diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000000..e69de29bb2d diff --git a/404.html b/404.html new file mode 100644 index 00000000000..ebf9b24d00b --- /dev/null +++ b/404.html @@ -0,0 +1,20 @@ + + + + + +Page Not Found | DeviceScript + + + + + + + + +
+
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

+ + + + \ No newline at end of file diff --git a/api/cli.html b/api/cli.html new file mode 100644 index 00000000000..5549f93ca3b --- /dev/null +++ b/api/cli.html @@ -0,0 +1,35 @@ + + + + + +Command Line Interface | DeviceScript + + + + + + + + +
+
Skip to main content

Command Line Interface

The DeviceScript command line (CLI) allows to compile and debug programs from your favorite IDE. +The CLI is also usable within containers (Docker, GitHub Codespaces, CodeSandbox, ...).

Setup

npm install @devicescript/cli@latest --save-dev

The command tool is named devicescript or devs for short. +The full list of options for each command is available through the CLI by running devs help <command>.

devs init [dir]

The init commands creates or updates the necessary files to get syntax completion +and checking in DeviceScript project (typically from Visual Studio Code).

devs init myproject

The command will create the files under myproject. A device script project will look as follows:

.devicescript/     reserved folder for devicescript generated files
package.json projet configuration
devsconfig.json configure the DeviceScript compiler with additional flags,
also used by VSCode extension to activate.
src/ directory for DeviceScript sources
src/main.ts usual name for your entry point application
src/tsconfig.json configure the TypeScript compiler to compile DeviceScript syntax
...
note

Make sure to keep the devsconfig.json file even if it is empty. +It is used as a marker to activate the Visual Studio Code extension.

--force

By default, init will not override existing tsconfig.json. Using this flag, you can override this setting +and force refreshing that file.

devs init --force

--no-install

Do not run npm or yarn install after dropping the files.

--board board-id

Specify the device identifier to use for the project. +The generate will patch ./src/main.ts and insert the board import statement.

devs add ...

The generated project by init is barebone by design. The add command can be used to +update the project with extra features. Each add command may require additional arguments.

add test

Configures the project to add DeviceScript unit tests.

devs add test

add board

Configures the project to add a custom device configuration (board).

devs add board

add service

Configures the project to add custom services.

devs add service

add sim

Configures the project to add a Node.JS subproject that runs simulated devices.

devs add sim

add npm

Prepare the project to be published to npm.js as a library.

devs add npm

devs build

The build command compiles the entry point file from the current project +using the resolution rules in tsconfig.json. It is the default command.

devs build

custom services and boards

The command line will automatically compile markdown files under the services folder (./services/*.md) +into TypeScript client definition in node_modules/@devicescript/core/src/services.d.ts.

--stats

The --stats flag enables printing additional debugging information about code size, +and other useful metrics.

devs build --stats

devs devtools

The devtools command launches the developer tool server, without trying to build a project.

devs devtools

build watch

To automatically rebuild your program based on file changes, +add the file name.

devs devtools main.ts

When the build is run in watch mode, it also opens a developer tool web server that allows +to execute the compiled program in a simulator or physical devices. Follow the console +application instructions to open the web page.

--internet

To access the developer tools outside localhost, add --internet

devs devtools --internet

devs flash

Command to flash the DeviceScript firmware onto a physical device. There are dedicated documentation +pages to support various MCU architectures.

devs bundle

Bundle firmware, DeviceScript program, and settings into one image. +Learn more

+ + + + \ No newline at end of file diff --git a/api/clients.html b/api/clients.html new file mode 100644 index 00000000000..af1787320b4 --- /dev/null +++ b/api/clients.html @@ -0,0 +1,22 @@ + + + + + +Clients | DeviceScript + + + + + + + + +
+
Skip to main content

Clients

In DeviceScript, hardware peripherals (and generally anything outside the VM) are modelled +as Jacdac services.

The peripherals are servers and the your client application creates clients to interact with them.

Declaring roles

Client instances, roles, should be allocated at the top level of your program. +The variable name is automatically assigned as the role name.

import { Temperature } from "@devicescript/core"

const thermometer = new Temperature()

Role binding state

You can test if the service is bound to a server.

import { Temperature } from "@devicescript/core"

const thermometer = new Temperature()

setInterval(async () => {
if (await thermometer.binding().read()) {
console.log("connected!")
}
}, 1000)
+ + + + \ No newline at end of file diff --git a/api/clients/accelerometer.html b/api/clients/accelerometer.html new file mode 100644 index 00000000000..5268d8a1f96 --- /dev/null +++ b/api/clients/accelerometer.html @@ -0,0 +1,21 @@ + + + + + +Accelerometer | DeviceScript + + + + + + + + +
+
Skip to main content

Accelerometer

A 3-axis accelerometer.

About

Orientation

An accelerometer module should translate acceleration values as follows:

OrientationX value (g)Y value (g)Z value (g)
Module lying flat00-1
Module on left edge-100
Module on bottom edge010

We recommend an orientation marking on the PCB so that users can mount modules without having to experiment with the device. Left/bottom can be determined by assuming text on silk runs left-to-right.

import { Accelerometer } from "@devicescript/core"

const accelerometer = new Accelerometer()

Registers

reading

Indicates the current forces acting on accelerometer.

  • type: Register<any[]> (packing format i12.20 i12.20 i12.20)

  • track incoming values

import { Accelerometer } from "@devicescript/core"

const accelerometer = new Accelerometer()
// ...
accelerometer.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reading value.

  • type: Register<number> (packing format u12.20)

  • optional: this register may not be implemented

  • read only

import { Accelerometer } from "@devicescript/core"

const accelerometer = new Accelerometer()
// ...
const value = await accelerometer.readingError.read()
  • track incoming values
import { Accelerometer } from "@devicescript/core"

const accelerometer = new Accelerometer()
// ...
accelerometer.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingRange

Configures the range forces detected. +The value will be "rounded up" to one of max_forces_supported.

  • type: Register<number> (packing format u12.20)

  • optional: this register may not be implemented

  • read and write

import { Accelerometer } from "@devicescript/core"

const accelerometer = new Accelerometer()
// ...
const value = await accelerometer.readingRange.read()
await accelerometer.readingRange.write(value)
  • track incoming values
import { Accelerometer } from "@devicescript/core"

const accelerometer = new Accelerometer()
// ...
accelerometer.readingRange.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

supportedRanges

Lists values supported for writing max_force.

  • type: Register<any[]> (packing format r: u12.20)
  • optional: this register may not be implemented
  • constant: the register value will not change (until the next reset)
note

write and read will block until a server is bound to the client.

Events

tiltUp

Emitted when accelerometer is tilted in the given direction.

accelerometer.tiltUp.subscribe(() => {

})

tiltDown

Emitted when accelerometer is tilted in the given direction.

accelerometer.tiltDown.subscribe(() => {

})

tiltLeft

Emitted when accelerometer is tilted in the given direction.

accelerometer.tiltLeft.subscribe(() => {

})

tiltRight

Emitted when accelerometer is tilted in the given direction.

accelerometer.tiltRight.subscribe(() => {

})

faceUp

Emitted when accelerometer is laying flat in the given direction.

accelerometer.faceUp.subscribe(() => {

})

faceDown

Emitted when accelerometer is laying flat in the given direction.

accelerometer.faceDown.subscribe(() => {

})

freefall

Emitted when total force acting on accelerometer is much less than 1g.

accelerometer.freefall.subscribe(() => {

})

shake

Emitted when forces change violently a few times.

accelerometer.shake.subscribe(() => {

})

force2g

Emitted when force in any direction exceeds given threshold.

accelerometer.force2g.subscribe(() => {

})

force3g

Emitted when force in any direction exceeds given threshold.

accelerometer.force3g.subscribe(() => {

})

force6g

Emitted when force in any direction exceeds given threshold.

accelerometer.force6g.subscribe(() => {

})

force8g

Emitted when force in any direction exceeds given threshold.

accelerometer.force8g.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/acidity.html b/api/clients/acidity.html new file mode 100644 index 00000000000..3415fce7ef7 --- /dev/null +++ b/api/clients/acidity.html @@ -0,0 +1,20 @@ + + + + + +Acidity | DeviceScript + + + + + + + + +
+
Skip to main content

Acidity

caution

This service is experimental and may change in the future.

A sensor measuring water acidity, commonly called pH.

import { Acidity } from "@devicescript/core"

const acidity = new Acidity()

Registers

reading

The acidity, pH, of water.

  • type: Register<number> (packing format u4.12)

  • read only

import { Acidity } from "@devicescript/core"

const acidity = new Acidity()
// ...
const value = await acidity.reading.read()
  • track incoming values
import { Acidity } from "@devicescript/core"

const acidity = new Acidity()
// ...
acidity.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the acidity reading.

  • type: Register<number> (packing format u4.12)

  • optional: this register may not be implemented

  • read only

import { Acidity } from "@devicescript/core"

const acidity = new Acidity()
// ...
const value = await acidity.readingError.read()
  • track incoming values
import { Acidity } from "@devicescript/core"

const acidity = new Acidity()
// ...
acidity.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Lowest acidity that can be reported.

  • type: Register<number> (packing format u4.12)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Acidity } from "@devicescript/core"

const acidity = new Acidity()
// ...
const value = await acidity.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Highest acidity that can be reported.

  • type: Register<number> (packing format u4.12)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Acidity } from "@devicescript/core"

const acidity = new Acidity()
// ...
const value = await acidity.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/airpressure.html b/api/clients/airpressure.html new file mode 100644 index 00000000000..46c93c180d8 --- /dev/null +++ b/api/clients/airpressure.html @@ -0,0 +1,20 @@ + + + + + +AirPressure | DeviceScript + + + + + + + + +
+
Skip to main content

AirPressure

caution

This service is rc and may change in the future.

A sensor measuring air pressure of outside environment.

import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()

Registers

reading

The air pressure.

  • type: Register<number> (packing format u22.10)

  • read only

import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()
// ...
const value = await airPressure.reading.read()
  • track incoming values
import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()
// ...
airPressure.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The real pressure is between pressure - pressure_error and pressure + pressure_error.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()
// ...
const value = await airPressure.readingError.read()
  • track incoming values
import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()
// ...
airPressure.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Lowest air pressure that can be reported.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()
// ...
const value = await airPressure.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Highest air pressure that can be reported.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { AirPressure } from "@devicescript/core"

const airPressure = new AirPressure()
// ...
const value = await airPressure.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/airqualityindex.html b/api/clients/airqualityindex.html new file mode 100644 index 00000000000..c3faa331ff3 --- /dev/null +++ b/api/clients/airqualityindex.html @@ -0,0 +1,21 @@ + + + + + +AirQualityIndex | DeviceScript + + + + + + + + +
+
Skip to main content

AirQualityIndex

caution

This service is experimental and may change in the future.

The Air Quality Index is a measure of how clean or polluted air is. From min, good quality, to high, low quality. +The range of AQI may vary between countries (https://en.wikipedia.org/wiki/Air_quality_index).

import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()

Registers

reading

Air quality index, typically refreshed every second.

  • type: Register<number> (packing format u16.16)

  • read only

import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()
// ...
const value = await airQualityIndex.reading.read()
  • track incoming values
import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()
// ...
airQualityIndex.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the AQI measure.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()
// ...
const value = await airQualityIndex.readingError.read()
  • track incoming values
import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()
// ...
airQualityIndex.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Minimum AQI reading, representing a good air quality. Typically 0.

  • type: Register<number> (packing format u16.16)

  • constant: the register value will not change (until the next reset)

  • read only

import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()
// ...
const value = await airQualityIndex.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Maximum AQI reading, representing a very poor air quality.

  • type: Register<number> (packing format u16.16)

  • constant: the register value will not change (until the next reset)

  • read only

import { AirQualityIndex } from "@devicescript/core"

const airQualityIndex = new AirQualityIndex()
// ...
const value = await airQualityIndex.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/arcadegamepad.html b/api/clients/arcadegamepad.html new file mode 100644 index 00000000000..73c024363af --- /dev/null +++ b/api/clients/arcadegamepad.html @@ -0,0 +1,20 @@ + + + + + +ArcadeGamepad | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/arcadesound.html b/api/clients/arcadesound.html new file mode 100644 index 00000000000..da8ac6dc368 --- /dev/null +++ b/api/clients/arcadesound.html @@ -0,0 +1,24 @@ + + + + + +ArcadeSound | DeviceScript + + + + + + + + +
+
Skip to main content

ArcadeSound

caution

This service is experimental and may change in the future.

A sound playing device.

This is typically run over an SPI connection, not regular single-wire Jacdac.

import { ArcadeSound } from "@devicescript/core"

const arcadeSound = new ArcadeSound()

Commands

play

Play samples, which are single channel, signed 16-bit little endian values.

arcadeSound.play(samples: Buffer): Promise<void>

Registers

sampleRate

Get or set playback sample rate (in samples per second). +If you set it, read it back, as the value may be rounded up or down.

  • type: Register<number> (packing format u22.10)

  • read and write

import { ArcadeSound } from "@devicescript/core"

const arcadeSound = new ArcadeSound()
// ...
const value = await arcadeSound.sampleRate.read()
await arcadeSound.sampleRate.write(value)
  • track incoming values
import { ArcadeSound } from "@devicescript/core"

const arcadeSound = new ArcadeSound()
// ...
arcadeSound.sampleRate.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

bufferSize

The size of the internal audio buffer.

  • type: Register<number> (packing format u32)

  • constant: the register value will not change (until the next reset)

  • read only

import { ArcadeSound } from "@devicescript/core"

const arcadeSound = new ArcadeSound()
// ...
const value = await arcadeSound.bufferSize.read()
note

write and read will block until a server is bound to the client.

bufferPending

How much data is still left in the buffer to play. +Clients should not send more data than buffer_size - buffer_pending, +but can keep the buffer_pending as low as they want to ensure low latency +of audio playback.

  • type: Register<number> (packing format u32)

  • read only

import { ArcadeSound } from "@devicescript/core"

const arcadeSound = new ArcadeSound()
// ...
const value = await arcadeSound.bufferPending.read()
  • track incoming values
import { ArcadeSound } from "@devicescript/core"

const arcadeSound = new ArcadeSound()
// ...
arcadeSound.bufferPending.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/barcodereader.html b/api/clients/barcodereader.html new file mode 100644 index 00000000000..17c68697b66 --- /dev/null +++ b/api/clients/barcodereader.html @@ -0,0 +1,21 @@ + + + + + +BarcodeReader | DeviceScript + + + + + + + + +
+
Skip to main content

BarcodeReader

caution

This service is experimental and may change in the future.

A device that reads various barcodes, like QR codes. For the web, see BarcodeDetector.

import { BarcodeReader } from "@devicescript/core"

const barcodeReader = new BarcodeReader()

Registers

enabled

Turns on or off the detection of barcodes.

  • type: Register<boolean> (packing format u8)

  • read and write

import { BarcodeReader } from "@devicescript/core"

const barcodeReader = new BarcodeReader()
// ...
const value = await barcodeReader.enabled.read()
await barcodeReader.enabled.write(value)
  • track incoming values
import { BarcodeReader } from "@devicescript/core"

const barcodeReader = new BarcodeReader()
// ...
barcodeReader.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

formats

Reports the list of supported barcode formats, as documented in https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API.

  • type: Register<any[]> (packing format r: u8)
  • optional: this register may not be implemented
  • constant: the register value will not change (until the next reset)
note

write and read will block until a server is bound to the client.

Events

detect

Raised when a bar code is detected and decoded. If the reader detects multiple codes, it will issue multiple events. +In case of numeric barcodes, the data field should contain the ASCII (which is the same as UTF8 in that case) representation of the number.

barcodeReader.detect.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/bitradio.html b/api/clients/bitradio.html new file mode 100644 index 00000000000..c17f5796276 --- /dev/null +++ b/api/clients/bitradio.html @@ -0,0 +1,20 @@ + + + + + +BitRadio | DeviceScript + + + + + + + + +
+
Skip to main content

BitRadio

Support for sending and receiving packets using the Bit Radio protocol, typically used between micro:bit devices.

import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()

Commands

sendString

Sends a string payload as a radio message, maximum 18 characters.

bitRadio.sendString(message: string): Promise<void>

sendNumber

Sends a double precision number payload as a radio message

bitRadio.sendNumber(value: number): Promise<void>

sendValue

Sends a double precision number and a name payload as a radio message

bitRadio.sendValue(value: number, name: string): Promise<void>

sendBuffer

Sends a payload of bytes as a radio message

bitRadio.sendBuffer(data: Buffer): Promise<void>

Registers

enabled

Turns on/off the radio antenna.

  • type: Register<boolean> (packing format u8)

  • read and write

import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
const value = await bitRadio.enabled.read()
await bitRadio.enabled.write(value)
  • track incoming values
import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
bitRadio.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

group

Group used to filter packets

  • type: Register<number> (packing format u8)

  • read and write

import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
const value = await bitRadio.group.read()
await bitRadio.group.write(value)
  • track incoming values
import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
bitRadio.group.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

transmissionPower

Antenna power to increase or decrease range.

  • type: Register<number> (packing format u8)

  • read and write

import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
const value = await bitRadio.transmissionPower.read()
await bitRadio.transmissionPower.write(value)
  • track incoming values
import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
bitRadio.transmissionPower.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

frequencyBand

Change the transmission and reception band of the radio to the given channel.

  • type: Register<number> (packing format u8)

  • read and write

import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
const value = await bitRadio.frequencyBand.read()
await bitRadio.frequencyBand.write(value)
  • track incoming values
import { BitRadio } from "@devicescript/core"

const bitRadio = new BitRadio()
// ...
bitRadio.frequencyBand.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/bootloader.html b/api/clients/bootloader.html new file mode 100644 index 00000000000..a1d4094786a --- /dev/null +++ b/api/clients/bootloader.html @@ -0,0 +1,21 @@ + + + + + +Bootloader | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/brailledisplay.html b/api/clients/brailledisplay.html new file mode 100644 index 00000000000..a3cb6c1864e --- /dev/null +++ b/api/clients/brailledisplay.html @@ -0,0 +1,20 @@ + + + + + +BrailleDisplay | DeviceScript + + + + + + + + +
+
Skip to main content

BrailleDisplay

A Braille pattern display module. This module display unicode braille patterns, country specific encoding have to be implemented by the clients.

import { BrailleDisplay } from "@devicescript/core"

const brailleDisplay = new BrailleDisplay()

Registers

enabled

Determines if the braille display is active.

  • type: Register<boolean> (packing format u8)

  • read and write

import { BrailleDisplay } from "@devicescript/core"

const brailleDisplay = new BrailleDisplay()
// ...
const value = await brailleDisplay.enabled.read()
await brailleDisplay.enabled.write(value)
  • track incoming values
import { BrailleDisplay } from "@devicescript/core"

const brailleDisplay = new BrailleDisplay()
// ...
brailleDisplay.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

length

Gets the number of patterns that can be displayed.

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { BrailleDisplay } from "@devicescript/core"

const brailleDisplay = new BrailleDisplay()
// ...
const value = await brailleDisplay.length.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/bridge.html b/api/clients/bridge.html new file mode 100644 index 00000000000..d3722a1d033 --- /dev/null +++ b/api/clients/bridge.html @@ -0,0 +1,21 @@ + + + + + +Bridge | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/button.html b/api/clients/button.html new file mode 100644 index 00000000000..79eee837d7d --- /dev/null +++ b/api/clients/button.html @@ -0,0 +1,24 @@ + + + + + +Button | DeviceScript + + + + + + + + +
+
Skip to main content

Button

A push-button, which returns to inactive position when not operated anymore.

import { Button } from "@devicescript/core"

const button = new Button()

Registers

reading

Indicates the pressure state of the button, where 0 is open.

  • type: Register<number> (packing format u0.16)

  • read only

import { Button } from "@devicescript/core"

const button = new Button()
// ...
const value = await button.reading.read()
  • track incoming values
import { Button } from "@devicescript/core"

const button = new Button()
// ...
button.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

analog

Indicates if the button provides analog pressure readings.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Button } from "@devicescript/core"

const button = new Button()
// ...
const value = await button.analog.read()
note

write and read will block until a server is bound to the client.

pressed

Determines if the button is pressed currently.

If the event down or hold is observed, pressed becomes true; if up is observed, pressed becomes false. +The client should initialize pressed to false.

  • type: Register<boolean> (packing format u8)

  • read only

import { Button } from "@devicescript/core"

const button = new Button()
// ...
const value = await button.pressed.read()
  • track incoming values
import { Button } from "@devicescript/core"

const button = new Button()
// ...
button.pressed.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

Events

down

Emitted when button goes from inactive to active.

button.down.subscribe(() => {

})

up

Emitted when button goes from active to inactive. The 'time' parameter +records the amount of time between the down and up events.

button.up.subscribe(() => {

})

hold

Emitted when the press time is greater than 500ms, and then at least every 500ms +as long as the button remains pressed. The 'time' parameter records the the amount of time +that the button has been held (since the down event).

button.hold.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/buzzer.html b/api/clients/buzzer.html new file mode 100644 index 00000000000..f6f90b1ce11 --- /dev/null +++ b/api/clients/buzzer.html @@ -0,0 +1,20 @@ + + + + + +Buzzer | DeviceScript + + + + + + + + +
+
Skip to main content

Buzzer

caution

This service is rc and may change in the future.

A simple buzzer.

import { Buzzer } from "@devicescript/core"

const buzzer = new Buzzer()

Commands

playNote

Play a note at the given frequency and volume.

buzzer.playNote(frequency: number, volume: number, duration: number): Promise<void>

Registers

intensity

The volume (duty cycle) of the buzzer.

  • type: Register<number> (packing format u0.8)

  • read and write

import { Buzzer } from "@devicescript/core"

const buzzer = new Buzzer()
// ...
const value = await buzzer.intensity.read()
await buzzer.intensity.write(value)
  • track incoming values
import { Buzzer } from "@devicescript/core"

const buzzer = new Buzzer()
// ...
buzzer.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/capacitivebutton.html b/api/clients/capacitivebutton.html new file mode 100644 index 00000000000..aea97089a23 --- /dev/null +++ b/api/clients/capacitivebutton.html @@ -0,0 +1,21 @@ + + + + + +CapacitiveButton | DeviceScript + + + + + + + + +
+
Skip to main content

CapacitiveButton

caution

This service is rc and may change in the future.

A configuration service for a capacitive push-button.

import { CapacitiveButton } from "@devicescript/core"

const capacitiveButton = new CapacitiveButton()

Commands

calibrate

Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button. +The report indicates the calibration is done.

capacitiveButton.calibrate(): Promise<void>

Registers

activeThreshold

Indicates the threshold for up events.

  • type: Register<number> (packing format u0.16)

  • read and write

import { CapacitiveButton } from "@devicescript/core"

const capacitiveButton = new CapacitiveButton()
// ...
const value = await capacitiveButton.activeThreshold.read()
await capacitiveButton.activeThreshold.write(value)
  • track incoming values
import { CapacitiveButton } from "@devicescript/core"

const capacitiveButton = new CapacitiveButton()
// ...
capacitiveButton.activeThreshold.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/characterscreen.html b/api/clients/characterscreen.html new file mode 100644 index 00000000000..eeda8fd4278 --- /dev/null +++ b/api/clients/characterscreen.html @@ -0,0 +1,20 @@ + + + + + +CharacterScreen | DeviceScript + + + + + + + + +
+
Skip to main content

CharacterScreen

caution

This service is rc and may change in the future.

A screen that displays characters, typically a LCD/OLED character screen.

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()

Registers

message

Text to show. Use \n to break lines.

  • type: Register<string> (packing format s)

  • read and write

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
const value = await characterScreen.message.read()
await characterScreen.message.write(value)
  • track incoming values
import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
characterScreen.message.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

intensity

Brightness of the screen. 0 means off.

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read and write

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
const value = await characterScreen.intensity.read()
await characterScreen.intensity.write(value)
  • track incoming values
import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
characterScreen.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Describes the type of character LED screen.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
const value = await characterScreen.variant.read()
note

write and read will block until a server is bound to the client.

textDirection

Specifies the RTL or LTR direction of the text.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • read and write

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
const value = await characterScreen.textDirection.read()
await characterScreen.textDirection.write(value)
  • track incoming values
import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
characterScreen.textDirection.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

rows

Gets the number of rows.

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
const value = await characterScreen.rows.read()
note

write and read will block until a server is bound to the client.

columns

Gets the number of columns.

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { CharacterScreen } from "@devicescript/core"

const characterScreen = new CharacterScreen()
// ...
const value = await characterScreen.columns.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/cloudadapter.html b/api/clients/cloudadapter.html new file mode 100644 index 00000000000..577293993b8 --- /dev/null +++ b/api/clients/cloudadapter.html @@ -0,0 +1,21 @@ + + + + + +CloudAdapter | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/cloudconfiguration.html b/api/clients/cloudconfiguration.html new file mode 100644 index 00000000000..a6e474e2f60 --- /dev/null +++ b/api/clients/cloudconfiguration.html @@ -0,0 +1,21 @@ + + + + + +CloudConfiguration | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/codalmessagebus.html b/api/clients/codalmessagebus.html new file mode 100644 index 00000000000..aff6cc9aad3 --- /dev/null +++ b/api/clients/codalmessagebus.html @@ -0,0 +1,21 @@ + + + + + +CodalMessageBus | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/color.html b/api/clients/color.html new file mode 100644 index 00000000000..6a2d2dd6d7d --- /dev/null +++ b/api/clients/color.html @@ -0,0 +1,20 @@ + + + + + +Color | DeviceScript + + + + + + + + +
+
Skip to main content

Color

caution

This service is experimental and may change in the future.

Senses RGB colors

import { Color } from "@devicescript/core"

const color = new Color()

Registers

reading

Detected color in the RGB color space.

  • type: Register<any[]> (packing format u0.16 u0.16 u0.16)

  • track incoming values

import { Color } from "@devicescript/core"

const color = new Color()
// ...
color.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/compass.html b/api/clients/compass.html new file mode 100644 index 00000000000..861750fd6ea --- /dev/null +++ b/api/clients/compass.html @@ -0,0 +1,20 @@ + + + + + +Compass | DeviceScript + + + + + + + + +
+
Skip to main content

Compass

caution

This service is rc and may change in the future.

A sensor that measures the heading.

import { Compass } from "@devicescript/core"

const compass = new Compass()

Commands

calibrate

Starts a calibration sequence for the compass.

compass.calibrate(): Promise<void>

Registers

reading

The heading with respect to the magnetic north.

  • type: Register<number> (packing format u16.16)

  • read only

import { Compass } from "@devicescript/core"

const compass = new Compass()
// ...
const value = await compass.reading.read()
  • track incoming values
import { Compass } from "@devicescript/core"

const compass = new Compass()
// ...
compass.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turn on or off the sensor. Turning on the sensor may start a calibration sequence.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Compass } from "@devicescript/core"

const compass = new Compass()
// ...
const value = await compass.enabled.read()
await compass.enabled.write(value)
  • track incoming values
import { Compass } from "@devicescript/core"

const compass = new Compass()
// ...
compass.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the heading reading

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { Compass } from "@devicescript/core"

const compass = new Compass()
// ...
const value = await compass.readingError.read()
  • track incoming values
import { Compass } from "@devicescript/core"

const compass = new Compass()
// ...
compass.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/control.html b/api/clients/control.html new file mode 100644 index 00000000000..66646a2eda5 --- /dev/null +++ b/api/clients/control.html @@ -0,0 +1,21 @@ + + + + + +Control | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/dashboard.html b/api/clients/dashboard.html new file mode 100644 index 00000000000..60dce975589 --- /dev/null +++ b/api/clients/dashboard.html @@ -0,0 +1,21 @@ + + + + + +Dashboard | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/dccurrentmeasurement.html b/api/clients/dccurrentmeasurement.html new file mode 100644 index 00000000000..19363d36b3d --- /dev/null +++ b/api/clients/dccurrentmeasurement.html @@ -0,0 +1,20 @@ + + + + + +DcCurrentMeasurement | DeviceScript + + + + + + + + +
+
Skip to main content

DcCurrentMeasurement

caution

This service is experimental and may change in the future.

A service that reports a current measurement.

import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()

Registers

measurementName

A string containing the net name that is being measured e.g. POWER_DUT or a reference e.g. DIFF_DEV1_DEV2. These constants can be used to identify a measurement from client code.

  • type: Register<string> (packing format s)

  • constant: the register value will not change (until the next reset)

  • read only

import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
const value = await dcCurrentMeasurement.measurementName.read()
note

write and read will block until a server is bound to the client.

reading

The current measurement.

  • type: Register<number> (packing format f64)

  • read only

import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
const value = await dcCurrentMeasurement.reading.read()
  • track incoming values
import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
dcCurrentMeasurement.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Absolute error on the reading value.

  • type: Register<number> (packing format f64)

  • optional: this register may not be implemented

  • read only

import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
const value = await dcCurrentMeasurement.readingError.read()
  • track incoming values
import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
dcCurrentMeasurement.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Minimum measurable current

  • type: Register<number> (packing format f64)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
const value = await dcCurrentMeasurement.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Maximum measurable current

  • type: Register<number> (packing format f64)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DcCurrentMeasurement } from "@devicescript/core"

const dcCurrentMeasurement = new DcCurrentMeasurement()
// ...
const value = await dcCurrentMeasurement.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/dcvoltagemeasurement.html b/api/clients/dcvoltagemeasurement.html new file mode 100644 index 00000000000..8b8340b8e0f --- /dev/null +++ b/api/clients/dcvoltagemeasurement.html @@ -0,0 +1,20 @@ + + + + + +DcVoltageMeasurement | DeviceScript + + + + + + + + +
+
Skip to main content

DcVoltageMeasurement

caution

This service is experimental and may change in the future.

A service that reports a voltage measurement.

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()

Registers

measurementType

The type of measurement that is taking place. Absolute results are measured with respect to ground, whereas differential results are measured against another signal that is not ground.

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
const value = await dcVoltageMeasurement.measurementType.read()
note

write and read will block until a server is bound to the client.

measurementName

A string containing the net name that is being measured e.g. POWER_DUT or a reference e.g. DIFF_DEV1_DEV2. These constants can be used to identify a measurement from client code.

  • type: Register<string> (packing format s)

  • constant: the register value will not change (until the next reset)

  • read only

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
const value = await dcVoltageMeasurement.measurementName.read()
note

write and read will block until a server is bound to the client.

reading

The voltage measurement.

  • type: Register<number> (packing format f64)

  • read only

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
const value = await dcVoltageMeasurement.reading.read()
  • track incoming values
import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
dcVoltageMeasurement.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Absolute error on the reading value.

  • type: Register<number> (packing format f64)

  • optional: this register may not be implemented

  • read only

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
const value = await dcVoltageMeasurement.readingError.read()
  • track incoming values
import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
dcVoltageMeasurement.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Minimum measurable current

  • type: Register<number> (packing format f64)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
const value = await dcVoltageMeasurement.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Maximum measurable current

  • type: Register<number> (packing format f64)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DcVoltageMeasurement } from "@devicescript/core"

const dcVoltageMeasurement = new DcVoltageMeasurement()
// ...
const value = await dcVoltageMeasurement.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/devicescriptcondition.html b/api/clients/devicescriptcondition.html new file mode 100644 index 00000000000..4afc3a21b3f --- /dev/null +++ b/api/clients/devicescriptcondition.html @@ -0,0 +1,20 @@ + + + + + +DeviceScriptCondition | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/devicescriptdebugger.html b/api/clients/devicescriptdebugger.html new file mode 100644 index 00000000000..2c81e20333a --- /dev/null +++ b/api/clients/devicescriptdebugger.html @@ -0,0 +1,21 @@ + + + + + +DevsDbg | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/devicescriptmanager.html b/api/clients/devicescriptmanager.html new file mode 100644 index 00000000000..34ae85980c4 --- /dev/null +++ b/api/clients/devicescriptmanager.html @@ -0,0 +1,21 @@ + + + + + +DeviceScriptManager | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/distance.html b/api/clients/distance.html new file mode 100644 index 00000000000..84853abf14c --- /dev/null +++ b/api/clients/distance.html @@ -0,0 +1,20 @@ + + + + + +Distance | DeviceScript + + + + + + + + +
+
Skip to main content

Distance

A sensor that determines the distance of an object without any physical contact involved.

import { Distance } from "@devicescript/core"

const distance = new Distance()

Registers

reading

Current distance from the object

  • type: Register<number> (packing format u16.16)

  • read only

import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
const value = await distance.reading.read()
  • track incoming values
import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
distance.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Absolute error on the reading value.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
const value = await distance.readingError.read()
  • track incoming values
import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
distance.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Minimum measurable distance

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
const value = await distance.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Maximum measurable distance

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
const value = await distance.maxReading.read()
note

write and read will block until a server is bound to the client.

variant

Determines the type of sensor used.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Distance } from "@devicescript/core"

const distance = new Distance()
// ...
const value = await distance.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/dmx.html b/api/clients/dmx.html new file mode 100644 index 00000000000..ebb407cd49f --- /dev/null +++ b/api/clients/dmx.html @@ -0,0 +1,20 @@ + + + + + +Dmx | DeviceScript + + + + + + + + +
+
Skip to main content

Dmx

caution

This service is experimental and may change in the future.

A service that can send DMX512-A packets with limited size. This service is designed to allow tinkering with a few DMX devices, but only allows 235 channels. More about DMX at https://en.wikipedia.org/wiki/DMX512.

import { Dmx } from "@devicescript/core"

const dmx = new Dmx()

Commands

send

Send a DMX packet, up to 236bytes long, including the start code.

dmx.send(channels: Buffer): Promise<void>

Registers

enabled

Determines if the DMX bridge is active.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Dmx } from "@devicescript/core"

const dmx = new Dmx()
// ...
const value = await dmx.enabled.read()
await dmx.enabled.write(value)
  • track incoming values
import { Dmx } from "@devicescript/core"

const dmx = new Dmx()
// ...
dmx.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/dotmatrix.html b/api/clients/dotmatrix.html new file mode 100644 index 00000000000..98893639a35 --- /dev/null +++ b/api/clients/dotmatrix.html @@ -0,0 +1,28 @@ + + + + + +DotMatrix | DeviceScript + + + + + + + + +
+
Skip to main content

DotMatrix

caution

This service is rc and may change in the future.

A rectangular dot matrix display, made of monochrome LEDs or Braille pins.

import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()

Registers

dots

The state of the screen where dot on/off state is +stored as a bit, column by column. The column should be byte aligned.

For example, if the display has no more than 8 rows in each column, then each byte contains bits corresponding +to a single column. Least-significant bit is on top. +If display has 10 rows, then each column is represented by two bytes. +The top-most 8 rows sit in the first byte (with the least significant bit being on top), +and the remainign 2 row sit in the second byte.

The following C expression can be used to check if a given column, row coordinate is set: +dots[column * column_size + (row >> 3)] & (1 << (row & 7)), where +column_size is (number_of_rows + 7) >> 3 (note that if number of rows is 8 or less then column_size is 1), +and dots is of uint8_t* type.

The size of this register is number_of_columns * column_size bytes.

  • type: Register<Buffer> (packing format b)

  • track incoming values

import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()
// ...
dotMatrix.dots.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

intensity

Reads the general brightness of the display, brightness for LEDs. 0 when the screen is off.

  • type: Register<number> (packing format u0.8)

  • optional: this register may not be implemented

  • read and write

import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.intensity.read()
await dotMatrix.intensity.write(value)
  • track incoming values
import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()
// ...
dotMatrix.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

rows

Number of rows on the screen

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.rows.read()
note

write and read will block until a server is bound to the client.

columns

Number of columns on the screen

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.columns.read()
note

write and read will block until a server is bound to the client.

variant

Describes the type of matrix used.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DotMatrix } from "@devicescript/core"

const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/dualmotors.html b/api/clients/dualmotors.html new file mode 100644 index 00000000000..27a5f736aec --- /dev/null +++ b/api/clients/dualmotors.html @@ -0,0 +1,21 @@ + + + + + +DualMotors | DeviceScript + + + + + + + + +
+
Skip to main content

DualMotors

caution

This service is experimental and may change in the future.

A synchronized pair of motors.

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()

Registers

speed

Relative speed of the motors. Use positive/negative values to run the motor forwards and backwards. +A speed of 0 while enabled acts as brake.

  • type: Register<any[]> (packing format i1.15 i1.15)

  • track incoming values

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
dualMotors.speed.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turn the power to the motors on/off.

  • type: Register<boolean> (packing format u8)

  • read and write

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.enabled.read()
await dualMotors.enabled.write(value)
  • track incoming values
import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
dualMotors.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

loadTorque

Torque required to produce the rated power of an each electrical motor at load speed.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.loadTorque.read()
note

write and read will block until a server is bound to the client.

loadRotationSpeed

Revolutions per minute of the motor under full load.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.loadRotationSpeed.read()
note

write and read will block until a server is bound to the client.

reversible

Indicates if the motors can run backwards.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.reversible.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/eco2.html b/api/clients/eco2.html new file mode 100644 index 00000000000..b05bc8231bb --- /dev/null +++ b/api/clients/eco2.html @@ -0,0 +1,20 @@ + + + + + +ECO2 | DeviceScript + + + + + + + + +
+
Skip to main content

ECO2

caution

This service is rc and may change in the future.

Measures equivalent CO₂ levels.

import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()

Registers

reading

Equivalent CO₂ (eCO₂) readings.

  • type: Register<number> (packing format u22.10)

  • read only

import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
const value = await eCO2.reading.read()
  • track incoming values
import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
eCO2.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reading value.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
const value = await eCO2.readingError.read()
  • track incoming values
import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
eCO2.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Minimum measurable value

  • type: Register<number> (packing format u22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
const value = await eCO2.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Minimum measurable value

  • type: Register<number> (packing format u22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
const value = await eCO2.maxReading.read()
note

write and read will block until a server is bound to the client.

variant

Type of physical sensor and capabilities.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { ECO2 } from "@devicescript/core"

const eCO2 = new ECO2()
// ...
const value = await eCO2.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/flex.html b/api/clients/flex.html new file mode 100644 index 00000000000..ae1f9ce39ea --- /dev/null +++ b/api/clients/flex.html @@ -0,0 +1,20 @@ + + + + + +Flex | DeviceScript + + + + + + + + +
+
Skip to main content

Flex

caution

This service is rc and may change in the future.

A bending or deflection sensor.

import { Flex } from "@devicescript/core"

const flex = new Flex()

Registers

reading

A measure of the bending.

  • type: Register<number> (packing format i1.15)

  • read only

import { Flex } from "@devicescript/core"

const flex = new Flex()
// ...
const value = await flex.reading.read()
  • track incoming values
import { Flex } from "@devicescript/core"

const flex = new Flex()
// ...
flex.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

length

Length of the flex sensor

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Flex } from "@devicescript/core"

const flex = new Flex()
// ...
const value = await flex.length.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/gamepad.html b/api/clients/gamepad.html new file mode 100644 index 00000000000..828532e4abf --- /dev/null +++ b/api/clients/gamepad.html @@ -0,0 +1,26 @@ + + + + + +Gamepad | DeviceScript + + + + + + + + +
+
Skip to main content

Gamepad

caution

This service is rc and may change in the future.

A two axis directional gamepad with optional buttons.

import { Gamepad } from "@devicescript/core"

const gamepad = new Gamepad()

Registers

axes

An array representing the controls with axes present on the device (e.g. analog thumb sticks), +as [x, y]. Each entry in the array is a floating point value in the range -1.0 – 1.0``, representing the axis position from the lowest value (-1.0) to the highest value (1.0`).

  • type: ClientRegister<{ x: number; y: number }> (packing format i1.15 i1.15)
import { Gamepad } from "@devicescript/core"

const gamepad = new Gamepad()
// ...
gamepad.axes.subscribe(async ({ x, y }) => {
console.log({ x, y })
})

button

A client register for the requested button or combination of buttons. The value is true if the button is pressed, false otherwise.

  • type: ClientRegister<GamepadButtons>
import { Gamepad, GamepadButtons } from "@devicescript/core"

const gamepad = new Gamepad()
// ...
gamepad.button(GamepadButtons.Down).subscribe(async pressed => {
console.log({ pressed })
})

reading

If the gamepad is analog, the directional buttons should be "simulated", based on gamepad position +(Left is { x = -1, y = 0 }, Up is { x = 0, y = -1}). +If the gamepad is digital, then each direction will read as either -1, 0, or 1 (in fixed representation). +The primary button on the gamepad is A.

  • type: Register<any[]> (packing format u32 i1.15 i1.15)

  • track incoming values

import { Gamepad } from "@devicescript/core"

const gamepad = new Gamepad()
// ...
gamepad.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of physical gamepad.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Gamepad } from "@devicescript/core"

const gamepad = new Gamepad()
// ...
const value = await gamepad.variant.read()
note

write and read will block until a server is bound to the client.

buttonsAvailable

Indicates a bitmask of the buttons that are mounted on the gamepad. +If the Left/Up/Right/Down buttons are marked as available here, the gamepad is digital. +Even when marked as not available, they will still be simulated based on the analog gamepad.

  • type: Register<number> (packing format u32)

  • constant: the register value will not change (until the next reset)

  • read only

import { Gamepad } from "@devicescript/core"

const gamepad = new Gamepad()
// ...
const value = await gamepad.buttonsAvailable.read()
note

write and read will block until a server is bound to the client.

Events

change

Emitted whenever the state of buttons changes.

gamepad.change.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/gpio.html b/api/clients/gpio.html new file mode 100644 index 00000000000..d09b7925846 --- /dev/null +++ b/api/clients/gpio.html @@ -0,0 +1,21 @@ + + + + + +GPIO | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/gyroscope.html b/api/clients/gyroscope.html new file mode 100644 index 00000000000..01433469a2f --- /dev/null +++ b/api/clients/gyroscope.html @@ -0,0 +1,21 @@ + + + + + +Gyroscope | DeviceScript + + + + + + + + +
+
Skip to main content

Gyroscope

caution

This service is rc and may change in the future.

A 3-axis gyroscope.

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()

Registers

reading

Indicates the current rates acting on gyroscope.

  • type: Register<any[]> (packing format i12.20 i12.20 i12.20)

  • track incoming values

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
gyroscope.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reading value.

  • type: Register<number> (packing format u12.20)

  • optional: this register may not be implemented

  • read only

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
const value = await gyroscope.readingError.read()
  • track incoming values
import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
gyroscope.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingRange

Configures the range of rotation rates. +The value will be "rounded up" to one of max_rates_supported.

  • type: Register<number> (packing format u12.20)

  • optional: this register may not be implemented

  • read and write

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
const value = await gyroscope.readingRange.read()
await gyroscope.readingRange.write(value)
  • track incoming values
import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
gyroscope.readingRange.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

supportedRanges

Lists values supported for writing max_rate.

  • type: Register<any[]> (packing format r: u12.20)
  • optional: this register may not be implemented
  • constant: the register value will not change (until the next reset)
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/heartrate.html b/api/clients/heartrate.html new file mode 100644 index 00000000000..7b5ada9fe5f --- /dev/null +++ b/api/clients/heartrate.html @@ -0,0 +1,20 @@ + + + + + +HeartRate | DeviceScript + + + + + + + + +
+
Skip to main content

HeartRate

caution

This service is experimental and may change in the future.

A sensor approximating the heart rate.

Jacdac is NOT suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()

Registers

reading

The estimated heart rate.

  • type: Register<number> (packing format u16.16)

  • read only

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
const value = await heartRate.reading.read()
  • track incoming values
import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
heartRate.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The estimated error on the reported sensor data.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
const value = await heartRate.readingError.read()
  • track incoming values
import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
heartRate.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of physical sensor

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { HeartRate } from "@devicescript/core"

const heartRate = new HeartRate()
// ...
const value = await heartRate.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/hidjoystick.html b/api/clients/hidjoystick.html new file mode 100644 index 00000000000..9d0f87be072 --- /dev/null +++ b/api/clients/hidjoystick.html @@ -0,0 +1,20 @@ + + + + + +HidJoystick | DeviceScript + + + + + + + + +
+
Skip to main content

HidJoystick

caution

This service is experimental and may change in the future.

Controls a HID joystick.

import { HidJoystick } from "@devicescript/core"

const hidJoystick = new HidJoystick()

Commands

setButtons

Sets the up/down button state, one byte per button, supports analog buttons. For digital buttons, use 0 for released, 1 for pressed.

hidJoystick.setButtons(...pressure: number[]): Promise<void>

setAxis

Sets the state of analog inputs.

hidJoystick.setAxis(...position: number[]): Promise<void>

Registers

buttonCount

Number of button report supported

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { HidJoystick } from "@devicescript/core"

const hidJoystick = new HidJoystick()
// ...
const value = await hidJoystick.buttonCount.read()
note

write and read will block until a server is bound to the client.

buttonsAnalog

A bitset that indicates which button is analog.

  • type: Register<number> (packing format u32)

  • constant: the register value will not change (until the next reset)

  • read only

import { HidJoystick } from "@devicescript/core"

const hidJoystick = new HidJoystick()
// ...
const value = await hidJoystick.buttonsAnalog.read()
note

write and read will block until a server is bound to the client.

axisCount

Number of analog input supported

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { HidJoystick } from "@devicescript/core"

const hidJoystick = new HidJoystick()
// ...
const value = await hidJoystick.axisCount.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/hidkeyboard.html b/api/clients/hidkeyboard.html new file mode 100644 index 00000000000..0a969713adb --- /dev/null +++ b/api/clients/hidkeyboard.html @@ -0,0 +1,22 @@ + + + + + +HidKeyboard | DeviceScript + + + + + + + + +
+
Skip to main content

HidKeyboard

Control a HID keyboard.

The codes for the key (selectors) is defined in the HID Keyboard +specification, chapter 10 Keyboard/Keypad Page, page 81. +Modifiers are in page 87.

The device keeps tracks of the key state and is able to clear it all with the clear command.

import { HidKeyboard } from "@devicescript/core"

const hidKeyboard = new HidKeyboard()

Commands

clear

Clears all pressed keys.

hidKeyboard.clear(): Promise<void>

+ + + + \ No newline at end of file diff --git a/api/clients/hidmouse.html b/api/clients/hidmouse.html new file mode 100644 index 00000000000..c485d33901c --- /dev/null +++ b/api/clients/hidmouse.html @@ -0,0 +1,24 @@ + + + + + +HidMouse | DeviceScript + + + + + + + + +
+
Skip to main content

HidMouse

Controls a HID mouse.

import { HidMouse } from "@devicescript/core"

const hidMouse = new HidMouse()

Commands

setButton

Sets the up/down state of one or more buttons. +A Click is the same as Down followed by Up after 100ms. +A DoubleClick is two clicks with 150ms gap between them (that is, 100ms first click, 150ms gap, 100ms second click).

hidMouse.setButton(buttons: HidMouseButton, ev: HidMouseButtonEvent): Promise<void>

move

Moves the mouse by the distance specified. +If the time is positive, it specifies how long to make the move.

hidMouse.move(dx: number, dy: number, time: number): Promise<void>

wheel

Turns the wheel up or down. Positive if scrolling up. +If the time is positive, it specifies how long to make the move.

hidMouse.wheel(dy: number, time: number): Promise<void>

+ + + + \ No newline at end of file diff --git a/api/clients/humidity.html b/api/clients/humidity.html new file mode 100644 index 00000000000..84f9a1448c4 --- /dev/null +++ b/api/clients/humidity.html @@ -0,0 +1,20 @@ + + + + + +Humidity | DeviceScript + + + + + + + + +
+
Skip to main content

Humidity

A sensor measuring humidity of outside environment.

import { Humidity } from "@devicescript/core"

const humidity = new Humidity()

Registers

reading

The relative humidity in percentage of full water saturation.

  • type: Register<number> (packing format u22.10)

  • read only

import { Humidity } from "@devicescript/core"

const humidity = new Humidity()
// ...
const value = await humidity.reading.read()
  • track incoming values
import { Humidity } from "@devicescript/core"

const humidity = new Humidity()
// ...
humidity.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The real humidity is between humidity - humidity_error and humidity + humidity_error.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { Humidity } from "@devicescript/core"

const humidity = new Humidity()
// ...
const value = await humidity.readingError.read()
  • track incoming values
import { Humidity } from "@devicescript/core"

const humidity = new Humidity()
// ...
humidity.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Lowest humidity that can be reported.

  • type: Register<number> (packing format u22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { Humidity } from "@devicescript/core"

const humidity = new Humidity()
// ...
const value = await humidity.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Highest humidity that can be reported.

  • type: Register<number> (packing format u22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { Humidity } from "@devicescript/core"

const humidity = new Humidity()
// ...
const value = await humidity.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/i2c.html b/api/clients/i2c.html new file mode 100644 index 00000000000..5d3e9c1cb02 --- /dev/null +++ b/api/clients/i2c.html @@ -0,0 +1,22 @@ + + + + + +I2C | DeviceScript + + + + + + + + +
+
Skip to main content

I2C

The I2C service is used internally by the +@devicescript/i2c package.

Usage

Read-write register byte

import { i2c } from "@devicescript/i2c"

const address = 0x..
const register = 0x..
const value = 0x..

await i2c.writeReg(address, register, value)

const readValue = await i2c.readReg(address, register)

Read-write register buffer

import { i2c } from "@devicescript/i2c"

const address = 0x..
const register = 0x..
const size = 0x..

await i2c.writeRegBuf(address, register, hex`...`)

const readBuf = await i2c.readRegBuf(address, register, size)

Read-write raw buffer

import { i2c } from "@devicescript/i2c"

const address = 0x..
const size = 0x..

await i2c.writeBuf(address, hex`...`)

const readBuf = await i2c.readBuf(address, size)

Errors

I2C functions may throw a I2CError +error if the operation fails.

+ + + + \ No newline at end of file diff --git a/api/clients/illuminance.html b/api/clients/illuminance.html new file mode 100644 index 00000000000..3d7d32b7c93 --- /dev/null +++ b/api/clients/illuminance.html @@ -0,0 +1,20 @@ + + + + + +Illuminance | DeviceScript + + + + + + + + +
+
Skip to main content

Illuminance

caution

This service is rc and may change in the future.

Detects the amount of light falling onto a given surface area.

Note that this is different from luminance, the amount of light that passes through, emits from, or reflects off an object.

import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()

Registers

reading

The amount of illuminance, as lumens per square metre.

  • type: Register<number> (packing format u22.10)

  • read only

import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
const value = await illuminance.reading.read()
  • track incoming values
import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
illuminance.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reported sensor value.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
const value = await illuminance.readingError.read()
  • track incoming values
import { Illuminance } from "@devicescript/core"

const illuminance = new Illuminance()
// ...
illuminance.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/indexedscreen.html b/api/clients/indexedscreen.html new file mode 100644 index 00000000000..7dfaf51c35e --- /dev/null +++ b/api/clients/indexedscreen.html @@ -0,0 +1,34 @@ + + + + + +IndexedScreen | DeviceScript + + + + + + + + +
+
Skip to main content

IndexedScreen

caution

This service is rc and may change in the future.

A screen with indexed colors from a palette.

This is often run over an SPI connection or directly on the MCU, not regular single-wire Jacdac.

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()

Commands

startUpdate

Sets the update window for subsequent set_pixels commands.

indexedScreen.startUpdate(x: number, y: number, width: number, height: number): Promise<void>

setPixels

Set pixels in current window, according to current palette. +Each "line" of data is aligned to a byte.

indexedScreen.setPixels(pixels: Buffer): Promise<void>

Registers

intensity

Set backlight brightness. +If set to 0 the display may go to sleep.

  • type: Register<number> (packing format u0.8)

  • read and write

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.intensity.read()
await indexedScreen.intensity.write(value)
  • track incoming values
import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
indexedScreen.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

palette

The current palette. The colors are [r,g,b, padding] 32bit color entries. +The color entry repeats 1 << bits_per_pixel times. +This register may be write-only.

  • type: Register<Buffer> (packing format b)

  • track incoming values

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
indexedScreen.palette.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

bitsPerPixel

Determines the number of palette entries. +Typical values are 1 or 4.

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.bitsPerPixel.read()
note

write and read will block until a server is bound to the client.

width

Screen width in "natural" orientation.

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.width.read()
note

write and read will block until a server is bound to the client.

height

Screen height in "natural" orientation.

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.height.read()
note

write and read will block until a server is bound to the client.

widthMajor

If true, consecutive pixels in the "width" direction are sent next to each other (this is typical for graphics cards). +If false, consecutive pixels in the "height" direction are sent next to each other. +For embedded screen controllers, this is typically true iff width < height +(in other words, it's only true for portrait orientation screens). +Some controllers may allow the user to change this (though the refresh order may not be optimal then). +This is independent of the rotation register.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • read and write

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.widthMajor.read()
await indexedScreen.widthMajor.write(value)
  • track incoming values
import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
indexedScreen.widthMajor.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

upSampling

Every pixel sent over wire is represented by up_sampling x up_sampling square of physical pixels. +Some displays may allow changing this (which will also result in changes to width and height). +Typical values are 1 and 2.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • read and write

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.upSampling.read()
await indexedScreen.upSampling.write(value)
  • track incoming values
import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
indexedScreen.upSampling.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

rotation

Possible values are 0, 90, 180 and 270 only. +Write to this register do not affect width and height registers, +and may be ignored by some screens.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
const value = await indexedScreen.rotation.read()
await indexedScreen.rotation.write(value)
  • track incoming values
import { IndexedScreen } from "@devicescript/core"

const indexedScreen = new IndexedScreen()
// ...
indexedScreen.rotation.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/infrastructure.html b/api/clients/infrastructure.html new file mode 100644 index 00000000000..7cb1de3bd8a --- /dev/null +++ b/api/clients/infrastructure.html @@ -0,0 +1,21 @@ + + + + + +Infrastructure | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/led.html b/api/clients/led.html new file mode 100644 index 00000000000..956be8017f2 --- /dev/null +++ b/api/clients/led.html @@ -0,0 +1,32 @@ + + + + + +Led | DeviceScript + + + + + + + + +
+
Skip to main content

Led

A controller for displays of individually controlled RGB LEDs.

For 64 or less LEDs, the service should support the pack the pixels in the pixels register. +Beyond this size, the register should return an empty payload as the amount of data exceeds +the size of a packet. Typically services that use more than 64 LEDs +will run on the same MCU and will maintain the pixels buffer internally.

import { Led } from "@devicescript/core"

const led = new Led()
note

Additional runtime support is provided for Led +by importing the @devicescript/runtime package.

Please refer to the LEDs developer documentation.

import { Led } from "@devicescript/core"
import "@devicescript/runtime"

const led = new Led()

Registers

pixels

A buffer of 24bit RGB color entries for each LED, in R, G, B order. +When writing, if the buffer is too short, the remaining pixels are set to #000000; +If the buffer is too long, the write may be ignored, or the additional pixels may be ignored. +If the number of pixels is greater than max_pixels_length, the read should return an empty payload.

  • type: Register<Buffer> (packing format b)

  • track incoming values

import { Led } from "@devicescript/core"

const led = new Led()
// ...
led.pixels.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

intensity

Set the luminosity of the strip. +At 0 the power to the strip is completely shut down.

  • type: Register<number> (packing format u0.8)

  • read and write

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.intensity.read()
await led.intensity.write(value)
  • track incoming values
import { Led } from "@devicescript/core"

const led = new Led()
// ...
led.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

actualBrightness

This is the luminosity actually applied to the strip. +May be lower than brightness if power-limited by the max_power register. +It will rise slowly (few seconds) back to brightness is limits are no longer required.

  • type: Register<number> (packing format u0.8)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.actualBrightness.read()
  • track incoming values
import { Led } from "@devicescript/core"

const led = new Led()
// ...
led.actualBrightness.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

numPixels

Specifies the number of pixels in the strip.

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.numPixels.read()
note

write and read will block until a server is bound to the client.

numColumns

If the LED pixel strip is a matrix, specifies the number of columns.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.numColumns.read()
note

write and read will block until a server is bound to the client.

maxPower

Limit the power drawn by the light-strip (and controller).

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.maxPower.read()
await led.maxPower.write(value)
  • track incoming values
import { Led } from "@devicescript/core"

const led = new Led()
// ...
led.maxPower.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

ledsPerPixel

If known, specifies the number of LEDs in parallel on this device. +The actual number of LEDs is num_pixels * leds_per_pixel.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.ledsPerPixel.read()
note

write and read will block until a server is bound to the client.

waveLength

If monochrome LED, specifies the wave length of the LED. +Register is missing for RGB LEDs.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.waveLength.read()
note

write and read will block until a server is bound to the client.

luminousIntensity

The luminous intensity of all the LEDs, at full brightness, in micro candella.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.luminousIntensity.read()
note

write and read will block until a server is bound to the client.

variant

Specifies the shape of the light strip.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Led } from "@devicescript/core"

const led = new Led()
// ...
const value = await led.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/ledsingle.html b/api/clients/ledsingle.html new file mode 100644 index 00000000000..3d07ae199b9 --- /dev/null +++ b/api/clients/ledsingle.html @@ -0,0 +1,20 @@ + + + + + +LedSingle | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/ledstrip.html b/api/clients/ledstrip.html new file mode 100644 index 00000000000..20bb99afb7d --- /dev/null +++ b/api/clients/ledstrip.html @@ -0,0 +1,40 @@ + + + + + +LedStrip | DeviceScript + + + + + + + + +
+
Skip to main content

LedStrip

A controller for strips of individually controlled RGB LEDs.

About

Light programs

With 1 mbit Jacdac, we can transmit under 2k of data per animation frame (at 20fps). +If transmitting raw data that would be around 500 pixels, which is not enough for many +installations and it would completely clog the network.

Thus, light service defines a domain-specific language for describing light animations +and efficiently transmitting them over wire. For short LED displays, less than 64 LEDs, +you can also use the LED service.

Light commands are not Jacdac commands. +Light commands are efficiently encoded as sequences of bytes and typically sent as payload +of run command.

Definitions:

  • P - position in the strip
  • R - number of repetitions of the command
  • N - number of pixels affected by the command
  • C - single color designation
  • C+ - sequence of color designations

Update modes:

  • 0 - replace
  • 1 - add RGB
  • 2 - subtract RGB
  • 3 - multiply RGB (by c/128); each pixel value will change by at least 1

Program commands:

  • 0xD0: setall C+ - set all pixels in current range to given color pattern
  • 0xD1: fade C+ - set pixels in current range to colors between colors in sequence
  • 0xD2: fadehsv C+ - similar to fade(), but colors are specified and faded in HSV
  • 0xD3: rotfwd K - rotate (shift) pixels by K positions away from the connector
  • 0xD4: rotback K - same, but towards the connector
  • 0xD5: show M=50 - send buffer to strip and wait M milliseconds
  • 0xD6: range P=0 N=length W=1 S=0 - range from pixel P, N pixels long (currently unsupported: every W pixels skip S pixels)
  • 0xD7: mode K=0 - set update mode
  • 0xD8: tmpmode K=0 - set update mode for next command only
  • 0xCF: setone P C - set one pixel at P (in current range) to given color
  • mult V - macro to multiply current range by given value (float)

A number k is encoded as follows:

  • 0 <= k < 128 -> k
  • 128 <= k < 16383 -> 0x80 | (k >> 8), k & 0xff
  • bigger and negative numbers are not supported

Thus, bytes 0xC0-0xFF are free to use for commands.

Formats:

  • 0xC1, R, G, B - single color parameter
  • 0xC2, R0, G0, B0, R1, G1, B1 - two color parameter
  • 0xC3, R0, G0, B0, R1, G1, B1, R2, G2, B2 - three color parameter
  • 0xC0, N, R0, G0, B0, ..., R(N-1), G(N-1), B(N-1) - N color parameter
  • 0xCF, <number>, R, G, B - set1 special format

Commands are encoded as command byte, followed by parameters in the order +from the command definition.

The setone() command has irregular encoding to save space - it is byte 0xCF followed by encoded +number, and followed by 3 bytes of color.

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()

Commands

run

Run the given light "program". See service description for details.

ledStrip.run(program: Buffer): Promise<void>

Registers

intensity

Set the luminosity of the strip. +At 0 the power to the strip is completely shut down.

  • type: Register<number> (packing format u0.8)

  • read and write

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.intensity.read()
await ledStrip.intensity.write(value)
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

actualBrightness

This is the luminosity actually applied to the strip. +May be lower than brightness if power-limited by the max_power register. +It will rise slowly (few seconds) back to brightness is limits are no longer required.

  • type: Register<number> (packing format u0.8)

  • read only

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.actualBrightness.read()
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.actualBrightness.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

lightType

Specifies the type of light strip connected to controller. +Controllers which are sold with lights should default to the correct type +and could not allow change.

  • type: Register<number> (packing format u8)

  • read and write

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.lightType.read()
await ledStrip.lightType.write(value)
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.lightType.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

numPixels

Specifies the number of pixels in the strip. +Controllers which are sold with lights should default to the correct length +and could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot.

  • type: Register<number> (packing format u16)

  • read and write

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.numPixels.read()
await ledStrip.numPixels.write(value)
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.numPixels.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

numColumns

If the LED pixel strip is a matrix, specifies the number of columns. Otherwise, a square shape is assumed. Controllers which are sold with lights should default to the correct length +and could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.numColumns.read()
await ledStrip.numColumns.write(value)
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.numColumns.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxPower

Limit the power drawn by the light-strip (and controller).

  • type: Register<number> (packing format u16)

  • read and write

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.maxPower.read()
await ledStrip.maxPower.write(value)
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.maxPower.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxPixels

The maximum supported number of pixels. +All writes to num_pixels are clamped to max_pixels.

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.maxPixels.read()
note

write and read will block until a server is bound to the client.

numRepeats

How many times to repeat the program passed in run command. +Should be set before the run command. +Setting to 0 means to repeat forever.

  • type: Register<number> (packing format u16)

  • read and write

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.numRepeats.read()
await ledStrip.numRepeats.write(value)
  • track incoming values
import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
ledStrip.numRepeats.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Specifies the shape of the light strip.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { LedStrip } from "@devicescript/core"

const ledStrip = new LedStrip()
// ...
const value = await ledStrip.variant.read()
note

write and read will block until a server is bound to the client.

Syntax

The input is split at spaces. The following tokens are supported:

  • a command name (see below)
  • a decimal number (0-16383)
  • a color, in HTML syntax '#ff0000' for red, etc
  • a single '#' which will take color (24-bit number) from list of arguments; +the list of arguments has an array or colors it will encode all elements of the array
  • a single '%' which takes a number (0-16383) from the list of arguments

Commands

  • setall C+ - set all pixels in current range to given color pattern

  • fade C+ - set pixels in current range to colors between colors in sequence

  • fadehsv C+ - similar to fade(), but colors are specified and faded in HSV

  • rotfwd K - rotate (shift) pixels by K positions away from the connector

  • rotback K - same, but towards the connector

  • show M=50 - send buffer to strip and wait M milliseconds

  • range P=0 N=length W=1 S=0 - range from pixel P, N pixels long (currently unsupported: every W pixels skip S pixels)

  • mode K=0 - set update mode

  • tmpmode K=0 - set update mode for next command only

  • setone P C - set one pixel at P (in current range) to given color

  • mult V - macro to multiply current range by given value (float)

  • C+ means one or more colors

  • V is a floating point number

  • Other letters (K, M, N, P, W, S) represent integers, with their default values if omitted

Examples

import { LedStrip } from "@devicescript-core"
const led = new LedStrip()

// turn off all lights
await led.runEncoded("setall #000000")
// the same
await led.runEncoded("setall #", 0)
// set first pixel to red, last to blue, and interpolate the ones in between
await led.runEncoded("fade # #", 0xff0000, 0x0000ff)
// the same; note the usage of an array []
await led.runEncoded("fade #", [0xff0000, 0x0000ff])
// set pixels 2-7 to white
await led.runEncoded("range 2 5 setall #ffffff")
// the same
await led.runEncoded("range % % setall #", 2, 5, 0xffffff)
+ + + + \ No newline at end of file diff --git a/api/clients/lightbulb.html b/api/clients/lightbulb.html new file mode 100644 index 00000000000..de48feb8b63 --- /dev/null +++ b/api/clients/lightbulb.html @@ -0,0 +1,21 @@ + + + + + +LightBulb | DeviceScript + + + + + + + + +
+
Skip to main content

LightBulb

caution

This service is rc and may change in the future.

A light bulb controller.

import { LightBulb } from "@devicescript/core"

const lightBulb = new LightBulb()

Registers

intensity

Indicates the brightness of the light bulb. Zero means completely off and 0xffff means completely on. +For non-dimmable lights, the value should be clamp to 0xffff for any non-zero value.

  • type: Register<number> (packing format u0.16)

  • read and write

import { LightBulb } from "@devicescript/core"

const lightBulb = new LightBulb()
// ...
const value = await lightBulb.intensity.read()
await lightBulb.intensity.write(value)
  • track incoming values
import { LightBulb } from "@devicescript/core"

const lightBulb = new LightBulb()
// ...
lightBulb.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

dimmable

Indicates if the light supports dimming.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { LightBulb } from "@devicescript/core"

const lightBulb = new LightBulb()
// ...
const value = await lightBulb.dimmable.read()
note

write and read will block until a server is bound to the client.

on

Turns on of the light bulb with an optional intensity value.

import { LightBulb } from "@devicescript/core"
const lightBulb = new LightBulb()

await lightBulb.on(0.5)

off

Turns off of the light bulb, same as writing 0 to the intensity register.

import { LightBulb } from "@devicescript/core"
const lightBulb = new LightBulb()

await lightBulb.off()

toggle

The toggle method flips the brightness state.

import { LightBulb } from "@devicescript/core"
const lightBulb = new LightBulb()

await lightBulb.toggle()
+ + + + \ No newline at end of file diff --git a/api/clients/lightlevel.html b/api/clients/lightlevel.html new file mode 100644 index 00000000000..7c1f5e2fb88 --- /dev/null +++ b/api/clients/lightlevel.html @@ -0,0 +1,20 @@ + + + + + +LightLevel | DeviceScript + + + + + + + + +
+
Skip to main content

LightLevel

A sensor that measures luminosity level.

import { LightLevel } from "@devicescript/core"

const lightLevel = new LightLevel()

Registers

reading

Detect light level

  • type: Register<number> (packing format u0.16)

  • read only

import { LightLevel } from "@devicescript/core"

const lightLevel = new LightLevel()
// ...
const value = await lightLevel.reading.read()
  • track incoming values
import { LightLevel } from "@devicescript/core"

const lightLevel = new LightLevel()
// ...
lightLevel.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Absolute estimated error of the reading value

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read only

import { LightLevel } from "@devicescript/core"

const lightLevel = new LightLevel()
// ...
const value = await lightLevel.readingError.read()
  • track incoming values
import { LightLevel } from "@devicescript/core"

const lightLevel = new LightLevel()
// ...
lightLevel.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of physical sensor.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { LightLevel } from "@devicescript/core"

const lightLevel = new LightLevel()
// ...
const value = await lightLevel.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/logger.html b/api/clients/logger.html new file mode 100644 index 00000000000..3f71f435a9a --- /dev/null +++ b/api/clients/logger.html @@ -0,0 +1,21 @@ + + + + + +Logger | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/magneticfieldlevel.html b/api/clients/magneticfieldlevel.html new file mode 100644 index 00000000000..232b34a7966 --- /dev/null +++ b/api/clients/magneticfieldlevel.html @@ -0,0 +1,28 @@ + + + + + +MagneticFieldLevel | DeviceScript + + + + + + + + +
+
Skip to main content

MagneticFieldLevel

A sensor that measures strength and polarity of magnetic field.

import { MagneticFieldLevel } from "@devicescript/core"

const magneticFieldLevel = new MagneticFieldLevel()

Registers

reading

Indicates the strength of magnetic field between -1 and 1. +When no magnet is present the value should be around 0. +For analog sensors, +when the north pole of the magnet is on top of the module +and closer than south pole, then the value should be positive. +For digital sensors, +the value should either 0 or 1, regardless of polarity.

  • type: Register<number> (packing format i1.15)

  • read only

import { MagneticFieldLevel } from "@devicescript/core"

const magneticFieldLevel = new MagneticFieldLevel()
// ...
const value = await magneticFieldLevel.reading.read()
  • track incoming values
import { MagneticFieldLevel } from "@devicescript/core"

const magneticFieldLevel = new MagneticFieldLevel()
// ...
magneticFieldLevel.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

detected

Determines if the magnetic field is present. +If the event active is observed, detected is true; if inactive is observed, detected is false.

  • type: Register<boolean> (packing format u8)

  • read only

import { MagneticFieldLevel } from "@devicescript/core"

const magneticFieldLevel = new MagneticFieldLevel()
// ...
const value = await magneticFieldLevel.detected.read()
  • track incoming values
import { MagneticFieldLevel } from "@devicescript/core"

const magneticFieldLevel = new MagneticFieldLevel()
// ...
magneticFieldLevel.detected.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Determines which magnetic poles the sensor can detected, +and whether or not it can measure their strength or just presence.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { MagneticFieldLevel } from "@devicescript/core"

const magneticFieldLevel = new MagneticFieldLevel()
// ...
const value = await magneticFieldLevel.variant.read()
note

write and read will block until a server is bound to the client.

Events

active

Emitted when strong-enough magnetic field is detected.

magneticFieldLevel.active.subscribe(() => {

})

inactive

Emitted when strong-enough magnetic field is no longer detected.

magneticFieldLevel.inactive.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/magnetomer.html b/api/clients/magnetomer.html new file mode 100644 index 00000000000..24d7c26da99 --- /dev/null +++ b/api/clients/magnetomer.html @@ -0,0 +1,22 @@ + + + + + +Magnetometer | DeviceScript + + + + + + + + +
+
Skip to main content

Magnetometer

caution

This service is rc and may change in the future.

A 3-axis magnetometer.

import { Magnetometer } from "@devicescript/core"

const magnetometer = new Magnetometer()

Commands

calibrate

Forces a calibration sequence where the user/device +might have to rotate to be calibrated.

magnetometer.calibrate(): Promise<void>

Registers

reading

Indicates the current magnetic field on magnetometer. +For reference: 1 mgauss is 100 nT (and 1 gauss is 100 000 nT).

  • type: Register<any[]> (packing format i32 i32 i32)

  • track incoming values

import { Magnetometer } from "@devicescript/core"

const magnetometer = new Magnetometer()
// ...
magnetometer.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Absolute estimated error on the readings.

  • type: Register<number> (packing format i32)

  • optional: this register may not be implemented

  • read only

import { Magnetometer } from "@devicescript/core"

const magnetometer = new Magnetometer()
// ...
const value = await magnetometer.readingError.read()
  • track incoming values
import { Magnetometer } from "@devicescript/core"

const magnetometer = new Magnetometer()
// ...
magnetometer.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/matrixkeypad.html b/api/clients/matrixkeypad.html new file mode 100644 index 00000000000..d05dae7063e --- /dev/null +++ b/api/clients/matrixkeypad.html @@ -0,0 +1,23 @@ + + + + + +MatrixKeypad | DeviceScript + + + + + + + + +
+
Skip to main content

MatrixKeypad

caution

This service is experimental and may change in the future.

A matrix of buttons connected as a keypad

import { MatrixKeypad } from "@devicescript/core"

const matrixKeypad = new MatrixKeypad()

Registers

reading

The coordinate of the button currently pressed. Keys are zero-indexed from left to right, top to bottom: +row = index / columns, column = index % columns.

  • type: Register<any[]> (packing format r: u8)

  • track incoming values

import { MatrixKeypad } from "@devicescript/core"

const matrixKeypad = new MatrixKeypad()
// ...
matrixKeypad.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

rows

Number of rows in the matrix

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { MatrixKeypad } from "@devicescript/core"

const matrixKeypad = new MatrixKeypad()
// ...
const value = await matrixKeypad.rows.read()
note

write and read will block until a server is bound to the client.

columns

Number of columns in the matrix

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { MatrixKeypad } from "@devicescript/core"

const matrixKeypad = new MatrixKeypad()
// ...
const value = await matrixKeypad.columns.read()
note

write and read will block until a server is bound to the client.

labels

The characters printed on the keys if any, in indexing sequence.

  • type: Register<any[]> (packing format r: z)
  • optional: this register may not be implemented
  • constant: the register value will not change (until the next reset)
note

write and read will block until a server is bound to the client.

variant

The type of physical keypad. If the variant is ElastomerLEDPixel +and the next service on the device is a LEDPixel service, it is considered +as the service controlling the LED pixel on the keypad.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { MatrixKeypad } from "@devicescript/core"

const matrixKeypad = new MatrixKeypad()
// ...
const value = await matrixKeypad.variant.read()
note

write and read will block until a server is bound to the client.

Events

down

Emitted when a key, at the given index, goes from inactive (pressed == 0) to active.

matrixKeypad.down.subscribe(() => {

})

up

Emitted when a key, at the given index, goes from active (pressed == 1) to inactive.

matrixKeypad.up.subscribe(() => {

})

click

Emitted together with up when the press time was not longer than 500ms.

matrixKeypad.click.subscribe(() => {

})

longClick

Emitted together with up when the press time was more than 500ms.

matrixKeypad.longClick.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/microphone.html b/api/clients/microphone.html new file mode 100644 index 00000000000..e7282461f79 --- /dev/null +++ b/api/clients/microphone.html @@ -0,0 +1,21 @@ + + + + + +Microphone | DeviceScript + + + + + + + + +
+
Skip to main content

Microphone

caution

This service is experimental and may change in the future.

A single-channel microphone.

import { Microphone } from "@devicescript/core"

const microphone = new Microphone()

Registers

samplingPeriod

Get or set microphone sampling period. +Sampling rate is 1_000_000 / sampling_period Hz.

  • type: Register<number> (packing format u32)

  • read and write

import { Microphone } from "@devicescript/core"

const microphone = new Microphone()
// ...
const value = await microphone.samplingPeriod.read()
await microphone.samplingPeriod.write(value)
  • track incoming values
import { Microphone } from "@devicescript/core"

const microphone = new Microphone()
// ...
microphone.samplingPeriod.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/midioutput.html b/api/clients/midioutput.html new file mode 100644 index 00000000000..922871b8d95 --- /dev/null +++ b/api/clients/midioutput.html @@ -0,0 +1,20 @@ + + + + + +MidiOutput | DeviceScript + + + + + + + + +
+
Skip to main content

MidiOutput

caution

This service is experimental and may change in the future.

A MIDI output device.

import { MidiOutput } from "@devicescript/core"

const midiOutput = new MidiOutput()

Commands

clear

Clears any pending send data that has not yet been sent from the MIDIOutput's queue.

midiOutput.clear(): Promise<void>

send

Enqueues the message to be sent to the corresponding MIDI port

midiOutput.send(data: Buffer): Promise<void>

Registers

enabled

Opens or closes the port to the MIDI device

  • type: Register<boolean> (packing format u8)

  • read and write

import { MidiOutput } from "@devicescript/core"

const midiOutput = new MidiOutput()
// ...
const value = await midiOutput.enabled.read()
await midiOutput.enabled.write(value)
  • track incoming values
import { MidiOutput } from "@devicescript/core"

const midiOutput = new MidiOutput()
// ...
midiOutput.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/modelrunner.html b/api/clients/modelrunner.html new file mode 100644 index 00000000000..4c9d41c1e6e --- /dev/null +++ b/api/clients/modelrunner.html @@ -0,0 +1,32 @@ + + + + + +ModelRunner | DeviceScript + + + + + + + + +
+
Skip to main content

ModelRunner

caution

This service is experimental and may change in the future.

Runs machine learning models.

Only models with a single input tensor and a single output tensor are supported at the moment. +Input is provided by Sensor Aggregator service on the same device. +Multiple instances of this service may be present, if more than one model format is supported by a device.

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()

Commands

setModel

Open pipe for streaming in the model. The size of the model has to be declared upfront. +The model is streamed over regular pipe data packets. +The format supported by this instance of the service is specified in format register. +When the pipe is closed, the model is written all into flash, and the device running the service may reset.

modelRunner.setModel(model_size: number): Promise<void>

Registers

autoInvokeEvery

When register contains N > 0, run the model automatically every time new N samples are collected. +Model may be run less often if it takes longer to run than N * sampling_interval. +The outputs register will stream its value after each run. +This register is not stored in flash.

  • type: Register<number> (packing format u16)

  • read and write

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.autoInvokeEvery.read()
await modelRunner.autoInvokeEvery.write(value)
  • track incoming values
import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.autoInvokeEvery.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

reading

Results of last model invocation as float32 array.

  • type: Register<any[]> (packing format r: f32)

  • track incoming values

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

inputShape

The shape of the input tensor.

  • type: Register<any[]> (packing format r: u16)

  • track incoming values

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.inputShape.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

outputShape

The shape of the output tensor.

  • type: Register<any[]> (packing format r: u16)

  • track incoming values

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.outputShape.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

lastRunTime

The time consumed in last model execution.

  • type: Register<number> (packing format u32)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.lastRunTime.read()
  • track incoming values
import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.lastRunTime.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

allocatedArenaSize

Number of RAM bytes allocated for model execution.

  • type: Register<number> (packing format u32)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.allocatedArenaSize.read()
  • track incoming values
import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.allocatedArenaSize.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

modelSize

The size of the model in bytes.

  • type: Register<number> (packing format u32)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.modelSize.read()
  • track incoming values
import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.modelSize.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

lastError

Textual description of last error when running or loading model (if any).

  • type: Register<string> (packing format s)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.lastError.read()
  • track incoming values
import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
modelRunner.lastError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

format

The type of ML models supported by this service. +TFLite is flatbuffer .tflite file. +ML4F is compiled machine code model for Cortex-M4F. +The format is typically present as first or second little endian word of model file.

  • type: Register<number> (packing format u32)

  • constant: the register value will not change (until the next reset)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.format.read()
note

write and read will block until a server is bound to the client.

formatVersion

A version number for the format.

  • type: Register<number> (packing format u32)

  • constant: the register value will not change (until the next reset)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.formatVersion.read()
note

write and read will block until a server is bound to the client.

parallel

If present and true this service can run models independently of other +instances of this service on the device.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { ModelRunner } from "@devicescript/core"

const modelRunner = new ModelRunner()
// ...
const value = await modelRunner.parallel.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/motion.html b/api/clients/motion.html new file mode 100644 index 00000000000..7defdd7b35c --- /dev/null +++ b/api/clients/motion.html @@ -0,0 +1,20 @@ + + + + + +Motion | DeviceScript + + + + + + + + +
+
Skip to main content

Motion

caution

This service is experimental and may change in the future.

A sensor, typically PIR, that detects object motion within a certain range

import { Motion } from "@devicescript/core"

const motion = new Motion()

Registers

reading

Reports is movement is currently detected by the sensor.

  • type: Register<boolean> (packing format u8)

  • read only

import { Motion } from "@devicescript/core"

const motion = new Motion()
// ...
const value = await motion.reading.read()
  • track incoming values
import { Motion } from "@devicescript/core"

const motion = new Motion()
// ...
motion.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxDistance

Maximum distance where objects can be detected.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Motion } from "@devicescript/core"

const motion = new Motion()
// ...
const value = await motion.maxDistance.read()
note

write and read will block until a server is bound to the client.

angle

Opening of the field of view

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Motion } from "@devicescript/core"

const motion = new Motion()
// ...
const value = await motion.angle.read()
note

write and read will block until a server is bound to the client.

variant

Type of physical sensor

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Motion } from "@devicescript/core"

const motion = new Motion()
// ...
const value = await motion.variant.read()
note

write and read will block until a server is bound to the client.

Events

movement

A movement was detected.

motion.movement.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/motor.html b/api/clients/motor.html new file mode 100644 index 00000000000..75933b7c22e --- /dev/null +++ b/api/clients/motor.html @@ -0,0 +1,22 @@ + + + + + +Motor | DeviceScript + + + + + + + + +
+
Skip to main content

Motor

caution

This service is rc and may change in the future.

A DC motor.

import { Motor } from "@devicescript/core"

const motor = new Motor()

Registers

speed

Relative speed of the motor. Use positive/negative values to run the motor forwards and backwards. +Positive is recommended to be clockwise rotation and negative counterclockwise. A speed of 0 +while enabled acts as brake.

  • type: Register<number> (packing format i1.15)

  • read and write

import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
const value = await motor.speed.read()
await motor.speed.write(value)
  • track incoming values
import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
motor.speed.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turn the power to the motor on/off.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
const value = await motor.enabled.read()
await motor.enabled.write(value)
  • track incoming values
import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
motor.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

loadTorque

Torque required to produce the rated power of an electrical motor at load speed.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
const value = await motor.loadTorque.read()
note

write and read will block until a server is bound to the client.

loadRotationSpeed

Revolutions per minute of the motor under full load.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
const value = await motor.loadRotationSpeed.read()
note

write and read will block until a server is bound to the client.

reversible

Indicates if the motor can run backwards.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Motor } from "@devicescript/core"

const motor = new Motor()
// ...
const value = await motor.reversible.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/multitouch.html b/api/clients/multitouch.html new file mode 100644 index 00000000000..a213d65fcce --- /dev/null +++ b/api/clients/multitouch.html @@ -0,0 +1,22 @@ + + + + + +Multitouch | DeviceScript + + + + + + + + +
+
Skip to main content

Multitouch

caution

This service is experimental and may change in the future.

A capacitive touch sensor with multiple inputs.

import { Multitouch } from "@devicescript/core"

const multitouch = new Multitouch()

Registers

reading

Capacitance of channels. The capacitance is continuously calibrated, and a value of 0 indicates +no touch, wheres a value of around 100 or more indicates touch. +It's best to ignore this (unless debugging), and use events.

Digital sensors will use 0 or 0xffff on each channel.

  • type: Register<any[]> (packing format r: i16)

  • track incoming values

import { Multitouch } from "@devicescript/core"

const multitouch = new Multitouch()
// ...
multitouch.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

Events

touch

Emitted when an input is touched.

multitouch.touch.subscribe(() => {

})

release

Emitted when an input is no longer touched.

multitouch.release.subscribe(() => {

})

tap

Emitted when an input is briefly touched. TODO Not implemented.

multitouch.tap.subscribe(() => {

})

longPress

Emitted when an input is touched for longer than 500ms. TODO Not implemented.

multitouch.longPress.subscribe(() => {

})

swipePos

Emitted when input channels are successively touched in order of increasing channel numbers.

multitouch.swipePos.subscribe(() => {

})

swipeNeg

Emitted when input channels are successively touched in order of decreasing channel numbers.

multitouch.swipeNeg.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/planarposition.html b/api/clients/planarposition.html new file mode 100644 index 00000000000..655973681ef --- /dev/null +++ b/api/clients/planarposition.html @@ -0,0 +1,20 @@ + + + + + +PlanarPosition | DeviceScript + + + + + + + + +
+
Skip to main content

PlanarPosition

caution

This service is experimental and may change in the future.

A sensor that repors 2D position, typically an optical mouse tracking sensor.

The sensor starts at an arbitrary origin (0,0) and reports the distance from that origin.

The streaming_interval is respected when the position is changing. When the position is not changing, the streaming interval may be throttled to 500ms.

import { PlanarPosition } from "@devicescript/core"

const planarPosition = new PlanarPosition()

Registers

reading

The current position of the sensor.

  • type: Register<any[]> (packing format i22.10 i22.10)

  • track incoming values

import { PlanarPosition } from "@devicescript/core"

const planarPosition = new PlanarPosition()
// ...
planarPosition.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Specifies the type of physical sensor.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { PlanarPosition } from "@devicescript/core"

const planarPosition = new PlanarPosition()
// ...
const value = await planarPosition.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/potentiometer.html b/api/clients/potentiometer.html new file mode 100644 index 00000000000..303f61bfed1 --- /dev/null +++ b/api/clients/potentiometer.html @@ -0,0 +1,20 @@ + + + + + +Potentiometer | DeviceScript + + + + + + + + +
+
Skip to main content

Potentiometer

A slider or rotary potentiometer.

import { Potentiometer } from "@devicescript/core"

const potentiometer = new Potentiometer()

Registers

reading

The relative position of the slider.

  • type: Register<number> (packing format u0.16)

  • read only

import { Potentiometer } from "@devicescript/core"

const potentiometer = new Potentiometer()
// ...
const value = await potentiometer.reading.read()
  • track incoming values
import { Potentiometer } from "@devicescript/core"

const potentiometer = new Potentiometer()
// ...
potentiometer.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Specifies the physical layout of the potentiometer.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Potentiometer } from "@devicescript/core"

const potentiometer = new Potentiometer()
// ...
const value = await potentiometer.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/power.html b/api/clients/power.html new file mode 100644 index 00000000000..86dd02a14c6 --- /dev/null +++ b/api/clients/power.html @@ -0,0 +1,100 @@ + + + + + +Power | DeviceScript + + + + + + + + +
+
Skip to main content

Power

caution

This service is experimental and may change in the future.

A power-provider service.

About

Power negotiation protocol

The purpose of the power negotiation is to ensure that there is no more than Iout_hc(max) delivered to the power rail. +This is realized by limiting the number of enabled power provider services to one.

Note, that it's also possible to have low-current power providers, +which are limited to Iout_lc(max) and do not run a power provider service. +These are not accounted for in the power negotiation protocol.

Power providers can have multiple channels, typically multiple Jacdac ports on the provider. +Each channel can be limited to Iout_hc(max) separately. +In normal operation, the data lines of each channels are connected together. +The ground lines are always connected together. +Multi-channel power providers are also called powered hubs.

While channels have separate current limits, there's nothing to prevent the user +from joining two or more channels outside of the provider using a passive hub. +This would allow more than Iout_hc(max) of current to be drawn, resulting in cables or components +getting hot and/or malfunctioning. +Thus, the power negotiation protocol seeks to detect situations where +multiple channels of power provider(s) are bridged together +and shut down all but one of the channels involved.

The protocol is built around the power providers periodically sending specially crafted +shutdown commands in broadcast mode. +Note that this is unusual - services typically only send reports.

The shutdown commands can be reliably identified based on their first half (more details below). +When a power provider starts receiving a shutdown command, it needs to take +steps to identify which of its channels the command is coming from. +This is typically realized with analog switches between the data lines of channels. +The delivery of power over the channel which received the shutdown command is then shut down. +Note that in the case of a single-channel provider, any received shutdown command will cause a shut down.

A multi-channel provider needs to also identify when a shutdown command it sent from one channel +is received on any of its other channels and shut down one of the channels involved.

It is also possible to build a data bridge device, with two or more ports. +It passes through all data except for shutdown commands, +but does not connect the power lines.

Protocol details

The shutdown commands follow a very narrow format:

  • they need to be the only packet in the frame (and thus we can also call them shutdown frames)
  • the second word of device_id needs to be set to 0xAA_AA_AA_AA (alternating 0 and 1)
  • the service index is set to 0x3d
  • the CRC is therefore fixed
  • therefore, the packet can be recognized by reading the first 8 bytes (total length is 16 bytes)

The exact byte structure of shutdown command is: +15 59 04 05 5A C9 A4 1F AA AA AA AA 00 3D 80 00

There is one power service per channel. +A multi-channel power provider can be implemented as one device with multiple services (typically with one MCU), +or many devices with one service each (typically multiple MCUs). +The first option is preferred as it fixes the order of channels, +but the second option may be cheaper to implement.

After queuing a shutdown command, the service enters a grace period +until the report has been sent on the wire. +During the grace period incoming shutdown commands are ignored.

  • Upon reset, a power service enables itself, and then only after 0-300ms (random) +sends the first shutdown command
  • Every enabled power service emits shutdown commands every 400-600ms (random; first few packets can be even sent more often)
  • If an enabled power service sees a shutdown command from somebody else, +it disables itself (unless in grace period)
  • If a disabled power service sees no shutdown command for more than ~1200ms, it enables itself +(this is when the previous power source is unplugged or otherwise malfunctions)
  • If a power service has been disabled for around 10s, it enables itself.

Additionally:

  • While the allowed register is set to 0, the service will not enable itself (nor send shutdown commands)
  • When a current overdraw is detected, the service stop providing power and enters Overload state for around 2 seconds, +while still sending shutdown commands.

Client notes

If a client hears a shutdown command it just means it's on a branch of the +network with a (high) power provider. +As clients (brains) typically do not consume much current (as opposed to, say, servos), +the shutdown commands are typically irrelevant to them.

For power monitoring, the power_status_changed event (and possibly power_status register) +can be used. +In particular, user interfaces may alert the user to Overload status. +The Overprovision status is generally considered normal (eg. when two multi-channel power providers are linked together).

Server implementation notes

A dedicated MCU per channel

Every channel has:

  • a cheap 8-bit MCU (e.g. PMS150C, PFS122),
  • a current limiter with FAULT output and ENABLE input, and
  • an analog switch.

The MCU here needs at least 4 pins per channel. +It is connected to data line of the channel, the control input of the switch, and to the current limiter's FAULT and ENABLE pins.

The switch connects the data line of the channel (JD_DATA_CHx) with the internal shared data bus, common to all channels (JD_DATA_COM). +Both the switch and the limiter are controlled by the MCU. +A latching circuit is not needed for the limiter because the MCU will detect an overcurrent fault and shut it down immediately.

During reception, after the beginning of shutdown frame is detected, +the switch is opened for a brief period. +If the shutdown frame is received correctly, it means it was on MCU's channel.

In the case of only one power delivery channel that's controlled by a dedicated MCU, the analog switch is not necessary.

A shared MCU for multiple channels

Every channel has:

  • a current limiter with FAULT output and ENABLE input,
  • an analog switch, and
  • a wiggle-detection line connecting the MCU to data line of the channel

The MCU again needs at least 4 pins per channel. +Switches and limiters are set up like in the configuration above. +The Jacdac data line of the MCU is connected to internal data bus.

While a Jacdac packet is being received, the MCU keeps checking if it is a +beginning of the shutdown frame. +If that is the case, it opens all switches and checks which one(s) of the channel +data lines wiggle (via the wiggle lines; this can be done with EXTI latches). +The one(s) that wiggle received the shutdown frame and need to be disabled.

Also, while sending the shutdown frames itself, it needs to be done separately +for each channel, with all the other switches open. +If during that operation we detect wiggle on other channels, then we have detected +a loop, and the respective channels needs to be disabled.

A brain-integrated power supply

Here, there's only one channel of power and we don't have hard real time requirements, +so user-programmable brain can control it. +There is no need for analog switch or wiggle-detection line, +but a current limiter with a latching circuit is needed.

There is nothing special to do during reception of shutdown packet. +When it is received, the current limiter should just be disabled.

Ideally, exception/hard-fault handlers on the MCU should also disable the current limiter. +Similarly, the limiter should be disabled while the MCU is in bootloader mode, +or otherwise unaware of the power negotiation protocol.

Rationale for the grace period

Consider the following scenario:

  • device A queues shutdown command for sending
  • A receives external shutdown packet from B (thus disabling A)
  • the A shutdown command is sent from the queue (thus eventually disabling B)

To avoid that, we make sure that at the precise instant when shutdown command is sent, +the power is enabled (and thus will stay enabled until another shutdown command arrives). +This could be achieved by inspecting the enable bit, aftering acquiring the line +and before starting UART transmission, however that would require breaking abstraction layers. +So instead, we never disable the service, while the shutdown packet is queued. +This may lead to delays in disabling power services, but these should be limited due to the +random nature of the shutdown packet spacing.

Rationale for timings

The initial 0-300ms delay is set to spread out the shutdown periods of power services, +to minimize collisions. +The shutdown periods are randomized 400-600ms, instead of a fixed 500ms used for regular +services, for the same reason.

The 1200ms period is set so that droping two shutdown packets in a row +from the current provider will not cause power switch, while missing 3 will.

The 50-60s power switch period is arbitrary, but chosen to limit amount of switching between supplies, +while keeping it short enough for user to notice any problems such switching may cause.

import { Power } from "@devicescript/core"

const power = new Power()

Commands

shutdown

Sent by the power service periodically, as broadcast.

power.shutdown(): Promise<void>

Registers

enabled

Can be used to completely disable the service. +When allowed, the service may still not be providing power, see +power_status for the actual current state.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.enabled.read()
await power.enabled.write(value)
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxPower

Limit the power provided by the service. The actual maximum limit will depend on hardware. +This field may be read-only in some implementations - you should read it back after setting.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.maxPower.read()
await power.maxPower.write(value)
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.maxPower.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

powerStatus

Indicates whether the power provider is currently providing power (Powering state), and if not, why not. +Overprovision means there was another power provider, and we stopped not to overprovision the bus.

  • type: Register<number> (packing format u8)

  • read only

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.powerStatus.read()
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.powerStatus.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

reading

Present current draw from the bus.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read only

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.reading.read()
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

batteryVoltage

Voltage on input.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read only

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.batteryVoltage.read()
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.batteryVoltage.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

batteryCharge

Fraction of charge in the battery.

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read only

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.batteryCharge.read()
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.batteryCharge.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

batteryCapacity

Energy that can be delivered to the bus when battery is fully charged. +This excludes conversion overheads if any.

  • type: Register<number> (packing format u32)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.batteryCapacity.read()
note

write and read will block until a server is bound to the client.

keepOnPulseDuration

Many USB power packs need current to be drawn from time to time to prevent shutdown. +This regulates how often and for how long such current is drawn. +Typically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.keepOnPulseDuration.read()
await power.keepOnPulseDuration.write(value)
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.keepOnPulseDuration.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

keepOnPulsePeriod

Many USB power packs need current to be drawn from time to time to prevent shutdown. +This regulates how often and for how long such current is drawn. +Typically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { Power } from "@devicescript/core"

const power = new Power()
// ...
const value = await power.keepOnPulsePeriod.read()
await power.keepOnPulsePeriod.write(value)
  • track incoming values
import { Power } from "@devicescript/core"

const power = new Power()
// ...
power.keepOnPulsePeriod.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

Events

change

Emitted whenever power_status changes.

power.change.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/powersupply.html b/api/clients/powersupply.html new file mode 100644 index 00000000000..67e176f2fe6 --- /dev/null +++ b/api/clients/powersupply.html @@ -0,0 +1,20 @@ + + + + + +PowerSupply | DeviceScript + + + + + + + + +
+
Skip to main content

PowerSupply

caution

This service is experimental and may change in the future.

A power supply with a fixed or variable voltage range

import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()

Registers

enabled

Turns the power supply on with true, off with false.

  • type: Register<boolean> (packing format u8)

  • read and write

import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.enabled.read()
await powerSupply.enabled.write(value)
  • track incoming values
import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()
// ...
powerSupply.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

outputVoltage

The current output voltage of the power supply. Values provided must be in the range minimum_voltage to maximum_voltage

  • type: Register<number> (packing format f64)

  • read and write

import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.outputVoltage.read()
await powerSupply.outputVoltage.write(value)
  • track incoming values
import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()
// ...
powerSupply.outputVoltage.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minValue

The minimum output voltage of the power supply. For fixed power supplies, minimum_voltage should be equal to maximum_voltage.

  • type: Register<number> (packing format f64)

  • constant: the register value will not change (until the next reset)

  • read only

import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.minValue.read()
note

write and read will block until a server is bound to the client.

maxValue

The maximum output voltage of the power supply. For fixed power supplies, minimum_voltage should be equal to maximum_voltage.

  • type: Register<number> (packing format f64)

  • constant: the register value will not change (until the next reset)

  • read only

import { PowerSupply } from "@devicescript/core"

const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.maxValue.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/pressurebutton.html b/api/clients/pressurebutton.html new file mode 100644 index 00000000000..60c00f8cdbb --- /dev/null +++ b/api/clients/pressurebutton.html @@ -0,0 +1,20 @@ + + + + + +PressureButton | DeviceScript + + + + + + + + +
+
Skip to main content

PressureButton

caution

This service is rc and may change in the future.

A pressure sensitive push-button.

import { PressureButton } from "@devicescript/core"

const pressureButton = new PressureButton()

Registers

activeThreshold

Indicates the threshold for up events.

  • type: Register<number> (packing format u0.16)

  • read and write

import { PressureButton } from "@devicescript/core"

const pressureButton = new PressureButton()
// ...
const value = await pressureButton.activeThreshold.read()
await pressureButton.activeThreshold.write(value)
  • track incoming values
import { PressureButton } from "@devicescript/core"

const pressureButton = new PressureButton()
// ...
pressureButton.activeThreshold.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/prototest.html b/api/clients/prototest.html new file mode 100644 index 00000000000..ff8c8489b44 --- /dev/null +++ b/api/clients/prototest.html @@ -0,0 +1,21 @@ + + + + + +ProtoTest | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/proxy.html b/api/clients/proxy.html new file mode 100644 index 00000000000..f1462acf69d --- /dev/null +++ b/api/clients/proxy.html @@ -0,0 +1,21 @@ + + + + + +Proxy | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/pulseoximeter.html b/api/clients/pulseoximeter.html new file mode 100644 index 00000000000..2b85fe383e9 --- /dev/null +++ b/api/clients/pulseoximeter.html @@ -0,0 +1,20 @@ + + + + + +PulseOximeter | DeviceScript + + + + + + + + +
+
Skip to main content

PulseOximeter

caution

This service is experimental and may change in the future.

A sensor approximating the oxygen level.

Jacdac is not suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.

import { PulseOximeter } from "@devicescript/core"

const pulseOximeter = new PulseOximeter()

Registers

reading

The estimated oxygen level in blood.

  • type: Register<number> (packing format u8.8)

  • read only

import { PulseOximeter } from "@devicescript/core"

const pulseOximeter = new PulseOximeter()
// ...
const value = await pulseOximeter.reading.read()
  • track incoming values
import { PulseOximeter } from "@devicescript/core"

const pulseOximeter = new PulseOximeter()
// ...
pulseOximeter.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The estimated error on the reported sensor data.

  • type: Register<number> (packing format u8.8)

  • optional: this register may not be implemented

  • read only

import { PulseOximeter } from "@devicescript/core"

const pulseOximeter = new PulseOximeter()
// ...
const value = await pulseOximeter.readingError.read()
  • track incoming values
import { PulseOximeter } from "@devicescript/core"

const pulseOximeter = new PulseOximeter()
// ...
pulseOximeter.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/raingauge.html b/api/clients/raingauge.html new file mode 100644 index 00000000000..36c5335fd85 --- /dev/null +++ b/api/clients/raingauge.html @@ -0,0 +1,20 @@ + + + + + +RainGauge | DeviceScript + + + + + + + + +
+
Skip to main content

RainGauge

caution

This service is rc and may change in the future.

Measures the amount of liquid precipitation over an area in a predefined period of time.

import { RainGauge } from "@devicescript/core"

const rainGauge = new RainGauge()

Registers

reading

Total precipitation recorded so far.

  • type: Register<number> (packing format u16.16)

  • read only

import { RainGauge } from "@devicescript/core"

const rainGauge = new RainGauge()
// ...
const value = await rainGauge.reading.read()
  • track incoming values
import { RainGauge } from "@devicescript/core"

const rainGauge = new RainGauge()
// ...
rainGauge.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingResolution

Typically the amount of rain needed for tipping the bucket.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { RainGauge } from "@devicescript/core"

const rainGauge = new RainGauge()
// ...
const value = await rainGauge.readingResolution.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/realtimeclock.html b/api/clients/realtimeclock.html new file mode 100644 index 00000000000..57f751b9ec5 --- /dev/null +++ b/api/clients/realtimeclock.html @@ -0,0 +1,20 @@ + + + + + +RealTimeClock | DeviceScript + + + + + + + + +
+
Skip to main content

RealTimeClock

caution

This service is rc and may change in the future.

Real time clock to support collecting data with precise time stamps.

import { RealTimeClock } from "@devicescript/core"

const realTimeClock = new RealTimeClock()

Commands

setTime

Sets the current time and resets the error.

realTimeClock.setTime(year: number, month: number, day_of_month: number, day_of_week: number, hour: number, min: number, sec: number): Promise<void>

Registers

reading

Current time in 24h representation.

  • day_of_month is day of the month, starting at 1

  • day_of_week is day of the week, starting at 1 as monday. Default streaming period is 1 second.

  • type: Register<any[]> (packing format u16 u8 u8 u8 u8 u8 u8)

  • track incoming values

import { RealTimeClock } from "@devicescript/core"

const realTimeClock = new RealTimeClock()
// ...
realTimeClock.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

drift

Time drift since the last call to the set_time command.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { RealTimeClock } from "@devicescript/core"

const realTimeClock = new RealTimeClock()
// ...
const value = await realTimeClock.drift.read()
  • track incoming values
import { RealTimeClock } from "@devicescript/core"

const realTimeClock = new RealTimeClock()
// ...
realTimeClock.drift.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

precision

Error on the clock, in parts per million of seconds.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { RealTimeClock } from "@devicescript/core"

const realTimeClock = new RealTimeClock()
// ...
const value = await realTimeClock.precision.read()
note

write and read will block until a server is bound to the client.

variant

The type of physical clock used by the sensor.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { RealTimeClock } from "@devicescript/core"

const realTimeClock = new RealTimeClock()
// ...
const value = await realTimeClock.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/reflectedlight.html b/api/clients/reflectedlight.html new file mode 100644 index 00000000000..dd37064228a --- /dev/null +++ b/api/clients/reflectedlight.html @@ -0,0 +1,20 @@ + + + + + +ReflectedLight | DeviceScript + + + + + + + + +
+
Skip to main content

ReflectedLight

caution

This service is rc and may change in the future.

A sensor that detects light and dark surfaces, commonly used for line following robots.

import { ReflectedLight } from "@devicescript/core"

const reflectedLight = new ReflectedLight()

Registers

reading

Reports the reflected brightness. It may be a digital value or, for some sensor, analog value.

  • type: Register<number> (packing format u0.16)

  • read only

import { ReflectedLight } from "@devicescript/core"

const reflectedLight = new ReflectedLight()
// ...
const value = await reflectedLight.reading.read()
  • track incoming values
import { ReflectedLight } from "@devicescript/core"

const reflectedLight = new ReflectedLight()
// ...
reflectedLight.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Type of physical sensor used

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { ReflectedLight } from "@devicescript/core"

const reflectedLight = new ReflectedLight()
// ...
const value = await reflectedLight.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/relay.html b/api/clients/relay.html new file mode 100644 index 00000000000..dfdb5ca2db1 --- /dev/null +++ b/api/clients/relay.html @@ -0,0 +1,24 @@ + + + + + +Relay | DeviceScript + + + + + + + + +
+
Skip to main content

Relay

A switching relay.

The contacts should be labelled NO (normally open), COM (common), and NC (normally closed). +When relay is energized it connects NO and COM. +When relay is not energized it connects NC and COM. +Some relays may be missing NO or NC contacts. +When relay module is not powered, or is in bootloader mode, it is not energized (connects NC and COM).

import { Relay } from "@devicescript/core"

const relay = new Relay()

Registers

enabled

Indicates whether the relay circuit is currently energized or not.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Relay } from "@devicescript/core"

const relay = new Relay()
// ...
const value = await relay.enabled.read()
await relay.enabled.write(value)
  • track incoming values
import { Relay } from "@devicescript/core"

const relay = new Relay()
// ...
relay.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Describes the type of relay used.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Relay } from "@devicescript/core"

const relay = new Relay()
// ...
const value = await relay.variant.read()
note

write and read will block until a server is bound to the client.

maxSwitchingCurrent

Maximum switching current for a resistive load.

  • type: Register<number> (packing format u32)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Relay } from "@devicescript/core"

const relay = new Relay()
// ...
const value = await relay.maxSwitchingCurrent.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/rng.html b/api/clients/rng.html new file mode 100644 index 00000000000..772f50bc323 --- /dev/null +++ b/api/clients/rng.html @@ -0,0 +1,25 @@ + + + + + +Rng | DeviceScript + + + + + + + + +
+
Skip to main content

Rng

caution

This service is rc and may change in the future.

Generates random numbers using entropy sourced from physical processes.

This typically uses a cryptographical pseudo-random number generator (for example Fortuna), +which is periodically re-seeded with entropy coming from some hardware source.

import { Rng } from "@devicescript/core"

const rng = new Rng()

Registers

random

A register that returns a 64 bytes random buffer on every request. +This never blocks for a long time. If you need additional random bytes, keep querying the register.

  • type: Register<Buffer> (packing format b)

  • track incoming values

import { Rng } from "@devicescript/core"

const rng = new Rng()
// ...
rng.random.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of algorithm/technique used to generate the number. +Quantum refers to dedicated hardware device generating random noise due to quantum effects. +ADCNoise is the noise from quick readings of analog-digital converter, which reads temperature of the MCU or some floating pin. +WebCrypto refers is used in simulators, where the source of randomness comes from an advanced operating system.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Rng } from "@devicescript/core"

const rng = new Rng()
// ...
const value = await rng.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/rolemanager.html b/api/clients/rolemanager.html new file mode 100644 index 00000000000..6423e4b76f5 --- /dev/null +++ b/api/clients/rolemanager.html @@ -0,0 +1,21 @@ + + + + + +RoleManager | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/ros.html b/api/clients/ros.html new file mode 100644 index 00000000000..cded4dad3fc --- /dev/null +++ b/api/clients/ros.html @@ -0,0 +1,21 @@ + + + + + +Ros | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/rotaryencoder.html b/api/clients/rotaryencoder.html new file mode 100644 index 00000000000..d900c50a57b --- /dev/null +++ b/api/clients/rotaryencoder.html @@ -0,0 +1,22 @@ + + + + + +RotaryEncoder | DeviceScript + + + + + + + + +
+
Skip to main content

RotaryEncoder

An incremental rotary encoder - converts angular motion of a shaft to digital signal.

import { RotaryEncoder } from "@devicescript/core"

const rotaryEncoder = new RotaryEncoder()

Registers

reading

Upon device reset starts at 0 (regardless of the shaft position). +Increases by 1 for a clockwise "click", by -1 for counter-clockwise.

  • type: Register<number> (packing format i32)

  • read only

import { RotaryEncoder } from "@devicescript/core"

const rotaryEncoder = new RotaryEncoder()
// ...
const value = await rotaryEncoder.reading.read()
  • track incoming values
import { RotaryEncoder } from "@devicescript/core"

const rotaryEncoder = new RotaryEncoder()
// ...
rotaryEncoder.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

clicksPerTurn

This specifies by how much position changes when the crank does 360 degree turn. Typically 12 or 24.

  • type: Register<number> (packing format u16)

  • constant: the register value will not change (until the next reset)

  • read only

import { RotaryEncoder } from "@devicescript/core"

const rotaryEncoder = new RotaryEncoder()
// ...
const value = await rotaryEncoder.clicksPerTurn.read()
note

write and read will block until a server is bound to the client.

clicker

The encoder is combined with a clicker. If this is the case, the clicker button service +should follow this service in the service list of the device.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { RotaryEncoder } from "@devicescript/core"

const rotaryEncoder = new RotaryEncoder()
// ...
const value = await rotaryEncoder.clicker.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/rover.html b/api/clients/rover.html new file mode 100644 index 00000000000..7cd957790ed --- /dev/null +++ b/api/clients/rover.html @@ -0,0 +1,20 @@ + + + + + +Rover | DeviceScript + + + + + + + + +
+
Skip to main content

Rover

caution

This service is experimental and may change in the future.

A roving robot.

import { Rover } from "@devicescript/core"

const rover = new Rover()

Registers

reading

The current position and orientation of the robot.

  • type: Register<any[]> (packing format i16.16 i16.16 i16.16 i16.16 i16.16)

  • track incoming values

import { Rover } from "@devicescript/core"

const rover = new Rover()
// ...
rover.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/satelittenavigationsystem.html b/api/clients/satelittenavigationsystem.html new file mode 100644 index 00000000000..aa876f65587 --- /dev/null +++ b/api/clients/satelittenavigationsystem.html @@ -0,0 +1,20 @@ + + + + + +SatNav | DeviceScript + + + + + + + + +
+
Skip to main content

SatNav

caution

This service is experimental and may change in the future.

A satellite-based navigation system like GPS, Gallileo, ...

import { SatNav } from "@devicescript/core"

const satNav = new SatNav()

Registers

reading

Reported coordinates, geometric altitude and time of position. Altitude accuracy is 0 if not available.

  • type: Register<any[]> (packing format u64 i9.23 i9.23 u16.16 i26.6 u16.16)

  • track incoming values

import { SatNav } from "@devicescript/core"

const satNav = new SatNav()
// ...
satNav.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Enables or disables the GPS module

  • type: Register<boolean> (packing format u8)

  • read and write

import { SatNav } from "@devicescript/core"

const satNav = new SatNav()
// ...
const value = await satNav.enabled.read()
await satNav.enabled.write(value)
  • track incoming values
import { SatNav } from "@devicescript/core"

const satNav = new SatNav()
// ...
satNav.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

Events

inactive

The module is disabled or lost connection with satellites.

satNav.inactive.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/sensoraggregator.html b/api/clients/sensoraggregator.html new file mode 100644 index 00000000000..9f1933d1e05 --- /dev/null +++ b/api/clients/sensoraggregator.html @@ -0,0 +1,22 @@ + + + + + +SensorAggregator | DeviceScript + + + + + + + + +
+
Skip to main content

SensorAggregator

caution

This service is experimental and may change in the future.

Aggregate data from multiple sensors into a single stream +(often used as input to machine learning models on the same device, see model runner service).

import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()

Registers

inputs

Set automatic input collection. +These settings are stored in flash.

  • type: Register<any[]> (packing format u16 u16 u32 r: b[8] u32 u8 u8 u8 i8)

  • track incoming values

import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
sensorAggregator.inputs.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

numSamples

Number of input samples collected so far.

  • type: Register<number> (packing format u32)

  • read only

import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
const value = await sensorAggregator.numSamples.read()
  • track incoming values
import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
sensorAggregator.numSamples.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

sampleSize

Size of a single sample.

  • type: Register<number> (packing format u8)

  • read only

import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
const value = await sensorAggregator.sampleSize.read()
  • track incoming values
import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
sensorAggregator.sampleSize.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

streamingSamples

When set to N, will stream N samples as current_sample reading.

  • type: Register<number> (packing format u32)

  • read and write

import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
const value = await sensorAggregator.streamingSamples.read()
await sensorAggregator.streamingSamples.write(value)
  • track incoming values
import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
sensorAggregator.streamingSamples.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

reading

Last collected sample.

  • type: Register<Buffer> (packing format b)

  • track incoming values

import { SensorAggregator } from "@devicescript/core"

const sensorAggregator = new SensorAggregator()
// ...
sensorAggregator.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/serial.html b/api/clients/serial.html new file mode 100644 index 00000000000..08fa46158df --- /dev/null +++ b/api/clients/serial.html @@ -0,0 +1,21 @@ + + + + + +Serial | DeviceScript + + + + + + + + +
+
Skip to main content

Serial

caution

This service is experimental and may change in the future.

An asynchronous serial communication service capable of sending and receiving buffers of data. +Settings default to 115200 baud 8N1.

import { Serial } from "@devicescript/core"

const serial = new Serial()

Commands

send

Send a buffer of data over the serial transport.

serial.send(data: Buffer): Promise<void>

Registers

enabled

Indicates if the serial connection is active.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.enabled.read()
await serial.enabled.write(value)
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

connectionName

User-friendly name of the connection.

  • type: Register<string> (packing format s)

  • optional: this register may not be implemented

  • read only

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.connectionName.read()
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.connectionName.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

baudRate

A positive, non-zero value indicating the baud rate at which serial communication is be established.

  • type: Register<number> (packing format u32)

  • read and write

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.baudRate.read()
await serial.baudRate.write(value)
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.baudRate.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

dataBits

The number of data bits per frame. Either 7 or 8.

  • type: Register<number> (packing format u8)

  • read and write

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.dataBits.read()
await serial.dataBits.write(value)
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.dataBits.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

stopBits

The number of stop bits at the end of a frame. Either 1 or 2.

  • type: Register<number> (packing format u8)

  • read and write

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.stopBits.read()
await serial.stopBits.write(value)
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.stopBits.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

parityMode

The parity mode.

  • type: Register<number> (packing format u8)

  • read and write

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.parityMode.read()
await serial.parityMode.write(value)
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.parityMode.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

bufferSize

A positive, non-zero value indicating the size of the read and write buffers that should be created.

  • type: Register<number> (packing format u8)

  • read and write

import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
const value = await serial.bufferSize.read()
await serial.bufferSize.write(value)
  • track incoming values
import { Serial } from "@devicescript/core"

const serial = new Serial()
// ...
serial.bufferSize.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/servo.html b/api/clients/servo.html new file mode 100644 index 00000000000..dcc110495c6 --- /dev/null +++ b/api/clients/servo.html @@ -0,0 +1,21 @@ + + + + + +Servo | DeviceScript + + + + + + + + +
+
Skip to main content

Servo

Servo is a small motor with arm that can be pointing at a specific direction. +Typically a servo angle is between 0° and 180° where 90° is the middle resting position.

The min_pulse/max_pulse may be read-only if the servo is permanently affixed to its Jacdac controller.

import { Servo } from "@devicescript/core"

const servo = new Servo()

Registers

angle

Specifies the angle of the arm (request).

  • type: Register<number> (packing format i16.16)

  • read and write

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.angle.read()
await servo.angle.write(value)
  • track incoming values
import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
servo.angle.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turn the power to the servo on/off.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.enabled.read()
await servo.enabled.write(value)
  • track incoming values
import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
servo.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

offset

Correction applied to the angle to account for the servo arm drift.

  • type: Register<number> (packing format i16.16)

  • read and write

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.offset.read()
await servo.offset.write(value)
  • track incoming values
import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
servo.offset.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minValue

Lowest angle that can be set, typiclly 0 °.

  • type: Register<number> (packing format i16.16)

  • constant: the register value will not change (until the next reset)

  • read only

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.minValue.read()
note

write and read will block until a server is bound to the client.

minPulse

The length of pulse corresponding to lowest angle.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.minPulse.read()
await servo.minPulse.write(value)
  • track incoming values
import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
servo.minPulse.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxValue

Highest angle that can be set, typically 180°.

  • type: Register<number> (packing format i16.16)

  • constant: the register value will not change (until the next reset)

  • read only

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.maxValue.read()
note

write and read will block until a server is bound to the client.

maxPulse

The length of pulse corresponding to highest angle.

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read and write

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.maxPulse.read()
await servo.maxPulse.write(value)
  • track incoming values
import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
servo.maxPulse.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

stallTorque

The servo motor will stop rotating when it is trying to move a stall_torque weight at a radial distance of 1.0 cm.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.stallTorque.read()
note

write and read will block until a server is bound to the client.

responseSpeed

Time to move 60°.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.responseSpeed.read()
note

write and read will block until a server is bound to the client.

reading

The current physical position of the arm, if the device has a way to sense the position.

  • type: Register<number> (packing format i16.16)

  • optional: this register may not be implemented

  • read only

import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
const value = await servo.reading.read()
  • track incoming values
import { Servo } from "@devicescript/core"

const servo = new Servo()
// ...
servo.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/settings.html b/api/clients/settings.html new file mode 100644 index 00000000000..68af78a3a56 --- /dev/null +++ b/api/clients/settings.html @@ -0,0 +1,21 @@ + + + + + +Settings | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/sevensegmentdisplay.html b/api/clients/sevensegmentdisplay.html new file mode 100644 index 00000000000..7a1e1543f09 --- /dev/null +++ b/api/clients/sevensegmentdisplay.html @@ -0,0 +1,21 @@ + + + + + +SevenSegmentDisplay | DeviceScript + + + + + + + + +
+
Skip to main content

SevenSegmentDisplay

caution

This service is rc and may change in the future.

A 7-segment numeric display, with one or more digits.

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()

Commands

setNumber

Shows the number on the screen using the decimal dot if available.

sevenSegmentDisplay.setNumber(value: number): Promise<void>

Registers

intensity

Controls the brightness of the LEDs. 0 means off.

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read and write

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.intensity.read()
await sevenSegmentDisplay.intensity.write(value)
  • track incoming values
import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
sevenSegmentDisplay.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

doubleDots

Turn on or off the column LEDs (separating minutes from hours, etc.) in of the segment. +If the column LEDs is not supported, the value remains false.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • read and write

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.doubleDots.read()
await sevenSegmentDisplay.doubleDots.write(value)
  • track incoming values
import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
sevenSegmentDisplay.doubleDots.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

digitCount

The number of digits available on the display.

  • type: Register<number> (packing format u8)

  • constant: the register value will not change (until the next reset)

  • read only

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.digitCount.read()
note

write and read will block until a server is bound to the client.

decimalPoint

True if decimal points are available (on all digits).

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { SevenSegmentDisplay } from "@devicescript/core"

const sevenSegmentDisplay = new SevenSegmentDisplay()
// ...
const value = await sevenSegmentDisplay.decimalPoint.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/soilmoisture.html b/api/clients/soilmoisture.html new file mode 100644 index 00000000000..d77a52b5b7e --- /dev/null +++ b/api/clients/soilmoisture.html @@ -0,0 +1,20 @@ + + + + + +SoilMoisture | DeviceScript + + + + + + + + +
+
Skip to main content

SoilMoisture

A soil moisture sensor.

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()

Registers

reading

Indicates the wetness of the soil, from dry to wet.

  • type: Register<number> (packing format u0.16)

  • read only

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
const value = await soilMoisture.reading.read()
  • track incoming values
import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
soilMoisture.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The error on the moisture reading.

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read only

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
const value = await soilMoisture.readingError.read()
  • track incoming values
import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
soilMoisture.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Describe the type of physical sensor.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
const value = await soilMoisture.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/solenoid.html b/api/clients/solenoid.html new file mode 100644 index 00000000000..86d485ba0fa --- /dev/null +++ b/api/clients/solenoid.html @@ -0,0 +1,20 @@ + + + + + +Solenoid | DeviceScript + + + + + + + + +
+
Skip to main content

Solenoid

caution

This service is rc and may change in the future.

A push-pull solenoid is a type of relay that pulls a coil when activated.

import { Solenoid } from "@devicescript/core"

const solenoid = new Solenoid()

Registers

enabled

Indicates whether the solenoid is energized and pulled (on) or pushed (off).

  • type: Register<boolean> (packing format u8)

  • read and write

import { Solenoid } from "@devicescript/core"

const solenoid = new Solenoid()
// ...
const value = await solenoid.enabled.read()
await solenoid.enabled.write(value)
  • track incoming values
import { Solenoid } from "@devicescript/core"

const solenoid = new Solenoid()
// ...
solenoid.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Describes the type of solenoid used.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Solenoid } from "@devicescript/core"

const solenoid = new Solenoid()
// ...
const value = await solenoid.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/soundlevel.html b/api/clients/soundlevel.html new file mode 100644 index 00000000000..493a733342b --- /dev/null +++ b/api/clients/soundlevel.html @@ -0,0 +1,20 @@ + + + + + +SoundLevel | DeviceScript + + + + + + + + +
+
Skip to main content

SoundLevel

caution

This service is rc and may change in the future.

A sound level detector sensor, gives a relative indication of the sound level.

import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()

Registers

reading

The sound level detected by the microphone

  • type: Register<number> (packing format u0.16)

  • read only

import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
const value = await soundLevel.reading.read()
  • track incoming values
import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
soundLevel.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turn on or off the microphone.

  • type: Register<boolean> (packing format u8)

  • read and write

import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
const value = await soundLevel.enabled.read()
await soundLevel.enabled.write(value)
  • track incoming values
import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
soundLevel.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

activeThreshold

Set level at which the loud event is generated.

  • type: Register<number> (packing format u0.16)

  • read and write

import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
const value = await soundLevel.activeThreshold.read()
await soundLevel.activeThreshold.write(value)
  • track incoming values
import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
soundLevel.activeThreshold.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

inactiveThreshold

Set level at which the quiet event is generated.

  • type: Register<number> (packing format u0.16)

  • read and write

import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
const value = await soundLevel.inactiveThreshold.read()
await soundLevel.inactiveThreshold.write(value)
  • track incoming values
import { SoundLevel } from "@devicescript/core"

const soundLevel = new SoundLevel()
// ...
soundLevel.inactiveThreshold.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

Events

loud

Generated when a loud sound is detected.

soundLevel.loud.subscribe(() => {

})

quiet

Generated low level of sound is detected.

soundLevel.quiet.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/soundplayer.html b/api/clients/soundplayer.html new file mode 100644 index 00000000000..7659eef9740 --- /dev/null +++ b/api/clients/soundplayer.html @@ -0,0 +1,20 @@ + + + + + +SoundPlayer | DeviceScript + + + + + + + + +
+
Skip to main content

SoundPlayer

caution

This service is rc and may change in the future.

A device that can play various sounds stored locally. This service is typically paired with a storage service for storing sounds.

import { SoundPlayer } from "@devicescript/core"

const soundPlayer = new SoundPlayer()

Commands

play

Starts playing a sound.

soundPlayer.play(name: string): Promise<void>

cancel

Cancel any sound playing.

soundPlayer.cancel(): Promise<void>

Registers

intensity

Global volume of the output. 0 means completely off. This volume is mixed with each play volumes.

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read and write

import { SoundPlayer } from "@devicescript/core"

const soundPlayer = new SoundPlayer()
// ...
const value = await soundPlayer.intensity.read()
await soundPlayer.intensity.write(value)
  • track incoming values
import { SoundPlayer } from "@devicescript/core"

const soundPlayer = new SoundPlayer()
// ...
soundPlayer.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/soundrecorderwithplayback.html b/api/clients/soundrecorderwithplayback.html new file mode 100644 index 00000000000..1cfa1811376 --- /dev/null +++ b/api/clients/soundrecorderwithplayback.html @@ -0,0 +1,20 @@ + + + + + +SoundRecorderWithPlayback | DeviceScript + + + + + + + + +
+
Skip to main content

SoundRecorderWithPlayback

caution

This service is experimental and may change in the future.

A record and replay module. You can record a few seconds of audio and play it back.

import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()

Commands

play

Replay recorded audio.

soundRecorderWithPlayback.play(): Promise<void>

record

Record audio for N milliseconds.

soundRecorderWithPlayback.record(duration: number): Promise<void>

cancel

Cancel record, the time register will be updated by already cached data.

soundRecorderWithPlayback.cancel(): Promise<void>

Registers

status

Indicate the current status

  • type: Register<number> (packing format u8)

  • read only

import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()
// ...
const value = await soundRecorderWithPlayback.status.read()
  • track incoming values
import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()
// ...
soundRecorderWithPlayback.status.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

time

Milliseconds of audio recorded.

  • type: Register<number> (packing format u16)

  • read only

import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()
// ...
const value = await soundRecorderWithPlayback.time.read()
  • track incoming values
import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()
// ...
soundRecorderWithPlayback.time.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

intensity

Playback volume control

  • type: Register<number> (packing format u0.8)

  • optional: this register may not be implemented

  • read and write

import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()
// ...
const value = await soundRecorderWithPlayback.intensity.read()
await soundRecorderWithPlayback.intensity.write(value)
  • track incoming values
import { SoundRecorderWithPlayback } from "@devicescript/core"

const soundRecorderWithPlayback = new SoundRecorderWithPlayback()
// ...
soundRecorderWithPlayback.intensity.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/soundspectrum.html b/api/clients/soundspectrum.html new file mode 100644 index 00000000000..8db67533f80 --- /dev/null +++ b/api/clients/soundspectrum.html @@ -0,0 +1,21 @@ + + + + + +SoundSpectrum | DeviceScript + + + + + + + + +
+
Skip to main content

SoundSpectrum

caution

This service is experimental and may change in the future.

A microphone that analyzes the sound specturm

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()

Registers

reading

The computed frequency data.

  • type: Register<Buffer> (packing format b)

  • track incoming values

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
soundSpectrum.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turns on/off the micropohone.

  • type: Register<boolean> (packing format u8)

  • read and write

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
const value = await soundSpectrum.enabled.read()
await soundSpectrum.enabled.write(value)
  • track incoming values
import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
soundSpectrum.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

fftPow2Size

The power of 2 used as the size of the FFT to be used to determine the frequency domain.

  • type: Register<number> (packing format u8)

  • read and write

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
const value = await soundSpectrum.fftPow2Size.read()
await soundSpectrum.fftPow2Size.write(value)
  • track incoming values
import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
soundSpectrum.fftPow2Size.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minDecibels

The minimum power value in the scaling range for the FFT analysis data

  • type: Register<number> (packing format i16)

  • read and write

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
const value = await soundSpectrum.minDecibels.read()
await soundSpectrum.minDecibels.write(value)
  • track incoming values
import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
soundSpectrum.minDecibels.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxDecibels

The maximum power value in the scaling range for the FFT analysis data

  • type: Register<number> (packing format i16)

  • read and write

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
const value = await soundSpectrum.maxDecibels.read()
await soundSpectrum.maxDecibels.write(value)
  • track incoming values
import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
soundSpectrum.maxDecibels.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

smoothingTimeConstant

The averaging constant with the last analysis frame. +If 0 is set, there is no averaging done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value".

  • type: Register<number> (packing format u0.8)

  • read and write

import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
const value = await soundSpectrum.smoothingTimeConstant.read()
await soundSpectrum.smoothingTimeConstant.write(value)
  • track incoming values
import { SoundSpectrum } from "@devicescript/core"

const soundSpectrum = new SoundSpectrum()
// ...
soundSpectrum.smoothingTimeConstant.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/speechsynthesis.html b/api/clients/speechsynthesis.html new file mode 100644 index 00000000000..070d5948e0f --- /dev/null +++ b/api/clients/speechsynthesis.html @@ -0,0 +1,20 @@ + + + + + +SpeechSynthesis | DeviceScript + + + + + + + + +
+
Skip to main content

SpeechSynthesis

caution

This service is rc and may change in the future.

A speech synthesizer

import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()

Commands

speak

Adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.

speechSynthesis.speak(text: string): Promise<void>

cancel

Cancels current utterance and all utterances from the utterance queue.

speechSynthesis.cancel(): Promise<void>

Registers

enabled

Determines if the speech engine is in a non-paused state.

  • type: Register<boolean> (packing format u8)

  • read and write

import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
const value = await speechSynthesis.enabled.read()
await speechSynthesis.enabled.write(value)
  • track incoming values
import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
speechSynthesis.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

lang

Language used for utterances as defined in https://www.ietf.org/rfc/bcp/bcp47.txt.

  • type: Register<string> (packing format s)

  • optional: this register may not be implemented

  • read and write

import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
const value = await speechSynthesis.lang.read()
await speechSynthesis.lang.write(value)
  • track incoming values
import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
speechSynthesis.lang.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

volume

Volume for utterances.

  • type: Register<number> (packing format u0.8)

  • optional: this register may not be implemented

  • read and write

import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
const value = await speechSynthesis.volume.read()
await speechSynthesis.volume.write(value)
  • track incoming values
import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
speechSynthesis.volume.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

pitch

Pitch for utterances

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read and write

import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
const value = await speechSynthesis.pitch.read()
await speechSynthesis.pitch.write(value)
  • track incoming values
import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
speechSynthesis.pitch.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

rate

Rate for utterances

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read and write

import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
const value = await speechSynthesis.rate.read()
await speechSynthesis.rate.write(value)
  • track incoming values
import { SpeechSynthesis } from "@devicescript/core"

const speechSynthesis = new SpeechSynthesis()
// ...
speechSynthesis.rate.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/switch.html b/api/clients/switch.html new file mode 100644 index 00000000000..55fbdd6d650 --- /dev/null +++ b/api/clients/switch.html @@ -0,0 +1,20 @@ + + + + + +Switch | DeviceScript + + + + + + + + +
+
Skip to main content

Switch

caution

This service is rc and may change in the future.

A switch, which keeps its position.

import { Switch } from "@devicescript/core"

const sw = new Switch()

Registers

reading

Indicates whether the switch is currently active (on).

  • type: Register<boolean> (packing format u8)

  • read only

import { Switch } from "@devicescript/core"

const sw = new Switch()
// ...
const value = await sw.reading.read()
  • track incoming values
import { Switch } from "@devicescript/core"

const sw = new Switch()
// ...
sw.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Describes the type of switch used.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Switch } from "@devicescript/core"

const sw = new Switch()
// ...
const value = await sw.variant.read()
note

write and read will block until a server is bound to the client.

Events

on

Emitted when switch goes from off to on.

sw.on.subscribe(() => {

})

off

Emitted when switch goes from on to off.

sw.off.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/tcp.html b/api/clients/tcp.html new file mode 100644 index 00000000000..3ddfe429002 --- /dev/null +++ b/api/clients/tcp.html @@ -0,0 +1,21 @@ + + + + + +Tcp | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/temperature.html b/api/clients/temperature.html new file mode 100644 index 00000000000..238fee776be --- /dev/null +++ b/api/clients/temperature.html @@ -0,0 +1,20 @@ + + + + + +Temperature | DeviceScript + + + + + + + + +
+
Skip to main content

Temperature

A thermometer measuring outside or inside environment.

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()

Registers

reading

The temperature.

  • type: Register<number> (packing format i22.10)

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.reading.read()
  • track incoming values
import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
temperature.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Lowest temperature that can be reported.

  • type: Register<number> (packing format i22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Highest temperature that can be reported.

  • type: Register<number> (packing format i22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.maxReading.read()
note

write and read will block until a server is bound to the client.

readingError

The real temperature is between temperature - temperature_error and temperature + temperature_error.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.readingError.read()
  • track incoming values
import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
temperature.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Specifies the type of thermometer.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/timeseriesaggregator.html b/api/clients/timeseriesaggregator.html new file mode 100644 index 00000000000..563e7cf62c8 --- /dev/null +++ b/api/clients/timeseriesaggregator.html @@ -0,0 +1,28 @@ + + + + + +TimeseriesAggregator | DeviceScript + + + + + + + + +
+
Skip to main content

TimeseriesAggregator

caution

This service is experimental and may change in the future.

Supports aggregating timeseries data (especially sensor readings) +and sending them to a cloud/storage service. +Used in DeviceScript.

Note that f64 values are not necessarily aligned.

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()

Commands

clear

Remove all pending timeseries.

timeseriesAggregator.clear(): Promise<void>

update

Add a data point to a timeseries.

timeseriesAggregator.update(value: number, label: string): Promise<void>

setWindow

Set aggregation window. +Setting to 0 will restore default.

timeseriesAggregator.setWindow(duration: number, label: string): Promise<void>

setUpload

Set whether or not the timeseries will be uploaded to the cloud. +The stored reports are generated regardless.

timeseriesAggregator.setUpload(upload: boolean, label: string): Promise<void>

Registers

now

This can queried to establish local time on the device.

  • type: Register<number> (packing format u32)

  • read only

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
const value = await timeseriesAggregator.now.read()
  • track incoming values
import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
timeseriesAggregator.now.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

fastStart

When true, the windows will be shorter after service reset and gradually extend to requested length. +This is ensure valid data is being streamed in program development.

  • type: Register<boolean> (packing format u8)

  • read and write

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
const value = await timeseriesAggregator.fastStart.read()
await timeseriesAggregator.fastStart.write(value)
  • track incoming values
import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
timeseriesAggregator.fastStart.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

defaultWindow

Window for timeseries for which set_window was never called. +Note that windows returned initially may be shorter if fast_start is enabled.

  • type: Register<number> (packing format u32)

  • read and write

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
const value = await timeseriesAggregator.defaultWindow.read()
await timeseriesAggregator.defaultWindow.write(value)
  • track incoming values
import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
timeseriesAggregator.defaultWindow.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

defaultUpload

Whether labelled timeseries for which set_upload was never called should be automatically uploaded.

  • type: Register<boolean> (packing format u8)

  • read and write

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
const value = await timeseriesAggregator.defaultUpload.read()
await timeseriesAggregator.defaultUpload.write(value)
  • track incoming values
import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
timeseriesAggregator.defaultUpload.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

uploadUnlabelled

Whether automatically created timeseries not bound in role manager should be uploaded.

  • type: Register<boolean> (packing format u8)

  • read and write

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
const value = await timeseriesAggregator.uploadUnlabelled.read()
await timeseriesAggregator.uploadUnlabelled.write(value)
  • track incoming values
import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
timeseriesAggregator.uploadUnlabelled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

sensorWatchdogPeriod

If no data is received from any sensor within given period, the device is rebooted. +Set to 0 to disable (default). +Updating user-provided timeseries does not reset the watchdog.

  • type: Register<number> (packing format u32)

  • read and write

import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
const value = await timeseriesAggregator.sensorWatchdogPeriod.read()
await timeseriesAggregator.sensorWatchdogPeriod.write(value)
  • track incoming values
import { TimeseriesAggregator } from "@devicescript/core"

const timeseriesAggregator = new TimeseriesAggregator()
// ...
timeseriesAggregator.sensorWatchdogPeriod.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/trafficlight.html b/api/clients/trafficlight.html new file mode 100644 index 00000000000..b921041e4f9 --- /dev/null +++ b/api/clients/trafficlight.html @@ -0,0 +1,20 @@ + + + + + +TrafficLight | DeviceScript + + + + + + + + +
+
Skip to main content

TrafficLight

caution

This service is rc and may change in the future.

Controls a mini traffic with a red, orange and green LED.

import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()

Registers

red

The on/off state of the red light.

  • type: Register<boolean> (packing format u8)

  • read and write

import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()
// ...
const value = await trafficLight.red.read()
await trafficLight.red.write(value)
  • track incoming values
import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()
// ...
trafficLight.red.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

yellow

The on/off state of the yellow light.

  • type: Register<boolean> (packing format u8)

  • read and write

import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()
// ...
const value = await trafficLight.yellow.read()
await trafficLight.yellow.write(value)
  • track incoming values
import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()
// ...
trafficLight.yellow.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

green

The on/off state of the green light.

  • type: Register<boolean> (packing format u8)

  • read and write

import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()
// ...
const value = await trafficLight.green.read()
await trafficLight.green.write(value)
  • track incoming values
import { TrafficLight } from "@devicescript/core"

const trafficLight = new TrafficLight()
// ...
trafficLight.green.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/tvoc.html b/api/clients/tvoc.html new file mode 100644 index 00000000000..9cd91231606 --- /dev/null +++ b/api/clients/tvoc.html @@ -0,0 +1,20 @@ + + + + + +Tvoc | DeviceScript + + + + + + + + +
+
Skip to main content

Tvoc

Measures equivalent Total Volatile Organic Compound levels.

import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()

Registers

reading

Total volatile organic compound readings in parts per billion.

  • type: Register<number> (packing format u22.10)

  • read only

import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()
// ...
const value = await tvoc.reading.read()
  • track incoming values
import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()
// ...
tvoc.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reading data

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()
// ...
const value = await tvoc.readingError.read()
  • track incoming values
import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()
// ...
tvoc.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

minReading

Minimum measurable value

  • type: Register<number> (packing format u22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()
// ...
const value = await tvoc.minReading.read()
note

write and read will block until a server is bound to the client.

maxReading

Minimum measurable value.

  • type: Register<number> (packing format u22.10)

  • constant: the register value will not change (until the next reset)

  • read only

import { Tvoc } from "@devicescript/core"

const tvoc = new Tvoc()
// ...
const value = await tvoc.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/uniquebrain.html b/api/clients/uniquebrain.html new file mode 100644 index 00000000000..fea52942101 --- /dev/null +++ b/api/clients/uniquebrain.html @@ -0,0 +1,21 @@ + + + + + +UniqueBrain | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/usbbridge.html b/api/clients/usbbridge.html new file mode 100644 index 00000000000..a3f35c5950a --- /dev/null +++ b/api/clients/usbbridge.html @@ -0,0 +1,31 @@ + + + + + +UsbBridge | DeviceScript + + + + + + + + +
+
Skip to main content

UsbBridge

caution

This service is rc and may change in the future.

This service is normally not announced or otherwise exposed on the serial bus. +It is used to communicate with a USB-Jacdac bridge at the USB layer. +The host sends broadcast packets to this service to control the link layer. +The device responds with broadcast reports (no-one else does that). +These packets are not forwarded to the UART Jacdac line.

Packets are sent over USB Serial (CDC). +The host shall set the CDC to 1Mbaud 8N1 +(even though in some cases the USB interface is connected directly to the MCU and line settings are +ignored).

The CDC line carries both Jacdac frames and serial logging output. +Jacdac frames have valid CRC and are framed by delimeter characters and possibly fragmented.

0xFE is used as a framing byte. +Note that bytes 0xF8-0xFF are always invalid UTF-8. +0xFF occurs relatively often in Jacdac packets, so is not used for framing.

The following sequences are supported:

  • 0xFE 0xF8 - literal 0xFE
  • 0xFE 0xF9 - reserved; ignore
  • 0xFE 0xFA - indicates that some serial logs were dropped at this point
  • 0xFE 0xFB - indicates that some Jacdac frames were dropped at this point
  • 0xFE 0xFC - Jacdac frame start
  • 0xFE 0xFD - Jacdac frame end

0xFE followed by any other byte:

  • in serial, should be treated as literal 0xFE (and the byte as itself, unless it's 0xFE)
  • in frame data, should terminate the current frame fragment, +and ideally have all data (incl. fragment start) in the current frame fragment treated as serial

import { UsbBridge } from "@devicescript/core"

const usbBridge = new UsbBridge()

Commands

disablePackets

Disables forwarding of Jacdac packets.

usbBridge.disablePackets(): Promise<void>

enablePackets

Enables forwarding of Jacdac packets.

usbBridge.enablePackets(): Promise<void>

disableLog

Disables forwarding of serial log messages.

usbBridge.disableLog(): Promise<void>

enableLog

Enables forwarding of serial log messages.

usbBridge.enableLog(): Promise<void>

+ + + + \ No newline at end of file diff --git a/api/clients/uvindex.html b/api/clients/uvindex.html new file mode 100644 index 00000000000..d03cc1a12e6 --- /dev/null +++ b/api/clients/uvindex.html @@ -0,0 +1,20 @@ + + + + + +UvIndex | DeviceScript + + + + + + + + +
+
Skip to main content

UvIndex

The UV Index is a measure of the intensity of ultraviolet (UV) rays from the Sun.

import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()

Registers

reading

Ultraviolet index, typically refreshed every second.

  • type: Register<number> (packing format u16.16)

  • read only

import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()
// ...
const value = await uvIndex.reading.read()
  • track incoming values
import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()
// ...
uvIndex.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the UV measure.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()
// ...
const value = await uvIndex.readingError.read()
  • track incoming values
import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()
// ...
uvIndex.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of physical sensor and capabilities.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { UvIndex } from "@devicescript/core"

const uvIndex = new UvIndex()
// ...
const value = await uvIndex.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/verifiedtelemetrysensor.html b/api/clients/verifiedtelemetrysensor.html new file mode 100644 index 00000000000..f79d90b1d7c --- /dev/null +++ b/api/clients/verifiedtelemetrysensor.html @@ -0,0 +1,20 @@ + + + + + +VerifiedTelemetry | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/clients/vibrationmotor.html b/api/clients/vibrationmotor.html new file mode 100644 index 00000000000..75c0e1c7a20 --- /dev/null +++ b/api/clients/vibrationmotor.html @@ -0,0 +1,20 @@ + + + + + +VibrationMotor | DeviceScript + + + + + + + + +
+
Skip to main content

VibrationMotor

A vibration motor.

import { VibrationMotor } from "@devicescript/core"

const vibrationMotor = new VibrationMotor()

Commands

vibrate

Starts a sequence of vibration and pauses. To stop any existing vibration, send an empty payload.

vibrationMotor.vibrate(duration: number, intensity: number): Promise<void>

Registers

maxVibrations

The maximum number of vibration sequences supported in a single packet.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { VibrationMotor } from "@devicescript/core"

const vibrationMotor = new VibrationMotor()
// ...
const value = await vibrationMotor.maxVibrations.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/waterlevel.html b/api/clients/waterlevel.html new file mode 100644 index 00000000000..af1f391dc07 --- /dev/null +++ b/api/clients/waterlevel.html @@ -0,0 +1,20 @@ + + + + + +WaterLevel | DeviceScript + + + + + + + + +
+
Skip to main content

WaterLevel

caution

This service is rc and may change in the future.

A sensor that measures liquid/water level.

import { WaterLevel } from "@devicescript/core"

const waterLevel = new WaterLevel()

Registers

reading

The reported water level.

  • type: Register<number> (packing format u0.16)

  • read only

import { WaterLevel } from "@devicescript/core"

const waterLevel = new WaterLevel()
// ...
const value = await waterLevel.reading.read()
  • track incoming values
import { WaterLevel } from "@devicescript/core"

const waterLevel = new WaterLevel()
// ...
waterLevel.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The error rage on the current reading

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read only

import { WaterLevel } from "@devicescript/core"

const waterLevel = new WaterLevel()
// ...
const value = await waterLevel.readingError.read()
  • track incoming values
import { WaterLevel } from "@devicescript/core"

const waterLevel = new WaterLevel()
// ...
waterLevel.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

The type of physical sensor.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { WaterLevel } from "@devicescript/core"

const waterLevel = new WaterLevel()
// ...
const value = await waterLevel.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/weightscale.html b/api/clients/weightscale.html new file mode 100644 index 00000000000..8720d708752 --- /dev/null +++ b/api/clients/weightscale.html @@ -0,0 +1,21 @@ + + + + + +WeightScale | DeviceScript + + + + + + + + +
+
Skip to main content

WeightScale

caution

This service is rc and may change in the future.

A weight measuring sensor.

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()

Commands

calibrateZeroOffset

Call this command when there is nothing on the scale. If supported, the module should save the calibration data.

weightScale.calibrateZeroOffset(): Promise<void>

calibrateGain

Call this command with the weight of the thing on the scale.

weightScale.calibrateGain(weight: number): Promise<void>

Registers

reading

The reported weight.

  • type: Register<number> (packing format u16.16)

  • read only

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.reading.read()
  • track incoming values
import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
weightScale.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The estimate error on the reported reading.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.readingError.read()
  • track incoming values
import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
weightScale.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

zeroOffset

Calibrated zero offset error on the scale, i.e. the measured weight when nothing is on the scale. +You do not need to subtract that from the reading, it has already been done.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read and write

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.zeroOffset.read()
await weightScale.zeroOffset.write(value)
  • track incoming values
import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
weightScale.zeroOffset.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

gain

Calibrated gain on the weight scale error.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read and write

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.gain.read()
await weightScale.gain.write(value)
  • track incoming values
import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
weightScale.gain.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxReading

Maximum supported weight on the scale.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.maxReading.read()
note

write and read will block until a server is bound to the client.

minReading

Minimum recommend weight on the scale.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.minReading.read()
note

write and read will block until a server is bound to the client.

readingResolution

Smallest, yet distinguishable change in reading.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.readingResolution.read()
note

write and read will block until a server is bound to the client.

variant

The type of physical scale

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { WeightScale } from "@devicescript/core"

const weightScale = new WeightScale()
// ...
const value = await weightScale.variant.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/wifi.html b/api/clients/wifi.html new file mode 100644 index 00000000000..9311e13ac20 --- /dev/null +++ b/api/clients/wifi.html @@ -0,0 +1,36 @@ + + + + + +Wifi | DeviceScript + + + + + + + + +
+
Skip to main content

Wifi

caution

This service is rc and may change in the future.

Discovery and connection to WiFi networks. Separate TCP service can be used for data transfer.

About

Connection

The device controlled by this service is meant to connect automatically, once configured. +To that end, it keeps a list of known WiFi networks, with priorities and passwords. +It will connect to the available network with numerically highest priority, +breaking ties in priority by signal strength (typically all known networks have priority of 0). +If the connection fails (due to wrong password, radio failure, or other problem) +an connection_failed event is emitted, and the device will try to connect to the next eligible network. +When networks are exhausted, the scan is performed again and the connection process restarts.

Updating networks (setting password, priorties, forgetting) does not trigger an automatic reconnect.

Captive portals

If the Wifi is not able to join an AP because it needs to receive a password, it may decide to enter a mode +where it waits for user input. Typical example of this mode would be a captive portal or waiting for a BLE interaction. +In that situation, the status_code should set to WaitingForInput.

import { Wifi } from "@devicescript/core"

const wifi = new Wifi()

Commands

addNetwork

Automatically connect to named network if available. Also set password if network is not open.

wifi.addNetwork(ssid: string, password: string): Promise<void>

reconnect

Enable the WiFi (if disabled), initiate a scan, wait for results, disconnect from current WiFi network if any, +and then reconnect (using regular algorithm, see set_network_priority).

wifi.reconnect(): Promise<void>

forgetNetwork

Prevent from automatically connecting to named network in future. +Forgetting a network resets its priority to 0.

wifi.forgetNetwork(ssid: string): Promise<void>

forgetAllNetworks

Clear the list of known networks.

wifi.forgetAllNetworks(): Promise<void>

setNetworkPriority

Set connection priority for a network. +By default, all known networks have priority of 0.

wifi.setNetworkPriority(priority: number, ssid: string): Promise<void>

scan

Initiate search for WiFi networks. Generates scan_complete event.

wifi.scan(): Promise<void>

Registers

reading

Current signal strength. Returns -128 when not connected.

  • type: Register<number> (packing format i8)

  • read only

import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
const value = await wifi.reading.read()
  • track incoming values
import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
wifi.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Determines whether the WiFi radio is enabled. It starts enabled upon reset.

  • type: Register<boolean> (packing format u8)

  • read and write

import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
const value = await wifi.enabled.read()
await wifi.enabled.write(value)
  • track incoming values
import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
wifi.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

ipAddress

0, 4 or 16 byte buffer with the IPv4 or IPv6 address assigned to device if any.

  • type: Register<Buffer> (packing format b[16])

  • track incoming values

import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
wifi.ipAddress.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

eui48

The 6-byte MAC address of the device. If a device does MAC address randomization it will have to "restart".

  • type: Register<Buffer> (packing format b[6])
  • constant: the register value will not change (until the next reset)
note

write and read will block until a server is bound to the client.

ssid

SSID of the access-point to which device is currently connected. +Empty string if not connected.

  • type: Register<string> (packing format s[32])

  • read only

import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
const value = await wifi.ssid.read()
  • track incoming values
import { Wifi } from "@devicescript/core"

const wifi = new Wifi()
// ...
wifi.ssid.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

Events

gotIp

Emitted upon successful join and IP address assignment.

wifi.gotIp.subscribe(() => {

})

lostIp

Emitted when disconnected from network.

wifi.lostIp.subscribe(() => {

})

scanComplete

A WiFi network scan has completed. Results can be read with the last_scan_results command. +The event indicates how many networks where found, and how many are considered +as candidates for connection.

wifi.scanComplete.subscribe(() => {

})

networksChanged

Emitted whenever the list of known networks is updated.

wifi.networksChanged.subscribe(() => {

})

connectionFailed

Emitted when when a network was detected in scan, the device tried to connect to it +and failed. +This may be because of wrong password or other random failure.

wifi.connectionFailed.subscribe(() => {

})

+ + + + \ No newline at end of file diff --git a/api/clients/winddirection.html b/api/clients/winddirection.html new file mode 100644 index 00000000000..e235b5faf2f --- /dev/null +++ b/api/clients/winddirection.html @@ -0,0 +1,20 @@ + + + + + +WindDirection | DeviceScript + + + + + + + + +
+
Skip to main content

WindDirection

caution

This service is rc and may change in the future.

A sensor that measures wind direction.

import { WindDirection } from "@devicescript/core"

const windDirection = new WindDirection()

Registers

reading

The direction of the wind.

  • type: Register<number> (packing format u16)

  • read only

import { WindDirection } from "@devicescript/core"

const windDirection = new WindDirection()
// ...
const value = await windDirection.reading.read()
  • track incoming values
import { WindDirection } from "@devicescript/core"

const windDirection = new WindDirection()
// ...
windDirection.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the wind direction reading

  • type: Register<number> (packing format u16)

  • optional: this register may not be implemented

  • read only

import { WindDirection } from "@devicescript/core"

const windDirection = new WindDirection()
// ...
const value = await windDirection.readingError.read()
  • track incoming values
import { WindDirection } from "@devicescript/core"

const windDirection = new WindDirection()
// ...
windDirection.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/windspeed.html b/api/clients/windspeed.html new file mode 100644 index 00000000000..f8f4408b479 --- /dev/null +++ b/api/clients/windspeed.html @@ -0,0 +1,20 @@ + + + + + +WindSpeed | DeviceScript + + + + + + + + +
+
Skip to main content

WindSpeed

caution

This service is rc and may change in the future.

A sensor that measures wind speed.

import { WindSpeed } from "@devicescript/core"

const windSpeed = new WindSpeed()

Registers

reading

The velocity of the wind.

  • type: Register<number> (packing format u16.16)

  • read only

import { WindSpeed } from "@devicescript/core"

const windSpeed = new WindSpeed()
// ...
const value = await windSpeed.reading.read()
  • track incoming values
import { WindSpeed } from "@devicescript/core"

const windSpeed = new WindSpeed()
// ...
windSpeed.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reading

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • read only

import { WindSpeed } from "@devicescript/core"

const windSpeed = new WindSpeed()
// ...
const value = await windSpeed.readingError.read()
  • track incoming values
import { WindSpeed } from "@devicescript/core"

const windSpeed = new WindSpeed()
// ...
windSpeed.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

maxReading

Maximum speed that can be measured by the sensor.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { WindSpeed } from "@devicescript/core"

const windSpeed = new WindSpeed()
// ...
const value = await windSpeed.maxReading.read()
note

write and read will block until a server is bound to the client.

+ + + + \ No newline at end of file diff --git a/api/clients/wssk.html b/api/clients/wssk.html new file mode 100644 index 00000000000..584d99ce449 --- /dev/null +++ b/api/clients/wssk.html @@ -0,0 +1,21 @@ + + + + + +Wssk | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/core.html b/api/core.html new file mode 100644 index 00000000000..a6754f415e8 --- /dev/null +++ b/api/core.html @@ -0,0 +1,21 @@ + + + + + +Code | DeviceScript + + + + + + + + +
+
Skip to main content

Code

DeviceScript provides builtin support for instantiating Jacdac service clients (role) +and binding them to Jacdac servers (sensors). Jacdac services are an abstraction layer that allow you to program in DeviceScript without having to enter the details of the hardware implementation.

Once a role is bound to a service server, DeviceScript provides the API to access its

Additional runtime components

+ + + + \ No newline at end of file diff --git a/api/core/buffers.html b/api/core/buffers.html new file mode 100644 index 00000000000..2df0ae9f9dc --- /dev/null +++ b/api/core/buffers.html @@ -0,0 +1,26 @@ + + + + + +Buffers | DeviceScript + + + + + + + + +
+
Skip to main content

Buffers

Buffers can be dynamically allocated, read and written. +This can be used to conserve memory (regular variables always take 8 bytes) +and create arrays (with fixed upper limit).

const mybuf = Buffer.alloc(12) // 12 byte buffer
mybuf.setAt(10, "u16", 123)
mybuf.setAt(3, "u22.10", 173.282)
const z = mybuf.getAt(3, "u22.10")

hex

hex is a string literal template that converts data in hexadecimal form into a readonly Buffer in flash.

// Buffer in flash!
const data = hex`010203040506070809`
console.log(data)

Comments and whitespace are allowed in hex literals:

const commentedData = hex`
01 02 03 // first three numbers
ff aa // two more bytes
`

packet

There is a special buffer called ds.packet which represents a buffer to be passed to next +command or register write. +It supports ds.packet.setLength() function (unlike regular buffers), +and can be passed to any command or register write. +For example lamp.intensity.write(0.7) is equivalent to:

const lamp = new ds.Led()
ds.packet.setLength(2)
ds.packet.setAt(0, "u0.16", 0.7)
lamp.intensity.write(ds.packet)
+ + + + \ No newline at end of file diff --git a/api/core/commands.html b/api/core/commands.html new file mode 100644 index 00000000000..25ea3426af1 --- /dev/null +++ b/api/core/commands.html @@ -0,0 +1,20 @@ + + + + + +Commands | DeviceScript + + + + + + + + +
+
Skip to main content

Commands

Commands are implemented directly on the role instance and are service specific.

import { Buzzer } from "@devicescript/core"

const buzzer = new Buzzer()

setInterval(async () => {
await buzzer.playNote(440, 1, 100)
}, 1000)
+ + + + \ No newline at end of file diff --git a/api/core/events.html b/api/core/events.html new file mode 100644 index 00000000000..3dea7091b6e --- /dev/null +++ b/api/core/events.html @@ -0,0 +1,20 @@ + + + + + +Events | DeviceScript + + + + + + + + +
+
Skip to main content

Events

Events are generated by service servers and can be subscribed with a callback.

subscribe

The subscribe method registers a callback that runs when the event is received.

const button = new ds.Button()

button.down.subscribe(() => {
console.log("click!")
})

wait

The wait method blocks the thread until the event is received.

const button = new ds.Button()

await button.down.wait()
console.log("click!")
+ + + + \ No newline at end of file diff --git a/api/core/registers.html b/api/core/registers.html new file mode 100644 index 00000000000..8e165fdb6c3 --- /dev/null +++ b/api/core/registers.html @@ -0,0 +1,20 @@ + + + + + +Registers | DeviceScript + + + + + + + + +
+
Skip to main content

Registers

The register client classe (Register<T>) allow to read, write and track changes of service registers.

Aside from the data type, there are 3 different type of access control on registers:

  • read only: the value can be read, but not written.
  • read write: the value can be read and writen.
  • const: the value of the register is constant. It may change on the next reset but this is not a common scenario.

read

The read method gets the current reported value stored in the register.

const sensor = new ds.Temperature()
setInterval(async () => {
const t = await sensor.reading.read()
console.log(t)
}, 1000)

write

The write method sets the current value of the register and only applies to read-write registers.

const led = new ds.Led()

await led.intensity.write(0.5)

subscribe

The subscribe method registers a callback that gets raised whenever a value update arrives.

const sensor = new ds.Temperature()
sensor.reading.subscribe(value => {
console.log(value)
})

The subscribe method returns an unsubscribe function that allows to remove the callback.

const sensor = new ds.Temperature()
const unsubscribe = sensor.reading.subscribe(value => {
console.log(value)
})

// later on
unsubscribe()
+ + + + \ No newline at end of file diff --git a/api/core/roles.html b/api/core/roles.html new file mode 100644 index 00000000000..9ed67e4a7d9 --- /dev/null +++ b/api/core/roles.html @@ -0,0 +1,22 @@ + + + + + +Roles | DeviceScript + + + + + + + + +
+
Skip to main content

Roles

Roles are defined by instantiating a service client. +The same role can be referenced multiple times, and runtime makes sure not to assign +multiple roles to the same service instance.

const btnA = new ds.Button()
const btnB = new ds.Button()
const pot = new ds.Potentiometer()
const lamp = new ds.LightBulb()

You can check if role is currently assigned, and react to it being assigned or unassigned:

const heater = new ds.Relay()
if (heater.isBound)
heater.enabled.write(true)
heater.onConnected(() => {
// ...
})
heater.onDisconnected(() => {
// ...
})
+ + + + \ No newline at end of file diff --git a/api/drivers.html b/api/drivers.html new file mode 100644 index 00000000000..79b1ff06fb5 --- /dev/null +++ b/api/drivers.html @@ -0,0 +1,23 @@ + + + + + +Drivers | DeviceScript + + + + + + + + +
+
Skip to main content

Drivers

Starting driver provide a programming abstraction for hardware periphericals. +Some driver implementations are builtin (written C), +while others can be contributed as DeviceScript packages.

import { gpio } from "@devicescript/core"
import { startButton } from "@devicescript/servers"

const buttonA = startButton({
pin: gpio(2),
})

You can find the list of servers in the table of contents.

Jacdac

DeviceScript supports Jacdac modules out of the box. +See Jacdac Device Catalog.

+ + + + \ No newline at end of file diff --git a/api/drivers/accelerometer.html b/api/drivers/accelerometer.html new file mode 100644 index 00000000000..3879ba5b9a7 --- /dev/null +++ b/api/drivers/accelerometer.html @@ -0,0 +1,28 @@ + + + + + +Accelerometer | DeviceScript + + + + + + + + +
+
Skip to main content

Accelerometer

The startAccelerometer function starts a accelerometer server on the device +and returns a client.

The accelerometer IMU chip will be auto-detected if it is supported.

import { startAccelerometer } from "@devicescript/servers"
const acc = startAccelerometer({})

Coordinate transforms

You can specify transform for X, Y, Z axis of the accelerometer to compensate for the physical +placement of the IMU chip. +See service spec for +info about what XYZ values should be returned, depending on device position.

For each output axis (trX, trY, trZ) you specify input axis 1, 2, 3 +or negated input axis -1, -2, -3. +The default is { trX: 1, trY: 2, trZ: 3 }, which is no transform. +The following would work for accelerometer mounted upside down and rotated, +it transforms (x1, y2, z3) into (y2, -x1, -z3).

import { startAccelerometer } from "@devicescript/servers"
const acc = startAccelerometer({
trX: 2,
trY: -1,
trZ: -3,
})
+ + + + \ No newline at end of file diff --git a/api/drivers/aht20.html b/api/drivers/aht20.html new file mode 100644 index 00000000000..a6b860a7e52 --- /dev/null +++ b/api/drivers/aht20.html @@ -0,0 +1,20 @@ + + + + + +AHT20 | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/bme680.html b/api/drivers/bme680.html new file mode 100644 index 00000000000..6be3acf9a76 --- /dev/null +++ b/api/drivers/bme680.html @@ -0,0 +1,21 @@ + + + + + +BME680 | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/button.html b/api/drivers/button.html new file mode 100644 index 00000000000..9d81258b2ab --- /dev/null +++ b/api/drivers/button.html @@ -0,0 +1,22 @@ + + + + + +Button | DeviceScript + + + + + + + + +
+
Skip to main content

Button

The startButton function starts a button server on the device +and returns a client.

import { gpio } from "@devicescript/core"
import { startButton } from "@devicescript/servers"

const buttonA = startButton({
pin: gpio(2),
})

The service instance name is automatically set to the variable name. In this example, it is set to buttonA.

Options

pin

The pin hardware identifier on which to mount the button.

pinBacklight

This pin is set high when the button is pressed. Useful for buttons with a builtin LED.

import { gpio } from "@devicescript/core"
import { startButton } from "@devicescript/servers"

const buttonA = startButton({
pin: gpio(2),
pinBacklight: gpio(4),
})

activeHigh

Button is normally active-low and pulled high. +This makes it active-high and pulled low.

import { gpio } from "@devicescript/core"
import { startButton } from "@devicescript/servers"

const buttonA = startButton({
pin: gpio(2),
activeHigh: true,
})
+ + + + \ No newline at end of file diff --git a/api/drivers/buzzer.html b/api/drivers/buzzer.html new file mode 100644 index 00000000000..b91841c9356 --- /dev/null +++ b/api/drivers/buzzer.html @@ -0,0 +1,23 @@ + + + + + +Buzzer | DeviceScript + + + + + + + + +
+
Skip to main content

Buzzer

The startBuzzer function starts a buzzer server on the device +and returns a client.

import { gpio } from "@devicescript/core"
import { startBuzzer } from "@devicescript/servers"

const speaker = startBuzzer({
pin: gpio(20)
})

Options

pin

The pin hardware identifier on which to mount the buzzer.

activeLow

Indicates that the current flows through the speaker when the pin 0. +That means that when the speaker is supposed to be silent, the pin will be set to 1. +By default, the opposite is assumed.

+ + + + \ No newline at end of file diff --git a/api/drivers/hall.html b/api/drivers/hall.html new file mode 100644 index 00000000000..c0ea1d14d69 --- /dev/null +++ b/api/drivers/hall.html @@ -0,0 +1,20 @@ + + + + + +Hall sensor | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/hidjoystick.html b/api/drivers/hidjoystick.html new file mode 100644 index 00000000000..4ded2b70c1e --- /dev/null +++ b/api/drivers/hidjoystick.html @@ -0,0 +1,21 @@ + + + + + +HID Joystick | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/hidkeyboard.html b/api/drivers/hidkeyboard.html new file mode 100644 index 00000000000..331d45299f3 --- /dev/null +++ b/api/drivers/hidkeyboard.html @@ -0,0 +1,21 @@ + + + + + +HID Keyboard | DeviceScript + + + + + + + + +
+
Skip to main content

HID Keyboard

The startHidKeyboard function starts a relay server on the device +and returns a client.

The server emulates a keyboard and can be used to send keystrokes to a computer.

import { startHidKeyboard } from "@devicescript/servers"

const keyboard = startHidKeyboard({})

The service instance name is automatically set to the variable name. In this example, it is set to keyboard.

+ + + + \ No newline at end of file diff --git a/api/drivers/hidmouse.html b/api/drivers/hidmouse.html new file mode 100644 index 00000000000..0f0fb1c3967 --- /dev/null +++ b/api/drivers/hidmouse.html @@ -0,0 +1,21 @@ + + + + + +HID Mouse | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/lightbulb.html b/api/drivers/lightbulb.html new file mode 100644 index 00000000000..80314d385b8 --- /dev/null +++ b/api/drivers/lightbulb.html @@ -0,0 +1,22 @@ + + + + + +Light bulb | DeviceScript + + + + + + + + +
+
Skip to main content

Light bulb

The startLightBulb function starts a light bulb server on the device +and returns a client.

import { gpio } from "@devicescript/core"
import { startLightBulb } from "@devicescript/servers"

const bulb = startLightBulb({
pin: gpio(20),
dimmable: true,
})
tip

For the onboard LED, use setStatusLight instead.

Options

pin

The pin hardware identifier on which to mount the light bulb.

dimmable

When set to true you can set the intensity of the light (it will use a PWM signal at a few kHz).

activeLow

Indicates that the light is on when the pin 0. +By default, the light is on when the pin is 1.

+ + + + \ No newline at end of file diff --git a/api/drivers/lightlevel.html b/api/drivers/lightlevel.html new file mode 100644 index 00000000000..31589622e14 --- /dev/null +++ b/api/drivers/lightlevel.html @@ -0,0 +1,21 @@ + + + + + +Light Level | DeviceScript + + + + + + + + +
+
Skip to main content

Light Level

The startLightLevel starts a simple analog sensor server that models a light level sensor +and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startLightLevel } from "@devicescript/servers"

const sensor = startLightLevel({
pin: ds.gpio(3),
})
sensor.reading.subscribe(light => console.data({ light }))
+ + + + \ No newline at end of file diff --git a/api/drivers/ltr390.html b/api/drivers/ltr390.html new file mode 100644 index 00000000000..dcf8dbfb6fd --- /dev/null +++ b/api/drivers/ltr390.html @@ -0,0 +1,20 @@ + + + + + +LTR390 | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/motion.html b/api/drivers/motion.html new file mode 100644 index 00000000000..77c037d65fb --- /dev/null +++ b/api/drivers/motion.html @@ -0,0 +1,22 @@ + + + + + +Motion Detector | DeviceScript + + + + + + + + +
+
Skip to main content

Motion detector

The startMotion function starts on-board server for Motion, +and returns a client bound to the server.

This is typically used with a PIR-based motion detectors, that just output the debounced motion +reading as high-level on a given pin. Typical hardware includes: AM312, SR602.

import { gpio } from "@devicescript/core"
import { startMotion } from "@devicescript/servers"

const sensor = startMotion({
pin: ds.gpio(3),
})
sensor.reading.subscribe(moving => console.data({ moving }))
+ + + + \ No newline at end of file diff --git a/api/drivers/potentiometer.html b/api/drivers/potentiometer.html new file mode 100644 index 00000000000..aa692cbc253 --- /dev/null +++ b/api/drivers/potentiometer.html @@ -0,0 +1,21 @@ + + + + + +Potentiometer | DeviceScript + + + + + + + + +
+
Skip to main content

Potentiometer

The startPotentiometer starts a simple analog sensor server that models a potentiometer +and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startPotentiometer } from "@devicescript/servers"

const sensor = startPotentiometer({
pin: ds.gpio(3),
})
sensor.reading.subscribe(v => console.data({ value: 100 * v }))
+ + + + \ No newline at end of file diff --git a/api/drivers/power.html b/api/drivers/power.html new file mode 100644 index 00000000000..4b37d5f5248 --- /dev/null +++ b/api/drivers/power.html @@ -0,0 +1,21 @@ + + + + + +Power | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/reflectedlight.html b/api/drivers/reflectedlight.html new file mode 100644 index 00000000000..6ddb686536b --- /dev/null +++ b/api/drivers/reflectedlight.html @@ -0,0 +1,21 @@ + + + + + +Reflected Light | DeviceScript + + + + + + + + +
+
Skip to main content

Reflected Light

The startReflectedLight starts a simple analog sensor server that models a reflected light sensor +and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startReflectedLight } from "@devicescript/servers"

const sensor = startReflectedLight({
pin: ds.gpio(3),
})
sensor.reading.subscribe(brightness => console.data({ brightness }))
+ + + + \ No newline at end of file diff --git a/api/drivers/relay.html b/api/drivers/relay.html new file mode 100644 index 00000000000..db41d5683f7 --- /dev/null +++ b/api/drivers/relay.html @@ -0,0 +1,21 @@ + + + + + +Relay | DeviceScript + + + + + + + + +
+
Skip to main content

Relay

The startRelay function starts a relay server on the device +and returns a client.

import { gpio } from "@devicescript/core"
import { startRelay } from "@devicescript/servers"

const relay = startRelay({
pin: gpio(2),
})

The service instance name is automatically set to the variable name. In this example, it is set to relay.

Options

pin

The pin hardware identifier on which to mount the relay.

options

Other configuration options are available in the options parameter.

+ + + + \ No newline at end of file diff --git a/api/drivers/rotaryencoder.html b/api/drivers/rotaryencoder.html new file mode 100644 index 00000000000..6280b10a1fc --- /dev/null +++ b/api/drivers/rotaryencoder.html @@ -0,0 +1,21 @@ + + + + + +Rotary Encoder | DeviceScript + + + + + + + + +
+
Skip to main content

Rotary Encoder

The startRotaryEncoder function starts a Rotary Encoder server on the device +and returns a client.

import { gpio } from "@devicescript/core"
import { startRotaryEncoder } from "@devicescript/servers"

const dialA = startRotaryEncoder({
pin0: gpio(2),
pin1: gpio(3),
})

The service instance name is automatically set to the variable name. In this example, it is set to RotadialA.

Options

pin0, pin1

The pin hardware identifiers on which to mount the Rotary Encoder.

clicksPerTurn (optional)

Number of reported clicks per full rotation. Default is 12.

import { gpio } from "@devicescript/core"
import { startRotaryEncoder } from "@devicescript/servers"

const dialA = startRotaryEncoder({
pin0: gpio(2),
pin1: gpio(3),
clicksPerTurn: 24,
})

dense (optional)

Encoder supports "half-clicks". Default is false.

import { gpio } from "@devicescript/core"
import { startRotaryEncoder } from "@devicescript/servers"

const dialA = startRotaryEncoder({
pin0: gpio(2),
pin1: gpio(3),
dense: true,
})

inverted (optional)

Invert direction. Default is false.

import { gpio } from "@devicescript/core"
import { startRotaryEncoder } from "@devicescript/servers"

const dialA = startRotaryEncoder({
pin0: gpio(2),
pin1: gpio(3),
inverted: true,
})
+ + + + \ No newline at end of file diff --git a/api/drivers/servo.html b/api/drivers/servo.html new file mode 100644 index 00000000000..36b845e6938 --- /dev/null +++ b/api/drivers/servo.html @@ -0,0 +1,21 @@ + + + + + +Servo | DeviceScript + + + + + + + + +
+
Skip to main content

Servo

The startServo function starts on-board server for servo, +and returns a client bound to the server.

import { gpio, delay } from "@devicescript/core"
import { startServo } from "@devicescript/servers"

const sensor = startServo({
pin: ds.gpio(3),
})
setInterval(async () => {
await sensor.angle.write(-45)
await delay(1000)
await sensor.angle.write(45)
}, 1000)
+ + + + \ No newline at end of file diff --git a/api/drivers/sht30.html b/api/drivers/sht30.html new file mode 100644 index 00000000000..7f5e9b6877e --- /dev/null +++ b/api/drivers/sht30.html @@ -0,0 +1,20 @@ + + + + + +SHT30 | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/shtc3.html b/api/drivers/shtc3.html new file mode 100644 index 00000000000..8a7b89dc8d9 --- /dev/null +++ b/api/drivers/shtc3.html @@ -0,0 +1,20 @@ + + + + + +SHTC3 | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/drivers/soilmoisture.html b/api/drivers/soilmoisture.html new file mode 100644 index 00000000000..81a3391220b --- /dev/null +++ b/api/drivers/soilmoisture.html @@ -0,0 +1,21 @@ + + + + + +Soil Moisture | DeviceScript + + + + + + + + +
+
Skip to main content

Soil Moisture

The startSoilMoisture starts a simple analog sensor server that models a soil moisture sensor +and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startSoilMoisture } from "@devicescript/servers"

const sensor = startSoilMoisture({
pin: ds.gpio(3),
})
sensor.reading.subscribe(moisture => console.data({ moisture }))
+ + + + \ No newline at end of file diff --git a/api/drivers/soundlevel.html b/api/drivers/soundlevel.html new file mode 100644 index 00000000000..0269916b8bb --- /dev/null +++ b/api/drivers/soundlevel.html @@ -0,0 +1,21 @@ + + + + + +Sound Level | DeviceScript + + + + + + + + +
+
Skip to main content

Soil Moisture

The startSoundLevel starts a simple analog sensor server that models a sound level sensor +and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startSoundLevel } from "@devicescript/servers"

const sensor = startSoundLevel({
pin: ds.gpio(3),
})
sensor.reading.subscribe(level => console.data({ level }))
+ + + + \ No newline at end of file diff --git a/api/drivers/ssd1306.html b/api/drivers/ssd1306.html new file mode 100644 index 00000000000..a91032c5959 --- /dev/null +++ b/api/drivers/ssd1306.html @@ -0,0 +1,21 @@ + + + + + +SSD1306 | DeviceScript + + + + + + + + +
+
Skip to main content

SSD1306

Driver for SSD1306 OLED screen at I2C address 0x3c (or 0x3d).

import { SSD1306Driver } from "@devicescript/drivers"

Photo of a SSD1306 screen

Hardware configuration

  • Configure the I2C connection through the board configuration
  • Check that you are using the proper I2C address

Display

The driver implements the Display interface and can be used as various services. +Using the driver through services provides a better simulation experience.

Driver

You can also use the SS1306 driver directly. However, it will not be usable from a simulator.

import { SSD1306Driver } from "@devicescript/drivers"

const ssd = new SSD1306Driver({ width: 64, height: 48 })
await ssd.init()
ssd.image.print("Hello world!", 3, 10)
await ssd.show()
+ + + + \ No newline at end of file diff --git a/api/drivers/st7789.html b/api/drivers/st7789.html new file mode 100644 index 00000000000..b613d39d21e --- /dev/null +++ b/api/drivers/st7789.html @@ -0,0 +1,24 @@ + + + + + +ST7735, ILI9163, ST7789 | DeviceScript + + + + + + + + +
+
Skip to main content

ST7735, ILI9163, ST7789

Driver for ST7735, ST7789 and similar LCD screens using SPI. +The ST7735 driver also works for ILI9163C. +ILI9341 should be easy to add.

import { ST7789Driver } from "@devicescript/drivers"
import { ST7735Driver } from "@devicescript/drivers"

WaveShare Pico-LCD shield

I8080 not supported

The drivers use the SPI interface. The parralel interface (I8080) is not supported at the moment.

Hardware configuration

  • Configure the SPI connection
import { spi } from "@devicescript/spi"
import { pins } from "@dsboard/pico_w"

spi.configure({
mosi: pins.GP11,
sck: pins.GP10,
hz: 8_000_000,
})

Display

The driver implements the Display interface and can be used as various services. +Using the driver through services provides a better simulation experience.

Driver

The devicescript-waveshare-pico-lcd +uses the driver for a WaveShare Pico-LCD shield.

import * as ds from "@devicescript/core"
import { spi } from "@devicescript/spi"
import { pins } from "@dsboard/pico_w"
import { ST7789Driver } from "@devicescript/drivers"
import { Image } from "@devicescript/graphics"

spi.configure({
mosi: pins.GP11,
sck: pins.GP10,
hz: 8_000_000,
})

// backlight led
pins.GP13.setMode(ds.GPIOMode.OutputHigh)

const display = new ST7789Driver(Image.alloc(240, 136, 4), {
dc: pins.GP8,
cs: pins.GP9,
reset: pins.GP12,
// frmctr1: 0x0e_14_ff,
flip: false,
spi: spi,
offX: 40,
offY: 53,
})
await display.init()
display.image.print("Hello world!", 3, 10)
await display.show()
+ + + + \ No newline at end of file diff --git a/api/drivers/switch.html b/api/drivers/switch.html new file mode 100644 index 00000000000..f1462eb54b8 --- /dev/null +++ b/api/drivers/switch.html @@ -0,0 +1,21 @@ + + + + + +Switch | DeviceScript + + + + + + + + +
+
Skip to main content

Switch

The startSwitch function starts a switch server on the device +and returns a client.

import { gpio } from "@devicescript/core"
import { startSwitch } from "@devicescript/servers"

const sw = startSwitch({
pin: gpio(2),
})

The service instance name is automatically set to the variable name. In this example, it is set to switch.

Options

pin

The pin hardware identifier on which to mount the relay.

options

Other configuration options are available in the options parameter.

+ + + + \ No newline at end of file diff --git a/api/drivers/trafficlight.html b/api/drivers/trafficlight.html new file mode 100644 index 00000000000..8843d80ac5f --- /dev/null +++ b/api/drivers/trafficlight.html @@ -0,0 +1,20 @@ + + + + + +Traffic Light | DeviceScript + + + + + + + + +
+
Skip to main content

Traffic Light

The traffic light driver, startTrafficLight is used to control a toy traffic light, driving 3 LEDs.

import { pins } from "@dsboard/pico_w"
import { startTrafficLight } from "@devicescript/drivers"

const light = await startTrafficLight({
red: pins.GP10,
yellow: pins.GP11,
green: pins.GP12,
})

await light.green.write(true)
await light.yellow.write(false)
await light.red.write(false)
+ + + + \ No newline at end of file diff --git a/api/drivers/uc8151.html b/api/drivers/uc8151.html new file mode 100644 index 00000000000..b71bf1de5c9 --- /dev/null +++ b/api/drivers/uc8151.html @@ -0,0 +1,21 @@ + + + + + +UC8151 | DeviceScript + + + + + + + + +
+
Skip to main content

UC8151 eInk Driver

Driver for UC8151 eInk screens.

import { UC8151Driver } from "@devicescript/drivers"

Pimoroni Badger W

The driver is used by the following packages:

Display

The driver implements the Display interface and can be used as various services. +Using the driver through services provides a better simulation experience.

Driver

import * as ds from "@devicescript/core"
import { UC8151Driver } from "@devicescript/drivers"
import { Image, font8, scaledFont } from "@devicescript/graphics"
import { spi } from "@devicescript/spi"
import { pins } from "@dsboard/pico_w"

spi.configure({
miso: pins.GP16,
mosi: pins.GP19,
sck: pins.GP18,
hz: 8_000_000,
})

const display = new UC8151Driver(Image.alloc(296, 128, 1), {
cs: pins.GP17,
dc: pins.GP20,
reset: pins.GP21,
busy: pins.GP26,

flip: false,
spi: spi,
})
await display.init()
const bigFont = scaledFont(font8(), 3)
display.image.print("Hello world!", 3, 10, 1, bigFont)
await display.show()
+ + + + \ No newline at end of file diff --git a/api/drivers/waterlevel.html b/api/drivers/waterlevel.html new file mode 100644 index 00000000000..8a543eccd9e --- /dev/null +++ b/api/drivers/waterlevel.html @@ -0,0 +1,21 @@ + + + + + +Water Level | DeviceScript + + + + + + + + +
+
Skip to main content

Water

The startWaterLevel starts a simple analog sensor server that models a water level sensor +and returns a client bound to the server.

import { gpio } from "@devicescript/core"
import { startWaterLevel } from "@devicescript/servers"

const sensor = startWaterLevel({
pin: ds.gpio(3),
})
sensor.reading.subscribe(level => console.data({ level }))
+ + + + \ No newline at end of file diff --git a/api/math.html b/api/math.html new file mode 100644 index 00000000000..acef0691d91 --- /dev/null +++ b/api/math.html @@ -0,0 +1,20 @@ + + + + + +Math | DeviceScript + + + + + + + + +
+
Skip to main content

Math

Most typical JavaScript Math function are supported. Please file an issue if we missed one.

Math.map

Maps a value between two ranges.

const ratio = 0.5 // [0, 1]
const percent = Math.map(ratio, 0, 1, 0, 100)

Math.constrain

Constrains a value between two values.

const v = -0.1 // [0, 1]
const c = Math.constrain(v, 0, 1)
+ + + + \ No newline at end of file diff --git a/api/observables.html b/api/observables.html new file mode 100644 index 00000000000..367c2588987 --- /dev/null +++ b/api/observables.html @@ -0,0 +1,22 @@ + + + + + +Observables | DeviceScript + + + + + + + + +
+
Skip to main content

Observables

The @devicescript/observables builtin module provides a lightweight reactive observable framework, a limited subset of RxJS. +We highly recommend reviewing the RxJS documentation for deeper discussions about observables.

For in-depth tutorials about observables, see RxJS.

Setup

Import @devicescript/observables to enable the APIs.

import "@devicescript/observables"

Operators

Observable operators apply transformation between observable data stream. They can be combined using the pipe +method to create complex data processing pipeline. Many (most) operators are adapted from Rxjs.

import { Temperature } from "@devicescript/core"
import { threshold, throttleTime } from "@devicescript/observables"

const thermometer = new Temperature()
// create a stream of temperature readings
const temperature = thermometer.reading.pipe(
threshold(0.1), // at least 0.1deg change
throttleTime(10000) // at most one update per 10s
)
temperature.subscribe(t => console.log(t))
+ + + + \ No newline at end of file diff --git a/api/observables/creation.html b/api/observables/creation.html new file mode 100644 index 00000000000..522876b1cdf --- /dev/null +++ b/api/observables/creation.html @@ -0,0 +1,21 @@ + + + + + +Creation Operators | DeviceScript + + + + + + + + +
+
Skip to main content

Creation Operators

from

Converts an array into a sequence of values.

output.svg
import { from } from "@devicescript/observables"

const obs = from([0, 1, 2, 3, 4])

obs.subscribe(v => console.log(v))

interval

Emits a value at a time interval. The value is the number of callbacks. +This observable runs forever.

output.svg
import { interval } from "@devicescript/observables"

const obs = interval(1000)

obs.subscribe(v => console.log(v))

timer

Emits a single value, 0 after a time interval, then completes.

output.svg
import { timer } from "@devicescript/observables"

const obs = timer(1000)

obs.subscribe(v => console.log(v))

iif

Checks a boolean at subscription time, and chooses between one of two observable sources.

import { from, iif } from "@devicescript/observables"

let connected: boolean
const obs = iif(() => connected, from(["connected"]), from(["not connected"]))

obs.subscribe(v => console.log(v))
+ + + + \ No newline at end of file diff --git a/api/observables/dsp.html b/api/observables/dsp.html new file mode 100644 index 00000000000..28b92e07936 --- /dev/null +++ b/api/observables/dsp.html @@ -0,0 +1,22 @@ + + + + + +Digital Signal processing | DeviceScript + + + + + + + + +
+
Skip to main content

Digital Signal processing

ewma

Exponentially weighted moving average is a simple PIR filter +with a gain parameter. +The closer gain to 1 and the more closely the EWMA tracks the original time series.

import { Temperature } from "@devicescript/core"
import { ewma } from "@devicescript/observables"

const thermometer = new Temperature()

thermometer.reading
.pipe(ewma(0.5))
.subscribe(t => console.log(t))

rollingAverage

A windowed rolling average filter.

import { Temperature } from "@devicescript/core"
import { rollingAverage } from "@devicescript/observables"

const thermometer = new Temperature()

thermometer.reading
.pipe(rollingAverage(10))
.subscribe(t => console.log(t))

fir

A general purpose Finite Response Filter filter. Coefficients are typically computed in a seperate process.

import { Temperature } from "@devicescript/core"
import { fir } from "@devicescript/observables"

const thermometer = new Temperature()

thermometer.reading
.pipe(fir([0.1, 0.2, 1]))
.subscribe(t => console.log(t))

levelDetector

Measures and thresholds data into low/mid/high levels.

import { Temperature } from "@devicescript/core"
import { levelDetector } from "@devicescript/observables"

const thermometer = new Temperature()

thermometer.reading
.pipe(levelDetector(20 /* low threshold */, 30 /*high threshold */))
.subscribe(level =>
console.log(level < 0 ? "cold" : level > 0 ? "hot" : "mild")
)
+ + + + \ No newline at end of file diff --git a/api/observables/filter.html b/api/observables/filter.html new file mode 100644 index 00000000000..d2c6fbf5343 --- /dev/null +++ b/api/observables/filter.html @@ -0,0 +1,26 @@ + + + + + +Filter Operators | DeviceScript + + + + + + + + +
+
Skip to main content

Filter Operators

filter

Filter items emitted by the source Observable by only emitting those that satisfy a specified predicate.

output.svg
import { from, filter } from "@devicescript/observables"

const obs = from([0, 1, 2, 3, 1])

obs
.pipe(filter(v => v > 1))
.subscribe(v => console.log(v))

debounceTime

Emits a notification from the source Observable +only after a particular time span has passed without another source emission.

output.svg

The example below debounce a button down event to one every 5 seconds.

import { Button } from "@devicescript/core"
import { debounceTime } from "@devicescript/observables"

const button = new Button()

button.down
.pipe(debounceTime(5000))
.subscribe(() => console.log("click"))

throttleTime

Emits a value from the source Observable, +then ignores subsequent source values for duration milliseconds, then repeats this process.

output.svg

The example below debounce a button down event to one every 5 seconds.

import { Button } from "@devicescript/core"
import { throttleTime } from "@devicescript/observables"

const button = new Button()

button.down
.pipe(throttleTime(1000))
.subscribe(() => console.log("click"))

auditTime

Ignores source values for duration milliseconds, +then emits the most recent value from the source Observable, then repeats this process

auditTime is similar to throttleTime, but emits the last value from the silenced time window, instead of the first value.

output.svg

The example below debounce a button down event to one every 5 seconds.

import { Button } from "@devicescript/core"
import { auditTime } from "@devicescript/observables"

const button = new Button()

button.down
.pipe(auditTime(1000))
.subscribe(() => console.log("click"))

threshold

Filters numerical data stream within change threshold.

output.svg

The example tracks the temperature returned

import { Temperature } from "@devicescript/core"
import { threshold } from "@devicescript/observables"

const thermometer = new Temperature()

thermometer.reading
.pipe(threshold(2))
.subscribe(t => console.log(t))

distinctUntilChanged

Returns a result Observable that emits all values pushed by the source observable +if they are distinct in comparison to the last value the result observable emitted.

This function can be used to create user-friendly transformer. For example, thershold is as follows:

export function threshold<T = number>(
value: number,
...
): OperatorFunction<T, T> {
return distinctUntilChanged<T, number>(
(l, r) => Math.abs(l - r) < value,
keySelector
)
}

Transform operators

map

Applies a converter function to converts the observed value into a new value.

output.svg
import { from, map } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs
.pipe(map(v => v * v))
.subscribe(v => console.log(v))

scan

Applies an accumulator (or "reducer function") to each value from the source.

output.svg
import { from, scan } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs.pipe(
scan((p, c) => p + c, 0)
).subscribe(v => console.log(v))

Signal processing

ewma

Exponentially weighted moving average is a simple PIR filter +with a gain parameter. +The closer gain to 1 and the more closely the EWMA tracks the original time series.

import { Temperature } from "@devicescript/core"
import { ewma } from "@devicescript/observables"

const thermometer = new Temperature()

thermometer.reading
.pipe(ewma(0.5))
.subscribe(t => console.log(t))

rollingAverage

A windowed rolling average filter.

import { Temperature } from "@devicescript/core"
import { rollingAverage } from "@devicescript/observables"
+ + + + \ No newline at end of file diff --git a/api/observables/transform.html b/api/observables/transform.html new file mode 100644 index 00000000000..a6dfe173717 --- /dev/null +++ b/api/observables/transform.html @@ -0,0 +1,23 @@ + + + + + +Transform operators | DeviceScript + + + + + + + + +
+
Skip to main content

Transform operators

map

Applies a converter function to converts the observed value into a new value.

output.svg
import { from, map } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs
.pipe(map(v => v * v))
.subscribe(v => console.log(v))

scan

Applies an accumulator (or "reducer function") to each value from the source.

output.svg
import { from, scan } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs.pipe(
scan((p, c) => p + c, 0)
).subscribe(v => console.log(v))

timestamp

Wraps value in an object with a timestamp property and lastTimestamp property.

output.svg
import { from, timestamp } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs.pipe(
timestamp()
).subscribe(v => console.log(v))

switchMap

Takes a source Observable and calls transform(T) for each emitted value. +It will immediately subscribe to any Observable coming from transform(T), b +ut in addition to this, will unsubscribe() from any prior Observables - +so that there is only ever one Observable subscribed at any one time.

output.svg
import { from, switchMap } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs.pipe(
switchMap(v => from([v + 1, v + 1, v + 1]))
).subscribe(v => console.log(v))
+ + + + \ No newline at end of file diff --git a/api/observables/utils.html b/api/observables/utils.html new file mode 100644 index 00000000000..231b818c4f8 --- /dev/null +++ b/api/observables/utils.html @@ -0,0 +1,20 @@ + + + + + +Utilities operators | DeviceScript + + + + + + + + +
+
Skip to main content

Utilities operators

tap

Allows to attach a side-effect function to a pipeline, tap passes the stream through. Typically used to add logging.

import { from, map, tap } from "@devicescript/observables"

const obs = from([1, 2, 3])

obs.pipe(
tap(v => console.log(v)),
map(v => v * v)
).subscribe(v => console.log(v))
+ + + + \ No newline at end of file diff --git a/api/runtime.html b/api/runtime.html new file mode 100644 index 00000000000..18d8e2cd8a2 --- /dev/null +++ b/api/runtime.html @@ -0,0 +1,21 @@ + + + + + +Runtime | DeviceScript + + + + + + + + +
+
Skip to main content
+ + + + \ No newline at end of file diff --git a/api/runtime/palette.html b/api/runtime/palette.html new file mode 100644 index 00000000000..c5c93ef50d3 --- /dev/null +++ b/api/runtime/palette.html @@ -0,0 +1,22 @@ + + + + + +Palette | DeviceScript + + + + + + + + +
+
Skip to main content

Palette

A fixed length color palette.

Palette are used with displays +to keep the storage needed for images low. They can also be used with LEDs +to create multi-color gradients.

at, setAt

These function allow to lookup and update the color of palette at indices.

import { Palette } from "@devicescript/graphics"

const palette = Palette.arcade()

// lookup color
const c = palette.at(2)

// update color
palette.setAt(2, 0x00_00_ff)

interpolateColor

Interpolates a [0, 1] value into a color of the palette, regarless of the palette size.

import { Palette } from "@devicescript/graphics"
import { interpolateColor } from "@devicescript/runtime"

const palette = Palette.arcade()

const c = interpolateColor(palette, 0.5)

correctGamma

For palette used with LEDs, you can preapply gamma correction.

import { Palette } from "@devicescript/graphics"
import { correctGamma } from "@devicescript/runtime"

const palette = Palette.arcade()
correctGamma(palette)
+ + + + \ No newline at end of file diff --git a/api/runtime/pixelbuffer.html b/api/runtime/pixelbuffer.html new file mode 100644 index 00000000000..141cba72d82 --- /dev/null +++ b/api/runtime/pixelbuffer.html @@ -0,0 +1,21 @@ + + + + + +PixelBuffer | DeviceScript + + + + + + + + +
+
Skip to main content

PixelBuffer

A 1D color vector to support color manipulation of LED strips. All colors are 24bit RGB colors.

The pixel buffer is typically accessed through a Led client.

import { Led } from "@devicescript/core"
import "@devicescript/runtime"

const led = new Led()
const pixels = await led.buffer()

It can also be allocated using pixelBuffer.

import { PixelBuffer } from "@devicescript/runtime"

const pixels = PixelBuffer.alloc(32)

Usage

at, setAt

Indexing functions similar to Array.at, they allow to set color of individual LEDs and support negative indices.

const c0 = pixels.at(0)
pixels.setAt(1, c0)

clear

Clears all colors to #000000.

pixels.clear()

view

Creates a aliased range view of the buffer so that you can apply operations on a subset of the colors.

const view = pixels.view(5, 10)
view.clear()

correctGamma

Applies gamma correction to compensate LED and eye perception

pixels.correctGamma()

rotate

Shifts the colors in the buffer by the given offset. Use a negative offset to shift right.

pixels.rotate(-1)

Helpers

Here are a few helpers built for PixelBuffer, but many other could be added!

fillSolid

This helper function asigns the given color to the entire range.

import { Led } from "@devicescript/core"
import { fillSolid } from "@devicescript/runtime"

const led = new Led()
const pixels = await led.buffer()

fillSolid(pixels, 0x00_ff_00)

await led.show()

fillRainbow

Fills the buffer by interpolating the hue of hsv colors.

import { Led } from "@devicescript/core"
import { fillRainbow } from "@devicescript/runtime"

const led = new Led()
const pixels = await led.buffer()

fillRainbow(pixels)

await led.show()

By default, the helper interpolates between 0 and 0xff, +but this can be changed with optional parameters.

fillGradient

Fills with a linear interpolation of two colors accross the RGB space.

import { Led } from "@devicescript/core"
import { fillGradient } from "@devicescript/runtime"

const led = new Led()
const pixels = await led.buffer()

fillGradient(pixels, 0x00_ff_00, 0x00_00_ff, { circular: true })

await led.show()

fillPalette

Fills by interpolating the colors of a palette.

import { Led } from "@devicescript/core"
import { Palette } from "@devicescript/graphics"
import { fillPalette } from "@devicescript/runtime"

const led = new Led()
const pixels = await led.buffer()
const palette = Palette.arcade()

fillPalette(pixels, palette)

await led.show()

fillBarGraph

A tiny bar chart engine to render on a value on a LED strip

import { Led } from "@devicescript/core"
import { fillBarGraph } from "@devicescript/runtime"

const led = new Led()
const pixels = await led.buffer()

const current = 25
const max = 100

fillBarGraph(pixels, current, max)

await led.show()
+ + + + \ No newline at end of file diff --git a/api/runtime/schedule.html b/api/runtime/schedule.html new file mode 100644 index 00000000000..766a8317446 --- /dev/null +++ b/api/runtime/schedule.html @@ -0,0 +1,21 @@ + + + + + +schedule | DeviceScript + + + + + + + + +
+
Skip to main content

schedule

The schedule function combines setTimeout and setInterval to provide a single function that can be used to schedule a function to run once or repeatedly. +The function also tracks the number of invocation, total elapsed time and time since last invocation.

import { schedule, setStatusLight } from "@devicescript/runtime"

// counter increments on every invocation
schedule(
async ({ counter, elapsed, delta }) => {
console.data({ counter })
// toggle between red and off
await setStatusLight(counter % 2 === 0 ? 0xff0000 : 0x000000)
},
{
// first delay
timeout: 100,
// repeated delay
interval: 1000,
}
)
+ + + + \ No newline at end of file diff --git a/api/settings.html b/api/settings.html new file mode 100644 index 00000000000..def9521311c --- /dev/null +++ b/api/settings.html @@ -0,0 +1,21 @@ + + + + + +Settings | DeviceScript + + + + + + + + +
+
Skip to main content

Settings

The @devicescript/settings builtin module provides a lightweight flash storage for small setting values. +Settings values are serialized in flash and available across device reset. Firmware updates might erase the settings.

Usage

You can store settings and secrets in .env files.

.env.defaults and .env.local files

Don't store secrets or settings in the code, use .env files instead.

  • ./.env.defaults: store general settings (tracked by version control)
  • ./.env.local: store secrets or override for general settings (untracked by version control)

The .env* file use a similar format to node.js .env file.

./.env.defaults
# This file is tracked by git. DO NOT store secrets in this file.
TEMP=68
./.env.local
# This file is **NOT** tracked by git and may contain secrets
PASSWORD=VALUE
TEMP=70 # override TEMP

The secrets can only be accessed by the DeviceScript program and are not available through the Jacdac protocol.

  • multiline values, and # in quote strings are not supported.
  • key length should be less than 14 characters.

writeSetting

Serializes an object into a setting at a given key. The key name should be less than 16 characters.

import { writeSetting } from "@devicescript/settings"

await writeSetting("hello", { world: true })

readSetting

Deserializes an object from a setting at a given key. If the key is missing or invalid format, it returns undefined or the second argument.

import { readSetting } from "@devicescript/settings"

const world = await readSetting("hello", ":)")

deleteSetting

Deletes a setting at the given key. If the setting does not exist, does nothing.

import { deleteSetting } from "@devicescript/settings"

await deleteSetting("hello")
+ + + + \ No newline at end of file diff --git a/api/spi.html b/api/spi.html new file mode 100644 index 00000000000..b90e6cd1355 --- /dev/null +++ b/api/spi.html @@ -0,0 +1,22 @@ + + + + + +SPI | DeviceScript + + + + + + + + +
+
Skip to main content

SPI

The SPI builtin package that exposes functions to read, write, transfer buffers over SPI. +In particular, it exposes an SPI class and spi singleton instance (currently only one SPI interface is supported).

SPI.configure

The SPI.configure function is used to configure the SPI bus. It takes the pin configuration, frequency and mode.

import { spi } from "@devicescript/spi"
await spi.configure({})

SPI.read

The SPI.read function is used to read a buffer from the SPI bus.

import { spi } from "@devicescript/spi"
const res = await spi.read(8) // read 8 bytes

SPI.write

The SPI.write function is used to write a buffer to the SPI bus.

import { spi } from "@devicescript/spi"

await spi.write(hex`abcd`)

SPI.transfer

The SPI.transfer function is used to write and read buffers from and to the SPI bus. +The read buffer has the same length as the write buffer.

import { spi } from "@devicescript/spi"

const res = await spi.transfer(hex`abcd`)
+ + + + \ No newline at end of file diff --git a/api/test.html b/api/test.html new file mode 100644 index 00000000000..583f3e82914 --- /dev/null +++ b/api/test.html @@ -0,0 +1,20 @@ + + + + + +Test | DeviceScript + + + + + + + + +
+
Skip to main content

Test

The @devicescript/test builtin package provides a lightweight unit test framework, with a subset of familiar APIs to Jest/Vitest/Mocha/Chai users (describe, test, expect).

Usage

test

Defines a test with a name and a callback. There can be many tests and the callback can be async. Tests should not be nested.

import { describe, test } from "@devicescript/test"

describe("this is a test suite", () => {
test("this is a test", async () => {})
})

describe

Declares and encapsulates a test suite. describe calls can be nested.

import { describe } from "@devicescript/test"

describe("this is a test suite", () => {})

expect

BDD style assertion API.

import { describe, test, expect } from "@devicescript/test"

describe("this is a test suite", () => {
test("this is a test", async () => {
expect(1 + 1).toBe(2)
})
})

beforeEach

Registers a callback to be called before each test in the current test suite.

import { describe, test, expect } from "@devicescript/test"

describe("this is a test suite", () => {
beforeEach(() => {
console.log(`...`)
})
test("this is a test", () => {})
})

afterEach

Registers a callback to be called after each test in the current test suite.

import { describe, test, expect } from "@devicescript/test"

describe("this is a test suite", () => {
afterEach(() => {
console.log(`...`)
})
test("this is a test", () => {})
})
+ + + + \ No newline at end of file diff --git a/api/vm.html b/api/vm.html new file mode 100644 index 00000000000..f8f068148cc --- /dev/null +++ b/api/vm.html @@ -0,0 +1,21 @@ + + + + + +WebASM VM | DeviceScript + + + + + + + + +
+
Skip to main content

Web Assembly Virtual Machine

The @devicescript/vm package contains DeviceScript C virtual machine compiled to Web Assembly. It allows you to run bytecode in node.js and browsers.

This package is used in the CLI and in developer tools web page.

npm install --save @devicescript/vm

import

Loading the virtual machine is async and should typically be cached in a global variable.

Node.js

import type { DevsModule } from "@devicescript/vm"

const vmLoader = require("@devicescript/vm")
const vm: DevsModule = await vmLoader()
vm.devsInit()

Browser

import type { DevsModule } from "@devicescript/vm"
import vmLoader from "@devicescript/vm"

const vm: DevsModule = await vmLoader()
vm.devsInit()

or import https://microsoft.github.io/devicescript/dist/devicescript-vm.js for the latest build.

devsSetDeviceId

Specifies the device id of the virtual machine device. This method should be called before starting the virtual machine.

vm.devsSetDeviceId("1989f4eee0ebe206")

devsStart

Starts the virtual machine. Does nothing if already running.

const res = vm.devsStart()
if (res) console.error("failed to start", res)

devsStop

Stops the virtual machine. Does nothing if already stopped.

vm.devsStop()

devsIsRunning

Indicates if the virtual machine is started.

const running = vm.devsIsRunning()

devsInit

This method allocates data structures necessary for running the virtual machine. +It is automatically called by other metods.

vm.devsInit()

devsVerify

Verifies that a buffer of bytecode is well formed. Returns non-zero error codes when failing.

const res = vm.devsVerify()
if (res) console.error("failed to verify", res)

devsClearFlash

Clear persistent "flash" storage.

vm.devsClearFlash()
+ + + + \ No newline at end of file diff --git a/assets/css/styles.d491155d.css b/assets/css/styles.d491155d.css new file mode 100644 index 00000000000..d392c2eb31b --- /dev/null +++ b/assets/css/styles.d491155d.css @@ -0,0 +1 @@ +.col,.container{padding:0 var(--ifm-spacing-horizontal);width:100%}.markdown>h2,.markdown>h3,.markdown>h4,.markdown>h5,.markdown>h6{margin-bottom:calc(var(--ifm-heading-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown li,body{word-wrap:break-word}body,ol ol,ol ul,ul ol,ul ul{margin:0}pre,table{overflow:auto}blockquote,pre{margin:0 0 var(--ifm-spacing-vertical)}.breadcrumbs__link,.button{transition-timing-function:var(--ifm-transition-timing-default)}.button,.hash-link{-webkit-user-select:none}.button,code{vertical-align:middle}.button--outline.button--active,.button--outline:active,.button--outline:hover,:root{--ifm-button-color:var(--ifm-font-color-base-inverse)}.menu__link:hover,a{transition:color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.navbar--dark,:root{--ifm-navbar-link-hover-color:var(--ifm-color-primary)}.menu,.navbar-sidebar{overflow-x:hidden}:root,html[data-theme=dark]{--ifm-color-emphasis-500:var(--ifm-color-gray-500)}[data-theme=dark] .DocSearch,[data-theme=light] .DocSearch{--docsearch-hit-color:var(--ifm-font-color-base);--docsearch-hit-active-color:var(--ifm-color-white)}.toggleButton_MMFG,html{-webkit-tap-highlight-color:transparent}*,.DocSearch-Container,.DocSearch-Container *,.Resizer{box-sizing:border-box}:root{--ifm-color-scheme:light;--ifm-dark-value:10%;--ifm-darker-value:15%;--ifm-darkest-value:30%;--ifm-light-value:15%;--ifm-lighter-value:30%;--ifm-lightest-value:50%;--ifm-contrast-background-value:90%;--ifm-contrast-foreground-value:70%;--ifm-contrast-background-dark-value:70%;--ifm-contrast-foreground-dark-value:90%;--ifm-color-primary:#3578e5;--ifm-color-secondary:#ebedf0;--ifm-color-success:#00a400;--ifm-color-info:#54c7ec;--ifm-color-warning:#ffba00;--ifm-color-danger:#fa383e;--ifm-color-primary-dark:#306cce;--ifm-color-primary-darker:#2d66c3;--ifm-color-primary-darkest:#2554a0;--ifm-color-primary-light:#538ce9;--ifm-color-primary-lighter:#72a1ed;--ifm-color-primary-lightest:#9abcf2;--ifm-color-primary-contrast-background:#ebf2fc;--ifm-color-primary-contrast-foreground:#102445;--ifm-color-secondary-dark:#d4d5d8;--ifm-color-secondary-darker:#c8c9cc;--ifm-color-secondary-darkest:#a4a6a8;--ifm-color-secondary-light:#eef0f2;--ifm-color-secondary-lighter:#f1f2f5;--ifm-color-secondary-lightest:#f5f6f8;--ifm-color-secondary-contrast-background:#fdfdfe;--ifm-color-secondary-contrast-foreground:#474748;--ifm-color-success-dark:#009400;--ifm-color-success-darker:#008b00;--ifm-color-success-darkest:#007300;--ifm-color-success-light:#26b226;--ifm-color-success-lighter:#4dbf4d;--ifm-color-success-lightest:#80d280;--ifm-color-success-contrast-background:#e6f6e6;--ifm-color-success-contrast-foreground:#003100;--ifm-color-info-dark:#4cb3d4;--ifm-color-info-darker:#47a9c9;--ifm-color-info-darkest:#3b8ba5;--ifm-color-info-light:#6ecfef;--ifm-color-info-lighter:#87d8f2;--ifm-color-info-lightest:#aae3f6;--ifm-color-info-contrast-background:#eef9fd;--ifm-color-info-contrast-foreground:#193c47;--ifm-color-warning-dark:#e6a700;--ifm-color-warning-darker:#d99e00;--ifm-color-warning-darkest:#b38200;--ifm-color-warning-light:#ffc426;--ifm-color-warning-lighter:#ffcf4d;--ifm-color-warning-lightest:#ffdd80;--ifm-color-warning-contrast-background:#fff8e6;--ifm-color-warning-contrast-foreground:#4d3800;--ifm-color-danger-dark:#e13238;--ifm-color-danger-darker:#d53035;--ifm-color-danger-darkest:#af272b;--ifm-color-danger-light:#fb565b;--ifm-color-danger-lighter:#fb7478;--ifm-color-danger-lightest:#fd9c9f;--ifm-color-danger-contrast-background:#ffebec;--ifm-color-danger-contrast-foreground:#4b1113;--ifm-color-white:#fff;--ifm-color-black:#000;--ifm-color-gray-0:var(--ifm-color-white);--ifm-color-gray-100:#f5f6f7;--ifm-color-gray-200:#ebedf0;--ifm-color-gray-300:#dadde1;--ifm-color-gray-400:#ccd0d5;--ifm-color-gray-500:#bec3c9;--ifm-color-gray-600:#8d949e;--ifm-color-gray-700:#606770;--ifm-color-gray-800:#444950;--ifm-color-gray-900:#1c1e21;--ifm-color-gray-1000:var(--ifm-color-black);--ifm-color-emphasis-0:var(--ifm-color-gray-0);--ifm-color-emphasis-100:var(--ifm-color-gray-100);--ifm-color-emphasis-200:var(--ifm-color-gray-200);--ifm-color-emphasis-300:var(--ifm-color-gray-300);--ifm-color-emphasis-400:var(--ifm-color-gray-400);--ifm-color-emphasis-600:var(--ifm-color-gray-600);--ifm-color-emphasis-700:var(--ifm-color-gray-700);--ifm-color-emphasis-800:var(--ifm-color-gray-800);--ifm-color-emphasis-900:var(--ifm-color-gray-900);--ifm-color-emphasis-1000:var(--ifm-color-gray-1000);--ifm-color-content:var(--ifm-color-emphasis-900);--ifm-color-content-inverse:var(--ifm-color-emphasis-0);--ifm-color-content-secondary:#525860;--ifm-background-color:transparent;--ifm-background-surface-color:var(--ifm-color-content-inverse);--ifm-global-border-width:1px;--ifm-global-radius:0.4rem;--ifm-hover-overlay:rgba(0,0,0,.05);--ifm-font-color-base:var(--ifm-color-content);--ifm-font-color-base-inverse:var(--ifm-color-content-inverse);--ifm-font-color-secondary:var(--ifm-color-content-secondary);--ifm-font-family-base:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ifm-font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--ifm-font-size-base:100%;--ifm-font-weight-light:300;--ifm-font-weight-normal:400;--ifm-font-weight-semibold:500;--ifm-font-weight-bold:700;--ifm-font-weight-base:var(--ifm-font-weight-normal);--ifm-line-height-base:1.65;--ifm-global-spacing:1rem;--ifm-spacing-vertical:var(--ifm-global-spacing);--ifm-spacing-horizontal:var(--ifm-global-spacing);--ifm-transition-fast:200ms;--ifm-transition-slow:400ms;--ifm-transition-timing-default:cubic-bezier(0.08,0.52,0.52,1);--ifm-global-shadow-lw:0 1px 2px 0 rgba(0,0,0,.1);--ifm-global-shadow-md:0 5px 40px rgba(0,0,0,.2);--ifm-global-shadow-tl:0 12px 28px 0 rgba(0,0,0,.2),0 2px 4px 0 rgba(0,0,0,.1);--ifm-z-index-dropdown:100;--ifm-z-index-fixed:200;--ifm-z-index-overlay:400;--ifm-container-width:1140px;--ifm-container-width-xl:1320px;--ifm-code-background:#f6f7f8;--ifm-code-border-radius:var(--ifm-global-radius);--ifm-code-font-size:90%;--ifm-code-padding-horizontal:0.1rem;--ifm-code-padding-vertical:0.1rem;--ifm-pre-background:var(--ifm-code-background);--ifm-pre-border-radius:var(--ifm-code-border-radius);--ifm-pre-color:inherit;--ifm-pre-line-height:1.45;--ifm-pre-padding:1rem;--ifm-heading-color:inherit;--ifm-heading-margin-top:0;--ifm-heading-margin-bottom:var(--ifm-spacing-vertical);--ifm-heading-font-family:var(--ifm-font-family-base);--ifm-heading-font-weight:var(--ifm-font-weight-bold);--ifm-heading-line-height:1.25;--ifm-h1-font-size:2rem;--ifm-h2-font-size:1.5rem;--ifm-h3-font-size:1.25rem;--ifm-h4-font-size:1rem;--ifm-h5-font-size:0.875rem;--ifm-h6-font-size:0.85rem;--ifm-image-alignment-padding:1.25rem;--ifm-leading-desktop:1.25;--ifm-leading:calc(var(--ifm-leading-desktop)*1rem);--ifm-list-left-padding:2rem;--ifm-list-margin:1rem;--ifm-list-item-margin:0.25rem;--ifm-list-paragraph-margin:1rem;--ifm-table-cell-padding:0.75rem;--ifm-table-background:transparent;--ifm-table-stripe-background:rgba(0,0,0,.03);--ifm-table-border-width:1px;--ifm-table-border-color:var(--ifm-color-emphasis-300);--ifm-table-head-background:inherit;--ifm-table-head-color:inherit;--ifm-table-head-font-weight:var(--ifm-font-weight-bold);--ifm-table-cell-color:inherit;--ifm-link-color:var(--ifm-color-primary);--ifm-link-decoration:none;--ifm-link-hover-color:var(--ifm-link-color);--ifm-link-hover-decoration:underline;--ifm-paragraph-margin-bottom:var(--ifm-leading);--ifm-blockquote-font-size:var(--ifm-font-size-base);--ifm-blockquote-border-left-width:2px;--ifm-blockquote-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-blockquote-padding-vertical:0;--ifm-blockquote-shadow:none;--ifm-blockquote-color:var(--ifm-color-emphasis-800);--ifm-blockquote-border-color:var(--ifm-color-emphasis-300);--ifm-hr-background-color:var(--ifm-color-emphasis-500);--ifm-hr-height:1px;--ifm-hr-margin-vertical:1.5rem;--ifm-scrollbar-size:7px;--ifm-scrollbar-track-background-color:#f1f1f1;--ifm-scrollbar-thumb-background-color:silver;--ifm-scrollbar-thumb-hover-background-color:#a7a7a7;--ifm-alert-background-color:inherit;--ifm-alert-border-color:inherit;--ifm-alert-border-radius:var(--ifm-global-radius);--ifm-alert-border-width:0px;--ifm-alert-border-left-width:5px;--ifm-alert-color:var(--ifm-font-color-base);--ifm-alert-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-alert-padding-vertical:var(--ifm-spacing-vertical);--ifm-alert-shadow:var(--ifm-global-shadow-lw);--ifm-avatar-intro-margin:1rem;--ifm-avatar-intro-alignment:inherit;--ifm-avatar-photo-size:3rem;--ifm-badge-background-color:inherit;--ifm-badge-border-color:inherit;--ifm-badge-border-radius:var(--ifm-global-radius);--ifm-badge-border-width:var(--ifm-global-border-width);--ifm-badge-color:var(--ifm-color-white);--ifm-badge-padding-horizontal:calc(var(--ifm-spacing-horizontal)*0.5);--ifm-badge-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-breadcrumb-border-radius:1.5rem;--ifm-breadcrumb-spacing:0.5rem;--ifm-breadcrumb-color-active:var(--ifm-color-primary);--ifm-breadcrumb-item-background-active:var(--ifm-hover-overlay);--ifm-breadcrumb-padding-horizontal:0.8rem;--ifm-breadcrumb-padding-vertical:0.4rem;--ifm-breadcrumb-size-multiplier:1;--ifm-breadcrumb-separator:url('data:image/svg+xml;utf8,');--ifm-breadcrumb-separator-filter:none;--ifm-breadcrumb-separator-size:0.5rem;--ifm-breadcrumb-separator-size-multiplier:1.25;--ifm-button-background-color:inherit;--ifm-button-border-color:var(--ifm-button-background-color);--ifm-button-border-width:var(--ifm-global-border-width);--ifm-button-font-weight:var(--ifm-font-weight-bold);--ifm-button-padding-horizontal:1.5rem;--ifm-button-padding-vertical:0.375rem;--ifm-button-size-multiplier:1;--ifm-button-transition-duration:var(--ifm-transition-fast);--ifm-button-border-radius:calc(var(--ifm-global-radius)*var(--ifm-button-size-multiplier));--ifm-button-group-spacing:2px;--ifm-card-background-color:var(--ifm-background-surface-color);--ifm-card-border-radius:calc(var(--ifm-global-radius)*2);--ifm-card-horizontal-spacing:var(--ifm-global-spacing);--ifm-card-vertical-spacing:var(--ifm-global-spacing);--ifm-toc-border-color:var(--ifm-color-emphasis-300);--ifm-toc-link-color:var(--ifm-color-content-secondary);--ifm-toc-padding-vertical:0.5rem;--ifm-toc-padding-horizontal:0.5rem;--ifm-dropdown-background-color:var(--ifm-background-surface-color);--ifm-dropdown-font-weight:var(--ifm-font-weight-semibold);--ifm-dropdown-link-color:var(--ifm-font-color-base);--ifm-dropdown-hover-background-color:var(--ifm-hover-overlay);--ifm-footer-background-color:var(--ifm-color-emphasis-100);--ifm-footer-color:inherit;--ifm-footer-link-color:var(--ifm-color-emphasis-700);--ifm-footer-link-hover-color:var(--ifm-color-primary);--ifm-footer-link-horizontal-spacing:0.5rem;--ifm-footer-padding-horizontal:calc(var(--ifm-spacing-horizontal)*2);--ifm-footer-padding-vertical:calc(var(--ifm-spacing-vertical)*2);--ifm-footer-title-color:inherit;--ifm-footer-logo-max-width:min(30rem,90vw);--ifm-hero-background-color:var(--ifm-background-surface-color);--ifm-hero-text-color:var(--ifm-color-emphasis-800);--ifm-menu-color:var(--ifm-color-emphasis-700);--ifm-menu-color-active:var(--ifm-color-primary);--ifm-menu-color-background-active:var(--ifm-hover-overlay);--ifm-menu-color-background-hover:var(--ifm-hover-overlay);--ifm-menu-link-padding-horizontal:0.75rem;--ifm-menu-link-padding-vertical:0.375rem;--ifm-menu-link-sublist-icon:url('data:image/svg+xml;utf8,');--ifm-menu-link-sublist-icon-filter:none;--ifm-navbar-background-color:var(--ifm-background-surface-color);--ifm-navbar-height:3.75rem;--ifm-navbar-item-padding-horizontal:0.75rem;--ifm-navbar-item-padding-vertical:0.25rem;--ifm-navbar-link-color:var(--ifm-font-color-base);--ifm-navbar-link-active-color:var(--ifm-link-color);--ifm-navbar-padding-horizontal:var(--ifm-spacing-horizontal);--ifm-navbar-padding-vertical:calc(var(--ifm-spacing-vertical)*0.5);--ifm-navbar-shadow:var(--ifm-global-shadow-lw);--ifm-navbar-search-input-background-color:var(--ifm-color-emphasis-200);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-800);--ifm-navbar-search-input-placeholder-color:var(--ifm-color-emphasis-500);--ifm-navbar-search-input-icon:url('data:image/svg+xml;utf8,');--ifm-navbar-sidebar-width:83vw;--ifm-pagination-border-radius:var(--ifm-global-radius);--ifm-pagination-color-active:var(--ifm-color-primary);--ifm-pagination-font-size:1rem;--ifm-pagination-item-active-background:var(--ifm-hover-overlay);--ifm-pagination-page-spacing:0.2em;--ifm-pagination-padding-horizontal:calc(var(--ifm-spacing-horizontal)*1);--ifm-pagination-padding-vertical:calc(var(--ifm-spacing-vertical)*0.25);--ifm-pagination-nav-border-radius:var(--ifm-global-radius);--ifm-pagination-nav-color-hover:var(--ifm-color-primary);--ifm-pills-color-active:var(--ifm-color-primary);--ifm-pills-color-background-active:var(--ifm-hover-overlay);--ifm-pills-spacing:0.125rem;--ifm-tabs-color:var(--ifm-font-color-secondary);--ifm-tabs-color-active:var(--ifm-color-primary);--ifm-tabs-color-active-border:var(--ifm-tabs-color-active);--ifm-tabs-padding-horizontal:1rem;--ifm-tabs-padding-vertical:1rem;--docusaurus-progress-bar-color:var(--ifm-color-primary);--ifm-color-primary:#005d8f;--ifm-color-primary-dark:#005481;--ifm-color-primary-darker:#004f7a;--ifm-color-primary-darkest:#004164;--ifm-color-primary-light:#00669d;--ifm-color-primary-lighter:#006ba4;--ifm-color-primary-lightest:#0079ba;--ifm-code-font-size:95%;--docusaurus-highlighted-code-line-bg:#fff;--docusaurus-announcement-bar-height:auto;--docusaurus-tag-list-border:var(--ifm-color-emphasis-300);--docusaurus-collapse-button-bg:transparent;--docusaurus-collapse-button-bg-hover:rgba(0,0,0,.1);--doc-sidebar-width:300px;--doc-sidebar-hidden-width:30px;--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:rgba(101,108,133,.8);--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 hsla(0,0%,100%,.5),0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px rgba(30,35,90,.4);--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 rgba(69,98,155,.12);--docsearch-primary-color:var(--ifm-color-primary);--docsearch-text-color:var(--ifm-font-color-base)}.alert,.markdown a{--ifm-link-decoration:underline}.badge--danger,.badge--info,.badge--primary,.badge--secondary,.badge--success,.badge--warning{--ifm-badge-border-color:var(--ifm-badge-background-color)}.button--link,.button--outline{--ifm-button-background-color:transparent}html{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-size-adjust:100%;background-color:var(--ifm-background-color);color:var(--ifm-font-color-base);color-scheme:var(--ifm-color-scheme);font:var(--ifm-font-size-base)/var(--ifm-line-height-base) var(--ifm-font-family-base);text-rendering:optimizelegibility}iframe{border:0;color-scheme:auto}.container{margin:0 auto;max-width:var(--ifm-container-width)}.container--fluid{max-width:inherit}.row{display:flex;flex-wrap:wrap;margin:0 calc(var(--ifm-spacing-horizontal)*-1)}.margin-bottom--none,.margin-vert--none,.markdown>:last-child{margin-bottom:0!important}.margin-top--none,.margin-vert--none,.tabItem_l0OV{margin-top:0!important}.row--no-gutters{margin-left:0;margin-right:0}.margin-horiz--none,.margin-right--none{margin-right:0!important}.row--no-gutters>.col{padding-left:0;padding-right:0}.row--align-top{align-items:flex-start}.row--align-bottom{align-items:flex-end}.menuExternalLink_BiEj,.row--align-center{align-items:center}.row--align-stretch{align-items:stretch}.row--align-baseline{align-items:baseline}.col{--ifm-col-width:100%;flex:1 0;margin-left:0;max-width:var(--ifm-col-width)}.padding-bottom--none,.padding-vert--none{padding-bottom:0!important}.padding-top--none,.padding-vert--none{padding-top:0!important}.padding-horiz--none,.padding-left--none{padding-left:0!important}.padding-horiz--none,.padding-right--none{padding-right:0!important}.col[class*=col--]{flex:0 0 var(--ifm-col-width)}.col--1{--ifm-col-width:8.33333%}.col--offset-1{margin-left:8.33333%}.col--2{--ifm-col-width:16.66667%}.col--offset-2{margin-left:16.66667%}.col--3{--ifm-col-width:25%}.col--offset-3{margin-left:25%}.col--4{--ifm-col-width:33.33333%}.col--offset-4{margin-left:33.33333%}.col--5{--ifm-col-width:41.66667%}.col--offset-5{margin-left:41.66667%}.col--6{--ifm-col-width:50%}.col--offset-6{margin-left:50%}.col--7{--ifm-col-width:58.33333%}.col--offset-7{margin-left:58.33333%}.col--8{--ifm-col-width:66.66667%}.col--offset-8{margin-left:66.66667%}.col--9{--ifm-col-width:75%}.col--offset-9{margin-left:75%}.col--10{--ifm-col-width:83.33333%}.col--offset-10{margin-left:83.33333%}.col--11{--ifm-col-width:91.66667%}.col--offset-11{margin-left:91.66667%}.col--12{--ifm-col-width:100%}.col--offset-12{margin-left:100%}.margin-horiz--none,.margin-left--none{margin-left:0!important}.margin--none{margin:0!important}.margin-bottom--xs,.margin-vert--xs{margin-bottom:.25rem!important}.margin-top--xs,.margin-vert--xs{margin-top:.25rem!important}.margin-horiz--xs,.margin-left--xs{margin-left:.25rem!important}.margin-horiz--xs,.margin-right--xs{margin-right:.25rem!important}.margin--xs{margin:.25rem!important}.margin-bottom--sm,.margin-vert--sm{margin-bottom:.5rem!important}.margin-top--sm,.margin-vert--sm{margin-top:.5rem!important}.margin-horiz--sm,.margin-left--sm{margin-left:.5rem!important}.margin-horiz--sm,.margin-right--sm{margin-right:.5rem!important}.margin--sm{margin:.5rem!important}.margin-bottom--md,.margin-vert--md{margin-bottom:1rem!important}.margin-top--md,.margin-vert--md{margin-top:1rem!important}.margin-horiz--md,.margin-left--md{margin-left:1rem!important}.margin-horiz--md,.margin-right--md{margin-right:1rem!important}.margin--md{margin:1rem!important}.margin-bottom--lg,.margin-vert--lg{margin-bottom:2rem!important}.margin-top--lg,.margin-vert--lg{margin-top:2rem!important}.margin-horiz--lg,.margin-left--lg{margin-left:2rem!important}.margin-horiz--lg,.margin-right--lg{margin-right:2rem!important}.margin--lg{margin:2rem!important}.margin-bottom--xl,.margin-vert--xl{margin-bottom:5rem!important}.margin-top--xl,.margin-vert--xl{margin-top:5rem!important}.margin-horiz--xl,.margin-left--xl{margin-left:5rem!important}.margin-horiz--xl,.margin-right--xl{margin-right:5rem!important}.margin--xl{margin:5rem!important}.padding--none{padding:0!important}.padding-bottom--xs,.padding-vert--xs{padding-bottom:.25rem!important}.padding-top--xs,.padding-vert--xs{padding-top:.25rem!important}.padding-horiz--xs,.padding-left--xs{padding-left:.25rem!important}.padding-horiz--xs,.padding-right--xs{padding-right:.25rem!important}.padding--xs{padding:.25rem!important}.padding-bottom--sm,.padding-vert--sm{padding-bottom:.5rem!important}.padding-top--sm,.padding-vert--sm{padding-top:.5rem!important}.padding-horiz--sm,.padding-left--sm{padding-left:.5rem!important}.padding-horiz--sm,.padding-right--sm{padding-right:.5rem!important}.padding--sm{padding:.5rem!important}.padding-bottom--md,.padding-vert--md{padding-bottom:1rem!important}.padding-top--md,.padding-vert--md{padding-top:1rem!important}.padding-horiz--md,.padding-left--md{padding-left:1rem!important}.padding-horiz--md,.padding-right--md{padding-right:1rem!important}.padding--md{padding:1rem!important}.padding-bottom--lg,.padding-vert--lg{padding-bottom:2rem!important}.padding-top--lg,.padding-vert--lg{padding-top:2rem!important}.padding-horiz--lg,.padding-left--lg{padding-left:2rem!important}.padding-horiz--lg,.padding-right--lg{padding-right:2rem!important}.padding--lg{padding:2rem!important}.padding-bottom--xl,.padding-vert--xl{padding-bottom:5rem!important}.padding-top--xl,.padding-vert--xl{padding-top:5rem!important}.padding-horiz--xl,.padding-left--xl{padding-left:5rem!important}.padding-horiz--xl,.padding-right--xl{padding-right:5rem!important}.padding--xl{padding:5rem!important}code{background-color:var(--ifm-code-background);border:.1rem solid rgba(0,0,0,.1);border-radius:var(--ifm-code-border-radius);font-family:var(--ifm-font-family-monospace);font-size:var(--ifm-code-font-size);padding:var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal)}a code{color:inherit}pre{background-color:var(--ifm-pre-background);border-radius:var(--ifm-pre-border-radius);color:var(--ifm-pre-color);font:var(--ifm-code-font-size)/var(--ifm-pre-line-height) var(--ifm-font-family-monospace);padding:var(--ifm-pre-padding)}pre code{background-color:transparent;border:none;font-size:100%;line-height:inherit;padding:0}kbd{background-color:var(--ifm-color-emphasis-0);border:1px solid var(--ifm-color-emphasis-400);border-radius:.2rem;box-shadow:inset 0 -1px 0 var(--ifm-color-emphasis-400);color:var(--ifm-color-emphasis-800);font:80% var(--ifm-font-family-monospace);padding:.15rem .3rem}h1,h2,h3,h4,h5,h6{color:var(--ifm-heading-color);font-family:var(--ifm-heading-font-family);font-weight:var(--ifm-heading-font-weight);line-height:var(--ifm-heading-line-height);margin:var(--ifm-heading-margin-top) 0 var(--ifm-heading-margin-bottom) 0}h1{font-size:var(--ifm-h1-font-size)}h2{font-size:var(--ifm-h2-font-size)}h3{font-size:var(--ifm-h3-font-size)}h4{font-size:var(--ifm-h4-font-size)}h5{font-size:var(--ifm-h5-font-size)}h6{font-size:var(--ifm-h6-font-size)}.container_U0RM,.container_U0RM>svg,img{max-width:100%}img[align=right]{padding-left:var(--image-alignment-padding)}img[align=left]{padding-right:var(--image-alignment-padding)}.markdown{--ifm-h1-vertical-rhythm-top:3;--ifm-h2-vertical-rhythm-top:2;--ifm-h3-vertical-rhythm-top:1.5;--ifm-heading-vertical-rhythm-top:1.25;--ifm-h1-vertical-rhythm-bottom:1.25;--ifm-heading-vertical-rhythm-bottom:1}.markdown:after,.markdown:before{content:"";display:table}.markdown:after{clear:both}.markdown h1:first-child{--ifm-h1-font-size:3rem;margin-bottom:calc(var(--ifm-h1-vertical-rhythm-bottom)*var(--ifm-leading))}.markdown>h2{--ifm-h2-font-size:2rem;margin-top:calc(var(--ifm-h2-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h3{--ifm-h3-font-size:1.5rem;margin-top:calc(var(--ifm-h3-vertical-rhythm-top)*var(--ifm-leading))}.markdown>h4,.markdown>h5,.markdown>h6{margin-top:calc(var(--ifm-heading-vertical-rhythm-top)*var(--ifm-leading))}.markdown>p,.markdown>pre,.markdown>ul,.tabList_J5MA{margin-bottom:var(--ifm-leading)}.markdown li>p{margin-top:var(--ifm-list-paragraph-margin)}.markdown li+li{margin-top:var(--ifm-list-item-margin)}ol,ul{margin:0 0 var(--ifm-list-margin);padding-left:var(--ifm-list-left-padding)}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}table{border-collapse:collapse;display:block;margin-bottom:var(--ifm-spacing-vertical)}table thead tr{border-bottom:2px solid var(--ifm-table-border-color)}table thead,table tr:nth-child(2n){background-color:var(--ifm-table-stripe-background)}table tr{background-color:var(--ifm-table-background);border-top:var(--ifm-table-border-width) solid var(--ifm-table-border-color)}table td,table th{border:var(--ifm-table-border-width) solid var(--ifm-table-border-color);padding:var(--ifm-table-cell-padding)}table th{background-color:var(--ifm-table-head-background);color:var(--ifm-table-head-color);font-weight:var(--ifm-table-head-font-weight)}table td{color:var(--ifm-table-cell-color)}strong{font-weight:var(--ifm-font-weight-bold)}a{color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}a:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button:hover,.text--no-decoration,.text--no-decoration:hover,a:not([href]){text-decoration:none}p{margin:0 0 var(--ifm-paragraph-margin-bottom)}blockquote{border-left:var(--ifm-blockquote-border-left-width) solid var(--ifm-blockquote-border-color);box-shadow:var(--ifm-blockquote-shadow);color:var(--ifm-blockquote-color);font-size:var(--ifm-blockquote-font-size);padding:var(--ifm-blockquote-padding-vertical) var(--ifm-blockquote-padding-horizontal)}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}hr{background-color:var(--ifm-hr-background-color);border:0;height:var(--ifm-hr-height);margin:var(--ifm-hr-margin-vertical) 0}.shadow--lw{box-shadow:var(--ifm-global-shadow-lw)!important}.shadow--md{box-shadow:var(--ifm-global-shadow-md)!important}.shadow--tl{box-shadow:var(--ifm-global-shadow-tl)!important}.text--primary,.wordWrapButtonEnabled_XzR1 .wordWrapButtonIcon_HV9T{color:var(--ifm-color-primary)}.text--secondary{color:var(--ifm-color-secondary)}.text--success{color:var(--ifm-color-success)}.text--info{color:var(--ifm-color-info)}.text--warning{color:var(--ifm-color-warning)}.text--danger{color:var(--ifm-color-danger)}.text--center{text-align:center}.text--left{text-align:left}.text--justify{text-align:justify}.text--right{text-align:right}.text--capitalize{text-transform:capitalize}.text--lowercase{text-transform:lowercase}.admonitionHeading_P5_N,.alert__heading,.text--uppercase{text-transform:uppercase}.text--light{font-weight:var(--ifm-font-weight-light)}.text--normal{font-weight:var(--ifm-font-weight-normal)}.text--semibold{font-weight:var(--ifm-font-weight-semibold)}.text--bold{font-weight:var(--ifm-font-weight-bold)}.text--italic{font-style:italic}.text--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text--break{word-wrap:break-word!important;word-break:break-word!important}.clean-btn{background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;padding:0}.alert,.alert .close{color:var(--ifm-alert-foreground-color)}.clean-list{list-style:none;padding-left:0}.alert--primary{--ifm-alert-background-color:var(--ifm-color-primary-contrast-background);--ifm-alert-background-color-highlight:rgba(53,120,229,.15);--ifm-alert-foreground-color:var(--ifm-color-primary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-primary-dark)}.alert--secondary{--ifm-alert-background-color:var(--ifm-color-secondary-contrast-background);--ifm-alert-background-color-highlight:rgba(235,237,240,.15);--ifm-alert-foreground-color:var(--ifm-color-secondary-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-secondary-dark)}.alert--success{--ifm-alert-background-color:var(--ifm-color-success-contrast-background);--ifm-alert-background-color-highlight:rgba(0,164,0,.15);--ifm-alert-foreground-color:var(--ifm-color-success-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-success-dark)}.alert--info{--ifm-alert-background-color:var(--ifm-color-info-contrast-background);--ifm-alert-background-color-highlight:rgba(84,199,236,.15);--ifm-alert-foreground-color:var(--ifm-color-info-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-info-dark)}.alert--warning{--ifm-alert-background-color:var(--ifm-color-warning-contrast-background);--ifm-alert-background-color-highlight:rgba(255,186,0,.15);--ifm-alert-foreground-color:var(--ifm-color-warning-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-warning-dark)}.alert--danger{--ifm-alert-background-color:var(--ifm-color-danger-contrast-background);--ifm-alert-background-color-highlight:rgba(250,56,62,.15);--ifm-alert-foreground-color:var(--ifm-color-danger-contrast-foreground);--ifm-alert-border-color:var(--ifm-color-danger-dark)}.alert{--ifm-code-background:var(--ifm-alert-background-color-highlight);--ifm-link-color:var(--ifm-alert-foreground-color);--ifm-link-hover-color:var(--ifm-alert-foreground-color);--ifm-tabs-color:var(--ifm-alert-foreground-color);--ifm-tabs-color-active:var(--ifm-alert-foreground-color);--ifm-tabs-color-active-border:var(--ifm-alert-border-color);background-color:var(--ifm-alert-background-color);border:var(--ifm-alert-border-width) solid var(--ifm-alert-border-color);border-left-width:var(--ifm-alert-border-left-width);border-radius:var(--ifm-alert-border-radius);box-shadow:var(--ifm-alert-shadow);padding:var(--ifm-alert-padding-vertical) var(--ifm-alert-padding-horizontal)}.alert__heading{align-items:center;display:flex;font:700 var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.5rem}.alert__icon{display:inline-flex;margin-right:.4em}.alert__icon svg{fill:var(--ifm-alert-foreground-color);stroke:var(--ifm-alert-foreground-color);stroke-width:0}.alert .close{margin:calc(var(--ifm-alert-padding-vertical)*-1) calc(var(--ifm-alert-padding-horizontal)*-1) 0 0;opacity:.75}.alert .close:focus,.alert .close:hover{opacity:1}.alert a{text-decoration-color:var(--ifm-alert-border-color)}.alert a:hover{text-decoration-thickness:2px}.avatar{column-gap:var(--ifm-avatar-intro-margin);display:flex}.avatar__photo{border-radius:50%;display:block;height:var(--ifm-avatar-photo-size);overflow:hidden;width:var(--ifm-avatar-photo-size)}.card--full-height,.navbar__logo img,body,html{height:100%}.avatar__photo--sm{--ifm-avatar-photo-size:2rem}.avatar__photo--lg{--ifm-avatar-photo-size:4rem}.avatar__photo--xl{--ifm-avatar-photo-size:6rem}.avatar__intro{display:flex;flex:1 1;flex-direction:column;justify-content:center;text-align:var(--ifm-avatar-intro-alignment)}.badge,.breadcrumbs__item,.breadcrumbs__link,.button,.dropdown>.navbar__link:after{display:inline-block}.avatar__name{font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base)}.avatar__subtitle{margin-top:.25rem}.avatar--vertical{--ifm-avatar-intro-alignment:center;--ifm-avatar-intro-margin:0.5rem;align-items:center;flex-direction:column}.badge{background-color:var(--ifm-badge-background-color);border:var(--ifm-badge-border-width) solid var(--ifm-badge-border-color);border-radius:var(--ifm-badge-border-radius);color:var(--ifm-badge-color);font-size:75%;font-weight:var(--ifm-font-weight-bold);line-height:1;padding:var(--ifm-badge-padding-vertical) var(--ifm-badge-padding-horizontal)}.badge--primary{--ifm-badge-background-color:var(--ifm-color-primary)}.badge--secondary{--ifm-badge-background-color:var(--ifm-color-secondary);color:var(--ifm-color-black)}.breadcrumbs__link,.button.button--secondary.button--outline:not(.button--active):not(:hover){color:var(--ifm-font-color-base)}.badge--success{--ifm-badge-background-color:var(--ifm-color-success)}.badge--info{--ifm-badge-background-color:var(--ifm-color-info)}.badge--warning{--ifm-badge-background-color:var(--ifm-color-warning)}.badge--danger{--ifm-badge-background-color:var(--ifm-color-danger)}.breadcrumbs{margin-bottom:0;padding-left:0}.breadcrumbs__item:not(:last-child):after{background:var(--ifm-breadcrumb-separator) center;content:" ";display:inline-block;filter:var(--ifm-breadcrumb-separator-filter);height:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier));margin:0 var(--ifm-breadcrumb-spacing);opacity:.5;width:calc(var(--ifm-breadcrumb-separator-size)*var(--ifm-breadcrumb-size-multiplier)*var(--ifm-breadcrumb-separator-size-multiplier))}.breadcrumbs__item--active .breadcrumbs__link{background:var(--ifm-breadcrumb-item-background-active);color:var(--ifm-breadcrumb-color-active)}.breadcrumbs__link{border-radius:var(--ifm-breadcrumb-border-radius);font-size:calc(1rem*var(--ifm-breadcrumb-size-multiplier));padding:calc(var(--ifm-breadcrumb-padding-vertical)*var(--ifm-breadcrumb-size-multiplier)) calc(var(--ifm-breadcrumb-padding-horizontal)*var(--ifm-breadcrumb-size-multiplier));transition-duration:var(--ifm-transition-fast);transition-property:background,color}.breadcrumbs__link:link:hover,.breadcrumbs__link:visited:hover,area[href].breadcrumbs__link:hover{background:var(--ifm-breadcrumb-item-background-active);text-decoration:none}.breadcrumbs__link:any-link:hover{background:var(--ifm-breadcrumb-item-background-active);text-decoration:none}.breadcrumbs--sm{--ifm-breadcrumb-size-multiplier:0.8}.breadcrumbs--lg{--ifm-breadcrumb-size-multiplier:1.2}.button{background-color:var(--ifm-button-background-color);border:var(--ifm-button-border-width) solid var(--ifm-button-border-color);border-radius:var(--ifm-button-border-radius);cursor:pointer;font-size:calc(.875rem*var(--ifm-button-size-multiplier));font-weight:var(--ifm-button-font-weight);line-height:1.5;padding:calc(var(--ifm-button-padding-vertical)*var(--ifm-button-size-multiplier)) calc(var(--ifm-button-padding-horizontal)*var(--ifm-button-size-multiplier));text-align:center;transition-duration:var(--ifm-button-transition-duration);transition-property:color,background,border-color;user-select:none;white-space:nowrap}.button,.button:hover{color:var(--ifm-button-color)}.button--outline{--ifm-button-color:var(--ifm-button-border-color)}.button--outline:hover{--ifm-button-background-color:var(--ifm-button-border-color)}.button--link{--ifm-button-border-color:transparent;color:var(--ifm-link-color);text-decoration:var(--ifm-link-decoration)}.button--link.button--active,.button--link:active,.button--link:hover{color:var(--ifm-link-hover-color);text-decoration:var(--ifm-link-hover-decoration)}.button.disabled,.button:disabled,.button[disabled]{opacity:.65;pointer-events:none}.button--sm{--ifm-button-size-multiplier:0.8}.button--lg{--ifm-button-size-multiplier:1.35}.button--block{display:block;width:100%}.button.button--secondary{color:var(--ifm-color-gray-900)}:where(.button--primary){--ifm-button-background-color:var(--ifm-color-primary);--ifm-button-border-color:var(--ifm-color-primary)}:where(.button--primary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-primary-dark);--ifm-button-border-color:var(--ifm-color-primary-dark)}.button--primary.button--active,.button--primary:active{--ifm-button-background-color:var(--ifm-color-primary-darker);--ifm-button-border-color:var(--ifm-color-primary-darker)}:where(.button--secondary){--ifm-button-background-color:var(--ifm-color-secondary);--ifm-button-border-color:var(--ifm-color-secondary)}:where(.button--secondary):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-secondary-dark);--ifm-button-border-color:var(--ifm-color-secondary-dark)}.button--secondary.button--active,.button--secondary:active{--ifm-button-background-color:var(--ifm-color-secondary-darker);--ifm-button-border-color:var(--ifm-color-secondary-darker)}:where(.button--success){--ifm-button-background-color:var(--ifm-color-success);--ifm-button-border-color:var(--ifm-color-success)}:where(.button--success):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-success-dark);--ifm-button-border-color:var(--ifm-color-success-dark)}.button--success.button--active,.button--success:active{--ifm-button-background-color:var(--ifm-color-success-darker);--ifm-button-border-color:var(--ifm-color-success-darker)}:where(.button--info){--ifm-button-background-color:var(--ifm-color-info);--ifm-button-border-color:var(--ifm-color-info)}:where(.button--info):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-info-dark);--ifm-button-border-color:var(--ifm-color-info-dark)}.button--info.button--active,.button--info:active{--ifm-button-background-color:var(--ifm-color-info-darker);--ifm-button-border-color:var(--ifm-color-info-darker)}:where(.button--warning){--ifm-button-background-color:var(--ifm-color-warning);--ifm-button-border-color:var(--ifm-color-warning)}:where(.button--warning):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-warning-dark);--ifm-button-border-color:var(--ifm-color-warning-dark)}.button--warning.button--active,.button--warning:active{--ifm-button-background-color:var(--ifm-color-warning-darker);--ifm-button-border-color:var(--ifm-color-warning-darker)}:where(.button--danger){--ifm-button-background-color:var(--ifm-color-danger);--ifm-button-border-color:var(--ifm-color-danger)}:where(.button--danger):not(.button--outline):hover{--ifm-button-background-color:var(--ifm-color-danger-dark);--ifm-button-border-color:var(--ifm-color-danger-dark)}.button--danger.button--active,.button--danger:active{--ifm-button-background-color:var(--ifm-color-danger-darker);--ifm-button-border-color:var(--ifm-color-danger-darker)}.button-group{display:inline-flex;gap:var(--ifm-button-group-spacing)}.button-group>.button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.button-group>.button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.button-group--block{display:flex;justify-content:stretch}.button-group--block>.button{flex-grow:1}.card{background-color:var(--ifm-card-background-color);border-radius:var(--ifm-card-border-radius);box-shadow:var(--ifm-global-shadow-lw);display:flex;flex-direction:column;overflow:hidden}.card__image{padding-top:var(--ifm-card-vertical-spacing)}.card__image:first-child{padding-top:0}.card__body,.card__footer,.card__header{padding:var(--ifm-card-vertical-spacing) var(--ifm-card-horizontal-spacing)}.card__body:not(:last-child),.card__footer:not(:last-child),.card__header:not(:last-child){padding-bottom:0}.card__body>:last-child,.card__footer>:last-child,.card__header>:last-child{margin-bottom:0}.card__footer{margin-top:auto}.table-of-contents{font-size:.8rem;margin-bottom:0;padding:var(--ifm-toc-padding-vertical) 0}.table-of-contents,.table-of-contents ul{list-style:none;padding-left:var(--ifm-toc-padding-horizontal)}.table-of-contents li{margin:var(--ifm-toc-padding-vertical) var(--ifm-toc-padding-horizontal)}.table-of-contents__left-border{border-left:1px solid var(--ifm-toc-border-color)}.table-of-contents__link{color:var(--ifm-toc-link-color);display:block}.table-of-contents__link--active,.table-of-contents__link--active code,.table-of-contents__link:hover,.table-of-contents__link:hover code{color:var(--ifm-color-primary);text-decoration:none}.close{color:var(--ifm-color-black);float:right;font-size:1.5rem;font-weight:var(--ifm-font-weight-bold);line-height:1;opacity:.5;padding:1rem;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.close:hover{opacity:.7}.close:focus,.theme-code-block-highlighted-line .codeLineNumber_BE9Z:before{opacity:.8}.dropdown{display:inline-flex;font-weight:var(--ifm-dropdown-font-weight);position:relative;vertical-align:top}.dropdown--hoverable:hover .dropdown__menu,.dropdown--show .dropdown__menu{opacity:1;pointer-events:all;transform:translateY(-1px);visibility:visible}#nprogress,.dropdown__menu,.navbar__item.dropdown .navbar__link:not([href]){pointer-events:none}.dropdown--right .dropdown__menu{left:inherit;right:0}.dropdown--nocaret .navbar__link:after{content:none!important}.dropdown__menu{background-color:var(--ifm-dropdown-background-color);border-radius:var(--ifm-global-radius);box-shadow:var(--ifm-global-shadow-md);left:0;list-style:none;max-height:80vh;min-width:10rem;opacity:0;overflow-y:auto;padding:.5rem;position:absolute;top:calc(100% - var(--ifm-navbar-item-padding-vertical) + .3rem);transform:translateY(-.625rem);transition-duration:var(--ifm-transition-fast);transition-property:opacity,transform,visibility;transition-timing-function:var(--ifm-transition-timing-default);visibility:hidden;z-index:var(--ifm-z-index-dropdown)}.menu__caret,.menu__link,.menu__list-item-collapsible{border-radius:.25rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.dropdown__link{border-radius:.25rem;color:var(--ifm-dropdown-link-color);display:block;font-size:.875rem;margin-top:.2rem;padding:.25rem .5rem;white-space:nowrap}.dropdown__link--active,.dropdown__link:hover{background-color:var(--ifm-dropdown-hover-background-color);color:var(--ifm-dropdown-link-color);text-decoration:none}.dropdown__link--active,.dropdown__link--active:hover{--ifm-dropdown-link-color:var(--ifm-link-color)}.dropdown>.navbar__link:after{border-color:currentcolor transparent;border-style:solid;border-width:.4em .4em 0;content:"";margin-left:.3em;position:relative;top:2px;transform:translateY(-50%)}.footer{background-color:var(--ifm-footer-background-color);color:var(--ifm-footer-color);padding:var(--ifm-footer-padding-vertical) var(--ifm-footer-padding-horizontal)}.footer--dark{--ifm-footer-background-color:#303846;--ifm-footer-color:var(--ifm-footer-link-color);--ifm-footer-link-color:var(--ifm-color-secondary);--ifm-footer-title-color:var(--ifm-color-white)}.footer__links{margin-bottom:1rem}.footer__link-item{color:var(--ifm-footer-link-color);line-height:2}.footer__link-item:hover{color:var(--ifm-footer-link-hover-color)}.footer__link-separator{margin:0 var(--ifm-footer-link-horizontal-spacing)}.footer__logo{margin-top:1rem;max-width:var(--ifm-footer-logo-max-width)}.footer__title{color:var(--ifm-footer-title-color);font:700 var(--ifm-h4-font-size)/var(--ifm-heading-line-height) var(--ifm-font-family-base);margin-bottom:var(--ifm-heading-margin-bottom)}.menu,.navbar__link{font-weight:var(--ifm-font-weight-semibold)}.docItemContainer_tjFy article>:first-child,.docItemContainer_tjFy header+*,.footer__item{margin-top:0}.admonitionContent_yySL>:last-child,.collapsibleContent_Fd2D>:last-child,.footer__items,.tabItem_wHwb>:last-child{margin-bottom:0}.codeBlockStandalone_wQog,[type=checkbox]{padding:0}.hero{align-items:center;background-color:var(--ifm-hero-background-color);color:var(--ifm-hero-text-color);display:flex;padding:4rem 2rem}.hero--primary{--ifm-hero-background-color:var(--ifm-color-primary);--ifm-hero-text-color:var(--ifm-font-color-base-inverse)}.hero--dark{--ifm-hero-background-color:#303846;--ifm-hero-text-color:var(--ifm-color-white)}.hero__title{font-size:3rem}.hero__subtitle{font-size:1.5rem}.menu__list{list-style:none;margin:0;padding-left:0}.menu__caret,.menu__link{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu__list .menu__list{flex:0 0 100%;margin-top:.25rem;padding-left:var(--ifm-menu-link-padding-horizontal)}.menu__list-item:not(:first-child){margin-top:.25rem}.menu__list-item--collapsed .menu__list{height:0;overflow:hidden}.details_IpIu[data-collapsed=false].isBrowser_QD4r>summary:before,.details_IpIu[open]:not(.isBrowser_QD4r)>summary:before,.menu__list-item--collapsed .menu__caret:before,.menu__list-item--collapsed .menu__link--sublist:after{transform:rotate(90deg)}.menu__list-item-collapsible{display:flex;flex-wrap:wrap;position:relative}.menu__caret:hover,.menu__link:hover,.menu__list-item-collapsible--active,.menu__list-item-collapsible:hover{background:var(--ifm-menu-color-background-hover)}.menu__list-item-collapsible .menu__link--active,.menu__list-item-collapsible .menu__link:hover{background:none!important}.menu__caret,.menu__link{align-items:center;display:flex}.navbar-sidebar,.navbar-sidebar__backdrop{bottom:0;opacity:0;top:0;transition-duration:var(--ifm-transition-fast);transition-timing-function:ease-in-out;left:0;visibility:hidden}.menu__link{color:var(--ifm-menu-color);flex:1;line-height:1.25}.menu__link:hover{color:var(--ifm-menu-color);text-decoration:none}.menu__caret:before,.menu__link--sublist-caret:after{height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast) linear;width:1.25rem;filter:var(--ifm-menu-link-sublist-icon-filter);content:""}.menu__link--sublist-caret:after{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem;margin-left:auto;min-width:1.25rem}.menu__link--active,.menu__link--active:hover{color:var(--ifm-menu-color-active)}.navbar__brand,.navbar__link{color:var(--ifm-navbar-link-color)}.menu__link--active:not(.menu__link--sublist){background-color:var(--ifm-menu-color-background-active)}.menu__caret:before{background:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem}.navbar--dark,html[data-theme=dark]{--ifm-menu-link-sublist-icon-filter:invert(100%) sepia(94%) saturate(17%) hue-rotate(223deg) brightness(104%) contrast(98%)}.navbar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-navbar-shadow);height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar,.navbar>.container,.navbar>.container-fluid{display:flex}.navbar--fixed-top{position:sticky;top:0;z-index:var(--ifm-z-index-fixed)}.navbar__inner{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%}.navbar__brand{align-items:center;display:flex;margin-right:1rem;min-width:0}.navbar__brand:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.announcementBarContent_t7IR,.navbar__title{flex:1 1 auto}.navbar__toggle{display:none;margin-right:.5rem}.navbar__logo{flex:0 0 auto;height:2rem;margin-right:.5rem}.navbar__items{align-items:center;display:flex;flex:1;min-width:0}.navbar__items--center{flex:0 0 auto}.navbar__items--center .navbar__brand{margin:0}.navbar__items--center+.navbar__items--right{flex:1}.navbar__items--right{flex:0 0 auto;justify-content:flex-end}.navbar__items--right>:last-child{padding-right:0}.navbar__item{display:inline-block;padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.navbar__link--active,.navbar__link:hover{color:var(--ifm-navbar-link-hover-color);text-decoration:none}.navbar--dark,.navbar--primary{--ifm-menu-color:var(--ifm-color-gray-300);--ifm-navbar-link-color:var(--ifm-color-gray-100);--ifm-navbar-search-input-background-color:hsla(0,0%,100%,.1);--ifm-navbar-search-input-placeholder-color:hsla(0,0%,100%,.5);color:var(--ifm-color-white)}.navbar--dark{--ifm-navbar-background-color:#242526;--ifm-menu-color-background-active:hsla(0,0%,100%,.05);--ifm-navbar-search-input-color:var(--ifm-color-white)}.navbar--primary{--ifm-navbar-background-color:var(--ifm-color-primary);--ifm-navbar-link-hover-color:var(--ifm-color-white);--ifm-menu-color-active:var(--ifm-color-white);--ifm-navbar-search-input-color:var(--ifm-color-emphasis-500)}.navbar__search-input{-webkit-appearance:none;appearance:none;background:var(--ifm-navbar-search-input-background-color) var(--ifm-navbar-search-input-icon) no-repeat .75rem center/1rem 1rem;border:none;border-radius:2rem;color:var(--ifm-navbar-search-input-color);cursor:text;display:inline-block;font-size:.9rem;height:2rem;padding:0 .5rem 0 2.25rem;width:12.5rem}.navbar__search-input::placeholder{color:var(--ifm-navbar-search-input-placeholder-color)}.navbar-sidebar{background-color:var(--ifm-navbar-background-color);box-shadow:var(--ifm-global-shadow-md);position:fixed;transform:translate3d(-100%,0,0);transition-property:opacity,visibility,transform;width:var(--ifm-navbar-sidebar-width)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar__items{transform:translateZ(0)}.navbar-sidebar--show .navbar-sidebar,.navbar-sidebar--show .navbar-sidebar__backdrop{opacity:1;visibility:visible}.navbar-sidebar__backdrop{background-color:rgba(0,0,0,.6);position:fixed;right:0;transition-property:opacity,visibility}.navbar-sidebar__brand{align-items:center;box-shadow:var(--ifm-navbar-shadow);display:flex;flex:1;height:var(--ifm-navbar-height);padding:var(--ifm-navbar-padding-vertical) var(--ifm-navbar-padding-horizontal)}.navbar-sidebar__items{display:flex;height:calc(100% - var(--ifm-navbar-height));transition:transform var(--ifm-transition-fast) ease-in-out}.navbar-sidebar__items--show-secondary{transform:translate3d(calc((var(--ifm-navbar-sidebar-width))*-1),0,0)}.navbar-sidebar__item{flex-shrink:0;padding:.5rem;width:calc(var(--ifm-navbar-sidebar-width))}.navbar-sidebar__back{background:var(--ifm-menu-color-background-active);font-size:15px;font-weight:var(--ifm-button-font-weight);margin:0 0 .2rem -.5rem;padding:.6rem 1.5rem;position:relative;text-align:left;top:-.5rem;width:calc(100% + 1rem)}.navbar-sidebar__close{display:flex;margin-left:auto}.pagination{column-gap:var(--ifm-pagination-page-spacing);display:flex;font-size:var(--ifm-pagination-font-size);padding-left:0}.pagination--sm{--ifm-pagination-font-size:0.8rem;--ifm-pagination-padding-horizontal:0.8rem;--ifm-pagination-padding-vertical:0.2rem}.pagination--lg{--ifm-pagination-font-size:1.2rem;--ifm-pagination-padding-horizontal:1.2rem;--ifm-pagination-padding-vertical:0.3rem}.pagination__item{display:inline-flex}.pagination__item>span{padding:var(--ifm-pagination-padding-vertical)}.pagination__item--active .pagination__link{color:var(--ifm-pagination-color-active)}.pagination__item--active .pagination__link,.pagination__item:not(.pagination__item--active):hover .pagination__link{background:var(--ifm-pagination-item-active-background)}.pagination__item--disabled,.pagination__item[disabled]{opacity:.25;pointer-events:none}.pagination__link{border-radius:var(--ifm-pagination-border-radius);color:var(--ifm-font-color-base);display:inline-block;padding:var(--ifm-pagination-padding-vertical) var(--ifm-pagination-padding-horizontal);transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination__link:hover{text-decoration:none}.pagination-nav{grid-gap:var(--ifm-spacing-horizontal);display:grid;gap:var(--ifm-spacing-horizontal);grid-template-columns:repeat(2,1fr)}.pagination-nav__link{border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-pagination-nav-border-radius);display:block;height:100%;line-height:var(--ifm-heading-line-height);padding:var(--ifm-global-spacing);transition:border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.pagination-nav__link:hover{border-color:var(--ifm-pagination-nav-color-hover);text-decoration:none}.pagination-nav__link--next{grid-column:2/3;text-align:right}.pagination-nav__label{font-size:var(--ifm-h4-font-size);font-weight:var(--ifm-heading-font-weight);word-break:break-word}.pagination-nav__link--prev .pagination-nav__label:before{content:"« "}.pagination-nav__link--next .pagination-nav__label:after{content:" »"}.pagination-nav__sublabel{color:var(--ifm-color-content-secondary);font-size:var(--ifm-h5-font-size);font-weight:var(--ifm-font-weight-semibold);margin-bottom:.25rem}.pills__item,.tabs{font-weight:var(--ifm-font-weight-bold)}.pills{display:flex;gap:var(--ifm-pills-spacing);padding-left:0}.pills__item{border-radius:.5rem;cursor:pointer;display:inline-block;padding:.25rem 1rem;transition:background var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs,:not(.containsTaskList_QWGu>li)>.containsTaskList_QWGu{padding-left:0}.pills__item--active{color:var(--ifm-pills-color-active)}.pills__item--active,.pills__item:not(.pills__item--active):hover{background:var(--ifm-pills-color-background-active)}.pills--block{justify-content:stretch}.pills--block .pills__item{flex-grow:1;text-align:center}.tabs{color:var(--ifm-tabs-color);display:flex;margin-bottom:0;overflow-x:auto}.tabs__item{border-bottom:3px solid transparent;border-radius:var(--ifm-global-radius);cursor:pointer;display:inline-flex;padding:var(--ifm-tabs-padding-vertical) var(--ifm-tabs-padding-horizontal);transition:background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.tabs__item--active{border-bottom-color:var(--ifm-tabs-color-active-border);border-bottom-left-radius:0;border-bottom-right-radius:0;color:var(--ifm-tabs-color-active)}.tabs__item:hover{background-color:var(--ifm-hover-overlay)}.tabs--block{justify-content:stretch}.tabs--block .tabs__item{flex-grow:1;justify-content:center}html[data-theme=dark]{--ifm-color-scheme:dark;--ifm-color-emphasis-0:var(--ifm-color-gray-1000);--ifm-color-emphasis-100:var(--ifm-color-gray-900);--ifm-color-emphasis-200:var(--ifm-color-gray-800);--ifm-color-emphasis-300:var(--ifm-color-gray-700);--ifm-color-emphasis-400:var(--ifm-color-gray-600);--ifm-color-emphasis-600:var(--ifm-color-gray-400);--ifm-color-emphasis-700:var(--ifm-color-gray-300);--ifm-color-emphasis-800:var(--ifm-color-gray-200);--ifm-color-emphasis-900:var(--ifm-color-gray-100);--ifm-color-emphasis-1000:var(--ifm-color-gray-0);--ifm-background-color:#1b1b1d;--ifm-background-surface-color:#242526;--ifm-hover-overlay:hsla(0,0%,100%,.05);--ifm-color-content:#e3e3e3;--ifm-color-content-secondary:#fff;--ifm-breadcrumb-separator-filter:invert(64%) sepia(11%) saturate(0%) hue-rotate(149deg) brightness(99%) contrast(95%);--ifm-code-background:hsla(0,0%,100%,.1);--ifm-scrollbar-track-background-color:#444;--ifm-scrollbar-thumb-background-color:#686868;--ifm-scrollbar-thumb-hover-background-color:#7a7a7a;--ifm-table-stripe-background:hsla(0,0%,100%,.07);--ifm-toc-border-color:var(--ifm-color-emphasis-200);--ifm-color-primary-contrast-background:#102445;--ifm-color-primary-contrast-foreground:#ebf2fc;--ifm-color-secondary-contrast-background:#474748;--ifm-color-secondary-contrast-foreground:#fdfdfe;--ifm-color-success-contrast-background:#003100;--ifm-color-success-contrast-foreground:#e6f6e6;--ifm-color-info-contrast-background:#193c47;--ifm-color-info-contrast-foreground:#eef9fd;--ifm-color-warning-contrast-background:#4d3800;--ifm-color-warning-contrast-foreground:#fff8e6;--ifm-color-danger-contrast-background:#4b1113;--ifm-color-danger-contrast-foreground:#ffebec;--docsearch-text-color:#f5f6f7;--docsearch-container-background:rgba(9,10,17,.8);--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 rgba(3,4,9,.3);--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 rgba(73,76,106,.5),0 -4px 8px 0 rgba(0,0,0,.2);--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}#nprogress .bar{background:var(--docusaurus-progress-bar-color);height:2px;left:0;position:fixed;top:0;width:100%;z-index:1031}#nprogress .peg,.pane{height:100%;position:absolute}#nprogress .peg{box-shadow:0 0 10px var(--docusaurus-progress-bar-color),0 0 5px var(--docusaurus-progress-bar-color);opacity:1;right:0;transform:rotate(3deg) translateY(-4px);width:100px}[data-theme=dark]{--ifm-color-primary:#2eb6ff;--ifm-color-primary-dark:#10abff;--ifm-color-primary-darker:#01a6ff;--ifm-color-primary-darkest:#0089d3;--ifm-color-primary-light:#4cc1ff;--ifm-color-primary-lighter:#5bc6ff;--ifm-color-primary-lightest:#88d6ff;--docusaurus-highlighted-code-line-bg:rgba(0,0,0,.3)}.Resizer{background:padding-box #000;-moz-background-clip:padding;-webkit-background-clip:padding;opacity:.2;z-index:1000}.Resizer:hover{transition:2s}.Resizer.vertical{border-left:8px solid hsla(0,0%,100%,0);border-right:8px solid hsla(0,0%,100%,0);cursor:col-resize;margin:0 -8px;width:17px}.Resizer.vertical:hover{border-left:8px solid rgba(0,0,0,.5);border-right:8px solid rgba(0,0,0,.5)}.Resizer.disabled,.toggleButtonDisabled_Uw7m{cursor:not-allowed}.Resizer.disabled:hover{border-color:transparent}.pane{border:0;overflow-y:auto;top:0;width:100%}.pane.left{left:0}.pane.right{right:0}div.navbar__logo{margin-right:1.5rem}.header-github-link:hover{opacity:.6}.header-github-link:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;content:"";display:flex;height:24px;width:24px}[data-theme=dark] .header-github-link:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23fff' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat}[data-theme=light] .DocSearch{--docsearch-muted-color:var(--ifm-color-emphasis-700);--docsearch-container-background:rgba(94,100,112,.7);--docsearch-modal-background:var(--ifm-color-secondary-lighter);--docsearch-searchbox-background:var(--ifm-color-secondary);--docsearch-searchbox-focus-background:var(--ifm-color-white);--docsearch-hit-background:var(--ifm-color-white);--docsearch-footer-background:var(--ifm-color-white)}[data-theme=dark] .DocSearch{--docsearch-text-color:var(--ifm-font-color-base);--docsearch-muted-color:var(--ifm-color-secondary-darkest);--docsearch-container-background:rgba(47,55,69,.7);--docsearch-modal-background:var(--ifm-background-color);--docsearch-searchbox-background:var(--ifm-background-color);--docsearch-searchbox-focus-background:var(--ifm-color-black);--docsearch-hit-background:var(--ifm-color-emphasis-100);--docsearch-footer-background:var(--ifm-background-surface-color);--docsearch-key-gradient:linear-gradient(-26.5deg,var(--ifm-color-emphasis-200) 0%,var(--ifm-color-emphasis-100) 100%)}body:not(.navigation-with-keyboard) :not(input):focus{outline:0}#__docusaurus-base-url-issue-banner-container,.themedImage_BQGR,[data-theme=dark] .lightToggleIcon_lgto,[data-theme=light] .darkToggleIcon_U96C,html[data-announcement-bar-initially-dismissed=true] .announcementBar_zJRd{display:none}.skipToContent_oPtH{background-color:var(--ifm-background-surface-color);color:var(--ifm-color-emphasis-900);left:100%;padding:calc(var(--ifm-global-spacing)/2) var(--ifm-global-spacing);position:fixed;top:1rem;z-index:calc(var(--ifm-z-index-fixed) + 1)}.skipToContent_oPtH:focus{box-shadow:var(--ifm-global-shadow-md);left:1rem}.closeButton_J5rP{line-height:0;padding:0}.content_bSb_{font-size:85%;padding:5px 0;text-align:center}.content_bSb_ a{color:inherit;text-decoration:underline}.DocSearch-Container a,.tag_otG2:hover{text-decoration:none}.announcementBar_zJRd{align-items:center;background-color:var(--ifm-color-white);border-bottom:1px solid var(--ifm-color-emphasis-100);color:var(--ifm-color-black);display:flex;height:var(--docusaurus-announcement-bar-height)}.announcementBarPlaceholder_NpUd{flex:0 0 10px}.announcementBarClose_Jjdj{align-self:stretch;flex:0 0 30px}.toggle_ki11{height:2rem;width:2rem}.toggleButton_MMFG{align-items:center;border-radius:50%;display:flex;height:100%;justify-content:center;transition:background var(--ifm-transition-fast);width:100%}.toggleButton_MMFG:hover{background:var(--ifm-color-emphasis-200)}.darkNavbarColorModeToggle_m8pZ:hover{background:var(--ifm-color-gray-800)}[data-theme=dark] .themedImage--dark_bGx0,[data-theme=light] .themedImage--light_HAxW{display:initial}.iconExternalLink_nPrP{margin-left:.3rem}.iconLanguage_kvP7{margin-right:5px;vertical-align:text-bottom}.navbarHideable_hhpl{transition:transform var(--ifm-transition-fast) ease}.navbarHidden_nmcs{transform:translate3d(0,calc(-100% - 2px),0)}.errorBoundaryError_WE6Q{color:red;white-space:pre-wrap}.footerLogoLink_tutC{opacity:.5;transition:opacity var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.footerLogoLink_tutC:hover,.hash-link:focus,:hover>.hash-link{opacity:1}.mainWrapper_MB5r{display:flex;flex:1 0 auto;flex-direction:column}.docusaurus-mt-lg{margin-top:3rem}#__docusaurus{display:flex;flex-direction:column;min-height:100%}.iconEdit_bHB7{margin-right:.3em;vertical-align:sub}.tag_otG2{border:1px solid var(--docusaurus-tag-list-border);transition:border var(--ifm-transition-fast)}.tag_otG2:hover{--docusaurus-tag-list-border:var(--ifm-link-color)}.tagRegular_s0E1{border-radius:var(--ifm-global-radius);font-size:90%;padding:.2rem .5rem .3rem}.tagWithCount_PGyn{align-items:center;border-left:0;display:flex;padding:0 .5rem 0 1rem;position:relative}.tagWithCount_PGyn:after,.tagWithCount_PGyn:before{border:1px solid var(--docusaurus-tag-list-border);content:"";position:absolute;top:50%;transition:inherit}.tagWithCount_PGyn:before{border-bottom:0;border-right:0;height:1.18rem;right:100%;transform:translate(50%,-50%) rotate(-45deg);width:1.18rem}.tagWithCount_PGyn:after{border-radius:50%;height:.5rem;left:0;transform:translateY(-50%);width:.5rem}.tagWithCount_PGyn span{background:var(--ifm-color-secondary);border-radius:var(--ifm-global-radius);color:var(--ifm-color-black);font-size:.7rem;line-height:1.2;margin-left:.3rem;padding:.1rem .4rem}.tags_Ow0B{display:inline}.tag_DFxh{display:inline-block;margin:0 .4rem .5rem 0}.lastUpdated_pbO5{font-size:smaller;font-style:italic;margin-top:.2rem}.tocCollapsibleButton_iI2p{align-items:center;display:flex;font-size:inherit;justify-content:space-between;padding:.4rem .8rem;width:100%}.tocCollapsibleButton_iI2p:after{background:var(--ifm-menu-link-sublist-icon) 50% 50%/2rem 2rem no-repeat;content:"";filter:var(--ifm-menu-link-sublist-icon-filter);height:1.25rem;transform:rotate(180deg);transition:transform var(--ifm-transition-fast);width:1.25rem}.tocCollapsibleButtonExpanded_cHjC:after,.tocCollapsibleExpanded_BbRn{transform:none}.tocCollapsible_wXna{background-color:var(--ifm-menu-color-background-active);border-radius:var(--ifm-global-radius);margin:1rem 0}.buttonGroup_aaMX button,.codeBlockContainer_mQmQ{background:var(--prism-background-color);color:var(--prism-color)}.tocCollapsibleContent_vea0>ul{border-left:none;border-top:1px solid var(--ifm-color-emphasis-300);font-size:15px;padding:.2rem 0}.tocCollapsibleContent_vea0 ul li{margin:.4rem .8rem}.tocCollapsibleContent_vea0 a{display:block}.tableOfContents_XG6w{max-height:calc(100vh - var(--ifm-navbar-height) - 2rem);overflow-y:auto;position:sticky;top:calc(var(--ifm-navbar-height) + 1rem)}.anchorWithStickyNavbar_JmGV{scroll-margin-top:calc(var(--ifm-navbar-height) + .5rem)}.anchorWithHideOnScrollNavbar_pMLv{scroll-margin-top:.5rem}.hash-link{opacity:0;padding-left:.5rem;transition:opacity var(--ifm-transition-fast);user-select:none}.hash-link:before{content:"#"}.codeBlockContainer_mQmQ{border-radius:var(--ifm-code-border-radius);box-shadow:var(--ifm-global-shadow-lw);margin-bottom:var(--ifm-leading)}.codeBlockContent_D5yF{border-radius:inherit;direction:ltr;position:relative}.codeBlockTitle_x_ju{border-bottom:1px solid var(--ifm-color-emphasis-300);border-top-left-radius:inherit;border-top-right-radius:inherit;font-size:var(--ifm-code-font-size);font-weight:500;padding:.75rem var(--ifm-pre-padding)}.codeBlock_RMoD{--ifm-pre-background:var(--prism-background-color);margin:0;padding:0}.codeBlockTitle_x_ju+.codeBlockContent_D5yF .codeBlock_RMoD{border-top-left-radius:0;border-top-right-radius:0}.codeBlockLines_AclH{float:left;font:inherit;min-width:100%;padding:var(--ifm-pre-padding)}.codeBlockLinesWithNumbering_O625{display:table;padding:var(--ifm-pre-padding) 0}.buttonGroup_aaMX{column-gap:.2rem;display:flex;position:absolute;right:calc(var(--ifm-pre-padding)/2);top:calc(var(--ifm-pre-padding)/2)}.buttonGroup_aaMX button{align-items:center;border:1px solid var(--ifm-color-emphasis-300);border-radius:var(--ifm-global-radius);display:flex;line-height:0;opacity:0;padding:.4rem;transition:opacity var(--ifm-transition-fast) ease-in-out}.buttonGroup_aaMX button:focus-visible,.buttonGroup_aaMX button:hover{opacity:1!important}.theme-code-block:hover .buttonGroup_aaMX button{opacity:.4}:where(:root){--docusaurus-highlighted-code-line-bg:#484d5b}:where([data-theme=dark]){--docusaurus-highlighted-code-line-bg:#646464}.theme-code-block-highlighted-line{background-color:var(--docusaurus-highlighted-code-line-bg);display:block;margin:0 calc(var(--ifm-pre-padding)*-1);padding:0 var(--ifm-pre-padding)}.codeLine_FAqz{counter-increment:a;display:table-row}.codeLineNumber_BE9Z{background:var(--ifm-pre-background);display:table-cell;left:0;overflow-wrap:normal;padding:0 var(--ifm-pre-padding);position:sticky;text-align:right;width:1%}.codeLineNumber_BE9Z:before{content:counter(a);opacity:.4}.codeLineContent_EF2y{padding-right:var(--ifm-pre-padding)}.theme-code-block:hover .copyButtonCopied_TYdd{opacity:1!important}.copyButtonIcons_z5j7{height:1.125rem;position:relative;width:1.125rem}.copyButtonIcon_FoOz,.copyButtonSuccessIcon_L0B6{fill:currentColor;height:inherit;left:0;opacity:inherit;position:absolute;top:0;transition:all var(--ifm-transition-fast) ease;width:inherit}.copyButtonSuccessIcon_L0B6{color:#00d600;left:50%;opacity:0;top:50%;transform:translate(-50%,-50%) scale(.33)}.copyButtonCopied_TYdd .copyButtonIcon_FoOz{opacity:0;transform:scale(.33)}.copyButtonCopied_TYdd .copyButtonSuccessIcon_L0B6{opacity:1;transform:translate(-50%,-50%) scale(1);transition-delay:75ms}.wordWrapButtonIcon_HV9T{height:1.2rem;width:1.2rem}.details_IpIu{--docusaurus-details-summary-arrow-size:0.38rem;--docusaurus-details-transition:transform 200ms ease;--docusaurus-details-decoration-color:grey}.details_IpIu>summary{cursor:pointer;list-style:none;padding-left:1rem;position:relative}.details_IpIu>summary::-webkit-details-marker{display:none}.details_IpIu>summary:before{border-color:transparent transparent transparent var(--docusaurus-details-decoration-color);border-style:solid;border-width:var(--docusaurus-details-summary-arrow-size);content:"";left:0;position:absolute;top:.45rem;transform:rotate(0);transform-origin:calc(var(--docusaurus-details-summary-arrow-size)/2) 50%;transition:var(--docusaurus-details-transition)}.collapsibleContent_Fd2D{border-top:1px solid var(--docusaurus-details-decoration-color);margin-top:1rem;padding-top:1rem}.details_jERq{--docusaurus-details-decoration-color:var(--ifm-alert-border-color);--docusaurus-details-transition:transform var(--ifm-transition-fast) ease;border:1px solid var(--ifm-alert-border-color);margin:0 0 var(--ifm-spacing-vertical)}.containsTaskList_QWGu{list-style:none}.img_SS3x{height:auto}.admonition_uH4V{margin-bottom:1em}.admonitionHeading_P5_N{font:var(--ifm-heading-font-weight) var(--ifm-h5-font-size)/var(--ifm-heading-line-height) var(--ifm-heading-font-family);margin-bottom:.3rem}.admonitionHeading_P5_N code{text-transform:none}.admonitionIcon_MF44{display:inline-block;margin-right:.4em;vertical-align:middle}.admonitionIcon_MF44 svg{fill:var(--ifm-alert-foreground-color);display:inline-block;height:1.6em;width:1.6em}.breadcrumbHomeIcon_sfvy{height:1.1rem;position:relative;top:1px;vertical-align:top;width:1.1rem}.breadcrumbsContainer_T5ub{--ifm-breadcrumb-size-multiplier:0.8;margin-bottom:.8rem}.searchQueryInput_RVvj,.searchVersionInput_QmSs{background:var(--docsearch-searchbox-focus-background);border:2px solid var(--ifm-toc-border-color);border-radius:var(--ifm-global-radius);color:var(--docsearch-text-color);font:var(--ifm-font-size-base) var(--ifm-font-family-base);margin-bottom:.5rem;padding:.8rem;transition:border var(--ifm-transition-fast) ease;width:100%}.searchQueryInput_RVvj:focus,.searchVersionInput_QmSs:focus{border-color:var(--docsearch-primary-color);outline:0}.searchQueryInput_RVvj::placeholder{color:var(--docsearch-muted-color)}.searchResultsColumn_Vh0c{font-size:.9rem;font-weight:700}.algoliaLogo_yiAH{max-width:150px}.algoliaLogoPathFill_tzCx{fill:var(--ifm-font-color-base)}.searchResultItem_q31K{border-bottom:1px solid var(--ifm-toc-border-color);padding:1rem 0}.searchResultItemHeading_Iq68{font-weight:400;margin-bottom:0}.searchResultItemPath_pr04{--ifm-breadcrumb-separator-size-multiplier:1;color:var(--ifm-color-content-secondary);font-size:.8rem}.searchResultItemSummary_fqhL{font-style:italic;margin:.5rem 0 0}.loadingSpinner_hU64{animation:1s linear infinite a;border:.4em solid #eee;border-radius:50%;border-top:.4em solid var(--ifm-color-primary);height:3rem;margin:0 auto;width:3rem}@keyframes a{to{transform:rotate(1turn)}}.loader_DZsO{margin-top:2rem}.search-result-match{background:rgba(255,215,142,.25);color:var(--docsearch-hit-color);padding:.09em 0}.backToTopButton_iEvu{background-color:var(--ifm-color-emphasis-200);border-radius:50%;bottom:1.3rem;box-shadow:var(--ifm-global-shadow-lw);height:3rem;opacity:0;position:fixed;right:1.3rem;transform:scale(0);transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default);visibility:hidden;width:3rem;z-index:calc(var(--ifm-z-index-fixed) - 1)}.backToTopButton_iEvu:after{background-color:var(--ifm-color-emphasis-1000);content:" ";display:inline-block;height:100%;-webkit-mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;mask:var(--ifm-menu-link-sublist-icon) 50%/2rem 2rem no-repeat;width:100%}.backToTopButtonShow_DO8w{opacity:1;transform:scale(1);visibility:visible}[data-theme=dark]:root{--docusaurus-collapse-button-bg:hsla(0,0%,100%,.05);--docusaurus-collapse-button-bg-hover:hsla(0,0%,100%,.1)}.collapseSidebarButton_oTwn{display:none;margin:0}.docSidebarContainer_y0RQ,.sidebarLogo_CYvI{display:none}.docMainContainer_sTIZ,.docPage_KLoz{display:flex;width:100%}.docPage_KLoz{flex:1 0}.docsWrapper_ct1J{display:flex;flex:1 0 auto}.buttons_AeoN,.features_t9lD{align-items:center;display:flex}.features_t9lD{padding:8rem 0;width:100%}.featureSvg_GfXr{height:200px;width:200px}.heroBanner_qdFl{overflow:hidden;padding:4rem 0;position:relative;text-align:center}.buttons_AeoN{justify-content:center}.DocSearch-Button,.DocSearch-Button-Container{align-items:center;display:flex}.device__photo_XeRs{border-radius:0;height:unset}.DocSearch-Button{background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;font-weight:500;height:36px;justify-content:space-between;padding:0 8px;-webkit-user-select:none;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:0}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Hit-Tree,.DocSearch-Hit-action,.DocSearch-Hit-icon,.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Input,.DocSearch-Link{-webkit-appearance:none;font:inherit}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 2px;position:relative;top:-1px;width:20px}.DocSearch--active{overflow:hidden!important}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{appearance:none;background:0 0;border:0;color:var(--docsearch-text-color);flex:1;font-size:1.2em;height:100%;outline:0;padding:0 0 0 8px;width:80%}.DocSearch-Hit-action-button,.DocSearch-Reset{-webkit-appearance:none;border:0;cursor:pointer}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{margin:0;padding:0}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Cancel,.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator,.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset{animation:.1s ease-in forwards b;appearance:none;background:none;border-radius:50%;color:var(--docsearch-icon-color);padding:2px;right:0}.DocSearch-Help,.DocSearch-HitsFooter,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:0 0}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help{font-size:.9em;margin:0;-webkit-user-select:none;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}.DocSearch-Hit--deleting{opacity:0;transition:.25s linear}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:.25s linear .25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit[aria-selected=true] mark{text-decoration:underline}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border-radius:50%;color:inherit;padding:2px}svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:rgba(0,0,0,.2);transition:background-color .1s ease-in}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:0;text-decoration:underline}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;-webkit-user-select:none;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border:0;border-radius:2px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;width:20px}@keyframes b{0%{opacity:0}to{opacity:1}}.DocSearch-Button{margin:0;transition:all var(--ifm-transition-fast) var(--ifm-transition-timing-default)}.DocSearch-Container{z-index:calc(var(--ifm-z-index-fixed) + 1)}@media (min-width:997px){.collapseSidebarButton_oTwn,.expandButton_YOoA{background-color:var(--docusaurus-collapse-button-bg)}:root{--docusaurus-announcement-bar-height:30px}.announcementBarClose_Jjdj,.announcementBarPlaceholder_NpUd{flex-basis:50px}.searchBox_WqAV{padding:var(--ifm-navbar-item-padding-vertical) var(--ifm-navbar-item-padding-horizontal)}.lastUpdated_pbO5{text-align:right}.tocMobile_Ojys{display:none}.docItemCol_Qr34{max-width:75%!important}.collapseSidebarButton_oTwn{border:1px solid var(--ifm-toc-border-color);border-radius:0;bottom:0;display:block!important;height:40px;position:sticky}.collapseSidebarButtonIcon_pMEX{margin-top:4px;transform:rotate(180deg)}.expandButtonIcon_GZLG,[dir=rtl] .collapseSidebarButtonIcon_pMEX{transform:rotate(0)}.collapseSidebarButton_oTwn:focus,.collapseSidebarButton_oTwn:hover,.expandButton_YOoA:focus,.expandButton_YOoA:hover{background-color:var(--docusaurus-collapse-button-bg-hover)}.menuHtmlItem_OniL{padding:var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal)}.menu_jmj1{flex-grow:1;padding:.5rem}@supports (scrollbar-gutter:stable){.menu_jmj1{padding:.5rem 0 .5rem .5rem;scrollbar-gutter:stable}}.menuWithAnnouncementBar_YufC{margin-bottom:var(--docusaurus-announcement-bar-height)}.sidebar_CUen{display:flex;flex-direction:column;height:100%;padding-top:var(--ifm-navbar-height);width:var(--doc-sidebar-width)}.sidebarWithHideableNavbar_w4KB{padding-top:0}.sidebarHidden_k6VE{opacity:0;visibility:hidden}.sidebarLogo_CYvI{align-items:center;color:inherit!important;display:flex!important;margin:0 var(--ifm-navbar-padding-horizontal);max-height:var(--ifm-navbar-height);min-height:var(--ifm-navbar-height);text-decoration:none!important}.sidebarLogo_CYvI img{height:2rem;margin-right:.5rem}.expandButton_YOoA{align-items:center;display:flex;height:100%;justify-content:center;position:absolute;right:0;top:0;transition:background-color var(--ifm-transition-fast) ease;width:100%}[dir=rtl] .expandButtonIcon_GZLG{transform:rotate(180deg)}.docSidebarContainer_y0RQ{border-right:1px solid var(--ifm-toc-border-color);-webkit-clip-path:inset(0);clip-path:inset(0);display:block;margin-top:calc(var(--ifm-navbar-height)*-1);transition:width var(--ifm-transition-fast) ease;width:var(--doc-sidebar-width);will-change:width}.docSidebarContainerHidden_uArb{cursor:pointer;width:var(--doc-sidebar-hidden-width)}.sidebarViewport_EJ1r{height:100%;max-height:100vh;position:sticky;top:0}.docMainContainer_sTIZ{flex-grow:1;max-width:calc(100% - var(--doc-sidebar-width))}.docMainContainerEnhanced_iSjt{max-width:calc(100% - var(--doc-sidebar-hidden-width))}.docItemWrapperEnhanced_PxMR{max-width:calc(var(--ifm-container-width) + var(--doc-sidebar-width))!important}}@media (min-width:1440px){.container{max-width:var(--ifm-container-width-xl)}}@media (max-width:996px){.col{--ifm-col-width:100%;flex-basis:var(--ifm-col-width);margin-left:0}.footer{--ifm-footer-padding-horizontal:0}.colorModeToggle_Hewu,.footer__link-separator,.navbar__item,.tableOfContents_XG6w{display:none}.footer__col{margin-bottom:calc(var(--ifm-spacing-vertical)*3)}.footer__link-item{display:block}.hero{padding-left:0;padding-right:0}.navbar>.container,.navbar>.container-fluid{padding:0}.navbar__toggle{display:inherit}.navbar__search-input{width:9rem}.pills--block,.tabs--block{flex-direction:column}.searchBox_WqAV{position:absolute;right:var(--ifm-navbar-padding-horizontal)}.docItemContainer_Tr6w{padding:0 .3rem}}@media only screen and (max-width:996px){.searchQueryColumn_YWTO,.searchResultsColumn_Vh0c{max-width:60%!important}.searchLogoColumn_ugtA,.searchVersionColumn_pdNL{max-width:40%!important}.searchLogoColumn_ugtA{padding-left:0!important}}@media screen and (max-width:996px){.heroBanner_qdFl{padding:2rem}}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder,.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%;max-height:calc(var(--docsearch-vh,1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh,1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Cancel{-webkit-appearance:none;appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:0;overflow:hidden;padding:0;-webkit-user-select:none;user-select:none;white-space:nowrap}}@media (max-width:576px){.markdown h1:first-child{--ifm-h1-font-size:2rem}.markdown>h2{--ifm-h2-font-size:1.5rem}.markdown>h3{--ifm-h3-font-size:1.25rem}}@media screen and (max-width:576px){.searchQueryColumn_YWTO{max-width:100%!important}.searchVersionColumn_pdNL{max-width:100%!important;padding-left:var(--ifm-spacing-horizontal)!important}}@media (hover:hover){.backToTopButton_iEvu:hover{background-color:var(--ifm-color-emphasis-300)}}@media (pointer:fine){.thin-scrollbar{scrollbar-width:thin}.thin-scrollbar::-webkit-scrollbar{height:var(--ifm-scrollbar-size);width:var(--ifm-scrollbar-size)}.thin-scrollbar::-webkit-scrollbar-track{background:var(--ifm-scrollbar-track-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb{background:var(--ifm-scrollbar-thumb-background-color);border-radius:10px}.thin-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--ifm-scrollbar-thumb-hover-background-color)}}@media (prefers-reduced-motion:reduce){:root{--ifm-transition-fast:0ms;--ifm-transition-slow:0ms}}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{stroke-width:var(--docsearch-icon-stroke-width);animation:none;-webkit-appearance:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0}.DocSearch-Hit--deleting,.DocSearch-Hit--favoriting{transition:none}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:rgba(0,0,0,.2);transition:none}}@media print{.announcementBar_zJRd,.footer,.menu,.navbar,.pagination-nav,.table-of-contents,.tocMobile_Ojys{display:none}.tabs{page-break-inside:avoid}.codeBlockLines_AclH{white-space:pre-wrap}} \ No newline at end of file diff --git a/assets/images/adafruitio-158caa745d4965548591ec514d363ef2.png b/assets/images/adafruitio-158caa745d4965548591ec514d363ef2.png new file mode 100644 index 00000000000..ae13bfced88 Binary files /dev/null and b/assets/images/adafruitio-158caa745d4965548591ec514d363ef2.png differ diff --git a/assets/images/autostart-e89b961cc32b221668cbd3cd9a25024d.png b/assets/images/autostart-e89b961cc32b221668cbd3cd9a25024d.png new file mode 100644 index 00000000000..62a84a2b713 Binary files /dev/null and b/assets/images/autostart-e89b961cc32b221668cbd3cd9a25024d.png differ diff --git a/assets/images/connect-button-0bd8798d45dcd18bfee97226549aad59.png b/assets/images/connect-button-0bd8798d45dcd18bfee97226549aad59.png new file mode 100644 index 00000000000..3e483b93a9b Binary files /dev/null and b/assets/images/connect-button-0bd8798d45dcd18bfee97226549aad59.png differ diff --git a/assets/images/consoledata-82fce9648a2c3463633acc673722b334.png b/assets/images/consoledata-82fce9648a2c3463633acc673722b334.png new file mode 100644 index 00000000000..fa243b0570a Binary files /dev/null and b/assets/images/consoledata-82fce9648a2c3463633acc673722b334.png differ diff --git a/assets/images/device-explorer-83bf8c4f6148ed75c174e95e1c57357b.png b/assets/images/device-explorer-83bf8c4f6148ed75c174e95e1c57357b.png new file mode 100644 index 00000000000..4d04030df35 Binary files /dev/null and b/assets/images/device-explorer-83bf8c4f6148ed75c174e95e1c57357b.png differ diff --git a/assets/images/editor-actions-a360b203d149616e420a59a3c8e6b44d.png b/assets/images/editor-actions-a360b203d149616e420a59a3c8e6b44d.png new file mode 100644 index 00000000000..df036a9c31e Binary files /dev/null and b/assets/images/editor-actions-a360b203d149616e420a59a3c8e6b44d.png differ diff --git a/assets/images/empty-view-0f03949a953ec9208558ab31992e000c.png b/assets/images/empty-view-0f03949a953ec9208558ab31992e000c.png new file mode 100644 index 00000000000..aa2eb895327 Binary files /dev/null and b/assets/images/empty-view-0f03949a953ec9208558ab31992e000c.png differ diff --git a/assets/images/hero-6841bcefb7272a3b78c2650090ff2181.png b/assets/images/hero-6841bcefb7272a3b78c2650090ff2181.png new file mode 100644 index 00000000000..0e9139d1a84 Binary files /dev/null and b/assets/images/hero-6841bcefb7272a3b78c2650090ff2181.png differ diff --git a/assets/images/image-1-30ce3afd44cffb315611a2948f1def98.png b/assets/images/image-1-30ce3afd44cffb315611a2948f1def98.png new file mode 100644 index 00000000000..2305f1970ff Binary files /dev/null and b/assets/images/image-1-30ce3afd44cffb315611a2948f1def98.png differ diff --git a/assets/images/image-2-1bdce9082d3ea7914efcb76d24c26e8b.png b/assets/images/image-2-1bdce9082d3ea7914efcb76d24c26e8b.png new file mode 100644 index 00000000000..fdca6275ab3 Binary files /dev/null and b/assets/images/image-2-1bdce9082d3ea7914efcb76d24c26e8b.png differ diff --git a/assets/images/image-3-7a0c8f8d9db092c71b636da2a349592b.png b/assets/images/image-3-7a0c8f8d9db092c71b636da2a349592b.png new file mode 100644 index 00000000000..46c186b2108 Binary files /dev/null and b/assets/images/image-3-7a0c8f8d9db092c71b636da2a349592b.png differ diff --git a/assets/images/image-4-1bdce9082d3ea7914efcb76d24c26e8b.png b/assets/images/image-4-1bdce9082d3ea7914efcb76d24c26e8b.png new file mode 100644 index 00000000000..fdca6275ab3 Binary files /dev/null and b/assets/images/image-4-1bdce9082d3ea7914efcb76d24c26e8b.png differ diff --git a/assets/images/image-5-82968f5529c50cd50b7a49d41b227d50.png b/assets/images/image-5-82968f5529c50cd50b7a49d41b227d50.png new file mode 100644 index 00000000000..f04ad986302 Binary files /dev/null and b/assets/images/image-5-82968f5529c50cd50b7a49d41b227d50.png differ diff --git a/assets/images/image-6-f8cd21cfbb4b74d7f156e2a683177492.png b/assets/images/image-6-f8cd21cfbb4b74d7f156e2a683177492.png new file mode 100644 index 00000000000..88f924431e9 Binary files /dev/null and b/assets/images/image-6-f8cd21cfbb4b74d7f156e2a683177492.png differ diff --git a/assets/images/image-7-d0ba0fcacc05e161bce54def0bab7436.png b/assets/images/image-7-d0ba0fcacc05e161bce54def0bab7436.png new file mode 100644 index 00000000000..cd901c799b0 Binary files /dev/null and b/assets/images/image-7-d0ba0fcacc05e161bce54def0bab7436.png differ diff --git a/assets/images/image-8-ea42f66d02c3a45e4d7953c7e24ad61c.png b/assets/images/image-8-ea42f66d02c3a45e4d7953c7e24ad61c.png new file mode 100644 index 00000000000..11a978f7353 Binary files /dev/null and b/assets/images/image-8-ea42f66d02c3a45e4d7953c7e24ad61c.png differ diff --git a/assets/images/jsx-bb7adf23a927bba0724325c97df19da2.png b/assets/images/jsx-bb7adf23a927bba0724325c97df19da2.png new file mode 100644 index 00000000000..39a4e52b6a3 Binary files /dev/null and b/assets/images/jsx-bb7adf23a927bba0724325c97df19da2.png differ diff --git a/assets/images/pico-bricks-9426bc01d401be67e5c8c356abb07848.jpg b/assets/images/pico-bricks-9426bc01d401be67e5c8c356abb07848.jpg new file mode 100644 index 00000000000..c0ae1975308 Binary files /dev/null and b/assets/images/pico-bricks-9426bc01d401be67e5c8c356abb07848.jpg differ diff --git a/assets/images/pimoroni-pico-badger-bc230e17191d6b4a8df0b57ae03d77c9.jpg b/assets/images/pimoroni-pico-badger-bc230e17191d6b4a8df0b57ae03d77c9.jpg new file mode 100644 index 00000000000..5e70bd35add Binary files /dev/null and b/assets/images/pimoroni-pico-badger-bc230e17191d6b4a8df0b57ae03d77c9.jpg differ diff --git a/assets/images/play-cd1822c16b71cd6b6678dcaf2821eda2.png b/assets/images/play-cd1822c16b71cd6b6678dcaf2821eda2.png new file mode 100644 index 00000000000..4f1b9d1e6ea Binary files /dev/null and b/assets/images/play-cd1822c16b71cd6b6678dcaf2821eda2.png differ diff --git a/assets/images/remote-83da64afb296fdfc2a4bc1a415ec21f3.png b/assets/images/remote-83da64afb296fdfc2a4bc1a415ec21f3.png new file mode 100644 index 00000000000..923493192d9 Binary files /dev/null and b/assets/images/remote-83da64afb296fdfc2a4bc1a415ec21f3.png differ diff --git a/assets/images/simulator-example-9f6880c7516de8e05171bad268ed85f4.png b/assets/images/simulator-example-9f6880c7516de8e05171bad268ed85f4.png new file mode 100644 index 00000000000..4a13976c7c6 Binary files /dev/null and b/assets/images/simulator-example-9f6880c7516de8e05171bad268ed85f4.png differ diff --git a/assets/images/simulator-ff4f3f7cd39d9aa7e683dfa47f6aa724.png b/assets/images/simulator-ff4f3f7cd39d9aa7e683dfa47f6aa724.png new file mode 100644 index 00000000000..a3721704c27 Binary files /dev/null and b/assets/images/simulator-ff4f3f7cd39d9aa7e683dfa47f6aa724.png differ diff --git a/assets/images/simulator-tree-5c38631c760a21ce4214ecd94b51a123.png b/assets/images/simulator-tree-5c38631c760a21ce4214ecd94b51a123.png new file mode 100644 index 00000000000..22269a19a87 Binary files /dev/null and b/assets/images/simulator-tree-5c38631c760a21ce4214ecd94b51a123.png differ diff --git a/assets/images/simulators-2104f8902e1a20aa2a3e224ab86e7770.png b/assets/images/simulators-2104f8902e1a20aa2a3e224ab86e7770.png new file mode 100644 index 00000000000..57fd28d2686 Binary files /dev/null and b/assets/images/simulators-2104f8902e1a20aa2a3e224ab86e7770.png differ diff --git a/assets/images/ssd1306-37a92c83c596d3a6493ef8358ad94ed5.png b/assets/images/ssd1306-37a92c83c596d3a6493ef8358ad94ed5.png new file mode 100644 index 00000000000..189bbc7956a Binary files /dev/null and b/assets/images/ssd1306-37a92c83c596d3a6493ef8358ad94ed5.png differ diff --git a/assets/images/start-simulator-dashboard-a83a4c119a01656342c3f934001bba98.png b/assets/images/start-simulator-dashboard-a83a4c119a01656342c3f934001bba98.png new file mode 100644 index 00000000000..c6dadd1f999 Binary files /dev/null and b/assets/images/start-simulator-dashboard-a83a4c119a01656342c3f934001bba98.png differ diff --git a/assets/images/status-bar-77b4a19758810163da794665162f4a29.png b/assets/images/status-bar-77b4a19758810163da794665162f4a29.png new file mode 100644 index 00000000000..23a8bffd3bc Binary files /dev/null and b/assets/images/status-bar-77b4a19758810163da794665162f4a29.png differ diff --git a/assets/images/temperature-mqtt-66b380e4e9c8659f93f2571bc8672633.jpg b/assets/images/temperature-mqtt-66b380e4e9c8659f93f2571bc8672633.jpg new file mode 100644 index 00000000000..fe8c25214d6 Binary files /dev/null and b/assets/images/temperature-mqtt-66b380e4e9c8659f93f2571bc8672633.jpg differ diff --git a/assets/images/waveshare-pico-lcd-114-6b2f09270d3b6ef99a8c1d095a807a44.png b/assets/images/waveshare-pico-lcd-114-6b2f09270d3b6ef99a8c1d095a807a44.png new file mode 100644 index 00000000000..662a6155f67 Binary files /dev/null and b/assets/images/waveshare-pico-lcd-114-6b2f09270d3b6ef99a8c1d095a807a44.png differ diff --git a/assets/images/xiao-expansion-board-bbb3d8fc7f164a7cd68228e074554200.jpg b/assets/images/xiao-expansion-board-bbb3d8fc7f164a7cd68228e074554200.jpg new file mode 100644 index 00000000000..64dd9dac807 Binary files /dev/null and b/assets/images/xiao-expansion-board-bbb3d8fc7f164a7cd68228e074554200.jpg differ diff --git a/assets/js/008bb2ac.09d9d62f.js b/assets/js/008bb2ac.09d9d62f.js new file mode 100644 index 00000000000..d555338c46b --- /dev/null +++ b/assets/js/008bb2ac.09d9d62f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8065],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,a(a({ref:t},s),{},{components:n})):r.createElement(f,a({ref:t},s))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:i,a[1]=c;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const o={},a="MQTT client",c={unversionedId:"developer/net/mqtt",id:"developer/net/mqtt",title:"MQTT client",description:"The startMQTTClient function connects to a MQTT broker using TCP or TLS.",source:"@site/docs/developer/net/mqtt.mdx",sourceDirName:"developer/net",slug:"/developer/net/mqtt",permalink:"/devicescript/developer/net/mqtt",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Encrypted Fetch",permalink:"/devicescript/developer/net/encrypted-fetch"},next:{title:"Packages",permalink:"/devicescript/developer/packages/"}},l={},p=[{value:"publish",id:"publish",level:2},{value:"deviceIdentifier",id:"deviceidentifier",level:3},{value:"subscribe",id:"subscribe",level:2},{value:"stop",id:"stop",level:2},{value:"Acknowledgements",id:"acknowledgements",level:2}],s={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"mqtt-client"},"MQTT client"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startMQTTClient")," function connects to a MQTT broker using TCP or TLS."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { startMQTTClient } from "@devicescript/net"\n\nconst mqtt = await startMQTTClient({\n host: "broker.hivemq.com",\n proto: "tcp",\n port: 1883,\n})\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"You can use ",(0,i.kt)("a",{parentName:"p",href:"https://www.hivemq.com/public-mqtt-broker/"},"HiveMQ public broker")," for testing\nwith public data.")),(0,i.kt)("h2",{id:"publish"},"publish"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"publish")," function sends a message on a topic."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { startMQTTClient } from "@devicescript/net"\n\nconst mqtt = await startMQTTClient({\n host: "broker.hivemq.com",\n proto: "tcp",\n port: 1883,\n})\n// highlight-next-line\nawait mqtt.publish("devs/log", "hello")\n')),(0,i.kt)("h3",{id:"deviceidentifier"},"deviceIdentifier"),(0,i.kt)("p",null,"You can use ",(0,i.kt)("inlineCode",{parentName:"p"},"deviceIdentifier")," to uniquely identify the device\nin the topic"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { deviceIdentifier } from "@devicescript/core"\nimport { startMQTTClient } from "@devicescript/net"\n\nconst mqtt = await startMQTTClient({\n host: "broker.hivemq.com",\n proto: "tcp",\n port: 1883,\n})\n// highlight-next-line\nconst id = deviceIdentifier("self")\nawait mqtt.publish(`devs/log/${id}`, "hello")\n')),(0,i.kt)("h2",{id:"subscribe"},"subscribe"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"subscribe")," function creates a subscription for a topic route.\nThe function takes a an optional handler an returns an ",(0,i.kt)("a",{parentName:"p",href:"/developer/observables"},"observable"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { startMQTTClient } from "@devicescript/net"\nconst mqtt = await startMQTTClient({\n host: "broker.hivemq.com",\n proto: "tcp",\n port: 1883,\n})\n\n// highlight-next-line\nawait mqtt.subscribe(`devs/log/#`, msg => {\n console.log(msg.content.toString("utf-8"))\n})\n')),(0,i.kt)("h2",{id:"stop"},"stop"),(0,i.kt)("p",null,"The MQTT client will automatically retry to connect once it detects that connectivity is lost.\nTo close the current socket and stop the reconnect task, use ",(0,i.kt)("inlineCode",{parentName:"p"},"stop"),"."),(0,i.kt)("h2",{id:"acknowledgements"},"Acknowledgements"),(0,i.kt)("p",null,"The MQTT client is based on ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/rovale/micro-mqtt"},"micro-mqtt"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/010eedb1.16e7eb3c.js b/assets/js/010eedb1.16e7eb3c.js new file mode 100644 index 00000000000..4e8d00d0033 --- /dev/null +++ b/assets/js/010eedb1.16e7eb3c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3775],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||i;return r?n.createElement(g,s(s({ref:t},p),{},{components:r})):n.createElement(g,s({ref:t},p))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,s=new Array(i);s[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[u]="string"==typeof e?e:a,s[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var n=r(25773),a=(r(27378),r(35318));const i={sidebar_position:1},s="Registers",o={unversionedId:"api/core/registers",id:"api/core/registers",title:"Registers",description:"The register client classe (Register) allow to read, write and track changes of service registers.",source:"@site/docs/api/core/registers.md",sourceDirName:"api/core",slug:"/api/core/registers",permalink:"/devicescript/api/core/registers",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Roles",permalink:"/devicescript/api/core/roles"},next:{title:"Events",permalink:"/devicescript/api/core/events"}},l={},c=[{value:"read",id:"read",level:2},{value:"write",id:"write",level:2},{value:"subscribe",id:"subscribe",level:2}],p={toc:c},u="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"registers"},"Registers"),(0,a.kt)("p",null,"The register client classe (",(0,a.kt)("inlineCode",{parentName:"p"},"Register"),") allow to read, write and track changes of ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/reference/protocol/#registers"},"service registers"),"."),(0,a.kt)("p",null,"Aside from the data type, there are 3 different type of access control on registers:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"read only"),": the value can be read, but not written."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"read write"),": the value can be read and writen."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"const"),": the value of the register is constant. It may change on the next reset but this is not a common scenario.")),(0,a.kt)("h2",{id:"read"},"read"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," method gets the current reported value stored in the register."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const sensor = new ds.Temperature()\nsetInterval(async () => {\n const t = await sensor.reading.read()\n console.log(t)\n}, 1000)\n")),(0,a.kt)("h2",{id:"write"},"write"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"write")," method sets the current value of the register and only applies to ",(0,a.kt)("inlineCode",{parentName:"p"},"read-write")," registers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const led = new ds.Led()\n\nawait led.intensity.write(0.5)\n")),(0,a.kt)("h2",{id:"subscribe"},"subscribe"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"subscribe")," method registers a callback that gets raised whenever a value update arrives."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const sensor = new ds.Temperature()\nsensor.reading.subscribe(value => {\n console.log(value)\n})\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"subscribe")," method returns an ",(0,a.kt)("strong",{parentName:"p"},"unsubscribe")," function that allows to remove the callback."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const sensor = new ds.Temperature()\nconst unsubscribe = sensor.reading.subscribe(value => {\n console.log(value)\n})\n\n// later on\nunsubscribe()\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/019132d2.53db818a.js b/assets/js/019132d2.53db818a.js new file mode 100644 index 00000000000..ea61c7d5577 --- /dev/null +++ b/assets/js/019132d2.53db818a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1169],{83769:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-docs","id":"default"}')}}]); \ No newline at end of file diff --git a/assets/js/01d62032.1b7c13fe.js b/assets/js/01d62032.1b7c13fe.js new file mode 100644 index 00000000000..b619d6049f1 --- /dev/null +++ b/assets/js/01d62032.1b7c13fe.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[229],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>v});var i=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=i.createContext({}),p=function(e){var t=i.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),m=n,v=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return r?i.createElement(v,o(o({ref:t},c),{},{components:r})):i.createElement(v,o({ref:t},c))}));function v(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,o=new Array(a);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:n,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var i=r(25773),n=(r(27378),r(35318));const a={title:"Drivers",sidebar_position:2.5},o="Drivers",s={unversionedId:"developer/drivers/index",id:"developer/drivers/index",title:"Drivers",description:"In DeviceScript, any hardware component is accessed through a service client.",source:"@site/docs/developer/drivers/index.mdx",sourceDirName:"developer/drivers",slug:"/developer/drivers/",permalink:"/devicescript/developer/drivers/",draft:!1,tags:[],version:"current",sidebarPosition:2.5,frontMatter:{title:"Drivers",sidebar_position:2.5},sidebar:"tutorialSidebar",previous:{title:"Commands",permalink:"/devicescript/developer/commands"},next:{title:"Digital IO (GPIO)",permalink:"/devicescript/developer/drivers/digital-io/"}},l={},p=[{value:"Analog (builtin)",id:"analog-builtin",level:2},{value:"Digital IO",id:"digital-io",level:2},{value:"I2C",id:"i2c",level:2},{value:"SPI",id:"spi",level:2},{value:"What about missing drivers?",id:"what-about-missing-drivers",level:2},{value:"Jacdac modules",id:"jacdac-modules",level:2},{value:"Serial, PWM",id:"serial-pwm",level:2}],c={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,n.kt)(u,(0,i.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"drivers"},"Drivers"),(0,n.kt)("p",null,"In DeviceScript, any hardware component is accessed through a service ",(0,n.kt)("strong",{parentName:"p"},"client"),".\nA ",(0,n.kt)("strong",{parentName:"p"},"driver")," implement one or more service ",(0,n.kt)("strong",{parentName:"p"},"servers")," for a given hardware peripherical."),(0,n.kt)("p",null,"The ",(0,n.kt)("a",{parentName:"p",href:"/developer/packages"},"drivers builtin package")," exposes drivers for a number of periphericals."),(0,n.kt)("h2",{id:"analog-builtin"},(0,n.kt)("a",{parentName:"h2",href:"/developer/drivers/analog"},"Analog")," (builtin)"),(0,n.kt)("p",null,"DeviceScript provides helper functions to mount a variety of servers out of the box\nin the ",(0,n.kt)("inlineCode",{parentName:"p"},"@devicescript/servers")," module."),(0,n.kt)("p",null,"For example, the ",(0,n.kt)("a",{parentName:"p",href:"/api/drivers/button"},"startButton")," function allows your script\nto mount a ",(0,n.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/button"},"button server"),"\nover a pin and returns the ",(0,n.kt)("a",{parentName:"p",href:"/api/clients/button"},"client")," for it."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"no-run","no-run":!0},'import { gpio } from "@devicescript/core"\nimport { startButton } from "@devicescript/servers"\n\nconst buttonA = startButton({\n pin: gpio(2),\n})\nbuttonA.up.subscribe(() => {\n console.log("up!")\n})\n')),(0,n.kt)("p",null,"Once you've added this code to your script, you can interact with pin ",(0,n.kt)("inlineCode",{parentName:"p"},"2"),"\n(hardware specific identifier) through the ",(0,n.kt)("inlineCode",{parentName:"p"},"buttonA")," client. The variable name is\nautomatically used as the ",(0,n.kt)("strong",{parentName:"p"},"role")," and ",(0,n.kt)("strong",{parentName:"p"},"instance")," name."),(0,n.kt)("h2",{id:"digital-io"},(0,n.kt)("a",{parentName:"h2",href:"/developer/drivers/digital-io"},"Digital IO")),(0,n.kt)("p",null,"Drivers can be implemented using digital IO\nand are either built-in from C or authored in DeviceScript directly."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio, GPIOMode } from "@devicescript/core"\nimport "@devicescript/gpio"\n\nconst p0 = gpio(0)\nawait p0.setMode(GPIOMode.Output)\nawait p0.write(true)\n')),(0,n.kt)("h2",{id:"i2c"},(0,n.kt)("a",{parentName:"h2",href:"/developer/drivers/i2c"},"I2C")),(0,n.kt)("p",null,"Drivers can be implemented using I2C\nand are either built-in from C or authored in DeviceScript directly."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { i2c } from "@devicescript/i2c"\n\n...\nawait i2c.writeReg(address, register, value)\n')),(0,n.kt)("h2",{id:"spi"},(0,n.kt)("a",{parentName:"h2",href:"/developer/drivers/spi"},"SPI")),(0,n.kt)("p",null,"Drivers can be implemented using SPI\nand are either built-in from C or authored in DeviceScript directly."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { spi } from "@devicescript/spi"\n\n...\nawait spi.write(hex`abcd`)\n')),(0,n.kt)("h2",{id:"what-about-missing-drivers"},"What about missing drivers?"),(0,n.kt)("p",null,"So the driver you need isn't here? There are a few options:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.npmjs.com/search?q=devicescript"},"Search on npm")," where a community member may have already published a driver."),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/labels/driver%20request"},"Check if a request is already open")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.md&title="},"Create a Driver Request")," to request a new driver. We can't guarantee that we'll have time to implement it, but we maybe someone in the community will!")),(0,n.kt)("h2",{id:"jacdac-modules"},"Jacdac modules"),(0,n.kt)("p",null,"If you connect a ",(0,n.kt)("a",{parentName:"p",href:"https://aka.ms/jacdac"},"Jacdac module"),", it will automatically run as a service server and\nyou will be able to bind a role to that module."),(0,n.kt)("p",null,"For example, the KittenBot KeyCap button will surface as a ",(0,n.kt)("strong",{parentName:"p"},"button server")," when connected."),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/devices/kittenbot/keycapbuttonv10/"},(0,n.kt)("img",{parentName:"a",src:"https://microsoft.github.io/jacdac-docs/images/devices/kittenbot/keycapbuttonv10.list.jpg",alt:"A KittenBot KeyCap button",title:"KittenBot KeyCap button"}))),(0,n.kt)("h2",{id:"serial-pwm"},"Serial, PWM"),(0,n.kt)("p",null,"Serial, PWM are not supported yet at the DeviceScript level,\nhowever specific PWM uses (such as servos, buzzers, light bulbs, motors)\nare supported through ",(0,n.kt)("inlineCode",{parentName:"p"},"@devicescript/servers"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/02d6ef5b.b419d04d.js b/assets/js/02d6ef5b.b419d04d.js new file mode 100644 index 00000000000..7084c043071 --- /dev/null +++ b/assets/js/02d6ef5b.b419d04d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7622],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(r),d=i,m=u["".concat(l,".").concat(d)]||u[d]||f[d]||o;return r?n.createElement(m,a(a({ref:t},s),{},{components:r})):n.createElement(m,a({ref:t},s))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:i,a[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>f,frontMatter:()=>o,metadata:()=>c,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},a="VerifiedTelemetry",c={unversionedId:"api/clients/verifiedtelemetrysensor",id:"api/clients/verifiedtelemetrysensor",title:"VerifiedTelemetry",description:"The Verified Telemetry service is deprecated and not supported in DeviceScript.",source:"@site/docs/api/clients/verifiedtelemetrysensor.md",sourceDirName:"api/clients",slug:"/api/clients/verifiedtelemetrysensor",permalink:"/devicescript/api/clients/verifiedtelemetrysensor",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},p=[],s={toc:p},u="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"verifiedtelemetry"},"VerifiedTelemetry"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/verifiedtelemetrysensor/"},"Verified Telemetry service")," is deprecated and not supported in DeviceScript."))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/03013c26.6a995f54.js b/assets/js/03013c26.6a995f54.js new file mode 100644 index 00000000000..f83d324dc36 --- /dev/null +++ b/assets/js/03013c26.6a995f54.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8766],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(n),g=i,f=d["".concat(c,".").concat(g)]||d[g]||u[g]||o;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=g;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[d]="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const o={sidebar_position:3,description:"Understanding the differences between ECMAScript and DeviceScript in handling strings, Unicode, and UTF-16 code units.",keywords:["ECMAScript","DeviceScript","strings","Unicode","UTF-16"]},a="Strings and Unicode",s={unversionedId:"language/strings",id:"language/strings",title:"Strings and Unicode",description:"Understanding the differences between ECMAScript and DeviceScript in handling strings, Unicode, and UTF-16 code units.",source:"@site/docs/language/strings.mdx",sourceDirName:"language",slug:"/language/strings",permalink:"/devicescript/language/strings",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Understanding the differences between ECMAScript and DeviceScript in handling strings, Unicode, and UTF-16 code units.",keywords:["ECMAScript","DeviceScript","strings","Unicode","UTF-16"]},sidebar:"tutorialSidebar",previous:{title:"toString() method",permalink:"/devicescript/language/tostring"},next:{title:"Special objects",permalink:"/devicescript/language/special"}},c={},p=[],l={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"strings-and-unicode"},"Strings and Unicode"),(0,i.kt)("p",null,"ECMAScript spec requires ",(0,i.kt)("inlineCode",{parentName:"p"},"String.charCodeAt()")," to return a 16-bit value.\nUnicode code points outside of 16-bit (mostly emoticons, but also some historical alphabets,\nand rare Chinese/Japanese/Korean ideograms) are represented as surrogate pairs of two 16-bit code units.\nThe ",(0,i.kt)("inlineCode",{parentName:"p"},"String.length")," returns the number of UTF-16 code units in the string."),(0,i.kt)("p",null,"If ES was designed today they would probably return up to 21-bit values from ",(0,i.kt)("inlineCode",{parentName:"p"},"charCodeAt()"),",\nor possibly use yet another abstraction since even with full 21-bit Unicode,\nseveral code points can still combine into a single glyph (character displayed on the screen). "),(0,i.kt)("p",null,"In DeviceScript,\nthe method ",(0,i.kt)("inlineCode",{parentName:"p"},"String.charCodeAt()")," returns Unicode code point (up to 21 bits), not UTF-16 character.\nSimilarly, ",(0,i.kt)("inlineCode",{parentName:"p"},"String.length")," will return the number of 21-bit code points.\nThus, ",(0,i.kt)("inlineCode",{parentName:"p"},'"\ud83d\uddfd".length === 1')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"\ud83d\uddfd".charCodeAt(0) === 0x1f5fd'),",\nand also ",(0,i.kt)("inlineCode",{parentName:"p"},'"\\uD83D\\uDDFD".length === 1')," since ",(0,i.kt)("inlineCode",{parentName:"p"},'"\\uD83D\\uDDFD" === "\ud83d\uddfd"')," which may be confusing."),(0,i.kt)("p",null,"Also string ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/issues/39"},"construction by concatnation quadratic"),",\nhowever you can use ",(0,i.kt)("inlineCode",{parentName:"p"},"String.join()")," which is linear in the size of output."),(0,i.kt)("p",null,"See also ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/discussions/34"},"discussion"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/032aa2b9.1c4d5c50.js b/assets/js/032aa2b9.1c4d5c50.js new file mode 100644 index 00000000000..c7279d18e8f --- /dev/null +++ b/assets/js/032aa2b9.1c4d5c50.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[952],{35318:(t,e,a)=>{a.d(e,{Zo:()=>m,kt:()=>f});var r=a(27378);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function i(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,r)}return a}function p(t){for(var e=1;e=0||(n[a]=t[a]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}var o=r.createContext({}),d=function(t){var e=r.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},m=function(t){var e=d(t.components);return r.createElement(o.Provider,{value:e},t.children)},s="mdxType",g={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},k=r.forwardRef((function(t,e){var a=t.components,n=t.mdxType,i=t.originalType,o=t.parentName,m=l(t,["components","mdxType","originalType","parentName"]),s=d(a),k=n,f=s["".concat(o,".").concat(k)]||s[k]||g[k]||i;return a?r.createElement(f,p(p({ref:e},m),{},{components:a})):r.createElement(f,p({ref:e},m))}));function f(t,e){var a=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=a.length,p=new Array(i);p[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[s]="string"==typeof t?t:n,p[1]=l;for(var d=2;d{a.r(e),a.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=a(25773),n=(a(27378),a(35318));const i={description:"Adafruit Feather ESP32-S2"},p="Adafruit Feather ESP32-S2",l={unversionedId:"devices/esp32/adafruit-feather-esp32-s2",id:"devices/esp32/adafruit-feather-esp32-s2",title:"Adafruit Feather ESP32-S2",description:"Adafruit Feather ESP32-S2",source:"@site/docs/devices/esp32/adafruit-feather-esp32-s2.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/adafruit-feather-esp32-s2",permalink:"/devicescript/devices/esp32/adafruit-feather-esp32-s2",draft:!1,tags:[],version:"current",frontMatter:{description:"Adafruit Feather ESP32-S2"},sidebar:"tutorialSidebar",previous:{title:"ESP32",permalink:"/devicescript/devices/esp32/"},next:{title:"Adafruit QT Py ESP32-C3 WiFi",permalink:"/devicescript/devices/esp32/adafruit-qt-py-c3"}},o={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],m={toc:d},s="wrapper";function g(t){let{components:e,...a}=t;return(0,n.kt)(s,(0,r.Z)({},m,a,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"adafruit-feather-esp32-s2"},"Adafruit Feather ESP32-S2"),(0,n.kt)("p",null,"A S2 Feather from Adafruit. (untested)"),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"I2C on SDA/SCL using Qwiic connector"),(0,n.kt)("li",{parentName:"ul"},"WS2812B RGB LED on pin 33 (use ",(0,n.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,n.kt)("li",{parentName:"ul"},"Serial logging on pin 43 at 115200 8N1")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.adafruit.com/product/5000"},"https://www.adafruit.com/product/5000"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A4_D24")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A5_D25")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D11")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D12")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"D9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"LED_PWR")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"MISO")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO37"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"MOSI")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"PWR")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"RX_D0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"SCK")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"SCL")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"SDA")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"TX_D1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO39"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"led.pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,n.kt)("td",{parentName:"tr",align:"right"},"led.pin, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"log.pinTX")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,n.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Adafruit Feather ESP32-S2".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/adafruit_feather_esp32_s2"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board adafruit_feather_esp32_s2\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-adafruit_feather_esp32_s2-0x1000.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="adafruit_feather_esp32_s2.json"',title:'"adafruit_feather_esp32_s2.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "adafruit_feather_esp32_s2",\n "devName": "Adafruit Feather ESP32-S2",\n "productId": "0x3c2ed99e",\n "$description": "A S2 Feather from Adafruit. (untested)",\n "archId": "esp32s2",\n "url": "https://www.adafruit.com/product/5000",\n "i2c": {\n "$connector": "Qwiic",\n "pinSCL": "SCL",\n "pinSDA": "SDA"\n },\n "led": {\n "pin": 33,\n "type": 1\n },\n "log": {\n "pinTX": 43\n },\n "pins": {\n "A0": 18,\n "A1": 17,\n "A2": 16,\n "A3": 15,\n "A4_D24": 14,\n "A5_D25": 8,\n "D10": 10,\n "D11": 11,\n "D12": 12,\n "D13": 13,\n "D5": 5,\n "D6": 6,\n "D9": 9,\n "LED_PWR": 21,\n "MISO": 37,\n "MOSI": 35,\n "PWR": 7,\n "RX_D0": 38,\n "SCK": 36,\n "SCL": 4,\n "SDA": 3,\n "TX_D1": 39\n },\n "sPin": {\n "LED_PWR": 1,\n "PWR": 1\n }\n}\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/03ded4e1.0e30b5ea.js b/assets/js/03ded4e1.0e30b5ea.js new file mode 100644 index 00000000000..8e441a78121 --- /dev/null +++ b/assets/js/03ded4e1.0e30b5ea.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(r),u=i,g=d["".concat(c,".").concat(u)]||d[u]||f[u]||a;return r?n.createElement(g,o(o({ref:t},p),{},{components:r})):n.createElement(g,o({ref:t},p))}));function g(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:i,o[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>f,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var n=r(25773),i=(r(27378),r(35318));const a={description:"Mounts a reflected light sensor",title:"Reflected Light"},o="Reflected Light",l={unversionedId:"api/drivers/reflectedlight",id:"api/drivers/reflectedlight",title:"Reflected Light",description:"Mounts a reflected light sensor",source:"@site/docs/api/drivers/reflectedlight.md",sourceDirName:"api/drivers",slug:"/api/drivers/reflectedlight",permalink:"/devicescript/api/drivers/reflectedlight",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a reflected light sensor",title:"Reflected Light"},sidebar:"tutorialSidebar",previous:{title:"Power",permalink:"/devicescript/api/drivers/power"},next:{title:"Relay",permalink:"/devicescript/api/drivers/relay"}},c={},s=[],p={toc:s},d="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"reflected-light"},"Reflected Light"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startReflectedLight")," starts a simple analog sensor server that models a reflected light sensor\nand returns a ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/reflectedlight"},"client")," bound to the server."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Please refer to the ",(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("a",{parentName:"strong",href:"/developer/drivers/analog/"},"analog documentation"))," for details.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startReflectedLight } from "@devicescript/servers"\n\nconst sensor = startReflectedLight({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(brightness => console.data({ brightness }))\n')))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0444f081.8c3ad9bb.js b/assets/js/0444f081.8c3ad9bb.js new file mode 100644 index 00000000000..5c96889b3db --- /dev/null +++ b/assets/js/0444f081.8c3ad9bb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2429],{35318:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>k});var i=a(27378);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var o=i.createContext({}),c=function(e){var t=i.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return i.createElement(o.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},u=i.forwardRef((function(e,t){var a=e.components,n=e.mdxType,r=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(a),u=n,k=p["".concat(o,".").concat(u)]||p[u]||m[u]||r;return a?i.createElement(k,s(s({ref:t},d),{},{components:a})):i.createElement(k,s({ref:t},d))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var r=a.length,s=new Array(r);s[0]=u;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[p]="string"==typeof e?e:n,s[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>s,default:()=>m,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var i=a(25773),n=(a(27378),a(35318));const r={sidebar_position:12},s="Add Shield",l={unversionedId:"devices/add-shield",id:"devices/add-shield",title:"Add Shield",description:"Shield typically rely on using an existing board definition",source:"@site/docs/devices/add-shield.mdx",sourceDirName:"devices",slug:"/devices/add-shield",permalink:"/devicescript/devices/add-shield",draft:!1,tags:[],version:"current",sidebarPosition:12,frontMatter:{sidebar_position:12},sidebar:"tutorialSidebar",previous:{title:"Add SoC/MCU",permalink:"/devicescript/devices/add-soc"},next:{title:"Command Line Interface",permalink:"/devicescript/api/cli"}},o={},c=[{value:"Add to this repository",id:"add-to-this-repository",level:2},{value:"How-to publish on npm",id:"how-to-publish-on-npm",level:2}],d={toc:c},p="wrapper";function m(e){let{components:t,...a}=e;return(0,n.kt)(p,(0,i.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"add-shield"},"Add Shield"),(0,n.kt)("p",null,"Shield typically rely on using an existing ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"board definition"),"\nand with extra configuration using ",(0,n.kt)("inlineCode",{parentName:"p"},"configureHardware"),"\nand the logic to start drivers."),(0,n.kt)("ul",{className:"contains-task-list"},(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","create a class ",(0,n.kt)("inlineCode",{parentName:"li"},"Shield")," (rename to your shield name) and add the ",(0,n.kt)("inlineCode",{parentName:"li"},"@devsPart"),", ",(0,n.kt)("inlineCode",{parentName:"li"},"@devsWhenUsed")," attribute in the jsdoc.")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"/**\n * A shield driver\n * @devsPart My Shield name\n * @devsWhenUsed\n */\nexport class Shield {}\n")),(0,n.kt)("ul",{className:"contains-task-list"},(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","call ",(0,n.kt)("inlineCode",{parentName:"li"},"configureHardware")," in the constructor to setup additional hardware configuration like I2C.")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"export class Shield {\n constructor() {\n // highlight-next-line\n configureHardware({\n ...\n })\n }\n}\n")),(0,n.kt)("ul",{className:"contains-task-list"},(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","add instance methods to start each driver")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"export class Shield {\n startButton() {\n return startButton({\n pin: pins.GP10,\n activeHigh: true,\n })\n }\n}\n")),(0,n.kt)("h2",{id:"add-to-this-repository"},"Add to this repository"),(0,n.kt)("ul",{className:"contains-task-list"},(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","fork the ",(0,n.kt)("inlineCode",{parentName:"li"},"microsoft/devicescript")," repository"),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","add driver in ",(0,n.kt)("inlineCode",{parentName:"li"},"packages/drivers")," (see others), export from ",(0,n.kt)("inlineCode",{parentName:"li"},"packages/drivers/index.ts")),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","add documentation page under ",(0,n.kt)("inlineCode",{parentName:"li"},"website/docs/devices/shields"),", see others"),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","add entry in ",(0,n.kt)("inlineCode",{parentName:"li"},"website/docs/devices/index.tsx"))),(0,n.kt)("h2",{id:"how-to-publish-on-npm"},"How-to publish on npm"),(0,n.kt)("ul",{className:"contains-task-list"},(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("input",{parentName:"p",type:"checkbox",checked:!1,disabled:!0})," ","start a new DeviceScript project")),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("input",{parentName:"p",type:"checkbox",checked:!1,disabled:!0})," ","run the ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: add npm...")," command to prepare it for publishing")),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("input",{parentName:"p",type:"checkbox",checked:!1,disabled:!0})," ","add the board package for your target ",(0,n.kt)("a",{parentName:"p",href:"/devices"},"device"))),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("input",{parentName:"p",type:"checkbox",checked:!1,disabled:!0})," ","update the README with examples and documentation")),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("input",{parentName:"p",type:"checkbox",checked:!1,disabled:!0})," ","publish a release of your package")),(0,n.kt)("li",{parentName:"ul",className:"task-list-item"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("input",{parentName:"p",type:"checkbox",checked:!1,disabled:!0})," ","send us a pull request so we list your shield package!"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/066d851d.05d25fd2.js b/assets/js/066d851d.05d25fd2.js new file mode 100644 index 00000000000..87f35de9ce8 --- /dev/null +++ b/assets/js/066d851d.05d25fd2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5140],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),o=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=o(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=o(n),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return n?r.createElement(m,s(s({ref:t},p),{},{components:n})):r.createElement(m,s({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,s=new Array(a);s[0]=h;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:i,s[1]=c;for(var o=2;o{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>o});var r=n(25773),i=(n(27378),n(35318));const a={},s="Test",c={unversionedId:"api/test/index",id:"api/test/index",title:"Test",description:"The @devicescript/test builtin package provides a lightweight unit test framework, with a subset of familiar APIs to Jest/Vitest/Mocha/Chai users (describe, test, expect).",source:"@site/docs/api/test/index.md",sourceDirName:"api/test",slug:"/api/test/",permalink:"/devicescript/api/test/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Settings",permalink:"/devicescript/api/settings/"},next:{title:"WebASM VM",permalink:"/devicescript/api/vm"}},l={},o=[{value:"Usage",id:"usage",level:2},{value:"test",id:"test-1",level:3},{value:"describe",id:"describe",level:3},{value:"expect",id:"expect",level:3},{value:"beforeEach",id:"beforeeach",level:3},{value:"afterEach",id:"aftereach",level:3}],p={toc:o},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"test"},"Test"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/test")," ",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," provides a lightweight unit test framework, with a subset of familiar APIs to Jest/Vitest/Mocha/Chai users (",(0,i.kt)("inlineCode",{parentName:"p"},"describe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"test"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"expect"),")."),(0,i.kt)("h2",{id:"usage"},"Usage"),(0,i.kt)("h3",{id:"test-1"},(0,i.kt)("inlineCode",{parentName:"h3"},"test")),(0,i.kt)("p",null,"Defines a test with a name and a callback. There can be many tests and the callback can be ",(0,i.kt)("inlineCode",{parentName:"p"},"async"),". Tests should not be nested."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { describe, test } from "@devicescript/test"\n\ndescribe("this is a test suite", () => {\n // highlight-next-line\n test("this is a test", async () => {})\n})\n')),(0,i.kt)("h3",{id:"describe"},(0,i.kt)("inlineCode",{parentName:"h3"},"describe")),(0,i.kt)("p",null,"Declares and encapsulates a test suite. ",(0,i.kt)("inlineCode",{parentName:"p"},"describe")," calls can be nested."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { describe } from "@devicescript/test"\n\n// highlight-next-line\ndescribe("this is a test suite", () => {})\n')),(0,i.kt)("h3",{id:"expect"},(0,i.kt)("inlineCode",{parentName:"h3"},"expect")),(0,i.kt)("p",null,"BDD style assertion API."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { describe, test, expect } from "@devicescript/test"\n\ndescribe("this is a test suite", () => {\n test("this is a test", async () => {\n // highlight-next-line\n expect(1 + 1).toBe(2)\n })\n})\n')),(0,i.kt)("h3",{id:"beforeeach"},(0,i.kt)("inlineCode",{parentName:"h3"},"beforeEach")),(0,i.kt)("p",null,"Registers a callback to be called before each test in the current test suite."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { describe, test, expect } from "@devicescript/test"\n\ndescribe("this is a test suite", () => {\n beforeEach(() => {\n // highlight-next-line\n console.log(`...`)\n })\n test("this is a test", () => {})\n})\n')),(0,i.kt)("h3",{id:"aftereach"},(0,i.kt)("inlineCode",{parentName:"h3"},"afterEach")),(0,i.kt)("p",null,"Registers a callback to be called after each test in the current test suite."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { describe, test, expect } from "@devicescript/test"\n\ndescribe("this is a test suite", () => {\n afterEach(() => {\n // highlight-next-line\n console.log(`...`)\n })\n test("this is a test", () => {})\n})\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/08972f5c.00e50ba0.js b/assets/js/08972f5c.00e50ba0.js new file mode 100644 index 00000000000..8f36a8dccca --- /dev/null +++ b/assets/js/08972f5c.00e50ba0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9931],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var i=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=i.createContext({}),c=function(e){var t=i.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return i.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},v=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(r),v=n,m=d["".concat(l,".").concat(v)]||d[v]||u[v]||a;return r?i.createElement(m,o(o({ref:t},p),{},{components:r})):i.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,o=new Array(a);o[0]=v;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:n,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var i=r(25773),n=(r(27378),r(35318));const a={title:"User Interface",sidebar_position:2},o="User interface",s={unversionedId:"getting-started/vscode/user-interface",id:"getting-started/vscode/user-interface",title:"User Interface",description:"Device Explorer",source:"@site/docs/getting-started/vscode/user-interface.mdx",sourceDirName:"getting-started/vscode",slug:"/getting-started/vscode/user-interface",permalink:"/devicescript/getting-started/vscode/user-interface",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{title:"User Interface",sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Simulation",permalink:"/devicescript/getting-started/vscode/simulation"},next:{title:"Debugging",permalink:"/devicescript/getting-started/vscode/debugging"}},l={},c=[{value:"Device Explorer",id:"device-explorer",level:2},{value:"Device Explorer Actions",id:"device-explorer-actions",level:3},{value:"Register and Events watch",id:"register-and-events-watch",level:3},{value:"Editor title actions",id:"editor-title-actions",level:2},{value:"Terminal",id:"terminal",level:2},{value:"Status bar",id:"status-bar",level:2}],p={toc:c},d="wrapper";function u(e){let{components:t,...a}=e;return(0,n.kt)(d,(0,i.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"user-interface"},"User interface"),(0,n.kt)("h2",{id:"device-explorer"},"Device Explorer"),(0,n.kt)("p",null,"The DeviceScript view is opened by clicking the DeviceScript logo in the left bar menu."),(0,n.kt)("p",null,"It provides a treeview of the device, services, registers and events. The tree view updates\nautomatically with live data from the simulators and devices."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Device explorer screenshot",src:r(15264).Z,width:"882",height:"1030"})),(0,n.kt)("h3",{id:"device-explorer-actions"},"Device Explorer Actions"),(0,n.kt)("p",null,"The view has 3 actions:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"connect"),", the plug icon, which allows you to connect to a physical device, start the simulator or flash new firmware."),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"dashboard"),", starts the peripheral simulator dashboard"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"terminal"),", displays the DeviceScript terminal")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Dashboard",src:r(3994).Z,width:"1380",height:"528"})),(0,n.kt)("h3",{id:"register-and-events-watch"},"Register and Events watch"),(0,n.kt)("p",null,"You can ",(0,n.kt)("em",{parentName:"p"},"watch")," any register or event in the device explorer. This provides a way to 'pin' a register for debugging\nor monitoring."),(0,n.kt)("h2",{id:"editor-title-actions"},"Editor title actions"),(0,n.kt)("p",null,"Any ",(0,n.kt)("inlineCode",{parentName:"p"},"main*.ts")," file in a DeviceScript project will have added action in the editor title."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Editor actions for the main file",src:r(44393).Z,width:"482",height:"217"})),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"Debug"),": starts a debugging session from this file,"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"Build"),": builds the binary for this entry point file,"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"Upload"),": builds and deploys the binary to the current device"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"Configure"),": a wizard experience that helps you configure the code for your hardware device")),(0,n.kt)("h2",{id:"terminal"},"Terminal"),(0,n.kt)("p",null,"The DeviceScript terminal displays the status of the development tool process and the console output from devices."),(0,n.kt)("h2",{id:"status-bar"},"Status bar"),(0,n.kt)("p",null,"The DeviceScript status shows a logo and the current project name (the extension works on a single project at a time).\nYou can hover over the status to get more information or click to change the current project."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"status bar screenshot",src:r(88108).Z,width:"584",height:"436"})))}u.isMDXComponent=!0},15264:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/device-explorer-83bf8c4f6148ed75c174e95e1c57357b.png"},44393:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/editor-actions-a360b203d149616e420a59a3c8e6b44d.png"},3994:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/start-simulator-dashboard-a83a4c119a01656342c3f934001bba98.png"},88108:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/status-bar-77b4a19758810163da794665162f4a29.png"}}]); \ No newline at end of file diff --git a/assets/js/09bafa26.bb6b699a.js b/assets/js/09bafa26.bb6b699a.js new file mode 100644 index 00000000000..7ce3d4f4c6c --- /dev/null +++ b/assets/js/09bafa26.bb6b699a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7339],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=i,g=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(g,o(o({ref:t},c),{},{components:n})):r.createElement(g,o({ref:t},c))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:i,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={title:"Settings and Secrets",sidebar_position:9,description:"Settings provides a friendly layer to read/write objects from the device flash. Keep it small, there's not a lot of space!"},o="Settings",s={unversionedId:"developer/settings",id:"developer/settings",title:"Settings and Secrets",description:"Settings provides a friendly layer to read/write objects from the device flash. Keep it small, there's not a lot of space!",source:"@site/docs/developer/settings.mdx",sourceDirName:"developer",slug:"/developer/settings",permalink:"/devicescript/developer/settings",draft:!1,tags:[],version:"current",sidebarPosition:9,frontMatter:{title:"Settings and Secrets",sidebar_position:9,description:"Settings provides a friendly layer to read/write objects from the device flash. Keep it small, there's not a lot of space!"},sidebar:"tutorialSidebar",previous:{title:"Observables",permalink:"/devicescript/developer/observables"},next:{title:"Testing",permalink:"/devicescript/developer/testing"}},l={},p=[{value:".env files",id:"env-files",level:2},{value:"Special Settings",id:"special-settings",level:2},{value:"Using settings",id:"using-settings",level:2},{value:"Clearing",id:"clearing",level:2},{value:"See also",id:"see-also",level:2}],c={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"settings"},"Settings"),(0,i.kt)("p",null,"Settings ",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," provides a friendly layer to read/write objects from the device flash. ",(0,i.kt)("strong",{parentName:"p"},"Keep it small, there's not a lot of space!")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"In Visual Studio Code, open the command palette and run ",(0,i.kt)("strong",{parentName:"p"},"DeviceScript: Add Device Settings..."),".")),(0,i.kt)("h2",{id:"env-files"},".env files"),(0,i.kt)("p",null,"Don't store secrets or settings in the code, use ",(0,i.kt)("inlineCode",{parentName:"p"},".env")," files instead."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"./.env.defaults"),": store general settings (",(0,i.kt)("strong",{parentName:"li"},"tracked by version control"),")"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"./.env.local"),": store secrets or override for general settings (",(0,i.kt)("strong",{parentName:"li"},"untracked by version control"),")")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},".env*")," file use a similar format to node.js ",(0,i.kt)("inlineCode",{parentName:"p"},".env")," file. The content will be transfered in the device flash\nwhen deploying the DeviceScript bytecode."),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"The setting keys should be shorter than 14 characters!")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-env",metastring:'title="./.env.defaults"',title:'"./.env.defaults"'},"# Default settings\n# This file is tracked by git.\n# DO NOT store secrets in this file.\ntemperature=68\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-env",metastring:'title="./.env.local"',title:'"./.env.local"'},"# Local settings and secrets\n# This file is/should **NOT** tracked by git\ntemperature=70 # override\nPASSWORD=secret\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"In Visual Studio Code, open the command palette and run ",(0,i.kt)("strong",{parentName:"p"},"DeviceScript: Add Device Settings..."),".\nFrom the CLI, run ",(0,i.kt)("inlineCode",{parentName:"p"},"devs add settings"),".")),(0,i.kt)("h2",{id:"special-settings"},"Special Settings"),(0,i.kt)("p",null,"Some settings entries are treaty specially and routed to other services:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"WIFI_SSID"),": set the WiFi SSID to connect to"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"WIFI_PWD"),": set the WiFi password (skip or leave empty to connect to open WiFi)")),(0,i.kt)("h2",{id:"using-settings"},"Using settings"),(0,i.kt)("p",null,"Once your .env files are ready, you can use ",(0,i.kt)("inlineCode",{parentName:"p"},"readSetting")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"writeSetting")," to read/write settings."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature, Button } from "@devicescript/core"\nimport { readSetting, writeSetting } from "@devicescript/settings"\n\nconst temperature = new Temperature()\nconst button = new Button()\n// highlight-next-line\nlet threshold = await readSetting("temperature")\n\n// show alert when temperature is above threshold\ntemperature.reading.subscribe(t => {\n // highlight-next-line\n if (t > threshold) {\n // too hot!\n console.log("hot!")\n }\n})\n\n// increase threshold when button is pressed\nbutton.down.subscribe(async () => {\n threshold++\n // highlight-next-line\n await writeSetting("temperature", threshold)\n})\n')),(0,i.kt)("h2",{id:"clearing"},"Clearing"),(0,i.kt)("p",null,"You can use the command ",(0,i.kt)("strong",{parentName:"p"},"DeviceScript: Clear Device Setings...")," to clear the settings\nof the currently connected device."),(0,i.kt)("h2",{id:"see-also"},"See also"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/settings/"},"API reference"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0cc1c4e6.9f1925d1.js b/assets/js/0cc1c4e6.9f1925d1.js new file mode 100644 index 00000000000..5729ad8890b --- /dev/null +++ b/assets/js/0cc1c4e6.9f1925d1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1716],{35318:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>k});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=r.createContext({}),p=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(l.Provider,{value:n},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),s=p(t),m=i,k=s["".concat(l,".").concat(m)]||s[m]||u[m]||a;return t?r.createElement(k,o(o({ref:n},d),{},{components:t})):r.createElement(k,o({ref:n},d))}));function k(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=m;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c[s]="string"==typeof e?e:i,o[1]=c;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var r=t(25773),i=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Wind direction service"},o="WindDirection",c={unversionedId:"api/clients/winddirection",id:"api/clients/winddirection",title:"WindDirection",description:"DeviceScript client for Wind direction service",source:"@site/docs/api/clients/winddirection.md",sourceDirName:"api/clients",slug:"/api/clients/winddirection",permalink:"/devicescript/api/clients/winddirection",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Wind direction service"},sidebar:"tutorialSidebar"},l={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3}],d={toc:p},s="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(s,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"winddirection"},"WindDirection"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A sensor that measures wind direction."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { WindDirection } from "@devicescript/core"\n\nconst windDirection = new WindDirection()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The direction of the wind."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindDirection } from "@devicescript/core"\n\nconst windDirection = new WindDirection()\n// ...\nconst value = await windDirection.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindDirection } from "@devicescript/core"\n\nconst windDirection = new WindDirection()\n// ...\nwindDirection.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"Error on the wind direction reading"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindDirection } from "@devicescript/core"\n\nconst windDirection = new WindDirection()\n// ...\nconst value = await windDirection.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindDirection } from "@devicescript/core"\n\nconst windDirection = new WindDirection()\n// ...\nwindDirection.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0f0c2e9e.47f7355a.js b/assets/js/0f0c2e9e.47f7355a.js new file mode 100644 index 00000000000..6c06dbffcd7 --- /dev/null +++ b/assets/js/0f0c2e9e.47f7355a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5032],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=c(n),u=i,k=d["".concat(p,".").concat(u)]||d[u]||m[u]||a;return n?r.createElement(k,l(l({ref:t},s),{},{components:n})):r.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[d]="string"==typeof e?e:i,l[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for DMX service"},l="Dmx",o={unversionedId:"api/clients/dmx",id:"api/clients/dmx",title:"Dmx",description:"DeviceScript client for DMX service",source:"@site/docs/api/clients/dmx.md",sourceDirName:"api/clients",slug:"/api/clients/dmx",permalink:"/devicescript/api/clients/dmx",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for DMX service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Commands",id:"commands",level:2},{value:"send",id:"send",level:3},{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3}],s={toc:c},d="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"dmx"},"Dmx"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A service that can send DMX512-A packets with limited size. This service is designed to allow tinkering with a few DMX devices, but only allows 235 channels. More about DMX at ",(0,i.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/DMX512"},"https://en.wikipedia.org/wiki/DMX512"),"."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Dmx } from "@devicescript/core"\n\nconst dmx = new Dmx()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"send"},"send"),(0,i.kt)("p",null,"Send a DMX packet, up to 236bytes long, including the start code."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"dmx.send(channels: Buffer): Promise\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Determines if the DMX bridge is active."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Dmx } from "@devicescript/core"\n\nconst dmx = new Dmx()\n// ...\nconst value = await dmx.enabled.read()\nawait dmx.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Dmx } from "@devicescript/core"\n\nconst dmx = new Dmx()\n// ...\ndmx.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0f58a8af.079e458b.js b/assets/js/0f58a8af.079e458b.js new file mode 100644 index 00000000000..73d8b49bdf8 --- /dev/null +++ b/assets/js/0f58a8af.079e458b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3663],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>v});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},l="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),l=c(r),f=i,v=l["".concat(s,".").concat(f)]||l[f]||d[f]||o;return r?n.createElement(v,a(a({ref:t},u),{},{components:r})):n.createElement(v,a({ref:t},u))}));function v(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=f;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[l]="string"==typeof e?e:i,a[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var n=r(25773),i=(r(27378),r(35318));const o={description:"Mounts a buzzer (sounder) server",title:"Buzzer"},a="Buzzer",p={unversionedId:"api/drivers/buzzer",id:"api/drivers/buzzer",title:"Buzzer",description:"Mounts a buzzer (sounder) server",source:"@site/docs/api/drivers/buzzer.md",sourceDirName:"api/drivers",slug:"/api/drivers/buzzer",permalink:"/devicescript/api/drivers/buzzer",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a buzzer (sounder) server",title:"Buzzer"},sidebar:"tutorialSidebar",previous:{title:"Button",permalink:"/devicescript/api/drivers/button"},next:{title:"Hall sensor",permalink:"/devicescript/api/drivers/hall"}},s={},c=[{value:"Options",id:"options",level:2},{value:"pin",id:"pin",level:3},{value:"activeLow",id:"activelow",level:3}],u={toc:c},l="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(l,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"buzzer"},"Buzzer"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startBuzzer")," function starts a ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/buzzer"},"buzzer")," server on the device\nand returns a ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/buzzer"},"client"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startBuzzer } from "@devicescript/servers"\n\nconst speaker = startBuzzer({\n pin: gpio(20)\n})\n')),(0,i.kt)("h2",{id:"options"},"Options"),(0,i.kt)("h3",{id:"pin"},"pin"),(0,i.kt)("p",null,"The pin hardware identifier on which to mount the buzzer."),(0,i.kt)("h3",{id:"activelow"},"activeLow"),(0,i.kt)("p",null,"Indicates that the current flows through the speaker when the pin ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),".\nThat means that when the speaker is supposed to be silent, the pin will be set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),".\nBy default, the opposite is assumed."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0fe4a880.3c67273c.js b/assets/js/0fe4a880.3c67273c.js new file mode 100644 index 00000000000..d125fac5d36 --- /dev/null +++ b/assets/js/0fe4a880.3c67273c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[831],{35318:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>k});var a=t(27378);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=a.createContext({}),c=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return a.createElement(p.Provider,{value:n},e.children)},d="mdxType",s={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=c(t),m=r,k=d["".concat(p,".").concat(m)]||d[m]||s[m]||i;return t?a.createElement(k,l(l({ref:n},u),{},{components:t})):a.createElement(k,l({ref:n},u))}));function k(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,l=new Array(i);l[0]=m;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[d]="string"==typeof e?e:r,l[1]=o;for(var c=2;c{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var a=t(25773),r=(t(27378),t(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Arcade Sound service"},l="ArcadeSound",o={unversionedId:"api/clients/arcadesound",id:"api/clients/arcadesound",title:"ArcadeSound",description:"DeviceScript client for Arcade Sound service",source:"@site/docs/api/clients/arcadesound.md",sourceDirName:"api/clients",slug:"/api/clients/arcadesound",permalink:"/devicescript/api/clients/arcadesound",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Arcade Sound service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Commands",id:"commands",level:2},{value:"play",id:"play",level:3},{value:"Registers",id:"registers",level:2},{value:"sampleRate",id:"rw:sampleRate",level:3},{value:"bufferSize",id:"const:bufferSize",level:3},{value:"bufferPending",id:"ro:bufferPending",level:3}],u={toc:c},d="wrapper";function s(e){let{components:n,...t}=e;return(0,r.kt)(d,(0,a.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"arcadesound"},"ArcadeSound"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"A sound playing device."),(0,r.kt)("p",null,"This is typically run over an SPI connection, not regular single-wire Jacdac."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { ArcadeSound } from "@devicescript/core"\n\nconst arcadeSound = new ArcadeSound()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"play"},"play"),(0,r.kt)("p",null,"Play samples, which are single channel, signed 16-bit little endian values."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"arcadeSound.play(samples: Buffer): Promise\n")),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:sampleRate"},"sampleRate"),(0,r.kt)("p",null,"Get or set playback sample rate (in samples per second).\nIf you set it, read it back, as the value may be rounded up or down."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ArcadeSound } from "@devicescript/core"\n\nconst arcadeSound = new ArcadeSound()\n// ...\nconst value = await arcadeSound.sampleRate.read()\nawait arcadeSound.sampleRate.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ArcadeSound } from "@devicescript/core"\n\nconst arcadeSound = new ArcadeSound()\n// ...\narcadeSound.sampleRate.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:bufferSize"},"bufferSize"),(0,r.kt)("p",null,"The size of the internal audio buffer."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ArcadeSound } from "@devicescript/core"\n\nconst arcadeSound = new ArcadeSound()\n// ...\nconst value = await arcadeSound.bufferSize.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:bufferPending"},"bufferPending"),(0,r.kt)("p",null,"How much data is still left in the buffer to play.\nClients should not send more data than ",(0,r.kt)("inlineCode",{parentName:"p"},"buffer_size - buffer_pending"),",\nbut can keep the ",(0,r.kt)("inlineCode",{parentName:"p"},"buffer_pending")," as low as they want to ensure low latency\nof audio playback."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ArcadeSound } from "@devicescript/core"\n\nconst arcadeSound = new ArcadeSound()\n// ...\nconst value = await arcadeSound.bufferPending.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ArcadeSound } from "@devicescript/core"\n\nconst arcadeSound = new ArcadeSound()\n// ...\narcadeSound.bufferPending.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/11653462.56d6540e.js b/assets/js/11653462.56d6540e.js new file mode 100644 index 00000000000..b3477f6d492 --- /dev/null +++ b/assets/js/11653462.56d6540e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4599],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=l(r),f=a,m=p["".concat(c,".").concat(f)]||p[f]||d[f]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[p]="string"==typeof e?e:a,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},i="CodalMessageBus",s={unversionedId:"api/clients/codalmessagebus",id:"api/clients/codalmessagebus",title:"CodalMessageBus",description:"The CODAL Message Bus service is used internally by the runtime",source:"@site/docs/api/clients/codalmessagebus.md",sourceDirName:"api/clients",slug:"/api/clients/codalmessagebus",permalink:"/devicescript/api/clients/codalmessagebus",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},c={},l=[],u={toc:l},p="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(p,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"codalmessagebus"},"CodalMessageBus"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/codalmessagebus/"},"CODAL Message Bus service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,a.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/13738eeb.542b869f.js b/assets/js/13738eeb.542b869f.js new file mode 100644 index 00000000000..353c3de32e8 --- /dev/null +++ b/assets/js/13738eeb.542b869f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3538],{35318:(e,r,t)=>{t.d(r,{Zo:()=>m,kt:()=>f});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=n.createContext({}),p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},m=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},l="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},u=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,c=e.originalType,s=e.parentName,m=a(e,["components","mdxType","originalType","parentName"]),l=p(t),u=i,f=l["".concat(s,".").concat(u)]||l[u]||d[u]||c;return t?n.createElement(f,o(o({ref:r},m),{},{components:t})):n.createElement(f,o({ref:r},m))}));function f(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var c=t.length,o=new Array(c);o[0]=u;var a={};for(var s in r)hasOwnProperty.call(r,s)&&(a[s]=r[s]);a.originalType=e,a[l]="string"==typeof e?e:i,o[1]=a;for(var p=2;p{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>c,metadata:()=>a,toc:()=>p});var n=t(25773),i=(t(27378),t(35318));const c={sidebar_position:4,description:"Learn how to implement commands directly on role instances and create service-specific commands in DeviceScript.",keywords:["DeviceScript","commands","role instances","service-specific","Buzzer"]},o="Commands",a={unversionedId:"api/core/commands",id:"api/core/commands",title:"Commands",description:"Learn how to implement commands directly on role instances and create service-specific commands in DeviceScript.",source:"@site/docs/api/core/commands.md",sourceDirName:"api/core",slug:"/api/core/commands",permalink:"/devicescript/api/core/commands",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Learn how to implement commands directly on role instances and create service-specific commands in DeviceScript.",keywords:["DeviceScript","commands","role instances","service-specific","Buzzer"]},sidebar:"tutorialSidebar",previous:{title:"Events",permalink:"/devicescript/api/core/events"},next:{title:"Buffers",permalink:"/devicescript/api/core/buffers"}},s={},p=[],m={toc:p},l="wrapper";function d(e){let{components:r,...t}=e;return(0,i.kt)(l,(0,n.Z)({},m,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"commands"},"Commands"),(0,i.kt)("p",null,"Commands are implemented directly on the role instance and are service specific."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"edit",edit:!0},'import { Buzzer } from "@devicescript/core"\n\nconst buzzer = new Buzzer()\n\nsetInterval(async () => {\n await buzzer.playNote(440, 1, 100)\n}, 1000)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/14b6b4b0.5c2455e8.js b/assets/js/14b6b4b0.5c2455e8.js new file mode 100644 index 00000000000..004c07dfb4e --- /dev/null +++ b/assets/js/14b6b4b0.5c2455e8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8145],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(r),d=i,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||a;return r?n.createElement(f,o(o({ref:t},l),{},{components:r})):n.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:i,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={},o="SHTC3",s={unversionedId:"api/drivers/shtc3",id:"api/drivers/shtc3",title:"SHTC3",description:"Driver for SHTC3 temperature/humidity sensor at I2C address 0x70.",source:"@site/docs/api/drivers/shtc3.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/shtc3",permalink:"/devicescript/api/drivers/shtc3",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"SHT30",permalink:"/devicescript/api/drivers/sht30"},next:{title:"Soil Moisture",permalink:"/devicescript/api/drivers/soilmoisture"}},c={},p=[{value:"Usage",id:"usage",level:2}],l={toc:p},u="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"shtc3"},"SHTC3"),(0,i.kt)("p",null,"Driver for SHTC3 temperature/humidity sensor at I2C address ",(0,i.kt)("inlineCode",{parentName:"p"},"0x70"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Services: ",(0,i.kt)("a",{parentName:"li",href:"/api/clients/temperature/"},"temperature"),", ",(0,i.kt)("a",{parentName:"li",href:"/api/clients/humidity/"},"humidity")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://sensirion.com/products/catalog/SHTC3/"},"Datasheet")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/shtc3.ts"},"Source"))),(0,i.kt)("h2",{id:"usage"},"Usage"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { startSHTC3 } from "@devicescript/drivers"\nconst { temperature, humidity } = await startSHTC3()\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/15372202.e97f7461.js b/assets/js/15372202.e97f7461.js new file mode 100644 index 00000000000..bc3bc247bbb --- /dev/null +++ b/assets/js/15372202.e97f7461.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6164],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?a.createElement(f,o(o({ref:t},c),{},{components:n})):a.createElement(f,o({ref:t},c))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:r,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var a=n(25773),r=(n(27378),n(35318));const i={},o="Matlab ThingSpeak",l={unversionedId:"developer/iot/matlab-thingspeak/index",id:"developer/iot/matlab-thingspeak/index",title:"Matlab ThingSpeak",description:"Matlab ThingSpeak is an IoT platform",source:"@site/docs/developer/iot/matlab-thingspeak/index.mdx",sourceDirName:"developer/iot/matlab-thingspeak",slug:"/developer/iot/matlab-thingspeak/",permalink:"/devicescript/developer/iot/matlab-thingspeak/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Blynk.io",permalink:"/devicescript/developer/iot/blynk-io/"},next:{title:"Cryptography",permalink:"/devicescript/developer/crypto"}},s={},p=[{value:"writeData",id:"writedata",level:2}],c={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"matlab-thingspeak"},"Matlab ThingSpeak"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://thingspeak.com/"},"Matlab ThingSpeak")," is an IoT platform\nthat allows you to collect and store sensor data in the cloud and develop IoT applications\nin Matlab."),(0,r.kt)("h2",{id:"writedata"},"writeData"),(0,r.kt)("p",null,"ThingSpeak provides a ",(0,r.kt)("a",{parentName:"p",href:"https://www.mathworks.com/help/thingspeak/writedata.html"},"HTTPS REST API")," to write data to a channel."),(0,r.kt)("p",null,"You can use settings to store your ThingSpeak API key and ",(0,r.kt)("inlineCode",{parentName:"p"},"fetch")," to send data to ThingSpeak."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-.env",metastring:'title=".env.local"',title:'".env.local"'},"TS_KEY=api_key\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./src/main.ts"',title:'"./src/main.ts"'},'import { fetch, Response } from "@devicescript/net"\nimport { readSetting } from "@devicescript/settings"\n\n/**\n * Write data to ThingSpeak channel\n * @param fields\n * @param options\n * @see {@link https://www.mathworks.com/help/thingspeak/writedata.html write data}\n * @see {@link https://www.mathworks.com/help/thingspeak/error-codes.html error codes}\n */\nexport async function writeData(\n // field values\n fields?: Record,\n options?: {\n // Latitude in degrees, specified as a value between -90 and 90.\n lat?: number\n // Longitude in degrees, specified as a value between -180 and 180.\n long?: number\n // Elevation in meters\n elevation?: number\n // Status update message.\n status?: string\n }\n) {\n const url = "https://api.thingspeak.com/update.json"\n // the secret key should be in .env.local\n const key = await readSetting("TS_KEY")\n\n // construct payload\n const payload: any = {}\n // field values\n Object.keys(fields).forEach(k => {\n const v = fields[k]\n if (v !== undefined && v !== null) payload[`field${k}`] = v\n })\n // additional options\n if (options) Object.assign(payload, options)\n\n // send request and return http response\n let resp: Response\n try {\n resp = await fetch(url, {\n method: "POST",\n headers: {\n THINGSPEAKAPIKEY: key,\n "Content-Type": "application/json",\n },\n body: JSON.stringify(payload),\n })\n return resp.status\n } finally {\n await resp?.close()\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/15d99295.4c89fccd.js b/assets/js/15d99295.4c89fccd.js new file mode 100644 index 00000000000..1bbde4223cf --- /dev/null +++ b/assets/js/15d99295.4c89fccd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8338],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=r.createContext({}),c=function(e){var t=r.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(d.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,d=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),p=c(n),m=i,g=p["".concat(d,".").concat(m)]||p[m]||u[m]||o;return n?r.createElement(g,a(a({ref:t},s),{},{components:n})):r.createElement(g,a({ref:t},s))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=m;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l[p]="string"==typeof e?e:i,a[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const o={title:"Getting Started",description:"Learn how to get started with DeviceScript using Visual Studio Code, command line, and explore samples.",keywords:["DeviceScript","TypeScript","Visual Studio Code","Command Line","Samples"]},a="Getting Started",l={unversionedId:"getting-started/index",id:"getting-started/index",title:"Getting Started",description:"Learn how to get started with DeviceScript using Visual Studio Code, command line, and explore samples.",source:"@site/docs/getting-started/index.mdx",sourceDirName:"getting-started",slug:"/getting-started/",permalink:"/devicescript/getting-started/",draft:!1,tags:[],version:"current",frontMatter:{title:"Getting Started",description:"Learn how to get started with DeviceScript using Visual Studio Code, command line, and explore samples.",keywords:["DeviceScript","TypeScript","Visual Studio Code","Command Line","Samples"]},sidebar:"tutorialSidebar",previous:{title:"DeviceScript",permalink:"/devicescript/intro"},next:{title:"Visual Studio Code Extension",permalink:"/devicescript/getting-started/vscode/"}},d={},c=[{value:"Visual Studio Code extension",id:"visual-studio-code-extension",level:2},{value:"Command Line",id:"command-line",level:2},{value:"Samples",id:"samples",level:2}],s={toc:c},p="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(p,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"getting-started"},"Getting Started"),(0,i.kt)("p",null,"DeviceScript has a development cycle tailored for TypeScript inclined developers, node or web."),(0,i.kt)("h2",{id:"visual-studio-code-extension"},"Visual Studio Code extension"),(0,i.kt)("p",null,"Visual Studio and the DeviceScript Extension provide the best developer experience, with building, deploying, debugging,\ntracing, device monitoring and other developer productivity features."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/getting-started/vscode"},"Getting started with Visual Studio Code"))),(0,i.kt)("h2",{id:"command-line"},"Command Line"),(0,i.kt)("p",null,"The command line is IDE agnostic and will let you script your own developer experience."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/getting-started/cli"},"Getting started with command line"))),(0,i.kt)("h2",{id:"samples"},"Samples"),(0,i.kt)("p",null,"Once you are ready with your setup, you can start with the ",(0,i.kt)("a",{parentName:"p",href:"/samples"},"samples"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/171.fcfc9a83.js b/assets/js/171.fcfc9a83.js new file mode 100644 index 00000000000..ba7336d8d01 --- /dev/null +++ b/assets/js/171.fcfc9a83.js @@ -0,0 +1,1354 @@ +"use strict"; +exports.id = 171; +exports.ids = [171]; +exports.modules = { + +/***/ 67171: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ diagram: () => (/* binding */ diagram) +/* harmony export */ }); +/* harmony import */ var _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(99255); +/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5949); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(75627); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(36304); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(54628); +/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27693); +/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7608); +/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42605); +/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(86161); +/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(88472); +/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(76576); +/* harmony import */ var dagre_d3_es__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(77567); +/* harmony import */ var dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(57635); +/* harmony import */ var dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(69746); +/* harmony import */ var dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(79580); +/* harmony import */ var dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_10__); + + + + + + + + + + + + + + + + + + + + + + +var parser = function() { + var o = function(k, v, o2, l) { + for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) + ; + return o2; + }, $V0 = [1, 2], $V1 = [1, 5], $V2 = [6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 17], $V6 = [1, 18], $V7 = [1, 19], $V8 = [1, 23], $V9 = [1, 24], $Va = [1, 27], $Vb = [4, 6, 9, 11, 17, 18, 20, 22, 23, 26, 27, 28]; + var parser2 = { + trace: function trace() { + }, + yy: {}, + symbols_: { "error": 2, "start": 3, "timeline": 4, "document": 5, "EOF": 6, "directive": 7, "line": 8, "SPACE": 9, "statement": 10, "NEWLINE": 11, "openDirective": 12, "typeDirective": 13, "closeDirective": 14, ":": 15, "argDirective": 16, "title": 17, "acc_title": 18, "acc_title_value": 19, "acc_descr": 20, "acc_descr_value": 21, "acc_descr_multiline_value": 22, "section": 23, "period_statement": 24, "event_statement": 25, "period": 26, "event": 27, "open_directive": 28, "type_directive": 29, "arg_directive": 30, "close_directive": 31, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "timeline", 6: "EOF", 9: "SPACE", 11: "NEWLINE", 15: ":", 17: "title", 18: "acc_title", 19: "acc_title_value", 20: "acc_descr", 21: "acc_descr_value", 22: "acc_descr_multiline_value", 23: "section", 26: "period", 27: "event", 28: "open_directive", 29: "type_directive", 30: "arg_directive", 31: "close_directive" }, + productions_: [0, [3, 3], [3, 2], [5, 0], [5, 2], [8, 2], [8, 1], [8, 1], [8, 1], [7, 4], [7, 6], [10, 1], [10, 2], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [24, 1], [25, 1], [12, 1], [13, 1], [16, 1], [14, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + case 3: + this.$ = []; + break; + case 4: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 5: + case 6: + this.$ = $$[$0]; + break; + case 7: + case 8: + this.$ = []; + break; + case 11: + yy.getCommonDb().setDiagramTitle($$[$0].substr(6)); + this.$ = $$[$0].substr(6); + break; + case 12: + this.$ = $$[$0].trim(); + yy.getCommonDb().setAccTitle(this.$); + break; + case 13: + case 14: + this.$ = $$[$0].trim(); + yy.getCommonDb().setAccDescription(this.$); + break; + case 15: + yy.addSection($$[$0].substr(8)); + this.$ = $$[$0].substr(8); + break; + case 19: + yy.addTask($$[$0], 0, ""); + this.$ = $$[$0]; + break; + case 20: + yy.addEvent($$[$0].substr(2)); + this.$ = $$[$0]; + break; + case 21: + yy.parseDirective("%%{", "open_directive"); + break; + case 22: + yy.parseDirective($$[$0], "type_directive"); + break; + case 23: + $$[$0] = $$[$0].trim().replace(/'/g, '"'); + yy.parseDirective($$[$0], "arg_directive"); + break; + case 24: + yy.parseDirective("}%%", "close_directive", "timeline"); + break; + } + }, + table: [{ 3: 1, 4: $V0, 7: 3, 12: 4, 28: $V1 }, { 1: [3] }, o($V2, [2, 3], { 5: 6 }), { 3: 7, 4: $V0, 7: 3, 12: 4, 28: $V1 }, { 13: 8, 29: [1, 9] }, { 29: [2, 21] }, { 6: [1, 10], 7: 22, 8: 11, 9: [1, 12], 10: 13, 11: [1, 14], 12: 4, 17: $V3, 18: $V4, 20: $V5, 22: $V6, 23: $V7, 24: 20, 25: 21, 26: $V8, 27: $V9, 28: $V1 }, { 1: [2, 2] }, { 14: 25, 15: [1, 26], 31: $Va }, o([15, 31], [2, 22]), o($V2, [2, 8], { 1: [2, 1] }), o($V2, [2, 4]), { 7: 22, 10: 28, 12: 4, 17: $V3, 18: $V4, 20: $V5, 22: $V6, 23: $V7, 24: 20, 25: 21, 26: $V8, 27: $V9, 28: $V1 }, o($V2, [2, 6]), o($V2, [2, 7]), o($V2, [2, 11]), { 19: [1, 29] }, { 21: [1, 30] }, o($V2, [2, 14]), o($V2, [2, 15]), o($V2, [2, 16]), o($V2, [2, 17]), o($V2, [2, 18]), o($V2, [2, 19]), o($V2, [2, 20]), { 11: [1, 31] }, { 16: 32, 30: [1, 33] }, { 11: [2, 24] }, o($V2, [2, 5]), o($V2, [2, 12]), o($V2, [2, 13]), o($Vb, [2, 9]), { 14: 34, 31: $Va }, { 31: [2, 23] }, { 11: [1, 35] }, o($Vb, [2, 10])], + defaultActions: { 5: [2, 21], 7: [2, 2], 27: [2, 24], 33: [2, 23] }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } + }, + parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function lex() { + var token; + token = tstack.pop() || lexer2.lex() || EOF; + if (typeof token !== "number") { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, state, action, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + var lexer = function() { + var lexer2 = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + // resets the lexer, sets new input + setInput: function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function() { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function(n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function(match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + for (var k in backup) { + this[k] = backup[k]; + } + return false; + } + return false; + }, + // return next match in input + next: function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { "case-insensitive": true }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + switch ($avoiding_name_collisions) { + case 0: + this.begin("open_directive"); + return 28; + case 1: + this.begin("type_directive"); + return 29; + case 2: + this.popState(); + this.begin("arg_directive"); + return 15; + case 3: + this.popState(); + this.popState(); + return 31; + case 4: + return 30; + case 5: + break; + case 6: + break; + case 7: + return 11; + case 8: + break; + case 9: + break; + case 10: + return 4; + case 11: + return 17; + case 12: + this.begin("acc_title"); + return 18; + case 13: + this.popState(); + return "acc_title_value"; + case 14: + this.begin("acc_descr"); + return 20; + case 15: + this.popState(); + return "acc_descr_value"; + case 16: + this.begin("acc_descr_multiline"); + break; + case 17: + this.popState(); + break; + case 18: + return "acc_descr_multiline_value"; + case 19: + return 23; + case 20: + return 27; + case 21: + return 26; + case 22: + return 6; + case 23: + return "INVALID"; + } + }, + rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?::\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "open_directive": { "rules": [1], "inclusive": false }, "type_directive": { "rules": [2, 3], "inclusive": false }, "arg_directive": { "rules": [3, 4], "inclusive": false }, "acc_descr_multiline": { "rules": [17, 18], "inclusive": false }, "acc_descr": { "rules": [15], "inclusive": false }, "acc_title": { "rules": [13], "inclusive": false }, "INITIAL": { "rules": [0, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 19, 20, 21, 22, 23], "inclusive": true } } + }; + return lexer2; + }(); + parser2.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser2; + parser2.Parser = Parser; + return new Parser(); +}(); +parser.parser = parser; +const parser$1 = parser; +let currentSection = ""; +let currentTaskId = 0; +const sections = []; +const tasks = []; +const rawTasks = []; +const getCommonDb = () => _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.j; +const parseDirective = (statement, context, type) => { + (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.k)(globalThis, statement, context, type); +}; +const clear = function() { + sections.length = 0; + tasks.length = 0; + currentSection = ""; + rawTasks.length = 0; + (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.m)(); +}; +const addSection = function(txt) { + currentSection = txt; + sections.push(txt); +}; +const getSections = function() { + return sections; +}; +const getTasks = function() { + let allItemsProcessed = compileTasks(); + const maxDepth = 100; + let iterationCount = 0; + while (!allItemsProcessed && iterationCount < maxDepth) { + allItemsProcessed = compileTasks(); + iterationCount++; + } + tasks.push(...rawTasks); + return tasks; +}; +const addTask = function(period, length, event) { + const rawTask = { + id: currentTaskId++, + section: currentSection, + type: currentSection, + task: period, + score: length ? length : 0, + //if event is defined, then add it the events array + events: event ? [event] : [] + }; + rawTasks.push(rawTask); +}; +const addEvent = function(event) { + const currentTask = rawTasks.find((task) => task.id === currentTaskId - 1); + currentTask.events.push(event); +}; +const addTaskOrg = function(descr) { + const newTask = { + section: currentSection, + type: currentSection, + description: descr, + task: descr, + classes: [] + }; + tasks.push(newTask); +}; +const compileTasks = function() { + const compileTask = function(pos) { + return rawTasks[pos].processed; + }; + let allProcessed = true; + for (const [i, rawTask] of rawTasks.entries()) { + compileTask(i); + allProcessed = allProcessed && rawTask.processed; + } + return allProcessed; +}; +const timelineDb = { + clear, + getCommonDb, + addSection, + getSections, + getTasks, + addTask, + addTaskOrg, + addEvent, + parseDirective +}; +const db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addEvent, + addSection, + addTask, + addTaskOrg, + clear, + default: timelineDb, + getCommonDb, + getSections, + getTasks, + parseDirective +}, Symbol.toStringTag, { value: "Module" })); +const MAX_SECTIONS = 12; +const drawRect = function(elem, rectData) { + const rectElem = elem.append("rect"); + rectElem.attr("x", rectData.x); + rectElem.attr("y", rectData.y); + rectElem.attr("fill", rectData.fill); + rectElem.attr("stroke", rectData.stroke); + rectElem.attr("width", rectData.width); + rectElem.attr("height", rectData.height); + rectElem.attr("rx", rectData.rx); + rectElem.attr("ry", rectData.ry); + if (rectData.class !== void 0) { + rectElem.attr("class", rectData.class); + } + return rectElem; +}; +const drawFace = function(element, faceData) { + const radius = 15; + const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible"); + const face = element.append("g"); + face.append("circle").attr("cx", faceData.cx - radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + face.append("circle").attr("cx", faceData.cx + radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + function smile(face2) { + const arc$1 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .arc */ .Nb1)().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")"); + } + function sad(face2) { + const arc$1 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .arc */ .Nb1)().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")"); + } + function ambivalent(face2) { + face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666"); + } + if (faceData.score > 3) { + smile(face); + } else if (faceData.score < 3) { + sad(face); + } else { + ambivalent(face); + } + return circleElement; +}; +const drawCircle = function(element, circleData) { + const circleElement = element.append("circle"); + circleElement.attr("cx", circleData.cx); + circleElement.attr("cy", circleData.cy); + circleElement.attr("class", "actor-" + circleData.pos); + circleElement.attr("fill", circleData.fill); + circleElement.attr("stroke", circleData.stroke); + circleElement.attr("r", circleData.r); + if (circleElement.class !== void 0) { + circleElement.attr("class", circleElement.class); + } + if (circleData.title !== void 0) { + circleElement.append("title").text(circleData.title); + } + return circleElement; +}; +const drawText = function(elem, textData) { + const nText = textData.text.replace(//gi, " "); + const textElem = elem.append("text"); + textElem.attr("x", textData.x); + textElem.attr("y", textData.y); + textElem.attr("class", "legend"); + textElem.style("text-anchor", textData.anchor); + if (textData.class !== void 0) { + textElem.attr("class", textData.class); + } + const span = textElem.append("tspan"); + span.attr("x", textData.x + textData.textMargin * 2); + span.text(nText); + return textElem; +}; +const drawLabel = function(elem, txtObject) { + function genPoints(x, y, width, height, cut) { + return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height); + } + const polygon = elem.append("polygon"); + polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7)); + polygon.attr("class", "labelBox"); + txtObject.y = txtObject.y + txtObject.labelMargin; + txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin; + drawText(elem, txtObject); +}; +const drawSection = function(elem, section, conf2) { + const g = elem.append("g"); + const rect = getNoteRect(); + rect.x = section.x; + rect.y = section.y; + rect.fill = section.fill; + rect.width = conf2.width; + rect.height = conf2.height; + rect.class = "journey-section section-type-" + section.num; + rect.rx = 3; + rect.ry = 3; + drawRect(g, rect); + _drawTextCandidateFunc(conf2)( + section.text, + g, + rect.x, + rect.y, + rect.width, + rect.height, + { class: "journey-section section-type-" + section.num }, + conf2, + section.colour + ); +}; +let taskCount = -1; +const drawTask = function(elem, task, conf2) { + const center = task.x + conf2.width / 2; + const g = elem.append("g"); + taskCount++; + const maxHeight = 300 + 5 * 30; + g.append("line").attr("id", "task" + taskCount).attr("x1", center).attr("y1", task.y).attr("x2", center).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"); + drawFace(g, { + cx: center, + cy: 300 + (5 - task.score) * 30, + score: task.score + }); + const rect = getNoteRect(); + rect.x = task.x; + rect.y = task.y; + rect.fill = task.fill; + rect.width = conf2.width; + rect.height = conf2.height; + rect.class = "task task-type-" + task.num; + rect.rx = 3; + rect.ry = 3; + drawRect(g, rect); + task.x + 14; + _drawTextCandidateFunc(conf2)( + task.task, + g, + rect.x, + rect.y, + rect.width, + rect.height, + { class: "task" }, + conf2, + task.colour + ); +}; +const drawBackgroundRect = function(elem, bounds) { + const rectElem = drawRect(elem, { + x: bounds.startx, + y: bounds.starty, + width: bounds.stopx - bounds.startx, + height: bounds.stopy - bounds.starty, + fill: bounds.fill, + class: "rect" + }); + rectElem.lower(); +}; +const getTextObj = function() { + return { + x: 0, + y: 0, + fill: void 0, + "text-anchor": "start", + width: 100, + height: 100, + textMargin: 0, + rx: 0, + ry: 0 + }; +}; +const getNoteRect = function() { + return { + x: 0, + y: 0, + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; +}; +const _drawTextCandidateFunc = function() { + function byText(content, g, x, y, width, height, textAttrs, colour) { + const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content); + _setTextAttrs(text, textAttrs); + } + function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) { + const { taskFontSize, taskFontFamily } = conf2; + const lines = content.split(//gi); + for (let i = 0; i < lines.length; i++) { + const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2; + const text = g.append("text").attr("x", x + width / 2).attr("y", y).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily); + text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]); + text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"); + _setTextAttrs(text, textAttrs); + } + } + function byFo(content, g, x, y, width, height, textAttrs, conf2) { + const body = g.append("switch"); + const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed"); + const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, body, x, y, width, height, textAttrs, conf2); + _setTextAttrs(text, textAttrs); + } + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (key in fromTextAttrsDict) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + return function(conf2) { + return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan; + }; +}(); +const initGraphics = function(graphics) { + graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z"); +}; +function wrap(text, width) { + text.each(function() { + var text2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(this), words = text2.text().split(/(\s+|
)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em"); + for (let j = 0; j < words.length; j++) { + word = words[words.length - 1 - j]; + line.push(word); + tspan.text(line.join(" ").trim()); + if (tspan.node().getComputedTextLength() > width || word === "
") { + line.pop(); + tspan.text(line.join(" ").trim()); + if (word === "
") { + line = [""]; + } else { + line = [word]; + } + tspan = text2.append("tspan").attr("x", 0).attr("y", y).attr("dy", lineHeight + "em").text(word); + } + } + }); +} +const drawNode = function(elem, node, fullSection, conf2) { + const section = fullSection % MAX_SECTIONS - 1; + const nodeElem = elem.append("g"); + node.section = section; + nodeElem.attr( + "class", + (node.class ? node.class + " " : "") + "timeline-node " + ("section-" + section) + ); + const bkgElem = nodeElem.append("g"); + const textElem = nodeElem.append("g"); + const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width); + const bbox = txt.node().getBBox(); + const fontSize = conf2.fontSize && conf2.fontSize.replace ? conf2.fontSize.replace("px", "") : conf2.fontSize; + node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding; + node.height = Math.max(node.height, node.maxHeight); + node.width = node.width + 2 * node.padding; + textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")"); + defaultBkg(bkgElem, node, section); + return node; +}; +const getVirtualNodeHeight = function(elem, node, conf2) { + const textElem = elem.append("g"); + const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width); + const bbox = txt.node().getBBox(); + const fontSize = conf2.fontSize && conf2.fontSize.replace ? conf2.fontSize.replace("px", "") : conf2.fontSize; + textElem.remove(); + return bbox.height + fontSize * 1.1 * 0.5 + node.padding; +}; +const defaultBkg = function(elem, node, section) { + const rd = 5; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + node.type).attr( + "d", + `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z` + ); + elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height); +}; +const svgDraw = { + drawRect, + drawCircle, + drawSection, + drawText, + drawLabel, + drawTask, + drawBackgroundRect, + getTextObj, + getNoteRect, + initGraphics, + drawNode, + getVirtualNodeHeight +}; +const setConf = function(cnf) { + const keys = Object.keys(cnf); + keys.forEach(function(key) { + conf[key] = cnf[key]; + }); +}; +const draw = function(text, id, version, diagObj) { + const conf2 = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.g)(); + const LEFT_MARGIN = conf2.leftMargin ? conf2.leftMargin : 50; + diagObj.db.clear(); + diagObj.parser.parse(text + "\n"); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("timeline", diagObj.db); + const securityLevel = conf2.securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id); + } + const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body"); + const svg = root.select("#" + id); + svg.append("g"); + const tasks2 = diagObj.db.getTasks(); + const title = diagObj.db.getCommonDb().getDiagramTitle(); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("task", tasks2); + svgDraw.initGraphics(svg); + const sections2 = diagObj.db.getSections(); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sections", sections2); + let maxSectionHeight = 0; + let maxTaskHeight = 0; + let depthY = 0; + let sectionBeginY = 0; + let masterX = 50 + LEFT_MARGIN; + let masterY = 50; + sectionBeginY = 50; + let sectionNumber = 0; + let hasSections = true; + sections2.forEach(function(section) { + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: 150, + padding: 20, + maxHeight: maxSectionHeight + }; + const sectionHeight = svgDraw.getVirtualNodeHeight(svg, sectionNode, conf2); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sectionHeight before draw", sectionHeight); + maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20); + }); + let maxEventCount = 0; + let maxEventLineLength = 0; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("tasks.length", tasks2.length); + for (const [i, task] of tasks2.entries()) { + const taskNode = { + number: i, + descr: task, + section: task.section, + width: 150, + padding: 20, + maxHeight: maxTaskHeight + }; + const taskHeight = svgDraw.getVirtualNodeHeight(svg, taskNode, conf2); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("taskHeight before draw", taskHeight); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20); + maxEventCount = Math.max(maxEventCount, task.events.length); + let maxEventLineLengthTemp = 0; + for (let j = 0; j < task.events.length; j++) { + const event = task.events[j]; + const eventNode = { + descr: event, + section: task.section, + number: task.section, + width: 150, + padding: 20, + maxHeight: 50 + }; + maxEventLineLengthTemp += svgDraw.getVirtualNodeHeight(svg, eventNode, conf2); + } + maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp); + } + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("maxSectionHeight before draw", maxSectionHeight); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("maxTaskHeight before draw", maxTaskHeight); + if (sections2 && sections2.length > 0) { + sections2.forEach((section) => { + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: 150, + padding: 20, + maxHeight: maxSectionHeight + }; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sectionNode", sectionNode); + const sectionNodeWrapper = svg.append("g"); + const node = svgDraw.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf2); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("sectionNode output", node); + sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`); + masterY += maxSectionHeight + 50; + const tasksForSection = tasks2.filter((task) => task.section === section); + if (tasksForSection.length > 0) { + drawTasks( + svg, + tasksForSection, + sectionNumber, + masterX, + masterY, + maxTaskHeight, + conf2, + maxEventCount, + maxEventLineLength, + maxSectionHeight, + false + ); + } + masterX += 200 * Math.max(tasksForSection.length, 1); + masterY = sectionBeginY; + sectionNumber++; + }); + } else { + hasSections = false; + drawTasks( + svg, + tasks2, + sectionNumber, + masterX, + masterY, + maxTaskHeight, + conf2, + maxEventCount, + maxEventLineLength, + maxSectionHeight, + true + ); + } + const box = svg.node().getBBox(); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("bounds", box); + if (title) { + svg.append("text").text(title).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20); + } + depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100; + const lineWrapper = svg.append("g").attr("class", "lineWrapper"); + lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"); + (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.s)( + void 0, + svg, + conf2.timeline.padding ? conf2.timeline.padding : 50, + conf2.timeline.useMaxWidth ? conf2.timeline.useMaxWidth : false + ); +}; +const drawTasks = function(diagram2, tasks2, sectionColor, masterX, masterY, maxTaskHeight, conf2, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections) { + for (const task of tasks2) { + const taskNode = { + descr: task.task, + section: sectionColor, + number: sectionColor, + width: 150, + padding: 20, + maxHeight: maxTaskHeight + }; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("taskNode", taskNode); + const taskWrapper = diagram2.append("g").attr("class", "taskWrapper"); + const node = svgDraw.drawNode(taskWrapper, taskNode, sectionColor, conf2); + const taskHeight = node.height; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("taskHeight after draw", taskHeight); + taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight); + if (task.events) { + const lineWrapper = diagram2.append("g").attr("class", "lineWrapper"); + let linelength = maxTaskHeight; + masterY += 100; + linelength = linelength + drawEvents(diagram2, task.events, sectionColor, masterX, masterY, conf2); + masterY -= 100; + lineWrapper.append("line").attr("x1", masterX + 190 / 2).attr("y1", masterY + maxTaskHeight).attr("x2", masterX + 190 / 2).attr( + "y2", + masterY + maxTaskHeight + (isWithoutSections ? maxTaskHeight : maxSectionHeight) + maxEventLineLength + 120 + ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5"); + } + masterX = masterX + 200; + if (isWithoutSections && !(0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.g)().timeline.disableMulticolor) { + sectionColor++; + } + } + masterY = masterY - 10; +}; +const drawEvents = function(diagram2, events, sectionColor, masterX, masterY, conf2) { + let maxEventHeight = 0; + const eventBeginY = masterY; + masterY = masterY + 100; + for (const event of events) { + const eventNode = { + descr: event, + section: sectionColor, + number: sectionColor, + width: 150, + padding: 20, + maxHeight: 50 + }; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_11__.l.debug("eventNode", eventNode); + const eventWrapper = diagram2.append("g").attr("class", "eventWrapper"); + const node = svgDraw.drawNode(eventWrapper, eventNode, sectionColor, conf2); + const eventHeight = node.height; + maxEventHeight = maxEventHeight + eventHeight; + eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`); + masterY = masterY + 10 + eventHeight; + } + masterY = eventBeginY; + return maxEventHeight; +}; +const renderer = { + setConf, + draw +}; +const genSections = (options) => { + let sections2 = ""; + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i]; + if ((0,khroma__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)(options["lineColor" + i])) { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } else { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } + } + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + const sw = "" + (17 - 3 * i); + sections2 += ` + .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} path { + fill: ${options["cScale" + i]}; + } + .section-${i - 1} text { + fill: ${options["cScaleLabel" + i]}; + } + .node-icon-${i - 1} { + font-size: 40px; + color: ${options["cScaleLabel" + i]}; + } + .section-edge-${i - 1}{ + stroke: ${options["cScale" + i]}; + } + .edge-depth-${i - 1}{ + stroke-width: ${sw}; + } + .section-${i - 1} line { + stroke: ${options["cScaleInv" + i]} ; + stroke-width: 3; + } + + .lineWrapper line{ + stroke: ${options["cScaleLabel" + i]} ; + } + + .disabled, .disabled circle, .disabled text { + fill: lightgray; + } + .disabled text { + fill: #efefef; + } + `; + } + return sections2; +}; +const getStyles = (options) => ` + .edge { + stroke-width: 3; + } + ${genSections(options)} + .section-root rect, .section-root path, .section-root circle { + fill: ${options.git0}; + } + .section-root text { + fill: ${options.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .eventWrapper { + filter: brightness(120%); + } +`; +const styles = getStyles; +const diagram = { + db, + renderer, + parser: parser$1, + styles +}; + +//# sourceMappingURL=timeline-definition-8e5a9bc6.js.map + + +/***/ }), + +/***/ 75627: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + Z: () => (/* binding */ is_dark) +}); + +// EXTERNAL MODULE: ../node_modules/khroma/dist/utils/index.js + 3 modules +var utils = __webpack_require__(83445); +// EXTERNAL MODULE: ../node_modules/khroma/dist/color/index.js + 4 modules +var dist_color = __webpack_require__(31739); +;// CONCATENATED MODULE: ../node_modules/khroma/dist/methods/luminance.js +/* IMPORT */ + + +/* MAIN */ +//SOURCE: https://planetcalc.com/7779 +const luminance = (color) => { + const { r, g, b } = dist_color/* default */.Z.parse(color); + const luminance = .2126 * utils/* default */.Z.channel.toLinear(r) + .7152 * utils/* default */.Z.channel.toLinear(g) + .0722 * utils/* default */.Z.channel.toLinear(b); + return utils/* default */.Z.lang.round(luminance); +}; +/* EXPORT */ +/* harmony default export */ const methods_luminance = (luminance); + +;// CONCATENATED MODULE: ../node_modules/khroma/dist/methods/is_light.js +/* IMPORT */ + +/* MAIN */ +const isLight = (color) => { + return methods_luminance(color) >= .5; +}; +/* EXPORT */ +/* harmony default export */ const is_light = (isLight); + +;// CONCATENATED MODULE: ../node_modules/khroma/dist/methods/is_dark.js +/* IMPORT */ + +/* MAIN */ +const isDark = (color) => { + return !is_light(color); +}; +/* EXPORT */ +/* harmony default export */ const is_dark = (isDark); + + +/***/ }) + +}; +; \ No newline at end of file diff --git a/assets/js/17139236.c59e42e1.js b/assets/js/17139236.c59e42e1.js new file mode 100644 index 00000000000..4e8a03e2420 --- /dev/null +++ b/assets/js/17139236.c59e42e1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6537],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=a,g=u["".concat(p,".").concat(d)]||u[d]||m[d]||i;return n?r.createElement(g,o(o({ref:t},c),{},{components:n})):r.createElement(g,o({ref:t},c))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Random Number Generator service"},o="Rng",l={unversionedId:"api/clients/rng",id:"api/clients/rng",title:"Rng",description:"DeviceScript client for Random Number Generator service",source:"@site/docs/api/clients/rng.md",sourceDirName:"api/clients",slug:"/api/clients/rng",permalink:"/devicescript/api/clients/rng",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Random Number Generator service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"random",id:"ro:random",level:3},{value:"variant",id:"const:variant",level:3}],c={toc:s},u="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"rng"},"Rng"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"Generates random numbers using entropy sourced from physical processes."),(0,a.kt)("p",null,"This typically uses a cryptographical pseudo-random number generator (for example ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Fortuna_(PRNG)"},"Fortuna"),"),\nwhich is periodically re-seeded with entropy coming from some hardware source."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Rng } from "@devicescript/core"\n\nconst rng = new Rng()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:random"},"random"),(0,a.kt)("p",null,"A register that returns a 64 bytes random buffer on every request.\nThis never blocks for a long time. If you need additional random bytes, keep querying the register."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"b"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Rng } from "@devicescript/core"\n\nconst rng = new Rng()\n// ...\nrng.random.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"The type of algorithm/technique used to generate the number.\n",(0,a.kt)("inlineCode",{parentName:"p"},"Quantum")," refers to dedicated hardware device generating random noise due to quantum effects.\n",(0,a.kt)("inlineCode",{parentName:"p"},"ADCNoise")," is the noise from quick readings of analog-digital converter, which reads temperature of the MCU or some floating pin.\n",(0,a.kt)("inlineCode",{parentName:"p"},"WebCrypto")," refers is used in simulators, where the source of randomness comes from an advanced operating system."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Rng } from "@devicescript/core"\n\nconst rng = new Rng()\n// ...\nconst value = await rng.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/174cc3bf.cd8d0986.js b/assets/js/174cc3bf.cd8d0986.js new file mode 100644 index 00000000000..bd577001bec --- /dev/null +++ b/assets/js/174cc3bf.cd8d0986.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4690],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>v});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(r),u=a,v=d["".concat(l,".").concat(u)]||d[u]||m[u]||i;return r?n.createElement(v,o(o({ref:t},s),{},{components:r})):n.createElement(v,o({ref:t},s))}));function v(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=u;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=r(25773),a=(r(27378),r(35318));const i={sidebar_position:2,description:"Learn how to collect usage telemetry of your DeviceScript using trackEvent, trackMetric, and trackException methods.",keywords:["DeviceScript","telemetry","trackEvent","trackMetric","trackException"]},o="Application Telemetry",c={unversionedId:"developer/development-gateway/telemetry",id:"developer/development-gateway/telemetry",title:"Application Telemetry",description:"Learn how to collect usage telemetry of your DeviceScript using trackEvent, trackMetric, and trackException methods.",source:"@site/docs/developer/development-gateway/telemetry.mdx",sourceDirName:"developer/development-gateway",slug:"/developer/development-gateway/telemetry",permalink:"/devicescript/developer/development-gateway/telemetry",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Learn how to collect usage telemetry of your DeviceScript using trackEvent, trackMetric, and trackException methods.",keywords:["DeviceScript","telemetry","trackEvent","trackMetric","trackException"]},sidebar:"tutorialSidebar",previous:{title:"Messages",permalink:"/devicescript/developer/development-gateway/messages"},next:{title:"Environment",permalink:"/devicescript/developer/development-gateway/environment"}},l={},p=[{value:"Exceptions",id:"exceptions",level:3},{value:"Events",id:"events",level:3},{value:"Metrics",id:"metrics",level:3}],s={toc:p},d="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(d,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"application-telemetry"},"Application Telemetry"),(0,a.kt)("p",null,"You can collect usage telemetry of your DeviceScript using ",(0,a.kt)("inlineCode",{parentName:"p"},"trackEvent")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"trackMetric")),(0,a.kt)("p",null,"When connected to the gateway, the device is modelled as a user and the connection as a session.\nThe data is injected directly\nin ",(0,a.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview"},"Application Insights"),"\nand can be analyzed through the Azure portal."),(0,a.kt)("h3",{id:"exceptions"},"Exceptions"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"trackException")," method uploads an exception to Application Insights. The stacktrace information is expanded in the gateway."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { trackException } from "@devicescript/cloud"\n\ntry {\n throw new Error("noes!")\n} catch (e) {\n // highlight-next-line\n await trackException(e as Error)\n}\n')),(0,a.kt)("h3",{id:"events"},"Events"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"trackEvent")," method creates custom events in application insights. The event may be buffered or sampled\nto reduce the network load."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { trackEvent } from "@devicescript/cloud"\n\n// highlight-next-line\nawait trackEvent("started")\n')),(0,a.kt)("h3",{id:"metrics"},"Metrics"),(0,a.kt)("p",null,"The metric aggregates a numberical value and upload the aggregate when requested."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { createMetric } from "@devicescript/cloud"\n\nconst thermo = new Temperature()\n// highlight-next-line\nconst temp = createMetric("temp")\n// highlight-next-line\nthermo.reading.subscribe(async t => temp.add(t))\nsetInterval(async () => {\n // highlight-next-line\n await temp.upload()\n}, 30000)\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/178.df30bf5f.js b/assets/js/178.df30bf5f.js new file mode 100644 index 00000000000..c094d112e7a --- /dev/null +++ b/assets/js/178.df30bf5f.js @@ -0,0 +1,7370 @@ +exports.id = 178; +exports.ids = [178]; +exports.modules = { + +/***/ 26746: +/***/ ((module) => { + +(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$defaultLayoutOpt = _ref.defaultLayoutOptions, + defaultLayoutOptions = _ref$defaultLayoutOpt === undefined ? {} : _ref$defaultLayoutOpt, + _ref$algorithms = _ref.algorithms, + algorithms = _ref$algorithms === undefined ? ['layered', 'stress', 'mrtree', 'radial', 'force', 'disco', 'sporeOverlap', 'sporeCompaction', 'rectpacking'] : _ref$algorithms, + workerFactory = _ref.workerFactory, + workerUrl = _ref.workerUrl; + + _classCallCheck(this, ELK); + + this.defaultLayoutOptions = defaultLayoutOptions; + this.initialized = false; + + // check valid worker construction possible + if (typeof workerUrl === 'undefined' && typeof workerFactory === 'undefined') { + throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'."); + } + var factory = workerFactory; + if (typeof workerUrl !== 'undefined' && typeof workerFactory === 'undefined') { + // use default Web Worker + factory = function factory(url) { + return new Worker(url); + }; + } + + // create the worker + var worker = factory(workerUrl); + if (typeof worker.postMessage !== 'function') { + throw new TypeError("Created worker does not provide" + " the required 'postMessage' function."); + } + + // wrap the worker to return promises + this.worker = new PromisedWorker(worker); + + // initially register algorithms + this.worker.postMessage({ + cmd: 'register', + algorithms: algorithms + }).then(function (r) { + return _this.initialized = true; + }).catch(console.err); + } + + _createClass(ELK, [{ + key: 'layout', + value: function layout(graph) { + var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref2$layoutOptions = _ref2.layoutOptions, + layoutOptions = _ref2$layoutOptions === undefined ? this.defaultLayoutOptions : _ref2$layoutOptions, + _ref2$logging = _ref2.logging, + logging = _ref2$logging === undefined ? false : _ref2$logging, + _ref2$measureExecutio = _ref2.measureExecutionTime, + measureExecutionTime = _ref2$measureExecutio === undefined ? false : _ref2$measureExecutio; + + if (!graph) { + return Promise.reject(new Error("Missing mandatory parameter 'graph'.")); + } + return this.worker.postMessage({ + cmd: 'layout', + graph: graph, + layoutOptions: layoutOptions, + options: { + logging: logging, + measureExecutionTime: measureExecutionTime + } + }); + } + }, { + key: 'knownLayoutAlgorithms', + value: function knownLayoutAlgorithms() { + return this.worker.postMessage({ cmd: 'algorithms' }); + } + }, { + key: 'knownLayoutOptions', + value: function knownLayoutOptions() { + return this.worker.postMessage({ cmd: 'options' }); + } + }, { + key: 'knownLayoutCategories', + value: function knownLayoutCategories() { + return this.worker.postMessage({ cmd: 'categories' }); + } + }, { + key: 'terminateWorker', + value: function terminateWorker() { + this.worker.terminate(); + } + }]); + + return ELK; +}(); + +exports.default = ELK; + +var PromisedWorker = function () { + function PromisedWorker(worker) { + var _this2 = this; + + _classCallCheck(this, PromisedWorker); + + if (worker === undefined) { + throw new Error("Missing mandatory parameter 'worker'."); + } + this.resolvers = {}; + this.worker = worker; + this.worker.onmessage = function (answer) { + // why is this necessary? + setTimeout(function () { + _this2.receive(_this2, answer); + }, 0); + }; + } + + _createClass(PromisedWorker, [{ + key: 'postMessage', + value: function postMessage(msg) { + var id = this.id || 0; + this.id = id + 1; + msg.id = id; + var self = this; + return new Promise(function (resolve, reject) { + // prepare the resolver + self.resolvers[id] = function (err, res) { + if (err) { + self.convertGwtStyleError(err); + reject(err); + } else { + resolve(res); + } + }; + // post the message + self.worker.postMessage(msg); + }); + } + }, { + key: 'receive', + value: function receive(self, answer) { + var json = answer.data; + var resolver = self.resolvers[json.id]; + if (resolver) { + delete self.resolvers[json.id]; + if (json.error) { + resolver(json.error); + } else { + resolver(null, json.data); + } + } + } + }, { + key: 'terminate', + value: function terminate() { + if (this.worker.terminate) { + this.worker.terminate(); + } + } + }, { + key: 'convertGwtStyleError', + value: function convertGwtStyleError(err) { + if (!err) { + return; + } + // Somewhat flatten the way GWT stores nested exception(s) + var javaException = err['__java$exception']; + if (javaException) { + // Note that the property name of the nested exception is different + // in the non-minified ('cause') and the minified (not deterministic) version. + // Hence, the version below only works for the non-minified version. + // However, as the minified stack trace is not of much use anyway, one + // should switch the used version for debugging in such a case. + if (javaException.cause && javaException.cause.backingJsObject) { + err.cause = javaException.cause.backingJsObject; + this.convertGwtStyleError(err.cause); + } + delete err['__java$exception']; + } + } + }]); + + return PromisedWorker; +}(); +},{}],2:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +// -------------- FAKE ELEMENTS GWT ASSUMES EXIST -------------- +var $wnd; +if (typeof window !== 'undefined') + $wnd = window +else if (typeof global !== 'undefined') + $wnd = global // nodejs +else if (typeof self !== 'undefined') + $wnd = self // web worker + +var $moduleName, + $moduleBase; + +// -------------- WORKAROUND STRICT MODE, SEE #127 -------------- +var g, i, o; + +// -------------- GENERATED CODE -------------- +function nb(){} +function xb(){} +function Fd(){} +function $g(){} +function _p(){} +function yq(){} +function Sq(){} +function Es(){} +function Jw(){} +function Vw(){} +function VA(){} +function dA(){} +function MA(){} +function PA(){} +function PB(){} +function bx(){} +function cx(){} +function vy(){} +function Nz(){} +function Yz(){} +function Ylb(){} +function Ymb(){} +function xmb(){} +function Fmb(){} +function Qmb(){} +function gcb(){} +function ccb(){} +function jcb(){} +function jtb(){} +function otb(){} +function qtb(){} +function _fb(){} +function bpb(){} +function kpb(){} +function ppb(){} +function Gpb(){} +function drb(){} +function dzb(){} +function fzb(){} +function fxb(){} +function Vxb(){} +function Ovb(){} +function byb(){} +function zyb(){} +function Zyb(){} +function _yb(){} +function hzb(){} +function jzb(){} +function lzb(){} +function nzb(){} +function rzb(){} +function zzb(){} +function Czb(){} +function Ezb(){} +function Gzb(){} +function Izb(){} +function Mzb(){} +function bBb(){} +function NBb(){} +function PBb(){} +function RBb(){} +function iCb(){} +function OCb(){} +function SCb(){} +function GDb(){} +function JDb(){} +function fEb(){} +function xEb(){} +function CEb(){} +function GEb(){} +function yFb(){} +function KGb(){} +function tIb(){} +function vIb(){} +function xIb(){} +function zIb(){} +function OIb(){} +function SIb(){} +function TJb(){} +function VJb(){} +function XJb(){} +function XKb(){} +function fKb(){} +function VKb(){} +function VLb(){} +function jLb(){} +function nLb(){} +function GLb(){} +function KLb(){} +function MLb(){} +function OLb(){} +function RLb(){} +function YLb(){} +function bMb(){} +function gMb(){} +function lMb(){} +function pMb(){} +function wMb(){} +function zMb(){} +function CMb(){} +function FMb(){} +function LMb(){} +function zNb(){} +function PNb(){} +function kOb(){} +function pOb(){} +function tOb(){} +function yOb(){} +function FOb(){} +function GPb(){} +function aQb(){} +function cQb(){} +function eQb(){} +function gQb(){} +function iQb(){} +function CQb(){} +function MQb(){} +function OQb(){} +function ASb(){} +function fTb(){} +function kTb(){} +function STb(){} +function fUb(){} +function DUb(){} +function VUb(){} +function YUb(){} +function _Ub(){} +function _Wb(){} +function QWb(){} +function XWb(){} +function jVb(){} +function DVb(){} +function VVb(){} +function $Vb(){} +function dXb(){} +function hXb(){} +function lXb(){} +function gYb(){} +function HYb(){} +function SYb(){} +function VYb(){} +function dZb(){} +function P$b(){} +function T$b(){} +function h1b(){} +function m1b(){} +function q1b(){} +function u1b(){} +function y1b(){} +function C1b(){} +function e2b(){} +function g2b(){} +function m2b(){} +function q2b(){} +function u2b(){} +function S2b(){} +function U2b(){} +function W2b(){} +function _2b(){} +function e3b(){} +function h3b(){} +function p3b(){} +function t3b(){} +function w3b(){} +function y3b(){} +function A3b(){} +function M3b(){} +function Q3b(){} +function U3b(){} +function Y3b(){} +function l4b(){} +function q4b(){} +function s4b(){} +function u4b(){} +function w4b(){} +function y4b(){} +function L4b(){} +function N4b(){} +function P4b(){} +function R4b(){} +function T4b(){} +function X4b(){} +function I5b(){} +function Q5b(){} +function T5b(){} +function Z5b(){} +function l6b(){} +function o6b(){} +function t6b(){} +function z6b(){} +function L6b(){} +function M6b(){} +function P6b(){} +function X6b(){} +function $6b(){} +function a7b(){} +function c7b(){} +function g7b(){} +function j7b(){} +function m7b(){} +function r7b(){} +function x7b(){} +function D7b(){} +function D9b(){} +function b9b(){} +function h9b(){} +function j9b(){} +function l9b(){} +function w9b(){} +function F9b(){} +function hac(){} +function jac(){} +function pac(){} +function uac(){} +function Iac(){} +function Kac(){} +function Sac(){} +function obc(){} +function rbc(){} +function vbc(){} +function Fbc(){} +function Jbc(){} +function Xbc(){} +function ccc(){} +function fcc(){} +function lcc(){} +function occ(){} +function tcc(){} +function ycc(){} +function Acc(){} +function Ccc(){} +function Ecc(){} +function Gcc(){} +function Zcc(){} +function _cc(){} +function bdc(){} +function fdc(){} +function jdc(){} +function pdc(){} +function sdc(){} +function ydc(){} +function Adc(){} +function Cdc(){} +function Edc(){} +function Idc(){} +function Ndc(){} +function Qdc(){} +function Sdc(){} +function Udc(){} +function Wdc(){} +function Ydc(){} +function aec(){} +function hec(){} +function jec(){} +function lec(){} +function nec(){} +function uec(){} +function wec(){} +function yec(){} +function Aec(){} +function Fec(){} +function Jec(){} +function Lec(){} +function Nec(){} +function Rec(){} +function Uec(){} +function Zec(){} +function Zfc(){} +function lfc(){} +function tfc(){} +function xfc(){} +function zfc(){} +function Ffc(){} +function Jfc(){} +function Nfc(){} +function Pfc(){} +function Vfc(){} +function _fc(){} +function fgc(){} +function jgc(){} +function lgc(){} +function Bgc(){} +function ehc(){} +function ghc(){} +function ihc(){} +function khc(){} +function mhc(){} +function ohc(){} +function qhc(){} +function yhc(){} +function Ahc(){} +function Ghc(){} +function Ihc(){} +function Khc(){} +function Mhc(){} +function Shc(){} +function Uhc(){} +function Whc(){} +function dic(){} +function dlc(){} +function blc(){} +function flc(){} +function hlc(){} +function jlc(){} +function Glc(){} +function Ilc(){} +function Klc(){} +function Mlc(){} +function Mjc(){} +function Qjc(){} +function Qlc(){} +function Ulc(){} +function Ylc(){} +function Lkc(){} +function Nkc(){} +function Pkc(){} +function Rkc(){} +function Xkc(){} +function _kc(){} +function gmc(){} +function kmc(){} +function zmc(){} +function Fmc(){} +function Wmc(){} +function $mc(){} +function anc(){} +function mnc(){} +function wnc(){} +function Hnc(){} +function Jnc(){} +function Lnc(){} +function Nnc(){} +function Pnc(){} +function Ync(){} +function eoc(){} +function Aoc(){} +function Coc(){} +function Eoc(){} +function Joc(){} +function Loc(){} +function Zoc(){} +function _oc(){} +function bpc(){} +function hpc(){} +function kpc(){} +function ppc(){} +function pFc(){} +function Ryc(){} +function QCc(){} +function PDc(){} +function xGc(){} +function HGc(){} +function JGc(){} +function NGc(){} +function GIc(){} +function iKc(){} +function mKc(){} +function wKc(){} +function yKc(){} +function AKc(){} +function EKc(){} +function KKc(){} +function OKc(){} +function QKc(){} +function SKc(){} +function UKc(){} +function YKc(){} +function aLc(){} +function fLc(){} +function hLc(){} +function nLc(){} +function pLc(){} +function tLc(){} +function vLc(){} +function zLc(){} +function BLc(){} +function DLc(){} +function FLc(){} +function sMc(){} +function JMc(){} +function hNc(){} +function RNc(){} +function ZNc(){} +function _Nc(){} +function bOc(){} +function dOc(){} +function fOc(){} +function hOc(){} +function hRc(){} +function jRc(){} +function KRc(){} +function NRc(){} +function NQc(){} +function LQc(){} +function _Qc(){} +function cPc(){} +function iPc(){} +function kPc(){} +function mPc(){} +function xPc(){} +function zPc(){} +function zSc(){} +function BSc(){} +function GSc(){} +function ISc(){} +function NSc(){} +function TSc(){} +function NTc(){} +function NVc(){} +function oVc(){} +function SVc(){} +function VVc(){} +function XVc(){} +function ZVc(){} +function bWc(){} +function bXc(){} +function CXc(){} +function FXc(){} +function IXc(){} +function MXc(){} +function UXc(){} +function bYc(){} +function fYc(){} +function oYc(){} +function qYc(){} +function uYc(){} +function pZc(){} +function G$c(){} +function h0c(){} +function N0c(){} +function k1c(){} +function I1c(){} +function Q1c(){} +function f2c(){} +function i2c(){} +function k2c(){} +function w2c(){} +function O2c(){} +function S2c(){} +function Z2c(){} +function v3c(){} +function x3c(){} +function R3c(){} +function U3c(){} +function e4c(){} +function w4c(){} +function x4c(){} +function z4c(){} +function B4c(){} +function D4c(){} +function F4c(){} +function H4c(){} +function J4c(){} +function L4c(){} +function N4c(){} +function P4c(){} +function R4c(){} +function T4c(){} +function V4c(){} +function X4c(){} +function Z4c(){} +function _4c(){} +function _7c(){} +function b5c(){} +function d5c(){} +function f5c(){} +function h5c(){} +function H5c(){} +function Hfd(){} +function Zfd(){} +function Zed(){} +function ged(){} +function Jed(){} +function Ned(){} +function Red(){} +function Ved(){} +function bbd(){} +function mdd(){} +function _fd(){} +function fgd(){} +function kgd(){} +function Mgd(){} +function Ahd(){} +function Ald(){} +function Tld(){} +function xkd(){} +function rmd(){} +function knd(){} +function Jod(){} +function JCd(){} +function Bpd(){} +function BFd(){} +function oFd(){} +function bqd(){} +function bvd(){} +function jvd(){} +function yud(){} +function Hxd(){} +function EBd(){} +function aDd(){} +function MGd(){} +function vHd(){} +function RHd(){} +function wNd(){} +function zNd(){} +function CNd(){} +function KNd(){} +function XNd(){} +function $Nd(){} +function HPd(){} +function lUd(){} +function XUd(){} +function DWd(){} +function GWd(){} +function JWd(){} +function MWd(){} +function PWd(){} +function SWd(){} +function VWd(){} +function YWd(){} +function _Wd(){} +function xYd(){} +function BYd(){} +function mZd(){} +function EZd(){} +function GZd(){} +function JZd(){} +function MZd(){} +function PZd(){} +function SZd(){} +function VZd(){} +function YZd(){} +function _Zd(){} +function c$d(){} +function f$d(){} +function i$d(){} +function l$d(){} +function o$d(){} +function r$d(){} +function u$d(){} +function x$d(){} +function A$d(){} +function D$d(){} +function G$d(){} +function J$d(){} +function M$d(){} +function P$d(){} +function S$d(){} +function V$d(){} +function Y$d(){} +function _$d(){} +function c_d(){} +function f_d(){} +function i_d(){} +function l_d(){} +function o_d(){} +function r_d(){} +function u_d(){} +function x_d(){} +function A_d(){} +function D_d(){} +function G_d(){} +function J_d(){} +function M_d(){} +function P_d(){} +function S_d(){} +function V_d(){} +function Y_d(){} +function h5d(){} +function U6d(){} +function U9d(){} +function _8d(){} +function fae(){} +function hae(){} +function kae(){} +function nae(){} +function qae(){} +function tae(){} +function wae(){} +function zae(){} +function Cae(){} +function Fae(){} +function Iae(){} +function Lae(){} +function Oae(){} +function Rae(){} +function Uae(){} +function Xae(){} +function $ae(){} +function bbe(){} +function ebe(){} +function hbe(){} +function kbe(){} +function nbe(){} +function qbe(){} +function tbe(){} +function wbe(){} +function zbe(){} +function Cbe(){} +function Fbe(){} +function Ibe(){} +function Lbe(){} +function Obe(){} +function Rbe(){} +function Ube(){} +function Xbe(){} +function $be(){} +function bce(){} +function ece(){} +function hce(){} +function kce(){} +function nce(){} +function qce(){} +function tce(){} +function wce(){} +function zce(){} +function Cce(){} +function Fce(){} +function Ice(){} +function Lce(){} +function Oce(){} +function Rce(){} +function Uce(){} +function Xce(){} +function ude(){} +function Vge(){} +function dhe(){} +function s_b(a){} +function jSd(a){} +function ol(){wb()} +function oPb(){nPb()} +function EPb(){CPb()} +function gFb(){fFb()} +function TRb(){SRb()} +function ySb(){wSb()} +function PSb(){OSb()} +function dTb(){bTb()} +function i4b(){b4b()} +function D2b(){x2b()} +function J6b(){D6b()} +function u9b(){q9b()} +function $9b(){I9b()} +function Umc(){Imc()} +function abc(){Vac()} +function ZCc(){VCc()} +function kCc(){hCc()} +function rCc(){oCc()} +function Tcc(){Occ()} +function xkc(){gkc()} +function xDc(){rDc()} +function iDc(){cDc()} +function kwc(){jwc()} +function tJc(){jJc()} +function dJc(){aJc()} +function Pyc(){Nyc()} +function VBc(){SBc()} +function CFc(){yFc()} +function CUc(){wUc()} +function lUc(){fUc()} +function sUc(){pUc()} +function IUc(){GUc()} +function IWc(){HWc()} +function _Wc(){ZWc()} +function fHc(){dHc()} +function f0c(){d0c()} +function B0c(){A0c()} +function L0c(){J0c()} +function LTc(){JTc()} +function sTc(){rTc()} +function KLc(){ILc()} +function wNc(){tNc()} +function PYc(){OYc()} +function nZc(){lZc()} +function q3c(){p3c()} +function Z7c(){X7c()} +function Z9c(){Y9c()} +function _ad(){Zad()} +function kdd(){idd()} +function $md(){Smd()} +function HGd(){tGd()} +function hLd(){NKd()} +function J6d(){Uge()} +function Mvb(a){uCb(a)} +function Yb(a){this.a=a} +function cc(a){this.a=a} +function cj(a){this.a=a} +function ij(a){this.a=a} +function Dj(a){this.a=a} +function df(a){this.a=a} +function kf(a){this.a=a} +function ah(a){this.a=a} +function lh(a){this.a=a} +function th(a){this.a=a} +function Ph(a){this.a=a} +function vi(a){this.a=a} +function Ci(a){this.a=a} +function Fk(a){this.a=a} +function Ln(a){this.a=a} +function ap(a){this.a=a} +function zp(a){this.a=a} +function Yp(a){this.a=a} +function qq(a){this.a=a} +function Dq(a){this.a=a} +function wr(a){this.a=a} +function Ir(a){this.b=a} +function sj(a){this.c=a} +function sw(a){this.a=a} +function fw(a){this.a=a} +function xw(a){this.a=a} +function Cw(a){this.a=a} +function Qw(a){this.a=a} +function Rw(a){this.a=a} +function Xw(a){this.a=a} +function Xv(a){this.a=a} +function Sv(a){this.a=a} +function eu(a){this.a=a} +function Zx(a){this.a=a} +function _x(a){this.a=a} +function xy(a){this.a=a} +function xB(a){this.a=a} +function HB(a){this.a=a} +function TB(a){this.a=a} +function fC(a){this.a=a} +function wB(){this.a=[]} +function MBb(a,b){a.a=b} +function w_b(a,b){a.a=b} +function x_b(a,b){a.b=b} +function YOb(a,b){a.b=b} +function $Ob(a,b){a.b=b} +function ZGb(a,b){a.j=b} +function qNb(a,b){a.g=b} +function rNb(a,b){a.i=b} +function dRb(a,b){a.c=b} +function eRb(a,b){a.d=b} +function z_b(a,b){a.d=b} +function y_b(a,b){a.c=b} +function __b(a,b){a.k=b} +function E0b(a,b){a.c=b} +function njc(a,b){a.c=b} +function mjc(a,b){a.a=b} +function dFc(a,b){a.a=b} +function eFc(a,b){a.f=b} +function nOc(a,b){a.a=b} +function oOc(a,b){a.b=b} +function pOc(a,b){a.d=b} +function qOc(a,b){a.i=b} +function rOc(a,b){a.o=b} +function sOc(a,b){a.r=b} +function $Pc(a,b){a.a=b} +function _Pc(a,b){a.b=b} +function DVc(a,b){a.e=b} +function EVc(a,b){a.f=b} +function FVc(a,b){a.g=b} +function SZc(a,b){a.e=b} +function TZc(a,b){a.f=b} +function c$c(a,b){a.f=b} +function bJd(a,b){a.n=b} +function A1d(a,b){a.a=b} +function J1d(a,b){a.a=b} +function B1d(a,b){a.c=b} +function K1d(a,b){a.c=b} +function L1d(a,b){a.d=b} +function M1d(a,b){a.e=b} +function N1d(a,b){a.g=b} +function d2d(a,b){a.a=b} +function e2d(a,b){a.c=b} +function f2d(a,b){a.d=b} +function g2d(a,b){a.e=b} +function h2d(a,b){a.f=b} +function i2d(a,b){a.j=b} +function Z8d(a,b){a.a=b} +function $8d(a,b){a.b=b} +function g9d(a,b){a.a=b} +function Cic(a){a.b=a.a} +function Dg(a){a.c=a.d.d} +function vib(a){this.d=a} +function eib(a){this.a=a} +function Pib(a){this.a=a} +function Vib(a){this.a=a} +function $ib(a){this.a=a} +function mcb(a){this.a=a} +function Mcb(a){this.a=a} +function Xcb(a){this.a=a} +function Ndb(a){this.a=a} +function _db(a){this.a=a} +function teb(a){this.a=a} +function Qeb(a){this.a=a} +function djb(a){this.a=a} +function Gjb(a){this.a=a} +function Njb(a){this.a=a} +function Bjb(a){this.b=a} +function lnb(a){this.b=a} +function Dnb(a){this.b=a} +function anb(a){this.a=a} +function Mob(a){this.a=a} +function Rob(a){this.a=a} +function iob(a){this.c=a} +function olb(a){this.c=a} +function qub(a){this.c=a} +function Tub(a){this.a=a} +function Vub(a){this.a=a} +function Xub(a){this.a=a} +function Zub(a){this.a=a} +function tpb(a){this.a=a} +function _pb(a){this.a=a} +function Wqb(a){this.a=a} +function nsb(a){this.a=a} +function Rxb(a){this.a=a} +function Txb(a){this.a=a} +function Xxb(a){this.a=a} +function bzb(a){this.a=a} +function tzb(a){this.a=a} +function vzb(a){this.a=a} +function xzb(a){this.a=a} +function Kzb(a){this.a=a} +function Ozb(a){this.a=a} +function iAb(a){this.a=a} +function kAb(a){this.a=a} +function mAb(a){this.a=a} +function BAb(a){this.a=a} +function hBb(a){this.a=a} +function jBb(a){this.a=a} +function nBb(a){this.a=a} +function TBb(a){this.a=a} +function XBb(a){this.a=a} +function QCb(a){this.a=a} +function WCb(a){this.a=a} +function _Cb(a){this.a=a} +function dEb(a){this.a=a} +function QGb(a){this.a=a} +function YGb(a){this.a=a} +function tKb(a){this.a=a} +function CLb(a){this.a=a} +function JMb(a){this.a=a} +function RNb(a){this.a=a} +function kQb(a){this.a=a} +function mQb(a){this.a=a} +function FQb(a){this.a=a} +function ETb(a){this.a=a} +function UTb(a){this.a=a} +function dUb(a){this.a=a} +function hUb(a){this.a=a} +function EZb(a){this.a=a} +function j$b(a){this.a=a} +function v$b(a){this.e=a} +function J0b(a){this.a=a} +function M0b(a){this.a=a} +function R0b(a){this.a=a} +function U0b(a){this.a=a} +function i2b(a){this.a=a} +function k2b(a){this.a=a} +function o2b(a){this.a=a} +function s2b(a){this.a=a} +function G2b(a){this.a=a} +function I2b(a){this.a=a} +function K2b(a){this.a=a} +function M2b(a){this.a=a} +function W3b(a){this.a=a} +function $3b(a){this.a=a} +function V4b(a){this.a=a} +function u5b(a){this.a=a} +function A7b(a){this.a=a} +function G7b(a){this.a=a} +function J7b(a){this.a=a} +function M7b(a){this.a=a} +function Mbc(a){this.a=a} +function Pbc(a){this.a=a} +function lac(a){this.a=a} +function nac(a){this.a=a} +function qcc(a){this.a=a} +function Gdc(a){this.a=a} +function $dc(a){this.a=a} +function cec(a){this.a=a} +function _ec(a){this.a=a} +function pfc(a){this.a=a} +function Bfc(a){this.a=a} +function Lfc(a){this.a=a} +function ygc(a){this.a=a} +function Dgc(a){this.a=a} +function shc(a){this.a=a} +function uhc(a){this.a=a} +function whc(a){this.a=a} +function Chc(a){this.a=a} +function Ehc(a){this.a=a} +function Ohc(a){this.a=a} +function Yhc(a){this.a=a} +function Tkc(a){this.a=a} +function Vkc(a){this.a=a} +function Olc(a){this.a=a} +function pnc(a){this.a=a} +function rnc(a){this.a=a} +function dpc(a){this.a=a} +function fpc(a){this.a=a} +function GCc(a){this.a=a} +function KCc(a){this.a=a} +function mDc(a){this.a=a} +function jEc(a){this.a=a} +function HEc(a){this.a=a} +function FEc(a){this.c=a} +function qoc(a){this.b=a} +function bFc(a){this.a=a} +function GFc(a){this.a=a} +function iGc(a){this.a=a} +function kGc(a){this.a=a} +function mGc(a){this.a=a} +function $Gc(a){this.a=a} +function hIc(a){this.a=a} +function lIc(a){this.a=a} +function pIc(a){this.a=a} +function tIc(a){this.a=a} +function xIc(a){this.a=a} +function zIc(a){this.a=a} +function CIc(a){this.a=a} +function LIc(a){this.a=a} +function CKc(a){this.a=a} +function IKc(a){this.a=a} +function MKc(a){this.a=a} +function $Kc(a){this.a=a} +function cLc(a){this.a=a} +function jLc(a){this.a=a} +function rLc(a){this.a=a} +function xLc(a){this.a=a} +function OMc(a){this.a=a} +function ZOc(a){this.a=a} +function ZRc(a){this.a=a} +function aSc(a){this.a=a} +function I$c(a){this.a=a} +function K$c(a){this.a=a} +function M$c(a){this.a=a} +function O$c(a){this.a=a} +function U$c(a){this.a=a} +function n1c(a){this.a=a} +function z1c(a){this.a=a} +function B1c(a){this.a=a} +function Q2c(a){this.a=a} +function U2c(a){this.a=a} +function z3c(a){this.a=a} +function med(a){this.a=a} +function Xed(a){this.a=a} +function _ed(a){this.a=a} +function Qfd(a){this.a=a} +function Bgd(a){this.a=a} +function $gd(a){this.a=a} +function lrd(a){this.a=a} +function urd(a){this.a=a} +function vrd(a){this.a=a} +function wrd(a){this.a=a} +function xrd(a){this.a=a} +function yrd(a){this.a=a} +function zrd(a){this.a=a} +function Ard(a){this.a=a} +function Brd(a){this.a=a} +function Crd(a){this.a=a} +function Ird(a){this.a=a} +function Krd(a){this.a=a} +function Lrd(a){this.a=a} +function Mrd(a){this.a=a} +function Nrd(a){this.a=a} +function Prd(a){this.a=a} +function Srd(a){this.a=a} +function Yrd(a){this.a=a} +function Zrd(a){this.a=a} +function _rd(a){this.a=a} +function asd(a){this.a=a} +function bsd(a){this.a=a} +function csd(a){this.a=a} +function dsd(a){this.a=a} +function msd(a){this.a=a} +function osd(a){this.a=a} +function qsd(a){this.a=a} +function ssd(a){this.a=a} +function Wsd(a){this.a=a} +function Lsd(a){this.b=a} +function thd(a){this.f=a} +function qtd(a){this.a=a} +function yBd(a){this.a=a} +function GBd(a){this.a=a} +function MBd(a){this.a=a} +function SBd(a){this.a=a} +function iCd(a){this.a=a} +function YMd(a){this.a=a} +function GNd(a){this.a=a} +function EPd(a){this.a=a} +function EQd(a){this.a=a} +function NTd(a){this.a=a} +function qOd(a){this.b=a} +function lVd(a){this.c=a} +function VVd(a){this.e=a} +function iYd(a){this.a=a} +function RYd(a){this.a=a} +function ZYd(a){this.a=a} +function z0d(a){this.a=a} +function O0d(a){this.a=a} +function s0d(a){this.d=a} +function W5d(a){this.a=a} +function cge(a){this.a=a} +function xfe(a){this.e=a} +function Tfd(){this.a=0} +function jkb(){Vjb(this)} +function Rkb(){Ckb(this)} +function Lqb(){Uhb(this)} +function lEb(){kEb(this)} +function A_b(){s_b(this)} +function UQd(){this.c=FQd} +function v6d(a,b){b.Wb(a)} +function moc(a,b){a.b+=b} +function yXb(a){a.b=new Ji} +function vbb(a){return a.e} +function DB(a){return a.a} +function LB(a){return a.a} +function ZB(a){return a.a} +function lC(a){return a.a} +function EC(a){return a.a} +function wC(){return null} +function SB(){return null} +function hcb(){mvd();ovd()} +function zJb(a){a.b.tf(a.e)} +function j5b(a,b){a.b=b-a.b} +function g5b(a,b){a.a=b-a.a} +function PXc(a,b){b.ad(a.a)} +function plc(a,b){G0b(b,a)} +function hp(a,b,c){a.Od(c,b)} +function As(a,b){a.e=b;b.b=a} +function Zl(a){Ql();this.a=a} +function jq(a){Ql();this.a=a} +function sq(a){Ql();this.a=a} +function Fq(a){im();this.a=a} +function Sz(a){Rz();Qz.be(a)} +function gz(){Xy.call(this)} +function xcb(){Xy.call(this)} +function pcb(){gz.call(this)} +function tcb(){gz.call(this)} +function Bdb(){gz.call(this)} +function Vdb(){gz.call(this)} +function Ydb(){gz.call(this)} +function Geb(){gz.call(this)} +function bgb(){gz.call(this)} +function Apb(){gz.call(this)} +function Jpb(){gz.call(this)} +function utb(){gz.call(this)} +function x2c(){gz.call(this)} +function rQd(){this.a=this} +function MPd(){this.Bb|=256} +function tTb(){this.b=new mt} +function fA(){fA=ccb;new Lqb} +function rcb(){pcb.call(this)} +function dCb(a,b){a.length=b} +function Tvb(a,b){Ekb(a.a,b)} +function sKb(a,b){UHb(a.c,b)} +function SMc(a,b){Qqb(a.b,b)} +function vBd(a,b){uAd(a.a,b)} +function wBd(a,b){vAd(a.a,b)} +function GLd(a,b){Uhd(a.e,b)} +function d7d(a){D2d(a.c,a.b)} +function mj(a,b){a.kc().Nb(b)} +function Odb(a){this.a=Tdb(a)} +function Tqb(){this.a=new Lqb} +function gyb(){this.a=new Lqb} +function Wvb(){this.a=new Rkb} +function KFb(){this.a=new Rkb} +function PFb(){this.a=new Rkb} +function FFb(){this.a=new yFb} +function pGb(){this.a=new MFb} +function ZQb(){this.a=new MQb} +function Gxb(){this.a=new Pwb} +function jUb(){this.a=new PTb} +function sDb(){this.a=new oDb} +function zDb(){this.a=new tDb} +function CWb(){this.a=new Rkb} +function HXb(){this.a=new Rkb} +function nYb(){this.a=new Rkb} +function BYb(){this.a=new Rkb} +function fLb(){this.d=new Rkb} +function vYb(){this.a=new Tqb} +function a2b(){this.a=new Lqb} +function wZb(){this.b=new Lqb} +function TCc(){this.b=new Rkb} +function zJc(){this.e=new Rkb} +function uMc(){this.d=new Rkb} +function wdc(){this.a=new xkc} +function vKc(){Rkb.call(this)} +function twb(){Wvb.call(this)} +function oHb(){$Gb.call(this)} +function LXb(){HXb.call(this)} +function L_b(){H_b.call(this)} +function H_b(){A_b.call(this)} +function p0b(){A_b.call(this)} +function s0b(){p0b.call(this)} +function WMc(){VMc.call(this)} +function bNc(){VMc.call(this)} +function EPc(){CPc.call(this)} +function JPc(){CPc.call(this)} +function OPc(){CPc.call(this)} +function w1c(){s1c.call(this)} +function s7c(){Psb.call(this)} +function apd(){Ald.call(this)} +function ppd(){Ald.call(this)} +function lDd(){YCd.call(this)} +function NDd(){YCd.call(this)} +function mFd(){Lqb.call(this)} +function vFd(){Lqb.call(this)} +function GFd(){Lqb.call(this)} +function KPd(){Tqb.call(this)} +function OJd(){hJd.call(this)} +function aQd(){MPd.call(this)} +function SSd(){FId.call(this)} +function rUd(){FId.call(this)} +function oUd(){Lqb.call(this)} +function NYd(){Lqb.call(this)} +function cZd(){Lqb.call(this)} +function R8d(){MGd.call(this)} +function o9d(){MGd.call(this)} +function i9d(){R8d.call(this)} +function hee(){ude.call(this)} +function Dd(a){yd.call(this,a)} +function Hd(a){yd.call(this,a)} +function ph(a){lh.call(this,a)} +function Sh(a){Wc.call(this,a)} +function oi(a){Sh.call(this,a)} +function Ii(a){Wc.call(this,a)} +function Zdd(){this.a=new Psb} +function CPc(){this.a=new Tqb} +function s1c(){this.a=new Lqb} +function QSc(){this.a=new Rkb} +function D2c(){this.j=new Rkb} +function QXc(){this.a=new UXc} +function e_c(){this.a=new d_c} +function YCd(){this.a=new aDd} +function _k(){_k=ccb;$k=new al} +function Lk(){Lk=ccb;Kk=new Mk} +function wb(){wb=ccb;vb=new xb} +function hs(){hs=ccb;gs=new is} +function rs(a){Sh.call(this,a)} +function Gp(a){Sh.call(this,a)} +function xp(a){Lo.call(this,a)} +function Ep(a){Lo.call(this,a)} +function Tp(a){Wn.call(this,a)} +function wx(a){un.call(this,a)} +function ov(a){dv.call(this,a)} +function Mv(a){Br.call(this,a)} +function Ov(a){Br.call(this,a)} +function Lw(a){Br.call(this,a)} +function hz(a){Yy.call(this,a)} +function MB(a){hz.call(this,a)} +function eC(){fC.call(this,{})} +function Ftb(a){Atb();this.a=a} +function zwb(a){a.b=null;a.c=0} +function Vy(a,b){a.e=b;Sy(a,b)} +function LVb(a,b){a.a=b;NVb(a)} +function lIb(a,b,c){a.a[b.g]=c} +function vfd(a,b,c){Dfd(c,a,b)} +function Odc(a,b){rjc(b.i,a.n)} +function Wyc(a,b){Xyc(a).td(b)} +function ERb(a,b){return a*a/b} +function Xr(a,b){return a.g-b.g} +function tC(a){return new TB(a)} +function vC(a){return new yC(a)} +function ocb(a){hz.call(this,a)} +function qcb(a){hz.call(this,a)} +function ucb(a){hz.call(this,a)} +function vcb(a){Yy.call(this,a)} +function fGc(a){LFc();this.a=a} +function c0d(a){kzd();this.a=a} +function bhd(a){Rgd();this.f=a} +function dhd(a){Rgd();this.f=a} +function Cdb(a){hz.call(this,a)} +function Wdb(a){hz.call(this,a)} +function Zdb(a){hz.call(this,a)} +function Feb(a){hz.call(this,a)} +function Heb(a){hz.call(this,a)} +function Ccb(a){return uCb(a),a} +function Edb(a){return uCb(a),a} +function Gdb(a){return uCb(a),a} +function jfb(a){return uCb(a),a} +function tfb(a){return uCb(a),a} +function akb(a){return a.b==a.c} +function Hwb(a){return !!a&&a.b} +function pIb(a){return !!a&&a.k} +function qIb(a){return !!a&&a.j} +function amb(a){uCb(a);this.a=a} +function wVb(a){qVb(a);return a} +function Blb(a){Glb(a,a.length)} +function cgb(a){hz.call(this,a)} +function cqd(a){hz.call(this,a)} +function n8d(a){hz.call(this,a)} +function y2c(a){hz.call(this,a)} +function z2c(a){hz.call(this,a)} +function mde(a){hz.call(this,a)} +function pc(a){qc.call(this,a,0)} +function Ji(){Ki.call(this,12,3)} +function Kz(){Kz=ccb;Jz=new Nz} +function jz(){jz=ccb;iz=new nb} +function KA(){KA=ccb;JA=new MA} +function OB(){OB=ccb;NB=new PB} +function jc(){throw vbb(new bgb)} +function zh(){throw vbb(new bgb)} +function Pi(){throw vbb(new bgb)} +function Pj(){throw vbb(new bgb)} +function Qj(){throw vbb(new bgb)} +function Ym(){throw vbb(new bgb)} +function Gb(){this.a=GD(Qb(She))} +function oy(a){Ql();this.a=Qb(a)} +function Bs(a,b){a.Td(b);b.Sd(a)} +function iw(a,b){a.a.ec().Mc(b)} +function CYb(a,b,c){a.c.lf(b,c)} +function scb(a){qcb.call(this,a)} +function Oeb(a){Wdb.call(this,a)} +function Hfb(){mcb.call(this,'')} +function Ifb(){mcb.call(this,'')} +function Ufb(){mcb.call(this,'')} +function Vfb(){mcb.call(this,'')} +function Xfb(a){qcb.call(this,a)} +function zob(a){lnb.call(this,a)} +function Yob(a){Inb.call(this,a)} +function Gob(a){zob.call(this,a)} +function Mk(){Fk.call(this,null)} +function al(){Fk.call(this,null)} +function Az(){Az=ccb;!!(Rz(),Qz)} +function wrb(){wrb=ccb;vrb=yrb()} +function Mtb(a){return a.a?a.b:0} +function Vtb(a){return a.a?a.b:0} +function Lcb(a,b){return a.a-b.a} +function Wcb(a,b){return a.a-b.a} +function Peb(a,b){return a.a-b.a} +function eCb(a,b){return PC(a,b)} +function GC(a,b){return rdb(a,b)} +function _B(b,a){return a in b.a} +function _Db(a,b){a.f=b;return a} +function ZDb(a,b){a.b=b;return a} +function $Db(a,b){a.c=b;return a} +function aEb(a,b){a.g=b;return a} +function HGb(a,b){a.a=b;return a} +function IGb(a,b){a.f=b;return a} +function JGb(a,b){a.k=b;return a} +function dLb(a,b){a.a=b;return a} +function eLb(a,b){a.e=b;return a} +function zVb(a,b){a.e=b;return a} +function AVb(a,b){a.f=b;return a} +function KOb(a,b){a.b=true;a.d=b} +function DHb(a,b){a.b=new g7c(b)} +function uvb(a,b,c){b.td(a.a[c])} +function zvb(a,b,c){b.we(a.a[c])} +function wJc(a,b){return a.b-b.b} +function kOc(a,b){return a.g-b.g} +function WQc(a,b){return a.s-b.s} +function Lic(a,b){return a?0:b-1} +function SFc(a,b){return a?0:b-1} +function RFc(a,b){return a?b-1:0} +function M2c(a,b){return b.Yf(a)} +function M3c(a,b){a.b=b;return a} +function L3c(a,b){a.a=b;return a} +function N3c(a,b){a.c=b;return a} +function O3c(a,b){a.d=b;return a} +function P3c(a,b){a.e=b;return a} +function Q3c(a,b){a.f=b;return a} +function b4c(a,b){a.a=b;return a} +function c4c(a,b){a.b=b;return a} +function d4c(a,b){a.c=b;return a} +function z5c(a,b){a.c=b;return a} +function y5c(a,b){a.b=b;return a} +function A5c(a,b){a.d=b;return a} +function B5c(a,b){a.e=b;return a} +function C5c(a,b){a.f=b;return a} +function D5c(a,b){a.g=b;return a} +function E5c(a,b){a.a=b;return a} +function F5c(a,b){a.i=b;return a} +function G5c(a,b){a.j=b;return a} +function Vdd(a,b){a.k=b;return a} +function Wdd(a,b){a.j=b;return a} +function ykc(a,b){gkc();F0b(b,a)} +function T$c(a,b,c){R$c(a.a,b,c)} +function RGc(a){cEc.call(this,a)} +function iHc(a){cEc.call(this,a)} +function t7c(a){Qsb.call(this,a)} +function aPb(a){_Ob.call(this,a)} +function Ixd(a){zud.call(this,a)} +function dCd(a){ZBd.call(this,a)} +function fCd(a){ZBd.call(this,a)} +function p_b(){q_b.call(this,'')} +function d7c(){this.a=0;this.b=0} +function aPc(){this.b=0;this.a=0} +function NJd(a,b){a.b=0;DId(a,b)} +function X1d(a,b){a.c=b;a.b=true} +function Oc(a,b){return a.c._b(b)} +function gdb(a){return a.e&&a.e()} +function Vd(a){return !a?null:a.d} +function sn(a,b){return Gv(a.b,b)} +function Fv(a){return !a?null:a.g} +function Kv(a){return !a?null:a.i} +function hdb(a){fdb(a);return a.o} +function Fhd(){Fhd=ccb;Ehd=ond()} +function Hhd(){Hhd=ccb;Ghd=Cod()} +function LFd(){LFd=ccb;KFd=qZd()} +function p8d(){p8d=ccb;o8d=Y9d()} +function r8d(){r8d=ccb;q8d=dae()} +function mvd(){mvd=ccb;lvd=n4c()} +function Srb(){throw vbb(new bgb)} +function enb(){throw vbb(new bgb)} +function fnb(){throw vbb(new bgb)} +function gnb(){throw vbb(new bgb)} +function jnb(){throw vbb(new bgb)} +function Cnb(){throw vbb(new bgb)} +function Uqb(a){this.a=new Mqb(a)} +function tgb(a){lgb();ngb(this,a)} +function Hxb(a){this.a=new Qwb(a)} +function _ub(a,b){while(a.ye(b));} +function Sub(a,b){while(a.sd(b));} +function Bfb(a,b){a.a+=b;return a} +function Cfb(a,b){a.a+=b;return a} +function Ffb(a,b){a.a+=b;return a} +function Lfb(a,b){a.a+=b;return a} +function WAb(a){Tzb(a);return a.a} +function Wsb(a){return a.b!=a.d.c} +function pD(a){return a.l|a.m<<22} +function aIc(a,b){return a.d[b.p]} +function h2c(a,b){return c2c(a,b)} +function cCb(a,b,c){a.splice(b,c)} +function WHb(a){a.c?VHb(a):XHb(a)} +function jVc(a){this.a=0;this.b=a} +function ZUc(){this.a=new L2c(K$)} +function tRc(){this.b=new L2c(h$)} +function Q$c(){this.b=new L2c(J_)} +function d_c(){this.b=new L2c(J_)} +function OCd(){throw vbb(new bgb)} +function PCd(){throw vbb(new bgb)} +function QCd(){throw vbb(new bgb)} +function RCd(){throw vbb(new bgb)} +function SCd(){throw vbb(new bgb)} +function TCd(){throw vbb(new bgb)} +function UCd(){throw vbb(new bgb)} +function VCd(){throw vbb(new bgb)} +function WCd(){throw vbb(new bgb)} +function XCd(){throw vbb(new bgb)} +function ahe(){throw vbb(new utb)} +function bhe(){throw vbb(new utb)} +function Rge(a){this.a=new ege(a)} +function ege(a){dge(this,a,Vee())} +function Fhe(a){return !a||Ehe(a)} +function dde(a){return $ce[a]!=-1} +function Iz(){xz!=0&&(xz=0);zz=-1} +function Ybb(){Wbb==null&&(Wbb=[])} +function ONd(a,b){Rxd(ZKd(a.a),b)} +function TNd(a,b){Rxd(ZKd(a.a),b)} +function Yf(a,b){zf.call(this,a,b)} +function $f(a,b){Yf.call(this,a,b)} +function Hf(a,b){this.b=a;this.c=b} +function rk(a,b){this.b=a;this.a=b} +function ek(a,b){this.a=a;this.b=b} +function gk(a,b){this.a=a;this.b=b} +function pk(a,b){this.a=a;this.b=b} +function yk(a,b){this.a=a;this.b=b} +function Ak(a,b){this.a=a;this.b=b} +function Fj(a,b){this.a=a;this.b=b} +function _j(a,b){this.a=a;this.b=b} +function dr(a,b){this.a=a;this.b=b} +function zr(a,b){this.b=a;this.a=b} +function So(a,b){this.b=a;this.a=b} +function qp(a,b){this.b=a;this.a=b} +function $q(a,b){this.b=a;this.a=b} +function $r(a,b){this.f=a;this.g=b} +function ne(a,b){this.e=a;this.d=b} +function Wo(a,b){this.g=a;this.i=b} +function bu(a,b){this.a=a;this.b=b} +function qu(a,b){this.a=a;this.f=b} +function qv(a,b){this.b=a;this.c=b} +function ox(a,b){this.a=a;this.b=b} +function Px(a,b){this.a=a;this.b=b} +function mC(a,b){this.a=a;this.b=b} +function Wc(a){Lb(a.dc());this.c=a} +function rf(a){this.b=BD(Qb(a),83)} +function Zv(a){this.a=BD(Qb(a),83)} +function dv(a){this.a=BD(Qb(a),15)} +function $u(a){this.a=BD(Qb(a),15)} +function Br(a){this.b=BD(Qb(a),47)} +function eB(){this.q=new $wnd.Date} +function Zfb(){Zfb=ccb;Yfb=new jcb} +function Emb(){Emb=ccb;Dmb=new Fmb} +function Vhb(a){return a.f.c+a.g.c} +function hnb(a,b){return a.b.Hc(b)} +function inb(a,b){return a.b.Ic(b)} +function knb(a,b){return a.b.Qc(b)} +function Dob(a,b){return a.b.Hc(b)} +function dob(a,b){return a.c.uc(b)} +function Rqb(a,b){return a.a._b(b)} +function fob(a,b){return pb(a.c,b)} +function jt(a,b){return Mhb(a.b,b)} +function Lp(a,b){return a>b&&b0} +function Gbb(a,b){return ybb(a,b)<0} +function Crb(a,b){return a.a.get(b)} +function icb(b,a){return a.split(b)} +function Vrb(a,b){return Mhb(a.e,b)} +function Nvb(a){return uCb(a),false} +function Rub(a){Kub.call(this,a,21)} +function wcb(a,b){Zy.call(this,a,b)} +function mxb(a,b){$r.call(this,a,b)} +function Gyb(a,b){$r.call(this,a,b)} +function zx(a){yx();Wn.call(this,a)} +function zlb(a,b){Dlb(a,a.length,b)} +function Alb(a,b){Flb(a,a.length,b)} +function ABb(a,b,c){b.ud(a.a.Ge(c))} +function uBb(a,b,c){b.we(a.a.Fe(c))} +function GBb(a,b,c){b.td(a.a.Kb(c))} +function Zq(a,b,c){a.Mb(c)&&b.td(c)} +function aCb(a,b,c){a.splice(b,0,c)} +function lDb(a,b){return uqb(a.e,b)} +function pjb(a,b){this.d=a;this.e=b} +function kqb(a,b){this.b=a;this.a=b} +function VBb(a,b){this.b=a;this.a=b} +function BEb(a,b){this.b=a;this.a=b} +function sBb(a,b){this.a=a;this.b=b} +function yBb(a,b){this.a=a;this.b=b} +function EBb(a,b){this.a=a;this.b=b} +function KBb(a,b){this.a=a;this.b=b} +function aDb(a,b){this.a=a;this.b=b} +function tMb(a,b){this.b=a;this.a=b} +function oOb(a,b){this.b=a;this.a=b} +function SOb(a,b){$r.call(this,a,b)} +function SMb(a,b){$r.call(this,a,b)} +function NEb(a,b){$r.call(this,a,b)} +function VEb(a,b){$r.call(this,a,b)} +function sFb(a,b){$r.call(this,a,b)} +function hHb(a,b){$r.call(this,a,b)} +function OHb(a,b){$r.call(this,a,b)} +function FIb(a,b){$r.call(this,a,b)} +function wLb(a,b){$r.call(this,a,b)} +function YRb(a,b){$r.call(this,a,b)} +function zTb(a,b){$r.call(this,a,b)} +function rUb(a,b){$r.call(this,a,b)} +function oWb(a,b){$r.call(this,a,b)} +function SXb(a,b){$r.call(this,a,b)} +function k0b(a,b){$r.call(this,a,b)} +function z5b(a,b){$r.call(this,a,b)} +function T8b(a,b){$r.call(this,a,b)} +function ibc(a,b){$r.call(this,a,b)} +function Cec(a,b){this.a=a;this.b=b} +function rfc(a,b){this.a=a;this.b=b} +function Rfc(a,b){this.a=a;this.b=b} +function Tfc(a,b){this.a=a;this.b=b} +function bgc(a,b){this.a=a;this.b=b} +function ngc(a,b){this.a=a;this.b=b} +function Qhc(a,b){this.a=a;this.b=b} +function $hc(a,b){this.a=a;this.b=b} +function Z0b(a,b){this.a=a;this.b=b} +function ZVb(a,b){this.b=a;this.a=b} +function Dfc(a,b){this.b=a;this.a=b} +function dgc(a,b){this.b=a;this.a=b} +function Bmc(a,b){this.b=a;this.a=b} +function cWb(a,b){this.c=a;this.d=b} +function I$b(a,b){this.e=a;this.d=b} +function Unc(a,b){this.a=a;this.b=b} +function Oic(a,b){this.b=b;this.c=a} +function Bjc(a,b){$r.call(this,a,b)} +function Yjc(a,b){$r.call(this,a,b)} +function Gkc(a,b){$r.call(this,a,b)} +function Bpc(a,b){$r.call(this,a,b)} +function Jpc(a,b){$r.call(this,a,b)} +function Tpc(a,b){$r.call(this,a,b)} +function cqc(a,b){$r.call(this,a,b)} +function oqc(a,b){$r.call(this,a,b)} +function yqc(a,b){$r.call(this,a,b)} +function Hqc(a,b){$r.call(this,a,b)} +function Uqc(a,b){$r.call(this,a,b)} +function arc(a,b){$r.call(this,a,b)} +function mrc(a,b){$r.call(this,a,b)} +function zrc(a,b){$r.call(this,a,b)} +function Prc(a,b){$r.call(this,a,b)} +function Yrc(a,b){$r.call(this,a,b)} +function fsc(a,b){$r.call(this,a,b)} +function nsc(a,b){$r.call(this,a,b)} +function nzc(a,b){$r.call(this,a,b)} +function zzc(a,b){$r.call(this,a,b)} +function Kzc(a,b){$r.call(this,a,b)} +function Xzc(a,b){$r.call(this,a,b)} +function Dtc(a,b){$r.call(this,a,b)} +function lAc(a,b){$r.call(this,a,b)} +function uAc(a,b){$r.call(this,a,b)} +function CAc(a,b){$r.call(this,a,b)} +function LAc(a,b){$r.call(this,a,b)} +function UAc(a,b){$r.call(this,a,b)} +function aBc(a,b){$r.call(this,a,b)} +function uBc(a,b){$r.call(this,a,b)} +function DBc(a,b){$r.call(this,a,b)} +function MBc(a,b){$r.call(this,a,b)} +function sGc(a,b){$r.call(this,a,b)} +function VIc(a,b){$r.call(this,a,b)} +function EIc(a,b){this.b=a;this.a=b} +function qKc(a,b){this.a=a;this.b=b} +function GKc(a,b){this.a=a;this.b=b} +function lLc(a,b){this.a=a;this.b=b} +function mMc(a,b){this.a=a;this.b=b} +function fMc(a,b){$r.call(this,a,b)} +function ZLc(a,b){$r.call(this,a,b)} +function ZMc(a,b){this.b=a;this.d=b} +function IOc(a,b){$r.call(this,a,b)} +function GQc(a,b){$r.call(this,a,b)} +function PQc(a,b){this.a=a;this.b=b} +function RQc(a,b){this.a=a;this.b=b} +function ARc(a,b){$r.call(this,a,b)} +function rSc(a,b){$r.call(this,a,b)} +function TTc(a,b){$r.call(this,a,b)} +function _Tc(a,b){$r.call(this,a,b)} +function RUc(a,b){$r.call(this,a,b)} +function uVc(a,b){$r.call(this,a,b)} +function hWc(a,b){$r.call(this,a,b)} +function rWc(a,b){$r.call(this,a,b)} +function kXc(a,b){$r.call(this,a,b)} +function uXc(a,b){$r.call(this,a,b)} +function AYc(a,b){$r.call(this,a,b)} +function l$c(a,b){$r.call(this,a,b)} +function Z$c(a,b){$r.call(this,a,b)} +function D_c(a,b){$r.call(this,a,b)} +function O_c(a,b){$r.call(this,a,b)} +function c1c(a,b){$r.call(this,a,b)} +function cVb(a,b){return uqb(a.c,b)} +function nnc(a,b){return uqb(b.b,a)} +function x1c(a,b){return -a.b.Je(b)} +function D3c(a,b){return uqb(a.g,b)} +function O5c(a,b){$r.call(this,a,b)} +function a6c(a,b){$r.call(this,a,b)} +function m2c(a,b){this.a=a;this.b=b} +function W2c(a,b){this.a=a;this.b=b} +function f7c(a,b){this.a=a;this.b=b} +function G7c(a,b){$r.call(this,a,b)} +function j8c(a,b){$r.call(this,a,b)} +function iad(a,b){$r.call(this,a,b)} +function rad(a,b){$r.call(this,a,b)} +function Bad(a,b){$r.call(this,a,b)} +function Nad(a,b){$r.call(this,a,b)} +function ibd(a,b){$r.call(this,a,b)} +function tbd(a,b){$r.call(this,a,b)} +function Ibd(a,b){$r.call(this,a,b)} +function Ubd(a,b){$r.call(this,a,b)} +function gcd(a,b){$r.call(this,a,b)} +function scd(a,b){$r.call(this,a,b)} +function Ycd(a,b){$r.call(this,a,b)} +function udd(a,b){$r.call(this,a,b)} +function Jdd(a,b){$r.call(this,a,b)} +function Eed(a,b){$r.call(this,a,b)} +function bfd(a,b){this.a=a;this.b=b} +function dfd(a,b){this.a=a;this.b=b} +function ffd(a,b){this.a=a;this.b=b} +function Kfd(a,b){this.a=a;this.b=b} +function Mfd(a,b){this.a=a;this.b=b} +function Ofd(a,b){this.a=a;this.b=b} +function vgd(a,b){this.a=a;this.b=b} +function qgd(a,b){$r.call(this,a,b)} +function jrd(a,b){this.a=a;this.b=b} +function krd(a,b){this.a=a;this.b=b} +function mrd(a,b){this.a=a;this.b=b} +function nrd(a,b){this.a=a;this.b=b} +function qrd(a,b){this.a=a;this.b=b} +function rrd(a,b){this.a=a;this.b=b} +function srd(a,b){this.b=a;this.a=b} +function trd(a,b){this.b=a;this.a=b} +function Drd(a,b){this.b=a;this.a=b} +function Frd(a,b){this.b=a;this.a=b} +function Hrd(a,b){this.a=a;this.b=b} +function Jrd(a,b){this.a=a;this.b=b} +function Ord(a,b){Xqd(a.a,BD(b,56))} +function BIc(a,b){gIc(a.a,BD(b,11))} +function fIc(a,b){FHc();return b!=a} +function Arb(){wrb();return new vrb} +function CMc(){wMc();this.b=new Tqb} +function NNc(){FNc();this.a=new Tqb} +function eCc(){ZBc();aCc.call(this)} +function Dsd(a,b){$r.call(this,a,b)} +function Urd(a,b){this.a=a;this.b=b} +function Wrd(a,b){this.a=a;this.b=b} +function kGd(a,b){this.a=a;this.b=b} +function nGd(a,b){this.a=a;this.b=b} +function bUd(a,b){this.a=a;this.b=b} +function zVd(a,b){this.a=a;this.b=b} +function C1d(a,b){this.d=a;this.b=b} +function MLd(a,b){this.d=a;this.e=b} +function Wud(a,b){this.f=a;this.c=b} +function f7d(a,b){this.b=a;this.c=b} +function _zd(a,b){this.i=a;this.g=b} +function Y1d(a,b){this.e=a;this.a=b} +function c8d(a,b){this.a=a;this.b=b} +function $Id(a,b){a.i=null;_Id(a,b)} +function ivd(a,b){!!a&&Rhb(cvd,a,b)} +function hCd(a,b){return qAd(a.a,b)} +function e7d(a){return R2d(a.c,a.b)} +function Wd(a){return !a?null:a.dd()} +function PD(a){return a==null?null:a} +function KD(a){return typeof a===Khe} +function LD(a){return typeof a===Lhe} +function ND(a){return typeof a===Mhe} +function Em(a,b){return a.Hd().Xb(b)} +function Kq(a,b){return hr(a.Kc(),b)} +function Bbb(a,b){return ybb(a,b)==0} +function Ebb(a,b){return ybb(a,b)>=0} +function Kbb(a,b){return ybb(a,b)!=0} +function Jdb(a){return ''+(uCb(a),a)} +function pfb(a,b){return a.substr(b)} +function cg(a){ag(a);return a.d.gc()} +function oVb(a){pVb(a,a.c);return a} +function RD(a){CCb(a==null);return a} +function Dfb(a,b){a.a+=''+b;return a} +function Efb(a,b){a.a+=''+b;return a} +function Nfb(a,b){a.a+=''+b;return a} +function Pfb(a,b){a.a+=''+b;return a} +function Qfb(a,b){a.a+=''+b;return a} +function Mfb(a,b){return a.a+=''+b,a} +function Esb(a,b){Gsb(a,b,a.a,a.a.a)} +function Fsb(a,b){Gsb(a,b,a.c.b,a.c)} +function Mqd(a,b,c){Rpd(b,kqd(a,c))} +function Nqd(a,b,c){Rpd(b,kqd(a,c))} +function Dhe(a,b){Hhe(new Fyd(a),b)} +function cB(a,b){a.q.setTime(Sbb(b))} +function fvb(a,b){bvb.call(this,a,b)} +function jvb(a,b){bvb.call(this,a,b)} +function nvb(a,b){bvb.call(this,a,b)} +function Nqb(a){Uhb(this);Ld(this,a)} +function wmb(a){tCb(a,0);return null} +function X6c(a){a.a=0;a.b=0;return a} +function f3c(a,b){a.a=b.g+1;return a} +function PJc(a,b){return a.j[b.p]==2} +function _Pb(a){return VPb(BD(a,79))} +function yJb(){yJb=ccb;xJb=as(wJb())} +function Y8b(){Y8b=ccb;X8b=as(W8b())} +function mt(){this.b=new Mqb(Cv(12))} +function Otb(){this.b=0;this.a=false} +function Wtb(){this.b=0;this.a=false} +function sl(a){this.a=a;ol.call(this)} +function vl(a){this.a=a;ol.call(this)} +function Nsd(a,b){Msd.call(this,a,b)} +function $zd(a,b){Cyd.call(this,a,b)} +function nNd(a,b){_zd.call(this,a,b)} +function s4d(a,b){p4d.call(this,a,b)} +function w4d(a,b){qRd.call(this,a,b)} +function rEd(a,b){pEd();Rhb(oEd,a,b)} +function lcb(a,b){return qfb(a.a,0,b)} +function ww(a,b){return a.a.a.a.cc(b)} +function mb(a,b){return PD(a)===PD(b)} +function Mdb(a,b){return Kdb(a.a,b.a)} +function $db(a,b){return beb(a.a,b.a)} +function seb(a,b){return ueb(a.a,b.a)} +function hfb(a,b){return a.indexOf(b)} +function Ny(a,b){return a==b?0:a?1:-1} +function kB(a){return a<10?'0'+a:''+a} +function Mq(a){return Qb(a),new sl(a)} +function SC(a){return TC(a.l,a.m,a.h)} +function Hdb(a){return QD((uCb(a),a))} +function Idb(a){return QD((uCb(a),a))} +function NIb(a,b){return beb(a.g,b.g)} +function Fbb(a){return typeof a===Lhe} +function mWb(a){return a==hWb||a==kWb} +function nWb(a){return a==hWb||a==iWb} +function G1b(a){return Jkb(a.b.b,a,0)} +function lrb(a){this.a=Arb();this.b=a} +function Frb(a){this.a=Arb();this.b=a} +function swb(a,b){Ekb(a.a,b);return b} +function Z1c(a,b){Ekb(a.c,b);return a} +function E2c(a,b){d3c(a.a,b);return a} +function _gc(a,b){Hgc();return b.a+=a} +function bhc(a,b){Hgc();return b.a+=a} +function ahc(a,b){Hgc();return b.c+=a} +function Nlb(a,b){Klb(a,0,a.length,b)} +function zsb(){Wqb.call(this,new $rb)} +function I_b(){B_b.call(this,0,0,0,0)} +function I6c(){J6c.call(this,0,0,0,0)} +function g7c(a){this.a=a.a;this.b=a.b} +function fad(a){return a==aad||a==bad} +function gad(a){return a==dad||a==_9c} +function Jzc(a){return a==Fzc||a==Ezc} +function fcd(a){return a!=bcd&&a!=ccd} +function oid(a){return a.Lg()&&a.Mg()} +function Gfd(a){return Kkd(BD(a,118))} +function k3c(a){return d3c(new j3c,a)} +function y2d(a,b){return new p4d(b,a)} +function z2d(a,b){return new p4d(b,a)} +function ukd(a,b,c){vkd(a,b);wkd(a,c)} +function _kd(a,b,c){cld(a,b);ald(a,c)} +function bld(a,b,c){dld(a,b);eld(a,c)} +function gmd(a,b,c){hmd(a,b);imd(a,c)} +function nmd(a,b,c){omd(a,b);pmd(a,c)} +function iKd(a,b){$Jd(a,b);_Jd(a,a.D)} +function _ud(a){Wud.call(this,a,true)} +function Xg(a,b,c){Vg.call(this,a,b,c)} +function Ygb(a){Hgb();Zgb.call(this,a)} +function rxb(){mxb.call(this,'Head',1)} +function wxb(){mxb.call(this,'Tail',3)} +function Ckb(a){a.c=KC(SI,Uhe,1,0,5,1)} +function Vjb(a){a.a=KC(SI,Uhe,1,8,5,1)} +function MGb(a){Hkb(a.xf(),new QGb(a))} +function xtb(a){return a!=null?tb(a):0} +function b2b(a,b){return ntd(b,mpd(a))} +function c2b(a,b){return ntd(b,mpd(a))} +function dAb(a,b){return a[a.length]=b} +function gAb(a,b){return a[a.length]=b} +function Vq(a){return lr(a.b.Kc(),a.a)} +function dqd(a,b){return _o(qo(a.d),b)} +function eqd(a,b){return _o(qo(a.g),b)} +function fqd(a,b){return _o(qo(a.j),b)} +function Osd(a,b){Msd.call(this,a.b,b)} +function q0b(a){B_b.call(this,a,a,a,a)} +function HOb(a){a.b&&LOb(a);return a.a} +function IOb(a){a.b&&LOb(a);return a.c} +function uyb(a,b){if(lyb){return}a.b=b} +function lzd(a,b,c){NC(a,b,c);return c} +function mBc(a,b,c){NC(a.c[b.g],b.g,c)} +function _Hd(a,b,c){BD(a.c,69).Xh(b,c)} +function wfd(a,b,c){bld(c,c.i+a,c.j+b)} +function UOd(a,b){wtd(VKd(a.a),XOd(b))} +function bTd(a,b){wtd(QSd(a.a),eTd(b))} +function Lge(a){wfe();xfe.call(this,a)} +function CAd(a){return a==null?0:tb(a)} +function fNc(){fNc=ccb;eNc=new Rpb(v1)} +function h0d(){h0d=ccb;new i0d;new Rkb} +function i0d(){new Lqb;new Lqb;new Lqb} +function GA(){GA=ccb;fA();FA=new Lqb} +function Iy(){Iy=ccb;$wnd.Math.log(2)} +function UVd(){UVd=ccb;TVd=(AFd(),zFd)} +function _ge(){throw vbb(new cgb(Cxe))} +function ohe(){throw vbb(new cgb(Cxe))} +function che(){throw vbb(new cgb(Dxe))} +function rhe(){throw vbb(new cgb(Dxe))} +function Mg(a){this.a=a;Gg.call(this,a)} +function up(a){this.a=a;rf.call(this,a)} +function Bp(a){this.a=a;rf.call(this,a)} +function Okb(a,b){Mlb(a.c,a.c.length,b)} +function llb(a){return a.ab?1:0} +function Deb(a,b){return ybb(a,b)>0?a:b} +function TC(a,b,c){return {l:a,m:b,h:c}} +function Ctb(a,b){a.a!=null&&BIc(b,a.a)} +function Csb(a){a.a=new jtb;a.c=new jtb} +function hDb(a){this.b=a;this.a=new Rkb} +function dOb(a){this.b=new pOb;this.a=a} +function q_b(a){n_b.call(this);this.a=a} +function txb(){mxb.call(this,'Range',2)} +function bUb(){ZTb();this.a=new L2c(zP)} +function Bh(a,b){Qb(b);Ah(a).Jc(new Vw)} +function fKc(a,b){FJc();return b.n.b+=a} +function Tgc(a,b,c){return Rhb(a.g,c,b)} +function LJc(a,b,c){return Rhb(a.k,c,b)} +function r1c(a,b){return Rhb(a.a,b.a,b)} +function jBc(a,b,c){return hBc(b,c,a.c)} +function E6c(a){return new f7c(a.c,a.d)} +function F6c(a){return new f7c(a.c,a.d)} +function R6c(a){return new f7c(a.a,a.b)} +function CQd(a,b){return hA(a.a,b,null)} +function fec(a){QZb(a,null);RZb(a,null)} +function AOc(a){BOc(a,null);COc(a,null)} +function u4d(){qRd.call(this,null,null)} +function y4d(){RRd.call(this,null,null)} +function a7d(a){this.a=a;Lqb.call(this)} +function Pp(a){this.b=(mmb(),new iob(a))} +function Py(a){a.j=KC(VI,nie,310,0,0,1)} +function oAd(a,b,c){a.c.Vc(b,BD(c,133))} +function GAd(a,b,c){a.c.ji(b,BD(c,133))} +function JLd(a,b){Uxd(a);a.Gc(BD(b,15))} +function b7d(a,b){return t2d(a.c,a.b,b)} +function Bv(a,b){return new Qv(a.Kc(),b)} +function Lq(a,b){return rr(a.Kc(),b)!=-1} +function Sqb(a,b){return a.a.Bc(b)!=null} +function pr(a){return a.Ob()?a.Pb():null} +function yfb(a){return zfb(a,0,a.length)} +function JD(a,b){return a!=null&&AD(a,b)} +function $A(a,b){a.q.setHours(b);YA(a,b)} +function Yrb(a,b){if(a.c){jsb(b);isb(b)}} +function nk(a,b,c){BD(a.Kb(c),164).Nb(b)} +function RJc(a,b,c){SJc(a,b,c);return c} +function Eub(a,b,c){a.a=b^1502;a.b=c^kke} +function xHb(a,b,c){return a.a[b.g][c.g]} +function REc(a,b){return a.a[b.c.p][b.p]} +function aEc(a,b){return a.e[b.c.p][b.p]} +function tEc(a,b){return a.c[b.c.p][b.p]} +function OJc(a,b){return a.j[b.p]=aKc(b)} +function k5c(a,b){return cfb(a.f,b.tg())} +function Isd(a,b){return cfb(a.b,b.tg())} +function Sfd(a,b){return a.a0?b*b/a:b*b*100} +function CRb(a,b){return a>0?b/(a*a):b*100} +function G2c(a,b,c){return Ekb(b,I2c(a,c))} +function t3c(a,b,c){p3c();a.Xe(b)&&c.td(a)} +function St(a,b,c){var d;d=a.Zc(b);d.Rb(c)} +function O6c(a,b,c){a.a+=b;a.b+=c;return a} +function Z6c(a,b,c){a.a*=b;a.b*=c;return a} +function b7c(a,b,c){a.a-=b;a.b-=c;return a} +function a7c(a,b){a.a=b.a;a.b=b.b;return a} +function V6c(a){a.a=-a.a;a.b=-a.b;return a} +function Dic(a){this.c=a;this.a=1;this.b=1} +function xed(a){this.c=a;dld(a,0);eld(a,0)} +function u7c(a){Psb.call(this);n7c(this,a)} +function AXb(a){xXb();yXb(this);this.mf(a)} +function GRd(a,b){nRd();qRd.call(this,a,b)} +function dSd(a,b){LRd();RRd.call(this,a,b)} +function hSd(a,b){LRd();RRd.call(this,a,b)} +function fSd(a,b){LRd();dSd.call(this,a,b)} +function sId(a,b,c){dId.call(this,a,b,c,2)} +function zXd(a,b){UVd();nXd.call(this,a,b)} +function BXd(a,b){UVd();zXd.call(this,a,b)} +function DXd(a,b){UVd();zXd.call(this,a,b)} +function FXd(a,b){UVd();DXd.call(this,a,b)} +function PXd(a,b){UVd();nXd.call(this,a,b)} +function RXd(a,b){UVd();PXd.call(this,a,b)} +function XXd(a,b){UVd();nXd.call(this,a,b)} +function pAd(a,b){return a.c.Fc(BD(b,133))} +function w1d(a,b,c){return V1d(p1d(a,b),c)} +function N2d(a,b,c){return b.Qk(a.e,a.c,c)} +function P2d(a,b,c){return b.Rk(a.e,a.c,c)} +function a3d(a,b){return xid(a.e,BD(b,49))} +function aTd(a,b,c){vtd(QSd(a.a),b,eTd(c))} +function TOd(a,b,c){vtd(VKd(a.a),b,XOd(c))} +function ypb(a,b){b.$modCount=a.$modCount} +function MUc(){MUc=ccb;LUc=new Lsd('root')} +function LCd(){LCd=ccb;KCd=new lDd;new NDd} +function KVc(){this.a=new Hp;this.b=new Hp} +function FUd(){hJd.call(this);this.Bb|=Tje} +function t_c(){$r.call(this,'GROW_TREE',0)} +function C9d(a){return a==null?null:cde(a)} +function G9d(a){return a==null?null:jde(a)} +function J9d(a){return a==null?null:fcb(a)} +function K9d(a){return a==null?null:fcb(a)} +function fdb(a){if(a.o!=null){return}vdb(a)} +function DD(a){CCb(a==null||KD(a));return a} +function ED(a){CCb(a==null||LD(a));return a} +function GD(a){CCb(a==null||ND(a));return a} +function gB(a){this.q=new $wnd.Date(Sbb(a))} +function Mf(a,b){this.c=a;ne.call(this,a,b)} +function Sf(a,b){this.a=a;Mf.call(this,a,b)} +function Hg(a,b){this.d=a;Dg(this);this.b=b} +function bAb(a,b){Vzb.call(this,a);this.a=b} +function vAb(a,b){Vzb.call(this,a);this.a=b} +function sNb(a){pNb.call(this,0,0);this.f=a} +function Vg(a,b,c){dg.call(this,a,b,c,null)} +function Yg(a,b,c){dg.call(this,a,b,c,null)} +function Pxb(a,b,c){return a.ue(b,c)<=0?c:b} +function Qxb(a,b,c){return a.ue(b,c)<=0?b:c} +function g4c(a,b){return BD(Wrb(a.b,b),149)} +function i4c(a,b){return BD(Wrb(a.c,b),229)} +function wic(a){return BD(Ikb(a.a,a.b),287)} +function B6c(a){return new f7c(a.c,a.d+a.a)} +function eLc(a){return FJc(),Jzc(BD(a,197))} +function $Jb(){$Jb=ccb;ZJb=pqb((tdd(),sdd))} +function fOb(a,b){b.a?gOb(a,b):Fxb(a.a,b.b)} +function qyb(a,b){if(lyb){return}Ekb(a.a,b)} +function F2b(a,b){x2b();return f_b(b.d.i,a)} +function _9b(a,b){I9b();return new gac(b,a)} +function _Hb(a,b){ytb(b,lle);a.f=b;return a} +function Kld(a,b,c){c=_hd(a,b,3,c);return c} +function bmd(a,b,c){c=_hd(a,b,6,c);return c} +function kpd(a,b,c){c=_hd(a,b,9,c);return c} +function Cvd(a,b,c){++a.j;a.Ki();Atd(a,b,c)} +function Avd(a,b,c){++a.j;a.Hi(b,a.oi(b,c))} +function bRd(a,b,c){var d;d=a.Zc(b);d.Rb(c)} +function c7d(a,b,c){return C2d(a.c,a.b,b,c)} +function DAd(a,b){return (b&Ohe)%a.d.length} +function Msd(a,b){Lsd.call(this,a);this.a=b} +function uVd(a,b){lVd.call(this,a);this.a=b} +function sYd(a,b){lVd.call(this,a);this.a=b} +function zyd(a,b){this.c=a;zud.call(this,b)} +function YOd(a,b){this.a=a;qOd.call(this,b)} +function fTd(a,b){this.a=a;qOd.call(this,b)} +function Xp(a){this.a=(Xj(a,Jie),new Skb(a))} +function cq(a){this.a=(Xj(a,Jie),new Skb(a))} +function LA(a){!a.a&&(a.a=new VA);return a.a} +function XMb(a){if(a>8){return 0}return a+1} +function Ecb(a,b){Bcb();return a==b?0:a?1:-1} +function Opb(a,b,c){return Npb(a,BD(b,22),c)} +function Bz(a,b,c){return a.apply(b,c);var d} +function Sfb(a,b,c){a.a+=zfb(b,0,c);return a} +function ijb(a,b){var c;c=a.e;a.e=b;return c} +function trb(a,b){var c;c=a[hke];c.call(a,b)} +function urb(a,b){var c;c=a[hke];c.call(a,b)} +function Aib(a,b){a.a.Vc(a.b,b);++a.b;a.c=-1} +function Urb(a){Uhb(a.e);a.d.b=a.d;a.d.a=a.d} +function _f(a){a.b?_f(a.b):a.f.c.zc(a.e,a.d)} +function _Ab(a,b,c){EAb();MBb(a,b.Ce(a.a,c))} +function Bxb(a,b){return Vd(Cwb(a.a,b,true))} +function Cxb(a,b){return Vd(Dwb(a.a,b,true))} +function _Bb(a,b){return eCb(new Array(b),a)} +function HD(a){return String.fromCharCode(a)} +function mz(a){return a==null?null:a.message} +function gRb(){this.a=new Rkb;this.b=new Rkb} +function iTb(){this.a=new MQb;this.b=new tTb} +function tDb(){this.b=new d7c;this.c=new Rkb} +function _Qb(){this.d=new d7c;this.e=new d7c} +function n_b(){this.n=new d7c;this.o=new d7c} +function $Gb(){this.n=new p0b;this.i=new I6c} +function sec(){this.a=new Umc;this.b=new mnc} +function NIc(){this.a=new Rkb;this.d=new Rkb} +function LDc(){this.b=new Tqb;this.a=new Tqb} +function hSc(){this.b=new Lqb;this.a=new Lqb} +function HRc(){this.b=new tRc;this.a=new hRc} +function aHb(){$Gb.call(this);this.a=new d7c} +function Ywb(a){Zwb.call(this,a,(lxb(),hxb))} +function J_b(a,b,c,d){B_b.call(this,a,b,c,d)} +function sqd(a,b,c){c!=null&&kmd(b,Wqd(a,c))} +function tqd(a,b,c){c!=null&&lmd(b,Wqd(a,c))} +function Tod(a,b,c){c=_hd(a,b,11,c);return c} +function P6c(a,b){a.a+=b.a;a.b+=b.b;return a} +function c7c(a,b){a.a-=b.a;a.b-=b.b;return a} +function u7b(a,b){return a.n.a=(uCb(b),b)+10} +function v7b(a,b){return a.n.a=(uCb(b),b)+10} +function dLd(a,b){return b==a||pud(UKd(b),a)} +function PYd(a,b){return Rhb(a.a,b,'')==null} +function E2b(a,b){x2b();return !f_b(b.d.i,a)} +function rjc(a,b){fad(a.f)?sjc(a,b):tjc(a,b)} +function h1d(a,b){var c;c=b.Hh(a.a);return c} +function Cyd(a,b){qcb.call(this,gve+a+mue+b)} +function gUd(a,b,c,d){cUd.call(this,a,b,c,d)} +function Q4d(a,b,c,d){cUd.call(this,a,b,c,d)} +function U4d(a,b,c,d){Q4d.call(this,a,b,c,d)} +function n5d(a,b,c,d){i5d.call(this,a,b,c,d)} +function p5d(a,b,c,d){i5d.call(this,a,b,c,d)} +function v5d(a,b,c,d){i5d.call(this,a,b,c,d)} +function t5d(a,b,c,d){p5d.call(this,a,b,c,d)} +function A5d(a,b,c,d){p5d.call(this,a,b,c,d)} +function y5d(a,b,c,d){v5d.call(this,a,b,c,d)} +function D5d(a,b,c,d){A5d.call(this,a,b,c,d)} +function d6d(a,b,c,d){Y5d.call(this,a,b,c,d)} +function Vp(a,b,c){this.a=a;qc.call(this,b,c)} +function tk(a,b,c){this.c=b;this.b=c;this.a=a} +function ik(a,b,c){return a.d=BD(b.Kb(c),164)} +function j6d(a,b){return a.Aj().Nh().Kh(a,b)} +function h6d(a,b){return a.Aj().Nh().Ih(a,b)} +function Fdb(a,b){return uCb(a),PD(a)===PD(b)} +function dfb(a,b){return uCb(a),PD(a)===PD(b)} +function Dxb(a,b){return Vd(Cwb(a.a,b,false))} +function Exb(a,b){return Vd(Dwb(a.a,b,false))} +function vBb(a,b){return a.b.sd(new yBb(a,b))} +function BBb(a,b){return a.b.sd(new EBb(a,b))} +function HBb(a,b){return a.b.sd(new KBb(a,b))} +function lfb(a,b,c){return a.lastIndexOf(b,c)} +function uTb(a,b,c){return Kdb(a[b.b],a[c.b])} +function RTb(a,b){return yNb(b,(Nyc(),Cwc),a)} +function fmc(a,b){return beb(b.a.d.p,a.a.d.p)} +function emc(a,b){return beb(a.a.d.p,b.a.d.p)} +function _Oc(a,b){return Kdb(a.c-a.s,b.c-b.s)} +function S_b(a){return !a.c?-1:Jkb(a.c.a,a,0)} +function Vxd(a){return a<100?null:new Ixd(a)} +function ecd(a){return a==Zbd||a==_bd||a==$bd} +function zAd(a,b){return JD(b,15)&&Btd(a.c,b)} +function vyb(a,b){if(lyb){return}!!b&&(a.d=b)} +function ujb(a,b){var c;c=b;return !!Awb(a,c)} +function czd(a,b){this.c=a;Pyd.call(this,a,b)} +function fBb(a){this.c=a;nvb.call(this,rie,0)} +function Avb(a,b){Bvb.call(this,a,a.length,b)} +function aId(a,b,c){return BD(a.c,69).lk(b,c)} +function bId(a,b,c){return BD(a.c,69).mk(b,c)} +function O2d(a,b,c){return N2d(a,BD(b,332),c)} +function Q2d(a,b,c){return P2d(a,BD(b,332),c)} +function i3d(a,b,c){return h3d(a,BD(b,332),c)} +function k3d(a,b,c){return j3d(a,BD(b,332),c)} +function tn(a,b){return b==null?null:Hv(a.b,b)} +function Kcb(a){return LD(a)?(uCb(a),a):a.ke()} +function Ldb(a){return !isNaN(a)&&!isFinite(a)} +function Wn(a){Ql();this.a=(mmb(),new zob(a))} +function dIc(a){FHc();this.d=a;this.a=new jkb} +function xqb(a,b,c){this.a=a;this.b=b;this.c=c} +function Nrb(a,b,c){this.a=a;this.b=b;this.c=c} +function $sb(a,b,c){this.d=a;this.b=c;this.a=b} +function Qsb(a){Csb(this);Osb(this);ye(this,a)} +function Tkb(a){Ckb(this);bCb(this.c,0,a.Pc())} +function Xwb(a){uib(a.a);Kwb(a.c,a.b);a.b=null} +function iyb(a){this.a=a;Zfb();Cbb(Date.now())} +function JCb(){JCb=ccb;GCb=new nb;ICb=new nb} +function ntb(){ntb=ccb;ltb=new otb;mtb=new qtb} +function kzd(){kzd=ccb;jzd=KC(SI,Uhe,1,0,5,1)} +function tGd(){tGd=ccb;sGd=KC(SI,Uhe,1,0,5,1)} +function $Gd(){$Gd=ccb;ZGd=KC(SI,Uhe,1,0,5,1)} +function Ql(){Ql=ccb;new Zl((mmb(),mmb(),jmb))} +function pxb(a){lxb();return es((zxb(),yxb),a)} +function Hyb(a){Fyb();return es((Kyb(),Jyb),a)} +function OEb(a){MEb();return es((REb(),QEb),a)} +function WEb(a){UEb();return es((ZEb(),YEb),a)} +function tFb(a){rFb();return es((wFb(),vFb),a)} +function iHb(a){gHb();return es((lHb(),kHb),a)} +function PHb(a){NHb();return es((SHb(),RHb),a)} +function GIb(a){EIb();return es((JIb(),IIb),a)} +function vJb(a){qJb();return es((yJb(),xJb),a)} +function xLb(a){vLb();return es((ALb(),zLb),a)} +function TMb(a){RMb();return es((WMb(),VMb),a)} +function TOb(a){ROb();return es((WOb(),VOb),a)} +function ePb(a){cPb();return es((hPb(),gPb),a)} +function ZRb(a){XRb();return es((aSb(),_Rb),a)} +function ATb(a){yTb();return es((DTb(),CTb),a)} +function sUb(a){qUb();return es((vUb(),uUb),a)} +function rWb(a){lWb();return es((uWb(),tWb),a)} +function TXb(a){RXb();return es((WXb(),VXb),a)} +function Mb(a,b){if(!a){throw vbb(new Wdb(b))}} +function l0b(a){j0b();return es((o0b(),n0b),a)} +function r0b(a){B_b.call(this,a.d,a.c,a.a,a.b)} +function K_b(a){B_b.call(this,a.d,a.c,a.a,a.b)} +function mKb(a,b,c){this.b=a;this.c=b;this.a=c} +function BZb(a,b,c){this.b=a;this.a=b;this.c=c} +function TNb(a,b,c){this.a=a;this.b=b;this.c=c} +function uOb(a,b,c){this.a=a;this.b=b;this.c=c} +function S3b(a,b,c){this.a=a;this.b=b;this.c=c} +function Z6b(a,b,c){this.a=a;this.b=b;this.c=c} +function n9b(a,b,c){this.b=a;this.a=b;this.c=c} +function x$b(a,b,c){this.e=b;this.b=a;this.d=c} +function $Ab(a,b,c){EAb();a.a.Od(b,c);return b} +function LGb(a){var b;b=new KGb;b.e=a;return b} +function iLb(a){var b;b=new fLb;b.b=a;return b} +function D6b(){D6b=ccb;B6b=new M6b;C6b=new P6b} +function Hgc(){Hgc=ccb;Fgc=new ghc;Ggc=new ihc} +function jbc(a){gbc();return es((mbc(),lbc),a)} +function Cjc(a){Ajc();return es((Fjc(),Ejc),a)} +function Clc(a){Alc();return es((Flc(),Elc),a)} +function Cpc(a){Apc();return es((Fpc(),Epc),a)} +function Kpc(a){Ipc();return es((Npc(),Mpc),a)} +function Wpc(a){Rpc();return es((Zpc(),Ypc),a)} +function $jc(a){Xjc();return es((bkc(),akc),a)} +function Hkc(a){Fkc();return es((Kkc(),Jkc),a)} +function dqc(a){bqc();return es((gqc(),fqc),a)} +function rqc(a){mqc();return es((uqc(),tqc),a)} +function zqc(a){xqc();return es((Cqc(),Bqc),a)} +function Iqc(a){Gqc();return es((Lqc(),Kqc),a)} +function Vqc(a){Sqc();return es((Yqc(),Xqc),a)} +function brc(a){_qc();return es((erc(),drc),a)} +function nrc(a){lrc();return es((qrc(),prc),a)} +function Arc(a){yrc();return es((Drc(),Crc),a)} +function Qrc(a){Orc();return es((Trc(),Src),a)} +function Zrc(a){Xrc();return es((asc(),_rc),a)} +function gsc(a){esc();return es((jsc(),isc),a)} +function osc(a){msc();return es((rsc(),qsc),a)} +function Etc(a){Ctc();return es((Htc(),Gtc),a)} +function qzc(a){lzc();return es((tzc(),szc),a)} +function Azc(a){xzc();return es((Dzc(),Czc),a)} +function Mzc(a){Izc();return es((Pzc(),Ozc),a)} +function MAc(a){KAc();return es((PAc(),OAc),a)} +function mAc(a){kAc();return es((pAc(),oAc),a)} +function vAc(a){tAc();return es((yAc(),xAc),a)} +function DAc(a){BAc();return es((GAc(),FAc),a)} +function VAc(a){TAc();return es((YAc(),XAc),a)} +function $zc(a){Vzc();return es((bAc(),aAc),a)} +function bBc(a){_Ac();return es((eBc(),dBc),a)} +function vBc(a){tBc();return es((yBc(),xBc),a)} +function EBc(a){CBc();return es((HBc(),GBc),a)} +function NBc(a){LBc();return es((QBc(),PBc),a)} +function tGc(a){rGc();return es((wGc(),vGc),a)} +function WIc(a){UIc();return es((ZIc(),YIc),a)} +function $Lc(a){YLc();return es((bMc(),aMc),a)} +function gMc(a){eMc();return es((jMc(),iMc),a)} +function JOc(a){HOc();return es((MOc(),LOc),a)} +function HQc(a){FQc();return es((KQc(),JQc),a)} +function DRc(a){yRc();return es((GRc(),FRc),a)} +function tSc(a){qSc();return es((wSc(),vSc),a)} +function UTc(a){STc();return es((XTc(),WTc),a)} +function UUc(a){PUc();return es((XUc(),WUc),a)} +function aUc(a){$Tc();return es((dUc(),cUc),a)} +function wVc(a){tVc();return es((zVc(),yVc),a)} +function iWc(a){fWc();return es((lWc(),kWc),a)} +function sWc(a){pWc();return es((vWc(),uWc),a)} +function lXc(a){iXc();return es((oXc(),nXc),a)} +function vXc(a){sXc();return es((yXc(),xXc),a)} +function BYc(a){zYc();return es((EYc(),DYc),a)} +function m$c(a){k$c();return es((p$c(),o$c),a)} +function $$c(a){Y$c();return es((b_c(),a_c),a)} +function n_c(a){i_c();return es((q_c(),p_c),a)} +function w_c(a){s_c();return es((z_c(),y_c),a)} +function E_c(a){C_c();return es((H_c(),G_c),a)} +function P_c(a){N_c();return es((S_c(),R_c),a)} +function W0c(a){R0c();return es((Z0c(),Y0c),a)} +function f1c(a){a1c();return es((i1c(),h1c),a)} +function P5c(a){N5c();return es((S5c(),R5c),a)} +function b6c(a){_5c();return es((e6c(),d6c),a)} +function H7c(a){F7c();return es((K7c(),J7c),a)} +function k8c(a){i8c();return es((n8c(),m8c),a)} +function V8b(a){S8b();return es((Y8b(),X8b),a)} +function A5b(a){y5b();return es((D5b(),C5b),a)} +function jad(a){ead();return es((mad(),lad),a)} +function sad(a){qad();return es((vad(),uad),a)} +function Cad(a){Aad();return es((Fad(),Ead),a)} +function Oad(a){Mad();return es((Rad(),Qad),a)} +function jbd(a){hbd();return es((mbd(),lbd),a)} +function ubd(a){rbd();return es((xbd(),wbd),a)} +function Kbd(a){Hbd();return es((Nbd(),Mbd),a)} +function Vbd(a){Tbd();return es((Ybd(),Xbd),a)} +function hcd(a){dcd();return es((kcd(),jcd),a)} +function vcd(a){rcd();return es((ycd(),xcd),a)} +function vdd(a){tdd();return es((ydd(),xdd),a)} +function Kdd(a){Idd();return es((Ndd(),Mdd),a)} +function $cd(a){Ucd();return es((cdd(),bdd),a)} +function Fed(a){Ded();return es((Ied(),Hed),a)} +function rgd(a){pgd();return es((ugd(),tgd),a)} +function Esd(a){Csd();return es((Hsd(),Gsd),a)} +function Yoc(a,b){return (uCb(a),a)+(uCb(b),b)} +function NNd(a,b){Zfb();return wtd(ZKd(a.a),b)} +function SNd(a,b){Zfb();return wtd(ZKd(a.a),b)} +function bPc(a,b){this.c=a;this.a=b;this.b=b-a} +function nYc(a,b,c){this.a=a;this.b=b;this.c=c} +function L1c(a,b,c){this.a=a;this.b=b;this.c=c} +function T1c(a,b,c){this.a=a;this.b=b;this.c=c} +function Rrd(a,b,c){this.a=a;this.b=b;this.c=c} +function zCd(a,b,c){this.a=a;this.b=b;this.c=c} +function IVd(a,b,c){this.e=a;this.a=b;this.c=c} +function kWd(a,b,c){UVd();cWd.call(this,a,b,c)} +function HXd(a,b,c){UVd();oXd.call(this,a,b,c)} +function TXd(a,b,c){UVd();oXd.call(this,a,b,c)} +function ZXd(a,b,c){UVd();oXd.call(this,a,b,c)} +function JXd(a,b,c){UVd();HXd.call(this,a,b,c)} +function LXd(a,b,c){UVd();HXd.call(this,a,b,c)} +function NXd(a,b,c){UVd();LXd.call(this,a,b,c)} +function VXd(a,b,c){UVd();TXd.call(this,a,b,c)} +function _Xd(a,b,c){UVd();ZXd.call(this,a,b,c)} +function $j(a,b){Qb(a);Qb(b);return new _j(a,b)} +function Nq(a,b){Qb(a);Qb(b);return new Wq(a,b)} +function Rq(a,b){Qb(a);Qb(b);return new ar(a,b)} +function lr(a,b){Qb(a);Qb(b);return new zr(a,b)} +function BD(a,b){CCb(a==null||AD(a,b));return a} +function Nu(a){var b;b=new Rkb;fr(b,a);return b} +function Ex(a){var b;b=new Tqb;fr(b,a);return b} +function Hx(a){var b;b=new Gxb;Jq(b,a);return b} +function Ru(a){var b;b=new Psb;Jq(b,a);return b} +function YEc(a){!a.e&&(a.e=new Rkb);return a.e} +function SMd(a){!a.c&&(a.c=new xYd);return a.c} +function Ekb(a,b){a.c[a.c.length]=b;return true} +function WA(a,b){this.c=a;this.b=b;this.a=false} +function Gg(a){this.d=a;Dg(this);this.b=ed(a.d)} +function pzb(){this.a=';,;';this.b='';this.c=''} +function Bvb(a,b,c){qvb.call(this,b,c);this.a=a} +function fAb(a,b,c){this.b=a;fvb.call(this,b,c)} +function lsb(a,b,c){this.c=a;pjb.call(this,b,c)} +function bCb(a,b,c){$Bb(c,0,a,b,c.length,false)} +function HVb(a,b,c,d,e){a.b=b;a.c=c;a.d=d;a.a=e} +function eBb(a,b){if(b){a.b=b;a.a=(Tzb(b),b.a)}} +function v_b(a,b,c,d,e){a.d=b;a.c=c;a.a=d;a.b=e} +function h5b(a){var b,c;b=a.b;c=a.c;a.b=c;a.c=b} +function k5b(a){var b,c;c=a.d;b=a.a;a.d=b;a.a=c} +function Lbb(a){return zbb(iD(Fbb(a)?Rbb(a):a))} +function rlc(a,b){return beb(D0b(a.d),D0b(b.d))} +function uic(a,b){return b==(Ucd(),Tcd)?a.c:a.d} +function FHc(){FHc=ccb;DHc=(Ucd(),Tcd);EHc=zcd} +function DRb(){this.b=Edb(ED(Ksd((wSb(),vSb))))} +function aBb(a){return EAb(),KC(SI,Uhe,1,a,5,1)} +function C6c(a){return new f7c(a.c+a.b,a.d+a.a)} +function Vmc(a,b){Imc();return beb(a.d.p,b.d.p)} +function Lsb(a){sCb(a.b!=0);return Nsb(a,a.a.a)} +function Msb(a){sCb(a.b!=0);return Nsb(a,a.c.b)} +function rCb(a,b){if(!a){throw vbb(new ucb(b))}} +function mCb(a,b){if(!a){throw vbb(new Wdb(b))}} +function dWb(a,b,c){cWb.call(this,a,b);this.b=c} +function pMd(a,b,c){MLd.call(this,a,b);this.c=c} +function Dnc(a,b,c){Cnc.call(this,b,c);this.d=a} +function _Gd(a){$Gd();MGd.call(this);this.th(a)} +function PNd(a,b,c){this.a=a;nNd.call(this,b,c)} +function UNd(a,b,c){this.a=a;nNd.call(this,b,c)} +function k2d(a,b,c){MLd.call(this,a,b);this.c=c} +function y1d(){T0d();z1d.call(this,(yFd(),xFd))} +function gFd(a){return a!=null&&!OEd(a,CEd,DEd)} +function dFd(a,b){return (jFd(a)<<4|jFd(b))&aje} +function ln(a,b){return Vm(),Wj(a,b),new iy(a,b)} +function Sdd(a,b){var c;if(a.n){c=b;Ekb(a.f,c)}} +function Upd(a,b,c){var d;d=new yC(c);cC(a,b,d)} +function WUd(a,b){var c;c=a.c;VUd(a,b);return c} +function Ydd(a,b){b<0?(a.g=-1):(a.g=b);return a} +function $6c(a,b){W6c(a);a.a*=b;a.b*=b;return a} +function G6c(a,b,c,d,e){a.c=b;a.d=c;a.b=d;a.a=e} +function Dsb(a,b){Gsb(a,b,a.c.b,a.c);return true} +function jsb(a){a.a.b=a.b;a.b.a=a.a;a.a=a.b=null} +function Aq(a){this.b=a;this.a=Wm(this.b.a).Ed()} +function Wq(a,b){this.b=a;this.a=b;ol.call(this)} +function ar(a,b){this.a=a;this.b=b;ol.call(this)} +function vvb(a,b){qvb.call(this,b,1040);this.a=a} +function Eeb(a){return a==0||isNaN(a)?a:a<0?-1:1} +function WPb(a){QPb();return jtd(a)==Xod(ltd(a))} +function XPb(a){QPb();return ltd(a)==Xod(jtd(a))} +function iYb(a,b){return hYb(a,new cWb(b.a,b.b))} +function NZb(a){return !OZb(a)&&a.c.i.c==a.d.i.c} +function _Gb(a){var b;b=a.n;return a.a.b+b.d+b.a} +function YHb(a){var b;b=a.n;return a.e.b+b.d+b.a} +function ZHb(a){var b;b=a.n;return a.e.a+b.b+b.c} +function zfe(a){wfe();++vfe;return new ige(0,a)} +function o_b(a){if(a.a){return a.a}return JZb(a)} +function CCb(a){if(!a){throw vbb(new Cdb(null))}} +function X6d(){X6d=ccb;W6d=(mmb(),new anb(Fwe))} +function ex(){ex=ccb;new gx((_k(),$k),(Lk(),Kk))} +function oeb(){oeb=ccb;neb=KC(JI,nie,19,256,0,1)} +function d$c(a,b,c,d){e$c.call(this,a,b,c,d,0,0)} +function sQc(a,b,c){return Rhb(a.b,BD(c.b,17),b)} +function tQc(a,b,c){return Rhb(a.b,BD(c.b,17),b)} +function xfd(a,b){return Ekb(a,new f7c(b.a,b.b))} +function Bic(a,b){return a.c=b){throw vbb(new rcb)}} +function Pyb(a,b,c){NC(b,0,Bzb(b[0],c[0]));return b} +function _yc(a,b,c){b.Ye(c,Edb(ED(Ohb(a.b,c)))*a.a)} +function n6c(a,b,c){i6c();return m6c(a,b)&&m6c(a,c)} +function tcd(a){rcd();return !a.Hc(ncd)&&!a.Hc(pcd)} +function D6c(a){return new f7c(a.c+a.b/2,a.d+a.a/2)} +function oOd(a,b){return b.kh()?xid(a.b,BD(b,49)):b} +function bvb(a,b){this.e=a;this.d=(b&64)!=0?b|oie:b} +function qvb(a,b){this.c=0;this.d=a;this.b=b|64|oie} +function gub(a){this.b=new Skb(11);this.a=(ipb(),a)} +function Qwb(a){this.b=null;this.a=(ipb(),!a?fpb:a)} +function nHc(a){this.a=lHc(a.a);this.b=new Tkb(a.b)} +function Pzd(a){this.b=a;Oyd.call(this,a);Ozd(this)} +function Xzd(a){this.b=a;bzd.call(this,a);Wzd(this)} +function jUd(a,b,c){this.a=a;gUd.call(this,b,c,5,6)} +function Y5d(a,b,c,d){this.b=a;xMd.call(this,b,c,d)} +function nSd(a,b,c,d,e){oSd.call(this,a,b,c,d,e,-1)} +function DSd(a,b,c,d,e){ESd.call(this,a,b,c,d,e,-1)} +function cUd(a,b,c,d){xMd.call(this,a,b,c);this.b=d} +function i5d(a,b,c,d){pMd.call(this,a,b,c);this.b=d} +function x0d(a){Wud.call(this,a,false);this.a=false} +function Lj(a,b){this.b=a;sj.call(this,a.b);this.a=b} +function px(a,b){im();ox.call(this,a,Dm(new amb(b)))} +function Cfe(a,b){wfe();++vfe;return new Dge(a,b,0)} +function Efe(a,b){wfe();++vfe;return new Dge(6,a,b)} +function nfb(a,b){return dfb(a.substr(0,b.length),b)} +function Mhb(a,b){return ND(b)?Qhb(a,b):!!irb(a.f,b)} +function Rrb(a,b){uCb(b);while(a.Ob()){b.td(a.Pb())}} +function Vgb(a,b,c){Hgb();this.e=a;this.d=b;this.a=c} +function amc(a,b,c,d){var e;e=a.i;e.i=b;e.a=c;e.b=d} +function xJc(a){var b;b=a;while(b.f){b=b.f}return b} +function fkb(a){var b;b=bkb(a);sCb(b!=null);return b} +function gkb(a){var b;b=ckb(a);sCb(b!=null);return b} +function cv(a,b){var c;c=a.a.gc();Sb(b,c);return c-b} +function Glb(a,b){var c;for(c=0;c0?$wnd.Math.log(a/b):-100} +function ueb(a,b){return ybb(a,b)<0?-1:ybb(a,b)>0?1:0} +function HMb(a,b,c){return IMb(a,BD(b,46),BD(c,167))} +function iq(a,b){return BD(Rl(Wm(a.a)).Xb(b),42).cd()} +function Olb(a,b){return avb(b,a.length),new vvb(a,b)} +function Pyd(a,b){this.d=a;Fyd.call(this,a);this.e=b} +function Lub(a){this.d=(uCb(a),a);this.a=0;this.c=rie} +function rge(a,b){xfe.call(this,1);this.a=a;this.b=b} +function Rzb(a,b){!a.c?Ekb(a.b,b):Rzb(a.c,b);return a} +function uB(a,b,c){var d;d=tB(a,b);vB(a,b,c);return d} +function ZBb(a,b){var c;c=a.slice(0,b);return PC(c,a)} +function Flb(a,b,c){var d;for(d=0;d=a.g} +function NHc(a,b,c){var d;d=THc(a,b,c);return MHc(a,d)} +function Qpd(a,b){var c;c=a.a.length;tB(a,c);vB(a,c,b)} +function gCb(a,b){var c;c=console[a];c.call(console,b)} +function Bvd(a,b){var c;++a.j;c=a.Vi();a.Ii(a.oi(c,b))} +function E1c(a,b,c){BD(b.b,65);Hkb(b.a,new L1c(a,c,b))} +function oXd(a,b,c){VVd.call(this,b);this.a=a;this.b=c} +function Dge(a,b,c){xfe.call(this,a);this.a=b;this.b=c} +function dYd(a,b,c){this.a=a;lVd.call(this,b);this.b=c} +function f0d(a,b,c){this.a=a;mxd.call(this,8,b,null,c)} +function z1d(a){this.a=(uCb(Rve),Rve);this.b=a;new oUd} +function ct(a){this.c=a;this.b=this.c.a;this.a=this.c.e} +function usb(a){this.c=a;this.b=a.a.d.a;ypb(a.a.e,this)} +function uib(a){yCb(a.c!=-1);a.d.$c(a.c);a.b=a.c;a.c=-1} +function U6c(a){return $wnd.Math.sqrt(a.a*a.a+a.b*a.b)} +function Uvb(a,b){return _vb(b,a.a.c.length),Ikb(a.a,b)} +function Hb(a,b){return PD(a)===PD(b)||a!=null&&pb(a,b)} +function oAb(a){if(0>=a){return new yAb}return pAb(a-1)} +function Nfe(a){if(!bfe)return false;return Qhb(bfe,a)} +function Ehe(a){if(a)return a.dc();return !a.Kc().Ob()} +function Q_b(a){if(!a.a&&!!a.c){return a.c.b}return a.a} +function LHd(a){!a.a&&(a.a=new xMd(m5,a,4));return a.a} +function LQd(a){!a.d&&(a.d=new xMd(j5,a,1));return a.d} +function uCb(a){if(a==null){throw vbb(new Geb)}return a} +function Qzb(a){if(!a.c){a.d=true;Szb(a)}else{a.c.He()}} +function Tzb(a){if(!a.c){Uzb(a);a.d=true}else{Tzb(a.c)}} +function Kpb(a){Ae(a.a);a.b=KC(SI,Uhe,1,a.b.length,5,1)} +function qlc(a,b){return beb(b.j.c.length,a.j.c.length)} +function igd(a,b){a.c<0||a.b.b=0?a.Bh(c):vid(a,b)} +function WHc(a){var b,c;b=a.c.i.c;c=a.d.i.c;return b==c} +function Wwd(a){if(a.p!=4)throw vbb(new Ydb);return a.e} +function Vwd(a){if(a.p!=3)throw vbb(new Ydb);return a.e} +function Ywd(a){if(a.p!=6)throw vbb(new Ydb);return a.f} +function fxd(a){if(a.p!=6)throw vbb(new Ydb);return a.k} +function cxd(a){if(a.p!=3)throw vbb(new Ydb);return a.j} +function dxd(a){if(a.p!=4)throw vbb(new Ydb);return a.j} +function AYd(a){!a.b&&(a.b=new RYd(new NYd));return a.b} +function $1d(a){a.c==-2&&e2d(a,X0d(a.g,a.b));return a.c} +function pdb(a,b){var c;c=ldb('',a);c.n=b;c.i=1;return c} +function MNb(a,b){$Nb(BD(b.b,65),a);Hkb(b.a,new RNb(a))} +function Cnd(a,b){wtd((!a.a&&(a.a=new fTd(a,a)),a.a),b)} +function Qzd(a,b){this.b=a;Pyd.call(this,a,b);Ozd(this)} +function Yzd(a,b){this.b=a;czd.call(this,a,b);Wzd(this)} +function Ms(a,b,c,d){Wo.call(this,a,b);this.d=c;this.a=d} +function $o(a,b,c,d){Wo.call(this,a,c);this.a=b;this.f=d} +function iy(a,b){Pp.call(this,umb(Qb(a),Qb(b)));this.a=b} +function cae(){fod.call(this,Ewe,(p8d(),o8d));$9d(this)} +function AZd(){fod.call(this,_ve,(LFd(),KFd));uZd(this)} +function T0c(){$r.call(this,'DELAUNAY_TRIANGULATION',0)} +function vfb(a){return String.fromCharCode.apply(null,a)} +function Rhb(a,b,c){return ND(b)?Shb(a,b,c):jrb(a.f,b,c)} +function tmb(a){mmb();return !a?(ipb(),ipb(),hpb):a.ve()} +function d2c(a,b,c){Y1c();return c.pg(a,BD(b.cd(),146))} +function ix(a,b){ex();return new gx(new il(a),new Uk(b))} +function Iu(a){Xj(a,Mie);return Oy(wbb(wbb(5,a),a/10|0))} +function Vm(){Vm=ccb;Um=new wx(OC(GC(CK,1),zie,42,0,[]))} +function hob(a){!a.d&&(a.d=new lnb(a.c.Cc()));return a.d} +function eob(a){!a.a&&(a.a=new Gob(a.c.vc()));return a.a} +function gob(a){!a.b&&(a.b=new zob(a.c.ec()));return a.b} +function keb(a,b){while(b-->0){a=a<<1|(a<0?1:0)}return a} +function wtb(a,b){return PD(a)===PD(b)||a!=null&&pb(a,b)} +function Gbc(a,b){return Bcb(),BD(b.b,19).ad&&++d;return d} +function Nnd(a){var b,c;c=(b=new UQd,b);NQd(c,a);return c} +function Ond(a){var b,c;c=(b=new UQd,b);RQd(c,a);return c} +function hqd(a,b){var c;c=Ohb(a.f,b);Yqd(b,c);return null} +function JZb(a){var b;b=P2b(a);if(b){return b}return null} +function Wod(a){!a.b&&(a.b=new cUd(B2,a,12,3));return a.b} +function YEd(a){return a!=null&&hnb(GEd,a.toLowerCase())} +function ied(a,b){return Kdb(red(a)*qed(a),red(b)*qed(b))} +function jed(a,b){return Kdb(red(a)*qed(a),red(b)*qed(b))} +function wEb(a,b){return Kdb(a.d.c+a.d.b/2,b.d.c+b.d.b/2)} +function UVb(a,b){return Kdb(a.g.c+a.g.b/2,b.g.c+b.g.b/2)} +function pQb(a,b,c){c.a?eld(a,b.b-a.f/2):dld(a,b.a-a.g/2)} +function prd(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d} +function ord(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d} +function JVd(a,b,c,d){this.e=a;this.a=b;this.c=c;this.d=d} +function ZVd(a,b,c,d){this.a=a;this.c=b;this.d=c;this.b=d} +function cXd(a,b,c,d){UVd();mWd.call(this,b,c,d);this.a=a} +function jXd(a,b,c,d){UVd();mWd.call(this,b,c,d);this.a=a} +function Ng(a,b){this.a=a;Hg.call(this,a,BD(a.d,15).Zc(b))} +function ZBd(a){this.f=a;this.c=this.f.e;a.f>0&&YBd(this)} +function lBb(a,b,c,d){this.b=a;this.c=d;nvb.call(this,b,c)} +function tib(a){sCb(a.b=0&&dfb(a.substr(c,b.length),b)} +function H2d(a,b,c,d,e,f,g){return new O7d(a.e,b,c,d,e,f,g)} +function Cxd(a,b,c,d,e,f){this.a=a;nxd.call(this,b,c,d,e,f)} +function vyd(a,b,c,d,e,f){this.a=a;nxd.call(this,b,c,d,e,f)} +function $Ec(a,b){this.g=a;this.d=OC(GC(OQ,1),kne,10,0,[b])} +function KVd(a,b){this.e=a;this.a=SI;this.b=R5d(b);this.c=b} +function cIb(a,b){$Gb.call(this);THb(this);this.a=a;this.c=b} +function kBc(a,b,c,d){NC(a.c[b.g],c.g,d);NC(a.c[c.g],b.g,d)} +function nBc(a,b,c,d){NC(a.c[b.g],b.g,c);NC(a.b[b.g],b.g,d)} +function cBc(){_Ac();return OC(GC(fX,1),Kie,376,0,[$Ac,ZAc])} +function crc(){_qc();return OC(GC(MW,1),Kie,479,0,[$qc,Zqc])} +function Aqc(){xqc();return OC(GC(JW,1),Kie,419,0,[vqc,wqc])} +function Lpc(){Ipc();return OC(GC(FW,1),Kie,422,0,[Gpc,Hpc])} +function psc(){msc();return OC(GC(SW,1),Kie,420,0,[ksc,lsc])} +function EAc(){BAc();return OC(GC(cX,1),Kie,421,0,[zAc,AAc])} +function XIc(){UIc();return OC(GC(mY,1),Kie,523,0,[TIc,SIc])} +function KOc(){HOc();return OC(GC(DZ,1),Kie,520,0,[GOc,FOc])} +function _Lc(){YLc();return OC(GC(fZ,1),Kie,516,0,[XLc,WLc])} +function hMc(){eMc();return OC(GC(gZ,1),Kie,515,0,[cMc,dMc])} +function IQc(){FQc();return OC(GC(YZ,1),Kie,455,0,[DQc,EQc])} +function bUc(){$Tc();return OC(GC(F$,1),Kie,425,0,[ZTc,YTc])} +function VTc(){STc();return OC(GC(E$,1),Kie,480,0,[QTc,RTc])} +function VUc(){PUc();return OC(GC(K$,1),Kie,495,0,[NUc,OUc])} +function jWc(){fWc();return OC(GC(X$,1),Kie,426,0,[dWc,eWc])} +function g1c(){a1c();return OC(GC(X_,1),Kie,429,0,[_0c,$0c])} +function F_c(){C_c();return OC(GC(P_,1),Kie,430,0,[B_c,A_c])} +function PEb(){MEb();return OC(GC(aN,1),Kie,428,0,[LEb,KEb])} +function XEb(){UEb();return OC(GC(bN,1),Kie,427,0,[SEb,TEb])} +function $Rb(){XRb();return OC(GC(gP,1),Kie,424,0,[VRb,WRb])} +function B5b(){y5b();return OC(GC(ZR,1),Kie,511,0,[x5b,w5b])} +function lid(a,b,c,d){return c>=0?a.jh(b,c,d):a.Sg(null,c,d)} +function hgd(a){if(a.b.b==0){return a.a.$e()}return Lsb(a.b)} +function Xwd(a){if(a.p!=5)throw vbb(new Ydb);return Tbb(a.f)} +function exd(a){if(a.p!=5)throw vbb(new Ydb);return Tbb(a.k)} +function pNd(a){PD(a.a)===PD((NKd(),MKd))&&qNd(a);return a.a} +function by(a){this.a=BD(Qb(a),271);this.b=(mmb(),new Zob(a))} +function bQc(a,b){$Pc(this,new f7c(a.a,a.b));_Pc(this,Ru(b))} +function FQc(){FQc=ccb;DQc=new GQc(jle,0);EQc=new GQc(kle,1)} +function YLc(){YLc=ccb;XLc=new ZLc(kle,0);WLc=new ZLc(jle,1)} +function Hp(){Gp.call(this,new Mqb(Cv(12)));Lb(true);this.a=2} +function Hge(a,b,c){wfe();xfe.call(this,a);this.b=b;this.a=c} +function cWd(a,b,c){UVd();VVd.call(this,b);this.a=a;this.b=c} +function aIb(a){$Gb.call(this);THb(this);this.a=a;this.c=true} +function isb(a){var b;b=a.c.d.b;a.b=b;a.a=a.c.d;b.a=a.c.d.b=a} +function $Cb(a){var b;NGb(a.a);MGb(a.a);b=new YGb(a.a);UGb(b)} +function iKb(a,b){hKb(a,true);Hkb(a.e.wf(),new mKb(a,true,b))} +function tlb(a,b){pCb(b);return vlb(a,KC(WD,oje,25,b,15,1),b)} +function YPb(a,b){QPb();return a==Xod(jtd(b))||a==Xod(ltd(b))} +function Phb(a,b){return b==null?Wd(irb(a.f,null)):Crb(a.g,b)} +function Ksb(a){return a.b==0?null:(sCb(a.b!=0),Nsb(a,a.a.a))} +function QD(a){return Math.max(Math.min(a,Ohe),-2147483648)|0} +function uz(a,b){var c=tz[a.charCodeAt(0)];return c==null?a:c} +function Cx(a,b){Rb(a,'set1');Rb(b,'set2');return new Px(a,b)} +function QUb(a,b){var c;c=zUb(a.f,b);return P6c(V6c(c),a.f.d)} +function Jwb(a,b){var c,d;c=b;d=new fxb;Lwb(a,c,d);return d.d} +function NJb(a,b,c,d){var e;e=new aHb;b.a[c.g]=e;Npb(a.b,d,e)} +function zid(a,b,c){var d;d=a.Yg(b);d>=0?a.sh(d,c):uid(a,b,c)} +function hvd(a,b,c){evd();!!a&&Rhb(dvd,a,b);!!a&&Rhb(cvd,a,c)} +function g_c(a,b,c){this.i=new Rkb;this.b=a;this.g=b;this.a=c} +function VZc(a,b,c){this.c=new Rkb;this.e=a;this.f=b;this.b=c} +function b$c(a,b,c){this.a=new Rkb;this.e=a;this.f=b;this.c=c} +function Zy(a,b){Py(this);this.f=b;this.g=a;Ry(this);this._d()} +function ZA(a,b){var c;c=a.q.getHours();a.q.setDate(b);YA(a,c)} +function no(a,b){var c;Qb(b);for(c=a.a;c;c=c.c){b.Od(c.g,c.i)}} +function Fx(a){var b;b=new Uqb(Cv(a.length));nmb(b,a);return b} +function ecb(a){function b(){} +;b.prototype=a||{};return new b} +function dkb(a,b){if(Zjb(a,b)){wkb(a);return true}return false} +function aC(a,b){if(b==null){throw vbb(new Geb)}return bC(a,b)} +function tdb(a){if(a.qe()){return null}var b=a.n;return _bb[b]} +function Mld(a){if(a.Db>>16!=3)return null;return BD(a.Cb,33)} +function mpd(a){if(a.Db>>16!=9)return null;return BD(a.Cb,33)} +function fmd(a){if(a.Db>>16!=6)return null;return BD(a.Cb,79)} +function Ind(a){if(a.Db>>16!=7)return null;return BD(a.Cb,235)} +function Fod(a){if(a.Db>>16!=7)return null;return BD(a.Cb,160)} +function Xod(a){if(a.Db>>16!=11)return null;return BD(a.Cb,33)} +function nid(a,b){var c;c=a.Yg(b);return c>=0?a.lh(c):tid(a,b)} +function Dtd(a,b){var c;c=new Bsb(b);Ve(c,a);return new Tkb(c)} +function Uud(a){var b;b=a.d;b=a.si(a.f);wtd(a,b);return b.Ob()} +function t_b(a,b){a.b+=b.b;a.c+=b.c;a.d+=b.d;a.a+=b.a;return a} +function A4b(a,b){return $wnd.Math.abs(a)<$wnd.Math.abs(b)?a:b} +function Zod(a){return !a.a&&(a.a=new cUd(E2,a,10,11)),a.a.i>0} +function oDb(){this.a=new zsb;this.e=new Tqb;this.g=0;this.i=0} +function BGc(a){this.a=a;this.b=KC(SX,nie,1944,a.e.length,0,2)} +function RHc(a,b,c){var d;d=SHc(a,b,c);a.b=new BHc(d.c.length)} +function eMc(){eMc=ccb;cMc=new fMc(vle,0);dMc=new fMc('UP',1)} +function STc(){STc=ccb;QTc=new TTc(Yqe,0);RTc=new TTc('FAN',1)} +function evd(){evd=ccb;dvd=new Lqb;cvd=new Lqb;ivd(hK,new jvd)} +function Swd(a){if(a.p!=0)throw vbb(new Ydb);return Kbb(a.f,0)} +function _wd(a){if(a.p!=0)throw vbb(new Ydb);return Kbb(a.k,0)} +function MHd(a){if(a.Db>>16!=3)return null;return BD(a.Cb,147)} +function ZJd(a){if(a.Db>>16!=6)return null;return BD(a.Cb,235)} +function WId(a){if(a.Db>>16!=17)return null;return BD(a.Cb,26)} +function rdb(a,b){var c=a.a=a.a||[];return c[b]||(c[b]=a.le(b))} +function hrb(a,b){var c;c=a.a.get(b);return c==null?new Array:c} +function aB(a,b){var c;c=a.q.getHours();a.q.setMonth(b);YA(a,c)} +function Shb(a,b,c){return b==null?jrb(a.f,null,c):Drb(a.g,b,c)} +function FLd(a,b,c,d,e,f){return new pSd(a.e,b,a.aj(),c,d,e,f)} +function Tfb(a,b,c){a.a=qfb(a.a,0,b)+(''+c)+pfb(a.a,b);return a} +function bq(a,b,c){Ekb(a.a,(Vm(),Wj(b,c),new Wo(b,c)));return a} +function uu(a){ot(a.c);a.e=a.a=a.c;a.c=a.c.c;++a.d;return a.a.f} +function vu(a){ot(a.e);a.c=a.a=a.e;a.e=a.e.e;--a.d;return a.a.f} +function RZb(a,b){!!a.d&&Lkb(a.d.e,a);a.d=b;!!a.d&&Ekb(a.d.e,a)} +function QZb(a,b){!!a.c&&Lkb(a.c.g,a);a.c=b;!!a.c&&Ekb(a.c.g,a)} +function $_b(a,b){!!a.c&&Lkb(a.c.a,a);a.c=b;!!a.c&&Ekb(a.c.a,a)} +function F0b(a,b){!!a.i&&Lkb(a.i.j,a);a.i=b;!!a.i&&Ekb(a.i.j,a)} +function jDb(a,b,c){this.a=b;this.c=a;this.b=(Qb(c),new Tkb(c))} +function qXb(a,b,c){this.a=b;this.c=a;this.b=(Qb(c),new Tkb(c))} +function aOb(a,b){this.a=a;this.c=R6c(this.a);this.b=new K6c(b)} +function IAb(a){var b;Uzb(a);b=new Tqb;return JAb(a,new jBb(b))} +function wCb(a,b){if(a<0||a>b){throw vbb(new qcb(Ake+a+Bke+b))}} +function Ppb(a,b){return vqb(a.a,b)?Qpb(a,BD(b,22).g,null):null} +function WUb(a){LUb();return Bcb(),BD(a.a,81).d.e!=0?true:false} +function qs(){qs=ccb;ps=as((hs(),OC(GC(yG,1),Kie,538,0,[gs])))} +function SBc(){SBc=ccb;RBc=c3c(new j3c,(qUb(),pUb),(S8b(),J8b))} +function ZBc(){ZBc=ccb;YBc=c3c(new j3c,(qUb(),pUb),(S8b(),J8b))} +function oCc(){oCc=ccb;nCc=c3c(new j3c,(qUb(),pUb),(S8b(),J8b))} +function aJc(){aJc=ccb;_Ic=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function FJc(){FJc=ccb;EJc=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function ILc(){ILc=ccb;HLc=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function wMc(){wMc=ccb;vMc=e3c(new j3c,(qUb(),pUb),(S8b(),h8b))} +function fUc(){fUc=ccb;eUc=c3c(new j3c,(yRc(),xRc),(qSc(),kSc))} +function DOc(a,b,c,d){this.c=a;this.d=d;BOc(this,b);COc(this,c)} +function W3c(a){this.c=new Psb;this.b=a.b;this.d=a.c;this.a=a.a} +function e7c(a){this.a=$wnd.Math.cos(a);this.b=$wnd.Math.sin(a)} +function BOc(a,b){!!a.a&&Lkb(a.a.k,a);a.a=b;!!a.a&&Ekb(a.a.k,a)} +function COc(a,b){!!a.b&&Lkb(a.b.f,a);a.b=b;!!a.b&&Ekb(a.b.f,a)} +function D1c(a,b){E1c(a,a.b,a.c);BD(a.b.b,65);!!b&&BD(b.b,65).b} +function BUd(a,b){CUd(a,b);JD(a.Cb,88)&&XMd($Kd(BD(a.Cb,88)),2)} +function cJd(a,b){JD(a.Cb,88)&&XMd($Kd(BD(a.Cb,88)),4);pnd(a,b)} +function lKd(a,b){JD(a.Cb,179)&&(BD(a.Cb,179).tb=null);pnd(a,b)} +function T2d(a,b){return Q6d(),YId(b)?new R7d(b,a):new f7d(b,a)} +function jsd(a,b){var c,d;c=b.c;d=c!=null;d&&Qpd(a,new yC(b.c))} +function XOd(a){var b,c;c=(LFd(),b=new UQd,b);NQd(c,a);return c} +function eTd(a){var b,c;c=(LFd(),b=new UQd,b);NQd(c,a);return c} +function yCc(a,b){var c;c=new H1b(a);b.c[b.c.length]=c;return c} +function Aw(a,b){var c;c=BD(Hv(nd(a.a),b),14);return !c?0:c.gc()} +function UAb(a){var b;Uzb(a);b=(ipb(),ipb(),gpb);return VAb(a,b)} +function nr(a){var b;while(true){b=a.Pb();if(!a.Ob()){return b}}} +function Ki(a,b){Ii.call(this,new Mqb(Cv(a)));Xj(b,mie);this.a=b} +function Jib(a,b,c){xCb(b,c,a.gc());this.c=a;this.a=b;this.b=c-b} +function Mkb(a,b,c){var d;xCb(b,c,a.c.length);d=c-b;cCb(a.c,b,d)} +function Fub(a,b){Eub(a,Tbb(xbb(Obb(b,24),nke)),Tbb(xbb(b,nke)))} +function tCb(a,b){if(a<0||a>=b){throw vbb(new qcb(Ake+a+Bke+b))}} +function BCb(a,b){if(a<0||a>=b){throw vbb(new Xfb(Ake+a+Bke+b))}} +function Kub(a,b){this.b=(uCb(a),a);this.a=(b&Rje)==0?b|64|oie:b} +function kkb(a){Vjb(this);dCb(this.a,geb($wnd.Math.max(8,a))<<1)} +function A0b(a){return l7c(OC(GC(m1,1),nie,8,0,[a.i.n,a.n,a.a]))} +function Iyb(){Fyb();return OC(GC(xL,1),Kie,132,0,[Cyb,Dyb,Eyb])} +function jHb(){gHb();return OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])} +function QHb(){NHb();return OC(GC(sN,1),Kie,461,0,[LHb,KHb,MHb])} +function HIb(){EIb();return OC(GC(zN,1),Kie,462,0,[DIb,CIb,BIb])} +function UXb(){RXb();return OC(GC(hQ,1),Kie,423,0,[QXb,PXb,OXb])} +function BTb(){yTb();return OC(GC(oP,1),Kie,379,0,[wTb,vTb,xTb])} +function Bzc(){xzc();return OC(GC(ZW,1),Kie,378,0,[uzc,vzc,wzc])} +function Xpc(){Rpc();return OC(GC(GW,1),Kie,314,0,[Ppc,Opc,Qpc])} +function eqc(){bqc();return OC(GC(HW,1),Kie,337,0,[$pc,aqc,_pc])} +function Jqc(){Gqc();return OC(GC(KW,1),Kie,450,0,[Eqc,Dqc,Fqc])} +function Ikc(){Fkc();return OC(GC(vV,1),Kie,361,0,[Ekc,Dkc,Ckc])} +function hsc(){esc();return OC(GC(RW,1),Kie,303,0,[csc,dsc,bsc])} +function $rc(){Xrc();return OC(GC(QW,1),Kie,292,0,[Vrc,Wrc,Urc])} +function NAc(){KAc();return OC(GC(dX,1),Kie,452,0,[JAc,HAc,IAc])} +function wAc(){tAc();return OC(GC(bX,1),Kie,339,0,[rAc,qAc,sAc])} +function WAc(){TAc();return OC(GC(eX,1),Kie,375,0,[QAc,RAc,SAc])} +function OBc(){LBc();return OC(GC(jX,1),Kie,377,0,[JBc,KBc,IBc])} +function wBc(){tBc();return OC(GC(hX,1),Kie,336,0,[qBc,rBc,sBc])} +function FBc(){CBc();return OC(GC(iX,1),Kie,338,0,[BBc,zBc,ABc])} +function uGc(){rGc();return OC(GC(PX,1),Kie,454,0,[oGc,pGc,qGc])} +function xVc(){tVc();return OC(GC(O$,1),Kie,442,0,[sVc,qVc,rVc])} +function tWc(){pWc();return OC(GC(Y$,1),Kie,380,0,[mWc,nWc,oWc])} +function CYc(){zYc();return OC(GC(q_,1),Kie,381,0,[xYc,yYc,wYc])} +function wXc(){sXc();return OC(GC(b_,1),Kie,293,0,[qXc,rXc,pXc])} +function _$c(){Y$c();return OC(GC(J_,1),Kie,437,0,[V$c,W$c,X$c])} +function kbd(){hbd();return OC(GC(z1,1),Kie,334,0,[fbd,ebd,gbd])} +function tad(){qad();return OC(GC(u1,1),Kie,272,0,[nad,oad,pad])} +function o3d(a,b){return p3d(a,b,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function LZc(a,b,c){var d;d=MZc(a,b,false);return d.b<=b&&d.a<=c} +function tMc(a,b,c){var d;d=new sMc;d.b=b;d.a=c;++b.b;Ekb(a.d,d)} +function fs(a,b){var c;c=(uCb(a),a).g;lCb(!!c);uCb(b);return c(b)} +function av(a,b){var c,d;d=cv(a,b);c=a.a.Zc(d);return new qv(a,c)} +function cKd(a){if(a.Db>>16!=6)return null;return BD(aid(a),235)} +function Uwd(a){if(a.p!=2)throw vbb(new Ydb);return Tbb(a.f)&aje} +function bxd(a){if(a.p!=2)throw vbb(new Ydb);return Tbb(a.k)&aje} +function Z1d(a){a.a==(T0d(),S0d)&&d2d(a,U0d(a.g,a.b));return a.a} +function _1d(a){a.d==(T0d(),S0d)&&f2d(a,Y0d(a.g,a.b));return a.d} +function mlb(a){sCb(a.ad?1:0} +function bjc(a,b){var c,d;c=ajc(b);d=c;return BD(Ohb(a.c,d),19).a} +function iSc(a,b){var c;c=a+'';while(c.length0&&a.a[--a.d]==0);a.a[a.d++]==0&&(a.e=0)} +function wwb(a){return !a.a?a.c:a.e.length==0?a.a.a:a.a.a+(''+a.e)} +function RSd(a){return !!a.a&&QSd(a.a.a).i!=0&&!(!!a.b&&QTd(a.b))} +function cLd(a){return !!a.u&&VKd(a.u.a).i!=0&&!(!!a.n&&FMd(a.n))} +function $i(a){return Zj(a.e.Hd().gc()*a.c.Hd().gc(),16,new ij(a))} +function XA(a,b){return ueb(Cbb(a.q.getTime()),Cbb(b.q.getTime()))} +function k_b(a){return BD(Qkb(a,KC(AQ,jne,17,a.c.length,0,1)),474)} +function l_b(a){return BD(Qkb(a,KC(OQ,kne,10,a.c.length,0,1)),193)} +function cKc(a){FJc();return !OZb(a)&&!(!OZb(a)&&a.c.i.c==a.d.i.c)} +function kDb(a,b,c){var d;d=(Qb(a),new Tkb(a));iDb(new jDb(d,b,c))} +function rXb(a,b,c){var d;d=(Qb(a),new Tkb(a));pXb(new qXb(d,b,c))} +function Nwb(a,b){var c;c=1-b;a.a[c]=Owb(a.a[c],c);return Owb(a,b)} +function YXc(a,b){var c;a.e=new QXc;c=gVc(b);Okb(c,a.c);ZXc(a,c,0)} +function o4c(a,b,c,d){var e;e=new w4c;e.a=b;e.b=c;e.c=d;Dsb(a.a,e)} +function p4c(a,b,c,d){var e;e=new w4c;e.a=b;e.b=c;e.c=d;Dsb(a.b,e)} +function i6d(a){var b,c,d;b=new A6d;c=s6d(b,a);z6d(b);d=c;return d} +function vZd(){var a,b,c;b=(c=(a=new UQd,a),c);Ekb(rZd,b);return b} +function H2c(a){a.j.c=KC(SI,Uhe,1,0,5,1);Ae(a.c);h3c(a.a);return a} +function tgc(a){qgc();if(JD(a.g,10)){return BD(a.g,10)}return null} +function Zw(a){if(Ah(a).dc()){return false}Bh(a,new bx);return true} +function _y(b){if(!('stack' in b)){try{throw b}catch(a){}}return b} +function Pb(a,b){if(a<0||a>=b){throw vbb(new qcb(Ib(a,b)))}return a} +function Tb(a,b,c){if(a<0||bc){throw vbb(new qcb(Kb(a,b,c)))}} +function eVb(a,b){Qqb(a.a,b);if(b.d){throw vbb(new hz(Hke))}b.d=a} +function xpb(a,b){if(b.$modCount!=a.$modCount){throw vbb(new Apb)}} +function $pb(a,b){if(JD(b,42)){return Jd(a.a,BD(b,42))}return false} +function dib(a,b){if(JD(b,42)){return Jd(a.a,BD(b,42))}return false} +function msb(a,b){if(JD(b,42)){return Jd(a.a,BD(b,42))}return false} +function qAb(a,b){if(a.a<=a.b){b.ud(a.a++);return true}return false} +function Sbb(a){var b;if(Fbb(a)){b=a;return b==-0.?0:b}return oD(a)} +function tAb(a){var b;Tzb(a);b=new drb;_ub(a.a,new BAb(b));return b} +function Yzb(a){var b;Tzb(a);b=new Gpb;_ub(a.a,new mAb(b));return b} +function Bib(a,b){this.a=a;vib.call(this,a);wCb(b,a.gc());this.b=b} +function orb(a){this.e=a;this.b=this.e.a.entries();this.a=new Array} +function Oi(a){return Zj(a.e.Hd().gc()*a.c.Hd().gc(),273,new cj(a))} +function Qu(a){return new Skb((Xj(a,Mie),Oy(wbb(wbb(5,a),a/10|0))))} +function m_b(a){return BD(Qkb(a,KC(aR,lne,11,a.c.length,0,1)),1943)} +function sMb(a,b,c){return c.f.c.length>0?HMb(a.a,b,c):HMb(a.b,b,c)} +function SZb(a,b,c){!!a.d&&Lkb(a.d.e,a);a.d=b;!!a.d&&Dkb(a.d.e,c,a)} +function a5b(a,b){i5b(b,a);k5b(a.d);k5b(BD(vNb(a,(Nyc(),wxc)),207))} +function _4b(a,b){f5b(b,a);h5b(a.d);h5b(BD(vNb(a,(Nyc(),wxc)),207))} +function Ypd(a,b){var c,d;c=aC(a,b);d=null;!!c&&(d=c.fe());return d} +function Zpd(a,b){var c,d;c=tB(a,b);d=null;!!c&&(d=c.ie());return d} +function $pd(a,b){var c,d;c=aC(a,b);d=null;!!c&&(d=c.ie());return d} +function _pd(a,b){var c,d;c=aC(a,b);d=null;!!c&&(d=aqd(c));return d} +function Tqd(a,b,c){var d;d=Wpd(c);ro(a.g,d,b);ro(a.i,b,c);return b} +function Ez(a,b,c){var d;d=Cz();try{return Bz(a,b,c)}finally{Fz(d)}} +function C6d(a){var b;b=a.Wg();this.a=JD(b,69)?BD(b,69).Zh():b.Kc()} +function j3c(){D2c.call(this);this.j.c=KC(SI,Uhe,1,0,5,1);this.a=-1} +function mxd(a,b,c,d){this.d=a;this.n=b;this.g=c;this.o=d;this.p=-1} +function jk(a,b,c,d){this.e=d;this.d=null;this.c=a;this.a=b;this.b=c} +function uEc(a,b,c){this.d=new HEc(this);this.e=a;this.i=b;this.f=c} +function msc(){msc=ccb;ksc=new nsc(gle,0);lsc=new nsc('TOP_LEFT',1)} +function cDc(){cDc=ccb;bDc=ix(meb(1),meb(4));aDc=ix(meb(1),meb(2))} +function z_c(){z_c=ccb;y_c=as((s_c(),OC(GC(O_,1),Kie,551,0,[r_c])))} +function q_c(){q_c=ccb;p_c=as((i_c(),OC(GC(N_,1),Kie,482,0,[h_c])))} +function Z0c(){Z0c=ccb;Y0c=as((R0c(),OC(GC(W_,1),Kie,530,0,[Q0c])))} +function hPb(){hPb=ccb;gPb=as((cPb(),OC(GC(GO,1),Kie,481,0,[bPb])))} +function yLb(){vLb();return OC(GC(PN,1),Kie,406,0,[uLb,rLb,sLb,tLb])} +function qxb(){lxb();return OC(GC(iL,1),Kie,297,0,[hxb,ixb,jxb,kxb])} +function UOb(){ROb();return OC(GC(CO,1),Kie,394,0,[OOb,NOb,POb,QOb])} +function UMb(){RMb();return OC(GC(jO,1),Kie,323,0,[OMb,NMb,PMb,QMb])} +function sWb(){lWb();return OC(GC(SP,1),Kie,405,0,[hWb,kWb,iWb,jWb])} +function kbc(){gbc();return OC(GC(VS,1),Kie,360,0,[fbc,dbc,ebc,cbc])} +function Vc(a,b,c,d){return JD(c,54)?new Cg(a,b,c,d):new qg(a,b,c,d)} +function Djc(){Ajc();return OC(GC(mV,1),Kie,411,0,[wjc,xjc,yjc,zjc])} +function okc(a){var b;return a.j==(Ucd(),Rcd)&&(b=pkc(a),uqb(b,zcd))} +function Mdc(a,b){var c;c=b.a;QZb(c,b.c.d);RZb(c,b.d.d);q7c(c.a,a.n)} +function Smc(a,b){return BD(Btb(QAb(BD(Qc(a.k,b),15).Oc(),Hmc)),113)} +function Tmc(a,b){return BD(Btb(RAb(BD(Qc(a.k,b),15).Oc(),Hmc)),113)} +function _w(a){return new Kub(rmb(BD(a.a.dd(),14).gc(),a.a.cd()),16)} +function Qq(a){if(JD(a,14)){return BD(a,14).dc()}return !a.Kc().Ob()} +function ugc(a){qgc();if(JD(a.g,145)){return BD(a.g,145)}return null} +function Ko(a){if(a.e.g!=a.b){throw vbb(new Apb)}return !!a.c&&a.d>0} +function Xsb(a){sCb(a.b!=a.d.c);a.c=a.b;a.b=a.b.a;++a.a;return a.c.c} +function Xjb(a,b){uCb(b);NC(a.a,a.c,b);a.c=a.c+1&a.a.length-1;_jb(a)} +function Wjb(a,b){uCb(b);a.b=a.b-1&a.a.length-1;NC(a.a,a.b,b);_jb(a)} +function A2c(a,b){var c;for(c=a.j.c.length;c0&&$fb(a.g,0,b,0,a.i);return b} +function qEd(a,b){pEd();var c;c=BD(Ohb(oEd,a),55);return !c||c.wj(b)} +function Twd(a){if(a.p!=1)throw vbb(new Ydb);return Tbb(a.f)<<24>>24} +function axd(a){if(a.p!=1)throw vbb(new Ydb);return Tbb(a.k)<<24>>24} +function gxd(a){if(a.p!=7)throw vbb(new Ydb);return Tbb(a.k)<<16>>16} +function Zwd(a){if(a.p!=7)throw vbb(new Ydb);return Tbb(a.f)<<16>>16} +function sr(a){var b;b=0;while(a.Ob()){a.Pb();b=wbb(b,1)}return Oy(b)} +function nx(a,b){var c;c=new Vfb;a.xd(c);c.a+='..';b.yd(c);return c.a} +function Sgc(a,b,c){var d;d=BD(Ohb(a.g,c),57);Ekb(a.a.c,new vgd(b,d))} +function VCb(a,b,c){return Ddb(ED(Wd(irb(a.f,b))),ED(Wd(irb(a.f,c))))} +function E2d(a,b,c){return F2d(a,b,c,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function L2d(a,b,c){return M2d(a,b,c,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function q3d(a,b,c){return r3d(a,b,c,JD(b,99)&&(BD(b,18).Bb&Tje)!=0)} +function JJc(a,b){return a==(j0b(),h0b)&&b==h0b?4:a==h0b||b==h0b?8:32} +function Nd(a,b){return PD(b)===PD(a)?'(this Map)':b==null?Xhe:fcb(b)} +function kFd(a,b){return BD(b==null?Wd(irb(a.f,null)):Crb(a.g,b),281)} +function Rqd(a,b,c){var d;d=Wpd(c);Rhb(a.b,d,b);Rhb(a.c,b,c);return b} +function Bfd(a,b){var c;c=b;while(c){O6c(a,c.i,c.j);c=Xod(c)}return a} +function kt(a,b){var c;c=vmb(Nu(new wu(a,b)));ir(new wu(a,b));return c} +function R6d(a,b){Q6d();var c;c=BD(a,66).Mj();kVd(c,b);return c.Ok(b)} +function TOc(a,b,c,d,e){var f;f=OOc(e,c,d);Ekb(b,tOc(e,f));XOc(a,e,b)} +function mic(a,b,c){a.i=0;a.e=0;if(b==c){return}lic(a,b,c);kic(a,b,c)} +function dB(a,b){var c;c=a.q.getHours();a.q.setFullYear(b+nje);YA(a,c)} +function dC(d,a,b){if(b){var c=b.ee();d.a[a]=c(b)}else{delete d.a[a]}} +function vB(d,a,b){if(b){var c=b.ee();b=c(b)}else{b=undefined}d.a[a]=b} +function pCb(a){if(a<0){throw vbb(new Feb('Negative array size: '+a))}} +function VKd(a){if(!a.n){$Kd(a);a.n=new JMd(a,j5,a);_Kd(a)}return a.n} +function Fqb(a){sCb(a.a=0&&a.a[c]===b[c];c--);return c<0} +function Ucc(a,b){Occ();var c;c=a.j.g-b.j.g;if(c!=0){return c}return 0} +function Dtb(a,b){uCb(b);if(a.a!=null){return Itb(b.Kb(a.a))}return ztb} +function Gx(a){var b;if(a){return new Bsb(a)}b=new zsb;Jq(b,a);return b} +function GAb(a,b){var c;return b.b.Kb(SAb(a,b.c.Ee(),(c=new TBb(b),c)))} +function Hub(a){zub();Eub(this,Tbb(xbb(Obb(a,24),nke)),Tbb(xbb(a,nke)))} +function REb(){REb=ccb;QEb=as((MEb(),OC(GC(aN,1),Kie,428,0,[LEb,KEb])))} +function ZEb(){ZEb=ccb;YEb=as((UEb(),OC(GC(bN,1),Kie,427,0,[SEb,TEb])))} +function aSb(){aSb=ccb;_Rb=as((XRb(),OC(GC(gP,1),Kie,424,0,[VRb,WRb])))} +function D5b(){D5b=ccb;C5b=as((y5b(),OC(GC(ZR,1),Kie,511,0,[x5b,w5b])))} +function Cqc(){Cqc=ccb;Bqc=as((xqc(),OC(GC(JW,1),Kie,419,0,[vqc,wqc])))} +function erc(){erc=ccb;drc=as((_qc(),OC(GC(MW,1),Kie,479,0,[$qc,Zqc])))} +function eBc(){eBc=ccb;dBc=as((_Ac(),OC(GC(fX,1),Kie,376,0,[$Ac,ZAc])))} +function GAc(){GAc=ccb;FAc=as((BAc(),OC(GC(cX,1),Kie,421,0,[zAc,AAc])))} +function Npc(){Npc=ccb;Mpc=as((Ipc(),OC(GC(FW,1),Kie,422,0,[Gpc,Hpc])))} +function rsc(){rsc=ccb;qsc=as((msc(),OC(GC(SW,1),Kie,420,0,[ksc,lsc])))} +function MOc(){MOc=ccb;LOc=as((HOc(),OC(GC(DZ,1),Kie,520,0,[GOc,FOc])))} +function ZIc(){ZIc=ccb;YIc=as((UIc(),OC(GC(mY,1),Kie,523,0,[TIc,SIc])))} +function bMc(){bMc=ccb;aMc=as((YLc(),OC(GC(fZ,1),Kie,516,0,[XLc,WLc])))} +function jMc(){jMc=ccb;iMc=as((eMc(),OC(GC(gZ,1),Kie,515,0,[cMc,dMc])))} +function KQc(){KQc=ccb;JQc=as((FQc(),OC(GC(YZ,1),Kie,455,0,[DQc,EQc])))} +function dUc(){dUc=ccb;cUc=as(($Tc(),OC(GC(F$,1),Kie,425,0,[ZTc,YTc])))} +function XUc(){XUc=ccb;WUc=as((PUc(),OC(GC(K$,1),Kie,495,0,[NUc,OUc])))} +function XTc(){XTc=ccb;WTc=as((STc(),OC(GC(E$,1),Kie,480,0,[QTc,RTc])))} +function lWc(){lWc=ccb;kWc=as((fWc(),OC(GC(X$,1),Kie,426,0,[dWc,eWc])))} +function i1c(){i1c=ccb;h1c=as((a1c(),OC(GC(X_,1),Kie,429,0,[_0c,$0c])))} +function H_c(){H_c=ccb;G_c=as((C_c(),OC(GC(P_,1),Kie,430,0,[B_c,A_c])))} +function UIc(){UIc=ccb;TIc=new VIc('UPPER',0);SIc=new VIc('LOWER',1)} +function Lqd(a,b){var c;c=new eC;Spd(c,'x',b.a);Spd(c,'y',b.b);Qpd(a,c)} +function Oqd(a,b){var c;c=new eC;Spd(c,'x',b.a);Spd(c,'y',b.b);Qpd(a,c)} +function Jic(a,b){var c,d;d=false;do{c=Mic(a,b);d=d|c}while(c);return d} +function zHc(a,b){var c,d;c=b;d=0;while(c>0){d+=a.a[c];c-=c&-c}return d} +function Cfd(a,b){var c;c=b;while(c){O6c(a,-c.i,-c.j);c=Xod(c)}return a} +function reb(a,b){var c,d;uCb(b);for(d=a.Kc();d.Ob();){c=d.Pb();b.td(c)}} +function me(a,b){var c;c=b.cd();return new Wo(c,a.e.pc(c,BD(b.dd(),14)))} +function Gsb(a,b,c,d){var e;e=new jtb;e.c=b;e.b=c;e.a=d;d.b=c.a=e;++a.b} +function Nkb(a,b,c){var d;d=(tCb(b,a.c.length),a.c[b]);a.c[b]=c;return d} +function lFd(a,b,c){return BD(b==null?jrb(a.f,null,c):Drb(a.g,b,c),281)} +function fRb(a){return !!a.c&&!!a.d?oRb(a.c)+'->'+oRb(a.d):'e_'+FCb(a)} +function FAb(a,b){return (Uzb(a),WAb(new YAb(a,new qBb(b,a.a)))).sd(DAb)} +function tUb(){qUb();return OC(GC(zP,1),Kie,356,0,[lUb,mUb,nUb,oUb,pUb])} +function _cd(){Ucd();return OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])} +function Dz(b){Az();return function(){return Ez(b,this,arguments);var a}} +function sz(){if(Date.now){return Date.now()}return (new Date).getTime()} +function OZb(a){if(!a.c||!a.d){return false}return !!a.c.i&&a.c.i==a.d.i} +function pv(a){if(!a.c.Sb()){throw vbb(new utb)}a.a=true;return a.c.Ub()} +function ko(a){a.i=0;Alb(a.b,null);Alb(a.c,null);a.a=null;a.e=null;++a.g} +function ycb(a){wcb.call(this,a==null?Xhe:fcb(a),JD(a,78)?BD(a,78):null)} +function PYb(a){MYb();yXb(this);this.a=new Psb;NYb(this,a);Dsb(this.a,a)} +function jYb(){Ckb(this);this.b=new f7c(Pje,Pje);this.a=new f7c(Qje,Qje)} +function rAb(a,b){this.c=0;this.b=b;jvb.call(this,a,17493);this.a=this.c} +function wyb(a){oyb();if(lyb){return}this.c=a;this.e=true;this.a=new Rkb} +function oyb(){oyb=ccb;lyb=true;jyb=false;kyb=false;nyb=false;myb=false} +function C3c(a,b){if(JD(b,149)){return dfb(a.c,BD(b,149).c)}return false} +function zUc(a,b){var c;c=0;!!a&&(c+=a.f.a/2);!!b&&(c+=b.f.a/2);return c} +function j4c(a,b){var c;c=BD(Wrb(a.d,b),23);return c?c:BD(Wrb(a.e,b),23)} +function Lzd(a){this.b=a;Fyd.call(this,a);this.a=BD(Ajd(this.b.a,4),126)} +function Uzd(a){this.b=a;$yd.call(this,a);this.a=BD(Ajd(this.b.a,4),126)} +function $Kd(a){if(!a.t){a.t=new YMd(a);vtd(new c0d(a),0,a.t)}return a.t} +function kad(){ead();return OC(GC(t1,1),Kie,103,0,[cad,bad,aad,_9c,dad])} +function Wbd(){Tbd();return OC(GC(C1,1),Kie,249,0,[Qbd,Sbd,Obd,Pbd,Rbd])} +function Q5c(){N5c();return OC(GC(e1,1),Kie,175,0,[L5c,K5c,I5c,M5c,J5c])} +function Q_c(){N_c();return OC(GC(Q_,1),Kie,316,0,[I_c,J_c,M_c,K_c,L_c])} +function _zc(){Vzc();return OC(GC(_W,1),Kie,315,0,[Uzc,Rzc,Szc,Qzc,Tzc])} +function sqc(){mqc();return OC(GC(IW,1),Kie,335,0,[iqc,hqc,kqc,lqc,jqc])} +function n$c(){k$c();return OC(GC(y_,1),Kie,355,0,[g$c,f$c,i$c,h$c,j$c])} +function _jc(){Xjc();return OC(GC(uV,1),Kie,363,0,[Tjc,Vjc,Wjc,Ujc,Sjc])} +function Ftc(){Ctc();return OC(GC(TW,1),Kie,163,0,[Btc,xtc,ytc,ztc,Atc])} +function T0d(){T0d=ccb;var a,b;R0d=(LFd(),b=new MPd,b);S0d=(a=new OJd,a)} +function yUd(a){var b;if(!a.c){b=a.r;JD(b,88)&&(a.c=BD(b,26))}return a.c} +function zc(a){a.e=3;a.d=a.Yb();if(a.e!=2){a.e=0;return true}return false} +function RC(a){var b,c,d;b=a&Eje;c=a>>22&Eje;d=a<0?Fje:0;return TC(b,c,d)} +function uy(a){var b,c,d,e;for(c=a,d=0,e=c.length;d0?ihb(a,b):lhb(a,-b)} +function Rgb(a,b){if(b==0||a.e==0){return a}return b>0?lhb(a,b):ihb(a,-b)} +function Rr(a){if(Qr(a)){a.c=a.a;return a.a.Pb()}else{throw vbb(new utb)}} +function Yac(a){var b,c;b=a.c.i;c=a.d.i;return b.k==(j0b(),e0b)&&c.k==e0b} +function kZb(a){var b;b=new UZb;tNb(b,a);yNb(b,(Nyc(),jxc),null);return b} +function hid(a,b,c){var d;return d=a.Yg(b),d>=0?a._g(d,c,true):sid(a,b,c)} +function uHb(a,b,c,d){var e;for(e=0;eb){throw vbb(new qcb(Jb(a,b,'index')))}return a} +function zhb(a,b,c,d){var e;e=KC(WD,oje,25,b,15,1);Ahb(e,a,b,c,d);return e} +function _A(a,b){var c;c=a.q.getHours()+(b/60|0);a.q.setMinutes(b);YA(a,c)} +function A$c(a,b){return $wnd.Math.min(S6c(b.a,a.d.d.c),S6c(b.b,a.d.d.c))} +function Thb(a,b){return ND(b)?b==null?krb(a.f,null):Erb(a.g,b):krb(a.f,b)} +function b1b(a){this.c=a;this.a=new olb(this.c.a);this.b=new olb(this.c.b)} +function kRb(){this.e=new Rkb;this.c=new Rkb;this.d=new Rkb;this.b=new Rkb} +function MFb(){this.g=new PFb;this.b=new PFb;this.a=new Rkb;this.k=new Rkb} +function Gjc(a,b,c){this.a=a;this.c=b;this.d=c;Ekb(b.e,this);Ekb(c.b,this)} +function wBb(a,b){fvb.call(this,b.rd(),b.qd()&-6);uCb(a);this.a=a;this.b=b} +function CBb(a,b){jvb.call(this,b.rd(),b.qd()&-6);uCb(a);this.a=a;this.b=b} +function IBb(a,b){nvb.call(this,b.rd(),b.qd()&-6);uCb(a);this.a=a;this.b=b} +function BQc(a,b,c){this.a=a;this.b=b;this.c=c;Ekb(a.t,this);Ekb(b.i,this)} +function SRc(){this.b=new Psb;this.a=new Psb;this.b=new Psb;this.a=new Psb} +function g6c(){g6c=ccb;f6c=new Lsd('org.eclipse.elk.labels.labelManager')} +function Vac(){Vac=ccb;Uac=new Msd('separateLayerConnections',(gbc(),fbc))} +function HOc(){HOc=ccb;GOc=new IOc('REGULAR',0);FOc=new IOc('CRITICAL',1)} +function _Ac(){_Ac=ccb;$Ac=new aBc('STACKED',0);ZAc=new aBc('SEQUENCED',1)} +function C_c(){C_c=ccb;B_c=new D_c('FIXED',0);A_c=new D_c('CENTER_NODE',1)} +function PHc(a,b){var c;c=VHc(a,b);a.b=new BHc(c.c.length);return OHc(a,c)} +function KAd(a,b,c){var d;++a.e;--a.f;d=BD(a.d[b].$c(c),133);return d.dd()} +function JJd(a){var b;if(!a.a){b=a.r;JD(b,148)&&(a.a=BD(b,148))}return a.a} +function poc(a){if(a.a){if(a.e){return poc(a.e)}}else{return a}return null} +function ODc(a,b){if(a.pb.p){return -1}return 0} +function pvb(a,b){uCb(b);if(a.c=0,'Initial capacity must not be negative')} +function lHb(){lHb=ccb;kHb=as((gHb(),OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])))} +function SHb(){SHb=ccb;RHb=as((NHb(),OC(GC(sN,1),Kie,461,0,[LHb,KHb,MHb])))} +function JIb(){JIb=ccb;IIb=as((EIb(),OC(GC(zN,1),Kie,462,0,[DIb,CIb,BIb])))} +function Kyb(){Kyb=ccb;Jyb=as((Fyb(),OC(GC(xL,1),Kie,132,0,[Cyb,Dyb,Eyb])))} +function DTb(){DTb=ccb;CTb=as((yTb(),OC(GC(oP,1),Kie,379,0,[wTb,vTb,xTb])))} +function WXb(){WXb=ccb;VXb=as((RXb(),OC(GC(hQ,1),Kie,423,0,[QXb,PXb,OXb])))} +function Zpc(){Zpc=ccb;Ypc=as((Rpc(),OC(GC(GW,1),Kie,314,0,[Ppc,Opc,Qpc])))} +function gqc(){gqc=ccb;fqc=as((bqc(),OC(GC(HW,1),Kie,337,0,[$pc,aqc,_pc])))} +function Lqc(){Lqc=ccb;Kqc=as((Gqc(),OC(GC(KW,1),Kie,450,0,[Eqc,Dqc,Fqc])))} +function Kkc(){Kkc=ccb;Jkc=as((Fkc(),OC(GC(vV,1),Kie,361,0,[Ekc,Dkc,Ckc])))} +function jsc(){jsc=ccb;isc=as((esc(),OC(GC(RW,1),Kie,303,0,[csc,dsc,bsc])))} +function asc(){asc=ccb;_rc=as((Xrc(),OC(GC(QW,1),Kie,292,0,[Vrc,Wrc,Urc])))} +function Dzc(){Dzc=ccb;Czc=as((xzc(),OC(GC(ZW,1),Kie,378,0,[uzc,vzc,wzc])))} +function YAc(){YAc=ccb;XAc=as((TAc(),OC(GC(eX,1),Kie,375,0,[QAc,RAc,SAc])))} +function yAc(){yAc=ccb;xAc=as((tAc(),OC(GC(bX,1),Kie,339,0,[rAc,qAc,sAc])))} +function PAc(){PAc=ccb;OAc=as((KAc(),OC(GC(dX,1),Kie,452,0,[JAc,HAc,IAc])))} +function QBc(){QBc=ccb;PBc=as((LBc(),OC(GC(jX,1),Kie,377,0,[JBc,KBc,IBc])))} +function yBc(){yBc=ccb;xBc=as((tBc(),OC(GC(hX,1),Kie,336,0,[qBc,rBc,sBc])))} +function HBc(){HBc=ccb;GBc=as((CBc(),OC(GC(iX,1),Kie,338,0,[BBc,zBc,ABc])))} +function wGc(){wGc=ccb;vGc=as((rGc(),OC(GC(PX,1),Kie,454,0,[oGc,pGc,qGc])))} +function zVc(){zVc=ccb;yVc=as((tVc(),OC(GC(O$,1),Kie,442,0,[sVc,qVc,rVc])))} +function vWc(){vWc=ccb;uWc=as((pWc(),OC(GC(Y$,1),Kie,380,0,[mWc,nWc,oWc])))} +function EYc(){EYc=ccb;DYc=as((zYc(),OC(GC(q_,1),Kie,381,0,[xYc,yYc,wYc])))} +function yXc(){yXc=ccb;xXc=as((sXc(),OC(GC(b_,1),Kie,293,0,[qXc,rXc,pXc])))} +function b_c(){b_c=ccb;a_c=as((Y$c(),OC(GC(J_,1),Kie,437,0,[V$c,W$c,X$c])))} +function mbd(){mbd=ccb;lbd=as((hbd(),OC(GC(z1,1),Kie,334,0,[fbd,ebd,gbd])))} +function vad(){vad=ccb;uad=as((qad(),OC(GC(u1,1),Kie,272,0,[nad,oad,pad])))} +function icd(){dcd();return OC(GC(D1,1),Kie,98,0,[ccd,bcd,acd,Zbd,_bd,$bd])} +function ikd(a,b){return !a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),qAd(a.o,b)} +function NAd(a){!a.g&&(a.g=new JCd);!a.g.d&&(a.g.d=new MBd(a));return a.g.d} +function yAd(a){!a.g&&(a.g=new JCd);!a.g.a&&(a.g.a=new SBd(a));return a.g.a} +function EAd(a){!a.g&&(a.g=new JCd);!a.g.b&&(a.g.b=new GBd(a));return a.g.b} +function FAd(a){!a.g&&(a.g=new JCd);!a.g.c&&(a.g.c=new iCd(a));return a.g.c} +function A2d(a,b,c){var d,e;e=new p4d(b,a);for(d=0;dc||b=0?a._g(c,true,true):sid(a,b,true)} +function s6b(a,b){return Kdb(Edb(ED(vNb(a,(wtc(),htc)))),Edb(ED(vNb(b,htc))))} +function pUc(){pUc=ccb;oUc=b3c(b3c(g3c(new j3c,(yRc(),vRc)),(qSc(),pSc)),lSc)} +function IHc(a,b,c){var d;d=SHc(a,b,c);a.b=new BHc(d.c.length);return KHc(a,d)} +function qhe(a){if(a.b<=0)throw vbb(new utb);--a.b;a.a-=a.c.c;return meb(a.a)} +function ptd(a){var b;if(!a.a){throw vbb(new vtb)}b=a.a;a.a=Xod(a.a);return b} +function dBb(a){while(!a.a){if(!HBb(a.c,new hBb(a))){return false}}return true} +function vr(a){var b;Qb(a);if(JD(a,198)){b=BD(a,198);return b}return new wr(a)} +function r3c(a){p3c();BD(a.We((Y9c(),x9c)),174).Fc((rcd(),ocd));a.Ye(w9c,null)} +function p3c(){p3c=ccb;m3c=new v3c;o3c=new x3c;n3c=mn((Y9c(),w9c),m3c,b9c,o3c)} +function fWc(){fWc=ccb;dWc=new hWc('LEAF_NUMBER',0);eWc=new hWc('NODE_SIZE',1)} +function UMc(a,b,c){a.a=b;a.c=c;a.b.a.$b();Osb(a.d);a.e.a.c=KC(SI,Uhe,1,0,5,1)} +function yHc(a){a.a=KC(WD,oje,25,a.b+1,15,1);a.c=KC(WD,oje,25,a.b,15,1);a.d=0} +function MWb(a,b){if(a.a.ue(b.d,a.b)>0){Ekb(a.c,new dWb(b.c,b.d,a.d));a.b=b.d}} +function nud(a,b){if(a.g==null||b>=a.i)throw vbb(new $zd(b,a.i));return a.g[b]} +function pOd(a,b,c){Itd(a,c);if(c!=null&&!a.wj(c)){throw vbb(new tcb)}return c} +function KLd(a){var b;if(a.Ek()){for(b=a.i-1;b>=0;--b){qud(a,b)}}return wud(a)} +function Bwb(a){var b,c;if(!a.b){return null}c=a.b;while(b=c.a[0]){c=b}return c} +function ulb(a,b){var c,d;pCb(b);return c=(d=a.slice(0,b),PC(d,a)),c.length=b,c} +function Klb(a,b,c,d){var e;d=(ipb(),!d?fpb:d);e=a.slice(b,c);Llb(e,a,b,c,-b,d)} +function bid(a,b,c,d,e){return b<0?sid(a,c,d):BD(c,66).Nj().Pj(a,a.yh(),b,d,e)} +function hZd(a){if(JD(a,172)){return ''+BD(a,172).a}return a==null?null:fcb(a)} +function iZd(a){if(JD(a,172)){return ''+BD(a,172).a}return a==null?null:fcb(a)} +function nDb(a,b){if(b.a){throw vbb(new hz(Hke))}Qqb(a.a,b);b.a=a;!a.j&&(a.j=b)} +function qBb(a,b){nvb.call(this,b.rd(),b.qd()&-16449);uCb(a);this.a=a;this.c=b} +function Ti(a,b){var c,d;d=b/a.c.Hd().gc()|0;c=b%a.c.Hd().gc();return Mi(a,d,c)} +function NHb(){NHb=ccb;LHb=new OHb(jle,0);KHb=new OHb(gle,1);MHb=new OHb(kle,2)} +function lxb(){lxb=ccb;hxb=new mxb('All',0);ixb=new rxb;jxb=new txb;kxb=new wxb} +function zxb(){zxb=ccb;yxb=as((lxb(),OC(GC(iL,1),Kie,297,0,[hxb,ixb,jxb,kxb])))} +function uWb(){uWb=ccb;tWb=as((lWb(),OC(GC(SP,1),Kie,405,0,[hWb,kWb,iWb,jWb])))} +function ALb(){ALb=ccb;zLb=as((vLb(),OC(GC(PN,1),Kie,406,0,[uLb,rLb,sLb,tLb])))} +function WMb(){WMb=ccb;VMb=as((RMb(),OC(GC(jO,1),Kie,323,0,[OMb,NMb,PMb,QMb])))} +function WOb(){WOb=ccb;VOb=as((ROb(),OC(GC(CO,1),Kie,394,0,[OOb,NOb,POb,QOb])))} +function GRc(){GRc=ccb;FRc=as((yRc(),OC(GC(h$,1),Kie,393,0,[uRc,vRc,wRc,xRc])))} +function mbc(){mbc=ccb;lbc=as((gbc(),OC(GC(VS,1),Kie,360,0,[fbc,dbc,ebc,cbc])))} +function oXc(){oXc=ccb;nXc=as((iXc(),OC(GC(a_,1),Kie,340,0,[hXc,fXc,gXc,eXc])))} +function Fjc(){Fjc=ccb;Ejc=as((Ajc(),OC(GC(mV,1),Kie,411,0,[wjc,xjc,yjc,zjc])))} +function Pzc(){Pzc=ccb;Ozc=as((Izc(),OC(GC($W,1),Kie,197,0,[Gzc,Hzc,Fzc,Ezc])))} +function ugd(){ugd=ccb;tgd=as((pgd(),OC(GC(k2,1),Kie,396,0,[mgd,ngd,lgd,ogd])))} +function xbd(){xbd=ccb;wbd=as((rbd(),OC(GC(A1,1),Kie,285,0,[qbd,nbd,obd,pbd])))} +function Fad(){Fad=ccb;Ead=as((Aad(),OC(GC(v1,1),Kie,218,0,[zad,xad,wad,yad])))} +function Ied(){Ied=ccb;Hed=as((Ded(),OC(GC(O1,1),Kie,311,0,[Ced,zed,Bed,Aed])))} +function ydd(){ydd=ccb;xdd=as((tdd(),OC(GC(I1,1),Kie,374,0,[rdd,sdd,qdd,pdd])))} +function A9d(){A9d=ccb;Smd();x9d=Pje;w9d=Qje;z9d=new Ndb(Pje);y9d=new Ndb(Qje)} +function _qc(){_qc=ccb;$qc=new arc(ane,0);Zqc=new arc('IMPROVE_STRAIGHTNESS',1)} +function eIc(a,b){FHc();return Ekb(a,new vgd(b,meb(b.e.c.length+b.g.c.length)))} +function gIc(a,b){FHc();return Ekb(a,new vgd(b,meb(b.e.c.length+b.g.c.length)))} +function PC(a,b){HC(b)!=10&&OC(rb(b),b.hm,b.__elementTypeId$,HC(b),a);return a} +function Lkb(a,b){var c;c=Jkb(a,b,0);if(c==-1){return false}Kkb(a,c);return true} +function Zrb(a,b){var c;c=BD(Thb(a.e,b),387);if(c){jsb(c);return c.e}return null} +function Jbb(a){var b;if(Fbb(a)){b=0-a;if(!isNaN(b)){return b}}return zbb(hD(a))} +function Jkb(a,b,c){for(;c=0?fid(a,c,true,true):sid(a,b,true)} +function vgc(a,b){qgc();var c,d;c=ugc(a);d=ugc(b);return !!c&&!!d&&!omb(c.k,d.k)} +function Gqd(a,b){dld(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function Hqd(a,b){eld(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function Iqd(a,b){cld(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function Jqd(a,b){ald(a,b==null||Ldb((uCb(b),b))||isNaN((uCb(b),b))?0:(uCb(b),b))} +function agd(a){(!this.q?(mmb(),mmb(),kmb):this.q).Ac(!a.q?(mmb(),mmb(),kmb):a.q)} +function S2d(a,b){return JD(b,99)&&(BD(b,18).Bb&Tje)!=0?new s4d(b,a):new p4d(b,a)} +function U2d(a,b){return JD(b,99)&&(BD(b,18).Bb&Tje)!=0?new s4d(b,a):new p4d(b,a)} +function INb(a,b){HNb=new tOb;FNb=b;GNb=a;BD(GNb.b,65);KNb(GNb,HNb,null);JNb(GNb)} +function uud(a,b,c){var d;d=a.g[b];mud(a,b,a.oi(b,c));a.gi(b,c,d);a.ci();return d} +function Ftd(a,b){var c;c=a.Xc(b);if(c>=0){a.$c(c);return true}else{return false}} +function YId(a){var b;if(a.d!=a.r){b=wId(a);a.e=!!b&&b.Cj()==Bve;a.d=b}return a.e} +function fr(a,b){var c;Qb(a);Qb(b);c=false;while(b.Ob()){c=c|a.Fc(b.Pb())}return c} +function Wrb(a,b){var c;c=BD(Ohb(a.e,b),387);if(c){Yrb(a,c);return c.e}return null} +function UA(a){var b,c;b=a/60|0;c=a%60;if(c==0){return ''+b}return ''+b+':'+(''+c)} +function LAb(a,b){var c,d;Uzb(a);d=new IBb(b,a.a);c=new fBb(d);return new YAb(a,c)} +function tB(d,a){var b=d.a[a];var c=(rC(),qC)[typeof b];return c?c(b):xC(typeof b)} +function yzc(a){switch(a.g){case 0:return Ohe;case 1:return -1;default:return 0;}} +function oD(a){if(eD(a,(wD(),vD))<0){return -aD(hD(a))}return a.l+a.m*Hje+a.h*Ije} +function HC(a){return a.__elementTypeCategory$==null?10:a.__elementTypeCategory$} +function dub(a){var b;b=a.b.c.length==0?null:Ikb(a.b,0);b!=null&&fub(a,0);return b} +function uA(a,b){while(b[0]=0){++b[0]}} +function sgb(a,b){this.e=b;this.a=vgb(a);this.a<54?(this.f=Sbb(a)):(this.c=ghb(a))} +function vge(a,b,c,d){wfe();xfe.call(this,26);this.c=a;this.a=b;this.d=c;this.b=d} +function EA(a,b,c){var d,e;d=10;for(e=0;ea.a[d]&&(d=c)}return d} +function fic(a,b){var c;c=Jy(a.e.c,b.e.c);if(c==0){return Kdb(a.e.d,b.e.d)}return c} +function Ogb(a,b){if(b.e==0){return Ggb}if(a.e==0){return Ggb}return Dhb(),Ehb(a,b)} +function nCb(a,b){if(!a){throw vbb(new Wdb(DCb('Enum constant undefined: %s',b)))}} +function AWb(){AWb=ccb;xWb=new XWb;yWb=new _Wb;vWb=new dXb;wWb=new hXb;zWb=new lXb} +function UEb(){UEb=ccb;SEb=new VEb('BY_SIZE',0);TEb=new VEb('BY_SIZE_AND_SHAPE',1)} +function XRb(){XRb=ccb;VRb=new YRb('EADES',0);WRb=new YRb('FRUCHTERMAN_REINGOLD',1)} +function xqc(){xqc=ccb;vqc=new yqc('READING_DIRECTION',0);wqc=new yqc('ROTATION',1)} +function uqc(){uqc=ccb;tqc=as((mqc(),OC(GC(IW,1),Kie,335,0,[iqc,hqc,kqc,lqc,jqc])))} +function bAc(){bAc=ccb;aAc=as((Vzc(),OC(GC(_W,1),Kie,315,0,[Uzc,Rzc,Szc,Qzc,Tzc])))} +function bkc(){bkc=ccb;akc=as((Xjc(),OC(GC(uV,1),Kie,363,0,[Tjc,Vjc,Wjc,Ujc,Sjc])))} +function Htc(){Htc=ccb;Gtc=as((Ctc(),OC(GC(TW,1),Kie,163,0,[Btc,xtc,ytc,ztc,Atc])))} +function S_c(){S_c=ccb;R_c=as((N_c(),OC(GC(Q_,1),Kie,316,0,[I_c,J_c,M_c,K_c,L_c])))} +function S5c(){S5c=ccb;R5c=as((N5c(),OC(GC(e1,1),Kie,175,0,[L5c,K5c,I5c,M5c,J5c])))} +function p$c(){p$c=ccb;o$c=as((k$c(),OC(GC(y_,1),Kie,355,0,[g$c,f$c,i$c,h$c,j$c])))} +function vUb(){vUb=ccb;uUb=as((qUb(),OC(GC(zP,1),Kie,356,0,[lUb,mUb,nUb,oUb,pUb])))} +function mad(){mad=ccb;lad=as((ead(),OC(GC(t1,1),Kie,103,0,[cad,bad,aad,_9c,dad])))} +function Ybd(){Ybd=ccb;Xbd=as((Tbd(),OC(GC(C1,1),Kie,249,0,[Qbd,Sbd,Obd,Pbd,Rbd])))} +function cdd(){cdd=ccb;bdd=as((Ucd(),OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])))} +function _1c(a,b){var c;c=BD(Ohb(a.a,b),134);if(!c){c=new zNb;Rhb(a.a,b,c)}return c} +function hoc(a){var b;b=BD(vNb(a,(wtc(),usc)),305);if(b){return b.a==a}return false} +function ioc(a){var b;b=BD(vNb(a,(wtc(),usc)),305);if(b){return b.i==a}return false} +function Jub(a,b){uCb(b);Iub(a);if(a.d.Ob()){b.td(a.d.Pb());return true}return false} +function Oy(a){if(ybb(a,Ohe)>0){return Ohe}if(ybb(a,Rie)<0){return Rie}return Tbb(a)} +function Cv(a){if(a<3){Xj(a,Hie);return a+1}if(a=0&&b=-0.01&&a.a<=ple&&(a.a=0);a.b>=-0.01&&a.b<=ple&&(a.b=0);return a} +function sfb(a,b){return b==(ntb(),ntb(),mtb)?a.toLocaleLowerCase():a.toLowerCase()} +function idb(a){return ((a.i&2)!=0?'interface ':(a.i&1)!=0?'':'class ')+(fdb(a),a.o)} +function Pnd(a){var b,c;c=(b=new SSd,b);wtd((!a.q&&(a.q=new cUd(n5,a,11,10)),a.q),c)} +function Pdd(a,b){var c;c=b>0?b-1:b;return Vdd(Wdd(Xdd(Ydd(new Zdd,c),a.n),a.j),a.k)} +function u2d(a,b,c,d){var e;a.j=-1;Qxd(a,I2d(a,b,c),(Q6d(),e=BD(b,66).Mj(),e.Ok(d)))} +function VWb(a){this.g=a;this.f=new Rkb;this.a=$wnd.Math.min(this.g.c.c,this.g.d.c)} +function mDb(a){this.b=new Rkb;this.a=new Rkb;this.c=new Rkb;this.d=new Rkb;this.e=a} +function Cnc(a,b){this.a=new Lqb;this.e=new Lqb;this.b=(xzc(),wzc);this.c=a;this.b=b} +function bIb(a,b,c){$Gb.call(this);THb(this);this.a=a;this.c=c;this.b=b.d;this.f=b.e} +function yd(a){this.d=a;this.c=a.c.vc().Kc();this.b=null;this.a=null;this.e=(hs(),gs)} +function zud(a){if(a<0){throw vbb(new Wdb('Illegal Capacity: '+a))}this.g=this.ri(a)} +function avb(a,b){if(0>a||a>b){throw vbb(new scb('fromIndex: 0, toIndex: '+a+oke+b))}} +function Gs(a){var b;if(a.a==a.b.a){throw vbb(new utb)}b=a.a;a.c=b;a.a=a.a.e;return b} +function Zsb(a){var b;yCb(!!a.c);b=a.c.a;Nsb(a.d,a.c);a.b==a.c?(a.b=b):--a.a;a.c=null} +function VAb(a,b){var c;Uzb(a);c=new lBb(a,a.a.rd(),a.a.qd()|4,b);return new YAb(a,c)} +function ke(a,b){var c,d;c=BD(Hv(a.d,b),14);if(!c){return null}d=b;return a.e.pc(d,c)} +function xac(a,b){var c,d;for(d=a.Kc();d.Ob();){c=BD(d.Pb(),70);yNb(c,(wtc(),Ssc),b)}} +function t9b(a){var b;b=Edb(ED(vNb(a,(Nyc(),Zwc))));if(b<0){b=0;yNb(a,Zwc,b)}return b} +function ifc(a,b,c){var d;d=$wnd.Math.max(0,a.b/2-0.5);cfc(c,d,1);Ekb(b,new rfc(c,d))} +function NMc(a,b,c){var d;d=a.a.e[BD(b.a,10).p]-a.a.e[BD(c.a,10).p];return QD(Eeb(d))} +function iZb(a,b,c,d,e,f){var g;g=kZb(d);QZb(g,e);RZb(g,f);Rc(a.a,d,new BZb(g,b,c.f))} +function Bid(a,b){var c;c=YKd(a.Tg(),b);if(!c){throw vbb(new Wdb(ite+b+lte))}return c} +function ntd(a,b){var c;c=a;while(Xod(c)){c=Xod(c);if(c==b){return true}}return false} +function Uw(a,b){var c,d,e;d=b.a.cd();c=BD(b.a.dd(),14).gc();for(e=0;e0){a.a/=b;a.b/=b}return a} +function bKd(a){var b;if(a.w){return a.w}else{b=cKd(a);!!b&&!b.kh()&&(a.w=b);return b}} +function gZd(a){var b;if(a==null){return null}else{b=BD(a,190);return Umd(b,b.length)}} +function qud(a,b){if(a.g==null||b>=a.i)throw vbb(new $zd(b,a.i));return a.li(b,a.g[b])} +function Mmc(a){var b,c;b=a.a.d.j;c=a.c.d.j;while(b!=c){rqb(a.b,b);b=Xcd(b)}rqb(a.b,b)} +function Jmc(a){var b;for(b=0;b=14&&b<=16)));return a} +function dcb(a,b,c){var d=function(){return a.apply(d,arguments)};b.apply(d,c);return d} +function TLc(a,b,c){var d,e;d=b;do{e=Edb(a.p[d.p])+c;a.p[d.p]=e;d=a.a[d.p]}while(d!=b)} +function NQd(a,b){var c,d;d=a.a;c=OQd(a,b,null);d!=b&&!a.e&&(c=QQd(a,b,c));!!c&&c.Fi()} +function ADb(a,b){return Iy(),My(Qie),$wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)} +function Ky(a,b){Iy();My(Qie);return $wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)} +function Akc(a,b){gkc();return beb(a.b.c.length-a.e.c.length,b.b.c.length-b.e.c.length)} +function oo(a,b){return Kv(uo(a,b,Tbb(Ibb(Eie,keb(Tbb(Ibb(b==null?0:tb(b),Fie)),15)))))} +function o0b(){o0b=ccb;n0b=as((j0b(),OC(GC(NQ,1),Kie,267,0,[h0b,g0b,e0b,i0b,f0b,d0b])))} +function n8c(){n8c=ccb;m8c=as((i8c(),OC(GC(r1,1),Kie,291,0,[h8c,g8c,f8c,d8c,c8c,e8c])))} +function K7c(){K7c=ccb;J7c=as((F7c(),OC(GC(o1,1),Kie,248,0,[z7c,C7c,D7c,E7c,A7c,B7c])))} +function Fpc(){Fpc=ccb;Epc=as((Apc(),OC(GC(EW,1),Kie,227,0,[wpc,ypc,vpc,xpc,zpc,upc])))} +function Drc(){Drc=ccb;Crc=as((yrc(),OC(GC(OW,1),Kie,275,0,[wrc,trc,xrc,vrc,urc,rrc])))} +function qrc(){qrc=ccb;prc=as((lrc(),OC(GC(NW,1),Kie,274,0,[irc,hrc,krc,grc,jrc,frc])))} +function tzc(){tzc=ccb;szc=as((lzc(),OC(GC(YW,1),Kie,313,0,[jzc,hzc,fzc,gzc,kzc,izc])))} +function Yqc(){Yqc=ccb;Xqc=as((Sqc(),OC(GC(LW,1),Kie,276,0,[Nqc,Mqc,Pqc,Oqc,Rqc,Qqc])))} +function wSc(){wSc=ccb;vSc=as((qSc(),OC(GC(t$,1),Kie,327,0,[pSc,lSc,nSc,mSc,oSc,kSc])))} +function ycd(){ycd=ccb;xcd=as((rcd(),OC(GC(E1,1),Kie,273,0,[pcd,ncd,ocd,mcd,lcd,qcd])))} +function Rad(){Rad=ccb;Qad=as((Mad(),OC(GC(w1,1),Kie,312,0,[Kad,Iad,Lad,Gad,Jad,Had])))} +function Lbd(){Hbd();return OC(GC(B1,1),Kie,93,0,[zbd,ybd,Bbd,Gbd,Fbd,Ebd,Cbd,Dbd,Abd])} +function vkd(a,b){var c;c=a.a;a.a=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,0,c,a.a))} +function wkd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,1,c,a.b))} +function hmd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,3,c,a.b))} +function ald(a,b){var c;c=a.f;a.f=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,3,c,a.f))} +function cld(a,b){var c;c=a.g;a.g=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,4,c,a.g))} +function dld(a,b){var c;c=a.i;a.i=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,5,c,a.i))} +function eld(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,6,c,a.j))} +function omd(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,1,c,a.j))} +function imd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,4,c,a.c))} +function pmd(a,b){var c;c=a.k;a.k=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new lSd(a,2,c,a.k))} +function qQd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new mSd(a,2,c,a.d))} +function AId(a,b){var c;c=a.s;a.s=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new mSd(a,4,c,a.s))} +function DId(a,b){var c;c=a.t;a.t=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new mSd(a,5,c,a.t))} +function _Jd(a,b){var c;c=a.F;a.F=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,5,c,b))} +function izd(a,b){var c;c=BD(Ohb((pEd(),oEd),a),55);return c?c.xj(b):KC(SI,Uhe,1,b,5,1)} +function Xpd(a,b){var c,d;c=b in a.a;if(c){d=aC(a,b).he();if(d){return d.a}}return null} +function ftd(a,b){var c,d,e;c=(d=(Fhd(),e=new Jod,e),!!b&&God(d,b),d);Hod(c,a);return c} +function LLd(a,b,c){Itd(a,c);if(!a.Bk()&&c!=null&&!a.wj(c)){throw vbb(new tcb)}return c} +function Xdd(a,b){a.n=b;if(a.n){a.f=new Rkb;a.e=new Rkb}else{a.f=null;a.e=null}return a} +function ndb(a,b,c,d,e,f){var g;g=ldb(a,b);zdb(c,g);g.i=e?8:0;g.f=d;g.e=e;g.g=f;return g} +function rSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=1;this.c=a;this.a=c} +function tSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=2;this.c=a;this.a=c} +function BSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=6;this.c=a;this.a=c} +function GSd(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=7;this.c=a;this.a=c} +function xSd(a,b,c,d,e){this.d=b;this.j=d;this.e=e;this.o=-1;this.p=4;this.c=a;this.a=c} +function rDb(a,b){var c,d,e,f;for(d=b,e=0,f=d.length;e=0);if(ekb(a.d,a.c)<0){a.a=a.a-1&a.d.a.length-1;a.b=a.d.c}a.c=-1} +function pgb(a){if(a.a<54){return a.f<0?-1:a.f>0?1:0}return (!a.c&&(a.c=fhb(a.f)),a.c).e} +function My(a){if(!(a>=0)){throw vbb(new Wdb('tolerance ('+a+') must be >= 0'))}return a} +function n4c(){if(!f4c){f4c=new m4c;l4c(f4c,OC(GC(C0,1),Uhe,130,0,[new Z9c]))}return f4c} +function KAc(){KAc=ccb;JAc=new LAc(ole,0);HAc=new LAc('INPUT',1);IAc=new LAc('OUTPUT',2)} +function bqc(){bqc=ccb;$pc=new cqc('ARD',0);aqc=new cqc('MSD',1);_pc=new cqc('MANUAL',2)} +function rGc(){rGc=ccb;oGc=new sGc('BARYCENTER',0);pGc=new sGc(Bne,1);qGc=new sGc(Cne,2)} +function ztd(a,b){var c;c=a.gc();if(b<0||b>c)throw vbb(new Cyd(b,c));return new czd(a,b)} +function JAd(a,b){var c;if(JD(b,42)){return a.c.Mc(b)}else{c=qAd(a,b);LAd(a,b);return c}} +function $nd(a,b,c){yId(a,b);pnd(a,c);AId(a,0);DId(a,1);CId(a,true);BId(a,true);return a} +function Xj(a,b){if(a<0){throw vbb(new Wdb(b+' cannot be negative but was: '+a))}return a} +function Bt(a,b){var c,d;for(c=0,d=a.gc();c0){return BD(Ikb(c.a,d-1),10)}return null} +function Lkd(a,b){var c;c=a.k;a.k=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,2,c,a.k))} +function kmd(a,b){var c;c=a.f;a.f=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,8,c,a.f))} +function lmd(a,b){var c;c=a.i;a.i=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,7,c,a.i))} +function Hod(a,b){var c;c=a.a;a.a=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,8,c,a.a))} +function zpd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,0,c,a.b))} +function UUd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,0,c,a.b))} +function VUd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,1,c,a.c))} +function Apd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,1,c,a.c))} +function pQd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,4,c,a.c))} +function PHd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,1,c,a.d))} +function jKd(a,b){var c;c=a.D;a.D=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,2,c,a.D))} +function Rdd(a,b){if(a.r>0&&a.c0&&a.g!=0&&Rdd(a.i,b/a.r*a.i.d)}} +function dge(a,b,c){var d;a.b=b;a.a=c;d=(a.a&512)==512?new hee:new ude;a.c=ode(d,a.b,a.a)} +function g3d(a,b){return T6d(a.e,b)?(Q6d(),YId(b)?new R7d(b,a):new f7d(b,a)):new c8d(b,a)} +function _o(a,b){return Fv(vo(a.a,b,Tbb(Ibb(Eie,keb(Tbb(Ibb(b==null?0:tb(b),Fie)),15)))))} +function Nyb(a,b,c){return Ayb(a,new Kzb(b),new Mzb,new Ozb(c),OC(GC(xL,1),Kie,132,0,[]))} +function pAb(a){var b,c;if(0>a){return new yAb}b=a+1;c=new rAb(b,a);return new vAb(null,c)} +function umb(a,b){mmb();var c;c=new Mqb(1);ND(a)?Shb(c,a,b):jrb(c.f,a,b);return new iob(c)} +function aMb(a,b){var c,d;c=a.o+a.p;d=b.o+b.p;if(cb){b<<=1;return b>0?b:Iie}return b} +function xc(a){Ub(a.e!=3);switch(a.e){case 2:return false;case 0:return true;}return zc(a)} +function T6c(a,b){var c;if(JD(b,8)){c=BD(b,8);return a.a==c.a&&a.b==c.b}else{return false}} +function _Mb(a,b,c){var d,e,f;f=b>>5;e=b&31;d=xbb(Pbb(a.n[c][f],Tbb(Nbb(e,1))),3);return d} +function IAd(a,b){var c,d;for(d=b.vc().Kc();d.Ob();){c=BD(d.Pb(),42);HAd(a,c.cd(),c.dd())}} +function N1c(a,b){var c;c=new tOb;BD(b.b,65);BD(b.b,65);BD(b.b,65);Hkb(b.a,new T1c(a,c,b))} +function DUd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,21,c,a.b))} +function jmd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,11,c,a.d))} +function _Id(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,13,c,a.j))} +function $jb(a,b,c){var d,e,f;f=a.a.length-1;for(e=a.b,d=0;d>>31}d!=0&&(a[c]=d)} +function rmb(a,b){mmb();var c,d;d=new Rkb;for(c=0;c0){this.g=this.ri(this.i+(this.i/8|0)+1);a.Qc(this.g)}} +function u3d(a,b){k2d.call(this,D9,a,b);this.b=this;this.a=S6d(a.Tg(),XKd(this.e.Tg(),this.c))} +function Ld(a,b){var c,d;uCb(b);for(d=b.vc().Kc();d.Ob();){c=BD(d.Pb(),42);a.zc(c.cd(),c.dd())}} +function G2d(a,b,c){var d;for(d=c.Kc();d.Ob();){if(!E2d(a,b,d.Pb())){return false}}return true} +function sVd(a,b,c,d,e){var f;if(c){f=bLd(b.Tg(),a.c);e=c.gh(b,-1-(f==-1?d:f),null,e)}return e} +function tVd(a,b,c,d,e){var f;if(c){f=bLd(b.Tg(),a.c);e=c.ih(b,-1-(f==-1?d:f),null,e)}return e} +function Mgb(a){var b;if(a.b==-2){if(a.e==0){b=-1}else{for(b=0;a.a[b]==0;b++);}a.b=b}return a.b} +function Z4b(a){switch(a.g){case 2:return Ucd(),Tcd;case 4:return Ucd(),zcd;default:return a;}} +function $4b(a){switch(a.g){case 1:return Ucd(),Rcd;case 3:return Ucd(),Acd;default:return a;}} +function nkc(a){var b,c,d;return a.j==(Ucd(),Acd)&&(b=pkc(a),c=uqb(b,zcd),d=uqb(b,Tcd),d||d&&c)} +function oqb(a){var b,c;b=BD(a.e&&a.e(),9);c=BD(ZBb(b,b.length),9);return new xqb(b,c,b.length)} +function l7b(a,b){Odd(b,zne,1);UGb(TGb(new YGb((a$b(),new l$b(a,false,false,new T$b)))));Qdd(b)} +function Fcb(a,b){Bcb();return ND(a)?cfb(a,GD(b)):LD(a)?Ddb(a,ED(b)):KD(a)?Dcb(a,DD(b)):a.wd(b)} +function WZc(a,b){b.q=a;a.d=$wnd.Math.max(a.d,b.r);a.b+=b.d+(a.a.c.length==0?0:a.c);Ekb(a.a,b)} +function m6c(a,b){var c,d,e,f;e=a.c;c=a.c+a.b;f=a.d;d=a.d+a.a;return b.a>e&&b.af&&b.b1||a.Ob()){++a.a;a.g=0;b=a.i;a.Ob();return b}else{throw vbb(new utb)}} +function kNc(a){fNc();var b;if(!Lpb(eNc,a)){b=new hNc;b.a=a;Opb(eNc,a,b)}return BD(Mpb(eNc,a),635)} +function Rbb(a){var b,c,d,e;e=a;d=0;if(e<0){e+=Ije;d=Fje}c=QD(e/Hje);b=QD(e-c*Hje);return TC(b,c,d)} +function Ox(a){var b,c,d;d=0;for(c=new Gqb(a.a);c.a>22);e=a.h+b.h+(d>>22);return TC(c&Eje,d&Eje,e&Fje)} +function nD(a,b){var c,d,e;c=a.l-b.l;d=a.m-b.m+(c>>22);e=a.h-b.h+(d>>22);return TC(c&Eje,d&Eje,e&Fje)} +function bdb(a){var b;if(a<128){b=(ddb(),cdb)[a];!b&&(b=cdb[a]=new Xcb(a));return b}return new Xcb(a)} +function ubb(a){var b;if(JD(a,78)){return a}b=a&&a.__java$exception;if(!b){b=new lz(a);Sz(b)}return b} +function btd(a){if(JD(a,186)){return BD(a,118)}else if(!a){throw vbb(new Heb(gue))}else{return null}} +function Zjb(a,b){if(b==null){return false}while(a.a!=a.b){if(pb(b,vkb(a))){return true}}return false} +function kib(a){if(a.a.Ob()){return true}if(a.a!=a.d){return false}a.a=new orb(a.e.f);return a.a.Ob()} +function Gkb(a,b){var c,d;c=b.Pc();d=c.length;if(d==0){return false}bCb(a.c,a.c.length,c);return true} +function Vyb(a,b,c){var d,e;for(e=b.vc().Kc();e.Ob();){d=BD(e.Pb(),42);a.yc(d.cd(),d.dd(),c)}return a} +function yac(a,b){var c,d;for(d=new olb(a.b);d.a=0,'Negative initial capacity');mCb(b>=0,'Non-positive load factor');Uhb(this)} +function _Ed(a,b,c){if(a>=128)return false;return a<64?Kbb(xbb(Nbb(1,a),c),0):Kbb(xbb(Nbb(1,a-64),b),0)} +function bOb(a,b){if(!a||!b||a==b){return false}return Jy(a.b.c,b.b.c+b.b.b)<0&&Jy(b.b.c,a.b.c+a.b.b)<0} +function I4b(a){var b,c,d;c=a.n;d=a.o;b=a.d;return new J6c(c.a-b.b,c.b-b.d,d.a+(b.b+b.c),d.b+(b.d+b.a))} +function $ic(a){var b,c,d,e;for(c=a.a,d=0,e=c.length;dd)throw vbb(new Cyd(b,d));a.hi()&&(c=Dtd(a,c));return a.Vh(b,c)} +function xNb(a,b,c){return c==null?(!a.q&&(a.q=new Lqb),Thb(a.q,b)):(!a.q&&(a.q=new Lqb),Rhb(a.q,b,c)),a} +function yNb(a,b,c){c==null?(!a.q&&(a.q=new Lqb),Thb(a.q,b)):(!a.q&&(a.q=new Lqb),Rhb(a.q,b,c));return a} +function TQb(a){var b,c;c=new kRb;tNb(c,a);yNb(c,(HSb(),FSb),a);b=new Lqb;VQb(a,c,b);UQb(a,c,b);return c} +function j6c(a){i6c();var b,c,d;c=KC(m1,nie,8,2,0,1);d=0;for(b=0;b<2;b++){d+=0.5;c[b]=r6c(d,a)}return c} +function Mic(a,b){var c,d,e,f;c=false;d=a.a[b].length;for(f=0;f>=1);return b}} +function $C(a){var b,c;c=heb(a.h);if(c==32){b=heb(a.m);return b==32?heb(a.l)+32:b+20-10}else{return c-12}} +function bkb(a){var b;b=a.a[a.b];if(b==null){return null}NC(a.a,a.b,null);a.b=a.b+1&a.a.length-1;return b} +function EDc(a){var b,c;b=a.t-a.k[a.o.p]*a.d+a.j[a.o.p]>a.f;c=a.u+a.e[a.o.p]*a.d>a.f*a.s*a.d;return b||c} +function Iwb(a,b,c){var d,e;d=new exb(b,c);e=new fxb;a.b=Gwb(a,a.b,d,e);e.b||++a.c;a.b.b=false;return e.d} +function djc(a,b,c){var d,e,f,g;g=CHc(b,c);f=0;for(e=g.Kc();e.Ob();){d=BD(e.Pb(),11);Rhb(a.c,d,meb(f++))}} +function xVb(a){var b,c;for(c=new olb(a.a.b);c.ac&&(c=a[b])}return c} +function SHc(a,b,c){var d;d=new Rkb;UHc(a,b,d,(Ucd(),zcd),true,false);UHc(a,c,d,Tcd,false,false);return d} +function crd(a,b,c){var d,e,f,g;f=null;g=b;e=Ypd(g,'labels');d=new Hrd(a,c);f=(Dqd(d.a,d.b,e),e);return f} +function j1d(a,b,c,d){var e;e=r1d(a,b,c,d);if(!e){e=i1d(a,c,d);if(!!e&&!e1d(a,b,e)){return null}}return e} +function m1d(a,b,c,d){var e;e=s1d(a,b,c,d);if(!e){e=l1d(a,c,d);if(!!e&&!e1d(a,b,e)){return null}}return e} +function Xb(a,b){var c;for(c=0;c1||b>=0&&a.b<3} +function w7c(a){var b,c,d;b=new s7c;for(d=Jsb(a,0);d.b!=d.d.c;){c=BD(Xsb(d),8);St(b,0,new g7c(c))}return b} +function qVb(a){var b,c;for(c=new olb(a.a.b);c.ad?1:0} +function NYb(a,b){if(OYb(a,b)){Rc(a.b,BD(vNb(b,(wtc(),Esc)),21),b);Dsb(a.a,b);return true}else{return false}} +function d3b(a){var b,c;b=BD(vNb(a,(wtc(),gtc)),10);if(b){c=b.c;Lkb(c.a,b);c.a.c.length==0&&Lkb(Q_b(b).b,c)}} +function syb(a){if(lyb){return KC(qL,tke,572,0,0,1)}return BD(Qkb(a.a,KC(qL,tke,572,a.a.c.length,0,1)),842)} +function mn(a,b,c,d){Vm();return new wx(OC(GC(CK,1),zie,42,0,[(Wj(a,b),new Wo(a,b)),(Wj(c,d),new Wo(c,d))]))} +function Dnd(a,b,c){var d,e;e=(d=new SSd,d);$nd(e,b,c);wtd((!a.q&&(a.q=new cUd(n5,a,11,10)),a.q),e);return e} +function Zmd(a){var b,c,d,e;e=icb(Rmd,a);c=e.length;d=KC(ZI,nie,2,c,6,1);for(b=0;b=a.b.c.length){return}aub(a,2*b+1);c=2*b+2;c=0&&a[d]===b[d];d--);return d<0?0:Gbb(xbb(a[d],Yje),xbb(b[d],Yje))?-1:1} +function UFc(a,b){var c,d;for(d=Jsb(a,0);d.b!=d.d.c;){c=BD(Xsb(d),214);if(c.e.length>0){b.td(c);c.i&&_Fc(c)}}} +function nzd(a,b){var c,d;d=BD(Ajd(a.a,4),126);c=KC($3,hve,415,b,0,1);d!=null&&$fb(d,0,c,0,d.length);return c} +function JEd(a,b){var c;c=new NEd((a.f&256)!=0,a.i,a.a,a.d,(a.f&16)!=0,a.j,a.g,b);a.e!=null||(c.c=a);return c} +function Dc(a,b){var c,d;for(d=a.Zb().Cc().Kc();d.Ob();){c=BD(d.Pb(),14);if(c.Hc(b)){return true}}return false} +function oNb(a,b,c,d,e){var f,g;for(g=c;g<=e;g++){for(f=b;f<=d;f++){if(YMb(a,f,g)){return true}}}return false} +function Tt(a,b,c){var d,e,f,g;uCb(c);g=false;f=a.Zc(b);for(e=c.Kc();e.Ob();){d=e.Pb();f.Rb(d);g=true}return g} +function Dv(a,b){var c;if(a===b){return true}else if(JD(b,83)){c=BD(b,83);return Ax(Wm(a),c.vc())}return false} +function Nhb(a,b,c){var d,e;for(e=c.Kc();e.Ob();){d=BD(e.Pb(),42);if(a.re(b,d.dd())){return true}}return false} +function Hic(a,b,c){if(!a.d[b.p][c.p]){Gic(a,b,c);a.d[b.p][c.p]=true;a.d[c.p][b.p]=true}return a.a[b.p][c.p]} +function Itd(a,b){if(!a.ai()&&b==null){throw vbb(new Wdb("The 'no null' constraint is violated"))}return b} +function $Jd(a,b){if(a.D==null&&a.B!=null){a.D=a.B;a.B=null}jKd(a,b==null?null:(uCb(b),b));!!a.C&&a.yk(null)} +function XHc(a,b){var c;if(!a||a==b||!wNb(b,(wtc(),Psc))){return false}c=BD(vNb(b,(wtc(),Psc)),10);return c!=a} +function b4d(a){switch(a.i){case 2:{return true}case 1:{return false}case -1:{++a.c}default:{return a.pl()}}} +function c4d(a){switch(a.i){case -2:{return true}case -1:{return false}case 1:{--a.c}default:{return a.ql()}}} +function Xdb(a){Zy.call(this,'The given string does not match the expected format for individual spacings.',a)} +function pgd(){pgd=ccb;mgd=new qgd('ELK',0);ngd=new qgd('JSON',1);lgd=new qgd('DOT',2);ogd=new qgd('SVG',3)} +function pWc(){pWc=ccb;mWc=new rWc(ane,0);nWc=new rWc('RADIAL_COMPACTION',1);oWc=new rWc('WEDGE_COMPACTION',2)} +function Fyb(){Fyb=ccb;Cyb=new Gyb('CONCURRENT',0);Dyb=new Gyb('IDENTITY_FINISH',1);Eyb=new Gyb('UNORDERED',2)} +function nPb(){nPb=ccb;kPb=(cPb(),bPb);jPb=new Nsd(Tle,kPb);iPb=new Lsd(Ule);lPb=new Lsd(Vle);mPb=new Lsd(Wle)} +function Occ(){Occ=ccb;Mcc=new Zcc;Ncc=new _cc;Lcc=new bdc;Kcc=new fdc;Jcc=new jdc;Icc=(uCb(Jcc),new bpb)} +function tBc(){tBc=ccb;qBc=new uBc('CONSERVATIVE',0);rBc=new uBc('CONSERVATIVE_SOFT',1);sBc=new uBc('SLOPPY',2)} +function Zad(){Zad=ccb;Xad=new q0b(15);Wad=new Osd((Y9c(),f9c),Xad);Yad=C9c;Sad=s8c;Tad=Y8c;Vad=_8c;Uad=$8c} +function o7c(a,b,c){var d,e,f;d=new Psb;for(f=Jsb(c,0);f.b!=f.d.c;){e=BD(Xsb(f),8);Dsb(d,new g7c(e))}Tt(a,b,d)} +function r7c(a){var b,c,d;b=0;d=KC(m1,nie,8,a.b,0,1);c=Jsb(a,0);while(c.b!=c.d.c){d[b++]=BD(Xsb(c),8)}return d} +function $Pd(a){var b;b=(!a.a&&(a.a=new cUd(g5,a,9,5)),a.a);if(b.i!=0){return nQd(BD(qud(b,0),678))}return null} +function Ly(a,b){var c;c=wbb(a,b);if(Gbb(Vbb(a,b),0)|Ebb(Vbb(a,c),0)){return c}return wbb(rie,Vbb(Pbb(c,63),1))} +function Yyc(a,b){var c;c=Ksd((dzc(),bzc))!=null&&b.wg()!=null?Edb(ED(b.wg()))/Edb(ED(Ksd(bzc))):1;Rhb(a.b,b,c)} +function le(a,b){var c,d;c=BD(a.d.Bc(b),14);if(!c){return null}d=a.e.hc();d.Gc(c);a.e.d-=c.gc();c.$b();return d} +function AHc(a,b){var c,d;d=a.c[b];if(d==0){return}a.c[b]=0;a.d-=d;c=b+1;while(c0){return _vb(b-1,a.a.c.length),Kkb(a.a,b-1)}else{throw vbb(new Jpb)}} +function C2c(a,b,c){if(b<0){throw vbb(new qcb(ese+b))}if(bb){throw vbb(new Wdb(xke+a+yke+b))}if(a<0||b>c){throw vbb(new scb(xke+a+zke+b+oke+c))}} +function j5c(a){if(!a.a||(a.a.i&8)==0){throw vbb(new Zdb('Enumeration class expected for layout option '+a.f))}} +function vud(a){var b;++a.j;if(a.i==0){a.g=null}else if(a.iRqe?a-c>Rqe:c-a>Rqe} +function pHb(a,b){if(!a){return 0}if(b&&!a.j){return 0}if(JD(a,124)){if(BD(a,124).a.b==0){return 0}}return a.Re()} +function qHb(a,b){if(!a){return 0}if(b&&!a.k){return 0}if(JD(a,124)){if(BD(a,124).a.a==0){return 0}}return a.Se()} +function fhb(a){Hgb();if(a<0){if(a!=-1){return new Tgb(-1,-a)}return Bgb}else return a<=10?Dgb[QD(a)]:new Tgb(1,a)} +function xC(a){rC();throw vbb(new MB("Unexpected typeof result '"+a+"'; please report this bug to the GWT team"))} +function lz(a){jz();Py(this);Ry(this);this.e=a;Sy(this,a);this.g=a==null?Xhe:fcb(a);this.a='';this.b=a;this.a=''} +function F$c(){this.a=new G$c;this.f=new I$c(this);this.b=new K$c(this);this.i=new M$c(this);this.e=new O$c(this)} +function ss(){rs.call(this,new _rb(Cv(16)));Xj(2,mie);this.b=2;this.a=new Ms(null,null,0,null);As(this.a,this.a)} +function xzc(){xzc=ccb;uzc=new zzc('DUMMY_NODE_OVER',0);vzc=new zzc('DUMMY_NODE_UNDER',1);wzc=new zzc('EQUAL',2)} +function LUb(){LUb=ccb;JUb=Fx(OC(GC(t1,1),Kie,103,0,[(ead(),aad),bad]));KUb=Fx(OC(GC(t1,1),Kie,103,0,[dad,_9c]))} +function VQc(a){return (Ucd(),Lcd).Hc(a.j)?Edb(ED(vNb(a,(wtc(),qtc)))):l7c(OC(GC(m1,1),nie,8,0,[a.i.n,a.n,a.a])).b} +function DOb(a){var b,c,d,e;d=a.b.a;for(c=d.a.ec().Kc();c.Ob();){b=BD(c.Pb(),561);e=new MPb(b,a.e,a.f);Ekb(a.g,e)}} +function yId(a,b){var c,d,e;d=a.nk(b,null);e=null;if(b){e=(LFd(),c=new UQd,c);NQd(e,a.r)}d=xId(a,e,d);!!d&&d.Fi()} +function VFc(a,b){var c,d;d=Cub(a.d,1)!=0;c=true;while(c){c=false;c=b.c.Tf(b.e,d);c=c|dGc(a,b,d,false);d=!d}$Fc(a)} +function wZc(a,b){var c,d,e;d=false;c=b.q.d;if(b.de){$Zc(b.q,e);d=c!=b.q.d}}return d} +function PVc(a,b){var c,d,e,f,g,h,i,j;i=b.i;j=b.j;d=a.f;e=d.i;f=d.j;g=i-e;h=j-f;c=$wnd.Math.sqrt(g*g+h*h);return c} +function Rnd(a,b){var c,d;d=jid(a);if(!d){!And&&(And=new lUd);c=(IEd(),PEd(b));d=new s0d(c);wtd(d.Vk(),a)}return d} +function Sc(a,b){var c,d;c=BD(a.c.Bc(b),14);if(!c){return a.jc()}d=a.hc();d.Gc(c);a.d-=c.gc();c.$b();return a.mc(d)} +function j7c(a,b){var c;for(c=0;c=a.c.b:a.a<=a.c.b)){throw vbb(new utb)}b=a.a;a.a+=a.c.c;++a.b;return meb(b)} +function BWb(a){var b;b=new VWb(a);rXb(a.a,zWb,new amb(OC(GC(bQ,1),Uhe,369,0,[b])));!!b.d&&Ekb(b.f,b.d);return b.f} +function Z1b(a){var b;b=new q_b(a.a);tNb(b,a);yNb(b,(wtc(),$sc),a);b.o.a=a.g;b.o.b=a.f;b.n.a=a.i;b.n.b=a.j;return b} +function A9b(a,b,c,d){var e,f;for(f=a.Kc();f.Ob();){e=BD(f.Pb(),70);e.n.a=b.a+(d.a-e.o.a)/2;e.n.b=b.b;b.b+=e.o.b+c}} +function UDb(a,b,c){var d,e;for(e=b.a.a.ec().Kc();e.Ob();){d=BD(e.Pb(),57);if(VDb(a,d,c)){return true}}return false} +function JDc(a){var b,c;for(c=new olb(a.r);c.a=0?b:-b;while(d>0){if(d%2==0){c*=c;d=d/2|0}else{e*=c;d-=1}}return b<0?1/e:e} +function y6c(a,b){var c,d,e;e=1;c=a;d=b>=0?b:-b;while(d>0){if(d%2==0){c*=c;d=d/2|0}else{e*=c;d-=1}}return b<0?1/e:e} +function sAd(a){var b,c,d,e;if(a!=null){for(c=0;c0){c=BD(Ikb(a.a,a.a.c.length-1),570);if(NYb(c,b)){return}}Ekb(a.a,new PYb(b))} +function $gc(a){Hgc();var b,c;b=a.d.c-a.e.c;c=BD(a.g,145);Hkb(c.b,new shc(b));Hkb(c.c,new uhc(b));reb(c.i,new whc(b))} +function gic(a){var b;b=new Ufb;b.a+='VerticalSegment ';Pfb(b,a.e);b.a+=' ';Qfb(b,Eb(new Gb,new olb(a.k)));return b.a} +function u4c(a){var b;b=BD(Wrb(a.c.c,''),229);if(!b){b=new W3c(d4c(c4c(new e4c,''),'Other'));Xrb(a.c.c,'',b)}return b} +function qnd(a){var b;if((a.Db&64)!=0)return Eid(a);b=new Jfb(Eid(a));b.a+=' (name: ';Efb(b,a.zb);b.a+=')';return b.a} +function Jnd(a,b,c){var d,e;e=a.sb;a.sb=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,4,e,b);!c?(c=d):c.Ei(d)}return c} +function _ic(a,b){var c,d,e;c=0;for(e=V_b(a,b).Kc();e.Ob();){d=BD(e.Pb(),11);c+=vNb(d,(wtc(),gtc))!=null?1:0}return c} +function vPc(a,b,c){var d,e,f;d=0;for(f=Jsb(a,0);f.b!=f.d.c;){e=Edb(ED(Xsb(f)));if(e>c){break}else e>=b&&++d}return d} +function RTd(a,b,c){var d,e;d=new pSd(a.e,3,13,null,(e=b.c,e?e:(jGd(),YFd)),HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function STd(a,b,c){var d,e;d=new pSd(a.e,4,13,(e=b.c,e?e:(jGd(),YFd)),null,HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function zId(a,b,c){var d,e;e=a.r;a.r=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,8,e,a.r);!c?(c=d):c.Ei(d)}return c} +function o1d(a,b){var c,d;c=BD(b,676);d=c.vk();!d&&c.wk(d=JD(b,88)?new C1d(a,BD(b,26)):new O1d(a,BD(b,148)));return d} +function kud(a,b,c){var d;a.qi(a.i+1);d=a.oi(b,c);b!=a.i&&$fb(a.g,b,a.g,b+1,a.i-b);NC(a.g,b,d);++a.i;a.bi(b,c);a.ci()} +function vwb(a,b){var c;if(b.a){c=b.a.a.length;!a.a?(a.a=new Wfb(a.d)):Qfb(a.a,a.b);Ofb(a.a,b.a,b.d.length,c)}return a} +function __d(a,b){var c,d,e,f;b.vi(a.a);f=BD(Ajd(a.a,8),1936);if(f!=null){for(c=f,d=0,e=c.length;dc){throw vbb(new qcb(xke+a+zke+b+', size: '+c))}if(a>b){throw vbb(new Wdb(xke+a+yke+b))}} +function eid(a,b,c){if(b<0){vid(a,c)}else{if(!c.Ij()){throw vbb(new Wdb(ite+c.ne()+jte))}BD(c,66).Nj().Vj(a,a.yh(),b)}} +function Jlb(a,b,c,d,e,f,g,h){var i;i=c;while(f=d||b=65&&a<=70){return a-65+10}if(a>=97&&a<=102){return a-97+10}if(a>=48&&a<=57){return a-48}return 0} +function QHd(a){var b;if((a.Db&64)!=0)return Eid(a);b=new Jfb(Eid(a));b.a+=' (source: ';Efb(b,a.d);b.a+=')';return b.a} +function OQd(a,b,c){var d,e;e=a.a;a.a=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,5,e,a.a);!c?(c=d):Qwd(c,d)}return c} +function BId(a,b){var c;c=(a.Bb&256)!=0;b?(a.Bb|=256):(a.Bb&=-257);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,2,c,b))} +function eLd(a,b){var c;c=(a.Bb&256)!=0;b?(a.Bb|=256):(a.Bb&=-257);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,8,c,b))} +function LPd(a,b){var c;c=(a.Bb&256)!=0;b?(a.Bb|=256):(a.Bb&=-257);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,8,c,b))} +function CId(a,b){var c;c=(a.Bb&512)!=0;b?(a.Bb|=512):(a.Bb&=-513);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,3,c,b))} +function fLd(a,b){var c;c=(a.Bb&512)!=0;b?(a.Bb|=512):(a.Bb&=-513);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,9,c,b))} +function N7d(a,b){var c;if(a.b==-1&&!!a.a){c=a.a.Gj();a.b=!c?bLd(a.c.Tg(),a.a):a.c.Xg(a.a.aj(),c)}return a.c.Og(a.b,b)} +function meb(a){var b,c;if(a>-129&&a<128){b=a+128;c=(oeb(),neb)[b];!c&&(c=neb[b]=new _db(a));return c}return new _db(a)} +function Web(a){var b,c;if(a>-129&&a<128){b=a+128;c=(Yeb(),Xeb)[b];!c&&(c=Xeb[b]=new Qeb(a));return c}return new Qeb(a)} +function L5b(a){var b,c;b=a.k;if(b==(j0b(),e0b)){c=BD(vNb(a,(wtc(),Hsc)),61);return c==(Ucd(),Acd)||c==Rcd}return false} +function i1d(a,b,c){var d,e,f;f=(e=nUd(a.b,b),e);if(f){d=BD(V1d(p1d(a,f),''),26);if(d){return r1d(a,d,b,c)}}return null} +function l1d(a,b,c){var d,e,f;f=(e=nUd(a.b,b),e);if(f){d=BD(V1d(p1d(a,f),''),26);if(d){return s1d(a,d,b,c)}}return null} +function cTd(a,b){var c,d;for(d=new Fyd(a);d.e!=d.i.gc();){c=BD(Dyd(d),138);if(PD(b)===PD(c)){return true}}return false} +function vtd(a,b,c){var d;d=a.gc();if(b>d)throw vbb(new Cyd(b,d));if(a.hi()&&a.Hc(c)){throw vbb(new Wdb(kue))}a.Xh(b,c)} +function iqd(a,b){var c;c=oo(a.i,b);if(c==null){throw vbb(new cqd('Node did not exist in input.'))}Yqd(b,c);return null} +function $hd(a,b){var c;c=YKd(a,b);if(JD(c,322)){return BD(c,34)}throw vbb(new Wdb(ite+b+"' is not a valid attribute"))} +function V2d(a,b,c){var d,e;e=JD(b,99)&&(BD(b,18).Bb&Tje)!=0?new s4d(b,a):new p4d(b,a);for(d=0;db){return 1}if(a==b){return a==0?Kdb(1/a,1/b):0}return isNaN(a)?isNaN(b)?0:1:-1} +function f4b(a,b){Odd(b,'Sort end labels',1);MAb(JAb(LAb(new YAb(null,new Kub(a.b,16)),new q4b),new s4b),new u4b);Qdd(b)} +function Wxd(a,b,c){var d,e;if(a.ej()){e=a.fj();d=sud(a,b,c);a.$i(a.Zi(7,meb(c),d,b,e));return d}else{return sud(a,b,c)}} +function vAd(a,b){var c,d,e;if(a.d==null){++a.e;--a.f}else{e=b.cd();c=b.Sh();d=(c&Ohe)%a.d.length;KAd(a,d,xAd(a,d,c,e))}} +function ZId(a,b){var c;c=(a.Bb&zte)!=0;b?(a.Bb|=zte):(a.Bb&=-1025);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,10,c,b))} +function dJd(a,b){var c;c=(a.Bb&Rje)!=0;b?(a.Bb|=Rje):(a.Bb&=-4097);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,12,c,b))} +function eJd(a,b){var c;c=(a.Bb&Cve)!=0;b?(a.Bb|=Cve):(a.Bb&=-8193);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,15,c,b))} +function fJd(a,b){var c;c=(a.Bb&Dve)!=0;b?(a.Bb|=Dve):(a.Bb&=-2049);(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new qSd(a,1,11,c,b))} +function jOb(a,b){var c;c=Kdb(a.b.c,b.b.c);if(c!=0){return c}c=Kdb(a.a.a,b.a.a);if(c!=0){return c}return Kdb(a.a.b,b.a.b)} +function jqd(a,b){var c;c=Ohb(a.k,b);if(c==null){throw vbb(new cqd('Port did not exist in input.'))}Yqd(b,c);return null} +function k6d(a){var b,c;for(c=l6d(bKd(a)).Kc();c.Ob();){b=GD(c.Pb());if(Dmd(a,b)){return uFd((tFd(),sFd),b)}}return null} +function n3d(a,b){var c,d,e,f,g;g=S6d(a.e.Tg(),b);f=0;c=BD(a.g,119);for(e=0;e>10)+Uje&aje;b[1]=(a&1023)+56320&aje;return zfb(b,0,b.length)} +function a_b(a){var b,c;c=BD(vNb(a,(Nyc(),Lwc)),103);if(c==(ead(),cad)){b=Edb(ED(vNb(a,owc)));return b>=1?bad:_9c}return c} +function rec(a){switch(BD(vNb(a,(Nyc(),Swc)),218).g){case 1:return new Fmc;case 3:return new wnc;default:return new zmc;}} +function Uzb(a){if(a.c){Uzb(a.c)}else if(a.d){throw vbb(new Zdb("Stream already terminated, can't be modified or used"))}} +function Mkd(a){var b;if((a.Db&64)!=0)return Eid(a);b=new Jfb(Eid(a));b.a+=' (identifier: ';Efb(b,a.k);b.a+=')';return b.a} +function ctd(a,b,c){var d,e;d=(Fhd(),e=new xkd,e);vkd(d,b);wkd(d,c);!!a&&wtd((!a.a&&(a.a=new xMd(y2,a,5)),a.a),d);return d} +function ttb(a,b,c,d){var e,f;uCb(d);uCb(c);e=a.xc(b);f=e==null?c:Myb(BD(e,15),BD(c,14));f==null?a.Bc(b):a.zc(b,f);return f} +function pqb(a){var b,c,d,e;c=(b=BD(gdb((d=a.gm,e=d.f,e==CI?d:e)),9),new xqb(b,BD(_Bb(b,b.length),9),0));rqb(c,a);return c} +function hDc(a,b,c){var d,e;for(e=a.a.ec().Kc();e.Ob();){d=BD(e.Pb(),10);if(Be(c,BD(Ikb(b,d.p),14))){return d}}return null} +function Db(b,c,d){var e;try{Cb(b,c,d)}catch(a){a=ubb(a);if(JD(a,597)){e=a;throw vbb(new ycb(e))}else throw vbb(a)}return c} +function Qbb(a,b){var c;if(Fbb(a)&&Fbb(b)){c=a-b;if(Kje>1;a.k=c-1>>1} +function Gub(){zub();var a,b,c;c=yub+++Date.now();a=QD($wnd.Math.floor(c*lke))&nke;b=QD(c-a*mke);this.a=a^1502;this.b=b^kke} +function O_b(a){var b,c,d;b=new Rkb;for(d=new olb(a.j);d.a3.4028234663852886E38){return Pje}else if(b<-3.4028234663852886E38){return Qje}return b} +function aeb(a){a-=a>>1&1431655765;a=(a>>2&858993459)+(a&858993459);a=(a>>4)+a&252645135;a+=a>>8;a+=a>>16;return a&63} +function Ev(a){var b,c,d,e;b=new cq(a.Hd().gc());e=0;for(d=vr(a.Hd().Kc());d.Ob();){c=d.Pb();bq(b,c,meb(e++))}return fn(b.a)} +function Uyb(a,b){var c,d,e;e=new Lqb;for(d=b.vc().Kc();d.Ob();){c=BD(d.Pb(),42);Rhb(e,c.cd(),Yyb(a,BD(c.dd(),15)))}return e} +function EZc(a,b){a.n.c.length==0&&Ekb(a.n,new VZc(a.s,a.t,a.i));Ekb(a.b,b);QZc(BD(Ikb(a.n,a.n.c.length-1),211),b);GZc(a,b)} +function LFb(a){if(a.c!=a.b.b||a.i!=a.g.b){a.a.c=KC(SI,Uhe,1,0,5,1);Gkb(a.a,a.b);Gkb(a.a,a.g);a.c=a.b.b;a.i=a.g.b}return a.a} +function Ycc(a,b){var c,d,e;e=0;for(d=BD(b.Kb(a),20).Kc();d.Ob();){c=BD(d.Pb(),17);Ccb(DD(vNb(c,(wtc(),ltc))))||++e}return e} +function efc(a,b){var c,d,e;d=tgc(b);e=Edb(ED(pBc(d,(Nyc(),lyc))));c=$wnd.Math.max(0,e/2-0.5);cfc(b,c,1);Ekb(a,new Dfc(b,c))} +function Ctc(){Ctc=ccb;Btc=new Dtc(ane,0);xtc=new Dtc('FIRST',1);ytc=new Dtc(Gne,2);ztc=new Dtc('LAST',3);Atc=new Dtc(Hne,4)} +function Aad(){Aad=ccb;zad=new Bad(ole,0);xad=new Bad('POLYLINE',1);wad=new Bad('ORTHOGONAL',2);yad=new Bad('SPLINES',3)} +function zYc(){zYc=ccb;xYc=new AYc('ASPECT_RATIO_DRIVEN',0);yYc=new AYc('MAX_SCALE_DRIVEN',1);wYc=new AYc('AREA_DRIVEN',2)} +function Y$c(){Y$c=ccb;V$c=new Z$c('P1_STRUCTURE',0);W$c=new Z$c('P2_PROCESSING_ORDER',1);X$c=new Z$c('P3_EXECUTION',2)} +function tVc(){tVc=ccb;sVc=new uVc('OVERLAP_REMOVAL',0);qVc=new uVc('COMPACTION',1);rVc=new uVc('GRAPH_SIZE_CALCULATION',2)} +function Jy(a,b){Iy();return My(Qie),$wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b))} +function yOc(a,b){var c,d;c=Jsb(a,0);while(c.b!=c.d.c){d=Gdb(ED(Xsb(c)));if(d==b){return}else if(d>b){Ysb(c);break}}Vsb(c,b)} +function t4c(a,b){var c,d,e,f,g;c=b.f;Xrb(a.c.d,c,b);if(b.g!=null){for(e=b.g,f=0,g=e.length;fb&&d.ue(a[f-1],a[f])>0;--f){g=a[f];NC(a,f,a[f-1]);NC(a,f-1,g)}}} +function did(a,b,c,d){if(b<0){uid(a,c,d)}else{if(!c.Ij()){throw vbb(new Wdb(ite+c.ne()+jte))}BD(c,66).Nj().Tj(a,a.yh(),b,d)}} +function xFb(a,b){if(b==a.d){return a.e}else if(b==a.e){return a.d}else{throw vbb(new Wdb('Node '+b+' not part of edge '+a))}} +function iEb(a,b){switch(b.g){case 2:return a.b;case 1:return a.c;case 4:return a.d;case 3:return a.a;default:return false;}} +function GVb(a,b){switch(b.g){case 2:return a.b;case 1:return a.c;case 4:return a.d;case 3:return a.a;default:return false;}} +function Xkd(a,b,c,d){switch(b){case 3:return a.f;case 4:return a.g;case 5:return a.i;case 6:return a.j;}return Ekd(a,b,c,d)} +function Ljc(a){if(a.k!=(j0b(),h0b)){return false}return FAb(new YAb(null,new Lub(new Sr(ur(U_b(a).a.Kc(),new Sq)))),new Mjc)} +function MEd(a){if(a.e==null){return a}else !a.c&&(a.c=new NEd((a.f&256)!=0,a.i,a.a,a.d,(a.f&16)!=0,a.j,a.g,null));return a.c} +function VC(a,b){if(a.h==Gje&&a.m==0&&a.l==0){b&&(QC=TC(0,0,0));return SC((wD(),uD))}b&&(QC=TC(a.l,a.m,a.h));return TC(0,0,0)} +function fcb(a){var b;if(Array.isArray(a)&&a.im===gcb){return hdb(rb(a))+'@'+(b=tb(a)>>>0,b.toString(16))}return a.toString()} +function Rpb(a){var b;this.a=(b=BD(a.e&&a.e(),9),new xqb(b,BD(_Bb(b,b.length),9),0));this.b=KC(SI,Uhe,1,this.a.a.length,5,1)} +function _Ob(a){var b,c,d;this.a=new zsb;for(d=new olb(a);d.a0&&(BCb(b-1,a.length),a.charCodeAt(b-1)==58)&&!OEd(a,CEd,DEd)} +function OEd(a,b,c){var d,e;for(d=0,e=a.length;d=e){return b.c+c}}return b.c+b.b.gc()} +function NCd(a,b){LCd();var c,d,e,f;d=KLd(a);e=b;Klb(d,0,d.length,e);for(c=0;c0){d+=e;++c}}c>1&&(d+=a.d*(c-1));return d} +function Htd(a){var b,c,d;d=new Hfb;d.a+='[';for(b=0,c=a.gc();b0&&this.b>0&&q$c(this.c,this.b,this.a)} +function ezc(a){dzc();this.c=Ou(OC(GC(h0,1),Uhe,831,0,[Uyc]));this.b=new Lqb;this.a=a;Rhb(this.b,bzc,1);Hkb(czc,new Xed(this))} +function I2c(a,b){var c;if(a.d){if(Mhb(a.b,b)){return BD(Ohb(a.b,b),51)}else{c=b.Kf();Rhb(a.b,b,c);return c}}else{return b.Kf()}} +function Kgb(a,b){var c;if(PD(a)===PD(b)){return true}if(JD(b,91)){c=BD(b,91);return a.e==c.e&&a.d==c.d&&Lgb(a,c.a)}return false} +function Zcd(a){Ucd();switch(a.g){case 4:return Acd;case 1:return zcd;case 3:return Rcd;case 2:return Tcd;default:return Scd;}} +function Ykd(a,b){switch(b){case 3:return a.f!=0;case 4:return a.g!=0;case 5:return a.i!=0;case 6:return a.j!=0;}return Hkd(a,b)} +function gWc(a){switch(a.g){case 0:return new FXc;case 1:return new IXc;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function QUc(a){switch(a.g){case 0:return new CXc;case 1:return new MXc;default:throw vbb(new Wdb(Dne+(a.f!=null?a.f:''+a.g)));}} +function b1c(a){switch(a.g){case 0:return new s1c;case 1:return new w1c;default:throw vbb(new Wdb(Mre+(a.f!=null?a.f:''+a.g)));}} +function qWc(a){switch(a.g){case 1:return new SVc;case 2:return new KVc;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function ryb(a){var b,c;if(a.b){return a.b}c=lyb?null:a.d;while(c){b=lyb?null:c.b;if(b){return b}c=lyb?null:c.d}return $xb(),Zxb} +function hhb(a){var b,c,d;if(a.e==0){return 0}b=a.d<<5;c=a.a[a.d-1];if(a.e<0){d=Mgb(a);if(d==a.d-1){--c;c=c|0}}b-=heb(c);return b} +function bhb(a){var b,c,d;if(a>5;b=a&31;d=KC(WD,oje,25,c+1,15,1);d[c]=1<3){e*=10;--f}a=(a+(e>>1))/e|0}d.i=a;return true} +function XUb(a){LUb();return Bcb(),GVb(BD(a.a,81).j,BD(a.b,103))||BD(a.a,81).d.e!=0&&GVb(BD(a.a,81).j,BD(a.b,103))?true:false} +function s3c(a){p3c();if(BD(a.We((Y9c(),b9c)),174).Hc((Idd(),Gdd))){BD(a.We(x9c),174).Fc((rcd(),qcd));BD(a.We(b9c),174).Mc(Gdd)}} +function Gxd(a,b){var c,d;if(!b){return false}else{for(c=0;c=0;--d){b=c[d];for(e=0;e>1;this.k=b-1>>1} +function r3b(a,b){Odd(b,'End label post-processing',1);MAb(JAb(LAb(new YAb(null,new Kub(a.b,16)),new w3b),new y3b),new A3b);Qdd(b)} +function NLc(a,b,c){var d,e;d=Edb(a.p[b.i.p])+Edb(a.d[b.i.p])+b.n.b+b.a.b;e=Edb(a.p[c.i.p])+Edb(a.d[c.i.p])+c.n.b+c.a.b;return e-d} +function xhb(a,b,c){var d,e;d=xbb(c,Yje);for(e=0;ybb(d,0)!=0&&e0&&(BCb(0,b.length),b.charCodeAt(0)==43)?b.substr(1):b))} +function T9d(a){var b;return a==null?null:new Ygb((b=Qge(a,true),b.length>0&&(BCb(0,b.length),b.charCodeAt(0)==43)?b.substr(1):b))} +function xud(a,b){var c;if(a.i>0){if(b.lengtha.i&&NC(b,a.i,null);return b} +function Sxd(a,b,c){var d,e,f;if(a.ej()){d=a.i;f=a.fj();kud(a,d,b);e=a.Zi(3,null,b,d,f);!c?(c=e):c.Ei(e)}else{kud(a,a.i,b)}return c} +function HMd(a,b,c){var d,e;d=new pSd(a.e,4,10,(e=b.c,JD(e,88)?BD(e,26):(jGd(),_Fd)),null,HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function GMd(a,b,c){var d,e;d=new pSd(a.e,3,10,null,(e=b.c,JD(e,88)?BD(e,26):(jGd(),_Fd)),HLd(a,b),false);!c?(c=d):c.Ei(d);return c} +function _Jb(a){$Jb();var b;b=new g7c(BD(a.e.We((Y9c(),_8c)),8));if(a.B.Hc((Idd(),Bdd))){b.a<=0&&(b.a=20);b.b<=0&&(b.b=20)}return b} +function Lzc(a){Izc();var b;(!a.q?(mmb(),mmb(),kmb):a.q)._b((Nyc(),Cxc))?(b=BD(vNb(a,Cxc),197)):(b=BD(vNb(Q_b(a),Dxc),197));return b} +function pBc(a,b){var c,d;d=null;if(wNb(a,(Nyc(),qyc))){c=BD(vNb(a,qyc),94);c.Xe(b)&&(d=c.We(b))}d==null&&(d=vNb(Q_b(a),b));return d} +function Ze(a,b){var c,d,e;if(JD(b,42)){c=BD(b,42);d=c.cd();e=Hv(a.Rc(),d);return Hb(e,c.dd())&&(e!=null||a.Rc()._b(d))}return false} +function qAd(a,b){var c,d,e;if(a.f>0){a.qj();d=b==null?0:tb(b);e=(d&Ohe)%a.d.length;c=xAd(a,e,d,b);return c!=-1}else{return false}} +function AAd(a,b){var c,d,e;if(a.f>0){a.qj();d=b==null?0:tb(b);e=(d&Ohe)%a.d.length;c=wAd(a,e,d,b);if(c){return c.dd()}}return null} +function R2d(a,b){var c,d,e,f;f=S6d(a.e.Tg(),b);c=BD(a.g,119);for(e=0;e1?Mbb(Nbb(b.a[1],32),xbb(b.a[0],Yje)):xbb(b.a[0],Yje),Sbb(Ibb(b.e,c))))} +function Hbb(a,b){var c;if(Fbb(a)&&Fbb(b)){c=a%b;if(Kje>5;b&=31;e=a.d+c+(b==0?0:1);d=KC(WD,oje,25,e,15,1);jhb(d,a.a,c,b);f=new Vgb(a.e,e,d);Jgb(f);return f} +function Ofe(a,b,c){var d,e;d=BD(Phb(Zee,b),117);e=BD(Phb($ee,b),117);if(c){Shb(Zee,a,d);Shb($ee,a,e)}else{Shb($ee,a,d);Shb(Zee,a,e)}} +function Cwb(a,b,c){var d,e,f;e=null;f=a.b;while(f){d=a.a.ue(b,f.d);if(c&&d==0){return f}if(d>=0){f=f.a[1]}else{e=f;f=f.a[0]}}return e} +function Dwb(a,b,c){var d,e,f;e=null;f=a.b;while(f){d=a.a.ue(b,f.d);if(c&&d==0){return f}if(d<=0){f=f.a[0]}else{e=f;f=f.a[1]}}return e} +function Nic(a,b,c,d){var e,f,g;e=false;if(fjc(a.f,c,d)){ijc(a.f,a.a[b][c],a.a[b][d]);f=a.a[b];g=f[d];f[d]=f[c];f[c]=g;e=true}return e} +function QHc(a,b,c,d,e){var f,g,h;g=e;while(b.b!=b.c){f=BD(fkb(b),10);h=BD(V_b(f,d).Xb(0),11);a.d[h.p]=g++;c.c[c.c.length]=h}return g} +function hBc(a,b,c){var d,e,f,g,h;g=a.k;h=b.k;d=c[g.g][h.g];e=ED(pBc(a,d));f=ED(pBc(b,d));return $wnd.Math.max((uCb(e),e),(uCb(f),f))} +function zZc(a,b,c){var d,e,f,g;d=c/a.c.length;e=0;for(g=new olb(a);g.a2000){yz=a;zz=$wnd.setTimeout(Iz,10)}}if(xz++==0){Lz((Kz(),Jz));return true}return false} +function wCc(a,b){var c,d,e;for(d=new Sr(ur(U_b(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);e=c.d.i;if(e.c==b){return false}}return true} +function Ek(b,c){var d,e;if(JD(c,245)){e=BD(c,245);try{d=b.vd(e);return d==0}catch(a){a=ubb(a);if(!JD(a,205))throw vbb(a)}}return false} +function Xz(){if(Error.stackTraceLimit>0){$wnd.Error.stackTraceLimit=Error.stackTraceLimit=64;return true}return 'stack' in new Error} +function BDb(a,b){return Iy(),Iy(),My(Qie),($wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b)))>0} +function DDb(a,b){return Iy(),Iy(),My(Qie),($wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b)))<0} +function CDb(a,b){return Iy(),Iy(),My(Qie),($wnd.Math.abs(a-b)<=Qie||a==b||isNaN(a)&&isNaN(b)?0:ab?1:Ny(isNaN(a),isNaN(b)))<=0} +function ydb(a,b){var c=0;while(!b[c]||b[c]==''){c++}var d=b[c++];for(;cWje){return c.fh()}d=c.Zg();if(!!d||c==a){break}}}return d} +function fvd(a){evd();if(JD(a,156)){return BD(Ohb(cvd,hK),288).vg(a)}if(Mhb(cvd,rb(a))){return BD(Ohb(cvd,rb(a)),288).vg(a)}return null} +function fZd(a){if(efb(kse,a)){return Bcb(),Acb}else if(efb(lse,a)){return Bcb(),zcb}else{throw vbb(new Wdb('Expecting true or false'))}} +function uDc(a,b){if(b.c==a){return b.d}else if(b.d==a){return b.c}throw vbb(new Wdb('Input edge is not connected to the input port.'))} +function Igb(a,b){if(a.e>b.e){return 1}if(a.eb.d){return a.e}if(a.d=48&&a<48+$wnd.Math.min(10,10)){return a-48}if(a>=97&&a<97){return a-97+10}if(a>=65&&a<65){return a-65+10}return -1} +function Ue(a,b){var c;if(PD(b)===PD(a)){return true}if(!JD(b,21)){return false}c=BD(b,21);if(c.gc()!=a.gc()){return false}return a.Ic(c)} +function ekb(a,b){var c,d,e,f;d=a.a.length-1;c=b-a.b&d;f=a.c-b&d;e=a.c-a.b&d;mkb(c=f){hkb(a,b);return -1}else{ikb(a,b);return 1}} +function lA(a,b){var c,d;c=(BCb(b,a.length),a.charCodeAt(b));d=b+1;while(db.e){return 1}else if(a.fb.f){return 1}return tb(a)-tb(b)} +function efb(a,b){uCb(a);if(b==null){return false}if(dfb(a,b)){return true}return a.length==b.length&&dfb(a.toLowerCase(),b.toLowerCase())} +function x6d(a,b){var c,d,e,f;for(d=0,e=b.gc();d0&&ybb(a,128)<0){b=Tbb(a)+128;c=(Ceb(),Beb)[b];!c&&(c=Beb[b]=new teb(a));return c}return new teb(a)} +function _0d(a,b){var c,d;c=b.Hh(a.a);if(c){d=GD(AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),fue));if(d!=null){return d}}return b.ne()} +function a1d(a,b){var c,d;c=b.Hh(a.a);if(c){d=GD(AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),fue));if(d!=null){return d}}return b.ne()} +function FMc(a,b){wMc();var c,d;for(d=new Sr(ur(O_b(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);if(c.d.i==b||c.c.i==b){return c}}return null} +function HUb(a,b,c){this.c=a;this.f=new Rkb;this.e=new d7c;this.j=new IVb;this.n=new IVb;this.b=b;this.g=new J6c(b.c,b.d,b.b,b.a);this.a=c} +function gVb(a){var b,c,d,e;this.a=new zsb;this.d=new Tqb;this.e=0;for(c=a,d=0,e=c.length;d0}else{return false}} +function q2c(a){var b;if(PD(hkd(a,(Y9c(),J8c)))===PD((hbd(),fbd))){if(!Xod(a)){jkd(a,J8c,gbd)}else{b=BD(hkd(Xod(a),J8c),334);jkd(a,J8c,b)}}} +function ijc(a,b,c){var d,e;bIc(a.e,b,c,(Ucd(),Tcd));bIc(a.i,b,c,zcd);if(a.a){e=BD(vNb(b,(wtc(),$sc)),11);d=BD(vNb(c,$sc),11);cIc(a.g,e,d)}} +function OEc(a,b,c){var d,e,f;d=b.c.p;f=b.p;a.b[d][f]=new $Ec(a,b);if(c){a.a[d][f]=new FEc(b);e=BD(vNb(b,(wtc(),Psc)),10);!!e&&Rc(a.d,e,b)}} +function TPb(a,b){var c,d,e;Ekb(PPb,a);b.Fc(a);c=BD(Ohb(OPb,a),21);if(c){for(e=c.Kc();e.Ob();){d=BD(e.Pb(),33);Jkb(PPb,d,0)!=-1||TPb(d,b)}}} +function tyb(a,b,c){var d;(jyb?(ryb(a),true):kyb?($xb(),true):nyb?($xb(),true):myb&&($xb(),false))&&(d=new iyb(b),d.b=c,pyb(a,d),undefined)} +function xKb(a,b){var c;c=!a.A.Hc((tdd(),sdd))||a.q==(dcd(),$bd);a.u.Hc((rcd(),ncd))?c?vKb(a,b):zKb(a,b):a.u.Hc(pcd)&&(c?wKb(a,b):AKb(a,b))} +function b0d(a,b){var c,d;++a.j;if(b!=null){c=(d=a.a.Cb,JD(d,97)?BD(d,97).Jg():null);if(xlb(b,c)){Cjd(a.a,4,c);return}}Cjd(a.a,4,BD(b,126))} +function dYb(a,b,c){return new J6c($wnd.Math.min(a.a,b.a)-c/2,$wnd.Math.min(a.b,b.b)-c/2,$wnd.Math.abs(a.a-b.a)+c,$wnd.Math.abs(a.b-b.b)+c)} +function k4b(a,b){var c,d;c=beb(a.a.c.p,b.a.c.p);if(c!=0){return c}d=beb(a.a.d.i.p,b.a.d.i.p);if(d!=0){return d}return beb(b.a.d.p,a.a.d.p)} +function _Dc(a,b,c){var d,e,f,g;f=b.j;g=c.j;if(f!=g){return f.g-g.g}else{d=a.f[b.p];e=a.f[c.p];return d==0&&e==0?0:d==0?-1:e==0?1:Kdb(d,e)}} +function HFb(a,b,c){var d,e,f;if(c[b.d]){return}c[b.d]=true;for(e=new olb(LFb(b));e.a=e)return e;for(b=b>0?b:0;bd&&NC(b,d,null);return b} +function _lb(a,b){var c,d;d=a.a.length;b.lengthd&&NC(b,d,null);return b} +function Xrb(a,b,c){var d,e,f;e=BD(Ohb(a.e,b),387);if(!e){d=new lsb(a,b,c);Rhb(a.e,b,d);isb(d);return null}else{f=ijb(e,c);Yrb(a,e);return f}} +function P9d(a){var b;if(a==null)return null;b=ide(Qge(a,true));if(b==null){throw vbb(new n8d("Invalid hexBinary value: '"+a+"'"))}return b} +function ghb(a){Hgb();if(ybb(a,0)<0){if(ybb(a,-1)!=0){return new Wgb(-1,Jbb(a))}return Bgb}else return ybb(a,10)<=0?Dgb[Tbb(a)]:new Wgb(1,a)} +function wJb(){qJb();return OC(GC(DN,1),Kie,159,0,[nJb,mJb,oJb,eJb,dJb,fJb,iJb,hJb,gJb,lJb,kJb,jJb,bJb,aJb,cJb,$Ib,ZIb,_Ib,XIb,WIb,YIb,pJb])} +function vjc(a){var b;this.d=new Rkb;this.j=new d7c;this.g=new d7c;b=a.g.b;this.f=BD(vNb(Q_b(b),(Nyc(),Lwc)),103);this.e=Edb(ED(c_b(b,ryc)))} +function Pjc(a){this.b=new Rkb;this.e=new Rkb;this.d=a;this.a=!WAb(JAb(new YAb(null,new Lub(new b1b(a.b))),new Xxb(new Qjc))).sd((EAb(),DAb))} +function N5c(){N5c=ccb;L5c=new O5c('PARENTS',0);K5c=new O5c('NODES',1);I5c=new O5c('EDGES',2);M5c=new O5c('PORTS',3);J5c=new O5c('LABELS',4)} +function Tbd(){Tbd=ccb;Qbd=new Ubd('DISTRIBUTED',0);Sbd=new Ubd('JUSTIFIED',1);Obd=new Ubd('BEGIN',2);Pbd=new Ubd(gle,3);Rbd=new Ubd('END',4)} +function UMd(a){var b;b=a.yi(null);switch(b){case 10:return 0;case 15:return 1;case 14:return 2;case 11:return 3;case 21:return 4;}return -1} +function cYb(a){switch(a.g){case 1:return ead(),dad;case 4:return ead(),aad;case 2:return ead(),bad;case 3:return ead(),_9c;}return ead(),cad} +function kA(a,b,c){var d;d=c.q.getFullYear()-nje+nje;d<0&&(d=-d);switch(b){case 1:a.a+=d;break;case 2:EA(a,d%100,2);break;default:EA(a,d,b);}} +function Jsb(a,b){var c,d;wCb(b,a.b);if(b>=a.b>>1){d=a.c;for(c=a.b;c>b;--c){d=d.b}}else{d=a.a.a;for(c=0;c=64&&b<128&&(e=Mbb(e,Nbb(1,b-64)))}return e} +function c_b(a,b){var c,d;d=null;if(wNb(a,(Y9c(),O9c))){c=BD(vNb(a,O9c),94);c.Xe(b)&&(d=c.We(b))}d==null&&!!Q_b(a)&&(d=vNb(Q_b(a),b));return d} +function oQc(a,b){var c,d,e;e=b.d.i;d=e.k;if(d==(j0b(),h0b)||d==d0b){return}c=new Sr(ur(U_b(e).a.Kc(),new Sq));Qr(c)&&Rhb(a.k,b,BD(Rr(c),17))} +function mid(a,b){var c,d,e;d=XKd(a.Tg(),b);c=b-a.Ah();return c<0?(e=a.Yg(d),e>=0?a.lh(e):tid(a,d)):c<0?tid(a,d):BD(d,66).Nj().Sj(a,a.yh(),c)} +function Ksd(a){var b;if(JD(a.a,4)){b=fvd(a.a);if(b==null){throw vbb(new Zdb(mse+a.b+"'. "+ise+(fdb(Y3),Y3.k)+jse))}return b}else{return a.a}} +function L9d(a){var b;if(a==null)return null;b=bde(Qge(a,true));if(b==null){throw vbb(new n8d("Invalid base64Binary value: '"+a+"'"))}return b} +function Dyd(b){var c;try{c=b.i.Xb(b.e);b.mj();b.g=b.e++;return c}catch(a){a=ubb(a);if(JD(a,73)){b.mj();throw vbb(new utb)}else throw vbb(a)}} +function Zyd(b){var c;try{c=b.c.ki(b.e);b.mj();b.g=b.e++;return c}catch(a){a=ubb(a);if(JD(a,73)){b.mj();throw vbb(new utb)}else throw vbb(a)}} +function CPb(){CPb=ccb;BPb=(Y9c(),K9c);vPb=G8c;qPb=r8c;wPb=f9c;zPb=(fFb(),bFb);yPb=_Eb;APb=dFb;xPb=$Eb;sPb=(nPb(),jPb);rPb=iPb;tPb=lPb;uPb=mPb} +function NWb(a){LWb();this.c=new Rkb;this.d=a;switch(a.g){case 0:case 2:this.a=tmb(KWb);this.b=Pje;break;case 3:case 1:this.a=KWb;this.b=Qje;}} +function ued(a,b,c){var d,e;if(a.c){dld(a.c,a.c.i+b);eld(a.c,a.c.j+c)}else{for(e=new olb(a.b);e.a0){Ekb(a.b,new WA(b.a,c));d=b.a.length;0d&&(b.a+=yfb(KC(TD,$ie,25,-d,15,1)))}} +function JKb(a,b){var c,d,e;c=a.o;for(e=BD(BD(Qc(a.r,b),21),84).Kc();e.Ob();){d=BD(e.Pb(),111);d.e.a=DKb(d,c.a);d.e.b=c.b*Edb(ED(d.b.We(BKb)))}} +function S5b(a,b){var c,d,e,f;e=a.k;c=Edb(ED(vNb(a,(wtc(),htc))));f=b.k;d=Edb(ED(vNb(b,htc)));return f!=(j0b(),e0b)?-1:e!=e0b?1:c==d?0:c=0){return a.hh(b,c,d)}else{!!a.eh()&&(d=(e=a.Vg(),e>=0?a.Qg(d):a.eh().ih(a,-1-e,null,d)));return a.Sg(b,c,d)}} +function zld(a,b){switch(b){case 7:!a.e&&(a.e=new y5d(B2,a,7,4));Uxd(a.e);return;case 8:!a.d&&(a.d=new y5d(B2,a,8,5));Uxd(a.d);return;}$kd(a,b)} +function Ut(b,c){var d;d=b.Zc(c);try{return d.Pb()}catch(a){a=ubb(a);if(JD(a,109)){throw vbb(new qcb("Can't get element "+c))}else throw vbb(a)}} +function Tgb(a,b){this.e=a;if(b=0&&(c.d=a.t);break;case 3:a.t>=0&&(c.a=a.t);}if(a.C){c.b=a.C.b;c.c=a.C.c}} +function RMb(){RMb=ccb;OMb=new SMb(xle,0);NMb=new SMb(yle,1);PMb=new SMb(zle,2);QMb=new SMb(Ale,3);OMb.a=false;NMb.a=true;PMb.a=false;QMb.a=true} +function ROb(){ROb=ccb;OOb=new SOb(xle,0);NOb=new SOb(yle,1);POb=new SOb(zle,2);QOb=new SOb(Ale,3);OOb.a=false;NOb.a=true;POb.a=false;QOb.a=true} +function dac(a){var b;b=a.a;do{b=BD(Rr(new Sr(ur(R_b(b).a.Kc(),new Sq))),17).c.i;b.k==(j0b(),g0b)&&a.b.Fc(b)}while(b.k==(j0b(),g0b));a.b=Su(a.b)} +function CDc(a){var b,c,d;d=a.c.a;a.p=(Qb(d),new Tkb(d));for(c=new olb(d);c.ac.b){return true}}}return false} +function AD(a,b){if(ND(a)){return !!zD[b]}else if(a.hm){return !!a.hm[b]}else if(LD(a)){return !!yD[b]}else if(KD(a)){return !!xD[b]}return false} +function jkd(a,b,c){c==null?(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),LAd(a.o,b)):(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),HAd(a.o,b,c));return a} +function jKb(a,b,c,d){var e,f;f=b.Xe((Y9c(),W8c))?BD(b.We(W8c),21):a.j;e=uJb(f);if(e==(qJb(),pJb)){return}if(c&&!sJb(e)){return}UHb(lKb(a,e,d),b)} +function fid(a,b,c,d){var e,f,g;f=XKd(a.Tg(),b);e=b-a.Ah();return e<0?(g=a.Yg(f),g>=0?a._g(g,c,true):sid(a,f,c)):BD(f,66).Nj().Pj(a,a.yh(),e,c,d)} +function u6d(a,b,c,d){var e,f,g;if(c.mh(b)){Q6d();if(YId(b)){e=BD(c.ah(b),153);x6d(a,e)}else{f=(g=b,!g?null:BD(d,49).xh(g));!!f&&v6d(c.ah(b),f)}}} +function H3b(a){switch(a.g){case 1:return vLb(),uLb;case 3:return vLb(),rLb;case 2:return vLb(),tLb;case 4:return vLb(),sLb;default:return null;}} +function kCb(a){switch(typeof(a)){case Mhe:return LCb(a);case Lhe:return QD(a);case Khe:return Bcb(),a?1231:1237;default:return a==null?0:FCb(a);}} +function Gic(a,b,c){if(a.e){switch(a.b){case 1:oic(a.c,b,c);break;case 0:pic(a.c,b,c);}}else{mic(a.c,b,c)}a.a[b.p][c.p]=a.c.i;a.a[c.p][b.p]=a.c.e} +function lHc(a){var b,c;if(a==null){return null}c=KC(OQ,nie,193,a.length,0,2);for(b=0;b=0)return e;if(a.Fk()){for(d=0;d=e)throw vbb(new Cyd(b,e));if(a.hi()){d=a.Xc(c);if(d>=0&&d!=b){throw vbb(new Wdb(kue))}}return a.mi(b,c)} +function gx(a,b){this.a=BD(Qb(a),245);this.b=BD(Qb(b),245);if(a.vd(b)>0||a==(Lk(),Kk)||b==(_k(),$k)){throw vbb(new Wdb('Invalid range: '+nx(a,b)))}} +function mYb(a){var b,c;this.b=new Rkb;this.c=a;this.a=false;for(c=new olb(a.a);c.a0);if((b&-b)==b){return QD(b*Cub(a,31)*4.6566128730773926E-10)}do{c=Cub(a,31);d=c%b}while(c-d+(b-1)<0);return QD(d)} +function LCb(a){JCb();var b,c,d;c=':'+a;d=ICb[c];if(d!=null){return QD((uCb(d),d))}d=GCb[c];b=d==null?KCb(a):QD((uCb(d),d));MCb();ICb[c]=b;return b} +function qZb(a,b,c){Odd(c,'Compound graph preprocessor',1);a.a=new Hp;vZb(a,b,null);pZb(a,b);uZb(a);yNb(b,(wtc(),zsc),a.a);a.a=null;Uhb(a.b);Qdd(c)} +function X$b(a,b,c){switch(c.g){case 1:a.a=b.a/2;a.b=0;break;case 2:a.a=b.a;a.b=b.b/2;break;case 3:a.a=b.a/2;a.b=b.b;break;case 4:a.a=0;a.b=b.b/2;}} +function tkc(a){var b,c,d;for(d=BD(Qc(a.a,(Xjc(),Vjc)),15).Kc();d.Ob();){c=BD(d.Pb(),101);b=Bkc(c);kkc(a,c,b[0],(Fkc(),Ckc),0);kkc(a,c,b[1],Ekc,1)}} +function ukc(a){var b,c,d;for(d=BD(Qc(a.a,(Xjc(),Wjc)),15).Kc();d.Ob();){c=BD(d.Pb(),101);b=Bkc(c);kkc(a,c,b[0],(Fkc(),Ckc),0);kkc(a,c,b[1],Ekc,1)}} +function tXc(a){switch(a.g){case 0:return null;case 1:return new $Xc;case 2:return new QXc;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function OZc(a,b,c){var d,e;FZc(a,b-a.s,c-a.t);for(e=new olb(a.n);e.a1&&(f=GFb(a,b));return f} +function dmd(a){var b;if(!!a.f&&a.f.kh()){b=BD(a.f,49);a.f=BD(xid(a,b),82);a.f!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,8,b,a.f))}return a.f} +function emd(a){var b;if(!!a.i&&a.i.kh()){b=BD(a.i,49);a.i=BD(xid(a,b),82);a.i!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,7,b,a.i))}return a.i} +function zUd(a){var b;if(!!a.b&&(a.b.Db&64)!=0){b=a.b;a.b=BD(xid(a,b),18);a.b!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,21,b,a.b))}return a.b} +function uAd(a,b){var c,d,e;if(a.d==null){++a.e;++a.f}else{d=b.Sh();BAd(a,a.f+1);e=(d&Ohe)%a.d.length;c=a.d[e];!c&&(c=a.d[e]=a.uj());c.Fc(b);++a.f}} +function m3d(a,b,c){var d;if(b.Kj()){return false}else if(b.Zj()!=-2){d=b.zj();return d==null?c==null:pb(d,c)}else return b.Hj()==a.e.Tg()&&c==null} +function wo(){var a;Xj(16,Hie);a=Kp(16);this.b=KC(GF,Gie,317,a,0,1);this.c=KC(GF,Gie,317,a,0,1);this.a=null;this.e=null;this.i=0;this.f=a-1;this.g=0} +function b0b(a){n_b.call(this);this.k=(j0b(),h0b);this.j=(Xj(6,Jie),new Skb(6));this.b=(Xj(2,Jie),new Skb(2));this.d=new L_b;this.f=new s0b;this.a=a} +function Scc(a){var b,c;if(a.c.length<=1){return}b=Pcc(a,(Ucd(),Rcd));Rcc(a,BD(b.a,19).a,BD(b.b,19).a);c=Pcc(a,Tcd);Rcc(a,BD(c.a,19).a,BD(c.b,19).a)} +function Vzc(){Vzc=ccb;Uzc=new Xzc('SIMPLE',0);Rzc=new Xzc(Tne,1);Szc=new Xzc('LINEAR_SEGMENTS',2);Qzc=new Xzc('BRANDES_KOEPF',3);Tzc=new Xzc(Aqe,4)} +function XDc(a,b,c){if(!ecd(BD(vNb(b,(Nyc(),Vxc)),98))){WDc(a,b,Y_b(b,c));WDc(a,b,Y_b(b,(Ucd(),Rcd)));WDc(a,b,Y_b(b,Acd));mmb();Okb(b.j,new jEc(a))}} +function HVc(a,b,c,d){var e,f,g;e=d?BD(Qc(a.a,b),21):BD(Qc(a.b,b),21);for(g=e.Kc();g.Ob();){f=BD(g.Pb(),33);if(BVc(a,c,f)){return true}}return false} +function FMd(a){var b,c;for(c=new Fyd(a);c.e!=c.i.gc();){b=BD(Dyd(c),87);if(!!b.e||(!b.d&&(b.d=new xMd(j5,b,1)),b.d).i!=0){return true}}return false} +function QTd(a){var b,c;for(c=new Fyd(a);c.e!=c.i.gc();){b=BD(Dyd(c),87);if(!!b.e||(!b.d&&(b.d=new xMd(j5,b,1)),b.d).i!=0){return true}}return false} +function FDc(a){var b,c,d;b=0;for(d=new olb(a.c.a);d.a102)return -1;if(a<=57)return a-48;if(a<65)return -1;if(a<=70)return a-65+10;if(a<97)return -1;return a-97+10} +function Wj(a,b){if(a==null){throw vbb(new Heb('null key in entry: null='+b))}else if(b==null){throw vbb(new Heb('null value in entry: '+a+'=null'))}} +function kr(a,b){var c,d;while(a.Ob()){if(!b.Ob()){return false}c=a.Pb();d=b.Pb();if(!(PD(c)===PD(d)||c!=null&&pb(c,d))){return false}}return !b.Ob()} +function jIb(a,b){var c;c=OC(GC(UD,1),Vje,25,15,[pHb(a.a[0],b),pHb(a.a[1],b),pHb(a.a[2],b)]);if(a.d){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0]}return c} +function kIb(a,b){var c;c=OC(GC(UD,1),Vje,25,15,[qHb(a.a[0],b),qHb(a.a[1],b),qHb(a.a[2],b)]);if(a.d){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0]}return c} +function mqc(){mqc=ccb;iqc=new oqc('GREEDY',0);hqc=new oqc(Une,1);kqc=new oqc(Tne,2);lqc=new oqc('MODEL_ORDER',3);jqc=new oqc('GREEDY_MODEL_ORDER',4)} +function iUc(a,b){var c,d,e;a.b[b.g]=1;for(d=Jsb(b.d,0);d.b!=d.d.c;){c=BD(Xsb(d),188);e=c.c;a.b[e.g]==1?Dsb(a.a,c):a.b[e.g]==2?(a.b[e.g]=1):iUc(a,e)}} +function V9b(a,b){var c,d,e;e=new Skb(b.gc());for(d=b.Kc();d.Ob();){c=BD(d.Pb(),286);c.c==c.f?K9b(a,c,c.c):L9b(a,c)||(e.c[e.c.length]=c,true)}return e} +function IZc(a,b,c){var d,e,f,g,h;h=a.r+b;a.r+=b;a.d+=c;d=c/a.n.c.length;e=0;for(g=new olb(a.n);g.af&&NC(b,f,null);return b} +function Lu(a,b){var c,d;d=a.gc();if(b==null){for(c=0;c0&&(i+=e);j[k]=g;g+=h*(i+d)}} +function Uoc(a){var b,c,d;d=a.f;a.n=KC(UD,Vje,25,d,15,1);a.d=KC(UD,Vje,25,d,15,1);for(b=0;b0?a.c:0);++e}a.b=d;a.d=f} +function BZc(a,b){var c,d,e,f,g;d=0;e=0;c=0;for(g=new olb(b);g.a0?a.g:0);++c}a.c=e;a.d=d} +function AHb(a,b){var c;c=OC(GC(UD,1),Vje,25,15,[zHb(a,(gHb(),dHb),b),zHb(a,eHb,b),zHb(a,fHb,b)]);if(a.f){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0]}return c} +function lNb(b,c,d){var e;try{aNb(b,c+b.j,d+b.k,false,true)}catch(a){a=ubb(a);if(JD(a,73)){e=a;throw vbb(new qcb(e.g+Gle+c+She+d+').'))}else throw vbb(a)}} +function mNb(b,c,d){var e;try{aNb(b,c+b.j,d+b.k,true,false)}catch(a){a=ubb(a);if(JD(a,73)){e=a;throw vbb(new qcb(e.g+Gle+c+She+d+').'))}else throw vbb(a)}} +function d5b(a){var b;if(!wNb(a,(Nyc(),xxc))){return}b=BD(vNb(a,xxc),21);if(b.Hc((Hbd(),zbd))){b.Mc(zbd);b.Fc(Bbd)}else if(b.Hc(Bbd)){b.Mc(Bbd);b.Fc(zbd)}} +function e5b(a){var b;if(!wNb(a,(Nyc(),xxc))){return}b=BD(vNb(a,xxc),21);if(b.Hc((Hbd(),Gbd))){b.Mc(Gbd);b.Fc(Ebd)}else if(b.Hc(Ebd)){b.Mc(Ebd);b.Fc(Gbd)}} +function udc(a,b,c){Odd(c,'Self-Loop ordering',1);MAb(NAb(JAb(JAb(LAb(new YAb(null,new Kub(b.b,16)),new ydc),new Adc),new Cdc),new Edc),new Gdc(a));Qdd(c)} +function ikc(a,b,c,d){var e,f;for(e=b;e0&&(e.b+=b);return e} +function GXb(a,b){var c,d,e;e=new d7c;for(d=a.Kc();d.Ob();){c=BD(d.Pb(),37);uXb(c,0,e.b);e.b+=c.f.b+b;e.a=$wnd.Math.max(e.a,c.f.a)}e.a>0&&(e.a+=b);return e} +function d_b(a){var b,c,d;d=Ohe;for(c=new olb(a.a);c.a>16==6){return a.Cb.ih(a,5,o5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?a.zh():c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Wz(a){Rz();var b=a.e;if(b&&b.stack){var c=b.stack;var d=b+'\n';c.substring(0,d.length)==d&&(c=c.substring(d.length));return c.split('\n')}return []} +function jeb(a){var b;b=(qeb(),peb);return b[a>>>28]|b[a>>24&15]<<4|b[a>>20&15]<<8|b[a>>16&15]<<12|b[a>>12&15]<<16|b[a>>8&15]<<20|b[a>>4&15]<<24|b[a&15]<<28} +function _jb(a){var b,c,d;if(a.b!=a.c){return}d=a.a.length;c=geb($wnd.Math.max(8,d))<<1;if(a.b!=0){b=_Bb(a.a,c);$jb(a,b,d);a.a=b;a.b=0}else{dCb(a.a,c)}a.c=d} +function DKb(a,b){var c;c=a.b;return c.Xe((Y9c(),s9c))?c.Hf()==(Ucd(),Tcd)?-c.rf().a-Edb(ED(c.We(s9c))):b+Edb(ED(c.We(s9c))):c.Hf()==(Ucd(),Tcd)?-c.rf().a:b} +function P_b(a){var b;if(a.b.c.length!=0&&!!BD(Ikb(a.b,0),70).a){return BD(Ikb(a.b,0),70).a}b=JZb(a);if(b!=null){return b}return ''+(!a.c?-1:Jkb(a.c.a,a,0))} +function C0b(a){var b;if(a.f.c.length!=0&&!!BD(Ikb(a.f,0),70).a){return BD(Ikb(a.f,0),70).a}b=JZb(a);if(b!=null){return b}return ''+(!a.i?-1:Jkb(a.i.j,a,0))} +function Ogc(a,b){var c,d;if(b<0||b>=a.gc()){return null}for(c=b;c0?a.c:0);e=$wnd.Math.max(e,b.d);++d}a.e=f;a.b=e} +function shd(a){var b,c;if(!a.b){a.b=Qu(BD(a.f,118).Ag().i);for(c=new Fyd(BD(a.f,118).Ag());c.e!=c.i.gc();){b=BD(Dyd(c),137);Ekb(a.b,new dhd(b))}}return a.b} +function Ctd(a,b){var c,d,e;if(b.dc()){return LCd(),LCd(),KCd}else{c=new zyd(a,b.gc());for(e=new Fyd(a);e.e!=e.i.gc();){d=Dyd(e);b.Hc(d)&&wtd(c,d)}return c}} +function bkd(a,b,c,d){if(b==0){return d?(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),a.o):(!a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),FAd(a.o))}return fid(a,b,c,d)} +function Tnd(a){var b,c;if(a.rb){for(b=0,c=a.rb.i;b>22);e+=d>>22;if(e<0){return false}a.l=c&Eje;a.m=d&Eje;a.h=e&Fje;return true} +function Fwb(a,b,c,d,e,f,g){var h,i;if(b.Ae()&&(i=a.a.ue(c,d),i<0||!e&&i==0)){return false}if(b.Be()&&(h=a.a.ue(c,f),h>0||!g&&h==0)){return false}return true} +function Vcc(a,b){Occ();var c;c=a.j.g-b.j.g;if(c!=0){return 0}switch(a.j.g){case 2:return Ycc(b,Ncc)-Ycc(a,Ncc);case 4:return Ycc(a,Mcc)-Ycc(b,Mcc);}return 0} +function Tqc(a){switch(a.g){case 0:return Mqc;case 1:return Nqc;case 2:return Oqc;case 3:return Pqc;case 4:return Qqc;case 5:return Rqc;default:return null;}} +function End(a,b,c){var d,e;d=(e=new rUd,yId(e,b),pnd(e,c),wtd((!a.c&&(a.c=new cUd(p5,a,12,10)),a.c),e),e);AId(d,0);DId(d,1);CId(d,true);BId(d,true);return d} +function tud(a,b){var c,d;if(b>=a.i)throw vbb(new $zd(b,a.i));++a.j;c=a.g[b];d=a.i-b-1;d>0&&$fb(a.g,b+1,a.g,b,d);NC(a.g,--a.i,null);a.fi(b,c);a.ci();return c} +function UId(a,b){var c,d;if(a.Db>>16==17){return a.Cb.ih(a,21,c5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?a.zh():c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function iDb(a){var b,c,d,e;mmb();Okb(a.c,a.a);for(e=new olb(a.c);e.ac.a.c.length)){throw vbb(new Wdb('index must be >= 0 and <= layer node count'))}!!a.c&&Lkb(a.c.a,a);a.c=c;!!c&&Dkb(c.a,b,a)} +function p7b(a,b){var c,d,e;for(d=new Sr(ur(O_b(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);e=BD(b.Kb(c),10);return new cc(Qb(e.n.b+e.o.b/2))}return wb(),wb(),vb} +function rMc(a,b){this.c=new Lqb;this.a=a;this.b=b;this.d=BD(vNb(a,(wtc(),otc)),304);PD(vNb(a,(Nyc(),yxc)))===PD((_qc(),Zqc))?(this.e=new bNc):(this.e=new WMc)} +function $dd(a,b){var c,d,e,f;f=0;for(d=new olb(a);d.a>16==6){return a.Cb.ih(a,6,B2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Lhd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Eod(a,b){var c,d;if(a.Db>>16==7){return a.Cb.ih(a,1,C2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Nhd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function lpd(a,b){var c,d;if(a.Db>>16==9){return a.Cb.ih(a,9,E2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Phd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function mQd(a,b){var c,d;if(a.Db>>16==5){return a.Cb.ih(a,9,h5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),VFd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function KHd(a,b){var c,d;if(a.Db>>16==3){return a.Cb.ih(a,0,k5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),OFd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Snd(a,b){var c,d;if(a.Db>>16==7){return a.Cb.ih(a,6,o5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),cGd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function ird(){this.a=new bqd;this.g=new wo;this.j=new wo;this.b=new Lqb;this.d=new wo;this.i=new wo;this.k=new Lqb;this.c=new Lqb;this.e=new Lqb;this.f=new Lqb} +function MCd(a,b,c){var d,e,f;c<0&&(c=0);f=a.i;for(e=c;eWje){return p6d(a,d)}if(d==a){return true}}}return false} +function HKb(a){CKb();switch(a.q.g){case 5:EKb(a,(Ucd(),Acd));EKb(a,Rcd);break;case 4:FKb(a,(Ucd(),Acd));FKb(a,Rcd);break;default:GKb(a,(Ucd(),Acd));GKb(a,Rcd);}} +function LKb(a){CKb();switch(a.q.g){case 5:IKb(a,(Ucd(),zcd));IKb(a,Tcd);break;case 4:JKb(a,(Ucd(),zcd));JKb(a,Tcd);break;default:KKb(a,(Ucd(),zcd));KKb(a,Tcd);}} +function XQb(a){var b,c;b=BD(vNb(a,(wSb(),pSb)),19);if(b){c=b.a;c==0?yNb(a,(HSb(),GSb),new Gub):yNb(a,(HSb(),GSb),new Hub(c))}else{yNb(a,(HSb(),GSb),new Hub(1))}} +function V$b(a,b){var c;c=a.i;switch(b.g){case 1:return -(a.n.b+a.o.b);case 2:return a.n.a-c.o.a;case 3:return a.n.b-c.o.b;case 4:return -(a.n.a+a.o.a);}return 0} +function hbc(a,b){switch(a.g){case 0:return b==(Ctc(),ytc)?dbc:ebc;case 1:return b==(Ctc(),ytc)?dbc:cbc;case 2:return b==(Ctc(),ytc)?cbc:ebc;default:return cbc;}} +function v$c(a,b){var c,d,e;Lkb(a.a,b);a.e-=b.r+(a.a.c.length==0?0:a.c);e=ere;for(d=new olb(a.a);d.a>16==3){return a.Cb.ih(a,12,E2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Khd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function Uod(a,b){var c,d;if(a.Db>>16==11){return a.Cb.ih(a,10,E2,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(Thd(),Ohd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function PSd(a,b){var c,d;if(a.Db>>16==10){return a.Cb.ih(a,11,c5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),aGd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function qUd(a,b){var c,d;if(a.Db>>16==10){return a.Cb.ih(a,12,n5,b)}return d=zUd(BD(XKd((c=BD(Ajd(a,16),26),!c?(jGd(),dGd):c),a.Db>>16),18)),a.Cb.ih(a,d.n,d.f,b)} +function wId(a){var b;if((a.Bb&1)==0&&!!a.r&&a.r.kh()){b=BD(a.r,49);a.r=BD(xid(a,b),138);a.r!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,9,8,b,a.r))}return a.r} +function yHb(a,b,c){var d;d=OC(GC(UD,1),Vje,25,15,[BHb(a,(gHb(),dHb),b,c),BHb(a,eHb,b,c),BHb(a,fHb,b,c)]);if(a.f){d[0]=$wnd.Math.max(d[0],d[2]);d[2]=d[0]}return d} +function O9b(a,b){var c,d,e;e=V9b(a,b);if(e.c.length==0){return}Okb(e,new pac);c=e.c.length;for(d=0;d>19;j=b.h>>19;if(i!=j){return j-i}e=a.h;h=b.h;if(e!=h){return e-h}d=a.m;g=b.m;if(d!=g){return d-g}c=a.l;f=b.l;return c-f} +function fFb(){fFb=ccb;eFb=(rFb(),oFb);dFb=new Nsd(Yke,eFb);cFb=(UEb(),TEb);bFb=new Nsd(Zke,cFb);aFb=(MEb(),LEb);_Eb=new Nsd($ke,aFb);$Eb=new Nsd(_ke,(Bcb(),true))} +function cfc(a,b,c){var d,e;d=b*c;if(JD(a.g,145)){e=ugc(a);if(e.f.d){e.f.a||(a.d.a+=d+ple)}else{a.d.d-=d+ple;a.d.a+=d+ple}}else if(JD(a.g,10)){a.d.d-=d;a.d.a+=2*d}} +function vmc(a,b,c){var d,e,f,g,h;e=a[c.g];for(h=new olb(b.d);h.a0?a.g:0);++c}b.b=d;b.e=e} +function to(a){var b,c,d;d=a.b;if(Lp(a.i,d.length)){c=d.length*2;a.b=KC(GF,Gie,317,c,0,1);a.c=KC(GF,Gie,317,c,0,1);a.f=c-1;a.i=0;for(b=a.a;b;b=b.c){po(a,b,b)}++a.g}} +function cNb(a,b,c,d){var e,f,g,h;for(e=0;eg&&(h=g/d);e>f&&(i=f/e);Y6c(a,$wnd.Math.min(h,i));return a} +function ond(){Smd();var b,c;try{c=BD(mUd((yFd(),xFd),yte),2014);if(c){return c}}catch(a){a=ubb(a);if(JD(a,102)){b=a;uvd((h0d(),b))}else throw vbb(a)}return new knd} +function Y9d(){A9d();var b,c;try{c=BD(mUd((yFd(),xFd),Ewe),2024);if(c){return c}}catch(a){a=ubb(a);if(JD(a,102)){b=a;uvd((h0d(),b))}else throw vbb(a)}return new U9d} +function qZd(){Smd();var b,c;try{c=BD(mUd((yFd(),xFd),_ve),1941);if(c){return c}}catch(a){a=ubb(a);if(JD(a,102)){b=a;uvd((h0d(),b))}else throw vbb(a)}return new mZd} +function HQd(a,b,c){var d,e;e=a.e;a.e=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new nSd(a,1,4,e,b);!c?(c=d):c.Ei(d)}e!=b&&(b?(c=QQd(a,MQd(a,b),c)):(c=QQd(a,a.a,c)));return c} +function nB(){eB.call(this);this.e=-1;this.a=false;this.p=Rie;this.k=-1;this.c=-1;this.b=-1;this.g=false;this.f=-1;this.j=-1;this.n=-1;this.i=-1;this.d=-1;this.o=Rie} +function qEb(a,b){var c,d,e;d=a.b.d.d;a.a||(d+=a.b.d.a);e=b.b.d.d;b.a||(e+=b.b.d.a);c=Kdb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c} +function eOb(a,b){var c,d,e;d=a.b.b.d;a.a||(d+=a.b.b.a);e=b.b.b.d;b.a||(e+=b.b.b.a);c=Kdb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c} +function PVb(a,b){var c,d,e;d=a.b.g.d;a.a||(d+=a.b.g.a);e=b.b.g.d;b.a||(e+=b.b.g.a);c=Kdb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c} +function ZTb(){ZTb=ccb;WTb=c3c(e3c(e3c(e3c(new j3c,(qUb(),oUb),(S8b(),m8b)),oUb,q8b),pUb,x8b),pUb,a8b);YTb=e3c(e3c(new j3c,oUb,S7b),oUb,b8b);XTb=c3c(new j3c,pUb,d8b)} +function s3b(a){var b,c,d,e,f;b=BD(vNb(a,(wtc(),Csc)),83);f=a.n;for(d=b.Cc().Kc();d.Ob();){c=BD(d.Pb(),306);e=c.i;e.c+=f.a;e.d+=f.b;c.c?VHb(c):XHb(c)}yNb(a,Csc,null)} +function qmc(a,b,c){var d,e;e=a.b;d=e.d;switch(b.g){case 1:return -d.d-c;case 2:return e.o.a+d.c+c;case 3:return e.o.b+d.a+c;case 4:return -d.b-c;default:return -1;}} +function BXc(a){var b,c,d,e,f;d=0;e=dme;if(a.b){for(b=0;b<360;b++){c=b*0.017453292519943295;zXc(a,a.d,0,0,dre,c);f=a.b.ig(a.d);if(f0){g=(f&Ohe)%a.d.length;e=wAd(a,g,f,b);if(e){h=e.ed(c);return h}}d=a.tj(f,b,c);a.c.Fc(d);return null} +function t1d(a,b){var c,d,e,f;switch(o1d(a,b)._k()){case 3:case 2:{c=OKd(b);for(e=0,f=c.i;e=0;d--){if(dfb(a[d].d,b)||dfb(a[d].d,c)){a.length>=d+1&&a.splice(0,d+1);break}}return a} +function Abb(a,b){var c;if(Fbb(a)&&Fbb(b)){c=a/b;if(Kje0){a.b+=2;a.a+=d}}else{a.b+=1;a.a+=$wnd.Math.min(d,e)}} +function Rpd(a,b){var c,d;d=false;if(ND(b)){d=true;Qpd(a,new yC(GD(b)))}if(!d){if(JD(b,236)){d=true;Qpd(a,(c=Kcb(BD(b,236)),new TB(c)))}}if(!d){throw vbb(new vcb(Ute))}} +function IMd(a,b,c,d){var e,f,g;e=new pSd(a.e,1,10,(g=b.c,JD(g,88)?BD(g,26):(jGd(),_Fd)),(f=c.c,JD(f,88)?BD(f,26):(jGd(),_Fd)),HLd(a,b),false);!d?(d=e):d.Ei(e);return d} +function T_b(a){var b,c;switch(BD(vNb(Q_b(a),(Nyc(),ixc)),420).g){case 0:b=a.n;c=a.o;return new f7c(b.a+c.a/2,b.b+c.b/2);case 1:return new g7c(a.n);default:return null;}} +function lrc(){lrc=ccb;irc=new mrc(ane,0);hrc=new mrc('LEFTUP',1);krc=new mrc('RIGHTUP',2);grc=new mrc('LEFTDOWN',3);jrc=new mrc('RIGHTDOWN',4);frc=new mrc('BALANCED',5)} +function FFc(a,b,c){var d,e,f;d=Kdb(a.a[b.p],a.a[c.p]);if(d==0){e=BD(vNb(b,(wtc(),Qsc)),15);f=BD(vNb(c,Qsc),15);if(e.Hc(c)){return -1}else if(f.Hc(b)){return 1}}return d} +function jXc(a){switch(a.g){case 1:return new XVc;case 2:return new ZVc;case 3:return new VVc;case 0:return null;default:throw vbb(new Wdb(jre+(a.f!=null?a.f:''+a.g)));}} +function Ikd(a,b,c){switch(b){case 1:!a.n&&(a.n=new cUd(D2,a,1,7));Uxd(a.n);!a.n&&(a.n=new cUd(D2,a,1,7));ytd(a.n,BD(c,14));return;case 2:Lkd(a,GD(c));return;}ekd(a,b,c)} +function Zkd(a,b,c){switch(b){case 3:ald(a,Edb(ED(c)));return;case 4:cld(a,Edb(ED(c)));return;case 5:dld(a,Edb(ED(c)));return;case 6:eld(a,Edb(ED(c)));return;}Ikd(a,b,c)} +function Fnd(a,b,c){var d,e,f;f=(d=new rUd,d);e=xId(f,b,null);!!e&&e.Fi();pnd(f,c);wtd((!a.c&&(a.c=new cUd(p5,a,12,10)),a.c),f);AId(f,0);DId(f,1);CId(f,true);BId(f,true)} +function mUd(a,b){var c,d,e;c=Crb(a.g,b);if(JD(c,235)){e=BD(c,235);e.Qh()==null&&undefined;return e.Nh()}else if(JD(c,498)){d=BD(c,1938);e=d.b;return e}else{return null}} +function Ui(a,b,c,d){var e,f;Qb(b);Qb(c);f=BD(tn(a.d,b),19);Ob(!!f,'Row %s not in %s',b,a.e);e=BD(tn(a.b,c),19);Ob(!!e,'Column %s not in %s',c,a.c);return Wi(a,f.a,e.a,d)} +function JC(a,b,c,d,e,f,g){var h,i,j,k,l;k=e[f];j=f==g-1;h=j?d:0;l=LC(h,k);d!=10&&OC(GC(a,g-f),b[f],c[f],h,l);if(!j){++f;for(i=0;i1||h==-1){f=BD(i,15);e.Wb(t6d(a,f))}else{e.Wb(s6d(a,BD(i,56)))}}}} +function Zbb(b,c,d,e){Ybb();var f=Wbb;$moduleName=c;$moduleBase=d;tbb=e;function g(){for(var a=0;aOqe){return c}else e>-1.0E-6&&++c}return c} +function PQd(a,b){var c;if(b!=a.b){c=null;!!a.b&&(c=lid(a.b,a,-4,c));!!b&&(c=kid(b,a,-4,c));c=GQd(a,b,c);!!c&&c.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,b,b))} +function SQd(a,b){var c;if(b!=a.f){c=null;!!a.f&&(c=lid(a.f,a,-1,c));!!b&&(c=kid(b,a,-1,c));c=IQd(a,b,c);!!c&&c.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,0,b,b))} +function E9d(a){var b,c,d;if(a==null)return null;c=BD(a,15);if(c.dc())return '';d=new Hfb;for(b=c.Kc();b.Ob();){Efb(d,(Q8d(),GD(b.Pb())));d.a+=' '}return lcb(d,d.a.length-1)} +function I9d(a){var b,c,d;if(a==null)return null;c=BD(a,15);if(c.dc())return '';d=new Hfb;for(b=c.Kc();b.Ob();){Efb(d,(Q8d(),GD(b.Pb())));d.a+=' '}return lcb(d,d.a.length-1)} +function qEc(a,b,c){var d,e;d=a.c[b.c.p][b.p];e=a.c[c.c.p][c.p];if(d.a!=null&&e.a!=null){return Ddb(d.a,e.a)}else if(d.a!=null){return -1}else if(e.a!=null){return 1}return 0} +function zqd(a,b){var c,d,e,f,g,h;if(b){f=b.a.length;c=new Yge(f);for(h=(c.b-c.a)*c.c<0?(Xge(),Wge):new she(c);h.Ob();){g=BD(h.Pb(),19);e=Zpd(b,g.a);d=new Crd(a);Aqd(d.a,e)}}} +function Qqd(a,b){var c,d,e,f,g,h;if(b){f=b.a.length;c=new Yge(f);for(h=(c.b-c.a)*c.c<0?(Xge(),Wge):new she(c);h.Ob();){g=BD(h.Pb(),19);e=Zpd(b,g.a);d=new lrd(a);nqd(d.a,e)}}} +function eFd(b){var c;if(b!=null&&b.length>0&&bfb(b,b.length-1)==33){try{c=PEd(qfb(b,0,b.length-1));return c.e==null}catch(a){a=ubb(a);if(!JD(a,32))throw vbb(a)}}return false} +function h3d(a,b,c){var d,e,f;d=b.ak();f=b.dd();e=d.$j()?H2d(a,3,d,null,f,M2d(a,d,f,JD(d,99)&&(BD(d,18).Bb&Tje)!=0),true):H2d(a,1,d,d.zj(),f,-1,true);c?c.Ei(e):(c=e);return c} +function Vee(){var a,b,c;b=0;for(a=0;a<'X'.length;a++){c=Uee((BCb(a,'X'.length),'X'.charCodeAt(a)));if(c==0)throw vbb(new mde('Unknown Option: '+'X'.substr(a)));b|=c}return b} +function mZb(a,b,c){var d,e,f;d=Q_b(b);e=a_b(d);f=new H0b;F0b(f,b);switch(c.g){case 1:G0b(f,Wcd(Zcd(e)));break;case 2:G0b(f,Zcd(e));}yNb(f,(Nyc(),Uxc),ED(vNb(a,Uxc)));return f} +function U9b(a){var b,c;b=BD(Rr(new Sr(ur(R_b(a.a).a.Kc(),new Sq))),17);c=BD(Rr(new Sr(ur(U_b(a.a).a.Kc(),new Sq))),17);return Ccb(DD(vNb(b,(wtc(),ltc))))||Ccb(DD(vNb(c,ltc)))} +function Xjc(){Xjc=ccb;Tjc=new Yjc('ONE_SIDE',0);Vjc=new Yjc('TWO_SIDES_CORNER',1);Wjc=new Yjc('TWO_SIDES_OPPOSING',2);Ujc=new Yjc('THREE_SIDES',3);Sjc=new Yjc('FOUR_SIDES',4)} +function jkc(a,b,c,d,e){var f,g;f=BD(GAb(JAb(b.Oc(),new _kc),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);g=BD(Si(a.b,c,d),15);e==0?g.Wc(0,f):g.Gc(f)} +function KDc(a,b){var c,d,e,f,g;for(f=new olb(b.a);f.a0&&ric(this,this.c-1,(Ucd(),zcd));this.c0&&a[0].length>0&&(this.c=Ccb(DD(vNb(Q_b(a[0][0]),(wtc(),Rsc)))));this.a=KC(CX,nie,2018,a.length,0,2);this.b=KC(FX,nie,2019,a.length,0,2);this.d=new ss} +function tKc(a){if(a.c.length==0){return false}if((tCb(0,a.c.length),BD(a.c[0],17)).c.i.k==(j0b(),g0b)){return true}return FAb(NAb(new YAb(null,new Kub(a,16)),new wKc),new yKc)} +function rRc(a,b,c){Odd(c,'Tree layout',1);H2c(a.b);K2c(a.b,(yRc(),uRc),uRc);K2c(a.b,vRc,vRc);K2c(a.b,wRc,wRc);K2c(a.b,xRc,xRc);a.a=F2c(a.b,b);sRc(a,b,Udd(c,1));Qdd(c);return b} +function HXc(a,b){var c,d,e,f,g,h,i;h=gVc(b);f=b.f;i=b.g;g=$wnd.Math.sqrt(f*f+i*i);e=0;for(d=new olb(h);d.a=0){c=Abb(a,Jje);d=Hbb(a,Jje)}else{b=Pbb(a,1);c=Abb(b,500000000);d=Hbb(b,500000000);d=wbb(Nbb(d,1),xbb(a,1))}return Mbb(Nbb(d,32),xbb(c,Yje))} +function oQb(a,b,c){var d,e;d=(sCb(b.b!=0),BD(Nsb(b,b.a.a),8));switch(c.g){case 0:d.b=0;break;case 2:d.b=a.f;break;case 3:d.a=0;break;default:d.a=a.g;}e=Jsb(b,0);Vsb(e,d);return b} +function pmc(a,b,c,d){var e,f,g,h,i;i=a.b;f=b.d;g=f.j;h=umc(g,i.d[g.g],c);e=P6c(R6c(f.n),f.a);switch(f.j.g){case 1:case 3:h.a+=e.a;break;case 2:case 4:h.b+=e.b;}Gsb(d,h,d.c.b,d.c)} +function yJc(a,b,c){var d,e,f,g;g=Jkb(a.e,b,0);f=new zJc;f.b=c;d=new Bib(a.e,g);while(d.b1;b>>=1){(b&1)!=0&&(d=Ogb(d,c));c.d==1?(c=Ogb(c,c)):(c=new Xgb(Lhb(c.a,c.d,KC(WD,oje,25,c.d<<1,15,1))))}d=Ogb(d,c);return d} +function zub(){zub=ccb;var a,b,c,d;wub=KC(UD,Vje,25,25,15,1);xub=KC(UD,Vje,25,33,15,1);d=1.52587890625E-5;for(b=32;b>=0;b--){xub[b]=d;d*=0.5}c=1;for(a=24;a>=0;a--){wub[a]=c;c*=0.5}} +function S1b(a){var b,c;if(Ccb(DD(hkd(a,(Nyc(),fxc))))){for(c=new Sr(ur(_sd(a).a.Kc(),new Sq));Qr(c);){b=BD(Rr(c),79);if(Qld(b)){if(Ccb(DD(hkd(b,gxc)))){return true}}}}return false} +function kjc(a,b){var c,d,e;if(Qqb(a.f,b)){b.b=a;d=b.c;Jkb(a.j,d,0)!=-1||Ekb(a.j,d);e=b.d;Jkb(a.j,e,0)!=-1||Ekb(a.j,e);c=b.a.b;if(c.c.length!=0){!a.i&&(a.i=new vjc(a));qjc(a.i,c)}}} +function rmc(a){var b,c,d,e,f;c=a.c.d;d=c.j;e=a.d.d;f=e.j;if(d==f){return c.p=0&&dfb(a.substr(b,'GMT'.length),'GMT')){c[0]=b+3;return tA(a,c,d)}if(b>=0&&dfb(a.substr(b,'UTC'.length),'UTC')){c[0]=b+3;return tA(a,c,d)}return tA(a,c,d)} +function tjc(a,b){var c,d,e,f,g;f=a.g.a;g=a.g.b;for(d=new olb(a.d);d.ac;f--){a[f]|=b[f-c-1]>>>g;a[f-1]=b[f-c-1]<=a.f){break}f.c[f.c.length]=c}return f} +function sfd(a){var b,c,d,e;b=null;for(e=new olb(a.wf());e.a0&&$fb(a.g,b,a.g,b+d,h);g=c.Kc();a.i+=d;for(e=0;ef&&nfb(j,sfb(c[h],ltb))){e=h;f=i}}e>=0&&(d[0]=b+f);return e} +function MIb(a,b){var c;c=NIb(a.b.Hf(),b.b.Hf());if(c!=0){return c}switch(a.b.Hf().g){case 1:case 2:return beb(a.b.sf(),b.b.sf());case 3:case 4:return beb(b.b.sf(),a.b.sf());}return 0} +function iRb(a){var b,c,d;d=a.e.c.length;a.a=IC(WD,[nie,oje],[48,25],15,[d,d],2);for(c=new olb(a.c);c.a>4&15;f=a[d]&15;g[e++]=Qmd[c];g[e++]=Qmd[f]}return zfb(g,0,g.length)}} +function j3d(a,b,c){var d,e,f;d=b.ak();f=b.dd();e=d.$j()?H2d(a,4,d,f,null,M2d(a,d,f,JD(d,99)&&(BD(d,18).Bb&Tje)!=0),true):H2d(a,d.Kj()?2:1,d,f,d.zj(),-1,true);c?c.Ei(e):(c=e);return c} +function wfb(a){var b,c;if(a>=Tje){b=Uje+(a-Tje>>10&1023)&aje;c=56320+(a-Tje&1023)&aje;return String.fromCharCode(b)+(''+String.fromCharCode(c))}else{return String.fromCharCode(a&aje)}} +function bKb(a,b){$Jb();var c,d,e,f;e=BD(BD(Qc(a.r,b),21),84);if(e.gc()>=2){d=BD(e.Kc().Pb(),111);c=a.u.Hc((rcd(),mcd));f=a.u.Hc(qcd);return !d.a&&!c&&(e.gc()==2||f)}else{return false}} +function IVc(a,b,c,d,e){var f,g,h;f=JVc(a,b,c,d,e);h=false;while(!f){AVc(a,e,true);h=true;f=JVc(a,b,c,d,e)}h&&AVc(a,e,false);g=dVc(e);if(g.c.length!=0){!!a.d&&a.d.lg(g);IVc(a,e,c,d,g)}} +function Mad(){Mad=ccb;Kad=new Nad(ane,0);Iad=new Nad('DIRECTED',1);Lad=new Nad('UNDIRECTED',2);Gad=new Nad('ASSOCIATION',3);Jad=new Nad('GENERALIZATION',4);Had=new Nad('DEPENDENCY',5)} +function kfd(a,b){var c;if(!mpd(a)){throw vbb(new Zdb(Sse))}c=mpd(a);switch(b.g){case 1:return -(a.j+a.f);case 2:return a.i-c.g;case 3:return a.j-c.f;case 4:return -(a.i+a.g);}return 0} +function cub(a,b){var c,d;uCb(b);d=a.b.c.length;Ekb(a.b,b);while(d>0){c=d;d=(d-1)/2|0;if(a.a.ue(Ikb(a.b,d),b)<=0){Nkb(a.b,c,b);return true}Nkb(a.b,c,Ikb(a.b,d))}Nkb(a.b,d,b);return true} +function BHb(a,b,c,d){var e,f;e=0;if(!c){for(f=0;f=h} +function Tpd(a,b,c,d){var e;e=false;if(ND(d)){e=true;Upd(b,c,GD(d))}if(!e){if(KD(d)){e=true;Tpd(a,b,c,d)}}if(!e){if(JD(d,236)){e=true;Spd(b,c,BD(d,236))}}if(!e){throw vbb(new vcb(Ute))}} +function W0d(a,b){var c,d,e;c=b.Hh(a.a);if(c){e=AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),Sve);if(e!=null){for(d=1;d<(O6d(),K6d).length;++d){if(dfb(K6d[d],e)){return d}}}}return 0} +function X0d(a,b){var c,d,e;c=b.Hh(a.a);if(c){e=AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),Sve);if(e!=null){for(d=1;d<(O6d(),L6d).length;++d){if(dfb(L6d[d],e)){return d}}}}return 0} +function Ve(a,b){var c,d,e,f;uCb(b);f=a.a.gc();if(f0?1:0;while(f.a[e]!=c){f=f.a[e];e=a.a.ue(c.d,f.d)>0?1:0}f.a[e]=d;d.b=c.b;d.a[0]=c.a[0];d.a[1]=c.a[1];c.a[0]=null;c.a[1]=null} +function ucd(a){rcd();var b,c;b=qqb(ncd,OC(GC(E1,1),Kie,273,0,[pcd]));if(Ox(Cx(b,a))>1){return false}c=qqb(mcd,OC(GC(E1,1),Kie,273,0,[lcd,qcd]));if(Ox(Cx(c,a))>1){return false}return true} +function fod(a,b){var c;c=Phb((yFd(),xFd),a);JD(c,498)?Shb(xFd,a,new bUd(this,b)):Shb(xFd,a,this);bod(this,b);if(b==(LFd(),KFd)){this.wb=BD(this,1939);BD(b,1941)}else{this.wb=(NFd(),MFd)}} +function lZd(b){var c,d,e;if(b==null){return null}c=null;for(d=0;d=_ie?'error':d>=900?'warn':d>=800?'info':'log');gCb(c,a.a);!!a.b&&hCb(b,c,a.b,'Exception: ',true)} +function vNb(a,b){var c,d;d=(!a.q&&(a.q=new Lqb),Ohb(a.q,b));if(d!=null){return d}c=b.wg();JD(c,4)&&(c==null?(!a.q&&(a.q=new Lqb),Thb(a.q,b)):(!a.q&&(a.q=new Lqb),Rhb(a.q,b,c)),a);return c} +function qUb(){qUb=ccb;lUb=new rUb('P1_CYCLE_BREAKING',0);mUb=new rUb('P2_LAYERING',1);nUb=new rUb('P3_NODE_ORDERING',2);oUb=new rUb('P4_NODE_PLACEMENT',3);pUb=new rUb('P5_EDGE_ROUTING',4)} +function SUb(a,b){var c,d,e,f,g;e=b==1?KUb:JUb;for(d=e.a.ec().Kc();d.Ob();){c=BD(d.Pb(),103);for(g=BD(Qc(a.f.c,c),21).Kc();g.Ob();){f=BD(g.Pb(),46);Lkb(a.b.b,f.b);Lkb(a.b.a,BD(f.b,81).d)}}} +function IWb(a,b){AWb();var c;if(a.c==b.c){if(a.b==b.b||pWb(a.b,b.b)){c=mWb(a.b)?1:-1;if(a.a&&!b.a){return c}else if(!a.a&&b.a){return -c}}return beb(a.b.g,b.b.g)}else{return Kdb(a.c,b.c)}} +function y6b(a,b){var c;Odd(b,'Hierarchical port position processing',1);c=a.b;c.c.length>0&&x6b((tCb(0,c.c.length),BD(c.c[0],29)),a);c.c.length>1&&x6b(BD(Ikb(c,c.c.length-1),29),a);Qdd(b)} +function RVc(a,b){var c,d,e;if(CVc(a,b)){return true}for(d=new olb(b);d.a=e||b<0)throw vbb(new qcb(lue+b+mue+e));if(c>=e||c<0)throw vbb(new qcb(nue+c+mue+e));b!=c?(d=(f=a.Ti(c),a.Hi(b,f),f)):(d=a.Oi(c));return d} +function m6d(a){var b,c,d;d=a;if(a){b=0;for(c=a.Ug();c;c=c.Ug()){if(++b>Wje){return m6d(c)}d=c;if(c==a){throw vbb(new Zdb('There is a cycle in the containment hierarchy of '+a))}}}return d} +function Fe(a){var b,c,d;d=new xwb(She,'[',']');for(c=a.Kc();c.Ob();){b=c.Pb();uwb(d,PD(b)===PD(a)?'(this Collection)':b==null?Xhe:fcb(b))}return !d.a?d.c:d.e.length==0?d.a.a:d.a.a+(''+d.e)} +function CVc(a,b){var c,d;d=false;if(b.gc()<2){return false}for(c=0;cd&&(BCb(b-1,a.length),a.charCodeAt(b-1)<=32)){--b}return d>0||b1&&(a.j.b+=a.e)}else{a.j.a+=c.a;a.j.b=$wnd.Math.max(a.j.b,c.b);a.d.c.length>1&&(a.j.a+=a.e)}} +function gkc(){gkc=ccb;dkc=OC(GC(F1,1),bne,61,0,[(Ucd(),Acd),zcd,Rcd]);ckc=OC(GC(F1,1),bne,61,0,[zcd,Rcd,Tcd]);ekc=OC(GC(F1,1),bne,61,0,[Rcd,Tcd,Acd]);fkc=OC(GC(F1,1),bne,61,0,[Tcd,Acd,zcd])} +function omc(a,b,c,d){var e,f,g,h,i,j,k;g=a.c.d;h=a.d.d;if(g.j==h.j){return}k=a.b;e=g.j;i=null;while(e!=h.j){i=b==0?Xcd(e):Vcd(e);f=umc(e,k.d[e.g],c);j=umc(i,k.d[i.g],c);Dsb(d,P6c(f,j));e=i}} +function oFc(a,b,c,d){var e,f,g,h,i;g=JHc(a.a,b,c);h=BD(g.a,19).a;f=BD(g.b,19).a;if(d){i=BD(vNb(b,(wtc(),gtc)),10);e=BD(vNb(c,gtc),10);if(!!i&&!!e){mic(a.b,i,e);h+=a.b.i;f+=a.b.e}}return h>f} +function oHc(a){var b,c,d,e,f,g,h,i,j;this.a=lHc(a);this.b=new Rkb;for(c=a,d=0,e=c.length;dwic(a.d).c){a.i+=a.g.c;yic(a.d)}else if(wic(a.d).c>wic(a.g).c){a.e+=a.d.c;yic(a.g)}else{a.i+=vic(a.g);a.e+=vic(a.d);yic(a.g);yic(a.d)}}} +function XOc(a,b,c){var d,e,f,g;f=b.q;g=b.r;new DOc((HOc(),FOc),b,f,1);new DOc(FOc,f,g,1);for(e=new olb(c);e.ah&&(i=h/d);e>f&&(j=f/e);g=$wnd.Math.min(i,j);a.a+=g*(b.a-a.a);a.b+=g*(b.b-a.b)} +function sZc(a,b,c,d,e){var f,g;g=false;f=BD(Ikb(c.b,0),33);while(yZc(a,b,f,d,e)){g=true;NZc(c,f);if(c.b.c.length==0){break}f=BD(Ikb(c.b,0),33)}c.b.c.length==0&&v$c(c.j,c);g&&a$c(b.q);return g} +function t6c(a,b){i6c();var c,d,e,f;if(b.b<2){return false}f=Jsb(b,0);c=BD(Xsb(f),8);d=c;while(f.b!=f.d.c){e=BD(Xsb(f),8);if(s6c(a,d,e)){return true}d=e}if(s6c(a,d,c)){return true}return false} +function ckd(a,b,c,d){var e,f;if(c==0){return !a.o&&(a.o=new dId((Thd(),Qhd),S2,a,0)),bId(a.o,b,d)}return f=BD(XKd((e=BD(Ajd(a,16),26),!e?a.zh():e),c),66),f.Nj().Rj(a,yjd(a),c-aLd(a.zh()),b,d)} +function bod(a,b){var c;if(b!=a.sb){c=null;!!a.sb&&(c=BD(a.sb,49).ih(a,1,i5,c));!!b&&(c=BD(b,49).gh(a,1,i5,c));c=Jnd(a,b,c);!!c&&c.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,4,b,b))} +function yqd(a,b){var c,d,e,f;if(b){e=Xpd(b,'x');c=new zrd(a);hmd(c.a,(uCb(e),e));f=Xpd(b,'y');d=new Ard(a);imd(d.a,(uCb(f),f))}else{throw vbb(new cqd('All edge sections need an end point.'))}} +function wqd(a,b){var c,d,e,f;if(b){e=Xpd(b,'x');c=new wrd(a);omd(c.a,(uCb(e),e));f=Xpd(b,'y');d=new xrd(a);pmd(d.a,(uCb(f),f))}else{throw vbb(new cqd('All edge sections need a start point.'))}} +function pyb(a,b){var c,d,e,f,g,h,i;for(d=syb(a),f=0,h=d.length;f>22-b;e=a.h<>22-b}else if(b<44){c=0;d=a.l<>44-b}else{c=0;d=0;e=a.l<a){throw vbb(new Wdb('k must be smaller than n'))}else return b==0||b==a?1:a==0?0:q6c(a)/(q6c(b)*q6c(a-b))} +function jfd(a,b){var c,d,e,f;c=new _ud(a);while(c.g==null&&!c.c?Uud(c):c.g==null||c.i!=0&&BD(c.g[c.i-1],47).Ob()){f=BD(Vud(c),56);if(JD(f,160)){d=BD(f,160);for(e=0;e>4];b[c*2+1]=gde[f&15]}return zfb(b,0,b.length)} +function fn(a){Vm();var b,c,d;d=a.c.length;switch(d){case 0:return Um;case 1:b=BD(qr(new olb(a)),42);return ln(b.cd(),b.dd());default:c=BD(Qkb(a,KC(CK,zie,42,a.c.length,0,1)),165);return new wx(c);}} +function ITb(a){var b,c,d,e,f,g;b=new jkb;c=new jkb;Wjb(b,a);Wjb(c,a);while(c.b!=c.c){e=BD(fkb(c),37);for(g=new olb(e.a);g.a0&&WGc(a,c,b);return e}return TGc(a,b,c)} +function MSc(a,b,c){var d,e,f,g;if(b.b!=0){d=new Psb;for(g=Jsb(b,0);g.b!=g.d.c;){f=BD(Xsb(g),86);ye(d,URc(f));e=f.e;e.a=BD(vNb(f,(mTc(),kTc)),19).a;e.b=BD(vNb(f,lTc),19).a}MSc(a,d,Udd(c,d.b/a.a|0))}} +function JZc(a,b){var c,d,e,f,g;if(a.e<=b){return a.g}if(LZc(a,a.g,b)){return a.g}f=a.r;d=a.g;g=a.r;e=(f-d)/2+d;while(d+11&&(a.e.b+=a.a)}else{a.e.a+=c.a;a.e.b=$wnd.Math.max(a.e.b,c.b);a.d.c.length>1&&(a.e.a+=a.a)}} +function cmc(a){var b,c,d,e;e=a.i;b=e.b;d=e.j;c=e.g;switch(e.a.g){case 0:c.a=(a.g.b.o.a-d.a)/2;break;case 1:c.a=b.d.n.a+b.d.a.a;break;case 2:c.a=b.d.n.a+b.d.a.a-d.a;break;case 3:c.b=b.d.n.b+b.d.a.b;}} +function Q6c(a,b,c,d,e){if(dd&&(a.a=d);a.be&&(a.b=e);return a} +function lsd(a){if(JD(a,149)){return esd(BD(a,149))}else if(JD(a,229)){return fsd(BD(a,229))}else if(JD(a,23)){return gsd(BD(a,23))}else{throw vbb(new Wdb(Xte+Fe(new amb(OC(GC(SI,1),Uhe,1,5,[a])))))}} +function mhb(a,b,c,d,e){var f,g,h;f=true;for(g=0;g>>e|c[g+d+1]<>>e;++g}return f} +function zMc(a,b,c,d){var e,f,g;if(b.k==(j0b(),g0b)){for(f=new Sr(ur(R_b(b).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);g=e.c.i.k;if(g==g0b&&a.c.a[e.c.i.c.p]==d&&a.c.a[b.c.p]==c){return true}}}return false} +function mD(a,b){var c,d,e,f;b&=63;c=a.h&Fje;if(b<22){f=c>>>b;e=a.m>>b|c<<22-b;d=a.l>>b|a.m<<22-b}else if(b<44){f=0;e=c>>>b-22;d=a.m>>b-22|a.h<<44-b}else{f=0;e=0;d=c>>>b-44}return TC(d&Eje,e&Eje,f&Fje)} +function Iic(a,b,c,d){var e;this.b=d;this.e=a==(rGc(),pGc);e=b[c];this.d=IC(sbb,[nie,dle],[177,25],16,[e.length,e.length],2);this.a=IC(WD,[nie,oje],[48,25],15,[e.length,e.length],2);this.c=new sic(b,c)} +function ljc(a){var b,c,d;a.k=new Ki((Ucd(),OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])).length,a.j.c.length);for(d=new olb(a.j);d.a=c){K9b(a,b,d.p);return true}}return false} +function Iod(a){var b;if((a.Db&64)!=0)return fld(a);b=new Wfb(dte);!a.a||Qfb(Qfb((b.a+=' "',b),a.a),'"');Qfb(Lfb(Qfb(Lfb(Qfb(Lfb(Qfb(Lfb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a} +function Z2d(a,b,c){var d,e,f,g,h;h=S6d(a.e.Tg(),b);e=BD(a.g,119);d=0;for(g=0;gc){return Jb(a,c,'start index')}if(b<0||b>c){return Jb(b,c,'end index')}return hc('end index (%s) must not be less than start index (%s)',OC(GC(SI,1),Uhe,1,5,[meb(b),meb(a)]))} +function Pz(b,c){var d,e,f,g;for(e=0,f=b.length;e0&&iCc(a,f,c))}}b.p=0} +function p5c(a){var b;this.c=new Psb;this.f=a.e;this.e=a.d;this.i=a.g;this.d=a.c;this.b=a.b;this.k=a.j;this.a=a.a;!a.i?(this.j=(b=BD(gdb(e1),9),new xqb(b,BD(_Bb(b,b.length),9),0))):(this.j=a.i);this.g=a.f} +function Wb(a){var b,c,d,e;b=Kfb(Qfb(new Wfb('Predicates.'),'and'),40);c=true;for(e=new vib(a);e.b0?h[g-1]:KC(OQ,kne,10,0,0,1);e=h[g];j=g=0?a.Bh(e):vid(a,d)}else{throw vbb(new Wdb(ite+d.ne()+jte))}}else{eid(a,c,d)}} +function aqd(a){var b,c;c=null;b=false;if(JD(a,204)){b=true;c=BD(a,204).a}if(!b){if(JD(a,258)){b=true;c=''+BD(a,258).a}}if(!b){if(JD(a,483)){b=true;c=''+BD(a,483).a}}if(!b){throw vbb(new vcb(Ute))}return c} +function ORd(a,b){var c,d;if(a.f){while(b.Ob()){c=BD(b.Pb(),72);d=c.ak();if(JD(d,99)&&(BD(d,18).Bb&ote)!=0&&(!a.e||d.Gj()!=x2||d.aj()!=0)&&c.dd()!=null){b.Ub();return true}}return false}else{return b.Ob()}} +function QRd(a,b){var c,d;if(a.f){while(b.Sb()){c=BD(b.Ub(),72);d=c.ak();if(JD(d,99)&&(BD(d,18).Bb&ote)!=0&&(!a.e||d.Gj()!=x2||d.aj()!=0)&&c.dd()!=null){b.Pb();return true}}return false}else{return b.Sb()}} +function I2d(a,b,c){var d,e,f,g,h,i;i=S6d(a.e.Tg(),b);d=0;h=a.i;e=BD(a.g,119);for(g=0;g1&&(b.c[b.c.length]=f,true)}} +function TJc(a){var b,c,d,e;c=new Psb;ye(c,a.o);d=new twb;while(c.b!=0){b=BD(c.b==0?null:(sCb(c.b!=0),Nsb(c,c.a.a)),508);e=KJc(a,b,true);e&&Ekb(d.a,b)}while(d.a.c.length!=0){b=BD(rwb(d),508);KJc(a,b,false)}} +function _5c(){_5c=ccb;$5c=new a6c(ole,0);T5c=new a6c('BOOLEAN',1);X5c=new a6c('INT',2);Z5c=new a6c('STRING',3);U5c=new a6c('DOUBLE',4);V5c=new a6c('ENUM',5);W5c=new a6c('ENUMSET',6);Y5c=new a6c('OBJECT',7)} +function H6c(a,b){var c,d,e,f,g;d=$wnd.Math.min(a.c,b.c);f=$wnd.Math.min(a.d,b.d);e=$wnd.Math.max(a.c+a.b,b.c+b.b);g=$wnd.Math.max(a.d+a.a,b.d+b.a);if(e=(e/2|0)){this.e=!d?null:d.c;this.d=e;while(c++0){uu(this)}}this.b=b;this.a=null} +function rEb(a,b){var c,d;b.a?sEb(a,b):(c=BD(Exb(a.b,b.b),57),!!c&&c==a.a[b.b.f]&&!!c.a&&c.a!=b.b.a&&c.c.Fc(b.b),d=BD(Dxb(a.b,b.b),57),!!d&&a.a[d.f]==b.b&&!!d.a&&d.a!=b.b.a&&b.b.c.Fc(d),Fxb(a.b,b.b),undefined)} +function FJb(a,b){var c,d;c=BD(Mpb(a.b,b),124);if(BD(BD(Qc(a.r,b),21),84).dc()){c.n.b=0;c.n.c=0;return}c.n.b=a.C.b;c.n.c=a.C.c;a.A.Hc((tdd(),sdd))&&KJb(a,b);d=JJb(a,b);KIb(a,b)==(Tbd(),Qbd)&&(d+=2*a.w);c.a.a=d} +function OKb(a,b){var c,d;c=BD(Mpb(a.b,b),124);if(BD(BD(Qc(a.r,b),21),84).dc()){c.n.d=0;c.n.a=0;return}c.n.d=a.C.d;c.n.a=a.C.a;a.A.Hc((tdd(),sdd))&&SKb(a,b);d=RKb(a,b);KIb(a,b)==(Tbd(),Qbd)&&(d+=2*a.w);c.a.b=d} +function cOb(a,b){var c,d,e,f;f=new Rkb;for(d=new olb(b);d.ac.a&&(d.Hc((i8c(),c8c))?(e=(b.a-c.a)/2):d.Hc(e8c)&&(e=b.a-c.a));b.b>c.b&&(d.Hc((i8c(),g8c))?(f=(b.b-c.b)/2):d.Hc(f8c)&&(f=b.b-c.b));Efd(a,e,f)} +function aod(a,b,c,d,e,f,g,h,i,j,k,l,m){JD(a.Cb,88)&&XMd($Kd(BD(a.Cb,88)),4);pnd(a,c);a.f=g;dJd(a,h);fJd(a,i);ZId(a,j);eJd(a,k);CId(a,l);aJd(a,m);BId(a,true);AId(a,e);a.ok(f);yId(a,b);d!=null&&(a.i=null,_Id(a,d))} +function PRd(a){var b,c;if(a.f){while(a.n>0){b=BD(a.k.Xb(a.n-1),72);c=b.ak();if(JD(c,99)&&(BD(c,18).Bb&ote)!=0&&(!a.e||c.Gj()!=x2||c.aj()!=0)&&b.dd()!=null){return true}else{--a.n}}return false}else{return a.n>0}} +function Jb(a,b,c){if(a<0){return hc(The,OC(GC(SI,1),Uhe,1,5,[c,meb(a)]))}else if(b<0){throw vbb(new Wdb(Vhe+b))}else{return hc('%s (%s) must not be greater than size (%s)',OC(GC(SI,1),Uhe,1,5,[c,meb(a),meb(b)]))}} +function Llb(a,b,c,d,e,f){var g,h,i,j;g=d-c;if(g<7){Ilb(b,c,d,f);return}i=c+e;h=d+e;j=i+(h-i>>1);Llb(b,a,i,j,-e,f);Llb(b,a,j,h,-e,f);if(f.ue(a[j-1],a[j])<=0){while(c=0?a.sh(f,c):uid(a,e,c)}else{throw vbb(new Wdb(ite+e.ne()+jte))}}else{did(a,d,e,c)}} +function q6d(b){var c,d,e,f;d=BD(b,49).qh();if(d){try{e=null;c=nUd((yFd(),xFd),LEd(MEd(d)));if(c){f=c.rh();!!f&&(e=f.Wk(tfb(d.e)))}if(!!e&&e!=b){return q6d(e)}}catch(a){a=ubb(a);if(!JD(a,60))throw vbb(a)}}return b} +function jrb(a,b,c){var d,e,f,g;g=b==null?0:a.b.se(b);e=(d=a.a.get(g),d==null?new Array:d);if(e.length==0){a.a.set(g,e)}else{f=grb(a,b,e);if(f){return f.ed(c)}}NC(e,e.length,new pjb(b,c));++a.c;zpb(a.b);return null} +function YUc(a,b){var c,d;H2c(a.a);K2c(a.a,(PUc(),NUc),NUc);K2c(a.a,OUc,OUc);d=new j3c;e3c(d,OUc,(tVc(),sVc));PD(hkd(b,(ZWc(),LWc)))!==PD((pWc(),mWc))&&e3c(d,OUc,qVc);e3c(d,OUc,rVc);E2c(a.a,d);c=F2c(a.a,b);return c} +function uC(a){if(!a){return OB(),NB}var b=a.valueOf?a.valueOf():a;if(b!==a){var c=qC[typeof b];return c?c(b):xC(typeof b)}else if(a instanceof Array||a instanceof $wnd.Array){return new xB(a)}else{return new fC(a)}} +function RJb(a,b,c){var d,e,f;f=a.o;d=BD(Mpb(a.p,c),244);e=d.i;e.b=gIb(d);e.a=fIb(d);e.b=$wnd.Math.max(e.b,f.a);e.b>f.a&&!b&&(e.b=f.a);e.c=-(e.b-f.a)/2;switch(c.g){case 1:e.d=-e.a;break;case 3:e.d=f.b;}hIb(d);iIb(d)} +function SJb(a,b,c){var d,e,f;f=a.o;d=BD(Mpb(a.p,c),244);e=d.i;e.b=gIb(d);e.a=fIb(d);e.a=$wnd.Math.max(e.a,f.b);e.a>f.b&&!b&&(e.a=f.b);e.d=-(e.a-f.b)/2;switch(c.g){case 4:e.c=-e.b;break;case 2:e.c=f.a;}hIb(d);iIb(d)} +function Jgc(a,b){var c,d,e,f,g;if(b.dc()){return}e=BD(b.Xb(0),128);if(b.gc()==1){Igc(a,e,e,1,0,b);return}c=1;while(c0){try{f=Icb(c,Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){e=a;throw vbb(new rFd(e))}else throw vbb(a)}}d=(!b.a&&(b.a=new z0d(b)),b.a);return f=0?BD(qud(d,f),56):null} +function Ib(a,b){if(a<0){return hc(The,OC(GC(SI,1),Uhe,1,5,['index',meb(a)]))}else if(b<0){throw vbb(new Wdb(Vhe+b))}else{return hc('%s (%s) must be less than size (%s)',OC(GC(SI,1),Uhe,1,5,['index',meb(a),meb(b)]))}} +function Slb(a){var b,c,d,e,f;if(a==null){return Xhe}f=new xwb(She,'[',']');for(c=a,d=0,e=c.length;d0){g=a.c.d;h=a.d.d;e=Y6c(c7c(new f7c(h.a,h.b),g),1/(d+1));f=new f7c(g.a,g.b);for(c=new olb(a.a);c.a=0?a._g(c,true,true):sid(a,e,true),153));BD(d,215).ol(b)}else{throw vbb(new Wdb(ite+b.ne()+jte))}} +function ugb(a){var b,c;if(a>-140737488355328&&a<140737488355328){if(a==0){return 0}b=a<0;b&&(a=-a);c=QD($wnd.Math.floor($wnd.Math.log(a)/0.6931471805599453));(!b||a!=$wnd.Math.pow(2,c))&&++c;return c}return vgb(Cbb(a))} +function QOc(a){var b,c,d,e,f,g,h;f=new zsb;for(c=new olb(a);c.a2&&h.e.b+h.j.b<=2){e=h;d=g}f.a.zc(e,f);e.q=d}return f} +function K5b(a,b){var c,d,e;d=new b0b(a);tNb(d,b);yNb(d,(wtc(),Gsc),b);yNb(d,(Nyc(),Vxc),(dcd(),$bd));yNb(d,mwc,(F7c(),B7c));__b(d,(j0b(),e0b));c=new H0b;F0b(c,d);G0b(c,(Ucd(),Tcd));e=new H0b;F0b(e,d);G0b(e,zcd);return d} +function Spc(a){switch(a.g){case 0:return new fGc((rGc(),oGc));case 1:return new CFc;case 2:return new fHc;default:throw vbb(new Wdb('No implementation is available for the crossing minimizer '+(a.f!=null?a.f:''+a.g)));}} +function tDc(a,b){var c,d,e,f,g;a.c[b.p]=true;Ekb(a.a,b);for(g=new olb(b.j);g.a=f){g.$b()}else{e=g.Kc();for(d=0;d0?zh():g<0&&Bw(a,b,-g);return true}else{return false}} +function fIb(a){var b,c,d,e,f,g,h;h=0;if(a.b==0){g=jIb(a,true);b=0;for(d=g,e=0,f=d.length;e0){h+=c;++b}}b>1&&(h+=a.c*(b-1))}else{h=Mtb(Zzb(OAb(JAb(Plb(a.a),new xIb),new zIb)))}return h>0?h+a.n.d+a.n.a:0} +function gIb(a){var b,c,d,e,f,g,h;h=0;if(a.b==0){h=Mtb(Zzb(OAb(JAb(Plb(a.a),new tIb),new vIb)))}else{g=kIb(a,true);b=0;for(d=g,e=0,f=d.length;e0){h+=c;++b}}b>1&&(h+=a.c*(b-1))}return h>0?h+a.n.b+a.n.c:0} +function MJb(a,b){var c,d,e,f;f=BD(Mpb(a.b,b),124);c=f.a;for(e=BD(BD(Qc(a.r,b),21),84).Kc();e.Ob();){d=BD(e.Pb(),111);!!d.c&&(c.a=$wnd.Math.max(c.a,ZHb(d.c)))}if(c.a>0){switch(b.g){case 2:f.n.c=a.s;break;case 4:f.n.b=a.s;}}} +function NQb(a,b){var c,d,e;c=BD(vNb(b,(wSb(),oSb)),19).a-BD(vNb(a,oSb),19).a;if(c==0){d=c7c(R6c(BD(vNb(a,(HSb(),DSb)),8)),BD(vNb(a,ESb),8));e=c7c(R6c(BD(vNb(b,DSb),8)),BD(vNb(b,ESb),8));return Kdb(d.a*d.b,e.a*e.b)}return c} +function iRc(a,b){var c,d,e;c=BD(vNb(b,(JTc(),ETc)),19).a-BD(vNb(a,ETc),19).a;if(c==0){d=c7c(R6c(BD(vNb(a,(mTc(),VSc)),8)),BD(vNb(a,WSc),8));e=c7c(R6c(BD(vNb(b,VSc),8)),BD(vNb(b,WSc),8));return Kdb(d.a*d.b,e.a*e.b)}return c} +function TZb(a){var b,c;c=new Ufb;c.a+='e_';b=KZb(a);b!=null&&(c.a+=''+b,c);if(!!a.c&&!!a.d){Qfb((c.a+=' ',c),C0b(a.c));Qfb(Pfb((c.a+='[',c),a.c.i),']');Qfb((c.a+=gne,c),C0b(a.d));Qfb(Pfb((c.a+='[',c),a.d.i),']')}return c.a} +function zRc(a){switch(a.g){case 0:return new lUc;case 1:return new sUc;case 2:return new CUc;case 3:return new IUc;default:throw vbb(new Wdb('No implementation is available for the layout phase '+(a.f!=null?a.f:''+a.g)));}} +function mfd(a,b,c,d,e){var f;f=0;switch(e.g){case 1:f=$wnd.Math.max(0,b.b+a.b-(c.b+d));break;case 3:f=$wnd.Math.max(0,-a.b-d);break;case 2:f=$wnd.Math.max(0,-a.a-d);break;case 4:f=$wnd.Math.max(0,b.a+a.a-(c.a+d));}return f} +function mqd(a,b,c){var d,e,f,g,h;if(c){e=c.a.length;d=new Yge(e);for(h=(d.b-d.a)*d.c<0?(Xge(),Wge):new she(d);h.Ob();){g=BD(h.Pb(),19);f=Zpd(c,g.a);Lte in f.a||Mte in f.a?$qd(a,f,b):erd(a,f,b);otd(BD(Ohb(a.b,Wpd(f)),79))}}} +function LJd(a){var b,c;switch(a.b){case -1:{return true}case 0:{c=a.t;if(c>1||c==-1){a.b=-1;return true}else{b=wId(a);if(!!b&&(Q6d(),b.Cj()==Bve)){a.b=-1;return true}else{a.b=1;return false}}}default:case 1:{return false}}} +function k1d(a,b){var c,d,e,f,g;d=(!b.s&&(b.s=new cUd(t5,b,21,17)),b.s);f=null;for(e=0,g=d.i;e=0&&f=0?a._g(c,true,true):sid(a,e,true),153));return BD(d,215).ll(b)}else{throw vbb(new Wdb(ite+b.ne()+lte))}} +function BZd(){tZd();var a;if(sZd)return BD(nUd((yFd(),xFd),_ve),1939);rEd(CK,new J_d);CZd();a=BD(JD(Phb((yFd(),xFd),_ve),547)?Phb(xFd,_ve):new AZd,547);sZd=true;yZd(a);zZd(a);Rhb((JFd(),IFd),a,new EZd);Shb(xFd,_ve,a);return a} +function v2d(a,b){var c,d,e,f;a.j=-1;if(oid(a.e)){c=a.i;f=a.i!=0;lud(a,b);d=new pSd(a.e,3,a.c,null,b,c,f);e=b.Qk(a.e,a.c,null);e=h3d(a,b,e);if(!e){Uhd(a.e,d)}else{e.Ei(d);e.Fi()}}else{lud(a,b);e=b.Qk(a.e,a.c,null);!!e&&e.Fi()}} +function rA(a,b){var c,d,e;e=0;d=b[0];if(d>=a.length){return -1}c=(BCb(d,a.length),a.charCodeAt(d));while(c>=48&&c<=57){e=e*10+(c-48);++d;if(d>=a.length){break}c=(BCb(d,a.length),a.charCodeAt(d))}d>b[0]?(b[0]=d):(e=-1);return e} +function vMb(a){var b,c,d,e,f;e=BD(a.a,19).a;f=BD(a.b,19).a;c=e;d=f;b=$wnd.Math.max($wnd.Math.abs(e),$wnd.Math.abs(f));if(e<=0&&e==f){c=0;d=f-1}else{if(e==-b&&f!=b){c=f;d=e;f>=0&&++c}else{c=-f;d=e}}return new vgd(meb(c),meb(d))} +function fNb(a,b,c,d){var e,f,g,h,i,j;for(e=0;e=0&&j>=0&&i=a.i)throw vbb(new qcb(lue+b+mue+a.i));if(c>=a.i)throw vbb(new qcb(nue+c+mue+a.i));d=a.g[c];if(b!=c){b>16);b=d>>16&16;c=16-b;a=a>>b;d=a-256;b=d>>16&8;c+=b;a<<=b;d=a-Rje;b=d>>16&4;c+=b;a<<=b;d=a-oie;b=d>>16&2;c+=b;a<<=b;d=a>>14;b=d&~(d>>1);return c+2-b}} +function $Pb(a){QPb();var b,c,d,e;PPb=new Rkb;OPb=new Lqb;NPb=new Rkb;b=(!a.a&&(a.a=new cUd(E2,a,10,11)),a.a);SPb(b);for(e=new Fyd(b);e.e!=e.i.gc();){d=BD(Dyd(e),33);if(Jkb(PPb,d,0)==-1){c=new Rkb;Ekb(NPb,c);TPb(d,c)}}return NPb} +function BQb(a,b,c){var d,e,f,g;a.a=c.b.d;if(JD(b,352)){e=itd(BD(b,79),false,false);f=ofd(e);d=new FQb(a);reb(f,d);ifd(f,e);b.We((Y9c(),Q8c))!=null&&reb(BD(b.We(Q8c),74),d)}else{g=BD(b,470);g.Hg(g.Dg()+a.a.a);g.Ig(g.Eg()+a.a.b)}} +function _5b(a,b){var c,d,e,f,g,h,i,j;j=Edb(ED(vNb(b,(Nyc(),zyc))));i=a[0].n.a+a[0].o.a+a[0].d.c+j;for(h=1;h=0){return c}h=U6c(c7c(new f7c(g.c+g.b/2,g.d+g.a/2),new f7c(f.c+f.b/2,f.d+f.a/2)));return -(xOb(f,g)-1)*h} +function ufd(a,b,c){var d;MAb(new YAb(null,(!c.a&&(c.a=new cUd(A2,c,6,6)),new Kub(c.a,16))),new Mfd(a,b));MAb(new YAb(null,(!c.n&&(c.n=new cUd(D2,c,1,7)),new Kub(c.n,16))),new Ofd(a,b));d=BD(hkd(c,(Y9c(),Q8c)),74);!!d&&p7c(d,a,b)} +function sid(a,b,c){var d,e,f;f=e1d((O6d(),M6d),a.Tg(),b);if(f){Q6d();BD(f,66).Oj()||(f=_1d(q1d(M6d,f)));e=(d=a.Yg(f),BD(d>=0?a._g(d,true,true):sid(a,f,true),153));return BD(e,215).hl(b,c)}else{throw vbb(new Wdb(ite+b.ne()+lte))}} +function wAd(a,b,c,d){var e,f,g,h,i;e=a.d[b];if(e){f=e.g;i=e.i;if(d!=null){for(h=0;h=c){d=b;j=(i.c+i.a)/2;g=j-c;if(i.c<=j-c){e=new bPc(i.c,g);Dkb(a,d++,e)}h=j+c;if(h<=i.a){f=new bPc(h,i.a);wCb(d,a.c.length);aCb(a.c,d,f)}}} +function u0d(a){var b;if(!a.c&&a.g==null){a.d=a.si(a.f);wtd(a,a.d);b=a.d}else{if(a.g==null){return true}else if(a.i==0){return false}else{b=BD(a.g[a.i-1],47)}}if(b==a.b&&null.km>=null.jm()){Vud(a);return u0d(a)}else{return b.Ob()}} +function KTb(a,b,c){var d,e,f,g,h;h=c;!h&&(h=Ydd(new Zdd,0));Odd(h,Vme,1);aUb(a.c,b);g=EYb(a.a,b);if(g.gc()==1){MTb(BD(g.Xb(0),37),h)}else{f=1/g.gc();for(e=g.Kc();e.Ob();){d=BD(e.Pb(),37);MTb(d,Udd(h,f))}}CYb(a.a,g,b);NTb(b);Qdd(h)} +function qYb(a){this.a=a;if(a.c.i.k==(j0b(),e0b)){this.c=a.c;this.d=BD(vNb(a.c.i,(wtc(),Hsc)),61)}else if(a.d.i.k==e0b){this.c=a.d;this.d=BD(vNb(a.d.i,(wtc(),Hsc)),61)}else{throw vbb(new Wdb('Edge '+a+' is not an external edge.'))}} +function oQd(a,b){var c,d,e;e=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,e,a.b));if(!b){pnd(a,null);qQd(a,0);pQd(a,null)}else if(b!=a){pnd(a,b.zb);qQd(a,b.d);c=(d=b.c,d==null?b.zb:d);pQd(a,c==null||dfb(c,b.zb)?null:c)}} +function NRd(a){var b,c;if(a.f){while(a.n=g)throw vbb(new Cyd(b,g));e=c[b];if(g==1){d=null}else{d=KC($3,hve,415,g-1,0,1);$fb(c,0,d,0,b);f=g-b-1;f>0&&$fb(c,b+1,d,b,f)}b0d(a,d);a0d(a,b,e);return e} +function m8d(){m8d=ccb;k8d=BD(qud(ZKd((r8d(),q8d).qb),6),34);h8d=BD(qud(ZKd(q8d.qb),3),34);i8d=BD(qud(ZKd(q8d.qb),4),34);j8d=BD(qud(ZKd(q8d.qb),5),18);XId(k8d);XId(h8d);XId(i8d);XId(j8d);l8d=new amb(OC(GC(t5,1),Mve,170,0,[k8d,h8d]))} +function AJb(a,b){var c;this.d=new H_b;this.b=b;this.e=new g7c(b.qf());c=a.u.Hc((rcd(),ocd));a.u.Hc(ncd)?a.D?(this.a=c&&!b.If()):(this.a=true):a.u.Hc(pcd)?c?(this.a=!(b.zf().Kc().Ob()||b.Bf().Kc().Ob())):(this.a=false):(this.a=false)} +function IKb(a,b){var c,d,e,f;c=a.o.a;for(f=BD(BD(Qc(a.r,b),21),84).Kc();f.Ob();){e=BD(f.Pb(),111);e.e.a=(d=e.b,d.Xe((Y9c(),s9c))?d.Hf()==(Ucd(),Tcd)?-d.rf().a-Edb(ED(d.We(s9c))):c+Edb(ED(d.We(s9c))):d.Hf()==(Ucd(),Tcd)?-d.rf().a:c)}} +function Q1b(a,b){var c,d,e,f;c=BD(vNb(a,(Nyc(),Lwc)),103);f=BD(hkd(b,$xc),61);e=BD(vNb(a,Vxc),98);if(e!=(dcd(),bcd)&&e!=ccd){if(f==(Ucd(),Scd)){f=lfd(b,c);f==Scd&&(f=Zcd(c))}}else{d=M1b(b);d>0?(f=Zcd(c)):(f=Wcd(Zcd(c)))}jkd(b,$xc,f)} +function olc(a,b){var c,d,e,f,g;g=a.j;b.a!=b.b&&Okb(g,new Ulc);e=g.c.length/2|0;for(d=0;d0&&WGc(a,c,b);return f}else if(d.a!=null){WGc(a,b,c);return -1}else if(e.a!=null){WGc(a,c,b);return 1}return 0} +function swd(a,b){var c,d,e,f;if(a.ej()){c=a.Vi();f=a.fj();++a.j;a.Hi(c,a.oi(c,b));d=a.Zi(3,null,b,c,f);if(a.bj()){e=a.cj(b,null);if(!e){a.$i(d)}else{e.Ei(d);e.Fi()}}else{a.$i(d)}}else{Bvd(a,b);if(a.bj()){e=a.cj(b,null);!!e&&e.Fi()}}} +function D2d(a,b){var c,d,e,f,g;g=S6d(a.e.Tg(),b);e=new yud;c=BD(a.g,119);for(f=a.i;--f>=0;){d=c[f];g.rl(d.ak())&&wtd(e,d)}!Yxd(a,e)&&oid(a.e)&&GLd(a,b.$j()?H2d(a,6,b,(mmb(),jmb),null,-1,false):H2d(a,b.Kj()?2:1,b,null,null,-1,false))} +function Dhb(){Dhb=ccb;var a,b;Bhb=KC(cJ,nie,91,32,0,1);Chb=KC(cJ,nie,91,32,0,1);a=1;for(b=0;b<=18;b++){Bhb[b]=ghb(a);Chb[b]=ghb(Nbb(a,b));a=Ibb(a,5)}for(;bg){return false}}if(b.q){d=b.C;g=d.c.c.a-d.o.a/2;e=d.n.a-c;if(e>g){return false}}return true} +function wcc(a,b){var c;Odd(b,'Partition preprocessing',1);c=BD(GAb(JAb(LAb(JAb(new YAb(null,new Kub(a.a,16)),new Acc),new Ccc),new Ecc),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);MAb(c.Oc(),new Gcc);Qdd(b)} +function DMc(a){wMc();var b,c,d,e,f,g,h;c=new $rb;for(e=new olb(a.e.b);e.a1?(a.e*=Edb(a.a)):(a.f/=Edb(a.a));DOb(a);EOb(a);AOb(a);yNb(a.b,(CPb(),uPb),a.g)} +function Y5b(a,b,c){var d,e,f,g,h,i;d=0;i=c;if(!b){d=c*(a.c.length-1);i*=-1}for(f=new olb(a);f.a=0){if(!b){b=new Ifb;d>0&&Efb(b,a.substr(0,d))}b.a+='\\';Afb(b,c&aje)}else !!b&&Afb(b,c&aje)}return b?b.a:a} +function l5c(a){var b;if(!a.a){throw vbb(new Zdb('IDataType class expected for layout option '+a.f))}b=gvd(a.a);if(b==null){throw vbb(new Zdb("Couldn't create new instance of property '"+a.f+"'. "+ise+(fdb(Y3),Y3.k)+jse))}return BD(b,414)} +function aid(a){var b,c,d,e,f;f=a.eh();if(f){if(f.kh()){e=xid(a,f);if(e!=f){c=a.Vg();d=(b=a.Vg(),b>=0?a.Qg(null):a.eh().ih(a,-1-b,null,null));a.Rg(BD(e,49),c);!!d&&d.Fi();a.Lg()&&a.Mg()&&c>-1&&Uhd(a,new nSd(a,9,c,f,e));return e}}}return f} +function nTb(a){var b,c,d,e,f,g,h,i;g=0;f=a.f.e;for(d=0;d>5;if(e>=a.d){return a.e<0}c=a.a[e];b=1<<(b&31);if(a.e<0){d=Mgb(a);if(e>16)),15).Xc(f);if(h0){!(fad(a.a.c)&&b.n.d)&&!(gad(a.a.c)&&b.n.b)&&(b.g.d+=$wnd.Math.max(0,d/2-0.5));!(fad(a.a.c)&&b.n.a)&&!(gad(a.a.c)&&b.n.c)&&(b.g.a-=d-1)}}} +function N3b(a){var b,c,d,e,f;e=new Rkb;f=O3b(a,e);b=BD(vNb(a,(wtc(),gtc)),10);if(b){for(d=new olb(b.j);d.a>b;f=a.m>>b|c<<22-b;e=a.l>>b|a.m<<22-b}else if(b<44){g=d?Fje:0;f=c>>b-22;e=a.m>>b-22|c<<44-b}else{g=d?Fje:0;f=d?Eje:0;e=c>>b-44}return TC(e&Eje,f&Eje,g&Fje)} +function XOb(a){var b,c,d,e,f,g;this.c=new Rkb;this.d=a;d=Pje;e=Pje;b=Qje;c=Qje;for(g=Jsb(a,0);g.b!=g.d.c;){f=BD(Xsb(g),8);d=$wnd.Math.min(d,f.a);e=$wnd.Math.min(e,f.b);b=$wnd.Math.max(b,f.a);c=$wnd.Math.max(c,f.b)}this.a=new J6c(d,e,b-d,c-e)} +function Dac(a,b){var c,d,e,f,g,h;for(f=new olb(a.b);f.a0&&JD(b,42)){a.a.qj();j=BD(b,42);i=j.cd();f=i==null?0:tb(i);g=DAd(a.a,f);c=a.a.d[g];if(c){d=BD(c.g,367);k=c.i;for(h=0;h=2){c=e.Kc();b=ED(c.Pb());while(c.Ob()){f=b;b=ED(c.Pb());d=$wnd.Math.min(d,(uCb(b),b)-(uCb(f),f))}}return d} +function gUc(a,b){var c,d,e,f,g;d=new Psb;Gsb(d,b,d.c.b,d.c);do{c=(sCb(d.b!=0),BD(Nsb(d,d.a.a),86));a.b[c.g]=1;for(f=Jsb(c.d,0);f.b!=f.d.c;){e=BD(Xsb(f),188);g=e.c;a.b[g.g]==1?Dsb(a.a,e):a.b[g.g]==2?(a.b[g.g]=1):Gsb(d,g,d.c.b,d.c)}}while(d.b!=0)} +function Ju(a,b){var c,d,e;if(PD(b)===PD(Qb(a))){return true}if(!JD(b,15)){return false}d=BD(b,15);e=a.gc();if(e!=d.gc()){return false}if(JD(d,54)){for(c=0;c0&&(e=c);for(g=new olb(a.f.e);g.a0){b-=1;c-=1}else{if(d>=0&&e<0){b+=1;c+=1}else{if(d>0&&e>=0){b-=1;c+=1}else{b+=1;c-=1}}}}}return new vgd(meb(b),meb(c))} +function PIc(a,b){if(a.cb.c){return 1}else if(a.bb.b){return 1}else if(a.a!=b.a){return tb(a.a)-tb(b.a)}else if(a.d==(UIc(),TIc)&&b.d==SIc){return -1}else if(a.d==SIc&&b.d==TIc){return 1}return 0} +function aNc(a,b){var c,d,e,f,g;f=b.a;f.c.i==b.b?(g=f.d):(g=f.c);f.c.i==b.b?(d=f.c):(d=f.d);e=NLc(a.a,g,d);if(e>0&&e0}else if(e<0&&-e0}return false} +function RZc(a,b,c,d){var e,f,g,h,i,j,k,l;e=(b-a.d)/a.c.c.length;f=0;a.a+=c;a.d=b;for(l=new olb(a.c);l.a>24}return g} +function vdb(a){if(a.pe()){var b=a.c;b.qe()?(a.o='['+b.n):!b.pe()?(a.o='[L'+b.ne()+';'):(a.o='['+b.ne());a.b=b.me()+'[]';a.k=b.oe()+'[]';return}var c=a.j;var d=a.d;d=d.split('/');a.o=ydb('.',[c,ydb('$',d)]);a.b=ydb('.',[c,ydb('.',d)]);a.k=d[d.length-1]} +function qGb(a,b){var c,d,e,f,g;g=null;for(f=new olb(a.e.a);f.a=0;b-=2){for(c=0;c<=b;c+=2){if(a.b[c]>a.b[c+2]||a.b[c]===a.b[c+2]&&a.b[c+1]>a.b[c+3]){d=a.b[c+2];a.b[c+2]=a.b[c];a.b[c]=d;d=a.b[c+3];a.b[c+3]=a.b[c+1];a.b[c+1]=d}}}a.c=true} +function UUb(a,b){var c,d,e,f,g,h,i,j;g=b==1?KUb:JUb;for(f=g.a.ec().Kc();f.Ob();){e=BD(f.Pb(),103);for(i=BD(Qc(a.f.c,e),21).Kc();i.Ob();){h=BD(i.Pb(),46);d=BD(h.b,81);j=BD(h.a,189);c=j.c;switch(e.g){case 2:case 1:d.g.d+=c;break;case 4:case 3:d.g.c+=c;}}}} +function PFc(a,b){var c,d,e,f,g,h,i,j,k;j=-1;k=0;for(g=a,h=0,i=g.length;h0&&++k}}++j}return k} +function Eid(a){var b,c;c=new Wfb(hdb(a.gm));c.a+='@';Qfb(c,(b=tb(a)>>>0,b.toString(16)));if(a.kh()){c.a+=' (eProxyURI: ';Pfb(c,a.qh());if(a.$g()){c.a+=' eClass: ';Pfb(c,a.$g())}c.a+=')'}else if(a.$g()){c.a+=' (eClass: ';Pfb(c,a.$g());c.a+=')'}return c.a} +function TDb(a){var b,c,d,e;if(a.e){throw vbb(new Zdb((fdb(TM),Jke+TM.k+Kke)))}a.d==(ead(),cad)&&SDb(a,aad);for(c=new olb(a.a.a);c.a>24}return c} +function lKb(a,b,c){var d,e,f;e=BD(Mpb(a.i,b),306);if(!e){e=new bIb(a.d,b,c);Npb(a.i,b,e);if(sJb(b)){CHb(a.a,b.c,b.b,e)}else{f=rJb(b);d=BD(Mpb(a.p,f),244);switch(f.g){case 1:case 3:e.j=true;lIb(d,b.b,e);break;case 4:case 2:e.k=true;lIb(d,b.c,e);}}}return e} +function r3d(a,b,c,d){var e,f,g,h,i,j;h=new yud;i=S6d(a.e.Tg(),b);e=BD(a.g,119);Q6d();if(BD(b,66).Oj()){for(g=0;g=0){return e}else{f=1;for(h=new olb(b.j);h.a0&&b.ue((tCb(e-1,a.c.length),BD(a.c[e-1],10)),f)>0){Nkb(a,e,(tCb(e-1,a.c.length),BD(a.c[e-1],10)));--e}tCb(e,a.c.length);a.c[e]=f}c.a=new Lqb;c.b=new Lqb} +function n5c(a,b,c){var d,e,f,g,h,i,j,k;k=(d=BD(b.e&&b.e(),9),new xqb(d,BD(_Bb(d,d.length),9),0));i=mfb(c,'[\\[\\]\\s,]+');for(f=i,g=0,h=f.length;g0){!(fad(a.a.c)&&b.n.d)&&!(gad(a.a.c)&&b.n.b)&&(b.g.d-=$wnd.Math.max(0,d/2-0.5));!(fad(a.a.c)&&b.n.a)&&!(gad(a.a.c)&&b.n.c)&&(b.g.a+=$wnd.Math.max(0,d-1))}}} +function Hac(a,b,c){var d,e;if((a.c-a.b&a.a.length-1)==2){if(b==(Ucd(),Acd)||b==zcd){xac(BD(bkb(a),15),(rbd(),nbd));xac(BD(bkb(a),15),obd)}else{xac(BD(bkb(a),15),(rbd(),obd));xac(BD(bkb(a),15),nbd)}}else{for(e=new xkb(a);e.a!=e.b;){d=BD(vkb(e),15);xac(d,c)}}} +function htd(a,b){var c,d,e,f,g,h,i;e=Nu(new qtd(a));h=new Bib(e,e.c.length);f=Nu(new qtd(b));i=new Bib(f,f.c.length);g=null;while(h.b>0&&i.b>0){c=(sCb(h.b>0),BD(h.a.Xb(h.c=--h.b),33));d=(sCb(i.b>0),BD(i.a.Xb(i.c=--i.b),33));if(c==d){g=c}else{break}}return g} +function Cub(a,b){var c,d,e,f,g,h;f=a.a*kke+a.b*1502;h=a.b*kke+11;c=$wnd.Math.floor(h*lke);f+=c;h-=c*mke;f%=mke;a.a=f;a.b=h;if(b<=24){return $wnd.Math.floor(a.a*wub[b])}else{e=a.a*(1<=2147483648&&(d-=Zje);return d}} +function Zic(a,b,c){var d,e,f,g;if(bjc(a,b)>bjc(a,c)){d=V_b(c,(Ucd(),zcd));a.d=d.dc()?0:B0b(BD(d.Xb(0),11));g=V_b(b,Tcd);a.b=g.dc()?0:B0b(BD(g.Xb(0),11))}else{e=V_b(c,(Ucd(),Tcd));a.d=e.dc()?0:B0b(BD(e.Xb(0),11));f=V_b(b,zcd);a.b=f.dc()?0:B0b(BD(f.Xb(0),11))}} +function l6d(a){var b,c,d,e,f,g,h;if(a){b=a.Hh(_ve);if(b){g=GD(AAd((!b.b&&(b.b=new sId((jGd(),fGd),x6,b)),b.b),'conversionDelegates'));if(g!=null){h=new Rkb;for(d=mfb(g,'\\w+'),e=0,f=d.length;ea.c){break}else if(e.a>=a.s){f<0&&(f=g);h=g}}i=(a.s+a.c)/2;if(f>=0){d=NOc(a,b,f,h);i=$Oc((tCb(d,b.c.length),BD(b.c[d],329)));YOc(b,d,c)}return i} +function lZc(){lZc=ccb;RYc=new Osd((Y9c(),r8c),1.3);VYc=I8c;gZc=new q0b(15);fZc=new Osd(f9c,gZc);jZc=new Osd(T9c,15);SYc=w8c;_Yc=Y8c;aZc=_8c;bZc=b9c;$Yc=W8c;cZc=e9c;hZc=x9c;eZc=(OYc(),KYc);ZYc=IYc;dZc=JYc;iZc=MYc;WYc=HYc;XYc=O8c;YYc=P8c;UYc=GYc;TYc=FYc;kZc=NYc} +function Bnd(a,b,c){var d,e,f,g,h,i,j;g=(f=new RHd,f);PHd(g,(uCb(b),b));j=(!g.b&&(g.b=new sId((jGd(),fGd),x6,g)),g.b);for(i=1;i0&&JPb(this,e)}} +function IQb(a,b,c,d,e,f){var g,h,i;if(!e[b.b]){e[b.b]=true;g=d;!g&&(g=new kRb);Ekb(g.e,b);for(i=f[b.b].Kc();i.Ob();){h=BD(i.Pb(),282);if(h.d==c||h.c==c){continue}h.c!=b&&IQb(a,h.c,b,g,e,f);h.d!=b&&IQb(a,h.d,b,g,e,f);Ekb(g.c,h);Gkb(g.d,h.b)}return g}return null} +function e4b(a){var b,c,d,e,f,g,h;b=0;for(e=new olb(a.e);e.a=2} +function gec(a,b){var c,d,e,f;Odd(b,'Self-Loop pre-processing',1);for(d=new olb(a.a);d.a1){return false}b=qqb(zbd,OC(GC(B1,1),Kie,93,0,[ybd,Bbd]));if(Ox(Cx(b,a))>1){return false}d=qqb(Gbd,OC(GC(B1,1),Kie,93,0,[Fbd,Ebd]));if(Ox(Cx(d,a))>1){return false}return true} +function U0d(a,b){var c,d,e;c=b.Hh(a.a);if(c){e=GD(AAd((!c.b&&(c.b=new sId((jGd(),fGd),x6,c)),c.b),'affiliation'));if(e!=null){d=kfb(e,wfb(35));return d==-1?l1d(a,u1d(a,bKd(b.Hj())),e):d==0?l1d(a,null,e.substr(1)):l1d(a,e.substr(0,d),e.substr(d+1))}}return null} +function ic(b){var c,d,e;try{return b==null?Xhe:fcb(b)}catch(a){a=ubb(a);if(JD(a,102)){c=a;e=hdb(rb(b))+'@'+(d=(Zfb(),kCb(b))>>>0,d.toString(16));tyb(xyb(),($xb(),'Exception during lenientFormat for '+e),c);return '<'+e+' threw '+hdb(c.gm)+'>'}else throw vbb(a)}} +function mzc(a){switch(a.g){case 0:return new xDc;case 1:return new ZCc;case 2:return new DCc;case 3:return new QCc;case 4:return new LDc;case 5:return new iDc;default:throw vbb(new Wdb('No implementation is available for the layerer '+(a.f!=null?a.f:''+a.g)));}} +function AQc(a,b,c){var d,e,f;for(f=new olb(a.t);f.a0){d.b.n-=d.c;d.b.n<=0&&d.b.u>0&&Dsb(b,d.b)}}for(e=new olb(a.i);e.a0){d.a.u-=d.c;d.a.u<=0&&d.a.n>0&&Dsb(c,d.a)}}} +function Vud(a){var b,c,d,e,f;if(a.g==null){a.d=a.si(a.f);wtd(a,a.d);if(a.c){f=a.f;return f}}b=BD(a.g[a.i-1],47);e=b.Pb();a.e=b;c=a.si(e);if(c.Ob()){a.d=c;wtd(a,c)}else{a.d=null;while(!b.Ob()){NC(a.g,--a.i,null);if(a.i==0){break}d=BD(a.g[a.i-1],47);b=d}}return e} +function r2d(a,b){var c,d,e,f,g,h;d=b;e=d.ak();if(T6d(a.e,e)){if(e.hi()&&E2d(a,e,d.dd())){return false}}else{h=S6d(a.e.Tg(),e);c=BD(a.g,119);for(f=0;f1||c>1){return 2}}if(b+c==1){return 2}return 0} +function WQb(a,b,c){var d,e,f,g,h;Odd(c,'ELK Force',1);Ccb(DD(hkd(b,(wSb(),jSb))))||$Cb((d=new _Cb((Pgd(),new bhd(b))),d));h=TQb(b);XQb(h);YQb(a,BD(vNb(h,fSb),424));g=LQb(a.a,h);for(f=g.Kc();f.Ob();){e=BD(f.Pb(),231);tRb(a.b,e,Udd(c,1/g.gc()))}h=KQb(g);SQb(h);Qdd(c)} +function yoc(a,b){var c,d,e,f,g;Odd(b,'Breaking Point Processor',1);xoc(a);if(Ccb(DD(vNb(a,(Nyc(),Jyc))))){for(e=new olb(a.b);e.a=0?a._g(d,true,true):sid(a,f,true),153));BD(e,215).ml(b,c)}else{throw vbb(new Wdb(ite+b.ne()+jte))}} +function ROc(a,b){var c,d,e,f,g;c=new Rkb;e=LAb(new YAb(null,new Kub(a,16)),new iPc);f=LAb(new YAb(null,new Kub(a,16)),new kPc);g=aAb(_zb(OAb(ty(OC(GC(xM,1),Uhe,833,0,[e,f])),new mPc)));for(d=1;d=2*b&&Ekb(c,new bPc(g[d-1]+b,g[d]-b))}return c} +function AXc(a,b,c){Odd(c,'Eades radial',1);c.n&&!!b&&Tdd(c,i6d(b),(pgd(),mgd));a.d=BD(hkd(b,(MUc(),LUc)),33);a.c=Edb(ED(hkd(b,(ZWc(),VWc))));a.e=tXc(BD(hkd(b,WWc),293));a.a=gWc(BD(hkd(b,YWc),426));a.b=jXc(BD(hkd(b,RWc),340));BXc(a);c.n&&!!b&&Tdd(c,i6d(b),(pgd(),mgd))} +function Fqd(a,b,c){var d,e,f,g,h,j,k,l;if(c){f=c.a.length;d=new Yge(f);for(h=(d.b-d.a)*d.c<0?(Xge(),Wge):new she(d);h.Ob();){g=BD(h.Pb(),19);e=Zpd(c,g.a);!!e&&(i=null,j=Uqd(a,(k=(Fhd(),l=new ppd,l),!!b&&npd(k,b),k),e),Lkd(j,_pd(e,Vte)),grd(e,j),hrd(e,j),crd(a,e,j))}}} +function UKd(a){var b,c,d,e,f,g;if(!a.j){g=new HPd;b=KKd;f=b.a.zc(a,b);if(f==null){for(d=new Fyd(_Kd(a));d.e!=d.i.gc();){c=BD(Dyd(d),26);e=UKd(c);ytd(g,e);wtd(g,c)}b.a.Bc(a)!=null}vud(g);a.j=new nNd((BD(qud(ZKd((NFd(),MFd).o),11),18),g.i),g.g);$Kd(a).b&=-33}return a.j} +function O9d(a){var b,c,d,e;if(a==null){return null}else{d=Qge(a,true);e=Nwe.length;if(dfb(d.substr(d.length-e,e),Nwe)){c=d.length;if(c==4){b=(BCb(0,d.length),d.charCodeAt(0));if(b==43){return z9d}else if(b==45){return y9d}}else if(c==3){return z9d}}return new Odb(d)}} +function _C(a){var b,c,d;c=a.l;if((c&c-1)!=0){return -1}d=a.m;if((d&d-1)!=0){return -1}b=a.h;if((b&b-1)!=0){return -1}if(b==0&&d==0&&c==0){return -1}if(b==0&&d==0&&c!=0){return ieb(c)}if(b==0&&d!=0&&c==0){return ieb(d)+22}if(b!=0&&d==0&&c==0){return ieb(b)+44}return -1} +function qbc(a,b){var c,d,e,f,g;Odd(b,'Edge joining',1);c=Ccb(DD(vNb(a,(Nyc(),Byc))));for(e=new olb(a.b);e.a1){for(e=new olb(a.a);e.a0);f.a.Xb(f.c=--f.b);Aib(f,e);sCb(f.b3&&EA(a,0,b-3)}} +function cUb(a){var b,c,d,e;if(PD(vNb(a,(Nyc(),axc)))===PD((hbd(),ebd))){return !a.e&&PD(vNb(a,Cwc))!==PD((Xrc(),Urc))}d=BD(vNb(a,Dwc),292);e=Ccb(DD(vNb(a,Hwc)))||PD(vNb(a,Iwc))===PD((Rpc(),Opc));b=BD(vNb(a,Bwc),19).a;c=a.a.c.length;return !e&&d!=(Xrc(),Urc)&&(b==0||b>c)} +function lkc(a){var b,c;c=0;for(;c0){break}}if(c>0&&c0){break}}if(b>0&&c>16!=6&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+qmd(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?cmd(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,6,d));d=bmd(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,6,b,b))} +function npd(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=9&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+opd(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?lpd(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,9,d));d=kpd(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,9,b,b))} +function Rld(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=3&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+Sld(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?Lld(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,12,d));d=Kld(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,b,b))} +function VId(b){var c,d,e,f,g;e=wId(b);g=b.j;if(g==null&&!!e){return b.$j()?null:e.zj()}else if(JD(e,148)){d=e.Aj();if(d){f=d.Nh();if(f!=b.i){c=BD(e,148);if(c.Ej()){try{b.g=f.Kh(c,g)}catch(a){a=ubb(a);if(JD(a,78)){b.g=null}else throw vbb(a)}}b.i=f}}return b.g}return null} +function wOb(a){var b;b=new Rkb;Ekb(b,new aDb(new f7c(a.c,a.d),new f7c(a.c+a.b,a.d)));Ekb(b,new aDb(new f7c(a.c,a.d),new f7c(a.c,a.d+a.a)));Ekb(b,new aDb(new f7c(a.c+a.b,a.d+a.a),new f7c(a.c+a.b,a.d)));Ekb(b,new aDb(new f7c(a.c+a.b,a.d+a.a),new f7c(a.c,a.d+a.a)));return b} +function IJc(a,b,c,d){var e,f,g;g=LZb(b,c);d.c[d.c.length]=b;if(a.j[g.p]==-1||a.j[g.p]==2||a.a[b.p]){return d}a.j[g.p]=-1;for(f=new Sr(ur(O_b(g).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);if(!(!OZb(e)&&!(!OZb(e)&&e.c.i.c==e.d.i.c))||e==b){continue}return IJc(a,e,g,d)}return d} +function vQb(a,b,c){var d,e,f;for(f=b.a.ec().Kc();f.Ob();){e=BD(f.Pb(),79);d=BD(Ohb(a.b,e),266);!d&&(Xod(jtd(e))==Xod(ltd(e))?uQb(a,e,c):jtd(e)==Xod(ltd(e))?Ohb(a.c,e)==null&&Ohb(a.b,ltd(e))!=null&&xQb(a,e,c,false):Ohb(a.d,e)==null&&Ohb(a.b,jtd(e))!=null&&xQb(a,e,c,true))}} +function jcc(a,b){var c,d,e,f,g,h,i;for(e=a.Kc();e.Ob();){d=BD(e.Pb(),10);h=new H0b;F0b(h,d);G0b(h,(Ucd(),zcd));yNb(h,(wtc(),ftc),(Bcb(),true));for(g=b.Kc();g.Ob();){f=BD(g.Pb(),10);i=new H0b;F0b(i,f);G0b(i,Tcd);yNb(i,ftc,true);c=new UZb;yNb(c,ftc,true);QZb(c,h);RZb(c,i)}}} +function jnc(a,b,c,d){var e,f,g,h;e=hnc(a,b,c);f=hnc(a,c,b);g=BD(Ohb(a.c,b),112);h=BD(Ohb(a.c,c),112);if(ed.b.g&&(f.c[f.c.length]=d,true)}}return f} +function k$c(){k$c=ccb;g$c=new l$c('CANDIDATE_POSITION_LAST_PLACED_RIGHT',0);f$c=new l$c('CANDIDATE_POSITION_LAST_PLACED_BELOW',1);i$c=new l$c('CANDIDATE_POSITION_WHOLE_DRAWING_RIGHT',2);h$c=new l$c('CANDIDATE_POSITION_WHOLE_DRAWING_BELOW',3);j$c=new l$c('WHOLE_DRAWING',4)} +function Xqd(a,b){if(JD(b,239)){return iqd(a,BD(b,33))}else if(JD(b,186)){return jqd(a,BD(b,118))}else if(JD(b,354)){return hqd(a,BD(b,137))}else if(JD(b,352)){return gqd(a,BD(b,79))}else if(b){return null}else{throw vbb(new Wdb(Xte+Fe(new amb(OC(GC(SI,1),Uhe,1,5,[b])))))}} +function aic(a){var b,c,d,e,f,g,h;f=new Psb;for(e=new olb(a.d.a);e.a1){b=nGb((c=new pGb,++a.b,c),a.d);for(h=Jsb(f,0);h.b!=h.d.c;){g=BD(Xsb(h),121);AFb(DFb(CFb(EFb(BFb(new FFb,1),0),b),g))}}} +function $od(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=11&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+_od(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?Uod(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=kid(b,a,10,d));d=Tod(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,11,b,b))} +function uZb(a){var b,c,d,e;for(d=new nib((new eib(a.b)).a);d.b;){c=lib(d);e=BD(c.cd(),11);b=BD(c.dd(),10);yNb(b,(wtc(),$sc),e);yNb(e,gtc,b);yNb(e,Nsc,(Bcb(),true));G0b(e,BD(vNb(b,Hsc),61));vNb(b,Hsc);yNb(e.i,(Nyc(),Vxc),(dcd(),acd));BD(vNb(Q_b(e.i),Ksc),21).Fc((Orc(),Krc))}} +function G4b(a,b,c){var d,e,f,g,h,i;f=0;g=0;if(a.c){for(i=new olb(a.d.i.j);i.af.a){return -1}else if(e.ai){k=a.d;a.d=KC(y4,jve,63,2*i+4,0,1);for(f=0;f=9223372036854775807){return wD(),sD}e=false;if(a<0){e=true;a=-a}d=0;if(a>=Ije){d=QD(a/Ije);a-=d*Ije}c=0;if(a>=Hje){c=QD(a/Hje);a-=c*Hje}b=QD(a);f=TC(b,c,d);e&&ZC(f);return f} +function rKb(a,b){var c,d,e,f;c=!b||!a.u.Hc((rcd(),ncd));f=0;for(e=new olb(a.e.Cf());e.a=-b&&d==b){return new vgd(meb(c-1),meb(d))}return new vgd(meb(c),meb(d-1))} +function W8b(){S8b();return OC(GC(AS,1),Kie,77,0,[Y7b,V7b,Z7b,n8b,G8b,r8b,M8b,w8b,E8b,i8b,A8b,v8b,F8b,e8b,O8b,P7b,z8b,I8b,o8b,H8b,Q8b,C8b,Q7b,D8b,R8b,K8b,P8b,p8b,b8b,q8b,m8b,N8b,T7b,_7b,t8b,S7b,u8b,k8b,f8b,x8b,h8b,W7b,U7b,l8b,g8b,y8b,L8b,R7b,B8b,j8b,s8b,c8b,a8b,J8b,$7b,d8b,X7b])} +function Yic(a,b,c){a.d=0;a.b=0;b.k==(j0b(),i0b)&&c.k==i0b&&BD(vNb(b,(wtc(),$sc)),10)==BD(vNb(c,$sc),10)&&(ajc(b).j==(Ucd(),Acd)?Zic(a,b,c):Zic(a,c,b));b.k==i0b&&c.k==g0b?ajc(b).j==(Ucd(),Acd)?(a.d=1):(a.b=1):c.k==i0b&&b.k==g0b&&(ajc(c).j==(Ucd(),Acd)?(a.b=1):(a.d=1));cjc(a,b,c)} +function esd(a){var b,c,d,e,f,g,h,i,j,k,l;l=hsd(a);b=a.a;i=b!=null;i&&Upd(l,'category',a.a);e=Fhe(new Pib(a.d));g=!e;if(g){j=new wB;cC(l,'knownOptions',j);c=new msd(j);reb(new Pib(a.d),c)}f=Fhe(a.g);h=!f;if(h){k=new wB;cC(l,'supportedFeatures',k);d=new osd(k);reb(a.g,d)}return l} +function ty(a){var b,c,d,e,f,g,h,i,j;d=false;b=336;c=0;f=new Xp(a.length);for(h=a,i=0,j=h.length;i>16!=7&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+Iod(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?Eod(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=BD(b,49).gh(a,1,C2,d));d=Dod(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,7,b,b))} +function NHd(a,b){var c,d;if(b!=a.Cb||a.Db>>16!=3&&!!b){if(p6d(a,b))throw vbb(new Wdb(ste+QHd(a)));d=null;!!a.Cb&&(d=(c=a.Db>>16,c>=0?KHd(a,d):a.Cb.ih(a,-1-c,null,d)));!!b&&(d=BD(b,49).gh(a,0,k5,d));d=JHd(a,b,d);!!d&&d.Fi()}else (a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,3,b,b))} +function Ehb(a,b){Dhb();var c,d,e,f,g,h,i,j,k;if(b.d>a.d){h=a;a=b;b=h}if(b.d<63){return Ihb(a,b)}g=(a.d&-2)<<4;j=Rgb(a,g);k=Rgb(b,g);d=yhb(a,Qgb(j,g));e=yhb(b,Qgb(k,g));i=Ehb(j,k);c=Ehb(d,e);f=Ehb(yhb(j,d),yhb(e,k));f=thb(thb(f,i),c);f=Qgb(f,g);i=Qgb(i,g<<1);return thb(thb(i,f),c)} +function aGc(a,b,c){var d,e,f,g,h;g=CHc(a,c);h=KC(OQ,kne,10,b.length,0,1);d=0;for(f=g.Kc();f.Ob();){e=BD(f.Pb(),11);Ccb(DD(vNb(e,(wtc(),Nsc))))&&(h[d++]=BD(vNb(e,gtc),10))}if(d=0;f+=c?1:-1){g=g|b.c.Sf(i,f,c,d&&!Ccb(DD(vNb(b.j,(wtc(),Jsc))))&&!Ccb(DD(vNb(b.j,(wtc(),mtc)))));g=g|b.q._f(i,f,c);g=g|cGc(a,i[f],c,d)}Qqb(a.c,b);return g} +function o3b(a,b,c){var d,e,f,g,h,i,j,k,l,m;for(k=m_b(a.j),l=0,m=k.length;l1&&(a.a=true);ZNb(BD(c.b,65),P6c(R6c(BD(b.b,65).c),Y6c(c7c(R6c(BD(c.b,65).a),BD(b.b,65).a),e)));D1c(a,b);F1c(a,c)}} +function rVb(a){var b,c,d,e,f,g,h;for(f=new olb(a.a.a);f.a0&&f>0?(g.p=b++):d>0?(g.p=c++):f>0?(g.p=e++):(g.p=c++);}}mmb();Okb(a.j,new fcc)} +function Vec(a){var b,c;c=null;b=BD(Ikb(a.g,0),17);do{c=b.d.i;if(wNb(c,(wtc(),Wsc))){return BD(vNb(c,Wsc),11).i}if(c.k!=(j0b(),h0b)&&Qr(new Sr(ur(U_b(c).a.Kc(),new Sq)))){b=BD(Rr(new Sr(ur(U_b(c).a.Kc(),new Sq))),17)}else if(c.k!=h0b){return null}}while(!!c&&c.k!=(j0b(),h0b));return c} +function Omc(a,b){var c,d,e,f,g,h,i,j,k;h=b.j;g=b.g;i=BD(Ikb(h,h.c.length-1),113);k=(tCb(0,h.c.length),BD(h.c[0],113));j=Kmc(a,g,i,k);for(f=1;fj){i=c;k=e;j=d}}b.a=k;b.c=i} +function sEb(a,b){var c,d;d=Axb(a.b,b.b);if(!d){throw vbb(new Zdb('Invalid hitboxes for scanline constraint calculation.'))}(mEb(b.b,BD(Cxb(a.b,b.b),57))||mEb(b.b,BD(Bxb(a.b,b.b),57)))&&(Zfb(),b.b+' has overlap.');a.a[b.b.f]=BD(Exb(a.b,b.b),57);c=BD(Dxb(a.b,b.b),57);!!c&&(a.a[c.f]=b.b)} +function AFb(a){if(!a.a.d||!a.a.e){throw vbb(new Zdb((fdb(fN),fN.k+' must have a source and target '+(fdb(jN),jN.k)+' specified.')))}if(a.a.d==a.a.e){throw vbb(new Zdb('Network simplex does not support self-loops: '+a.a+' '+a.a.d+' '+a.a.e))}NFb(a.a.d.g,a.a);NFb(a.a.e.b,a.a);return a.a} +function HHc(a,b,c){var d,e,f,g,h,i,j;j=new Hxb(new tIc(a));for(g=OC(GC(aR,1),lne,11,0,[b,c]),h=0,i=g.length;hi-a.b&&hi-a.a&&h0&&++n}}}++m}return n} +function hUc(a,b){var c,d,e,f,g;g=BD(vNb(b,(JTc(),FTc)),425);for(f=Jsb(b.b,0);f.b!=f.d.c;){e=BD(Xsb(f),86);if(a.b[e.g]==0){switch(g.g){case 0:iUc(a,e);break;case 1:gUc(a,e);}a.b[e.g]=2}}for(d=Jsb(a.a,0);d.b!=d.d.c;){c=BD(Xsb(d),188);ze(c.b.d,c,true);ze(c.c.b,c,true)}yNb(b,(mTc(),gTc),a.a)} +function S6d(a,b){Q6d();var c,d,e,f;if(!b){return P6d}else if(b==(Q8d(),N8d)||(b==v8d||b==t8d||b==u8d)&&a!=s8d){return new Z6d(a,b)}else{d=BD(b,677);c=d.pk();if(!c){a2d(q1d((O6d(),M6d),b));c=d.pk()}f=(!c.i&&(c.i=new Lqb),c.i);e=BD(Wd(irb(f.f,a)),1942);!e&&Rhb(f,a,e=new Z6d(a,b));return e}} +function Tbc(a,b){var c,d,e,f,g,h,i,j,k;i=BD(vNb(a,(wtc(),$sc)),11);j=l7c(OC(GC(m1,1),nie,8,0,[i.i.n,i.n,i.a])).a;k=a.i.n.b;c=k_b(a.e);for(e=c,f=0,g=e.length;f0){if(f.a){h=f.b.rf().a;if(c>h){e=(c-h)/2;f.d.b=e;f.d.c=e}}else{f.d.c=a.s+c}}else if(tcd(a.u)){d=sfd(f.b);d.c<0&&(f.d.b=-d.c);d.c+d.b>f.b.rf().a&&(f.d.c=d.c+d.b-f.b.rf().a)}}} +function Eec(a,b){var c,d,e,f;Odd(b,'Semi-Interactive Crossing Minimization Processor',1);c=false;for(e=new olb(a.b);e.a=0){if(b==c){return new vgd(meb(-b-1),meb(-b-1))}if(b==-c){return new vgd(meb(-b),meb(c+1))}}if($wnd.Math.abs(b)>$wnd.Math.abs(c)){if(b<0){return new vgd(meb(-b),meb(c))}return new vgd(meb(-b),meb(c+1))}return new vgd(meb(b+1),meb(c))} +function q5b(a){var b,c;c=BD(vNb(a,(Nyc(),mxc)),163);b=BD(vNb(a,(wtc(),Osc)),303);if(c==(Ctc(),ytc)){yNb(a,mxc,Btc);yNb(a,Osc,(esc(),dsc))}else if(c==Atc){yNb(a,mxc,Btc);yNb(a,Osc,(esc(),bsc))}else if(b==(esc(),dsc)){yNb(a,mxc,ytc);yNb(a,Osc,csc)}else if(b==bsc){yNb(a,mxc,Atc);yNb(a,Osc,csc)}} +function FNc(){FNc=ccb;DNc=new RNc;zNc=e3c(new j3c,(qUb(),nUb),(S8b(),o8b));CNc=c3c(e3c(new j3c,nUb,C8b),pUb,B8b);ENc=b3c(b3c(g3c(c3c(e3c(new j3c,lUb,M8b),pUb,L8b),oUb),K8b),N8b);ANc=c3c(e3c(e3c(e3c(new j3c,mUb,r8b),oUb,t8b),oUb,u8b),pUb,s8b);BNc=c3c(e3c(e3c(new j3c,oUb,u8b),oUb,_7b),pUb,$7b)} +function hQc(){hQc=ccb;cQc=e3c(c3c(new j3c,(qUb(),pUb),(S8b(),c8b)),nUb,o8b);gQc=b3c(b3c(g3c(c3c(e3c(new j3c,lUb,M8b),pUb,L8b),oUb),K8b),N8b);dQc=c3c(e3c(e3c(e3c(new j3c,mUb,r8b),oUb,t8b),oUb,u8b),pUb,s8b);fQc=e3c(e3c(new j3c,nUb,C8b),pUb,B8b);eQc=c3c(e3c(e3c(new j3c,oUb,u8b),oUb,_7b),pUb,$7b)} +function GNc(a,b,c,d,e){var f,g;if((!OZb(b)&&b.c.i.c==b.d.i.c||!T6c(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])),c))&&!OZb(b)){b.c==e?St(b.a,0,new g7c(c)):Dsb(b.a,new g7c(c));if(d&&!Rqb(a.a,c)){g=BD(vNb(b,(Nyc(),jxc)),74);if(!g){g=new s7c;yNb(b,jxc,g)}f=new g7c(c);Gsb(g,f,g.c.b,g.c);Qqb(a.a,f)}}} +function Qac(a){var b,c;for(c=new Sr(ur(R_b(a).a.Kc(),new Sq));Qr(c);){b=BD(Rr(c),17);if(b.c.i.k!=(j0b(),f0b)){throw vbb(new y2c(Fne+P_b(a)+"' has its layer constraint set to FIRST, but has at least one incoming edge that "+' does not come from a FIRST_SEPARATE node. That must not happen.'))}}} +function vjd(a,b,c){var d,e,f,g,h,i,j;e=aeb(a.Db&254);if(e==0){a.Eb=c}else{if(e==1){h=KC(SI,Uhe,1,2,5,1);f=zjd(a,b);if(f==0){h[0]=c;h[1]=a.Eb}else{h[0]=a.Eb;h[1]=c}}else{h=KC(SI,Uhe,1,e+1,5,1);g=CD(a.Eb);for(d=2,i=0,j=0;d<=128;d<<=1){d==b?(h[j++]=c):(a.Db&d)!=0&&(h[j++]=g[i++])}}a.Eb=h}a.Db|=b} +function ENb(a,b,c){var d,e,f,g;this.b=new Rkb;e=0;d=0;for(g=new olb(a);g.a0){f=BD(Ikb(this.b,0),167);e+=f.o;d+=f.p}e*=2;d*=2;b>1?(e=QD($wnd.Math.ceil(e*b))):(d=QD($wnd.Math.ceil(d/b)));this.a=new pNb(e,d)} +function Igc(a,b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r;k=d;if(b.j&&b.o){n=BD(Ohb(a.f,b.A),57);p=n.d.c+n.d.b;--k}else{p=b.a.c+b.a.b}l=e;if(c.q&&c.o){n=BD(Ohb(a.f,c.C),57);j=n.d.c;++l}else{j=c.a.c}q=j-p;i=$wnd.Math.max(2,l-k);h=q/i;o=p+h;for(m=k;m=0;g+=e?1:-1){h=b[g];i=d==(Ucd(),zcd)?e?V_b(h,d):Su(V_b(h,d)):e?Su(V_b(h,d)):V_b(h,d);f&&(a.c[h.p]=i.gc());for(l=i.Kc();l.Ob();){k=BD(l.Pb(),11);a.d[k.p]=j++}Gkb(c,i)}} +function aQc(a,b,c){var d,e,f,g,h,i,j,k;f=Edb(ED(a.b.Kc().Pb()));j=Edb(ED(Pq(b.b)));d=Y6c(R6c(a.a),j-c);e=Y6c(R6c(b.a),c-f);k=P6c(d,e);Y6c(k,1/(j-f));this.a=k;this.b=new Rkb;h=true;g=a.b.Kc();g.Pb();while(g.Ob()){i=Edb(ED(g.Pb()));if(h&&i-c>Oqe){this.b.Fc(c);h=false}this.b.Fc(i)}h&&this.b.Fc(c)} +function vGb(a){var b,c,d,e;yGb(a,a.n);if(a.d.c.length>0){Blb(a.c);while(GGb(a,BD(mlb(new olb(a.e.a)),121))>5;b&=31;if(d>=a.d){return a.e<0?(Hgb(),Bgb):(Hgb(),Ggb)}f=a.d-d;e=KC(WD,oje,25,f+1,15,1);mhb(e,f,a.a,d,b);if(a.e<0){for(c=0;c0&&a.a[c]<<32-b!=0){for(c=0;c=0){return false}else{c=e1d((O6d(),M6d),e,b);if(!c){return true}else{d=c.Zj();return (d>1||d==-1)&&$1d(q1d(M6d,c))!=3}}}}else{return false}} +function R1b(a,b,c,d){var e,f,g,h,i;h=atd(BD(qud((!b.b&&(b.b=new y5d(z2,b,4,7)),b.b),0),82));i=atd(BD(qud((!b.c&&(b.c=new y5d(z2,b,5,8)),b.c),0),82));if(Xod(h)==Xod(i)){return null}if(ntd(i,h)){return null}g=Mld(b);if(g==c){return d}else{f=BD(Ohb(a.a,g),10);if(f){e=f.e;if(e){return e}}}return null} +function Cac(a,b){var c;c=BD(vNb(a,(Nyc(),Rwc)),276);Odd(b,'Label side selection ('+c+')',1);switch(c.g){case 0:Dac(a,(rbd(),nbd));break;case 1:Dac(a,(rbd(),obd));break;case 2:Bac(a,(rbd(),nbd));break;case 3:Bac(a,(rbd(),obd));break;case 4:Eac(a,(rbd(),nbd));break;case 5:Eac(a,(rbd(),obd));}Qdd(b)} +function bGc(a,b,c){var d,e,f,g,h,i;d=RFc(c,a.length);g=a[d];if(g[0].k!=(j0b(),e0b)){return}f=SFc(c,g.length);i=b.j;for(e=0;e0){c[0]+=a.d;g-=c[0]}if(c[2]>0){c[2]+=a.d;g-=c[2]}f=$wnd.Math.max(0,g);c[1]=$wnd.Math.max(c[1],g);vHb(a,eHb,e.c+d.b+c[0]-(c[1]-g)/2,c);if(b==eHb){a.c.b=f;a.c.c=e.c+d.b+(f-g)/2}} +function AYb(){this.c=KC(UD,Vje,25,(Ucd(),OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd])).length,15,1);this.b=KC(UD,Vje,25,OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd]).length,15,1);this.a=KC(UD,Vje,25,OC(GC(F1,1),bne,61,0,[Scd,Acd,zcd,Rcd,Tcd]).length,15,1);zlb(this.c,Pje);zlb(this.b,Qje);zlb(this.a,Qje)} +function Ufe(a,b,c){var d,e,f,g;if(b<=c){e=b;f=c}else{e=c;f=b}d=0;if(a.b==null){a.b=KC(WD,oje,25,2,15,1);a.b[0]=e;a.b[1]=f;a.c=true}else{d=a.b.length;if(a.b[d-1]+1==e){a.b[d-1]=f;return}g=KC(WD,oje,25,d+2,15,1);$fb(a.b,0,g,0,d);a.b=g;a.b[d-1]>=e&&(a.c=false,a.a=false);a.b[d++]=e;a.b[d]=f;a.c||Yfe(a)}} +function inc(a,b,c){var d,e,f,g,h,i,j;j=b.d;a.a=new Skb(j.c.length);a.c=new Lqb;for(h=new olb(j);h.a=0?a._g(j,false,true):sid(a,c,false),58));n:for(f=l.Kc();f.Ob();){e=BD(f.Pb(),56);for(k=0;k1){Xxd(e,e.i-1)}}return d}} +function Z2b(a,b){var c,d,e,f,g,h,i;Odd(b,'Comment post-processing',1);for(f=new olb(a.b);f.aa.d[g.p]){c+=zHc(a.b,f);Wjb(a.a,meb(f))}}while(!akb(a.a)){xHc(a.b,BD(fkb(a.a),19).a)}}return c} +function o2c(a,b,c){var d,e,f,g;f=(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a).i;for(e=new Fyd((!b.a&&(b.a=new cUd(E2,b,10,11)),b.a));e.e!=e.i.gc();){d=BD(Dyd(e),33);(!d.a&&(d.a=new cUd(E2,d,10,11)),d.a).i==0||(f+=o2c(a,d,false))}if(c){g=Xod(b);while(g){f+=(!g.a&&(g.a=new cUd(E2,g,10,11)),g.a).i;g=Xod(g)}}return f} +function Xxd(a,b){var c,d,e,f;if(a.ej()){d=null;e=a.fj();a.ij()&&(d=a.kj(a.pi(b),null));c=a.Zi(4,f=tud(a,b),null,b,e);if(a.bj()&&f!=null){d=a.dj(f,d);if(!d){a.$i(c)}else{d.Ei(c);d.Fi()}}else{if(!d){a.$i(c)}else{d.Ei(c);d.Fi()}}return f}else{f=tud(a,b);if(a.bj()&&f!=null){d=a.dj(f,null);!!d&&d.Fi()}return f}} +function UKb(a){var b,c,d,e,f,g,h,i,j,k;j=a.a;b=new Tqb;i=0;for(d=new olb(a.d);d.ah.d&&(k=h.d+h.a+j)}}c.c.d=k;b.a.zc(c,b);i=$wnd.Math.max(i,c.c.d+c.c.a)}return i} +function Orc(){Orc=ccb;Frc=new Prc('COMMENTS',0);Hrc=new Prc('EXTERNAL_PORTS',1);Irc=new Prc('HYPEREDGES',2);Jrc=new Prc('HYPERNODES',3);Krc=new Prc('NON_FREE_PORTS',4);Lrc=new Prc('NORTH_SOUTH_PORTS',5);Nrc=new Prc(Wne,6);Erc=new Prc('CENTER_LABELS',7);Grc=new Prc('END_LABELS',8);Mrc=new Prc('PARTITIONS',9)} +function gVc(a){var b,c,d,e,f;e=new Rkb;b=new Vqb((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));for(d=new Sr(ur(_sd(a).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),79);if(!JD(qud((!c.b&&(c.b=new y5d(z2,c,4,7)),c.b),0),186)){f=atd(BD(qud((!c.c&&(c.c=new y5d(z2,c,5,8)),c.c),0),82));b.a._b(f)||(e.c[e.c.length]=f,true)}}return e} +function fVc(a){var b,c,d,e,f,g;f=new Tqb;b=new Vqb((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));for(e=new Sr(ur(_sd(a).a.Kc(),new Sq));Qr(e);){d=BD(Rr(e),79);if(!JD(qud((!d.b&&(d.b=new y5d(z2,d,4,7)),d.b),0),186)){g=atd(BD(qud((!d.c&&(d.c=new y5d(z2,d,5,8)),d.c),0),82));b.a._b(g)||(c=f.a.zc(g,f),c==null)}}return f} +function zA(a,b,c,d,e){if(d<0){d=oA(a,e,OC(GC(ZI,1),nie,2,6,[bje,cje,dje,eje,fje,gje,hje,ije,jje,kje,lje,mje]),b);d<0&&(d=oA(a,e,OC(GC(ZI,1),nie,2,6,['Jan','Feb','Mar','Apr',fje,'Jun','Jul','Aug','Sep','Oct','Nov','Dec']),b));if(d<0){return false}c.k=d;return true}else if(d>0){c.k=d-1;return true}return false} +function BA(a,b,c,d,e){if(d<0){d=oA(a,e,OC(GC(ZI,1),nie,2,6,[bje,cje,dje,eje,fje,gje,hje,ije,jje,kje,lje,mje]),b);d<0&&(d=oA(a,e,OC(GC(ZI,1),nie,2,6,['Jan','Feb','Mar','Apr',fje,'Jun','Jul','Aug','Sep','Oct','Nov','Dec']),b));if(d<0){return false}c.k=d;return true}else if(d>0){c.k=d-1;return true}return false} +function DA(a,b,c,d,e,f){var g,h,i,j;h=32;if(d<0){if(b[0]>=a.length){return false}h=bfb(a,b[0]);if(h!=43&&h!=45){return false}++b[0];d=rA(a,b);if(d<0){return false}h==45&&(d=-d)}if(h==32&&b[0]-c==2&&e.b==2){i=new eB;j=i.q.getFullYear()-nje+nje-80;g=j%100;f.a=d==g;d+=(j/100|0)*100+(d=j&&(i=d)}!!i&&(k=$wnd.Math.max(k,i.a.o.a));if(k>m){l=j;m=k}}return l} +function ode(a,b,c){var d,e,f;a.e=c;a.d=0;a.b=0;a.f=1;a.i=b;(a.e&16)==16&&(a.i=Xee(a.i));a.j=a.i.length;nde(a);f=rde(a);if(a.d!=a.j)throw vbb(new mde(tvd((h0d(),sue))));if(a.g){for(d=0;dvre?Okb(i,a.b):d<=vre&&d>wre?Okb(i,a.d):d<=wre&&d>xre?Okb(i,a.c):d<=xre&&Okb(i,a.a);f=ZXc(a,i,f)}return e} +function Hgb(){Hgb=ccb;var a;Cgb=new Ugb(1,1);Egb=new Ugb(1,10);Ggb=new Ugb(0,0);Bgb=new Ugb(-1,1);Dgb=OC(GC(cJ,1),nie,91,0,[Ggb,Cgb,new Ugb(1,2),new Ugb(1,3),new Ugb(1,4),new Ugb(1,5),new Ugb(1,6),new Ugb(1,7),new Ugb(1,8),new Ugb(1,9),Egb]);Fgb=KC(cJ,nie,91,32,0,1);for(a=0;a1;if(h){d=new f7c(e,c.b);Dsb(b.a,d)}n7c(b.a,OC(GC(m1,1),nie,8,0,[m,l]))} +function jdd(a){r4c(a,new E3c(P3c(M3c(O3c(N3c(new R3c,Rse),'ELK Randomizer'),'Distributes the nodes randomly on the plane, leading to very obfuscating layouts. Can be useful to demonstrate the power of "real" layout algorithms.'),new mdd)));p4c(a,Rse,ame,fdd);p4c(a,Rse,wme,15);p4c(a,Rse,yme,meb(0));p4c(a,Rse,_le,tme)} +function hde(){hde=ccb;var a,b,c,d,e,f;fde=KC(SD,wte,25,255,15,1);gde=KC(TD,$ie,25,16,15,1);for(b=0;b<255;b++){fde[b]=-1}for(c=57;c>=48;c--){fde[c]=c-48<<24>>24}for(d=70;d>=65;d--){fde[d]=d-65+10<<24>>24}for(e=102;e>=97;e--){fde[e]=e-97+10<<24>>24}for(f=0;f<10;f++)gde[f]=48+f&aje;for(a=10;a<=15;a++)gde[a]=65+a-10&aje} +function BVc(a,b,c){var d,e,f,g,h,i,j,k;h=b.i-a.g/2;i=c.i-a.g/2;j=b.j-a.g/2;k=c.j-a.g/2;f=b.g+a.g/2;g=c.g+a.g/2;d=b.f+a.g/2;e=c.f+a.g/2;if(h>19!=0){return '-'+qD(hD(a))}c=a;d='';while(!(c.l==0&&c.m==0&&c.h==0)){e=RC(Jje);c=UC(c,e,true);b=''+pD(QC);if(!(c.l==0&&c.m==0&&c.h==0)){f=9-b.length;for(;f>0;f--){b='0'+b}}d=b+d}return d} +function xrb(){if(!Object.create||!Object.getOwnPropertyNames){return false}var a='__proto__';var b=Object.create(null);if(b[a]!==undefined){return false}var c=Object.getOwnPropertyNames(b);if(c.length!=0){return false}b[a]=42;if(b[a]!==42){return false}if(Object.getOwnPropertyNames(b).length==0){return false}return true} +function Pgc(a){var b,c,d,e,f,g,h;b=false;c=0;for(e=new olb(a.d.b);e.a=a.a){return -1}if(!F6b(b,c)){return -1}if(Qq(BD(d.Kb(b),20))){return 1}e=0;for(g=BD(d.Kb(b),20).Kc();g.Ob();){f=BD(g.Pb(),17);i=f.c.i==b?f.d.i:f.c.i;h=G6b(a,i,c,d);if(h==-1){return -1}e=$wnd.Math.max(e,h);if(e>a.c-1){return -1}}return e+1} +function Btd(a,b){var c,d,e,f,g,h;if(PD(b)===PD(a)){return true}if(!JD(b,15)){return false}d=BD(b,15);h=a.gc();if(d.gc()!=h){return false}g=d.Kc();if(a.ni()){for(c=0;c0){a.qj();if(b!=null){for(f=0;f>24}case 97:case 98:case 99:case 100:case 101:case 102:{return a-97+10<<24>>24}case 65:case 66:case 67:case 68:case 69:case 70:{return a-65+10<<24>>24}default:{throw vbb(new Oeb('Invalid hexadecimal'))}}} +function AUc(a,b,c){var d,e,f,g;Odd(c,'Processor order nodes',2);a.a=Edb(ED(vNb(b,(JTc(),HTc))));e=new Psb;for(g=Jsb(b.b,0);g.b!=g.d.c;){f=BD(Xsb(g),86);Ccb(DD(vNb(f,(mTc(),jTc))))&&(Gsb(e,f,e.c.b,e.c),true)}d=(sCb(e.b!=0),BD(e.a.a.c,86));yUc(a,d);!c.b&&Rdd(c,1);BUc(a,d,0-Edb(ED(vNb(d,(mTc(),bTc))))/2,0);!c.b&&Rdd(c,1);Qdd(c)} +function rFb(){rFb=ccb;qFb=new sFb('SPIRAL',0);lFb=new sFb('LINE_BY_LINE',1);mFb=new sFb('MANHATTAN',2);kFb=new sFb('JITTER',3);oFb=new sFb('QUADRANTS_LINE_BY_LINE',4);pFb=new sFb('QUADRANTS_MANHATTAN',5);nFb=new sFb('QUADRANTS_JITTER',6);jFb=new sFb('COMBINE_LINE_BY_LINE_MANHATTAN',7);iFb=new sFb('COMBINE_JITTER_MANHATTAN',8)} +function roc(a,b,c,d){var e,f,g,h,i,j;i=woc(a,c);j=woc(b,c);e=false;while(!!i&&!!j){if(d||uoc(i,j,c)){g=woc(i,c);h=woc(j,c);zoc(b);zoc(a);f=i.c;sbc(i,false);sbc(j,false);if(c){Z_b(b,j.p,f);b.p=j.p;Z_b(a,i.p+1,f);a.p=i.p}else{Z_b(a,i.p,f);a.p=i.p;Z_b(b,j.p+1,f);b.p=j.p}$_b(i,null);$_b(j,null);i=g;j=h;e=true}else{break}}return e} +function VDc(a,b,c,d){var e,f,g,h,i;e=false;f=false;for(h=new olb(d.j);h.a=b.length){throw vbb(new qcb('Greedy SwitchDecider: Free layer not in graph.'))}this.c=b[a];this.e=new dIc(d);THc(this.e,this.c,(Ucd(),Tcd));this.i=new dIc(d);THc(this.i,this.c,zcd);this.f=new ejc(this.c);this.a=!f&&e.i&&!e.s&&this.c[0].k==(j0b(),e0b);this.a&&hjc(this,a,b.length)} +function hKb(a,b){var c,d,e,f,g,h;f=!a.B.Hc((Idd(),zdd));g=a.B.Hc(Cdd);a.a=new FHb(g,f,a.c);!!a.n&&u_b(a.a.n,a.n);lIb(a.g,(gHb(),eHb),a.a);if(!b){d=new mIb(1,f,a.c);d.n.a=a.k;Npb(a.p,(Ucd(),Acd),d);e=new mIb(1,f,a.c);e.n.d=a.k;Npb(a.p,Rcd,e);h=new mIb(0,f,a.c);h.n.c=a.k;Npb(a.p,Tcd,h);c=new mIb(0,f,a.c);c.n.b=a.k;Npb(a.p,zcd,c)}} +function Vgc(a){var b,c,d;b=BD(vNb(a.d,(Nyc(),Swc)),218);switch(b.g){case 2:c=Ngc(a);break;case 3:c=(d=new Rkb,MAb(JAb(NAb(LAb(LAb(new YAb(null,new Kub(a.d.b,16)),new Shc),new Uhc),new Whc),new ehc),new Yhc(d)),d);break;default:throw vbb(new Zdb('Compaction not supported for '+b+' edges.'));}Ugc(a,c);reb(new Pib(a.g),new Ehc(a))} +function a2c(a,b){var c;c=new zNb;!!b&&tNb(c,BD(Ohb(a.a,C2),94));JD(b,470)&&tNb(c,BD(Ohb(a.a,G2),94));if(JD(b,354)){tNb(c,BD(Ohb(a.a,D2),94));return c}JD(b,82)&&tNb(c,BD(Ohb(a.a,z2),94));if(JD(b,239)){tNb(c,BD(Ohb(a.a,E2),94));return c}if(JD(b,186)){tNb(c,BD(Ohb(a.a,F2),94));return c}JD(b,352)&&tNb(c,BD(Ohb(a.a,B2),94));return c} +function wSb(){wSb=ccb;oSb=new Osd((Y9c(),D9c),meb(1));uSb=new Osd(T9c,80);tSb=new Osd(M9c,5);bSb=new Osd(r8c,tme);pSb=new Osd(E9c,meb(1));sSb=new Osd(H9c,(Bcb(),true));lSb=new q0b(50);kSb=new Osd(f9c,lSb);dSb=O8c;mSb=t9c;cSb=new Osd(B8c,false);jSb=e9c;iSb=b9c;hSb=Y8c;gSb=W8c;nSb=x9c;fSb=(SRb(),LRb);vSb=QRb;eSb=KRb;qSb=NRb;rSb=PRb} +function ZXb(a){var b,c,d,e,f,g,h,i;i=new jYb;for(h=new olb(a.a);h.a0&&b=0){return false}else{b.p=c.b;Ekb(c.e,b)}if(e==(j0b(),g0b)||e==i0b){for(g=new olb(b.j);g.a1||g==-1)&&(f|=16);(e.Bb&ote)!=0&&(f|=64)}(c.Bb&Tje)!=0&&(f|=Dve);f|=zte}else{if(JD(b,457)){f|=512}else{d=b.Bj();!!d&&(d.i&1)!=0&&(f|=256)}}(a.Bb&512)!=0&&(f|=128);return f} +function hc(a,b){var c,d,e,f,g;a=a==null?Xhe:(uCb(a),a);for(e=0;ea.d[h.p]){c+=zHc(a.b,f);Wjb(a.a,meb(f))}}else{++g}}c+=a.b.d*g;while(!akb(a.a)){xHc(a.b,BD(fkb(a.a),19).a)}}return c} +function Y6d(a,b){var c;if(a.f==W6d){c=$1d(q1d((O6d(),M6d),b));return a.e?c==4&&b!=(m8d(),k8d)&&b!=(m8d(),h8d)&&b!=(m8d(),i8d)&&b!=(m8d(),j8d):c==2}if(!!a.d&&(a.d.Hc(b)||a.d.Hc(_1d(q1d((O6d(),M6d),b)))||a.d.Hc(e1d((O6d(),M6d),a.b,b)))){return true}if(a.f){if(x1d((O6d(),a.f),b2d(q1d(M6d,b)))){c=$1d(q1d(M6d,b));return a.e?c==4:c==2}}return false} +function iVc(a,b,c,d){var e,f,g,h,i,j,k,l;g=BD(hkd(c,(Y9c(),C9c)),8);i=g.a;k=g.b+a;e=$wnd.Math.atan2(k,i);e<0&&(e+=dre);e+=b;e>dre&&(e-=dre);h=BD(hkd(d,C9c),8);j=h.a;l=h.b+a;f=$wnd.Math.atan2(l,j);f<0&&(f+=dre);f+=b;f>dre&&(f-=dre);return Iy(),My(1.0E-10),$wnd.Math.abs(e-f)<=1.0E-10||e==f||isNaN(e)&&isNaN(f)?0:ef?1:Ny(isNaN(e),isNaN(f))} +function YDb(a){var b,c,d,e,f,g,h;h=new Lqb;for(d=new olb(a.a.b);d.a=b.o){throw vbb(new rcb)}i=c>>5;h=c&31;g=Nbb(1,Tbb(Nbb(h,1)));f?(b.n[d][i]=Mbb(b.n[d][i],g)):(b.n[d][i]=xbb(b.n[d][i],Lbb(g)));g=Nbb(g,1);e?(b.n[d][i]=Mbb(b.n[d][i],g)):(b.n[d][i]=xbb(b.n[d][i],Lbb(g)))}catch(a){a=ubb(a);if(JD(a,320)){throw vbb(new qcb(Dle+b.o+'*'+b.p+Ele+c+She+d+Fle))}else throw vbb(a)}} +function BUc(a,b,c,d){var e,f,g;if(b){f=Edb(ED(vNb(b,(mTc(),fTc))))+d;g=c+Edb(ED(vNb(b,bTc)))/2;yNb(b,kTc,meb(Tbb(Cbb($wnd.Math.round(f)))));yNb(b,lTc,meb(Tbb(Cbb($wnd.Math.round(g)))));b.d.b==0||BUc(a,BD(pr((e=Jsb((new ZRc(b)).a.d,0),new aSc(e))),86),c+Edb(ED(vNb(b,bTc)))+a.a,d+Edb(ED(vNb(b,cTc))));vNb(b,iTc)!=null&&BUc(a,BD(vNb(b,iTc),86),c,d)}} +function N9b(a,b){var c,d,e,f,g,h,i,j,k,l,m;i=Q_b(b.a);e=Edb(ED(vNb(i,(Nyc(),pyc))))*2;k=Edb(ED(vNb(i,wyc)));j=$wnd.Math.max(e,k);f=KC(UD,Vje,25,b.f-b.c+1,15,1);d=-j;c=0;for(h=b.b.Kc();h.Ob();){g=BD(h.Pb(),10);d+=a.a[g.c.p]+j;f[c++]=d}d+=a.a[b.a.c.p]+j;f[c++]=d;for(m=new olb(b.e);m.a0){d=(!a.n&&(a.n=new cUd(D2,a,1,7)),BD(qud(a.n,0),137)).a;!d||Qfb(Qfb((b.a+=' "',b),d),'"')}}else{Qfb(Qfb((b.a+=' "',b),c),'"')}Qfb(Lfb(Qfb(Lfb(Qfb(Lfb(Qfb(Lfb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a} +function opd(a){var b,c,d;if((a.Db&64)!=0)return fld(a);b=new Wfb(fte);c=a.k;if(!c){!a.n&&(a.n=new cUd(D2,a,1,7));if(a.n.i>0){d=(!a.n&&(a.n=new cUd(D2,a,1,7)),BD(qud(a.n,0),137)).a;!d||Qfb(Qfb((b.a+=' "',b),d),'"')}}else{Qfb(Qfb((b.a+=' "',b),c),'"')}Qfb(Lfb(Qfb(Lfb(Qfb(Lfb(Qfb(Lfb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a} +function h4c(a,b){var c,d,e,f,g,h,i;if(b==null||b.length==0){return null}e=BD(Phb(a.a,b),149);if(!e){for(d=(h=(new $ib(a.b)).a.vc().Kc(),new djb(h));d.a.Ob();){c=(f=BD(d.a.Pb(),42),BD(f.dd(),149));g=c.c;i=b.length;if(dfb(g.substr(g.length-i,i),b)&&(b.length==g.length||bfb(g,g.length-b.length-1)==46)){if(e){return null}e=c}}!!e&&Shb(a.a,b,e)}return e} +function QLb(a,b){var c,d,e,f;c=new VLb;d=BD(GAb(NAb(new YAb(null,new Kub(a.f,16)),c),Ayb(new hzb,new jzb,new Gzb,new Izb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Eyb),Dyb]))),21);e=d.gc();d=BD(GAb(NAb(new YAb(null,new Kub(b.f,16)),c),Ayb(new hzb,new jzb,new Gzb,new Izb,OC(GC(xL,1),Kie,132,0,[Eyb,Dyb]))),21);f=d.gc();if(ee.p){G0b(f,Rcd);if(f.d){h=f.o.b;b=f.a.b;f.a.b=h-b}}else if(f.j==Rcd&&e.p>a.p){G0b(f,Acd);if(f.d){h=f.o.b;b=f.a.b;f.a.b=-(h-b)}}break}}return e} +function NOc(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o;f=c;if(c1;if(h){d=new f7c(e,c.b);Dsb(b.a,d)}n7c(b.a,OC(GC(m1,1),nie,8,0,[m,l]))} +function Nid(a,b,c){var d,e,f,g,h,i;if(!b){return null}else{if(c<=-1){d=XKd(b.Tg(),-1-c);if(JD(d,99)){return BD(d,18)}else{g=BD(b.ah(d),153);for(h=0,i=g.gc();h0){e=i.length;while(e>0&&i[e-1]==''){--e}e=40;g&&FGb(a);wGb(a);vGb(a);c=zGb(a);d=0;while(!!c&&d0&&Dsb(a.f,f)}else{a.c[g]-=j+1;a.c[g]<=0&&a.a[g]>0&&Dsb(a.e,f)}}}}} +function _Kb(a){var b,c,d,e,f,g,h,i,j;h=new Hxb(BD(Qb(new nLb),62));j=Qje;for(c=new olb(a.d);c.a=0&&ic?b:c;j<=l;++j){if(j==c){h=d++}else{f=e[j];k=o.rl(f.ak());j==b&&(i=j==l&&!k?d-1:d);k&&++d}}m=BD(Wxd(a,b,c),72);h!=i&&GLd(a,new ESd(a.e,7,g,meb(h),n.dd(),i));return m}}}else{return BD(sud(a,b,c),72)}return BD(Wxd(a,b,c),72)} +function Qcc(a,b){var c,d,e,f,g,h,i;Odd(b,'Port order processing',1);i=BD(vNb(a,(Nyc(),_xc)),421);for(d=new olb(a.b);d.a=0){h=bD(a,g);if(h){j<22?(i.l|=1<>>1;g.m=k>>>1|(l&1)<<21;g.l=m>>>1|(k&1)<<21;--j}c&&ZC(i);if(f){if(d){QC=hD(a);e&&(QC=nD(QC,(wD(),uD)))}else{QC=TC(a.l,a.m,a.h)}}return i} +function TDc(a,b){var c,d,e,f,g,h,i,j,k,l;j=a.e[b.c.p][b.p]+1;i=b.c.a.c.length+1;for(h=new olb(a.a);h.a0&&(BCb(0,a.length),a.charCodeAt(0)==45||(BCb(0,a.length),a.charCodeAt(0)==43))?1:0;for(d=g;dc){throw vbb(new Oeb(Oje+a+'"'))}return h} +function dnc(a){var b,c,d,e,f,g,h;g=new Psb;for(f=new olb(a.a);f.a1)&&b==1&&BD(a.a[a.b],10).k==(j0b(),f0b)){zac(BD(a.a[a.b],10),(rbd(),nbd))}else if(d&&(!c||(a.c-a.b&a.a.length-1)>1)&&b==1&&BD(a.a[a.c-1&a.a.length-1],10).k==(j0b(),f0b)){zac(BD(a.a[a.c-1&a.a.length-1],10),(rbd(),obd))}else if((a.c-a.b&a.a.length-1)==2){zac(BD(bkb(a),10),(rbd(),nbd));zac(BD(bkb(a),10),obd)}else{wac(a,e)}Yjb(a)} +function pRc(a,b,c){var d,e,f,g,h;f=0;for(e=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));e.e!=e.i.gc();){d=BD(Dyd(e),33);g='';(!d.n&&(d.n=new cUd(D2,d,1,7)),d.n).i==0||(g=BD(qud((!d.n&&(d.n=new cUd(D2,d,1,7)),d.n),0),137).a);h=new XRc(f++,b,g);tNb(h,d);yNb(h,(mTc(),dTc),d);h.e.b=d.j+d.f/2;h.f.a=$wnd.Math.max(d.g,1);h.e.a=d.i+d.g/2;h.f.b=$wnd.Math.max(d.f,1);Dsb(b.b,h);jrb(c.f,d,h)}} +function B2b(a){var b,c,d,e,f;d=BD(vNb(a,(wtc(),$sc)),33);f=BD(hkd(d,(Nyc(),Fxc)),174).Hc((tdd(),sdd));if(!a.e){e=BD(vNb(a,Ksc),21);b=new f7c(a.f.a+a.d.b+a.d.c,a.f.b+a.d.d+a.d.a);if(e.Hc((Orc(),Hrc))){jkd(d,Vxc,(dcd(),$bd));Afd(d,b.a,b.b,false,true)}else{Ccb(DD(hkd(d,Gxc)))||Afd(d,b.a,b.b,true,true)}}f?jkd(d,Fxc,pqb(sdd)):jkd(d,Fxc,(c=BD(gdb(I1),9),new xqb(c,BD(_Bb(c,c.length),9),0)))} +function tA(a,b,c){var d,e,f,g;if(b[0]>=a.length){c.o=0;return true}switch(bfb(a,b[0])){case 43:e=1;break;case 45:e=-1;break;default:c.o=0;return true;}++b[0];f=b[0];g=rA(a,b);if(g==0&&b[0]==f){return false}if(b[0]=0&&h!=c){f=new nSd(a,1,h,g,null);!d?(d=f):d.Ei(f)}if(c>=0){f=new nSd(a,1,c,h==c?g:null,b);!d?(d=f):d.Ei(f)}}return d} +function LEd(a){var b,c,d;if(a.b==null){d=new Hfb;if(a.i!=null){Efb(d,a.i);d.a+=':'}if((a.f&256)!=0){if((a.f&256)!=0&&a.a!=null){YEd(a.i)||(d.a+='//',d);Efb(d,a.a)}if(a.d!=null){d.a+='/';Efb(d,a.d)}(a.f&16)!=0&&(d.a+='/',d);for(b=0,c=a.j.length;bm){return false}l=(i=MZc(d,m,false),i.a);if(k+h+l<=b.b){KZc(c,f-c.s);c.c=true;KZc(d,f-c.s);OZc(d,c.s,c.t+c.d+h);d.k=true;WZc(c.q,d);n=true;if(e){s$c(b,d);d.j=b;if(a.c.length>g){v$c((tCb(g,a.c.length),BD(a.c[g],200)),d);(tCb(g,a.c.length),BD(a.c[g],200)).a.c.length==0&&Kkb(a,g)}}}return n} +function kcc(a,b){var c,d,e,f,g,h;Odd(b,'Partition midprocessing',1);e=new Hp;MAb(JAb(new YAb(null,new Kub(a.a,16)),new occ),new qcc(e));if(e.d==0){return}h=BD(GAb(UAb((f=e.i,new YAb(null,(!f?(e.i=new zf(e,e.c)):f).Nc()))),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);d=h.Kc();c=BD(d.Pb(),19);while(d.Ob()){g=BD(d.Pb(),19);jcc(BD(Qc(e,c),21),BD(Qc(e,g),21));c=g}Qdd(b)} +function DYb(a,b,c){var d,e,f,g,h,i,j,k;if(b.p==0){b.p=1;g=c;if(!g){e=new Rkb;f=(d=BD(gdb(F1),9),new xqb(d,BD(_Bb(d,d.length),9),0));g=new vgd(e,f)}BD(g.a,15).Fc(b);b.k==(j0b(),e0b)&&BD(g.b,21).Fc(BD(vNb(b,(wtc(),Hsc)),61));for(i=new olb(b.j);i.a0){e=BD(a.Ab.g,1934);if(b==null){for(f=0;f1){for(d=new olb(e);d.ac.s&&hh){h=e;k.c=KC(SI,Uhe,1,0,5,1)}e==h&&Ekb(k,new vgd(c.c.i,c))}mmb();Okb(k,a.c);Dkb(a.b,i.p,k)}}} +function MMc(a,b){var c,d,e,f,g,h,i,j,k;for(g=new olb(b.b);g.ah){h=e;k.c=KC(SI,Uhe,1,0,5,1)}e==h&&Ekb(k,new vgd(c.d.i,c))}mmb();Okb(k,a.c);Dkb(a.f,i.p,k)}}} +function Y7c(a){r4c(a,new E3c(P3c(M3c(O3c(N3c(new R3c,qse),'ELK Box'),'Algorithm for packing of unconnected boxes, i.e. graphs without edges.'),new _7c)));p4c(a,qse,ame,U7c);p4c(a,qse,wme,15);p4c(a,qse,vme,meb(0));p4c(a,qse,Jre,Ksd(O7c));p4c(a,qse,Fme,Ksd(Q7c));p4c(a,qse,Eme,Ksd(S7c));p4c(a,qse,_le,pse);p4c(a,qse,Ame,Ksd(P7c));p4c(a,qse,Tme,Ksd(R7c));p4c(a,qse,rse,Ksd(M7c));p4c(a,qse,lqe,Ksd(N7c))} +function W$b(a,b){var c,d,e,f,g,h,i,j,k;e=a.i;g=e.o.a;f=e.o.b;if(g<=0&&f<=0){return Ucd(),Scd}j=a.n.a;k=a.n.b;h=a.o.a;c=a.o.b;switch(b.g){case 2:case 1:if(j<0){return Ucd(),Tcd}else if(j+h>g){return Ucd(),zcd}break;case 4:case 3:if(k<0){return Ucd(),Acd}else if(k+c>f){return Ucd(),Rcd}}i=(j+h/2)/g;d=(k+c/2)/f;return i+d<=1&&i-d<=0?(Ucd(),Tcd):i+d>=1&&i-d>=0?(Ucd(),zcd):d<0.5?(Ucd(),Acd):(Ucd(),Rcd)} +function pJc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;c=false;k=Edb(ED(vNb(b,(Nyc(),vyc))));o=Qie*k;for(e=new olb(b.b);e.ai+o){p=l.g+m.g;m.a=(m.g*m.a+l.g*l.a)/p;m.g=p;l.f=m;c=true}}f=h;l=m}}return c} +function VGb(a,b,c,d,e,f,g){var h,i,j,k,l,m;m=new I6c;for(j=b.Kc();j.Ob();){h=BD(j.Pb(),839);for(l=new olb(h.wf());l.a0){if(h.a){j=h.b.rf().b;if(e>j){if(a.v||h.c.d.c.length==1){g=(e-j)/2;h.d.d=g;h.d.a=g}else{c=BD(Ikb(h.c.d,0),181).rf().b;d=(c-j)/2;h.d.d=$wnd.Math.max(0,d);h.d.a=e-d-j}}}else{h.d.a=a.t+e}}else if(tcd(a.u)){f=sfd(h.b);f.d<0&&(h.d.d=-f.d);f.d+f.a>h.b.rf().b&&(h.d.a=f.d+f.a-h.b.rf().b)}}} +function FC(a,b){var c;switch(HC(a)){case 6:return ND(b);case 7:return LD(b);case 8:return KD(b);case 3:return Array.isArray(b)&&(c=HC(b),!(c>=14&&c<=16));case 11:return b!=null&&typeof b===Nhe;case 12:return b!=null&&(typeof b===Jhe||typeof b==Nhe);case 0:return AD(b,a.__elementTypeId$);case 2:return OD(b)&&!(b.im===gcb);case 1:return OD(b)&&!(b.im===gcb)||AD(b,a.__elementTypeId$);default:return true;}} +function xOb(a,b){var c,d,e,f;d=$wnd.Math.min($wnd.Math.abs(a.c-(b.c+b.b)),$wnd.Math.abs(a.c+a.b-b.c));f=$wnd.Math.min($wnd.Math.abs(a.d-(b.d+b.a)),$wnd.Math.abs(a.d+a.a-b.d));c=$wnd.Math.abs(a.c+a.b/2-(b.c+b.b/2));if(c>a.b/2+b.b/2){return 1}e=$wnd.Math.abs(a.d+a.a/2-(b.d+b.a/2));if(e>a.a/2+b.a/2){return 1}if(c==0&&e==0){return 0}if(c==0){return f/e+1}if(e==0){return d/c+1}return $wnd.Math.min(d/c,f/e)+1} +function mgb(a,b){var c,d,e,f,g,h;e=pgb(a);h=pgb(b);if(e==h){if(a.e==b.e&&a.a<54&&b.a<54){return a.fb.f?1:0}d=a.e-b.e;c=(a.d>0?a.d:$wnd.Math.floor((a.a-1)*Xje)+1)-(b.d>0?b.d:$wnd.Math.floor((b.a-1)*Xje)+1);if(c>d+1){return e}else if(c0&&(g=Ogb(g,Khb(d)));return Igb(f,g)}}else return e0&&a.d!=(yTb(),xTb)&&(h+=g*(d.d.a+a.a[b.b][d.b]*(b.d.a-d.d.a)/c));c>0&&a.d!=(yTb(),vTb)&&(i+=g*(d.d.b+a.a[b.b][d.b]*(b.d.b-d.d.b)/c))}switch(a.d.g){case 1:return new f7c(h/f,b.d.b);case 2:return new f7c(b.d.a,i/f);default:return new f7c(h/f,i/f);}} +function Wcc(a,b){Occ();var c,d,e,f,g;g=BD(vNb(a.i,(Nyc(),Vxc)),98);f=a.j.g-b.j.g;if(f!=0||!(g==(dcd(),Zbd)||g==_bd||g==$bd)){return 0}if(g==(dcd(),Zbd)){c=BD(vNb(a,Wxc),19);d=BD(vNb(b,Wxc),19);if(!!c&&!!d){e=c.a-d.a;if(e!=0){return e}}}switch(a.j.g){case 1:return Kdb(a.n.a,b.n.a);case 2:return Kdb(a.n.b,b.n.b);case 3:return Kdb(b.n.a,a.n.a);case 4:return Kdb(b.n.b,a.n.b);default:throw vbb(new Zdb(ine));}} +function tfd(a){var b,c,d,e,f,g;c=(!a.a&&(a.a=new xMd(y2,a,5)),a.a).i+2;g=new Skb(c);Ekb(g,new f7c(a.j,a.k));MAb(new YAb(null,(!a.a&&(a.a=new xMd(y2,a,5)),new Kub(a.a,16))),new Qfd(g));Ekb(g,new f7c(a.b,a.c));b=1;while(b0){jEb(i,false,(ead(),aad));jEb(i,true,bad)}Hkb(b.g,new $hc(a,c));Rhb(a.g,b,c)} +function Neb(){Neb=ccb;var a;Jeb=OC(GC(WD,1),oje,25,15,[-1,-1,30,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5]);Keb=KC(WD,oje,25,37,15,1);Leb=OC(GC(WD,1),oje,25,15,[-1,-1,63,40,32,28,25,23,21,20,19,19,18,18,17,17,16,16,16,15,15,15,15,14,14,14,14,14,14,13,13,13,13,13,13,13,13]);Meb=KC(XD,Sje,25,37,14,1);for(a=2;a<=36;a++){Keb[a]=QD($wnd.Math.pow(a,Jeb[a]));Meb[a]=Abb(rie,Keb[a])}} +function pfd(a){var b;if((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i!=1){throw vbb(new Wdb(Tse+(!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i))}b=new s7c;!!btd(BD(qud((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b),0),82))&&ye(b,qfd(a,btd(BD(qud((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b),0),82)),false));!!btd(BD(qud((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c),0),82))&&ye(b,qfd(a,btd(BD(qud((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c),0),82)),true));return b} +function _Mc(a,b){var c,d,e,f,g;b.d?(e=a.a.c==(YLc(),XLc)?R_b(b.b):U_b(b.b)):(e=a.a.c==(YLc(),WLc)?R_b(b.b):U_b(b.b));f=false;for(d=new Sr(ur(e.a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),17);g=Ccb(a.a.f[a.a.g[b.b.p].p]);if(!g&&!OZb(c)&&c.c.i.c==c.d.i.c){continue}if(Ccb(a.a.n[a.a.g[b.b.p].p])||Ccb(a.a.n[a.a.g[b.b.p].p])){continue}f=true;if(Rqb(a.b,a.a.g[TMc(c,b.b).p])){b.c=true;b.a=c;return b}}b.c=f;b.a=null;return b} +function bed(a,b,c,d,e){var f,g,h,i,j,k,l;mmb();Okb(a,new Red);h=new Bib(a,0);l=new Rkb;f=0;while(h.bf*2){k=new wed(l);j=red(g)/qed(g);i=fed(k,b,new p0b,c,d,e,j);P6c(X6c(k.e),i);l.c=KC(SI,Uhe,1,0,5,1);f=0;l.c[l.c.length]=k;l.c[l.c.length]=g;f=red(k)*qed(k)+red(g)*qed(g)}else{l.c[l.c.length]=g;f+=red(g)*qed(g)}}return l} +function qwd(a,b,c){var d,e,f,g,h,i,j;d=c.gc();if(d==0){return false}else{if(a.ej()){i=a.fj();zvd(a,b,c);g=d==1?a.Zi(3,null,c.Kc().Pb(),b,i):a.Zi(5,null,c,b,i);if(a.bj()){h=d<100?null:new Ixd(d);f=b+d;for(e=b;e0){for(g=0;g>16==-15&&a.Cb.nh()&&Rwd(new oSd(a.Cb,9,13,c,a.c,HLd(QSd(BD(a.Cb,59)),a)))}else if(JD(a.Cb,88)){if(a.Db>>16==-23&&a.Cb.nh()){b=a.c;JD(b,88)||(b=(jGd(),_Fd));JD(c,88)||(c=(jGd(),_Fd));Rwd(new oSd(a.Cb,9,10,c,b,HLd(VKd(BD(a.Cb,26)),a)))}}}}return a.c} +function f7b(a,b){var c,d,e,f,g,h,i,j,k,l;Odd(b,'Hypernodes processing',1);for(e=new olb(a.b);e.ac);return e} +function XFc(a,b){var c,d,e;d=Cub(a.d,1)!=0;!Ccb(DD(vNb(b.j,(wtc(),Jsc))))&&!Ccb(DD(vNb(b.j,mtc)))||PD(vNb(b.j,(Nyc(),ywc)))===PD((tAc(),rAc))?b.c.Tf(b.e,d):(d=Ccb(DD(vNb(b.j,Jsc))));dGc(a,b,d,true);Ccb(DD(vNb(b.j,mtc)))&&yNb(b.j,mtc,(Bcb(),false));if(Ccb(DD(vNb(b.j,Jsc)))){yNb(b.j,Jsc,(Bcb(),false));yNb(b.j,mtc,true)}c=NFc(a,b);do{$Fc(a);if(c==0){return 0}d=!d;e=c;dGc(a,b,d,false);c=NFc(a,b)}while(e>c);return e} +function uNd(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;if(b==c){return true}else{b=vNd(a,b);c=vNd(a,c);d=JQd(b);if(d){k=JQd(c);if(k!=d){if(!k){return false}else{i=d.Dj();o=k.Dj();return i==o&&i!=null}}else{g=(!b.d&&(b.d=new xMd(j5,b,1)),b.d);f=g.i;m=(!c.d&&(c.d=new xMd(j5,c,1)),c.d);if(f==m.i){for(j=0;j0;h=xFb(b,f);c?OFb(h.b,b):OFb(h.g,b);LFb(h).c.length==1&&(Gsb(d,h,d.c.b,d.c),true);e=new vgd(f,b);Wjb(a.o,e);Lkb(a.e.a,f)}} +function _Nb(a,b){var c,d,e,f,g,h,i;d=$wnd.Math.abs(D6c(a.b).a-D6c(b.b).a);h=$wnd.Math.abs(D6c(a.b).b-D6c(b.b).b);e=0;i=0;c=1;g=1;if(d>a.b.b/2+b.b.b/2){e=$wnd.Math.min($wnd.Math.abs(a.b.c-(b.b.c+b.b.b)),$wnd.Math.abs(a.b.c+a.b.b-b.b.c));c=1-e/d}if(h>a.b.a/2+b.b.a/2){i=$wnd.Math.min($wnd.Math.abs(a.b.d-(b.b.d+b.b.a)),$wnd.Math.abs(a.b.d+a.b.a-b.b.d));g=1-i/h}f=$wnd.Math.min(c,g);return (1-f)*$wnd.Math.sqrt(d*d+h*h)} +function lQc(a){var b,c,d,e;nQc(a,a.e,a.f,(FQc(),DQc),true,a.c,a.i);nQc(a,a.e,a.f,DQc,false,a.c,a.i);nQc(a,a.e,a.f,EQc,true,a.c,a.i);nQc(a,a.e,a.f,EQc,false,a.c,a.i);mQc(a,a.c,a.e,a.f,a.i);d=new Bib(a.i,0);while(d.b=65;c--){$ce[c]=c-65<<24>>24}for(d=122;d>=97;d--){$ce[d]=d-97+26<<24>>24}for(e=57;e>=48;e--){$ce[e]=e-48+52<<24>>24}$ce[43]=62;$ce[47]=63;for(f=0;f<=25;f++)_ce[f]=65+f&aje;for(g=26,i=0;g<=51;++g,i++)_ce[g]=97+i&aje;for(a=52,h=0;a<=61;++a,h++)_ce[a]=48+h&aje;_ce[62]=43;_ce[63]=47} +function FXb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.dc()){return new d7c}j=0;l=0;for(e=a.Kc();e.Ob();){d=BD(e.Pb(),37);f=d.f;j=$wnd.Math.max(j,f.a);l+=f.a*f.b}j=$wnd.Math.max(j,$wnd.Math.sqrt(l)*Edb(ED(vNb(BD(a.Kc().Pb(),37),(Nyc(),owc)))));m=0;n=0;i=0;c=b;for(h=a.Kc();h.Ob();){g=BD(h.Pb(),37);k=g.f;if(m+k.a>j){m=0;n+=i+b;i=0}uXb(g,m,n);c=$wnd.Math.max(c,m+k.a);i=$wnd.Math.max(i,k.b);m+=k.a+b}return new f7c(c+b,n+i+b)} +function mQc(a,b,c,d,e){var f,g,h,i,j,k,l;for(g=new olb(b);g.af){return Ucd(),zcd}break;case 4:case 3:if(i<0){return Ucd(),Acd}else if(i+a.f>e){return Ucd(),Rcd}}g=(h+a.g/2)/f;c=(i+a.f/2)/e;return g+c<=1&&g-c<=0?(Ucd(),Tcd):g+c>=1&&g-c>=0?(Ucd(),zcd):c<0.5?(Ucd(),Acd):(Ucd(),Rcd)} +function vhb(a,b,c,d,e){var f,g;f=wbb(xbb(b[0],Yje),xbb(d[0],Yje));a[0]=Tbb(f);f=Obb(f,32);if(c>=e){for(g=1;g0){e.b[g++]=0;e.b[g++]=f.b[0]-1}for(b=1;b0){pOc(i,i.d-e.d);e.c==(HOc(),FOc)&&nOc(i,i.a-e.d);i.d<=0&&i.i>0&&(Gsb(b,i,b.c.b,b.c),true)}}}for(f=new olb(a.f);f.a0){qOc(h,h.i-e.d);e.c==(HOc(),FOc)&&oOc(h,h.b-e.d);h.i<=0&&h.d>0&&(Gsb(c,h,c.c.b,c.c),true)}}}} +function gSc(a,b,c){var d,e,f,g,h,i,j,k;Odd(c,'Processor compute fanout',1);Uhb(a.b);Uhb(a.a);h=null;f=Jsb(b.b,0);while(!h&&f.b!=f.d.c){j=BD(Xsb(f),86);Ccb(DD(vNb(j,(mTc(),jTc))))&&(h=j)}i=new Psb;Gsb(i,h,i.c.b,i.c);fSc(a,i);for(k=Jsb(b.b,0);k.b!=k.d.c;){j=BD(Xsb(k),86);g=GD(vNb(j,(mTc(),$Sc)));e=Phb(a.b,g)!=null?BD(Phb(a.b,g),19).a:0;yNb(j,ZSc,meb(e));d=1+(Phb(a.a,g)!=null?BD(Phb(a.a,g),19).a:0);yNb(j,XSc,meb(d))}Qdd(c)} +function WPc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o;m=VPc(a,c);for(i=0;i0);d.a.Xb(d.c=--d.b);l>m+i&&uib(d)}for(g=new olb(n);g.a0);d.a.Xb(d.c=--d.b)}}}} +function Jfe(){wfe();var a,b,c,d,e,f;if(gfe)return gfe;a=(++vfe,new $fe(4));Xfe(a,Kfe(vxe,true));Zfe(a,Kfe('M',true));Zfe(a,Kfe('C',true));f=(++vfe,new $fe(4));for(d=0;d<11;d++){Ufe(f,d,d)}b=(++vfe,new $fe(4));Xfe(b,Kfe('M',true));Ufe(b,4448,4607);Ufe(b,65438,65439);e=(++vfe,new Lge(2));Kge(e,a);Kge(e,ffe);c=(++vfe,new Lge(2));c.$l(Bfe(f,Kfe('L',true)));c.$l(b);c=(++vfe,new lge(3,c));c=(++vfe,new rge(e,c));gfe=c;return gfe} +function S3c(a){var b,c;b=GD(hkd(a,(Y9c(),o8c)));if(T3c(b,a)){return}if(!ikd(a,F9c)&&((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a).i!=0||Ccb(DD(hkd(a,M8c))))){if(b==null||ufb(b).length==0){if(!T3c(sne,a)){c=Qfb(Qfb(new Wfb('Unable to load default layout algorithm '),sne),' for unconfigured node ');yfd(a,c);throw vbb(new y2c(c.a))}}else{c=Qfb(Qfb(new Wfb("Layout algorithm '"),b),"' not found for ");yfd(a,c);throw vbb(new y2c(c.a))}}} +function hIb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;c=a.i;b=a.n;if(a.b==0){n=c.c+b.b;m=c.b-b.b-b.c;for(g=a.a,i=0,k=g.length;i0){l-=d[0]+a.c;d[0]+=a.c}d[2]>0&&(l-=d[2]+a.c);d[1]=$wnd.Math.max(d[1],l);mHb(a.a[1],c.c+b.b+d[0]-(d[1]-l)/2,d[1])}for(f=a.a,h=0,j=f.length;h0?(a.n.c.length-1)*a.i:0;for(d=new olb(a.n);d.a1){for(d=Jsb(e,0);d.b!=d.d.c;){c=BD(Xsb(d),231);f=0;for(i=new olb(c.e);i.a0){b[0]+=a.c;l-=b[0]}b[2]>0&&(l-=b[2]+a.c);b[1]=$wnd.Math.max(b[1],l);nHb(a.a[1],d.d+c.d+b[0]-(b[1]-l)/2,b[1])}else{o=d.d+c.d;n=d.a-c.d-c.a;for(g=a.a,i=0,k=g.length;i=0&&f!=c){throw vbb(new Wdb(kue))}}e=0;for(i=0;i0||Jy(e.b.d,a.b.d+a.b.a)==0&&d.b<0||Jy(e.b.d+e.b.a,a.b.d)==0&&d.b>0){h=0;break}}else{h=$wnd.Math.min(h,YNb(a,e,d))}h=$wnd.Math.min(h,ONb(a,f,h,d))}return h} +function ifd(a,b){var c,d,e,f,g,h,i;if(a.b<2){throw vbb(new Wdb('The vector chain must contain at least a source and a target point.'))}e=(sCb(a.b!=0),BD(a.a.a.c,8));nmd(b,e.a,e.b);i=new Oyd((!b.a&&(b.a=new xMd(y2,b,5)),b.a));g=Jsb(a,1);while(g.aEdb(REc(g.g,g.d[0]).a)){sCb(i.b>0);i.a.Xb(i.c=--i.b);Aib(i,g);e=true}else if(!!h.e&&h.e.gc()>0){f=(!h.e&&(h.e=new Rkb),h.e).Mc(b);j=(!h.e&&(h.e=new Rkb),h.e).Mc(c);if(f||j){(!h.e&&(h.e=new Rkb),h.e).Fc(g);++g.c}}}e||(d.c[d.c.length]=g,true)} +function odc(a){var b,c,d;if(fcd(BD(vNb(a,(Nyc(),Vxc)),98))){for(c=new olb(a.j);c.a>>0,'0'+b.toString(16));d='\\x'+qfb(c,c.length-2,c.length)}else if(a>=Tje){c=(b=a>>>0,'0'+b.toString(16));d='\\v'+qfb(c,c.length-6,c.length)}else d=''+String.fromCharCode(a&aje);}return d} +function yhb(a,b){var c,d,e,f,g,h,i,j,k,l;g=a.e;i=b.e;if(i==0){return a}if(g==0){return b.e==0?b:new Vgb(-b.e,b.d,b.a)}f=a.d;h=b.d;if(f+h==2){c=xbb(a.a[0],Yje);d=xbb(b.a[0],Yje);g<0&&(c=Jbb(c));i<0&&(d=Jbb(d));return ghb(Qbb(c,d))}e=f!=h?f>h?1:-1:whb(a.a,b.a,f);if(e==-1){l=-i;k=g==i?zhb(b.a,h,a.a,f):uhb(b.a,h,a.a,f)}else{l=g;if(g==i){if(e==0){return Hgb(),Ggb}k=zhb(a.a,f,b.a,h)}else{k=uhb(a.a,f,b.a,h)}}j=new Vgb(l,k.length,k);Jgb(j);return j} +function YPc(a){var b,c,d,e,f,g;this.e=new Rkb;this.a=new Rkb;for(c=a.b-1;c<3;c++){St(a,0,BD(Ut(a,0),8))}if(a.b<4){throw vbb(new Wdb('At (least dimension + 1) control points are necessary!'))}else{this.b=3;this.d=true;this.c=false;TPc(this,a.b+this.b-1);g=new Rkb;f=new olb(this.e);for(b=0;b=b.o&&c.f<=b.f||b.a*0.5<=c.f&&b.a*1.5>=c.f){g=BD(Ikb(b.n,b.n.c.length-1),211);if(g.e+g.d+c.g+e<=d&&(f=BD(Ikb(b.n,b.n.c.length-1),211),f.f-a.f+c.f<=a.b||a.a.c.length==1)){EZc(b,c);return true}else if(b.s+c.g<=d&&(b.t+b.d+c.f+e<=a.b||a.a.c.length==1)){Ekb(b.b,c);h=BD(Ikb(b.n,b.n.c.length-1),211);Ekb(b.n,new VZc(b.s,h.f+h.a+b.i,b.i));QZc(BD(Ikb(b.n,b.n.c.length-1),211),c);GZc(b,c);return true}}return false} +function Zxd(a,b,c){var d,e,f,g;if(a.ej()){e=null;f=a.fj();d=a.Zi(1,g=uud(a,b,c),c,b,f);if(a.bj()&&!(a.ni()&&g!=null?pb(g,c):PD(g)===PD(c))){g!=null&&(e=a.dj(g,e));e=a.cj(c,e);a.ij()&&(e=a.lj(g,c,e));if(!e){a.$i(d)}else{e.Ei(d);e.Fi()}}else{a.ij()&&(e=a.lj(g,c,e));if(!e){a.$i(d)}else{e.Ei(d);e.Fi()}}return g}else{g=uud(a,b,c);if(a.bj()&&!(a.ni()&&g!=null?pb(g,c):PD(g)===PD(c))){e=null;g!=null&&(e=a.dj(g,null));e=a.cj(c,e);!!e&&e.Fi()}return g}} +function YA(a,b){var c,d,e,f,g,h,i,j;b%=24;if(a.q.getHours()!=b){d=new $wnd.Date(a.q.getTime());d.setDate(d.getDate()+1);h=a.q.getTimezoneOffset()-d.getTimezoneOffset();if(h>0){i=h/60|0;j=h%60;e=a.q.getDate();c=a.q.getHours();c+i>=24&&++e;f=new $wnd.Date(a.q.getFullYear(),a.q.getMonth(),e,b+i,a.q.getMinutes()+j,a.q.getSeconds(),a.q.getMilliseconds());a.q.setTime(f.getTime())}}g=a.q.getTime();a.q.setTime(g+3600000);a.q.getHours()!=b&&a.q.setTime(g)} +function opc(a,b){var c,d,e,f,g;Odd(b,'Path-Like Graph Wrapping',1);if(a.b.c.length==0){Qdd(b);return}e=new Xoc(a);g=(e.i==null&&(e.i=Soc(e,new Zoc)),Edb(e.i)*e.f);c=g/(e.i==null&&(e.i=Soc(e,new Zoc)),Edb(e.i));if(e.b>c){Qdd(b);return}switch(BD(vNb(a,(Nyc(),Gyc)),337).g){case 2:f=new hpc;break;case 0:f=new Ync;break;default:f=new kpc;}d=f.Vf(a,e);if(!f.Wf()){switch(BD(vNb(a,Myc),338).g){case 2:d=tpc(e,d);break;case 1:d=rpc(e,d);}}npc(a,e,d);Qdd(b)} +function MFc(a,b){var c,d,e,f;Fub(a.d,a.e);a.c.a.$b();if(Edb(ED(vNb(b.j,(Nyc(),uwc))))!=0||Edb(ED(vNb(b.j,uwc)))!=0){c=dme;PD(vNb(b.j,ywc))!==PD((tAc(),rAc))&&yNb(b.j,(wtc(),Jsc),(Bcb(),true));f=BD(vNb(b.j,Ayc),19).a;for(e=0;ee&&++j;Ekb(g,(tCb(h+j,b.c.length),BD(b.c[h+j],19)));i+=(tCb(h+j,b.c.length),BD(b.c[h+j],19)).a-d;++c;while(c1&&(i>red(h)*qed(h)/2||g.b==0)){l=new wed(m);k=red(h)/qed(h);j=fed(l,b,new p0b,c,d,e,k);P6c(X6c(l.e),j);h=l;n.c[n.c.length]=l;i=0;m.c=KC(SI,Uhe,1,0,5,1)}}}Gkb(n,m);return n} +function y6d(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p;if(c.mh(b)){k=(n=b,!n?null:BD(d,49).xh(n));if(k){p=c.bh(b,a.a);o=b.t;if(o>1||o==-1){l=BD(p,69);m=BD(k,69);if(l.dc()){m.$b()}else{g=!!zUd(b);f=0;for(h=a.a?l.Kc():l.Zh();h.Ob();){j=BD(h.Pb(),56);e=BD(Wrb(a,j),56);if(!e){if(a.b&&!g){m.Xh(f,j);++f}}else{if(g){i=m.Xc(e);i==-1?m.Xh(f,e):f!=i&&m.ji(f,e)}else{m.Xh(f,e)}++f}}}}else{if(p==null){k.Wb(null)}else{e=Wrb(a,p);e==null?a.b&&!zUd(b)&&k.Wb(p):k.Wb(e)}}}}} +function E6b(a,b){var c,d,e,f,g,h,i,j;c=new L6b;for(e=new Sr(ur(R_b(b).a.Kc(),new Sq));Qr(e);){d=BD(Rr(e),17);if(OZb(d)){continue}h=d.c.i;if(F6b(h,C6b)){j=G6b(a,h,C6b,B6b);if(j==-1){continue}c.b=$wnd.Math.max(c.b,j);!c.a&&(c.a=new Rkb);Ekb(c.a,h)}}for(g=new Sr(ur(U_b(b).a.Kc(),new Sq));Qr(g);){f=BD(Rr(g),17);if(OZb(f)){continue}i=f.d.i;if(F6b(i,B6b)){j=G6b(a,i,B6b,C6b);if(j==-1){continue}c.d=$wnd.Math.max(c.d,j);!c.c&&(c.c=new Rkb);Ekb(c.c,i)}}return c} +function Khb(a){Dhb();var b,c,d,e;b=QD(a);if(a1000000){throw vbb(new ocb('power of ten too big'))}if(a<=Ohe){return Qgb(Pgb(Bhb[1],b),b)}d=Pgb(Bhb[1],Ohe);e=d;c=Cbb(a-Ohe);b=QD(a%Ohe);while(ybb(c,Ohe)>0){e=Ogb(e,d);c=Qbb(c,Ohe)}e=Ogb(e,Pgb(Bhb[1],b));e=Qgb(e,Ohe);c=Cbb(a-Ohe);while(ybb(c,Ohe)>0){e=Qgb(e,Ohe);c=Qbb(c,Ohe)}e=Qgb(e,b);return e} +function X5b(a,b){var c,d,e,f,g,h,i,j,k;Odd(b,'Hierarchical port dummy size processing',1);i=new Rkb;k=new Rkb;d=Edb(ED(vNb(a,(Nyc(),myc))));c=d*2;for(f=new olb(a.b);f.aj&&d>j){k=h;j=Edb(b.p[h.p])+Edb(b.d[h.p])+h.o.b+h.d.a}else{e=false;c.n&&Sdd(c,'bk node placement breaks on '+h+' which should have been after '+k);break}}if(!e){break}}c.n&&Sdd(c,b+' is feasible: '+e);return e} +function XNc(a,b,c,d){var e,f,g,h,i,j,k;h=-1;for(k=new olb(a);k.a=q&&a.e[i.p]>o*a.b||t>=c*q){m.c[m.c.length]=h;h=new Rkb;ye(g,f);f.a.$b();j-=k;n=$wnd.Math.max(n,j*a.b+p);j+=t;s=t;t=0;k=0;p=0}}return new vgd(n,m)} +function q4c(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;for(c=(j=(new $ib(a.c.b)).a.vc().Kc(),new djb(j));c.a.Ob();){b=(h=BD(c.a.Pb(),42),BD(h.dd(),149));e=b.a;e==null&&(e='');d=i4c(a.c,e);!d&&e.length==0&&(d=u4c(a));!!d&&!ze(d.c,b,false)&&Dsb(d.c,b)}for(g=Jsb(a.a,0);g.b!=g.d.c;){f=BD(Xsb(g),478);k=j4c(a.c,f.a);n=j4c(a.c,f.b);!!k&&!!n&&Dsb(k.c,new vgd(n,f.c))}Osb(a.a);for(m=Jsb(a.b,0);m.b!=m.d.c;){l=BD(Xsb(m),478);b=g4c(a.c,l.a);i=j4c(a.c,l.b);!!b&&!!i&&B3c(b,i,l.c)}Osb(a.b)} +function qvd(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;f=new fC(a);g=new ird;e=(ko(g.g),ko(g.j),Uhb(g.b),ko(g.d),ko(g.i),Uhb(g.k),Uhb(g.c),Uhb(g.e),n=drd(g,f,null),ard(g,f),n);if(b){j=new fC(b);h=rvd(j);jfd(e,OC(GC(g2,1),Uhe,527,0,[h]))}m=false;l=false;if(c){j=new fC(c);que in j.a&&(m=aC(j,que).ge().a);rue in j.a&&(l=aC(j,rue).ge().a)}k=Vdd(Xdd(new Zdd,m),l);t2c(new w2c,e,k);que in f.a&&cC(f,que,null);if(m||l){i=new eC;nvd(k,i,m,l);cC(f,que,i)}d=new Prd(g);Ghe(new _ud(e),d)} +function pA(a,b,c){var d,e,f,g,h,i,j,k,l;g=new nB;j=OC(GC(WD,1),oje,25,15,[0]);e=-1;f=0;d=0;for(i=0;i0){if(e<0&&k.a){e=i;f=j[0];d=0}if(e>=0){h=k.b;if(i==e){h-=d++;if(h==0){return 0}}if(!wA(b,j,k,h,g)){i=e-1;j[0]=f;continue}}else{e=-1;if(!wA(b,j,k,0,g)){return 0}}}else{e=-1;if(bfb(k.c,0)==32){l=j[0];uA(b,j);if(j[0]>l){continue}}else if(ofb(b,k.c,j[0])){j[0]+=k.c.length;continue}return 0}}if(!mB(g,c)){return 0}return j[0]} +function SKd(a){var b,c,d,e,f,g,h,i;if(!a.f){i=new CNd;h=new CNd;b=KKd;g=b.a.zc(a,b);if(g==null){for(f=new Fyd(_Kd(a));f.e!=f.i.gc();){e=BD(Dyd(f),26);ytd(i,SKd(e))}b.a.Bc(a)!=null;b.a.gc()==0&&undefined}for(d=(!a.s&&(a.s=new cUd(t5,a,21,17)),new Fyd(a.s));d.e!=d.i.gc();){c=BD(Dyd(d),170);JD(c,99)&&wtd(h,BD(c,18))}vud(h);a.r=new UNd(a,(BD(qud(ZKd((NFd(),MFd).o),6),18),h.i),h.g);ytd(i,a.r);vud(i);a.f=new nNd((BD(qud(ZKd(MFd.o),5),18),i.i),i.g);$Kd(a).b&=-3}return a.f} +function rMb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;g=a.o;d=KC(WD,oje,25,g,15,1);e=KC(WD,oje,25,g,15,1);c=a.p;b=KC(WD,oje,25,c,15,1);f=KC(WD,oje,25,c,15,1);for(j=0;j=0&&!YMb(a,k,l)){--l}e[k]=l}for(n=0;n=0&&!YMb(a,h,o)){--h}f[o]=h}for(i=0;ib[m]&&md[i]&&aNb(a,i,m,false,true)}}} +function lRb(a){var b,c,d,e,f,g,h,i;c=Ccb(DD(vNb(a,(wSb(),cSb))));f=a.a.c.d;h=a.a.d.d;if(c){g=Y6c(c7c(new f7c(h.a,h.b),f),0.5);i=Y6c(R6c(a.e),0.5);b=c7c(P6c(new f7c(f.a,f.b),g),i);a7c(a.d,b)}else{e=Edb(ED(vNb(a.a,tSb)));d=a.d;if(f.a>=h.a){if(f.b>=h.b){d.a=h.a+(f.a-h.a)/2+e;d.b=h.b+(f.b-h.b)/2-e-a.e.b}else{d.a=h.a+(f.a-h.a)/2+e;d.b=f.b+(h.b-f.b)/2+e}}else{if(f.b>=h.b){d.a=f.a+(h.a-f.a)/2+e;d.b=h.b+(f.b-h.b)/2+e}else{d.a=f.a+(h.a-f.a)/2+e;d.b=f.b+(h.b-f.b)/2-e-a.e.b}}}} +function Qge(a,b){var c,d,e,f,g,h,i;if(a==null){return null}f=a.length;if(f==0){return ''}i=KC(TD,$ie,25,f,15,1);ACb(0,f,a.length);ACb(0,f,i.length);ffb(a,0,f,i,0);c=null;h=b;for(e=0,g=0;e0?qfb(c.a,0,f-1):''}}else{return !c?a:c.a}} +function DPb(a){r4c(a,new E3c(P3c(M3c(O3c(N3c(new R3c,Yle),'ELK DisCo'),'Layouter for arranging unconnected subgraphs. The subgraphs themselves are, by default, not laid out.'),new GPb)));p4c(a,Yle,Zle,Ksd(BPb));p4c(a,Yle,$le,Ksd(vPb));p4c(a,Yle,_le,Ksd(qPb));p4c(a,Yle,ame,Ksd(wPb));p4c(a,Yle,Zke,Ksd(zPb));p4c(a,Yle,$ke,Ksd(yPb));p4c(a,Yle,Yke,Ksd(APb));p4c(a,Yle,_ke,Ksd(xPb));p4c(a,Yle,Tle,Ksd(sPb));p4c(a,Yle,Ule,Ksd(rPb));p4c(a,Yle,Vle,Ksd(tPb));p4c(a,Yle,Wle,Ksd(uPb))} +function Zbc(a,b,c,d){var e,f,g,h,i,j,k,l,m;f=new b0b(a);__b(f,(j0b(),i0b));yNb(f,(Nyc(),Vxc),(dcd(),$bd));e=0;if(b){g=new H0b;yNb(g,(wtc(),$sc),b);yNb(f,$sc,b.i);G0b(g,(Ucd(),Tcd));F0b(g,f);m=k_b(b.e);for(j=m,k=0,l=j.length;k0){c-=d.length-b;if(c>=0){e.a+='0.';for(;c>egb.length;c-=egb.length){Rfb(e,egb)}Sfb(e,egb,QD(c));Qfb(e,d.substr(b))}else{c=b-c;Qfb(e,qfb(d,b,QD(c)));e.a+='.';Qfb(e,pfb(d,QD(c)))}}else{Qfb(e,d.substr(b));for(;c<-egb.length;c+=egb.length){Rfb(e,egb)}Sfb(e,egb,QD(-c))}return e.a} +function v6c(a,b,c,d){var e,f,g,h,i,j,k,l,m;i=c7c(new f7c(c.a,c.b),a);j=i.a*b.b-i.b*b.a;k=b.a*d.b-b.b*d.a;l=(i.a*d.b-i.b*d.a)/k;m=j/k;if(k==0){if(j==0){e=P6c(new f7c(c.a,c.b),Y6c(new f7c(d.a,d.b),0.5));f=S6c(a,e);g=S6c(P6c(new f7c(a.a,a.b),b),e);h=$wnd.Math.sqrt(d.a*d.a+d.b*d.b)*0.5;if(f=0&&l<=1&&m>=0&&m<=1?P6c(new f7c(a.a,a.b),Y6c(new f7c(b.a,b.b),l)):null}} +function OTb(a,b,c){var d,e,f,g,h;d=BD(vNb(a,(Nyc(),zwc)),21);c.a>b.a&&(d.Hc((i8c(),c8c))?(a.c.a+=(c.a-b.a)/2):d.Hc(e8c)&&(a.c.a+=c.a-b.a));c.b>b.b&&(d.Hc((i8c(),g8c))?(a.c.b+=(c.b-b.b)/2):d.Hc(f8c)&&(a.c.b+=c.b-b.b));if(BD(vNb(a,(wtc(),Ksc)),21).Hc((Orc(),Hrc))&&(c.a>b.a||c.b>b.b)){for(h=new olb(a.a);h.ab.a&&(d.Hc((i8c(),c8c))?(a.c.a+=(c.a-b.a)/2):d.Hc(e8c)&&(a.c.a+=c.a-b.a));c.b>b.b&&(d.Hc((i8c(),g8c))?(a.c.b+=(c.b-b.b)/2):d.Hc(f8c)&&(a.c.b+=c.b-b.b));if(BD(vNb(a,(wtc(),Ksc)),21).Hc((Orc(),Hrc))&&(c.a>b.a||c.b>b.b)){for(g=new olb(a.a);g.ab){e=0;f+=k.b+c;l.c[l.c.length]=k;k=new x$c(f,c);d=new PZc(0,k.f,k,c);s$c(k,d);e=0}if(d.b.c.length==0||i.f>=d.o&&i.f<=d.f||d.a*0.5<=i.f&&d.a*1.5>=i.f){EZc(d,i)}else{g=new PZc(d.s+d.r+c,k.f,k,c);s$c(k,g);EZc(g,i)}e=i.i+i.g}l.c[l.c.length]=k;return l} +function OKd(a){var b,c,d,e,f,g,h,i;if(!a.a){a.o=null;i=new GNd(a);b=new KNd;c=KKd;h=c.a.zc(a,c);if(h==null){for(g=new Fyd(_Kd(a));g.e!=g.i.gc();){f=BD(Dyd(g),26);ytd(i,OKd(f))}c.a.Bc(a)!=null;c.a.gc()==0&&undefined}for(e=(!a.s&&(a.s=new cUd(t5,a,21,17)),new Fyd(a.s));e.e!=e.i.gc();){d=BD(Dyd(e),170);JD(d,322)&&wtd(b,BD(d,34))}vud(b);a.k=new PNd(a,(BD(qud(ZKd((NFd(),MFd).o),7),18),b.i),b.g);ytd(i,a.k);vud(i);a.a=new nNd((BD(qud(ZKd(MFd.o),4),18),i.i),i.g);$Kd(a).b&=-2}return a.a} +function vZc(a,b,c,d,e,f,g){var h,i,j,k,l,m;l=false;i=ZZc(c.q,b.f+b.b-c.q.f);m=e-(c.q.e+i-g);if(m=(tCb(f,a.c.length),BD(a.c[f],200)).e;k=(h=MZc(d,m,false),h.a);if(k>b.b&&!j){return false}if(j||k<=b.b){if(j&&k>b.b){c.d=k;KZc(c,JZc(c,k))}else{$Zc(c.q,i);c.c=true}KZc(d,e-(c.s+c.r));OZc(d,c.q.e+c.q.d,b.f);s$c(b,d);if(a.c.length>f){v$c((tCb(f,a.c.length),BD(a.c[f],200)),d);(tCb(f,a.c.length),BD(a.c[f],200)).a.c.length==0&&Kkb(a,f)}l=true}return l} +function C2d(a,b,c,d){var e,f,g,h,i,j,k;k=S6d(a.e.Tg(),b);e=0;f=BD(a.g,119);i=null;Q6d();if(BD(b,66).Oj()){for(h=0;ha.o.a){k=(i-a.o.a)/2;h.b=$wnd.Math.max(h.b,k);h.c=$wnd.Math.max(h.c,k)}} +function rvd(a){var b,c,d,e,f,g,h,i;f=new b2c;Z1c(f,(Y1c(),V1c));for(d=(e=$B(a,KC(ZI,nie,2,0,6,1)),new vib(new amb((new mC(a,e)).b)));d.b0?a.i:0)>b&&i>0){f=0;g+=i+a.i;e=$wnd.Math.max(e,m);d+=i+a.i;i=0;m=0;if(c){++l;Ekb(a.n,new VZc(a.s,g,a.i))}h=0}m+=j.g+(h>0?a.i:0);i=$wnd.Math.max(i,j.f);c&&QZc(BD(Ikb(a.n,l),211),j);f+=j.g+(h>0?a.i:0);++h}e=$wnd.Math.max(e,m);d+=i;if(c){a.r=e;a.d=d;u$c(a.j)}return new J6c(a.s,a.t,e,d)} +function $fb(a,b,c,d,e){Zfb();var f,g,h,i,j,k,l,m,n;vCb(a,'src');vCb(c,'dest');m=rb(a);i=rb(c);rCb((m.i&4)!=0,'srcType is not an array');rCb((i.i&4)!=0,'destType is not an array');l=m.c;g=i.c;rCb((l.i&1)!=0?l==g:(g.i&1)==0,"Array types don't match");n=a.length;j=c.length;if(b<0||d<0||e<0||b+e>n||d+e>j){throw vbb(new pcb)}if((l.i&1)==0&&m!=i){k=CD(a);f=CD(c);if(PD(a)===PD(c)&&bd;){NC(f,h,k[--b])}}else{for(h=d+e;d0&&$Bb(a,b,c,d,e,true)} +function phb(){phb=ccb;nhb=OC(GC(WD,1),oje,25,15,[Rie,1162261467,Iie,1220703125,362797056,1977326743,Iie,387420489,Jje,214358881,429981696,815730721,1475789056,170859375,268435456,410338673,612220032,893871739,1280000000,1801088541,113379904,148035889,191102976,244140625,308915776,387420489,481890304,594823321,729000000,887503681,Iie,1291467969,1544804416,1838265625,60466176]);ohb=OC(GC(WD,1),oje,25,15,[-1,-1,31,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5])} +function soc(a){var b,c,d,e,f,g,h,i;for(e=new olb(a.b);e.a=a.b.length){f[e++]=g.b[d++];f[e++]=g.b[d++]}else if(d>=g.b.length){f[e++]=a.b[c++];f[e++]=a.b[c++]}else if(g.b[d]0?a.i:0)}++b}Ce(a.n,i);a.d=c;a.r=d;a.g=0;a.f=0;a.e=0;a.o=Pje;a.p=Pje;for(f=new olb(a.b);f.a0){e=(!a.n&&(a.n=new cUd(D2,a,1,7)),BD(qud(a.n,0),137)).a;!e||Qfb(Qfb((b.a+=' "',b),e),'"')}}else{Qfb(Qfb((b.a+=' "',b),d),'"')}c=(!a.b&&(a.b=new y5d(z2,a,4,7)),!(a.b.i<=1&&(!a.c&&(a.c=new y5d(z2,a,5,8)),a.c.i<=1)));c?(b.a+=' [',b):(b.a+=' ',b);Qfb(b,Eb(new Gb,new Fyd(a.b)));c&&(b.a+=']',b);b.a+=gne;c&&(b.a+='[',b);Qfb(b,Eb(new Gb,new Fyd(a.c)));c&&(b.a+=']',b);return b.a} +function TQd(a,b){var c,d,e,f,g,h,i;if(a.a){h=a.a.ne();i=null;if(h!=null){b.a+=''+h}else{g=a.a.Dj();if(g!=null){f=hfb(g,wfb(91));if(f!=-1){i=g.substr(f);b.a+=''+qfb(g==null?Xhe:(uCb(g),g),0,f)}else{b.a+=''+g}}}if(!!a.d&&a.d.i!=0){e=true;b.a+='<';for(d=new Fyd(a.d);d.e!=d.i.gc();){c=BD(Dyd(d),87);e?(e=false):(b.a+=She,b);TQd(c,b)}b.a+='>'}i!=null&&(b.a+=''+i,b)}else if(a.e){h=a.e.zb;h!=null&&(b.a+=''+h,b)}else{b.a+='?';if(a.b){b.a+=' super ';TQd(a.b,b)}else{if(a.f){b.a+=' extends ';TQd(a.f,b)}}}} +function Z9b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D;v=a.c;w=b.c;c=Jkb(v.a,a,0);d=Jkb(w.a,b,0);t=BD(W_b(a,(KAc(),HAc)).Kc().Pb(),11);C=BD(W_b(a,IAc).Kc().Pb(),11);u=BD(W_b(b,HAc).Kc().Pb(),11);D=BD(W_b(b,IAc).Kc().Pb(),11);r=k_b(t.e);A=k_b(C.g);s=k_b(u.e);B=k_b(D.g);Z_b(a,d,w);for(g=s,k=0,o=g.length;kk){new DOc((HOc(),GOc),c,b,j-k)}else if(j>0&&k>0){new DOc((HOc(),GOc),b,c,0);new DOc(GOc,c,b,0)}}return g} +function TUb(a,b){var c,d,e,f,g,h;for(g=new nib((new eib(a.f.b)).a);g.b;){f=lib(g);e=BD(f.cd(),594);if(b==1){if(e.gf()!=(ead(),dad)&&e.gf()!=_9c){continue}}else{if(e.gf()!=(ead(),aad)&&e.gf()!=bad){continue}}d=BD(BD(f.dd(),46).b,81);h=BD(BD(f.dd(),46).a,189);c=h.c;switch(e.gf().g){case 2:d.g.c=a.e.a;d.g.b=$wnd.Math.max(1,d.g.b+c);break;case 1:d.g.c=d.g.c+c;d.g.b=$wnd.Math.max(1,d.g.b-c);break;case 4:d.g.d=a.e.b;d.g.a=$wnd.Math.max(1,d.g.a+c);break;case 3:d.g.d=d.g.d+c;d.g.a=$wnd.Math.max(1,d.g.a-c);}}} +function nJc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;h=KC(WD,oje,25,b.b.c.length,15,1);j=KC(NQ,Kie,267,b.b.c.length,0,1);i=KC(OQ,kne,10,b.b.c.length,0,1);for(l=a.a,m=0,n=l.length;m0&&!!i[d]&&(o=jBc(a.b,i[d],e));p=$wnd.Math.max(p,e.c.c.b+o)}for(f=new olb(k.e);f.a1){throw vbb(new Wdb(Hwe))}if(!i){f=R6d(b,d.Kc().Pb());g.Fc(f)}}return xtd(a,I2d(a,b,c),g)} +function Pmc(a,b){var c,d,e,f;Jmc(b.b.j);MAb(NAb(new YAb(null,new Kub(b.d,16)),new $mc),new anc);for(f=new olb(b.d);f.aa.o.b){return false}c=V_b(a,zcd);h=b.d+b.a+(c.gc()-1)*g;if(h>a.o.b){return false}}return true} +function thb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;g=a.e;i=b.e;if(g==0){return b}if(i==0){return a}f=a.d;h=b.d;if(f+h==2){c=xbb(a.a[0],Yje);d=xbb(b.a[0],Yje);if(g==i){k=wbb(c,d);o=Tbb(k);n=Tbb(Pbb(k,32));return n==0?new Ugb(g,o):new Vgb(g,2,OC(GC(WD,1),oje,25,15,[o,n]))}return ghb(g<0?Qbb(d,c):Qbb(c,d))}else if(g==i){m=g;l=f>=h?uhb(a.a,f,b.a,h):uhb(b.a,h,a.a,f)}else{e=f!=h?f>h?1:-1:whb(a.a,b.a,f);if(e==0){return Hgb(),Ggb}if(e==1){m=g;l=zhb(a.a,f,b.a,h)}else{m=i;l=zhb(b.a,h,a.a,f)}}j=new Vgb(m,l.length,l);Jgb(j);return j} +function oZb(a,b,c,d,e,f,g){var h,i,j,k,l,m,n;l=Ccb(DD(vNb(b,(Nyc(),vxc))));m=null;f==(KAc(),HAc)&&d.c.i==c?(m=d.c):f==IAc&&d.d.i==c&&(m=d.d);j=g;if(!j||!l||!!m){k=(Ucd(),Scd);m?(k=m.j):fcd(BD(vNb(c,Vxc),98))&&(k=f==HAc?Tcd:zcd);i=lZb(a,b,c,f,k,d);h=kZb((Q_b(c),d));if(f==HAc){QZb(h,BD(Ikb(i.j,0),11));RZb(h,e)}else{QZb(h,e);RZb(h,BD(Ikb(i.j,0),11))}j=new yZb(d,h,i,BD(vNb(i,(wtc(),$sc)),11),f,!m)}else{Ekb(j.e,d);n=$wnd.Math.max(Edb(ED(vNb(j.d,Zwc))),Edb(ED(vNb(d,Zwc))));yNb(j.d,Zwc,n)}Rc(a.a,d,new BZb(j.d,b,f));return j} +function V1d(a,b){var c,d,e,f,g,h,i,j,k,l;k=null;!!a.d&&(k=BD(Phb(a.d,b),138));if(!k){f=a.a.Mh();l=f.i;if(!a.d||Vhb(a.d)!=l){i=new Lqb;!!a.d&&Ld(i,a.d);j=i.f.c+i.g.c;for(h=j;h0){n=(o-1)*c;!!h&&(n+=d);!!k&&(n+=d);n=a.b[e+1]){e+=2}else if(c0){d=new Tkb(BD(Qc(a.a,f),21));mmb();Okb(d,new EZb(b));e=new Bib(f.b,0);while(e.bv)){i=2;g=Ohe}else if(i==0){i=1;g=A}else{i=0;g=A}}else{n=A>=g||g-A0?1:Ny(isNaN(d),isNaN(0)))>=0^(null,My(Jqe),($wnd.Math.abs(h)<=Jqe||h==0||isNaN(h)&&isNaN(0)?0:h<0?-1:h>0?1:Ny(isNaN(h),isNaN(0)))>=0)){return $wnd.Math.max(h,d)}My(Jqe);if(($wnd.Math.abs(d)<=Jqe||d==0||isNaN(d)&&isNaN(0)?0:d<0?-1:d>0?1:Ny(isNaN(d),isNaN(0)))>0){return $wnd.Math.sqrt(h*h+d*d)}return -$wnd.Math.sqrt(h*h+d*d)} +function Kge(a,b){var c,d,e,f,g,h;if(!b)return;!a.a&&(a.a=new Wvb);if(a.e==2){Tvb(a.a,b);return}if(b.e==1){for(e=0;e=Tje?Efb(c,Tee(d)):Afb(c,d&aje);g=(++vfe,new Hge(10,null,0));Vvb(a.a,g,h-1)}else{c=(g.bm().length+f,new Ifb);Efb(c,g.bm())}if(b.e==0){d=b._l();d>=Tje?Efb(c,Tee(d)):Afb(c,d&aje)}else{Efb(c,b.bm())}BD(g,521).b=c.a} +function rgb(a){var b,c,d,e,f;if(a.g!=null){return a.g}if(a.a<32){a.g=rhb(Cbb(a.f),QD(a.e));return a.g}e=shb((!a.c&&(a.c=fhb(a.f)),a.c),0);if(a.e==0){return e}b=(!a.c&&(a.c=fhb(a.f)),a.c).e<0?2:1;c=e.length;d=-a.e+c-b;f=new Ufb;f.a+=''+e;if(a.e>0&&d>=-6){if(d>=0){Tfb(f,c-QD(a.e),String.fromCharCode(46))}else{f.a=qfb(f.a,0,b-1)+'0.'+pfb(f.a,b-1);Tfb(f,b+1,zfb(egb,0,-QD(d)-1))}}else{if(c-b>=1){Tfb(f,b,String.fromCharCode(46));++c}Tfb(f,c,String.fromCharCode(69));d>0&&Tfb(f,++c,String.fromCharCode(43));Tfb(f,++c,''+Ubb(Cbb(d)))}a.g=f.a;return a.g} +function npc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(c.dc()){return}h=0;m=0;d=c.Kc();o=BD(d.Pb(),19).a;while(h1&&(i=j.mg(i,a.a,h))}if(i.c.length==1){return BD(Ikb(i,i.c.length-1),220)}if(i.c.length==2){return lYc((tCb(0,i.c.length),BD(i.c[0],220)),(tCb(1,i.c.length),BD(i.c[1],220)),g,f)}return null} +function JNb(a){var b,c,d,e,f,g;Hkb(a.a,new PNb);for(c=new olb(a.a);c.a=$wnd.Math.abs(d.b)){d.b=0;f.d+f.a>g.d&&f.dg.c&&f.c0){b=new _zd(a.i,a.g);c=a.i;f=c<100?null:new Ixd(c);if(a.ij()){for(d=0;d0){h=a.g;j=a.i;oud(a);f=j<100?null:new Ixd(j);for(d=0;d>13|(a.m&15)<<9;e=a.m>>4&8191;f=a.m>>17|(a.h&255)<<5;g=(a.h&1048320)>>8;h=b.l&8191;i=b.l>>13|(b.m&15)<<9;j=b.m>>4&8191;k=b.m>>17|(b.h&255)<<5;l=(b.h&1048320)>>8;B=c*h;C=d*h;D=e*h;F=f*h;G=g*h;if(i!=0){C+=c*i;D+=d*i;F+=e*i;G+=f*i}if(j!=0){D+=c*j;F+=d*j;G+=e*j}if(k!=0){F+=c*k;G+=d*k}l!=0&&(G+=c*l);n=B&Eje;o=(C&511)<<13;m=n+o;q=B>>22;r=C>>9;s=(D&262143)<<4;t=(F&31)<<17;p=q+r+s+t;v=D>>18;w=F>>5;A=(G&4095)<<8;u=v+w+A;p+=m>>22;m&=Eje;u+=p>>22;p&=Eje;u&=Fje;return TC(m,p,u)} +function o7b(a){var b,c,d,e,f,g,h;h=BD(Ikb(a.j,0),11);if(h.g.c.length!=0&&h.e.c.length!=0){throw vbb(new Zdb('Interactive layout does not support NORTH/SOUTH ports with incoming _and_ outgoing edges.'))}if(h.g.c.length!=0){f=Pje;for(c=new olb(h.g);c.a4){if(a.wj(b)){if(a.rk()){e=BD(b,49);d=e.Ug();i=d==a.e&&(a.Dk()?e.Og(e.Vg(),a.zk())==a.Ak():-1-e.Vg()==a.aj());if(a.Ek()&&!i&&!d&&!!e.Zg()){for(f=0;f0&&(j=a.n.a/f);break;case 2:case 4:e=a.i.o.b;e>0&&(j=a.n.b/e);}yNb(a,(wtc(),htc),j)}i=a.o;g=a.a;if(d){g.a=d.a;g.b=d.b;a.d=true}else if(b!=bcd&&b!=ccd&&h!=Scd){switch(h.g){case 1:g.a=i.a/2;break;case 2:g.a=i.a;g.b=i.b/2;break;case 3:g.a=i.a/2;g.b=i.b;break;case 4:g.b=i.b/2;}}else{g.a=i.a/2;g.b=i.b/2}} +function vwd(a){var b,c,d,e,f,g,h,i,j,k;if(a.ej()){k=a.Vi();i=a.fj();if(k>0){b=new Aud(a.Gi());c=k;f=c<100?null:new Ixd(c);Cvd(a,c,b.g);e=c==1?a.Zi(4,qud(b,0),null,0,i):a.Zi(6,b,null,-1,i);if(a.bj()){for(d=new Fyd(b);d.e!=d.i.gc();){f=a.dj(Dyd(d),f)}if(!f){a.$i(e)}else{f.Ei(e);f.Fi()}}else{if(!f){a.$i(e)}else{f.Ei(e);f.Fi()}}}else{Cvd(a,a.Vi(),a.Wi());a.$i(a.Zi(6,(mmb(),jmb),null,-1,i))}}else if(a.bj()){k=a.Vi();if(k>0){h=a.Wi();j=k;Cvd(a,k,h);f=j<100?null:new Ixd(j);for(d=0;da.d[g.p]){c+=zHc(a.b,f)*BD(i.b,19).a;Wjb(a.a,meb(f))}}while(!akb(a.a)){xHc(a.b,BD(fkb(a.a),19).a)}}return c} +function eed(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q;l=new g7c(BD(hkd(a,(X7c(),R7c)),8));l.a=$wnd.Math.max(l.a-c.b-c.c,0);l.b=$wnd.Math.max(l.b-c.d-c.a,0);e=ED(hkd(a,L7c));(e==null||(uCb(e),e)<=0)&&(e=1.3);h=new Rkb;for(o=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));o.e!=o.i.gc();){n=BD(Dyd(o),33);g=new xed(n);h.c[h.c.length]=g}m=BD(hkd(a,M7c),311);switch(m.g){case 3:q=bed(h,b,l.a,l.b,(j=d,uCb(e),e,j));break;case 1:q=aed(h,b,l.a,l.b,(k=d,uCb(e),e,k));break;default:q=ced(h,b,l.a,l.b,(i=d,uCb(e),e,i));}f=new wed(q);p=fed(f,b,c,l.a,l.b,d,(uCb(e),e));Afd(a,p.a,p.b,false,true)} +function vkc(a,b){var c,d,e,f;c=b.b;f=new Tkb(c.j);e=0;d=c.j;d.c=KC(SI,Uhe,1,0,5,1);hkc(BD(Si(a.b,(Ucd(),Acd),(Fkc(),Ekc)),15),c);e=ikc(f,e,new blc,d);hkc(BD(Si(a.b,Acd,Dkc),15),c);e=ikc(f,e,new dlc,d);hkc(BD(Si(a.b,Acd,Ckc),15),c);hkc(BD(Si(a.b,zcd,Ekc),15),c);hkc(BD(Si(a.b,zcd,Dkc),15),c);e=ikc(f,e,new flc,d);hkc(BD(Si(a.b,zcd,Ckc),15),c);hkc(BD(Si(a.b,Rcd,Ekc),15),c);e=ikc(f,e,new hlc,d);hkc(BD(Si(a.b,Rcd,Dkc),15),c);e=ikc(f,e,new jlc,d);hkc(BD(Si(a.b,Rcd,Ckc),15),c);hkc(BD(Si(a.b,Tcd,Ekc),15),c);e=ikc(f,e,new Pkc,d);hkc(BD(Si(a.b,Tcd,Dkc),15),c);hkc(BD(Si(a.b,Tcd,Ckc),15),c)} +function nbc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;Odd(b,'Layer size calculation',1);k=Pje;j=Qje;e=false;for(h=new olb(a.b);h.a0.5?(r-=g*2*(o-0.5)):o<0.5&&(r+=f*2*(0.5-o));e=h.d.b;rq.a-p-k&&(r=q.a-p-k);h.n.a=b+r}} +function ced(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q;h=KC(UD,Vje,25,a.c.length,15,1);m=new gub(new Ned);_tb(m,a);j=0;p=new Rkb;while(m.b.c.length!=0){g=BD(m.b.c.length==0?null:Ikb(m.b,0),157);if(j>1&&red(g)*qed(g)/2>h[0]){f=0;while(fh[f]){++f}o=new Jib(p,0,f+1);l=new wed(o);k=red(g)/qed(g);i=fed(l,b,new p0b,c,d,e,k);P6c(X6c(l.e),i);zCb(cub(m,l));n=new Jib(p,f+1,p.c.length);_tb(m,n);p.c=KC(SI,Uhe,1,0,5,1);j=0;Dlb(h,h.length,0)}else{q=m.b.c.length==0?null:Ikb(m.b,0);q!=null&&fub(m,0);j>0&&(h[j]=h[j-1]);h[j]+=red(g)*qed(g);++j;p.c[p.c.length]=g}}return p} +function Wac(a){var b,c,d,e,f;d=BD(vNb(a,(Nyc(),mxc)),163);if(d==(Ctc(),ytc)){for(c=new Sr(ur(R_b(a).a.Kc(),new Sq));Qr(c);){b=BD(Rr(c),17);if(!Yac(b)){throw vbb(new y2c(Fne+P_b(a)+"' has its layer constraint set to FIRST_SEPARATE, but has at least one incoming edge. "+'FIRST_SEPARATE nodes must not have incoming edges.'))}}}else if(d==Atc){for(f=new Sr(ur(U_b(a).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);if(!Yac(e)){throw vbb(new y2c(Fne+P_b(a)+"' has its layer constraint set to LAST_SEPARATE, but has at least one outgoing edge. "+'LAST_SEPARATE nodes must not have outgoing edges.'))}}}} +function C9b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;Odd(b,'Label dummy removal',1);d=Edb(ED(vNb(a,(Nyc(),nyc))));e=Edb(ED(vNb(a,ryc)));j=BD(vNb(a,Lwc),103);for(i=new olb(a.b);i.a0&&iCc(a,h,l)}for(e=new olb(l);e.a>19!=0){b=hD(b);i=!i}g=_C(b);f=false;e=false;d=false;if(a.h==Gje&&a.m==0&&a.l==0){e=true;f=true;if(g==-1){a=SC((wD(),sD));d=true;i=!i}else{h=lD(a,g);i&&ZC(h);c&&(QC=TC(0,0,0));return h}}else if(a.h>>19!=0){f=true;a=hD(a);d=true;i=!i}if(g!=-1){return WC(a,g,i,f,c)}if(eD(a,b)<0){c&&(f?(QC=hD(a)):(QC=TC(a.l,a.m,a.h)));return TC(0,0,0)}return XC(d?a:TC(a.l,a.m,a.h),b,i,f,e,c)} +function F2c(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(a.e&&a.c.cb.f||b.g>a.f){return}c=0;d=0;for(g=a.w.a.ec().Kc();g.Ob();){e=BD(g.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,b.g,b.f)&&++c}for(h=a.r.a.ec().Kc();h.Ob();){e=BD(h.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,b.g,b.f)&&--c}for(i=b.w.a.ec().Kc();i.Ob();){e=BD(i.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,a.g,a.f)&&++d}for(f=b.r.a.ec().Kc();f.Ob();){e=BD(f.Pb(),11);aRc(l7c(OC(GC(m1,1),nie,8,0,[e.i.n,e.n,e.a])).b,a.g,a.f)&&--d}if(c=0){f=wid(b,c.substr(1,h-1));l=c.substr(h+1,j-(h+1));return pid(b,l,f)}}else{d=-1;Vcb==null&&(Vcb=new RegExp('\\d'));if(Vcb.test(String.fromCharCode(i))){d=lfb(c,wfb(46),j-1);if(d>=0){e=BD(hid(b,Bid(b,c.substr(1,d-1)),false),58);k=0;try{k=Icb(c.substr(d+1),Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){g=a;throw vbb(new rFd(g))}else throw vbb(a)}if(k=0){return c}switch($1d(q1d(a,c))){case 2:{if(dfb('',o1d(a,c.Hj()).ne())){i=b2d(q1d(a,c));h=a2d(q1d(a,c));k=r1d(a,b,i,h);if(k){return k}e=f1d(a,b);for(g=0,l=e.gc();g1){throw vbb(new Wdb(Hwe))}k=S6d(a.e.Tg(),b);d=BD(a.g,119);for(g=0;g1;for(j=new b1b(m.b);llb(j.a)||llb(j.b);){i=BD(llb(j.a)?mlb(j.a):mlb(j.b),17);l=i.c==m?i.d:i.c;$wnd.Math.abs(l7c(OC(GC(m1,1),nie,8,0,[l.i.n,l.n,l.a])).b-g.b)>1&&GNc(a,i,g,f,m)}}} +function XPc(a){var b,c,d,e,f,g;e=new Bib(a.e,0);d=new Bib(a.a,0);if(a.d){for(c=0;cOqe){f=b;g=0;while($wnd.Math.abs(b-f)0);e.a.Xb(e.c=--e.b);WPc(a,a.b-g,f,d,e);sCb(e.b0);d.a.Xb(d.c=--d.b)}if(!a.d){for(c=0;c0){a.f[k.p]=n/(k.e.c.length+k.g.c.length);a.c=$wnd.Math.min(a.c,a.f[k.p]);a.b=$wnd.Math.max(a.b,a.f[k.p])}else h&&(a.f[k.p]=n)}} +function $9d(a){a.b=null;a.bb=null;a.fb=null;a.qb=null;a.a=null;a.c=null;a.d=null;a.e=null;a.f=null;a.n=null;a.M=null;a.L=null;a.Q=null;a.R=null;a.K=null;a.db=null;a.eb=null;a.g=null;a.i=null;a.j=null;a.k=null;a.gb=null;a.o=null;a.p=null;a.q=null;a.r=null;a.$=null;a.ib=null;a.S=null;a.T=null;a.t=null;a.s=null;a.u=null;a.v=null;a.w=null;a.B=null;a.A=null;a.C=null;a.D=null;a.F=null;a.G=null;a.H=null;a.I=null;a.J=null;a.P=null;a.Z=null;a.U=null;a.V=null;a.W=null;a.X=null;a.Y=null;a._=null;a.ab=null;a.cb=null;a.hb=null;a.nb=null;a.lb=null;a.mb=null;a.ob=null;a.pb=null;a.jb=null;a.kb=null;a.N=false;a.O=false} +function l5b(a,b,c){var d,e,f,g;Odd(c,'Graph transformation ('+a.a+')',1);g=Mu(b.a);for(f=new olb(b.b);f.a0){a.a=i+(n-1)*f;b.c.b+=a.a;b.f.b+=a.a}}if(o.a.gc()!=0){m=new tPc(1,f);n=sPc(m,b,o,p,b.f.b+i-b.c.b);n>0&&(b.f.b+=i+(n-1)*f)}} +function kKd(a,b){var c,d,e,f;f=a.F;if(b==null){a.F=null;$Jd(a,null)}else{a.F=(uCb(b),b);d=hfb(b,wfb(60));if(d!=-1){e=b.substr(0,d);hfb(b,wfb(46))==-1&&!dfb(e,Khe)&&!dfb(e,Eve)&&!dfb(e,Fve)&&!dfb(e,Gve)&&!dfb(e,Hve)&&!dfb(e,Ive)&&!dfb(e,Jve)&&!dfb(e,Kve)&&(e=Lve);c=kfb(b,wfb(62));c!=-1&&(e+=''+b.substr(c+1));$Jd(a,e)}else{e=b;if(hfb(b,wfb(46))==-1){d=hfb(b,wfb(91));d!=-1&&(e=b.substr(0,d));if(!dfb(e,Khe)&&!dfb(e,Eve)&&!dfb(e,Fve)&&!dfb(e,Gve)&&!dfb(e,Hve)&&!dfb(e,Ive)&&!dfb(e,Jve)&&!dfb(e,Kve)){e=Lve;d!=-1&&(e+=''+b.substr(d))}else{e=b}}$Jd(a,e);e==b&&(a.F=a.D)}}(a.Db&4)!=0&&(a.Db&1)==0&&Uhd(a,new nSd(a,1,5,f,b))} +function AMc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;p=b.b.c.length;if(p<3){return}n=KC(WD,oje,25,p,15,1);l=0;for(k=new olb(b.b);k.ag)&&Qqb(a.b,BD(q.b,17))}}++h}f=g}}}} +function o5c(b,c){var d;if(c==null||dfb(c,Xhe)){return null}if(c.length==0&&b.k!=(_5c(),W5c)){return null}switch(b.k.g){case 1:return efb(c,kse)?(Bcb(),Acb):efb(c,lse)?(Bcb(),zcb):null;case 2:try{return meb(Icb(c,Rie,Ohe))}catch(a){a=ubb(a);if(JD(a,127)){return null}else throw vbb(a)}case 4:try{return Hcb(c)}catch(a){a=ubb(a);if(JD(a,127)){return null}else throw vbb(a)}case 3:return c;case 5:j5c(b);return m5c(b,c);case 6:j5c(b);return n5c(b,b.a,c);case 7:try{d=l5c(b);d.Jf(c);return d}catch(a){a=ubb(a);if(JD(a,32)){return null}else throw vbb(a)}default:throw vbb(new Zdb('Invalid type set for this layout option.'));}} +function JWb(a){AWb();var b,c,d,e,f,g,h;h=new CWb;for(c=new olb(a);c.a=h.b.c)&&(h.b=b);if(!h.c||b.c<=h.c.c){h.d=h.c;h.c=b}(!h.e||b.d>=h.e.d)&&(h.e=b);(!h.f||b.d<=h.f.d)&&(h.f=b)}d=new NWb((lWb(),hWb));rXb(a,yWb,new amb(OC(GC(bQ,1),Uhe,369,0,[d])));g=new NWb(kWb);rXb(a,xWb,new amb(OC(GC(bQ,1),Uhe,369,0,[g])));e=new NWb(iWb);rXb(a,wWb,new amb(OC(GC(bQ,1),Uhe,369,0,[e])));f=new NWb(jWb);rXb(a,vWb,new amb(OC(GC(bQ,1),Uhe,369,0,[f])));DWb(d.c,hWb);DWb(e.c,iWb);DWb(f.c,jWb);DWb(g.c,kWb);h.a.c=KC(SI,Uhe,1,0,5,1);Gkb(h.a,d.c);Gkb(h.a,Su(e.c));Gkb(h.a,f.c);Gkb(h.a,Su(g.c));return h} +function jxd(a){var b;switch(a.d){case 1:{if(a.hj()){return a.o!=-2}break}case 2:{if(a.hj()){return a.o==-2}break}case 3:case 5:case 4:case 6:case 7:{return a.o>-2}default:{return false}}b=a.gj();switch(a.p){case 0:return b!=null&&Ccb(DD(b))!=Kbb(a.k,0);case 1:return b!=null&&BD(b,217).a!=Tbb(a.k)<<24>>24;case 2:return b!=null&&BD(b,172).a!=(Tbb(a.k)&aje);case 6:return b!=null&&Kbb(BD(b,162).a,a.k);case 5:return b!=null&&BD(b,19).a!=Tbb(a.k);case 7:return b!=null&&BD(b,184).a!=Tbb(a.k)<<16>>16;case 3:return b!=null&&Edb(ED(b))!=a.j;case 4:return b!=null&&BD(b,155).a!=a.j;default:return b==null?a.n!=null:!pb(b,a.n);}} +function nOd(a,b,c){var d,e,f,g;if(a.Fk()&&a.Ek()){g=oOd(a,BD(c,56));if(PD(g)!==PD(c)){a.Oi(b);a.Ui(b,pOd(a,b,g));if(a.rk()){f=(e=BD(c,49),a.Dk()?a.Bk()?e.ih(a.b,zUd(BD(XKd(wjd(a.b),a.aj()),18)).n,BD(XKd(wjd(a.b),a.aj()).Yj(),26).Bj(),null):e.ih(a.b,bLd(e.Tg(),zUd(BD(XKd(wjd(a.b),a.aj()),18))),null,null):e.ih(a.b,-1-a.aj(),null,null));!BD(g,49).eh()&&(f=(d=BD(g,49),a.Dk()?a.Bk()?d.gh(a.b,zUd(BD(XKd(wjd(a.b),a.aj()),18)).n,BD(XKd(wjd(a.b),a.aj()).Yj(),26).Bj(),f):d.gh(a.b,bLd(d.Tg(),zUd(BD(XKd(wjd(a.b),a.aj()),18))),null,f):d.gh(a.b,-1-a.aj(),null,f)));!!f&&f.Fi()}oid(a.b)&&a.$i(a.Zi(9,c,g,b,false));return g}}return c} +function Noc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;k=Edb(ED(vNb(a,(Nyc(),oyc))));d=Edb(ED(vNb(a,Cyc)));m=new _fd;yNb(m,oyc,k+d);j=b;r=j.d;p=j.c.i;s=j.d.i;q=G1b(p.c);t=G1b(s.c);e=new Rkb;for(l=q;l<=t;l++){h=new b0b(a);__b(h,(j0b(),g0b));yNb(h,(wtc(),$sc),j);yNb(h,Vxc,(dcd(),$bd));yNb(h,qyc,m);n=BD(Ikb(a.b,l),29);l==q?Z_b(h,n.a.c.length-c,n):$_b(h,n);u=Edb(ED(vNb(j,Zwc)));if(u<0){u=0;yNb(j,Zwc,u)}h.o.b=u;o=$wnd.Math.floor(u/2);g=new H0b;G0b(g,(Ucd(),Tcd));F0b(g,h);g.n.b=o;i=new H0b;G0b(i,zcd);F0b(i,h);i.n.b=o;RZb(j,g);f=new UZb;tNb(f,j);yNb(f,jxc,null);QZb(f,i);RZb(f,r);Ooc(h,j,f);e.c[e.c.length]=f;j=f}return e} +function sbc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;i=BD(Y_b(a,(Ucd(),Tcd)).Kc().Pb(),11).e;n=BD(Y_b(a,zcd).Kc().Pb(),11).g;h=i.c.length;t=A0b(BD(Ikb(a.j,0),11));while(h-->0){p=(tCb(0,i.c.length),BD(i.c[0],17));e=(tCb(0,n.c.length),BD(n.c[0],17));s=e.d.e;f=Jkb(s,e,0);SZb(p,e.d,f);QZb(e,null);RZb(e,null);o=p.a;b&&Dsb(o,new g7c(t));for(d=Jsb(e.a,0);d.b!=d.d.c;){c=BD(Xsb(d),8);Dsb(o,new g7c(c))}r=p.b;for(m=new olb(e.b);m.a0&&(g=$wnd.Math.max(g,IJb(a.C.b+d.d.b,e)))}else{n=m+k.d.c+a.w+d.d.b;g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(l-e)<=ple||l==e||isNaN(l)&&isNaN(e)?0:n/(e-l)))}k=d;l=e;m=f}if(!!a.C&&a.C.c>0){n=m+a.C.c;j&&(n+=k.d.c);g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(l-1)<=ple||l==1||isNaN(l)&&isNaN(1)?0:n/(1-l)))}c.n.b=0;c.a.a=g} +function NKb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;c=BD(Mpb(a.b,b),124);i=BD(BD(Qc(a.r,b),21),84);if(i.dc()){c.n.d=0;c.n.a=0;return}j=a.u.Hc((rcd(),ncd));g=0;a.A.Hc((tdd(),sdd))&&SKb(a,b);h=i.Kc();k=null;m=0;l=0;while(h.Ob()){d=BD(h.Pb(),111);f=Edb(ED(d.b.We((CKb(),BKb))));e=d.b.rf().b;if(!k){!!a.C&&a.C.d>0&&(g=$wnd.Math.max(g,IJb(a.C.d+d.d.d,f)))}else{n=l+k.d.a+a.w+d.d.d;g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(m-f)<=ple||m==f||isNaN(m)&&isNaN(f)?0:n/(f-m)))}k=d;m=f;l=e}if(!!a.C&&a.C.a>0){n=l+a.C.a;j&&(n+=k.d.a);g=$wnd.Math.max(g,(Iy(),My(ple),$wnd.Math.abs(m-1)<=ple||m==1||isNaN(m)&&isNaN(1)?0:n/(1-m)))}c.n.d=0;c.a.b=g} +function _Ec(a,b,c){var d,e,f,g,h,i;this.g=a;h=b.d.length;i=c.d.length;this.d=KC(OQ,kne,10,h+i,0,1);for(g=0;g0?ZEc(this,this.f/this.a):REc(b.g,b.d[0]).a!=null&&REc(c.g,c.d[0]).a!=null?ZEc(this,(Edb(REc(b.g,b.d[0]).a)+Edb(REc(c.g,c.d[0]).a))/2):REc(b.g,b.d[0]).a!=null?ZEc(this,REc(b.g,b.d[0]).a):REc(c.g,c.d[0]).a!=null&&ZEc(this,REc(c.g,c.d[0]).a)} +function BUb(a,b){var c,d,e,f,g,h,i,j,k,l;a.a=new dVb(oqb(t1));for(d=new olb(b.a);d.a=1){if(q-g>0&&l>=0){i.n.a+=p;i.n.b+=f*g}else if(q-g<0&&k>=0){i.n.a+=p*q;i.n.b+=f}}}a.o.a=b.a;a.o.b=b.b;yNb(a,(Nyc(),Fxc),(tdd(),d=BD(gdb(I1),9),new xqb(d,BD(_Bb(d,d.length),9),0)))} +function iFd(a,b,c,d,e,f){var g;if(!(b==null||!OEd(b,zEd,AEd))){throw vbb(new Wdb('invalid scheme: '+b))}if(!a&&!(c!=null&&hfb(c,wfb(35))==-1&&c.length>0&&(BCb(0,c.length),c.charCodeAt(0)!=47))){throw vbb(new Wdb('invalid opaquePart: '+c))}if(a&&!(b!=null&&hnb(GEd,b.toLowerCase()))&&!(c==null||!OEd(c,CEd,DEd))){throw vbb(new Wdb(mve+c))}if(a&&b!=null&&hnb(GEd,b.toLowerCase())&&!eFd(c)){throw vbb(new Wdb(mve+c))}if(!fFd(d)){throw vbb(new Wdb('invalid device: '+d))}if(!hFd(e)){g=e==null?'invalid segments: null':'invalid segment: '+VEd(e);throw vbb(new Wdb(g))}if(!(f==null||hfb(f,wfb(35))==-1)){throw vbb(new Wdb('invalid query: '+f))}} +function nVc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;Odd(b,'Calculate Graph Size',1);b.n&&!!a&&Tdd(b,i6d(a),(pgd(),mgd));h=dme;i=dme;f=ere;g=ere;for(l=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));l.e!=l.i.gc();){j=BD(Dyd(l),33);o=j.i;p=j.j;r=j.g;d=j.f;e=BD(hkd(j,(Y9c(),S8c)),142);h=$wnd.Math.min(h,o-e.b);i=$wnd.Math.min(i,p-e.d);f=$wnd.Math.max(f,o+r+e.c);g=$wnd.Math.max(g,p+d+e.a)}n=BD(hkd(a,(Y9c(),f9c)),116);m=new f7c(h-n.b,i-n.d);for(k=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));k.e!=k.i.gc();){j=BD(Dyd(k),33);dld(j,j.i-m.a);eld(j,j.j-m.b)}q=f-h+(n.b+n.c);c=g-i+(n.d+n.a);cld(a,q);ald(a,c);b.n&&!!a&&Tdd(b,i6d(a),(pgd(),mgd))} +function rGb(a){var b,c,d,e,f,g,h,i,j,k;d=new Rkb;for(g=new olb(a.e.a);g.a0){gA(a,c,0);c.a+=String.fromCharCode(d);e=lA(b,f);gA(a,c,e);f+=e-1;continue}if(d==39){if(f+11){p=KC(WD,oje,25,a.b.b.c.length,15,1);l=0;for(j=new olb(a.b.b);j.a=h&&e<=i){if(h<=e&&f<=i){c[k++]=e;c[k++]=f;d+=2}else if(h<=e){c[k++]=e;c[k++]=i;a.b[d]=i+1;g+=2}else if(f<=i){c[k++]=h;c[k++]=f;d+=2}else{c[k++]=h;c[k++]=i;a.b[d]=i+1}}else if(iQie)&&h<10);zVb(a.c,new _Ub);OUb(a);vVb(a.c);yUb(a.f)} +function sZb(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(!Ccb(DD(vNb(c,(Nyc(),fxc))))){return}for(h=new olb(c.j);h.a=2){i=Jsb(c,0);g=BD(Xsb(i),8);h=BD(Xsb(i),8);while(h.a0&&jEb(j,true,(ead(),bad));h.k==(j0b(),e0b)&&kEb(j);Rhb(a.f,h,b)}}} +function Bbc(a,b,c){var d,e,f,g,h,i,j,k,l,m;Odd(c,'Node promotion heuristic',1);a.g=b;Abc(a);a.q=BD(vNb(b,(Nyc(),rxc)),260);k=BD(vNb(a.g,qxc),19).a;f=new Jbc;switch(a.q.g){case 2:case 1:Dbc(a,f);break;case 3:a.q=(kAc(),jAc);Dbc(a,f);i=0;for(h=new olb(a.a);h.aa.j){a.q=dAc;Dbc(a,f)}break;case 4:a.q=(kAc(),jAc);Dbc(a,f);j=0;for(e=new olb(a.b);e.aa.k){a.q=gAc;Dbc(a,f)}break;case 6:m=QD($wnd.Math.ceil(a.f.length*k/100));Dbc(a,new Mbc(m));break;case 5:l=QD($wnd.Math.ceil(a.d*k/100));Dbc(a,new Pbc(l));break;default:Dbc(a,f);}Ebc(a,b);Qdd(c)} +function fFc(a,b,c){var d,e,f,g;this.j=a;this.e=WZb(a);this.o=this.j.e;this.i=!!this.o;this.p=this.i?BD(Ikb(c,Q_b(this.o).p),214):null;e=BD(vNb(a,(wtc(),Ksc)),21);this.g=e.Hc((Orc(),Hrc));this.b=new Rkb;this.d=new rHc(this.e);g=BD(vNb(this.j,jtc),230);this.q=wFc(b,g,this.e);this.k=new BGc(this);f=Ou(OC(GC(qY,1),Uhe,225,0,[this,this.d,this.k,this.q]));if(b==(rGc(),oGc)&&!Ccb(DD(vNb(a,(Nyc(),Awc))))){d=new SEc(this.e);f.c[f.c.length]=d;this.c=new uEc(d,g,BD(this.q,402))}else if(b==oGc&&Ccb(DD(vNb(a,(Nyc(),Awc))))){d=new SEc(this.e);f.c[f.c.length]=d;this.c=new XGc(d,g,BD(this.q,402))}else{this.c=new Oic(b,this)}Ekb(f,this.c);$Ic(f,this.e);this.s=AGc(this.k)} +function xUc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;l=BD(pr((g=Jsb((new ZRc(b)).a.d,0),new aSc(g))),86);o=l?BD(vNb(l,(mTc(),_Sc)),86):null;e=1;while(!!l&&!!o){i=0;u=0;c=l;d=o;for(h=0;h=a.i){++a.i;Ekb(a.a,meb(1));Ekb(a.b,k)}else{d=a.c[b.p][1];Nkb(a.a,j,meb(BD(Ikb(a.a,j),19).a+1-d));Nkb(a.b,j,Edb(ED(Ikb(a.b,j)))+k-d*a.e)}(a.q==(kAc(),dAc)&&(BD(Ikb(a.a,j),19).a>a.j||BD(Ikb(a.a,j-1),19).a>a.j)||a.q==gAc&&(Edb(ED(Ikb(a.b,j)))>a.k||Edb(ED(Ikb(a.b,j-1)))>a.k))&&(i=false);for(g=new Sr(ur(R_b(b).a.Kc(),new Sq));Qr(g);){f=BD(Rr(g),17);h=f.c.i;if(a.f[h.p]==j){l=Cbc(a,h);e=e+BD(l.a,19).a;i=i&&Ccb(DD(l.b))}}a.f[b.p]=j;e=e+a.c[b.p][0];return new vgd(meb(e),(Bcb(),i?true:false))} +function sPc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r;l=new Lqb;g=new Rkb;qPc(a,c,a.d.fg(),g,l);qPc(a,d,a.d.gg(),g,l);a.b=0.2*(p=rPc(LAb(new YAb(null,new Kub(g,16)),new xPc)),q=rPc(LAb(new YAb(null,new Kub(g,16)),new zPc)),$wnd.Math.min(p,q));f=0;for(h=0;h=2&&(r=WNc(g,true,m),!a.e&&(a.e=new ZOc(a)),VOc(a.e,r,g,a.b),undefined);uPc(g,m);wPc(g);n=-1;for(k=new olb(g);k.ah} +function k6b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;c=BD(vNb(a,(Nyc(),Vxc)),98);g=a.f;f=a.d;h=g.a+f.b+f.c;i=0-f.d-a.c.b;k=g.b+f.d+f.a-a.c.b;j=new Rkb;l=new Rkb;for(e=new olb(b);e.a0),BD(k.a.Xb(k.c=--k.b),17));while(f!=d&&k.b>0){a.a[f.p]=true;a.a[d.p]=true;f=(sCb(k.b>0),BD(k.a.Xb(k.c=--k.b),17))}k.b>0&&uib(k)}}}} +function Vmd(b,c,d){var e,f,g,h,i,j,k,l,m;if(b.a!=c.Aj()){throw vbb(new Wdb(tte+c.ne()+ute))}e=o1d((O6d(),M6d),c).$k();if(e){return e.Aj().Nh().Ih(e,d)}h=o1d(M6d,c).al();if(h){if(d==null){return null}i=BD(d,15);if(i.dc()){return ''}m=new Hfb;for(g=i.Kc();g.Ob();){f=g.Pb();Efb(m,h.Aj().Nh().Ih(h,f));m.a+=' '}return lcb(m,m.a.length-1)}l=o1d(M6d,c).bl();if(!l.dc()){for(k=l.Kc();k.Ob();){j=BD(k.Pb(),148);if(j.wj(d)){try{m=j.Aj().Nh().Ih(j,d);if(m!=null){return m}}catch(a){a=ubb(a);if(!JD(a,102))throw vbb(a)}}}throw vbb(new Wdb("Invalid value: '"+d+"' for datatype :"+c.ne()))}BD(c,834).Fj();return d==null?null:JD(d,172)?''+BD(d,172).a:rb(d)==$J?CQd(Pmd[0],BD(d,199)):fcb(d)} +function zQc(a){var b,c,d,e,f,g,h,i,j,k;j=new Psb;h=new Psb;for(f=new olb(a);f.a-1){for(e=Jsb(h,0);e.b!=e.d.c;){d=BD(Xsb(e),128);d.v=g}while(h.b!=0){d=BD(Vt(h,0),128);for(c=new olb(d.i);c.a0){c+=i.n.a+i.o.a/2;++l}for(o=new olb(i.j);o.a0&&(c/=l);r=KC(UD,Vje,25,d.a.c.length,15,1);h=0;for(j=new olb(d.a);j.a=h&&e<=i){if(h<=e&&f<=i){d+=2}else if(h<=e){a.b[d]=i+1;g+=2}else if(f<=i){c[k++]=e;c[k++]=h-1;d+=2}else{c[k++]=e;c[k++]=h-1;a.b[d]=i+1;g+=2}}else if(i0?(e-=86400000):(e+=86400000);i=new gB(wbb(Cbb(b.q.getTime()),e))}k=new Vfb;j=a.a.length;for(f=0;f=97&&d<=122||d>=65&&d<=90){for(g=f+1;g=j){throw vbb(new Wdb("Missing trailing '"))}g+10&&c.c==0){!b&&(b=new Rkb);b.c[b.c.length]=c}}if(b){while(b.c.length!=0){c=BD(Kkb(b,0),233);if(!!c.b&&c.b.c.length>0){for(f=(!c.b&&(c.b=new Rkb),new olb(c.b));f.aJkb(a,c,0)){return new vgd(e,c)}}else if(Edb(REc(e.g,e.d[0]).a)>Edb(REc(c.g,c.d[0]).a)){return new vgd(e,c)}}}for(h=(!c.e&&(c.e=new Rkb),c.e).Kc();h.Ob();){g=BD(h.Pb(),233);i=(!g.b&&(g.b=new Rkb),g.b);wCb(0,i.c.length);aCb(i.c,0,c);g.c==i.c.length&&(b.c[b.c.length]=g,true)}}}return null} +function wlb(a,b){var c,d,e,f,g,h,i,j,k;if(a==null){return Xhe}i=b.a.zc(a,b);if(i!=null){return '[...]'}c=new xwb(She,'[',']');for(e=a,f=0,g=e.length;f=14&&k<=16))){if(b.a._b(d)){!c.a?(c.a=new Wfb(c.d)):Qfb(c.a,c.b);Nfb(c.a,'[...]')}else{h=CD(d);j=new Vqb(b);uwb(c,wlb(h,j))}}else JD(d,177)?uwb(c,Xlb(BD(d,177))):JD(d,190)?uwb(c,Qlb(BD(d,190))):JD(d,195)?uwb(c,Rlb(BD(d,195))):JD(d,2012)?uwb(c,Wlb(BD(d,2012))):JD(d,48)?uwb(c,Ulb(BD(d,48))):JD(d,364)?uwb(c,Vlb(BD(d,364))):JD(d,832)?uwb(c,Tlb(BD(d,832))):JD(d,104)&&uwb(c,Slb(BD(d,104)))}else{uwb(c,d==null?Xhe:fcb(d))}}return !c.a?c.c:c.e.length==0?c.a.a:c.a.a+(''+c.e)} +function xQb(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;h=itd(b,false,false);r=ofd(h);d&&(r=w7c(r));t=Edb(ED(hkd(b,(CPb(),vPb))));q=(sCb(r.b!=0),BD(r.a.a.c,8));l=BD(Ut(r,1),8);if(r.b>2){k=new Rkb;Gkb(k,new Jib(r,1,r.b));f=sQb(k,t+a.a);s=new XOb(f);tNb(s,b);c.c[c.c.length]=s}else{d?(s=BD(Ohb(a.b,jtd(b)),266)):(s=BD(Ohb(a.b,ltd(b)),266))}i=jtd(b);d&&(i=ltd(b));g=zQb(q,i);j=t+a.a;if(g.a){j+=$wnd.Math.abs(q.b-l.b);p=new f7c(l.a,(l.b+q.b)/2)}else{j+=$wnd.Math.abs(q.a-l.a);p=new f7c((l.a+q.a)/2,l.b)}d?Rhb(a.d,b,new ZOb(s,g,p,j)):Rhb(a.c,b,new ZOb(s,g,p,j));Rhb(a.b,b,s);o=(!b.n&&(b.n=new cUd(D2,b,1,7)),b.n);for(n=new Fyd(o);n.e!=n.i.gc();){m=BD(Dyd(n),137);e=wQb(a,m,true,0,0);c.c[c.c.length]=e}} +function wPc(a){var b,c,d,e,f,g,h,i,j,k;j=new Rkb;h=new Rkb;for(g=new olb(a);g.a-1){for(f=new olb(h);f.a0){continue}rOc(i,$wnd.Math.min(i.o,e.o-1));qOc(i,i.i-1);i.i==0&&(h.c[h.c.length]=i,true)}}}} +function QQd(a,b,c){var d,e,f,g,h,i,j;j=a.c;!b&&(b=FQd);a.c=b;if((a.Db&4)!=0&&(a.Db&1)==0){i=new nSd(a,1,2,j,a.c);!c?(c=i):c.Ei(i)}if(j!=b){if(JD(a.Cb,284)){if(a.Db>>16==-10){c=BD(a.Cb,284).nk(b,c)}else if(a.Db>>16==-15){!b&&(b=(jGd(),YFd));!j&&(j=(jGd(),YFd));if(a.Cb.nh()){i=new pSd(a.Cb,1,13,j,b,HLd(QSd(BD(a.Cb,59)),a),false);!c?(c=i):c.Ei(i)}}}else if(JD(a.Cb,88)){if(a.Db>>16==-23){JD(b,88)||(b=(jGd(),_Fd));JD(j,88)||(j=(jGd(),_Fd));if(a.Cb.nh()){i=new pSd(a.Cb,1,10,j,b,HLd(VKd(BD(a.Cb,26)),a),false);!c?(c=i):c.Ei(i)}}}else if(JD(a.Cb,444)){h=BD(a.Cb,836);g=(!h.b&&(h.b=new RYd(new NYd)),h.b);for(f=(d=new nib((new eib(g.a)).a),new ZYd(d));f.a.b;){e=BD(lib(f.a).cd(),87);c=QQd(e,MQd(e,h),c)}}}return c} +function O1b(a,b){var c,d,e,f,g,h,i,j,k,l,m;g=Ccb(DD(hkd(a,(Nyc(),fxc))));m=BD(hkd(a,Yxc),21);i=false;j=false;l=new Fyd((!a.c&&(a.c=new cUd(F2,a,9,9)),a.c));while(l.e!=l.i.gc()&&(!i||!j)){f=BD(Dyd(l),118);h=0;for(e=ul(pl(OC(GC(KI,1),Uhe,20,0,[(!f.d&&(f.d=new y5d(B2,f,8,5)),f.d),(!f.e&&(f.e=new y5d(B2,f,7,4)),f.e)])));Qr(e);){d=BD(Rr(e),79);k=g&&Qld(d)&&Ccb(DD(hkd(d,gxc)));c=ELd((!d.b&&(d.b=new y5d(z2,d,4,7)),d.b),f)?a==Xod(atd(BD(qud((!d.c&&(d.c=new y5d(z2,d,5,8)),d.c),0),82))):a==Xod(atd(BD(qud((!d.b&&(d.b=new y5d(z2,d,4,7)),d.b),0),82)));if(k||c){++h;if(h>1){break}}}h>0?(i=true):m.Hc((rcd(),ncd))&&(!f.n&&(f.n=new cUd(D2,f,1,7)),f.n).i>0&&(i=true);h>1&&(j=true)}i&&b.Fc((Orc(),Hrc));j&&b.Fc((Orc(),Irc))} +function zfd(a){var b,c,d,e,f,g,h,i,j,k,l,m;m=BD(hkd(a,(Y9c(),Y8c)),21);if(m.dc()){return null}h=0;g=0;if(m.Hc((tdd(),rdd))){k=BD(hkd(a,t9c),98);d=2;c=2;e=2;f=2;b=!Xod(a)?BD(hkd(a,z8c),103):BD(hkd(Xod(a),z8c),103);for(j=new Fyd((!a.c&&(a.c=new cUd(F2,a,9,9)),a.c));j.e!=j.i.gc();){i=BD(Dyd(j),118);l=BD(hkd(i,A9c),61);if(l==(Ucd(),Scd)){l=lfd(i,b);jkd(i,A9c,l)}if(k==(dcd(),$bd)){switch(l.g){case 1:d=$wnd.Math.max(d,i.i+i.g);break;case 2:c=$wnd.Math.max(c,i.j+i.f);break;case 3:e=$wnd.Math.max(e,i.i+i.g);break;case 4:f=$wnd.Math.max(f,i.j+i.f);}}else{switch(l.g){case 1:d+=i.g+2;break;case 2:c+=i.f+2;break;case 3:e+=i.g+2;break;case 4:f+=i.f+2;}}}h=$wnd.Math.max(d,e);g=$wnd.Math.max(c,f)}return Afd(a,h,g,true,true)} +function lnc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;s=BD(GAb(VAb(JAb(new YAb(null,new Kub(b.d,16)),new pnc(c)),new rnc(c)),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)]))),15);l=Ohe;k=Rie;for(i=new olb(b.b.j);i.a0;if(j){if(j){m=r.p;g?++m:--m;l=BD(Ikb(r.c.a,m),10);d=I4b(l);n=!(s6c(d,w,c[0])||n6c(d,w,c[0]))}}else{n=true}}o=false;v=b.D.i;if(!!v&&!!v.c&&h.e){k=g&&v.p>0||!g&&v.p0&&(b.a+=She,b);yfd(BD(Dyd(h),160),b)}b.a+=gne;i=new Oyd((!d.c&&(d.c=new y5d(z2,d,5,8)),d.c));while(i.e!=i.i.gc()){i.e>0&&(b.a+=She,b);yfd(BD(Dyd(i),160),b)}b.a+=')'}}} +function y2b(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;f=BD(vNb(a,(wtc(),$sc)),79);if(!f){return}d=a.a;e=new g7c(c);P6c(e,C2b(a));if(f_b(a.d.i,a.c.i)){m=a.c;l=l7c(OC(GC(m1,1),nie,8,0,[m.n,m.a]));c7c(l,c)}else{l=A0b(a.c)}Gsb(d,l,d.a,d.a.a);n=A0b(a.d);vNb(a,utc)!=null&&P6c(n,BD(vNb(a,utc),8));Gsb(d,n,d.c.b,d.c);q7c(d,e);g=itd(f,true,true);kmd(g,BD(qud((!f.b&&(f.b=new y5d(z2,f,4,7)),f.b),0),82));lmd(g,BD(qud((!f.c&&(f.c=new y5d(z2,f,5,8)),f.c),0),82));ifd(d,g);for(k=new olb(a.b);k.a=0){i=null;h=new Bib(k.a,j+1);while(h.bg?1:Ny(isNaN(0),isNaN(g)))<0&&(null,My(Jqe),($wnd.Math.abs(g-1)<=Jqe||g==1||isNaN(g)&&isNaN(1)?0:g<1?-1:g>1?1:Ny(isNaN(g),isNaN(1)))<0)&&(null,My(Jqe),($wnd.Math.abs(0-h)<=Jqe||0==h||isNaN(0)&&isNaN(h)?0:0h?1:Ny(isNaN(0),isNaN(h)))<0)&&(null,My(Jqe),($wnd.Math.abs(h-1)<=Jqe||h==1||isNaN(h)&&isNaN(1)?0:h<1?-1:h>1?1:Ny(isNaN(h),isNaN(1)))<0));return f} +function z6d(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(l=new usb(new nsb(a));l.b!=l.c.a.d;){k=tsb(l);h=BD(k.d,56);b=BD(k.e,56);g=h.Tg();for(p=0,u=(g.i==null&&TKd(g),g.i).length;p=0&&p=j.c.c.length?(k=JJc((j0b(),h0b),g0b)):(k=JJc((j0b(),g0b),g0b));k*=2;f=c.a.g;c.a.g=$wnd.Math.max(f,f+(k-f));g=c.b.g;c.b.g=$wnd.Math.max(g,g+(k-g));e=b}}} +function VNc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;v=Hx(a);k=new Rkb;h=a.c.length;l=h-1;m=h+1;while(v.a.c!=0){while(c.b!=0){t=(sCb(c.b!=0),BD(Nsb(c,c.a.a),112));Jwb(v.a,t)!=null;t.g=l--;YNc(t,b,c,d)}while(b.b!=0){u=(sCb(b.b!=0),BD(Nsb(b,b.a.a),112));Jwb(v.a,u)!=null;u.g=m++;YNc(u,b,c,d)}j=Rie;for(r=(g=new Ywb((new cxb((new Gjb(v.a)).a)).b),new Njb(g));sib(r.a.a);){q=(f=Wwb(r.a),BD(f.cd(),112));if(!d&&q.b>0&&q.a<=0){k.c=KC(SI,Uhe,1,0,5,1);k.c[k.c.length]=q;break}p=q.i-q.d;if(p>=j){if(p>j){k.c=KC(SI,Uhe,1,0,5,1);j=p}k.c[k.c.length]=q}}if(k.c.length!=0){i=BD(Ikb(k,Bub(e,k.c.length)),112);Jwb(v.a,i)!=null;i.g=m++;YNc(i,b,c,d);k.c=KC(SI,Uhe,1,0,5,1)}}s=a.c.length+1;for(o=new olb(a);o.a0){m.d+=k.n.d;m.d+=k.d}if(m.a>0){m.a+=k.n.a;m.a+=k.d}if(m.b>0){m.b+=k.n.b;m.b+=k.d}if(m.c>0){m.c+=k.n.c;m.c+=k.d}return m} +function d6b(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;m=c.d;l=c.c;f=new f7c(c.f.a+c.d.b+c.d.c,c.f.b+c.d.d+c.d.a);g=f.b;for(j=new olb(a.a);j.a0){a.c[b.c.p][b.p].d+=Cub(a.i,24)*lke*0.07000000029802322-0.03500000014901161;a.c[b.c.p][b.p].a=a.c[b.c.p][b.p].d/a.c[b.c.p][b.p].b}} +function m5b(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(o=new olb(a);o.ad.d;d.d=$wnd.Math.max(d.d,b);if(h&&c){d.d=$wnd.Math.max(d.d,d.a);d.a=d.d+e}break;case 3:c=b>d.a;d.a=$wnd.Math.max(d.a,b);if(h&&c){d.a=$wnd.Math.max(d.a,d.d);d.d=d.a+e}break;case 2:c=b>d.c;d.c=$wnd.Math.max(d.c,b);if(h&&c){d.c=$wnd.Math.max(d.b,d.c);d.b=d.c+e}break;case 4:c=b>d.b;d.b=$wnd.Math.max(d.b,b);if(h&&c){d.b=$wnd.Math.max(d.b,d.c);d.c=d.b+e}}}}} +function l3b(a){var b,c,d,e,f,g,h,i,j,k,l;for(j=new olb(a);j.a0||k.j==Tcd&&k.e.c.length-k.g.c.length<0)){b=false;break}for(e=new olb(k.g);e.a=j&&v>=q){m+=o.n.b+p.n.b+p.a.b-u;++h}}}}if(c){for(g=new olb(s.e);g.a=j&&v>=q){m+=o.n.b+p.n.b+p.a.b-u;++h}}}}}if(h>0){w+=m/h;++n}}if(n>0){b.a=e*w/n;b.g=n}else{b.a=0;b.g=0}} +function oMc(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(e=new olb(a.a.b);e.aQje||b.o==cMc&&k0&&dld(r,u*w);v>0&&eld(r,v*A)}stb(a.b,new CQb);b=new Rkb;for(h=new nib((new eib(a.c)).a);h.b;){g=lib(h);d=BD(g.cd(),79);c=BD(g.dd(),395).a;e=itd(d,false,false);l=oQb(jtd(d),ofd(e),c);ifd(l,e);t=ktd(d);if(!!t&&Jkb(b,t,0)==-1){b.c[b.c.length]=t;pQb(t,(sCb(l.b!=0),BD(l.a.a.c,8)),c)}}for(q=new nib((new eib(a.d)).a);q.b;){p=lib(q);d=BD(p.cd(),79);c=BD(p.dd(),395).a;e=itd(d,false,false);l=oQb(ltd(d),w7c(ofd(e)),c);l=w7c(l);ifd(l,e);t=mtd(d);if(!!t&&Jkb(b,t,0)==-1){b.c[b.c.length]=t;pQb(t,(sCb(l.b!=0),BD(l.c.b.c,8)),c)}}} +function _Vc(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B;if(c.c.length!=0){o=new Rkb;for(n=new olb(c);n.a1){n=new ZQc(o,t,d);reb(t,new PQc(a,n));g.c[g.c.length]=n;for(l=t.a.ec().Kc();l.Ob();){k=BD(l.Pb(),46);Lkb(f,k.b)}}if(h.a.gc()>1){n=new ZQc(o,h,d);reb(h,new RQc(a,n));g.c[g.c.length]=n;for(l=h.a.ec().Kc();l.Ob();){k=BD(l.Pb(),46);Lkb(f,k.b)}}}} +function $Wc(a){r4c(a,new E3c(L3c(P3c(M3c(O3c(N3c(new R3c,sre),'ELK Radial'),'A radial layout provider which is based on the algorithm of Peter Eades published in "Drawing free trees.", published by International Institute for Advanced Study of Social Information Science, Fujitsu Limited in 1991. The radial layouter takes a tree and places the nodes in radial order around the root. The nodes of the same tree level are placed on the same radius.'),new bXc),sre)));p4c(a,sre,uqe,Ksd(UWc));p4c(a,sre,wme,Ksd(XWc));p4c(a,sre,Fme,Ksd(NWc));p4c(a,sre,Tme,Ksd(OWc));p4c(a,sre,Eme,Ksd(PWc));p4c(a,sre,Gme,Ksd(MWc));p4c(a,sre,Dme,Ksd(QWc));p4c(a,sre,Hme,Ksd(TWc));p4c(a,sre,ore,Ksd(KWc));p4c(a,sre,nre,Ksd(LWc));p4c(a,sre,rre,Ksd(RWc));p4c(a,sre,lre,Ksd(SWc));p4c(a,sre,mre,Ksd(VWc));p4c(a,sre,pre,Ksd(WWc));p4c(a,sre,qre,Ksd(YWc))} +function LIb(a){var b;this.r=Cy(new OIb,new SIb);this.b=new Rpb(BD(Qb(F1),290));this.p=new Rpb(BD(Qb(F1),290));this.i=new Rpb(BD(Qb(DN),290));this.e=a;this.o=new g7c(a.rf());this.D=a.Df()||Ccb(DD(a.We((Y9c(),M8c))));this.A=BD(a.We((Y9c(),Y8c)),21);this.B=BD(a.We(b9c),21);this.q=BD(a.We(t9c),98);this.u=BD(a.We(x9c),21);if(!ucd(this.u)){throw vbb(new y2c('Invalid port label placement: '+this.u))}this.v=Ccb(DD(a.We(z9c)));this.j=BD(a.We(W8c),21);if(!Jbd(this.j)){throw vbb(new y2c('Invalid node label placement: '+this.j))}this.n=BD(bgd(a,U8c),116);this.k=Edb(ED(bgd(a,Q9c)));this.d=Edb(ED(bgd(a,P9c)));this.w=Edb(ED(bgd(a,X9c)));this.s=Edb(ED(bgd(a,R9c)));this.t=Edb(ED(bgd(a,S9c)));this.C=BD(bgd(a,V9c),142);this.c=2*this.d;b=!this.B.Hc((Idd(),zdd));this.f=new mIb(0,b,0);this.g=new mIb(1,b,0);lIb(this.f,(gHb(),eHb),this.g)} +function Lgd(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D;t=0;o=0;n=0;m=1;for(s=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));s.e!=s.i.gc();){q=BD(Dyd(s),33);m+=sr(new Sr(ur(_sd(q).a.Kc(),new Sq)));B=q.g;o=$wnd.Math.max(o,B);l=q.f;n=$wnd.Math.max(n,l);t+=B*l}p=(!a.a&&(a.a=new cUd(E2,a,10,11)),a.a).i;g=t+2*d*d*m*p;f=$wnd.Math.sqrt(g);i=$wnd.Math.max(f*c,o);h=$wnd.Math.max(f/c,n);for(r=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));r.e!=r.i.gc();){q=BD(Dyd(r),33);C=e.b+(Cub(b,26)*ike+Cub(b,27)*jke)*(i-q.g);D=e.b+(Cub(b,26)*ike+Cub(b,27)*jke)*(h-q.f);dld(q,C);eld(q,D)}A=i+(e.b+e.c);w=h+(e.d+e.a);for(v=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));v.e!=v.i.gc();){u=BD(Dyd(v),33);for(k=new Sr(ur(_sd(u).a.Kc(),new Sq));Qr(k);){j=BD(Rr(k),79);Pld(j)||Kgd(j,b,A,w)}}A+=e.b+e.c;w+=e.d+e.a;Afd(a,A,w,false,true)} +function Jcb(a){var b,c,d,e,f,g,h,i,j,k,l;if(a==null){throw vbb(new Oeb(Xhe))}j=a;f=a.length;i=false;if(f>0){b=(BCb(0,a.length),a.charCodeAt(0));if(b==45||b==43){a=a.substr(1);--f;i=b==45}}if(f==0){throw vbb(new Oeb(Oje+j+'"'))}while(a.length>0&&(BCb(0,a.length),a.charCodeAt(0)==48)){a=a.substr(1);--f}if(f>(Neb(),Leb)[10]){throw vbb(new Oeb(Oje+j+'"'))}for(e=0;e0){l=-parseInt(a.substr(0,d),10);a=a.substr(d);f-=d;c=false}while(f>=g){d=parseInt(a.substr(0,g),10);a=a.substr(g);f-=g;if(c){c=false}else{if(ybb(l,h)<0){throw vbb(new Oeb(Oje+j+'"'))}l=Ibb(l,k)}l=Qbb(l,d)}if(ybb(l,0)>0){throw vbb(new Oeb(Oje+j+'"'))}if(!i){l=Jbb(l);if(ybb(l,0)<0){throw vbb(new Oeb(Oje+j+'"'))}}return l} +function Z6d(a,b){X6d();var c,d,e,f,g,h,i;this.a=new a7d(this);this.b=a;this.c=b;this.f=c2d(q1d((O6d(),M6d),b));if(this.f.dc()){if((h=t1d(M6d,a))==b){this.e=true;this.d=new Rkb;this.f=new oFd;this.f.Fc(Ewe);BD(V1d(p1d(M6d,bKd(a)),''),26)==a&&this.f.Fc(u1d(M6d,bKd(a)));for(e=g1d(M6d,a).Kc();e.Ob();){d=BD(e.Pb(),170);switch($1d(q1d(M6d,d))){case 4:{this.d.Fc(d);break}case 5:{this.f.Gc(c2d(q1d(M6d,d)));break}}}}else{Q6d();if(BD(b,66).Oj()){this.e=true;this.f=null;this.d=new Rkb;for(g=0,i=(a.i==null&&TKd(a),a.i).length;g=0&&g0&&(BD(Mpb(a.b,b),124).a.b=c)} +function b3b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;Odd(b,'Comment pre-processing',1);c=0;i=new olb(a.a);while(i.a0){j=(BCb(0,c.length),c.charCodeAt(0));if(j!=64){if(j==37){m=c.lastIndexOf('%');k=false;if(m!=0&&(m==n-1||(k=(BCb(m+1,c.length),c.charCodeAt(m+1)==46)))){h=c.substr(1,m-1);u=dfb('%',h)?null:QEd(h);e=0;if(k){try{e=Icb(c.substr(m+2),Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){i=a;throw vbb(new rFd(i))}else throw vbb(a)}}for(r=pRd(b.Wg());r.Ob();){p=MRd(r);if(JD(p,510)){f=BD(p,590);t=f.d;if((u==null?t==null:dfb(u,t))&&e--==0){return f}}}return null}}l=c.lastIndexOf('.');o=l==-1?c:c.substr(0,l);d=0;if(l!=-1){try{d=Icb(c.substr(l+1),Rie,Ohe)}catch(a){a=ubb(a);if(JD(a,127)){o=c}else throw vbb(a)}}o=dfb('%',o)?null:QEd(o);for(q=pRd(b.Wg());q.Ob();){p=MRd(q);if(JD(p,191)){g=BD(p,191);s=g.ne();if((o==null?s==null:dfb(o,s))&&d--==0){return g}}}return null}}return rid(b,c)} +function f6b(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F;w=new Rkb;for(o=new olb(a.b);o.a=b.length)return {done:true};var a=b[d++];return {value:[a,c.get(a)],done:false}}}};if(!xrb()){e.prototype.createObject=function(){return {}};e.prototype.get=function(a){return this.obj[':'+a]};e.prototype.set=function(a,b){this.obj[':'+a]=b};e.prototype[hke]=function(a){delete this.obj[':'+a]};e.prototype.keys=function(){var a=[];for(var b in this.obj){b.charCodeAt(0)==58&&a.push(b.substring(1))}return a}}return e} +function cde(a){ade();var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(a==null)return null;l=a.length*8;if(l==0){return ''}h=l%24;n=l/24|0;m=h!=0?n+1:n;f=null;f=KC(TD,$ie,25,m*4,15,1);j=0;k=0;b=0;c=0;d=0;g=0;e=0;for(i=0;i>24;j=(b&3)<<24>>24;o=(b&-128)==0?b>>2<<24>>24:(b>>2^192)<<24>>24;p=(c&-128)==0?c>>4<<24>>24:(c>>4^240)<<24>>24;q=(d&-128)==0?d>>6<<24>>24:(d>>6^252)<<24>>24;f[g++]=_ce[o];f[g++]=_ce[p|j<<4];f[g++]=_ce[k<<2|q];f[g++]=_ce[d&63]}if(h==8){b=a[e];j=(b&3)<<24>>24;o=(b&-128)==0?b>>2<<24>>24:(b>>2^192)<<24>>24;f[g++]=_ce[o];f[g++]=_ce[j<<4];f[g++]=61;f[g++]=61}else if(h==16){b=a[e];c=a[e+1];k=(c&15)<<24>>24;j=(b&3)<<24>>24;o=(b&-128)==0?b>>2<<24>>24:(b>>2^192)<<24>>24;p=(c&-128)==0?c>>4<<24>>24:(c>>4^240)<<24>>24;f[g++]=_ce[o];f[g++]=_ce[p|j<<4];f[g++]=_ce[k<<2];f[g++]=61}return zfb(f,0,f.length)} +function mB(a,b){var c,d,e,f,g,h,i;a.e==0&&a.p>0&&(a.p=-(a.p-1));a.p>Rie&&dB(b,a.p-nje);g=b.q.getDate();ZA(b,1);a.k>=0&&aB(b,a.k);if(a.c>=0){ZA(b,a.c)}else if(a.k>=0){i=new fB(b.q.getFullYear()-nje,b.q.getMonth(),35);d=35-i.q.getDate();ZA(b,$wnd.Math.min(d,g))}else{ZA(b,g)}a.f<0&&(a.f=b.q.getHours());a.b>0&&a.f<12&&(a.f+=12);$A(b,a.f==24&&a.g?0:a.f);a.j>=0&&_A(b,a.j);a.n>=0&&bB(b,a.n);a.i>=0&&cB(b,wbb(Ibb(Abb(Cbb(b.q.getTime()),_ie),_ie),a.i));if(a.a){e=new eB;dB(e,e.q.getFullYear()-nje-80);Gbb(Cbb(b.q.getTime()),Cbb(e.q.getTime()))&&dB(b,e.q.getFullYear()-nje+100)}if(a.d>=0){if(a.c==-1){c=(7+a.d-b.q.getDay())%7;c>3&&(c-=7);h=b.q.getMonth();ZA(b,b.q.getDate()+c);b.q.getMonth()!=h&&ZA(b,b.q.getDate()+(c>0?-7:7))}else{if(b.q.getDay()!=a.d){return false}}}if(a.o>Rie){f=b.q.getTimezoneOffset();cB(b,wbb(Cbb(b.q.getTime()),(a.o-f)*60*_ie))}return true} +function z2b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;e=vNb(b,(wtc(),$sc));if(!JD(e,239)){return}o=BD(e,33);p=b.e;m=new g7c(b.c);f=b.d;m.a+=f.b;m.b+=f.d;u=BD(hkd(o,(Nyc(),Ixc)),174);if(uqb(u,(Idd(),Add))){n=BD(hkd(o,Kxc),116);w_b(n,f.a);z_b(n,f.d);x_b(n,f.b);y_b(n,f.c)}c=new Rkb;for(k=new olb(b.a);k.a0&&Ekb(a.p,k);Ekb(a.o,k)}b-=d;n=i+b;j+=b*a.e;Nkb(a.a,h,meb(n));Nkb(a.b,h,j);a.j=$wnd.Math.max(a.j,n);a.k=$wnd.Math.max(a.k,j);a.d+=b;b+=p}} +function Ucd(){Ucd=ccb;var a;Scd=new Ycd(ole,0);Acd=new Ycd(xle,1);zcd=new Ycd(yle,2);Rcd=new Ycd(zle,3);Tcd=new Ycd(Ale,4);Fcd=(mmb(),new zob((a=BD(gdb(F1),9),new xqb(a,BD(_Bb(a,a.length),9),0))));Gcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[])));Bcd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[])));Ocd=Up(qqb(Rcd,OC(GC(F1,1),bne,61,0,[])));Qcd=Up(qqb(Tcd,OC(GC(F1,1),bne,61,0,[])));Lcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[Rcd])));Ecd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[Tcd])));Ncd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[Tcd])));Hcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd])));Pcd=Up(qqb(Rcd,OC(GC(F1,1),bne,61,0,[Tcd])));Ccd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[Rcd])));Kcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd,Tcd])));Dcd=Up(qqb(zcd,OC(GC(F1,1),bne,61,0,[Rcd,Tcd])));Mcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[Rcd,Tcd])));Icd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd,Rcd])));Jcd=Up(qqb(Acd,OC(GC(F1,1),bne,61,0,[zcd,Rcd,Tcd])))} +function fSc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;if(b.b!=0){n=new Psb;h=null;o=null;d=QD($wnd.Math.floor($wnd.Math.log(b.b)*$wnd.Math.LOG10E)+1);i=0;for(t=Jsb(b,0);t.b!=t.d.c;){r=BD(Xsb(t),86);if(PD(o)!==PD(vNb(r,(mTc(),$Sc)))){o=GD(vNb(r,$Sc));i=0}o!=null?(h=o+iSc(i++,d)):(h=iSc(i++,d));yNb(r,$Sc,h);for(q=(e=Jsb((new ZRc(r)).a.d,0),new aSc(e));Wsb(q.a);){p=BD(Xsb(q.a),188).c;Gsb(n,p,n.c.b,n.c);yNb(p,$Sc,h)}}m=new Lqb;for(g=0;g=i){sCb(r.b>0);r.a.Xb(r.c=--r.b);break}else if(p.a>j){if(!e){Ekb(p.b,l);p.c=$wnd.Math.min(p.c,j);p.a=$wnd.Math.max(p.a,i);e=p}else{Gkb(e.b,p.b);e.a=$wnd.Math.max(e.a,p.a);uib(r)}}}if(!e){e=new TCc;e.c=j;e.a=i;Aib(r,e);Ekb(e.b,l)}}h=b.b;k=0;for(q=new olb(d);q.ah?1:0}if(a.b){a.b._b(f)&&(e=BD(a.b.xc(f),19).a);a.b._b(i)&&(h=BD(a.b.xc(i),19).a)}return eh?1:0}return b.e.c.length!=0&&c.g.c.length!=0?1:-1} +function acc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A;Odd(b,Ine,1);p=new Rkb;w=new Rkb;for(j=new olb(a.b);j.a0&&(t-=n);h_b(g,t);k=0;for(m=new olb(g.a);m.a0);h.a.Xb(h.c=--h.b)}i=0.4*d*k;!f&&h.bb.d.c){n=a.c[b.a.d];q=a.c[l.a.d];if(n==q){continue}AFb(DFb(CFb(EFb(BFb(new FFb,1),100),n),q))}}}}}}} +function QEd(a){IEd();var b,c,d,e,f,g,h,i;if(a==null)return null;e=hfb(a,wfb(37));if(e<0){return a}else{i=new Wfb(a.substr(0,e));b=KC(SD,wte,25,4,15,1);h=0;d=0;for(g=a.length;ee+2&&_Ed((BCb(e+1,a.length),a.charCodeAt(e+1)),xEd,yEd)&&_Ed((BCb(e+2,a.length),a.charCodeAt(e+2)),xEd,yEd)){c=dFd((BCb(e+1,a.length),a.charCodeAt(e+1)),(BCb(e+2,a.length),a.charCodeAt(e+2)));e+=2;if(d>0){(c&192)==128?(b[h++]=c<<24>>24):(d=0)}else if(c>=128){if((c&224)==192){b[h++]=c<<24>>24;d=2}else if((c&240)==224){b[h++]=c<<24>>24;d=3}else if((c&248)==240){b[h++]=c<<24>>24;d=4}}if(d>0){if(h==d){switch(h){case 2:{Kfb(i,((b[0]&31)<<6|b[1]&63)&aje);break}case 3:{Kfb(i,((b[0]&15)<<12|(b[1]&63)<<6|b[2]&63)&aje);break}}h=0;d=0}}else{for(f=0;f0){if(g+d>a.length){return false}h=rA(a.substr(0,g+d),b)}else{h=rA(a,b)}}switch(f){case 71:h=oA(a,g,OC(GC(ZI,1),nie,2,6,[pje,qje]),b);e.e=h;return true;case 77:return zA(a,b,e,h,g);case 76:return BA(a,b,e,h,g);case 69:return xA(a,b,g,e);case 99:return AA(a,b,g,e);case 97:h=oA(a,g,OC(GC(ZI,1),nie,2,6,['AM','PM']),b);e.b=h;return true;case 121:return DA(a,b,g,h,c,e);case 100:if(h<=0){return false}e.c=h;return true;case 83:if(h<0){return false}return yA(h,g,b[0],e);case 104:h==12&&(h=0);case 75:case 72:if(h<0){return false}e.f=h;e.g=false;return true;case 107:if(h<0){return false}e.f=h;e.g=true;return true;case 109:if(h<0){return false}e.j=h;return true;case 115:if(h<0){return false}e.n=h;return true;case 90:if(gw&&(o.c=w-o.b);Ekb(g.d,new BLb(o,bLb(g,o)));s=b==Acd?$wnd.Math.max(s,p.b+j.b.rf().b):$wnd.Math.min(s,p.b)}s+=b==Acd?a.t:-a.t;t=cLb((g.e=s,g));t>0&&(BD(Mpb(a.b,b),124).a.b=t);for(k=m.Kc();k.Ob();){j=BD(k.Pb(),111);if(!j.c||j.c.d.c.length<=0){continue}o=j.c.i;o.c-=j.e.a;o.d-=j.e.b}} +function SPb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;b=new Lqb;for(i=new Fyd(a);i.e!=i.i.gc();){h=BD(Dyd(i),33);c=new Tqb;Rhb(OPb,h,c);n=new aQb;e=BD(GAb(new YAb(null,new Lub(new Sr(ur($sd(h).a.Kc(),new Sq)))),Wyb(n,Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[(Fyb(),Dyb)])))),83);RPb(c,BD(e.xc((Bcb(),true)),14),new cQb);d=BD(GAb(JAb(BD(e.xc(false),15).Lc(),new eQb),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[Dyb]))),15);for(g=d.Kc();g.Ob();){f=BD(g.Pb(),79);m=ktd(f);if(m){j=BD(Wd(irb(b.f,m)),21);if(!j){j=UPb(m);jrb(b.f,m,j)}ye(c,j)}}e=BD(GAb(new YAb(null,new Lub(new Sr(ur(_sd(h).a.Kc(),new Sq)))),Wyb(n,Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[Dyb])))),83);RPb(c,BD(e.xc(true),14),new gQb);d=BD(GAb(JAb(BD(e.xc(false),15).Lc(),new iQb),Byb(new fzb,new dzb,new Ezb,OC(GC(xL,1),Kie,132,0,[Dyb]))),15);for(l=d.Kc();l.Ob();){k=BD(l.Pb(),79);m=mtd(k);if(m){j=BD(Wd(irb(b.f,m)),21);if(!j){j=UPb(m);jrb(b.f,m,j)}ye(c,j)}}}} +function rhb(a,b){phb();var c,d,e,f,g,h,i,j,k,l,m,n,o,p;i=ybb(a,0)<0;i&&(a=Jbb(a));if(ybb(a,0)==0){switch(b){case 0:return '0';case 1:return $je;case 2:return '0.00';case 3:return '0.000';case 4:return '0.0000';case 5:return '0.00000';case 6:return '0.000000';default:n=new Ufb;b<0?(n.a+='0E+',n):(n.a+='0E',n);n.a+=b==Rie?'2147483648':''+-b;return n.a;}}k=18;l=KC(TD,$ie,25,k+1,15,1);c=k;p=a;do{j=p;p=Abb(p,10);l[--c]=Tbb(wbb(48,Qbb(j,Ibb(p,10))))&aje}while(ybb(p,0)!=0);e=Qbb(Qbb(Qbb(k,c),b),1);if(b==0){i&&(l[--c]=45);return zfb(l,c,k-c)}if(b>0&&ybb(e,-6)>=0){if(ybb(e,0)>=0){f=c+Tbb(e);for(h=k-1;h>=f;h--){l[h+1]=l[h]}l[++f]=46;i&&(l[--c]=45);return zfb(l,c,k-c+1)}for(g=2;Gbb(g,wbb(Jbb(e),1));g++){l[--c]=48}l[--c]=46;l[--c]=48;i&&(l[--c]=45);return zfb(l,c,k-c)}o=c+1;d=k;m=new Vfb;i&&(m.a+='-',m);if(d-o>=1){Kfb(m,l[c]);m.a+='.';m.a+=zfb(l,c+1,k-c-1)}else{m.a+=zfb(l,c,k-c)}m.a+='E';ybb(e,0)>0&&(m.a+='+',m);m.a+=''+Ubb(e);return m.a} +function iQc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;a.e.a.$b();a.f.a.$b();a.c.c=KC(SI,Uhe,1,0,5,1);a.i.c=KC(SI,Uhe,1,0,5,1);a.g.a.$b();if(b){for(g=new olb(b.a);g.a=1){if(v-j>0&&o>=0){dld(l,l.i+u);eld(l,l.j+i*j)}else if(v-j<0&&n>=0){dld(l,l.i+u*v);eld(l,l.j+i)}}}}jkd(a,(Y9c(),Y8c),(tdd(),f=BD(gdb(I1),9),new xqb(f,BD(_Bb(f,f.length),9),0)));return new f7c(w,k)} +function Yfd(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;n=Xod(atd(BD(qud((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b),0),82)));o=Xod(atd(BD(qud((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c),0),82)));l=n==o;h=new d7c;b=BD(hkd(a,(Zad(),Sad)),74);if(!!b&&b.b>=2){if((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i==0){c=(Fhd(),e=new rmd,e);wtd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a),c)}else if((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a).i>1){m=new Oyd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a));while(m.e!=m.i.gc()){Eyd(m)}}ifd(b,BD(qud((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a),0),202))}if(l){for(d=new Fyd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a));d.e!=d.i.gc();){c=BD(Dyd(d),202);for(j=new Fyd((!c.a&&(c.a=new xMd(y2,c,5)),c.a));j.e!=j.i.gc();){i=BD(Dyd(j),469);h.a=$wnd.Math.max(h.a,i.a);h.b=$wnd.Math.max(h.b,i.b)}}}for(g=new Fyd((!a.n&&(a.n=new cUd(D2,a,1,7)),a.n));g.e!=g.i.gc();){f=BD(Dyd(g),137);k=BD(hkd(f,Yad),8);!!k&&bld(f,k.a,k.b);if(l){h.a=$wnd.Math.max(h.a,f.i+f.g);h.b=$wnd.Math.max(h.b,f.j+f.f)}}return h} +function yMc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B;t=b.c.length;e=new ULc(a.a,c,null,null);B=KC(UD,Vje,25,t,15,1);p=KC(UD,Vje,25,t,15,1);o=KC(UD,Vje,25,t,15,1);q=0;for(h=0;hB[i]&&(q=i);for(l=new olb(a.a.b);l.an){if(f){Fsb(w,m);Fsb(B,meb(j.b-1))}H=c.b;I+=m+b;m=0;k=$wnd.Math.max(k,c.b+c.c+G)}dld(h,H);eld(h,I);k=$wnd.Math.max(k,H+G+c.c);m=$wnd.Math.max(m,l);H+=G+b}k=$wnd.Math.max(k,d);F=I+m+c.a;if(Fqme;C=$wnd.Math.abs(m.b-o.b)>qme;(!c&&B&&C||c&&(B||C))&&Dsb(q.a,u)}ye(q.a,d);d.b==0?(m=u):(m=(sCb(d.b!=0),BD(d.c.b.c,8)));bZb(n,l,p);if(AZb(e)==A){if(Q_b(A.i)!=e.a){p=new d7c;Y$b(p,Q_b(A.i),s)}yNb(q,utc,p)}cZb(n,q,s);k.a.zc(n,k)}QZb(q,v);RZb(q,A)}for(j=k.a.ec().Kc();j.Ob();){i=BD(j.Pb(),17);QZb(i,null);RZb(i,null)}Qdd(b)} +function KQb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;if(a.gc()==1){return BD(a.Xb(0),231)}else if(a.gc()<=0){return new kRb}for(e=a.Kc();e.Ob();){c=BD(e.Pb(),231);o=0;k=Ohe;l=Ohe;i=Rie;j=Rie;for(n=new olb(c.e);n.ah){t=0;u+=g+r;g=0}JQb(p,c,t,u);b=$wnd.Math.max(b,t+q.a);g=$wnd.Math.max(g,q.b);t+=q.a+r}return p} +function Ioc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=new s7c;switch(a.a.g){case 3:m=BD(vNb(b.e,(wtc(),rtc)),15);n=BD(vNb(b.j,rtc),15);o=BD(vNb(b.f,rtc),15);c=BD(vNb(b.e,ptc),15);d=BD(vNb(b.j,ptc),15);e=BD(vNb(b.f,ptc),15);g=new Rkb;Gkb(g,m);n.Jc(new Loc);Gkb(g,JD(n,152)?km(BD(n,152)):JD(n,131)?BD(n,131).a:JD(n,54)?new ov(n):new dv(n));Gkb(g,o);f=new Rkb;Gkb(f,c);Gkb(f,JD(d,152)?km(BD(d,152)):JD(d,131)?BD(d,131).a:JD(d,54)?new ov(d):new dv(d));Gkb(f,e);yNb(b.f,rtc,g);yNb(b.f,ptc,f);yNb(b.f,stc,b.f);yNb(b.e,rtc,null);yNb(b.e,ptc,null);yNb(b.j,rtc,null);yNb(b.j,ptc,null);break;case 1:ye(k,b.e.a);Dsb(k,b.i.n);ye(k,Su(b.j.a));Dsb(k,b.a.n);ye(k,b.f.a);break;default:ye(k,b.e.a);ye(k,Su(b.j.a));ye(k,b.f.a);}Osb(b.f.a);ye(b.f.a,k);QZb(b.f,b.e.c);h=BD(vNb(b.e,(Nyc(),jxc)),74);j=BD(vNb(b.j,jxc),74);i=BD(vNb(b.f,jxc),74);if(!!h||!!j||!!i){l=new s7c;Goc(l,i);Goc(l,j);Goc(l,h);yNb(b.f,jxc,l)}QZb(b.j,null);RZb(b.j,null);QZb(b.e,null);RZb(b.e,null);$_b(b.a,null);$_b(b.i,null);!!b.g&&Ioc(a,b.g)} +function bde(a){ade();var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(a==null)return null;f=rfb(a);o=ede(f);if(o%4!=0){return null}p=o/4|0;if(p==0)return KC(SD,wte,25,0,15,1);l=null;b=0;c=0;d=0;e=0;g=0;h=0;i=0;j=0;n=0;m=0;k=0;l=KC(SD,wte,25,p*3,15,1);for(;n>4)<<24>>24;l[m++]=((c&15)<<4|d>>2&15)<<24>>24;l[m++]=(d<<6|e)<<24>>24}if(!dde(g=f[k++])||!dde(h=f[k++])){return null}b=$ce[g];c=$ce[h];i=f[k++];j=f[k++];if($ce[i]==-1||$ce[j]==-1){if(i==61&&j==61){if((c&15)!=0)return null;q=KC(SD,wte,25,n*3+1,15,1);$fb(l,0,q,0,n*3);q[m]=(b<<2|c>>4)<<24>>24;return q}else if(i!=61&&j==61){d=$ce[i];if((d&3)!=0)return null;q=KC(SD,wte,25,n*3+2,15,1);$fb(l,0,q,0,n*3);q[m++]=(b<<2|c>>4)<<24>>24;q[m]=((c&15)<<4|d>>2&15)<<24>>24;return q}else{return null}}else{d=$ce[i];e=$ce[j];l[m++]=(b<<2|c>>4)<<24>>24;l[m++]=((c&15)<<4|d>>2&15)<<24>>24;l[m++]=(d<<6|e)<<24>>24}return l} +function Sbc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;Odd(b,Ine,1);o=BD(vNb(a,(Nyc(),Swc)),218);for(e=new olb(a.b);e.a=2){p=true;m=new olb(f.j);c=BD(mlb(m),11);n=null;while(m.a0){e=BD(Ikb(q.c.a,w-1),10);g=a.i[e.p];B=$wnd.Math.ceil(jBc(a.n,e,q));f=v.a.e-q.d.d-(g.a.e+e.o.b+e.d.a)-B}j=Pje;if(w0&&A.a.e.e-A.a.a-(A.b.e.e-A.b.a)<0;o=t.a.e.e-t.a.a-(t.b.e.e-t.b.a)<0&&A.a.e.e-A.a.a-(A.b.e.e-A.b.a)>0;n=t.a.e.e+t.b.aA.b.e.e+A.a.a;u=0;!p&&!o&&(m?f+l>0?(u=l):j-d>0&&(u=d):n&&(f+h>0?(u=h):j-s>0&&(u=s)));v.a.e+=u;v.b&&(v.d.e+=u);return false} +function XGb(a,b,c){var d,e,f,g,h,i,j,k,l,m;d=new J6c(b.qf().a,b.qf().b,b.rf().a,b.rf().b);e=new I6c;if(a.c){for(g=new olb(b.wf());g.aj&&(d.a+=yfb(KC(TD,$ie,25,-j,15,1)));d.a+='Is';if(hfb(i,wfb(32))>=0){for(e=0;e=d.o.b/2}else{s=!l}if(s){r=BD(vNb(d,(wtc(),vtc)),15);if(!r){f=new Rkb;yNb(d,vtc,f)}else if(m){f=r}else{e=BD(vNb(d,tsc),15);if(!e){f=new Rkb;yNb(d,tsc,f)}else{r.gc()<=e.gc()?(f=r):(f=e)}}}else{e=BD(vNb(d,(wtc(),tsc)),15);if(!e){f=new Rkb;yNb(d,tsc,f)}else if(l){f=e}else{r=BD(vNb(d,vtc),15);if(!r){f=new Rkb;yNb(d,vtc,f)}else{e.gc()<=r.gc()?(f=e):(f=r)}}}f.Fc(a);yNb(a,(wtc(),vsc),c);if(b.d==c){RZb(b,null);c.e.c.length+c.g.c.length==0&&F0b(c,null);d3b(c)}else{QZb(b,null);c.e.c.length+c.g.c.length==0&&F0b(c,null)}Osb(b.a)} +function aoc(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;s=new Bib(a.b,0);k=b.Kc();o=0;j=BD(k.Pb(),19).a;v=0;c=new Tqb;A=new zsb;while(s.b=a.a){d=E6b(a,s);k=$wnd.Math.max(k,d.b);u=$wnd.Math.max(u,d.d);Ekb(h,new vgd(s,d))}}B=new Rkb;for(j=0;j0),q.a.Xb(q.c=--q.b),C=new H1b(a.b),Aib(q,C),sCb(q.b0){j=0;!!q&&(j+=h);j+=(C-1)*g;!!t&&(j+=h);B&&!!t&&(j=$wnd.Math.max(j,jQc(t,g,s,A)));if(j0){m=k<100?null:new Ixd(k);j=new Aud(b);o=j.g;r=KC(WD,oje,25,k,15,1);d=0;u=new zud(k);for(e=0;e=0;){if(n!=null?pb(n,o[i]):PD(n)===PD(o[i])){if(r.length<=d){q=r;r=KC(WD,oje,25,2*r.length,15,1);$fb(q,0,r,0,d)}r[d++]=e;wtd(u,o[i]);break v}}n=n;if(PD(n)===PD(h)){break}}}j=u;o=u.g;k=d;if(d>r.length){q=r;r=KC(WD,oje,25,d,15,1);$fb(q,0,r,0,d)}if(d>0){t=true;for(f=0;f=0;){tud(a,r[g])}if(d!=k){for(e=k;--e>=d;){tud(j,e)}q=r;r=KC(WD,oje,25,d,15,1);$fb(q,0,r,0,d)}b=j}}}else{b=Ctd(a,b);for(e=a.i;--e>=0;){if(b.Hc(a.g[e])){tud(a,e);t=true}}}if(t){if(r!=null){c=b.gc();l=c==1?FLd(a,4,b.Kc().Pb(),null,r[0],p):FLd(a,6,b,r,r[0],p);m=c<100?null:new Ixd(c);for(e=b.Kc();e.Ob();){n=e.Pb();m=Q2d(a,BD(n,72),m)}if(!m){Uhd(a.e,l)}else{m.Ei(l);m.Fi()}}else{m=Vxd(b.gc());for(e=b.Kc();e.Ob();){n=e.Pb();m=Q2d(a,BD(n,72),m)}!!m&&m.Fi()}return true}else{return false}} +function fYb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;c=new mYb(b);c.a||$Xb(b);j=ZXb(b);i=new Hp;q=new AYb;for(p=new olb(b.a);p.a0||c.o==dMc&&e0){l=BD(Ikb(m.c.a,g-1),10);B=jBc(a.b,m,l);q=m.n.b-m.d.d-(l.n.b+l.o.b+l.d.a+B)}else{q=m.n.b-m.d.d}j=$wnd.Math.min(q,j);if(gg?Anc(a,b,c):Anc(a,c,b);return eg?1:0}}d=BD(vNb(b,(wtc(),Zsc)),19).a;f=BD(vNb(c,Zsc),19).a;d>f?Anc(a,b,c):Anc(a,c,b);return df?1:0} +function u2c(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(Ccb(DD(hkd(b,(Y9c(),d9c))))){return mmb(),mmb(),jmb}j=(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a).i!=0;l=s2c(b);k=!l.dc();if(j||k){e=BD(hkd(b,F9c),149);if(!e){throw vbb(new y2c('Resolved algorithm is not set; apply a LayoutAlgorithmResolver before computing layout.'))}s=D3c(e,(Csd(),ysd));q2c(b);if(!j&&k&&!s){return mmb(),mmb(),jmb}i=new Rkb;if(PD(hkd(b,J8c))===PD((hbd(),ebd))&&(D3c(e,vsd)||D3c(e,usd))){n=p2c(a,b);o=new Psb;ye(o,(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a));while(o.b!=0){m=BD(o.b==0?null:(sCb(o.b!=0),Nsb(o,o.a.a)),33);q2c(m);r=PD(hkd(m,J8c))===PD(gbd);if(r||ikd(m,o8c)&&!C3c(e,hkd(m,F9c))){h=u2c(a,m,c,d);Gkb(i,h);jkd(m,J8c,gbd);hfd(m)}else{ye(o,(!m.a&&(m.a=new cUd(E2,m,10,11)),m.a))}}}else{n=(!b.a&&(b.a=new cUd(E2,b,10,11)),b.a).i;for(g=new Fyd((!b.a&&(b.a=new cUd(E2,b,10,11)),b.a));g.e!=g.i.gc();){f=BD(Dyd(g),33);h=u2c(a,f,c,d);Gkb(i,h);hfd(f)}}for(q=new olb(i);q.a=0?(n=Zcd(h)):(n=Wcd(Zcd(h)));a.Ye($xc,n)}j=new d7c;m=false;if(a.Xe(Txc)){a7c(j,BD(a.We(Txc),8));m=true}else{_6c(j,g.a/2,g.b/2)}switch(n.g){case 4:yNb(k,mxc,(Ctc(),ytc));yNb(k,Bsc,(Gqc(),Fqc));k.o.b=g.b;p<0&&(k.o.a=-p);G0b(l,(Ucd(),zcd));m||(j.a=g.a);j.a-=g.a;break;case 2:yNb(k,mxc,(Ctc(),Atc));yNb(k,Bsc,(Gqc(),Dqc));k.o.b=g.b;p<0&&(k.o.a=-p);G0b(l,(Ucd(),Tcd));m||(j.a=0);break;case 1:yNb(k,Osc,(esc(),dsc));k.o.a=g.a;p<0&&(k.o.b=-p);G0b(l,(Ucd(),Rcd));m||(j.b=g.b);j.b-=g.b;break;case 3:yNb(k,Osc,(esc(),bsc));k.o.a=g.a;p<0&&(k.o.b=-p);G0b(l,(Ucd(),Acd));m||(j.b=0);}a7c(l.n,j);yNb(k,Txc,j);if(b==Zbd||b==_bd||b==$bd){o=0;if(b==Zbd&&a.Xe(Wxc)){switch(n.g){case 1:case 2:o=BD(a.We(Wxc),19).a;break;case 3:case 4:o=-BD(a.We(Wxc),19).a;}}else{switch(n.g){case 4:case 2:o=f.b;b==_bd&&(o/=e.b);break;case 1:case 3:o=f.a;b==_bd&&(o/=e.a);}}yNb(k,htc,o)}yNb(k,Hsc,n);return k} +function AGc(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C;c=Edb(ED(vNb(a.a.j,(Nyc(),Ewc))));if(c<-1||!a.a.i||ecd(BD(vNb(a.a.o,Vxc),98))||V_b(a.a.o,(Ucd(),zcd)).gc()<2&&V_b(a.a.o,Tcd).gc()<2){return true}if(a.a.c.Rf()){return false}v=0;u=0;t=new Rkb;for(i=a.a.e,j=0,k=i.length;j=c} +function ovd(){mvd();function h(f){var g=this;this.dispatch=function(a){var b=a.data;switch(b.cmd){case 'algorithms':var c=pvd((mmb(),new lnb(new $ib(lvd.b))));f.postMessage({id:b.id,data:c});break;case 'categories':var d=pvd((mmb(),new lnb(new $ib(lvd.c))));f.postMessage({id:b.id,data:d});break;case 'options':var e=pvd((mmb(),new lnb(new $ib(lvd.d))));f.postMessage({id:b.id,data:e});break;case 'register':svd(b.algorithms);f.postMessage({id:b.id});break;case 'layout':qvd(b.graph,b.layoutOptions||{},b.options||{});f.postMessage({id:b.id,data:b.graph});break;}};this.saveDispatch=function(b){try{g.dispatch(b)}catch(a){f.postMessage({id:b.data.id,error:a})}}} +function j(b){var c=this;this.dispatcher=new h({postMessage:function(a){c.onmessage({data:a})}});this.postMessage=function(a){setTimeout(function(){c.dispatcher.saveDispatch({data:a})},0)}} +if(typeof document===uke&&typeof self!==uke){var i=new h(self);self.onmessage=i.saveDispatch}else if(typeof module!==uke&&module.exports){Object.defineProperty(exports,'__esModule',{value:true});module.exports={'default':j,Worker:j}}} +function aae(a){if(a.N)return;a.N=true;a.b=Lnd(a,0);Knd(a.b,0);Knd(a.b,1);Knd(a.b,2);a.bb=Lnd(a,1);Knd(a.bb,0);Knd(a.bb,1);a.fb=Lnd(a,2);Knd(a.fb,3);Knd(a.fb,4);Qnd(a.fb,5);a.qb=Lnd(a,3);Knd(a.qb,0);Qnd(a.qb,1);Qnd(a.qb,2);Knd(a.qb,3);Knd(a.qb,4);Qnd(a.qb,5);Knd(a.qb,6);a.a=Mnd(a,4);a.c=Mnd(a,5);a.d=Mnd(a,6);a.e=Mnd(a,7);a.f=Mnd(a,8);a.g=Mnd(a,9);a.i=Mnd(a,10);a.j=Mnd(a,11);a.k=Mnd(a,12);a.n=Mnd(a,13);a.o=Mnd(a,14);a.p=Mnd(a,15);a.q=Mnd(a,16);a.s=Mnd(a,17);a.r=Mnd(a,18);a.t=Mnd(a,19);a.u=Mnd(a,20);a.v=Mnd(a,21);a.w=Mnd(a,22);a.B=Mnd(a,23);a.A=Mnd(a,24);a.C=Mnd(a,25);a.D=Mnd(a,26);a.F=Mnd(a,27);a.G=Mnd(a,28);a.H=Mnd(a,29);a.J=Mnd(a,30);a.I=Mnd(a,31);a.K=Mnd(a,32);a.M=Mnd(a,33);a.L=Mnd(a,34);a.P=Mnd(a,35);a.Q=Mnd(a,36);a.R=Mnd(a,37);a.S=Mnd(a,38);a.T=Mnd(a,39);a.U=Mnd(a,40);a.V=Mnd(a,41);a.X=Mnd(a,42);a.W=Mnd(a,43);a.Y=Mnd(a,44);a.Z=Mnd(a,45);a.$=Mnd(a,46);a._=Mnd(a,47);a.ab=Mnd(a,48);a.cb=Mnd(a,49);a.db=Mnd(a,50);a.eb=Mnd(a,51);a.gb=Mnd(a,52);a.hb=Mnd(a,53);a.ib=Mnd(a,54);a.jb=Mnd(a,55);a.kb=Mnd(a,56);a.lb=Mnd(a,57);a.mb=Mnd(a,58);a.nb=Mnd(a,59);a.ob=Mnd(a,60);a.pb=Mnd(a,61)} +function f5b(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;s=0;if(b.f.a==0){for(q=new olb(a);q.aj&&(tCb(j,b.c.length),BD(b.c[j],200)).a.c.length==0){Lkb(b,(tCb(j,b.c.length),b.c[j]))}}if(!i){--f;continue}if(uZc(b,k,e,i,m,c,j,d)){l=true;continue}if(m){if(vZc(b,k,e,i,c,j,d)){l=true;continue}else if(wZc(k,e)){e.c=true;l=true;continue}}else if(wZc(k,e)){e.c=true;l=true;continue}if(l){continue}}if(wZc(k,e)){e.c=true;l=true;!!i&&(i.k=false);continue}else{a$c(e.q)}}return l} +function fed(a,b,c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I;p=0;D=0;for(j=new olb(a.b);j.ap){if(f){Fsb(w,n);Fsb(B,meb(k.b-1));Ekb(a.d,o);h.c=KC(SI,Uhe,1,0,5,1)}H=c.b;I+=n+b;n=0;l=$wnd.Math.max(l,c.b+c.c+G)}h.c[h.c.length]=i;ued(i,H,I);l=$wnd.Math.max(l,H+G+c.c);n=$wnd.Math.max(n,m);H+=G+b;o=i}Gkb(a.a,h);Ekb(a.d,BD(Ikb(h,h.c.length-1),157));l=$wnd.Math.max(l,d);F=I+n+c.a;if(F1&&(g=$wnd.Math.min(g,$wnd.Math.abs(BD(Ut(h.a,1),8).b-k.b)))}}}}}else{for(p=new olb(b.j);p.ae){f=m.a-e;g=Ohe;d.c=KC(SI,Uhe,1,0,5,1);e=m.a}if(m.a>=e){d.c[d.c.length]=h;h.a.b>1&&(g=$wnd.Math.min(g,$wnd.Math.abs(BD(Ut(h.a,h.a.b-2),8).b-m.b)))}}}}}if(d.c.length!=0&&f>b.o.a/2&&g>b.o.b/2){n=new H0b;F0b(n,b);G0b(n,(Ucd(),Acd));n.n.a=b.o.a/2;r=new H0b;F0b(r,b);G0b(r,Rcd);r.n.a=b.o.a/2;r.n.b=b.o.b;for(i=new olb(d);i.a=j.b?QZb(h,r):QZb(h,n)}else{j=BD(Msb(h.a),8);q=h.a.b==0?A0b(h.c):BD(Isb(h.a),8);q.b>=j.b?RZb(h,r):RZb(h,n)}l=BD(vNb(h,(Nyc(),jxc)),74);!!l&&ze(l,j,true)}b.n.a=e-b.o.a/2}} +function erd(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I,J,K;D=null;G=b;F=Rqd(a,dtd(c),G);Lkd(F,_pd(G,Vte));H=BD(oo(a.g,Vpd(aC(G,Cte))),33);m=aC(G,'sourcePort');d=null;!!m&&(d=Vpd(m));I=BD(oo(a.j,d),118);if(!H){h=Wpd(G);o="An edge must have a source node (edge id: '"+h;p=o+$te;throw vbb(new cqd(p))}if(!!I&&!Hb(mpd(I),H)){i=_pd(G,Vte);q="The source port of an edge must be a port of the edge's source node (edge id: '"+i;r=q+$te;throw vbb(new cqd(r))}B=(!F.b&&(F.b=new y5d(z2,F,4,7)),F.b);f=null;I?(f=I):(f=H);wtd(B,f);J=BD(oo(a.g,Vpd(aC(G,bue))),33);n=aC(G,'targetPort');e=null;!!n&&(e=Vpd(n));K=BD(oo(a.j,e),118);if(!J){l=Wpd(G);s="An edge must have a target node (edge id: '"+l;t=s+$te;throw vbb(new cqd(t))}if(!!K&&!Hb(mpd(K),J)){j=_pd(G,Vte);u="The target port of an edge must be a port of the edge's target node (edge id: '"+j;v=u+$te;throw vbb(new cqd(v))}C=(!F.c&&(F.c=new y5d(z2,F,5,8)),F.c);g=null;K?(g=K):(g=J);wtd(C,g);if((!F.b&&(F.b=new y5d(z2,F,4,7)),F.b).i==0||(!F.c&&(F.c=new y5d(z2,F,5,8)),F.c).i==0){k=_pd(G,Vte);w=Zte+k;A=w+$te;throw vbb(new cqd(A))}grd(G,F);frd(G,F);D=crd(a,G,F);return D} +function DXb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D;l=FXb(zXb(a,(Ucd(),Fcd)),b);o=EXb(zXb(a,Gcd),b);u=EXb(zXb(a,Ocd),b);B=GXb(zXb(a,Qcd),b);m=GXb(zXb(a,Bcd),b);s=EXb(zXb(a,Ncd),b);p=EXb(zXb(a,Hcd),b);w=EXb(zXb(a,Pcd),b);v=EXb(zXb(a,Ccd),b);C=GXb(zXb(a,Ecd),b);r=EXb(zXb(a,Lcd),b);t=EXb(zXb(a,Kcd),b);A=EXb(zXb(a,Dcd),b);D=GXb(zXb(a,Mcd),b);n=GXb(zXb(a,Icd),b);q=EXb(zXb(a,Jcd),b);c=w6c(OC(GC(UD,1),Vje,25,15,[s.a,B.a,w.a,D.a]));d=w6c(OC(GC(UD,1),Vje,25,15,[o.a,l.a,u.a,q.a]));e=r.a;f=w6c(OC(GC(UD,1),Vje,25,15,[p.a,m.a,v.a,n.a]));j=w6c(OC(GC(UD,1),Vje,25,15,[s.b,o.b,p.b,t.b]));i=w6c(OC(GC(UD,1),Vje,25,15,[B.b,l.b,m.b,q.b]));k=C.b;h=w6c(OC(GC(UD,1),Vje,25,15,[w.b,u.b,v.b,A.b]));vXb(zXb(a,Fcd),c+e,j+k);vXb(zXb(a,Jcd),c+e,j+k);vXb(zXb(a,Gcd),c+e,0);vXb(zXb(a,Ocd),c+e,j+k+i);vXb(zXb(a,Qcd),0,j+k);vXb(zXb(a,Bcd),c+e+d,j+k);vXb(zXb(a,Hcd),c+e+d,0);vXb(zXb(a,Pcd),0,j+k+i);vXb(zXb(a,Ccd),c+e+d,j+k+i);vXb(zXb(a,Ecd),0,j);vXb(zXb(a,Lcd),c,0);vXb(zXb(a,Dcd),0,j+k+i);vXb(zXb(a,Icd),c+e+d,0);g=new d7c;g.a=w6c(OC(GC(UD,1),Vje,25,15,[c+d+e+f,C.a,t.a,A.a]));g.b=w6c(OC(GC(UD,1),Vje,25,15,[j+i+k+h,r.b,D.b,n.b]));return g} +function Ngc(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;p=new Rkb;for(m=new olb(a.d.b);m.ae.d.d+e.d.a){k.f.d=true}else{k.f.d=true;k.f.a=true}}}d.b!=d.d.c&&(b=c)}if(k){f=BD(Ohb(a.f,g.d.i),57);if(b.bf.d.d+f.d.a){k.f.d=true}else{k.f.d=true;k.f.a=true}}}}for(h=new Sr(ur(R_b(n).a.Kc(),new Sq));Qr(h);){g=BD(Rr(h),17);if(g.a.b!=0){b=BD(Isb(g.a),8);if(g.d.j==(Ucd(),Acd)){q=new hic(b,new f7c(b.a,e.d.d),e,g);q.f.a=true;q.a=g.d;p.c[p.c.length]=q}if(g.d.j==Rcd){q=new hic(b,new f7c(b.a,e.d.d+e.d.a),e,g);q.f.d=true;q.a=g.d;p.c[p.c.length]=q}}}}}return p} +function WJc(a,b,c){var d,e,f,g,h,i,j,k,l;Odd(c,'Network simplex node placement',1);a.e=b;a.n=BD(vNb(b,(wtc(),otc)),304);VJc(a);HJc(a);MAb(LAb(new YAb(null,new Kub(a.e.b,16)),new KKc),new MKc(a));MAb(JAb(LAb(JAb(LAb(new YAb(null,new Kub(a.e.b,16)),new zLc),new BLc),new DLc),new FLc),new IKc(a));if(Ccb(DD(vNb(a.e,(Nyc(),Axc))))){g=Udd(c,1);Odd(g,'Straight Edges Pre-Processing',1);UJc(a);Qdd(g)}JFb(a.f);f=BD(vNb(b,Ayc),19).a*a.f.a.c.length;uGb(HGb(IGb(LGb(a.f),f),false),Udd(c,1));if(a.d.a.gc()!=0){g=Udd(c,1);Odd(g,'Flexible Where Space Processing',1);h=BD(Btb(RAb(NAb(new YAb(null,new Kub(a.f.a,16)),new OKc),new iKc)),19).a;i=BD(Btb(QAb(NAb(new YAb(null,new Kub(a.f.a,16)),new QKc),new mKc)),19).a;j=i-h;k=nGb(new pGb,a.f);l=nGb(new pGb,a.f);AFb(DFb(CFb(BFb(EFb(new FFb,20000),j),k),l));MAb(JAb(JAb(Plb(a.i),new SKc),new UKc),new WKc(h,k,j,l));for(e=a.d.a.ec().Kc();e.Ob();){d=BD(e.Pb(),213);d.g=1}uGb(HGb(IGb(LGb(a.f),f),false),Udd(g,1));Qdd(g)}if(Ccb(DD(vNb(b,Axc)))){g=Udd(c,1);Odd(g,'Straight Edges Post-Processing',1);TJc(a);Qdd(g)}GJc(a);a.e=null;a.f=null;a.i=null;a.c=null;Uhb(a.k);a.j=null;a.a=null;a.o=null;a.d.a.$b();Qdd(c)} +function lMc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;for(h=new olb(a.a.b);h.a0){d=l.gc();j=QD($wnd.Math.floor((d+1)/2))-1;e=QD($wnd.Math.ceil((d+1)/2))-1;if(b.o==dMc){for(k=e;k>=j;k--){if(b.a[u.p]==u){p=BD(l.Xb(k),46);o=BD(p.a,10);if(!Rqb(c,p.b)&&n>a.b.e[o.p]){b.a[o.p]=u;b.g[u.p]=b.g[o.p];b.a[u.p]=b.g[u.p];b.f[b.g[u.p].p]=(Bcb(),Ccb(b.f[b.g[u.p].p])&u.k==(j0b(),g0b)?true:false);n=a.b.e[o.p]}}}}else{for(k=j;k<=e;k++){if(b.a[u.p]==u){r=BD(l.Xb(k),46);q=BD(r.a,10);if(!Rqb(c,r.b)&&n=o){if(s>o){n.c=KC(SI,Uhe,1,0,5,1);o=s}n.c[n.c.length]=g}}if(n.c.length!=0){m=BD(Ikb(n,Bub(b,n.c.length)),128);F.a.Bc(m)!=null;m.s=p++;AQc(m,C,w);n.c=KC(SI,Uhe,1,0,5,1)}}u=a.c.length+1;for(h=new olb(a);h.aD.s){uib(c);Lkb(D.i,d);if(d.c>0){d.a=D;Ekb(D.t,d);d.b=A;Ekb(A.i,d)}}}}} +function qde(a){var b,c,d,e,f;b=a.c;switch(b){case 11:return a.Ml();case 12:return a.Ol();case 14:return a.Ql();case 15:return a.Tl();case 16:return a.Rl();case 17:return a.Ul();case 21:nde(a);return wfe(),wfe(),ffe;case 10:switch(a.a){case 65:return a.yl();case 90:return a.Dl();case 122:return a.Kl();case 98:return a.El();case 66:return a.zl();case 60:return a.Jl();case 62:return a.Hl();}}f=pde(a);b=a.c;switch(b){case 3:return a.Zl(f);case 4:return a.Xl(f);case 5:return a.Yl(f);case 0:if(a.a==123&&a.d=48&&b<=57){d=b-48;while(e=48&&b<=57){d=d*10+b-48;if(d<0)throw vbb(new mde(tvd((h0d(),bve))))}}else{throw vbb(new mde(tvd((h0d(),Zue))))}c=d;if(b==44){if(e>=a.j){throw vbb(new mde(tvd((h0d(),_ue))))}else if((b=bfb(a.i,e++))>=48&&b<=57){c=b-48;while(e=48&&b<=57){c=c*10+b-48;if(c<0)throw vbb(new mde(tvd((h0d(),bve))))}if(d>c)throw vbb(new mde(tvd((h0d(),ave))))}else{c=-1}}if(b!=125)throw vbb(new mde(tvd((h0d(),$ue))));if(a.sl(e)){f=(wfe(),wfe(),++vfe,new lge(9,f));a.d=e+1}else{f=(wfe(),wfe(),++vfe,new lge(3,f));a.d=e}f.dm(d);f.cm(c);nde(a)}}return f} +function $bc(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F;p=new Skb(b.b);u=new Skb(b.b);m=new Skb(b.b);B=new Skb(b.b);q=new Skb(b.b);for(A=Jsb(b,0);A.b!=A.d.c;){v=BD(Xsb(A),11);for(h=new olb(v.g);h.a0;r=v.g.c.length>0;j&&r?(m.c[m.c.length]=v,true):j?(p.c[p.c.length]=v,true):r&&(u.c[u.c.length]=v,true)}for(o=new olb(p);o.a1){o=new Oyd((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a));while(o.e!=o.i.gc()){Eyd(o)}}g=BD(qud((!a.a&&(a.a=new cUd(A2,a,6,6)),a.a),0),202);q=H;H>v+u?(q=v+u):Hw+p?(r=w+p):Iv-u&&qw-p&&rH+G?(B=H+G):vI+A?(C=I+A):wH-G&&BI-A&&Cc&&(m=c-1);n=N+Cub(b,24)*lke*l-l/2;n<0?(n=1):n>d&&(n=d-1);e=(Fhd(),i=new xkd,i);vkd(e,m);wkd(e,n);wtd((!g.a&&(g.a=new xMd(y2,g,5)),g.a),e)}} +function Nyc(){Nyc=ccb;iyc=(Y9c(),I9c);jyc=J9c;kyc=K9c;lyc=L9c;nyc=M9c;oyc=N9c;ryc=P9c;tyc=R9c;uyc=S9c;syc=Q9c;vyc=T9c;xyc=U9c;zyc=X9c;qyc=O9c;hyc=(jwc(),Bvc);myc=Cvc;pyc=Dvc;wyc=Evc;byc=new Osd(D9c,meb(0));cyc=yvc;dyc=zvc;eyc=Avc;Kyc=awc;Cyc=Hvc;Dyc=Kvc;Gyc=Svc;Eyc=Nvc;Fyc=Pvc;Myc=fwc;Lyc=cwc;Iyc=Yvc;Hyc=Wvc;Jyc=$vc;Cxc=pvc;Dxc=qvc;Xwc=Auc;Ywc=Duc;Lxc=new q0b(12);Kxc=new Osd(f9c,Lxc);Twc=(Aad(),wad);Swc=new Osd(E8c,Twc);Uxc=new Osd(s9c,0);fyc=new Osd(E9c,meb(1));owc=new Osd(r8c,tme);Jxc=d9c;Vxc=t9c;$xc=A9c;Kwc=y8c;mwc=p8c;axc=J8c;gyc=new Osd(H9c,(Bcb(),true));fxc=M8c;gxc=N8c;Fxc=Y8c;Ixc=b9c;Gxc=$8c;Nwc=(ead(),cad);Lwc=new Osd(z8c,Nwc);xxc=W8c;wxc=U8c;Yxc=x9c;Xxc=w9c;Zxc=z9c;Oxc=(Tbd(),Sbd);new Osd(l9c,Oxc);Qxc=o9c;Rxc=p9c;Sxc=q9c;Pxc=n9c;Byc=Gvc;sxc=avc;rxc=$uc;Ayc=Fvc;mxc=Suc;Jwc=muc;Iwc=kuc;Awc=Xtc;Bwc=Ytc;Dwc=buc;Cwc=Ztc;Hwc=iuc;uxc=cvc;vxc=dvc;ixc=Luc;Exc=uvc;zxc=hvc;$wc=Guc;Bxc=nvc;Vwc=wuc;Wwc=yuc;zwc=w8c;yxc=evc;swc=Mtc;rwc=Ktc;qwc=Jtc;cxc=Juc;bxc=Iuc;dxc=Kuc;Hxc=_8c;jxc=Q8c;Zwc=G8c;Qwc=C8c;Pwc=B8c;Ewc=euc;Wxc=v9c;pwc=v8c;exc=L8c;Txc=r9c;Mxc=h9c;Nxc=j9c;oxc=Vuc;pxc=Xuc;ayc=C9c;nwc=Itc;qxc=Zuc;Rwc=suc;Owc=quc;txc=S8c;kxc=Puc;Axc=kvc;yyc=V9c;Mwc=ouc;_xc=wvc;Uwc=uuc;lxc=Ruc;Fwc=guc;hxc=P8c;nxc=Uuc;Gwc=huc;ywc=Vtc;wwc=Stc;uwc=Qtc;vwc=Rtc;xwc=Utc;twc=Otc;_wc=Huc} +function shb(a,b){phb();var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;B=a.e;o=a.d;e=a.a;if(B==0){switch(b){case 0:return '0';case 1:return $je;case 2:return '0.00';case 3:return '0.000';case 4:return '0.0000';case 5:return '0.00000';case 6:return '0.000000';default:w=new Ufb;b<0?(w.a+='0E+',w):(w.a+='0E',w);w.a+=-b;return w.a;}}t=o*10+1+7;u=KC(TD,$ie,25,t+1,15,1);c=t;if(o==1){h=e[0];if(h<0){H=xbb(h,Yje);do{p=H;H=Abb(H,10);u[--c]=48+Tbb(Qbb(p,Ibb(H,10)))&aje}while(ybb(H,0)!=0)}else{H=h;do{p=H;H=H/10|0;u[--c]=48+(p-H*10)&aje}while(H!=0)}}else{D=KC(WD,oje,25,o,15,1);G=o;$fb(e,0,D,0,G);I:while(true){A=0;for(j=G-1;j>=0;j--){F=wbb(Nbb(A,32),xbb(D[j],Yje));r=qhb(F);D[j]=Tbb(r);A=Tbb(Obb(r,32))}s=Tbb(A);q=c;do{u[--c]=48+s%10&aje}while((s=s/10|0)!=0&&c!=0);d=9-q+c;for(i=0;i0;i++){u[--c]=48}l=G-1;for(;D[l]==0;l--){if(l==0){break I}}G=l+1}while(u[c]==48){++c}}n=B<0;g=t-c-b-1;if(b==0){n&&(u[--c]=45);return zfb(u,c,t-c)}if(b>0&&g>=-6){if(g>=0){k=c+g;for(m=t-1;m>=k;m--){u[m+1]=u[m]}u[++k]=46;n&&(u[--c]=45);return zfb(u,c,t-c+1)}for(l=2;l<-g+1;l++){u[--c]=48}u[--c]=46;u[--c]=48;n&&(u[--c]=45);return zfb(u,c,t-c)}C=c+1;f=t;v=new Vfb;n&&(v.a+='-',v);if(f-C>=1){Kfb(v,u[c]);v.a+='.';v.a+=zfb(u,c+1,t-c-1)}else{v.a+=zfb(u,c,t-c)}v.a+='E';g>0&&(v.a+='+',v);v.a+=''+g;return v.a} +function z$c(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;a.c=b;a.g=new Lqb;c=(Pgd(),new bhd(a.c));d=new YGb(c);UGb(d);t=GD(hkd(a.c,(d0c(),Y_c)));i=BD(hkd(a.c,$_c),316);v=BD(hkd(a.c,__c),429);g=BD(hkd(a.c,T_c),482);u=BD(hkd(a.c,Z_c),430);a.j=Edb(ED(hkd(a.c,a0c)));h=a.a;switch(i.g){case 0:h=a.a;break;case 1:h=a.b;break;case 2:h=a.i;break;case 3:h=a.e;break;case 4:h=a.f;break;default:throw vbb(new Wdb(Mre+(i.f!=null?i.f:''+i.g)));}a.d=new g_c(h,v,g);yNb(a.d,(XNb(),VNb),DD(hkd(a.c,V_c)));a.d.c=Ccb(DD(hkd(a.c,U_c)));if(Vod(a.c).i==0){return a.d}for(l=new Fyd(Vod(a.c));l.e!=l.i.gc();){k=BD(Dyd(l),33);n=k.g/2;m=k.f/2;w=new f7c(k.i+n,k.j+m);while(Mhb(a.g,w)){O6c(w,($wnd.Math.random()-0.5)*qme,($wnd.Math.random()-0.5)*qme)}p=BD(hkd(k,(Y9c(),S8c)),142);q=new aOb(w,new J6c(w.a-n-a.j/2-p.b,w.b-m-a.j/2-p.d,k.g+a.j+(p.b+p.c),k.f+a.j+(p.d+p.a)));Ekb(a.d.i,q);Rhb(a.g,w,new vgd(q,k))}switch(u.g){case 0:if(t==null){a.d.d=BD(Ikb(a.d.i,0),65)}else{for(s=new olb(a.d.i);s.a1&&(Gsb(k,r,k.c.b,k.c),true);Zsb(e)}}}r=s}}return k} +function $Bc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I,J,K,L;Odd(c,'Greedy cycle removal',1);t=b.a;L=t.c.length;a.a=KC(WD,oje,25,L,15,1);a.c=KC(WD,oje,25,L,15,1);a.b=KC(WD,oje,25,L,15,1);j=0;for(r=new olb(t);r.a0?G+1:1}for(g=new olb(w.g);g.a0?G+1:1}}a.c[j]==0?Dsb(a.e,p):a.a[j]==0&&Dsb(a.f,p);++j}o=-1;n=1;l=new Rkb;a.d=BD(vNb(b,(wtc(),jtc)),230);while(L>0){while(a.e.b!=0){I=BD(Lsb(a.e),10);a.b[I.p]=o--;_Bc(a,I);--L}while(a.f.b!=0){J=BD(Lsb(a.f),10);a.b[J.p]=n++;_Bc(a,J);--L}if(L>0){m=Rie;for(s=new olb(t);s.a=m){if(u>m){l.c=KC(SI,Uhe,1,0,5,1);m=u}l.c[l.c.length]=p}}}k=a.Zf(l);a.b[k.p]=n++;_Bc(a,k);--L}}H=t.c.length+1;for(j=0;ja.b[K]){PZb(d,true);yNb(b,Asc,(Bcb(),true))}}}}a.a=null;a.c=null;a.b=null;Osb(a.f);Osb(a.e);Qdd(c)} +function sQb(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;d=new Rkb;h=new Rkb;q=b/2;n=a.gc();e=BD(a.Xb(0),8);r=BD(a.Xb(1),8);o=tQb(e.a,e.b,r.a,r.b,q);Ekb(d,(tCb(0,o.c.length),BD(o.c[0],8)));Ekb(h,(tCb(1,o.c.length),BD(o.c[1],8)));for(j=2;j=0;i--){Dsb(c,(tCb(i,g.c.length),BD(g.c[i],8)))}return c} +function aFd(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;g=true;l=null;d=null;e=null;b=false;n=BEd;j=null;f=null;h=0;i=UEd(a,h,zEd,AEd);if(i=0&&dfb(a.substr(h,'//'.length),'//')){h+=2;i=UEd(a,h,CEd,DEd);d=a.substr(h,i-h);h=i}else if(l!=null&&(h==a.length||(BCb(h,a.length),a.charCodeAt(h)!=47))){g=false;i=ifb(a,wfb(35),h);i==-1&&(i=a.length);d=a.substr(h,i-h);h=i}if(!c&&h0&&bfb(k,k.length-1)==58){e=k;h=i}}if(h=a.j){a.a=-1;a.c=1;return}b=bfb(a.i,a.d++);a.a=b;if(a.b==1){switch(b){case 92:d=10;if(a.d>=a.j)throw vbb(new mde(tvd((h0d(),uue))));a.a=bfb(a.i,a.d++);break;case 45:if((a.e&512)==512&&a.d=a.j)break;if(bfb(a.i,a.d)!=63)break;if(++a.d>=a.j)throw vbb(new mde(tvd((h0d(),vue))));b=bfb(a.i,a.d++);switch(b){case 58:d=13;break;case 61:d=14;break;case 33:d=15;break;case 91:d=19;break;case 62:d=18;break;case 60:if(a.d>=a.j)throw vbb(new mde(tvd((h0d(),vue))));b=bfb(a.i,a.d++);if(b==61){d=16}else if(b==33){d=17}else throw vbb(new mde(tvd((h0d(),wue))));break;case 35:while(a.d=a.j)throw vbb(new mde(tvd((h0d(),uue))));a.a=bfb(a.i,a.d++);break;default:d=0;}a.c=d} +function P5b(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G;A=BD(vNb(a,(Nyc(),Vxc)),98);if(!(A!=(dcd(),bcd)&&A!=ccd)){return}o=a.b;n=o.c.length;k=new Skb((Xj(n+2,Mie),Oy(wbb(wbb(5,n+2),(n+2)/10|0))));p=new Skb((Xj(n+2,Mie),Oy(wbb(wbb(5,n+2),(n+2)/10|0))));Ekb(k,new Lqb);Ekb(k,new Lqb);Ekb(p,new Rkb);Ekb(p,new Rkb);w=new Rkb;for(b=0;b=v||!wCc(r,d))&&(d=yCc(b,k));$_b(r,d);for(f=new Sr(ur(R_b(r).a.Kc(),new Sq));Qr(f);){e=BD(Rr(f),17);if(a.a[e.p]){continue}p=e.c.i;--a.e[p.p];a.e[p.p]==0&&(zCb(cub(n,p)),true)}}for(j=k.c.length-1;j>=0;--j){Ekb(b.b,(tCb(j,k.c.length),BD(k.c[j],29)))}b.a.c=KC(SI,Uhe,1,0,5,1);Qdd(c)} +function gee(a){var b,c,d,e,f,g,h,i,j;a.b=1;nde(a);b=null;if(a.c==0&&a.a==94){nde(a);b=(wfe(),wfe(),++vfe,new $fe(4));Ufe(b,0,lxe);h=(null,++vfe,new $fe(4))}else{h=(wfe(),wfe(),++vfe,new $fe(4))}e=true;while((j=a.c)!=1){if(j==0&&a.a==93&&!e){if(b){Zfe(b,h);h=b}break}c=a.a;d=false;if(j==10){switch(c){case 100:case 68:case 119:case 87:case 115:case 83:Xfe(h,fee(c));d=true;break;case 105:case 73:case 99:case 67:c=(Xfe(h,fee(c)),-1);c<0&&(d=true);break;case 112:case 80:i=tde(a,c);if(!i)throw vbb(new mde(tvd((h0d(),Iue))));Xfe(h,i);d=true;break;default:c=eee(a);}}else if(j==24&&!e){if(b){Zfe(b,h);h=b}f=gee(a);Zfe(h,f);if(a.c!=0||a.a!=93)throw vbb(new mde(tvd((h0d(),Mue))));break}nde(a);if(!d){if(j==0){if(c==91)throw vbb(new mde(tvd((h0d(),Nue))));if(c==93)throw vbb(new mde(tvd((h0d(),Oue))));if(c==45&&!e&&a.a!=93)throw vbb(new mde(tvd((h0d(),Pue))))}if(a.c!=0||a.a!=45||c==45&&e){Ufe(h,c,c)}else{nde(a);if((j=a.c)==1)throw vbb(new mde(tvd((h0d(),Kue))));if(j==0&&a.a==93){Ufe(h,c,c);Ufe(h,45,45)}else if(j==0&&a.a==93||j==24){throw vbb(new mde(tvd((h0d(),Pue))))}else{g=a.a;if(j==0){if(g==91)throw vbb(new mde(tvd((h0d(),Nue))));if(g==93)throw vbb(new mde(tvd((h0d(),Oue))));if(g==45)throw vbb(new mde(tvd((h0d(),Pue))))}else j==10&&(g=eee(a));nde(a);if(c>g)throw vbb(new mde(tvd((h0d(),Sue))));Ufe(h,c,g)}}}e=false}if(a.c==1)throw vbb(new mde(tvd((h0d(),Kue))));Yfe(h);Vfe(h);a.b=0;nde(a);return h} +function xZd(a){Bnd(a.c,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#decimal']));Bnd(a.d,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#integer']));Bnd(a.e,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#boolean']));Bnd(a.f,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EBoolean',fue,'EBoolean:Object']));Bnd(a.i,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#byte']));Bnd(a.g,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#hexBinary']));Bnd(a.j,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EByte',fue,'EByte:Object']));Bnd(a.n,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EChar',fue,'EChar:Object']));Bnd(a.t,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#double']));Bnd(a.u,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EDouble',fue,'EDouble:Object']));Bnd(a.F,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#float']));Bnd(a.G,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EFloat',fue,'EFloat:Object']));Bnd(a.I,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#int']));Bnd(a.J,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EInt',fue,'EInt:Object']));Bnd(a.N,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#long']));Bnd(a.O,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'ELong',fue,'ELong:Object']));Bnd(a.Z,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#short']));Bnd(a.$,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'EShort',fue,'EShort:Object']));Bnd(a._,Rve,OC(GC(ZI,1),nie,2,6,[cwe,'http://www.w3.org/2001/XMLSchema#string']))} +function fRc(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G;if(a.c.length==1){return tCb(0,a.c.length),BD(a.c[0],135)}else if(a.c.length<=0){return new SRc}for(i=new olb(a);i.al){F=0;G+=k+A;k=0}eRc(v,g,F,G);b=$wnd.Math.max(b,F+w.a);k=$wnd.Math.max(k,w.b);F+=w.a+A}u=new Lqb;c=new Lqb;for(C=new olb(a);C.aSLc(f))&&(l=f)}}!l&&(l=(tCb(0,q.c.length),BD(q.c[0],180)));for(p=new olb(b.b);p.a=-1900?1:0;c>=4?Qfb(a,OC(GC(ZI,1),nie,2,6,[pje,qje])[h]):Qfb(a,OC(GC(ZI,1),nie,2,6,['BC','AD'])[h]);break;case 121:kA(a,c,d);break;case 77:jA(a,c,d);break;case 107:i=e.q.getHours();i==0?EA(a,24,c):EA(a,i,c);break;case 83:iA(a,c,e);break;case 69:k=d.q.getDay();c==5?Qfb(a,OC(GC(ZI,1),nie,2,6,['S','M','T','W','T','F','S'])[k]):c==4?Qfb(a,OC(GC(ZI,1),nie,2,6,[rje,sje,tje,uje,vje,wje,xje])[k]):Qfb(a,OC(GC(ZI,1),nie,2,6,['Sun','Mon','Tue','Wed','Thu','Fri','Sat'])[k]);break;case 97:e.q.getHours()>=12&&e.q.getHours()<24?Qfb(a,OC(GC(ZI,1),nie,2,6,['AM','PM'])[1]):Qfb(a,OC(GC(ZI,1),nie,2,6,['AM','PM'])[0]);break;case 104:l=e.q.getHours()%12;l==0?EA(a,12,c):EA(a,l,c);break;case 75:m=e.q.getHours()%12;EA(a,m,c);break;case 72:n=e.q.getHours();EA(a,n,c);break;case 99:o=d.q.getDay();c==5?Qfb(a,OC(GC(ZI,1),nie,2,6,['S','M','T','W','T','F','S'])[o]):c==4?Qfb(a,OC(GC(ZI,1),nie,2,6,[rje,sje,tje,uje,vje,wje,xje])[o]):c==3?Qfb(a,OC(GC(ZI,1),nie,2,6,['Sun','Mon','Tue','Wed','Thu','Fri','Sat'])[o]):EA(a,o,1);break;case 76:p=d.q.getMonth();c==5?Qfb(a,OC(GC(ZI,1),nie,2,6,['J','F','M','A','M','J','J','A','S','O','N','D'])[p]):c==4?Qfb(a,OC(GC(ZI,1),nie,2,6,[bje,cje,dje,eje,fje,gje,hje,ije,jje,kje,lje,mje])[p]):c==3?Qfb(a,OC(GC(ZI,1),nie,2,6,['Jan','Feb','Mar','Apr',fje,'Jun','Jul','Aug','Sep','Oct','Nov','Dec'])[p]):EA(a,p+1,c);break;case 81:q=d.q.getMonth()/3|0;c<4?Qfb(a,OC(GC(ZI,1),nie,2,6,['Q1','Q2','Q3','Q4'])[q]):Qfb(a,OC(GC(ZI,1),nie,2,6,['1st quarter','2nd quarter','3rd quarter','4th quarter'])[q]);break;case 100:r=d.q.getDate();EA(a,r,c);break;case 109:j=e.q.getMinutes();EA(a,j,c);break;case 115:g=e.q.getSeconds();EA(a,g,c);break;case 122:c<4?Qfb(a,f.c[0]):Qfb(a,f.c[1]);break;case 118:Qfb(a,f.b);break;case 90:c<3?Qfb(a,OA(f)):c==3?Qfb(a,NA(f)):Qfb(a,QA(f.a));break;default:return false;}return true} +function X1b(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H;N1b(b);i=BD(qud((!b.b&&(b.b=new y5d(z2,b,4,7)),b.b),0),82);k=BD(qud((!b.c&&(b.c=new y5d(z2,b,5,8)),b.c),0),82);h=atd(i);j=atd(k);g=(!b.a&&(b.a=new cUd(A2,b,6,6)),b.a).i==0?null:BD(qud((!b.a&&(b.a=new cUd(A2,b,6,6)),b.a),0),202);A=BD(Ohb(a.a,h),10);F=BD(Ohb(a.a,j),10);B=null;G=null;if(JD(i,186)){w=BD(Ohb(a.a,i),299);if(JD(w,11)){B=BD(w,11)}else if(JD(w,10)){A=BD(w,10);B=BD(Ikb(A.j,0),11)}}if(JD(k,186)){D=BD(Ohb(a.a,k),299);if(JD(D,11)){G=BD(D,11)}else if(JD(D,10)){F=BD(D,10);G=BD(Ikb(F.j,0),11)}}if(!A||!F){throw vbb(new z2c('The source or the target of edge '+b+' could not be found. '+'This usually happens when an edge connects a node laid out by ELK Layered to a node in '+'another level of hierarchy laid out by either another instance of ELK Layered or another '+'layout algorithm alltogether. The former can be solved by setting the hierarchyHandling '+'option to INCLUDE_CHILDREN.'))}p=new UZb;tNb(p,b);yNb(p,(wtc(),$sc),b);yNb(p,(Nyc(),jxc),null);n=BD(vNb(d,Ksc),21);A==F&&n.Fc((Orc(),Nrc));if(!B){v=(KAc(),IAc);C=null;if(!!g&&fcd(BD(vNb(A,Vxc),98))){C=new f7c(g.j,g.k);Bfd(C,Mld(b));Cfd(C,c);if(ntd(j,h)){v=HAc;P6c(C,A.n)}}B=$$b(A,C,v,d)}if(!G){v=(KAc(),HAc);H=null;if(!!g&&fcd(BD(vNb(F,Vxc),98))){H=new f7c(g.b,g.c);Bfd(H,Mld(b));Cfd(H,c)}G=$$b(F,H,v,Q_b(F))}QZb(p,B);RZb(p,G);(B.e.c.length>1||B.g.c.length>1||G.e.c.length>1||G.g.c.length>1)&&n.Fc((Orc(),Irc));for(m=new Fyd((!b.n&&(b.n=new cUd(D2,b,1,7)),b.n));m.e!=m.i.gc();){l=BD(Dyd(m),137);if(!Ccb(DD(hkd(l,Jxc)))&&!!l.a){q=Z1b(l);Ekb(p.b,q);switch(BD(vNb(q,Qwc),272).g){case 1:case 2:n.Fc((Orc(),Grc));break;case 0:n.Fc((Orc(),Erc));yNb(q,Qwc,(qad(),nad));}}}f=BD(vNb(d,Iwc),314);r=BD(vNb(d,Exc),315);e=f==(Rpc(),Opc)||r==(Vzc(),Rzc);if(!!g&&(!g.a&&(g.a=new xMd(y2,g,5)),g.a).i!=0&&e){s=ofd(g);o=new s7c;for(u=Jsb(s,0);u.b!=u.d.c;){t=BD(Xsb(u),8);Dsb(o,new g7c(t))}yNb(p,_sc,o)}return p} +function yZd(a){if(a.gb)return;a.gb=true;a.b=Lnd(a,0);Knd(a.b,18);Qnd(a.b,19);a.a=Lnd(a,1);Knd(a.a,1);Qnd(a.a,2);Qnd(a.a,3);Qnd(a.a,4);Qnd(a.a,5);a.o=Lnd(a,2);Knd(a.o,8);Knd(a.o,9);Qnd(a.o,10);Qnd(a.o,11);Qnd(a.o,12);Qnd(a.o,13);Qnd(a.o,14);Qnd(a.o,15);Qnd(a.o,16);Qnd(a.o,17);Qnd(a.o,18);Qnd(a.o,19);Qnd(a.o,20);Qnd(a.o,21);Qnd(a.o,22);Qnd(a.o,23);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);Pnd(a.o);a.p=Lnd(a,3);Knd(a.p,2);Knd(a.p,3);Knd(a.p,4);Knd(a.p,5);Qnd(a.p,6);Qnd(a.p,7);Pnd(a.p);Pnd(a.p);a.q=Lnd(a,4);Knd(a.q,8);a.v=Lnd(a,5);Qnd(a.v,9);Pnd(a.v);Pnd(a.v);Pnd(a.v);a.w=Lnd(a,6);Knd(a.w,2);Knd(a.w,3);Knd(a.w,4);Qnd(a.w,5);a.B=Lnd(a,7);Qnd(a.B,1);Pnd(a.B);Pnd(a.B);Pnd(a.B);a.Q=Lnd(a,8);Qnd(a.Q,0);Pnd(a.Q);a.R=Lnd(a,9);Knd(a.R,1);a.S=Lnd(a,10);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);Pnd(a.S);a.T=Lnd(a,11);Qnd(a.T,10);Qnd(a.T,11);Qnd(a.T,12);Qnd(a.T,13);Qnd(a.T,14);Pnd(a.T);Pnd(a.T);a.U=Lnd(a,12);Knd(a.U,2);Knd(a.U,3);Qnd(a.U,4);Qnd(a.U,5);Qnd(a.U,6);Qnd(a.U,7);Pnd(a.U);a.V=Lnd(a,13);Qnd(a.V,10);a.W=Lnd(a,14);Knd(a.W,18);Knd(a.W,19);Knd(a.W,20);Qnd(a.W,21);Qnd(a.W,22);Qnd(a.W,23);a.bb=Lnd(a,15);Knd(a.bb,10);Knd(a.bb,11);Knd(a.bb,12);Knd(a.bb,13);Knd(a.bb,14);Knd(a.bb,15);Knd(a.bb,16);Qnd(a.bb,17);Pnd(a.bb);Pnd(a.bb);a.eb=Lnd(a,16);Knd(a.eb,2);Knd(a.eb,3);Knd(a.eb,4);Knd(a.eb,5);Knd(a.eb,6);Knd(a.eb,7);Qnd(a.eb,8);Qnd(a.eb,9);a.ab=Lnd(a,17);Knd(a.ab,0);Knd(a.ab,1);a.H=Lnd(a,18);Qnd(a.H,0);Qnd(a.H,1);Qnd(a.H,2);Qnd(a.H,3);Qnd(a.H,4);Qnd(a.H,5);Pnd(a.H);a.db=Lnd(a,19);Qnd(a.db,2);a.c=Mnd(a,20);a.d=Mnd(a,21);a.e=Mnd(a,22);a.f=Mnd(a,23);a.i=Mnd(a,24);a.g=Mnd(a,25);a.j=Mnd(a,26);a.k=Mnd(a,27);a.n=Mnd(a,28);a.r=Mnd(a,29);a.s=Mnd(a,30);a.t=Mnd(a,31);a.u=Mnd(a,32);a.fb=Mnd(a,33);a.A=Mnd(a,34);a.C=Mnd(a,35);a.D=Mnd(a,36);a.F=Mnd(a,37);a.G=Mnd(a,38);a.I=Mnd(a,39);a.J=Mnd(a,40);a.L=Mnd(a,41);a.M=Mnd(a,42);a.N=Mnd(a,43);a.O=Mnd(a,44);a.P=Mnd(a,45);a.X=Mnd(a,46);a.Y=Mnd(a,47);a.Z=Mnd(a,48);a.$=Mnd(a,49);a._=Mnd(a,50);a.cb=Mnd(a,51);a.K=Mnd(a,52)} +function Y9c(){Y9c=ccb;var a,b;o8c=new Lsd(sse);F9c=new Lsd(tse);q8c=(F7c(),z7c);p8c=new Nsd($pe,q8c);new Tfd;r8c=new Nsd(_le,null);s8c=new Lsd(use);x8c=(i8c(),qqb(h8c,OC(GC(r1,1),Kie,291,0,[d8c])));w8c=new Nsd(lqe,x8c);y8c=new Nsd(Zpe,(Bcb(),false));A8c=(ead(),cad);z8c=new Nsd(cqe,A8c);F8c=(Aad(),zad);E8c=new Nsd(ype,F8c);I8c=new Nsd(Jre,false);K8c=(hbd(),fbd);J8c=new Nsd(tpe,K8c);g9c=new q0b(12);f9c=new Nsd(ame,g9c);O8c=new Nsd(Ame,false);P8c=new Nsd(xqe,false);e9c=new Nsd(Dme,false);u9c=(dcd(),ccd);t9c=new Nsd(Bme,u9c);C9c=new Lsd(uqe);D9c=new Lsd(vme);E9c=new Lsd(yme);H9c=new Lsd(zme);R8c=new s7c;Q8c=new Nsd(mqe,R8c);v8c=new Nsd(pqe,false);L8c=new Nsd(qqe,false);new Lsd(vse);T8c=new H_b;S8c=new Nsd(vqe,T8c);d9c=new Nsd(Xpe,false);new Tfd;G9c=new Nsd(wse,1);new Nsd(xse,true);meb(0);new Nsd(yse,meb(100));new Nsd(zse,false);meb(0);new Nsd(Ase,meb(4000));meb(0);new Nsd(Bse,meb(400));new Nsd(Cse,false);new Nsd(Dse,false);new Nsd(Ese,true);new Nsd(Fse,false);u8c=(Ded(),Ced);t8c=new Nsd(rse,u8c);I9c=new Nsd(Lpe,10);J9c=new Nsd(Mpe,10);K9c=new Nsd(Zle,20);L9c=new Nsd(Npe,10);M9c=new Nsd(xme,2);N9c=new Nsd(Ope,10);P9c=new Nsd(Ppe,0);Q9c=new Nsd(Spe,5);R9c=new Nsd(Qpe,1);S9c=new Nsd(Rpe,1);T9c=new Nsd(wme,20);U9c=new Nsd(Tpe,10);X9c=new Nsd(Upe,10);O9c=new Lsd(Vpe);W9c=new I_b;V9c=new Nsd(wqe,W9c);j9c=new Lsd(tqe);i9c=false;h9c=new Nsd(sqe,i9c);V8c=new q0b(5);U8c=new Nsd(dqe,V8c);X8c=(Hbd(),b=BD(gdb(B1),9),new xqb(b,BD(_Bb(b,b.length),9),0));W8c=new Nsd(Gme,X8c);m9c=(Tbd(),Qbd);l9c=new Nsd(gqe,m9c);o9c=new Lsd(hqe);p9c=new Lsd(iqe);q9c=new Lsd(jqe);n9c=new Lsd(kqe);Z8c=(a=BD(gdb(I1),9),new xqb(a,BD(_Bb(a,a.length),9),0));Y8c=new Nsd(Fme,Z8c);c9c=pqb((Idd(),Bdd));b9c=new Nsd(Eme,c9c);a9c=new f7c(0,0);_8c=new Nsd(Tme,a9c);$8c=new Nsd(bqe,false);D8c=(qad(),nad);C8c=new Nsd(nqe,D8c);B8c=new Nsd(Cme,false);new Lsd(Gse);meb(1);new Nsd(Hse,null);r9c=new Lsd(rqe);v9c=new Lsd(oqe);B9c=(Ucd(),Scd);A9c=new Nsd(Ype,B9c);s9c=new Lsd(Wpe);y9c=(rcd(),pqb(pcd));x9c=new Nsd(Hme,y9c);w9c=new Nsd(eqe,false);z9c=new Nsd(fqe,true);M8c=new Nsd(_pe,false);N8c=new Nsd(aqe,false);G8c=new Nsd($le,1);H8c=(Mad(),Kad);new Nsd(Ise,H8c);k9c=true} +function wtc(){wtc=ccb;var a,b;$sc=new Lsd(Ime);xsc=new Lsd('coordinateOrigin');itc=new Lsd('processors');wsc=new Msd('compoundNode',(Bcb(),false));Nsc=new Msd('insideConnections',false);_sc=new Lsd('originalBendpoints');atc=new Lsd('originalDummyNodePosition');btc=new Lsd('originalLabelEdge');ktc=new Lsd('representedLabels');Csc=new Lsd('endLabels');Dsc=new Lsd('endLabel.origin');Ssc=new Msd('labelSide',(rbd(),qbd));Ysc=new Msd('maxEdgeThickness',0);ltc=new Msd('reversed',false);jtc=new Lsd(Jme);Vsc=new Msd('longEdgeSource',null);Wsc=new Msd('longEdgeTarget',null);Usc=new Msd('longEdgeHasLabelDummies',false);Tsc=new Msd('longEdgeBeforeLabelDummy',false);Bsc=new Msd('edgeConstraint',(Gqc(),Eqc));Psc=new Lsd('inLayerLayoutUnit');Osc=new Msd('inLayerConstraint',(esc(),csc));Qsc=new Msd('inLayerSuccessorConstraint',new Rkb);Rsc=new Msd('inLayerSuccessorConstraintBetweenNonDummies',false);gtc=new Lsd('portDummy');ysc=new Msd('crossingHint',meb(0));Ksc=new Msd('graphProperties',(b=BD(gdb(PW),9),new xqb(b,BD(_Bb(b,b.length),9),0)));Hsc=new Msd('externalPortSide',(Ucd(),Scd));Isc=new Msd('externalPortSize',new d7c);Fsc=new Lsd('externalPortReplacedDummies');Gsc=new Lsd('externalPortReplacedDummy');Esc=new Msd('externalPortConnections',(a=BD(gdb(F1),9),new xqb(a,BD(_Bb(a,a.length),9),0)));htc=new Msd(tle,0);ssc=new Lsd('barycenterAssociates');vtc=new Lsd('TopSideComments');tsc=new Lsd('BottomSideComments');vsc=new Lsd('CommentConnectionPort');Msc=new Msd('inputCollect',false);etc=new Msd('outputCollect',false);Asc=new Msd('cyclic',false);zsc=new Lsd('crossHierarchyMap');utc=new Lsd('targetOffset');new Msd('splineLabelSize',new d7c);otc=new Lsd('spacings');ftc=new Msd('partitionConstraint',false);usc=new Lsd('breakingPoint.info');stc=new Lsd('splines.survivingEdge');rtc=new Lsd('splines.route.start');ptc=new Lsd('splines.edgeChain');dtc=new Lsd('originalPortConstraints');ntc=new Lsd('selfLoopHolder');qtc=new Lsd('splines.nsPortY');Zsc=new Lsd('modelOrder');Xsc=new Lsd('longEdgeTargetNode');Jsc=new Msd(Xne,false);mtc=new Msd(Xne,false);Lsc=new Lsd('layerConstraints.hiddenNodes');ctc=new Lsd('layerConstraints.opposidePort');ttc=new Lsd('targetNode.modelOrder')} +function jwc(){jwc=ccb;puc=(xqc(),vqc);ouc=new Nsd(Yne,puc);Guc=new Nsd(Zne,(Bcb(),false));Muc=(msc(),ksc);Luc=new Nsd($ne,Muc);cvc=new Nsd(_ne,false);dvc=new Nsd(aoe,true);Itc=new Nsd(boe,false);xvc=(BAc(),zAc);wvc=new Nsd(coe,xvc);meb(1);Fvc=new Nsd(doe,meb(7));Gvc=new Nsd(eoe,false);Huc=new Nsd(foe,false);nuc=(mqc(),iqc);muc=new Nsd(goe,nuc);bvc=(lzc(),jzc);avc=new Nsd(hoe,bvc);Tuc=(Ctc(),Btc);Suc=new Nsd(ioe,Tuc);meb(-1);Ruc=new Nsd(joe,meb(-1));meb(-1);Uuc=new Nsd(koe,meb(-1));meb(-1);Vuc=new Nsd(loe,meb(4));meb(-1);Xuc=new Nsd(moe,meb(2));_uc=(kAc(),iAc);$uc=new Nsd(noe,_uc);meb(0);Zuc=new Nsd(ooe,meb(0));Puc=new Nsd(poe,meb(Ohe));luc=(Rpc(),Ppc);kuc=new Nsd(qoe,luc);Xtc=new Nsd(roe,false);euc=new Nsd(soe,0.1);iuc=new Nsd(toe,false);meb(-1);guc=new Nsd(uoe,meb(-1));meb(-1);huc=new Nsd(voe,meb(-1));meb(0);Ytc=new Nsd(woe,meb(40));cuc=(Xrc(),Wrc);buc=new Nsd(xoe,cuc);$tc=Urc;Ztc=new Nsd(yoe,$tc);vvc=(Vzc(),Qzc);uvc=new Nsd(zoe,vvc);kvc=new Lsd(Aoe);fvc=(_qc(),Zqc);evc=new Nsd(Boe,fvc);ivc=(lrc(),irc);hvc=new Nsd(Coe,ivc);new Tfd;nvc=new Nsd(Doe,0.3);pvc=new Lsd(Eoe);rvc=(Izc(),Gzc);qvc=new Nsd(Foe,rvc);xuc=(TAc(),RAc);wuc=new Nsd(Goe,xuc);zuc=(_Ac(),$Ac);yuc=new Nsd(Hoe,zuc);Buc=(tBc(),sBc);Auc=new Nsd(Ioe,Buc);Duc=new Nsd(Joe,0.2);uuc=new Nsd(Koe,2);Bvc=new Nsd(Loe,null);Dvc=new Nsd(Moe,10);Cvc=new Nsd(Noe,10);Evc=new Nsd(Ooe,20);meb(0);yvc=new Nsd(Poe,meb(0));meb(0);zvc=new Nsd(Qoe,meb(0));meb(0);Avc=new Nsd(Roe,meb(0));Jtc=new Nsd(Soe,false);Ntc=(yrc(),wrc);Mtc=new Nsd(Toe,Ntc);Ltc=(Ipc(),Hpc);Ktc=new Nsd(Uoe,Ltc);Juc=new Nsd(Voe,false);meb(0);Iuc=new Nsd(Woe,meb(16));meb(0);Kuc=new Nsd(Xoe,meb(5));bwc=(LBc(),JBc);awc=new Nsd(Yoe,bwc);Hvc=new Nsd(Zoe,10);Kvc=new Nsd($oe,1);Tvc=(bqc(),aqc);Svc=new Nsd(_oe,Tvc);Nvc=new Lsd(ape);Qvc=meb(1);meb(0);Pvc=new Nsd(bpe,Qvc);gwc=(CBc(),zBc);fwc=new Nsd(cpe,gwc);cwc=new Lsd(dpe);Yvc=new Nsd(epe,true);Wvc=new Nsd(fpe,2);$vc=new Nsd(gpe,true);tuc=(Sqc(),Qqc);suc=new Nsd(hpe,tuc);ruc=(Apc(),wpc);quc=new Nsd(ipe,ruc);Wtc=(tAc(),rAc);Vtc=new Nsd(jpe,Wtc);Utc=new Nsd(kpe,false);Ptc=(RXb(),QXb);Otc=new Nsd(lpe,Ptc);Ttc=(xzc(),uzc);Stc=new Nsd(mpe,Ttc);Qtc=new Nsd(npe,0);Rtc=new Nsd(ope,0);Ouc=kqc;Nuc=Opc;Wuc=izc;Yuc=izc;Quc=fzc;fuc=(hbd(),ebd);juc=Ppc;duc=Ppc;_tc=Ppc;auc=ebd;lvc=Tzc;mvc=Qzc;gvc=Qzc;jvc=Qzc;ovc=Szc;tvc=Tzc;svc=Tzc;Cuc=(Aad(),yad);Euc=yad;Fuc=sBc;vuc=xad;Ivc=KBc;Jvc=IBc;Lvc=KBc;Mvc=IBc;Uvc=KBc;Vvc=IBc;Ovc=_pc;Rvc=aqc;hwc=KBc;iwc=IBc;dwc=KBc;ewc=IBc;Zvc=IBc;Xvc=IBc;_vc=IBc} +function S8b(){S8b=ccb;Y7b=new T8b('DIRECTION_PREPROCESSOR',0);V7b=new T8b('COMMENT_PREPROCESSOR',1);Z7b=new T8b('EDGE_AND_LAYER_CONSTRAINT_EDGE_REVERSER',2);n8b=new T8b('INTERACTIVE_EXTERNAL_PORT_POSITIONER',3);G8b=new T8b('PARTITION_PREPROCESSOR',4);r8b=new T8b('LABEL_DUMMY_INSERTER',5);M8b=new T8b('SELF_LOOP_PREPROCESSOR',6);w8b=new T8b('LAYER_CONSTRAINT_PREPROCESSOR',7);E8b=new T8b('PARTITION_MIDPROCESSOR',8);i8b=new T8b('HIGH_DEGREE_NODE_LAYER_PROCESSOR',9);A8b=new T8b('NODE_PROMOTION',10);v8b=new T8b('LAYER_CONSTRAINT_POSTPROCESSOR',11);F8b=new T8b('PARTITION_POSTPROCESSOR',12);e8b=new T8b('HIERARCHICAL_PORT_CONSTRAINT_PROCESSOR',13);O8b=new T8b('SEMI_INTERACTIVE_CROSSMIN_PROCESSOR',14);P7b=new T8b('BREAKING_POINT_INSERTER',15);z8b=new T8b('LONG_EDGE_SPLITTER',16);I8b=new T8b('PORT_SIDE_PROCESSOR',17);o8b=new T8b('INVERTED_PORT_PROCESSOR',18);H8b=new T8b('PORT_LIST_SORTER',19);Q8b=new T8b('SORT_BY_INPUT_ORDER_OF_MODEL',20);C8b=new T8b('NORTH_SOUTH_PORT_PREPROCESSOR',21);Q7b=new T8b('BREAKING_POINT_PROCESSOR',22);D8b=new T8b(Bne,23);R8b=new T8b(Cne,24);K8b=new T8b('SELF_LOOP_PORT_RESTORER',25);P8b=new T8b('SINGLE_EDGE_GRAPH_WRAPPER',26);p8b=new T8b('IN_LAYER_CONSTRAINT_PROCESSOR',27);b8b=new T8b('END_NODE_PORT_LABEL_MANAGEMENT_PROCESSOR',28);q8b=new T8b('LABEL_AND_NODE_SIZE_PROCESSOR',29);m8b=new T8b('INNERMOST_NODE_MARGIN_CALCULATOR',30);N8b=new T8b('SELF_LOOP_ROUTER',31);T7b=new T8b('COMMENT_NODE_MARGIN_CALCULATOR',32);_7b=new T8b('END_LABEL_PREPROCESSOR',33);t8b=new T8b('LABEL_DUMMY_SWITCHER',34);S7b=new T8b('CENTER_LABEL_MANAGEMENT_PROCESSOR',35);u8b=new T8b('LABEL_SIDE_SELECTOR',36);k8b=new T8b('HYPEREDGE_DUMMY_MERGER',37);f8b=new T8b('HIERARCHICAL_PORT_DUMMY_SIZE_PROCESSOR',38);x8b=new T8b('LAYER_SIZE_AND_GRAPH_HEIGHT_CALCULATOR',39);h8b=new T8b('HIERARCHICAL_PORT_POSITION_PROCESSOR',40);W7b=new T8b('CONSTRAINTS_POSTPROCESSOR',41);U7b=new T8b('COMMENT_POSTPROCESSOR',42);l8b=new T8b('HYPERNODE_PROCESSOR',43);g8b=new T8b('HIERARCHICAL_PORT_ORTHOGONAL_EDGE_ROUTER',44);y8b=new T8b('LONG_EDGE_JOINER',45);L8b=new T8b('SELF_LOOP_POSTPROCESSOR',46);R7b=new T8b('BREAKING_POINT_REMOVER',47);B8b=new T8b('NORTH_SOUTH_PORT_POSTPROCESSOR',48);j8b=new T8b('HORIZONTAL_COMPACTOR',49);s8b=new T8b('LABEL_DUMMY_REMOVER',50);c8b=new T8b('FINAL_SPLINE_BENDPOINTS_CALCULATOR',51);a8b=new T8b('END_LABEL_SORTER',52);J8b=new T8b('REVERSED_EDGE_RESTORER',53);$7b=new T8b('END_LABEL_POSTPROCESSOR',54);d8b=new T8b('HIERARCHICAL_NODE_RESIZER',55);X7b=new T8b('DIRECTION_POSTPROCESSOR',56)} +function KIc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B,C,D,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb;cb=0;for(H=b,K=0,N=H.length;K0&&(a.a[U.p]=cb++)}}hb=0;for(I=c,L=0,O=I.length;L0){U=(sCb(Y.b>0),BD(Y.a.Xb(Y.c=--Y.b),11));X=0;for(h=new olb(U.e);h.a0){if(U.j==(Ucd(),Acd)){a.a[U.p]=hb;++hb}else{a.a[U.p]=hb+P+R;++R}}}hb+=R}W=new Lqb;o=new zsb;for(G=b,J=0,M=G.length;Jj.b&&(j.b=Z)}else if(U.i.c==bb){Zj.c&&(j.c=Z)}}}Klb(p,0,p.length,null);gb=KC(WD,oje,25,p.length,15,1);d=KC(WD,oje,25,hb+1,15,1);for(r=0;r0){A%2>0&&(e+=kb[A+1]);A=(A-1)/2|0;++kb[A]}}C=KC(nY,Uhe,362,p.length*2,0,1);for(u=0;u'?":dfb(wue,a)?"'(?<' or '(? toIndex: ',zke=', toIndex: ',Ake='Index: ',Bke=', Size: ',Cke='org.eclipse.elk.alg.common',Dke={62:1},Eke='org.eclipse.elk.alg.common.compaction',Fke='Scanline/EventHandler',Gke='org.eclipse.elk.alg.common.compaction.oned',Hke='CNode belongs to another CGroup.',Ike='ISpacingsHandler/1',Jke='The ',Kke=' instance has been finished already.',Lke='The direction ',Mke=' is not supported by the CGraph instance.',Nke='OneDimensionalCompactor',Oke='OneDimensionalCompactor/lambda$0$Type',Pke='Quadruplet',Qke='ScanlineConstraintCalculator',Rke='ScanlineConstraintCalculator/ConstraintsScanlineHandler',Ske='ScanlineConstraintCalculator/ConstraintsScanlineHandler/lambda$0$Type',Tke='ScanlineConstraintCalculator/Timestamp',Uke='ScanlineConstraintCalculator/lambda$0$Type',Vke={169:1,45:1},Wke='org.eclipse.elk.alg.common.compaction.options',Xke='org.eclipse.elk.core.data',Yke='org.eclipse.elk.polyomino.traversalStrategy',Zke='org.eclipse.elk.polyomino.lowLevelSort',$ke='org.eclipse.elk.polyomino.highLevelSort',_ke='org.eclipse.elk.polyomino.fill',ale={130:1},ble='polyomino',cle='org.eclipse.elk.alg.common.networksimplex',dle={177:1,3:1,4:1},ele='org.eclipse.elk.alg.common.nodespacing',fle='org.eclipse.elk.alg.common.nodespacing.cellsystem',gle='CENTER',hle={212:1,326:1},ile={3:1,4:1,5:1,595:1},jle='LEFT',kle='RIGHT',lle='Vertical alignment cannot be null',mle='BOTTOM',nle='org.eclipse.elk.alg.common.nodespacing.internal',ole='UNDEFINED',ple=0.01,qle='org.eclipse.elk.alg.common.nodespacing.internal.algorithm',rle='LabelPlacer/lambda$0$Type',sle='LabelPlacer/lambda$1$Type',tle='portRatioOrPosition',ule='org.eclipse.elk.alg.common.overlaps',vle='DOWN',wle='org.eclipse.elk.alg.common.polyomino',xle='NORTH',yle='EAST',zle='SOUTH',Ale='WEST',Ble='org.eclipse.elk.alg.common.polyomino.structures',Cle='Direction',Dle='Grid is only of size ',Ele='. Requested point (',Fle=') is out of bounds.',Gle=' Given center based coordinates were (',Hle='org.eclipse.elk.graph.properties',Ile='IPropertyHolder',Jle={3:1,94:1,134:1},Kle='org.eclipse.elk.alg.common.spore',Lle='org.eclipse.elk.alg.common.utils',Mle={209:1},Nle='org.eclipse.elk.core',Ole='Connected Components Compaction',Ple='org.eclipse.elk.alg.disco',Qle='org.eclipse.elk.alg.disco.graph',Rle='org.eclipse.elk.alg.disco.options',Sle='CompactionStrategy',Tle='org.eclipse.elk.disco.componentCompaction.strategy',Ule='org.eclipse.elk.disco.componentCompaction.componentLayoutAlgorithm',Vle='org.eclipse.elk.disco.debug.discoGraph',Wle='org.eclipse.elk.disco.debug.discoPolys',Xle='componentCompaction',Yle='org.eclipse.elk.disco',Zle='org.eclipse.elk.spacing.componentComponent',$le='org.eclipse.elk.edge.thickness',_le='org.eclipse.elk.aspectRatio',ame='org.eclipse.elk.padding',bme='org.eclipse.elk.alg.disco.transform',cme=1.5707963267948966,dme=1.7976931348623157E308,eme={3:1,4:1,5:1,192:1},fme={3:1,6:1,4:1,5:1,106:1,120:1},gme='org.eclipse.elk.alg.force',hme='ComponentsProcessor',ime='ComponentsProcessor/1',jme='org.eclipse.elk.alg.force.graph',kme='Component Layout',lme='org.eclipse.elk.alg.force.model',mme='org.eclipse.elk.force.model',nme='org.eclipse.elk.force.iterations',ome='org.eclipse.elk.force.repulsivePower',pme='org.eclipse.elk.force.temperature',qme=0.001,rme='org.eclipse.elk.force.repulsion',sme='org.eclipse.elk.alg.force.options',tme=1.600000023841858,ume='org.eclipse.elk.force',vme='org.eclipse.elk.priority',wme='org.eclipse.elk.spacing.nodeNode',xme='org.eclipse.elk.spacing.edgeLabel',yme='org.eclipse.elk.randomSeed',zme='org.eclipse.elk.separateConnectedComponents',Ame='org.eclipse.elk.interactive',Bme='org.eclipse.elk.portConstraints',Cme='org.eclipse.elk.edgeLabels.inline',Dme='org.eclipse.elk.omitNodeMicroLayout',Eme='org.eclipse.elk.nodeSize.options',Fme='org.eclipse.elk.nodeSize.constraints',Gme='org.eclipse.elk.nodeLabels.placement',Hme='org.eclipse.elk.portLabels.placement',Ime='origin',Jme='random',Kme='boundingBox.upLeft',Lme='boundingBox.lowRight',Mme='org.eclipse.elk.stress.fixed',Nme='org.eclipse.elk.stress.desiredEdgeLength',Ome='org.eclipse.elk.stress.dimension',Pme='org.eclipse.elk.stress.epsilon',Qme='org.eclipse.elk.stress.iterationLimit',Rme='org.eclipse.elk.stress',Sme='ELK Stress',Tme='org.eclipse.elk.nodeSize.minimum',Ume='org.eclipse.elk.alg.force.stress',Vme='Layered layout',Wme='org.eclipse.elk.alg.layered',Xme='org.eclipse.elk.alg.layered.compaction.components',Yme='org.eclipse.elk.alg.layered.compaction.oned',Zme='org.eclipse.elk.alg.layered.compaction.oned.algs',$me='org.eclipse.elk.alg.layered.compaction.recthull',_me='org.eclipse.elk.alg.layered.components',ane='NONE',bne={3:1,6:1,4:1,9:1,5:1,122:1},cne={3:1,6:1,4:1,5:1,141:1,106:1,120:1},dne='org.eclipse.elk.alg.layered.compound',ene={51:1},fne='org.eclipse.elk.alg.layered.graph',gne=' -> ',hne='Not supported by LGraph',ine='Port side is undefined',jne={3:1,6:1,4:1,5:1,474:1,141:1,106:1,120:1},kne={3:1,6:1,4:1,5:1,141:1,193:1,203:1,106:1,120:1},lne={3:1,6:1,4:1,5:1,141:1,1943:1,203:1,106:1,120:1},mne='([{"\' \t\r\n',nne=')]}"\' \t\r\n',one='The given string contains parts that cannot be parsed as numbers.',pne='org.eclipse.elk.core.math',qne={3:1,4:1,142:1,207:1,414:1},rne={3:1,4:1,116:1,207:1,414:1},sne='org.eclipse.elk.layered',tne='org.eclipse.elk.alg.layered.graph.transform',une='ElkGraphImporter',vne='ElkGraphImporter/lambda$0$Type',wne='ElkGraphImporter/lambda$1$Type',xne='ElkGraphImporter/lambda$2$Type',yne='ElkGraphImporter/lambda$4$Type',zne='Node margin calculation',Ane='org.eclipse.elk.alg.layered.intermediate',Bne='ONE_SIDED_GREEDY_SWITCH',Cne='TWO_SIDED_GREEDY_SWITCH',Dne='No implementation is available for the layout processor ',Ene='IntermediateProcessorStrategy',Fne="Node '",Gne='FIRST_SEPARATE',Hne='LAST_SEPARATE',Ine='Odd port side processing',Jne='org.eclipse.elk.alg.layered.intermediate.compaction',Kne='org.eclipse.elk.alg.layered.intermediate.greedyswitch',Lne='org.eclipse.elk.alg.layered.p3order.counting',Mne={225:1},Nne='org.eclipse.elk.alg.layered.intermediate.loops',One='org.eclipse.elk.alg.layered.intermediate.loops.ordering',Pne='org.eclipse.elk.alg.layered.intermediate.loops.routing',Qne='org.eclipse.elk.alg.layered.intermediate.preserveorder',Rne='org.eclipse.elk.alg.layered.intermediate.wrapping',Sne='org.eclipse.elk.alg.layered.options',Tne='INTERACTIVE',Une='DEPTH_FIRST',Vne='EDGE_LENGTH',Wne='SELF_LOOPS',Xne='firstTryWithInitialOrder',Yne='org.eclipse.elk.layered.directionCongruency',Zne='org.eclipse.elk.layered.feedbackEdges',$ne='org.eclipse.elk.layered.interactiveReferencePoint',_ne='org.eclipse.elk.layered.mergeEdges',aoe='org.eclipse.elk.layered.mergeHierarchyEdges',boe='org.eclipse.elk.layered.allowNonFlowPortsToSwitchSides',coe='org.eclipse.elk.layered.portSortingStrategy',doe='org.eclipse.elk.layered.thoroughness',eoe='org.eclipse.elk.layered.unnecessaryBendpoints',foe='org.eclipse.elk.layered.generatePositionAndLayerIds',goe='org.eclipse.elk.layered.cycleBreaking.strategy',hoe='org.eclipse.elk.layered.layering.strategy',ioe='org.eclipse.elk.layered.layering.layerConstraint',joe='org.eclipse.elk.layered.layering.layerChoiceConstraint',koe='org.eclipse.elk.layered.layering.layerId',loe='org.eclipse.elk.layered.layering.minWidth.upperBoundOnWidth',moe='org.eclipse.elk.layered.layering.minWidth.upperLayerEstimationScalingFactor',noe='org.eclipse.elk.layered.layering.nodePromotion.strategy',ooe='org.eclipse.elk.layered.layering.nodePromotion.maxIterations',poe='org.eclipse.elk.layered.layering.coffmanGraham.layerBound',qoe='org.eclipse.elk.layered.crossingMinimization.strategy',roe='org.eclipse.elk.layered.crossingMinimization.forceNodeModelOrder',soe='org.eclipse.elk.layered.crossingMinimization.hierarchicalSweepiness',toe='org.eclipse.elk.layered.crossingMinimization.semiInteractive',uoe='org.eclipse.elk.layered.crossingMinimization.positionChoiceConstraint',voe='org.eclipse.elk.layered.crossingMinimization.positionId',woe='org.eclipse.elk.layered.crossingMinimization.greedySwitch.activationThreshold',xoe='org.eclipse.elk.layered.crossingMinimization.greedySwitch.type',yoe='org.eclipse.elk.layered.crossingMinimization.greedySwitchHierarchical.type',zoe='org.eclipse.elk.layered.nodePlacement.strategy',Aoe='org.eclipse.elk.layered.nodePlacement.favorStraightEdges',Boe='org.eclipse.elk.layered.nodePlacement.bk.edgeStraightening',Coe='org.eclipse.elk.layered.nodePlacement.bk.fixedAlignment',Doe='org.eclipse.elk.layered.nodePlacement.linearSegments.deflectionDampening',Eoe='org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility',Foe='org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility.default',Goe='org.eclipse.elk.layered.edgeRouting.selfLoopDistribution',Hoe='org.eclipse.elk.layered.edgeRouting.selfLoopOrdering',Ioe='org.eclipse.elk.layered.edgeRouting.splines.mode',Joe='org.eclipse.elk.layered.edgeRouting.splines.sloppy.layerSpacingFactor',Koe='org.eclipse.elk.layered.edgeRouting.polyline.slopedEdgeZoneWidth',Loe='org.eclipse.elk.layered.spacing.baseValue',Moe='org.eclipse.elk.layered.spacing.edgeNodeBetweenLayers',Noe='org.eclipse.elk.layered.spacing.edgeEdgeBetweenLayers',Ooe='org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers',Poe='org.eclipse.elk.layered.priority.direction',Qoe='org.eclipse.elk.layered.priority.shortness',Roe='org.eclipse.elk.layered.priority.straightness',Soe='org.eclipse.elk.layered.compaction.connectedComponents',Toe='org.eclipse.elk.layered.compaction.postCompaction.strategy',Uoe='org.eclipse.elk.layered.compaction.postCompaction.constraints',Voe='org.eclipse.elk.layered.highDegreeNodes.treatment',Woe='org.eclipse.elk.layered.highDegreeNodes.threshold',Xoe='org.eclipse.elk.layered.highDegreeNodes.treeHeight',Yoe='org.eclipse.elk.layered.wrapping.strategy',Zoe='org.eclipse.elk.layered.wrapping.additionalEdgeSpacing',$oe='org.eclipse.elk.layered.wrapping.correctionFactor',_oe='org.eclipse.elk.layered.wrapping.cutting.strategy',ape='org.eclipse.elk.layered.wrapping.cutting.cuts',bpe='org.eclipse.elk.layered.wrapping.cutting.msd.freedom',cpe='org.eclipse.elk.layered.wrapping.validify.strategy',dpe='org.eclipse.elk.layered.wrapping.validify.forbiddenIndices',epe='org.eclipse.elk.layered.wrapping.multiEdge.improveCuts',fpe='org.eclipse.elk.layered.wrapping.multiEdge.distancePenalty',gpe='org.eclipse.elk.layered.wrapping.multiEdge.improveWrappedEdges',hpe='org.eclipse.elk.layered.edgeLabels.sideSelection',ipe='org.eclipse.elk.layered.edgeLabels.centerLabelPlacementStrategy',jpe='org.eclipse.elk.layered.considerModelOrder.strategy',kpe='org.eclipse.elk.layered.considerModelOrder.noModelOrder',lpe='org.eclipse.elk.layered.considerModelOrder.components',mpe='org.eclipse.elk.layered.considerModelOrder.longEdgeStrategy',npe='org.eclipse.elk.layered.considerModelOrder.crossingCounterNodeInfluence',ope='org.eclipse.elk.layered.considerModelOrder.crossingCounterPortInfluence',ppe='layering',qpe='layering.minWidth',rpe='layering.nodePromotion',spe='crossingMinimization',tpe='org.eclipse.elk.hierarchyHandling',upe='crossingMinimization.greedySwitch',vpe='nodePlacement',wpe='nodePlacement.bk',xpe='edgeRouting',ype='org.eclipse.elk.edgeRouting',zpe='spacing',Ape='priority',Bpe='compaction',Cpe='compaction.postCompaction',Dpe='Specifies whether and how post-process compaction is applied.',Epe='highDegreeNodes',Fpe='wrapping',Gpe='wrapping.cutting',Hpe='wrapping.validify',Ipe='wrapping.multiEdge',Jpe='edgeLabels',Kpe='considerModelOrder',Lpe='org.eclipse.elk.spacing.commentComment',Mpe='org.eclipse.elk.spacing.commentNode',Npe='org.eclipse.elk.spacing.edgeEdge',Ope='org.eclipse.elk.spacing.edgeNode',Ppe='org.eclipse.elk.spacing.labelLabel',Qpe='org.eclipse.elk.spacing.labelPortHorizontal',Rpe='org.eclipse.elk.spacing.labelPortVertical',Spe='org.eclipse.elk.spacing.labelNode',Tpe='org.eclipse.elk.spacing.nodeSelfLoop',Upe='org.eclipse.elk.spacing.portPort',Vpe='org.eclipse.elk.spacing.individual',Wpe='org.eclipse.elk.port.borderOffset',Xpe='org.eclipse.elk.noLayout',Ype='org.eclipse.elk.port.side',Zpe='org.eclipse.elk.debugMode',$pe='org.eclipse.elk.alignment',_pe='org.eclipse.elk.insideSelfLoops.activate',aqe='org.eclipse.elk.insideSelfLoops.yo',bqe='org.eclipse.elk.nodeSize.fixedGraphSize',cqe='org.eclipse.elk.direction',dqe='org.eclipse.elk.nodeLabels.padding',eqe='org.eclipse.elk.portLabels.nextToPortIfPossible',fqe='org.eclipse.elk.portLabels.treatAsGroup',gqe='org.eclipse.elk.portAlignment.default',hqe='org.eclipse.elk.portAlignment.north',iqe='org.eclipse.elk.portAlignment.south',jqe='org.eclipse.elk.portAlignment.west',kqe='org.eclipse.elk.portAlignment.east',lqe='org.eclipse.elk.contentAlignment',mqe='org.eclipse.elk.junctionPoints',nqe='org.eclipse.elk.edgeLabels.placement',oqe='org.eclipse.elk.port.index',pqe='org.eclipse.elk.commentBox',qqe='org.eclipse.elk.hypernode',rqe='org.eclipse.elk.port.anchor',sqe='org.eclipse.elk.partitioning.activate',tqe='org.eclipse.elk.partitioning.partition',uqe='org.eclipse.elk.position',vqe='org.eclipse.elk.margins',wqe='org.eclipse.elk.spacing.portsSurrounding',xqe='org.eclipse.elk.interactiveLayout',yqe='org.eclipse.elk.core.util',zqe={3:1,4:1,5:1,593:1},Aqe='NETWORK_SIMPLEX',Bqe={123:1,51:1},Cqe='org.eclipse.elk.alg.layered.p1cycles',Dqe='org.eclipse.elk.alg.layered.p2layers',Eqe={402:1,225:1},Fqe={832:1,3:1,4:1},Gqe='org.eclipse.elk.alg.layered.p3order',Hqe='org.eclipse.elk.alg.layered.p4nodes',Iqe={3:1,4:1,5:1,840:1},Jqe=1.0E-5,Kqe='org.eclipse.elk.alg.layered.p4nodes.bk',Lqe='org.eclipse.elk.alg.layered.p5edges',Mqe='org.eclipse.elk.alg.layered.p5edges.orthogonal',Nqe='org.eclipse.elk.alg.layered.p5edges.orthogonal.direction',Oqe=1.0E-6,Pqe='org.eclipse.elk.alg.layered.p5edges.splines',Qqe=0.09999999999999998,Rqe=1.0E-8,Sqe=4.71238898038469,Tqe=3.141592653589793,Uqe='org.eclipse.elk.alg.mrtree',Vqe='org.eclipse.elk.alg.mrtree.graph',Wqe='org.eclipse.elk.alg.mrtree.intermediate',Xqe='Set neighbors in level',Yqe='DESCENDANTS',Zqe='org.eclipse.elk.mrtree.weighting',$qe='org.eclipse.elk.mrtree.searchOrder',_qe='org.eclipse.elk.alg.mrtree.options',are='org.eclipse.elk.mrtree',bre='org.eclipse.elk.tree',cre='org.eclipse.elk.alg.radial',dre=6.283185307179586,ere=4.9E-324,fre='org.eclipse.elk.alg.radial.intermediate',gre='org.eclipse.elk.alg.radial.intermediate.compaction',hre={3:1,4:1,5:1,106:1},ire='org.eclipse.elk.alg.radial.intermediate.optimization',jre='No implementation is available for the layout option ',kre='org.eclipse.elk.alg.radial.options',lre='org.eclipse.elk.radial.orderId',mre='org.eclipse.elk.radial.radius',nre='org.eclipse.elk.radial.compactor',ore='org.eclipse.elk.radial.compactionStepSize',pre='org.eclipse.elk.radial.sorter',qre='org.eclipse.elk.radial.wedgeCriteria',rre='org.eclipse.elk.radial.optimizationCriteria',sre='org.eclipse.elk.radial',tre='org.eclipse.elk.alg.radial.p1position.wedge',ure='org.eclipse.elk.alg.radial.sorting',vre=5.497787143782138,wre=3.9269908169872414,xre=2.356194490192345,yre='org.eclipse.elk.alg.rectpacking',zre='org.eclipse.elk.alg.rectpacking.firstiteration',Are='org.eclipse.elk.alg.rectpacking.options',Bre='org.eclipse.elk.rectpacking.optimizationGoal',Cre='org.eclipse.elk.rectpacking.lastPlaceShift',Dre='org.eclipse.elk.rectpacking.currentPosition',Ere='org.eclipse.elk.rectpacking.desiredPosition',Fre='org.eclipse.elk.rectpacking.onlyFirstIteration',Gre='org.eclipse.elk.rectpacking.rowCompaction',Hre='org.eclipse.elk.rectpacking.expandToAspectRatio',Ire='org.eclipse.elk.rectpacking.targetWidth',Jre='org.eclipse.elk.expandNodes',Kre='org.eclipse.elk.rectpacking',Lre='org.eclipse.elk.alg.rectpacking.util',Mre='No implementation available for ',Nre='org.eclipse.elk.alg.spore',Ore='org.eclipse.elk.alg.spore.options',Pre='org.eclipse.elk.sporeCompaction',Qre='org.eclipse.elk.underlyingLayoutAlgorithm',Rre='org.eclipse.elk.processingOrder.treeConstruction',Sre='org.eclipse.elk.processingOrder.spanningTreeCostFunction',Tre='org.eclipse.elk.processingOrder.preferredRoot',Ure='org.eclipse.elk.processingOrder.rootSelection',Vre='org.eclipse.elk.structure.structureExtractionStrategy',Wre='org.eclipse.elk.compaction.compactionStrategy',Xre='org.eclipse.elk.compaction.orthogonal',Yre='org.eclipse.elk.overlapRemoval.maxIterations',Zre='org.eclipse.elk.overlapRemoval.runScanline',$re='processingOrder',_re='overlapRemoval',ase='org.eclipse.elk.sporeOverlap',bse='org.eclipse.elk.alg.spore.p1structure',cse='org.eclipse.elk.alg.spore.p2processingorder',dse='org.eclipse.elk.alg.spore.p3execution',ese='Invalid index: ',fse='org.eclipse.elk.core.alg',gse={331:1},hse={288:1},ise='Make sure its type is registered with the ',jse=' utility class.',kse='true',lse='false',mse="Couldn't clone property '",nse=0.05,ose='org.eclipse.elk.core.options',pse=1.2999999523162842,qse='org.eclipse.elk.box',rse='org.eclipse.elk.box.packingMode',sse='org.eclipse.elk.algorithm',tse='org.eclipse.elk.resolvedAlgorithm',use='org.eclipse.elk.bendPoints',vse='org.eclipse.elk.labelManager',wse='org.eclipse.elk.scaleFactor',xse='org.eclipse.elk.animate',yse='org.eclipse.elk.animTimeFactor',zse='org.eclipse.elk.layoutAncestors',Ase='org.eclipse.elk.maxAnimTime',Bse='org.eclipse.elk.minAnimTime',Cse='org.eclipse.elk.progressBar',Dse='org.eclipse.elk.validateGraph',Ese='org.eclipse.elk.validateOptions',Fse='org.eclipse.elk.zoomToFit',Gse='org.eclipse.elk.font.name',Hse='org.eclipse.elk.font.size',Ise='org.eclipse.elk.edge.type',Jse='partitioning',Kse='nodeLabels',Lse='portAlignment',Mse='nodeSize',Nse='port',Ose='portLabels',Pse='insideSelfLoops',Qse='org.eclipse.elk.fixed',Rse='org.eclipse.elk.random',Sse='port must have a parent node to calculate the port side',Tse='The edge needs to have exactly one edge section. Found: ',Use='org.eclipse.elk.core.util.adapters',Vse='org.eclipse.emf.ecore',Wse='org.eclipse.elk.graph',Xse='EMapPropertyHolder',Yse='ElkBendPoint',Zse='ElkGraphElement',$se='ElkConnectableShape',_se='ElkEdge',ate='ElkEdgeSection',bte='EModelElement',cte='ENamedElement',dte='ElkLabel',ete='ElkNode',fte='ElkPort',gte={92:1,90:1},hte='org.eclipse.emf.common.notify.impl',ite="The feature '",jte="' is not a valid changeable feature",kte='Expecting null',lte="' is not a valid feature",mte='The feature ID',nte=' is not a valid feature ID',ote=32768,pte={105:1,92:1,90:1,56:1,49:1,97:1},qte='org.eclipse.emf.ecore.impl',rte='org.eclipse.elk.graph.impl',ste='Recursive containment not allowed for ',tte="The datatype '",ute="' is not a valid classifier",vte="The value '",wte={190:1,3:1,4:1},xte="The class '",yte='http://www.eclipse.org/elk/ElkGraph',zte=1024,Ate='property',Bte='value',Cte='source',Dte='properties',Ete='identifier',Fte='height',Gte='width',Hte='parent',Ite='text',Jte='children',Kte='hierarchical',Lte='sources',Mte='targets',Nte='sections',Ote='bendPoints',Pte='outgoingShape',Qte='incomingShape',Rte='outgoingSections',Ste='incomingSections',Tte='org.eclipse.emf.common.util',Ute='Severe implementation error in the Json to ElkGraph importer.',Vte='id',Wte='org.eclipse.elk.graph.json',Xte='Unhandled parameter types: ',Yte='startPoint',Zte="An edge must have at least one source and one target (edge id: '",$te="').",_te='Referenced edge section does not exist: ',aue=" (edge id: '",bue='target',cue='sourcePoint',due='targetPoint',eue='group',fue='name',gue='connectableShape cannot be null',hue='edge cannot be null',iue="Passed edge is not 'simple'.",jue='org.eclipse.elk.graph.util',kue="The 'no duplicates' constraint is violated",lue='targetIndex=',mue=', size=',nue='sourceIndex=',oue={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1},pue={3:1,4:1,20:1,28:1,52:1,14:1,47:1,15:1,54:1,67:1,63:1,58:1,588:1},que='logging',rue='measureExecutionTime',sue='parser.parse.1',tue='parser.parse.2',uue='parser.next.1',vue='parser.next.2',wue='parser.next.3',xue='parser.next.4',yue='parser.factor.1',zue='parser.factor.2',Aue='parser.factor.3',Bue='parser.factor.4',Cue='parser.factor.5',Due='parser.factor.6',Eue='parser.atom.1',Fue='parser.atom.2',Gue='parser.atom.3',Hue='parser.atom.4',Iue='parser.atom.5',Jue='parser.cc.1',Kue='parser.cc.2',Lue='parser.cc.3',Mue='parser.cc.5',Nue='parser.cc.6',Oue='parser.cc.7',Pue='parser.cc.8',Que='parser.ope.1',Rue='parser.ope.2',Sue='parser.ope.3',Tue='parser.descape.1',Uue='parser.descape.2',Vue='parser.descape.3',Wue='parser.descape.4',Xue='parser.descape.5',Yue='parser.process.1',Zue='parser.quantifier.1',$ue='parser.quantifier.2',_ue='parser.quantifier.3',ave='parser.quantifier.4',bve='parser.quantifier.5',cve='org.eclipse.emf.common.notify',dve={415:1,672:1},eve={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1},fve={366:1,143:1},gve='index=',hve={3:1,4:1,5:1,126:1},ive={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,58:1},jve={3:1,6:1,4:1,5:1,192:1},kve={3:1,4:1,5:1,165:1,367:1},lve=';/?:@&=+$,',mve='invalid authority: ',nve='EAnnotation',ove='ETypedElement',pve='EStructuralFeature',qve='EAttribute',rve='EClassifier',sve='EEnumLiteral',tve='EGenericType',uve='EOperation',vve='EParameter',wve='EReference',xve='ETypeParameter',yve='org.eclipse.emf.ecore.util',zve={76:1},Ave={3:1,20:1,14:1,15:1,58:1,589:1,76:1,69:1,95:1},Bve='org.eclipse.emf.ecore.util.FeatureMap$Entry',Cve=8192,Dve=2048,Eve='byte',Fve='char',Gve='double',Hve='float',Ive='int',Jve='long',Kve='short',Lve='java.lang.Object',Mve={3:1,4:1,5:1,247:1},Nve={3:1,4:1,5:1,673:1},Ove={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,69:1},Pve={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,69:1,95:1},Qve='mixed',Rve='http:///org/eclipse/emf/ecore/util/ExtendedMetaData',Sve='kind',Tve={3:1,4:1,5:1,674:1},Uve={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1,76:1,69:1,95:1},Vve={20:1,28:1,52:1,14:1,15:1,58:1,69:1},Wve={47:1,125:1,279:1},Xve={72:1,332:1},Yve="The value of type '",Zve="' must be of type '",$ve=1316,_ve='http://www.eclipse.org/emf/2002/Ecore',awe=-32768,bwe='constraints',cwe='baseType',dwe='getEStructuralFeature',ewe='getFeatureID',fwe='feature',gwe='getOperationID',hwe='operation',iwe='defaultValue',jwe='eTypeParameters',kwe='isInstance',lwe='getEEnumLiteral',mwe='eContainingClass',nwe={55:1},owe={3:1,4:1,5:1,119:1},pwe='org.eclipse.emf.ecore.resource',qwe={92:1,90:1,591:1,1935:1},rwe='org.eclipse.emf.ecore.resource.impl',swe='unspecified',twe='simple',uwe='attribute',vwe='attributeWildcard',wwe='element',xwe='elementWildcard',ywe='collapse',zwe='itemType',Awe='namespace',Bwe='##targetNamespace',Cwe='whiteSpace',Dwe='wildcards',Ewe='http://www.eclipse.org/emf/2003/XMLType',Fwe='##any',Gwe='uninitialized',Hwe='The multiplicity constraint is violated',Iwe='org.eclipse.emf.ecore.xml.type',Jwe='ProcessingInstruction',Kwe='SimpleAnyType',Lwe='XMLTypeDocumentRoot',Mwe='org.eclipse.emf.ecore.xml.type.impl',Nwe='INF',Owe='processing',Pwe='ENTITIES_._base',Qwe='minLength',Rwe='ENTITY',Swe='NCName',Twe='IDREFS_._base',Uwe='integer',Vwe='token',Wwe='pattern',Xwe='[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*',Ywe='\\i\\c*',Zwe='[\\i-[:]][\\c-[:]]*',$we='nonPositiveInteger',_we='maxInclusive',axe='NMTOKEN',bxe='NMTOKENS_._base',cxe='nonNegativeInteger',dxe='minInclusive',exe='normalizedString',fxe='unsignedByte',gxe='unsignedInt',hxe='18446744073709551615',ixe='unsignedShort',jxe='processingInstruction',kxe='org.eclipse.emf.ecore.xml.type.internal',lxe=1114111,mxe='Internal Error: shorthands: \\u',nxe='xml:isDigit',oxe='xml:isWord',pxe='xml:isSpace',qxe='xml:isNameChar',rxe='xml:isInitialNameChar',sxe='09\u0660\u0669\u06F0\u06F9\u0966\u096F\u09E6\u09EF\u0A66\u0A6F\u0AE6\u0AEF\u0B66\u0B6F\u0BE7\u0BEF\u0C66\u0C6F\u0CE6\u0CEF\u0D66\u0D6F\u0E50\u0E59\u0ED0\u0ED9\u0F20\u0F29',txe='AZaz\xC0\xD6\xD8\xF6\xF8\u0131\u0134\u013E\u0141\u0148\u014A\u017E\u0180\u01C3\u01CD\u01F0\u01F4\u01F5\u01FA\u0217\u0250\u02A8\u02BB\u02C1\u0386\u0386\u0388\u038A\u038C\u038C\u038E\u03A1\u03A3\u03CE\u03D0\u03D6\u03DA\u03DA\u03DC\u03DC\u03DE\u03DE\u03E0\u03E0\u03E2\u03F3\u0401\u040C\u040E\u044F\u0451\u045C\u045E\u0481\u0490\u04C4\u04C7\u04C8\u04CB\u04CC\u04D0\u04EB\u04EE\u04F5\u04F8\u04F9\u0531\u0556\u0559\u0559\u0561\u0586\u05D0\u05EA\u05F0\u05F2\u0621\u063A\u0641\u064A\u0671\u06B7\u06BA\u06BE\u06C0\u06CE\u06D0\u06D3\u06D5\u06D5\u06E5\u06E6\u0905\u0939\u093D\u093D\u0958\u0961\u0985\u098C\u098F\u0990\u0993\u09A8\u09AA\u09B0\u09B2\u09B2\u09B6\u09B9\u09DC\u09DD\u09DF\u09E1\u09F0\u09F1\u0A05\u0A0A\u0A0F\u0A10\u0A13\u0A28\u0A2A\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59\u0A5C\u0A5E\u0A5E\u0A72\u0A74\u0A85\u0A8B\u0A8D\u0A8D\u0A8F\u0A91\u0A93\u0AA8\u0AAA\u0AB0\u0AB2\u0AB3\u0AB5\u0AB9\u0ABD\u0ABD\u0AE0\u0AE0\u0B05\u0B0C\u0B0F\u0B10\u0B13\u0B28\u0B2A\u0B30\u0B32\u0B33\u0B36\u0B39\u0B3D\u0B3D\u0B5C\u0B5D\u0B5F\u0B61\u0B85\u0B8A\u0B8E\u0B90\u0B92\u0B95\u0B99\u0B9A\u0B9C\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8\u0BAA\u0BAE\u0BB5\u0BB7\u0BB9\u0C05\u0C0C\u0C0E\u0C10\u0C12\u0C28\u0C2A\u0C33\u0C35\u0C39\u0C60\u0C61\u0C85\u0C8C\u0C8E\u0C90\u0C92\u0CA8\u0CAA\u0CB3\u0CB5\u0CB9\u0CDE\u0CDE\u0CE0\u0CE1\u0D05\u0D0C\u0D0E\u0D10\u0D12\u0D28\u0D2A\u0D39\u0D60\u0D61\u0E01\u0E2E\u0E30\u0E30\u0E32\u0E33\u0E40\u0E45\u0E81\u0E82\u0E84\u0E84\u0E87\u0E88\u0E8A\u0E8A\u0E8D\u0E8D\u0E94\u0E97\u0E99\u0E9F\u0EA1\u0EA3\u0EA5\u0EA5\u0EA7\u0EA7\u0EAA\u0EAB\u0EAD\u0EAE\u0EB0\u0EB0\u0EB2\u0EB3\u0EBD\u0EBD\u0EC0\u0EC4\u0F40\u0F47\u0F49\u0F69\u10A0\u10C5\u10D0\u10F6\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110B\u110C\u110E\u1112\u113C\u113C\u113E\u113E\u1140\u1140\u114C\u114C\u114E\u114E\u1150\u1150\u1154\u1155\u1159\u1159\u115F\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116D\u116E\u1172\u1173\u1175\u1175\u119E\u119E\u11A8\u11A8\u11AB\u11AB\u11AE\u11AF\u11B7\u11B8\u11BA\u11BA\u11BC\u11C2\u11EB\u11EB\u11F0\u11F0\u11F9\u11F9\u1E00\u1E9B\u1EA0\u1EF9\u1F00\u1F15\u1F18\u1F1D\u1F20\u1F45\u1F48\u1F4D\u1F50\u1F57\u1F59\u1F59\u1F5B\u1F5B\u1F5D\u1F5D\u1F5F\u1F7D\u1F80\u1FB4\u1FB6\u1FBC\u1FBE\u1FBE\u1FC2\u1FC4\u1FC6\u1FCC\u1FD0\u1FD3\u1FD6\u1FDB\u1FE0\u1FEC\u1FF2\u1FF4\u1FF6\u1FFC\u2126\u2126\u212A\u212B\u212E\u212E\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30A1\u30FA\u3105\u312C\u4E00\u9FA5\uAC00\uD7A3',uxe='Private Use',vxe='ASSIGNED',wxe='\x00\x7F\x80\xFF\u0100\u017F\u0180\u024F\u0250\u02AF\u02B0\u02FF\u0300\u036F\u0370\u03FF\u0400\u04FF\u0530\u058F\u0590\u05FF\u0600\u06FF\u0700\u074F\u0780\u07BF\u0900\u097F\u0980\u09FF\u0A00\u0A7F\u0A80\u0AFF\u0B00\u0B7F\u0B80\u0BFF\u0C00\u0C7F\u0C80\u0CFF\u0D00\u0D7F\u0D80\u0DFF\u0E00\u0E7F\u0E80\u0EFF\u0F00\u0FFF\u1000\u109F\u10A0\u10FF\u1100\u11FF\u1200\u137F\u13A0\u13FF\u1400\u167F\u1680\u169F\u16A0\u16FF\u1780\u17FF\u1800\u18AF\u1E00\u1EFF\u1F00\u1FFF\u2000\u206F\u2070\u209F\u20A0\u20CF\u20D0\u20FF\u2100\u214F\u2150\u218F\u2190\u21FF\u2200\u22FF\u2300\u23FF\u2400\u243F\u2440\u245F\u2460\u24FF\u2500\u257F\u2580\u259F\u25A0\u25FF\u2600\u26FF\u2700\u27BF\u2800\u28FF\u2E80\u2EFF\u2F00\u2FDF\u2FF0\u2FFF\u3000\u303F\u3040\u309F\u30A0\u30FF\u3100\u312F\u3130\u318F\u3190\u319F\u31A0\u31BF\u3200\u32FF\u3300\u33FF\u3400\u4DB5\u4E00\u9FFF\uA000\uA48F\uA490\uA4CF\uAC00\uD7A3\uE000\uF8FF\uF900\uFAFF\uFB00\uFB4F\uFB50\uFDFF\uFE20\uFE2F\uFE30\uFE4F\uFE50\uFE6F\uFE70\uFEFE\uFEFF\uFEFF\uFF00\uFFEF',xxe='UNASSIGNED',yxe={3:1,117:1},zxe='org.eclipse.emf.ecore.xml.type.util',Axe={3:1,4:1,5:1,368:1},Bxe='org.eclipse.xtext.xbase.lib',Cxe='Cannot add elements to a Range',Dxe='Cannot set elements in a Range',Exe='Cannot remove elements from a Range',Fxe='locale',Gxe='default',Hxe='user.agent';var _,_bb,Wbb,tbb=-1;$wnd.goog=$wnd.goog||{};$wnd.goog.global=$wnd.goog.global||$wnd;acb();bcb(1,null,{},nb);_.Fb=function ob(a){return mb(this,a)};_.Gb=function qb(){return this.gm};_.Hb=function sb(){return FCb(this)};_.Ib=function ub(){var a;return hdb(rb(this))+'@'+(a=tb(this)>>>0,a.toString(16))};_.equals=function(a){return this.Fb(a)};_.hashCode=function(){return this.Hb()};_.toString=function(){return this.Ib()};var xD,yD,zD;bcb(290,1,{290:1,2026:1},jdb);_.le=function kdb(a){var b;b=new jdb;b.i=4;a>1?(b.c=rdb(this,a-1)):(b.c=this);return b};_.me=function qdb(){fdb(this);return this.b};_.ne=function sdb(){return hdb(this)};_.oe=function udb(){return fdb(this),this.k};_.pe=function wdb(){return (this.i&4)!=0};_.qe=function xdb(){return (this.i&1)!=0};_.Ib=function Adb(){return idb(this)};_.i=0;var edb=1;var SI=mdb(Phe,'Object',1);var AI=mdb(Phe,'Class',290);bcb(1998,1,Qhe);var $D=mdb(Rhe,'Optional',1998);bcb(1170,1998,Qhe,xb);_.Fb=function yb(a){return a===this};_.Hb=function zb(){return 2040732332};_.Ib=function Ab(){return 'Optional.absent()'};_.Jb=function Bb(a){Qb(a);return wb(),vb};var vb;var YD=mdb(Rhe,'Absent',1170);bcb(628,1,{},Gb);var ZD=mdb(Rhe,'Joiner',628);var _D=odb(Rhe,'Predicate');bcb(582,1,{169:1,582:1,3:1,45:1},Yb);_.Mb=function ac(a){return Xb(this,a)};_.Lb=function Zb(a){return Xb(this,a)};_.Fb=function $b(a){var b;if(JD(a,582)){b=BD(a,582);return At(this.a,b.a)}return false};_.Hb=function _b(){return qmb(this.a)+306654252};_.Ib=function bc(){return Wb(this.a)};var aE=mdb(Rhe,'Predicates/AndPredicate',582);bcb(408,1998,{408:1,3:1},cc);_.Fb=function dc(a){var b;if(JD(a,408)){b=BD(a,408);return pb(this.a,b.a)}return false};_.Hb=function ec(){return 1502476572+tb(this.a)};_.Ib=function fc(){return Whe+this.a+')'};_.Jb=function gc(a){return new cc(Rb(a.Kb(this.a),'the Function passed to Optional.transform() must not return null.'))};var bE=mdb(Rhe,'Present',408);bcb(198,1,Yhe);_.Nb=function kc(a){Rrb(this,a)};_.Qb=function lc(){jc()};var MH=mdb(Zhe,'UnmodifiableIterator',198);bcb(1978,198,$he);_.Qb=function nc(){jc()};_.Rb=function mc(a){throw vbb(new bgb)};_.Wb=function oc(a){throw vbb(new bgb)};var NH=mdb(Zhe,'UnmodifiableListIterator',1978);bcb(386,1978,$he);_.Ob=function rc(){return this.c0};_.Pb=function tc(){if(this.c>=this.d){throw vbb(new utb)}return this.Xb(this.c++)};_.Tb=function uc(){return this.c};_.Ub=function vc(){if(this.c<=0){throw vbb(new utb)}return this.Xb(--this.c)};_.Vb=function wc(){return this.c-1};_.c=0;_.d=0;var cE=mdb(Zhe,'AbstractIndexedListIterator',386);bcb(699,198,Yhe);_.Ob=function Ac(){return xc(this)};_.Pb=function Bc(){return yc(this)};_.e=1;var dE=mdb(Zhe,'AbstractIterator',699);bcb(1986,1,{224:1});_.Zb=function Hc(){var a;return a=this.f,!a?(this.f=this.ac()):a};_.Fb=function Ic(a){return hw(this,a)};_.Hb=function Jc(){return tb(this.Zb())};_.dc=function Kc(){return this.gc()==0};_.ec=function Lc(){return Ec(this)};_.Ib=function Mc(){return fcb(this.Zb())};var IE=mdb(Zhe,'AbstractMultimap',1986);bcb(726,1986,_he);_.$b=function Xc(){Nc(this)};_._b=function Yc(a){return Oc(this,a)};_.ac=function Zc(){return new ne(this,this.c)};_.ic=function $c(a){return this.hc()};_.bc=function _c(){return new zf(this,this.c)};_.jc=function ad(){return this.mc(this.hc())};_.kc=function bd(){return new Hd(this)};_.lc=function cd(){return Yj(this.c.vc().Nc(),new $g,64,this.d)};_.cc=function dd(a){return Qc(this,a)};_.fc=function gd(a){return Sc(this,a)};_.gc=function hd(){return this.d};_.mc=function jd(a){return mmb(),new lnb(a)};_.nc=function kd(){return new Dd(this)};_.oc=function ld(){return Yj(this.c.Cc().Nc(),new Fd,64,this.d)};_.pc=function md(a,b){return new dg(this,a,b,null)};_.d=0;var DE=mdb(Zhe,'AbstractMapBasedMultimap',726);bcb(1631,726,_he);_.hc=function pd(){return new Skb(this.a)};_.jc=function qd(){return mmb(),mmb(),jmb};_.cc=function sd(a){return BD(Qc(this,a),15)};_.fc=function ud(a){return BD(Sc(this,a),15)};_.Zb=function od(){return nd(this)};_.Fb=function rd(a){return hw(this,a)};_.qc=function td(a){return BD(Qc(this,a),15)};_.rc=function vd(a){return BD(Sc(this,a),15)};_.mc=function wd(a){return vmb(BD(a,15))};_.pc=function xd(a,b){return Vc(this,a,BD(b,15),null)};var eE=mdb(Zhe,'AbstractListMultimap',1631);bcb(732,1,aie);_.Nb=function zd(a){Rrb(this,a)};_.Ob=function Ad(){return this.c.Ob()||this.e.Ob()};_.Pb=function Bd(){var a;if(!this.e.Ob()){a=BD(this.c.Pb(),42);this.b=a.cd();this.a=BD(a.dd(),14);this.e=this.a.Kc()}return this.sc(this.b,this.e.Pb())};_.Qb=function Cd(){this.e.Qb();this.a.dc()&&this.c.Qb();--this.d.d};var mE=mdb(Zhe,'AbstractMapBasedMultimap/Itr',732);bcb(1099,732,aie,Dd);_.sc=function Ed(a,b){return b};var fE=mdb(Zhe,'AbstractMapBasedMultimap/1',1099);bcb(1100,1,{},Fd);_.Kb=function Gd(a){return BD(a,14).Nc()};var gE=mdb(Zhe,'AbstractMapBasedMultimap/1methodref$spliterator$Type',1100);bcb(1101,732,aie,Hd);_.sc=function Id(a,b){return new Wo(a,b)};var hE=mdb(Zhe,'AbstractMapBasedMultimap/2',1101);var DK=odb(bie,'Map');bcb(1967,1,cie);_.wc=function Td(a){stb(this,a)};_.yc=function $d(a,b,c){return ttb(this,a,b,c)};_.$b=function Od(){this.vc().$b()};_.tc=function Pd(a){return Jd(this,a)};_._b=function Qd(a){return !!Kd(this,a,false)};_.uc=function Rd(a){var b,c,d;for(c=this.vc().Kc();c.Ob();){b=BD(c.Pb(),42);d=b.dd();if(PD(a)===PD(d)||a!=null&&pb(a,d)){return true}}return false};_.Fb=function Sd(a){var b,c,d;if(a===this){return true}if(!JD(a,83)){return false}d=BD(a,83);if(this.gc()!=d.gc()){return false}for(c=d.vc().Kc();c.Ob();){b=BD(c.Pb(),42);if(!this.tc(b)){return false}}return true};_.xc=function Ud(a){return Wd(Kd(this,a,false))};_.Hb=function Xd(){return pmb(this.vc())};_.dc=function Yd(){return this.gc()==0};_.ec=function Zd(){return new Pib(this)};_.zc=function _d(a,b){throw vbb(new cgb('Put not supported on this map'))};_.Ac=function ae(a){Ld(this,a)};_.Bc=function be(a){return Wd(Kd(this,a,true))};_.gc=function ce(){return this.vc().gc()};_.Ib=function de(){return Md(this)};_.Cc=function ee(){return new $ib(this)};var sJ=mdb(bie,'AbstractMap',1967);bcb(1987,1967,cie);_.bc=function ge(){return new rf(this)};_.vc=function he(){return fe(this)};_.ec=function ie(){var a;a=this.g;return !a?(this.g=this.bc()):a};_.Cc=function je(){var a;a=this.i;return !a?(this.i=new Zv(this)):a};var bH=mdb(Zhe,'Maps/ViewCachingAbstractMap',1987);bcb(389,1987,cie,ne);_.xc=function se(a){return ke(this,a)};_.Bc=function ve(a){return le(this,a)};_.$b=function oe(){this.d==this.e.c?this.e.$b():ir(new mf(this))};_._b=function pe(a){return Gv(this.d,a)};_.Ec=function qe(){return new df(this)};_.Dc=function(){return this.Ec()};_.Fb=function re(a){return this===a||pb(this.d,a)};_.Hb=function te(){return tb(this.d)};_.ec=function ue(){return this.e.ec()};_.gc=function we(){return this.d.gc()};_.Ib=function xe(){return fcb(this.d)};var lE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap',389);var KI=odb(Phe,'Iterable');bcb(28,1,die);_.Jc=function Le(a){reb(this,a)};_.Lc=function Ne(){return this.Oc()};_.Nc=function Pe(){return new Kub(this,0)};_.Oc=function Qe(){return new YAb(null,this.Nc())};_.Fc=function Ge(a){throw vbb(new cgb('Add not supported on this collection'))};_.Gc=function He(a){return ye(this,a)};_.$b=function Ie(){Ae(this)};_.Hc=function Je(a){return ze(this,a,false)};_.Ic=function Ke(a){return Be(this,a)};_.dc=function Me(){return this.gc()==0};_.Mc=function Oe(a){return ze(this,a,true)};_.Pc=function Re(){return De(this)};_.Qc=function Se(a){return Ee(this,a)};_.Ib=function Te(){return Fe(this)};var dJ=mdb(bie,'AbstractCollection',28);var LK=odb(bie,'Set');bcb(eie,28,fie);_.Nc=function Ye(){return new Kub(this,1)};_.Fb=function We(a){return Ue(this,a)};_.Hb=function Xe(){return pmb(this)};var zJ=mdb(bie,'AbstractSet',eie);bcb(1970,eie,fie);var BH=mdb(Zhe,'Sets/ImprovedAbstractSet',1970);bcb(1971,1970,fie);_.$b=function $e(){this.Rc().$b()};_.Hc=function _e(a){return Ze(this,a)};_.dc=function af(){return this.Rc().dc()};_.Mc=function bf(a){var b;if(this.Hc(a)){b=BD(a,42);return this.Rc().ec().Mc(b.cd())}return false};_.gc=function cf(){return this.Rc().gc()};var WG=mdb(Zhe,'Maps/EntrySet',1971);bcb(1097,1971,fie,df);_.Hc=function ef(a){return Ck(this.a.d.vc(),a)};_.Kc=function ff(){return new mf(this.a)};_.Rc=function gf(){return this.a};_.Mc=function hf(a){var b;if(!Ck(this.a.d.vc(),a)){return false}b=BD(a,42);Tc(this.a.e,b.cd());return true};_.Nc=function jf(){return $j(this.a.d.vc().Nc(),new kf(this.a))};var jE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap/AsMapEntries',1097);bcb(1098,1,{},kf);_.Kb=function lf(a){return me(this.a,BD(a,42))};var iE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap/AsMapEntries/0methodref$wrapEntry$Type',1098);bcb(730,1,aie,mf);_.Nb=function nf(a){Rrb(this,a)};_.Pb=function pf(){var a;return a=BD(this.b.Pb(),42),this.a=BD(a.dd(),14),me(this.c,a)};_.Ob=function of(){return this.b.Ob()};_.Qb=function qf(){Vb(!!this.a);this.b.Qb();this.c.e.d-=this.a.gc();this.a.$b();this.a=null};var kE=mdb(Zhe,'AbstractMapBasedMultimap/AsMap/AsMapIterator',730);bcb(532,1970,fie,rf);_.$b=function sf(){this.b.$b()};_.Hc=function tf(a){return this.b._b(a)};_.Jc=function uf(a){Qb(a);this.b.wc(new Xv(a))};_.dc=function vf(){return this.b.dc()};_.Kc=function wf(){return new Mv(this.b.vc().Kc())};_.Mc=function xf(a){if(this.b._b(a)){this.b.Bc(a);return true}return false};_.gc=function yf(){return this.b.gc()};var $G=mdb(Zhe,'Maps/KeySet',532);bcb(318,532,fie,zf);_.$b=function Af(){var a;ir((a=this.b.vc().Kc(),new Hf(this,a)))};_.Ic=function Bf(a){return this.b.ec().Ic(a)};_.Fb=function Cf(a){return this===a||pb(this.b.ec(),a)};_.Hb=function Df(){return tb(this.b.ec())};_.Kc=function Ef(){var a;return a=this.b.vc().Kc(),new Hf(this,a)};_.Mc=function Ff(a){var b,c;c=0;b=BD(this.b.Bc(a),14);if(b){c=b.gc();b.$b();this.a.d-=c}return c>0};_.Nc=function Gf(){return this.b.ec().Nc()};var oE=mdb(Zhe,'AbstractMapBasedMultimap/KeySet',318);bcb(731,1,aie,Hf);_.Nb=function If(a){Rrb(this,a)};_.Ob=function Jf(){return this.c.Ob()};_.Pb=function Kf(){this.a=BD(this.c.Pb(),42);return this.a.cd()};_.Qb=function Lf(){var a;Vb(!!this.a);a=BD(this.a.dd(),14);this.c.Qb();this.b.a.d-=a.gc();a.$b();this.a=null};var nE=mdb(Zhe,'AbstractMapBasedMultimap/KeySet/1',731);bcb(491,389,{83:1,161:1},Mf);_.bc=function Nf(){return this.Sc()};_.ec=function Pf(){return this.Tc()};_.Sc=function Of(){return new Yf(this.c,this.Uc())};_.Tc=function Qf(){var a;return a=this.b,!a?(this.b=this.Sc()):a};_.Uc=function Rf(){return BD(this.d,161)};var sE=mdb(Zhe,'AbstractMapBasedMultimap/SortedAsMap',491);bcb(542,491,gie,Sf);_.bc=function Tf(){return new $f(this.a,BD(BD(this.d,161),171))};_.Sc=function Uf(){return new $f(this.a,BD(BD(this.d,161),171))};_.ec=function Vf(){var a;return a=this.b,BD(!a?(this.b=new $f(this.a,BD(BD(this.d,161),171))):a,271)};_.Tc=function Wf(){var a;return a=this.b,BD(!a?(this.b=new $f(this.a,BD(BD(this.d,161),171))):a,271)};_.Uc=function Xf(){return BD(BD(this.d,161),171)};var pE=mdb(Zhe,'AbstractMapBasedMultimap/NavigableAsMap',542);bcb(490,318,hie,Yf);_.Nc=function Zf(){return this.b.ec().Nc()};var tE=mdb(Zhe,'AbstractMapBasedMultimap/SortedKeySet',490);bcb(388,490,iie,$f);var qE=mdb(Zhe,'AbstractMapBasedMultimap/NavigableKeySet',388);bcb(541,28,die,dg);_.Fc=function eg(a){var b,c;ag(this);c=this.d.dc();b=this.d.Fc(a);if(b){++this.f.d;c&&_f(this)}return b};_.Gc=function fg(a){var b,c,d;if(a.dc()){return false}d=(ag(this),this.d.gc());b=this.d.Gc(a);if(b){c=this.d.gc();this.f.d+=c-d;d==0&&_f(this)}return b};_.$b=function gg(){var a;a=(ag(this),this.d.gc());if(a==0){return}this.d.$b();this.f.d-=a;bg(this)};_.Hc=function hg(a){ag(this);return this.d.Hc(a)};_.Ic=function ig(a){ag(this);return this.d.Ic(a)};_.Fb=function jg(a){if(a===this){return true}ag(this);return pb(this.d,a)};_.Hb=function kg(){ag(this);return tb(this.d)};_.Kc=function lg(){ag(this);return new Gg(this)};_.Mc=function mg(a){var b;ag(this);b=this.d.Mc(a);if(b){--this.f.d;bg(this)}return b};_.gc=function ng(){return cg(this)};_.Nc=function og(){return ag(this),this.d.Nc()};_.Ib=function pg(){ag(this);return fcb(this.d)};var vE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedCollection',541);var yK=odb(bie,'List');bcb(728,541,{20:1,28:1,14:1,15:1},qg);_.ad=function zg(a){ktb(this,a)};_.Nc=function Ag(){return ag(this),this.d.Nc()};_.Vc=function rg(a,b){var c;ag(this);c=this.d.dc();BD(this.d,15).Vc(a,b);++this.a.d;c&&_f(this)};_.Wc=function sg(a,b){var c,d,e;if(b.dc()){return false}e=(ag(this),this.d.gc());c=BD(this.d,15).Wc(a,b);if(c){d=this.d.gc();this.a.d+=d-e;e==0&&_f(this)}return c};_.Xb=function tg(a){ag(this);return BD(this.d,15).Xb(a)};_.Xc=function ug(a){ag(this);return BD(this.d,15).Xc(a)};_.Yc=function vg(){ag(this);return new Mg(this)};_.Zc=function wg(a){ag(this);return new Ng(this,a)};_.$c=function xg(a){var b;ag(this);b=BD(this.d,15).$c(a);--this.a.d;bg(this);return b};_._c=function yg(a,b){ag(this);return BD(this.d,15)._c(a,b)};_.bd=function Bg(a,b){ag(this);return Vc(this.a,this.e,BD(this.d,15).bd(a,b),!this.b?this:this.b)};var xE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedList',728);bcb(1096,728,{20:1,28:1,14:1,15:1,54:1},Cg);var rE=mdb(Zhe,'AbstractMapBasedMultimap/RandomAccessWrappedList',1096);bcb(620,1,aie,Gg);_.Nb=function Ig(a){Rrb(this,a)};_.Ob=function Jg(){Fg(this);return this.b.Ob()};_.Pb=function Kg(){Fg(this);return this.b.Pb()};_.Qb=function Lg(){Eg(this)};var uE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedCollection/WrappedIterator',620);bcb(729,620,jie,Mg,Ng);_.Qb=function Tg(){Eg(this)};_.Rb=function Og(a){var b;b=cg(this.a)==0;(Fg(this),BD(this.b,125)).Rb(a);++this.a.a.d;b&&_f(this.a)};_.Sb=function Pg(){return (Fg(this),BD(this.b,125)).Sb()};_.Tb=function Qg(){return (Fg(this),BD(this.b,125)).Tb()};_.Ub=function Rg(){return (Fg(this),BD(this.b,125)).Ub()};_.Vb=function Sg(){return (Fg(this),BD(this.b,125)).Vb()};_.Wb=function Ug(a){(Fg(this),BD(this.b,125)).Wb(a)};var wE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedList/WrappedListIterator',729);bcb(727,541,hie,Vg);_.Nc=function Wg(){return ag(this),this.d.Nc()};var AE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedSortedSet',727);bcb(1095,727,iie,Xg);var yE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedNavigableSet',1095);bcb(1094,541,fie,Yg);_.Nc=function Zg(){return ag(this),this.d.Nc()};var zE=mdb(Zhe,'AbstractMapBasedMultimap/WrappedSet',1094);bcb(1103,1,{},$g);_.Kb=function _g(a){return fd(BD(a,42))};var BE=mdb(Zhe,'AbstractMapBasedMultimap/lambda$1$Type',1103);bcb(1102,1,{},ah);_.Kb=function bh(a){return new Wo(this.a,a)};var CE=mdb(Zhe,'AbstractMapBasedMultimap/lambda$2$Type',1102);var CK=odb(bie,'Map/Entry');bcb(345,1,kie);_.Fb=function dh(a){var b;if(JD(a,42)){b=BD(a,42);return Hb(this.cd(),b.cd())&&Hb(this.dd(),b.dd())}return false};_.Hb=function eh(){var a,b;a=this.cd();b=this.dd();return (a==null?0:tb(a))^(b==null?0:tb(b))};_.ed=function fh(a){throw vbb(new bgb)};_.Ib=function gh(){return this.cd()+'='+this.dd()};var EE=mdb(Zhe,lie,345);bcb(1988,28,die);_.$b=function hh(){this.fd().$b()};_.Hc=function ih(a){var b;if(JD(a,42)){b=BD(a,42);return Cc(this.fd(),b.cd(),b.dd())}return false};_.Mc=function jh(a){var b;if(JD(a,42)){b=BD(a,42);return Gc(this.fd(),b.cd(),b.dd())}return false};_.gc=function kh(){return this.fd().d};var fH=mdb(Zhe,'Multimaps/Entries',1988);bcb(733,1988,die,lh);_.Kc=function mh(){return this.a.kc()};_.fd=function nh(){return this.a};_.Nc=function oh(){return this.a.lc()};var FE=mdb(Zhe,'AbstractMultimap/Entries',733);bcb(734,733,fie,ph);_.Nc=function sh(){return this.a.lc()};_.Fb=function qh(a){return Ax(this,a)};_.Hb=function rh(){return Bx(this)};var GE=mdb(Zhe,'AbstractMultimap/EntrySet',734);bcb(735,28,die,th);_.$b=function uh(){this.a.$b()};_.Hc=function vh(a){return Dc(this.a,a)};_.Kc=function wh(){return this.a.nc()};_.gc=function xh(){return this.a.d};_.Nc=function yh(){return this.a.oc()};var HE=mdb(Zhe,'AbstractMultimap/Values',735);bcb(1989,28,{835:1,20:1,28:1,14:1});_.Jc=function Gh(a){Qb(a);Ah(this).Jc(new Xw(a))};_.Nc=function Kh(){var a;return a=Ah(this).Nc(),Yj(a,new cx,64|a.qd()&1296,this.a.d)};_.Fc=function Ch(a){zh();return true};_.Gc=function Dh(a){return Qb(this),Qb(a),JD(a,543)?Zw(BD(a,835)):!a.dc()&&fr(this,a.Kc())};_.Hc=function Eh(a){var b;return b=BD(Hv(nd(this.a),a),14),(!b?0:b.gc())>0};_.Fb=function Fh(a){return $w(this,a)};_.Hb=function Hh(){return tb(Ah(this))};_.dc=function Ih(){return Ah(this).dc()};_.Mc=function Jh(a){return Bw(this,a,1)>0};_.Ib=function Lh(){return fcb(Ah(this))};var KE=mdb(Zhe,'AbstractMultiset',1989);bcb(1991,1970,fie);_.$b=function Mh(){Nc(this.a.a)};_.Hc=function Nh(a){var b,c;if(JD(a,492)){c=BD(a,416);if(BD(c.a.dd(),14).gc()<=0){return false}b=Aw(this.a,c.a.cd());return b==BD(c.a.dd(),14).gc()}return false};_.Mc=function Oh(a){var b,c,d,e;if(JD(a,492)){c=BD(a,416);b=c.a.cd();d=BD(c.a.dd(),14).gc();if(d!=0){e=this.a;return ax(e,b,d)}}return false};var pH=mdb(Zhe,'Multisets/EntrySet',1991);bcb(1109,1991,fie,Ph);_.Kc=function Qh(){return new Lw(fe(nd(this.a.a)).Kc())};_.gc=function Rh(){return nd(this.a.a).gc()};var JE=mdb(Zhe,'AbstractMultiset/EntrySet',1109);bcb(619,726,_he);_.hc=function Uh(){return this.gd()};_.jc=function Vh(){return this.hd()};_.cc=function Yh(a){return this.jd(a)};_.fc=function $h(a){return this.kd(a)};_.Zb=function Th(){var a;return a=this.f,!a?(this.f=this.ac()):a};_.hd=function Wh(){return mmb(),mmb(),lmb};_.Fb=function Xh(a){return hw(this,a)};_.jd=function Zh(a){return BD(Qc(this,a),21)};_.kd=function _h(a){return BD(Sc(this,a),21)};_.mc=function ai(a){return mmb(),new zob(BD(a,21))};_.pc=function bi(a,b){return new Yg(this,a,BD(b,21))};var LE=mdb(Zhe,'AbstractSetMultimap',619);bcb(1657,619,_he);_.hc=function ei(){return new Hxb(this.b)};_.gd=function fi(){return new Hxb(this.b)};_.jc=function gi(){return Ix(new Hxb(this.b))};_.hd=function hi(){return Ix(new Hxb(this.b))};_.cc=function ii(a){return BD(BD(Qc(this,a),21),84)};_.jd=function ji(a){return BD(BD(Qc(this,a),21),84)};_.fc=function ki(a){return BD(BD(Sc(this,a),21),84)};_.kd=function li(a){return BD(BD(Sc(this,a),21),84)};_.mc=function mi(a){return JD(a,271)?Ix(BD(a,271)):(mmb(),new Zob(BD(a,84)))};_.Zb=function di(){var a;return a=this.f,!a?(this.f=JD(this.c,171)?new Sf(this,BD(this.c,171)):JD(this.c,161)?new Mf(this,BD(this.c,161)):new ne(this,this.c)):a};_.pc=function ni(a,b){return JD(b,271)?new Xg(this,a,BD(b,271)):new Vg(this,a,BD(b,84))};var NE=mdb(Zhe,'AbstractSortedSetMultimap',1657);bcb(1658,1657,_he);_.Zb=function pi(){var a;return a=this.f,BD(BD(!a?(this.f=JD(this.c,171)?new Sf(this,BD(this.c,171)):JD(this.c,161)?new Mf(this,BD(this.c,161)):new ne(this,this.c)):a,161),171)};_.ec=function ri(){var a;return a=this.i,BD(BD(!a?(this.i=JD(this.c,171)?new $f(this,BD(this.c,171)):JD(this.c,161)?new Yf(this,BD(this.c,161)):new zf(this,this.c)):a,84),271)};_.bc=function qi(){return JD(this.c,171)?new $f(this,BD(this.c,171)):JD(this.c,161)?new Yf(this,BD(this.c,161)):new zf(this,this.c)};var ME=mdb(Zhe,'AbstractSortedKeySortedSetMultimap',1658);bcb(2010,1,{1947:1});_.Fb=function si(a){return zy(this,a)};_.Hb=function ti(){var a;return pmb((a=this.g,!a?(this.g=new vi(this)):a))};_.Ib=function ui(){var a;return Md((a=this.f,!a?(this.f=new Rj(this)):a))};var QE=mdb(Zhe,'AbstractTable',2010);bcb(665,eie,fie,vi);_.$b=function wi(){Pi()};_.Hc=function xi(a){var b,c;if(JD(a,468)){b=BD(a,682);c=BD(Hv(Vi(this.a),Em(b.c.e,b.b)),83);return !!c&&Ck(c.vc(),new Wo(Em(b.c.c,b.a),Mi(b.c,b.b,b.a)))}return false};_.Kc=function yi(){return Ni(this.a)};_.Mc=function zi(a){var b,c;if(JD(a,468)){b=BD(a,682);c=BD(Hv(Vi(this.a),Em(b.c.e,b.b)),83);return !!c&&Dk(c.vc(),new Wo(Em(b.c.c,b.a),Mi(b.c,b.b,b.a)))}return false};_.gc=function Ai(){return Xi(this.a)};_.Nc=function Bi(){return Oi(this.a)};var OE=mdb(Zhe,'AbstractTable/CellSet',665);bcb(1928,28,die,Ci);_.$b=function Di(){Pi()};_.Hc=function Ei(a){return Qi(this.a,a)};_.Kc=function Fi(){return Zi(this.a)};_.gc=function Gi(){return Xi(this.a)};_.Nc=function Hi(){return $i(this.a)};var PE=mdb(Zhe,'AbstractTable/Values',1928);bcb(1632,1631,_he);var RE=mdb(Zhe,'ArrayListMultimapGwtSerializationDependencies',1632);bcb(513,1632,_he,Ji,Ki);_.hc=function Li(){return new Skb(this.a)};_.a=0;var SE=mdb(Zhe,'ArrayListMultimap',513);bcb(664,2010,{664:1,1947:1,3:1},_i);var cF=mdb(Zhe,'ArrayTable',664);bcb(1924,386,$he,aj);_.Xb=function bj(a){return new hj(this.a,a)};var TE=mdb(Zhe,'ArrayTable/1',1924);bcb(1925,1,{},cj);_.ld=function dj(a){return new hj(this.a,a)};var UE=mdb(Zhe,'ArrayTable/1methodref$getCell$Type',1925);bcb(2011,1,{682:1});_.Fb=function ej(a){var b;if(a===this){return true}if(JD(a,468)){b=BD(a,682);return Hb(Em(this.c.e,this.b),Em(b.c.e,b.b))&&Hb(Em(this.c.c,this.a),Em(b.c.c,b.a))&&Hb(Mi(this.c,this.b,this.a),Mi(b.c,b.b,b.a))}return false};_.Hb=function fj(){return Hlb(OC(GC(SI,1),Uhe,1,5,[Em(this.c.e,this.b),Em(this.c.c,this.a),Mi(this.c,this.b,this.a)]))};_.Ib=function gj(){return '('+Em(this.c.e,this.b)+','+Em(this.c.c,this.a)+')='+Mi(this.c,this.b,this.a)};var JH=mdb(Zhe,'Tables/AbstractCell',2011);bcb(468,2011,{468:1,682:1},hj);_.a=0;_.b=0;_.d=0;var VE=mdb(Zhe,'ArrayTable/2',468);bcb(1927,1,{},ij);_.ld=function jj(a){return Ti(this.a,a)};var WE=mdb(Zhe,'ArrayTable/2methodref$getValue$Type',1927);bcb(1926,386,$he,kj);_.Xb=function lj(a){return Ti(this.a,a)};var XE=mdb(Zhe,'ArrayTable/3',1926);bcb(1979,1967,cie);_.$b=function nj(){ir(this.kc())};_.vc=function oj(){return new Sv(this)};_.lc=function pj(){return new Mub(this.kc(),this.gc())};var YG=mdb(Zhe,'Maps/IteratorBasedAbstractMap',1979);bcb(828,1979,cie);_.$b=function tj(){throw vbb(new bgb)};_._b=function uj(a){return sn(this.c,a)};_.kc=function vj(){return new Jj(this,this.c.b.c.gc())};_.lc=function wj(){return Zj(this.c.b.c.gc(),16,new Dj(this))};_.xc=function xj(a){var b;b=BD(tn(this.c,a),19);return !b?null:this.nd(b.a)};_.dc=function yj(){return this.c.b.c.dc()};_.ec=function zj(){return Xm(this.c)};_.zc=function Aj(a,b){var c;c=BD(tn(this.c,a),19);if(!c){throw vbb(new Wdb(this.md()+' '+a+' not in '+Xm(this.c)))}return this.od(c.a,b)};_.Bc=function Bj(a){throw vbb(new bgb)};_.gc=function Cj(){return this.c.b.c.gc()};var _E=mdb(Zhe,'ArrayTable/ArrayMap',828);bcb(1923,1,{},Dj);_.ld=function Ej(a){return qj(this.a,a)};var YE=mdb(Zhe,'ArrayTable/ArrayMap/0methodref$getEntry$Type',1923);bcb(1921,345,kie,Fj);_.cd=function Gj(){return rj(this.a,this.b)};_.dd=function Hj(){return this.a.nd(this.b)};_.ed=function Ij(a){return this.a.od(this.b,a)};_.b=0;var ZE=mdb(Zhe,'ArrayTable/ArrayMap/1',1921);bcb(1922,386,$he,Jj);_.Xb=function Kj(a){return qj(this.a,a)};var $E=mdb(Zhe,'ArrayTable/ArrayMap/2',1922);bcb(1920,828,cie,Lj);_.md=function Mj(){return 'Column'};_.nd=function Nj(a){return Mi(this.b,this.a,a)};_.od=function Oj(a,b){return Wi(this.b,this.a,a,b)};_.a=0;var bF=mdb(Zhe,'ArrayTable/Row',1920);bcb(829,828,cie,Rj);_.nd=function Tj(a){return new Lj(this.a,a)};_.zc=function Uj(a,b){return BD(b,83),Pj()};_.od=function Vj(a,b){return BD(b,83),Qj()};_.md=function Sj(){return 'Row'};var aF=mdb(Zhe,'ArrayTable/RowMap',829);bcb(1120,1,pie,_j);_.qd=function ak(){return this.a.qd()&-262};_.rd=function bk(){return this.a.rd()};_.Nb=function ck(a){this.a.Nb(new gk(a,this.b))};_.sd=function dk(a){return this.a.sd(new ek(a,this.b))};var lF=mdb(Zhe,'CollectSpliterators/1',1120);bcb(1121,1,qie,ek);_.td=function fk(a){this.a.td(this.b.Kb(a))};var dF=mdb(Zhe,'CollectSpliterators/1/lambda$0$Type',1121);bcb(1122,1,qie,gk);_.td=function hk(a){this.a.td(this.b.Kb(a))};var eF=mdb(Zhe,'CollectSpliterators/1/lambda$1$Type',1122);bcb(1123,1,pie,jk);_.qd=function kk(){return this.a};_.rd=function lk(){!!this.d&&(this.b=Deb(this.b,this.d.rd()));return Deb(this.b,0)};_.Nb=function mk(a){if(this.d){this.d.Nb(a);this.d=null}this.c.Nb(new rk(this.e,a));this.b=0};_.sd=function ok(a){while(true){if(!!this.d&&this.d.sd(a)){Kbb(this.b,rie)&&(this.b=Qbb(this.b,1));return true}else{this.d=null}if(!this.c.sd(new pk(this,this.e))){return false}}};_.a=0;_.b=0;var hF=mdb(Zhe,'CollectSpliterators/1FlatMapSpliterator',1123);bcb(1124,1,qie,pk);_.td=function qk(a){ik(this.a,this.b,a)};var fF=mdb(Zhe,'CollectSpliterators/1FlatMapSpliterator/lambda$0$Type',1124);bcb(1125,1,qie,rk);_.td=function sk(a){nk(this.b,this.a,a)};var gF=mdb(Zhe,'CollectSpliterators/1FlatMapSpliterator/lambda$1$Type',1125);bcb(1117,1,pie,tk);_.qd=function uk(){return 16464|this.b};_.rd=function vk(){return this.a.rd()};_.Nb=function wk(a){this.a.xe(new Ak(a,this.c))};_.sd=function xk(a){return this.a.ye(new yk(a,this.c))};_.b=0;var kF=mdb(Zhe,'CollectSpliterators/1WithCharacteristics',1117);bcb(1118,1,sie,yk);_.ud=function zk(a){this.a.td(this.b.ld(a))};var iF=mdb(Zhe,'CollectSpliterators/1WithCharacteristics/lambda$0$Type',1118);bcb(1119,1,sie,Ak);_.ud=function Bk(a){this.a.td(this.b.ld(a))};var jF=mdb(Zhe,'CollectSpliterators/1WithCharacteristics/lambda$1$Type',1119);bcb(245,1,tie);_.wd=function Hk(a){return this.vd(BD(a,245))};_.vd=function Gk(a){var b;if(a==(_k(),$k)){return 1}if(a==(Lk(),Kk)){return -1}b=(ex(),Fcb(this.a,a.a));if(b!=0){return b}return JD(this,519)==JD(a,519)?0:JD(this,519)?1:-1};_.zd=function Ik(){return this.a};_.Fb=function Jk(a){return Ek(this,a)};var qF=mdb(Zhe,'Cut',245);bcb(1761,245,tie,Mk);_.vd=function Nk(a){return a==this?0:1};_.xd=function Ok(a){throw vbb(new xcb)};_.yd=function Pk(a){a.a+='+\u221E)'};_.zd=function Qk(){throw vbb(new Zdb(uie))};_.Hb=function Rk(){return Zfb(),kCb(this)};_.Ad=function Sk(a){return false};_.Ib=function Tk(){return '+\u221E'};var Kk;var mF=mdb(Zhe,'Cut/AboveAll',1761);bcb(519,245,{245:1,519:1,3:1,35:1},Uk);_.xd=function Vk(a){Pfb((a.a+='(',a),this.a)};_.yd=function Wk(a){Kfb(Pfb(a,this.a),93)};_.Hb=function Xk(){return ~tb(this.a)};_.Ad=function Yk(a){return ex(),Fcb(this.a,a)<0};_.Ib=function Zk(){return '/'+this.a+'\\'};var nF=mdb(Zhe,'Cut/AboveValue',519);bcb(1760,245,tie,al);_.vd=function bl(a){return a==this?0:-1};_.xd=function cl(a){a.a+='(-\u221E'};_.yd=function dl(a){throw vbb(new xcb)};_.zd=function el(){throw vbb(new Zdb(uie))};_.Hb=function fl(){return Zfb(),kCb(this)};_.Ad=function gl(a){return true};_.Ib=function hl(){return '-\u221E'};var $k;var oF=mdb(Zhe,'Cut/BelowAll',1760);bcb(1762,245,tie,il);_.xd=function jl(a){Pfb((a.a+='[',a),this.a)};_.yd=function kl(a){Kfb(Pfb(a,this.a),41)};_.Hb=function ll(){return tb(this.a)};_.Ad=function ml(a){return ex(),Fcb(this.a,a)<=0};_.Ib=function nl(){return '\\'+this.a+'/'};var pF=mdb(Zhe,'Cut/BelowValue',1762);bcb(537,1,vie);_.Jc=function ql(a){reb(this,a)};_.Ib=function rl(){return tr(BD(Rb(this,'use Optional.orNull() instead of Optional.or(null)'),20).Kc())};var uF=mdb(Zhe,'FluentIterable',537);bcb(433,537,vie,sl);_.Kc=function tl(){return new Sr(ur(this.a.Kc(),new Sq))};var rF=mdb(Zhe,'FluentIterable/2',433);bcb(1046,537,vie,vl);_.Kc=function wl(){return ul(this)};var tF=mdb(Zhe,'FluentIterable/3',1046);bcb(708,386,$he,xl);_.Xb=function yl(a){return this.a[a].Kc()};var sF=mdb(Zhe,'FluentIterable/3/1',708);bcb(1972,1,{});_.Ib=function zl(){return fcb(this.Bd().b)};var BF=mdb(Zhe,'ForwardingObject',1972);bcb(1973,1972,wie);_.Bd=function Fl(){return this.Cd()};_.Jc=function Gl(a){reb(this,a)};_.Lc=function Jl(){return this.Oc()};_.Nc=function Ml(){return new Kub(this,0)};_.Oc=function Nl(){return new YAb(null,this.Nc())};_.Fc=function Al(a){return this.Cd(),enb()};_.Gc=function Bl(a){return this.Cd(),fnb()};_.$b=function Cl(){this.Cd(),gnb()};_.Hc=function Dl(a){return this.Cd().Hc(a)};_.Ic=function El(a){return this.Cd().Ic(a)};_.dc=function Hl(){return this.Cd().b.dc()};_.Kc=function Il(){return this.Cd().Kc()};_.Mc=function Kl(a){return this.Cd(),jnb()};_.gc=function Ll(){return this.Cd().b.gc()};_.Pc=function Ol(){return this.Cd().Pc()};_.Qc=function Pl(a){return this.Cd().Qc(a)};var vF=mdb(Zhe,'ForwardingCollection',1973);bcb(1980,28,xie);_.Kc=function Xl(){return this.Ed()};_.Fc=function Sl(a){throw vbb(new bgb)};_.Gc=function Tl(a){throw vbb(new bgb)};_.$b=function Ul(){throw vbb(new bgb)};_.Hc=function Vl(a){return a!=null&&ze(this,a,false)};_.Dd=function Wl(){switch(this.gc()){case 0:return im(),im(),hm;case 1:return im(),new my(Qb(this.Ed().Pb()));default:return new px(this,this.Pc());}};_.Mc=function Yl(a){throw vbb(new bgb)};var WF=mdb(Zhe,'ImmutableCollection',1980);bcb(712,1980,xie,Zl);_.Kc=function cm(){return vr(this.a.Kc())};_.Hc=function $l(a){return a!=null&&this.a.Hc(a)};_.Ic=function _l(a){return this.a.Ic(a)};_.dc=function am(){return this.a.dc()};_.Ed=function bm(){return vr(this.a.Kc())};_.gc=function dm(){return this.a.gc()};_.Pc=function em(){return this.a.Pc()};_.Qc=function fm(a){return this.a.Qc(a)};_.Ib=function gm(){return fcb(this.a)};var wF=mdb(Zhe,'ForwardingImmutableCollection',712);bcb(152,1980,yie);_.Kc=function sm(){return this.Ed()};_.Yc=function tm(){return this.Fd(0)};_.Zc=function vm(a){return this.Fd(a)};_.ad=function zm(a){ktb(this,a)};_.Nc=function Am(){return new Kub(this,16)};_.bd=function Cm(a,b){return this.Gd(a,b)};_.Vc=function lm(a,b){throw vbb(new bgb)};_.Wc=function mm(a,b){throw vbb(new bgb)};_.Fb=function om(a){return Ju(this,a)};_.Hb=function pm(){return Ku(this)};_.Xc=function qm(a){return a==null?-1:Lu(this,a)};_.Ed=function rm(){return this.Fd(0)};_.Fd=function um(a){return jm(this,a)};_.$c=function xm(a){throw vbb(new bgb)};_._c=function ym(a,b){throw vbb(new bgb)};_.Gd=function Bm(a,b){var c;return Dm((c=new $u(this),new Jib(c,a,b)))};var hm;var _F=mdb(Zhe,'ImmutableList',152);bcb(2006,152,yie);_.Kc=function Nm(){return vr(this.Hd().Kc())};_.bd=function Qm(a,b){return Dm(this.Hd().bd(a,b))};_.Hc=function Fm(a){return a!=null&&this.Hd().Hc(a)};_.Ic=function Gm(a){return this.Hd().Ic(a)};_.Fb=function Hm(a){return pb(this.Hd(),a)};_.Xb=function Im(a){return Em(this,a)};_.Hb=function Jm(){return tb(this.Hd())};_.Xc=function Km(a){return this.Hd().Xc(a)};_.dc=function Lm(){return this.Hd().dc()};_.Ed=function Mm(){return vr(this.Hd().Kc())};_.gc=function Om(){return this.Hd().gc()};_.Gd=function Pm(a,b){return Dm(this.Hd().bd(a,b))};_.Pc=function Rm(){return this.Hd().Qc(KC(SI,Uhe,1,this.Hd().gc(),5,1))};_.Qc=function Sm(a){return this.Hd().Qc(a)};_.Ib=function Tm(){return fcb(this.Hd())};var xF=mdb(Zhe,'ForwardingImmutableList',2006);bcb(714,1,Aie);_.vc=function cn(){return Wm(this)};_.wc=function en(a){stb(this,a)};_.ec=function jn(){return Xm(this)};_.yc=function kn(a,b,c){return ttb(this,a,b,c)};_.Cc=function rn(){return this.Ld()};_.$b=function Zm(){throw vbb(new bgb)};_._b=function $m(a){return this.xc(a)!=null};_.uc=function _m(a){return this.Ld().Hc(a)};_.Jd=function an(){return new jq(this)};_.Kd=function bn(){return new sq(this)};_.Fb=function dn(a){return Dv(this,a)};_.Hb=function gn(){return Wm(this).Hb()};_.dc=function hn(){return this.gc()==0};_.zc=function nn(a,b){return Ym()};_.Bc=function on(a){throw vbb(new bgb)};_.Ib=function pn(){return Jv(this)};_.Ld=function qn(){if(this.e){return this.e}return this.e=this.Kd()};_.c=null;_.d=null;_.e=null;var Um;var iG=mdb(Zhe,'ImmutableMap',714);bcb(715,714,Aie);_._b=function vn(a){return sn(this,a)};_.uc=function wn(a){return dob(this.b,a)};_.Id=function xn(){return Vn(new Ln(this))};_.Jd=function yn(){return Vn(gob(this.b))};_.Kd=function zn(){return Ql(),new Zl(hob(this.b))};_.Fb=function An(a){return fob(this.b,a)};_.xc=function Bn(a){return tn(this,a)};_.Hb=function Cn(){return tb(this.b.c)};_.dc=function Dn(){return this.b.c.dc()};_.gc=function En(){return this.b.c.gc()};_.Ib=function Fn(){return fcb(this.b.c)};var zF=mdb(Zhe,'ForwardingImmutableMap',715);bcb(1974,1973,Bie);_.Bd=function Gn(){return this.Md()};_.Cd=function Hn(){return this.Md()};_.Nc=function Kn(){return new Kub(this,1)};_.Fb=function In(a){return a===this||this.Md().Fb(a)};_.Hb=function Jn(){return this.Md().Hb()};var CF=mdb(Zhe,'ForwardingSet',1974);bcb(1069,1974,Bie,Ln);_.Bd=function Nn(){return eob(this.a.b)};_.Cd=function On(){return eob(this.a.b)};_.Hc=function Mn(b){if(JD(b,42)&&BD(b,42).cd()==null){return false}try{return Dob(eob(this.a.b),b)}catch(a){a=ubb(a);if(JD(a,205)){return false}else throw vbb(a)}};_.Md=function Pn(){return eob(this.a.b)};_.Qc=function Qn(a){var b;b=Eob(eob(this.a.b),a);eob(this.a.b).b.gc()=0?'+':'')+(c/60|0);b=kB($wnd.Math.abs(c)%60);return (Dpb(),Bpb)[this.q.getDay()]+' '+Cpb[this.q.getMonth()]+' '+kB(this.q.getDate())+' '+kB(this.q.getHours())+':'+kB(this.q.getMinutes())+':'+kB(this.q.getSeconds())+' GMT'+a+b+' '+this.q.getFullYear()};var $J=mdb(bie,'Date',199);bcb(1915,199,Cje,nB);_.a=false;_.b=0;_.c=0;_.d=0;_.e=0;_.f=0;_.g=false;_.i=0;_.j=0;_.k=0;_.n=0;_.o=0;_.p=0;var eI=mdb('com.google.gwt.i18n.shared.impl','DateRecord',1915);bcb(1966,1,{});_.fe=function oB(){return null};_.ge=function pB(){return null};_.he=function qB(){return null};_.ie=function rB(){return null};_.je=function sB(){return null};var nI=mdb(Dje,'JSONValue',1966);bcb(216,1966,{216:1},wB,xB);_.Fb=function yB(a){if(!JD(a,216)){return false}return qz(this.a,BD(a,216).a)};_.ee=function zB(){return DB};_.Hb=function AB(){return rz(this.a)};_.fe=function BB(){return this};_.Ib=function CB(){var a,b,c;c=new Wfb('[');for(b=0,a=this.a.length;b0&&(c.a+=',',c);Pfb(c,tB(this,b))}c.a+=']';return c.a};var fI=mdb(Dje,'JSONArray',216);bcb(483,1966,{483:1},HB);_.ee=function IB(){return LB};_.ge=function JB(){return this};_.Ib=function KB(){return Bcb(),''+this.a};_.a=false;var EB,FB;var gI=mdb(Dje,'JSONBoolean',483);bcb(985,60,Tie,MB);var hI=mdb(Dje,'JSONException',985);bcb(1023,1966,{},PB);_.ee=function QB(){return SB};_.Ib=function RB(){return Xhe};var NB;var iI=mdb(Dje,'JSONNull',1023);bcb(258,1966,{258:1},TB);_.Fb=function UB(a){if(!JD(a,258)){return false}return this.a==BD(a,258).a};_.ee=function VB(){return ZB};_.Hb=function WB(){return Hdb(this.a)};_.he=function XB(){return this};_.Ib=function YB(){return this.a+''};_.a=0;var jI=mdb(Dje,'JSONNumber',258);bcb(183,1966,{183:1},eC,fC);_.Fb=function gC(a){if(!JD(a,183)){return false}return qz(this.a,BD(a,183).a)};_.ee=function hC(){return lC};_.Hb=function iC(){return rz(this.a)};_.ie=function jC(){return this};_.Ib=function kC(){var a,b,c,d,e,f,g;g=new Wfb('{');a=true;f=$B(this,KC(ZI,nie,2,0,6,1));for(c=f,d=0,e=c.length;d=0?':'+this.c:'')+')'};_.c=0;var VI=mdb(Phe,'StackTraceElement',310);zD={3:1,475:1,35:1,2:1};var ZI=mdb(Phe,Vie,2);bcb(107,418,{475:1},Hfb,Ifb,Jfb);var WI=mdb(Phe,'StringBuffer',107);bcb(100,418,{475:1},Ufb,Vfb,Wfb);var XI=mdb(Phe,'StringBuilder',100);bcb(687,73,Mje,Xfb);var YI=mdb(Phe,'StringIndexOutOfBoundsException',687);bcb(2043,1,{});var Yfb;bcb(844,1,{},_fb);_.Kb=function agb(a){return BD(a,78).e};var $I=mdb(Phe,'Throwable/lambda$0$Type',844);bcb(41,60,{3:1,102:1,60:1,78:1,41:1},bgb,cgb);var aJ=mdb(Phe,'UnsupportedOperationException',41);bcb(240,236,{3:1,35:1,236:1,240:1},sgb,tgb);_.wd=function wgb(a){return mgb(this,BD(a,240))};_.ke=function xgb(){return Hcb(rgb(this))};_.Fb=function ygb(a){var b;if(this===a){return true}if(JD(a,240)){b=BD(a,240);return this.e==b.e&&mgb(this,b)==0}return false};_.Hb=function zgb(){var a;if(this.b!=0){return this.b}if(this.a<54){a=Cbb(this.f);this.b=Tbb(xbb(a,-1));this.b=33*this.b+Tbb(xbb(Obb(a,32),-1));this.b=17*this.b+QD(this.e);return this.b}this.b=17*Ngb(this.c)+QD(this.e);return this.b};_.Ib=function Agb(){return rgb(this)};_.a=0;_.b=0;_.d=0;_.e=0;_.f=0;var dgb,egb,fgb,ggb,hgb,igb,jgb,kgb;var bJ=mdb('java.math','BigDecimal',240);bcb(91,236,{3:1,35:1,236:1,91:1},Tgb,Ugb,Vgb,Wgb,Xgb,Ygb);_.wd=function $gb(a){return Igb(this,BD(a,91))};_.ke=function _gb(){return Hcb(shb(this,0))};_.Fb=function ahb(a){return Kgb(this,a)};_.Hb=function chb(){return Ngb(this)};_.Ib=function ehb(){return shb(this,0)};_.b=-2;_.c=0;_.d=0;_.e=0;var Bgb,Cgb,Dgb,Egb,Fgb,Ggb;var cJ=mdb('java.math','BigInteger',91);var nhb,ohb;var Bhb,Chb;bcb(488,1967,cie);_.$b=function Xhb(){Uhb(this)};_._b=function Yhb(a){return Mhb(this,a)};_.uc=function Zhb(a){return Nhb(this,a,this.g)||Nhb(this,a,this.f)};_.vc=function $hb(){return new eib(this)};_.xc=function _hb(a){return Ohb(this,a)};_.zc=function aib(a,b){return Rhb(this,a,b)};_.Bc=function bib(a){return Thb(this,a)};_.gc=function cib(){return Vhb(this)};var gJ=mdb(bie,'AbstractHashMap',488);bcb(261,eie,fie,eib);_.$b=function fib(){this.a.$b()};_.Hc=function gib(a){return dib(this,a)};_.Kc=function hib(){return new nib(this.a)};_.Mc=function iib(a){var b;if(dib(this,a)){b=BD(a,42).cd();this.a.Bc(b);return true}return false};_.gc=function jib(){return this.a.gc()};var fJ=mdb(bie,'AbstractHashMap/EntrySet',261);bcb(262,1,aie,nib);_.Nb=function oib(a){Rrb(this,a)};_.Pb=function qib(){return lib(this)};_.Ob=function pib(){return this.b};_.Qb=function rib(){mib(this)};_.b=false;var eJ=mdb(bie,'AbstractHashMap/EntrySetIterator',262);bcb(417,1,aie,vib);_.Nb=function wib(a){Rrb(this,a)};_.Ob=function xib(){return sib(this)};_.Pb=function yib(){return tib(this)};_.Qb=function zib(){uib(this)};_.b=0;_.c=-1;var hJ=mdb(bie,'AbstractList/IteratorImpl',417);bcb(96,417,jie,Bib);_.Qb=function Hib(){uib(this)};_.Rb=function Cib(a){Aib(this,a)};_.Sb=function Dib(){return this.b>0};_.Tb=function Eib(){return this.b};_.Ub=function Fib(){return sCb(this.b>0),this.a.Xb(this.c=--this.b)};_.Vb=function Gib(){return this.b-1};_.Wb=function Iib(a){yCb(this.c!=-1);this.a._c(this.c,a)};var iJ=mdb(bie,'AbstractList/ListIteratorImpl',96);bcb(219,52,Lie,Jib);_.Vc=function Kib(a,b){wCb(a,this.b);this.c.Vc(this.a+a,b);++this.b};_.Xb=function Lib(a){tCb(a,this.b);return this.c.Xb(this.a+a)};_.$c=function Mib(a){var b;tCb(a,this.b);b=this.c.$c(this.a+a);--this.b;return b};_._c=function Nib(a,b){tCb(a,this.b);return this.c._c(this.a+a,b)};_.gc=function Oib(){return this.b};_.a=0;_.b=0;var jJ=mdb(bie,'AbstractList/SubList',219);bcb(384,eie,fie,Pib);_.$b=function Qib(){this.a.$b()};_.Hc=function Rib(a){return this.a._b(a)};_.Kc=function Sib(){var a;return a=this.a.vc().Kc(),new Vib(a)};_.Mc=function Tib(a){if(this.a._b(a)){this.a.Bc(a);return true}return false};_.gc=function Uib(){return this.a.gc()};var mJ=mdb(bie,'AbstractMap/1',384);bcb(691,1,aie,Vib);_.Nb=function Wib(a){Rrb(this,a)};_.Ob=function Xib(){return this.a.Ob()};_.Pb=function Yib(){var a;return a=BD(this.a.Pb(),42),a.cd()};_.Qb=function Zib(){this.a.Qb()};var lJ=mdb(bie,'AbstractMap/1/1',691);bcb(226,28,die,$ib);_.$b=function _ib(){this.a.$b()};_.Hc=function ajb(a){return this.a.uc(a)};_.Kc=function bjb(){var a;return a=this.a.vc().Kc(),new djb(a)};_.gc=function cjb(){return this.a.gc()};var oJ=mdb(bie,'AbstractMap/2',226);bcb(294,1,aie,djb);_.Nb=function ejb(a){Rrb(this,a)};_.Ob=function fjb(){return this.a.Ob()};_.Pb=function gjb(){var a;return a=BD(this.a.Pb(),42),a.dd()};_.Qb=function hjb(){this.a.Qb()};var nJ=mdb(bie,'AbstractMap/2/1',294);bcb(484,1,{484:1,42:1});_.Fb=function jjb(a){var b;if(!JD(a,42)){return false}b=BD(a,42);return wtb(this.d,b.cd())&&wtb(this.e,b.dd())};_.cd=function kjb(){return this.d};_.dd=function ljb(){return this.e};_.Hb=function mjb(){return xtb(this.d)^xtb(this.e)};_.ed=function njb(a){return ijb(this,a)};_.Ib=function ojb(){return this.d+'='+this.e};var pJ=mdb(bie,'AbstractMap/AbstractEntry',484);bcb(383,484,{484:1,383:1,42:1},pjb);var qJ=mdb(bie,'AbstractMap/SimpleEntry',383);bcb(1984,1,_je);_.Fb=function qjb(a){var b;if(!JD(a,42)){return false}b=BD(a,42);return wtb(this.cd(),b.cd())&&wtb(this.dd(),b.dd())};_.Hb=function rjb(){return xtb(this.cd())^xtb(this.dd())};_.Ib=function sjb(){return this.cd()+'='+this.dd()};var rJ=mdb(bie,lie,1984);bcb(1992,1967,gie);_.tc=function vjb(a){return tjb(this,a)};_._b=function wjb(a){return ujb(this,a)};_.vc=function xjb(){return new Bjb(this)};_.xc=function yjb(a){var b;b=a;return Wd(Awb(this,b))};_.ec=function Ajb(){return new Gjb(this)};var wJ=mdb(bie,'AbstractNavigableMap',1992);bcb(739,eie,fie,Bjb);_.Hc=function Cjb(a){return JD(a,42)&&tjb(this.b,BD(a,42))};_.Kc=function Djb(){return new Ywb(this.b)};_.Mc=function Ejb(a){var b;if(JD(a,42)){b=BD(a,42);return Kwb(this.b,b)}return false};_.gc=function Fjb(){return this.b.c};var tJ=mdb(bie,'AbstractNavigableMap/EntrySet',739);bcb(493,eie,iie,Gjb);_.Nc=function Mjb(){return new Rub(this)};_.$b=function Hjb(){zwb(this.a)};_.Hc=function Ijb(a){return ujb(this.a,a)};_.Kc=function Jjb(){var a;return a=new Ywb((new cxb(this.a)).b),new Njb(a)};_.Mc=function Kjb(a){if(ujb(this.a,a)){Jwb(this.a,a);return true}return false};_.gc=function Ljb(){return this.a.c};var vJ=mdb(bie,'AbstractNavigableMap/NavigableKeySet',493);bcb(494,1,aie,Njb);_.Nb=function Ojb(a){Rrb(this,a)};_.Ob=function Pjb(){return sib(this.a.a)};_.Pb=function Qjb(){var a;return a=Wwb(this.a),a.cd()};_.Qb=function Rjb(){Xwb(this.a)};var uJ=mdb(bie,'AbstractNavigableMap/NavigableKeySet/1',494);bcb(2004,28,die);_.Fc=function Sjb(a){return zCb(cub(this,a)),true};_.Gc=function Tjb(a){uCb(a);mCb(a!=this,"Can't add a queue to itself");return ye(this,a)};_.$b=function Ujb(){while(dub(this)!=null);};var xJ=mdb(bie,'AbstractQueue',2004);bcb(302,28,{4:1,20:1,28:1,14:1},jkb,kkb);_.Fc=function lkb(a){return Xjb(this,a),true};_.$b=function nkb(){Yjb(this)};_.Hc=function okb(a){return Zjb(new xkb(this),a)};_.dc=function pkb(){return akb(this)};_.Kc=function qkb(){return new xkb(this)};_.Mc=function rkb(a){return dkb(new xkb(this),a)};_.gc=function skb(){return this.c-this.b&this.a.length-1};_.Nc=function tkb(){return new Kub(this,272)};_.Qc=function ukb(a){var b;b=this.c-this.b&this.a.length-1;a.lengthb&&NC(a,b,null);return a};_.b=0;_.c=0;var BJ=mdb(bie,'ArrayDeque',302);bcb(446,1,aie,xkb);_.Nb=function ykb(a){Rrb(this,a)};_.Ob=function zkb(){return this.a!=this.b};_.Pb=function Akb(){return vkb(this)};_.Qb=function Bkb(){wkb(this)};_.a=0;_.b=0;_.c=-1;var AJ=mdb(bie,'ArrayDeque/IteratorImpl',446);bcb(12,52,ake,Rkb,Skb,Tkb);_.Vc=function Ukb(a,b){Dkb(this,a,b)};_.Fc=function Vkb(a){return Ekb(this,a)};_.Wc=function Wkb(a,b){return Fkb(this,a,b)};_.Gc=function Xkb(a){return Gkb(this,a)};_.$b=function Ykb(){this.c=KC(SI,Uhe,1,0,5,1)};_.Hc=function Zkb(a){return Jkb(this,a,0)!=-1};_.Jc=function $kb(a){Hkb(this,a)};_.Xb=function _kb(a){return Ikb(this,a)};_.Xc=function alb(a){return Jkb(this,a,0)};_.dc=function blb(){return this.c.length==0};_.Kc=function clb(){return new olb(this)};_.$c=function dlb(a){return Kkb(this,a)};_.Mc=function elb(a){return Lkb(this,a)};_.Ud=function flb(a,b){Mkb(this,a,b)};_._c=function glb(a,b){return Nkb(this,a,b)};_.gc=function hlb(){return this.c.length};_.ad=function ilb(a){Okb(this,a)};_.Pc=function jlb(){return Pkb(this)};_.Qc=function klb(a){return Qkb(this,a)};var DJ=mdb(bie,'ArrayList',12);bcb(7,1,aie,olb);_.Nb=function plb(a){Rrb(this,a)};_.Ob=function qlb(){return llb(this)};_.Pb=function rlb(){return mlb(this)};_.Qb=function slb(){nlb(this)};_.a=0;_.b=-1;var CJ=mdb(bie,'ArrayList/1',7);bcb(2013,$wnd.Function,{},Ylb);_.te=function Zlb(a,b){return Kdb(a,b)};bcb(154,52,bke,amb);_.Hc=function bmb(a){return Bt(this,a)!=-1};_.Jc=function cmb(a){var b,c,d,e;uCb(a);for(c=this.a,d=0,e=c.length;d>>0,a.toString(16))};_.f=0;_.i=Qje;var PM=mdb(Gke,'CNode',57);bcb(814,1,{},zDb);var OM=mdb(Gke,'CNode/CNodeBuilder',814);var EDb;bcb(1525,1,{},GDb);_.Oe=function HDb(a,b){return 0};_.Pe=function IDb(a,b){return 0};var QM=mdb(Gke,Ike,1525);bcb(1790,1,{},JDb);_.Le=function KDb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;j=Pje;for(d=new olb(a.a.b);d.ad.d.c||d.d.c==f.d.c&&d.d.b0?a+this.n.d+this.n.a:0};_.Se=function HHb(){var a,b,c,d,e;e=0;if(this.e){this.b?(e=this.b.a):!!this.a[1][1]&&(e=this.a[1][1].Se())}else if(this.g){e=EHb(this,yHb(this,null,true))}else{for(b=(gHb(),OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])),c=0,d=b.length;c0?e+this.n.b+this.n.c:0};_.Te=function IHb(){var a,b,c,d,e;if(this.g){a=yHb(this,null,false);for(c=(gHb(),OC(GC(pN,1),Kie,232,0,[dHb,eHb,fHb])),d=0,e=c.length;d0){d[0]+=this.d;c-=d[0]}if(d[2]>0){d[2]+=this.d;c-=d[2]}this.c.a=$wnd.Math.max(0,c);this.c.d=b.d+a.d+(this.c.a-c)/2;d[1]=$wnd.Math.max(d[1],c);uHb(this,eHb,b.d+a.d+d[0]-(d[1]-c)/2,d)};_.b=null;_.d=0;_.e=false;_.f=false;_.g=false;var rHb=0,sHb=0;var rN=mdb(fle,'GridContainerCell',1473);bcb(461,22,{3:1,35:1,22:1,461:1},OHb);var KHb,LHb,MHb;var sN=ndb(fle,'HorizontalLabelAlignment',461,CI,QHb,PHb);var RHb;bcb(306,212,{212:1,306:1},aIb,bIb,cIb);_.Re=function dIb(){return YHb(this)};_.Se=function eIb(){return ZHb(this)};_.a=0;_.c=false;var tN=mdb(fle,'LabelCell',306);bcb(244,326,{212:1,326:1,244:1},mIb);_.Re=function nIb(){return fIb(this)};_.Se=function oIb(){return gIb(this)};_.Te=function rIb(){hIb(this)};_.Ue=function sIb(){iIb(this)};_.b=0;_.c=0;_.d=false;var yN=mdb(fle,'StripContainerCell',244);bcb(1626,1,Oie,tIb);_.Mb=function uIb(a){return pIb(BD(a,212))};var uN=mdb(fle,'StripContainerCell/lambda$0$Type',1626);bcb(1627,1,{},vIb);_.Fe=function wIb(a){return BD(a,212).Se()};var vN=mdb(fle,'StripContainerCell/lambda$1$Type',1627);bcb(1628,1,Oie,xIb);_.Mb=function yIb(a){return qIb(BD(a,212))};var wN=mdb(fle,'StripContainerCell/lambda$2$Type',1628);bcb(1629,1,{},zIb);_.Fe=function AIb(a){return BD(a,212).Re()};var xN=mdb(fle,'StripContainerCell/lambda$3$Type',1629);bcb(462,22,{3:1,35:1,22:1,462:1},FIb);var BIb,CIb,DIb;var zN=ndb(fle,'VerticalLabelAlignment',462,CI,HIb,GIb);var IIb;bcb(789,1,{},LIb);_.c=0;_.d=0;_.k=0;_.s=0;_.t=0;_.v=false;_.w=0;_.D=false;var CN=mdb(nle,'NodeContext',789);bcb(1471,1,Dke,OIb);_.ue=function PIb(a,b){return NIb(BD(a,61),BD(b,61))};_.Fb=function QIb(a){return this===a};_.ve=function RIb(){return new tpb(this)};var AN=mdb(nle,'NodeContext/0methodref$comparePortSides$Type',1471);bcb(1472,1,Dke,SIb);_.ue=function TIb(a,b){return MIb(BD(a,111),BD(b,111))};_.Fb=function UIb(a){return this===a};_.ve=function VIb(){return new tpb(this)};var BN=mdb(nle,'NodeContext/1methodref$comparePortContexts$Type',1472);bcb(159,22,{3:1,35:1,22:1,159:1},tJb);var WIb,XIb,YIb,ZIb,$Ib,_Ib,aJb,bJb,cJb,dJb,eJb,fJb,gJb,hJb,iJb,jJb,kJb,lJb,mJb,nJb,oJb,pJb;var DN=ndb(nle,'NodeLabelLocation',159,CI,wJb,vJb);var xJb;bcb(111,1,{111:1},AJb);_.a=false;var EN=mdb(nle,'PortContext',111);bcb(1476,1,qie,TJb);_.td=function UJb(a){WHb(BD(a,306))};var FN=mdb(qle,rle,1476);bcb(1477,1,Oie,VJb);_.Mb=function WJb(a){return !!BD(a,111).c};var GN=mdb(qle,sle,1477);bcb(1478,1,qie,XJb);_.td=function YJb(a){WHb(BD(a,111).c)};var HN=mdb(qle,'LabelPlacer/lambda$2$Type',1478);var ZJb;bcb(1475,1,qie,fKb);_.td=function gKb(a){$Jb();zJb(BD(a,111))};var IN=mdb(qle,'NodeLabelAndSizeUtilities/lambda$0$Type',1475);bcb(790,1,qie,mKb);_.td=function nKb(a){kKb(this.b,this.c,this.a,BD(a,181))};_.a=false;_.c=false;var JN=mdb(qle,'NodeLabelCellCreator/lambda$0$Type',790);bcb(1474,1,qie,tKb);_.td=function uKb(a){sKb(this.a,BD(a,181))};var KN=mdb(qle,'PortContextCreator/lambda$0$Type',1474);var BKb;bcb(1829,1,{},VKb);var MN=mdb(ule,'GreedyRectangleStripOverlapRemover',1829);bcb(1830,1,Dke,XKb);_.ue=function YKb(a,b){return WKb(BD(a,222),BD(b,222))};_.Fb=function ZKb(a){return this===a};_.ve=function $Kb(){return new tpb(this)};var LN=mdb(ule,'GreedyRectangleStripOverlapRemover/0methodref$compareByYCoordinate$Type',1830);bcb(1786,1,{},fLb);_.a=5;_.e=0;var SN=mdb(ule,'RectangleStripOverlapRemover',1786);bcb(1787,1,Dke,jLb);_.ue=function kLb(a,b){return gLb(BD(a,222),BD(b,222))};_.Fb=function lLb(a){return this===a};_.ve=function mLb(){return new tpb(this)};var NN=mdb(ule,'RectangleStripOverlapRemover/0methodref$compareLeftRectangleBorders$Type',1787);bcb(1789,1,Dke,nLb);_.ue=function oLb(a,b){return hLb(BD(a,222),BD(b,222))};_.Fb=function pLb(a){return this===a};_.ve=function qLb(){return new tpb(this)};var ON=mdb(ule,'RectangleStripOverlapRemover/1methodref$compareRightRectangleBorders$Type',1789);bcb(406,22,{3:1,35:1,22:1,406:1},wLb);var rLb,sLb,tLb,uLb;var PN=ndb(ule,'RectangleStripOverlapRemover/OverlapRemovalDirection',406,CI,yLb,xLb);var zLb;bcb(222,1,{222:1},BLb);var QN=mdb(ule,'RectangleStripOverlapRemover/RectangleNode',222);bcb(1788,1,qie,CLb);_.td=function DLb(a){aLb(this.a,BD(a,222))};var RN=mdb(ule,'RectangleStripOverlapRemover/lambda$1$Type',1788);bcb(1304,1,Dke,GLb);_.ue=function HLb(a,b){return FLb(BD(a,167),BD(b,167))};_.Fb=function ILb(a){return this===a};_.ve=function JLb(){return new tpb(this)};var WN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator',1304);bcb(1307,1,{},KLb);_.Kb=function LLb(a){return BD(a,324).a};var TN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$0$Type',1307);bcb(1308,1,Oie,MLb);_.Mb=function NLb(a){return BD(a,323).a};var UN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$1$Type',1308);bcb(1309,1,Oie,OLb);_.Mb=function PLb(a){return BD(a,323).a};var VN=mdb(wle,'PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$2$Type',1309);bcb(1302,1,Dke,RLb);_.ue=function SLb(a,b){return QLb(BD(a,167),BD(b,167))};_.Fb=function TLb(a){return this===a};_.ve=function ULb(){return new tpb(this)};var YN=mdb(wle,'PolyominoCompactor/MinNumOfExtensionDirectionsComparator',1302);bcb(1305,1,{},VLb);_.Kb=function WLb(a){return BD(a,324).a};var XN=mdb(wle,'PolyominoCompactor/MinNumOfExtensionDirectionsComparator/lambda$0$Type',1305);bcb(767,1,Dke,YLb);_.ue=function ZLb(a,b){return XLb(BD(a,167),BD(b,167))};_.Fb=function $Lb(a){return this===a};_.ve=function _Lb(){return new tpb(this)};var ZN=mdb(wle,'PolyominoCompactor/MinNumOfExtensionsComparator',767);bcb(1300,1,Dke,bMb);_.ue=function cMb(a,b){return aMb(BD(a,321),BD(b,321))};_.Fb=function dMb(a){return this===a};_.ve=function eMb(){return new tpb(this)};var _N=mdb(wle,'PolyominoCompactor/MinPerimeterComparator',1300);bcb(1301,1,Dke,gMb);_.ue=function hMb(a,b){return fMb(BD(a,321),BD(b,321))};_.Fb=function iMb(a){return this===a};_.ve=function jMb(){return new tpb(this)};var $N=mdb(wle,'PolyominoCompactor/MinPerimeterComparatorWithShape',1301);bcb(1303,1,Dke,lMb);_.ue=function mMb(a,b){return kMb(BD(a,167),BD(b,167))};_.Fb=function nMb(a){return this===a};_.ve=function oMb(){return new tpb(this)};var bO=mdb(wle,'PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator',1303);bcb(1306,1,{},pMb);_.Kb=function qMb(a){return BD(a,324).a};var aO=mdb(wle,'PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator/lambda$0$Type',1306);bcb(777,1,{},tMb);_.Ce=function uMb(a,b){return sMb(this,BD(a,46),BD(b,167))};var cO=mdb(wle,'SuccessorCombination',777);bcb(644,1,{},wMb);_.Ce=function xMb(a,b){var c;return vMb((c=BD(a,46),BD(b,167),c))};var dO=mdb(wle,'SuccessorJitter',644);bcb(643,1,{},zMb);_.Ce=function AMb(a,b){var c;return yMb((c=BD(a,46),BD(b,167),c))};var eO=mdb(wle,'SuccessorLineByLine',643);bcb(568,1,{},CMb);_.Ce=function DMb(a,b){var c;return BMb((c=BD(a,46),BD(b,167),c))};var fO=mdb(wle,'SuccessorManhattan',568);bcb(1356,1,{},FMb);_.Ce=function GMb(a,b){var c;return EMb((c=BD(a,46),BD(b,167),c))};var gO=mdb(wle,'SuccessorMaxNormWindingInMathPosSense',1356);bcb(400,1,{},JMb);_.Ce=function KMb(a,b){return HMb(this,a,b)};_.c=false;_.d=false;_.e=false;_.f=false;var iO=mdb(wle,'SuccessorQuadrantsGeneric',400);bcb(1357,1,{},LMb);_.Kb=function MMb(a){return BD(a,324).a};var hO=mdb(wle,'SuccessorQuadrantsGeneric/lambda$0$Type',1357);bcb(323,22,{3:1,35:1,22:1,323:1},SMb);_.a=false;var NMb,OMb,PMb,QMb;var jO=ndb(Ble,Cle,323,CI,UMb,TMb);var VMb;bcb(1298,1,{});_.Ib=function bNb(){var a,b,c,d,e,f;c=' ';a=meb(0);for(e=0;e=0?'b'+a+'['+fRb(this.a)+']':'b['+fRb(this.a)+']'}return 'b_'+FCb(this)};var YO=mdb(jme,'FBendpoint',559);bcb(282,134,{3:1,282:1,94:1,134:1},gRb);_.Ib=function hRb(){return fRb(this)};var ZO=mdb(jme,'FEdge',282);bcb(231,134,{3:1,231:1,94:1,134:1},kRb);var $O=mdb(jme,'FGraph',231);bcb(447,357,{3:1,447:1,357:1,94:1,134:1},mRb);_.Ib=function nRb(){return this.b==null||this.b.length==0?'l['+fRb(this.a)+']':'l_'+this.b};var _O=mdb(jme,'FLabel',447);bcb(144,357,{3:1,144:1,357:1,94:1,134:1},pRb);_.Ib=function qRb(){return oRb(this)};_.b=0;var aP=mdb(jme,'FNode',144);bcb(2003,1,{});_.bf=function vRb(a){rRb(this,a)};_.cf=function wRb(){sRb(this)};_.d=0;var cP=mdb(lme,'AbstractForceModel',2003);bcb(631,2003,{631:1},xRb);_.af=function zRb(a,b){var c,d,e,f,g;uRb(this.f,a,b);e=c7c(R6c(b.d),a.d);g=$wnd.Math.sqrt(e.a*e.a+e.b*e.b);d=$wnd.Math.max(0,g-U6c(a.e)/2-U6c(b.e)/2);c=jRb(this.e,a,b);c>0?(f=-yRb(d,this.c)*c):(f=CRb(d,this.b)*BD(vNb(a,(wSb(),oSb)),19).a);Y6c(e,f/g);return e};_.bf=function ARb(a){rRb(this,a);this.a=BD(vNb(a,(wSb(),eSb)),19).a;this.c=Edb(ED(vNb(a,uSb)));this.b=Edb(ED(vNb(a,qSb)))};_.df=function BRb(a){return a0&&(f-=ERb(d,this.a)*c);Y6c(e,f*this.b/g);return e};_.bf=function GRb(a){var b,c,d,e,f,g,h;rRb(this,a);this.b=Edb(ED(vNb(a,(wSb(),vSb))));this.c=this.b/BD(vNb(a,eSb),19).a;d=a.e.c.length;f=0;e=0;for(h=new olb(a.e);h.a0};_.a=0;_.b=0;_.c=0;var eP=mdb(lme,'FruchtermanReingoldModel',632);bcb(849,1,ale,TRb);_.Qe=function URb(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,mme),''),'Force Model'),'Determines the model for force calculation.'),MRb),(_5c(),V5c)),gP),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,nme),''),'Iterations'),'The number of iterations on the force model.'),meb(300)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ome),''),'Repulsive Power'),'Determines how many bend points are added to the edge; such bend points are regarded as repelling particles in the force model'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,pme),''),'FR Temperature'),'The temperature is used as a scaling factor for particle displacements.'),qme),U5c),BI),pqb(L5c))));o4c(a,pme,mme,RRb);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,rme),''),'Eades Repulsion'),"Factor for repulsive forces in Eades' model."),5),U5c),BI),pqb(L5c))));o4c(a,rme,mme,ORb);xSb((new ySb,a))};var KRb,LRb,MRb,NRb,ORb,PRb,QRb,RRb;var fP=mdb(sme,'ForceMetaDataProvider',849);bcb(424,22,{3:1,35:1,22:1,424:1},YRb);var VRb,WRb;var gP=ndb(sme,'ForceModelStrategy',424,CI,$Rb,ZRb);var _Rb;bcb(988,1,ale,ySb);_.Qe=function zSb(a){xSb(a)};var bSb,cSb,dSb,eSb,fSb,gSb,hSb,iSb,jSb,kSb,lSb,mSb,nSb,oSb,pSb,qSb,rSb,sSb,tSb,uSb,vSb;var iP=mdb(sme,'ForceOptions',988);bcb(989,1,{},ASb);_.$e=function BSb(){var a;return a=new ZQb,a};_._e=function CSb(a){};var hP=mdb(sme,'ForceOptions/ForceFactory',989);var DSb,ESb,FSb,GSb;bcb(850,1,ale,PSb);_.Qe=function QSb(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Mme),''),'Fixed Position'),'Prevent that the node is moved by the layout algorithm.'),(Bcb(),false)),(_5c(),T5c)),wI),pqb((N5c(),K5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Nme),''),'Desired Edge Length'),'Either specified for parent nodes or for individual edges, where the latter takes higher precedence.'),100),U5c),BI),qqb(L5c,OC(GC(e1,1),Kie,175,0,[I5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ome),''),'Layout Dimension'),'Dimensions that are permitted to be altered during layout.'),KSb),V5c),oP),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Pme),''),'Stress Epsilon'),'Termination criterion for the iterative process.'),qme),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Qme),''),'Iteration Limit'),"Maximum number of performed iterations. Takes higher precedence than 'epsilon'."),meb(Ohe)),X5c),JI),pqb(L5c))));cTb((new dTb,a))};var ISb,JSb,KSb,LSb,MSb,NSb;var jP=mdb(sme,'StressMetaDataProvider',850);bcb(992,1,ale,dTb);_.Qe=function eTb(a){cTb(a)};var RSb,SSb,TSb,USb,VSb,WSb,XSb,YSb,ZSb,$Sb,_Sb,aTb;var lP=mdb(sme,'StressOptions',992);bcb(993,1,{},fTb);_.$e=function gTb(){var a;return a=new iTb,a};_._e=function hTb(a){};var kP=mdb(sme,'StressOptions/StressFactory',993);bcb(1128,209,Mle,iTb);_.Ze=function jTb(a,b){var c,d,e,f,g;Odd(b,Sme,1);Ccb(DD(hkd(a,(bTb(),VSb))))?Ccb(DD(hkd(a,_Sb)))||$Cb((c=new _Cb((Pgd(),new bhd(a))),c)):WQb(new ZQb,a,Udd(b,1));e=TQb(a);d=LQb(this.a,e);for(g=d.Kc();g.Ob();){f=BD(g.Pb(),231);if(f.e.c.length<=1){continue}sTb(this.b,f);qTb(this.b);Hkb(f.d,new kTb)}e=KQb(d);SQb(e);Qdd(b)};var nP=mdb(Ume,'StressLayoutProvider',1128);bcb(1129,1,qie,kTb);_.td=function lTb(a){lRb(BD(a,447))};var mP=mdb(Ume,'StressLayoutProvider/lambda$0$Type',1129);bcb(990,1,{},tTb);_.c=0;_.e=0;_.g=0;var qP=mdb(Ume,'StressMajorization',990);bcb(379,22,{3:1,35:1,22:1,379:1},zTb);var vTb,wTb,xTb;var oP=ndb(Ume,'StressMajorization/Dimension',379,CI,BTb,ATb);var CTb;bcb(991,1,Dke,ETb);_.ue=function FTb(a,b){return uTb(this.a,BD(a,144),BD(b,144))};_.Fb=function GTb(a){return this===a};_.ve=function HTb(){return new tpb(this)};var pP=mdb(Ume,'StressMajorization/lambda$0$Type',991);bcb(1229,1,{},PTb);var tP=mdb(Wme,'ElkLayered',1229);bcb(1230,1,qie,STb);_.td=function TTb(a){QTb(BD(a,37))};var rP=mdb(Wme,'ElkLayered/lambda$0$Type',1230);bcb(1231,1,qie,UTb);_.td=function VTb(a){RTb(this.a,BD(a,37))};var sP=mdb(Wme,'ElkLayered/lambda$1$Type',1231);bcb(1263,1,{},bUb);var WTb,XTb,YTb;var xP=mdb(Wme,'GraphConfigurator',1263);bcb(759,1,qie,dUb);_.td=function eUb(a){$Tb(this.a,BD(a,10))};var uP=mdb(Wme,'GraphConfigurator/lambda$0$Type',759);bcb(760,1,{},fUb);_.Kb=function gUb(a){return ZTb(),new YAb(null,new Kub(BD(a,29).a,16))};var vP=mdb(Wme,'GraphConfigurator/lambda$1$Type',760);bcb(761,1,qie,hUb);_.td=function iUb(a){$Tb(this.a,BD(a,10))};var wP=mdb(Wme,'GraphConfigurator/lambda$2$Type',761);bcb(1127,209,Mle,jUb);_.Ze=function kUb(a,b){var c;c=U1b(new a2b,a);PD(hkd(a,(Nyc(),axc)))===PD((hbd(),ebd))?JTb(this.a,c,b):KTb(this.a,c,b);z2b(new D2b,c)};var yP=mdb(Wme,'LayeredLayoutProvider',1127);bcb(356,22,{3:1,35:1,22:1,356:1},rUb);var lUb,mUb,nUb,oUb,pUb;var zP=ndb(Wme,'LayeredPhases',356,CI,tUb,sUb);var uUb;bcb(1651,1,{},CUb);_.i=0;var wUb;var CP=mdb(Xme,'ComponentsToCGraphTransformer',1651);var hVb;bcb(1652,1,{},DUb);_.ef=function EUb(a,b){return $wnd.Math.min(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};_.ff=function FUb(a,b){return $wnd.Math.min(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};var AP=mdb(Xme,'ComponentsToCGraphTransformer/1',1652);bcb(81,1,{81:1});_.i=0;_.k=true;_.o=Qje;var IP=mdb(Yme,'CNode',81);bcb(460,81,{460:1,81:1},GUb,HUb);_.Ib=function IUb(){return ''};var BP=mdb(Xme,'ComponentsToCGraphTransformer/CRectNode',460);bcb(1623,1,{},VUb);var JUb,KUb;var FP=mdb(Xme,'OneDimensionalComponentsCompaction',1623);bcb(1624,1,{},YUb);_.Kb=function ZUb(a){return WUb(BD(a,46))};_.Fb=function $Ub(a){return this===a};var DP=mdb(Xme,'OneDimensionalComponentsCompaction/lambda$0$Type',1624);bcb(1625,1,{},_Ub);_.Kb=function aVb(a){return XUb(BD(a,46))};_.Fb=function bVb(a){return this===a};var EP=mdb(Xme,'OneDimensionalComponentsCompaction/lambda$1$Type',1625);bcb(1654,1,{},dVb);var GP=mdb(Yme,'CGraph',1654);bcb(189,1,{189:1},gVb);_.b=0;_.c=0;_.e=0;_.g=true;_.i=Qje;var HP=mdb(Yme,'CGroup',189);bcb(1653,1,{},jVb);_.ef=function kVb(a,b){return $wnd.Math.max(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};_.ff=function lVb(a,b){return $wnd.Math.max(a.a!=null?Edb(a.a):a.c.i,b.a!=null?Edb(b.a):b.c.i)};var JP=mdb(Yme,Ike,1653);bcb(1655,1,{},CVb);_.d=false;var mVb;var LP=mdb(Yme,Nke,1655);bcb(1656,1,{},DVb);_.Kb=function EVb(a){return nVb(),Bcb(),BD(BD(a,46).a,81).d.e!=0?true:false};_.Fb=function FVb(a){return this===a};var KP=mdb(Yme,Oke,1656);bcb(823,1,{},IVb);_.a=false;_.b=false;_.c=false;_.d=false;var MP=mdb(Yme,Pke,823);bcb(1825,1,{},OVb);var RP=mdb(Zme,Qke,1825);var bQ=odb($me,Fke);bcb(1826,1,{369:1},SVb);_.Ke=function TVb(a){QVb(this,BD(a,466))};var OP=mdb(Zme,Rke,1826);bcb(1827,1,Dke,VVb);_.ue=function WVb(a,b){return UVb(BD(a,81),BD(b,81))};_.Fb=function XVb(a){return this===a};_.ve=function YVb(){return new tpb(this)};var NP=mdb(Zme,Ske,1827);bcb(466,1,{466:1},ZVb);_.a=false;var PP=mdb(Zme,Tke,466);bcb(1828,1,Dke,$Vb);_.ue=function _Vb(a,b){return PVb(BD(a,466),BD(b,466))};_.Fb=function aWb(a){return this===a};_.ve=function bWb(){return new tpb(this)};var QP=mdb(Zme,Uke,1828);bcb(140,1,{140:1},cWb,dWb);_.Fb=function eWb(a){var b;if(a==null){return false}if(TP!=rb(a)){return false}b=BD(a,140);return wtb(this.c,b.c)&&wtb(this.d,b.d)};_.Hb=function fWb(){return Hlb(OC(GC(SI,1),Uhe,1,5,[this.c,this.d]))};_.Ib=function gWb(){return '('+this.c+She+this.d+(this.a?'cx':'')+this.b+')'};_.a=true;_.c=0;_.d=0;var TP=mdb($me,'Point',140);bcb(405,22,{3:1,35:1,22:1,405:1},oWb);var hWb,iWb,jWb,kWb;var SP=ndb($me,'Point/Quadrant',405,CI,sWb,rWb);var tWb;bcb(1642,1,{},CWb);_.b=null;_.c=null;_.d=null;_.e=null;_.f=null;var vWb,wWb,xWb,yWb,zWb;var aQ=mdb($me,'RectilinearConvexHull',1642);bcb(574,1,{369:1},NWb);_.Ke=function OWb(a){MWb(this,BD(a,140))};_.b=0;var KWb;var VP=mdb($me,'RectilinearConvexHull/MaximalElementsEventHandler',574);bcb(1644,1,Dke,QWb);_.ue=function RWb(a,b){return PWb(ED(a),ED(b))};_.Fb=function SWb(a){return this===a};_.ve=function TWb(){return new tpb(this)};var UP=mdb($me,'RectilinearConvexHull/MaximalElementsEventHandler/lambda$0$Type',1644);bcb(1643,1,{369:1},VWb);_.Ke=function WWb(a){UWb(this,BD(a,140))};_.a=0;_.b=null;_.c=null;_.d=null;_.e=null;var WP=mdb($me,'RectilinearConvexHull/RectangleEventHandler',1643);bcb(1645,1,Dke,XWb);_.ue=function YWb(a,b){return EWb(BD(a,140),BD(b,140))};_.Fb=function ZWb(a){return this===a};_.ve=function $Wb(){return new tpb(this)};var XP=mdb($me,'RectilinearConvexHull/lambda$0$Type',1645);bcb(1646,1,Dke,_Wb);_.ue=function aXb(a,b){return FWb(BD(a,140),BD(b,140))};_.Fb=function bXb(a){return this===a};_.ve=function cXb(){return new tpb(this)};var YP=mdb($me,'RectilinearConvexHull/lambda$1$Type',1646);bcb(1647,1,Dke,dXb);_.ue=function eXb(a,b){return GWb(BD(a,140),BD(b,140))};_.Fb=function fXb(a){return this===a};_.ve=function gXb(){return new tpb(this)};var ZP=mdb($me,'RectilinearConvexHull/lambda$2$Type',1647);bcb(1648,1,Dke,hXb);_.ue=function iXb(a,b){return HWb(BD(a,140),BD(b,140))};_.Fb=function jXb(a){return this===a};_.ve=function kXb(){return new tpb(this)};var $P=mdb($me,'RectilinearConvexHull/lambda$3$Type',1648);bcb(1649,1,Dke,lXb);_.ue=function mXb(a,b){return IWb(BD(a,140),BD(b,140))};_.Fb=function nXb(a){return this===a};_.ve=function oXb(){return new tpb(this)};var _P=mdb($me,'RectilinearConvexHull/lambda$4$Type',1649);bcb(1650,1,{},qXb);var cQ=mdb($me,'Scanline',1650);bcb(2005,1,{});var dQ=mdb(_me,'AbstractGraphPlacer',2005);bcb(325,1,{325:1},AXb);_.mf=function BXb(a){if(this.nf(a)){Rc(this.b,BD(vNb(a,(wtc(),Esc)),21),a);return true}else{return false}};_.nf=function CXb(a){var b,c,d,e;b=BD(vNb(a,(wtc(),Esc)),21);e=BD(Qc(wXb,b),21);for(d=e.Kc();d.Ob();){c=BD(d.Pb(),21);if(!BD(Qc(this.b,c),15).dc()){return false}}return true};var wXb;var gQ=mdb(_me,'ComponentGroup',325);bcb(765,2005,{},HXb);_.of=function IXb(a){var b,c;for(c=new olb(this.a);c.an){v=0;w+=m+e;m=0}q=g.c;uXb(g,v+q.a,w+q.b);X6c(q);c=$wnd.Math.max(c,v+s.a);m=$wnd.Math.max(m,s.b);v+=s.a+e}b.f.a=c;b.f.b=w+m;if(Ccb(DD(vNb(f,qwc)))){d=new gYb;YXb(d,a,e);for(l=a.Kc();l.Ob();){k=BD(l.Pb(),37);P6c(X6c(k.c),d.e)}P6c(X6c(b.f),d.a)}tXb(b,a)};var uQ=mdb(_me,'SimpleRowGraphPlacer',1291);bcb(1292,1,Dke,VYb);_.ue=function WYb(a,b){return UYb(BD(a,37),BD(b,37))};_.Fb=function XYb(a){return this===a};_.ve=function YYb(){return new tpb(this)};var tQ=mdb(_me,'SimpleRowGraphPlacer/1',1292);var ZYb;bcb(1262,1,Vke,dZb);_.Lb=function eZb(a){var b;return b=BD(vNb(BD(a,243).b,(Nyc(),jxc)),74),!!b&&b.b!=0};_.Fb=function fZb(a){return this===a};_.Mb=function gZb(a){var b;return b=BD(vNb(BD(a,243).b,(Nyc(),jxc)),74),!!b&&b.b!=0};var vQ=mdb(dne,'CompoundGraphPostprocessor/1',1262);bcb(1261,1,ene,wZb);_.pf=function xZb(a,b){qZb(this,BD(a,37),b)};var xQ=mdb(dne,'CompoundGraphPreprocessor',1261);bcb(441,1,{441:1},yZb);_.c=false;var wQ=mdb(dne,'CompoundGraphPreprocessor/ExternalPort',441);bcb(243,1,{243:1},BZb);_.Ib=function CZb(){return Zr(this.c)+':'+TZb(this.b)};var zQ=mdb(dne,'CrossHierarchyEdge',243);bcb(763,1,Dke,EZb);_.ue=function FZb(a,b){return DZb(this,BD(a,243),BD(b,243))};_.Fb=function GZb(a){return this===a};_.ve=function IZb(){return new tpb(this)};var yQ=mdb(dne,'CrossHierarchyEdgeComparator',763);bcb(299,134,{3:1,299:1,94:1,134:1});_.p=0;var JQ=mdb(fne,'LGraphElement',299);bcb(17,299,{3:1,17:1,299:1,94:1,134:1},UZb);_.Ib=function VZb(){return TZb(this)};var AQ=mdb(fne,'LEdge',17);bcb(37,299,{3:1,20:1,37:1,299:1,94:1,134:1},XZb);_.Jc=function YZb(a){reb(this,a)};_.Kc=function ZZb(){return new olb(this.b)};_.Ib=function $Zb(){if(this.b.c.length==0){return 'G-unlayered'+Fe(this.a)}else if(this.a.c.length==0){return 'G-layered'+Fe(this.b)}return 'G[layerless'+Fe(this.a)+', layers'+Fe(this.b)+']'};var KQ=mdb(fne,'LGraph',37);var _Zb;bcb(657,1,{});_.qf=function b$b(){return this.e.n};_.We=function c$b(a){return vNb(this.e,a)};_.rf=function d$b(){return this.e.o};_.sf=function e$b(){return this.e.p};_.Xe=function f$b(a){return wNb(this.e,a)};_.tf=function g$b(a){this.e.n.a=a.a;this.e.n.b=a.b};_.uf=function h$b(a){this.e.o.a=a.a;this.e.o.b=a.b};_.vf=function i$b(a){this.e.p=a};var BQ=mdb(fne,'LGraphAdapters/AbstractLShapeAdapter',657);bcb(577,1,{839:1},j$b);_.wf=function k$b(){var a,b;if(!this.b){this.b=Pu(this.a.b.c.length);for(b=new olb(this.a.b);b.a0&&E_b((BCb(c-1,b.length),b.charCodeAt(c-1)),nne)){--c}if(g> ',a),C0b(c));Qfb(Pfb((a.a+='[',a),c.i),']')}return a.a};_.c=true;_.d=false;var t0b,u0b,v0b,w0b,x0b,y0b;var aR=mdb(fne,'LPort',11);bcb(397,1,vie,J0b);_.Jc=function K0b(a){reb(this,a)};_.Kc=function L0b(){var a;a=new olb(this.a.e);return new M0b(a)};var RQ=mdb(fne,'LPort/1',397);bcb(1290,1,aie,M0b);_.Nb=function N0b(a){Rrb(this,a)};_.Pb=function P0b(){return BD(mlb(this.a),17).c};_.Ob=function O0b(){return llb(this.a)};_.Qb=function Q0b(){nlb(this.a)};var QQ=mdb(fne,'LPort/1/1',1290);bcb(359,1,vie,R0b);_.Jc=function S0b(a){reb(this,a)};_.Kc=function T0b(){var a;return a=new olb(this.a.g),new U0b(a)};var TQ=mdb(fne,'LPort/2',359);bcb(762,1,aie,U0b);_.Nb=function V0b(a){Rrb(this,a)};_.Pb=function X0b(){return BD(mlb(this.a),17).d};_.Ob=function W0b(){return llb(this.a)};_.Qb=function Y0b(){nlb(this.a)};var SQ=mdb(fne,'LPort/2/1',762);bcb(1283,1,vie,Z0b);_.Jc=function $0b(a){reb(this,a)};_.Kc=function _0b(){return new b1b(this)};var VQ=mdb(fne,'LPort/CombineIter',1283);bcb(201,1,aie,b1b);_.Nb=function c1b(a){Rrb(this,a)};_.Qb=function f1b(){Srb()};_.Ob=function d1b(){return a1b(this)};_.Pb=function e1b(){return llb(this.a)?mlb(this.a):mlb(this.b)};var UQ=mdb(fne,'LPort/CombineIter/1',201);bcb(1285,1,Vke,h1b);_.Lb=function i1b(a){return g1b(a)};_.Fb=function j1b(a){return this===a};_.Mb=function k1b(a){return z0b(),BD(a,11).e.c.length!=0};var WQ=mdb(fne,'LPort/lambda$0$Type',1285);bcb(1284,1,Vke,m1b);_.Lb=function n1b(a){return l1b(a)};_.Fb=function o1b(a){return this===a};_.Mb=function p1b(a){return z0b(),BD(a,11).g.c.length!=0};var XQ=mdb(fne,'LPort/lambda$1$Type',1284);bcb(1286,1,Vke,q1b);_.Lb=function r1b(a){return z0b(),BD(a,11).j==(Ucd(),Acd)};_.Fb=function s1b(a){return this===a};_.Mb=function t1b(a){return z0b(),BD(a,11).j==(Ucd(),Acd)};var YQ=mdb(fne,'LPort/lambda$2$Type',1286);bcb(1287,1,Vke,u1b);_.Lb=function v1b(a){return z0b(),BD(a,11).j==(Ucd(),zcd)};_.Fb=function w1b(a){return this===a};_.Mb=function x1b(a){return z0b(),BD(a,11).j==(Ucd(),zcd)};var ZQ=mdb(fne,'LPort/lambda$3$Type',1287);bcb(1288,1,Vke,y1b);_.Lb=function z1b(a){return z0b(),BD(a,11).j==(Ucd(),Rcd)};_.Fb=function A1b(a){return this===a};_.Mb=function B1b(a){return z0b(),BD(a,11).j==(Ucd(),Rcd)};var $Q=mdb(fne,'LPort/lambda$4$Type',1288);bcb(1289,1,Vke,C1b);_.Lb=function D1b(a){return z0b(),BD(a,11).j==(Ucd(),Tcd)};_.Fb=function E1b(a){return this===a};_.Mb=function F1b(a){return z0b(),BD(a,11).j==(Ucd(),Tcd)};var _Q=mdb(fne,'LPort/lambda$5$Type',1289);bcb(29,299,{3:1,20:1,299:1,29:1,94:1,134:1},H1b);_.Jc=function I1b(a){reb(this,a)};_.Kc=function J1b(){return new olb(this.a)};_.Ib=function K1b(){return 'L_'+Jkb(this.b.b,this,0)+Fe(this.a)};var cR=mdb(fne,'Layer',29);bcb(1342,1,{},a2b);var mR=mdb(tne,une,1342);bcb(1346,1,{},e2b);_.Kb=function f2b(a){return atd(BD(a,82))};var dR=mdb(tne,'ElkGraphImporter/0methodref$connectableShapeToNode$Type',1346);bcb(1349,1,{},g2b);_.Kb=function h2b(a){return atd(BD(a,82))};var eR=mdb(tne,'ElkGraphImporter/1methodref$connectableShapeToNode$Type',1349);bcb(1343,1,qie,i2b);_.td=function j2b(a){Q1b(this.a,BD(a,118))};var fR=mdb(tne,vne,1343);bcb(1344,1,qie,k2b);_.td=function l2b(a){Q1b(this.a,BD(a,118))};var gR=mdb(tne,wne,1344);bcb(1345,1,{},m2b);_.Kb=function n2b(a){return new YAb(null,new Kub(Old(BD(a,79)),16))};var hR=mdb(tne,xne,1345);bcb(1347,1,Oie,o2b);_.Mb=function p2b(a){return b2b(this.a,BD(a,33))};var iR=mdb(tne,yne,1347);bcb(1348,1,{},q2b);_.Kb=function r2b(a){return new YAb(null,new Kub(Nld(BD(a,79)),16))};var jR=mdb(tne,'ElkGraphImporter/lambda$5$Type',1348);bcb(1350,1,Oie,s2b);_.Mb=function t2b(a){return c2b(this.a,BD(a,33))};var kR=mdb(tne,'ElkGraphImporter/lambda$7$Type',1350);bcb(1351,1,Oie,u2b);_.Mb=function v2b(a){return d2b(BD(a,79))};var lR=mdb(tne,'ElkGraphImporter/lambda$8$Type',1351);bcb(1278,1,{},D2b);var w2b;var rR=mdb(tne,'ElkGraphLayoutTransferrer',1278);bcb(1279,1,Oie,G2b);_.Mb=function H2b(a){return E2b(this.a,BD(a,17))};var nR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$0$Type',1279);bcb(1280,1,qie,I2b);_.td=function J2b(a){x2b();Ekb(this.a,BD(a,17))};var oR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$1$Type',1280);bcb(1281,1,Oie,K2b);_.Mb=function L2b(a){return F2b(this.a,BD(a,17))};var pR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$2$Type',1281);bcb(1282,1,qie,M2b);_.td=function N2b(a){x2b();Ekb(this.a,BD(a,17))};var qR=mdb(tne,'ElkGraphLayoutTransferrer/lambda$3$Type',1282);bcb(1485,1,ene,S2b);_.pf=function T2b(a,b){Q2b(BD(a,37),b)};var uR=mdb(Ane,'CommentNodeMarginCalculator',1485);bcb(1486,1,{},U2b);_.Kb=function V2b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var sR=mdb(Ane,'CommentNodeMarginCalculator/lambda$0$Type',1486);bcb(1487,1,qie,W2b);_.td=function X2b(a){R2b(BD(a,10))};var tR=mdb(Ane,'CommentNodeMarginCalculator/lambda$1$Type',1487);bcb(1488,1,ene,_2b);_.pf=function a3b(a,b){Z2b(BD(a,37),b)};var vR=mdb(Ane,'CommentPostprocessor',1488);bcb(1489,1,ene,e3b);_.pf=function f3b(a,b){b3b(BD(a,37),b)};var wR=mdb(Ane,'CommentPreprocessor',1489);bcb(1490,1,ene,h3b);_.pf=function i3b(a,b){g3b(BD(a,37),b)};var xR=mdb(Ane,'ConstraintsPostprocessor',1490);bcb(1491,1,ene,p3b);_.pf=function q3b(a,b){n3b(BD(a,37),b)};var yR=mdb(Ane,'EdgeAndLayerConstraintEdgeReverser',1491);bcb(1492,1,ene,t3b);_.pf=function v3b(a,b){r3b(BD(a,37),b)};var CR=mdb(Ane,'EndLabelPostprocessor',1492);bcb(1493,1,{},w3b);_.Kb=function x3b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var zR=mdb(Ane,'EndLabelPostprocessor/lambda$0$Type',1493);bcb(1494,1,Oie,y3b);_.Mb=function z3b(a){return u3b(BD(a,10))};var AR=mdb(Ane,'EndLabelPostprocessor/lambda$1$Type',1494);bcb(1495,1,qie,A3b);_.td=function B3b(a){s3b(BD(a,10))};var BR=mdb(Ane,'EndLabelPostprocessor/lambda$2$Type',1495);bcb(1496,1,ene,M3b);_.pf=function P3b(a,b){I3b(BD(a,37),b)};var JR=mdb(Ane,'EndLabelPreprocessor',1496);bcb(1497,1,{},Q3b);_.Kb=function R3b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var DR=mdb(Ane,'EndLabelPreprocessor/lambda$0$Type',1497);bcb(1498,1,qie,S3b);_.td=function T3b(a){E3b(this.a,this.b,this.c,BD(a,10))};_.a=0;_.b=0;_.c=false;var ER=mdb(Ane,'EndLabelPreprocessor/lambda$1$Type',1498);bcb(1499,1,Oie,U3b);_.Mb=function V3b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),pad))};var FR=mdb(Ane,'EndLabelPreprocessor/lambda$2$Type',1499);bcb(1500,1,qie,W3b);_.td=function X3b(a){Dsb(this.a,BD(a,70))};var GR=mdb(Ane,'EndLabelPreprocessor/lambda$3$Type',1500);bcb(1501,1,Oie,Y3b);_.Mb=function Z3b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),oad))};var HR=mdb(Ane,'EndLabelPreprocessor/lambda$4$Type',1501);bcb(1502,1,qie,$3b);_.td=function _3b(a){Dsb(this.a,BD(a,70))};var IR=mdb(Ane,'EndLabelPreprocessor/lambda$5$Type',1502);bcb(1551,1,ene,i4b);_.pf=function j4b(a,b){f4b(BD(a,37),b)};var a4b;var RR=mdb(Ane,'EndLabelSorter',1551);bcb(1552,1,Dke,l4b);_.ue=function m4b(a,b){return k4b(BD(a,456),BD(b,456))};_.Fb=function n4b(a){return this===a};_.ve=function o4b(){return new tpb(this)};var KR=mdb(Ane,'EndLabelSorter/1',1552);bcb(456,1,{456:1},p4b);var LR=mdb(Ane,'EndLabelSorter/LabelGroup',456);bcb(1553,1,{},q4b);_.Kb=function r4b(a){return b4b(),new YAb(null,new Kub(BD(a,29).a,16))};var MR=mdb(Ane,'EndLabelSorter/lambda$0$Type',1553);bcb(1554,1,Oie,s4b);_.Mb=function t4b(a){return b4b(),BD(a,10).k==(j0b(),h0b)};var NR=mdb(Ane,'EndLabelSorter/lambda$1$Type',1554);bcb(1555,1,qie,u4b);_.td=function v4b(a){g4b(BD(a,10))};var OR=mdb(Ane,'EndLabelSorter/lambda$2$Type',1555);bcb(1556,1,Oie,w4b);_.Mb=function x4b(a){return b4b(),PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),oad))};var PR=mdb(Ane,'EndLabelSorter/lambda$3$Type',1556);bcb(1557,1,Oie,y4b);_.Mb=function z4b(a){return b4b(),PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),pad))};var QR=mdb(Ane,'EndLabelSorter/lambda$4$Type',1557);bcb(1503,1,ene,L4b);_.pf=function M4b(a,b){J4b(this,BD(a,37))};_.b=0;_.c=0;var YR=mdb(Ane,'FinalSplineBendpointsCalculator',1503);bcb(1504,1,{},N4b);_.Kb=function O4b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var SR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$0$Type',1504);bcb(1505,1,{},P4b);_.Kb=function Q4b(a){return new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var TR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$1$Type',1505);bcb(1506,1,Oie,R4b);_.Mb=function S4b(a){return !OZb(BD(a,17))};var UR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$2$Type',1506);bcb(1507,1,Oie,T4b);_.Mb=function U4b(a){return wNb(BD(a,17),(wtc(),rtc))};var VR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$3$Type',1507);bcb(1508,1,qie,V4b);_.td=function W4b(a){C4b(this.a,BD(a,128))};var WR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$4$Type',1508);bcb(1509,1,qie,X4b);_.td=function Y4b(a){smb(BD(a,17).a)};var XR=mdb(Ane,'FinalSplineBendpointsCalculator/lambda$5$Type',1509);bcb(792,1,ene,u5b);_.pf=function v5b(a,b){l5b(this,BD(a,37),b)};var $R=mdb(Ane,'GraphTransformer',792);bcb(511,22,{3:1,35:1,22:1,511:1},z5b);var w5b,x5b;var ZR=ndb(Ane,'GraphTransformer/Mode',511,CI,B5b,A5b);var C5b;bcb(1510,1,ene,I5b);_.pf=function J5b(a,b){F5b(BD(a,37),b)};var _R=mdb(Ane,'HierarchicalNodeResizingProcessor',1510);bcb(1511,1,ene,Q5b);_.pf=function R5b(a,b){M5b(BD(a,37),b)};var bS=mdb(Ane,'HierarchicalPortConstraintProcessor',1511);bcb(1512,1,Dke,T5b);_.ue=function U5b(a,b){return S5b(BD(a,10),BD(b,10))};_.Fb=function V5b(a){return this===a};_.ve=function W5b(){return new tpb(this)};var aS=mdb(Ane,'HierarchicalPortConstraintProcessor/NodeComparator',1512);bcb(1513,1,ene,Z5b);_.pf=function $5b(a,b){X5b(BD(a,37),b)};var cS=mdb(Ane,'HierarchicalPortDummySizeProcessor',1513);bcb(1514,1,ene,l6b);_.pf=function m6b(a,b){e6b(this,BD(a,37),b)};_.a=0;var fS=mdb(Ane,'HierarchicalPortOrthogonalEdgeRouter',1514);bcb(1515,1,Dke,o6b);_.ue=function p6b(a,b){return n6b(BD(a,10),BD(b,10))};_.Fb=function q6b(a){return this===a};_.ve=function r6b(){return new tpb(this)};var dS=mdb(Ane,'HierarchicalPortOrthogonalEdgeRouter/1',1515);bcb(1516,1,Dke,t6b);_.ue=function u6b(a,b){return s6b(BD(a,10),BD(b,10))};_.Fb=function v6b(a){return this===a};_.ve=function w6b(){return new tpb(this)};var eS=mdb(Ane,'HierarchicalPortOrthogonalEdgeRouter/2',1516);bcb(1517,1,ene,z6b);_.pf=function A6b(a,b){y6b(BD(a,37),b)};var gS=mdb(Ane,'HierarchicalPortPositionProcessor',1517);bcb(1518,1,ene,J6b);_.pf=function K6b(a,b){I6b(this,BD(a,37))};_.a=0;_.c=0;var B6b,C6b;var kS=mdb(Ane,'HighDegreeNodeLayeringProcessor',1518);bcb(571,1,{571:1},L6b);_.b=-1;_.d=-1;var hS=mdb(Ane,'HighDegreeNodeLayeringProcessor/HighDegreeNodeInformation',571);bcb(1519,1,{},M6b);_.Kb=function N6b(a){return D6b(),R_b(BD(a,10))};_.Fb=function O6b(a){return this===a};var iS=mdb(Ane,'HighDegreeNodeLayeringProcessor/lambda$0$Type',1519);bcb(1520,1,{},P6b);_.Kb=function Q6b(a){return D6b(),U_b(BD(a,10))};_.Fb=function R6b(a){return this===a};var jS=mdb(Ane,'HighDegreeNodeLayeringProcessor/lambda$1$Type',1520);bcb(1526,1,ene,X6b);_.pf=function Y6b(a,b){W6b(this,BD(a,37),b)};var pS=mdb(Ane,'HyperedgeDummyMerger',1526);bcb(793,1,{},Z6b);_.a=false;_.b=false;_.c=false;var lS=mdb(Ane,'HyperedgeDummyMerger/MergeState',793);bcb(1527,1,{},$6b);_.Kb=function _6b(a){return new YAb(null,new Kub(BD(a,29).a,16))};var mS=mdb(Ane,'HyperedgeDummyMerger/lambda$0$Type',1527);bcb(1528,1,{},a7b);_.Kb=function b7b(a){return new YAb(null,new Kub(BD(a,10).j,16))};var nS=mdb(Ane,'HyperedgeDummyMerger/lambda$1$Type',1528);bcb(1529,1,qie,c7b);_.td=function d7b(a){BD(a,11).p=-1};var oS=mdb(Ane,'HyperedgeDummyMerger/lambda$2$Type',1529);bcb(1530,1,ene,g7b);_.pf=function h7b(a,b){f7b(BD(a,37),b)};var qS=mdb(Ane,'HypernodesProcessor',1530);bcb(1531,1,ene,j7b);_.pf=function k7b(a,b){i7b(BD(a,37),b)};var rS=mdb(Ane,'InLayerConstraintProcessor',1531);bcb(1532,1,ene,m7b);_.pf=function n7b(a,b){l7b(BD(a,37),b)};var sS=mdb(Ane,'InnermostNodeMarginCalculator',1532);bcb(1533,1,ene,r7b);_.pf=function w7b(a,b){q7b(this,BD(a,37))};_.a=Qje;_.b=Qje;_.c=Pje;_.d=Pje;var zS=mdb(Ane,'InteractiveExternalPortPositioner',1533);bcb(1534,1,{},x7b);_.Kb=function y7b(a){return BD(a,17).d.i};_.Fb=function z7b(a){return this===a};var tS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$0$Type',1534);bcb(1535,1,{},A7b);_.Kb=function B7b(a){return s7b(this.a,ED(a))};_.Fb=function C7b(a){return this===a};var uS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$1$Type',1535);bcb(1536,1,{},D7b);_.Kb=function E7b(a){return BD(a,17).c.i};_.Fb=function F7b(a){return this===a};var vS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$2$Type',1536);bcb(1537,1,{},G7b);_.Kb=function H7b(a){return t7b(this.a,ED(a))};_.Fb=function I7b(a){return this===a};var wS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$3$Type',1537);bcb(1538,1,{},J7b);_.Kb=function K7b(a){return u7b(this.a,ED(a))};_.Fb=function L7b(a){return this===a};var xS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$4$Type',1538);bcb(1539,1,{},M7b);_.Kb=function N7b(a){return v7b(this.a,ED(a))};_.Fb=function O7b(a){return this===a};var yS=mdb(Ane,'InteractiveExternalPortPositioner/lambda$5$Type',1539);bcb(77,22,{3:1,35:1,22:1,77:1,234:1},T8b);_.Kf=function U8b(){switch(this.g){case 15:return new eoc;case 22:return new Aoc;case 47:return new Joc;case 28:case 35:return new uac;case 32:return new S2b;case 42:return new _2b;case 1:return new e3b;case 41:return new h3b;case 56:return new u5b((y5b(),x5b));case 0:return new u5b((y5b(),w5b));case 2:return new p3b;case 54:return new t3b;case 33:return new M3b;case 51:return new L4b;case 55:return new I5b;case 13:return new Q5b;case 38:return new Z5b;case 44:return new l6b;case 40:return new z6b;case 9:return new J6b;case 49:return new sgc;case 37:return new X6b;case 43:return new g7b;case 27:return new j7b;case 30:return new m7b;case 3:return new r7b;case 18:return new b9b;case 29:return new h9b;case 5:return new u9b;case 50:return new D9b;case 34:return new $9b;case 36:return new Iac;case 52:return new i4b;case 11:return new Sac;case 7:return new abc;case 39:return new obc;case 45:return new rbc;case 16:return new vbc;case 10:return new Fbc;case 48:return new Xbc;case 21:return new ccc;case 23:return new fGc((rGc(),pGc));case 8:return new lcc;case 12:return new tcc;case 4:return new ycc;case 19:return new Tcc;case 17:return new pdc;case 53:return new sdc;case 6:return new hec;case 25:return new wdc;case 46:return new Ndc;case 31:return new sec;case 14:return new Fec;case 26:return new ppc;case 20:return new Uec;case 24:return new fGc((rGc(),qGc));default:throw vbb(new Wdb(Dne+(this.f!=null?this.f:''+this.g)));}};var P7b,Q7b,R7b,S7b,T7b,U7b,V7b,W7b,X7b,Y7b,Z7b,$7b,_7b,a8b,b8b,c8b,d8b,e8b,f8b,g8b,h8b,i8b,j8b,k8b,l8b,m8b,n8b,o8b,p8b,q8b,r8b,s8b,t8b,u8b,v8b,w8b,x8b,y8b,z8b,A8b,B8b,C8b,D8b,E8b,F8b,G8b,H8b,I8b,J8b,K8b,L8b,M8b,N8b,O8b,P8b,Q8b,R8b;var AS=ndb(Ane,Ene,77,CI,W8b,V8b);var X8b;bcb(1540,1,ene,b9b);_.pf=function c9b(a,b){_8b(BD(a,37),b)};var BS=mdb(Ane,'InvertedPortProcessor',1540);bcb(1541,1,ene,h9b);_.pf=function i9b(a,b){g9b(BD(a,37),b)};var FS=mdb(Ane,'LabelAndNodeSizeProcessor',1541);bcb(1542,1,Oie,j9b);_.Mb=function k9b(a){return BD(a,10).k==(j0b(),h0b)};var CS=mdb(Ane,'LabelAndNodeSizeProcessor/lambda$0$Type',1542);bcb(1543,1,Oie,l9b);_.Mb=function m9b(a){return BD(a,10).k==(j0b(),e0b)};var DS=mdb(Ane,'LabelAndNodeSizeProcessor/lambda$1$Type',1543);bcb(1544,1,qie,n9b);_.td=function o9b(a){e9b(this.b,this.a,this.c,BD(a,10))};_.a=false;_.c=false;var ES=mdb(Ane,'LabelAndNodeSizeProcessor/lambda$2$Type',1544);bcb(1545,1,ene,u9b);_.pf=function v9b(a,b){s9b(BD(a,37),b)};var p9b;var HS=mdb(Ane,'LabelDummyInserter',1545);bcb(1546,1,Vke,w9b);_.Lb=function x9b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),nad))};_.Fb=function y9b(a){return this===a};_.Mb=function z9b(a){return PD(vNb(BD(a,70),(Nyc(),Qwc)))===PD((qad(),nad))};var GS=mdb(Ane,'LabelDummyInserter/1',1546);bcb(1547,1,ene,D9b);_.pf=function E9b(a,b){C9b(BD(a,37),b)};var JS=mdb(Ane,'LabelDummyRemover',1547);bcb(1548,1,Oie,F9b);_.Mb=function G9b(a){return Ccb(DD(vNb(BD(a,70),(Nyc(),Pwc))))};var IS=mdb(Ane,'LabelDummyRemover/lambda$0$Type',1548);bcb(1359,1,ene,$9b);_.pf=function cac(a,b){W9b(this,BD(a,37),b)};_.a=null;var H9b;var QS=mdb(Ane,'LabelDummySwitcher',1359);bcb(286,1,{286:1},gac);_.c=0;_.d=null;_.f=0;var KS=mdb(Ane,'LabelDummySwitcher/LabelDummyInfo',286);bcb(1360,1,{},hac);_.Kb=function iac(a){return I9b(),new YAb(null,new Kub(BD(a,29).a,16))};var LS=mdb(Ane,'LabelDummySwitcher/lambda$0$Type',1360);bcb(1361,1,Oie,jac);_.Mb=function kac(a){return I9b(),BD(a,10).k==(j0b(),f0b)};var MS=mdb(Ane,'LabelDummySwitcher/lambda$1$Type',1361);bcb(1362,1,{},lac);_.Kb=function mac(a){return _9b(this.a,BD(a,10))};var NS=mdb(Ane,'LabelDummySwitcher/lambda$2$Type',1362);bcb(1363,1,qie,nac);_.td=function oac(a){aac(this.a,BD(a,286))};var OS=mdb(Ane,'LabelDummySwitcher/lambda$3$Type',1363);bcb(1364,1,Dke,pac);_.ue=function qac(a,b){return bac(BD(a,286),BD(b,286))};_.Fb=function rac(a){return this===a};_.ve=function sac(){return new tpb(this)};var PS=mdb(Ane,'LabelDummySwitcher/lambda$4$Type',1364);bcb(791,1,ene,uac);_.pf=function vac(a,b){tac(BD(a,37),b)};var RS=mdb(Ane,'LabelManagementProcessor',791);bcb(1549,1,ene,Iac);_.pf=function Jac(a,b){Cac(BD(a,37),b)};var TS=mdb(Ane,'LabelSideSelector',1549);bcb(1550,1,Oie,Kac);_.Mb=function Lac(a){return Ccb(DD(vNb(BD(a,70),(Nyc(),Pwc))))};var SS=mdb(Ane,'LabelSideSelector/lambda$0$Type',1550);bcb(1558,1,ene,Sac);_.pf=function Tac(a,b){Oac(BD(a,37),b)};var US=mdb(Ane,'LayerConstraintPostprocessor',1558);bcb(1559,1,ene,abc);_.pf=function bbc(a,b){$ac(BD(a,37),b)};var Uac;var WS=mdb(Ane,'LayerConstraintPreprocessor',1559);bcb(360,22,{3:1,35:1,22:1,360:1},ibc);var cbc,dbc,ebc,fbc;var VS=ndb(Ane,'LayerConstraintPreprocessor/HiddenNodeConnections',360,CI,kbc,jbc);var lbc;bcb(1560,1,ene,obc);_.pf=function pbc(a,b){nbc(BD(a,37),b)};var XS=mdb(Ane,'LayerSizeAndGraphHeightCalculator',1560);bcb(1561,1,ene,rbc);_.pf=function tbc(a,b){qbc(BD(a,37),b)};var YS=mdb(Ane,'LongEdgeJoiner',1561);bcb(1562,1,ene,vbc);_.pf=function xbc(a,b){ubc(BD(a,37),b)};var ZS=mdb(Ane,'LongEdgeSplitter',1562);bcb(1563,1,ene,Fbc);_.pf=function Ibc(a,b){Bbc(this,BD(a,37),b)};_.d=0;_.e=0;_.i=0;_.j=0;_.k=0;_.n=0;var bT=mdb(Ane,'NodePromotion',1563);bcb(1564,1,{},Jbc);_.Kb=function Kbc(a){return BD(a,46),Bcb(),true};_.Fb=function Lbc(a){return this===a};var $S=mdb(Ane,'NodePromotion/lambda$0$Type',1564);bcb(1565,1,{},Mbc);_.Kb=function Nbc(a){return Gbc(this.a,BD(a,46))};_.Fb=function Obc(a){return this===a};_.a=0;var _S=mdb(Ane,'NodePromotion/lambda$1$Type',1565);bcb(1566,1,{},Pbc);_.Kb=function Qbc(a){return Hbc(this.a,BD(a,46))};_.Fb=function Rbc(a){return this===a};_.a=0;var aT=mdb(Ane,'NodePromotion/lambda$2$Type',1566);bcb(1567,1,ene,Xbc);_.pf=function Ybc(a,b){Sbc(BD(a,37),b)};var cT=mdb(Ane,'NorthSouthPortPostprocessor',1567);bcb(1568,1,ene,ccc);_.pf=function ecc(a,b){acc(BD(a,37),b)};var eT=mdb(Ane,'NorthSouthPortPreprocessor',1568);bcb(1569,1,Dke,fcc);_.ue=function gcc(a,b){return dcc(BD(a,11),BD(b,11))};_.Fb=function hcc(a){return this===a};_.ve=function icc(){return new tpb(this)};var dT=mdb(Ane,'NorthSouthPortPreprocessor/lambda$0$Type',1569);bcb(1570,1,ene,lcc);_.pf=function ncc(a,b){kcc(BD(a,37),b)};var hT=mdb(Ane,'PartitionMidprocessor',1570);bcb(1571,1,Oie,occ);_.Mb=function pcc(a){return wNb(BD(a,10),(Nyc(),Nxc))};var fT=mdb(Ane,'PartitionMidprocessor/lambda$0$Type',1571);bcb(1572,1,qie,qcc);_.td=function rcc(a){mcc(this.a,BD(a,10))};var gT=mdb(Ane,'PartitionMidprocessor/lambda$1$Type',1572);bcb(1573,1,ene,tcc);_.pf=function ucc(a,b){scc(BD(a,37),b)};var iT=mdb(Ane,'PartitionPostprocessor',1573);bcb(1574,1,ene,ycc);_.pf=function zcc(a,b){wcc(BD(a,37),b)};var nT=mdb(Ane,'PartitionPreprocessor',1574);bcb(1575,1,Oie,Acc);_.Mb=function Bcc(a){return wNb(BD(a,10),(Nyc(),Nxc))};var jT=mdb(Ane,'PartitionPreprocessor/lambda$0$Type',1575);bcb(1576,1,{},Ccc);_.Kb=function Dcc(a){return new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var kT=mdb(Ane,'PartitionPreprocessor/lambda$1$Type',1576);bcb(1577,1,Oie,Ecc);_.Mb=function Fcc(a){return vcc(BD(a,17))};var lT=mdb(Ane,'PartitionPreprocessor/lambda$2$Type',1577);bcb(1578,1,qie,Gcc);_.td=function Hcc(a){xcc(BD(a,17))};var mT=mdb(Ane,'PartitionPreprocessor/lambda$3$Type',1578);bcb(1579,1,ene,Tcc);_.pf=function Xcc(a,b){Qcc(BD(a,37),b)};var Icc,Jcc,Kcc,Lcc,Mcc,Ncc;var tT=mdb(Ane,'PortListSorter',1579);bcb(1580,1,{},Zcc);_.Kb=function $cc(a){return Occ(),BD(a,11).e};var oT=mdb(Ane,'PortListSorter/lambda$0$Type',1580);bcb(1581,1,{},_cc);_.Kb=function adc(a){return Occ(),BD(a,11).g};var pT=mdb(Ane,'PortListSorter/lambda$1$Type',1581);bcb(1582,1,Dke,bdc);_.ue=function cdc(a,b){return Ucc(BD(a,11),BD(b,11))};_.Fb=function ddc(a){return this===a};_.ve=function edc(){return new tpb(this)};var qT=mdb(Ane,'PortListSorter/lambda$2$Type',1582);bcb(1583,1,Dke,fdc);_.ue=function gdc(a,b){return Vcc(BD(a,11),BD(b,11))};_.Fb=function hdc(a){return this===a};_.ve=function idc(){return new tpb(this)};var rT=mdb(Ane,'PortListSorter/lambda$3$Type',1583);bcb(1584,1,Dke,jdc);_.ue=function kdc(a,b){return Wcc(BD(a,11),BD(b,11))};_.Fb=function ldc(a){return this===a};_.ve=function mdc(){return new tpb(this)};var sT=mdb(Ane,'PortListSorter/lambda$4$Type',1584);bcb(1585,1,ene,pdc);_.pf=function qdc(a,b){ndc(BD(a,37),b)};var uT=mdb(Ane,'PortSideProcessor',1585);bcb(1586,1,ene,sdc);_.pf=function tdc(a,b){rdc(BD(a,37),b)};var vT=mdb(Ane,'ReversedEdgeRestorer',1586);bcb(1591,1,ene,wdc);_.pf=function xdc(a,b){udc(this,BD(a,37),b)};var CT=mdb(Ane,'SelfLoopPortRestorer',1591);bcb(1592,1,{},ydc);_.Kb=function zdc(a){return new YAb(null,new Kub(BD(a,29).a,16))};var wT=mdb(Ane,'SelfLoopPortRestorer/lambda$0$Type',1592);bcb(1593,1,Oie,Adc);_.Mb=function Bdc(a){return BD(a,10).k==(j0b(),h0b)};var xT=mdb(Ane,'SelfLoopPortRestorer/lambda$1$Type',1593);bcb(1594,1,Oie,Cdc);_.Mb=function Ddc(a){return wNb(BD(a,10),(wtc(),ntc))};var yT=mdb(Ane,'SelfLoopPortRestorer/lambda$2$Type',1594);bcb(1595,1,{},Edc);_.Kb=function Fdc(a){return BD(vNb(BD(a,10),(wtc(),ntc)),403)};var zT=mdb(Ane,'SelfLoopPortRestorer/lambda$3$Type',1595);bcb(1596,1,qie,Gdc);_.td=function Hdc(a){vdc(this.a,BD(a,403))};var AT=mdb(Ane,'SelfLoopPortRestorer/lambda$4$Type',1596);bcb(794,1,qie,Idc);_.td=function Jdc(a){ljc(BD(a,101))};var BT=mdb(Ane,'SelfLoopPortRestorer/lambda$5$Type',794);bcb(1597,1,ene,Ndc);_.pf=function Pdc(a,b){Kdc(BD(a,37),b)};var LT=mdb(Ane,'SelfLoopPostProcessor',1597);bcb(1598,1,{},Qdc);_.Kb=function Rdc(a){return new YAb(null,new Kub(BD(a,29).a,16))};var DT=mdb(Ane,'SelfLoopPostProcessor/lambda$0$Type',1598);bcb(1599,1,Oie,Sdc);_.Mb=function Tdc(a){return BD(a,10).k==(j0b(),h0b)};var ET=mdb(Ane,'SelfLoopPostProcessor/lambda$1$Type',1599);bcb(1600,1,Oie,Udc);_.Mb=function Vdc(a){return wNb(BD(a,10),(wtc(),ntc))};var FT=mdb(Ane,'SelfLoopPostProcessor/lambda$2$Type',1600);bcb(1601,1,qie,Wdc);_.td=function Xdc(a){Ldc(BD(a,10))};var GT=mdb(Ane,'SelfLoopPostProcessor/lambda$3$Type',1601);bcb(1602,1,{},Ydc);_.Kb=function Zdc(a){return new YAb(null,new Kub(BD(a,101).f,1))};var HT=mdb(Ane,'SelfLoopPostProcessor/lambda$4$Type',1602);bcb(1603,1,qie,$dc);_.td=function _dc(a){Mdc(this.a,BD(a,409))};var IT=mdb(Ane,'SelfLoopPostProcessor/lambda$5$Type',1603);bcb(1604,1,Oie,aec);_.Mb=function bec(a){return !!BD(a,101).i};var JT=mdb(Ane,'SelfLoopPostProcessor/lambda$6$Type',1604);bcb(1605,1,qie,cec);_.td=function dec(a){Odc(this.a,BD(a,101))};var KT=mdb(Ane,'SelfLoopPostProcessor/lambda$7$Type',1605);bcb(1587,1,ene,hec);_.pf=function iec(a,b){gec(BD(a,37),b)};var PT=mdb(Ane,'SelfLoopPreProcessor',1587);bcb(1588,1,{},jec);_.Kb=function kec(a){return new YAb(null,new Kub(BD(a,101).f,1))};var MT=mdb(Ane,'SelfLoopPreProcessor/lambda$0$Type',1588);bcb(1589,1,{},lec);_.Kb=function mec(a){return BD(a,409).a};var NT=mdb(Ane,'SelfLoopPreProcessor/lambda$1$Type',1589);bcb(1590,1,qie,nec);_.td=function oec(a){fec(BD(a,17))};var OT=mdb(Ane,'SelfLoopPreProcessor/lambda$2$Type',1590);bcb(1606,1,ene,sec);_.pf=function tec(a,b){qec(this,BD(a,37),b)};var VT=mdb(Ane,'SelfLoopRouter',1606);bcb(1607,1,{},uec);_.Kb=function vec(a){return new YAb(null,new Kub(BD(a,29).a,16))};var QT=mdb(Ane,'SelfLoopRouter/lambda$0$Type',1607);bcb(1608,1,Oie,wec);_.Mb=function xec(a){return BD(a,10).k==(j0b(),h0b)};var RT=mdb(Ane,'SelfLoopRouter/lambda$1$Type',1608);bcb(1609,1,Oie,yec);_.Mb=function zec(a){return wNb(BD(a,10),(wtc(),ntc))};var ST=mdb(Ane,'SelfLoopRouter/lambda$2$Type',1609);bcb(1610,1,{},Aec);_.Kb=function Bec(a){return BD(vNb(BD(a,10),(wtc(),ntc)),403)};var TT=mdb(Ane,'SelfLoopRouter/lambda$3$Type',1610);bcb(1611,1,qie,Cec);_.td=function Dec(a){pec(this.a,this.b,BD(a,403))};var UT=mdb(Ane,'SelfLoopRouter/lambda$4$Type',1611);bcb(1612,1,ene,Fec);_.pf=function Iec(a,b){Eec(BD(a,37),b)};var $T=mdb(Ane,'SemiInteractiveCrossMinProcessor',1612);bcb(1613,1,Oie,Jec);_.Mb=function Kec(a){return BD(a,10).k==(j0b(),h0b)};var WT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$0$Type',1613);bcb(1614,1,Oie,Lec);_.Mb=function Mec(a){return uNb(BD(a,10))._b((Nyc(),ayc))};var XT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$1$Type',1614);bcb(1615,1,Dke,Nec);_.ue=function Oec(a,b){return Gec(BD(a,10),BD(b,10))};_.Fb=function Pec(a){return this===a};_.ve=function Qec(){return new tpb(this)};var YT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$2$Type',1615);bcb(1616,1,{},Rec);_.Ce=function Sec(a,b){return Hec(BD(a,10),BD(b,10))};var ZT=mdb(Ane,'SemiInteractiveCrossMinProcessor/lambda$3$Type',1616);bcb(1618,1,ene,Uec);_.pf=function Yec(a,b){Tec(BD(a,37),b)};var bU=mdb(Ane,'SortByInputModelProcessor',1618);bcb(1619,1,Oie,Zec);_.Mb=function $ec(a){return BD(a,11).g.c.length!=0};var _T=mdb(Ane,'SortByInputModelProcessor/lambda$0$Type',1619);bcb(1620,1,qie,_ec);_.td=function afc(a){Wec(this.a,BD(a,11))};var aU=mdb(Ane,'SortByInputModelProcessor/lambda$1$Type',1620);bcb(1693,803,{},jfc);_.Me=function kfc(a){var b,c,d,e;this.c=a;switch(this.a.g){case 2:b=new Rkb;MAb(JAb(new YAb(null,new Kub(this.c.a.b,16)),new lgc),new ngc(this,b));nEb(this,new tfc);Hkb(b,new xfc);b.c=KC(SI,Uhe,1,0,5,1);MAb(JAb(new YAb(null,new Kub(this.c.a.b,16)),new zfc),new Bfc(b));nEb(this,new Ffc);Hkb(b,new Jfc);b.c=KC(SI,Uhe,1,0,5,1);c=Ntb($zb(OAb(new YAb(null,new Kub(this.c.a.b,16)),new Lfc(this))),new Nfc);MAb(new YAb(null,new Kub(this.c.a.a,16)),new Rfc(c,b));nEb(this,new Vfc);Hkb(b,new Zfc);b.c=KC(SI,Uhe,1,0,5,1);break;case 3:d=new Rkb;nEb(this,new lfc);e=Ntb($zb(OAb(new YAb(null,new Kub(this.c.a.b,16)),new pfc(this))),new Pfc);MAb(JAb(new YAb(null,new Kub(this.c.a.b,16)),new _fc),new bgc(e,d));nEb(this,new fgc);Hkb(d,new jgc);d.c=KC(SI,Uhe,1,0,5,1);break;default:throw vbb(new x2c);}};_.b=0;var AU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation',1693);bcb(1694,1,Vke,lfc);_.Lb=function mfc(a){return JD(BD(a,57).g,145)};_.Fb=function nfc(a){return this===a};_.Mb=function ofc(a){return JD(BD(a,57).g,145)};var cU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$0$Type',1694);bcb(1695,1,{},pfc);_.Fe=function qfc(a){return dfc(this.a,BD(a,57))};var dU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$1$Type',1695);bcb(1703,1,Pie,rfc);_.Vd=function sfc(){cfc(this.a,this.b,-1)};_.b=0;var eU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$10$Type',1703);bcb(1705,1,Vke,tfc);_.Lb=function ufc(a){return JD(BD(a,57).g,145)};_.Fb=function vfc(a){return this===a};_.Mb=function wfc(a){return JD(BD(a,57).g,145)};var fU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$11$Type',1705);bcb(1706,1,qie,xfc);_.td=function yfc(a){BD(a,365).Vd()};var gU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$12$Type',1706);bcb(1707,1,Oie,zfc);_.Mb=function Afc(a){return JD(BD(a,57).g,10)};var hU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$13$Type',1707);bcb(1709,1,qie,Bfc);_.td=function Cfc(a){efc(this.a,BD(a,57))};var iU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$14$Type',1709);bcb(1708,1,Pie,Dfc);_.Vd=function Efc(){cfc(this.b,this.a,-1)};_.a=0;var jU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$15$Type',1708);bcb(1710,1,Vke,Ffc);_.Lb=function Gfc(a){return JD(BD(a,57).g,10)};_.Fb=function Hfc(a){return this===a};_.Mb=function Ifc(a){return JD(BD(a,57).g,10)};var kU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$16$Type',1710);bcb(1711,1,qie,Jfc);_.td=function Kfc(a){BD(a,365).Vd()};var lU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$17$Type',1711);bcb(1712,1,{},Lfc);_.Fe=function Mfc(a){return ffc(this.a,BD(a,57))};var mU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$18$Type',1712);bcb(1713,1,{},Nfc);_.De=function Ofc(){return 0};var nU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$19$Type',1713);bcb(1696,1,{},Pfc);_.De=function Qfc(){return 0};var oU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$2$Type',1696);bcb(1715,1,qie,Rfc);_.td=function Sfc(a){gfc(this.a,this.b,BD(a,307))};_.a=0;var pU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$20$Type',1715);bcb(1714,1,Pie,Tfc);_.Vd=function Ufc(){bfc(this.a,this.b,-1)};_.b=0;var qU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$21$Type',1714);bcb(1716,1,Vke,Vfc);_.Lb=function Wfc(a){return BD(a,57),true};_.Fb=function Xfc(a){return this===a};_.Mb=function Yfc(a){return BD(a,57),true};var rU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$22$Type',1716);bcb(1717,1,qie,Zfc);_.td=function $fc(a){BD(a,365).Vd()};var sU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$23$Type',1717);bcb(1697,1,Oie,_fc);_.Mb=function agc(a){return JD(BD(a,57).g,10)};var tU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$3$Type',1697);bcb(1699,1,qie,bgc);_.td=function cgc(a){hfc(this.a,this.b,BD(a,57))};_.a=0;var uU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$4$Type',1699);bcb(1698,1,Pie,dgc);_.Vd=function egc(){cfc(this.b,this.a,-1)};_.a=0;var vU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$5$Type',1698);bcb(1700,1,Vke,fgc);_.Lb=function ggc(a){return BD(a,57),true};_.Fb=function hgc(a){return this===a};_.Mb=function igc(a){return BD(a,57),true};var wU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$6$Type',1700);bcb(1701,1,qie,jgc);_.td=function kgc(a){BD(a,365).Vd()};var xU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$7$Type',1701);bcb(1702,1,Oie,lgc);_.Mb=function mgc(a){return JD(BD(a,57).g,145)};var yU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$8$Type',1702);bcb(1704,1,qie,ngc);_.td=function ogc(a){ifc(this.a,this.b,BD(a,57))};var zU=mdb(Jne,'EdgeAwareScanlineConstraintCalculation/lambda$9$Type',1704);bcb(1521,1,ene,sgc);_.pf=function xgc(a,b){rgc(this,BD(a,37),b)};var pgc;var EU=mdb(Jne,'HorizontalGraphCompactor',1521);bcb(1522,1,{},ygc);_.Oe=function zgc(a,b){var c,d,e;if(vgc(a,b)){return 0}c=tgc(a);d=tgc(b);if(!!c&&c.k==(j0b(),e0b)||!!d&&d.k==(j0b(),e0b)){return 0}e=BD(vNb(this.a.a,(wtc(),otc)),304);return fBc(e,c?c.k:(j0b(),g0b),d?d.k:(j0b(),g0b))};_.Pe=function Agc(a,b){var c,d,e;if(vgc(a,b)){return 1}c=tgc(a);d=tgc(b);e=BD(vNb(this.a.a,(wtc(),otc)),304);return iBc(e,c?c.k:(j0b(),g0b),d?d.k:(j0b(),g0b))};var BU=mdb(Jne,'HorizontalGraphCompactor/1',1522);bcb(1523,1,{},Bgc);_.Ne=function Cgc(a,b){return qgc(),a.a.i==0};var CU=mdb(Jne,'HorizontalGraphCompactor/lambda$0$Type',1523);bcb(1524,1,{},Dgc);_.Ne=function Egc(a,b){return wgc(this.a,a,b)};var DU=mdb(Jne,'HorizontalGraphCompactor/lambda$1$Type',1524);bcb(1664,1,{},Ygc);var Fgc,Ggc;var cV=mdb(Jne,'LGraphToCGraphTransformer',1664);bcb(1672,1,Oie,ehc);_.Mb=function fhc(a){return a!=null};var FU=mdb(Jne,'LGraphToCGraphTransformer/0methodref$nonNull$Type',1672);bcb(1665,1,{},ghc);_.Kb=function hhc(a){return Hgc(),fcb(vNb(BD(BD(a,57).g,10),(wtc(),$sc)))};var GU=mdb(Jne,'LGraphToCGraphTransformer/lambda$0$Type',1665);bcb(1666,1,{},ihc);_.Kb=function jhc(a){return Hgc(),gic(BD(BD(a,57).g,145))};var HU=mdb(Jne,'LGraphToCGraphTransformer/lambda$1$Type',1666);bcb(1675,1,Oie,khc);_.Mb=function lhc(a){return Hgc(),JD(BD(a,57).g,10)};var IU=mdb(Jne,'LGraphToCGraphTransformer/lambda$10$Type',1675);bcb(1676,1,qie,mhc);_.td=function nhc(a){Zgc(BD(a,57))};var JU=mdb(Jne,'LGraphToCGraphTransformer/lambda$11$Type',1676);bcb(1677,1,Oie,ohc);_.Mb=function phc(a){return Hgc(),JD(BD(a,57).g,145)};var KU=mdb(Jne,'LGraphToCGraphTransformer/lambda$12$Type',1677);bcb(1681,1,qie,qhc);_.td=function rhc(a){$gc(BD(a,57))};var LU=mdb(Jne,'LGraphToCGraphTransformer/lambda$13$Type',1681);bcb(1678,1,qie,shc);_.td=function thc(a){_gc(this.a,BD(a,8))};_.a=0;var MU=mdb(Jne,'LGraphToCGraphTransformer/lambda$14$Type',1678);bcb(1679,1,qie,uhc);_.td=function vhc(a){ahc(this.a,BD(a,110))};_.a=0;var NU=mdb(Jne,'LGraphToCGraphTransformer/lambda$15$Type',1679);bcb(1680,1,qie,whc);_.td=function xhc(a){bhc(this.a,BD(a,8))};_.a=0;var OU=mdb(Jne,'LGraphToCGraphTransformer/lambda$16$Type',1680);bcb(1682,1,{},yhc);_.Kb=function zhc(a){return Hgc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var PU=mdb(Jne,'LGraphToCGraphTransformer/lambda$17$Type',1682);bcb(1683,1,Oie,Ahc);_.Mb=function Bhc(a){return Hgc(),OZb(BD(a,17))};var QU=mdb(Jne,'LGraphToCGraphTransformer/lambda$18$Type',1683);bcb(1684,1,qie,Chc);_.td=function Dhc(a){Qgc(this.a,BD(a,17))};var RU=mdb(Jne,'LGraphToCGraphTransformer/lambda$19$Type',1684);bcb(1668,1,qie,Ehc);_.td=function Fhc(a){Rgc(this.a,BD(a,145))};var SU=mdb(Jne,'LGraphToCGraphTransformer/lambda$2$Type',1668);bcb(1685,1,{},Ghc);_.Kb=function Hhc(a){return Hgc(),new YAb(null,new Kub(BD(a,29).a,16))};var TU=mdb(Jne,'LGraphToCGraphTransformer/lambda$20$Type',1685);bcb(1686,1,{},Ihc);_.Kb=function Jhc(a){return Hgc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var UU=mdb(Jne,'LGraphToCGraphTransformer/lambda$21$Type',1686);bcb(1687,1,{},Khc);_.Kb=function Lhc(a){return Hgc(),BD(vNb(BD(a,17),(wtc(),rtc)),15)};var VU=mdb(Jne,'LGraphToCGraphTransformer/lambda$22$Type',1687);bcb(1688,1,Oie,Mhc);_.Mb=function Nhc(a){return chc(BD(a,15))};var WU=mdb(Jne,'LGraphToCGraphTransformer/lambda$23$Type',1688);bcb(1689,1,qie,Ohc);_.td=function Phc(a){Jgc(this.a,BD(a,15))};var XU=mdb(Jne,'LGraphToCGraphTransformer/lambda$24$Type',1689);bcb(1667,1,qie,Qhc);_.td=function Rhc(a){Sgc(this.a,this.b,BD(a,145))};var YU=mdb(Jne,'LGraphToCGraphTransformer/lambda$3$Type',1667);bcb(1669,1,{},Shc);_.Kb=function Thc(a){return Hgc(),new YAb(null,new Kub(BD(a,29).a,16))};var ZU=mdb(Jne,'LGraphToCGraphTransformer/lambda$4$Type',1669);bcb(1670,1,{},Uhc);_.Kb=function Vhc(a){return Hgc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var $U=mdb(Jne,'LGraphToCGraphTransformer/lambda$5$Type',1670);bcb(1671,1,{},Whc);_.Kb=function Xhc(a){return Hgc(),BD(vNb(BD(a,17),(wtc(),rtc)),15)};var _U=mdb(Jne,'LGraphToCGraphTransformer/lambda$6$Type',1671);bcb(1673,1,qie,Yhc);_.td=function Zhc(a){dhc(this.a,BD(a,15))};var aV=mdb(Jne,'LGraphToCGraphTransformer/lambda$8$Type',1673);bcb(1674,1,qie,$hc);_.td=function _hc(a){Tgc(this.a,this.b,BD(a,145))};var bV=mdb(Jne,'LGraphToCGraphTransformer/lambda$9$Type',1674);bcb(1663,1,{},dic);_.Le=function eic(a){var b,c,d,e,f;this.a=a;this.d=new KFb;this.c=KC(jN,Uhe,121,this.a.a.a.c.length,0,1);this.b=0;for(c=new olb(this.a.a.a);c.a=p){Ekb(f,meb(k));s=$wnd.Math.max(s,t[k-1]-l);h+=o;q+=t[k-1]-q;l=t[k-1];o=i[k]}o=$wnd.Math.max(o,i[k]);++k}h+=o}n=$wnd.Math.min(1/s,1/b.b/h);if(n>d){d=n;c=f}}return c};_.Wf=function mpc(){return false};var CW=mdb(Rne,'MSDCutIndexHeuristic',802);bcb(1617,1,ene,ppc);_.pf=function qpc(a,b){opc(BD(a,37),b)};var DW=mdb(Rne,'SingleEdgeGraphWrapper',1617);bcb(227,22,{3:1,35:1,22:1,227:1},Bpc);var upc,vpc,wpc,xpc,ypc,zpc;var EW=ndb(Sne,'CenterEdgeLabelPlacementStrategy',227,CI,Dpc,Cpc);var Epc;bcb(422,22,{3:1,35:1,22:1,422:1},Jpc);var Gpc,Hpc;var FW=ndb(Sne,'ConstraintCalculationStrategy',422,CI,Lpc,Kpc);var Mpc;bcb(314,22,{3:1,35:1,22:1,314:1,246:1,234:1},Tpc);_.Kf=function Vpc(){return Spc(this)};_.Xf=function Upc(){return Spc(this)};var Opc,Ppc,Qpc;var GW=ndb(Sne,'CrossingMinimizationStrategy',314,CI,Xpc,Wpc);var Ypc;bcb(337,22,{3:1,35:1,22:1,337:1},cqc);var $pc,_pc,aqc;var HW=ndb(Sne,'CuttingStrategy',337,CI,eqc,dqc);var fqc;bcb(335,22,{3:1,35:1,22:1,335:1,246:1,234:1},oqc);_.Kf=function qqc(){return nqc(this)};_.Xf=function pqc(){return nqc(this)};var hqc,iqc,jqc,kqc,lqc;var IW=ndb(Sne,'CycleBreakingStrategy',335,CI,sqc,rqc);var tqc;bcb(419,22,{3:1,35:1,22:1,419:1},yqc);var vqc,wqc;var JW=ndb(Sne,'DirectionCongruency',419,CI,Aqc,zqc);var Bqc;bcb(450,22,{3:1,35:1,22:1,450:1},Hqc);var Dqc,Eqc,Fqc;var KW=ndb(Sne,'EdgeConstraint',450,CI,Jqc,Iqc);var Kqc;bcb(276,22,{3:1,35:1,22:1,276:1},Uqc);var Mqc,Nqc,Oqc,Pqc,Qqc,Rqc;var LW=ndb(Sne,'EdgeLabelSideSelection',276,CI,Wqc,Vqc);var Xqc;bcb(479,22,{3:1,35:1,22:1,479:1},arc);var Zqc,$qc;var MW=ndb(Sne,'EdgeStraighteningStrategy',479,CI,crc,brc);var drc;bcb(274,22,{3:1,35:1,22:1,274:1},mrc);var frc,grc,hrc,irc,jrc,krc;var NW=ndb(Sne,'FixedAlignment',274,CI,orc,nrc);var prc;bcb(275,22,{3:1,35:1,22:1,275:1},zrc);var rrc,trc,urc,vrc,wrc,xrc;var OW=ndb(Sne,'GraphCompactionStrategy',275,CI,Brc,Arc);var Crc;bcb(256,22,{3:1,35:1,22:1,256:1},Prc);var Erc,Frc,Grc,Hrc,Irc,Jrc,Krc,Lrc,Mrc,Nrc;var PW=ndb(Sne,'GraphProperties',256,CI,Rrc,Qrc);var Src;bcb(292,22,{3:1,35:1,22:1,292:1},Yrc);var Urc,Vrc,Wrc;var QW=ndb(Sne,'GreedySwitchType',292,CI,$rc,Zrc);var _rc;bcb(303,22,{3:1,35:1,22:1,303:1},fsc);var bsc,csc,dsc;var RW=ndb(Sne,'InLayerConstraint',303,CI,hsc,gsc);var isc;bcb(420,22,{3:1,35:1,22:1,420:1},nsc);var ksc,lsc;var SW=ndb(Sne,'InteractiveReferencePoint',420,CI,psc,osc);var qsc;var ssc,tsc,usc,vsc,wsc,xsc,ysc,zsc,Asc,Bsc,Csc,Dsc,Esc,Fsc,Gsc,Hsc,Isc,Jsc,Ksc,Lsc,Msc,Nsc,Osc,Psc,Qsc,Rsc,Ssc,Tsc,Usc,Vsc,Wsc,Xsc,Ysc,Zsc,$sc,_sc,atc,btc,ctc,dtc,etc,ftc,gtc,htc,itc,jtc,ktc,ltc,mtc,ntc,otc,ptc,qtc,rtc,stc,ttc,utc,vtc;bcb(163,22,{3:1,35:1,22:1,163:1},Dtc);var xtc,ytc,ztc,Atc,Btc;var TW=ndb(Sne,'LayerConstraint',163,CI,Ftc,Etc);var Gtc;bcb(848,1,ale,kwc);_.Qe=function lwc(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Yne),''),'Direction Congruency'),'Specifies how drawings of the same graph with different layout directions compare to each other: either a natural reading direction is preserved or the drawings are rotated versions of each other.'),puc),(_5c(),V5c)),JW),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zne),''),'Feedback Edges'),'Whether feedback edges should be highlighted by routing around the nodes.'),(Bcb(),false)),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$ne),''),'Interactive Reference Point'),'Determines which point of a node is considered by interactive layout phases.'),Muc),V5c),SW),pqb(L5c))));o4c(a,$ne,goe,Ouc);o4c(a,$ne,qoe,Nuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,_ne),''),'Merge Edges'),'Edges that have no ports are merged so they touch the connected nodes at the same points. When this option is disabled, one port is created for each edge directly connected to a node. When it is enabled, all such incoming edges share an input port, and all outgoing edges share an output port.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,aoe),''),'Merge Hierarchy-Crossing Edges'),'If hierarchical layout is active, hierarchy-crossing edges use as few hierarchical ports as possible. They are broken by the algorithm, with hierarchical ports inserted as required. Usually, one such port is created for each edge at each hierarchy crossing point. With this option set to true, we try to create as few hierarchical ports as possible in the process. In particular, all edges that form a hyperedge can share a port.'),true),T5c),wI),pqb(L5c))));t4c(a,new p5c(C5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,boe),''),'Allow Non-Flow Ports To Switch Sides'),"Specifies whether non-flow ports may switch sides if their node's port constraints are either FIXED_SIDE or FIXED_ORDER. A non-flow port is a port on a side that is not part of the currently configured layout flow. For instance, given a left-to-right layout direction, north and south ports would be considered non-flow ports. Further note that the underlying criterium whether to switch sides or not solely relies on the minimization of edge crossings. Hence, edge length and other aesthetics criteria are not addressed."),false),T5c),wI),pqb(M5c)),OC(GC(ZI,1),nie,2,6,['org.eclipse.elk.layered.northOrSouthPort']))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,coe),''),'Port Sorting Strategy'),"Only relevant for nodes with FIXED_SIDE port constraints. Determines the way a node's ports are distributed on the sides of a node if their order is not prescribed. The option is set on parent nodes."),xvc),V5c),cX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,doe),''),'Thoroughness'),'How much effort should be spent to produce a nice layout.'),meb(7)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,eoe),''),'Add Unnecessary Bendpoints'),'Adds bend points even if an edge does not change direction. If true, each long edge dummy will contribute a bend point to its edges and hierarchy-crossing edges will always get a bend point where they cross hierarchy boundaries. By default, bend points are only added where an edge changes direction.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,foe),''),'Generate Position and Layer IDs'),'If enabled position id and layer id are generated, which are usually only used internally when setting the interactiveLayout option. This option should be specified on the root node.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,goe),'cycleBreaking'),'Cycle Breaking Strategy'),'Strategy for cycle breaking. Cycle breaking looks for cycles in the graph and determines which edges to reverse to break the cycles. Reversed edges will end up pointing to the opposite direction of regular edges (that is, reversed edges will point left if edges usually point right).'),nuc),V5c),IW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,hoe),ppe),'Node Layering Strategy'),'Strategy for node layering.'),bvc),V5c),YW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ioe),ppe),'Layer Constraint'),'Determines a constraint on the placement of the node regarding the layering.'),Tuc),V5c),TW),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,joe),ppe),'Layer Choice Constraint'),"Allows to set a constraint regarding the layer placement of a node. Let i be the value of teh constraint. Assumed the drawing has n layers and i < n. If set to i, it expresses that the node should be placed in i-th layer. Should i>=n be true then the node is placed in the last layer of the drawing. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,koe),ppe),'Layer ID'),'Layer identifier that was calculated by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set.'),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,loe),qpe),'Upper Bound On Width [MinWidth Layerer]'),"Defines a loose upper bound on the width of the MinWidth layerer. If set to '-1' multiple values are tested and the best result is selected."),meb(4)),X5c),JI),pqb(L5c))));o4c(a,loe,hoe,Wuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,moe),qpe),'Upper Layer Estimation Scaling Factor [MinWidth Layerer]'),"Multiplied with Upper Bound On Width for defining an upper bound on the width of layers which haven't been determined yet, but whose maximum width had been (roughly) estimated by the MinWidth algorithm. Compensates for too high estimations. If set to '-1' multiple values are tested and the best result is selected."),meb(2)),X5c),JI),pqb(L5c))));o4c(a,moe,hoe,Yuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,noe),rpe),'Node Promotion Strategy'),'Reduces number of dummy nodes after layering phase (if possible).'),_uc),V5c),aX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ooe),rpe),'Max Node Promotion Iterations'),'Limits the number of iterations for node promotion.'),meb(0)),X5c),JI),pqb(L5c))));o4c(a,ooe,noe,null);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,poe),'layering.coffmanGraham'),'Layer Bound'),'The maximum number of nodes allowed per layer.'),meb(Ohe)),X5c),JI),pqb(L5c))));o4c(a,poe,hoe,Quc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,qoe),spe),'Crossing Minimization Strategy'),'Strategy for crossing minimization.'),luc),V5c),GW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,roe),spe),'Force Node Model Order'),'The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,soe),spe),'Hierarchical Sweepiness'),'How likely it is to use cross-hierarchy (1) vs bottom-up (-1).'),0.1),U5c),BI),pqb(L5c))));o4c(a,soe,tpe,fuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,toe),spe),'Semi-Interactive Crossing Minimization'),"Preserves the order of nodes within a layer but still minimizes crossings between edges connecting long edge dummies. Derives the desired order from positions specified by the 'org.eclipse.elk.position' layout option. Requires a crossing minimization strategy that is able to process 'in-layer' constraints."),false),T5c),wI),pqb(L5c))));o4c(a,toe,qoe,juc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,uoe),spe),'Position Choice Constraint'),"Allows to set a constraint regarding the position placement of a node in a layer. Assumed the layer in which the node placed includes n other nodes and i < n. If set to i, it expresses that the node should be placed at the i-th position. Should i>=n be true then the node is placed at the last position in the layer. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,voe),spe),'Position ID'),'Position within a layer that was determined by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set.'),meb(-1)),X5c),JI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,woe),upe),'Greedy Switch Activation Threshold'),"By default it is decided automatically if the greedy switch is activated or not. The decision is based on whether the size of the input graph (without dummy nodes) is smaller than the value of this option. A '0' enforces the activation."),meb(40)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xoe),upe),'Greedy Switch Crossing Minimization'),"Greedy Switch strategy for crossing minimization. The greedy switch heuristic is executed after the regular crossing minimization as a post-processor. Note that if 'hierarchyHandling' is set to 'INCLUDE_CHILDREN', the 'greedySwitchHierarchical.type' option must be used."),cuc),V5c),QW),pqb(L5c))));o4c(a,xoe,qoe,duc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,yoe),'crossingMinimization.greedySwitchHierarchical'),'Greedy Switch Crossing Minimization (hierarchical)'),"Activates the greedy switch heuristic in case hierarchical layout is used. The differences to the non-hierarchical case (see 'greedySwitch.type') are: 1) greedy switch is inactive by default, 3) only the option value set on the node at which hierarchical layout starts is relevant, and 2) if it's activated by the user, it properly addresses hierarchy-crossing edges."),$tc),V5c),QW),pqb(L5c))));o4c(a,yoe,qoe,_tc);o4c(a,yoe,tpe,auc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,zoe),vpe),'Node Placement Strategy'),'Strategy for node placement.'),vvc),V5c),_W),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Aoe),vpe),'Favor Straight Edges Over Balancing'),"Favor straight edges over a balanced node placement. The default behavior is determined automatically based on the used 'edgeRouting'. For an orthogonal style it is set to true, for all other styles to false."),T5c),wI),pqb(L5c))));o4c(a,Aoe,zoe,lvc);o4c(a,Aoe,zoe,mvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Boe),wpe),'BK Edge Straightening'),"Specifies whether the Brandes Koepf node placer tries to increase the number of straight edges at the expense of diagram size. There is a subtle difference to the 'favorStraightEdges' option, which decides whether a balanced placement of the nodes is desired, or not. In bk terms this means combining the four alignments into a single balanced one, or not. This option on the other hand tries to straighten additional edges during the creation of each of the four alignments."),fvc),V5c),MW),pqb(L5c))));o4c(a,Boe,zoe,gvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Coe),wpe),'BK Fixed Alignment'),'Tells the BK node placer to use a certain alignment (out of its four) instead of the one producing the smallest height, or the combination of all four.'),ivc),V5c),NW),pqb(L5c))));o4c(a,Coe,zoe,jvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Doe),'nodePlacement.linearSegments'),'Linear Segments Deflection Dampening'),'Dampens the movement of nodes to keep the diagram from getting too large.'),0.3),U5c),BI),pqb(L5c))));o4c(a,Doe,zoe,ovc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Eoe),'nodePlacement.networkSimplex'),'Node Flexibility'),"Aims at shorter and straighter edges. Two configurations are possible: (a) allow ports to move freely on the side they are assigned to (the order is always defined beforehand), (b) additionally allow to enlarge a node wherever it helps. If this option is not configured for a node, the 'nodeFlexibility.default' value is used, which is specified for the node's parent."),V5c),$W),pqb(K5c))));o4c(a,Eoe,zoe,tvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Foe),'nodePlacement.networkSimplex.nodeFlexibility'),'Node Flexibility Default'),"Default value of the 'nodeFlexibility' option for the children of a hierarchical node."),rvc),V5c),$W),pqb(L5c))));o4c(a,Foe,zoe,svc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Goe),xpe),'Self-Loop Distribution'),'Alter the distribution of the loops around the node. It only takes effect for PortConstraints.FREE.'),xuc),V5c),eX),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Hoe),xpe),'Self-Loop Ordering'),'Alter the ordering of the loops they can either be stacked or sequenced. It only takes effect for PortConstraints.FREE.'),zuc),V5c),fX),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ioe),'edgeRouting.splines'),'Spline Routing Mode'),'Specifies the way control points are assembled for each individual edge. CONSERVATIVE ensures that edges are properly routed around the nodes but feels rather orthogonal at times. SLOPPY uses fewer control points to obtain curvier edge routes but may result in edges overlapping nodes.'),Buc),V5c),hX),pqb(L5c))));o4c(a,Ioe,ype,Cuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Joe),'edgeRouting.splines.sloppy'),'Sloppy Spline Layer Spacing Factor'),'Spacing factor for routing area between layers when using sloppy spline routing.'),0.2),U5c),BI),pqb(L5c))));o4c(a,Joe,ype,Euc);o4c(a,Joe,Ioe,Fuc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Koe),'edgeRouting.polyline'),'Sloped Edge Zone Width'),'Width of the strip to the left and to the right of each layer where the polyline edge router is allowed to refrain from ensuring that edges are routed horizontally. This prevents awkward bend points for nodes that extent almost to the edge of their layer.'),2),U5c),BI),pqb(L5c))));o4c(a,Koe,ype,vuc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Loe),zpe),'Spacing Base Value'),"An optional base value for all other layout options of the 'spacing' group. It can be used to conveniently alter the overall 'spaciousness' of the drawing. Whenever an explicit value is set for the other layout options, this base value will have no effect. The base value is not inherited, i.e. it must be set for each hierarchical node."),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Moe),zpe),'Edge Node Between Layers Spacing'),"The spacing to be preserved between nodes and edges that are routed next to the node's layer. For the spacing between nodes and edges that cross the node's layer 'spacing.edgeNode' is used."),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Noe),zpe),'Edge Edge Between Layer Spacing'),"Spacing to be preserved between pairs of edges that are routed between the same pair of layers. Note that 'spacing.edgeEdge' is used for the spacing between pairs of edges crossing the same layer."),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ooe),zpe),'Node Node Between Layers Spacing'),"The spacing to be preserved between any pair of nodes of two adjacent layers. Note that 'spacing.nodeNode' is used for the spacing between nodes within the layer itself."),20),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Poe),Ape),'Direction Priority'),'Defines how important it is to have a certain edge point into the direction of the overall layout. This option is evaluated during the cycle breaking phase.'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Qoe),Ape),'Shortness Priority'),'Defines how important it is to keep an edge as short as possible. This option is evaluated during the layering phase.'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Roe),Ape),'Straightness Priority'),'Defines how important it is to keep an edge straight, i.e. aligned with one of the two axes. This option is evaluated during node placement.'),meb(0)),X5c),JI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Soe),Bpe),Ole),'Tries to further compact components (disconnected sub-graphs).'),false),T5c),wI),pqb(L5c))));o4c(a,Soe,zme,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Toe),Cpe),'Post Compaction Strategy'),Dpe),Ntc),V5c),OW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Uoe),Cpe),'Post Compaction Constraint Calculation'),Dpe),Ltc),V5c),FW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Voe),Epe),'High Degree Node Treatment'),'Makes room around high degree nodes to place leafs and trees.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Woe),Epe),'High Degree Node Threshold'),'Whether a node is considered to have a high degree.'),meb(16)),X5c),JI),pqb(L5c))));o4c(a,Woe,Voe,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Xoe),Epe),'High Degree Node Maximum Tree Height'),'Maximum height of a subtree connected to a high degree node to be moved to separate layers.'),meb(5)),X5c),JI),pqb(L5c))));o4c(a,Xoe,Voe,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Yoe),Fpe),'Graph Wrapping Strategy'),"For certain graphs and certain prescribed drawing areas it may be desirable to split the laid out graph into chunks that are placed side by side. The edges that connect different chunks are 'wrapped' around from the end of one chunk to the start of the other chunk. The points between the chunks are referred to as 'cuts'."),bwc),V5c),jX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zoe),Fpe),'Additional Wrapped Edges Spacing'),'To visually separate edges that are wrapped from regularly routed edges an additional spacing value can be specified in form of this layout option. The spacing is added to the regular edgeNode spacing.'),10),U5c),BI),pqb(L5c))));o4c(a,Zoe,Yoe,Ivc);o4c(a,Zoe,Yoe,Jvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$oe),Fpe),'Correction Factor for Wrapping'),"At times and for certain types of graphs the executed wrapping may produce results that are consistently biased in the same fashion: either wrapping to often or to rarely. This factor can be used to correct the bias. Internally, it is simply multiplied with the 'aspect ratio' layout option."),1),U5c),BI),pqb(L5c))));o4c(a,$oe,Yoe,Lvc);o4c(a,$oe,Yoe,Mvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,_oe),Gpe),'Cutting Strategy'),'The strategy by which the layer indexes are determined at which the layering crumbles into chunks.'),Tvc),V5c),HW),pqb(L5c))));o4c(a,_oe,Yoe,Uvc);o4c(a,_oe,Yoe,Vvc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,ape),Gpe),'Manually Specified Cuts'),'Allows the user to specify her own cuts for a certain graph.'),Y5c),yK),pqb(L5c))));o4c(a,ape,_oe,Ovc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,bpe),'wrapping.cutting.msd'),'MSD Freedom'),'The MSD cutting strategy starts with an initial guess on the number of chunks the graph should be split into. The freedom specifies how much the strategy may deviate from this guess. E.g. if an initial number of 3 is computed, a freedom of 1 allows 2, 3, and 4 cuts.'),Qvc),X5c),JI),pqb(L5c))));o4c(a,bpe,_oe,Rvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,cpe),Hpe),'Validification Strategy'),'When wrapping graphs, one can specify indices that are not allowed as split points. The validification strategy makes sure every computed split point is allowed.'),gwc),V5c),iX),pqb(L5c))));o4c(a,cpe,Yoe,hwc);o4c(a,cpe,Yoe,iwc);t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,dpe),Hpe),'Valid Indices for Wrapping'),null),Y5c),yK),pqb(L5c))));o4c(a,dpe,Yoe,dwc);o4c(a,dpe,Yoe,ewc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,epe),Ipe),'Improve Cuts'),'For general graphs it is important that not too many edges wrap backwards. Thus a compromise between evenly-distributed cuts and the total number of cut edges is sought.'),true),T5c),wI),pqb(L5c))));o4c(a,epe,Yoe,Zvc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,fpe),Ipe),'Distance Penalty When Improving Cuts'),null),2),U5c),BI),pqb(L5c))));o4c(a,fpe,Yoe,Xvc);o4c(a,fpe,epe,true);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,gpe),Ipe),'Improve Wrapped Edges'),'The initial wrapping is performed in a very simple way. As a consequence, edges that wrap from one chunk to another may be unnecessarily long. Activating this option tries to shorten such edges.'),true),T5c),wI),pqb(L5c))));o4c(a,gpe,Yoe,_vc);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,hpe),Jpe),'Edge Label Side Selection'),'Method to decide on edge label sides.'),tuc),V5c),LW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ipe),Jpe),'Edge Center Label Placement Strategy'),'Determines in which layer center labels of long edges should be placed.'),ruc),V5c),EW),qqb(L5c,OC(GC(e1,1),Kie,175,0,[J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,jpe),Kpe),'Consider Model Order'),'Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting.'),Wtc),V5c),bX),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,kpe),Kpe),'No Model Order'),'Set on a node to not set a model order for this node even though it is a real node.'),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,lpe),Kpe),'Consider Model Order for Components'),'If set to NONE the usual ordering strategy (by cumulative node priority and size of nodes) is used. INSIDE_PORT_SIDES orders the components with external ports only inside the groups with the same port side. FORCE_MODEL_ORDER enforces the mode order on components. This option might produce bad alignments and sub optimal drawings in terms of used area since the ordering should be respected.'),Ptc),V5c),hQ),pqb(L5c))));o4c(a,lpe,zme,null);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,mpe),Kpe),'Long Edge Ordering Strategy'),'Indicates whether long edges are sorted under, over, or equal to nodes that have no connection to a previous layer in a left-to-right or right-to-left layout. Under and over changes to right and left in a vertical layout.'),Ttc),V5c),ZW),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,npe),Kpe),'Crossing Counter Node Order Influence'),'Indicates with what percentage (1 for 100%) violations of the node model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal node order. Defaults to no influence (0).'),0),U5c),BI),pqb(L5c))));o4c(a,npe,jpe,null);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ope),Kpe),'Crossing Counter Port Order Influence'),'Indicates with what percentage (1 for 100%) violations of the port model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal port order. Defaults to no influence (0).'),0),U5c),BI),pqb(L5c))));o4c(a,ope,jpe,null);Oyc((new Pyc,a))};var Itc,Jtc,Ktc,Ltc,Mtc,Ntc,Otc,Ptc,Qtc,Rtc,Stc,Ttc,Utc,Vtc,Wtc,Xtc,Ytc,Ztc,$tc,_tc,auc,buc,cuc,duc,euc,fuc,guc,huc,iuc,juc,kuc,luc,muc,nuc,ouc,puc,quc,ruc,suc,tuc,uuc,vuc,wuc,xuc,yuc,zuc,Auc,Buc,Cuc,Duc,Euc,Fuc,Guc,Huc,Iuc,Juc,Kuc,Luc,Muc,Nuc,Ouc,Puc,Quc,Ruc,Suc,Tuc,Uuc,Vuc,Wuc,Xuc,Yuc,Zuc,$uc,_uc,avc,bvc,cvc,dvc,evc,fvc,gvc,hvc,ivc,jvc,kvc,lvc,mvc,nvc,ovc,pvc,qvc,rvc,svc,tvc,uvc,vvc,wvc,xvc,yvc,zvc,Avc,Bvc,Cvc,Dvc,Evc,Fvc,Gvc,Hvc,Ivc,Jvc,Kvc,Lvc,Mvc,Nvc,Ovc,Pvc,Qvc,Rvc,Svc,Tvc,Uvc,Vvc,Wvc,Xvc,Yvc,Zvc,$vc,_vc,awc,bwc,cwc,dwc,ewc,fwc,gwc,hwc,iwc;var UW=mdb(Sne,'LayeredMetaDataProvider',848);bcb(986,1,ale,Pyc);_.Qe=function Qyc(a){Oyc(a)};var mwc,nwc,owc,pwc,qwc,rwc,swc,twc,uwc,vwc,wwc,xwc,ywc,zwc,Awc,Bwc,Cwc,Dwc,Ewc,Fwc,Gwc,Hwc,Iwc,Jwc,Kwc,Lwc,Mwc,Nwc,Owc,Pwc,Qwc,Rwc,Swc,Twc,Uwc,Vwc,Wwc,Xwc,Ywc,Zwc,$wc,_wc,axc,bxc,cxc,dxc,exc,fxc,gxc,hxc,ixc,jxc,kxc,lxc,mxc,nxc,oxc,pxc,qxc,rxc,sxc,txc,uxc,vxc,wxc,xxc,yxc,zxc,Axc,Bxc,Cxc,Dxc,Exc,Fxc,Gxc,Hxc,Ixc,Jxc,Kxc,Lxc,Mxc,Nxc,Oxc,Pxc,Qxc,Rxc,Sxc,Txc,Uxc,Vxc,Wxc,Xxc,Yxc,Zxc,$xc,_xc,ayc,byc,cyc,dyc,eyc,fyc,gyc,hyc,iyc,jyc,kyc,lyc,myc,nyc,oyc,pyc,qyc,ryc,syc,tyc,uyc,vyc,wyc,xyc,yyc,zyc,Ayc,Byc,Cyc,Dyc,Eyc,Fyc,Gyc,Hyc,Iyc,Jyc,Kyc,Lyc,Myc;var WW=mdb(Sne,'LayeredOptions',986);bcb(987,1,{},Ryc);_.$e=function Syc(){var a;return a=new jUb,a};_._e=function Tyc(a){};var VW=mdb(Sne,'LayeredOptions/LayeredFactory',987);bcb(1372,1,{});_.a=0;var Uyc;var $1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder',1372);bcb(779,1372,{},ezc);var bzc,czc;var XW=mdb(Sne,'LayeredSpacings/LayeredSpacingsBuilder',779);bcb(313,22,{3:1,35:1,22:1,313:1,246:1,234:1},nzc);_.Kf=function pzc(){return mzc(this)};_.Xf=function ozc(){return mzc(this)};var fzc,gzc,hzc,izc,jzc,kzc;var YW=ndb(Sne,'LayeringStrategy',313,CI,rzc,qzc);var szc;bcb(378,22,{3:1,35:1,22:1,378:1},zzc);var uzc,vzc,wzc;var ZW=ndb(Sne,'LongEdgeOrderingStrategy',378,CI,Bzc,Azc);var Czc;bcb(197,22,{3:1,35:1,22:1,197:1},Kzc);var Ezc,Fzc,Gzc,Hzc;var $W=ndb(Sne,'NodeFlexibility',197,CI,Nzc,Mzc);var Ozc;bcb(315,22,{3:1,35:1,22:1,315:1,246:1,234:1},Xzc);_.Kf=function Zzc(){return Wzc(this)};_.Xf=function Yzc(){return Wzc(this)};var Qzc,Rzc,Szc,Tzc,Uzc;var _W=ndb(Sne,'NodePlacementStrategy',315,CI,_zc,$zc);var aAc;bcb(260,22,{3:1,35:1,22:1,260:1},lAc);var cAc,dAc,eAc,fAc,gAc,hAc,iAc,jAc;var aX=ndb(Sne,'NodePromotionStrategy',260,CI,nAc,mAc);var oAc;bcb(339,22,{3:1,35:1,22:1,339:1},uAc);var qAc,rAc,sAc;var bX=ndb(Sne,'OrderingStrategy',339,CI,wAc,vAc);var xAc;bcb(421,22,{3:1,35:1,22:1,421:1},CAc);var zAc,AAc;var cX=ndb(Sne,'PortSortingStrategy',421,CI,EAc,DAc);var FAc;bcb(452,22,{3:1,35:1,22:1,452:1},LAc);var HAc,IAc,JAc;var dX=ndb(Sne,'PortType',452,CI,NAc,MAc);var OAc;bcb(375,22,{3:1,35:1,22:1,375:1},UAc);var QAc,RAc,SAc;var eX=ndb(Sne,'SelfLoopDistributionStrategy',375,CI,WAc,VAc);var XAc;bcb(376,22,{3:1,35:1,22:1,376:1},aBc);var ZAc,$Ac;var fX=ndb(Sne,'SelfLoopOrderingStrategy',376,CI,cBc,bBc);var dBc;bcb(304,1,{304:1},oBc);var gX=mdb(Sne,'Spacings',304);bcb(336,22,{3:1,35:1,22:1,336:1},uBc);var qBc,rBc,sBc;var hX=ndb(Sne,'SplineRoutingMode',336,CI,wBc,vBc);var xBc;bcb(338,22,{3:1,35:1,22:1,338:1},DBc);var zBc,ABc,BBc;var iX=ndb(Sne,'ValidifyStrategy',338,CI,FBc,EBc);var GBc;bcb(377,22,{3:1,35:1,22:1,377:1},MBc);var IBc,JBc,KBc;var jX=ndb(Sne,'WrappingStrategy',377,CI,OBc,NBc);var PBc;bcb(1383,1,Bqe,VBc);_.Yf=function WBc(a){return BD(a,37),RBc};_.pf=function XBc(a,b){UBc(this,BD(a,37),b)};var RBc;var kX=mdb(Cqe,'DepthFirstCycleBreaker',1383);bcb(782,1,Bqe,aCc);_.Yf=function cCc(a){return BD(a,37),YBc};_.pf=function dCc(a,b){$Bc(this,BD(a,37),b)};_.Zf=function bCc(a){return BD(Ikb(a,Bub(this.d,a.c.length)),10)};var YBc;var lX=mdb(Cqe,'GreedyCycleBreaker',782);bcb(1386,782,Bqe,eCc);_.Zf=function fCc(a){var b,c,d,e;e=null;b=Ohe;for(d=new olb(a);d.a1){Ccb(DD(vNb(Q_b((tCb(0,a.c.length),BD(a.c[0],10))),(Nyc(),Awc))))?YGc(a,this.d,BD(this,660)):(mmb(),Okb(a,this.d));PEc(this.e,a)}};_.Sf=function DEc(a,b,c,d){var e,f,g,h,i,j,k;if(b!=sEc(c,a.length)){f=a[b-(c?1:-1)];UDc(this.f,f,c?(KAc(),IAc):(KAc(),HAc))}e=a[b][0];k=!d||e.k==(j0b(),e0b);j=Ou(a[b]);this.ag(j,k,false,c);g=0;for(i=new olb(j);i.a');a0?(RHc(this.a,a[b-1],a[b]),undefined):!c&&b1){Ccb(DD(vNb(Q_b((tCb(0,a.c.length),BD(a.c[0],10))),(Nyc(),Awc))))?YGc(a,this.d,this):(mmb(),Okb(a,this.d));Ccb(DD(vNb(Q_b((tCb(0,a.c.length),BD(a.c[0],10))),Awc)))||PEc(this.e,a)}};var YX=mdb(Gqe,'ModelOrderBarycenterHeuristic',660);bcb(1803,1,Dke,$Gc);_.ue=function _Gc(a,b){return VGc(this.a,BD(a,10),BD(b,10))};_.Fb=function aHc(a){return this===a};_.ve=function bHc(){return new tpb(this)};var XX=mdb(Gqe,'ModelOrderBarycenterHeuristic/lambda$0$Type',1803);bcb(1403,1,Bqe,fHc);_.Yf=function gHc(a){var b;return BD(a,37),b=k3c(cHc),e3c(b,(qUb(),nUb),(S8b(),H8b)),b};_.pf=function hHc(a,b){eHc((BD(a,37),b))};var cHc;var ZX=mdb(Gqe,'NoCrossingMinimizer',1403);bcb(796,402,Eqe,iHc);_.$f=function jHc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;l=this.g;switch(c.g){case 1:{e=0;f=0;for(k=new olb(a.j);k.a1&&(e.j==(Ucd(),zcd)?(this.b[a]=true):e.j==Tcd&&a>0&&(this.b[a-1]=true))};_.f=0;var aY=mdb(Lne,'AllCrossingsCounter',1798);bcb(587,1,{},BHc);_.b=0;_.d=0;var bY=mdb(Lne,'BinaryIndexedTree',587);bcb(524,1,{},dIc);var DHc,EHc;var lY=mdb(Lne,'CrossingsCounter',524);bcb(1906,1,Dke,hIc);_.ue=function iIc(a,b){return YHc(this.a,BD(a,11),BD(b,11))};_.Fb=function jIc(a){return this===a};_.ve=function kIc(){return new tpb(this)};var cY=mdb(Lne,'CrossingsCounter/lambda$0$Type',1906);bcb(1907,1,Dke,lIc);_.ue=function mIc(a,b){return ZHc(this.a,BD(a,11),BD(b,11))};_.Fb=function nIc(a){return this===a};_.ve=function oIc(){return new tpb(this)};var dY=mdb(Lne,'CrossingsCounter/lambda$1$Type',1907);bcb(1908,1,Dke,pIc);_.ue=function qIc(a,b){return $Hc(this.a,BD(a,11),BD(b,11))};_.Fb=function rIc(a){return this===a};_.ve=function sIc(){return new tpb(this)};var eY=mdb(Lne,'CrossingsCounter/lambda$2$Type',1908);bcb(1909,1,Dke,tIc);_.ue=function uIc(a,b){return _Hc(this.a,BD(a,11),BD(b,11))};_.Fb=function vIc(a){return this===a};_.ve=function wIc(){return new tpb(this)};var fY=mdb(Lne,'CrossingsCounter/lambda$3$Type',1909);bcb(1910,1,qie,xIc);_.td=function yIc(a){eIc(this.a,BD(a,11))};var gY=mdb(Lne,'CrossingsCounter/lambda$4$Type',1910);bcb(1911,1,Oie,zIc);_.Mb=function AIc(a){return fIc(this.a,BD(a,11))};var hY=mdb(Lne,'CrossingsCounter/lambda$5$Type',1911);bcb(1912,1,qie,CIc);_.td=function DIc(a){BIc(this,a)};var iY=mdb(Lne,'CrossingsCounter/lambda$6$Type',1912);bcb(1913,1,qie,EIc);_.td=function FIc(a){var b;FHc();Wjb(this.b,(b=this.a,BD(a,11),b))};var jY=mdb(Lne,'CrossingsCounter/lambda$7$Type',1913);bcb(826,1,Vke,GIc);_.Lb=function HIc(a){return FHc(),wNb(BD(a,11),(wtc(),gtc))};_.Fb=function IIc(a){return this===a};_.Mb=function JIc(a){return FHc(),wNb(BD(a,11),(wtc(),gtc))};var kY=mdb(Lne,'CrossingsCounter/lambda$8$Type',826);bcb(1905,1,{},LIc);var pY=mdb(Lne,'HyperedgeCrossingsCounter',1905);bcb(467,1,{35:1,467:1},NIc);_.wd=function OIc(a){return MIc(this,BD(a,467))};_.b=0;_.c=0;_.e=0;_.f=0;var oY=mdb(Lne,'HyperedgeCrossingsCounter/Hyperedge',467);bcb(362,1,{35:1,362:1},QIc);_.wd=function RIc(a){return PIc(this,BD(a,362))};_.b=0;_.c=0;var nY=mdb(Lne,'HyperedgeCrossingsCounter/HyperedgeCorner',362);bcb(523,22,{3:1,35:1,22:1,523:1},VIc);var SIc,TIc;var mY=ndb(Lne,'HyperedgeCrossingsCounter/HyperedgeCorner/Type',523,CI,XIc,WIc);var YIc;bcb(1405,1,Bqe,dJc);_.Yf=function eJc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?_Ic:null};_.pf=function fJc(a,b){cJc(this,BD(a,37),b)};var _Ic;var rY=mdb(Hqe,'InteractiveNodePlacer',1405);bcb(1406,1,Bqe,tJc);_.Yf=function uJc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?gJc:null};_.pf=function vJc(a,b){rJc(this,BD(a,37),b)};var gJc,hJc,iJc;var tY=mdb(Hqe,'LinearSegmentsNodePlacer',1406);bcb(257,1,{35:1,257:1},zJc);_.wd=function AJc(a){return wJc(this,BD(a,257))};_.Fb=function BJc(a){var b;if(JD(a,257)){b=BD(a,257);return this.b==b.b}return false};_.Hb=function CJc(){return this.b};_.Ib=function DJc(){return 'ls'+Fe(this.e)};_.a=0;_.b=0;_.c=-1;_.d=-1;_.g=0;var sY=mdb(Hqe,'LinearSegmentsNodePlacer/LinearSegment',257);bcb(1408,1,Bqe,$Jc);_.Yf=function _Jc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?EJc:null};_.pf=function hKc(a,b){WJc(this,BD(a,37),b)};_.b=0;_.g=0;var EJc;var dZ=mdb(Hqe,'NetworkSimplexPlacer',1408);bcb(1427,1,Dke,iKc);_.ue=function jKc(a,b){return beb(BD(a,19).a,BD(b,19).a)};_.Fb=function kKc(a){return this===a};_.ve=function lKc(){return new tpb(this)};var uY=mdb(Hqe,'NetworkSimplexPlacer/0methodref$compare$Type',1427);bcb(1429,1,Dke,mKc);_.ue=function nKc(a,b){return beb(BD(a,19).a,BD(b,19).a)};_.Fb=function oKc(a){return this===a};_.ve=function pKc(){return new tpb(this)};var vY=mdb(Hqe,'NetworkSimplexPlacer/1methodref$compare$Type',1429);bcb(649,1,{649:1},qKc);var wY=mdb(Hqe,'NetworkSimplexPlacer/EdgeRep',649);bcb(401,1,{401:1},rKc);_.b=false;var xY=mdb(Hqe,'NetworkSimplexPlacer/NodeRep',401);bcb(508,12,{3:1,4:1,20:1,28:1,52:1,12:1,14:1,15:1,54:1,508:1},vKc);var CY=mdb(Hqe,'NetworkSimplexPlacer/Path',508);bcb(1409,1,{},wKc);_.Kb=function xKc(a){return BD(a,17).d.i.k};var yY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$0$Type',1409);bcb(1410,1,Oie,yKc);_.Mb=function zKc(a){return BD(a,267)==(j0b(),g0b)};var zY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$1$Type',1410);bcb(1411,1,{},AKc);_.Kb=function BKc(a){return BD(a,17).d.i};var AY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$2$Type',1411);bcb(1412,1,Oie,CKc);_.Mb=function DKc(a){return eLc(Lzc(BD(a,10)))};var BY=mdb(Hqe,'NetworkSimplexPlacer/Path/lambda$3$Type',1412);bcb(1413,1,Oie,EKc);_.Mb=function FKc(a){return dKc(BD(a,11))};var DY=mdb(Hqe,'NetworkSimplexPlacer/lambda$0$Type',1413);bcb(1414,1,qie,GKc);_.td=function HKc(a){LJc(this.a,this.b,BD(a,11))};var EY=mdb(Hqe,'NetworkSimplexPlacer/lambda$1$Type',1414);bcb(1423,1,qie,IKc);_.td=function JKc(a){MJc(this.a,BD(a,17))};var FY=mdb(Hqe,'NetworkSimplexPlacer/lambda$10$Type',1423);bcb(1424,1,{},KKc);_.Kb=function LKc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var GY=mdb(Hqe,'NetworkSimplexPlacer/lambda$11$Type',1424);bcb(1425,1,qie,MKc);_.td=function NKc(a){NJc(this.a,BD(a,10))};var HY=mdb(Hqe,'NetworkSimplexPlacer/lambda$12$Type',1425);bcb(1426,1,{},OKc);_.Kb=function PKc(a){return FJc(),meb(BD(a,121).e)};var IY=mdb(Hqe,'NetworkSimplexPlacer/lambda$13$Type',1426);bcb(1428,1,{},QKc);_.Kb=function RKc(a){return FJc(),meb(BD(a,121).e)};var JY=mdb(Hqe,'NetworkSimplexPlacer/lambda$15$Type',1428);bcb(1430,1,Oie,SKc);_.Mb=function TKc(a){return FJc(),BD(a,401).c.k==(j0b(),h0b)};var KY=mdb(Hqe,'NetworkSimplexPlacer/lambda$17$Type',1430);bcb(1431,1,Oie,UKc);_.Mb=function VKc(a){return FJc(),BD(a,401).c.j.c.length>1};var LY=mdb(Hqe,'NetworkSimplexPlacer/lambda$18$Type',1431);bcb(1432,1,qie,WKc);_.td=function XKc(a){eKc(this.c,this.b,this.d,this.a,BD(a,401))};_.c=0;_.d=0;var MY=mdb(Hqe,'NetworkSimplexPlacer/lambda$19$Type',1432);bcb(1415,1,{},YKc);_.Kb=function ZKc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var NY=mdb(Hqe,'NetworkSimplexPlacer/lambda$2$Type',1415);bcb(1433,1,qie,$Kc);_.td=function _Kc(a){fKc(this.a,BD(a,11))};_.a=0;var OY=mdb(Hqe,'NetworkSimplexPlacer/lambda$20$Type',1433);bcb(1434,1,{},aLc);_.Kb=function bLc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var PY=mdb(Hqe,'NetworkSimplexPlacer/lambda$21$Type',1434);bcb(1435,1,qie,cLc);_.td=function dLc(a){OJc(this.a,BD(a,10))};var QY=mdb(Hqe,'NetworkSimplexPlacer/lambda$22$Type',1435);bcb(1436,1,Oie,fLc);_.Mb=function gLc(a){return eLc(a)};var RY=mdb(Hqe,'NetworkSimplexPlacer/lambda$23$Type',1436);bcb(1437,1,{},hLc);_.Kb=function iLc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var SY=mdb(Hqe,'NetworkSimplexPlacer/lambda$24$Type',1437);bcb(1438,1,Oie,jLc);_.Mb=function kLc(a){return PJc(this.a,BD(a,10))};var TY=mdb(Hqe,'NetworkSimplexPlacer/lambda$25$Type',1438);bcb(1439,1,qie,lLc);_.td=function mLc(a){QJc(this.a,this.b,BD(a,10))};var UY=mdb(Hqe,'NetworkSimplexPlacer/lambda$26$Type',1439);bcb(1440,1,Oie,nLc);_.Mb=function oLc(a){return FJc(),!OZb(BD(a,17))};var VY=mdb(Hqe,'NetworkSimplexPlacer/lambda$27$Type',1440);bcb(1441,1,Oie,pLc);_.Mb=function qLc(a){return FJc(),!OZb(BD(a,17))};var WY=mdb(Hqe,'NetworkSimplexPlacer/lambda$28$Type',1441);bcb(1442,1,{},rLc);_.Ce=function sLc(a,b){return RJc(this.a,BD(a,29),BD(b,29))};var XY=mdb(Hqe,'NetworkSimplexPlacer/lambda$29$Type',1442);bcb(1416,1,{},tLc);_.Kb=function uLc(a){return FJc(),new YAb(null,new Lub(new Sr(ur(U_b(BD(a,10)).a.Kc(),new Sq))))};var YY=mdb(Hqe,'NetworkSimplexPlacer/lambda$3$Type',1416);bcb(1417,1,Oie,vLc);_.Mb=function wLc(a){return FJc(),cKc(BD(a,17))};var ZY=mdb(Hqe,'NetworkSimplexPlacer/lambda$4$Type',1417);bcb(1418,1,qie,xLc);_.td=function yLc(a){XJc(this.a,BD(a,17))};var $Y=mdb(Hqe,'NetworkSimplexPlacer/lambda$5$Type',1418);bcb(1419,1,{},zLc);_.Kb=function ALc(a){return FJc(),new YAb(null,new Kub(BD(a,29).a,16))};var _Y=mdb(Hqe,'NetworkSimplexPlacer/lambda$6$Type',1419);bcb(1420,1,Oie,BLc);_.Mb=function CLc(a){return FJc(),BD(a,10).k==(j0b(),h0b)};var aZ=mdb(Hqe,'NetworkSimplexPlacer/lambda$7$Type',1420);bcb(1421,1,{},DLc);_.Kb=function ELc(a){return FJc(),new YAb(null,new Lub(new Sr(ur(O_b(BD(a,10)).a.Kc(),new Sq))))};var bZ=mdb(Hqe,'NetworkSimplexPlacer/lambda$8$Type',1421);bcb(1422,1,Oie,FLc);_.Mb=function GLc(a){return FJc(),NZb(BD(a,17))};var cZ=mdb(Hqe,'NetworkSimplexPlacer/lambda$9$Type',1422);bcb(1404,1,Bqe,KLc);_.Yf=function LLc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?HLc:null};_.pf=function MLc(a,b){JLc(BD(a,37),b)};var HLc;var eZ=mdb(Hqe,'SimpleNodePlacer',1404);bcb(180,1,{180:1},ULc);_.Ib=function VLc(){var a;a='';this.c==(YLc(),XLc)?(a+=kle):this.c==WLc&&(a+=jle);this.o==(eMc(),cMc)?(a+=vle):this.o==dMc?(a+='UP'):(a+='BALANCED');return a};var hZ=mdb(Kqe,'BKAlignedLayout',180);bcb(516,22,{3:1,35:1,22:1,516:1},ZLc);var WLc,XLc;var fZ=ndb(Kqe,'BKAlignedLayout/HDirection',516,CI,_Lc,$Lc);var aMc;bcb(515,22,{3:1,35:1,22:1,515:1},fMc);var cMc,dMc;var gZ=ndb(Kqe,'BKAlignedLayout/VDirection',515,CI,hMc,gMc);var iMc;bcb(1634,1,{},mMc);var iZ=mdb(Kqe,'BKAligner',1634);bcb(1637,1,{},rMc);var lZ=mdb(Kqe,'BKCompactor',1637);bcb(654,1,{654:1},sMc);_.a=0;var jZ=mdb(Kqe,'BKCompactor/ClassEdge',654);bcb(458,1,{458:1},uMc);_.a=null;_.b=0;var kZ=mdb(Kqe,'BKCompactor/ClassNode',458);bcb(1407,1,Bqe,CMc);_.Yf=function GMc(a){return BD(vNb(BD(a,37),(wtc(),Ksc)),21).Hc((Orc(),Hrc))?vMc:null};_.pf=function HMc(a,b){BMc(this,BD(a,37),b)};_.d=false;var vMc;var mZ=mdb(Kqe,'BKNodePlacer',1407);bcb(1635,1,{},JMc);_.d=0;var oZ=mdb(Kqe,'NeighborhoodInformation',1635);bcb(1636,1,Dke,OMc);_.ue=function PMc(a,b){return NMc(this,BD(a,46),BD(b,46))};_.Fb=function QMc(a){return this===a};_.ve=function RMc(){return new tpb(this)};var nZ=mdb(Kqe,'NeighborhoodInformation/NeighborComparator',1636);bcb(808,1,{});var sZ=mdb(Kqe,'ThresholdStrategy',808);bcb(1763,808,{},WMc);_.bg=function XMc(a,b,c){return this.a.o==(eMc(),dMc)?Pje:Qje};_.cg=function YMc(){};var pZ=mdb(Kqe,'ThresholdStrategy/NullThresholdStrategy',1763);bcb(579,1,{579:1},ZMc);_.c=false;_.d=false;var qZ=mdb(Kqe,'ThresholdStrategy/Postprocessable',579);bcb(1764,808,{},bNc);_.bg=function cNc(a,b,c){var d,e,f;e=b==c;d=this.a.a[c.p]==b;if(!(e||d)){return a}f=a;if(this.a.c==(YLc(),XLc)){e&&(f=$Mc(this,b,true));!isNaN(f)&&!isFinite(f)&&d&&(f=$Mc(this,c,false))}else{e&&(f=$Mc(this,b,true));!isNaN(f)&&!isFinite(f)&&d&&(f=$Mc(this,c,false))}return f};_.cg=function dNc(){var a,b,c,d,e;while(this.d.b!=0){e=BD(Ksb(this.d),579);d=_Mc(this,e);if(!d.a){continue}a=d.a;c=Ccb(this.a.f[this.a.g[e.b.p].p]);if(!c&&!OZb(a)&&a.c.i.c==a.d.i.c){continue}b=aNc(this,e);b||swb(this.e,e)}while(this.e.a.c.length!=0){aNc(this,BD(rwb(this.e),579))}};var rZ=mdb(Kqe,'ThresholdStrategy/SimpleThresholdStrategy',1764);bcb(635,1,{635:1,246:1,234:1},hNc);_.Kf=function jNc(){return gNc(this)};_.Xf=function iNc(){return gNc(this)};var eNc;var tZ=mdb(Lqe,'EdgeRouterFactory',635);bcb(1458,1,Bqe,wNc);_.Yf=function xNc(a){return uNc(BD(a,37))};_.pf=function yNc(a,b){vNc(BD(a,37),b)};var lNc,mNc,nNc,oNc,pNc,qNc,rNc,sNc;var uZ=mdb(Lqe,'OrthogonalEdgeRouter',1458);bcb(1451,1,Bqe,NNc);_.Yf=function ONc(a){return INc(BD(a,37))};_.pf=function PNc(a,b){KNc(this,BD(a,37),b)};var zNc,ANc,BNc,CNc,DNc,ENc;var wZ=mdb(Lqe,'PolylineEdgeRouter',1451);bcb(1452,1,Vke,RNc);_.Lb=function SNc(a){return QNc(BD(a,10))};_.Fb=function TNc(a){return this===a};_.Mb=function UNc(a){return QNc(BD(a,10))};var vZ=mdb(Lqe,'PolylineEdgeRouter/1',1452);bcb(1809,1,Oie,ZNc);_.Mb=function $Nc(a){return BD(a,129).c==(HOc(),FOc)};var xZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$0$Type',1809);bcb(1810,1,{},_Nc);_.Ge=function aOc(a){return BD(a,129).d};var yZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$1$Type',1810);bcb(1811,1,Oie,bOc);_.Mb=function cOc(a){return BD(a,129).c==(HOc(),FOc)};var zZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$2$Type',1811);bcb(1812,1,{},dOc);_.Ge=function eOc(a){return BD(a,129).d};var AZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$3$Type',1812);bcb(1813,1,{},fOc);_.Ge=function gOc(a){return BD(a,129).d};var BZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$4$Type',1813);bcb(1814,1,{},hOc);_.Ge=function iOc(a){return BD(a,129).d};var CZ=mdb(Mqe,'HyperEdgeCycleDetector/lambda$5$Type',1814);bcb(112,1,{35:1,112:1},uOc);_.wd=function vOc(a){return kOc(this,BD(a,112))};_.Fb=function wOc(a){var b;if(JD(a,112)){b=BD(a,112);return this.g==b.g}return false};_.Hb=function xOc(){return this.g};_.Ib=function zOc(){var a,b,c,d;a=new Wfb('{');d=new olb(this.n);while(d.a'+this.b+' ('+Yr(this.c)+')'};_.d=0;var EZ=mdb(Mqe,'HyperEdgeSegmentDependency',129);bcb(520,22,{3:1,35:1,22:1,520:1},IOc);var FOc,GOc;var DZ=ndb(Mqe,'HyperEdgeSegmentDependency/DependencyType',520,CI,KOc,JOc);var LOc;bcb(1815,1,{},ZOc);var MZ=mdb(Mqe,'HyperEdgeSegmentSplitter',1815);bcb(1816,1,{},aPc);_.a=0;_.b=0;var FZ=mdb(Mqe,'HyperEdgeSegmentSplitter/AreaRating',1816);bcb(329,1,{329:1},bPc);_.a=0;_.b=0;_.c=0;var GZ=mdb(Mqe,'HyperEdgeSegmentSplitter/FreeArea',329);bcb(1817,1,Dke,cPc);_.ue=function dPc(a,b){return _Oc(BD(a,112),BD(b,112))};_.Fb=function ePc(a){return this===a};_.ve=function fPc(){return new tpb(this)};var HZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$0$Type',1817);bcb(1818,1,qie,gPc);_.td=function hPc(a){TOc(this.a,this.d,this.c,this.b,BD(a,112))};_.b=0;var IZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$1$Type',1818);bcb(1819,1,{},iPc);_.Kb=function jPc(a){return new YAb(null,new Kub(BD(a,112).e,16))};var JZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$2$Type',1819);bcb(1820,1,{},kPc);_.Kb=function lPc(a){return new YAb(null,new Kub(BD(a,112).j,16))};var KZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$3$Type',1820);bcb(1821,1,{},mPc);_.Fe=function nPc(a){return Edb(ED(a))};var LZ=mdb(Mqe,'HyperEdgeSegmentSplitter/lambda$4$Type',1821);bcb(655,1,{},tPc);_.a=0;_.b=0;_.c=0;var QZ=mdb(Mqe,'OrthogonalRoutingGenerator',655);bcb(1638,1,{},xPc);_.Kb=function yPc(a){return new YAb(null,new Kub(BD(a,112).e,16))};var OZ=mdb(Mqe,'OrthogonalRoutingGenerator/lambda$0$Type',1638);bcb(1639,1,{},zPc);_.Kb=function APc(a){return new YAb(null,new Kub(BD(a,112).j,16))};var PZ=mdb(Mqe,'OrthogonalRoutingGenerator/lambda$1$Type',1639);bcb(661,1,{});var RZ=mdb(Nqe,'BaseRoutingDirectionStrategy',661);bcb(1807,661,{},EPc);_.dg=function FPc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;if(!!a.r&&!a.q){return}k=b+a.o*c;for(j=new olb(a.n);j.aqme){f=k;e=a;d=new f7c(l,f);Dsb(g.a,d);BPc(this,g,e,d,false);m=a.r;if(m){n=Edb(ED(Ut(m.e,0)));d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false);f=b+m.o*c;e=m;d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false)}d=new f7c(p,f);Dsb(g.a,d);BPc(this,g,e,d,false)}}}}};_.eg=function GPc(a){return a.i.n.a+a.n.a+a.a.a};_.fg=function HPc(){return Ucd(),Rcd};_.gg=function IPc(){return Ucd(),Acd};var SZ=mdb(Nqe,'NorthToSouthRoutingStrategy',1807);bcb(1808,661,{},JPc);_.dg=function KPc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;if(!!a.r&&!a.q){return}k=b-a.o*c;for(j=new olb(a.n);j.aqme){f=k;e=a;d=new f7c(l,f);Dsb(g.a,d);BPc(this,g,e,d,false);m=a.r;if(m){n=Edb(ED(Ut(m.e,0)));d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false);f=b-m.o*c;e=m;d=new f7c(n,f);Dsb(g.a,d);BPc(this,g,e,d,false)}d=new f7c(p,f);Dsb(g.a,d);BPc(this,g,e,d,false)}}}}};_.eg=function LPc(a){return a.i.n.a+a.n.a+a.a.a};_.fg=function MPc(){return Ucd(),Acd};_.gg=function NPc(){return Ucd(),Rcd};var TZ=mdb(Nqe,'SouthToNorthRoutingStrategy',1808);bcb(1806,661,{},OPc);_.dg=function PPc(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p;if(!!a.r&&!a.q){return}k=b+a.o*c;for(j=new olb(a.n);j.aqme){f=k;e=a;d=new f7c(f,l);Dsb(g.a,d);BPc(this,g,e,d,true);m=a.r;if(m){n=Edb(ED(Ut(m.e,0)));d=new f7c(f,n);Dsb(g.a,d);BPc(this,g,e,d,true);f=b+m.o*c;e=m;d=new f7c(f,n);Dsb(g.a,d);BPc(this,g,e,d,true)}d=new f7c(f,p);Dsb(g.a,d);BPc(this,g,e,d,true)}}}}};_.eg=function QPc(a){return a.i.n.b+a.n.b+a.a.b};_.fg=function RPc(){return Ucd(),zcd};_.gg=function SPc(){return Ucd(),Tcd};var UZ=mdb(Nqe,'WestToEastRoutingStrategy',1806);bcb(813,1,{},YPc);_.Ib=function ZPc(){return Fe(this.a)};_.b=0;_.c=false;_.d=false;_.f=0;var WZ=mdb(Pqe,'NubSpline',813);bcb(407,1,{407:1},aQc,bQc);var VZ=mdb(Pqe,'NubSpline/PolarCP',407);bcb(1453,1,Bqe,vQc);_.Yf=function xQc(a){return qQc(BD(a,37))};_.pf=function yQc(a,b){uQc(this,BD(a,37),b)};var cQc,dQc,eQc,fQc,gQc;var b$=mdb(Pqe,'SplineEdgeRouter',1453);bcb(268,1,{268:1},BQc);_.Ib=function CQc(){return this.a+' ->('+this.c+') '+this.b};_.c=0;var XZ=mdb(Pqe,'SplineEdgeRouter/Dependency',268);bcb(455,22,{3:1,35:1,22:1,455:1},GQc);var DQc,EQc;var YZ=ndb(Pqe,'SplineEdgeRouter/SideToProcess',455,CI,IQc,HQc);var JQc;bcb(1454,1,Oie,LQc);_.Mb=function MQc(a){return hQc(),!BD(a,128).o};var ZZ=mdb(Pqe,'SplineEdgeRouter/lambda$0$Type',1454);bcb(1455,1,{},NQc);_.Ge=function OQc(a){return hQc(),BD(a,128).v+1};var $Z=mdb(Pqe,'SplineEdgeRouter/lambda$1$Type',1455);bcb(1456,1,qie,PQc);_.td=function QQc(a){sQc(this.a,this.b,BD(a,46))};var _Z=mdb(Pqe,'SplineEdgeRouter/lambda$2$Type',1456);bcb(1457,1,qie,RQc);_.td=function SQc(a){tQc(this.a,this.b,BD(a,46))};var a$=mdb(Pqe,'SplineEdgeRouter/lambda$3$Type',1457);bcb(128,1,{35:1,128:1},YQc,ZQc);_.wd=function $Qc(a){return WQc(this,BD(a,128))};_.b=0;_.e=false;_.f=0;_.g=0;_.j=false;_.k=false;_.n=0;_.o=false;_.p=false;_.q=false;_.s=0;_.u=0;_.v=0;_.F=0;var d$=mdb(Pqe,'SplineSegment',128);bcb(459,1,{459:1},_Qc);_.a=0;_.b=false;_.c=false;_.d=false;_.e=false;_.f=0;var c$=mdb(Pqe,'SplineSegment/EdgeInformation',459);bcb(1234,1,{},hRc);var f$=mdb(Uqe,hme,1234);bcb(1235,1,Dke,jRc);_.ue=function kRc(a,b){return iRc(BD(a,135),BD(b,135))};_.Fb=function lRc(a){return this===a};_.ve=function mRc(){return new tpb(this)};var e$=mdb(Uqe,ime,1235);bcb(1233,1,{},tRc);var g$=mdb(Uqe,'MrTree',1233);bcb(393,22,{3:1,35:1,22:1,393:1,246:1,234:1},ARc);_.Kf=function CRc(){return zRc(this)};_.Xf=function BRc(){return zRc(this)};var uRc,vRc,wRc,xRc;var h$=ndb(Uqe,'TreeLayoutPhases',393,CI,ERc,DRc);var FRc;bcb(1130,209,Mle,HRc);_.Ze=function IRc(a,b){var c,d,e,f,g,h,i;Ccb(DD(hkd(a,(JTc(),ATc))))||$Cb((c=new _Cb((Pgd(),new bhd(a))),c));g=(h=new SRc,tNb(h,a),yNb(h,(mTc(),dTc),a),i=new Lqb,pRc(a,h,i),oRc(a,h,i),h);f=gRc(this.a,g);for(e=new olb(f);e.a'+WRc(this.c):'e_'+tb(this)};var l$=mdb(Vqe,'TEdge',188);bcb(135,134,{3:1,135:1,94:1,134:1},SRc);_.Ib=function TRc(){var a,b,c,d,e;e=null;for(d=Jsb(this.b,0);d.b!=d.d.c;){c=BD(Xsb(d),86);e+=(c.c==null||c.c.length==0?'n_'+c.g:'n_'+c.c)+'\n'}for(b=Jsb(this.a,0);b.b!=b.d.c;){a=BD(Xsb(b),188);e+=(!!a.b&&!!a.c?WRc(a.b)+'->'+WRc(a.c):'e_'+tb(a))+'\n'}return e};var n$=mdb(Vqe,'TGraph',135);bcb(633,502,{3:1,502:1,633:1,94:1,134:1});var r$=mdb(Vqe,'TShape',633);bcb(86,633,{3:1,502:1,86:1,633:1,94:1,134:1},XRc);_.Ib=function YRc(){return WRc(this)};var q$=mdb(Vqe,'TNode',86);bcb(255,1,vie,ZRc);_.Jc=function $Rc(a){reb(this,a)};_.Kc=function _Rc(){var a;return a=Jsb(this.a.d,0),new aSc(a)};var p$=mdb(Vqe,'TNode/2',255);bcb(358,1,aie,aSc);_.Nb=function bSc(a){Rrb(this,a)};_.Pb=function dSc(){return BD(Xsb(this.a),188).c};_.Ob=function cSc(){return Wsb(this.a)};_.Qb=function eSc(){Zsb(this.a)};var o$=mdb(Vqe,'TNode/2/1',358);bcb(1840,1,ene,hSc);_.pf=function jSc(a,b){gSc(this,BD(a,135),b)};var s$=mdb(Wqe,'FanProcessor',1840);bcb(327,22,{3:1,35:1,22:1,327:1,234:1},rSc);_.Kf=function sSc(){switch(this.g){case 0:return new QSc;case 1:return new hSc;case 2:return new GSc;case 3:return new zSc;case 4:return new NSc;case 5:return new TSc;default:throw vbb(new Wdb(Dne+(this.f!=null?this.f:''+this.g)));}};var kSc,lSc,mSc,nSc,oSc,pSc;var t$=ndb(Wqe,Ene,327,CI,uSc,tSc);var vSc;bcb(1843,1,ene,zSc);_.pf=function ASc(a,b){xSc(this,BD(a,135),b)};_.a=0;var v$=mdb(Wqe,'LevelHeightProcessor',1843);bcb(1844,1,vie,BSc);_.Jc=function CSc(a){reb(this,a)};_.Kc=function DSc(){return mmb(),Emb(),Dmb};var u$=mdb(Wqe,'LevelHeightProcessor/1',1844);bcb(1841,1,ene,GSc);_.pf=function HSc(a,b){ESc(this,BD(a,135),b)};_.a=0;var x$=mdb(Wqe,'NeighborsProcessor',1841);bcb(1842,1,vie,ISc);_.Jc=function JSc(a){reb(this,a)};_.Kc=function KSc(){return mmb(),Emb(),Dmb};var w$=mdb(Wqe,'NeighborsProcessor/1',1842);bcb(1845,1,ene,NSc);_.pf=function OSc(a,b){LSc(this,BD(a,135),b)};_.a=0;var y$=mdb(Wqe,'NodePositionProcessor',1845);bcb(1839,1,ene,QSc);_.pf=function RSc(a,b){PSc(this,BD(a,135))};var z$=mdb(Wqe,'RootProcessor',1839);bcb(1846,1,ene,TSc);_.pf=function USc(a,b){SSc(BD(a,135))};var A$=mdb(Wqe,'Untreeifyer',1846);var VSc,WSc,XSc,YSc,ZSc,$Sc,_Sc,aTc,bTc,cTc,dTc,eTc,fTc,gTc,hTc,iTc,jTc,kTc,lTc;bcb(851,1,ale,sTc);_.Qe=function tTc(a){t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zqe),''),'Weighting of Nodes'),'Which weighting to use when computing a node order.'),qTc),(_5c(),V5c)),E$),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$qe),''),'Search Order'),'Which search order to use when computing a spanning tree.'),oTc),V5c),F$),pqb(L5c))));KTc((new LTc,a))};var nTc,oTc,pTc,qTc;var B$=mdb(_qe,'MrTreeMetaDataProvider',851);bcb(994,1,ale,LTc);_.Qe=function MTc(a){KTc(a)};var uTc,vTc,wTc,xTc,yTc,zTc,ATc,BTc,CTc,DTc,ETc,FTc,GTc,HTc,ITc;var D$=mdb(_qe,'MrTreeOptions',994);bcb(995,1,{},NTc);_.$e=function OTc(){var a;return a=new HRc,a};_._e=function PTc(a){};var C$=mdb(_qe,'MrTreeOptions/MrtreeFactory',995);bcb(480,22,{3:1,35:1,22:1,480:1},TTc);var QTc,RTc;var E$=ndb(_qe,'OrderWeighting',480,CI,VTc,UTc);var WTc;bcb(425,22,{3:1,35:1,22:1,425:1},_Tc);var YTc,ZTc;var F$=ndb(_qe,'TreeifyingOrder',425,CI,bUc,aUc);var cUc;bcb(1459,1,Bqe,lUc);_.Yf=function mUc(a){return BD(a,135),eUc};_.pf=function nUc(a,b){kUc(this,BD(a,135),b)};var eUc;var G$=mdb('org.eclipse.elk.alg.mrtree.p1treeify','DFSTreeifyer',1459);bcb(1460,1,Bqe,sUc);_.Yf=function tUc(a){return BD(a,135),oUc};_.pf=function uUc(a,b){rUc(this,BD(a,135),b)};var oUc;var H$=mdb('org.eclipse.elk.alg.mrtree.p2order','NodeOrderer',1460);bcb(1461,1,Bqe,CUc);_.Yf=function DUc(a){return BD(a,135),vUc};_.pf=function EUc(a,b){AUc(this,BD(a,135),b)};_.a=0;var vUc;var I$=mdb('org.eclipse.elk.alg.mrtree.p3place','NodePlacer',1461);bcb(1462,1,Bqe,IUc);_.Yf=function JUc(a){return BD(a,135),FUc};_.pf=function KUc(a,b){HUc(BD(a,135),b)};var FUc;var J$=mdb('org.eclipse.elk.alg.mrtree.p4route','EdgeRouter',1462);var LUc;bcb(495,22,{3:1,35:1,22:1,495:1,246:1,234:1},RUc);_.Kf=function TUc(){return QUc(this)};_.Xf=function SUc(){return QUc(this)};var NUc,OUc;var K$=ndb(cre,'RadialLayoutPhases',495,CI,VUc,UUc);var WUc;bcb(1131,209,Mle,ZUc);_.Ze=function $Uc(a,b){var c,d,e,f,g,h;c=YUc(this,a);Odd(b,'Radial layout',c.c.length);Ccb(DD(hkd(a,(ZWc(),QWc))))||$Cb((d=new _Cb((Pgd(),new bhd(a))),d));h=aVc(a);jkd(a,(MUc(),LUc),h);if(!h){throw vbb(new Wdb('The given graph is not a tree!'))}e=Edb(ED(hkd(a,VWc)));e==0&&(e=_Uc(a));jkd(a,VWc,e);for(g=new olb(YUc(this,a));g.a0&&j7c((BCb(c-1,b.length),b.charCodeAt(c-1)),nne)){--c}if(e>=c){throw vbb(new Wdb('The given string does not contain any numbers.'))}f=mfb(b.substr(e,c-e),',|;|\r|\n');if(f.length!=2){throw vbb(new Wdb('Exactly two numbers are expected, '+f.length+' were found.'))}try{this.a=Hcb(ufb(f[0]));this.b=Hcb(ufb(f[1]))}catch(a){a=ubb(a);if(JD(a,127)){d=a;throw vbb(new Wdb(one+d))}else throw vbb(a)}};_.Ib=function m7c(){return '('+this.a+','+this.b+')'};_.a=0;_.b=0;var m1=mdb(pne,'KVector',8);bcb(74,68,{3:1,4:1,20:1,28:1,52:1,14:1,68:1,15:1,74:1,414:1},s7c,t7c,u7c);_.Pc=function x7c(){return r7c(this)};_.Jf=function v7c(b){var c,d,e,f,g,h;e=mfb(b,',|;|\\(|\\)|\\[|\\]|\\{|\\}| |\t|\n');Osb(this);try{d=0;g=0;f=0;h=0;while(d0){g%2==0?(f=Hcb(e[d])):(h=Hcb(e[d]));g>0&&g%2!=0&&Dsb(this,new f7c(f,h));++g}++d}}catch(a){a=ubb(a);if(JD(a,127)){c=a;throw vbb(new Wdb('The given string does not match the expected format for vectors.'+c))}else throw vbb(a)}};_.Ib=function y7c(){var a,b,c;a=new Wfb('(');b=Jsb(this,0);while(b.b!=b.d.c){c=BD(Xsb(b),8);Qfb(a,c.a+','+c.b);b.b!=b.d.c&&(a.a+='; ',a)}return (a.a+=')',a).a};var l1=mdb(pne,'KVectorChain',74);bcb(248,22,{3:1,35:1,22:1,248:1},G7c);var z7c,A7c,B7c,C7c,D7c,E7c;var o1=ndb(ose,'Alignment',248,CI,I7c,H7c);var J7c;bcb(979,1,ale,Z7c);_.Qe=function $7c(a){Y7c(a)};var L7c,M7c,N7c,O7c,P7c,Q7c,R7c,S7c,T7c,U7c,V7c,W7c;var q1=mdb(ose,'BoxLayouterOptions',979);bcb(980,1,{},_7c);_.$e=function a8c(){var a;return a=new ged,a};_._e=function b8c(a){};var p1=mdb(ose,'BoxLayouterOptions/BoxFactory',980);bcb(291,22,{3:1,35:1,22:1,291:1},j8c);var c8c,d8c,e8c,f8c,g8c,h8c;var r1=ndb(ose,'ContentAlignment',291,CI,l8c,k8c);var m8c;bcb(684,1,ale,Z9c);_.Qe=function $9c(a){t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,sse),''),'Layout Algorithm'),'Select a specific layout algorithm.'),(_5c(),Z5c)),ZI),pqb((N5c(),L5c)))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,tse),''),'Resolved Layout Algorithm'),'Meta data associated with the selected algorithm.'),Y5c),E0),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$pe),''),'Alignment'),'Alignment of the selected node relative to other nodes; the exact meaning depends on the used algorithm.'),q8c),V5c),o1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,_le),''),'Aspect Ratio'),'The desired aspect ratio of the drawing, that is the quotient of width by height.'),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,use),''),'Bend Points'),"A fixed list of bend points for the edge. This is used by the 'Fixed Layout' algorithm to specify a pre-defined routing for an edge. The vector chain must include the source point, any bend points, and the target point, so it must have at least two points."),Y5c),l1),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,lqe),''),'Content Alignment'),'Specifies how the content of a node are aligned. Each node can individually control the alignment of its contents. I.e. if a node should be aligned top left in its parent node, the parent node should specify that option.'),x8c),W5c),r1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zpe),''),'Debug Mode'),'Whether additional debug information shall be generated.'),(Bcb(),false)),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,cqe),''),Cle),'Overall direction of edges: horizontal (right / left) or vertical (down / up).'),A8c),V5c),t1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ype),''),'Edge Routing'),'What kind of edge routing style should be applied for the content of a parent node. Algorithms may also set this option to single edges in order to mark them as splines. The bend point list of edges with this option set to SPLINES must be interpreted as control points for a piecewise cubic spline.'),F8c),V5c),v1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Jre),''),'Expand Nodes'),'If active, nodes are expanded to fill the area of their parent.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,tpe),''),'Hierarchy Handling'),"Determines whether separate layout runs are triggered for different compound nodes in a hierarchical graph. Setting a node's hierarchy handling to `INCLUDE_CHILDREN` will lay out that node and all of its descendants in a single layout run, until a descendant is encountered which has its hierarchy handling set to `SEPARATE_CHILDREN`. In general, `SEPARATE_CHILDREN` will ensure that a new layout run is triggered for a node with that setting. Including multiple levels of hierarchy in a single layout run may allow cross-hierarchical edges to be laid out properly. If the root node is set to `INHERIT` (or not set at all), the default behavior is `SEPARATE_CHILDREN`."),K8c),V5c),z1),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,ame),''),'Padding'),"The padding to be left to a parent element's border when placing child elements. This can also serve as an output option of a layout algorithm if node size calculation is setup appropriately."),g9c),Y5c),j1),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ame),''),'Interactive'),'Whether the algorithm should be run in interactive mode for the content of a parent node. What this means exactly depends on how the specific algorithm interprets this option. Usually in the interactive mode algorithms try to modify the current layout as little as possible.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xqe),''),'interactive Layout'),'Whether the graph should be changeable interactively and by setting constraints'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Dme),''),'Omit Node Micro Layout'),"Node micro layout comprises the computation of node dimensions (if requested), the placement of ports and their labels, and the placement of node labels. The functionality is implemented independent of any specific layout algorithm and shouldn't have any negative impact on the layout algorithm's performance itself. Yet, if any unforeseen behavior occurs, this option allows to deactivate the micro layout."),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Bme),''),'Port Constraints'),'Defines constraints of the position of the ports of a node.'),u9c),V5c),D1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,uqe),''),'Position'),"The position of a node, port, or label. This is used by the 'Fixed Layout' algorithm to specify a pre-defined position."),Y5c),m1),qqb(K5c,OC(GC(e1,1),Kie,175,0,[M5c,J5c])))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,vme),''),'Priority'),'Defines the priority of an object; its meaning depends on the specific layout algorithm and the context where it is used.'),X5c),JI),qqb(K5c,OC(GC(e1,1),Kie,175,0,[I5c])))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,yme),''),'Randomization Seed'),'Seed used for pseudo-random number generators to control the layout algorithm. If the value is 0, the seed shall be determined pseudo-randomly (e.g. from the system time).'),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,zme),''),'Separate Connected Components'),'Whether each connected component should be processed separately.'),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,mqe),''),'Junction Points'),'This option is not used as option, but as output of the layout algorithms. It is attached to edges and determines the points where junction symbols should be drawn in order to represent hyperedges with orthogonal routing. Whether such points are computed depends on the chosen layout algorithm and edge routing style. The points are put into the vector chain with no specific order.'),R8c),Y5c),l1),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,pqe),''),'Comment Box'),'Whether the node should be regarded as a comment box instead of a regular node. In that case its placement should be similar to how labels are handled. Any edges incident to a comment box specify to which graph elements the comment is related.'),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,qqe),''),'Hypernode'),'Whether the node should be handled as a hypernode.'),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,vse),''),'Label Manager'),"Label managers can shorten labels upon a layout algorithm's request."),Y5c),h1),qqb(L5c,OC(GC(e1,1),Kie,175,0,[J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,vqe),''),'Margins'),"Margins define additional space around the actual bounds of a graph element. For instance, ports or labels being placed on the outside of a node's border might introduce such a margin. The margin is used to guarantee non-overlap of other graph elements with those ports or labels."),T8c),Y5c),i1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Xpe),''),'No Layout'),"No layout is done for the associated element. This is used to mark parts of a diagram to avoid their inclusion in the layout graph, or to mark parts of the layout graph to prevent layout engines from processing them. If you wish to exclude the contents of a compound node from automatic layout, while the node itself is still considered on its own layer, use the 'Fixed Layout' algorithm for that node."),false),T5c),wI),qqb(K5c,OC(GC(e1,1),Kie,175,0,[I5c,M5c,J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,wse),''),'Scale Factor'),"The scaling factor to be applied to the corresponding node in recursive layout. It causes the corresponding node's size to be adjusted, and its ports and labels to be sized and placed accordingly after the layout of that node has been determined (and before the node itself and its siblings are arranged). The scaling is not reverted afterwards, so the resulting layout graph contains the adjusted size and position data. This option is currently not supported if 'Layout Hierarchy' is set."),1),U5c),BI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xse),''),'Animate'),'Whether the shift from the old layout to the new computed layout shall be animated.'),true),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,yse),''),'Animation Time Factor'),"Factor for computation of animation time. The higher the value, the longer the animation time. If the value is 0, the resulting time is always equal to the minimum defined by 'Minimal Animation Time'."),meb(100)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,zse),''),'Layout Ancestors'),'Whether the hierarchy levels on the path from the selected element to the root of the diagram shall be included in the layout process.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ase),''),'Maximal Animation Time'),'The maximal time for animations, in milliseconds.'),meb(4000)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Bse),''),'Minimal Animation Time'),'The minimal time for animations, in milliseconds.'),meb(400)),X5c),JI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Cse),''),'Progress Bar'),'Whether a progress bar shall be displayed during layout computations.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Dse),''),'Validate Graph'),'Whether the graph shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ese),''),'Validate Options'),'Whether layout options shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user.'),true),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Fse),''),'Zoom to Fit'),'Whether the zoom level shall be set to view the whole diagram after layout.'),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,rse),'box'),'Box Layout Mode'),'Configures the packing mode used by the {@link BoxLayoutProvider}. If SIMPLE is not required (neither priorities are used nor the interactive mode), GROUP_DEC can improve the packing and decrease the area. GROUP_MIXED and GROUP_INC may, in very specific scenarios, work better.'),u8c),V5c),O1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Lpe),zpe),'Comment Comment Spacing'),'Spacing to be preserved between a comment box and other comment boxes connected to the same node. The space left between comment boxes of different nodes is controlled by the node-node spacing.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Mpe),zpe),'Comment Node Spacing'),'Spacing to be preserved between a node and its connected comment boxes. The space left between a node and the comments of another node is controlled by the node-node spacing.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Zle),zpe),'Components Spacing'),"Spacing to be preserved between pairs of connected components. This option is only relevant if 'separateConnectedComponents' is activated."),20),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Npe),zpe),'Edge Spacing'),'Spacing to be preserved between any two edges. Note that while this can somewhat easily be satisfied for the segments of orthogonally drawn edges, it is harder for general polylines or splines.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,xme),zpe),'Edge Label Spacing'),"The minimal distance to be preserved between a label and the edge it is associated with. Note that the placement of a label is influenced by the 'edgelabels.placement' option."),2),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ope),zpe),'Edge Node Spacing'),'Spacing to be preserved between nodes and edges.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ppe),zpe),'Label Spacing'),'Determines the amount of space to be left between two labels of the same graph element.'),0),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Spe),zpe),'Label Node Spacing'),"Spacing to be preserved between labels and the border of node they are associated with. Note that the placement of a label is influenced by the 'nodelabels.placement' option."),5),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Qpe),zpe),'Horizontal spacing between Label and Port'),"Horizontal spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Rpe),zpe),'Vertical spacing between Label and Port'),"Vertical spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,wme),zpe),'Node Spacing'),'The minimal distance to be preserved between each two nodes.'),20),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Tpe),zpe),'Node Self Loop Spacing'),'Spacing to be preserved between a node and its self loops.'),10),U5c),BI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Upe),zpe),'Port Spacing'),'Spacing between pairs of ports of the same node.'),10),U5c),BI),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Vpe),zpe),'Individual Spacing'),"Allows to specify individual spacing values for graph elements that shall be different from the value specified for the element's parent."),Y5c),i2),qqb(K5c,OC(GC(e1,1),Kie,175,0,[I5c,M5c,J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,wqe),zpe),'Additional Port Space'),'Additional space around the sets of ports on each node side. For each side of a node, this option can reserve additional space before and after the ports on each side. For example, a top spacing of 20 makes sure that the first port on the western and eastern side is 20 units away from the northern border.'),W9c),Y5c),i1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,tqe),Jse),'Layout Partition'),'Partition to which the node belongs. This requires Layout Partitioning to be active. Nodes with lower partition IDs will appear to the left of nodes with higher partition IDs (assuming a left-to-right layout direction).'),X5c),JI),qqb(L5c,OC(GC(e1,1),Kie,175,0,[K5c])))));o4c(a,tqe,sqe,k9c);t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,sqe),Jse),'Layout Partitioning'),'Whether to activate partitioned layout. This will allow to group nodes through the Layout Partition option. a pair of nodes with different partition indices is then placed such that the node with lower index is placed to the left of the other node (with left-to-right layout direction). Depending on the layout algorithm, this may only be guaranteed to work if all nodes have a layout partition configured, or at least if edges that cross partitions are not part of a partition-crossing cycle.'),i9c),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,dqe),Kse),'Node Label Padding'),'Define padding for node labels that are placed inside of a node.'),V8c),Y5c),j1),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Gme),Kse),'Node Label Placement'),"Hints for where node labels are to be placed; if empty, the node label's position is not modified."),X8c),W5c),B1),qqb(K5c,OC(GC(e1,1),Kie,175,0,[J5c])))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,gqe),Lse),'Port Alignment'),'Defines the default port distribution for a node. May be overridden for each side individually.'),m9c),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,hqe),Lse),'Port Alignment (North)'),"Defines how ports on the northern side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,iqe),Lse),'Port Alignment (South)'),"Defines how ports on the southern side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,jqe),Lse),'Port Alignment (West)'),"Defines how ports on the western side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,kqe),Lse),'Port Alignment (East)'),"Defines how ports on the eastern side are placed, overriding the node's general port alignment."),V5c),C1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Fme),Mse),'Node Size Constraints'),"What should be taken into account when calculating a node's size. Empty size constraints specify that a node's size is already fixed and should not be changed."),Z8c),W5c),I1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Eme),Mse),'Node Size Options'),'Options modifying the behavior of the size constraints set on a node. Each member of the set specifies something that should be taken into account when calculating node sizes. The empty set corresponds to no further modifications.'),c9c),W5c),J1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Tme),Mse),'Node Size Minimum'),'The minimal size to which a node can be reduced.'),a9c),Y5c),m1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,bqe),Mse),'Fixed Graph Size'),"By default, the fixed layout provider will enlarge a graph until it is large enough to contain its children. If this option is set, it won't do so."),false),T5c),wI),pqb(L5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,nqe),Jpe),'Edge Label Placement'),'Gives a hint on where to put edge labels.'),D8c),V5c),u1),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Cme),Jpe),'Inline Edge Labels'),"If true, an edge label is placed directly on its edge. May only apply to center edge labels. This kind of label placement is only advisable if the label's rendering is such that it is not crossed by its edge and thus stays legible."),false),T5c),wI),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Gse),'font'),'Font Name'),'Font name used for a label.'),Z5c),ZI),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Hse),'font'),'Font Size'),'Font size used for a label.'),X5c),JI),pqb(J5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,rqe),Nse),'Port Anchor Offset'),'The offset to the port position where connections shall be attached.'),Y5c),m1),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,oqe),Nse),'Port Index'),"The index of a port in the fixed order around a node. The order is assumed as clockwise, starting with the leftmost port on the top side. This option must be set if 'Port Constraints' is set to FIXED_ORDER and no specific positions are given for the ports. Additionally, the option 'Port Side' must be defined in this case."),X5c),JI),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ype),Nse),'Port Side'),"The side of a node on which a port is situated. This option must be set if 'Port Constraints' is set to FIXED_SIDE or FIXED_ORDER and no specific positions are given for the ports."),B9c),V5c),F1),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(z5c(D5c(A5c(B5c(new H5c,Wpe),Nse),'Port Border Offset'),"The offset of ports on the node border. With a positive offset the port is moved outside of the node, while with a negative offset the port is moved towards the inside. An offset of 0 means that the port is placed directly on the node border, i.e. if the port side is north, the port's south border touches the nodes's north border; if the port side is east, the port's west border touches the nodes's east border; if the port side is south, the port's north border touches the node's south border; if the port side is west, the port's east border touches the node's west border."),U5c),BI),pqb(M5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Hme),Ose),'Port Label Placement'),"Decides on a placement method for port labels; if empty, the node label's position is not modified."),y9c),W5c),E1),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,eqe),Ose),'Port Labels Next to Port'),"Use 'portLabels.placement': NEXT_TO_PORT_OF_POSSIBLE."),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,fqe),Ose),'Treat Port Labels as Group'),'If this option is true (default), the labels of a port will be treated as a group when it comes to centering them next to their port. If this option is false, only the first label will be centered next to the port, with the others being placed below. This only applies to labels of eastern and western ports and will have no effect if labels are not placed next to their port.'),true),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,_pe),Pse),'Activate Inside Self Loops'),"Whether this node allows to route self loops inside of it instead of around it. If set to true, this will make the node a compound node if it isn't already, and will require the layout algorithm to support compound nodes with hierarchical ports."),false),T5c),wI),pqb(K5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,aqe),Pse),'Inside Self Loop'),'Whether a self loop should be routed inside a node instead of around that node.'),false),T5c),wI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,$le),'edge'),'Edge Thickness'),'The thickness of an edge. This is a hint on the line width used to draw an edge, possibly requiring more space to be reserved for it.'),1),U5c),BI),pqb(I5c))));t4c(a,new p5c(F5c(E5c(G5c(y5c(z5c(D5c(A5c(B5c(new H5c,Ise),'edge'),'Edge Type'),'The type of an edge. This is usually used for UML class diagrams, where associations must be handled differently from generalizations.'),H8c),V5c),w1),pqb(I5c))));s4c(a,new W3c(b4c(d4c(c4c(new e4c,sne),'Layered'),'The layer-based method was introduced by Sugiyama, Tagawa and Toda in 1981. It emphasizes the direction of edges by pointing as many edges as possible into the same direction. The nodes are arranged in layers, which are sometimes called "hierarchies", and then reordered such that the number of edge crossings is minimized. Afterwards, concrete coordinates are computed for the nodes and edge bend points.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,'org.eclipse.elk.orthogonal'),'Orthogonal'),'Orthogonal methods that follow the "topology-shape-metrics" approach by Batini, Nardelli and Tamassia \'86. The first phase determines the topology of the drawing by applying a planarization technique, which results in a planar representation of the graph. The orthogonal shape is computed in the second phase, which aims at minimizing the number of edge bends, and is called orthogonalization. The third phase leads to concrete coordinates for nodes and edge bend points by applying a compaction method, thus defining the metrics.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,ume),'Force'),'Layout algorithms that follow physical analogies by simulating a system of attractive and repulsive forces. The first successful method of this kind was proposed by Eades in 1984.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,'org.eclipse.elk.circle'),'Circle'),'Circular layout algorithms emphasize cycles or biconnected components of a graph by arranging them in circles. This is useful if a drawing is desired where such components are clearly grouped, or where cycles are shown as prominent OPTIONS of the graph.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,bre),'Tree'),'Specialized layout methods for trees, i.e. acyclic graphs. The regular structure of graphs that have no undirected cycles can be emphasized using an algorithm of this type.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,'org.eclipse.elk.planar'),'Planar'),'Algorithms that require a planar or upward planar graph. Most of these algorithms are theoretically interesting, but not practically usable.')));s4c(a,new W3c(b4c(d4c(c4c(new e4c,sre),'Radial'),'Radial layout algorithms usually position the nodes of the graph on concentric circles.')));$ad((new _ad,a));Y7c((new Z7c,a));jdd((new kdd,a))};var o8c,p8c,q8c,r8c,s8c,t8c,u8c,v8c,w8c,x8c,y8c,z8c,A8c,B8c,C8c,D8c,E8c,F8c,G8c,H8c,I8c,J8c,K8c,L8c,M8c,N8c,O8c,P8c,Q8c,R8c,S8c,T8c,U8c,V8c,W8c,X8c,Y8c,Z8c,$8c,_8c,a9c,b9c,c9c,d9c,e9c,f9c,g9c,h9c,i9c,j9c,k9c,l9c,m9c,n9c,o9c,p9c,q9c,r9c,s9c,t9c,u9c,v9c,w9c,x9c,y9c,z9c,A9c,B9c,C9c,D9c,E9c,F9c,G9c,H9c,I9c,J9c,K9c,L9c,M9c,N9c,O9c,P9c,Q9c,R9c,S9c,T9c,U9c,V9c,W9c,X9c;var s1=mdb(ose,'CoreOptions',684);bcb(103,22,{3:1,35:1,22:1,103:1},iad);var _9c,aad,bad,cad,dad;var t1=ndb(ose,Cle,103,CI,kad,jad);var lad;bcb(272,22,{3:1,35:1,22:1,272:1},rad);var nad,oad,pad;var u1=ndb(ose,'EdgeLabelPlacement',272,CI,tad,sad);var uad;bcb(218,22,{3:1,35:1,22:1,218:1},Bad);var wad,xad,yad,zad;var v1=ndb(ose,'EdgeRouting',218,CI,Dad,Cad);var Ead;bcb(312,22,{3:1,35:1,22:1,312:1},Nad);var Gad,Had,Iad,Jad,Kad,Lad;var w1=ndb(ose,'EdgeType',312,CI,Pad,Oad);var Qad;bcb(977,1,ale,_ad);_.Qe=function abd(a){$ad(a)};var Sad,Tad,Uad,Vad,Wad,Xad,Yad;var y1=mdb(ose,'FixedLayouterOptions',977);bcb(978,1,{},bbd);_.$e=function cbd(){var a;return a=new Zfd,a};_._e=function dbd(a){};var x1=mdb(ose,'FixedLayouterOptions/FixedFactory',978);bcb(334,22,{3:1,35:1,22:1,334:1},ibd);var ebd,fbd,gbd;var z1=ndb(ose,'HierarchyHandling',334,CI,kbd,jbd);var lbd;bcb(285,22,{3:1,35:1,22:1,285:1},tbd);var nbd,obd,pbd,qbd;var A1=ndb(ose,'LabelSide',285,CI,vbd,ubd);var wbd;bcb(93,22,{3:1,35:1,22:1,93:1},Ibd);var ybd,zbd,Abd,Bbd,Cbd,Dbd,Ebd,Fbd,Gbd;var B1=ndb(ose,'NodeLabelPlacement',93,CI,Lbd,Kbd);var Mbd;bcb(249,22,{3:1,35:1,22:1,249:1},Ubd);var Obd,Pbd,Qbd,Rbd,Sbd;var C1=ndb(ose,'PortAlignment',249,CI,Wbd,Vbd);var Xbd;bcb(98,22,{3:1,35:1,22:1,98:1},gcd);var Zbd,$bd,_bd,acd,bcd,ccd;var D1=ndb(ose,'PortConstraints',98,CI,icd,hcd);var jcd;bcb(273,22,{3:1,35:1,22:1,273:1},scd);var lcd,mcd,ncd,ocd,pcd,qcd;var E1=ndb(ose,'PortLabelPlacement',273,CI,wcd,vcd);var xcd;bcb(61,22,{3:1,35:1,22:1,61:1},Ycd);var zcd,Acd,Bcd,Ccd,Dcd,Ecd,Fcd,Gcd,Hcd,Icd,Jcd,Kcd,Lcd,Mcd,Ncd,Ocd,Pcd,Qcd,Rcd,Scd,Tcd;var F1=ndb(ose,'PortSide',61,CI,_cd,$cd);var bdd;bcb(981,1,ale,kdd);_.Qe=function ldd(a){jdd(a)};var ddd,edd,fdd,gdd,hdd;var H1=mdb(ose,'RandomLayouterOptions',981);bcb(982,1,{},mdd);_.$e=function ndd(){var a;return a=new Mgd,a};_._e=function odd(a){};var G1=mdb(ose,'RandomLayouterOptions/RandomFactory',982);bcb(374,22,{3:1,35:1,22:1,374:1},udd);var pdd,qdd,rdd,sdd;var I1=ndb(ose,'SizeConstraint',374,CI,wdd,vdd);var xdd;bcb(259,22,{3:1,35:1,22:1,259:1},Jdd);var zdd,Add,Bdd,Cdd,Ddd,Edd,Fdd,Gdd,Hdd;var J1=ndb(ose,'SizeOptions',259,CI,Ldd,Kdd);var Mdd;bcb(370,1,{1949:1},Zdd);_.b=false;_.c=0;_.d=-1;_.e=null;_.f=null;_.g=-1;_.j=false;_.k=false;_.n=false;_.o=0;_.q=0;_.r=0;var L1=mdb(yqe,'BasicProgressMonitor',370);bcb(972,209,Mle,ged);_.Ze=function ked(a,b){var c,d,e,f,g,h,i,j,k;Odd(b,'Box layout',2);e=Gdb(ED(hkd(a,(X7c(),W7c))));f=BD(hkd(a,T7c),116);c=Ccb(DD(hkd(a,O7c)));d=Ccb(DD(hkd(a,P7c)));switch(BD(hkd(a,M7c),311).g){case 0:g=(h=new Tkb((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a)),mmb(),Okb(h,new med(d)),h);i=rfd(a);j=ED(hkd(a,L7c));(j==null||(uCb(j),j)<=0)&&(j=1.3);k=ded(g,e,f,i.a,i.b,c,(uCb(j),j));Afd(a,k.a,k.b,false,true);break;default:eed(a,e,f,c);}Qdd(b)};var S1=mdb(yqe,'BoxLayoutProvider',972);bcb(973,1,Dke,med);_.ue=function ned(a,b){return led(this,BD(a,33),BD(b,33))};_.Fb=function oed(a){return this===a};_.ve=function ped(){return new tpb(this)};_.a=false;var M1=mdb(yqe,'BoxLayoutProvider/1',973);bcb(157,1,{157:1},wed,xed);_.Ib=function yed(){return this.c?_od(this.c):Fe(this.b)};var N1=mdb(yqe,'BoxLayoutProvider/Group',157);bcb(311,22,{3:1,35:1,22:1,311:1},Eed);var zed,Aed,Bed,Ced;var O1=ndb(yqe,'BoxLayoutProvider/PackingMode',311,CI,Ged,Fed);var Hed;bcb(974,1,Dke,Jed);_.ue=function Ked(a,b){return hed(BD(a,157),BD(b,157))};_.Fb=function Led(a){return this===a};_.ve=function Med(){return new tpb(this)};var P1=mdb(yqe,'BoxLayoutProvider/lambda$0$Type',974);bcb(975,1,Dke,Ned);_.ue=function Oed(a,b){return ied(BD(a,157),BD(b,157))};_.Fb=function Ped(a){return this===a};_.ve=function Qed(){return new tpb(this)};var Q1=mdb(yqe,'BoxLayoutProvider/lambda$1$Type',975);bcb(976,1,Dke,Red);_.ue=function Sed(a,b){return jed(BD(a,157),BD(b,157))};_.Fb=function Ted(a){return this===a};_.ve=function Ued(){return new tpb(this)};var R1=mdb(yqe,'BoxLayoutProvider/lambda$2$Type',976);bcb(1365,1,{831:1},Ved);_.qg=function Wed(a,b){return Vyc(),!JD(b,160)||h2c((Y1c(),X1c,BD(a,160)),b)};var T1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$0$Type',1365);bcb(1366,1,qie,Xed);_.td=function Yed(a){Yyc(this.a,BD(a,146))};var U1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$1$Type',1366);bcb(1367,1,qie,Zed);_.td=function $ed(a){BD(a,94);Vyc()};var V1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$2$Type',1367);bcb(1371,1,qie,_ed);_.td=function afd(a){Zyc(this.a,BD(a,94))};var W1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$3$Type',1371);bcb(1369,1,Oie,bfd);_.Mb=function cfd(a){return $yc(this.a,this.b,BD(a,146))};var X1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$4$Type',1369);bcb(1368,1,Oie,dfd);_.Mb=function efd(a){return azc(this.a,this.b,BD(a,831))};var Y1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$5$Type',1368);bcb(1370,1,qie,ffd);_.td=function gfd(a){_yc(this.a,this.b,BD(a,146))};var Z1=mdb(yqe,'ElkSpacings/AbstractSpacingsBuilder/lambda$6$Type',1370);bcb(935,1,{},Hfd);_.Kb=function Ifd(a){return Gfd(a)};_.Fb=function Jfd(a){return this===a};var _1=mdb(yqe,'ElkUtil/lambda$0$Type',935);bcb(936,1,qie,Kfd);_.td=function Lfd(a){ufd(this.a,this.b,BD(a,79))};_.a=0;_.b=0;var a2=mdb(yqe,'ElkUtil/lambda$1$Type',936);bcb(937,1,qie,Mfd);_.td=function Nfd(a){vfd(this.a,this.b,BD(a,202))};_.a=0;_.b=0;var b2=mdb(yqe,'ElkUtil/lambda$2$Type',937);bcb(938,1,qie,Ofd);_.td=function Pfd(a){wfd(this.a,this.b,BD(a,137))};_.a=0;_.b=0;var c2=mdb(yqe,'ElkUtil/lambda$3$Type',938);bcb(939,1,qie,Qfd);_.td=function Rfd(a){xfd(this.a,BD(a,469))};var d2=mdb(yqe,'ElkUtil/lambda$4$Type',939);bcb(342,1,{35:1,342:1},Tfd);_.wd=function Ufd(a){return Sfd(this,BD(a,236))};_.Fb=function Vfd(a){var b;if(JD(a,342)){b=BD(a,342);return this.a==b.a}return false};_.Hb=function Wfd(){return QD(this.a)};_.Ib=function Xfd(){return this.a+' (exclusive)'};_.a=0;var e2=mdb(yqe,'ExclusiveBounds/ExclusiveLowerBound',342);bcb(1138,209,Mle,Zfd);_.Ze=function $fd(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,A,B;Odd(b,'Fixed Layout',1);f=BD(hkd(a,(Y9c(),E8c)),218);l=0;m=0;for(s=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));s.e!=s.i.gc();){q=BD(Dyd(s),33);B=BD(hkd(q,(Zad(),Yad)),8);if(B){bld(q,B.a,B.b);if(BD(hkd(q,Tad),174).Hc((tdd(),pdd))){n=BD(hkd(q,Vad),8);n.a>0&&n.b>0&&Afd(q,n.a,n.b,true,true)}}l=$wnd.Math.max(l,q.i+q.g);m=$wnd.Math.max(m,q.j+q.f);for(j=new Fyd((!q.n&&(q.n=new cUd(D2,q,1,7)),q.n));j.e!=j.i.gc();){h=BD(Dyd(j),137);B=BD(hkd(h,Yad),8);!!B&&bld(h,B.a,B.b);l=$wnd.Math.max(l,q.i+h.i+h.g);m=$wnd.Math.max(m,q.j+h.j+h.f)}for(v=new Fyd((!q.c&&(q.c=new cUd(F2,q,9,9)),q.c));v.e!=v.i.gc();){u=BD(Dyd(v),118);B=BD(hkd(u,Yad),8);!!B&&bld(u,B.a,B.b);w=q.i+u.i;A=q.j+u.j;l=$wnd.Math.max(l,w+u.g);m=$wnd.Math.max(m,A+u.f);for(i=new Fyd((!u.n&&(u.n=new cUd(D2,u,1,7)),u.n));i.e!=i.i.gc();){h=BD(Dyd(i),137);B=BD(hkd(h,Yad),8);!!B&&bld(h,B.a,B.b);l=$wnd.Math.max(l,w+h.i+h.g);m=$wnd.Math.max(m,A+h.j+h.f)}}for(e=new Sr(ur(_sd(q).a.Kc(),new Sq));Qr(e);){c=BD(Rr(e),79);k=Yfd(c);l=$wnd.Math.max(l,k.a);m=$wnd.Math.max(m,k.b)}for(d=new Sr(ur($sd(q).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),79);if(Xod(jtd(c))!=a){k=Yfd(c);l=$wnd.Math.max(l,k.a);m=$wnd.Math.max(m,k.b)}}}if(f==(Aad(),wad)){for(r=new Fyd((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a));r.e!=r.i.gc();){q=BD(Dyd(r),33);for(d=new Sr(ur(_sd(q).a.Kc(),new Sq));Qr(d);){c=BD(Rr(d),79);g=pfd(c);g.b==0?jkd(c,Q8c,null):jkd(c,Q8c,g)}}}if(!Ccb(DD(hkd(a,(Zad(),Uad))))){t=BD(hkd(a,Wad),116);p=l+t.b+t.c;o=m+t.d+t.a;Afd(a,p,o,true,true)}Qdd(b)};var f2=mdb(yqe,'FixedLayoutProvider',1138);bcb(373,134,{3:1,414:1,373:1,94:1,134:1},_fd,agd);_.Jf=function dgd(b){var c,d,e,f,g,h,i,j,k;if(!b){return}try{j=mfb(b,';,;');for(g=j,h=0,i=g.length;h>16&aje|b^d<<16};_.Kc=function zgd(){return new Bgd(this)};_.Ib=function Agd(){return this.a==null&&this.b==null?'pair(null,null)':this.a==null?'pair(null,'+fcb(this.b)+')':this.b==null?'pair('+fcb(this.a)+',null)':'pair('+fcb(this.a)+','+fcb(this.b)+')'};var n2=mdb(yqe,'Pair',46);bcb(983,1,aie,Bgd);_.Nb=function Cgd(a){Rrb(this,a)};_.Ob=function Dgd(){return !this.c&&(!this.b&&this.a.a!=null||this.a.b!=null)};_.Pb=function Egd(){if(!this.c&&!this.b&&this.a.a!=null){this.b=true;return this.a.a}else if(!this.c&&this.a.b!=null){this.c=true;return this.a.b}throw vbb(new utb)};_.Qb=function Fgd(){this.c&&this.a.b!=null?(this.a.b=null):this.b&&this.a.a!=null&&(this.a.a=null);throw vbb(new Ydb)};_.b=false;_.c=false;var m2=mdb(yqe,'Pair/1',983);bcb(448,1,{448:1},Ggd);_.Fb=function Hgd(a){return wtb(this.a,BD(a,448).a)&&wtb(this.c,BD(a,448).c)&&wtb(this.d,BD(a,448).d)&&wtb(this.b,BD(a,448).b)};_.Hb=function Igd(){return Hlb(OC(GC(SI,1),Uhe,1,5,[this.a,this.c,this.d,this.b]))};_.Ib=function Jgd(){return '('+this.a+She+this.c+She+this.d+She+this.b+')'};var o2=mdb(yqe,'Quadruple',448);bcb(1126,209,Mle,Mgd);_.Ze=function Ngd(a,b){var c,d,e,f,g;Odd(b,'Random Layout',1);if((!a.a&&(a.a=new cUd(E2,a,10,11)),a.a).i==0){Qdd(b);return}f=BD(hkd(a,(idd(),gdd)),19);!!f&&f.a!=0?(e=new Hub(f.a)):(e=new Gub);c=Gdb(ED(hkd(a,ddd)));g=Gdb(ED(hkd(a,hdd)));d=BD(hkd(a,edd),116);Lgd(a,e,c,g,d);Qdd(b)};var p2=mdb(yqe,'RandomLayoutProvider',1126);var Ogd;bcb(553,1,{});_.qf=function Sgd(){return new f7c(this.f.i,this.f.j)};_.We=function Tgd(a){if(Jsd(a,(Y9c(),s9c))){return hkd(this.f,Qgd)}return hkd(this.f,a)};_.rf=function Ugd(){return new f7c(this.f.g,this.f.f)};_.sf=function Vgd(){return this.g};_.Xe=function Wgd(a){return ikd(this.f,a)};_.tf=function Xgd(a){dld(this.f,a.a);eld(this.f,a.b)};_.uf=function Ygd(a){cld(this.f,a.a);ald(this.f,a.b)};_.vf=function Zgd(a){this.g=a};_.g=0;var Qgd;var q2=mdb(Use,'ElkGraphAdapters/AbstractElkGraphElementAdapter',553);bcb(554,1,{839:1},$gd);_.wf=function _gd(){var a,b;if(!this.b){this.b=Qu(Kkd(this.a).i);for(b=new Fyd(Kkd(this.a));b.e!=b.i.gc();){a=BD(Dyd(b),137);Ekb(this.b,new dhd(a))}}return this.b};_.b=null;var r2=mdb(Use,'ElkGraphAdapters/ElkEdgeAdapter',554);bcb(301,553,{},bhd);_.xf=function chd(){return ahd(this)};_.a=null;var s2=mdb(Use,'ElkGraphAdapters/ElkGraphAdapter',301);bcb(630,553,{181:1},dhd);var t2=mdb(Use,'ElkGraphAdapters/ElkLabelAdapter',630);bcb(629,553,{680:1},hhd);_.wf=function khd(){return ehd(this)};_.Af=function lhd(){var a;return a=BD(hkd(this.f,(Y9c(),S8c)),142),!a&&(a=new H_b),a};_.Cf=function nhd(){return fhd(this)};_.Ef=function phd(a){var b;b=new K_b(a);jkd(this.f,(Y9c(),S8c),b)};_.Ff=function qhd(a){jkd(this.f,(Y9c(),f9c),new r0b(a))};_.yf=function ihd(){return this.d};_.zf=function jhd(){var a,b;if(!this.a){this.a=new Rkb;for(b=new Sr(ur($sd(BD(this.f,33)).a.Kc(),new Sq));Qr(b);){a=BD(Rr(b),79);Ekb(this.a,new $gd(a))}}return this.a};_.Bf=function mhd(){var a,b;if(!this.c){this.c=new Rkb;for(b=new Sr(ur(_sd(BD(this.f,33)).a.Kc(),new Sq));Qr(b);){a=BD(Rr(b),79);Ekb(this.c,new $gd(a))}}return this.c};_.Df=function ohd(){return Vod(BD(this.f,33)).i!=0||Ccb(DD(BD(this.f,33).We((Y9c(),M8c))))};_.Gf=function rhd(){ghd(this,(Pgd(),Ogd))};_.a=null;_.b=null;_.c=null;_.d=null;_.e=null;var u2=mdb(Use,'ElkGraphAdapters/ElkNodeAdapter',629);bcb(1266,553,{838:1},thd);_.wf=function vhd(){return shd(this)};_.zf=function uhd(){var a,b;if(!this.a){this.a=Pu(BD(this.f,118).xg().i);for(b=new Fyd(BD(this.f,118).xg());b.e!=b.i.gc();){a=BD(Dyd(b),79);Ekb(this.a,new $gd(a))}}return this.a};_.Bf=function whd(){var a,b;if(!this.c){this.c=Pu(BD(this.f,118).yg().i);for(b=new Fyd(BD(this.f,118).yg());b.e!=b.i.gc();){a=BD(Dyd(b),79);Ekb(this.c,new $gd(a))}}return this.c};_.Hf=function xhd(){return BD(BD(this.f,118).We((Y9c(),A9c)),61)};_.If=function yhd(){var a,b,c,d,e,f,g,h;d=mpd(BD(this.f,118));for(c=new Fyd(BD(this.f,118).yg());c.e!=c.i.gc();){a=BD(Dyd(c),79);for(h=new Fyd((!a.c&&(a.c=new y5d(z2,a,5,8)),a.c));h.e!=h.i.gc();){g=BD(Dyd(h),82);if(ntd(atd(g),d)){return true}else if(atd(g)==d&&Ccb(DD(hkd(a,(Y9c(),N8c))))){return true}}}for(b=new Fyd(BD(this.f,118).xg());b.e!=b.i.gc();){a=BD(Dyd(b),79);for(f=new Fyd((!a.b&&(a.b=new y5d(z2,a,4,7)),a.b));f.e!=f.i.gc();){e=BD(Dyd(f),82);if(ntd(atd(e),d)){return true}}}return false};_.a=null;_.b=null;_.c=null;var v2=mdb(Use,'ElkGraphAdapters/ElkPortAdapter',1266);bcb(1267,1,Dke,Ahd);_.ue=function Bhd(a,b){return zhd(BD(a,118),BD(b,118))};_.Fb=function Chd(a){return this===a};_.ve=function Dhd(){return new tpb(this)};var w2=mdb(Use,'ElkGraphAdapters/PortComparator',1267);var m5=odb(Vse,'EObject');var x2=odb(Wse,Xse);var y2=odb(Wse,Yse);var C2=odb(Wse,Zse);var G2=odb(Wse,'ElkShape');var z2=odb(Wse,$se);var B2=odb(Wse,_se);var A2=odb(Wse,ate);var k5=odb(Vse,bte);var i5=odb(Vse,'EFactory');var Ehd;var l5=odb(Vse,cte);var o5=odb(Vse,'EPackage');var Ghd;var Ihd,Jhd,Khd,Lhd,Mhd,Nhd,Ohd,Phd,Qhd,Rhd,Shd;var D2=odb(Wse,dte);var E2=odb(Wse,ete);var F2=odb(Wse,fte);bcb(90,1,gte);_.Jg=function Vhd(){this.Kg();return null};_.Kg=function Whd(){return null};_.Lg=function Xhd(){return this.Kg(),false};_.Mg=function Yhd(){return false};_.Ng=function Zhd(a){Uhd(this,a)};var b4=mdb(hte,'BasicNotifierImpl',90);bcb(97,90,pte);_.nh=function fjd(){return oid(this)};_.Og=function Fid(a,b){return a};_.Pg=function Gid(){throw vbb(new bgb)};_.Qg=function Hid(a){var b;return b=zUd(BD(XKd(this.Tg(),this.Vg()),18)),this.eh().ih(this,b.n,b.f,a)};_.Rg=function Iid(a,b){throw vbb(new bgb)};_.Sg=function Jid(a,b,c){return _hd(this,a,b,c)};_.Tg=function Kid(){var a;if(this.Pg()){a=this.Pg().ck();if(a){return a}}return this.zh()};_.Ug=function Lid(){return aid(this)};_.Vg=function Mid(){throw vbb(new bgb)};_.Wg=function Oid(){var a,b;b=this.ph().dk();!b&&this.Pg().ik(b=(nRd(),a=pNd(TKd(this.Tg())),a==null?mRd:new qRd(this,a)));return b};_.Xg=function Qid(a,b){return a};_.Yg=function Rid(a){var b;b=a.Gj();return !b?bLd(this.Tg(),a):a.aj()};_.Zg=function Sid(){var a;a=this.Pg();return !a?null:a.fk()};_.$g=function Tid(){return !this.Pg()?null:this.Pg().ck()};_._g=function Uid(a,b,c){return fid(this,a,b,c)};_.ah=function Vid(a){return gid(this,a)};_.bh=function Wid(a,b){return hid(this,a,b)};_.dh=function Xid(){var a;a=this.Pg();return !!a&&a.gk()};_.eh=function Yid(){throw vbb(new bgb)};_.fh=function Zid(){return jid(this)};_.gh=function $id(a,b,c,d){return kid(this,a,b,d)};_.hh=function _id(a,b,c){var d;return d=BD(XKd(this.Tg(),b),66),d.Nj().Qj(this,this.yh(),b-this.Ah(),a,c)};_.ih=function ajd(a,b,c,d){return lid(this,a,b,d)};_.jh=function bjd(a,b,c){var d;return d=BD(XKd(this.Tg(),b),66),d.Nj().Rj(this,this.yh(),b-this.Ah(),a,c)};_.kh=function cjd(){return !!this.Pg()&&!!this.Pg().ek()};_.lh=function djd(a){return mid(this,a)};_.mh=function ejd(a){return nid(this,a)};_.oh=function gjd(a){return rid(this,a)};_.ph=function hjd(){throw vbb(new bgb)};_.qh=function ijd(){return !this.Pg()?null:this.Pg().ek()};_.rh=function jjd(){return jid(this)};_.sh=function kjd(a,b){yid(this,a,b)};_.th=function ljd(a){this.ph().hk(a)};_.uh=function mjd(a){this.ph().kk(a)};_.vh=function njd(a){this.ph().jk(a)};_.wh=function ojd(a,b){var c,d,e,f;f=this.Zg();if(!!f&&!!a){b=Txd(f.Vk(),this,b);f.Zk(this)}d=this.eh();if(d){if((Nid(this,this.eh(),this.Vg()).Bb&Tje)!=0){e=d.fh();!!e&&(!a?e.Yk(this):!f&&e.Zk(this))}else{b=(c=this.Vg(),c>=0?this.Qg(b):this.eh().ih(this,-1-c,null,b));b=this.Sg(null,-1,b)}}this.uh(a);return b};_.xh=function pjd(a){var b,c,d,e,f,g,h,i;c=this.Tg();f=bLd(c,a);b=this.Ah();if(f>=b){return BD(a,66).Nj().Uj(this,this.yh(),f-b)}else if(f<=-1){g=e1d((O6d(),M6d),c,a);if(g){Q6d();BD(g,66).Oj()||(g=_1d(q1d(M6d,g)));e=(d=this.Yg(g),BD(d>=0?this._g(d,true,true):sid(this,g,true),153));i=g.Zj();if(i>1||i==-1){return BD(BD(e,215).hl(a,false),76)}}else{throw vbb(new Wdb(ite+a.ne()+lte))}}else if(a.$j()){return d=this.Yg(a),BD(d>=0?this._g(d,false,true):sid(this,a,false),76)}h=new nGd(this,a);return h};_.yh=function qjd(){return Aid(this)};_.zh=function rjd(){return (NFd(),MFd).S};_.Ah=function sjd(){return aLd(this.zh())};_.Bh=function tjd(a){Cid(this,a)};_.Ib=function ujd(){return Eid(this)};var B5=mdb(qte,'BasicEObjectImpl',97);var zFd;bcb(114,97,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1});_.Ch=function Djd(a){var b;b=xjd(this);return b[a]};_.Dh=function Ejd(a,b){var c;c=xjd(this);NC(c,a,b)};_.Eh=function Fjd(a){var b;b=xjd(this);NC(b,a,null)};_.Jg=function Gjd(){return BD(Ajd(this,4),126)};_.Kg=function Hjd(){throw vbb(new bgb)};_.Lg=function Ijd(){return (this.Db&4)!=0};_.Pg=function Jjd(){throw vbb(new bgb)};_.Fh=function Kjd(a){Cjd(this,2,a)};_.Rg=function Ljd(a,b){this.Db=b<<16|this.Db&255;this.Fh(a)};_.Tg=function Mjd(){return wjd(this)};_.Vg=function Njd(){return this.Db>>16};_.Wg=function Ojd(){var a,b;return nRd(),b=pNd(TKd((a=BD(Ajd(this,16),26),!a?this.zh():a))),b==null?(null,mRd):new qRd(this,b)};_.Mg=function Pjd(){return (this.Db&1)==0};_.Zg=function Qjd(){return BD(Ajd(this,128),1935)};_.$g=function Rjd(){return BD(Ajd(this,16),26)};_.dh=function Sjd(){return (this.Db&32)!=0};_.eh=function Tjd(){return BD(Ajd(this,2),49)};_.kh=function Ujd(){return (this.Db&64)!=0};_.ph=function Vjd(){throw vbb(new bgb)};_.qh=function Wjd(){return BD(Ajd(this,64),281)};_.th=function Xjd(a){Cjd(this,16,a)};_.uh=function Yjd(a){Cjd(this,128,a)};_.vh=function Zjd(a){Cjd(this,64,a)};_.yh=function $jd(){return yjd(this)};_.Db=0;var s8=mdb(qte,'MinimalEObjectImpl',114);bcb(115,114,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_.Fh=function _jd(a){this.Cb=a};_.eh=function akd(){return this.Cb};var r8=mdb(qte,'MinimalEObjectImpl/Container',115);bcb(1985,115,{105:1,413:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function kkd(a,b,c){return bkd(this,a,b,c)};_.jh=function lkd(a,b,c){return ckd(this,a,b,c)};_.lh=function mkd(a){return dkd(this,a)};_.sh=function nkd(a,b){ekd(this,a,b)};_.zh=function okd(){return Thd(),Shd};_.Bh=function pkd(a){fkd(this,a)};_.Ve=function qkd(){return gkd(this)};_.We=function rkd(a){return hkd(this,a)};_.Xe=function skd(a){return ikd(this,a)};_.Ye=function tkd(a,b){return jkd(this,a,b)};var H2=mdb(rte,'EMapPropertyHolderImpl',1985);bcb(567,115,{105:1,469:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},xkd);_._g=function ykd(a,b,c){switch(a){case 0:return this.a;case 1:return this.b;}return fid(this,a,b,c)};_.lh=function zkd(a){switch(a){case 0:return this.a!=0;case 1:return this.b!=0;}return mid(this,a)};_.sh=function Akd(a,b){switch(a){case 0:vkd(this,Edb(ED(b)));return;case 1:wkd(this,Edb(ED(b)));return;}yid(this,a,b)};_.zh=function Bkd(){return Thd(),Ihd};_.Bh=function Ckd(a){switch(a){case 0:vkd(this,0);return;case 1:wkd(this,0);return;}Cid(this,a)};_.Ib=function Dkd(){var a;if((this.Db&64)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (x: ';Bfb(a,this.a);a.a+=', y: ';Bfb(a,this.b);a.a+=')';return a.a};_.a=0;_.b=0;var I2=mdb(rte,'ElkBendPointImpl',567);bcb(723,1985,{105:1,413:1,160:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function Nkd(a,b,c){return Ekd(this,a,b,c)};_.hh=function Okd(a,b,c){return Fkd(this,a,b,c)};_.jh=function Pkd(a,b,c){return Gkd(this,a,b,c)};_.lh=function Qkd(a){return Hkd(this,a)};_.sh=function Rkd(a,b){Ikd(this,a,b)};_.zh=function Skd(){return Thd(),Mhd};_.Bh=function Tkd(a){Jkd(this,a)};_.zg=function Ukd(){return this.k};_.Ag=function Vkd(){return Kkd(this)};_.Ib=function Wkd(){return Mkd(this)};_.k=null;var M2=mdb(rte,'ElkGraphElementImpl',723);bcb(724,723,{105:1,413:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function gld(a,b,c){return Xkd(this,a,b,c)};_.lh=function hld(a){return Ykd(this,a)};_.sh=function ild(a,b){Zkd(this,a,b)};_.zh=function jld(){return Thd(),Rhd};_.Bh=function kld(a){$kd(this,a)};_.Bg=function lld(){return this.f};_.Cg=function mld(){return this.g};_.Dg=function nld(){return this.i};_.Eg=function old(){return this.j};_.Fg=function pld(a,b){_kd(this,a,b)};_.Gg=function qld(a,b){bld(this,a,b)};_.Hg=function rld(a){dld(this,a)};_.Ig=function sld(a){eld(this,a)};_.Ib=function tld(){return fld(this)};_.f=0;_.g=0;_.i=0;_.j=0;var T2=mdb(rte,'ElkShapeImpl',724);bcb(725,724,{105:1,413:1,82:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1});_._g=function Bld(a,b,c){return uld(this,a,b,c)};_.hh=function Cld(a,b,c){return vld(this,a,b,c)};_.jh=function Dld(a,b,c){return wld(this,a,b,c)};_.lh=function Eld(a){return xld(this,a)};_.sh=function Fld(a,b){yld(this,a,b)};_.zh=function Gld(){return Thd(),Jhd};_.Bh=function Hld(a){zld(this,a)};_.xg=function Ild(){return !this.d&&(this.d=new y5d(B2,this,8,5)),this.d};_.yg=function Jld(){return !this.e&&(this.e=new y5d(B2,this,7,4)),this.e};var J2=mdb(rte,'ElkConnectableShapeImpl',725);bcb(352,723,{105:1,413:1,79:1,160:1,352:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},Tld);_.Qg=function Uld(a){return Lld(this,a)};_._g=function Vld(a,b,c){switch(a){case 3:return Mld(this);case 4:return !this.b&&(this.b=new y5d(z2,this,4,7)),this.b;case 5:return !this.c&&(this.c=new y5d(z2,this,5,8)),this.c;case 6:return !this.a&&(this.a=new cUd(A2,this,6,6)),this.a;case 7:return Bcb(),!this.b&&(this.b=new y5d(z2,this,4,7)),this.b.i<=1&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i<=1)?false:true;case 8:return Bcb(),Pld(this)?true:false;case 9:return Bcb(),Qld(this)?true:false;case 10:return Bcb(),!this.b&&(this.b=new y5d(z2,this,4,7)),this.b.i!=0&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i!=0)?true:false;}return Ekd(this,a,b,c)};_.hh=function Wld(a,b,c){var d;switch(b){case 3:!!this.Cb&&(c=(d=this.Db>>16,d>=0?Lld(this,c):this.Cb.ih(this,-1-d,null,c)));return Kld(this,BD(a,33),c);case 4:return !this.b&&(this.b=new y5d(z2,this,4,7)),Sxd(this.b,a,c);case 5:return !this.c&&(this.c=new y5d(z2,this,5,8)),Sxd(this.c,a,c);case 6:return !this.a&&(this.a=new cUd(A2,this,6,6)),Sxd(this.a,a,c);}return Fkd(this,a,b,c)};_.jh=function Xld(a,b,c){switch(b){case 3:return Kld(this,null,c);case 4:return !this.b&&(this.b=new y5d(z2,this,4,7)),Txd(this.b,a,c);case 5:return !this.c&&(this.c=new y5d(z2,this,5,8)),Txd(this.c,a,c);case 6:return !this.a&&(this.a=new cUd(A2,this,6,6)),Txd(this.a,a,c);}return Gkd(this,a,b,c)};_.lh=function Yld(a){switch(a){case 3:return !!Mld(this);case 4:return !!this.b&&this.b.i!=0;case 5:return !!this.c&&this.c.i!=0;case 6:return !!this.a&&this.a.i!=0;case 7:return !this.b&&(this.b=new y5d(z2,this,4,7)),!(this.b.i<=1&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i<=1));case 8:return Pld(this);case 9:return Qld(this);case 10:return !this.b&&(this.b=new y5d(z2,this,4,7)),this.b.i!=0&&(!this.c&&(this.c=new y5d(z2,this,5,8)),this.c.i!=0);}return Hkd(this,a)};_.sh=function Zld(a,b){switch(a){case 3:Rld(this,BD(b,33));return;case 4:!this.b&&(this.b=new y5d(z2,this,4,7));Uxd(this.b);!this.b&&(this.b=new y5d(z2,this,4,7));ytd(this.b,BD(b,14));return;case 5:!this.c&&(this.c=new y5d(z2,this,5,8));Uxd(this.c);!this.c&&(this.c=new y5d(z2,this,5,8));ytd(this.c,BD(b,14));return;case 6:!this.a&&(this.a=new cUd(A2,this,6,6));Uxd(this.a);!this.a&&(this.a=new cUd(A2,this,6,6));ytd(this.a,BD(b,14));return;}Ikd(this,a,b)};_.zh=function $ld(){return Thd(),Khd};_.Bh=function _ld(a){switch(a){case 3:Rld(this,null);return;case 4:!this.b&&(this.b=new y5d(z2,this,4,7));Uxd(this.b);return;case 5:!this.c&&(this.c=new y5d(z2,this,5,8));Uxd(this.c);return;case 6:!this.a&&(this.a=new cUd(A2,this,6,6));Uxd(this.a);return;}Jkd(this,a)};_.Ib=function amd(){return Sld(this)};var K2=mdb(rte,'ElkEdgeImpl',352);bcb(439,1985,{105:1,413:1,202:1,439:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},rmd);_.Qg=function smd(a){return cmd(this,a)};_._g=function tmd(a,b,c){switch(a){case 1:return this.j;case 2:return this.k;case 3:return this.b;case 4:return this.c;case 5:return !this.a&&(this.a=new xMd(y2,this,5)),this.a;case 6:return fmd(this);case 7:if(b)return emd(this);return this.i;case 8:if(b)return dmd(this);return this.f;case 9:return !this.g&&(this.g=new y5d(A2,this,9,10)),this.g;case 10:return !this.e&&(this.e=new y5d(A2,this,10,9)),this.e;case 11:return this.d;}return bkd(this,a,b,c)};_.hh=function umd(a,b,c){var d,e,f;switch(b){case 6:!!this.Cb&&(c=(e=this.Db>>16,e>=0?cmd(this,c):this.Cb.ih(this,-1-e,null,c)));return bmd(this,BD(a,79),c);case 9:return !this.g&&(this.g=new y5d(A2,this,9,10)),Sxd(this.g,a,c);case 10:return !this.e&&(this.e=new y5d(A2,this,10,9)),Sxd(this.e,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(Thd(),Lhd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((Thd(),Lhd)),a,c)};_.jh=function vmd(a,b,c){switch(b){case 5:return !this.a&&(this.a=new xMd(y2,this,5)),Txd(this.a,a,c);case 6:return bmd(this,null,c);case 9:return !this.g&&(this.g=new y5d(A2,this,9,10)),Txd(this.g,a,c);case 10:return !this.e&&(this.e=new y5d(A2,this,10,9)),Txd(this.e,a,c);}return ckd(this,a,b,c)};_.lh=function wmd(a){switch(a){case 1:return this.j!=0;case 2:return this.k!=0;case 3:return this.b!=0;case 4:return this.c!=0;case 5:return !!this.a&&this.a.i!=0;case 6:return !!fmd(this);case 7:return !!this.i;case 8:return !!this.f;case 9:return !!this.g&&this.g.i!=0;case 10:return !!this.e&&this.e.i!=0;case 11:return this.d!=null;}return dkd(this,a)};_.sh=function xmd(a,b){switch(a){case 1:omd(this,Edb(ED(b)));return;case 2:pmd(this,Edb(ED(b)));return;case 3:hmd(this,Edb(ED(b)));return;case 4:imd(this,Edb(ED(b)));return;case 5:!this.a&&(this.a=new xMd(y2,this,5));Uxd(this.a);!this.a&&(this.a=new xMd(y2,this,5));ytd(this.a,BD(b,14));return;case 6:mmd(this,BD(b,79));return;case 7:lmd(this,BD(b,82));return;case 8:kmd(this,BD(b,82));return;case 9:!this.g&&(this.g=new y5d(A2,this,9,10));Uxd(this.g);!this.g&&(this.g=new y5d(A2,this,9,10));ytd(this.g,BD(b,14));return;case 10:!this.e&&(this.e=new y5d(A2,this,10,9));Uxd(this.e);!this.e&&(this.e=new y5d(A2,this,10,9));ytd(this.e,BD(b,14));return;case 11:jmd(this,GD(b));return;}ekd(this,a,b)};_.zh=function ymd(){return Thd(),Lhd};_.Bh=function zmd(a){switch(a){case 1:omd(this,0);return;case 2:pmd(this,0);return;case 3:hmd(this,0);return;case 4:imd(this,0);return;case 5:!this.a&&(this.a=new xMd(y2,this,5));Uxd(this.a);return;case 6:mmd(this,null);return;case 7:lmd(this,null);return;case 8:kmd(this,null);return;case 9:!this.g&&(this.g=new y5d(A2,this,9,10));Uxd(this.g);return;case 10:!this.e&&(this.e=new y5d(A2,this,10,9));Uxd(this.e);return;case 11:jmd(this,null);return;}fkd(this,a)};_.Ib=function Amd(){return qmd(this)};_.b=0;_.c=0;_.d=null;_.j=0;_.k=0;var L2=mdb(rte,'ElkEdgeSectionImpl',439);bcb(150,115,{105:1,92:1,90:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1});_._g=function Emd(a,b,c){var d;if(a==0){return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.hh=function Fmd(a,b,c){var d,e;if(b==0){return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c)}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Qj(this,yjd(this),b-aLd(this.zh()),a,c)};_.jh=function Gmd(a,b,c){var d,e;if(b==0){return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c)}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function Hmd(a){var b;if(a==0){return !!this.Ab&&this.Ab.i!=0}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.oh=function Imd(a){return Bmd(this,a)};_.sh=function Jmd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.uh=function Kmd(a){Cjd(this,128,a)};_.zh=function Lmd(){return jGd(),ZFd};_.Bh=function Mmd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.Gh=function Nmd(){this.Bb|=1};_.Hh=function Omd(a){return Dmd(this,a)};_.Bb=0;var f6=mdb(qte,'EModelElementImpl',150);bcb(704,150,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},$md);_.Ih=function _md(a,b){return Vmd(this,a,b)};_.Jh=function and(a){var b,c,d,e,f;if(this.a!=bKd(a)||(a.Bb&256)!=0){throw vbb(new Wdb(xte+a.zb+ute))}for(d=_Kd(a);VKd(d.a).i!=0;){c=BD(nOd(d,0,(b=BD(qud(VKd(d.a),0),87),f=b.c,JD(f,88)?BD(f,26):(jGd(),_Fd))),26);if(dKd(c)){e=bKd(c).Nh().Jh(c);BD(e,49).th(a);return e}d=_Kd(c)}return (a.D!=null?a.D:a.B)=='java.util.Map$Entry'?new lHd(a):new _Gd(a)};_.Kh=function bnd(a,b){return Wmd(this,a,b)};_._g=function cnd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.a;}return bid(this,a-aLd((jGd(),WFd)),XKd((d=BD(Ajd(this,16),26),!d?WFd:d),a),b,c)};_.hh=function dnd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 1:!!this.a&&(c=BD(this.a,49).ih(this,4,o5,c));return Tmd(this,BD(a,235),c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),WFd):d),b),66),e.Nj().Qj(this,yjd(this),b-aLd((jGd(),WFd)),a,c)};_.jh=function end(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 1:return Tmd(this,null,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),WFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),WFd)),a,c)};_.lh=function fnd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return !!this.a;}return cid(this,a-aLd((jGd(),WFd)),XKd((b=BD(Ajd(this,16),26),!b?WFd:b),a))};_.sh=function gnd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:Ymd(this,BD(b,235));return;}did(this,a-aLd((jGd(),WFd)),XKd((c=BD(Ajd(this,16),26),!c?WFd:c),a),b)};_.zh=function hnd(){return jGd(),WFd};_.Bh=function ind(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:Ymd(this,null);return;}eid(this,a-aLd((jGd(),WFd)),XKd((b=BD(Ajd(this,16),26),!b?WFd:b),a))};var Pmd,Qmd,Rmd;var d6=mdb(qte,'EFactoryImpl',704);bcb(zte,704,{105:1,2014:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},knd);_.Ih=function lnd(a,b){switch(a.yj()){case 12:return BD(b,146).tg();case 13:return fcb(b);default:throw vbb(new Wdb(tte+a.ne()+ute));}};_.Jh=function mnd(a){var b,c,d,e,f,g,h,i;switch(a.G==-1&&(a.G=(b=bKd(a),b?HLd(b.Mh(),a):-1)),a.G){case 4:return f=new Jod,f;case 6:return g=new apd,g;case 7:return h=new ppd,h;case 8:return d=new Tld,d;case 9:return c=new xkd,c;case 10:return e=new rmd,e;case 11:return i=new Bpd,i;default:throw vbb(new Wdb(xte+a.zb+ute));}};_.Kh=function nnd(a,b){switch(a.yj()){case 13:case 12:return null;default:throw vbb(new Wdb(tte+a.ne()+ute));}};var N2=mdb(rte,'ElkGraphFactoryImpl',zte);bcb(438,150,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1});_.Wg=function rnd(){var a,b;b=(a=BD(Ajd(this,16),26),pNd(TKd(!a?this.zh():a)));return b==null?(nRd(),nRd(),mRd):new GRd(this,b)};_._g=function snd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.ne();}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.lh=function tnd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function und(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:this.Lh(GD(b));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function vnd(){return jGd(),$Fd};_.Bh=function wnd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:this.Lh(null);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.ne=function xnd(){return this.zb};_.Lh=function ynd(a){pnd(this,a)};_.Ib=function znd(){return qnd(this)};_.zb=null;var j6=mdb(qte,'ENamedElementImpl',438);bcb(179,438,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},eod);_.Qg=function god(a){return Snd(this,a)};_._g=function hod(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.yb;case 3:return this.xb;case 4:return this.sb;case 5:return !this.rb&&(this.rb=new jUd(this,d5,this)),this.rb;case 6:return !this.vb&&(this.vb=new gUd(o5,this,6,7)),this.vb;case 7:if(b)return this.Db>>16==7?BD(this.Cb,235):null;return Ind(this);}return bid(this,a-aLd((jGd(),cGd)),XKd((d=BD(Ajd(this,16),26),!d?cGd:d),a),b,c)};_.hh=function iod(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 4:!!this.sb&&(c=BD(this.sb,49).ih(this,1,i5,c));return Jnd(this,BD(a,471),c);case 5:return !this.rb&&(this.rb=new jUd(this,d5,this)),Sxd(this.rb,a,c);case 6:return !this.vb&&(this.vb=new gUd(o5,this,6,7)),Sxd(this.vb,a,c);case 7:!!this.Cb&&(c=(e=this.Db>>16,e>=0?Snd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,7,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),cGd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),cGd)),a,c)};_.jh=function jod(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 4:return Jnd(this,null,c);case 5:return !this.rb&&(this.rb=new jUd(this,d5,this)),Txd(this.rb,a,c);case 6:return !this.vb&&(this.vb=new gUd(o5,this,6,7)),Txd(this.vb,a,c);case 7:return _hd(this,null,7,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),cGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),cGd)),a,c)};_.lh=function kod(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.yb!=null;case 3:return this.xb!=null;case 4:return !!this.sb;case 5:return !!this.rb&&this.rb.i!=0;case 6:return !!this.vb&&this.vb.i!=0;case 7:return !!Ind(this);}return cid(this,a-aLd((jGd(),cGd)),XKd((b=BD(Ajd(this,16),26),!b?cGd:b),a))};_.oh=function lod(a){var b;b=Und(this,a);return b?b:Bmd(this,a)};_.sh=function mod(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:dod(this,GD(b));return;case 3:cod(this,GD(b));return;case 4:bod(this,BD(b,471));return;case 5:!this.rb&&(this.rb=new jUd(this,d5,this));Uxd(this.rb);!this.rb&&(this.rb=new jUd(this,d5,this));ytd(this.rb,BD(b,14));return;case 6:!this.vb&&(this.vb=new gUd(o5,this,6,7));Uxd(this.vb);!this.vb&&(this.vb=new gUd(o5,this,6,7));ytd(this.vb,BD(b,14));return;}did(this,a-aLd((jGd(),cGd)),XKd((c=BD(Ajd(this,16),26),!c?cGd:c),a),b)};_.vh=function nod(a){var b,c;if(!!a&&!!this.rb){for(c=new Fyd(this.rb);c.e!=c.i.gc();){b=Dyd(c);JD(b,351)&&(BD(b,351).w=null)}}Cjd(this,64,a)};_.zh=function ood(){return jGd(),cGd};_.Bh=function pod(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:dod(this,null);return;case 3:cod(this,null);return;case 4:bod(this,null);return;case 5:!this.rb&&(this.rb=new jUd(this,d5,this));Uxd(this.rb);return;case 6:!this.vb&&(this.vb=new gUd(o5,this,6,7));Uxd(this.vb);return;}eid(this,a-aLd((jGd(),cGd)),XKd((b=BD(Ajd(this,16),26),!b?cGd:b),a))};_.Gh=function qod(){Tnd(this)};_.Mh=function rod(){return !this.rb&&(this.rb=new jUd(this,d5,this)),this.rb};_.Nh=function sod(){return this.sb};_.Oh=function tod(){return this.ub};_.Ph=function uod(){return this.xb};_.Qh=function vod(){return this.yb};_.Rh=function wod(a){this.ub=a};_.Ib=function xod(){var a;if((this.Db&64)!=0)return qnd(this);a=new Jfb(qnd(this));a.a+=' (nsURI: ';Efb(a,this.yb);a.a+=', nsPrefix: ';Efb(a,this.xb);a.a+=')';return a.a};_.xb=null;_.yb=null;var And;var t6=mdb(qte,'EPackageImpl',179);bcb(555,179,{105:1,2016:1,555:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},Bod);_.q=false;_.r=false;var yod=false;var O2=mdb(rte,'ElkGraphPackageImpl',555);bcb(354,724,{105:1,413:1,160:1,137:1,470:1,354:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},Jod);_.Qg=function Kod(a){return Eod(this,a)};_._g=function Lod(a,b,c){switch(a){case 7:return Fod(this);case 8:return this.a;}return Xkd(this,a,b,c)};_.hh=function Mod(a,b,c){var d;switch(b){case 7:!!this.Cb&&(c=(d=this.Db>>16,d>=0?Eod(this,c):this.Cb.ih(this,-1-d,null,c)));return Dod(this,BD(a,160),c);}return Fkd(this,a,b,c)};_.jh=function Nod(a,b,c){if(b==7){return Dod(this,null,c)}return Gkd(this,a,b,c)};_.lh=function Ood(a){switch(a){case 7:return !!Fod(this);case 8:return !dfb('',this.a);}return Ykd(this,a)};_.sh=function Pod(a,b){switch(a){case 7:God(this,BD(b,160));return;case 8:Hod(this,GD(b));return;}Zkd(this,a,b)};_.zh=function Qod(){return Thd(),Nhd};_.Bh=function Rod(a){switch(a){case 7:God(this,null);return;case 8:Hod(this,'');return;}$kd(this,a)};_.Ib=function Sod(){return Iod(this)};_.a='';var P2=mdb(rte,'ElkLabelImpl',354);bcb(239,725,{105:1,413:1,82:1,160:1,33:1,470:1,239:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},apd);_.Qg=function bpd(a){return Uod(this,a)};_._g=function cpd(a,b,c){switch(a){case 9:return !this.c&&(this.c=new cUd(F2,this,9,9)),this.c;case 10:return !this.a&&(this.a=new cUd(E2,this,10,11)),this.a;case 11:return Xod(this);case 12:return !this.b&&(this.b=new cUd(B2,this,12,3)),this.b;case 13:return Bcb(),!this.a&&(this.a=new cUd(E2,this,10,11)),this.a.i>0?true:false;}return uld(this,a,b,c)};_.hh=function dpd(a,b,c){var d;switch(b){case 9:return !this.c&&(this.c=new cUd(F2,this,9,9)),Sxd(this.c,a,c);case 10:return !this.a&&(this.a=new cUd(E2,this,10,11)),Sxd(this.a,a,c);case 11:!!this.Cb&&(c=(d=this.Db>>16,d>=0?Uod(this,c):this.Cb.ih(this,-1-d,null,c)));return Tod(this,BD(a,33),c);case 12:return !this.b&&(this.b=new cUd(B2,this,12,3)),Sxd(this.b,a,c);}return vld(this,a,b,c)};_.jh=function epd(a,b,c){switch(b){case 9:return !this.c&&(this.c=new cUd(F2,this,9,9)),Txd(this.c,a,c);case 10:return !this.a&&(this.a=new cUd(E2,this,10,11)),Txd(this.a,a,c);case 11:return Tod(this,null,c);case 12:return !this.b&&(this.b=new cUd(B2,this,12,3)),Txd(this.b,a,c);}return wld(this,a,b,c)};_.lh=function fpd(a){switch(a){case 9:return !!this.c&&this.c.i!=0;case 10:return !!this.a&&this.a.i!=0;case 11:return !!Xod(this);case 12:return !!this.b&&this.b.i!=0;case 13:return !this.a&&(this.a=new cUd(E2,this,10,11)),this.a.i>0;}return xld(this,a)};_.sh=function gpd(a,b){switch(a){case 9:!this.c&&(this.c=new cUd(F2,this,9,9));Uxd(this.c);!this.c&&(this.c=new cUd(F2,this,9,9));ytd(this.c,BD(b,14));return;case 10:!this.a&&(this.a=new cUd(E2,this,10,11));Uxd(this.a);!this.a&&(this.a=new cUd(E2,this,10,11));ytd(this.a,BD(b,14));return;case 11:$od(this,BD(b,33));return;case 12:!this.b&&(this.b=new cUd(B2,this,12,3));Uxd(this.b);!this.b&&(this.b=new cUd(B2,this,12,3));ytd(this.b,BD(b,14));return;}yld(this,a,b)};_.zh=function hpd(){return Thd(),Ohd};_.Bh=function ipd(a){switch(a){case 9:!this.c&&(this.c=new cUd(F2,this,9,9));Uxd(this.c);return;case 10:!this.a&&(this.a=new cUd(E2,this,10,11));Uxd(this.a);return;case 11:$od(this,null);return;case 12:!this.b&&(this.b=new cUd(B2,this,12,3));Uxd(this.b);return;}zld(this,a)};_.Ib=function jpd(){return _od(this)};var Q2=mdb(rte,'ElkNodeImpl',239);bcb(186,725,{105:1,413:1,82:1,160:1,118:1,470:1,186:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},ppd);_.Qg=function qpd(a){return lpd(this,a)};_._g=function rpd(a,b,c){if(a==9){return mpd(this)}return uld(this,a,b,c)};_.hh=function spd(a,b,c){var d;switch(b){case 9:!!this.Cb&&(c=(d=this.Db>>16,d>=0?lpd(this,c):this.Cb.ih(this,-1-d,null,c)));return kpd(this,BD(a,33),c);}return vld(this,a,b,c)};_.jh=function tpd(a,b,c){if(b==9){return kpd(this,null,c)}return wld(this,a,b,c)};_.lh=function upd(a){if(a==9){return !!mpd(this)}return xld(this,a)};_.sh=function vpd(a,b){switch(a){case 9:npd(this,BD(b,33));return;}yld(this,a,b)};_.zh=function wpd(){return Thd(),Phd};_.Bh=function xpd(a){switch(a){case 9:npd(this,null);return;}zld(this,a)};_.Ib=function ypd(){return opd(this)};var R2=mdb(rte,'ElkPortImpl',186);var J4=odb(Tte,'BasicEMap/Entry');bcb(1092,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,114:1,115:1},Bpd);_.Fb=function Hpd(a){return this===a};_.cd=function Jpd(){return this.b};_.Hb=function Lpd(){return FCb(this)};_.Uh=function Npd(a){zpd(this,BD(a,146))};_._g=function Cpd(a,b,c){switch(a){case 0:return this.b;case 1:return this.c;}return fid(this,a,b,c)};_.lh=function Dpd(a){switch(a){case 0:return !!this.b;case 1:return this.c!=null;}return mid(this,a)};_.sh=function Epd(a,b){switch(a){case 0:zpd(this,BD(b,146));return;case 1:Apd(this,b);return;}yid(this,a,b)};_.zh=function Fpd(){return Thd(),Qhd};_.Bh=function Gpd(a){switch(a){case 0:zpd(this,null);return;case 1:Apd(this,null);return;}Cid(this,a)};_.Sh=function Ipd(){var a;if(this.a==-1){a=this.b;this.a=!a?0:tb(a)}return this.a};_.dd=function Kpd(){return this.c};_.Th=function Mpd(a){this.a=a};_.ed=function Opd(a){var b;b=this.c;Apd(this,a);return b};_.Ib=function Ppd(){var a;if((this.Db&64)!=0)return Eid(this);a=new Ufb;Qfb(Qfb(Qfb(a,this.b?this.b.tg():Xhe),gne),xfb(this.c));return a.a};_.a=-1;_.c=null;var S2=mdb(rte,'ElkPropertyToValueMapEntryImpl',1092);bcb(984,1,{},bqd);var U2=mdb(Wte,'JsonAdapter',984);bcb(210,60,Tie,cqd);var V2=mdb(Wte,'JsonImportException',210);bcb(857,1,{},ird);var J3=mdb(Wte,'JsonImporter',857);bcb(891,1,{},jrd);var W2=mdb(Wte,'JsonImporter/lambda$0$Type',891);bcb(892,1,{},krd);var X2=mdb(Wte,'JsonImporter/lambda$1$Type',892);bcb(900,1,{},lrd);var Y2=mdb(Wte,'JsonImporter/lambda$10$Type',900);bcb(902,1,{},mrd);var Z2=mdb(Wte,'JsonImporter/lambda$11$Type',902);bcb(903,1,{},nrd);var $2=mdb(Wte,'JsonImporter/lambda$12$Type',903);bcb(909,1,{},ord);var _2=mdb(Wte,'JsonImporter/lambda$13$Type',909);bcb(908,1,{},prd);var a3=mdb(Wte,'JsonImporter/lambda$14$Type',908);bcb(904,1,{},qrd);var b3=mdb(Wte,'JsonImporter/lambda$15$Type',904);bcb(905,1,{},rrd);var c3=mdb(Wte,'JsonImporter/lambda$16$Type',905);bcb(906,1,{},srd);var d3=mdb(Wte,'JsonImporter/lambda$17$Type',906);bcb(907,1,{},trd);var e3=mdb(Wte,'JsonImporter/lambda$18$Type',907);bcb(912,1,{},urd);var f3=mdb(Wte,'JsonImporter/lambda$19$Type',912);bcb(893,1,{},vrd);var g3=mdb(Wte,'JsonImporter/lambda$2$Type',893);bcb(910,1,{},wrd);var h3=mdb(Wte,'JsonImporter/lambda$20$Type',910);bcb(911,1,{},xrd);var i3=mdb(Wte,'JsonImporter/lambda$21$Type',911);bcb(915,1,{},yrd);var j3=mdb(Wte,'JsonImporter/lambda$22$Type',915);bcb(913,1,{},zrd);var k3=mdb(Wte,'JsonImporter/lambda$23$Type',913);bcb(914,1,{},Ard);var l3=mdb(Wte,'JsonImporter/lambda$24$Type',914);bcb(917,1,{},Brd);var m3=mdb(Wte,'JsonImporter/lambda$25$Type',917);bcb(916,1,{},Crd);var n3=mdb(Wte,'JsonImporter/lambda$26$Type',916);bcb(918,1,qie,Drd);_.td=function Erd(a){Bqd(this.b,this.a,GD(a))};var o3=mdb(Wte,'JsonImporter/lambda$27$Type',918);bcb(919,1,qie,Frd);_.td=function Grd(a){Cqd(this.b,this.a,GD(a))};var p3=mdb(Wte,'JsonImporter/lambda$28$Type',919);bcb(920,1,{},Hrd);var q3=mdb(Wte,'JsonImporter/lambda$29$Type',920);bcb(896,1,{},Ird);var r3=mdb(Wte,'JsonImporter/lambda$3$Type',896);bcb(921,1,{},Jrd);var s3=mdb(Wte,'JsonImporter/lambda$30$Type',921);bcb(922,1,{},Krd);var t3=mdb(Wte,'JsonImporter/lambda$31$Type',922);bcb(923,1,{},Lrd);var u3=mdb(Wte,'JsonImporter/lambda$32$Type',923);bcb(924,1,{},Mrd);var v3=mdb(Wte,'JsonImporter/lambda$33$Type',924);bcb(925,1,{},Nrd);var w3=mdb(Wte,'JsonImporter/lambda$34$Type',925);bcb(859,1,{},Prd);var x3=mdb(Wte,'JsonImporter/lambda$35$Type',859);bcb(929,1,{},Rrd);var y3=mdb(Wte,'JsonImporter/lambda$36$Type',929);bcb(926,1,qie,Srd);_.td=function Trd(a){Lqd(this.a,BD(a,469))};var z3=mdb(Wte,'JsonImporter/lambda$37$Type',926);bcb(927,1,qie,Urd);_.td=function Vrd(a){Mqd(this.a,this.b,BD(a,202))};var A3=mdb(Wte,'JsonImporter/lambda$38$Type',927);bcb(928,1,qie,Wrd);_.td=function Xrd(a){Nqd(this.a,this.b,BD(a,202))};var B3=mdb(Wte,'JsonImporter/lambda$39$Type',928);bcb(894,1,{},Yrd);var C3=mdb(Wte,'JsonImporter/lambda$4$Type',894);bcb(930,1,qie,Zrd);_.td=function $rd(a){Oqd(this.a,BD(a,8))};var D3=mdb(Wte,'JsonImporter/lambda$40$Type',930);bcb(895,1,{},_rd);var E3=mdb(Wte,'JsonImporter/lambda$5$Type',895);bcb(899,1,{},asd);var F3=mdb(Wte,'JsonImporter/lambda$6$Type',899);bcb(897,1,{},bsd);var G3=mdb(Wte,'JsonImporter/lambda$7$Type',897);bcb(898,1,{},csd);var H3=mdb(Wte,'JsonImporter/lambda$8$Type',898);bcb(901,1,{},dsd);var I3=mdb(Wte,'JsonImporter/lambda$9$Type',901);bcb(948,1,qie,msd);_.td=function nsd(a){Qpd(this.a,new yC(GD(a)))};var K3=mdb(Wte,'JsonMetaDataConverter/lambda$0$Type',948);bcb(949,1,qie,osd);_.td=function psd(a){isd(this.a,BD(a,237))};var L3=mdb(Wte,'JsonMetaDataConverter/lambda$1$Type',949);bcb(950,1,qie,qsd);_.td=function rsd(a){jsd(this.a,BD(a,149))};var M3=mdb(Wte,'JsonMetaDataConverter/lambda$2$Type',950);bcb(951,1,qie,ssd);_.td=function tsd(a){ksd(this.a,BD(a,175))};var N3=mdb(Wte,'JsonMetaDataConverter/lambda$3$Type',951);bcb(237,22,{3:1,35:1,22:1,237:1},Dsd);var usd,vsd,wsd,xsd,ysd,zsd,Asd,Bsd;var O3=ndb(Hle,'GraphFeature',237,CI,Fsd,Esd);var Gsd;bcb(13,1,{35:1,146:1},Lsd,Msd,Nsd,Osd);_.wd=function Psd(a){return Isd(this,BD(a,146))};_.Fb=function Qsd(a){return Jsd(this,a)};_.wg=function Rsd(){return Ksd(this)};_.tg=function Ssd(){return this.b};_.Hb=function Tsd(){return LCb(this.b)};_.Ib=function Usd(){return this.b};var T3=mdb(Hle,'Property',13);bcb(818,1,Dke,Wsd);_.ue=function Xsd(a,b){return Vsd(this,BD(a,94),BD(b,94))};_.Fb=function Ysd(a){return this===a};_.ve=function Zsd(){return new tpb(this)};var S3=mdb(Hle,'PropertyHolderComparator',818);bcb(695,1,aie,qtd);_.Nb=function rtd(a){Rrb(this,a)};_.Pb=function ttd(){return ptd(this)};_.Qb=function utd(){Srb()};_.Ob=function std(){return !!this.a};var U3=mdb(jue,'ElkGraphUtil/AncestorIterator',695);var T4=odb(Tte,'EList');bcb(67,52,{20:1,28:1,52:1,14:1,15:1,67:1,58:1});_.Vc=function Jtd(a,b){vtd(this,a,b)};_.Fc=function Ktd(a){return wtd(this,a)};_.Wc=function Ltd(a,b){return xtd(this,a,b)};_.Gc=function Mtd(a){return ytd(this,a)};_.Zh=function Ntd(){return new $yd(this)};_.$h=function Otd(){return new bzd(this)};_._h=function Ptd(a){return ztd(this,a)};_.ai=function Qtd(){return true};_.bi=function Rtd(a,b){};_.ci=function Std(){};_.di=function Ttd(a,b){Atd(this,a,b)};_.ei=function Utd(a,b,c){};_.fi=function Vtd(a,b){};_.gi=function Wtd(a,b,c){};_.Fb=function Xtd(a){return Btd(this,a)};_.Hb=function Ytd(){return Etd(this)};_.hi=function Ztd(){return false};_.Kc=function $td(){return new Fyd(this)};_.Yc=function _td(){return new Oyd(this)};_.Zc=function aud(a){var b;b=this.gc();if(a<0||a>b)throw vbb(new Cyd(a,b));return new Pyd(this,a)};_.ji=function bud(a,b){this.ii(a,this.Xc(b))};_.Mc=function cud(a){return Ftd(this,a)};_.li=function dud(a,b){return b};_._c=function eud(a,b){return Gtd(this,a,b)};_.Ib=function fud(){return Htd(this)};_.ni=function gud(){return true};_.oi=function hud(a,b){return Itd(this,b)};var p4=mdb(Tte,'AbstractEList',67);bcb(63,67,oue,yud,zud,Aud);_.Vh=function Bud(a,b){return iud(this,a,b)};_.Wh=function Cud(a){return jud(this,a)};_.Xh=function Dud(a,b){kud(this,a,b)};_.Yh=function Eud(a){lud(this,a)};_.pi=function Fud(a){return nud(this,a)};_.$b=function Gud(){oud(this)};_.Hc=function Hud(a){return pud(this,a)};_.Xb=function Iud(a){return qud(this,a)};_.qi=function Jud(a){var b,c,d;++this.j;c=this.g==null?0:this.g.length;if(a>c){d=this.g;b=c+(c/2|0)+4;b=0){this.$c(b);return true}else{return false}};_.mi=function lwd(a,b){return this.Ui(a,this.oi(a,b))};_.gc=function mwd(){return this.Vi()};_.Pc=function nwd(){return this.Wi()};_.Qc=function owd(a){return this.Xi(a)};_.Ib=function pwd(){return this.Yi()};var M4=mdb(Tte,'DelegatingEList',1995);bcb(1996,1995,eve);_.Vh=function xwd(a,b){return qwd(this,a,b)};_.Wh=function ywd(a){return this.Vh(this.Vi(),a)};_.Xh=function zwd(a,b){rwd(this,a,b)};_.Yh=function Awd(a){swd(this,a)};_.ai=function Bwd(){return !this.bj()};_.$b=function Cwd(){vwd(this)};_.Zi=function Dwd(a,b,c,d,e){return new Cxd(this,a,b,c,d,e)};_.$i=function Ewd(a){Uhd(this.Ai(),a)};_._i=function Fwd(){return null};_.aj=function Gwd(){return -1};_.Ai=function Hwd(){return null};_.bj=function Iwd(){return false};_.cj=function Jwd(a,b){return b};_.dj=function Kwd(a,b){return b};_.ej=function Lwd(){return false};_.fj=function Mwd(){return !this.Ri()};_.ii=function Nwd(a,b){var c,d;if(this.ej()){d=this.fj();c=Dvd(this,a,b);this.$i(this.Zi(7,meb(b),c,a,d));return c}else{return Dvd(this,a,b)}};_.$c=function Owd(a){var b,c,d,e;if(this.ej()){c=null;d=this.fj();b=this.Zi(4,e=Evd(this,a),null,a,d);if(this.bj()&&!!e){c=this.dj(e,c);if(!c){this.$i(b)}else{c.Ei(b);c.Fi()}}else{if(!c){this.$i(b)}else{c.Ei(b);c.Fi()}}return e}else{e=Evd(this,a);if(this.bj()&&!!e){c=this.dj(e,null);!!c&&c.Fi()}return e}};_.mi=function Pwd(a,b){return wwd(this,a,b)};var d4=mdb(hte,'DelegatingNotifyingListImpl',1996);bcb(143,1,fve);_.Ei=function pxd(a){return Qwd(this,a)};_.Fi=function qxd(){Rwd(this)};_.xi=function rxd(){return this.d};_._i=function sxd(){return null};_.gj=function txd(){return null};_.yi=function uxd(a){return -1};_.zi=function vxd(){return $wd(this)};_.Ai=function wxd(){return null};_.Bi=function xxd(){return hxd(this)};_.Ci=function yxd(){return this.o<0?this.o<-2?-2-this.o-1:-1:this.o};_.hj=function zxd(){return false};_.Di=function Axd(a){var b,c,d,e,f,g,h,i,j,k,l;switch(this.d){case 1:case 2:{e=a.xi();switch(e){case 1:case 2:{f=a.Ai();if(PD(f)===PD(this.Ai())&&this.yi(null)==a.yi(null)){this.g=a.zi();a.xi()==1&&(this.d=1);return true}}}}case 4:{e=a.xi();switch(e){case 4:{f=a.Ai();if(PD(f)===PD(this.Ai())&&this.yi(null)==a.yi(null)){j=jxd(this);i=this.o<0?this.o<-2?-2-this.o-1:-1:this.o;g=a.Ci();this.d=6;l=new zud(2);if(i<=g){wtd(l,this.n);wtd(l,a.Bi());this.g=OC(GC(WD,1),oje,25,15,[this.o=i,g+1])}else{wtd(l,a.Bi());wtd(l,this.n);this.g=OC(GC(WD,1),oje,25,15,[this.o=g,i])}this.n=l;j||(this.o=-2-this.o-1);return true}break}}break}case 6:{e=a.xi();switch(e){case 4:{f=a.Ai();if(PD(f)===PD(this.Ai())&&this.yi(null)==a.yi(null)){j=jxd(this);g=a.Ci();k=BD(this.g,48);d=KC(WD,oje,25,k.length+1,15,1);b=0;while(b>>0,b.toString(16)));d.a+=' (eventType: ';switch(this.d){case 1:{d.a+='SET';break}case 2:{d.a+='UNSET';break}case 3:{d.a+='ADD';break}case 5:{d.a+='ADD_MANY';break}case 4:{d.a+='REMOVE';break}case 6:{d.a+='REMOVE_MANY';break}case 7:{d.a+='MOVE';break}case 8:{d.a+='REMOVING_ADAPTER';break}case 9:{d.a+='RESOLVE';break}default:{Cfb(d,this.d);break}}ixd(this)&&(d.a+=', touch: true',d);d.a+=', position: ';Cfb(d,this.o<0?this.o<-2?-2-this.o-1:-1:this.o);d.a+=', notifier: ';Dfb(d,this.Ai());d.a+=', feature: ';Dfb(d,this._i());d.a+=', oldValue: ';Dfb(d,hxd(this));d.a+=', newValue: ';if(this.d==6&&JD(this.g,48)){c=BD(this.g,48);d.a+='[';for(a=0;a10){if(!this.b||this.c.j!=this.a){this.b=new Vqb(this);this.a=this.j}return Rqb(this.b,a)}else{return pud(this,a)}};_.ni=function Byd(){return true};_.a=0;var j4=mdb(Tte,'AbstractEList/1',953);bcb(295,73,Mje,Cyd);var k4=mdb(Tte,'AbstractEList/BasicIndexOutOfBoundsException',295);bcb(40,1,aie,Fyd);_.Nb=function Iyd(a){Rrb(this,a)};_.mj=function Gyd(){if(this.i.j!=this.f){throw vbb(new Apb)}};_.nj=function Hyd(){return Dyd(this)};_.Ob=function Jyd(){return this.e!=this.i.gc()};_.Pb=function Kyd(){return this.nj()};_.Qb=function Lyd(){Eyd(this)};_.e=0;_.f=0;_.g=-1;var l4=mdb(Tte,'AbstractEList/EIterator',40);bcb(278,40,jie,Oyd,Pyd);_.Qb=function Xyd(){Eyd(this)};_.Rb=function Qyd(a){Myd(this,a)};_.oj=function Ryd(){var b;try{b=this.d.Xb(--this.e);this.mj();this.g=this.e;return b}catch(a){a=ubb(a);if(JD(a,73)){this.mj();throw vbb(new utb)}else throw vbb(a)}};_.pj=function Syd(a){Nyd(this,a)};_.Sb=function Tyd(){return this.e!=0};_.Tb=function Uyd(){return this.e};_.Ub=function Vyd(){return this.oj()};_.Vb=function Wyd(){return this.e-1};_.Wb=function Yyd(a){this.pj(a)};var m4=mdb(Tte,'AbstractEList/EListIterator',278);bcb(341,40,aie,$yd);_.nj=function _yd(){return Zyd(this)};_.Qb=function azd(){throw vbb(new bgb)};var n4=mdb(Tte,'AbstractEList/NonResolvingEIterator',341);bcb(385,278,jie,bzd,czd);_.Rb=function dzd(a){throw vbb(new bgb)};_.nj=function ezd(){var b;try{b=this.c.ki(this.e);this.mj();this.g=this.e++;return b}catch(a){a=ubb(a);if(JD(a,73)){this.mj();throw vbb(new utb)}else throw vbb(a)}};_.oj=function fzd(){var b;try{b=this.c.ki(--this.e);this.mj();this.g=this.e;return b}catch(a){a=ubb(a);if(JD(a,73)){this.mj();throw vbb(new utb)}else throw vbb(a)}};_.Qb=function gzd(){throw vbb(new bgb)};_.Wb=function hzd(a){throw vbb(new bgb)};var o4=mdb(Tte,'AbstractEList/NonResolvingEListIterator',385);bcb(1982,67,ive);_.Vh=function pzd(a,b){var c,d,e,f,g,h,i,j,k,l,m;e=b.gc();if(e!=0){j=BD(Ajd(this.a,4),126);k=j==null?0:j.length;m=k+e;d=nzd(this,m);l=k-a;l>0&&$fb(j,a,d,a+e,l);i=b.Kc();for(g=0;gc)throw vbb(new Cyd(a,c));return new Yzd(this,a)};_.$b=function wzd(){var a,b;++this.j;a=BD(Ajd(this.a,4),126);b=a==null?0:a.length;b0d(this,null);Atd(this,b,a)};_.Hc=function xzd(a){var b,c,d,e,f;b=BD(Ajd(this.a,4),126);if(b!=null){if(a!=null){for(d=b,e=0,f=d.length;e=c)throw vbb(new Cyd(a,c));return b[a]};_.Xc=function zzd(a){var b,c,d;b=BD(Ajd(this.a,4),126);if(b!=null){if(a!=null){for(c=0,d=b.length;cc)throw vbb(new Cyd(a,c));return new Qzd(this,a)};_.ii=function Ezd(a,b){var c,d,e;c=mzd(this);e=c==null?0:c.length;if(a>=e)throw vbb(new qcb(lue+a+mue+e));if(b>=e)throw vbb(new qcb(nue+b+mue+e));d=c[b];if(a!=b){a0&&$fb(a,0,b,0,c);return b};_.Qc=function Kzd(a){var b,c,d;b=BD(Ajd(this.a,4),126);d=b==null?0:b.length;if(d>0){if(a.lengthd&&NC(a,d,null);return a};var jzd;var v4=mdb(Tte,'ArrayDelegatingEList',1982);bcb(1038,40,aie,Lzd);_.mj=function Mzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};_.Qb=function Nzd(){Eyd(this);this.a=BD(Ajd(this.b.a,4),126)};var r4=mdb(Tte,'ArrayDelegatingEList/EIterator',1038);bcb(706,278,jie,Pzd,Qzd);_.mj=function Rzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};_.pj=function Szd(a){Nyd(this,a);this.a=BD(Ajd(this.b.a,4),126)};_.Qb=function Tzd(){Eyd(this);this.a=BD(Ajd(this.b.a,4),126)};var s4=mdb(Tte,'ArrayDelegatingEList/EListIterator',706);bcb(1039,341,aie,Uzd);_.mj=function Vzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};var t4=mdb(Tte,'ArrayDelegatingEList/NonResolvingEIterator',1039);bcb(707,385,jie,Xzd,Yzd);_.mj=function Zzd(){if(this.b.j!=this.f||PD(BD(Ajd(this.b.a,4),126))!==PD(this.a)){throw vbb(new Apb)}};var u4=mdb(Tte,'ArrayDelegatingEList/NonResolvingEListIterator',707);bcb(606,295,Mje,$zd);var w4=mdb(Tte,'BasicEList/BasicIndexOutOfBoundsException',606);bcb(696,63,oue,_zd);_.Vc=function aAd(a,b){throw vbb(new bgb)};_.Fc=function bAd(a){throw vbb(new bgb)};_.Wc=function cAd(a,b){throw vbb(new bgb)};_.Gc=function dAd(a){throw vbb(new bgb)};_.$b=function eAd(){throw vbb(new bgb)};_.qi=function fAd(a){throw vbb(new bgb)};_.Kc=function gAd(){return this.Zh()};_.Yc=function hAd(){return this.$h()};_.Zc=function iAd(a){return this._h(a)};_.ii=function jAd(a,b){throw vbb(new bgb)};_.ji=function kAd(a,b){throw vbb(new bgb)};_.$c=function lAd(a){throw vbb(new bgb)};_.Mc=function mAd(a){throw vbb(new bgb)};_._c=function nAd(a,b){throw vbb(new bgb)};var x4=mdb(Tte,'BasicEList/UnmodifiableEList',696);bcb(705,1,{3:1,20:1,14:1,15:1,58:1,589:1});_.Vc=function OAd(a,b){oAd(this,a,BD(b,42))};_.Fc=function PAd(a){return pAd(this,BD(a,42))};_.Jc=function XAd(a){reb(this,a)};_.Xb=function YAd(a){return BD(qud(this.c,a),133)};_.ii=function fBd(a,b){return BD(this.c.ii(a,b),42)};_.ji=function gBd(a,b){GAd(this,a,BD(b,42))};_.Lc=function jBd(){return new YAb(null,new Kub(this,16))};_.$c=function kBd(a){return BD(this.c.$c(a),42)};_._c=function mBd(a,b){return MAd(this,a,BD(b,42))};_.ad=function oBd(a){ktb(this,a)};_.Nc=function pBd(){return new Kub(this,16)};_.Oc=function qBd(){return new YAb(null,new Kub(this,16))};_.Wc=function QAd(a,b){return this.c.Wc(a,b)};_.Gc=function RAd(a){return this.c.Gc(a)};_.$b=function SAd(){this.c.$b()};_.Hc=function TAd(a){return this.c.Hc(a)};_.Ic=function UAd(a){return Be(this.c,a)};_.qj=function VAd(){var a,b,c;if(this.d==null){this.d=KC(y4,jve,63,2*this.f+1,0,1);c=this.e;this.f=0;for(b=this.c.Kc();b.e!=b.i.gc();){a=BD(b.nj(),133);uAd(this,a)}this.e=c}};_.Fb=function WAd(a){return zAd(this,a)};_.Hb=function ZAd(){return Etd(this.c)};_.Xc=function $Ad(a){return this.c.Xc(a)};_.rj=function _Ad(){this.c=new yBd(this)};_.dc=function aBd(){return this.f==0};_.Kc=function bBd(){return this.c.Kc()};_.Yc=function cBd(){return this.c.Yc()};_.Zc=function dBd(a){return this.c.Zc(a)};_.sj=function eBd(){return FAd(this)};_.tj=function hBd(a,b,c){return new zCd(a,b,c)};_.uj=function iBd(){return new EBd};_.Mc=function lBd(a){return JAd(this,a)};_.gc=function nBd(){return this.f};_.bd=function rBd(a,b){return new Jib(this.c,a,b)};_.Pc=function sBd(){return this.c.Pc()};_.Qc=function tBd(a){return this.c.Qc(a)};_.Ib=function uBd(){return Htd(this.c)};_.e=0;_.f=0;var L4=mdb(Tte,'BasicEMap',705);bcb(1033,63,oue,yBd);_.bi=function zBd(a,b){vBd(this,BD(b,133))};_.ei=function BBd(a,b,c){var d;++(d=this,BD(b,133),d).a.e};_.fi=function CBd(a,b){wBd(this,BD(b,133))};_.gi=function DBd(a,b,c){xBd(this,BD(b,133),BD(c,133))};_.di=function ABd(a,b){tAd(this.a)};var z4=mdb(Tte,'BasicEMap/1',1033);bcb(1034,63,oue,EBd);_.ri=function FBd(a){return KC(I4,kve,612,a,0,1)};var A4=mdb(Tte,'BasicEMap/2',1034);bcb(1035,eie,fie,GBd);_.$b=function HBd(){this.a.c.$b()};_.Hc=function IBd(a){return qAd(this.a,a)};_.Kc=function JBd(){return this.a.f==0?(LCd(),KCd.a):new dCd(this.a)};_.Mc=function KBd(a){var b;b=this.a.f;LAd(this.a,a);return this.a.f!=b};_.gc=function LBd(){return this.a.f};var B4=mdb(Tte,'BasicEMap/3',1035);bcb(1036,28,die,MBd);_.$b=function NBd(){this.a.c.$b()};_.Hc=function OBd(a){return rAd(this.a,a)};_.Kc=function PBd(){return this.a.f==0?(LCd(),KCd.a):new fCd(this.a)};_.gc=function QBd(){return this.a.f};var C4=mdb(Tte,'BasicEMap/4',1036);bcb(1037,eie,fie,SBd);_.$b=function TBd(){this.a.c.$b()};_.Hc=function UBd(a){var b,c,d,e,f,g,h,i,j;if(this.a.f>0&&JD(a,42)){this.a.qj();i=BD(a,42);h=i.cd();e=h==null?0:tb(h);f=DAd(this.a,e);b=this.a.d[f];if(b){c=BD(b.g,367);j=b.i;for(g=0;g'+this.c};_.a=0;var I4=mdb(Tte,'BasicEMap/EntryImpl',612);bcb(536,1,{},JCd);var K4=mdb(Tte,'BasicEMap/View',536);var KCd;bcb(768,1,{});_.Fb=function ZCd(a){return At((mmb(),jmb),a)};_.Hb=function $Cd(){return qmb((mmb(),jmb))};_.Ib=function _Cd(){return Fe((mmb(),jmb))};var Q4=mdb(Tte,'ECollections/BasicEmptyUnmodifiableEList',768);bcb(1312,1,jie,aDd);_.Nb=function cDd(a){Rrb(this,a)};_.Rb=function bDd(a){throw vbb(new bgb)};_.Ob=function dDd(){return false};_.Sb=function eDd(){return false};_.Pb=function fDd(){throw vbb(new utb)};_.Tb=function gDd(){return 0};_.Ub=function hDd(){throw vbb(new utb)};_.Vb=function iDd(){return -1};_.Qb=function jDd(){throw vbb(new bgb)};_.Wb=function kDd(a){throw vbb(new bgb)};var P4=mdb(Tte,'ECollections/BasicEmptyUnmodifiableEList/1',1312);bcb(1310,768,{20:1,14:1,15:1,58:1},lDd);_.Vc=function mDd(a,b){OCd()};_.Fc=function nDd(a){return PCd()};_.Wc=function oDd(a,b){return QCd()};_.Gc=function pDd(a){return RCd()};_.$b=function qDd(){SCd()};_.Hc=function rDd(a){return false};_.Ic=function sDd(a){return false};_.Jc=function tDd(a){reb(this,a)};_.Xb=function uDd(a){return wmb((mmb(),jmb,a)),null};_.Xc=function vDd(a){return -1};_.dc=function wDd(){return true};_.Kc=function xDd(){return this.a};_.Yc=function yDd(){return this.a};_.Zc=function zDd(a){return this.a};_.ii=function ADd(a,b){return TCd()};_.ji=function BDd(a,b){UCd()};_.Lc=function CDd(){return new YAb(null,new Kub(this,16))};_.$c=function DDd(a){return VCd()};_.Mc=function EDd(a){return WCd()};_._c=function FDd(a,b){return XCd()};_.gc=function GDd(){return 0};_.ad=function HDd(a){ktb(this,a)};_.Nc=function IDd(){return new Kub(this,16)};_.Oc=function JDd(){return new YAb(null,new Kub(this,16))};_.bd=function KDd(a,b){return mmb(),new Jib(jmb,a,b)};_.Pc=function LDd(){return De((mmb(),jmb))};_.Qc=function MDd(a){return mmb(),Ee(jmb,a)};var R4=mdb(Tte,'ECollections/EmptyUnmodifiableEList',1310);bcb(1311,768,{20:1,14:1,15:1,58:1,589:1},NDd);_.Vc=function ODd(a,b){OCd()};_.Fc=function PDd(a){return PCd()};_.Wc=function QDd(a,b){return QCd()};_.Gc=function RDd(a){return RCd()};_.$b=function SDd(){SCd()};_.Hc=function TDd(a){return false};_.Ic=function UDd(a){return false};_.Jc=function VDd(a){reb(this,a)};_.Xb=function WDd(a){return wmb((mmb(),jmb,a)),null};_.Xc=function XDd(a){return -1};_.dc=function YDd(){return true};_.Kc=function ZDd(){return this.a};_.Yc=function $Dd(){return this.a};_.Zc=function _Dd(a){return this.a};_.ii=function bEd(a,b){return TCd()};_.ji=function cEd(a,b){UCd()};_.Lc=function dEd(){return new YAb(null,new Kub(this,16))};_.$c=function eEd(a){return VCd()};_.Mc=function fEd(a){return WCd()};_._c=function gEd(a,b){return XCd()};_.gc=function hEd(){return 0};_.ad=function iEd(a){ktb(this,a)};_.Nc=function jEd(){return new Kub(this,16)};_.Oc=function kEd(){return new YAb(null,new Kub(this,16))};_.bd=function lEd(a,b){return mmb(),new Jib(jmb,a,b)};_.Pc=function mEd(){return De((mmb(),jmb))};_.Qc=function nEd(a){return mmb(),Ee(jmb,a)};_.sj=function aEd(){return mmb(),mmb(),kmb};var S4=mdb(Tte,'ECollections/EmptyUnmodifiableEMap',1311);var U4=odb(Tte,'Enumerator');var oEd;bcb(281,1,{281:1},NEd);_.Fb=function REd(a){var b;if(this===a)return true;if(!JD(a,281))return false;b=BD(a,281);return this.f==b.f&&TEd(this.i,b.i)&&SEd(this.a,(this.f&256)!=0?(b.f&256)!=0?b.a:null:(b.f&256)!=0?null:b.a)&&SEd(this.d,b.d)&&SEd(this.g,b.g)&&SEd(this.e,b.e)&&KEd(this,b)};_.Hb=function WEd(){return this.f};_.Ib=function cFd(){return LEd(this)};_.f=0;var sEd=0,tEd=0,uEd=0,vEd=0,wEd=0,xEd=0,yEd=0,zEd=0,AEd=0,BEd,CEd=0,DEd=0,EEd=0,FEd=0,GEd,HEd;var Z4=mdb(Tte,'URI',281);bcb(1091,43,fke,mFd);_.zc=function nFd(a,b){return BD(Shb(this,GD(a),BD(b,281)),281)};var Y4=mdb(Tte,'URI/URICache',1091);bcb(497,63,oue,oFd,pFd);_.hi=function qFd(){return true};var $4=mdb(Tte,'UniqueEList',497);bcb(581,60,Tie,rFd);var _4=mdb(Tte,'WrappedException',581);var a5=odb(Vse,nve);var v5=odb(Vse,ove);var t5=odb(Vse,pve);var b5=odb(Vse,qve);var d5=odb(Vse,rve);var c5=odb(Vse,'EClass');var f5=odb(Vse,'EDataType');var sFd;bcb(1183,43,fke,vFd);_.xc=function wFd(a){return ND(a)?Phb(this,a):Wd(irb(this.f,a))};var e5=mdb(Vse,'EDataType/Internal/ConversionDelegate/Factory/Registry/Impl',1183);var h5=odb(Vse,'EEnum');var g5=odb(Vse,sve);var j5=odb(Vse,tve);var n5=odb(Vse,uve);var xFd;var p5=odb(Vse,vve);var q5=odb(Vse,wve);bcb(1029,1,{},BFd);_.Ib=function CFd(){return 'NIL'};var r5=mdb(Vse,'EStructuralFeature/Internal/DynamicValueHolder/1',1029);var DFd;bcb(1028,43,fke,GFd);_.xc=function HFd(a){return ND(a)?Phb(this,a):Wd(irb(this.f,a))};var s5=mdb(Vse,'EStructuralFeature/Internal/SettingDelegate/Factory/Registry/Impl',1028);var u5=odb(Vse,xve);var w5=odb(Vse,'EValidator/PatternMatcher');var IFd;var KFd;var MFd;var OFd,PFd,QFd,RFd,SFd,TFd,UFd,VFd,WFd,XFd,YFd,ZFd,$Fd,_Fd,aGd,bGd,cGd,dGd,eGd,fGd,gGd,hGd,iGd;var E9=odb(yve,'FeatureMap/Entry');bcb(535,1,{72:1},kGd);_.ak=function lGd(){return this.a};_.dd=function mGd(){return this.b};var x5=mdb(qte,'BasicEObjectImpl/1',535);bcb(1027,1,zve,nGd);_.Wj=function oGd(a){return hid(this.a,this.b,a)};_.fj=function pGd(){return nid(this.a,this.b)};_.Wb=function qGd(a){zid(this.a,this.b,a)};_.Xj=function rGd(){Did(this.a,this.b)};var y5=mdb(qte,'BasicEObjectImpl/4',1027);bcb(1983,1,{108:1});_.bk=function uGd(a){this.e=a==0?sGd:KC(SI,Uhe,1,a,5,1)};_.Ch=function vGd(a){return this.e[a]};_.Dh=function wGd(a,b){this.e[a]=b};_.Eh=function xGd(a){this.e[a]=null};_.ck=function yGd(){return this.c};_.dk=function zGd(){throw vbb(new bgb)};_.ek=function AGd(){throw vbb(new bgb)};_.fk=function BGd(){return this.d};_.gk=function CGd(){return this.e!=null};_.hk=function DGd(a){this.c=a};_.ik=function EGd(a){throw vbb(new bgb)};_.jk=function FGd(a){throw vbb(new bgb)};_.kk=function GGd(a){this.d=a};var sGd;var z5=mdb(qte,'BasicEObjectImpl/EPropertiesHolderBaseImpl',1983);bcb(185,1983,{108:1},HGd);_.dk=function IGd(){return this.a};_.ek=function JGd(){return this.b};_.ik=function KGd(a){this.a=a};_.jk=function LGd(a){this.b=a};var A5=mdb(qte,'BasicEObjectImpl/EPropertiesHolderImpl',185);bcb(506,97,pte,MGd);_.Kg=function NGd(){return this.f};_.Pg=function OGd(){return this.k};_.Rg=function PGd(a,b){this.g=a;this.i=b};_.Tg=function QGd(){return (this.j&2)==0?this.zh():this.ph().ck()};_.Vg=function RGd(){return this.i};_.Mg=function SGd(){return (this.j&1)!=0};_.eh=function TGd(){return this.g};_.kh=function UGd(){return (this.j&4)!=0};_.ph=function VGd(){return !this.k&&(this.k=new HGd),this.k};_.th=function WGd(a){this.ph().hk(a);a?(this.j|=2):(this.j&=-3)};_.vh=function XGd(a){this.ph().jk(a);a?(this.j|=4):(this.j&=-5)};_.zh=function YGd(){return (NFd(),MFd).S};_.i=0;_.j=1;var l6=mdb(qte,'EObjectImpl',506);bcb(780,506,{105:1,92:1,90:1,56:1,108:1,49:1,97:1},_Gd);_.Ch=function aHd(a){return this.e[a]};_.Dh=function bHd(a,b){this.e[a]=b};_.Eh=function cHd(a){this.e[a]=null};_.Tg=function dHd(){return this.d};_.Yg=function eHd(a){return bLd(this.d,a)};_.$g=function fHd(){return this.d};_.dh=function gHd(){return this.e!=null};_.ph=function hHd(){!this.k&&(this.k=new vHd);return this.k};_.th=function iHd(a){this.d=a};_.yh=function jHd(){var a;if(this.e==null){a=aLd(this.d);this.e=a==0?ZGd:KC(SI,Uhe,1,a,5,1)}return this};_.Ah=function kHd(){return 0};var ZGd;var E5=mdb(qte,'DynamicEObjectImpl',780);bcb(1376,780,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1},lHd);_.Fb=function nHd(a){return this===a};_.Hb=function rHd(){return FCb(this)};_.th=function mHd(a){this.d=a;this.b=YKd(a,'key');this.c=YKd(a,Bte)};_.Sh=function oHd(){var a;if(this.a==-1){a=iid(this,this.b);this.a=a==null?0:tb(a)}return this.a};_.cd=function pHd(){return iid(this,this.b)};_.dd=function qHd(){return iid(this,this.c)};_.Th=function sHd(a){this.a=a};_.Uh=function tHd(a){zid(this,this.b,a)};_.ed=function uHd(a){var b;b=iid(this,this.c);zid(this,this.c,a);return b};_.a=0;var C5=mdb(qte,'DynamicEObjectImpl/BasicEMapEntry',1376);bcb(1377,1,{108:1},vHd);_.bk=function wHd(a){throw vbb(new bgb)};_.Ch=function xHd(a){throw vbb(new bgb)};_.Dh=function yHd(a,b){throw vbb(new bgb)};_.Eh=function zHd(a){throw vbb(new bgb)};_.ck=function AHd(){throw vbb(new bgb)};_.dk=function BHd(){return this.a};_.ek=function CHd(){return this.b};_.fk=function DHd(){return this.c};_.gk=function EHd(){throw vbb(new bgb)};_.hk=function FHd(a){throw vbb(new bgb)};_.ik=function GHd(a){this.a=a};_.jk=function HHd(a){this.b=a};_.kk=function IHd(a){this.c=a};var D5=mdb(qte,'DynamicEObjectImpl/DynamicEPropertiesHolderImpl',1377);bcb(510,150,{105:1,92:1,90:1,590:1,147:1,56:1,108:1,49:1,97:1,510:1,150:1,114:1,115:1},RHd);_.Qg=function SHd(a){return KHd(this,a)};_._g=function THd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.d;case 2:return c?(!this.b&&(this.b=new sId((jGd(),fGd),x6,this)),this.b):(!this.b&&(this.b=new sId((jGd(),fGd),x6,this)),FAd(this.b));case 3:return MHd(this);case 4:return !this.a&&(this.a=new xMd(m5,this,4)),this.a;case 5:return !this.c&&(this.c=new _4d(m5,this,5)),this.c;}return bid(this,a-aLd((jGd(),OFd)),XKd((d=BD(Ajd(this,16),26),!d?OFd:d),a),b,c)};_.hh=function UHd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 3:!!this.Cb&&(c=(e=this.Db>>16,e>=0?KHd(this,c):this.Cb.ih(this,-1-e,null,c)));return JHd(this,BD(a,147),c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),OFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),OFd)),a,c)};_.jh=function VHd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 2:return !this.b&&(this.b=new sId((jGd(),fGd),x6,this)),bId(this.b,a,c);case 3:return JHd(this,null,c);case 4:return !this.a&&(this.a=new xMd(m5,this,4)),Txd(this.a,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),OFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),OFd)),a,c)};_.lh=function WHd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.d!=null;case 2:return !!this.b&&this.b.f!=0;case 3:return !!MHd(this);case 4:return !!this.a&&this.a.i!=0;case 5:return !!this.c&&this.c.i!=0;}return cid(this,a-aLd((jGd(),OFd)),XKd((b=BD(Ajd(this,16),26),!b?OFd:b),a))};_.sh=function XHd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:OHd(this,GD(b));return;case 2:!this.b&&(this.b=new sId((jGd(),fGd),x6,this));cId(this.b,b);return;case 3:NHd(this,BD(b,147));return;case 4:!this.a&&(this.a=new xMd(m5,this,4));Uxd(this.a);!this.a&&(this.a=new xMd(m5,this,4));ytd(this.a,BD(b,14));return;case 5:!this.c&&(this.c=new _4d(m5,this,5));Uxd(this.c);!this.c&&(this.c=new _4d(m5,this,5));ytd(this.c,BD(b,14));return;}did(this,a-aLd((jGd(),OFd)),XKd((c=BD(Ajd(this,16),26),!c?OFd:c),a),b)};_.zh=function YHd(){return jGd(),OFd};_.Bh=function ZHd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:PHd(this,null);return;case 2:!this.b&&(this.b=new sId((jGd(),fGd),x6,this));this.b.c.$b();return;case 3:NHd(this,null);return;case 4:!this.a&&(this.a=new xMd(m5,this,4));Uxd(this.a);return;case 5:!this.c&&(this.c=new _4d(m5,this,5));Uxd(this.c);return;}eid(this,a-aLd((jGd(),OFd)),XKd((b=BD(Ajd(this,16),26),!b?OFd:b),a))};_.Ib=function $Hd(){return QHd(this)};_.d=null;var G5=mdb(qte,'EAnnotationImpl',510);bcb(151,705,Ave,dId);_.Xh=function eId(a,b){_Hd(this,a,BD(b,42))};_.lk=function fId(a,b){return aId(this,BD(a,42),b)};_.pi=function gId(a){return BD(BD(this.c,69).pi(a),133)};_.Zh=function hId(){return BD(this.c,69).Zh()};_.$h=function iId(){return BD(this.c,69).$h()};_._h=function jId(a){return BD(this.c,69)._h(a)};_.mk=function kId(a,b){return bId(this,a,b)};_.Wj=function lId(a){return BD(this.c,76).Wj(a)};_.rj=function mId(){};_.fj=function nId(){return BD(this.c,76).fj()};_.tj=function oId(a,b,c){var d;d=BD(bKd(this.b).Nh().Jh(this.b),133);d.Th(a);d.Uh(b);d.ed(c);return d};_.uj=function pId(){return new W5d(this)};_.Wb=function qId(a){cId(this,a)};_.Xj=function rId(){BD(this.c,76).Xj()};var y9=mdb(yve,'EcoreEMap',151);bcb(158,151,Ave,sId);_.qj=function tId(){var a,b,c,d,e,f;if(this.d==null){f=KC(y4,jve,63,2*this.f+1,0,1);for(c=this.c.Kc();c.e!=c.i.gc();){b=BD(c.nj(),133);d=b.Sh();e=(d&Ohe)%f.length;a=f[e];!a&&(a=f[e]=new W5d(this));a.Fc(b)}this.d=f}};var F5=mdb(qte,'EAnnotationImpl/1',158);bcb(284,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,472:1,49:1,97:1,150:1,284:1,114:1,115:1});_._g=function GId(a,b,c){var d,e;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),this.$j()?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.jh=function HId(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function IId(a){var b,c;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return this.$j();case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function JId(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:this.Lh(GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:this.ok(BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function KId(){return jGd(),hGd};_.Bh=function LId(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:this.Lh(null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:this.ok(1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.Gh=function MId(){wId(this);this.Bb|=1};_.Yj=function NId(){return wId(this)};_.Zj=function OId(){return this.t};_.$j=function PId(){var a;return a=this.t,a>1||a==-1};_.hi=function QId(){return (this.Bb&512)!=0};_.nk=function RId(a,b){return zId(this,a,b)};_.ok=function SId(a){DId(this,a)};_.Ib=function TId(){return EId(this)};_.s=0;_.t=1;var v7=mdb(qte,'ETypedElementImpl',284);bcb(449,284,{105:1,92:1,90:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,449:1,284:1,114:1,115:1,677:1});_.Qg=function iJd(a){return UId(this,a)};_._g=function jJd(a,b,c){var d,e;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),this.$j()?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return Bcb(),(this.Bb&zte)!=0?true:false;case 11:return Bcb(),(this.Bb&Dve)!=0?true:false;case 12:return Bcb(),(this.Bb&Rje)!=0?true:false;case 13:return this.j;case 14:return VId(this);case 15:return Bcb(),(this.Bb&Cve)!=0?true:false;case 16:return Bcb(),(this.Bb&oie)!=0?true:false;case 17:return WId(this);}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.hh=function kJd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 17:!!this.Cb&&(c=(e=this.Db>>16,e>=0?UId(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,17,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),f.Nj().Qj(this,yjd(this),b-aLd(this.zh()),a,c)};_.jh=function lJd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);case 17:return _hd(this,null,17,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function mJd(a){var b,c;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return this.$j();case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return (this.Bb&zte)==0;case 11:return (this.Bb&Dve)!=0;case 12:return (this.Bb&Rje)!=0;case 13:return this.j!=null;case 14:return VId(this)!=null;case 15:return (this.Bb&Cve)!=0;case 16:return (this.Bb&oie)!=0;case 17:return !!WId(this);}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function nJd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:cJd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:this.ok(BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 10:ZId(this,Ccb(DD(b)));return;case 11:fJd(this,Ccb(DD(b)));return;case 12:dJd(this,Ccb(DD(b)));return;case 13:$Id(this,GD(b));return;case 15:eJd(this,Ccb(DD(b)));return;case 16:aJd(this,Ccb(DD(b)));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function oJd(){return jGd(),gGd};_.Bh=function pJd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),4);pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:this.ok(1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 10:ZId(this,true);return;case 11:fJd(this,false);return;case 12:dJd(this,false);return;case 13:this.i=null;_Id(this,null);return;case 15:eJd(this,false);return;case 16:aJd(this,false);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.Gh=function qJd(){a2d(q1d((O6d(),M6d),this));wId(this);this.Bb|=1};_.Gj=function rJd(){return this.f};_.zj=function sJd(){return VId(this)};_.Hj=function tJd(){return WId(this)};_.Lj=function uJd(){return null};_.pk=function vJd(){return this.k};_.aj=function wJd(){return this.n};_.Mj=function xJd(){return XId(this)};_.Nj=function yJd(){var a,b,c,d,e,f,g,h,i;if(!this.p){c=WId(this);(c.i==null&&TKd(c),c.i).length;d=this.Lj();!!d&&aLd(WId(d));e=wId(this);g=e.Bj();a=!g?null:(g.i&1)!=0?g==sbb?wI:g==WD?JI:g==VD?FI:g==UD?BI:g==XD?MI:g==rbb?UI:g==SD?xI:yI:g;b=VId(this);h=e.zj();n6d(this);(this.Bb&oie)!=0&&(!!(f=t1d((O6d(),M6d),c))&&f!=this||!!(f=_1d(q1d(M6d,this))))?(this.p=new zVd(this,f)):this.$j()?this.rk()?!d?(this.Bb&Cve)!=0?!a?this.sk()?(this.p=new KVd(42,this)):(this.p=new KVd(0,this)):a==CK?(this.p=new IVd(50,J4,this)):this.sk()?(this.p=new IVd(43,a,this)):(this.p=new IVd(1,a,this)):!a?this.sk()?(this.p=new KVd(44,this)):(this.p=new KVd(2,this)):a==CK?(this.p=new IVd(41,J4,this)):this.sk()?(this.p=new IVd(45,a,this)):(this.p=new IVd(3,a,this)):(this.Bb&Cve)!=0?!a?this.sk()?(this.p=new LVd(46,this,d)):(this.p=new LVd(4,this,d)):this.sk()?(this.p=new JVd(47,a,this,d)):(this.p=new JVd(5,a,this,d)):!a?this.sk()?(this.p=new LVd(48,this,d)):(this.p=new LVd(6,this,d)):this.sk()?(this.p=new JVd(49,a,this,d)):(this.p=new JVd(7,a,this,d)):JD(e,148)?a==E9?(this.p=new KVd(40,this)):(this.Bb&512)!=0?(this.Bb&Cve)!=0?!a?(this.p=new KVd(8,this)):(this.p=new IVd(9,a,this)):!a?(this.p=new KVd(10,this)):(this.p=new IVd(11,a,this)):(this.Bb&Cve)!=0?!a?(this.p=new KVd(12,this)):(this.p=new IVd(13,a,this)):!a?(this.p=new KVd(14,this)):(this.p=new IVd(15,a,this)):!d?this.sk()?(this.Bb&Cve)!=0?!a?(this.p=new KVd(16,this)):(this.p=new IVd(17,a,this)):!a?(this.p=new KVd(18,this)):(this.p=new IVd(19,a,this)):(this.Bb&Cve)!=0?!a?(this.p=new KVd(20,this)):(this.p=new IVd(21,a,this)):!a?(this.p=new KVd(22,this)):(this.p=new IVd(23,a,this)):(i=d.t,i>1||i==-1?this.sk()?(this.Bb&Cve)!=0?!a?(this.p=new LVd(24,this,d)):(this.p=new JVd(25,a,this,d)):!a?(this.p=new LVd(26,this,d)):(this.p=new JVd(27,a,this,d)):(this.Bb&Cve)!=0?!a?(this.p=new LVd(28,this,d)):(this.p=new JVd(29,a,this,d)):!a?(this.p=new LVd(30,this,d)):(this.p=new JVd(31,a,this,d)):this.sk()?(this.Bb&Cve)!=0?!a?(this.p=new LVd(32,this,d)):(this.p=new JVd(33,a,this,d)):!a?(this.p=new LVd(34,this,d)):(this.p=new JVd(35,a,this,d)):(this.Bb&Cve)!=0?!a?(this.p=new LVd(36,this,d)):(this.p=new JVd(37,a,this,d)):!a?(this.p=new LVd(38,this,d)):(this.p=new JVd(39,a,this,d))):this.qk()?this.sk()?(this.p=new kWd(BD(e,26),this,d)):(this.p=new cWd(BD(e,26),this,d)):JD(e,148)?a==E9?(this.p=new KVd(40,this)):(this.Bb&Cve)!=0?!a?(this.p=new jXd(BD(e,148),b,h,this)):(this.p=new lXd(b,h,this,(CWd(),g==WD?yWd:g==sbb?tWd:g==XD?zWd:g==VD?xWd:g==UD?wWd:g==rbb?BWd:g==SD?uWd:g==TD?vWd:AWd))):!a?(this.p=new cXd(BD(e,148),b,h,this)):(this.p=new eXd(b,h,this,(CWd(),g==WD?yWd:g==sbb?tWd:g==XD?zWd:g==VD?xWd:g==UD?wWd:g==rbb?BWd:g==SD?uWd:g==TD?vWd:AWd))):this.rk()?!d?(this.Bb&Cve)!=0?this.sk()?(this.p=new FXd(BD(e,26),this)):(this.p=new DXd(BD(e,26),this)):this.sk()?(this.p=new BXd(BD(e,26),this)):(this.p=new zXd(BD(e,26),this)):(this.Bb&Cve)!=0?this.sk()?(this.p=new NXd(BD(e,26),this,d)):(this.p=new LXd(BD(e,26),this,d)):this.sk()?(this.p=new JXd(BD(e,26),this,d)):(this.p=new HXd(BD(e,26),this,d)):this.sk()?!d?(this.Bb&Cve)!=0?(this.p=new RXd(BD(e,26),this)):(this.p=new PXd(BD(e,26),this)):(this.Bb&Cve)!=0?(this.p=new VXd(BD(e,26),this,d)):(this.p=new TXd(BD(e,26),this,d)):!d?(this.Bb&Cve)!=0?(this.p=new XXd(BD(e,26),this)):(this.p=new nXd(BD(e,26),this)):(this.Bb&Cve)!=0?(this.p=new _Xd(BD(e,26),this,d)):(this.p=new ZXd(BD(e,26),this,d))}return this.p};_.Ij=function zJd(){return (this.Bb&zte)!=0};_.qk=function AJd(){return false};_.rk=function BJd(){return false};_.Jj=function CJd(){return (this.Bb&oie)!=0};_.Oj=function DJd(){return YId(this)};_.sk=function EJd(){return false};_.Kj=function FJd(){return (this.Bb&Cve)!=0};_.tk=function GJd(a){this.k=a};_.Lh=function HJd(a){cJd(this,a)};_.Ib=function IJd(){return gJd(this)};_.e=false;_.n=0;var n7=mdb(qte,'EStructuralFeatureImpl',449);bcb(322,449,{105:1,92:1,90:1,34:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,322:1,150:1,449:1,284:1,114:1,115:1,677:1},OJd);_._g=function PJd(a,b,c){var d,e;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),LJd(this)?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return Bcb(),(this.Bb&zte)!=0?true:false;case 11:return Bcb(),(this.Bb&Dve)!=0?true:false;case 12:return Bcb(),(this.Bb&Rje)!=0?true:false;case 13:return this.j;case 14:return VId(this);case 15:return Bcb(),(this.Bb&Cve)!=0?true:false;case 16:return Bcb(),(this.Bb&oie)!=0?true:false;case 17:return WId(this);case 18:return Bcb(),(this.Bb&ote)!=0?true:false;case 19:if(b)return KJd(this);return JJd(this);}return bid(this,a-aLd((jGd(),PFd)),XKd((d=BD(Ajd(this,16),26),!d?PFd:d),a),b,c)};_.lh=function QJd(a){var b,c;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return LJd(this);case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return (this.Bb&zte)==0;case 11:return (this.Bb&Dve)!=0;case 12:return (this.Bb&Rje)!=0;case 13:return this.j!=null;case 14:return VId(this)!=null;case 15:return (this.Bb&Cve)!=0;case 16:return (this.Bb&oie)!=0;case 17:return !!WId(this);case 18:return (this.Bb&ote)!=0;case 19:return !!JJd(this);}return cid(this,a-aLd((jGd(),PFd)),XKd((b=BD(Ajd(this,16),26),!b?PFd:b),a))};_.sh=function RJd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:cJd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:NJd(this,BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 10:ZId(this,Ccb(DD(b)));return;case 11:fJd(this,Ccb(DD(b)));return;case 12:dJd(this,Ccb(DD(b)));return;case 13:$Id(this,GD(b));return;case 15:eJd(this,Ccb(DD(b)));return;case 16:aJd(this,Ccb(DD(b)));return;case 18:MJd(this,Ccb(DD(b)));return;}did(this,a-aLd((jGd(),PFd)),XKd((c=BD(Ajd(this,16),26),!c?PFd:c),a),b)};_.zh=function SJd(){return jGd(),PFd};_.Bh=function TJd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),4);pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:this.b=0;DId(this,1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 10:ZId(this,true);return;case 11:fJd(this,false);return;case 12:dJd(this,false);return;case 13:this.i=null;_Id(this,null);return;case 15:eJd(this,false);return;case 16:aJd(this,false);return;case 18:MJd(this,false);return;}eid(this,a-aLd((jGd(),PFd)),XKd((b=BD(Ajd(this,16),26),!b?PFd:b),a))};_.Gh=function UJd(){KJd(this);a2d(q1d((O6d(),M6d),this));wId(this);this.Bb|=1};_.$j=function VJd(){return LJd(this)};_.nk=function WJd(a,b){this.b=0;this.a=null;return zId(this,a,b)};_.ok=function XJd(a){NJd(this,a)};_.Ib=function YJd(){var a;if((this.Db&64)!=0)return gJd(this);a=new Jfb(gJd(this));a.a+=' (iD: ';Ffb(a,(this.Bb&ote)!=0);a.a+=')';return a.a};_.b=0;var H5=mdb(qte,'EAttributeImpl',322);bcb(351,438,{105:1,92:1,90:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,351:1,150:1,114:1,115:1,676:1});_.uk=function nKd(a){return a.Tg()==this};_.Qg=function oKd(a){return aKd(this,a)};_.Rg=function pKd(a,b){this.w=null;this.Db=b<<16|this.Db&255;this.Cb=a};_._g=function qKd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.D!=null?this.D:this.B;case 3:return dKd(this);case 4:return this.zj();case 5:return this.F;case 6:if(b)return bKd(this);return ZJd(this);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),this.A;}return bid(this,a-aLd(this.zh()),XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),a),b,c)};_.hh=function rKd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 6:!!this.Cb&&(c=(e=this.Db>>16,e>=0?aKd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,6,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),f.Nj().Qj(this,yjd(this),b-aLd(this.zh()),a,c)};_.jh=function sKd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 6:return _hd(this,null,6,c);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),Txd(this.A,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?this.zh():d),b),66),e.Nj().Rj(this,yjd(this),b-aLd(this.zh()),a,c)};_.lh=function tKd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.D!=null&&this.D==this.F;case 3:return !!dKd(this);case 4:return this.zj()!=null;case 5:return this.F!=null&&this.F!=this.D&&this.F!=this.B;case 6:return !!ZJd(this);case 7:return !!this.A&&this.A.i!=0;}return cid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.sh=function uKd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:lKd(this,GD(b));return;case 2:iKd(this,GD(b));return;case 5:kKd(this,GD(b));return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);!this.A&&(this.A=new K4d(u5,this,7));ytd(this.A,BD(b,14));return;}did(this,a-aLd(this.zh()),XKd((c=BD(Ajd(this,16),26),!c?this.zh():c),a),b)};_.zh=function vKd(){return jGd(),RFd};_.Bh=function wKd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,179)&&(BD(this.Cb,179).tb=null);pnd(this,null);return;case 2:$Jd(this,null);_Jd(this,this.D);return;case 5:kKd(this,null);return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);return;}eid(this,a-aLd(this.zh()),XKd((b=BD(Ajd(this,16),26),!b?this.zh():b),a))};_.yj=function xKd(){var a;return this.G==-1&&(this.G=(a=bKd(this),a?HLd(a.Mh(),this):-1)),this.G};_.zj=function yKd(){return null};_.Aj=function zKd(){return bKd(this)};_.vk=function AKd(){return this.v};_.Bj=function BKd(){return dKd(this)};_.Cj=function CKd(){return this.D!=null?this.D:this.B};_.Dj=function DKd(){return this.F};_.wj=function EKd(a){return fKd(this,a)};_.wk=function FKd(a){this.v=a};_.xk=function GKd(a){gKd(this,a)};_.yk=function HKd(a){this.C=a};_.Lh=function IKd(a){lKd(this,a)};_.Ib=function JKd(){return mKd(this)};_.C=null;_.D=null;_.G=-1;var Z5=mdb(qte,'EClassifierImpl',351);bcb(88,351,{105:1,92:1,90:1,26:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,88:1,351:1,150:1,473:1,114:1,115:1,676:1},hLd);_.uk=function iLd(a){return dLd(this,a.Tg())};_._g=function jLd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.D!=null?this.D:this.B;case 3:return dKd(this);case 4:return null;case 5:return this.F;case 6:if(b)return bKd(this);return ZJd(this);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),this.A;case 8:return Bcb(),(this.Bb&256)!=0?true:false;case 9:return Bcb(),(this.Bb&512)!=0?true:false;case 10:return _Kd(this);case 11:return !this.q&&(this.q=new cUd(n5,this,11,10)),this.q;case 12:return OKd(this);case 13:return SKd(this);case 14:return SKd(this),this.r;case 15:return OKd(this),this.k;case 16:return PKd(this);case 17:return RKd(this);case 18:return TKd(this);case 19:return UKd(this);case 20:return OKd(this),this.o;case 21:return !this.s&&(this.s=new cUd(t5,this,21,17)),this.s;case 22:return VKd(this);case 23:return QKd(this);}return bid(this,a-aLd((jGd(),QFd)),XKd((d=BD(Ajd(this,16),26),!d?QFd:d),a),b,c)};_.hh=function kLd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 6:!!this.Cb&&(c=(e=this.Db>>16,e>=0?aKd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,6,c);case 11:return !this.q&&(this.q=new cUd(n5,this,11,10)),Sxd(this.q,a,c);case 21:return !this.s&&(this.s=new cUd(t5,this,21,17)),Sxd(this.s,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),QFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),QFd)),a,c)};_.jh=function lLd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 6:return _hd(this,null,6,c);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),Txd(this.A,a,c);case 11:return !this.q&&(this.q=new cUd(n5,this,11,10)),Txd(this.q,a,c);case 21:return !this.s&&(this.s=new cUd(t5,this,21,17)),Txd(this.s,a,c);case 22:return Txd(VKd(this),a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),QFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),QFd)),a,c)};_.lh=function mLd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.D!=null&&this.D==this.F;case 3:return !!dKd(this);case 4:return false;case 5:return this.F!=null&&this.F!=this.D&&this.F!=this.B;case 6:return !!ZJd(this);case 7:return !!this.A&&this.A.i!=0;case 8:return (this.Bb&256)!=0;case 9:return (this.Bb&512)!=0;case 10:return !!this.u&&VKd(this.u.a).i!=0&&!(!!this.n&&FMd(this.n));case 11:return !!this.q&&this.q.i!=0;case 12:return OKd(this).i!=0;case 13:return SKd(this).i!=0;case 14:return SKd(this),this.r.i!=0;case 15:return OKd(this),this.k.i!=0;case 16:return PKd(this).i!=0;case 17:return RKd(this).i!=0;case 18:return TKd(this).i!=0;case 19:return UKd(this).i!=0;case 20:return OKd(this),!!this.o;case 21:return !!this.s&&this.s.i!=0;case 22:return !!this.n&&FMd(this.n);case 23:return QKd(this).i!=0;}return cid(this,a-aLd((jGd(),QFd)),XKd((b=BD(Ajd(this,16),26),!b?QFd:b),a))};_.oh=function nLd(a){var b;b=this.i==null||!!this.q&&this.q.i!=0?null:YKd(this,a);return b?b:Bmd(this,a)};_.sh=function oLd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:lKd(this,GD(b));return;case 2:iKd(this,GD(b));return;case 5:kKd(this,GD(b));return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);!this.A&&(this.A=new K4d(u5,this,7));ytd(this.A,BD(b,14));return;case 8:eLd(this,Ccb(DD(b)));return;case 9:fLd(this,Ccb(DD(b)));return;case 10:vwd(_Kd(this));ytd(_Kd(this),BD(b,14));return;case 11:!this.q&&(this.q=new cUd(n5,this,11,10));Uxd(this.q);!this.q&&(this.q=new cUd(n5,this,11,10));ytd(this.q,BD(b,14));return;case 21:!this.s&&(this.s=new cUd(t5,this,21,17));Uxd(this.s);!this.s&&(this.s=new cUd(t5,this,21,17));ytd(this.s,BD(b,14));return;case 22:Uxd(VKd(this));ytd(VKd(this),BD(b,14));return;}did(this,a-aLd((jGd(),QFd)),XKd((c=BD(Ajd(this,16),26),!c?QFd:c),a),b)};_.zh=function pLd(){return jGd(),QFd};_.Bh=function qLd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,179)&&(BD(this.Cb,179).tb=null);pnd(this,null);return;case 2:$Jd(this,null);_Jd(this,this.D);return;case 5:kKd(this,null);return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);return;case 8:eLd(this,false);return;case 9:fLd(this,false);return;case 10:!!this.u&&vwd(this.u);return;case 11:!this.q&&(this.q=new cUd(n5,this,11,10));Uxd(this.q);return;case 21:!this.s&&(this.s=new cUd(t5,this,21,17));Uxd(this.s);return;case 22:!!this.n&&Uxd(this.n);return;}eid(this,a-aLd((jGd(),QFd)),XKd((b=BD(Ajd(this,16),26),!b?QFd:b),a))};_.Gh=function rLd(){var a,b;OKd(this);SKd(this);PKd(this);RKd(this);TKd(this);UKd(this);QKd(this);oud(SMd($Kd(this)));if(this.s){for(a=0,b=this.s.i;a=0;--b){qud(this,b)}}return xud(this,a)};_.Xj=function nMd(){Uxd(this)};_.oi=function oMd(a,b){return LLd(this,a,b)};var t9=mdb(yve,'EcoreEList',622);bcb(496,622,Pve,pMd);_.ai=function qMd(){return false};_.aj=function rMd(){return this.c};_.bj=function sMd(){return false};_.Fk=function tMd(){return true};_.hi=function uMd(){return true};_.li=function vMd(a,b){return b};_.ni=function wMd(){return false};_.c=0;var d9=mdb(yve,'EObjectEList',496);bcb(85,496,Pve,xMd);_.bj=function yMd(){return true};_.Dk=function zMd(){return false};_.rk=function AMd(){return true};var Z8=mdb(yve,'EObjectContainmentEList',85);bcb(545,85,Pve,BMd);_.ci=function CMd(){this.b=true};_.fj=function DMd(){return this.b};_.Xj=function EMd(){var a;Uxd(this);if(oid(this.e)){a=this.b;this.b=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.b=false}};_.b=false;var Y8=mdb(yve,'EObjectContainmentEList/Unsettable',545);bcb(1140,545,Pve,JMd);_.ii=function NMd(a,b){var c,d;return c=BD(Wxd(this,a,b),87),oid(this.e)&&GLd(this,new ESd(this.a,7,(jGd(),SFd),meb(b),(d=c.c,JD(d,88)?BD(d,26):_Fd),a)),c};_.jj=function OMd(a,b){return GMd(this,BD(a,87),b)};_.kj=function PMd(a,b){return HMd(this,BD(a,87),b)};_.lj=function QMd(a,b,c){return IMd(this,BD(a,87),BD(b,87),c)};_.Zi=function KMd(a,b,c,d,e){switch(a){case 3:{return FLd(this,a,b,c,d,this.i>1)}case 5:{return FLd(this,a,b,c,d,this.i-BD(c,15).gc()>0)}default:{return new pSd(this.e,a,this.c,b,c,d,true)}}};_.ij=function LMd(){return true};_.fj=function MMd(){return FMd(this)};_.Xj=function RMd(){Uxd(this)};var N5=mdb(qte,'EClassImpl/1',1140);bcb(1154,1153,dve);_.ui=function VMd(a){var b,c,d,e,f,g,h;c=a.xi();if(c!=8){d=UMd(a);if(d==0){switch(c){case 1:case 9:{h=a.Bi();if(h!=null){b=$Kd(BD(h,473));!b.c&&(b.c=new xYd);Ftd(b.c,a.Ai())}g=a.zi();if(g!=null){e=BD(g,473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);wtd(b.c,BD(a.Ai(),26))}}break}case 3:{g=a.zi();if(g!=null){e=BD(g,473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);wtd(b.c,BD(a.Ai(),26))}}break}case 5:{g=a.zi();if(g!=null){for(f=BD(g,14).Kc();f.Ob();){e=BD(f.Pb(),473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);wtd(b.c,BD(a.Ai(),26))}}}break}case 4:{h=a.Bi();if(h!=null){e=BD(h,473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);Ftd(b.c,a.Ai())}}break}case 6:{h=a.Bi();if(h!=null){for(f=BD(h,14).Kc();f.Ob();){e=BD(f.Pb(),473);if((e.Bb&1)==0){b=$Kd(e);!b.c&&(b.c=new xYd);Ftd(b.c,a.Ai())}}}break}}}this.Hk(d)}};_.Hk=function WMd(a){TMd(this,a)};_.b=63;var p7=mdb(qte,'ESuperAdapter',1154);bcb(1155,1154,dve,YMd);_.Hk=function ZMd(a){XMd(this,a)};var I5=mdb(qte,'EClassImpl/10',1155);bcb(1144,696,Pve);_.Vh=function $Md(a,b){return iud(this,a,b)};_.Wh=function _Md(a){return jud(this,a)};_.Xh=function aNd(a,b){kud(this,a,b)};_.Yh=function bNd(a){lud(this,a)};_.pi=function dNd(a){return nud(this,a)};_.mi=function lNd(a,b){return uud(this,a,b)};_.lk=function cNd(a,b){throw vbb(new bgb)};_.Zh=function eNd(){return new $yd(this)};_.$h=function fNd(){return new bzd(this)};_._h=function gNd(a){return ztd(this,a)};_.mk=function hNd(a,b){throw vbb(new bgb)};_.Wj=function iNd(a){return this};_.fj=function jNd(){return this.i!=0};_.Wb=function kNd(a){throw vbb(new bgb)};_.Xj=function mNd(){throw vbb(new bgb)};var s9=mdb(yve,'EcoreEList/UnmodifiableEList',1144);bcb(319,1144,Pve,nNd);_.ni=function oNd(){return false};var r9=mdb(yve,'EcoreEList/UnmodifiableEList/FastCompare',319);bcb(1147,319,Pve,rNd);_.Xc=function sNd(a){var b,c,d;if(JD(a,170)){b=BD(a,170);c=b.aj();if(c!=-1){for(d=this.i;c4){if(this.wj(a)){if(this.rk()){d=BD(a,49);c=d.Ug();h=c==this.b&&(this.Dk()?d.Og(d.Vg(),BD(XKd(wjd(this.b),this.aj()).Yj(),26).Bj())==zUd(BD(XKd(wjd(this.b),this.aj()),18)).n:-1-d.Vg()==this.aj());if(this.Ek()&&!h&&!c&&!!d.Zg()){for(e=0;e1||d==-1)}else{return false}};_.Dk=function COd(){var a,b,c;b=XKd(wjd(this.b),this.aj());if(JD(b,99)){a=BD(b,18);c=zUd(a);return !!c}else{return false}};_.Ek=function DOd(){var a,b;b=XKd(wjd(this.b),this.aj());if(JD(b,99)){a=BD(b,18);return (a.Bb&Tje)!=0}else{return false}};_.Xc=function EOd(a){var b,c,d,e;d=this.Qi(a);if(d>=0)return d;if(this.Fk()){for(c=0,e=this.Vi();c=0;--a){nOd(this,a,this.Oi(a))}}return this.Wi()};_.Qc=function QOd(a){var b;if(this.Ek()){for(b=this.Vi()-1;b>=0;--b){nOd(this,b,this.Oi(b))}}return this.Xi(a)};_.Xj=function ROd(){vwd(this)};_.oi=function SOd(a,b){return pOd(this,a,b)};var K8=mdb(yve,'DelegatingEcoreEList',742);bcb(1150,742,Uve,YOd);_.Hi=function _Od(a,b){TOd(this,a,BD(b,26))};_.Ii=function aPd(a){UOd(this,BD(a,26))};_.Oi=function gPd(a){var b,c;return b=BD(qud(VKd(this.a),a),87),c=b.c,JD(c,88)?BD(c,26):(jGd(),_Fd)};_.Ti=function lPd(a){var b,c;return b=BD(Xxd(VKd(this.a),a),87),c=b.c,JD(c,88)?BD(c,26):(jGd(),_Fd)};_.Ui=function mPd(a,b){return WOd(this,a,BD(b,26))};_.ai=function ZOd(){return false};_.Zi=function $Od(a,b,c,d,e){return null};_.Ji=function bPd(){return new EPd(this)};_.Ki=function cPd(){Uxd(VKd(this.a))};_.Li=function dPd(a){return VOd(this,a)};_.Mi=function ePd(a){var b,c;for(c=a.Kc();c.Ob();){b=c.Pb();if(!VOd(this,b)){return false}}return true};_.Ni=function fPd(a){var b,c,d;if(JD(a,15)){d=BD(a,15);if(d.gc()==VKd(this.a).i){for(b=d.Kc(),c=new Fyd(this);b.Ob();){if(PD(b.Pb())!==PD(Dyd(c))){return false}}return true}}return false};_.Pi=function hPd(){var a,b,c,d,e;c=1;for(b=new Fyd(VKd(this.a));b.e!=b.i.gc();){a=BD(Dyd(b),87);d=(e=a.c,JD(e,88)?BD(e,26):(jGd(),_Fd));c=31*c+(!d?0:FCb(d))}return c};_.Qi=function iPd(a){var b,c,d,e;d=0;for(c=new Fyd(VKd(this.a));c.e!=c.i.gc();){b=BD(Dyd(c),87);if(PD(a)===PD((e=b.c,JD(e,88)?BD(e,26):(jGd(),_Fd)))){return d}++d}return -1};_.Ri=function jPd(){return VKd(this.a).i==0};_.Si=function kPd(){return null};_.Vi=function nPd(){return VKd(this.a).i};_.Wi=function oPd(){var a,b,c,d,e,f;f=VKd(this.a).i;e=KC(SI,Uhe,1,f,5,1);c=0;for(b=new Fyd(VKd(this.a));b.e!=b.i.gc();){a=BD(Dyd(b),87);e[c++]=(d=a.c,JD(d,88)?BD(d,26):(jGd(),_Fd))}return e};_.Xi=function pPd(a){var b,c,d,e,f,g,h;h=VKd(this.a).i;if(a.lengthh&&NC(a,h,null);d=0;for(c=new Fyd(VKd(this.a));c.e!=c.i.gc();){b=BD(Dyd(c),87);f=(g=b.c,JD(g,88)?BD(g,26):(jGd(),_Fd));NC(a,d++,f)}return a};_.Yi=function qPd(){var a,b,c,d,e;e=new Hfb;e.a+='[';a=VKd(this.a);for(b=0,d=VKd(this.a).i;b>16,e>=0?aKd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,6,c);case 9:return !this.a&&(this.a=new cUd(g5,this,9,5)),Sxd(this.a,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),UFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),UFd)),a,c)};_.jh=function dQd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 6:return _hd(this,null,6,c);case 7:return !this.A&&(this.A=new K4d(u5,this,7)),Txd(this.A,a,c);case 9:return !this.a&&(this.a=new cUd(g5,this,9,5)),Txd(this.a,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),UFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),UFd)),a,c)};_.lh=function eQd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.D!=null&&this.D==this.F;case 3:return !!dKd(this);case 4:return !!$Pd(this);case 5:return this.F!=null&&this.F!=this.D&&this.F!=this.B;case 6:return !!ZJd(this);case 7:return !!this.A&&this.A.i!=0;case 8:return (this.Bb&256)==0;case 9:return !!this.a&&this.a.i!=0;}return cid(this,a-aLd((jGd(),UFd)),XKd((b=BD(Ajd(this,16),26),!b?UFd:b),a))};_.sh=function fQd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:lKd(this,GD(b));return;case 2:iKd(this,GD(b));return;case 5:kKd(this,GD(b));return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);!this.A&&(this.A=new K4d(u5,this,7));ytd(this.A,BD(b,14));return;case 8:LPd(this,Ccb(DD(b)));return;case 9:!this.a&&(this.a=new cUd(g5,this,9,5));Uxd(this.a);!this.a&&(this.a=new cUd(g5,this,9,5));ytd(this.a,BD(b,14));return;}did(this,a-aLd((jGd(),UFd)),XKd((c=BD(Ajd(this,16),26),!c?UFd:c),a),b)};_.zh=function gQd(){return jGd(),UFd};_.Bh=function hQd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,179)&&(BD(this.Cb,179).tb=null);pnd(this,null);return;case 2:$Jd(this,null);_Jd(this,this.D);return;case 5:kKd(this,null);return;case 7:!this.A&&(this.A=new K4d(u5,this,7));Uxd(this.A);return;case 8:LPd(this,true);return;case 9:!this.a&&(this.a=new cUd(g5,this,9,5));Uxd(this.a);return;}eid(this,a-aLd((jGd(),UFd)),XKd((b=BD(Ajd(this,16),26),!b?UFd:b),a))};_.Gh=function iQd(){var a,b;if(this.a){for(a=0,b=this.a.i;a>16==5?BD(this.Cb,671):null;}return bid(this,a-aLd((jGd(),VFd)),XKd((d=BD(Ajd(this,16),26),!d?VFd:d),a),b,c)};_.hh=function uQd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 5:!!this.Cb&&(c=(e=this.Db>>16,e>=0?mQd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,5,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),VFd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),VFd)),a,c)};_.jh=function vQd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 5:return _hd(this,null,5,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),VFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),VFd)),a,c)};_.lh=function wQd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return this.d!=0;case 3:return !!this.b;case 4:return this.c!=null;case 5:return !!(this.Db>>16==5?BD(this.Cb,671):null);}return cid(this,a-aLd((jGd(),VFd)),XKd((b=BD(Ajd(this,16),26),!b?VFd:b),a))};_.sh=function xQd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:qQd(this,BD(b,19).a);return;case 3:oQd(this,BD(b,1940));return;case 4:pQd(this,GD(b));return;}did(this,a-aLd((jGd(),VFd)),XKd((c=BD(Ajd(this,16),26),!c?VFd:c),a),b)};_.zh=function yQd(){return jGd(),VFd};_.Bh=function zQd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:qQd(this,0);return;case 3:oQd(this,null);return;case 4:pQd(this,null);return;}eid(this,a-aLd((jGd(),VFd)),XKd((b=BD(Ajd(this,16),26),!b?VFd:b),a))};_.Ib=function BQd(){var a;return a=this.c,a==null?this.zb:a};_.b=null;_.c=null;_.d=0;var a6=mdb(qte,'EEnumLiteralImpl',573);var c6=odb(qte,'EFactoryImpl/InternalEDateTimeFormat');bcb(489,1,{2015:1},EQd);var b6=mdb(qte,'EFactoryImpl/1ClientInternalEDateTimeFormat',489);bcb(241,115,{105:1,92:1,90:1,87:1,56:1,108:1,49:1,97:1,241:1,114:1,115:1},UQd);_.Sg=function VQd(a,b,c){var d;c=_hd(this,a,b,c);if(!!this.e&&JD(a,170)){d=MQd(this,this.e);d!=this.c&&(c=QQd(this,d,c))}return c};_._g=function WQd(a,b,c){var d;switch(a){case 0:return this.f;case 1:return !this.d&&(this.d=new xMd(j5,this,1)),this.d;case 2:if(b)return KQd(this);return this.c;case 3:return this.b;case 4:return this.e;case 5:if(b)return JQd(this);return this.a;}return bid(this,a-aLd((jGd(),XFd)),XKd((d=BD(Ajd(this,16),26),!d?XFd:d),a),b,c)};_.jh=function XQd(a,b,c){var d,e;switch(b){case 0:return IQd(this,null,c);case 1:return !this.d&&(this.d=new xMd(j5,this,1)),Txd(this.d,a,c);case 3:return GQd(this,null,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),XFd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),XFd)),a,c)};_.lh=function YQd(a){var b;switch(a){case 0:return !!this.f;case 1:return !!this.d&&this.d.i!=0;case 2:return !!this.c;case 3:return !!this.b;case 4:return !!this.e;case 5:return !!this.a;}return cid(this,a-aLd((jGd(),XFd)),XKd((b=BD(Ajd(this,16),26),!b?XFd:b),a))};_.sh=function ZQd(a,b){var c;switch(a){case 0:SQd(this,BD(b,87));return;case 1:!this.d&&(this.d=new xMd(j5,this,1));Uxd(this.d);!this.d&&(this.d=new xMd(j5,this,1));ytd(this.d,BD(b,14));return;case 3:PQd(this,BD(b,87));return;case 4:RQd(this,BD(b,836));return;case 5:NQd(this,BD(b,138));return;}did(this,a-aLd((jGd(),XFd)),XKd((c=BD(Ajd(this,16),26),!c?XFd:c),a),b)};_.zh=function $Qd(){return jGd(),XFd};_.Bh=function _Qd(a){var b;switch(a){case 0:SQd(this,null);return;case 1:!this.d&&(this.d=new xMd(j5,this,1));Uxd(this.d);return;case 3:PQd(this,null);return;case 4:RQd(this,null);return;case 5:NQd(this,null);return;}eid(this,a-aLd((jGd(),XFd)),XKd((b=BD(Ajd(this,16),26),!b?XFd:b),a))};_.Ib=function aRd(){var a;a=new Wfb(Eid(this));a.a+=' (expression: ';TQd(this,a);a.a+=')';return a.a};var FQd;var e6=mdb(qte,'EGenericTypeImpl',241);bcb(1969,1964,Vve);_.Xh=function cRd(a,b){bRd(this,a,b)};_.lk=function dRd(a,b){bRd(this,this.gc(),a);return b};_.pi=function eRd(a){return Ut(this.Gi(),a)};_.Zh=function fRd(){return this.$h()};_.Gi=function gRd(){return new O0d(this)};_.$h=function hRd(){return this._h(0)};_._h=function iRd(a){return this.Gi().Zc(a)};_.mk=function jRd(a,b){ze(this,a,true);return b};_.ii=function kRd(a,b){var c,d;d=Vt(this,b);c=this.Zc(a);c.Rb(d);return d};_.ji=function lRd(a,b){var c;ze(this,b,true);c=this.Zc(a);c.Rb(b)};var B8=mdb(yve,'AbstractSequentialInternalEList',1969);bcb(486,1969,Vve,qRd);_.pi=function rRd(a){return Ut(this.Gi(),a)};_.Zh=function sRd(){if(this.b==null){return LRd(),LRd(),KRd}return this.Jk()};_.Gi=function tRd(){return new w4d(this.a,this.b)};_.$h=function uRd(){if(this.b==null){return LRd(),LRd(),KRd}return this.Jk()};_._h=function vRd(a){var b,c;if(this.b==null){if(a<0||a>1){throw vbb(new qcb(gve+a+', size=0'))}return LRd(),LRd(),KRd}c=this.Jk();for(b=0;b0){b=this.c[--this.d];if((!this.e||b.Gj()!=x2||b.aj()!=0)&&(!this.Mk()||this.b.mh(b))){f=this.b.bh(b,this.Lk());this.f=(Q6d(),BD(b,66).Oj());if(this.f||b.$j()){if(this.Lk()){d=BD(f,15);this.k=d}else{d=BD(f,69);this.k=this.j=d}if(JD(this.k,54)){this.o=this.k.gc();this.n=this.o}else{this.p=!this.j?this.k.Zc(this.k.gc()):this.j._h(this.k.gc())}if(!this.p?PRd(this):QRd(this,this.p)){e=!this.p?!this.j?this.k.Xb(--this.n):this.j.pi(--this.n):this.p.Ub();if(this.f){a=BD(e,72);a.ak();c=a.dd();this.i=c}else{c=e;this.i=c}this.g=-3;return true}}else if(f!=null){this.k=null;this.p=null;c=f;this.i=c;this.g=-2;return true}}}this.k=null;this.p=null;this.g=-1;return false}else{e=!this.p?!this.j?this.k.Xb(--this.n):this.j.pi(--this.n):this.p.Ub();if(this.f){a=BD(e,72);a.ak();c=a.dd();this.i=c}else{c=e;this.i=c}this.g=-3;return true}}}};_.Pb=function XRd(){return MRd(this)};_.Tb=function YRd(){return this.a};_.Ub=function ZRd(){var a;if(this.g<-1||this.Sb()){--this.a;this.g=0;a=this.i;this.Sb();return a}else{throw vbb(new utb)}};_.Vb=function $Rd(){return this.a-1};_.Qb=function _Rd(){throw vbb(new bgb)};_.Lk=function aSd(){return false};_.Wb=function bSd(a){throw vbb(new bgb)};_.Mk=function cSd(){return true};_.a=0;_.d=0;_.f=false;_.g=0;_.n=0;_.o=0;var KRd;var P8=mdb(yve,'EContentsEList/FeatureIteratorImpl',279);bcb(697,279,Wve,dSd);_.Lk=function eSd(){return true};var Q8=mdb(yve,'EContentsEList/ResolvingFeatureIteratorImpl',697);bcb(1157,697,Wve,fSd);_.Mk=function gSd(){return false};var g6=mdb(qte,'ENamedElementImpl/1/1',1157);bcb(1158,279,Wve,hSd);_.Mk=function iSd(){return false};var h6=mdb(qte,'ENamedElementImpl/1/2',1158);bcb(36,143,fve,lSd,mSd,nSd,oSd,pSd,qSd,rSd,sSd,tSd,uSd,vSd,wSd,xSd,ySd,zSd,ASd,BSd,CSd,DSd,ESd,FSd,GSd,HSd,ISd,JSd);_._i=function KSd(){return kSd(this)};_.gj=function LSd(){var a;a=kSd(this);if(a){return a.zj()}return null};_.yi=function MSd(a){this.b==-1&&!!this.a&&(this.b=this.c.Xg(this.a.aj(),this.a.Gj()));return this.c.Og(this.b,a)};_.Ai=function NSd(){return this.c};_.hj=function OSd(){var a;a=kSd(this);if(a){return a.Kj()}return false};_.b=-1;var k6=mdb(qte,'ENotificationImpl',36);bcb(399,284,{105:1,92:1,90:1,147:1,191:1,56:1,59:1,108:1,472:1,49:1,97:1,150:1,399:1,284:1,114:1,115:1},SSd);_.Qg=function TSd(a){return PSd(this,a)};_._g=function USd(a,b,c){var d,e,f;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),f=this.t,f>1||f==-1?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return this.Db>>16==10?BD(this.Cb,26):null;case 11:return !this.d&&(this.d=new K4d(u5,this,11)),this.d;case 12:return !this.c&&(this.c=new cUd(p5,this,12,10)),this.c;case 13:return !this.a&&(this.a=new fTd(this,this)),this.a;case 14:return QSd(this);}return bid(this,a-aLd((jGd(),aGd)),XKd((d=BD(Ajd(this,16),26),!d?aGd:d),a),b,c)};_.hh=function VSd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 10:!!this.Cb&&(c=(e=this.Db>>16,e>=0?PSd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,10,c);case 12:return !this.c&&(this.c=new cUd(p5,this,12,10)),Sxd(this.c,a,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),aGd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),aGd)),a,c)};_.jh=function WSd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);case 10:return _hd(this,null,10,c);case 11:return !this.d&&(this.d=new K4d(u5,this,11)),Txd(this.d,a,c);case 12:return !this.c&&(this.c=new cUd(p5,this,12,10)),Txd(this.c,a,c);case 14:return Txd(QSd(this),a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),aGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),aGd)),a,c)};_.lh=function XSd(a){var b,c,d;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return d=this.t,d>1||d==-1;case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return !!(this.Db>>16==10?BD(this.Cb,26):null);case 11:return !!this.d&&this.d.i!=0;case 12:return !!this.c&&this.c.i!=0;case 13:return !!this.a&&QSd(this.a.a).i!=0&&!(!!this.b&&QTd(this.b));case 14:return !!this.b&&QTd(this.b);}return cid(this,a-aLd((jGd(),aGd)),XKd((b=BD(Ajd(this,16),26),!b?aGd:b),a))};_.sh=function YSd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:DId(this,BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 11:!this.d&&(this.d=new K4d(u5,this,11));Uxd(this.d);!this.d&&(this.d=new K4d(u5,this,11));ytd(this.d,BD(b,14));return;case 12:!this.c&&(this.c=new cUd(p5,this,12,10));Uxd(this.c);!this.c&&(this.c=new cUd(p5,this,12,10));ytd(this.c,BD(b,14));return;case 13:!this.a&&(this.a=new fTd(this,this));vwd(this.a);!this.a&&(this.a=new fTd(this,this));ytd(this.a,BD(b,14));return;case 14:Uxd(QSd(this));ytd(QSd(this),BD(b,14));return;}did(this,a-aLd((jGd(),aGd)),XKd((c=BD(Ajd(this,16),26),!c?aGd:c),a),b)};_.zh=function ZSd(){return jGd(),aGd};_.Bh=function $Sd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:DId(this,1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 11:!this.d&&(this.d=new K4d(u5,this,11));Uxd(this.d);return;case 12:!this.c&&(this.c=new cUd(p5,this,12,10));Uxd(this.c);return;case 13:!!this.a&&vwd(this.a);return;case 14:!!this.b&&Uxd(this.b);return;}eid(this,a-aLd((jGd(),aGd)),XKd((b=BD(Ajd(this,16),26),!b?aGd:b),a))};_.Gh=function _Sd(){var a,b;if(this.c){for(a=0,b=this.c.i;ah&&NC(a,h,null);d=0;for(c=new Fyd(QSd(this.a));c.e!=c.i.gc();){b=BD(Dyd(c),87);f=(g=b.c,g?g:(jGd(),YFd));NC(a,d++,f)}return a};_.Yi=function zTd(){var a,b,c,d,e;e=new Hfb;e.a+='[';a=QSd(this.a);for(b=0,d=QSd(this.a).i;b1)}case 5:{return FLd(this,a,b,c,d,this.i-BD(c,15).gc()>0)}default:{return new pSd(this.e,a,this.c,b,c,d,true)}}};_.ij=function WTd(){return true};_.fj=function XTd(){return QTd(this)};_.Xj=function aUd(){Uxd(this)};var o6=mdb(qte,'EOperationImpl/2',1341);bcb(498,1,{1938:1,498:1},bUd);var q6=mdb(qte,'EPackageImpl/1',498);bcb(16,85,Pve,cUd);_.zk=function dUd(){return this.d};_.Ak=function eUd(){return this.b};_.Dk=function fUd(){return true};_.b=0;var b9=mdb(yve,'EObjectContainmentWithInverseEList',16);bcb(353,16,Pve,gUd);_.Ek=function hUd(){return true};_.li=function iUd(a,b){return ILd(this,a,BD(b,56))};var $8=mdb(yve,'EObjectContainmentWithInverseEList/Resolving',353);bcb(298,353,Pve,jUd);_.ci=function kUd(){this.a.tb=null};var r6=mdb(qte,'EPackageImpl/2',298);bcb(1228,1,{},lUd);var s6=mdb(qte,'EPackageImpl/3',1228);bcb(718,43,fke,oUd);_._b=function pUd(a){return ND(a)?Qhb(this,a):!!irb(this.f,a)};var u6=mdb(qte,'EPackageRegistryImpl',718);bcb(509,284,{105:1,92:1,90:1,147:1,191:1,56:1,2017:1,108:1,472:1,49:1,97:1,150:1,509:1,284:1,114:1,115:1},rUd);_.Qg=function sUd(a){return qUd(this,a)};_._g=function tUd(a,b,c){var d,e,f;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),f=this.t,f>1||f==-1?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return this.Db>>16==10?BD(this.Cb,59):null;}return bid(this,a-aLd((jGd(),dGd)),XKd((d=BD(Ajd(this,16),26),!d?dGd:d),a),b,c)};_.hh=function uUd(a,b,c){var d,e,f;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Sxd(this.Ab,a,c);case 10:!!this.Cb&&(c=(e=this.Db>>16,e>=0?qUd(this,c):this.Cb.ih(this,-1-e,null,c)));return _hd(this,a,10,c);}return f=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),dGd):d),b),66),f.Nj().Qj(this,yjd(this),b-aLd((jGd(),dGd)),a,c)};_.jh=function vUd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 9:return vId(this,c);case 10:return _hd(this,null,10,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),dGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),dGd)),a,c)};_.lh=function wUd(a){var b,c,d;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return d=this.t,d>1||d==-1;case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return !!(this.Db>>16==10?BD(this.Cb,59):null);}return cid(this,a-aLd((jGd(),dGd)),XKd((b=BD(Ajd(this,16),26),!b?dGd:b),a))};_.zh=function xUd(){return jGd(),dGd};var v6=mdb(qte,'EParameterImpl',509);bcb(99,449,{105:1,92:1,90:1,147:1,191:1,56:1,18:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,99:1,449:1,284:1,114:1,115:1,677:1},FUd);_._g=function GUd(a,b,c){var d,e,f,g;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return Bcb(),(this.Bb&256)!=0?true:false;case 3:return Bcb(),(this.Bb&512)!=0?true:false;case 4:return meb(this.s);case 5:return meb(this.t);case 6:return Bcb(),g=this.t,g>1||g==-1?true:false;case 7:return Bcb(),e=this.s,e>=1?true:false;case 8:if(b)return wId(this);return this.r;case 9:return this.q;case 10:return Bcb(),(this.Bb&zte)!=0?true:false;case 11:return Bcb(),(this.Bb&Dve)!=0?true:false;case 12:return Bcb(),(this.Bb&Rje)!=0?true:false;case 13:return this.j;case 14:return VId(this);case 15:return Bcb(),(this.Bb&Cve)!=0?true:false;case 16:return Bcb(),(this.Bb&oie)!=0?true:false;case 17:return WId(this);case 18:return Bcb(),(this.Bb&ote)!=0?true:false;case 19:return Bcb(),f=zUd(this),!!f&&(f.Bb&ote)!=0?true:false;case 20:return Bcb(),(this.Bb&Tje)!=0?true:false;case 21:if(b)return zUd(this);return this.b;case 22:if(b)return AUd(this);return yUd(this);case 23:return !this.a&&(this.a=new _4d(b5,this,23)),this.a;}return bid(this,a-aLd((jGd(),eGd)),XKd((d=BD(Ajd(this,16),26),!d?eGd:d),a),b,c)};_.lh=function HUd(a){var b,c,d,e;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return (this.Bb&256)==0;case 3:return (this.Bb&512)==0;case 4:return this.s!=0;case 5:return this.t!=1;case 6:return e=this.t,e>1||e==-1;case 7:return c=this.s,c>=1;case 8:return !!this.r&&!this.q.e&&LQd(this.q).i==0;case 9:return !!this.q&&!(!!this.r&&!this.q.e&&LQd(this.q).i==0);case 10:return (this.Bb&zte)==0;case 11:return (this.Bb&Dve)!=0;case 12:return (this.Bb&Rje)!=0;case 13:return this.j!=null;case 14:return VId(this)!=null;case 15:return (this.Bb&Cve)!=0;case 16:return (this.Bb&oie)!=0;case 17:return !!WId(this);case 18:return (this.Bb&ote)!=0;case 19:return d=zUd(this),!!d&&(d.Bb&ote)!=0;case 20:return (this.Bb&Tje)==0;case 21:return !!this.b;case 22:return !!yUd(this);case 23:return !!this.a&&this.a.i!=0;}return cid(this,a-aLd((jGd(),eGd)),XKd((b=BD(Ajd(this,16),26),!b?eGd:b),a))};_.sh=function IUd(a,b){var c,d;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:cJd(this,GD(b));return;case 2:BId(this,Ccb(DD(b)));return;case 3:CId(this,Ccb(DD(b)));return;case 4:AId(this,BD(b,19).a);return;case 5:DId(this,BD(b,19).a);return;case 8:yId(this,BD(b,138));return;case 9:d=xId(this,BD(b,87),null);!!d&&d.Fi();return;case 10:ZId(this,Ccb(DD(b)));return;case 11:fJd(this,Ccb(DD(b)));return;case 12:dJd(this,Ccb(DD(b)));return;case 13:$Id(this,GD(b));return;case 15:eJd(this,Ccb(DD(b)));return;case 16:aJd(this,Ccb(DD(b)));return;case 18:BUd(this,Ccb(DD(b)));return;case 20:EUd(this,Ccb(DD(b)));return;case 21:DUd(this,BD(b,18));return;case 23:!this.a&&(this.a=new _4d(b5,this,23));Uxd(this.a);!this.a&&(this.a=new _4d(b5,this,23));ytd(this.a,BD(b,14));return;}did(this,a-aLd((jGd(),eGd)),XKd((c=BD(Ajd(this,16),26),!c?eGd:c),a),b)};_.zh=function JUd(){return jGd(),eGd};_.Bh=function KUd(a){var b,c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),4);pnd(this,null);return;case 2:BId(this,true);return;case 3:CId(this,true);return;case 4:AId(this,0);return;case 5:DId(this,1);return;case 8:yId(this,null);return;case 9:c=xId(this,null,null);!!c&&c.Fi();return;case 10:ZId(this,true);return;case 11:fJd(this,false);return;case 12:dJd(this,false);return;case 13:this.i=null;_Id(this,null);return;case 15:eJd(this,false);return;case 16:aJd(this,false);return;case 18:CUd(this,false);JD(this.Cb,88)&&XMd($Kd(BD(this.Cb,88)),2);return;case 20:EUd(this,true);return;case 21:DUd(this,null);return;case 23:!this.a&&(this.a=new _4d(b5,this,23));Uxd(this.a);return;}eid(this,a-aLd((jGd(),eGd)),XKd((b=BD(Ajd(this,16),26),!b?eGd:b),a))};_.Gh=function LUd(){AUd(this);a2d(q1d((O6d(),M6d),this));wId(this);this.Bb|=1};_.Lj=function MUd(){return zUd(this)};_.qk=function NUd(){var a;return a=zUd(this),!!a&&(a.Bb&ote)!=0};_.rk=function OUd(){return (this.Bb&ote)!=0};_.sk=function PUd(){return (this.Bb&Tje)!=0};_.nk=function QUd(a,b){this.c=null;return zId(this,a,b)};_.Ib=function RUd(){var a;if((this.Db&64)!=0)return gJd(this);a=new Jfb(gJd(this));a.a+=' (containment: ';Ffb(a,(this.Bb&ote)!=0);a.a+=', resolveProxies: ';Ffb(a,(this.Bb&Tje)!=0);a.a+=')';return a.a};var w6=mdb(qte,'EReferenceImpl',99);bcb(548,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,548:1,114:1,115:1},XUd);_.Fb=function bVd(a){return this===a};_.cd=function dVd(){return this.b};_.dd=function eVd(){return this.c};_.Hb=function fVd(){return FCb(this)};_.Uh=function hVd(a){SUd(this,GD(a))};_.ed=function iVd(a){return WUd(this,GD(a))};_._g=function YUd(a,b,c){var d;switch(a){case 0:return this.b;case 1:return this.c;}return bid(this,a-aLd((jGd(),fGd)),XKd((d=BD(Ajd(this,16),26),!d?fGd:d),a),b,c)};_.lh=function ZUd(a){var b;switch(a){case 0:return this.b!=null;case 1:return this.c!=null;}return cid(this,a-aLd((jGd(),fGd)),XKd((b=BD(Ajd(this,16),26),!b?fGd:b),a))};_.sh=function $Ud(a,b){var c;switch(a){case 0:TUd(this,GD(b));return;case 1:VUd(this,GD(b));return;}did(this,a-aLd((jGd(),fGd)),XKd((c=BD(Ajd(this,16),26),!c?fGd:c),a),b)};_.zh=function _Ud(){return jGd(),fGd};_.Bh=function aVd(a){var b;switch(a){case 0:UUd(this,null);return;case 1:VUd(this,null);return;}eid(this,a-aLd((jGd(),fGd)),XKd((b=BD(Ajd(this,16),26),!b?fGd:b),a))};_.Sh=function cVd(){var a;if(this.a==-1){a=this.b;this.a=a==null?0:LCb(a)}return this.a};_.Th=function gVd(a){this.a=a};_.Ib=function jVd(){var a;if((this.Db&64)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (key: ';Efb(a,this.b);a.a+=', value: ';Efb(a,this.c);a.a+=')';return a.a};_.a=-1;_.b=null;_.c=null;var x6=mdb(qte,'EStringToStringMapEntryImpl',548);var D9=odb(yve,'FeatureMap/Entry/Internal');bcb(565,1,Xve);_.Ok=function mVd(a){return this.Pk(BD(a,49))};_.Pk=function nVd(a){return this.Ok(a)};_.Fb=function oVd(a){var b,c;if(this===a){return true}else if(JD(a,72)){b=BD(a,72);if(b.ak()==this.c){c=this.dd();return c==null?b.dd()==null:pb(c,b.dd())}else{return false}}else{return false}};_.ak=function pVd(){return this.c};_.Hb=function qVd(){var a;a=this.dd();return tb(this.c)^(a==null?0:tb(a))};_.Ib=function rVd(){var a,b;a=this.c;b=bKd(a.Hj()).Ph();a.ne();return (b!=null&&b.length!=0?b+':'+a.ne():a.ne())+'='+this.dd()};var y6=mdb(qte,'EStructuralFeatureImpl/BasicFeatureMapEntry',565);bcb(776,565,Xve,uVd);_.Pk=function vVd(a){return new uVd(this.c,a)};_.dd=function wVd(){return this.a};_.Qk=function xVd(a,b,c){return sVd(this,a,this.a,b,c)};_.Rk=function yVd(a,b,c){return tVd(this,a,this.a,b,c)};var z6=mdb(qte,'EStructuralFeatureImpl/ContainmentUpdatingFeatureMapEntry',776);bcb(1314,1,{},zVd);_.Pj=function AVd(a,b,c,d,e){var f;f=BD(gid(a,this.b),215);return f.nl(this.a).Wj(d)};_.Qj=function BVd(a,b,c,d,e){var f;f=BD(gid(a,this.b),215);return f.el(this.a,d,e)};_.Rj=function CVd(a,b,c,d,e){var f;f=BD(gid(a,this.b),215);return f.fl(this.a,d,e)};_.Sj=function DVd(a,b,c){var d;d=BD(gid(a,this.b),215);return d.nl(this.a).fj()};_.Tj=function EVd(a,b,c,d){var e;e=BD(gid(a,this.b),215);e.nl(this.a).Wb(d)};_.Uj=function FVd(a,b,c){return BD(gid(a,this.b),215).nl(this.a)};_.Vj=function GVd(a,b,c){var d;d=BD(gid(a,this.b),215);d.nl(this.a).Xj()};var A6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateFeatureMapDelegator',1314);bcb(89,1,{},IVd,JVd,KVd,LVd);_.Pj=function MVd(a,b,c,d,e){var f;f=b.Ch(c);f==null&&b.Dh(c,f=HVd(this,a));if(!e){switch(this.e){case 50:case 41:return BD(f,589).sj();case 40:return BD(f,215).kl();}}return f};_.Qj=function NVd(a,b,c,d,e){var f,g;g=b.Ch(c);g==null&&b.Dh(c,g=HVd(this,a));f=BD(g,69).lk(d,e);return f};_.Rj=function OVd(a,b,c,d,e){var f;f=b.Ch(c);f!=null&&(e=BD(f,69).mk(d,e));return e};_.Sj=function PVd(a,b,c){var d;d=b.Ch(c);return d!=null&&BD(d,76).fj()};_.Tj=function QVd(a,b,c,d){var e;e=BD(b.Ch(c),76);!e&&b.Dh(c,e=HVd(this,a));e.Wb(d)};_.Uj=function RVd(a,b,c){var d,e;e=b.Ch(c);e==null&&b.Dh(c,e=HVd(this,a));if(JD(e,76)){return BD(e,76)}else{d=BD(b.Ch(c),15);return new iYd(d)}};_.Vj=function SVd(a,b,c){var d;d=BD(b.Ch(c),76);!d&&b.Dh(c,d=HVd(this,a));d.Xj()};_.b=0;_.e=0;var B6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateMany',89);bcb(504,1,{});_.Qj=function WVd(a,b,c,d,e){throw vbb(new bgb)};_.Rj=function XVd(a,b,c,d,e){throw vbb(new bgb)};_.Uj=function YVd(a,b,c){return new ZVd(this,a,b,c)};var TVd;var i7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingle',504);bcb(1331,1,zve,ZVd);_.Wj=function $Vd(a){return this.a.Pj(this.c,this.d,this.b,a,true)};_.fj=function _Vd(){return this.a.Sj(this.c,this.d,this.b)};_.Wb=function aWd(a){this.a.Tj(this.c,this.d,this.b,a)};_.Xj=function bWd(){this.a.Vj(this.c,this.d,this.b)};_.b=0;var C6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingle/1',1331);bcb(769,504,{},cWd);_.Pj=function dWd(a,b,c,d,e){return Nid(a,a.eh(),a.Vg())==this.b?this.sk()&&d?aid(a):a.eh():null};_.Qj=function eWd(a,b,c,d,e){var f,g;!!a.eh()&&(e=(f=a.Vg(),f>=0?a.Qg(e):a.eh().ih(a,-1-f,null,e)));g=bLd(a.Tg(),this.e);return a.Sg(d,g,e)};_.Rj=function fWd(a,b,c,d,e){var f;f=bLd(a.Tg(),this.e);return a.Sg(null,f,e)};_.Sj=function gWd(a,b,c){var d;d=bLd(a.Tg(),this.e);return !!a.eh()&&a.Vg()==d};_.Tj=function hWd(a,b,c,d){var e,f,g,h,i;if(d!=null&&!fKd(this.a,d)){throw vbb(new Cdb(Yve+(JD(d,56)?gLd(BD(d,56).Tg()):idb(rb(d)))+Zve+this.a+"'"))}e=a.eh();g=bLd(a.Tg(),this.e);if(PD(d)!==PD(e)||a.Vg()!=g&&d!=null){if(p6d(a,BD(d,56)))throw vbb(new Wdb(ste+a.Ib()));i=null;!!e&&(i=(f=a.Vg(),f>=0?a.Qg(i):a.eh().ih(a,-1-f,null,i)));h=BD(d,49);!!h&&(i=h.gh(a,bLd(h.Tg(),this.b),null,i));i=a.Sg(h,g,i);!!i&&i.Fi()}else{a.Lg()&&a.Mg()&&Uhd(a,new nSd(a,1,g,d,d))}};_.Vj=function iWd(a,b,c){var d,e,f,g;d=a.eh();if(d){g=(e=a.Vg(),e>=0?a.Qg(null):a.eh().ih(a,-1-e,null,null));f=bLd(a.Tg(),this.e);g=a.Sg(null,f,g);!!g&&g.Fi()}else{a.Lg()&&a.Mg()&&Uhd(a,new DSd(a,1,this.e,null,null))}};_.sk=function jWd(){return false};var E6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleContainer',769);bcb(1315,769,{},kWd);_.sk=function lWd(){return true};var D6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleContainerResolving',1315);bcb(563,504,{});_.Pj=function oWd(a,b,c,d,e){var f;return f=b.Ch(c),f==null?this.b:PD(f)===PD(TVd)?null:f};_.Sj=function pWd(a,b,c){var d;d=b.Ch(c);return d!=null&&(PD(d)===PD(TVd)||!pb(d,this.b))};_.Tj=function qWd(a,b,c,d){var e,f;if(a.Lg()&&a.Mg()){e=(f=b.Ch(c),f==null?this.b:PD(f)===PD(TVd)?null:f);if(d==null){if(this.c!=null){b.Dh(c,null);d=this.b}else this.b!=null?b.Dh(c,TVd):b.Dh(c,null)}else{this.Sk(d);b.Dh(c,d)}Uhd(a,this.d.Tk(a,1,this.e,e,d))}else{if(d==null){this.c!=null?b.Dh(c,null):this.b!=null?b.Dh(c,TVd):b.Dh(c,null)}else{this.Sk(d);b.Dh(c,d)}}};_.Vj=function rWd(a,b,c){var d,e;if(a.Lg()&&a.Mg()){d=(e=b.Ch(c),e==null?this.b:PD(e)===PD(TVd)?null:e);b.Eh(c);Uhd(a,this.d.Tk(a,1,this.e,d,this.b))}else{b.Eh(c)}};_.Sk=function sWd(a){throw vbb(new Bdb)};var T6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData',563);bcb($ve,1,{},DWd);_.Tk=function EWd(a,b,c,d,e){return new DSd(a,b,c,d,e)};_.Uk=function FWd(a,b,c,d,e,f){return new FSd(a,b,c,d,e,f)};var tWd,uWd,vWd,wWd,xWd,yWd,zWd,AWd,BWd;var N6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator',$ve);bcb(1332,$ve,{},GWd);_.Tk=function HWd(a,b,c,d,e){return new ISd(a,b,c,Ccb(DD(d)),Ccb(DD(e)))};_.Uk=function IWd(a,b,c,d,e,f){return new JSd(a,b,c,Ccb(DD(d)),Ccb(DD(e)),f)};var F6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/1',1332);bcb(1333,$ve,{},JWd);_.Tk=function KWd(a,b,c,d,e){return new rSd(a,b,c,BD(d,217).a,BD(e,217).a)};_.Uk=function LWd(a,b,c,d,e,f){return new sSd(a,b,c,BD(d,217).a,BD(e,217).a,f)};var G6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/2',1333);bcb(1334,$ve,{},MWd);_.Tk=function NWd(a,b,c,d,e){return new tSd(a,b,c,BD(d,172).a,BD(e,172).a)};_.Uk=function OWd(a,b,c,d,e,f){return new uSd(a,b,c,BD(d,172).a,BD(e,172).a,f)};var H6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/3',1334);bcb(1335,$ve,{},PWd);_.Tk=function QWd(a,b,c,d,e){return new vSd(a,b,c,Edb(ED(d)),Edb(ED(e)))};_.Uk=function RWd(a,b,c,d,e,f){return new wSd(a,b,c,Edb(ED(d)),Edb(ED(e)),f)};var I6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/4',1335);bcb(1336,$ve,{},SWd);_.Tk=function TWd(a,b,c,d,e){return new xSd(a,b,c,BD(d,155).a,BD(e,155).a)};_.Uk=function UWd(a,b,c,d,e,f){return new ySd(a,b,c,BD(d,155).a,BD(e,155).a,f)};var J6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/5',1336);bcb(1337,$ve,{},VWd);_.Tk=function WWd(a,b,c,d,e){return new zSd(a,b,c,BD(d,19).a,BD(e,19).a)};_.Uk=function XWd(a,b,c,d,e,f){return new ASd(a,b,c,BD(d,19).a,BD(e,19).a,f)};var K6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/6',1337);bcb(1338,$ve,{},YWd);_.Tk=function ZWd(a,b,c,d,e){return new BSd(a,b,c,BD(d,162).a,BD(e,162).a)};_.Uk=function $Wd(a,b,c,d,e,f){return new CSd(a,b,c,BD(d,162).a,BD(e,162).a,f)};var L6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/7',1338);bcb(1339,$ve,{},_Wd);_.Tk=function aXd(a,b,c,d,e){return new GSd(a,b,c,BD(d,184).a,BD(e,184).a)};_.Uk=function bXd(a,b,c,d,e,f){return new HSd(a,b,c,BD(d,184).a,BD(e,184).a,f)};var M6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/8',1339);bcb(1317,563,{},cXd);_.Sk=function dXd(a){if(!this.a.wj(a)){throw vbb(new Cdb(Yve+rb(a)+Zve+this.a+"'"))}};var O6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataDynamic',1317);bcb(1318,563,{},eXd);_.Sk=function fXd(a){};var P6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataStatic',1318);bcb(770,563,{});_.Sj=function gXd(a,b,c){var d;d=b.Ch(c);return d!=null};_.Tj=function hXd(a,b,c,d){var e,f;if(a.Lg()&&a.Mg()){e=true;f=b.Ch(c);if(f==null){e=false;f=this.b}else PD(f)===PD(TVd)&&(f=null);if(d==null){if(this.c!=null){b.Dh(c,null);d=this.b}else{b.Dh(c,TVd)}}else{this.Sk(d);b.Dh(c,d)}Uhd(a,this.d.Uk(a,1,this.e,f,d,!e))}else{if(d==null){this.c!=null?b.Dh(c,null):b.Dh(c,TVd)}else{this.Sk(d);b.Dh(c,d)}}};_.Vj=function iXd(a,b,c){var d,e;if(a.Lg()&&a.Mg()){d=true;e=b.Ch(c);if(e==null){d=false;e=this.b}else PD(e)===PD(TVd)&&(e=null);b.Eh(c);Uhd(a,this.d.Uk(a,2,this.e,e,this.b,d))}else{b.Eh(c)}};var S6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettable',770);bcb(1319,770,{},jXd);_.Sk=function kXd(a){if(!this.a.wj(a)){throw vbb(new Cdb(Yve+rb(a)+Zve+this.a+"'"))}};var Q6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableDynamic',1319);bcb(1320,770,{},lXd);_.Sk=function mXd(a){};var R6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableStatic',1320);bcb(398,504,{},nXd);_.Pj=function pXd(a,b,c,d,e){var f,g,h,i,j;j=b.Ch(c);if(this.Kj()&&PD(j)===PD(TVd)){return null}else if(this.sk()&&d&&j!=null){h=BD(j,49);if(h.kh()){i=xid(a,h);if(h!=i){if(!fKd(this.a,i)){throw vbb(new Cdb(Yve+rb(i)+Zve+this.a+"'"))}b.Dh(c,j=i);if(this.rk()){f=BD(i,49);g=h.ih(a,!this.b?-1-bLd(a.Tg(),this.e):bLd(h.Tg(),this.b),null,null);!f.eh()&&(g=f.gh(a,!this.b?-1-bLd(a.Tg(),this.e):bLd(f.Tg(),this.b),null,g));!!g&&g.Fi()}a.Lg()&&a.Mg()&&Uhd(a,new DSd(a,9,this.e,h,i))}}return j}else{return j}};_.Qj=function qXd(a,b,c,d,e){var f,g;g=b.Ch(c);PD(g)===PD(TVd)&&(g=null);b.Dh(c,d);if(this.bj()){if(PD(g)!==PD(d)&&g!=null){f=BD(g,49);e=f.ih(a,bLd(f.Tg(),this.b),null,e)}}else this.rk()&&g!=null&&(e=BD(g,49).ih(a,-1-bLd(a.Tg(),this.e),null,e));if(a.Lg()&&a.Mg()){!e&&(e=new Ixd(4));e.Ei(new DSd(a,1,this.e,g,d))}return e};_.Rj=function rXd(a,b,c,d,e){var f;f=b.Ch(c);PD(f)===PD(TVd)&&(f=null);b.Eh(c);if(a.Lg()&&a.Mg()){!e&&(e=new Ixd(4));this.Kj()?e.Ei(new DSd(a,2,this.e,f,null)):e.Ei(new DSd(a,1,this.e,f,null))}return e};_.Sj=function sXd(a,b,c){var d;d=b.Ch(c);return d!=null};_.Tj=function tXd(a,b,c,d){var e,f,g,h,i;if(d!=null&&!fKd(this.a,d)){throw vbb(new Cdb(Yve+(JD(d,56)?gLd(BD(d,56).Tg()):idb(rb(d)))+Zve+this.a+"'"))}i=b.Ch(c);h=i!=null;this.Kj()&&PD(i)===PD(TVd)&&(i=null);g=null;if(this.bj()){if(PD(i)!==PD(d)){if(i!=null){e=BD(i,49);g=e.ih(a,bLd(e.Tg(),this.b),null,g)}if(d!=null){e=BD(d,49);g=e.gh(a,bLd(e.Tg(),this.b),null,g)}}}else if(this.rk()){if(PD(i)!==PD(d)){i!=null&&(g=BD(i,49).ih(a,-1-bLd(a.Tg(),this.e),null,g));d!=null&&(g=BD(d,49).gh(a,-1-bLd(a.Tg(),this.e),null,g))}}d==null&&this.Kj()?b.Dh(c,TVd):b.Dh(c,d);if(a.Lg()&&a.Mg()){f=new FSd(a,1,this.e,i,d,this.Kj()&&!h);if(!g){Uhd(a,f)}else{g.Ei(f);g.Fi()}}else !!g&&g.Fi()};_.Vj=function uXd(a,b,c){var d,e,f,g,h;h=b.Ch(c);g=h!=null;this.Kj()&&PD(h)===PD(TVd)&&(h=null);f=null;if(h!=null){if(this.bj()){d=BD(h,49);f=d.ih(a,bLd(d.Tg(),this.b),null,f)}else this.rk()&&(f=BD(h,49).ih(a,-1-bLd(a.Tg(),this.e),null,f))}b.Eh(c);if(a.Lg()&&a.Mg()){e=new FSd(a,this.Kj()?2:1,this.e,h,null,g);if(!f){Uhd(a,e)}else{f.Ei(e);f.Fi()}}else !!f&&f.Fi()};_.bj=function vXd(){return false};_.rk=function wXd(){return false};_.sk=function xXd(){return false};_.Kj=function yXd(){return false};var h7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObject',398);bcb(564,398,{},zXd);_.rk=function AXd(){return true};var _6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainment',564);bcb(1323,564,{},BXd);_.sk=function CXd(){return true};var U6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentResolving',1323);bcb(772,564,{},DXd);_.Kj=function EXd(){return true};var W6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettable',772);bcb(1325,772,{},FXd);_.sk=function GXd(){return true};var V6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettableResolving',1325);bcb(640,564,{},HXd);_.bj=function IXd(){return true};var $6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverse',640);bcb(1324,640,{},JXd);_.sk=function KXd(){return true};var X6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseResolving',1324);bcb(773,640,{},LXd);_.Kj=function MXd(){return true};var Z6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettable',773);bcb(1326,773,{},NXd);_.sk=function OXd(){return true};var Y6=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettableResolving',1326);bcb(641,398,{},PXd);_.sk=function QXd(){return true};var d7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolving',641);bcb(1327,641,{},RXd);_.Kj=function SXd(){return true};var a7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingUnsettable',1327);bcb(774,641,{},TXd);_.bj=function UXd(){return true};var c7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverse',774);bcb(1328,774,{},VXd);_.Kj=function WXd(){return true};var b7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverseUnsettable',1328);bcb(1321,398,{},XXd);_.Kj=function YXd(){return true};var e7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectUnsettable',1321);bcb(771,398,{},ZXd);_.bj=function $Xd(){return true};var g7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverse',771);bcb(1322,771,{},_Xd);_.Kj=function aYd(){return true};var f7=mdb(qte,'EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverseUnsettable',1322);bcb(775,565,Xve,dYd);_.Pk=function eYd(a){return new dYd(this.a,this.c,a)};_.dd=function fYd(){return this.b};_.Qk=function gYd(a,b,c){return bYd(this,a,this.b,c)};_.Rk=function hYd(a,b,c){return cYd(this,a,this.b,c)};var j7=mdb(qte,'EStructuralFeatureImpl/InverseUpdatingFeatureMapEntry',775);bcb(1329,1,zve,iYd);_.Wj=function jYd(a){return this.a};_.fj=function kYd(){return JD(this.a,95)?BD(this.a,95).fj():!this.a.dc()};_.Wb=function lYd(a){this.a.$b();this.a.Gc(BD(a,15))};_.Xj=function mYd(){JD(this.a,95)?BD(this.a,95).Xj():this.a.$b()};var k7=mdb(qte,'EStructuralFeatureImpl/SettingMany',1329);bcb(1330,565,Xve,nYd);_.Ok=function oYd(a){return new sYd((Q8d(),P8d),this.b.Ih(this.a,a))};_.dd=function pYd(){return null};_.Qk=function qYd(a,b,c){return c};_.Rk=function rYd(a,b,c){return c};var l7=mdb(qte,'EStructuralFeatureImpl/SimpleContentFeatureMapEntry',1330);bcb(642,565,Xve,sYd);_.Ok=function tYd(a){return new sYd(this.c,a)};_.dd=function uYd(){return this.a};_.Qk=function vYd(a,b,c){return c};_.Rk=function wYd(a,b,c){return c};var m7=mdb(qte,'EStructuralFeatureImpl/SimpleFeatureMapEntry',642);bcb(391,497,oue,xYd);_.ri=function yYd(a){return KC(c5,Uhe,26,a,0,1)};_.ni=function zYd(){return false};var o7=mdb(qte,'ESuperAdapter/1',391);bcb(444,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,836:1,49:1,97:1,150:1,444:1,114:1,115:1},BYd);_._g=function CYd(a,b,c){var d;switch(a){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),this.Ab;case 1:return this.zb;case 2:return !this.a&&(this.a=new KYd(this,j5,this)),this.a;}return bid(this,a-aLd((jGd(),iGd)),XKd((d=BD(Ajd(this,16),26),!d?iGd:d),a),b,c)};_.jh=function DYd(a,b,c){var d,e;switch(b){case 0:return !this.Ab&&(this.Ab=new cUd(a5,this,0,3)),Txd(this.Ab,a,c);case 2:return !this.a&&(this.a=new KYd(this,j5,this)),Txd(this.a,a,c);}return e=BD(XKd((d=BD(Ajd(this,16),26),!d?(jGd(),iGd):d),b),66),e.Nj().Rj(this,yjd(this),b-aLd((jGd(),iGd)),a,c)};_.lh=function EYd(a){var b;switch(a){case 0:return !!this.Ab&&this.Ab.i!=0;case 1:return this.zb!=null;case 2:return !!this.a&&this.a.i!=0;}return cid(this,a-aLd((jGd(),iGd)),XKd((b=BD(Ajd(this,16),26),!b?iGd:b),a))};_.sh=function FYd(a,b){var c;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);!this.Ab&&(this.Ab=new cUd(a5,this,0,3));ytd(this.Ab,BD(b,14));return;case 1:pnd(this,GD(b));return;case 2:!this.a&&(this.a=new KYd(this,j5,this));Uxd(this.a);!this.a&&(this.a=new KYd(this,j5,this));ytd(this.a,BD(b,14));return;}did(this,a-aLd((jGd(),iGd)),XKd((c=BD(Ajd(this,16),26),!c?iGd:c),a),b)};_.zh=function GYd(){return jGd(),iGd};_.Bh=function HYd(a){var b;switch(a){case 0:!this.Ab&&(this.Ab=new cUd(a5,this,0,3));Uxd(this.Ab);return;case 1:pnd(this,null);return;case 2:!this.a&&(this.a=new KYd(this,j5,this));Uxd(this.a);return;}eid(this,a-aLd((jGd(),iGd)),XKd((b=BD(Ajd(this,16),26),!b?iGd:b),a))};var u7=mdb(qte,'ETypeParameterImpl',444);bcb(445,85,Pve,KYd);_.cj=function LYd(a,b){return IYd(this,BD(a,87),b)};_.dj=function MYd(a,b){return JYd(this,BD(a,87),b)};var q7=mdb(qte,'ETypeParameterImpl/1',445);bcb(634,43,fke,NYd);_.ec=function OYd(){return new RYd(this)};var t7=mdb(qte,'ETypeParameterImpl/2',634);bcb(556,eie,fie,RYd);_.Fc=function SYd(a){return PYd(this,BD(a,87))};_.Gc=function TYd(a){var b,c,d;d=false;for(c=a.Kc();c.Ob();){b=BD(c.Pb(),87);Rhb(this.a,b,'')==null&&(d=true)}return d};_.$b=function UYd(){Uhb(this.a)};_.Hc=function VYd(a){return Mhb(this.a,a)};_.Kc=function WYd(){var a;return a=new nib((new eib(this.a)).a),new ZYd(a)};_.Mc=function XYd(a){return QYd(this,a)};_.gc=function YYd(){return Vhb(this.a)};var s7=mdb(qte,'ETypeParameterImpl/2/1',556);bcb(557,1,aie,ZYd);_.Nb=function $Yd(a){Rrb(this,a)};_.Pb=function aZd(){return BD(lib(this.a).cd(),87)};_.Ob=function _Yd(){return this.a.b};_.Qb=function bZd(){mib(this.a)};var r7=mdb(qte,'ETypeParameterImpl/2/1/1',557);bcb(1276,43,fke,cZd);_._b=function dZd(a){return ND(a)?Qhb(this,a):!!irb(this.f,a)};_.xc=function eZd(a){var b,c;b=ND(a)?Phb(this,a):Wd(irb(this.f,a));if(JD(b,837)){c=BD(b,837);b=c._j();Rhb(this,BD(a,235),b);return b}else return b!=null?b:a==null?(g5d(),f5d):null};var w7=mdb(qte,'EValidatorRegistryImpl',1276);bcb(1313,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,1941:1,49:1,97:1,150:1,114:1,115:1},mZd);_.Ih=function nZd(a,b){switch(a.yj()){case 21:case 22:case 23:case 24:case 26:case 31:case 32:case 37:case 38:case 39:case 40:case 43:case 44:case 48:case 49:case 20:return b==null?null:fcb(b);case 25:return gZd(b);case 27:return hZd(b);case 28:return iZd(b);case 29:return b==null?null:CQd(Pmd[0],BD(b,199));case 41:return b==null?'':hdb(BD(b,290));case 42:return fcb(b);case 50:return GD(b);default:throw vbb(new Wdb(tte+a.ne()+ute));}};_.Jh=function oZd(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;switch(a.G==-1&&(a.G=(m=bKd(a),m?HLd(m.Mh(),a):-1)),a.G){case 0:return c=new OJd,c;case 1:return b=new RHd,b;case 2:return d=new hLd,d;case 4:return e=new MPd,e;case 5:return f=new aQd,f;case 6:return g=new rQd,g;case 7:return h=new $md,h;case 10:return j=new MGd,j;case 11:return k=new SSd,k;case 12:return l=new eod,l;case 13:return n=new rUd,n;case 14:return o=new FUd,o;case 17:return p=new XUd,p;case 18:return i=new UQd,i;case 19:return q=new BYd,q;default:throw vbb(new Wdb(xte+a.zb+ute));}};_.Kh=function pZd(a,b){switch(a.yj()){case 20:return b==null?null:new tgb(b);case 21:return b==null?null:new Ygb(b);case 23:case 22:return b==null?null:fZd(b);case 26:case 24:return b==null?null:Scb(Icb(b,-128,127)<<24>>24);case 25:return Xmd(b);case 27:return jZd(b);case 28:return kZd(b);case 29:return lZd(b);case 32:case 31:return b==null?null:Hcb(b);case 38:case 37:return b==null?null:new Odb(b);case 40:case 39:return b==null?null:meb(Icb(b,Rie,Ohe));case 41:return null;case 42:return b==null?null:null;case 44:case 43:return b==null?null:Aeb(Jcb(b));case 49:case 48:return b==null?null:Web(Icb(b,awe,32767)<<16>>16);case 50:return b;default:throw vbb(new Wdb(tte+a.ne()+ute));}};var x7=mdb(qte,'EcoreFactoryImpl',1313);bcb(547,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,1939:1,49:1,97:1,150:1,179:1,547:1,114:1,115:1,675:1},AZd);_.gb=false;_.hb=false;var rZd,sZd=false;var o8=mdb(qte,'EcorePackageImpl',547);bcb(1184,1,{837:1},EZd);_._j=function FZd(){return I6d(),H6d};var I7=mdb(qte,'EcorePackageImpl/1',1184);bcb(1193,1,nwe,GZd);_.wj=function HZd(a){return JD(a,147)};_.xj=function IZd(a){return KC(k5,Uhe,147,a,0,1)};var y7=mdb(qte,'EcorePackageImpl/10',1193);bcb(1194,1,nwe,JZd);_.wj=function KZd(a){return JD(a,191)};_.xj=function LZd(a){return KC(l5,Uhe,191,a,0,1)};var z7=mdb(qte,'EcorePackageImpl/11',1194);bcb(1195,1,nwe,MZd);_.wj=function NZd(a){return JD(a,56)};_.xj=function OZd(a){return KC(m5,Uhe,56,a,0,1)};var A7=mdb(qte,'EcorePackageImpl/12',1195);bcb(1196,1,nwe,PZd);_.wj=function QZd(a){return JD(a,399)};_.xj=function RZd(a){return KC(n5,Nve,59,a,0,1)};var B7=mdb(qte,'EcorePackageImpl/13',1196);bcb(1197,1,nwe,SZd);_.wj=function TZd(a){return JD(a,235)};_.xj=function UZd(a){return KC(o5,Uhe,235,a,0,1)};var C7=mdb(qte,'EcorePackageImpl/14',1197);bcb(1198,1,nwe,VZd);_.wj=function WZd(a){return JD(a,509)};_.xj=function XZd(a){return KC(p5,Uhe,2017,a,0,1)};var D7=mdb(qte,'EcorePackageImpl/15',1198);bcb(1199,1,nwe,YZd);_.wj=function ZZd(a){return JD(a,99)};_.xj=function $Zd(a){return KC(q5,Mve,18,a,0,1)};var E7=mdb(qte,'EcorePackageImpl/16',1199);bcb(1200,1,nwe,_Zd);_.wj=function a$d(a){return JD(a,170)};_.xj=function b$d(a){return KC(t5,Mve,170,a,0,1)};var F7=mdb(qte,'EcorePackageImpl/17',1200);bcb(1201,1,nwe,c$d);_.wj=function d$d(a){return JD(a,472)};_.xj=function e$d(a){return KC(v5,Uhe,472,a,0,1)};var G7=mdb(qte,'EcorePackageImpl/18',1201);bcb(1202,1,nwe,f$d);_.wj=function g$d(a){return JD(a,548)};_.xj=function h$d(a){return KC(x6,kve,548,a,0,1)};var H7=mdb(qte,'EcorePackageImpl/19',1202);bcb(1185,1,nwe,i$d);_.wj=function j$d(a){return JD(a,322)};_.xj=function k$d(a){return KC(b5,Mve,34,a,0,1)};var T7=mdb(qte,'EcorePackageImpl/2',1185);bcb(1203,1,nwe,l$d);_.wj=function m$d(a){return JD(a,241)};_.xj=function n$d(a){return KC(j5,Tve,87,a,0,1)};var J7=mdb(qte,'EcorePackageImpl/20',1203);bcb(1204,1,nwe,o$d);_.wj=function p$d(a){return JD(a,444)};_.xj=function q$d(a){return KC(u5,Uhe,836,a,0,1)};var K7=mdb(qte,'EcorePackageImpl/21',1204);bcb(1205,1,nwe,r$d);_.wj=function s$d(a){return KD(a)};_.xj=function t$d(a){return KC(wI,nie,476,a,8,1)};var L7=mdb(qte,'EcorePackageImpl/22',1205);bcb(1206,1,nwe,u$d);_.wj=function v$d(a){return JD(a,190)};_.xj=function w$d(a){return KC(SD,nie,190,a,0,2)};var M7=mdb(qte,'EcorePackageImpl/23',1206);bcb(1207,1,nwe,x$d);_.wj=function y$d(a){return JD(a,217)};_.xj=function z$d(a){return KC(xI,nie,217,a,0,1)};var N7=mdb(qte,'EcorePackageImpl/24',1207);bcb(1208,1,nwe,A$d);_.wj=function B$d(a){return JD(a,172)};_.xj=function C$d(a){return KC(yI,nie,172,a,0,1)};var O7=mdb(qte,'EcorePackageImpl/25',1208);bcb(1209,1,nwe,D$d);_.wj=function E$d(a){return JD(a,199)};_.xj=function F$d(a){return KC($J,nie,199,a,0,1)};var P7=mdb(qte,'EcorePackageImpl/26',1209);bcb(1210,1,nwe,G$d);_.wj=function H$d(a){return false};_.xj=function I$d(a){return KC(O4,Uhe,2110,a,0,1)};var Q7=mdb(qte,'EcorePackageImpl/27',1210);bcb(1211,1,nwe,J$d);_.wj=function K$d(a){return LD(a)};_.xj=function L$d(a){return KC(BI,nie,333,a,7,1)};var R7=mdb(qte,'EcorePackageImpl/28',1211);bcb(1212,1,nwe,M$d);_.wj=function N$d(a){return JD(a,58)};_.xj=function O$d(a){return KC(T4,eme,58,a,0,1)};var S7=mdb(qte,'EcorePackageImpl/29',1212);bcb(1186,1,nwe,P$d);_.wj=function Q$d(a){return JD(a,510)};_.xj=function R$d(a){return KC(a5,{3:1,4:1,5:1,1934:1},590,a,0,1)};var c8=mdb(qte,'EcorePackageImpl/3',1186);bcb(1213,1,nwe,S$d);_.wj=function T$d(a){return JD(a,573)};_.xj=function U$d(a){return KC(U4,Uhe,1940,a,0,1)};var U7=mdb(qte,'EcorePackageImpl/30',1213);bcb(1214,1,nwe,V$d);_.wj=function W$d(a){return JD(a,153)};_.xj=function X$d(a){return KC(O9,eme,153,a,0,1)};var V7=mdb(qte,'EcorePackageImpl/31',1214);bcb(1215,1,nwe,Y$d);_.wj=function Z$d(a){return JD(a,72)};_.xj=function $$d(a){return KC(E9,owe,72,a,0,1)};var W7=mdb(qte,'EcorePackageImpl/32',1215);bcb(1216,1,nwe,_$d);_.wj=function a_d(a){return JD(a,155)};_.xj=function b_d(a){return KC(FI,nie,155,a,0,1)};var X7=mdb(qte,'EcorePackageImpl/33',1216);bcb(1217,1,nwe,c_d);_.wj=function d_d(a){return JD(a,19)};_.xj=function e_d(a){return KC(JI,nie,19,a,0,1)};var Y7=mdb(qte,'EcorePackageImpl/34',1217);bcb(1218,1,nwe,f_d);_.wj=function g_d(a){return JD(a,290)};_.xj=function h_d(a){return KC(AI,Uhe,290,a,0,1)};var Z7=mdb(qte,'EcorePackageImpl/35',1218);bcb(1219,1,nwe,i_d);_.wj=function j_d(a){return JD(a,162)};_.xj=function k_d(a){return KC(MI,nie,162,a,0,1)};var $7=mdb(qte,'EcorePackageImpl/36',1219);bcb(1220,1,nwe,l_d);_.wj=function m_d(a){return JD(a,83)};_.xj=function n_d(a){return KC(DK,Uhe,83,a,0,1)};var _7=mdb(qte,'EcorePackageImpl/37',1220);bcb(1221,1,nwe,o_d);_.wj=function p_d(a){return JD(a,591)};_.xj=function q_d(a){return KC(v8,Uhe,591,a,0,1)};var a8=mdb(qte,'EcorePackageImpl/38',1221);bcb(1222,1,nwe,r_d);_.wj=function s_d(a){return false};_.xj=function t_d(a){return KC(u8,Uhe,2111,a,0,1)};var b8=mdb(qte,'EcorePackageImpl/39',1222);bcb(1187,1,nwe,u_d);_.wj=function v_d(a){return JD(a,88)};_.xj=function w_d(a){return KC(c5,Uhe,26,a,0,1)};var i8=mdb(qte,'EcorePackageImpl/4',1187);bcb(1223,1,nwe,x_d);_.wj=function y_d(a){return JD(a,184)};_.xj=function z_d(a){return KC(UI,nie,184,a,0,1)};var d8=mdb(qte,'EcorePackageImpl/40',1223);bcb(1224,1,nwe,A_d);_.wj=function B_d(a){return ND(a)};_.xj=function C_d(a){return KC(ZI,nie,2,a,6,1)};var e8=mdb(qte,'EcorePackageImpl/41',1224);bcb(1225,1,nwe,D_d);_.wj=function E_d(a){return JD(a,588)};_.xj=function F_d(a){return KC(X4,Uhe,588,a,0,1)};var f8=mdb(qte,'EcorePackageImpl/42',1225);bcb(1226,1,nwe,G_d);_.wj=function H_d(a){return false};_.xj=function I_d(a){return KC(V4,nie,2112,a,0,1)};var g8=mdb(qte,'EcorePackageImpl/43',1226);bcb(1227,1,nwe,J_d);_.wj=function K_d(a){return JD(a,42)};_.xj=function L_d(a){return KC(CK,zie,42,a,0,1)};var h8=mdb(qte,'EcorePackageImpl/44',1227);bcb(1188,1,nwe,M_d);_.wj=function N_d(a){return JD(a,138)};_.xj=function O_d(a){return KC(d5,Uhe,138,a,0,1)};var j8=mdb(qte,'EcorePackageImpl/5',1188);bcb(1189,1,nwe,P_d);_.wj=function Q_d(a){return JD(a,148)};_.xj=function R_d(a){return KC(f5,Uhe,148,a,0,1)};var k8=mdb(qte,'EcorePackageImpl/6',1189);bcb(1190,1,nwe,S_d);_.wj=function T_d(a){return JD(a,457)};_.xj=function U_d(a){return KC(h5,Uhe,671,a,0,1)};var l8=mdb(qte,'EcorePackageImpl/7',1190);bcb(1191,1,nwe,V_d);_.wj=function W_d(a){return JD(a,573)};_.xj=function X_d(a){return KC(g5,Uhe,678,a,0,1)};var m8=mdb(qte,'EcorePackageImpl/8',1191);bcb(1192,1,nwe,Y_d);_.wj=function Z_d(a){return JD(a,471)};_.xj=function $_d(a){return KC(i5,Uhe,471,a,0,1)};var n8=mdb(qte,'EcorePackageImpl/9',1192);bcb(1025,1982,ive,c0d);_.bi=function d0d(a,b){__d(this,BD(b,415))};_.fi=function e0d(a,b){a0d(this,a,BD(b,415))};var q8=mdb(qte,'MinimalEObjectImpl/1ArrayDelegatingAdapterList',1025);bcb(1026,143,fve,f0d);_.Ai=function g0d(){return this.a.a};var p8=mdb(qte,'MinimalEObjectImpl/1ArrayDelegatingAdapterList/1',1026);bcb(1053,1052,{},i0d);var t8=mdb('org.eclipse.emf.ecore.plugin','EcorePlugin',1053);var v8=odb(pwe,'Resource');bcb(781,1378,qwe);_.Yk=function m0d(a){};_.Zk=function n0d(a){};_.Vk=function o0d(){return !this.a&&(this.a=new z0d(this)),this.a};_.Wk=function p0d(a){var b,c,d,e,f;d=a.length;if(d>0){BCb(0,a.length);if(a.charCodeAt(0)==47){f=new Skb(4);e=1;for(b=1;b0&&(a=a.substr(0,c))}}}return k0d(this,a)};_.Xk=function q0d(){return this.c};_.Ib=function r0d(){var a;return hdb(this.gm)+'@'+(a=tb(this)>>>0,a.toString(16))+" uri='"+this.d+"'"};_.b=false;var z8=mdb(rwe,'ResourceImpl',781);bcb(1379,781,qwe,s0d);var w8=mdb(rwe,'BinaryResourceImpl',1379);bcb(1169,694,pue);_.si=function v0d(a){return JD(a,56)?t0d(this,BD(a,56)):JD(a,591)?new Fyd(BD(a,591).Vk()):PD(a)===PD(this.f)?BD(a,14).Kc():(LCd(),KCd.a)};_.Ob=function w0d(){return u0d(this)};_.a=false;var z9=mdb(yve,'EcoreUtil/ContentTreeIterator',1169);bcb(1380,1169,pue,x0d);_.si=function y0d(a){return PD(a)===PD(this.f)?BD(a,15).Kc():new C6d(BD(a,56))};var x8=mdb(rwe,'ResourceImpl/5',1380);bcb(648,1994,Ove,z0d);_.Hc=function A0d(a){return this.i<=4?pud(this,a):JD(a,49)&&BD(a,49).Zg()==this.a};_.bi=function B0d(a,b){a==this.i-1&&(this.a.b||(this.a.b=true,null))};_.di=function C0d(a,b){a==0?this.a.b||(this.a.b=true,null):Atd(this,a,b)};_.fi=function D0d(a,b){};_.gi=function E0d(a,b,c){};_.aj=function F0d(){return 2};_.Ai=function G0d(){return this.a};_.bj=function H0d(){return true};_.cj=function I0d(a,b){var c;c=BD(a,49);b=c.wh(this.a,b);return b};_.dj=function J0d(a,b){var c;c=BD(a,49);return c.wh(null,b)};_.ej=function K0d(){return false};_.hi=function L0d(){return true};_.ri=function M0d(a){return KC(m5,Uhe,56,a,0,1)};_.ni=function N0d(){return false};var y8=mdb(rwe,'ResourceImpl/ContentsEList',648);bcb(957,1964,Lie,O0d);_.Zc=function P0d(a){return this.a._h(a)};_.gc=function Q0d(){return this.a.gc()};var A8=mdb(yve,'AbstractSequentialInternalEList/1',957);var K6d,L6d,M6d,N6d;bcb(624,1,{},y1d);var R0d,S0d;var G8=mdb(yve,'BasicExtendedMetaData',624);bcb(1160,1,{},C1d);_.$k=function D1d(){return null};_._k=function E1d(){this.a==-2&&A1d(this,W0d(this.d,this.b));return this.a};_.al=function F1d(){return null};_.bl=function G1d(){return mmb(),mmb(),jmb};_.ne=function H1d(){this.c==Gwe&&B1d(this,_0d(this.d,this.b));return this.c};_.cl=function I1d(){return 0};_.a=-2;_.c=Gwe;var C8=mdb(yve,'BasicExtendedMetaData/EClassExtendedMetaDataImpl',1160);bcb(1161,1,{},O1d);_.$k=function P1d(){this.a==(T0d(),R0d)&&J1d(this,V0d(this.f,this.b));return this.a};_._k=function Q1d(){return 0};_.al=function R1d(){this.c==(T0d(),R0d)&&K1d(this,Z0d(this.f,this.b));return this.c};_.bl=function S1d(){!this.d&&L1d(this,$0d(this.f,this.b));return this.d};_.ne=function T1d(){this.e==Gwe&&M1d(this,_0d(this.f,this.b));return this.e};_.cl=function U1d(){this.g==-2&&N1d(this,c1d(this.f,this.b));return this.g};_.e=Gwe;_.g=-2;var D8=mdb(yve,'BasicExtendedMetaData/EDataTypeExtendedMetaDataImpl',1161);bcb(1159,1,{},Y1d);_.b=false;_.c=false;var E8=mdb(yve,'BasicExtendedMetaData/EPackageExtendedMetaDataImpl',1159);bcb(1162,1,{},j2d);_.c=-2;_.e=Gwe;_.f=Gwe;var F8=mdb(yve,'BasicExtendedMetaData/EStructuralFeatureExtendedMetaDataImpl',1162);bcb(585,622,Pve,k2d);_.aj=function l2d(){return this.c};_.Fk=function m2d(){return false};_.li=function n2d(a,b){return b};_.c=0;var T8=mdb(yve,'EDataTypeEList',585);var O9=odb(yve,'FeatureMap');bcb(75,585,{3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},u3d);_.Vc=function v3d(a,b){o2d(this,a,BD(b,72))};_.Fc=function w3d(a){return r2d(this,BD(a,72))};_.Yh=function B3d(a){w2d(this,BD(a,72))};_.cj=function M3d(a,b){return O2d(this,BD(a,72),b)};_.dj=function N3d(a,b){return Q2d(this,BD(a,72),b)};_.ii=function P3d(a,b){return W2d(this,a,b)};_.li=function R3d(a,b){return _2d(this,a,BD(b,72))};_._c=function T3d(a,b){return c3d(this,a,BD(b,72))};_.jj=function X3d(a,b){return i3d(this,BD(a,72),b)};_.kj=function Y3d(a,b){return k3d(this,BD(a,72),b)};_.lj=function Z3d(a,b,c){return l3d(this,BD(a,72),BD(b,72),c)};_.oi=function _3d(a,b){return t3d(this,a,BD(b,72))};_.dl=function x3d(a,b){return q2d(this,a,b)};_.Wc=function y3d(a,b){var c,d,e,f,g,h,i,j,k;j=new zud(b.gc());for(e=b.Kc();e.Ob();){d=BD(e.Pb(),72);f=d.ak();if(T6d(this.e,f)){(!f.hi()||!E2d(this,f,d.dd())&&!pud(j,d))&&wtd(j,d)}else{k=S6d(this.e.Tg(),f);c=BD(this.g,119);g=true;for(h=0;h=0){b=a[this.c];if(this.k.rl(b.ak())){this.j=this.f?b:b.dd();this.i=-2;return true}}this.i=-1;this.g=-1;return false};var H8=mdb(yve,'BasicFeatureMap/FeatureEIterator',410);bcb(662,410,jie,s4d);_.Lk=function t4d(){return true};var I8=mdb(yve,'BasicFeatureMap/ResolvingFeatureEIterator',662);bcb(955,486,Vve,u4d);_.Gi=function v4d(){return this};var M8=mdb(yve,'EContentsEList/1',955);bcb(956,486,Vve,w4d);_.Lk=function x4d(){return false};var N8=mdb(yve,'EContentsEList/2',956);bcb(954,279,Wve,y4d);_.Nk=function z4d(a){};_.Ob=function A4d(){return false};_.Sb=function B4d(){return false};var O8=mdb(yve,'EContentsEList/FeatureIteratorImpl/1',954);bcb(825,585,Pve,C4d);_.ci=function D4d(){this.a=true};_.fj=function E4d(){return this.a};_.Xj=function F4d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var S8=mdb(yve,'EDataTypeEList/Unsettable',825);bcb(1849,585,Pve,G4d);_.hi=function H4d(){return true};var V8=mdb(yve,'EDataTypeUniqueEList',1849);bcb(1850,825,Pve,I4d);_.hi=function J4d(){return true};var U8=mdb(yve,'EDataTypeUniqueEList/Unsettable',1850);bcb(139,85,Pve,K4d);_.Ek=function L4d(){return true};_.li=function M4d(a,b){return ILd(this,a,BD(b,56))};var W8=mdb(yve,'EObjectContainmentEList/Resolving',139);bcb(1163,545,Pve,N4d);_.Ek=function O4d(){return true};_.li=function P4d(a,b){return ILd(this,a,BD(b,56))};var X8=mdb(yve,'EObjectContainmentEList/Unsettable/Resolving',1163);bcb(748,16,Pve,Q4d);_.ci=function R4d(){this.a=true};_.fj=function S4d(){return this.a};_.Xj=function T4d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var a9=mdb(yve,'EObjectContainmentWithInverseEList/Unsettable',748);bcb(1173,748,Pve,U4d);_.Ek=function V4d(){return true};_.li=function W4d(a,b){return ILd(this,a,BD(b,56))};var _8=mdb(yve,'EObjectContainmentWithInverseEList/Unsettable/Resolving',1173);bcb(743,496,Pve,X4d);_.ci=function Y4d(){this.a=true};_.fj=function Z4d(){return this.a};_.Xj=function $4d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var c9=mdb(yve,'EObjectEList/Unsettable',743);bcb(328,496,Pve,_4d);_.Ek=function a5d(){return true};_.li=function b5d(a,b){return ILd(this,a,BD(b,56))};var f9=mdb(yve,'EObjectResolvingEList',328);bcb(1641,743,Pve,c5d);_.Ek=function d5d(){return true};_.li=function e5d(a,b){return ILd(this,a,BD(b,56))};var e9=mdb(yve,'EObjectResolvingEList/Unsettable',1641);bcb(1381,1,{},h5d);var f5d;var g9=mdb(yve,'EObjectValidator',1381);bcb(546,496,Pve,i5d);_.zk=function j5d(){return this.d};_.Ak=function k5d(){return this.b};_.bj=function l5d(){return true};_.Dk=function m5d(){return true};_.b=0;var k9=mdb(yve,'EObjectWithInverseEList',546);bcb(1176,546,Pve,n5d);_.Ck=function o5d(){return true};var h9=mdb(yve,'EObjectWithInverseEList/ManyInverse',1176);bcb(625,546,Pve,p5d);_.ci=function q5d(){this.a=true};_.fj=function r5d(){return this.a};_.Xj=function s5d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var j9=mdb(yve,'EObjectWithInverseEList/Unsettable',625);bcb(1175,625,Pve,t5d);_.Ck=function u5d(){return true};var i9=mdb(yve,'EObjectWithInverseEList/Unsettable/ManyInverse',1175);bcb(749,546,Pve,v5d);_.Ek=function w5d(){return true};_.li=function x5d(a,b){return ILd(this,a,BD(b,56))};var o9=mdb(yve,'EObjectWithInverseResolvingEList',749);bcb(31,749,Pve,y5d);_.Ck=function z5d(){return true};var l9=mdb(yve,'EObjectWithInverseResolvingEList/ManyInverse',31);bcb(750,625,Pve,A5d);_.Ek=function B5d(){return true};_.li=function C5d(a,b){return ILd(this,a,BD(b,56))};var n9=mdb(yve,'EObjectWithInverseResolvingEList/Unsettable',750);bcb(1174,750,Pve,D5d);_.Ck=function E5d(){return true};var m9=mdb(yve,'EObjectWithInverseResolvingEList/Unsettable/ManyInverse',1174);bcb(1164,622,Pve);_.ai=function F5d(){return (this.b&1792)==0};_.ci=function G5d(){this.b|=1};_.Bk=function H5d(){return (this.b&4)!=0};_.bj=function I5d(){return (this.b&40)!=0};_.Ck=function J5d(){return (this.b&16)!=0};_.Dk=function K5d(){return (this.b&8)!=0};_.Ek=function L5d(){return (this.b&Dve)!=0};_.rk=function M5d(){return (this.b&32)!=0};_.Fk=function N5d(){return (this.b&zte)!=0};_.wj=function O5d(a){return !this.d?this.ak().Yj().wj(a):qEd(this.d,a)};_.fj=function P5d(){return (this.b&2)!=0?(this.b&1)!=0:this.i!=0};_.hi=function Q5d(){return (this.b&128)!=0};_.Xj=function S5d(){var a;Uxd(this);if((this.b&2)!=0){if(oid(this.e)){a=(this.b&1)!=0;this.b&=-2;GLd(this,new qSd(this.e,2,bLd(this.e.Tg(),this.ak()),a,false))}else{this.b&=-2}}};_.ni=function T5d(){return (this.b&1536)==0};_.b=0;var q9=mdb(yve,'EcoreEList/Generic',1164);bcb(1165,1164,Pve,U5d);_.ak=function V5d(){return this.a};var p9=mdb(yve,'EcoreEList/Dynamic',1165);bcb(747,63,oue,W5d);_.ri=function X5d(a){return izd(this.a.a,a)};var u9=mdb(yve,'EcoreEMap/1',747);bcb(746,85,Pve,Y5d);_.bi=function Z5d(a,b){uAd(this.b,BD(b,133))};_.di=function $5d(a,b){tAd(this.b)};_.ei=function _5d(a,b,c){var d;++(d=this.b,BD(b,133),d).e};_.fi=function a6d(a,b){vAd(this.b,BD(b,133))};_.gi=function b6d(a,b,c){vAd(this.b,BD(c,133));PD(c)===PD(b)&&BD(c,133).Th(CAd(BD(b,133).cd()));uAd(this.b,BD(b,133))};var v9=mdb(yve,'EcoreEMap/DelegateEObjectContainmentEList',746);bcb(1171,151,Ave,c6d);var x9=mdb(yve,'EcoreEMap/Unsettable',1171);bcb(1172,746,Pve,d6d);_.ci=function e6d(){this.a=true};_.fj=function f6d(){return this.a};_.Xj=function g6d(){var a;Uxd(this);if(oid(this.e)){a=this.a;this.a=false;Uhd(this.e,new qSd(this.e,2,this.c,a,false))}else{this.a=false}};_.a=false;var w9=mdb(yve,'EcoreEMap/Unsettable/UnsettableDelegateEObjectContainmentEList',1172);bcb(1168,228,fke,A6d);_.a=false;_.b=false;var A9=mdb(yve,'EcoreUtil/Copier',1168);bcb(745,1,aie,C6d);_.Nb=function D6d(a){Rrb(this,a)};_.Ob=function E6d(){return B6d(this)};_.Pb=function F6d(){var a;B6d(this);a=this.b;this.b=null;return a};_.Qb=function G6d(){this.a.Qb()};var B9=mdb(yve,'EcoreUtil/ProperContentIterator',745);bcb(1382,1381,{},J6d);var H6d;var C9=mdb(yve,'EcoreValidator',1382);var P6d;var N9=odb(yve,'FeatureMapUtil/Validator');bcb(1260,1,{1942:1},U6d);_.rl=function V6d(a){return true};var F9=mdb(yve,'FeatureMapUtil/1',1260);bcb(757,1,{1942:1},Z6d);_.rl=function $6d(a){var b;if(this.c==a)return true;b=DD(Ohb(this.a,a));if(b==null){if(Y6d(this,a)){_6d(this.a,a,(Bcb(),Acb));return true}else{_6d(this.a,a,(Bcb(),zcb));return false}}else{return b==(Bcb(),Acb)}};_.e=false;var W6d;var I9=mdb(yve,'FeatureMapUtil/BasicValidator',757);bcb(758,43,fke,a7d);var H9=mdb(yve,'FeatureMapUtil/BasicValidator/Cache',758);bcb(501,52,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,69:1,95:1},f7d);_.Vc=function g7d(a,b){p2d(this.c,this.b,a,b)};_.Fc=function h7d(a){return q2d(this.c,this.b,a)};_.Wc=function i7d(a,b){return s2d(this.c,this.b,a,b)};_.Gc=function j7d(a){return b7d(this,a)};_.Xh=function k7d(a,b){u2d(this.c,this.b,a,b)};_.lk=function l7d(a,b){return x2d(this.c,this.b,a,b)};_.pi=function m7d(a){return J2d(this.c,this.b,a,false)};_.Zh=function n7d(){return y2d(this.c,this.b)};_.$h=function o7d(){return z2d(this.c,this.b)};_._h=function p7d(a){return A2d(this.c,this.b,a)};_.mk=function q7d(a,b){return c7d(this,a,b)};_.$b=function r7d(){d7d(this)};_.Hc=function s7d(a){return E2d(this.c,this.b,a)};_.Ic=function t7d(a){return G2d(this.c,this.b,a)};_.Xb=function u7d(a){return J2d(this.c,this.b,a,true)};_.Wj=function v7d(a){return this};_.Xc=function w7d(a){return L2d(this.c,this.b,a)};_.dc=function x7d(){return e7d(this)};_.fj=function y7d(){return !R2d(this.c,this.b)};_.Kc=function z7d(){return S2d(this.c,this.b)};_.Yc=function A7d(){return U2d(this.c,this.b)};_.Zc=function B7d(a){return V2d(this.c,this.b,a)};_.ii=function C7d(a,b){return X2d(this.c,this.b,a,b)};_.ji=function D7d(a,b){Y2d(this.c,this.b,a,b)};_.$c=function E7d(a){return Z2d(this.c,this.b,a)};_.Mc=function F7d(a){return $2d(this.c,this.b,a)};_._c=function G7d(a,b){return e3d(this.c,this.b,a,b)};_.Wb=function H7d(a){D2d(this.c,this.b);b7d(this,BD(a,15))};_.gc=function I7d(){return n3d(this.c,this.b)};_.Pc=function J7d(){return o3d(this.c,this.b)};_.Qc=function K7d(a){return q3d(this.c,this.b,a)};_.Ib=function L7d(){var a,b;b=new Hfb;b.a+='[';for(a=y2d(this.c,this.b);b4d(a);){Efb(b,xfb(d4d(a)));b4d(a)&&(b.a+=She,b)}b.a+=']';return b.a};_.Xj=function M7d(){D2d(this.c,this.b)};var J9=mdb(yve,'FeatureMapUtil/FeatureEList',501);bcb(627,36,fve,O7d);_.yi=function P7d(a){return N7d(this,a)};_.Di=function Q7d(a){var b,c,d,e,f,g,h;switch(this.d){case 1:case 2:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.g=a.zi();a.xi()==1&&(this.d=1);return true}break}case 3:{e=a.xi();switch(e){case 3:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.d=5;b=new zud(2);wtd(b,this.g);wtd(b,a.zi());this.g=b;return true}break}}break}case 5:{e=a.xi();switch(e){case 3:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){c=BD(this.g,14);c.Fc(a.zi());return true}break}}break}case 4:{e=a.xi();switch(e){case 3:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.d=1;this.g=a.zi();return true}break}case 4:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){this.d=6;h=new zud(2);wtd(h,this.n);wtd(h,a.Bi());this.n=h;g=OC(GC(WD,1),oje,25,15,[this.o,a.Ci()]);this.g=g;return true}break}}break}case 6:{e=a.xi();switch(e){case 4:{f=a.Ai();if(PD(f)===PD(this.c)&&N7d(this,null)==a.yi(null)){c=BD(this.n,14);c.Fc(a.Bi());g=BD(this.g,48);d=KC(WD,oje,25,g.length+1,15,1);$fb(g,0,d,0,g.length);d[g.length]=a.Ci();this.g=d;return true}break}}break}}return false};var K9=mdb(yve,'FeatureMapUtil/FeatureENotificationImpl',627);bcb(552,501,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},R7d);_.dl=function S7d(a,b){return q2d(this.c,a,b)};_.el=function T7d(a,b,c){return x2d(this.c,a,b,c)};_.fl=function U7d(a,b,c){return C2d(this.c,a,b,c)};_.gl=function V7d(){return this};_.hl=function W7d(a,b){return K2d(this.c,a,b)};_.il=function X7d(a){return BD(J2d(this.c,this.b,a,false),72).ak()};_.jl=function Y7d(a){return BD(J2d(this.c,this.b,a,false),72).dd()};_.kl=function Z7d(){return this.a};_.ll=function $7d(a){return !R2d(this.c,a)};_.ml=function _7d(a,b){f3d(this.c,a,b)};_.nl=function a8d(a){return g3d(this.c,a)};_.ol=function b8d(a){s3d(this.c,a)};var L9=mdb(yve,'FeatureMapUtil/FeatureFeatureMap',552);bcb(1259,1,zve,c8d);_.Wj=function d8d(a){return J2d(this.b,this.a,-1,a)};_.fj=function e8d(){return !R2d(this.b,this.a)};_.Wb=function f8d(a){f3d(this.b,this.a,a)};_.Xj=function g8d(){D2d(this.b,this.a)};var M9=mdb(yve,'FeatureMapUtil/FeatureValue',1259);var h8d,i8d,j8d,k8d,l8d;var Q9=odb(Iwe,'AnyType');bcb(666,60,Tie,n8d);var R9=mdb(Iwe,'InvalidDatatypeValueException',666);var S9=odb(Iwe,Jwe);var T9=odb(Iwe,Kwe);var U9=odb(Iwe,Lwe);var o8d;var q8d;var s8d,t8d,u8d,v8d,w8d,x8d,y8d,z8d,A8d,B8d,C8d,D8d,E8d,F8d,G8d,H8d,I8d,J8d,K8d,L8d,M8d,N8d,O8d,P8d;bcb(830,506,{105:1,92:1,90:1,56:1,49:1,97:1,843:1},R8d);_._g=function S8d(a,b,c){switch(a){case 0:if(c)return !this.c&&(this.c=new u3d(this,0)),this.c;return !this.c&&(this.c=new u3d(this,0)),this.c.b;case 1:if(c)return !this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153);return (!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).kl();case 2:if(c)return !this.b&&(this.b=new u3d(this,2)),this.b;return !this.b&&(this.b=new u3d(this,2)),this.b.b;}return bid(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.jh=function T8d(a,b,c){var d;switch(b){case 0:return !this.c&&(this.c=new u3d(this,0)),B2d(this.c,a,c);case 1:return (!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),69)).mk(a,c);case 2:return !this.b&&(this.b=new u3d(this,2)),B2d(this.b,a,c);}return d=BD(XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),b),66),d.Nj().Rj(this,Aid(this),b-aLd(this.zh()),a,c)};_.lh=function U8d(a){switch(a){case 0:return !!this.c&&this.c.i!=0;case 1:return !(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).dc();case 2:return !!this.b&&this.b.i!=0;}return cid(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function V8d(a,b){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));d3d(this.c,b);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).Wb(b);return;case 2:!this.b&&(this.b=new u3d(this,2));d3d(this.b,b);return;}did(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function W8d(){return Q8d(),s8d};_.Bh=function X8d(a){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));Uxd(this.c);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).$b();return;case 2:!this.b&&(this.b=new u3d(this,2));Uxd(this.b);return;}eid(this,a-aLd(this.zh()),XKd((this.j&2)==0?this.zh():(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.Ib=function Y8d(){var a;if((this.j&4)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (mixed: ';Dfb(a,this.c);a.a+=', anyAttribute: ';Dfb(a,this.b);a.a+=')';return a.a};var V9=mdb(Mwe,'AnyTypeImpl',830);bcb(667,506,{105:1,92:1,90:1,56:1,49:1,97:1,2021:1,667:1},_8d);_._g=function a9d(a,b,c){switch(a){case 0:return this.a;case 1:return this.b;}return bid(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.lh=function b9d(a){switch(a){case 0:return this.a!=null;case 1:return this.b!=null;}return cid(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function c9d(a,b){switch(a){case 0:Z8d(this,GD(b));return;case 1:$8d(this,GD(b));return;}did(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function d9d(){return Q8d(),F8d};_.Bh=function e9d(a){switch(a){case 0:this.a=null;return;case 1:this.b=null;return;}eid(this,a-aLd((Q8d(),F8d)),XKd((this.j&2)==0?F8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.Ib=function f9d(){var a;if((this.j&4)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (data: ';Efb(a,this.a);a.a+=', target: ';Efb(a,this.b);a.a+=')';return a.a};_.a=null;_.b=null;var W9=mdb(Mwe,'ProcessingInstructionImpl',667);bcb(668,830,{105:1,92:1,90:1,56:1,49:1,97:1,843:1,2022:1,668:1},i9d);_._g=function j9d(a,b,c){switch(a){case 0:if(c)return !this.c&&(this.c=new u3d(this,0)),this.c;return !this.c&&(this.c=new u3d(this,0)),this.c.b;case 1:if(c)return !this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153);return (!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).kl();case 2:if(c)return !this.b&&(this.b=new u3d(this,2)),this.b;return !this.b&&(this.b=new u3d(this,2)),this.b.b;case 3:return !this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true));case 4:return j6d(this.a,(!this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true))));case 5:return this.a;}return bid(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.lh=function k9d(a){switch(a){case 0:return !!this.c&&this.c.i!=0;case 1:return !(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).dc();case 2:return !!this.b&&this.b.i!=0;case 3:return !this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true))!=null;case 4:return j6d(this.a,(!this.c&&(this.c=new u3d(this,0)),GD(K2d(this.c,(Q8d(),I8d),true))))!=null;case 5:return !!this.a;}return cid(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function l9d(a,b){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));d3d(this.c,b);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(BD(T2d(this.c,(Q8d(),t8d)),153),215)).Wb(b);return;case 2:!this.b&&(this.b=new u3d(this,2));d3d(this.b,b);return;case 3:h9d(this,GD(b));return;case 4:h9d(this,h6d(this.a,b));return;case 5:g9d(this,BD(b,148));return;}did(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function m9d(){return Q8d(),H8d};_.Bh=function n9d(a){switch(a){case 0:!this.c&&(this.c=new u3d(this,0));Uxd(this.c);return;case 1:(!this.c&&(this.c=new u3d(this,0)),BD(T2d(this.c,(Q8d(),t8d)),153)).$b();return;case 2:!this.b&&(this.b=new u3d(this,2));Uxd(this.b);return;case 3:!this.c&&(this.c=new u3d(this,0));f3d(this.c,(Q8d(),I8d),null);return;case 4:h9d(this,h6d(this.a,null));return;case 5:this.a=null;return;}eid(this,a-aLd((Q8d(),H8d)),XKd((this.j&2)==0?H8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};var X9=mdb(Mwe,'SimpleAnyTypeImpl',668);bcb(669,506,{105:1,92:1,90:1,56:1,49:1,97:1,2023:1,669:1},o9d);_._g=function p9d(a,b,c){switch(a){case 0:if(c)return !this.a&&(this.a=new u3d(this,0)),this.a;return !this.a&&(this.a=new u3d(this,0)),this.a.b;case 1:return c?(!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1)),this.b):(!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1)),FAd(this.b));case 2:return c?(!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2)),this.c):(!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2)),FAd(this.c));case 3:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),L8d));case 4:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),M8d));case 5:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),O8d));case 6:return !this.a&&(this.a=new u3d(this,0)),T2d(this.a,(Q8d(),P8d));}return bid(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b,c)};_.jh=function q9d(a,b,c){var d;switch(b){case 0:return !this.a&&(this.a=new u3d(this,0)),B2d(this.a,a,c);case 1:return !this.b&&(this.b=new dId((jGd(),fGd),x6,this,1)),bId(this.b,a,c);case 2:return !this.c&&(this.c=new dId((jGd(),fGd),x6,this,2)),bId(this.c,a,c);case 5:return !this.a&&(this.a=new u3d(this,0)),c7d(T2d(this.a,(Q8d(),O8d)),a,c);}return d=BD(XKd((this.j&2)==0?(Q8d(),K8d):(!this.k&&(this.k=new HGd),this.k).ck(),b),66),d.Nj().Rj(this,Aid(this),b-aLd((Q8d(),K8d)),a,c)};_.lh=function r9d(a){switch(a){case 0:return !!this.a&&this.a.i!=0;case 1:return !!this.b&&this.b.f!=0;case 2:return !!this.c&&this.c.f!=0;case 3:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),L8d)));case 4:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),M8d)));case 5:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),O8d)));case 6:return !this.a&&(this.a=new u3d(this,0)),!e7d(T2d(this.a,(Q8d(),P8d)));}return cid(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.sh=function s9d(a,b){switch(a){case 0:!this.a&&(this.a=new u3d(this,0));d3d(this.a,b);return;case 1:!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1));cId(this.b,b);return;case 2:!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2));cId(this.c,b);return;case 3:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),L8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,L8d),BD(b,14));return;case 4:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),M8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,M8d),BD(b,14));return;case 5:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),O8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,O8d),BD(b,14));return;case 6:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),P8d)));!this.a&&(this.a=new u3d(this,0));b7d(T2d(this.a,P8d),BD(b,14));return;}did(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a),b)};_.zh=function t9d(){return Q8d(),K8d};_.Bh=function u9d(a){switch(a){case 0:!this.a&&(this.a=new u3d(this,0));Uxd(this.a);return;case 1:!this.b&&(this.b=new dId((jGd(),fGd),x6,this,1));this.b.c.$b();return;case 2:!this.c&&(this.c=new dId((jGd(),fGd),x6,this,2));this.c.c.$b();return;case 3:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),L8d)));return;case 4:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),M8d)));return;case 5:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),O8d)));return;case 6:!this.a&&(this.a=new u3d(this,0));d7d(T2d(this.a,(Q8d(),P8d)));return;}eid(this,a-aLd((Q8d(),K8d)),XKd((this.j&2)==0?K8d:(!this.k&&(this.k=new HGd),this.k).ck(),a))};_.Ib=function v9d(){var a;if((this.j&4)!=0)return Eid(this);a=new Jfb(Eid(this));a.a+=' (mixed: ';Dfb(a,this.a);a.a+=')';return a.a};var Y9=mdb(Mwe,'XMLTypeDocumentRootImpl',669);bcb(1919,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1,2024:1},U9d);_.Ih=function V9d(a,b){switch(a.yj()){case 7:case 8:case 9:case 10:case 16:case 22:case 23:case 24:case 25:case 26:case 32:case 33:case 34:case 36:case 37:case 44:case 45:case 50:case 51:case 53:case 55:case 56:case 57:case 58:case 60:case 61:case 4:return b==null?null:fcb(b);case 19:case 28:case 29:case 35:case 38:case 39:case 41:case 46:case 52:case 54:case 5:return GD(b);case 6:return C9d(BD(b,190));case 12:case 47:case 49:case 11:return Vmd(this,a,b);case 13:return b==null?null:qgb(BD(b,240));case 15:case 14:return b==null?null:D9d(Edb(ED(b)));case 17:return E9d((Q8d(),b));case 18:return E9d(b);case 21:case 20:return b==null?null:F9d(BD(b,155).a);case 27:return G9d(BD(b,190));case 30:return H9d((Q8d(),BD(b,15)));case 31:return H9d(BD(b,15));case 40:return K9d((Q8d(),b));case 42:return I9d((Q8d(),b));case 43:return I9d(b);case 59:case 48:return J9d((Q8d(),b));default:throw vbb(new Wdb(tte+a.ne()+ute));}};_.Jh=function W9d(a){var b,c,d,e,f;switch(a.G==-1&&(a.G=(c=bKd(a),c?HLd(c.Mh(),a):-1)),a.G){case 0:return b=new R8d,b;case 1:return d=new _8d,d;case 2:return e=new i9d,e;case 3:return f=new o9d,f;default:throw vbb(new Wdb(xte+a.zb+ute));}};_.Kh=function X9d(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;switch(a.yj()){case 5:case 52:case 4:return b;case 6:return L9d(b);case 8:case 7:return b==null?null:B9d(b);case 9:return b==null?null:Scb(Icb((d=Qge(b,true),d.length>0&&(BCb(0,d.length),d.charCodeAt(0)==43)?d.substr(1):d),-128,127)<<24>>24);case 10:return b==null?null:Scb(Icb((e=Qge(b,true),e.length>0&&(BCb(0,e.length),e.charCodeAt(0)==43)?e.substr(1):e),-128,127)<<24>>24);case 11:return GD(Wmd(this,(Q8d(),w8d),b));case 12:return GD(Wmd(this,(Q8d(),x8d),b));case 13:return b==null?null:new tgb(Qge(b,true));case 15:case 14:return M9d(b);case 16:return GD(Wmd(this,(Q8d(),y8d),b));case 17:return N9d((Q8d(),b));case 18:return N9d(b);case 28:case 29:case 35:case 38:case 39:case 41:case 54:case 19:return Qge(b,true);case 21:case 20:return O9d(b);case 22:return GD(Wmd(this,(Q8d(),z8d),b));case 23:return GD(Wmd(this,(Q8d(),A8d),b));case 24:return GD(Wmd(this,(Q8d(),B8d),b));case 25:return GD(Wmd(this,(Q8d(),C8d),b));case 26:return GD(Wmd(this,(Q8d(),D8d),b));case 27:return P9d(b);case 30:return Q9d((Q8d(),b));case 31:return Q9d(b);case 32:return b==null?null:meb(Icb((k=Qge(b,true),k.length>0&&(BCb(0,k.length),k.charCodeAt(0)==43)?k.substr(1):k),Rie,Ohe));case 33:return b==null?null:new Ygb((l=Qge(b,true),l.length>0&&(BCb(0,l.length),l.charCodeAt(0)==43)?l.substr(1):l));case 34:return b==null?null:meb(Icb((m=Qge(b,true),m.length>0&&(BCb(0,m.length),m.charCodeAt(0)==43)?m.substr(1):m),Rie,Ohe));case 36:return b==null?null:Aeb(Jcb((n=Qge(b,true),n.length>0&&(BCb(0,n.length),n.charCodeAt(0)==43)?n.substr(1):n)));case 37:return b==null?null:Aeb(Jcb((o=Qge(b,true),o.length>0&&(BCb(0,o.length),o.charCodeAt(0)==43)?o.substr(1):o)));case 40:return T9d((Q8d(),b));case 42:return R9d((Q8d(),b));case 43:return R9d(b);case 44:return b==null?null:new Ygb((p=Qge(b,true),p.length>0&&(BCb(0,p.length),p.charCodeAt(0)==43)?p.substr(1):p));case 45:return b==null?null:new Ygb((q=Qge(b,true),q.length>0&&(BCb(0,q.length),q.charCodeAt(0)==43)?q.substr(1):q));case 46:return Qge(b,false);case 47:return GD(Wmd(this,(Q8d(),E8d),b));case 59:case 48:return S9d((Q8d(),b));case 49:return GD(Wmd(this,(Q8d(),G8d),b));case 50:return b==null?null:Web(Icb((r=Qge(b,true),r.length>0&&(BCb(0,r.length),r.charCodeAt(0)==43)?r.substr(1):r),awe,32767)<<16>>16);case 51:return b==null?null:Web(Icb((f=Qge(b,true),f.length>0&&(BCb(0,f.length),f.charCodeAt(0)==43)?f.substr(1):f),awe,32767)<<16>>16);case 53:return GD(Wmd(this,(Q8d(),J8d),b));case 55:return b==null?null:Web(Icb((g=Qge(b,true),g.length>0&&(BCb(0,g.length),g.charCodeAt(0)==43)?g.substr(1):g),awe,32767)<<16>>16);case 56:return b==null?null:Web(Icb((h=Qge(b,true),h.length>0&&(BCb(0,h.length),h.charCodeAt(0)==43)?h.substr(1):h),awe,32767)<<16>>16);case 57:return b==null?null:Aeb(Jcb((i=Qge(b,true),i.length>0&&(BCb(0,i.length),i.charCodeAt(0)==43)?i.substr(1):i)));case 58:return b==null?null:Aeb(Jcb((j=Qge(b,true),j.length>0&&(BCb(0,j.length),j.charCodeAt(0)==43)?j.substr(1):j)));case 60:return b==null?null:meb(Icb((c=Qge(b,true),c.length>0&&(BCb(0,c.length),c.charCodeAt(0)==43)?c.substr(1):c),Rie,Ohe));case 61:return b==null?null:meb(Icb(Qge(b,true),Rie,Ohe));default:throw vbb(new Wdb(tte+a.ne()+ute));}};var w9d,x9d,y9d,z9d;var Z9=mdb(Mwe,'XMLTypeFactoryImpl',1919);bcb(586,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1,1945:1,586:1},cae);_.N=false;_.O=false;var Z9d=false;var Yab=mdb(Mwe,'XMLTypePackageImpl',586);bcb(1852,1,{837:1},fae);_._j=function gae(){return Uge(),Tge};var iab=mdb(Mwe,'XMLTypePackageImpl/1',1852);bcb(1861,1,nwe,hae);_.wj=function iae(a){return ND(a)};_.xj=function jae(a){return KC(ZI,nie,2,a,6,1)};var $9=mdb(Mwe,'XMLTypePackageImpl/10',1861);bcb(1862,1,nwe,kae);_.wj=function lae(a){return ND(a)};_.xj=function mae(a){return KC(ZI,nie,2,a,6,1)};var _9=mdb(Mwe,'XMLTypePackageImpl/11',1862);bcb(1863,1,nwe,nae);_.wj=function oae(a){return ND(a)};_.xj=function pae(a){return KC(ZI,nie,2,a,6,1)};var aab=mdb(Mwe,'XMLTypePackageImpl/12',1863);bcb(1864,1,nwe,qae);_.wj=function rae(a){return LD(a)};_.xj=function sae(a){return KC(BI,nie,333,a,7,1)};var bab=mdb(Mwe,'XMLTypePackageImpl/13',1864);bcb(1865,1,nwe,tae);_.wj=function uae(a){return ND(a)};_.xj=function vae(a){return KC(ZI,nie,2,a,6,1)};var cab=mdb(Mwe,'XMLTypePackageImpl/14',1865);bcb(1866,1,nwe,wae);_.wj=function xae(a){return JD(a,15)};_.xj=function yae(a){return KC(yK,eme,15,a,0,1)};var dab=mdb(Mwe,'XMLTypePackageImpl/15',1866);bcb(1867,1,nwe,zae);_.wj=function Aae(a){return JD(a,15)};_.xj=function Bae(a){return KC(yK,eme,15,a,0,1)};var eab=mdb(Mwe,'XMLTypePackageImpl/16',1867);bcb(1868,1,nwe,Cae);_.wj=function Dae(a){return ND(a)};_.xj=function Eae(a){return KC(ZI,nie,2,a,6,1)};var fab=mdb(Mwe,'XMLTypePackageImpl/17',1868);bcb(1869,1,nwe,Fae);_.wj=function Gae(a){return JD(a,155)};_.xj=function Hae(a){return KC(FI,nie,155,a,0,1)};var gab=mdb(Mwe,'XMLTypePackageImpl/18',1869);bcb(1870,1,nwe,Iae);_.wj=function Jae(a){return ND(a)};_.xj=function Kae(a){return KC(ZI,nie,2,a,6,1)};var hab=mdb(Mwe,'XMLTypePackageImpl/19',1870);bcb(1853,1,nwe,Lae);_.wj=function Mae(a){return JD(a,843)};_.xj=function Nae(a){return KC(Q9,Uhe,843,a,0,1)};var tab=mdb(Mwe,'XMLTypePackageImpl/2',1853);bcb(1871,1,nwe,Oae);_.wj=function Pae(a){return ND(a)};_.xj=function Qae(a){return KC(ZI,nie,2,a,6,1)};var jab=mdb(Mwe,'XMLTypePackageImpl/20',1871);bcb(1872,1,nwe,Rae);_.wj=function Sae(a){return ND(a)};_.xj=function Tae(a){return KC(ZI,nie,2,a,6,1)};var kab=mdb(Mwe,'XMLTypePackageImpl/21',1872);bcb(1873,1,nwe,Uae);_.wj=function Vae(a){return ND(a)};_.xj=function Wae(a){return KC(ZI,nie,2,a,6,1)};var lab=mdb(Mwe,'XMLTypePackageImpl/22',1873);bcb(1874,1,nwe,Xae);_.wj=function Yae(a){return ND(a)};_.xj=function Zae(a){return KC(ZI,nie,2,a,6,1)};var mab=mdb(Mwe,'XMLTypePackageImpl/23',1874);bcb(1875,1,nwe,$ae);_.wj=function _ae(a){return JD(a,190)};_.xj=function abe(a){return KC(SD,nie,190,a,0,2)};var nab=mdb(Mwe,'XMLTypePackageImpl/24',1875);bcb(1876,1,nwe,bbe);_.wj=function cbe(a){return ND(a)};_.xj=function dbe(a){return KC(ZI,nie,2,a,6,1)};var oab=mdb(Mwe,'XMLTypePackageImpl/25',1876);bcb(1877,1,nwe,ebe);_.wj=function fbe(a){return ND(a)};_.xj=function gbe(a){return KC(ZI,nie,2,a,6,1)};var pab=mdb(Mwe,'XMLTypePackageImpl/26',1877);bcb(1878,1,nwe,hbe);_.wj=function ibe(a){return JD(a,15)};_.xj=function jbe(a){return KC(yK,eme,15,a,0,1)};var qab=mdb(Mwe,'XMLTypePackageImpl/27',1878);bcb(1879,1,nwe,kbe);_.wj=function lbe(a){return JD(a,15)};_.xj=function mbe(a){return KC(yK,eme,15,a,0,1)};var rab=mdb(Mwe,'XMLTypePackageImpl/28',1879);bcb(1880,1,nwe,nbe);_.wj=function obe(a){return ND(a)};_.xj=function pbe(a){return KC(ZI,nie,2,a,6,1)};var sab=mdb(Mwe,'XMLTypePackageImpl/29',1880);bcb(1854,1,nwe,qbe);_.wj=function rbe(a){return JD(a,667)};_.xj=function sbe(a){return KC(S9,Uhe,2021,a,0,1)};var Eab=mdb(Mwe,'XMLTypePackageImpl/3',1854);bcb(1881,1,nwe,tbe);_.wj=function ube(a){return JD(a,19)};_.xj=function vbe(a){return KC(JI,nie,19,a,0,1)};var uab=mdb(Mwe,'XMLTypePackageImpl/30',1881);bcb(1882,1,nwe,wbe);_.wj=function xbe(a){return ND(a)};_.xj=function ybe(a){return KC(ZI,nie,2,a,6,1)};var vab=mdb(Mwe,'XMLTypePackageImpl/31',1882);bcb(1883,1,nwe,zbe);_.wj=function Abe(a){return JD(a,162)};_.xj=function Bbe(a){return KC(MI,nie,162,a,0,1)};var wab=mdb(Mwe,'XMLTypePackageImpl/32',1883);bcb(1884,1,nwe,Cbe);_.wj=function Dbe(a){return ND(a)};_.xj=function Ebe(a){return KC(ZI,nie,2,a,6,1)};var xab=mdb(Mwe,'XMLTypePackageImpl/33',1884);bcb(1885,1,nwe,Fbe);_.wj=function Gbe(a){return ND(a)};_.xj=function Hbe(a){return KC(ZI,nie,2,a,6,1)};var yab=mdb(Mwe,'XMLTypePackageImpl/34',1885);bcb(1886,1,nwe,Ibe);_.wj=function Jbe(a){return ND(a)};_.xj=function Kbe(a){return KC(ZI,nie,2,a,6,1)};var zab=mdb(Mwe,'XMLTypePackageImpl/35',1886);bcb(1887,1,nwe,Lbe);_.wj=function Mbe(a){return ND(a)};_.xj=function Nbe(a){return KC(ZI,nie,2,a,6,1)};var Aab=mdb(Mwe,'XMLTypePackageImpl/36',1887);bcb(1888,1,nwe,Obe);_.wj=function Pbe(a){return JD(a,15)};_.xj=function Qbe(a){return KC(yK,eme,15,a,0,1)};var Bab=mdb(Mwe,'XMLTypePackageImpl/37',1888);bcb(1889,1,nwe,Rbe);_.wj=function Sbe(a){return JD(a,15)};_.xj=function Tbe(a){return KC(yK,eme,15,a,0,1)};var Cab=mdb(Mwe,'XMLTypePackageImpl/38',1889);bcb(1890,1,nwe,Ube);_.wj=function Vbe(a){return ND(a)};_.xj=function Wbe(a){return KC(ZI,nie,2,a,6,1)};var Dab=mdb(Mwe,'XMLTypePackageImpl/39',1890);bcb(1855,1,nwe,Xbe);_.wj=function Ybe(a){return JD(a,668)};_.xj=function Zbe(a){return KC(T9,Uhe,2022,a,0,1)};var Pab=mdb(Mwe,'XMLTypePackageImpl/4',1855);bcb(1891,1,nwe,$be);_.wj=function _be(a){return ND(a)};_.xj=function ace(a){return KC(ZI,nie,2,a,6,1)};var Fab=mdb(Mwe,'XMLTypePackageImpl/40',1891);bcb(1892,1,nwe,bce);_.wj=function cce(a){return ND(a)};_.xj=function dce(a){return KC(ZI,nie,2,a,6,1)};var Gab=mdb(Mwe,'XMLTypePackageImpl/41',1892);bcb(1893,1,nwe,ece);_.wj=function fce(a){return ND(a)};_.xj=function gce(a){return KC(ZI,nie,2,a,6,1)};var Hab=mdb(Mwe,'XMLTypePackageImpl/42',1893);bcb(1894,1,nwe,hce);_.wj=function ice(a){return ND(a)};_.xj=function jce(a){return KC(ZI,nie,2,a,6,1)};var Iab=mdb(Mwe,'XMLTypePackageImpl/43',1894);bcb(1895,1,nwe,kce);_.wj=function lce(a){return ND(a)};_.xj=function mce(a){return KC(ZI,nie,2,a,6,1)};var Jab=mdb(Mwe,'XMLTypePackageImpl/44',1895);bcb(1896,1,nwe,nce);_.wj=function oce(a){return JD(a,184)};_.xj=function pce(a){return KC(UI,nie,184,a,0,1)};var Kab=mdb(Mwe,'XMLTypePackageImpl/45',1896);bcb(1897,1,nwe,qce);_.wj=function rce(a){return ND(a)};_.xj=function sce(a){return KC(ZI,nie,2,a,6,1)};var Lab=mdb(Mwe,'XMLTypePackageImpl/46',1897);bcb(1898,1,nwe,tce);_.wj=function uce(a){return ND(a)};_.xj=function vce(a){return KC(ZI,nie,2,a,6,1)};var Mab=mdb(Mwe,'XMLTypePackageImpl/47',1898);bcb(1899,1,nwe,wce);_.wj=function xce(a){return ND(a)};_.xj=function yce(a){return KC(ZI,nie,2,a,6,1)};var Nab=mdb(Mwe,'XMLTypePackageImpl/48',1899);bcb(nje,1,nwe,zce);_.wj=function Ace(a){return JD(a,184)};_.xj=function Bce(a){return KC(UI,nie,184,a,0,1)};var Oab=mdb(Mwe,'XMLTypePackageImpl/49',nje);bcb(1856,1,nwe,Cce);_.wj=function Dce(a){return JD(a,669)};_.xj=function Ece(a){return KC(U9,Uhe,2023,a,0,1)};var Tab=mdb(Mwe,'XMLTypePackageImpl/5',1856);bcb(1901,1,nwe,Fce);_.wj=function Gce(a){return JD(a,162)};_.xj=function Hce(a){return KC(MI,nie,162,a,0,1)};var Qab=mdb(Mwe,'XMLTypePackageImpl/50',1901);bcb(1902,1,nwe,Ice);_.wj=function Jce(a){return ND(a)};_.xj=function Kce(a){return KC(ZI,nie,2,a,6,1)};var Rab=mdb(Mwe,'XMLTypePackageImpl/51',1902);bcb(1903,1,nwe,Lce);_.wj=function Mce(a){return JD(a,19)};_.xj=function Nce(a){return KC(JI,nie,19,a,0,1)};var Sab=mdb(Mwe,'XMLTypePackageImpl/52',1903);bcb(1857,1,nwe,Oce);_.wj=function Pce(a){return ND(a)};_.xj=function Qce(a){return KC(ZI,nie,2,a,6,1)};var Uab=mdb(Mwe,'XMLTypePackageImpl/6',1857);bcb(1858,1,nwe,Rce);_.wj=function Sce(a){return JD(a,190)};_.xj=function Tce(a){return KC(SD,nie,190,a,0,2)};var Vab=mdb(Mwe,'XMLTypePackageImpl/7',1858);bcb(1859,1,nwe,Uce);_.wj=function Vce(a){return KD(a)};_.xj=function Wce(a){return KC(wI,nie,476,a,8,1)};var Wab=mdb(Mwe,'XMLTypePackageImpl/8',1859);bcb(1860,1,nwe,Xce);_.wj=function Yce(a){return JD(a,217)};_.xj=function Zce(a){return KC(xI,nie,217,a,0,1)};var Xab=mdb(Mwe,'XMLTypePackageImpl/9',1860);var $ce,_ce;var fde,gde;var kde;bcb(50,60,Tie,mde);var Zab=mdb(kxe,'RegEx/ParseException',50);bcb(820,1,{},ude);_.sl=function vde(a){return ac*16)throw vbb(new mde(tvd((h0d(),Uue))));c=c*16+e}while(true);if(this.a!=125)throw vbb(new mde(tvd((h0d(),Vue))));if(c>lxe)throw vbb(new mde(tvd((h0d(),Wue))));a=c}else{e=0;if(this.c!=0||(e=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));c=e;nde(this);if(this.c!=0||(e=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));c=c*16+e;a=c}break;case 117:d=0;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;a=b;break;case 118:nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;nde(this);if(this.c!=0||(d=yde(this.a))<0)throw vbb(new mde(tvd((h0d(),Tue))));b=b*16+d;if(b>lxe)throw vbb(new mde(tvd((h0d(),'parser.descappe.4'))));a=b;break;case 65:case 90:case 122:throw vbb(new mde(tvd((h0d(),Xue))));}return a};_.ul=function xde(a){var b,c;switch(a){case 100:c=(this.e&32)==32?Kfe('Nd',true):(wfe(),cfe);break;case 68:c=(this.e&32)==32?Kfe('Nd',false):(wfe(),jfe);break;case 119:c=(this.e&32)==32?Kfe('IsWord',true):(wfe(),sfe);break;case 87:c=(this.e&32)==32?Kfe('IsWord',false):(wfe(),lfe);break;case 115:c=(this.e&32)==32?Kfe('IsSpace',true):(wfe(),nfe);break;case 83:c=(this.e&32)==32?Kfe('IsSpace',false):(wfe(),kfe);break;default:throw vbb(new hz((b=a,mxe+b.toString(16))));}return c};_.vl=function zde(a){var b,c,d,e,f,g,h,i,j,k,l,m;this.b=1;nde(this);b=null;if(this.c==0&&this.a==94){nde(this);if(a){k=(wfe(),wfe(),++vfe,new $fe(5))}else{b=(wfe(),wfe(),++vfe,new $fe(4));Ufe(b,0,lxe);k=(null,++vfe,new $fe(4))}}else{k=(wfe(),wfe(),++vfe,new $fe(4))}e=true;while((m=this.c)!=1){if(m==0&&this.a==93&&!e)break;e=false;c=this.a;d=false;if(m==10){switch(c){case 100:case 68:case 119:case 87:case 115:case 83:Xfe(k,this.ul(c));d=true;break;case 105:case 73:case 99:case 67:c=this.Ll(k,c);c<0&&(d=true);break;case 112:case 80:l=tde(this,c);if(!l)throw vbb(new mde(tvd((h0d(),Iue))));Xfe(k,l);d=true;break;default:c=this.tl();}}else if(m==20){g=gfb(this.i,58,this.d);if(g<0)throw vbb(new mde(tvd((h0d(),Jue))));h=true;if(bfb(this.i,this.d)==94){++this.d;h=false}f=qfb(this.i,this.d,g);i=Lfe(f,h,(this.e&512)==512);if(!i)throw vbb(new mde(tvd((h0d(),Lue))));Xfe(k,i);d=true;if(g+1>=this.j||bfb(this.i,g+1)!=93)throw vbb(new mde(tvd((h0d(),Jue))));this.d=g+2}nde(this);if(!d){if(this.c!=0||this.a!=45){Ufe(k,c,c)}else{nde(this);if((m=this.c)==1)throw vbb(new mde(tvd((h0d(),Kue))));if(m==0&&this.a==93){Ufe(k,c,c);Ufe(k,45,45)}else{j=this.a;m==10&&(j=this.tl());nde(this);Ufe(k,c,j)}}}(this.e&zte)==zte&&this.c==0&&this.a==44&&nde(this)}if(this.c==1)throw vbb(new mde(tvd((h0d(),Kue))));if(b){Zfe(b,k);k=b}Yfe(k);Vfe(k);this.b=0;nde(this);return k};_.wl=function Ade(){var a,b,c,d;c=this.vl(false);while((d=this.c)!=7){a=this.a;if(d==0&&(a==45||a==38)||d==4){nde(this);if(this.c!=9)throw vbb(new mde(tvd((h0d(),Que))));b=this.vl(false);if(d==4)Xfe(c,b);else if(a==45)Zfe(c,b);else if(a==38)Wfe(c,b);else throw vbb(new hz('ASSERT'))}else{throw vbb(new mde(tvd((h0d(),Rue))))}}nde(this);return c};_.xl=function Bde(){var a,b;a=this.a-48;b=(wfe(),wfe(),++vfe,new Hge(12,null,a));!this.g&&(this.g=new Wvb);Tvb(this.g,new cge(a));nde(this);return b};_.yl=function Cde(){nde(this);return wfe(),ofe};_.zl=function Dde(){nde(this);return wfe(),mfe};_.Al=function Ede(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Bl=function Fde(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Cl=function Gde(){nde(this);return Ife()};_.Dl=function Hde(){nde(this);return wfe(),qfe};_.El=function Ide(){nde(this);return wfe(),tfe};_.Fl=function Jde(){var a;if(this.d>=this.j||((a=bfb(this.i,this.d++))&65504)!=64)throw vbb(new mde(tvd((h0d(),Eue))));nde(this);return wfe(),wfe(),++vfe,new ige(0,a-64)};_.Gl=function Kde(){nde(this);return Jfe()};_.Hl=function Lde(){nde(this);return wfe(),ufe};_.Il=function Mde(){var a;a=(wfe(),wfe(),++vfe,new ige(0,105));nde(this);return a};_.Jl=function Nde(){nde(this);return wfe(),rfe};_.Kl=function Ode(){nde(this);return wfe(),pfe};_.Ll=function Pde(a,b){return this.tl()};_.Ml=function Qde(){nde(this);return wfe(),hfe};_.Nl=function Rde(){var a,b,c,d,e;if(this.d+1>=this.j)throw vbb(new mde(tvd((h0d(),Bue))));d=-1;b=null;a=bfb(this.i,this.d);if(49<=a&&a<=57){d=a-48;!this.g&&(this.g=new Wvb);Tvb(this.g,new cge(d));++this.d;if(bfb(this.i,this.d)!=41)throw vbb(new mde(tvd((h0d(),yue))));++this.d}else{a==63&&--this.d;nde(this);b=qde(this);switch(b.e){case 20:case 21:case 22:case 23:break;case 8:if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));break;default:throw vbb(new mde(tvd((h0d(),Cue))));}}nde(this);e=rde(this);c=null;if(e.e==2){if(e.em()!=2)throw vbb(new mde(tvd((h0d(),Due))));c=e.am(1);e=e.am(0)}if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return wfe(),wfe(),++vfe,new vge(d,b,e,c)};_.Ol=function Sde(){nde(this);return wfe(),ife};_.Pl=function Tde(){var a;nde(this);a=Cfe(24,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Ql=function Ude(){var a;nde(this);a=Cfe(20,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Rl=function Vde(){var a;nde(this);a=Cfe(22,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Sl=function Wde(){var a,b,c,d,e;a=0;c=0;b=-1;while(this.d=this.j)throw vbb(new mde(tvd((h0d(),zue))));if(b==45){++this.d;while(this.d=this.j)throw vbb(new mde(tvd((h0d(),zue))))}if(b==58){++this.d;nde(this);d=Dfe(rde(this),a,c);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this)}else if(b==41){++this.d;nde(this);d=Dfe(rde(this),a,c)}else throw vbb(new mde(tvd((h0d(),Aue))));return d};_.Tl=function Xde(){var a;nde(this);a=Cfe(21,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Ul=function Yde(){var a;nde(this);a=Cfe(23,rde(this));if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Vl=function Zde(){var a,b;nde(this);a=this.f++;b=Efe(rde(this),a);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return b};_.Wl=function $de(){var a;nde(this);a=Efe(rde(this),0);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Xl=function _de(a){nde(this);if(this.c==5){nde(this);return Bfe(a,(wfe(),wfe(),++vfe,new lge(9,a)))}else return Bfe(a,(wfe(),wfe(),++vfe,new lge(3,a)))};_.Yl=function aee(a){var b;nde(this);b=(wfe(),wfe(),++vfe,new Lge(2));if(this.c==5){nde(this);Kge(b,(null,ffe));Kge(b,a)}else{Kge(b,a);Kge(b,(null,ffe))}return b};_.Zl=function bee(a){nde(this);if(this.c==5){nde(this);return wfe(),wfe(),++vfe,new lge(9,a)}else return wfe(),wfe(),++vfe,new lge(3,a)};_.a=0;_.b=0;_.c=0;_.d=0;_.e=0;_.f=1;_.g=null;_.j=0;var bbb=mdb(kxe,'RegEx/RegexParser',820);bcb(1824,820,{},hee);_.sl=function iee(a){return false};_.tl=function jee(){return eee(this)};_.ul=function lee(a){return fee(a)};_.vl=function mee(a){return gee(this)};_.wl=function nee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.xl=function oee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.yl=function pee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.zl=function qee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Al=function ree(){nde(this);return fee(67)};_.Bl=function see(){nde(this);return fee(73)};_.Cl=function tee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Dl=function uee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.El=function vee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Fl=function wee(){nde(this);return fee(99)};_.Gl=function xee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Hl=function yee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Il=function zee(){nde(this);return fee(105)};_.Jl=function Aee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Kl=function Bee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ll=function Cee(a,b){return Xfe(a,fee(b)),-1};_.Ml=function Dee(){nde(this);return wfe(),wfe(),++vfe,new ige(0,94)};_.Nl=function Eee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ol=function Fee(){nde(this);return wfe(),wfe(),++vfe,new ige(0,36)};_.Pl=function Gee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ql=function Hee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Rl=function Iee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Sl=function Jee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Tl=function Kee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Ul=function Lee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Vl=function Mee(){var a;nde(this);a=Efe(rde(this),0);if(this.c!=7)throw vbb(new mde(tvd((h0d(),yue))));nde(this);return a};_.Wl=function Nee(){throw vbb(new mde(tvd((h0d(),Yue))))};_.Xl=function Oee(a){nde(this);return Bfe(a,(wfe(),wfe(),++vfe,new lge(3,a)))};_.Yl=function Pee(a){var b;nde(this);b=(wfe(),wfe(),++vfe,new Lge(2));Kge(b,a);Kge(b,(null,ffe));return b};_.Zl=function Qee(a){nde(this);return wfe(),wfe(),++vfe,new lge(3,a)};var cee=null,dee=null;var $ab=mdb(kxe,'RegEx/ParserForXMLSchema',1824);bcb(117,1,yxe,xfe);_.$l=function yfe(a){throw vbb(new hz('Not supported.'))};_._l=function Gfe(){return -1};_.am=function Hfe(a){return null};_.bm=function Mfe(){return null};_.cm=function Pfe(a){};_.dm=function Qfe(a){};_.em=function Rfe(){return 0};_.Ib=function Sfe(){return this.fm(0)};_.fm=function Tfe(a){return this.e==11?'.':''};_.e=0;var Yee,Zee,$ee,_ee,afe,bfe=null,cfe,dfe=null,efe,ffe,gfe=null,hfe,ife,jfe,kfe,lfe,mfe,nfe,ofe,pfe,qfe,rfe,sfe,tfe,ufe,vfe=0;var lbb=mdb(kxe,'RegEx/Token',117);bcb(136,117,{3:1,136:1,117:1},$fe);_.fm=function bge(a){var b,c,d;if(this.e==4){if(this==efe)c='.';else if(this==cfe)c='\\d';else if(this==sfe)c='\\w';else if(this==nfe)c='\\s';else{d=new Hfb;d.a+='[';for(b=0;b0&&(d.a+=',',d);if(this.b[b]===this.b[b+1]){Efb(d,age(this.b[b]))}else{Efb(d,age(this.b[b]));d.a+='-';Efb(d,age(this.b[b+1]))}}d.a+=']';c=d.a}}else{if(this==jfe)c='\\D';else if(this==lfe)c='\\W';else if(this==kfe)c='\\S';else{d=new Hfb;d.a+='[^';for(b=0;b0&&(d.a+=',',d);if(this.b[b]===this.b[b+1]){Efb(d,age(this.b[b]))}else{Efb(d,age(this.b[b]));d.a+='-';Efb(d,age(this.b[b+1]))}}d.a+=']';c=d.a}}return c};_.a=false;_.c=false;var _ab=mdb(kxe,'RegEx/RangeToken',136);bcb(584,1,{584:1},cge);_.a=0;var abb=mdb(kxe,'RegEx/RegexParser/ReferencePosition',584);bcb(583,1,{3:1,583:1},ege);_.Fb=function fge(a){var b;if(a==null)return false;if(!JD(a,583))return false;b=BD(a,583);return dfb(this.b,b.b)&&this.a==b.a};_.Hb=function gge(){return LCb(this.b+'/'+See(this.a))};_.Ib=function hge(){return this.c.fm(this.a)};_.a=0;var cbb=mdb(kxe,'RegEx/RegularExpression',583);bcb(223,117,yxe,ige);_._l=function jge(){return this.a};_.fm=function kge(a){var b,c,d;switch(this.e){case 0:switch(this.a){case 124:case 42:case 43:case 63:case 40:case 41:case 46:case 91:case 123:case 92:d='\\'+HD(this.a&aje);break;case 12:d='\\f';break;case 10:d='\\n';break;case 13:d='\\r';break;case 9:d='\\t';break;case 27:d='\\e';break;default:if(this.a>=Tje){c=(b=this.a>>>0,'0'+b.toString(16));d='\\v'+qfb(c,c.length-6,c.length)}else d=''+HD(this.a&aje);}break;case 8:this==hfe||this==ife?(d=''+HD(this.a&aje)):(d='\\'+HD(this.a&aje));break;default:d=null;}return d};_.a=0;var dbb=mdb(kxe,'RegEx/Token/CharToken',223);bcb(309,117,yxe,lge);_.am=function mge(a){return this.a};_.cm=function nge(a){this.b=a};_.dm=function oge(a){this.c=a};_.em=function pge(){return 1};_.fm=function qge(a){var b;if(this.e==3){if(this.c<0&&this.b<0){b=this.a.fm(a)+'*'}else if(this.c==this.b){b=this.a.fm(a)+'{'+this.c+'}'}else if(this.c>=0&&this.b>=0){b=this.a.fm(a)+'{'+this.c+','+this.b+'}'}else if(this.c>=0&&this.b<0){b=this.a.fm(a)+'{'+this.c+',}'}else throw vbb(new hz('Token#toString(): CLOSURE '+this.c+She+this.b))}else{if(this.c<0&&this.b<0){b=this.a.fm(a)+'*?'}else if(this.c==this.b){b=this.a.fm(a)+'{'+this.c+'}?'}else if(this.c>=0&&this.b>=0){b=this.a.fm(a)+'{'+this.c+','+this.b+'}?'}else if(this.c>=0&&this.b<0){b=this.a.fm(a)+'{'+this.c+',}?'}else throw vbb(new hz('Token#toString(): NONGREEDYCLOSURE '+this.c+She+this.b))}return b};_.b=0;_.c=0;var ebb=mdb(kxe,'RegEx/Token/ClosureToken',309);bcb(821,117,yxe,rge);_.am=function sge(a){return a==0?this.a:this.b};_.em=function tge(){return 2};_.fm=function uge(a){var b;this.b.e==3&&this.b.am(0)==this.a?(b=this.a.fm(a)+'+'):this.b.e==9&&this.b.am(0)==this.a?(b=this.a.fm(a)+'+?'):(b=this.a.fm(a)+(''+this.b.fm(a)));return b};var fbb=mdb(kxe,'RegEx/Token/ConcatToken',821);bcb(1822,117,yxe,vge);_.am=function wge(a){if(a==0)return this.d;if(a==1)return this.b;throw vbb(new hz('Internal Error: '+a))};_.em=function xge(){return !this.b?1:2};_.fm=function yge(a){var b;this.c>0?(b='(?('+this.c+')'):this.a.e==8?(b='(?('+this.a+')'):(b='(?'+this.a);!this.b?(b+=this.d+')'):(b+=this.d+'|'+this.b+')');return b};_.c=0;var gbb=mdb(kxe,'RegEx/Token/ConditionToken',1822);bcb(1823,117,yxe,zge);_.am=function Age(a){return this.b};_.em=function Bge(){return 1};_.fm=function Cge(a){return '(?'+(this.a==0?'':See(this.a))+(this.c==0?'':See(this.c))+':'+this.b.fm(a)+')'};_.a=0;_.c=0;var hbb=mdb(kxe,'RegEx/Token/ModifierToken',1823);bcb(822,117,yxe,Dge);_.am=function Ege(a){return this.a};_.em=function Fge(){return 1};_.fm=function Gge(a){var b;b=null;switch(this.e){case 6:this.b==0?(b='(?:'+this.a.fm(a)+')'):(b='('+this.a.fm(a)+')');break;case 20:b='(?='+this.a.fm(a)+')';break;case 21:b='(?!'+this.a.fm(a)+')';break;case 22:b='(?<='+this.a.fm(a)+')';break;case 23:b='(?'+this.a.fm(a)+')';}return b};_.b=0;var ibb=mdb(kxe,'RegEx/Token/ParenToken',822);bcb(521,117,{3:1,117:1,521:1},Hge);_.bm=function Ige(){return this.b};_.fm=function Jge(a){return this.e==12?'\\'+this.a:Wee(this.b)};_.a=0;var jbb=mdb(kxe,'RegEx/Token/StringToken',521);bcb(465,117,yxe,Lge);_.$l=function Mge(a){Kge(this,a)};_.am=function Nge(a){return BD(Uvb(this.a,a),117)};_.em=function Oge(){return !this.a?0:this.a.a.c.length};_.fm=function Pge(a){var b,c,d,e,f;if(this.e==1){if(this.a.a.c.length==2){b=BD(Uvb(this.a,0),117);c=BD(Uvb(this.a,1),117);c.e==3&&c.am(0)==b?(e=b.fm(a)+'+'):c.e==9&&c.am(0)==b?(e=b.fm(a)+'+?'):(e=b.fm(a)+(''+c.fm(a)))}else{f=new Hfb;for(d=0;d=this.c.b:this.a<=this.c.b};_.Sb=function whe(){return this.b>0};_.Tb=function yhe(){return this.b};_.Vb=function Ahe(){return this.b-1};_.Qb=function Bhe(){throw vbb(new cgb(Exe))};_.a=0;_.b=0;var pbb=mdb(Bxe,'ExclusiveRange/RangeIterator',254);var TD=pdb(Fve,'C');var WD=pdb(Ive,'I');var sbb=pdb(Khe,'Z');var XD=pdb(Jve,'J');var SD=pdb(Eve,'B');var UD=pdb(Gve,'D');var VD=pdb(Hve,'F');var rbb=pdb(Kve,'S');var h1=odb('org.eclipse.elk.core.labels','ILabelManager');var O4=odb(Tte,'DiagnosticChain');var u8=odb(pwe,'ResourceSet');var V4=mdb(Tte,'InvocationTargetException',null);var Ihe=(Az(),Dz);var gwtOnLoad=gwtOnLoad=Zbb;Xbb(hcb);$bb('permProps',[[[Fxe,Gxe],[Hxe,'gecko1_8']],[[Fxe,Gxe],[Hxe,'ie10']],[[Fxe,Gxe],[Hxe,'ie8']],[[Fxe,Gxe],[Hxe,'ie9']],[[Fxe,Gxe],[Hxe,'safari']]]); +// -------------- RUN GWT INITIALIZATION CODE -------------- +gwtOnLoad(null, 'elk', null); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],3:[function(require,module,exports){ +'use strict'; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/******************************************************************************* + * Copyright (c) 2021 Kiel University and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +var ELK = require('./elk-api.js').default; + +var ELKNode = function (_ELK) { + _inherits(ELKNode, _ELK); + + function ELKNode() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, ELKNode); + + var optionsClone = Object.assign({}, options); + + var workerThreadsExist = false; + try { + require.resolve('web-worker'); + workerThreadsExist = true; + } catch (e) {} + + // user requested a worker + if (options.workerUrl) { + if (workerThreadsExist) { + var Worker = require('web-worker'); + optionsClone.workerFactory = function (url) { + return new Worker(url); + }; + } else { + console.warn('Web worker requested but \'web-worker\' package not installed. \nConsider installing the package or pass your own \'workerFactory\' to ELK\'s constructor.\n... Falling back to non-web worker version.'); + } + } + + // unless no other workerFactory is registered, use the fake worker + if (!optionsClone.workerFactory) { + var _require = require('./elk-worker.min.js'), + _Worker = _require.Worker; + + optionsClone.workerFactory = function (url) { + return new _Worker(url); + }; + } + + return _possibleConstructorReturn(this, (ELKNode.__proto__ || Object.getPrototypeOf(ELKNode)).call(this, optionsClone)); + } + + return ELKNode; +}(ELK); + +Object.defineProperty(module.exports, "__esModule", { + value: true +}); +module.exports = ELKNode; +ELKNode.default = ELKNode; +},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(require,module,exports){ +/** + * Copyright 2020 Google LLC + * + * 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. + */ +module.exports = Worker; +},{}]},{},[3])(3) +}); + + +/***/ }), + +/***/ 64178: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ diagram: () => (/* binding */ diagram) +/* harmony export */ }); +/* harmony import */ var _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(99255); +/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5949); +/* harmony import */ var dagre_d3_es_src_dagre_js_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(96157); +/* harmony import */ var elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26746); +/* harmony import */ var elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27693); +/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7608); +/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(42605); +/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(86161); +/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88472); +/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(76576); +/* harmony import */ var dagre_d3_es__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(77567); +/* harmony import */ var dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(57635); +/* harmony import */ var dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(69746); +/* harmony import */ var dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_10__); +/* harmony import */ var dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(79580); +/* harmony import */ var dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_11__); + + + + + + + + + + + + + + + + + + + + + + + +const findCommonAncestor = (id1, id2, treeData) => { + const { parentById } = treeData; + const visited = /* @__PURE__ */ new Set(); + let currentId = id1; + while (currentId) { + visited.add(currentId); + if (currentId === id2) { + return currentId; + } + currentId = parentById[currentId]; + } + currentId = id2; + while (currentId) { + if (visited.has(currentId)) { + return currentId; + } + currentId = parentById[currentId]; + } + return "root"; +}; +const elk = new (elkjs_lib_elk_bundled_js__WEBPACK_IMPORTED_MODULE_1___default())(); +const portPos = {}; +const conf = {}; +let nodeDb = {}; +const addVertices = function(vert, svgId, root, doc, diagObj, parentLookupDb, graph) { + const svg = root.select(`[id="${svgId}"]`); + const nodes = svg.insert("g").attr("class", "nodes"); + const keys = Object.keys(vert); + keys.forEach(function(id) { + const vertex = vert[id]; + let classStr = "default"; + if (vertex.classes.length > 0) { + classStr = vertex.classes.join(" "); + } + const styles2 = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.a)(vertex.styles); + let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id; + let vertexNode; + const labelData = { width: 0, height: 0 }; + if ((0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.e)((0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.g)().flowchart.htmlLabels)) { + const node2 = { + label: vertexText.replace( + /fa[blrs]?:fa-[\w-]+/g, + (s) => `` + ) + }; + vertexNode = (0,dagre_d3_es_src_dagre_js_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_13__/* .addHtmlLabel */ .a)(svg, node2).node(); + const bbox = vertexNode.getBBox(); + labelData.width = bbox.width; + labelData.height = bbox.height; + labelData.labelNode = vertexNode; + vertexNode.parentNode.removeChild(vertexNode); + } else { + const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text"); + svgLabel.setAttribute("style", styles2.labelStyle.replace("color:", "fill:")); + const rows = vertexText.split(_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.c.lineBreakRegex); + for (const row of rows) { + const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan"); + tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"); + tspan.setAttribute("dy", "1em"); + tspan.setAttribute("x", "1"); + tspan.textContent = row; + svgLabel.appendChild(tspan); + } + vertexNode = svgLabel; + const bbox = vertexNode.getBBox(); + labelData.width = bbox.width; + labelData.height = bbox.height; + labelData.labelNode = vertexNode; + } + const ports = [ + { + id: vertex.id + "-west", + layoutOptions: { + "port.side": "WEST" + } + }, + { + id: vertex.id + "-east", + layoutOptions: { + "port.side": "EAST" + } + }, + { + id: vertex.id + "-south", + layoutOptions: { + "port.side": "SOUTH" + } + }, + { + id: vertex.id + "-north", + layoutOptions: { + "port.side": "NORTH" + } + } + ]; + let radious = 0; + let _shape = ""; + let layoutOptions = {}; + switch (vertex.type) { + case "round": + radious = 5; + _shape = "rect"; + break; + case "square": + _shape = "rect"; + break; + case "diamond": + _shape = "question"; + layoutOptions = { + portConstraints: "FIXED_SIDE" + }; + break; + case "hexagon": + _shape = "hexagon"; + break; + case "odd": + _shape = "rect_left_inv_arrow"; + break; + case "lean_right": + _shape = "lean_right"; + break; + case "lean_left": + _shape = "lean_left"; + break; + case "trapezoid": + _shape = "trapezoid"; + break; + case "inv_trapezoid": + _shape = "inv_trapezoid"; + break; + case "odd_right": + _shape = "rect_left_inv_arrow"; + break; + case "circle": + _shape = "circle"; + break; + case "ellipse": + _shape = "ellipse"; + break; + case "stadium": + _shape = "stadium"; + break; + case "subroutine": + _shape = "subroutine"; + break; + case "cylinder": + _shape = "cylinder"; + break; + case "group": + _shape = "rect"; + break; + case "doublecircle": + _shape = "doublecircle"; + break; + default: + _shape = "rect"; + } + const node = { + labelStyle: styles2.labelStyle, + shape: _shape, + labelText: vertexText, + rx: radious, + ry: radious, + class: classStr, + style: styles2.style, + id: vertex.id, + link: vertex.link, + linkTarget: vertex.linkTarget, + tooltip: diagObj.db.getTooltip(vertex.id) || "", + domId: diagObj.db.lookUpDomId(vertex.id), + haveCallback: vertex.haveCallback, + width: vertex.type === "group" ? 500 : void 0, + dir: vertex.dir, + type: vertex.type, + props: vertex.props, + padding: (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.g)().flowchart.padding + }; + let boundingBox; + let nodeEl; + if (node.type !== "group") { + nodeEl = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.b)(nodes, node, vertex.dir); + boundingBox = nodeEl.node().getBBox(); + } + const data = { + id: vertex.id, + ports: vertex.type === "diamond" ? ports : [], + // labelStyle: styles.labelStyle, + // shape: _shape, + layoutOptions, + labelText: vertexText, + labelData, + // labels: [{ text: vertexText }], + // rx: radius, + // ry: radius, + // class: classStr, + // style: styles.style, + // link: vertex.link, + // linkTarget: vertex.linkTarget, + // tooltip: diagObj.db.getTooltip(vertex.id) || '', + domId: diagObj.db.lookUpDomId(vertex.id), + // haveCallback: vertex.haveCallback, + width: boundingBox == null ? void 0 : boundingBox.width, + height: boundingBox == null ? void 0 : boundingBox.height, + // dir: vertex.dir, + type: vertex.type, + // props: vertex.props, + // padding: getConfig().flowchart.padding, + // boundingBox, + el: nodeEl, + parent: parentLookupDb.parentById[vertex.id] + }; + nodeDb[node.id] = data; + }); + return graph; +}; +const getNextPosition = (position, edgeDirection, graphDirection) => { + const portPos2 = { + TB: { + in: { + north: "north" + }, + out: { + south: "west", + west: "east", + east: "south" + } + }, + LR: { + in: { + west: "west" + }, + out: { + east: "south", + south: "north", + north: "east" + } + }, + RL: { + in: { + east: "east" + }, + out: { + west: "north", + north: "south", + south: "west" + } + }, + BT: { + in: { + south: "south" + }, + out: { + north: "east", + east: "west", + west: "north" + } + } + }; + portPos2.TD = portPos2.TB; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("abc88", graphDirection, edgeDirection, position); + return portPos2[graphDirection][edgeDirection][position]; +}; +const getNextPort = (node, edgeDirection, graphDirection) => { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("getNextPort abc88", { node, edgeDirection, graphDirection }); + if (!portPos[node]) { + switch (graphDirection) { + case "TB": + case "TD": + portPos[node] = { + inPosition: "north", + outPosition: "south" + }; + break; + case "BT": + portPos[node] = { + inPosition: "south", + outPosition: "north" + }; + break; + case "RL": + portPos[node] = { + inPosition: "east", + outPosition: "west" + }; + break; + case "LR": + portPos[node] = { + inPosition: "west", + outPosition: "east" + }; + break; + } + } + const result = edgeDirection === "in" ? portPos[node].inPosition : portPos[node].outPosition; + if (edgeDirection === "in") { + portPos[node].inPosition = getNextPosition( + portPos[node].inPosition, + edgeDirection, + graphDirection + ); + } else { + portPos[node].outPosition = getNextPosition( + portPos[node].outPosition, + edgeDirection, + graphDirection + ); + } + return result; +}; +const getEdgeStartEndPoint = (edge, dir) => { + let source = edge.start; + let target = edge.end; + const startNode = nodeDb[source]; + const endNode = nodeDb[target]; + if (!startNode || !endNode) { + return { source, target }; + } + if (startNode.type === "diamond") { + source = `${source}-${getNextPort(source, "out", dir)}`; + } + if (endNode.type === "diamond") { + target = `${target}-${getNextPort(target, "in", dir)}`; + } + return { source, target }; +}; +const addEdges = function(edges, diagObj, graph, svg) { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("abc78 edges = ", edges); + const labelsEl = svg.insert("g").attr("class", "edgeLabels"); + let linkIdCnt = {}; + let dir = diagObj.db.getDirection(); + let defaultStyle; + let defaultLabelStyle; + if (edges.defaultStyle !== void 0) { + const defaultStyles = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.a)(edges.defaultStyle); + defaultStyle = defaultStyles.style; + defaultLabelStyle = defaultStyles.labelStyle; + } + edges.forEach(function(edge) { + var linkIdBase = "L-" + edge.start + "-" + edge.end; + if (linkIdCnt[linkIdBase] === void 0) { + linkIdCnt[linkIdBase] = 0; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]); + } else { + linkIdCnt[linkIdBase]++; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]); + } + let linkId = linkIdBase + "-" + linkIdCnt[linkIdBase]; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("abc78 new link id to be used is", linkIdBase, linkId, linkIdCnt[linkIdBase]); + var linkNameStart = "LS-" + edge.start; + var linkNameEnd = "LE-" + edge.end; + const edgeData = { style: "", labelStyle: "" }; + edgeData.minlen = edge.length || 1; + if (edge.type === "arrow_open") { + edgeData.arrowhead = "none"; + } else { + edgeData.arrowhead = "normal"; + } + edgeData.arrowTypeStart = "arrow_open"; + edgeData.arrowTypeEnd = "arrow_open"; + switch (edge.type) { + case "double_arrow_cross": + edgeData.arrowTypeStart = "arrow_cross"; + case "arrow_cross": + edgeData.arrowTypeEnd = "arrow_cross"; + break; + case "double_arrow_point": + edgeData.arrowTypeStart = "arrow_point"; + case "arrow_point": + edgeData.arrowTypeEnd = "arrow_point"; + break; + case "double_arrow_circle": + edgeData.arrowTypeStart = "arrow_circle"; + case "arrow_circle": + edgeData.arrowTypeEnd = "arrow_circle"; + break; + } + let style = ""; + let labelStyle = ""; + switch (edge.stroke) { + case "normal": + style = "fill:none;"; + if (defaultStyle !== void 0) { + style = defaultStyle; + } + if (defaultLabelStyle !== void 0) { + labelStyle = defaultLabelStyle; + } + edgeData.thickness = "normal"; + edgeData.pattern = "solid"; + break; + case "dotted": + edgeData.thickness = "normal"; + edgeData.pattern = "dotted"; + edgeData.style = "fill:none;stroke-width:2px;stroke-dasharray:3;"; + break; + case "thick": + edgeData.thickness = "thick"; + edgeData.pattern = "solid"; + edgeData.style = "stroke-width: 3.5px;fill:none;"; + break; + } + if (edge.style !== void 0) { + const styles2 = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.a)(edge.style); + style = styles2.style; + labelStyle = styles2.labelStyle; + } + edgeData.style = edgeData.style += style; + edgeData.labelStyle = edgeData.labelStyle += labelStyle; + if (edge.interpolate !== void 0) { + edgeData.curve = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.d)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + } else if (edges.defaultInterpolate !== void 0) { + edgeData.curve = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.d)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + } else { + edgeData.curve = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.d)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + } + if (edge.text === void 0) { + if (edge.style !== void 0) { + edgeData.arrowheadStyle = "fill: #333"; + } + } else { + edgeData.arrowheadStyle = "fill: #333"; + edgeData.labelpos = "c"; + } + edgeData.labelType = "text"; + edgeData.label = edge.text.replace(_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.c.lineBreakRegex, "\n"); + if (edge.style === void 0) { + edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none;"; + } + edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:"); + edgeData.id = linkId; + edgeData.classes = "flowchart-link " + linkNameStart + " " + linkNameEnd; + const labelEl = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.f)(labelsEl, edgeData); + const { source, target } = getEdgeStartEndPoint(edge, dir); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.debug("abc78 source and target", source, target); + graph.edges.push({ + id: "e" + edge.start + edge.end, + sources: [source], + targets: [target], + labelEl, + labels: [ + { + width: edgeData.width, + height: edgeData.height, + orgWidth: edgeData.width, + orgHeight: edgeData.height, + text: edgeData.label, + layoutOptions: { + "edgeLabels.inline": "true", + "edgeLabels.placement": "CENTER" + } + } + ], + edgeData + }); + }); + return graph; +}; +const addMarkersToEdge = function(svgPath, edgeData, diagramType, arrowMarkerAbsolute) { + let url = ""; + if (arrowMarkerAbsolute) { + url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search; + url = url.replace(/\(/g, "\\("); + url = url.replace(/\)/g, "\\)"); + } + switch (edgeData.arrowTypeStart) { + case "arrow_cross": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-crossStart)"); + break; + case "arrow_point": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-pointStart)"); + break; + case "arrow_barb": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-barbStart)"); + break; + case "arrow_circle": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-circleStart)"); + break; + case "aggregation": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-aggregationStart)"); + break; + case "extension": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-extensionStart)"); + break; + case "composition": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-compositionStart)"); + break; + case "dependency": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-dependencyStart)"); + break; + case "lollipop": + svgPath.attr("marker-start", "url(" + url + "#" + diagramType + "-lollipopStart)"); + break; + } + switch (edgeData.arrowTypeEnd) { + case "arrow_cross": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-crossEnd)"); + break; + case "arrow_point": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-pointEnd)"); + break; + case "arrow_barb": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-barbEnd)"); + break; + case "arrow_circle": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-circleEnd)"); + break; + case "aggregation": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-aggregationEnd)"); + break; + case "extension": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-extensionEnd)"); + break; + case "composition": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-compositionEnd)"); + break; + case "dependency": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-dependencyEnd)"); + break; + case "lollipop": + svgPath.attr("marker-end", "url(" + url + "#" + diagramType + "-lollipopEnd)"); + break; + } +}; +const getClasses = function(text, diagObj) { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("Extracting classes"); + diagObj.db.clear("ver-2"); + try { + diagObj.parse(text); + return diagObj.db.getClasses(); + } catch (e) { + return {}; + } +}; +const addSubGraphs = function(db2) { + const parentLookupDb = { parentById: {}, childrenById: {} }; + const subgraphs = db2.getSubGraphs(); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("Subgraphs - ", subgraphs); + subgraphs.forEach(function(subgraph) { + subgraph.nodes.forEach(function(node) { + parentLookupDb.parentById[node] = subgraph.id; + if (parentLookupDb.childrenById[subgraph.id] === void 0) { + parentLookupDb.childrenById[subgraph.id] = []; + } + parentLookupDb.childrenById[subgraph.id].push(node); + }); + }); + subgraphs.forEach(function(subgraph) { + ({ id: subgraph.id }); + if (parentLookupDb.parentById[subgraph.id] !== void 0) { + parentLookupDb.parentById[subgraph.id]; + } + }); + return parentLookupDb; +}; +const calcOffset = function(src, dest, parentLookupDb) { + const ancestor = findCommonAncestor(src, dest, parentLookupDb); + if (ancestor === void 0 || ancestor === "root") { + return { x: 0, y: 0 }; + } + const ancestorOffset = nodeDb[ancestor].offset; + return { x: ancestorOffset.posX, y: ancestorOffset.posY }; +}; +const insertEdge = function(edgesEl, edge, edgeData, diagObj, parentLookupDb) { + const offset = calcOffset(edge.sources[0], edge.targets[0], parentLookupDb); + const src = edge.sections[0].startPoint; + const dest = edge.sections[0].endPoint; + const segments = edge.sections[0].bendPoints ? edge.sections[0].bendPoints : []; + const segPoints = segments.map((segment) => [segment.x + offset.x, segment.y + offset.y]); + const points = [ + [src.x + offset.x, src.y + offset.y], + ...segPoints, + [dest.x + offset.x, dest.y + offset.y] + ]; + const curve = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .line */ .jvg)().curve(d3__WEBPACK_IMPORTED_MODULE_0__/* .curveLinear */ .c_6); + const edgePath = edgesEl.insert("path").attr("d", curve(points)).attr("class", "path").attr("fill", "none"); + const edgeG = edgesEl.insert("g").attr("class", "edgeLabel"); + const edgeWithLabel = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(edgeG.node().appendChild(edge.labelEl)); + const box = edgeWithLabel.node().firstChild.getBoundingClientRect(); + edgeWithLabel.attr("width", box.width); + edgeWithLabel.attr("height", box.height); + edgeG.attr( + "transform", + `translate(${edge.labels[0].x + offset.x}, ${edge.labels[0].y + offset.y})` + ); + addMarkersToEdge(edgePath, edgeData, diagObj.type, diagObj.arrowMarkerAbsolute); +}; +const insertChildren = (nodeArray, parentLookupDb) => { + nodeArray.forEach((node) => { + if (!node.children) { + node.children = []; + } + const childIds = parentLookupDb.childrenById[node.id]; + if (childIds) { + childIds.forEach((childId) => { + node.children.push(nodeDb[childId]); + }); + } + insertChildren(node.children, parentLookupDb); + }); +}; +const draw = async function(text, id, _version, diagObj) { + var _a; + diagObj.db.clear(); + nodeDb = {}; + diagObj.db.setGen("gen-2"); + diagObj.parser.parse(text); + const renderEl = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body").append("div").attr("style", "height:400px").attr("id", "cy"); + let graph = { + id: "root", + layoutOptions: { + "elk.hierarchyHandling": "INCLUDE_CHILDREN", + "org.eclipse.elk.padding": "[top=100, left=100, bottom=110, right=110]", + "elk.layered.spacing.edgeNodeBetweenLayers": "30", + // 'elk.layered.mergeEdges': 'true', + "elk.direction": "DOWN" + // 'elk.ports.sameLayerEdges': true, + // 'nodePlacement.strategy': 'SIMPLE', + }, + children: [], + edges: [] + }; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("Drawing flowchart using v3 renderer", elk); + let dir = diagObj.db.getDirection(); + switch (dir) { + case "BT": + graph.layoutOptions["elk.direction"] = "UP"; + break; + case "TB": + graph.layoutOptions["elk.direction"] = "DOWN"; + break; + case "LR": + graph.layoutOptions["elk.direction"] = "RIGHT"; + break; + case "RL": + graph.layoutOptions["elk.direction"] = "LEFT"; + break; + } + const { securityLevel, flowchart: conf2 } = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.g)(); + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id); + } + const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body"); + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + const svg = root.select(`[id="${id}"]`); + const markers = ["point", "circle", "cross"]; + (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.i)(svg, markers, diagObj.type, diagObj.arrowMarkerAbsolute); + const vert = diagObj.db.getVertices(); + let subG; + const subGraphs = diagObj.db.getSubGraphs(); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("Subgraphs - ", subGraphs); + for (let i = subGraphs.length - 1; i >= 0; i--) { + subG = subGraphs[i]; + diagObj.db.addVertex(subG.id, subG.title, "group", void 0, subG.classes, subG.dir); + } + const subGraphsEl = svg.insert("g").attr("class", "subgraphs"); + const parentLookupDb = addSubGraphs(diagObj.db); + graph = addVertices(vert, id, root, doc, diagObj, parentLookupDb, graph); + const edgesEl = svg.insert("g").attr("class", "edges edgePath"); + const edges = diagObj.db.getEdges(); + graph = addEdges(edges, diagObj, graph, svg); + const nodes = Object.keys(nodeDb); + nodes.forEach((nodeId) => { + const node = nodeDb[nodeId]; + if (!node.parent) { + graph.children.push(node); + } + if (parentLookupDb.childrenById[nodeId] !== void 0) { + node.labels = [ + { + text: node.labelText, + layoutOptions: { + "nodeLabels.placement": "[H_CENTER, V_TOP, INSIDE]" + }, + width: node.labelData.width, + height: node.labelData.height + } + ]; + delete node.x; + delete node.y; + delete node.width; + delete node.height; + } + }); + insertChildren(graph.children, parentLookupDb); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("after layout", JSON.stringify(graph, null, 2)); + const g = await elk.layout(graph); + drawNodes(0, 0, g.children, svg, subGraphsEl, diagObj, 0); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("after layout", g); + (_a = g.edges) == null ? void 0 : _a.map((edge) => { + insertEdge(edgesEl, edge, edge.edgeData, diagObj, parentLookupDb); + }); + (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.s)({}, svg, conf2.diagramPadding, conf2.useMaxWidth); + renderEl.remove(); +}; +const drawNodes = (relX, relY, nodeArray, svg, subgraphsEl, diagObj, depth) => { + nodeArray.forEach(function(node) { + if (node) { + nodeDb[node.id].offset = { + posX: node.x + relX, + posY: node.y + relY, + x: relX, + y: relY, + depth, + width: node.width, + height: node.height + }; + if (node.type === "group") { + const subgraphEl = subgraphsEl.insert("g").attr("class", "subgraph"); + subgraphEl.insert("rect").attr("class", "subgraph subgraph-lvl-" + depth % 5 + " node").attr("x", node.x + relX).attr("y", node.y + relY).attr("width", node.width).attr("height", node.height); + const label = subgraphEl.insert("g").attr("class", "label"); + label.attr( + "transform", + `translate(${node.labels[0].x + relX + node.x}, ${node.labels[0].y + relY + node.y})` + ); + label.node().appendChild(node.labelData.labelNode); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("Id (UGH)= ", node.type, node.labels); + } else { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.l.info("Id (UGH)= ", node.id); + node.el.attr( + "transform", + `translate(${node.x + relX + node.width / 2}, ${node.y + relY + node.height / 2})` + ); + } + } + }); + nodeArray.forEach(function(node) { + if (node && node.type === "group") { + drawNodes(relX + node.x, relY + node.y, node.children, svg, subgraphsEl, diagObj, depth + 1); + } + }); +}; +const renderer = { + getClasses, + draw +}; +const genSections = (options) => { + let sections = ""; + for (let i = 0; i < 5; i++) { + sections += ` + .subgraph-lvl-${i} { + fill: ${options[`surface${i}`]}; + stroke: ${options[`surfacePeer${i}`]}; + } + `; + } + return sections; +}; +const getStyles = (options) => `.label { + font-family: ${options.fontFamily}; + color: ${options.nodeTextColor || options.textColor}; + } + .cluster-label text { + fill: ${options.titleColor}; + } + .cluster-label span { + color: ${options.titleColor}; + } + + .label text,span { + fill: ${options.nodeTextColor || options.textColor}; + color: ${options.nodeTextColor || options.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options.mainBkg}; + stroke: ${options.nodeBorder}; + stroke-width: 1px; + } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${options.arrowheadColor}; + } + + .edgePath .path { + stroke: ${options.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${options.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${options.edgeLabelBackground}; + rect { + opacity: 0.5; + background-color: ${options.edgeLabelBackground}; + fill: ${options.edgeLabelBackground}; + } + text-align: center; + } + + .cluster rect { + fill: ${options.clusterBkg}; + stroke: ${options.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${options.titleColor}; + } + + .cluster span { + color: ${options.titleColor}; + } + /* .cluster div { + color: ${options.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${options.fontFamily}; + font-size: 12px; + background: ${options.tertiaryColor}; + border: 1px solid ${options.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options.textColor}; + } + .subgraph { + stroke-width:2; + rx:3; + } + // .subgraph-lvl-1 { + // fill:#ccc; + // // stroke:black; + // } + ${genSections(options)} +`; +const styles = getStyles; +const diagram = { + db: _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.h, + renderer, + parser: _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_12__.p, + styles +}; + +//# sourceMappingURL=flowchart-elk-definition-170a3958.js.map + + +/***/ }) + +}; +; \ No newline at end of file diff --git a/assets/js/17896441.229a9328.js b/assets/js/17896441.229a9328.js new file mode 100644 index 00000000000..b3a108240ad --- /dev/null +++ b/assets/js/17896441.229a9328.js @@ -0,0 +1,2 @@ +/*! For license information please see 17896441.229a9328.js.LICENSE.txt */ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7918],{7608:(t,e)=>{"use strict";e.N=void 0;var n=/^([^\w]*)(javascript|data|vbscript)/im,r=/&#(\w+)(^\w|;)?/g,i=/&(newline|tab);/gi,a=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,s=/^.+(:|:)/gim,o=[".","/"];e.N=function(t){var e,c=(e=t||"",e.replace(r,(function(t,e){return String.fromCharCode(e)}))).replace(i,"").replace(a,"").trim();if(!c)return"about:blank";if(function(t){return o.indexOf(t[0])>-1}(c))return c;var l=c.match(s);if(!l)return c;var h=l[0];return n.test(h)?"about:blank":c}},35318:(t,e,n)=>{"use strict";n.d(e,{Zo:()=>h,kt:()=>f});var r=n(27378);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function s(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var c=r.createContext({}),l=function(t){var e=r.useContext(c),n=e;return t&&(n="function"==typeof t?t(e):s(s({},e),t)),n},h=function(t){var e=l(t.components);return r.createElement(c.Provider,{value:e},t.children)},u="mdxType",d={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},p=r.forwardRef((function(t,e){var n=t.components,i=t.mdxType,a=t.originalType,c=t.parentName,h=o(t,["components","mdxType","originalType","parentName"]),u=l(n),p=i,f=u["".concat(c,".").concat(p)]||u[p]||d[p]||a;return n?r.createElement(f,s(s({ref:e},h),{},{components:n})):r.createElement(f,s({ref:e},h))}));function f(t,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var a=n.length,s=new Array(a);s[0]=p;var o={};for(var c in e)hasOwnProperty.call(e,c)&&(o[c]=e[c]);o.originalType=t,o[u]="string"==typeof t?t:i,s[1]=o;for(var l=2;l{"use strict";n.r(e),n.d(e,{default:()=>Fe});var r=n(27378),i=n(1123),a=n(41763);const s=r.createContext(null);function o(t){let{children:e,content:n}=t;const i=function(t){return(0,r.useMemo)((()=>({metadata:t.metadata,frontMatter:t.frontMatter,assets:t.assets,contentTitle:t.contentTitle,toc:t.toc})),[t])}(n);return r.createElement(s.Provider,{value:i},e)}function c(){const t=(0,r.useContext)(s);if(null===t)throw new a.i6("DocProvider");return t}function l(){const{metadata:t,frontMatter:e,assets:n}=c();return r.createElement(i.d,{title:t.title,description:t.description,keywords:e.keywords,image:n.image??e.image})}var h=n(38944),u=n(58357),d=n(25773),p=n(99213),f=n(81884);function g(t){const{permalink:e,title:n,subLabel:i,isNext:a}=t;return r.createElement(f.Z,{className:(0,h.Z)("pagination-nav__link",a?"pagination-nav__link--next":"pagination-nav__link--prev"),to:e},i&&r.createElement("div",{className:"pagination-nav__sublabel"},i),r.createElement("div",{className:"pagination-nav__label"},n))}function y(t){const{previous:e,next:n}=t;return r.createElement("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,p.I)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages",description:"The ARIA label for the docs pagination"})},e&&r.createElement(g,(0,d.Z)({},e,{subLabel:r.createElement(p.Z,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc"},"Previous")})),n&&r.createElement(g,(0,d.Z)({},n,{subLabel:r.createElement(p.Z,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc"},"Next"),isNext:!0})))}function m(){const{metadata:t}=c();return r.createElement(y,{previous:t.previous,next:t.next})}var b=n(50353),_=n(62935),x=n(75484),v=n(24453),k=n(25611);const w={unreleased:function(t){let{siteTitle:e,versionMetadata:n}=t;return r.createElement(p.Z,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:e,versionLabel:r.createElement("b",null,n.label)}},"This is unreleased documentation for {siteTitle} {versionLabel} version.")},unmaintained:function(t){let{siteTitle:e,versionMetadata:n}=t;return r.createElement(p.Z,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:e,versionLabel:r.createElement("b",null,n.label)}},"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.")}};function C(t){const e=w[t.versionMetadata.banner];return r.createElement(e,t)}function E(t){let{versionLabel:e,to:n,onClick:i}=t;return r.createElement(p.Z,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:e,latestVersionLink:r.createElement("b",null,r.createElement(f.Z,{to:n,onClick:i},r.createElement(p.Z,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label"},"latest version")))}},"For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).")}function T(t){let{className:e,versionMetadata:n}=t;const{siteConfig:{title:i}}=(0,b.Z)(),{pluginId:a}=(0,_.gA)({failfast:!0}),{savePreferredVersionName:s}=(0,v.J)(a),{latestDocSuggestion:o,latestVersionSuggestion:c}=(0,_.Jo)(a),l=o??(u=c).docs.find((t=>t.id===u.mainDocId));var u;return r.createElement("div",{className:(0,h.Z)(e,x.k.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert"},r.createElement("div",null,r.createElement(C,{siteTitle:i,versionMetadata:n})),r.createElement("div",{className:"margin-top--md"},r.createElement(E,{versionLabel:c.label,to:l.path,onClick:()=>s(c.name)})))}function S(t){let{className:e}=t;const n=(0,k.E)();return n.banner?r.createElement(T,{className:e,versionMetadata:n}):null}function A(t){let{className:e}=t;const n=(0,k.E)();return n.badge?r.createElement("span",{className:(0,h.Z)(e,x.k.docs.docVersionBadge,"badge badge--secondary")},r.createElement(p.Z,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label}},"Version: {versionLabel}")):null}function L(t){let{lastUpdatedAt:e,formattedLastUpdatedAt:n}=t;return r.createElement(p.Z,{id:"theme.lastUpdated.atDate",description:"The words used to describe on which date a page has been last updated",values:{date:r.createElement("b",null,r.createElement("time",{dateTime:new Date(1e3*e).toISOString()},n))}}," on {date}")}function B(t){let{lastUpdatedBy:e}=t;return r.createElement(p.Z,{id:"theme.lastUpdated.byUser",description:"The words used to describe by who the page has been last updated",values:{user:r.createElement("b",null,e)}}," by {user}")}function N(t){let{lastUpdatedAt:e,formattedLastUpdatedAt:n,lastUpdatedBy:i}=t;return r.createElement("span",{className:x.k.common.lastUpdated},r.createElement(p.Z,{id:"theme.lastUpdated.lastUpdatedAtBy",description:"The sentence used to display when a page has been last updated, and by who",values:{atDate:e&&n?r.createElement(L,{lastUpdatedAt:e,formattedLastUpdatedAt:n}):"",byUser:i?r.createElement(B,{lastUpdatedBy:i}):""}},"Last updated{atDate}{byUser}"),!1)}const D={iconEdit:"iconEdit_bHB7"};function O(t){let{className:e,...n}=t;return r.createElement("svg",(0,d.Z)({fill:"currentColor",height:"20",width:"20",viewBox:"0 0 40 40",className:(0,h.Z)(D.iconEdit,e),"aria-hidden":"true"},n),r.createElement("g",null,r.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"})))}function M(t){let{editUrl:e}=t;return r.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener",className:x.k.common.editThisPage},r.createElement(O,null),r.createElement(p.Z,{id:"theme.common.editThisPage",description:"The link label to edit the current page"},"Edit this page"))}const I={tag:"tag_otG2",tagRegular:"tagRegular_s0E1",tagWithCount:"tagWithCount_PGyn"};function F(t){let{permalink:e,label:n,count:i}=t;return r.createElement(f.Z,{href:e,className:(0,h.Z)(I.tag,i?I.tagWithCount:I.tagRegular)},n,i&&r.createElement("span",null,i))}const $={tags:"tags_Ow0B",tag:"tag_DFxh"};function R(t){let{tags:e}=t;return r.createElement(r.Fragment,null,r.createElement("b",null,r.createElement(p.Z,{id:"theme.tags.tagsListLabel",description:"The label alongside a tag list"},"Tags:")),r.createElement("ul",{className:(0,h.Z)($.tags,"padding--none","margin-left--sm")},e.map((t=>{let{label:e,permalink:n}=t;return r.createElement("li",{key:n,className:$.tag},r.createElement(F,{label:e,permalink:n}))}))))}const Z={lastUpdated:"lastUpdated_pbO5"};function P(t){return r.createElement("div",{className:(0,h.Z)(x.k.docs.docFooterTagsRow,"row margin-bottom--sm")},r.createElement("div",{className:"col"},r.createElement(R,t)))}function j(t){let{editUrl:e,lastUpdatedAt:n,lastUpdatedBy:i,formattedLastUpdatedAt:a}=t;return r.createElement("div",{className:(0,h.Z)(x.k.docs.docFooterEditMetaRow,"row")},r.createElement("div",{className:"col"},e&&r.createElement(M,{editUrl:e})),r.createElement("div",{className:(0,h.Z)("col",Z.lastUpdated)},(n||i)&&r.createElement(N,{lastUpdatedAt:n,formattedLastUpdatedAt:a,lastUpdatedBy:i})))}function Y(){const{metadata:t}=c(),{editUrl:e,lastUpdatedAt:n,formattedLastUpdatedAt:i,lastUpdatedBy:a,tags:s}=t,o=s.length>0,l=!!(e||n||a);return o||l?r.createElement("footer",{className:(0,h.Z)(x.k.docs.docFooter,"docusaurus-mt-lg")},o&&r.createElement(P,{tags:s}),l&&r.createElement(j,{editUrl:e,lastUpdatedAt:n,lastUpdatedBy:a,formattedLastUpdatedAt:i})):null}var z=n(80376),U=n(20624);function W(t){const e=t.map((t=>({...t,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);e.forEach(((t,e)=>{const r=n.slice(2,t.level);t.parentIndex=Math.max(...r),n[t.level]=e}));const r=[];return e.forEach((t=>{const{parentIndex:n,...i}=t;n>=0?e[n].children.push(i):r.push(i)})),r}function H(t){let{toc:e,minHeadingLevel:n,maxHeadingLevel:r}=t;return e.flatMap((t=>{const e=H({toc:t.children,minHeadingLevel:n,maxHeadingLevel:r});return function(t){return t.level>=n&&t.level<=r}(t)?[{...t,children:e}]:e}))}function q(t){const e=t.getBoundingClientRect();return e.top===e.bottom?q(t.parentNode):e}function V(t,e){let{anchorTopOffset:n}=e;const r=t.find((t=>q(t).top>=n));if(r){return function(t){return t.top>0&&t.bottom{t.current=e?0:document.querySelector(".navbar").clientHeight}),[e]),t}function X(t){const e=(0,r.useRef)(void 0),n=G();(0,r.useEffect)((()=>{if(!t)return()=>{};const{linkClassName:r,linkActiveClassName:i,minHeadingLevel:a,maxHeadingLevel:s}=t;function o(){const t=function(t){return Array.from(document.getElementsByClassName(t))}(r),o=function(t){let{minHeadingLevel:e,maxHeadingLevel:n}=t;const r=[];for(let i=e;i<=n;i+=1)r.push(`h${i}.anchor`);return Array.from(document.querySelectorAll(r.join()))}({minHeadingLevel:a,maxHeadingLevel:s}),c=V(o,{anchorTopOffset:n.current}),l=t.find((t=>c&&c.id===function(t){return decodeURIComponent(t.href.substring(t.href.indexOf("#")+1))}(t)));t.forEach((t=>{!function(t,n){n?(e.current&&e.current!==t&&e.current.classList.remove(i),t.classList.add(i),e.current=t):t.classList.remove(i)}(t,t===l)}))}return document.addEventListener("scroll",o),document.addEventListener("resize",o),o(),()=>{document.removeEventListener("scroll",o),document.removeEventListener("resize",o)}}),[t,n])}function Q(t){let{toc:e,className:n,linkClassName:i,isChild:a}=t;return e.length?r.createElement("ul",{className:a?void 0:n},e.map((t=>r.createElement("li",{key:t.id},r.createElement("a",{href:`#${t.id}`,className:i??void 0,dangerouslySetInnerHTML:{__html:t.value}}),r.createElement(Q,{isChild:!0,toc:t.children,className:n,linkClassName:i}))))):null}const K=r.memo(Q);function J(t){let{toc:e,className:n="table-of-contents table-of-contents__left-border",linkClassName:i="table-of-contents__link",linkActiveClassName:a,minHeadingLevel:s,maxHeadingLevel:o,...c}=t;const l=(0,U.L)(),h=s??l.tableOfContents.minHeadingLevel,u=o??l.tableOfContents.maxHeadingLevel,p=function(t){let{toc:e,minHeadingLevel:n,maxHeadingLevel:i}=t;return(0,r.useMemo)((()=>H({toc:W(e),minHeadingLevel:n,maxHeadingLevel:i})),[e,n,i])}({toc:e,minHeadingLevel:h,maxHeadingLevel:u});return X((0,r.useMemo)((()=>{if(i&&a)return{linkClassName:i,linkActiveClassName:a,minHeadingLevel:h,maxHeadingLevel:u}}),[i,a,h,u])),r.createElement(K,(0,d.Z)({toc:p,className:n,linkClassName:i},c))}const tt={tocCollapsibleButton:"tocCollapsibleButton_iI2p",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_cHjC"};function et(t){let{collapsed:e,...n}=t;return r.createElement("button",(0,d.Z)({type:"button"},n,{className:(0,h.Z)("clean-btn",tt.tocCollapsibleButton,!e&&tt.tocCollapsibleButtonExpanded,n.className)}),r.createElement(p.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component"},"On this page"))}const nt={tocCollapsible:"tocCollapsible_wXna",tocCollapsibleContent:"tocCollapsibleContent_vea0",tocCollapsibleExpanded:"tocCollapsibleExpanded_BbRn"};function rt(t){let{toc:e,className:n,minHeadingLevel:i,maxHeadingLevel:a}=t;const{collapsed:s,toggleCollapsed:o}=(0,z.u)({initialState:!0});return r.createElement("div",{className:(0,h.Z)(nt.tocCollapsible,!s&&nt.tocCollapsibleExpanded,n)},r.createElement(et,{collapsed:s,onClick:o}),r.createElement(z.z,{lazy:!0,className:nt.tocCollapsibleContent,collapsed:s},r.createElement(J,{toc:e,minHeadingLevel:i,maxHeadingLevel:a})))}const it={tocMobile:"tocMobile_Ojys"};function at(){const{toc:t,frontMatter:e}=c();return r.createElement(rt,{toc:t,minHeadingLevel:e.toc_min_heading_level,maxHeadingLevel:e.toc_max_heading_level,className:(0,h.Z)(x.k.docs.docTocMobile,it.tocMobile)})}const st={tableOfContents:"tableOfContents_XG6w",docItemContainer:"docItemContainer_Tr6w"},ot="table-of-contents__link toc-highlight",ct="table-of-contents__link--active";function lt(t){let{className:e,...n}=t;return r.createElement("div",{className:(0,h.Z)(st.tableOfContents,"thin-scrollbar",e)},r.createElement(J,(0,d.Z)({},n,{linkClassName:ot,linkActiveClassName:ct})))}function ht(){const{toc:t,frontMatter:e}=c();return r.createElement(lt,{toc:t,minHeadingLevel:e.toc_min_heading_level,maxHeadingLevel:e.toc_max_heading_level,className:x.k.docs.docTocDesktop})}const ut={anchorWithStickyNavbar:"anchorWithStickyNavbar_JmGV",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_pMLv"};function dt(t){let{as:e,id:n,...i}=t;const{navbar:{hideOnScroll:a}}=(0,U.L)();if("h1"===e||!n)return r.createElement(e,(0,d.Z)({},i,{id:void 0}));const s=(0,p.I)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof i.children?i.children:n});return r.createElement(e,(0,d.Z)({},i,{className:(0,h.Z)("anchor",a?ut.anchorWithHideOnScrollNavbar:ut.anchorWithStickyNavbar,i.className),id:n}),i.children,r.createElement(f.Z,{className:"hash-link",to:`#${n}`,"aria-label":s,title:s},"\u200b"))}var pt=n(35318),ft=n(7092);var gt=n(76457),yt=n(55421);function mt(){const{prism:t}=(0,U.L)(),{colorMode:e}=(0,yt.I)(),n=t.theme,r=t.darkTheme||n;return"dark"===e?r:n}var bt=n(6324),_t=n.n(bt);const xt=/title=(?["'])(?.*?)\1/,vt=/\{(?<range>[\d,-]+)\}/,kt={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}};function wt(t,e){const n=t.map((t=>{const{start:n,end:r}=kt[t];return`(?:${n}\\s*(${e.flatMap((t=>[t.line,t.block?.start,t.block?.end].filter(Boolean))).join("|")})\\s*${r})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function Ct(t,e){let n=t.replace(/\n$/,"");const{language:r,magicComments:i,metastring:a}=e;if(a&&vt.test(a)){const t=a.match(vt).groups.range;if(0===i.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${a}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const e=i[0].className,r=_t()(t).filter((t=>t>0)).map((t=>[t-1,[e]]));return{lineClassNames:Object.fromEntries(r),code:n}}if(void 0===r)return{lineClassNames:{},code:n};const s=function(t,e){switch(t){case"js":case"javascript":case"ts":case"typescript":return wt(["js","jsBlock"],e);case"jsx":case"tsx":return wt(["js","jsBlock","jsx"],e);case"html":return wt(["js","jsBlock","html"],e);case"python":case"py":case"bash":return wt(["bash"],e);case"markdown":case"md":return wt(["html","jsx","bash"],e);default:return wt(Object.keys(kt),e)}}(r,i),o=n.split("\n"),c=Object.fromEntries(i.map((t=>[t.className,{start:0,range:""}]))),l=Object.fromEntries(i.filter((t=>t.line)).map((t=>{let{className:e,line:n}=t;return[n,e]}))),h=Object.fromEntries(i.filter((t=>t.block)).map((t=>{let{className:e,block:n}=t;return[n.start,e]}))),u=Object.fromEntries(i.filter((t=>t.block)).map((t=>{let{className:e,block:n}=t;return[n.end,e]})));for(let p=0;p<o.length;){const t=o[p].match(s);if(!t){p+=1;continue}const e=t.slice(1).find((t=>void 0!==t));l[e]?c[l[e]].range+=`${p},`:h[e]?c[h[e]].start=p:u[e]&&(c[u[e]].range+=`${c[u[e]].start}-${p-1},`),o.splice(p,1)}n=o.join("\n");const d={};return Object.entries(c).forEach((t=>{let[e,{range:n}]=t;_t()(n).forEach((t=>{d[t]??=[],d[t].push(e)}))})),{lineClassNames:d,code:n}}const Et={codeBlockContainer:"codeBlockContainer_mQmQ"};function Tt(t){let{as:e,...n}=t;const i=function(t){const e={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(t.plain).forEach((t=>{let[r,i]=t;const a=e[r];a&&"string"==typeof i&&(n[a]=i)})),n}(mt());return r.createElement(e,(0,d.Z)({},n,{style:i,className:(0,h.Z)(n.className,Et.codeBlockContainer,x.k.common.codeBlock)}))}const St={codeBlockContent:"codeBlockContent_D5yF",codeBlockTitle:"codeBlockTitle_x_ju",codeBlock:"codeBlock_RMoD",codeBlockStandalone:"codeBlockStandalone_wQog",codeBlockLines:"codeBlockLines_AclH",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_O625",buttonGroup:"buttonGroup_aaMX"};function At(t){let{children:e,className:n}=t;return r.createElement(Tt,{as:"pre",tabIndex:0,className:(0,h.Z)(St.codeBlockStandalone,"thin-scrollbar",n)},r.createElement("code",{className:St.codeBlockLines},e))}const Lt={attributes:!0,characterData:!0,childList:!0,subtree:!0};function Bt(t,e){const[n,i]=(0,r.useState)(),s=(0,r.useCallback)((()=>{i(t.current?.closest("[role=tabpanel][hidden]"))}),[t,i]);(0,r.useEffect)((()=>{s()}),[s]),function(t,e,n){void 0===n&&(n=Lt);const i=(0,a.zX)(e),s=(0,a.Ql)(n);(0,r.useEffect)((()=>{const e=new MutationObserver(i);return t&&e.observe(t,s),()=>e.disconnect()}),[t,i,s])}(n,(t=>{t.forEach((t=>{"attributes"===t.type&&"hidden"===t.attributeName&&(e(),s())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}const Nt={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]};var Dt={Prism:n(52349).Z,theme:Nt};function Ot(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mt(){return Mt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mt.apply(this,arguments)}var It=/\r\n|\r|\n/,Ft=function(t){0===t.length?t.push({types:["plain"],content:"\n",empty:!0}):1===t.length&&""===t[0].content&&(t[0].content="\n",t[0].empty=!0)},$t=function(t,e){var n=t.length;return n>0&&t[n-1]===e?t:t.concat(e)};function Rt(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&-1===e.indexOf(r)&&(n[r]=t[r]);return n}var Zt=function(t){function e(){for(var e=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];t.apply(this,n),Ot(this,"getThemeDict",(function(t){if(void 0!==e.themeDict&&t.theme===e.prevTheme&&t.language===e.prevLanguage)return e.themeDict;e.prevTheme=t.theme,e.prevLanguage=t.language;var n=t.theme?function(t,e){var n=t.plain,r=Object.create(null),i=t.styles.reduce((function(t,n){var r=n.languages,i=n.style;return r&&!r.includes(e)||n.types.forEach((function(e){var n=Mt({},t[e],i);t[e]=n})),t}),r);return i.root=n,i.plain=Mt({},n,{backgroundColor:null}),i}(t.theme,t.language):void 0;return e.themeDict=n})),Ot(this,"getLineProps",(function(t){var n=t.key,r=t.className,i=t.style,a=Mt({},Rt(t,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),s=e.getThemeDict(e.props);return void 0!==s&&(a.style=s.plain),void 0!==i&&(a.style=void 0!==a.style?Mt({},a.style,i):i),void 0!==n&&(a.key=n),r&&(a.className+=" "+r),a})),Ot(this,"getStyleForToken",(function(t){var n=t.types,r=t.empty,i=n.length,a=e.getThemeDict(e.props);if(void 0!==a){if(1===i&&"plain"===n[0])return r?{display:"inline-block"}:void 0;if(1===i&&!r)return a[n[0]];var s=r?{display:"inline-block"}:{},o=n.map((function(t){return a[t]}));return Object.assign.apply(Object,[s].concat(o))}})),Ot(this,"getTokenProps",(function(t){var n=t.key,r=t.className,i=t.style,a=t.token,s=Mt({},Rt(t,["key","className","style","token"]),{className:"token "+a.types.join(" "),children:a.content,style:e.getStyleForToken(a),key:void 0});return void 0!==i&&(s.style=void 0!==s.style?Mt({},s.style,i):i),void 0!==n&&(s.key=n),r&&(s.className+=" "+r),s})),Ot(this,"tokenize",(function(t,e,n,r){var i={code:e,grammar:n,language:r,tokens:[]};t.hooks.run("before-tokenize",i);var a=i.tokens=t.tokenize(i.code,i.grammar,i.language);return t.hooks.run("after-tokenize",i),a}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(){var t=this.props,e=t.Prism,n=t.language,r=t.code,i=t.children,a=this.getThemeDict(this.props),s=e.languages[n];return i({tokens:function(t){for(var e=[[]],n=[t],r=[0],i=[t.length],a=0,s=0,o=[],c=[o];s>-1;){for(;(a=r[s]++)<i[s];){var l=void 0,h=e[s],u=n[s][a];if("string"==typeof u?(h=s>0?h:["plain"],l=u):(h=$t(h,u.type),u.alias&&(h=$t(h,u.alias)),l=u.content),"string"==typeof l){var d=l.split(It),p=d.length;o.push({types:h,content:d[0]});for(var f=1;f<p;f++)Ft(o),c.push(o=[]),o.push({types:h,content:d[f]})}else s++,e.push(h),n.push(l),r.push(0),i.push(l.length)}s--,e.pop(),n.pop(),r.pop(),i.pop()}return Ft(o),c}(void 0!==s?this.tokenize(e,r,s,n):[r]),className:"prism-code language-"+n,style:void 0!==a?a.root:{},getLineProps:this.getLineProps,getTokenProps:this.getTokenProps})},e}(r.Component);const Pt=Zt,jt={codeLine:"codeLine_FAqz",codeLineNumber:"codeLineNumber_BE9Z",codeLineContent:"codeLineContent_EF2y"};function Yt(t){let{line:e,classNames:n,showLineNumbers:i,getLineProps:a,getTokenProps:s}=t;1===e.length&&"\n"===e[0].content&&(e[0].content="");const o=a({line:e,className:(0,h.Z)(n,i&&jt.codeLine)}),c=e.map(((t,e)=>r.createElement("span",(0,d.Z)({key:e},s({token:t,key:e})))));return r.createElement("span",o,i?r.createElement(r.Fragment,null,r.createElement("span",{className:jt.codeLineNumber}),r.createElement("span",{className:jt.codeLineContent},c)):c,r.createElement("br",null))}function zt(t){return r.createElement("svg",(0,d.Z)({viewBox:"0 0 24 24"},t),r.createElement("path",{fill:"currentColor",d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"}))}function Ut(t){return r.createElement("svg",(0,d.Z)({viewBox:"0 0 24 24"},t),r.createElement("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))}const Wt={copyButtonCopied:"copyButtonCopied_TYdd",copyButtonIcons:"copyButtonIcons_z5j7",copyButtonIcon:"copyButtonIcon_FoOz",copyButtonSuccessIcon:"copyButtonSuccessIcon_L0B6"};function Ht(t){let{code:e,className:n}=t;const[i,a]=(0,r.useState)(!1),s=(0,r.useRef)(void 0),o=(0,r.useCallback)((()=>{!function(t,e){let{target:n=document.body}=void 0===e?{}:e;if("string"!=typeof t)throw new TypeError(`Expected parameter \`text\` to be a \`string\`, got \`${typeof t}\`.`);const r=document.createElement("textarea"),i=document.activeElement;r.value=t,r.setAttribute("readonly",""),r.style.contain="strict",r.style.position="absolute",r.style.left="-9999px",r.style.fontSize="12pt";const a=document.getSelection(),s=a.rangeCount>0&&a.getRangeAt(0);n.append(r),r.select(),r.selectionStart=0,r.selectionEnd=t.length;let o=!1;try{o=document.execCommand("copy")}catch{}r.remove(),s&&(a.removeAllRanges(),a.addRange(s)),i&&i.focus()}(e),a(!0),s.current=window.setTimeout((()=>{a(!1)}),1e3)}),[e]);return(0,r.useEffect)((()=>()=>window.clearTimeout(s.current)),[]),r.createElement("button",{type:"button","aria-label":i?(0,p.I)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,p.I)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,p.I)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,h.Z)("clean-btn",n,Wt.copyButton,i&&Wt.copyButtonCopied),onClick:o},r.createElement("span",{className:Wt.copyButtonIcons,"aria-hidden":"true"},r.createElement(zt,{className:Wt.copyButtonIcon}),r.createElement(Ut,{className:Wt.copyButtonSuccessIcon})))}function qt(t){return r.createElement("svg",(0,d.Z)({viewBox:"0 0 24 24"},t),r.createElement("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"}))}const Vt={wordWrapButtonIcon:"wordWrapButtonIcon_HV9T",wordWrapButtonEnabled:"wordWrapButtonEnabled_XzR1"};function Gt(t){let{className:e,onClick:n,isEnabled:i}=t;const a=(0,p.I)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return r.createElement("button",{type:"button",onClick:n,className:(0,h.Z)("clean-btn",e,i&&Vt.wordWrapButtonEnabled),"aria-label":a,title:a},r.createElement(qt,{className:Vt.wordWrapButtonIcon,"aria-hidden":"true"}))}function Xt(t){let{children:e,className:n="",metastring:i,title:a,showLineNumbers:s,language:o}=t;const{prism:{defaultLanguage:c,magicComments:l}}=(0,U.L)(),u=o??function(t){const e=t.split(" ").find((t=>t.startsWith("language-")));return e?.replace(/language-/,"")}(n)??c,p=mt(),f=function(){const[t,e]=(0,r.useState)(!1),[n,i]=(0,r.useState)(!1),a=(0,r.useRef)(null),s=(0,r.useCallback)((()=>{const n=a.current.querySelector("code");t?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),e((t=>!t))}),[a,t]),o=(0,r.useCallback)((()=>{const{scrollWidth:t,clientWidth:e}=a.current,n=t>e||a.current.querySelector("code").hasAttribute("style");i(n)}),[a]);return Bt(a,o),(0,r.useEffect)((()=>{o()}),[t,o]),(0,r.useEffect)((()=>(window.addEventListener("resize",o,{passive:!0}),()=>{window.removeEventListener("resize",o)})),[o]),{codeBlockRef:a,isEnabled:t,isCodeScrollable:n,toggle:s}}(),g=function(t){return t?.match(xt)?.groups.title??""}(i)||a,{lineClassNames:y,code:m}=Ct(e,{metastring:i,language:u,magicComments:l}),b=s??function(t){return Boolean(t?.includes("showLineNumbers"))}(i);return r.createElement(Tt,{as:"div",className:(0,h.Z)(n,u&&!n.includes(`language-${u}`)&&`language-${u}`)},g&&r.createElement("div",{className:St.codeBlockTitle},g),r.createElement("div",{className:St.codeBlockContent},r.createElement(Pt,(0,d.Z)({},Dt,{theme:p,code:m,language:u??"text"}),(t=>{let{className:e,tokens:n,getLineProps:i,getTokenProps:a}=t;return r.createElement("pre",{tabIndex:0,ref:f.codeBlockRef,className:(0,h.Z)(e,St.codeBlock,"thin-scrollbar")},r.createElement("code",{className:(0,h.Z)(St.codeBlockLines,b&&St.codeBlockLinesWithNumbering)},n.map(((t,e)=>r.createElement(Yt,{key:e,line:t,getLineProps:i,getTokenProps:a,classNames:y[e],showLineNumbers:b})))))})),r.createElement("div",{className:St.buttonGroup},(f.isEnabled||f.isCodeScrollable)&&r.createElement(Gt,{className:St.codeButton,onClick:()=>f.toggle(),isEnabled:f.isEnabled}),r.createElement(Ht,{className:St.codeButton,code:m}))))}function Qt(t){let{children:e,...n}=t;const i=(0,gt.Z)(),a=function(t){return r.Children.toArray(t).some((t=>(0,r.isValidElement)(t)))?t:Array.isArray(t)?t.join(""):t}(e),s="string"==typeof a?Xt:At;return r.createElement(s,(0,d.Z)({key:String(i)},n),a)}const Kt={details:"details_IpIu",isBrowser:"isBrowser_QD4r",collapsibleContent:"collapsibleContent_Fd2D"};function Jt(t){return!!t&&("SUMMARY"===t.tagName||Jt(t.parentElement))}function te(t,e){return!!t&&(t===e||te(t.parentElement,e))}function ee(t){let{summary:e,children:n,...i}=t;const a=(0,gt.Z)(),s=(0,r.useRef)(null),{collapsed:o,setCollapsed:c}=(0,z.u)({initialState:!i.open}),[l,u]=(0,r.useState)(i.open),p=r.isValidElement(e)?e:r.createElement("summary",null,e??"Details");return r.createElement("details",(0,d.Z)({},i,{ref:s,open:l,"data-collapsed":o,className:(0,h.Z)(Kt.details,a&&Kt.isBrowser,i.className),onMouseDown:t=>{Jt(t.target)&&t.detail>1&&t.preventDefault()},onClick:t=>{t.stopPropagation();const e=t.target;Jt(e)&&te(e,s.current)&&(t.preventDefault(),o?(c(!1),u(!0)):c(!0))}}),p,r.createElement(z.z,{lazy:!1,collapsed:o,disableSSRStyle:!0,onCollapseTransitionEnd:t=>{c(t),u(!t)}},r.createElement("div",{className:Kt.collapsibleContent},n)))}const ne={details:"details_jERq"},re="alert alert--info";function ie(t){let{...e}=t;return r.createElement(ee,(0,d.Z)({},e,{className:(0,h.Z)(re,ne.details,e.className)}))}function ae(t){return r.createElement(dt,t)}const se={containsTaskList:"containsTaskList_QWGu"};const oe={img:"img_SS3x"};const ce="admonition_uH4V",le="admonitionHeading_P5_N",he="admonitionIcon_MF44",ue="admonitionContent_yySL";const de={note:{infimaClassName:"secondary",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))},label:r.createElement(p.Z,{id:"theme.admonition.note",description:"The default label used for the Note admonition (:::note)"},"note")},tip:{infimaClassName:"success",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))},label:r.createElement(p.Z,{id:"theme.admonition.tip",description:"The default label used for the Tip admonition (:::tip)"},"tip")},danger:{infimaClassName:"danger",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 12 16"},r.createElement("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"}))},label:r.createElement(p.Z,{id:"theme.admonition.danger",description:"The default label used for the Danger admonition (:::danger)"},"danger")},info:{infimaClassName:"info",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 14 16"},r.createElement("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))},label:r.createElement(p.Z,{id:"theme.admonition.info",description:"The default label used for the Info admonition (:::info)"},"info")},caution:{infimaClassName:"warning",iconComponent:function(){return r.createElement("svg",{viewBox:"0 0 16 16"},r.createElement("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))},label:r.createElement(p.Z,{id:"theme.admonition.caution",description:"The default label used for the Caution admonition (:::caution)"},"caution")}},pe={secondary:"note",important:"info",success:"tip",warning:"danger"};function fe(t){const{mdxAdmonitionTitle:e,rest:n}=function(t){const e=r.Children.toArray(t),n=e.find((t=>r.isValidElement(t)&&"mdxAdmonitionTitle"===t.props?.mdxType)),i=r.createElement(r.Fragment,null,e.filter((t=>t!==n)));return{mdxAdmonitionTitle:n,rest:i}}(t.children);return{...t,title:t.title??e,children:n}}function ge(t){let{children:e,fallback:n}=t;return(0,gt.Z)()?r.createElement(r.Fragment,null,e?.()):n??null}var ye=n(90829);const me="docusaurus-mermaid-container";function be(){const{colorMode:t}=(0,yt.I)(),e=(0,U.L)().mermaid,n=e.theme[t],{options:i}=e;return(0,r.useMemo)((()=>({startOnLoad:!1,...i,theme:n})),[n,i])}const _e={container:"container_U0RM"};function xe(t){let{value:e}=t;const n=function(t,e){const n=be(),i=e??n;return(0,r.useMemo)((()=>{ye.o.mermaidAPI.initialize(i);const e=`mermaid-svg-${Math.round(1e7*Math.random())}`;return ye.o.render(e,t)}),[t,i])}(e);return r.createElement("div",{className:`${me} ${_e.container}`,dangerouslySetInnerHTML:{__html:n}})}const ve={head:function(t){const e=r.Children.map(t.children,(t=>r.isValidElement(t)?function(t){if(t.props?.mdxType&&t.props.originalType){const{mdxType:e,originalType:n,...i}=t.props;return r.createElement(t.props.originalType,i)}return t}(t):t));return r.createElement(ft.Z,t,e)},code:function(t){const e=["a","abbr","b","br","button","cite","code","del","dfn","em","i","img","input","ins","kbd","label","object","output","q","ruby","s","small","span","strong","sub","sup","time","u","var","wbr"];return r.Children.toArray(t.children).every((t=>"string"==typeof t&&!t.includes("\n")||(0,r.isValidElement)(t)&&e.includes(t.props?.mdxType)))?r.createElement("code",t):r.createElement(Qt,t)},a:function(t){return r.createElement(f.Z,t)},pre:function(t){return r.createElement(Qt,(0,r.isValidElement)(t.children)&&"code"===t.children.props?.originalType?t.children.props:{...t})},details:function(t){const e=r.Children.toArray(t.children),n=e.find((t=>r.isValidElement(t)&&"summary"===t.props?.mdxType)),i=r.createElement(r.Fragment,null,e.filter((t=>t!==n)));return r.createElement(ie,(0,d.Z)({},t,{summary:n}),i)},ul:function(t){return r.createElement("ul",(0,d.Z)({},t,{className:(e=t.className,(0,h.Z)(e,e?.includes("contains-task-list")&&se.containsTaskList))}));var e},img:function(t){return r.createElement("img",(0,d.Z)({loading:"lazy"},t,{className:(e=t.className,(0,h.Z)(e,oe.img))}));var e},h1:t=>r.createElement(ae,(0,d.Z)({as:"h1"},t)),h2:t=>r.createElement(ae,(0,d.Z)({as:"h2"},t)),h3:t=>r.createElement(ae,(0,d.Z)({as:"h3"},t)),h4:t=>r.createElement(ae,(0,d.Z)({as:"h4"},t)),h5:t=>r.createElement(ae,(0,d.Z)({as:"h5"},t)),h6:t=>r.createElement(ae,(0,d.Z)({as:"h6"},t)),admonition:function(t){const{children:e,type:n,title:i,icon:a}=fe(t),s=function(t){const e=pe[t]??t,n=de[e];return n||(console.warn(`No admonition config found for admonition type "${e}". Using Info as fallback.`),de.info)}(n),o=i??s.label,{iconComponent:c}=s,l=a??r.createElement(c,null);return r.createElement("div",{className:(0,h.Z)(x.k.common.admonition,x.k.common.admonitionType(t.type),"alert",`alert--${s.infimaClassName}`,ce)},r.createElement("div",{className:le},r.createElement("span",{className:he},l),o),r.createElement("div",{className:ue},e))},mermaid:function(t){return r.createElement(ge,null,(()=>r.createElement(xe,t)))}};function ke(t){let{children:e}=t;return r.createElement(pt.Zo,{components:ve},e)}function we(t){let{children:e}=t;const n=function(){const{metadata:t,frontMatter:e,contentTitle:n}=c();return e.hide_title||void 0!==n?null:t.title}();return r.createElement("div",{className:(0,h.Z)(x.k.docs.docMarkdown,"markdown")},n&&r.createElement("header",null,r.createElement(dt,{as:"h1"},n)),r.createElement(ke,null,e))}var Ce=n(45161),Ee=n(8862),Te=n(98948);function Se(t){return r.createElement("svg",(0,d.Z)({viewBox:"0 0 24 24"},t),r.createElement("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"}))}const Ae={breadcrumbHomeIcon:"breadcrumbHomeIcon_sfvy"};function Le(){const t=(0,Te.Z)("/");return r.createElement("li",{className:"breadcrumbs__item"},r.createElement(f.Z,{"aria-label":(0,p.I)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:t},r.createElement(Se,{className:Ae.breadcrumbHomeIcon})))}const Be={breadcrumbsContainer:"breadcrumbsContainer_T5ub"};function Ne(t){let{children:e,href:n,isLast:i}=t;const a="breadcrumbs__link";return i?r.createElement("span",{className:a,itemProp:"name"},e):n?r.createElement(f.Z,{className:a,href:n,itemProp:"item"},r.createElement("span",{itemProp:"name"},e)):r.createElement("span",{className:a},e)}function De(t){let{children:e,active:n,index:i,addMicrodata:a}=t;return r.createElement("li",(0,d.Z)({},a&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},{className:(0,h.Z)("breadcrumbs__item",{"breadcrumbs__item--active":n})}),e,r.createElement("meta",{itemProp:"position",content:String(i+1)}))}function Oe(){const t=(0,Ce.s1)(),e=(0,Ee.Ns)();return t?r.createElement("nav",{className:(0,h.Z)(x.k.docs.docBreadcrumbs,Be.breadcrumbsContainer),"aria-label":(0,p.I)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"})},r.createElement("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList"},e&&r.createElement(Le,null),t.map(((e,n)=>{const i=n===t.length-1;return r.createElement(De,{key:n,active:i,index:n,addMicrodata:!!e.href},r.createElement(Ne,{href:e.href,isLast:i},e.label))})))):null}const Me={docItemContainer:"docItemContainer_tjFy",docItemCol:"docItemCol_Qr34"};function Ie(t){let{children:e}=t;const n=function(){const{frontMatter:t,toc:e}=c(),n=(0,u.i)(),i=t.hide_table_of_contents,a=!i&&e.length>0;return{hidden:i,mobile:a?r.createElement(at,null):void 0,desktop:!a||"desktop"!==n&&"ssr"!==n?void 0:r.createElement(ht,null)}}();return r.createElement("div",{className:"row"},r.createElement("div",{className:(0,h.Z)("col",!n.hidden&&Me.docItemCol)},r.createElement(S,null),r.createElement("div",{className:Me.docItemContainer},r.createElement("article",null,r.createElement(Oe,null),r.createElement(A,null),n.mobile,r.createElement(we,null,e),r.createElement(Y,null)),r.createElement(m,null))),n.desktop&&r.createElement("div",{className:"col col--3"},n.desktop))}function Fe(t){const e=`docs-doc-id-${t.content.metadata.unversionedId}`,n=t.content;return r.createElement(o,{content:t.content},r.createElement(i.FG,{className:e},r.createElement(l,null),r.createElement(Ie,null,r.createElement(n,null))))}},25611:(t,e,n)=>{"use strict";n.d(e,{E:()=>o,q:()=>s});var r=n(27378),i=n(41763);const a=r.createContext(null);function s(t){let{children:e,version:n}=t;return r.createElement(a.Provider,{value:n},e)}function o(){const t=(0,r.useContext)(a);if(null===t)throw new i.i6("DocsVersionProvider");return t}},27693:function(t){t.exports=function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",a="minute",s="hour",o="day",c="week",l="month",h="quarter",u="year",d="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},b={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,l),a=n-i<0,s=e.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-s:s-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:l,y:u,w:c,d:o,D:d,h:s,m:a,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},_="en",x={};x[_]=y;var v=function(t){return t instanceof E},k=function t(e,n,r){var i;if(!e)return _;if("string"==typeof e){var a=e.toLowerCase();x[a]&&(i=a),n&&(x[a]=n,i=a);var s=e.split("-");if(!i&&s.length>1)return t(s[0])}else{var o=e.name;x[o]=e,i=o}return!r&&i&&(_=i),i||!r&&_},w=function(t,e){if(v(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new E(n)},C=b;C.l=k,C.i=v,C.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var E=function(){function y(t){this.$L=k(t.locale,null,!0),this.parse(t)}var m=y.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(C.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(f);if(r){var i=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return C},m.isValid=function(){return!(this.$d.toString()===p)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return C.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!C.u(e)||e,h=C.p(t),p=function(t,e){var i=C.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(o)},f=function(t,e){return C.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},g=this.$W,y=this.$M,m=this.$D,b="set"+(this.$u?"UTC":"");switch(h){case u:return r?p(1,0):p(31,11);case l:return r?p(1,y):p(0,y+1);case c:var _=this.$locale().weekStart||0,x=(g<_?g+7:g)-_;return p(r?m-x:m+(6-x),y);case o:case d:return f(b+"Hours",0);case s:return f(b+"Minutes",1);case a:return f(b+"Seconds",2);case i:return f(b+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,c=C.p(t),h="set"+(this.$u?"UTC":""),p=(n={},n[o]=h+"Date",n[d]=h+"Date",n[l]=h+"Month",n[u]=h+"FullYear",n[s]=h+"Hours",n[a]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[c],f=c===o?this.$D+(e-this.$W):e;if(c===l||c===u){var g=this.clone().set(d,1);g.$d[p](f),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[C.p(t)]()},m.add=function(r,h){var d,p=this;r=Number(r);var f=C.p(h),g=function(t){var e=w(p);return C.w(e.date(e.date()+Math.round(t*r)),p)};if(f===l)return this.set(l,this.$M+r);if(f===u)return this.set(u,this.$y+r);if(f===o)return g(1);if(f===c)return g(7);var y=(d={},d[a]=e,d[s]=n,d[i]=t,d)[f]||1,m=this.$d.getTime()+r*y;return C.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=C.z(this),a=this.$H,s=this.$m,o=this.$M,c=n.weekdays,l=n.months,h=n.meridiem,u=function(t,n,i,a){return t&&(t[n]||t(e,r))||i[n].slice(0,a)},d=function(t){return C.s(a%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(g,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return C.s(e.$y,4,"0");case"M":return o+1;case"MM":return C.s(o+1,2,"0");case"MMM":return u(n.monthsShort,o,l,3);case"MMMM":return u(l,o);case"D":return e.$D;case"DD":return C.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return u(n.weekdaysMin,e.$W,c,2);case"ddd":return u(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(a);case"HH":return C.s(a,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(a,s,!0);case"A":return f(a,s,!1);case"m":return String(s);case"mm":return C.s(s,2,"0");case"s":return String(e.$s);case"ss":return C.s(e.$s,2,"0");case"SSS":return C.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,p){var f,g=this,y=C.p(d),m=w(r),b=(m.utcOffset()-this.utcOffset())*e,_=this-m,x=function(){return C.m(g,m)};switch(y){case u:f=x()/12;break;case l:f=x();break;case h:f=x()/3;break;case c:f=(_-b)/6048e5;break;case o:f=(_-b)/864e5;break;case s:f=_/n;break;case a:f=_/e;break;case i:f=_/t;break;default:f=_}return p?f:C.a(f)},m.daysInMonth=function(){return this.endOf(l).$D},m.$locale=function(){return x[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=k(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return C.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},y}(),T=E.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",a],["$H",s],["$W",o],["$M",l],["$y",u],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),w.extend=function(t,e){return t.$i||(t(e,E,w),t.$i=!0),w},w.locale=k,w.isDayjs=v,w.unix=function(t){return w(1e3*t)},w.en=x[_],w.Ls=x,w.p={},w}()},79580:function(t){t.exports=function(){"use strict";return function(t,e){var n=e.prototype,r=n.format;n.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return r.bind(this)(t);var i=this.$utils(),a=(t||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(t){switch(t){case"Q":return Math.ceil((e.$M+1)/3);case"Do":return n.ordinal(e.$D);case"gggg":return e.weekYear();case"GGGG":return e.isoWeekYear();case"wo":return n.ordinal(e.week(),"W");case"w":case"ww":return i.s(e.week(),"w"===t?1:2,"0");case"W":case"WW":return i.s(e.isoWeek(),"W"===t?1:2,"0");case"k":case"kk":return i.s(String(0===e.$H?24:e.$H),"k"===t?1:2,"0");case"X":return Math.floor(e.$d.getTime()/1e3);case"x":return e.$d.getTime();case"z":return"["+e.offsetName()+"]";case"zzz":return"["+e.offsetName("long")+"]";default:return t}}));return r.bind(this)(a)}}}()},69746:function(t){t.exports=function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},s=function(t){return(t=+t)+(t>68?1900:2e3)},o=function(t){return function(e){this[t]=+e}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t)}],l=function(t){var e=a[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=a.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},u={A:[i,function(t){this.afternoon=h(t,!1)}],a:[i,function(t){this.afternoon=h(t,!0)}],S:[/\d/,function(t){this.milliseconds=100*+t}],SS:[n,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[r,o("seconds")],ss:[r,o("seconds")],m:[r,o("minutes")],mm:[r,o("minutes")],H:[r,o("hours")],h:[r,o("hours")],HH:[r,o("hours")],hh:[r,o("hours")],D:[r,o("day")],DD:[n,o("day")],Do:[i,function(t){var e=a.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r)}],M:[r,o("month")],MM:[n,o("month")],MMM:[i,function(t){var e=l("months"),n=(l("monthsShort")||e.map((function(t){return t.slice(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(t){var e=l("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,o("year")],YY:[n,function(t){this.year=s(t)}],YYYY:[/\d{4}/,o("year")],Z:c,ZZ:c};function d(n){var r,i;r=n,i=a&&a.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var a=r&&r.toUpperCase();return n||i[r]||t[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),o=s.length,c=0;c<o;c+=1){var l=s[c],h=u[l],d=h&&h[0],p=h&&h[1];s[c]=p?{regex:d,parser:p}:l.replace(/^\[|\]$/g,"")}return function(t){for(var e={},n=0,r=0;n<o;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else{var a=i.regex,c=i.parser,l=t.slice(r),h=a.exec(l)[0];c.call(e,h),t=t.replace(h,"")}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var o=s[1];if("string"==typeof o){var c=!0===s[2],l=!0===s[3],h=c||l,u=s[2];l&&(u=s[2]),a=this.$locale(),!c&&u&&(a=n.Ls[u]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=d(e)(t),i=r.year,a=r.month,s=r.day,o=r.hours,c=r.minutes,l=r.seconds,h=r.milliseconds,u=r.zone,p=new Date,f=s||(i||a?1:p.getDate()),g=i||p.getFullYear(),y=0;i&&!a||(y=a>0?a-1:p.getMonth());var m=o||0,b=c||0,_=l||0,x=h||0;return u?new Date(Date.UTC(g,y,f,m,b,_,x+60*u.offset*1e3)):n?new Date(Date.UTC(g,y,f,m,b,_,x)):new Date(g,y,f,m,b,_,x)}catch(t){return new Date("")}}(e,o,r),this.init(),u&&!0!==u&&(this.$L=this.locale(u).$L),h&&e!=this.format(o)&&(this.$d=new Date("")),a={}}else if(o instanceof Array)for(var p=o.length,f=1;f<=p;f+=1){s[1]=o[f-1];var g=n.apply(this,s);if(g.isValid()){this.$d=g.$d,this.$L=g.$L,this.init();break}f===p&&(this.$d=new Date(""))}else i.call(this,t)}}}()},57635:function(t){t.exports=function(){"use strict";var t="day";return function(e,n,r){var i=function(e){return e.add(4-e.isoWeekday(),t)},a=n.prototype;a.isoWeekYear=function(){return i(this).year()},a.isoWeek=function(e){if(!this.$utils().u(e))return this.add(7*(e-this.isoWeek()),t);var n,a,s,o=i(this),c=(n=this.isoWeekYear(),s=4-(a=(this.$u?r.utc:r)().year(n).startOf("year")).isoWeekday(),a.isoWeekday()>4&&(s+=7),a.add(s,t));return o.diff(c,"week")+1},a.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var s=a.startOf;a.startOf=function(t,e){var n=this.$utils(),r=!!n.u(e)||e;return"isoweek"===n.p(t)?r?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):s.bind(this)(t,e)}}}()},31699:function(t){t.exports=function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function r(t,i,a){return r=n()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var a=new(Function.bind.apply(t,i));return r&&e(a,r.prototype),a},r.apply(null,arguments)}function i(t){return a(t)||s(t)||o(t)||l()}function a(t){if(Array.isArray(t))return c(t)}function s(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function o(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h=Object.hasOwnProperty,u=Object.setPrototypeOf,d=Object.isFrozen,p=Object.getPrototypeOf,f=Object.getOwnPropertyDescriptor,g=Object.freeze,y=Object.seal,m=Object.create,b="undefined"!=typeof Reflect&&Reflect,_=b.apply,x=b.construct;_||(_=function(t,e,n){return t.apply(e,n)}),g||(g=function(t){return t}),y||(y=function(t){return t}),x||(x=function(t,e){return r(t,i(e))});var v=D(Array.prototype.forEach),k=D(Array.prototype.pop),w=D(Array.prototype.push),C=D(String.prototype.toLowerCase),E=D(String.prototype.toString),T=D(String.prototype.match),S=D(String.prototype.replace),A=D(String.prototype.indexOf),L=D(String.prototype.trim),B=D(RegExp.prototype.test),N=O(TypeError);function D(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return _(t,e,r)}}function O(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return x(t,n)}}function M(t,e,n){n=n||C,u&&u(t,null);for(var r=e.length;r--;){var i=e[r];if("string"==typeof i){var a=n(i);a!==i&&(d(e)||(e[r]=a),i=a)}t[i]=!0}return t}function I(t){var e,n=m(null);for(e in t)!0===_(h,t,[e])&&(n[e]=t[e]);return n}function F(t,e){for(;null!==t;){var n=f(t,e);if(n){if(n.get)return D(n.get);if("function"==typeof n.value)return D(n.value)}t=p(t)}function r(t){return console.warn("fallback value for",t),null}return r}var $=g(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),R=g(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Z=g(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=g(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),j=g(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Y=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),z=g(["#text"]),U=g(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),W=g(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),H=g(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=y(/<%[\w\W]*|[\w\W]*%>/gm),X=y(/\${[\w\W]*}/gm),Q=y(/^data-[\-\w.\u00B7-\uFFFF]/),K=y(/^aria-[\-\w]+$/),J=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tt=y(/^(?:\w+script|data):/i),et=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nt=y(/^html$/i),rt=function(){return"undefined"==typeof window?null:window},it=function(e,n){if("object"!==t(e)||"function"!=typeof e.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(s){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function at(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt(),n=function(t){return at(t)};if(n.version="2.4.3",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,a=e.document,s=e.DocumentFragment,o=e.HTMLTemplateElement,c=e.Node,l=e.Element,h=e.NodeFilter,u=e.NamedNodeMap,d=void 0===u?e.NamedNodeMap||e.MozNamedAttrMap:u,p=e.HTMLFormElement,f=e.DOMParser,y=e.trustedTypes,m=l.prototype,b=F(m,"cloneNode"),_=F(m,"nextSibling"),x=F(m,"childNodes"),D=F(m,"parentNode");if("function"==typeof o){var O=a.createElement("template");O.content&&O.content.ownerDocument&&(a=O.content.ownerDocument)}var st=it(y,r),ot=st?st.createHTML(""):"",ct=a,lt=ct.implementation,ht=ct.createNodeIterator,ut=ct.createDocumentFragment,dt=ct.getElementsByTagName,pt=r.importNode,ft={};try{ft=I(a).documentMode?a.documentMode:{}}catch(De){}var gt={};n.isSupported="function"==typeof D&<&&void 0!==lt.createHTMLDocument&&9!==ft;var yt,mt,bt=V,_t=G,xt=X,vt=Q,kt=K,wt=tt,Ct=et,Et=J,Tt=null,St=M({},[].concat(i($),i(R),i(Z),i(j),i(z))),At=null,Lt=M({},[].concat(i(U),i(W),i(H),i(q))),Bt=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Nt=null,Dt=null,Ot=!0,Mt=!0,It=!1,Ft=!1,$t=!1,Rt=!1,Zt=!1,Pt=!1,jt=!1,Yt=!1,zt=!0,Ut=!1,Wt="user-content-",Ht=!0,qt=!1,Vt={},Gt=null,Xt=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Qt=null,Kt=M({},["audio","video","img","source","image","track"]),Jt=null,te=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ee="http://www.w3.org/1998/Math/MathML",ne="http://www.w3.org/2000/svg",re="http://www.w3.org/1999/xhtml",ie=re,ae=!1,se=null,oe=M({},[ee,ne,re],E),ce=["application/xhtml+xml","text/html"],le="text/html",he=null,ue=a.createElement("form"),de=function(t){return t instanceof RegExp||t instanceof Function},pe=function(e){he&&he===e||(e&&"object"===t(e)||(e={}),e=I(e),yt=yt=-1===ce.indexOf(e.PARSER_MEDIA_TYPE)?le:e.PARSER_MEDIA_TYPE,mt="application/xhtml+xml"===yt?E:C,Tt="ALLOWED_TAGS"in e?M({},e.ALLOWED_TAGS,mt):St,At="ALLOWED_ATTR"in e?M({},e.ALLOWED_ATTR,mt):Lt,se="ALLOWED_NAMESPACES"in e?M({},e.ALLOWED_NAMESPACES,E):oe,Jt="ADD_URI_SAFE_ATTR"in e?M(I(te),e.ADD_URI_SAFE_ATTR,mt):te,Qt="ADD_DATA_URI_TAGS"in e?M(I(Kt),e.ADD_DATA_URI_TAGS,mt):Kt,Gt="FORBID_CONTENTS"in e?M({},e.FORBID_CONTENTS,mt):Xt,Nt="FORBID_TAGS"in e?M({},e.FORBID_TAGS,mt):{},Dt="FORBID_ATTR"in e?M({},e.FORBID_ATTR,mt):{},Vt="USE_PROFILES"in e&&e.USE_PROFILES,Ot=!1!==e.ALLOW_ARIA_ATTR,Mt=!1!==e.ALLOW_DATA_ATTR,It=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ft=e.SAFE_FOR_TEMPLATES||!1,$t=e.WHOLE_DOCUMENT||!1,Pt=e.RETURN_DOM||!1,jt=e.RETURN_DOM_FRAGMENT||!1,Yt=e.RETURN_TRUSTED_TYPE||!1,Zt=e.FORCE_BODY||!1,zt=!1!==e.SANITIZE_DOM,Ut=e.SANITIZE_NAMED_PROPS||!1,Ht=!1!==e.KEEP_CONTENT,qt=e.IN_PLACE||!1,Et=e.ALLOWED_URI_REGEXP||Et,ie=e.NAMESPACE||re,e.CUSTOM_ELEMENT_HANDLING&&de(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Bt.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&de(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Bt.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Bt.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ft&&(Mt=!1),jt&&(Pt=!0),Vt&&(Tt=M({},i(z)),At=[],!0===Vt.html&&(M(Tt,$),M(At,U)),!0===Vt.svg&&(M(Tt,R),M(At,W),M(At,q)),!0===Vt.svgFilters&&(M(Tt,Z),M(At,W),M(At,q)),!0===Vt.mathMl&&(M(Tt,j),M(At,H),M(At,q))),e.ADD_TAGS&&(Tt===St&&(Tt=I(Tt)),M(Tt,e.ADD_TAGS,mt)),e.ADD_ATTR&&(At===Lt&&(At=I(At)),M(At,e.ADD_ATTR,mt)),e.ADD_URI_SAFE_ATTR&&M(Jt,e.ADD_URI_SAFE_ATTR,mt),e.FORBID_CONTENTS&&(Gt===Xt&&(Gt=I(Gt)),M(Gt,e.FORBID_CONTENTS,mt)),Ht&&(Tt["#text"]=!0),$t&&M(Tt,["html","head","body"]),Tt.table&&(M(Tt,["tbody"]),delete Nt.tbody),g&&g(e),he=e)},fe=M({},["mi","mo","mn","ms","mtext"]),ge=M({},["foreignobject","desc","title","annotation-xml"]),ye=M({},["title","style","font","a","script"]),me=M({},R);M(me,Z),M(me,P);var be=M({},j);M(be,Y);var _e=function(t){var e=D(t);e&&e.tagName||(e={namespaceURI:ie,tagName:"template"});var n=C(t.tagName),r=C(e.tagName);return!!se[t.namespaceURI]&&(t.namespaceURI===ne?e.namespaceURI===re?"svg"===n:e.namespaceURI===ee?"svg"===n&&("annotation-xml"===r||fe[r]):Boolean(me[n]):t.namespaceURI===ee?e.namespaceURI===re?"math"===n:e.namespaceURI===ne?"math"===n&&ge[r]:Boolean(be[n]):t.namespaceURI===re?!(e.namespaceURI===ne&&!ge[r])&&!(e.namespaceURI===ee&&!fe[r])&&!be[n]&&(ye[n]||!me[n]):!("application/xhtml+xml"!==yt||!se[t.namespaceURI]))},xe=function(t){w(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(De){try{t.outerHTML=ot}catch(De){t.remove()}}},ve=function(t,e){try{w(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(De){w(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!At[t])if(Pt||jt)try{xe(e)}catch(De){}else try{e.setAttribute(t,"")}catch(De){}},ke=function(t){var e,n;if(Zt)t="<remove></remove>"+t;else{var r=T(t,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===yt&&ie===re&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=st?st.createHTML(t):t;if(ie===re)try{e=(new f).parseFromString(i,yt)}catch(De){}if(!e||!e.documentElement){e=lt.createDocument(ie,"template",null);try{e.documentElement.innerHTML=ae?ot:i}catch(De){}}var s=e.body||e.documentElement;return t&&n&&s.insertBefore(a.createTextNode(n),s.childNodes[0]||null),ie===re?dt.call(e,$t?"html":"body")[0]:$t?e.documentElement:s},we=function(t){return ht.call(t.ownerDocument||t,t,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT,null,!1)},Ce=function(t){return t instanceof p&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof d)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Ee=function(e){return"object"===t(c)?e instanceof c:e&&"object"===t(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Te=function(t,e,r){gt[t]&&v(gt[t],(function(t){t.call(n,e,r,he)}))},Se=function(t){var e;if(Te("beforeSanitizeElements",t,null),Ce(t))return xe(t),!0;if(B(/[\u0080-\uFFFF]/,t.nodeName))return xe(t),!0;var r=mt(t.nodeName);if(Te("uponSanitizeElement",t,{tagName:r,allowedTags:Tt}),t.hasChildNodes()&&!Ee(t.firstElementChild)&&(!Ee(t.content)||!Ee(t.content.firstElementChild))&&B(/<[/\w]/g,t.innerHTML)&&B(/<[/\w]/g,t.textContent))return xe(t),!0;if("select"===r&&B(/<template/i,t.innerHTML))return xe(t),!0;if(!Tt[r]||Nt[r]){if(!Nt[r]&&Le(r)){if(Bt.tagNameCheck instanceof RegExp&&B(Bt.tagNameCheck,r))return!1;if(Bt.tagNameCheck instanceof Function&&Bt.tagNameCheck(r))return!1}if(Ht&&!Gt[r]){var i=D(t)||t.parentNode,a=x(t)||t.childNodes;if(a&&i)for(var s=a.length-1;s>=0;--s)i.insertBefore(b(a[s],!0),_(t))}return xe(t),!0}return t instanceof l&&!_e(t)?(xe(t),!0):"noscript"!==r&&"noembed"!==r||!B(/<\/no(script|embed)/i,t.innerHTML)?(Ft&&3===t.nodeType&&(e=t.textContent,e=S(e,bt," "),e=S(e,_t," "),e=S(e,xt," "),t.textContent!==e&&(w(n.removed,{element:t.cloneNode()}),t.textContent=e)),Te("afterSanitizeElements",t,null),!1):(xe(t),!0)},Ae=function(t,e,n){if(zt&&("id"===e||"name"===e)&&(n in a||n in ue))return!1;if(Mt&&!Dt[e]&&B(vt,e));else if(Ot&&B(kt,e));else if(!At[e]||Dt[e]){if(!(Le(t)&&(Bt.tagNameCheck instanceof RegExp&&B(Bt.tagNameCheck,t)||Bt.tagNameCheck instanceof Function&&Bt.tagNameCheck(t))&&(Bt.attributeNameCheck instanceof RegExp&&B(Bt.attributeNameCheck,e)||Bt.attributeNameCheck instanceof Function&&Bt.attributeNameCheck(e))||"is"===e&&Bt.allowCustomizedBuiltInElements&&(Bt.tagNameCheck instanceof RegExp&&B(Bt.tagNameCheck,n)||Bt.tagNameCheck instanceof Function&&Bt.tagNameCheck(n))))return!1}else if(Jt[e]);else if(B(Et,S(n,Ct,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==A(n,"data:")||!Qt[t])if(It&&!B(wt,S(n,Ct,"")));else if(n)return!1;return!0},Le=function(t){return t.indexOf("-")>0},Be=function(e){var r,i,a,s;Te("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:At};for(s=o.length;s--;){var l=r=o[s],h=l.name,u=l.namespaceURI;if(i="value"===h?r.value:L(r.value),a=mt(h),c.attrName=a,c.attrValue=i,c.keepAttr=!0,c.forceKeepAttr=void 0,Te("uponSanitizeAttribute",e,c),i=c.attrValue,!c.forceKeepAttr&&(ve(h,e),c.keepAttr))if(B(/\/>/i,i))ve(h,e);else{Ft&&(i=S(i,bt," "),i=S(i,_t," "),i=S(i,xt," "));var d=mt(e.nodeName);if(Ae(d,a,i)){if(!Ut||"id"!==a&&"name"!==a||(ve(h,e),i=Wt+i),st&&"object"===t(y)&&"function"==typeof y.getAttributeType)if(u);else switch(y.getAttributeType(d,a)){case"TrustedHTML":i=st.createHTML(i);break;case"TrustedScriptURL":i=st.createScriptURL(i)}try{u?e.setAttributeNS(u,h,i):e.setAttribute(h,i),k(n.removed)}catch(De){}}}}Te("afterSanitizeAttributes",e,null)}},Ne=function t(e){var n,r=we(e);for(Te("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Te("uponSanitizeShadowNode",n,null),Se(n)||(n.content instanceof s&&t(n.content),Be(n));Te("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(i){var a,o,l,h,u,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((ae=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!Ee(i)){if("function"!=typeof i.toString)throw N("toString is not a function");if("string"!=typeof(i=i.toString()))throw N("dirty is not a string, aborting")}if(!n.isSupported){if("object"===t(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof i)return e.toStaticHTML(i);if(Ee(i))return e.toStaticHTML(i.outerHTML)}return i}if(Rt||pe(d),n.removed=[],"string"==typeof i&&(qt=!1),qt){if(i.nodeName){var p=mt(i.nodeName);if(!Tt[p]||Nt[p])throw N("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof c)1===(o=(a=ke("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?a=o:a.appendChild(o);else{if(!Pt&&!Ft&&!$t&&-1===i.indexOf("<"))return st&&Yt?st.createHTML(i):i;if(!(a=ke(i)))return Pt?null:Yt?ot:""}a&&Zt&&xe(a.firstChild);for(var f=we(qt?i:a);l=f.nextNode();)3===l.nodeType&&l===h||Se(l)||(l.content instanceof s&&Ne(l.content),Be(l),h=l);if(h=null,qt)return i;if(Pt){if(jt)for(u=ut.call(a.ownerDocument);a.firstChild;)u.appendChild(a.firstChild);else u=a;return At.shadowroot&&(u=pt.call(r,u,!0)),u}var g=$t?a.outerHTML:a.innerHTML;return $t&&Tt["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&B(nt,a.ownerDocument.doctype.name)&&(g="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+g),Ft&&(g=S(g,bt," "),g=S(g,_t," "),g=S(g,xt," ")),st&&Yt?st.createHTML(g):g},n.setConfig=function(t){pe(t),Rt=!0},n.clearConfig=function(){he=null,Rt=!1},n.isValidAttribute=function(t,e,n){he||pe({});var r=mt(t),i=mt(e);return Ae(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(gt[t]=gt[t]||[],w(gt[t],e))},n.removeHook=function(t){if(gt[t])return k(gt[t])},n.removeHooks=function(t){gt[t]&&(gt[t]=[])},n.removeAllHooks=function(){gt={}},n}return at()}()},90829:(t,e,n)=>{"use strict";n.d(e,{a:()=>Pn,b:()=>Ys,c:()=>jt,d:()=>Rn,e:()=>Zt,f:()=>Vs,g:()=>ur,h:()=>wc,i:()=>ys,j:()=>Hr,k:()=>Vr,l:()=>Bt,m:()=>Rr,n:()=>It,o:()=>Sp,p:()=>Co,s:()=>_r});const r=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=Array.from("string"==typeof t?[t]:t);r[r.length-1]=r[r.length-1].replace(/\r?\n([\t ]*)$/,"");var i=r.reduce((function(t,e){var n=e.match(/\n([\t ]+|(?!\s).)/g);return n?t.concat(n.map((function(t){var e,n;return null!==(n=null===(e=t.match(/[\t ]/g))||void 0===e?void 0:e.length)&&void 0!==n?n:0}))):t}),[]);if(i.length){var a=new RegExp("\n[\t ]{"+Math.min.apply(Math,i)+"}","g");r=r.map((function(t){return t.replace(a,"\n")}))}r[0]=r[0].replace(/^\r?\n/,"");var s=r[0];return e.forEach((function(t,e){var n=s.match(/(?:^|\n)( *)$/),i=n?n[1]:"",a=t;"string"==typeof t&&t.includes("\n")&&(a=String(t).split("\n").map((function(t,e){return 0===e?t:""+i+t})).join("\n")),s+=a+r[e+1]})),s};var i=n(27693),a=n.n(i),s=n(7608),o=n(5949),l=n(31699),h=n.n(l),u=n(31739),d=n(83445);const p=(t,e)=>{const n=u.Z.parse(t);for(const r in e)n[r]=d.Z.channel.clamp[r](e[r]);return u.Z.stringify(n)},f=(t,e)=>{const n=u.Z.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return p(t,r)};var g=n(75781);const y=(t,e,n=0,r=1)=>{if("number"!=typeof t)return p(t,{a:e});const i=g.Z.set({r:d.Z.channel.clamp.r(t),g:d.Z.channel.clamp.g(e),b:d.Z.channel.clamp.b(n),a:d.Z.channel.clamp.a(r)});return u.Z.stringify(i)},m=(t,e,n=50)=>{const{r:r,g:i,b:a,a:s}=u.Z.parse(t),{r:o,g:c,b:l,a:h}=u.Z.parse(e),d=n/100,p=2*d-1,f=s-h,g=((p*f==-1?p:(p+f)/(1+p*f))+1)/2,m=1-g;return y(r*g+o*m,i*g+c*m,a*g+l*m,s*d+h*(1-d))},b=(t,e=100)=>{const n=u.Z.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,m(n,t,e)};var _=n(54628),x=n(36304),v=n(77397),k="comm",w="rule",C="decl",E=Math.abs,T=String.fromCharCode;Object.assign;function S(t){return t.trim()}function A(t,e,n){return t.replace(e,n)}function L(t,e){return t.indexOf(e)}function B(t,e){return 0|t.charCodeAt(e)}function N(t,e,n){return t.slice(e,n)}function D(t){return t.length}function O(t,e){return e.push(t),t}function M(t,e){for(var n="",r=0;r<t.length;r++)n+=e(t[r],r,t,e)||"";return n}function I(t,e,n,r){switch(t.type){case"@layer":if(t.children.length)break;case"@import":case C:return t.return=t.return||t.value;case k:return"";case"@keyframes":return t.return=t.value+"{"+M(t.children,r)+"}";case w:if(!D(t.value=t.props.join(",")))return""}return D(n=M(t.children,r))?t.return=t.value+"{"+n+"}":""}var F=1,$=1,R=0,Z=0,P=0,j="";function Y(t,e,n,r,i,a,s,o){return{value:t,root:e,parent:n,type:r,props:i,children:a,line:F,column:$,length:s,return:"",siblings:o}}function z(){return P=Z>0?B(j,--Z):0,$--,10===P&&($=1,F--),P}function U(){return P=Z<R?B(j,Z++):0,$++,10===P&&($=1,F++),P}function W(){return B(j,Z)}function H(){return Z}function q(t,e){return N(j,t,e)}function V(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function G(t){return F=$=1,R=D(j=t),Z=0,[]}function X(t){return j="",t}function Q(t){return S(q(Z-1,tt(91===t?t+2:40===t?t+1:t)))}function K(t){for(;(P=W())&&P<33;)U();return V(t)>2||V(P)>3?"":" "}function J(t,e){for(;--e&&U()&&!(P<48||P>102||P>57&&P<65||P>70&&P<97););return q(t,H()+(e<6&&32==W()&&32==U()))}function tt(t){for(;U();)switch(P){case t:return Z;case 34:case 39:34!==t&&39!==t&&tt(P);break;case 40:41===t&&tt(t);break;case 92:U()}return Z}function et(t,e){for(;U()&&t+P!==57&&(t+P!==84||47!==W()););return"/*"+q(e,Z-1)+"*"+T(47===t?t:U())}function nt(t){for(;!V(W());)U();return q(t,Z)}function rt(t){return X(it("",null,null,null,[""],t=G(t),0,[0],t))}function it(t,e,n,r,i,a,s,o,c){for(var l=0,h=0,u=s,d=0,p=0,f=0,g=1,y=1,m=1,b=0,_="",x=i,v=a,k=r,w=_;y;)switch(f=b,b=U()){case 40:if(108!=f&&58==B(w,u-1)){-1!=L(w+=A(Q(b),"&","&\f"),"&\f")&&(m=-1);break}case 34:case 39:case 91:w+=Q(b);break;case 9:case 10:case 13:case 32:w+=K(f);break;case 92:w+=J(H()-1,7);continue;case 47:switch(W()){case 42:case 47:O(st(et(U(),H()),e,n,c),c);break;default:w+="/"}break;case 123*g:o[l++]=D(w)*m;case 125*g:case 59:case 0:switch(b){case 0:case 125:y=0;case 59+h:-1==m&&(w=A(w,/\f/g,"")),p>0&&D(w)-u&&O(p>32?ot(w+";",r,n,u-1,c):ot(A(w," ","")+";",r,n,u-2,c),c);break;case 59:w+=";";default:if(O(k=at(w,e,n,l,h,i,o,_,x=[],v=[],u,a),a),123===b)if(0===h)it(w,e,k,k,x,a,u,o,v);else switch(99===d&&110===B(w,3)?100:d){case 100:case 108:case 109:case 115:it(t,k,k,r&&O(at(t,k,k,0,0,i,o,_,i,x=[],u,v),v),i,v,u,o,r?x:v);break;default:it(w,k,k,k,[""],v,0,o,v)}}l=h=p=0,g=m=1,_=w="",u=s;break;case 58:u=1+D(w),p=f;default:if(g<1)if(123==b)--g;else if(125==b&&0==g++&&125==z())continue;switch(w+=T(b),b*g){case 38:m=h>0?1:(w+="\f",-1);break;case 44:o[l++]=(D(w)-1)*m,m=1;break;case 64:45===W()&&(w+=Q(U())),d=W(),h=u=D(_=w+=nt(H())),b++;break;case 45:45===f&&2==D(w)&&(g=0)}}return a}function at(t,e,n,r,i,a,s,o,c,l,h,u){for(var d=i-1,p=0===i?a:[""],f=function(t){return t.length}(p),g=0,y=0,m=0;g<r;++g)for(var b=0,_=N(t,d+1,d=E(y=s[g])),x=t;b<f;++b)(x=S(y>0?p[b]+" "+_:A(_,/&\f/g,p[b])))&&(c[m++]=x);return Y(t,e,n,0===i?w:o,c,l,h,u)}function st(t,e,n,r){return Y(t,e,n,k,T(P),N(t,2,-2),0,r)}function ot(t,e,n,r,i){return Y(t,e,n,C,N(t,0,r),N(t,r+1,-1),r,i)}var ct=n(86161),lt=n(88472),ht=n(76576);const ut=[];for(let c=0;c<256;++c)ut.push((c+256).toString(16).slice(1));function dt(t,e=0){return(ut[t[e+0]]+ut[t[e+1]]+ut[t[e+2]]+ut[t[e+3]]+"-"+ut[t[e+4]]+ut[t[e+5]]+"-"+ut[t[e+6]]+ut[t[e+7]]+"-"+ut[t[e+8]]+ut[t[e+9]]+"-"+ut[t[e+10]]+ut[t[e+11]]+ut[t[e+12]]+ut[t[e+13]]+ut[t[e+14]]+ut[t[e+15]]).toLowerCase()}const pt=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const ft=function(t){return"string"==typeof t&&pt.test(t)};const gt=function(t){if(!ft(t))throw TypeError("Invalid UUID");let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n};function yt(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function mt(t,e){return t<<e|t>>>32-e}const bt=function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const r=t.length/4+2,i=Math.ceil(r/16),a=new Array(i);for(let s=0;s<i;++s){const e=new Uint32Array(16);for(let n=0;n<16;++n)e[n]=t[64*s+4*n]<<24|t[64*s+4*n+1]<<16|t[64*s+4*n+2]<<8|t[64*s+4*n+3];a[s]=e}a[i-1][14]=8*(t.length-1)/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=8*(t.length-1)&4294967295;for(let s=0;s<i;++s){const t=new Uint32Array(80);for(let e=0;e<16;++e)t[e]=a[s][e];for(let e=16;e<80;++e)t[e]=mt(t[e-3]^t[e-8]^t[e-14]^t[e-16],1);let r=n[0],i=n[1],o=n[2],c=n[3],l=n[4];for(let n=0;n<80;++n){const a=Math.floor(n/20),s=mt(r,5)+yt(a,i,o,c)+l+e[a]+t[n]>>>0;l=c,c=o,o=mt(i,30)>>>0,i=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+o>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]},_t=function(t,e,n){function r(t,r,i,a){var s;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=gt(r)),16!==(null===(s=r)||void 0===s?void 0:s.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let o=new Uint8Array(16+t.length);if(o.set(r),o.set(t,r.length),o=n(o),o[6]=15&o[6]|e,o[8]=63&o[8]|128,i){a=a||0;for(let t=0;t<16;++t)i[a+t]=o[t];return i}return dt(o)}try{r.name=t}catch(i){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}("v5",80,bt),xt=_t;n(77567),n(36715);var vt=n(96157),kt=(n(13768),n(62945),n(57635)),wt=n.n(kt),Ct=n(69746),Et=n.n(Ct),Tt=n(79580),St=n.n(Tt),At=n(29955);const Lt={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},Bt={trace:(...t)=>{},debug:(...t)=>{},info:(...t)=>{},warn:(...t)=>{},error:(...t)=>{},fatal:(...t)=>{}},Nt=function(t="fatal"){let e=Lt.fatal;"string"==typeof t?(t=t.toLowerCase())in Lt&&(e=Lt[t]):"number"==typeof t&&(e=t),Bt.trace=()=>{},Bt.debug=()=>{},Bt.info=()=>{},Bt.warn=()=>{},Bt.error=()=>{},Bt.fatal=()=>{},e<=Lt.fatal&&(Bt.fatal=console.error?console.error.bind(console,Dt("FATAL"),"color: orange"):console.log.bind(console,"\x1b[35m",Dt("FATAL"))),e<=Lt.error&&(Bt.error=console.error?console.error.bind(console,Dt("ERROR"),"color: orange"):console.log.bind(console,"\x1b[31m",Dt("ERROR"))),e<=Lt.warn&&(Bt.warn=console.warn?console.warn.bind(console,Dt("WARN"),"color: orange"):console.log.bind(console,"\x1b[33m",Dt("WARN"))),e<=Lt.info&&(Bt.info=console.info?console.info.bind(console,Dt("INFO"),"color: lightblue"):console.log.bind(console,"\x1b[34m",Dt("INFO"))),e<=Lt.debug&&(Bt.debug=console.debug?console.debug.bind(console,Dt("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1b[32m",Dt("DEBUG"))),e<=Lt.trace&&(Bt.trace=console.debug?console.debug.bind(console,Dt("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1b[32m",Dt("TRACE")))},Dt=t=>`%c${a()().format("ss.SSS")} : ${t} : `,Ot=t=>h().sanitize(t),Mt=(t,e)=>{var n;if(!1!==(null==(n=e.flowchart)?void 0:n.htmlLabels)){const n=e.securityLevel;"antiscript"===n||"strict"===n?t=Ot(t):"loose"!==n&&(t=(t=(t=Rt(t)).replace(/</g,"<").replace(/>/g,">")).replace(/=/g,"="),t=$t(t))}return t},It=(t,e)=>t?t=e.dompurifyConfig?h().sanitize(Mt(t,e),e.dompurifyConfig).toString():h().sanitize(Mt(t,e),{FORBID_TAGS:["style"]}).toString():t,Ft=/<br\s*\/?>/gi,$t=t=>t.replace(/#br#/g,"<br/>"),Rt=t=>t.replace(Ft,"#br#"),Zt=t=>!1!==t&&!["false","null","0"].includes(String(t).trim().toLowerCase()),Pt=function(t){let e=t;if(t.split("~").length-1>=2){let t=e;do{e=t,t=e.replace(/~([^\s,:;]+)~/,"<$1>")}while(t!=e);return Pt(t)}return e},jt={getRows:t=>{if(!t)return[""];return Rt(t).replace(/\\n/g,"#br#").split("#br#")},sanitizeText:It,sanitizeTextOrArray:(t,e)=>"string"==typeof t?It(t,e):t.flat().map((t=>It(t,e))),hasBreaks:t=>Ft.test(t),splitBreaks:t=>t.split(Ft),lineBreakRegex:Ft,removeScript:Ot,getUrl:t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=e.replaceAll(/\(/g,"\\("),e=e.replaceAll(/\)/g,"\\)")),e},evaluate:Zt},Yt=(t,e)=>f(t,e?{s:-40,l:10}:{s:-40,l:-10}),zt="#ffffff",Ut="#f2f2f2";class Wt{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=(0,x.Z)(this.contrast,55),this.background="#ffffff",this.tertiaryColor=f(this.primaryColor,{h:-160}),this.primaryBorderColor=Yt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Yt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Yt(this.tertiaryColor,this.darkMode),this.primaryTextColor=b(this.primaryColor),this.secondaryTextColor=b(this.secondaryColor),this.tertiaryTextColor=b(this.tertiaryColor),this.lineColor=b(this.background),this.textColor=b(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=(0,x.Z)(this.contrast,55),this.border2=this.contrast,this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||b(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this.darkMode?this["cScalePeer"+t]=this["cScalePeer"+t]||(0,x.Z)(this["cScale"+t],10):this["cScalePeer"+t]=this["cScalePeer"+t]||(0,_.Z)(this["cScale"+t],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||f(this.mainBkg,{l:-(5+5*t)}),this["surfacePeer"+t]=this["surfacePeer"+t]||f(this.mainBkg,{l:-(8+5*t)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.actorBorder=(0,x.Z)(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.lineColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.sectionBkgColor=(0,x.Z)(this.contrast,30),this.sectionBkgColor2=(0,x.Z)(this.contrast,30),this.taskBorderColor=(0,_.Z)(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=(0,x.Z)(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=(0,_.Z)(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=f(this.primaryColor,{h:64}),this.fillType3=f(this.secondaryColor,{h:64}),this.fillType4=f(this.primaryColor,{h:-64}),this.fillType5=f(this.secondaryColor,{h:-64}),this.fillType6=f(this.primaryColor,{h:128}),this.fillType7=f(this.secondaryColor,{h:128});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=(0,_.Z)(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||f(this.primaryColor,{h:-30}),this.git4=this.pie5||f(this.primaryColor,{h:-60}),this.git5=this.pie6||f(this.primaryColor,{h:-90}),this.git6=this.pie7||f(this.primaryColor,{h:60}),this.git7=this.pie8||f(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||b(this.git0),this.gitInv1=this.gitInv1||b(this.git1),this.gitInv2=this.gitInv2||b(this.git2),this.gitInv3=this.gitInv3||b(this.git3),this.gitInv4=this.gitInv4||b(this.git4),this.gitInv5=this.gitInv5||b(this.git5),this.gitInv6=this.gitInv6||b(this.git6),this.gitInv7=this.gitInv7||b(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||zt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ut}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}}const Ht={base:{getThemeVariables:t=>{const e=new class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||f(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||f(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Yt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Yt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Yt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Yt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||b(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||b(this.tertiaryColor),this.lineColor=this.lineColor||b(this.background),this.textColor=this.textColor||this.primaryTextColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?(0,_.Z)(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||"grey",this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||(0,_.Z)(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||b(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||(0,x.Z)(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||f(this.primaryColor,{h:30}),this.cScale4=this.cScale4||f(this.primaryColor,{h:60}),this.cScale5=this.cScale5||f(this.primaryColor,{h:90}),this.cScale6=this.cScale6||f(this.primaryColor,{h:120}),this.cScale7=this.cScale7||f(this.primaryColor,{h:150}),this.cScale8=this.cScale8||f(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||f(this.primaryColor,{h:270}),this.cScale10=this.cScale10||f(this.primaryColor,{h:300}),this.cScale11=this.cScale11||f(this.primaryColor,{h:330}),this.darkMode)for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScale"+e]=(0,_.Z)(this["cScale"+e],75);else for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScale"+e]=(0,_.Z)(this["cScale"+e],25);for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScaleInv"+e]=this["cScaleInv"+e]||b(this["cScale"+e]);for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this.darkMode?this["cScalePeer"+e]=this["cScalePeer"+e]||(0,x.Z)(this["cScale"+e],10):this["cScalePeer"+e]=this["cScalePeer"+e]||(0,_.Z)(this["cScale"+e],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let e=0;e<this.THEME_COLOR_LIMIT;e++)this["cScaleLabel"+e]=this["cScaleLabel"+e]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let e=0;e<5;e++)this["surface"+e]=this["surface"+e]||f(this.mainBkg,{h:180,s:-15,l:t*(5+3*e)}),this["surfacePeer"+e]=this["surfacePeer"+e]||f(this.mainBkg,{h:180,s:-15,l:t*(8+3*e)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||f(this.primaryColor,{h:64}),this.fillType3=this.fillType3||f(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||f(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||f(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||f(this.primaryColor,{h:128}),this.fillType7=this.fillType7||f(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||f(this.primaryColor,{l:-10}),this.pie5=this.pie5||f(this.secondaryColor,{l:-10}),this.pie6=this.pie6||f(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||f(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||f(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||f(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||f(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||f(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||f(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?(0,_.Z)(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||f(this.primaryColor,{h:-30}),this.git4=this.git4||f(this.primaryColor,{h:-60}),this.git5=this.git5||f(this.primaryColor,{h:-90}),this.git6=this.git6||f(this.primaryColor,{h:60}),this.git7=this.git7||f(this.primaryColor,{h:120}),this.darkMode?(this.git0=(0,x.Z)(this.git0,25),this.git1=(0,x.Z)(this.git1,25),this.git2=(0,x.Z)(this.git2,25),this.git3=(0,x.Z)(this.git3,25),this.git4=(0,x.Z)(this.git4,25),this.git5=(0,x.Z)(this.git5,25),this.git6=(0,x.Z)(this.git6,25),this.git7=(0,x.Z)(this.git7,25)):(this.git0=(0,_.Z)(this.git0,25),this.git1=(0,_.Z)(this.git1,25),this.git2=(0,_.Z)(this.git2,25),this.git3=(0,_.Z)(this.git3,25),this.git4=(0,_.Z)(this.git4,25),this.git5=(0,_.Z)(this.git5,25),this.git6=(0,_.Z)(this.git6,25),this.git7=(0,_.Z)(this.git7,25)),this.gitInv0=this.gitInv0||b(this.git0),this.gitInv1=this.gitInv1||b(this.git1),this.gitInv2=this.gitInv2||b(this.git2),this.gitInv3=this.gitInv3||b(this.git3),this.gitInv4=this.gitInv4||b(this.git4),this.gitInv5=this.gitInv5||b(this.git5),this.gitInv6=this.gitInv6||b(this.git6),this.gitInv7=this.gitInv7||b(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||zt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ut}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}};return e.calculate(t),e}},dark:{getThemeVariables:t=>{const e=new class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=(0,x.Z)(this.primaryColor,16),this.tertiaryColor=f(this.primaryColor,{h:-160}),this.primaryBorderColor=b(this.background),this.secondaryBorderColor=Yt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Yt(this.tertiaryColor,this.darkMode),this.primaryTextColor=b(this.primaryColor),this.secondaryTextColor=b(this.secondaryColor),this.tertiaryTextColor=b(this.tertiaryColor),this.lineColor=b(this.background),this.textColor=b(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=(0,x.Z)(b("#323D47"),10),this.lineColor="calculated",this.border1="#81B1DB",this.border2=y(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=(0,_.Z)("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.taskBorderColor=y(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=y(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=(0,x.Z)(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=(0,x.Z)(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.mainContrastColor,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=(0,x.Z)(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=f(this.primaryColor,{h:64}),this.fillType3=f(this.secondaryColor,{h:64}),this.fillType4=f(this.primaryColor,{h:-64}),this.fillType5=f(this.secondaryColor,{h:-64}),this.fillType6=f(this.primaryColor,{h:128}),this.fillType7=f(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||f(this.primaryColor,{h:30}),this.cScale4=this.cScale4||f(this.primaryColor,{h:60}),this.cScale5=this.cScale5||f(this.primaryColor,{h:90}),this.cScale6=this.cScale6||f(this.primaryColor,{h:120}),this.cScale7=this.cScale7||f(this.primaryColor,{h:150}),this.cScale8=this.cScale8||f(this.primaryColor,{h:210}),this.cScale9=this.cScale9||f(this.primaryColor,{h:270}),this.cScale10=this.cScale10||f(this.primaryColor,{h:300}),this.cScale11=this.cScale11||f(this.primaryColor,{h:330});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||b(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScalePeer"+t]=this["cScalePeer"+t]||(0,x.Z)(this["cScale"+t],10);for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||f(this.mainBkg,{h:30,s:-30,l:-(4*t-10)}),this["surfacePeer"+t]=this["surfacePeer"+t]||f(this.mainBkg,{h:30,s:-30,l:-(4*t-7)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?(0,_.Z)(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=(0,x.Z)(this.secondaryColor,20),this.git1=(0,x.Z)(this.pie2||this.secondaryColor,20),this.git2=(0,x.Z)(this.pie3||this.tertiaryColor,20),this.git3=(0,x.Z)(this.pie4||f(this.primaryColor,{h:-30}),20),this.git4=(0,x.Z)(this.pie5||f(this.primaryColor,{h:-60}),20),this.git5=(0,x.Z)(this.pie6||f(this.primaryColor,{h:-90}),10),this.git6=(0,x.Z)(this.pie7||f(this.primaryColor,{h:60}),10),this.git7=(0,x.Z)(this.pie8||f(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||b(this.git0),this.gitInv1=this.gitInv1||b(this.git1),this.gitInv2=this.gitInv2||b(this.git2),this.gitInv3=this.gitInv3||b(this.git3),this.gitInv4=this.gitInv4||b(this.git4),this.gitInv5=this.gitInv5||b(this.git5),this.gitInv6=this.gitInv6||b(this.git6),this.gitInv7=this.gitInv7||b(this.git7),this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||(0,x.Z)(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||(0,x.Z)(this.background,2)}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}};return e.calculate(t),e}},default:{getThemeVariables:t=>{const e=new class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=f(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=f(this.primaryColor,{h:-160}),this.primaryBorderColor=Yt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Yt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Yt(this.tertiaryColor,this.darkMode),this.primaryTextColor=b(this.primaryColor),this.secondaryTextColor=b(this.secondaryColor),this.tertiaryTextColor=b(this.tertiaryColor),this.lineColor=b(this.background),this.textColor=b(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#e8e8e8",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="grey",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.sectionBkgColor=y(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||f(this.primaryColor,{h:30}),this.cScale4=this.cScale4||f(this.primaryColor,{h:60}),this.cScale5=this.cScale5||f(this.primaryColor,{h:90}),this.cScale6=this.cScale6||f(this.primaryColor,{h:120}),this.cScale7=this.cScale7||f(this.primaryColor,{h:150}),this.cScale8=this.cScale8||f(this.primaryColor,{h:210}),this.cScale9=this.cScale9||f(this.primaryColor,{h:270}),this.cScale10=this.cScale10||f(this.primaryColor,{h:300}),this.cScale11=this.cScale11||f(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||(0,_.Z)(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||(0,_.Z)(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=(0,_.Z)(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||(0,_.Z)(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||f(this["cScale"+t],{h:180});for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||f(this.mainBkg,{h:30,l:-(5+5*t)}),this["surfacePeer"+t]=this["surfacePeer"+t]||f(this.mainBkg,{h:30,l:-(7+5*t)});if(this.scaleLabelColor="calculated"!==this.scaleLabelColor&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,"calculated"!==this.labelTextColor){this.cScaleLabel0=this.cScaleLabel0||b(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||b(this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=(0,x.Z)(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=f(this.primaryColor,{h:64}),this.fillType3=f(this.secondaryColor,{h:64}),this.fillType4=f(this.primaryColor,{h:-64}),this.fillType5=f(this.secondaryColor,{h:-64}),this.fillType6=f(this.primaryColor,{h:128}),this.fillType7=f(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||f(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||f(this.primaryColor,{l:-10}),this.pie5=this.pie5||f(this.secondaryColor,{l:-30}),this.pie6=this.pie6||f(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||f(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||f(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||f(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||f(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||f(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||f(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||f(this.primaryColor,{h:-30}),this.git4=this.git4||f(this.primaryColor,{h:-60}),this.git5=this.git5||f(this.primaryColor,{h:-90}),this.git6=this.git6||f(this.primaryColor,{h:60}),this.git7=this.git7||f(this.primaryColor,{h:120}),this.darkMode?(this.git0=(0,x.Z)(this.git0,25),this.git1=(0,x.Z)(this.git1,25),this.git2=(0,x.Z)(this.git2,25),this.git3=(0,x.Z)(this.git3,25),this.git4=(0,x.Z)(this.git4,25),this.git5=(0,x.Z)(this.git5,25),this.git6=(0,x.Z)(this.git6,25),this.git7=(0,x.Z)(this.git7,25)):(this.git0=(0,_.Z)(this.git0,25),this.git1=(0,_.Z)(this.git1,25),this.git2=(0,_.Z)(this.git2,25),this.git3=(0,_.Z)(this.git3,25),this.git4=(0,_.Z)(this.git4,25),this.git5=(0,_.Z)(this.git5,25),this.git6=(0,_.Z)(this.git6,25),this.git7=(0,_.Z)(this.git7,25)),this.gitInv0=this.gitInv0||(0,_.Z)(b(this.git0),25),this.gitInv1=this.gitInv1||b(this.git1),this.gitInv2=this.gitInv2||b(this.git2),this.gitInv3=this.gitInv3||b(this.git3),this.gitInv4=this.gitInv4||b(this.git4),this.gitInv5=this.gitInv5||b(this.git5),this.gitInv6=this.gitInv6||b(this.git6),this.gitInv7=this.gitInv7||b(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||b(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||b(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||zt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ut}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}};return e.calculate(t),e}},forest:{getThemeVariables:t=>{const e=new class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=(0,x.Z)("#cde498",10),this.primaryBorderColor=Yt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Yt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Yt(this.tertiaryColor,this.darkMode),this.primaryTextColor=b(this.primaryColor),this.secondaryTextColor=b(this.secondaryColor),this.tertiaryTextColor=b(this.primaryColor),this.lineColor=b(this.background),this.textColor=b(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="grey",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder="calculated",this.personBkg="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||f(this.primaryColor,{h:30}),this.cScale4=this.cScale4||f(this.primaryColor,{h:60}),this.cScale5=this.cScale5||f(this.primaryColor,{h:90}),this.cScale6=this.cScale6||f(this.primaryColor,{h:120}),this.cScale7=this.cScale7||f(this.primaryColor,{h:150}),this.cScale8=this.cScale8||f(this.primaryColor,{h:210}),this.cScale9=this.cScale9||f(this.primaryColor,{h:270}),this.cScale10=this.cScale10||f(this.primaryColor,{h:300}),this.cScale11=this.cScale11||f(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||(0,_.Z)(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||(0,_.Z)(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=(0,_.Z)(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||(0,_.Z)(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||f(this["cScale"+t],{h:180});this.scaleLabelColor="calculated"!==this.scaleLabelColor&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||f(this.mainBkg,{h:30,s:-30,l:-(5+5*t)}),this["surfacePeer"+t]=this["surfacePeer"+t]||f(this.mainBkg,{h:30,s:-30,l:-(8+5*t)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.actorBorder=(0,_.Z)(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=f(this.primaryColor,{h:64}),this.fillType3=f(this.secondaryColor,{h:64}),this.fillType4=f(this.primaryColor,{h:-64}),this.fillType5=f(this.secondaryColor,{h:-64}),this.fillType6=f(this.primaryColor,{h:128}),this.fillType7=f(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||f(this.primaryColor,{l:-30}),this.pie5=this.pie5||f(this.secondaryColor,{l:-30}),this.pie6=this.pie6||f(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||f(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||f(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||f(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||f(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||f(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||f(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOpacity=this.pieOpacity||"0.7",this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||this.primaryBorderColor,this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||f(this.primaryColor,{h:-30}),this.git4=this.git4||f(this.primaryColor,{h:-60}),this.git5=this.git5||f(this.primaryColor,{h:-90}),this.git6=this.git6||f(this.primaryColor,{h:60}),this.git7=this.git7||f(this.primaryColor,{h:120}),this.darkMode?(this.git0=(0,x.Z)(this.git0,25),this.git1=(0,x.Z)(this.git1,25),this.git2=(0,x.Z)(this.git2,25),this.git3=(0,x.Z)(this.git3,25),this.git4=(0,x.Z)(this.git4,25),this.git5=(0,x.Z)(this.git5,25),this.git6=(0,x.Z)(this.git6,25),this.git7=(0,x.Z)(this.git7,25)):(this.git0=(0,_.Z)(this.git0,25),this.git1=(0,_.Z)(this.git1,25),this.git2=(0,_.Z)(this.git2,25),this.git3=(0,_.Z)(this.git3,25),this.git4=(0,_.Z)(this.git4,25),this.git5=(0,_.Z)(this.git5,25),this.git6=(0,_.Z)(this.git6,25),this.git7=(0,_.Z)(this.git7,25)),this.gitInv0=this.gitInv0||b(this.git0),this.gitInv1=this.gitInv1||b(this.git1),this.gitInv2=this.gitInv2||b(this.git2),this.gitInv3=this.gitInv3||b(this.git3),this.gitInv4=this.gitInv4||b(this.git4),this.gitInv5=this.gitInv5||b(this.git5),this.gitInv6=this.gitInv6||b(this.git6),this.gitInv7=this.gitInv7||b(this.git7),this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||zt,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Ut}calculate(t){if("object"!=typeof t)return void this.updateColors();const e=Object.keys(t);e.forEach((e=>{this[e]=t[e]})),this.updateColors(),e.forEach((e=>{this[e]=t[e]}))}};return e.calculate(t),e}},neutral:{getThemeVariables:t=>{const e=new Wt;return e.calculate(t),e}}},qt={theme:"default",themeVariables:Ht.default.getThemeVariables(),themeCSS:void 0,maxTextSize:5e4,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize"],deterministicIds:!1,deterministicIDSeed:void 0,flowchart:{titleTopMargin:25,diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,useMaxWidth:!0,defaultRenderer:"dagre-wrapper"},sequence:{hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20,messageFont:function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},noteFont:function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},actorFont:function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}}},gantt:{titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",tickInterval:void 0,useMaxWidth:!0,topAxis:!1,useWidth:void 0},journey:{diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"]},timeline:{diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},class:{titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,useMaxWidth:!0,defaultRenderer:"dagre-wrapper"},state:{titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,useMaxWidth:!0,defaultRenderer:"dagre-wrapper"},er:{titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,stroke:"gray",fill:"honeydew",fontSize:12,useMaxWidth:!0},pie:{useWidth:void 0,useMaxWidth:!0},requirement:{useWidth:void 0,useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},gitGraph:{titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0},c4:{useWidth:void 0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,useMaxWidth:!0,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,personFont:function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},external_personFont:function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},systemFont:function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},external_systemFont:function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},system_dbFont:function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},external_system_dbFont:function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},system_queueFont:function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},external_system_queueFont:function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},containerFont:function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},external_containerFont:function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},container_dbFont:function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},external_container_dbFont:function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},container_queueFont:function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},external_container_queueFont:function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},componentFont:function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},external_componentFont:function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},component_dbFont:function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},external_component_dbFont:function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},component_queueFont:function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},external_component_queueFont:function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},boundaryFont:function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},messageFont:function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200},fontSize:16};qt.class&&(qt.class.arrowMarkerAbsolute=qt.arrowMarkerAbsolute),qt.gitGraph&&(qt.gitGraph.arrowMarkerAbsolute=qt.arrowMarkerAbsolute);const Vt=(t,e="")=>Object.keys(t).reduce(((n,r)=>Array.isArray(t[r])?n:"object"==typeof t[r]&&null!==t[r]?[...n,e+r,...Vt(t[r],"")]:[...n,e+r]),[]),Gt=Vt(qt,""),Xt=qt;function Qt(t){return null==t}var Kt={isNothing:Qt,isObject:function(t){return"object"==typeof t&&null!==t},toArray:function(t){return Array.isArray(t)?t:Qt(t)?[]:[t]},repeat:function(t,e){var n,r="";for(n=0;n<e;n+=1)r+=t;return r},isNegativeZero:function(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t},extend:function(t,e){var n,r,i,a;if(e)for(n=0,r=(a=Object.keys(e)).length;n<r;n+=1)t[i=a[n]]=e[i];return t}};function Jt(t,e){var n="",r=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(n+='in "'+t.mark.name+'" '),n+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(n+="\n\n"+t.mark.snippet),r+" "+n):r}function te(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=Jt(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}te.prototype=Object.create(Error.prototype),te.prototype.constructor=te,te.prototype.toString=function(t){return this.name+": "+Jt(this,t)};var ee=te;function ne(t,e,n,r,i){var a="",s="",o=Math.floor(i/2)-1;return r-e>o&&(e=r-o+(a=" ... ").length),n-r>o&&(n=r+o-(s=" ...").length),{str:a+t.slice(e,n).replace(/\t/g,"\u2192")+s,pos:r-e+a.length}}function re(t,e){return Kt.repeat(" ",e-t.length)+t}var ie=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var n,r=/\r?\n|\r|\0/g,i=[0],a=[],s=-1;n=r.exec(t.buffer);)a.push(n.index),i.push(n.index+n[0].length),t.position<=n.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var o,c,l="",h=Math.min(t.line+e.linesAfter,a.length).toString().length,u=e.maxLength-(e.indent+h+3);for(o=1;o<=e.linesBefore&&!(s-o<0);o++)c=ne(t.buffer,i[s-o],a[s-o],t.position-(i[s]-i[s-o]),u),l=Kt.repeat(" ",e.indent)+re((t.line-o+1).toString(),h)+" | "+c.str+"\n"+l;for(c=ne(t.buffer,i[s],a[s],t.position,u),l+=Kt.repeat(" ",e.indent)+re((t.line+1).toString(),h)+" | "+c.str+"\n",l+=Kt.repeat("-",e.indent+h+3+c.pos)+"^\n",o=1;o<=e.linesAfter&&!(s+o>=a.length);o++)c=ne(t.buffer,i[s+o],a[s+o],t.position-(i[s]-i[s+o]),u),l+=Kt.repeat(" ",e.indent)+re((t.line+o+1).toString(),h)+" | "+c.str+"\n";return l.replace(/\n$/,"")},ae=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],se=["scalar","sequence","mapping"];var oe=function(t,e){var n,r;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===ae.indexOf(e))throw new ee('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=(n=e.styleAliases||null,r={},null!==n&&Object.keys(n).forEach((function(t){n[t].forEach((function(e){r[String(e)]=t}))})),r),-1===se.indexOf(this.kind))throw new ee('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function ce(t,e){var n=[];return t[e].forEach((function(t){var e=n.length;n.forEach((function(n,r){n.tag===t.tag&&n.kind===t.kind&&n.multi===t.multi&&(e=r)})),n[e]=t})),n}function le(t){return this.extend(t)}le.prototype.extend=function(t){var e=[],n=[];if(t instanceof oe)n.push(t);else if(Array.isArray(t))n=n.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new ee("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof oe))throw new ee("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new ee("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new ee("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(t){if(!(t instanceof oe))throw new ee("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var r=Object.create(le.prototype);return r.implicit=(this.implicit||[]).concat(e),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=ce(r,"implicit"),r.compiledExplicit=ce(r,"explicit"),r.compiledTypeMap=function(){var t,e,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function r(t){t.multi?(n.multi[t.kind].push(t),n.multi.fallback.push(t)):n[t.kind][t.tag]=n.fallback[t.tag]=t}for(t=0,e=arguments.length;t<e;t+=1)arguments[t].forEach(r);return n}(r.compiledImplicit,r.compiledExplicit),r};var he=new le({explicit:[new oe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}}),new oe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}}),new oe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}})]});var ue=new oe("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)},construct:function(){return null},predicate:function(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var de=new oe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)},construct:function(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function pe(t){return 48<=t&&t<=55}function fe(t){return 48<=t&&t<=57}var ge=new oe("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,r=t.length,i=0,a=!1;if(!r)return!1;if("-"!==(e=t[i])&&"+"!==e||(e=t[++i]),"0"===e){if(i+1===r)return!0;if("b"===(e=t[++i])){for(i++;i<r;i++)if("_"!==(e=t[i])){if("0"!==e&&"1"!==e)return!1;a=!0}return a&&"_"!==e}if("x"===e){for(i++;i<r;i++)if("_"!==(e=t[i])){if(!(48<=(n=t.charCodeAt(i))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;a=!0}return a&&"_"!==e}if("o"===e){for(i++;i<r;i++)if("_"!==(e=t[i])){if(!pe(t.charCodeAt(i)))return!1;a=!0}return a&&"_"!==e}}if("_"===e)return!1;for(;i<r;i++)if("_"!==(e=t[i])){if(!fe(t.charCodeAt(i)))return!1;a=!0}return!(!a||"_"===e)},construct:function(t){var e,n=t,r=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(e=n[0])&&"+"!==e||("-"===e&&(r=-1),e=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===e){if("b"===n[1])return r*parseInt(n.slice(2),2);if("x"===n[1])return r*parseInt(n.slice(2),16);if("o"===n[1])return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!Kt.isNegativeZero(t)},represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),ye=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var me=/^[-+]?[0-9]+e/;var be=new oe("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!ye.test(t)||"_"===t[t.length-1])},construct:function(t){var e,n;return n="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:n*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||Kt.isNegativeZero(t))},represent:function(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Kt.isNegativeZero(t))return"-0.0";return n=t.toString(10),me.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),_e=he.extend({implicit:[ue,de,ge,be]}),xe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ve=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var ke=new oe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==xe.exec(t)||null!==ve.exec(t))},construct:function(t){var e,n,r,i,a,s,o,c,l=0,h=null;if(null===(e=xe.exec(t))&&(e=ve.exec(t)),null===e)throw new Error("Date resolve error");if(n=+e[1],r=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(n,r,i));if(a=+e[4],s=+e[5],o=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(h=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(h=-h)),c=new Date(Date.UTC(n,r,i,a,s,o,l)),h&&c.setTime(c.getTime()-h),c},instanceOf:Date,represent:function(t){return t.toISOString()}});var we=new oe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Ee=new oe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,r=0,i=t.length,a=Ce;for(n=0;n<i;n++)if(!((e=a.indexOf(t.charAt(n)))>64)){if(e<0)return!1;r+=6}return r%8==0},construct:function(t){var e,n,r=t.replace(/[\r\n=]/g,""),i=r.length,a=Ce,s=0,o=[];for(e=0;e<i;e++)e%4==0&&e&&(o.push(s>>16&255),o.push(s>>8&255),o.push(255&s)),s=s<<6|a.indexOf(r.charAt(e));return 0===(n=i%4*6)?(o.push(s>>16&255),o.push(s>>8&255),o.push(255&s)):18===n?(o.push(s>>10&255),o.push(s>>2&255)):12===n&&o.push(s>>4&255),new Uint8Array(o)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,n,r="",i=0,a=t.length,s=Ce;for(e=0;e<a;e++)e%3==0&&e&&(r+=s[i>>18&63],r+=s[i>>12&63],r+=s[i>>6&63],r+=s[63&i]),i=(i<<8)+t[e];return 0===(n=a%3)?(r+=s[i>>18&63],r+=s[i>>12&63],r+=s[i>>6&63],r+=s[63&i]):2===n?(r+=s[i>>10&63],r+=s[i>>4&63],r+=s[i<<2&63],r+=s[64]):1===n&&(r+=s[i>>2&63],r+=s[i<<4&63],r+=s[64],r+=s[64]),r}}),Te=Object.prototype.hasOwnProperty,Se=Object.prototype.toString;var Ae=new oe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,r,i,a,s=[],o=t;for(e=0,n=o.length;e<n;e+=1){if(r=o[e],a=!1,"[object Object]"!==Se.call(r))return!1;for(i in r)if(Te.call(r,i)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==s.indexOf(i))return!1;s.push(i)}return!0},construct:function(t){return null!==t?t:[]}}),Le=Object.prototype.toString;var Be=new oe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,r,i,a,s=t;for(a=new Array(s.length),e=0,n=s.length;e<n;e+=1){if(r=s[e],"[object Object]"!==Le.call(r))return!1;if(1!==(i=Object.keys(r)).length)return!1;a[e]=[i[0],r[i[0]]]}return!0},construct:function(t){if(null===t)return[];var e,n,r,i,a,s=t;for(a=new Array(s.length),e=0,n=s.length;e<n;e+=1)r=s[e],i=Object.keys(r),a[e]=[i[0],r[i[0]]];return a}}),Ne=Object.prototype.hasOwnProperty;var De=new oe("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(t){if(null===t)return!0;var e,n=t;for(e in n)if(Ne.call(n,e)&&null!==n[e])return!1;return!0},construct:function(t){return null!==t?t:{}}}),Oe=_e.extend({implicit:[ke,we],explicit:[Ee,Ae,Be,De]}),Me=Object.prototype.hasOwnProperty,Ie=1,Fe=2,$e=3,Re=4,Ze=1,Pe=2,je=3,Ye=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ze=/[\x85\u2028\u2029]/,Ue=/[,\[\]\{\}]/,We=/^(?:!|!!|![a-z\-]+!)$/i,He=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function qe(t){return Object.prototype.toString.call(t)}function Ve(t){return 10===t||13===t}function Ge(t){return 9===t||32===t}function Xe(t){return 9===t||32===t||10===t||13===t}function Qe(t){return 44===t||91===t||93===t||123===t||125===t}function Ke(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function Je(t){return 48===t?"\0":97===t?"\x07":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"\x1b":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"\x85":95===t?"\xa0":76===t?"\u2028":80===t?"\u2029":""}function tn(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var en=new Array(256),nn=new Array(256),rn=0;rn<256;rn++)en[rn]=Je(rn)?1:0,nn[rn]=Je(rn);function an(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Oe,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function sn(t,e){var n={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return n.snippet=ie(n),new ee(e,n)}function on(t,e){throw sn(t,e)}function cn(t,e){t.onWarning&&t.onWarning.call(null,sn(t,e))}var ln={YAML:function(t,e,n){var r,i,a;null!==t.version&&on(t,"duplication of %YAML directive"),1!==n.length&&on(t,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&on(t,"ill-formed argument of the YAML directive"),i=parseInt(r[1],10),a=parseInt(r[2],10),1!==i&&on(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,1!==a&&2!==a&&cn(t,"unsupported YAML version of the document")},TAG:function(t,e,n){var r,i;2!==n.length&&on(t,"TAG directive accepts exactly two arguments"),r=n[0],i=n[1],We.test(r)||on(t,"ill-formed tag handle (first argument) of the TAG directive"),Me.call(t.tagMap,r)&&on(t,'there is a previously declared suffix for "'+r+'" tag handle'),He.test(i)||on(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(a){on(t,"tag prefix is malformed: "+i)}t.tagMap[r]=i}};function hn(t,e,n,r){var i,a,s,o;if(e<n){if(o=t.input.slice(e,n),r)for(i=0,a=o.length;i<a;i+=1)9===(s=o.charCodeAt(i))||32<=s&&s<=1114111||on(t,"expected valid JSON character");else Ye.test(o)&&on(t,"the stream contains non-printable characters");t.result+=o}}function un(t,e,n,r){var i,a,s,o;for(Kt.isObject(n)||on(t,"cannot merge mappings; the provided source object is unacceptable"),s=0,o=(i=Object.keys(n)).length;s<o;s+=1)a=i[s],Me.call(e,a)||(e[a]=n[a],r[a]=!0)}function dn(t,e,n,r,i,a,s,o,c){var l,h;if(Array.isArray(i))for(l=0,h=(i=Array.prototype.slice.call(i)).length;l<h;l+=1)Array.isArray(i[l])&&on(t,"nested arrays are not supported inside keys"),"object"==typeof i&&"[object Object]"===qe(i[l])&&(i[l]="[object Object]");if("object"==typeof i&&"[object Object]"===qe(i)&&(i="[object Object]"),i=String(i),null===e&&(e={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(a))for(l=0,h=a.length;l<h;l+=1)un(t,e,a[l],n);else un(t,e,a,n);else t.json||Me.call(n,i)||!Me.call(e,i)||(t.line=s||t.line,t.lineStart=o||t.lineStart,t.position=c||t.position,on(t,"duplicated mapping key")),"__proto__"===i?Object.defineProperty(e,i,{configurable:!0,enumerable:!0,writable:!0,value:a}):e[i]=a,delete n[i];return e}function pn(t){var e;10===(e=t.input.charCodeAt(t.position))?t.position++:13===e?(t.position++,10===t.input.charCodeAt(t.position)&&t.position++):on(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function fn(t,e,n){for(var r=0,i=t.input.charCodeAt(t.position);0!==i;){for(;Ge(i);)9===i&&-1===t.firstTabInLine&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&35===i)do{i=t.input.charCodeAt(++t.position)}while(10!==i&&13!==i&&0!==i);if(!Ve(i))break;for(pn(t),i=t.input.charCodeAt(t.position),r++,t.lineIndent=0;32===i;)t.lineIndent++,i=t.input.charCodeAt(++t.position)}return-1!==n&&0!==r&&t.lineIndent<n&&cn(t,"deficient indentation"),r}function gn(t){var e,n=t.position;return!(45!==(e=t.input.charCodeAt(n))&&46!==e||e!==t.input.charCodeAt(n+1)||e!==t.input.charCodeAt(n+2)||(n+=3,0!==(e=t.input.charCodeAt(n))&&!Xe(e)))}function yn(t,e){1===e?t.result+=" ":e>1&&(t.result+=Kt.repeat("\n",e-1))}function mn(t,e){var n,r,i=t.tag,a=t.anchor,s=[],o=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=s),r=t.input.charCodeAt(t.position);0!==r&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,on(t,"tab characters must not be used in indentation")),45===r)&&Xe(t.input.charCodeAt(t.position+1));)if(o=!0,t.position++,fn(t,!0,-1)&&t.lineIndent<=e)s.push(null),r=t.input.charCodeAt(t.position);else if(n=t.line,xn(t,e,$e,!1,!0),s.push(t.result),fn(t,!0,-1),r=t.input.charCodeAt(t.position),(t.line===n||t.lineIndent>e)&&0!==r)on(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break;return!!o&&(t.tag=i,t.anchor=a,t.kind="sequence",t.result=s,!0)}function bn(t){var e,n,r,i,a=!1,s=!1;if(33!==(i=t.input.charCodeAt(t.position)))return!1;if(null!==t.tag&&on(t,"duplication of a tag property"),60===(i=t.input.charCodeAt(++t.position))?(a=!0,i=t.input.charCodeAt(++t.position)):33===i?(s=!0,n="!!",i=t.input.charCodeAt(++t.position)):n="!",e=t.position,a){do{i=t.input.charCodeAt(++t.position)}while(0!==i&&62!==i);t.position<t.length?(r=t.input.slice(e,t.position),i=t.input.charCodeAt(++t.position)):on(t,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!Xe(i);)33===i&&(s?on(t,"tag suffix cannot contain exclamation marks"):(n=t.input.slice(e-1,t.position+1),We.test(n)||on(t,"named tag handle cannot contain such characters"),s=!0,e=t.position+1)),i=t.input.charCodeAt(++t.position);r=t.input.slice(e,t.position),Ue.test(r)&&on(t,"tag suffix cannot contain flow indicator characters")}r&&!He.test(r)&&on(t,"tag name cannot contain such characters: "+r);try{r=decodeURIComponent(r)}catch(o){on(t,"tag name is malformed: "+r)}return a?t.tag=r:Me.call(t.tagMap,n)?t.tag=t.tagMap[n]+r:"!"===n?t.tag="!"+r:"!!"===n?t.tag="tag:yaml.org,2002:"+r:on(t,'undeclared tag handle "'+n+'"'),!0}function _n(t){var e,n;if(38!==(n=t.input.charCodeAt(t.position)))return!1;for(null!==t.anchor&&on(t,"duplication of an anchor property"),n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!Xe(n)&&!Qe(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&on(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function xn(t,e,n,r,i){var a,s,o,c,l,h,u,d,p,f=1,g=!1,y=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=s=o=Re===n||$e===n,r&&fn(t,!0,-1)&&(g=!0,t.lineIndent>e?f=1:t.lineIndent===e?f=0:t.lineIndent<e&&(f=-1)),1===f)for(;bn(t)||_n(t);)fn(t,!0,-1)?(g=!0,o=a,t.lineIndent>e?f=1:t.lineIndent===e?f=0:t.lineIndent<e&&(f=-1)):o=!1;if(o&&(o=g||i),1!==f&&Re!==n||(d=Ie===n||Fe===n?e:e+1,p=t.position-t.lineStart,1===f?o&&(mn(t,p)||function(t,e,n){var r,i,a,s,o,c,l,h=t.tag,u=t.anchor,d={},p=Object.create(null),f=null,g=null,y=null,m=!1,b=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=d),l=t.input.charCodeAt(t.position);0!==l;){if(m||-1===t.firstTabInLine||(t.position=t.firstTabInLine,on(t,"tab characters must not be used in indentation")),r=t.input.charCodeAt(t.position+1),a=t.line,63!==l&&58!==l||!Xe(r)){if(s=t.line,o=t.lineStart,c=t.position,!xn(t,n,Fe,!1,!0))break;if(t.line===a){for(l=t.input.charCodeAt(t.position);Ge(l);)l=t.input.charCodeAt(++t.position);if(58===l)Xe(l=t.input.charCodeAt(++t.position))||on(t,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(dn(t,d,p,f,g,null,s,o,c),f=g=y=null),b=!0,m=!1,i=!1,f=t.tag,g=t.result;else{if(!b)return t.tag=h,t.anchor=u,!0;on(t,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return t.tag=h,t.anchor=u,!0;on(t,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(m&&(dn(t,d,p,f,g,null,s,o,c),f=g=y=null),b=!0,m=!0,i=!0):m?(m=!1,i=!0):on(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,l=r;if((t.line===a||t.lineIndent>e)&&(m&&(s=t.line,o=t.lineStart,c=t.position),xn(t,e,Re,!0,i)&&(m?g=t.result:y=t.result),m||(dn(t,d,p,f,g,y,s,o,c),f=g=y=null),fn(t,!0,-1),l=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&0!==l)on(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return m&&dn(t,d,p,f,g,null,s,o,c),b&&(t.tag=h,t.anchor=u,t.kind="mapping",t.result=d),b}(t,p,d))||function(t,e){var n,r,i,a,s,o,c,l,h,u,d,p,f=!0,g=t.tag,y=t.anchor,m=Object.create(null);if(91===(p=t.input.charCodeAt(t.position)))s=93,l=!1,a=[];else{if(123!==p)return!1;s=125,l=!0,a={}}for(null!==t.anchor&&(t.anchorMap[t.anchor]=a),p=t.input.charCodeAt(++t.position);0!==p;){if(fn(t,!0,e),(p=t.input.charCodeAt(t.position))===s)return t.position++,t.tag=g,t.anchor=y,t.kind=l?"mapping":"sequence",t.result=a,!0;f?44===p&&on(t,"expected the node content, but found ','"):on(t,"missed comma between flow collection entries"),d=null,o=c=!1,63===p&&Xe(t.input.charCodeAt(t.position+1))&&(o=c=!0,t.position++,fn(t,!0,e)),n=t.line,r=t.lineStart,i=t.position,xn(t,e,Ie,!1,!0),u=t.tag,h=t.result,fn(t,!0,e),p=t.input.charCodeAt(t.position),!c&&t.line!==n||58!==p||(o=!0,p=t.input.charCodeAt(++t.position),fn(t,!0,e),xn(t,e,Ie,!1,!0),d=t.result),l?dn(t,a,m,u,h,d,n,r,i):o?a.push(dn(t,null,m,u,h,d,n,r,i)):a.push(h),fn(t,!0,e),44===(p=t.input.charCodeAt(t.position))?(f=!0,p=t.input.charCodeAt(++t.position)):f=!1}on(t,"unexpected end of the stream within a flow collection")}(t,d)?y=!0:(s&&function(t,e){var n,r,i,a,s,o=Ze,c=!1,l=!1,h=e,u=0,d=!1;if(124===(a=t.input.charCodeAt(t.position)))r=!1;else{if(62!==a)return!1;r=!0}for(t.kind="scalar",t.result="";0!==a;)if(43===(a=t.input.charCodeAt(++t.position))||45===a)Ze===o?o=43===a?je:Pe:on(t,"repeat of a chomping mode identifier");else{if(!((i=48<=(s=a)&&s<=57?s-48:-1)>=0))break;0===i?on(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?on(t,"repeat of an indentation width identifier"):(h=e+i-1,l=!0)}if(Ge(a)){do{a=t.input.charCodeAt(++t.position)}while(Ge(a));if(35===a)do{a=t.input.charCodeAt(++t.position)}while(!Ve(a)&&0!==a)}for(;0!==a;){for(pn(t),t.lineIndent=0,a=t.input.charCodeAt(t.position);(!l||t.lineIndent<h)&&32===a;)t.lineIndent++,a=t.input.charCodeAt(++t.position);if(!l&&t.lineIndent>h&&(h=t.lineIndent),Ve(a))u++;else{if(t.lineIndent<h){o===je?t.result+=Kt.repeat("\n",c?1+u:u):o===Ze&&c&&(t.result+="\n");break}for(r?Ge(a)?(d=!0,t.result+=Kt.repeat("\n",c?1+u:u)):d?(d=!1,t.result+=Kt.repeat("\n",u+1)):0===u?c&&(t.result+=" "):t.result+=Kt.repeat("\n",u):t.result+=Kt.repeat("\n",c?1+u:u),c=!0,l=!0,u=0,n=t.position;!Ve(a)&&0!==a;)a=t.input.charCodeAt(++t.position);hn(t,n,t.position,!1)}}return!0}(t,d)||function(t,e){var n,r,i;if(39!==(n=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,r=i=t.position;0!==(n=t.input.charCodeAt(t.position));)if(39===n){if(hn(t,r,t.position,!0),39!==(n=t.input.charCodeAt(++t.position)))return!0;r=t.position,t.position++,i=t.position}else Ve(n)?(hn(t,r,i,!0),yn(t,fn(t,!1,e)),r=i=t.position):t.position===t.lineStart&&gn(t)?on(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);on(t,"unexpected end of the stream within a single quoted scalar")}(t,d)||function(t,e){var n,r,i,a,s,o,c;if(34!==(o=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,n=r=t.position;0!==(o=t.input.charCodeAt(t.position));){if(34===o)return hn(t,n,t.position,!0),t.position++,!0;if(92===o){if(hn(t,n,t.position,!0),Ve(o=t.input.charCodeAt(++t.position)))fn(t,!1,e);else if(o<256&&en[o])t.result+=nn[o],t.position++;else if((s=120===(c=o)?2:117===c?4:85===c?8:0)>0){for(i=s,a=0;i>0;i--)(s=Ke(o=t.input.charCodeAt(++t.position)))>=0?a=(a<<4)+s:on(t,"expected hexadecimal character");t.result+=tn(a),t.position++}else on(t,"unknown escape sequence");n=r=t.position}else Ve(o)?(hn(t,n,r,!0),yn(t,fn(t,!1,e)),n=r=t.position):t.position===t.lineStart&&gn(t)?on(t,"unexpected end of the document within a double quoted scalar"):(t.position++,r=t.position)}on(t,"unexpected end of the stream within a double quoted scalar")}(t,d)?y=!0:!function(t){var e,n,r;if(42!==(r=t.input.charCodeAt(t.position)))return!1;for(r=t.input.charCodeAt(++t.position),e=t.position;0!==r&&!Xe(r)&&!Qe(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&on(t,"name of an alias node must contain at least one character"),n=t.input.slice(e,t.position),Me.call(t.anchorMap,n)||on(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],fn(t,!0,-1),!0}(t)?function(t,e,n){var r,i,a,s,o,c,l,h,u=t.kind,d=t.result;if(Xe(h=t.input.charCodeAt(t.position))||Qe(h)||35===h||38===h||42===h||33===h||124===h||62===h||39===h||34===h||37===h||64===h||96===h)return!1;if((63===h||45===h)&&(Xe(r=t.input.charCodeAt(t.position+1))||n&&Qe(r)))return!1;for(t.kind="scalar",t.result="",i=a=t.position,s=!1;0!==h;){if(58===h){if(Xe(r=t.input.charCodeAt(t.position+1))||n&&Qe(r))break}else if(35===h){if(Xe(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&gn(t)||n&&Qe(h))break;if(Ve(h)){if(o=t.line,c=t.lineStart,l=t.lineIndent,fn(t,!1,-1),t.lineIndent>=e){s=!0,h=t.input.charCodeAt(t.position);continue}t.position=a,t.line=o,t.lineStart=c,t.lineIndent=l;break}}s&&(hn(t,i,a,!1),yn(t,t.line-o),i=a=t.position,s=!1),Ge(h)||(a=t.position+1),h=t.input.charCodeAt(++t.position)}return hn(t,i,a,!1),!!t.result||(t.kind=u,t.result=d,!1)}(t,d,Ie===n)&&(y=!0,null===t.tag&&(t.tag="?")):(y=!0,null===t.tag&&null===t.anchor||on(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===f&&(y=o&&mn(t,p))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&on(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),c=0,l=t.implicitTypes.length;c<l;c+=1)if((u=t.implicitTypes[c]).resolve(t.result)){t.result=u.construct(t.result),t.tag=u.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else if("!"!==t.tag){if(Me.call(t.typeMap[t.kind||"fallback"],t.tag))u=t.typeMap[t.kind||"fallback"][t.tag];else for(u=null,c=0,l=(h=t.typeMap.multi[t.kind||"fallback"]).length;c<l;c+=1)if(t.tag.slice(0,h[c].tag.length)===h[c].tag){u=h[c];break}u||on(t,"unknown tag !<"+t.tag+">"),null!==t.result&&u.kind!==t.kind&&on(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+u.kind+'", not "'+t.kind+'"'),u.resolve(t.result,t.tag)?(t.result=u.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):on(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||y}function vn(t){var e,n,r,i,a=t.position,s=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(i=t.input.charCodeAt(t.position))&&(fn(t,!0,-1),i=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==i));){for(s=!0,i=t.input.charCodeAt(++t.position),e=t.position;0!==i&&!Xe(i);)i=t.input.charCodeAt(++t.position);for(r=[],(n=t.input.slice(e,t.position)).length<1&&on(t,"directive name must not be less than one character in length");0!==i;){for(;Ge(i);)i=t.input.charCodeAt(++t.position);if(35===i){do{i=t.input.charCodeAt(++t.position)}while(0!==i&&!Ve(i));break}if(Ve(i))break;for(e=t.position;0!==i&&!Xe(i);)i=t.input.charCodeAt(++t.position);r.push(t.input.slice(e,t.position))}0!==i&&pn(t),Me.call(ln,n)?ln[n](t,n,r):cn(t,'unknown document directive "'+n+'"')}fn(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,fn(t,!0,-1)):s&&on(t,"directives end mark is expected"),xn(t,t.lineIndent-1,Re,!1,!0),fn(t,!0,-1),t.checkLineBreaks&&ze.test(t.input.slice(a,t.position))&&cn(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&gn(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,fn(t,!0,-1)):t.position<t.length-1&&on(t,"end of the stream or a document separator is expected")}function kn(t,e){e=e||{},0!==(t=String(t)).length&&(10!==t.charCodeAt(t.length-1)&&13!==t.charCodeAt(t.length-1)&&(t+="\n"),65279===t.charCodeAt(0)&&(t=t.slice(1)));var n=new an(t,e),r=t.indexOf("\0");for(-1!==r&&(n.position=r,on(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)vn(n);return n.documents}var wn=he,Cn={loadAll:function(t,e,n){null!==e&&"object"==typeof e&&void 0===n&&(n=e,e=null);var r=kn(t,n);if("function"!=typeof e)return r;for(var i=0,a=r.length;i<a;i+=1)e(r[i])},load:function(t,e){var n=kn(t,e);if(0!==n.length){if(1===n.length)return n[0];throw new ee("expected a single document in the stream, but found more")}}}.load;const En=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;const Tn=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Sn=/\s*%%.*\n/gm,An={},Ln=function(t,e){t=t.replace(En,"").replace(Tn,"").replace(Sn,"\n");for(const[n,{detector:r}]of Object.entries(An)){if(r(t,e))return n}throw new Error(`No diagram type detected for text: ${t}`)},Bn=(...t)=>{for(const{id:e,detector:n,loader:r}of t)Nn(e,n,r)},Nn=(t,e,n)=>{An[t]?Bt.error(`Detector with key ${t} already exists`):An[t]={detector:e,loader:n},Bt.debug(`Detector with key ${t} added${n?" with loader":""}`)},Dn=function(t,e,n){const{depth:r,clobber:i}=Object.assign({depth:2,clobber:!1},n);return Array.isArray(e)&&!Array.isArray(t)?(e.forEach((e=>Dn(t,e,n))),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach((e=>{t.includes(e)||t.push(e)})),t):void 0===t||r<=0?null!=t&&"object"==typeof t&&"object"==typeof e?Object.assign(t,e):e:(void 0!==e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).forEach((n=>{"object"!=typeof e[n]||void 0!==t[n]&&"object"!=typeof t[n]?(i||"object"!=typeof t[n]&&"object"!=typeof e[n])&&(t[n]=e[n]):(void 0===t[n]&&(t[n]=Array.isArray(e[n])?[]:{}),t[n]=Dn(t[n],e[n],{depth:r-1,clobber:i}))})),t)},On=Dn,Mn={curveBasis:o.$0Z,curveBasisClosed:o.Dts,curveBasisOpen:o.WQY,curveBumpX:o.qpX,curveBumpY:o.u93,curveBundle:o.tFB,curveCardinalClosed:o.OvA,curveCardinalOpen:o.dCK,curveCardinal:o.YY7,curveCatmullRomClosed:o.fGX,curveCatmullRomOpen:o.$m7,curveCatmullRom:o.zgE,curveLinear:o.c_6,curveLinearClosed:o.fxm,curveMonotoneX:o.FdL,curveMonotoneY:o.ak_,curveNatural:o.SxZ,curveStep:o.eA_,curveStepAfter:o.jsv,curveStepBefore:o.iJ},In=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Fn=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,$n=function(t,e=null){try{const n=new RegExp(`[%]{2}(?![{]${Fn.source})(?=[}][%]{2}).*\n`,"ig");let r;t=t.trim().replace(n,"").replace(/'/gm,'"'),Bt.debug(`Detecting diagram directive${null!==e?" type:"+e:""} based on the text:${t}`);const i=[];for(;null!==(r=In.exec(t));)if(r.index===In.lastIndex&&In.lastIndex++,r&&!e||e&&r[1]&&r[1].match(e)||e&&r[2]&&r[2].match(e)){const t=r[1]?r[1]:r[2],e=r[3]?r[3].trim():r[4]?JSON.parse(r[4].trim()):null;i.push({type:t,args:e})}return 0===i.length&&i.push({type:t,args:null}),1===i.length?i[0]:i}catch(n){return Bt.error(`ERROR: ${n.message} - Unable to parse directive\n ${null!==e?" type:"+e:""} based on the text:${t}`),{type:null,args:null}}};function Rn(t,e){if(!t)return e;const n=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return Mn[n]||e}function Zn(t,e){return t&&e?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):0}function Pn(t){let e="",n="";for(const r of t)void 0!==r&&(r.startsWith("color:")||r.startsWith("text-align:")?n=n+r+";":e=e+r+";");return{style:e,labelStyle:n}}let jn=0;const Yn=()=>(jn++,"id-"+Math.random().toString(36).substr(2,12)+"-"+jn);const zn=t=>function(t){let e="";const n="0123456789abcdef";for(let r=0;r<t;r++)e+=n.charAt(Math.floor(16*Math.random()));return e}(t.length),Un=function(t,e){const n=e.text.replace(jt.lineBreakRegex," "),[,r]=tr(e.fontSize),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.style("text-anchor",e.anchor),i.style("font-family",e.fontFamily),i.style("font-size",r),i.style("font-weight",e.fontWeight),i.attr("fill",e.fill),void 0!==e.class&&i.attr("class",e.class);const a=i.append("tspan");return a.attr("x",e.x+2*e.textMargin),a.attr("fill",e.fill),a.text(n),i},Wn=(0,v.Z)(((t,e,n)=>{if(!t)return t;if(n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},n),jt.lineBreakRegex.test(t))return t;const r=t.split(" "),i=[];let a="";return r.forEach(((t,s)=>{const o=Vn(`${t} `,n),c=Vn(a,n);if(o>e){const{hyphenatedStrings:r,remainingWord:s}=Hn(t,e,"-",n);i.push(a,...r),a=s}else c+o>=e?(i.push(a),a=t):a=[a,t].filter(Boolean).join(" ");s+1===r.length&&i.push(a)})),i.filter((t=>""!==t)).join(n.joinWith)}),((t,e,n)=>`${t}${e}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`)),Hn=(0,v.Z)(((t,e,n="-",r)=>{r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},r);const i=[...t],a=[];let s="";return i.forEach(((t,o)=>{const c=`${s}${t}`;if(Vn(c,r)>=e){const t=o+1,e=i.length===t,r=`${c}${n}`;a.push(e?c:r),s=""}else s=c})),{hyphenatedStrings:a,remainingWord:s}}),((t,e,n="-",r)=>`${t}${e}${n}${r.fontSize}${r.fontWeight}${r.fontFamily}`));function qn(t,e){return e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:15},e),Gn(t,e).height}function Vn(t,e){return e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial"},e),Gn(t,e).width}const Gn=(0,v.Z)(((t,e)=>{e=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial"},e);const{fontSize:n,fontFamily:r,fontWeight:i}=e;if(!t)return{width:0,height:0};const[,a]=tr(n),s=["sans-serif",r],c=t.split(jt.lineBreakRegex),l=[],h=(0,o.Ys)("body");if(!h.remove)return{width:0,height:0,lineHeight:0};const u=h.append("svg");for(const o of s){let t=0;const e={width:0,height:0,lineHeight:0};for(const n of c){const r={x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0};r.text=n;const s=Un(u,r).style("font-size",a).style("font-weight",i).style("font-family",o),c=(s._groups||s)[0][0].getBBox();e.width=Math.round(Math.max(e.width,c.width)),t=Math.round(c.height),e.height+=t,e.lineHeight=Math.round(Math.max(e.lineHeight,t))}l.push(e)}u.remove();return l[isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1]}),((t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`));let Xn;const Qn=t=>{if(Bt.debug("directiveSanitizer called with",t),"object"==typeof t&&(t.length?t.forEach((t=>Qn(t))):Object.keys(t).forEach((e=>{Bt.debug("Checking key",e),e.startsWith("__")&&(Bt.debug("sanitize deleting __ option",e),delete t[e]),e.includes("proto")&&(Bt.debug("sanitize deleting proto option",e),delete t[e]),e.includes("constr")&&(Bt.debug("sanitize deleting constr option",e),delete t[e]),e.includes("themeCSS")&&(Bt.debug("sanitizing themeCss option"),t[e]=Kn(t[e])),e.includes("fontFamily")&&(Bt.debug("sanitizing fontFamily option"),t[e]=Kn(t[e])),e.includes("altFontFamily")&&(Bt.debug("sanitizing altFontFamily option"),t[e]=Kn(t[e])),Gt.includes(e)?"object"==typeof t[e]&&(Bt.debug("sanitize deleting object",e),Qn(t[e])):(Bt.debug("sanitize deleting option",e),delete t[e])}))),t.themeVariables){const e=Object.keys(t.themeVariables);for(const n of e){const e=t.themeVariables[n];e&&e.match&&!e.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[n]="")}}Bt.debug("After sanitization",t)},Kn=t=>{let e=0,n=0;for(const r of t){if(e<n)return"{ /* ERROR: Unbalanced CSS */ }";"{"===r?e++:"}"===r&&n++}return e!==n?"{ /* ERROR: Unbalanced CSS */ }":t};function Jn(t){return"str"in t}const tr=t=>{if("number"==typeof t)return[t,t+"px"];const e=parseInt(t,10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},er={assignWithDepth:On,wrapLabel:Wn,calculateTextHeight:qn,calculateTextWidth:Vn,calculateTextDimensions:Gn,detectInit:function(t,e){const n=$n(t,/(?:init\b)|(?:initialize\b)/);let r={};if(Array.isArray(n)){const t=n.map((t=>t.args));Qn(t),r=On(r,[...t])}else r=n.args;if(r){let n=Ln(t,e);["config"].forEach((t=>{void 0!==r[t]&&("flowchart-v2"===n&&(n="flowchart"),r[n]=r[t],delete r[t])}))}return r},detectDirective:$n,isSubstringInArray:function(t,e){for(const[n,r]of e.entries())if(r.match(t))return n;return-1},interpolateToCurve:Rn,calcLabelPosition:function(t){return 1===t.length?t[0]:function(t){let e,n=0;t.forEach((t=>{n+=Zn(t,e),e=t}));let r,i=n/2;return e=void 0,t.forEach((t=>{if(e&&!r){const n=Zn(t,e);if(n<i)i-=n;else{const a=i/n;a<=0&&(r=e),a>=1&&(r={x:t.x,y:t.y}),a>0&&a<1&&(r={x:(1-a)*e.x+a*t.x,y:(1-a)*e.y+a*t.y})}}e=t})),r}(t)},calcCardinalityPosition:(t,e,n)=>{let r;Bt.info(`our points ${JSON.stringify(e)}`),e[0]!==n&&(e=e.reverse());let i,a=25;r=void 0,e.forEach((t=>{if(r&&!i){const e=Zn(t,r);if(e<a)a-=e;else{const n=a/e;n<=0&&(i=r),n>=1&&(i={x:t.x,y:t.y}),n>0&&n<1&&(i={x:(1-n)*r.x+n*t.x,y:(1-n)*r.y+n*t.y})}}r=t}));const s=t?10:5,o=Math.atan2(e[0].y-i.y,e[0].x-i.x),c={x:0,y:0};return c.x=Math.sin(o)*s+(e[0].x+i.x)/2,c.y=-Math.cos(o)*s+(e[0].y+i.y)/2,c},calcTerminalLabelPosition:function(t,e,n){let r,i=JSON.parse(JSON.stringify(n));Bt.info("our points",i),"start_left"!==e&&"start_right"!==e&&(i=i.reverse()),i.forEach((t=>{r=t}));let a,s=25+t;r=void 0,i.forEach((t=>{if(r&&!a){const e=Zn(t,r);if(e<s)s-=e;else{const n=s/e;n<=0&&(a=r),n>=1&&(a={x:t.x,y:t.y}),n>0&&n<1&&(a={x:(1-n)*r.x+n*t.x,y:(1-n)*r.y+n*t.y})}}r=t}));const o=10+.5*t,c=Math.atan2(i[0].y-a.y,i[0].x-a.x),l={x:0,y:0};return l.x=Math.sin(c)*o+(i[0].x+a.x)/2,l.y=-Math.cos(c)*o+(i[0].y+a.y)/2,"start_left"===e&&(l.x=Math.sin(c+Math.PI)*o+(i[0].x+a.x)/2,l.y=-Math.cos(c+Math.PI)*o+(i[0].y+a.y)/2),"end_right"===e&&(l.x=Math.sin(c-Math.PI)*o+(i[0].x+a.x)/2-5,l.y=-Math.cos(c-Math.PI)*o+(i[0].y+a.y)/2-5),"end_left"===e&&(l.x=Math.sin(c)*o+(i[0].x+a.x)/2-5,l.y=-Math.cos(c)*o+(i[0].y+a.y)/2-5),l},formatUrl:function(t,e){const n=t.trim();if(n)return"loose"!==e.securityLevel?(0,s.N)(n):n},getStylesFromArray:Pn,generateId:Yn,random:zn,runFunc:(t,...e)=>{const n=t.split("."),r=n.length-1,i=n[r];let a=window;for(let s=0;s<r;s++)if(a=a[n[s]],!a)return;a[i](...e)},entityDecode:function(t){return Xn=Xn||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Xn.innerHTML=t,unescape(Xn.textContent)},initIdGenerator:class{constructor(t,e){this.deterministic=t,this.seed=e,this.count=e?e.length:0}next(){return this.deterministic?this.count++:Date.now()}},directiveSanitizer:Qn,sanitizeCss:Kn,insertTitle:(t,e,n,r)=>{if(!r)return;const i=t.node().getBBox();t.append("text").text(r).attr("x",i.x+i.width/2).attr("y",-n).attr("class",e)},parseFontSize:tr},nr="9.4.3",rr=Object.freeze(Xt);let ir,ar=On({},rr),sr=[],or=On({},rr);const cr=(t,e)=>{let n=On({},t),r={};for(const i of e)dr(i),r=On(r,i);if(n=On(n,r),r.theme&&r.theme in Ht){const t=On({},ir),e=On(t.themeVariables||{},r.themeVariables);n.theme&&n.theme in Ht&&(n.themeVariables=Ht[n.theme].getThemeVariables(e))}return or=n,mr(or),or},lr=()=>On({},ar),hr=t=>(mr(t),On(or,t),ur()),ur=()=>On({},or),dr=t=>{["secure",...ar.secure??[]].forEach((e=>{void 0!==t[e]&&(Bt.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])})),Object.keys(t).forEach((e=>{0===e.indexOf("__")&&delete t[e]})),Object.keys(t).forEach((e=>{"string"==typeof t[e]&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],"object"==typeof t[e]&&dr(t[e])}))},pr=t=>{t.fontFamily&&(t.themeVariables&&t.themeVariables.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),sr.push(t),cr(ar,sr)},fr=(t=ar)=>{sr=[],cr(t,sr)};var gr=(t=>(t.LAZY_LOAD_DEPRECATED="The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",t))(gr||{});const yr={},mr=t=>{var e;t&&((t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&(yr[e="LAZY_LOAD_DEPRECATED"]||(Bt.warn(gr[e]),yr[e]=!0)))},br=function(t,e,n,r){const i=function(t,e,n){let r=new Map;return n?(r.set("width","100%"),r.set("style",`max-width: ${e}px;`)):(r.set("height",t),r.set("width",e)),r}(e,n,r);!function(t,e){for(let n of e)t.attr(n[0],n[1])}(t,i)},_r=function(t,e,n,r){const i=e.node().getBBox(),a=i.width,s=i.height;Bt.info(`SVG bounds: ${a}x${s}`,i);let o=0,c=0;Bt.info(`Graph bounds: ${o}x${c}`,t),o=a+2*n,c=s+2*n,Bt.info(`Calculated bounds: ${o}x${c}`),br(e,c,o,r);const l=`${i.x-n} ${i.y-n} ${i.width+2*n} ${i.height+2*n}`;e.attr("viewBox",l)},xr=t=>`g.classGroup text {\n fill: ${t.nodeBorder};\n fill: ${t.classText};\n stroke: none;\n font-family: ${t.fontFamily};\n font-size: 10px;\n\n .title {\n font-weight: bolder;\n }\n\n}\n\n.nodeLabel, .edgeLabel {\n color: ${t.classText};\n}\n.edgeLabel .label rect {\n fill: ${t.mainBkg};\n}\n.label text {\n fill: ${t.classText};\n}\n.edgeLabel .label span {\n background: ${t.mainBkg};\n}\n\n.classTitle {\n font-weight: bolder;\n}\n.node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n\n.divider {\n stroke: ${t.nodeBorder};\n stroke: 1;\n}\n\ng.clickable {\n cursor: pointer;\n}\n\ng.classGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.classGroup line {\n stroke: ${t.nodeBorder};\n stroke-width: 1;\n}\n\n.classLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.classLabel .label {\n fill: ${t.nodeBorder};\n font-size: 10px;\n}\n\n.relation {\n stroke: ${t.lineColor};\n stroke-width: 1;\n fill: none;\n}\n\n.dashed-line{\n stroke-dasharray: 3;\n}\n\n.dotted-line{\n stroke-dasharray: 1 2;\n}\n\n#compositionStart, .composition {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#compositionEnd, .composition {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#extensionStart, .extension {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#extensionEnd, .extension {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#aggregationStart, .aggregation {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#aggregationEnd, .aggregation {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#lollipopStart, .lollipop {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#lollipopEnd, .lollipop {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n.edgeTerminals {\n font-size: 11px;\n}\n\n.classTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n`,vr=t=>`\n .entityBox {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n }\n\n .attributeBoxOdd {\n fill: ${t.attributeBackgroundColorOdd};\n stroke: ${t.nodeBorder};\n }\n\n .attributeBoxEven {\n fill: ${t.attributeBackgroundColorEven};\n stroke: ${t.nodeBorder};\n }\n\n .relationshipLabelBox {\n fill: ${t.tertiaryColor};\n opacity: 0.7;\n background-color: ${t.tertiaryColor};\n rect {\n opacity: 0.5;\n }\n }\n\n .relationshipLine {\n stroke: ${t.lineColor};\n }\n\n .entityTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n } \n`,kr=()=>"",wr=t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.nodeTextColor||t.textColor};\n }\n .cluster-label text {\n fill: ${t.titleColor};\n }\n .cluster-label span {\n color: ${t.titleColor};\n }\n\n .label text,span {\n fill: ${t.nodeTextColor||t.textColor};\n color: ${t.nodeTextColor||t.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ${t.clusterBkg};\n stroke: ${t.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n .cluster span {\n color: ${t.titleColor};\n }\n /* .cluster div {\n color: ${t.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`,Cr=t=>`\n .mermaid-main-font {\n font-family: "trebuchet ms", verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n .exclude-range {\n fill: ${t.excludeBkgColor};\n }\n\n .section {\n stroke: none;\n opacity: 0.2;\n }\n\n .section0 {\n fill: ${t.sectionBkgColor};\n }\n\n .section2 {\n fill: ${t.sectionBkgColor2};\n }\n\n .section1,\n .section3 {\n fill: ${t.altSectionBkgColor};\n opacity: 0.2;\n }\n\n .sectionTitle0 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle1 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle2 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle3 {\n fill: ${t.titleColor};\n }\n\n .sectionTitle {\n text-anchor: start;\n // font-size: ${t.ganttFontSize};\n // text-height: 14px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n\n /* Grid and axis */\n\n .grid .tick {\n stroke: ${t.gridColor};\n opacity: 0.8;\n shape-rendering: crispEdges;\n text {\n font-family: ${t.fontFamily};\n fill: ${t.textColor};\n }\n }\n\n .grid path {\n stroke-width: 0;\n }\n\n\n /* Today line */\n\n .today {\n fill: none;\n stroke: ${t.todayLineColor};\n stroke-width: 2px;\n }\n\n\n /* Task styling */\n\n /* Default task */\n\n .task {\n stroke-width: 2;\n }\n\n .taskText {\n text-anchor: middle;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n\n // .taskText:not([font-size]) {\n // font-size: ${t.ganttFontSize};\n // }\n\n .taskTextOutsideRight {\n fill: ${t.taskTextDarkColor};\n text-anchor: start;\n // font-size: ${t.ganttFontSize};\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n .taskTextOutsideLeft {\n fill: ${t.taskTextDarkColor};\n text-anchor: end;\n // font-size: ${t.ganttFontSize};\n }\n\n /* Special case clickable */\n .task.clickable {\n cursor: pointer;\n }\n .taskText.clickable {\n cursor: pointer;\n fill: ${t.taskTextClickableColor} !important;\n font-weight: bold;\n }\n\n .taskTextOutsideLeft.clickable {\n cursor: pointer;\n fill: ${t.taskTextClickableColor} !important;\n font-weight: bold;\n }\n\n .taskTextOutsideRight.clickable {\n cursor: pointer;\n fill: ${t.taskTextClickableColor} !important;\n font-weight: bold;\n }\n\n /* Specific task settings for the sections*/\n\n .taskText0,\n .taskText1,\n .taskText2,\n .taskText3 {\n fill: ${t.taskTextColor};\n }\n\n .task0,\n .task1,\n .task2,\n .task3 {\n fill: ${t.taskBkgColor};\n stroke: ${t.taskBorderColor};\n }\n\n .taskTextOutside0,\n .taskTextOutside2\n {\n fill: ${t.taskTextOutsideColor};\n }\n\n .taskTextOutside1,\n .taskTextOutside3 {\n fill: ${t.taskTextOutsideColor};\n }\n\n\n /* Active task */\n\n .active0,\n .active1,\n .active2,\n .active3 {\n fill: ${t.activeTaskBkgColor};\n stroke: ${t.activeTaskBorderColor};\n }\n\n .activeText0,\n .activeText1,\n .activeText2,\n .activeText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n\n /* Completed task */\n\n .done0,\n .done1,\n .done2,\n .done3 {\n stroke: ${t.doneTaskBorderColor};\n fill: ${t.doneTaskBkgColor};\n stroke-width: 2;\n }\n\n .doneText0,\n .doneText1,\n .doneText2,\n .doneText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n\n /* Tasks on the critical line */\n\n .crit0,\n .crit1,\n .crit2,\n .crit3 {\n stroke: ${t.critBorderColor};\n fill: ${t.critBkgColor};\n stroke-width: 2;\n }\n\n .activeCrit0,\n .activeCrit1,\n .activeCrit2,\n .activeCrit3 {\n stroke: ${t.critBorderColor};\n fill: ${t.activeTaskBkgColor};\n stroke-width: 2;\n }\n\n .doneCrit0,\n .doneCrit1,\n .doneCrit2,\n .doneCrit3 {\n stroke: ${t.critBorderColor};\n fill: ${t.doneTaskBkgColor};\n stroke-width: 2;\n cursor: pointer;\n shape-rendering: crispEdges;\n }\n\n .milestone {\n transform: rotate(45deg) scale(0.8,0.8);\n }\n\n .milestoneText {\n font-style: italic;\n }\n .doneCritText0,\n .doneCritText1,\n .doneCritText2,\n .doneCritText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n .activeCritText0,\n .activeCritText1,\n .activeCritText2,\n .activeCritText3 {\n fill: ${t.taskTextDarkColor} !important;\n }\n\n .titleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor} ;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n`,Er=()=>"",Tr=t=>`\n .pieCircle{\n stroke: ${t.pieStrokeColor};\n stroke-width : ${t.pieStrokeWidth};\n opacity : ${t.pieOpacity};\n }\n .pieTitleText {\n text-anchor: middle;\n font-size: ${t.pieTitleTextSize};\n fill: ${t.pieTitleTextColor};\n font-family: ${t.fontFamily};\n }\n .slice {\n font-family: ${t.fontFamily};\n fill: ${t.pieSectionTextColor};\n font-size:${t.pieSectionTextSize};\n // fill: white;\n }\n .legend text {\n fill: ${t.pieLegendTextColor};\n font-family: ${t.fontFamily};\n font-size: ${t.pieLegendTextSize};\n }\n`,Sr=t=>`\n\n marker {\n fill: ${t.relationColor};\n stroke: ${t.relationColor};\n }\n\n marker.cross {\n stroke: ${t.lineColor};\n }\n\n svg {\n font-family: ${t.fontFamily};\n font-size: ${t.fontSize};\n }\n\n .reqBox {\n fill: ${t.requirementBackground};\n fill-opacity: 100%;\n stroke: ${t.requirementBorderColor};\n stroke-width: ${t.requirementBorderSize};\n }\n \n .reqTitle, .reqLabel{\n fill: ${t.requirementTextColor};\n }\n .reqLabelBox {\n fill: ${t.relationLabelBackground};\n fill-opacity: 100%;\n }\n\n .req-title-line {\n stroke: ${t.requirementBorderColor};\n stroke-width: ${t.requirementBorderSize};\n }\n .relationshipLine {\n stroke: ${t.relationColor};\n stroke-width: 1;\n }\n .relationshipLabel {\n fill: ${t.relationLabelColor};\n }\n\n`,Ar=t=>`.actor {\n stroke: ${t.actorBorder};\n fill: ${t.actorBkg};\n }\n\n text.actor > tspan {\n fill: ${t.actorTextColor};\n stroke: none;\n }\n\n .actor-line {\n stroke: ${t.actorLineColor};\n }\n\n .messageLine0 {\n stroke-width: 1.5;\n stroke-dasharray: none;\n stroke: ${t.signalColor};\n }\n\n .messageLine1 {\n stroke-width: 1.5;\n stroke-dasharray: 2, 2;\n stroke: ${t.signalColor};\n }\n\n #arrowhead path {\n fill: ${t.signalColor};\n stroke: ${t.signalColor};\n }\n\n .sequenceNumber {\n fill: ${t.sequenceNumberColor};\n }\n\n #sequencenumber {\n fill: ${t.signalColor};\n }\n\n #crosshead path {\n fill: ${t.signalColor};\n stroke: ${t.signalColor};\n }\n\n .messageText {\n fill: ${t.signalTextColor};\n stroke: none;\n }\n\n .labelBox {\n stroke: ${t.labelBoxBorderColor};\n fill: ${t.labelBoxBkgColor};\n }\n\n .labelText, .labelText > tspan {\n fill: ${t.labelTextColor};\n stroke: none;\n }\n\n .loopText, .loopText > tspan {\n fill: ${t.loopTextColor};\n stroke: none;\n }\n\n .loopLine {\n stroke-width: 2px;\n stroke-dasharray: 2, 2;\n stroke: ${t.labelBoxBorderColor};\n fill: ${t.labelBoxBorderColor};\n }\n\n .note {\n //stroke: #decc93;\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n }\n\n .noteText, .noteText > tspan {\n fill: ${t.noteTextColor};\n stroke: none;\n }\n\n .activation0 {\n fill: ${t.activationBkgColor};\n stroke: ${t.activationBorderColor};\n }\n\n .activation1 {\n fill: ${t.activationBkgColor};\n stroke: ${t.activationBorderColor};\n }\n\n .activation2 {\n fill: ${t.activationBkgColor};\n stroke: ${t.activationBorderColor};\n }\n\n .actorPopupMenu {\n position: absolute;\n }\n\n .actorPopupMenuPanel {\n position: absolute;\n fill: ${t.actorBkg};\n box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);\n filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));\n}\n .actor-man line {\n stroke: ${t.actorBorder};\n fill: ${t.actorBkg};\n }\n .actor-man circle, line {\n stroke: ${t.actorBorder};\n fill: ${t.actorBkg};\n stroke-width: 2px;\n }\n`,Lr=t=>`\ndefs #statediagram-barbEnd {\n fill: ${t.transitionColor};\n stroke: ${t.transitionColor};\n }\ng.stateGroup text {\n fill: ${t.nodeBorder};\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ${t.textColor};\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ${t.stateLabelColor};\n}\n\ng.stateGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.stateGroup line {\n stroke: ${t.lineColor};\n stroke-width: 1;\n}\n\n.transition {\n stroke: ${t.transitionColor};\n stroke-width: 1;\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ${t.background};\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n\n text {\n fill: ${t.noteTextColor};\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ${t.labelBackgroundColor};\n opacity: 0.5;\n}\n.edgeLabel .label text {\n fill: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n.label div .edgeLabel {\n color: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n\n.stateLabel text {\n fill: ${t.stateLabelColor};\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node .fork-join {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node circle.state-end {\n fill: ${t.innerEndBackground};\n stroke: ${t.background};\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ${t.compositeBackground||t.background};\n // stroke: ${t.background};\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ${t.stateBkg||t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: 1px;\n}\n.node polygon {\n fill: ${t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};;\n stroke-width: 1px;\n}\n#statediagram-barbEnd {\n fill: ${t.lineColor};\n}\n\n.statediagram-cluster rect {\n fill: ${t.compositeTitleBackground};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: 1px;\n}\n\n.cluster-label, .nodeLabel {\n color: ${t.stateLabelColor};\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ${t.stateBorder||t.nodeBorder};\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ${t.compositeBackground||t.background};\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ${t.noteTextColor};\n}\n\n.statediagram-note .nodeLabel {\n color: ${t.noteTextColor};\n}\n.statediagram .edgeLabel {\n color: red; // ${t.noteTextColor};\n}\n\n#dependencyStart, #dependencyEnd {\n fill: ${t.lineColor};\n stroke: ${t.lineColor};\n stroke-width: 1;\n}\n\n.statediagramTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n`,Br=t=>`.label {\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n color: ${t.textColor};\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ${t.textColor}\n }\n\n .legend {\n fill: ${t.textColor};\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ${t.textColor}\n }\n\n .face {\n ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"};\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ${t.fillType0?`fill: ${t.fillType0}`:""};\n }\n .task-type-1, .section-type-1 {\n ${t.fillType0?`fill: ${t.fillType1}`:""};\n }\n .task-type-2, .section-type-2 {\n ${t.fillType0?`fill: ${t.fillType2}`:""};\n }\n .task-type-3, .section-type-3 {\n ${t.fillType0?`fill: ${t.fillType3}`:""};\n }\n .task-type-4, .section-type-4 {\n ${t.fillType0?`fill: ${t.fillType4}`:""};\n }\n .task-type-5, .section-type-5 {\n ${t.fillType0?`fill: ${t.fillType5}`:""};\n }\n .task-type-6, .section-type-6 {\n ${t.fillType0?`fill: ${t.fillType6}`:""};\n }\n .task-type-7, .section-type-7 {\n ${t.fillType0?`fill: ${t.fillType7}`:""};\n }\n\n .actor-0 {\n ${t.actor0?`fill: ${t.actor0}`:""};\n }\n .actor-1 {\n ${t.actor1?`fill: ${t.actor1}`:""};\n }\n .actor-2 {\n ${t.actor2?`fill: ${t.actor2}`:""};\n }\n .actor-3 {\n ${t.actor3?`fill: ${t.actor3}`:""};\n }\n .actor-4 {\n ${t.actor4?`fill: ${t.actor4}`:""};\n }\n .actor-5 {\n ${t.actor5?`fill: ${t.actor5}`:""};\n }\n`,Nr=t=>`.person {\n stroke: ${t.personBorder};\n fill: ${t.personBkg};\n }\n`,Dr={flowchart:wr,"flowchart-v2":wr,sequence:Ar,gantt:Cr,classDiagram:xr,"classDiagram-v2":xr,class:xr,stateDiagram:Lr,state:Lr,info:Er,pie:Tr,er:vr,error:kr,journey:Br,requirement:Sr,c4:Nr},Or=(t,e,n)=>{let r="";return t in Dr&&Dr[t]?r=Dr[t](n):Bt.warn(`No theme found for ${t}`),` & {\n font-family: ${n.fontFamily};\n font-size: ${n.fontSize};\n fill: ${n.textColor}\n }\n\n /* Classes common for multiple diagrams */\n\n & .error-icon {\n fill: ${n.errorBkgColor};\n }\n & .error-text {\n fill: ${n.errorTextColor};\n stroke: ${n.errorTextColor};\n }\n\n & .edge-thickness-normal {\n stroke-width: 2px;\n }\n & .edge-thickness-thick {\n stroke-width: 3.5px\n }\n & .edge-pattern-solid {\n stroke-dasharray: 0;\n }\n\n & .edge-pattern-dashed{\n stroke-dasharray: 3;\n }\n .edge-pattern-dotted {\n stroke-dasharray: 2;\n }\n\n & .marker {\n fill: ${n.lineColor};\n stroke: ${n.lineColor};\n }\n & .marker.cross {\n stroke: ${n.lineColor};\n }\n\n & svg {\n font-family: ${n.fontFamily};\n font-size: ${n.fontSize};\n }\n\n ${r}\n\n ${e}\n`};let Mr="",Ir="",Fr="";const $r=t=>It(t,ur()),Rr=function(){Mr="",Fr="",Ir=""},Zr=function(t){Mr=$r(t).replace(/^\s+/g,"")},Pr=function(){return Mr||Ir},jr=function(t){Fr=$r(t).replace(/\n\s+/g,"\n")},Yr=function(){return Fr},zr=function(t){Ir=$r(t)},Ur=function(){return Ir},Wr={setAccTitle:Zr,getAccTitle:Pr,setDiagramTitle:zr,getDiagramTitle:Ur,getAccDescription:Yr,setAccDescription:jr,clear:Rr},Hr=Object.freeze(Object.defineProperty({__proto__:null,clear:Rr,default:Wr,getAccDescription:Yr,getAccTitle:Pr,getDiagramTitle:Ur,setAccDescription:jr,setAccTitle:Zr,setDiagramTitle:zr},Symbol.toStringTag,{value:"Module"}));let qr={};const Vr=function(t,e,n,r){Bt.debug("parseDirective is being called",e,n,r);try{if(void 0!==e)switch(e=e.trim(),n){case"open_directive":qr={};break;case"type_directive":if(!qr)throw new Error("currentDirective is undefined");qr.type=e.toLowerCase();break;case"arg_directive":if(!qr)throw new Error("currentDirective is undefined");qr.args=JSON.parse(e);break;case"close_directive":Gr(t,qr,r),qr=void 0}}catch(i){Bt.error(`Error while rendering sequenceDiagram directive: ${e} jison context: ${n}`),Bt.error(i.message)}},Gr=function(t,e,n){switch(Bt.info(`Directive type=${e.type} with args:`,e.args),e.type){case"init":case"initialize":["config"].forEach((t=>{void 0!==e.args[t]&&("flowchart-v2"===n&&(n="flowchart"),e.args[n]=e.args[t],delete e.args[t])})),Bt.info("sanitize in handleDirective",e.args),Qn(e.args),Bt.info("sanitize in handleDirective (done)",e.args),pr(e.args);break;case"wrap":case"nowrap":t&&t.setWrap&&t.setWrap("wrap"===e.type);break;case"themeCss":Bt.warn("themeCss encountered");break;default:Bt.warn(`Unhandled directive: source: '%%{${e.type}: ${JSON.stringify(e.args?e.args:{})}}%%`,e)}},Xr=Bt,Qr=Nt,Kr=ur,Jr=t=>It(t,Kr()),ti=_r,ei=(t,e,n,r)=>Vr(t,e,n,r),ni={},ri=(t,e,n)=>{if(ni[t])throw new Error(`Diagram ${t} already registered.`);var r,i;ni[t]=e,n&&Nn(t,n),r=t,i=e.styles,Dr[r]=i,e.injectUtils&&e.injectUtils(Xr,Qr,Kr,Jr,ti,Hr,ei)},ii=t=>{if(t in ni)return ni[t];throw new Error(`Diagram ${t} not found.`)};var ai=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,4],r=[1,7],i=[1,5],a=[1,9],s=[1,6],o=[2,6],c=[1,16],l=[6,8,14,20,22,24,25,27,29,32,37,40,50,55],h=[8,14,20,22,24,25,27,29,32,37,40],u=[8,13,14,20,22,24,25,27,29,32,37,40],d=[1,26],p=[6,8,14,50,55],f=[8,14,55],g=[1,53],y=[1,52],m=[8,14,30,33,35,38,55],b=[1,67],_=[1,68],x=[1,69],v=[8,14,33,35,42,55],k={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,GG:6,document:7,EOF:8,":":9,DIR:10,options:11,body:12,OPT:13,NL:14,line:15,statement:16,commitStatement:17,mergeStatement:18,cherryPickStatement:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,branchStatement:26,CHECKOUT:27,ref:28,BRANCH:29,ORDER:30,NUM:31,CHERRY_PICK:32,COMMIT_ID:33,STR:34,COMMIT_TAG:35,EMPTYSTR:36,MERGE:37,COMMIT_TYPE:38,commitType:39,COMMIT:40,commit_arg:41,COMMIT_MSG:42,NORMAL:43,REVERSE:44,HIGHLIGHT:45,openDirective:46,typeDirective:47,closeDirective:48,argDirective:49,open_directive:50,type_directive:51,arg_directive:52,close_directive:53,ID:54,";":55,$accept:0,$end:1},terminals_:{2:"error",6:"GG",8:"EOF",9:":",10:"DIR",13:"OPT",14:"NL",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"CHECKOUT",29:"BRANCH",30:"ORDER",31:"NUM",32:"CHERRY_PICK",33:"COMMIT_ID",34:"STR",35:"COMMIT_TAG",36:"EMPTYSTR",37:"MERGE",38:"COMMIT_TYPE",40:"COMMIT",42:"COMMIT_MSG",43:"NORMAL",44:"REVERSE",45:"HIGHLIGHT",50:"open_directive",51:"type_directive",52:"arg_directive",53:"close_directive",54:"ID",55:";"},productions_:[0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[19,5],[19,5],[19,5],[19,5],[18,2],[18,4],[18,4],[18,4],[18,6],[18,6],[18,6],[18,6],[18,6],[18,6],[18,8],[18,8],[18,8],[18,8],[18,8],[18,8],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[41,0],[41,1],[39,1],[39,1],[39,1],[5,3],[5,5],[46,1],[47,1],[49,1],[48,1],[28,1],[28,1],[4,1],[4,1],[4,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 3:return a[o];case 4:return a[o-1];case 5:return r.setDirection(a[o-3]),a[o-1];case 7:r.setOptions(a[o-1]),this.$=a[o];break;case 8:a[o-1]+=a[o],this.$=a[o-1];break;case 10:this.$=[];break;case 11:a[o-1].push(a[o]),this.$=a[o-1];break;case 12:this.$=a[o-1];break;case 17:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 22:r.checkout(a[o]);break;case 23:r.branch(a[o]);break;case 24:r.branch(a[o-2],a[o]);break;case 25:r.cherryPick(a[o],"",void 0);break;case 26:r.cherryPick(a[o-2],"",a[o]);break;case 27:case 29:r.cherryPick(a[o-2],"","");break;case 28:r.cherryPick(a[o],"",a[o-2]);break;case 30:r.merge(a[o],"","","");break;case 31:r.merge(a[o-2],a[o],"","");break;case 32:r.merge(a[o-2],"",a[o],"");break;case 33:r.merge(a[o-2],"","",a[o]);break;case 34:r.merge(a[o-4],a[o],"",a[o-2]);break;case 35:r.merge(a[o-4],"",a[o],a[o-2]);break;case 36:r.merge(a[o-4],"",a[o-2],a[o]);break;case 37:r.merge(a[o-4],a[o-2],a[o],"");break;case 38:r.merge(a[o-4],a[o-2],"",a[o]);break;case 39:r.merge(a[o-4],a[o],a[o-2],"");break;case 40:r.merge(a[o-6],a[o-4],a[o-2],a[o]);break;case 41:r.merge(a[o-6],a[o],a[o-4],a[o-2]);break;case 42:r.merge(a[o-6],a[o-4],a[o],a[o-2]);break;case 43:r.merge(a[o-6],a[o-2],a[o-4],a[o]);break;case 44:r.merge(a[o-6],a[o],a[o-2],a[o-4]);break;case 45:r.merge(a[o-6],a[o-2],a[o],a[o-4]);break;case 46:r.commit(a[o]);break;case 47:r.commit("","",r.commitType.NORMAL,a[o]);break;case 48:r.commit("","",a[o],"");break;case 49:r.commit("","",a[o],a[o-2]);break;case 50:r.commit("","",a[o-2],a[o]);break;case 51:r.commit("",a[o],r.commitType.NORMAL,"");break;case 52:r.commit("",a[o-2],r.commitType.NORMAL,a[o]);break;case 53:r.commit("",a[o],r.commitType.NORMAL,a[o-2]);break;case 54:r.commit("",a[o-2],a[o],"");break;case 55:r.commit("",a[o],a[o-2],"");break;case 56:r.commit("",a[o-4],a[o-2],a[o]);break;case 57:r.commit("",a[o-4],a[o],a[o-2]);break;case 58:r.commit("",a[o-2],a[o-4],a[o]);break;case 59:r.commit("",a[o],a[o-4],a[o-2]);break;case 60:r.commit("",a[o],a[o-2],a[o-4]);break;case 61:r.commit("",a[o-2],a[o],a[o-4]);break;case 62:r.commit(a[o],"",r.commitType.NORMAL,"");break;case 63:r.commit(a[o],"",r.commitType.NORMAL,a[o-2]);break;case 64:r.commit(a[o-2],"",r.commitType.NORMAL,a[o]);break;case 65:r.commit(a[o-2],"",a[o],"");break;case 66:r.commit(a[o],"",a[o-2],"");break;case 67:r.commit(a[o],a[o-2],r.commitType.NORMAL,"");break;case 68:r.commit(a[o-2],a[o],r.commitType.NORMAL,"");break;case 69:r.commit(a[o-4],"",a[o-2],a[o]);break;case 70:r.commit(a[o-4],"",a[o],a[o-2]);break;case 71:r.commit(a[o-2],"",a[o-4],a[o]);break;case 72:r.commit(a[o],"",a[o-4],a[o-2]);break;case 73:r.commit(a[o],"",a[o-2],a[o-4]);break;case 74:r.commit(a[o-2],"",a[o],a[o-4]);break;case 75:r.commit(a[o-4],a[o],a[o-2],"");break;case 76:r.commit(a[o-4],a[o-2],a[o],"");break;case 77:r.commit(a[o-2],a[o],a[o-4],"");break;case 78:r.commit(a[o],a[o-2],a[o-4],"");break;case 79:r.commit(a[o],a[o-4],a[o-2],"");break;case 80:r.commit(a[o-2],a[o-4],a[o],"");break;case 81:r.commit(a[o-4],a[o],r.commitType.NORMAL,a[o-2]);break;case 82:r.commit(a[o-4],a[o-2],r.commitType.NORMAL,a[o]);break;case 83:r.commit(a[o-2],a[o],r.commitType.NORMAL,a[o-4]);break;case 84:r.commit(a[o],a[o-2],r.commitType.NORMAL,a[o-4]);break;case 85:r.commit(a[o],a[o-4],r.commitType.NORMAL,a[o-2]);break;case 86:r.commit(a[o-2],a[o-4],r.commitType.NORMAL,a[o]);break;case 87:r.commit(a[o-6],a[o-4],a[o-2],a[o]);break;case 88:r.commit(a[o-6],a[o-4],a[o],a[o-2]);break;case 89:r.commit(a[o-6],a[o-2],a[o-4],a[o]);break;case 90:r.commit(a[o-6],a[o],a[o-4],a[o-2]);break;case 91:r.commit(a[o-6],a[o-2],a[o],a[o-4]);break;case 92:r.commit(a[o-6],a[o],a[o-2],a[o-4]);break;case 93:r.commit(a[o-4],a[o-6],a[o-2],a[o]);break;case 94:r.commit(a[o-4],a[o-6],a[o],a[o-2]);break;case 95:r.commit(a[o-2],a[o-6],a[o-4],a[o]);break;case 96:r.commit(a[o],a[o-6],a[o-4],a[o-2]);break;case 97:r.commit(a[o-2],a[o-6],a[o],a[o-4]);break;case 98:r.commit(a[o],a[o-6],a[o-2],a[o-4]);break;case 99:r.commit(a[o],a[o-4],a[o-2],a[o-6]);break;case 100:r.commit(a[o-2],a[o-4],a[o],a[o-6]);break;case 101:r.commit(a[o],a[o-2],a[o-4],a[o-6]);break;case 102:r.commit(a[o-2],a[o],a[o-4],a[o-6]);break;case 103:r.commit(a[o-4],a[o-2],a[o],a[o-6]);break;case 104:r.commit(a[o-4],a[o],a[o-2],a[o-6]);break;case 105:r.commit(a[o-2],a[o-4],a[o-6],a[o]);break;case 106:r.commit(a[o],a[o-4],a[o-6],a[o-2]);break;case 107:r.commit(a[o-2],a[o],a[o-6],a[o-4]);break;case 108:r.commit(a[o],a[o-2],a[o-6],a[o-4]);break;case 109:r.commit(a[o-4],a[o-2],a[o-6],a[o]);break;case 110:r.commit(a[o-4],a[o],a[o-6],a[o-2]);break;case 111:this.$="";break;case 112:this.$=a[o];break;case 113:this.$=r.commitType.NORMAL;break;case 114:this.$=r.commitType.REVERSE;break;case 115:this.$=r.commitType.HIGHLIGHT;break;case 118:r.parseDirective("%%{","open_directive");break;case 119:r.parseDirective(a[o],"type_directive");break;case 120:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 121:r.parseDirective("}%%","close_directive","gitGraph")}},table:[{3:1,4:2,5:3,6:n,8:r,14:i,46:8,50:a,55:s},{1:[3]},{3:10,4:2,5:3,6:n,8:r,14:i,46:8,50:a,55:s},{3:11,4:2,5:3,6:n,8:r,14:i,46:8,50:a,55:s},{7:12,8:o,9:[1,13],10:[1,14],11:15,14:c},e(l,[2,124]),e(l,[2,125]),e(l,[2,126]),{47:17,51:[1,18]},{51:[2,118]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:o,11:15,14:c},{9:[1,21]},e(h,[2,10],{12:22,13:[1,23]}),e(u,[2,9]),{9:[1,25],48:24,53:d},e([9,53],[2,119]),{1:[2,3]},{8:[1,27]},{7:28,8:o,11:15,14:c},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],37:[1,42],40:[1,41]},e(u,[2,8]),e(p,[2,116]),{49:45,52:[1,46]},e(p,[2,121]),{1:[2,4]},{8:[1,47]},e(h,[2,11]),{4:48,8:r,14:i,55:s},e(h,[2,13]),e(f,[2,14]),e(f,[2,15]),e(f,[2,16]),{21:[1,49]},{23:[1,50]},e(f,[2,19]),e(f,[2,20]),e(f,[2,21]),{28:51,34:g,54:y},e(f,[2,111],{41:54,33:[1,57],34:[1,59],35:[1,55],38:[1,56],42:[1,58]}),{28:60,34:g,54:y},{33:[1,61],35:[1,62]},{28:63,34:g,54:y},{48:64,53:d},{53:[2,120]},{1:[2,5]},e(h,[2,12]),e(f,[2,17]),e(f,[2,18]),e(f,[2,22]),e(m,[2,122]),e(m,[2,123]),e(f,[2,46]),{34:[1,65]},{39:66,43:b,44:_,45:x},{34:[1,70]},{34:[1,71]},e(f,[2,112]),e(f,[2,30],{33:[1,72],35:[1,74],38:[1,73]}),{34:[1,75]},{34:[1,76],36:[1,77]},e(f,[2,23],{30:[1,78]}),e(p,[2,117]),e(f,[2,47],{33:[1,80],38:[1,79],42:[1,81]}),e(f,[2,48],{33:[1,83],35:[1,82],42:[1,84]}),e(v,[2,113]),e(v,[2,114]),e(v,[2,115]),e(f,[2,51],{35:[1,85],38:[1,86],42:[1,87]}),e(f,[2,62],{33:[1,90],35:[1,88],38:[1,89]}),{34:[1,91]},{39:92,43:b,44:_,45:x},{34:[1,93]},e(f,[2,25],{35:[1,94]}),{33:[1,95]},{33:[1,96]},{31:[1,97]},{39:98,43:b,44:_,45:x},{34:[1,99]},{34:[1,100]},{34:[1,101]},{34:[1,102]},{34:[1,103]},{34:[1,104]},{39:105,43:b,44:_,45:x},{34:[1,106]},{34:[1,107]},{39:108,43:b,44:_,45:x},{34:[1,109]},e(f,[2,31],{35:[1,111],38:[1,110]}),e(f,[2,32],{33:[1,113],35:[1,112]}),e(f,[2,33],{33:[1,114],38:[1,115]}),{34:[1,116],36:[1,117]},{34:[1,118]},{34:[1,119]},e(f,[2,24]),e(f,[2,49],{33:[1,120],42:[1,121]}),e(f,[2,53],{38:[1,122],42:[1,123]}),e(f,[2,63],{33:[1,125],38:[1,124]}),e(f,[2,50],{33:[1,126],42:[1,127]}),e(f,[2,55],{35:[1,128],42:[1,129]}),e(f,[2,66],{33:[1,131],35:[1,130]}),e(f,[2,52],{38:[1,132],42:[1,133]}),e(f,[2,54],{35:[1,134],42:[1,135]}),e(f,[2,67],{35:[1,137],38:[1,136]}),e(f,[2,64],{33:[1,139],38:[1,138]}),e(f,[2,65],{33:[1,141],35:[1,140]}),e(f,[2,68],{35:[1,143],38:[1,142]}),{39:144,43:b,44:_,45:x},{34:[1,145]},{34:[1,146]},{34:[1,147]},{34:[1,148]},{39:149,43:b,44:_,45:x},e(f,[2,26]),e(f,[2,27]),e(f,[2,28]),e(f,[2,29]),{34:[1,150]},{34:[1,151]},{39:152,43:b,44:_,45:x},{34:[1,153]},{39:154,43:b,44:_,45:x},{34:[1,155]},{34:[1,156]},{34:[1,157]},{34:[1,158]},{34:[1,159]},{34:[1,160]},{34:[1,161]},{39:162,43:b,44:_,45:x},{34:[1,163]},{34:[1,164]},{34:[1,165]},{39:166,43:b,44:_,45:x},{34:[1,167]},{39:168,43:b,44:_,45:x},{34:[1,169]},{34:[1,170]},{34:[1,171]},{39:172,43:b,44:_,45:x},{34:[1,173]},e(f,[2,37],{35:[1,174]}),e(f,[2,38],{38:[1,175]}),e(f,[2,36],{33:[1,176]}),e(f,[2,39],{35:[1,177]}),e(f,[2,34],{38:[1,178]}),e(f,[2,35],{33:[1,179]}),e(f,[2,60],{42:[1,180]}),e(f,[2,73],{33:[1,181]}),e(f,[2,61],{42:[1,182]}),e(f,[2,84],{38:[1,183]}),e(f,[2,74],{33:[1,184]}),e(f,[2,83],{38:[1,185]}),e(f,[2,59],{42:[1,186]}),e(f,[2,72],{33:[1,187]}),e(f,[2,58],{42:[1,188]}),e(f,[2,78],{35:[1,189]}),e(f,[2,71],{33:[1,190]}),e(f,[2,77],{35:[1,191]}),e(f,[2,57],{42:[1,192]}),e(f,[2,85],{38:[1,193]}),e(f,[2,56],{42:[1,194]}),e(f,[2,79],{35:[1,195]}),e(f,[2,80],{35:[1,196]}),e(f,[2,86],{38:[1,197]}),e(f,[2,70],{33:[1,198]}),e(f,[2,81],{38:[1,199]}),e(f,[2,69],{33:[1,200]}),e(f,[2,75],{35:[1,201]}),e(f,[2,76],{35:[1,202]}),e(f,[2,82],{38:[1,203]}),{34:[1,204]},{39:205,43:b,44:_,45:x},{34:[1,206]},{34:[1,207]},{39:208,43:b,44:_,45:x},{34:[1,209]},{34:[1,210]},{34:[1,211]},{34:[1,212]},{39:213,43:b,44:_,45:x},{34:[1,214]},{39:215,43:b,44:_,45:x},{34:[1,216]},{34:[1,217]},{34:[1,218]},{34:[1,219]},{34:[1,220]},{34:[1,221]},{34:[1,222]},{39:223,43:b,44:_,45:x},{34:[1,224]},{34:[1,225]},{34:[1,226]},{39:227,43:b,44:_,45:x},{34:[1,228]},{39:229,43:b,44:_,45:x},{34:[1,230]},{34:[1,231]},{34:[1,232]},{39:233,43:b,44:_,45:x},e(f,[2,40]),e(f,[2,42]),e(f,[2,41]),e(f,[2,43]),e(f,[2,45]),e(f,[2,44]),e(f,[2,101]),e(f,[2,102]),e(f,[2,99]),e(f,[2,100]),e(f,[2,104]),e(f,[2,103]),e(f,[2,108]),e(f,[2,107]),e(f,[2,106]),e(f,[2,105]),e(f,[2,110]),e(f,[2,109]),e(f,[2,98]),e(f,[2,97]),e(f,[2,96]),e(f,[2,95]),e(f,[2,93]),e(f,[2,94]),e(f,[2,92]),e(f,[2,91]),e(f,[2,90]),e(f,[2,89]),e(f,[2,87]),e(f,[2,88])],defaultActions:{9:[2,118],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,120],47:[2,5]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},w=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),50;case 1:return this.begin("type_directive"),51;case 2:return this.popState(),this.begin("arg_directive"),9;case 3:return this.popState(),this.popState(),53;case 4:return 52;case 5:return this.begin("acc_title"),20;case 6:return this.popState(),"acc_title_value";case 7:return this.begin("acc_descr"),22;case 8:return this.popState(),"acc_descr_value";case 9:this.begin("acc_descr_multiline");break;case 10:case 34:case 38:this.popState();break;case 11:return"acc_descr_multiline_value";case 12:return 14;case 13:case 14:break;case 15:return 6;case 16:return 40;case 17:return 33;case 18:return 38;case 19:return 42;case 20:return 43;case 21:return 44;case 22:return 45;case 23:return 35;case 24:return 29;case 25:return 30;case 26:return 37;case 27:return 32;case 28:return 27;case 29:case 30:return 10;case 31:return 9;case 32:return"CARET";case 33:this.begin("options");break;case 35:return 13;case 36:return 36;case 37:this.begin("string");break;case 39:return 34;case 40:return 31;case 41:return 54;case 42:return 8}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit(?=\s|$))/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\b)/i,/^(?:REVERSE\b)/i,/^(?:HIGHLIGHT\b)/i,/^(?:tag:)/i,/^(?:branch(?=\s|$))/i,/^(?:order:)/i,/^(?:merge(?=\s|$))/i,/^(?:cherry-pick(?=\s|$))/i,/^(?:checkout(?=\s|$))/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:[ \r\n\t]+end\b)/i,/^(?:[\s\S]+(?=[ \r\n\t]+end))/i,/^(?:["]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[0-9]+(?=\s|$))/i,/^(?:\w([-\./\w]*[-\w])?)/i,/^(?:$)/i,/^(?:\s+)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},options:{rules:[34,35],inclusive:!1},string:{rules:[38,39],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,36,37,40,41,42,43],inclusive:!0}}},t);function C(){this.yy={}}return k.lexer=w,C.prototype=k,k.Parser=C,new C}();ai.parser=ai;const si=ai,oi=t=>null!==t.match(/^\s*gitGraph/);let ci=ur().gitGraph.mainBranchName,li=ur().gitGraph.mainBranchOrder,hi={},ui=null,di={};di[ci]={name:ci,order:li};let pi={};pi[ci]=ui;let fi=ci,gi="LR",yi=0;function mi(){return zn({length:7})}let bi={};const _i=function(t){if(t=jt.sanitizeText(t,ur()),void 0===pi[t]){let e=new Error('Trying to checkout branch which is not yet created. (Help try using "branch '+t+'")');throw e.hash={text:"checkout "+t,token:"checkout "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"branch '+t+'"']},e}{fi=t;const e=pi[fi];ui=hi[e]}};function xi(t,e,n){const r=t.indexOf(e);-1===r?t.push(n):t.splice(r,1,n)}function vi(t){const e=t.reduce(((t,e)=>t.seq>e.seq?t:e),t[0]);let n="";t.forEach((function(t){n+=t===e?"\t*":"\t|"}));const r=[n,e.id,e.seq];for(let i in pi)pi[i]===e.id&&r.push(i);if(Bt.debug(r.join(" ")),e.parents&&2==e.parents.length){const n=hi[e.parents[0]];xi(t,e,n),t.push(hi[e.parents[1]])}else{if(0==e.parents.length)return;{const n=hi[e.parents];xi(t,e,n)}}vi(t=function(t,e){const n=Object.create(null);return t.reduce(((t,r)=>{const i=e(r);return n[i]||(n[i]=!0,t.push(r)),t}),[])}(t,(t=>t.id)))}const ki=function(){const t=Object.keys(hi).map((function(t){return hi[t]}));return t.forEach((function(t){Bt.debug(t.id)})),t.sort(((t,e)=>t.seq-e.seq)),t},wi={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Ci={parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().gitGraph,setDirection:function(t){gi=t},setOptions:function(t){Bt.debug("options str",t),t=(t=t&&t.trim())||"{}";try{bi=JSON.parse(t)}catch(e){Bt.error("error while parsing gitGraph options",e.message)}},getOptions:function(){return bi},commit:function(t,e,n,r){Bt.debug("Entering commit:",t,e,n,r),e=jt.sanitizeText(e,ur()),t=jt.sanitizeText(t,ur()),r=jt.sanitizeText(r,ur());const i={id:e||yi+"-"+mi(),message:t,seq:yi++,type:n||wi.NORMAL,tag:r||"",parents:null==ui?[]:[ui.id],branch:fi};ui=i,hi[i.id]=i,pi[fi]=i.id,Bt.debug("in pushCommit "+i.id)},branch:function(t,e){if(t=jt.sanitizeText(t,ur()),void 0!==pi[t]){let e=new Error('Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout '+t+'")');throw e.hash={text:"branch "+t,token:"branch "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+t+'"']},e}pi[t]=null!=ui?ui.id:null,di[t]={name:t,order:e?parseInt(e,10):null},_i(t),Bt.debug("in createBranch")},merge:function(t,e,n,r){t=jt.sanitizeText(t,ur()),e=jt.sanitizeText(e,ur());const i=hi[pi[fi]],a=hi[pi[t]];if(fi===t){let e=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["branch abc"]},e}if(void 0===i||!i){let e=new Error('Incorrect usage of "merge". Current branch ('+fi+")has no commits");throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["commit"]},e}if(void 0===pi[t]){let e=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["branch "+t]},e}if(void 0===a||!a){let e=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"commit"']},e}if(i===a){let e=new Error('Incorrect usage of "merge". Both branches have same head');throw e.hash={text:"merge "+t,token:"merge "+t,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["branch abc"]},e}if(e&&void 0!==hi[e]){let i=new Error('Incorrect usage of "merge". Commit with id:'+e+" already exists, use different custom Id");throw i.hash={text:"merge "+t+e+n+r,token:"merge "+t+e+n+r,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["merge "+t+" "+e+"_UNIQUE "+n+" "+r]},i}const s={id:e||yi+"-"+mi(),message:"merged branch "+t+" into "+fi,seq:yi++,parents:[null==ui?null:ui.id,pi[t]],branch:fi,type:wi.MERGE,customType:n,customId:!!e,tag:r||""};ui=s,hi[s.id]=s,pi[fi]=s.id,Bt.debug(pi),Bt.debug("in mergeBranch")},cherryPick:function(t,e,n){if(Bt.debug("Entering cherryPick:",t,e,n),t=jt.sanitizeText(t,ur()),e=jt.sanitizeText(e,ur()),n=jt.sanitizeText(n,ur()),!t||void 0===hi[t]){let n=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}let r=hi[t],i=r.branch;if(r.type===wi.MERGE){let n=new Error('Incorrect usage of "cherryPick". Source commit should not be a merge commit');throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}if(!e||void 0===hi[e]){if(i===fi){let n=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}const a=hi[pi[fi]];if(void 0===a||!a){let n=new Error('Incorrect usage of "cherry-pick". Current branch ('+fi+")has no commits");throw n.hash={text:"cherryPick "+t+" "+e,token:"cherryPick "+t+" "+e,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["cherry-pick abc"]},n}const s={id:yi+"-"+mi(),message:"cherry-picked "+r+" into "+fi,seq:yi++,parents:[null==ui?null:ui.id,r.id],branch:fi,type:wi.CHERRY_PICK,tag:n??"cherry-pick:"+r.id};ui=s,hi[s.id]=s,pi[fi]=s.id,Bt.debug(pi),Bt.debug("in cherryPick")}},checkout:_i,prettyPrint:function(){Bt.debug(hi);vi([ki()[0]])},clear:function(){hi={},ui=null;let t=ur().gitGraph.mainBranchName,e=ur().gitGraph.mainBranchOrder;pi={},pi[t]=null,di={},di[t]={name:t,order:e},fi=t,yi=0,Rr()},getBranchesAsObjArray:function(){const t=Object.values(di).map(((t,e)=>null!==t.order?t:{...t,order:parseFloat(`0.${e}`,10)})).sort(((t,e)=>t.order-e.order)).map((({name:t})=>({name:t})));return t},getBranches:function(){return pi},getCommits:function(){return hi},getCommitsArray:ki,getCurrentBranch:function(){return fi},getDirection:function(){return gi},getHead:function(){return ui},setAccTitle:Zr,getAccTitle:Pr,getAccDescription:Yr,setAccDescription:jr,setDiagramTitle:zr,getDiagramTitle:Ur,commitType:wi};let Ei={};const Ti=0,Si=1,Ai=2,Li=3,Bi=4;let Ni={},Di={},Oi=[],Mi=0;const Ii=(t,e,n)=>{const r=Kr().gitGraph,i=t.append("g").attr("class","commit-bullets"),a=t.append("g").attr("class","commit-labels");let s=0;Object.keys(e).sort(((t,n)=>e[t].seq-e[n].seq)).forEach((t=>{const o=e[t],c=Ni[o.branch].pos,l=s+10;if(n){let t,e=void 0!==o.customType&&""!==o.customType?o.customType:o.type;switch(e){case Ti:t="commit-normal";break;case Si:t="commit-reverse";break;case Ai:t="commit-highlight";break;case Li:t="commit-merge";break;case Bi:t="commit-cherry-pick";break;default:t="commit-normal"}if(e===Ai){const e=i.append("rect");e.attr("x",l-10),e.attr("y",c-10),e.attr("height",20),e.attr("width",20),e.attr("class",`commit ${o.id} commit-highlight${Ni[o.branch].index%8} ${t}-outer`),i.append("rect").attr("x",l-6).attr("y",c-6).attr("height",12).attr("width",12).attr("class",`commit ${o.id} commit${Ni[o.branch].index%8} ${t}-inner`)}else if(e===Bi)i.append("circle").attr("cx",l).attr("cy",c).attr("r",10).attr("class",`commit ${o.id} ${t}`),i.append("circle").attr("cx",l-3).attr("cy",c+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${o.id} ${t}`),i.append("circle").attr("cx",l+3).attr("cy",c+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${o.id} ${t}`),i.append("line").attr("x1",l+3).attr("y1",c+1).attr("x2",l).attr("y2",c-5).attr("stroke","#fff").attr("class",`commit ${o.id} ${t}`),i.append("line").attr("x1",l-3).attr("y1",c+1).attr("x2",l).attr("y2",c-5).attr("stroke","#fff").attr("class",`commit ${o.id} ${t}`);else{const n=i.append("circle");if(n.attr("cx",l),n.attr("cy",c),n.attr("r",o.type===Li?9:10),n.attr("class",`commit ${o.id} commit${Ni[o.branch].index%8}`),e===Li){const e=i.append("circle");e.attr("cx",l),e.attr("cy",c),e.attr("r",6),e.attr("class",`commit ${t} ${o.id} commit${Ni[o.branch].index%8}`)}if(e===Si){i.append("path").attr("d",`M ${l-5},${c-5}L${l+5},${c+5}M${l-5},${c+5}L${l+5},${c-5}`).attr("class",`commit ${t} ${o.id} commit${Ni[o.branch].index%8}`)}}}if(Di[o.id]={x:s+10,y:c},n){const t=4,e=2;if(o.type!==Bi&&(o.customId&&o.type===Li||o.type!==Li)&&r.showCommitLabel){const t=a.append("g"),n=t.insert("rect").attr("class","commit-label-bkg"),i=t.append("text").attr("x",s).attr("y",c+25).attr("class","commit-label").text(o.id);let l=i.node().getBBox();if(n.attr("x",s+10-l.width/2-e).attr("y",c+13.5).attr("width",l.width+2*e).attr("height",l.height+2*e),i.attr("x",s+10-l.width/2),r.rotateCommitLabel){let e=-7.5-(l.width+10)/25*9.5,n=10+l.width/25*8.5;t.attr("transform","translate("+e+", "+n+") rotate("+"-45, "+s+", "+c+")")}}if(o.tag){const n=a.insert("polygon"),r=a.append("circle"),i=a.append("text").attr("y",c-16).attr("class","tag-label").text(o.tag);let l=i.node().getBBox();i.attr("x",s+10-l.width/2);const h=l.height/2,u=c-19.2;n.attr("class","tag-label-bkg").attr("points",`\n ${s-l.width/2-t/2},${u+e}\n ${s-l.width/2-t/2},${u-e}\n ${s+10-l.width/2-t},${u-h-e}\n ${s+10+l.width/2+t},${u-h-e}\n ${s+10+l.width/2+t},${u+h+e}\n ${s+10-l.width/2-t},${u+h+e}`),r.attr("cx",s-l.width/2+t/2).attr("cy",u).attr("r",1.5).attr("class","tag-hole")}}s+=50,s>Mi&&(Mi=s)}))},Fi=(t,e,n=0)=>{const r=t+Math.abs(t-e)/2;if(n>5)return r;if(Oi.every((t=>Math.abs(t-r)>=10)))return Oi.push(r),r;const i=Math.abs(t-e);return Fi(t,e-i/5,n+1)},$i=(t,e,n,r)=>{const i=Di[e.id],a=Di[n.id],s=((t,e,n)=>Object.keys(n).filter((r=>n[r].branch===e.branch&&n[r].seq>t.seq&&n[r].seq<e.seq)).length>0)(e,n,r);let o,c="",l="",h=0,u=0,d=Ni[n.branch].index;if(s){c="A 10 10, 0, 0, 0,",l="A 10 10, 0, 0, 1,",h=10,u=10,d=Ni[n.branch].index;const t=i.y<a.y?Fi(i.y,a.y):Fi(a.y,i.y);o=i.y<a.y?`M ${i.x} ${i.y} L ${i.x} ${t-h} ${c} ${i.x+u} ${t} L ${a.x-h} ${t} ${l} ${a.x} ${t+u} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${i.x} ${t+h} ${l} ${i.x+u} ${t} L ${a.x-h} ${t} ${c} ${a.x} ${t-u} L ${a.x} ${a.y}`}else i.y<a.y&&(c="A 20 20, 0, 0, 0,",h=20,u=20,d=Ni[n.branch].index,o=`M ${i.x} ${i.y} L ${i.x} ${a.y-h} ${c} ${i.x+u} ${a.y} L ${a.x} ${a.y}`),i.y>a.y&&(c="A 20 20, 0, 0, 0,",h=20,u=20,d=Ni[e.branch].index,o=`M ${i.x} ${i.y} L ${a.x-h} ${i.y} ${c} ${a.x} ${i.y-u} L ${a.x} ${a.y}`),i.y===a.y&&(d=Ni[e.branch].index,o=`M ${i.x} ${i.y} L ${i.x} ${a.y-h} ${c} ${i.x+u} ${a.y} L ${a.x} ${a.y}`);t.append("path").attr("d",o).attr("class","arrow arrow"+d%8)},Ri=(t,e)=>{const n=Kr().gitGraph,r=t.append("g");e.forEach(((t,e)=>{const i=e%8,a=Ni[t.name].pos,s=r.append("line");s.attr("x1",0),s.attr("y1",a),s.attr("x2",Mi),s.attr("y2",a),s.attr("class","branch branch"+i),Oi.push(a);const o=(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","text");let n=[];n="string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(t)?t:[];for(const r of n){const t=document.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),t.setAttribute("dy","1em"),t.setAttribute("x","0"),t.setAttribute("class","row"),t.textContent=r.trim(),e.appendChild(t)}return e})(t.name),c=r.insert("rect"),l=r.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+i);l.node().appendChild(o);let h=o.getBBox();c.attr("class","branchLabelBkg label"+i).attr("rx",4).attr("ry",4).attr("x",-h.width-4-(!0===n.rotateCommitLabel?30:0)).attr("y",-h.height/2+8).attr("width",h.width+18).attr("height",h.height+4),l.attr("transform","translate("+(-h.width-14-(!0===n.rotateCommitLabel?30:0))+", "+(a-h.height/2-1)+")"),c.attr("transform","translate(-19, "+(a-h.height/2)+")")}))},Zi={draw:function(t,e,n,r){Ni={},Di={},Ei={},Mi=0,Oi=[];const i=Kr(),a=i.gitGraph;Bt.debug("in gitgraph renderer",t+"\n","id:",e,n),Ei=r.db.getCommits();const s=r.db.getBranchesAsObjArray();let c=0;s.forEach(((t,e)=>{Ni[t.name]={pos:c,index:e},c+=50+(a.rotateCommitLabel?40:0)}));const l=(0,o.Ys)(`[id="${e}"]`);Ii(l,Ei,!1),a.showBranches&&Ri(l,s),((t,e)=>{const n=t.append("g").attr("class","commit-arrows");Object.keys(e).forEach((t=>{const r=e[t];r.parents&&r.parents.length>0&&r.parents.forEach((t=>{$i(n,e[t],r,e)}))}))})(l,Ei),Ii(l,Ei,!0),er.insertTitle(l,"gitTitleText",a.titleTopMargin,r.db.getDiagramTitle()),ti(void 0,l,a.diagramPadding,a.useMaxWidth??i.useMaxWidth)}},Pi=t=>`\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n ${[0,1,2,3,4,5,6,7].map((e=>`\n .branch-label${e} { fill: ${t["gitBranchLabel"+e]}; }\n .commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }\n .commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }\n .label${e} { fill: ${t["git"+e]}; }\n .arrow${e} { stroke: ${t["git"+e]}; }\n `)).join("\n")}\n\n .branch {\n stroke-width: 1;\n stroke: ${t.lineColor};\n stroke-dasharray: 2;\n }\n .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}\n .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }\n .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}\n .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }\n .tag-hole { fill: ${t.textColor}; }\n\n .commit-merge {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n .commit-reverse {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n stroke-width: 3;\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n\n .arrow { stroke-width: 8; stroke-linecap: round; fill: none}\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n }\n`;var ji=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,6],r=[1,7],i=[1,8],a=[1,9],s=[1,16],o=[1,11],l=[1,12],h=[1,13],u=[1,14],d=[1,15],p=[1,27],f=[1,33],g=[1,34],y=[1,35],m=[1,36],b=[1,37],_=[1,72],x=[1,73],v=[1,74],k=[1,75],w=[1,76],C=[1,77],E=[1,78],T=[1,38],S=[1,39],A=[1,40],L=[1,41],B=[1,42],N=[1,43],D=[1,44],O=[1,45],M=[1,46],I=[1,47],F=[1,48],$=[1,49],R=[1,50],Z=[1,51],P=[1,52],j=[1,53],Y=[1,54],z=[1,55],U=[1,56],W=[1,57],H=[1,59],q=[1,60],V=[1,61],G=[1,62],X=[1,63],Q=[1,64],K=[1,65],J=[1,66],tt=[1,67],et=[1,68],nt=[1,69],rt=[24,52],it=[24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],at=[15,24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],st=[1,94],ot=[1,95],ct=[1,96],lt=[1,97],ht=[15,24,52],ut=[7,8,9,10,18,22,25,26,27,28],dt=[15,24,43,52],pt=[15,24,43,52,86,87,89,90],ft=[15,43],gt=[44,46,47,48,49,50,51,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],yt={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,directive:6,direction_tb:7,direction_bt:8,direction_rl:9,direction_lr:10,graphConfig:11,openDirective:12,typeDirective:13,closeDirective:14,NEWLINE:15,":":16,argDirective:17,open_directive:18,type_directive:19,arg_directive:20,close_directive:21,C4_CONTEXT:22,statements:23,EOF:24,C4_CONTAINER:25,C4_COMPONENT:26,C4_DYNAMIC:27,C4_DEPLOYMENT:28,otherStatements:29,diagramStatements:30,otherStatement:31,title:32,accDescription:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,boundaryStatement:39,boundaryStartStatement:40,boundaryStopStatement:41,boundaryStart:42,LBRACE:43,ENTERPRISE_BOUNDARY:44,attributes:45,SYSTEM_BOUNDARY:46,BOUNDARY:47,CONTAINER_BOUNDARY:48,NODE:49,NODE_L:50,NODE_R:51,RBRACE:52,diagramStatement:53,PERSON:54,PERSON_EXT:55,SYSTEM:56,SYSTEM_DB:57,SYSTEM_QUEUE:58,SYSTEM_EXT:59,SYSTEM_EXT_DB:60,SYSTEM_EXT_QUEUE:61,CONTAINER:62,CONTAINER_DB:63,CONTAINER_QUEUE:64,CONTAINER_EXT:65,CONTAINER_EXT_DB:66,CONTAINER_EXT_QUEUE:67,COMPONENT:68,COMPONENT_DB:69,COMPONENT_QUEUE:70,COMPONENT_EXT:71,COMPONENT_EXT_DB:72,COMPONENT_EXT_QUEUE:73,REL:74,BIREL:75,REL_U:76,REL_D:77,REL_L:78,REL_R:79,REL_B:80,REL_INDEX:81,UPDATE_EL_STYLE:82,UPDATE_REL_STYLE:83,UPDATE_LAYOUT_CONFIG:84,attribute:85,STR:86,STR_KEY:87,STR_VALUE:88,ATTRIBUTE:89,ATTRIBUTE_EMPTY:90,$accept:0,$end:1},terminals_:{2:"error",7:"direction_tb",8:"direction_bt",9:"direction_rl",10:"direction_lr",15:"NEWLINE",16:":",18:"open_directive",19:"type_directive",20:"arg_directive",21:"close_directive",22:"C4_CONTEXT",24:"EOF",25:"C4_CONTAINER",26:"C4_COMPONENT",27:"C4_DYNAMIC",28:"C4_DEPLOYMENT",32:"title",33:"accDescription",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",43:"LBRACE",44:"ENTERPRISE_BOUNDARY",46:"SYSTEM_BOUNDARY",47:"BOUNDARY",48:"CONTAINER_BOUNDARY",49:"NODE",50:"NODE_L",51:"NODE_R",52:"RBRACE",54:"PERSON",55:"PERSON_EXT",56:"SYSTEM",57:"SYSTEM_DB",58:"SYSTEM_QUEUE",59:"SYSTEM_EXT",60:"SYSTEM_EXT_DB",61:"SYSTEM_EXT_QUEUE",62:"CONTAINER",63:"CONTAINER_DB",64:"CONTAINER_QUEUE",65:"CONTAINER_EXT",66:"CONTAINER_EXT_DB",67:"CONTAINER_EXT_QUEUE",68:"COMPONENT",69:"COMPONENT_DB",70:"COMPONENT_QUEUE",71:"COMPONENT_EXT",72:"COMPONENT_EXT_DB",73:"COMPONENT_EXT_QUEUE",74:"REL",75:"BIREL",76:"REL_U",77:"REL_D",78:"REL_L",79:"REL_R",80:"REL_B",81:"REL_INDEX",82:"UPDATE_EL_STYLE",83:"UPDATE_REL_STYLE",84:"UPDATE_LAYOUT_CONFIG",86:"STR",87:"STR_KEY",88:"STR_VALUE",89:"ATTRIBUTE",90:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:r.setDirection("TB");break;case 5:r.setDirection("BT");break;case 6:r.setDirection("RL");break;case 7:r.setDirection("LR");break;case 11:r.parseDirective("%%{","open_directive");break;case 12:break;case 13:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 14:r.parseDirective("}%%","close_directive","c4Context");break;case 15:case 16:case 17:case 18:case 19:r.setC4Type(a[o-3]);break;case 26:r.setTitle(a[o].substring(6)),this.$=a[o].substring(6);break;case 27:r.setAccDescription(a[o].substring(15)),this.$=a[o].substring(15);break;case 28:this.$=a[o].trim(),r.setTitle(this.$);break;case 29:case 30:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 35:case 36:a[o].splice(2,0,"ENTERPRISE"),r.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 37:r.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 38:a[o].splice(2,0,"CONTAINER"),r.addContainerBoundary(...a[o]),this.$=a[o];break;case 39:r.addDeploymentNode("node",...a[o]),this.$=a[o];break;case 40:r.addDeploymentNode("nodeL",...a[o]),this.$=a[o];break;case 41:r.addDeploymentNode("nodeR",...a[o]),this.$=a[o];break;case 42:r.popBoundaryParseStack();break;case 46:r.addPersonOrSystem("person",...a[o]),this.$=a[o];break;case 47:r.addPersonOrSystem("external_person",...a[o]),this.$=a[o];break;case 48:r.addPersonOrSystem("system",...a[o]),this.$=a[o];break;case 49:r.addPersonOrSystem("system_db",...a[o]),this.$=a[o];break;case 50:r.addPersonOrSystem("system_queue",...a[o]),this.$=a[o];break;case 51:r.addPersonOrSystem("external_system",...a[o]),this.$=a[o];break;case 52:r.addPersonOrSystem("external_system_db",...a[o]),this.$=a[o];break;case 53:r.addPersonOrSystem("external_system_queue",...a[o]),this.$=a[o];break;case 54:r.addContainer("container",...a[o]),this.$=a[o];break;case 55:r.addContainer("container_db",...a[o]),this.$=a[o];break;case 56:r.addContainer("container_queue",...a[o]),this.$=a[o];break;case 57:r.addContainer("external_container",...a[o]),this.$=a[o];break;case 58:r.addContainer("external_container_db",...a[o]),this.$=a[o];break;case 59:r.addContainer("external_container_queue",...a[o]),this.$=a[o];break;case 60:r.addComponent("component",...a[o]),this.$=a[o];break;case 61:r.addComponent("component_db",...a[o]),this.$=a[o];break;case 62:r.addComponent("component_queue",...a[o]),this.$=a[o];break;case 63:r.addComponent("external_component",...a[o]),this.$=a[o];break;case 64:r.addComponent("external_component_db",...a[o]),this.$=a[o];break;case 65:r.addComponent("external_component_queue",...a[o]),this.$=a[o];break;case 67:r.addRel("rel",...a[o]),this.$=a[o];break;case 68:r.addRel("birel",...a[o]),this.$=a[o];break;case 69:r.addRel("rel_u",...a[o]),this.$=a[o];break;case 70:r.addRel("rel_d",...a[o]),this.$=a[o];break;case 71:r.addRel("rel_l",...a[o]),this.$=a[o];break;case 72:r.addRel("rel_r",...a[o]),this.$=a[o];break;case 73:r.addRel("rel_b",...a[o]),this.$=a[o];break;case 74:a[o].splice(0,1),r.addRel("rel",...a[o]),this.$=a[o];break;case 75:r.updateElStyle("update_el_style",...a[o]),this.$=a[o];break;case 76:r.updateRelStyle("update_rel_style",...a[o]),this.$=a[o];break;case 77:r.updateLayoutConfig("update_layout_config",...a[o]),this.$=a[o];break;case 78:this.$=[a[o]];break;case 79:a[o].unshift(a[o-1]),this.$=a[o];break;case 80:case 82:this.$=a[o].trim();break;case 81:let t={};t[a[o-1].trim()]=a[o].trim(),this.$=t;break;case 83:this.$=""}},table:[{3:1,4:2,5:3,6:4,7:n,8:r,9:i,10:a,11:5,12:10,18:s,22:o,25:l,26:h,27:u,28:d},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:n,8:r,9:i,10:a,11:5,12:10,18:s,22:o,25:l,26:h,27:u,28:d},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:p},e([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:f,33:g,34:y,36:m,38:b,39:58,40:70,42:71,44:_,46:x,47:v,48:k,49:w,50:C,51:E,53:32,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt},{23:79,29:29,30:30,31:31,32:f,33:g,34:y,36:m,38:b,39:58,40:70,42:71,44:_,46:x,47:v,48:k,49:w,50:C,51:E,53:32,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt},{23:80,29:29,30:30,31:31,32:f,33:g,34:y,36:m,38:b,39:58,40:70,42:71,44:_,46:x,47:v,48:k,49:w,50:C,51:E,53:32,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt},{23:81,29:29,30:30,31:31,32:f,33:g,34:y,36:m,38:b,39:58,40:70,42:71,44:_,46:x,47:v,48:k,49:w,50:C,51:E,53:32,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt},{23:82,29:29,30:30,31:31,32:f,33:g,34:y,36:m,38:b,39:58,40:70,42:71,44:_,46:x,47:v,48:k,49:w,50:C,51:E,53:32,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},e(rt,[2,20],{53:32,39:58,40:70,42:71,30:87,44:_,46:x,47:v,48:k,49:w,50:C,51:E,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt}),e(rt,[2,21]),e(it,[2,23],{15:[1,88]}),e(rt,[2,43],{15:[1,89]}),e(at,[2,26]),e(at,[2,27]),{35:[1,90]},{37:[1,91]},e(at,[2,30]),{45:92,85:93,86:st,87:ot,89:ct,90:lt},{45:98,85:93,86:st,87:ot,89:ct,90:lt},{45:99,85:93,86:st,87:ot,89:ct,90:lt},{45:100,85:93,86:st,87:ot,89:ct,90:lt},{45:101,85:93,86:st,87:ot,89:ct,90:lt},{45:102,85:93,86:st,87:ot,89:ct,90:lt},{45:103,85:93,86:st,87:ot,89:ct,90:lt},{45:104,85:93,86:st,87:ot,89:ct,90:lt},{45:105,85:93,86:st,87:ot,89:ct,90:lt},{45:106,85:93,86:st,87:ot,89:ct,90:lt},{45:107,85:93,86:st,87:ot,89:ct,90:lt},{45:108,85:93,86:st,87:ot,89:ct,90:lt},{45:109,85:93,86:st,87:ot,89:ct,90:lt},{45:110,85:93,86:st,87:ot,89:ct,90:lt},{45:111,85:93,86:st,87:ot,89:ct,90:lt},{45:112,85:93,86:st,87:ot,89:ct,90:lt},{45:113,85:93,86:st,87:ot,89:ct,90:lt},{45:114,85:93,86:st,87:ot,89:ct,90:lt},{45:115,85:93,86:st,87:ot,89:ct,90:lt},{45:116,85:93,86:st,87:ot,89:ct,90:lt},e(ht,[2,66]),{45:117,85:93,86:st,87:ot,89:ct,90:lt},{45:118,85:93,86:st,87:ot,89:ct,90:lt},{45:119,85:93,86:st,87:ot,89:ct,90:lt},{45:120,85:93,86:st,87:ot,89:ct,90:lt},{45:121,85:93,86:st,87:ot,89:ct,90:lt},{45:122,85:93,86:st,87:ot,89:ct,90:lt},{45:123,85:93,86:st,87:ot,89:ct,90:lt},{45:124,85:93,86:st,87:ot,89:ct,90:lt},{45:125,85:93,86:st,87:ot,89:ct,90:lt},{45:126,85:93,86:st,87:ot,89:ct,90:lt},{45:127,85:93,86:st,87:ot,89:ct,90:lt},{30:128,39:58,40:70,42:71,44:_,46:x,47:v,48:k,49:w,50:C,51:E,53:32,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt},{15:[1,130],43:[1,129]},{45:131,85:93,86:st,87:ot,89:ct,90:lt},{45:132,85:93,86:st,87:ot,89:ct,90:lt},{45:133,85:93,86:st,87:ot,89:ct,90:lt},{45:134,85:93,86:st,87:ot,89:ct,90:lt},{45:135,85:93,86:st,87:ot,89:ct,90:lt},{45:136,85:93,86:st,87:ot,89:ct,90:lt},{45:137,85:93,86:st,87:ot,89:ct,90:lt},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},e(ut,[2,9]),{14:142,21:p},{21:[2,13]},{1:[2,15]},e(rt,[2,22]),e(it,[2,24],{31:31,29:143,32:f,33:g,34:y,36:m,38:b}),e(rt,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:f,33:g,34:y,36:m,38:b,44:_,46:x,47:v,48:k,49:w,50:C,51:E,54:T,55:S,56:A,57:L,58:B,59:N,60:D,61:O,62:M,63:I,64:F,65:$,66:R,67:Z,68:P,69:j,70:Y,71:z,72:U,73:W,74:H,75:q,76:V,77:G,78:X,79:Q,80:K,81:J,82:tt,83:et,84:nt}),e(at,[2,28]),e(at,[2,29]),e(ht,[2,46]),e(dt,[2,78],{85:93,45:145,86:st,87:ot,89:ct,90:lt}),e(pt,[2,80]),{88:[1,146]},e(pt,[2,82]),e(pt,[2,83]),e(ht,[2,47]),e(ht,[2,48]),e(ht,[2,49]),e(ht,[2,50]),e(ht,[2,51]),e(ht,[2,52]),e(ht,[2,53]),e(ht,[2,54]),e(ht,[2,55]),e(ht,[2,56]),e(ht,[2,57]),e(ht,[2,58]),e(ht,[2,59]),e(ht,[2,60]),e(ht,[2,61]),e(ht,[2,62]),e(ht,[2,63]),e(ht,[2,64]),e(ht,[2,65]),e(ht,[2,67]),e(ht,[2,68]),e(ht,[2,69]),e(ht,[2,70]),e(ht,[2,71]),e(ht,[2,72]),e(ht,[2,73]),e(ht,[2,74]),e(ht,[2,75]),e(ht,[2,76]),e(ht,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},e(ft,[2,35]),e(ft,[2,36]),e(ft,[2,37]),e(ft,[2,38]),e(ft,[2,39]),e(ft,[2,40]),e(ft,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},e(it,[2,25]),e(rt,[2,45]),e(dt,[2,79]),e(pt,[2,81]),e(ht,[2,31]),e(ht,[2,42]),e(gt,[2,32]),e(gt,[2,33],{15:[1,152]}),e(ut,[2,10]),e(gt,[2,34])],defaultActions:{2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},mt=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),18;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 10;case 5:return this.begin("type_directive"),19;case 6:return this.popState(),this.begin("arg_directive"),16;case 7:return this.popState(),this.popState(),21;case 8:return 20;case 9:return 32;case 10:return 33;case 11:return this.begin("acc_title"),34;case 12:return this.popState(),"acc_title_value";case 13:return this.begin("acc_descr"),36;case 14:return this.popState(),"acc_descr_value";case 15:this.begin("acc_descr_multiline");break;case 16:case 78:this.popState();break;case 17:return"acc_descr_multiline_value";case 18:case 21:case 75:break;case 19:c;break;case 20:return 15;case 22:return 22;case 23:return 25;case 24:return 26;case 25:return 27;case 26:return 28;case 27:return this.begin("person_ext"),55;case 28:return this.begin("person"),54;case 29:return this.begin("system_ext_queue"),61;case 30:return this.begin("system_ext_db"),60;case 31:return this.begin("system_ext"),59;case 32:return this.begin("system_queue"),58;case 33:return this.begin("system_db"),57;case 34:return this.begin("system"),56;case 35:return this.begin("boundary"),47;case 36:return this.begin("enterprise_boundary"),44;case 37:return this.begin("system_boundary"),46;case 38:return this.begin("container_ext_queue"),67;case 39:return this.begin("container_ext_db"),66;case 40:return this.begin("container_ext"),65;case 41:return this.begin("container_queue"),64;case 42:return this.begin("container_db"),63;case 43:return this.begin("container"),62;case 44:return this.begin("container_boundary"),48;case 45:return this.begin("component_ext_queue"),73;case 46:return this.begin("component_ext_db"),72;case 47:return this.begin("component_ext"),71;case 48:return this.begin("component_queue"),70;case 49:return this.begin("component_db"),69;case 50:return this.begin("component"),68;case 51:case 52:return this.begin("node"),49;case 53:return this.begin("node_l"),50;case 54:return this.begin("node_r"),51;case 55:return this.begin("rel"),74;case 56:return this.begin("birel"),75;case 57:case 58:return this.begin("rel_u"),76;case 59:case 60:return this.begin("rel_d"),77;case 61:case 62:return this.begin("rel_l"),78;case 63:case 64:return this.begin("rel_r"),79;case 65:return this.begin("rel_b"),80;case 66:return this.begin("rel_index"),81;case 67:return this.begin("update_el_style"),82;case 68:return this.begin("update_rel_style"),83;case 69:return this.begin("update_layout_config"),84;case 70:return"EOF_IN_STRUCT";case 71:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 72:this.begin("attribute");break;case 73:case 84:this.popState(),this.popState();break;case 74:case 76:return 90;case 77:this.begin("string");break;case 79:case 85:return"STR";case 80:this.begin("string_kv");break;case 81:return this.begin("string_kv_key"),"STR_KEY";case 82:this.popState(),this.begin("string_kv_value");break;case 83:return"STR_VALUE";case 86:return"LBRACE";case 87:return"RBRACE";case 88:return"SPACE";case 89:return"EOL";case 90:return 24}},rules:[/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},string_kv_value:{rules:[83,84],inclusive:!1},string_kv_key:{rules:[82],inclusive:!1},string_kv:{rules:[81],inclusive:!1},string:{rules:[78,79],inclusive:!1},attribute:{rules:[73,74,75,76,77,80,85],inclusive:!1},update_layout_config:{rules:[70,71,72,73],inclusive:!1},update_rel_style:{rules:[70,71,72,73],inclusive:!1},update_el_style:{rules:[70,71,72,73],inclusive:!1},rel_b:{rules:[70,71,72,73],inclusive:!1},rel_r:{rules:[70,71,72,73],inclusive:!1},rel_l:{rules:[70,71,72,73],inclusive:!1},rel_d:{rules:[70,71,72,73],inclusive:!1},rel_u:{rules:[70,71,72,73],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[70,71,72,73],inclusive:!1},node_r:{rules:[70,71,72,73],inclusive:!1},node_l:{rules:[70,71,72,73],inclusive:!1},node:{rules:[70,71,72,73],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[70,71,72,73],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[70,71,72,73],inclusive:!1},component_ext:{rules:[70,71,72,73],inclusive:!1},component_queue:{rules:[70,71,72,73],inclusive:!1},component_db:{rules:[70,71,72,73],inclusive:!1},component:{rules:[70,71,72,73],inclusive:!1},container_boundary:{rules:[70,71,72,73],inclusive:!1},container_ext_queue:{rules:[],inclusive:!1},container_ext_db:{rules:[70,71,72,73],inclusive:!1},container_ext:{rules:[70,71,72,73],inclusive:!1},container_queue:{rules:[70,71,72,73],inclusive:!1},container_db:{rules:[70,71,72,73],inclusive:!1},container:{rules:[70,71,72,73],inclusive:!1},birel:{rules:[70,71,72,73],inclusive:!1},system_boundary:{rules:[70,71,72,73],inclusive:!1},enterprise_boundary:{rules:[70,71,72,73],inclusive:!1},boundary:{rules:[70,71,72,73],inclusive:!1},system_ext_queue:{rules:[70,71,72,73],inclusive:!1},system_ext_db:{rules:[70,71,72,73],inclusive:!1},system_ext:{rules:[70,71,72,73],inclusive:!1},system_queue:{rules:[70,71,72,73],inclusive:!1},system_db:{rules:[70,71,72,73],inclusive:!1},system:{rules:[70,71,72,73],inclusive:!1},person_ext:{rules:[70,71,72,73],inclusive:!1},person:{rules:[70,71,72,73],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,87,88,89,90],inclusive:!0}}},t);function bt(){this.yy={}}return yt.lexer=mt,bt.prototype=yt,yt.Parser=bt,new bt}();ji.parser=ji;const Yi=ji,zi=t=>null!==t.match(/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/);let Ui=[],Wi=[""],Hi="global",qi="",Vi=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Gi=[],Xi="",Qi=!1,Ki=4,Ji=2;var ta;const ea=function(t){return null==t?Ui:Ui.filter((e=>e.parentBoundary===t))},na=function(){return Qi},ra={addPersonOrSystem:function(t,e,n,r,i,a,s){if(null===e||null===n)return;let o={};const c=Ui.find((t=>t.alias===e));if(c&&e===c.alias?o=c:(o.alias=e,Ui.push(o)),o.label=null==n?{text:""}:{text:n},null==r)o.descr={text:""};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]={text:e}}else o.descr={text:r};if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]=e}else o.sprite=i;if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]=e}else o.tags=a;if("object"==typeof s){let[t,e]=Object.entries(s)[0];o[t]=e}else o.link=s;o.typeC4Shape={text:t},o.parentBoundary=Hi,o.wrap=na()},addPersonOrSystemBoundary:function(t,e,n,r,i){if(null===t||null===e)return;let a={};const s=Vi.find((e=>e.alias===t));if(s&&t===s.alias?a=s:(a.alias=t,Vi.push(a)),a.label=null==e?{text:""}:{text:e},null==n)a.type={text:"system"};else if("object"==typeof n){let[t,e]=Object.entries(n)[0];a[t]={text:e}}else a.type={text:n};if("object"==typeof r){let[t,e]=Object.entries(r)[0];a[t]=e}else a.tags=r;if("object"==typeof i){let[t,e]=Object.entries(i)[0];a[t]=e}else a.link=i;a.parentBoundary=Hi,a.wrap=na(),qi=Hi,Hi=t,Wi.push(qi)},addContainer:function(t,e,n,r,i,a,s,o){if(null===e||null===n)return;let c={};const l=Ui.find((t=>t.alias===e));if(l&&e===l.alias?c=l:(c.alias=e,Ui.push(c)),c.label=null==n?{text:""}:{text:n},null==r)c.techn={text:""};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];c[t]={text:e}}else c.techn={text:r};if(null==i)c.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];c[t]={text:e}}else c.descr={text:i};if("object"==typeof a){let[t,e]=Object.entries(a)[0];c[t]=e}else c.sprite=a;if("object"==typeof s){let[t,e]=Object.entries(s)[0];c[t]=e}else c.tags=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];c[t]=e}else c.link=o;c.wrap=na(),c.typeC4Shape={text:t},c.parentBoundary=Hi},addContainerBoundary:function(t,e,n,r,i){if(null===t||null===e)return;let a={};const s=Vi.find((e=>e.alias===t));if(s&&t===s.alias?a=s:(a.alias=t,Vi.push(a)),a.label=null==e?{text:""}:{text:e},null==n)a.type={text:"container"};else if("object"==typeof n){let[t,e]=Object.entries(n)[0];a[t]={text:e}}else a.type={text:n};if("object"==typeof r){let[t,e]=Object.entries(r)[0];a[t]=e}else a.tags=r;if("object"==typeof i){let[t,e]=Object.entries(i)[0];a[t]=e}else a.link=i;a.parentBoundary=Hi,a.wrap=na(),qi=Hi,Hi=t,Wi.push(qi)},addComponent:function(t,e,n,r,i,a,s,o){if(null===e||null===n)return;let c={};const l=Ui.find((t=>t.alias===e));if(l&&e===l.alias?c=l:(c.alias=e,Ui.push(c)),c.label=null==n?{text:""}:{text:n},null==r)c.techn={text:""};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];c[t]={text:e}}else c.techn={text:r};if(null==i)c.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];c[t]={text:e}}else c.descr={text:i};if("object"==typeof a){let[t,e]=Object.entries(a)[0];c[t]=e}else c.sprite=a;if("object"==typeof s){let[t,e]=Object.entries(s)[0];c[t]=e}else c.tags=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];c[t]=e}else c.link=o;c.wrap=na(),c.typeC4Shape={text:t},c.parentBoundary=Hi},addDeploymentNode:function(t,e,n,r,i,a,s,o){if(null===e||null===n)return;let c={};const l=Vi.find((t=>t.alias===e));if(l&&e===l.alias?c=l:(c.alias=e,Vi.push(c)),c.label=null==n?{text:""}:{text:n},null==r)c.type={text:"node"};else if("object"==typeof r){let[t,e]=Object.entries(r)[0];c[t]={text:e}}else c.type={text:r};if(null==i)c.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];c[t]={text:e}}else c.descr={text:i};if("object"==typeof s){let[t,e]=Object.entries(s)[0];c[t]=e}else c.tags=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];c[t]=e}else c.link=o;c.nodeType=t,c.parentBoundary=Hi,c.wrap=na(),qi=Hi,Hi=e,Wi.push(qi)},popBoundaryParseStack:function(){Hi=qi,Wi.pop(),qi=Wi.pop(),Wi.push(qi)},addRel:function(t,e,n,r,i,a,s,o,c){if(null==t||null==e||null==n||null==r)return;let l={};const h=Gi.find((t=>t.from===e&&t.to===n));if(h?l=h:Gi.push(l),l.type=t,l.from=e,l.to=n,l.label={text:r},null==i)l.techn={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];l[t]={text:e}}else l.techn={text:i};if(null==a)l.descr={text:""};else if("object"==typeof a){let[t,e]=Object.entries(a)[0];l[t]={text:e}}else l.descr={text:a};if("object"==typeof s){let[t,e]=Object.entries(s)[0];l[t]=e}else l.sprite=s;if("object"==typeof o){let[t,e]=Object.entries(o)[0];l[t]=e}else l.tags=o;if("object"==typeof c){let[t,e]=Object.entries(c)[0];l[t]=e}else l.link=c;l.wrap=na()},updateElStyle:function(t,e,n,r,i,a,s,o,c,l,h){let u=Ui.find((t=>t.alias===e));if(void 0!==u||(u=Vi.find((t=>t.alias===e)),void 0!==u)){if(null!=n)if("object"==typeof n){let[t,e]=Object.entries(n)[0];u[t]=e}else u.bgColor=n;if(null!=r)if("object"==typeof r){let[t,e]=Object.entries(r)[0];u[t]=e}else u.fontColor=r;if(null!=i)if("object"==typeof i){let[t,e]=Object.entries(i)[0];u[t]=e}else u.borderColor=i;if(null!=a)if("object"==typeof a){let[t,e]=Object.entries(a)[0];u[t]=e}else u.shadowing=a;if(null!=s)if("object"==typeof s){let[t,e]=Object.entries(s)[0];u[t]=e}else u.shape=s;if(null!=o)if("object"==typeof o){let[t,e]=Object.entries(o)[0];u[t]=e}else u.sprite=o;if(null!=c)if("object"==typeof c){let[t,e]=Object.entries(c)[0];u[t]=e}else u.techn=c;if(null!=l)if("object"==typeof l){let[t,e]=Object.entries(l)[0];u[t]=e}else u.legendText=l;if(null!=h)if("object"==typeof h){let[t,e]=Object.entries(h)[0];u[t]=e}else u.legendSprite=h}},updateRelStyle:function(t,e,n,r,i,a,s){const o=Gi.find((t=>t.from===e&&t.to===n));if(void 0!==o){if(null!=r)if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]=e}else o.textColor=r;if(null!=i)if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]=e}else o.lineColor=i;if(null!=a)if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]=parseInt(e)}else o.offsetX=parseInt(a);if(null!=s)if("object"==typeof s){let[t,e]=Object.entries(s)[0];o[t]=parseInt(e)}else o.offsetY=parseInt(s)}},updateLayoutConfig:function(t,e,n){let r=Ki,i=Ji;if("object"==typeof e){const t=Object.values(e)[0];r=parseInt(t)}else r=parseInt(e);if("object"==typeof n){const t=Object.values(n)[0];i=parseInt(t)}else i=parseInt(n);r>=1&&(Ki=r),i>=1&&(Ji=i)},autoWrap:na,setWrap:function(t){Qi=t},getC4ShapeArray:ea,getC4Shape:function(t){return Ui.find((e=>e.alias===t))},getC4ShapeKeys:function(t){return Object.keys(ea(t))},getBoundarys:function(t){return null==t?Vi:Vi.filter((e=>e.parentBoundary===t))},getCurrentBoundaryParse:function(){return Hi},getParentBoundaryParse:function(){return qi},getRels:function(){return Gi},getTitle:function(){return Xi},getC4Type:function(){return ta},getC4ShapeInRow:function(){return Ki},getC4BoundaryInRow:function(){return Ji},setAccTitle:Zr,getAccTitle:Pr,getAccDescription:Yr,setAccDescription:jr,parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().c4,clear:function(){Ui=[],Vi=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],qi="",Hi="global",Wi=[""],Gi=[],Wi=[""],Xi="",Qi=!1,Ki=4,Ji=2},LINETYPE:{SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},setTitle:function(t){let e=It(t,ur());Xi=e},setC4Type:function(t){let e=It(t,ur());ta=e}},ia=function(t,e){const n=t.append("rect");if(n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),"undefined"!==e.attrs&&null!==e.attrs)for(let r in e.attrs)n.attr(r,e.attrs[r]);return"undefined"!==e.class&&n.attr("class",e.class),n},aa=function(t,e,n,r,i,a){const o=t.append("image");o.attr("width",e),o.attr("height",n),o.attr("x",r),o.attr("y",i);let c=a.startsWith("data:image/png;base64")?a:(0,s.N)(a);o.attr("xlink:href",c)},sa=function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},oa=(t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),ca=function(){function t(t,e,n,i,a,s,o){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("text-anchor","middle").text(t),o)}function e(t,e,n,i,a,s,o,c){const{fontSize:l,fontFamily:h,fontWeight:u}=c,d=t.split(jt.lineBreakRegex);for(let p=0;p<d.length;p++){const t=p*l-l*(d.length-1)/2,s=e.append("text").attr("x",n+a/2).attr("y",i).style("text-anchor","middle").attr("dominant-baseline","middle").style("font-size",l).style("font-weight",u).style("font-family",h);s.append("tspan").attr("dy",t).text(d[p]).attr("alignment-baseline","mathematical"),r(s,o)}}function n(t,n,i,a,s,o,c,l){const h=n.append("switch"),u=h.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,i,a,s,0,c,l),r(u,c)}function r(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),la=function(t,e,n){const r=t.append("g");let i=e.bgColor?e.bgColor:"none",a=e.borderColor?e.borderColor:"#444444",s=e.fontColor?e.fontColor:"black",o={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(o={"stroke-width":1});let c={x:e.x,y:e.y,fill:i,stroke:a,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:o};ia(r,c);let l=n.boundaryFont();l.fontWeight="bold",l.fontSize=l.fontSize+2,l.fontColor=s,ca(n)(e.label.text,r,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},l),e.type&&""!==e.type.text&&(l=n.boundaryFont(),l.fontColor=s,ca(n)(e.type.text,r,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},l)),e.descr&&""!==e.descr.text&&(l=n.boundaryFont(),l.fontSize=l.fontSize-2,l.fontColor=s,ca(n)(e.descr.text,r,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},l))},ha=function(t,e,n){var r;let i=e.bgColor?e.bgColor:n[e.typeC4Shape.text+"_bg_color"],a=e.borderColor?e.borderColor:n[e.typeC4Shape.text+"_border_color"],s=e.fontColor?e.fontColor:"#FFFFFF",o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(e.typeC4Shape.text){case"person":o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="}const c=t.append("g");c.attr("class","person-man");const l=sa();switch(e.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":l.x=e.x,l.y=e.y,l.fill=i,l.width=e.width,l.height=e.height,l.stroke=a,l.rx=2.5,l.ry=2.5,l.attrs={"stroke-width":.5},ia(c,l);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":c.append("path").attr("fill",i).attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2).replaceAll("height",e.height)),c.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":c.append("path").attr("fill",i).attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("width",e.width).replaceAll("half",e.height/2)),c.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",a).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",e.x+e.width).replaceAll("starty",e.y).replaceAll("half",e.height/2))}let h=oa(n,e.typeC4Shape.text);switch(c.append("text").attr("fill",s).attr("font-family",h.fontFamily).attr("font-size",h.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",e.typeC4Shape.width).attr("x",e.x+e.width/2-e.typeC4Shape.width/2).attr("y",e.y+e.typeC4Shape.Y).text("<<"+e.typeC4Shape.text+">>"),e.typeC4Shape.text){case"person":case"external_person":aa(c,48,48,e.x+e.width/2-24,e.y+e.image.Y,o)}let u=n[e.typeC4Shape.text+"Font"]();return u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=s,ca(n)(e.label.text,c,e.x,e.y+e.label.Y,e.width,e.height,{fill:s},u),u=n[e.typeC4Shape.text+"Font"](),u.fontColor=s,e.techn&&""!==(null==(r=e.techn)?void 0:r.text)?ca(n)(e.techn.text,c,e.x,e.y+e.techn.Y,e.width,e.height,{fill:s,"font-style":"italic"},u):e.type&&""!==e.type.text&&ca(n)(e.type.text,c,e.x,e.y+e.type.Y,e.width,e.height,{fill:s,"font-style":"italic"},u),e.descr&&""!==e.descr.text&&(u=n.personFont(),u.fontColor=s,ca(n)(e.descr.text,c,e.x,e.y+e.descr.Y,e.width,e.height,{fill:s},u)),e.height},ua=(t,e,n)=>{const r=t.append("g");let i=0;for(let a of e){let t=a.textColor?a.textColor:"#444444",e=a.lineColor?a.lineColor:"#444444",s=a.offsetX?parseInt(a.offsetX):0,o=a.offsetY?parseInt(a.offsetY):0,c="";if(0===i){let t=r.append("line");t.attr("x1",a.startPoint.x),t.attr("y1",a.startPoint.y),t.attr("x2",a.endPoint.x),t.attr("y2",a.endPoint.y),t.attr("stroke-width","1"),t.attr("stroke",e),t.style("fill","none"),"rel_b"!==a.type&&t.attr("marker-end","url("+c+"#arrowhead)"),"birel"!==a.type&&"rel_b"!==a.type||t.attr("marker-start","url("+c+"#arrowend)"),i=-1}else{let t=r.append("path");t.attr("fill","none").attr("stroke-width","1").attr("stroke",e).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),"rel_b"!==a.type&&t.attr("marker-end","url("+c+"#arrowhead)"),"birel"!==a.type&&"rel_b"!==a.type||t.attr("marker-start","url("+c+"#arrowend)")}let l=n.messageFont();ca(n)(a.label.text,r,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+s,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+o,a.label.width,a.label.height,{fill:t},l),a.techn&&""!==a.techn.text&&(l=n.messageFont(),ca(n)("["+a.techn.text+"]",r,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+s,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+n.messageFontSize+5+o,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:t,"font-style":"italic"},l))}},da=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},pa=function(t){t.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},fa=function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},ga=function(t){const e=t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);e.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),e.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},ya=function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},ma=function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},ba=function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")};s.N;let _a=0,xa=0,va=4,ka=2;ji.yy=ra;let wa={};class Ca{constructor(t){this.name="",this.data={},this.data.startx=void 0,this.data.stopx=void 0,this.data.starty=void 0,this.data.stopy=void 0,this.data.widthLimit=void 0,this.nextData={},this.nextData.startx=void 0,this.nextData.stopx=void 0,this.nextData.starty=void 0,this.nextData.stopy=void 0,this.nextData.cnt=0,Ea(t.db.getConfig())}setData(t,e,n,r){this.nextData.startx=this.data.startx=t,this.nextData.stopx=this.data.stopx=e,this.nextData.starty=this.data.starty=n,this.nextData.stopy=this.data.stopy=r}updateVal(t,e,n,r){void 0===t[e]?t[e]=n:t[e]=r(n,t[e])}insert(t){this.nextData.cnt=this.nextData.cnt+1;let e=this.nextData.startx===this.nextData.stopx?this.nextData.stopx+t.margin:this.nextData.stopx+2*t.margin,n=e+t.width,r=this.nextData.starty+2*t.margin,i=r+t.height;(e>=this.data.widthLimit||n>=this.data.widthLimit||this.nextData.cnt>va)&&(e=this.nextData.startx+t.margin+wa.nextLinePaddingX,r=this.nextData.stopy+2*t.margin,this.nextData.stopx=n=e+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=r+t.height,this.nextData.cnt=1),t.x=e,t.y=r,this.updateVal(this.data,"startx",e,Math.min),this.updateVal(this.data,"starty",r,Math.min),this.updateVal(this.data,"stopx",n,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",e,Math.min),this.updateVal(this.nextData,"starty",r,Math.min),this.updateVal(this.nextData,"stopx",n,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},Ea(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}}const Ea=function(t){On(wa,t),t.fontFamily&&(wa.personFontFamily=wa.systemFontFamily=wa.messageFontFamily=t.fontFamily),t.fontSize&&(wa.personFontSize=wa.systemFontSize=wa.messageFontSize=t.fontSize),t.fontWeight&&(wa.personFontWeight=wa.systemFontWeight=wa.messageFontWeight=t.fontWeight)},Ta=(t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),Sa=t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight});function Aa(t,e,n,r,i){if(!e[t].width)if(n)e[t].text=Wn(e[t].text,i,r),e[t].textLines=e[t].text.split(jt.lineBreakRegex).length,e[t].width=i,e[t].height=qn(e[t].text,r);else{let n=e[t].text.split(jt.lineBreakRegex);e[t].textLines=n.length;let i=0;e[t].height=0,e[t].width=0;for(const a of n)e[t].width=Math.max(Vn(a,r),e[t].width),i=qn(a,r),e[t].height=e[t].height+i}}const La=function(t,e,n){e.x=n.data.startx,e.y=n.data.starty,e.width=n.data.stopx-n.data.startx,e.height=n.data.stopy-n.data.starty,e.label.y=wa.c4ShapeMargin-35;let r=e.wrap&&wa.wrap,i=Sa(wa);i.fontSize=i.fontSize+2,i.fontWeight="bold",Aa("label",e,r,i,Vn(e.label.text,i)),la(t,e,wa)},Ba=function(t,e,n,r){let i=0;for(const a of r){i=0;const r=n[a];let s=Ta(wa,r.typeC4Shape.text);switch(s.fontSize=s.fontSize-2,r.typeC4Shape.width=Vn("<<"+r.typeC4Shape.text+">>",s),r.typeC4Shape.height=s.fontSize+2,r.typeC4Shape.Y=wa.c4ShapePadding,i=r.typeC4Shape.Y+r.typeC4Shape.height-4,r.image={width:0,height:0,Y:0},r.typeC4Shape.text){case"person":case"external_person":r.image.width=48,r.image.height=48,r.image.Y=i,i=r.image.Y+r.image.height}r.sprite&&(r.image.width=48,r.image.height=48,r.image.Y=i,i=r.image.Y+r.image.height);let o=r.wrap&&wa.wrap,c=wa.width-2*wa.c4ShapePadding,l=Ta(wa,r.typeC4Shape.text);if(l.fontSize=l.fontSize+2,l.fontWeight="bold",Aa("label",r,o,l,c),r.label.Y=i+8,i=r.label.Y+r.label.height,r.type&&""!==r.type.text){r.type.text="["+r.type.text+"]",Aa("type",r,o,Ta(wa,r.typeC4Shape.text),c),r.type.Y=i+5,i=r.type.Y+r.type.height}else if(r.techn&&""!==r.techn.text){r.techn.text="["+r.techn.text+"]",Aa("techn",r,o,Ta(wa,r.techn.text),c),r.techn.Y=i+5,i=r.techn.Y+r.techn.height}let h=i,u=r.label.width;if(r.descr&&""!==r.descr.text){Aa("descr",r,o,Ta(wa,r.typeC4Shape.text),c),r.descr.Y=i+20,i=r.descr.Y+r.descr.height,u=Math.max(r.label.width,r.descr.width),h=i-5*r.descr.textLines}u+=wa.c4ShapePadding,r.width=Math.max(r.width||wa.width,u,wa.width),r.height=Math.max(r.height||wa.height,h,wa.height),r.margin=r.margin||wa.c4ShapeMargin,t.insert(r),ha(e,r,wa)}t.bumpLastMargin(wa.c4ShapeMargin)};class Na{constructor(t,e){this.x=t,this.y=e}}let Da=function(t,e){let n=t.x,r=t.y,i=e.x,a=e.y,s=n+t.width/2,o=r+t.height/2,c=Math.abs(n-i),l=Math.abs(r-a),h=l/c,u=t.height/t.width,d=null;return r==a&&n<i?d=new Na(n+t.width,o):r==a&&n>i?d=new Na(n,o):n==i&&r<a?d=new Na(s,r+t.height):n==i&&r>a&&(d=new Na(s,r)),n>i&&r<a?d=u>=h?new Na(n,o+h*t.width/2):new Na(s-c/l*t.height/2,r+t.height):n<i&&r<a?d=u>=h?new Na(n+t.width,o+h*t.width/2):new Na(s+c/l*t.height/2,r+t.height):n<i&&r>a?d=u>=h?new Na(n+t.width,o-h*t.width/2):new Na(s+t.height/2*c/l,r):n>i&&r>a&&(d=u>=h?new Na(n,o-t.width/2*h):new Na(s-t.height/2*c/l,r)),d},Oa=function(t,e){let n={x:0,y:0};n.x=e.x+e.width/2,n.y=e.y+e.height/2;let r=Da(t,n);return n.x=t.x+t.width/2,n.y=t.y+t.height/2,{startPoint:r,endPoint:Da(e,n)}};function Ma(t,e,n,r,i){let a=new Ca(i);a.data.widthLimit=n.data.widthLimit/Math.min(ka,r.length);for(let[s,o]of r.entries()){let r=0;o.image={width:0,height:0,Y:0},o.sprite&&(o.image.width=48,o.image.height=48,o.image.Y=r,r=o.image.Y+o.image.height);let c=o.wrap&&wa.wrap,l=Sa(wa);if(l.fontSize=l.fontSize+2,l.fontWeight="bold",Aa("label",o,c,l,a.data.widthLimit),o.label.Y=r+8,r=o.label.Y+o.label.height,o.type&&""!==o.type.text){o.type.text="["+o.type.text+"]",Aa("type",o,c,Sa(wa),a.data.widthLimit),o.type.Y=r+5,r=o.type.Y+o.type.height}if(o.descr&&""!==o.descr.text){let t=Sa(wa);t.fontSize=t.fontSize-2,Aa("descr",o,c,t,a.data.widthLimit),o.descr.Y=r+20,r=o.descr.Y+o.descr.height}if(0==s||s%ka==0){let t=n.data.startx+wa.diagramMarginX,e=n.data.stopy+wa.diagramMarginY+r;a.setData(t,t,e,e)}else{let t=a.data.stopx!==a.data.startx?a.data.stopx+wa.diagramMarginX:a.data.startx,e=a.data.starty;a.setData(t,t,e,e)}a.name=o.alias;let h=i.db.getC4ShapeArray(o.alias),u=i.db.getC4ShapeKeys(o.alias);u.length>0&&Ba(a,t,h,u),e=o.alias;let d=i.db.getBoundarys(e);d.length>0&&Ma(t,e,a,d,i),"global"!==o.alias&&La(t,o,a),n.data.stopy=Math.max(a.data.stopy+wa.c4ShapeMargin,n.data.stopy),n.data.stopx=Math.max(a.data.stopx+wa.c4ShapeMargin,n.data.stopx),_a=Math.max(_a,n.data.stopx),xa=Math.max(xa,n.data.stopy)}}const Ia={drawPersonOrSystemArray:Ba,drawBoundary:La,setConf:Ea,draw:function(t,e,n,r){wa=ur().c4;const i=ur().securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s="sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body");let c=r.db;r.db.setWrap(wa.wrap),va=c.getC4ShapeInRow(),ka=c.getC4BoundaryInRow(),Bt.debug(`C:${JSON.stringify(wa,null,2)}`);const l="sandbox"===i?s.select(`[id="${e}"]`):(0,o.Ys)(`[id="${e}"]`);ma(l),ya(l),ba(l);let h=new Ca(r);h.setData(wa.diagramMarginX,wa.diagramMarginX,wa.diagramMarginY,wa.diagramMarginY),h.data.widthLimit=screen.availWidth,_a=wa.diagramMarginX,xa=wa.diagramMarginY;const u=r.db.getTitle();Ma(l,"",h,r.db.getBoundarys(""),r),da(l),pa(l),ga(l),fa(l),function(t,e,n,r){let i=0;for(let s of e){i+=1;let t=s.wrap&&wa.wrap,e={fontFamily:(a=wa).messageFontFamily,fontSize:a.messageFontSize,fontWeight:a.messageFontWeight};"C4Dynamic"===r.db.getC4Type()&&(s.label.text=i+": "+s.label.text);let o=Vn(s.label.text,e);Aa("label",s,t,e,o),s.techn&&""!==s.techn.text&&(o=Vn(s.techn.text,e),Aa("techn",s,t,e,o)),s.descr&&""!==s.descr.text&&(o=Vn(s.descr.text,e),Aa("descr",s,t,e,o));let c=n(s.from),l=n(s.to),h=Oa(c,l);s.startPoint=h.startPoint,s.endPoint=h.endPoint}var a;ua(t,e,wa)}(l,r.db.getRels(),r.db.getC4Shape,r),h.data.stopx=_a,h.data.stopy=xa;const d=h.data;let p=d.stopy-d.starty+2*wa.diagramMarginY;const f=d.stopx-d.startx+2*wa.diagramMarginX;u&&l.append("text").text(u).attr("x",(d.stopx-d.startx)/2-4*wa.diagramMarginX).attr("y",d.starty+wa.diagramMarginY),br(l,p,f,wa.useMaxWidth);const g=u?60:0;l.attr("viewBox",d.startx-wa.diagramMarginX+" -"+(wa.diagramMarginY+g)+" "+f+" "+(p+g)),Bt.debug("models:",d)}};var Fa=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,3],r=[1,7],i=[1,8],a=[1,9],s=[1,10],o=[1,13],c=[1,12],l=[1,16,25],h=[1,20],u=[1,32],d=[1,33],p=[1,34],f=[1,36],g=[1,39],y=[1,37],m=[1,38],b=[1,44],_=[1,45],x=[1,40],v=[1,41],k=[1,42],w=[1,43],C=[1,48],E=[1,49],T=[1,50],S=[1,51],A=[16,25],L=[1,65],B=[1,66],N=[1,67],D=[1,68],O=[1,69],M=[1,70],I=[1,71],F=[1,80],$=[16,25,32,45,46,54,60,61,62,63,64,65,66,71,73],R=[16,25,30,32,45,46,50,54,60,61,62,63,64,65,66,71,73,88,89,90,91],Z=[5,8,9,10,11,16,19,23,25],P=[54,88,89,90,91],j=[54,65,66,88,89,90,91],Y=[54,60,61,62,63,64,88,89,90,91],z=[16,25,32],U=[1,107],W={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statments:5,direction:6,directive:7,direction_tb:8,direction_bt:9,direction_rl:10,direction_lr:11,graphConfig:12,openDirective:13,typeDirective:14,closeDirective:15,NEWLINE:16,":":17,argDirective:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,CLASS_DIAGRAM:23,statements:24,EOF:25,statement:26,className:27,alphaNumToken:28,classLiteralName:29,GENERICTYPE:30,relationStatement:31,LABEL:32,classStatement:33,methodStatement:34,annotationStatement:35,clickStatement:36,cssClassStatement:37,noteStatement:38,acc_title:39,acc_title_value:40,acc_descr:41,acc_descr_value:42,acc_descr_multiline_value:43,CLASS:44,STYLE_SEPARATOR:45,STRUCT_START:46,members:47,STRUCT_STOP:48,ANNOTATION_START:49,ANNOTATION_END:50,MEMBER:51,SEPARATOR:52,relation:53,STR:54,NOTE_FOR:55,noteText:56,NOTE:57,relationType:58,lineType:59,AGGREGATION:60,EXTENSION:61,COMPOSITION:62,DEPENDENCY:63,LOLLIPOP:64,LINE:65,DOTTED_LINE:66,CALLBACK:67,LINK:68,LINK_TARGET:69,CLICK:70,CALLBACK_NAME:71,CALLBACK_ARGS:72,HREF:73,CSSCLASS:74,commentToken:75,textToken:76,graphCodeTokens:77,textNoTagsToken:78,TAGSTART:79,TAGEND:80,"==":81,"--":82,PCT:83,DEFAULT:84,SPACE:85,MINUS:86,keywords:87,UNICODE_TEXT:88,NUM:89,ALPHA:90,BQUOTE_STR:91,$accept:0,$end:1},terminals_:{2:"error",5:"statments",8:"direction_tb",9:"direction_bt",10:"direction_rl",11:"direction_lr",16:"NEWLINE",17:":",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",23:"CLASS_DIAGRAM",25:"EOF",30:"GENERICTYPE",32:"LABEL",39:"acc_title",40:"acc_title_value",41:"acc_descr",42:"acc_descr_value",43:"acc_descr_multiline_value",44:"CLASS",45:"STYLE_SEPARATOR",46:"STRUCT_START",48:"STRUCT_STOP",49:"ANNOTATION_START",50:"ANNOTATION_END",51:"MEMBER",52:"SEPARATOR",54:"STR",55:"NOTE_FOR",57:"NOTE",60:"AGGREGATION",61:"EXTENSION",62:"COMPOSITION",63:"DEPENDENCY",64:"LOLLIPOP",65:"LINE",66:"DOTTED_LINE",67:"CALLBACK",68:"LINK",69:"LINK_TARGET",70:"CLICK",71:"CALLBACK_NAME",72:"CALLBACK_ARGS",73:"HREF",74:"CSSCLASS",77:"graphCodeTokens",79:"TAGSTART",80:"TAGEND",81:"==",82:"--",83:"PCT",84:"DEFAULT",85:"SPACE",86:"MINUS",87:"keywords",88:"UNICODE_TEXT",89:"NUM",90:"ALPHA",91:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[47,1],[47,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[38,3],[38,2],[53,3],[53,2],[53,2],[53,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[75,1],[75,1],[76,1],[76,1],[76,1],[76,1],[76,1],[76,1],[76,1],[78,1],[78,1],[78,1],[78,1],[28,1],[28,1],[28,1],[29,1],[56,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 5:r.setDirection("TB");break;case 6:r.setDirection("BT");break;case 7:r.setDirection("RL");break;case 8:r.setDirection("LR");break;case 12:r.parseDirective("%%{","open_directive");break;case 13:r.parseDirective(a[o],"type_directive");break;case 14:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 15:r.parseDirective("}%%","close_directive","class");break;case 20:case 21:this.$=a[o];break;case 22:this.$=a[o-1]+a[o];break;case 23:case 24:this.$=a[o-1]+"~"+a[o];break;case 25:r.addRelation(a[o]);break;case 26:a[o-1].title=r.cleanupLabel(a[o]),r.addRelation(a[o-1]);break;case 35:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 36:case 37:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 38:r.addClass(a[o]);break;case 39:r.addClass(a[o-2]),r.setCssClass(a[o-2],a[o]);break;case 40:r.addClass(a[o-3]),r.addMembers(a[o-3],a[o-1]);break;case 41:r.addClass(a[o-5]),r.setCssClass(a[o-5],a[o-3]),r.addMembers(a[o-5],a[o-1]);break;case 42:r.addAnnotation(a[o],a[o-2]);break;case 43:this.$=[a[o]];break;case 44:a[o].push(a[o-1]),this.$=a[o];break;case 45:case 47:case 48:break;case 46:r.addMember(a[o-1],r.cleanupLabel(a[o]));break;case 49:this.$={id1:a[o-2],id2:a[o],relation:a[o-1],relationTitle1:"none",relationTitle2:"none"};break;case 50:this.$={id1:a[o-3],id2:a[o],relation:a[o-1],relationTitle1:a[o-2],relationTitle2:"none"};break;case 51:this.$={id1:a[o-3],id2:a[o],relation:a[o-2],relationTitle1:"none",relationTitle2:a[o-1]};break;case 52:this.$={id1:a[o-4],id2:a[o],relation:a[o-2],relationTitle1:a[o-3],relationTitle2:a[o-1]};break;case 53:r.addNote(a[o],a[o-1]);break;case 54:r.addNote(a[o]);break;case 55:this.$={type1:a[o-2],type2:a[o],lineType:a[o-1]};break;case 56:this.$={type1:"none",type2:a[o],lineType:a[o-1]};break;case 57:this.$={type1:a[o-1],type2:"none",lineType:a[o]};break;case 58:this.$={type1:"none",type2:"none",lineType:a[o]};break;case 59:this.$=r.relationType.AGGREGATION;break;case 60:this.$=r.relationType.EXTENSION;break;case 61:this.$=r.relationType.COMPOSITION;break;case 62:this.$=r.relationType.DEPENDENCY;break;case 63:this.$=r.relationType.LOLLIPOP;break;case 64:this.$=r.lineType.LINE;break;case 65:this.$=r.lineType.DOTTED_LINE;break;case 66:case 72:this.$=a[o-2],r.setClickEvent(a[o-1],a[o]);break;case 67:case 73:this.$=a[o-3],r.setClickEvent(a[o-2],a[o-1]),r.setTooltip(a[o-2],a[o]);break;case 68:case 76:this.$=a[o-2],r.setLink(a[o-1],a[o]);break;case 69:case 77:this.$=a[o-3],r.setLink(a[o-2],a[o-1],a[o]);break;case 70:case 78:this.$=a[o-3],r.setLink(a[o-2],a[o-1]),r.setTooltip(a[o-2],a[o]);break;case 71:case 79:this.$=a[o-4],r.setLink(a[o-3],a[o-2],a[o]),r.setTooltip(a[o-3],a[o-1]);break;case 74:this.$=a[o-3],r.setClickEvent(a[o-2],a[o-1],a[o]);break;case 75:this.$=a[o-4],r.setClickEvent(a[o-3],a[o-2],a[o-1]),r.setTooltip(a[o-3],a[o]);break;case 80:r.setCssClass(a[o-1],a[o])}},table:[{3:1,4:2,5:n,6:4,7:5,8:r,9:i,10:a,11:s,12:6,13:11,19:o,23:c},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:n,6:4,7:5,8:r,9:i,10:a,11:s,12:6,13:11,19:o,23:c},{1:[2,9]},e(l,[2,5]),e(l,[2,6]),e(l,[2,7]),e(l,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:h},e([17,22],[2,13]),{6:31,7:30,8:r,9:i,10:a,11:s,13:11,19:o,24:21,26:22,27:35,28:46,29:47,31:23,33:24,34:25,35:26,36:27,37:28,38:29,39:u,41:d,43:p,44:f,49:g,51:y,52:m,55:b,57:_,67:x,68:v,70:k,74:w,88:C,89:E,90:T,91:S},{16:[1,52]},{18:53,21:[1,54]},{16:[2,15]},{25:[1,55]},{16:[1,56],25:[2,17]},e(A,[2,25],{32:[1,57]}),e(A,[2,27]),e(A,[2,28]),e(A,[2,29]),e(A,[2,30]),e(A,[2,31]),e(A,[2,32]),e(A,[2,33]),e(A,[2,34]),{40:[1,58]},{42:[1,59]},e(A,[2,37]),e(A,[2,45],{53:60,58:63,59:64,32:[1,62],54:[1,61],60:L,61:B,62:N,63:D,64:O,65:M,66:I}),{27:72,28:46,29:47,88:C,89:E,90:T,91:S},e(A,[2,47]),e(A,[2,48]),{28:73,88:C,89:E,90:T},{27:74,28:46,29:47,88:C,89:E,90:T,91:S},{27:75,28:46,29:47,88:C,89:E,90:T,91:S},{27:76,28:46,29:47,88:C,89:E,90:T,91:S},{54:[1,77]},{27:78,28:46,29:47,88:C,89:E,90:T,91:S},{54:F,56:79},e($,[2,20],{28:46,29:47,27:81,30:[1,82],88:C,89:E,90:T,91:S}),e($,[2,21],{30:[1,83]}),e(R,[2,94]),e(R,[2,95]),e(R,[2,96]),e([16,25,30,32,45,46,54,60,61,62,63,64,65,66,71,73],[2,97]),e(Z,[2,10]),{15:84,22:h},{22:[2,14]},{1:[2,16]},{6:31,7:30,8:r,9:i,10:a,11:s,13:11,19:o,24:85,25:[2,18],26:22,27:35,28:46,29:47,31:23,33:24,34:25,35:26,36:27,37:28,38:29,39:u,41:d,43:p,44:f,49:g,51:y,52:m,55:b,57:_,67:x,68:v,70:k,74:w,88:C,89:E,90:T,91:S},e(A,[2,26]),e(A,[2,35]),e(A,[2,36]),{27:86,28:46,29:47,54:[1,87],88:C,89:E,90:T,91:S},{53:88,58:63,59:64,60:L,61:B,62:N,63:D,64:O,65:M,66:I},e(A,[2,46]),{59:89,65:M,66:I},e(P,[2,58],{58:90,60:L,61:B,62:N,63:D,64:O}),e(j,[2,59]),e(j,[2,60]),e(j,[2,61]),e(j,[2,62]),e(j,[2,63]),e(Y,[2,64]),e(Y,[2,65]),e(A,[2,38],{45:[1,91],46:[1,92]}),{50:[1,93]},{54:[1,94]},{54:[1,95]},{71:[1,96],73:[1,97]},{28:98,88:C,89:E,90:T},{54:F,56:99},e(A,[2,54]),e(A,[2,98]),e($,[2,22]),e($,[2,23]),e($,[2,24]),{16:[1,100]},{25:[2,19]},e(z,[2,49]),{27:101,28:46,29:47,88:C,89:E,90:T,91:S},{27:102,28:46,29:47,54:[1,103],88:C,89:E,90:T,91:S},e(P,[2,57],{58:104,60:L,61:B,62:N,63:D,64:O}),e(P,[2,56]),{28:105,88:C,89:E,90:T},{47:106,51:U},{27:108,28:46,29:47,88:C,89:E,90:T,91:S},e(A,[2,66],{54:[1,109]}),e(A,[2,68],{54:[1,111],69:[1,110]}),e(A,[2,72],{54:[1,112],72:[1,113]}),e(A,[2,76],{54:[1,115],69:[1,114]}),e(A,[2,80]),e(A,[2,53]),e(Z,[2,11]),e(z,[2,51]),e(z,[2,50]),{27:116,28:46,29:47,88:C,89:E,90:T,91:S},e(P,[2,55]),e(A,[2,39],{46:[1,117]}),{48:[1,118]},{47:119,48:[2,43],51:U},e(A,[2,42]),e(A,[2,67]),e(A,[2,69]),e(A,[2,70],{69:[1,120]}),e(A,[2,73]),e(A,[2,74],{54:[1,121]}),e(A,[2,77]),e(A,[2,78],{69:[1,122]}),e(z,[2,52]),{47:123,51:U},e(A,[2,40]),{48:[2,44]},e(A,[2,71]),e(A,[2,75]),e(A,[2,79]),{48:[1,124]},e(A,[2,41])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],54:[2,14],55:[2,16],85:[2,19],119:[2,44]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},H=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),19;case 1:return 8;case 2:return 9;case 3:return 10;case 4:return 11;case 5:return this.begin("type_directive"),20;case 6:return this.popState(),this.begin("arg_directive"),17;case 7:return this.popState(),this.popState(),22;case 8:return 21;case 9:case 10:case 19:case 27:break;case 11:return this.begin("acc_title"),39;case 12:return this.popState(),"acc_title_value";case 13:return this.begin("acc_descr"),41;case 14:return this.popState(),"acc_descr_value";case 15:this.begin("acc_descr_multiline");break;case 16:case 39:case 42:case 45:case 48:case 51:case 54:this.popState();break;case 17:return"acc_descr_multiline_value";case 18:return 16;case 20:case 21:return 23;case 22:return this.begin("struct"),46;case 23:return"EDGE_STATE";case 24:return"EOF_IN_STRUCT";case 25:return"OPEN_IN_STRUCT";case 26:return this.popState(),48;case 28:return"MEMBER";case 29:return 44;case 30:return 74;case 31:return 67;case 32:return 68;case 33:return 70;case 34:return 55;case 35:return 57;case 36:return 49;case 37:return 50;case 38:this.begin("generic");break;case 40:return"GENERICTYPE";case 41:this.begin("string");break;case 43:return"STR";case 44:this.begin("bqstring");break;case 46:return"BQUOTE_STR";case 47:this.begin("href");break;case 49:return 73;case 50:this.begin("callback_name");break;case 52:this.popState(),this.begin("callback_args");break;case 53:return 71;case 55:return 72;case 56:case 57:case 58:case 59:return 69;case 60:case 61:return 61;case 62:case 63:return 63;case 64:return 62;case 65:return 60;case 66:return 64;case 67:return 65;case 68:return 66;case 69:return 32;case 70:return 45;case 71:return 86;case 72:return"DOT";case 73:return"PLUS";case 74:return 83;case 75:case 76:return"EQUALS";case 77:return 90;case 78:return"PUNCTUATION";case 79:return 89;case 80:return 88;case 81:return 85;case 82:return 25}},rules:[/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:\[\*\])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},callback_args:{rules:[54,55],inclusive:!1},callback_name:{rules:[51,52,53],inclusive:!1},href:{rules:[48,49],inclusive:!1},struct:{rules:[23,24,25,26,27,28],inclusive:!1},generic:{rules:[39,40],inclusive:!1},bqstring:{rules:[45,46],inclusive:!1},string:{rules:[42,43],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,29,30,31,32,33,34,35,36,37,38,41,44,47,50,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82],inclusive:!0}}},t);function q(){this.yy={}}return W.lexer=H,q.prototype=W,W.Parser=q,new q}();Fa.parser=Fa;const $a=Fa,Ra=(t,e)=>{var n;return"dagre-wrapper"!==(null==(n=null==e?void 0:e.class)?void 0:n.defaultRenderer)&&null!==t.match(/^\s*classDiagram/)},Za=(t,e)=>{var n;return null!==t.match(/^\s*classDiagram/)&&"dagre-wrapper"===(null==(n=null==e?void 0:e.class)?void 0:n.defaultRenderer)||null!==t.match(/^\s*classDiagram-v2/)},Pa="classid-";let ja=[],Ya={},za=[],Ua=0,Wa=[];const Ha=t=>jt.sanitizeText(t,ur()),qa=function(t){let e="",n=t;if(t.indexOf("~")>0){let r=t.split("~");n=r[0],e=jt.sanitizeText(r[1],ur())}return{className:n,type:e}},Va=function(t){let e=qa(t);void 0===Ya[e.className]&&(Ya[e.className]={id:e.className,type:e.type,cssClasses:[],methods:[],members:[],annotations:[],domId:Pa+e.className+"-"+Ua},Ua++)},Ga=function(t){const e=Object.keys(Ya);for(const n of e)if(Ya[n].id===t)return Ya[n].domId},Xa=function(t,e){const n=qa(t).className,r=Ya[n];if("string"==typeof e){const t=e.trim();t.startsWith("<<")&&t.endsWith(">>")?r.annotations.push(Ha(t.substring(2,t.length-2))):t.indexOf(")")>0?r.methods.push(Ha(t)):t&&r.members.push(Ha(t))}},Qa=function(t,e){t.split(",").forEach((function(t){let n=t;t[0].match(/\d/)&&(n=Pa+n),void 0!==Ya[n]&&Ya[n].cssClasses.push(e)}))},Ka=function(t,e,n){const r=ur();let i=t,a=Ga(i);if("loose"===r.securityLevel&&void 0!==e&&void 0!==Ya[i]){let t=[];if("string"==typeof n){t=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let e=0;e<t.length;e++){let n=t[e].trim();'"'===n.charAt(0)&&'"'===n.charAt(n.length-1)&&(n=n.substr(1,n.length-2)),t[e]=n}}0===t.length&&t.push(a),Wa.push((function(){const n=document.querySelector(`[id="${a}"]`);null!==n&&n.addEventListener("click",(function(){er.runFunc(e,...t)}),!1)}))}},Ja=function(t){let e=(0,o.Ys)(".mermaidTooltip");null===(e._groups||e)[0][0]&&(e=(0,o.Ys)("body").append("div").attr("class","mermaidTooltip").style("opacity",0));(0,o.Ys)(t).select("svg").selectAll("g.node").on("mouseover",(function(){const t=(0,o.Ys)(this);if(null===t.attr("title"))return;const n=this.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.text(t.attr("title")).style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.top-14+document.body.scrollTop+"px"),e.html(e.html().replace(/<br\/>/g,"<br/>")),t.classed("hover",!0)})).on("mouseout",(function(){e.transition().duration(500).style("opacity",0);(0,o.Ys)(this).classed("hover",!1)}))};Wa.push(Ja);let ts="TB";const es={parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},setAccTitle:Zr,getAccTitle:Pr,getAccDescription:Yr,setAccDescription:jr,getConfig:()=>ur().class,addClass:Va,bindFunctions:function(t){Wa.forEach((function(e){e(t)}))},clear:function(){ja=[],Ya={},za=[],Wa=[],Wa.push(Ja),Rr()},getClass:function(t){return Ya[t]},getClasses:function(){return Ya},getNotes:function(){return za},addAnnotation:function(t,e){const n=qa(t).className;Ya[n].annotations.push(e)},addNote:function(t,e){const n={id:`note${za.length}`,class:e,text:t};za.push(n)},getRelations:function(){return ja},addRelation:function(t){Bt.debug("Adding relation: "+JSON.stringify(t)),Va(t.id1),Va(t.id2),t.id1=qa(t.id1).className,t.id2=qa(t.id2).className,t.relationTitle1=jt.sanitizeText(t.relationTitle1.trim(),ur()),t.relationTitle2=jt.sanitizeText(t.relationTitle2.trim(),ur()),ja.push(t)},getDirection:()=>ts,setDirection:t=>{ts=t},addMember:Xa,addMembers:function(t,e){Array.isArray(e)&&(e.reverse(),e.forEach((e=>Xa(t,e))))},cleanupLabel:function(t){return":"===t.substring(0,1)?jt.sanitizeText(t.substr(1).trim(),ur()):Ha(t.trim())},lineType:{LINE:0,DOTTED_LINE:1},relationType:{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},setClickEvent:function(t,e,n){t.split(",").forEach((function(t){Ka(t,e,n),Ya[t].haveCallback=!0})),Qa(t,"clickable")},setCssClass:Qa,setLink:function(t,e,n){const r=ur();t.split(",").forEach((function(t){let i=t;t[0].match(/\d/)&&(i=Pa+i),void 0!==Ya[i]&&(Ya[i].link=er.formatUrl(e,r),"sandbox"===r.securityLevel?Ya[i].linkTarget="_top":Ya[i].linkTarget="string"==typeof n?Ha(n):"_blank")})),Qa(t,"clickable")},getTooltip:function(t){return Ya[t].tooltip},setTooltip:function(t,e){const n=ur();t.split(",").forEach((function(t){void 0!==e&&(Ya[t].tooltip=jt.sanitizeText(e,n))}))},lookUpDomId:Ga,setDiagramTitle:zr,getDiagramTitle:Ur};let ns=0;const rs=function(t){let e=t.match(/^([#+~-])?(\w+)(~\w+~|\[])?\s+(\w+) *([$*])?$/),n=t.match(/^([#+|~-])?(\w+) *\( *(.*)\) *([$*])? *(\w*[[\]|~]*\s*\w*~?)$/);return e&&!n?is(e):n?as(n):ss(t)},is=function(t){let e="",n="";try{let r=t[1]?t[1].trim():"",i=t[2]?t[2].trim():"",a=t[3]?Pt(t[3].trim()):"",s=t[4]?t[4].trim():"",o=t[5]?t[5].trim():"";n=r+i+a+" "+s,e=cs(o)}catch(r){n=t}return{displayText:n,cssStyle:e}},as=function(t){let e="",n="";try{let r=t[1]?t[1].trim():"",i=t[2]?t[2].trim():"",a=t[3]?Pt(t[3].trim()):"",s=t[4]?t[4].trim():"";n=r+i+"("+a+")"+(t[5]?" : "+Pt(t[5]).trim():""),e=cs(s)}catch(r){n=t}return{displayText:n,cssStyle:e}},ss=function(t){let e="",n="",r="",i=t.indexOf("("),a=t.indexOf(")");if(i>1&&a>i&&a<=t.length){let s="",o="",c=t.substring(0,1);c.match(/\w/)?o=t.substring(0,i).trim():(c.match(/[#+~-]/)&&(s=c),o=t.substring(1,i).trim());const l=t.substring(i+1,a);t.substring(a+1,1),n=cs(t.substring(a+1,a+2)),e=s+o+"("+Pt(l.trim())+")",a<t.length&&(r=t.substring(a+2).trim(),""!==r&&(r=" : "+Pt(r),e+=r))}else e=Pt(t);return{displayText:e,cssStyle:n}},os=function(t,e,n,r){let i=rs(e);const a=t.append("tspan").attr("x",r.padding).text(i.displayText);""!==i.cssStyle&&a.attr("style",i.cssStyle),n||a.attr("dy",r.textHeight)},cs=function(t){switch(t){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}},ls=function(t,e,n,r){Bt.debug("Rendering class ",e,n);const i=e.id,a={id:i,label:e.id,width:0,height:0},s=t.append("g").attr("id",r.db.lookUpDomId(i)).attr("class","classGroup");let o;o=e.link?s.append("svg:a").attr("xlink:href",e.link).attr("target",e.linkTarget).append("text").attr("y",n.textHeight+n.padding).attr("x",0):s.append("text").attr("y",n.textHeight+n.padding).attr("x",0);let c=!0;e.annotations.forEach((function(t){const e=o.append("tspan").text("\xab"+t+"\xbb");c||e.attr("dy",n.textHeight),c=!1}));let l=e.id;void 0!==e.type&&""!==e.type&&(l+="<"+e.type+">");const h=o.append("tspan").text(l).attr("class","title");c||h.attr("dy",n.textHeight);const u=o.node().getBBox().height,d=s.append("line").attr("x1",0).attr("y1",n.padding+u+n.dividerMargin/2).attr("y2",n.padding+u+n.dividerMargin/2),p=s.append("text").attr("x",n.padding).attr("y",u+n.dividerMargin+n.textHeight).attr("fill","white").attr("class","classText");c=!0,e.members.forEach((function(t){os(p,t,c,n),c=!1}));const f=p.node().getBBox(),g=s.append("line").attr("x1",0).attr("y1",n.padding+u+n.dividerMargin+f.height).attr("y2",n.padding+u+n.dividerMargin+f.height),y=s.append("text").attr("x",n.padding).attr("y",u+2*n.dividerMargin+f.height+n.textHeight).attr("fill","white").attr("class","classText");c=!0,e.methods.forEach((function(t){os(y,t,c,n),c=!1}));const m=s.node().getBBox();var b=" ";e.cssClasses.length>0&&(b+=e.cssClasses.join(" "));const _=s.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",m.width+2*n.padding).attr("height",m.height+n.padding+.5*n.dividerMargin).attr("class",b).node().getBBox().width;return o.node().childNodes.forEach((function(t){t.setAttribute("x",(_-t.getBBox().width)/2)})),e.tooltip&&o.insert("title").text(e.tooltip),d.attr("x2",_),g.attr("x2",_),a.width=_,a.height=m.height+n.padding+.5*n.dividerMargin,a},hs=function(t,e,n,r,i){const a=function(t){switch(t){case i.db.relationType.AGGREGATION:return"aggregation";case i.db.relationType.EXTENSION:return"extension";case i.db.relationType.COMPOSITION:return"composition";case i.db.relationType.DEPENDENCY:return"dependency";case i.db.relationType.LOLLIPOP:return"lollipop"}};e.points=e.points.filter((t=>!Number.isNaN(t.y)));const s=e.points,c=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(o.$0Z),l=t.append("path").attr("d",c(s)).attr("id","edge"+ns).attr("class","relation");let h,u,d="";r.arrowMarkerAbsolute&&(d=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,d=d.replace(/\(/g,"\\("),d=d.replace(/\)/g,"\\)")),1==n.relation.lineType&&l.attr("class","relation dashed-line"),10==n.relation.lineType&&l.attr("class","relation dotted-line"),"none"!==n.relation.type1&&l.attr("marker-start","url("+d+"#"+a(n.relation.type1)+"Start)"),"none"!==n.relation.type2&&l.attr("marker-end","url("+d+"#"+a(n.relation.type2)+"End)");const p=e.points.length;let f,g,y,m,b=er.calcLabelPosition(e.points);if(h=b.x,u=b.y,p%2!=0&&p>1){let t=er.calcCardinalityPosition("none"!==n.relation.type1,e.points,e.points[0]),r=er.calcCardinalityPosition("none"!==n.relation.type2,e.points,e.points[p-1]);Bt.debug("cardinality_1_point "+JSON.stringify(t)),Bt.debug("cardinality_2_point "+JSON.stringify(r)),f=t.x,g=t.y,y=r.x,m=r.y}if(void 0!==n.title){const e=t.append("g").attr("class","classLabel"),i=e.append("text").attr("class","label").attr("x",h).attr("y",u).attr("fill","red").attr("text-anchor","middle").text(n.title);window.label=i;const a=i.node().getBBox();e.insert("rect",":first-child").attr("class","box").attr("x",a.x-r.padding/2).attr("y",a.y-r.padding/2).attr("width",a.width+r.padding).attr("height",a.height+r.padding)}if(Bt.info("Rendering relation "+JSON.stringify(n)),void 0!==n.relationTitle1&&"none"!==n.relationTitle1){t.append("g").attr("class","cardinality").append("text").attr("class","type1").attr("x",f).attr("y",g).attr("fill","black").attr("font-size","6").text(n.relationTitle1)}if(void 0!==n.relationTitle2&&"none"!==n.relationTitle2){t.append("g").attr("class","cardinality").append("text").attr("class","type2").attr("x",y).attr("y",m).attr("fill","black").attr("font-size","6").text(n.relationTitle2)}ns++},us=function(t,e,n,r){Bt.debug("Rendering note ",e,n);const i=e.id,a={id:i,text:e.text,width:0,height:0},s=t.append("g").attr("id",i).attr("class","classGroup");let o=s.append("text").attr("y",n.textHeight+n.padding).attr("x",0);const c=JSON.parse(`"${e.text}"`).split("\n");c.forEach((function(t){Bt.debug(`Adding line: ${t}`),o.append("tspan").text(t).attr("class","title").attr("dy",n.textHeight)}));const l=s.node().getBBox(),h=s.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",l.width+2*n.padding).attr("height",l.height+c.length*n.textHeight+n.padding+.5*n.dividerMargin).node().getBBox().width;return o.node().childNodes.forEach((function(t){t.setAttribute("x",(h-t.getBBox().width)/2)})),a.width=h,a.height=l.height+c.length*n.textHeight+n.padding+.5*n.dividerMargin,a};let ds={};const ps=function(t){const e=Object.entries(ds).find((e=>e[1].label===t));if(e)return e[0]},fs={draw:function(t,e,n,r){const i=ur().class;ds={},Bt.info("Rendering diagram "+t);const a=ur().securityLevel;let s;"sandbox"===a&&(s=(0,o.Ys)("#i"+e));const c="sandbox"===a?(0,o.Ys)(s.nodes()[0].contentDocument.body):(0,o.Ys)("body"),l=c.select(`[id='${e}']`);var h;(h=l).append("defs").append("marker").attr("id","extensionStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),h.append("defs").append("marker").attr("id","extensionEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),h.append("defs").append("marker").attr("id","compositionStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),h.append("defs").append("marker").attr("id","compositionEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),h.append("defs").append("marker").attr("id","aggregationStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),h.append("defs").append("marker").attr("id","aggregationEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),h.append("defs").append("marker").attr("id","dependencyStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),h.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z");const u=new lt.k({multigraph:!0});u.setGraph({isMultiGraph:!0}),u.setDefaultEdgeLabel((function(){return{}}));const d=r.db.getClasses(),p=Object.keys(d);for(const o of p){const t=d[o],e=ls(l,t,i,r);ds[e.id]=e,u.setNode(e.id,e),Bt.info("Org height: "+e.height)}r.db.getRelations().forEach((function(t){Bt.info("tjoho"+ps(t.id1)+ps(t.id2)+JSON.stringify(t)),u.setEdge(ps(t.id1),ps(t.id2),{relation:t},t.title||"DEFAULT")}));r.db.getNotes().forEach((function(t){Bt.debug(`Adding note: ${JSON.stringify(t)}`);const e=us(l,t,i,r);ds[e.id]=e,u.setNode(e.id,e),t.class&&t.class in d&&u.setEdge(t.id,ps(t.class),{relation:{id1:t.id,id2:t.class,relation:{type1:"none",type2:"none",lineType:10}}},"DEFAULT")})),(0,ct.bK)(u),u.nodes().forEach((function(t){void 0!==t&&void 0!==u.node(t)&&(Bt.debug("Node "+t+": "+JSON.stringify(u.node(t))),c.select("#"+(r.db.lookUpDomId(t)||t)).attr("transform","translate("+(u.node(t).x-u.node(t).width/2)+","+(u.node(t).y-u.node(t).height/2)+" )"))})),u.edges().forEach((function(t){void 0!==t&&void 0!==u.edge(t)&&(Bt.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(u.edge(t))),hs(l,u.edge(t),u.edge(t).relation,i,r))}));const f=l.node().getBBox(),g=f.width+40,y=f.height+40;br(l,y,g,i.useMaxWidth);const m=`${f.x-20} ${f.y-20} ${g} ${y}`;Bt.debug(`viewBox ${m}`),l.attr("viewBox",m)}},gs={extension:(t,e,n)=>{Bt.trace("Making markers for ",n),t.append("defs").append("marker").attr("id",e+"-extensionStart").attr("class","marker extension "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},composition:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-compositionStart").attr("class","marker composition "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},aggregation:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},dependency:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},lollipop:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","white").attr("cx",6).attr("cy",7).attr("r",6)},point:(t,e)=>{t.append("marker").attr("id",e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 12 20").attr("refX",10).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},circle:(t,e)=>{t.append("marker").attr("id",e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},cross:(t,e)=>{t.append("marker").attr("id",e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},barb:(t,e)=>{t.append("defs").append("marker").attr("id",e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")}},ys=(t,e,n,r)=>{e.forEach((e=>{gs[e](t,n,r)}))};const ms=(t,e,n,r)=>{let i=t||"";if("object"==typeof i&&(i=i[0]),Zt(ur().flowchart.htmlLabels)){i=i.replace(/\\n|\n/g,"<br />"),Bt.info("vertexText"+i);let t=function(t){const e=(0,o.Ys)(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),n=e.append("xhtml:div"),r=t.label,i=t.isNode?"nodeLabel":"edgeLabel";var a,s;return n.html('<span class="'+i+'" '+(t.labelStyle?'style="'+t.labelStyle+'"':"")+">"+r+"</span>"),a=n,(s=t.labelStyle)&&a.attr("style",s),n.style("display","inline-block"),n.style("white-space","nowrap"),n.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}({isNode:r,label:up(i).replace(/fa[blrs]?:fa-[\w-]+/g,(t=>`<i class='${t.replace(":"," ")}'></i>`)),labelStyle:e.replace("fill:","color:")});return t}{const t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",e.replace("color:","fill:"));let r=[];r="string"==typeof i?i.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(i)?i:[];for(const e of r){const r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.setAttribute("dy","1em"),r.setAttribute("x","0"),n?r.setAttribute("class","title-row"):r.setAttribute("class","row"),r.textContent=e.trim(),t.appendChild(r)}return t}},bs=(t,e,n,r)=>{let i;i=n||"node default";const a=t.insert("g").attr("class",i).attr("id",e.domId||e.id),s=a.insert("g").attr("class","label").attr("style",e.labelStyle);let c;c=void 0===e.labelText?"":"string"==typeof e.labelText?e.labelText:e.labelText[0];const l=s.node().appendChild(ms(It(up(c),ur()),e.labelStyle,!1,r));let h=l.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=l.children[0],e=(0,o.Ys)(l);h=t.getBoundingClientRect(),e.attr("width",h.width),e.attr("height",h.height)}const u=e.padding/2;return s.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"),{shapeSvg:a,bbox:h,halfPadding:u,label:s}},_s=(t,e)=>{const n=e.node().getBBox();t.width=n.width,t.height=n.height};function xs(t,e,n,r){return t.insert("polygon",":first-child").attr("points",r.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+n/2+")")}let vs={},ks={},ws={};const Cs=(t,e)=>(Bt.trace("In isDecendant",e," ",t," = ",ks[e].includes(t)),!!ks[e].includes(t)),Es=(t,e,n,r)=>{Bt.warn("Copying children of ",t,"root",r,"data",e.node(t),r);const i=e.children(t)||[];t!==r&&i.push(t),Bt.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach((i=>{if(e.children(i).length>0)Es(i,e,n,r);else{const a=e.node(i);Bt.info("cp ",i," to ",r," with parent ",t),n.setNode(i,a),r!==e.parent(i)&&(Bt.warn("Setting parent",i,e.parent(i)),n.setParent(i,e.parent(i))),t!==r&&i!==t?(Bt.debug("Setting parent",i,t),n.setParent(i,t)):(Bt.info("In copy ",t,"root",r,"data",e.node(t),r),Bt.debug("Not Setting parent for node=",i,"cluster!==rootId",t!==r,"node!==clusterId",i!==t));const s=e.edges(i);Bt.debug("Copying Edges",s),s.forEach((i=>{Bt.info("Edge",i);const a=e.edge(i.v,i.w,i.name);Bt.info("Edge data",a,r);try{((t,e)=>(Bt.info("Decendants of ",e," is ",ks[e]),Bt.info("Edge is ",t),t.v!==e&&t.w!==e&&(ks[e]?ks[e].includes(t.v)||Cs(t.v,e)||Cs(t.w,e)||ks[e].includes(t.w):(Bt.debug("Tilt, ",e,",not in decendants"),!1))))(i,r)?(Bt.info("Copying as ",i.v,i.w,a,i.name),n.setEdge(i.v,i.w,a,i.name),Bt.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):Bt.info("Skipping copy of edge ",i.v,"--\x3e",i.w," rootId: ",r," clusterId:",t)}catch(s){Bt.error(s)}}))}Bt.debug("Removing node",i),e.removeNode(i)}))},Ts=(t,e)=>{const n=e.children(t);let r=[...n];for(const i of n)ws[i]=t,r=[...r,...Ts(i,e)];return r},Ss=(t,e)=>{Bt.trace("Searching",t);const n=e.children(t);if(Bt.trace("Searching children of id ",t,n),n.length<1)return Bt.trace("This is a valid node",t),t;for(const r of n){const n=Ss(r,e);if(n)return Bt.trace("Found replacement for",t," => ",n),n}},As=t=>vs[t]&&vs[t].externalConnections&&vs[t]?vs[t].id:t,Ls=(t,e)=>{if(Bt.warn("extractor - ",e,ht.c(t),t.children("D")),e>10)return void Bt.error("Bailing out");let n=t.nodes(),r=!1;for(const i of n){const e=t.children(i);r=r||e.length>0}if(r){Bt.debug("Nodes = ",n,e);for(const r of n)if(Bt.debug("Extracting node",r,vs,vs[r]&&!vs[r].externalConnections,!t.parent(r),t.node(r),t.children("D")," Depth ",e),vs[r])if(!vs[r].externalConnections&&t.children(r)&&t.children(r).length>0){Bt.warn("Cluster without external connections, without a parent and with children",r,e);let n="TB"===t.graph().rankdir?"LR":"TB";vs[r]&&vs[r].clusterData&&vs[r].clusterData.dir&&(n=vs[r].clusterData.dir,Bt.warn("Fixing dir",vs[r].clusterData.dir,n));const i=new lt.k({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}}));Bt.warn("Old graph before copy",ht.c(t)),Es(r,t,i,r),t.setNode(r,{clusterNode:!0,id:r,clusterData:vs[r].clusterData,labelText:vs[r].labelText,graph:i}),Bt.warn("New graph after copy node: (",r,")",ht.c(i)),Bt.debug("Old graph after copy",ht.c(t))}else Bt.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!vs[r].externalConnections," no parent: ",!t.parent(r)," children ",t.children(r)&&t.children(r).length>0,t.children("D"),e),Bt.debug(vs);else Bt.debug("Not a cluster",r,e);n=t.nodes(),Bt.warn("New list of nodes",n);for(const r of n){const n=t.node(r);Bt.warn(" Now next level",r,n),n.clusterNode&&Ls(n.graph,e+1)}}else Bt.debug("Done, no node has children",t.nodes())},Bs=(t,e)=>{if(0===e.length)return[];let n=Object.assign(e);return e.forEach((e=>{const r=t.children(e),i=Bs(t,r);n=[...n,...i]})),n};function Ns(t,e,n,r){var i=t.x,a=t.y,s=i-r.x,o=a-r.y,c=Math.sqrt(e*e*o*o+n*n*s*s),l=Math.abs(e*n*s/c);r.x<i&&(l=-l);var h=Math.abs(e*n*o/c);return r.y<a&&(h=-h),{x:i+l,y:a+h}}function Ds(t,e,n,r){var i,a,s,o,c,l,h,u,d,p,f,g,y;if(i=e.y-t.y,s=t.x-e.x,c=e.x*t.y-t.x*e.y,d=i*n.x+s*n.y+c,p=i*r.x+s*r.y+c,!(0!==d&&0!==p&&Os(d,p)||(a=r.y-n.y,o=n.x-r.x,l=r.x*n.y-n.x*r.y,h=a*t.x+o*t.y+l,u=a*e.x+o*e.y+l,0!==h&&0!==u&&Os(h,u)||0==(f=i*o-a*s))))return g=Math.abs(f/2),{x:(y=s*l-o*c)<0?(y-g)/f:(y+g)/f,y:(y=a*c-i*l)<0?(y-g)/f:(y+g)/f}}function Os(t,e){return t*e>0}const Ms=(t,e)=>{var n,r,i=t.x,a=t.y,s=e.x-i,o=e.y-a,c=t.width/2,l=t.height/2;return Math.abs(o)*c>Math.abs(s)*l?(o<0&&(l=-l),n=0===o?0:l*s/o,r=l):(s<0&&(c=-c),n=c,r=0===s?0:c*o/s),{x:i+n,y:a+r}},Is={node:function(t,e){return t.intersect(e)},circle:function(t,e,n){return Ns(t,e,e,n)},ellipse:Ns,polygon:function(t,e,n){var r=t.x,i=t.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;"function"==typeof e.forEach?e.forEach((function(t){s=Math.min(s,t.x),o=Math.min(o,t.y)})):(s=Math.min(s,e.x),o=Math.min(o,e.y));for(var c=r-t.width/2-s,l=i-t.height/2-o,h=0;h<e.length;h++){var u=e[h],d=e[h<e.length-1?h+1:0],p=Ds(t,n,{x:c+u.x,y:l+u.y},{x:c+d.x,y:l+d.y});p&&a.push(p)}return a.length?(a.length>1&&a.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),s=e.x-n.x,o=e.y-n.y,c=Math.sqrt(s*s+o*o);return a<c?-1:a===c?0:1})),a[0]):t},rect:Ms},Fs=(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=bs(t,e,"node "+e.classes,!0);Bt.info("Classes = ",e.classes);const a=n.insert("rect",":first-child");return a.attr("rx",e.rx).attr("ry",e.ry).attr("x",-r.width/2-i).attr("y",-r.height/2-i).attr("width",r.width+e.padding).attr("height",r.height+e.padding),_s(e,a),e.intersect=function(t){return Is.rect(e,t)},n},$s=(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding+(r.height+e.padding),a=[{x:i/2,y:0},{x:i,y:-i/2},{x:i/2,y:-i},{x:0,y:-i/2}];Bt.info("Question main (Circle)");const s=xs(n,i,i,a);return s.attr("style",e.style),_s(e,s),e.intersect=function(t){return Bt.warn("Intersect called"),Is.polygon(e,a,t)},n};function Rs(t,e,n,r){const i=[],a=t=>{i.push(t,0)},s=t=>{i.push(0,t)};e.includes("t")?(Bt.debug("add top border"),a(n)):s(n),e.includes("r")?(Bt.debug("add right border"),a(r)):s(r),e.includes("b")?(Bt.debug("add bottom border"),a(n)):s(n),e.includes("l")?(Bt.debug("add left border"),a(r)):s(r),t.attr("stroke-dasharray",i.join(" "))}const Zs=(t,e,n)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let i=70,a=10;"LR"===n&&(i=10,a=70);const s=r.append("rect").attr("x",-1*i/2).attr("y",-1*a/2).attr("width",i).attr("height",a).attr("class","fork-join");return _s(e,s),e.height=e.height+e.padding/2,e.width=e.width+e.padding/2,e.intersect=function(t){return Is.rect(e,t)},r},Ps={rhombus:$s,question:$s,rect:(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=bs(t,e,"node "+e.classes,!0);Bt.trace("Classes = ",e.classes);const a=n.insert("rect",":first-child"),s=r.width+e.padding,o=r.height+e.padding;if(a.attr("class","basic label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",-r.width/2-i).attr("y",-r.height/2-i).attr("width",s).attr("height",o),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(Rs(a,e.props.borders,s,o),t.delete("borders")),t.forEach((t=>{Bt.warn(`Unknown node property ${t}`)}))}return _s(e,a),e.intersect=function(t){return Is.rect(e,t)},n},labelRect:(t,e)=>{const{shapeSvg:n}=bs(t,e,"label",!0);Bt.trace("Classes = ",e.classes);const r=n.insert("rect",":first-child");if(r.attr("width",0).attr("height",0),n.attr("class","label edgeLabel"),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(Rs(r,e.props.borders,0,0),t.delete("borders")),t.forEach((t=>{Bt.warn(`Unknown node property ${t}`)}))}return _s(e,r),e.intersect=function(t){return Is.rect(e,t)},n},rectWithTitle:(t,e)=>{let n;n=e.classes?"node "+e.classes:"node default";const r=t.insert("g").attr("class",n).attr("id",e.domId||e.id),i=r.insert("rect",":first-child"),a=r.insert("line"),s=r.insert("g").attr("class","label"),c=e.labelText.flat?e.labelText.flat():e.labelText;let l="";l="object"==typeof c?c[0]:c,Bt.info("Label text abc79",l,c,"object"==typeof c);const h=s.node().appendChild(ms(l,e.labelStyle,!0,!0));let u={width:0,height:0};if(Zt(ur().flowchart.htmlLabels)){const t=h.children[0],e=(0,o.Ys)(h);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}Bt.info("Text 2",c);const d=c.slice(1,c.length);let p=h.getBBox();const f=s.node().appendChild(ms(d.join?d.join("<br/>"):d,e.labelStyle,!0,!0));if(Zt(ur().flowchart.htmlLabels)){const t=f.children[0],e=(0,o.Ys)(f);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}const g=e.padding/2;return(0,o.Ys)(f).attr("transform","translate( "+(u.width>p.width?0:(p.width-u.width)/2)+", "+(p.height+g+5)+")"),(0,o.Ys)(h).attr("transform","translate( "+(u.width<p.width?0:-(p.width-u.width)/2)+", 0)"),u=s.node().getBBox(),s.attr("transform","translate("+-u.width/2+", "+(-u.height/2-g+3)+")"),i.attr("class","outer title-state").attr("x",-u.width/2-g).attr("y",-u.height/2-g).attr("width",u.width+e.padding).attr("height",u.height+e.padding),a.attr("class","divider").attr("x1",-u.width/2-g).attr("x2",u.width/2+g).attr("y1",-u.height/2-g+p.height+g).attr("y2",-u.height/2-g+p.height+g),_s(e,i),e.intersect=function(t){return Is.rect(e,t)},r},choice:(t,e)=>{const n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),r=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return n.insert("polygon",":first-child").attr("points",r.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),e.width=28,e.height=28,e.intersect=function(t){return Is.circle(e,14,t)},n},circle:(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=bs(t,e,void 0,!0),a=n.insert("circle",":first-child");return a.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",r.width/2+i).attr("width",r.width+e.padding).attr("height",r.height+e.padding),Bt.info("Circle main"),_s(e,a),e.intersect=function(t){return Bt.info("Circle intersect",e,r.width/2+i,t),Is.circle(e,r.width/2+i,t)},n},doublecircle:(t,e)=>{const{shapeSvg:n,bbox:r,halfPadding:i}=bs(t,e,void 0,!0),a=n.insert("g",":first-child"),s=a.insert("circle"),o=a.insert("circle");return s.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",r.width/2+i+5).attr("width",r.width+e.padding+10).attr("height",r.height+e.padding+10),o.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",r.width/2+i).attr("width",r.width+e.padding).attr("height",r.height+e.padding),Bt.info("DoubleCircle main"),_s(e,s),e.intersect=function(t){return Bt.info("DoubleCircle intersect",e,r.width/2+i+5,t),Is.circle(e,r.width/2+i+5,t)},n},stadium:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.height+e.padding,a=r.width+i/4+e.padding,s=n.insert("rect",":first-child").attr("style",e.style).attr("rx",i/2).attr("ry",i/2).attr("x",-a/2).attr("y",-i/2).attr("width",a).attr("height",i);return _s(e,s),e.intersect=function(t){return Is.rect(e,t)},n},hexagon:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.height+e.padding,a=i/4,s=r.width+2*a+e.padding,o=[{x:a,y:0},{x:s-a,y:0},{x:s,y:-i/2},{x:s-a,y:-i},{x:a,y:-i},{x:0,y:-i/2}],c=xs(n,s,i,o);return c.attr("style",e.style),_s(e,c),e.intersect=function(t){return Is.polygon(e,o,t)},n},rect_left_inv_arrow:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:-a/2,y:0},{x:i,y:0},{x:i,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}];return xs(n,i,a,s).attr("style",e.style),e.width=i+a,e.height=a,e.intersect=function(t){return Is.polygon(e,s,t)},n},lean_right:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:-2*a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:a/6,y:-a}],o=xs(n,i,a,s);return o.attr("style",e.style),_s(e,o),e.intersect=function(t){return Is.polygon(e,s,t)},n},lean_left:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:2*a/6,y:0},{x:i+a/6,y:0},{x:i-2*a/6,y:-a},{x:-a/6,y:-a}],o=xs(n,i,a,s);return o.attr("style",e.style),_s(e,o),e.intersect=function(t){return Is.polygon(e,s,t)},n},trapezoid:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:-2*a/6,y:0},{x:i+2*a/6,y:0},{x:i-a/6,y:-a},{x:a/6,y:-a}],o=xs(n,i,a,s);return o.attr("style",e.style),_s(e,o),e.intersect=function(t){return Is.polygon(e,s,t)},n},inv_trapezoid:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:-2*a/6,y:-a}],o=xs(n,i,a,s);return o.attr("style",e.style),_s(e,o),e.intersect=function(t){return Is.polygon(e,s,t)},n},rect_right_inv_arrow:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:0,y:0},{x:i+a/2,y:0},{x:i,y:-a/2},{x:i+a/2,y:-a},{x:0,y:-a}],o=xs(n,i,a,s);return o.attr("style",e.style),_s(e,o),e.intersect=function(t){return Is.polygon(e,s,t)},n},cylinder:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=i/2,s=a/(2.5+i/50),o=r.height+s+e.padding,c="M 0,"+s+" a "+a+","+s+" 0,0,0 "+i+" 0 a "+a+","+s+" 0,0,0 "+-i+" 0 l 0,"+o+" a "+a+","+s+" 0,0,0 "+i+" 0 l 0,"+-o,l=n.attr("label-offset-y",s).insert("path",":first-child").attr("style",e.style).attr("d",c).attr("transform","translate("+-i/2+","+-(o/2+s)+")");return _s(e,l),e.intersect=function(t){const n=Is.rect(e,t),r=n.x-e.x;if(0!=a&&(Math.abs(r)<e.width/2||Math.abs(r)==e.width/2&&Math.abs(n.y-e.y)>e.height/2-s)){let i=s*s*(1-r*r/(a*a));0!=i&&(i=Math.sqrt(i)),i=s-i,t.y-e.y>0&&(i=-i),n.y+=i}return n},n},start:(t,e)=>{const n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),r=n.insert("circle",":first-child");return r.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),_s(e,r),e.intersect=function(t){return Is.circle(e,7,t)},n},end:(t,e)=>{const n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),r=n.insert("circle",":first-child"),i=n.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),r.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),_s(e,i),e.intersect=function(t){return Is.circle(e,7,t)},n},note:Fs,subroutine:(t,e)=>{const{shapeSvg:n,bbox:r}=bs(t,e,void 0,!0),i=r.width+e.padding,a=r.height+e.padding,s=[{x:0,y:0},{x:i,y:0},{x:i,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],o=xs(n,i,a,s);return o.attr("style",e.style),_s(e,o),e.intersect=function(t){return Is.polygon(e,s,t)},n},fork:Zs,join:Zs,class_box:(t,e)=>{const n=e.padding/2;let r;r=e.classes?"node "+e.classes:"node default";const i=t.insert("g").attr("class",r).attr("id",e.domId||e.id),a=i.insert("rect",":first-child"),s=i.insert("line"),c=i.insert("line");let l=0,h=4;const u=i.insert("g").attr("class","label");let d=0;const p=e.classData.annotations&&e.classData.annotations[0],f=e.classData.annotations[0]?"\xab"+e.classData.annotations[0]+"\xbb":"",g=u.node().appendChild(ms(f,e.labelStyle,!0,!0));let y=g.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=g.children[0],e=(0,o.Ys)(g);y=t.getBoundingClientRect(),e.attr("width",y.width),e.attr("height",y.height)}e.classData.annotations[0]&&(h+=y.height+4,l+=y.width);let m=e.classData.id;void 0!==e.classData.type&&""!==e.classData.type&&(ur().flowchart.htmlLabels?m+="<"+e.classData.type+">":m+="<"+e.classData.type+">");const b=u.node().appendChild(ms(m,e.labelStyle,!0,!0));(0,o.Ys)(b).attr("class","classTitle");let _=b.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=b.children[0],e=(0,o.Ys)(b);_=t.getBoundingClientRect(),e.attr("width",_.width),e.attr("height",_.height)}h+=_.height+4,_.width>l&&(l=_.width);const x=[];e.classData.members.forEach((t=>{const n=rs(t);let r=n.displayText;ur().flowchart.htmlLabels&&(r=r.replace(/</g,"<").replace(/>/g,">"));const i=u.node().appendChild(ms(r,n.cssStyle?n.cssStyle:e.labelStyle,!0,!0));let a=i.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=i.children[0],e=(0,o.Ys)(i);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>l&&(l=a.width),h+=a.height+4,x.push(i)})),h+=8;const v=[];if(e.classData.methods.forEach((t=>{const n=rs(t);let r=n.displayText;ur().flowchart.htmlLabels&&(r=r.replace(/</g,"<").replace(/>/g,">"));const i=u.node().appendChild(ms(r,n.cssStyle?n.cssStyle:e.labelStyle,!0,!0));let a=i.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=i.children[0],e=(0,o.Ys)(i);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>l&&(l=a.width),h+=a.height+4,v.push(i)})),h+=8,p){let t=(l-y.width)/2;(0,o.Ys)(g).attr("transform","translate( "+(-1*l/2+t)+", "+-1*h/2+")"),d=y.height+4}let k=(l-_.width)/2;return(0,o.Ys)(b).attr("transform","translate( "+(-1*l/2+k)+", "+(-1*h/2+d)+")"),d+=_.height+4,s.attr("class","divider").attr("x1",-l/2-n).attr("x2",l/2+n).attr("y1",-h/2-n+8+d).attr("y2",-h/2-n+8+d),d+=8,x.forEach((t=>{(0,o.Ys)(t).attr("transform","translate( "+-l/2+", "+(-1*h/2+d+4)+")"),d+=_.height+4})),d+=8,c.attr("class","divider").attr("x1",-l/2-n).attr("x2",l/2+n).attr("y1",-h/2-n+8+d).attr("y2",-h/2-n+8+d),d+=8,v.forEach((t=>{(0,o.Ys)(t).attr("transform","translate( "+-l/2+", "+(-1*h/2+d)+")"),d+=_.height+4})),a.attr("class","outer title-state").attr("x",-l/2-n).attr("y",-h/2-n).attr("width",l+e.padding).attr("height",h+e.padding),_s(e,a),e.intersect=function(t){return Is.rect(e,t)},i}};let js={};const Ys=(t,e,n)=>{let r,i;if(e.link){let a;"sandbox"===ur().securityLevel?a="_top":e.linkTarget&&(a=e.linkTarget||"_blank"),r=t.insert("svg:a").attr("xlink:href",e.link).attr("target",a),i=Ps[e.shape](r,e,n)}else i=Ps[e.shape](t,e,n),r=i;return e.tooltip&&i.attr("title",e.tooltip),e.class&&i.attr("class","node default "+e.class),js[e.id]=r,e.haveCallback&&js[e.id].attr("class",js[e.id].attr("class")+" clickable"),r},zs=t=>{const e=js[t.id];Bt.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-8)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},Us={rect:(t,e)=>{Bt.trace("Creating subgraph rect for ",e.id,e);const n=t.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),r=n.insert("rect",":first-child"),i=n.insert("g").attr("class","cluster-label"),a=i.node().appendChild(ms(e.labelText,e.labelStyle,void 0,!0));let s=a.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=a.children[0],e=(0,o.Ys)(a);s=t.getBoundingClientRect(),e.attr("width",s.width),e.attr("height",s.height)}const c=0*e.padding,l=c/2,h=e.width<=s.width+c?s.width+c:e.width;e.width<=s.width+c?e.diff=(s.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,Bt.trace("Data ",e,JSON.stringify(e)),r.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-h/2).attr("y",e.y-e.height/2-l).attr("width",h).attr("height",e.height+c),i.attr("transform","translate("+(e.x-s.width/2)+", "+(e.y-e.height/2)+")");const u=r.node().getBBox();return e.width=u.width,e.height=u.height,e.intersect=function(t){return Ms(e,t)},n},roundedWithTitle:(t,e)=>{const n=t.insert("g").attr("class",e.classes).attr("id",e.id),r=n.insert("rect",":first-child"),i=n.insert("g").attr("class","cluster-label"),a=n.append("rect"),s=i.node().appendChild(ms(e.labelText,e.labelStyle,void 0,!0));let c=s.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=s.children[0],e=(0,o.Ys)(s);c=t.getBoundingClientRect(),e.attr("width",c.width),e.attr("height",c.height)}c=s.getBBox();const l=0*e.padding,h=l/2,u=e.width<=c.width+e.padding?c.width+e.padding:e.width;e.width<=c.width+e.padding?e.diff=(c.width+0*e.padding-e.width)/2:e.diff=-e.padding/2,r.attr("class","outer").attr("x",e.x-u/2-h).attr("y",e.y-e.height/2-h).attr("width",u+l).attr("height",e.height+l),a.attr("class","inner").attr("x",e.x-u/2-h).attr("y",e.y-e.height/2-h+c.height-1).attr("width",u+l).attr("height",e.height+l-c.height-3),i.attr("transform","translate("+(e.x-c.width/2)+", "+(e.y-e.height/2-e.padding/3+(Zt(ur().flowchart.htmlLabels)?5:3))+")");const d=r.node().getBBox();return e.height=d.height,e.intersect=function(t){return Ms(e,t)},n},noteGroup:(t,e)=>{const n=t.insert("g").attr("class","note-cluster").attr("id",e.id),r=n.insert("rect",":first-child"),i=0*e.padding,a=i/2;r.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-a).attr("y",e.y-e.height/2-a).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");const s=r.node().getBBox();return e.width=s.width,e.height=s.height,e.intersect=function(t){return Ms(e,t)},n},divider:(t,e)=>{const n=t.insert("g").attr("class",e.classes).attr("id",e.id),r=n.insert("rect",":first-child"),i=0*e.padding,a=i/2;r.attr("class","divider").attr("x",e.x-e.width/2-a).attr("y",e.y-e.height/2).attr("width",e.width+i).attr("height",e.height+i);const s=r.node().getBBox();return e.width=s.width,e.height=s.height,e.diff=-e.padding/2,e.intersect=function(t){return Ms(e,t)},n}};let Ws={};let Hs={},qs={};const Vs=(t,e)=>{const n=ms(e.label,e.labelStyle),r=t.insert("g").attr("class","edgeLabel"),i=r.insert("g").attr("class","label");i.node().appendChild(n);let a,s=n.getBBox();if(Zt(ur().flowchart.htmlLabels)){const t=n.children[0],e=(0,o.Ys)(n);s=t.getBoundingClientRect(),e.attr("width",s.width),e.attr("height",s.height)}if(i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),Hs[e.id]=r,e.width=s.width,e.height=s.height,e.startLabelLeft){const n=ms(e.startLabelLeft,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),qs[e.id]||(qs[e.id]={}),qs[e.id].startLeft=r,Gs(a,e.startLabelLeft)}if(e.startLabelRight){const n=ms(e.startLabelRight,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=r.node().appendChild(n),i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),qs[e.id]||(qs[e.id]={}),qs[e.id].startRight=r,Gs(a,e.startLabelRight)}if(e.endLabelLeft){const n=ms(e.endLabelLeft,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),r.node().appendChild(n),qs[e.id]||(qs[e.id]={}),qs[e.id].endLeft=r,Gs(a,e.endLabelLeft)}if(e.endLabelRight){const n=ms(e.endLabelRight,e.labelStyle),r=t.insert("g").attr("class","edgeTerminals"),i=r.insert("g").attr("class","inner");a=i.node().appendChild(n);const s=n.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),r.node().appendChild(n),qs[e.id]||(qs[e.id]={}),qs[e.id].endRight=r,Gs(a,e.endLabelRight)}return n};function Gs(t,e){ur().flowchart.htmlLabels&&t&&(t.style.width=9*e.length+"px",t.style.height="12px")}const Xs=(t,e)=>{Bt.warn("abc88 cutPathAtIntersect",t,e);let n=[],r=t[0],i=!1;return t.forEach((t=>{if(Bt.info("abc88 checking point",t,e),((t,e)=>{const n=t.x,r=t.y,i=Math.abs(e.x-n),a=Math.abs(e.y-r),s=t.width/2,o=t.height/2;return i>=s||a>=o})(e,t)||i)Bt.warn("abc88 outside",t,r),r=t,i||n.push(t);else{const a=((t,e,n)=>{Bt.warn(`intersection calc abc89:\n outsidePoint: ${JSON.stringify(e)}\n insidePoint : ${JSON.stringify(n)}\n node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const r=t.x,i=t.y,a=Math.abs(r-n.x),s=t.width/2;let o=n.x<e.x?s-a:s+a;const c=t.height/2,l=Math.abs(e.y-n.y),h=Math.abs(e.x-n.x);if(Math.abs(i-e.y)*s>Math.abs(r-e.x)*c){let t=n.y<e.y?e.y-c-i:i-c-e.y;o=h*t/l;const r={x:n.x<e.x?n.x+o:n.x-h+o,y:n.y<e.y?n.y+l-t:n.y-l+t};return 0===o&&(r.x=e.x,r.y=e.y),0===h&&(r.x=e.x),0===l&&(r.y=e.y),Bt.warn(`abc89 topp/bott calc, Q ${l}, q ${t}, R ${h}, r ${o}`,r),r}{o=n.x<e.x?e.x-s-r:r-s-e.x;let t=l*o/h,i=n.x<e.x?n.x+h-o:n.x-h+o,a=n.y<e.y?n.y+t:n.y-t;return Bt.warn(`sides calc abc89, Q ${l}, q ${t}, R ${h}, r ${o}`,{_x:i,_y:a}),0===o&&(i=e.x,a=e.y),0===h&&(i=e.x),0===l&&(a=e.y),{x:i,y:a}}})(e,r,t);Bt.warn("abc88 inside",t,r,a),Bt.warn("abc88 intersection",a);let s=!1;n.forEach((t=>{s=s||t.x===a.x&&t.y===a.y})),n.some((t=>t.x===a.x&&t.y===a.y))?Bt.warn("abc88 no intersect",a,n):n.push(a),i=!0}})),Bt.warn("abc88 returning points",n),n},Qs=(t,e,n,r)=>{Bt.info("Graph in recursive render: XXX",ht.c(e),r);const i=e.graph().rankdir;Bt.trace("Dir in recursive render - dir:",i);const a=t.insert("g").attr("class","root");e.nodes()?Bt.info("Recursive render XXX",e.nodes()):Bt.info("No nodes found for",e),e.edges().length>0&&Bt.trace("Recursive edges",e.edge(e.edges()[0]));const s=a.insert("g").attr("class","clusters"),c=a.insert("g").attr("class","edgePaths"),l=a.insert("g").attr("class","edgeLabels"),h=a.insert("g").attr("class","nodes");e.nodes().forEach((function(t){const a=e.node(t);if(void 0!==r){const n=JSON.parse(JSON.stringify(r.clusterData));Bt.info("Setting data for cluster XXX (",t,") ",n,r),e.setNode(r.id,n),e.parent(t)||(Bt.trace("Setting parent",t,r.id),e.setParent(t,r.id,n))}if(Bt.info("(Insert) Node XXX"+t+": "+JSON.stringify(e.node(t))),a&&a.clusterNode){Bt.info("Cluster identified",t,a.width,e.node(t));const r=Qs(h,a.graph,n,e.node(t)),i=r.elem;_s(a,i),a.diff=r.diff||0,Bt.info("Node bounds (abc123)",t,a,a.width,a.x,a.y),((t,e)=>{js[e.id]=t})(i,a),Bt.warn("Recursive render complete ",i,a)}else e.children(t).length>0?(Bt.info("Cluster - the non recursive path XXX",t,a.id,a,e),Bt.info(Ss(a.id,e)),vs[a.id]={id:Ss(a.id,e),node:a}):(Bt.info("Node - the non recursive path",t,a.id,a),Ys(h,e.node(t),i))})),e.edges().forEach((function(t){const n=e.edge(t.v,t.w,t.name);Bt.info("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),Bt.info("Edge "+t.v+" -> "+t.w+": ",t," ",JSON.stringify(e.edge(t))),Bt.info("Fix",vs,"ids:",t.v,t.w,"Translateing: ",vs[t.v],vs[t.w]),Vs(l,n)})),e.edges().forEach((function(t){Bt.info("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t))})),Bt.info("#############################################"),Bt.info("### Layout ###"),Bt.info("#############################################"),Bt.info(e),(0,ct.bK)(e),Bt.info("Graph after layout:",ht.c(e));let u=0;return(t=>Bs(t,t.children()))(e).forEach((function(t){const n=e.node(t);Bt.info("Position "+t+": "+JSON.stringify(e.node(t))),Bt.info("Position "+t+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n&&n.clusterNode?zs(n):e.children(t).length>0?(((t,e)=>{Bt.trace("Inserting cluster");const n=e.shape||"rect";Ws[e.id]=Us[n](t,e)})(s,n),vs[n.id].node=n):zs(n)})),e.edges().forEach((function(t){const r=e.edge(t);Bt.info("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r),r);const i=function(t,e,n,r,i,a){let s=n.points,c=!1;const l=a.node(e.v);var h=a.node(e.w);Bt.info("abc88 InsertEdge: ",n),h.intersect&&l.intersect&&(s=s.slice(1,n.points.length-1),s.unshift(l.intersect(s[0])),Bt.info("Last point",s[s.length-1],h,h.intersect(s[s.length-1])),s.push(h.intersect(s[s.length-1]))),n.toCluster&&(Bt.info("to cluster abc88",r[n.toCluster]),s=Xs(n.points,r[n.toCluster].node),c=!0),n.fromCluster&&(Bt.info("from cluster abc88",r[n.fromCluster]),s=Xs(s.reverse(),r[n.fromCluster].node).reverse(),c=!0);const u=s.filter((t=>!Number.isNaN(t.y)));let d;d=("graph"===i||"flowchart"===i)&&n.curve||o.$0Z;const p=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(d);let f;switch(n.thickness){case"normal":f="edge-thickness-normal";break;case"thick":f="edge-thickness-thick";break;default:f=""}switch(n.pattern){case"solid":f+=" edge-pattern-solid";break;case"dotted":f+=" edge-pattern-dotted";break;case"dashed":f+=" edge-pattern-dashed"}const g=t.append("path").attr("d",p(u)).attr("id",n.id).attr("class"," "+f+(n.classes?" "+n.classes:"")).attr("style",n.style);let y="";switch((ur().flowchart.arrowMarkerAbsolute||ur().state.arrowMarkerAbsolute)&&(y=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,y=y.replace(/\(/g,"\\("),y=y.replace(/\)/g,"\\)")),Bt.info("arrowTypeStart",n.arrowTypeStart),Bt.info("arrowTypeEnd",n.arrowTypeEnd),n.arrowTypeStart){case"arrow_cross":g.attr("marker-start","url("+y+"#"+i+"-crossStart)");break;case"arrow_point":g.attr("marker-start","url("+y+"#"+i+"-pointStart)");break;case"arrow_barb":g.attr("marker-start","url("+y+"#"+i+"-barbStart)");break;case"arrow_circle":g.attr("marker-start","url("+y+"#"+i+"-circleStart)");break;case"aggregation":g.attr("marker-start","url("+y+"#"+i+"-aggregationStart)");break;case"extension":g.attr("marker-start","url("+y+"#"+i+"-extensionStart)");break;case"composition":g.attr("marker-start","url("+y+"#"+i+"-compositionStart)");break;case"dependency":g.attr("marker-start","url("+y+"#"+i+"-dependencyStart)");break;case"lollipop":g.attr("marker-start","url("+y+"#"+i+"-lollipopStart)")}switch(n.arrowTypeEnd){case"arrow_cross":g.attr("marker-end","url("+y+"#"+i+"-crossEnd)");break;case"arrow_point":g.attr("marker-end","url("+y+"#"+i+"-pointEnd)");break;case"arrow_barb":g.attr("marker-end","url("+y+"#"+i+"-barbEnd)");break;case"arrow_circle":g.attr("marker-end","url("+y+"#"+i+"-circleEnd)");break;case"aggregation":g.attr("marker-end","url("+y+"#"+i+"-aggregationEnd)");break;case"extension":g.attr("marker-end","url("+y+"#"+i+"-extensionEnd)");break;case"composition":g.attr("marker-end","url("+y+"#"+i+"-compositionEnd)");break;case"dependency":g.attr("marker-end","url("+y+"#"+i+"-dependencyEnd)");break;case"lollipop":g.attr("marker-end","url("+y+"#"+i+"-lollipopEnd)")}let m={};return c&&(m.updatedPath=s),m.originalPath=n.points,m}(c,t,r,vs,n,e);((t,e)=>{Bt.info("Moving label abc78 ",t.id,t.label,Hs[t.id]);let n=e.updatedPath?e.updatedPath:e.originalPath;if(t.label){const r=Hs[t.id];let i=t.x,a=t.y;if(n){const r=er.calcLabelPosition(n);Bt.info("Moving label "+t.label+" from (",i,",",a,") to (",r.x,",",r.y,") abc78"),e.updatedPath&&(i=r.x,a=r.y)}r.attr("transform","translate("+i+", "+a+")")}if(t.startLabelLeft){const e=qs[t.id].startLeft;let r=t.x,i=t.y;if(n){const e=er.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}if(t.startLabelRight){const e=qs[t.id].startRight;let r=t.x,i=t.y;if(n){const e=er.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}if(t.endLabelLeft){const e=qs[t.id].endLeft;let r=t.x,i=t.y;if(n){const e=er.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}if(t.endLabelRight){const e=qs[t.id].endRight;let r=t.x,i=t.y;if(n){const e=er.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);r=e.x,i=e.y}e.attr("transform","translate("+r+", "+i+")")}})(r,i)})),e.nodes().forEach((function(t){const n=e.node(t);Bt.info(t,n.type,n.diff),"group"===n.type&&(u=n.diff)})),{elem:a,diff:u}},Ks=(t,e,n,r,i)=>{ys(t,n,r,i),js={},Hs={},qs={},Ws={},ks={},ws={},vs={},Bt.warn("Graph at first:",ht.c(e)),((t,e)=>{!t||e>10?Bt.debug("Opting out, no graph "):(Bt.debug("Opting in, graph "),t.nodes().forEach((function(e){t.children(e).length>0&&(Bt.warn("Cluster identified",e," Replacement id in edges: ",Ss(e,t)),ks[e]=Ts(e,t),vs[e]={id:Ss(e,t),clusterData:t.node(e)})})),t.nodes().forEach((function(e){const n=t.children(e),r=t.edges();n.length>0?(Bt.debug("Cluster identified",e,ks),r.forEach((t=>{t.v!==e&&t.w!==e&&Cs(t.v,e)^Cs(t.w,e)&&(Bt.warn("Edge: ",t," leaves cluster ",e),Bt.warn("Decendants of XXX ",e,": ",ks[e]),vs[e].externalConnections=!0)}))):Bt.debug("Not a cluster ",e,ks)})),t.edges().forEach((function(e){const n=t.edge(e);Bt.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),Bt.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(t.edge(e)));let r=e.v,i=e.w;if(Bt.warn("Fix XXX",vs,"ids:",e.v,e.w,"Translating: ",vs[e.v]," --- ",vs[e.w]),vs[e.v]&&vs[e.w]&&vs[e.v]===vs[e.w]){Bt.warn("Fixing and trixing link to self - removing XXX",e.v,e.w,e.name),Bt.warn("Fixing and trixing - removing XXX",e.v,e.w,e.name),r=As(e.v),i=As(e.w),t.removeEdge(e.v,e.w,e.name);const a=e.w+"---"+e.v;t.setNode(a,{domId:a,id:a,labelStyle:"",labelText:n.label,padding:0,shape:"labelRect",style:""});const s=JSON.parse(JSON.stringify(n)),o=JSON.parse(JSON.stringify(n));s.label="",s.arrowTypeEnd="none",o.label="",s.fromCluster=e.v,o.toCluster=e.v,t.setEdge(r,a,s,e.name+"-cyclic-special"),t.setEdge(a,i,o,e.name+"-cyclic-special")}else(vs[e.v]||vs[e.w])&&(Bt.warn("Fixing and trixing - removing XXX",e.v,e.w,e.name),r=As(e.v),i=As(e.w),t.removeEdge(e.v,e.w,e.name),r!==e.v&&(n.fromCluster=e.v),i!==e.w&&(n.toCluster=e.w),Bt.warn("Fix Replacing with XXX",r,i,e.name),t.setEdge(r,i,n,e.name))})),Bt.warn("Adjusted Graph",ht.c(t)),Ls(t,0),Bt.trace(vs))})(e),Bt.warn("Graph after:",ht.c(e)),Qs(t,e,r)},Js=t=>jt.sanitizeText(t,ur());let to={dividerMargin:10,padding:5,textHeight:10};function eo(t){let e;switch(t){case 0:e="aggregation";break;case 1:e="extension";break;case 2:e="composition";break;case 3:e="dependency";break;case 4:e="lollipop";break;default:e="none"}return e}const no={setConf:function(t){Object.keys(t).forEach((function(e){to[e]=t[e]}))},draw:function(t,e,n,r){Bt.info("Drawing class - ",e);const i=ur().flowchart,a=ur().securityLevel;Bt.info("config:",i);const s=i.nodeSpacing||50,c=i.rankSpacing||50,l=new lt.k({multigraph:!0,compound:!0}).setGraph({rankdir:r.db.getDirection(),nodesep:s,ranksep:c,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}})),h=r.db.getClasses(),u=r.db.getRelations(),d=r.db.getNotes();let p;Bt.info(u),function(t,e,n,r){const i=Object.keys(t);Bt.info("keys:",i),Bt.info(t),i.forEach((function(n){const i=t[n];let a="";i.cssClasses.length>0&&(a=a+" "+i.cssClasses.join(" "));const s={labelStyle:""};let o=void 0!==i.text?i.text:i.id,c="";i.type,c="class_box",e.setNode(i.id,{labelStyle:s.labelStyle,shape:c,labelText:Js(o),classData:i,rx:0,ry:0,class:a,style:s.style,id:i.id,domId:i.domId,tooltip:r.db.getTooltip(i.id)||"",haveCallback:i.haveCallback,link:i.link,width:"group"===i.type?500:void 0,type:i.type,padding:ur().flowchart.padding}),Bt.info("setNode",{labelStyle:s.labelStyle,shape:c,labelText:o,rx:0,ry:0,class:a,style:s.style,id:i.id,width:"group"===i.type?500:void 0,type:i.type,padding:ur().flowchart.padding})}))}(h,l,0,r),function(t,e){const n=ur().flowchart;let r=0;t.forEach((function(i){r++;const a={classes:"relation"};a.pattern=1==i.relation.lineType?"dashed":"solid",a.id="id"+r,"arrow_open"===i.type?a.arrowhead="none":a.arrowhead="normal",Bt.info(a,i),a.startLabelRight="none"===i.relationTitle1?"":i.relationTitle1,a.endLabelLeft="none"===i.relationTitle2?"":i.relationTitle2,a.arrowTypeStart=eo(i.relation.type1),a.arrowTypeEnd=eo(i.relation.type2);let s="",c="";if(void 0!==i.style){const t=Pn(i.style);s=t.style,c=t.labelStyle}else s="fill:none";a.style=s,a.labelStyle=c,void 0!==i.interpolate?a.curve=Rn(i.interpolate,o.c_6):void 0!==t.defaultInterpolate?a.curve=Rn(t.defaultInterpolate,o.c_6):a.curve=Rn(n.curve,o.c_6),i.text=i.title,void 0===i.text?void 0!==i.style&&(a.arrowheadStyle="fill: #333"):(a.arrowheadStyle="fill: #333",a.labelpos="c",ur().flowchart.htmlLabels?(a.labelType="html",a.label='<span class="edgeLabel">'+i.text+"</span>"):(a.labelType="text",a.label=i.text.replace(jt.lineBreakRegex,"\n"),void 0===i.style&&(a.style=a.style||"stroke: #333; stroke-width: 1.5px;fill:none"),a.labelStyle=a.labelStyle.replace("color:","fill:"))),e.setEdge(i.id1,i.id2,a,r)}))}(u,l),function(t,e,n,r){Bt.info(t),t.forEach((function(t,i){const a=t,s="",c="";let l=a.text,h="note";if(e.setNode(a.id,{labelStyle:s,shape:h,labelText:Js(l),noteData:a,rx:0,ry:0,class:"",style:c,id:a.id,domId:a.id,tooltip:"",type:"note",padding:ur().flowchart.padding}),Bt.info("setNode",{labelStyle:s,shape:h,labelText:l,rx:0,ry:0,style:c,id:a.id,type:"note",padding:ur().flowchart.padding}),!a.class||!(a.class in r))return;const u=n+i,d={classes:"relation",pattern:"dotted"};d.id=`edgeNote${u}`,d.arrowhead="none",Bt.info(`Note edge: ${JSON.stringify(d)}, ${JSON.stringify(a)}`),d.startLabelRight="",d.endLabelLeft="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.style="fill:none",d.labelStyle="",d.curve=Rn(to.curve,o.c_6),e.setEdge(a.id,a.class,d,u)}))}(d,l,u.length+1,h),"sandbox"===a&&(p=(0,o.Ys)("#i"+e));const f="sandbox"===a?(0,o.Ys)(p.nodes()[0].contentDocument.body):(0,o.Ys)("body"),g=f.select(`[id="${e}"]`),y=f.select("#"+e+" g");if(Ks(y,l,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",e),er.insertTitle(g,"classTitleText",i.titleTopMargin,r.db.getDiagramTitle()),_r(l,g,i.diagramPadding,i.useMaxWidth),!i.htmlLabels){const t="sandbox"===a?p.nodes()[0].contentDocument:document,n=t.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(const e of n){const n=e.getBBox(),r=t.createElementNS("http://www.w3.org/2000/svg","rect");r.setAttribute("rx",0),r.setAttribute("ry",0),r.setAttribute("width",n.width),r.setAttribute("height",n.height),e.insertBefore(r,e.firstChild)}}}};var ro=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,5],i=[6,9,11,23,25,27,29,30,31,51],a=[1,17],s=[1,18],o=[1,19],c=[1,20],l=[1,21],h=[1,22],u=[1,25],d=[1,30],p=[1,31],f=[1,32],g=[1,33],y=[6,9,11,15,20,23,25,27,29,30,31,44,45,46,47,51],m=[1,45],b=[30,31,48,49],_=[4,6,9,11,23,25,27,29,30,31,51],x=[44,45,46,47],v=[22,37],k=[1,65],w=[1,64],C=[22,37,39,41],E={trace:function(){},yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,entityName:17,relSpec:18,role:19,BLOCK_START:20,attributes:21,BLOCK_STOP:22,title:23,title_value:24,acc_title:25,acc_title_value:26,acc_descr:27,acc_descr_value:28,acc_descr_multiline_value:29,ALPHANUM:30,ENTITY_NAME:31,attribute:32,attributeType:33,attributeName:34,attributeKeyTypeList:35,attributeComment:36,ATTRIBUTE_WORD:37,attributeKeyType:38,COMMA:39,ATTRIBUTE_KEY:40,COMMENT:41,cardinality:42,relType:43,ZERO_OR_ONE:44,ZERO_OR_MORE:45,ONE_OR_MORE:46,ONLY_ONE:47,NON_IDENTIFYING:48,IDENTIFYING:49,WORD:50,open_directive:51,type_directive:52,arg_directive:53,close_directive:54,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"title",24:"title_value",25:"acc_title",26:"acc_title_value",27:"acc_descr",28:"acc_descr_value",29:"acc_descr_multiline_value",30:"ALPHANUM",31:"ENTITY_NAME",37:"ATTRIBUTE_WORD",39:"COMMA",40:"ATTRIBUTE_KEY",41:"COMMENT",44:"ZERO_OR_ONE",45:"ZERO_OR_MORE",46:"ONE_OR_MORE",47:"ONLY_ONE",48:"NON_IDENTIFYING",49:"IDENTIFYING",50:"WORD",51:"open_directive",52:"type_directive",53:"arg_directive",54:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,1],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[35,3],[38,1],[36,1],[18,3],[42,1],[42,1],[42,1],[42,1],[43,1],[43,1],[19,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 1:break;case 3:case 7:case 8:this.$=[];break;case 4:a[o-1].push(a[o]),this.$=a[o-1];break;case 5:case 6:case 20:case 43:case 28:case 29:case 32:this.$=a[o];break;case 12:r.addEntity(a[o-4]),r.addEntity(a[o-2]),r.addRelationship(a[o-4],a[o],a[o-2],a[o-3]);break;case 13:r.addEntity(a[o-3]),r.addAttributes(a[o-3],a[o-1]);break;case 14:r.addEntity(a[o-2]);break;case 15:r.addEntity(a[o]);break;case 16:case 17:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 21:case 41:case 42:case 33:this.$=a[o].replace(/"/g,"");break;case 22:case 30:this.$=[a[o]];break;case 23:a[o].push(a[o-1]),this.$=a[o];break;case 24:this.$={attributeType:a[o-1],attributeName:a[o]};break;case 25:this.$={attributeType:a[o-2],attributeName:a[o-1],attributeKeyTypeList:a[o]};break;case 26:this.$={attributeType:a[o-2],attributeName:a[o-1],attributeComment:a[o]};break;case 27:this.$={attributeType:a[o-3],attributeName:a[o-2],attributeKeyTypeList:a[o-1],attributeComment:a[o]};break;case 31:a[o-2].push(a[o]),this.$=a[o-2];break;case 34:this.$={cardA:a[o],relType:a[o-1],cardB:a[o-2]};break;case 35:this.$=r.Cardinality.ZERO_OR_ONE;break;case 36:this.$=r.Cardinality.ZERO_OR_MORE;break;case 37:this.$=r.Cardinality.ONE_OR_MORE;break;case 38:this.$=r.Cardinality.ONLY_ONE;break;case 39:this.$=r.Identification.NON_IDENTIFYING;break;case 40:this.$=r.Identification.IDENTIFYING;break;case 44:r.parseDirective("%%{","open_directive");break;case 45:r.parseDirective(a[o],"type_directive");break;case 46:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 47:r.parseDirective("}%%","close_directive","er")}},table:[{3:1,4:n,7:3,12:4,51:r},{1:[3]},e(i,[2,3],{5:6}),{3:7,4:n,7:3,12:4,51:r},{13:8,52:[1,9]},{52:[2,44]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:a,25:s,27:o,29:c,30:l,31:h,51:r},{1:[2,2]},{14:23,15:[1,24],54:u},e([15,54],[2,45]),e(i,[2,8],{1:[2,1]}),e(i,[2,4]),{7:15,10:26,12:4,17:16,23:a,25:s,27:o,29:c,30:l,31:h,51:r},e(i,[2,6]),e(i,[2,7]),e(i,[2,11]),e(i,[2,15],{18:27,42:29,20:[1,28],44:d,45:p,46:f,47:g}),{24:[1,34]},{26:[1,35]},{28:[1,36]},e(i,[2,19]),e(y,[2,20]),e(y,[2,21]),{11:[1,37]},{16:38,53:[1,39]},{11:[2,47]},e(i,[2,5]),{17:40,30:l,31:h},{21:41,22:[1,42],32:43,33:44,37:m},{43:46,48:[1,47],49:[1,48]},e(b,[2,35]),e(b,[2,36]),e(b,[2,37]),e(b,[2,38]),e(i,[2,16]),e(i,[2,17]),e(i,[2,18]),e(_,[2,9]),{14:49,54:u},{54:[2,46]},{15:[1,50]},{22:[1,51]},e(i,[2,14]),{21:52,22:[2,22],32:43,33:44,37:m},{34:53,37:[1,54]},{37:[2,28]},{42:55,44:d,45:p,46:f,47:g},e(x,[2,39]),e(x,[2,40]),{11:[1,56]},{19:57,30:[1,60],31:[1,59],50:[1,58]},e(i,[2,13]),{22:[2,23]},e(v,[2,24],{35:61,36:62,38:63,40:k,41:w}),e([22,37,40,41],[2,29]),e([30,31],[2,34]),e(_,[2,10]),e(i,[2,12]),e(i,[2,41]),e(i,[2,42]),e(i,[2,43]),e(v,[2,25],{36:66,39:[1,67],41:w}),e(v,[2,26]),e(C,[2,30]),e(v,[2,33]),e(C,[2,32]),e(v,[2,27]),{38:68,40:k},e(C,[2,31])],defaultActions:{5:[2,44],7:[2,2],25:[2,47],39:[2,46],45:[2,28],52:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},T=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("acc_title"),25;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),27;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.begin("open_directive"),51;case 8:return this.begin("type_directive"),52;case 9:return this.popState(),this.begin("arg_directive"),15;case 10:return this.popState(),this.popState(),54;case 11:return 53;case 12:case 13:case 15:case 22:case 27:break;case 14:return 11;case 16:return 9;case 17:return 31;case 18:return 50;case 19:return 4;case 20:return this.begin("block"),20;case 21:return 39;case 23:return 40;case 24:case 25:return 37;case 26:return 41;case 28:return this.popState(),22;case 29:case 58:return e.yytext[0];case 30:case 34:case 35:case 48:return 44;case 31:case 32:case 33:case 41:case 43:case 50:return 46;case 36:case 37:case 38:case 39:case 40:case 42:case 49:return 45;case 44:case 45:case 46:case 47:return 47;case 51:case 54:case 55:case 56:return 48;case 52:case 53:return 49;case 57:return 30;case 59:return 6}},rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:,)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:1\b)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},open_directive:{rules:[8],inclusive:!1},type_directive:{rules:[9,10],inclusive:!1},arg_directive:{rules:[10,11],inclusive:!1},block:{rules:[21,22,23,24,25,26,27,28,29],inclusive:!1},INITIAL:{rules:[0,2,4,7,12,13,14,15,16,17,18,19,20,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],inclusive:!0}}},t);function S(){this.yy={}}return E.lexer=T,S.prototype=E,E.Parser=S,new S}();ro.parser=ro;const io=ro,ao=t=>null!==t.match(/^\s*erDiagram/);let so={},oo=[];const co=function(t){return void 0===so[t]&&(so[t]={attributes:[]},Bt.info("Added new entity :",t)),so[t]},lo={Cardinality:{ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE"},Identification:{NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().er,addEntity:co,addAttributes:function(t,e){let n,r=co(t);for(n=e.length-1;n>=0;n--)r.attributes.push(e[n]),Bt.debug("Added attribute ",e[n].attributeName)},getEntities:()=>so,addRelationship:function(t,e,n,r){let i={entityA:t,roleA:e,entityB:n,relSpec:r};oo.push(i),Bt.debug("Added new relationship :",i)},getRelationships:()=>oo,clear:function(){so={},oo=[],Rr()},setAccTitle:Zr,getAccTitle:Pr,setAccDescription:jr,getAccDescription:Yr,setDiagramTitle:zr,getDiagramTitle:Ur},ho={ONLY_ONE_START:"ONLY_ONE_START",ONLY_ONE_END:"ONLY_ONE_END",ZERO_OR_ONE_START:"ZERO_OR_ONE_START",ZERO_OR_ONE_END:"ZERO_OR_ONE_END",ONE_OR_MORE_START:"ONE_OR_MORE_START",ONE_OR_MORE_END:"ONE_OR_MORE_END",ZERO_OR_MORE_START:"ZERO_OR_MORE_START",ZERO_OR_MORE_END:"ZERO_OR_MORE_END"},uo=ho,po=function(t,e){let n;t.append("defs").append("marker").attr("id",ho.ONLY_ONE_START).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",ho.ONLY_ONE_END).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M3,0 L3,18 M9,0 L9,18"),n=t.append("defs").append("marker").attr("id",ho.ZERO_OR_ONE_START).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M9,0 L9,18"),n=t.append("defs").append("marker").attr("id",ho.ZERO_OR_ONE_END).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M21,0 L21,18"),t.append("defs").append("marker").attr("id",ho.ONE_OR_MORE_START).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",ho.ONE_OR_MORE_END).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"),n=t.append("defs").append("marker").attr("id",ho.ZERO_OR_MORE_START).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18"),n=t.append("defs").append("marker").attr("id",ho.ZERO_OR_MORE_END).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto"),n.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),n.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},fo=/[^\dA-Za-z](\W)*/g;let go={},yo=new Map;const mo=function(t,e,n){let r;return Object.keys(e).forEach((function(i){const a=function(t="",e=""){const n=t.replace(fo,"");return`${vo(e)}${vo(n)}${xt(t,xo)}`}(i,"entity");yo.set(i,a);const s=t.append("g").attr("id",a);r=void 0===r?a:r;const o="text-"+a,c=s.append("text").classed("er entityLabel",!0).attr("id",o).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","middle").style("font-family",ur().fontFamily).style("font-size",go.fontSize+"px").text(i),{width:l,height:h}=((t,e,n)=>{const r=go.entityPadding/3,i=go.entityPadding/3,a=.85*go.fontSize,s=e.node().getBBox(),o=[];let c=!1,l=!1,h=0,u=0,d=0,p=0,f=s.height+2*r,g=1;n.forEach((t=>{void 0!==t.attributeKeyTypeList&&t.attributeKeyTypeList.length>0&&(c=!0),void 0!==t.attributeComment&&(l=!0)})),n.forEach((n=>{const i=`${e.node().id}-attr-${g}`;let s=0;const y=Pt(n.attributeType),m=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-type`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ur().fontFamily).style("font-size",a+"px").text(y),b=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-name`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ur().fontFamily).style("font-size",a+"px").text(n.attributeName),_={};_.tn=m,_.nn=b;const x=m.node().getBBox(),v=b.node().getBBox();if(h=Math.max(h,x.width),u=Math.max(u,v.width),s=Math.max(x.height,v.height),c){const e=void 0!==n.attributeKeyTypeList?n.attributeKeyTypeList.join(","):"",r=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-key`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ur().fontFamily).style("font-size",a+"px").text(e);_.kn=r;const o=r.node().getBBox();d=Math.max(d,o.width),s=Math.max(s,o.height)}if(l){const e=t.append("text").classed("er entityLabel",!0).attr("id",`${i}-comment`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",ur().fontFamily).style("font-size",a+"px").text(n.attributeComment||"");_.cn=e;const r=e.node().getBBox();p=Math.max(p,r.width),s=Math.max(s,r.height)}_.height=s,o.push(_),f+=s+2*r,g+=1}));let y=4;c&&(y+=2),l&&(y+=2);const m=h+u+d+p,b={width:Math.max(go.minEntityWidth,Math.max(s.width+2*go.entityPadding,m+i*y)),height:n.length>0?f:Math.max(go.minEntityHeight,s.height+2*go.entityPadding)};if(n.length>0){const n=Math.max(0,(b.width-m-i*y)/(y/2));e.attr("transform","translate("+b.width/2+","+(r+s.height/2)+")");let a=s.height+2*r,f="attributeBoxOdd";o.forEach((e=>{const s=a+r+e.height/2;e.tn.attr("transform","translate("+i+","+s+")");const o=t.insert("rect","#"+e.tn.node().id).classed(`er ${f}`,!0).attr("x",0).attr("y",a).attr("width",h+2*i+n).attr("height",e.height+2*r),g=parseFloat(o.attr("x"))+parseFloat(o.attr("width"));e.nn.attr("transform","translate("+(g+i)+","+s+")");const y=t.insert("rect","#"+e.nn.node().id).classed(`er ${f}`,!0).attr("x",g).attr("y",a).attr("width",u+2*i+n).attr("height",e.height+2*r);let m=parseFloat(y.attr("x"))+parseFloat(y.attr("width"));if(c){e.kn.attr("transform","translate("+(m+i)+","+s+")");const o=t.insert("rect","#"+e.kn.node().id).classed(`er ${f}`,!0).attr("x",m).attr("y",a).attr("width",d+2*i+n).attr("height",e.height+2*r);m=parseFloat(o.attr("x"))+parseFloat(o.attr("width"))}l&&(e.cn.attr("transform","translate("+(m+i)+","+s+")"),t.insert("rect","#"+e.cn.node().id).classed(`er ${f}`,"true").attr("x",m).attr("y",a).attr("width",p+2*i+n).attr("height",e.height+2*r)),a+=e.height+2*r,f="attributeBoxOdd"===f?"attributeBoxEven":"attributeBoxOdd"}))}else b.height=Math.max(go.minEntityHeight,f),e.attr("transform","translate("+b.width/2+","+b.height/2+")");return b})(s,c,e[i].attributes),u=s.insert("rect","#"+o).classed("er entityBox",!0).attr("x",0).attr("y",0).attr("width",l).attr("height",h).node().getBBox();n.setNode(a,{width:u.width,height:u.height,shape:"rect",id:a})})),r},bo=function(t){return(t.entityA+t.roleA+t.entityB).replace(/\s/g,"")};let _o=0;const xo="28e9f9db-3c8d-5aa5-9faf-44286ae5937c";function vo(t=""){return t.length>0?`${t}-`:""}const ko={setConf:function(t){const e=Object.keys(t);for(const n of e)go[n]=t[n]},draw:function(t,e,n,r){go=ur().er,Bt.info("Drawing ER diagram");const i=ur().securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s=("sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body")).select(`[id='${e}']`);let c;po(s,go),c=new lt.k({multigraph:!0,directed:!0,compound:!1}).setGraph({rankdir:go.layoutDirection,marginx:20,marginy:20,nodesep:100,edgesep:100,ranksep:100}).setDefaultEdgeLabel((function(){return{}}));const l=mo(s,r.db.getEntities(),c),h=function(t,e){return t.forEach((function(t){e.setEdge(yo.get(t.entityA),yo.get(t.entityB),{relationship:t},bo(t))})),t}(r.db.getRelationships(),c);var u,d;(0,ct.bK)(c),u=s,(d=c).nodes().forEach((function(t){void 0!==t&&void 0!==d.node(t)&&u.select("#"+t).attr("transform","translate("+(d.node(t).x-d.node(t).width/2)+","+(d.node(t).y-d.node(t).height/2)+" )")})),h.forEach((function(t){!function(t,e,n,r,i){_o++;const a=n.edge(yo.get(e.entityA),yo.get(e.entityB),bo(e)),s=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(o.$0Z),c=t.insert("path","#"+r).classed("er relationshipLine",!0).attr("d",s(a.points)).style("stroke",go.stroke).style("fill","none");e.relSpec.relType===i.db.Identification.NON_IDENTIFYING&&c.attr("stroke-dasharray","8,8");let l="";switch(go.arrowMarkerAbsolute&&(l=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,l=l.replace(/\(/g,"\\("),l=l.replace(/\)/g,"\\)")),e.relSpec.cardA){case i.db.Cardinality.ZERO_OR_ONE:c.attr("marker-end","url("+l+"#"+uo.ZERO_OR_ONE_END+")");break;case i.db.Cardinality.ZERO_OR_MORE:c.attr("marker-end","url("+l+"#"+uo.ZERO_OR_MORE_END+")");break;case i.db.Cardinality.ONE_OR_MORE:c.attr("marker-end","url("+l+"#"+uo.ONE_OR_MORE_END+")");break;case i.db.Cardinality.ONLY_ONE:c.attr("marker-end","url("+l+"#"+uo.ONLY_ONE_END+")")}switch(e.relSpec.cardB){case i.db.Cardinality.ZERO_OR_ONE:c.attr("marker-start","url("+l+"#"+uo.ZERO_OR_ONE_START+")");break;case i.db.Cardinality.ZERO_OR_MORE:c.attr("marker-start","url("+l+"#"+uo.ZERO_OR_MORE_START+")");break;case i.db.Cardinality.ONE_OR_MORE:c.attr("marker-start","url("+l+"#"+uo.ONE_OR_MORE_START+")");break;case i.db.Cardinality.ONLY_ONE:c.attr("marker-start","url("+l+"#"+uo.ONLY_ONE_START+")")}const h=c.node().getTotalLength(),u=c.node().getPointAtLength(.5*h),d="rel"+_o,p=t.append("text").classed("er relationshipLabel",!0).attr("id",d).attr("x",u.x).attr("y",u.y).style("text-anchor","middle").style("dominant-baseline","middle").style("font-family",ur().fontFamily).style("font-size",go.fontSize+"px").text(e.roleA).node().getBBox();t.insert("rect","#"+d).classed("er relationshipLabelBox",!0).attr("x",u.x-p.width/2).attr("y",u.y-p.height/2).attr("width",p.width).attr("height",p.height)}(s,t,c,l,r)}));const p=go.diagramPadding;er.insertTitle(s,"entityTitleText",go.titleTopMargin,r.db.getDiagramTitle());const f=s.node().getBBox(),g=f.width+2*p,y=f.height+2*p;br(s,y,g,go.useMaxWidth),s.attr("viewBox",`${f.x-p} ${f.y-p} ${g} ${y}`)}};var wo=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,9],r=[1,7],i=[1,6],a=[1,8],s=[1,20,21,22,23,38,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],o=[2,10],c=[1,20],l=[1,21],h=[1,22],u=[1,23],d=[1,30],p=[1,32],f=[1,33],g=[1,34],y=[1,62],m=[1,48],b=[1,52],_=[1,36],x=[1,37],v=[1,38],k=[1,39],w=[1,40],C=[1,56],E=[1,63],T=[1,51],S=[1,53],A=[1,55],L=[1,59],B=[1,60],N=[1,41],D=[1,42],O=[1,43],M=[1,44],I=[1,61],F=[1,50],$=[1,54],R=[1,57],Z=[1,58],P=[1,49],j=[1,66],Y=[1,71],z=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],U=[1,75],W=[1,74],H=[1,76],q=[20,21,23,81,82],V=[1,99],G=[1,104],X=[1,107],Q=[1,108],K=[1,101],J=[1,106],tt=[1,109],et=[1,102],nt=[1,114],rt=[1,113],it=[1,103],at=[1,105],st=[1,110],ot=[1,111],ct=[1,112],lt=[1,115],ht=[20,21,22,23,81,82],ut=[20,21,22,23,53,81,82],dt=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],pt=[20,21,23],ft=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],gt=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],yt=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],mt=[1,149],bt=[1,157],_t=[1,158],xt=[1,159],vt=[1,160],kt=[1,144],wt=[1,145],Ct=[1,141],Et=[1,152],Tt=[1,153],St=[1,154],At=[1,155],Lt=[1,156],Bt=[1,161],Nt=[1,162],Dt=[1,147],Ot=[1,150],Mt=[1,146],It=[1,143],Ft=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$t=[1,165],Rt=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],Zt=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],Pt=[12,21,22,24],jt=[22,106],Yt=[1,250],zt=[1,245],Ut=[1,246],Wt=[1,254],Ht=[1,251],qt=[1,248],Vt=[1,247],Gt=[1,249],Xt=[1,252],Qt=[1,253],Kt=[1,255],Jt=[1,273],te=[20,21,23,106],ee=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113],ne={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,directive:5,openDirective:6,typeDirective:7,closeDirective:8,separator:9,":":10,argDirective:11,open_directive:12,type_directive:13,arg_directive:14,close_directive:15,graphConfig:16,document:17,line:18,statement:19,SEMI:20,NEWLINE:21,SPACE:22,EOF:23,GRAPH:24,NODIR:25,DIR:26,FirstStmtSeperator:27,ending:28,endToken:29,spaceList:30,spaceListNewline:31,verticeStatement:32,styleStatement:33,linkStyleStatement:34,classDefStatement:35,classStatement:36,clickStatement:37,subgraph:38,text:39,SQS:40,SQE:41,end:42,direction:43,acc_title:44,acc_title_value:45,acc_descr:46,acc_descr_value:47,acc_descr_multiline_value:48,link:49,node:50,vertex:51,AMP:52,STYLE_SEPARATOR:53,idString:54,DOUBLECIRCLESTART:55,DOUBLECIRCLEEND:56,PS:57,PE:58,"(-":59,"-)":60,STADIUMSTART:61,STADIUMEND:62,SUBROUTINESTART:63,SUBROUTINEEND:64,VERTEX_WITH_PROPS_START:65,ALPHA:66,COLON:67,PIPE:68,CYLINDERSTART:69,CYLINDEREND:70,DIAMOND_START:71,DIAMOND_STOP:72,TAGEND:73,TRAPSTART:74,TRAPEND:75,INVTRAPSTART:76,INVTRAPEND:77,linkStatement:78,arrowText:79,TESTSTR:80,START_LINK:81,LINK:82,textToken:83,STR:84,keywords:85,STYLE:86,LINKSTYLE:87,CLASSDEF:88,CLASS:89,CLICK:90,DOWN:91,UP:92,textNoTags:93,textNoTagsToken:94,DEFAULT:95,stylesOpt:96,alphaNum:97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,HEX:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,MINUS:109,UNIT:110,BRKT:111,DOT:112,PCT:113,TAGSTART:114,alphaNumToken:115,idStringToken:116,alphaNumStatement:117,direction_tb:118,direction_bt:119,direction_rl:120,direction_lr:121,PUNCTUATION:122,UNICODE_TEXT:123,PLUS:124,EQUALS:125,MULT:126,UNDERSCORE:127,graphCodeTokens:128,ARROW_CROSS:129,ARROW_POINT:130,ARROW_CIRCLE:131,ARROW_OPEN:132,QUOTE:133,$accept:0,$end:1},terminals_:{2:"error",10:":",12:"open_directive",13:"type_directive",14:"arg_directive",15:"close_directive",20:"SEMI",21:"NEWLINE",22:"SPACE",23:"EOF",24:"GRAPH",25:"NODIR",26:"DIR",38:"subgraph",40:"SQS",41:"SQE",42:"end",44:"acc_title",45:"acc_title_value",46:"acc_descr",47:"acc_descr_value",48:"acc_descr_multiline_value",52:"AMP",53:"STYLE_SEPARATOR",55:"DOUBLECIRCLESTART",56:"DOUBLECIRCLEEND",57:"PS",58:"PE",59:"(-",60:"-)",61:"STADIUMSTART",62:"STADIUMEND",63:"SUBROUTINESTART",64:"SUBROUTINEEND",65:"VERTEX_WITH_PROPS_START",66:"ALPHA",67:"COLON",68:"PIPE",69:"CYLINDERSTART",70:"CYLINDEREND",71:"DIAMOND_START",72:"DIAMOND_STOP",73:"TAGEND",74:"TRAPSTART",75:"TRAPEND",76:"INVTRAPSTART",77:"INVTRAPEND",80:"TESTSTR",81:"START_LINK",82:"LINK",84:"STR",86:"STYLE",87:"LINKSTYLE",88:"CLASSDEF",89:"CLASS",90:"CLICK",91:"DOWN",92:"UP",95:"DEFAULT",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"HEX",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"MINUS",110:"UNIT",111:"BRKT",112:"DOT",113:"PCT",114:"TAGSTART",118:"direction_tb",119:"direction_bt",120:"direction_rl",121:"direction_lr",122:"PUNCTUATION",123:"UNICODE_TEXT",124:"PLUS",125:"EQUALS",126:"MULT",127:"UNDERSCORE",129:"ARROW_CROSS",130:"ARROW_POINT",131:"ARROW_CIRCLE",132:"ARROW_OPEN",133:"QUOTE"},productions_:[0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 5:r.parseDirective("%%{","open_directive");break;case 6:r.parseDirective(a[o],"type_directive");break;case 7:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 8:r.parseDirective("}%%","close_directive","flowchart");break;case 10:case 36:case 37:case 38:case 39:case 40:this.$=[];break;case 11:(!Array.isArray(a[o])||a[o].length>0)&&a[o-1].push(a[o]),this.$=a[o-1];break;case 12:case 82:case 84:case 96:case 152:case 154:case 155:case 78:case 150:this.$=a[o];break;case 19:r.setDirection("TB"),this.$="TB";break;case 20:r.setDirection(a[o-1]),this.$=a[o-1];break;case 35:this.$=a[o-1].nodes;break;case 41:this.$=r.addSubGraph(a[o-6],a[o-1],a[o-4]);break;case 42:this.$=r.addSubGraph(a[o-3],a[o-1],a[o-3]);break;case 43:this.$=r.addSubGraph(void 0,a[o-1],void 0);break;case 45:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 46:case 47:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 51:r.addLink(a[o-2].stmt,a[o],a[o-1]),this.$={stmt:a[o],nodes:a[o].concat(a[o-2].nodes)};break;case 52:r.addLink(a[o-3].stmt,a[o-1],a[o-2]),this.$={stmt:a[o-1],nodes:a[o-1].concat(a[o-3].nodes)};break;case 53:this.$={stmt:a[o-1],nodes:a[o-1]};break;case 54:this.$={stmt:a[o],nodes:a[o]};break;case 55:case 123:case 125:this.$=[a[o]];break;case 56:this.$=a[o-4].concat(a[o]);break;case 57:this.$=[a[o-2]],r.setClass(a[o-2],a[o]);break;case 58:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"square");break;case 59:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"doublecircle");break;case 60:this.$=a[o-5],r.addVertex(a[o-5],a[o-2],"circle");break;case 61:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"ellipse");break;case 62:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"stadium");break;case 63:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"subroutine");break;case 64:this.$=a[o-7],r.addVertex(a[o-7],a[o-1],"rect",void 0,void 0,void 0,Object.fromEntries([[a[o-5],a[o-3]]]));break;case 65:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"cylinder");break;case 66:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"round");break;case 67:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"diamond");break;case 68:this.$=a[o-5],r.addVertex(a[o-5],a[o-2],"hexagon");break;case 69:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"odd");break;case 70:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"trapezoid");break;case 71:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"inv_trapezoid");break;case 72:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"lean_right");break;case 73:this.$=a[o-3],r.addVertex(a[o-3],a[o-1],"lean_left");break;case 74:this.$=a[o],r.addVertex(a[o]);break;case 75:a[o-1].text=a[o],this.$=a[o-1];break;case 76:case 77:a[o-2].text=a[o-1],this.$=a[o-2];break;case 79:var c=r.destructLink(a[o],a[o-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,text:a[o-1]};break;case 80:c=r.destructLink(a[o]);this.$={type:c.type,stroke:c.stroke,length:c.length};break;case 81:this.$=a[o-1];break;case 83:case 97:case 153:case 151:this.$=a[o-1]+""+a[o];break;case 98:case 99:this.$=a[o-4],r.addClass(a[o-2],a[o]);break;case 100:this.$=a[o-4],r.setClass(a[o-2],a[o]);break;case 101:case 109:this.$=a[o-1],r.setClickEvent(a[o-1],a[o]);break;case 102:case 110:this.$=a[o-3],r.setClickEvent(a[o-3],a[o-2]),r.setTooltip(a[o-3],a[o]);break;case 103:this.$=a[o-2],r.setClickEvent(a[o-2],a[o-1],a[o]);break;case 104:this.$=a[o-4],r.setClickEvent(a[o-4],a[o-3],a[o-2]),r.setTooltip(a[o-4],a[o]);break;case 105:case 111:this.$=a[o-1],r.setLink(a[o-1],a[o]);break;case 106:case 112:this.$=a[o-3],r.setLink(a[o-3],a[o-2]),r.setTooltip(a[o-3],a[o]);break;case 107:case 113:this.$=a[o-3],r.setLink(a[o-3],a[o-2],a[o]);break;case 108:case 114:this.$=a[o-5],r.setLink(a[o-5],a[o-4],a[o]),r.setTooltip(a[o-5],a[o-2]);break;case 115:this.$=a[o-4],r.addVertex(a[o-2],void 0,void 0,a[o]);break;case 116:case 118:this.$=a[o-4],r.updateLink(a[o-2],a[o]);break;case 117:this.$=a[o-4],r.updateLink([a[o-2]],a[o]);break;case 119:this.$=a[o-8],r.updateLinkInterpolate([a[o-6]],a[o-2]),r.updateLink([a[o-6]],a[o]);break;case 120:this.$=a[o-8],r.updateLinkInterpolate(a[o-6],a[o-2]),r.updateLink(a[o-6],a[o]);break;case 121:this.$=a[o-6],r.updateLinkInterpolate([a[o-4]],a[o]);break;case 122:this.$=a[o-6],r.updateLinkInterpolate(a[o-4],a[o]);break;case 124:case 126:a[o-2].push(a[o]),this.$=a[o-2];break;case 128:this.$=a[o-1]+a[o];break;case 156:this.$="v";break;case 157:this.$="-";break;case 158:this.$={stmt:"dir",value:"TB"};break;case 159:this.$={stmt:"dir",value:"BT"};break;case 160:this.$={stmt:"dir",value:"RL"};break;case 161:this.$={stmt:"dir",value:"LR"}}},table:[{3:1,4:2,5:3,6:5,12:n,16:4,21:r,22:i,24:a},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:n,16:4,21:r,22:i,24:a},e(s,o,{17:11}),{7:12,13:[1,13]},{16:14,21:r,22:i,24:a},{16:15,21:r,22:i,24:a},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:c,21:l,22:h,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:d,43:31,44:p,46:f,48:g,50:35,51:45,52:y,54:46,66:m,67:b,86:_,87:x,88:v,89:k,90:w,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,118:N,119:D,120:O,121:M,122:I,123:F,124:$,125:R,126:Z,127:P},{8:64,10:[1,65],15:j},e([10,15],[2,6]),e(s,[2,17]),e(s,[2,18]),e(s,[2,19]),{20:[1,68],21:[1,69],22:Y,27:67,30:70},e(z,[2,11]),e(z,[2,12]),e(z,[2,13]),e(z,[2,14]),e(z,[2,15]),e(z,[2,16]),{9:72,20:U,21:W,23:H,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:U,21:W,23:H},{9:81,20:U,21:W,23:H},{9:82,20:U,21:W,23:H},{9:83,20:U,21:W,23:H},{9:84,20:U,21:W,23:H},{9:86,20:U,21:W,22:[1,85],23:H},e(z,[2,44]),{45:[1,87]},{47:[1,88]},e(z,[2,47]),e(q,[2,54],{30:89,22:Y}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:V,52:G,66:X,67:Q,84:[1,97],91:K,97:96,98:[1,94],100:[1,95],105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(z,[2,158]),e(z,[2,159]),e(z,[2,160]),e(z,[2,161]),e(ht,[2,55],{53:[1,116]}),e(ut,[2,74],{116:129,40:[1,117],52:y,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:m,67:b,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:C,95:E,105:T,106:S,109:A,111:L,112:B,122:I,123:F,124:$,125:R,126:Z,127:P}),e(dt,[2,150]),e(dt,[2,175]),e(dt,[2,176]),e(dt,[2,177]),e(dt,[2,178]),e(dt,[2,179]),e(dt,[2,180]),e(dt,[2,181]),e(dt,[2,182]),e(dt,[2,183]),e(dt,[2,184]),e(dt,[2,185]),e(dt,[2,186]),e(dt,[2,187]),e(dt,[2,188]),e(dt,[2,189]),e(dt,[2,190]),{9:130,20:U,21:W,23:H},{11:131,14:[1,132]},e(pt,[2,8]),e(s,[2,20]),e(s,[2,26]),e(s,[2,27]),{21:[1,133]},e(ft,[2,34],{30:134,22:Y}),e(z,[2,35]),{50:135,51:45,52:y,54:46,66:m,67:b,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,122:I,123:F,124:$,125:R,126:Z,127:P},e(gt,[2,48]),e(gt,[2,49]),e(gt,[2,50]),e(yt,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:mt,24:bt,26:_t,38:xt,39:139,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),e(z,[2,36]),e(z,[2,37]),e(z,[2,38]),e(z,[2,39]),e(z,[2,40]),{22:mt,24:bt,26:_t,38:xt,39:163,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(Ft,o,{17:164}),e(z,[2,45]),e(z,[2,46]),e(q,[2,53],{52:$t}),{26:V,52:G,66:X,67:Q,91:K,97:166,102:[1,167],105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},{95:[1,168],103:169,105:[1,170]},{26:V,52:G,66:X,67:Q,91:K,95:[1,171],97:172,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},{26:V,52:G,66:X,67:Q,91:K,97:173,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(pt,[2,101],{22:[1,174],99:[1,175]}),e(pt,[2,105],{22:[1,176]}),e(pt,[2,109],{115:100,117:178,22:[1,177],26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:ct,127:lt}),e(pt,[2,111],{22:[1,179]}),e(Rt,[2,152]),e(Rt,[2,154]),e(Rt,[2,155]),e(Rt,[2,156]),e(Rt,[2,157]),e(Zt,[2,162]),e(Zt,[2,163]),e(Zt,[2,164]),e(Zt,[2,165]),e(Zt,[2,166]),e(Zt,[2,167]),e(Zt,[2,168]),e(Zt,[2,169]),e(Zt,[2,170]),e(Zt,[2,171]),e(Zt,[2,172]),e(Zt,[2,173]),e(Zt,[2,174]),{52:y,54:180,66:m,67:b,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,122:I,123:F,124:$,125:R,126:Z,127:P},{22:mt,24:bt,26:_t,38:xt,39:181,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:182,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:184,42:vt,52:G,57:[1,183],66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:185,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:186,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:187,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{66:[1,188]},{22:mt,24:bt,26:_t,38:xt,39:189,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:190,42:vt,52:G,66:X,67:Q,71:[1,191],73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:192,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:193,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:194,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(dt,[2,151]),e(Pt,[2,3]),{8:195,15:j},{15:[2,7]},e(s,[2,28]),e(ft,[2,33]),e(q,[2,51],{30:196,22:Y}),e(yt,[2,75],{22:[1,197]}),{22:[1,198]},{22:mt,24:bt,26:_t,38:xt,39:199,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,73:kt,81:wt,82:[1,200],83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(Zt,[2,82]),e(Zt,[2,84]),e(Zt,[2,140]),e(Zt,[2,141]),e(Zt,[2,142]),e(Zt,[2,143]),e(Zt,[2,144]),e(Zt,[2,145]),e(Zt,[2,146]),e(Zt,[2,147]),e(Zt,[2,148]),e(Zt,[2,149]),e(Zt,[2,85]),e(Zt,[2,86]),e(Zt,[2,87]),e(Zt,[2,88]),e(Zt,[2,89]),e(Zt,[2,90]),e(Zt,[2,91]),e(Zt,[2,92]),e(Zt,[2,93]),e(Zt,[2,94]),e(Zt,[2,95]),{9:203,20:U,21:W,22:mt,23:H,24:bt,26:_t,38:xt,40:[1,202],42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{18:18,19:19,20:c,21:l,22:h,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:d,42:[1,204],43:31,44:p,46:f,48:g,50:35,51:45,52:y,54:46,66:m,67:b,86:_,87:x,88:v,89:k,90:w,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,118:N,119:D,120:O,121:M,122:I,123:F,124:$,125:R,126:Z,127:P},{22:Y,30:205},{22:[1,206],26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:178,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},e(jt,[2,123]),{22:[1,211]},{22:[1,212],26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:178,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:[1,213],26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:178,122:it,123:at,124:st,125:ot,126:ct,127:lt},{84:[1,214]},e(pt,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},e(Rt,[2,153]),{84:[1,219],101:[1,220]},e(ht,[2,57],{116:129,52:y,66:m,67:b,91:C,95:E,105:T,106:S,109:A,111:L,112:B,122:I,123:F,124:$,125:R,126:Z,127:P}),{22:mt,24:bt,26:_t,38:xt,41:[1,221],42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,56:[1,222],66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:223,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,58:[1,224],66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,60:[1,225],66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,62:[1,226],66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,64:[1,227],66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{67:[1,228]},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,70:[1,229],73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,72:[1,230],73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,39:231,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,41:[1,232],42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,73:kt,75:[1,233],77:[1,234],81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,73:kt,75:[1,236],77:[1,235],81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{9:237,20:U,21:W,23:H},e(q,[2,52],{52:$t}),e(yt,[2,77]),e(yt,[2,76]),{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,68:[1,238],73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(yt,[2,79]),e(Zt,[2,83]),{22:mt,24:bt,26:_t,38:xt,39:239,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(Ft,o,{17:240}),e(z,[2,43]),{51:241,52:y,54:46,66:m,67:b,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,122:I,123:F,124:$,125:R,126:Z,127:P},{22:Yt,66:zt,67:Ut,86:Wt,96:242,102:Ht,105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{22:Yt,66:zt,67:Ut,86:Wt,96:256,102:Ht,105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{22:Yt,66:zt,67:Ut,86:Wt,96:257,102:Ht,104:[1,258],105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{22:Yt,66:zt,67:Ut,86:Wt,96:259,102:Ht,104:[1,260],105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{105:[1,261]},{22:Yt,66:zt,67:Ut,86:Wt,96:262,102:Ht,105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{22:Yt,66:zt,67:Ut,86:Wt,96:263,102:Ht,105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{26:V,52:G,66:X,67:Q,91:K,97:264,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(pt,[2,102]),{84:[1,265]},e(pt,[2,106],{22:[1,266]}),e(pt,[2,107]),e(pt,[2,110]),e(pt,[2,112],{22:[1,267]}),e(pt,[2,113]),e(ut,[2,58]),e(ut,[2,59]),{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,58:[1,268],66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(ut,[2,66]),e(ut,[2,61]),e(ut,[2,62]),e(ut,[2,63]),{66:[1,269]},e(ut,[2,65]),e(ut,[2,67]),{22:mt,24:bt,26:_t,38:xt,42:vt,52:G,66:X,67:Q,72:[1,270],73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(ut,[2,69]),e(ut,[2,70]),e(ut,[2,72]),e(ut,[2,71]),e(ut,[2,73]),e(Pt,[2,4]),e([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:mt,24:bt,26:_t,38:xt,41:[1,271],42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{18:18,19:19,20:c,21:l,22:h,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:d,42:[1,272],43:31,44:p,46:f,48:g,50:35,51:45,52:y,54:46,66:m,67:b,86:_,87:x,88:v,89:k,90:w,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,118:N,119:D,120:O,121:M,122:I,123:F,124:$,125:R,126:Z,127:P},e(ht,[2,56]),e(pt,[2,115],{106:Jt}),e(te,[2,125],{108:274,22:Yt,66:zt,67:Ut,86:Wt,102:Ht,105:qt,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt}),e(ee,[2,127]),e(ee,[2,129]),e(ee,[2,130]),e(ee,[2,131]),e(ee,[2,132]),e(ee,[2,133]),e(ee,[2,134]),e(ee,[2,135]),e(ee,[2,136]),e(ee,[2,137]),e(ee,[2,138]),e(ee,[2,139]),e(pt,[2,116],{106:Jt}),e(pt,[2,117],{106:Jt}),{22:[1,275]},e(pt,[2,118],{106:Jt}),{22:[1,276]},e(jt,[2,124]),e(pt,[2,98],{106:Jt}),e(pt,[2,99],{106:Jt}),e(pt,[2,100],{115:100,117:178,26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:ct,127:lt}),e(pt,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:U,21:W,23:H},e(z,[2,42]),{22:Yt,66:zt,67:Ut,86:Wt,102:Ht,105:qt,107:283,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},e(ee,[2,128]),{26:V,52:G,66:X,67:Q,91:K,97:284,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},{26:V,52:G,66:X,67:Q,91:K,97:285,105:J,106:tt,109:et,111:nt,112:rt,115:100,117:98,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(pt,[2,108]),e(pt,[2,114]),e(ut,[2,60]),{22:mt,24:bt,26:_t,38:xt,39:286,42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:140,84:Ct,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},e(ut,[2,68]),e(Ft,o,{17:287}),e(te,[2,126],{108:274,22:Yt,66:zt,67:Ut,86:Wt,102:Ht,105:qt,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt}),e(pt,[2,121],{115:100,117:178,22:[1,288],26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:ct,127:lt}),e(pt,[2,122],{115:100,117:178,22:[1,289],26:V,52:G,66:X,67:Q,91:K,105:J,106:tt,109:et,111:nt,112:rt,122:it,123:at,124:st,125:ot,126:ct,127:lt}),{22:mt,24:bt,26:_t,38:xt,41:[1,290],42:vt,52:G,66:X,67:Q,73:kt,81:wt,83:201,85:151,86:Et,87:Tt,88:St,89:At,90:Lt,91:Bt,92:Nt,94:142,95:Dt,105:J,106:tt,109:Ot,111:nt,112:rt,113:Mt,114:It,115:148,122:it,123:at,124:st,125:ot,126:ct,127:lt},{18:18,19:19,20:c,21:l,22:h,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:d,42:[1,291],43:31,44:p,46:f,48:g,50:35,51:45,52:y,54:46,66:m,67:b,86:_,87:x,88:v,89:k,90:w,91:C,95:E,105:T,106:S,109:A,111:L,112:B,116:47,118:N,119:D,120:O,121:M,122:I,123:F,124:$,125:R,126:Z,127:P},{22:Yt,66:zt,67:Ut,86:Wt,96:292,102:Ht,105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},{22:Yt,66:zt,67:Ut,86:Wt,96:293,102:Ht,105:qt,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Qt,113:Kt},e(ut,[2,64]),e(z,[2,41]),e(pt,[2,119],{106:Jt}),e(pt,[2,120],{106:Jt})],defaultActions:{2:[2,1],9:[2,5],10:[2,2],132:[2,7]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},re=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),12;case 1:return this.begin("type_directive"),13;case 2:return this.popState(),this.begin("arg_directive"),10;case 3:return this.popState(),this.popState(),15;case 4:return 14;case 5:case 6:break;case 7:return this.begin("acc_title"),44;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),46;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:case 15:case 24:case 27:case 30:case 33:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:this.begin("string");break;case 16:return"STR";case 17:return 86;case 18:return 95;case 19:return 87;case 20:return 104;case 21:return 88;case 22:return 89;case 23:this.begin("href");break;case 25:return 100;case 26:this.begin("callbackname");break;case 28:this.popState(),this.begin("callbackargs");break;case 29:return 98;case 31:return 99;case 32:this.begin("click");break;case 34:return 90;case 35:case 36:case 37:return t.lex.firstGraph()&&this.begin("dir"),24;case 38:return 38;case 39:return 42;case 40:case 41:case 42:case 43:return 101;case 44:return this.popState(),25;case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:return this.popState(),26;case 55:return 118;case 56:return 119;case 57:return 120;case 58:return 121;case 59:return 105;case 60:return 111;case 61:return 53;case 62:return 67;case 63:return 52;case 64:return 20;case 65:return 106;case 66:return 126;case 67:case 68:case 69:return 82;case 70:case 71:case 72:return 81;case 73:return 59;case 74:return 60;case 75:return 61;case 76:return 62;case 77:return 63;case 78:return 64;case 79:return 65;case 80:return 69;case 81:return 70;case 82:return 55;case 83:return 56;case 84:return 109;case 85:return 112;case 86:return 127;case 87:return 124;case 88:return 113;case 89:case 90:return 125;case 91:return 114;case 92:return 73;case 93:return 92;case 94:return"SEP";case 95:return 91;case 96:return 66;case 97:return 75;case 98:return 74;case 99:return 77;case 100:return 76;case 101:return 122;case 102:return 123;case 103:return 68;case 104:return 57;case 105:return 58;case 106:return 40;case 107:return 41;case 108:return 71;case 109:return 72;case 110:return 133;case 111:return 21;case 112:return 22;case 113:return 23}},rules:[/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\[)/,/^(?:\]\))/,/^(?:\[\[)/,/^(?:\]\])/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\])/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:-)/,/^(?:\.)/,/^(?:[\_])/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\])/,/^(?:\[\/)/,/^(?:\/\])/,/^(?:\[\\)/,/^(?:[!"#$%&'*+,-.`?\\_/])/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[30,31],inclusive:!1},callbackname:{rules:[27,28,29],inclusive:!1},href:{rules:[24,25],inclusive:!1},click:{rules:[33,34],inclusive:!1},vertex:{rules:[],inclusive:!1},dir:{rules:[44,45,46,47,48,49,50,51,52,53,54],inclusive:!1},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},string:{rules:[15,16],inclusive:!1},INITIAL:{rules:[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,43,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113],inclusive:!0}}},t);function ie(){this.yy={}}return ne.lexer=re,ie.prototype=ne,ne.Parser=ie,new ie}();wo.parser=wo;const Co=wo,Eo=(t,e)=>{var n,r;return"dagre-wrapper"!==(null==(n=null==e?void 0:e.flowchart)?void 0:n.defaultRenderer)&&("elk"!==(null==(r=null==e?void 0:e.flowchart)?void 0:r.defaultRenderer)&&null!==t.match(/^\s*graph/))},To=(t,e)=>{var n,r;return"dagre-d3"!==(null==(n=null==e?void 0:e.flowchart)?void 0:n.defaultRenderer)&&("elk"!==(null==(r=null==e?void 0:e.flowchart)?void 0:r.defaultRenderer)&&(null!==t.match(/^\s*graph/)||null!==t.match(/^\s*flowchart/)))};let So,Ao,Lo=0,Bo=ur(),No={},Do=[],Oo={},Mo=[],Io={},Fo={},$o=0,Ro=!0,Zo=[];const Po=t=>jt.sanitizeText(t,Bo),jo=function(t,e,n){xp.parseDirective(this,t,e,n)},Yo=function(t){const e=Object.keys(No);for(const n of e)if(No[n].id===t)return No[n].domId;return t},zo=function(t,e,n,r,i,a,s={}){let o,c=t;void 0!==c&&0!==c.trim().length&&(void 0===No[c]&&(No[c]={id:c,domId:"flowchart-"+c+"-"+Lo,styles:[],classes:[]}),Lo++,void 0!==e?(Bo=ur(),o=Po(e.trim()),'"'===o[0]&&'"'===o[o.length-1]&&(o=o.substring(1,o.length-1)),No[c].text=o):void 0===No[c].text&&(No[c].text=t),void 0!==n&&(No[c].type=n),null!=r&&r.forEach((function(t){No[c].styles.push(t)})),null!=i&&i.forEach((function(t){No[c].classes.push(t)})),void 0!==a&&(No[c].dir=a),void 0===No[c].props?No[c].props=s:void 0!==s&&Object.assign(No[c].props,s))},Uo=function(t,e,n,r){const i={start:t,end:e,type:void 0,text:""};void 0!==(r=n.text)&&(i.text=Po(r.trim()),'"'===i.text[0]&&'"'===i.text[i.text.length-1]&&(i.text=i.text.substring(1,i.text.length-1))),void 0!==n&&(i.type=n.type,i.stroke=n.stroke,i.length=n.length),Do.push(i)},Wo=function(t,e,n,r){let i,a;for(i=0;i<t.length;i++)for(a=0;a<e.length;a++)Uo(t[i],e[a],n,r)},Ho=function(t,e){t.forEach((function(t){"default"===t?Do.defaultInterpolate=e:Do[t].interpolate=e}))},qo=function(t,e){t.forEach((function(t){"default"===t?Do.defaultStyle=e:(-1===er.isSubstringInArray("fill",e)&&e.push("fill:none"),Do[t].style=e)}))},Vo=function(t,e){void 0===Oo[t]&&(Oo[t]={id:t,styles:[],textStyles:[]}),null!=e&&e.forEach((function(e){if(e.match("color")){const n=e.replace("fill","bgFill").replace("color","fill");Oo[t].textStyles.push(n)}Oo[t].styles.push(e)}))},Go=function(t){So=t,So.match(/.*</)&&(So="RL"),So.match(/.*\^/)&&(So="BT"),So.match(/.*>/)&&(So="LR"),So.match(/.*v/)&&(So="TB"),"TD"===So&&(So="TB")},Xo=function(t,e){t.split(",").forEach((function(t){let n=t;void 0!==No[n]&&No[n].classes.push(e),void 0!==Io[n]&&Io[n].classes.push(e)}))},Qo=function(t,e,n){t.split(",").forEach((function(t){void 0!==No[t]&&(No[t].link=er.formatUrl(e,Bo),No[t].linkTarget=n)})),Xo(t,"clickable")},Ko=function(t){return Fo[t]},Jo=function(t,e,n){t.split(",").forEach((function(t){!function(t,e,n){let r=Yo(t);if("loose"!==ur().securityLevel)return;if(void 0===e)return;let i=[];if("string"==typeof n){i=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let t=0;t<i.length;t++){let e=i[t].trim();'"'===e.charAt(0)&&'"'===e.charAt(e.length-1)&&(e=e.substr(1,e.length-2)),i[t]=e}}0===i.length&&i.push(t),void 0!==No[t]&&(No[t].haveCallback=!0,Zo.push((function(){const t=document.querySelector(`[id="${r}"]`);null!==t&&t.addEventListener("click",(function(){er.runFunc(e,...i)}),!1)})))}(t,e,n)})),Xo(t,"clickable")},tc=function(t){Zo.forEach((function(e){e(t)}))},ec=function(){return So.trim()},nc=function(){return No},rc=function(){return Do},ic=function(){return Oo},ac=function(t){let e=(0,o.Ys)(".mermaidTooltip");null===(e._groups||e)[0][0]&&(e=(0,o.Ys)("body").append("div").attr("class","mermaidTooltip").style("opacity",0));(0,o.Ys)(t).select("svg").selectAll("g.node").on("mouseover",(function(){const t=(0,o.Ys)(this);if(null===t.attr("title"))return;const n=this.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.text(t.attr("title")).style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.top-14+document.body.scrollTop+"px"),e.html(e.html().replace(/<br\/>/g,"<br/>")),t.classed("hover",!0)})).on("mouseout",(function(){e.transition().duration(500).style("opacity",0);(0,o.Ys)(this).classed("hover",!1)}))};Zo.push(ac);const sc=function(t="gen-1"){No={},Oo={},Do=[],Zo=[ac],Mo=[],Io={},$o=0,Fo=[],Ro=!0,Ao=t,Rr()},oc=t=>{Ao=t||"gen-2"},cc=function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"},lc=function(t,e,n){let r=t.trim(),i=n;t===n&&n.match(/\s/)&&(r=void 0);let a=[];const{nodeList:s,dir:o}=function(t){const e={boolean:{},number:{},string:{}},n=[];let r;return{nodeList:t.filter((function(t){const i=typeof t;return t.stmt&&"dir"===t.stmt?(r=t.value,!1):""!==t.trim()&&(i in e?!e[i].hasOwnProperty(t)&&(e[i][t]=!0):!n.includes(t)&&n.push(t))})),dir:r}}(a.concat.apply(a,e));if(a=s,"gen-1"===Ao)for(let l=0;l<a.length;l++)a[l]=Yo(a[l]);r=r||"subGraph"+$o,i=i||"",i=Po(i),$o+=1;const c={id:r,nodes:a,title:i.trim(),classes:[],dir:o};return Bt.info("Adding",c.id,c.nodes,c.dir),c.nodes=xc(c,Mo).nodes,Mo.push(c),Io[r]=c,r},hc=function(t){for(const[e,n]of Mo.entries())if(n.id===t)return e;return-1};let uc=-1;const dc=[],pc=function(t,e){const n=Mo[e].nodes;if(uc+=1,uc>2e3)return;if(dc[uc]=e,Mo[e].id===t)return{result:!0,count:0};let r=0,i=1;for(;r<n.length;){const e=hc(n[r]);if(e>=0){const n=pc(t,e);if(n.result)return{result:!0,count:i+n.count};i+=n.count}r+=1}return{result:!1,count:i}},fc=function(t){return dc[t]},gc=function(){uc=-1,Mo.length>0&&pc("none",Mo.length-1)},yc=function(){return Mo},mc=()=>!!Ro&&(Ro=!1,!0),bc=(t,e)=>{const n=(t=>{const e=t.trim();let n=e.slice(0,-1),r="arrow_open";switch(e.slice(-1)){case"x":r="arrow_cross","x"===e[0]&&(r="double_"+r,n=n.slice(1));break;case">":r="arrow_point","<"===e[0]&&(r="double_"+r,n=n.slice(1));break;case"o":r="arrow_circle","o"===e[0]&&(r="double_"+r,n=n.slice(1))}let i="normal",a=n.length-1;"="===n[0]&&(i="thick");let s=((t,e)=>{const n=e.length;let r=0;for(let i=0;i<n;++i)e[i]===t&&++r;return r})(".",n);return s&&(i="dotted",a=s),{type:r,stroke:i,length:a}})(t);let r;if(e){if(r=(t=>{let e=t.trim(),n="arrow_open";switch(e[0]){case"<":n="arrow_point",e=e.slice(1);break;case"x":n="arrow_cross",e=e.slice(1);break;case"o":n="arrow_circle",e=e.slice(1)}let r="normal";return e.includes("=")&&(r="thick"),e.includes(".")&&(r="dotted"),{type:n,stroke:r}})(e),r.stroke!==n.stroke)return{type:"INVALID",stroke:"INVALID"};if("arrow_open"===r.type)r.type=n.type;else{if(r.type!==n.type)return{type:"INVALID",stroke:"INVALID"};r.type="double_"+r.type}return"double_arrow"===r.type&&(r.type="double_arrow_point"),r.length=n.length,r}return n},_c=(t,e)=>{let n=!1;return t.forEach((t=>{t.nodes.indexOf(e)>=0&&(n=!0)})),n},xc=(t,e)=>{const n=[];return t.nodes.forEach(((r,i)=>{_c(e,r)||n.push(t.nodes[i])})),{nodes:n}},vc={firstGraph:mc},kc={parseDirective:jo,defaultConfig:()=>rr.flowchart,setAccTitle:Zr,getAccTitle:Pr,getAccDescription:Yr,setAccDescription:jr,addVertex:zo,lookUpDomId:Yo,addLink:Wo,updateLinkInterpolate:Ho,updateLink:qo,addClass:Vo,setDirection:Go,setClass:Xo,setTooltip:function(t,e){t.split(",").forEach((function(t){void 0!==e&&(Fo["gen-1"===Ao?Yo(t):t]=Po(e))}))},getTooltip:Ko,setClickEvent:Jo,setLink:Qo,bindFunctions:tc,getDirection:ec,getVertices:nc,getEdges:rc,getClasses:ic,clear:sc,setGen:oc,defaultStyle:cc,addSubGraph:lc,getDepthFirstPos:fc,indexNodes:gc,getSubGraphs:yc,destructLink:bc,lex:vc,exists:_c,makeUniq:xc,setDiagramTitle:zr,getDiagramTitle:Ur},wc=Object.freeze(Object.defineProperty({__proto__:null,addClass:Vo,addLink:Wo,addSingleLink:Uo,addSubGraph:lc,addVertex:zo,bindFunctions:tc,clear:sc,default:kc,defaultStyle:cc,destructLink:bc,firstGraph:mc,getClasses:ic,getDepthFirstPos:fc,getDirection:ec,getEdges:rc,getSubGraphs:yc,getTooltip:Ko,getVertices:nc,indexNodes:gc,lex:vc,lookUpDomId:Yo,parseDirective:jo,setClass:Xo,setClickEvent:Jo,setDirection:Go,setGen:oc,setLink:Qo,updateLink:qo,updateLinkInterpolate:Ho},Symbol.toStringTag,{value:"Module"}));const Cc={},Ec=function(t){const e=Object.keys(t);for(const n of e)Cc[n]=t[n]},Tc={},Sc=function(t,e,n,r,i,a){const s=r.select(`[id="${n}"]`);Object.keys(t).forEach((function(n){const r=t[n];let o="default";r.classes.length>0&&(o=r.classes.join(" "));const c=Pn(r.styles);let l,h=void 0!==r.text?r.text:r.id;if(Zt(ur().flowchart.htmlLabels)){const t={label:h.replace(/fa[blrs]?:fa-[\w-]+/g,(t=>`<i class='${t.replace(":"," ")}'></i>`))};l=(0,vt.a)(s,t).node(),l.parentNode.removeChild(l)}else{const t=i.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",c.labelStyle.replace("color:","fill:"));const e=h.split(jt.lineBreakRegex);for(const n of e){const e=i.createElementNS("http://www.w3.org/2000/svg","tspan");e.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),e.setAttribute("dy","1em"),e.setAttribute("x","1"),e.textContent=n,t.appendChild(e)}l=t}let u=0,d="";switch(r.type){case"round":u=5,d="rect";break;case"square":case"group":default:d="rect";break;case"diamond":d="question";break;case"hexagon":d="hexagon";break;case"odd":case"odd_right":d="rect_left_inv_arrow";break;case"lean_right":d="lean_right";break;case"lean_left":d="lean_left";break;case"trapezoid":d="trapezoid";break;case"inv_trapezoid":d="inv_trapezoid";break;case"circle":d="circle";break;case"ellipse":d="ellipse";break;case"stadium":d="stadium";break;case"subroutine":d="subroutine";break;case"cylinder":d="cylinder";break;case"doublecircle":d="doublecircle"}e.setNode(r.id,{labelStyle:c.labelStyle,shape:d,labelText:h,rx:u,ry:u,class:o,style:c.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:a.db.getTooltip(r.id)||"",domId:a.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:"group"===r.type?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:ur().flowchart.padding}),Bt.info("setNode",{labelStyle:c.labelStyle,shape:d,labelText:h,rx:u,ry:u,class:o,style:c.style,id:r.id,domId:a.db.lookUpDomId(r.id),width:"group"===r.type?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:ur().flowchart.padding})}))},Ac=function(t,e,n){Bt.info("abc78 edges = ",t);let r,i,a=0,s={};if(void 0!==t.defaultStyle){const e=Pn(t.defaultStyle);r=e.style,i=e.labelStyle}t.forEach((function(n){a++;var c="L-"+n.start+"-"+n.end;void 0===s[c]?(s[c]=0,Bt.info("abc78 new entry",c,s[c])):(s[c]++,Bt.info("abc78 new entry",c,s[c]));let l=c+"-"+s[c];Bt.info("abc78 new link id to be used is",c,l,s[c]);var h="LS-"+n.start,u="LE-"+n.end;const d={style:"",labelStyle:""};switch(d.minlen=n.length||1,"arrow_open"===n.type?d.arrowhead="none":d.arrowhead="normal",d.arrowTypeStart="arrow_open",d.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":d.arrowTypeStart="arrow_cross";case"arrow_cross":d.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":d.arrowTypeStart="arrow_point";case"arrow_point":d.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":d.arrowTypeStart="arrow_circle";case"arrow_circle":d.arrowTypeEnd="arrow_circle"}let p="",f="";switch(n.stroke){case"normal":p="fill:none;",void 0!==r&&(p=r),void 0!==i&&(f=i),d.thickness="normal",d.pattern="solid";break;case"dotted":d.thickness="normal",d.pattern="dotted",d.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":d.thickness="thick",d.pattern="solid",d.style="stroke-width: 3.5px;fill:none;"}if(void 0!==n.style){const t=Pn(n.style);p=t.style,f=t.labelStyle}d.style=d.style+=p,d.labelStyle=d.labelStyle+=f,void 0!==n.interpolate?d.curve=Rn(n.interpolate,o.c_6):void 0!==t.defaultInterpolate?d.curve=Rn(t.defaultInterpolate,o.c_6):d.curve=Rn(Tc.curve,o.c_6),void 0===n.text?void 0!==n.style&&(d.arrowheadStyle="fill: #333"):(d.arrowheadStyle="fill: #333",d.labelpos="c"),d.labelType="text",d.label=n.text.replace(jt.lineBreakRegex,"\n"),void 0===n.style&&(d.style=d.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),d.labelStyle=d.labelStyle.replace("color:","fill:"),d.id=l,d.classes="flowchart-link "+h+" "+u,e.setEdge(n.start,n.end,d,a)}))},Lc={setConf:function(t){const e=Object.keys(t);for(const n of e)Tc[n]=t[n]},addVertices:Sc,addEdges:Ac,getClasses:function(t,e){Bt.info("Extracting classes"),e.db.clear();try{return e.parse(t),e.db.getClasses()}catch(n){return}},draw:function(t,e,n,r){Bt.info("Drawing flowchart"),r.db.clear(),kc.setGen("gen-2"),r.parser.parse(t);let i=r.db.getDirection();void 0===i&&(i="TD");const{securityLevel:a,flowchart:s}=ur(),c=s.nodeSpacing||50,l=s.rankSpacing||50;let h;"sandbox"===a&&(h=(0,o.Ys)("#i"+e));const u="sandbox"===a?(0,o.Ys)(h.nodes()[0].contentDocument.body):(0,o.Ys)("body"),d="sandbox"===a?h.nodes()[0].contentDocument:document,p=new lt.k({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:c,ranksep:l,marginx:0,marginy:0}).setDefaultEdgeLabel((function(){return{}}));let f;const g=r.db.getSubGraphs();Bt.info("Subgraphs - ",g);for(let o=g.length-1;o>=0;o--)f=g[o],Bt.info("Subgraph - ",f),r.db.addVertex(f.id,f.title,"group",void 0,f.classes,f.dir);const y=r.db.getVertices(),m=r.db.getEdges();Bt.info("Edges",m);let b=0;for(b=g.length-1;b>=0;b--){f=g[b],(0,o.td_)("cluster").append("text");for(let t=0;t<f.nodes.length;t++)Bt.info("Setting up subgraphs",f.nodes[t],f.id),p.setParent(f.nodes[t],f.id)}Sc(y,p,e,u,d,r),Ac(m,p);const _=u.select(`[id="${e}"]`),x=u.select("#"+e+" g");if(Ks(x,p,["point","circle","cross"],"flowchart",e),er.insertTitle(_,"flowchartTitleText",s.titleTopMargin,r.db.getDiagramTitle()),_r(p,_,s.diagramPadding,s.useMaxWidth),r.db.indexNodes("subGraph"+b),!s.htmlLabels){const t=d.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(const e of t){const t=e.getBBox(),n=d.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("rx",0),n.setAttribute("ry",0),n.setAttribute("width",t.width),n.setAttribute("height",t.height),e.insertBefore(n,e.firstChild)}}Object.keys(y).forEach((function(t){const n=y[t];if(n.link){const r=(0,o.Ys)("#"+e+' [id="'+t+'"]');if(r){const t=d.createElementNS("http://www.w3.org/2000/svg","a");t.setAttributeNS("http://www.w3.org/2000/svg","class",n.classes.join(" ")),t.setAttributeNS("http://www.w3.org/2000/svg","href",n.link),t.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),"sandbox"===a?t.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):n.linkTarget&&t.setAttributeNS("http://www.w3.org/2000/svg","target",n.linkTarget);const e=r.insert((function(){return t}),":first-child"),i=r.select(".label-container");i&&e.append((function(){return i.node()}));const s=r.select(".label");s&&e.append((function(){return s.node()}))}}}))}};var Bc=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,3],r=[1,5],i=[7,9,11,12,13,14,15,16,17,18,19,20,21,23,25,26,28,35,40],a=[1,15],s=[1,16],o=[1,17],c=[1,18],l=[1,19],h=[1,20],u=[1,21],d=[1,22],p=[1,23],f=[1,24],g=[1,25],y=[1,26],m=[1,27],b=[1,29],_=[1,31],x=[1,34],v=[5,7,9,11,12,13,14,15,16,17,18,19,20,21,23,25,26,28,35,40],k={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,gantt:5,document:6,EOF:7,line:8,SPACE:9,statement:10,NL:11,dateFormat:12,inclusiveEndDates:13,topAxis:14,axisFormat:15,tickInterval:16,excludes:17,includes:18,todayMarker:19,title:20,acc_title:21,acc_title_value:22,acc_descr:23,acc_descr_value:24,acc_descr_multiline_value:25,section:26,clickStatement:27,taskTxt:28,taskData:29,openDirective:30,typeDirective:31,closeDirective:32,":":33,argDirective:34,click:35,callbackname:36,callbackargs:37,href:38,clickStatementDebug:39,open_directive:40,type_directive:41,arg_directive:42,close_directive:43,$accept:0,$end:1},terminals_:{2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"tickInterval",17:"excludes",18:"includes",19:"todayMarker",20:"title",21:"acc_title",22:"acc_title_value",23:"acc_descr",24:"acc_descr_value",25:"acc_descr_multiline_value",26:"section",28:"taskTxt",29:"taskData",33:":",35:"click",36:"callbackname",37:"callbackargs",38:"href",40:"open_directive",41:"type_directive",42:"arg_directive",43:"close_directive"},productions_:[0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[27,2],[27,3],[27,3],[27,4],[27,3],[27,4],[27,2],[39,2],[39,3],[39,3],[39,4],[39,3],[39,4],[39,2],[30,1],[31,1],[34,1],[32,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 2:return a[o-1];case 3:case 7:case 8:this.$=[];break;case 4:a[o-1].push(a[o]),this.$=a[o-1];break;case 5:case 6:this.$=a[o];break;case 9:r.setDateFormat(a[o].substr(11)),this.$=a[o].substr(11);break;case 10:r.enableInclusiveEndDates(),this.$=a[o].substr(18);break;case 11:r.TopAxis(),this.$=a[o].substr(8);break;case 12:r.setAxisFormat(a[o].substr(11)),this.$=a[o].substr(11);break;case 13:r.setTickInterval(a[o].substr(13)),this.$=a[o].substr(13);break;case 14:r.setExcludes(a[o].substr(9)),this.$=a[o].substr(9);break;case 15:r.setIncludes(a[o].substr(9)),this.$=a[o].substr(9);break;case 16:r.setTodayMarker(a[o].substr(12)),this.$=a[o].substr(12);break;case 17:r.setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 18:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 19:case 20:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 21:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 23:r.addTask(a[o-1],a[o]),this.$="task";break;case 27:this.$=a[o-1],r.setClickEvent(a[o-1],a[o],null);break;case 28:this.$=a[o-2],r.setClickEvent(a[o-2],a[o-1],a[o]);break;case 29:this.$=a[o-2],r.setClickEvent(a[o-2],a[o-1],null),r.setLink(a[o-2],a[o]);break;case 30:this.$=a[o-3],r.setClickEvent(a[o-3],a[o-2],a[o-1]),r.setLink(a[o-3],a[o]);break;case 31:this.$=a[o-2],r.setClickEvent(a[o-2],a[o],null),r.setLink(a[o-2],a[o-1]);break;case 32:this.$=a[o-3],r.setClickEvent(a[o-3],a[o-1],a[o]),r.setLink(a[o-3],a[o-2]);break;case 33:this.$=a[o-1],r.setLink(a[o-1],a[o]);break;case 34:case 40:this.$=a[o-1]+" "+a[o];break;case 35:case 36:case 38:this.$=a[o-2]+" "+a[o-1]+" "+a[o];break;case 37:case 39:this.$=a[o-3]+" "+a[o-2]+" "+a[o-1]+" "+a[o];break;case 41:r.parseDirective("%%{","open_directive");break;case 42:r.parseDirective(a[o],"type_directive");break;case 43:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 44:r.parseDirective("}%%","close_directive","gantt")}},table:[{3:1,4:2,5:n,30:4,40:r},{1:[3]},{3:6,4:2,5:n,30:4,40:r},e(i,[2,3],{6:7}),{31:8,41:[1,9]},{41:[2,41]},{1:[2,1]},{4:30,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:a,13:s,14:o,15:c,16:l,17:h,18:u,19:d,20:p,21:f,23:g,25:y,26:m,27:28,28:b,30:4,35:_,40:r},{32:32,33:[1,33],43:x},e([33,43],[2,42]),e(i,[2,8],{1:[2,2]}),e(i,[2,4]),{4:30,10:35,12:a,13:s,14:o,15:c,16:l,17:h,18:u,19:d,20:p,21:f,23:g,25:y,26:m,27:28,28:b,30:4,35:_,40:r},e(i,[2,6]),e(i,[2,7]),e(i,[2,9]),e(i,[2,10]),e(i,[2,11]),e(i,[2,12]),e(i,[2,13]),e(i,[2,14]),e(i,[2,15]),e(i,[2,16]),e(i,[2,17]),{22:[1,36]},{24:[1,37]},e(i,[2,20]),e(i,[2,21]),e(i,[2,22]),{29:[1,38]},e(i,[2,24]),{36:[1,39],38:[1,40]},{11:[1,41]},{34:42,42:[1,43]},{11:[2,44]},e(i,[2,5]),e(i,[2,18]),e(i,[2,19]),e(i,[2,23]),e(i,[2,27],{37:[1,44],38:[1,45]}),e(i,[2,33],{36:[1,46]}),e(v,[2,25]),{32:47,43:x},{43:[2,43]},e(i,[2,28],{38:[1,48]}),e(i,[2,29]),e(i,[2,31],{37:[1,49]}),{11:[1,50]},e(i,[2,30]),e(i,[2,32]),e(v,[2,26])],defaultActions:{5:[2,41],6:[2,1],34:[2,44],43:[2,43]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},w=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),40;case 1:return this.begin("type_directive"),41;case 2:return this.popState(),this.begin("arg_directive"),33;case 3:return this.popState(),this.popState(),43;case 4:return 42;case 5:return this.begin("acc_title"),21;case 6:return this.popState(),"acc_title_value";case 7:return this.begin("acc_descr"),23;case 8:return this.popState(),"acc_descr_value";case 9:this.begin("acc_descr_multiline");break;case 10:case 20:case 23:case 26:case 29:this.popState();break;case 11:return"acc_descr_multiline_value";case 12:case 13:case 14:case 16:case 17:case 18:break;case 15:return 11;case 19:this.begin("href");break;case 21:return 38;case 22:this.begin("callbackname");break;case 24:this.popState(),this.begin("callbackargs");break;case 25:return 36;case 27:return 37;case 28:this.begin("click");break;case 30:return 35;case 31:return 5;case 32:return 12;case 33:return 13;case 34:return 14;case 35:return 15;case 36:return 16;case 37:return 18;case 38:return 17;case 39:return 19;case 40:return"date";case 41:return 20;case 42:return"accDescription";case 43:return 26;case 44:return 28;case 45:return 29;case 46:return 33;case 47:return 7;case 48:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[26,27],inclusive:!1},callbackname:{rules:[23,24,25],inclusive:!1},href:{rules:[20,21],inclusive:!1},click:{rules:[29,30],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],inclusive:!0}}},t);function C(){this.yy={}}return k.lexer=w,C.prototype=k,k.Parser=C,new C}();Bc.parser=Bc;const Nc=Bc,Dc=t=>null!==t.match(/^\s*gantt/);a().extend(wt()),a().extend(Et()),a().extend(St());let Oc,Mc="",Ic="",Fc="",$c=[],Rc=[],Zc={},Pc=[],jc=[],Yc="";const zc=["active","done","crit","milestone"];let Uc=[],Wc=!1,Hc=!1,qc=0;const Vc=function(t,e,n,r){return!r.includes(t.format(e.trim()))&&(!!(t.isoWeekday()>=6&&n.includes("weekends"))||(!!n.includes(t.format("dddd").toLowerCase())||n.includes(t.format(e.trim()))))},Gc=function(t,e,n,r){if(!n.length||t.manualEndTime)return;let i,s;i=t.startTime instanceof Date?a()(t.startTime):a()(t.startTime,e,!0),i=i.add(1,"d"),s=t.endTime instanceof Date?a()(t.endTime):a()(t.endTime,e,!0);const[o,c]=Xc(i,s,e,n,r);t.endTime=o.toDate(),t.renderEndTime=c},Xc=function(t,e,n,r,i){let a=!1,s=null;for(;t<=e;)a||(s=e.toDate()),a=Vc(t,n,r,i),a&&(e=e.add(1,"d")),t=t.add(1,"d");return[e,s]},Qc=function(t,e,n){n=n.trim();const r=/^after\s+([\d\w- ]+)/.exec(n.trim());if(null!==r){let t=null;if(r[1].split(" ").forEach((function(e){let n=sl(e);void 0!==n&&(t?n.endTime>t.endTime&&(t=n):t=n)})),t)return t.endTime;{const t=new Date;return t.setHours(0,0,0,0),t}}let i=a()(n,e.trim(),!0);if(i.isValid())return i.toDate();{Bt.debug("Invalid date:"+n),Bt.debug("With date format:"+e.trim());const t=new Date(n);if(void 0===t||isNaN(t.getTime()))throw new Error("Invalid date:"+n);return t}},Kc=function(t){const e=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());return null!==e?[Number.parseFloat(e[1]),e[2]]:[NaN,"ms"]},Jc=function(t,e,n,r=!1){n=n.trim();let i=a()(n,e.trim(),!0);if(i.isValid())return r&&(i=i.add(1,"d")),i.toDate();let s=a()(t);const[o,c]=Kc(n);if(!Number.isNaN(o)){const t=s.add(o,c);t.isValid()&&(s=t)}return s.toDate()};let tl=0;const el=function(t){return void 0===t?(tl+=1,"task"+tl):t};let nl,rl,il=[];const al={},sl=function(t){const e=al[t];return il[e]},ol=function(){const t=function(t){const e=il[t];let n="";switch(il[t].raw.startTime.type){case"prevTaskEnd":{const t=sl(e.prevTaskId);e.startTime=t.endTime;break}case"getStartDate":n=Qc(0,Mc,il[t].raw.startTime.startData),n&&(il[t].startTime=n)}return il[t].startTime&&(il[t].endTime=Jc(il[t].startTime,Mc,il[t].raw.endTime.data,Wc),il[t].endTime&&(il[t].processed=!0,il[t].manualEndTime=a()(il[t].raw.endTime.data,"YYYY-MM-DD",!0).isValid(),Gc(il[t],Mc,Rc,$c))),il[t].processed};let e=!0;for(const[n,r]of il.entries())t(n),e=e&&r.processed;return e},cl=function(t,e){t.split(",").forEach((function(t){let n=sl(t);void 0!==n&&n.classes.push(e)}))},ll=function(t,e){Uc.push((function(){const n=document.querySelector(`[id="${t}"]`);null!==n&&n.addEventListener("click",(function(){e()}))}),(function(){const n=document.querySelector(`[id="${t}-text"]`);null!==n&&n.addEventListener("click",(function(){e()}))}))},hl={parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().gantt,clear:function(){Pc=[],jc=[],Yc="",Uc=[],tl=0,nl=void 0,rl=void 0,il=[],Mc="",Ic="",Oc=void 0,Fc="",$c=[],Rc=[],Wc=!1,Hc=!1,qc=0,Zc={},Rr()},setDateFormat:function(t){Mc=t},getDateFormat:function(){return Mc},enableInclusiveEndDates:function(){Wc=!0},endDatesAreInclusive:function(){return Wc},enableTopAxis:function(){Hc=!0},topAxisEnabled:function(){return Hc},setAxisFormat:function(t){Ic=t},getAxisFormat:function(){return Ic},setTickInterval:function(t){Oc=t},getTickInterval:function(){return Oc},setTodayMarker:function(t){Fc=t},getTodayMarker:function(){return Fc},setAccTitle:Zr,getAccTitle:Pr,setDiagramTitle:zr,getDiagramTitle:Ur,setAccDescription:jr,getAccDescription:Yr,addSection:function(t){Yc=t,Pc.push(t)},getSections:function(){return Pc},getTasks:function(){let t=ol();let e=0;for(;!t&&e<10;)t=ol(),e++;return jc=il,jc},addTask:function(t,e){const n={section:Yc,type:Yc,processed:!1,manualEndTime:!1,renderEndTime:null,raw:{data:e},task:t,classes:[]},r=function(t,e){let n;n=":"===e.substr(0,1)?e.substr(1,e.length):e;const r=n.split(","),i={};ul(r,i,zc);for(let a=0;a<r.length;a++)r[a]=r[a].trim();switch(r.length){case 1:i.id=el(),i.startTime={type:"prevTaskEnd",id:t},i.endTime={data:r[0]};break;case 2:i.id=el(),i.startTime={type:"getStartDate",startData:r[0]},i.endTime={data:r[1]};break;case 3:i.id=el(r[0]),i.startTime={type:"getStartDate",startData:r[1]},i.endTime={data:r[2]}}return i}(rl,e);n.raw.startTime=r.startTime,n.raw.endTime=r.endTime,n.id=r.id,n.prevTaskId=rl,n.active=r.active,n.done=r.done,n.crit=r.crit,n.milestone=r.milestone,n.order=qc,qc++;const i=il.push(n);rl=n.id,al[n.id]=i-1},findTaskById:sl,addTaskOrg:function(t,e){const n={section:Yc,type:Yc,description:t,task:t,classes:[]},r=function(t,e){let n;n=":"===e.substr(0,1)?e.substr(1,e.length):e;const r=n.split(","),i={};ul(r,i,zc);for(let a=0;a<r.length;a++)r[a]=r[a].trim();let s="";switch(r.length){case 1:i.id=el(),i.startTime=t.endTime,s=r[0];break;case 2:i.id=el(),i.startTime=Qc(0,Mc,r[0]),s=r[1];break;case 3:i.id=el(r[0]),i.startTime=Qc(0,Mc,r[1]),s=r[2]}return s&&(i.endTime=Jc(i.startTime,Mc,s,Wc),i.manualEndTime=a()(s,"YYYY-MM-DD",!0).isValid(),Gc(i,Mc,Rc,$c)),i}(nl,e);n.startTime=r.startTime,n.endTime=r.endTime,n.id=r.id,n.active=r.active,n.done=r.done,n.crit=r.crit,n.milestone=r.milestone,nl=n,jc.push(n)},setIncludes:function(t){$c=t.toLowerCase().split(/[\s,]+/)},getIncludes:function(){return $c},setExcludes:function(t){Rc=t.toLowerCase().split(/[\s,]+/)},getExcludes:function(){return Rc},setClickEvent:function(t,e,n){t.split(",").forEach((function(t){!function(t,e,n){if("loose"!==ur().securityLevel)return;if(void 0===e)return;let r=[];if("string"==typeof n){r=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let t=0;t<r.length;t++){let e=r[t].trim();'"'===e.charAt(0)&&'"'===e.charAt(e.length-1)&&(e=e.substr(1,e.length-2)),r[t]=e}}0===r.length&&r.push(t),void 0!==sl(t)&&ll(t,(()=>{er.runFunc(e,...r)}))}(t,e,n)})),cl(t,"clickable")},setLink:function(t,e){let n=e;"loose"!==ur().securityLevel&&(n=(0,s.N)(e)),t.split(",").forEach((function(t){void 0!==sl(t)&&(ll(t,(()=>{window.open(n,"_self")})),Zc[t]=n)})),cl(t,"clickable")},getLinks:function(){return Zc},bindFunctions:function(t){Uc.forEach((function(e){e(t)}))},parseDuration:Kc,isInvalidDate:Vc};function ul(t,e,n){let r=!0;for(;r;)r=!1,n.forEach((function(n){const i=new RegExp("^\\s*"+n+"\\s*$");t[0].match(i)&&(e[n]=!0,t.shift(1),r=!0)}))}let dl;const pl={setConf:function(){Bt.debug("Something is calling, setConf, remove the call")},draw:function(t,e,n,r){const i=ur().gantt,s=ur().securityLevel;let c;"sandbox"===s&&(c=(0,o.Ys)("#i"+e));const l="sandbox"===s?(0,o.Ys)(c.nodes()[0].contentDocument.body):(0,o.Ys)("body"),h="sandbox"===s?c.nodes()[0].contentDocument:document,u=h.getElementById(e);dl=u.parentElement.offsetWidth,void 0===dl&&(dl=1200),void 0!==i.useWidth&&(dl=i.useWidth);const d=r.db.getTasks(),p=d.length*(i.barHeight+i.barGap)+2*i.topPadding;u.setAttribute("viewBox","0 0 "+dl+" "+p);const f=l.select(`[id="${e}"]`),g=(0,o.Xf)().domain([(0,o.VV$)(d,(function(t){return t.startTime})),(0,o.Fp7)(d,(function(t){return t.endTime}))]).rangeRound([0,dl-i.leftPadding-i.rightPadding]);let y=[];for(const a of d)y.push(a.type);const m=y;function b(t,e){return function(t){let e=t.length;const n={};for(;e;)n[t[--e]]=(n[t[e]]||0)+1;return n}(e)[t]||0}y=function(t){const e={},n=[];for(let r=0,i=t.length;r<i;++r)Object.prototype.hasOwnProperty.call(e,t[r])||(e[t[r]]=!0,n.push(t[r]));return n}(y),d.sort((function(t,e){const n=t.startTime,r=e.startTime;let i=0;return n>r?i=1:n<r&&(i=-1),i})),function(t,n,s){const c=i.barHeight,l=c+i.barGap,u=i.topPadding,d=i.leftPadding;(0,o.BYU)().domain([0,y.length]).range(["#00B9FA","#F95002"]).interpolate(o.JHv);(function(t,e,n,s,o,c,l,h){const u=c.reduce(((t,{startTime:e})=>t?Math.min(t,e):e),0),d=c.reduce(((t,{endTime:e})=>t?Math.max(t,e):e),0),p=r.db.getDateFormat();if(!u||!d)return;const y=[];let m=null,b=a()(u);for(;b.valueOf()<=d;)r.db.isInvalidDate(b,p,l,h)?m?m.end=b:m={start:b,end:b}:m&&(y.push(m),m=null),b=b.add(1,"d");f.append("g").selectAll("rect").data(y).enter().append("rect").attr("id",(function(t){return"exclude-"+t.start.format("YYYY-MM-DD")})).attr("x",(function(t){return g(t.start)+n})).attr("y",i.gridLineStartPadding).attr("width",(function(t){const e=t.end.add(1,"day");return g(e)-g(t.start)})).attr("height",o-e-i.gridLineStartPadding).attr("transform-origin",(function(e,r){return(g(e.start)+n+.5*(g(e.end)-g(e.start))).toString()+"px "+(r*t+.5*o).toString()+"px"})).attr("class","exclude-range")})(l,u,d,0,s,t,r.db.getExcludes(),r.db.getIncludes()),function(t,e,n,a){let s=(0,o.LLu)(g).tickSize(-a+e+i.gridLineStartPadding).tickFormat((0,o.i$Z)(r.db.getAxisFormat()||i.axisFormat||"%Y-%m-%d"));const c=/^([1-9]\d*)(minute|hour|day|week|month)$/.exec(r.db.getTickInterval()||i.tickInterval);if(null!==c){const t=c[1];switch(c[2]){case"minute":s.ticks(o.Z_i.every(t));break;case"hour":s.ticks(o.WQD.every(t));break;case"day":s.ticks(o.rr1.every(t));break;case"week":s.ticks(o.NGh.every(t));break;case"month":s.ticks(o.F0B.every(t))}}if(f.append("g").attr("class","grid").attr("transform","translate("+t+", "+(a-50)+")").call(s).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),r.db.topAxisEnabled()||i.topAxis){let n=(0,o.F5q)(g).tickSize(-a+e+i.gridLineStartPadding).tickFormat((0,o.i$Z)(r.db.getAxisFormat()||i.axisFormat||"%Y-%m-%d"));if(null!==c){const t=c[1];switch(c[2]){case"minute":n.ticks(o.Z_i.every(t));break;case"hour":n.ticks(o.WQD.every(t));break;case"day":n.ticks(o.rr1.every(t));break;case"week":n.ticks(o.NGh.every(t));break;case"month":n.ticks(o.F0B.every(t))}}f.append("g").attr("class","grid").attr("transform","translate("+t+", "+e+")").call(n).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}(d,u,0,s),function(t,n,a,s,c,l,h){f.append("g").selectAll("rect").data(t).enter().append("rect").attr("x",0).attr("y",(function(t,e){return t.order*n+a-2})).attr("width",(function(){return h-i.rightPadding/2})).attr("height",n).attr("class",(function(t){for(const[e,n]of y.entries())if(t.type===n)return"section section"+e%i.numberSectionStyles;return"section section0"}));const u=f.append("g").selectAll("rect").data(t).enter(),d=r.db.getLinks();u.append("rect").attr("id",(function(t){return t.id})).attr("rx",3).attr("ry",3).attr("x",(function(t){return t.milestone?g(t.startTime)+s+.5*(g(t.endTime)-g(t.startTime))-.5*c:g(t.startTime)+s})).attr("y",(function(t,e){return t.order*n+a})).attr("width",(function(t){return t.milestone?c:g(t.renderEndTime||t.endTime)-g(t.startTime)})).attr("height",c).attr("transform-origin",(function(t,e){return e=t.order,(g(t.startTime)+s+.5*(g(t.endTime)-g(t.startTime))).toString()+"px "+(e*n+a+.5*c).toString()+"px"})).attr("class",(function(t){const e="task";let n="";t.classes.length>0&&(n=t.classes.join(" "));let r=0;for(const[s,o]of y.entries())t.type===o&&(r=s%i.numberSectionStyles);let a="";return t.active?t.crit?a+=" activeCrit":a=" active":t.done?a=t.crit?" doneCrit":" done":t.crit&&(a+=" crit"),0===a.length&&(a=" task"),t.milestone&&(a=" milestone "+a),a+=r,a+=" "+n,e+a})),u.append("text").attr("id",(function(t){return t.id+"-text"})).text((function(t){return t.task})).attr("font-size",i.fontSize).attr("x",(function(t){let e=g(t.startTime),n=g(t.renderEndTime||t.endTime);t.milestone&&(e+=.5*(g(t.endTime)-g(t.startTime))-.5*c),t.milestone&&(n=e+c);const r=this.getBBox().width;return r>n-e?n+r+1.5*i.leftPadding>h?e+s-5:n+s+5:(n-e)/2+e+s})).attr("y",(function(t,e){return t.order*n+i.barHeight/2+(i.fontSize/2-2)+a})).attr("text-height",c).attr("class",(function(t){const e=g(t.startTime);let n=g(t.endTime);t.milestone&&(n=e+c);const r=this.getBBox().width;let a="";t.classes.length>0&&(a=t.classes.join(" "));let s=0;for(const[c,l]of y.entries())t.type===l&&(s=c%i.numberSectionStyles);let o="";return t.active&&(o=t.crit?"activeCritText"+s:"activeText"+s),t.done?o=t.crit?o+" doneCritText"+s:o+" doneText"+s:t.crit&&(o=o+" critText"+s),t.milestone&&(o+=" milestoneText"),r>n-e?n+r+1.5*i.leftPadding>h?a+" taskTextOutsideLeft taskTextOutside"+s+" "+o:a+" taskTextOutsideRight taskTextOutside"+s+" "+o+" width-"+r:a+" taskText taskText"+s+" "+o+" width-"+r}));if("sandbox"===ur().securityLevel){let t;t=(0,o.Ys)("#i"+e);const n=t.nodes()[0].contentDocument;u.filter((function(t){return void 0!==d[t.id]})).each((function(t){var e=n.querySelector("#"+t.id),r=n.querySelector("#"+t.id+"-text");const i=e.parentNode;var a=n.createElement("a");a.setAttribute("xlink:href",d[t.id]),a.setAttribute("target","_top"),i.appendChild(a),a.appendChild(e),a.appendChild(r)}))}}(t,l,u,d,c,0,n),function(t,e){const n=[];let r=0;for(const[i,a]of y.entries())n[i]=[a,b(a,m)];f.append("g").selectAll("text").data(n).enter().append((function(t){const e=t[0].split(jt.lineBreakRegex),n=-(e.length-1)/2,r=h.createElementNS("http://www.w3.org/2000/svg","text");r.setAttribute("dy",n+"em");for(const[i,a]of e.entries()){const t=h.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttribute("alignment-baseline","central"),t.setAttribute("x","10"),i>0&&t.setAttribute("dy","1em"),t.textContent=a,r.appendChild(t)}return r})).attr("x",10).attr("y",(function(i,a){if(!(a>0))return i[1]*t/2+e;for(let s=0;s<a;s++)return r+=n[a-1][1],i[1]*t/2+r*t+e})).attr("font-size",i.sectionFontSize).attr("font-size",i.sectionFontSize).attr("class",(function(t){for(const[e,n]of y.entries())if(t[0]===n)return"sectionTitle sectionTitle"+e%i.numberSectionStyles;return"sectionTitle"}))}(l,u),function(t,e,n,a){const s=r.db.getTodayMarker();if("off"===s)return;const o=f.append("g").attr("class","today"),c=new Date,l=o.append("line");l.attr("x1",g(c)+t).attr("x2",g(c)+t).attr("y1",i.titleTopMargin).attr("y2",a-i.titleTopMargin).attr("class","today"),""!==s&&l.attr("style",s.replace(/,/g,";"))}(d,0,0,s)}(d,dl,p),br(f,p,dl,i.useMaxWidth),f.append("text").text(r.db.getDiagramTitle()).attr("x",dl/2).attr("y",i.titleTopMargin).attr("class","titleText")}};var fl=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[6,9,10],r={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,r,i,a,s){switch(a.length,i){case 1:return r;case 4:break;case 6:r.setInfo(!0)}},table:[{3:1,4:[1,2]},{1:[3]},e(n,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},e(n,[2,3]),e(n,[2,4]),e(n,[2,5]),e(n,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},i=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return 4;case 1:return 9;case 2:return"space";case 3:return 10;case 4:return 6;case 5:return"TXT"}},rules:[/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5],inclusive:!0}}},t);function a(){this.yy={}}return r.lexer=i,a.prototype=r,r.Parser=a,new a}();fl.parser=fl;const gl=fl;var yl="",ml=!1;const bl={setMessage:t=>{Bt.debug("Setting message to: "+t),yl=t},getMessage:()=>yl,setInfo:t=>{ml=t},getInfo:()=>ml,clear:Rr},_l={draw:(t,e,n)=>{try{Bt.debug("Rendering info diagram\n"+t);const r=ur().securityLevel;let i;"sandbox"===r&&(i=(0,o.Ys)("#i"+e));const a=("sandbox"===r?(0,o.Ys)(i.nodes()[0].contentDocument.body):(0,o.Ys)("body")).select("#"+e);a.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size","32px").style("text-anchor","middle").text("v "+n),a.attr("height",100),a.attr("width",400)}catch(r){Bt.error("Error while rendering info diagram"),Bt.error(r.message)}}},xl=t=>null!==t.match(/^\s*info/);var vl=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,4],r=[1,5],i=[1,6],a=[1,7],s=[1,9],o=[1,11,13,15,17,19,20,26,27,28,29],c=[2,5],l=[1,6,11,13,15,17,19,20,26,27,28,29],h=[26,27,28],u=[2,8],d=[1,18],p=[1,19],f=[1,20],g=[1,21],y=[1,22],m=[1,23],b=[1,28],_=[6,26,27,28,29],x={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,PIE:6,document:7,showData:8,line:9,statement:10,txt:11,value:12,title:13,title_value:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,openDirective:21,typeDirective:22,closeDirective:23,":":24,argDirective:25,NEWLINE:26,";":27,EOF:28,open_directive:29,type_directive:30,arg_directive:31,close_directive:32,$accept:0,$end:1},terminals_:{2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",24:":",26:"NEWLINE",27:";",28:"EOF",29:"open_directive",30:"type_directive",31:"arg_directive",32:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:r.setShowData(!0);break;case 7:this.$=a[o-1];break;case 9:r.addSection(a[o-1],r.cleanupValue(a[o]));break;case 10:this.$=a[o].trim(),r.setDiagramTitle(this.$);break;case 11:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 12:case 13:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 14:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 21:r.parseDirective("%%{","open_directive");break;case 22:r.parseDirective(a[o],"type_directive");break;case 23:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 24:r.parseDirective("}%%","close_directive","pie")}},table:[{3:1,4:2,5:3,6:n,21:8,26:r,27:i,28:a,29:s},{1:[3]},{3:10,4:2,5:3,6:n,21:8,26:r,27:i,28:a,29:s},{3:11,4:2,5:3,6:n,21:8,26:r,27:i,28:a,29:s},e(o,c,{7:12,8:[1,13]}),e(l,[2,18]),e(l,[2,19]),e(l,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},e(h,u,{21:8,9:16,10:17,5:24,1:[2,3],11:d,13:p,15:f,17:g,19:y,20:m,29:s}),e(o,c,{7:25}),{23:26,24:[1,27],32:b},e([24,32],[2,22]),e(o,[2,6]),{4:29,26:r,27:i,28:a},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},e(h,[2,13]),e(h,[2,14]),e(h,[2,15]),e(h,u,{21:8,9:16,10:17,5:24,1:[2,4],11:d,13:p,15:f,17:g,19:y,20:m,29:s}),e(_,[2,16]),{25:34,31:[1,35]},e(_,[2,24]),e(o,[2,7]),e(h,[2,9]),e(h,[2,10]),e(h,[2,11]),e(h,[2,12]),{23:36,32:b},{32:[2,23]},e(_,[2,17])],defaultActions:{9:[2,21],10:[2,1],11:[2,2],35:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},v=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),29;case 1:return this.begin("type_directive"),30;case 2:return this.popState(),this.begin("arg_directive"),24;case 3:return this.popState(),this.popState(),32;case 4:return 31;case 5:case 6:case 8:case 9:break;case 7:return 26;case 10:return this.begin("title"),13;case 11:return this.popState(),"title_value";case 12:return this.begin("acc_title"),15;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),17;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:case 20:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:this.begin("string");break;case 21:return"txt";case 22:return 6;case 23:return 8;case 24:return"value";case 25:return 28}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},title:{rules:[11],inclusive:!1},string:{rules:[20,21],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],inclusive:!0}}},t);function k(){this.yy={}}return x.lexer=v,k.prototype=x,x.Parser=k,new k}();vl.parser=vl;const kl=vl,wl=t=>null!==t.match(/^\s*pie/)||null!==t.match(/^\s*bar/);let Cl={},El=!1;const Tl={parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().pie,addSection:function(t,e){t=jt.sanitizeText(t,ur()),void 0===Cl[t]&&(Cl[t]=e,Bt.debug("Added new section :",t))},getSections:()=>Cl,cleanupValue:function(t){return":"===t.substring(0,1)?(t=t.substring(1).trim(),Number(t.trim())):Number(t.trim())},clear:function(){Cl={},El=!1,Rr()},setAccTitle:Zr,getAccTitle:Pr,setDiagramTitle:zr,getDiagramTitle:Ur,setShowData:function(t){El=t},getShowData:function(){return El},getAccDescription:Yr,setAccDescription:jr};let Sl,Al=ur();const Ll=450,Bl={draw:(t,e,n,r)=>{try{Al=ur(),Bt.debug("Rendering info diagram\n"+t);const n=ur().securityLevel;let y;"sandbox"===n&&(y=(0,o.Ys)("#i"+e));const m="sandbox"===n?(0,o.Ys)(y.nodes()[0].contentDocument.body):(0,o.Ys)("body"),b="sandbox"===n?y.nodes()[0].contentDocument:document;r.db.clear(),r.parser.parse(t),Bt.debug("Parsed info diagram");const _=b.getElementById(e);Sl=_.parentElement.offsetWidth,void 0===Sl&&(Sl=1200),void 0!==Al.useWidth&&(Sl=Al.useWidth),void 0!==Al.pie.useWidth&&(Sl=Al.pie.useWidth);const x=m.select("#"+e);br(x,Ll,Sl,Al.pie.useMaxWidth),_.setAttribute("viewBox","0 0 "+Sl+" "+Ll);var i=18,a=Math.min(Sl,Ll)/2-40,s=x.append("g").attr("transform","translate("+Sl/2+",225)"),c=r.db.getSections(),l=0;Object.keys(c).forEach((function(t){l+=c[t]}));const v=Al.themeVariables;var h=[v.pie1,v.pie2,v.pie3,v.pie4,v.pie5,v.pie6,v.pie7,v.pie8,v.pie9,v.pie10,v.pie11,v.pie12],u=(0,o.PKp)().range(h),d=Object.entries(c).map((function(t,e){return{order:e,name:t[0],value:t[1]}})),p=(0,o.ve8)().value((function(t){return t.value})).sort((function(t,e){return t.order-e.order}))(d),f=(0,o.Nb1)().innerRadius(0).outerRadius(a);s.selectAll("mySlices").data(p).enter().append("path").attr("d",f).attr("fill",(function(t){return u(t.data.name)})).attr("class","pieCircle"),s.selectAll("mySlices").data(p).enter().append("text").text((function(t){return(t.data.value/l*100).toFixed(0)+"%"})).attr("transform",(function(t){return"translate("+f.centroid(t)+")"})).style("text-anchor","middle").attr("class","slice"),s.append("text").text(r.db.getDiagramTitle()).attr("x",0).attr("y",-200).attr("class","pieTitleText");var g=s.selectAll(".legend").data(u.domain()).enter().append("g").attr("class","legend").attr("transform",(function(t,e){return"translate(216,"+(22*e-22*u.domain().length/2)+")"}));g.append("rect").attr("width",i).attr("height",i).style("fill",u).style("stroke",u),g.data(p).append("text").attr("x",22).attr("y",14).text((function(t){return r.db.getShowData()||Al.showData||Al.pie.showData?t.data.name+" ["+t.data.value+"]":t.data.name}))}catch(y){Bt.error("Error while rendering info diagram"),Bt.error(y)}}};var Nl=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,3],r=[1,5],i=[1,6],a=[1,7],s=[1,8],o=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],c=[1,22],l=[2,13],h=[1,26],u=[1,27],d=[1,28],p=[1,29],f=[1,30],g=[1,31],y=[1,24],m=[1,32],b=[1,33],_=[1,36],x=[71,72],v=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],k=[1,56],w=[1,57],C=[1,58],E=[1,59],T=[1,60],S=[1,61],A=[1,62],L=[62,63],B=[1,74],N=[1,70],D=[1,71],O=[1,72],M=[1,73],I=[1,75],F=[1,79],$=[1,80],R=[1,77],Z=[1,78],P=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72],j={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,openDirective:9,typeDirective:10,closeDirective:11,":":12,argDirective:13,acc_title:14,acc_title_value:15,acc_descr:16,acc_descr_value:17,acc_descr_multiline_value:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,requirementDef:23,elementDef:24,relationshipDef:25,requirementType:26,requirementName:27,STRUCT_START:28,requirementBody:29,ID:30,COLONSEP:31,id:32,TEXT:33,text:34,RISK:35,riskLevel:36,VERIFYMTHD:37,verifyType:38,STRUCT_STOP:39,REQUIREMENT:40,FUNCTIONAL_REQUIREMENT:41,INTERFACE_REQUIREMENT:42,PERFORMANCE_REQUIREMENT:43,PHYSICAL_REQUIREMENT:44,DESIGN_CONSTRAINT:45,LOW_RISK:46,MED_RISK:47,HIGH_RISK:48,VERIFY_ANALYSIS:49,VERIFY_DEMONSTRATION:50,VERIFY_INSPECTION:51,VERIFY_TEST:52,ELEMENT:53,elementName:54,elementBody:55,TYPE:56,type:57,DOCREF:58,ref:59,END_ARROW_L:60,relationship:61,LINE:62,END_ARROW_R:63,CONTAINS:64,COPIES:65,DERIVES:66,SATISFIES:67,VERIFIES:68,REFINES:69,TRACES:70,unqString:71,qString:72,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"acc_title",15:"acc_title_value",16:"acc_descr",17:"acc_descr_value",18:"acc_descr_multiline_value",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",28:"STRUCT_START",30:"ID",31:"COLONSEP",33:"TEXT",35:"RISK",37:"VERIFYMTHD",39:"STRUCT_STOP",40:"REQUIREMENT",41:"FUNCTIONAL_REQUIREMENT",42:"INTERFACE_REQUIREMENT",43:"PERFORMANCE_REQUIREMENT",44:"PHYSICAL_REQUIREMENT",45:"DESIGN_CONSTRAINT",46:"LOW_RISK",47:"MED_RISK",48:"HIGH_RISK",49:"VERIFY_ANALYSIS",50:"VERIFY_DEMONSTRATION",51:"VERIFY_INSPECTION",52:"VERIFY_TEST",53:"ELEMENT",56:"TYPE",58:"DOCREF",60:"END_ARROW_L",62:"LINE",63:"END_ARROW_R",64:"CONTAINS",65:"COPIES",66:"DERIVES",67:"SATISFIES",68:"VERIFIES",69:"REFINES",70:"TRACES",71:"unqString",72:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 6:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 7:case 8:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 9:r.parseDirective("%%{","open_directive");break;case 10:r.parseDirective(a[o],"type_directive");break;case 11:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 12:r.parseDirective("}%%","close_directive","pie");break;case 13:this.$=[];break;case 19:r.addRequirement(a[o-3],a[o-4]);break;case 20:r.setNewReqId(a[o-2]);break;case 21:r.setNewReqText(a[o-2]);break;case 22:r.setNewReqRisk(a[o-2]);break;case 23:r.setNewReqVerifyMethod(a[o-2]);break;case 26:this.$=r.RequirementType.REQUIREMENT;break;case 27:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 28:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 29:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 30:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 32:this.$=r.RiskLevel.LOW_RISK;break;case 33:this.$=r.RiskLevel.MED_RISK;break;case 34:this.$=r.RiskLevel.HIGH_RISK;break;case 35:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 36:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 37:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 38:this.$=r.VerifyType.VERIFY_TEST;break;case 39:r.addElement(a[o-3]);break;case 40:r.setNewElementType(a[o-2]);break;case 41:r.setNewElementDocRef(a[o-2]);break;case 44:r.addRelationship(a[o-2],a[o],a[o-4]);break;case 45:r.addRelationship(a[o-2],a[o-4],a[o]);break;case 46:this.$=r.Relationships.CONTAINS;break;case 47:this.$=r.Relationships.COPIES;break;case 48:this.$=r.Relationships.DERIVES;break;case 49:this.$=r.Relationships.SATISFIES;break;case 50:this.$=r.Relationships.VERIFIES;break;case 51:this.$=r.Relationships.REFINES;break;case 52:this.$=r.Relationships.TRACES}},table:[{3:1,4:2,6:n,9:4,14:r,16:i,18:a,19:s},{1:[3]},{3:10,4:2,5:[1,9],6:n,9:4,14:r,16:i,18:a,19:s},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},e(o,[2,8]),{20:[2,9]},{3:16,4:2,6:n,9:4,14:r,16:i,18:a,19:s},{1:[2,2]},{4:21,5:c,7:17,8:l,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:h,41:u,42:d,43:p,44:f,45:g,53:y,71:m,72:b},{11:34,12:[1,35],22:_},e([12,22],[2,10]),e(o,[2,6]),e(o,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:c,7:38,8:l,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:h,41:u,42:d,43:p,44:f,45:g,53:y,71:m,72:b},{4:21,5:c,7:39,8:l,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:h,41:u,42:d,43:p,44:f,45:g,53:y,71:m,72:b},{4:21,5:c,7:40,8:l,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:h,41:u,42:d,43:p,44:f,45:g,53:y,71:m,72:b},{4:21,5:c,7:41,8:l,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:h,41:u,42:d,43:p,44:f,45:g,53:y,71:m,72:b},{4:21,5:c,7:42,8:l,9:4,14:r,16:i,18:a,19:s,23:18,24:19,25:20,26:23,32:25,40:h,41:u,42:d,43:p,44:f,45:g,53:y,71:m,72:b},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},e(x,[2,26]),e(x,[2,27]),e(x,[2,28]),e(x,[2,29]),e(x,[2,30]),e(x,[2,31]),e(v,[2,55]),e(v,[2,56]),e(o,[2,4]),{13:51,21:[1,52]},e(o,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:k,65:w,66:C,67:E,68:T,69:S,70:A},{61:63,64:k,65:w,66:C,67:E,68:T,69:S,70:A},{11:64,22:_},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},e(L,[2,46]),e(L,[2,47]),e(L,[2,48]),e(L,[2,49]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),{63:[1,68]},e(o,[2,5]),{5:B,29:69,30:N,33:D,35:O,37:M,39:I},{5:F,39:$,55:76,56:R,58:Z},{32:81,71:m,72:b},{32:82,71:m,72:b},e(P,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:B,29:87,30:N,33:D,35:O,37:M,39:I},e(P,[2,25]),e(P,[2,39]),{31:[1,88]},{31:[1,89]},{5:F,39:$,55:90,56:R,58:Z},e(P,[2,43]),e(P,[2,44]),e(P,[2,45]),{32:91,71:m,72:b},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},e(P,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},e(P,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:B,29:116,30:N,33:D,35:O,37:M,39:I},{5:B,29:117,30:N,33:D,35:O,37:M,39:I},{5:B,29:118,30:N,33:D,35:O,37:M,39:I},{5:B,29:119,30:N,33:D,35:O,37:M,39:I},{5:F,39:$,55:120,56:R,58:Z},{5:F,39:$,55:121,56:R,58:Z},e(P,[2,20]),e(P,[2,21]),e(P,[2,22]),e(P,[2,23]),e(P,[2,40]),e(P,[2,41])],defaultActions:{8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},Y=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),19;case 1:return this.begin("type_directive"),20;case 2:return this.popState(),this.begin("arg_directive"),12;case 3:return this.popState(),this.popState(),22;case 4:return 21;case 5:return"title";case 6:return this.begin("acc_title"),14;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),16;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 53:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 5;case 14:case 15:case 16:break;case 17:return 8;case 18:return 6;case 19:return 28;case 20:return 39;case 21:return 31;case 22:return 30;case 23:return 33;case 24:return 35;case 25:return 37;case 26:return 40;case 27:return 41;case 28:return 42;case 29:return 43;case 30:return 44;case 31:return 45;case 32:return 46;case 33:return 47;case 34:return 48;case 35:return 49;case 36:return 50;case 37:return 51;case 38:return 52;case 39:return 53;case 40:return 64;case 41:return 65;case 42:return 66;case 43:return 67;case 44:return 68;case 45:return 69;case 46:return 70;case 47:return 56;case 48:return 58;case 49:return 60;case 50:return 63;case 51:return 62;case 52:this.begin("string");break;case 54:return"qString";case 55:return e.yytext=e.yytext.trim(),71}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[53,54],inclusive:!1},INITIAL:{rules:[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],inclusive:!0}}},t);function z(){this.yy={}}return j.lexer=Y,z.prototype=j,j.Parser=z,new z}();Nl.parser=Nl;const Dl=Nl,Ol=t=>null!==t.match(/^\s*requirement(Diagram)?/);let Ml=[],Il={},Fl={},$l={},Rl={};const Zl={RequirementType:{REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},RiskLevel:{LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},VerifyType:{VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},Relationships:{CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().req,addRequirement:(t,e)=>(void 0===Fl[t]&&(Fl[t]={name:t,type:e,id:Il.id,text:Il.text,risk:Il.risk,verifyMethod:Il.verifyMethod}),Il={},Fl[t]),getRequirements:()=>Fl,setNewReqId:t=>{void 0!==Il&&(Il.id=t)},setNewReqText:t=>{void 0!==Il&&(Il.text=t)},setNewReqRisk:t=>{void 0!==Il&&(Il.risk=t)},setNewReqVerifyMethod:t=>{void 0!==Il&&(Il.verifyMethod=t)},setAccTitle:Zr,getAccTitle:Pr,setAccDescription:jr,getAccDescription:Yr,addElement:t=>(void 0===Rl[t]&&(Rl[t]={name:t,type:$l.type,docRef:$l.docRef},Bt.info("Added new requirement: ",t)),$l={},Rl[t]),getElements:()=>Rl,setNewElementType:t=>{void 0!==$l&&($l.type=t)},setNewElementDocRef:t=>{void 0!==$l&&($l.docRef=t)},addRelationship:(t,e,n)=>{Ml.push({type:t,src:e,dst:n})},getRelationships:()=>Ml,clear:()=>{Ml=[],Il={},Fl={},$l={},Rl={},Rr()}},Pl={CONTAINS:"contains",ARROW:"arrow"},jl=Pl,Yl=(t,e)=>{let n=t.append("defs").append("marker").attr("id",Pl.CONTAINS+"_line_ending").attr("refX",0).attr("refY",e.line_height/2).attr("markerWidth",e.line_height).attr("markerHeight",e.line_height).attr("orient","auto").append("g");n.append("circle").attr("cx",e.line_height/2).attr("cy",e.line_height/2).attr("r",e.line_height/2).attr("fill","none"),n.append("line").attr("x1",0).attr("x2",e.line_height).attr("y1",e.line_height/2).attr("y2",e.line_height/2).attr("stroke-width",1),n.append("line").attr("y1",0).attr("y2",e.line_height).attr("x1",e.line_height/2).attr("x2",e.line_height/2).attr("stroke-width",1),t.append("defs").append("marker").attr("id",Pl.ARROW+"_line_ending").attr("refX",e.line_height).attr("refY",.5*e.line_height).attr("markerWidth",e.line_height).attr("markerHeight",e.line_height).attr("orient","auto").append("path").attr("d",`M0,0\n L${e.line_height},${e.line_height/2}\n M${e.line_height},${e.line_height/2}\n L0,${e.line_height}`).attr("stroke-width",1)};let zl={},Ul=0;const Wl=(t,e)=>t.insert("rect","#"+e).attr("class","req reqBox").attr("x",0).attr("y",0).attr("width",zl.rect_min_width+"px").attr("height",zl.rect_min_height+"px"),Hl=(t,e,n)=>{let r=zl.rect_min_width/2,i=t.append("text").attr("class","req reqLabel reqTitle").attr("id",e).attr("x",r).attr("y",zl.rect_padding).attr("dominant-baseline","hanging"),a=0;n.forEach((t=>{0==a?i.append("tspan").attr("text-anchor","middle").attr("x",zl.rect_min_width/2).attr("dy",0).text(t):i.append("tspan").attr("text-anchor","middle").attr("x",zl.rect_min_width/2).attr("dy",.75*zl.line_height).text(t),a++}));let s=1.5*zl.rect_padding+a*zl.line_height*.75;return t.append("line").attr("class","req-title-line").attr("x1","0").attr("x2",zl.rect_min_width).attr("y1",s).attr("y2",s),{titleNode:i,y:s}},ql=(t,e,n,r)=>{let i=t.append("text").attr("class","req reqLabel").attr("id",e).attr("x",zl.rect_padding).attr("y",r).attr("dominant-baseline","hanging"),a=0;let s=[];return n.forEach((t=>{let e=t.length;for(;e>30&&a<3;){let n=t.substring(0,30);e=(t=t.substring(30,t.length)).length,s[s.length]=n,a++}if(3==a){let t=s[s.length-1];s[s.length-1]=t.substring(0,t.length-4)+"..."}else s[s.length]=t;a=0})),s.forEach((t=>{i.append("tspan").attr("x",zl.rect_padding).attr("dy",zl.line_height).text(t)})),i},Vl=function(t,e,n,r,i){const a=n.edge(Gl(e.src),Gl(e.dst)),s=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})),c=t.insert("path","#"+r).attr("class","er relationshipLine").attr("d",s(a.points)).attr("fill","none");e.type==i.db.Relationships.CONTAINS?c.attr("marker-start","url("+jt.getUrl(zl.arrowMarkerAbsolute)+"#"+e.type+"_line_ending)"):(c.attr("stroke-dasharray","10,7"),c.attr("marker-end","url("+jt.getUrl(zl.arrowMarkerAbsolute)+"#"+jl.ARROW+"_line_ending)")),((t,e,n,r)=>{const i=e.node().getTotalLength(),a=e.node().getPointAtLength(.5*i),s="rel"+Ul;Ul++;const o=t.append("text").attr("class","req relationshipLabel").attr("id",s).attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","middle").text(r).node().getBBox();t.insert("rect","#"+s).attr("class","req reqLabelBox").attr("x",a.x-o.width/2).attr("y",a.y-o.height/2).attr("width",o.width).attr("height",o.height).attr("fill","white").attr("fill-opacity","85%")})(t,c,0,`<<${e.type}>>`)},Gl=t=>t.replace(/\s/g,"").replace(/\./g,"_"),Xl={draw:(t,e,n,r)=>{zl=ur().requirement,r.db.clear(),r.parser.parse(t);const i=zl.securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s=("sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body")).select(`[id='${e}']`);Yl(s,zl);const c=new lt.k({multigraph:!1,compound:!1,directed:!0}).setGraph({rankdir:zl.layoutDirection,marginx:20,marginy:20,nodesep:100,edgesep:100,ranksep:100}).setDefaultEdgeLabel((function(){return{}}));let l=r.db.getRequirements(),h=r.db.getElements(),u=r.db.getRelationships();var d,p,f;d=l,p=c,f=s,Object.keys(d).forEach((t=>{let e=d[t];t=Gl(t),Bt.info("Added new requirement: ",t);const n=f.append("g").attr("id",t),r=Wl(n,"req-"+t);let i=Hl(n,t+"_title",[`<<${e.type}>>`,`${e.name}`]);ql(n,t+"_body",[`Id: ${e.id}`,`Text: ${e.text}`,`Risk: ${e.risk}`,`Verification: ${e.verifyMethod}`],i.y);const a=r.node().getBBox();p.setNode(t,{width:a.width,height:a.height,shape:"rect",id:t})})),((t,e,n)=>{Object.keys(t).forEach((r=>{let i=t[r];const a=Gl(r),s=n.append("g").attr("id",a),o="element-"+a,c=Wl(s,o);let l=Hl(s,o+"_title",["<<Element>>",`${r}`]);ql(s,o+"_body",[`Type: ${i.type||"Not Specified"}`,`Doc Ref: ${i.docRef||"None"}`],l.y);const h=c.node().getBBox();e.setNode(a,{width:h.width,height:h.height,shape:"rect",id:a})}))})(h,c,s),((t,e)=>{t.forEach((function(t){let n=Gl(t.src),r=Gl(t.dst);e.setEdge(n,r,{relationship:t})}))})(u,c),(0,ct.bK)(c),function(t,e){e.nodes().forEach((function(n){void 0!==n&&void 0!==e.node(n)&&(t.select("#"+n),t.select("#"+n).attr("transform","translate("+(e.node(n).x-e.node(n).width/2)+","+(e.node(n).y-e.node(n).height/2)+" )"))}))}(s,c),u.forEach((function(t){Vl(s,t,c,e,r)}));const g=zl.rect_padding,y=s.node().getBBox(),m=y.width+2*g,b=y.height+2*g;br(s,b,m,zl.useMaxWidth),s.attr("viewBox",`${y.x-g} ${y.y-g} ${m} ${b}`)}};var Ql=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,3],i=[1,5],a=[1,7],s=[2,5],o=[1,15],c=[1,17],l=[1,19],h=[1,21],u=[1,22],d=[1,23],p=[1,29],f=[1,30],g=[1,31],y=[1,32],m=[1,33],b=[1,34],_=[1,35],x=[1,36],v=[1,37],k=[1,38],w=[1,39],C=[1,40],E=[1,42],T=[1,43],S=[1,45],A=[1,46],L=[1,47],B=[1,48],N=[1,49],D=[1,50],O=[1,53],M=[1,4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,51,52,53,54,56,57,62,63,64,65,73,83],I=[4,5,21,54,56],F=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,54,56,57,62,63,64,65,73,83],$=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,53,54,56,57,62,63,64,65,73,83],R=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,52,54,56,57,62,63,64,65,73,83],Z=[4,5,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,51,54,56,57,62,63,64,65,73,83],P=[71,72,73],j=[1,125],Y=[1,4,5,7,19,21,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,51,52,53,54,56,57,62,63,64,65,73,83],z={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,directive:6,SD:7,document:8,line:9,statement:10,box_section:11,box_line:12,participant_statement:13,openDirective:14,typeDirective:15,closeDirective:16,":":17,argDirective:18,box:19,restOfLine:20,end:21,signal:22,autonumber:23,NUM:24,off:25,activate:26,actor:27,deactivate:28,note_statement:29,links_statement:30,link_statement:31,properties_statement:32,details_statement:33,title:34,legacy_title:35,acc_title:36,acc_title_value:37,acc_descr:38,acc_descr_value:39,acc_descr_multiline_value:40,loop:41,rect:42,opt:43,alt:44,else_sections:45,par:46,par_sections:47,critical:48,option_sections:49,break:50,option:51,and:52,else:53,participant:54,AS:55,participant_actor:56,note:57,placement:58,text2:59,over:60,actor_pair:61,links:62,link:63,properties:64,details:65,spaceList:66,",":67,left_of:68,right_of:69,signaltype:70,"+":71,"-":72,ACTOR:73,SOLID_OPEN_ARROW:74,DOTTED_OPEN_ARROW:75,SOLID_ARROW:76,DOTTED_ARROW:77,SOLID_CROSS:78,DOTTED_CROSS:79,SOLID_POINT:80,DOTTED_POINT:81,TXT:82,open_directive:83,type_directive:84,arg_directive:85,close_directive:86,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",7:"SD",17:":",19:"box",20:"restOfLine",21:"end",23:"autonumber",24:"NUM",25:"off",26:"activate",28:"deactivate",34:"title",35:"legacy_title",36:"acc_title",37:"acc_title_value",38:"acc_descr",39:"acc_descr_value",40:"acc_descr_multiline_value",41:"loop",42:"rect",43:"opt",44:"alt",46:"par",48:"critical",50:"break",51:"option",52:"and",53:"else",54:"participant",55:"AS",56:"participant_actor",57:"note",60:"over",62:"links",63:"link",64:"properties",65:"details",67:",",68:"left_of",69:"right_of",71:"+",72:"-",73:"ACTOR",74:"SOLID_OPEN_ARROW",75:"DOTTED_OPEN_ARROW",76:"SOLID_ARROW",77:"DOTTED_ARROW",78:"SOLID_CROSS",79:"DOTTED_CROSS",80:"SOLID_POINT",81:"DOTTED_POINT",82:"TXT",83:"open_directive",84:"type_directive",85:"arg_directive",86:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[11,0],[11,2],[12,2],[12,1],[12,1],[6,4],[6,6],[10,1],[10,4],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[49,1],[49,4],[47,1],[47,4],[45,1],[45,4],[13,5],[13,3],[13,5],[13,3],[29,4],[29,4],[30,3],[31,3],[32,3],[33,3],[66,2],[66,1],[61,3],[61,1],[58,1],[58,1],[22,5],[22,5],[22,4],[27,1],[70,1],[70,1],[70,1],[70,1],[70,1],[70,1],[70,1],[70,1],[59,1],[14,1],[15,1],[18,1],[16,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:return r.apply(a[o]),a[o];case 5:case 10:case 9:case 14:this.$=[];break;case 6:case 11:a[o-1].push(a[o]),this.$=a[o-1];break;case 7:case 8:case 12:case 13:case 63:this.$=a[o];break;case 18:a[o-1].unshift({type:"boxStart",boxData:r.parseBoxData(a[o-2])}),a[o-1].push({type:"boxEnd",boxText:a[o-2]}),this.$=a[o-1];break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(a[o-2]),sequenceIndexStep:Number(a[o-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceIndex:Number(a[o-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 24:this.$={type:"activeStart",signalType:r.LINETYPE.ACTIVE_START,actor:a[o-1]};break;case 25:this.$={type:"activeEnd",signalType:r.LINETYPE.ACTIVE_END,actor:a[o-1]};break;case 31:r.setDiagramTitle(a[o].substring(6)),this.$=a[o].substring(6);break;case 32:r.setDiagramTitle(a[o].substring(7)),this.$=a[o].substring(7);break;case 33:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 34:case 35:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 36:a[o-1].unshift({type:"loopStart",loopText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.LOOP_START}),a[o-1].push({type:"loopEnd",loopText:a[o-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[o-1];break;case 37:a[o-1].unshift({type:"rectStart",color:r.parseMessage(a[o-2]),signalType:r.LINETYPE.RECT_START}),a[o-1].push({type:"rectEnd",color:r.parseMessage(a[o-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[o-1];break;case 38:a[o-1].unshift({type:"optStart",optText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.OPT_START}),a[o-1].push({type:"optEnd",optText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[o-1];break;case 39:a[o-1].unshift({type:"altStart",altText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.ALT_START}),a[o-1].push({type:"altEnd",signalType:r.LINETYPE.ALT_END}),this.$=a[o-1];break;case 40:a[o-1].unshift({type:"parStart",parText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.PAR_START}),a[o-1].push({type:"parEnd",signalType:r.LINETYPE.PAR_END}),this.$=a[o-1];break;case 41:a[o-1].unshift({type:"criticalStart",criticalText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.CRITICAL_START}),a[o-1].push({type:"criticalEnd",signalType:r.LINETYPE.CRITICAL_END}),this.$=a[o-1];break;case 42:a[o-1].unshift({type:"breakStart",breakText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.BREAK_START}),a[o-1].push({type:"breakEnd",optText:r.parseMessage(a[o-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[o-1];break;case 45:this.$=a[o-3].concat([{type:"option",optionText:r.parseMessage(a[o-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[o]]);break;case 47:this.$=a[o-3].concat([{type:"and",parText:r.parseMessage(a[o-1]),signalType:r.LINETYPE.PAR_AND},a[o]]);break;case 49:this.$=a[o-3].concat([{type:"else",altText:r.parseMessage(a[o-1]),signalType:r.LINETYPE.ALT_ELSE},a[o]]);break;case 50:a[o-3].type="addParticipant",a[o-3].description=r.parseMessage(a[o-1]),this.$=a[o-3];break;case 51:a[o-1].type="addParticipant",this.$=a[o-1];break;case 52:a[o-3].type="addActor",a[o-3].description=r.parseMessage(a[o-1]),this.$=a[o-3];break;case 53:a[o-1].type="addActor",this.$=a[o-1];break;case 54:this.$=[a[o-1],{type:"addNote",placement:a[o-2],actor:a[o-1].actor,text:a[o]}];break;case 55:a[o-2]=[].concat(a[o-1],a[o-1]).slice(0,2),a[o-2][0]=a[o-2][0].actor,a[o-2][1]=a[o-2][1].actor,this.$=[a[o-1],{type:"addNote",placement:r.PLACEMENT.OVER,actor:a[o-2].slice(0,2),text:a[o]}];break;case 56:this.$=[a[o-1],{type:"addLinks",actor:a[o-1].actor,text:a[o]}];break;case 57:this.$=[a[o-1],{type:"addALink",actor:a[o-1].actor,text:a[o]}];break;case 58:this.$=[a[o-1],{type:"addProperties",actor:a[o-1].actor,text:a[o]}];break;case 59:this.$=[a[o-1],{type:"addDetails",actor:a[o-1].actor,text:a[o]}];break;case 62:this.$=[a[o-2],a[o]];break;case 64:this.$=r.PLACEMENT.LEFTOF;break;case 65:this.$=r.PLACEMENT.RIGHTOF;break;case 66:this.$=[a[o-4],a[o-1],{type:"addMessage",from:a[o-4].actor,to:a[o-1].actor,signalType:a[o-3],msg:a[o]},{type:"activeStart",signalType:r.LINETYPE.ACTIVE_START,actor:a[o-1]}];break;case 67:this.$=[a[o-4],a[o-1],{type:"addMessage",from:a[o-4].actor,to:a[o-1].actor,signalType:a[o-3],msg:a[o]},{type:"activeEnd",signalType:r.LINETYPE.ACTIVE_END,actor:a[o-4]}];break;case 68:this.$=[a[o-3],a[o-1],{type:"addMessage",from:a[o-3].actor,to:a[o-1].actor,signalType:a[o-2],msg:a[o]}];break;case 69:this.$={type:"addParticipant",actor:a[o]};break;case 70:this.$=r.LINETYPE.SOLID_OPEN;break;case 71:this.$=r.LINETYPE.DOTTED_OPEN;break;case 72:this.$=r.LINETYPE.SOLID;break;case 73:this.$=r.LINETYPE.DOTTED;break;case 74:this.$=r.LINETYPE.SOLID_CROSS;break;case 75:this.$=r.LINETYPE.DOTTED_CROSS;break;case 76:this.$=r.LINETYPE.SOLID_POINT;break;case 77:this.$=r.LINETYPE.DOTTED_POINT;break;case 78:this.$=r.parseMessage(a[o].trim().substring(1));break;case 79:r.parseDirective("%%{","open_directive");break;case 80:r.parseDirective(a[o],"type_directive");break;case 81:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 82:r.parseDirective("}%%","close_directive","sequence")}},table:[{3:1,4:n,5:r,6:4,7:i,14:6,83:a},{1:[3]},{3:8,4:n,5:r,6:4,7:i,14:6,83:a},{3:9,4:n,5:r,6:4,7:i,14:6,83:a},{3:10,4:n,5:r,6:4,7:i,14:6,83:a},e([1,4,5,19,23,26,28,34,35,36,38,40,41,42,43,44,46,48,50,54,56,57,62,63,64,65,73,83],s,{8:11}),{15:12,84:[1,13]},{84:[2,79]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{16:51,17:[1,52],86:O},e([17,86],[2,80]),e(M,[2,6]),{6:41,10:54,13:18,14:6,19:l,22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},e(M,[2,8]),e(M,[2,9]),e(M,[2,17]),{20:[1,55]},{5:[1,56]},{5:[1,59],24:[1,57],25:[1,58]},{27:60,73:D},{27:61,73:D},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},{5:[1,66]},e(M,[2,31]),e(M,[2,32]),{37:[1,67]},{39:[1,68]},e(M,[2,35]),{20:[1,69]},{20:[1,70]},{20:[1,71]},{20:[1,72]},{20:[1,73]},{20:[1,74]},{20:[1,75]},e(M,[2,43]),{27:76,73:D},{27:77,73:D},{70:78,74:[1,79],75:[1,80],76:[1,81],77:[1,82],78:[1,83],79:[1,84],80:[1,85],81:[1,86]},{58:87,60:[1,88],68:[1,89],69:[1,90]},{27:91,73:D},{27:92,73:D},{27:93,73:D},{27:94,73:D},e([5,55,67,74,75,76,77,78,79,80,81,82],[2,69]),{5:[1,95]},{18:96,85:[1,97]},{5:[2,82]},e(M,[2,7]),e(I,[2,10],{11:98}),e(M,[2,19]),{5:[1,100],24:[1,99]},{5:[1,101]},e(M,[2,23]),{5:[1,102]},{5:[1,103]},e(M,[2,26]),e(M,[2,27]),e(M,[2,28]),e(M,[2,29]),e(M,[2,30]),e(M,[2,33]),e(M,[2,34]),e(F,s,{8:104}),e(F,s,{8:105}),e(F,s,{8:106}),e($,s,{45:107,8:108}),e(R,s,{47:109,8:110}),e(Z,s,{49:111,8:112}),e(F,s,{8:113}),{5:[1,115],55:[1,114]},{5:[1,117],55:[1,116]},{27:120,71:[1,118],72:[1,119],73:D},e(P,[2,70]),e(P,[2,71]),e(P,[2,72]),e(P,[2,73]),e(P,[2,74]),e(P,[2,75]),e(P,[2,76]),e(P,[2,77]),{27:121,73:D},{27:123,61:122,73:D},{73:[2,64]},{73:[2,65]},{59:124,82:j},{59:126,82:j},{59:127,82:j},{59:128,82:j},e(Y,[2,15]),{16:129,86:O},{86:[2,81]},{4:[1,132],5:[1,134],12:131,13:133,21:[1,130],54:E,56:T},{5:[1,135]},e(M,[2,21]),e(M,[2,22]),e(M,[2,24]),e(M,[2,25]),{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[1,136],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[1,137],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[1,138],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{21:[1,139]},{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[2,48],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,53:[1,140],54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{21:[1,141]},{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[2,46],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,52:[1,142],54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{21:[1,143]},{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[2,44],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,51:[1,144],54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{4:o,5:c,6:41,9:14,10:16,13:18,14:6,19:l,21:[1,145],22:20,23:h,26:u,27:44,28:d,29:24,30:25,31:26,32:27,33:28,34:p,35:f,36:g,38:y,40:m,41:b,42:_,43:x,44:v,46:k,48:w,50:C,54:E,56:T,57:S,62:A,63:L,64:B,65:N,73:D,83:a},{20:[1,146]},e(M,[2,51]),{20:[1,147]},e(M,[2,53]),{27:148,73:D},{27:149,73:D},{59:150,82:j},{59:151,82:j},{59:152,82:j},{67:[1,153],82:[2,63]},{5:[2,56]},{5:[2,78]},{5:[2,57]},{5:[2,58]},{5:[2,59]},{5:[1,154]},e(M,[2,18]),e(I,[2,11]),{13:155,54:E,56:T},e(I,[2,13]),e(I,[2,14]),e(M,[2,20]),e(M,[2,36]),e(M,[2,37]),e(M,[2,38]),e(M,[2,39]),{20:[1,156]},e(M,[2,40]),{20:[1,157]},e(M,[2,41]),{20:[1,158]},e(M,[2,42]),{5:[1,159]},{5:[1,160]},{59:161,82:j},{59:162,82:j},{5:[2,68]},{5:[2,54]},{5:[2,55]},{27:163,73:D},e(Y,[2,16]),e(I,[2,12]),e($,s,{8:108,45:164}),e(R,s,{8:110,47:165}),e(Z,s,{8:112,49:166}),e(M,[2,50]),e(M,[2,52]),{5:[2,66]},{5:[2,67]},{82:[2,62]},{21:[2,49]},{21:[2,47]},{21:[2,45]}],defaultActions:{7:[2,79],8:[2,1],9:[2,2],10:[2,3],53:[2,82],89:[2,64],90:[2,65],97:[2,81],124:[2,56],125:[2,78],126:[2,57],127:[2,58],128:[2,59],150:[2,68],151:[2,54],152:[2,55],161:[2,66],162:[2,67],163:[2,62],164:[2,49],165:[2,47],166:[2,45]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},U=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),83;case 1:return this.begin("type_directive"),84;case 2:return this.popState(),this.begin("arg_directive"),17;case 3:return this.popState(),this.popState(),86;case 4:return 85;case 5:case 53:case 66:return 5;case 6:case 7:case 8:case 9:case 10:break;case 11:return 24;case 12:return this.begin("LINE"),19;case 13:return this.begin("ID"),54;case 14:return this.begin("ID"),56;case 15:return e.yytext=e.yytext.trim(),this.begin("ALIAS"),73;case 16:return this.popState(),this.popState(),this.begin("LINE"),55;case 17:return this.popState(),this.popState(),5;case 18:return this.begin("LINE"),41;case 19:return this.begin("LINE"),42;case 20:return this.begin("LINE"),43;case 21:return this.begin("LINE"),44;case 22:return this.begin("LINE"),53;case 23:return this.begin("LINE"),46;case 24:return this.begin("LINE"),52;case 25:return this.begin("LINE"),48;case 26:return this.begin("LINE"),51;case 27:return this.begin("LINE"),50;case 28:return this.popState(),20;case 29:return 21;case 30:return 68;case 31:return 69;case 32:return 62;case 33:return 63;case 34:return 64;case 35:return 65;case 36:return 60;case 37:return 57;case 38:return this.begin("ID"),26;case 39:return this.begin("ID"),28;case 40:return 34;case 41:return 35;case 42:return this.begin("acc_title"),36;case 43:return this.popState(),"acc_title_value";case 44:return this.begin("acc_descr"),38;case 45:return this.popState(),"acc_descr_value";case 46:this.begin("acc_descr_multiline");break;case 47:this.popState();break;case 48:return"acc_descr_multiline_value";case 49:return 7;case 50:return 23;case 51:return 25;case 52:return 67;case 54:return e.yytext=e.yytext.trim(),73;case 55:return 76;case 56:return 77;case 57:return 74;case 58:return 75;case 59:return 78;case 60:return 79;case 61:return 80;case 62:return 81;case 63:return 82;case 64:return 71;case 65:return 72;case 67:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:[^\->:\n,;]+?([\-]*[^\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[47,48],inclusive:!1},acc_descr:{rules:[45],inclusive:!1},acc_title:{rules:[43],inclusive:!1},open_directive:{rules:[1,8],inclusive:!1},type_directive:{rules:[2,3,8],inclusive:!1},arg_directive:{rules:[3,4,8],inclusive:!1},ID:{rules:[7,8,15],inclusive:!1},ALIAS:{rules:[7,8,16,17],inclusive:!1},LINE:{rules:[7,8,28],inclusive:!1},INITIAL:{rules:[0,5,6,8,9,10,11,12,13,14,18,19,20,21,22,23,24,25,26,27,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,46,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],inclusive:!0}}},t);function W(){this.yy={}}return z.lexer=U,W.prototype=z,z.Parser=W,new W}();Ql.parser=Ql;const Kl=Ql,Jl=t=>null!==t.match(/^\s*sequenceDiagram/);let th,eh,nh,rh={},ih=[],ah=[],sh=!1;const oh=function(t,e,n,r){let i=nh;const a=rh[t];if(a){if(nh&&a.box&&nh!==a.box)throw new Error("A same participant should only be defined in one Box: "+a.name+" can't be in '"+a.box.name+"' and in '"+nh.name+"' at the same time.");if(i=a.box?a.box:nh,a.box=i,a&&e===a.name&&null==n)return}null!=n&&null!=n.text||(n={text:e,wrap:null,type:r}),null!=r&&null!=n.text||(n={text:e,wrap:null,type:r}),rh[t]={box:i,name:e,description:n.text,wrap:void 0===n.wrap&&hh()||!!n.wrap,prevActor:th,links:{},properties:{},actorCnt:null,rectData:null,type:r||"participant"},th&&rh[th]&&(rh[th].nextActor=t),nh&&nh.actorKeys.push(t),th=t},ch=function(t,e,n={text:void 0,wrap:void 0},r){if(r===uh.ACTIVE_END){const e=(t=>{let e,n=0;for(e=0;e<ah.length;e++)ah[e].type===uh.ACTIVE_START&&ah[e].from.actor===t&&n++,ah[e].type===uh.ACTIVE_END&&ah[e].from.actor===t&&n--;return n})(t.actor);if(e<1){let e=new Error("Trying to inactivate an inactive participant ("+t.actor+")");throw e.hash={text:"->>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},e}}return ah.push({from:t,to:e,message:n.text,wrap:void 0===n.wrap&&hh()||!!n.wrap,type:r}),!0},lh=function(t){return rh[t]},hh=()=>void 0!==eh?eh:ur().sequence.wrap,uh={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31},dh=function(t,e,n){n.text,void 0===n.wrap&&hh()||n.wrap;const r=[].concat(t,t);ah.push({from:r[0],to:r[1],message:n.text,wrap:void 0===n.wrap&&hh()||!!n.wrap,type:uh.NOTE,placement:e})},ph=function(t,e){const n=lh(t);try{let t=It(e.text,ur());t=t.replace(/&/g,"&"),t=t.replace(/=/g,"=");fh(n,JSON.parse(t))}catch(r){Bt.error("error while parsing actor link text",r)}};function fh(t,e){if(null==t.links)t.links=e;else for(let n in e)t.links[n]=e[n]}const gh=function(t,e){const n=lh(t);try{let t=It(e.text,ur());yh(n,JSON.parse(t))}catch(r){Bt.error("error while parsing actor properties text",r)}};function yh(t,e){if(null==t.properties)t.properties=e;else for(let n in e)t.properties[n]=e[n]}const mh=function(t,e){const n=lh(t),r=document.getElementById(e.text);try{const t=r.innerHTML,e=JSON.parse(t);e.properties&&yh(n,e.properties),e.links&&fh(n,e.links)}catch(i){Bt.error("error while parsing actor details text",i)}},bh=function(t){if(Array.isArray(t))t.forEach((function(t){bh(t)}));else switch(t.type){case"sequenceIndex":ah.push({from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":oh(t.actor,t.actor,t.description,"participant");break;case"addActor":oh(t.actor,t.actor,t.description,"actor");break;case"activeStart":case"activeEnd":ch(t.actor,void 0,void 0,t.signalType);break;case"addNote":dh(t.actor,t.placement,t.text);break;case"addLinks":ph(t.actor,t.text);break;case"addALink":!function(t,e){const n=lh(t);try{const t={};let s=It(e.text,ur());var r=s.indexOf("@");s=s.replace(/&/g,"&"),s=s.replace(/=/g,"=");var i=s.slice(0,r-1).trim(),a=s.slice(r+1).trim();t[i]=a,fh(n,t)}catch(s){Bt.error("error while parsing actor link text",s)}}(t.actor,t.text);break;case"addProperties":gh(t.actor,t.text);break;case"addDetails":mh(t.actor,t.text);break;case"addMessage":ch(t.from,t.to,t.msg,t.signalType);break;case"boxStart":e=t.boxData,ih.push({name:e.text,wrap:void 0===e.wrap&&hh()||!!e.wrap,fill:e.color,actorKeys:[]}),nh=ih.slice(-1)[0];break;case"boxEnd":nh=void 0;break;case"loopStart":ch(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":case"rectEnd":case"optEnd":case"altEnd":case"parEnd":case"criticalEnd":case"breakEnd":ch(void 0,void 0,void 0,t.signalType);break;case"rectStart":ch(void 0,void 0,t.color,t.signalType);break;case"optStart":ch(void 0,void 0,t.optText,t.signalType);break;case"altStart":case"else":ch(void 0,void 0,t.altText,t.signalType);break;case"setAccTitle":Zr(t.text);break;case"parStart":case"and":ch(void 0,void 0,t.parText,t.signalType);break;case"criticalStart":ch(void 0,void 0,t.criticalText,t.signalType);break;case"option":ch(void 0,void 0,t.optionText,t.signalType);break;case"breakStart":ch(void 0,void 0,t.breakText,t.signalType)}var e},_h={addActor:oh,addMessage:function(t,e,n,r){ah.push({from:t,to:e,message:n.text,wrap:void 0===n.wrap&&hh()||!!n.wrap,answer:r})},addSignal:ch,addLinks:ph,addDetails:mh,addProperties:gh,autoWrap:hh,setWrap:function(t){eh=t},enableSequenceNumbers:function(){sh=!0},disableSequenceNumbers:function(){sh=!1},showSequenceNumbers:()=>sh,getMessages:function(){return ah},getActors:function(){return rh},getActor:lh,getActorKeys:function(){return Object.keys(rh)},getActorProperty:function(t,e){if(void 0!==t&&void 0!==t.properties)return t.properties[e]},getAccTitle:Pr,getBoxes:function(){return ih},getDiagramTitle:Ur,setDiagramTitle:zr,parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().sequence,clear:function(){rh={},ih=[],ah=[],sh=!1,Rr()},parseMessage:function(t){const e=t.trim(),n={text:e.replace(/^:?(?:no)?wrap:/,"").trim(),wrap:null!==e.match(/^:?wrap:/)||null===e.match(/^:?nowrap:/)&&void 0};return Bt.debug("parseMessage:",n),n},parseBoxData:function(t){const e=t.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/);let n=null!=e&&e[1]?e[1].trim():"transparent",r=null!=e&&e[2]?e[2].trim():void 0;if(window&&window.CSS)window.CSS.supports("color",n)||(n="transparent",r=t.trim());else{const e=(new Option).style;e.color=n,e.color!==n&&(n="transparent",r=t.trim())}return{color:n,text:void 0!==r?It(r.replace(/^:?(?:no)?wrap:/,""),ur()):void 0,wrap:void 0!==r?null!==r.match(/^:?wrap:/)||null===r.match(/^:?nowrap:/)&&void 0:void 0}},LINETYPE:uh,ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},addNote:dh,setAccTitle:Zr,apply:bh,setAccDescription:jr,getAccDescription:Yr,hasAtLeastOneBox:function(){return ih.length>0},hasAtLeastOneBoxWithTitle:function(){return ih.some((t=>t.name))}};let xh=[];const vh=()=>{xh.forEach((t=>{t()})),xh=[]},kh=function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},wh=(t,e)=>{var n;n=()=>{const n=document.querySelectorAll(t);0!==n.length&&(n[0].addEventListener("mouseover",(function(){Th("actor"+e+"_popup")})),n[0].addEventListener("mouseout",(function(){Sh("actor"+e+"_popup")})))},xh.push(n)},Ch=function(t,e,n,r){const i=t.append("image");i.attr("x",e),i.attr("y",n);var a=(0,s.N)(r);i.attr("xlink:href",a)},Eh=function(t,e,n,r){const i=t.append("use");i.attr("x",e),i.attr("y",n);var a=(0,s.N)(r);i.attr("xlink:href","#"+a)},Th=function(t){var e=document.getElementById(t);null!=e&&(e.style.display="block")},Sh=function(t){var e=document.getElementById(t);null!=e&&(e.style.display="none")},Ah=function(t,e){let n=0,r=0;const i=e.text.split(jt.lineBreakRegex),[a,s]=tr(e.fontSize);let o=[],c=0,l=()=>e.y;if(void 0!==e.valign&&void 0!==e.textMargin&&e.textMargin>0)switch(e.valign){case"top":case"start":l=()=>Math.round(e.y+e.textMargin);break;case"middle":case"center":l=()=>Math.round(e.y+(n+r+e.textMargin)/2);break;case"bottom":case"end":l=()=>Math.round(e.y+(n+r+2*e.textMargin)-e.textMargin)}if(void 0!==e.anchor&&void 0!==e.textMargin&&void 0!==e.width)switch(e.anchor){case"left":case"start":e.x=Math.round(e.x+e.textMargin),e.anchor="start",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"middle":case"center":e.x=Math.round(e.x+e.width/2),e.anchor="middle",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"right":case"end":e.x=Math.round(e.x+e.width-e.textMargin),e.anchor="end",e.dominantBaseline="middle",e.alignmentBaseline="middle"}for(let[h,u]of i.entries()){void 0!==e.textMargin&&0===e.textMargin&&void 0!==a&&(c=h*a);const i=t.append("text");if(i.attr("x",e.x),i.attr("y",l()),void 0!==e.anchor&&i.attr("text-anchor",e.anchor).attr("dominant-baseline",e.dominantBaseline).attr("alignment-baseline",e.alignmentBaseline),void 0!==e.fontFamily&&i.style("font-family",e.fontFamily),void 0!==s&&i.style("font-size",s),void 0!==e.fontWeight&&i.style("font-weight",e.fontWeight),void 0!==e.fill&&i.attr("fill",e.fill),void 0!==e.class&&i.attr("class",e.class),void 0!==e.dy?i.attr("dy",e.dy):0!==c&&i.attr("dy",c),e.tspan){const t=i.append("tspan");t.attr("x",e.x),void 0!==e.fill&&t.attr("fill",e.fill),t.text(u)}else i.text(u);void 0!==e.valign&&void 0!==e.textMargin&&e.textMargin>0&&(r+=(i._groups||i)[0][0].getBBox().height,n=r),o.push(i)}return o},Lh=function(t,e){const n=t.append("polygon");var r,i,a,s,o;return n.attr("points",(r=e.x,i=e.y,a=e.width,s=e.height,r+","+i+" "+(r+a)+","+i+" "+(r+a)+","+(i+s-(o=7))+" "+(r+a-1.2*o)+","+(i+s)+" "+r+","+(i+s))),n.attr("class","labelBox"),e.y=e.y+e.height/2,Ah(t,e),n};let Bh=-1;const Nh=(t,e)=>{t.selectAll&&t.selectAll(".actor-line").attr("class","200").attr("y2",e-55)},Dh=function(t,e){kh(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"}).lower()},Oh=function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},Mh=function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},Ih=function(){function t(t,e,n,i,a,s,o){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("text-anchor","middle").text(t),o)}function e(t,e,n,i,a,s,o,c){const{actorFontSize:l,actorFontFamily:h,actorFontWeight:u}=c,[d,p]=tr(l),f=t.split(jt.lineBreakRegex);for(let g=0;g<f.length;g++){const t=g*d-d*(f.length-1)/2,c=e.append("text").attr("x",n+a/2).attr("y",i).style("text-anchor","middle").style("font-size",p).style("font-weight",u).style("font-family",h);c.append("tspan").attr("x",n+a/2).attr("dy",t).text(f[g]),c.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(c,o)}}function n(t,n,i,a,s,o,c,l){const h=n.append("switch"),u=h.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,i,a,s,o,c,l),r(u,c)}function r(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),Fh=function(){function t(t,e,n,i,a,s,o){r(e.append("text").attr("x",n).attr("y",i).style("text-anchor","start").text(t),o)}function e(t,e,n,i,a,s,o,c){const{actorFontSize:l,actorFontFamily:h,actorFontWeight:u}=c,d=t.split(jt.lineBreakRegex);for(let p=0;p<d.length;p++){const t=p*l-l*(d.length-1)/2,a=e.append("text").attr("x",n).attr("y",i).style("text-anchor","start").style("font-size",l).style("font-weight",u).style("font-family",h);a.append("tspan").attr("x",n).attr("dy",t).text(d[p]),a.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(a,o)}}function n(t,n,i,a,s,o,c,l){const h=n.append("switch"),u=h.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,i,a,0,o,c,l),r(u,c)}function r(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),$h={drawRect:kh,drawText:Ah,drawLabel:Lh,drawActor:function(t,e,n,r){switch(e.type){case"actor":return function(t,e,n,r){const i=e.x+e.width/2,a=e.y+80;r||(Bh++,t.append("line").attr("id","actor"+Bh).attr("x1",i).attr("y1",a).attr("x2",i).attr("y2",2e3).attr("class","actor-line").attr("stroke-width","0.5px").attr("stroke","#999"));const s=t.append("g");s.attr("class","actor-man");const o=Mh();o.x=e.x,o.y=e.y,o.fill="#eaeaea",o.width=e.width,o.height=e.height,o.class="actor",o.rx=3,o.ry=3,s.append("line").attr("id","actor-man-torso"+Bh).attr("x1",i).attr("y1",e.y+25).attr("x2",i).attr("y2",e.y+45),s.append("line").attr("id","actor-man-arms"+Bh).attr("x1",i-18).attr("y1",e.y+33).attr("x2",i+18).attr("y2",e.y+33),s.append("line").attr("x1",i-18).attr("y1",e.y+60).attr("x2",i).attr("y2",e.y+45),s.append("line").attr("x1",i).attr("y1",e.y+45).attr("x2",i+16).attr("y2",e.y+60);const c=s.append("circle");c.attr("cx",e.x+e.width/2),c.attr("cy",e.y+10),c.attr("r",15),c.attr("width",e.width),c.attr("height",e.height);const l=s.node().getBBox();return e.height=l.height,Ih(n)(e.description,s,o.x,o.y+35,o.width,o.height,{class:"actor"},n),e.height}(t,e,n,r);case"participant":return function(t,e,n,r){const i=e.x+e.width/2,a=e.y+5,s=t.append("g");var o=s;r||(Bh++,o.append("line").attr("id","actor"+Bh).attr("x1",i).attr("y1",a).attr("x2",i).attr("y2",2e3).attr("class","actor-line").attr("stroke-width","0.5px").attr("stroke","#999"),o=s.append("g"),e.actorCnt=Bh,null!=e.links&&(o.attr("id","root-"+Bh),wh("#root-"+Bh,Bh)));const c=Mh();var l="actor";null!=e.properties&&e.properties.class?l=e.properties.class:c.fill="#eaeaea",c.x=e.x,c.y=e.y,c.width=e.width,c.height=e.height,c.class=l,c.rx=3,c.ry=3;const h=kh(o,c);if(e.rectData=c,null!=e.properties&&e.properties.icon){const t=e.properties.icon.trim();"@"===t.charAt(0)?Eh(o,c.x+c.width-20,c.y+10,t.substr(1)):Ch(o,c.x+c.width-20,c.y+10,t)}Ih(n)(e.description,o,c.x,c.y,c.width,c.height,{class:"actor"},n);let u=e.height;if(h.node){const t=h.node().getBBox();e.height=t.height,u=t.height}return u}(t,e,n,r)}},drawBox:function(t,e,n){const r=t.append("g");Dh(r,e),e.name&&Ih(n)(e.name,r,e.x,e.y+(e.textMaxHeight||0)/2,e.width,0,{class:"text"},n),r.lower()},drawPopup:function(t,e,n,r,i){if(void 0===e.links||null===e.links||0===Object.keys(e.links).length)return{height:0,width:0};const a=e.links,o=e.actorCnt,c=e.rectData;var l="none";i&&(l="block !important");const h=t.append("g");h.attr("id","actor"+o+"_popup"),h.attr("class","actorPopupMenu"),h.attr("display",l),wh("#actor"+o+"_popup",o);var u="";void 0!==c.class&&(u=" "+c.class);let d=c.width>n?c.width:n;const p=h.append("rect");if(p.attr("class","actorPopupMenuPanel"+u),p.attr("x",c.x),p.attr("y",c.height),p.attr("fill",c.fill),p.attr("stroke",c.stroke),p.attr("width",d),p.attr("height",c.height),p.attr("rx",c.rx),p.attr("ry",c.ry),null!=a){var f=20;for(let t in a){var g=h.append("a"),y=(0,s.N)(a[t]);g.attr("xlink:href",y),g.attr("target","_blank"),Fh(r)(t,g,c.x+10,c.height+f,d,20,{class:"actor"},r),f+=30}}return p.attr("height",f),{height:c.height+f,width:d}},drawImage:Ch,drawEmbeddedImage:Eh,anchorElement:function(t){return t.append("g")},drawActivation:function(t,e,n,r,i){const a=Mh(),s=e.anchored;a.x=e.startx,a.y=e.starty,a.class="activation"+i%3,a.width=e.stopx-e.startx,a.height=n-e.starty,kh(s,a)},drawLoop:function(t,e,n,r){const{boxMargin:i,boxTextMargin:a,labelBoxHeight:s,labelBoxWidth:o,messageFontFamily:c,messageFontSize:l,messageFontWeight:h}=r,u=t.append("g"),d=function(t,e,n,r){return u.append("line").attr("x1",t).attr("y1",e).attr("x2",n).attr("y2",r).attr("class","loopLine")};d(e.startx,e.starty,e.stopx,e.starty),d(e.stopx,e.starty,e.stopx,e.stopy),d(e.startx,e.stopy,e.stopx,e.stopy),d(e.startx,e.starty,e.startx,e.stopy),void 0!==e.sections&&e.sections.forEach((function(t){d(e.startx,t.y,e.stopx,t.y).style("stroke-dasharray","3, 3")}));let p=Oh();p.text=n,p.x=e.startx,p.y=e.starty,p.fontFamily=c,p.fontSize=l,p.fontWeight=h,p.anchor="middle",p.valign="middle",p.tspan=!1,p.width=o||50,p.height=s||20,p.textMargin=a,p.class="labelText",Lh(u,p),p=Oh(),p.text=e.title,p.x=e.startx+o/2+(e.stopx-e.startx)/2,p.y=e.starty+i+a,p.anchor="middle",p.valign="middle",p.textMargin=a,p.class="loopText",p.fontFamily=c,p.fontSize=l,p.fontWeight=h,p.wrap=!0;let f=Ah(u,p);return void 0!==e.sectionTitles&&e.sectionTitles.forEach((function(t,n){if(t.message){p.text=t.message,p.x=e.startx+(e.stopx-e.startx)/2,p.y=e.sections[n].y+i+a,p.class="loopText",p.anchor="middle",p.valign="middle",p.tspan=!1,p.fontFamily=c,p.fontSize=l,p.fontWeight=h,p.wrap=e.wrap,f=Ah(u,p);let r=Math.round(f.map((t=>(t._groups||t)[0][0].getBBox().height)).reduce(((t,e)=>t+e)));e.sections[n].height+=r-(i+a)}})),e.height=Math.round(e.stopy-e.starty),u},drawBackgroundRect:Dh,insertArrowHead:function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},insertArrowFilledHead:function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},insertSequenceNumber:function(t){t.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},insertArrowCrossHead:function(t){t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},insertDatabaseIcon:function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},insertComputerIcon:function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},insertClockIcon:function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},getTextObj:Oh,getNoteRect:Mh,popupMenu:function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = 'block'; }"},popdownMenu:function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = 'none'; }"},fixLifeLineHeights:Nh,sanitizeUrl:s.N};let Rh={};const Zh={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],activations:[],models:{getHeight:function(){return Math.max.apply(null,0===this.actors.length?[0]:this.actors.map((t=>t.height||0)))+(0===this.loops.length?0:this.loops.map((t=>t.height||0)).reduce(((t,e)=>t+e)))+(0===this.messages.length?0:this.messages.map((t=>t.height||0)).reduce(((t,e)=>t+e)))+(0===this.notes.length?0:this.notes.map((t=>t.height||0)).reduce(((t,e)=>t+e)))},clear:function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},addBox:function(t){this.boxes.push(t)},addActor:function(t){this.actors.push(t)},addLoop:function(t){this.loops.push(t)},addMessage:function(t){this.messages.push(t)},addNote:function(t){this.notes.push(t)},lastActor:function(){return this.actors[this.actors.length-1]},lastLoop:function(){return this.loops[this.loops.length-1]},lastMessage:function(){return this.messages[this.messages.length-1]},lastNote:function(){return this.notes[this.notes.length-1]},actors:[],boxes:[],loops:[],messages:[],notes:[]},init:function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,Wh(ur())},updateVal:function(t,e,n,r){void 0===t[e]?t[e]=n:t[e]=r(n,t[e])},updateBounds:function(t,e,n,r){const i=this;let a=0;function s(s){return function(o){a++;const c=i.sequenceItems.length-a+1;i.updateVal(o,"starty",e-c*Rh.boxMargin,Math.min),i.updateVal(o,"stopy",r+c*Rh.boxMargin,Math.max),i.updateVal(Zh.data,"startx",t-c*Rh.boxMargin,Math.min),i.updateVal(Zh.data,"stopx",n+c*Rh.boxMargin,Math.max),"activation"!==s&&(i.updateVal(o,"startx",t-c*Rh.boxMargin,Math.min),i.updateVal(o,"stopx",n+c*Rh.boxMargin,Math.max),i.updateVal(Zh.data,"starty",e-c*Rh.boxMargin,Math.min),i.updateVal(Zh.data,"stopy",r+c*Rh.boxMargin,Math.max))}}this.sequenceItems.forEach(s()),this.activations.forEach(s("activation"))},insert:function(t,e,n,r){const i=Math.min(t,n),a=Math.max(t,n),s=Math.min(e,r),o=Math.max(e,r);this.updateVal(Zh.data,"startx",i,Math.min),this.updateVal(Zh.data,"starty",s,Math.min),this.updateVal(Zh.data,"stopx",a,Math.max),this.updateVal(Zh.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},newActivation:function(t,e,n){const r=n[t.from.actor],i=Hh(t.from.actor).length||0,a=r.x+r.width/2+(i-1)*Rh.activationWidth/2;this.activations.push({startx:a,starty:this.verticalPos+2,stopx:a+Rh.activationWidth,stopy:void 0,actor:t.from.actor,anchored:$h.anchorElement(e)})},endActivation:function(t){const e=this.activations.map((function(t){return t.actor})).lastIndexOf(t.from.actor);return this.activations.splice(e,1)[0]},createLoop:function(t={message:void 0,wrap:!1,width:void 0},e){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:t.message,wrap:t.wrap,width:t.width,height:0,fill:e}},newLoop:function(t={message:void 0,wrap:!1,width:void 0},e){this.sequenceItems.push(this.createLoop(t,e))},endLoop:function(){return this.sequenceItems.pop()},addSectionToLoop:function(t){const e=this.sequenceItems.pop();e.sections=e.sections||[],e.sectionTitles=e.sectionTitles||[],e.sections.push({y:Zh.getVerticalPos(),height:0}),e.sectionTitles.push(t),this.sequenceItems.push(e)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return{bounds:this.data,models:this.models}}},Ph=t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),jh=t=>({fontFamily:t.noteFontFamily,fontSize:t.noteFontSize,fontWeight:t.noteFontWeight}),Yh=t=>({fontFamily:t.actorFontFamily,fontSize:t.actorFontSize,fontWeight:t.actorFontWeight});const zh=function(t,e,n,r,i,a,s){if(!0===i.hideUnusedParticipants){const t=new Set;a.forEach((e=>{t.add(e.from),t.add(e.to)})),n=n.filter((e=>t.has(e)))}let o,c=0,l=0,h=0;for(const u of n){const n=e[u],i=n.box;o&&o!=i&&(s||Zh.models.addBox(o),l+=Rh.boxMargin+o.margin),i&&i!=o&&(s||(i.x=c+l,i.y=r),l+=i.margin),n.width=n.width||Rh.width,n.height=Math.max(n.height||Rh.height,Rh.height),n.margin=n.margin||Rh.actorMargin,n.x=c+l,n.y=Zh.getVerticalPos();const a=$h.drawActor(t,n,Rh,s);h=Math.max(h,a),Zh.insert(n.x,r,n.x+n.width,n.height),c+=n.width+l,n.box&&(n.box.width=c+i.margin-n.box.x),l=n.margin,o=n.box,Zh.models.addActor(n)}o&&!s&&Zh.models.addBox(o),Zh.bumpVerticalPos(h)},Uh=function(t,e,n,r){let i=0,a=0;for(const s of n){const n=e[s],o=Gh(n),c=$h.drawPopup(t,n,o,Rh,Rh.forceMenus,r);c.height>i&&(i=c.height),c.width+n.x>a&&(a=c.width+n.x)}return{maxHeight:i,maxWidth:a}},Wh=function(t){On(Rh,t),t.fontFamily&&(Rh.actorFontFamily=Rh.noteFontFamily=Rh.messageFontFamily=t.fontFamily),t.fontSize&&(Rh.actorFontSize=Rh.noteFontSize=Rh.messageFontSize=t.fontSize),t.fontWeight&&(Rh.actorFontWeight=Rh.noteFontWeight=Rh.messageFontWeight=t.fontWeight)},Hh=function(t){return Zh.activations.filter((function(e){return e.actor===t}))},qh=function(t,e){const n=e[t],r=Hh(t);return[r.reduce((function(t,e){return Math.min(t,e.startx)}),n.x+n.width/2),r.reduce((function(t,e){return Math.max(t,e.stopx)}),n.x+n.width/2)]};function Vh(t,e,n,r,i){Zh.bumpVerticalPos(n);let a=r;if(e.id&&e.message&&t[e.id]){const n=t[e.id].width,i=Ph(Rh);e.message=er.wrapLabel(`[${e.message}]`,n-2*Rh.wrapPadding,i),e.width=n,e.wrap=!0;const s=er.calculateTextDimensions(e.message,i),o=Math.max(s.height,Rh.labelBoxHeight);a=r+o,Bt.debug(`${o} - ${e.message}`)}i(e),Zh.bumpVerticalPos(a)}const Gh=function(t){let e=0;const n=Yh(Rh);for(const r in t.links){const t=er.calculateTextDimensions(r,n).width+2*Rh.wrapPadding+2*Rh.boxMargin;e<t&&(e=t)}return e};const Xh=function(t,e,n,r){const i={},a=[];let s,o,c;return t.forEach((function(t){switch(t.id=er.random({length:10}),t.type){case r.db.LINETYPE.LOOP_START:case r.db.LINETYPE.ALT_START:case r.db.LINETYPE.OPT_START:case r.db.LINETYPE.PAR_START:case r.db.LINETYPE.CRITICAL_START:case r.db.LINETYPE.BREAK_START:a.push({id:t.id,msg:t.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case r.db.LINETYPE.ALT_ELSE:case r.db.LINETYPE.PAR_AND:case r.db.LINETYPE.CRITICAL_OPTION:t.message&&(s=a.pop(),i[s.id]=s,i[t.id]=s,a.push(s));break;case r.db.LINETYPE.LOOP_END:case r.db.LINETYPE.ALT_END:case r.db.LINETYPE.OPT_END:case r.db.LINETYPE.PAR_END:case r.db.LINETYPE.CRITICAL_END:case r.db.LINETYPE.BREAK_END:s=a.pop(),i[s.id]=s;break;case r.db.LINETYPE.ACTIVE_START:{const n=e[t.from?t.from.actor:t.to.actor],r=Hh(t.from?t.from.actor:t.to.actor).length,i=n.x+n.width/2+(r-1)*Rh.activationWidth/2,a={startx:i,stopx:i+Rh.activationWidth,actor:t.from.actor,enabled:!0};Zh.activations.push(a)}break;case r.db.LINETYPE.ACTIVE_END:{const e=Zh.activations.map((t=>t.actor)).lastIndexOf(t.from.actor);delete Zh.activations.splice(e,1)[0]}}void 0!==t.placement?(o=function(t,e,n){const r=e[t.from].x,i=e[t.to].x,a=t.wrap&&t.message;let s=er.calculateTextDimensions(a?er.wrapLabel(t.message,Rh.width,jh(Rh)):t.message,jh(Rh));const o={width:a?Rh.width:Math.max(Rh.width,s.width+2*Rh.noteMargin),height:0,startx:e[t.from].x,stopx:0,starty:0,stopy:0,message:t.message};return t.placement===n.db.PLACEMENT.RIGHTOF?(o.width=a?Math.max(Rh.width,s.width):Math.max(e[t.from].width/2+e[t.to].width/2,s.width+2*Rh.noteMargin),o.startx=r+(e[t.from].width+Rh.actorMargin)/2):t.placement===n.db.PLACEMENT.LEFTOF?(o.width=a?Math.max(Rh.width,s.width+2*Rh.noteMargin):Math.max(e[t.from].width/2+e[t.to].width/2,s.width+2*Rh.noteMargin),o.startx=r-o.width+(e[t.from].width-Rh.actorMargin)/2):t.to===t.from?(s=er.calculateTextDimensions(a?er.wrapLabel(t.message,Math.max(Rh.width,e[t.from].width),jh(Rh)):t.message,jh(Rh)),o.width=a?Math.max(Rh.width,e[t.from].width):Math.max(e[t.from].width,Rh.width,s.width+2*Rh.noteMargin),o.startx=r+(e[t.from].width-o.width)/2):(o.width=Math.abs(r+e[t.from].width/2-(i+e[t.to].width/2))+Rh.actorMargin,o.startx=r<i?r+e[t.from].width/2-Rh.actorMargin/2:i+e[t.to].width/2-Rh.actorMargin/2),a&&(o.message=er.wrapLabel(t.message,o.width-2*Rh.wrapPadding,jh(Rh))),Bt.debug(`NM:[${o.startx},${o.stopx},${o.starty},${o.stopy}:${o.width},${o.height}=${t.message}]`),o}(t,e,r),t.noteModel=o,a.forEach((t=>{s=t,s.from=Math.min(s.from,o.startx),s.to=Math.max(s.to,o.startx+o.width),s.width=Math.max(s.width,Math.abs(s.from-s.to))-Rh.labelBoxWidth}))):(c=function(t,e,n){let r=!1;if([n.db.LINETYPE.SOLID_OPEN,n.db.LINETYPE.DOTTED_OPEN,n.db.LINETYPE.SOLID,n.db.LINETYPE.DOTTED,n.db.LINETYPE.SOLID_CROSS,n.db.LINETYPE.DOTTED_CROSS,n.db.LINETYPE.SOLID_POINT,n.db.LINETYPE.DOTTED_POINT].includes(t.type)&&(r=!0),!r)return{};const i=qh(t.from,e),a=qh(t.to,e),s=i[0]<=a[0]?1:0,o=i[0]<a[0]?0:1,c=[...i,...a],l=Math.abs(a[o]-i[s]);t.wrap&&t.message&&(t.message=er.wrapLabel(t.message,Math.max(l+2*Rh.wrapPadding,Rh.width),Ph(Rh)));const h=er.calculateTextDimensions(t.message,Ph(Rh));return{width:Math.max(t.wrap?0:h.width+2*Rh.wrapPadding,l+2*Rh.wrapPadding,Rh.width),height:0,startx:i[s],stopx:a[o],starty:0,stopy:0,message:t.message,type:t.type,wrap:t.wrap,fromBounds:Math.min.apply(null,c),toBounds:Math.max.apply(null,c)}}(t,e,r),t.msgModel=c,c.startx&&c.stopx&&a.length>0&&a.forEach((n=>{if(s=n,c.startx===c.stopx){const n=e[t.from],r=e[t.to];s.from=Math.min(n.x-c.width/2,n.x-n.width/2,s.from),s.to=Math.max(r.x+c.width/2,r.x+n.width/2,s.to),s.width=Math.max(s.width,Math.abs(s.to-s.from))-Rh.labelBoxWidth}else s.from=Math.min(c.startx,s.from),s.to=Math.max(c.stopx,s.to),s.width=Math.max(s.width,c.width)-Rh.labelBoxWidth})))})),Zh.activations=[],Bt.debug("Loop type widths:",i),i},Qh={bounds:Zh,drawActors:zh,drawActorsPopup:Uh,setConf:Wh,draw:function(t,e,n,r){const{securityLevel:i,sequence:a}=ur();let s;Rh=a,r.db.clear(),r.parser.parse(t),"sandbox"===i&&(s=(0,o.Ys)("#i"+e));const c="sandbox"===i?(0,o.Ys)(s.nodes()[0].contentDocument.body):(0,o.Ys)("body"),l="sandbox"===i?s.nodes()[0].contentDocument:document;Zh.init(),Bt.debug(r.db);const h="sandbox"===i?c.select(`[id="${e}"]`):(0,o.Ys)(`[id="${e}"]`),u=r.db.getActors(),d=r.db.getBoxes(),p=r.db.getActorKeys(),f=r.db.getMessages(),g=r.db.getDiagramTitle(),y=r.db.hasAtLeastOneBox(),m=r.db.hasAtLeastOneBoxWithTitle(),b=function(t,e,n){const r={};return e.forEach((function(e){if(t[e.to]&&t[e.from]){const i=t[e.to];if(e.placement===n.db.PLACEMENT.LEFTOF&&!i.prevActor)return;if(e.placement===n.db.PLACEMENT.RIGHTOF&&!i.nextActor)return;const a=void 0!==e.placement,s=!a,o=a?jh(Rh):Ph(Rh),c=e.wrap?er.wrapLabel(e.message,Rh.width-2*Rh.wrapPadding,o):e.message,l=er.calculateTextDimensions(c,o).width+2*Rh.wrapPadding;s&&e.from===i.nextActor?r[e.to]=Math.max(r[e.to]||0,l):s&&e.from===i.prevActor?r[e.from]=Math.max(r[e.from]||0,l):s&&e.from===e.to?(r[e.from]=Math.max(r[e.from]||0,l/2),r[e.to]=Math.max(r[e.to]||0,l/2)):e.placement===n.db.PLACEMENT.RIGHTOF?r[e.from]=Math.max(r[e.from]||0,l):e.placement===n.db.PLACEMENT.LEFTOF?r[i.prevActor]=Math.max(r[i.prevActor]||0,l):e.placement===n.db.PLACEMENT.OVER&&(i.prevActor&&(r[i.prevActor]=Math.max(r[i.prevActor]||0,l/2)),i.nextActor&&(r[e.from]=Math.max(r[e.from]||0,l/2)))}})),Bt.debug("maxMessageWidthPerActor:",r),r}(u,f,r);Rh.height=function(t,e,n){let r=0;Object.keys(t).forEach((e=>{const n=t[e];n.wrap&&(n.description=er.wrapLabel(n.description,Rh.width-2*Rh.wrapPadding,Yh(Rh)));const i=er.calculateTextDimensions(n.description,Yh(Rh));n.width=n.wrap?Rh.width:Math.max(Rh.width,i.width+2*Rh.wrapPadding),n.height=n.wrap?Math.max(i.height,Rh.height):Rh.height,r=Math.max(r,n.height)}));for(const a in e){const n=t[a];if(!n)continue;const r=t[n.nextActor];if(!r){const t=e[a]+Rh.actorMargin-n.width/2;n.margin=Math.max(t,Rh.actorMargin);continue}const i=e[a]+Rh.actorMargin-n.width/2-r.width/2;n.margin=Math.max(i,Rh.actorMargin)}let i=0;return n.forEach((e=>{const n=Ph(Rh);let r=e.actorKeys.reduce(((e,n)=>e+(t[n].width+(t[n].margin||0))),0);r-=2*Rh.boxTextMargin,e.wrap&&(e.name=er.wrapLabel(e.name,r-2*Rh.wrapPadding,n));const a=er.calculateTextDimensions(e.name,n);i=Math.max(a.height,i);const s=Math.max(r,a.width+2*Rh.wrapPadding);if(e.margin=Rh.boxTextMargin,r<s){const t=(s-r)/2;e.margin+=t}})),n.forEach((t=>t.textMaxHeight=i)),Math.max(r,Rh.height)}(u,b,d),$h.insertComputerIcon(h),$h.insertDatabaseIcon(h),$h.insertClockIcon(h),y&&(Zh.bumpVerticalPos(Rh.boxMargin),m&&Zh.bumpVerticalPos(d[0].textMaxHeight)),zh(h,u,p,0,Rh,f,!1);const _=Xh(f,u,b,r);$h.insertArrowHead(h),$h.insertArrowCrossHead(h),$h.insertArrowFilledHead(h),$h.insertSequenceNumber(h);let x=1,v=1;const k=[];f.forEach((function(t){let e,n,i;switch(t.type){case r.db.LINETYPE.NOTE:n=t.noteModel,function(t,e){Zh.bumpVerticalPos(Rh.boxMargin),e.height=Rh.boxMargin,e.starty=Zh.getVerticalPos();const n=$h.getNoteRect();n.x=e.startx,n.y=e.starty,n.width=e.width||Rh.width,n.class="note";const r=t.append("g"),i=$h.drawRect(r,n),a=$h.getTextObj();a.x=e.startx,a.y=e.starty,a.width=n.width,a.dy="1em",a.text=e.message,a.class="noteText",a.fontFamily=Rh.noteFontFamily,a.fontSize=Rh.noteFontSize,a.fontWeight=Rh.noteFontWeight,a.anchor=Rh.noteAlign,a.textMargin=Rh.noteMargin,a.valign="center";const s=Ah(r,a),o=Math.round(s.map((t=>(t._groups||t)[0][0].getBBox().height)).reduce(((t,e)=>t+e)));i.attr("height",o+2*Rh.noteMargin),e.height+=o+2*Rh.noteMargin,Zh.bumpVerticalPos(o+2*Rh.noteMargin),e.stopy=e.starty+o+2*Rh.noteMargin,e.stopx=e.startx+n.width,Zh.insert(e.startx,e.starty,e.stopx,e.stopy),Zh.models.addNote(e)}(h,n);break;case r.db.LINETYPE.ACTIVE_START:Zh.newActivation(t,h,u);break;case r.db.LINETYPE.ACTIVE_END:!function(t,e){const n=Zh.endActivation(t);n.starty+18>e&&(n.starty=e-6,e+=12),$h.drawActivation(h,n,e,Rh,Hh(t.from.actor).length),Zh.insert(n.startx,e-10,n.stopx,e)}(t,Zh.getVerticalPos());break;case r.db.LINETYPE.LOOP_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin+Rh.boxTextMargin,(t=>Zh.newLoop(t)));break;case r.db.LINETYPE.LOOP_END:e=Zh.endLoop(),$h.drawLoop(h,e,"loop",Rh),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos()),Zh.models.addLoop(e);break;case r.db.LINETYPE.RECT_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin,(t=>Zh.newLoop(void 0,t.message)));break;case r.db.LINETYPE.RECT_END:e=Zh.endLoop(),$h.drawBackgroundRect(h,e),Zh.models.addLoop(e),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos());break;case r.db.LINETYPE.OPT_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin+Rh.boxTextMargin,(t=>Zh.newLoop(t)));break;case r.db.LINETYPE.OPT_END:e=Zh.endLoop(),$h.drawLoop(h,e,"opt",Rh),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos()),Zh.models.addLoop(e);break;case r.db.LINETYPE.ALT_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin+Rh.boxTextMargin,(t=>Zh.newLoop(t)));break;case r.db.LINETYPE.ALT_ELSE:Vh(_,t,Rh.boxMargin+Rh.boxTextMargin,Rh.boxMargin,(t=>Zh.addSectionToLoop(t)));break;case r.db.LINETYPE.ALT_END:e=Zh.endLoop(),$h.drawLoop(h,e,"alt",Rh),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos()),Zh.models.addLoop(e);break;case r.db.LINETYPE.PAR_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin+Rh.boxTextMargin,(t=>Zh.newLoop(t)));break;case r.db.LINETYPE.PAR_AND:Vh(_,t,Rh.boxMargin+Rh.boxTextMargin,Rh.boxMargin,(t=>Zh.addSectionToLoop(t)));break;case r.db.LINETYPE.PAR_END:e=Zh.endLoop(),$h.drawLoop(h,e,"par",Rh),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos()),Zh.models.addLoop(e);break;case r.db.LINETYPE.AUTONUMBER:x=t.message.start||x,v=t.message.step||v,t.message.visible?r.db.enableSequenceNumbers():r.db.disableSequenceNumbers();break;case r.db.LINETYPE.CRITICAL_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin+Rh.boxTextMargin,(t=>Zh.newLoop(t)));break;case r.db.LINETYPE.CRITICAL_OPTION:Vh(_,t,Rh.boxMargin+Rh.boxTextMargin,Rh.boxMargin,(t=>Zh.addSectionToLoop(t)));break;case r.db.LINETYPE.CRITICAL_END:e=Zh.endLoop(),$h.drawLoop(h,e,"critical",Rh),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos()),Zh.models.addLoop(e);break;case r.db.LINETYPE.BREAK_START:Vh(_,t,Rh.boxMargin,Rh.boxMargin+Rh.boxTextMargin,(t=>Zh.newLoop(t)));break;case r.db.LINETYPE.BREAK_END:e=Zh.endLoop(),$h.drawLoop(h,e,"break",Rh),Zh.bumpVerticalPos(e.stopy-Zh.getVerticalPos()),Zh.models.addLoop(e);break;default:try{i=t.msgModel,i.starty=Zh.getVerticalPos(),i.sequenceIndex=x,i.sequenceVisible=r.db.showSequenceNumbers();const e=function(t,e){Zh.bumpVerticalPos(10);const{startx:n,stopx:r,message:i}=e,a=jt.splitBreaks(i).length,s=er.calculateTextDimensions(i,Ph(Rh)),o=s.height/a;let c;e.height+=o,Zh.bumpVerticalPos(o);let l=s.height-10;const h=s.width;if(n===r){c=Zh.getVerticalPos()+l,Rh.rightAngles||(l+=Rh.boxMargin,c=Zh.getVerticalPos()+l),l+=30;const t=Math.max(h/2,Rh.width/2);Zh.insert(n-t,Zh.getVerticalPos()-10+l,r+t,Zh.getVerticalPos()+30+l)}else l+=Rh.boxMargin,c=Zh.getVerticalPos()+l,Zh.insert(n,c-10,r,c);return Zh.bumpVerticalPos(l),e.height+=l,e.stopy=e.starty+e.height,Zh.insert(e.fromBounds,e.starty,e.toBounds,e.stopy),c}(0,i);k.push({messageModel:i,lineStartY:e}),Zh.models.addMessage(i)}catch(a){Bt.error("error while drawing message",a)}}[r.db.LINETYPE.SOLID_OPEN,r.db.LINETYPE.DOTTED_OPEN,r.db.LINETYPE.SOLID,r.db.LINETYPE.DOTTED,r.db.LINETYPE.SOLID_CROSS,r.db.LINETYPE.DOTTED_CROSS,r.db.LINETYPE.SOLID_POINT,r.db.LINETYPE.DOTTED_POINT].includes(t.type)&&(x+=v)})),k.forEach((t=>function(t,e,n,r){const{startx:i,stopx:a,starty:s,message:o,type:c,sequenceIndex:l,sequenceVisible:h}=e,u=er.calculateTextDimensions(o,Ph(Rh)),d=$h.getTextObj();d.x=i,d.y=s+10,d.width=a-i,d.class="messageText",d.dy="1em",d.text=o,d.fontFamily=Rh.messageFontFamily,d.fontSize=Rh.messageFontSize,d.fontWeight=Rh.messageFontWeight,d.anchor=Rh.messageAlign,d.valign="center",d.textMargin=Rh.wrapPadding,d.tspan=!1,Ah(t,d);const p=u.width;let f;i===a?f=Rh.rightAngles?t.append("path").attr("d",`M ${i},${n} H ${i+Math.max(Rh.width/2,p/2)} V ${n+25} H ${i}`):t.append("path").attr("d","M "+i+","+n+" C "+(i+60)+","+(n-10)+" "+(i+60)+","+(n+30)+" "+i+","+(n+20)):(f=t.append("line"),f.attr("x1",i),f.attr("y1",n),f.attr("x2",a),f.attr("y2",n)),c===r.db.LINETYPE.DOTTED||c===r.db.LINETYPE.DOTTED_CROSS||c===r.db.LINETYPE.DOTTED_POINT||c===r.db.LINETYPE.DOTTED_OPEN?(f.style("stroke-dasharray","3, 3"),f.attr("class","messageLine1")):f.attr("class","messageLine0");let g="";Rh.arrowMarkerAbsolute&&(g=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,g=g.replace(/\(/g,"\\("),g=g.replace(/\)/g,"\\)")),f.attr("stroke-width",2),f.attr("stroke","none"),f.style("fill","none"),c!==r.db.LINETYPE.SOLID&&c!==r.db.LINETYPE.DOTTED||f.attr("marker-end","url("+g+"#arrowhead)"),c!==r.db.LINETYPE.SOLID_POINT&&c!==r.db.LINETYPE.DOTTED_POINT||f.attr("marker-end","url("+g+"#filled-head)"),c!==r.db.LINETYPE.SOLID_CROSS&&c!==r.db.LINETYPE.DOTTED_CROSS||f.attr("marker-end","url("+g+"#crosshead)"),(h||Rh.showSequenceNumbers)&&(f.attr("marker-start","url("+g+"#sequencenumber)"),t.append("text").attr("x",i).attr("y",n+4).attr("font-family","sans-serif").attr("font-size","12px").attr("text-anchor","middle").attr("class","sequenceNumber").text(l))}(h,t.messageModel,t.lineStartY,r))),Rh.mirrorActors&&(Zh.bumpVerticalPos(2*Rh.boxMargin),zh(h,u,p,Zh.getVerticalPos(),Rh,f,!0),Zh.bumpVerticalPos(Rh.boxMargin),Nh(h,Zh.getVerticalPos())),Zh.models.boxes.forEach((function(t){t.height=Zh.getVerticalPos()-t.y,Zh.insert(t.x,t.y,t.x+t.width,t.height),t.startx=t.x,t.starty=t.y,t.stopx=t.startx+t.width,t.stopy=t.starty+t.height,t.stroke="rgb(0,0,0, 0.5)",$h.drawBox(h,t,Rh)})),y&&Zh.bumpVerticalPos(Rh.boxMargin);const w=Uh(h,u,p,l),{bounds:C}=Zh.getBounds();Bt.debug("For line height fix Querying: #"+e+" .actor-line");(0,o.td_)("#"+e+" .actor-line").attr("y2",C.stopy);let E=C.stopy-C.starty;E<w.maxHeight&&(E=w.maxHeight);let T=E+2*Rh.diagramMarginY;Rh.mirrorActors&&(T=T-Rh.boxMargin+Rh.bottomMarginAdj);let S=C.stopx-C.startx;S<w.maxWidth&&(S=w.maxWidth);const A=S+2*Rh.diagramMarginX;g&&h.append("text").text(g).attr("x",(C.stopx-C.startx)/2-2*Rh.diagramMarginX).attr("y",-25),br(h,T,A,Rh.useMaxWidth);const L=g?40:0;h.attr("viewBox",C.startx-Rh.diagramMarginX+" -"+(Rh.diagramMarginY+L)+" "+A+" "+(T+L)),Bt.debug("models:",Zh.models)}};var Kh=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,3],i=[1,5],a=[1,7],s=[2,5],o=[1,15],c=[1,17],l=[1,21],h=[1,22],u=[1,23],d=[1,24],p=[1,37],f=[1,25],g=[1,26],y=[1,27],m=[1,28],b=[1,29],_=[1,32],x=[1,33],v=[1,34],k=[1,35],w=[1,36],C=[1,39],E=[1,40],T=[1,41],S=[1,42],A=[1,38],L=[1,45],B=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],N=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],D=[1,4,5,7,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],O=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],M={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,directive:6,SD:7,document:8,line:9,statement:10,classDefStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"--\x3e":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,classDef:38,CLASSDEF_ID:39,CLASSDEF_STYLEOPTS:40,DEFAULT:41,class:42,CLASSENTITY_IDS:43,STYLECLASS:44,openDirective:45,typeDirective:46,closeDirective:47,":":48,argDirective:49,direction_tb:50,direction_bt:51,direction_rl:52,direction_lr:53,eol:54,";":55,EDGE_STATE:56,STYLE_SEPARATOR:57,left_of:58,right_of:59,open_directive:60,type_directive:61,arg_directive:62,close_directive:63,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",7:"SD",14:"DESCR",15:"--\x3e",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"classDef",39:"CLASSDEF_ID",40:"CLASSDEF_STYLEOPTS",41:"DEFAULT",42:"class",43:"CLASSENTITY_IDS",44:"STYLECLASS",48:":",50:"direction_tb",51:"direction_bt",52:"direction_rl",53:"direction_lr",55:";",56:"EDGE_STATE",57:"STYLE_SEPARATOR",58:"left_of",59:"right_of",60:"open_directive",61:"type_directive",62:"arg_directive",63:"close_directive"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[11,3],[11,3],[12,3],[6,3],[6,5],[32,1],[32,1],[32,1],[32,1],[54,1],[54,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1],[45,1],[46,1],[49,1],[47,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 4:return r.setRootDoc(a[o]),a[o];case 5:this.$=[];break;case 6:"nl"!=a[o]&&(a[o-1].push(a[o]),this.$=a[o-1]);break;case 7:case 8:case 12:this.$=a[o];break;case 9:this.$="nl";break;case 13:const t=a[o-1];t.description=r.trimColon(a[o]),this.$=t;break;case 14:this.$={stmt:"relation",state1:a[o-2],state2:a[o]};break;case 15:const e=r.trimColon(a[o]);this.$={stmt:"relation",state1:a[o-3],state2:a[o-1],description:e};break;case 19:this.$={stmt:"state",id:a[o-3],type:"default",description:"",doc:a[o-1]};break;case 20:var c=a[o],l=a[o-2].trim();if(a[o].match(":")){var h=a[o].split(":");c=h[0],l=[l,h[1]]}this.$={stmt:"state",id:c,type:"default",description:l};break;case 21:this.$={stmt:"state",id:a[o-3],type:"default",description:a[o-5],doc:a[o-1]};break;case 22:this.$={stmt:"state",id:a[o],type:"fork"};break;case 23:this.$={stmt:"state",id:a[o],type:"join"};break;case 24:this.$={stmt:"state",id:a[o],type:"choice"};break;case 25:this.$={stmt:"state",id:r.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:a[o-1].trim(),note:{position:a[o-2].trim(),text:a[o].trim()}};break;case 30:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 33:case 34:this.$={stmt:"classDef",id:a[o-1].trim(),classes:a[o].trim()};break;case 35:this.$={stmt:"applyClass",id:a[o-1].trim(),styleClass:a[o].trim()};break;case 38:r.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:r.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:r.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:r.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:a[o].trim(),type:"default",description:""};break;case 46:case 47:this.$={stmt:"state",id:a[o-2].trim(),classes:[a[o].trim()],type:"default",description:""};break;case 50:r.parseDirective("%%{","open_directive");break;case 51:r.parseDirective(a[o],"type_directive");break;case 52:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 53:r.parseDirective("}%%","close_directive","state")}},table:[{3:1,4:n,5:r,6:4,7:i,45:6,60:a},{1:[3]},{3:8,4:n,5:r,6:4,7:i,45:6,60:a},{3:9,4:n,5:r,6:4,7:i,45:6,60:a},{3:10,4:n,5:r,6:4,7:i,45:6,60:a},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,42,50,51,52,53,56,60],s,{8:11}),{46:12,61:[1,13]},{61:[2,50]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:c,6:30,9:14,10:16,11:18,12:19,13:20,16:l,17:h,19:u,22:d,24:p,25:f,26:g,27:y,28:m,29:b,32:31,33:_,35:x,37:v,38:k,42:w,45:6,50:C,51:E,52:T,53:S,56:A,60:a},{47:43,48:[1,44],63:L},e([48,63],[2,51]),e(B,[2,6]),{6:30,10:46,11:18,12:19,13:20,16:l,17:h,19:u,22:d,24:p,25:f,26:g,27:y,28:m,29:b,32:31,33:_,35:x,37:v,38:k,42:w,45:6,50:C,51:E,52:T,53:S,56:A,60:a},e(B,[2,8]),e(B,[2,9]),e(B,[2,10]),e(B,[2,11]),e(B,[2,12],{14:[1,47],15:[1,48]}),e(B,[2,16]),{18:[1,49]},e(B,[2,18],{20:[1,50]}),{23:[1,51]},e(B,[2,22]),e(B,[2,23]),e(B,[2,24]),e(B,[2,25]),{30:52,31:[1,53],58:[1,54],59:[1,55]},e(B,[2,28]),e(B,[2,29]),{34:[1,56]},{36:[1,57]},e(B,[2,32]),{39:[1,58],41:[1,59]},{43:[1,60]},e(N,[2,44],{57:[1,61]}),e(N,[2,45],{57:[1,62]}),e(B,[2,38]),e(B,[2,39]),e(B,[2,40]),e(B,[2,41]),e(D,[2,36]),{49:63,62:[1,64]},e(D,[2,53]),e(B,[2,7]),e(B,[2,13]),{13:65,24:p,56:A},e(B,[2,17]),e(O,s,{8:66}),{24:[1,67]},{24:[1,68]},{23:[1,69]},{24:[2,48]},{24:[2,49]},e(B,[2,30]),e(B,[2,31]),{40:[1,70]},{40:[1,71]},{44:[1,72]},{24:[1,73]},{24:[1,74]},{47:75,63:L},{63:[2,52]},e(B,[2,14],{14:[1,76]}),{4:o,5:c,6:30,9:14,10:16,11:18,12:19,13:20,16:l,17:h,19:u,21:[1,77],22:d,24:p,25:f,26:g,27:y,28:m,29:b,32:31,33:_,35:x,37:v,38:k,42:w,45:6,50:C,51:E,52:T,53:S,56:A,60:a},e(B,[2,20],{20:[1,78]}),{31:[1,79]},{24:[1,80]},e(B,[2,33]),e(B,[2,34]),e(B,[2,35]),e(N,[2,46]),e(N,[2,47]),e(D,[2,37]),e(B,[2,15]),e(B,[2,19]),e(O,s,{8:81}),e(B,[2,26]),e(B,[2,27]),{4:o,5:c,6:30,9:14,10:16,11:18,12:19,13:20,16:l,17:h,19:u,21:[1,82],22:d,24:p,25:f,26:g,27:y,28:m,29:b,32:31,33:_,35:x,37:v,38:k,42:w,45:6,50:C,51:E,52:T,53:S,56:A,60:a},e(B,[2,21])],defaultActions:{7:[2,50],8:[2,1],9:[2,2],10:[2,3],54:[2,48],55:[2,49],64:[2,52]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},I=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return 41;case 1:case 44:return 50;case 2:case 45:return 51;case 3:case 46:return 52;case 4:case 47:return 53;case 5:return this.begin("open_directive"),60;case 6:return this.begin("type_directive"),61;case 7:return this.popState(),this.begin("arg_directive"),48;case 8:return this.popState(),this.popState(),63;case 9:return 62;case 10:case 11:case 13:case 14:case 15:case 16:case 56:case 58:case 64:break;case 12:case 79:return 5;case 17:case 34:return this.pushState("SCALE"),17;case 18:case 35:return 18;case 19:case 25:case 36:case 51:case 54:this.popState();break;case 20:return this.begin("acc_title"),33;case 21:return this.popState(),"acc_title_value";case 22:return this.begin("acc_descr"),35;case 23:return this.popState(),"acc_descr_value";case 24:this.begin("acc_descr_multiline");break;case 26:return"acc_descr_multiline_value";case 27:return this.pushState("CLASSDEF"),38;case 28:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 29:return this.popState(),this.pushState("CLASSDEFID"),39;case 30:return this.popState(),40;case 31:return this.pushState("CLASS"),42;case 32:return this.popState(),this.pushState("CLASS_STYLE"),43;case 33:return this.popState(),44;case 37:this.pushState("STATE");break;case 38:case 41:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),25;case 39:case 42:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),26;case 40:case 43:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),27;case 48:this.pushState("STATE_STRING");break;case 49:return this.pushState("STATE_ID"),"AS";case 50:case 66:return this.popState(),"ID";case 52:return"STATE_DESCR";case 53:return 19;case 55:return this.popState(),this.pushState("struct"),20;case 57:return this.popState(),21;case 59:return this.begin("NOTE"),29;case 60:return this.popState(),this.pushState("NOTE_ID"),58;case 61:return this.popState(),this.pushState("NOTE_ID"),59;case 62:this.popState(),this.pushState("FLOATING_NOTE");break;case 63:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 65:return"NOTE_TEXT";case 67:return this.popState(),this.pushState("NOTE_TEXT"),24;case 68:return this.popState(),e.yytext=e.yytext.substr(2).trim(),31;case 69:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),31;case 70:case 71:return 7;case 72:return 16;case 73:return 56;case 74:return 24;case 75:return e.yytext=e.yytext.trim(),14;case 76:return 15;case 77:return 28;case 78:return 57;case 80:return"INVALID"}},rules:[/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[14,15],inclusive:!1},close_directive:{rules:[14,15],inclusive:!1},arg_directive:{rules:[8,9,14,15],inclusive:!1},type_directive:{rules:[7,8,14,15],inclusive:!1},open_directive:{rules:[6,14,15],inclusive:!1},struct:{rules:[14,15,27,31,37,44,45,46,47,56,57,58,59,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[66],inclusive:!1},FLOATING_NOTE:{rules:[63,64,65],inclusive:!1},NOTE_TEXT:{rules:[68,69],inclusive:!1},NOTE_ID:{rules:[67],inclusive:!1},NOTE:{rules:[60,61,62],inclusive:!1},CLASS_STYLE:{rules:[33],inclusive:!1},CLASS:{rules:[32],inclusive:!1},CLASSDEFID:{rules:[30],inclusive:!1},CLASSDEF:{rules:[28,29],inclusive:!1},acc_descr_multiline:{rules:[25,26],inclusive:!1},acc_descr:{rules:[23],inclusive:!1},acc_title:{rules:[21],inclusive:!1},SCALE:{rules:[18,19,35,36],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[50],inclusive:!1},STATE_STRING:{rules:[51,52],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[14,15,38,39,40,41,42,43,48,49,53,54,55],inclusive:!1},ID:{rules:[14,15],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,10,11,12,13,15,16,17,20,22,24,27,31,34,37,55,59,70,71,72,73,74,75,76,78,79,80],inclusive:!0}}},t);function F(){this.yy={}}return M.lexer=I,F.prototype=M,M.Parser=F,new F}();Kh.parser=Kh;const Jh=Kh,tu=(t,e)=>{var n;return"dagre-wrapper"!==(null==(n=null==e?void 0:e.state)?void 0:n.defaultRenderer)&&null!==t.match(/^\s*stateDiagram/)},eu=(t,e)=>{var n;return null!==t.match(/^\s*stateDiagram-v2/)||!(!t.match(/^\s*stateDiagram/)||"dagre-wrapper"!==(null==(n=null==e?void 0:e.state)?void 0:n.defaultRenderer))},nu="state",ru="relation",iu="default",au="divider",su="[*]",ou="start",cu=su,lu="color",hu="fill";let uu="LR",du=[],pu={};let fu={root:{relations:[],states:{},documents:{}}},gu=fu.root,yu=0,mu=0;const bu=t=>JSON.parse(JSON.stringify(t)),_u=(t,e,n)=>{if(e.stmt===ru)_u(t,e.state1,!0),_u(t,e.state2,!1);else if(e.stmt===nu&&("[*]"===e.id?(e.id=n?t.id+"_start":t.id+"_end",e.start=n):e.id=e.id.trim()),e.doc){const t=[];let n,r=[];for(n=0;n<e.doc.length;n++)if(e.doc[n].type===au){const i=bu(e.doc[n]);i.doc=bu(r),t.push(i),r=[]}else r.push(e.doc[n]);if(t.length>0&&r.length>0){const n={stmt:nu,id:Yn(),type:"divider",doc:bu(r)};t.push(bu(n)),e.doc=t}e.doc.forEach((t=>_u(e,t,!0)))}},xu=function(t,e=iu,n=null,r=null,i=null,a=null,s=null,o=null){const c=null==t?void 0:t.trim();if(void 0===gu.states[c]?(Bt.info("Adding state ",c,r),gu.states[c]={id:c,descriptions:[],type:e,doc:n,note:i,classes:[],styles:[],textStyles:[]}):(gu.states[c].doc||(gu.states[c].doc=n),gu.states[c].type||(gu.states[c].type=e)),r&&(Bt.info("Setting state description",c,r),"string"==typeof r&&Tu(c,r.trim()),"object"==typeof r&&r.forEach((t=>Tu(c,t.trim())))),i&&(gu.states[c].note=i,gu.states[c].note.text=jt.sanitizeText(gu.states[c].note.text,ur())),a){Bt.info("Setting state classes",c,a);("string"==typeof a?[a]:a).forEach((t=>Au(c,t.trim())))}if(s){Bt.info("Setting state styles",c,s);("string"==typeof s?[s]:s).forEach((t=>Lu(c,t.trim())))}if(o){Bt.info("Setting state styles",c,s);("string"==typeof o?[o]:o).forEach((t=>Bu(c,t.trim())))}},vu=function(t){fu={root:{relations:[],states:{},documents:{}}},gu=fu.root,yu=0,pu={},t||Rr()},ku=function(t){return gu.states[t]};function wu(t=""){let e=t;return t===su&&(yu++,e=`${ou}${yu}`),e}function Cu(t="",e=iu){return t===su?ou:e}const Eu=function(t,e,n){if("object"==typeof t)!function(t,e,n){let r=wu(t.id.trim()),i=Cu(t.id.trim(),t.type),a=wu(e.id.trim()),s=Cu(e.id.trim(),e.type);xu(r,i,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),xu(a,s,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),gu.relations.push({id1:r,id2:a,relationTitle:jt.sanitizeText(n,ur())})}(t,e,n);else{const r=wu(t.trim()),i=Cu(t),a=function(t=""){let e=t;return t===cu&&(yu++,e=`end${yu}`),e}(e.trim()),s=function(t="",e=iu){return t===cu?"end":e}(e);xu(r,i),xu(a,s),gu.relations.push({id1:r,id2:a,title:jt.sanitizeText(n,ur())})}},Tu=function(t,e){const n=gu.states[t],r=e.startsWith(":")?e.replace(":","").trim():e;n.descriptions.push(jt.sanitizeText(r,ur()))},Su=function(t,e=""){void 0===pu[t]&&(pu[t]={id:t,styles:[],textStyles:[]});const n=pu[t];null!=e&&e.split(",").forEach((t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(t.match(lu)){const t=e.replace(hu,"bgFill").replace(lu,hu);n.textStyles.push(t)}n.styles.push(e)}))},Au=function(t,e){t.split(",").forEach((function(t){let n=ku(t);if(void 0===n){const e=t.trim();xu(e),n=ku(e)}n.classes.push(e)}))},Lu=function(t,e){const n=ku(t);void 0!==n&&n.textStyles.push(e)},Bu=function(t,e){const n=ku(t);void 0!==n&&n.textStyles.push(e)},Nu={parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().state,addState:xu,clear:vu,getState:ku,getStates:function(){return gu.states},getRelations:function(){return gu.relations},getClasses:function(){return pu},getDirection:()=>uu,addRelation:Eu,getDividerId:()=>(mu++,"divider-id-"+mu),setDirection:t=>{uu=t},cleanupLabel:function(t){return":"===t.substring(0,1)?t.substr(2).trim():t.trim()},lineType:{LINE:0,DOTTED_LINE:1},relationType:{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3},logDocuments:function(){Bt.info("Documents = ",fu)},getRootDoc:()=>du,setRootDoc:t=>{Bt.info("Setting root doc",t),du=t},getRootDocV2:()=>(_u({id:"root"},{id:"root",doc:du},!0),{id:"root",doc:du}),extract:t=>{let e;e=t.doc?t.doc:t,Bt.info(e),vu(!0),Bt.info("Extract",e),e.forEach((t=>{switch(t.stmt){case nu:xu(t.id.trim(),t.type,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles);break;case ru:Eu(t.state1,t.state2,t.description);break;case"classDef":Su(t.id.trim(),t.classes);break;case"applyClass":Au(t.id.trim(),t.styleClass)}}))},trimColon:t=>t&&":"===t[0]?t.substr(1).trim():t.trim(),getAccTitle:Pr,setAccTitle:Zr,getAccDescription:Yr,setAccDescription:jr,addStyleClass:Su,setCssClass:Au,addDescription:Tu,setDiagramTitle:zr,getDiagramTitle:Ur},Du={},Ou=(t,e)=>{Du[t]=e},Mu=(t,e)=>{const n=t.append("text").attr("x",2*ur().state.padding).attr("y",ur().state.textHeight+1.3*ur().state.padding).attr("font-size",ur().state.fontSize).attr("class","state-title").text(e.descriptions[0]).node().getBBox(),r=n.height,i=t.append("text").attr("x",ur().state.padding).attr("y",r+.4*ur().state.padding+ur().state.dividerMargin+ur().state.textHeight).attr("class","state-description");let a=!0,s=!0;e.descriptions.forEach((function(t){a||(!function(t,e,n){const r=t.append("tspan").attr("x",2*ur().state.padding).text(e);n||r.attr("dy",ur().state.textHeight)}(i,t,s),s=!1),a=!1}));const o=t.append("line").attr("x1",ur().state.padding).attr("y1",ur().state.padding+r+ur().state.dividerMargin/2).attr("y2",ur().state.padding+r+ur().state.dividerMargin/2).attr("class","descr-divider"),c=i.node().getBBox(),l=Math.max(c.width,n.width);return o.attr("x2",l+3*ur().state.padding),t.insert("rect",":first-child").attr("x",ur().state.padding).attr("y",ur().state.padding).attr("width",l+2*ur().state.padding).attr("height",c.height+r+2*ur().state.padding).attr("rx",ur().state.radius),t},Iu=(t,e,n)=>{const r=ur().state.padding,i=2*ur().state.padding,a=t.node().getBBox(),s=a.width,o=a.x,c=t.append("text").attr("x",0).attr("y",ur().state.titleShift).attr("font-size",ur().state.fontSize).attr("class","state-title").text(e.id),l=c.node().getBBox().width+i;let h,u=Math.max(l,s);u===s&&(u+=i);const d=t.node().getBBox();e.doc,h=o-r,l>s&&(h=(s-u)/2+r),Math.abs(o-d.x)<r&&l>s&&(h=o-(l-s)/2);const p=1-ur().state.textHeight;return t.insert("rect",":first-child").attr("x",h).attr("y",p).attr("class",n?"alt-composit":"composit").attr("width",u).attr("height",d.height+ur().state.textHeight+ur().state.titleShift+1).attr("rx","0"),c.attr("x",h+r),l<=s&&c.attr("x",o+(u-i)/2-l/2+r),t.insert("rect",":first-child").attr("x",h).attr("y",ur().state.titleShift-ur().state.textHeight-ur().state.padding).attr("width",u).attr("height",3*ur().state.textHeight).attr("rx",ur().state.radius),t.insert("rect",":first-child").attr("x",h).attr("y",ur().state.titleShift-ur().state.textHeight-ur().state.padding).attr("width",u).attr("height",d.height+3+2*ur().state.textHeight).attr("rx",ur().state.radius),t},Fu=(t,e)=>{e.attr("class","state-note");const n=e.append("rect").attr("x",0).attr("y",ur().state.padding),r=e.append("g"),{textWidth:i,textHeight:a}=((t,e,n,r)=>{let i=0;const a=r.append("text");a.style("text-anchor","start"),a.attr("class","noteText");let s=t.replace(/\r\n/g,"<br/>");s=s.replace(/\n/g,"<br/>");const o=s.split(jt.lineBreakRegex);let c=1.25*ur().state.noteMargin;for(const l of o){const t=l.trim();if(t.length>0){const r=a.append("tspan");r.text(t),0===c&&(c+=r.node().getBBox().height),i+=c,r.attr("x",e+ur().state.noteMargin),r.attr("y",n+i+1.25*ur().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}})(t,0,0,r);return n.attr("height",a+2*ur().state.noteMargin),n.attr("width",i+2*ur().state.noteMargin),n},$u=function(t,e){const n=e.id,r={id:n,label:e.id,width:0,height:0},i=t.append("g").attr("id",n).attr("class","stateGroup");"start"===e.type&&(t=>{t.append("circle").attr("class","start-state").attr("r",ur().state.sizeUnit).attr("cx",ur().state.padding+ur().state.sizeUnit).attr("cy",ur().state.padding+ur().state.sizeUnit)})(i),"end"===e.type&&(t=>{t.append("circle").attr("class","end-state-outer").attr("r",ur().state.sizeUnit+ur().state.miniPadding).attr("cx",ur().state.padding+ur().state.sizeUnit+ur().state.miniPadding).attr("cy",ur().state.padding+ur().state.sizeUnit+ur().state.miniPadding),t.append("circle").attr("class","end-state-inner").attr("r",ur().state.sizeUnit).attr("cx",ur().state.padding+ur().state.sizeUnit+2).attr("cy",ur().state.padding+ur().state.sizeUnit+2)})(i),"fork"!==e.type&&"join"!==e.type||((t,e)=>{let n=ur().state.forkWidth,r=ur().state.forkHeight;if(e.parentId){let t=n;n=r,r=t}t.append("rect").style("stroke","black").style("fill","black").attr("width",n).attr("height",r).attr("x",ur().state.padding).attr("y",ur().state.padding)})(i,e),"note"===e.type&&Fu(e.note.text,i),"divider"===e.type&&(t=>{t.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",ur().state.textHeight).attr("class","divider").attr("x2",2*ur().state.textHeight).attr("y1",0).attr("y2",0)})(i),"default"===e.type&&0===e.descriptions.length&&((t,e)=>{const n=t.append("text").attr("x",2*ur().state.padding).attr("y",ur().state.textHeight+2*ur().state.padding).attr("font-size",ur().state.fontSize).attr("class","state-title").text(e.id),r=n.node().getBBox();t.insert("rect",":first-child").attr("x",ur().state.padding).attr("y",ur().state.padding).attr("width",r.width+2*ur().state.padding).attr("height",r.height+2*ur().state.padding).attr("rx",ur().state.radius)})(i,e),"default"===e.type&&e.descriptions.length>0&&Mu(i,e);const a=i.node().getBBox();return r.width=a.width+2*ur().state.padding,r.height=a.height+2*ur().state.padding,Ou(n,r),r};let Ru=0;let Zu;const Pu={},ju=(t,e,n,r,i,a,s)=>{const c=new lt.k({compound:!0,multigraph:!0});let l,h=!0;for(l=0;l<t.length;l++)if("relation"===t[l].stmt){h=!1;break}n?c.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:h?1:Zu.edgeLengthFactor,nodeSep:h?1:50,isMultiGraph:!0}):c.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:h?1:Zu.edgeLengthFactor,nodeSep:h?1:50,ranker:"tight-tree",isMultiGraph:!0}),c.setDefaultEdgeLabel((function(){return{}})),s.db.extract(t);const u=s.db.getStates(),d=s.db.getRelations(),p=Object.keys(u);for(const o of p){const t=u[o];let l;if(n&&(t.parentId=n),t.doc){let n=e.append("g").attr("id",t.id).attr("class","stateGroup");l=ju(t.doc,n,t.id,!r,i,a,s);{n=Iu(n,t,r);let e=n.node().getBBox();l.width=e.width,l.height=e.height+Zu.padding/2,Pu[t.id]={y:Zu.compositTitleSize}}}else l=$u(e,t);if(t.note){const n={descriptions:[],id:t.id+"-note",note:t.note,type:"note"},r=$u(e,n);"left of"===t.note.position?(c.setNode(l.id+"-note",r),c.setNode(l.id,l)):(c.setNode(l.id,l),c.setNode(l.id+"-note",r)),c.setParent(l.id,l.id+"-group"),c.setParent(l.id+"-note",l.id+"-group")}else c.setNode(l.id,l)}Bt.debug("Count=",c.nodeCount(),c);let f=0;d.forEach((function(t){var e;f++,Bt.debug("Setting edge",t),c.setEdge(t.id1,t.id2,{relation:t,width:(e=t.title,e?e.length*Zu.fontSizeFactor:1),height:Zu.labelHeight*jt.getRows(t.title).length,labelpos:"c"},"id"+f)})),(0,ct.bK)(c),Bt.debug("Graph after layout",c.nodes());const g=e.node();c.nodes().forEach((function(t){if(void 0!==t&&void 0!==c.node(t)){Bt.warn("Node "+t+": "+JSON.stringify(c.node(t))),i.select("#"+g.id+" #"+t).attr("transform","translate("+(c.node(t).x-c.node(t).width/2)+","+(c.node(t).y+(Pu[t]?Pu[t].y:0)-c.node(t).height/2)+" )"),i.select("#"+g.id+" #"+t).attr("data-x-shift",c.node(t).x-c.node(t).width/2);a.querySelectorAll("#"+g.id+" #"+t+" .divider").forEach((t=>{const e=t.parentElement;let n=0,r=0;e&&(e.parentElement&&(n=e.parentElement.getBBox().width),r=parseInt(e.getAttribute("data-x-shift"),10),Number.isNaN(r)&&(r=0)),t.setAttribute("x1",0-r+8),t.setAttribute("x2",n-r-8)}))}else Bt.debug("No Node "+t+": "+JSON.stringify(c.node(t)))}));let y=g.getBBox();c.edges().forEach((function(t){void 0!==t&&void 0!==c.edge(t)&&(Bt.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(c.edge(t))),function(t,e,n){e.points=e.points.filter((t=>!Number.isNaN(t.y)));const r=e.points,i=(0,o.jvg)().x((function(t){return t.x})).y((function(t){return t.y})).curve(o.$0Z),a=t.append("path").attr("d",i(r)).attr("id","edge"+Ru).attr("class","transition");let s="";if(ur().state.arrowMarkerAbsolute&&(s=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,s=s.replace(/\(/g,"\\("),s=s.replace(/\)/g,"\\)")),a.attr("marker-end","url("+s+"#"+function(t){switch(t){case Nu.relationType.AGGREGATION:return"aggregation";case Nu.relationType.EXTENSION:return"extension";case Nu.relationType.COMPOSITION:return"composition";case Nu.relationType.DEPENDENCY:return"dependency"}}(Nu.relationType.DEPENDENCY)+"End)"),void 0!==n.title){const r=t.append("g").attr("class","stateLabel"),{x:i,y:a}=er.calcLabelPosition(e.points),s=jt.getRows(n.title);let o=0;const c=[];let l=0,h=0;for(let t=0;t<=s.length;t++){const e=r.append("text").attr("text-anchor","middle").text(s[t]).attr("x",i).attr("y",a+o),n=e.node().getBBox();if(l=Math.max(l,n.width),h=Math.min(h,n.x),Bt.info(n.x,i,a+o),0===o){const t=e.node().getBBox();o=t.height,Bt.info("Title height",o,a)}c.push(e)}let u=o*s.length;if(s.length>1){const t=(s.length-1)*o*.5;c.forEach(((e,n)=>e.attr("y",a+n*o-t))),u=o*s.length}const d=r.node().getBBox();r.insert("rect",":first-child").attr("class","box").attr("x",i-l/2-ur().state.padding/2).attr("y",a-u/2-ur().state.padding/2-3.5).attr("width",l+ur().state.padding).attr("height",u+ur().state.padding),Bt.info(d)}Ru++}(e,c.edge(t),c.edge(t).relation))})),y=g.getBBox();const m={id:n||"root",label:n||"root",width:0,height:0};return m.width=y.width+2*Zu.padding,m.height=y.height+2*Zu.padding,Bt.debug("Doc rendered",m,c),m},Yu={setConf:function(){},draw:function(t,e,n,r){Zu=ur().state;const i=ur().securityLevel;let a;"sandbox"===i&&(a=(0,o.Ys)("#i"+e));const s="sandbox"===i?(0,o.Ys)(a.nodes()[0].contentDocument.body):(0,o.Ys)("body"),c="sandbox"===i?a.nodes()[0].contentDocument:document;Bt.debug("Rendering diagram "+t);const l=s.select(`[id='${e}']`);l.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z");new lt.k({multigraph:!0,compound:!0,rankdir:"RL"}).setDefaultEdgeLabel((function(){return{}}));const h=r.db.getRootDoc();ju(h,l,void 0,!1,s,c,r);const u=Zu.padding,d=l.node().getBBox(),p=d.width+2*u,f=d.height+2*u;br(l,f,1.75*p,Zu.useMaxWidth),l.attr("viewBox",`${d.x-Zu.padding} ${d.y-Zu.padding} `+p+" "+f)}},zu="rect",Uu="rectWithTitle",Wu="statediagram",Hu=`${Wu}-state`,qu="transition",Vu=`${qu} note-edge`,Gu=`${Wu}-note`,Xu=`${Wu}-cluster`,Qu=`${Wu}-cluster-alt`,Ku="parent",Ju="note",td="----",ed=`${td}${Ju}`,nd=`${td}${Ku}`,rd="fill:none",id="fill: #333",ad="text",sd="normal";let od={},cd=0;function ld(t="",e=0,n="",r=td){return`state-${t}${null!==n&&n.length>0?`${r}${n}`:""}-${e}`}const hd=(t,e,n,r,i,a)=>{const s=n.id,o=null==(c=r[s])?"":c.classes?c.classes.join(" "):"";var c;if("root"!==s){let e=zu;!0===n.start&&(e="start"),!1===n.start&&(e="end"),n.type!==iu&&(e=n.type),od[s]||(od[s]={id:s,shape:e,description:jt.sanitizeText(s,ur()),classes:`${o} ${Hu}`});const r=od[s];n.description&&(Array.isArray(r.description)?(r.shape=Uu,r.description.push(n.description)):r.description.length>0?(r.shape=Uu,r.description===s?r.description=[n.description]:r.description=[r.description,n.description]):(r.shape=zu,r.description=n.description),r.description=jt.sanitizeTextOrArray(r.description,ur())),1===r.description.length&&r.shape===Uu&&(r.shape=zu),!r.type&&n.doc&&(Bt.info("Setting cluster for ",s,dd(n)),r.type="group",r.dir=dd(n),r.shape=n.type===au?"divider":"roundedWithTitle",r.classes=r.classes+" "+Xu+" "+(a?Qu:""));const i={labelStyle:"",shape:r.shape,labelText:r.description,classes:r.classes,style:"",id:s,dir:r.dir,domId:ld(s,cd),type:r.type,padding:15};if(n.note){const e={labelStyle:"",shape:"note",labelText:n.note.text,classes:Gu,style:"",id:s+ed+"-"+cd,domId:ld(s,cd,Ju),type:r.type,padding:15},a={labelStyle:"",shape:"noteGroup",labelText:n.note.text,classes:r.classes,style:"",id:s+nd,domId:ld(s,cd,Ku),type:"group",padding:0};cd++;const o=s+nd;t.setNode(o,a),t.setNode(e.id,e),t.setNode(s,i),t.setParent(s,o),t.setParent(e.id,o);let c=s,l=e.id;"left of"===n.note.position&&(c=e.id,l=s),t.setEdge(c,l,{arrowhead:"none",arrowType:"",style:rd,labelStyle:"",classes:Vu,arrowheadStyle:id,labelpos:"c",labelType:ad,thickness:sd})}else t.setNode(s,i)}e&&"root"!==e.id&&(Bt.trace("Setting node ",s," to be child of its parent ",e.id),t.setParent(s,e.id)),n.doc&&(Bt.trace("Adding nodes children "),ud(t,n,n.doc,r,i,!a))},ud=(t,e,n,r,i,a)=>{Bt.trace("items",n),n.forEach((n=>{switch(n.stmt){case nu:case iu:hd(t,e,n,r,i,a);break;case ru:{hd(t,e,n.state1,r,i,a),hd(t,e,n.state2,r,i,a);const s={id:"edge"+cd,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:rd,labelStyle:"",label:jt.sanitizeText(n.description,ur()),arrowheadStyle:id,labelpos:"c",labelType:ad,thickness:sd,classes:qu};t.setEdge(n.state1.id,n.state2.id,s,cd),cd++}}}))},dd=(t,e="TB")=>{let n=e;if(t.doc)for(let r=0;r<t.doc.length;r++){const e=t.doc[r];"dir"===e.stmt&&(n=e.value)}return n},pd={setConf:function(t){const e=Object.keys(t);for(const n of e)t[n]},getClasses:function(t,e){Bt.trace("Extracting classes"),e.db.clear();try{return e.parser.parse(t),e.db.extract(e.db.getRootDocV2()),e.db.getClasses()}catch(n){return n}},draw:function(t,e,n,r){Bt.info("Drawing state diagram (v2)",e),od={};let i=r.db.getDirection();void 0===i&&(i="LR");const{securityLevel:a,state:s}=ur(),c=s.nodeSpacing||50,l=s.rankSpacing||50;Bt.info(r.db.getRootDocV2()),r.db.extract(r.db.getRootDocV2()),Bt.info(r.db.getRootDocV2());const h=r.db.getStates(),u=new lt.k({multigraph:!0,compound:!0}).setGraph({rankdir:dd(r.db.getRootDocV2()),nodesep:c,ranksep:l,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}}));let d;hd(u,void 0,r.db.getRootDocV2(),h,r.db,!0),"sandbox"===a&&(d=(0,o.Ys)("#i"+e));const p="sandbox"===a?(0,o.Ys)(d.nodes()[0].contentDocument.body):(0,o.Ys)("body"),f=p.select(`[id="${e}"]`),g=p.select("#"+e+" g");Ks(g,u,["barb"],Wu,e);er.insertTitle(f,"statediagramTitleText",s.titleTopMargin,r.db.getDiagramTitle());const y=f.node().getBBox(),m=y.width+16,b=y.height+16;f.attr("class",Wu);const _=f.node().getBBox();br(f,b,m,s.useMaxWidth);const x=`${_.x-8} ${_.y-8} ${m} ${b}`;Bt.debug(`viewBox ${x}`),f.attr("viewBox",x);const v=document.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(const o of v){const t=o.getBBox(),e=document.createElementNS("http://www.w3.org/2000/svg",zu);e.setAttribute("rx",0),e.setAttribute("ry",0),e.setAttribute("width",t.width),e.setAttribute("height",t.height),o.insertBefore(e,o.firstChild)}}};var fd=function(){var t,e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,2],r=[1,5],i=[6,9,11,17,18,20,22,23,24,26],a=[1,15],s=[1,16],o=[1,17],c=[1,18],l=[1,19],h=[1,20],u=[1,24],d=[4,6,9,11,17,18,20,22,23,24,26],p={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,taskName:24,taskData:25,open_directive:26,type_directive:27,arg_directive:28,close_directive:29,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",24:"taskName",25:"taskData",26:"open_directive",27:"type_directive",28:"arg_directive",29:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 1:return a[o-1];case 3:case 7:case 8:this.$=[];break;case 4:a[o-1].push(a[o]),this.$=a[o-1];break;case 5:case 6:this.$=a[o];break;case 11:r.setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 12:this.$=a[o].trim(),r.setAccTitle(this.$);break;case 13:case 14:this.$=a[o].trim(),r.setAccDescription(this.$);break;case 15:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 16:r.addTask(a[o-1],a[o]),this.$="task";break;case 18:r.parseDirective("%%{","open_directive");break;case 19:r.parseDirective(a[o],"type_directive");break;case 20:a[o]=a[o].trim().replace(/'/g,'"'),r.parseDirective(a[o],"arg_directive");break;case 21:r.parseDirective("}%%","close_directive","journey")}},table:[{3:1,4:n,7:3,12:4,26:r},{1:[3]},e(i,[2,3],{5:6}),{3:7,4:n,7:3,12:4,26:r},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:a,18:s,20:o,22:c,23:l,24:h,26:r},{1:[2,2]},{14:22,15:[1,23],29:u},e([15,29],[2,19]),e(i,[2,8],{1:[2,1]}),e(i,[2,4]),{7:21,10:25,12:4,17:a,18:s,20:o,22:c,23:l,24:h,26:r},e(i,[2,6]),e(i,[2,7]),e(i,[2,11]),{19:[1,26]},{21:[1,27]},e(i,[2,14]),e(i,[2,15]),{25:[1,28]},e(i,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},e(i,[2,5]),e(i,[2,12]),e(i,[2,13]),e(i,[2,16]),e(d,[2,9]),{14:32,29:u},{29:[2,20]},{11:[1,33]},e(d,[2,10])],defaultActions:{5:[2,18],7:[2,2],24:[2,21],31:[2,20]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],s=this.table,o="",c=0,l=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;a.push(f);var g=u.options&&u.options.ranges;function y(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var m,b,_,x,v,k,w,C,E={};;){if(b=n[n.length-1],this.defaultActions[b]?_=this.defaultActions[b]:(null==m&&(m=y()),_=s[b]&&s[b][m]),void 0===_||!_.length||!_[0]){var T="";for(v in C=[],s[b])this.terminals_[v]&&v>2&&C.push("'"+this.terminals_[v]+"'");T=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(T,{text:u.match,token:this.terminals_[m]||m,line:u.yylineno,loc:f,expected:C})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(_[0]){case 1:n.push(m),i.push(u.yytext),a.push(u.yylloc),n.push(_[1]),m=null,l=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(k=this.productions_[_[1]][1],E.$=i[i.length-k],E._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},g&&(E._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(E,[o,l,c,d.yy,_[1],i,a].concat(h))))return x;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[_[1]][0]),i.push(E.$),a.push(E._$),w=s[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0}},f=(t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin("open_directive"),26;case 1:return this.begin("type_directive"),27;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}},t);function g(){this.yy={}}return p.lexer=f,g.prototype=p,p.Parser=g,new g}();fd.parser=fd;const gd=fd,yd=t=>null!==t.match(/^\s*journey/);let md="";const bd=[],_d=[],xd=[],vd=function(){let t=!0;for(const[e,n]of xd.entries())xd[e].processed,t=t&&n.processed;return t},kd={parseDirective:function(t,e,n){xp.parseDirective(this,t,e,n)},getConfig:()=>ur().journey,clear:function(){bd.length=0,_d.length=0,md="",xd.length=0,Rr()},setDiagramTitle:zr,getDiagramTitle:Ur,setAccTitle:Zr,getAccTitle:Pr,setAccDescription:jr,getAccDescription:Yr,addSection:function(t){md=t,bd.push(t)},getSections:function(){return bd},getTasks:function(){let t=vd();let e=0;for(;!t&&e<100;)t=vd(),e++;return _d.push(...xd),_d},addTask:function(t,e){const n=e.substr(1).split(":");let r=0,i=[];1===n.length?(r=Number(n[0]),i=[]):(r=Number(n[0]),i=n[1].split(","));const a=i.map((t=>t.trim())),s={section:md,type:md,people:a,task:t,score:r};xd.push(s)},addTaskOrg:function(t){const e={section:md,type:md,description:t,task:t,classes:[]};_d.push(e)},getActors:function(){return function(){const t=[];return _d.forEach((e=>{e.people&&t.push(...e.people)})),[...new Set(t)].sort()}()}},wd=function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},Cd=function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n},Ed=function(t,e){const n=e.text.replace(/<br\s*\/?>/gi," "),r=t.append("text");r.attr("x",e.x),r.attr("y",e.y),r.attr("class","legend"),r.style("text-anchor",e.anchor),void 0!==e.class&&r.attr("class",e.class);const i=r.append("tspan");return i.attr("x",e.x+2*e.textMargin),i.text(n),r};let Td=-1;const Sd=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},Ad=function(){function t(t,e,n,i,a,s,o,c){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function e(t,e,n,i,a,s,o,c,l){const{taskFontSize:h,taskFontFamily:u}=c,d=t.split(/<br\s*\/?>/gi);for(let p=0;p<d.length;p++){const t=p*h-h*(d.length-1)/2,c=e.append("text").attr("x",n+a/2).attr("y",i).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",u);c.append("tspan").attr("x",n+a/2).attr("dy",t).text(d[p]),c.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(c,o)}}function n(t,n,i,a,s,o,c,l){const h=n.append("switch"),u=h.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");u.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,i,a,s,o,c,l),r(u,c)}function r(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return function(r){return"fo"===r.textPlacement?n:"old"===r.textPlacement?t:e}}(),Ld=Cd,Bd=function(t,e,n){const r=t.append("g"),i=Sd();i.x=e.x,i.y=e.y,i.fill=e.fill,i.width=n.width,i.height=n.height,i.class="journey-section section-type-"+e.num,i.rx=3,i.ry=3,wd(r,i),Ad(n)(e.text,r,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+e.num},n,e.colour)},Nd=Ed,Dd=function(t,e,n){const r=e.x+n.width/2,i=t.append("g");Td++;i.append("line").attr("id","task"+Td).attr("x1",r).attr("y1",e.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),function(t,e){const n=15,r=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",n).attr("stroke-width",2).attr("overflow","visible"),i=t.append("g");i.append("circle").attr("cx",e.cx-5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",e.cx+5).attr("cy",e.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),e.score>3?function(t){const r=(0,o.Nb1)().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",r).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}(i):e.score<3?function(t){const r=(0,o.Nb1)().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(n/2.2);t.append("path").attr("class","mouth").attr("d",r).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}(i):i.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}(i,{cx:r,cy:300+30*(5-e.score),score:e.score});const a=Sd();a.x=e.x,a.y=e.y,a.fill=e.fill,a.width=n.width,a.height=n.height,a.class="task task-type-"+e.num,a.rx=3,a.ry=3,wd(i,a);let s=e.x+14;e.people.forEach((t=>{const n=e.actors[t].color,r={cx:s,cy:e.y,r:7,fill:n,stroke:"#000",title:t,pos:e.actors[t].position};Cd(i,r),s+=10})),Ad(n)(e.task,i,a.x,a.y,a.width,a.height,{class:"task"},n,e.colour)},Od=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},Md={};const Id=ur().journey,Fd=Id.leftMargin,$d={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},updateVal:function(t,e,n,r){void 0===t[e]?t[e]=n:t[e]=r(n,t[e])},updateBounds:function(t,e,n,r){const i=ur().journey,a=this;let s=0;var o;this.sequenceItems.forEach((function(c){s++;const l=a.sequenceItems.length-s+1;a.updateVal(c,"starty",e-l*i.boxMargin,Math.min),a.updateVal(c,"stopy",r+l*i.boxMargin,Math.max),a.updateVal($d.data,"startx",t-l*i.boxMargin,Math.min),a.updateVal($d.data,"stopx",n+l*i.boxMargin,Math.max),"activation"!==o&&(a.updateVal(c,"startx",t-l*i.boxMargin,Math.min),a.updateVal(c,"stopx",n+l*i.boxMargin,Math.max),a.updateVal($d.data,"starty",e-l*i.boxMargin,Math.min),a.updateVal($d.data,"stopy",r+l*i.boxMargin,Math.max))}))},insert:function(t,e,n,r){const i=Math.min(t,n),a=Math.max(t,n),s=Math.min(e,r),o=Math.max(e,r);this.updateVal($d.data,"startx",i,Math.min),this.updateVal($d.data,"starty",s,Math.min),this.updateVal($d.data,"stopx",a,Math.max),this.updateVal($d.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return this.data}},Rd=Id.sectionFills,Zd=Id.sectionColours,Pd=function(t,e,n){const r=ur().journey;let i="";const a=n+(2*r.height+r.diagramMarginY);let s=0,o="#CCC",c="black",l=0;for(const[h,u]of e.entries()){if(i!==u.section){o=Rd[s%Rd.length],l=s%Rd.length,c=Zd[s%Zd.length];const e={x:h*r.taskMargin+h*r.width+Fd,y:50,text:u.section,fill:o,num:l,colour:c};Bd(t,e,r),i=u.section,s++}const e=u.people.reduce(((t,e)=>(Md[e]&&(t[e]=Md[e]),t)),{});u.x=h*r.taskMargin+h*r.width+Fd,u.y=a,u.width=r.diagramMarginX,u.height=r.diagramMarginY,u.colour=c,u.fill=o,u.num=l,u.actors=e,Dd(t,u,r),$d.insert(u.x,u.y,u.x+u.width+r.taskMargin,450)}},jd={setConf:function(t){Object.keys(t).forEach((function(e){Id[e]=t[e]}))},draw:function(t,e,n,r){const i=ur().journey;r.db.clear(),r.parser.parse(t+"\n");const a=ur().securityLevel;let s;"sandbox"===a&&(s=(0,o.Ys)("#i"+e));const c="sandbox"===a?(0,o.Ys)(s.nodes()[0].contentDocument.body):(0,o.Ys)("body");$d.init();const l=c.select("#"+e);Od(l);const h=r.db.getTasks(),u=r.db.getDiagramTitle(),d=r.db.getActors();for(const o in Md)delete Md[o];let p=0;d.forEach((t=>{Md[t]={color:i.actorColours[p%i.actorColours.length],position:p},p++})),function(t){const e=ur().journey;let n=60;Object.keys(Md).forEach((r=>{const i=Md[r].color,a={cx:20,cy:n,r:7,fill:i,stroke:"#000",pos:Md[r].position};Ld(t,a);const s={x:40,y:n+7,fill:"#666",text:r,textMargin:5|e.boxTextMargin};Nd(t,s),n+=20}))}(l),$d.insert(0,0,Fd,50*Object.keys(Md).length),Pd(l,h,0);const f=$d.getBounds();u&&l.append("text").text(u).attr("x",Fd).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const g=f.stopy-f.starty+2*i.diagramMarginY,y=Fd+f.stopx+2*i.diagramMarginX;br(l,g,y,i.useMaxWidth),l.append("line").attr("x1",Fd).attr("y1",4*i.height).attr("x2",y-Fd-4).attr("y2",4*i.height).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const m=u?70:0;l.attr("viewBox",`${f.startx} -25 ${y} ${g+m}`),l.attr("preserveAspectRatio","xMinYMin meet"),l.attr("height",g+m+25)}};let Yd={};const zd={setConf:function(t){Yd={...Yd,...t}},draw:(t,e,n)=>{try{Bt.debug("Renering svg for syntax error\n");const t=(0,o.Ys)("#"+e),r=t.append("g");r.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),r.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),r.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),r.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),r.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),r.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),r.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),r.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+n),t.attr("height",100),t.attr("width",500),t.attr("viewBox","768 0 912 512")}catch(i){Bt.error("Error while rendering info diagram"),Bt.error((r=i)instanceof Error?r.message:String(r))}var r}},Ud="flowchart-elk",Wd={id:Ud,detector:(t,e)=>{var n;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&"elk"===(null==(n=null==e?void 0:e.flowchart)?void 0:n.defaultRenderer))},loader:async()=>{const{diagram:t}=await n.e(4178).then(n.bind(n,64178));return{id:Ud,diagram:t}}},Hd="timeline",qd={id:Hd,detector:t=>null!==t.match(/^\s*timeline/),loader:async()=>{const{diagram:t}=await n.e(7171).then(n.bind(n,67171));return{id:Hd,diagram:t}}},Vd="mindmap",Gd={id:Vd,detector:t=>null!==t.match(/^\s*mindmap/),loader:async()=>{const{diagram:t}=await n.e(7735).then(n.bind(n,37735));return{id:Vd,diagram:t}}};let Xd=!1;const Qd=()=>{Xd||(Xd=!0,Bn(Wd,qd,Gd),ri("error",{db:{clear:()=>{}},styles:kr,renderer:zd,parser:{parser:{yy:{}},parse:()=>{}},init:()=>{}},(t=>"error"===t.toLowerCase().trim())),ri("---",{db:{clear:()=>{}},styles:kr,renderer:zd,parser:{parser:{yy:{}},parse:()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with unindented `---` blocks")}},init:()=>null},(t=>t.toLowerCase().trimStart().startsWith("---"))),ri("c4",{parser:Yi,db:ra,renderer:Ia,styles:Nr,init:t=>{Ia.setConf(t.c4)}},zi),ri("class",{parser:$a,db:es,renderer:fs,styles:xr,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,es.clear()}},Ra),ri("classDiagram",{parser:$a,db:es,renderer:no,styles:xr,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,es.clear()}},Za),ri("er",{parser:io,db:lo,renderer:ko,styles:vr},ao),ri("gantt",{parser:Nc,db:hl,renderer:pl,styles:Cr},Dc),ri("info",{parser:gl,db:bl,renderer:_l,styles:Er},xl),ri("pie",{parser:kl,db:Tl,renderer:Bl,styles:Tr},wl),ri("requirement",{parser:Dl,db:Zl,renderer:Xl,styles:Sr},Ol),ri("sequence",{parser:Kl,db:_h,renderer:Qh,styles:Ar,init:t=>{if(t.sequence||(t.sequence={}),t.sequence.arrowMarkerAbsolute=t.arrowMarkerAbsolute,"sequenceDiagram"in t)throw new Error("`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.");_h.setWrap(t.wrap),Qh.setConf(t.sequence)}},Jl),ri("state",{parser:Jh,db:Nu,renderer:Yu,styles:Lr,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Nu.clear()}},tu),ri("stateDiagram",{parser:Jh,db:Nu,renderer:pd,styles:Lr,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Nu.clear()}},eu),ri("journey",{parser:gd,db:kd,renderer:jd,styles:Br,init:t=>{jd.setConf(t.journey),kd.clear()}},yd),ri("flowchart",{parser:Co,db:kc,renderer:Lc,styles:wr,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ec(t.flowchart),kc.clear(),kc.setGen("gen-1")}},Eo),ri("flowchart-v2",{parser:Co,db:kc,renderer:Lc,styles:wr,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,hr({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Lc.setConf(t.flowchart),kc.clear(),kc.setGen("gen-2")}},To),ri("gitGraph",{parser:si,db:Ci,renderer:Zi,styles:Pi},oi))};class Kd{constructor(t,e){var n,r;this.txt=t,this.type="graph",this.detectTypeFailed=!1;const i=ur();this.txt=t;try{this.type=Ln(t,i)}catch(o){this.handleError(o,e),this.type="error",this.detectTypeFailed=!0}const a=ii(this.type);Bt.debug("Type "+this.type),this.db=a.db,null==(r=(n=this.db).clear)||r.call(n),this.renderer=a.renderer,this.parser=a.parser;const s=this.parser.parse.bind(this.parser);this.parser.parse=t=>s(function(t,e){var n;const r=t.match(En);if(r){const i=Cn(r[1],{schema:wn});return(null==i?void 0:i.title)&&(null==(n=e.setDiagramTitle)||n.call(e,i.title)),t.slice(r[0].length)}return t}(t,this.db)),this.parser.parser.yy=this.db,a.init&&(a.init(i),Bt.info("Initialized diagram "+this.type,i)),this.txt+="\n",this.parse(this.txt,e)}parse(t,e){var n,r;if(this.detectTypeFailed)return!1;try{return t+="\n",null==(r=(n=this.db).clear)||r.call(n),this.parser.parse(t),!0}catch(i){this.handleError(i,e)}return!1}handleError(t,e){if(void 0===e)throw t;Jn(t)?e(t.str,t.hash):e(t)}getParser(){return this.parser}getType(){return this.type}}const Jd=(t,e)=>{const n=Ln(t,ur());try{ii(n)}catch(r){const i=An[n].loader;if(!i)throw new Error(`Diagram ${n} not found.`);return i().then((({diagram:r})=>(ri(n,r,void 0),new Kd(t,e))))}return new Kd(t,e)},tp=Kd,ep="graphics-document document";const np=["graph","flowchart","flowchart-v2","stateDiagram","stateDiagram-v2"],rp="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",ip="sandbox",ap="loose",sp="http://www.w3.org/1999/xlink",op="http://www.w3.org/1999/xhtml",cp=["foreignobject"],lp=["dominant-baseline"];const hp=function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,(function(t){return t.substring(0,t.length-1)})),e=e.replace(/classDef.*:\S*#.*;/g,(function(t){return t.substring(0,t.length-1)})),e=e.replace(/#\w+;/g,(function(t){const e=t.substring(1,t.length-1);return/^\+?\d+$/.test(e)?"\ufb02\xb0\xb0"+e+"\xb6\xdf":"\ufb02\xb0"+e+"\xb6\xdf"})),e},up=function(t){let e=t;return e=e.replace(/\ufb02\xb0\xb0/g,"&#"),e=e.replace(/\ufb02\xb0/g,"&"),e=e.replace(/\xb6\xdf/g,";"),e},dp=(t,e,n=[])=>`\n.${t} ${e} { ${n.join(" !important; ")} !important; }`,pp=(t,e,n,r)=>{const i=((t,e,n={})=>{var r;let i="";if(void 0!==t.themeCSS&&(i+=`\n${t.themeCSS}`),void 0!==t.fontFamily&&(i+=`\n:root { --mermaid-font-family: ${t.fontFamily}}`),void 0!==t.altFontFamily&&(i+=`\n:root { --mermaid-alt-font-family: ${t.altFontFamily}}`),!(0,At.Z)(n)&&np.includes(e)){const e=t.htmlLabels||(null==(r=t.flowchart)?void 0:r.htmlLabels)?["> *","span"]:["rect","polygon","ellipse","circle","path"];for(const t in n){const r=n[t];(0,At.Z)(r.styles)||e.forEach((t=>{i+=dp(r.id,t,r.styles)})),(0,At.Z)(r.textStyles)||(i+=dp(r.id,"tspan",r.textStyles))}}return i})(t,e,n);return M(rt(`${r}{${Or(e,i,t.themeVariables)}}`),I)},fp=(t="",e,n)=>{let r=t;return n||e||(r=r.replace(/marker-end="url\(.*?#/g,'marker-end="url(#')),r=up(r),r=r.replace(/<br>/g,"<br/>"),r},gp=(t="",e)=>`<iframe style="width:100%;height:${e?e.viewBox.baseVal.height+"px":"100%"};border:0;margin:0;" src="data:text/html;base64,${btoa('<body style="margin:0">'+t+"</body>")}" sandbox="allow-top-navigation-by-user-activation allow-popups">\n The "iframe" tag is not supported by your browser.\n</iframe>`,yp=(t,e,n,r,i)=>{const a=t.append("div");a.attr("id",n),r&&a.attr("style",r);const s=a.append("svg").attr("id",e).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return i&&s.attr("xmlns:xlink",i),s.append("g"),t};function mp(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}const bp=(t,e,n,r)=>{var i,a,s;null==(i=t.getElementById(e))||i.remove(),null==(a=t.getElementById(n))||a.remove(),null==(s=t.getElementById(r))||s.remove()};function _p(t,e,n,r){var i,a;a=t,(i=e).attr("role",ep),(0,At.Z)(a)||i.attr("aria-roledescription",a),function(t,e,n,r){if(void 0!==t.insert&&(e||n)){if(n){const e="chart-desc-"+r;t.attr("aria-describedby",e),t.insert("desc",":first-child").attr("id",e).text(n)}if(e){const n="chart-title-"+r;t.attr("aria-labelledby",n),t.insert("title",":first-child").attr("id",n).text(e)}}}(e,n,r,e.attr("id"))}const xp=Object.freeze({render:function(t,e,n,r){var i,a,s,c;Qd(),fr();const l=er.detectInit(e);l&&(Qn(l),pr(l));const u=ur();Bt.debug(u),e.length>((null==u?void 0:u.maxTextSize)??5e4)&&(e=rp),e=e.replace(/\r\n?/g,"\n");const d="#"+t,p="i"+t,f="#"+p,g="d"+t,y="#"+g;let m=(0,o.Ys)("body");const b=u.securityLevel===ip,_=u.securityLevel===ap,x=u.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),b){const t=mp((0,o.Ys)(r),p);m=(0,o.Ys)(t.nodes()[0].contentDocument.body),m.node().style.margin=0}else m=(0,o.Ys)(r);yp(m,t,g,`font-family: ${x}`,sp)}else{if(bp(document,t,g,p),b){const t=mp((0,o.Ys)("body"),p);m=(0,o.Ys)(t.nodes()[0].contentDocument.body),m.node().style.margin=0}else m=(0,o.Ys)("body");yp(m,t,g)}let v,k;e=hp(e);try{if(v=Jd(e),"then"in v)throw new Error("Diagram is a promise. Use renderAsync.")}catch(O){v=new tp("error"),k=O}const w=m.select(y).node(),C=v.type,E=w.firstChild,T=E.firstChild,S=np.includes(C)?v.renderer.getClasses(e,v):{},A=pp(u,C,S,d),L=document.createElement("style");L.innerHTML=A,E.insertBefore(L,T);try{v.renderer.draw(e,t,nr,v)}catch(M){throw zd.draw(e,t,nr),M}_p(C,m.select(`${y} svg`),null==(a=(i=v.db).getAccTitle)?void 0:a.call(i),null==(c=(s=v.db).getAccDescription)?void 0:c.call(s)),m.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",op);let B=m.select(y).node().innerHTML;if(Bt.debug("config.arrowMarkerAbsolute",u.arrowMarkerAbsolute),B=fp(B,b,Zt(u.arrowMarkerAbsolute)),b){const t=m.select(y+" svg").node();B=gp(B,t)}else _||(B=h().sanitize(B,{ADD_TAGS:cp,ADD_ATTR:lp}));if(void 0!==n)switch(C){case"flowchart":case"flowchart-v2":n(B,kc.bindFunctions);break;case"gantt":n(B,hl.bindFunctions);break;case"class":case"classDiagram":n(B,es.bindFunctions);break;default:n(B)}else Bt.debug("CB = undefined!");vh();const N=b?f:y,D=(0,o.Ys)(N).node();if(D&&"remove"in D&&D.remove(),k)throw k;return B},renderAsync:async function(t,e,n,r){var i,a,s,c;Qd(),fr();const l=er.detectInit(e);l&&(Qn(l),pr(l));const u=ur();Bt.debug(u),e.length>((null==u?void 0:u.maxTextSize)??5e4)&&(e=rp),e=e.replace(/\r\n?/g,"\n");const d="#"+t,p="i"+t,f="#"+p,g="d"+t,y="#"+g;let m=(0,o.Ys)("body");const b=u.securityLevel===ip,_=u.securityLevel===ap,x=u.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),b){const t=mp((0,o.Ys)(r),p);m=(0,o.Ys)(t.nodes()[0].contentDocument.body),m.node().style.margin=0}else m=(0,o.Ys)(r);yp(m,t,g,`font-family: ${x}`,sp)}else{if(bp(document,t,g,p),b){const t=mp((0,o.Ys)("body"),p);m=(0,o.Ys)(t.nodes()[0].contentDocument.body),m.node().style.margin=0}else m=(0,o.Ys)("body");yp(m,t,g)}let v,k;e=hp(e);try{v=await Jd(e)}catch(O){v=new tp("error"),k=O}const w=m.select(y).node(),C=v.type,E=w.firstChild,T=E.firstChild,S=np.includes(C)?v.renderer.getClasses(e,v):{},A=pp(u,C,S,d),L=document.createElement("style");L.innerHTML=A,E.insertBefore(L,T);try{await v.renderer.draw(e,t,nr,v)}catch(M){throw zd.draw(e,t,nr),M}_p(C,m.select(`${y} svg`),null==(a=(i=v.db).getAccTitle)?void 0:a.call(i),null==(c=(s=v.db).getAccDescription)?void 0:c.call(s)),m.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",op);let B=m.select(y).node().innerHTML;if(Bt.debug("config.arrowMarkerAbsolute",u.arrowMarkerAbsolute),B=fp(B,b,Zt(u.arrowMarkerAbsolute)),b){const t=m.select(y+" svg").node();B=gp(B,t)}else _||(B=h().sanitize(B,{ADD_TAGS:cp,ADD_ATTR:lp}));if(void 0!==n)switch(C){case"flowchart":case"flowchart-v2":n(B,kc.bindFunctions);break;case"gantt":n(B,hl.bindFunctions);break;case"class":case"classDiagram":n(B,es.bindFunctions);break;default:n(B)}else Bt.debug("CB = undefined!");vh();const N=b?f:y,D=(0,o.Ys)(N).node();if(D&&"remove"in D&&D.remove(),k)throw k;return B},parse:function(t,e){return Qd(),new tp(t,e).parse(t,e)},parseAsync:async function(t,e){return Qd(),(await Jd(t,e)).parse(t,e)},parseDirective:Vr,initialize:function(t={}){var e;(null==t?void 0:t.fontFamily)&&!(null==(e=t.themeVariables)?void 0:e.fontFamily)&&(t.themeVariables={fontFamily:t.fontFamily}),ir=On({},t),(null==t?void 0:t.theme)&&t.theme in Ht?t.themeVariables=Ht[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Ht.default.getThemeVariables(t.themeVariables));const n="object"==typeof t?(t=>(ar=On({},rr),ar=On(ar,t),t.theme&&Ht[t.theme]&&(ar.themeVariables=Ht[t.theme].getThemeVariables(t.themeVariables)),cr(ar,sr),ar))(t):lr();Nt(n.logLevel),Qd()},getConfig:ur,setConfig:hr,getSiteConfig:lr,updateSiteConfig:t=>(ar=On(ar,t),cr(ar,sr),ar),reset:()=>{fr()},globalReset:()=>{fr(rr)},defaultConfig:rr});Nt(ur().logLevel),fr(ur());const vp=(t,e,n)=>{Bt.warn(t),Jn(t)?(n&&n(t.str,t.hash),e.push({...t,message:t.str,error:t})):(n&&n(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},kp=async function(t,e,n){const i=xp.getConfig();let a;if(t&&(Sp.sequenceConfig=t),Bt.debug((n?"":"No ")+"Callback function found"),void 0===e)a=document.querySelectorAll(".mermaid");else if("string"==typeof e)a=document.querySelectorAll(e);else if(e instanceof HTMLElement)a=[e];else{if(!(e instanceof NodeList))throw new Error("Invalid argument nodes for mermaid.init");a=e}Bt.debug(`Found ${a.length} diagrams`),void 0!==(null==t?void 0:t.startOnLoad)&&(Bt.debug("Start On Load: "+(null==t?void 0:t.startOnLoad)),xp.updateSiteConfig({startOnLoad:null==t?void 0:t.startOnLoad}));const s=new er.initIdGenerator(i.deterministicIds,i.deterministicIDSeed);let o;const c=[];for(const h of Array.from(a)){if(Bt.info("Rendering diagram: "+h.id),h.getAttribute("data-processed"))continue;h.setAttribute("data-processed","true");const t=`mermaid-${s.next()}`;o=h.innerHTML,o=r(er.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const e=er.detectInit(o);e&&Bt.debug("Detected early reinit: ",e);try{await xp.renderAsync(t,o,((e,r)=>{h.innerHTML=e,void 0!==n&&n(t),r&&r(h)}),h)}catch(l){vp(l,c,Sp.parseError)}}if(c.length>0)throw c[0]},wp=function(){if(Sp.startOnLoad){const{startOnLoad:t}=xp.getConfig();t&&Sp.init().catch((t=>Bt.error("Mermaid failed to initialize",t)))}};"undefined"!=typeof document&&window.addEventListener("load",wp,!1);const Cp=[];let Ep=!1;const Tp=async()=>{if(!Ep){for(Ep=!0;Cp.length>0;){const e=Cp.shift();if(e)try{await e()}catch(t){Bt.error("Error executing queue",t)}}Ep=!1}},Sp={startOnLoad:!0,diagrams:{},mermaidAPI:xp,parse:t=>xp.parse(t,Sp.parseError),parseAsync:t=>new Promise(((e,n)=>{Cp.push((()=>new Promise(((r,i)=>{xp.parseAsync(t,Sp.parseError).then((t=>{r(t),e(t)}),(t=>{Bt.error("Error parsing",t),i(t),n(t)}))})))),Tp().catch(n)})),render:xp.render,renderAsync:(t,e,n,r)=>new Promise(((i,a)=>{Cp.push((()=>new Promise(((s,o)=>{xp.renderAsync(t,e,n,r).then((t=>{s(t),i(t)}),(t=>{Bt.error("Error parsing",t),o(t),a(t)}))})))),Tp().catch(a)})),init:async function(t,e,n){try{await kp(t,e,n)}catch(r){Bt.warn("Syntax Error rendering"),Jn(r)&&Bt.warn(r.str),Sp.parseError&&Sp.parseError(r)}},initThrowsErrors:function(t,e,n){const i=xp.getConfig();let a;if(t&&(Sp.sequenceConfig=t),Bt.debug((n?"":"No ")+"Callback function found"),void 0===e)a=document.querySelectorAll(".mermaid");else if("string"==typeof e)a=document.querySelectorAll(e);else if(e instanceof HTMLElement)a=[e];else{if(!(e instanceof NodeList))throw new Error("Invalid argument nodes for mermaid.init");a=e}Bt.debug(`Found ${a.length} diagrams`),void 0!==(null==t?void 0:t.startOnLoad)&&(Bt.debug("Start On Load: "+(null==t?void 0:t.startOnLoad)),xp.updateSiteConfig({startOnLoad:null==t?void 0:t.startOnLoad}));const s=new er.initIdGenerator(i.deterministicIds,i.deterministicIDSeed);let o;const c=[];for(const h of Array.from(a)){if(Bt.info("Rendering diagram: "+h.id),h.getAttribute("data-processed"))continue;h.setAttribute("data-processed","true");const t=`mermaid-${s.next()}`;o=h.innerHTML,o=r(er.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const e=er.detectInit(o);e&&Bt.debug("Detected early reinit: ",e);try{xp.render(t,o,((e,r)=>{h.innerHTML=e,void 0!==n&&n(t),r&&r(h)}),h)}catch(l){vp(l,c,Sp.parseError)}}if(c.length>0)throw c[0]},initThrowsErrorsAsync:kp,registerExternalDiagrams:async(t,{lazyLoad:e=!0}={})=>{e?Bn(...t):await(async(...t)=>{Bt.debug(`Loading ${t.length} external diagrams`);const e=(await Promise.allSettled(t.map((async({id:t,detector:e,loader:n})=>{const{diagram:r}=await n();ri(t,r,e)})))).filter((t=>"rejected"===t.status));if(e.length>0){Bt.error(`Failed to load ${e.length} external diagrams`);for(const t of e)Bt.error(t);throw new Error(`Failed to load ${e.length} external diagrams`)}})(...t)},initialize:function(t){xp.initialize(t)},parseError:void 0,contentLoaded:wp,setParseErrorHandler:function(t){Sp.parseError=t}}},6324:(t,e)=>{function n(t){let e,n=[];for(let r of t.split(",").map((t=>t.trim())))if(/^-?\d+$/.test(r))n.push(parseInt(r,10));else if(e=r.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[t,r,i,a]=e;if(r&&a){r=parseInt(r),a=parseInt(a);const t=r<a?1:-1;"-"!==i&&".."!==i&&"\u2025"!==i||(a+=t);for(let e=r;e!==a;e+=t)n.push(e)}}return n}e.default=n,t.exports=n},5949:(t,e,n)=>{"use strict";function r(t,e){let n;if(void 0===e)for(const r of t)null!=r&&(n<r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function i(t,e){let n;if(void 0===e)for(const r of t)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function a(t){return t}n.d(e,{Nb1:()=>so,LLu:()=>b,F5q:()=>m,$0Z:()=>xo,Dts:()=>ko,WQY:()=>Co,qpX:()=>To,u93:()=>So,tFB:()=>Lo,YY7:()=>Do,OvA:()=>Mo,dCK:()=>Fo,zgE:()=>Zo,fGX:()=>jo,$m7:()=>zo,c_6:()=>lo,fxm:()=>Wo,FdL:()=>Jo,ak_:()=>tc,SxZ:()=>rc,eA_:()=>ac,jsv:()=>oc,iJ:()=>sc,JHv:()=>gr,jvg:()=>po,Fp7:()=>r,VV$:()=>i,ve8:()=>yo,BYU:()=>ci,PKp:()=>gi,Xf:()=>Ns,Ys:()=>Ds,td_:()=>Os,YPS:()=>Vn,rr1:()=>Di,i$Z:()=>ha,WQD:()=>Bi,Z_i:()=>Ai,F0B:()=>Qi,NGh:()=>Fi});var s=1,o=2,c=3,l=4,h=1e-6;function u(t){return"translate("+t+",0)"}function d(t){return"translate(0,"+t+")"}function p(t){return e=>+t(e)}function f(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function g(){return!this.__axis}function y(t,e){var n=[],r=null,i=null,y=6,m=6,b=3,_="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,x=t===s||t===l?-1:1,v=t===l||t===o?"x":"y",k=t===s||t===c?u:d;function w(u){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,w=null==i?e.tickFormat?e.tickFormat.apply(e,n):a:i,C=Math.max(y,0)+b,E=e.range(),T=+E[0]+_,S=+E[E.length-1]+_,A=(e.bandwidth?f:p)(e.copy(),_),L=u.selection?u.selection():u,B=L.selectAll(".domain").data([null]),N=L.selectAll(".tick").data(d,e).order(),D=N.exit(),O=N.enter().append("g").attr("class","tick"),M=N.select("line"),I=N.select("text");B=B.merge(B.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),N=N.merge(O),M=M.merge(O.append("line").attr("stroke","currentColor").attr(v+"2",x*y)),I=I.merge(O.append("text").attr("fill","currentColor").attr(v,x*C).attr("dy",t===s?"0em":t===c?"0.71em":"0.32em")),u!==L&&(B=B.transition(u),N=N.transition(u),M=M.transition(u),I=I.transition(u),D=D.transition(u).attr("opacity",h).attr("transform",(function(t){return isFinite(t=A(t))?k(t+_):this.getAttribute("transform")})),O.attr("opacity",h).attr("transform",(function(t){var e=this.parentNode.__axis;return k((e&&isFinite(e=e(t))?e:A(t))+_)}))),D.remove(),B.attr("d",t===l||t===o?m?"M"+x*m+","+T+"H"+_+"V"+S+"H"+x*m:"M"+_+","+T+"V"+S:m?"M"+T+","+x*m+"V"+_+"H"+S+"V"+x*m:"M"+T+","+_+"H"+S),N.attr("opacity",1).attr("transform",(function(t){return k(A(t)+_)})),M.attr(v+"2",x*y),I.attr(v,x*C).text(w),L.filter(g).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===o?"start":t===l?"end":"middle"),L.each((function(){this.__axis=A}))}return w.scale=function(t){return arguments.length?(e=t,w):e},w.ticks=function(){return n=Array.from(arguments),w},w.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),w):n.slice()},w.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),w):r&&r.slice()},w.tickFormat=function(t){return arguments.length?(i=t,w):i},w.tickSize=function(t){return arguments.length?(y=m=+t,w):y},w.tickSizeInner=function(t){return arguments.length?(y=+t,w):y},w.tickSizeOuter=function(t){return arguments.length?(m=+t,w):m},w.tickPadding=function(t){return arguments.length?(b=+t,w):b},w.offset=function(t){return arguments.length?(_=+t,w):_},w}function m(t){return y(s,t)}function b(t){return y(c,t)}function _(){}function x(t){return null==t?_:function(){return this.querySelector(t)}}function v(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function k(){return[]}function w(t){return null==t?k:function(){return this.querySelectorAll(t)}}function C(t){return function(){return this.matches(t)}}function E(t){return function(e){return e.matches(t)}}var T=Array.prototype.find;function S(){return this.firstElementChild}var A=Array.prototype.filter;function L(){return Array.from(this.children)}function B(t){return new Array(t.length)}function N(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function D(t,e,n,r,i,a){for(var s,o=0,c=e.length,l=a.length;o<l;++o)(s=e[o])?(s.__data__=a[o],r[o]=s):n[o]=new N(t,a[o]);for(;o<c;++o)(s=e[o])&&(i[o]=s)}function O(t,e,n,r,i,a,s){var o,c,l,h=new Map,u=e.length,d=a.length,p=new Array(u);for(o=0;o<u;++o)(c=e[o])&&(p[o]=l=s.call(c,c.__data__,o,e)+"",h.has(l)?i[o]=c:h.set(l,c));for(o=0;o<d;++o)l=s.call(t,a[o],o,a)+"",(c=h.get(l))?(r[o]=c,c.__data__=a[o],h.delete(l)):n[o]=new N(t,a[o]);for(o=0;o<u;++o)(c=e[o])&&h.get(p[o])===c&&(i[o]=c)}function M(t){return t.__data__}function I(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function F(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}N.prototype={constructor:N,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var $="http://www.w3.org/1999/xhtml";const R={svg:"http://www.w3.org/2000/svg",xhtml:$,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Z(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),R.hasOwnProperty(e)?{space:R[e],local:t}:t}function P(t){return function(){this.removeAttribute(t)}}function j(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Y(t,e){return function(){this.setAttribute(t,e)}}function z(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function U(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function W(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function H(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function q(t){return function(){this.style.removeProperty(t)}}function V(t,e,n){return function(){this.style.setProperty(t,e,n)}}function G(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function X(t,e){return t.style.getPropertyValue(e)||H(t).getComputedStyle(t,null).getPropertyValue(e)}function Q(t){return function(){delete this[t]}}function K(t,e){return function(){this[t]=e}}function J(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function tt(t){return t.trim().split(/^|\s+/)}function et(t){return t.classList||new nt(t)}function nt(t){this._node=t,this._names=tt(t.getAttribute("class")||"")}function rt(t,e){for(var n=et(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function it(t,e){for(var n=et(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function at(t){return function(){rt(this,t)}}function st(t){return function(){it(this,t)}}function ot(t,e){return function(){(e.apply(this,arguments)?rt:it)(this,t)}}function ct(){this.textContent=""}function lt(t){return function(){this.textContent=t}}function ht(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function ut(){this.innerHTML=""}function dt(t){return function(){this.innerHTML=t}}function pt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function ft(){this.nextSibling&&this.parentNode.appendChild(this)}function gt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===$&&e.documentElement.namespaceURI===$?e.createElement(t):e.createElementNS(n,t)}}function mt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function bt(t){var e=Z(t);return(e.local?mt:yt)(e)}function _t(){return null}function xt(){var t=this.parentNode;t&&t.removeChild(this)}function vt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function kt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function wt(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r<a;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Ct(t,e,n){return function(){var r,i=this.__on,a=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var s=0,o=i.length;s<o;++s)if((r=i[s]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=e);this.addEventListener(t.type,a,n),r={type:t.type,name:t.name,value:e,listener:a,options:n},i?i.push(r):this.__on=[r]}}function Et(t,e,n){var r=H(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Tt(t,e){return function(){return Et(this,t,e)}}function St(t,e){return function(){return Et(this,t,e.apply(this,arguments))}}nt.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var At=[null];function Lt(t,e){this._groups=t,this._parents=e}function Bt(){return new Lt([[document.documentElement]],At)}Lt.prototype=Bt.prototype={constructor:Lt,select:function(t){"function"!=typeof t&&(t=x(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,s,o=e[i],c=o.length,l=r[i]=new Array(c),h=0;h<c;++h)(a=o[h])&&(s=t.call(a,a.__data__,h,o))&&("__data__"in a&&(s.__data__=a.__data__),l[h]=s);return new Lt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return v(t.apply(this,arguments))}}(t):w(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var s,o=e[a],c=o.length,l=0;l<c;++l)(s=o[l])&&(r.push(t.call(s,s.__data__,l,o)),i.push(s));return new Lt(r,i)},selectChild:function(t){return this.select(null==t?S:function(t){return function(){return T.call(this.children,t)}}("function"==typeof t?t:E(t)))},selectChildren:function(t){return this.selectAll(null==t?L:function(t){return function(){return A.call(this.children,t)}}("function"==typeof t?t:E(t)))},filter:function(t){"function"!=typeof t&&(t=C(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,s=e[i],o=s.length,c=r[i]=[],l=0;l<o;++l)(a=s[l])&&t.call(a,a.__data__,l,s)&&c.push(a);return new Lt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,M);var n,r=e?O:D,i=this._parents,a=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var s=a.length,o=new Array(s),c=new Array(s),l=new Array(s),h=0;h<s;++h){var u=i[h],d=a[h],p=d.length,f=I(t.call(u,u&&u.__data__,h,i)),g=f.length,y=c[h]=new Array(g),m=o[h]=new Array(g);r(u,d,y,m,l[h]=new Array(p),f,e);for(var b,_,x=0,v=0;x<g;++x)if(b=y[x]){for(x>=v&&(v=x+1);!(_=m[v])&&++v<g;);b._next=_||null}}return(o=new Lt(o,i))._enter=c,o._exit=l,o},enter:function(){return new Lt(this._enter||this._groups.map(B),this._parents)},exit:function(){return new Lt(this._exit||this._groups.map(B),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,a=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?a.remove():n(a),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,a=r.length,s=Math.min(i,a),o=new Array(i),c=0;c<s;++c)for(var l,h=n[c],u=r[c],d=h.length,p=o[c]=new Array(d),f=0;f<d;++f)(l=h[f]||u[f])&&(p[f]=l);for(;c<i;++c)o[c]=n[c];return new Lt(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],a=i.length-1,s=i[a];--a>=0;)(r=i[a])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=F);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var s,o=n[a],c=o.length,l=i[a]=new Array(c),h=0;h<c;++h)(s=o[h])&&(l[h]=s);l.sort(e)}return new Lt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var s=r[i];if(s)return s}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,a=e[n],s=0,o=a.length;s<o;++s)(i=a[s])&&t.call(i,i.__data__,s,a);return this},attr:function(t,e){var n=Z(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?j:P:"function"==typeof e?n.local?W:U:n.local?z:Y)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?q:"function"==typeof e?G:V)(t,e,null==n?"":n)):X(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Q:"function"==typeof e?J:K)(t,e)):this.node()[t]},classed:function(t,e){var n=tt(t+"");if(arguments.length<2){for(var r=et(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?ot:e?at:st)(n,e))},text:function(t){return arguments.length?this.each(null==t?ct:("function"==typeof t?ht:lt)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?ut:("function"==typeof t?pt:dt)(t)):this.node().innerHTML},raise:function(){return this.each(ft)},lower:function(){return this.each(gt)},append:function(t){var e="function"==typeof t?t:bt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:bt(t),r=null==e?_t:"function"==typeof e?e:x(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(xt)},clone:function(t){return this.select(t?kt:vt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,a=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),s=a.length;if(!(arguments.length<2)){for(o=e?Ct:wt,r=0;r<s;++r)this.each(o(a[r],e,n));return this}var o=this.node().__on;if(o)for(var c,l=0,h=o.length;l<h;++l)for(r=0,c=o[l];r<s;++r)if((i=a[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,e){return this.each(("function"==typeof e?St:Tt)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],a=0,s=i.length;a<s;++a)(r=i[a])&&(yield r)}};const Nt=Bt;var Dt={value:()=>{}};function Ot(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Mt(r)}function Mt(t){this._=t}function It(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Ft(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Dt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Mt.prototype=Ot.prototype={constructor:Mt,on:function(t,e){var n,r,i=this._,a=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<o;)if(n=(t=a[s]).type)i[n]=Ft(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Ft(i[n],t.name,null);return this}for(;++s<o;)if((n=(t=a[s]).type)&&(n=It(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Mt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};const $t=Ot;var Rt,Zt,Pt=0,jt=0,Yt=0,zt=1e3,Ut=0,Wt=0,Ht=0,qt="object"==typeof performance&&performance.now?performance:Date,Vt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Gt(){return Wt||(Vt(Xt),Wt=qt.now()+Ht)}function Xt(){Wt=0}function Qt(){this._call=this._time=this._next=null}function Kt(t,e,n){var r=new Qt;return r.restart(t,e,n),r}function Jt(){Wt=(Ut=qt.now())+Ht,Pt=jt=0;try{!function(){Gt(),++Pt;for(var t,e=Rt;e;)(t=Wt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Pt}()}finally{Pt=0,function(){var t,e,n=Rt,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Rt=e);Zt=t,ee(r)}(),Wt=0}}function te(){var t=qt.now(),e=t-Ut;e>zt&&(Ht-=e,Ut=t)}function ee(t){Pt||(jt&&(jt=clearTimeout(jt)),t-Wt>24?(t<1/0&&(jt=setTimeout(Jt,t-qt.now()-Ht)),Yt&&(Yt=clearInterval(Yt))):(Yt||(Ut=qt.now(),Yt=setInterval(te,zt)),Pt=1,Vt(Jt)))}function ne(t,e,n){var r=new Qt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Qt.prototype=Kt.prototype={constructor:Qt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Gt():+n)+(null==e?0:+e),this._next||Zt===this||(Zt?Zt._next=this:Rt=this,Zt=this),this._call=t,this._time=n,ee()},stop:function(){this._call&&(this._call=null,this._time=1/0,ee())}};var re=$t("start","end","cancel","interrupt"),ie=[],ae=0,se=1,oe=2,ce=3,le=4,he=5,ue=6;function de(t,e,n,r,i,a){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(t){n.state=se,n.timer.restart(s,n.delay,n.time),n.delay<=t&&s(t-n.delay)}function s(a){var l,h,u,d;if(n.state!==se)return c();for(l in i)if((d=i[l]).name===n.name){if(d.state===ce)return ne(s);d.state===le?(d.state=ue,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[l]):+l<e&&(d.state=ue,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[l])}if(ne((function(){n.state===ce&&(n.state=le,n.timer.restart(o,n.delay,n.time),o(a))})),n.state=oe,n.on.call("start",t,t.__data__,n.index,n.group),n.state===oe){for(n.state=ce,r=new Array(u=n.tween.length),l=0,h=-1;l<u;++l)(d=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(r[++h]=d);r.length=h+1}}function o(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(c),n.state=he,1),a=-1,s=r.length;++a<s;)r[a].call(t,i);n.state===he&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){for(var r in n.state=ue,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Kt(a,0,n.time)}(t,n,{name:e,index:r,group:i,on:re,tween:ie,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ae})}function pe(t,e){var n=ge(t,e);if(n.state>ae)throw new Error("too late; already scheduled");return n}function fe(t,e){var n=ge(t,e);if(n.state>ce)throw new Error("too late; already running");return n}function ge(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ye(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var me,be=180/Math.PI,_e={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xe(t,e,n,r,i,a){var s,o,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(o=Math.sqrt(n*n+r*r))&&(n/=o,r/=o,c/=o),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*be,skewX:Math.atan(c)*be,scaleX:s,scaleY:o}}function ve(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,s){var o=[],c=[];return a=t(a),s=t(s),function(t,r,i,a,s,o){if(t!==i||r!==a){var c=s.push("translate(",null,e,null,n);o.push({i:c-4,x:ye(t,i)},{i:c-2,x:ye(r,a)})}else(i||a)&&s.push("translate("+i+e+a+n)}(a.translateX,a.translateY,s.translateX,s.translateY,o,c),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:ye(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,s.rotate,o,c),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:ye(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,s.skewX,o,c),function(t,e,n,r,a,s){if(t!==n||e!==r){var o=a.push(i(a)+"scale(",null,",",null,")");s.push({i:o-4,x:ye(t,n)},{i:o-2,x:ye(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,s.scaleX,s.scaleY,o,c),a=s=null,function(t){for(var e,n=-1,r=c.length;++n<r;)o[(e=c[n]).i]=e.x(t);return o.join("")}}}var ke=ve((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?_e:xe(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),we=ve((function(t){return null==t?_e:(me||(me=document.createElementNS("http://www.w3.org/2000/svg","g")),me.setAttribute("transform",t),(t=me.transform.baseVal.consolidate())?xe((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):_e)}),", ",")",")");function Ce(t,e){var n,r;return function(){var i=fe(this,t),a=i.tween;if(a!==n)for(var s=0,o=(r=n=a).length;s<o;++s)if(r[s].name===e){(r=r.slice()).splice(s,1);break}i.tween=r}}function Ee(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=fe(this,t),s=a.tween;if(s!==r){i=(r=s).slice();for(var o={name:e,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===e){i[c]=o;break}c===l&&i.push(o)}a.tween=i}}function Te(t,e,n){var r=t._id;return t.each((function(){var t=fe(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return ge(t,r).value[e]}}function Se(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ae(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Le(){}var Be=.7,Ne=1/Be,De="\\s*([+-]?\\d+)\\s*",Oe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ie=/^#([0-9a-f]{3,8})$/,Fe=new RegExp(`^rgb\\(${De},${De},${De}\\)$`),$e=new RegExp(`^rgb\\(${Me},${Me},${Me}\\)$`),Re=new RegExp(`^rgba\\(${De},${De},${De},${Oe}\\)$`),Ze=new RegExp(`^rgba\\(${Me},${Me},${Me},${Oe}\\)$`),Pe=new RegExp(`^hsl\\(${Oe},${Me},${Me}\\)$`),je=new RegExp(`^hsla\\(${Oe},${Me},${Me},${Oe}\\)$`),Ye={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ze(){return this.rgb().formatHex()}function Ue(){return this.rgb().formatRgb()}function We(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ie.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?He(e):3===n?new Xe(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?qe(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?qe(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Fe.exec(t))?new Xe(e[1],e[2],e[3],1):(e=$e.exec(t))?new Xe(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Re.exec(t))?qe(e[1],e[2],e[3],e[4]):(e=Ze.exec(t))?qe(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Pe.exec(t))?nn(e[1],e[2]/100,e[3]/100,1):(e=je.exec(t))?nn(e[1],e[2]/100,e[3]/100,e[4]):Ye.hasOwnProperty(t)?He(Ye[t]):"transparent"===t?new Xe(NaN,NaN,NaN,0):null}function He(t){return new Xe(t>>16&255,t>>8&255,255&t,1)}function qe(t,e,n,r){return r<=0&&(t=e=n=NaN),new Xe(t,e,n,r)}function Ve(t){return t instanceof Le||(t=We(t)),t?new Xe((t=t.rgb()).r,t.g,t.b,t.opacity):new Xe}function Ge(t,e,n,r){return 1===arguments.length?Ve(t):new Xe(t,e,n,null==r?1:r)}function Xe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Qe(){return`#${en(this.r)}${en(this.g)}${en(this.b)}`}function Ke(){const t=Je(this.opacity);return`${1===t?"rgb(":"rgba("}${tn(this.r)}, ${tn(this.g)}, ${tn(this.b)}${1===t?")":`, ${t})`}`}function Je(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function tn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function en(t){return((t=tn(t))<16?"0":"")+t.toString(16)}function nn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new an(t,e,n,r)}function rn(t){if(t instanceof an)return new an(t.h,t.s,t.l,t.opacity);if(t instanceof Le||(t=We(t)),!t)return new an;if(t instanceof an)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),s=NaN,o=a-i,c=(a+i)/2;return o?(s=e===a?(n-r)/o+6*(n<r):n===a?(r-e)/o+2:(e-n)/o+4,o/=c<.5?a+i:2-a-i,s*=60):o=c>0&&c<1?0:s,new an(s,o,c,t.opacity)}function an(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function sn(t){return(t=(t||0)%360)<0?t+360:t}function on(t){return Math.max(0,Math.min(1,t||0))}function cn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function ln(t,e,n,r,i){var a=t*t,s=a*t;return((1-3*t+3*a-s)*e+(4-6*a+3*s)*n+(1+3*t+3*a-3*s)*r+s*i)/6}Se(Le,We,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ze,formatHex:ze,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return rn(this).formatHsl()},formatRgb:Ue,toString:Ue}),Se(Xe,Ge,Ae(Le,{brighter(t){return t=null==t?Ne:Math.pow(Ne,t),new Xe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Be:Math.pow(Be,t),new Xe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Xe(tn(this.r),tn(this.g),tn(this.b),Je(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Qe,formatHex:Qe,formatHex8:function(){return`#${en(this.r)}${en(this.g)}${en(this.b)}${en(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ke,toString:Ke})),Se(an,(function(t,e,n,r){return 1===arguments.length?rn(t):new an(t,e,n,null==r?1:r)}),Ae(Le,{brighter(t){return t=null==t?Ne:Math.pow(Ne,t),new an(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Be:Math.pow(Be,t),new an(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Xe(cn(t>=240?t-240:t+120,i,r),cn(t,i,r),cn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new an(sn(this.h),on(this.s),on(this.l),Je(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Je(this.opacity);return`${1===t?"hsl(":"hsla("}${sn(this.h)}, ${100*on(this.s)}%, ${100*on(this.l)}%${1===t?")":`, ${t})`}`}}));const hn=t=>()=>t;function un(t,e){return function(n){return t+n*e}}function dn(t){return 1==(t=+t)?pn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):hn(isNaN(e)?n:e)}}function pn(t,e){var n=e-t;return n?un(t,n):hn(isNaN(t)?e:t)}const fn=function t(e){var n=dn(e);function r(t,e){var r=n((t=Ge(t)).r,(e=Ge(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),s=pn(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function gn(t){return function(e){var n,r,i=e.length,a=new Array(i),s=new Array(i),o=new Array(i);for(n=0;n<i;++n)r=Ge(e[n]),a[n]=r.r||0,s[n]=r.g||0,o[n]=r.b||0;return a=t(a),s=t(s),o=t(o),r.opacity=1,function(t){return r.r=a(t),r.g=s(t),r.b=o(t),r+""}}}gn((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],s=r>0?t[r-1]:2*i-a,o=r<e-1?t[r+2]:2*a-i;return ln((n-r/e)*e,s,i,a,o)}})),gn((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],a=t[r%e],s=t[(r+1)%e],o=t[(r+2)%e];return ln((n-r/e)*e,i,a,s,o)}}));var yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mn=new RegExp(yn.source,"g");function bn(t,e){var n,r,i,a=yn.lastIndex=mn.lastIndex=0,s=-1,o=[],c=[];for(t+="",e+="";(n=yn.exec(t))&&(r=mn.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),o[s]?o[s]+=i:o[++s]=i),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,c.push({i:s,x:ye(n,r)})),a=mn.lastIndex;return a<e.length&&(i=e.slice(a),o[s]?o[s]+=i:o[++s]=i),o.length<2?c[0]?function(t){return function(e){return t(e)+""}}(c[0].x):function(t){return function(){return t}}(e):(e=c.length,function(t){for(var n,r=0;r<e;++r)o[(n=c[r]).i]=n.x(t);return o.join("")})}function _n(t,e){var n;return("number"==typeof e?ye:e instanceof We?fn:(n=We(e))?(e=n,fn):bn)(t,e)}function xn(t){return function(){this.removeAttribute(t)}}function vn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function kn(t,e,n){var r,i,a=n+"";return function(){var s=this.getAttribute(t);return s===a?null:s===r?i:i=e(r=s,n)}}function wn(t,e,n){var r,i,a=n+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===a?null:s===r?i:i=e(r=s,n)}}function Cn(t,e,n){var r,i,a;return function(){var s,o,c=n(this);if(null!=c)return(s=this.getAttribute(t))===(o=c+"")?null:s===r&&o===i?a:(i=o,a=e(r=s,c));this.removeAttribute(t)}}function En(t,e,n){var r,i,a;return function(){var s,o,c=n(this);if(null!=c)return(s=this.getAttributeNS(t.space,t.local))===(o=c+"")?null:s===r&&o===i?a:(i=o,a=e(r=s,c));this.removeAttributeNS(t.space,t.local)}}function Tn(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Sn(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function An(t,e){return function(){pe(this,t).delay=+e.apply(this,arguments)}}function Ln(t,e){return e=+e,function(){pe(this,t).delay=e}}function Bn(t,e){return function(){fe(this,t).duration=+e.apply(this,arguments)}}function Nn(t,e){return e=+e,function(){fe(this,t).duration=e}}var Dn=Nt.prototype.constructor;function On(t){return function(){this.style.removeProperty(t)}}var Mn=0;function In(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Fn(){return++Mn}var $n=Nt.prototype;In.prototype=function(t){return Nt().transition(t)}.prototype={constructor:In,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=x(t));for(var r=this._groups,i=r.length,a=new Array(i),s=0;s<i;++s)for(var o,c,l=r[s],h=l.length,u=a[s]=new Array(h),d=0;d<h;++d)(o=l[d])&&(c=t.call(o,o.__data__,d,l))&&("__data__"in o&&(c.__data__=o.__data__),u[d]=c,de(u[d],e,n,d,u,ge(o,n)));return new In(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=w(t));for(var r=this._groups,i=r.length,a=[],s=[],o=0;o<i;++o)for(var c,l=r[o],h=l.length,u=0;u<h;++u)if(c=l[u]){for(var d,p=t.call(c,c.__data__,u,l),f=ge(c,n),g=0,y=p.length;g<y;++g)(d=p[g])&&de(d,e,n,g,p,f);a.push(p),s.push(c)}return new In(a,s,e,n)},selectChild:$n.selectChild,selectChildren:$n.selectChildren,filter:function(t){"function"!=typeof t&&(t=C(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,s=e[i],o=s.length,c=r[i]=[],l=0;l<o;++l)(a=s[l])&&t.call(a,a.__data__,l,s)&&c.push(a);return new In(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),s=new Array(r),o=0;o<a;++o)for(var c,l=e[o],h=n[o],u=l.length,d=s[o]=new Array(u),p=0;p<u;++p)(c=l[p]||h[p])&&(d[p]=c);for(;o<r;++o)s[o]=e[o];return new In(s,this._parents,this._name,this._id)},selection:function(){return new Dn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Fn(),r=this._groups,i=r.length,a=0;a<i;++a)for(var s,o=r[a],c=o.length,l=0;l<c;++l)if(s=o[l]){var h=ge(s,e);de(s,t,n,l,o,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new In(r,this._parents,t,n)},call:$n.call,nodes:$n.nodes,node:$n.node,size:$n.size,empty:$n.empty,each:$n.each,on:function(t,e){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,a=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?pe:fe;return function(){var s=a(this,t),o=s.on;o!==r&&(i=(r=o).copy()).on(e,n),s.on=i}}(n,t,e))},attr:function(t,e){var n=Z(t),r="transform"===n?we:_n;return this.attrTween(t,"function"==typeof e?(n.local?En:Cn)(n,r,Te(this,"attr."+t,e)):null==e?(n.local?vn:xn)(n):(n.local?wn:kn)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Z(t);return this.tween(n,(r.local?Tn:Sn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ke:_n;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=X(this,t),s=(this.style.removeProperty(t),X(this,t));return a===s?null:a===n&&s===r?i:i=e(n=a,r=s)}}(t,r)).on("end.style."+t,On(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,a;return function(){var s=X(this,t),o=n(this),c=o+"";return null==o&&(this.style.removeProperty(t),c=o=X(this,t)),s===c?null:s===r&&c===i?a:(i=c,a=e(r=s,o))}}(t,r,Te(this,"style."+t,e))).each(function(t,e){var n,r,i,a,s="style."+e,o="end."+s;return function(){var c=fe(this,t),l=c.on,h=null==c.value[s]?a||(a=On(e)):void 0;l===n&&i===h||(r=(n=l).copy()).on(o,i=h),c.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,a=n+"";return function(){var s=X(this,t);return s===a?null:s===r?i:i=e(r=s,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function a(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,a,n)),r}return a._value=e,a}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Te(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=ge(this.node(),n).tween,a=0,s=i.length;a<s;++a)if((r=i[a]).name===t)return r.value;return null}return this.each((null==e?Ce:Ee)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?An:Ln)(e,t)):ge(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Bn:Nn)(e,t)):ge(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){fe(this,t).ease=e}}(e,t)):ge(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;fe(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(a,s){var o={value:s},c={value:function(){0==--i&&a()}};n.each((function(){var n=fe(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(o),e._.interrupt.push(o),e._.end.push(c)),n.on=e})),0===i&&a()}))},[Symbol.iterator]:$n[Symbol.iterator]};var Rn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Zn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}Nt.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,a=t.__transition,s=!0;if(a){for(i in e=null==e?null:e+"",a)(n=a[i]).name===e?(r=n.state>oe&&n.state<he,n.state=ue,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete a[i]):s=!1;s&&delete t.__transition}}(this,t)}))},Nt.prototype.transition=function(t){var e,n;t instanceof In?(e=t._id,t=t._name):(e=Fn(),(n=Rn).time=Gt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var s,o=r[a],c=o.length,l=0;l<c;++l)(s=o[l])&&de(s,t,e,l,o,n||Zn(s,e));return new In(r,this._parents,t,e)};const{abs:Pn,max:jn,min:Yn}=Math;function zn(t){return[+t[0],+t[1]]}function Un(t){return[zn(t[0]),zn(t[1])]}["w","e"].map(Wn),["n","s"].map(Wn),["n","w","e","s","nw","ne","sw","se"].map(Wn);function Wn(t){return{type:t}}function Hn(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function qn(t){return(e,n)=>function(t,e){return fetch(t,e).then(Hn)}(e,n).then((e=>(new DOMParser).parseFromString(e,t)))}qn("application/xml");qn("text/html");var Vn=qn("image/svg+xml");const Gn=Math.PI/180,Xn=180/Math.PI,Qn=.96422,Kn=1,Jn=.82521,tr=4/29,er=6/29,nr=3*er*er,rr=er*er*er;function ir(t){if(t instanceof ar)return new ar(t.l,t.a,t.b,t.opacity);if(t instanceof dr)return pr(t);t instanceof Xe||(t=Ve(t));var e,n,r=lr(t.r),i=lr(t.g),a=lr(t.b),s=sr((.2225045*r+.7168786*i+.0606169*a)/Kn);return r===i&&i===a?e=n=s:(e=sr((.4360747*r+.3850649*i+.1430804*a)/Qn),n=sr((.0139322*r+.0971045*i+.7141733*a)/Jn)),new ar(116*s-16,500*(e-s),200*(s-n),t.opacity)}function ar(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function sr(t){return t>rr?Math.pow(t,1/3):t/nr+tr}function or(t){return t>er?t*t*t:nr*(t-tr)}function cr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function lr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function hr(t){if(t instanceof dr)return new dr(t.h,t.c,t.l,t.opacity);if(t instanceof ar||(t=ir(t)),0===t.a&&0===t.b)return new dr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Xn;return new dr(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function ur(t,e,n,r){return 1===arguments.length?hr(t):new dr(t,e,n,null==r?1:r)}function dr(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function pr(t){if(isNaN(t.h))return new ar(t.l,0,0,t.opacity);var e=t.h*Gn;return new ar(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}function fr(t){return function(e,n){var r=t((e=ur(e)).h,(n=ur(n)).h),i=pn(e.c,n.c),a=pn(e.l,n.l),s=pn(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=a(t),e.opacity=s(t),e+""}}}Se(ar,(function(t,e,n,r){return 1===arguments.length?ir(t):new ar(t,e,n,null==r?1:r)}),Ae(Le,{brighter(t){return new ar(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new ar(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Xe(cr(3.1338561*(e=Qn*or(e))-1.6168667*(t=Kn*or(t))-.4906146*(n=Jn*or(n))),cr(-.9787684*e+1.9161415*t+.033454*n),cr(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Se(dr,ur,Ae(Le,{brighter(t){return new dr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new dr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return pr(this).rgb()}}));const gr=fr((function(t,e){var n=e-t;return n?un(t,n>180||n<-180?n-360*Math.round(n/360):n):hn(isNaN(t)?e:t)}));fr(pn);const yr=Math.sqrt(50),mr=Math.sqrt(10),br=Math.sqrt(2);function _r(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),s=a>=yr?10:a>=mr?5:a>=br?2:1;let o,c,l;return i<0?(l=Math.pow(10,-i)/s,o=Math.round(t*l),c=Math.round(e*l),o/l<t&&++o,c/l>e&&--c,l=-l):(l=Math.pow(10,i)*s,o=Math.round(t/l),c=Math.round(e/l),o*l<t&&++o,c*l>e&&--c),c<o&&.5<=n&&n<2?_r(t,e,2*n):[o,c,l]}function xr(t,e,n){return _r(t=+t,e=+e,n=+n)[2]}function vr(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?xr(e,t,n):xr(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function kr(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function wr(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Cr(t){let e,n,r;function i(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<0?i=e+1:a=e}while(i<a)}return i}return 2!==t.length?(e=kr,n=(e,n)=>kr(t(e),n),r=(e,n)=>t(e)-n):(e=t===kr||t===wr?t:Er,n=t,r=t),{left:i,center:function(t,e,n=0,a=t.length){const s=i(t,e,n,a-1);return s>n&&r(t[s-1],e)>-r(t[s],e)?s-1:s},right:function(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<=0?i=e+1:a=e}while(i<a)}return i}}}function Er(){return 0}const Tr=Cr(kr),Sr=Tr.right,Ar=(Tr.left,Cr((function(t){return null===t?NaN:+t})).center,Sr);function Lr(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),s=new Array(r);for(n=0;n<i;++n)a[n]=Or(t[n],e[n]);for(;n<r;++n)s[n]=e[n];return function(t){for(n=0;n<i;++n)s[n]=a[n](t);return s}}function Br(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Nr(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Or(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}function Dr(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(a){for(n=0;n<r;++n)i[n]=t[n]*(1-a)+e[n]*a;return i}}function Or(t,e){var n,r,i=typeof e;return null==e||"boolean"===i?hn(e):("number"===i?ye:"string"===i?(n=We(e))?(e=n,fn):bn:e instanceof We?fn:e instanceof Date?Br:(r=e,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(e)?Lr:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Nr:ye:Dr))(t,e)}function Mr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Ir(t){return+t}var Fr=[0,1];function $r(t){return t}function Rr(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function Zr(t,e,n){var r=t[0],i=t[1],a=e[0],s=e[1];return i<r?(r=Rr(i,r),a=n(s,a)):(r=Rr(r,i),a=n(a,s)),function(t){return a(r(t))}}function Pr(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=Rr(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(e){var n=Ar(t,e,1,r)-1;return a[n](i[n](e))}}function jr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Yr(){var t,e,n,r,i,a,s=Fr,o=Fr,c=Or,l=$r;function h(){var t,e,n,c=Math.min(s.length,o.length);return l!==$r&&(t=s[0],e=s[c-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=c>2?Pr:Zr,i=a=null,u}function u(e){return null==e||isNaN(e=+e)?n:(i||(i=r(s.map(t),o,c)))(t(l(e)))}return u.invert=function(n){return l(e((a||(a=r(o,s.map(t),ye)))(n)))},u.domain=function(t){return arguments.length?(s=Array.from(t,Ir),h()):s.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),h()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),c=Mr,h()},u.clamp=function(t){return arguments.length?(l=!!t||$r,h()):l!==$r},u.interpolate=function(t){return arguments.length?(c=t,h()):c},u.unknown=function(t){return arguments.length?(n=t,u):n},function(n,r){return t=n,e=r,h()}}function zr(){return Yr()($r,$r)}function Ur(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}var Wr,Hr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qr(t){if(!(e=Hr.exec(t)))throw new Error("invalid format: "+t);var e;return new Vr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Vr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Gr(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Xr(t){return(t=Gr(Math.abs(t)))?t[1]:NaN}function Qr(t,e){var n=Gr(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}qr.prototype=Vr.prototype,Vr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Kr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Qr(100*t,e),r:Qr,s:function(t,e){var n=Gr(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Wr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return a===s?r:a>s?r+new Array(a-s+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Gr(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Jr(t){return t}var ti,ei,ni,ri=Array.prototype.map,ii=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function ai(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Jr:(e=ri.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],s=0,o=e[0],c=0;i>0&&o>0&&(c+o+1>r&&(o=Math.max(1,r-c)),a.push(t.substring(i-=o,i+o)),!((c+=o+1)>r));)o=e[s=(s+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Jr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ri.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"\u2212":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function u(t){var e=(t=qr(t)).fill,n=t.align,u=t.sign,d=t.symbol,p=t.zero,f=t.width,g=t.comma,y=t.precision,m=t.trim,b=t.type;"n"===b?(g=!0,b="g"):Kr[b]||(void 0===y&&(y=12),m=!0,b="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var _="$"===d?i:"#"===d&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",x="$"===d?a:/[%p]/.test(b)?c:"",v=Kr[b],k=/[defgprs%]/.test(b);function w(t){var i,a,c,d=_,w=x;if("c"===b)w=v(t)+w,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:v(Math.abs(t),y),m&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),C&&0==+t&&"+"!==u&&(C=!1),d=(C?"("===u?u:l:"-"===u||"("===u?"":u)+d,w=("s"===b?ii[8+Wr/3]:"")+w+(C&&"("===u?")":""),k)for(i=-1,a=t.length;++i<a;)if(48>(c=t.charCodeAt(i))||c>57){w=(46===c?s+t.slice(i+1):t.slice(i))+w,t=t.slice(0,i);break}}g&&!p&&(t=r(t,1/0));var E=d.length+t.length+w.length,T=E<f?new Array(f-E+1).join(e):"";switch(g&&p&&(t=r(T+t,T.length?f-w.length:1/0),T=""),n){case"<":t=d+t+w+T;break;case"=":t=d+T+t+w;break;case"^":t=T.slice(0,E=T.length>>1)+d+t+w+T.slice(E);break;default:t=T+d+t+w}return o(t)}return y=void 0===y?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),w.toString=function(){return t+""},w}return{format:u,formatPrefix:function(t,e){var n=u(((t=qr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Xr(e)/3))),i=Math.pow(10,-r),a=ii[8+r/3];return function(t){return n(i*t)+a}}}}function si(t,e,n,r){var i,a=vr(t,e,n);switch((r=qr(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Xr(e)/3)))-Xr(Math.abs(t)))}(a,s))||(r.precision=i),ni(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Xr(e)-Xr(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Xr(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return ei(r)}function oi(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const r=e<t,[i,a,s]=r?_r(e,t,n):_r(t,e,n);if(!(a>=i))return[];const o=a-i+1,c=new Array(o);if(r)if(s<0)for(let l=0;l<o;++l)c[l]=(a-l)/-s;else for(let l=0;l<o;++l)c[l]=(a-l)*s;else if(s<0)for(let l=0;l<o;++l)c[l]=(i+l)/-s;else for(let l=0;l<o;++l)c[l]=(i+l)*s;return c}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return si(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,a=e(),s=0,o=a.length-1,c=a[s],l=a[o],h=10;for(l<c&&(i=c,c=l,l=i,i=s,s=o,o=i);h-- >0;){if((i=xr(c,l,n))===r)return a[s]=c,a[o]=l,e(a);if(i>0)c=Math.floor(c/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;c=Math.ceil(c*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function ci(){var t=zr();return t.copy=function(){return jr(t,ci())},Ur.apply(t,arguments),oi(t)}ti=ai({thousands:",",grouping:[3],currency:["$",""]}),ei=ti.format,ni=ti.formatPrefix;class li extends Map{constructor(t,e=pi){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[n,r]of t)this.set(n,r)}get(t){return super.get(hi(this,t))}has(t){return super.has(hi(this,t))}set(t,e){return super.set(ui(this,t),e)}delete(t){return super.delete(di(this,t))}}function hi({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function ui({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function di({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function pi(t){return null!==t&&"object"==typeof t?t.valueOf():t}const fi=Symbol("implicit");function gi(){var t=new li,e=[],n=[],r=fi;function i(i){let a=t.get(i);if(void 0===a){if(r!==fi)return r;t.set(i,a=e.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new li;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return gi(e,n).unknown(r)},Ur.apply(i,arguments),i}const yi=1e3,mi=6e4,bi=36e5,_i=864e5,xi=6048e5,vi=2592e6,ki=31536e6,wi=new Date,Ci=new Date;function Ei(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,a)=>{const s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return s;let o;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o<n&&n<r);return s},i.filter=n=>Ei((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})),n&&(i.count=(e,r)=>(wi.setTime(+e),Ci.setTime(+r),t(wi),t(Ci),Math.floor(n(wi,Ci))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t==0:e=>i.count(0,e)%t==0):i:null)),i}const Ti=Ei((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));Ti.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Ei((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):Ti:null);Ti.range;const Si=Ei((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*yi)}),((t,e)=>(e-t)/yi),(t=>t.getUTCSeconds())),Ai=(Si.range,Ei((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*yi)}),((t,e)=>{t.setTime(+t+e*mi)}),((t,e)=>(e-t)/mi),(t=>t.getMinutes()))),Li=(Ai.range,Ei((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*mi)}),((t,e)=>(e-t)/mi),(t=>t.getUTCMinutes()))),Bi=(Li.range,Ei((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*yi-t.getMinutes()*mi)}),((t,e)=>{t.setTime(+t+e*bi)}),((t,e)=>(e-t)/bi),(t=>t.getHours()))),Ni=(Bi.range,Ei((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*bi)}),((t,e)=>(e-t)/bi),(t=>t.getUTCHours()))),Di=(Ni.range,Ei((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*mi)/_i),(t=>t.getDate()-1))),Oi=(Di.range,Ei((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/_i),(t=>t.getUTCDate()-1))),Mi=(Oi.range,Ei((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/_i),(t=>Math.floor(t/_i))));Mi.range;function Ii(t){return Ei((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*mi)/xi))}const Fi=Ii(0),$i=Ii(1),Ri=Ii(2),Zi=Ii(3),Pi=Ii(4),ji=Ii(5),Yi=Ii(6);Fi.range,$i.range,Ri.range,Zi.range,Pi.range,ji.range,Yi.range;function zi(t){return Ei((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/xi))}const Ui=zi(0),Wi=zi(1),Hi=zi(2),qi=zi(3),Vi=zi(4),Gi=zi(5),Xi=zi(6),Qi=(Ui.range,Wi.range,Hi.range,qi.range,Vi.range,Gi.range,Xi.range,Ei((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()))),Ki=(Qi.range,Ei((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()))),Ji=(Ki.range,Ei((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));Ji.every=t=>isFinite(t=Math.floor(t))&&t>0?Ei((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null;Ji.range;const ta=Ei((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));ta.every=t=>isFinite(t=Math.floor(t))&&t>0?Ei((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null;ta.range;function ea(t,e,n,r,i,a){const s=[[Si,1,yi],[Si,5,5e3],[Si,15,15e3],[Si,30,3e4],[a,1,mi],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,bi],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,_i],[r,2,1728e5],[n,1,xi],[e,1,vi],[e,3,7776e6],[t,1,ki]];function o(e,n,r){const i=Math.abs(n-e)/r,a=Cr((([,,t])=>t)).right(s,i);if(a===s.length)return t.every(vr(e/ki,n/ki,r));if(0===a)return Ti.every(Math.max(vr(e,n,r),1));const[o,c]=s[i/s[a-1][2]<s[a][2]/i?a-1:a];return o.every(c)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:o(t,e,n),a=i?i.range(t,+e+1):[];return r?a.reverse():a},o]}const[na,ra]=ea(ta,Ki,Ui,Mi,Ni,Li),[ia,aa]=ea(Ji,Qi,Fi,Di,Bi,Ai);function sa(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function oa(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ca(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var la,ha,ua={"-":"",_:" ",0:"0"},da=/^\s*\d+/,pa=/^%/,fa=/[\\^$*+?|[\]().{}]/g;function ga(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function ya(t){return t.replace(fa,"\\$&")}function ma(t){return new RegExp("^(?:"+t.map(ya).join("|")+")","i")}function ba(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function _a(t,e,n){var r=da.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function xa(t,e,n){var r=da.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function va(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ka(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function wa(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Ca(t,e,n){var r=da.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ea(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ta(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Sa(t,e,n){var r=da.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Aa(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function La(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ba(t,e,n){var r=da.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Na(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Da(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Oa(t,e,n){var r=da.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Ma(t,e,n){var r=da.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ia(t,e,n){var r=da.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Fa(t,e,n){var r=pa.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function $a(t,e,n){var r=da.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Ra(t,e,n){var r=da.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Za(t,e){return ga(t.getDate(),e,2)}function Pa(t,e){return ga(t.getHours(),e,2)}function ja(t,e){return ga(t.getHours()%12||12,e,2)}function Ya(t,e){return ga(1+Di.count(Ji(t),t),e,3)}function za(t,e){return ga(t.getMilliseconds(),e,3)}function Ua(t,e){return za(t,e)+"000"}function Wa(t,e){return ga(t.getMonth()+1,e,2)}function Ha(t,e){return ga(t.getMinutes(),e,2)}function qa(t,e){return ga(t.getSeconds(),e,2)}function Va(t){var e=t.getDay();return 0===e?7:e}function Ga(t,e){return ga(Fi.count(Ji(t)-1,t),e,2)}function Xa(t){var e=t.getDay();return e>=4||0===e?Pi(t):Pi.ceil(t)}function Qa(t,e){return t=Xa(t),ga(Pi.count(Ji(t),t)+(4===Ji(t).getDay()),e,2)}function Ka(t){return t.getDay()}function Ja(t,e){return ga($i.count(Ji(t)-1,t),e,2)}function ts(t,e){return ga(t.getFullYear()%100,e,2)}function es(t,e){return ga((t=Xa(t)).getFullYear()%100,e,2)}function ns(t,e){return ga(t.getFullYear()%1e4,e,4)}function rs(t,e){var n=t.getDay();return ga((t=n>=4||0===n?Pi(t):Pi.ceil(t)).getFullYear()%1e4,e,4)}function is(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ga(e/60|0,"0",2)+ga(e%60,"0",2)}function as(t,e){return ga(t.getUTCDate(),e,2)}function ss(t,e){return ga(t.getUTCHours(),e,2)}function os(t,e){return ga(t.getUTCHours()%12||12,e,2)}function cs(t,e){return ga(1+Oi.count(ta(t),t),e,3)}function ls(t,e){return ga(t.getUTCMilliseconds(),e,3)}function hs(t,e){return ls(t,e)+"000"}function us(t,e){return ga(t.getUTCMonth()+1,e,2)}function ds(t,e){return ga(t.getUTCMinutes(),e,2)}function ps(t,e){return ga(t.getUTCSeconds(),e,2)}function fs(t){var e=t.getUTCDay();return 0===e?7:e}function gs(t,e){return ga(Ui.count(ta(t)-1,t),e,2)}function ys(t){var e=t.getUTCDay();return e>=4||0===e?Vi(t):Vi.ceil(t)}function ms(t,e){return t=ys(t),ga(Vi.count(ta(t),t)+(4===ta(t).getUTCDay()),e,2)}function bs(t){return t.getUTCDay()}function _s(t,e){return ga(Wi.count(ta(t)-1,t),e,2)}function xs(t,e){return ga(t.getUTCFullYear()%100,e,2)}function vs(t,e){return ga((t=ys(t)).getUTCFullYear()%100,e,2)}function ks(t,e){return ga(t.getUTCFullYear()%1e4,e,4)}function ws(t,e){var n=t.getUTCDay();return ga((t=n>=4||0===n?Vi(t):Vi.ceil(t)).getUTCFullYear()%1e4,e,4)}function Cs(){return"+0000"}function Es(){return"%"}function Ts(t){return+t}function Ss(t){return Math.floor(+t/1e3)}function As(t){return new Date(t)}function Ls(t){return t instanceof Date?+t:+new Date(+t)}function Bs(t,e,n,r,i,a,s,o,c,l){var h=zr(),u=h.invert,d=h.domain,p=l(".%L"),f=l(":%S"),g=l("%I:%M"),y=l("%I %p"),m=l("%a %d"),b=l("%b %d"),_=l("%B"),x=l("%Y");function v(t){return(c(t)<t?p:o(t)<t?f:s(t)<t?g:a(t)<t?y:r(t)<t?i(t)<t?m:b:n(t)<t?_:x)(t)}return h.invert=function(t){return new Date(u(t))},h.domain=function(t){return arguments.length?d(Array.from(t,Ls)):d().map(As)},h.ticks=function(e){var n=d();return t(n[0],n[n.length-1],null==e?10:e)},h.tickFormat=function(t,e){return null==e?v:l(e)},h.nice=function(t){var n=d();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?d(function(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],s=t[i];return s<a&&(n=r,r=i,i=n,n=a,a=s,s=n),t[r]=e.floor(a),t[i]=e.ceil(s),t}(n,t)):h},h.copy=function(){return jr(h,Bs(t,e,n,r,i,a,s,o,c,l))},h}function Ns(){return Ur.apply(Bs(ia,aa,Ji,Qi,Fi,Di,Bi,Ai,Si,ha).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ds(t){return"string"==typeof t?new Lt([[document.querySelector(t)]],[document.documentElement]):new Lt([[t]],At)}function Os(t){return"string"==typeof t?new Lt([document.querySelectorAll(t)],[document.documentElement]):new Lt([v(t)],At)}function Ms(t){return function(){return t}}!function(t){la=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,s=t.shortDays,o=t.months,c=t.shortMonths,l=ma(i),h=ba(i),u=ma(a),d=ba(a),p=ma(s),f=ba(s),g=ma(o),y=ba(o),m=ma(c),b=ba(c),_={a:function(t){return s[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Za,e:Za,f:Ua,g:es,G:rs,H:Pa,I:ja,j:Ya,L:za,m:Wa,M:Ha,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ts,s:Ss,S:qa,u:Va,U:Ga,V:Qa,w:Ka,W:Ja,x:null,X:null,y:ts,Y:ns,Z:is,"%":Es},x={a:function(t){return s[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:as,e:as,f:hs,g:vs,G:ws,H:ss,I:os,j:cs,L:ls,m:us,M:ds,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ts,s:Ss,S:ps,u:fs,U:gs,V:ms,w:bs,W:_s,x:null,X:null,y:xs,Y:ks,Z:Cs,"%":Es},v={a:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=u.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=b.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return C(t,e,n,r)},d:La,e:La,f:Ia,g:Ea,G:Ca,H:Na,I:Na,j:Ba,L:Ma,m:Aa,M:Da,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=h.get(r[0].toLowerCase()),n+r[0].length):-1},q:Sa,Q:$a,s:Ra,S:Oa,u:xa,U:va,V:ka,w:_a,W:wa,x:function(t,e,r){return C(t,n,e,r)},X:function(t,e,n){return C(t,r,e,n)},y:Ea,Y:Ca,Z:Ta,"%":Fa};function k(t,e){return function(n){var r,i,a,s=[],o=-1,c=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++o<l;)37===t.charCodeAt(o)&&(s.push(t.slice(c,o)),null!=(i=ua[r=t.charAt(++o)])?r=t.charAt(++o):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),s.push(r),c=o+1);return s.push(t.slice(c,o)),s.join("")}}function w(t,e){return function(n){var r,i,a=ca(1900,void 0,1);if(C(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(e&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=oa(ca(a.y,0,1))).getUTCDay(),r=i>4||0===i?Wi.ceil(r):Wi(r),r=Oi.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=sa(ca(a.y,0,1))).getDay(),r=i>4||0===i?$i.ceil(r):$i(r),r=Di.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?oa(ca(a.y,0,1)).getUTCDay():sa(ca(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,oa(a)):sa(a)}}function C(t,e,n,r){for(var i,a,s=0,o=e.length,c=n.length;s<o;){if(r>=c)return-1;if(37===(i=e.charCodeAt(s++))){if(i=e.charAt(s++),!(a=v[i in ua?e.charAt(s++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=k(n,_),_.X=k(r,_),_.c=k(e,_),x.x=k(n,x),x.X=k(r,x),x.c=k(e,x),{format:function(t){var e=k(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=w(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=k(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=w(t+="",!0);return e.toString=function(){return t},e}}}(t),ha=la.format,la.parse,la.utcFormat,la.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});const Is=Math.abs,Fs=Math.atan2,$s=Math.cos,Rs=Math.max,Zs=Math.min,Ps=Math.sin,js=Math.sqrt,Ys=1e-12,zs=Math.PI,Us=zs/2,Ws=2*zs;function Hs(t){return t>=1?Us:t<=-1?-Us:Math.asin(t)}const qs=Math.PI,Vs=2*qs,Gs=1e-6,Xs=Vs-Gs;function Qs(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class Ks{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Qs:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Qs;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,a){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let a=this._x1,s=this._y1,o=n-t,c=r-e,l=a-t,h=s-e,u=l*l+h*h;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>Gs)if(Math.abs(h*o-c*l)>Gs&&i){let d=n-a,p=r-s,f=o*o+c*c,g=d*d+p*p,y=Math.sqrt(f),m=Math.sqrt(u),b=i*Math.tan((qs-Math.acos((f+u-g)/(2*y*m)))/2),_=b/m,x=b/y;Math.abs(_-1)>Gs&&this._append`L${t+_*l},${e+_*h}`,this._append`A${i},${i},0,0,${+(h*d>l*p)},${this._x1=t+x*o},${this._y1=e+x*c}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,a){if(t=+t,e=+e,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(r),o=n*Math.sin(r),c=t+s,l=e+o,h=1^a,u=a?r-i:i-r;null===this._x1?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Gs||Math.abs(this._y1-l)>Gs)&&this._append`L${c},${l}`,n&&(u<0&&(u=u%Vs+Vs),u>Xs?this._append`A${n},${n},0,1,${h},${t-s},${e-o}A${n},${n},0,1,${h},${this._x1=c},${this._y1=l}`:u>Gs&&this._append`A${n},${n},0,${+(u>=qs)},${h},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Js(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ks(e)}function to(t){return t.innerRadius}function eo(t){return t.outerRadius}function no(t){return t.startAngle}function ro(t){return t.endAngle}function io(t){return t&&t.padAngle}function ao(t,e,n,r,i,a,s){var o=t-n,c=e-r,l=(s?a:-a)/js(o*o+c*c),h=l*c,u=-l*o,d=t+h,p=e+u,f=n+h,g=r+u,y=(d+f)/2,m=(p+g)/2,b=f-d,_=g-p,x=b*b+_*_,v=i-a,k=d*g-f*p,w=(_<0?-1:1)*js(Rs(0,v*v*x-k*k)),C=(k*_-b*w)/x,E=(-k*b-_*w)/x,T=(k*_+b*w)/x,S=(-k*b+_*w)/x,A=C-y,L=E-m,B=T-y,N=S-m;return A*A+L*L>B*B+N*N&&(C=T,E=S),{cx:C,cy:E,x01:-h,y01:-u,x11:C*(i/v-1),y11:E*(i/v-1)}}function so(){var t=to,e=eo,n=Ms(0),r=null,i=no,a=ro,s=io,o=null,c=Js(l);function l(){var l,h,u,d=+t.apply(this,arguments),p=+e.apply(this,arguments),f=i.apply(this,arguments)-Us,g=a.apply(this,arguments)-Us,y=Is(g-f),m=g>f;if(o||(o=l=c()),p<d&&(h=p,p=d,d=h),p>Ys)if(y>Ws-Ys)o.moveTo(p*$s(f),p*Ps(f)),o.arc(0,0,p,f,g,!m),d>Ys&&(o.moveTo(d*$s(g),d*Ps(g)),o.arc(0,0,d,g,f,m));else{var b,_,x=f,v=g,k=f,w=g,C=y,E=y,T=s.apply(this,arguments)/2,S=T>Ys&&(r?+r.apply(this,arguments):js(d*d+p*p)),A=Zs(Is(p-d)/2,+n.apply(this,arguments)),L=A,B=A;if(S>Ys){var N=Hs(S/d*Ps(T)),D=Hs(S/p*Ps(T));(C-=2*N)>Ys?(k+=N*=m?1:-1,w-=N):(C=0,k=w=(f+g)/2),(E-=2*D)>Ys?(x+=D*=m?1:-1,v-=D):(E=0,x=v=(f+g)/2)}var O=p*$s(x),M=p*Ps(x),I=d*$s(w),F=d*Ps(w);if(A>Ys){var $,R=p*$s(v),Z=p*Ps(v),P=d*$s(k),j=d*Ps(k);if(y<zs)if($=function(t,e,n,r,i,a,s,o){var c=n-t,l=r-e,h=s-i,u=o-a,d=u*c-h*l;if(!(d*d<Ys))return[t+(d=(h*(e-a)-u*(t-i))/d)*c,e+d*l]}(O,M,P,j,R,Z,I,F)){var Y=O-$[0],z=M-$[1],U=R-$[0],W=Z-$[1],H=1/Ps(((u=(Y*U+z*W)/(js(Y*Y+z*z)*js(U*U+W*W)))>1?0:u<-1?zs:Math.acos(u))/2),q=js($[0]*$[0]+$[1]*$[1]);L=Zs(A,(d-q)/(H-1)),B=Zs(A,(p-q)/(H+1))}else L=B=0}E>Ys?B>Ys?(b=ao(P,j,O,M,p,B,m),_=ao(R,Z,I,F,p,B,m),o.moveTo(b.cx+b.x01,b.cy+b.y01),B<A?o.arc(b.cx,b.cy,B,Fs(b.y01,b.x01),Fs(_.y01,_.x01),!m):(o.arc(b.cx,b.cy,B,Fs(b.y01,b.x01),Fs(b.y11,b.x11),!m),o.arc(0,0,p,Fs(b.cy+b.y11,b.cx+b.x11),Fs(_.cy+_.y11,_.cx+_.x11),!m),o.arc(_.cx,_.cy,B,Fs(_.y11,_.x11),Fs(_.y01,_.x01),!m))):(o.moveTo(O,M),o.arc(0,0,p,x,v,!m)):o.moveTo(O,M),d>Ys&&C>Ys?L>Ys?(b=ao(I,F,R,Z,d,-L,m),_=ao(O,M,P,j,d,-L,m),o.lineTo(b.cx+b.x01,b.cy+b.y01),L<A?o.arc(b.cx,b.cy,L,Fs(b.y01,b.x01),Fs(_.y01,_.x01),!m):(o.arc(b.cx,b.cy,L,Fs(b.y01,b.x01),Fs(b.y11,b.x11),!m),o.arc(0,0,d,Fs(b.cy+b.y11,b.cx+b.x11),Fs(_.cy+_.y11,_.cx+_.x11),m),o.arc(_.cx,_.cy,L,Fs(_.y11,_.x11),Fs(_.y01,_.x01),!m))):o.arc(0,0,d,w,k,m):o.lineTo(I,F)}else o.moveTo(0,0);if(o.closePath(),l)return o=null,l+""||null}return l.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-zs/2;return[$s(r)*n,Ps(r)*n]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Ms(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Ms(+t),l):e},l.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Ms(+t),l):n},l.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Ms(+t),l):r},l.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Ms(+t),l):i},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ms(+t),l):a},l.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:Ms(+t),l):s},l.context=function(t){return arguments.length?(o=null==t?null:t,l):o},l}Ks.prototype;Array.prototype.slice;function oo(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function co(t){this._context=t}function lo(t){return new co(t)}function ho(t){return t[0]}function uo(t){return t[1]}function po(t,e){var n=Ms(!0),r=null,i=lo,a=null,s=Js(o);function o(o){var c,l,h,u=(o=oo(o)).length,d=!1;for(null==r&&(a=i(h=s())),c=0;c<=u;++c)!(c<u&&n(l=o[c],c,o))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+t(l,c,o),+e(l,c,o));if(h)return a=null,h+""||null}return t="function"==typeof t?t:void 0===t?ho:Ms(t),e="function"==typeof e?e:void 0===e?uo:Ms(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:Ms(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Ms(+t),o):e},o.defined=function(t){return arguments.length?(n="function"==typeof t?t:Ms(!!t),o):n},o.curve=function(t){return arguments.length?(i=t,null!=r&&(a=i(r)),o):i},o.context=function(t){return arguments.length?(null==t?r=a=null:a=i(r=t),o):r},o}function fo(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function go(t){return t}function yo(){var t=go,e=fo,n=null,r=Ms(0),i=Ms(Ws),a=Ms(0);function s(s){var o,c,l,h,u,d=(s=oo(s)).length,p=0,f=new Array(d),g=new Array(d),y=+r.apply(this,arguments),m=Math.min(Ws,Math.max(-Ws,i.apply(this,arguments)-y)),b=Math.min(Math.abs(m)/d,a.apply(this,arguments)),_=b*(m<0?-1:1);for(o=0;o<d;++o)(u=g[f[o]=o]=+t(s[o],o,s))>0&&(p+=u);for(null!=e?f.sort((function(t,n){return e(g[t],g[n])})):null!=n&&f.sort((function(t,e){return n(s[t],s[e])})),o=0,l=p?(m-d*_)/p:0;o<d;++o,y=h)c=f[o],h=y+((u=g[c])>0?u*l:0)+_,g[c]={data:s[c],index:o,value:u,startAngle:y,endAngle:h,padAngle:b};return g}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:Ms(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,n=null,s):e},s.sort=function(t){return arguments.length?(n=t,e=null,s):n},s.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Ms(+t),s):r},s.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Ms(+t),s):i},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ms(+t),s):a},s}function mo(){}function bo(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function _o(t){this._context=t}function xo(t){return new _o(t)}function vo(t){this._context=t}function ko(t){return new vo(t)}function wo(t){this._context=t}function Co(t){return new wo(t)}co.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},_o.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:bo(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:bo(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},vo.prototype={areaStart:mo,areaEnd:mo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:bo(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},wo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:bo(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};class Eo{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function To(t){return new Eo(t,!0)}function So(t){return new Eo(t,!1)}function Ao(t,e){this._basis=new _o(t),this._beta=e}Ao.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],a=e[0],s=t[n]-i,o=e[n]-a,c=-1;++c<=n;)r=c/n,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*s),this._beta*e[c]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const Lo=function t(e){function n(t){return 1===e?new _o(t):new Ao(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Bo(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function No(t,e){this._context=t,this._k=(1-e)/6}No.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Bo(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Bo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Do=function t(e){function n(t){return new No(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Oo(t,e){this._context=t,this._k=(1-e)/6}Oo.prototype={areaStart:mo,areaEnd:mo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Bo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Mo=function t(e){function n(t){return new Oo(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Io(t,e){this._context=t,this._k=(1-e)/6}Io.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bo(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Fo=function t(e){function n(t){return new Io(t,e)}return n.tension=function(e){return t(+e)},n}(0);function $o(t,e,n){var r=t._x1,i=t._y1,a=t._x2,s=t._y2;if(t._l01_a>Ys){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>Ys){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,h=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*l+t._x1*t._l23_2a-e*t._l12_2a)/h,s=(s*l+t._y1*t._l23_2a-n*t._l12_2a)/h}t._context.bezierCurveTo(r,i,a,s,t._x2,t._y2)}function Ro(t,e){this._context=t,this._alpha=e}Ro.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:$o(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Zo=function t(e){function n(t){return e?new Ro(t,e):new No(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Po(t,e){this._context=t,this._alpha=e}Po.prototype={areaStart:mo,areaEnd:mo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:$o(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const jo=function t(e){function n(t){return e?new Po(t,e):new Oo(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Yo(t,e){this._context=t,this._alpha=e}Yo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:$o(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const zo=function t(e){function n(t){return e?new Yo(t,e):new Io(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Uo(t){this._context=t}function Wo(t){return new Uo(t)}function Ho(t){return t<0?-1:1}function qo(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(Ho(a)+Ho(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function Vo(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Go(t,e,n){var r=t._x0,i=t._y0,a=t._x1,s=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*e,a-o,s-o*n,a,s)}function Xo(t){this._context=t}function Qo(t){this._context=new Ko(t)}function Ko(t){this._context=t}function Jo(t){return new Xo(t)}function tc(t){return new Qo(t)}function ec(t){this._context=t}function nc(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),s=new Array(r);for(i[0]=0,a[0]=2,s[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,s[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,s[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,s[e]-=n*s[e-1];for(i[r-1]=s[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(s[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function rc(t){return new ec(t)}function ic(t,e){this._context=t,this._t=e}function ac(t){return new ic(t,.5)}function sc(t){return new ic(t,0)}function oc(t){return new ic(t,1)}function cc(t,e,n){this.k=t,this.x=e,this.y=n}Uo.prototype={areaStart:mo,areaEnd:mo,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},Xo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Go(this,this._t0,Vo(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Go(this,Vo(this,n=qo(this,t,e)),n);break;default:Go(this,this._t0,n=qo(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Qo.prototype=Object.create(Xo.prototype)).point=function(t,e){Xo.prototype.point.call(this,e,t)},Ko.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,a){this._context.bezierCurveTo(e,t,r,n,a,i)}},ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=nc(t),i=nc(e),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[s],e[s]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},ic.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}},cc.prototype={constructor:cc,scale:function(t){return 1===t?this:new cc(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new cc(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new cc(1,0,0);cc.prototype},13768:(t,e,n)=>{"use strict";function r(t,e,n,r){var a,s,o,c,l,h,u,d,p,f,g,y,m;if(a=e.y-t.y,o=t.x-e.x,l=e.x*t.y-t.x*e.y,p=a*n.x+o*n.y+l,f=a*r.x+o*r.y+l,!(0!==p&&0!==f&&i(p,f)||(s=r.y-n.y,c=n.x-r.x,h=r.x*n.y-n.x*r.y,u=s*t.x+c*t.y+h,d=s*e.x+c*e.y+h,0!==u&&0!==d&&i(u,d)||0==(g=a*c-s*o))))return y=Math.abs(g/2),{x:(m=o*h-c*l)<0?(m-y)/g:(m+y)/g,y:(m=s*l-a*h)<0?(m-y)/g:(m+y)/g}}function i(t,e){return t*e>0}function a(t,e,n){var i=t.x,a=t.y,s=[],o=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;e.forEach((function(t){o=Math.min(o,t.x),c=Math.min(c,t.y)}));for(var l=i-t.width/2-o,h=a-t.height/2-c,u=0;u<e.length;u++){var d=e[u],p=e[u<e.length-1?u+1:0],f=r(t,n,{x:l+d.x,y:h+d.y},{x:l+p.x,y:h+p.y});f&&s.push(f)}return s.length?(s.length>1&&s.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),s=e.x-n.x,o=e.y-n.y,c=Math.sqrt(s*s+o*o);return a<c?-1:a===c?0:1})),s[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",t),t)}n.d(e,{A:()=>a})},62945:(t,e,n)=>{"use strict";function r(t,e){var n,r,i=t.x,a=t.y,s=e.x-i,o=e.y-a,c=t.width/2,l=t.height/2;return Math.abs(o)*c>Math.abs(s)*l?(o<0&&(l=-l),n=0===o?0:l*s/o,r=l):(s<0&&(c=-c),n=c,r=0===s?0:c*o/s),{x:i+n,y:a+r}}n.d(e,{q:()=>r})},96157:(t,e,n)=>{"use strict";n.d(e,{a:()=>i});var r=n(36715);function i(t,e){var n=t.append("foreignObject").attr("width","100000"),i=n.append("xhtml:div");i.attr("xmlns","http://www.w3.org/1999/xhtml");var a=e.label;switch(typeof a){case"function":i.insert(a);break;case"object":i.insert((function(){return a}));break;default:i.html(a)}r.bg(i,e.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap");var s=i.node().getBoundingClientRect();return n.attr("width",s.width).attr("height",s.height),n}},36715:(t,e,n)=>{"use strict";n.d(e,{$p:()=>h,O1:()=>s,WR:()=>u,bF:()=>a,bg:()=>l});var r=n(22701),i=n(78246);function a(t,e){return!!t.children(e).length}function s(t){return c(t.v)+":"+c(t.w)+":"+c(t.name)}var o=/:/g;function c(t){return t?String(t).replace(o,"\\:"):""}function l(t,e){e&&t.attr("style",e)}function h(t,e,n){e&&t.attr("class",e).attr("class",n+" "+t.attr("class"))}function u(t,e){var n=e.graph();if(r.Z(n)){var a=n.transition;if(i.Z(a))return a(t)}return t}},86161:(t,e,n)=>{"use strict";n.d(e,{bK:()=>Ge});var r=n(46188),i=n(63345),a=n(88103),s=n(2977),o=n(94605),c=n(27206),l=n(1110),h=n(88472);class u{constructor(){var t={};t._next=t._prev=t,this._sentinel=t}dequeue(){var t=this._sentinel,e=t._prev;if(e!==t)return d(e),e}enqueue(t){var e=this._sentinel;t._prev&&t._next&&d(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,p)),n=n._prev;return"["+t.join(", ")+"]"}}function d(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function p(t,e){if("_next"!==t&&"_prev"!==t)return e}var f=s.Z(1);function g(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new h.k,i=0,a=0;r.Z(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),r.Z(t.edges(),(function(t){var r=n.edge(t.v,t.w)||0,s=e(t),o=r+s;n.setEdge(t.v,t.w,o),a=Math.max(a,n.node(t.v).out+=s),i=Math.max(i,n.node(t.w).in+=s)}));var s=l.Z(a+i+3).map((function(){return new u})),o=i+1;return r.Z(n.nodes(),(function(t){m(s,o,n.node(t))})),{graph:n,buckets:s,zeroIdx:o}}(t,e||f),i=function(t,e,n){var r,i=[],a=e[e.length-1],s=e[0];for(;t.nodeCount();){for(;r=s.dequeue();)y(t,e,n,r);for(;r=a.dequeue();)y(t,e,n,r);if(t.nodeCount())for(var o=e.length-2;o>0;--o)if(r=e[o].dequeue()){i=i.concat(y(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return o.Z(c.Z(i,(function(e){return t.outEdges(e.v,e.w)})))}function y(t,e,n,i,a){var s=a?[]:void 0;return r.Z(t.inEdges(i.v),(function(r){var i=t.edge(r),o=t.node(r.v);a&&s.push({v:r.v,w:r.w}),o.out-=i,m(e,n,o)})),r.Z(t.outEdges(i.v),(function(r){var i=t.edge(r),a=r.w,s=t.node(a);s.in-=i,m(e,n,s)})),t.removeNode(i.v),s}function m(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}function b(t){var e="greedy"===t.graph().acyclicer?g(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},i={};function s(o){a.Z(i,o)||(i[o]=!0,n[o]=!0,r.Z(t.outEdges(o),(function(t){a.Z(n,t.w)?e.push(t):s(t.w)})),delete n[o])}return r.Z(t.nodes(),s),e}(t);r.Z(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,i.Z("rev"))}))}var _=n(72178),x=n(10541),v=n(28916);const k=function(t,e,n){(void 0!==n&&!(0,v.Z)(t[e],n)||void 0===n&&!(e in t))&&(0,x.Z)(t,e,n)};var w=n(30434),C=n(23999),E=n(24763),T=n(98058),S=n(33731),A=n(5998),L=n(47838),B=n(93530),N=n(45633),D=n(78246),O=n(80369),M=n(22701),I=n(17065);const F=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]};var $=n(46518),R=n(86483);const Z=function(t){return(0,$.Z)(t,(0,R.Z)(t))};const P=function(t,e,n,r,i,a,s){var o=F(t,n),c=F(e,n),l=s.get(c);if(l)k(t,n,l);else{var h=a?a(o,c,n+"",t,e,s):void 0,u=void 0===h;if(u){var d=(0,L.Z)(c),p=!d&&(0,N.Z)(c),f=!d&&!p&&(0,I.Z)(c);h=c,d||p||f?(0,L.Z)(o)?h=o:(0,B.Z)(o)?h=(0,T.Z)(o):p?(u=!1,h=(0,C.Z)(c,!0)):f?(u=!1,h=(0,E.Z)(c,!0)):h=[]:(0,M.Z)(c)||(0,A.Z)(c)?(h=o,(0,A.Z)(o)?h=Z(o):(0,O.Z)(o)&&!(0,D.Z)(o)||(h=(0,S.Z)(c))):u=!1}u&&(s.set(c,h),i(h,c,r,a,s),s.delete(c)),k(t,n,h)}};const j=function t(e,n,r,i,a){e!==n&&(0,w.Z)(n,(function(s,o){if(a||(a=new _.Z),(0,O.Z)(s))P(e,n,o,r,t,i,a);else{var c=i?i(F(e,o),s,o+"",e,n,a):void 0;void 0===c&&(c=s),k(e,o,c)}}),R.Z)};var Y=n(92042),z=n(84264);const U=function(t){return(0,Y.Z)((function(e,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,s&&(0,z.Z)(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,a)}return e}))}((function(t,e,n){j(t,e,n)}));var W=n(25541),H=n(65029),q=n(54878);const V=function(t,e,n){for(var r=-1,i=t.length;++r<i;){var a=t[r],s=e(a);if(null!=s&&(void 0===o?s==s&&!(0,q.Z)(s):n(s,o)))var o=s,c=a}return c};const G=function(t,e){return t>e};var X=n(84111);const Q=function(t){return t&&t.length?V(t,X.Z,G):void 0};const K=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0};var J=n(51877),tt=n(90510);const et=function(t,e){var n={};return e=(0,tt.Z)(e,3),(0,J.Z)(t,(function(t,r,i){(0,x.Z)(n,r,e(t,r,i))})),n};var nt=n(6524);const rt=function(t,e){return t<e};const it=function(t){return t&&t.length?V(t,X.Z,rt):void 0};var at=n(97659);const st=function(){return at.Z.Date.now()};function ot(t,e,n,r){var a;do{a=i.Z(r)}while(t.hasNode(a));return n.dummy=e,t.setNode(a,n),a}function ct(t){var e=new h.k({multigraph:t.isMultigraph()}).setGraph(t.graph());return r.Z(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),r.Z(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e}function lt(t,e){var n,r,i=t.x,a=t.y,s=e.x-i,o=e.y-a,c=t.width/2,l=t.height/2;if(!s&&!o)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(o)*c>Math.abs(s)*l?(o<0&&(l=-l),n=l*s/o,r=l):(s<0&&(c=-c),n=c,r=c*o/s),{x:i+n,y:a+r}}function ht(t){var e=c.Z(l.Z(dt(t)+1),(function(){return[]}));return r.Z(t.nodes(),(function(n){var r=t.node(n),i=r.rank;nt.Z(i)||(e[i][r.order]=n)})),e}function ut(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),ot(t,"border",i,e)}function dt(t){return Q(c.Z(t.nodes(),(function(e){var n=t.node(e).rank;if(!nt.Z(n))return n})))}function pt(t,e){var n=st();try{return e()}finally{console.log(t+" time: "+(st()-n)+"ms")}}function ft(t,e){return e()}function gt(t,e,n,r,i,a){var s={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],c=ot(t,"border",s,n);i[e][a]=c,t.setParent(c,r),o&&t.setEdge(o,c,{weight:1})}function yt(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){r.Z(t.nodes(),(function(e){_t(t.node(e))})),r.Z(t.edges(),(function(e){var n=t.edge(e);r.Z(n.points,_t),a.Z(n,"y")&&_t(n)}))}(t),"lr"!==e&&"rl"!==e||(!function(t){r.Z(t.nodes(),(function(e){xt(t.node(e))})),r.Z(t.edges(),(function(e){var n=t.edge(e);r.Z(n.points,xt),a.Z(n,"x")&&xt(n)}))}(t),mt(t))}function mt(t){r.Z(t.nodes(),(function(e){bt(t.node(e))})),r.Z(t.edges(),(function(e){bt(t.edge(e))}))}function bt(t){var e=t.width;t.width=t.height,t.height=e}function _t(t){t.y=-t.y}function xt(t){var e=t.x;t.x=t.y,t.y=e}function vt(t){t.graph().dummyChains=[],r.Z(t.edges(),(function(e){!function(t,e){var n,r,i,a=e.v,s=t.node(a).rank,o=e.w,c=t.node(o).rank,l=e.name,h=t.edge(e),u=h.labelRank;if(c===s+1)return;for(t.removeEdge(e),i=0,++s;s<c;++i,++s)h.points=[],n=ot(t,"edge",r={width:0,height:0,edgeLabel:h,edgeObj:e,rank:s},"_d"),s===u&&(r.width=h.width,r.height=h.height,r.dummy="edge-label",r.labelpos=h.labelpos),t.setEdge(a,n,{weight:h.weight},l),0===i&&t.graph().dummyChains.push(n),a=n;t.setEdge(a,o,{weight:h.weight},l)}(t,e)}))}const kt=function(t,e){return t&&t.length?V(t,(0,tt.Z)(e,2),rt):void 0};function wt(t){var e={};r.Z(t.sources(),(function n(r){var i=t.node(r);if(a.Z(e,r))return i.rank;e[r]=!0;var s=it(c.Z(t.outEdges(r),(function(e){return n(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))}function Ct(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function Et(t){var e,n,r=new h.k({directed:!1}),i=t.nodes()[0],a=t.nodeCount();for(r.setNode(i,{});Tt(r,t)<a;)e=St(r,t),n=r.hasNode(e.v)?Ct(t,e):-Ct(t,e),At(r,t,n);return r}function Tt(t,e){return r.Z(t.nodes(),(function n(i){r.Z(e.nodeEdges(i),(function(r){var a=r.v,s=i===a?r.w:a;t.hasNode(s)||Ct(e,r)||(t.setNode(s,{}),t.setEdge(i,s,{}),n(s))}))})),t.nodeCount()}function St(t,e){return kt(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return Ct(e,n)}))}function At(t,e,n){r.Z(t.nodes(),(function(t){e.node(t).rank+=n}))}var Lt=n(79458),Bt=n(94778);const Nt=function(t){return function(e,n,r){var i=Object(e);if(!(0,Lt.Z)(e)){var a=(0,tt.Z)(n,3);e=(0,Bt.Z)(e),n=function(t){return a(i[t],t,i)}}var s=t(e,n,r);return s>-1?i[a?e[s]:s]:void 0}};var Dt=n(78953),Ot=n(26460);const Mt=function(t){var e=(0,Ot.Z)(t),n=e%1;return e==e?n?e-n:e:0};var It=Math.max;const Ft=Nt((function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:Mt(n);return i<0&&(i=It(r+i,0)),(0,Dt.Z)(t,(0,tt.Z)(e,3),i)}));var $t=n(88205);s.Z(1);s.Z(1);n(58410),n(68023),n(97640),n(18742);(0,n(32965).Z)("length");RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Rt="\\ud800-\\udfff",Zt="["+Rt+"]",Pt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",jt="\\ud83c[\\udffb-\\udfff]",Yt="[^"+Rt+"]",zt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="(?:"+Pt+"|"+jt+")"+"?",Ht="[\\ufe0e\\ufe0f]?",qt=Ht+Wt+("(?:\\u200d(?:"+[Yt,zt,Ut].join("|")+")"+Ht+Wt+")*"),Vt="(?:"+[Yt+Pt+"?",Pt,zt,Ut,Zt].join("|")+")";RegExp(jt+"(?="+jt+")|"+Vt+qt,"g");function Gt(){}function Xt(t,e,n){L.Z(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],s={};return r.Z(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);Qt(t,e,"post"===n,s,i,a)})),a}function Qt(t,e,n,i,s,o){a.Z(i,e)||(i[e]=!0,n||o.push(e),r.Z(s(e),(function(e){Qt(t,e,n,i,s,o)})),n&&o.push(e))}Gt.prototype=new Error;n(96635);function Kt(t){t=function(t){var e=(new h.k).setGraph(t.graph());return r.Z(t.nodes(),(function(n){e.setNode(n,t.node(n))})),r.Z(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e}(t),wt(t);var e,n=Et(t);for(ee(n),Jt(n,t);e=re(n);)ae(n,t,e,ie(n,t,e))}function Jt(t,e){var n=function(t,e){return Xt(t,e,"post")}(t,t.nodes());n=n.slice(0,n.length-1),r.Z(n,(function(n){!function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=te(t,e,n)}(t,e,n)}))}function te(t,e,n){var i=t.node(n).parent,a=!0,s=e.edge(n,i),o=0;return s||(a=!1,s=e.edge(i,n)),o=s.weight,r.Z(e.nodeEdges(n),(function(r){var s,c,l=r.v===n,h=l?r.w:r.v;if(h!==i){var u=l===a,d=e.edge(r).weight;if(o+=u?d:-d,s=n,c=h,t.hasEdge(s,c)){var p=t.edge(n,h).cutvalue;o+=u?-p:p}}})),o}function ee(t,e){arguments.length<2&&(e=t.nodes()[0]),ne(t,{},1,e)}function ne(t,e,n,i,s){var o=n,c=t.node(i);return e[i]=!0,r.Z(t.neighbors(i),(function(r){a.Z(e,r)||(n=ne(t,e,n,r,i))})),c.low=o,c.lim=n++,s?c.parent=s:delete c.parent,n}function re(t){return Ft(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function ie(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var a=t.node(r),s=t.node(i),o=a,c=!1;a.lim>s.lim&&(o=s,c=!0);var l=$t.Z(e.edges(),(function(e){return c===se(t,t.node(e.v),o)&&c!==se(t,t.node(e.w),o)}));return kt(l,(function(t){return Ct(e,t)}))}function ae(t,e,n,i){var a=n.v,s=n.w;t.removeEdge(a,s),t.setEdge(i.v,i.w,{}),ee(t),Jt(t,e),function(t,e){var n=Ft(t.nodes(),(function(t){return!e.node(t).parent})),i=function(t,e){return Xt(t,e,"pre")}(t,n);i=i.slice(1),r.Z(i,(function(n){var r=t.node(n).parent,i=e.edge(n,r),a=!1;i||(i=e.edge(r,n),a=!0),e.node(n).rank=e.node(r).rank+(a?i.minlen:-i.minlen)}))}(t,e)}function se(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}function oe(t){switch(t.graph().ranker){case"network-simplex":default:le(t);break;case"tight-tree":!function(t){wt(t),Et(t)}(t);break;case"longest-path":ce(t)}}Kt.initLowLimValues=ee,Kt.initCutValues=Jt,Kt.calcCutValue=te,Kt.leaveEdge=re,Kt.enterEdge=ie,Kt.exchangeEdges=ae;var ce=wt;function le(t){Kt(t)}var he=n(95179),ue=n(54632);function de(t){var e=ot(t,"root",{},"_root"),n=function(t){var e={};function n(i,a){var s=t.children(i);s&&s.length&&r.Z(s,(function(t){n(t,a+1)})),e[i]=a}return r.Z(t.children(),(function(t){n(t,1)})),e}(t),i=Q(he.Z(n))-1,a=2*i+1;t.graph().nestingRoot=e,r.Z(t.edges(),(function(e){t.edge(e).minlen*=a}));var s=function(t){return ue.Z(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;r.Z(t.children(),(function(r){pe(t,e,a,s,i,n,r)})),t.graph().nodeRankFactor=a}function pe(t,e,n,i,a,s,o){var c=t.children(o);if(c.length){var l=ut(t,"_bt"),h=ut(t,"_bb"),u=t.node(o);t.setParent(l,o),u.borderTop=l,t.setParent(h,o),u.borderBottom=h,r.Z(c,(function(r){pe(t,e,n,i,a,s,r);var c=t.node(r),u=c.borderTop?c.borderTop:r,d=c.borderBottom?c.borderBottom:r,p=c.borderTop?i:2*i,f=u!==d?1:a-s[o]+1;t.setEdge(l,u,{weight:p,minlen:f,nestingEdge:!0}),t.setEdge(d,h,{weight:p,minlen:f,nestingEdge:!0})})),t.parent(o)||t.setEdge(e,l,{weight:0,minlen:a+s[o]})}else o!==e&&t.setEdge(e,o,{weight:0,minlen:n})}var fe=n(31066);const ge=function(t){return(0,fe.Z)(t,5)};function ye(t,e,n){var s=function(t){var e;for(;t.hasNode(e=i.Z("_root")););return e}(t),o=new h.k({compound:!0}).setGraph({root:s}).setDefaultNodeLabel((function(e){return t.node(e)}));return r.Z(t.nodes(),(function(i){var c=t.node(i),l=t.parent(i);(c.rank===e||c.minRank<=e&&e<=c.maxRank)&&(o.setNode(i),o.setParent(i,l||s),r.Z(t[n](i),(function(e){var n=e.v===i?e.w:e.v,r=o.edge(n,i),a=nt.Z(r)?0:r.weight;o.setEdge(n,i,{weight:t.edge(e).weight+a})})),a.Z(c,"minRank")&&o.setNode(i,{borderLeft:c.borderLeft[e],borderRight:c.borderRight[e]}))})),o}var me=n(84424);const be=function(t,e,n){for(var r=-1,i=t.length,a=e.length,s={};++r<i;){var o=r<a?e[r]:void 0;n(s,t[r],o)}return s};const _e=function(t,e){return be(t||[],e||[],me.Z)};var xe=n(45556),ve=n(90497),ke=n(42825),we=n(46133);const Ce=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t};var Ee=n(42052);const Te=function(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,a=(0,q.Z)(t),s=void 0!==e,o=null===e,c=e==e,l=(0,q.Z)(e);if(!o&&!l&&!a&&t>e||a&&s&&c&&!o&&!l||r&&s&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&t<e||l&&n&&i&&!r&&!a||o&&n&&i||!s&&i||!c)return-1}return 0};const Se=function(t,e,n){for(var r=-1,i=t.criteria,a=e.criteria,s=i.length,o=n.length;++r<s;){var c=Te(i[r],a[r]);if(c)return r>=o?c:c*("desc"==n[r]?-1:1)}return t.index-e.index};const Ae=function(t,e,n){e=e.length?(0,ve.Z)(e,(function(t){return(0,L.Z)(t)?function(e){return(0,ke.Z)(e,1===t.length?t[0]:t)}:t})):[X.Z];var r=-1;e=(0,ve.Z)(e,(0,Ee.Z)(tt.Z));var i=(0,we.Z)(t,(function(t,n,i){return{criteria:(0,ve.Z)(e,(function(e){return e(t)})),index:++r,value:t}}));return Ce(i,(function(t,e){return Se(t,e,n)}))};const Le=(0,Y.Z)((function(t,e){if(null==t)return[];var n=e.length;return n>1&&(0,z.Z)(t,e[0],e[1])?e=[]:n>2&&(0,z.Z)(e[0],e[1],e[2])&&(e=[e[0]]),Ae(t,(0,xe.Z)(e,1),[])}));function Be(t,e){for(var n=0,r=1;r<e.length;++r)n+=Ne(t,e[r-1],e[r]);return n}function Ne(t,e,n){for(var i=_e(n,c.Z(n,(function(t,e){return e}))),a=o.Z(c.Z(e,(function(e){return Le(c.Z(t.outEdges(e),(function(e){return{pos:i[e.w],weight:t.edge(e).weight}})),"pos")}))),s=1;s<n.length;)s<<=1;var l=2*s-1;s-=1;var h=c.Z(new Array(l),(function(){return 0})),u=0;return r.Z(a.forEach((function(t){var e=t.pos+s;h[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=h[e+1]),h[e=e-1>>1]+=t.weight;u+=t.weight*n}))),u}function De(t,e){var n={};return r.Z(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};nt.Z(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),r.Z(e.edges(),(function(t){var e=n[t.v],r=n[t.w];nt.Z(e)||nt.Z(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(nt.Z(e.barycenter)||nt.Z(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function i(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var a=t.pop();e.push(a),r.Z(a.in.reverse(),n(a)),r.Z(a.out,i(a))}return c.Z($t.Z(e,(function(t){return!t.merged})),(function(t){return W.Z(t,["vs","i","barycenter","weight"])}))}($t.Z(n,(function(t){return!t.indegree})))}function Oe(t,e){var n,i=function(t,e){var n={lhs:[],rhs:[]};return r.Z(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n}(t,(function(t){return a.Z(t,"barycenter")})),s=i.lhs,c=Le(i.rhs,(function(t){return-t.i})),l=[],h=0,u=0,d=0;s.sort((n=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:n?e.i-t.i:t.i-e.i})),d=Me(l,c,d),r.Z(s,(function(t){d+=t.vs.length,l.push(t.vs),h+=t.barycenter*t.weight,u+=t.weight,d=Me(l,c,d)}));var p={vs:o.Z(l)};return u&&(p.barycenter=h/u,p.weight=u),p}function Me(t,e,n){for(var r;e.length&&(r=K(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}function Ie(t,e,n,i){var s=t.children(e),l=t.node(e),h=l?l.borderLeft:void 0,u=l?l.borderRight:void 0,d={};h&&(s=$t.Z(s,(function(t){return t!==h&&t!==u})));var p=function(t,e){return c.Z(e,(function(e){var n=t.inEdges(e);if(n.length){var r=ue.Z(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))}(t,s);r.Z(p,(function(e){if(t.children(e.v).length){var r=Ie(t,e.v,n,i);d[e.v]=r,a.Z(r,"barycenter")&&(s=e,o=r,nt.Z(s.barycenter)?(s.barycenter=o.barycenter,s.weight=o.weight):(s.barycenter=(s.barycenter*s.weight+o.barycenter*o.weight)/(s.weight+o.weight),s.weight+=o.weight))}var s,o}));var f=De(p,n);!function(t,e){r.Z(t,(function(t){t.vs=o.Z(t.vs.map((function(t){return e[t]?e[t].vs:t})))}))}(f,d);var g=Oe(f,i);if(h&&(g.vs=o.Z([h,g.vs,u]),t.predecessors(h).length)){var y=t.node(t.predecessors(h)[0]),m=t.node(t.predecessors(u)[0]);a.Z(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+y.order+m.order)/(g.weight+2),g.weight+=2}return g}function Fe(t){var e=dt(t),n=$e(t,l.Z(1,e+1),"inEdges"),i=$e(t,l.Z(e-1,-1,-1),"outEdges"),s=function(t){var e={},n=$t.Z(t.nodes(),(function(e){return!t.children(e).length})),i=Q(c.Z(n,(function(e){return t.node(e).rank}))),s=c.Z(l.Z(i+1),(function(){return[]})),o=Le(n,(function(e){return t.node(e).rank}));return r.Z(o,(function n(i){if(!a.Z(e,i)){e[i]=!0;var o=t.node(i);s[o.rank].push(i),r.Z(t.successors(i),n)}})),s}(t);Ze(t,s);for(var o,h=Number.POSITIVE_INFINITY,u=0,d=0;d<4;++u,++d){Re(u%2?n:i,u%4>=2);var p=Be(t,s=ht(t));p<h&&(d=0,o=ge(s),h=p)}Ze(t,o)}function $e(t,e,n){return c.Z(e,(function(e){return ye(t,e,n)}))}function Re(t,e){var n=new h.k;r.Z(t,(function(t){var i=t.graph().root,a=Ie(t,i,n,e);r.Z(a.vs,(function(e,n){t.node(e).order=n})),function(t,e,n){var i,a={};r.Z(n,(function(n){for(var r,s,o=t.parent(n);o;){if((r=t.parent(o))?(s=a[r],a[r]=o):(s=i,i=o),s&&s!==o)return void e.setEdge(s,o);o=r}}))}(t,n,a.vs)}))}function Ze(t,e){r.Z(e,(function(e){r.Z(e,(function(e,n){t.node(e).order=n}))}))}function Pe(t){var e=function(t){var e={},n=0;function i(a){var s=n;r.Z(t.children(a),i),e[a]={low:s,lim:n++}}return r.Z(t.children(),i),e}(t);r.Z(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,a=function(t,e,n,r){var i,a,s=[],o=[],c=Math.min(e[n].low,e[r].low),l=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),s.push(i)}while(i&&(e[i].low>c||l>e[i].lim));a=i,i=r;for(;(i=t.parent(i))!==a;)o.push(i);return{path:s.concat(o.reverse()),lca:a}}(t,e,i.v,i.w),s=a.path,o=a.lca,c=0,l=s[c],h=!0;n!==i.w;){if(r=t.node(n),h){for(;(l=s[c])!==o&&t.node(l).maxRank<r.rank;)c++;l===o&&(h=!1)}if(!h){for(;c<s.length-1&&t.node(l=s[c+1]).minRank<=r.rank;)c++;l=s[c]}t.setParent(n,l),n=t.successors(n)[0]}}))}var je=n(22412);const Ye=function(t,e){return null==t?t:(0,w.Z)(t,(0,je.Z)(e),R.Z)};function ze(t,e){var n={};return ue.Z(e,(function(e,i){var a=0,s=0,o=e.length,c=K(i);return r.Z(i,(function(e,l){var h=function(t,e){if(t.node(e).dummy)return Ft(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),u=h?t.node(h).order:o;(h||e===c)&&(r.Z(i.slice(s,l+1),(function(e){r.Z(t.predecessors(e),(function(r){var i=t.node(r),s=i.order;!(s<a||u<s)||i.dummy&&t.node(e).dummy||Ue(n,r,e)}))})),s=l+1,a=u)})),i})),n}function Ue(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function We(t,e,n){if(e>n){var r=e;e=n,n=r}return a.Z(t[e],n)}function He(t,e,n,i,s){var o={},c=function(t,e,n,i){var s=new h.k,o=t.graph(),c=function(t,e,n){return function(r,i,s){var o,c=r.node(i),l=r.node(s),h=0;if(h+=c.width/2,a.Z(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":o=-c.width/2;break;case"r":o=c.width/2}if(o&&(h+=n?o:-o),o=0,h+=(c.dummy?e:t)/2,h+=(l.dummy?e:t)/2,h+=l.width/2,a.Z(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":o=l.width/2;break;case"r":o=-l.width/2}return o&&(h+=n?o:-o),o=0,h}}(o.nodesep,o.edgesep,i);return r.Z(e,(function(e){var i;r.Z(e,(function(e){var r=n[e];if(s.setNode(r),i){var a=n[i],o=s.edge(a,r);s.setEdge(a,r,Math.max(c(t,e,i),o||0))}i=e}))})),s}(t,e,n,s),l=s?"borderLeft":"borderRight";function u(t,e){for(var n=c.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return u((function(t){o[t]=c.inEdges(t).reduce((function(t,e){return Math.max(t,o[e.v]+c.edge(e))}),0)}),c.predecessors.bind(c)),u((function(e){var n=c.outEdges(e).reduce((function(t,e){return Math.min(t,o[e.w]-c.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==l&&(o[e]=Math.max(o[e],n))}),c.successors.bind(c)),r.Z(i,(function(t){o[t]=o[n[t]]})),o}function qe(t){var e,n=ht(t),i=U(ze(t,n),function(t,e){var n={};function i(e,i,a,s,o){var c;r.Z(l.Z(i,a),(function(i){c=e[i],t.node(c).dummy&&r.Z(t.predecessors(c),(function(e){var r=t.node(e);r.dummy&&(r.order<s||r.order>o)&&Ue(n,e,c)}))}))}return ue.Z(e,(function(e,n){var a,s=-1,o=0;return r.Z(n,(function(r,c){if("border"===t.node(r).dummy){var l=t.predecessors(r);l.length&&(a=t.node(l[0]).order,i(n,o,c,s,a),o=c,s=a)}i(n,o,n.length,a,e.length)})),n})),n}(t,n)),a={};r.Z(["u","d"],(function(s){e="u"===s?n:he.Z(n).reverse(),r.Z(["l","r"],(function(n){"r"===n&&(e=c.Z(e,(function(t){return he.Z(t).reverse()})));var o=("u"===s?t.predecessors:t.successors).bind(t),l=function(t,e,n,i){var a={},s={},o={};return r.Z(e,(function(t){r.Z(t,(function(t,e){a[t]=t,s[t]=t,o[t]=e}))})),r.Z(e,(function(t){var e=-1;r.Z(t,(function(t){var r=i(t);if(r.length){r=Le(r,(function(t){return o[t]}));for(var c=(r.length-1)/2,l=Math.floor(c),h=Math.ceil(c);l<=h;++l){var u=r[l];s[t]===t&&e<o[u]&&!We(n,t,u)&&(s[u]=t,s[t]=a[t]=a[u],e=o[u])}}}))})),{root:a,align:s}}(0,e,i,o),h=He(t,e,l.root,l.align,"r"===n);"r"===n&&(h=et(h,(function(t){return-t}))),a[s+n]=h}))}));var s=function(t,e){return kt(he.Z(e),(function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Ye(e,(function(e,i){var a=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+a,n),r=Math.min(e-a,r)})),n-r}))}(t,a);return function(t,e){var n=he.Z(e),i=it(n),a=Q(n);r.Z(["u","d"],(function(n){r.Z(["l","r"],(function(r){var s,o=n+r,c=t[o];if(c!==e){var l=he.Z(c);(s="l"===r?i-it(l):a-Q(l))&&(t[o]=et(c,(function(t){return t+s})))}}))}))}(a,s),function(t,e){return et(t.ul,(function(n,r){if(e)return t[e.toLowerCase()][r];var i=Le(c.Z(t,r));return(i[1]+i[2])/2}))}(a,t.graph().align)}function Ve(t){(function(t){var e=ht(t),n=t.graph().ranksep,i=0;r.Z(e,(function(e){var a=Q(c.Z(e,(function(e){return t.node(e).height})));r.Z(e,(function(e){t.node(e).y=i+a/2})),i+=a+n}))})(t=ct(t)),r.Z(qe(t),(function(e,n){t.node(n).x=e}))}function Ge(t,e){var n=e&&e.debugTiming?pt:ft;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new h.k({multigraph:!0,compound:!0}),n=sn(t.graph());return e.setGraph(U({},Qe,an(n,Xe),W.Z(n,Ke))),r.Z(t.nodes(),(function(n){var r=sn(t.node(n));e.setNode(n,H.Z(an(r,Je),tn)),e.setParent(n,t.parent(n))})),r.Z(t.edges(),(function(n){var r=sn(t.edge(n));e.setEdge(n,U({},nn,an(r,en),W.Z(r,rn)))})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,r.Z(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){r.Z(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){b(t)})),e(" nestingGraph.run",(function(){de(t)})),e(" rank",(function(){oe(ct(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){r.Z(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};ot(t,"edge-proxy",i,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){!function(t){var e=it(c.Z(t.nodes(),(function(e){return t.node(e).rank}))),n=[];r.Z(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var i=0,a=t.graph().nodeRankFactor;r.Z(n,(function(e,n){nt.Z(e)&&n%a!=0?--i:i&&r.Z(e,(function(e){t.node(e).rank+=i}))}))}(t)})),e(" nestingGraph.cleanup",(function(){!function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,r.Z(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}(t)})),e(" normalizeRanks",(function(){!function(t){var e=it(c.Z(t.nodes(),(function(e){return t.node(e).rank})));r.Z(t.nodes(),(function(n){var r=t.node(n);a.Z(r,"rank")&&(r.rank-=e)}))}(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;r.Z(t.nodes(),(function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Q(e,r.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){r.Z(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){vt(t)})),e(" parentDummyChains",(function(){Pe(t)})),e(" addBorderSegments",(function(){!function(t){r.Z(t.children(),(function e(n){var i=t.children(n),s=t.node(n);if(i.length&&r.Z(i,e),a.Z(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var o=s.minRank,c=s.maxRank+1;o<c;++o)gt(t,"borderLeft","_bl",n,s,o),gt(t,"borderRight","_br",n,s,o)}}))}(t)})),e(" order",(function(){Fe(t)})),e(" insertSelfEdges",(function(){!function(t){var e=ht(t);r.Z(e,(function(e){var n=0;r.Z(e,(function(e,i){var a=t.node(e);a.order=i+n,r.Z(a.selfEdges,(function(e){ot(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++n,e:e.e,label:e.label},"_se")})),delete a.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){!function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||mt(t)}(t)})),e(" position",(function(){Ve(t)})),e(" positionSelfEdges",(function(){!function(t){r.Z(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,s=n.x-i,o=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){r.Z(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),a=t.node(K(n.borderLeft)),s=t.node(K(n.borderRight));n.width=Math.abs(s.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}})),r.Z(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){!function(t){r.Z(t.graph().dummyChains,(function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)}))}(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){r.Z(t.edges(),(function(e){var n=t.edge(e);if(a.Z(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){yt(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,s=0,o=t.graph(),c=o.marginx||0,l=o.marginy||0;function h(t){var r=t.x,a=t.y,o=t.width,c=t.height;e=Math.min(e,r-o/2),n=Math.max(n,r+o/2),i=Math.min(i,a-c/2),s=Math.max(s,a+c/2)}r.Z(t.nodes(),(function(e){h(t.node(e))})),r.Z(t.edges(),(function(e){var n=t.edge(e);a.Z(n,"x")&&h(n)})),e-=c,i-=l,r.Z(t.nodes(),(function(n){var r=t.node(n);r.x-=e,r.y-=i})),r.Z(t.edges(),(function(n){var s=t.edge(n);r.Z(s.points,(function(t){t.x-=e,t.y-=i})),a.Z(s,"x")&&(s.x-=e),a.Z(s,"y")&&(s.y-=i)})),o.width=n-e+c,o.height=s-i+l}(t)})),e(" assignNodeIntersects",(function(){!function(t){r.Z(t.edges(),(function(e){var n,r,i=t.edge(e),a=t.node(e.v),s=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=s,r=a),i.points.unshift(lt(a,n)),i.points.push(lt(s,r))}))}(t)})),e(" reversePoints",(function(){!function(t){r.Z(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){!function(t){r.Z(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}(t)}))}(e,n)})),n(" updateInputGraph",(function(){!function(t,e){r.Z(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),r.Z(t.edges(),(function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,a.Z(i,"x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))}var Xe=["nodesep","edgesep","ranksep","marginx","marginy"],Qe={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ke=["acyclicer","ranker","rankdir","align"],Je=["width","height"],tn={width:0,height:0},en=["minlen","weight","width","height","labeloffset"],nn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},rn=["labelpos"];function an(t,e){return et(W.Z(t,e),Number)}function sn(t){var e={};return r.Z(t,(function(t,n){e[n.toLowerCase()]=t})),e}},96635:(t,e,n)=>{"use strict";n.d(e,{k:()=>M});var r=n(88103),i=n(2977),a=n(78246),s=n(94778),o=n(88205),c=n(29955),l=n(46188),h=n(6524),u=n(45556),d=n(92042),p=n(58017),f=n(78953);const g=function(t){return t!=t};const y=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1};const m=function(t,e,n){return e==e?y(t,e,n):(0,f.Z)(t,g,n)};const b=function(t,e){return!!(null==t?0:t.length)&&m(t,e,0)>-1};const _=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1};var x=n(58923),v=n(79228);const k=function(){};var w=n(80877),C=v.Z&&1/(0,w.Z)(new v.Z([,-0]))[1]==1/0?function(t){return new v.Z(t)}:k;const E=C;const T=function(t,e,n){var r=-1,i=b,a=t.length,s=!0,o=[],c=o;if(n)s=!1,i=_;else if(a>=200){var l=e?null:E(t);if(l)return(0,w.Z)(l);s=!1,i=x.Z,c=new p.Z}else c=e?[]:o;t:for(;++r<a;){var h=t[r],u=e?e(h):h;if(h=n||0!==h?h:0,s&&u==u){for(var d=c.length;d--;)if(c[d]===u)continue t;e&&c.push(u),o.push(h)}else i(c,u,n)||(c!==o&&c.push(u),o.push(h))}return o};var S=n(93530);const A=(0,d.Z)((function(t){return T((0,u.Z)(t,1,S.Z,!0))}));var L=n(95179),B=n(54632),N="\0",D="\0",O="\x01";class M{constructor(t={}){this._isDirected=!r.Z(t,"directed")||t.directed,this._isMultigraph=!!r.Z(t,"multigraph")&&t.multigraph,this._isCompound=!!r.Z(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=i.Z(void 0),this._defaultEdgeLabelFn=i.Z(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[D]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return a.Z(t)||(t=i.Z(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return s.Z(this._nodes)}sources(){var t=this;return o.Z(this.nodes(),(function(e){return c.Z(t._in[e])}))}sinks(){var t=this;return o.Z(this.nodes(),(function(e){return c.Z(t._out[e])}))}setNodes(t,e){var n=arguments,r=this;return l.Z(t,(function(t){n.length>1?r.setNode(t,e):r.setNode(t)})),this}setNode(t,e){return r.Z(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=D,this._children[t]={},this._children[D][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return r.Z(this._nodes,t)}removeNode(t){var e=this;if(r.Z(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],l.Z(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),l.Z(s.Z(this._in[t]),n),delete this._in[t],delete this._preds[t],l.Z(s.Z(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(h.Z(e))e=D;else{for(var n=e+="";!h.Z(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==D)return e}}children(t){if(h.Z(t)&&(t=D),this._isCompound){var e=this._children[t];if(e)return s.Z(e)}else{if(t===D)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var e=this._preds[t];if(e)return s.Z(e)}successors(t){var e=this._sucs[t];if(e)return s.Z(e)}neighbors(t){var e=this.predecessors(t);if(e)return A(e,this.successors(t))}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;l.Z(this._nodes,(function(n,r){t(r)&&e.setNode(r,n)})),l.Z(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))}));var r={};function i(t){var a=n.parent(t);return void 0===a||e.hasNode(a)?(r[t]=a,a):a in r?r[a]:i(a)}return this._isCompound&&l.Z(e.nodes(),(function(t){e.setParent(t,i(t))})),e}setDefaultEdgeLabel(t){return a.Z(t)||(t=i.Z(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return L.Z(this._edgeObjs)}setPath(t,e){var n=this,r=arguments;return B.Z(t,(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i})),this}setEdge(){var t,e,n,i,a=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,n=s.name,2===arguments.length&&(i=arguments[1],a=!0)):(t=s,e=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,e=""+e,h.Z(n)||(n=""+n);var o=$(this._isDirected,t,e,n);if(r.Z(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!h.Z(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(t,e,n);var c=function(t,e,n,r){var i=""+e,a=""+n;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};r&&(o.name=r);return o}(this._isDirected,t,e,n);return t=c.v,e=c.w,Object.freeze(c),this._edgeObjs[o]=c,I(this._preds[e],t),I(this._sucs[t],e),this._in[e][o]=c,this._out[t][o]=c,this._edgeCount++,this}edge(t,e,n){var r=1===arguments.length?R(this._isDirected,arguments[0]):$(this._isDirected,t,e,n);return this._edgeLabels[r]}hasEdge(t,e,n){var i=1===arguments.length?R(this._isDirected,arguments[0]):$(this._isDirected,t,e,n);return r.Z(this._edgeLabels,i)}removeEdge(t,e,n){var r=1===arguments.length?R(this._isDirected,arguments[0]):$(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],F(this._preds[e],t),F(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this}inEdges(t,e){var n=this._in[t];if(n){var r=L.Z(n);return e?o.Z(r,(function(t){return t.v===e})):r}}outEdges(t,e){var n=this._out[t];if(n){var r=L.Z(n);return e?o.Z(r,(function(t){return t.w===e})):r}}nodeEdges(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}}function I(t,e){t[e]?t[e]++:t[e]=1}function F(t,e){--t[e]||delete t[e]}function $(t,e,n,r){var i=""+e,a=""+n;if(!t&&i>a){var s=i;i=a,a=s}return i+O+a+O+(h.Z(r)?N:r)}function R(t,e){return $(t,e.v,e.w,e.name)}M.prototype._nodeCount=0,M.prototype._edgeCount=0},88472:(t,e,n)=>{"use strict";n.d(e,{k:()=>r.k});var r=n(96635)},76576:(t,e,n)=>{"use strict";n.d(e,{c:()=>o});var r=n(6524),i=n(31066);const a=function(t){return(0,i.Z)(t,4)};var s=n(27206);n(96635);function o(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:c(t),edges:l(t)};return r.Z(t.graph())||(e.value=a(t.graph())),e}function c(t){return s.Z(t.nodes(),(function(e){var n=t.node(e),i=t.parent(e),a={v:e};return r.Z(n)||(a.value=n),r.Z(i)||(a.parent=i),a}))}function l(t){return s.Z(t.edges(),(function(e){var n=t.edge(e),i={v:e.v,w:e.w};return r.Z(e.name)||(i.name=e.name),r.Z(n)||(i.value=n),i}))}},77567:(t,e,n)=>{"use strict";n.d(e,{sY:()=>E});var r=n(5949),i=n(88103),a=n(65029),s=n(46188),o=n(86161),c=n(36715),l={normal:function(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");c.bg(i,n[r+"Style"]),n[r+"Class"]&&i.attr("class",n[r+"Class"])},vee:function(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");c.bg(i,n[r+"Style"]),n[r+"Class"]&&i.attr("class",n[r+"Class"])},undirected:function(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");c.bg(i,n[r+"Style"]),n[r+"Class"]&&i.attr("class",n[r+"Class"])}};var h=n(96157);function u(t,e,n){var r=e.label,i=t.append("g");"svg"===e.labelType?function(t,e){var n=t;n.node().appendChild(e.label),c.bg(n,e.labelStyle)}(i,e):"string"!=typeof r||"html"===e.labelType?(0,h.a)(i,e):function(t,e){for(var n=t.append("text"),r=function(t){for(var e,n="",r=!1,i=0;i<t.length;++i)e=t[i],r?(n+="n"===e?"\n":e,r=!1):"\\"===e?r=!0:n+=e;return n}(e.label).split("\n"),i=0;i<r.length;i++)n.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(r[i]);c.bg(n,e.labelStyle)}(i,e);var a,s=i.node().getBBox();switch(n){case"top":a=-e.height/2;break;case"bottom":a=e.height/2-s.height;break;default:a=-s.height/2}return i.attr("transform","translate("+-s.width/2+","+a+")"),i}var d=function(t,e){var n=e.nodes().filter((function(t){return c.bF(e,t)})),i=t.selectAll("g.cluster").data(n,(function(t){return t}));c.WR(i.exit(),e).style("opacity",0).remove();var a=i.enter().append("g").attr("class","cluster").attr("id",(function(t){return e.node(t).id})).style("opacity",0).each((function(t){var n=e.node(t),i=r.Ys(this);r.Ys(this).append("rect"),u(i.append("g").attr("class","label"),n,n.clusterLabelPos)}));return i=i.merge(a),(i=c.WR(i,e).style("opacity",1)).selectAll("rect").each((function(t){var n=e.node(t),i=r.Ys(this);c.bg(i,n.style)})),i};let p=function(t,e){var n,a=t.selectAll("g.edgeLabel").data(e.edges(),(function(t){return c.O1(t)})).classed("update",!0);return a.exit().remove(),a.enter().append("g").classed("edgeLabel",!0).style("opacity",0),(a=t.selectAll("g.edgeLabel")).each((function(t){var n=r.Ys(this);n.select(".label").remove();var a=e.edge(t),s=u(n,e.edge(t),0).classed("label",!0),o=s.node().getBBox();a.labelId&&s.attr("id",a.labelId),i.Z(a,"width")||(a.width=o.width),i.Z(a,"height")||(a.height=o.height)})),n=a.exit?a.exit():a.selectAll(null),c.WR(n,e).style("opacity",0).remove(),a};var f=n(63345),g=n(1110);function y(t,e){return t.intersect(e)}var m=function(t,e,n){var i=t.selectAll("g.edgePath").data(e.edges(),(function(t){return c.O1(t)})).classed("update",!0),a=function(t,e){var n=t.enter().append("g").attr("class","edgePath").style("opacity",0);return n.append("path").attr("class","path").attr("d",(function(t){var n=e.edge(t),r=e.node(t.v).elem;return b(n,g.Z(n.points.length).map((function(){return e=(t=r).getBBox(),{x:(n=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:n.f};var t,e,n})))})),n.append("defs"),n}(i,e);!function(t,e){var n=t.exit();c.WR(n,e).style("opacity",0).remove()}(i,e);var s=void 0!==i.merge?i.merge(a):i;return c.WR(s,e).style("opacity",1),s.each((function(t){var n=r.Ys(this),i=e.edge(t);i.elem=this,i.id&&n.attr("id",i.id),c.$p(n,i.class,(n.classed("update")?"update ":"")+"edgePath")})),s.selectAll("path.path").each((function(t){var n=e.edge(t);n.arrowheadId=f.Z("arrowhead");var i=r.Ys(this).attr("marker-end",(function(){return"url("+(t=location.href,e=n.arrowheadId,t.split("#")[0]+"#"+e+")");var t,e})).style("fill","none");c.WR(i,e).attr("d",(function(t){return function(t,e){var n=t.edge(e),r=t.node(e.v),i=t.node(e.w),a=n.points.slice(1,n.points.length-1);return a.unshift(y(r,a[0])),a.push(y(i,a[a.length-1])),b(n,a)}(e,t)})),c.bg(i,n.style)})),s.selectAll("defs *").remove(),s.selectAll("defs").each((function(t){var i=e.edge(t);(0,n[i.arrowhead])(r.Ys(this),i.arrowheadId,i,"arrowhead")})),s};function b(t,e){var n=(r.jvg||r.YPS.line)().x((function(t){return t.x})).y((function(t){return t.y}));return(n.curve||n.interpolate)(t.curve),n(e)}var _=n(25541),x=function(t,e,n){var a,s=e.nodes().filter((function(t){return!c.bF(e,t)})),o=t.selectAll("g.node").data(s,(function(t){return t})).classed("update",!0);return o.exit().remove(),o.enter().append("g").attr("class","node").style("opacity",0),(o=t.selectAll("g.node")).each((function(t){var a=e.node(t),s=r.Ys(this);c.$p(s,a.class,(s.classed("update")?"update ":"")+"node"),s.select("g.label").remove();var o=s.append("g").attr("class","label"),l=u(o,a),h=n[a.shape],d=_.Z(l.node().getBBox(),"width","height");a.elem=this,a.id&&s.attr("id",a.id),a.labelId&&o.attr("id",a.labelId),i.Z(a,"width")&&(d.width=a.width),i.Z(a,"height")&&(d.height=a.height),d.width+=a.paddingLeft+a.paddingRight,d.height+=a.paddingTop+a.paddingBottom,o.attr("transform","translate("+(a.paddingLeft-a.paddingRight)/2+","+(a.paddingTop-a.paddingBottom)/2+")");var p=r.Ys(this);p.select(".label-container").remove();var f=h(p,d,a).classed("label-container",!0);c.bg(f,a.style);var g=f.node().getBBox();a.width=g.width,a.height=g.height})),a=o.exit?o.exit():o.selectAll(null),c.WR(a,e).style("opacity",0).remove(),o};function v(t,e,n,r){var i=t.x,a=t.y,s=i-r.x,o=a-r.y,c=Math.sqrt(e*e*o*o+n*n*s*s),l=Math.abs(e*n*s/c);r.x<i&&(l=-l);var h=Math.abs(e*n*o/c);return r.y<a&&(h=-h),{x:i+l,y:a+h}}var k=n(13768),w=n(62945),C={rect:function(t,e,n){var r=t.insert("rect",":first-child").attr("rx",n.rx).attr("ry",n.ry).attr("x",-e.width/2).attr("y",-e.height/2).attr("width",e.width).attr("height",e.height);return n.intersect=function(t){return(0,w.q)(n,t)},r},ellipse:function(t,e,n){var r=e.width/2,i=e.height/2,a=t.insert("ellipse",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("rx",r).attr("ry",i);return n.intersect=function(t){return v(n,r,i,t)},a},circle:function(t,e,n){var r=Math.max(e.width,e.height)/2,i=t.insert("circle",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("r",r);return n.intersect=function(t){return function(t,e,n){return v(t,e,e,n)}(n,r,t)},i},diamond:function(t,e,n){var r=e.width*Math.SQRT2/2,i=e.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-r,y:0},{x:0,y:i},{x:r,y:0}],s=t.insert("polygon",":first-child").attr("points",a.map((function(t){return t.x+","+t.y})).join(" "));return n.intersect=function(t){return(0,k.A)(n,a,t)},s}};function E(){var t=function(t,e){!function(t){t.nodes().forEach((function(e){var n=t.node(e);i.Z(n,"label")||t.children(e).length||(n.label=e),i.Z(n,"paddingX")&&a.Z(n,{paddingLeft:n.paddingX,paddingRight:n.paddingX}),i.Z(n,"paddingY")&&a.Z(n,{paddingTop:n.paddingY,paddingBottom:n.paddingY}),i.Z(n,"padding")&&a.Z(n,{paddingLeft:n.padding,paddingRight:n.padding,paddingTop:n.padding,paddingBottom:n.padding}),a.Z(n,T),s.Z(["paddingLeft","paddingRight","paddingTop","paddingBottom"],(function(t){n[t]=Number(n[t])})),i.Z(n,"width")&&(n._prevWidth=n.width),i.Z(n,"height")&&(n._prevHeight=n.height)})),t.edges().forEach((function(e){var n=t.edge(e);i.Z(n,"label")||(n.label=""),a.Z(n,S)}))}(e);var n=A(t,"output"),h=A(n,"clusters"),u=A(n,"edgePaths"),f=p(A(n,"edgeLabels"),e),g=x(A(n,"nodes"),e,C);(0,o.bK)(e),function(t,e){function n(t){var n=e.node(t);return"translate("+n.x+","+n.y+")"}t.filter((function(){return!r.Ys(this).classed("update")})).attr("transform",n),c.WR(t,e).style("opacity",1).attr("transform",n)}(g,e),function(t,e){function n(t){var n=e.edge(t);return i.Z(n,"x")?"translate("+n.x+","+n.y+")":""}t.filter((function(){return!r.Ys(this).classed("update")})).attr("transform",n),c.WR(t,e).style("opacity",1).attr("transform",n)}(f,e),m(u,e,l),function(t,e){var n=t.filter((function(){return!r.Ys(this).classed("update")}));function i(t){var n=e.node(t);return"translate("+n.x+","+n.y+")"}n.attr("transform",i),c.WR(t,e).style("opacity",1).attr("transform",i),c.WR(n.selectAll("rect"),e).attr("width",(function(t){return e.node(t).width})).attr("height",(function(t){return e.node(t).height})).attr("x",(function(t){return-e.node(t).width/2})).attr("y",(function(t){return-e.node(t).height/2}))}(d(h,e),e),function(t){s.Z(t.nodes(),(function(e){var n=t.node(e);i.Z(n,"_prevWidth")?n.width=n._prevWidth:delete n.width,i.Z(n,"_prevHeight")?n.height=n._prevHeight:delete n.height,delete n._prevWidth,delete n._prevHeight}))}(e)};return t.createNodes=function(e){return arguments.length?(function(t){x=t}(e),t):x},t.createClusters=function(e){return arguments.length?(function(t){d=t}(e),t):d},t.createEdgeLabels=function(e){return arguments.length?(function(t){p=t}(e),t):p},t.createEdgePaths=function(e){return arguments.length?(function(t){m=t}(e),t):m},t.shapes=function(e){return arguments.length?(function(t){C=t}(e),t):C},t.arrows=function(e){return arguments.length?(function(t){l=t}(e),t):l},t}var T={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},S={arrowhead:"normal",curve:r.c_6};function A(t,e){var n=t.select("g."+e);return n.empty()&&(n=t.append("g").attr("class",e)),n}n(88472)},75781:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(83445),i=n(81300);const a=class{constructor(){this.type=i.w.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=i.w.ALL}is(t){return this.type===t}};const s=new class{constructor(t,e){this.color=e,this.changed=!1,this.data=t,this.type=new a}set(t,e){return this.color=e,this.changed=!1,this.data=t,this.type.type=i.w.ALL,this}_ensureHSL(){const t=this.data,{h:e,s:n,l:i}=t;void 0===e&&(t.h=r.Z.channel.rgb2hsl(t,"h")),void 0===n&&(t.s=r.Z.channel.rgb2hsl(t,"s")),void 0===i&&(t.l=r.Z.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r:e,g:n,b:i}=t;void 0===e&&(t.r=r.Z.channel.hsl2rgb(t,"r")),void 0===n&&(t.g=r.Z.channel.hsl2rgb(t,"g")),void 0===i&&(t.b=r.Z.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,e=t.r;return this.type.is(i.w.HSL)||void 0===e?(this._ensureHSL(),r.Z.channel.hsl2rgb(t,"r")):e}get g(){const t=this.data,e=t.g;return this.type.is(i.w.HSL)||void 0===e?(this._ensureHSL(),r.Z.channel.hsl2rgb(t,"g")):e}get b(){const t=this.data,e=t.b;return this.type.is(i.w.HSL)||void 0===e?(this._ensureHSL(),r.Z.channel.hsl2rgb(t,"b")):e}get h(){const t=this.data,e=t.h;return this.type.is(i.w.RGB)||void 0===e?(this._ensureRGB(),r.Z.channel.rgb2hsl(t,"h")):e}get s(){const t=this.data,e=t.s;return this.type.is(i.w.RGB)||void 0===e?(this._ensureRGB(),r.Z.channel.rgb2hsl(t,"s")):e}get l(){const t=this.data,e=t.l;return this.type.is(i.w.RGB)||void 0===e?(this._ensureRGB(),r.Z.channel.rgb2hsl(t,"l")):e}get a(){return this.data.a}set r(t){this.type.set(i.w.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(i.w.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(i.w.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(i.w.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(i.w.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(i.w.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}({r:0,g:0,b:0,a:0},"transparent")},31739:(t,e,n)=>{"use strict";n.d(e,{Z:()=>g});var r=n(75781),i=n(81300);const a={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(35!==t.charCodeAt(0))return;const e=t.match(a.re);if(!e)return;const n=e[1],i=parseInt(n,16),s=n.length,o=s%4==0,c=s>4,l=c?1:17,h=c?8:4,u=o?0:-1,d=c?255:15;return r.Z.set({r:(i>>h*(u+3)&d)*l,g:(i>>h*(u+2)&d)*l,b:(i>>h*(u+1)&d)*l,a:o?(i&d)*l/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:a}=t;return a<1?`#${i.Q[Math.round(e)]}${i.Q[Math.round(n)]}${i.Q[Math.round(r)]}${i.Q[Math.round(255*a)]}`:`#${i.Q[Math.round(e)]}${i.Q[Math.round(n)]}${i.Q[Math.round(r)]}`}},s=a;var o=n(83445);const c={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(c.hueRe);if(e){const[,t,n]=e;switch(n){case"grad":return o.Z.channel.clamp.h(.9*parseFloat(t));case"rad":return o.Z.channel.clamp.h(180*parseFloat(t)/Math.PI);case"turn":return o.Z.channel.clamp.h(360*parseFloat(t))}}return o.Z.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(104!==e&&72!==e)return;const n=t.match(c.re);if(!n)return;const[,i,a,s,l,h]=n;return r.Z.set({h:c._hue2deg(i),s:o.Z.channel.clamp.s(parseFloat(a)),l:o.Z.channel.clamp.l(parseFloat(s)),a:l?o.Z.channel.clamp.a(h?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}%, ${o.Z.lang.round(r)}%, ${i})`:`hsl(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}%, ${o.Z.lang.round(r)}%)`}},l=c,h={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=h.colors[t];if(e)return s.parse(e)},stringify:t=>{const e=s.stringify(t);for(const n in h.colors)if(h.colors[n]===e)return n}},u=h,d={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(114!==e&&82!==e)return;const n=t.match(d.re);if(!n)return;const[,i,a,s,c,l,h,u,p]=n;return r.Z.set({r:o.Z.channel.clamp.r(a?2.55*parseFloat(i):parseFloat(i)),g:o.Z.channel.clamp.g(c?2.55*parseFloat(s):parseFloat(s)),b:o.Z.channel.clamp.b(h?2.55*parseFloat(l):parseFloat(l)),a:u?o.Z.channel.clamp.a(p?parseFloat(u)/100:parseFloat(u)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}, ${o.Z.lang.round(r)}, ${o.Z.lang.round(i)})`:`rgb(${o.Z.lang.round(e)}, ${o.Z.lang.round(n)}, ${o.Z.lang.round(r)})`}},p=d,f={format:{keyword:h,hex:s,rgb:d,rgba:d,hsl:c,hsla:c},parse:t=>{if("string"!=typeof t)return t;const e=s.parse(t)||p.parse(t)||l.parse(t)||u.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(i.w.HSL)||void 0===t.data.r?l.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?p.stringify(t):s.stringify(t)},g=f},81300:(t,e,n)=>{"use strict";n.d(e,{Q:()=>i,w:()=>a});var r=n(83445);const i={};for(let s=0;s<=255;s++)i[s]=r.Z.unit.dec2hex(s);const a={ALL:0,RGB:1,HSL:2}},55590:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(83445),i=n(31739);const a=(t,e,n)=>{const a=i.Z.parse(t),s=a[e],o=r.Z.channel.clamp[e](s+n);return s!==o&&(a[e]=o),i.Z.stringify(a)}},54628:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(55590);const i=(t,e)=>(0,r.Z)(t,"l",-e)},36304:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(55590);const i=(t,e)=>(0,r.Z)(t,"l",e)},83445:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});const r={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},i)=>{if(!e)return 2.55*n;t/=360,e/=100;const a=(n/=100)<.5?n*(1+e):n+e-n*e,s=2*n-a;switch(i){case"r":return 255*r.hue2rgb(s,a,t+1/3);case"g":return 255*r.hue2rgb(s,a,t);case"b":return 255*r.hue2rgb(s,a,t-1/3)}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),a=Math.min(t,e,n),s=(i+a)/2;if("l"===r)return 100*s;if(i===a)return 0;const o=i-a;if("s"===r)return 100*(s>.5?o/(2-i-a):o/(i+a));switch(i){case t:return 60*((e-n)/o+(e<n?6:0));case e:return 60*((n-t)/o+2);case n:return 60*((t-e)/o+4);default:return-1}}},i={channel:r,lang:{clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(1e10*t)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}}},79115:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});const r=function(){this.__data__=[],this.size=0};var i=n(28916);const a=function(t,e){for(var n=t.length;n--;)if((0,i.Z)(t[n][0],e))return n;return-1};var s=Array.prototype.splice;const o=function(t){var e=this.__data__,n=a(e,t);return!(n<0)&&(n==e.length-1?e.pop():s.call(e,n,1),--this.size,!0)};const c=function(t){var e=this.__data__,n=a(e,t);return n<0?void 0:e[n][1]};const l=function(t){return a(this.__data__,t)>-1};const h=function(t,e){var n=this.__data__,r=a(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=o,u.prototype.get=c,u.prototype.has=l,u.prototype.set=h;const d=u},46462:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(45565),i=n(97659);const a=(0,r.Z)(i.Z,"Map")},61056:(t,e,n)=>{"use strict";n.d(e,{Z:()=>w});const r=(0,n(45565).Z)(Object,"create");const i=function(){this.__data__=r?r(null):{},this.size=0};const a=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e};var s=Object.prototype.hasOwnProperty;const o=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return s.call(e,t)?e[t]:void 0};var c=Object.prototype.hasOwnProperty;const l=function(t){var e=this.__data__;return r?void 0!==e[t]:c.call(e,t)};const h=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this};function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=i,u.prototype.delete=a,u.prototype.get=o,u.prototype.has=l,u.prototype.set=h;const d=u;var p=n(79115),f=n(46462);const g=function(){this.size=0,this.__data__={hash:new d,map:new(f.Z||p.Z),string:new d}};const y=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};const m=function(t,e){var n=t.__data__;return y(e)?n["string"==typeof e?"string":"hash"]:n.map};const b=function(t){var e=m(this,t).delete(t);return this.size-=e?1:0,e};const _=function(t){return m(this,t).get(t)};const x=function(t){return m(this,t).has(t)};const v=function(t,e){var n=m(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function k(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}k.prototype.clear=g,k.prototype.delete=b,k.prototype.get=_,k.prototype.has=x,k.prototype.set=v;const w=k},79228:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(45565),i=n(97659);const a=(0,r.Z)(i.Z,"Set")},58017:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(61056);const i=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};const a=function(t){return this.__data__.has(t)};function s(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r.Z;++e<n;)this.add(t[e])}s.prototype.add=s.prototype.push=i,s.prototype.has=a;const o=s},72178:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(79115);const i=function(){this.__data__=new r.Z,this.size=0};const a=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};const s=function(t){return this.__data__.get(t)};const o=function(t){return this.__data__.has(t)};var c=n(46462),l=n(61056);const h=function(t,e){var n=this.__data__;if(n instanceof r.Z){var i=n.__data__;if(!c.Z||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new l.Z(i)}return n.set(t,e),this.size=n.size,this};function u(t){var e=this.__data__=new r.Z(t);this.size=e.size}u.prototype.clear=i,u.prototype.delete=a,u.prototype.get=s,u.prototype.has=o,u.prototype.set=h;const d=u},9e3:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=n(97659).Z.Symbol},56421:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=n(97659).Z.Uint8Array},62020:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}},69878:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,a=[];++n<r;){var s=t[n];e(s,n,t)&&(a[i++]=s)}return a}},9852:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});const r=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r};var i=n(5998),a=n(47838),s=n(45633),o=n(62916),c=n(17065),l=Object.prototype.hasOwnProperty;const h=function(t,e){var n=(0,a.Z)(t),h=!n&&(0,i.Z)(t),u=!n&&!h&&(0,s.Z)(t),d=!n&&!h&&!u&&(0,c.Z)(t),p=n||h||u||d,f=p?r(t.length,String):[],g=f.length;for(var y in t)!e&&!l.call(t,y)||p&&("length"==y||u&&("offset"==y||"parent"==y)||d&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||(0,o.Z)(y,g))||f.push(y);return f}},90497:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}},37891:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}},84424:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(10541),i=n(28916),a=Object.prototype.hasOwnProperty;const s=function(t,e,n){var s=t[e];a.call(t,e)&&(0,i.Z)(s,n)&&(void 0!==n||e in t)||(0,r.Z)(t,e,n)}},10541:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(42452);const i=function(t,e,n){"__proto__"==e&&r.Z?(0,r.Z)(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},31066:(t,e,n)=>{"use strict";n.d(e,{Z:()=>J});var r=n(72178),i=n(62020),a=n(84424),s=n(46518),o=n(94778);const c=function(t,e){return t&&(0,s.Z)(e,(0,o.Z)(e),t)};var l=n(86483);const h=function(t,e){return t&&(0,s.Z)(e,(0,l.Z)(e),t)};var u=n(23999),d=n(98058),p=n(57538);const f=function(t,e){return(0,s.Z)(t,(0,p.Z)(t),e)};var g=n(37891),y=n(99773),m=n(33464);const b=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)(0,g.Z)(e,(0,p.Z)(t)),t=(0,y.Z)(t);return e}:m.Z;const _=function(t,e){return(0,s.Z)(t,b(t),e)};var x=n(22879),v=n(65976);const k=function(t){return(0,v.Z)(t,l.Z,b)};var w=n(68023),C=Object.prototype.hasOwnProperty;const E=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&C.call(t,"index")&&(n.index=t.index,n.input=t.input),n};var T=n(37659);const S=function(t,e){var n=e?(0,T.Z)(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)};var A=/\w*$/;const L=function(t){var e=new t.constructor(t.source,A.exec(t));return e.lastIndex=t.lastIndex,e};var B=n(9e3),N=B.Z?B.Z.prototype:void 0,D=N?N.valueOf:void 0;const O=function(t){return D?Object(D.call(t)):{}};var M=n(24763);const I=function(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return(0,T.Z)(t);case"[object Boolean]":case"[object Date]":return new r(+t);case"[object DataView]":return S(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return(0,M.Z)(t,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":return L(t);case"[object Symbol]":return O(t)}};var F=n(33731),$=n(47838),R=n(45633),Z=n(18742);const P=function(t){return(0,Z.Z)(t)&&"[object Map]"==(0,w.Z)(t)};var j=n(42052),Y=n(17433),z=Y.Z&&Y.Z.isMap;const U=z?(0,j.Z)(z):P;var W=n(80369);const H=function(t){return(0,Z.Z)(t)&&"[object Set]"==(0,w.Z)(t)};var q=Y.Z&&Y.Z.isSet;const V=q?(0,j.Z)(q):H;var G="[object Arguments]",X="[object Function]",Q="[object Object]",K={};K[G]=K["[object Array]"]=K["[object ArrayBuffer]"]=K["[object DataView]"]=K["[object Boolean]"]=K["[object Date]"]=K["[object Float32Array]"]=K["[object Float64Array]"]=K["[object Int8Array]"]=K["[object Int16Array]"]=K["[object Int32Array]"]=K["[object Map]"]=K["[object Number]"]=K[Q]=K["[object RegExp]"]=K["[object Set]"]=K["[object String]"]=K["[object Symbol]"]=K["[object Uint8Array]"]=K["[object Uint8ClampedArray]"]=K["[object Uint16Array]"]=K["[object Uint32Array]"]=!0,K["[object Error]"]=K[X]=K["[object WeakMap]"]=!1;const J=function t(e,n,s,p,g,y){var m,b=1&n,v=2&n,C=4&n;if(s&&(m=g?s(e,p,g,y):s(e)),void 0!==m)return m;if(!(0,W.Z)(e))return e;var T=(0,$.Z)(e);if(T){if(m=E(e),!b)return(0,d.Z)(e,m)}else{var S=(0,w.Z)(e),A=S==X||"[object GeneratorFunction]"==S;if((0,R.Z)(e))return(0,u.Z)(e,b);if(S==Q||S==G||A&&!g){if(m=v||A?{}:(0,F.Z)(e),!b)return v?_(e,h(m,e)):f(e,c(m,e))}else{if(!K[S])return g?e:{};m=I(e,S,b)}}y||(y=new r.Z);var L=y.get(e);if(L)return L;y.set(e,m),V(e)?e.forEach((function(r){m.add(t(r,n,s,r,e,y))})):U(e)&&e.forEach((function(r,i){m.set(i,t(r,n,s,i,e,y))}));var B=C?v?k:x.Z:v?l.Z:o.Z,N=T?void 0:B(e);return(0,i.Z)(N||e,(function(r,i){N&&(r=e[i=r]),(0,a.Z)(m,i,t(r,n,s,i,e,y))})),m}},88015:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(51877),i=n(79458);const a=function(t,e){return function(n,r){if(null==n)return n;if(!(0,i.Z)(n))return t(n,r);for(var a=n.length,s=e?a:-1,o=Object(n);(e?s--:++s<a)&&!1!==r(o[s],s,o););return n}}(r.Z)},78953:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e,n,r){for(var i=t.length,a=n+(r?1:-1);r?a--:++a<i;)if(e(t[a],a,t))return a;return-1}},45556:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(37891),i=n(9e3),a=n(5998),s=n(47838),o=i.Z?i.Z.isConcatSpreadable:void 0;const c=function(t){return(0,s.Z)(t)||(0,a.Z)(t)||!!(o&&t&&t[o])};const l=function t(e,n,i,a,s){var o=-1,l=e.length;for(i||(i=c),s||(s=[]);++o<l;){var h=e[o];n>0&&i(h)?n>1?t(h,n-1,i,a,s):(0,r.Z)(s,h):a||(s[s.length]=h)}return s}},30434:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(e,n,r){for(var i=-1,a=Object(e),s=r(e),o=s.length;o--;){var c=s[t?o:++i];if(!1===n(a[c],c,a))break}return e}}()},51877:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(30434),i=n(94778);const a=function(t,e){return t&&(0,r.Z)(t,e,i.Z)}},42825:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(43169),i=n(99316);const a=function(t,e){for(var n=0,a=(e=(0,r.Z)(e,t)).length;null!=t&&n<a;)t=t[(0,i.Z)(e[n++])];return n&&n==a?t:void 0}},65976:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(37891),i=n(47838);const a=function(t,e,n){var a=e(t);return(0,i.Z)(t)?a:(0,r.Z)(a,n(t))}},97640:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(9e3),i=Object.prototype,a=i.hasOwnProperty,s=i.toString,o=r.Z?r.Z.toStringTag:void 0;const c=function(t){var e=a.call(t,o),n=t[o];try{t[o]=void 0;var r=!0}catch(c){}var i=s.call(t);return r&&(e?t[o]=n:delete t[o]),i};var l=Object.prototype.toString;const h=function(t){return l.call(t)};var u=r.Z?r.Z.toStringTag:void 0;const d=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?c(t):h(t)}},90510:(t,e,n)=>{"use strict";n.d(e,{Z:()=>q});var r=n(72178),i=n(58017);const a=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var s=n(58923);const o=function(t,e,n,r,o,c){var l=1&n,h=t.length,u=e.length;if(h!=u&&!(l&&u>h))return!1;var d=c.get(t),p=c.get(e);if(d&&p)return d==e&&p==t;var f=-1,g=!0,y=2&n?new i.Z:void 0;for(c.set(t,e),c.set(e,t);++f<h;){var m=t[f],b=e[f];if(r)var _=l?r(b,m,f,e,t,c):r(m,b,f,t,e,c);if(void 0!==_){if(_)continue;g=!1;break}if(y){if(!a(e,(function(t,e){if(!(0,s.Z)(y,e)&&(m===t||o(m,t,n,r,c)))return y.push(e)}))){g=!1;break}}else if(m!==b&&!o(m,b,n,r,c)){g=!1;break}}return c.delete(t),c.delete(e),g};var c=n(9e3),l=n(56421),h=n(28916);const u=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n};var d=n(80877),p=c.Z?c.Z.prototype:void 0,f=p?p.valueOf:void 0;const g=function(t,e,n,r,i,a,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!a(new l.Z(t),new l.Z(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return(0,h.Z)(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var c=u;case"[object Set]":var p=1&r;if(c||(c=d.Z),t.size!=e.size&&!p)return!1;var g=s.get(t);if(g)return g==e;r|=2,s.set(t,e);var y=o(c(t),c(e),r,i,a,s);return s.delete(t),y;case"[object Symbol]":if(f)return f.call(t)==f.call(e)}return!1};var y=n(22879),m=Object.prototype.hasOwnProperty;const b=function(t,e,n,r,i,a){var s=1&n,o=(0,y.Z)(t),c=o.length;if(c!=(0,y.Z)(e).length&&!s)return!1;for(var l=c;l--;){var h=o[l];if(!(s?h in e:m.call(e,h)))return!1}var u=a.get(t),d=a.get(e);if(u&&d)return u==e&&d==t;var p=!0;a.set(t,e),a.set(e,t);for(var f=s;++l<c;){var g=t[h=o[l]],b=e[h];if(r)var _=s?r(b,g,h,e,t,a):r(g,b,h,t,e,a);if(!(void 0===_?g===b||i(g,b,n,r,a):_)){p=!1;break}f||(f="constructor"==h)}if(p&&!f){var x=t.constructor,v=e.constructor;x==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof v&&v instanceof v||(p=!1)}return a.delete(t),a.delete(e),p};var _=n(68023),x=n(47838),v=n(45633),k=n(17065),w="[object Arguments]",C="[object Array]",E="[object Object]",T=Object.prototype.hasOwnProperty;const S=function(t,e,n,i,a,s){var c=(0,x.Z)(t),l=(0,x.Z)(e),h=c?C:(0,_.Z)(t),u=l?C:(0,_.Z)(e),d=(h=h==w?E:h)==E,p=(u=u==w?E:u)==E,f=h==u;if(f&&(0,v.Z)(t)){if(!(0,v.Z)(e))return!1;c=!0,d=!1}if(f&&!d)return s||(s=new r.Z),c||(0,k.Z)(t)?o(t,e,n,i,a,s):g(t,e,h,n,i,a,s);if(!(1&n)){var y=d&&T.call(t,"__wrapped__"),m=p&&T.call(e,"__wrapped__");if(y||m){var S=y?t.value():t,A=m?e.value():e;return s||(s=new r.Z),a(S,A,n,i,s)}}return!!f&&(s||(s=new r.Z),b(t,e,n,i,a,s))};var A=n(18742);const L=function t(e,n,r,i,a){return e===n||(null==e||null==n||!(0,A.Z)(e)&&!(0,A.Z)(n)?e!=e&&n!=n:S(e,n,r,i,t,a))};const B=function(t,e,n,i){var a=n.length,s=a,o=!i;if(null==t)return!s;for(t=Object(t);a--;){var c=n[a];if(o&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var l=(c=n[a])[0],h=t[l],u=c[1];if(o&&c[2]){if(void 0===h&&!(l in t))return!1}else{var d=new r.Z;if(i)var p=i(h,u,l,t,e,d);if(!(void 0===p?L(u,h,3,i,d):p))return!1}}return!0};var N=n(80369);const D=function(t){return t==t&&!(0,N.Z)(t)};var O=n(94778);const M=function(t){for(var e=(0,O.Z)(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,D(i)]}return e};const I=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}};const F=function(t){var e=M(t);return 1==e.length&&e[0][2]?I(e[0][0],e[0][1]):function(n){return n===t||B(n,t,e)}};var $=n(42825);const R=function(t,e,n){var r=null==t?void 0:(0,$.Z)(t,e);return void 0===r?n:r};var Z=n(7171),P=n(67990),j=n(99316);const Y=function(t,e){return(0,P.Z)(t)&&D(e)?I((0,j.Z)(t),e):function(n){var r=R(n,t);return void 0===r&&r===e?(0,Z.Z)(n,t):L(e,r,3)}};var z=n(84111),U=n(32965);const W=function(t){return function(e){return(0,$.Z)(e,t)}};const H=function(t){return(0,P.Z)(t)?(0,U.Z)((0,j.Z)(t)):W(t)};const q=function(t){return"function"==typeof t?t:null==t?z.Z:"object"==typeof t?(0,x.Z)(t)?Y(t[0],t[1]):F(t):H(t)}},58410:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(54357);const i=(0,n(84068).Z)(Object.keys,Object);var a=Object.prototype.hasOwnProperty;const s=function(t){if(!(0,r.Z)(t))return i(t);var e=[];for(var n in Object(t))a.call(t,n)&&"constructor"!=n&&e.push(n);return e}},46133:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(88015),i=n(79458);const a=function(t,e){var n=-1,a=(0,i.Z)(t)?Array(t.length):[];return(0,r.Z)(t,(function(t,r,i){a[++n]=e(t,r,i)})),a}},32965:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(e){return null==e?void 0:e[t]}}},92042:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(84111),i=n(6348),a=n(98950);const s=function(t,e){return(0,a.Z)((0,i.Z)(t,e,r.Z),t+"")}},42052:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(e){return t(e)}}},58923:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){return t.has(e)}},22412:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(84111);const i=function(t){return"function"==typeof t?t:r.Z}},43169:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(47838),i=n(67990),a=n(77397);var s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g;const c=function(t){var e=(0,a.Z)(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(s,(function(t,n,r,i){e.push(r?i.replace(o,"$1"):n||t)})),e}));var l=n(59457);const h=function(t,e){return(0,r.Z)(t)?t:(0,i.Z)(t,e)?[t]:c((0,l.Z)(t))}},37659:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(56421);const i=function(t){var e=new t.constructor(t.byteLength);return new r.Z(e).set(new r.Z(t)),e}},23999:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(97659),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof module&&module&&!module.nodeType&&module,s=a&&a.exports===i?r.Z.Buffer:void 0,o=s?s.allocUnsafe:void 0;const c=function(t,e){if(e)return t.slice();var n=t.length,r=o?o(n):new t.constructor(n);return t.copy(r),r}},24763:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(37659);const i=function(t,e){var n=e?(0,r.Z)(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},98058:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},46518:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(84424),i=n(10541);const a=function(t,e,n,a){var s=!n;n||(n={});for(var o=-1,c=e.length;++o<c;){var l=e[o],h=a?a(n[l],t[l],l,n,t):void 0;void 0===h&&(h=t[l]),s?(0,i.Z)(n,l,h):(0,r.Z)(n,l,h)}return n}},42452:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(45565);const i=function(){try{var t=(0,r.Z)(Object,"defineProperty");return t({},"",{}),t}catch(e){}}()},58055:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r="object"==typeof global&&global&&global.Object===Object&&global},22879:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(65976),i=n(57538),a=n(94778);const s=function(t){return(0,r.Z)(t,a.Z,i.Z)}},45565:(t,e,n)=>{"use strict";n.d(e,{Z:()=>b});var r=n(78246);const i=n(97659).Z["__core-js_shared__"];var a,s=(a=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";const o=function(t){return!!s&&s in t};var c=n(80369),l=n(94549),h=/^\[object .+?Constructor\]$/,u=Function.prototype,d=Object.prototype,p=u.toString,f=d.hasOwnProperty,g=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const y=function(t){return!(!(0,c.Z)(t)||o(t))&&((0,r.Z)(t)?g:h).test((0,l.Z)(t))};const m=function(t,e){return null==t?void 0:t[e]};const b=function(t,e){var n=m(t,e);return y(n)?n:void 0}},99773:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=(0,n(84068).Z)(Object.getPrototypeOf,Object)},57538:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(69878),i=n(33464),a=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols;const o=s?function(t){return null==t?[]:(t=Object(t),(0,r.Z)(s(t),(function(e){return a.call(t,e)})))}:i.Z},68023:(t,e,n)=>{"use strict";n.d(e,{Z:()=>w});var r=n(45565),i=n(97659);const a=(0,r.Z)(i.Z,"DataView");var s=n(46462);const o=(0,r.Z)(i.Z,"Promise");var c=n(79228);const l=(0,r.Z)(i.Z,"WeakMap");var h=n(97640),u=n(94549),d="[object Map]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",y="[object DataView]",m=(0,u.Z)(a),b=(0,u.Z)(s.Z),_=(0,u.Z)(o),x=(0,u.Z)(c.Z),v=(0,u.Z)(l),k=h.Z;(a&&k(new a(new ArrayBuffer(1)))!=y||s.Z&&k(new s.Z)!=d||o&&k(o.resolve())!=p||c.Z&&k(new c.Z)!=f||l&&k(new l)!=g)&&(k=function(t){var e=(0,h.Z)(t),n="[object Object]"==e?t.constructor:void 0,r=n?(0,u.Z)(n):"";if(r)switch(r){case m:return y;case b:return d;case _:return p;case x:return f;case v:return g}return e});const w=k},95942:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(43169),i=n(5998),a=n(47838),s=n(62916),o=n(7614),c=n(99316);const l=function(t,e,n){for(var l=-1,h=(e=(0,r.Z)(e,t)).length,u=!1;++l<h;){var d=(0,c.Z)(e[l]);if(!(u=null!=t&&n(t,d)))break;t=t[d]}return u||++l!=h?u:!!(h=null==t?0:t.length)&&(0,o.Z)(h)&&(0,s.Z)(d,h)&&((0,a.Z)(t)||(0,i.Z)(t))}},33731:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(80369),i=Object.create;const a=function(){function t(){}return function(e){if(!(0,r.Z)(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var s=n(99773),o=n(54357);const c=function(t){return"function"!=typeof t.constructor||(0,o.Z)(t)?{}:a((0,s.Z)(t))}},62916:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=/^(?:0|[1-9]\d*)$/;const i=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&r.test(t))&&t>-1&&t%1==0&&t<e}},84264:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(28916),i=n(79458),a=n(62916),s=n(80369);const o=function(t,e,n){if(!(0,s.Z)(n))return!1;var o=typeof e;return!!("number"==o?(0,i.Z)(n)&&(0,a.Z)(e,n.length):"string"==o&&e in n)&&(0,r.Z)(n[e],t)}},67990:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(47838),i=n(54878),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;const o=function(t,e){if((0,r.Z)(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!(0,i.Z)(t))||(s.test(t)||!a.test(t)||null!=e&&t in Object(e))}},54357:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=Object.prototype;const i=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},17433:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(58055),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof module&&module&&!module.nodeType&&module,s=a&&a.exports===i&&r.Z.process;const o=function(){try{var t=a&&a.require&&a.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(e){}}()},84068:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){return function(n){return t(e(n))}}},6348:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});const r=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)};var i=Math.max;const a=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var a=arguments,s=-1,o=i(a.length-e,0),c=Array(o);++s<o;)c[s]=a[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=a[s];return l[e]=n(c),r(t,this,l)}}},97659:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(58055),i="object"==typeof self&&self&&self.Object===Object&&self;const a=r.Z||i||Function("return this")()},80877:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}},98950:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(2977),i=n(42452),a=n(84111);const s=i.Z?function(t,e){return(0,i.Z)(t,"toString",{configurable:!0,enumerable:!1,value:(0,r.Z)(e),writable:!0})}:a.Z;var o=Date.now;const c=function(t){var e=0,n=0;return function(){var r=o(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(s)},99316:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(54878);const i=function(t){if("string"==typeof t||(0,r.Z)(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}},94549:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=Function.prototype.toString;const i=function(t){if(null!=t){try{return r.call(t)}catch(e){}try{return t+""}catch(e){}}return""}},2977:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return function(){return t}}},65029:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(92042),i=n(28916),a=n(84264),s=n(86483),o=Object.prototype,c=o.hasOwnProperty;const l=(0,r.Z)((function(t,e){t=Object(t);var n=-1,r=e.length,l=r>2?e[2]:void 0;for(l&&(0,a.Z)(e[0],e[1],l)&&(r=1);++n<r;)for(var h=e[n],u=(0,s.Z)(h),d=-1,p=u.length;++d<p;){var f=u[d],g=t[f];(void 0===g||(0,i.Z)(g,o[f])&&!c.call(t,f))&&(t[f]=h[f])}return t}))},28916:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t,e){return t===e||t!=t&&e!=e}},88205:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(69878),i=n(88015);const a=function(t,e){var n=[];return(0,i.Z)(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n};var s=n(90510),o=n(47838);const c=function(t,e){return((0,o.Z)(t)?r.Z:a)(t,(0,s.Z)(e,3))}},94605:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(45556);const i=function(t){return(null==t?0:t.length)?(0,r.Z)(t,1):[]}},46188:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(62020),i=n(88015),a=n(22412),s=n(47838);const o=function(t,e){return((0,s.Z)(t)?r.Z:i.Z)(t,(0,a.Z)(e))}},88103:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=Object.prototype.hasOwnProperty;const i=function(t,e){return null!=t&&r.call(t,e)};var a=n(95942);const s=function(t,e){return null!=t&&(0,a.Z)(t,e,i)}},7171:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});const r=function(t,e){return null!=t&&e in Object(t)};var i=n(95942);const a=function(t,e){return null!=t&&(0,i.Z)(t,e,r)}},84111:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return t}},5998:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=n(97640),i=n(18742);const a=function(t){return(0,i.Z)(t)&&"[object Arguments]"==(0,r.Z)(t)};var s=Object.prototype,o=s.hasOwnProperty,c=s.propertyIsEnumerable;const l=a(function(){return arguments}())?a:function(t){return(0,i.Z)(t)&&o.call(t,"callee")&&!c.call(t,"callee")}},47838:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=Array.isArray},79458:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(78246),i=n(7614);const a=function(t){return null!=t&&(0,i.Z)(t.length)&&!(0,r.Z)(t)}},93530:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(79458),i=n(18742);const a=function(t){return(0,i.Z)(t)&&(0,r.Z)(t)}},45633:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=n(97659);const i=function(){return!1};var a="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=a&&"object"==typeof module&&module&&!module.nodeType&&module,o=s&&s.exports===a?r.Z.Buffer:void 0;const c=(o?o.isBuffer:void 0)||i},29955:(t,e,n)=>{"use strict";n.d(e,{Z:()=>d});var r=n(58410),i=n(68023),a=n(5998),s=n(47838),o=n(79458),c=n(45633),l=n(54357),h=n(17065),u=Object.prototype.hasOwnProperty;const d=function(t){if(null==t)return!0;if((0,o.Z)(t)&&((0,s.Z)(t)||"string"==typeof t||"function"==typeof t.splice||(0,c.Z)(t)||(0,h.Z)(t)||(0,a.Z)(t)))return!t.length;var e=(0,i.Z)(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if((0,l.Z)(t))return!(0,r.Z)(t).length;for(var n in t)if(u.call(t,n))return!1;return!0}},78246:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(97640),i=n(80369);const a=function(t){if(!(0,i.Z)(t))return!1;var e=(0,r.Z)(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},7614:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},80369:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},18742:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return null!=t&&"object"==typeof t}},22701:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(97640),i=n(99773),a=n(18742),s=Function.prototype,o=Object.prototype,c=s.toString,l=o.hasOwnProperty,h=c.call(Object);const u=function(t){if(!(0,a.Z)(t)||"[object Object]"!=(0,r.Z)(t))return!1;var e=(0,i.Z)(t);if(null===e)return!0;var n=l.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==h}},54878:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(97640),i=n(18742);const a=function(t){return"symbol"==typeof t||(0,i.Z)(t)&&"[object Symbol]"==(0,r.Z)(t)}},17065:(t,e,n)=>{"use strict";n.d(e,{Z:()=>u});var r=n(97640),i=n(7614),a=n(18742),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;const o=function(t){return(0,a.Z)(t)&&(0,i.Z)(t.length)&&!!s[(0,r.Z)(t)]};var c=n(42052),l=n(17433),h=l.Z&&l.Z.isTypedArray;const u=h?(0,c.Z)(h):o},6524:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(t){return void 0===t}},94778:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(9852),i=n(58410),a=n(79458);const s=function(t){return(0,a.Z)(t)?(0,r.Z)(t):(0,i.Z)(t)}},86483:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(9852),i=n(80369),a=n(54357);const s=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e};var o=Object.prototype.hasOwnProperty;const c=function(t){if(!(0,i.Z)(t))return s(t);var e=(0,a.Z)(t),n=[];for(var r in t)("constructor"!=r||!e&&o.call(t,r))&&n.push(r);return n};var l=n(79458);const h=function(t){return(0,l.Z)(t)?(0,r.Z)(t,!0):c(t)}},27206:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(90497),i=n(90510),a=n(46133),s=n(47838);const o=function(t,e){return((0,s.Z)(t)?r.Z:a.Z)(t,(0,i.Z)(e,3))}},77397:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(61056);function i(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var s=t.apply(this,r);return n.cache=a.set(i,s)||a,s};return n.cache=new(i.Cache||r.Z),n}i.Cache=r.Z;const a=i},25541:(t,e,n)=>{"use strict";n.d(e,{Z:()=>y});var r=n(42825),i=n(84424),a=n(43169),s=n(62916),o=n(80369),c=n(99316);const l=function(t,e,n,r){if(!(0,o.Z)(t))return t;for(var l=-1,h=(e=(0,a.Z)(e,t)).length,u=h-1,d=t;null!=d&&++l<h;){var p=(0,c.Z)(e[l]),f=n;if("__proto__"===p||"constructor"===p||"prototype"===p)return t;if(l!=u){var g=d[p];void 0===(f=r?r(g,p,d):void 0)&&(f=(0,o.Z)(g)?g:(0,s.Z)(e[l+1])?[]:{})}(0,i.Z)(d,p,f),d=d[p]}return t};const h=function(t,e,n){for(var i=-1,s=e.length,o={};++i<s;){var c=e[i],h=(0,r.Z)(t,c);n(h,c)&&l(o,(0,a.Z)(c,t),h)}return o};var u=n(7171);const d=function(t,e){return h(t,e,(function(e,n){return(0,u.Z)(t,n)}))};var p=n(94605),f=n(6348),g=n(98950);const y=function(t){return(0,g.Z)((0,f.Z)(t,void 0,p.Z),t+"")}((function(t,e){return null==t?{}:d(t,e)}))},1110:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=Math.ceil,i=Math.max;const a=function(t,e,n,a){for(var s=-1,o=i(r((e-t)/(n||1)),0),c=Array(o);o--;)c[a?o:++s]=t,t+=n;return c};var s=n(84264),o=n(26460);const c=function(t){return function(e,n,r){return r&&"number"!=typeof r&&(0,s.Z)(e,n,r)&&(n=r=void 0),e=(0,o.Z)(e),void 0===n?(n=e,e=0):n=(0,o.Z)(n),r=void 0===r?e<n?1:-1:(0,o.Z)(r),a(e,n,r,t)}}()},54632:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});const r=function(t,e,n,r){var i=-1,a=null==t?0:t.length;for(r&&a&&(n=t[++i]);++i<a;)n=e(n,t[i],i,t);return n};var i=n(88015),a=n(90510);const s=function(t,e,n,r,i){return i(t,(function(t,i,a){n=r?(r=!1,t):e(n,t,i,a)})),n};var o=n(47838);const c=function(t,e,n){var c=(0,o.Z)(t)?r:s,l=arguments.length<3;return c(t,(0,a.Z)(e,4),n,l,i.Z)}},33464:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r=function(){return[]}},26460:(t,e,n)=>{"use strict";n.d(e,{Z:()=>g});var r=/\s/;const i=function(t){for(var e=t.length;e--&&r.test(t.charAt(e)););return e};var a=/^\s+/;const s=function(t){return t?t.slice(0,i(t)+1).replace(a,""):t};var o=n(80369),c=n(54878),l=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,u=/^0o[0-7]+$/i,d=parseInt;const p=function(t){if("number"==typeof t)return t;if((0,c.Z)(t))return NaN;if((0,o.Z)(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=(0,o.Z)(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=s(t);var n=h.test(t);return n||u.test(t)?d(t.slice(2),n?2:8):l.test(t)?NaN:+t};var f=1/0;const g=function(t){return t?(t=p(t))===f||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},59457:(t,e,n)=>{"use strict";n.d(e,{Z:()=>h});var r=n(9e3),i=n(90497),a=n(47838),s=n(54878),o=r.Z?r.Z.prototype:void 0,c=o?o.toString:void 0;const l=function t(e){if("string"==typeof e)return e;if((0,a.Z)(e))return(0,i.Z)(e,t)+"";if((0,s.Z)(e))return c?c.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};const h=function(t){return null==t?"":l(t)}},63345:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(59457),i=0;const a=function(t){var e=++i;return(0,r.Z)(t)+e}},95179:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var r=n(90497);const i=function(t,e){return(0,r.Z)(e,(function(e){return t[e]}))};var a=n(94778);const s=function(t){return null==t?[]:i(t,(0,a.Z)(t))}}}]); \ No newline at end of file diff --git a/assets/js/17896441.229a9328.js.LICENSE.txt b/assets/js/17896441.229a9328.js.LICENSE.txt new file mode 100644 index 00000000000..f253ee25a6c --- /dev/null +++ b/assets/js/17896441.229a9328.js.LICENSE.txt @@ -0,0 +1,9 @@ +/*! + * Wait for document loaded before starting the execution + */ + +/*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE */ + +/*! Check if previously processed */ + +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ diff --git a/assets/js/1a1df4a0.507e07d4.js b/assets/js/1a1df4a0.507e07d4.js new file mode 100644 index 00000000000..8122c0a9ff5 --- /dev/null +++ b/assets/js/1a1df4a0.507e07d4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3357],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>v});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),u=s(n),f=i,v=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return n?r.createElement(v,c(c({ref:t},l),{},{components:n})):r.createElement(v,c({ref:t},l))}));function v(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,c=new Array(o);c[0]=f;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[u]="string"==typeof e?e:i,c[1]=a;for(var s=2;s<o;s++)c[s]=n[s];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},32759:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>d,frontMatter:()=>o,metadata:()=>a,toc:()=>s});var r=n(25773),i=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},c="DeviceScriptCondition",a={unversionedId:"api/clients/devicescriptcondition",id:"api/clients/devicescriptcondition",title:"DeviceScriptCondition",description:"The DeviceScript Condition service is deprecated and not supported in DeviceScript.",source:"@site/docs/api/clients/devicescriptcondition.md",sourceDirName:"api/clients",slug:"/api/clients/devicescriptcondition",permalink:"/devicescript/api/clients/devicescriptcondition",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},p={},s=[],l={toc:s},u="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"devicescriptcondition"},"DeviceScriptCondition"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/devicescriptcondition/"},"DeviceScript Condition service")," is deprecated and not supported in DeviceScript."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.faee987e.js b/assets/js/1a4e3797.faee987e.js new file mode 100644 index 00000000000..01aa14021dd --- /dev/null +++ b/assets/js/1a4e3797.faee987e.js @@ -0,0 +1,2 @@ +/*! For license information please see 1a4e3797.faee987e.js.LICENSE.txt */ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7920],{42573:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,a,s,c,u,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i(a=this._events[e]))return!1;if(r(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),a.apply(this,c)}else if(n(a))for(c=Array.prototype.slice.call(arguments,1),s=(o=a.slice()).length,u=0;u<s;u++)o[u].apply(this,c);return!0},t.prototype.addListener=function(e,a){var s;if(!r(a))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(a.listener)?a.listener:a),this._events[e]?n(this._events[e])?this._events[e].push(a):this._events[e]=[this._events[e],a]:this._events[e]=a,n(this._events[e])&&!this._events[e].warned&&(s=i(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,a,s,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,a=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(c=s;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){a=c;break}if(a<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(a,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},24501:(e,t,r)=>{"use strict";var n=r(55510),i=r(1098),a=r(27155);function s(e,t,r){return new n(e,t,r)}s.version=r(22026),s.AlgoliaSearchHelper=n,s.SearchParameters=i,s.SearchResults=a,e.exports=s},21657:(e,t,r)=>{"use strict";var n=r(42573);function i(e,t){this.main=e,this.fn=t,this.lastResults=null}r(38400)(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},e.exports=i},7978:(e,t,r)=>{"use strict";var n=r(38800),i=r(56516),a=r(41262),s={addRefinement:function(e,t,r){if(s.isRefined(e,t,r))return e;var i=""+r,a=e[t]?e[t].concat(i):[i],c={};return c[t]=a,n({},c,e)},removeRefinement:function(e,t,r){if(void 0===r)return s.clearRefinement(e,(function(e,r){return t===r}));var n=""+r;return s.clearRefinement(e,(function(e,r){return t===r&&n===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return s.isRefined(e,t,r)?s.removeRefinement(e,t,r):s.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return a(e)?{}:e;if("string"==typeof t)return i(e,[t]);if("function"==typeof t){var n=!1,s=Object.keys(e).reduce((function(i,a){var s=e[a]||[],c=s.filter((function(e){return!t(e,a,r)}));return c.length!==s.length&&(n=!0),i[a]=c,i}),{});return n?s:e}},isRefined:function(e,t,r){var n=Boolean(e[t])&&e[t].length>0;if(void 0===r||!n)return n;var i=""+r;return-1!==e[t].indexOf(i)}};e.exports=s},1098:(e,t,r)=>{"use strict";var n=r(27868),i=r(38800),a=r(4501),s=r(94812),c=r(37032),u=r(56516),o=r(41262),h=r(96609),f=r(7978);function l(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return l(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var n=-1!==m.PARAMETERS.indexOf(e),i=void 0!==t[e];!n&&i&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var n=e[r];if("string"==typeof n){var i=parseFloat(n);t[r]=isNaN(i)?n:i}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach((function(e){var i=n[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=i}))})),t.numericRefinements=r}return n({},e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&o(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):o(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:f.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:f.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:f.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:f.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var i=c(r);if(this.isNumericRefined(e,t,i))return this;var a=n({},this.numericRefinements);return a[e]=n({},a[e]),a[e][t]?(a[e][t]=a[e][t].slice(),a[e][t].push(i)):a[e][t]=[i],this.setQueryParameters({numericRefinements:a})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var n=r;return void 0!==n?this.isNumericRefined(e,t,n)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t&&l(r.val,c(n))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return o(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return u(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,n=Object.keys(r).reduce((function(n,i){var a=r[i],s={};return a=a||{},Object.keys(a).forEach((function(r){var n=a[r]||[],c=[];n.forEach((function(t){e({val:t,op:r},i,"numeric")||c.push(t)})),c.length!==n.length&&(t=!0),s[r]=c})),n[i]=s,n}),{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:f.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:f.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:f.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:f.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return f.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:f.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return f.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:f.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:f.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:f.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:f.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),n={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?n[e]=[]:n[e]=[t.slice(0,t.lastIndexOf(r))]:n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:i({},n,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:i({},r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:i({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&f.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&f.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!n)return n;var i,a,u=c(r),o=void 0!==(i=this.numericRefinements[e][t],a=u,s(i,(function(e){return l(e,a)})));return n&&o},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=a(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){var e=this;return a(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0})))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(n){var i=r[n];-1===e.indexOf(n)&&void 0!==i&&(t[n]=i)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,n=m._parseNumbers(e),i=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),a=Object.keys(n).reduce((function(e,t){var r=void 0!==e[t],i=void 0!==n[t];return r&&!i?u(e,[t]):(i&&(e[t]=n[t]),e)}),i);return new this.constructor(a)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return s(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},70916:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var s=e.hierarchicalFacets[r],o=e.hierarchicalFacetsRefinements[s.name]&&e.hierarchicalFacetsRefinements[s.name][0]||"",h=e._getHierarchicalFacetSeparator(s),f=e._getHierarchicalRootPath(s),l=e._getHierarchicalShowParentLevel(s),m=a(e._getHierarchicalFacetSortBy(s)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,a,s){return function(o,h,f){var l=o;if(f>0){var m=0;for(l=o;m<f;){var d=l&&Array.isArray(l.data)?l.data:[];l=i(d,(function(e){return e.isRefined})),m++}}if(l){var p=Object.keys(h.data).map((function(e){return[e,h.data[e]]})).filter((function(e){return function(e,t,r,n,i,a){if(i&&(0!==e.indexOf(i)||i===e))return!1;return!i&&-1===e.indexOf(n)||i&&e.split(n).length-i.split(n).length==1||-1===e.indexOf(n)&&-1===r.indexOf(n)||0===r.indexOf(e)||0===e.indexOf(t+n)&&(a||0===e.indexOf(r))}(e[0],l.path||r,s,t,r,a)}));l.data=n(p.map((function(e){var r=e[0];return function(e,t,r,n,i){var a=t.split(r);return{name:a[a.length-1].trim(),path:t,escapedValue:c(t),count:e,isRefined:n===t||0===n.indexOf(t+r),exhaustive:i,data:null}}(e[1],r,t,u(s),h.exhaustive)})),e[0],e[1])}return o}}(m,h,f,l,o),v=t;return f&&(v=t.slice(f.split(h).length)),v.reduce(p,{name:e.hierarchicalFacets[r].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:d,data:null})}};var n=r(80771),i=r(94812),a=r(36034),s=r(29038),c=s.escapeFacetValue,u=s.unescapeFacetValue},27155:(e,t,r)=>{"use strict";var n=r(27868),i=r(38800),a=r(80771),s=r(24105),c=r(94812),u=r(9443),o=r(36034),h=r(29038),f=h.escapeFacetValue,l=h.unescapeFacetValue,m=r(70916);function d(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function p(e,t,r){t&&t[r]&&(e.stats=t[r])}function v(e,t,r){var a=t[0];this._rawResults=t;var o=this;Object.keys(a).forEach((function(e){o[e]=a[e]})),Object.keys(r||{}).forEach((function(e){o[e]=r[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var h=e.getRefinedDisjunctiveFacets(),f=d(e.facets),v=d(e.disjunctiveFacets),g=1,y=a.facets||{};Object.keys(y).forEach((function(t){var r,n,i=y[t],s=(r=e.hierarchicalFacets,n=t,c(r,(function(e){return(e.attributes||[]).indexOf(n)>-1})));if(s){var h=s.attributes.indexOf(t),l=u(e.hierarchicalFacets,(function(e){return e.name===s.name}));o.hierarchicalFacets[l][h]={attribute:t,data:i,exhaustive:a.exhaustiveFacetsCount}}else{var m,d=-1!==e.disjunctiveFacets.indexOf(t),g=-1!==e.facets.indexOf(t);d&&(m=v[t],o.disjunctiveFacets[m]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},p(o.disjunctiveFacets[m],a.facets_stats,t)),g&&(m=f[t],o.facets[m]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},p(o.facets[m],a.facets_stats,t))}})),this.hierarchicalFacets=s(this.hierarchicalFacets),h.forEach((function(r){var s=t[g],c=s&&s.facets?s.facets:{},h=e.getHierarchicalFacetByName(r);Object.keys(c).forEach((function(t){var r,f=c[t];if(h){r=u(e.hierarchicalFacets,(function(e){return e.name===h.name}));var m=u(o.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===m)return;o.hierarchicalFacets[r][m].data=n({},o.hierarchicalFacets[r][m].data,f)}else{r=v[t];var d=a.facets&&a.facets[t]||{};o.disjunctiveFacets[r]={name:t,data:i({},f,d),exhaustive:s.exhaustiveFacetsCount},p(o.disjunctiveFacets[r],s.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(n){!o.disjunctiveFacets[r].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(l(n))>-1&&(o.disjunctiveFacets[r].data[n]=0)}))}})),g++})),e.getRefinedHierarchicalFacets().forEach((function(r){var n=e.getHierarchicalFacetByName(r),a=e._getHierarchicalFacetSeparator(n),s=e.getHierarchicalRefinement(r);0===s.length||s[0].split(a).length<2||t.slice(g).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var c=r[t],h=u(e.hierarchicalFacets,(function(e){return e.name===n.name})),f=u(o.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==f){var l={};if(s.length>0){var m=s[0].split(a)[0];l[m]=o.hierarchicalFacets[h][f].data[m]}o.hierarchicalFacets[h][f].data=i(l,c,o.hierarchicalFacets[h][f].data)}})),g++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],n=f[t];o.facets[n]={name:t,data:y[t],exhaustive:a.exhaustiveFacetsCount},r.forEach((function(e){o.facets[n]=o.facets[n]||{name:t},o.facets[n].data=o.facets[n].data||{},o.facets[n].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(m(e)),this.facets=s(this.facets),this.disjunctiveFacets=s(this.disjunctiveFacets),this._state=e}function g(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=c(e.facets,r);return n?Object.keys(n.data).map((function(r){var i=f(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var i=c(e.disjunctiveFacets,r);return i?Object.keys(i.data).map((function(r){var n=f(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}})):[]}if(e._state.isHierarchicalFacet(t)){var a=c(e.hierarchicalFacets,r);if(!a)return a;var s=e._state.getHierarchicalFacetByName(t),u=e._state._getHierarchicalFacetSeparator(s),o=l(e._state.getHierarchicalRefinement(t)[0]||"");0===o.indexOf(s.rootPath)&&(o=o.replace(s.rootPath+u,""));var h=o.split(u);return h.unshift(t),y(a,h,0),a}}function y(e,t,r){e.isRefined=e.name===t[r],e.data&&e.data.forEach((function(e){y(e,t,r+1)}))}function R(e,t,r,n){if(n=n||0,Array.isArray(t))return e(t,r[n]);if(!t.data||0===t.data.length)return t;var a=t.data.map((function(t){return R(e,t,r,n+1)})),s=e(a,r[n]);return i({data:s},t)}function F(e,t){var r=c(e,(function(e){return e.name===t}));return r&&r.stats}function b(e,t,r,n,i){var a=c(i,(function(e){return e.name===r})),s=a&&a.data&&a.data[n]?a.data[n]:0,u=a&&a.exhaustive||!1;return{type:t,attributeName:r,name:n,count:s,exhaustive:u}}v.prototype.getFacetByName=function(e){function t(t){return t.name===e}return c(this.facets,t)||c(this.disjunctiveFacets,t)||c(this.hierarchicalFacets,t)},v.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],v.prototype.getFacetValues=function(e,t){var r=g(this,e);if(r){var n,s=i({},t,{sortBy:v.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),c=this;if(Array.isArray(r))n=[e];else n=c._state.getHierarchicalFacetByName(r.name).attributes;return R((function(e,t){if(s.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(c,t);if(r)return function(e,t){var r=[],n=[],i=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name;void 0!==i[t]?r[i[t]]=e:n.push(e)})),r=r.filter((function(e){return e}));var s,c=t.sortRemainingBy;return"hidden"===c?r:(s="alpha"===c?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(a(n,s[0],s[1])))}(e,r)}if(Array.isArray(s.sortBy)){var n=o(s.sortBy,v.DEFAULT_SORT);return a(e,n[0],n[1])}if("function"==typeof s.sortBy)return function(e,t){return t.sort(e)}(s.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,n)}},v.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?F(this.facets,e):this._state.isDisjunctiveFacet(e)?F(this.disjunctiveFacets,e):void 0},v.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(n){e.facetsRefinements[n].forEach((function(i){r.push(b(e,"facet",n,i,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(n){e.facetsExcludes[n].forEach((function(i){r.push(b(e,"exclude",n,i,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(n){e.disjunctiveFacetsRefinements[n].forEach((function(i){r.push(b(e,"disjunctive",n,i,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(n){e.hierarchicalFacetsRefinements[n].forEach((function(i){r.push(function(e,t,r,n){var i=e.getHierarchicalFacetByName(t),a=e._getHierarchicalFacetSeparator(i),s=r.split(a),u=c(n,(function(e){return e.name===t})),o=s.reduce((function(e,t){var r=e&&c(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),u),h=o&&o.count||0,f=o&&o.exhaustive||!1,l=o&&o.path||"";return{type:"hierarchical",attributeName:t,name:l,count:h,exhaustive:f}}(e,n,i,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t];Object.keys(n).forEach((function(e){n[e].forEach((function(n){r.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=v},55510:(e,t,r)=>{"use strict";var n=r(1098),i=r(27155),a=r(21657),s=r(90584),c=r(42573),u=r(38400),o=r(41262),h=r(56516),f=r(27868),l=r(22026),m=r(29038).escapeFacetValue;function d(e,t,r){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+l+")"),this.setClient(e);var i=r||{};i.index=t,this.state=n.make(i),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0}function p(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function v(){return this.state.page}u(d,c),d.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},d.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},d.prototype.getQuery=function(){var e=this.state;return s._getHitsSearchParams(e)},d.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,n=s._getQueries(r.index,r),a=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(n).then((function(e){return a._currentNbQueries--,0===a._currentNbQueries&&a.emit("searchQueueEmpty"),{content:new i(r,e.results),state:r,_originalResponse:e}}),(function(e){throw a._currentNbQueries--,0===a._currentNbQueries&&a.emit("searchQueueEmpty"),e}));this.client.search(n).then((function(e){a._currentNbQueries--,0===a._currentNbQueries&&a.emit("searchQueueEmpty"),t(null,new i(r,e.results),r)})).catch((function(e){a._currentNbQueries--,0===a._currentNbQueries&&a.emit("searchQueueEmpty"),t(e,null,r)}))},d.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var n=r.getModifiedState(t),i=f({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:h(s._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),a="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(a);var c=this.client.initIndex(n.index);if("function"!=typeof c.findAnswers)throw new Error(a);return c.findAnswers(n.query,e.queryLanguages,i)},d.prototype.searchForFacetValues=function(e,t,r,n){var i="function"==typeof this.client.searchForFacetValues,a="function"==typeof this.client.initIndex;if(!i&&!a&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(n||{}),u=c.isDisjunctiveFacet(e),o=s.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var h,f=this;return i?h=this.client.searchForFacetValues([{indexName:c.index,params:o}]):a?h=this.client.initIndex(c.index).searchForFacetValues(o):(delete o.facetName,h=this.client.search([{type:"facet",facet:e,indexName:c.index,params:o}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),h.then((function(t){return f._currentNbQueries--,0===f._currentNbQueries&&f.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=m(t.value),t.isRefined=u?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw f._currentNbQueries--,0===f._currentNbQueries&&f.emit("searchQueueEmpty"),e}))},d.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},d.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},d.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},d.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},d.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},d.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},d.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},d.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},d.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},d.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},d.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},d.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},d.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},d.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},d.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},d.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},d.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},d.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},d.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},d.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},d.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},d.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},d.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},d.prototype.setCurrentPage=p,d.prototype.setPage=p,d.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},d.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},d.prototype.setState=function(e){return this._change({state:n.make(e),isPageReset:!1}),this},d.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new n(e),this},d.prototype.hasRefinements=function(e){return!!o(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},d.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},d.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},d.prototype.hasTag=function(e){return this.state.isTagRefined(e)},d.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},d.prototype.getIndex=function(){return this.state.index},d.prototype.getCurrentPage=v,d.prototype.getPage=v,d.prototype.getTags=function(){return this.state.tagRefinements},d.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var n=r[e];t.push({value:n,operator:e,type:"numeric"})})),t},d.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},d.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},d.prototype._search=function(e){var t=this.state,r=[],n=[];e.onlyWithDerivedHelpers||(n=s._getQueries(t.index,t),r.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var i=this.derivedHelpers.map((function(e){var n=e.getModifiedState(t),i=n.index?s._getQueries(n.index,n):[];return r.push({state:n,queriesCount:i.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),i})),a=Array.prototype.concat.apply(n,i),c=this._queryId++;if(this._currentNbQueries++,!a.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,c));try{this.client.search(a).then(this._dispatchAlgoliaResponse.bind(this,r,c)).catch(this._dispatchAlgoliaError.bind(this,c))}catch(u){this.emit("error",{error:u})}},d.prototype._dispatchAlgoliaResponse=function(e,t,r){if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var n=r.results.slice();e.forEach((function(e){var t=e.state,r=e.queriesCount,a=e.helper,s=n.splice(0,r);t.index?(a.lastResults=new i(t,s),a.emit("result",{results:a.lastResults,state:t})):a.emit("result",{results:null,state:t})}))}},d.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},d.prototype.containsRefinement=function(e,t,r,n){return e||0!==t.length||0!==r.length||0!==n.length},d.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},d.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},d.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},d.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+l+")"),this.client=e),this},d.prototype.getClient=function(){return this.client},d.prototype.derive=function(e){var t=new a(this,e);return this.derivedHelpers.push(t),t},d.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},d.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=d},24105:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},38800:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},29038:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},94812:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}},9443:e=>{"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r<e.length;r++)if(t(e[r]))return r;return-1}},36034:(e,t,r)=>{"use strict";var n=r(94812);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var i=t.split(":"),a=n(r,(function(e){return e[0]===i[0]}));return i.length>1||!a?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(a[0]),e[1].push(a[1]),e)}),[[],[]])}},38400:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},4501:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,n){return t.indexOf(r)>-1&&e.indexOf(r)===n}))}},27868:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,n){if(e===n)return e;for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"__proto__"!==i&&"constructor"!==i){var a=n[i],s=e[i];void 0!==s&&void 0===a||(t(s)&&t(a)?e[i]=r(s,a):e[i]="object"==typeof(c=a)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var n=1,i=arguments.length;n<i;n++){var a=arguments[n];t(a)&&r(e,a)}return e}},41262:e=>{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},56516:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}},80771:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=void 0!==t,a=null===t;if(!a&&e>t||n&&i||!r)return 1;if(!n&&e<t||a&&r||!i)return-1}return 0}e.exports=function(e,r,n){if(!Array.isArray(e))return[];Array.isArray(n)||(n=[]);var i=e.map((function(e,t){return{criteria:r.map((function(t){return e[t]})),index:t,value:e}}));return i.sort((function(e,r){for(var i=-1;++i<e.criteria.length;){var a=t(e.criteria[i],r.criteria[i]);if(a)return i>=n.length?a:"desc"===n[i]?-a:a}return e.index-r.index})),i.map((function(e){return e.value}))}},37032:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},90584:(e,t,r)=>{"use strict";var n=r(27868);function i(e){return Object.keys(e).sort((function(e,t){return e.localeCompare(t)})).reduce((function(t,r){return t[r]=e[r],t}),{})}var a={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:a._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(n){r.push({indexName:e,params:a._getDisjunctiveFacetSearchParams(t,n)})})),t.getRefinedHierarchicalFacets().forEach((function(n){var i=t.getHierarchicalFacetByName(n),s=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(i);if(s.length>0&&s[0].split(c).length>1){var u=s[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:i.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);u.forEach((function(n,s){var c=a._getDisjunctiveFacetSearchParams(t,n.attribute,0===s);function o(e){return i.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!o(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||o(t)||e.push(t),e}),[]),f=u[s-1];c.facetFilters=s>0?h.concat(f.attribute+":"+f.value):h.length>0?h:void 0,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(a._getHitsHierarchicalFacetsAttributes(e)),r=a._getFacetFilters(e),s=a._getNumericFilters(e),c=a._getTagFilters(e),u={facets:t.indexOf("*")>-1?["*"]:t,tagFilters:c};return r.length>0&&(u.facetFilters=r),s.length>0&&(u.numericFilters=s),i(n({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,r){var s=a._getFacetFilters(e,t,r),c=a._getNumericFilters(e,t),u=a._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var h=e.getHierarchicalFacetByName(t);return o.facets=h?a._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(o.numericFilters=c),s.length>0&&(o.facetFilters=s),i(n({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(n){var i=e.numericRefinements[n]||{};Object.keys(i).forEach((function(e){var a=i[e]||[];t!==n&&a.forEach((function(t){if(Array.isArray(t)){var i=t.map((function(t){return n+e+t}));r.push(i)}else r.push(n+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var n=[],i=e.facetsRefinements||{};Object.keys(i).forEach((function(e){(i[e]||[]).forEach((function(t){n.push(e+":"+t)}))}));var a=e.facetsExcludes||{};Object.keys(a).forEach((function(e){(a[e]||[]).forEach((function(t){n.push(e+":-"+t)}))}));var s=e.disjunctiveFacetsRefinements||{};Object.keys(s).forEach((function(e){var r=s[e]||[];if(e!==t&&r&&0!==r.length){var i=[];r.forEach((function(t){i.push(e+":"+t)})),n.push(i)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).forEach((function(i){var a=(c[i]||[])[0];if(void 0!==a){var s,u,o=e.getHierarchicalFacetByName(i),h=e._getHierarchicalFacetSeparator(o),f=e._getHierarchicalRootPath(o);if(t===i){if(-1===a.indexOf(h)||!f&&!0===r||f&&f.split(h).length===a.split(h).length)return;f?(u=f.split(h).length-1,a=f):(u=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),s=o.attributes[u]}else u=a.split(h).length-1,s=o.attributes[u];s&&n.push([s+":"+a])}})),n},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var n=e.getHierarchicalRefinement(r.name)[0];if(!n)return t.push(r.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(r),a=n.split(i).length,s=r.attributes.slice(0,a+1);return t.concat(s)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var n=e._getHierarchicalFacetSeparator(t);if(!0===r){var i=e._getHierarchicalRootPath(t),a=0;return i&&(a=i.split(n).length),[t.attributes[a]]}var s=(e.getHierarchicalRefinement(t.name)[0]||"").split(n).length-1;return t.attributes.slice(0,s+1)},getSearchForFacetQuery:function(e,t,r,s){var c=s.isDisjunctiveFacet(e)?s.clearRefinements(e):s,u={facetQuery:t,facetName:e};return"number"==typeof r&&(u.maxFacetHits=r),i(n({},a._getHitsSearchParams(c),u))}};e.exports=a},96609:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},22026:e=>{"use strict";e.exports="3.13.5"},80934:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(n=(s=c.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(i)throw a}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function s(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")},s=function(e){n().setItem(r,JSON.stringify(e))},c=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=a(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==i(e,2)[1].timestamp})));if(s(n),t){var c=Object.fromEntries(Object.entries(n).filter((function(e){var r=i(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));s(c)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){c();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var i=a();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(i)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,i).catch((function(){return c({caches:t}).get(e,n,i)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var s=n(),c=i&&i.miss||function(){return Promise.resolve()};return s.then((function(e){return c(e)})).then((function(){return s}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function o(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function f(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[i++])}))}var l={WithinQueryParameters:0,WithinHeaders:1};function m(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,v=2,g=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function R(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var F="GET",b="POST";function P(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===g&&Date.now()-e.lastUpdate<=12e4}(e)})),i=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:i.length>0?i.map((function(e){return R(e)})):t}}))}function j(e,t,n,i){var s=[],c=function(e,t){if(e.method!==F&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,i),u=function(e,t){var n=r(r({},e.headers),t.headers),i={};return Object.keys(n).forEach((function(e){var t=n[e];i[e.toLowerCase()]=t})),i}(e,i),o=n.method,h=n.method!==F?{}:r(r({},n.data),i.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),h),i.queryParameters),l=0,m=function t(r,a){var h=r.pop();if(void 0===h)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:O(s)};var m={data:c,headers:u,method:o,url:E(h,n.path,f),connectTimeout:a(l,e.timeouts.connect),responseTimeout:a(l,i.timeout)},d=function(e){var t={request:m,response:e,host:h,triesLeft:r.length};return s.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var i=d(n);return n.isTimedOut&&l++,Promise.all([e.logger.info("Retryable failure",w(i)),e.hostsCache.set(h,y(h,n.isTimedOut?g:v))]).then((function(){return t(r,a)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,i=r;try{i=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(i,n,t)}(e,O(s))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return P(e.hostsCache,t).then((function(e){return m(a(e.statelessHosts).reverse(),e.getTimeout)}))}function _(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function E(e,t,r){var n=x(r),i="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(i+="?".concat(n)),i}function x(e){return Object.keys(e).map((function(t){return f("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function O(e){return e.map((function(e){return w(e)}))}function w(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var N=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===l.WithinHeaders?n:{}},queryParameters:function(){return e===l.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:l.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,s=e.responsesCache,c=e.timeouts,u=e.userAgent,o=e.hosts,h=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:s,timeouts:c,userAgent:u,headers:e.headers,queryParameters:h,hosts:o.map((function(e){return R(e)})),read:function(e,t){var r=m(t,f.timeouts.read),n=function(){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,n()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=i(e,2);return t[0],t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&d.Write)})),e,m(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(o([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},A=function(e){return function(t,r){return t.method===F?e.transporter.read(t,r):e.transporter.write(t,r)}},H=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},S=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{params:x(e.params||{})})}));return e.transporter.read({method:b,path:"1/indexes/*/queries",data:{requests:i},cacheable:!0},n)}},T=function(e){return function(t,i){return Promise.all(t.map((function(t){var a=t.params,s=a.facetName,c=a.facetQuery,u=n(a,["facetName","facetQuery"]);return H(e)(t.indexName,{methods:{searchForFacetValues:I}}).searchForFacetValues(s,c,r(r({},i),u))})))}},Q=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},C=function(e){return function(t,r){return e.transporter.read({method:b,path:f("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},I=function(e){return function(t,r,n){return e.transporter.read({method:b,path:f("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},k=1,D=2,q=3;function L(e,t,n){var i,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,i=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=i(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=i(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(i=q,{debug:function(e,t){return k>=i&&console.debug(e,t),Promise.resolve()},info:function(e,t){return D>=i&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:c({caches:[s({key:"".concat("4.19.0","-").concat(e)}),u()]}),userAgent:_("4.19.0").add({segment:"Browser",version:"lite"}),authMode:l.WithinQueryParameters};return N(r(r(r({},a),n),{},{methods:{search:S,searchForFacetValues:T,multipleQueries:S,multipleSearchForFacetValues:T,customRequest:A,initIndex:function(e){return function(t){return H(e)(t,{methods:{search:C,searchForFacetValues:I,findAnswers:Q}})}}}}))}return L.version="4.19.0",L}()},41174:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>A});var n=r(27378),i=r(38944),a=r(24501),s=r.n(a),c=r(80934),u=r.n(c),o=r(161),h=r(7092),f=r(81884),l=r(62935),m=r(50353);const d=["zero","one","two","few","many","other"];function p(e){return d.filter((t=>e.includes(t)))}const v={locale:"en",pluralForms:p(["one","other"]),select:e=>1===e?"one":"other"};function g(){const{i18n:{currentLocale:e}}=(0,m.Z)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:p(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),v}}),[e])}function y(){const e=g();return{selectMessage:(t,r)=>function(e,t,r){const n=e.split("|");if(1===n.length)return n[0];n.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const i=r.select(t),a=r.pluralForms.indexOf(i);return n[Math.min(a,n.length-1)]}(r,t,e)}}var R=r(53584),F=r(41763),b=r(1123),P=r(99162),j=r(99213),_=r(80632),E=r(42473),x=r(20432);const O={searchQueryInput:"searchQueryInput_RVvj",searchVersionInput:"searchVersionInput_QmSs",searchResultsColumn:"searchResultsColumn_Vh0c",algoliaLogo:"algoliaLogo_yiAH",algoliaLogoPathFill:"algoliaLogoPathFill_tzCx",searchResultItem:"searchResultItem_q31K",searchResultItemHeading:"searchResultItemHeading_Iq68",searchResultItemPath:"searchResultItemPath_pr04",searchResultItemSummary:"searchResultItemSummary_fqhL",searchQueryColumn:"searchQueryColumn_YWTO",searchVersionColumn:"searchVersionColumn_pdNL",searchLogoColumn:"searchLogoColumn_ugtA",loadingSpinner:"loadingSpinner_hU64","loading-spin":"loading-spin_xBR4",loader:"loader_DZsO"};function w(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return n.createElement("div",{className:(0,i.Z)("col","col--3","padding-left--none",O.searchVersionColumn)},r.map((e=>{let[i,a]=e;const s=r.length>1?`${i}: `:"";return n.createElement("select",{key:i,onChange:e=>t.setSearchVersion(i,e.target.value),defaultValue:t.searchVersions[i],className:O.searchVersionInput},a.versions.map(((e,t)=>n.createElement("option",{key:t,label:`${s}${e.label}`,value:e.name}))))})))}function N(){const{i18n:{currentLocale:e}}=(0,m.Z)(),{algolia:{appId:t,apiKey:r,indexName:a}}=(0,_.L)(),c=(0,E.l)(),d=function(){const{selectMessage:e}=y();return t=>e(t,(0,j.I)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),p=function(){const e=(0,l._r)(),[t,r]=(0,n.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return{...e,[r]:n.versions[0].name}}),{}))),i=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:i,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),[v,g]=(0,R.K)(),b={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[N,A]=(0,n.useReducer)(((e,t)=>{switch(t.type){case"reset":return b;case"loading":return{...e,loading:!0};case"update":return v!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),b),H=u()(t,r),S=s()(H,a,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:["language","docusaurus_tag"]});S.on("result",(e=>{let{results:{query:t,hits:r,page:n,nbHits:i,nbPages:a}}=e;if(""===t||!Array.isArray(r))return void A({type:"reset"});const s=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),u=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:n={}}=e;const i=Object.keys(r).map((e=>s(r[e].value)));return{title:i.pop(),url:c(t),summary:n.content?`${s(n.content.value)}...`:"",breadcrumbs:i}}));A({type:"update",value:{items:u,query:t,totalResults:i,totalPages:a,lastPage:n,hasMore:a>n+1,loading:!1}})}));const[T,Q]=(0,n.useState)(null),C=(0,n.useRef)(0),I=(0,n.useRef)(o.Z.canUseIntersectionObserver&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&C.current>r&&A({type:"advance"}),C.current=r}),{threshold:1})),k=()=>v?(0,j.I)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:v}):(0,j.I)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),D=(0,F.zX)((function(t){void 0===t&&(t=0),S.addDisjunctiveFacetRefinement("docusaurus_tag","default"),S.addDisjunctiveFacetRefinement("language",e),Object.entries(p.searchVersions).forEach((e=>{let[t,r]=e;S.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)})),S.setQuery(v).setPage(t).search()}));return(0,n.useEffect)((()=>{if(!T)return;const e=I.current;return e?(e.observe(T),()=>e.unobserve(T)):()=>!0}),[T]),(0,n.useEffect)((()=>{A({type:"reset"}),v&&(A({type:"loading"}),setTimeout((()=>{D()}),300))}),[v,p.searchVersions,D]),(0,n.useEffect)((()=>{N.lastPage&&0!==N.lastPage&&D(N.lastPage)}),[D,N.lastPage]),n.createElement(x.Z,null,n.createElement(h.Z,null,n.createElement("title",null,(0,P.p)(k())),n.createElement("meta",{property:"robots",content:"noindex, follow"})),n.createElement("div",{className:"container margin-vert--lg"},n.createElement("h1",null,k()),n.createElement("form",{className:"row",onSubmit:e=>e.preventDefault()},n.createElement("div",{className:(0,i.Z)("col",O.searchQueryColumn,{"col--9":p.versioningEnabled,"col--12":!p.versioningEnabled})},n.createElement("input",{type:"search",name:"q",className:O.searchQueryInput,placeholder:(0,j.I)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,j.I)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>g(e.target.value),value:v,autoComplete:"off",autoFocus:!0})),p.versioningEnabled&&n.createElement(w,{docsSearchVersionsHelpers:p})),n.createElement("div",{className:"row"},n.createElement("div",{className:(0,i.Z)("col","col--8",O.searchResultsColumn)},!!N.totalResults&&d(N.totalResults)),n.createElement("div",{className:(0,i.Z)("col","col--4","text--right",O.searchLogoColumn)},n.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.algolia.com/","aria-label":(0,j.I)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"})},n.createElement("svg",{viewBox:"0 0 168 24",className:O.algoliaLogo},n.createElement("g",{fill:"none"},n.createElement("path",{className:O.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),n.createElement("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),n.createElement("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})))))),N.items.length>0?n.createElement("main",null,N.items.map(((e,t)=>{let{title:r,url:a,summary:s,breadcrumbs:c}=e;return n.createElement("article",{key:t,className:O.searchResultItem},n.createElement("h2",{className:O.searchResultItemHeading},n.createElement(f.Z,{to:a,dangerouslySetInnerHTML:{__html:r}})),c.length>0&&n.createElement("nav",{"aria-label":"breadcrumbs"},n.createElement("ul",{className:(0,i.Z)("breadcrumbs",O.searchResultItemPath)},c.map(((e,t)=>n.createElement("li",{key:t,className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}}))))),s&&n.createElement("p",{className:O.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}}))}))):[v&&!N.loading&&n.createElement("p",{key:"no-results"},n.createElement(j.Z,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result"},"No results were found")),!!N.loading&&n.createElement("div",{key:"spinner",className:O.loadingSpinner})],N.hasMore&&n.createElement("div",{className:O.loader,ref:Q},n.createElement(j.Z,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results"},"Fetching new results..."))))}function A(){return n.createElement(b.FG,{className:"search-page-wrapper"},n.createElement(N,null))}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.faee987e.js.LICENSE.txt b/assets/js/1a4e3797.faee987e.js.LICENSE.txt new file mode 100644 index 00000000000..ac43b0e313c --- /dev/null +++ b/assets/js/1a4e3797.faee987e.js.LICENSE.txt @@ -0,0 +1 @@ +/*! algoliasearch-lite.umd.js | 4.19.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ diff --git a/assets/js/1b1eee5e.189c0a28.js b/assets/js/1b1eee5e.189c0a28.js new file mode 100644 index 00000000000..44178aa9526 --- /dev/null +++ b/assets/js/1b1eee5e.189c0a28.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6060],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var o=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),d=r,g=u["".concat(l,".").concat(d)]||u[d]||m[d]||a;return n?o.createElement(g,i(i({ref:t},c),{},{components:n})):o.createElement(g,i({ref:t},c))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:r,i[1]=s;for(var p=2;p<a;p++)i[p]=n[p];return o.createElement.apply(null,i)}return o.createElement.apply(null,n)}d.displayName="MDXCreateElement"},39388:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var o=n(25773),r=(n(27378),n(35318));const a={sidebar_position:1,description:"Learn how to use console functionality in DeviceScript to add logging to your script and how to use format strings to write registers.",keywords:["DeviceScript","console","logging","format strings","registers"]},i="Console output",s={unversionedId:"developer/console",id:"developer/console",title:"Console output",description:"Learn how to use console functionality in DeviceScript to add logging to your script and how to use format strings to write registers.",source:"@site/docs/developer/console.mdx",sourceDirName:"developer",slug:"/developer/console",permalink:"/devicescript/developer/console",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Learn how to use console functionality in DeviceScript to add logging to your script and how to use format strings to write registers.",keywords:["DeviceScript","console","logging","format strings","registers"]},sidebar:"tutorialSidebar",previous:{title:"Developer",permalink:"/devicescript/developer/"},next:{title:"Status Light",permalink:"/devicescript/developer/status-light"}},l={},p=[{value:"Console data",id:"console-data",level:2},{value:"Format strings",id:"format-strings",level:2}],c={toc:p},u="wrapper";function m(e){let{components:t,...a}=e;return(0,r.kt)(u,(0,o.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"console-output"},"Console output"),(0,r.kt)("p",null,"DeviceScript supports basic ",(0,r.kt)("inlineCode",{parentName:"p"},"console")," functionality which allows you to add logging to your script."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'console.debug("debug")\nconsole.log("log")\nconsole.warn("warn")\nconsole.error("error")\n')),(0,r.kt)("p",null,"The console output will be visible in the DeviceScript terminal window."),(0,r.kt)("h2",{id:"console-data"},"Console data"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"console.data")," is a special purpose function to log sensor data. A timestamp (",(0,r.kt)("inlineCode",{parentName:"p"},"ds.millis()"),") is automatically added by the runtime."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const temp = 20\nconst humi = 60\n\nconsole.data({ temp, humi })\n")),(0,r.kt)("p",null,"In Visual Studio Code, you will find the data in the ",(0,r.kt)("strong",{parentName:"p"},"DeviceScript - Data"),"\noutput pane or you can download it from the view menu."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"console data icon",src:n(13682).Z,width:"372",height:"355"})),(0,r.kt)("p",null,"The following Visual Studio Code extensions are recommended for a best experience:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter"},"Jupyter")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-renderers"},"Jupyter Renderers")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=ms-python.python"},"Python")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance"},"PyLance")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=mechatroner.rainbow-csv"},"Raibow CSV"))),(0,r.kt)("h2",{id:"format-strings"},"Format strings"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"console.log()")," takes zero or more arguments of any type.\nTemplate literals and string concatenation are also supported.\nCompiler internally constructs a format string (see below)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'let x = 0\nlet y = 4\nconsole.log("Hello world")\nconsole.log("X is", x, "and Y is", y)\nconsole.log("X=", x, "Y=", y)\nconsole.log(`X=${x} Y=${y}`)\nconsole.log("X=" + x + " Y=" + y)\n')),(0,r.kt)("p",null,"The compiler is smart about adding spaces (the second and third examples will print ",(0,r.kt)("inlineCode",{parentName:"p"},"X is 7 and Y is 12"),"\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"X=7 Y=12")," respectively)."),(0,r.kt)("p",null,"Concatenation and template literals can be also used to write registers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'const screen = new ds.CharacterScreen()\nlet x = 7\nscreen.message.write("X = " + x)\nscreen.message.write(`X is ${x}`)\n')),(0,r.kt)("p",null,"You can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ds.format()")," function directly, either with ",(0,r.kt)("inlineCode",{parentName:"p"},"console.log()")," or\nwhen setting string registers.\nArguments are ",(0,r.kt)("inlineCode",{parentName:"p"},"{0}"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"{1}"),", ..., ",(0,r.kt)("inlineCode",{parentName:"p"},"{9}"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"{A}"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"{B}"),", ..., ",(0,r.kt)("inlineCode",{parentName:"p"},"{F}"),".\nA second digit can be supplied to specify precision (though this doesn't work so well yet):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'const screen = new ds.CharacterScreen()\nlet x = 7,\n y = 12\n\nconsole.log(ds.format("X is {0} and Y is {1}", x, y))\nconsole.log(ds.format("X = {04}", x))\nscreen.message.write(ds.format("X is {0}", x))\n')))}m.isMDXComponent=!0},13682:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/consoledata-82fce9648a2c3463633acc673722b334.png"}}]); \ No newline at end of file diff --git a/assets/js/1b288cf4.af496d69.js b/assets/js/1b288cf4.af496d69.js new file mode 100644 index 00000000000..bbd2211176e --- /dev/null +++ b/assets/js/1b288cf4.af496d69.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9459],{35318:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>f});var n=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function l(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=n.createContext({}),c=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=c(e.components);return n.createElement(s.Provider,{value:r},e.children)},u="mdxType",v={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(t),d=a,f=u["".concat(s,".").concat(d)]||u[d]||v[d]||o;return t?n.createElement(f,i(i({ref:r},p),{},{components:t})):n.createElement(f,i({ref:r},p))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=d;var l={};for(var s in r)hasOwnProperty.call(r,s)&&(l[s]=r[s]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var c=2;c<o;c++)i[c]=t[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}d.displayName="MDXCreateElement"},47501:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>i,default:()=>v,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=t(25773),a=(t(27378),t(35318));const o={description:"Mounts a water level sensor",title:"Water Level"},i="Water",l={unversionedId:"api/drivers/waterlevel",id:"api/drivers/waterlevel",title:"Water Level",description:"Mounts a water level sensor",source:"@site/docs/api/drivers/waterlevel.md",sourceDirName:"api/drivers",slug:"/api/drivers/waterlevel",permalink:"/devicescript/api/drivers/waterlevel",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a water level sensor",title:"Water Level"},sidebar:"tutorialSidebar",previous:{title:"UC8151",permalink:"/devicescript/api/drivers/uc8151"},next:{title:"Runtime",permalink:"/devicescript/api/runtime/"}},s={},c=[],p={toc:c},u="wrapper";function v(e){let{components:r,...t}=e;return(0,a.kt)(u,(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"water"},"Water"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"startWaterLevel")," starts a simple analog sensor server that models a water level sensor\nand returns a ",(0,a.kt)("a",{parentName:"p",href:"/api/clients/waterlevel"},"client")," bound to the server."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Please refer to the ",(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("a",{parentName:"strong",href:"/developer/drivers/analog/"},"analog documentation"))," for details.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startWaterLevel } from "@devicescript/servers"\n\nconst sensor = startWaterLevel({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(level => console.data({ level }))\n')))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1be78505.6dc27e27.js b/assets/js/1be78505.6dc27e27.js new file mode 100644 index 00000000000..77678bca25f --- /dev/null +++ b/assets/js/1be78505.6dc27e27.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9514,3893],{65553:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ge});var a=n(27378),o=n(38944),l=n(1123),r=n(75484),c=n(13149),i=n(45161),s=n(25611),d=n(52095),m=n(20432),u=n(99213),b=n(83457),p=n(24993);const h={backToTopButton:"backToTopButton_iEvu",backToTopButtonShow:"backToTopButtonShow_DO8w"};function E(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,o]=(0,a.useState)(!1),l=(0,a.useRef)(!1),{startScroll:r,cancelScroll:c}=(0,b.Ct)();return(0,b.RF)(((e,n)=>{let{scrollY:a}=e;const r=n?.scrollY;r&&(l.current?l.current=!1:a>=r?(c(),o(!1)):a<t?o(!1):a+window.innerHeight<document.documentElement.scrollHeight&&o(!0))})),(0,p.S)((e=>{e.location.hash&&(l.current=!0,o(!1))})),{shown:n,scrollToTop:()=>r(0)}}({threshold:300});return a.createElement("button",{"aria-label":(0,u.I)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,o.Z)("clean-btn",r.k.common.backToTopButton,h.backToTopButton,e&&h.backToTopButtonShow),type:"button",onClick:t})}var f=n(56903),g=n(3620),v=n(58357),k=n(20624),C=n(10898),_=n(25773);function I(e){return a.createElement("svg",(0,_.Z)({width:"20",height:"20","aria-hidden":"true"},e),a.createElement("g",{fill:"#7a7a7a"},a.createElement("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),a.createElement("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})))}const S={collapseSidebarButton:"collapseSidebarButton_oTwn",collapseSidebarButtonIcon:"collapseSidebarButtonIcon_pMEX"};function N(e){let{onClick:t}=e;return a.createElement("button",{type:"button",title:(0,u.I)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,u.I)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,o.Z)("button button--secondary button--outline",S.collapseSidebarButton),onClick:t},a.createElement(I,{className:S.collapseSidebarButtonIcon}))}var T=n(10),Z=n(41763);const x=Symbol("EmptyContext"),w=a.createContext(x);function B(e){let{children:t}=e;const[n,o]=(0,a.useState)(null),l=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:o})),[n]);return a.createElement(w.Provider,{value:l},t)}var y=n(80376),L=n(8862),A=n(81884),M=n(76457);function H(e){let{categoryLabel:t,onClick:n}=e;return a.createElement("button",{"aria-label":(0,u.I)({id:"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel",message:"Toggle the collapsible sidebar category '{label}'",description:"The ARIA label to toggle the collapsible sidebar category"},{label:t}),type:"button",className:"clean-btn menu__caret",onClick:n})}function P(e){let{item:t,onItemClick:n,activePath:l,level:c,index:s,...d}=e;const{items:m,label:u,collapsible:b,className:p,href:h}=t,{docs:{sidebar:{autoCollapseCategories:E}}}=(0,k.L)(),f=function(e){const t=(0,M.Z)();return(0,a.useMemo)((()=>e.href?e.href:!t&&e.collapsible?(0,i.Wl)(e):void 0),[e,t])}(t),g=(0,i._F)(t,l),v=(0,L.Mg)(h,l),{collapsed:C,setCollapsed:I}=(0,y.u)({initialState:()=>!!b&&(!g&&t.collapsed)}),{expandedItem:S,setExpandedItem:N}=function(){const e=(0,a.useContext)(w);if(e===x)throw new Z.i6("DocSidebarItemsExpandedStateProvider");return e}(),T=function(e){void 0===e&&(e=!C),N(e?null:s),I(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:o}=e;const l=(0,Z.D9)(t);(0,a.useEffect)((()=>{t&&!l&&n&&o(!1)}),[t,l,n,o])}({isActive:g,collapsed:C,updateCollapsed:T}),(0,a.useEffect)((()=>{b&&null!=S&&S!==s&&E&&I(!0)}),[b,S,s,I,E]),a.createElement("li",{className:(0,o.Z)(r.k.docs.docSidebarItemCategory,r.k.docs.docSidebarItemCategoryLevel(c),"menu__list-item",{"menu__list-item--collapsed":C},p)},a.createElement("div",{className:(0,o.Z)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":v})},a.createElement(A.Z,(0,_.Z)({className:(0,o.Z)("menu__link",{"menu__link--sublist":b,"menu__link--sublist-caret":!h&&b,"menu__link--active":g}),onClick:b?e=>{n?.(t),h?T(!1):(e.preventDefault(),T())}:()=>{n?.(t)},"aria-current":v?"page":void 0,"aria-expanded":b?!C:void 0,href:b?f??"#":f},d),u),h&&b&&a.createElement(H,{categoryLabel:u,onClick:e=>{e.preventDefault(),T()}})),a.createElement(y.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:C},a.createElement(O,{items:m,tabIndex:C?-1:0,onItemClick:n,activePath:l,level:c+1})))}var F=n(45626),W=n(6125);const R={menuExternalLink:"menuExternalLink_BiEj"};function D(e){let{item:t,onItemClick:n,activePath:l,level:c,index:s,...d}=e;const{href:m,label:u,className:b,autoAddBaseUrl:p}=t,h=(0,i._F)(t,l),E=(0,F.Z)(m);return a.createElement("li",{className:(0,o.Z)(r.k.docs.docSidebarItemLink,r.k.docs.docSidebarItemLinkLevel(c),"menu__list-item",b),key:u},a.createElement(A.Z,(0,_.Z)({className:(0,o.Z)("menu__link",!E&&R.menuExternalLink,{"menu__link--active":h}),autoAddBaseUrl:p,"aria-current":h?"page":void 0,to:m},E&&{onClick:n?()=>n(t):void 0},d),u,!E&&a.createElement(W.Z,null)))}const V={menuHtmlItem:"menuHtmlItem_OniL"};function Y(e){let{item:t,level:n,index:l}=e;const{value:c,defaultStyle:i,className:s}=t;return a.createElement("li",{className:(0,o.Z)(r.k.docs.docSidebarItemLink,r.k.docs.docSidebarItemLinkLevel(n),i&&[V.menuHtmlItem,"menu__list-item"],s),key:l,dangerouslySetInnerHTML:{__html:c}})}function z(e){let{item:t,...n}=e;switch(t.type){case"category":return a.createElement(P,(0,_.Z)({item:t},n));case"html":return a.createElement(Y,(0,_.Z)({item:t},n));default:return a.createElement(D,(0,_.Z)({item:t},n))}}function j(e){let{items:t,...n}=e;return a.createElement(B,null,t.map(((e,t)=>a.createElement(z,(0,_.Z)({key:t,item:e,index:t},n)))))}const O=(0,a.memo)(j),U={menu:"menu_jmj1",menuWithAnnouncementBar:"menuWithAnnouncementBar_YufC"};function G(e){let{path:t,sidebar:n,className:l}=e;const c=function(){const{isActive:e}=(0,T.nT)(),[t,n]=(0,a.useState)(e);return(0,b.RF)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return a.createElement("nav",{"aria-label":(0,u.I)({id:"theme.docs.sidebar.navAriaLabel",message:"Docs sidebar",description:"The ARIA label for the sidebar navigation"}),className:(0,o.Z)("menu thin-scrollbar",U.menu,c&&U.menuWithAnnouncementBar,l)},a.createElement("ul",{className:(0,o.Z)(r.k.docs.docSidebarMenu,"menu__list")},a.createElement(O,{items:n,activePath:t,level:1})))}const K="sidebar_CUen",q="sidebarWithHideableNavbar_w4KB",J="sidebarHidden_k6VE",Q="sidebarLogo_CYvI";function X(e){let{path:t,sidebar:n,onCollapse:l,isHidden:r}=e;const{navbar:{hideOnScroll:c},docs:{sidebar:{hideable:i}}}=(0,k.L)();return a.createElement("div",{className:(0,o.Z)(K,c&&q,r&&J)},c&&a.createElement(C.Z,{tabIndex:-1,className:Q}),a.createElement(G,{path:t,sidebar:n}),i&&a.createElement(N,{onClick:l}))}const $=a.memo(X);var ee=n(63471),te=n(85536);const ne=e=>{let{sidebar:t,path:n}=e;const l=(0,te.e)();return a.createElement("ul",{className:(0,o.Z)(r.k.docs.docSidebarMenu,"menu__list")},a.createElement(O,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&l.toggle(),"link"===e.type&&l.toggle()},level:1}))};function ae(e){return a.createElement(ee.Zo,{component:ne,props:e})}const oe=a.memo(ae);function le(e){const t=(0,v.i)(),n="desktop"===t||"ssr"===t,o="mobile"===t;return a.createElement(a.Fragment,null,n&&a.createElement($,e),o&&a.createElement(oe,e))}const re={expandButton:"expandButton_YOoA",expandButtonIcon:"expandButtonIcon_GZLG"};function ce(e){let{toggleSidebar:t}=e;return a.createElement("div",{className:re.expandButton,title:(0,u.I)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,u.I)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t},a.createElement(I,{className:re.expandButtonIcon}))}const ie={docSidebarContainer:"docSidebarContainer_y0RQ",docSidebarContainerHidden:"docSidebarContainerHidden_uArb",sidebarViewport:"sidebarViewport_EJ1r"};function se(e){let{children:t}=e;const n=(0,d.V)();return a.createElement(a.Fragment,{key:n?.name??"noSidebar"},t)}function de(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:l}=e;const{pathname:c}=(0,g.TH)(),[i,s]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{i&&s(!1),!i&&(0,f.n)()&&s(!0),l((e=>!e))}),[l,i]);return a.createElement("aside",{className:(0,o.Z)(r.k.docs.docSidebarContainer,ie.docSidebarContainer,n&&ie.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(ie.docSidebarContainer)&&n&&s(!0)}},a.createElement(se,null,a.createElement("div",{className:(0,o.Z)(ie.sidebarViewport,i&&ie.sidebarViewportHidden)},a.createElement(le,{sidebar:t,path:c,onCollapse:d,isHidden:i}),i&&a.createElement(ce,{toggleSidebar:d}))))}const me={docMainContainer:"docMainContainer_sTIZ",docMainContainerEnhanced:"docMainContainerEnhanced_iSjt",docItemWrapperEnhanced:"docItemWrapperEnhanced_PxMR"};function ue(e){let{hiddenSidebarContainer:t,children:n}=e;const l=(0,d.V)();return a.createElement("main",{className:(0,o.Z)(me.docMainContainer,(t||!l)&&me.docMainContainerEnhanced)},a.createElement("div",{className:(0,o.Z)("container padding-top--md padding-bottom--lg",me.docItemWrapper,t&&me.docItemWrapperEnhanced)},n))}const be={docPage:"docPage_KLoz",docsWrapper:"docsWrapper_ct1J"};function pe(e){let{children:t}=e;const n=(0,d.V)(),[o,l]=(0,a.useState)(!1);return a.createElement(m.Z,{wrapperClassName:be.docsWrapper},a.createElement(E,null),a.createElement("div",{className:be.docPage},n&&a.createElement(de,{sidebar:n.items,hiddenSidebarContainer:o,setHiddenSidebarContainer:l}),a.createElement(ue,{hiddenSidebarContainer:o},t)))}var he=n(53893),Ee=n(60505);function fe(e){const{versionMetadata:t}=e;return a.createElement(a.Fragment,null,a.createElement(Ee.Z,{version:t.version,tag:(0,c.os)(t.pluginId,t.version)}),a.createElement(l.d,null,t.noIndex&&a.createElement("meta",{name:"robots",content:"noindex, nofollow"})))}function ge(e){const{versionMetadata:t}=e,n=(0,i.hI)(e);if(!n)return a.createElement(he.default,null);const{docElement:c,sidebarName:m,sidebarItems:u}=n;return a.createElement(a.Fragment,null,a.createElement(fe,e),a.createElement(l.FG,{className:(0,o.Z)(r.k.wrapper.docsPages,r.k.page.docsDocPage,e.versionMetadata.className)},a.createElement(s.q,{version:t},a.createElement(d.b,{name:m,items:u},a.createElement(pe,null,c)))))}},53893:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var a=n(27378),o=n(99213),l=n(1123),r=n(20432);function c(){return a.createElement(a.Fragment,null,a.createElement(l.d,{title:(0,o.I)({id:"theme.NotFound.title",message:"Page Not Found"})}),a.createElement(r.Z,null,a.createElement("main",{className:"container margin-vert--xl"},a.createElement("div",{className:"row"},a.createElement("div",{className:"col col--6 col--offset-3"},a.createElement("h1",{className:"hero__title"},a.createElement(o.Z,{id:"theme.NotFound.title",description:"The title of the 404 page"},"Page Not Found")),a.createElement("p",null,a.createElement(o.Z,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page"},"We could not find what you were looking for.")),a.createElement("p",null,a.createElement(o.Z,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page"},"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))))}},25611:(e,t,n)=>{n.d(t,{E:()=>c,q:()=>r});var a=n(27378),o=n(41763);const l=a.createContext(null);function r(e){let{children:t,version:n}=e;return a.createElement(l.Provider,{value:n},t)}function c(){const e=(0,a.useContext)(l);if(null===e)throw new o.i6("DocsVersionProvider");return e}}}]); \ No newline at end of file diff --git a/assets/js/1c420d1d.ba8ab86f.js b/assets/js/1c420d1d.ba8ab86f.js new file mode 100644 index 00000000000..fee468bea50 --- /dev/null +++ b/assets/js/1c420d1d.ba8ab86f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7336],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,c=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=l(r),y=i,d=u["".concat(p,".").concat(y)]||u[y]||f[y]||c;return r?n.createElement(d,a(a({ref:t},s),{},{components:r})):n.createElement(d,a({ref:t},s))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var c=r.length,a=new Array(c);a[0]=y;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,a[1]=o;for(var l=2;l<c;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},45845:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>f,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const c={pagination_prev:null,pagination_next:null,unlisted:!0},a="Tcp",o={unversionedId:"api/clients/tcp",id:"api/clients/tcp",title:"Tcp",description:"The TCP service is used internally by the runtime",source:"@site/docs/api/clients/tcp.md",sourceDirName:"api/clients",slug:"/api/clients/tcp",permalink:"/devicescript/api/clients/tcp",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},p={},l=[],s={toc:l},u="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"tcp"},"Tcp"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/tcp/"},"TCP service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1d820ac6.dcd93d58.js b/assets/js/1d820ac6.dcd93d58.js new file mode 100644 index 00000000000..cc386609c36 --- /dev/null +++ b/assets/js/1d820ac6.dcd93d58.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4008],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var u=n.createContext({}),p=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,u=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=i,f=c["".concat(u,".").concat(m)]||c[m]||d[m]||a;return r?n.createElement(f,o(o({ref:t},l),{},{components:r})):n.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=m;var s={};for(var u in t)hasOwnProperty.call(t,u)&&(s[u]=t[u]);s.originalType=e,s[c]="string"==typeof e?e:i,o[1]=s;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},36181:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Pressure Button service"},o="PressureButton",s={unversionedId:"api/clients/pressurebutton",id:"api/clients/pressurebutton",title:"PressureButton",description:"DeviceScript client for Pressure Button service",source:"@site/docs/api/clients/pressurebutton.md",sourceDirName:"api/clients",slug:"/api/clients/pressurebutton",permalink:"/devicescript/api/clients/pressurebutton",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Pressure Button service"},sidebar:"tutorialSidebar"},u={},p=[{value:"Registers",id:"registers",level:2},{value:"activeThreshold",id:"rw:activeThreshold",level:3}],l={toc:p},c="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(c,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"pressurebutton"},"PressureButton"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A pressure sensitive push-button."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { PressureButton } from "@devicescript/core"\n\nconst pressureButton = new PressureButton()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:activeThreshold"},"activeThreshold"),(0,i.kt)("p",null,"Indicates the threshold for ",(0,i.kt)("inlineCode",{parentName:"p"},"up")," events."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PressureButton } from "@devicescript/core"\n\nconst pressureButton = new PressureButton()\n// ...\nconst value = await pressureButton.activeThreshold.read()\nawait pressureButton.activeThreshold.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PressureButton } from "@devicescript/core"\n\nconst pressureButton = new PressureButton()\n// ...\npressureButton.activeThreshold.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1df93b7f.b42e492d.js b/assets/js/1df93b7f.b42e492d.js new file mode 100644 index 00000000000..7f5123da4c5 --- /dev/null +++ b/assets/js/1df93b7f.b42e492d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3237],{58100:(e,t,r)=>{r.d(t,{Z:()=>a});var i=r(27378);const n={borderRadius:"0.5rem",marginTop:"1rem",marginBottom:"1rem",maxHeight:"40rem",maxWidth:"40rem"};function a(e){const{name:t,style:r=n,webm:a}=e,l=(0,i.useRef)(null);return i.createElement("video",{ref:l,style:r,poster:`/devicescript/videos/${t}.jpg`,playsInline:!0,controls:!0,preload:"metadata"},i.createElement("source",{src:`/devicescript/videos/${t}.mp4`,type:"video/mp4"}),i.createElement("p",null,"Your browser doesn't support HTML video. Here is a",i.createElement("a",{href:`/devicescript/videos/${t}.mp4`},"link to the video")," ","instead."))}},33513:(e,t,r)=>{r.r(t),r.d(t,{default:()=>f});var i=r(27378),n=r(38944),a=r(81884),l=r(50353),o=r(20432),c=r(25773);const s={features:"features_t9lD",featureSvg:"featureSvg_GfXr"};function m(e){let{title:t,Svg:r,description:a,link:l}=e;return i.createElement("div",{className:(0,n.Z)("col col--4")},r&&i.createElement("div",{className:"text--center"},i.createElement(r,{className:s.featureSvg,role:"img"})),i.createElement("div",{className:"text--center padding-horiz--md"},i.createElement("h3",null,l?i.createElement("a",{href:l},t):t),i.createElement("p",null,a)))}function d(){return i.createElement("section",{className:s.features},i.createElement("div",{className:"container"},i.createElement("div",{className:"row"},[{title:"TypeScript for IoT",description:"The familiar syntax and tooling, all at your fingertips.",link:"/devicescript/language"},{title:"Small Runtime",description:"Bytecode interpreter for low power/flash/memory.",link:"/devicescript/devices"},{title:"Debugging",description:"In Visual Studio Code, for embedded hardware or simulated devices.",link:"/devicescript/getting-started/vscode/debugging"},{title:"Simulation and Testing",description:"Develop and test your firmware using hardware/mock sensors. CI friendly.",link:"/devicescript/developer/simulation"},{title:"Local and Remote Workspace",description:"Develop your firmware from your local machine or a remote container"},{title:"TypeScript Drivers",description:"Write drivers in TypeScript using I2C, SPI, ... without having to go down to C (limitations apply :) )",link:"/devicescript/developer/drivers"},{title:"ESP32, RP2040, ...",description:"Supported on popular microcontrollers. Portable to more...",link:"/devicescript/devices"},{title:"Networking",description:"fetch, TCP, TLS, HTTP/S, MQTT, ...",link:"/devicescript/developer/net"},{title:"Package Ecosystem",description:"Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages.",link:"/devicescript/developer/packages"}].map((e=>i.createElement(m,(0,c.Z)({key:e.title},e)))))))}const p={heroBanner:"heroBanner_qdFl",buttons:"buttons_AeoN"};var u=r(58100);const v={borderRadius:"0.5rem",marginTop:"2rem",maxHeight:"60vh",maxWidth:"60vw"};function g(){const{siteConfig:e}=(0,l.Z)();return i.createElement("header",{className:(0,n.Z)("hero hero--primary",p.heroBanner)},i.createElement("div",{className:"container"},i.createElement("h1",{className:"hero__title"},"Device",i.createElement("wbr",null),"Script"),i.createElement("p",{className:"hero__subtitle"},e.tagline),i.createElement("div",{className:p.buttons},i.createElement("div",{className:p.buttons},i.createElement(a.Z,{className:"button button--secondary button--lg",to:"/getting-started"},"Getting Started - 5min \u23f1\ufe0f"))),i.createElement("div",null,i.createElement(u.Z,{name:"blinky",style:v}))))}function f(){const{siteConfig:e}=(0,l.Z)();return i.createElement(o.Z,{title:e.title,description:e.tagline},i.createElement(g,null),i.createElement("main",null,i.createElement(d,null)))}}}]); \ No newline at end of file diff --git a/assets/js/1ebf7e3d.c116904a.js b/assets/js/1ebf7e3d.c116904a.js new file mode 100644 index 00000000000..09f0c95d832 --- /dev/null +++ b/assets/js/1ebf7e3d.c116904a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[490],{35318:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>N});var r=a(27378);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function i(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,r)}return a}function p(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?i(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function l(t,e){if(null==t)return{};var a,r,n=function(t,e){if(null==t)return{};var a,r,n={},i=Object.keys(t);for(r=0;r<i.length;r++)a=i[r],e.indexOf(a)>=0||(n[a]=t[a]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)a=i[r],e.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}var o=r.createContext({}),d=function(t){var e=r.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},s=function(t){var e=d(t.components);return r.createElement(o.Provider,{value:e},t.children)},m="mdxType",g={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},k=r.forwardRef((function(t,e){var a=t.components,n=t.mdxType,i=t.originalType,o=t.parentName,s=l(t,["components","mdxType","originalType","parentName"]),m=d(a),k=n,N=m["".concat(o,".").concat(k)]||m[k]||g[k]||i;return a?r.createElement(N,p(p({ref:e},s),{},{components:a})):r.createElement(N,p({ref:e},s))}));function N(t,e){var a=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=a.length,p=new Array(i);p[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[m]="string"==typeof t?t:n,p[1]=l;for(var d=2;d<i;d++)p[d]=a[d];return r.createElement.apply(null,p)}return r.createElement.apply(null,a)}k.displayName="MDXCreateElement"},54190:(t,e,a)=>{a.r(e),a.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=a(25773),n=(a(27378),a(35318));const i={description:"Espressif ESP32-S2 (bare)"},p="Espressif ESP32-S2 (bare)",l={unversionedId:"devices/esp32/esp32s2-bare",id:"devices/esp32/esp32s2-bare",title:"Espressif ESP32-S2 (bare)",description:"Espressif ESP32-S2 (bare)",source:"@site/docs/devices/esp32/esp32s2-bare.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32s2-bare",permalink:"/devicescript/devices/esp32/esp32s2-bare",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32-S2 (bare)"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32-C3-RUST-DevKit",permalink:"/devicescript/devices/esp32/esp32c3-rust-devkit"},next:{title:"Espressif ESP32-S3 (bare)",permalink:"/devicescript/devices/esp32/esp32s3-bare"}},o={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:d},m="wrapper";function g(t){let{components:e,...a}=t;return(0,n.kt)(m,(0,r.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"espressif-esp32-s2-bare"},"Espressif ESP32-S2 (bare)"),(0,n.kt)("p",null,"A bare ESP32-S2 board without any pin functions."),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Serial logging on pin P43 at 115200 8N1")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.espressif.com/en/products/socs/esp32-s2"},"https://www.espressif.com/en/products/socs/esp32-s2"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P11")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P12")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P15")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P16")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P17")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P33")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P34")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P35")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P36")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P37")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO37"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P38")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P39")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO39"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P40")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO40"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P41")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO41"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P42")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO42"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P43")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,n.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P44")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO44"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P45")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO45"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P46")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO46"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32-S2 (bare)".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32s2_bare"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32s2_bare\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-esp32s2_bare-0x1000.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32s2_bare.json"',title:'"esp32s2_bare.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32s2_bare",\n "devName": "Espressif ESP32-S2 (bare)",\n "productId": "0x3f140dcc",\n "$description": "A bare ESP32-S2 board without any pin functions.",\n "archId": "esp32s2",\n "url": "https://www.espressif.com/en/products/socs/esp32-s2",\n "log": {\n "pinTX": "P43"\n },\n "pins": {\n "P0": 0,\n "P1": 1,\n "P10": 10,\n "P11": 11,\n "P12": 12,\n "P13": 13,\n "P14": 14,\n "P15": 15,\n "P16": 16,\n "P17": 17,\n "P18": 18,\n "P2": 2,\n "P21": 21,\n "P3": 3,\n "P33": 33,\n "P34": 34,\n "P35": 35,\n "P36": 36,\n "P37": 37,\n "P38": 38,\n "P39": 39,\n "P4": 4,\n "P40": 40,\n "P41": 41,\n "P42": 42,\n "P43": 43,\n "P44": 44,\n "P45": 45,\n "P46": 46,\n "P5": 5,\n "P6": 6,\n "P7": 7,\n "P8": 8,\n "P9": 9\n }\n}\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1f829b5e.2fdd0e4b.js b/assets/js/1f829b5e.2fdd0e4b.js new file mode 100644 index 00000000000..6cfe49cec70 --- /dev/null +++ b/assets/js/1f829b5e.2fdd0e4b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5272],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),l=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,h=u["".concat(p,".").concat(m)]||u[m]||c[m]||i;return n?r.createElement(h,o(o({ref:t},d),{},{components:n})):r.createElement(h,o({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var l=2;l<i;l++)o[l]=n[l];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},39614:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=n(25773),a=(n(27378),n(35318));const i={sidebar_position:4.1,description:"Temperature logging to Adafruit.io using QT Py and SHCT3",hide_table_of_contents:!0},o="Temperature + MQTT",s={unversionedId:"samples/temperature-mqtt",id:"samples/temperature-mqtt",title:"Temperature + MQTT",description:"Temperature logging to Adafruit.io using QT Py and SHCT3",source:"@site/docs/samples/temperature-mqtt.mdx",sourceDirName:"samples",slug:"/samples/temperature-mqtt",permalink:"/devicescript/samples/temperature-mqtt",draft:!1,tags:[],version:"current",sidebarPosition:4.1,frontMatter:{sidebar_position:4.1,description:"Temperature logging to Adafruit.io using QT Py and SHCT3",hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"GitHub Build Status",permalink:"/devicescript/samples/github-build-status"},next:{title:"Homebridge + Humidity Sensor",permalink:"/devicescript/samples/homebridge-humidity"}},p={},l=[{value:"Reading temperature",id:"reading-temperature",level:2},{value:"Configuration and Secrets",id:"configuration-and-secrets",level:2},{value:"Starting the MQTT client",id:"starting-the-mqtt-client",level:2},{value:"Publish data",id:"publish-data",level:2},{value:"All together",id:"all-together",level:2},{value:"Extra points: Filtering data",id:"extra-points-filtering-data",level:2}],d={toc:l},u="wrapper";function c(e){let{components:t,...i}=e;return(0,a.kt)(u,(0,r.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"temperature--mqtt"},"Temperature + MQTT"),(0,a.kt)("p",null,"This sample uses an ESP32-C3 board ",(0,a.kt)("a",{parentName:"p",href:"/devices/esp32/adafruit-qt-py-c3"},"Adafruit QT Py C3"),"\nand a ",(0,a.kt)("a",{parentName:"p",href:"https://www.adafruit.com/product/4636"},"SHTC3 sensor")," to publish a temperature reading to\nthe ",(0,a.kt)("a",{parentName:"p",href:"https://io.adafruit.com/api/docs/"},"Adafruit.io MQTT APIs")," every minute."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"A photograph of the Adafruit QT Py and SHTC3 breakout",src:n(988).Z,width:"1024",height:"576"})),(0,a.kt)("h2",{id:"reading-temperature"},"Reading temperature"),(0,a.kt)("p",null,"We start by configuring the script for the QT Py and adding a scheduled interval to read the temperature\nfrom the SHTC3 sensor every 60 seconds."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'// hardware configuration and drivers\nimport "@dsboard/adafruit_qt_py_c3"\nimport { startSHTC3 } from "@devicescript/drivers"\nimport { schedule } from "@devicescript/runtime"\n\n// mounting a temperature server for the SHTC3 sensor\nconst { temperature } = await startSHTC3()\n\nschedule(\n async () => {\n // read data from temperature sensor\n const value = await temperature.reading.read()\n },\n { timeout: 1000, interval: 60000 }\n)\n')),(0,a.kt)("h2",{id:"configuration-and-secrets"},"Configuration and Secrets"),(0,a.kt)("p",null,"To connect to Adafruit.io, you will to get an account with ",(0,a.kt)("a",{parentName:"p",href:"https://io.adafruit.com"},"https://io.adafruit.com"),"\nand store your username and password in the ",(0,a.kt)("a",{parentName:"p",href:"/developer/settings"},"settings"),"\nas the ",(0,a.kt)("inlineCode",{parentName:"p"},"IO_USERNAME")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"IO_KEY")," keys (make sure your key is in ",(0,a.kt)("inlineCode",{parentName:"p"},"env.local"),").\nAlso create a feed and update the feed key in the example below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'// highlight-next-line\nimport { readSetting } from "@devicescript/settings"\n\n// TODO: update feed key\nconst feed = "temperature"\n// highlight-next-line\nconst username = await readSetting("IO_USERNAME")\n// this secret is stored in the .env.local and uploaded to the device settings\n// highlight-next-line\nconst password = await readSetting("IO_KEY")\n')),(0,a.kt)("h2",{id:"starting-the-mqtt-client"},"Starting the MQTT client"),(0,a.kt)("p",null,"Following the ",(0,a.kt)("a",{parentName:"p",href:"https://io.adafruit.com/api/docs/mqtt.html#feed-topic-format"},"Adafruit documentation"),",\nwe start a MQTT connection and craft a topic that will route the data to our account."),(0,a.kt)("p",null,"In the "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'// highlight-next-line\nimport { startMQTTClient } from "@devicescript/net"\n\n...\n\n// highlight-start\nconst mqtt = await startMQTTClient({\n host: `io.adafruit.com`,\n proto: "tls",\n port: 8883,\n username,\n password,\n})\nconst topic = `${username}/feeds/${feed}/json`\n// highlight-end\n')),(0,a.kt)("h2",{id:"publish-data"},"Publish data"),(0,a.kt)("p",null,"With the MQTT client and the topic, we can add a call to ",(0,a.kt)("inlineCode",{parentName:"p"},"mqtt.publish")," in the scheduled worker\nto upload the data to Adafruit (note that ",(0,a.kt)("inlineCode",{parentName:"p"},"{ value }")," expands to JSON ",(0,a.kt)("inlineCode",{parentName:"p"},'{ "value": value }')," automatically)"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"schedule(\n async () => { \n ...\n // publish data to Adafruit\n // highlight-next-line\n await mqtt.publish(topic, { value })\n },\n { timeout: 1000, interval: 60000 }\n)\n")),(0,a.kt)("h2",{id:"all-together"},"All together"),(0,a.kt)("p",null,"Putting all the pieces together we get the following program."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'// hardware configuration and drivers\nimport "@dsboard/adafruit_qt_py_c3"\nimport { startSHTC3 } from "@devicescript/drivers"\nimport { startMQTTClient } from "@devicescript/net"\n// extra APIs\nimport { readSetting } from "@devicescript/settings"\nimport { schedule } from "@devicescript/runtime"\n\n// mounting a temperature server for the SHTC3 sensor\nconst { temperature } = await startSHTC3()\n\n// update feed key\nconst feed = "temperature"\nconst username = await readSetting("IO_USERNAME")\n// this secret is stored in the .env.local and uploaded to the device settings\nconst password = await readSetting("IO_KEY")\n\nconst mqtt = await startMQTTClient({\n host: `io.adafruit.com`,\n proto: "tls",\n port: 8883,\n username,\n password,\n})\n// https://io.adafruit.com/api/docs/mqtt.html#feed-topic-format\nconst topic = `${username}/feeds/${feed}/json`\n\nschedule(\n async () => {\n // read data from temperature sensor\n const value = await temperature.reading.read()\n // publish to feed topic\n await mqtt.publish(topic, { value })\n },\n { timeout: 1000, interval: 60000 }\n)\n')),(0,a.kt)("h2",{id:"extra-points-filtering-data"},"Extra points: Filtering data"),(0,a.kt)("p",null,"You could use ",(0,a.kt)("a",{parentName:"p",href:"/developer/observables"},"observables")," to smooth the sensor\ndata. For example, apply an exponentially moving average\non the feed of temperature readings."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ewma, auditTime } from "@devicescript/observables"\n...\ntemperature.reading\n .pipe(ewma(0.5), auditTime(60000))\n .subscribe(async value => await mqtt.publish(topic, { value }))\n')))}c.isMDXComponent=!0},988:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/temperature-mqtt-66b380e4e9c8659f93f2571bc8672633.jpg"}}]); \ No newline at end of file diff --git a/assets/js/204e02b7.a5060607.js b/assets/js/204e02b7.a5060607.js new file mode 100644 index 00000000000..442097c092f --- /dev/null +++ b/assets/js/204e02b7.a5060607.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[162],{35318:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>v});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=n.createContext({}),p=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},s=function(e){var r=p(e.components);return n.createElement(l.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(t),f=i,v=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return t?n.createElement(v,a(a({ref:r},s),{},{components:t})):n.createElement(v,a({ref:r},s))}));function v(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var o=t.length,a=new Array(o);a[0]=f;var c={};for(var l in r)hasOwnProperty.call(r,l)&&(c[l]=r[l]);c.originalType=e,c[d]="string"==typeof e?e:i,a[1]=c;for(var p=2;p<o;p++)a[p]=t[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"},7472:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>p});var n=t(25773),i=(t(27378),t(35318));const o={title:"Serial",sidebar_position:100},a="Serial",c={unversionedId:"developer/drivers/serial",id:"developer/drivers/serial",title:"Serial",description:"Serial drivers are not supported yet in DeviceScript, but can be added in the C firmware SDK.",source:"@site/docs/developer/drivers/serial.mdx",sourceDirName:"developer/drivers",slug:"/developer/drivers/serial",permalink:"/devicescript/developer/drivers/serial",draft:!1,tags:[],version:"current",sidebarPosition:100,frontMatter:{title:"Serial",sidebar_position:100},sidebar:"tutorialSidebar",previous:{title:"I2C",permalink:"/devicescript/developer/drivers/i2c"},next:{title:"Custom Services",permalink:"/devicescript/developer/drivers/custom-services"}},l={},p=[],s={toc:p},d="wrapper";function u(e){let{components:r,...t}=e;return(0,i.kt)(d,(0,n.Z)({},s,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"serial"},"Serial"),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Serial drivers are not supported yet in DeviceScript, but can be added in the C firmware SDK.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2188eaab.d157c268.js b/assets/js/2188eaab.d157c268.js new file mode 100644 index 00000000000..1a1db5d8abc --- /dev/null +++ b/assets/js/2188eaab.d157c268.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2643],{35318:(e,i,I)=>{I.d(i,{Zo:()=>r,kt:()=>Z});var t=I(27378);function b(e,i,I){return i in e?Object.defineProperty(e,i,{value:I,enumerable:!0,configurable:!0,writable:!0}):e[i]=I,e}function a(e,i){var I=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);i&&(t=t.filter((function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable}))),I.push.apply(I,t)}return I}function l(e){for(var i=1;i<arguments.length;i++){var I=null!=arguments[i]?arguments[i]:{};i%2?a(Object(I),!0).forEach((function(i){b(e,i,I[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(I)):a(Object(I)).forEach((function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(I,i))}))}return e}function m(e,i){if(null==e)return{};var I,t,b=function(e,i){if(null==e)return{};var I,t,b={},a=Object.keys(e);for(t=0;t<a.length;t++)I=a[t],i.indexOf(I)>=0||(b[I]=e[I]);return b}(e,i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)I=a[t],i.indexOf(I)>=0||Object.prototype.propertyIsEnumerable.call(e,I)&&(b[I]=e[I])}return b}var s=t.createContext({}),n=function(e){var i=t.useContext(s),I=i;return e&&(I="function"==typeof e?e(i):l(l({},i),e)),I},r=function(e){var i=n(e.components);return t.createElement(s.Provider,{value:i},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var i=e.children;return t.createElement(t.Fragment,{},i)}},o=t.forwardRef((function(e,i){var I=e.components,b=e.mdxType,a=e.originalType,s=e.parentName,r=m(e,["components","mdxType","originalType","parentName"]),c=n(I),o=b,Z=c["".concat(s,".").concat(o)]||c[o]||d[o]||a;return I?t.createElement(Z,l(l({ref:i},r),{},{components:I})):t.createElement(Z,l({ref:i},r))}));function Z(e,i){var I=arguments,b=i&&i.mdxType;if("string"==typeof e||b){var a=I.length,l=new Array(a);l[0]=o;var m={};for(var s in i)hasOwnProperty.call(i,s)&&(m[s]=i[s]);m.originalType=e,m[c]="string"==typeof e?e:b,l[1]=m;for(var n=2;n<a;n++)l[n]=I[n];return t.createElement.apply(null,l)}return t.createElement.apply(null,I)}o.displayName="MDXCreateElement"},9345:(e,i,I)=>{I.r(i),I.d(i,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>a,metadata:()=>m,toc:()=>n});var t=I(25773),b=(I(27378),I(35318));const a={title:"Observables",sidebar_position:4.5,description:"The @devicescript/observables builtin package provides a lightweight reactive observable framework, a limited subset of RxJS. Learn how to use observables in DeviceScript to listen for data and filter out small data changes."},l="Observables",m={unversionedId:"developer/observables",id:"developer/observables",title:"Observables",description:"The @devicescript/observables builtin package provides a lightweight reactive observable framework, a limited subset of RxJS. Learn how to use observables in DeviceScript to listen for data and filter out small data changes.",source:"@site/docs/developer/observables.mdx",sourceDirName:"developer",slug:"/developer/observables",permalink:"/devicescript/developer/observables",draft:!1,tags:[],version:"current",sidebarPosition:4.5,frontMatter:{title:"Observables",sidebar_position:4.5,description:"The @devicescript/observables builtin package provides a lightweight reactive observable framework, a limited subset of RxJS. Learn how to use observables in DeviceScript to listen for data and filter out small data changes."},sidebar:"tutorialSidebar",previous:{title:"JSON",permalink:"/devicescript/developer/json"},next:{title:"Settings and Secrets",permalink:"/devicescript/developer/settings"}},s={},n=[{value:"Motivation",id:"motivation",level:2},{value:"See also",id:"see-also",level:2}],r={toc:n},c="wrapper";function d(e){let{components:i,...a}=e;return(0,b.kt)(c,(0,t.Z)({},r,a,{components:i,mdxType:"MDXLayout"}),(0,b.kt)("h1",{id:"observables"},"Observables"),(0,b.kt)("p",null,"The ",(0,b.kt)("inlineCode",{parentName:"p"},"@devicescript/observables")," ",(0,b.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," provides a lightweight reactive observable framework, a limited subset of ",(0,b.kt)("a",{parentName:"p",href:"https://rxjs.dev"},"RxJS"),".\nWe highly recommend reviewing the RxJS documentation for deeper discussions about observables."),(0,b.kt)("h2",{id:"motivation"},"Motivation"),(0,b.kt)("p",null,"Imagine a temperature sensor, it routinely senses the temperature and updates the ",(0,b.kt)("inlineCode",{parentName:"p"},"temperature")," register.\n",(0,b.kt)("strong",{parentName:"p"},"The temperature register is an observable of sensor reading.")),(0,b.kt)("p",null,"If you write code in DeviceScript to listen for this data, it will look like this:"),(0,b.kt)("pre",null,(0,b.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Temperature } from "@devicescript/clients"\n\nconst thermometer = new Temperature()\nconst { temperature } = thermometer\n// highlight-next-line\ntemperature.subscribe(temp => console.log(temp))\n')),(0,b.kt)("p",null,"In particular, the handler passed to ",(0,b.kt)("inlineCode",{parentName:"p"},"subscribe")," will be called whenever a new temperature reading is received (even if it did not change).\nThe program would print something like this:"),(0,b.kt)("pre",null,(0,b.kt)("code",{parentName:"pre",className:"language-console"},"20\n21\n21\n20\n")),(0,b.kt)("p",null,"A better way to visualize streams of data and how observable handle them is to use a marble diagram.\nThe input stream (on top) arrives unchanged to the subscribe handler and is printed to the console."),(0,b.kt)("img",{alt:"output.svg",src:I(1851).Z,width:"312",height:"260"}),(0,b.kt)("p",null,"As you can see, there are 2 data readings with the same temperature and we would like to filter them out. Using the ",(0,b.kt)("inlineCode",{parentName:"p"},"threshold")," operator,\nwhich filters out small data changes, we get"),(0,b.kt)("pre",null,(0,b.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Temperature } from "@devicescript/clients"\n// highlight-next-line\nimport { threshold } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\nconst { temperature } = thermometer\ntemperature\n // highlight-next-line\n .pipe(threshold(1))\n .subscribe(temp => console.log(temp))\n')),(0,b.kt)("img",{alt:"output.svg",src:I(54334).Z,width:"312",height:"260"}),(0,b.kt)("p",null,"Operators can be chained and combined to create complex data processing pipelines. Custom operators can also be defining by combining existing ones\nor writing them from bare code."),(0,b.kt)("h2",{id:"see-also"},"See also"),(0,b.kt)("ul",null,(0,b.kt)("li",{parentName:"ul"},(0,b.kt)("a",{parentName:"li",href:"/api/observables/"},"API reference"))))}d.isMDXComponent=!0},54334:(e,i,I)=>{I.d(i,{Z:()=>t});const t="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMTIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjYwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjI1MCwxOS4yMjY0OTczMDgxMDM3NDIgMjYwLDI1IDI1MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDYwLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjA8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEzMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTEsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yMTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDExLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjE8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCg2MCwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjIwPC90ZXh0PjwvZz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA3MCkiPjxyZWN0IHg9IjEiIHk9IjExIiB3aWR0aD0iMjYwLjMwOTQwMTA3Njc1ODUiIGhlaWdodD0iNDgiIGZpbGw9IndoaXRlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHJ4PSIwIi8+PHRleHQgeD0iMTMxLjE1NDcwMDUzODM3OTI1IiB5PSIzNSIgZmlsbD0iYmxhY2siIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjI0cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgd2lkdGg9IjI2Mi4zMDk0MDEwNzY3NTg1Ij50aHJlc2hvbGQoMSk8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMTYwKSI+PGc+PGxpbmUgeDE9IjAiIHkxPSIyNSIgeDI9IjI2MCIgeTI9IjI1IiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48cG9seWxpbmUgcG9pbnRzPSIyNTAsMTkuMjI2NDk3MzA4MTAzNzQyIDI2MCwyNSAyNTAsMzAuNzczNTAyNjkxODk2MjU4IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiLz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTkwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCg2MCwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjIwPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTEsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yMTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDYwLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjA8L3RleHQ+PC9nPjwvZz48L2c+PC9zdmc+"},1851:(e,i,I)=>{I.d(i,{Z:()=>t});const t="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMTIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjYwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjI1MCwxOS4yMjY0OTczMDgxMDM3NDIgMjYwLDI1IDI1MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDYwLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjA8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEzMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTEsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yMTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDExLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjE8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCg2MCwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjIwPC90ZXh0PjwvZz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA3MCkiPjxyZWN0IHg9IjEiIHk9IjExIiB3aWR0aD0iMjYwLjMwOTQwMTA3Njc1ODUiIGhlaWdodD0iNDgiIGZpbGw9IndoaXRlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHJ4PSIwIi8+PHRleHQgeD0iMTMxLjE1NDcwMDUzODM3OTI1IiB5PSIzNSIgZmlsbD0iYmxhY2siIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjI0cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgd2lkdGg9IjI2Mi4zMDk0MDEwNzY3NTg1Ij5zdWJzY3JpYmUoLi4uKTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxNjApIj48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjYwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjI1MCwxOS4yMjY0OTczMDgxMDM3NDIgMjYwLDI1IDI1MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDYwLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjA8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEzMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTEsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yMTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDExLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjE8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCg2MCwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjIwPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="}}]); \ No newline at end of file diff --git a/assets/js/22021e31.7dc463f3.js b/assets/js/22021e31.7dc463f3.js new file mode 100644 index 00000000000..68e4b0c9c41 --- /dev/null +++ b/assets/js/22021e31.7dc463f3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6143],{35318:(t,e,r)=>{r.d(e,{Zo:()=>d,kt:()=>g});var a=r(27378);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){if(null==t)return{};var r,a,n=function(t,e){if(null==t)return{};var r,a,n={},i=Object.keys(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var s=a.createContext({}),l=function(t){var e=a.useContext(s),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},d=function(t){var e=l(t.components);return a.createElement(s.Provider,{value:e},t.children)},c="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var r=t.components,n=t.mdxType,i=t.originalType,s=t.parentName,d=o(t,["components","mdxType","originalType","parentName"]),c=l(r),u=n,g=c["".concat(s,".").concat(u)]||c[u]||m[u]||i;return r?a.createElement(g,p(p({ref:e},d),{},{components:r})):a.createElement(g,p({ref:e},d))}));function g(t,e){var r=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=r.length,p=new Array(i);p[0]=u;var o={};for(var s in e)hasOwnProperty.call(e,s)&&(o[s]=e[s]);o.originalType=t,o[c]="string"==typeof t?t:n,p[1]=o;for(var l=2;l<i;l++)p[l]=r[l];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}u.displayName="MDXCreateElement"},47673:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var a=r(25773),n=(r(27378),r(35318));const i={description:"Espressif ESP32-C3 (bare)"},p="Espressif ESP32-C3 (bare)",o={unversionedId:"devices/esp32/esp32c3-bare",id:"devices/esp32/esp32c3-bare",title:"Espressif ESP32-C3 (bare)",description:"Espressif ESP32-C3 (bare)",source:"@site/docs/devices/esp32/esp32c3-bare.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32c3-bare",permalink:"/devicescript/devices/esp32/esp32c3-bare",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32-C3 (bare)"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32-DevKitC",permalink:"/devicescript/devices/esp32/esp32-devkit-c"},next:{title:"Espressif ESP32-C3-RUST-DevKit",permalink:"/devicescript/devices/esp32/esp32c3-rust-devkit"}},s={},l=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:l},c="wrapper";function m(t){let{components:e,...r}=t;return(0,n.kt)(c,(0,a.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"espressif-esp32-c3-bare"},"Espressif ESP32-C3 (bare)"),(0,n.kt)("p",null,"A bare ESP32-C3 board without any pin functions."),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Serial logging on pin P21 at 115200 8N1"),(0,n.kt)("li",{parentName:"ul"},"Service: buttonBOOT (button)")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.espressif.com/en/products/socs/esp32-c3"},"https://www.espressif.com/en/products/socs/esp32-c3"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P20")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,n.kt)("td",{parentName:"tr",align:"right"},"bootUart, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, bootUart, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"$services.buttonBOOT","[0]",".pin, boot, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32-C3 (bare)".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32c3_bare"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32c3_bare\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_bare-0x0.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32c3_bare.json"',title:'"esp32c3_bare.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32c3_bare",\n "devName": "Espressif ESP32-C3 (bare)",\n "productId": "0x3a1d89be",\n "$description": "A bare ESP32-C3 board without any pin functions.",\n "archId": "esp32c3",\n "url": "https://www.espressif.com/en/products/socs/esp32-c3",\n "$services": [\n {\n "name": "buttonBOOT",\n "pin": "P9",\n "service": "button"\n }\n ],\n "log": {\n "pinTX": "P21"\n },\n "pins": {\n "P0": 0,\n "P1": 1,\n "P10": 10,\n "P2": 2,\n "P20": 20,\n "P21": 21,\n "P3": 3,\n "P4": 4,\n "P5": 5,\n "P6": 6,\n "P7": 7,\n "P8": 8,\n "P9": 9\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/22820bcb.1f65b4f3.js b/assets/js/22820bcb.1f65b4f3.js new file mode 100644 index 00000000000..2ce5b882771 --- /dev/null +++ b/assets/js/22820bcb.1f65b4f3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6644],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>h});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(r),f=i,h=u["".concat(s,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(h,o(o({ref:t},l),{},{components:r})):n.createElement(h,o({ref:t},l))}));function h(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[u]="string"==typeof e?e:i,o[1]=c;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},30121:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={description:"Mounts a switch server",title:"Switch"},o="Switch",c={unversionedId:"api/drivers/switch",id:"api/drivers/switch",title:"Switch",description:"Mounts a switch server",source:"@site/docs/api/drivers/switch.md",sourceDirName:"api/drivers",slug:"/api/drivers/switch",permalink:"/devicescript/api/drivers/switch",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a switch server",title:"Switch"},sidebar:"tutorialSidebar",previous:{title:"ST7735, ILI9163, ST7789",permalink:"/devicescript/api/drivers/st7789"},next:{title:"Traffic Light",permalink:"/devicescript/api/drivers/trafficlight"}},s={},p=[{value:"Options",id:"options",level:2},{value:"pin",id:"pin",level:3},{value:"options",id:"options-1",level:3}],l={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"switch"},"Switch"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startSwitch")," function starts a ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/switch"},"switch")," server on the device\nand returns a ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/switch"},"client"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startSwitch } from "@devicescript/servers"\n\nconst sw = startSwitch({\n pin: gpio(2),\n})\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"switch"),"."),(0,i.kt)("h2",{id:"options"},"Options"),(0,i.kt)("h3",{id:"pin"},"pin"),(0,i.kt)("p",null,"The pin hardware identifier on which to mount the relay."),(0,i.kt)("h3",{id:"options-1"},"options"),(0,i.kt)("p",null,"Other configuration options are available in the options parameter."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/236f6b2e.cfe9bb7e.js b/assets/js/236f6b2e.cfe9bb7e.js new file mode 100644 index 00000000000..c9645d35355 --- /dev/null +++ b/assets/js/236f6b2e.cfe9bb7e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6140],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=i,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,l(l({ref:t},s),{},{components:n})):r.createElement(f,l({ref:t},s))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=m;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[d]="string"==typeof e?e:i,l[1]=o;for(var p=2;p<a;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},1561:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Reflected light service"},l="ReflectedLight",o={unversionedId:"api/clients/reflectedlight",id:"api/clients/reflectedlight",title:"ReflectedLight",description:"DeviceScript client for Reflected light service",source:"@site/docs/api/clients/reflectedlight.md",sourceDirName:"api/clients",slug:"/api/clients/reflectedlight",permalink:"/devicescript/api/clients/reflectedlight",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Reflected light service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"reflectedlight"},"ReflectedLight"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A sensor that detects light and dark surfaces, commonly used for line following robots."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { ReflectedLight } from "@devicescript/core"\n\nconst reflectedLight = new ReflectedLight()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"Reports the reflected brightness. It may be a digital value or, for some sensor, analog value."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ReflectedLight } from "@devicescript/core"\n\nconst reflectedLight = new ReflectedLight()\n// ...\nconst value = await reflectedLight.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ReflectedLight } from "@devicescript/core"\n\nconst reflectedLight = new ReflectedLight()\n// ...\nreflectedLight.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Type of physical sensor used"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ReflectedLight } from "@devicescript/core"\n\nconst reflectedLight = new ReflectedLight()\n// ...\nconst value = await reflectedLight.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/23719d77.5c86c1bf.js b/assets/js/23719d77.5c86c1bf.js new file mode 100644 index 00000000000..5c04e9714f7 --- /dev/null +++ b/assets/js/23719d77.5c86c1bf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2214],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=i.createContext({}),s=function(e){var t=i.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return i.createElement(u.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,u=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=s(n),d=r,h=p["".concat(u,".").concat(d)]||p[d]||m[d]||a;return n?i.createElement(h,l(l({ref:t},c),{},{components:n})):i.createElement(h,l({ref:t},c))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[p]="string"==typeof e?e:r,l[1]=o;for(var s=2;s<a;s++)l[s]=n[s];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}d.displayName="MDXCreateElement"},55573:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var i=n(25773),r=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Multitouch service"},l="Multitouch",o={unversionedId:"api/clients/multitouch",id:"api/clients/multitouch",title:"Multitouch",description:"DeviceScript client for Multitouch service",source:"@site/docs/api/clients/multitouch.md",sourceDirName:"api/clients",slug:"/api/clients/multitouch",permalink:"/devicescript/api/clients/multitouch",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Multitouch service"},sidebar:"tutorialSidebar"},u={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"Events",id:"events",level:2},{value:"touch",id:"touch",level:3},{value:"release",id:"release",level:3},{value:"tap",id:"tap",level:3},{value:"longPress",id:"longpress",level:3},{value:"swipePos",id:"swipepos",level:3},{value:"swipeNeg",id:"swipeneg",level:3}],c={toc:s},p="wrapper";function m(e){let{components:t,...n}=e;return(0,r.kt)(p,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"multitouch"},"Multitouch"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"A capacitive touch sensor with multiple inputs."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Multitouch } from "@devicescript/core"\n\nconst multitouch = new Multitouch()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"Capacitance of channels. The capacitance is continuously calibrated, and a value of ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," indicates\nno touch, wheres a value of around ",(0,r.kt)("inlineCode",{parentName:"p"},"100")," or more indicates touch.\nIt's best to ignore this (unless debugging), and use events."),(0,r.kt)("p",null,"Digital sensors will use ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"0xffff")," on each channel."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"r: i16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"track incoming values"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Multitouch } from "@devicescript/core"\n\nconst multitouch = new Multitouch()\n// ...\nmultitouch.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h2",{id:"events"},"Events"),(0,r.kt)("h3",{id:"touch"},"touch"),(0,r.kt)("p",null,"Emitted when an input is touched."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"multitouch.touch.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"release"},"release"),(0,r.kt)("p",null,"Emitted when an input is no longer touched."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"multitouch.release.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"tap"},"tap"),(0,r.kt)("p",null,"Emitted when an input is briefly touched. TODO Not implemented."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"multitouch.tap.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"longpress"},"longPress"),(0,r.kt)("p",null,"Emitted when an input is touched for longer than 500ms. TODO Not implemented."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"multitouch.longPress.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"swipepos"},"swipePos"),(0,r.kt)("p",null,"Emitted when input channels are successively touched in order of increasing channel numbers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"multitouch.swipePos.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"swipeneg"},"swipeNeg"),(0,r.kt)("p",null,"Emitted when input channels are successively touched in order of decreasing channel numbers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"multitouch.swipeNeg.subscribe(() => {\n\n})\n")),(0,r.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/255d1f03.8a723e44.js b/assets/js/255d1f03.8a723e44.js new file mode 100644 index 00000000000..365ac033012 --- /dev/null +++ b/assets/js/255d1f03.8a723e44.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2579],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>d});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(r),f=a,d=u["".concat(s,".").concat(f)]||u[f]||m[f]||i;return r?n.createElement(d,o(o({ref:t},l),{},{components:r})):n.createElement(d,o({ref:t},l))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[u]="string"==typeof e?e:a,o[1]=c;for(var p=2;p<i;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},35229:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=r(25773),a=(r(27378),r(35318));const i={sidebar_position:10},o="Math",c={unversionedId:"api/math",id:"api/math",title:"Math",description:"Most typical JavaScript Math function are supported. Please file an issue if we missed one.",source:"@site/docs/api/math.mdx",sourceDirName:"api",slug:"/api/math",permalink:"/devicescript/api/math",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10},sidebar:"tutorialSidebar",previous:{title:"Wssk",permalink:"/devicescript/api/clients/wssk"},next:{title:"Drivers",permalink:"/devicescript/api/drivers/"}},s={},p=[{value:"Math.map",id:"mathmap",level:2},{value:"Math.constrain",id:"mathconstrain",level:2}],l={toc:p},u="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"math"},"Math"),(0,a.kt)("p",null,"Most typical JavaScript Math function are supported. Please file an issue if we missed one."),(0,a.kt)("h2",{id:"mathmap"},"Math.map"),(0,a.kt)("p",null,"Maps a value between two ranges."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const ratio = 0.5 // [0, 1]\nconst percent = Math.map(ratio, 0, 1, 0, 100)\n")),(0,a.kt)("h2",{id:"mathconstrain"},"Math.constrain"),(0,a.kt)("p",null,"Constrains a value between two values."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const v = -0.1 // [0, 1]\nconst c = Math.constrain(v, 0, 1)\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/25856b02.d64845d7.js b/assets/js/25856b02.d64845d7.js new file mode 100644 index 00000000000..ae3c2618c8a --- /dev/null +++ b/assets/js/25856b02.d64845d7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2412],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=c(r),d=a,f=u["".concat(p,".").concat(d)]||u[d]||m[d]||o;return r?n.createElement(f,l(l({ref:t},s),{},{components:r})):n.createElement(f,l({ref:t},s))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var c=2;c<o;c++)l[c]=r[c];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},28843:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(25773),a=(r(27378),r(35318));const o={},l="Palette",i={unversionedId:"api/runtime/palette",id:"api/runtime/palette",title:"Palette",description:"A fixed length color palette.",source:"@site/docs/api/runtime/palette.mdx",sourceDirName:"api/runtime",slug:"/api/runtime/palette",permalink:"/devicescript/api/runtime/palette",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Runtime",permalink:"/devicescript/api/runtime/"},next:{title:"PixelBuffer",permalink:"/devicescript/api/runtime/pixelbuffer"}},p={},c=[{value:"<code>at</code>, <code>setAt</code>",id:"at-setat",level:2},{value:"<code>interpolateColor</code>",id:"interpolatecolor",level:2},{value:"<code>correctGamma</code>",id:"correctgamma",level:2}],s={toc:c},u="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"palette"},"Palette"),(0,a.kt)("p",null,"A fixed length color palette."),(0,a.kt)("p",null,"Palette are used with ",(0,a.kt)("a",{parentName:"p",href:"/developer/graphics/display"},"displays"),"\nto keep the storage needed for images low. They can also be used with ",(0,a.kt)("a",{parentName:"p",href:"/developer/leds"},"LEDs"),"\nto create multi-color gradients."),(0,a.kt)("h2",{id:"at-setat"},(0,a.kt)("inlineCode",{parentName:"h2"},"at"),", ",(0,a.kt)("inlineCode",{parentName:"h2"},"setAt")),(0,a.kt)("p",null,"These function allow to lookup and update the color of palette at indices."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Palette } from "@devicescript/graphics"\n\nconst palette = Palette.arcade()\n\n// lookup color\n// highlight-next-line\nconst c = palette.at(2)\n\n// update color\n// highlight-next-line\npalette.setAt(2, 0x00_00_ff)\n')),(0,a.kt)("h2",{id:"interpolatecolor"},(0,a.kt)("inlineCode",{parentName:"h2"},"interpolateColor")),(0,a.kt)("p",null,"Interpolates a ",(0,a.kt)("inlineCode",{parentName:"p"},"[0, 1]")," value into a color of the palette, regarless of the palette size."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Palette } from "@devicescript/graphics"\nimport { interpolateColor } from "@devicescript/runtime"\n\nconst palette = Palette.arcade()\n\n// highlight-next-line\nconst c = interpolateColor(palette, 0.5)\n')),(0,a.kt)("h2",{id:"correctgamma"},(0,a.kt)("inlineCode",{parentName:"h2"},"correctGamma")),(0,a.kt)("p",null,"For palette used with LEDs, you can preapply gamma correction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Palette } from "@devicescript/graphics"\nimport { correctGamma } from "@devicescript/runtime"\n\nconst palette = Palette.arcade()\n// highlight-next-line\ncorrectGamma(palette)\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/26effb06.ad431031.js b/assets/js/26effb06.ad431031.js new file mode 100644 index 00000000000..2e86ad73126 --- /dev/null +++ b/assets/js/26effb06.ad431031.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3598],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=l(r),d=i,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||o;return r?n.createElement(m,a(a({ref:t},s),{},{components:r})):n.createElement(m,a({ref:t},s))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:i,a[1]=c;for(var l=2;l<o;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},70339:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>f,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for ROS service"},a="Ros",c={unversionedId:"api/clients/ros",id:"api/clients/ros",title:"Ros",description:"DeviceScript client for ROS service",source:"@site/docs/api/clients/ros.md",sourceDirName:"api/clients",slug:"/api/clients/ros",permalink:"/devicescript/api/clients/ros",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for ROS service"},sidebar:"tutorialSidebar"},p={},l=[],s={toc:l},u="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ros"},"Ros"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/ros/"},"ROS service")," is used internally by the\n",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},(0,i.kt)("inlineCode",{parentName:"a"},"@devicescript/ros"))," package."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2785e21a.dad615c3.js b/assets/js/2785e21a.dad615c3.js new file mode 100644 index 00000000000..a6607f3cae6 --- /dev/null +++ b/assets/js/2785e21a.dad615c3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6474],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>k});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(r),d=i,k=u["".concat(p,".").concat(d)]||u[d]||m[d]||a;return r?n.createElement(k,l(l({ref:t},c),{},{components:r})):n.createElement(k,l({ref:t},c))}));function k(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,l=new Array(a);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var s=2;s<a;s++)l[s]=r[s];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},51403:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var n=r(25773),i=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Pulse Oximeter service"},l="PulseOximeter",o={unversionedId:"api/clients/pulseoximeter",id:"api/clients/pulseoximeter",title:"PulseOximeter",description:"DeviceScript client for Pulse Oximeter service",source:"@site/docs/api/clients/pulseoximeter.md",sourceDirName:"api/clients",slug:"/api/clients/pulseoximeter",permalink:"/devicescript/api/clients/pulseoximeter",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Pulse Oximeter service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3}],c={toc:s},u="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"pulseoximeter"},"PulseOximeter"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A sensor approximating the oxygen level."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Jacdac is not suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.")),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { PulseOximeter } from "@devicescript/core"\n\nconst pulseOximeter = new PulseOximeter()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The estimated oxygen level in blood."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PulseOximeter } from "@devicescript/core"\n\nconst pulseOximeter = new PulseOximeter()\n// ...\nconst value = await pulseOximeter.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PulseOximeter } from "@devicescript/core"\n\nconst pulseOximeter = new PulseOximeter()\n// ...\npulseOximeter.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"The estimated error on the reported sensor data."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PulseOximeter } from "@devicescript/core"\n\nconst pulseOximeter = new PulseOximeter()\n// ...\nconst value = await pulseOximeter.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PulseOximeter } from "@devicescript/core"\n\nconst pulseOximeter = new PulseOximeter()\n// ...\npulseOximeter.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/27971726.4ae51102.js b/assets/js/27971726.4ae51102.js new file mode 100644 index 00000000000..200f821b861 --- /dev/null +++ b/assets/js/27971726.4ae51102.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6468],{35318:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(27378);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){o(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),c=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=c(e.components);return n.createElement(l.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(t),f=o,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||a;return t?n.createElement(m,i(i({ref:r},p),{},{components:t})):n.createElement(m,i({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=f;var s={};for(var l in r)hasOwnProperty.call(r,l)&&(s[l]=r[l]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var c=2;c<a;c++)i[c]=t[c];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"},33359:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=t(25773),o=(t(27378),t(35318));const a={description:"Mounts a Hall sensor",title:"Hall sensor"},i="Hall sensor",s={unversionedId:"api/drivers/hall",id:"api/drivers/hall",title:"Hall sensor",description:"Mounts a Hall sensor",source:"@site/docs/api/drivers/hall.md",sourceDirName:"api/drivers",slug:"/api/drivers/hall",permalink:"/devicescript/api/drivers/hall",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a Hall sensor",title:"Hall sensor"},sidebar:"tutorialSidebar",previous:{title:"Buzzer",permalink:"/devicescript/api/drivers/buzzer"},next:{title:"HID Joystick",permalink:"/devicescript/api/drivers/hidjoystick"}},l={},c=[],p={toc:c},u="wrapper";function d(e){let{components:r,...t}=e;return(0,o.kt)(u,(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"hall-sensor"},"Hall sensor"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startPotentiometer")," starts a Hall (analog) sensor server and returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/potentiometer"},"client")," bound to the server."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startPotentiometer } from "@devicescript/servers"\n\nconst sensor = startPotentiometer({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(v => console.data({ value: 100 * v }))\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/27ec97a3.11e09067.js b/assets/js/27ec97a3.11e09067.js new file mode 100644 index 00000000000..3ee734a3634 --- /dev/null +++ b/assets/js/27ec97a3.11e09067.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4213],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var i=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,i,a=function(e,t){if(null==e)return{};var r,i,a={},n=Object.keys(e);for(i=0;i<n.length;i++)r=n[i],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)r=n[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},v=i.forwardRef((function(e,t){var r=e.components,a=e.mdxType,n=e.originalType,s=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),d=p(r),v=a,m=d["".concat(s,".").concat(v)]||d[v]||u[v]||n;return r?i.createElement(m,c(c({ref:t},l),{},{components:r})):i.createElement(m,c({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var n=r.length,c=new Array(n);c[0]=v;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var p=2;p<n;p++)c[p]=r[p];return i.createElement.apply(null,c)}return i.createElement.apply(null,r)}v.displayName="MDXCreateElement"},66840:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>n,metadata:()=>o,toc:()=>p});var i=r(25773),a=(r(27378),r(35318));const n={title:"WaveShare Pico-LCD"},c="WaveShare Pico-LCD",o={unversionedId:"devices/shields/waveshare-pico-lcd-114",id:"devices/shields/waveshare-pico-lcd-114",title:"WaveShare Pico-LCD",description:"- Device: Raspberry Pi Pico W",source:"@site/docs/devices/shields/waveshare-pico-lcd-114.mdx",sourceDirName:"devices/shields",slug:"/devices/shields/waveshare-pico-lcd-114",permalink:"/devicescript/devices/shields/waveshare-pico-lcd-114",draft:!1,tags:[],version:"current",frontMatter:{title:"WaveShare Pico-LCD"},sidebar:"tutorialSidebar",previous:{title:"Pimoroni Badger RP2040",permalink:"/devicescript/devices/shields/pimoroni-pico-badger"},next:{title:"Xiao ESP32-C3 Expansion Board",permalink:"/devicescript/devices/shields/xiao-expansion-board"}},s={},p=[{value:"DeviceScript import",id:"devicescript-import",level:2}],l={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(d,(0,i.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"waveshare-pico-lcd"},"WaveShare Pico-LCD"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Device: ",(0,a.kt)("a",{parentName:"li",href:"/devices/rp2040/pico-w"},"Raspberry Pi Pico W")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://www.waveshare.com/pico-lcd-1.14.htm"},"Home"))),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"WaveShare Image",src:r(35374).Z,width:"594",height:"297"})),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must import ",(0,a.kt)("inlineCode",{parentName:"p"},"WaveSharePicoLCD114")," to access the shield services."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "WaveShare Pico LCD 114".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { WaveSharePicoLCD114 } from "@devicescript/drivers"\nconst shield = new WaveSharePicoLCD114()\n\nconst gamepad = await shield.startGamepad()\nconst display = await shield.startDisplay()\n')))}u.isMDXComponent=!0},35374:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/waveshare-pico-lcd-114-6b2f09270d3b6ef99a8c1d095a807a44.png"}}]); \ No newline at end of file diff --git a/assets/js/298366da.f448d030.js b/assets/js/298366da.f448d030.js new file mode 100644 index 00000000000..5eac7730c87 --- /dev/null +++ b/assets/js/298366da.f448d030.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[114],{35318:(I,i,b)=>{b.d(i,{Zo:()=>a,kt:()=>n});var m=b(27378);function l(I,i,b){return i in I?Object.defineProperty(I,i,{value:b,enumerable:!0,configurable:!0,writable:!0}):I[i]=b,I}function Z(I,i){var b=Object.keys(I);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(I);i&&(m=m.filter((function(i){return Object.getOwnPropertyDescriptor(I,i).enumerable}))),b.push.apply(b,m)}return b}function c(I){for(var i=1;i<arguments.length;i++){var b=null!=arguments[i]?arguments[i]:{};i%2?Z(Object(b),!0).forEach((function(i){l(I,i,b[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(b)):Z(Object(b)).forEach((function(i){Object.defineProperty(I,i,Object.getOwnPropertyDescriptor(b,i))}))}return I}function e(I,i){if(null==I)return{};var b,m,l=function(I,i){if(null==I)return{};var b,m,l={},Z=Object.keys(I);for(m=0;m<Z.length;m++)b=Z[m],i.indexOf(b)>=0||(l[b]=I[b]);return l}(I,i);if(Object.getOwnPropertySymbols){var Z=Object.getOwnPropertySymbols(I);for(m=0;m<Z.length;m++)b=Z[m],i.indexOf(b)>=0||Object.prototype.propertyIsEnumerable.call(I,b)&&(l[b]=I[b])}return l}var t=m.createContext({}),g=function(I){var i=m.useContext(t),b=i;return I&&(b="function"==typeof I?I(i):c(c({},i),I)),b},a=function(I){var i=g(I.components);return m.createElement(t.Provider,{value:i},I.children)},s="mdxType",S={inlineCode:"code",wrapper:function(I){var i=I.children;return m.createElement(m.Fragment,{},i)}},d=m.forwardRef((function(I,i){var b=I.components,l=I.mdxType,Z=I.originalType,t=I.parentName,a=e(I,["components","mdxType","originalType","parentName"]),s=g(b),d=l,n=s["".concat(t,".").concat(d)]||s[d]||S[d]||Z;return b?m.createElement(n,c(c({ref:i},a),{},{components:b})):m.createElement(n,c({ref:i},a))}));function n(I,i){var b=arguments,l=i&&i.mdxType;if("string"==typeof I||l){var Z=b.length,c=new Array(Z);c[0]=d;var e={};for(var t in i)hasOwnProperty.call(i,t)&&(e[t]=i[t]);e.originalType=I,e[s]="string"==typeof I?I:l,c[1]=e;for(var g=2;g<Z;g++)c[g]=b[g];return m.createElement.apply(null,c)}return m.createElement.apply(null,b)}d.displayName="MDXCreateElement"},9545:(I,i,b)=>{b.r(i),b.d(i,{assets:()=>t,contentTitle:()=>c,default:()=>S,frontMatter:()=>Z,metadata:()=>e,toc:()=>g});var m=b(25773),l=(b(27378),b(35318));const Z={title:"Filter Operators"},c="Filter Operators",e={unversionedId:"api/observables/filter",id:"api/observables/filter",title:"Filter Operators",description:"filter",source:"@site/docs/api/observables/filter.mdx",sourceDirName:"api/observables",slug:"/api/observables/filter",permalink:"/devicescript/api/observables/filter",draft:!1,tags:[],version:"current",frontMatter:{title:"Filter Operators"},sidebar:"tutorialSidebar",previous:{title:"Digital Signal processing",permalink:"/devicescript/api/observables/dsp"},next:{title:"Transform operators",permalink:"/devicescript/api/observables/transform"}},t={},g=[{value:"filter",id:"filter",level:2},{value:"debounceTime",id:"debouncetime",level:2},{value:"throttleTime",id:"throttletime",level:2},{value:"auditTime",id:"audittime",level:2},{value:"threshold",id:"threshold",level:3},{value:"distinctUntilChanged",id:"distinctuntilchanged",level:2},{value:"Transform operators",id:"transform-operators",level:2},{value:"map",id:"map",level:3},{value:"scan",id:"scan",level:3},{value:"Signal processing",id:"signal-processing",level:2},{value:"ewma",id:"ewma",level:3},{value:"rollingAverage",id:"rollingaverage",level:3}],a={toc:g},s="wrapper";function S(I){let{components:i,...Z}=I;return(0,l.kt)(s,(0,m.Z)({},a,Z,{components:i,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"filter-operators"},"Filter Operators"),(0,l.kt)("h2",{id:"filter"},"filter"),(0,l.kt)("p",null,"Filter items emitted by the source Observable by only emitting those that satisfy a specified predicate."),(0,l.kt)("img",{alt:"output.svg",src:b(67996).Z,width:"432",height:"260"}),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, filter } from "@devicescript/observables"\n\nconst obs = from([0, 1, 2, 3, 1])\n\nobs\n // highlight-next-line\n .pipe(filter(v => v > 1))\n .subscribe(v => console.log(v))\n')),(0,l.kt)("h2",{id:"debouncetime"},"debounceTime"),(0,l.kt)("p",null,"Emits a notification from the source Observable\nonly after a particular time span has passed without another source emission."),(0,l.kt)("img",{alt:"output.svg",src:b(76517).Z,width:"402",height:"260"}),(0,l.kt)("p",null,"The example below debounce a button down event to one every 5 seconds."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\nimport { debounceTime } from "@devicescript/observables"\n\nconst button = new Button()\n\nbutton.down\n // highlight-next-line\n .pipe(debounceTime(5000))\n .subscribe(() => console.log("click"))\n')),(0,l.kt)("h2",{id:"throttletime"},"throttleTime"),(0,l.kt)("p",null,"Emits a value from the source Observable,\nthen ignores subsequent source values for duration milliseconds, then repeats this process."),(0,l.kt)("img",{alt:"output.svg",src:b(131).Z,width:"372",height:"260"}),(0,l.kt)("p",null,"The example below debounce a button down event to one every 5 seconds."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\nimport { throttleTime } from "@devicescript/observables"\n\nconst button = new Button()\n\nbutton.down\n // highlight-next-line\n .pipe(throttleTime(1000))\n .subscribe(() => console.log("click"))\n')),(0,l.kt)("h2",{id:"audittime"},"auditTime"),(0,l.kt)("p",null,"Ignores source values for duration milliseconds,\nthen emits the most recent value from the source Observable, then repeats this process"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"auditTime")," is similar to ",(0,l.kt)("inlineCode",{parentName:"p"},"throttleTime"),", but emits the last value from the silenced time window, instead of the first value."),(0,l.kt)("img",{alt:"output.svg",src:b(82591).Z,width:"372",height:"260"}),(0,l.kt)("p",null,"The example below debounce a button down event to one every 5 seconds."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\nimport { auditTime } from "@devicescript/observables"\n\nconst button = new Button()\n\nbutton.down\n // highlight-next-line\n .pipe(auditTime(1000))\n .subscribe(() => console.log("click"))\n')),(0,l.kt)("h3",{id:"threshold"},"threshold"),(0,l.kt)("p",null,"Filters numerical data stream within change threshold."),(0,l.kt)("img",{alt:"output.svg",src:b(28733).Z,width:"372",height:"260"}),(0,l.kt)("p",null,"The example tracks the temperature returned"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { threshold } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n\nthermometer.reading\n // highlight-next-line\n .pipe(threshold(2))\n .subscribe(t => console.log(t))\n')),(0,l.kt)("h2",{id:"distinctuntilchanged"},"distinctUntilChanged"),(0,l.kt)("p",null,"Returns a result Observable that emits all values pushed by the source observable\nif they are distinct in comparison to the last value the result observable emitted."),(0,l.kt)("p",null,"This function can be used to create user-friendly transformer. For example, thershold is as follows:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"export function threshold<T = number>(\n value: number,\n ...\n): OperatorFunction<T, T> {\n return distinctUntilChanged<T, number>(\n (l, r) => Math.abs(l - r) < value,\n keySelector\n )\n}\n")),(0,l.kt)("h2",{id:"transform-operators"},"Transform operators"),(0,l.kt)("h3",{id:"map"},"map"),(0,l.kt)("p",null,"Applies a converter function to converts the observed value into a new value."),(0,l.kt)("img",{alt:"output.svg",src:b(5405).Z,width:"312",height:"260"}),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, map } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs\n // highlight-next-line\n .pipe(map(v => v * v))\n .subscribe(v => console.log(v))\n')),(0,l.kt)("h3",{id:"scan"},"scan"),(0,l.kt)("p",null,'Applies an accumulator (or "reducer function") to each value from the source.'),(0,l.kt)("img",{alt:"output.svg",src:b(63522).Z,width:"372",height:"260"}),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, scan } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs.pipe(\n // highlight-next-line\n scan((p, c) => p + c, 0)\n).subscribe(v => console.log(v))\n')),(0,l.kt)("h2",{id:"signal-processing"},"Signal processing"),(0,l.kt)("h3",{id:"ewma"},"ewma"),(0,l.kt)("p",null,"Exponentially weighted moving average is a simple PIR filter\nwith a gain parameter.\nThe closer gain to 1 and the more closely the EWMA tracks the original time series."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { ewma } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n\nthermometer.reading\n // highlight-next-line\n .pipe(ewma(0.5))\n .subscribe(t => console.log(t))\n')),(0,l.kt)("h3",{id:"rollingaverage"},"rollingAverage"),(0,l.kt)("p",null,"A windowed rolling average filter."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { rollingAverage } from "@devicescript/observables"\n')))}S.isMDXComponent=!0},63522:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzIwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjMxMCwxOS4yMjY0OTczMDgxMDM3NDIgMzIwLDI1IDMxMCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEzMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDM1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MTwvdGV4dD48L2c+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgNzApIj48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjMyMC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjE2MS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIzMjIuMzA5NDAxMDc2NzU4NSI+c2NhbigocCwgYykgPSZndDsgcCArIGMsIDApPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSIzMjAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMzEwLDE5LjIyNjQ5NzMwODEwMzc0MiAzMjAsMjUgMzEwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI1MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+NjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxNDcsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4zPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},5405:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMTIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjYwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjI1MCwxOS4yMjY0OTczMDgxMDM3NDIgMjYwLDI1IDI1MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDM1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MTwvdGV4dD48L2c+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgNzApIj48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjI2MC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjEzMS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIyNjIuMzA5NDAxMDc2NzU4NSI+bWFwKHggPSZndDsgeCAqIHgpPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSIyNjAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMjUwLDE5LjIyNjQ5NzMwODEwMzc0MiAyNjAsMjUgMjUwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTc1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+OTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxMTcsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj40PC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},131:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzIwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjMxMCwxOS4yMjY0OTczMDgxMDM3NDIgMzIwLDI1IDMxMCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDExNywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjQ8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTQ3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MzwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjI1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MDwvdGV4dD48L2c+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgNzApIj48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjMyMC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjE2MS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIzMjIuMzA5NDAxMDc2NzU4NSI+dGhyb3R0bGVUaW1lKDIpPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSIzMjAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMzEwLDE5LjIyNjQ5NzMwODEwMzc0MiAzMjAsMjUgMzEwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI1MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTE3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+NDwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjI1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MDwvdGV4dD48L2c+PC9nPjwvZz48L3N2Zz4="},76517:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSI0MDIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0MDIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjkwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjI4MCwxOS4yMjY0OTczMDgxMDM3NDIgMjkwLDI1IDI4MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMjAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDcwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgzNSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjE8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMjUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4wPC90ZXh0PjwvZz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA3MCkiPjxyZWN0IHg9IjEiIHk9IjExIiB3aWR0aD0iMzUwLjMwOTQwMTA3Njc1ODUiIGhlaWdodD0iNDgiIGZpbGw9IndoaXRlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHJ4PSIwIi8+PHRleHQgeD0iMTc2LjE1NDcwMDUzODM3OTI1IiB5PSIzNSIgZmlsbD0iYmxhY2siIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjI0cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgd2lkdGg9IjM1Mi4zMDk0MDEwNzY3NTg1Ij5kZWJvdW5jZVRpbWUoMik8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMTYwKSI+PGc+PGxpbmUgeDE9IjAiIHkxPSIyNSIgeDI9IjM1MCIgeTI9IjI1IiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48cG9seWxpbmUgcG9pbnRzPSIzNDAsMTkuMjI2NDk3MzA4MTAzNzQyIDM1MCwyNSAzNDAsMzAuNzczNTAyNjkxODk2MjU4IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiLz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjgwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxNDcsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4zPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDIyNSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjA8L3RleHQ+PC9nPjwvZz48L2c+PC9zdmc+"},67996:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MzIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSI0MzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0MzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzgwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjM3MCwxOS4yMjY0OTczMDgxMDM3NDIgMzgwLDI1IDM3MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMjkgMCkiPjxsaW5lIHgxPSIwIiB5MT0iMCIgeDI9IjAiIHkyPSI1MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI1MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEzMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDM1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDIyNSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjA8L3RleHQ+PC9nPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDcwKSI+PHJlY3QgeD0iMSIgeT0iMTEiIHdpZHRoPSIzODAuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSI0OCIgZmlsbD0id2hpdGUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgcng9IjAiLz48dGV4dCB4PSIxOTEuMTU0NzAwNTM4Mzc5MjUiIHk9IjM1IiBmaWxsPSJibGFjayIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMjRweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiB3aWR0aD0iMzgyLjMwOTQwMTA3Njc1ODUiPmZpbHRlcih2ID0mZ3Q7IHYgJmd0OyAxKTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxNjApIj48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzgwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjM3MCwxOS4yMjY0OTczMDgxMDM3NDIgMzgwLDI1IDM3MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMjkgMCkiPjxsaW5lIHgxPSIwIiB5MT0iMCIgeDI9IjAiIHkyPSI1MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTQ3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MzwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},82591:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzIwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjMxMCwxOS4yMjY0OTczMDgxMDM3NDIgMzIwLDI1IDMxMCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDExNywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjQ8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTQ3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MzwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjI1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MDwvdGV4dD48L2c+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgNzApIj48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjMyMC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjE2MS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIzMjIuMzA5NDAxMDc2NzU4NSI+YXVkaXRUaW1lKDIpPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSIyOTAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMjgwLDE5LjIyNjQ5NzMwODEwMzc0MiAyOTAsMjUgMjgwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIyMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTE3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+NDwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},28733:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzIwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjMxMCwxOS4yMjY0OTczMDgxMDM3NDIgMzIwLDI1IDMxMCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDIyNSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjA8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDIwNiwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjI8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDcwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgzNSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjE8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMjUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4wPC90ZXh0PjwvZz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA3MCkiPjxyZWN0IHg9IjEiIHk9IjExIiB3aWR0aD0iMzIwLjMwOTQwMTA3Njc1ODUiIGhlaWdodD0iNDgiIGZpbGw9IndoaXRlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHJ4PSIwIi8+PHRleHQgeD0iMTYxLjE1NDcwMDUzODM3OTI1IiB5PSIzNSIgZmlsbD0iYmxhY2siIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjI0cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgd2lkdGg9IjMyMi4zMDk0MDEwNzY3NTg1Ij50aHJlc2hvbGQoMik8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMTYwKSI+PGc+PGxpbmUgeDE9IjAiIHkxPSIyNSIgeDI9IjMyMCIgeTI9IjI1IiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48cG9seWxpbmUgcG9pbnRzPSIzMTAsMTkuMjI2NDk3MzA4MTAzNzQyIDMyMCwyNSAzMTAsMzAuNzczNTAyNjkxODk2MjU4IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiLz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMjUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4wPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDIwNiwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjI8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMjUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4wPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="}}]); \ No newline at end of file diff --git a/assets/js/2ae8a91e.05536828.js b/assets/js/2ae8a91e.05536828.js new file mode 100644 index 00000000000..9adb4602262 --- /dev/null +++ b/assets/js/2ae8a91e.05536828.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2899],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>g});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=l(n),u=r,g=c["".concat(s,".").concat(u)]||c[u]||m[u]||i;return n?a.createElement(g,o(o({ref:t},d),{},{components:n})):a.createElement(g,o({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=u;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[c]="string"==typeof e?e:r,o[1]=p;for(var l=2;l<i;l++)o[l]=n[l];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},1094:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var a=n(25773),r=(n(27378),n(35318));const i={description:"Seeed Studio XIAO ESP32C3 with MSR218 base"},o="Seeed Studio XIAO ESP32C3 with MSR218 base",p={unversionedId:"devices/esp32/seeed-xiao-esp32c3-msr218",id:"devices/esp32/seeed-xiao-esp32c3-msr218",title:"Seeed Studio XIAO ESP32C3 with MSR218 base",description:"Seeed Studio XIAO ESP32C3 with MSR218 base",source:"@site/docs/devices/esp32/seeed-xiao-esp32c3-msr218.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/seeed-xiao-esp32c3-msr218",permalink:"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218",draft:!1,tags:[],version:"current",frontMatter:{description:"Seeed Studio XIAO ESP32C3 with MSR218 base"},sidebar:"tutorialSidebar",previous:{title:"MSR JacdacIoT 48 v0.2",permalink:"/devicescript/devices/esp32/msr48"},next:{title:"Seeed Studio XIAO ESP32C3",permalink:"/devicescript/devices/esp32/seeed-xiao-esp32c3"}},s={},l=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:l},c="wrapper";function m(e){let{components:t,...n}=e;return(0,r.kt)(c,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"seeed-studio-xiao-esp32c3-with-msr218-base"},"Seeed Studio XIAO ESP32C3 with MSR218 base"),(0,r.kt)("p",null,"A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors."),(0,r.kt)("p",null,(0,r.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/seeed-studio/xiaoesp32c3withmsr218base218v46.catalog.jpg",alt:"Seeed Studio XIAO ESP32C3 with MSR218 base picture"})),(0,r.kt)("h2",{id:"features"},"Features"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Jacdac on pin JD using Jacdac connector"),(0,r.kt)("li",{parentName:"ul"},"I2C on SDA/SCL using Qwiic connector"),(0,r.kt)("li",{parentName:"ul"},"WS2812B RGB LED on pin LED (use ",(0,r.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,r.kt)("li",{parentName:"ul"},"Serial logging on pin TX at 115200 8N1")),(0,r.kt)("h2",{id:"stores"},"Stores"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html"},"https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html"))),(0,r.kt)("h2",{id:"pins"},"Pins"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,r.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"A0")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, boot, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"A1")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"A2")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, debug, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"D9")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,r.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"JD")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,r.kt)("td",{parentName:"tr",align:"right"},"jacdac.pin, debug, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"LED")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,r.kt)("td",{parentName:"tr",align:"right"},"led.pin, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"LED_PWR")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,r.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"RX")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,r.kt)("td",{parentName:"tr",align:"right"},"bootUart, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SCL")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,r.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, debug, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SDA")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,r.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, debug, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"TX")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,r.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, bootUart, io")))),(0,r.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,r.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,r.kt)("p",null,"In ",(0,r.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,r.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Seeed Studio XIAO ESP32C3 with MSR218 base".'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/seeed_xiao_esp32c3_msr218"\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,r.kt)("p",null,"In Visual Studio Code,\nselect ",(0,r.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,r.kt)("p",null,"Run this ",(0,r.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board seeed_xiao_esp32c3_msr218\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-seeed_xiao_esp32c3_msr218-0x0.bin"},"Firmware"))),(0,r.kt)("h2",{id:"configuration"},"Configuration"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="seeed_xiao_esp32c3_msr218.json"',title:'"seeed_xiao_esp32c3_msr218.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "seeed_xiao_esp32c3_msr218",\n "devName": "Seeed Studio XIAO ESP32C3 with MSR218 base",\n "productId": "0x36b64827",\n "$description": "A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors.",\n "archId": "esp32c3",\n "url": "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html",\n "$services": [],\n "i2c": {\n "$connector": "Qwiic",\n "pinSCL": "SCL",\n "pinSDA": "SDA"\n },\n "jacdac": {\n "$connector": "Jacdac",\n "pin": "JD"\n },\n "led": {\n "pin": "LED",\n "type": 1\n },\n "log": {\n "pinTX": "TX"\n },\n "pins": {\n "A0": 2,\n "A1": 3,\n "A2": 4,\n "D9": 9,\n "JD": 5,\n "LED": 10,\n "LED_PWR": 8,\n "RX": 20,\n "SCL": 7,\n "SDA": 6,\n "TX": 21\n },\n "sPin": {\n "LED_PWR": 1\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2b38635b.4a9dbb34.js b/assets/js/2b38635b.4a9dbb34.js new file mode 100644 index 00000000000..69d1006baf0 --- /dev/null +++ b/assets/js/2b38635b.4a9dbb34.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3931],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>b});var s=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,s,r=function(e,t){if(null==e)return{};var n,s,r={},i=Object.keys(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},m=s.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(n),m=r,b=c["".concat(l,".").concat(m)]||c[m]||d[m]||i;return n?s.createElement(b,a(a({ref:t},u),{},{components:n})):s.createElement(b,a({ref:t},u))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[c]="string"==typeof e?e:r,a[1]=o;for(var p=2;p<i;p++)a[p]=n[p];return s.createElement.apply(null,a)}return s.createElement.apply(null,n)}m.displayName="MDXCreateElement"},48876:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var s=n(25773),r=(n(27378),n(35318));const i={sidebar_position:1,description:"Learn how to publish and subscribe to messages using DeviceScript, Azure Event Hub, and Visual Studio Code extension.",keywords:["DeviceScript","Azure Event Hub","Visual Studio Code","publish message","subscribe message"]},a="Messages",o={unversionedId:"developer/development-gateway/messages",id:"developer/development-gateway/messages",title:"Messages",description:"Learn how to publish and subscribe to messages using DeviceScript, Azure Event Hub, and Visual Studio Code extension.",source:"@site/docs/developer/development-gateway/messages.mdx",sourceDirName:"developer/development-gateway",slug:"/developer/development-gateway/messages",permalink:"/devicescript/developer/development-gateway/messages",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Learn how to publish and subscribe to messages using DeviceScript, Azure Event Hub, and Visual Studio Code extension.",keywords:["DeviceScript","Azure Event Hub","Visual Studio Code","publish message","subscribe message"]},sidebar:"tutorialSidebar",previous:{title:"Development Gateway",permalink:"/devicescript/developer/development-gateway/"},next:{title:"Application Telemetry",permalink:"/devicescript/developer/development-gateway/telemetry"}},l={},p=[{value:"Publish Message",id:"publish-message",level:2},{value:"Subscribe Message",id:"subscribe-message",level:2},{value:"Visual Studio Code extension",id:"visual-studio-code-extension",level:2}],u={toc:p},c="wrapper";function d(e){let{components:t,...n}=e;return(0,r.kt)(c,(0,s.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"messages"},"Messages"),(0,r.kt)("h2",{id:"publish-message"},"Publish Message"),(0,r.kt)("p",null,"Publish a topic, payload pair to the gateway."),(0,r.kt)("p",null,"DeviceScript will stringify and upload your object as a JSON payload. The gateway add this messages\ninto an ",(0,r.kt)("a",{parentName:"p",href:"https://azure.microsoft.com/en-us/products/event-hubs/"},"Azure Event Hub"),", additonal sinks can be configured online."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { publishMessage } from "@devicescript/cloud"\n\n// highlight-next-line\nawait publishMessage("greetings", { msg: "hello" })\n')),(0,r.kt)("p",null,"In the device gateway, this topic will be expanded to ",(0,r.kt)("inlineCode",{parentName:"p"},"devs/{deviceid}/from/{topic}"),".\nIf you want to override this behavior, use ",(0,r.kt)("inlineCode",{parentName:"p"},"/{topic}")," and the leading will be removed\nthe MQTT topic to be ",(0,r.kt)("inlineCode",{parentName:"p"},"{topic}"),"."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Keep those field names very short as the payload needs to be small (",(0,r.kt)("inlineCode",{parentName:"p"},"< 236")," bytes).")),(0,r.kt)("p",null,"In the Visual Studio Code extension, you can upload a JSON\nmessage from the device context menu."),(0,r.kt)("h2",{id:"subscribe-message"},"Subscribe Message"),(0,r.kt)("p",null,"Subscribes to able to receive messages from the gateway."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { subscribeMessage } from "@devicescript/cloud"\n\nsubscribeMessage("greetings", async msg => {\n console.log(msg)\n})\n')),(0,r.kt)("h2",{id:"visual-studio-code-extension"},"Visual Studio Code extension"),(0,r.kt)("p",null,"In the DeviceScript Gateway extension, you can connect to the device and\nsee the messages in the output window."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2bfae4de.43f5f295.js b/assets/js/2bfae4de.43f5f295.js new file mode 100644 index 00000000000..8bd1ce13cd9 --- /dev/null +++ b/assets/js/2bfae4de.43f5f295.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6300],{35318:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>k});var r=a(27378);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},l=Object.keys(e);for(r=0;r<l.length;r++)a=l[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)a=l[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),m=n,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||l;return a?r.createElement(k,o(o({ref:t},c),{},{components:a})):r.createElement(k,o({ref:t},c))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:n,o[1]=i;for(var p=2;p<l;p++)o[p]=a[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"},39983:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var r=a(25773),n=(a(27378),a(35318));const l={},o="Local and Remote Workspaces",i={unversionedId:"getting-started/vscode/workspaces",id:"getting-started/vscode/workspaces",title:"Local and Remote Workspaces",description:"In a local workspace, DeviceScript opens a native serial connection to communicate with hardware devices.",source:"@site/docs/getting-started/vscode/workspaces.mdx",sourceDirName:"getting-started/vscode",slug:"/getting-started/vscode/workspaces",permalink:"/devicescript/getting-started/vscode/workspaces",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Troubleshooting",permalink:"/devicescript/getting-started/vscode/troubleshooting"},next:{title:"Command Line",permalink:"/devicescript/getting-started/cli"}},s={},p=[{value:"Remote workspace",id:"remote-workspace",level:2},{value:"Virtual Workspaces",id:"virtual-workspaces",level:2}],c={toc:p},u="wrapper";function d(e){let{components:t,...l}=e;return(0,n.kt)(u,(0,r.Z)({},c,l,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"local-and-remote-workspaces"},"Local and Remote Workspaces"),(0,n.kt)("p",null,"In a local workspace, DeviceScript opens a native serial connection to communicate with hardware devices."),(0,n.kt)("p",null,"In a remote workspace, DeviceScript uses a separate browser window using WebSerial that communicates with\nthe localhost developer tools server."),(0,n.kt)("p",null,"In general, web editor is not supported."),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:null},"Feature"),(0,n.kt)("th",{parentName:"tr",align:null},"Local (Windows, MacOS, Linux)"),(0,n.kt)("th",{parentName:"tr",align:null},"Remote (WSL, Docker, Codespaces, ...)"),(0,n.kt)("th",{parentName:"tr",align:null},"Web"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"TypeScript completion, syntax"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Compiler"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Device Simulator"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Debugger"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Simulator Dashboard"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Devices/Watch views"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Flash Firmware"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713 (1)"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Serial connection to hardware"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,n.kt)("td",{parentName:"tr",align:null},"\u2713 (2)"),(0,n.kt)("td",{parentName:"tr",align:null})),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"USB connection to hardware"),(0,n.kt)("td",{parentName:"tr",align:null},"(3)"),(0,n.kt)("td",{parentName:"tr",align:null}),(0,n.kt)("td",{parentName:"tr",align:null})))),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"(1) Using manual download of .UF2 files for RP2040 or the ",(0,n.kt)("a",{parentName:"li",href:"https://adafruit.github.io/Adafruit_WebSerial_ESPTool/"},"Adafruit WebSerial ESPTool")),(0,n.kt)("li",{parentName:"ul"},"(2) Through a seperate browser window using WebSerial"),(0,n.kt)("li",{parentName:"ul"},"(3) No board with USB connection supported yet")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Two windows with a connection connector and Visual Studio Code in the browser",src:a(59838).Z,width:"1324",height:"931"})),(0,n.kt)("h2",{id:"remote-workspace"},"Remote workspace"),(0,n.kt)("p",null,"When using a remote workspace, the developer tool command line (that gets spawned by the Visual Studio extension)\ncannot access physical devices."),(0,n.kt)("p",null,"To work around this issue, the extension launches a web page that uses WebSerial/WebUSB to connect\nto the physical device and proxy the packets back to the local web server hosted by the developer tools."),(0,n.kt)("p",null,"The key difference between local and remote are:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"the connection is done through a separate web page\nthat needs to stay opened and in the foreground (browser aggressively throttle background pages)"),(0,n.kt)("li",{parentName:"ul"},"the console output is displayed in the connection page rather than in the VS Code terminal")),(0,n.kt)("p",null,"The remote feature was tested for the following remote solutions:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces"},"GitHub Codespaces")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl"},"WSL")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=CodeSandbox-io.codesandbox-projects"},"CodeSandbox")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=gitpod.gitpod-remote-ssh"},"GitPod"))),(0,n.kt)("h2",{id:"virtual-workspaces"},"Virtual Workspaces"),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://code.visualstudio.com/api/extension-guides/virtual-workspaces"},"Virtual Workspaces"),", not to be confused with remote workspaces,\nare ",(0,n.kt)("strong",{parentName:"p"},"not")," supported:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=GitHub.remotehub"},"GitHub Repositories"))))}d.isMDXComponent=!0},59838:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/remote-83da64afb296fdfc2a4bc1a415ec21f3.png"}}]); \ No newline at end of file diff --git a/assets/js/2c32c100.c4f28f56.js b/assets/js/2c32c100.c4f28f56.js new file mode 100644 index 00000000000..9d3f377e66c --- /dev/null +++ b/assets/js/2c32c100.c4f28f56.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4577],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=l(r),f=i,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,o(o({ref:t},s),{},{components:r})):n.createElement(m,o({ref:t},s))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=f;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:i,o[1]=c;for(var l=2;l<a;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},21015:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const a={sidebar_position:1},o="Code",c={unversionedId:"api/core/index",id:"api/core/index",title:"Code",description:"DeviceScript provides builtin support for instantiating Jacdac service clients (role)",source:"@site/docs/api/core/index.md",sourceDirName:"api/core",slug:"/api/core/",permalink:"/devicescript/api/core/",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Command Line Interface",permalink:"/devicescript/api/cli"},next:{title:"Roles",permalink:"/devicescript/api/core/roles"}},p={},l=[],s={toc:l},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"code"},"Code"),(0,i.kt)("p",null,"DeviceScript provides builtin support for instantiating ",(0,i.kt)("strong",{parentName:"p"},"Jacdac service clients (role)"),"\nand binding them to ",(0,i.kt)("strong",{parentName:"p"},"Jacdac servers (sensors)"),". Jacdac services are an abstraction layer that allow you to program in DeviceScript without having to enter the details of the hardware implementation."),(0,i.kt)("p",null,"Once a role is bound to a service server, DeviceScript provides the API to access its"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/core/registers"},"registers")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/core/events"},"events")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/core/commands"},"commands"))),(0,i.kt)("p",null,"Additional runtime components"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/core/buffers"},"Buffer"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3041.3d8294e0.js b/assets/js/3041.3d8294e0.js new file mode 100644 index 00000000000..c136fdc66d0 --- /dev/null +++ b/assets/js/3041.3d8294e0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3041],{93041:(e,t,r)=>{function n(e,t){var r=void 0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];r&&clearTimeout(r),r=setTimeout((function(){return e.apply(void 0,o)}),t)}}function o(e){return e!==Object(e)}function i(e,t){if(e===t)return!0;if(o(e)||o(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r=0,n=Object.keys(e);r<n.length;r++){var a=n[r];if(!(a in t))return!1;if(!i(e[a],t[a]))return!1}return!0}r.r(t),r.d(t,{DocSearchModal:()=>pn});var a=function(){};function c(e){var t=e.item,r=e.items;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID,algoliaSource:["autocomplete"]}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);l=!0);}catch(s){u=!0,o=s}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=["items"],f=["items"];function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function p(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return v(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==m(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===m(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){return e.map((function(e){var t=e.items,r=d(e,s);return h(h({},r),{},{objectIDs:(null==t?void 0:t.map((function(e){return e.objectID})))||r.objectIDs})}))}function O(e){var t,r,n,o=(t=l((e.version||"").split(".").map(Number),2),r=t[0],n=t[1],r>=3||2===r&&n>=4||1===r&&n>=10);function i(t,r,n){if(o&&void 0!==n){var i=n[0].__autocomplete_algoliaCredentials,a={"X-Algolia-Application-Id":i.appId,"X-Algolia-API-Key":i.apiKey};e.apply(void 0,[t].concat(p(r),[{headers:a}]))}else e.apply(void 0,[t].concat(p(r)))}return{init:function(t,r){e("init",{appId:t,apiKey:r})},setUserToken:function(t){e("setUserToken",t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("clickedObjectIDsAfterSearch",g(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("clickedObjectIDs",g(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.length>0&&e.apply(void 0,["clickedFilters"].concat(r))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("convertedObjectIDsAfterSearch",g(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&i("convertedObjectIDs",g(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.length>0&&e.apply(void 0,["convertedFilters"].concat(r))},viewedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&t.reduce((function(e,t){var r=t.items,n=d(t,f);return[].concat(p(e),p(function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,r=[],n=0;n<e.objectIDs.length;n+=t)r.push(h(h({},e),{},{objectIDs:e.objectIDs.slice(n,n+t)}));return r}(h(h({},n),{},{objectIDs:(null==r?void 0:r.map((function(e){return e.objectID})))||n.objectIDs})).map((function(e){return{items:r,payload:e}}))))}),[]).forEach((function(e){var t=e.items;return i("viewedObjectIDs",[e.payload],t)}))},viewedFilters:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.length>0&&e.apply(void 0,["viewedFilters"].concat(r))}}}function S(e){var t=e.items.reduce((function(e,t){var r;return e[t.__autocomplete_indexName]=(null!==(r=e[t.__autocomplete_indexName])&&void 0!==r?r:[]).concat(t),e}),{});return Object.keys(t).map((function(e){return{index:e,items:t[e],algoliaSource:["autocomplete"]}}))}function j(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function E(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function I(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I(Object(r),!0).forEach((function(t){A(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function A(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==w(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==w(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===w(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k="2.6.0",x="https://cdn.jsdelivr.net/npm/search-insights@".concat(k,"/dist/search-insights.min.js"),C=n((function(e){var t=e.onItemsChange,r=e.items,n=e.insights,o=e.state;t({insights:n,insightsEvents:S({items:r}).map((function(e){return D({eventName:"Items Viewed"},e)})),state:o})}),400);function N(e){var t=function(e){return D({onItemsChange:function(e){var t=e.insights,r=e.insightsEvents;t.viewedObjectIDs.apply(t,E(r.map((function(e){return D(D({},e),{},{algoliaSource:[].concat(E(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onSelect:function(e){var t=e.insights,r=e.insightsEvents;t.clickedObjectIDsAfterSearch.apply(t,E(r.map((function(e){return D(D({},e),{},{algoliaSource:[].concat(E(e.algoliaSource||[]),["autocomplete-internal"])})}))))},onActive:a},e)}(e),r=t.insightsClient,o=t.onItemsChange,l=t.onSelect,u=t.onActive,s=r;r||function(e){if("undefined"!=typeof window)e({window:window})}((function(e){var t=e.window,r=t.AlgoliaAnalyticsObject||"aa";"string"==typeof r&&(s=t[r]),s||(t.AlgoliaAnalyticsObject=r,t[r]||(t[r]=function(){t[r].queue||(t[r].queue=[]);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];t[r].queue.push(n)}),t[r].version=k,s=t[r],function(e){var t="[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete";try{var r=e.document.createElement("script");r.async=!0,r.src=x,r.onerror=function(){console.error(t)},document.body.appendChild(r)}catch(n){console.error(t)}}(t))}));var f=O(s),m={current:[]},p=n((function(e){var t=e.state;if(t.isOpen){var r=t.collections.reduce((function(e,t){return[].concat(E(e),E(t.items))}),[]).filter(j);i(m.current.map((function(e){return e.objectID})),r.map((function(e){return e.objectID})))||(m.current=r,r.length>0&&C({onItemsChange:o,items:r,insights:f,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,r=e.onSelect,n=e.onActive;s("addAlgoliaAgent","insights-plugin"),t({algoliaInsightsPlugin:{__algoliaSearchParameters:{clickAnalytics:!0},insights:f}}),r((function(e){var t=e.item,r=e.state,n=e.event;j(t)&&l({state:r,event:n,insights:f,item:t,insightsEvents:[D({eventName:"Item Selected"},c({item:t,items:m.current}))]})})),n((function(e){var t=e.item,r=e.state,n=e.event;j(t)&&u({state:r,event:n,insights:f,item:t,insightsEvents:[D({eventName:"Item Active"},c({item:t,items:m.current}))]})}))},onStateChange:function(e){var t=e.state;p({state:t})},__autocomplete_pluginOptions:e}}function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==_(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===_(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(e,t,r){var n,o=t.initialState;return{getState:function(){return o},dispatch:function(n,i){var a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){q(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o);o=e(o,{type:n,props:t,payload:i}),r({state:o,prevState:a})},pendingRequests:(n=[],{add:function(e){return n.push(e),e.finally((function(){n=n.filter((function(t){return t!==e}))}))},cancelAll:function(){n.forEach((function(e){return e.cancel()}))},isEmpty:function(){return 0===n.length}})}}function L(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach((function(t){U(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function U(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==M(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===M(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}var V=0;function K(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K(Object(r),!0).forEach((function(t){J(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function J(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==z(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===z(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function W(e){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(e)}function Q(e){return function(e){if(Array.isArray(e))return Z(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function X(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){Y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Y(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==W(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==W(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===W(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ee(e,t){var r,n="undefined"!=typeof window?window:{},o=e.plugins||[];return X(X({debug:!1,openOnFocus:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:!1,environment:n,shouldPanelOpen:function(e){return B(e.state)>0},reshape:function(e){return e.sources}},e),{},{id:null!==(r=e.id)&&void 0!==r?r:"autocomplete-".concat(V++),plugins:o,initialState:X({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var r;null===(r=e.onStateChange)||void 0===r||r.call(e,t),o.forEach((function(e){var r;return null===(r=e.onStateChange)||void 0===r?void 0:r.call(e,t)}))},onSubmit:function(t){var r;null===(r=e.onSubmit)||void 0===r||r.call(e,t),o.forEach((function(e){var r;return null===(r=e.onSubmit)||void 0===r?void 0:r.call(e,t)}))},onReset:function(t){var r;null===(r=e.onReset)||void 0===r||r.call(e,t),o.forEach((function(e){var r;return null===(r=e.onReset)||void 0===r?void 0:r.call(e,t)}))},getSources:function(r){return Promise.all([].concat(Q(o.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var r=[];return Promise.resolve(e(t)).then((function(e){return Array.isArray(e),Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,r.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));r.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:a,onResolve:a};Object.keys(t).forEach((function(e){t[e].__default=!0}));var n=$($({},t),e);return Promise.resolve(n)})))}))}(e,r)}))).then((function(e){return L(e)})).then((function(e){return e.map((function(e){return X(X({},e),{},{onSelect:function(r){e.onSelect(r),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,r)}))},onActive:function(r){e.onActive(r),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,r)}))},onResolve:function(r){e.onResolve(r),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,r)}))}})}))}))},navigator:X({navigate:function(e){var t=e.itemUrl;n.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,r=n.open(t,"_blank","noopener");null==r||r.focus()},navigateNewWindow:function(e){var t=e.itemUrl;n.open(t,"_blank","noopener")}},e.navigator)})}function te(e){return te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},te(e)}function re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?re(Object(r),!0).forEach((function(t){oe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function oe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==te(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===te(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==ie(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ie(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ue(e){return function(e){if(Array.isArray(e))return se(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function fe(e){return Boolean(e.execute)}function me(e,t,r){if(o=e,Boolean(null==o?void 0:o.execute)){var n="algolia"===e.requesterId?Object.assign.apply(Object,[{}].concat(ue(Object.keys(r.context).map((function(e){var t;return null===(t=r.context[e])||void 0===t?void 0:t.__algoliaSearchParameters}))))):{};return ce(ce({},e),{},{requests:e.queries.map((function(r){return{query:"algolia"===e.requesterId?ce(ce({},r),{},{params:ce(ce({},n),r.params)}):r,sourceId:t,transformResponse:e.transformResponse}}))})}var o;return{items:e,sourceId:t}}function pe(e){var t=e.reduce((function(e,t){if(!fe(t))return e.push(t),e;var r=t.searchClient,n=t.execute,o=t.requesterId,i=t.requests,a=e.find((function(e){return fe(t)&&fe(e)&&e.searchClient===r&&Boolean(o)&&e.requesterId===o}));if(a){var c;(c=a.items).push.apply(c,ue(i))}else{var l={execute:n,requesterId:o,items:i,searchClient:r};e.push(l)}return e}),[]).map((function(e){if(!fe(e))return Promise.resolve(e);var t=e,r=t.execute,n=t.items;return r({searchClient:t.searchClient,requests:n})}));return Promise.all(t).then((function(e){return L(e)}))}function ve(e,t,r){return t.map((function(t){var n,o=e.filter((function(e){return e.sourceId===t.sourceId})),i=o.map((function(e){return e.items})),a=o[0].transformResponse,c=a?a({results:n=i,hits:n.map((function(e){return e.hits})).filter(Boolean),facetHits:n.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}):i;return t.onResolve({source:t,results:i,items:c,state:r.getState()}),Array.isArray(c),c.every(Boolean),'The `getItems` function from source "'.concat(t.sourceId,'" must return an array of items but returned ').concat(JSON.stringify(void 0),".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"),{source:t,items:c}}))}function de(e,t){var r=t;return{then:function(t,n){return de(e.then(be(t,r,e),be(n,r,e)),r)},catch:function(t){return de(e.catch(be(t,r,e)),r)},finally:function(t){return t&&r.onCancelList.push(t),de(e.finally(be(t&&function(){return r.onCancelList=[],t()},r,e)),r)},cancel:function(){r.isCanceled=!0;var e=r.onCancelList;r.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===r.isCanceled}}}function ye(e){return de(new Promise((function(t,r){return e(t,r)})),{isCanceled:!1,onCancelList:[]})}function he(e){return de(e,{isCanceled:!1,onCancelList:[]})}function be(e,t,r){return e?function(r){return t.isCanceled?r:e(r)}:r}function ge(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,r){var n=(e[r-1]||0)+t;return e.push(n),e}),[]).reduce((function(t,r){return r<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var r=t.items[function(e){for(var t=e.state,r=e.collection,n=!1,o=0,i=0;!1===n;){var a=t.collections[o];if(a===r){n=!0;break}i+=a.items.length,o++}return t.activeItemId-i}({state:e,collection:t})],n=t.source;return{item:r,itemInputValue:n.getItemInputValue({item:r,state:e}),itemUrl:n.getItemUrl({item:r,state:e}),source:n}}function Oe(e){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oe(e)}ye.resolve=function(e){return he(Promise.resolve(e))},ye.reject=function(e){return he(Promise.reject(e))};var Se=["event","nextState","props","query","refresh","store"];function je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function we(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){Ee(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ee(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Oe(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Oe(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pe(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var Ie,De,Ae,ke=null,xe=(Ie=-1,De=-1,Ae=void 0,function(e){var t=++Ie;return Promise.resolve(e).then((function(e){return Ae&&t<De?Ae:(De=t,Ae=e,e)}))});function Ce(e){var t=e.event,r=e.nextState,n=void 0===r?{}:r,o=e.props,i=e.query,a=e.refresh,c=e.store,l=Pe(e,Se);ke&&o.environment.clearTimeout(ke);var u=l.setCollections,s=l.setIsOpen,f=l.setQuery,m=l.setActiveItemId,p=l.setStatus;if(f(i),m(o.defaultActiveItemId),!i&&!1===o.openOnFocus){var v,d=c.getState().collections.map((function(e){return we(we({},e),{},{items:[]})}));p("idle"),u(d),s(null!==(v=n.isOpen)&&void 0!==v?v:o.shouldPanelOpen({state:c.getState()}));var y=he(xe(d).then((function(){return Promise.resolve()})));return c.pendingRequests.add(y)}p("loading"),ke=o.environment.setTimeout((function(){p("stalled")}),o.stallThreshold);var h=he(xe(o.getSources(we({query:i,refresh:a,state:c.getState()},l)).then((function(e){return Promise.all(e.map((function(e){return Promise.resolve(e.getItems(we({query:i,refresh:a,state:c.getState()},l))).then((function(t){return me(t,e.sourceId,c.getState())}))}))).then(pe).then((function(t){return ve(t,e,c)})).then((function(e){return function(e){var t=e.collections,r=e.props,n=e.state,o=t.reduce((function(e,t){return ne(ne({},e),{},oe({},t.source.sourceId,ne(ne({},t.source),{},{getItems:function(){return L(t.items)}})))}),{}),i=r.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:o,state:n}).sourcesBySourceId;return L(r.reshape({sourcesBySourceId:i,sources:Object.values(i),state:n})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:o,state:c.getState()})}))})))).then((function(e){var r;p("idle"),u(e);var f=o.shouldPanelOpen({state:c.getState()});s(null!==(r=n.isOpen)&&void 0!==r?r:o.openOnFocus&&!i&&f||f);var m=ge(c.getState());if(null!==c.getState().activeItemId&&m){var v=m.item,d=m.itemInputValue,y=m.itemUrl,h=m.source;h.onActive(we({event:t,item:v,itemInputValue:d,itemUrl:y,refresh:a,source:h,state:c.getState()},l))}})).finally((function(){p("idle"),ke&&o.environment.clearTimeout(ke)}));return c.pendingRequests.add(h)}function Ne(e){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ne(e)}var _e=["event","props","refresh","store"];function Te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(r),!0).forEach((function(t){Re(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Re(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Ne(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ne(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var Me=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function He(e){return He="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(e)}var Fe=["props","refresh","store"],Ue=["inputElement","formElement","panelElement"],Be=["inputElement"],Ve=["inputElement","maxLength"],Ke=["sourceIndex"],$e=["sourceIndex"],Je=["item","source","sourceIndex"];function ze(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function We(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(r),!0).forEach((function(t){Qe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Qe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==He(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==He(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===He(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ze(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Ge(e){var t=e.props,r=e.refresh,n=e.store,o=Ze(e,Fe),i=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var r=e.inputElement,o=e.formElement,i=e.panelElement;function a(e){!n.getState().isOpen&&n.pendingRequests.isEmpty()||e.target===r||!1===[o,i].some((function(t){return r=t,n=e.target,r===n||r.contains(n);var r,n}))&&(n.dispatch("blur",null),t.debug||n.pendingRequests.cancelAll())}return We({onTouchStart:a,onMouseDown:a,onTouchMove:function(e){!1!==n.getState().isOpen&&r===t.environment.document.activeElement&&e.target!==r&&r.blur()}},Ze(e,Ue))},getRootProps:function(e){return We({role:"combobox","aria-expanded":n.getState().isOpen,"aria-haspopup":"listbox","aria-owns":n.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){e.inputElement;return We({action:"",noValidate:!0,role:"search",onSubmit:function(i){var a;i.preventDefault(),t.onSubmit(We({event:i,refresh:r,state:n.getState()},o)),n.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(i){var a;i.preventDefault(),t.onReset(We({event:i,refresh:r,state:n.getState()},o)),n.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},Ze(e,Be))},getLabelProps:function(e){var r=e||{},n=r.sourceIndex,o=Ze(r,Ke);return We({htmlFor:"".concat(i(t.id,n),"-input"),id:"".concat(i(t.id,n),"-label")},o)},getInputProps:function(e){var i;function c(e){(t.openOnFocus||Boolean(n.getState().query))&&Ce(We({event:e,props:t,query:n.getState().completion||n.getState().query,refresh:r,store:n},o)),n.dispatch("focus",null)}var l=e||{},u=(l.inputElement,l.maxLength),s=void 0===u?512:u,f=Ze(l,Ve),m=ge(n.getState()),p=function(e){return Boolean(e&&e.match(Me))}((null===(i=t.environment.navigator)||void 0===i?void 0:i.userAgent)||""),v=null!=m&&m.itemUrl&&!p?"go":"search";return We({"aria-autocomplete":"both","aria-activedescendant":n.getState().isOpen&&null!==n.getState().activeItemId?"".concat(t.id,"-item-").concat(n.getState().activeItemId):void 0,"aria-controls":n.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:n.getState().completion||n.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:v,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:s,type:"search",onChange:function(e){Ce(We({event:e,props:t,query:e.currentTarget.value.slice(0,s),refresh:r,store:n},o))},onKeyDown:function(e){!function(e){var t=e.event,r=e.props,n=e.refresh,o=e.store,i=Le(e,_e);if("ArrowUp"===t.key||"ArrowDown"===t.key){var a=function(){var e=r.environment.document.getElementById("".concat(r.id,"-item-").concat(o.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},c=function(){var e=ge(o.getState());if(null!==o.getState().activeItemId&&e){var r=e.item,a=e.itemInputValue,c=e.itemUrl,l=e.source;l.onActive(qe({event:t,item:r,itemInputValue:a,itemUrl:c,refresh:n,source:l,state:o.getState()},i))}};t.preventDefault(),!1===o.getState().isOpen&&(r.openOnFocus||Boolean(o.getState().query))?Ce(qe({event:t,props:r,query:o.getState().query,refresh:n,store:o},i)).then((function(){o.dispatch(t.key,{nextActiveItemId:r.defaultActiveItemId}),c(),setTimeout(a,0)})):(o.dispatch(t.key,{}),c(),a())}else if("Escape"===t.key)t.preventDefault(),o.dispatch(t.key,null),o.pendingRequests.cancelAll();else if("Tab"===t.key)o.dispatch("blur",null),o.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===o.getState().activeItemId||o.getState().collections.every((function(e){return 0===e.items.length})))return void(r.debug||o.pendingRequests.cancelAll());t.preventDefault();var l=ge(o.getState()),u=l.item,s=l.itemInputValue,f=l.itemUrl,m=l.source;if(t.metaKey||t.ctrlKey)void 0!==f&&(m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i)),r.navigator.navigateNewTab({itemUrl:f,item:u,state:o.getState()}));else if(t.shiftKey)void 0!==f&&(m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i)),r.navigator.navigateNewWindow({itemUrl:f,item:u,state:o.getState()}));else if(t.altKey);else{if(void 0!==f)return m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i)),void r.navigator.navigate({itemUrl:f,item:u,state:o.getState()});Ce(qe({event:t,nextState:{isOpen:!1},props:r,query:s,refresh:n,store:o},i)).then((function(){m.onSelect(qe({event:t,item:u,itemInputValue:s,itemUrl:f,refresh:n,source:m,state:o.getState()},i))}))}}}(We({event:e,props:t,refresh:r,store:n},o))},onFocus:c,onBlur:a,onClick:function(r){e.inputElement!==t.environment.document.activeElement||n.getState().isOpen||c(r)}},f)},getPanelProps:function(e){return We({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){n.dispatch("mouseleave",null)}},e)},getListProps:function(e){var r=e||{},n=r.sourceIndex,o=Ze(r,$e);return We({role:"listbox","aria-labelledby":"".concat(i(t.id,n),"-label"),id:"".concat(i(t.id,n),"-list")},o)},getItemProps:function(e){var a=e.item,c=e.source,l=e.sourceIndex,u=Ze(e,Je);return We({id:"".concat(i(t.id,l),"-item-").concat(a.__autocomplete_id),role:"option","aria-selected":n.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==n.getState().activeItemId){n.dispatch("mousemove",a.__autocomplete_id);var t=ge(n.getState());if(null!==n.getState().activeItemId&&t){var i=t.item,c=t.itemInputValue,l=t.itemUrl,u=t.source;u.onActive(We({event:e,item:i,itemInputValue:c,itemUrl:l,refresh:r,source:u,state:n.getState()},o))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=c.getItemInputValue({item:a,state:n.getState()}),l=c.getItemUrl({item:a,state:n.getState()});(l?Promise.resolve():Ce(We({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:r,store:n},o))).then((function(){c.onSelect(We({event:e,item:a,itemInputValue:i,itemUrl:l,refresh:r,source:c,state:n.getState()},o))}))}},u)}}}var Xe=[{segment:"autocomplete-core",version:"1.9.3"}];function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function et(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?et(Object(r),!0).forEach((function(t){rt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):et(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==Ye(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ye(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ye(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nt(e){var t,r,n,o,i=e.plugins,a=e.options,c=null===(t=((null===(r=a.__autocomplete_metadata)||void 0===r?void 0:r.userAgents)||[])[0])||void 0===t?void 0:t.segment,l=c?rt({},c,Object.keys((null===(n=a.__autocomplete_metadata)||void 0===n?void 0:n.options)||{})):{};return{plugins:i.map((function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}})),options:tt({"autocomplete-core":Object.keys(a)},l),ua:Xe.concat((null===(o=a.__autocomplete_metadata)||void 0===o?void 0:o.userAgents)||[])}}function ot(e){var t,r=e.state;return!1===r.isOpen||null===r.activeItemId?null:(null===(t=ge(r))||void 0===t?void 0:t.itemInputValue)||null}function it(e,t,r,n){if(!r)return null;if(e<0&&(null===t||null!==n&&0===t))return r+e;var o=(null===t?-1:t)+e;return o<=-1||o>=r?null===n?null:0:o}function at(e){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(e)}function ct(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(r),!0).forEach((function(t){ut(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ct(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==at(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===at(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var st=function(e,t){switch(t.type){case"setActiveItemId":case"mousemove":return lt(lt({},e),{},{activeItemId:t.payload});case"setQuery":return lt(lt({},e),{},{query:t.payload,completion:null});case"setCollections":return lt(lt({},e),{},{collections:t.payload});case"setIsOpen":return lt(lt({},e),{},{isOpen:t.payload});case"setStatus":return lt(lt({},e),{},{status:t.payload});case"setContext":return lt(lt({},e),{},{context:lt(lt({},e.context),t.payload)});case"ArrowDown":var r=lt(lt({},e),{},{activeItemId:t.payload.hasOwnProperty("nextActiveItemId")?t.payload.nextActiveItemId:it(1,e.activeItemId,B(e),t.props.defaultActiveItemId)});return lt(lt({},r),{},{completion:ot({state:r})});case"ArrowUp":var n=lt(lt({},e),{},{activeItemId:it(-1,e.activeItemId,B(e),t.props.defaultActiveItemId)});return lt(lt({},n),{},{completion:ot({state:n})});case"Escape":return e.isOpen?lt(lt({},e),{},{activeItemId:null,isOpen:!1,completion:null}):lt(lt({},e),{},{activeItemId:null,query:"",status:"idle",collections:[]});case"submit":return lt(lt({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return lt(lt({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",query:""});case"focus":return lt(lt({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:lt(lt({},e),{},{isOpen:!1,activeItemId:null});case"mouseleave":return lt(lt({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};function ft(e){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ft(e)}function mt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(r),!0).forEach((function(t){vt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function vt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==ft(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ft(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dt(e){var t=[],r=ee(e,t),n=R(st,r,(function(e){var t=e.prevState,n=e.state;r.onStateChange(pt({prevState:t,state:n,refresh:a,navigator:r.navigator},o))})),o=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var r=0,n=e.map((function(e){return F(F({},e),{},{items:L(e.items).map((function(e){return F(F({},e),{},{__autocomplete_id:r++})}))})}));t.dispatch("setCollections",n)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:n}),i=Ge(pt({props:r,refresh:a,store:n,navigator:r.navigator},o));function a(){return Ce(pt({event:new Event("input"),nextState:{isOpen:n.getState().isOpen},props:r,navigator:r.navigator,query:n.getState().query,refresh:a,store:n},o))}if(e.insights&&!r.plugins.some((function(e){return"aa.algoliaInsightsPlugin"===e.name}))){var c="boolean"==typeof e.insights?{}:e.insights;r.plugins.push(N(c))}return r.plugins.forEach((function(e){var n;return null===(n=e.subscribe)||void 0===n?void 0:n.call(e,pt(pt({},o),{},{navigator:r.navigator,refresh:a,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))})),function(e){var t,r,n=e.metadata,o=e.environment;if(null===(t=o.navigator)||void 0===t||null===(r=t.userAgent)||void 0===r?void 0:r.includes("Algolia Crawler")){var i=o.document.createElement("meta"),a=o.document.querySelector("head");i.name="algolia:metadata",setTimeout((function(){i.content=JSON.stringify(n),a.appendChild(i)}),0)}}({metadata:nt({plugins:r.plugins,options:e}),environment:r.environment}),pt(pt({refresh:a,navigator:r.navigator},i),o)}var yt=r(27378),ht=64;function bt(e){var t=e.translations,r=(void 0===t?{}:t).searchByText,n=void 0===r?"Search by":r;return yt.createElement("a",{href:"https://www.algolia.com/ref/docsearch/?utm_source=".concat(window.location.hostname,"&utm_medium=referral&utm_content=powered_by&utm_campaign=docsearch"),target:"_blank",rel:"noopener noreferrer"},yt.createElement("span",{className:"DocSearch-Label"},n),yt.createElement("svg",{width:"77",height:"19","aria-label":"Algolia",role:"img",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2196.2 500"},yt.createElement("defs",null,yt.createElement("style",null,".cls-1,.cls-2{fill:#003dff;}.cls-2{fill-rule:evenodd;}")),yt.createElement("path",{className:"cls-2",d:"M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"}),yt.createElement("rect",{className:"cls-1",x:"1845.88",y:"104.73",width:"62.58",height:"277.9",rx:"5.9",ry:"5.9"}),yt.createElement("path",{className:"cls-2",d:"M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z"}),yt.createElement("path",{className:"cls-2",d:"M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"}),yt.createElement("path",{className:"cls-2",d:"M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z"}),yt.createElement("path",{className:"cls-2",d:"M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"}),yt.createElement("path",{className:"cls-2",d:"M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"}),yt.createElement("path",{className:"cls-2",d:"M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z"}),yt.createElement("path",{className:"cls-1",d:"M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z"})))}function gt(e){return yt.createElement("svg",{width:"15",height:"15","aria-label":e.ariaLabel,role:"img"},yt.createElement("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"},e.children))}function Ot(e){var t=e.translations,r=void 0===t?{}:t,n=r.selectText,o=void 0===n?"to select":n,i=r.selectKeyAriaLabel,a=void 0===i?"Enter key":i,c=r.navigateText,l=void 0===c?"to navigate":c,u=r.navigateUpKeyAriaLabel,s=void 0===u?"Arrow up":u,f=r.navigateDownKeyAriaLabel,m=void 0===f?"Arrow down":f,p=r.closeText,v=void 0===p?"to close":p,d=r.closeKeyAriaLabel,y=void 0===d?"Escape key":d,h=r.searchByText,b=void 0===h?"Search by":h;return yt.createElement(yt.Fragment,null,yt.createElement("div",{className:"DocSearch-Logo"},yt.createElement(bt,{translations:{searchByText:b}})),yt.createElement("ul",{className:"DocSearch-Commands"},yt.createElement("li",null,yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:a},yt.createElement("path",{d:"M12 3.53088v3c0 1-1 2-2 2H4M7 11.53088l-3-3 3-3"}))),yt.createElement("span",{className:"DocSearch-Label"},o)),yt.createElement("li",null,yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:m},yt.createElement("path",{d:"M7.5 3.5v8M10.5 8.5l-3 3-3-3"}))),yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:s},yt.createElement("path",{d:"M7.5 11.5v-8M10.5 6.5l-3-3-3 3"}))),yt.createElement("span",{className:"DocSearch-Label"},l)),yt.createElement("li",null,yt.createElement("kbd",{className:"DocSearch-Commands-Key"},yt.createElement(gt,{ariaLabel:y},yt.createElement("path",{d:"M13.6167 8.936c-.1065.3583-.6883.962-1.4875.962-.7993 0-1.653-.9165-1.653-2.1258v-.5678c0-1.2548.7896-2.1016 1.653-2.1016.8634 0 1.3601.4778 1.4875 1.0724M9 6c-.1352-.4735-.7506-.9219-1.46-.8972-.7092.0246-1.344.57-1.344 1.2166s.4198.8812 1.3445.9805C8.465 7.3992 8.968 7.9337 9 8.5c.032.5663-.454 1.398-1.4595 1.398C6.6593 9.898 6 9 5.963 8.4851m-1.4748.5368c-.2635.5941-.8099.876-1.5443.876s-1.7073-.6248-1.7073-2.204v-.4603c0-1.0416.721-2.131 1.7073-2.131.9864 0 1.6425 1.031 1.5443 2.2492h-2.956"}))),yt.createElement("span",{className:"DocSearch-Label"},v))))}function St(e){var t=e.hit,r=e.children;return yt.createElement("a",{href:t.url},r)}function jt(){return yt.createElement("svg",{width:"40",height:"40",viewBox:"0 0 20 20",fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M19 4.8a16 16 0 00-2-1.2m-3.3-1.2A16 16 0 001.1 4.7M16.7 8a12 12 0 00-2.8-1.4M10 6a12 12 0 00-6.7 2M12.3 14.7a4 4 0 00-4.5 0M14.5 11.4A8 8 0 0010 10M3 16L18 2M10 18h0"}))}function wt(e){var t=e.translations,r=void 0===t?{}:t,n=r.titleText,o=void 0===n?"Unable to fetch results":n,i=r.helpText,a=void 0===i?"You might want to check your network connection.":i;return yt.createElement("div",{className:"DocSearch-ErrorScreen"},yt.createElement("div",{className:"DocSearch-Screen-Icon"},yt.createElement(jt,null)),yt.createElement("p",{className:"DocSearch-Title"},o),yt.createElement("p",{className:"DocSearch-Help"},a))}function Et(){return yt.createElement("svg",{width:"40",height:"40",viewBox:"0 0 20 20",fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M15.5 4.8c2 3 1.7 7-1 9.7h0l4.3 4.3-4.3-4.3a7.8 7.8 0 01-9.8 1m-2.2-2.2A7.8 7.8 0 0113.2 2.4M2 18L18 2"}))}var Pt=["translations"];function It(e){return function(e){if(Array.isArray(e))return Dt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Dt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function At(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function kt(e){var t=e.translations,r=void 0===t?{}:t,n=At(e,Pt),o=r.noResultsText,i=void 0===o?"No results for":o,a=r.suggestedQueryText,c=void 0===a?"Try searching for":a,l=r.reportMissingResultsText,u=void 0===l?"Believe this query should return results?":l,s=r.reportMissingResultsLinkText,f=void 0===s?"Let us know.":s,m=n.state.context.searchSuggestions;return yt.createElement("div",{className:"DocSearch-NoResults"},yt.createElement("div",{className:"DocSearch-Screen-Icon"},yt.createElement(Et,null)),yt.createElement("p",{className:"DocSearch-Title"},i,' "',yt.createElement("strong",null,n.state.query),'"'),m&&m.length>0&&yt.createElement("div",{className:"DocSearch-NoResults-Prefill-List"},yt.createElement("p",{className:"DocSearch-Help"},c,":"),yt.createElement("ul",null,m.slice(0,3).reduce((function(e,t){return[].concat(It(e),[yt.createElement("li",{key:t},yt.createElement("button",{className:"DocSearch-Prefill",key:t,type:"button",onClick:function(){n.setQuery(t.toLowerCase()+" "),n.refresh(),n.inputRef.current.focus()}},t))])}),[]))),n.getMissingResultsUrl&&yt.createElement("p",{className:"DocSearch-Help"},"".concat(u," "),yt.createElement("a",{href:n.getMissingResultsUrl({query:n.state.query}),target:"_blank",rel:"noopener noreferrer"},f)))}var xt=function(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M17 6v12c0 .52-.2 1-1 1H4c-.7 0-1-.33-1-1V2c0-.55.42-1 1-1h8l5 5zM14 8h-3.13c-.51 0-.87-.34-.87-.87V4",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))};function Ct(e){switch(e.type){case"lvl1":return yt.createElement(xt,null);case"content":return yt.createElement(_t,null);default:return yt.createElement(Nt,null)}}function Nt(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M13 13h4-4V8H7v5h6v4-4H7V8H3h4V3v5h6V3v5h4-4v5zm-6 0v4-4H3h4z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}function _t(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M17 5H3h14zm0 5H3h14zm0 5H3h14z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))}function Tt(){return yt.createElement("svg",{className:"DocSearch-Hit-Select-Icon",width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M18 3v4c0 2-2 4-4 4H2"}),yt.createElement("path",{d:"M8 17l-6-6 6-6"})))}var qt=["hit","attribute","tagName"];function Rt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rt(Object(r),!0).forEach((function(t){Mt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ht(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Ft(e,t){return t.split(".").reduce((function(e,t){return null!=e&&e[t]?e[t]:null}),e)}function Ut(e){var t=e.hit,r=e.attribute,n=e.tagName,o=void 0===n?"span":n,i=Ht(e,qt);return(0,yt.createElement)(o,Lt(Lt({},i),{},{dangerouslySetInnerHTML:{__html:Ft(t,"_snippetResult.".concat(r,".value"))||Ft(t,r)}}))}function Bt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){c=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Vt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kt(){return Kt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kt.apply(this,arguments)}function $t(e){return e.collection&&0!==e.collection.items.length?yt.createElement("section",{className:"DocSearch-Hits"},yt.createElement("div",{className:"DocSearch-Hit-source"},e.title),yt.createElement("ul",e.getListProps(),e.collection.items.map((function(t,r){return yt.createElement(Jt,Kt({key:[e.title,t.objectID].join(":"),item:t,index:r},e))})))):null}function Jt(e){var t=e.item,r=e.index,n=e.renderIcon,o=e.renderAction,i=e.getItemProps,a=e.onItemClick,c=e.collection,l=e.hitComponent,u=Bt(yt.useState(!1),2),s=u[0],f=u[1],m=Bt(yt.useState(!1),2),p=m[0],v=m[1],d=yt.useRef(null),y=l;return yt.createElement("li",Kt({className:["DocSearch-Hit",t.__docsearch_parent&&"DocSearch-Hit--Child",s&&"DocSearch-Hit--deleting",p&&"DocSearch-Hit--favoriting"].filter(Boolean).join(" "),onTransitionEnd:function(){d.current&&d.current()}},i({item:t,source:c.source,onClick:function(e){a(t,e)}})),yt.createElement(y,{hit:t},yt.createElement("div",{className:"DocSearch-Hit-Container"},n({item:t,index:r}),t.hierarchy[t.type]&&"lvl1"===t.type&&yt.createElement("div",{className:"DocSearch-Hit-content-wrapper"},yt.createElement(Ut,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.lvl1"}),t.content&&yt.createElement(Ut,{className:"DocSearch-Hit-path",hit:t,attribute:"content"})),t.hierarchy[t.type]&&("lvl2"===t.type||"lvl3"===t.type||"lvl4"===t.type||"lvl5"===t.type||"lvl6"===t.type)&&yt.createElement("div",{className:"DocSearch-Hit-content-wrapper"},yt.createElement(Ut,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.".concat(t.type)}),yt.createElement(Ut,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),"content"===t.type&&yt.createElement("div",{className:"DocSearch-Hit-content-wrapper"},yt.createElement(Ut,{className:"DocSearch-Hit-title",hit:t,attribute:"content"}),yt.createElement(Ut,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),o({item:t,runDeleteTransition:function(e){f(!0),d.current=e},runFavoriteTransition:function(e){v(!0),d.current=e}}))))}var zt=/(<mark>|<\/mark>)/g,Wt=RegExp(zt.source);function Qt(e){var t,r,n,o,i,a=e;if(!a.__docsearch_parent&&!e._highlightResult)return e.hierarchy.lvl0;var c=((a.__docsearch_parent?null===(t=a.__docsearch_parent)||void 0===t||null===(r=t._highlightResult)||void 0===r||null===(n=r.hierarchy)||void 0===n?void 0:n.lvl0:null===(o=e._highlightResult)||void 0===o||null===(i=o.hierarchy)||void 0===i?void 0:i.lvl0)||{}).value;return c&&Wt.test(c)?c.replace(zt,""):c}function Zt(){return Zt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zt.apply(this,arguments)}function Gt(e){return yt.createElement("div",{className:"DocSearch-Dropdown-Container"},e.state.collections.map((function(t){if(0===t.items.length)return null;var r=Qt(t.items[0]);return yt.createElement($t,Zt({},e,{key:t.source.sourceId,title:r,collection:t,renderIcon:function(e){var r,n=e.item,o=e.index;return yt.createElement(yt.Fragment,null,n.__docsearch_parent&&yt.createElement("svg",{className:"DocSearch-Hit-Tree",viewBox:"0 0 24 54"},yt.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},n.__docsearch_parent!==(null===(r=t.items[o+1])||void 0===r?void 0:r.__docsearch_parent)?yt.createElement("path",{d:"M8 6v21M20 27H8.3"}):yt.createElement("path",{d:"M8 6v42M20 27H8.3"}))),yt.createElement("div",{className:"DocSearch-Hit-icon"},yt.createElement(Ct,{type:n.type})))},renderAction:function(){return yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement(Tt,null))}}))})),e.resultsFooterComponent&&yt.createElement("section",{className:"DocSearch-HitsFooter"},yt.createElement(e.resultsFooterComponent,{state:e.state})))}function Xt(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M3.18 6.6a8.23 8.23 0 1112.93 9.94h0a8.23 8.23 0 01-11.63 0"}),yt.createElement("path",{d:"M6.44 7.25H2.55V3.36M10.45 6v5.6M10.45 11.6L13 13"})))}function Yt(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M10 14.2L5 17l1-5.6-4-4 5.5-.7 2.5-5 2.5 5 5.6.8-4 4 .9 5.5z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinejoin:"round"}))}function er(){return yt.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},yt.createElement("path",{d:"M10 10l5.09-5.09L10 10l5.09 5.09L10 10zm0 0L4.91 4.91 10 10l-5.09 5.09L10 10z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}var tr=["translations"];function rr(){return rr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rr.apply(this,arguments)}function nr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function or(e){var t=e.translations,r=void 0===t?{}:t,n=nr(e,tr),o=r.recentSearchesTitle,i=void 0===o?"Recent":o,a=r.noRecentSearchesText,c=void 0===a?"No recent searches":a,l=r.saveRecentSearchButtonTitle,u=void 0===l?"Save this search":l,s=r.removeRecentSearchButtonTitle,f=void 0===s?"Remove this search from history":s,m=r.favoriteSearchesTitle,p=void 0===m?"Favorite":m,v=r.removeFavoriteSearchButtonTitle,d=void 0===v?"Remove this search from favorites":v;return"idle"===n.state.status&&!1===n.hasCollections?n.disableUserPersonalization?null:yt.createElement("div",{className:"DocSearch-StartScreen"},yt.createElement("p",{className:"DocSearch-Help"},c)):!1===n.hasCollections?null:yt.createElement("div",{className:"DocSearch-Dropdown-Container"},yt.createElement($t,rr({},n,{title:i,collection:n.state.collections[0],renderIcon:function(){return yt.createElement("div",{className:"DocSearch-Hit-icon"},yt.createElement(Xt,null))},renderAction:function(e){var t=e.item,r=e.runFavoriteTransition,o=e.runDeleteTransition;return yt.createElement(yt.Fragment,null,yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement("button",{className:"DocSearch-Hit-action-button",title:u,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),r((function(){n.favoriteSearches.add(t),n.recentSearches.remove(t),n.refresh()}))}},yt.createElement(Yt,null))),yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement("button",{className:"DocSearch-Hit-action-button",title:f,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),o((function(){n.recentSearches.remove(t),n.refresh()}))}},yt.createElement(er,null))))}})),yt.createElement($t,rr({},n,{title:p,collection:n.state.collections[1],renderIcon:function(){return yt.createElement("div",{className:"DocSearch-Hit-icon"},yt.createElement(Yt,null))},renderAction:function(e){var t=e.item,r=e.runDeleteTransition;return yt.createElement("div",{className:"DocSearch-Hit-action"},yt.createElement("button",{className:"DocSearch-Hit-action-button",title:d,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),r((function(){n.favoriteSearches.remove(t),n.refresh()}))}},yt.createElement(er,null)))}})))}var ir=["translations"];function ar(){return ar=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ar.apply(this,arguments)}function cr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var lr=yt.memo((function(e){var t=e.translations,r=void 0===t?{}:t,n=cr(e,ir);if("error"===n.state.status)return yt.createElement(wt,{translations:null==r?void 0:r.errorScreen});var o=n.state.collections.some((function(e){return e.items.length>0}));return n.state.query?!1===o?yt.createElement(kt,ar({},n,{translations:null==r?void 0:r.noResultsScreen})):yt.createElement(Gt,n):yt.createElement(or,ar({},n,{hasCollections:o,translations:null==r?void 0:r.startScreen}))}),(function(e,t){return"loading"===t.state.status||"stalled"===t.state.status}));function ur(){return yt.createElement("svg",{viewBox:"0 0 38 38",stroke:"currentColor",strokeOpacity:".5"},yt.createElement("g",{fill:"none",fillRule:"evenodd"},yt.createElement("g",{transform:"translate(1 1)",strokeWidth:"2"},yt.createElement("circle",{strokeOpacity:".3",cx:"18",cy:"18",r:"18"}),yt.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18"},yt.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 18 18",to:"360 18 18",dur:"1s",repeatCount:"indefinite"})))))}var sr=r(56573),fr=["translations"];function mr(){return mr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mr.apply(this,arguments)}function pr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function vr(e){var t=e.translations,r=void 0===t?{}:t,n=pr(e,fr),o=r.resetButtonTitle,i=void 0===o?"Clear the query":o,a=r.resetButtonAriaLabel,c=void 0===a?"Clear the query":a,l=r.cancelButtonText,u=void 0===l?"Cancel":l,s=r.cancelButtonAriaLabel,f=void 0===s?"Cancel":s,m=n.getFormProps({inputElement:n.inputRef.current}).onReset;return yt.useEffect((function(){n.autoFocus&&n.inputRef.current&&n.inputRef.current.focus()}),[n.autoFocus,n.inputRef]),yt.useEffect((function(){n.isFromSelection&&n.inputRef.current&&n.inputRef.current.select()}),[n.isFromSelection,n.inputRef]),yt.createElement(yt.Fragment,null,yt.createElement("form",{className:"DocSearch-Form",onSubmit:function(e){e.preventDefault()},onReset:m},yt.createElement("label",mr({className:"DocSearch-MagnifierLabel"},n.getLabelProps()),yt.createElement(sr.W,null)),yt.createElement("div",{className:"DocSearch-LoadingIndicator"},yt.createElement(ur,null)),yt.createElement("input",mr({className:"DocSearch-Input",ref:n.inputRef},n.getInputProps({inputElement:n.inputRef.current,autoFocus:n.autoFocus,maxLength:ht}))),yt.createElement("button",{type:"reset",title:i,className:"DocSearch-Reset","aria-label":c,hidden:!n.state.query},yt.createElement(er,null))),yt.createElement("button",{className:"DocSearch-Cancel",type:"reset","aria-label":f,onClick:n.onClose},u))}var dr=["_highlightResult","_snippetResult"];function yr(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function hr(e){return!1===function(){var e="__TEST_KEY__";try{return localStorage.setItem(e,""),localStorage.removeItem(e),!0}catch(t){return!1}}()?{setItem:function(){},getItem:function(){return[]}}:{setItem:function(t){return window.localStorage.setItem(e,JSON.stringify(t))},getItem:function(){var t=window.localStorage.getItem(e);return t?JSON.parse(t):[]}}}function br(e){var t=e.key,r=e.limit,n=void 0===r?5:r,o=hr(t),i=o.getItem().slice(0,n);return{add:function(e){var t=e,r=(t._highlightResult,t._snippetResult,yr(t,dr)),a=i.findIndex((function(e){return e.objectID===r.objectID}));a>-1&&i.splice(a,1),i.unshift(r),i=i.slice(0,n),o.setItem(i)},remove:function(e){i=i.filter((function(t){return t.objectID!==e.objectID})),o.setItem(i)},getAll:function(){return i}}}function gr(e){const t=`algoliasearch-client-js-${e.key}`;let r;const n=()=>(void 0===r&&(r=e.localStorage||window.localStorage),r),o=()=>JSON.parse(n().getItem(t)||"{}"),i=e=>{n().setItem(t,JSON.stringify(e))};return{get:(t,r,n={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{(()=>{const t=e.timeToLive?1e3*e.timeToLive:null,r=o(),n=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(i(n),!t)return;const a=Object.fromEntries(Object.entries(n).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)})));i(a)})();const r=JSON.stringify(t);return o()[r]})).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||n.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve().then((()=>{const i=o();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:r},n().setItem(t,JSON.stringify(i)),r})),delete:e=>Promise.resolve().then((()=>{const r=o();delete r[JSON.stringify(e)],n().setItem(t,JSON.stringify(r))})),clear:()=>Promise.resolve().then((()=>{n().removeItem(t)}))}}function Or(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,n,o={miss:()=>Promise.resolve()})=>r.get(e,n,o).catch((()=>Or({caches:t}).get(e,n,o))),set:(e,n)=>r.set(e,n).catch((()=>Or({caches:t}).set(e,n))),delete:e=>r.delete(e).catch((()=>Or({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>Or({caches:t}).clear()))}}function Sr(e={serializable:!0}){let t={};return{get(r,n,o={miss:()=>Promise.resolve()}){const i=JSON.stringify(r);if(i in t)return Promise.resolve(e.serializable?JSON.parse(t[i]):t[i]);const a=n(),c=o&&o.miss||(()=>Promise.resolve());return a.then((e=>c(e))).then((()=>a))},set:(r,n)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}function jr(e){let t=e.length-1;for(;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function wr(e,t){return t?(Object.keys(t).forEach((r=>{e[r]=t[r](e)})),e):e}function Er(e,...t){let r=0;return e.replace(/%s/g,(()=>encodeURIComponent(t[r++])))}const Pr="4.19.0",Ir={WithinQueryParameters:0,WithinHeaders:1};function Dr(e,t){const r=e||{},n=r.data||{};return Object.keys(r).forEach((e=>{-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}const Ar={Read:1,Write:2,Any:3},kr={Up:1,Down:2,Timeouted:3},xr=12e4;function Cr(e,t=kr.Up){return{...e,status:t,lastUpdate:Date.now()}}function Nr(e){return"string"==typeof e?{protocol:"https",url:e,accept:Ar.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||Ar.Any}}const _r={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};function Tr(e,t){return Promise.all(t.map((t=>e.get(t,(()=>Promise.resolve(Cr(t))))))).then((e=>{const r=e.filter((e=>function(e){return e.status===kr.Up||Date.now()-e.lastUpdate>xr}(e))),n=e.filter((e=>function(e){return e.status===kr.Timeouted&&Date.now()-e.lastUpdate<=xr}(e))),o=[...r,...n];return{getTimeout:(e,t)=>(0===n.length&&0===e?1:n.length+3+e)*t,statelessHosts:o.length>0?o.map((e=>Nr(e))):t}}))}const qr=(e,t)=>(e=>{const t=e.status;return e.isTimedOut||(({isTimedOut:e,status:t})=>!e&&0==~~t)(e)||2!=~~(t/100)&&4!=~~(t/100)})(e)?t.onRetry(e):(({status:e})=>2==~~(e/100))(e)?t.onSuccess(e):t.onFail(e);function Rr(e,t,r,n){const o=[],i=function(e,t){if(e.method===_r.Get||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(r,n),a=function(e,t){const r={...e.headers,...t.headers},n={};return Object.keys(r).forEach((e=>{const t=r[e];n[e.toLowerCase()]=t})),n}(e,n),c=r.method,l=r.method!==_r.Get?{}:{...r.data,...n.data},u={"x-algolia-agent":e.userAgent.value,...e.queryParameters,...l,...n.queryParameters};let s=0;const f=(t,l)=>{const m=t.pop();if(void 0===m)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:Fr(o)};const p={data:i,headers:a,method:c,url:Mr(m,r.path,u),connectTimeout:l(s,e.timeouts.connect),responseTimeout:l(s,n.timeout)},v=e=>{const r={request:p,response:e,host:m,triesLeft:t.length};return o.push(r),r},d={onSuccess:e=>function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e),onRetry(r){const n=v(r);return r.isTimedOut&&s++,Promise.all([e.logger.info("Retryable failure",Ur(n)),e.hostsCache.set(m,Cr(m,r.isTimedOut?kr.Timeouted:kr.Down))]).then((()=>f(t,l)))},onFail(e){throw v(e),function({content:e,status:t},r){let n=e;try{n=JSON.parse(e).message}catch(o){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(n,t,r)}(e,Fr(o))}};return e.requester.send(p).then((e=>qr(e,d)))};return Tr(e.hostsCache,t).then((e=>f([...e.statelessHosts].reverse(),e.getTimeout)))}function Lr(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}function Mr(e,t,r){const n=Hr(r);let o=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return n.length&&(o+=`?${n}`),o}function Hr(e){return Object.keys(e).map((t=>{return Er("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function Fr(e){return e.map((e=>Ur(e)))}function Ur(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}const Br=e=>{const t=e.appId,r=function(e,t,r){const n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:()=>e===Ir.WithinHeaders?n:{},queryParameters:()=>e===Ir.WithinQueryParameters?n:{}}}(void 0!==e.authMode?e.authMode:Ir.WithinHeaders,t,e.apiKey),n=function(e){const{hostsCache:t,logger:r,requester:n,requestsCache:o,responsesCache:i,timeouts:a,userAgent:c,hosts:l,queryParameters:u,headers:s}=e,f={hostsCache:t,logger:r,requester:n,requestsCache:o,responsesCache:i,timeouts:a,userAgent:c,headers:s,queryParameters:u,hosts:l.map((e=>Nr(e))),read(e,t){const r=Dr(t,f.timeouts.read),n=()=>Rr(f,f.hosts.filter((e=>0!=(e.accept&Ar.Read))),e,r);if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();const o={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(o,(()=>f.requestsCache.get(o,(()=>f.requestsCache.set(o,n()).then((e=>Promise.all([f.requestsCache.delete(o),e])),(e=>Promise.all([f.requestsCache.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.responsesCache.set(o,e)})},write:(e,t)=>Rr(f,f.hosts.filter((e=>0!=(e.accept&Ar.Write))),e,Dr(t,f.timeouts.write))};return f}({hosts:[{url:`${t}-dsn.algolia.net`,accept:Ar.Read},{url:`${t}.algolia.net`,accept:Ar.Write}].concat(jr([{url:`${t}-1.algolianet.com`},{url:`${t}-2.algolianet.com`},{url:`${t}-3.algolianet.com`}])),...e,headers:{...r.headers(),"content-type":"application/x-www-form-urlencoded",...e.headers},queryParameters:{...r.queryParameters(),...e.queryParameters}}),o={transporter:n,appId:t,addAlgoliaAgent(e,t){n.userAgent.add({segment:e,version:t})},clearCache:()=>Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then((()=>{}))};return wr(o,e.methods)},Vr=e=>(t,r)=>t.method===_r.Get?e.transporter.read(t,r):e.transporter.write(t,r),Kr=e=>(t,r={})=>wr({transporter:e.transporter,appId:e.appId,indexName:t},r.methods),$r=e=>(t,r)=>{const n=t.map((e=>({...e,params:Hr(e.params||{})})));return e.transporter.read({method:_r.Post,path:"1/indexes/*/queries",data:{requests:n},cacheable:!0},r)},Jr=e=>(t,r)=>Promise.all(t.map((t=>{const{facetName:n,facetQuery:o,...i}=t.params;return Kr(e)(t.indexName,{methods:{searchForFacetValues:Qr}}).searchForFacetValues(n,o,{...r,...i})}))),zr=e=>(t,r,n)=>e.transporter.read({method:_r.Post,path:Er("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n),Wr=e=>(t,r)=>e.transporter.read({method:_r.Post,path:Er("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r),Qr=e=>(t,r,n)=>e.transporter.read({method:_r.Post,path:Er("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n),Zr={Debug:1,Info:2,Error:3};function Gr(e,t,r){const n={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:e=>new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const n=(e,n)=>setTimeout((()=>{r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e),o=n(e.connectTimeout,"Connection timeout");let i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===i&&(clearTimeout(o),i=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(o),clearTimeout(i),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(o),clearTimeout(i),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))},logger:(o=Zr.Error,{debug:(e,t)=>(Zr.Debug>=o&&console.debug(e,t),Promise.resolve()),info:(e,t)=>(Zr.Info>=o&&console.info(e,t),Promise.resolve()),error:(e,t)=>(console.error(e,t),Promise.resolve())}),responsesCache:Sr(),requestsCache:Sr({serializable:!1}),hostsCache:Or({caches:[gr({key:`${Pr}-${e}`}),Sr()]}),userAgent:Lr(Pr).add({segment:"Browser",version:"lite"}),authMode:Ir.WithinQueryParameters};var o;return Br({...n,...r,methods:{search:$r,searchForFacetValues:Jr,multipleQueries:$r,multipleSearchForFacetValues:Jr,customRequest:Vr,initIndex:e=>t=>Kr(e)(t,{methods:{search:Wr,searchForFacetValues:Qr,findAnswers:zr}})}})}Gr.version=Pr;const Xr=Gr;var Yr="3.5.1";function en(){}function tn(e){return e}function rn(e){return 1===e.button||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function nn(e,t,r){return e.reduce((function(e,n){var o=t(n);return e.hasOwnProperty(o)||(e[o]=[]),e[o].length<(r||5)&&e[o].push(n),e}),{})}var on=["footer","searchBox"];function an(){return an=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},an.apply(this,arguments)}function cn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cn(Object(r),!0).forEach((function(t){un(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function un(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){c=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function mn(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function pn(e){var t=e.appId,r=e.apiKey,n=e.indexName,o=e.placeholder,i=void 0===o?"Search docs":o,a=e.searchParameters,c=e.maxResultsPerGroup,l=e.onClose,u=void 0===l?en:l,s=e.transformItems,f=void 0===s?tn:s,m=e.hitComponent,p=void 0===m?St:m,v=e.resultsFooterComponent,d=void 0===v?function(){return null}:v,y=e.navigator,h=e.initialScrollY,b=void 0===h?0:h,g=e.transformSearchClient,O=void 0===g?tn:g,S=e.disableUserPersonalization,j=void 0!==S&&S,w=e.initialQuery,E=void 0===w?"":w,P=e.translations,I=void 0===P?{}:P,D=e.getMissingResultsUrl,A=e.insights,k=void 0!==A&&A,x=I.footer,C=I.searchBox,N=mn(I,on),_=sn(yt.useState({query:"",collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:"idle"}),2),T=_[0],q=_[1],R=yt.useRef(null),L=yt.useRef(null),M=yt.useRef(null),H=yt.useRef(null),F=yt.useRef(null),U=yt.useRef(10),B=yt.useRef("undefined"!=typeof window?window.getSelection().toString().slice(0,ht):"").current,V=yt.useRef(E||B).current,K=function(e,t,r){return yt.useMemo((function(){var n=Xr(e,t);return n.addAlgoliaAgent("docsearch",Yr),!1===/docsearch.js \(.*\)/.test(n.transporter.userAgent.value)&&n.addAlgoliaAgent("docsearch-react",Yr),r(n)}),[e,t,r])}(t,r,O),$=yt.useRef(br({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(n),limit:10})).current,J=yt.useRef(br({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(n),limit:0===$.getAll().length?7:4})).current,z=yt.useCallback((function(e){if(!j){var t="content"===e.type?e.__docsearch_parent:e;t&&-1===$.getAll().findIndex((function(e){return e.objectID===t.objectID}))&&J.add(t)}}),[$,J,j]),W=yt.useCallback((function(e){if(T.context.algoliaInsightsPlugin&&e.__autocomplete_id){var t=e,r={eventName:"Item Selected",index:t.__autocomplete_indexName,items:[t],positions:[e.__autocomplete_id],queryID:t.__autocomplete_queryID};T.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch(r)}}),[T.context.algoliaInsightsPlugin]),Q=yt.useMemo((function(){return dt({id:"docsearch",defaultActiveItemId:0,placeholder:i,openOnFocus:!0,initialState:{query:V,context:{searchSuggestions:[]}},insights:k,navigator:y,onStateChange:function(e){q(e.state)},getSources:function(e){var o=e.query,i=e.state,l=e.setContext,s=e.setStatus;if(!o)return j?[]:[{sourceId:"recentSearches",onSelect:function(e){var t=e.item,r=e.event;z(t),rn(r)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return J.getAll()}},{sourceId:"favoriteSearches",onSelect:function(e){var t=e.item,r=e.event;z(t),rn(r)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return $.getAll()}}];var m=Boolean(k);return K.search([{query:o,indexName:n,params:ln({attributesToRetrieve:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"],attributesToSnippet:["hierarchy.lvl1:".concat(U.current),"hierarchy.lvl2:".concat(U.current),"hierarchy.lvl3:".concat(U.current),"hierarchy.lvl4:".concat(U.current),"hierarchy.lvl5:".concat(U.current),"hierarchy.lvl6:".concat(U.current),"content:".concat(U.current)],snippetEllipsisText:"\u2026",highlightPreTag:"<mark>",highlightPostTag:"</mark>",hitsPerPage:20,clickAnalytics:m},a)}]).catch((function(e){throw"RetryError"===e.name&&s("error"),e})).then((function(e){var o=e.results,a=o[0],s=a.hits,p=a.nbHits,v=nn(s,(function(e){return Qt(e)}),c);i.context.searchSuggestions.length<Object.keys(v).length&&l({searchSuggestions:Object.keys(v)}),l({nbHits:p});var d={};return m&&(d={__autocomplete_indexName:n,__autocomplete_queryID:o[0].queryID,__autocomplete_algoliaCredentials:{appId:t,apiKey:r}}),Object.values(v).map((function(e,t){return{sourceId:"hits".concat(t),onSelect:function(e){var t=e.item,r=e.event;z(t),rn(r)||u()},getItemUrl:function(e){return e.item.url},getItems:function(){return Object.values(nn(e,(function(e){return e.hierarchy.lvl1}),c)).map(f).map((function(e){return e.map((function(t){var r=null,n=e.find((function(e){return"lvl1"===e.type&&e.hierarchy.lvl1===t.hierarchy.lvl1}));return"lvl1"!==t.type&&n&&(r=n),ln(ln({},t),{},{__docsearch_parent:r},d)}))})).flat()}}}))}))}})}),[n,a,c,K,u,J,$,z,V,i,y,f,j,k,t,r]),Z=Q.getEnvironmentProps,G=Q.getRootProps,X=Q.refresh;return function(e){var t=e.getEnvironmentProps,r=e.panelElement,n=e.formElement,o=e.inputElement;yt.useEffect((function(){if(r&&n&&o){var e=t({panelElement:r,formElement:n,inputElement:o}),i=e.onTouchStart,a=e.onTouchMove;return window.addEventListener("touchstart",i),window.addEventListener("touchmove",a),function(){window.removeEventListener("touchstart",i),window.removeEventListener("touchmove",a)}}}),[t,r,n,o])}({getEnvironmentProps:Z,panelElement:H.current,formElement:M.current,inputElement:F.current}),function(e){var t=e.container;yt.useEffect((function(){if(t){var e=t.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), input:not([disabled])"),r=e[0],n=e[e.length-1];return t.addEventListener("keydown",o),function(){t.removeEventListener("keydown",o)}}function o(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===r&&(e.preventDefault(),n.focus()):document.activeElement===n&&(e.preventDefault(),r.focus()))}}),[t])}({container:R.current}),yt.useEffect((function(){return document.body.classList.add("DocSearch--active"),function(){var e,t;document.body.classList.remove("DocSearch--active"),null===(e=(t=window).scrollTo)||void 0===e||e.call(t,0,b)}}),[]),yt.useEffect((function(){window.matchMedia("(max-width: 768px)").matches&&(U.current=5)}),[]),yt.useEffect((function(){H.current&&(H.current.scrollTop=0)}),[T.query]),yt.useEffect((function(){V.length>0&&(X(),F.current&&F.current.focus())}),[V,X]),yt.useEffect((function(){function e(){if(L.current){var e=.01*window.innerHeight;L.current.style.setProperty("--docsearch-vh","".concat(e,"px"))}}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),yt.createElement("div",an({ref:R},G({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container","stalled"===T.status&&"DocSearch-Container--Stalled","error"===T.status&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(e){e.target===e.currentTarget&&u()}}),yt.createElement("div",{className:"DocSearch-Modal",ref:L},yt.createElement("header",{className:"DocSearch-SearchBar",ref:M},yt.createElement(vr,an({},Q,{state:T,autoFocus:0===V.length,inputRef:F,isFromSelection:Boolean(V)&&V===B,translations:C,onClose:u}))),yt.createElement("div",{className:"DocSearch-Dropdown",ref:H},yt.createElement(lr,an({},Q,{indexName:n,state:T,hitComponent:p,resultsFooterComponent:d,disableUserPersonalization:j,recentSearches:J,favoriteSearches:$,inputRef:F,translations:N,getMissingResultsUrl:D,onItemClick:function(e,t){W(e),z(e),rn(t)||u()}}))),yt.createElement("footer",{className:"DocSearch-Footer"},yt.createElement(Ot,{translations:x}))))}}}]); \ No newline at end of file diff --git a/assets/js/30943bfd.4a4d1e70.js b/assets/js/30943bfd.4a4d1e70.js new file mode 100644 index 00000000000..50bdc83cb0d --- /dev/null +++ b/assets/js/30943bfd.4a4d1e70.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4997],{35318:(t,e,r)=>{r.d(e,{Zo:()=>d,kt:()=>u});var n=r(27378);function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function p(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r,n,a={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(a[r]=t[r]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}var l=n.createContext({}),s=function(t){var e=n.useContext(l),r=e;return t&&(r="function"==typeof t?t(e):o(o({},e),t)),r},d=function(t){var e=s(t.components);return n.createElement(l.Provider,{value:e},t.children)},c="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},g=n.forwardRef((function(t,e){var r=t.components,a=t.mdxType,i=t.originalType,l=t.parentName,d=p(t,["components","mdxType","originalType","parentName"]),c=s(r),g=a,u=c["".concat(l,".").concat(g)]||c[g]||m[g]||i;return r?n.createElement(u,o(o({ref:e},d),{},{components:r})):n.createElement(u,o({ref:e},d))}));function u(t,e){var r=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=r.length,o=new Array(i);o[0]=g;var p={};for(var l in e)hasOwnProperty.call(e,l)&&(p[l]=e[l]);p.originalType=t,p[c]="string"==typeof t?t:a,o[1]=p;for(var s=2;s<i;s++)o[s]=r[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}g.displayName="MDXCreateElement"},2403:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>l,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var n=r(25773),a=(r(27378),r(35318));const i={description:"ESP32-C3FH4-RGB"},o="ESP32-C3FH4-RGB",p={unversionedId:"devices/esp32/esp32-c3fh4-rgb",id:"devices/esp32/esp32-c3fh4-rgb",title:"ESP32-C3FH4-RGB",description:"ESP32-C3FH4-RGB",source:"@site/docs/devices/esp32/esp32-c3fh4-rgb.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32-c3fh4-rgb",permalink:"/devicescript/devices/esp32/esp32-c3fh4-rgb",draft:!1,tags:[],version:"current",frontMatter:{description:"ESP32-C3FH4-RGB"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32 (bare)",permalink:"/devicescript/devices/esp32/esp32-bare"},next:{title:"Espressif ESP32-DevKitC",permalink:"/devicescript/devices/esp32/esp32-devkit-c"}},l={},s=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Driver",id:"driver",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:s},c="wrapper";function m(t){let{components:e,...r}=t;return(0,a.kt)(c,(0,n.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"esp32-c3fh4-rgb"},"ESP32-C3FH4-RGB"),(0,a.kt)("p",null,"A tiny ESP32-C3 board with 5x5 LED array."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/01space/esp32c3fh4rgbv10.catalog.jpg",alt:"ESP32-C3FH4-RGB picture"})),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"I2C on 0/1 using Qwiic connector"),(0,a.kt)("li",{parentName:"ul"},"LED on pin 10 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin 21 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: buttonBOOT (button)")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/01Space/ESP32-C3FH4-RGB"},"https://github.com/01Space/ESP32-C3FH4-RGB")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://usa.banggood.com/ESP32-C3-Development-Board-RISC-V-WiFi-Bluetooth-IoT-Development-Board-Compatible-with-Python-p-1914005.html?imageAb=2&akmClientCountry=America&a=1694552315.7453&akmClientCountry=America&cur_warehouse=CN"},"https://usa.banggood.com/ESP32-C3-Development-Board-RISC-V-WiFi-Bluetooth-IoT-Development-Board-Compatible-with-Python-p-1914005.html?imageAb=2&akmClientCountry=America&a=1694552315.7453&akmClientCountry=America&cur_warehouse=CN"))),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"LEDS")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P2")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P20")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,a.kt)("td",{parentName:"tr",align:"right"},"bootUart, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P3")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P4")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P5")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P6")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P7")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"$services.buttonBOOT","[0]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,a.kt)("td",{parentName:"tr",align:"right"},"$services.buttonBOOT","[0]",".pin, boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"i2c.pinSCL")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,a.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"i2c.pinSDA")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,a.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"log.pinTX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, bootUart, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "ESP32-C3FH4-RGB".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32_c3fh4_rgb"\n')),(0,a.kt)("h2",{id:"driver"},"Driver"),(0,a.kt)("p",null,"The LEDs can be controlled as a LED strip or a display."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Esp32C3FH4RGB } from "@devicescript/drivers"\nimport { startLedDisplay } from "@devicescript/runtime"\n\nconst board = new Esp32C3FH4RGB()\nconst led = await board.startLed()\nawait led.intensity.write(0.05)\nconst display = await startLedDisplay(led)\n\nconst n = display.palette.length\nlet k = 0\nfor (let y = 0; y < 5; ++y)\n for (let x = 0; x < 5; ++x) \n await display.image.set(x, y, k++ % n)\nawait display.show()\n')),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32_c3fh4_rgb\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32_c3fh4_rgb-0x0.bin"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32_c3fh4_rgb.json"',title:'"esp32_c3fh4_rgb.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32_c3fh4_rgb",\n "devName": "ESP32-C3FH4-RGB",\n "productId": "0x3a90885c",\n "$description": "A tiny ESP32-C3 board with 5x5 LED array.",\n "archId": "esp32c3",\n "url": "https://github.com/01Space/ESP32-C3FH4-RGB",\n "$services": [\n {\n "name": "buttonBOOT",\n "pin": 9,\n "service": "button"\n }\n ],\n "i2c": {\n "$connector": "Qwiic",\n "pinSCL": 1,\n "pinSDA": 0\n },\n "led": {\n "isMono": true,\n "pin": 10\n },\n "log": {\n "pinTX": 21\n },\n "pins": {\n "LEDS": 8,\n "P2": 2,\n "P20": 20,\n "P3": 3,\n "P4": 4,\n "P5": 5,\n "P6": 6,\n "P7": 7\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3287d67a.a219c785.js b/assets/js/3287d67a.a219c785.js new file mode 100644 index 00000000000..71402748562 --- /dev/null +++ b/assets/js/3287d67a.a219c785.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9657],{35318:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>v});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),s=c(r),m=i,v=s["".concat(p,".").concat(m)]||s[m]||u[m]||o;return r?n.createElement(v,a(a({ref:t},d),{},{components:r})):n.createElement(v,a({ref:t},d))}));function v(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[s]="string"==typeof e?e:i,a[1]=l;for(var c=2;c<o;c++)a[c]=r[c];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},68392:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(25773),i=(r(27378),r(35318));const o={sidebar_position:1},a="Developer",l={unversionedId:"developer/index",id:"developer/index",title:"Developer",description:"The DeviceScript developer experience is designed to be friendly with developers familiar with TypeScript projects.",source:"@site/docs/developer/index.mdx",sourceDirName:"developer",slug:"/developer/",permalink:"/devicescript/developer/",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Command Line",permalink:"/devicescript/getting-started/cli"},next:{title:"Console output",permalink:"/devicescript/developer/console"}},p={},c=[{value:"Visual Studio Code extension",id:"visual-studio-code-extension",level:2},{value:"Command Line",id:"command-line",level:2}],d={toc:c},s="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(s,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"developer"},"Developer"),(0,i.kt)("p",null,"The DeviceScript developer experience is designed to be friendly with developers familiar with TypeScript projects.\nDeviceScript uses the TypeScript syntax and the developer tooling does not require any special hardware"),(0,i.kt)("h2",{id:"visual-studio-code-extension"},"Visual Studio Code extension"),(0,i.kt)("p",null,"Visual Studio and the DeviceScript Extension provide the best developer experience, with building, deploying, debugging,\ntracing, device monitoring and other developer productivity features."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/getting-started/vscode"},"Getting started with Visual Studio Code"))),(0,i.kt)("h2",{id:"command-line"},"Command Line"),(0,i.kt)("p",null,"The command line is IDE agnostic and will let you script your own developer experience."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/getting-started/cli"},"Getting started with command line"))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"If you are developing the C firmware for DeviceScript,\nyou will need a more traditional embedded development setup.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3352a21f.4b1ee331.js b/assets/js/3352a21f.4b1ee331.js new file mode 100644 index 00000000000..f2f85f22c8c --- /dev/null +++ b/assets/js/3352a21f.4b1ee331.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4050],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),y=a,f=u["".concat(p,".").concat(y)]||u[y]||d[y]||i;return r?n.createElement(f,o(o({ref:t},c),{},{components:r})):n.createElement(f,o({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=y;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var s=2;s<i;s++)o[s]=r[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},31694:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var n=r(25773),a=(r(27378),r(35318));const i={description:"Mounts a relay server",title:"Relay"},o="Relay",l={unversionedId:"api/drivers/relay",id:"api/drivers/relay",title:"Relay",description:"Mounts a relay server",source:"@site/docs/api/drivers/relay.md",sourceDirName:"api/drivers",slug:"/api/drivers/relay",permalink:"/devicescript/api/drivers/relay",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a relay server",title:"Relay"},sidebar:"tutorialSidebar",previous:{title:"Reflected Light",permalink:"/devicescript/api/drivers/reflectedlight"},next:{title:"Rotary Encoder",permalink:"/devicescript/api/drivers/rotaryencoder"}},p={},s=[{value:"Options",id:"options",level:2},{value:"pin",id:"pin",level:3},{value:"options",id:"options-1",level:3}],c={toc:s},u="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"relay"},"Relay"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"startRelay")," function starts a ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/relay"},"relay")," server on the device\nand returns a ",(0,a.kt)("a",{parentName:"p",href:"/api/clients/relay"},"client"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startRelay } from "@devicescript/servers"\n\nconst relay = startRelay({\n pin: gpio(2),\n})\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,a.kt)("inlineCode",{parentName:"p"},"relay"),"."),(0,a.kt)("h2",{id:"options"},"Options"),(0,a.kt)("h3",{id:"pin"},"pin"),(0,a.kt)("p",null,"The pin hardware identifier on which to mount the relay."),(0,a.kt)("h3",{id:"options-1"},"options"),(0,a.kt)("p",null,"Other configuration options are available in the options parameter."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/338b64d9.8a72abe6.js b/assets/js/338b64d9.8a72abe6.js new file mode 100644 index 00000000000..47ad3a9f08a --- /dev/null +++ b/assets/js/338b64d9.8a72abe6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4995],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},b=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),b=o,f=u["".concat(s,".").concat(b)]||u[b]||d[b]||i;return n?r.createElement(f,a(a({ref:t},p),{},{components:n})):r.createElement(f,a({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=b;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,a[1]=l;for(var c=2;c<i;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}b.displayName="MDXCreateElement"},55049:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var r=n(25773),o=(n(27378),n(35318));const i={sidebar_position:3,hide_table_of_contents:!0},a="Double Blinky",l={unversionedId:"samples/double-blinky",id:"samples/double-blinky",title:"Double Blinky",description:"This example shows how to blink two LEDs at a different rate.",source:"@site/docs/samples/double-blinky.mdx",sourceDirName:"samples",slug:"/samples/double-blinky",permalink:"/devicescript/samples/double-blinky",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Schedule Blinky",permalink:"/devicescript/samples/schedule-blinky"},next:{title:"Button LED",permalink:"/devicescript/samples/button-led"}},s={},c=[],p={toc:c},u="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"double-blinky"},"Double Blinky"),(0,o.kt)("p",null,"This example shows how to blink two LEDs at a different rate.\nYou can use multiple ",(0,o.kt)("inlineCode",{parentName:"p"},"setInterval")," to schedule different tasks,\nin this case toggling the LED status."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/esp32c3_bare"\nimport { startLightBulb } from "@devicescript/servers"\n\n// start a lightbulb drivers on pin GP1 and GP2\nconst led1 = startLightBulb({\n pin: pins.P1,\n})\nconst led2 = startLightBulb({\n pin: pins.P2,\n})\n\n// start interval timer every 1000ms\nsetInterval(async () => {\n // toggle on/off\n await led1.toggle()\n}, 1000)\n\n// start interval timer every 250ms\nsetInterval(async () => {\n // toggle on/off\n await led2.toggle()\n}, 250)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/34179c72.41e9780c.js b/assets/js/34179c72.41e9780c.js new file mode 100644 index 00000000000..49b324936ee --- /dev/null +++ b/assets/js/34179c72.41e9780c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8802],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>y});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(r),f=a,y=d["".concat(l,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(y,o(o({ref:t},s),{},{components:r})):n.createElement(y,o({ref:t},s))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var p=2;p<i;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},37646:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=r(25773),a=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for HID Keyboard service"},o="HidKeyboard",c={unversionedId:"api/clients/hidkeyboard",id:"api/clients/hidkeyboard",title:"HidKeyboard",description:"DeviceScript client for HID Keyboard service",source:"@site/docs/api/clients/hidkeyboard.md",sourceDirName:"api/clients",slug:"/api/clients/hidkeyboard",permalink:"/devicescript/api/clients/hidkeyboard",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for HID Keyboard service"},sidebar:"tutorialSidebar"},l={},p=[{value:"Commands",id:"commands",level:2},{value:"clear",id:"clear",level:3}],s={toc:p},d="wrapper";function u(e){let{components:t,...r}=e;return(0,a.kt)(d,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"hidkeyboard"},"HidKeyboard"),(0,a.kt)("p",null,"Control a HID keyboard."),(0,a.kt)("p",null,"The codes for the key (selectors) is defined in the ",(0,a.kt)("a",{parentName:"p",href:"https://usb.org/sites/default/files/hut1_21.pdf"},"HID Keyboard\nspecification"),", chapter 10 Keyboard/Keypad Page, page 81.\nModifiers are in page 87."),(0,a.kt)("p",null,"The device keeps tracks of the key state and is able to clear it all with the clear command."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { HidKeyboard } from "@devicescript/core"\n\nconst hidKeyboard = new HidKeyboard()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"clear"},"clear"),(0,a.kt)("p",null,"Clears all pressed keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"hidKeyboard.clear(): Promise<void>\n")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/34b3ce2d.d3f4fb14.js b/assets/js/34b3ce2d.d3f4fb14.js new file mode 100644 index 00000000000..ee438eb0ef4 --- /dev/null +++ b/assets/js/34b3ce2d.d3f4fb14.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9900],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=l(r),d=i,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return r?n.createElement(m,c(c({ref:t},s),{},{components:r})):n.createElement(m,c({ref:t},s))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,c=new Array(a);c[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,c[1]=o;for(var l=2;l<a;l++)c[l]=r[l];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},55297:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>o,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,unlisted:!0},c="DeviceScriptManager",o={unversionedId:"api/clients/devicescriptmanager",id:"api/clients/devicescriptmanager",title:"DeviceScriptManager",description:"The DeviceScript Manager service is used internally by the runtime",source:"@site/docs/api/clients/devicescriptmanager.md",sourceDirName:"api/clients",slug:"/api/clients/devicescriptmanager",permalink:"/devicescript/api/clients/devicescriptmanager",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},p={},l=[],s={toc:l},u="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"devicescriptmanager"},"DeviceScriptManager"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/devicescriptmanager/"},"DeviceScript Manager service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/351c4745.20e3a2b0.js b/assets/js/351c4745.20e3a2b0.js new file mode 100644 index 00000000000..cb994148f8a --- /dev/null +++ b/assets/js/351c4745.20e3a2b0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8053],{35318:(e,t,r)=>{r.d(t,{Zo:()=>g,kt:()=>c});var a=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=a.createContext({}),p=function(e){var t=a.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},g=function(e){var t=p(e.components);return a.createElement(o.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,o=e.parentName,g=s(e,["components","mdxType","originalType","parentName"]),m=p(r),u=n,c=m["".concat(o,".").concat(u)]||m[u]||d[u]||i;return r?a.createElement(c,l(l({ref:t},g),{},{components:r})):a.createElement(c,l({ref:t},g))}));function c(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,l=new Array(i);l[0]=u;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[m]="string"==typeof e?e:n,l[1]=s;for(var p=2;p<i;p++)l[p]=r[p];return a.createElement.apply(null,l)}return a.createElement.apply(null,r)}u.displayName="MDXCreateElement"},35980:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var a=r(25773),n=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Timeseries Aggregator service"},l="TimeseriesAggregator",s={unversionedId:"api/clients/timeseriesaggregator",id:"api/clients/timeseriesaggregator",title:"TimeseriesAggregator",description:"DeviceScript client for Timeseries Aggregator service",source:"@site/docs/api/clients/timeseriesaggregator.md",sourceDirName:"api/clients",slug:"/api/clients/timeseriesaggregator",permalink:"/devicescript/api/clients/timeseriesaggregator",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Timeseries Aggregator service"},sidebar:"tutorialSidebar"},o={},p=[{value:"Commands",id:"commands",level:2},{value:"clear",id:"clear",level:3},{value:"update",id:"update",level:3},{value:"setWindow",id:"setwindow",level:3},{value:"setUpload",id:"setupload",level:3},{value:"Registers",id:"registers",level:2},{value:"now",id:"ro:now",level:3},{value:"fastStart",id:"rw:fastStart",level:3},{value:"defaultWindow",id:"rw:defaultWindow",level:3},{value:"defaultUpload",id:"rw:defaultUpload",level:3},{value:"uploadUnlabelled",id:"rw:uploadUnlabelled",level:3},{value:"sensorWatchdogPeriod",id:"rw:sensorWatchdogPeriod",level:3}],g={toc:p},m="wrapper";function d(e){let{components:t,...r}=e;return(0,n.kt)(m,(0,a.Z)({},g,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"timeseriesaggregator"},"TimeseriesAggregator"),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,n.kt)("p",null,"Supports aggregating timeseries data (especially sensor readings)\nand sending them to a cloud/storage service.\nUsed in DeviceScript."),(0,n.kt)("p",null,"Note that ",(0,n.kt)("inlineCode",{parentName:"p"},"f64")," values are not necessarily aligned."),(0,n.kt)("p",null),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"commands"},"Commands"),(0,n.kt)("h3",{id:"clear"},"clear"),(0,n.kt)("p",null,"Remove all pending timeseries."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"timeseriesAggregator.clear(): Promise<void>\n")),(0,n.kt)("h3",{id:"update"},"update"),(0,n.kt)("p",null,"Add a data point to a timeseries."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"timeseriesAggregator.update(value: number, label: string): Promise<void>\n")),(0,n.kt)("h3",{id:"setwindow"},"setWindow"),(0,n.kt)("p",null,"Set aggregation window.\nSetting to ",(0,n.kt)("inlineCode",{parentName:"p"},"0")," will restore default."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"timeseriesAggregator.setWindow(duration: number, label: string): Promise<void>\n")),(0,n.kt)("h3",{id:"setupload"},"setUpload"),(0,n.kt)("p",null,"Set whether or not the timeseries will be uploaded to the cloud.\nThe ",(0,n.kt)("inlineCode",{parentName:"p"},"stored")," reports are generated regardless."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"timeseriesAggregator.setUpload(upload: boolean, label: string): Promise<void>\n")),(0,n.kt)("h2",{id:"registers"},"Registers"),(0,n.kt)("p",null),(0,n.kt)("h3",{id:"ro:now"},"now"),(0,n.kt)("p",null,"This can queried to establish local time on the device."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"type: ",(0,n.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,n.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"read only"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\nconst value = await timeseriesAggregator.now.read()\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"track incoming values")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\ntimeseriesAggregator.now.subscribe(async (value) => {\n ...\n})\n')),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,n.kt)("h3",{id:"rw:fastStart"},"fastStart"),(0,n.kt)("p",null,"When ",(0,n.kt)("inlineCode",{parentName:"p"},"true"),", the windows will be shorter after service reset and gradually extend to requested length.\nThis is ensure valid data is being streamed in program development."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"type: ",(0,n.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,n.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"read and write"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\nconst value = await timeseriesAggregator.fastStart.read()\nawait timeseriesAggregator.fastStart.write(value)\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"track incoming values")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\ntimeseriesAggregator.fastStart.subscribe(async (value) => {\n ...\n})\n')),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,n.kt)("h3",{id:"rw:defaultWindow"},"defaultWindow"),(0,n.kt)("p",null,"Window for timeseries for which ",(0,n.kt)("inlineCode",{parentName:"p"},"set_window")," was never called.\nNote that windows returned initially may be shorter if ",(0,n.kt)("inlineCode",{parentName:"p"},"fast_start")," is enabled."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"type: ",(0,n.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,n.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"read and write"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\nconst value = await timeseriesAggregator.defaultWindow.read()\nawait timeseriesAggregator.defaultWindow.write(value)\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"track incoming values")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\ntimeseriesAggregator.defaultWindow.subscribe(async (value) => {\n ...\n})\n')),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,n.kt)("h3",{id:"rw:defaultUpload"},"defaultUpload"),(0,n.kt)("p",null,"Whether labelled timeseries for which ",(0,n.kt)("inlineCode",{parentName:"p"},"set_upload")," was never called should be automatically uploaded."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"type: ",(0,n.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,n.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"read and write"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\nconst value = await timeseriesAggregator.defaultUpload.read()\nawait timeseriesAggregator.defaultUpload.write(value)\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"track incoming values")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\ntimeseriesAggregator.defaultUpload.subscribe(async (value) => {\n ...\n})\n')),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,n.kt)("h3",{id:"rw:uploadUnlabelled"},"uploadUnlabelled"),(0,n.kt)("p",null,"Whether automatically created timeseries not bound in role manager should be uploaded."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"type: ",(0,n.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,n.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"read and write"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\nconst value = await timeseriesAggregator.uploadUnlabelled.read()\nawait timeseriesAggregator.uploadUnlabelled.write(value)\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"track incoming values")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\ntimeseriesAggregator.uploadUnlabelled.subscribe(async (value) => {\n ...\n})\n')),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,n.kt)("h3",{id:"rw:sensorWatchdogPeriod"},"sensorWatchdogPeriod"),(0,n.kt)("p",null,"If no data is received from any sensor within given period, the device is rebooted.\nSet to ",(0,n.kt)("inlineCode",{parentName:"p"},"0")," to disable (default).\nUpdating user-provided timeseries does not reset the watchdog."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"type: ",(0,n.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,n.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"read and write"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\nconst value = await timeseriesAggregator.sensorWatchdogPeriod.read()\nawait timeseriesAggregator.sensorWatchdogPeriod.write(value)\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"track incoming values")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TimeseriesAggregator } from "@devicescript/core"\n\nconst timeseriesAggregator = new TimeseriesAggregator()\n// ...\ntimeseriesAggregator.sensorWatchdogPeriod.subscribe(async (value) => {\n ...\n})\n')),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},(0,n.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,n.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/357f20a9.1927d9f2.js b/assets/js/357f20a9.1927d9f2.js new file mode 100644 index 00000000000..875b61689d1 --- /dev/null +++ b/assets/js/357f20a9.1927d9f2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5370],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:i,a[1]=s;for(var p=2;p<o;p++)a[p]=n[p];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},72393:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const o={sidebar_position:5,description:"Learn about tree-shaking in Microsoft DeviceScript, how to use the ds.keep() function, and potential improvements in future releases.",keywords:["tree-shaking","Microsoft DeviceScript","ds.keep","index operator","compiler warnings"]},a="Tree-shaking",s={unversionedId:"language/tree-shaking",id:"language/tree-shaking",title:"Tree-shaking",description:"Learn about tree-shaking in Microsoft DeviceScript, how to use the ds.keep() function, and potential improvements in future releases.",source:"@site/docs/language/tree-shaking.mdx",sourceDirName:"language",slug:"/language/tree-shaking",permalink:"/devicescript/language/tree-shaking",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,description:"Learn about tree-shaking in Microsoft DeviceScript, how to use the ds.keep() function, and potential improvements in future releases.",keywords:["tree-shaking","Microsoft DeviceScript","ds.keep","index operator","compiler warnings"]},sidebar:"tutorialSidebar",previous:{title:"Special objects",permalink:"/devicescript/language/special"},next:{title:"Runtime implementation",permalink:"/devicescript/language/runtime"}},c={},p=[],l={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"tree-shaking"},"Tree-shaking"),(0,i.kt)("p",null,"Classes and/or methods in classes can be marked with ",(0,i.kt)("inlineCode",{parentName:"p"},"@devsWhenUsed")," JSDoc attribute.\nThis will cause them to be omitted from compilation unless they are used.\nIn such case, care needs to be taken when using index operator (",(0,i.kt)("inlineCode",{parentName:"p"},"obj[some_expression]"),")\nor accessing properties through ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type.\nYou can use ",(0,i.kt)("inlineCode",{parentName:"p"},"ds.keep()")," function to make sure methods are included."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'/**\n * Foooooo!\n * \n * @devsWhenUsed\n */\nclass Foo {\n bar() {}\n}\nfunction callBar(v: any) {\n v["bar"]()\n}\ncallBar(new Foo())\n\n// can be called anywhere from the reachable code\nds.keep(Foo.prototype.bar)\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"@devsWhenUsed")," attribute is implicit when methods are defined through\nprototype assignments."),(0,i.kt)("p",null,"We may improve compiler warnings about such cases in future."),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/discussions/36"},"discussion"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3583f1cc.06f598bf.js b/assets/js/3583f1cc.06f598bf.js new file mode 100644 index 00000000000..acc02f45e40 --- /dev/null +++ b/assets/js/3583f1cc.06f598bf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9178],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=p(n),d=a,k=u["".concat(c,".").concat(d)]||u[d]||m[d]||l;return n?r.createElement(k,i(i({ref:t},s),{},{components:n})):r.createElement(k,i({ref:t},s))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var p=2;p<l;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},63603:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=n(25773),a=(n(27378),n(35318));const l={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Accelerometer service"},i="Accelerometer",o={unversionedId:"api/clients/accelerometer",id:"api/clients/accelerometer",title:"Accelerometer",description:"DeviceScript client for Accelerometer service",source:"@site/docs/api/clients/accelerometer.md",sourceDirName:"api/clients",slug:"/api/clients/accelerometer",permalink:"/devicescript/api/clients/accelerometer",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Accelerometer service"},sidebar:"tutorialSidebar"},c={},p=[{value:"About",id:"about",level:2},{value:"Orientation",id:"orientation",level:2},{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"readingRange",id:"rw:readingRange",level:3},{value:"supportedRanges",id:"const:supportedRanges",level:3},{value:"Events",id:"events",level:2},{value:"tiltUp",id:"tiltup",level:3},{value:"tiltDown",id:"tiltdown",level:3},{value:"tiltLeft",id:"tiltleft",level:3},{value:"tiltRight",id:"tiltright",level:3},{value:"faceUp",id:"faceup",level:3},{value:"faceDown",id:"facedown",level:3},{value:"freefall",id:"freefall",level:3},{value:"shake",id:"shake",level:3},{value:"force2g",id:"force2g",level:3},{value:"force3g",id:"force3g",level:3},{value:"force6g",id:"force6g",level:3},{value:"force8g",id:"force8g",level:3}],s={toc:p},u="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"accelerometer"},"Accelerometer"),(0,a.kt)("p",null,"A 3-axis accelerometer."),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"about"},"About"),(0,a.kt)("h2",{id:"orientation"},"Orientation"),(0,a.kt)("p",null,"An accelerometer module should translate acceleration values as follows:"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Orientation"),(0,a.kt)("th",{parentName:"tr",align:null},"X value (g)"),(0,a.kt)("th",{parentName:"tr",align:null},"Y value (g)"),(0,a.kt)("th",{parentName:"tr",align:null},"Z value (g)"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Module lying flat"),(0,a.kt)("td",{parentName:"tr",align:null},"0"),(0,a.kt)("td",{parentName:"tr",align:null},"0"),(0,a.kt)("td",{parentName:"tr",align:null},"-1")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Module on left edge"),(0,a.kt)("td",{parentName:"tr",align:null},"-1"),(0,a.kt)("td",{parentName:"tr",align:null},"0"),(0,a.kt)("td",{parentName:"tr",align:null},"0")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Module on bottom edge"),(0,a.kt)("td",{parentName:"tr",align:null},"0"),(0,a.kt)("td",{parentName:"tr",align:null},"1"),(0,a.kt)("td",{parentName:"tr",align:null},"0")))),(0,a.kt)("p",null,"We recommend an orientation marking on the PCB so that users can mount modules without having to experiment with the device. Left/bottom can be determined by assuming text on silk runs left-to-right."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Accelerometer } from "@devicescript/core"\n\nconst accelerometer = new Accelerometer()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Indicates the current forces acting on accelerometer."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i12.20 i12.20 i12.20"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Accelerometer } from "@devicescript/core"\n\nconst accelerometer = new Accelerometer()\n// ...\naccelerometer.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Error on the reading value."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u12.20"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Accelerometer } from "@devicescript/core"\n\nconst accelerometer = new Accelerometer()\n// ...\nconst value = await accelerometer.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Accelerometer } from "@devicescript/core"\n\nconst accelerometer = new Accelerometer()\n// ...\naccelerometer.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:readingRange"},"readingRange"),(0,a.kt)("p",null,'Configures the range forces detected.\nThe value will be "rounded up" to one of ',(0,a.kt)("inlineCode",{parentName:"p"},"max_forces_supported"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u12.20"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Accelerometer } from "@devicescript/core"\n\nconst accelerometer = new Accelerometer()\n// ...\nconst value = await accelerometer.readingRange.read()\nawait accelerometer.readingRange.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Accelerometer } from "@devicescript/core"\n\nconst accelerometer = new Accelerometer()\n// ...\naccelerometer.readingRange.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:supportedRanges"},"supportedRanges"),(0,a.kt)("p",null,"Lists values supported for writing ",(0,a.kt)("inlineCode",{parentName:"p"},"max_force"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"type: ",(0,a.kt)("inlineCode",{parentName:"li"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"li"},"r: u12.20"),")"),(0,a.kt)("li",{parentName:"ul"},"optional: this register may not be implemented"),(0,a.kt)("li",{parentName:"ul"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h2",{id:"events"},"Events"),(0,a.kt)("h3",{id:"tiltup"},"tiltUp"),(0,a.kt)("p",null,"Emitted when accelerometer is tilted in the given direction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.tiltUp.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"tiltdown"},"tiltDown"),(0,a.kt)("p",null,"Emitted when accelerometer is tilted in the given direction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.tiltDown.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"tiltleft"},"tiltLeft"),(0,a.kt)("p",null,"Emitted when accelerometer is tilted in the given direction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.tiltLeft.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"tiltright"},"tiltRight"),(0,a.kt)("p",null,"Emitted when accelerometer is tilted in the given direction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.tiltRight.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"faceup"},"faceUp"),(0,a.kt)("p",null,"Emitted when accelerometer is laying flat in the given direction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.faceUp.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"facedown"},"faceDown"),(0,a.kt)("p",null,"Emitted when accelerometer is laying flat in the given direction."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.faceDown.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"freefall"},"freefall"),(0,a.kt)("p",null,"Emitted when total force acting on accelerometer is much less than 1g."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.freefall.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"shake"},"shake"),(0,a.kt)("p",null,"Emitted when forces change violently a few times."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.shake.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"force2g"},"force2g"),(0,a.kt)("p",null,"Emitted when force in any direction exceeds given threshold."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.force2g.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"force3g"},"force3g"),(0,a.kt)("p",null,"Emitted when force in any direction exceeds given threshold."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.force3g.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"force6g"},"force6g"),(0,a.kt)("p",null,"Emitted when force in any direction exceeds given threshold."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.force6g.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"force8g"},"force8g"),(0,a.kt)("p",null,"Emitted when force in any direction exceeds given threshold."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"accelerometer.force8g.subscribe(() => {\n\n})\n")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/36363056.bbabcb33.js b/assets/js/36363056.bbabcb33.js new file mode 100644 index 00000000000..f125b3932e3 --- /dev/null +++ b/assets/js/36363056.bbabcb33.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8716],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var o=r.createContext({}),u=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=u(e.components);return r.createElement(o.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),s=u(n),d=a,k=s["".concat(o,".").concat(d)]||s[d]||c[d]||i;return n?r.createElement(k,l(l({ref:t},m),{},{components:n})):r.createElement(k,l({ref:t},m))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,l=new Array(i);l[0]=d;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[s]="string"==typeof e?e:a,l[1]=p;for(var u=2;u<i;u++)l[u]=n[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},59047:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for DC Current Measurement service"},l="DcCurrentMeasurement",p={unversionedId:"api/clients/dccurrentmeasurement",id:"api/clients/dccurrentmeasurement",title:"DcCurrentMeasurement",description:"DeviceScript client for DC Current Measurement service",source:"@site/docs/api/clients/dccurrentmeasurement.md",sourceDirName:"api/clients",slug:"/api/clients/dccurrentmeasurement",permalink:"/devicescript/api/clients/dccurrentmeasurement",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for DC Current Measurement service"},sidebar:"tutorialSidebar"},o={},u=[{value:"Registers",id:"registers",level:2},{value:"measurementName",id:"const:measurementName",level:3},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],m={toc:u},s="wrapper";function c(e){let{components:t,...n}=e;return(0,a.kt)(s,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"dccurrentmeasurement"},"DcCurrentMeasurement"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A service that reports a current measurement."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"const:measurementName"},"measurementName"),(0,a.kt)("p",null,"A string containing the net name that is being measured e.g. ",(0,a.kt)("inlineCode",{parentName:"p"},"POWER_DUT")," or a reference e.g. ",(0,a.kt)("inlineCode",{parentName:"p"},"DIFF_DEV1_DEV2"),". These constants can be used to identify a measurement from client code."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"s"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\nconst value = await dcCurrentMeasurement.measurementName.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The current measurement."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\nconst value = await dcCurrentMeasurement.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\ndcCurrentMeasurement.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Absolute error on the reading value."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\nconst value = await dcCurrentMeasurement.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\ndcCurrentMeasurement.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:minReading"},"minReading"),(0,a.kt)("p",null,"Minimum measurable current"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\nconst value = await dcCurrentMeasurement.minReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,a.kt)("p",null,"Maximum measurable current"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcCurrentMeasurement } from "@devicescript/core"\n\nconst dcCurrentMeasurement = new DcCurrentMeasurement()\n// ...\nconst value = await dcCurrentMeasurement.maxReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3731312d.228ed73b.js b/assets/js/3731312d.228ed73b.js new file mode 100644 index 00000000000..f0410a5299a --- /dev/null +++ b/assets/js/3731312d.228ed73b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1429],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(n),m=a,f=p["".concat(s,".").concat(m)]||p[m]||d[m]||o;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:a,l[1]=i;for(var u=2;u<o;u++)l[u]=n[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},39798:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(27378),a=n(38944);const o={tabItem:"tabItem_wHwb"};function l(e){let{children:t,hidden:n,className:l}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(o.tabItem,l),hidden:n},t)}},23930:(e,t,n)=>{n.d(t,{Z:()=>w});var r=n(25773),a=n(27378),o=n(38944),l=n(83457),i=n(3620),s=n(30654),u=n(70784),c=n(71819);function p(e){return function(e){return a.Children.map(e,(e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}function d(e){const{values:t,children:n}=e;return(0,a.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,i.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,s._X)(o),(0,a.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(r.location.search);t.set(o,e),r.replace({...r.location,search:t.toString()})}),[o,r])]}function b(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,o=d(e),[l,i]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:o}))),[s,u]=f({queryString:n,groupId:r}),[p,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,o]=(0,c.Nk)(n);return[r,(0,a.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:r}),h=(()=>{const e=s??p;return m({value:e,tabValues:o})?e:null})();(0,a.useLayoutEffect)((()=>{h&&i(h)}),[h]);return{selectedValue:l,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),b(e)}),[u,b,o]),tabValues:o}}var h=n(76457);const v={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function g(e){let{className:t,block:n,selectedValue:i,selectValue:s,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,l.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),r=u[n].value;r!==i&&(p(t),s(r))},m=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:l}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},l,{className:(0,o.Z)("tabs__item",v.tabItem,l?.className,{"tabs__item--active":i===t})}),n??t)})))}function k(e){let{lazy:t,children:n,selectedValue:r}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r}))))}function y(e){const t=b(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",v.tabList)},a.createElement(g,(0,r.Z)({},e,t)),a.createElement(k,(0,r.Z)({},e,t)))}function w(e){const t=(0,h.Z)();return a.createElement(y,(0,r.Z)({key:String(t)},e))}},21310:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>u,toc:()=>p});var r=n(25773),a=(n(27378),n(35318)),o=n(23930),l=n(39798);const i={sidebar_position:1e4,title:"Errors",description:"Troubleshooting DeviceScript errors"},s="Errors",u={unversionedId:"developer/errors",id:"developer/errors",title:"Errors",description:"Troubleshooting DeviceScript errors",source:"@site/docs/developer/errors.mdx",sourceDirName:"developer",slug:"/developer/errors",permalink:"/devicescript/developer/errors",draft:!1,tags:[],version:"current",sidebarPosition:1e4,frontMatter:{sidebar_position:1e4,title:"Errors",description:"Troubleshooting DeviceScript errors"},sidebar:"tutorialSidebar",previous:{title:"Development Gateway",permalink:"/devicescript/developer/development-gateway/gateway"},next:{title:"Samples",permalink:"/devicescript/samples/"}},c={},p=[{value:"loopback rx ovf",id:"loopback-rx-ovf",level:2},{value:"can't connect, no HF2 nor JDUSB",id:"no-hf2",level:2},{value:"esptool cannot connect",id:"esptool-cannot-connect",level:2},{value:"I2C device not found or malfunctioning",id:"i2c-device-not-found-or-malfunctioning",level:2},{value:"Unable to locate Node.JS v16+.",id:"terminal-nodemissing",level:2},{value:"Install @devicescript/cli package",id:"terminal-notinstalled",level:2},{value:"missing "devicescript" section",id:"missing-devicescript-section",level:2}],d={toc:p},m="wrapper";function f(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"errors"},"Errors"),(0,a.kt)("h2",{id:"loopback-rx-ovf"},"loopback rx ovf"),(0,a.kt)("p",null,"The program is issuing requests to service client faster than the system can handle."),(0,a.kt)("h2",{id:"no-hf2"},"can't connect, no HF2 nor JDUSB"),(0,a.kt)("p",null,"On ESP32-C3, we do not support external serial chips. This is the ",(0,a.kt)("a",{parentName:"p",href:"/devices/esp32"},"list of known supported ESP32 boards"),"."),(0,a.kt)("h2",{id:"esptool-cannot-connect"},"esptool cannot connect"),(0,a.kt)("p",null,"If the ",(0,a.kt)("inlineCode",{parentName:"p"},"esptool")," complains about not being able to connect, try plugging your board in\nwhile holding ",(0,a.kt)("inlineCode",{parentName:"p"},"IO0"),"/",(0,a.kt)("inlineCode",{parentName:"p"},"BOOT")," button."),(0,a.kt)("h2",{id:"i2c-device-not-found-or-malfunctioning"},"I2C device not found or malfunctioning"),(0,a.kt)("p",null,"There is a number of reasons why this error message will appear. A few common ones\nare due to invalid configurations, aside from hardware issues with the sensor."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Check that the I2C pins have been configured. Read about ",(0,a.kt)("a",{parentName:"li",href:"/developer/board-configuration"},"board configuration"),"."),(0,a.kt)("li",{parentName:"ul"},"The I2C address is incorrect. Check the datasheet for the correct address."),(0,a.kt)("li",{parentName:"ul"},"The I2C address is correct, but the sensor is not responding. Check the wiring and the sensor datasheet.")),(0,a.kt)("h2",{id:"terminal-nodemissing"},"Unable to locate Node.JS v16+."),(0,a.kt)("p",null,"The Visual Studio Code extension was unable to determine the version of Node.JS.\nThis may mean that Node.JS is not installed or not in the path,\nthe local installation of modules is broken."),(0,a.kt)("p",null,"You can try to run npm update in the folder and try again."),(0,a.kt)(o.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,a.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"npm update\n"))),(0,a.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"npm update\n# couldn't auto-convert command\n"))),(0,a.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"npm update\n# couldn't auto-convert command\n")))),(0,a.kt)("h2",{id:"terminal-notinstalled"},"Install @devicescript/cli package"),(0,a.kt)("p",null,"The Visual Studio Code extension tries to locate the\nCLI script, ",(0,a.kt)("inlineCode",{parentName:"p"},"./node_modules/.bins/devicescript"),", that gets installed by the package manager."),(0,a.kt)("p",null,"If this file is not present, it typically means that the CLI is not installed in the project\nand needs to be added as ",(0,a.kt)("inlineCode",{parentName:"p"},"devDependency"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"click ",(0,a.kt)("strong",{parentName:"li"},"Install")," to install @devicescript/cli"),(0,a.kt)("li",{parentName:"ul"},"try running ",(0,a.kt)("inlineCode",{parentName:"li"},"npm update")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"yarn update")," to fix the installation")),(0,a.kt)("h2",{id:"missing-devicescript-section"},'missing "devicescript" section'),(0,a.kt)("p",null,"Importing a npm package designed for node.js or the browser is not yet supported. The reason is that it would most likely not work\nas the DeviceScript runtime environment is radically different from the browser or even node.js."),(0,a.kt)("p",null,"Instead you should try to import packages ",(0,a.kt)("a",{parentName:"p",href:"/developer/packages/custom"},"specifically built for devicescript"),"."))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3851185d.a84ed23a.js b/assets/js/3851185d.a84ed23a.js new file mode 100644 index 00000000000..e578ea60c17 --- /dev/null +++ b/assets/js/3851185d.a84ed23a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[770],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=s(n),d=i,k=m["".concat(p,".").concat(d)]||m[d]||c[d]||r;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[m]="string"==typeof e?e:i,l[1]=o;for(var s=2;s<r;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},42015:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>o,toc:()=>s});var a=n(25773),i=(n(27378),n(35318));const r={description:"Learn about the supported and unsupported features of DeviceScript, a TypeScript subset designed for limited resources environments.",keywords:["DeviceScript","TypeScript subset","language features","supported features","unsupported features"]},l="DeviceScript Language",o={unversionedId:"language/index",id:"language/index",title:"DeviceScript Language",description:"Learn about the supported and unsupported features of DeviceScript, a TypeScript subset designed for limited resources environments.",source:"@site/docs/language/index.mdx",sourceDirName:"language",slug:"/language/",permalink:"/devicescript/language/",draft:!1,tags:[],version:"current",frontMatter:{description:"Learn about the supported and unsupported features of DeviceScript, a TypeScript subset designed for limited resources environments.",keywords:["DeviceScript","TypeScript subset","language features","supported features","unsupported features"]},sidebar:"tutorialSidebar",previous:{title:"Workshop",permalink:"/devicescript/samples/workshop/"},next:{title:"Async/await and promises",permalink:"/devicescript/language/async"}},p={},s=[{value:"TypeScript subset",id:"typescript-subset",level:2},{value:"Supported language features",id:"supported-language-features",level:3},{value:"Unsupported language features",id:"unsupported-language-features",level:3}],u={toc:s},m="wrapper";function c(e){let{components:t,...n}=e;return(0,i.kt)(m,(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"devicescript-language"},"DeviceScript Language"),(0,i.kt)("p",null,"DeviceScript generally works just like TypeScript, unless the compiler tells you something is not supported."),(0,i.kt)("p",null,"The TypeScript sources are compiled to a ",(0,i.kt)("a",{parentName:"p",href:"/language/bytecode"},"bytecode"),"\nthat is then executed on the ",(0,i.kt)("a",{parentName:"p",href:"/language/runtime"},"DeviceScript runtime"),"."),(0,i.kt)("h2",{id:"typescript-subset"},"TypeScript subset"),(0,i.kt)("p",null,"DeviceScript is a subset of ",(0,i.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org"},"TypeScript"),".\nTypeScript itself follows semantics of ECMAScript also known as JavaScript (JS).\nDeviceScript generally also follows JavaScript semantics, and the DeviceScript compiler\nwill give you an error if you're using an unsupported feature."),(0,i.kt)("p",null,"Otherwise, there are some semantic differences stemming from the limited\nresources available to the DeviceScript runtime:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/language/async"},"programs run in multiple fibers"),"; ",(0,i.kt)("inlineCode",{parentName:"li"},"async"),"/",(0,i.kt)("inlineCode",{parentName:"li"},"await")," are supported general ",(0,i.kt)("inlineCode",{parentName:"li"},"Promise")," is not"),(0,i.kt)("li",{parentName:"ul"},"user-defined ",(0,i.kt)("a",{parentName:"li",href:"/language/tostring"},".toString() method")," is limited"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/language/strings"},"strings are Unicode"),", not UTF-16, and some features are missing"),(0,i.kt)("li",{parentName:"ul"},"some objects, including functions, ",(0,i.kt)("a",{parentName:"li",href:"/language/special"},"are static or otherwise special"),", and cannot have random properties attached"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/language/tree-shaking"},"tree shaking")," is quite aggressive"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/language/hex"},"hex string template")," compiles hex string into flash-stored buffers"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/language/devicescript-vs-javascript"},"other differences")," include lack of subnormals")),(0,i.kt)("p",null,"Below we list supported and unsupported language features."),(0,i.kt)("h3",{id:"supported-language-features"},"Supported language features"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"variable declarations with ",(0,i.kt)("inlineCode",{parentName:"li"},"let"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"const")),(0,i.kt)("li",{parentName:"ul"},"functions with lexical scoping and recursion"),(0,i.kt)("li",{parentName:"ul"},"top-level code in the file; hello world really is ",(0,i.kt)("inlineCode",{parentName:"li"},'console.log("Hello world")')),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"if ... else if ... else")," statements"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"while")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"do ... while")," loops"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"for(;;)")," loops"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"for ... of")," statements"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"for ... in")," statements (though they behave the same as ",(0,i.kt)("inlineCode",{parentName:"li"},"for ... of Object.keys(...)"),")"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"break/continue"),"; also with labeled loops"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"switch")," statement (on numbers, strings, and arbitrary types - the last one isn't very useful)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"debugger")," statement for breakpoints"),(0,i.kt)("li",{parentName:"ul"},"conditional operator ",(0,i.kt)("inlineCode",{parentName:"li"},"? :"),"; lazy boolean operators"),(0,i.kt)("li",{parentName:"ul"},"all arithmetic operators (including bitwise operators)"),(0,i.kt)("li",{parentName:"ul"},"strings (with a few common methods)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals"},"string templates")," (",(0,i.kt)("inlineCode",{parentName:"li"},"`x is ${x}`"),")"),(0,i.kt)("li",{parentName:"ul"},"arrow functions ",(0,i.kt)("inlineCode",{parentName:"li"},"() => ..."),"; passing functions as values"),(0,i.kt)("li",{parentName:"ul"},"classes with inheritance, instance fields, methods and constructors; ",(0,i.kt)("inlineCode",{parentName:"li"},"new")," keyword"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"public"),"/",(0,i.kt)("inlineCode",{parentName:"li"},"private")," annotations on constructor arguments (syntactic sugar to make them into fields); initializers for class fields"),(0,i.kt)("li",{parentName:"ul"},"enumerations (",(0,i.kt)("inlineCode",{parentName:"li"},"enum"),")"),(0,i.kt)("li",{parentName:"ul"},"generic classes, methods, and functions"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"typeof")," expression"),(0,i.kt)("li",{parentName:"ul"},"binding with arrays or objects: ",(0,i.kt)("inlineCode",{parentName:"li"},"let [a, b] = ...; let { x, y } = ...")),(0,i.kt)("li",{parentName:"ul"},"exceptions (",(0,i.kt)("inlineCode",{parentName:"li"},"throw"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"try ... catch"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"try ... finally"),")"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"union")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"intersection")," types"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"delete")," statement"),(0,i.kt)("li",{parentName:"ul"},"array literals ",(0,i.kt)("inlineCode",{parentName:"li"},"[1, 2, 3]"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"[1, ...x, ...y, 2]")),(0,i.kt)("li",{parentName:"ul"},"object literals ",(0,i.kt)("inlineCode",{parentName:"li"},'{ foo: 1, bar: "two" }')),(0,i.kt)("li",{parentName:"ul"},"shorthand properties (",(0,i.kt)("inlineCode",{parentName:"li"},"{a, b: 1}")," parsed as ",(0,i.kt)("inlineCode",{parentName:"li"},"{a: a, b: 1}"),")"),(0,i.kt)("li",{parentName:"ul"},"computed property names (",(0,i.kt)("inlineCode",{parentName:"li"},"{[foo()]: 1, bar: 2}"),")"),(0,i.kt)("li",{parentName:"ul"},"spread and rest operators (in certain places)"),(0,i.kt)("li",{parentName:"ul"},"file-based modules (",(0,i.kt)("inlineCode",{parentName:"li"},"import * from ..."),", ",(0,i.kt)("inlineCode",{parentName:"li"},"import { foo } from ...")," etc)"),(0,i.kt)("li",{parentName:"ul"},"array/object destructuring in parameters and definitions (not in assignments yet)"),(0,i.kt)("li",{parentName:"ul"},"optional chaining (",(0,i.kt)("inlineCode",{parentName:"li"},"a?.b.c"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"foo.bar?.()"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"foo?.[1]"),", etc)"),(0,i.kt)("li",{parentName:"ul"},"nullish coalescing operator (",(0,i.kt)("inlineCode",{parentName:"li"},"width ?? 240"),")"),(0,i.kt)("li",{parentName:"ul"},"static fields and methods in classes"),(0,i.kt)("li",{parentName:"ul"},"JSX is supported (though experimental) if you feel like developing an MCU-React!")),(0,i.kt)("h3",{id:"unsupported-language-features"},"Unsupported language features"),(0,i.kt)("p",null,"Things you may miss and we may implement:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"support of ",(0,i.kt)("inlineCode",{parentName:"li"},"enums")," as run-time arrays"),(0,i.kt)("li",{parentName:"ul"},"initializer for static fields"),(0,i.kt)("li",{parentName:"ul"},"method-like properties (get/set accessors)"),(0,i.kt)("li",{parentName:"ul"},"tagged templates ",(0,i.kt)("inlineCode",{parentName:"li"},"tag `text ${expression} more text` ")," are limited to special compiler features\nlike buffer literals; regular templates are supported")),(0,i.kt)("p",null,"Things that we are not very likely to implement due to the scope of the project\nor other constraints (note that if you don't know what a given feature is, you're\nunlikely to miss it):"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"yield")," expression and ",(0,i.kt)("inlineCode",{parentName:"li"},"function*")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"with")," statement"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"eval")),(0,i.kt)("li",{parentName:"ul"},"namespaces (we do support ES modules)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"arguments")," keyword; ",(0,i.kt)("inlineCode",{parentName:"li"},".apply")," method (modern spread operator is supported)"),(0,i.kt)("li",{parentName:"ul"},"marking properties as non-enumerable etc"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"==")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"!=")," operators (other than ",(0,i.kt)("inlineCode",{parentName:"li"},"== null"),"/",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),"); please use ",(0,i.kt)("inlineCode",{parentName:"li"},"===")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"!=="))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3893.81ef05c9.js b/assets/js/3893.81ef05c9.js new file mode 100644 index 00000000000..0c65e3c96f6 --- /dev/null +++ b/assets/js/3893.81ef05c9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3893],{53893:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var a=n(27378),l=n(99213),o=n(1123),r=n(20432);function i(){return a.createElement(a.Fragment,null,a.createElement(o.d,{title:(0,l.I)({id:"theme.NotFound.title",message:"Page Not Found"})}),a.createElement(r.Z,null,a.createElement("main",{className:"container margin-vert--xl"},a.createElement("div",{className:"row"},a.createElement("div",{className:"col col--6 col--offset-3"},a.createElement("h1",{className:"hero__title"},a.createElement(l.Z,{id:"theme.NotFound.title",description:"The title of the 404 page"},"Page Not Found")),a.createElement("p",null,a.createElement(l.Z,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page"},"We could not find what you were looking for.")),a.createElement("p",null,a.createElement(l.Z,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page"},"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))))}}}]); \ No newline at end of file diff --git a/assets/js/38e4c03d.625454aa.js b/assets/js/38e4c03d.625454aa.js new file mode 100644 index 00000000000..b92755644b7 --- /dev/null +++ b/assets/js/38e4c03d.625454aa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2481],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>h});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(r),u=a,h=d["".concat(s,".").concat(u)]||d[u]||m[u]||o;return r?n.createElement(h,i(i({ref:t},c),{},{components:r})):n.createElement(h,i({ref:t},c))}));function h(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var p=2;p<o;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},69686:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var n=r(25773),a=(r(27378),r(35318));const o={sidebar_position:4,description:"Learn how to create a thermostat controller using temperature sensor, relay, and observables for filtering, throttling, and level detection.",keywords:["thermostat","temperature sensor","relay","observables","devicescript"],hide_table_of_contents:!0},i="Thermostat",l={unversionedId:"samples/thermostat",id:"samples/thermostat",title:"Thermostat",description:"Learn how to create a thermostat controller using temperature sensor, relay, and observables for filtering, throttling, and level detection.",source:"@site/docs/samples/thermostat.mdx",sourceDirName:"samples",slug:"/samples/thermostat",permalink:"/devicescript/samples/thermostat",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Learn how to create a thermostat controller using temperature sensor, relay, and observables for filtering, throttling, and level detection.",keywords:["thermostat","temperature sensor","relay","observables","devicescript"],hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Copy Paste Button",permalink:"/devicescript/samples/copy-paste-button"},next:{title:"GitHub Build Status",permalink:"/devicescript/samples/github-build-status"}},s={},p=[{value:"Logging sensor data",id:"logging-sensor-data",level:2},{value:"Add observables",id:"add-observables",level:2},{value:"Filtering",id:"filtering",level:2},{value:"Tapping",id:"tapping",level:2},{value:"Throttling",id:"throttling",level:2},{value:"Level detector",id:"level-detector",level:2},{value:"Relay",id:"relay",level:2},{value:"Relay on ESP32",id:"relay-on-esp32",level:2}],c={toc:p},d="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(d,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"thermostat"},"Thermostat"),(0,a.kt)("p",null,"A rudimentary thermostat controller that uses a\ntemperature sensor to decide when to turn on or off a furnace controlled by a relay."),(0,a.kt)("h2",{id:"logging-sensor-data"},"Logging sensor data"),(0,a.kt)("p",null,"Let's start by mounting a ",(0,a.kt)("inlineCode",{parentName:"p"},"temperature")," service client\nand logging each sensor reading to the console (using ",(0,a.kt)("inlineCode",{parentName:"p"},"console.data"),")."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst thermometer = new Temperature()\nthermometer.reading.subscribe(t => {\n console.data({ t })\n})\n')),(0,a.kt)("p",null,"In Visual Studio Code, you can run this program with a simulated device and sensor and collect virtual data.\nClick on the ",(0,a.kt)("inlineCode",{parentName:"p"},"Download Data")," icon in the DeviceScript view, you can analyze the data in a notebook."),(0,a.kt)("p",null,"This approach works for a basic scenario but we lack the control over when data arrives, how it is filtered\nand at which rate.\nThis is where ",(0,a.kt)("a",{parentName:"p",href:"/api/observables"},"observables")," come into play."),(0,a.kt)("h2",{id:"add-observables"},"Add observables"),(0,a.kt)("p",null,"Add this import to your ",(0,a.kt)("inlineCode",{parentName:"p"},"main.ts")," file (the ",(0,a.kt)("inlineCode",{parentName:"p"},"@devicescript/observables")," is ",(0,a.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin"),")."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import "@devicescript/observables"\n')),(0,a.kt)("h2",{id:"filtering"},"Filtering"),(0,a.kt)("p",null,"Observables provide a way to add operators over streams of data. A register like ",(0,a.kt)("inlineCode",{parentName:"p"},"temperature")," is like\na stream of readings and we'll use ",(0,a.kt)("a",{parentName:"p",href:"/api/observables"},"operators")," to manipulate them."),(0,a.kt)("p",null,"We start with the ",(0,a.kt)("inlineCode",{parentName:"p"},"ewma")," operator, which applies a exponentially weighted moving average filter to the data."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n// highlight-next-line\nimport { ewma } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\nthermometer.reading\n // highlight-next-line\n .pipe(ewma(0.9))\n .subscribe(t => console.data({ t }))\n')),(0,a.kt)("h2",{id:"tapping"},"Tapping"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n// highlight-next-line\nimport { ewma, tap } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\nthermometer.reading\n .pipe(\n // highlight-next-line\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9)\n )\n .subscribe(t => console.data({ t }))\n')),(0,a.kt)("h2",{id:"throttling"},"Throttling"),(0,a.kt)("p",null,"Although the sensor may produce a high frequency of data locally, we probably want to\nthrottle the output to a slower pace when deciding to control the relay.\nThis can be done through ",(0,a.kt)("inlineCode",{parentName:"p"},"throttleTime")," (stream first value and wait) or ",(0,a.kt)("inlineCode",{parentName:"p"},"auditTime")," (wait then stream last value)."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n// highlight-next-line\nimport { ewma, tap, auditTime } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\nthermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n // highlight-next-line\n auditTime(5000) // once every 5 seconds\n )\n .subscribe(t => console.data({ t }))\n')),(0,a.kt)("h2",{id:"level-detector"},"Level detector"),(0,a.kt)("p",null,"The next step is to categorize the current temperature in 3 zones, or levels: low, mid, high.\nIn the low zone, the relay should be turn on to heat the room. In the high zone, the relay should be turned off.\nIn the ",(0,a.kt)("inlineCode",{parentName:"p"},"mid")," zone, the relay should not be actuated to avoid switching at the boundary of the levels."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n// highlight-next-line\nimport { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n// highlight-next-line\nconst t_ref = 68 // degree F\n\nthermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n auditTime(5000), // once every 5 seconds\n tap(t_audit => console.data({ t_audit })),\n // highlight-next-line\n levelDetector(t_ref - 1, t_ref + 1), // -1 = low, 0 = mid, 1 = high\n // highlight-next-line\n tap(level => console.data({ level }))\n )\n // highlight-next-line\n .subscribe(level => console.data({ level }))\n')),(0,a.kt)("h2",{id:"relay"},"Relay"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature, Relay } from "@devicescript/core"\nimport { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\nconst t_ref = 68 // degree F\n// highlight-next-line\nconst relay = new Relay()\n\nthermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n auditTime(5000),\n tap(t_audit => console.data({ t_audit })),\n levelDetector(t_ref - 1, t_ref + 1),\n tap(level => console.data({ level }))\n )\n .subscribe(async level => {\n // highlight-start\n if (level < 0) await relay.enabled.write(true)\n else if (level > 0) await relay.enabled.write(false)\n console.data({ relay: await relay.enabled.read() })\n // highlight-end\n })\n')),(0,a.kt)("h2",{id:"relay-on-esp32"},"Relay on ESP32"),(0,a.kt)("p",null,"Using a ESP32 board and a relay on pin ",(0,a.kt)("inlineCode",{parentName:"p"},"A0"),", we can\nfinalize this example."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { Temperature } from "@devicescript/core"\nimport { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"\n// highlight-next-line\nimport { startRelay } from "@devicescript/servers"\n\nconst thermometer = new Temperature()\nconst t_ref = 68 // degree F\n// highlight-start\nconst relay = startRelay({\n pin: pins.A0_D0,\n})\n// highlight-end\n\nthermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n auditTime(5000),\n tap(t_audit => console.data({ t_audit })),\n levelDetector(t_ref - 1, t_ref + 1),\n tap(level => console.data({ level }))\n )\n .subscribe(async level => {\n if (level < 0) await relay.enabled.write(true)\n else if (level > 0) await relay.enabled.write(false)\n console.data({ relay: await relay.enabled.read() })\n })\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/39409b5b.5f865e03.js b/assets/js/39409b5b.5f865e03.js new file mode 100644 index 00000000000..bd487ab4c6e --- /dev/null +++ b/assets/js/39409b5b.5f865e03.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[118],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),d=s(n),u=i,k=d["".concat(o,".").concat(u)]||d[u]||c[u]||r;return n?a.createElement(k,l(l({ref:t},m),{},{components:n})):a.createElement(k,l({ref:t},m))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=u;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:i,l[1]=p;for(var s=2;s<r;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},96865:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>p,toc:()=>s});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Gamepad service"},l="Gamepad",p={unversionedId:"api/clients/gamepad",id:"api/clients/gamepad",title:"Gamepad",description:"DeviceScript client for Gamepad service",source:"@site/docs/api/clients/gamepad.md",sourceDirName:"api/clients",slug:"/api/clients/gamepad",permalink:"/devicescript/api/clients/gamepad",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Gamepad service"},sidebar:"tutorialSidebar"},o={},s=[{value:"Registers",id:"registers",level:2},{value:"axes",id:"ro:axes",level:3},{value:"button",id:"ro:button",level:3},{value:"reading",id:"ro:reading",level:3},{value:"variant",id:"const:variant",level:3},{value:"buttonsAvailable",id:"const:buttonsAvailable",level:3},{value:"Events",id:"events",level:2},{value:"change",id:"change",level:3}],m={toc:s},d="wrapper";function c(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"gamepad"},"Gamepad"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A two axis directional gamepad with optional buttons."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Gamepad } from "@devicescript/core"\n\nconst gamepad = new Gamepad()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("h3",{id:"ro:axes"},"axes"),(0,i.kt)("p",null,"An array representing the controls with axes present on the device (e.g. analog thumb sticks),\nas ",(0,i.kt)("inlineCode",{parentName:"p"},"[x, y]"),". Each entry in the array is a floating point value in the range ",(0,i.kt)("inlineCode",{parentName:"p"},"-1.0 \u2013 1.0``, representing the axis position from the lowest value ("),"-1.0",(0,i.kt)("inlineCode",{parentName:"p"},") to the highest value ("),"1.0`)."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"type: ",(0,i.kt)("inlineCode",{parentName:"li"},"ClientRegister<{ x: number; y: number }>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"li"},"i1.15 i1.15"),")")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Gamepad } from "@devicescript/core"\n\nconst gamepad = new Gamepad()\n// ...\ngamepad.axes.subscribe(async ({ x, y }) => {\n console.log({ x, y })\n})\n')),(0,i.kt)("h3",{id:"ro:button"},"button"),(0,i.kt)("p",null,"A client register for the requested button or combination of buttons. The value is ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if the button is pressed, ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," otherwise."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"type: ",(0,i.kt)("inlineCode",{parentName:"li"},"ClientRegister<GamepadButtons>"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Gamepad, GamepadButtons } from "@devicescript/core"\n\nconst gamepad = new Gamepad()\n// ...\ngamepad.button(GamepadButtons.Down).subscribe(async pressed => {\n console.log({ pressed })\n})\n')),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,'If the gamepad is analog, the directional buttons should be "simulated", based on gamepad position\n(',(0,i.kt)("inlineCode",{parentName:"p"},"Left")," is ",(0,i.kt)("inlineCode",{parentName:"p"},"{ x = -1, y = 0 }"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Up")," is ",(0,i.kt)("inlineCode",{parentName:"p"},"{ x = 0, y = -1}"),").\nIf the gamepad is digital, then each direction will read as either ",(0,i.kt)("inlineCode",{parentName:"p"},"-1"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"0"),", or ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," (in fixed representation).\nThe primary button on the gamepad is ",(0,i.kt)("inlineCode",{parentName:"p"},"A"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u32 i1.15 i1.15"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gamepad } from "@devicescript/core"\n\nconst gamepad = new Gamepad()\n// ...\ngamepad.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"The type of physical gamepad."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gamepad } from "@devicescript/core"\n\nconst gamepad = new Gamepad()\n// ...\nconst value = await gamepad.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:buttonsAvailable"},"buttonsAvailable"),(0,i.kt)("p",null,"Indicates a bitmask of the buttons that are mounted on the gamepad.\nIf the ",(0,i.kt)("inlineCode",{parentName:"p"},"Left"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"Up"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"Right"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"Down")," buttons are marked as available here, the gamepad is digital.\nEven when marked as not available, they will still be simulated based on the analog gamepad."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gamepad } from "@devicescript/core"\n\nconst gamepad = new Gamepad()\n// ...\nconst value = await gamepad.buttonsAvailable.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h2",{id:"events"},"Events"),(0,i.kt)("h3",{id:"change"},"change"),(0,i.kt)("p",null,"Emitted whenever the state of buttons changes."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"gamepad.change.subscribe(() => {\n\n})\n")),(0,i.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3bc219ec.d0590810.js b/assets/js/3bc219ec.d0590810.js new file mode 100644 index 00000000000..350874a06dd --- /dev/null +++ b/assets/js/3bc219ec.d0590810.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5832],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(n),d=a,g=u["".concat(l,".").concat(d)]||u[d]||m[d]||i;return n?r.createElement(g,o(o({ref:t},c),{},{components:n})):r.createElement(g,o({ref:t},c))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:a,o[1]=p;for(var s=2;s<i;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},55645:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Gyroscope service"},o="Gyroscope",p={unversionedId:"api/clients/gyroscope",id:"api/clients/gyroscope",title:"Gyroscope",description:"DeviceScript client for Gyroscope service",source:"@site/docs/api/clients/gyroscope.md",sourceDirName:"api/clients",slug:"/api/clients/gyroscope",permalink:"/devicescript/api/clients/gyroscope",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Gyroscope service"},sidebar:"tutorialSidebar"},l={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"readingRange",id:"rw:readingRange",level:3},{value:"supportedRanges",id:"const:supportedRanges",level:3}],c={toc:s},u="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"gyroscope"},"Gyroscope"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A 3-axis gyroscope."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Gyroscope } from "@devicescript/core"\n\nconst gyroscope = new Gyroscope()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Indicates the current rates acting on gyroscope."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i12.20 i12.20 i12.20"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gyroscope } from "@devicescript/core"\n\nconst gyroscope = new Gyroscope()\n// ...\ngyroscope.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Error on the reading value."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u12.20"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gyroscope } from "@devicescript/core"\n\nconst gyroscope = new Gyroscope()\n// ...\nconst value = await gyroscope.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gyroscope } from "@devicescript/core"\n\nconst gyroscope = new Gyroscope()\n// ...\ngyroscope.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:readingRange"},"readingRange"),(0,a.kt)("p",null,'Configures the range of rotation rates.\nThe value will be "rounded up" to one of ',(0,a.kt)("inlineCode",{parentName:"p"},"max_rates_supported"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u12.20"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gyroscope } from "@devicescript/core"\n\nconst gyroscope = new Gyroscope()\n// ...\nconst value = await gyroscope.readingRange.read()\nawait gyroscope.readingRange.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Gyroscope } from "@devicescript/core"\n\nconst gyroscope = new Gyroscope()\n// ...\ngyroscope.readingRange.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:supportedRanges"},"supportedRanges"),(0,a.kt)("p",null,"Lists values supported for writing ",(0,a.kt)("inlineCode",{parentName:"p"},"max_rate"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"type: ",(0,a.kt)("inlineCode",{parentName:"li"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"li"},"r: u12.20"),")"),(0,a.kt)("li",{parentName:"ul"},"optional: this register may not be implemented"),(0,a.kt)("li",{parentName:"ul"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3c8d9a18.158c036d.js b/assets/js/3c8d9a18.158c036d.js new file mode 100644 index 00000000000..e322877e19c --- /dev/null +++ b/assets/js/3c8d9a18.158c036d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6618],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},30561:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(25773),o=(n(27378),n(35318));const a={sidebar_position:.5},i="Roles",s={unversionedId:"api/core/roles",id:"api/core/roles",title:"Roles",description:"Roles are defined by instantiating a service client.",source:"@site/docs/api/core/roles.md",sourceDirName:"api/core",slug:"/api/core/roles",permalink:"/devicescript/api/core/roles",draft:!1,tags:[],version:"current",sidebarPosition:.5,frontMatter:{sidebar_position:.5},sidebar:"tutorialSidebar",previous:{title:"Code",permalink:"/devicescript/api/core/"},next:{title:"Registers",permalink:"/devicescript/api/core/registers"}},c={},l=[],p={toc:l},u="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roles"},"Roles"),(0,o.kt)("p",null,"Roles are defined by instantiating a service client.\nThe same role can be referenced multiple times, and runtime makes sure not to assign\nmultiple roles to the same service instance."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"const btnA = new ds.Button()\nconst btnB = new ds.Button()\nconst pot = new ds.Potentiometer()\nconst lamp = new ds.LightBulb()\n")),(0,o.kt)("p",null,"You can check if role is currently assigned, and react to it being assigned or unassigned:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const heater = new ds.Relay()\nif (heater.isBound)\n heater.enabled.write(true)\nheater.onConnected(() => {\n // ...\n})\nheater.onDisconnected(() => {\n // ...\n})\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3dd53374.77eae4ac.js b/assets/js/3dd53374.77eae4ac.js new file mode 100644 index 00000000000..ea0f8787374 --- /dev/null +++ b/assets/js/3dd53374.77eae4ac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[320],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>h});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=i,h=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(h,o(o({ref:t},l),{},{components:r})):n.createElement(h,o({ref:t},l))}));function h(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[d]="string"==typeof e?e:i,o[1]=s;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},26763:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={sidebar_position:11,title:"Add SoC/MCU"},o="Adding a System-on-a-Chip or Microcontroller",s={unversionedId:"devices/add-soc",id:"devices/add-soc",title:"Add SoC/MCU",description:"DeviceScript currently supports the following:",source:"@site/docs/devices/add-soc.mdx",sourceDirName:"devices",slug:"/devices/add-soc",permalink:"/devicescript/devices/add-soc",draft:!1,tags:[],version:"current",sidebarPosition:11,frontMatter:{sidebar_position:11,title:"Add SoC/MCU"},sidebar:"tutorialSidebar",previous:{title:"Add Board",permalink:"/devicescript/devices/add-board"},next:{title:"Add Shield",permalink:"/devicescript/devices/add-shield"}},c={},p=[{value:"Creating new SoC",id:"creating-new-soc",level:2}],l={toc:p},d="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"adding-a-system-on-a-chip-or-microcontroller"},"Adding a System-on-a-Chip or Microcontroller"),(0,i.kt)("p",null,"DeviceScript currently supports the following:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32"},"ESP32"),', including the "classic", S2, S3, and C3 variants'),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-pico"},"RP2040"),", including Raspberry Pi Pico and Pico W"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/tree/main/runtime/posix"},"WASM and POSIX")," for simulation")),(0,i.kt)("p",null,"Following are work-in-progress:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-stm32"},"STM32"),", specifically STM32L475VG")),(0,i.kt)("p",null,"If you're working on a port, let us know (via\n",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/issues"},"GitHub issue")," or\n",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/discussions"},"discussion"),") so we can list is here."),(0,i.kt)("p",null,'Generally, DeviceScript has a concept of an "architecture" which corresponds 1:1 to an executable binary,\nwhich is a specific SoC/MCU or a family thereof\n(we use SoC (System-on-a-Chip) and MCU (Microcontroller Unit) interchangably in this document).'),(0,i.kt)("p",null,"For example, for ESP32 there are ",(0,i.kt)("inlineCode",{parentName:"p"},"esp32"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"esp32c3"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"esp32s2"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"esp32s3")," architectures.\nFor RP2040, we have two architectures: ",(0,i.kt)("inlineCode",{parentName:"p"},"rp2040")," (generic) and ",(0,i.kt)("inlineCode",{parentName:"p"},"rp2040w")," (with support for WiFi chip from Pico W).\nFor STM32, it may be possible in future to have say a single ",(0,i.kt)("inlineCode",{parentName:"p"},"stm32l4")," architecture that then dynamically adds enables support\nfor peripherals that are present and auto-detects the size of RAM and FLASH,\nbut right now we just have a specific ",(0,i.kt)("inlineCode",{parentName:"p"},"stm32l475vg"),"."),(0,i.kt)("p",null,"DeviceScript further ",(0,i.kt)("a",{parentName:"p",href:"/devices/add-board"},'defines "boards"')," which take a binary architecture image and binary-edit it to include\nconfiguration data about pin names and on-board peripherals."),(0,i.kt)("p",null,'Note, that there isn\'t any shared code for say "ARM" or "RISC-V" architecture, as all the VM code is platform-agnostic C anyways,\nwhich sits in the main ',(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/tree/main/runtime/devicescript"},"DeviceScript repo"),"."),(0,i.kt)("h2",{id:"creating-new-soc"},"Creating new SoC"),(0,i.kt)("p",null,"It's best to start by forking an existing port, we suggest the ",(0,i.kt)("inlineCode",{parentName:"p"},"rp2040")," one, and implement functions one by one.\nStart by looking at ",(0,i.kt)("inlineCode",{parentName:"p"},"jd_user_config.h")," file and disable things."),(0,i.kt)("p",null,"Note that the STM32 port borrows heavily from ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/jacdac-msr-modules"},"Jacdac firmware for STM32G0-based modules"),",\nso parts of the source are not necessary for DeviceScript.\nIf you want to use STM32 as a base, it's likely better to use ",(0,i.kt)("inlineCode",{parentName:"p"},"rp2040")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"esp32")," as the skeleton,\nand copy code from the STM32 as needed."),(0,i.kt)("p",null,"As for SoC requirements:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"make sure your SoC ",(0,i.kt)("a",{parentName:"li",href:"/language/runtime#memory"},"has enough memory")),(0,i.kt)("li",{parentName:"ul"},"it's highly recommended to use SoCs with built-in USB peripheral; we do have some support for using external USB-UART chips (as in ESP32 classic port) but it's rather buggy")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3de927d0.26022825.js b/assets/js/3de927d0.26022825.js new file mode 100644 index 00000000000..64b60e8c169 --- /dev/null +++ b/assets/js/3de927d0.26022825.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1431],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),d=i,k=u["".concat(p,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(k,o(o({ref:t},s),{},{components:n})):r.createElement(k,o({ref:t},s))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var c=2;c<a;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},25193:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Switch service"},o="Switch",l={unversionedId:"api/clients/switch",id:"api/clients/switch",title:"Switch",description:"DeviceScript client for Switch service",source:"@site/docs/api/clients/switch.md",sourceDirName:"api/clients",slug:"/api/clients/switch",permalink:"/devicescript/api/clients/switch",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Switch service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"variant",id:"const:variant",level:3},{value:"Events",id:"events",level:2},{value:"on",id:"on",level:3},{value:"off",id:"off",level:3}],s={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"switch"},"Switch"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A switch, which keeps its position."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Switch } from "@devicescript/core"\n\nconst sw = new Switch()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"Indicates whether the switch is currently active (on)."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Switch } from "@devicescript/core"\n\nconst sw = new Switch()\n// ...\nconst value = await sw.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Switch } from "@devicescript/core"\n\nconst sw = new Switch()\n// ...\nsw.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Describes the type of switch used."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Switch } from "@devicescript/core"\n\nconst sw = new Switch()\n// ...\nconst value = await sw.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h2",{id:"events"},"Events"),(0,i.kt)("h3",{id:"on"},"on"),(0,i.kt)("p",null,"Emitted when switch goes from ",(0,i.kt)("inlineCode",{parentName:"p"},"off")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"on"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"sw.on.subscribe(() => {\n\n})\n")),(0,i.kt)("h3",{id:"off"},"off"),(0,i.kt)("p",null,"Emitted when switch goes from ",(0,i.kt)("inlineCode",{parentName:"p"},"on")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"off"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"sw.off.subscribe(() => {\n\n})\n")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3e4ca316.87dad0b3.js b/assets/js/3e4ca316.87dad0b3.js new file mode 100644 index 00000000000..099741d8034 --- /dev/null +++ b/assets/js/3e4ca316.87dad0b3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2671],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=i,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,s(s({ref:t},c),{},{components:n})):a.createElement(f,s({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,s=new Array(r);s[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:i,s[1]=o;for(var p=2;p<r;p++)s[p]=n[p];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},60979:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>o,toc:()=>p});var a=n(25773),i=(n(27378),n(35318));const r={title:"Runtime implementation",sidebar_position:99},s="Runtime implementation",o={unversionedId:"language/runtime",id:"language/runtime",title:"Runtime implementation",description:"DeviceScript compiler takes TypeScript files and generates bytecode files, which are then executed by",source:"@site/docs/language/runtime.mdx",sourceDirName:"language",slug:"/language/runtime",permalink:"/devicescript/language/runtime",draft:!1,tags:[],version:"current",sidebarPosition:99,frontMatter:{title:"Runtime implementation",sidebar_position:99},sidebar:"tutorialSidebar",previous:{title:"Tree-shaking",permalink:"/devicescript/language/tree-shaking"},next:{title:"Bytecode",permalink:"/devicescript/language/bytecode"}},l={},p=[{value:"Memory requirements",id:"memory",level:2},{value:"Why not Web Assembly (Wasm)?",id:"why-not-web-assembly-wasm",level:2},{value:"NaN-boxing",id:"nan-boxing",level:2},{value:"String representation",id:"string-representation",level:2},{value:"GC",id:"gc",level:2},{value:"Bytecode example",id:"bytecode-example",level:2}],c={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"runtime-implementation"},"Runtime implementation"),(0,i.kt)("p",null,"DeviceScript compiler takes TypeScript files and generates bytecode files, which are then executed by\nthe DeviceScript runtime.\nThe bytecode files are designed to be small (about half the size of source code)\nand executable directly from storage (typically flash memory), with minimal overhead in RAM."),(0,i.kt)("p",null,"For technical specification of bytecode files see ",(0,i.kt)("a",{parentName:"p",href:"/language/bytecode"},"Bytecode format page"),"\nand the example below."),(0,i.kt)("h2",{id:"memory"},"Memory requirements"),(0,i.kt)("p",null,"A DeviceScript build for Raspberry Pi Pico (not W) takes about 200kB of flash.\nOf that, 134kB is taken by DeviceScript (and Jacdac) library and the rest by system libraries.\nA build for STM32L4+ takes 153kB of flash, of which 115kB if taken by DeviceScript\n(this likely due to different compiler settings).\nBuilds for ESP32 are around 1.2MB due to various libraries, mostly related to networking and TLS."),(0,i.kt)("p",null,"These numbers do not include bytecode size for user program."),(0,i.kt)("p",null,"RAM usage can be configured via ",(0,i.kt)("inlineCode",{parentName:"p"},"JD_GC_KB"),". This defaults to 64kB but it's often possible\nto run with 32kB or less when not doing web requests.\nAdditionally, the following subsystems take some RAM:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"DeviceScript context - 2kB"),(0,i.kt)("li",{parentName:"ul"},"DeviceScript logging (",(0,i.kt)("inlineCode",{parentName:"li"},"DMESG()"),") - 4kB"),(0,i.kt)("li",{parentName:"ul"},"Jacdac packet queues - 5kB")),(0,i.kt)("p",null,"Note that networking typically takes significant amounts of RAM, especially when using TLS."),(0,i.kt)("h2",{id:"why-not-web-assembly-wasm"},"Why not Web Assembly (Wasm)?"),(0,i.kt)("p",null,"While the DeviceScript runtime itself can be compiled to Wasm, the bytecode format that the TypeScript\nis compiled to is quite different."),(0,i.kt)("p",null,"Wasm files have a tree structure of unlimited depth, designed for fast JIT compilation, not in-place interpreters.\nThus, executing Wasm from a read-only memory incurs significant overhead in working memory,\neven with ",(0,i.kt)("a",{parentName:"p",href:"https://arxiv.org/pdf/2205.01183.pdf"},"state of the art approaches"),".\nTypically, on an embedded system you have ~5x-20x the flash memory (which is quite slow to write) compared to RAM."),(0,i.kt)("p",null,"Additionally, Wasm is a low-level bytecode, for example ",(0,i.kt)("inlineCode",{parentName:"p"},"i32.add")," takes two 32-bit integers and adds them up.\nFor JavaScript semantics, you want the ",(0,i.kt)("inlineCode",{parentName:"p"},"+")," operator to work on doubles, strings, and integers (if represented differently than doubles)."),(0,i.kt)("h2",{id:"nan-boxing"},"NaN-boxing"),(0,i.kt)("p",null,"The DeviceScript runtime uses ",(0,i.kt)("a",{parentName:"p",href:"https://anniecherkaev.com/the-secret-life-of-nan"},"NaN-boxing"),"\non both 64- and 32-bit architectures.\nThat is all JavaScript values are represented as 64-bit doubles,\nbut various NaN and subnormal encodings have special meaning:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"all 32-bit signed integers are represented in low word (mantissa),\nwhen the high word (sign, exponent, and high bits of mantissa) is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"0xffff_ffff"),"\n(this is a subset of NaNs)"),(0,i.kt)("li",{parentName:"ul"},"various special values (",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"null"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"NaN"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"false"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"Infinity"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"-Infinity"),")\nare represented as subnormals"),(0,i.kt)("li",{parentName:"ul"},"pointers to heap objects are also represented as subnormals;\non 64-bit machines pointers are assumed to live within GC heap, which is assumed to be under 4GB"),(0,i.kt)("li",{parentName:"ul"},"references to bytecode objects (strings, buffers, service specifcations, functions, ...)\nare subnormal too"),(0,i.kt)("li",{parentName:"ul"},"finally, functions (which are 16 bit indices) can be bound to other objects and still fit in a subnormal;\nthat is, ",(0,i.kt)("inlineCode",{parentName:"li"},"x.foo")," where ",(0,i.kt)("inlineCode",{parentName:"li"},".foo")," is a function is represented as heap reference to ",(0,i.kt)("inlineCode",{parentName:"li"},"x")," and index of ",(0,i.kt)("inlineCode",{parentName:"li"},".foo")," function\nin bytecode, all packed into a 64-bit value")),(0,i.kt)("h2",{id:"string-representation"},"String representation"),(0,i.kt)("p",null,"All strings are represented as valid UTF8 (which is a ",(0,i.kt)("a",{parentName:"p",href:"/language/strings"},"slight departure")," from JavaScript semantics).\nThis makes it easy to send them over wire and also saves memory when strings only use\nASCII characters (which is often the case even in international code-bases due to field/function names).\nThere are two representations:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"short ASCII strings are represented simply as NUL-terminated byte sequences in bytecode - when ",(0,i.kt)("inlineCode",{parentName:"li"},".length")," is requested - it's recomputed"),(0,i.kt)("li",{parentName:"ul"},"longer and non-ASCII strings are represented as structures with byte size, character length and jump list to speed up indexing;\nthe jump list has byte index of every 16-th character index")),(0,i.kt)("h2",{id:"gc"},"GC"),(0,i.kt)("p",null,"Garbage collector in DeviceScript is quite simple, yet efficient.\nCollection can happen on any allocation, and is forced after a fixed size of allocations has been reached since\nlast collection, or when the allocation cannot be performed.\nAllocation always prefers returning smaller addresses, which tends to reduce fragmentation\n(this is also the reason why we force collection more often than necessary)."),(0,i.kt)("p",null,"The collection is quick, since the heap size compared to CPU speed is very small.\nTypical embedded system is 10x-100x slower than a desktop CPU, but has 100,000x-1,000,000x less RAM,\nthus scanning the whole heap takes on the order of a single millisecond."),(0,i.kt)("h2",{id:"bytecode-example"},"Bytecode example"),(0,i.kt)("p",null,"Let's take a look at how a simple example is compiled:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'function add(x: any, y: any) {\n return x + y\n}\nfunction assertEq(x: any, y: any) {\n if (x !== y) throw new Error(`Not eq: ${x} != ${y}!`)\n}\nassertEq(add(2, 2.1), 4.1)\nassertEq(add("2", 2), "22")\n')),(0,i.kt)("p",null,"We compile it with ",(0,i.kt)("inlineCode",{parentName:"p"},"devs build")," and then can disassemble it with ",(0,i.kt)("inlineCode",{parentName:"p"},"devs disasm"),"\n(or ",(0,i.kt)("inlineCode",{parentName:"p"},"devs disasm --detailed"),"; you can also pass a ",(0,i.kt)("inlineCode",{parentName:"p"},".devs")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-dbg.json")," file to ",(0,i.kt)("inlineCode",{parentName:"p"},"disasm"),").\nThe disassembly results in the following output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},"proc main_F0(): @176\n")),(0,i.kt)("p",null,"The first procedure in bytecode file is an entry point.\nHere, it sits at byte offset ",(0,i.kt)("inlineCode",{parentName:"p"},"176")," in the bytecode file."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0}," 0: CALL prototype_F1{F1}() // 270102\n")),(0,i.kt)("p",null,"The three bytes ",(0,i.kt)("inlineCode",{parentName:"p"},"0x27, 0x01, 0x02"),' encode state\n"function reference", "function number 1", "call 0-arguments".'),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0}," 3: CALL add_F3{F3}(2, 2.1{D0}) // 270392290004\n")),(0,i.kt)("p",null,'Here the opcodes say "function reference", "function 3",\n"constant 0x92 - 0x90 == 2", "double reference",\n"double number 0", "call 2-arguments".\nThe number ',(0,i.kt)("inlineCode",{parentName:"p"},"3:")," in front refers to byte offset within a function."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0}," 9: CALL assertEq_F2{F2}(ret_val(), 4.1{D1}) // 27022c290104\n")),(0,i.kt)("p",null,"Here, we have ",(0,i.kt)("inlineCode",{parentName:"p"},"ret_val()")," opcode refering to the result of previous\ncall - calls are statements so they cannot be nested."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},' 15: CALL add_F3{F3}("2"{A3}, 2) // 270325039204\n')),(0,i.kt)("p",null,"The new thing here is ASCII string reference (see table of strings and doubles at the bottom of the file)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},' 21: CALL assertEq_F2{F2}(ret_val(), "22"{A4}) // 27022c250404\n 27: CALL ds."restart"{I57}() // 1e3902\n 30: RETURN 0 // 900c\n')),(0,i.kt)("p",null,"The compiler adds call to ",(0,i.kt)("inlineCode",{parentName:"p"},"ds.restart()")," in test-mode compilation.\nNote that there is special opcode for members of ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/core"),'\nmodule that are referenced by built-in strings ("internal string 57");\nthus ',(0,i.kt)("inlineCode",{parentName:"p"},"ds.restart()")," is only 3 bytes.\nThe final ",(0,i.kt)("inlineCode",{parentName:"p"},"RETURN")," is superfluous."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},"proc prototype_F1(): @208\n 0: RETURN undefined // 2e0c\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"prototype_Fx()")," function would have assignment of methods\nto prototypes if there were any.\nAlso ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," has it's own opcode."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},"proc assertEq_F2(par0, par1): @212\n 0: JMP 25 IF NOT (par0{L0} !== par1{L1}) // 15001501470ef90014\n")),(0,i.kt)("p",null,"Here we jump to offset ",(0,i.kt)("inlineCode",{parentName:"p"},"25"),' if the condition is not true.\nThe condition refers to "local variable 0" and "1"\n(which happen to be parameters).'),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},' 9: CALL ds."format"{I76}("Not eq: {0} != {1}!"{A1}, par0{L0}, par1{L1}) // 1e4c25011500150105\n')),(0,i.kt)("p",null,"The template literals are compiled to ",(0,i.kt)("inlineCode",{parentName:"p"},"ds.format()")," calls."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0}," 18: CALL (new Error{O27})(ret_val()) // 011b582c03\n")),(0,i.kt)("p",null,"Here, the ",(0,i.kt)("inlineCode",{parentName:"p"},"new"),' opcode takes a reference to "built-in object 27" (',(0,i.kt)("inlineCode",{parentName:"p"},"Error"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0}," 23: THROW ret_val() // 2c54\n 25: RETURN undefined // 2e0c\n\nproc add_F3(par0, par1): @240\n 0: RETURN (par0{L0} + par1{L1}) // 150015013a0c\n\n")),(0,i.kt)("p",null,"Note how the ",(0,i.kt)("inlineCode",{parentName:"p"},"+")," opcode can be used on both strings and numbers."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js",metastring:"skip",skip:!0},'Strings ASCII:\n 0: "assertEq"\n 1: "Not eq: {0} != {1}!"\n 2: "add"\n 3: "2"\n 4: "22"\n 5: "assertEq"\n\nStrings UTF8:\n\nStrings buffer:\n\nDoubles:\n 0: 2.1\n 1: 4.1\n')),(0,i.kt)("p",null,"The file finishes with tables of various literals.\nThe short ASCII literals are separate from UTF8 literals, which have a more\ncomplex representation."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3f4a2944.40a74b03.js b/assets/js/3f4a2944.40a74b03.js new file mode 100644 index 00000000000..dd0bca03a8c --- /dev/null +++ b/assets/js/3f4a2944.40a74b03.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7573],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=r,k=m["".concat(p,".").concat(d)]||m[d]||u[d]||i;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[m]="string"==typeof e?e:r,o[1]=s;for(var l=2;l<i;l++)o[l]=n[l];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},91997:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Compass service"},o="Compass",s={unversionedId:"api/clients/compass",id:"api/clients/compass",title:"Compass",description:"DeviceScript client for Compass service",source:"@site/docs/api/clients/compass.md",sourceDirName:"api/clients",slug:"/api/clients/compass",permalink:"/devicescript/api/clients/compass",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Compass service"},sidebar:"tutorialSidebar"},p={},l=[{value:"Commands",id:"commands",level:2},{value:"calibrate",id:"calibrate",level:3},{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"readingError",id:"ro:readingError",level:3}],c={toc:l},m="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"compass"},"Compass"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,r.kt)("p",null,"A sensor that measures the heading."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"calibrate"},"calibrate"),(0,r.kt)("p",null,"Starts a calibration sequence for the compass."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"compass.calibrate(): Promise<void>\n")),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"The heading with respect to the magnetic north."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n// ...\nconst value = await compass.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n// ...\ncompass.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:enabled"},"enabled"),(0,r.kt)("p",null,"Turn on or off the sensor. Turning on the sensor may start a calibration sequence."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n// ...\nconst value = await compass.enabled.read()\nawait compass.enabled.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n// ...\ncompass.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:readingError"},"readingError"),(0,r.kt)("p",null,"Error on the heading reading"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n// ...\nconst value = await compass.readingError.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Compass } from "@devicescript/core"\n\nconst compass = new Compass()\n// ...\ncompass.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4009ac77.1b52d52c.js b/assets/js/4009ac77.1b52d52c.js new file mode 100644 index 00000000000..82e21b7acb5 --- /dev/null +++ b/assets/js/4009ac77.1b52d52c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5709],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=s(r),m=o,f=p["".concat(c,".").concat(m)]||p[m]||d[m]||i;return r?n.createElement(f,a(a({ref:t},u),{},{components:r})):n.createElement(f,a({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[p]="string"==typeof e?e:o,a[1]=l;for(var s=2;s<i;s++)a[s]=r[s];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},36721:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var n=r(25773),o=(r(27378),r(35318));const i={title:"Blues.io Notecard",sidebar_position:5.5},a="Blues.io Notecard",l={unversionedId:"developer/iot/blues-io/index",id:"developer/iot/blues-io/index",title:"Blues.io Notecard",description:"The Blues.io Notecard provides",source:"@site/docs/developer/iot/blues-io/index.mdx",sourceDirName:"developer/iot/blues-io",slug:"/developer/iot/blues-io/",permalink:"/devicescript/developer/iot/blues-io/",draft:!1,tags:[],version:"current",sidebarPosition:5.5,frontMatter:{title:"Blues.io Notecard",sidebar_position:5.5},sidebar:"tutorialSidebar",previous:{title:"Adafruit.io",permalink:"/devicescript/developer/iot/adafruit-io/"},next:{title:"Blynk.io",permalink:"/devicescript/developer/iot/blynk-io/"}},c={},s=[{value:"Getting started",id:"getting-started",level:2},{value:"Configuration",id:"configuration",level:2}],u={toc:s},p="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(p,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"bluesio-notecard"},"Blues.io Notecard"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://blues.io/products/notecard/"},"Blues.io Notecard")," provides\na simple way to add cellular connectivity to your IoT project."),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/pelikhan/devicescript-note"},"pelikhan/devicescript-note")," package uses ",(0,o.kt)("a",{parentName:"p",href:"https://dev.blues.io/guides-and-tutorials/notecard-guides/serial-over-i2c-protocol/"},"I2C to communicate with the Notecard"),"."),(0,o.kt)("h2",{id:"getting-started"},"Getting started"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Create a new DeviceScript project"),(0,o.kt)("li",{parentName:"ul"},"Add the library to your DeviceScript project:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install --save pelikhan/devicescript-note\n")),(0,o.kt)("h2",{id:"configuration"},"Configuration"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/developer/settings"},"Add device settings")," to your project"),(0,o.kt)("li",{parentName:"ul"},"Add the notehub product UID into your settings.\nBy default, DeviceScript will use the deviceid as a serial number; but you can override this setting.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# .env.defaults\nNOTE_PUID=your-product-uid\nNOTE_SN=your-serial-number\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Connect the notecard to your I2C pins and power it up.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Temperature } from "@devicescript/core"\nimport { delay, millis } from "@devicescript/core"\nimport { init, request, NoteAddRequest } from "devicescript-note"\n\n// configure product UID and serial number\nawait init()\n\n// connect sensors\nconst temperature = new Temperature()\n\nwhile (true) {\n // read sensor values\n const t = await temperature.reading.read()\n\n // send node.add request\n await request(<NoteAddRequest>{\n req: "note.add",\n body: { t },\n })\n\n // take a break\n await delay(10000)\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4178.2b265306.js b/assets/js/4178.2b265306.js new file mode 100644 index 00000000000..c736b4b80b1 --- /dev/null +++ b/assets/js/4178.2b265306.js @@ -0,0 +1 @@ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4178],{26746:(n,t,e)=>{n.exports=function(){function n(t,e,i){function r(a,u){if(!e[a]){if(!t[a]){if(c)return c(a,!0);var o=new Error("Cannot find module '"+a+"'");throw o.code="MODULE_NOT_FOUND",o}var s=e[a]={exports:{}};t[a][0].call(s.exports,(function(n){return r(t[a][1][n]||n)}),s,s.exports,n,t,e,i)}return e[a].exports}for(var c=void 0,a=0;a<i.length;a++)r(i[a]);return r}return n}()({1:[function(n,t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function n(n,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}();function r(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}var c=function(){function n(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.defaultLayoutOptions,c=void 0===i?{}:i,u=e.algorithms,o=void 0===u?["layered","stress","mrtree","radial","force","disco","sporeOverlap","sporeCompaction","rectpacking"]:u,s=e.workerFactory,h=e.workerUrl;if(r(this,n),this.defaultLayoutOptions=c,this.initialized=!1,void 0===h&&void 0===s)throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");var f=s;void 0!==h&&void 0===s&&(f=function(n){return new Worker(n)});var l=f(h);if("function"!=typeof l.postMessage)throw new TypeError("Created worker does not provide the required 'postMessage' function.");this.worker=new a(l),this.worker.postMessage({cmd:"register",algorithms:o}).then((function(n){return t.initialized=!0})).catch(console.err)}return i(n,[{key:"layout",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.layoutOptions,i=void 0===e?this.defaultLayoutOptions:e,r=t.logging,c=void 0!==r&&r,a=t.measureExecutionTime,u=void 0!==a&&a;return n?this.worker.postMessage({cmd:"layout",graph:n,layoutOptions:i,options:{logging:c,measureExecutionTime:u}}):Promise.reject(new Error("Missing mandatory parameter 'graph'."))}},{key:"knownLayoutAlgorithms",value:function(){return this.worker.postMessage({cmd:"algorithms"})}},{key:"knownLayoutOptions",value:function(){return this.worker.postMessage({cmd:"options"})}},{key:"knownLayoutCategories",value:function(){return this.worker.postMessage({cmd:"categories"})}},{key:"terminateWorker",value:function(){this.worker.terminate()}}]),n}();e.default=c;var a=function(){function n(t){var e=this;if(r(this,n),void 0===t)throw new Error("Missing mandatory parameter 'worker'.");this.resolvers={},this.worker=t,this.worker.onmessage=function(n){setTimeout((function(){e.receive(e,n)}),0)}}return i(n,[{key:"postMessage",value:function(n){var t=this.id||0;this.id=t+1,n.id=t;var e=this;return new Promise((function(i,r){e.resolvers[t]=function(n,t){n?(e.convertGwtStyleError(n),r(n)):i(t)},e.worker.postMessage(n)}))}},{key:"receive",value:function(n,t){var e=t.data,i=n.resolvers[e.id];i&&(delete n.resolvers[e.id],e.error?i(e.error):i(null,e.data))}},{key:"terminate",value:function(){this.worker.terminate&&this.worker.terminate()}},{key:"convertGwtStyleError",value:function(n){if(n){var t=n.__java$exception;t&&(t.cause&&t.cause.backingJsObject&&(n.cause=t.cause.backingJsObject,this.convertGwtStyleError(n.cause)),delete n.__java$exception)}}}]),n}()},{}],2:[function(n,t,i){(function(n){(function(){"use strict";var e;function r(){}function c(){}function a(){}function u(){}function o(){}function s(){}function h(){}function f(){}function l(){}function b(){}function w(){}function d(){}function g(){}function p(){}function v(){}function m(){}function y(){}function k(){}function j(){}function E(){}function T(){}function M(){}function S(){}function P(){}function C(){}function I(){}function O(){}function A(){}function $(){}function L(){}function N(){}function x(){}function D(){}function R(){}function K(){}function _(){}function F(){}function B(){}function H(){}function q(){}function G(){}function z(){}function U(){}function X(){}function W(){}function V(){}function Q(){}function Y(){}function J(){}function Z(){}function nn(){}function tn(){}function en(){}function rn(){}function cn(){}function an(){}function un(){}function on(){}function sn(){}function hn(){}function fn(){}function ln(){}function bn(){}function wn(){}function dn(){}function gn(){}function pn(){}function vn(){}function mn(){}function yn(){}function kn(){}function jn(){}function En(){}function Tn(){}function Mn(){}function Sn(){}function Pn(){}function Cn(){}function In(){}function On(){}function An(){}function $n(){}function Ln(){}function Nn(){}function xn(){}function Dn(){}function Rn(){}function Kn(){}function _n(){}function Fn(){}function Bn(){}function Hn(){}function qn(){}function Gn(){}function zn(){}function Un(){}function Xn(){}function Wn(){}function Vn(){}function Qn(){}function Yn(){}function Jn(){}function Zn(){}function nt(){}function tt(){}function et(){}function it(){}function rt(){}function ct(){}function at(){}function ut(){}function ot(){}function st(){}function ht(){}function ft(){}function lt(){}function bt(){}function wt(){}function dt(){}function gt(){}function pt(){}function vt(){}function mt(){}function yt(){}function kt(){}function jt(){}function Et(){}function Tt(){}function Mt(){}function St(){}function Pt(){}function Ct(){}function It(){}function Ot(){}function At(){}function $t(){}function Lt(){}function Nt(){}function xt(){}function Dt(){}function Rt(){}function Kt(){}function _t(){}function Ft(){}function Bt(){}function Ht(){}function qt(){}function Gt(){}function zt(){}function Ut(){}function Xt(){}function Wt(){}function Vt(){}function Qt(){}function Yt(){}function Jt(){}function Zt(){}function ne(){}function te(){}function ee(){}function ie(){}function re(){}function ce(){}function ae(){}function ue(){}function oe(){}function se(){}function he(){}function fe(){}function le(){}function be(){}function we(){}function de(){}function ge(){}function pe(){}function ve(){}function me(){}function ye(){}function ke(){}function je(){}function Ee(){}function Te(){}function Me(){}function Se(){}function Pe(){}function Ce(){}function Ie(){}function Oe(){}function Ae(){}function $e(){}function Le(){}function Ne(){}function xe(){}function De(){}function Re(){}function Ke(){}function _e(){}function Fe(){}function Be(){}function He(){}function qe(){}function Ge(){}function ze(){}function Ue(){}function Xe(){}function We(){}function Ve(){}function Qe(){}function Ye(){}function Je(){}function Ze(){}function ni(){}function ti(){}function ei(){}function ii(){}function ri(){}function ci(){}function ai(){}function ui(){}function oi(){}function si(){}function hi(){}function fi(){}function li(){}function bi(){}function wi(){}function di(){}function gi(){}function pi(){}function vi(){}function mi(){}function yi(){}function ki(){}function ji(){}function Ei(){}function Ti(){}function Mi(){}function Si(){}function Pi(){}function Ci(){}function Ii(){}function Oi(){}function Ai(){}function $i(){}function Li(){}function Ni(){}function xi(){}function Di(){}function Ri(){}function Ki(){}function _i(){}function Fi(){}function Bi(){}function Hi(){}function qi(){}function Gi(){}function zi(){}function Ui(){}function Xi(){}function Wi(){}function Vi(){}function Qi(){}function Yi(){}function Ji(){}function Zi(){}function nr(){}function tr(){}function er(){}function ir(){}function rr(){}function cr(){}function ar(){}function ur(){}function or(){}function sr(){}function hr(){}function fr(){}function lr(){}function br(){}function wr(){}function dr(){}function gr(){}function pr(){}function vr(){}function mr(){}function yr(){}function kr(){}function jr(){}function Er(){}function Tr(){}function Mr(){}function Sr(){}function Pr(){}function Cr(){}function Ir(){}function Or(){}function Ar(){}function $r(){}function Lr(){}function Nr(){}function xr(){}function Dr(){}function Rr(){}function Kr(){}function _r(){}function Fr(){}function Br(){}function Hr(){}function qr(){}function Gr(){}function zr(){}function Ur(){}function Xr(){}function Wr(){}function Vr(){}function Qr(){}function Yr(){}function Jr(){}function Zr(){}function nc(){}function tc(){}function ec(){}function ic(){}function rc(){}function cc(){}function ac(){}function uc(){}function oc(){}function sc(){}function hc(){}function fc(){}function lc(){}function bc(){}function wc(){}function dc(){}function gc(){}function pc(){}function vc(){}function mc(){}function yc(){}function kc(){}function jc(){}function Ec(){}function Tc(){}function Mc(){}function Sc(){}function Pc(){}function Cc(){}function Ic(){}function Oc(){}function Ac(){}function $c(){}function Lc(){}function Nc(){}function xc(){}function Dc(){}function Rc(){}function Kc(){}function _c(){}function Fc(){}function Bc(){}function Hc(){}function qc(){}function Gc(){}function zc(){}function Uc(){}function Xc(){}function Wc(){}function Vc(){}function Qc(){}function Yc(){}function Jc(){}function Zc(){}function na(){}function ta(){}function ea(){}function ia(){}function ra(){}function ca(){}function aa(){}function ua(){}function oa(){}function sa(){}function ha(){}function fa(){}function la(){}function ba(){}function wa(){}function da(){}function ga(){}function pa(){}function va(){}function ma(){}function ya(){}function ka(){}function ja(){}function Ea(){}function Ta(){}function Ma(){}function Sa(){}function Pa(){}function Ca(){}function Ia(){}function Oa(){}function Aa(){}function $a(){}function La(){}function Na(){}function xa(){}function Da(){}function Ra(){}function Ka(){}function _a(){}function Fa(){}function Ba(){}function Ha(){}function qa(){}function Ga(){}function za(){}function Ua(){}function Xa(){}function Wa(){}function Va(){}function Qa(){}function Ya(){}function Ja(){}function Za(){}function nu(){}function tu(){}function eu(){}function iu(){}function ru(){}function cu(){}function au(){}function uu(){}function ou(){}function su(){}function hu(){}function fu(){}function lu(){}function bu(){}function wu(){}function du(){}function gu(){}function pu(){}function vu(){}function mu(){}function yu(){}function ku(){}function ju(){}function Eu(){}function Tu(){}function Mu(){}function Su(){}function Pu(){}function Cu(){}function Iu(){}function Ou(){}function Au(){}function $u(){}function Lu(){}function Nu(){}function xu(){}function Du(){}function Ru(){}function Ku(){}function _u(){}function Fu(){}function Bu(){}function Hu(){}function qu(){}function Gu(){}function zu(){}function Uu(){}function Xu(){}function Wu(){}function Vu(){}function Qu(){}function Yu(){}function Ju(){}function Zu(){}function no(){}function to(){}function eo(){}function io(){}function ro(){}function co(){}function ao(){}function uo(){}function oo(){}function so(){}function ho(){}function fo(){}function lo(){}function bo(){}function wo(){}function go(){}function po(){}function vo(){}function mo(){}function yo(){}function ko(){}function jo(){}function Eo(){}function To(){}function Mo(){}function So(){}function Po(){}function Co(){}function Io(){}function Oo(){}function Ao(){}function $o(){}function Lo(){}function No(){}function xo(){}function Do(){}function Ro(){}function Ko(){}function _o(){}function Fo(){}function Bo(){}function Ho(){}function qo(){}function Go(){}function zo(){}function Uo(){}function Xo(){}function Wo(){}function Vo(){}function Qo(){}function Yo(){}function Jo(){}function Zo(){}function ns(){}function ts(){}function es(){}function is(){}function rs(){}function cs(){}function as(){}function us(){}function os(){}function ss(){}function hs(){}function fs(){}function ls(){}function bs(){}function ws(){}function ds(){}function gs(){}function ps(){}function vs(){}function ms(){}function ys(){}function ks(){}function js(){}function Es(){}function Ts(){}function Ms(){}function Ss(){}function Ps(){}function Cs(){}function Is(){}function Os(){}function As(){}function $s(){}function Ls(){}function Ns(){}function xs(){}function Ds(){}function Rs(){}function Ks(){}function _s(){}function Fs(){}function Bs(){}function Hs(){}function qs(){}function Gs(){}function zs(){}function Us(){}function Xs(){}function Ws(){}function Vs(){}function Qs(){}function Ys(){}function Js(){}function Zs(){}function nh(){}function th(){}function eh(){}function ih(){}function rh(){}function ch(){}function ah(){}function uh(){}function oh(){}function sh(){}function hh(){}function fh(){}function lh(){}function bh(){}function wh(){}function dh(){}function gh(){}function ph(){}function vh(){}function mh(){}function yh(){}function kh(){}function jh(){}function Eh(){}function Th(){}function Mh(){}function Sh(){}function Ph(){}function Ch(){}function Ih(){}function Oh(){}function Ah(){}function $h(){}function Lh(){}function Nh(){}function xh(){}function Dh(){}function Rh(){}function Kh(){}function _h(n){}function Fh(n){}function Bh(){iy()}function Hh(){Gsn()}function qh(){Epn()}function Gh(){_kn()}function zh(){jSn()}function Uh(){fRn()}function Xh(){Kyn()}function Wh(){rkn()}function Vh(){EM()}function Qh(){mM()}function Yh(){q_()}function Jh(){TM()}function Zh(){Irn()}function nf(){SM()}function tf(){I6()}function ef(){Pin()}function rf(){Q8()}function cf(){_Z()}function af(){zsn()}function uf(){_Mn()}function of(){Cin()}function sf(){U2()}function hf(){fWn()}function ff(){Gyn()}function lf(){FZ()}function bf(){HXn()}function wf(){RZ()}function df(){Iin()}function gf(){Yun()}function pf(){GZ()}function vf(){C9()}function mf(){PM()}function yf(){KAn()}function kf(){Uyn()}function jf(){Fcn()}function Ef(){MMn()}function Tf(){bRn()}function Mf(){Bvn()}function Sf(){CAn()}function Pf(){Ran()}function Cf(){HZ()}function If(){s_n()}function Of(){$An()}function Af(){W$n()}function $f(){x9()}function Lf(){SMn()}function Nf(){sWn()}function xf(){Xsn()}function Df(){vdn()}function Rf(){qBn()}function Kf(){u_()}function _f(){wcn()}function Ff(){fFn()}function Bf(n){kW(n)}function Hf(n){this.a=n}function qf(n){this.a=n}function Gf(n){this.a=n}function zf(n){this.a=n}function Uf(n){this.a=n}function Xf(n){this.a=n}function Wf(n){this.a=n}function Vf(n){this.a=n}function Qf(n){this.a=n}function Yf(n){this.a=n}function Jf(n){this.a=n}function Zf(n){this.a=n}function nl(n){this.a=n}function tl(n){this.a=n}function el(n){this.a=n}function il(n){this.a=n}function rl(n){this.a=n}function cl(n){this.a=n}function al(n){this.a=n}function ul(n){this.a=n}function ol(n){this.a=n}function sl(n){this.b=n}function hl(n){this.c=n}function fl(n){this.a=n}function ll(n){this.a=n}function bl(n){this.a=n}function wl(n){this.a=n}function dl(n){this.a=n}function gl(n){this.a=n}function pl(n){this.a=n}function vl(n){this.a=n}function ml(n){this.a=n}function yl(n){this.a=n}function kl(n){this.a=n}function jl(n){this.a=n}function El(n){this.a=n}function Tl(n){this.a=n}function Ml(n){this.a=n}function Sl(n){this.a=n}function Pl(n){this.a=n}function Cl(){this.a=[]}function Il(n,t){n.a=t}function Ol(n,t){n.a=t}function Al(n,t){n.b=t}function $l(n,t){n.b=t}function Ll(n,t){n.b=t}function Nl(n,t){n.j=t}function xl(n,t){n.g=t}function Dl(n,t){n.i=t}function Rl(n,t){n.c=t}function Kl(n,t){n.d=t}function _l(n,t){n.d=t}function Fl(n,t){n.c=t}function Bl(n,t){n.k=t}function Hl(n,t){n.c=t}function ql(n,t){n.c=t}function Gl(n,t){n.a=t}function zl(n,t){n.a=t}function Ul(n,t){n.f=t}function Xl(n,t){n.a=t}function Wl(n,t){n.b=t}function Vl(n,t){n.d=t}function Ql(n,t){n.i=t}function Yl(n,t){n.o=t}function Jl(n,t){n.r=t}function Zl(n,t){n.a=t}function nb(n,t){n.b=t}function tb(n,t){n.e=t}function eb(n,t){n.f=t}function ib(n,t){n.g=t}function rb(n,t){n.e=t}function cb(n,t){n.f=t}function ab(n,t){n.f=t}function ub(n,t){n.n=t}function ob(n,t){n.a=t}function sb(n,t){n.a=t}function hb(n,t){n.c=t}function fb(n,t){n.c=t}function lb(n,t){n.d=t}function bb(n,t){n.e=t}function wb(n,t){n.g=t}function db(n,t){n.a=t}function gb(n,t){n.c=t}function pb(n,t){n.d=t}function vb(n,t){n.e=t}function mb(n,t){n.f=t}function yb(n,t){n.j=t}function kb(n,t){n.a=t}function jb(n,t){n.b=t}function Eb(n,t){n.a=t}function Tb(n){n.b=n.a}function Mb(n){n.c=n.d.d}function Sb(n){this.d=n}function Pb(n){this.a=n}function Cb(n){this.a=n}function Ib(n){this.a=n}function Ob(n){this.a=n}function Ab(n){this.a=n}function $b(n){this.a=n}function Lb(n){this.a=n}function Nb(n){this.a=n}function xb(n){this.a=n}function Db(n){this.a=n}function Rb(n){this.a=n}function Kb(n){this.a=n}function _b(n){this.a=n}function Fb(n){this.a=n}function Bb(n){this.b=n}function Hb(n){this.b=n}function qb(n){this.b=n}function Gb(n){this.a=n}function zb(n){this.a=n}function Ub(n){this.a=n}function Xb(n){this.c=n}function Wb(n){this.c=n}function Vb(n){this.c=n}function Qb(n){this.a=n}function Yb(n){this.a=n}function Jb(n){this.a=n}function Zb(n){this.a=n}function nw(n){this.a=n}function tw(n){this.a=n}function ew(n){this.a=n}function iw(n){this.a=n}function rw(n){this.a=n}function cw(n){this.a=n}function aw(n){this.a=n}function uw(n){this.a=n}function ow(n){this.a=n}function sw(n){this.a=n}function hw(n){this.a=n}function fw(n){this.a=n}function lw(n){this.a=n}function bw(n){this.a=n}function ww(n){this.a=n}function dw(n){this.a=n}function gw(n){this.a=n}function pw(n){this.a=n}function vw(n){this.a=n}function mw(n){this.a=n}function yw(n){this.a=n}function kw(n){this.a=n}function jw(n){this.a=n}function Ew(n){this.a=n}function Tw(n){this.a=n}function Mw(n){this.a=n}function Sw(n){this.a=n}function Pw(n){this.a=n}function Cw(n){this.a=n}function Iw(n){this.a=n}function Ow(n){this.a=n}function Aw(n){this.a=n}function $w(n){this.a=n}function Lw(n){this.a=n}function Nw(n){this.a=n}function xw(n){this.a=n}function Dw(n){this.a=n}function Rw(n){this.a=n}function Kw(n){this.a=n}function _w(n){this.a=n}function Fw(n){this.a=n}function Bw(n){this.e=n}function Hw(n){this.a=n}function qw(n){this.a=n}function Gw(n){this.a=n}function zw(n){this.a=n}function Uw(n){this.a=n}function Xw(n){this.a=n}function Ww(n){this.a=n}function Vw(n){this.a=n}function Qw(n){this.a=n}function Yw(n){this.a=n}function Jw(n){this.a=n}function Zw(n){this.a=n}function nd(n){this.a=n}function td(n){this.a=n}function ed(n){this.a=n}function id(n){this.a=n}function rd(n){this.a=n}function cd(n){this.a=n}function ad(n){this.a=n}function ud(n){this.a=n}function od(n){this.a=n}function sd(n){this.a=n}function hd(n){this.a=n}function fd(n){this.a=n}function ld(n){this.a=n}function bd(n){this.a=n}function wd(n){this.a=n}function dd(n){this.a=n}function gd(n){this.a=n}function pd(n){this.a=n}function vd(n){this.a=n}function md(n){this.a=n}function yd(n){this.a=n}function kd(n){this.a=n}function jd(n){this.a=n}function Ed(n){this.a=n}function Td(n){this.a=n}function Md(n){this.a=n}function Sd(n){this.a=n}function Pd(n){this.a=n}function Cd(n){this.a=n}function Id(n){this.a=n}function Od(n){this.a=n}function Ad(n){this.a=n}function $d(n){this.a=n}function Ld(n){this.a=n}function Nd(n){this.a=n}function xd(n){this.a=n}function Dd(n){this.a=n}function Rd(n){this.a=n}function Kd(n){this.a=n}function _d(n){this.a=n}function Fd(n){this.a=n}function Bd(n){this.c=n}function Hd(n){this.b=n}function qd(n){this.a=n}function Gd(n){this.a=n}function zd(n){this.a=n}function Ud(n){this.a=n}function Xd(n){this.a=n}function Wd(n){this.a=n}function Vd(n){this.a=n}function Qd(n){this.a=n}function Yd(n){this.a=n}function Jd(n){this.a=n}function Zd(n){this.a=n}function ng(n){this.a=n}function tg(n){this.a=n}function eg(n){this.a=n}function ig(n){this.a=n}function rg(n){this.a=n}function cg(n){this.a=n}function ag(n){this.a=n}function ug(n){this.a=n}function og(n){this.a=n}function sg(n){this.a=n}function hg(n){this.a=n}function fg(n){this.a=n}function lg(n){this.a=n}function bg(n){this.a=n}function wg(n){this.a=n}function dg(n){this.a=n}function gg(n){this.a=n}function pg(n){this.a=n}function vg(n){this.a=n}function mg(n){this.a=n}function yg(n){this.a=n}function kg(n){this.a=n}function jg(n){this.a=n}function Eg(n){this.a=n}function Tg(n){this.a=n}function Mg(n){this.a=n}function Sg(n){this.a=n}function Pg(n){this.a=n}function Cg(n){this.a=n}function Ig(n){this.a=n}function Og(n){this.a=n}function Ag(n){this.a=n}function $g(n){this.a=n}function Lg(n){this.a=n}function Ng(n){this.a=n}function xg(n){this.a=n}function Dg(n){this.a=n}function Rg(n){this.a=n}function Kg(n){this.a=n}function _g(n){this.a=n}function Fg(n){this.a=n}function Bg(n){this.a=n}function Hg(n){this.a=n}function qg(n){this.a=n}function Gg(n){this.a=n}function zg(n){this.a=n}function Ug(n){this.a=n}function Xg(n){this.a=n}function Wg(n){this.a=n}function Vg(n){this.a=n}function Qg(n){this.a=n}function Yg(n){this.a=n}function Jg(n){this.a=n}function Zg(n){this.a=n}function np(n){this.a=n}function tp(n){this.a=n}function ep(n){this.a=n}function ip(n){this.a=n}function rp(n){this.a=n}function cp(n){this.a=n}function ap(n){this.a=n}function up(n){this.b=n}function op(n){this.f=n}function sp(n){this.a=n}function hp(n){this.a=n}function fp(n){this.a=n}function lp(n){this.a=n}function bp(n){this.a=n}function wp(n){this.a=n}function dp(n){this.a=n}function gp(n){this.a=n}function pp(n){this.a=n}function vp(n){this.a=n}function mp(n){this.a=n}function yp(n){this.b=n}function kp(n){this.c=n}function jp(n){this.e=n}function Ep(n){this.a=n}function Tp(n){this.a=n}function Mp(n){this.a=n}function Sp(n){this.a=n}function Pp(n){this.a=n}function Cp(n){this.d=n}function Ip(n){this.a=n}function Op(n){this.a=n}function Ap(n){this.e=n}function $p(){this.a=0}function Lp(){DA(this)}function Np(){xA(this)}function xp(){$U(this)}function Dp(){wV(this)}function Rp(){_h(this)}function Kp(){this.c=L$t}function _p(n,t){t.Wb(n)}function Fp(n,t){n.b+=t}function Bp(n){n.b=new ok}function Hp(n){return n.e}function qp(n){return n.a}function Gp(n){return n.a}function zp(n){return n.a}function Up(n){return n.a}function Xp(n){return n.a}function Wp(){return null}function Vp(){return null}function Qp(){aE(),dXn()}function Yp(n){n.b.tf(n.e)}function Jp(n,t){n.b=t-n.b}function Zp(n,t){n.a=t-n.a}function nv(n,t){t.ad(n.a)}function tv(n,t){qCn(t,n)}function ev(n,t,e){n.Od(e,t)}function iv(n,t){n.e=t,t.b=n}function rv(n){s_(),this.a=n}function cv(n){s_(),this.a=n}function av(n){s_(),this.a=n}function uv(n){WX(),this.a=n}function ov(n){PY(),ett.be(n)}function sv(){gN.call(this)}function hv(){gN.call(this)}function fv(){sv.call(this)}function lv(){sv.call(this)}function bv(){sv.call(this)}function wv(){sv.call(this)}function dv(){sv.call(this)}function gv(){sv.call(this)}function pv(){sv.call(this)}function vv(){sv.call(this)}function mv(){sv.call(this)}function yv(){sv.call(this)}function kv(){sv.call(this)}function jv(){this.a=this}function Ev(){this.Bb|=256}function Tv(){this.b=new PO}function Mv(){Mv=O,new xp}function Sv(){fv.call(this)}function Pv(n,t){n.length=t}function Cv(n,t){WB(n.a,t)}function Iv(n,t){USn(n.c,t)}function Ov(n,t){TU(n.b,t)}function Av(n,t){Ivn(n.a,t)}function $v(n,t){Oln(n.a,t)}function Lv(n,t){ban(n.e,t)}function Nv(n){AOn(n.c,n.b)}function xv(n,t){n.kc().Nb(t)}function Dv(n){this.a=gbn(n)}function Rv(){this.a=new xp}function Kv(){this.a=new xp}function _v(){this.a=new Np}function Fv(){this.a=new Np}function Bv(){this.a=new Np}function Hv(){this.a=new kn}function qv(){this.a=new k6}function Gv(){this.a=new bt}function zv(){this.a=new WT}function Uv(){this.a=new D0}function Xv(){this.a=new cZ}function Wv(){this.a=new AR}function Vv(){this.a=new Np}function Qv(){this.a=new Np}function Yv(){this.a=new Np}function Jv(){this.a=new Np}function Zv(){this.d=new Np}function nm(){this.a=new Rv}function tm(){this.a=new xp}function em(){this.b=new xp}function im(){this.b=new Np}function rm(){this.e=new Np}function cm(){this.d=new Np}function am(){this.a=new uf}function um(){Np.call(this)}function om(){_v.call(this)}function sm(){NR.call(this)}function hm(){Qv.call(this)}function fm(){lm.call(this)}function lm(){Rp.call(this)}function bm(){Rp.call(this)}function wm(){bm.call(this)}function dm(){dY.call(this)}function gm(){dY.call(this)}function pm(){Wm.call(this)}function vm(){Wm.call(this)}function mm(){Wm.call(this)}function ym(){Vm.call(this)}function km(){YT.call(this)}function jm(){eo.call(this)}function Em(){eo.call(this)}function Tm(){ny.call(this)}function Mm(){ny.call(this)}function Sm(){xp.call(this)}function Pm(){xp.call(this)}function Cm(){xp.call(this)}function Im(){Rv.call(this)}function Om(){jin.call(this)}function Am(){Ev.call(this)}function $m(){OL.call(this)}function Lm(){OL.call(this)}function Nm(){xp.call(this)}function xm(){xp.call(this)}function Dm(){xp.call(this)}function Rm(){yo.call(this)}function Km(){yo.call(this)}function _m(){Rm.call(this)}function Fm(){Dh.call(this)}function Bm(n){dtn.call(this,n)}function Hm(n){dtn.call(this,n)}function qm(n){Qf.call(this,n)}function Gm(n){MT.call(this,n)}function zm(n){Gm.call(this,n)}function Um(n){MT.call(this,n)}function Xm(){this.a=new YT}function Wm(){this.a=new Rv}function Vm(){this.a=new xp}function Qm(){this.a=new Np}function Ym(){this.j=new Np}function Jm(){this.a=new Xa}function Zm(){this.a=new LE}function ny(){this.a=new mo}function ty(){ty=O,_nt=new xk}function ey(){ey=O,Knt=new Nk}function iy(){iy=O,Ont=new c}function ry(){ry=O,znt=new cN}function cy(n){Gm.call(this,n)}function ay(n){Gm.call(this,n)}function uy(n){d4.call(this,n)}function oy(n){d4.call(this,n)}function sy(n){VK.call(this,n)}function hy(n){ySn.call(this,n)}function fy(n){CT.call(this,n)}function ly(n){OT.call(this,n)}function by(n){OT.call(this,n)}function wy(n){OT.call(this,n)}function dy(n){fz.call(this,n)}function gy(n){dy.call(this,n)}function py(){Pl.call(this,{})}function vy(n){CL(),this.a=n}function my(n){n.b=null,n.c=0}function yy(n,t){n.e=t,Cxn(n,t)}function ky(n,t){n.a=t,aCn(n)}function jy(n,t,e){n.a[t.g]=e}function Ey(n,t,e){wjn(e,n,t)}function Ty(n,t){ZR(t.i,n.n)}function My(n,t){ssn(n).td(t)}function Sy(n,t){return n*n/t}function Py(n,t){return n.g-t.g}function Cy(n){return new Sl(n)}function Iy(n){return new GX(n)}function Oy(n){dy.call(this,n)}function Ay(n){dy.call(this,n)}function $y(n){dy.call(this,n)}function Ly(n){fz.call(this,n)}function Ny(n){_cn(),this.a=n}function xy(n){a_(),this.a=n}function Dy(n){FG(),this.f=n}function Ry(n){FG(),this.f=n}function Ky(n){dy.call(this,n)}function _y(n){dy.call(this,n)}function Fy(n){dy.call(this,n)}function By(n){dy.call(this,n)}function Hy(n){dy.call(this,n)}function qy(n){return kW(n),n}function Gy(n){return kW(n),n}function zy(n){return kW(n),n}function Uy(n){return kW(n),n}function Xy(n){return kW(n),n}function Wy(n){return n.b==n.c}function Vy(n){return!!n&&n.b}function Qy(n){return!!n&&n.k}function Yy(n){return!!n&&n.j}function Jy(n){kW(n),this.a=n}function Zy(n){return Zon(n),n}function nk(n){vU(n,n.length)}function tk(n){dy.call(this,n)}function ek(n){dy.call(this,n)}function ik(n){dy.call(this,n)}function rk(n){dy.call(this,n)}function ck(n){dy.call(this,n)}function ak(n){dy.call(this,n)}function uk(n){ZN.call(this,n,0)}function ok(){o1.call(this,12,3)}function sk(){sk=O,ttt=new j}function hk(){hk=O,Ynt=new r}function fk(){fk=O,rtt=new g}function lk(){lk=O,htt=new v}function bk(){throw Hp(new pv)}function wk(){throw Hp(new pv)}function dk(){throw Hp(new pv)}function gk(){throw Hp(new pv)}function pk(){throw Hp(new pv)}function vk(){throw Hp(new pv)}function mk(){this.a=SD(yX(FWn))}function yk(n){s_(),this.a=yX(n)}function kk(n,t){n.Td(t),t.Sd(n)}function jk(n,t){n.a.ec().Mc(t)}function Ek(n,t,e){n.c.lf(t,e)}function Tk(n){Ay.call(this,n)}function Mk(n){_y.call(this,n)}function Sk(){Ab.call(this,"")}function Pk(){Ab.call(this,"")}function Ck(){Ab.call(this,"")}function Ik(){Ab.call(this,"")}function Ok(n){Ay.call(this,n)}function Ak(n){Hb.call(this,n)}function $k(n){bN.call(this,n)}function Lk(n){Ak.call(this,n)}function Nk(){tl.call(this,null)}function xk(){tl.call(this,null)}function Dk(){Dk=O,PY()}function Rk(){Rk=O,ket=mEn()}function Kk(n){return n.a?n.b:0}function _k(n){return n.a?n.b:0}function Fk(n,t){return n.a-t.a}function Bk(n,t){return n.a-t.a}function Hk(n,t){return n.a-t.a}function qk(n,t){return m7(n,t)}function Gk(n,t){return gZ(n,t)}function zk(n,t){return t in n.a}function Uk(n,t){return n.f=t,n}function Xk(n,t){return n.b=t,n}function Wk(n,t){return n.c=t,n}function Vk(n,t){return n.g=t,n}function Qk(n,t){return n.a=t,n}function Yk(n,t){return n.f=t,n}function Jk(n,t){return n.k=t,n}function Zk(n,t){return n.a=t,n}function nj(n,t){return n.e=t,n}function tj(n,t){return n.e=t,n}function ej(n,t){return n.f=t,n}function ij(n,t){n.b=!0,n.d=t}function rj(n,t){n.b=new wA(t)}function cj(n,t,e){t.td(n.a[e])}function aj(n,t,e){t.we(n.a[e])}function uj(n,t){return n.b-t.b}function oj(n,t){return n.g-t.g}function sj(n,t){return n.s-t.s}function hj(n,t){return n?0:t-1}function fj(n,t){return n?0:t-1}function lj(n,t){return n?t-1:0}function bj(n,t){return t.Yf(n)}function wj(n,t){return n.b=t,n}function dj(n,t){return n.a=t,n}function gj(n,t){return n.c=t,n}function pj(n,t){return n.d=t,n}function vj(n,t){return n.e=t,n}function mj(n,t){return n.f=t,n}function yj(n,t){return n.a=t,n}function kj(n,t){return n.b=t,n}function jj(n,t){return n.c=t,n}function Ej(n,t){return n.c=t,n}function Tj(n,t){return n.b=t,n}function Mj(n,t){return n.d=t,n}function Sj(n,t){return n.e=t,n}function Pj(n,t){return n.f=t,n}function Cj(n,t){return n.g=t,n}function Ij(n,t){return n.a=t,n}function Oj(n,t){return n.i=t,n}function Aj(n,t){return n.j=t,n}function $j(n,t){return n.k=t,n}function Lj(n,t){return n.j=t,n}function Nj(n,t){_Mn(),CZ(t,n)}function xj(n,t,e){GG(n.a,t,e)}function Dj(n){BV.call(this,n)}function Rj(n){BV.call(this,n)}function Kj(n){n_.call(this,n)}function _j(n){qbn.call(this,n)}function Fj(n){gtn.call(this,n)}function Bj(n){pQ.call(this,n)}function Hj(n){pQ.call(this,n)}function qj(){O$.call(this,"")}function Gj(){this.a=0,this.b=0}function zj(){this.b=0,this.a=0}function Uj(n,t){n.b=0,Nen(n,t)}function Xj(n,t){n.c=t,n.b=!0}function Wj(n,t){return n.c._b(t)}function Vj(n){return n.e&&n.e()}function Qj(n){return n?n.d:null}function Yj(n,t){return gfn(n.b,t)}function Jj(n){return n?n.g:null}function Zj(n){return n?n.i:null}function nE(n){return ED(n),n.o}function tE(){tE=O,dOt=Xkn()}function eE(){eE=O,gOt=oTn()}function iE(){iE=O,n$t=Vkn()}function rE(){rE=O,dLt=Wkn()}function cE(){cE=O,gLt=iCn()}function aE(){aE=O,lAt=cin()}function uE(){throw Hp(new pv)}function oE(){throw Hp(new pv)}function sE(){throw Hp(new pv)}function hE(){throw Hp(new pv)}function fE(){throw Hp(new pv)}function lE(){throw Hp(new pv)}function bE(n){this.a=new XT(n)}function wE(n){lUn(),DXn(this,n)}function dE(n){this.a=new Wz(n)}function gE(n,t){for(;n.ye(t););}function pE(n,t){for(;n.sd(t););}function vE(n,t){return n.a+=t,n}function mE(n,t){return n.a+=t,n}function yE(n,t){return n.a+=t,n}function kE(n,t){return n.a+=t,n}function jE(n){return EW(n),n.a}function EE(n){return n.b!=n.d.c}function TE(n){return n.l|n.m<<22}function ME(n,t){return n.d[t.p]}function SE(n,t){return Sxn(n,t)}function PE(n,t,e){n.splice(t,e)}function CE(n){n.c?NDn(n):xDn(n)}function IE(n){this.a=0,this.b=n}function OE(){this.a=new CNn(ijt)}function AE(){this.b=new CNn(qyt)}function $E(){this.b=new CNn(WEt)}function LE(){this.b=new CNn(WEt)}function NE(){throw Hp(new pv)}function xE(){throw Hp(new pv)}function DE(){throw Hp(new pv)}function RE(){throw Hp(new pv)}function KE(){throw Hp(new pv)}function _E(){throw Hp(new pv)}function FE(){throw Hp(new pv)}function BE(){throw Hp(new pv)}function HE(){throw Hp(new pv)}function qE(){throw Hp(new pv)}function GE(){throw Hp(new yv)}function zE(){throw Hp(new yv)}function UE(n){this.a=new XE(n)}function XE(n){Gin(this,n,OEn())}function WE(n){return!n||pW(n)}function VE(n){return-1!=WLt[n]}function QE(){0!=ctt&&(ctt=0),utt=-1}function YE(){null==PWn&&(PWn=[])}function JE(n,t){tAn(QQ(n.a),t)}function ZE(n,t){tAn(QQ(n.a),t)}function nT(n,t){HL.call(this,n,t)}function tT(n,t){nT.call(this,n,t)}function eT(n,t){this.b=n,this.c=t}function iT(n,t){this.b=n,this.a=t}function rT(n,t){this.a=n,this.b=t}function cT(n,t){this.a=n,this.b=t}function aT(n,t){this.a=n,this.b=t}function uT(n,t){this.a=n,this.b=t}function oT(n,t){this.a=n,this.b=t}function sT(n,t){this.a=n,this.b=t}function hT(n,t){this.a=n,this.b=t}function fT(n,t){this.a=n,this.b=t}function lT(n,t){this.b=n,this.a=t}function bT(n,t){this.b=n,this.a=t}function wT(n,t){this.b=n,this.a=t}function dT(n,t){this.b=n,this.a=t}function gT(n,t){this.f=n,this.g=t}function pT(n,t){this.e=n,this.d=t}function vT(n,t){this.g=n,this.i=t}function mT(n,t){this.a=n,this.b=t}function yT(n,t){this.a=n,this.f=t}function kT(n,t){this.b=n,this.c=t}function jT(n,t){this.a=n,this.b=t}function ET(n,t){this.a=n,this.b=t}function TT(n,t){this.a=n,this.b=t}function MT(n){aN(n.dc()),this.c=n}function ST(n){this.b=BB(yX(n),83)}function PT(n){this.a=BB(yX(n),83)}function CT(n){this.a=BB(yX(n),15)}function IT(n){this.a=BB(yX(n),15)}function OT(n){this.b=BB(yX(n),47)}function AT(){this.q=new e.Date}function $T(){$T=O,Btt=new A}function LT(){LT=O,bet=new P}function NT(n){return n.f.c+n.g.c}function xT(n,t){return n.b.Hc(t)}function DT(n,t){return n.b.Ic(t)}function RT(n,t){return n.b.Qc(t)}function KT(n,t){return n.b.Hc(t)}function _T(n,t){return n.c.uc(t)}function FT(n,t){return n.a._b(t)}function BT(n,t){return Nfn(n.c,t)}function HT(n,t){return hU(n.b,t)}function qT(n,t){return n>t&&t<OVn}function GT(n,t){return n.Gc(t),n}function zT(n,t){return Frn(n,t),n}function UT(n){return XX(),n?stt:ott}function XT(n){non.call(this,n,0)}function WT(){Wz.call(this,null)}function VT(){B8.call(this,null)}function QT(n){this.c=n,Ann(this)}function YT(){P$(this),yQ(this)}function JT(n,t){EW(n),n.a.Nb(t)}function ZT(n,t){return n.Gc(t),n}function nM(n,t){return n.a.f=t,n}function tM(n,t){return n.a.d=t,n}function eM(n,t){return n.a.g=t,n}function iM(n,t){return n.a.j=t,n}function rM(n,t){return n.a.a=t,n}function cM(n,t){return n.a.d=t,n}function aM(n,t){return n.a.e=t,n}function uM(n,t){return n.a.g=t,n}function oM(n,t){return n.a.f=t,n}function sM(n){return n.b=!1,n}function hM(){hM=O,Pet=new CO}function fM(){fM=O,Cet=new IO}function lM(){lM=O,Het=new U}function bM(){bM=O,vut=new Kt}function wM(){wM=O,rct=new Ix}function dM(){dM=O,tit=new hn}function gM(){gM=O,kut=new _t}function pM(){pM=O,sit=new dn}function vM(){vM=O,Gat=new yt}function mM(){mM=O,Fut=new Gj}function yM(){yM=O,zat=new Pt}function kM(){kM=O,Vat=new DG}function jM(){jM=O,hut=new Mt}function EM(){EM=O,But=new be}function TM(){TM=O,nst=new Ye}function MM(){MM=O,wst=new Lr}function SM(){SM=O,Qst=new rc}function PM(){PM=O,Wkt=new B2}function CM(){CM=O,XEt=new LM}function IM(){IM=O,QEt=new vD}function OM(){OM=O,GTt=new XW}function AM(){AM=O,Wpt=new Wu}function $M(){Sin(),this.c=new ok}function LM(){gT.call(this,H1n,0)}function NM(n,t){Jgn(n.c.b,t.c,t)}function xM(n,t){Jgn(n.c.c,t.b,t)}function DM(n,t,e){mZ(n.d,t.f,e)}function RM(n,t,e,i){Jpn(n,i,t,e)}function KM(n,t,e,i){uNn(i,n,t,e)}function _M(n,t,e,i){oUn(i,n,t,e)}function FM(n,t){return n.a=t.g,n}function BM(n,t){return ekn(n.a,t)}function HM(n){return n.b?n.b:n.a}function qM(n){return(n.c+n.a)/2}function GM(){GM=O,lOt=new to}function zM(){zM=O,COt=new ho}function UM(){UM=O,RAt=new Pm}function XM(){XM=O,UAt=new Cm}function WM(){WM=O,zAt=new Nm}function VM(){VM=O,ZAt=new Dm}function QM(){QM=O,N$t=new z$}function YM(){YM=O,x$t=new U$}function JM(){JM=O,rLt=new Ns}function ZM(){ZM=O,aLt=new xs}function nS(){nS=O,mAt=new xp}function tS(){tS=O,V$t=new Np}function eS(){eS=O,MNt=new Kh}function iS(n){e.clearTimeout(n)}function rS(n){this.a=BB(yX(n),224)}function cS(n){return BB(n,42).cd()}function aS(n){return n.b<n.d.gc()}function uS(n,t){return CG(n.a,t)}function oS(n,t){return Vhn(n,t)>0}function sS(n,t){return Vhn(n,t)<0}function hS(n,t){return n.a.get(t)}function fS(n,t){return t.split(n)}function lS(n,t){return hU(n.e,t)}function bS(n){return kW(n),!1}function wS(n){w1.call(this,n,21)}function dS(n,t){_J.call(this,n,t)}function gS(n,t){gT.call(this,n,t)}function pS(n,t){gT.call(this,n,t)}function vS(n){VX(),VK.call(this,n)}function mS(n,t){jG(n,n.length,t)}function yS(n,t){QU(n,n.length,t)}function kS(n,t,e){t.ud(n.a.Ge(e))}function jS(n,t,e){t.we(n.a.Fe(e))}function ES(n,t,e){t.td(n.a.Kb(e))}function TS(n,t,e){n.Mb(e)&&t.td(e)}function MS(n,t,e){n.splice(t,0,e)}function SS(n,t){return SN(n.e,t)}function PS(n,t){this.d=n,this.e=t}function CS(n,t){this.b=n,this.a=t}function IS(n,t){this.b=n,this.a=t}function OS(n,t){this.b=n,this.a=t}function AS(n,t){this.a=n,this.b=t}function $S(n,t){this.a=n,this.b=t}function LS(n,t){this.a=n,this.b=t}function NS(n,t){this.a=n,this.b=t}function xS(n,t){this.a=n,this.b=t}function DS(n,t){this.b=n,this.a=t}function RS(n,t){this.b=n,this.a=t}function KS(n,t){gT.call(this,n,t)}function _S(n,t){gT.call(this,n,t)}function FS(n,t){gT.call(this,n,t)}function BS(n,t){gT.call(this,n,t)}function HS(n,t){gT.call(this,n,t)}function qS(n,t){gT.call(this,n,t)}function GS(n,t){gT.call(this,n,t)}function zS(n,t){gT.call(this,n,t)}function US(n,t){gT.call(this,n,t)}function XS(n,t){gT.call(this,n,t)}function WS(n,t){gT.call(this,n,t)}function VS(n,t){gT.call(this,n,t)}function QS(n,t){gT.call(this,n,t)}function YS(n,t){gT.call(this,n,t)}function JS(n,t){gT.call(this,n,t)}function ZS(n,t){gT.call(this,n,t)}function nP(n,t){gT.call(this,n,t)}function tP(n,t){gT.call(this,n,t)}function eP(n,t){this.a=n,this.b=t}function iP(n,t){this.a=n,this.b=t}function rP(n,t){this.a=n,this.b=t}function cP(n,t){this.a=n,this.b=t}function aP(n,t){this.a=n,this.b=t}function uP(n,t){this.a=n,this.b=t}function oP(n,t){this.a=n,this.b=t}function sP(n,t){this.a=n,this.b=t}function hP(n,t){this.a=n,this.b=t}function fP(n,t){this.b=n,this.a=t}function lP(n,t){this.b=n,this.a=t}function bP(n,t){this.b=n,this.a=t}function wP(n,t){this.b=n,this.a=t}function dP(n,t){this.c=n,this.d=t}function gP(n,t){this.e=n,this.d=t}function pP(n,t){this.a=n,this.b=t}function vP(n,t){this.b=t,this.c=n}function mP(n,t){gT.call(this,n,t)}function yP(n,t){gT.call(this,n,t)}function kP(n,t){gT.call(this,n,t)}function jP(n,t){gT.call(this,n,t)}function EP(n,t){gT.call(this,n,t)}function TP(n,t){gT.call(this,n,t)}function MP(n,t){gT.call(this,n,t)}function SP(n,t){gT.call(this,n,t)}function PP(n,t){gT.call(this,n,t)}function CP(n,t){gT.call(this,n,t)}function IP(n,t){gT.call(this,n,t)}function OP(n,t){gT.call(this,n,t)}function AP(n,t){gT.call(this,n,t)}function $P(n,t){gT.call(this,n,t)}function LP(n,t){gT.call(this,n,t)}function NP(n,t){gT.call(this,n,t)}function xP(n,t){gT.call(this,n,t)}function DP(n,t){gT.call(this,n,t)}function RP(n,t){gT.call(this,n,t)}function KP(n,t){gT.call(this,n,t)}function _P(n,t){gT.call(this,n,t)}function FP(n,t){gT.call(this,n,t)}function BP(n,t){gT.call(this,n,t)}function HP(n,t){gT.call(this,n,t)}function qP(n,t){gT.call(this,n,t)}function GP(n,t){gT.call(this,n,t)}function zP(n,t){gT.call(this,n,t)}function UP(n,t){gT.call(this,n,t)}function XP(n,t){gT.call(this,n,t)}function WP(n,t){gT.call(this,n,t)}function VP(n,t){gT.call(this,n,t)}function QP(n,t){gT.call(this,n,t)}function YP(n,t){gT.call(this,n,t)}function JP(n,t){gT.call(this,n,t)}function ZP(n,t){this.b=n,this.a=t}function nC(n,t){this.a=n,this.b=t}function tC(n,t){this.a=n,this.b=t}function eC(n,t){this.a=n,this.b=t}function iC(n,t){this.a=n,this.b=t}function rC(n,t){gT.call(this,n,t)}function cC(n,t){gT.call(this,n,t)}function aC(n,t){this.b=n,this.d=t}function uC(n,t){gT.call(this,n,t)}function oC(n,t){gT.call(this,n,t)}function sC(n,t){this.a=n,this.b=t}function hC(n,t){this.a=n,this.b=t}function fC(n,t){gT.call(this,n,t)}function lC(n,t){gT.call(this,n,t)}function bC(n,t){gT.call(this,n,t)}function wC(n,t){gT.call(this,n,t)}function dC(n,t){gT.call(this,n,t)}function gC(n,t){gT.call(this,n,t)}function pC(n,t){gT.call(this,n,t)}function vC(n,t){gT.call(this,n,t)}function mC(n,t){gT.call(this,n,t)}function yC(n,t){gT.call(this,n,t)}function kC(n,t){gT.call(this,n,t)}function jC(n,t){gT.call(this,n,t)}function EC(n,t){gT.call(this,n,t)}function TC(n,t){gT.call(this,n,t)}function MC(n,t){gT.call(this,n,t)}function SC(n,t){gT.call(this,n,t)}function PC(n,t){return SN(n.c,t)}function CC(n,t){return SN(t.b,n)}function IC(n,t){return-n.b.Je(t)}function OC(n,t){return SN(n.g,t)}function AC(n,t){gT.call(this,n,t)}function $C(n,t){gT.call(this,n,t)}function LC(n,t){this.a=n,this.b=t}function NC(n,t){this.a=n,this.b=t}function xC(n,t){this.a=n,this.b=t}function DC(n,t){gT.call(this,n,t)}function RC(n,t){gT.call(this,n,t)}function KC(n,t){gT.call(this,n,t)}function _C(n,t){gT.call(this,n,t)}function FC(n,t){gT.call(this,n,t)}function BC(n,t){gT.call(this,n,t)}function HC(n,t){gT.call(this,n,t)}function qC(n,t){gT.call(this,n,t)}function GC(n,t){gT.call(this,n,t)}function zC(n,t){gT.call(this,n,t)}function UC(n,t){gT.call(this,n,t)}function XC(n,t){gT.call(this,n,t)}function WC(n,t){gT.call(this,n,t)}function VC(n,t){gT.call(this,n,t)}function QC(n,t){gT.call(this,n,t)}function YC(n,t){gT.call(this,n,t)}function JC(n,t){this.a=n,this.b=t}function ZC(n,t){this.a=n,this.b=t}function nI(n,t){this.a=n,this.b=t}function tI(n,t){this.a=n,this.b=t}function eI(n,t){this.a=n,this.b=t}function iI(n,t){this.a=n,this.b=t}function rI(n,t){this.a=n,this.b=t}function cI(n,t){gT.call(this,n,t)}function aI(n,t){this.a=n,this.b=t}function uI(n,t){this.a=n,this.b=t}function oI(n,t){this.a=n,this.b=t}function sI(n,t){this.a=n,this.b=t}function hI(n,t){this.a=n,this.b=t}function fI(n,t){this.a=n,this.b=t}function lI(n,t){this.b=n,this.a=t}function bI(n,t){this.b=n,this.a=t}function wI(n,t){this.b=n,this.a=t}function dI(n,t){this.b=n,this.a=t}function gI(n,t){this.a=n,this.b=t}function pI(n,t){this.a=n,this.b=t}function vI(n,t){JLn(n.a,BB(t,56))}function mI(n,t){v7(n.a,BB(t,11))}function yI(n,t){return hH(),t!=n}function kI(){return Rk(),new ket}function jI(){qZ(),this.b=new Rv}function EI(){dxn(),this.a=new Rv}function TI(){KZ(),KG.call(this)}function MI(n,t){gT.call(this,n,t)}function SI(n,t){this.a=n,this.b=t}function PI(n,t){this.a=n,this.b=t}function CI(n,t){this.a=n,this.b=t}function II(n,t){this.a=n,this.b=t}function OI(n,t){this.a=n,this.b=t}function AI(n,t){this.a=n,this.b=t}function $I(n,t){this.d=n,this.b=t}function LI(n,t){this.d=n,this.e=t}function NI(n,t){this.f=n,this.c=t}function xI(n,t){this.b=n,this.c=t}function DI(n,t){this.i=n,this.g=t}function RI(n,t){this.e=n,this.a=t}function KI(n,t){this.a=n,this.b=t}function _I(n,t){n.i=null,arn(n,t)}function FI(n,t){n&&VW(hAt,n,t)}function BI(n,t){return rdn(n.a,t)}function HI(n){return adn(n.c,n.b)}function qI(n){return n?n.dd():null}function GI(n){return null==n?null:n}function zI(n){return typeof n===$Wn}function UI(n){return typeof n===LWn}function XI(n){return typeof n===NWn}function WI(n,t){return n.Hd().Xb(t)}function VI(n,t){return Qcn(n.Kc(),t)}function QI(n,t){return 0==Vhn(n,t)}function YI(n,t){return Vhn(n,t)>=0}function JI(n,t){return 0!=Vhn(n,t)}function ZI(n){return""+(kW(n),n)}function nO(n,t){return n.substr(t)}function tO(n){return zbn(n),n.d.gc()}function eO(n){return zOn(n,n.c),n}function iO(n){return JH(null==n),n}function rO(n,t){return n.a+=""+t,n}function cO(n,t){return n.a+=""+t,n}function aO(n,t){return n.a+=""+t,n}function uO(n,t){return n.a+=""+t,n}function oO(n,t){return n.a+=""+t,n}function sO(n,t){return n.a+=""+t,n}function hO(n,t){r5(n,t,n.a,n.a.a)}function fO(n,t){r5(n,t,n.c.b,n.c)}function lO(n,t,e){Kjn(t,RPn(n,e))}function bO(n,t,e){Kjn(t,RPn(n,e))}function wO(n,t){Tnn(new AL(n),t)}function dO(n,t){n.q.setTime(j2(t))}function gO(n,t){zz.call(this,n,t)}function pO(n,t){zz.call(this,n,t)}function vO(n,t){zz.call(this,n,t)}function mO(n){$U(this),Tcn(this,n)}function yO(n){return l1(n,0),null}function kO(n){return n.a=0,n.b=0,n}function jO(n,t){return n.a=t.g+1,n}function EO(n,t){return 2==n.j[t.p]}function TO(n){return sX(BB(n,79))}function MO(){MO=O,Art=lhn(tpn())}function SO(){SO=O,Zot=lhn(ENn())}function PO(){this.b=new XT(etn(12))}function CO(){this.b=0,this.a=!1}function IO(){this.b=0,this.a=!1}function OO(n){this.a=n,Bh.call(this)}function AO(n){this.a=n,Bh.call(this)}function $O(n,t){iR.call(this,n,t)}function LO(n,t){tK.call(this,n,t)}function NO(n,t){DI.call(this,n,t)}function xO(n,t){Aan.call(this,n,t)}function DO(n,t){QN.call(this,n,t)}function RO(n,t){nS(),VW(mAt,n,t)}function KO(n,t){return fx(n.a,0,t)}function _O(n,t){return n.a.a.a.cc(t)}function FO(n,t){return GI(n)===GI(t)}function BO(n,t){return Pln(n.a,t.a)}function HO(n,t){return E$(n.a,t.a)}function qO(n,t){return FU(n.a,t.a)}function GO(n,t){return n.indexOf(t)}function zO(n,t){return n==t?0:n?1:-1}function UO(n){return n<10?"0"+n:""+n}function XO(n){return yX(n),new OO(n)}function WO(n){return M$(n.l,n.m,n.h)}function VO(n){return CJ((kW(n),n))}function QO(n){return CJ((kW(n),n))}function YO(n,t){return E$(n.g,t.g)}function JO(n){return typeof n===LWn}function ZO(n){return n==Zat||n==eut}function nA(n){return n==Zat||n==nut}function tA(n){return E7(n.b.b,n,0)}function eA(n){this.a=kI(),this.b=n}function iA(n){this.a=kI(),this.b=n}function rA(n,t){return WB(n.a,t),t}function cA(n,t){return WB(n.c,t),n}function aA(n,t){return Jcn(n.a,t),n}function uA(n,t){return G_(),t.a+=n}function oA(n,t){return G_(),t.a+=n}function sA(n,t){return G_(),t.c+=n}function hA(n,t){z9(n,0,n.length,t)}function fA(){ew.call(this,new v4)}function lA(){uG.call(this,0,0,0,0)}function bA(){UV.call(this,0,0,0,0)}function wA(n){this.a=n.a,this.b=n.b}function dA(n){return n==_Pt||n==FPt}function gA(n){return n==HPt||n==KPt}function pA(n){return n==fvt||n==hvt}function vA(n){return n!=QCt&&n!=YCt}function mA(n){return n.Lg()&&n.Mg()}function yA(n){return mV(BB(n,118))}function kA(n){return Jcn(new B2,n)}function jA(n,t){return new Aan(t,n)}function EA(n,t){return new Aan(t,n)}function TA(n,t,e){jen(n,t),Een(n,e)}function MA(n,t,e){Sen(n,t),Men(n,e)}function SA(n,t,e){Pen(n,t),Cen(n,e)}function PA(n,t,e){Ten(n,t),Oen(n,e)}function CA(n,t,e){Ien(n,t),Aen(n,e)}function IA(n,t){Dsn(n,t),xen(n,n.D)}function OA(n){NI.call(this,n,!0)}function AA(n,t,e){ND.call(this,n,t,e)}function $A(n){ODn(),san.call(this,n)}function LA(){gS.call(this,"Head",1)}function NA(){gS.call(this,"Tail",3)}function xA(n){n.c=x8(Ant,HWn,1,0,5,1)}function DA(n){n.a=x8(Ant,HWn,1,8,5,1)}function RA(n){Otn(n.xf(),new Sw(n))}function KA(n){return null!=n?nsn(n):0}function _A(n,t){return Ctn(t,WJ(n))}function FA(n,t){return Ctn(t,WJ(n))}function BA(n,t){return n[n.length]=t}function HA(n,t){return n[n.length]=t}function qA(n){return FB(n.b.Kc(),n.a)}function GA(n,t){return Uin(PX(n.d),t)}function zA(n,t){return Uin(PX(n.g),t)}function UA(n,t){return Uin(PX(n.j),t)}function XA(n,t){iR.call(this,n.b,t)}function WA(n){uG.call(this,n,n,n,n)}function VA(n){return n.b&&VBn(n),n.a}function QA(n){return n.b&&VBn(n),n.c}function YA(n,t){Qet||(n.b=t)}function JA(n,t,e){return $X(n,t,e),e}function ZA(n,t,e){$X(n.c[t.g],t.g,e)}function n$(n,t,e){BB(n.c,69).Xh(t,e)}function t$(n,t,e){SA(e,e.i+n,e.j+t)}function e$(n,t){f9(a4(n.a),e1(t))}function i$(n,t){f9(H7(n.a),i1(t))}function r$(n){wWn(),Ap.call(this,n)}function c$(n){return null==n?0:nsn(n)}function a$(){a$=O,syt=new Hbn(oCt)}function u$(){u$=O,new o$,new Np}function o$(){new xp,new xp,new xp}function s$(){s$=O,Mv(),itt=new xp}function h$(){h$=O,e.Math.log(2)}function f$(){f$=O,zM(),R$t=COt}function l$(){throw Hp(new tk(Tnt))}function b$(){throw Hp(new tk(Tnt))}function w$(){throw Hp(new tk(Mnt))}function d$(){throw Hp(new tk(Mnt))}function g$(n){this.a=n,QB.call(this,n)}function p$(n){this.a=n,ST.call(this,n)}function v$(n){this.a=n,ST.call(this,n)}function m$(n,t){yG(n.c,n.c.length,t)}function y$(n){return n.a<n.c.c.length}function k$(n){return n.a<n.c.a.length}function j$(n,t){return n.a?n.b:t.De()}function E$(n,t){return n<t?-1:n>t?1:0}function T$(n,t){return Vhn(n,t)>0?n:t}function M$(n,t,e){return{l:n,m:t,h:e}}function S$(n,t){null!=n.a&&mI(t,n.a)}function P$(n){n.a=new $,n.c=new $}function C$(n){this.b=n,this.a=new Np}function I$(n){this.b=new et,this.a=n}function O$(n){LR.call(this),this.a=n}function A$(){gS.call(this,"Range",2)}function $$(){tjn(),this.a=new CNn(Uat)}function L$(n,t){yX(t),EV(n).Jc(new b)}function N$(n,t){return BZ(),t.n.b+=n}function x$(n,t,e){return VW(n.g,e,t)}function D$(n,t,e){return VW(n.k,e,t)}function R$(n,t){return VW(n.a,t.a,t)}function K$(n,t,e){return Idn(t,e,n.c)}function _$(n){return new xC(n.c,n.d)}function F$(n){return new xC(n.c,n.d)}function B$(n){return new xC(n.a,n.b)}function H$(n,t){return tzn(n.a,t,null)}function q$(n){SZ(n,null),MZ(n,null)}function G$(n){WZ(n,null),VZ(n,null)}function z$(){QN.call(this,null,null)}function U$(){YN.call(this,null,null)}function X$(n){this.a=n,xp.call(this)}function W$(n){this.b=(SQ(),new Xb(n))}function V$(n){n.j=x8(Ftt,sVn,310,0,0,1)}function Q$(n,t,e){n.c.Vc(t,BB(e,133))}function Y$(n,t,e){n.c.ji(t,BB(e,133))}function J$(n,t){sqn(n),n.Gc(BB(t,15))}function Z$(n,t){return Bqn(n.c,n.b,t)}function nL(n,t){return new pN(n.Kc(),t)}function tL(n,t){return-1!=Fun(n.Kc(),t)}function eL(n,t){return null!=n.a.Bc(t)}function iL(n){return n.Ob()?n.Pb():null}function rL(n){return Bdn(n,0,n.length)}function cL(n,t){return null!=n&&Qpn(n,t)}function aL(n,t){n.q.setHours(t),lBn(n,t)}function uL(n,t){n.c&&(RH(t),kJ(t))}function oL(n,t,e){BB(n.Kb(e),164).Nb(t)}function sL(n,t,e){return HGn(n,t,e),e}function hL(n,t,e){n.a=1502^t,n.b=e^aYn}function fL(n,t,e){return n.a[t.g][e.g]}function lL(n,t){return n.a[t.c.p][t.p]}function bL(n,t){return n.e[t.c.p][t.p]}function wL(n,t){return n.c[t.c.p][t.p]}function dL(n,t){return n.j[t.p]=pLn(t)}function gL(n,t){return f6(n.f,t.tg())}function pL(n,t){return f6(n.b,t.tg())}function vL(n,t){return n.a<XK(t)?-1:1}function mL(n,t,e){return e?0!=t:t!=n-1}function yL(n,t,e){return n.a=t,n.b=e,n}function kL(n,t){return n.a*=t,n.b*=t,n}function jL(n,t,e){return $X(n.g,t,e),e}function EL(n,t,e,i){$X(n.a[t.g],e.g,i)}function TL(n,t){_x(t,n.a.a.a,n.a.a.b)}function ML(n){n.a=BB(yan(n.b.a,4),126)}function SL(n){n.a=BB(yan(n.b.a,4),126)}function PL(n){OY(n,i8n),HLn(n,IUn(n))}function CL(){CL=O,Set=new vy(null)}function IL(){(IL=O)(),$et=new z}function OL(){this.Bb|=256,this.Bb|=512}function AL(n){this.i=n,this.f=this.i.j}function $L(n,t,e){yH.call(this,n,t,e)}function LL(n,t,e){$L.call(this,n,t,e)}function NL(n,t,e){$L.call(this,n,t,e)}function xL(n,t,e){LL.call(this,n,t,e)}function DL(n,t,e){yH.call(this,n,t,e)}function RL(n,t,e){yH.call(this,n,t,e)}function KL(n,t,e){MH.call(this,n,t,e)}function _L(n,t,e){MH.call(this,n,t,e)}function FL(n,t,e){KL.call(this,n,t,e)}function BL(n,t,e){DL.call(this,n,t,e)}function HL(n,t){this.a=n,ST.call(this,t)}function qL(n,t){this.a=n,uk.call(this,t)}function GL(n,t){this.a=n,uk.call(this,t)}function zL(n,t){this.a=n,uk.call(this,t)}function UL(n){this.a=n,hl.call(this,n.d)}function XL(n){this.c=n,this.a=this.c.a}function WL(n,t){this.a=t,uk.call(this,n)}function VL(n,t){this.a=t,d4.call(this,n)}function QL(n,t){this.a=n,d4.call(this,t)}function YL(n,t){return wz(bz(n.c)).Xb(t)}function JL(n,t){return ebn(n,new Ck,t).a}function ZL(n,t){return yX(t),new nN(n,t)}function nN(n,t){this.a=t,OT.call(this,n)}function tN(n){this.b=n,this.a=this.b.a.e}function eN(n){n.b.Qb(),--n.d.f.d,$G(n.d)}function iN(n){tl.call(this,BB(yX(n),35))}function rN(n){tl.call(this,BB(yX(n),35))}function cN(){gT.call(this,"INSTANCE",0)}function aN(n){if(!n)throw Hp(new wv)}function uN(n){if(!n)throw Hp(new dv)}function oN(n){if(!n)throw Hp(new yv)}function sN(){sN=O,JM(),cLt=new Ff}function hN(){hN=O,ptt=!1,vtt=!0}function fN(n){Ab.call(this,(kW(n),n))}function lN(n){Ab.call(this,(kW(n),n))}function bN(n){Hb.call(this,n),this.a=n}function wN(n){qb.call(this,n),this.a=n}function dN(n){Ak.call(this,n),this.a=n}function gN(){V$(this),jQ(this),this._d()}function pN(n,t){this.a=t,OT.call(this,n)}function vN(n,t){return new KPn(n.a,n.b,t)}function mN(n,t){return n.lastIndexOf(t)}function yN(n,t,e){return n.indexOf(t,e)}function kN(n){return null==n?zWn:Bbn(n)}function jN(n){return null==n?null:n.name}function EN(n){return null!=n.a?n.a:null}function TN(n){return EE(n.a)?u1(n):null}function MN(n,t){return null!=$J(n.a,t)}function SN(n,t){return!!t&&n.b[t.g]==t}function PN(n){return n.$H||(n.$H=++cit)}function CN(n){return n.l+n.m*IQn+n.h*OQn}function IN(n,t){return WB(t.a,n.a),n.a}function ON(n,t){return WB(t.b,n.a),n.a}function AN(n,t){return WB(t.a,n.a),n.a}function $N(n){return Px(null!=n.a),n.a}function LN(n){ew.call(this,new q8(n))}function NN(n,t){Sgn.call(this,n,t,null)}function xN(n){this.a=n,Bb.call(this,n)}function DN(){DN=O,Lrt=new iR(dJn,0)}function RN(n,t){return++n.b,WB(n.a,t)}function KN(n,t){return++n.b,y7(n.a,t)}function _N(n,t){return Pln(n.n.a,t.n.a)}function FN(n,t){return Pln(n.c.d,t.c.d)}function BN(n,t){return Pln(n.c.c,t.c.c)}function HN(n,t){return BB(h6(n.b,t),15)}function qN(n,t){return n.n.b=(kW(t),t)}function GN(n,t){return n.n.b=(kW(t),t)}function zN(n){return y$(n.a)||y$(n.b)}function UN(n,t,e){return p3(n,t,e,n.b)}function XN(n,t,e){return p3(n,t,e,n.c)}function WN(n,t,e){BB(D7(n,t),21).Fc(e)}function VN(n,t,e){Oln(n.a,e),Ivn(n.a,t)}function QN(n,t){QM(),this.a=n,this.b=t}function YN(n,t){YM(),this.b=n,this.c=t}function JN(n,t){FG(),this.f=t,this.d=n}function ZN(n,t){w6(t,n),this.d=n,this.c=t}function nx(n){var t;t=n.a,n.a=n.b,n.b=t}function tx(n){return G_(),!!n&&!n.dc()}function ex(n){return new h4(3,n)}function ix(n,t){return new bK(n,n.gc(),t)}function rx(n){return ry(),Cnn((DZ(),Xnt),n)}function cx(n){this.d=n,AL.call(this,n)}function ax(n){this.c=n,AL.call(this,n)}function ux(n){this.c=n,cx.call(this,n)}function ox(){MM(),this.b=new yd(this)}function sx(n){return lin(n,AVn),new J6(n)}function hx(n){return PY(),parseInt(n)||-1}function fx(n,t,e){return n.substr(t,e-t)}function lx(n,t,e){return yN(n,YTn(t),e)}function bx(n){return VU(n.c,n.c.length)}function wx(n){return null!=n.f?n.f:""+n.g}function dx(n){return null!=n.f?n.f:""+n.g}function gx(n){return Px(0!=n.b),n.a.a.c}function px(n){return Px(0!=n.b),n.c.b.c}function vx(n){cL(n,150)&&BB(n,150).Gh()}function mx(n){return n.b=BB(mQ(n.a),42)}function yx(n){hM(),this.b=n,this.a=!0}function kx(n){fM(),this.b=n,this.a=!0}function jx(n){n.d=new Cx(n),n.e=new xp}function Ex(n){if(!n)throw Hp(new vv)}function Tx(n){if(!n)throw Hp(new wv)}function Mx(n){if(!n)throw Hp(new dv)}function Sx(n){if(!n)throw Hp(new lv)}function Px(n){if(!n)throw Hp(new yv)}function Cx(n){nH.call(this,n,null,null)}function Ix(){gT.call(this,"POLYOMINO",0)}function Ox(n,t,e,i){sz.call(this,n,t,e,i)}function Ax(n,t){return _Mn(),JIn(n,t.e,t)}function $x(n,t,e){return AM(),e.qg(n,t)}function Lx(n,t){return!!n.q&&hU(n.q,t)}function Nx(n,t){return n>0?t*t/n:t*t*100}function xx(n,t){return n>0?t/(n*n):100*t}function Dx(n,t,e){return WB(t,own(n,e))}function Rx(n,t,e){x9(),n.Xe(t)&&e.td(n)}function Kx(n,t,e){n.Zc(t).Rb(e)}function _x(n,t,e){return n.a+=t,n.b+=e,n}function Fx(n,t,e){return n.a*=t,n.b*=e,n}function Bx(n,t,e){return n.a-=t,n.b-=e,n}function Hx(n,t){return n.a=t.a,n.b=t.b,n}function qx(n){return n.a=-n.a,n.b=-n.b,n}function Gx(n){this.c=n,this.a=1,this.b=1}function zx(n){this.c=n,Pen(n,0),Cen(n,0)}function Ux(n){YT.call(this),nin(this,n)}function Xx(n){RXn(),Bp(this),this.mf(n)}function Wx(n,t){QM(),QN.call(this,n,t)}function Vx(n,t){YM(),YN.call(this,n,t)}function Qx(n,t){YM(),YN.call(this,n,t)}function Yx(n,t){YM(),Vx.call(this,n,t)}function Jx(n,t,e){y9.call(this,n,t,e,2)}function Zx(n,t){f$(),cG.call(this,n,t)}function nD(n,t){f$(),Zx.call(this,n,t)}function tD(n,t){f$(),Zx.call(this,n,t)}function eD(n,t){f$(),tD.call(this,n,t)}function iD(n,t){f$(),cG.call(this,n,t)}function rD(n,t){f$(),iD.call(this,n,t)}function cD(n,t){f$(),cG.call(this,n,t)}function aD(n,t){return n.c.Fc(BB(t,133))}function uD(n,t,e){return NHn(F7(n,t),e)}function oD(n,t,e){return t.Qk(n.e,n.c,e)}function sD(n,t,e){return t.Rk(n.e,n.c,e)}function hD(n,t){return tfn(n.e,BB(t,49))}function fD(n,t,e){sln(H7(n.a),t,i1(e))}function lD(n,t,e){sln(a4(n.a),t,e1(e))}function bD(n,t){t.$modCount=n.$modCount}function wD(){wD=O,Vkt=new up("root")}function dD(){dD=O,pAt=new Tm,new Mm}function gD(){this.a=new pJ,this.b=new pJ}function pD(){jin.call(this),this.Bb|=BQn}function vD(){gT.call(this,"GROW_TREE",0)}function mD(n){return null==n?null:wUn(n)}function yD(n){return null==n?null:LSn(n)}function kD(n){return null==n?null:Bbn(n)}function jD(n){return null==n?null:Bbn(n)}function ED(n){null==n.o&&g$n(n)}function TD(n){return JH(null==n||zI(n)),n}function MD(n){return JH(null==n||UI(n)),n}function SD(n){return JH(null==n||XI(n)),n}function PD(n){this.q=new e.Date(j2(n))}function CD(n,t){this.c=n,pT.call(this,n,t)}function ID(n,t){this.a=n,CD.call(this,n,t)}function OD(n,t){this.d=n,Mb(this),this.b=t}function AD(n,t){B8.call(this,n),this.a=t}function $D(n,t){B8.call(this,n),this.a=t}function LD(n){qwn.call(this,0,0),this.f=n}function ND(n,t,e){W6.call(this,n,t,e,null)}function xD(n,t,e){W6.call(this,n,t,e,null)}function DD(n,t,e){return n.ue(t,e)<=0?e:t}function RD(n,t,e){return n.ue(t,e)<=0?t:e}function KD(n,t){return BB(lnn(n.b,t),149)}function _D(n,t){return BB(lnn(n.c,t),229)}function FD(n){return BB(xq(n.a,n.b),287)}function BD(n){return new xC(n.c,n.d+n.a)}function HD(n){return BZ(),pA(BB(n,197))}function qD(){qD=O,$rt=nbn((mdn(),_It))}function GD(n,t){t.a?Fxn(n,t):MN(n.a,t.b)}function zD(n,t){Qet||WB(n.a,t)}function UD(n,t){return mM(),wan(t.d.i,n)}function XD(n,t){return Irn(),new cKn(t,n)}function WD(n,t){return OY(t,uJn),n.f=t,n}function VD(n,t,e){return e=T_n(n,t,3,e)}function QD(n,t,e){return e=T_n(n,t,6,e)}function YD(n,t,e){return e=T_n(n,t,9,e)}function JD(n,t,e){++n.j,n.Ki(),L8(n,t,e)}function ZD(n,t,e){++n.j,n.Hi(t,n.oi(t,e))}function nR(n,t,e){n.Zc(t).Rb(e)}function tR(n,t,e){return ZBn(n.c,n.b,t,e)}function eR(n,t){return(t&DWn)%n.d.length}function iR(n,t){up.call(this,n),this.a=t}function rR(n,t){kp.call(this,n),this.a=t}function cR(n,t){kp.call(this,n),this.a=t}function aR(n,t){this.c=n,gtn.call(this,t)}function uR(n,t){this.a=n,yp.call(this,t)}function oR(n,t){this.a=n,yp.call(this,t)}function sR(n){this.a=(lin(n,AVn),new J6(n))}function hR(n){this.a=(lin(n,AVn),new J6(n))}function fR(n){return!n.a&&(n.a=new w),n.a}function lR(n){return n>8?0:n+1}function bR(n,t){return hN(),n==t?0:n?1:-1}function wR(n,t,e){return mG(n,BB(t,22),e)}function dR(n,t,e){return n.apply(t,e)}function gR(n,t,e){return n.a+=Bdn(t,0,e),n}function pR(n,t){var e;return e=n.e,n.e=t,e}function vR(n,t){n[iYn].call(n,t)}function mR(n,t){n[iYn].call(n,t)}function yR(n,t){n.a.Vc(n.b,t),++n.b,n.c=-1}function kR(n){$U(n.e),n.d.b=n.d,n.d.a=n.d}function jR(n){n.b?jR(n.b):n.f.c.zc(n.e,n.d)}function ER(n,t,e){dM(),Il(n,t.Ce(n.a,e))}function TR(n,t){return Qj(Mdn(n.a,t,!0))}function MR(n,t){return Qj(Sdn(n.a,t,!0))}function SR(n,t){return qk(new Array(t),n)}function PR(n){return String.fromCharCode(n)}function CR(n){return null==n?null:n.message}function IR(){this.a=new Np,this.b=new Np}function OR(){this.a=new bt,this.b=new Tv}function AR(){this.b=new Gj,this.c=new Np}function $R(){this.d=new Gj,this.e=new Gj}function LR(){this.n=new Gj,this.o=new Gj}function NR(){this.n=new bm,this.i=new bA}function xR(){this.a=new nf,this.b=new uc}function DR(){this.a=new Np,this.d=new Np}function RR(){this.b=new Rv,this.a=new Rv}function KR(){this.b=new xp,this.a=new xp}function _R(){this.b=new AE,this.a=new da}function FR(){NR.call(this),this.a=new Gj}function BR(n){Oan.call(this,n,(Z9(),Net))}function HR(n,t,e,i){uG.call(this,n,t,e,i)}function qR(n,t,e){null!=e&&Lin(t,Amn(n,e))}function GR(n,t,e){null!=e&&Nin(t,Amn(n,e))}function zR(n,t,e){return e=T_n(n,t,11,e)}function UR(n,t){return n.a+=t.a,n.b+=t.b,n}function XR(n,t){return n.a-=t.a,n.b-=t.b,n}function WR(n,t){return n.n.a=(kW(t),t+10)}function VR(n,t){return n.n.a=(kW(t),t+10)}function QR(n,t){return t==n||Sjn(CLn(t),n)}function YR(n,t){return null==VW(n.a,t,"")}function JR(n,t){return mM(),!wan(t.d.i,n)}function ZR(n,t){dA(n.f)?c$n(n,t):ITn(n,t)}function nK(n,t){return t.Hh(n.a)}function tK(n,t){Ay.call(this,e9n+n+o8n+t)}function eK(n,t,e,i){eU.call(this,n,t,e,i)}function iK(n,t,e,i){eU.call(this,n,t,e,i)}function rK(n,t,e,i){iK.call(this,n,t,e,i)}function cK(n,t,e,i){iU.call(this,n,t,e,i)}function aK(n,t,e,i){iU.call(this,n,t,e,i)}function uK(n,t,e,i){iU.call(this,n,t,e,i)}function oK(n,t,e,i){aK.call(this,n,t,e,i)}function sK(n,t,e,i){aK.call(this,n,t,e,i)}function hK(n,t,e,i){uK.call(this,n,t,e,i)}function fK(n,t,e,i){sK.call(this,n,t,e,i)}function lK(n,t,e,i){Zz.call(this,n,t,e,i)}function bK(n,t,e){this.a=n,ZN.call(this,t,e)}function wK(n,t,e){this.c=t,this.b=e,this.a=n}function dK(n,t,e){return n.d=BB(t.Kb(e),164)}function gK(n,t){return n.Aj().Nh().Kh(n,t)}function pK(n,t){return n.Aj().Nh().Ih(n,t)}function vK(n,t){return kW(n),GI(n)===GI(t)}function mK(n,t){return kW(n),GI(n)===GI(t)}function yK(n,t){return Qj(Mdn(n.a,t,!1))}function kK(n,t){return Qj(Sdn(n.a,t,!1))}function jK(n,t){return n.b.sd(new $S(n,t))}function EK(n,t){return n.b.sd(new LS(n,t))}function TK(n,t){return n.b.sd(new NS(n,t))}function MK(n,t,e){return n.lastIndexOf(t,e)}function SK(n,t,e){return Pln(n[t.b],n[e.b])}function PK(n,t){return hon(t,(HXn(),Rdt),n)}function CK(n,t){return E$(t.a.d.p,n.a.d.p)}function IK(n,t){return E$(n.a.d.p,t.a.d.p)}function OK(n,t){return Pln(n.c-n.s,t.c-t.s)}function AK(n){return n.c?E7(n.c.a,n,0):-1}function $K(n){return n<100?null:new Fj(n)}function LK(n){return n==UCt||n==WCt||n==XCt}function NK(n,t){return cL(t,15)&&QDn(n.c,t)}function xK(n,t){Qet||t&&(n.d=t)}function DK(n,t){return!!lsn(n,t)}function RK(n,t){this.c=n,GU.call(this,n,t)}function KK(n){this.c=n,vO.call(this,bVn,0)}function _K(n,t){JB.call(this,n,n.length,t)}function FK(n,t,e){return BB(n.c,69).lk(t,e)}function BK(n,t,e){return BB(n.c,69).mk(t,e)}function HK(n,t,e){return oD(n,BB(t,332),e)}function qK(n,t,e){return sD(n,BB(t,332),e)}function GK(n,t,e){return IEn(n,BB(t,332),e)}function zK(n,t,e){return QTn(n,BB(t,332),e)}function UK(n,t){return null==t?null:lfn(n.b,t)}function XK(n){return UI(n)?(kW(n),n):n.ke()}function WK(n){return!isNaN(n)&&!isFinite(n)}function VK(n){s_(),this.a=(SQ(),new Ak(n))}function QK(n){hH(),this.d=n,this.a=new Lp}function YK(n,t,e){this.a=n,this.b=t,this.c=e}function JK(n,t,e){this.a=n,this.b=t,this.c=e}function ZK(n,t,e){this.d=n,this.b=e,this.a=t}function n_(n){P$(this),yQ(this),Frn(this,n)}function t_(n){xA(this),tH(this.c,0,n.Pc())}function e_(n){fW(n.a),z8(n.c,n.b),n.b=null}function i_(n){this.a=n,$T(),fan(Date.now())}function r_(){r_=O,iit=new r,rit=new r}function c_(){c_=O,Tet=new L,Met=new N}function a_(){a_=O,wAt=x8(Ant,HWn,1,0,5,1)}function u_(){u_=O,M$t=x8(Ant,HWn,1,0,5,1)}function o_(){o_=O,S$t=x8(Ant,HWn,1,0,5,1)}function s_(){s_=O,new rv((SQ(),SQ(),set))}function h_(n){return Z9(),Cnn((n7(),_et),n)}function f_(n){return qsn(),Cnn((e8(),Zet),n)}function l_(n){return hpn(),Cnn((I4(),pit),n)}function b_(n){return Rnn(),Cnn((O4(),kit),n)}function w_(n){return tRn(),Cnn((xan(),Fit),n)}function d_(n){return Dtn(),Cnn((Z6(),Wit),n)}function g_(n){return J9(),Cnn((n8(),trt),n)}function p_(n){return G7(),Cnn((t8(),urt),n)}function v_(n){return dWn(),Cnn((MO(),Art),n)}function m_(n){return Dan(),Cnn((e7(),_rt),n)}function y_(n){return Hpn(),Cnn((i7(),zrt),n)}function k_(n){return qpn(),Cnn((r7(),ict),n)}function j_(n){return wM(),Cnn((Q2(),act),n)}function E_(n){return Knn(),Cnn((A4(),_ct),n)}function T_(n){return q7(),Cnn((i8(),Lat),n)}function M_(n){return yMn(),Cnn((Xnn(),qat),n)}function S_(n){return Aun(),Cnn((t7(),rut),n)}function P_(n){return Bfn(),Cnn((r8(),gut),n)}function C_(n,t){if(!n)throw Hp(new _y(t))}function I_(n){return uSn(),Cnn((hen(),Aut),n)}function O_(n){uG.call(this,n.d,n.c,n.a,n.b)}function A_(n){uG.call(this,n.d,n.c,n.a,n.b)}function $_(n,t,e){this.b=n,this.c=t,this.a=e}function L_(n,t,e){this.b=n,this.a=t,this.c=e}function N_(n,t,e){this.a=n,this.b=t,this.c=e}function x_(n,t,e){this.a=n,this.b=t,this.c=e}function D_(n,t,e){this.a=n,this.b=t,this.c=e}function R_(n,t,e){this.a=n,this.b=t,this.c=e}function K_(n,t,e){this.b=n,this.a=t,this.c=e}function __(n,t,e){this.e=t,this.b=n,this.d=e}function F_(n,t,e){return dM(),n.a.Od(t,e),t}function B_(n){var t;return(t=new jn).e=n,t}function H_(n){var t;return(t=new Zv).b=n,t}function q_(){q_=O,Uut=new Ne,Xut=new xe}function G_(){G_=O,dst=new vr,gst=new mr}function z_(n){return Iun(),Cnn((a7(),ost),n)}function U_(n){return Oun(),Cnn((o7(),Est),n)}function X_(n){return kDn(),Cnn((Gcn(),Vst),n)}function W_(n){return $Pn(),Cnn((ben(),rht),n)}function V_(n){return V8(),Cnn((R4(),oht),n)}function Q_(n){return Oin(),Cnn((c8(),bht),n)}function Y_(n){return LEn(),Cnn((Hnn(),Ost),n)}function J_(n){return Crn(),Cnn((o8(),_st),n)}function Z_(n){return uin(),Cnn((a8(),vht),n)}function nF(n){return Vvn(),Cnn((Fnn(),Mht),n)}function tF(n){return _nn(),Cnn((L4(),Iht),n)}function eF(n){return Jun(),Cnn((u8(),Nht),n)}function iF(n){return gSn(),Cnn((pen(),Hht),n)}function rF(n){return g7(),Cnn((N4(),Uht),n)}function cF(n){return Bjn(),Cnn((den(),nft),n)}function aF(n){return JMn(),Cnn((wen(),oft),n)}function uF(n){return bDn(),Cnn((Vun(),yft),n)}function oF(n){return Kan(),Cnn((h8(),Mft),n)}function sF(n){return z7(),Cnn((s8(),Oft),n)}function hF(n){return z2(),Cnn((K4(),Nft),n)}function fF(n){return Tbn(),Cnn((qnn(),zlt),n)}function lF(n){return TTn(),Cnn((gen(),rvt),n)}function bF(n){return Mhn(),Cnn((f8(),svt),n)}function wF(n){return bvn(),Cnn((s7(),dvt),n)}function dF(n){return ain(),Cnn((w8(),Uvt),n)}function gF(n){return sNn(),Cnn((qcn(),$vt),n)}function pF(n){return mon(),Cnn((b8(),Rvt),n)}function vF(n){return U7(),Cnn((D4(),Bvt),n)}function mF(n){return Hcn(),Cnn((l8(),Yvt),n)}function yF(n){return Nvn(),Cnn((Bnn(),jvt),n)}function kF(n){return A6(),Cnn((x4(),tmt),n)}function jF(n){return Usn(),Cnn((g8(),amt),n)}function EF(n){return dcn(),Cnn((p8(),fmt),n)}function TF(n){return $un(),Cnn((d8(),gmt),n)}function MF(n){return oin(),Cnn((v8(),Nmt),n)}function SF(n){return Q4(),Cnn((F4(),Gmt),n)}function PF(n){return gJ(),Cnn((B4(),iyt),n)}function CF(n){return oZ(),Cnn((H4(),uyt),n)}function IF(n){return O6(),Cnn((_4(),Pyt),n)}function OF(n){return dJ(),Cnn((q4(),Dyt),n)}function AF(n){return zyn(),Cnn((c7(),Hyt),n)}function $F(n){return DPn(),Cnn((ven(),Jyt),n)}function LF(n){return sZ(),Cnn((U4(),Fkt),n)}function NF(n){return Prn(),Cnn((z4(),Zkt),n)}function xF(n){return B0(),Cnn((G4(),Gkt),n)}function DF(n){return Cbn(),Cnn((m8(),rjt),n)}function RF(n){return D9(),Cnn((X4(),ojt),n)}function KF(n){return Hsn(),Cnn((y8(),bjt),n)}function _F(n){return Omn(),Cnn((u7(),zjt),n)}function FF(n){return Bcn(),Cnn((j8(),Qjt),n)}function BF(n){return Sbn(),Cnn((k8(),eEt),n)}function HF(n){return YLn(),Cnn((Unn(),BEt),n)}function qF(n){return Pbn(),Cnn((E8(),UEt),n)}function GF(n){return CM(),Cnn((W2(),VEt),n)}function zF(n){return IM(),Cnn((X2(),JEt),n)}function UF(n){return $6(),Cnn((V4(),eTt),n)}function XF(n){return $Sn(),Cnn((Gnn(),sTt),n)}function WF(n){return OM(),Cnn((V2(),UTt),n)}function VF(n){return Lun(),Cnn((W4(),QTt),n)}function QF(n){return rpn(),Cnn((znn(),bMt),n)}function YF(n){return PPn(),Cnn((zcn(),EMt),n)}function JF(n){return wvn(),Cnn((len(),xMt),n)}function ZF(n){return wEn(),Cnn((fen(),tSt),n)}function nB(n){return lWn(),Cnn((SO(),Zot),n)}function tB(n){return Srn(),Cnn(($4(),zut),n)}function eB(n){return Ffn(),Cnn((Wnn(),GPt),n)}function iB(n){return Rtn(),Cnn((M8(),VPt),n)}function rB(n){return Mbn(),Cnn((l7(),tCt),n)}function cB(n){return nMn(),Cnn((yen(),sCt),n)}function aB(n){return ufn(),Cnn((T8(),kCt),n)}function uB(n){return Xyn(),Cnn((f7(),PCt),n)}function oB(n){return n$n(),Cnn((Nan(),KCt),n)}function sB(n){return cpn(),Cnn((Vnn(),zCt),n)}function hB(n){return QEn(),Cnn((Htn(),ZCt),n)}function fB(n){return lIn(),Cnn((men(),uIt),n)}function lB(n){return mdn(),Cnn((w7(),BIt),n)}function bB(n){return n_n(),Cnn((Qun(),JIt),n)}function wB(n){return kUn(),Cnn((Qnn(),OIt),n)}function dB(n){return Fwn(),Cnn((b7(),rOt),n)}function gB(n){return Bsn(),Cnn((h7(),fOt),n)}function pB(n){return hAn(),Cnn((Ucn(),cAt),n)}function vB(n,t){return kW(n),n+(kW(t),t)}function mB(n,t){return $T(),f9(QQ(n.a),t)}function yB(n,t){return $T(),f9(QQ(n.a),t)}function kB(n,t){this.c=n,this.a=t,this.b=t-n}function jB(n,t,e){this.a=n,this.b=t,this.c=e}function EB(n,t,e){this.a=n,this.b=t,this.c=e}function TB(n,t,e){this.a=n,this.b=t,this.c=e}function MB(n,t,e){this.a=n,this.b=t,this.c=e}function SB(n,t,e){this.a=n,this.b=t,this.c=e}function PB(n,t,e){this.e=n,this.a=t,this.c=e}function CB(n,t,e){f$(),mJ.call(this,n,t,e)}function IB(n,t,e){f$(),rW.call(this,n,t,e)}function OB(n,t,e){f$(),rW.call(this,n,t,e)}function AB(n,t,e){f$(),rW.call(this,n,t,e)}function $B(n,t,e){f$(),IB.call(this,n,t,e)}function LB(n,t,e){f$(),IB.call(this,n,t,e)}function NB(n,t,e){f$(),LB.call(this,n,t,e)}function xB(n,t,e){f$(),OB.call(this,n,t,e)}function DB(n,t,e){f$(),AB.call(this,n,t,e)}function RB(n,t){return yX(n),yX(t),new hT(n,t)}function KB(n,t){return yX(n),yX(t),new _H(n,t)}function _B(n,t){return yX(n),yX(t),new FH(n,t)}function FB(n,t){return yX(n),yX(t),new lT(n,t)}function BB(n,t){return JH(null==n||Qpn(n,t)),n}function HB(n){var t;return fnn(t=new Np,n),t}function qB(n){var t;return fnn(t=new Rv,n),t}function GB(n){var t;return qrn(t=new zv,n),t}function zB(n){var t;return qrn(t=new YT,n),t}function UB(n){return!n.e&&(n.e=new Np),n.e}function XB(n){return!n.c&&(n.c=new Bo),n.c}function WB(n,t){return n.c[n.c.length]=t,!0}function VB(n,t){this.c=n,this.b=t,this.a=!1}function QB(n){this.d=n,Mb(this),this.b=rz(n.d)}function YB(){this.a=";,;",this.b="",this.c=""}function JB(n,t,e){Uz.call(this,t,e),this.a=n}function ZB(n,t,e){this.b=n,gO.call(this,t,e)}function nH(n,t,e){this.c=n,PS.call(this,t,e)}function tH(n,t,e){_Cn(e,0,n,t,e.length,!1)}function eH(n,t,e,i,r){n.b=t,n.c=e,n.d=i,n.a=r}function iH(n,t){t&&(n.b=t,n.a=(EW(t),t.a))}function rH(n,t,e,i,r){n.d=t,n.c=e,n.a=i,n.b=r}function cH(n){var t,e;t=n.b,e=n.c,n.b=e,n.c=t}function aH(n){var t,e;e=n.d,t=n.a,n.d=t,n.a=e}function uH(n){return uan(xU(JO(n)?Pan(n):n))}function oH(n,t){return E$(oq(n.d),oq(t.d))}function sH(n,t){return t==(kUn(),CIt)?n.c:n.d}function hH(){hH=O,kUn(),Rmt=CIt,Kmt=oIt}function fH(){this.b=Gy(MD(mpn((fRn(),aat))))}function lH(n){return dM(),x8(Ant,HWn,1,n,5,1)}function bH(n){return new xC(n.c+n.b,n.d+n.a)}function wH(n,t){return SM(),E$(n.d.p,t.d.p)}function dH(n){return Px(0!=n.b),Atn(n,n.a.a)}function gH(n){return Px(0!=n.b),Atn(n,n.c.b)}function pH(n,t){if(!n)throw Hp(new $y(t))}function vH(n,t){if(!n)throw Hp(new _y(t))}function mH(n,t,e){dP.call(this,n,t),this.b=e}function yH(n,t,e){LI.call(this,n,t),this.c=e}function kH(n,t,e){btn.call(this,t,e),this.d=n}function jH(n){o_(),yo.call(this),this.th(n)}function EH(n,t,e){this.a=n,NO.call(this,t,e)}function TH(n,t,e){this.a=n,NO.call(this,t,e)}function MH(n,t,e){LI.call(this,n,t),this.c=e}function SH(){R5(),oW.call(this,(WM(),zAt))}function PH(n){return null!=n&&!Xbn(n,LAt,NAt)}function CH(n,t){return(Wfn(n)<<4|Wfn(t))&QVn}function IH(n,t){return nV(),zvn(n,t),new GW(n,t)}function OH(n,t){var e;n.n&&(e=t,WB(n.f,e))}function AH(n,t,e){rtn(n,t,new GX(e))}function $H(n,t){var e;return e=n.c,Kin(n,t),e}function LH(n,t){return n.g=t<0?-1:t,n}function NH(n,t){return ztn(n),n.a*=t,n.b*=t,n}function xH(n,t,e,i,r){n.c=t,n.d=e,n.b=i,n.a=r}function DH(n,t){return r5(n,t,n.c.b,n.c),!0}function RH(n){n.a.b=n.b,n.b.a=n.a,n.a=n.b=null}function KH(n){this.b=n,this.a=lz(this.b.a).Ed()}function _H(n,t){this.b=n,this.a=t,Bh.call(this)}function FH(n,t){this.a=n,this.b=t,Bh.call(this)}function BH(n,t){Uz.call(this,t,1040),this.a=n}function HH(n){return 0==n||isNaN(n)?n:n<0?-1:1}function qH(n){return MQ(),PMn(n)==JJ(OMn(n))}function GH(n){return MQ(),OMn(n)==JJ(PMn(n))}function zH(n,t){return Yjn(n,new dP(t.a,t.b))}function UH(n){return!b5(n)&&n.c.i.c==n.d.i.c}function XH(n){var t;return t=n.n,n.a.b+t.d+t.a}function WH(n){var t;return t=n.n,n.e.b+t.d+t.a}function VH(n){var t;return t=n.n,n.e.a+t.b+t.c}function QH(n){return wWn(),new oG(0,n)}function YH(n){return n.a?n.a:eQ(n)}function JH(n){if(!n)throw Hp(new Ky(null))}function ZH(){ZH=O,SQ(),uLt=new Gb(P7n)}function nq(){nq=O,new svn((ty(),_nt),(ey(),Knt))}function tq(){tq=O,Itt=x8(Att,sVn,19,256,0,1)}function eq(n,t,e,i){awn.call(this,n,t,e,i,0,0)}function iq(n,t,e){return VW(n.b,BB(e.b,17),t)}function rq(n,t,e){return VW(n.b,BB(e.b,17),t)}function cq(n,t){return WB(n,new xC(t.a,t.b))}function aq(n,t){return n.c<t.c?-1:n.c==t.c?0:1}function uq(n){return n.e.c.length+n.g.c.length}function oq(n){return n.e.c.length-n.g.c.length}function sq(n){return n.b.c.length-n.e.c.length}function hq(n){return BZ(),(kUn(),bIt).Hc(n.j)}function fq(n){o_(),jH.call(this,n),this.a=-1}function lq(n,t){xI.call(this,n,t),this.a=this}function bq(n,t){var e;return(e=mX(n,t)).i=2,e}function wq(n,t){return++n.j,n.Ti(t)}function dq(n,t,e){return n.a=-1,WN(n,t.g,e),n}function gq(n,t,e){Kzn(n.a,n.b,n.c,BB(t,202),e)}function pq(n,t){Bin(n,null==t?null:(kW(t),t))}function vq(n,t){Rin(n,null==t?null:(kW(t),t))}function mq(n,t){Rin(n,null==t?null:(kW(t),t))}function yq(n,t,e){return new wK(dW(n).Ie(),e,t)}function kq(n,t,e,i,r,c){return Vjn(n,t,e,i,r,0,c)}function jq(){jq=O,jtt=x8(Ttt,sVn,217,256,0,1)}function Eq(){Eq=O,$tt=x8(Rtt,sVn,162,256,0,1)}function Tq(){Tq=O,Ktt=x8(_tt,sVn,184,256,0,1)}function Mq(){Mq=O,Mtt=x8(Stt,sVn,172,128,0,1)}function Sq(){eH(this,!1,!1,!1,!1)}function Pq(n){WX(),this.a=(SQ(),new Gb(yX(n)))}function Cq(n){for(yX(n);n.Ob();)n.Pb(),n.Qb()}function Iq(n){n.a.cd(),BB(n.a.dd(),14).gc(),wk()}function Oq(n){this.c=n,this.b=this.c.d.vc().Kc()}function Aq(n){this.c=n,this.a=new QT(this.c.a)}function $q(n){this.a=new XT(n.gc()),Frn(this,n)}function Lq(n){ew.call(this,new v4),Frn(this,n)}function Nq(n,t){return n.a+=Bdn(t,0,t.length),n}function xq(n,t){return l1(t,n.c.length),n.c[t]}function Dq(n,t){return l1(t,n.a.length),n.a[t]}function Rq(n,t){dM(),B8.call(this,n),this.a=t}function Kq(n,t){return jgn(rbn(jgn(n.a).a,t.a))}function _q(n,t){return kW(n),Ncn(n,(kW(t),t))}function Fq(n,t){return kW(t),Ncn(t,(kW(n),n))}function Bq(n,t){return $X(t,0,Hq(t[0],jgn(1)))}function Hq(n,t){return Kq(BB(n,162),BB(t,162))}function qq(n){return n.c-BB(xq(n.a,n.b),287).b}function Gq(n){return n.q?n.q:(SQ(),SQ(),het)}function zq(n){return n.e.Hd().gc()*n.c.Hd().gc()}function Uq(n,t,e){return E$(t.d[n.g],e.d[n.g])}function Xq(n,t,e){return E$(n.d[t.p],n.d[e.p])}function Wq(n,t,e){return E$(n.d[t.p],n.d[e.p])}function Vq(n,t,e){return E$(n.d[t.p],n.d[e.p])}function Qq(n,t,e){return E$(n.d[t.p],n.d[e.p])}function Yq(n,t,i){return e.Math.min(i/n,1/t)}function Jq(n,t){return n?0:e.Math.max(0,t-1)}function Zq(n,t){var e;for(e=0;e<t;++e)n[e]=-1}function nG(n){var t;return(t=uEn(n))?nG(t):n}function tG(n,t){return null==n.a&&wRn(n),n.a[t]}function eG(n){return n.c?n.c.f:n.e.b}function iG(n){return n.c?n.c.g:n.e.a}function rG(n){gtn.call(this,n.gc()),pX(this,n)}function cG(n,t){f$(),jp.call(this,t),this.a=n}function aG(n,t,e){this.a=n,$L.call(this,t,e,2)}function uG(n,t,e,i){_h(this),rH(this,n,t,e,i)}function oG(n,t){wWn(),Ap.call(this,n),this.a=t}function sG(n){this.b=new YT,this.a=n,this.c=-1}function hG(){this.d=new xC(0,0),this.e=new Rv}function fG(n){ZN.call(this,0,0),this.a=n,this.b=0}function lG(n){this.a=n,this.c=new xp,ron(this)}function bG(n){if(n.e.c!=n.b)throw Hp(new vv)}function wG(n){if(n.c.e!=n.a)throw Hp(new vv)}function dG(n){return JO(n)?0|n:TE(n)}function gG(n,t){return wWn(),new UU(n,t)}function pG(n,t){return null==n?null==t:mK(n,t)}function vG(n,t){return null==n?null==t:mgn(n,t)}function mG(n,t,e){return orn(n.a,t),EU(n,t.g,e)}function yG(n,t,e){ihn(0,t,n.length),z9(n,0,t,e)}function kG(n,t,e){LZ(t,n.c.length),MS(n.c,t,e)}function jG(n,t,e){var i;for(i=0;i<t;++i)n[i]=e}function EG(n,t){var e;return $on(e=nbn(n),t),e}function TG(n,t){return!n&&(n=[]),n[n.length]=t,n}function MG(n,t){return!(void 0===n.a.get(t))}function SG(n,t){return Xin(new nn,new uw(n),t)}function PG(n){return null==n?Set:new vy(kW(n))}function CG(n,t){return cL(t,22)&&SN(n,BB(t,22))}function IG(n,t){return cL(t,22)&&$tn(n,BB(t,22))}function OG(n){return H$n(n,26)*rYn+H$n(n,27)*cYn}function AG(n){return Array.isArray(n)&&n.im===I}function $G(n){n.b?$G(n.b):n.d.dc()&&n.f.c.Bc(n.e)}function LG(n,t){UR(n.c,t),n.b.c+=t.a,n.b.d+=t.b}function NG(n,t){LG(n,XR(new xC(t.a,t.b),n.c))}function xG(n,t){this.b=new YT,this.a=n,this.c=t}function DG(){this.b=new Ot,this.c=new lY(this)}function RG(){this.d=new mn,this.e=new fY(this)}function KG(){KZ(),this.f=new YT,this.e=new YT}function _G(){BZ(),this.k=new xp,this.d=new Rv}function FG(){FG=O,bOt=new XA((sWn(),aPt),0)}function BG(){BG=O,qnt=new fG(x8(Ant,HWn,1,0,5,1))}function HG(n,t,e){VAn(e,n,1),WB(t,new cP(e,n))}function qG(n,t,e){Fkn(e,n,1),WB(t,new bP(e,n))}function GG(n,t,e){return TU(n,new xS(t.a,e.a))}function zG(n,t,e){return-E$(n.f[t.p],n.f[e.p])}function UG(n,t,e){var i;n&&((i=n.i).c=t,i.b=e)}function XG(n,t,e){var i;n&&((i=n.i).d=t,i.a=e)}function WG(n,t,e){return n.a=-1,WN(n,t.g+1,e),n}function VG(n,t,e){return e=T_n(n,BB(t,49),7,e)}function QG(n,t,e){return e=T_n(n,BB(t,49),3,e)}function YG(n,t,e){this.a=n,LL.call(this,t,e,22)}function JG(n,t,e){this.a=n,LL.call(this,t,e,14)}function ZG(n,t,e,i){f$(),N0.call(this,n,t,e,i)}function nz(n,t,e,i){f$(),N0.call(this,n,t,e,i)}function tz(n,t){0!=(t.Bb&h6n)&&!n.a.o&&(n.a.o=t)}function ez(n){return null!=n&&DU(n)&&!(n.im===I)}function iz(n){return!Array.isArray(n)&&n.im===I}function rz(n){return cL(n,15)?BB(n,15).Yc():n.Kc()}function cz(n){return n.Qc(x8(Ant,HWn,1,n.gc(),5,1))}function az(n,t){return lgn(F7(n,t))?t.Qh():null}function uz(n){n?Fmn(n,($T(),Btt),""):$T()}function oz(n){this.a=(BG(),qnt),this.d=BB(yX(n),47)}function sz(n,t,e,i){this.a=n,W6.call(this,n,t,e,i)}function hz(n){eS(),this.a=0,this.b=n-1,this.c=1}function fz(n){V$(this),this.g=n,jQ(this),this._d()}function lz(n){return n.c?n.c:n.c=n.Id()}function bz(n){return n.d?n.d:n.d=n.Jd()}function wz(n){return n.c||(n.c=n.Dd())}function dz(n){return n.f||(n.f=n.Dc())}function gz(n){return n.i||(n.i=n.bc())}function pz(n){return wWn(),new vJ(10,n,0)}function vz(n){return JO(n)?""+n:GDn(n)}function mz(n){if(n.e.j!=n.d)throw Hp(new vv)}function yz(n,t){return uan(lSn(JO(n)?Pan(n):n,t))}function kz(n,t){return uan(jAn(JO(n)?Pan(n):n,t))}function jz(n,t){return uan(JSn(JO(n)?Pan(n):n,t))}function Ez(n,t){return bR((kW(n),n),(kW(t),t))}function Tz(n,t){return Pln((kW(n),n),(kW(t),t))}function Mz(n,t){return yX(t),n.a.Ad(t)&&!n.b.Ad(t)}function Sz(n,t){return M$(n.l&t.l,n.m&t.m,n.h&t.h)}function Pz(n,t){return M$(n.l|t.l,n.m|t.m,n.h|t.h)}function Cz(n,t){return M$(n.l^t.l,n.m^t.m,n.h^t.h)}function Iz(n,t){return $fn(n,(kW(t),new rw(t)))}function Oz(n,t){return $fn(n,(kW(t),new cw(t)))}function Az(n){return gcn(),0!=BB(n,11).e.c.length}function $z(n){return gcn(),0!=BB(n,11).g.c.length}function Lz(n,t){return Irn(),Pln(t.a.o.a,n.a.o.a)}function Nz(n,t,e){return TUn(n,BB(t,11),BB(e,11))}function xz(n){return n.e?D6(n.e):null}function Dz(n){n.d||(n.d=n.b.Kc(),n.c=n.b.gc())}function Rz(n,t,e){n.a.Mb(e)&&(n.b=!0,t.td(e))}function Kz(n,t){if(n<0||n>=t)throw Hp(new Sv)}function _z(n,t,e){return $X(t,0,Hq(t[0],e[0])),t}function Fz(n,t,e){t.Ye(e,Gy(MD(RX(n.b,e)))*n.a)}function Bz(n,t,e){return jDn(),Dcn(n,t)&&Dcn(n,e)}function Hz(n){return lIn(),!n.Hc(eIt)&&!n.Hc(rIt)}function qz(n){return new xC(n.c+n.b/2,n.d+n.a/2)}function Gz(n,t){return t.kh()?tfn(n.b,BB(t,49)):t}function zz(n,t){this.e=n,this.d=0!=(64&t)?t|hVn:t}function Uz(n,t){this.c=0,this.d=n,this.b=64|t|hVn}function Xz(n){this.b=new J6(11),this.a=(PQ(),n)}function Wz(n){this.b=null,this.a=(PQ(),n||wet)}function Vz(n){this.a=rvn(n.a),this.b=new t_(n.b)}function Qz(n){this.b=n,cx.call(this,n),ML(this)}function Yz(n){this.b=n,ux.call(this,n),SL(this)}function Jz(n,t,e){this.a=n,eK.call(this,t,e,5,6)}function Zz(n,t,e,i){this.b=n,$L.call(this,t,e,i)}function nU(n,t,e,i,r){k9.call(this,n,t,e,i,r,-1)}function tU(n,t,e,i,r){j9.call(this,n,t,e,i,r,-1)}function eU(n,t,e,i){$L.call(this,n,t,e),this.b=i}function iU(n,t,e,i){yH.call(this,n,t,e),this.b=i}function rU(n){NI.call(this,n,!1),this.a=!1}function cU(n,t){this.b=n,hl.call(this,n.b),this.a=t}function aU(n,t){WX(),jT.call(this,n,sfn(new Jy(t)))}function uU(n,t){return wWn(),new cW(n,t,0)}function oU(n,t){return wWn(),new cW(6,n,t)}function sU(n,t){return mK(n.substr(0,t.length),t)}function hU(n,t){return XI(t)?eY(n,t):!!AY(n.f,t)}function fU(n,t){for(kW(t);n.Ob();)t.td(n.Pb())}function lU(n,t,e){ODn(),this.e=n,this.d=t,this.a=e}function bU(n,t,e,i){var r;(r=n.i).i=t,r.a=e,r.b=i}function wU(n){var t;for(t=n;t.f;)t=t.f;return t}function dU(n){var t;return Px(null!=(t=Eon(n))),t}function gU(n){var t;return Px(null!=(t=mln(n))),t}function pU(n,t){var e;return w6(t,e=n.a.gc()),e-t}function vU(n,t){var e;for(e=0;e<t;++e)n[e]=!1}function mU(n,t,e,i){var r;for(r=t;r<e;++r)n[r]=i}function yU(n,t,e,i){ihn(t,e,n.length),mU(n,t,e,i)}function kU(n,t,e){Kz(e,n.a.c.length),c5(n.a,e,t)}function jU(n,t,e){this.c=n,this.a=t,SQ(),this.b=e}function EU(n,t,e){var i;return i=n.b[t],n.b[t]=e,i}function TU(n,t){return null==n.a.zc(t,n)}function MU(n){if(!n)throw Hp(new yv);return n.d}function SU(n,t){if(null==n)throw Hp(new Hy(t))}function PU(n,t){return!!t&&Frn(n,t)}function CU(n,t,e){return ehn(n,t.g,e),orn(n.c,t),n}function IU(n){return Mzn(n,(Ffn(),_Pt)),n.d=!0,n}function OU(n){return!n.j&&yb(n,FKn(n.g,n.b)),n.j}function AU(n){Mx(-1!=n.b),s6(n.c,n.a=n.b),n.b=-1}function $U(n){n.f=new eA(n),n.g=new iA(n),oY(n)}function LU(n){return new Rq(null,qU(n,n.length))}function NU(n){return new oz(new WL(n.a.length,n.a))}function xU(n){return M$(~n.l&SQn,~n.m&SQn,~n.h&PQn)}function DU(n){return typeof n===AWn||typeof n===xWn}function RU(n){return n==RQn?x7n:n==KQn?"-INF":""+n}function KU(n){return n==RQn?x7n:n==KQn?"-INF":""+n}function _U(n,t){return n>0?e.Math.log(n/t):-100}function FU(n,t){return Vhn(n,t)<0?-1:Vhn(n,t)>0?1:0}function BU(n,t,e){return SHn(n,BB(t,46),BB(e,167))}function HU(n,t){return BB(wz(lz(n.a)).Xb(t),42).cd()}function qU(n,t){return ptn(t,n.length),new BH(n,t)}function GU(n,t){this.d=n,AL.call(this,n),this.e=t}function zU(n){this.d=(kW(n),n),this.a=0,this.c=bVn}function UU(n,t){Ap.call(this,1),this.a=n,this.b=t}function XU(n,t){return n.c?XU(n.c,t):WB(n.b,t),n}function WU(n,t,e){var i;return i=dnn(n,t),r4(n,t,e),i}function VU(n,t){return m7(n.slice(0,t),n)}function QU(n,t,e){var i;for(i=0;i<t;++i)$X(n,i,e)}function YU(n,t,e,i,r){for(;t<e;)i[r++]=fV(n,t++)}function JU(n,t){return Pln(n.c.c+n.c.b,t.c.c+t.c.b)}function ZU(n,t){return null==Mon(n.a,t,(hN(),ptt))}function nX(n,t){r5(n.d,t,n.b.b,n.b),++n.a,n.c=null}function tX(n,t){J$(n,cL(t,153)?t:BB(t,1937).gl())}function eX(n,t){JT($V(n.Oc(),new Yr),new Id(t))}function iX(n,t,e,i,r){NEn(n,BB(h6(t.k,e),15),e,i,r)}function rX(n){n.s=NaN,n.c=NaN,ZOn(n,n.e),ZOn(n,n.j)}function cX(n){n.a=null,n.e=null,$U(n.b),n.d=0,++n.c}function aX(n){return e.Math.abs(n.d.e-n.e.e)-n.a}function uX(n,t,e){return BB(n.c._c(t,BB(e,133)),42)}function oX(){return ry(),Pun(Gk(Wnt,1),$Vn,538,0,[znt])}function sX(n){return MQ(),JJ(PMn(n))==JJ(OMn(n))}function hX(n){$R.call(this),this.a=n,WB(n.a,this)}function fX(n,t){this.d=Sln(n),this.c=t,this.a=.5*t}function lX(){v4.call(this),this.a=!0,this.b=!0}function bX(n){return(null==n.i&&qFn(n),n.i).length}function wX(n){return cL(n,99)&&0!=(BB(n,18).Bb&h6n)}function dX(n,t){++n.j,sTn(n,n.i,t),zIn(n,BB(t,332))}function gX(n,t){return t=n.nk(null,t),$Tn(n,null,t)}function pX(n,t){return n.hi()&&(t=nZ(n,t)),n.Wh(t)}function vX(n,t,e){var i;return Qen(e,i=mX(n,t)),i}function mX(n,t){var e;return(e=new pon).j=n,e.d=t,e}function yX(n){if(null==n)throw Hp(new gv);return n}function kX(n){return n.j||(n.j=new wl(n))}function jX(n){return n.f||(n.f=new UL(n))}function EX(n){return n.k||(n.k=new Yf(n))}function TX(n){return n.k||(n.k=new Yf(n))}function MX(n){return n.g||(n.g=new Qf(n))}function SX(n){return n.i||(n.i=new nl(n))}function PX(n){return n.d||(n.d=new il(n))}function CX(n){return yX(n),cL(n,475)?BB(n,475):Bbn(n)}function IX(n){return cL(n,607)?n:new bJ(n)}function OX(n,t){return w2(t,n.c.b.c.gc()),new sT(n,t)}function AX(n,t,e){return wWn(),new T0(n,t,e)}function $X(n,t,e){return Sx(null==e||Q_n(n,e)),n[t]=e}function LX(n,t){var e;return w2(t,e=n.a.gc()),e-1-t}function NX(n,t){return n.a+=String.fromCharCode(t),n}function xX(n,t){return n.a+=String.fromCharCode(t),n}function DX(n,t){for(kW(t);n.c<n.d;)n.ze(t,n.c++)}function RX(n,t){return XI(t)?SJ(n,t):qI(AY(n.f,t))}function KX(n,t){return MQ(),n==PMn(t)?OMn(t):PMn(t)}function _X(n,t){nW(n,new GX(null!=t.f?t.f:""+t.g))}function FX(n,t){nW(n,new GX(null!=t.f?t.f:""+t.g))}function BX(n){this.b=new Np,this.a=new Np,this.c=n}function HX(n){this.c=new Gj,this.a=new Np,this.b=n}function qX(n){$R.call(this),this.a=new Gj,this.c=n}function GX(n){if(null==n)throw Hp(new gv);this.a=n}function zX(n){Mv(),this.b=new Np,this.a=n,vGn(this,n)}function UX(n){this.c=n,this.a=new YT,this.b=new YT}function XX(){XX=O,ott=new Ml(!1),stt=new Ml(!0)}function WX(){WX=O,s_(),Fnt=new SY((SQ(),SQ(),set))}function VX(){VX=O,s_(),Vnt=new vS((SQ(),SQ(),fet))}function QX(){QX=O,t$t=GIn(),gWn(),i$t&&Rkn()}function YX(n,t){return Irn(),BB(oV(n,t.d),15).Fc(t)}function JX(n,t,e,i){return 0==e||(e-i)/e<n.e||t>=n.g}function ZX(n,t,e){return NRn(n,yrn(n,t,e))}function nW(n,t){var e;dnn(n,e=n.a.length),r4(n,e,t)}function tW(n,t){console[n].call(console,t)}function eW(n,t){var e;++n.j,e=n.Vi(),n.Ii(n.oi(e,t))}function iW(n,t,e){BB(t.b,65),Otn(t.a,new EB(n,e,t))}function rW(n,t,e){jp.call(this,t),this.a=n,this.b=e}function cW(n,t,e){Ap.call(this,n),this.a=t,this.b=e}function aW(n,t,e){this.a=n,kp.call(this,t),this.b=e}function uW(n,t,e){this.a=n,H2.call(this,8,t,null,e)}function oW(n){this.a=(kW(_9n),_9n),this.b=n,new Nm}function sW(n){this.c=n,this.b=this.c.a,this.a=this.c.e}function hW(n){this.c=n,this.b=n.a.d.a,bD(n.a.e,this)}function fW(n){Mx(-1!=n.c),n.d.$c(n.c),n.b=n.c,n.c=-1}function lW(n){return e.Math.sqrt(n.a*n.a+n.b*n.b)}function bW(n,t){return Kz(t,n.a.c.length),xq(n.a,t)}function wW(n,t){return GI(n)===GI(t)||null!=n&&Nfn(n,t)}function dW(n){return 0>=n?new VT:Win(n-1)}function gW(n){return!!SNt&&eY(SNt,n)}function pW(n){return n?n.dc():!n.Kc().Ob()}function vW(n){return!n.a&&n.c?n.c.b:n.a}function mW(n){return!n.a&&(n.a=new $L(LOt,n,4)),n.a}function yW(n){return!n.d&&(n.d=new $L(VAt,n,1)),n.d}function kW(n){if(null==n)throw Hp(new gv);return n}function jW(n){n.c?n.c.He():(n.d=!0,QNn(n))}function EW(n){n.c?EW(n.c):(Qln(n),n.d=!0)}function TW(n){TV(n.a),n.b=x8(Ant,HWn,1,n.b.length,5,1)}function MW(n,t){return E$(t.j.c.length,n.j.c.length)}function SW(n,t){n.c<0||n.b.b<n.c?fO(n.b,t):n.a._e(t)}function PW(n,t){var e;(e=n.Yg(t))>=0?n.Bh(e):cIn(n,t)}function CW(n){return n.c.i.c==n.d.i.c}function IW(n){if(4!=n.p)throw Hp(new dv);return n.e}function OW(n){if(3!=n.p)throw Hp(new dv);return n.e}function AW(n){if(6!=n.p)throw Hp(new dv);return n.f}function $W(n){if(6!=n.p)throw Hp(new dv);return n.k}function LW(n){if(3!=n.p)throw Hp(new dv);return n.j}function NW(n){if(4!=n.p)throw Hp(new dv);return n.j}function xW(n){return!n.b&&(n.b=new Tp(new xm)),n.b}function DW(n){return-2==n.c&&gb(n,uMn(n.g,n.b)),n.c}function RW(n,t){var e;return(e=mX("",n)).n=t,e.i=1,e}function KW(n,t){LG(BB(t.b,65),n),Otn(t.a,new Aw(n))}function _W(n,t){f9((!n.a&&(n.a=new oR(n,n)),n.a),t)}function FW(n,t){this.b=n,GU.call(this,n,t),ML(this)}function BW(n,t){this.b=n,RK.call(this,n,t),SL(this)}function HW(n,t,e,i){vT.call(this,n,t),this.d=e,this.a=i}function qW(n,t,e,i){vT.call(this,n,e),this.a=t,this.f=i}function GW(n,t){W$.call(this,Vin(yX(n),yX(t))),this.a=t}function zW(){dMn.call(this,S7n,(rE(),dLt)),Wqn(this)}function UW(){dMn.call(this,V9n,(iE(),n$t)),OHn(this)}function XW(){gT.call(this,"DELAUNAY_TRIANGULATION",0)}function WW(n){return String.fromCharCode.apply(null,n)}function VW(n,t,e){return XI(t)?mZ(n,t,e):jCn(n.f,t,e)}function QW(n){return SQ(),n?n.ve():(PQ(),PQ(),get)}function YW(n,t,e){return Nun(),e.pg(n,BB(t.cd(),146))}function JW(n,t){return nq(),new svn(new rN(n),new iN(t))}function ZW(n){return lin(n,NVn),ttn(rbn(rbn(5,n),n/10|0))}function nV(){nV=O,Bnt=new hy(Pun(Gk(Hnt,1),kVn,42,0,[]))}function tV(n){return!n.d&&(n.d=new Hb(n.c.Cc())),n.d}function eV(n){return!n.a&&(n.a=new Lk(n.c.vc())),n.a}function iV(n){return!n.b&&(n.b=new Ak(n.c.ec())),n.b}function rV(n,t){for(;t-- >0;)n=n<<1|(n<0?1:0);return n}function cV(n,t){return GI(n)===GI(t)||null!=n&&Nfn(n,t)}function aV(n,t){return hN(),BB(t.b,19).a<n}function uV(n,t){return hN(),BB(t.a,19).a<n}function oV(n,t){return CG(n.a,t)?n.b[BB(t,22).g]:null}function sV(n,t,e,i){n.a=fx(n.a,0,t)+""+i+nO(n.a,e)}function hV(n,t){n.u.Hc((lIn(),eIt))&&PIn(n,t),z6(n,t)}function fV(n,t){return b1(t,n.length),n.charCodeAt(t)}function lV(){dy.call(this,"There is no more element.")}function bV(n){this.d=n,this.a=this.d.b,this.b=this.d.c}function wV(n){n.b=!1,n.c=!1,n.d=!1,n.a=!1}function dV(n,t,e,i){return Rcn(n,t,e,!1),Zfn(n,i),n}function gV(n){return n.j.c=x8(Ant,HWn,1,0,5,1),n.a=-1,n}function pV(n){return!n.c&&(n.c=new hK(KOt,n,5,8)),n.c}function vV(n){return!n.b&&(n.b=new hK(KOt,n,4,7)),n.b}function mV(n){return!n.n&&(n.n=new eU(zOt,n,1,7)),n.n}function yV(n){return!n.c&&(n.c=new eU(XOt,n,9,9)),n.c}function kV(n){return n.e==C7n&&vb(n,Tgn(n.g,n.b)),n.e}function jV(n){return n.f==C7n&&mb(n,pkn(n.g,n.b)),n.f}function EV(n){var t;return!(t=n.b)&&(n.b=t=new Jf(n)),t}function TV(n){var t;for(t=n.Kc();t.Ob();)t.Pb(),t.Qb()}function MV(n){if(zbn(n.d),n.d.d!=n.c)throw Hp(new vv)}function SV(n,t){this.b=n,this.c=t,this.a=new QT(this.b)}function PV(n,t,e){this.a=XVn,this.d=n,this.b=t,this.c=e}function CV(n,t){this.d=(kW(n),n),this.a=16449,this.c=t}function IV(n,t){Jln(n,Gy(Ren(t,"x")),Gy(Ren(t,"y")))}function OV(n,t){Jln(n,Gy(Ren(t,"x")),Gy(Ren(t,"y")))}function AV(n,t){return Qln(n),new Rq(n,new Q9(t,n.a))}function $V(n,t){return Qln(n),new Rq(n,new M6(t,n.a))}function LV(n,t){return Qln(n),new AD(n,new E6(t,n.a))}function NV(n,t){return Qln(n),new $D(n,new T6(t,n.a))}function xV(n,t){return new pY(BB(yX(n),62),BB(yX(t),62))}function DV(n,t){return jM(),Pln((kW(n),n),(kW(t),t))}function RV(){return wM(),Pun(Gk(Pct,1),$Vn,481,0,[rct])}function KV(){return CM(),Pun(Gk(YEt,1),$Vn,482,0,[XEt])}function _V(){return IM(),Pun(Gk(tTt,1),$Vn,551,0,[QEt])}function FV(){return OM(),Pun(Gk(VTt,1),$Vn,530,0,[GTt])}function BV(n){this.a=new Np,this.e=x8(ANt,sVn,48,n,0,2)}function HV(n,t,e,i){this.a=n,this.e=t,this.d=e,this.c=i}function qV(n,t,e,i){this.a=n,this.c=t,this.b=e,this.d=i}function GV(n,t,e,i){this.c=n,this.b=t,this.a=e,this.d=i}function zV(n,t,e,i){this.c=n,this.b=t,this.d=e,this.a=i}function UV(n,t,e,i){this.c=n,this.d=t,this.b=e,this.a=i}function XV(n,t,e,i){this.a=n,this.d=t,this.c=e,this.b=i}function WV(n,t,e,i){gT.call(this,n,t),this.a=e,this.b=i}function VV(n,t,e,i){this.a=n,this.c=t,this.d=e,this.b=i}function QV(n,t,e){EHn(n.a,e),nun(e),AAn(n.b,e),rqn(t,e)}function YV(n,t,e){var i;return i=$Un(n),t.Kh(e,i)}function JV(n,t){var e,i;return(e=n/t)>(i=CJ(e))&&++i,i}function ZV(n){var t;return cen(t=new Kp,n),t}function nQ(n){var t;return DMn(t=new Kp,n),t}function tQ(n,t){return Kcn(t,RX(n.f,t)),null}function eQ(n){return Yin(n)||null}function iQ(n){return!n.b&&(n.b=new eU(_Ot,n,12,3)),n.b}function rQ(n){return null!=n&&xT(jAt,n.toLowerCase())}function cQ(n,t){return Pln(iG(n)*eG(n),iG(t)*eG(t))}function aQ(n,t){return Pln(iG(n)*eG(n),iG(t)*eG(t))}function uQ(n,t){return Pln(n.d.c+n.d.b/2,t.d.c+t.d.b/2)}function oQ(n,t){return Pln(n.g.c+n.g.b/2,t.g.c+t.g.b/2)}function sQ(n,t,e){e.a?Cen(n,t.b-n.f/2):Pen(n,t.a-n.g/2)}function hQ(n,t,e,i){this.a=n,this.b=t,this.c=e,this.d=i}function fQ(n,t,e,i){this.a=n,this.b=t,this.c=e,this.d=i}function lQ(n,t,e,i){this.e=n,this.a=t,this.c=e,this.d=i}function bQ(n,t,e,i){this.a=n,this.c=t,this.d=e,this.b=i}function wQ(n,t,e,i){f$(),e6.call(this,t,e,i),this.a=n}function dQ(n,t,e,i){f$(),e6.call(this,t,e,i),this.a=n}function gQ(n,t){this.a=n,OD.call(this,n,BB(n.d,15).Zc(t))}function pQ(n){this.f=n,this.c=this.f.e,n.f>0&&ujn(this)}function vQ(n,t,e,i){this.b=n,this.c=i,vO.call(this,t,e)}function mQ(n){return Px(n.b<n.d.gc()),n.d.Xb(n.c=n.b++)}function yQ(n){n.a.a=n.c,n.c.b=n.a,n.a.b=n.c.a=null,n.b=0}function kQ(n,t){return n.b=t.b,n.c=t.c,n.d=t.d,n.a=t.a,n}function jQ(n){return n.n&&(n.e!==FVn&&n._d(),n.j=null),n}function EQ(n){return JH(null==n||DU(n)&&!(n.im===I)),n}function TQ(n){this.b=new Np,gun(this.b,this.b),this.a=n}function MQ(){MQ=O,Sct=new Np,Mct=new xp,Tct=new Np}function SQ(){SQ=O,set=new S,het=new C,fet=new M}function PQ(){PQ=O,wet=new R,det=new R,get=new K}function CQ(){CQ=O,hit=new gn,lit=new RG,fit=new pn}function IQ(){256==ait&&(iit=rit,rit=new r,ait=0),++ait}function OQ(n){return n.f||(n.f=new pT(n,n.c))}function AQ(n){return QIn(n)&&qy(TD(ZAn(n,(HXn(),dgt))))}function $Q(n,t){return JIn(n,BB(mMn(t,(HXn(),Wgt)),19),t)}function LQ(n,t){return Tfn(n.j,t.s,t.c)+Tfn(t.e,n.s,n.c)}function NQ(n,t){n.e&&!n.e.a&&(Fp(n.e,t),NQ(n.e,t))}function xQ(n,t){n.d&&!n.d.a&&(Fp(n.d,t),xQ(n.d,t))}function DQ(n,t){return-Pln(iG(n)*eG(n),iG(t)*eG(t))}function RQ(n){return BB(n.cd(),146).tg()+":"+Bbn(n.dd())}function KQ(n){var t;G_(),(t=BB(n.g,10)).n.a=n.d.c+t.d.b}function _Q(n,t,e){return MM(),xbn(BB(RX(n.e,t),522),e)}function FQ(n,t){return tsn(n),tsn(t),Py(BB(n,22),BB(t,22))}function BQ(n,t,e){n.i=0,n.e=0,t!=e&&Xon(n,t,e)}function HQ(n,t,e){n.i=0,n.e=0,t!=e&&Won(n,t,e)}function qQ(n,t,e){rtn(n,t,new Sl(XK(e)))}function GQ(n,t,e,i,r,c){j9.call(this,n,t,e,i,r,c?-2:-1)}function zQ(n,t,e,i){LI.call(this,t,e),this.b=n,this.a=i}function UQ(n,t){new YT,this.a=new km,this.b=n,this.c=t}function XQ(n,t){return BB(mMn(n,(hWn(),clt)),15).Fc(t),t}function WQ(n,t){if(null==n)throw Hp(new Hy(t));return n}function VQ(n){return!n.q&&(n.q=new eU(QAt,n,11,10)),n.q}function QQ(n){return!n.s&&(n.s=new eU(FAt,n,21,17)),n.s}function YQ(n){return!n.a&&(n.a=new eU(UOt,n,10,11)),n.a}function JQ(n){return cL(n,14)?new $q(BB(n,14)):qB(n.Kc())}function ZQ(n){return new qL(n,n.e.Hd().gc()*n.c.Hd().gc())}function nY(n){return new GL(n,n.e.Hd().gc()*n.c.Hd().gc())}function tY(n){return n&&n.hashCode?n.hashCode():PN(n)}function eY(n,t){return null==t?!!AY(n.f,null):MG(n.g,t)}function iY(n){return yX(n),emn(new oz(ZL(n.a.Kc(),new h)))}function rY(n){return SQ(),cL(n,54)?new $k(n):new bN(n)}function cY(n,t,e){return!!n.f&&n.f.Ne(t,e)}function aY(n,t){return n.a=fx(n.a,0,t)+""+nO(n.a,t+1),n}function uY(n,t){var e;return(e=eL(n.a,t))&&(t.d=null),e}function oY(n){var t,e;t=0|(e=n).$modCount,e.$modCount=t+1}function sY(n){this.b=n,this.c=n,n.e=null,n.c=null,this.a=1}function hY(n){this.b=n,this.a=new dE(BB(yX(new tt),62))}function fY(n){this.c=n,this.b=new dE(BB(yX(new vn),62))}function lY(n){this.c=n,this.b=new dE(BB(yX(new It),62))}function bY(){this.a=new Qv,this.b=new hm,this.d=new Dt}function wY(){this.a=new km,this.b=(lin(3,AVn),new J6(3))}function dY(){this.b=new Rv,this.d=new YT,this.e=new om}function gY(n){this.c=n.c,this.d=n.d,this.b=n.b,this.a=n.a}function pY(n,t){zm.call(this,new Wz(n)),this.a=n,this.b=t}function vY(){iSn(this,new Rf),this.wb=(QX(),t$t),iE()}function mY(n){OTn(n,"No crossing minimization",1),HSn(n)}function yY(n){Dk(),e.setTimeout((function(){throw n}),0)}function kY(n){return n.u||(P5(n),n.u=new uR(n,n)),n.u}function jY(n){return BB(yan(n,16),26)||n.zh()}function EY(n,t){return cL(t,146)&&mK(n.b,BB(t,146).tg())}function TY(n,t){return n.a?t.Wg().Kc():BB(t.Wg(),69).Zh()}function MY(n){return n.k==(uSn(),Cut)&&Lx(n,(hWn(),zft))}function SY(n){this.a=(SQ(),cL(n,54)?new $k(n):new bN(n))}function PY(){var n,t;PY=O,t=!Ddn(),n=new d,ett=t?new E:n}function CY(n,t){var e;return e=nE(n.gm),null==t?e:e+": "+t}function IY(n,t){var e;return j4(e=n.b.Qc(t),n.b.gc()),e}function OY(n,t){if(null==n)throw Hp(new Hy(t));return n}function AY(n,t){return hhn(n,t,pZ(n,null==t?0:n.b.se(t)))}function $Y(n,t,e){return e>=0&&mK(n.substr(e,t.length),t)}function LY(n,t,e,i,r,c,a){return new b4(n.e,t,e,i,r,c,a)}function NY(n,t,e,i,r,c){this.a=n,kin.call(this,t,e,i,r,c)}function xY(n,t,e,i,r,c){this.a=n,kin.call(this,t,e,i,r,c)}function DY(n,t){this.g=n,this.d=Pun(Gk(Out,1),a1n,10,0,[t])}function RY(n,t){this.e=n,this.a=Ant,this.b=ARn(t),this.c=t}function KY(n,t){NR.call(this),xtn(this),this.a=n,this.c=t}function _Y(n,t,e,i){$X(n.c[t.g],e.g,i),$X(n.c[e.g],t.g,i)}function FY(n,t,e,i){$X(n.c[t.g],t.g,e),$X(n.b[t.g],t.g,i)}function BY(){return A6(),Pun(Gk(cmt,1),$Vn,376,0,[Zvt,Jvt])}function HY(){return g7(),Pun(Gk(Zht,1),$Vn,479,0,[Ght,qht])}function qY(){return _nn(),Pun(Gk(Lht,1),$Vn,419,0,[Sht,Pht])}function GY(){return V8(),Pun(Gk(lht,1),$Vn,422,0,[cht,aht])}function zY(){return z2(),Pun(Gk(Glt,1),$Vn,420,0,[Aft,$ft])}function UY(){return U7(),Pun(Gk(zvt,1),$Vn,421,0,[Kvt,_vt])}function XY(){return Q4(),Pun(Gk(Vmt,1),$Vn,523,0,[Hmt,Bmt])}function WY(){return O6(),Pun(Gk(xyt,1),$Vn,520,0,[Myt,Tyt])}function VY(){return gJ(),Pun(Gk(ayt,1),$Vn,516,0,[tyt,nyt])}function QY(){return oZ(),Pun(Gk(Syt,1),$Vn,515,0,[ryt,cyt])}function YY(){return dJ(),Pun(Gk(Byt,1),$Vn,455,0,[Lyt,Nyt])}function JY(){return B0(),Pun(Gk(Jkt,1),$Vn,425,0,[Hkt,Bkt])}function ZY(){return sZ(),Pun(Gk(qkt,1),$Vn,480,0,[Rkt,Kkt])}function nJ(){return Prn(),Pun(Gk(ijt,1),$Vn,495,0,[Qkt,Ykt])}function tJ(){return D9(),Pun(Gk(ljt,1),$Vn,426,0,[cjt,ajt])}function eJ(){return Lun(),Pun(Gk(YTt,1),$Vn,429,0,[WTt,XTt])}function iJ(){return $6(),Pun(Gk(oTt,1),$Vn,430,0,[nTt,ZEt])}function rJ(){return hpn(),Pun(Gk(yit,1),$Vn,428,0,[dit,wit])}function cJ(){return Rnn(),Pun(Gk(Kit,1),$Vn,427,0,[vit,mit])}function aJ(){return Knn(),Pun(Gk($at,1),$Vn,424,0,[Dct,Rct])}function uJ(){return Srn(),Pun(Gk(Wut,1),$Vn,511,0,[qut,Hut])}function oJ(n,t,e,i){return e>=0?n.jh(t,e,i):n.Sg(null,e,i)}function sJ(n){return 0==n.b.b?n.a.$e():dH(n.b)}function hJ(n){if(5!=n.p)throw Hp(new dv);return dG(n.f)}function fJ(n){if(5!=n.p)throw Hp(new dv);return dG(n.k)}function lJ(n){return GI(n.a)===GI((wcn(),I$t))&&Rqn(n),n.a}function bJ(n){this.a=BB(yX(n),271),this.b=(SQ(),new dN(n))}function wJ(n,t){Zl(this,new xC(n.a,n.b)),nb(this,zB(t))}function dJ(){dJ=O,Lyt=new oC(cJn,0),Nyt=new oC(aJn,1)}function gJ(){gJ=O,tyt=new cC(aJn,0),nyt=new cC(cJn,1)}function pJ(){ay.call(this,new XT(etn(12))),aN(!0),this.a=2}function vJ(n,t,e){wWn(),Ap.call(this,n),this.b=t,this.a=e}function mJ(n,t,e){f$(),jp.call(this,t),this.a=n,this.b=e}function yJ(n){NR.call(this),xtn(this),this.a=n,this.c=!0}function kJ(n){var t;t=n.c.d.b,n.b=t,n.a=n.c.d,t.a=n.c.d.b=n}function jJ(n){pin(n.a),RA(n.a),twn(new Pw(n.a))}function EJ(n,t){oRn(n,!0),Otn(n.e.wf(),new $_(n,!0,t))}function TJ(n,t){return c4(t),Yen(n,x8(ANt,hQn,25,t,15,1),t)}function MJ(n,t){return MQ(),n==JJ(PMn(t))||n==JJ(OMn(t))}function SJ(n,t){return null==t?qI(AY(n.f,null)):hS(n.g,t)}function PJ(n){return 0==n.b?null:(Px(0!=n.b),Atn(n,n.a.a))}function CJ(n){return 0|Math.max(Math.min(n,DWn),-2147483648)}function IJ(n,t){var e=Znt[n.charCodeAt(0)];return null==e?n:e}function OJ(n,t){return WQ(n,"set1"),WQ(t,"set2"),new ET(n,t)}function AJ(n,t){return UR(qx(nen(n.f,t)),n.f.d)}function $J(n,t){var e;return YGn(n,t,e=new q),e.d}function LJ(n,t,e,i){var r;r=new FR,t.a[e.g]=r,mG(n.b,i,r)}function NJ(n,t,e){var i;(i=n.Yg(t))>=0?n.sh(i,e):TLn(n,t,e)}function xJ(n,t,e){hZ(),n&&VW(fAt,n,t),n&&VW(hAt,n,e)}function DJ(n,t,e){this.i=new Np,this.b=n,this.g=t,this.a=e}function RJ(n,t,e){this.c=new Np,this.e=n,this.f=t,this.b=e}function KJ(n,t,e){this.a=new Np,this.e=n,this.f=t,this.c=e}function _J(n,t){V$(this),this.f=t,this.g=n,jQ(this),this._d()}function FJ(n,t){var e;e=n.q.getHours(),n.q.setDate(t),lBn(n,e)}function BJ(n,t){var e;for(yX(t),e=n.a;e;e=e.c)t.Od(e.g,e.i)}function HJ(n){var t;return $on(t=new bE(etn(n.length)),n),t}function qJ(n){function t(){}return t.prototype=n||{},new t}function GJ(n,t){return!!wun(n,t)&&(ein(n),!0)}function zJ(n,t){if(null==t)throw Hp(new gv);return ugn(n,t)}function UJ(n){if(n.qe())return null;var t=n.n;return SWn[t]}function XJ(n){return n.Db>>16!=3?null:BB(n.Cb,33)}function WJ(n){return n.Db>>16!=9?null:BB(n.Cb,33)}function VJ(n){return n.Db>>16!=6?null:BB(n.Cb,79)}function QJ(n){return n.Db>>16!=7?null:BB(n.Cb,235)}function YJ(n){return n.Db>>16!=7?null:BB(n.Cb,160)}function JJ(n){return n.Db>>16!=11?null:BB(n.Cb,33)}function ZJ(n,t){var e;return(e=n.Yg(t))>=0?n.lh(e):qIn(n,t)}function nZ(n,t){var e;return oMn(e=new Lq(t),n),new t_(e)}function tZ(n){var t;return t=n.d,t=n.si(n.f),f9(n,t),t.Ob()}function eZ(n,t){return n.b+=t.b,n.c+=t.c,n.d+=t.d,n.a+=t.a,n}function iZ(n,t){return e.Math.abs(n)<e.Math.abs(t)?n:t}function rZ(n){return!n.a&&(n.a=new eU(UOt,n,10,11)),n.a.i>0}function cZ(){this.a=new fA,this.e=new Rv,this.g=0,this.i=0}function aZ(n){this.a=n,this.b=x8(_mt,sVn,1944,n.e.length,0,2)}function uZ(n,t,e){var i;i=Non(n,t,e),n.b=new mrn(i.c.length)}function oZ(){oZ=O,ryt=new rC(pJn,0),cyt=new rC("UP",1)}function sZ(){sZ=O,Rkt=new bC(U3n,0),Kkt=new bC("FAN",1)}function hZ(){hZ=O,fAt=new xp,hAt=new xp,FI(yet,new wo)}function fZ(n){if(0!=n.p)throw Hp(new dv);return JI(n.f,0)}function lZ(n){if(0!=n.p)throw Hp(new dv);return JI(n.k,0)}function bZ(n){return n.Db>>16!=3?null:BB(n.Cb,147)}function wZ(n){return n.Db>>16!=6?null:BB(n.Cb,235)}function dZ(n){return n.Db>>16!=17?null:BB(n.Cb,26)}function gZ(n,t){var e=n.a=n.a||[];return e[t]||(e[t]=n.le(t))}function pZ(n,t){var e;return null==(e=n.a.get(t))?new Array:e}function vZ(n,t){var e;e=n.q.getHours(),n.q.setMonth(t),lBn(n,e)}function mZ(n,t,e){return null==t?jCn(n.f,null,e):ubn(n.g,t,e)}function yZ(n,t,e,i,r,c){return new N7(n.e,t,n.aj(),e,i,r,c)}function kZ(n,t,e){return n.a=fx(n.a,0,t)+""+e+nO(n.a,t),n}function jZ(n,t,e){return WB(n.a,(nV(),zvn(t,e),new vT(t,e))),n}function EZ(n){return oN(n.c),n.e=n.a=n.c,n.c=n.c.c,++n.d,n.a.f}function TZ(n){return oN(n.e),n.c=n.a=n.e,n.e=n.e.e,--n.d,n.a.f}function MZ(n,t){n.d&&y7(n.d.e,n),n.d=t,n.d&&WB(n.d.e,n)}function SZ(n,t){n.c&&y7(n.c.g,n),n.c=t,n.c&&WB(n.c.g,n)}function PZ(n,t){n.c&&y7(n.c.a,n),n.c=t,n.c&&WB(n.c.a,n)}function CZ(n,t){n.i&&y7(n.i.j,n),n.i=t,n.i&&WB(n.i.j,n)}function IZ(n,t,e){this.a=t,this.c=n,this.b=(yX(e),new t_(e))}function OZ(n,t,e){this.a=t,this.c=n,this.b=(yX(e),new t_(e))}function AZ(n,t){this.a=n,this.c=B$(this.a),this.b=new gY(t)}function $Z(n){return Qln(n),AV(n,new vw(new Rv))}function LZ(n,t){if(n<0||n>t)throw Hp(new Ay(jYn+n+EYn+t))}function NZ(n,t){return IG(n.a,t)?EU(n,BB(t,22).g,null):null}function xZ(n){return Shn(),hN(),0!=BB(n.a,81).d.e}function DZ(){DZ=O,Xnt=lhn((ry(),Pun(Gk(Wnt,1),$Vn,538,0,[znt])))}function RZ(){RZ=O,pmt=WG(new B2,(yMn(),Bat),(lWn(),qot))}function KZ(){KZ=O,vmt=WG(new B2,(yMn(),Bat),(lWn(),qot))}function _Z(){_Z=O,ymt=WG(new B2,(yMn(),Bat),(lWn(),qot))}function FZ(){FZ=O,zmt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function BZ(){BZ=O,Qmt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function HZ(){HZ=O,Zmt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function qZ(){qZ=O,oyt=dq(new B2,(yMn(),Bat),(lWn(),dot))}function GZ(){GZ=O,zkt=WG(new B2,(zyn(),Fyt),(DPn(),zyt))}function zZ(n,t,e,i){this.c=n,this.d=i,WZ(this,t),VZ(this,e)}function UZ(n){this.c=new YT,this.b=n.b,this.d=n.c,this.a=n.a}function XZ(n){this.a=e.Math.cos(n),this.b=e.Math.sin(n)}function WZ(n,t){n.a&&y7(n.a.k,n),n.a=t,n.a&&WB(n.a.k,n)}function VZ(n,t){n.b&&y7(n.b.f,n),n.b=t,n.b&&WB(n.b.f,n)}function QZ(n,t){iW(n,n.b,n.c),BB(n.b.b,65),t&&BB(t.b,65).b}function YZ(n,t){zln(n,t),cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),2)}function JZ(n,t){cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),4),Nrn(n,t)}function ZZ(n,t){cL(n.Cb,179)&&(BB(n.Cb,179).tb=null),Nrn(n,t)}function n1(n,t){return ZM(),hnn(t)?new lq(t,n):new xI(t,n)}function t1(n,t){null!=t.c&&nW(n,new GX(t.c))}function e1(n){var t;return iE(),cen(t=new Kp,n),t}function i1(n){var t;return iE(),cen(t=new Kp,n),t}function r1(n,t){var e;return e=new HX(n),t.c[t.c.length]=e,e}function c1(n,t){var e;return(e=BB(lfn(OQ(n.a),t),14))?e.gc():0}function a1(n){return Qln(n),PQ(),PQ(),ytn(n,det)}function u1(n){for(var t;;)if(t=n.Pb(),!n.Ob())return t}function o1(n,t){Um.call(this,new XT(etn(n))),lin(t,oVn),this.a=t}function s1(n,t,e){Hfn(t,e,n.gc()),this.c=n,this.a=t,this.b=e-t}function h1(n,t,e){var i;Hfn(t,e,n.c.length),i=e-t,PE(n.c,t,i)}function f1(n,t){hL(n,dG(e0(kz(t,24),sYn)),dG(e0(t,sYn)))}function l1(n,t){if(n<0||n>=t)throw Hp(new Ay(jYn+n+EYn+t))}function b1(n,t){if(n<0||n>=t)throw Hp(new Ok(jYn+n+EYn+t))}function w1(n,t){this.b=(kW(n),n),this.a=0==(t&_Qn)?64|t|hVn:t}function d1(n){DA(this),Pv(this.a,kon(e.Math.max(8,n))<<1)}function g1(n){return Aon(Pun(Gk(PMt,1),sVn,8,0,[n.i.n,n.n,n.a]))}function p1(){return qsn(),Pun(Gk(nit,1),$Vn,132,0,[zet,Uet,Xet])}function v1(){return Dtn(),Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])}function m1(){return J9(),Pun(Gk(ert,1),$Vn,461,0,[Yit,Qit,Jit])}function y1(){return G7(),Pun(Gk(Ort,1),$Vn,462,0,[crt,rrt,irt])}function k1(){return Bfn(),Pun(Gk(mut,1),$Vn,423,0,[wut,but,lut])}function j1(){return q7(),Pun(Gk(Hat,1),$Vn,379,0,[Oat,Iat,Aat])}function E1(){return Mhn(),Pun(Gk(wvt,1),$Vn,378,0,[cvt,avt,uvt])}function T1(){return Oin(),Pun(Gk(pht,1),$Vn,314,0,[hht,sht,fht])}function M1(){return uin(),Pun(Gk(Tht,1),$Vn,337,0,[wht,ght,dht])}function S1(){return Jun(),Pun(Gk(Bht,1),$Vn,450,0,[Aht,Oht,$ht])}function P1(){return Crn(),Pun(Gk(Wst,1),$Vn,361,0,[Rst,Dst,xst])}function C1(){return z7(),Pun(Gk(Lft,1),$Vn,303,0,[Pft,Cft,Sft])}function I1(){return Kan(),Pun(Gk(Ift,1),$Vn,292,0,[jft,Eft,kft])}function O1(){return ain(),Pun(Gk(Qvt,1),$Vn,452,0,[Gvt,Hvt,qvt])}function A1(){return mon(),Pun(Gk(Fvt,1),$Vn,339,0,[Nvt,Lvt,xvt])}function $1(){return Hcn(),Pun(Gk(nmt,1),$Vn,375,0,[Xvt,Wvt,Vvt])}function L1(){return $un(),Pun(Gk(Smt,1),$Vn,377,0,[bmt,wmt,lmt])}function N1(){return Usn(),Pun(Gk(hmt,1),$Vn,336,0,[emt,imt,rmt])}function x1(){return dcn(),Pun(Gk(dmt,1),$Vn,338,0,[smt,umt,omt])}function D1(){return oin(),Pun(Gk(xmt,1),$Vn,454,0,[Omt,Amt,$mt])}function R1(){return Cbn(),Pun(Gk(ujt,1),$Vn,442,0,[ejt,njt,tjt])}function K1(){return Hsn(),Pun(Gk(Gjt,1),$Vn,380,0,[sjt,hjt,fjt])}function _1(){return Sbn(),Pun(Gk(NEt,1),$Vn,381,0,[Zjt,nEt,Jjt])}function F1(){return Bcn(),Pun(Gk(Yjt,1),$Vn,293,0,[Xjt,Wjt,Ujt])}function B1(){return Pbn(),Pun(Gk(WEt,1),$Vn,437,0,[HEt,qEt,GEt])}function H1(){return ufn(),Pun(Gk(SCt,1),$Vn,334,0,[vCt,pCt,mCt])}function q1(){return Rtn(),Pun(Gk(nCt,1),$Vn,272,0,[zPt,UPt,XPt])}function G1(n,t){return k$n(n,t,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function z1(n,t,e){var i;return(i=cHn(n,t,!1)).b<=t&&i.a<=e}function U1(n,t,e){var i;(i=new ca).b=t,i.a=e,++t.b,WB(n.d,i)}function X1(n,t){var e;return Tx(!!(e=(kW(n),n).g)),kW(t),e(t)}function W1(n,t){var e,i;return i=pU(n,t),e=n.a.Zc(i),new kT(n,e)}function V1(n){return n.Db>>16!=6?null:BB(cAn(n),235)}function Q1(n){if(2!=n.p)throw Hp(new dv);return dG(n.f)&QVn}function Y1(n){if(2!=n.p)throw Hp(new dv);return dG(n.k)&QVn}function J1(n){return n.a==(R5(),eLt)&&db(n,eLn(n.g,n.b)),n.a}function Z1(n){return n.d==(R5(),eLt)&&pb(n,NKn(n.g,n.b)),n.d}function n0(n){return Px(n.a<n.c.c.length),n.b=n.a++,n.c.c[n.b]}function t0(n,t){n.b=n.b|t.b,n.c=n.c|t.c,n.d=n.d|t.d,n.a=n.a|t.a}function e0(n,t){return uan(Sz(JO(n)?Pan(n):n,JO(t)?Pan(t):t))}function i0(n,t){return uan(Pz(JO(n)?Pan(n):n,JO(t)?Pan(t):t))}function r0(n,t){return uan(Cz(JO(n)?Pan(n):n,JO(t)?Pan(t):t))}function c0(n){return rbn(yz(fan(H$n(n,32)),32),fan(H$n(n,32)))}function a0(n){return yX(n),cL(n,14)?new t_(BB(n,14)):HB(n.Kc())}function u0(n,t){return Dnn(),n.c==t.c?Pln(t.d,n.d):Pln(n.c,t.c)}function o0(n,t){return Dnn(),n.c==t.c?Pln(n.d,t.d):Pln(n.c,t.c)}function s0(n,t){return Dnn(),n.c==t.c?Pln(n.d,t.d):Pln(t.c,n.c)}function h0(n,t){return Dnn(),n.c==t.c?Pln(t.d,n.d):Pln(t.c,n.c)}function f0(n,t){var e;e=Gy(MD(n.a.We((sWn(),OPt)))),VUn(n,t,e)}function l0(n,t){var e;e=BB(RX(n.g,t),57),Otn(t.d,new oP(n,e))}function b0(n,t){var e,i;return(e=oyn(n))<(i=oyn(t))?-1:e>i?1:0}function w0(n,t){var e;return e=S7(t),BB(RX(n.c,e),19).a}function d0(n,t){var e;for(e=n+"";e.length<t;)e="0"+e;return e}function g0(n){return null==n.c||0==n.c.length?"n_"+n.g:"n_"+n.c}function p0(n){return null==n.c||0==n.c.length?"n_"+n.b:"n_"+n.c}function v0(n,t){return n&&n.equals?n.equals(t):GI(n)===GI(t)}function m0(n,t){return 0==t?!!n.o&&0!=n.o.f:vpn(n,t)}function y0(n,t,e){var i;n.n&&t&&e&&(i=new Zu,WB(n.e,i))}function k0(n,t,e){var i;i=n.d[t.p],n.d[t.p]=n.d[e.p],n.d[e.p]=i}function j0(n,t,e){this.d=n,this.j=t,this.e=e,this.o=-1,this.p=3}function E0(n,t,e){this.d=n,this.k=t,this.f=e,this.o=-1,this.p=5}function T0(n,t,e){Ap.call(this,25),this.b=n,this.a=t,this.c=e}function M0(n){wWn(),Ap.call(this,n),this.c=!1,this.a=!1}function S0(n,t,e,i,r,c){Hen.call(this,n,t,e,i,r),c&&(this.o=-2)}function P0(n,t,e,i,r,c){qen.call(this,n,t,e,i,r),c&&(this.o=-2)}function C0(n,t,e,i,r,c){J5.call(this,n,t,e,i,r),c&&(this.o=-2)}function I0(n,t,e,i,r,c){Uen.call(this,n,t,e,i,r),c&&(this.o=-2)}function O0(n,t,e,i,r,c){Z5.call(this,n,t,e,i,r),c&&(this.o=-2)}function A0(n,t,e,i,r,c){Gen.call(this,n,t,e,i,r),c&&(this.o=-2)}function $0(n,t,e,i,r,c){zen.call(this,n,t,e,i,r),c&&(this.o=-2)}function L0(n,t,e,i,r,c){n6.call(this,n,t,e,i,r),c&&(this.o=-2)}function N0(n,t,e,i){jp.call(this,e),this.b=n,this.c=t,this.d=i}function x0(n,t){this.a=new Np,this.d=new Np,this.f=n,this.c=t}function D0(){this.c=new $$,this.a=new bY,this.b=new em,bM()}function R0(){Nun(),this.b=new xp,this.a=new xp,this.c=new Np}function K0(n,t){this.g=n,this.d=(R5(),eLt),this.a=eLt,this.b=t}function _0(n,t){this.f=n,this.a=(R5(),tLt),this.c=tLt,this.b=t}function F0(n,t){!n.c&&(n.c=new Ecn(n,0)),MHn(n.c,(Uqn(),LLt),t)}function B0(){B0=O,Hkt=new wC("DFS",0),Bkt=new wC("BFS",1)}function H0(n,t,e){var i;return!!(i=BB(n.Zb().xc(t),14))&&i.Hc(e)}function q0(n,t,e){var i;return!!(i=BB(n.Zb().xc(t),14))&&i.Mc(e)}function G0(n,t,e,i){return n.a+=""+fx(null==t?zWn:Bbn(t),e,i),n}function z0(n,t,e,i,r,c){return Rcn(n,t,e,c),Jfn(n,i),tln(n,r),n}function U0(n){return Px(n.b.b!=n.d.a),n.c=n.b=n.b.b,--n.a,n.c.c}function X0(n){for(;n.d>0&&0==n.a[--n.d];);0==n.a[n.d++]&&(n.e=0)}function W0(n){return n.a?0==n.e.length?n.a.a:n.a.a+""+n.e:n.c}function V0(n){return!(!n.a||0==H7(n.a.a).i||n.b&&Kvn(n.b))}function Q0(n){return!(!n.u||0==a4(n.u.a).i||n.n&&Rvn(n.n))}function Y0(n){return yq(n.e.Hd().gc()*n.c.Hd().gc(),16,new zf(n))}function J0(n,t){return FU(fan(n.q.getTime()),fan(t.q.getTime()))}function Z0(n){return BB(Qgn(n,x8(yut,c1n,17,n.c.length,0,1)),474)}function n2(n){return BB(Qgn(n,x8(Out,a1n,10,n.c.length,0,1)),193)}function t2(n){return BZ(),!(b5(n)||!b5(n)&&n.c.i.c==n.d.i.c)}function e2(n,t,e){yX(n),xyn(new IZ(new t_(n),t,e))}function i2(n,t,e){yX(n),Dyn(new OZ(new t_(n),t,e))}function r2(n,t){var e;return e=1-t,n.a[e]=wrn(n.a[e],e),wrn(n,t)}function c2(n,t){var e;n.e=new Jm,m$(e=wDn(t),n.c),IDn(n,e,0)}function a2(n,t,e,i){var r;(r=new vu).a=t,r.b=e,r.c=i,DH(n.a,r)}function u2(n,t,e,i){var r;(r=new vu).a=t,r.b=e,r.c=i,DH(n.b,r)}function o2(n){var t,e;return e=t_n(t=new lX,n),yzn(t),e}function s2(){var n,t;return n=new Kp,WB(V$t,t=n),t}function h2(n){return n.j.c=x8(Ant,HWn,1,0,5,1),TV(n.c),gV(n.a),n}function f2(n){return MM(),cL(n.g,10)?BB(n.g,10):null}function l2(n){return!EV(n).dc()&&(L$(n,new m),!0)}function b2(n){if(!("stack"in n))try{throw n}catch(t){}return n}function w2(n,t){if(n<0||n>=t)throw Hp(new Ay(LCn(n,t)));return n}function d2(n,t,e){if(n<0||t<n||t>e)throw Hp(new Ay(oPn(n,t,e)))}function g2(n,t){if(TU(n.a,t),t.d)throw Hp(new dy(IYn));t.d=n}function p2(n,t){if(t.$modCount!=n.$modCount)throw Hp(new vv)}function v2(n,t){return!!cL(t,42)&&Mmn(n.a,BB(t,42))}function m2(n,t){return!!cL(t,42)&&Mmn(n.a,BB(t,42))}function y2(n,t){return!!cL(t,42)&&Mmn(n.a,BB(t,42))}function k2(n,t){return n.a<=n.b&&(t.ud(n.a++),!0)}function j2(n){var t;return JO(n)?-0==(t=n)?0:t:pnn(n)}function E2(n){var t;return EW(n),t=new F,gE(n.a,new gw(t)),t}function T2(n){var t;return EW(n),t=new _,gE(n.a,new dw(t)),t}function M2(n,t){this.a=n,Sb.call(this,n),LZ(t,n.gc()),this.b=t}function S2(n){this.e=n,this.b=this.e.a.entries(),this.a=new Array}function P2(n){return yq(n.e.Hd().gc()*n.c.Hd().gc(),273,new Gf(n))}function C2(n){return new J6((lin(n,NVn),ttn(rbn(rbn(5,n),n/10|0))))}function I2(n){return BB(Qgn(n,x8(Gut,u1n,11,n.c.length,0,1)),1943)}function O2(n,t,e){return e.f.c.length>0?BU(n.a,t,e):BU(n.b,t,e)}function A2(n,t,e){n.d&&y7(n.d.e,n),n.d=t,n.d&&kG(n.d.e,e,n)}function $2(n,t){vXn(t,n),aH(n.d),aH(BB(mMn(n,(HXn(),Agt)),207))}function L2(n,t){pXn(t,n),cH(n.d),cH(BB(mMn(n,(HXn(),Agt)),207))}function N2(n,t){var e,i;return i=null,(e=zJ(n,t))&&(i=e.fe()),i}function x2(n,t){var e,i;return i=null,(e=dnn(n,t))&&(i=e.ie()),i}function D2(n,t){var e,i;return i=null,(e=zJ(n,t))&&(i=e.ie()),i}function R2(n,t){var e,i;return i=null,(e=zJ(n,t))&&(i=yPn(e)),i}function K2(n,t,e){var i;return i=Qdn(e),wKn(n.g,i,t),wKn(n.i,t,e),t}function _2(n,t,e){var i;i=Ldn();try{return dR(n,t,e)}finally{y3(i)}}function F2(n){var t;t=n.Wg(),this.a=cL(t,69)?BB(t,69).Zh():t.Kc()}function B2(){Ym.call(this),this.j.c=x8(Ant,HWn,1,0,5,1),this.a=-1}function H2(n,t,e,i){this.d=n,this.n=t,this.g=e,this.o=i,this.p=-1}function q2(n,t,e,i){this.e=i,this.d=null,this.c=n,this.a=t,this.b=e}function G2(n,t,e){this.d=new Fd(this),this.e=n,this.i=t,this.f=e}function z2(){z2=O,Aft=new DP(eJn,0),$ft=new DP("TOP_LEFT",1)}function U2(){U2=O,Tmt=JW(iln(1),iln(4)),Emt=JW(iln(1),iln(2))}function X2(){X2=O,JEt=lhn((IM(),Pun(Gk(tTt,1),$Vn,551,0,[QEt])))}function W2(){W2=O,VEt=lhn((CM(),Pun(Gk(YEt,1),$Vn,482,0,[XEt])))}function V2(){V2=O,UTt=lhn((OM(),Pun(Gk(VTt,1),$Vn,530,0,[GTt])))}function Q2(){Q2=O,act=lhn((wM(),Pun(Gk(Pct,1),$Vn,481,0,[rct])))}function Y2(){return Dan(),Pun(Gk(Grt,1),$Vn,406,0,[Rrt,Nrt,xrt,Drt])}function J2(){return Z9(),Pun(Gk(Fet,1),$Vn,297,0,[Net,xet,Det,Ret])}function Z2(){return qpn(),Pun(Gk(cct,1),$Vn,394,0,[Zrt,Jrt,nct,tct])}function n3(){return Hpn(),Pun(Gk(Urt,1),$Vn,323,0,[Brt,Frt,Hrt,qrt])}function t3(){return Aun(),Pun(Gk(dut,1),$Vn,405,0,[Zat,eut,nut,tut])}function e3(){return Iun(),Pun(Gk(pst,1),$Vn,360,0,[ast,rst,cst,ist])}function i3(n,t,e,i){return cL(e,54)?new Ox(n,t,e,i):new sz(n,t,e,i)}function r3(){return Oun(),Pun(Gk(Ist,1),$Vn,411,0,[vst,mst,yst,kst])}function c3(n){return n.j==(kUn(),SIt)&&SN(UOn(n),oIt)}function a3(n,t){var e;SZ(e=t.a,t.c.d),MZ(e,t.d.d),Ztn(e.a,n.n)}function u3(n,t){return BB($N(Iz(BB(h6(n.k,t),15).Oc(),Qst)),113)}function o3(n,t){return BB($N(Oz(BB(h6(n.k,t),15).Oc(),Qst)),113)}function s3(n){return new w1(tcn(BB(n.a.dd(),14).gc(),n.a.cd()),16)}function h3(n){return cL(n,14)?BB(n,14).dc():!n.Kc().Ob()}function f3(n){return MM(),cL(n.g,145)?BB(n.g,145):null}function l3(n){if(n.e.g!=n.b)throw Hp(new vv);return!!n.c&&n.d>0}function b3(n){return Px(n.b!=n.d.c),n.c=n.b,n.b=n.b.a,++n.a,n.c.c}function w3(n,t){kW(t),$X(n.a,n.c,t),n.c=n.c+1&n.a.length-1,wyn(n)}function d3(n,t){kW(t),n.b=n.b-1&n.a.length-1,$X(n.a,n.b,t),wyn(n)}function g3(n,t){var e;for(e=n.j.c.length;e<t;e++)WB(n.j,n.rg())}function p3(n,t,e,i){var r;return r=i[t.g][e.g],Gy(MD(mMn(n.a,r)))}function v3(n,t,e,i,r){this.i=n,this.a=t,this.e=e,this.j=i,this.f=r}function m3(n,t,e,i,r){this.a=n,this.e=t,this.f=e,this.b=i,this.g=r}function y3(n){n&&Inn((sk(),ttt)),--ctt,n&&-1!=utt&&(iS(utt),utt=-1)}function k3(){return bvn(),Pun(Gk(kvt,1),$Vn,197,0,[lvt,bvt,fvt,hvt])}function j3(){return zyn(),Pun(Gk(qyt,1),$Vn,393,0,[Ryt,Kyt,_yt,Fyt])}function E3(){return Omn(),Pun(Gk(Vjt,1),$Vn,340,0,[qjt,Bjt,Hjt,Fjt])}function T3(){return mdn(),Pun(Gk(YIt,1),$Vn,374,0,[KIt,_It,RIt,DIt])}function M3(){return Xyn(),Pun(Gk(RCt,1),$Vn,285,0,[MCt,jCt,ECt,TCt])}function S3(){return Mbn(),Pun(Gk(oCt,1),$Vn,218,0,[ZPt,YPt,QPt,JPt])}function P3(){return Fwn(),Pun(Gk(cOt,1),$Vn,311,0,[eOt,ZIt,tOt,nOt])}function C3(){return Bsn(),Pun(Gk(wOt,1),$Vn,396,0,[uOt,oOt,aOt,sOt])}function I3(n){return hZ(),hU(fAt,n)?BB(RX(fAt,n),331).ug():null}function O3(n,t,e){return t<0?qIn(n,e):BB(e,66).Nj().Sj(n,n.yh(),t)}function A3(n,t,e){var i;return i=Qdn(e),wKn(n.d,i,t),VW(n.e,t,e),t}function $3(n,t,e){var i;return i=Qdn(e),wKn(n.j,i,t),VW(n.k,t,e),t}function L3(n){var t;return tE(),t=new io,n&&HLn(t,n),t}function N3(n){var t;return t=n.ri(n.i),n.i>0&&aHn(n.g,0,t,0,n.i),t}function x3(n,t){var e;return nS(),!(e=BB(RX(mAt,n),55))||e.wj(t)}function D3(n){if(1!=n.p)throw Hp(new dv);return dG(n.f)<<24>>24}function R3(n){if(1!=n.p)throw Hp(new dv);return dG(n.k)<<24>>24}function K3(n){if(7!=n.p)throw Hp(new dv);return dG(n.k)<<16>>16}function _3(n){if(7!=n.p)throw Hp(new dv);return dG(n.f)<<16>>16}function F3(n){var t;for(t=0;n.Ob();)n.Pb(),t=rbn(t,1);return ttn(t)}function B3(n,t){var e;return e=new Ik,n.xd(e),e.a+="..",t.yd(e),e.a}function H3(n,t,e){var i;i=BB(RX(n.g,e),57),WB(n.a.c,new rI(t,i))}function q3(n,t,e){return Tz(MD(qI(AY(n.f,t))),MD(qI(AY(n.f,e))))}function G3(n,t,e){return UFn(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function z3(n,t,e){return pBn(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function U3(n,t,e){return x$n(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn))}function X3(n,t){return n==(uSn(),Cut)&&t==Cut?4:n==Cut||t==Cut?8:32}function W3(n,t){return GI(t)===GI(n)?"(this Map)":null==t?zWn:Bbn(t)}function V3(n,t){return BB(null==t?qI(AY(n.f,null)):hS(n.g,t),281)}function Q3(n,t,e){var i;return i=Qdn(e),VW(n.b,i,t),VW(n.c,t,e),t}function Y3(n,t){var e;for(e=t;e;)_x(n,e.i,e.j),e=JJ(e);return n}function J3(n,t){var e;return e=rY(HB(new C7(n,t))),Cq(new C7(n,t)),e}function Z3(n,t){var e;return ZM(),TSn(e=BB(n,66).Mj(),t),e.Ok(t)}function n4(n,t,e,i,r){WB(t,mCn(r,X$n(r,e,i))),UMn(n,r,t)}function t4(n,t,e){n.i=0,n.e=0,t!=e&&(Won(n,t,e),Xon(n,t,e))}function e4(n,t){var e;e=n.q.getHours(),n.q.setFullYear(t+sQn),lBn(n,e)}function i4(n,t,e){if(e){var i=e.ee();n.a[t]=i(e)}else delete n.a[t]}function r4(n,t,e){if(e){var i=e.ee();e=i(e)}else e=void 0;n.a[t]=e}function c4(n){if(n<0)throw Hp(new By("Negative array size: "+n))}function a4(n){return n.n||(P5(n),n.n=new YG(n,VAt,n),kY(n)),n.n}function u4(n){return Px(n.a<n.c.a.length),n.b=n.a,Ann(n),n.c.b[n.b]}function o4(n){n.b!=n.c&&(n.a=x8(Ant,HWn,1,8,5,1),n.b=0,n.c=0)}function s4(n){this.b=new xp,this.c=new xp,this.d=new xp,this.a=n}function h4(n,t){wWn(),Ap.call(this,n),this.a=t,this.c=-1,this.b=-1}function f4(n,t,e,i){j0.call(this,1,e,i),Fh(this),this.c=n,this.b=t}function l4(n,t,e,i){E0.call(this,1,e,i),Fh(this),this.c=n,this.b=t}function b4(n,t,e,i,r,c,a){kin.call(this,t,i,r,c,a),this.c=n,this.a=e}function w4(n,t,e){this.e=n,this.a=Ant,this.b=ARn(t),this.c=t,this.d=e}function d4(n){this.e=n,this.c=this.e.a,this.b=this.e.g,this.d=this.e.i}function g4(n){this.c=n,this.a=BB(Ikn(n),148),this.b=this.a.Aj().Nh()}function p4(n){this.d=n,this.b=this.d.a.entries(),this.a=this.b.next()}function v4(){xp.call(this),jx(this),this.d.b=this.d,this.d.a=this.d}function m4(n,t){$R.call(this),this.a=n,this.b=t,WB(this.a.b,this)}function y4(n,t){return iO(null!=t?SJ(n,t):qI(AY(n.f,t)))}function k4(n,t){return iO(null!=t?SJ(n,t):qI(AY(n.f,t)))}function j4(n,t){var e;for(e=0;e<t;++e)$X(n,e,new Ub(BB(n[e],42)))}function E4(n,t){var e;for(e=n.d-1;e>=0&&n.a[e]===t[e];e--);return e<0}function T4(n,t){var e;return zsn(),0!=(e=n.j.g-t.j.g)?e:0}function M4(n,t){return kW(t),null!=n.a?PG(t.Kb(n.a)):Set}function S4(n){var t;return n?new Lq(n):(qrn(t=new fA,n),t)}function P4(n,t){return t.b.Kb(T7(n,t.c.Ee(),new yw(t)))}function C4(n){yTn(),hL(this,dG(e0(kz(n,24),sYn)),dG(e0(n,sYn)))}function I4(){I4=O,pit=lhn((hpn(),Pun(Gk(yit,1),$Vn,428,0,[dit,wit])))}function O4(){O4=O,kit=lhn((Rnn(),Pun(Gk(Kit,1),$Vn,427,0,[vit,mit])))}function A4(){A4=O,_ct=lhn((Knn(),Pun(Gk($at,1),$Vn,424,0,[Dct,Rct])))}function $4(){$4=O,zut=lhn((Srn(),Pun(Gk(Wut,1),$Vn,511,0,[qut,Hut])))}function L4(){L4=O,Iht=lhn((_nn(),Pun(Gk(Lht,1),$Vn,419,0,[Sht,Pht])))}function N4(){N4=O,Uht=lhn((g7(),Pun(Gk(Zht,1),$Vn,479,0,[Ght,qht])))}function x4(){x4=O,tmt=lhn((A6(),Pun(Gk(cmt,1),$Vn,376,0,[Zvt,Jvt])))}function D4(){D4=O,Bvt=lhn((U7(),Pun(Gk(zvt,1),$Vn,421,0,[Kvt,_vt])))}function R4(){R4=O,oht=lhn((V8(),Pun(Gk(lht,1),$Vn,422,0,[cht,aht])))}function K4(){K4=O,Nft=lhn((z2(),Pun(Gk(Glt,1),$Vn,420,0,[Aft,$ft])))}function _4(){_4=O,Pyt=lhn((O6(),Pun(Gk(xyt,1),$Vn,520,0,[Myt,Tyt])))}function F4(){F4=O,Gmt=lhn((Q4(),Pun(Gk(Vmt,1),$Vn,523,0,[Hmt,Bmt])))}function B4(){B4=O,iyt=lhn((gJ(),Pun(Gk(ayt,1),$Vn,516,0,[tyt,nyt])))}function H4(){H4=O,uyt=lhn((oZ(),Pun(Gk(Syt,1),$Vn,515,0,[ryt,cyt])))}function q4(){q4=O,Dyt=lhn((dJ(),Pun(Gk(Byt,1),$Vn,455,0,[Lyt,Nyt])))}function G4(){G4=O,Gkt=lhn((B0(),Pun(Gk(Jkt,1),$Vn,425,0,[Hkt,Bkt])))}function z4(){z4=O,Zkt=lhn((Prn(),Pun(Gk(ijt,1),$Vn,495,0,[Qkt,Ykt])))}function U4(){U4=O,Fkt=lhn((sZ(),Pun(Gk(qkt,1),$Vn,480,0,[Rkt,Kkt])))}function X4(){X4=O,ojt=lhn((D9(),Pun(Gk(ljt,1),$Vn,426,0,[cjt,ajt])))}function W4(){W4=O,QTt=lhn((Lun(),Pun(Gk(YTt,1),$Vn,429,0,[WTt,XTt])))}function V4(){V4=O,eTt=lhn(($6(),Pun(Gk(oTt,1),$Vn,430,0,[nTt,ZEt])))}function Q4(){Q4=O,Hmt=new JP("UPPER",0),Bmt=new JP("LOWER",1)}function Y4(n,t){var e;qQ(e=new py,"x",t.a),qQ(e,"y",t.b),nW(n,e)}function J4(n,t){var e;qQ(e=new py,"x",t.a),qQ(e,"y",t.b),nW(n,e)}function Z4(n,t){var e,i;i=!1;do{i|=e=bon(n,t)}while(e);return i}function n5(n,t){var e,i;for(e=t,i=0;e>0;)i+=n.a[e],e-=e&-e;return i}function t5(n,t){var e;for(e=t;e;)_x(n,-e.i,-e.j),e=JJ(e);return n}function e5(n,t){var e,i;for(kW(t),i=n.Kc();i.Ob();)e=i.Pb(),t.td(e)}function i5(n,t){var e;return new vT(e=t.cd(),n.e.pc(e,BB(t.dd(),14)))}function r5(n,t,e,i){var r;(r=new $).c=t,r.b=e,r.a=i,i.b=e.a=r,++n.b}function c5(n,t,e){var i;return l1(t,n.c.length),i=n.c[t],n.c[t]=e,i}function a5(n,t,e){return BB(null==t?jCn(n.f,null,e):ubn(n.g,t,e),281)}function u5(n){return n.c&&n.d?p0(n.c)+"->"+p0(n.d):"e_"+PN(n)}function o5(n,t){return(Qln(n),jE(new Rq(n,new Q9(t,n.a)))).sd(tit)}function s5(){return yMn(),Pun(Gk(Uat,1),$Vn,356,0,[Rat,Kat,_at,Fat,Bat])}function h5(){return kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])}function f5(n){return Dk(),function(){return _2(n,this,arguments)}}function l5(){return Date.now?Date.now():(new Date).getTime()}function b5(n){return!(!n.c||!n.d||!n.c.i||n.c.i!=n.d.i)}function w5(n){if(!n.c.Sb())throw Hp(new yv);return n.a=!0,n.c.Ub()}function d5(n){n.i=0,yS(n.b,null),yS(n.c,null),n.a=null,n.e=null,++n.g}function g5(n){dS.call(this,null==n?zWn:Bbn(n),cL(n,78)?BB(n,78):null)}function p5(n){eWn(),Bp(this),this.a=new YT,dsn(this,n),DH(this.a,n)}function v5(){xA(this),this.b=new xC(RQn,RQn),this.a=new xC(KQn,KQn)}function m5(n,t){this.c=0,this.b=t,pO.call(this,n,17493),this.a=this.c}function y5(n){k5(),Qet||(this.c=n,this.e=!0,this.a=new Np)}function k5(){k5=O,Qet=!0,Wet=!1,Vet=!1,Jet=!1,Yet=!1}function j5(n,t){return!!cL(t,149)&&mK(n.c,BB(t,149).c)}function E5(n,t){var e;return e=0,n&&(e+=n.f.a/2),t&&(e+=t.f.a/2),e}function T5(n,t){return BB(lnn(n.d,t),23)||BB(lnn(n.e,t),23)}function M5(n){this.b=n,AL.call(this,n),this.a=BB(yan(this.b.a,4),126)}function S5(n){this.b=n,ax.call(this,n),this.a=BB(yan(this.b.a,4),126)}function P5(n){return n.t||(n.t=new dp(n),sln(new xy(n),0,n.t)),n.t}function C5(){return Ffn(),Pun(Gk(WPt,1),$Vn,103,0,[BPt,FPt,_Pt,KPt,HPt])}function I5(){return cpn(),Pun(Gk(JCt,1),$Vn,249,0,[BCt,qCt,_Ct,FCt,HCt])}function O5(){return rpn(),Pun(Gk(jMt,1),$Vn,175,0,[hMt,sMt,uMt,fMt,oMt])}function A5(){return $Sn(),Pun(Gk(zTt,1),$Vn,316,0,[iTt,rTt,uTt,cTt,aTt])}function $5(){return Nvn(),Pun(Gk(Avt,1),$Vn,315,0,[yvt,pvt,vvt,gvt,mvt])}function L5(){return Vvn(),Pun(Gk(Cht,1),$Vn,335,0,[yht,mht,jht,Eht,kht])}function N5(){return YLn(),Pun(Gk(zEt,1),$Vn,355,0,[DEt,xEt,KEt,REt,_Et])}function x5(){return LEn(),Pun(Gk(Kst,1),$Vn,363,0,[Mst,Pst,Cst,Sst,Tst])}function D5(){return Tbn(),Pun(Gk(ivt,1),$Vn,163,0,[qlt,_lt,Flt,Blt,Hlt])}function R5(){var n,t;R5=O,iE(),t=new Ev,tLt=t,n=new Om,eLt=n}function K5(n){var t;return n.c||cL(t=n.r,88)&&(n.c=BB(t,26)),n.c}function _5(n){return n.e=3,n.d=n.Yb(),2!=n.e&&(n.e=0,!0)}function F5(n){return M$(n&SQn,n>>22&SQn,n<0?PQn:0)}function B5(n){var t,e,i;for(e=0,i=(t=n).length;e<i;++e)jW(t[e])}function H5(n,t){var e,i;(e=BB(bfn(n.c,t),14))&&(i=e.gc(),e.$b(),n.d-=i)}function q5(n,t){var e;return!!(e=lsn(n,t.cd()))&&cV(e.e,t.dd())}function G5(n,t){return 0==t||0==n.e?n:t>0?Edn(n,t):Ixn(n,-t)}function z5(n,t){return 0==t||0==n.e?n:t>0?Ixn(n,t):Edn(n,-t)}function U5(n){if(dAn(n))return n.c=n.a,n.a.Pb();throw Hp(new yv)}function X5(n){var t,e;return t=n.c.i,e=n.d.i,t.k==(uSn(),Mut)&&e.k==Mut}function W5(n){var t;return qan(t=new wY,n),hon(t,(HXn(),vgt),null),t}function V5(n,t,e){var i;return(i=n.Yg(t))>=0?n._g(i,e,!0):cOn(n,t,e)}function Q5(n,t,e,i){var r;for(r=0;r<Zit;r++)XG(n.a[t.g][r],e,i[t.g])}function Y5(n,t,e,i){var r;for(r=0;r<nrt;r++)UG(n.a[r][t.g],e,i[t.g])}function J5(n,t,e,i,r){j0.call(this,t,i,r),Fh(this),this.c=n,this.a=e}function Z5(n,t,e,i,r){E0.call(this,t,i,r),Fh(this),this.c=n,this.a=e}function n6(n,t,e,i,r){i6.call(this,t,i,r),Fh(this),this.c=n,this.a=e}function t6(n,t,e,i,r){i6.call(this,t,i,r),Fh(this),this.c=n,this.b=e}function e6(n,t,e){jp.call(this,e),this.b=n,this.c=t,this.d=(Bwn(),z$t)}function i6(n,t,e){this.d=n,this.k=t?1:0,this.f=e?1:0,this.o=-1,this.p=0}function r6(n,t,e){var i;Tcn(i=new X$(n.a),n.a.a),jCn(i.f,t,e),n.a.a=i}function c6(n,t){n.qi(n.i+1),jL(n,n.i,n.oi(n.i,t)),n.bi(n.i++,t),n.ci()}function a6(n){var t,e;++n.j,t=n.g,e=n.i,n.g=null,n.i=0,n.di(e,t),n.ci()}function u6(n){var t;return yX(n),$on(t=new J6(ZW(n.length)),n),t}function o6(n){var t;return yX(n),JPn(t=n?new t_(n):HB(n.Kc())),sfn(t)}function s6(n,t){var e;return l1(t,n.c.length),e=n.c[t],PE(n.c,t,1),e}function h6(n,t){var e;return!(e=BB(n.c.xc(t),14))&&(e=n.ic(t)),n.pc(t,e)}function f6(n,t){var e,i;return kW(n),e=n,kW(t),e==(i=t)?0:e<i?-1:1}function l6(n){var t;return t=n.e+n.f,isNaN(t)&&WK(n.d)?n.d:t}function b6(n,t){return n.a?oO(n.a,n.b):n.a=new lN(n.d),aO(n.a,t),n}function w6(n,t){if(n<0||n>t)throw Hp(new Ay(dCn(n,t,"index")));return n}function d6(n,t,e,i){var r;return vTn(r=x8(ANt,hQn,25,t,15,1),n,t,e,i),r}function g6(n,t){var e;e=n.q.getHours()+(t/60|0),n.q.setMinutes(t),lBn(n,e)}function p6(n,t){return e.Math.min(W8(t.a,n.d.d.c),W8(t.b,n.d.d.c))}function v6(n,t){return XI(t)?null==t?gAn(n.f,null):Gan(n.g,t):gAn(n.f,t)}function m6(n){this.c=n,this.a=new Wb(this.c.a),this.b=new Wb(this.c.b)}function y6(){this.e=new Np,this.c=new Np,this.d=new Np,this.b=new Np}function k6(){this.g=new Bv,this.b=new Bv,this.a=new Np,this.k=new Np}function j6(n,t,e){this.a=n,this.c=t,this.d=e,WB(t.e,this),WB(e.b,this)}function E6(n,t){gO.call(this,t.rd(),-6&t.qd()),kW(n),this.a=n,this.b=t}function T6(n,t){pO.call(this,t.rd(),-6&t.qd()),kW(n),this.a=n,this.b=t}function M6(n,t){vO.call(this,t.rd(),-6&t.qd()),kW(n),this.a=n,this.b=t}function S6(n,t,e){this.a=n,this.b=t,this.c=e,WB(n.t,this),WB(t.i,this)}function P6(){this.b=new YT,this.a=new YT,this.b=new YT,this.a=new YT}function C6(){C6=O,TMt=new up("org.eclipse.elk.labels.labelManager")}function I6(){I6=O,est=new iR("separateLayerConnections",(Iun(),ast))}function O6(){O6=O,Myt=new uC("REGULAR",0),Tyt=new uC("CRITICAL",1)}function A6(){A6=O,Zvt=new XP("STACKED",0),Jvt=new XP("SEQUENCED",1)}function $6(){$6=O,nTt=new TC("FIXED",0),ZEt=new TC("CENTER_NODE",1)}function L6(n,t){var e;return e=xGn(n,t),n.b=new mrn(e.c.length),yqn(n,e)}function N6(n,t,e){return++n.e,--n.f,BB(n.d[t].$c(e),133).dd()}function x6(n){var t;return n.a||cL(t=n.r,148)&&(n.a=BB(t,148)),n.a}function D6(n){return n.a?n.e?D6(n.e):null:n}function R6(n,t){return n.p<t.p?1:n.p>t.p?-1:0}function K6(n,t){return kW(t),n.c<n.d&&(n.ze(t,n.c++),!0)}function _6(n,t){return!!hU(n.a,t)&&(v6(n.a,t),!0)}function F6(n){var t;return t=n.cd(),RB(BB(n.dd(),14).Nc(),new Vf(t))}function B6(n){var t;return t=BB(VU(n.b,n.b.length),9),new YK(n.a,t,n.c)}function H6(n){return Qln(n),new AD(n,new ZB(n,n.a.e,4|n.a.d))}function q6(n){var t;for(EW(n),t=0;n.a.sd(new fn);)t=rbn(t,1);return t}function G6(n,t,e){var i,r;for(i=0,r=0;r<t.length;r++)i+=n.$f(t[r],i,e)}function z6(n,t){var e;n.C&&((e=BB(oV(n.b,t),124).n).d=n.C.d,e.a=n.C.a)}function U6(n,t,e){return w2(t,n.e.Hd().gc()),w2(e,n.c.Hd().gc()),n.a[t][e]}function X6(n,t){ODn(),this.e=n,this.d=1,this.a=Pun(Gk(ANt,1),hQn,25,15,[t])}function W6(n,t,e,i){this.f=n,this.e=t,this.d=e,this.b=i,this.c=i?i.d:null}function V6(n){var t,e,i,r;r=n.d,t=n.a,e=n.b,i=n.c,n.d=e,n.a=i,n.b=r,n.c=t}function Q6(n,t,e,i){mFn(n,t,e,pBn(n,t,i,cL(t,99)&&0!=(BB(t,18).Bb&BQn)))}function Y6(n,t){OTn(t,"Label management",1),iO(mMn(n,(C6(),TMt))),HSn(t)}function J6(n){xA(this),vH(n>=0,"Initial capacity must not be negative")}function Z6(){Z6=O,Wit=lhn((Dtn(),Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])))}function n8(){n8=O,trt=lhn((J9(),Pun(Gk(ert,1),$Vn,461,0,[Yit,Qit,Jit])))}function t8(){t8=O,urt=lhn((G7(),Pun(Gk(Ort,1),$Vn,462,0,[crt,rrt,irt])))}function e8(){e8=O,Zet=lhn((qsn(),Pun(Gk(nit,1),$Vn,132,0,[zet,Uet,Xet])))}function i8(){i8=O,Lat=lhn((q7(),Pun(Gk(Hat,1),$Vn,379,0,[Oat,Iat,Aat])))}function r8(){r8=O,gut=lhn((Bfn(),Pun(Gk(mut,1),$Vn,423,0,[wut,but,lut])))}function c8(){c8=O,bht=lhn((Oin(),Pun(Gk(pht,1),$Vn,314,0,[hht,sht,fht])))}function a8(){a8=O,vht=lhn((uin(),Pun(Gk(Tht,1),$Vn,337,0,[wht,ght,dht])))}function u8(){u8=O,Nht=lhn((Jun(),Pun(Gk(Bht,1),$Vn,450,0,[Aht,Oht,$ht])))}function o8(){o8=O,_st=lhn((Crn(),Pun(Gk(Wst,1),$Vn,361,0,[Rst,Dst,xst])))}function s8(){s8=O,Oft=lhn((z7(),Pun(Gk(Lft,1),$Vn,303,0,[Pft,Cft,Sft])))}function h8(){h8=O,Mft=lhn((Kan(),Pun(Gk(Ift,1),$Vn,292,0,[jft,Eft,kft])))}function f8(){f8=O,svt=lhn((Mhn(),Pun(Gk(wvt,1),$Vn,378,0,[cvt,avt,uvt])))}function l8(){l8=O,Yvt=lhn((Hcn(),Pun(Gk(nmt,1),$Vn,375,0,[Xvt,Wvt,Vvt])))}function b8(){b8=O,Rvt=lhn((mon(),Pun(Gk(Fvt,1),$Vn,339,0,[Nvt,Lvt,xvt])))}function w8(){w8=O,Uvt=lhn((ain(),Pun(Gk(Qvt,1),$Vn,452,0,[Gvt,Hvt,qvt])))}function d8(){d8=O,gmt=lhn(($un(),Pun(Gk(Smt,1),$Vn,377,0,[bmt,wmt,lmt])))}function g8(){g8=O,amt=lhn((Usn(),Pun(Gk(hmt,1),$Vn,336,0,[emt,imt,rmt])))}function p8(){p8=O,fmt=lhn((dcn(),Pun(Gk(dmt,1),$Vn,338,0,[smt,umt,omt])))}function v8(){v8=O,Nmt=lhn((oin(),Pun(Gk(xmt,1),$Vn,454,0,[Omt,Amt,$mt])))}function m8(){m8=O,rjt=lhn((Cbn(),Pun(Gk(ujt,1),$Vn,442,0,[ejt,njt,tjt])))}function y8(){y8=O,bjt=lhn((Hsn(),Pun(Gk(Gjt,1),$Vn,380,0,[sjt,hjt,fjt])))}function k8(){k8=O,eEt=lhn((Sbn(),Pun(Gk(NEt,1),$Vn,381,0,[Zjt,nEt,Jjt])))}function j8(){j8=O,Qjt=lhn((Bcn(),Pun(Gk(Yjt,1),$Vn,293,0,[Xjt,Wjt,Ujt])))}function E8(){E8=O,UEt=lhn((Pbn(),Pun(Gk(WEt,1),$Vn,437,0,[HEt,qEt,GEt])))}function T8(){T8=O,kCt=lhn((ufn(),Pun(Gk(SCt,1),$Vn,334,0,[vCt,pCt,mCt])))}function M8(){M8=O,VPt=lhn((Rtn(),Pun(Gk(nCt,1),$Vn,272,0,[zPt,UPt,XPt])))}function S8(){return QEn(),Pun(Gk(aIt,1),$Vn,98,0,[YCt,QCt,VCt,UCt,WCt,XCt])}function P8(n,t){return!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),rdn(n.o,t)}function C8(n){return!n.g&&(n.g=new oo),!n.g.d&&(n.g.d=new lp(n)),n.g.d}function I8(n){return!n.g&&(n.g=new oo),!n.g.a&&(n.g.a=new bp(n)),n.g.a}function O8(n){return!n.g&&(n.g=new oo),!n.g.b&&(n.g.b=new fp(n)),n.g.b}function A8(n){return!n.g&&(n.g=new oo),!n.g.c&&(n.g.c=new wp(n)),n.g.c}function $8(n,t,e){var i,r;for(r=new Aan(t,n),i=0;i<e;++i)cvn(r);return r}function L8(n,t,e){var i,r;if(null!=e)for(i=0;i<t;++i)r=e[i],n.fi(i,r)}function N8(n,t,e,i){var r;return AFn(r=x8(ANt,hQn,25,t+1,15,1),n,t,e,i),r}function x8(n,t,e,i,r,c){var a;return a=Bmn(r,i),10!=r&&Pun(Gk(n,c),t,e,r,a),a}function D8(n,t,e,i){return e&&(i=e.gh(t,Awn(e.Tg(),n.c.Lj()),null,i)),i}function R8(n,t,e,i){return e&&(i=e.ih(t,Awn(e.Tg(),n.c.Lj()),null,i)),i}function K8(n,t,e){BB(n.b,65),BB(n.b,65),BB(n.b,65),Otn(n.a,new N_(e,t,n))}function _8(n,t,e){if(n<0||t>e||t<n)throw Hp(new Ok(mYn+n+kYn+t+hYn+e))}function F8(n){if(!n)throw Hp(new Fy("Unable to add element to queue"))}function B8(n){n?(this.c=n,this.b=null):(this.c=null,this.b=new Np)}function H8(n,t){PS.call(this,n,t),this.a=x8(Ket,kVn,436,2,0,1),this.b=!0}function q8(n){non.call(this,n,0),jx(this),this.d.b=this.d,this.d.a=this.d}function G8(n){var t;return 0==(t=n.b).b?null:BB(Dpn(t,0),188).b}function z8(n,t){var e;return(e=new q).c=!0,e.d=t.dd(),YGn(n,t.cd(),e)}function U8(n,t){var e;e=n.q.getHours()+(t/3600|0),n.q.setSeconds(t),lBn(n,e)}function X8(n,t,e){var i;(i=n.b[e.c.p][e.p]).b+=t.b,i.c+=t.c,i.a+=t.a,++i.a}function W8(n,t){var i,r;return i=n.a-t.a,r=n.b-t.b,e.Math.sqrt(i*i+r*r)}function V8(){V8=O,cht=new EP("QUADRATIC",0),aht=new EP("SCANLINE",1)}function Q8(){Q8=O,mmt=WG(dq(new B2,(yMn(),Rat),(lWn(),kot)),Bat,qot)}function Y8(){return wEn(),Pun(Gk(qPt,1),$Vn,291,0,[ZMt,JMt,YMt,VMt,WMt,QMt])}function J8(){return wvn(),Pun(Gk(nSt,1),$Vn,248,0,[CMt,AMt,$Mt,LMt,IMt,OMt])}function Z8(){return $Pn(),Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])}function n9(){return JMn(),Pun(Gk(mft,1),$Vn,275,0,[cft,eft,aft,rft,ift,tft])}function t9(){return Bjn(),Pun(Gk(uft,1),$Vn,274,0,[Qht,Vht,Jht,Wht,Yht,Xht])}function e9(){return TTn(),Pun(Gk(ovt,1),$Vn,313,0,[tvt,Zpt,Ypt,Jpt,evt,nvt])}function i9(){return gSn(),Pun(Gk(zht,1),$Vn,276,0,[Dht,xht,Kht,Rht,Fht,_ht])}function r9(){return DPn(),Pun(Gk(_kt,1),$Vn,327,0,[Qyt,Uyt,Wyt,Xyt,Vyt,zyt])}function c9(){return lIn(),Pun(Gk(IIt,1),$Vn,273,0,[rIt,eIt,iIt,tIt,nIt,cIt])}function a9(){return nMn(),Pun(Gk(yCt,1),$Vn,312,0,[aCt,rCt,uCt,eCt,cCt,iCt])}function u9(){return uSn(),Pun(Gk($ut,1),$Vn,267,0,[Cut,Put,Mut,Iut,Sut,Tut])}function o9(n){Mx(!!n.c),p2(n.e,n),n.c.Qb(),n.c=null,n.b=dun(n),bD(n.e,n)}function s9(n){return p2(n.c.a.e,n),Px(n.b!=n.c.a.d),n.a=n.b,n.b=n.b.a,n.a}function h9(n){var t;return n.a||-1==n.b||(t=n.c.Tg(),n.a=itn(t,n.b)),n.a}function f9(n,t){return!(n.hi()&&n.Hc(t)||(n.Yh(t),0))}function l9(n,t){return OY(t,"Horizontal alignment cannot be null"),n.b=t,n}function b9(n,t,e){var i;return wWn(),i=ZUn(n,t),e&&i&&gW(n)&&(i=null),i}function w9(n,t,e){var i;for(i=n.Kc();i.Ob();)ZRn(BB(i.Pb(),37),t,e)}function d9(n,t){var e;for(e=t.Kc();e.Ob();)$Kn(n,BB(e.Pb(),37),0,0)}function g9(n,t,i){var r;n.d[t.g]=i,(r=n.g.c)[t.g]=e.Math.max(r[t.g],i+1)}function p9(n,t){var e,i,r;return r=n.r,i=n.d,(e=cHn(n,t,!0)).b!=r||e.a!=i}function v9(n,t){return lS(n.e,t)||Jgn(n.e,t,new ipn(t)),BB(lnn(n.e,t),113)}function m9(n,t,e,i){return kW(n),kW(t),kW(e),kW(i),new jU(n,t,new G)}function y9(n,t,e,i){this.rj(),this.a=t,this.b=n,this.c=new Zz(this,t,e,i)}function k9(n,t,e,i,r,c){H2.call(this,t,i,r,c),Fh(this),this.c=n,this.b=e}function j9(n,t,e,i,r,c){H2.call(this,t,i,r,c),Fh(this),this.c=n,this.a=e}function E9(n,t,e){var i,r;r=null,(i=zJ(n,e))&&(r=yPn(i)),Xgn(t,e,r)}function T9(n,t,e){var i,r;r=null,(i=zJ(n,e))&&(r=yPn(i)),Xgn(t,e,r)}function M9(n,t,e){var i;return(i=$$n(n.b,t))?NHn(F7(n,i),e):null}function S9(n,t){var e;return(e=n.Yg(t))>=0?n._g(e,!0,!0):cOn(n,t,!0)}function P9(n,t){return Pln(Gy(MD(mMn(n,(hWn(),Tlt)))),Gy(MD(mMn(t,Tlt))))}function C9(){C9=O,Ukt=ogn(ogn(FM(new B2,(zyn(),Kyt)),(DPn(),Qyt)),Uyt)}function I9(n,t,e){var i;return i=Non(n,t,e),n.b=new mrn(i.c.length),sDn(n,i)}function O9(n){if(n.b<=0)throw Hp(new yv);return--n.b,n.a-=n.c.c,iln(n.a)}function A9(n){var t;if(!n.a)throw Hp(new lV);return t=n.a,n.a=JJ(n.a),t}function $9(n){for(;!n.a;)if(!TK(n.c,new pw(n)))return!1;return!0}function L9(n){return yX(n),cL(n,198)?BB(n,198):new ol(n)}function N9(n){x9(),BB(n.We((sWn(),fPt)),174).Fc((lIn(),iIt)),n.Ye(hPt,null)}function x9(){x9=O,tMt=new bu,iMt=new wu,eMt=vsn((sWn(),hPt),tMt,qSt,iMt)}function D9(){D9=O,cjt=new pC("LEAF_NUMBER",0),ajt=new pC("NODE_SIZE",1)}function R9(n,t,e){n.a=t,n.c=e,n.b.a.$b(),yQ(n.d),n.e.a.c=x8(Ant,HWn,1,0,5,1)}function K9(n){n.a=x8(ANt,hQn,25,n.b+1,15,1),n.c=x8(ANt,hQn,25,n.b,15,1),n.d=0}function _9(n,t){n.a.ue(t.d,n.b)>0&&(WB(n.c,new mH(t.c,t.d,n.d)),n.b=t.d)}function F9(n,t){if(null==n.g||t>=n.i)throw Hp(new LO(t,n.i));return n.g[t]}function B9(n,t,e){if(xsn(n,e),null!=e&&!n.wj(e))throw Hp(new lv);return e}function H9(n){var t;if(n.Ek())for(t=n.i-1;t>=0;--t)Wtn(n,t);return N3(n)}function q9(n){var t,e;if(!n.b)return null;for(e=n.b;t=e.a[0];)e=t;return e}function G9(n,t){var e;return c4(t),(e=m7(n.slice(0,t),n)).length=t,e}function z9(n,t,e,i){PQ(),i=i||wet,gCn(n.slice(t,e),n,t,e,-t,i)}function U9(n,t,e,i,r){return t<0?cOn(n,e,i):BB(e,66).Nj().Pj(n,n.yh(),t,i,r)}function X9(n){return cL(n,172)?""+BB(n,172).a:null==n?null:Bbn(n)}function W9(n){return cL(n,172)?""+BB(n,172).a:null==n?null:Bbn(n)}function V9(n,t){if(t.a)throw Hp(new dy(IYn));TU(n.a,t),t.a=n,!n.j&&(n.j=t)}function Q9(n,t){vO.call(this,t.rd(),-16449&t.qd()),kW(n),this.a=n,this.c=t}function Y9(n,t){var e,i;return i=t/n.c.Hd().gc()|0,e=t%n.c.Hd().gc(),U6(n,i,e)}function J9(){J9=O,Yit=new GS(cJn,0),Qit=new GS(eJn,1),Jit=new GS(aJn,2)}function Z9(){Z9=O,Net=new gS("All",0),xet=new LA,Det=new A$,Ret=new NA}function n7(){n7=O,_et=lhn((Z9(),Pun(Gk(Fet,1),$Vn,297,0,[Net,xet,Det,Ret])))}function t7(){t7=O,rut=lhn((Aun(),Pun(Gk(dut,1),$Vn,405,0,[Zat,eut,nut,tut])))}function e7(){e7=O,_rt=lhn((Dan(),Pun(Gk(Grt,1),$Vn,406,0,[Rrt,Nrt,xrt,Drt])))}function i7(){i7=O,zrt=lhn((Hpn(),Pun(Gk(Urt,1),$Vn,323,0,[Brt,Frt,Hrt,qrt])))}function r7(){r7=O,ict=lhn((qpn(),Pun(Gk(cct,1),$Vn,394,0,[Zrt,Jrt,nct,tct])))}function c7(){c7=O,Hyt=lhn((zyn(),Pun(Gk(qyt,1),$Vn,393,0,[Ryt,Kyt,_yt,Fyt])))}function a7(){a7=O,ost=lhn((Iun(),Pun(Gk(pst,1),$Vn,360,0,[ast,rst,cst,ist])))}function u7(){u7=O,zjt=lhn((Omn(),Pun(Gk(Vjt,1),$Vn,340,0,[qjt,Bjt,Hjt,Fjt])))}function o7(){o7=O,Est=lhn((Oun(),Pun(Gk(Ist,1),$Vn,411,0,[vst,mst,yst,kst])))}function s7(){s7=O,dvt=lhn((bvn(),Pun(Gk(kvt,1),$Vn,197,0,[lvt,bvt,fvt,hvt])))}function h7(){h7=O,fOt=lhn((Bsn(),Pun(Gk(wOt,1),$Vn,396,0,[uOt,oOt,aOt,sOt])))}function f7(){f7=O,PCt=lhn((Xyn(),Pun(Gk(RCt,1),$Vn,285,0,[MCt,jCt,ECt,TCt])))}function l7(){l7=O,tCt=lhn((Mbn(),Pun(Gk(oCt,1),$Vn,218,0,[ZPt,YPt,QPt,JPt])))}function b7(){b7=O,rOt=lhn((Fwn(),Pun(Gk(cOt,1),$Vn,311,0,[eOt,ZIt,tOt,nOt])))}function w7(){w7=O,BIt=lhn((mdn(),Pun(Gk(YIt,1),$Vn,374,0,[KIt,_It,RIt,DIt])))}function d7(){d7=O,qBn(),HLt=RQn,BLt=KQn,GLt=new Nb(RQn),qLt=new Nb(KQn)}function g7(){g7=O,Ght=new OP(QZn,0),qht=new OP("IMPROVE_STRAIGHTNESS",1)}function p7(n,t){return hH(),WB(n,new rI(t,iln(t.e.c.length+t.g.c.length)))}function v7(n,t){return hH(),WB(n,new rI(t,iln(t.e.c.length+t.g.c.length)))}function m7(n,t){return 10!=vnn(t)&&Pun(tsn(t),t.hm,t.__elementTypeId$,vnn(t),n),n}function y7(n,t){var e;return-1!=(e=E7(n,t,0))&&(s6(n,e),!0)}function k7(n,t){var e;return(e=BB(v6(n.e,t),387))?(RH(e),e.e):null}function j7(n){var t;return JO(n)&&(t=0-n,!isNaN(t))?t:uan(aon(n))}function E7(n,t,e){for(;e<n.c.length;++e)if(cV(t,n.c[e]))return e;return-1}function T7(n,t,e){var i;return EW(n),(i=new sn).a=t,n.a.Nb(new IS(i,e)),i.a}function M7(n){var t;return EW(n),t=x8(xNt,qQn,25,0,15,1),gE(n.a,new ww(t)),t}function S7(n){var t;return t=BB(xq(n.j,0),11),BB(mMn(t,(hWn(),dlt)),11)}function P7(n){var t;if(!Zin(n))throw Hp(new yv);return n.e=1,t=n.d,n.d=null,t}function C7(n,t){var e;this.f=n,this.b=t,e=BB(RX(n.b,t),283),this.c=e?e.b:null}function I7(){G_(),this.b=new xp,this.f=new xp,this.g=new xp,this.e=new xp}function O7(n,t){this.a=x8(Out,a1n,10,n.a.c.length,0,1),Qgn(n.a,this.a),this.b=t}function A7(n){var t;for(t=n.p+1;t<n.c.a.c.length;++t)--BB(xq(n.c.a,t),10).p}function $7(n){var t;null!=(t=n.Ai())&&-1!=n.d&&BB(t,92).Ng(n),n.i&&n.i.Fi()}function L7(n){V$(this),this.g=n?CY(n,n.$d()):null,this.f=n,jQ(this),this._d()}function N7(n,t,e,i,r,c,a){kin.call(this,t,i,r,c,a),Fh(this),this.c=n,this.b=e}function x7(n,t,e,i,r){return kW(n),kW(t),kW(e),kW(i),kW(r),new jU(n,t,i)}function D7(n,t){if(t<0)throw Hp(new Ay(n5n+t));return g3(n,t+1),xq(n.j,t)}function R7(n,t,e,i){if(!n)throw Hp(new _y($Rn(t,Pun(Gk(Ant,1),HWn,1,5,[e,i]))))}function K7(n,t){return cV(t,xq(n.f,0))||cV(t,xq(n.f,1))||cV(t,xq(n.f,2))}function _7(n,t){LK(BB(BB(n.f,33).We((sWn(),uPt)),98))&&Qbn(yV(BB(n.f,33)),t)}function F7(n,t){var e,i;return!(i=(e=BB(t,675)).Oh())&&e.Rh(i=new RI(n,t)),i}function B7(n,t){var e,i;return!(i=(e=BB(t,677)).pk())&&e.tk(i=new K0(n,t)),i}function H7(n){return n.b||(n.b=new JG(n,VAt,n),!n.a&&(n.a=new oR(n,n))),n.b}function q7(){q7=O,Oat=new WS("XY",0),Iat=new WS("X",1),Aat=new WS("Y",2)}function G7(){G7=O,crt=new zS("TOP",0),rrt=new zS(eJn,1),irt=new zS(oJn,2)}function z7(){z7=O,Pft=new xP(QZn,0),Cft=new xP("TOP",1),Sft=new xP(oJn,2)}function U7(){U7=O,Kvt=new GP("INPUT_ORDER",0),_vt=new GP("PORT_DEGREE",1)}function X7(){X7=O,btt=M$(SQn,SQn,524287),wtt=M$(0,0,CQn),dtt=F5(1),F5(2),gtt=F5(0)}function W7(n,t,e){n.a.c=x8(Ant,HWn,1,0,5,1),Xqn(n,t,e),0==n.a.c.length||f_n(n,t)}function V7(n){var t,e;return YU(n,0,e=n.length,t=x8(ONt,WVn,25,e,15,1),0),t}function Q7(n){var t;return n.dh()||(t=bX(n.Tg())-n.Ah(),n.ph().bk(t)),n.Pg()}function Y7(n){var t;return null==(t=een(yan(n,32)))&&(fgn(n),t=een(yan(n,32))),t}function J7(n,t){var e;return(e=Awn(n.d,t))>=0?Zpn(n,e,!0,!0):cOn(n,t,!0)}function Z7(n,t){var e,i;return MM(),e=f3(n),i=f3(t),!!e&&!!i&&!Kpn(e.k,i.k)}function nnn(n,t){Pen(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function tnn(n,t){Cen(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function enn(n,t){Sen(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function inn(n,t){Men(n,null==t||WK((kW(t),t))||isNaN((kW(t),t))?0:(kW(t),t))}function rnn(n){(this.q?this.q:(SQ(),SQ(),het)).Ac(n.q?n.q:(SQ(),SQ(),het))}function cnn(n,t){return cL(t,99)&&0!=(BB(t,18).Bb&BQn)?new xO(t,n):new Aan(t,n)}function ann(n,t){return cL(t,99)&&0!=(BB(t,18).Bb&BQn)?new xO(t,n):new Aan(t,n)}function unn(n,t){Vrt=new it,ect=t,BB((Wrt=n).b,65),K8(Wrt,Vrt,null),uqn(Wrt)}function onn(n,t,e){var i;return i=n.g[t],jL(n,t,n.oi(t,e)),n.gi(t,e,i),n.ci(),i}function snn(n,t){var e;return(e=n.Xc(t))>=0&&(n.$c(e),!0)}function hnn(n){var t;return n.d!=n.r&&(t=Ikn(n),n.e=!!t&&t.Cj()==E9n,n.d=t),n.e}function fnn(n,t){var e;for(yX(n),yX(t),e=!1;t.Ob();)e|=n.Fc(t.Pb());return e}function lnn(n,t){var e;return(e=BB(RX(n.e,t),387))?(uL(n,e),e.e):null}function bnn(n){var t,e;return t=n/60|0,0==(e=n%60)?""+t:t+":"+e}function wnn(n,t){return Qln(n),new Rq(n,new KK(new M6(t,n.a)))}function dnn(n,t){var e=n.a[t],i=(Zun(),ftt)[typeof e];return i?i(e):khn(typeof e)}function gnn(n){switch(n.g){case 0:return DWn;case 1:return-1;default:return 0}}function pnn(n){return Kkn(n,(X7(),gtt))<0?-CN(aon(n)):n.l+n.m*IQn+n.h*OQn}function vnn(n){return null==n.__elementTypeCategory$?10:n.__elementTypeCategory$}function mnn(n){var t;return null!=(t=0==n.b.c.length?null:xq(n.b,0))&&hrn(n,0),t}function ynn(n,t){for(;t[0]<n.length&&GO(" \t\r\n",YTn(fV(n,t[0])))>=0;)++t[0]}function knn(n,t){this.e=t,this.a=Van(n),this.a<54?this.f=j2(n):this.c=npn(n)}function jnn(n,t,e,i){wWn(),Ap.call(this,26),this.c=n,this.a=t,this.d=e,this.b=i}function Enn(n,t,e){var i,r;for(i=10,r=0;r<e-1;r++)t<i&&(n.a+="0"),i*=10;n.a+=t}function Tnn(n,t){var e;for(e=0;n.e!=n.i.gc();)gq(t,kpn(n),iln(e)),e!=DWn&&++e}function Mnn(n,t){var e;for(++n.d,++n.c[t],e=t+1;e<n.a.length;)++n.a[e],e+=e&-e}function Snn(n,t){var e,i,r;r=t.c.i,i=(e=BB(RX(n.f,r),57)).d.c-e.e.c,Yrn(t.a,i,0)}function Pnn(n){var t,e;return t=n+128,!(e=(jq(),jtt)[t])&&(e=jtt[t]=new $b(n)),e}function Cnn(n,t){var e;return kW(t),xnn(!!(e=n[":"+t]),Pun(Gk(Ant,1),HWn,1,5,[t])),e}function Inn(n){var t,e;if(n.b){e=null;do{t=n.b,n.b=null,e=sPn(t,e)}while(n.b);n.b=e}}function Onn(n){var t,e;if(n.a){e=null;do{t=n.a,n.a=null,e=sPn(t,e)}while(n.a);n.a=e}}function Ann(n){var t;for(++n.a,t=n.c.a.length;n.a<t;++n.a)if(n.c.b[n.a])return}function $nn(n,t){var e,i;for(e=(i=t.c)+1;e<=t.f;e++)n.a[e]>n.a[i]&&(i=e);return i}function Lnn(n,t){var e;return 0==(e=Ibn(n.e.c,t.e.c))?Pln(n.e.d,t.e.d):e}function Nnn(n,t){return 0==t.e||0==n.e?eet:($On(),ANn(n,t))}function xnn(n,t){if(!n)throw Hp(new _y(YNn("Enum constant undefined: %s",t)))}function Dnn(){Dnn=O,uut=new St,out=new Tt,cut=new At,aut=new $t,sut=new Lt}function Rnn(){Rnn=O,vit=new BS("BY_SIZE",0),mit=new BS("BY_SIZE_AND_SHAPE",1)}function Knn(){Knn=O,Dct=new XS("EADES",0),Rct=new XS("FRUCHTERMAN_REINGOLD",1)}function _nn(){_nn=O,Sht=new PP("READING_DIRECTION",0),Pht=new PP("ROTATION",1)}function Fnn(){Fnn=O,Mht=lhn((Vvn(),Pun(Gk(Cht,1),$Vn,335,0,[yht,mht,jht,Eht,kht])))}function Bnn(){Bnn=O,jvt=lhn((Nvn(),Pun(Gk(Avt,1),$Vn,315,0,[yvt,pvt,vvt,gvt,mvt])))}function Hnn(){Hnn=O,Ost=lhn((LEn(),Pun(Gk(Kst,1),$Vn,363,0,[Mst,Pst,Cst,Sst,Tst])))}function qnn(){qnn=O,zlt=lhn((Tbn(),Pun(Gk(ivt,1),$Vn,163,0,[qlt,_lt,Flt,Blt,Hlt])))}function Gnn(){Gnn=O,sTt=lhn(($Sn(),Pun(Gk(zTt,1),$Vn,316,0,[iTt,rTt,uTt,cTt,aTt])))}function znn(){znn=O,bMt=lhn((rpn(),Pun(Gk(jMt,1),$Vn,175,0,[hMt,sMt,uMt,fMt,oMt])))}function Unn(){Unn=O,BEt=lhn((YLn(),Pun(Gk(zEt,1),$Vn,355,0,[DEt,xEt,KEt,REt,_Et])))}function Xnn(){Xnn=O,qat=lhn((yMn(),Pun(Gk(Uat,1),$Vn,356,0,[Rat,Kat,_at,Fat,Bat])))}function Wnn(){Wnn=O,GPt=lhn((Ffn(),Pun(Gk(WPt,1),$Vn,103,0,[BPt,FPt,_Pt,KPt,HPt])))}function Vnn(){Vnn=O,zCt=lhn((cpn(),Pun(Gk(JCt,1),$Vn,249,0,[BCt,qCt,_Ct,FCt,HCt])))}function Qnn(){Qnn=O,OIt=lhn((kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])))}function Ynn(n,t){var e;return(e=BB(RX(n.a,t),134))||(e=new Zn,VW(n.a,t,e)),e}function Jnn(n){var t;return!!(t=BB(mMn(n,(hWn(),Rft)),305))&&t.a==n}function Znn(n){var t;return!!(t=BB(mMn(n,(hWn(),Rft)),305))&&t.i==n}function ntn(n,t){return kW(t),Dz(n),!!n.d.Ob()&&(t.td(n.d.Pb()),!0)}function ttn(n){return Vhn(n,DWn)>0?DWn:Vhn(n,_Vn)<0?_Vn:dG(n)}function etn(n){return n<3?(lin(n,IVn),n+1):n<OVn?CJ(n/.75+1):DWn}function itn(n,t){var e;return null==n.i&&qFn(n),e=n.i,t>=0&&t<e.length?e[t]:null}function rtn(n,t,e){var i;if(null==t)throw Hp(new gv);return i=zJ(n,t),i4(n,t,e),i}function ctn(n){return n.a>=-.01&&n.a<=fJn&&(n.a=0),n.b>=-.01&&n.b<=fJn&&(n.b=0),n}function atn(n,t){return t==(c_(),c_(),Met)?n.toLocaleLowerCase():n.toLowerCase()}function utn(n){return(0!=(2&n.i)?"interface ":0!=(1&n.i)?"":"class ")+(ED(n),n.o)}function otn(n){var t;t=new $m,f9((!n.q&&(n.q=new eU(QAt,n,11,10)),n.q),t)}function stn(n,t){var e;return e=t>0?t-1:t,$j(Lj(Fen(LH(new Xm,e),n.n),n.j),n.k)}function htn(n,t,e,i){n.j=-1,qOn(n,EPn(n,t,e),(ZM(),BB(t,66).Mj().Ok(i)))}function ftn(n){this.g=n,this.f=new Np,this.a=e.Math.min(this.g.c.c,this.g.d.c)}function ltn(n){this.b=new Np,this.a=new Np,this.c=new Np,this.d=new Np,this.e=n}function btn(n,t){this.a=new xp,this.e=new xp,this.b=(Mhn(),uvt),this.c=n,this.b=t}function wtn(n,t,e){NR.call(this),xtn(this),this.a=n,this.c=e,this.b=t.d,this.f=t.e}function dtn(n){this.d=n,this.c=n.c.vc().Kc(),this.b=null,this.a=null,this.e=(ry(),znt)}function gtn(n){if(n<0)throw Hp(new _y("Illegal Capacity: "+n));this.g=this.ri(n)}function ptn(n,t){if(0>n||n>t)throw Hp(new Tk("fromIndex: 0, toIndex: "+n+hYn+t))}function vtn(n){var t;if(n.a==n.b.a)throw Hp(new yv);return t=n.a,n.c=t,n.a=n.a.e,t}function mtn(n){var t;Mx(!!n.c),t=n.c.a,Atn(n.d,n.c),n.b==n.c?n.b=t:--n.a,n.c=null}function ytn(n,t){var e;return Qln(n),e=new vQ(n,n.a.rd(),4|n.a.qd(),t),new Rq(n,e)}function ktn(n,t){var e,i;return(e=BB(lfn(n.d,t),14))?(i=t,n.e.pc(i,e)):null}function jtn(n,t){var e;for(e=n.Kc();e.Ob();)hon(BB(e.Pb(),70),(hWn(),ult),t)}function Etn(n){var t;return(t=Gy(MD(mMn(n,(HXn(),agt)))))<0&&hon(n,agt,t=0),t}function Ttn(n,t,i){var r;Fkn(i,r=e.Math.max(0,n.b/2-.5),1),WB(t,new iP(i,r))}function Mtn(n,t,e){return CJ(HH(n.a.e[BB(t.a,10).p]-n.a.e[BB(e.a,10).p]))}function Stn(n,t,e,i,r,c){var a;SZ(a=W5(i),r),MZ(a,c),JIn(n.a,i,new L_(a,t,e.f))}function Ptn(n,t){var e;if(!(e=NNn(n.Tg(),t)))throw Hp(new _y(r6n+t+u6n));return e}function Ctn(n,t){var e;for(e=n;JJ(e);)if((e=JJ(e))==t)return!0;return!1}function Itn(n,t){var e,i,r;for(i=t.a.cd(),e=BB(t.a.dd(),14).gc(),r=0;r<e;r++)n.td(i)}function Otn(n,t){var e,i,r,c;for(kW(t),r=0,c=(i=n.c).length;r<c;++r)e=i[r],t.td(e)}function Atn(n,t){var e;return e=t.c,t.a.b=t.b,t.b.a=t.a,t.a=t.b=null,t.c=null,--n.b,e}function $tn(n,t){return!(!t||n.b[t.g]!=t||($X(n.b,t.g,null),--n.c,0))}function Ltn(n,t){return!!Zrn(n,t,dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15))))}function Ntn(n,t){LK(BB(mMn(BB(n.e,10),(HXn(),ept)),98))&&(SQ(),m$(BB(n.e,10).j,t))}function xtn(n){n.b=(J9(),Qit),n.f=(G7(),rrt),n.d=(lin(2,AVn),new J6(2)),n.e=new Gj}function Dtn(){Dtn=O,Git=new qS("BEGIN",0),zit=new qS(eJn,1),Uit=new qS("END",2)}function Rtn(){Rtn=O,zPt=new _C(eJn,0),UPt=new _C("HEAD",1),XPt=new _C("TAIL",2)}function Ktn(){return hAn(),Pun(Gk(aAt,1),$Vn,237,0,[iAt,nAt,tAt,ZOt,eAt,YOt,QOt,JOt])}function _tn(){return PPn(),Pun(Gk(SMt,1),$Vn,277,0,[kMt,wMt,vMt,yMt,dMt,gMt,pMt,mMt])}function Ftn(){return kDn(),Pun(Gk(iht,1),$Vn,270,0,[Bst,Gst,Fst,Xst,qst,Hst,Ust,zst])}function Btn(){return sNn(),Pun(Gk(Dvt,1),$Vn,260,0,[Ivt,Tvt,Pvt,Mvt,Svt,Evt,Cvt,Ovt])}function Htn(){Htn=O,ZCt=lhn((QEn(),Pun(Gk(aIt,1),$Vn,98,0,[YCt,QCt,VCt,UCt,WCt,XCt])))}function qtn(){qtn=O,nrt=(Dtn(),Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length,Zit=nrt}function Gtn(n){this.b=(yX(n),new t_(n)),this.a=new Np,this.d=new Np,this.e=new Gj}function ztn(n){var t;return(t=e.Math.sqrt(n.a*n.a+n.b*n.b))>0&&(n.a/=t,n.b/=t),n}function Utn(n){var t;return n.w?n.w:((t=V1(n))&&!t.kh()&&(n.w=t),t)}function Xtn(n){var t;return null==n?null:VTn(t=BB(n,190),t.length)}function Wtn(n,t){if(null==n.g||t>=n.i)throw Hp(new LO(t,n.i));return n.li(t,n.g[t])}function Vtn(n){var t,e;for(t=n.a.d.j,e=n.c.d.j;t!=e;)orn(n.b,t),t=Mln(t);orn(n.b,t)}function Qtn(n){var t;for(t=0;t<n.c.length;t++)(l1(t,n.c.length),BB(n.c[t],11)).p=t}function Ytn(n,t,e){var i,r,c;for(r=t[e],i=0;i<r.length;i++)c=r[i],n.e[c.c.p][c.p]=i}function Jtn(n,t){var e,i,r,c;for(r=0,c=(i=n.d).length;r<c;++r)e=i[r],lL(n.g,e).a=t}function Ztn(n,t){var e;for(e=spn(n,0);e.b!=e.d.c;)UR(BB(b3(e),8),t);return n}function nen(n,t){return XR(B$(BB(RX(n.g,t),8)),_$(BB(RX(n.f,t),460).b))}function ten(n){var t;return p2(n.e,n),Px(n.b),n.c=n.a,t=BB(n.a.Pb(),42),n.b=dun(n),t}function een(n){var t;return JH(null==n||Array.isArray(n)&&!((t=vnn(n))>=14&&t<=16)),n}function ien(n,t,e){var i=function(){return n.apply(i,arguments)};return t.apply(i,e),i}function ren(n,t,e){var i,r;i=t;do{r=Gy(n.p[i.p])+e,n.p[i.p]=r,i=n.a[i.p]}while(i!=t)}function cen(n,t){var e,i;i=n.a,e=Qfn(n,t,null),i!=t&&!n.e&&(e=azn(n,t,e)),e&&e.Fi()}function aen(n,t){return h$(),rin(KVn),e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)}function uen(n,t){return h$(),rin(KVn),e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)}function oen(n,t){return _Mn(),E$(n.b.c.length-n.e.c.length,t.b.c.length-t.e.c.length)}function sen(n,t){return Zj(Jrn(n,t,dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15)))))}function hen(){hen=O,Aut=lhn((uSn(),Pun(Gk($ut,1),$Vn,267,0,[Cut,Put,Mut,Iut,Sut,Tut])))}function fen(){fen=O,tSt=lhn((wEn(),Pun(Gk(qPt,1),$Vn,291,0,[ZMt,JMt,YMt,VMt,WMt,QMt])))}function len(){len=O,xMt=lhn((wvn(),Pun(Gk(nSt,1),$Vn,248,0,[CMt,AMt,$Mt,LMt,IMt,OMt])))}function ben(){ben=O,rht=lhn(($Pn(),Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])))}function wen(){wen=O,oft=lhn((JMn(),Pun(Gk(mft,1),$Vn,275,0,[cft,eft,aft,rft,ift,tft])))}function den(){den=O,nft=lhn((Bjn(),Pun(Gk(uft,1),$Vn,274,0,[Qht,Vht,Jht,Wht,Yht,Xht])))}function gen(){gen=O,rvt=lhn((TTn(),Pun(Gk(ovt,1),$Vn,313,0,[tvt,Zpt,Ypt,Jpt,evt,nvt])))}function pen(){pen=O,Hht=lhn((gSn(),Pun(Gk(zht,1),$Vn,276,0,[Dht,xht,Kht,Rht,Fht,_ht])))}function ven(){ven=O,Jyt=lhn((DPn(),Pun(Gk(_kt,1),$Vn,327,0,[Qyt,Uyt,Wyt,Xyt,Vyt,zyt])))}function men(){men=O,uIt=lhn((lIn(),Pun(Gk(IIt,1),$Vn,273,0,[rIt,eIt,iIt,tIt,nIt,cIt])))}function yen(){yen=O,sCt=lhn((nMn(),Pun(Gk(yCt,1),$Vn,312,0,[aCt,rCt,uCt,eCt,cCt,iCt])))}function ken(){return n$n(),Pun(Gk(GCt,1),$Vn,93,0,[ICt,CCt,ACt,DCt,xCt,NCt,$Ct,LCt,OCt])}function jen(n,t){var e;e=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,0,e,n.a))}function Een(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,1,e,n.b))}function Ten(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,3,e,n.b))}function Men(n,t){var e;e=n.f,n.f=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,3,e,n.f))}function Sen(n,t){var e;e=n.g,n.g=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,4,e,n.g))}function Pen(n,t){var e;e=n.i,n.i=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,5,e,n.i))}function Cen(n,t){var e;e=n.j,n.j=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,6,e,n.j))}function Ien(n,t){var e;e=n.j,n.j=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,1,e,n.j))}function Oen(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,4,e,n.c))}function Aen(n,t){var e;e=n.k,n.k=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new f4(n,2,e,n.k))}function $en(n,t){var e;e=n.d,n.d=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new l4(n,2,e,n.d))}function Len(n,t){var e;e=n.s,n.s=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new l4(n,4,e,n.s))}function Nen(n,t){var e;e=n.t,n.t=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new l4(n,5,e,n.t))}function xen(n,t){var e;e=n.F,n.F=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,5,e,t))}function Den(n,t){var e;return(e=BB(RX((nS(),mAt),n),55))?e.xj(t):x8(Ant,HWn,1,t,5,1)}function Ren(n,t){var e;return t in n.a&&(e=zJ(n,t).he())?e.a:null}function Ken(n,t){var e,i;return tE(),i=new uo,!!t&&INn(i,t),xin(e=i,n),e}function _en(n,t,e){if(xsn(n,e),!n.Bk()&&null!=e&&!n.wj(e))throw Hp(new lv);return e}function Fen(n,t){return n.n=t,n.n?(n.f=new Np,n.e=new Np):(n.f=null,n.e=null),n}function Ben(n,t,e,i,r,c){var a;return Qen(e,a=mX(n,t)),a.i=r?8:0,a.f=i,a.e=r,a.g=c,a}function Hen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=1,this.c=n,this.a=e}function qen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=2,this.c=n,this.a=e}function Gen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=6,this.c=n,this.a=e}function zen(n,t,e,i,r){this.d=t,this.k=i,this.f=r,this.o=-1,this.p=7,this.c=n,this.a=e}function Uen(n,t,e,i,r){this.d=t,this.j=i,this.e=r,this.o=-1,this.p=4,this.c=n,this.a=e}function Xen(n,t){var e,i,r,c;for(r=0,c=(i=t).length;r<c;++r)e=i[r],V9(n.a,e);return n}function Wen(n){var t,e,i;for(e=0,i=(t=n).length;e<i;++e)yX(t[e]);return new AO(n)}function Ven(n){var t=/function(?:\s+([\w$]+))?\s*\(/.exec(n);return t&&t[1]||zVn}function Qen(n,t){if(n){t.n=n;var e=UJ(t);e?e.gm=t:SWn[n]=[t]}}function Yen(n,t,i){var r;return r=n.length,_Cn(n,0,t,0,e.Math.min(i,r),!0),t}function Jen(n,t,e){var i,r;for(r=t.Kc();r.Ob();)i=BB(r.Pb(),79),TU(n,BB(e.Kb(i),33))}function Zen(){YE();for(var n=PWn,t=0;t<arguments.length;t++)n.push(arguments[t])}function nin(n,t){var e,i,r;for(i=0,r=(e=t).length;i<r;++i)r5(n,e[i],n.c.b,n.c)}function tin(n,t){n.b=e.Math.max(n.b,t.d),n.e+=t.r+(0==n.a.c.length?0:n.c),WB(n.a,t)}function ein(n){Mx(n.c>=0),rgn(n.d,n.c)<0&&(n.a=n.a-1&n.d.a.length-1,n.b=n.d.c),n.c=-1}function iin(n){return n.a<54?n.f<0?-1:n.f>0?1:0:(!n.c&&(n.c=yhn(n.f)),n.c).e}function rin(n){if(!(n>=0))throw Hp(new _y("tolerance ("+n+") must be >= 0"));return n}function cin(){return cMt||ksn(cMt=new ORn,Pun(Gk(_it,1),HWn,130,0,[new Nf])),cMt}function ain(){ain=O,Gvt=new zP(hJn,0),Hvt=new zP("INPUT",1),qvt=new zP("OUTPUT",2)}function uin(){uin=O,wht=new MP("ARD",0),ght=new MP("MSD",1),dht=new MP("MANUAL",2)}function oin(){oin=O,Omt=new YP("BARYCENTER",0),Amt=new YP(E1n,1),$mt=new YP(T1n,2)}function sin(n,t){var e;if(e=n.gc(),t<0||t>e)throw Hp(new tK(t,e));return new RK(n,t)}function hin(n,t){var e;return cL(t,42)?n.c.Mc(t):(e=rdn(n,t),Wdn(n,t),e)}function fin(n,t,e){return Ihn(n,t),Nrn(n,e),Len(n,0),Nen(n,1),nln(n,!0),Yfn(n,!0),n}function lin(n,t){if(n<0)throw Hp(new _y(t+" cannot be negative but was: "+n));return n}function bin(n,t){var e,i;for(e=0,i=n.gc();e<i;++e)if(cV(t,n.Xb(e)))return e;return-1}function win(n){var t;for(t=n.c.Cc().Kc();t.Ob();)BB(t.Pb(),14).$b();n.c.$b(),n.d=0}function din(n){var t,e,i,r;for(i=0,r=(e=n.a).length;i<r;++i)QU(t=e[i],t.length,null)}function gin(n){var t,e;if(0==n)return 32;for(e=0,t=1;0==(t&n);t<<=1)++e;return e}function pin(n){var t;for(t=new Wb(eyn(n));t.a<t.c.c.length;)BB(n0(t),680).Gf()}function vin(n){vM(),this.g=new xp,this.f=new xp,this.b=new xp,this.c=new pJ,this.i=n}function min(){this.f=new Gj,this.d=new wm,this.c=new Gj,this.a=new Np,this.b=new Np}function yin(n,t,e,i){this.rj(),this.a=t,this.b=n,this.c=null,this.c=new lK(this,t,e,i)}function kin(n,t,e,i,r){this.d=n,this.n=t,this.g=e,this.o=i,this.p=-1,r||(this.o=-2-i-1)}function jin(){OL.call(this),this.n=-1,this.g=null,this.i=null,this.j=null,this.Bb|=k6n}function Ein(){return n_n(),Pun(Gk(iOt,1),$Vn,259,0,[GIt,UIt,qIt,XIt,WIt,QIt,VIt,zIt,HIt])}function Tin(){return tRn(),Pun(Gk(Bit,1),$Vn,250,0,[Rit,$it,Lit,Ait,xit,Dit,Nit,Oit,Iit])}function Min(){Min=O,Ott=Pun(Gk(ANt,1),hQn,25,15,[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15])}function Sin(){Sin=O,kmt=dq(dq(dq(new B2,(yMn(),Rat),(lWn(),cot)),Kat,Oot),_at,Iot)}function Pin(){Pin=O,jmt=dq(dq(dq(new B2,(yMn(),Rat),(lWn(),cot)),Kat,Oot),_at,Iot)}function Cin(){Cin=O,Mmt=dq(dq(dq(new B2,(yMn(),Rat),(lWn(),cot)),Kat,Oot),_at,Iot)}function Iin(){Iin=O,Cmt=WG(dq(dq(new B2,(yMn(),_at),(lWn(),Lot)),Fat,Eot),Bat,$ot)}function Oin(){Oin=O,hht=new TP("LAYER_SWEEP",0),sht=new TP(B1n,1),fht=new TP(QZn,2)}function Ain(n,t){var e,i;return e=n.c,(i=t.e[n.p])>0?BB(xq(e.a,i-1),10):null}function $in(n,t){var e;e=n.k,n.k=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,2,e,n.k))}function Lin(n,t){var e;e=n.f,n.f=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,8,e,n.f))}function Nin(n,t){var e;e=n.i,n.i=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,7,e,n.i))}function xin(n,t){var e;e=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,8,e,n.a))}function Din(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,0,e,n.b))}function Rin(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,0,e,n.b))}function Kin(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.c))}function _in(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.c))}function Fin(n,t){var e;e=n.c,n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,4,e,n.c))}function Bin(n,t){var e;e=n.d,n.d=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.d))}function Hin(n,t){var e;e=n.D,n.D=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,2,e,n.D))}function qin(n,t){n.r>0&&n.c<n.r&&(n.c+=t,n.i&&n.i.d>0&&0!=n.g&&qin(n.i,t/n.r*n.i.d))}function Gin(n,t,e){var i;n.b=t,n.a=e,i=512==(512&n.a)?new Fm:new Dh,n.c=MDn(i,n.b,n.a)}function zin(n,t){return $xn(n.e,t)?(ZM(),hnn(t)?new lq(t,n):new xI(t,n)):new KI(t,n)}function Uin(n,t){return Jj(Zrn(n.a,t,dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15)))))}function Xin(n,t,e){return x7(n,new fw(t),new un,new lw(e),Pun(Gk(nit,1),$Vn,132,0,[]))}function Win(n){return 0>n?new VT:new $D(null,new m5(n+1,n))}function Vin(n,t){var e;return SQ(),e=new XT(1),XI(n)?mZ(e,n,t):jCn(e.f,n,t),new Xb(e)}function Qin(n,t){var e,i;return(e=n.o+n.p)<(i=t.o+t.p)?-1:e==i?0:1}function Yin(n){var t;return cL(t=mMn(n,(hWn(),dlt)),160)?mwn(BB(t,160)):null}function Jin(n){var t;return(n=e.Math.max(n,2))>(t=kon(n))?(t<<=1)>0?t:OVn:t}function Zin(n){switch(uN(3!=n.e),n.e){case 2:return!1;case 0:return!0}return _5(n)}function nrn(n,t){var e;return!!cL(t,8)&&(e=BB(t,8),n.a==e.a&&n.b==e.b)}function trn(n,t,e){var i,r;return r=t>>5,i=31&t,e0(jz(n.n[e][r],dG(yz(i,1))),3)}function ern(n,t){var e,i;for(i=t.vc().Kc();i.Ob();)vjn(n,(e=BB(i.Pb(),42)).cd(),e.dd())}function irn(n,t){var e;e=new it,BB(t.b,65),BB(t.b,65),BB(t.b,65),Otn(t.a,new TB(n,e,t))}function rrn(n,t){var e;e=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,21,e,n.b))}function crn(n,t){var e;e=n.d,n.d=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,11,e,n.d))}function arn(n,t){var e;e=n.j,n.j=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,13,e,n.j))}function urn(n,t,e){var i,r,c;for(c=n.a.length-1,r=n.b,i=0;i<e;r=r+1&c,++i)$X(t,i,n.a[r])}function orn(n,t){var e;return kW(t),e=t.g,!n.b[e]&&($X(n.b,e,t),++n.c,!0)}function srn(n,t){var e;return!((e=null==t?-1:E7(n.b,t,0))<0||(hrn(n,e),0))}function hrn(n,t){var e;e=s6(n.b,n.b.c.length-1),t<n.b.c.length&&(c5(n.b,t,e),KCn(n,t))}function frn(n,t){0==(k5(),Qet?null:t.c).length&&zD(t,new X),mZ(n.a,Qet?null:t.c,t)}function lrn(n,t){OTn(t,"Hierarchical port constraint processing",1),bpn(n),YXn(n),HSn(t)}function brn(n,t){var e,i;for(i=t.Kc();i.Ob();)e=BB(i.Pb(),266),n.b=!0,TU(n.e,e),e.b=n}function wrn(n,t){var e,i;return e=1-t,i=n.a[e],n.a[e]=i.a[t],i.a[t]=n,n.b=!0,i.b=!1,i}function drn(n,t){var e,i;return e=BB(mMn(n,(HXn(),spt)),8),i=BB(mMn(t,spt),8),Pln(e.b,i.b)}function grn(n){RG.call(this),this.b=Gy(MD(mMn(n,(HXn(),ypt)))),this.a=BB(mMn(n,Zdt),218)}function prn(n,t,e){G2.call(this,n,t,e),this.a=new xp,this.b=new xp,this.d=new Wd(this)}function vrn(n){this.e=n,this.d=new bE(etn(gz(this.e).gc())),this.c=this.e.a,this.b=this.e.c}function mrn(n){this.b=n,this.a=x8(ANt,hQn,25,n+1,15,1),this.c=x8(ANt,hQn,25,n,15,1),this.d=0}function yrn(n,t,e){var i;return jxn(n,t,i=new Np,e,!0,!0),n.b=new mrn(i.c.length),i}function krn(n,t){var e;return(e=BB(RX(n.c,t),458))||((e=new cm).c=t,VW(n.c,e.c,e)),e}function jrn(n,t){var e=n.a,i=0;for(var r in e)e.hasOwnProperty(r)&&(t[i++]=r);return t}function Ern(n){return null==n.b?(YM(),YM(),x$t):n.Lk()?n.Kk():n.Jk()}function Trn(n){var t,e;for(e=new AL(n);e.e!=e.i.gc();)Pen(t=BB(kpn(e),33),0),Cen(t,0)}function Mrn(){Mrn=O,sat=new up(OZn),hat=new up(AZn),oat=new up($Zn),uat=new up(LZn)}function Srn(){Srn=O,qut=new ZS("TO_INTERNAL_LTR",0),Hut=new ZS("TO_INPUT_DIRECTION",1)}function Prn(){Prn=O,Qkt=new dC("P1_NODE_PLACEMENT",0),Ykt=new dC("P2_EDGE_ROUTING",1)}function Crn(){Crn=O,Rst=new kP("START",0),Dst=new kP("MIDDLE",1),xst=new kP("END",2)}function Irn(){Irn=O,tst=new iR("edgelabelcenterednessanalysis.includelabel",(hN(),ptt))}function Orn(n,t){JT(AV(new Rq(null,new w1(new Cb(n.b),1)),new JC(n,t)),new nI(n,t))}function Arn(){this.c=new IE(0),this.b=new IE(B3n),this.d=new IE(F3n),this.a=new IE(JJn)}function $rn(n){var t,e;for(e=n.c.a.ec().Kc();e.Ob();)Ul(t=BB(e.Pb(),214),new HMn(t.e))}function Lrn(n){var t,e;for(e=n.c.a.ec().Kc();e.Ob();)zl(t=BB(e.Pb(),214),new Vz(t.f))}function Nrn(n,t){var e;e=n.zb,n.zb=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,e,n.zb))}function xrn(n,t){var e;e=n.xb,n.xb=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,e,n.xb))}function Drn(n,t){var e;e=n.yb,n.yb=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,2,e,n.yb))}function Rrn(n,t){var e;(e=new Om).n=t,f9((!n.s&&(n.s=new eU(FAt,n,21,17)),n.s),e)}function Krn(n,t){var e;(e=new pD).n=t,f9((!n.s&&(n.s=new eU(FAt,n,21,17)),n.s),e)}function _rn(n,t){var e,i;for(z9(e=n.Pc(),0,e.length,t),i=0;i<e.length;i++)n._c(i,e[i])}function Frn(n,t){var e,i,r;for(kW(t),e=!1,r=t.Kc();r.Ob();)i=r.Pb(),e|=n.Fc(i);return e}function Brn(n){var t,e,i;for(t=0,i=n.Kc();i.Ob();)t=~~(t+=null!=(e=i.Pb())?nsn(e):0);return t}function Hrn(n){var t;return 0==n?"UTC":(n<0?(n=-n,t="UTC+"):t="UTC-",t+bnn(n))}function qrn(n,t){var e;return cL(t,14)?(e=BB(t,14),n.Gc(e)):fnn(n,BB(yX(t),20).Kc())}function Grn(n,t,e){btn.call(this,t,e),this.d=x8(Out,a1n,10,n.a.c.length,0,1),Qgn(n.a,this.d)}function zrn(n){n.a=null,n.e=null,n.b.c=x8(Ant,HWn,1,0,5,1),n.f.c=x8(Ant,HWn,1,0,5,1),n.c=null}function Urn(n,t){t?null==n.B&&(n.B=n.D,n.D=null):null!=n.B&&(n.D=n.B,n.B=null)}function Xrn(n,t){return Gy(MD($N($fn($V(new Rq(null,new w1(n.c.b,16)),new xd(n)),t))))}function Wrn(n,t){return Gy(MD($N($fn($V(new Rq(null,new w1(n.c.b,16)),new Nd(n)),t))))}function Vrn(n,t){OTn(t,k1n,1),JT(wnn(new Rq(null,new w1(n.b,16)),new Zt),new ne),HSn(t)}function Qrn(n,t){var e,i;return e=BB(ZAn(n,(Uyn(),Ljt)),19),i=BB(ZAn(t,Ljt),19),E$(e.a,i.a)}function Yrn(n,t,e){var i,r;for(r=spn(n,0);r.b!=r.d.c;)(i=BB(b3(r),8)).a+=t,i.b+=e;return n}function Jrn(n,t,e){var i;for(i=n.b[e&n.f];i;i=i.b)if(e==i.a&&wW(t,i.g))return i;return null}function Zrn(n,t,e){var i;for(i=n.c[e&n.f];i;i=i.d)if(e==i.f&&wW(t,i.i))return i;return null}function ncn(n,t,e){var i,r,c;for(i=0,r=0;r<e;r++)c=t[r],n[r]=c<<1|i,i=c>>>31;0!=i&&(n[e]=i)}function tcn(n,t){var e,i;for(SQ(),i=new Np,e=0;e<n;++e)i.c[i.c.length]=t;return new $k(i)}function ecn(n){var t;return QI((t=T2(n)).a,0)?(hM(),hM(),Pet):(hM(),new yx(t.b))}function icn(n){var t;return QI((t=T2(n)).a,0)?(hM(),hM(),Pet):(hM(),new yx(t.c))}function rcn(n){var t;return QI((t=E2(n)).a,0)?(fM(),fM(),Cet):(fM(),new kx(t.b))}function ccn(n){return n.b.c.i.k==(uSn(),Mut)?BB(mMn(n.b.c.i,(hWn(),dlt)),11):n.b.c}function acn(n){return n.b.d.i.k==(uSn(),Mut)?BB(mMn(n.b.d.i,(hWn(),dlt)),11):n.b.d}function ucn(n,t,e,i,r,c,a,u,o,s,h,f,l){return bCn(n,t,e,i,r,c,a,u,o,s,h,f,l),Gln(n,!1),n}function ocn(n,t,e,i,r,c,a){gT.call(this,n,t),this.d=e,this.e=i,this.c=r,this.b=c,this.a=u6(a)}function scn(n,t){typeof window===AWn&&typeof window.$gwt===AWn&&(window.$gwt[n]=t)}function hcn(n,t){return Aun(),n==Zat&&t==eut||n==eut&&t==Zat||n==tut&&t==nut||n==nut&&t==tut}function fcn(n,t){return Aun(),n==Zat&&t==nut||n==Zat&&t==tut||n==eut&&t==tut||n==eut&&t==nut}function lcn(n,t){return h$(),rin(fJn),e.Math.abs(0-t)<=fJn||0==t||isNaN(0)&&isNaN(t)?0:n/t}function bcn(){return bDn(),Pun(Gk(Tft,1),$Vn,256,0,[hft,lft,bft,wft,dft,gft,vft,sft,fft,pft])}function wcn(){wcn=O,P$t=new Im,I$t=Pun(Gk(FAt,1),N9n,170,0,[]),C$t=Pun(Gk(QAt,1),x9n,59,0,[])}function dcn(){dcn=O,smt=new VP("NO",0),umt=new VP("GREEDY",1),omt=new VP("LOOK_BACK",2)}function gcn(){gcn=O,Dut=new Ht,Nut=new Bt,xut=new qt,Lut=new Gt,Rut=new zt,Kut=new Ut}function pcn(n){var t,e;for(e=0,t=new Wb(n.b);t.a<t.c.c.length;)BB(n0(t),29).p=e,++e}function vcn(n,t){var e;return $In(new xC((e=_Tn(n)).c,e.d),new xC(e.b,e.a),n.rf(),t,n.Hf())}function mcn(n,t){var e;return n.b?null:(e=stn(n,n.g),DH(n.a,e),e.i=n,n.d=t,e)}function ycn(n,t,e){OTn(e,"DFS Treeifying phase",1),jdn(n,t),cxn(n,t),n.a=null,n.b=null,HSn(e)}function kcn(n,t,e){this.g=n,this.d=t,this.e=e,this.a=new Np,UCn(this),SQ(),m$(this.a,null)}function jcn(n){this.i=n.gc(),this.i>0&&(this.g=this.ri(this.i+(this.i/8|0)+1),n.Qc(this.g))}function Ecn(n,t){MH.call(this,W$t,n,t),this.b=this,this.a=axn(n.Tg(),itn(this.e.Tg(),this.c))}function Tcn(n,t){var e,i;for(kW(t),i=t.vc().Kc();i.Ob();)e=BB(i.Pb(),42),n.zc(e.cd(),e.dd())}function Mcn(n,t,e){var i;for(i=e.Kc();i.Ob();)if(!G3(n,t,i.Pb()))return!1;return!0}function Scn(n,t,e,i,r){var c;return e&&(c=Awn(t.Tg(),n.c),r=e.gh(t,-1-(-1==c?i:c),null,r)),r}function Pcn(n,t,e,i,r){var c;return e&&(c=Awn(t.Tg(),n.c),r=e.ih(t,-1-(-1==c?i:c),null,r)),r}function Ccn(n){var t;if(-2==n.b){if(0==n.e)t=-1;else for(t=0;0==n.a[t];t++);n.b=t}return n.b}function Icn(n){switch(n.g){case 2:return kUn(),CIt;case 4:return kUn(),oIt;default:return n}}function Ocn(n){switch(n.g){case 1:return kUn(),SIt;case 3:return kUn(),sIt;default:return n}}function Acn(n){var t,e,i;return n.j==(kUn(),sIt)&&(e=SN(t=UOn(n),oIt),(i=SN(t,CIt))||i&&e)}function $cn(n){var t;return new YK(t=BB(n.e&&n.e(),9),BB(VU(t,t.length),9),t.length)}function Lcn(n,t){OTn(t,k1n,1),twn(sM(new Pw((gM(),new HV(n,!1,!1,new Ft))))),HSn(t)}function Ncn(n,t){return hN(),XI(n)?f6(n,SD(t)):UI(n)?Tz(n,MD(t)):zI(n)?Ez(n,TD(t)):n.wd(t)}function xcn(n,t){t.q=n,n.d=e.Math.max(n.d,t.r),n.b+=t.d+(0==n.a.c.length?0:n.c),WB(n.a,t)}function Dcn(n,t){var e,i,r,c;return r=n.c,e=n.c+n.b,c=n.d,i=n.d+n.a,t.a>r&&t.a<e&&t.b>c&&t.b<i}function Rcn(n,t,e,i){cL(n.Cb,179)&&(BB(n.Cb,179).tb=null),Nrn(n,e),t&&_In(n,t),i&&n.xk(!0)}function Kcn(n,t){var e;qQ(e=BB(t,183),"x",n.i),qQ(e,"y",n.j),qQ(e,C6n,n.g),qQ(e,P6n,n.f)}function _cn(){_cn=O,Imt=ogn(jO(dq(dq(new B2,(yMn(),_at),(lWn(),Lot)),Fat,Eot),Bat),$ot)}function Fcn(){Fcn=O,Dmt=ogn(jO(dq(dq(new B2,(yMn(),_at),(lWn(),Lot)),Fat,Eot),Bat),$ot)}function Bcn(){Bcn=O,Xjt=new yC(QZn,0),Wjt=new yC("POLAR_COORDINATE",1),Ujt=new yC("ID",2)}function Hcn(){Hcn=O,Xvt=new UP("EQUALLY",0),Wvt=new UP(mJn,1),Vvt=new UP("NORTH_SOUTH",2)}function qcn(){qcn=O,$vt=lhn((sNn(),Pun(Gk(Dvt,1),$Vn,260,0,[Ivt,Tvt,Pvt,Mvt,Svt,Evt,Cvt,Ovt])))}function Gcn(){Gcn=O,Vst=lhn((kDn(),Pun(Gk(iht,1),$Vn,270,0,[Bst,Gst,Fst,Xst,qst,Hst,Ust,zst])))}function zcn(){zcn=O,EMt=lhn((PPn(),Pun(Gk(SMt,1),$Vn,277,0,[kMt,wMt,vMt,yMt,dMt,gMt,pMt,mMt])))}function Ucn(){Ucn=O,cAt=lhn((hAn(),Pun(Gk(aAt,1),$Vn,237,0,[iAt,nAt,tAt,ZOt,eAt,YOt,QOt,JOt])))}function Xcn(){Xcn=O,Qrt=new iR("debugSVG",(hN(),!1)),Yrt=new iR("overlapsExisted",!0)}function Wcn(n,t){return x7(new ow(n),new sw(t),new hw(t),new tn,Pun(Gk(nit,1),$Vn,132,0,[]))}function Vcn(){var n;return qet||(qet=new Kv,YA(n=new y5(""),(lM(),Het)),frn(qet,n)),qet}function Qcn(n,t){for(yX(t);n.Ob();)if(!Qan(BB(n.Pb(),10)))return!1;return!0}function Ycn(n,t){var e;return!!(e=XRn(cin(),n))&&(Ypn(t,(sWn(),mPt),e),!0)}function Jcn(n,t){var e;for(e=0;e<t.j.c.length;e++)BB(D7(n,e),21).Gc(BB(D7(t,e),14));return n}function Zcn(n,t){var e,i;for(i=new Wb(t.b);i.a<i.c.c.length;)e=BB(n0(i),29),n.a[e.p]=QMn(e)}function nan(n,t){var e,i;for(kW(t),i=n.vc().Kc();i.Ob();)e=BB(i.Pb(),42),t.Od(e.cd(),e.dd())}function tan(n,t){cL(t,83)?(BB(n.c,76).Xj(),ern(n,BB(t,83))):BB(n.c,76).Wb(t)}function ean(n){return cL(n,152)?o6(BB(n,152)):cL(n,131)?BB(n,131).a:cL(n,54)?new fy(n):new CT(n)}function ian(n,t){return t<n.b.gc()?BB(n.b.Xb(t),10):t==n.b.gc()?n.a:BB(xq(n.e,t-n.b.gc()-1),10)}function ran(n,t){n.a=rbn(n.a,1),n.c=e.Math.min(n.c,t),n.b=e.Math.max(n.b,t),n.d=rbn(n.d,t)}function can(n,t){OTn(t,"Edge and layer constraint edge reversal",1),Fzn(LRn(n)),HSn(t)}function aan(n){var t;null==n.d?(++n.e,n.f=0,rfn(null)):(++n.e,t=n.d,n.d=null,n.f=0,rfn(t))}function uan(n){var t;return 0==(t=n.h)?n.l+n.m*IQn:t==PQn?n.l+n.m*IQn-OQn:n}function oan(n){return qD(),n.A.Hc((mdn(),DIt))&&!n.B.Hc((n_n(),UIt))?ndn(n):null}function san(n){if(kW(n),0==n.length)throw Hp(new Mk("Zero length BigInteger"));iKn(this,n)}function han(n){if(!n)throw Hp(new Fy("no calls to next() since the last call to remove()"))}function fan(n){return $Qn<n&&n<OQn?n<0?e.Math.ceil(n):e.Math.floor(n):uan(gNn(n))}function lan(n,t){var e,i,r;for(e=n.c.Ee(),r=t.Kc();r.Ob();)i=r.Pb(),n.a.Od(e,i);return n.b.Kb(e)}function ban(n,t){var e,i,r;if(null!=(e=n.Jg())&&n.Mg())for(i=0,r=e.length;i<r;++i)e[i].ui(t)}function wan(n,t){var e,i;for(i=vW(e=n).e;i;){if((e=i)==t)return!0;i=vW(e).e}return!1}function dan(n,t,e){var i,r;return(i=n.a.f[t.p])<(r=n.a.f[e.p])?-1:i==r?0:1}function gan(n,t,e){var i,r;return r=BB(UK(n.d,t),19),i=BB(UK(n.b,e),19),r&&i?U6(n,r.a,i.a):null}function pan(n,t){var e,i;for(i=new AL(n);i.e!=i.i.gc();)SA(e=BB(kpn(i),33),e.i+t.b,e.j+t.d)}function van(n,t){var e,i;for(i=new Wb(t);i.a<i.c.c.length;)e=BB(n0(i),70),WB(n.d,e),KMn(n,e)}function man(n,t){var e,i;i=new Np,e=t;do{i.c[i.c.length]=e,e=BB(RX(n.k,e),17)}while(e);return i}function yan(n,t){var e;return 0!=(n.Db&t)?-1==(e=Rmn(n,t))?n.Eb:een(n.Eb)[e]:null}function kan(n,t){var e;return(e=new _f).G=t,!n.rb&&(n.rb=new Jz(n,HAt,n)),f9(n.rb,e),e}function jan(n,t){var e;return(e=new Ev).G=t,!n.rb&&(n.rb=new Jz(n,HAt,n)),f9(n.rb,e),e}function Ean(n,t){switch(t){case 1:return!!n.n&&0!=n.n.i;case 2:return null!=n.k}return m0(n,t)}function Tan(n){switch(n.a.g){case 1:return new EI;case 3:return new hyn;default:return new If}}function Man(n){var t;if(n.g>1||n.Ob())return++n.a,n.g=0,t=n.i,n.Ob(),t;throw Hp(new yv)}function San(n){var t;return a$(),uS(syt,n)||((t=new ua).a=n,wR(syt,n,t)),BB(oV(syt,n),635)}function Pan(n){var t,e,i;return e=0,(i=n)<0&&(i+=OQn,e=PQn),t=CJ(i/IQn),M$(CJ(i-t*IQn),t,e)}function Can(n){var t,e,i;for(i=0,e=new QT(n.a);e.a<e.c.a.length;)t=u4(e),n.b.Hc(t)&&++i;return i}function Ian(n){var t,e,i;for(t=1,i=n.Kc();i.Ob();)t=~~(t=31*t+(null==(e=i.Pb())?0:nsn(e)));return t}function Oan(n,t){var e;this.c=n,gmn(n,e=new Np,t,n.b,null,!1,null,!1),this.a=new M2(e,0)}function Aan(n,t){this.b=n,this.e=t,this.d=t.j,this.f=(ZM(),BB(n,66).Oj()),this.k=axn(t.e.Tg(),n)}function $an(n,t,e){this.b=(kW(n),n),this.d=(kW(t),t),this.e=(kW(e),e),this.c=this.d+""+this.e}function Lan(){this.a=BB(mpn((fRn(),qct)),19).a,this.c=Gy(MD(mpn(cat))),this.b=Gy(MD(mpn(tat)))}function Nan(){Nan=O,KCt=lhn((n$n(),Pun(Gk(GCt,1),$Vn,93,0,[ICt,CCt,ACt,DCt,xCt,NCt,$Ct,LCt,OCt])))}function xan(){xan=O,Fit=lhn((tRn(),Pun(Gk(Bit,1),$Vn,250,0,[Rit,$it,Lit,Ait,xit,Dit,Nit,Oit,Iit])))}function Dan(){Dan=O,Rrt=new US("UP",0),Nrt=new US(pJn,1),xrt=new US(cJn,2),Drt=new US(aJn,3)}function Ran(){Ran=O,sZ(),ykt=new $O(X3n,kkt=Rkt),B0(),vkt=new $O(W3n,mkt=Hkt)}function Kan(){Kan=O,jft=new NP("ONE_SIDED",0),Eft=new NP("TWO_SIDED",1),kft=new NP("OFF",2)}function _an(n){n.r=new Rv,n.w=new Rv,n.t=new Np,n.i=new Np,n.d=new Rv,n.a=new bA,n.c=new xp}function Fan(n){this.n=new Np,this.e=new YT,this.j=new YT,this.k=new Np,this.f=new Np,this.p=n}function Ban(n,t){n.c&&(JKn(n,t,!0),JT(new Rq(null,new w1(t,16)),new qd(n))),JKn(n,t,!1)}function Han(n,t,e){return n==(oin(),$mt)?new Pc:0!=H$n(t,1)?new Rj(e.length):new Dj(e.length)}function qan(n,t){var e;return t?((e=t.Ve()).dc()||(n.q?Tcn(n.q,e):n.q=new mO(e)),n):n}function Gan(n,t){var e;return void 0===(e=n.a.get(t))?++n.d:(mR(n.a,t),--n.c,oY(n.b)),e}function zan(n,t){var e;return 0==(e=t.p-n.p)?Pln(n.f.a*n.f.b,t.f.a*t.f.b):e}function Uan(n,t){var e,i;return(e=n.f.c.length)<(i=t.f.c.length)?-1:e==i?0:1}function Xan(n){return 0!=n.b.c.length&&BB(xq(n.b,0),70).a?BB(xq(n.b,0),70).a:eQ(n)}function Wan(n){var t;if(n){if((t=n).dc())throw Hp(new yv);return t.Xb(t.gc()-1)}return u1(n.Kc())}function Van(n){var t;return Vhn(n,0)<0&&(n=uH(n)),64-(0!=(t=dG(kz(n,32)))?ZIn(t):ZIn(dG(n))+32)}function Qan(n){var t;return t=BB(mMn(n,(hWn(),Qft)),61),n.k==(uSn(),Mut)&&(t==(kUn(),CIt)||t==oIt)}function Yan(n,t,e){var i,r;(r=BB(mMn(n,(HXn(),vgt)),74))&&(Wsn(i=new km,0,r),Ztn(i,e),Frn(t,i))}function Jan(n,t,e){var i,r,c,a;i=(a=vW(n)).d,r=a.c,c=n.n,t&&(c.a=c.a-i.b-r.a),e&&(c.b=c.b-i.d-r.b)}function Zan(n,t){var e,i;return(e=n.j)!=(i=t.j)?e.g-i.g:n.p==t.p?0:e==(kUn(),sIt)?n.p-t.p:t.p-n.p}function nun(n){var t,e;for(PUn(n),e=new Wb(n.d);e.a<e.c.c.length;)(t=BB(n0(e),101)).i&&XSn(t)}function tun(n,t,e,i,r){$X(n.c[t.g],e.g,i),$X(n.c[e.g],t.g,i),$X(n.b[t.g],e.g,r),$X(n.b[e.g],t.g,r)}function eun(n,t,e,i){BB(e.b,65),BB(e.b,65),BB(i.b,65),BB(i.b,65),BB(i.b,65),Otn(i.a,new EB(n,t,i))}function iun(n,t){n.d==(Ffn(),_Pt)||n.d==HPt?BB(t.a,57).c.Fc(BB(t.b,57)):BB(t.b,57).c.Fc(BB(t.a,57))}function run(n,t,e,i){return 1==e?(!n.n&&(n.n=new eU(zOt,n,1,7)),_pn(n.n,t,i)):eSn(n,t,e,i)}function cun(n,t){var e;return Nrn(e=new Ho,t),f9((!n.A&&(n.A=new NL(O$t,n,7)),n.A),e),e}function aun(n,t,e){var i,r;return r=N2(t,A6n),pjn((i=new aI(n,e)).a,i.b,r),r}function uun(n){var t;return(!n.a||0==(1&n.Bb)&&n.a.kh())&&cL(t=Ikn(n),148)&&(n.a=BB(t,148)),n.a}function oun(n,t){var e,i;for(kW(t),i=t.Kc();i.Ob();)if(e=i.Pb(),!n.Hc(e))return!1;return!0}function sun(n,t){var e,i,r;return e=n.l+t.l,i=n.m+t.m+(e>>22),r=n.h+t.h+(i>>22),M$(e&SQn,i&SQn,r&PQn)}function hun(n,t){var e,i,r;return e=n.l-t.l,i=n.m-t.m+(e>>22),r=n.h-t.h+(i>>22),M$(e&SQn,i&SQn,r&PQn)}function fun(n){var t;return n<128?(!(t=(Mq(),Mtt)[n])&&(t=Mtt[n]=new Lb(n)),t):new Lb(n)}function lun(n){var t;return cL(n,78)?n:((t=n&&n.__java$exception)||ov(t=new jhn(n)),t)}function bun(n){if(cL(n,186))return BB(n,118);if(n)return null;throw Hp(new Hy(e8n))}function wun(n,t){if(null==t)return!1;for(;n.a!=n.b;)if(Nfn(t,_hn(n)))return!0;return!1}function dun(n){return!!n.a.Ob()||n.a==n.d&&(n.a=new S2(n.e.f),n.a.Ob())}function gun(n,t){var e;return 0!=(e=t.Pc()).length&&(tH(n.c,n.c.length,e),!0)}function pun(n,t,e){var i,r;for(r=t.vc().Kc();r.Ob();)i=BB(r.Pb(),42),n.yc(i.cd(),i.dd(),e);return n}function vun(n,t){var e;for(e=new Wb(n.b);e.a<e.c.c.length;)hon(BB(n0(e),70),(hWn(),ult),t)}function mun(n,t,e){var i,r;for(r=new Wb(n.b);r.a<r.c.c.length;)SA(i=BB(n0(r),33),i.i+t,i.j+e)}function yun(n,t){if(!n)throw Hp(new _y($Rn("value already present: %s",Pun(Gk(Ant,1),HWn,1,5,[t]))))}function kun(n,t){return!(!n||!t||n==t)&&_dn(n.d.c,t.d.c+t.d.b)&&_dn(t.d.c,n.d.c+n.d.b)}function jun(){return k5(),Qet?new y5(null):FOn(Vcn(),"com.google.common.base.Strings")}function Eun(n,t){var e;return e=sx(t.a.gc()),JT(ytn(new Rq(null,new w1(t,1)),n.i),new NC(n,e)),e}function Tun(n){var t;return Nrn(t=new Ho,"T"),f9((!n.d&&(n.d=new NL(O$t,n,11)),n.d),t),t}function Mun(n){var t,e,i,r;for(t=1,e=0,r=n.gc();e<r;++e)t=31*t+(null==(i=n.ki(e))?0:nsn(i));return t}function Sun(n,t,e,i){var r;return w2(t,n.e.Hd().gc()),w2(e,n.c.Hd().gc()),r=n.a[t][e],$X(n.a[t],e,i),r}function Pun(n,t,e,i,r){return r.gm=n,r.hm=t,r.im=I,r.__elementTypeId$=e,r.__elementTypeCategory$=i,r}function Cun(n,t,i,r,c){return jDn(),e.Math.min(zGn(n,t,i,r,c),zGn(i,r,n,t,qx(new xC(c.a,c.b))))}function Iun(){Iun=O,ast=new tP(QZn,0),rst=new tP(C1n,1),cst=new tP(I1n,2),ist=new tP("BOTH",3)}function Oun(){Oun=O,vst=new mP(eJn,0),mst=new mP(cJn,1),yst=new mP(aJn,2),kst=new mP("TOP",3)}function Aun(){Aun=O,Zat=new QS("Q1",0),eut=new QS("Q4",1),nut=new QS("Q2",2),tut=new QS("Q3",3)}function $un(){$un=O,bmt=new QP("OFF",0),wmt=new QP("SINGLE_EDGE",1),lmt=new QP("MULTI_EDGE",2)}function Lun(){Lun=O,WTt=new SC("MINIMUM_SPANNING_TREE",0),XTt=new SC("MAXIMUM_SPANNING_TREE",1)}function Nun(){Nun=O,new up("org.eclipse.elk.addLayoutConfig"),ZTt=new ou,JTt=new au,new uu}function xun(n){var t,e;for(t=new YT,e=spn(n.d,0);e.b!=e.d.c;)DH(t,BB(b3(e),188).c);return t}function Dun(n){var t,e;for(e=new Np,t=n.Kc();t.Ob();)gun(e,wDn(BB(t.Pb(),33)));return e}function Run(n){var t;tBn(n,!0),t=VVn,Lx(n,(HXn(),fpt))&&(t+=BB(mMn(n,fpt),19).a),hon(n,fpt,iln(t))}function Kun(n,t,e){var i;$U(n.a),Otn(e.i,new jg(n)),kgn(n,i=new C$(BB(RX(n.a,t.b),65)),t),e.f=i}function _un(n,t){var e,i;return e=n.c,(i=t.e[n.p])<e.a.c.length-1?BB(xq(e.a,i+1),10):null}function Fun(n,t){var e,i;for(WQ(t,"predicate"),i=0;n.Ob();i++)if(e=n.Pb(),t.Lb(e))return i;return-1}function Bun(n,t){var e,i;if(i=0,n<64&&n<=t)for(t=t<64?t:63,e=n;e<=t;e++)i=i0(i,yz(1,e));return i}function Hun(n){var t,e,i;for(SQ(),i=0,e=n.Kc();e.Ob();)i+=null!=(t=e.Pb())?nsn(t):0,i|=0;return i}function qun(n){var t;return tE(),t=new co,n&&f9((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),t),t}function Gun(n){var t;return(t=new p).a=n,t.b=yon(n),t.c=x8(Qtt,sVn,2,2,6,1),t.c[0]=Hrn(n),t.c[1]=Hrn(n),t}function zun(n,t){if(0===t)return!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),void n.o.c.$b();mPn(n,t)}function Uun(n,t,e){switch(e.g){case 2:n.b=t;break;case 1:n.c=t;break;case 4:n.d=t;break;case 3:n.a=t}}function Xun(n){switch(n.g){case 1:return ECt;case 2:return jCt;case 3:return TCt;default:return MCt}}function Wun(n){switch(BB(mMn(n,(HXn(),kgt)),163).g){case 2:case 4:return!0;default:return!1}}function Vun(){Vun=O,yft=lhn((bDn(),Pun(Gk(Tft,1),$Vn,256,0,[hft,lft,bft,wft,dft,gft,vft,sft,fft,pft])))}function Qun(){Qun=O,JIt=lhn((n_n(),Pun(Gk(iOt,1),$Vn,259,0,[GIt,UIt,qIt,XIt,WIt,QIt,VIt,zIt,HIt])))}function Yun(){Yun=O,Xkt=dq(ogn(ogn(FM(dq(new B2,(zyn(),Kyt),(DPn(),Qyt)),_yt),Xyt),Wyt),Fyt,Vyt)}function Jun(){Jun=O,Aht=new CP(QZn,0),Oht=new CP("INCOMING_ONLY",1),$ht=new CP("OUTGOING_ONLY",2)}function Zun(){Zun=O,ftt={boolean:UT,number:Cy,string:Iy,object:TCn,function:TCn,undefined:Wp}}function non(n,t){vH(n>=0,"Negative initial capacity"),vH(t>=0,"Non-positive load factor"),$U(this)}function ton(n,t,e){return!(n>=128)&&JI(n<64?e0(yz(1,n),e):e0(yz(1,n-64),t),0)}function eon(n,t){return!(!n||!t||n==t)&&Ibn(n.b.c,t.b.c+t.b.b)<0&&Ibn(t.b.c,n.b.c+n.b.b)<0}function ion(n){var t,e,i;return e=n.n,i=n.o,t=n.d,new UV(e.a-t.b,e.b-t.d,i.a+(t.b+t.c),i.b+(t.d+t.a))}function ron(n){var t,e,i,r;for(i=0,r=(e=n.a).length;i<r;++i)Son(n,t=e[i],(kUn(),SIt)),Son(n,t,sIt)}function con(n){var t,e;for(null==n.j&&(n.j=(PY(),Ijn(ett.ce(n)))),t=0,e=n.j.length;t<e;++t);}function aon(n){var t,e;return M$(t=1+~n.l&SQn,e=~n.m+(0==t?1:0)&SQn,~n.h+(0==t&&0==e?1:0)&PQn)}function uon(n,t){return TFn(BB(BB(RX(n.g,t.a),46).a,65),BB(BB(RX(n.g,t.b),46).a,65))}function oon(n,t,e){var i;if(t>(i=n.gc()))throw Hp(new tK(t,i));return n.hi()&&(e=nZ(n,e)),n.Vh(t,e)}function son(n,t,e){return null==e?(!n.q&&(n.q=new xp),v6(n.q,t)):(!n.q&&(n.q=new xp),VW(n.q,t,e)),n}function hon(n,t,e){return null==e?(!n.q&&(n.q=new xp),v6(n.q,t)):(!n.q&&(n.q=new xp),VW(n.q,t,e)),n}function fon(n){var t,e;return qan(e=new y6,n),hon(e,(Mrn(),sat),n),eBn(n,e,t=new xp),Szn(n,e,t),e}function lon(n){var t,e,i;for(jDn(),e=x8(PMt,sVn,8,2,0,1),i=0,t=0;t<2;t++)i+=.5,e[t]=lmn(i,n);return e}function bon(n,t){var e,i,r;for(e=!1,i=n.a[t].length,r=0;r<i-1;r++)e|=Pdn(n,t,r,r+1);return e}function won(n,t,e,i,r){var c,a;for(a=e;a<=r;a++)for(c=t;c<=i;c++)vmn(n,c,a)||FRn(n,c,a,!0,!1)}function don(n,t){this.b=n,NO.call(this,(BB(Wtn(QQ((QX(),t$t).o),10),18),t.i),t.g),this.a=(wcn(),I$t)}function gon(n,t){this.c=n,this.d=t,this.b=this.d/this.c.c.Hd().gc()|0,this.a=this.d%this.c.c.Hd().gc()}function pon(){this.o=null,this.k=null,this.j=null,this.d=null,this.b=null,this.n=null,this.a=null}function von(n,t,i){this.q=new e.Date,this.q.setFullYear(n+sQn,t,i),this.q.setHours(0,0,0,0),lBn(this,0)}function mon(){mon=O,Nvt=new qP(QZn,0),Lvt=new qP("NODES_AND_EDGES",1),xvt=new qP("PREFER_EDGES",2)}function yon(n){var t;return 0==n?"Etc/GMT":(n<0?(n=-n,t="Etc/GMT-"):t="Etc/GMT+",t+bnn(n))}function kon(n){var t;if(n<0)return _Vn;if(0==n)return 0;for(t=OVn;0==(t&n);t>>=1);return t}function jon(n){var t,e;return 32==(e=ZIn(n.h))?32==(t=ZIn(n.m))?ZIn(n.l)+32:t+20-10:e-12}function Eon(n){var t;return null==(t=n.a[n.b])?null:($X(n.a,n.b,null),n.b=n.b+1&n.a.length-1,t)}function Ton(n){var t,e;return t=n.t-n.k[n.o.p]*n.d+n.j[n.o.p]>n.f,e=n.u+n.e[n.o.p]*n.d>n.f*n.s*n.d,t||e}function Mon(n,t,e){var i,r;return i=new H8(t,e),r=new q,n.b=Wxn(n,n.b,i,r),r.b||++n.c,n.b.b=!1,r.d}function Son(n,t,e){var i,r,c;for(c=0,r=Lfn(t,e).Kc();r.Ob();)i=BB(r.Pb(),11),VW(n.c,i,iln(c++))}function Pon(n){var t,e;for(e=new Wb(n.a.b);e.a<e.c.c.length;)(t=BB(n0(e),81)).g.c=-t.g.c-t.g.b;kNn(n)}function Con(n){var t,e;for(e=new Wb(n.a.b);e.a<e.c.c.length;)(t=BB(n0(e),57)).d.c=-t.d.c-t.d.b;yNn(n)}function Ion(n){var t;return(!n.c||0==(1&n.Bb)&&0!=(64&n.c.Db))&&cL(t=Ikn(n),88)&&(n.c=BB(t,26)),n.c}function Oon(n){var t,e,i;t=1+~n.l&SQn,e=~n.m+(0==t?1:0)&SQn,i=~n.h+(0==t&&0==e?1:0)&PQn,n.l=t,n.m=e,n.h=i}function Aon(n){var t,e,i,r,c;for(t=new Gj,r=0,c=(i=n).length;r<c;++r)e=i[r],t.a+=e.a,t.b+=e.b;return t}function $on(n,t){var e,i,r,c,a;for(SQ(),a=!1,r=0,c=(i=t).length;r<c;++r)e=i[r],a|=n.Fc(e);return a}function Lon(n){var t,e;for(jDn(),e=-17976931348623157e292,t=0;t<n.length;t++)n[t]>e&&(e=n[t]);return e}function Non(n,t,e){var i;return jxn(n,t,i=new Np,(kUn(),oIt),!0,!1),jxn(n,e,i,CIt,!1,!1),i}function xon(n,t,e){var i,r;return r=N2(t,"labels"),XAn((i=new gI(n,e)).a,i.b,r),r}function Don(n,t,e,i){var r;return(r=m$n(n,t,e,i))||!(r=aln(n,e,i))||Fqn(n,t,r)?r:null}function Ron(n,t,e,i){var r;return(r=y$n(n,t,e,i))||!(r=uln(n,e,i))||Fqn(n,t,r)?r:null}function Kon(n,t){var e;for(e=0;e<n.a.a.length;e++)if(!BB(Dq(n.a,e),169).Lb(t))return!1;return!0}function _on(n,t,e){if(yX(t),e.Ob())for(sO(t,CX(e.Pb()));e.Ob();)sO(t,n.a),sO(t,CX(e.Pb()));return t}function Fon(n){var t,e,i;for(SQ(),i=1,e=n.Kc();e.Ob();)i=31*i+(null!=(t=e.Pb())?nsn(t):0),i|=0;return i}function Bon(n,t,e,i,r){var c;return c=jAn(n,t),e&&Oon(c),r&&(n=Smn(n,t),ltt=i?aon(n):M$(n.l,n.m,n.h)),c}function Hon(n,t){var e;try{t.Vd()}catch(i){if(!cL(i=lun(i),78))throw Hp(i);e=i,n.c[n.c.length]=e}}function qon(n,t,e){var i,r;return cL(t,144)&&e?(i=BB(t,144),r=e,n.a[i.b][r.b]+n.a[r.b][i.b]):0}function Gon(n,t){switch(t){case 7:return!!n.e&&0!=n.e.i;case 8:return!!n.d&&0!=n.d.i}return fwn(n,t)}function zon(n,t){switch(t.g){case 0:cL(n.b,631)||(n.b=new Lan);break;case 1:cL(n.b,632)||(n.b=new fH)}}function Uon(n,t){for(;null!=n.g||n.c?null==n.g||0!=n.i&&BB(n.g[n.i-1],47).Ob():tZ(n);)vI(t,aLn(n))}function Xon(n,t,e){n.g=APn(n,t,(kUn(),oIt),n.b),n.d=APn(n,e,oIt,n.b),0!=n.g.c&&0!=n.d.c&&zMn(n)}function Won(n,t,e){n.g=APn(n,t,(kUn(),CIt),n.j),n.d=APn(n,e,CIt,n.j),0!=n.g.c&&0!=n.d.c&&zMn(n)}function Von(n,t,e){return!jE(AV(new Rq(null,new w1(n.c,16)),new aw(new ZC(t,e)))).sd((dM(),tit))}function Qon(n){var t;return EW(n),t=new sn,n.a.sd(t)?(CL(),new vy(kW(t.a))):(CL(),CL(),Set)}function Yon(n){var t;return!(n.b<=0)&&((t=GO("MLydhHmsSDkK",YTn(fV(n.c,0))))>1||t>=0&&n.b<3)}function Jon(n){var t,e;for(t=new km,e=spn(n,0);e.b!=e.d.c;)Kx(t,0,new wA(BB(b3(e),8)));return t}function Zon(n){var t;for(t=new Wb(n.a.b);t.a<t.c.c.length;)BB(n0(t),81).f.$b();ky(n.b,n),BNn(n)}function nsn(n){return XI(n)?vvn(n):UI(n)?VO(n):zI(n)?(kW(n),n?1231:1237):iz(n)?n.Hb():AG(n)?PN(n):tY(n)}function tsn(n){return XI(n)?Qtt:UI(n)?Ptt:zI(n)?ktt:iz(n)||AG(n)?n.gm:n.gm||Array.isArray(n)&&Gk(ntt,1)||ntt}function esn(n){if(0===n.g)return new cu;throw Hp(new _y(N4n+(null!=n.f?n.f:""+n.g)))}function isn(n){if(0===n.g)return new iu;throw Hp(new _y(N4n+(null!=n.f?n.f:""+n.g)))}function rsn(n,t,e){if(0===t)return!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),void tan(n.o,e);yCn(n,t,e)}function csn(n,t,e){this.g=n,this.e=new Gj,this.f=new Gj,this.d=new YT,this.b=new YT,this.a=t,this.c=e}function asn(n,t,e,i){this.b=new Np,this.n=new Np,this.i=i,this.j=e,this.s=n,this.t=t,this.r=0,this.d=0}function usn(n){this.e=n,this.d=new p4(this.e.g),this.a=this.d,this.b=dun(this),this.$modCount=n.$modCount}function osn(n){for(;!n.d||!n.d.Ob();){if(!n.b||Wy(n.b))return null;n.d=BB(dU(n.b),47)}return n.d}function ssn(n){return WB(n.c,(Nun(),ZTt)),uen(n.a,Gy(MD(mpn((Rwn(),Vpt)))))?new qu:new Cg(n)}function hsn(n){switch(n.g){case 1:return F3n;default:case 2:return 0;case 3:return JJn;case 4:return B3n}}function fsn(){var n;return wWn(),PNt||(n=ex(ZUn("M",!0)),n=gG(ZUn("M",!1),n),PNt=n)}function lsn(n,t){var e,i,r;for(r=n.b;r;){if(0==(e=n.a.ue(t,r.d)))return r;i=e<0?0:1,r=r.a[i]}return null}function bsn(n,t,e){var i,r;hN(),i=!!TO(e),(r=BB(t.xc(i),15))||(r=new Np,t.zc(i,r)),r.Fc(e)}function wsn(n,t){var e,i;return(e=BB(ZAn(n,(W$n(),dEt)),19).a)==(i=BB(ZAn(t,dEt),19).a)||e<i?-1:e>i?1:0}function dsn(n,t){return!!bNn(n,t)&&(JIn(n.b,BB(mMn(t,(hWn(),Xft)),21),t),DH(n.a,t),!0)}function gsn(n){var t,e;(t=BB(mMn(n,(hWn(),Elt)),10))&&(y7((e=t.c).a,t),0==e.a.c.length&&y7(vW(t).b,e))}function psn(n){return Qet?x8(Get,dYn,572,0,0,1):BB(Qgn(n.a,x8(Get,dYn,572,n.a.c.length,0,1)),842)}function vsn(n,t,e,i){return nV(),new hy(Pun(Gk(Hnt,1),kVn,42,0,[(zvn(n,t),new vT(n,t)),(zvn(e,i),new vT(e,i))]))}function msn(n,t,e){var i;return fin(i=new $m,t,e),f9((!n.q&&(n.q=new eU(QAt,n,11,10)),n.q),i),i}function ysn(n){var t,e,i,r;for(e=(r=fS(AOt,n)).length,i=x8(Qtt,sVn,2,e,6,1),t=0;t<e;++t)i[t]=r[t];return i}function ksn(n,t){var e,i,r,c,a;for(r=0,c=(i=t).length;r<c;++r)e=i[r],a=new UX(n),e.Qe(a),NBn(a);$U(n.f)}function jsn(n,t){var e;return t===n||!!cL(t,224)&&(e=BB(t,224),Nfn(n.Zb(),e.Zb()))}function Esn(n,t){var e;2*t+1>=n.b.c.length||(Esn(n,2*t+1),(e=2*t+2)<n.b.c.length&&Esn(n,e),KCn(n,t))}function Tsn(n,t,e){var i,r;this.g=n,this.c=t,this.a=this,this.d=this,r=Jin(e),i=x8(Qnt,CVn,330,r,0,1),this.b=i}function Msn(n,t,e){var i;for(i=e-1;i>=0&&n[i]===t[i];i--);return i<0?0:sS(e0(n[i],UQn),e0(t[i],UQn))?-1:1}function Ssn(n,t){var e,i;for(i=spn(n,0);i.b!=i.d.c;)(e=BB(b3(i),214)).e.length>0&&(t.td(e),e.i&&pln(e))}function Psn(n,t){var e,i;return i=BB(yan(n.a,4),126),e=x8(dAt,i9n,415,t,0,1),null!=i&&aHn(i,0,e,0,i.length),e}function Csn(n,t){var e;return e=new rRn(0!=(256&n.f),n.i,n.a,n.d,0!=(16&n.f),n.j,n.g,t),null!=n.e||(e.c=n),e}function Isn(n,t){var e;for(e=n.Zb().Cc().Kc();e.Ob();)if(BB(e.Pb(),14).Hc(t))return!0;return!1}function Osn(n,t,e,i,r){var c,a;for(a=e;a<=r;a++)for(c=t;c<=i;c++)if(vmn(n,c,a))return!0;return!1}function Asn(n,t,e){var i,r,c,a;for(kW(e),a=!1,c=n.Zc(t),r=e.Kc();r.Ob();)i=r.Pb(),c.Rb(i),a=!0;return a}function $sn(n,t){var e;return n===t||!!cL(t,83)&&(e=BB(t,83),zSn(lz(n),e.vc()))}function Lsn(n,t,e){var i,r;for(r=e.Kc();r.Ob();)if(i=BB(r.Pb(),42),n.re(t,i.dd()))return!0;return!1}function Nsn(n,t,e){return n.d[t.p][e.p]||(ivn(n,t,e),n.d[t.p][e.p]=!0,n.d[e.p][t.p]=!0),n.a[t.p][e.p]}function xsn(n,t){if(!n.ai()&&null==t)throw Hp(new _y("The 'no null' constraint is violated"));return t}function Dsn(n,t){null==n.D&&null!=n.B&&(n.D=n.B,n.B=null),Hin(n,null==t?null:(kW(t),t)),n.C&&n.yk(null)}function Rsn(n,t){return!(!n||n==t||!Lx(t,(hWn(),rlt)))&&BB(mMn(t,(hWn(),rlt)),10)!=n}function Ksn(n){switch(n.i){case 2:return!0;case 1:return!1;case-1:++n.c;default:return n.pl()}}function _sn(n){switch(n.i){case-2:return!0;case-1:return!1;case 1:--n.c;default:return n.ql()}}function Fsn(n){_J.call(this,"The given string does not match the expected format for individual spacings.",n)}function Bsn(){Bsn=O,uOt=new cI("ELK",0),oOt=new cI("JSON",1),aOt=new cI("DOT",2),sOt=new cI("SVG",3)}function Hsn(){Hsn=O,sjt=new vC(QZn,0),hjt=new vC("RADIAL_COMPACTION",1),fjt=new vC("WEDGE_COMPACTION",2)}function qsn(){qsn=O,zet=new pS("CONCURRENT",0),Uet=new pS("IDENTITY_FINISH",1),Xet=new pS("UNORDERED",2)}function Gsn(){Gsn=O,wM(),oct=new $O(BJn,sct=rct),uct=new up(HJn),hct=new up(qJn),fct=new up(GJn)}function zsn(){zsn=O,lst=new ji,bst=new Ei,fst=new Ti,hst=new Mi,kW(new Si),sst=new D}function Usn(){Usn=O,emt=new WP("CONSERVATIVE",0),imt=new WP("CONSERVATIVE_SOFT",1),rmt=new WP("SLOPPY",2)}function Xsn(){Xsn=O,dCt=new WA(15),wCt=new XA((sWn(),XSt),dCt),gCt=gPt,hCt=aSt,fCt=KSt,bCt=BSt,lCt=FSt}function Wsn(n,t,e){var i,r;for(i=new YT,r=spn(e,0);r.b!=r.d.c;)DH(i,new wA(BB(b3(r),8)));Asn(n,t,i)}function Vsn(n){var t,e,i;for(t=0,i=x8(PMt,sVn,8,n.b,0,1),e=spn(n,0);e.b!=e.d.c;)i[t++]=BB(b3(e),8);return i}function Qsn(n){var t;return!n.a&&(n.a=new eU(WAt,n,9,5)),0!=(t=n.a).i?HM(BB(Wtn(t,0),678)):null}function Ysn(n,t){var e;return e=rbn(n,t),sS(r0(n,t),0)|YI(r0(n,e),0)?e:rbn(bVn,r0(jz(e,63),1))}function Jsn(n,t){var e;e=null!=mpn((Rwn(),Vpt))&&null!=t.wg()?Gy(MD(t.wg()))/Gy(MD(mpn(Vpt))):1,VW(n.b,t,e)}function Zsn(n,t){var e,i;return(e=BB(n.d.Bc(t),14))?((i=n.e.hc()).Gc(e),n.e.d-=e.gc(),e.$b(),i):null}function nhn(n,t){var e,i;if(0!=(i=n.c[t]))for(n.c[t]=0,n.d-=i,e=t+1;e<n.a.length;)n.a[e]-=i,e+=e&-e}function thn(n){var t;if((t=n.a.c.length)>0)return Kz(t-1,n.a.c.length),s6(n.a,t-1);throw Hp(new mv)}function ehn(n,t,e){if(t<0)throw Hp(new Ay(n5n+t));t<n.j.c.length?c5(n.j,t,e):(g3(n,t),WB(n.j,e))}function ihn(n,t,e){if(n>t)throw Hp(new _y(mYn+n+yYn+t));if(n<0||t>e)throw Hp(new Tk(mYn+n+kYn+t+hYn+e))}function rhn(n){if(!n.a||0==(8&n.a.i))throw Hp(new Fy("Enumeration class expected for layout option "+n.f))}function chn(n){var t;++n.j,0==n.i?n.g=null:n.i<n.g.length&&(t=n.g,n.g=n.ri(n.i),aHn(t,0,n.g,0,n.i))}function ahn(n,t){var e,i;for(e=n.a.length-1,n.c=n.c-1&e;t!=n.c;)i=t+1&e,$X(n.a,t,n.a[i]),t=i;$X(n.a,n.c,null)}function uhn(n,t){var e,i;for(e=n.a.length-1;t!=n.b;)i=t-1&e,$X(n.a,t,n.a[i]),t=i;$X(n.a,n.b,null),n.b=n.b+1&e}function ohn(n,t,e){var i;return LZ(t,n.c.length),0!=(i=e.Pc()).length&&(tH(n.c,t,i),!0)}function shn(n){var t,e;if(null==n)return null;for(t=0,e=n.length;t<e;t++)if(!PH(n[t]))return n[t];return null}function hhn(n,t,e){var i,r,c,a;for(c=0,a=(r=e).length;c<a;++c)if(i=r[c],n.b.re(t,i.cd()))return i;return null}function fhn(n){var t,e,i,r,c;for(c=1,i=0,r=(e=n).length;i<r;++i)c=31*c+(null!=(t=e[i])?nsn(t):0),c|=0;return c}function lhn(n){var t,e,i,r,c;for(t={},r=0,c=(i=n).length;r<c;++r)t[":"+(null!=(e=i[r]).f?e.f:""+e.g)]=e;return t}function bhn(n){var t;for(yX(n),C_(!0,"numberToAdvance must be nonnegative"),t=0;t<0&&dAn(n);t++)U5(n);return t}function whn(n){var t,e,i;for(i=0,e=new oz(ZL(n.a.Kc(),new h));dAn(e);)(t=BB(U5(e),17)).c.i==t.d.i||++i;return i}function dhn(n,t){var e,i,r;for(e=n,r=0;;){if(e==t)return r;if(!(i=e.e))throw Hp(new wv);e=vW(i),++r}}function ghn(n,t){var e,i,r;for(r=t-n.f,i=new Wb(n.d);i.a<i.c.c.length;)kdn(e=BB(n0(i),443),e.e,e.f+r);n.f=t}function phn(n,t,i){return e.Math.abs(t-n)<_3n||e.Math.abs(i-n)<_3n||(t-n>_3n?n-i>_3n:i-n>_3n)}function vhn(n,t){return n?t&&!n.j||cL(n,124)&&0==BB(n,124).a.b?0:n.Re():0}function mhn(n,t){return n?t&&!n.k||cL(n,124)&&0==BB(n,124).a.a?0:n.Se():0}function yhn(n){return ODn(),n<0?-1!=n?new Rpn(-1,-n):Ytt:n<=10?Ztt[CJ(n)]:new Rpn(1,n)}function khn(n){throw Zun(),Hp(new gy("Unexpected typeof result '"+n+"'; please report this bug to the GWT team"))}function jhn(n){hk(),V$(this),jQ(this),this.e=n,Cxn(this,n),this.g=null==n?zWn:Bbn(n),this.a="",this.b=n,this.a=""}function Ehn(){this.a=new nu,this.f=new dg(this),this.b=new gg(this),this.i=new pg(this),this.e=new vg(this)}function Thn(){cy.call(this,new q8(etn(16))),lin(2,oVn),this.b=2,this.a=new HW(null,null,0,null),iv(this.a,this.a)}function Mhn(){Mhn=O,cvt=new KP("DUMMY_NODE_OVER",0),avt=new KP("DUMMY_NODE_UNDER",1),uvt=new KP("EQUAL",2)}function Shn(){Shn=O,Xat=HJ(Pun(Gk(WPt,1),$Vn,103,0,[(Ffn(),_Pt),FPt])),Wat=HJ(Pun(Gk(WPt,1),$Vn,103,0,[HPt,KPt]))}function Phn(n){return(kUn(),yIt).Hc(n.j)?Gy(MD(mMn(n,(hWn(),Llt)))):Aon(Pun(Gk(PMt,1),sVn,8,0,[n.i.n,n.n,n.a])).b}function Chn(n){var t,e;for(t=n.b.a.a.ec().Kc();t.Ob();)e=new Q$n(BB(t.Pb(),561),n.e,n.f),WB(n.g,e)}function Ihn(n,t){var e,i;e=n.nk(t,null),i=null,t&&(iE(),cen(i=new Kp,n.r)),(e=HTn(n,i,e))&&e.Fi()}function Ohn(n,t){var e,i;for(i=0!=H$n(n.d,1),e=!0;e;)e=!1,e=t.c.Tf(t.e,i),e|=DNn(n,t,i,!1),i=!i;$rn(n)}function Ahn(n,t){var e,i,r;return i=!1,e=t.q.d,t.d<n.b&&(r=dNn(t.q,n.b),t.q.d>r&&(aEn(t.q,r),i=e!=t.q.d)),i}function $hn(n,t){var i,r,c,a,u;return a=t.i,u=t.j,r=a-(i=n.f).i,c=u-i.j,e.Math.sqrt(r*r+c*c)}function Lhn(n,t){var e;return(e=Ydn(n))||(!$Ot&&($Ot=new Oo),RHn(),f9((e=new Cp(YPn(t))).Vk(),n)),e}function Nhn(n,t){var e,i;return(e=BB(n.c.Bc(t),14))?((i=n.hc()).Gc(e),n.d-=e.gc(),e.$b(),n.mc(i)):n.jc()}function xhn(n,t){var e;for(e=0;e<t.length;e++)if(n==(b1(e,t.length),t.charCodeAt(e)))return!0;return!1}function Dhn(n,t){var e;for(e=0;e<t.length;e++)if(n==(b1(e,t.length),t.charCodeAt(e)))return!0;return!1}function Rhn(n){var t,e;if(null==n)return!1;for(t=0,e=n.length;t<e;t++)if(!PH(n[t]))return!1;return!0}function Khn(n){var t;if(0!=n.c)return n.c;for(t=0;t<n.a.length;t++)n.c=33*n.c+(-1&n.a[t]);return n.c=n.c*n.e,n.c}function _hn(n){var t;return Px(n.a!=n.b),t=n.d.a[n.a],Ex(n.b==n.d.c&&null!=t),n.c=n.a,n.a=n.a+1&n.d.a.length-1,t}function Fhn(n){var t;if(!(n.c.c<0?n.a>=n.c.b:n.a<=n.c.b))throw Hp(new yv);return t=n.a,n.a+=n.c.c,++n.b,iln(t)}function Bhn(n){var t;return t=new ftn(n),i2(n.a,sut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[t]))),t.d&&WB(t.f,t.d),t.f}function Hhn(n){var t;return qan(t=new O$(n.a),n),hon(t,(hWn(),dlt),n),t.o.a=n.g,t.o.b=n.f,t.n.a=n.i,t.n.b=n.j,t}function qhn(n,t,e,i){var r,c;for(c=n.Kc();c.Ob();)(r=BB(c.Pb(),70)).n.a=t.a+(i.a-r.o.a)/2,r.n.b=t.b,t.b+=r.o.b+e}function Ghn(n,t,e){var i;for(i=t.a.a.ec().Kc();i.Ob();)if(cY(n,BB(i.Pb(),57),e))return!0;return!1}function zhn(n){var t,e;for(e=new Wb(n.r);e.a<e.c.c.length;)if(t=BB(n0(e),10),n.n[t.p]<=0)return t;return null}function Uhn(n){var t,e;for(e=new Rv,t=new Wb(n);t.a<t.c.c.length;)Frn(e,dDn(BB(n0(t),33)));return e}function Xhn(n){var t;return t=kA(Cmt),BB(mMn(n,(hWn(),Zft)),21).Hc((bDn(),dft))&&dq(t,(yMn(),_at),(lWn(),Bot)),t}function Whn(n,t,e){var i;i=new MOn(n,t),JIn(n.r,t.Hf(),i),e&&!Hz(n.u)&&(i.c=new yJ(n.d),Otn(t.wf(),new Cw(i)))}function Vhn(n,t){var e;return JO(n)&&JO(t)&&(e=n-t,!isNaN(e))?e:Kkn(JO(n)?Pan(n):n,JO(t)?Pan(t):t)}function Qhn(n,t){return t<n.length&&(b1(t,n.length),63!=n.charCodeAt(t))&&(b1(t,n.length),35!=n.charCodeAt(t))}function Yhn(n,t,e,i){var r,c;n.a=t,c=i?0:1,n.f=(r=new ZSn(n.c,n.a,e,c),new uRn(e,n.a,r,n.e,n.b,n.c==(oin(),Amt)))}function Jhn(n,t,e){var i,r;return r=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,1,r,t),e?e.Ei(i):e=i),e}function Zhn(n,t,e){var i,r;return r=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,3,r,t),e?e.Ei(i):e=i),e}function nfn(n,t,e){var i,r;return r=n.f,n.f=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,0,r,t),e?e.Ei(i):e=i),e}function tfn(n,t){var e,i,r,c;return(c=kCn((i=t,(r=n?Ydn(n):null)&&r.Xk(),i)))==t&&(e=Ydn(n))&&e.Xk(),c}function efn(n,t){var e,i,r;for(r=1,e=n,i=t>=0?t:-t;i>0;)i%2==0?(e*=e,i=i/2|0):(r*=e,i-=1);return t<0?1/r:r}function ifn(n,t){var e,i,r;for(r=1,e=n,i=t>=0?t:-t;i>0;)i%2==0?(e*=e,i=i/2|0):(r*=e,i-=1);return t<0?1/r:r}function rfn(n){var t,e,i,r;if(null!=n)for(e=0;e<n.length;++e)if(t=n[e])for(BB(t.g,367),r=t.i,i=0;i<r;++i);}function cfn(n){var t,i,r;for(r=0,i=new Wb(n.a);i.a<i.c.c.length;)t=BB(n0(i),187),r=e.Math.max(r,t.g);return r}function afn(n){var t,e,i;for(i=new Wb(n.b);i.a<i.c.c.length;)(t=(e=BB(n0(i),214)).c.Rf()?e.f:e.a)&&wqn(t,e.j)}function ufn(){ufn=O,vCt=new HC("INHERIT",0),pCt=new HC("INCLUDE_CHILDREN",1),mCt=new HC("SEPARATE_CHILDREN",2)}function ofn(n,t){switch(t){case 1:return!n.n&&(n.n=new eU(zOt,n,1,7)),void sqn(n.n);case 2:return void $in(n,null)}zun(n,t)}function sfn(n){switch(n.gc()){case 0:return Fnt;case 1:return new Pq(yX(n.Xb(0)));default:return new SY(n)}}function hfn(n){switch(s_(),n.gc()){case 0:return VX(),Vnt;case 1:return new yk(n.Kc().Pb());default:return new vS(n)}}function ffn(n){switch(s_(),n.c){case 0:return VX(),Vnt;case 1:return new yk(JCn(new QT(n)));default:return new sy(n)}}function lfn(n,t){yX(n);try{return n.xc(t)}catch(e){if(cL(e=lun(e),205)||cL(e,173))return null;throw Hp(e)}}function bfn(n,t){yX(n);try{return n.Bc(t)}catch(e){if(cL(e=lun(e),205)||cL(e,173))return null;throw Hp(e)}}function wfn(n,t){yX(n);try{return n.Hc(t)}catch(e){if(cL(e=lun(e),205)||cL(e,173))return!1;throw Hp(e)}}function dfn(n,t){yX(n);try{return n.Mc(t)}catch(e){if(cL(e=lun(e),205)||cL(e,173))return!1;throw Hp(e)}}function gfn(n,t){yX(n);try{return n._b(t)}catch(e){if(cL(e=lun(e),205)||cL(e,173))return!1;throw Hp(e)}}function pfn(n,t){n.a.c.length>0&&dsn(BB(xq(n.a,n.a.c.length-1),570),t)||WB(n.a,new p5(t))}function vfn(n){var t,e;G_(),t=n.d.c-n.e.c,Otn((e=BB(n.g,145)).b,new jd(t)),Otn(e.c,new Ed(t)),e5(e.i,new Td(t))}function mfn(n){var t;return(t=new Ck).a+="VerticalSegment ",uO(t,n.e),t.a+=" ",oO(t,JL(new mk,new Wb(n.k))),t.a}function yfn(n){var t;return(t=BB(lnn(n.c.c,""),229))||(t=new UZ(jj(kj(new pu,""),"Other")),Jgn(n.c.c,"",t)),t}function kfn(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (name: ",cO(t,n.zb),t.a+=")",t.a)}function jfn(n,t,e){var i,r;return r=n.sb,n.sb=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,4,r,t),e?e.Ei(i):e=i),e}function Efn(n,t){var e,i;for(e=0,i=abn(n,t).Kc();i.Ob();)e+=null!=mMn(BB(i.Pb(),11),(hWn(),Elt))?1:0;return e}function Tfn(n,t,e){var i,r,c;for(i=0,c=spn(n,0);c.b!=c.d.c&&!((r=Gy(MD(b3(c))))>e);)r>=t&&++i;return i}function Mfn(n,t,e){var i;return i=new N7(n.e,3,13,null,t.c||(gWn(),l$t),uvn(n,t),!1),e?e.Ei(i):e=i,e}function Sfn(n,t,e){var i;return i=new N7(n.e,4,13,t.c||(gWn(),l$t),null,uvn(n,t),!1),e?e.Ei(i):e=i,e}function Pfn(n,t,e){var i,r;return r=n.r,n.r=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,8,r,n.r),e?e.Ei(i):e=i),e}function Cfn(n,t){var e,i;return!(i=(e=BB(t,676)).vk())&&e.wk(i=cL(t,88)?new $I(n,BB(t,26)):new _0(n,BB(t,148))),i}function Ifn(n,t,e){var i;n.qi(n.i+1),i=n.oi(t,e),t!=n.i&&aHn(n.g,t,n.g,t+1,n.i-t),$X(n.g,t,i),++n.i,n.bi(t,e),n.ci()}function Ofn(n,t){var e;return t.a&&(e=t.a.a.length,n.a?oO(n.a,n.b):n.a=new lN(n.d),G0(n.a,t.a,t.d.length,e)),n}function Afn(n,t){var e,i,r;if(t.vi(n.a),null!=(r=BB(yan(n.a,8),1936)))for(e=0,i=r.length;e<i;++e)null.jm()}function $fn(n,t){var e;return e=new sn,n.a.sd(e)?(CL(),new vy(kW(T7(n,e.a,t)))):(EW(n),CL(),CL(),Set)}function Lfn(n,t){switch(t.g){case 2:case 1:return abn(n,t);case 3:case 4:return ean(abn(n,t))}return SQ(),SQ(),set}function Nfn(n,t){return XI(n)?mK(n,t):UI(n)?vK(n,t):zI(n)?(kW(n),GI(n)===GI(t)):iz(n)?n.Fb(t):AG(n)?FO(n,t):v0(n,t)}function xfn(n){return n?0!=(1&n.i)?n==$Nt?ktt:n==ANt?Att:n==DNt?Ctt:n==xNt?Ptt:n==LNt?Rtt:n==RNt?_tt:n==NNt?Ttt:Stt:n:null}function Dfn(n,t,e,i,r){0!=t&&0!=i&&(1==t?r[i]=dvn(r,e,i,n[0]):1==i?r[t]=dvn(r,n,t,e[0]):YOn(n,e,r,t,i))}function Rfn(n,t){var e;0!=n.c.length&&(hA(e=BB(Qgn(n,x8(Out,a1n,10,n.c.length,0,1)),193),new Oe),eOn(e,t))}function Kfn(n,t){var e;0!=n.c.length&&(hA(e=BB(Qgn(n,x8(Out,a1n,10,n.c.length,0,1)),193),new Ae),eOn(e,t))}function _fn(n,t,e,i){switch(t){case 1:return!n.n&&(n.n=new eU(zOt,n,1,7)),n.n;case 2:return n.k}return Eyn(n,t,e,i)}function Ffn(){Ffn=O,BPt=new KC(hJn,0),FPt=new KC(aJn,1),_Pt=new KC(cJn,2),KPt=new KC(pJn,3),HPt=new KC("UP",4)}function Bfn(){Bfn=O,wut=new YS(QZn,0),but=new YS("INSIDE_PORT_SIDE_GROUPS",1),lut=new YS("FORCE_MODEL_ORDER",2)}function Hfn(n,t,e){if(n<0||t>e)throw Hp(new Ay(mYn+n+kYn+t+", size: "+e));if(n>t)throw Hp(new _y(mYn+n+yYn+t))}function qfn(n,t,e){if(t<0)cIn(n,e);else{if(!e.Ij())throw Hp(new _y(r6n+e.ne()+c6n));BB(e,66).Nj().Vj(n,n.yh(),t)}}function Gfn(n,t,e,i,r,c,a,u){var o;for(o=e;c<a;)o>=i||t<e&&u.ue(n[t],n[o])<=0?$X(r,c++,n[t++]):$X(r,c++,n[o++])}function zfn(n,t,e,i,r,c){this.e=new Np,this.f=(ain(),Gvt),WB(this.e,n),this.d=t,this.a=e,this.b=i,this.f=r,this.c=c}function Ufn(n,t){var e,i;for(i=new AL(n);i.e!=i.i.gc();)if(e=BB(kpn(i),26),GI(t)===GI(e))return!0;return!1}function Xfn(n){var t,e,i,r;for(dWn(),i=0,r=(e=tpn()).length;i<r;++i)if(-1!=E7((t=e[i]).a,n,0))return t;return Irt}function Wfn(n){return n>=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:n>=48&&n<=57?n-48:0}function Vfn(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (source: ",cO(t,n.d),t.a+=")",t.a)}function Qfn(n,t,e){var i,r;return r=n.a,n.a=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,5,r,n.a),e?KEn(e,i):e=i),e}function Yfn(n,t){var e;e=0!=(256&n.Bb),t?n.Bb|=256:n.Bb&=-257,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,2,e,t))}function Jfn(n,t){var e;e=0!=(256&n.Bb),t?n.Bb|=256:n.Bb&=-257,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,8,e,t))}function Zfn(n,t){var e;e=0!=(256&n.Bb),t?n.Bb|=256:n.Bb&=-257,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,8,e,t))}function nln(n,t){var e;e=0!=(512&n.Bb),t?n.Bb|=512:n.Bb&=-513,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,3,e,t))}function tln(n,t){var e;e=0!=(512&n.Bb),t?n.Bb|=512:n.Bb&=-513,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,9,e,t))}function eln(n,t){var e;return-1==n.b&&n.a&&(e=n.a.Gj(),n.b=e?n.c.Xg(n.a.aj(),e):Awn(n.c.Tg(),n.a)),n.c.Og(n.b,t)}function iln(n){var t,e;return n>-129&&n<128?(t=n+128,!(e=(tq(),Itt)[t])&&(e=Itt[t]=new xb(n)),e):new xb(n)}function rln(n){var t,e;return n>-129&&n<128?(t=n+128,!(e=(Tq(),Ktt)[t])&&(e=Ktt[t]=new Rb(n)),e):new Rb(n)}function cln(n){var t;return n.k==(uSn(),Mut)&&((t=BB(mMn(n,(hWn(),Qft)),61))==(kUn(),sIt)||t==SIt)}function aln(n,t,e){var i,r;return(r=$$n(n.b,t))&&(i=BB(NHn(F7(n,r),""),26))?m$n(n,i,t,e):null}function uln(n,t,e){var i,r;return(r=$$n(n.b,t))&&(i=BB(NHn(F7(n,r),""),26))?y$n(n,i,t,e):null}function oln(n,t){var e,i;for(i=new AL(n);i.e!=i.i.gc();)if(e=BB(kpn(i),138),GI(t)===GI(e))return!0;return!1}function sln(n,t,e){var i;if(t>(i=n.gc()))throw Hp(new tK(t,i));if(n.hi()&&n.Hc(e))throw Hp(new _y(a8n));n.Xh(t,e)}function hln(n,t){var e;if(null==(e=sen(n.i,t)))throw Hp(new ek("Node did not exist in input."));return Kcn(t,e),null}function fln(n,t){var e;if(cL(e=NNn(n,t),322))return BB(e,34);throw Hp(new _y(r6n+t+"' is not a valid attribute"))}function lln(n,t,e){var i,r;for(r=cL(t,99)&&0!=(BB(t,18).Bb&BQn)?new xO(t,n):new Aan(t,n),i=0;i<e;++i)cvn(r);return r}function bln(n){var t,e,i;for(i=0,e=n.length,t=0;t<e;t++)32==n[t]||13==n[t]||10==n[t]||9==n[t]||(n[i++]=n[t]);return i}function wln(n){var t,e,i;for(t=new Np,i=new Wb(n.b);i.a<i.c.c.length;)e=BB(n0(i),594),gun(t,BB(e.jf(),14));return t}function dln(n){var t,e;for(e=BB(mMn(n,(qqn(),lkt)),15).Kc();e.Ob();)DH((t=BB(e.Pb(),188)).b.d,t),DH(t.c.b,t)}function gln(n){switch(BB(mMn(n,(hWn(),ilt)),303).g){case 1:hon(n,ilt,(z7(),Sft));break;case 2:hon(n,ilt,(z7(),Cft))}}function pln(n){var t;n.g&&(xxn((t=n.c.Rf()?n.f:n.a).a,n.o,!0),xxn(t.a,n.o,!1),hon(n.o,(HXn(),ept),(QEn(),UCt)))}function vln(n){var t;if(!n.a)throw Hp(new Fy("Cannot offset an unassigned cut."));t=n.c-n.b,n.b+=t,xQ(n,t),NQ(n,t)}function mln(n){var t;return null==(t=n.a[n.c-1&n.a.length-1])?null:(n.c=n.c-1&n.a.length-1,$X(n.a,n.c,null),t)}function yln(n){var t,e;for(e=n.p.a.ec().Kc();e.Ob();)if((t=BB(e.Pb(),213)).f&&n.b[t.c]<-1e-10)return t;return null}function kln(n,t){switch(n.b.g){case 0:case 1:return t;case 2:case 3:return new UV(t.d,0,t.a,t.b);default:return null}}function jln(n){switch(n.g){case 2:return FPt;case 1:return _Pt;case 4:return KPt;case 3:return HPt;default:return BPt}}function Eln(n){switch(n.g){case 1:return CIt;case 2:return sIt;case 3:return oIt;case 4:return SIt;default:return PIt}}function Tln(n){switch(n.g){case 1:return SIt;case 2:return CIt;case 3:return sIt;case 4:return oIt;default:return PIt}}function Mln(n){switch(n.g){case 1:return oIt;case 2:return SIt;case 3:return CIt;case 4:return sIt;default:return PIt}}function Sln(n){switch(n){case 0:return new mm;case 1:return new pm;case 2:return new vm;default:throw Hp(new wv)}}function Pln(n,t){return n<t?-1:n>t?1:n==t?0==n?Pln(1/n,1/t):0:isNaN(n)?isNaN(t)?0:1:-1}function Cln(n,t){OTn(t,"Sort end labels",1),JT(AV(wnn(new Rq(null,new w1(n.b,16)),new we),new de),new ge),HSn(t)}function Iln(n,t,e){var i,r;return n.ej()?(r=n.fj(),i=YIn(n,t,e),n.$i(n.Zi(7,iln(e),i,t,r)),i):YIn(n,t,e)}function Oln(n,t){var e,i,r;null==n.d?(++n.e,--n.f):(r=t.cd(),N6(n,i=((e=t.Sh())&DWn)%n.d.length,A$n(n,i,e,r)))}function Aln(n,t){var e;e=0!=(n.Bb&k6n),t?n.Bb|=k6n:n.Bb&=-1025,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,10,e,t))}function $ln(n,t){var e;e=0!=(n.Bb&_Qn),t?n.Bb|=_Qn:n.Bb&=-4097,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,12,e,t))}function Lln(n,t){var e;e=0!=(n.Bb&T9n),t?n.Bb|=T9n:n.Bb&=-8193,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,15,e,t))}function Nln(n,t){var e;e=0!=(n.Bb&M9n),t?n.Bb|=M9n:n.Bb&=-2049,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,11,e,t))}function xln(n,t){var e;return 0!=(e=Pln(n.b.c,t.b.c))||0!=(e=Pln(n.a.a,t.a.a))?e:Pln(n.a.b,t.a.b)}function Dln(n,t){var e;if(null==(e=RX(n.k,t)))throw Hp(new ek("Port did not exist in input."));return Kcn(t,e),null}function Rln(n){var t,e;for(e=G$n(Utn(n)).Kc();e.Ob();)if(N_n(n,t=SD(e.Pb())))return y4((UM(),RAt),t);return null}function Kln(n,t){var e,i,r,c,a;for(a=axn(n.e.Tg(),t),c=0,e=BB(n.g,119),r=0;r<n.i;++r)i=e[r],a.rl(i.ak())&&++c;return c}function _ln(n,t,e){var i,r;return i=BB(t.We(n.a),35),r=BB(e.We(n.a),35),null!=i&&null!=r?Ncn(i,r):null!=i?-1:null!=r?1:0}function Fln(n,t,e){var i;if(n.c)lMn(n.c,t,e);else for(i=new Wb(n.b);i.a<i.c.c.length;)Fln(BB(n0(i),157),t,e)}function Bln(n,t){var e,i;for(i=new Wb(t);i.a<i.c.c.length;)e=BB(n0(i),46),y7(n.b.b,e.b),uY(BB(e.a,189),BB(e.b,81))}function Hln(n){var t,e;for(e=xX(new Ck,91),t=!0;n.Ob();)t||(e.a+=FWn),t=!1,uO(e,n.Pb());return(e.a+="]",e).a}function qln(n,t){var e;e=0!=(n.Bb&hVn),t?n.Bb|=hVn:n.Bb&=-16385,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,16,e,t))}function Gln(n,t){var e;e=0!=(n.Bb&h6n),t?n.Bb|=h6n:n.Bb&=-32769,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,18,e,t))}function zln(n,t){var e;e=0!=(n.Bb&h6n),t?n.Bb|=h6n:n.Bb&=-32769,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,18,e,t))}function Uln(n,t){var e;e=0!=(n.Bb&BQn),t?n.Bb|=BQn:n.Bb&=-65537,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new t6(n,1,20,e,t))}function Xln(n){var t;return t=x8(ONt,WVn,25,2,15,1),n-=BQn,t[0]=(n>>10)+HQn&QVn,t[1]=56320+(1023&n)&QVn,Bdn(t,0,t.length)}function Wln(n){var t;return(t=BB(mMn(n,(HXn(),Udt)),103))==(Ffn(),BPt)?Gy(MD(mMn(n,Edt)))>=1?FPt:KPt:t}function Vln(n){switch(BB(mMn(n,(HXn(),Zdt)),218).g){case 1:return new ic;case 3:return new oc;default:return new ec}}function Qln(n){if(n.c)Qln(n.c);else if(n.d)throw Hp(new Fy("Stream already terminated, can't be modified or used"))}function Yln(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (identifier: ",cO(t,n.k),t.a+=")",t.a)}function Jln(n,t,e){var i;return tE(),jen(i=new ro,t),Een(i,e),n&&f9((!n.a&&(n.a=new $L(xOt,n,5)),n.a),i),i}function Zln(n,t,e,i){var r,c;return kW(i),kW(e),null==(c=null==(r=n.xc(t))?e:ZT(BB(r,15),BB(e,14)))?n.Bc(t):n.zc(t,c),c}function nbn(n){var t,e,i,r;return orn(e=new YK(t=BB(Vj((r=(i=n.gm).f)==Unt?i:r),9),BB(SR(t,t.length),9),0),n),e}function tbn(n,t,e){var i,r;for(r=n.a.ec().Kc();r.Ob();)if(i=BB(r.Pb(),10),oun(e,BB(xq(t,i.p),14)))return i;return null}function ebn(n,t,e){try{_on(n,t,e)}catch(i){throw cL(i=lun(i),597)?Hp(new g5(i)):Hp(i)}return t}function ibn(n,t){var e;return JO(n)&&JO(t)&&$Qn<(e=n-t)&&e<OQn?e:uan(hun(JO(n)?Pan(n):n,JO(t)?Pan(t):t))}function rbn(n,t){var e;return JO(n)&&JO(t)&&$Qn<(e=n+t)&&e<OQn?e:uan(sun(JO(n)?Pan(n):n,JO(t)?Pan(t):t))}function cbn(n,t){var e;return JO(n)&&JO(t)&&$Qn<(e=n*t)&&e<OQn?e:uan(fqn(JO(n)?Pan(n):n,JO(t)?Pan(t):t))}function abn(n,t){var e;return n.i||eIn(n),(e=BB(oV(n.g,t),46))?new s1(n.j,BB(e.a,19).a,BB(e.b,19).a):(SQ(),SQ(),set)}function ubn(n,t,e){var i;return i=n.a.get(t),n.a.set(t,void 0===e?null:e),void 0===i?(++n.c,oY(n.b)):++n.d,i}function obn(n,t,i){n.n=kq(LNt,[sVn,FQn],[364,25],14,[i,CJ(e.Math.ceil(t/32))],2),n.o=t,n.p=i,n.j=t-1>>1,n.k=i-1>>1}function sbn(){var n,t,i;yTn(),i=Let+++Date.now(),n=CJ(e.Math.floor(i*uYn))&sYn,t=CJ(i-n*oYn),this.a=1502^n,this.b=t^aYn}function hbn(n){var t,e;for(t=new Np,e=new Wb(n.j);e.a<e.c.c.length;)WB(t,BB(n0(e),11).b);return yX(t),new OO(t)}function fbn(n){var t,e;for(t=new Np,e=new Wb(n.j);e.a<e.c.c.length;)WB(t,BB(n0(e),11).e);return yX(t),new OO(t)}function lbn(n){var t,e;for(t=new Np,e=new Wb(n.j);e.a<e.c.c.length;)WB(t,BB(n0(e),11).g);return yX(t),new OO(t)}function bbn(n){var t,e;for(e=t$n(Utn(dZ(n))).Kc();e.Ob();)if(N_n(n,t=SD(e.Pb())))return k4((XM(),UAt),t);return null}function wbn(n){var t,e;for(t=0,e=n.length;t<e;t++)if(null==n[t])throw Hp(new Hy("at index "+t));return new Jy(n)}function dbn(n,t){var e;if(cL(e=NNn(n.Tg(),t),99))return BB(e,18);throw Hp(new _y(r6n+t+"' is not a valid reference"))}function gbn(n){var t;return(t=bSn(n))>34028234663852886e22?RQn:t<-34028234663852886e22?KQn:t}function pbn(n){return n=((n=((n-=n>>1&1431655765)>>2&858993459)+(858993459&n))>>4)+n&252645135,n+=n>>8,63&(n+=n>>16)}function vbn(n){var t,e,i;for(t=new hR(n.Hd().gc()),i=0,e=L9(n.Hd().Kc());e.Ob();)jZ(t,e.Pb(),iln(i++));return NSn(t.a)}function mbn(n,t){var e,i,r;for(r=new xp,i=t.vc().Kc();i.Ob();)VW(r,(e=BB(i.Pb(),42)).cd(),lan(n,BB(e.dd(),15)));return r}function ybn(n,t){0==n.n.c.length&&WB(n.n,new RJ(n.s,n.t,n.i)),WB(n.b,t),smn(BB(xq(n.n,n.n.c.length-1),211),t),BFn(n,t)}function kbn(n){return n.c==n.b.b&&n.i==n.g.b||(n.a.c=x8(Ant,HWn,1,0,5,1),gun(n.a,n.b),gun(n.a,n.g),n.c=n.b.b,n.i=n.g.b),n.a}function jbn(n,t){var e,i;for(i=0,e=BB(t.Kb(n),20).Kc();e.Ob();)qy(TD(mMn(BB(e.Pb(),17),(hWn(),Clt))))||++i;return i}function Ebn(n,t){var i,r;r=Gy(MD(edn(f2(t),(HXn(),ypt)))),Fkn(t,i=e.Math.max(0,r/2-.5),1),WB(n,new lP(t,i))}function Tbn(){Tbn=O,qlt=new BP(QZn,0),_lt=new BP("FIRST",1),Flt=new BP(C1n,2),Blt=new BP("LAST",3),Hlt=new BP(I1n,4)}function Mbn(){Mbn=O,ZPt=new FC(hJn,0),YPt=new FC("POLYLINE",1),QPt=new FC("ORTHOGONAL",2),JPt=new FC("SPLINES",3)}function Sbn(){Sbn=O,Zjt=new kC("ASPECT_RATIO_DRIVEN",0),nEt=new kC("MAX_SCALE_DRIVEN",1),Jjt=new kC("AREA_DRIVEN",2)}function Pbn(){Pbn=O,HEt=new EC("P1_STRUCTURE",0),qEt=new EC("P2_PROCESSING_ORDER",1),GEt=new EC("P3_EXECUTION",2)}function Cbn(){Cbn=O,ejt=new gC("OVERLAP_REMOVAL",0),njt=new gC("COMPACTION",1),tjt=new gC("GRAPH_SIZE_CALCULATION",2)}function Ibn(n,t){return h$(),rin(KVn),e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:n<t?-1:n>t?1:zO(isNaN(n),isNaN(t))}function Obn(n,t){var e,i;for(e=spn(n,0);e.b!=e.d.c;){if((i=zy(MD(b3(e))))==t)return;if(i>t){U0(e);break}}nX(e,t)}function Abn(n,t){var e,i,r,c,a;if(e=t.f,Jgn(n.c.d,e,t),null!=t.g)for(c=0,a=(r=t.g).length;c<a;++c)i=r[c],Jgn(n.c.e,i,t)}function $bn(n,t,e,i){var r,c,a;for(r=t+1;r<e;++r)for(c=r;c>t&&i.ue(n[c-1],n[c])>0;--c)a=n[c],$X(n,c,n[c-1]),$X(n,c-1,a)}function Lbn(n,t,e,i){if(t<0)TLn(n,e,i);else{if(!e.Ij())throw Hp(new _y(r6n+e.ne()+c6n));BB(e,66).Nj().Tj(n,n.yh(),t,i)}}function Nbn(n,t){if(t==n.d)return n.e;if(t==n.e)return n.d;throw Hp(new _y("Node "+t+" not part of edge "+n))}function xbn(n,t){switch(t.g){case 2:return n.b;case 1:return n.c;case 4:return n.d;case 3:return n.a;default:return!1}}function Dbn(n,t){switch(t.g){case 2:return n.b;case 1:return n.c;case 4:return n.d;case 3:return n.a;default:return!1}}function Rbn(n,t,e,i){switch(t){case 3:return n.f;case 4:return n.g;case 5:return n.i;case 6:return n.j}return _fn(n,t,e,i)}function Kbn(n){return n.k==(uSn(),Cut)&&o5(new Rq(null,new zU(new oz(ZL(lbn(n).a.Kc(),new h)))),new qr)}function _bn(n){return null==n.e?n:(!n.c&&(n.c=new rRn(0!=(256&n.f),n.i,n.a,n.d,0!=(16&n.f),n.j,n.g,null)),n.c)}function Fbn(n,t){return n.h==CQn&&0==n.m&&0==n.l?(t&&(ltt=M$(0,0,0)),WO((X7(),dtt))):(t&&(ltt=M$(n.l,n.m,n.h)),M$(0,0,0))}function Bbn(n){return Array.isArray(n)&&n.im===I?nE(tsn(n))+"@"+(nsn(n)>>>0).toString(16):n.toString()}function Hbn(n){var t;this.a=new YK(t=BB(n.e&&n.e(),9),BB(SR(t,t.length),9),0),this.b=x8(Ant,HWn,1,this.a.a.length,5,1)}function qbn(n){var t,e,i;for(this.a=new fA,i=new Wb(n);i.a<i.c.c.length;)e=BB(n0(i),14),brn(t=new hG,e),TU(this.a,t)}function Gbn(n){var t,e;for(qD(),t=n.o.b,e=BB(BB(h6(n.r,(kUn(),SIt)),21),84).Kc();e.Ob();)BB(e.Pb(),111).e.b+=t}function zbn(n){var t;if(n.b){if(zbn(n.b),n.b.d!=n.c)throw Hp(new vv)}else n.d.dc()&&(t=BB(n.f.c.xc(n.e),14))&&(n.d=t)}function Ubn(n){var t;return null==n||(t=n.length)>0&&(b1(t-1,n.length),58==n.charCodeAt(t-1))&&!Xbn(n,LAt,NAt)}function Xbn(n,t,e){var i,r;for(i=0,r=n.length;i<r;i++)if(ton((b1(i,n.length),n.charCodeAt(i)),t,e))return!0;return!1}function Wbn(n,t){var e,i;for(i=n.e.a.ec().Kc();i.Ob();)if(tSn(t,(e=BB(i.Pb(),266)).d)||ICn(t,e.d))return!0;return!1}function Vbn(n,t){var e,i,r;for(r=(i=HRn(n,t))[i.length-1]/2,e=0;e<i.length;e++)if(i[e]>=r)return t.c+e;return t.c+t.b.gc()}function Qbn(n,t){var e,i,r,c;for(dD(),r=t,z9(i=H9(n),0,i.length,r),e=0;e<i.length;e++)e!=(c=gkn(n,i[e],e))&&Iln(n,e,c)}function Ybn(n,t){var e,i,r,c,a,u;for(i=0,e=0,a=0,u=(c=t).length;a<u;++a)(r=c[a])>0&&(i+=r,++e);return e>1&&(i+=n.d*(e-1)),i}function Jbn(n){var t,e,i;for((i=new Sk).a+="[",t=0,e=n.gc();t<e;)cO(i,kN(n.ki(t))),++t<e&&(i.a+=FWn);return i.a+="]",i.a}function Zbn(n){var t,e,i;return i=ATn(n),!WE(n.c)&&(rtn(i,"knownLayouters",e=new Cl),t=new rp(e),e5(n.c,t)),i}function nwn(n,t){var e,i;for(kW(t),e=!1,i=new Wb(n);i.a<i.c.c.length;)ywn(t,n0(i),!1)&&(AU(i),e=!0);return e}function twn(n){var t,e;for(e=Gy(MD(n.a.We((sWn(),OPt)))),t=new Wb(n.a.xf());t.a<t.c.c.length;)VUn(n,BB(n0(t),680),e)}function ewn(n,t){var e,i;for(i=new Wb(t);i.a<i.c.c.length;)e=BB(n0(i),46),WB(n.b.b,BB(e.b,81)),g2(BB(e.a,189),BB(e.b,81))}function iwn(n,t,e){var i,r;for(i=(r=n.a.b).c.length;i<e;i++)kG(r,0,new HX(n.a));PZ(t,BB(xq(r,r.c.length-e),29)),n.b[t.p]=e}function rwn(n,t,e){var i;!(i=e)&&(i=LH(new Xm,0)),OTn(i,qZn,2),mvn(n.b,t,mcn(i,1)),Kqn(n,t,mcn(i,1)),qUn(t,mcn(i,1)),HSn(i)}function cwn(n,t,e,i,r){BZ(),UNn(aM(cM(rM(uM(new Hv,0),r.d.e-n),t),r.d)),UNn(aM(cM(rM(uM(new Hv,0),e-r.a.e),r.a),i))}function awn(n,t,e,i,r,c){this.a=n,this.c=t,this.b=e,this.f=i,this.d=r,this.e=c,this.c>0&&this.b>0&&Yq(this.c,this.b,this.a)}function uwn(n){Rwn(),this.c=u6(Pun(Gk(rMt,1),HWn,831,0,[Wpt])),this.b=new xp,this.a=n,VW(this.b,Vpt,1),Otn(Qpt,new Pg(this))}function own(n,t){var e;return n.d?hU(n.b,t)?BB(RX(n.b,t),51):(e=t.Kf(),VW(n.b,t,e),e):t.Kf()}function swn(n,t){var e;return GI(n)===GI(t)||!!cL(t,91)&&(e=BB(t,91),n.e==e.e&&n.d==e.d&&E4(n,e.a))}function hwn(n){switch(kUn(),n.g){case 4:return sIt;case 1:return oIt;case 3:return SIt;case 2:return CIt;default:return PIt}}function fwn(n,t){switch(t){case 3:return 0!=n.f;case 4:return 0!=n.g;case 5:return 0!=n.i;case 6:return 0!=n.j}return Ean(n,t)}function lwn(n){switch(n.g){case 0:return new Ga;case 1:return new za;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function bwn(n){switch(n.g){case 0:return new qa;case 1:return new Ua;default:throw Hp(new _y(M1n+(null!=n.f?n.f:""+n.g)))}}function wwn(n){switch(n.g){case 0:return new Vm;case 1:return new ym;default:throw Hp(new _y(N4n+(null!=n.f?n.f:""+n.g)))}}function dwn(n){switch(n.g){case 1:return new Ra;case 2:return new gD;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function gwn(n){var t,e;if(n.b)return n.b;for(e=Qet?null:n.d;e;){if(t=Qet?null:e.b)return t;e=Qet?null:e.d}return lM(),Het}function pwn(n){var t,e;return 0==n.e?0:(t=n.d<<5,e=n.a[n.d-1],n.e<0&&Ccn(n)==n.d-1&&(--e,e|=0),t-=ZIn(e))}function vwn(n){var t,e,i;return n<tet.length?tet[n]:(t=31&n,(i=x8(ANt,hQn,25,1+(e=n>>5),15,1))[e]=1<<t,new lU(1,e+1,i))}function mwn(n){var t,e,i;return(e=n.zg())?cL(t=n.Ug(),160)&&null!=(i=mwn(BB(t,160)))?i+"."+e:e:null}function ywn(n,t,e){var i,r;for(r=n.Kc();r.Ob();)if(i=r.Pb(),GI(t)===GI(i)||null!=t&&Nfn(t,i))return e&&r.Qb(),!0;return!1}function kwn(n,t,e){var i,r;if(++n.j,e.dc())return!1;for(r=e.Kc();r.Ob();)i=r.Pb(),n.Hi(t,n.oi(t,i)),++t;return!0}function jwn(n,t,e,i){var r,c;if((c=e-t)<3)for(;c<3;)n*=10,++c;else{for(r=1;c>3;)r*=10,--c;n=(n+(r>>1))/r|0}return i.i=n,!0}function Ewn(n){return Shn(),hN(),!!(Dbn(BB(n.a,81).j,BB(n.b,103))||0!=BB(n.a,81).d.e&&Dbn(BB(n.a,81).j,BB(n.b,103)))}function Twn(n){x9(),BB(n.We((sWn(),qSt)),174).Hc((n_n(),VIt))&&(BB(n.We(fPt),174).Fc((lIn(),cIt)),BB(n.We(qSt),174).Mc(VIt))}function Mwn(n,t){var e;if(t){for(e=0;e<n.i;++e)if(BB(n.g[e],366).Di(t))return!1;return f9(n,t)}return!1}function Swn(n){var t,e,i;for(t=new Cl,i=new qb(n.b.Kc());i.b.Ob();)e=VSn(BB(i.b.Pb(),686)),WU(t,t.a.length,e);return t.a}function Pwn(n){var t;return!n.c&&(n.c=new Nn),m$(n.d,new Dn),YKn(n),t=lDn(n),JT(new Rq(null,new w1(n.d,16)),new Iw(n)),t}function Cwn(n){var t;return 0!=(64&n.Db)?kfn(n):((t=new fN(kfn(n))).a+=" (instanceClassName: ",cO(t,n.D),t.a+=")",t.a)}function Iwn(n,t){var e,i;t&&(e=Ren(t,"x"),Ten(new Zg(n).a,(kW(e),e)),i=Ren(t,"y"),Oen(new np(n).a,(kW(i),i)))}function Own(n,t){var e,i;t&&(e=Ren(t,"x"),Ien(new Vg(n).a,(kW(e),e)),i=Ren(t,"y"),Aen(new Yg(n).a,(kW(i),i)))}function Awn(n,t){var e,i,r;if(null==n.i&&qFn(n),e=n.i,-1!=(i=t.aj()))for(r=e.length;i<r;++i)if(e[i]==t)return i;return-1}function $wn(n){var t,e,i,r;for(e=BB(n.g,674),i=n.i-1;i>=0;--i)for(t=e[i],r=0;r<i;++r)if(vFn(n,t,e[r])){Lyn(n,i);break}}function Lwn(n){var t=n.e;function e(n){return n&&0!=n.length?"\t"+n.join("\n\t"):""}return t&&(t.stack||e(n[UVn]))}function Nwn(n){var t;switch(WX(),(t=n.Pc()).length){case 0:return Fnt;case 1:return new Pq(yX(t[0]));default:return new SY(wbn(t))}}function xwn(n,t){switch(t.g){case 1:return KB(n.j,(gcn(),Nut));case 2:return KB(n.j,(gcn(),Dut));default:return SQ(),SQ(),set}}function Dwn(n,t){switch(t){case 3:return void Men(n,0);case 4:return void Sen(n,0);case 5:return void Pen(n,0);case 6:return void Cen(n,0)}ofn(n,t)}function Rwn(){Rwn=O,AM(),HXn(),Vpt=Opt,Qpt=u6(Pun(Gk(lMt,1),k3n,146,0,[mpt,ypt,jpt,Ept,Spt,Ppt,Cpt,Ipt,$pt,Npt,kpt,Tpt,Apt]))}function Kwn(n){var t,e;t=n.d==($Pn(),Jst),e=$En(n),hon(n.a,(HXn(),kdt),t&&!e||!t&&e?(wvn(),$Mt):(wvn(),AMt))}function _wn(n,t){var e;return(e=BB(P4(n,m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15)).Qc(lH(e.gc()))}function Fwn(){Fwn=O,eOt=new YC("SIMPLE",0),ZIt=new YC("GROUP_DEC",1),tOt=new YC("GROUP_MIXED",2),nOt=new YC("GROUP_INC",3)}function Bwn(){Bwn=O,z$t=new $o,K$t=new Lo,_$t=new No,F$t=new xo,B$t=new Do,H$t=new Ro,q$t=new Ko,G$t=new _o,U$t=new Fo}function Hwn(n,t,e){qtn(),sm.call(this),this.a=kq(Xit,[sVn,rJn],[595,212],0,[nrt,Zit],2),this.c=new bA,this.g=n,this.f=t,this.d=e}function qwn(n,t){this.n=kq(LNt,[sVn,FQn],[364,25],14,[t,CJ(e.Math.ceil(n/32))],2),this.o=n,this.p=t,this.j=n-1>>1,this.k=t-1>>1}function Gwn(n,t){OTn(t,"End label post-processing",1),JT(AV(wnn(new Rq(null,new w1(n.b,16)),new ae),new ue),new oe),HSn(t)}function zwn(n,t,e){var i;return i=Gy(n.p[t.i.p])+Gy(n.d[t.i.p])+t.n.b+t.a.b,Gy(n.p[e.i.p])+Gy(n.d[e.i.p])+e.n.b+e.a.b-i}function Uwn(n,t,e){var i,r;for(i=e0(e,UQn),r=0;0!=Vhn(i,0)&&r<t;r++)i=rbn(i,e0(n[r],UQn)),n[r]=dG(i),i=kz(i,32);return dG(i)}function Xwn(n){var t,e,i,r;for(r=0,e=0,i=n.length;e<i;e++)b1(e,n.length),(t=n.charCodeAt(e))<64&&(r=i0(r,yz(1,t)));return r}function Wwn(n){var t;return null==n?null:new $A((t=FBn(n,!0)).length>0&&(b1(0,t.length),43==t.charCodeAt(0))?t.substr(1):t)}function Vwn(n){var t;return null==n?null:new $A((t=FBn(n,!0)).length>0&&(b1(0,t.length),43==t.charCodeAt(0))?t.substr(1):t)}function Qwn(n,t){return n.i>0&&(t.length<n.i&&(t=Den(tsn(t).c,n.i)),aHn(n.g,0,t,0,n.i)),t.length>n.i&&$X(t,n.i,null),t}function Ywn(n,t,e){var i,r,c;return n.ej()?(i=n.i,c=n.fj(),Ifn(n,i,t),r=n.Zi(3,null,t,i,c),e?e.Ei(r):e=r):Ifn(n,n.i,t),e}function Jwn(n,t,e){var i,r;return i=new N7(n.e,4,10,cL(r=t.c,88)?BB(r,26):(gWn(),d$t),null,uvn(n,t),!1),e?e.Ei(i):e=i,e}function Zwn(n,t,e){var i,r;return i=new N7(n.e,3,10,null,cL(r=t.c,88)?BB(r,26):(gWn(),d$t),uvn(n,t),!1),e?e.Ei(i):e=i,e}function ndn(n){var t;return qD(),t=new wA(BB(n.e.We((sWn(),BSt)),8)),n.B.Hc((n_n(),GIt))&&(t.a<=0&&(t.a=20),t.b<=0&&(t.b=20)),t}function tdn(n){return bvn(),(n.q?n.q:(SQ(),SQ(),het))._b((HXn(),Rgt))?BB(mMn(n,Rgt),197):BB(mMn(vW(n),Kgt),197)}function edn(n,t){var e,i;return i=null,Lx(n,(HXn(),Mpt))&&(e=BB(mMn(n,Mpt),94)).Xe(t)&&(i=e.We(t)),null==i&&(i=mMn(vW(n),t)),i}function idn(n,t){var e,i,r;return!!cL(t,42)&&(i=(e=BB(t,42)).cd(),wW(r=lfn(n.Rc(),i),e.dd())&&(null!=r||n.Rc()._b(i)))}function rdn(n,t){var e;return n.f>0&&(n.qj(),-1!=A$n(n,((e=null==t?0:nsn(t))&DWn)%n.d.length,e,t))}function cdn(n,t){var e,i;return n.f>0&&(n.qj(),e=aOn(n,((i=null==t?0:nsn(t))&DWn)%n.d.length,i,t))?e.dd():null}function adn(n,t){var e,i,r,c;for(c=axn(n.e.Tg(),t),e=BB(n.g,119),r=0;r<n.i;++r)if(i=e[r],c.rl(i.ak()))return!1;return!0}function udn(n){if(null==n.b){for(;n.a.Ob();)if(n.b=n.a.Pb(),!BB(n.b,49).Zg())return!0;return n.b=null,!1}return!0}function odn(n,t){n.mj();try{n.d.Vc(n.e++,t),n.f=n.d.j,n.g=-1}catch(e){throw cL(e=lun(e),73)?Hp(new vv):Hp(e)}}function sdn(n,t){var e,i;return s$(),i=null,t==(e=fR((fk(),fk(),rtt)))&&(i=BB(SJ(itt,n),615)),i||(i=new zX(n),t==e&&mZ(itt,n,i)),i}function hdn(n,t){var i,r;n.a=rbn(n.a,1),n.c=e.Math.min(n.c,t),n.b=e.Math.max(n.b,t),n.d+=t,i=t-n.f,r=n.e+i,n.f=r-n.e-i,n.e=r}function fdn(n,t){var e;n.c=t,n.a=pwn(t),n.a<54&&(n.f=(e=t.d>1?i0(yz(t.a[1],32),e0(t.a[0],UQn)):e0(t.a[0],UQn),j2(cbn(t.e,e))))}function ldn(n,t){var e;return JO(n)&&JO(t)&&$Qn<(e=n%t)&&e<OQn?e:uan((Aqn(JO(n)?Pan(n):n,JO(t)?Pan(t):t,!0),ltt))}function bdn(n,t){var e;Dzn(t),(e=BB(mMn(n,(HXn(),Jdt)),276))&&hon(n,Jdt,Ayn(e)),nx(n.c),nx(n.f),V6(n.d),V6(BB(mMn(n,Agt),207))}function wdn(n){this.e=x8(ANt,hQn,25,n.length,15,1),this.c=x8($Nt,ZYn,25,n.length,16,1),this.b=x8($Nt,ZYn,25,n.length,16,1),this.f=0}function ddn(n){var t,e;for(n.j=x8(xNt,qQn,25,n.p.c.length,15,1),e=new Wb(n.p);e.a<e.c.c.length;)t=BB(n0(e),10),n.j[t.p]=t.o.b/n.i}function gdn(n){var t;0!=n.c&&(1==(t=BB(xq(n.a,n.b),287)).b?(++n.b,n.b<n.a.c.length&&Tb(BB(xq(n.a,n.b),287))):--t.b,--n.c)}function pdn(n){var t;t=n.a;do{(t=BB(U5(new oz(ZL(lbn(t).a.Kc(),new h))),17).d.i).k==(uSn(),Put)&&WB(n.e,t)}while(t.k==(uSn(),Put))}function vdn(){vdn=O,LIt=new WA(15),$It=new XA((sWn(),XSt),LIt),xIt=new XA(LPt,15),NIt=new XA(vPt,iln(0)),AIt=new XA(cSt,dZn)}function mdn(){mdn=O,KIt=new VC("PORTS",0),_It=new VC("PORT_LABELS",1),RIt=new VC("NODE_LABELS",2),DIt=new VC("MINIMUM_SIZE",3)}function ydn(n,t){var e,i;for(i=t.length,e=0;e<i;e+=2)Yxn(n,(b1(e,t.length),t.charCodeAt(e)),(b1(e+1,t.length),t.charCodeAt(e+1)))}function kdn(n,t,e){var i,r,c,a;for(c=t-n.e,a=e-n.f,r=new Wb(n.a);r.a<r.c.c.length;)Tvn(i=BB(n0(r),187),i.s+c,i.t+a);n.e=t,n.f=e}function jdn(n,t){var e,i,r;for(r=t.b.b,n.a=new YT,n.b=x8(ANt,hQn,25,r,15,1),e=0,i=spn(t.b,0);i.b!=i.d.c;)BB(b3(i),86).g=e++}function Edn(n,t){var e,i,r,c;return e=t>>5,t&=31,r=n.d+e+(0==t?0:1),xTn(i=x8(ANt,hQn,25,r,15,1),n.a,e,t),X0(c=new lU(n.e,r,i)),c}function Tdn(n,t,e){var i,r;i=BB(SJ(iNt,t),117),r=BB(SJ(rNt,t),117),e?(mZ(iNt,n,i),mZ(rNt,n,r)):(mZ(rNt,n,i),mZ(iNt,n,r))}function Mdn(n,t,e){var i,r,c;for(r=null,c=n.b;c;){if(i=n.a.ue(t,c.d),e&&0==i)return c;i>=0?c=c.a[1]:(r=c,c=c.a[0])}return r}function Sdn(n,t,e){var i,r,c;for(r=null,c=n.b;c;){if(i=n.a.ue(t,c.d),e&&0==i)return c;i<=0?c=c.a[0]:(r=c,c=c.a[1])}return r}function Pdn(n,t,e,i){var r,c,a;return r=!1,LGn(n.f,e,i)&&(xgn(n.f,n.a[t][e],n.a[t][i]),a=(c=n.a[t])[i],c[i]=c[e],c[e]=a,r=!0),r}function Cdn(n,t,e,i,r){var c,a,u;for(a=r;t.b!=t.c;)c=BB(dU(t),10),u=BB(abn(c,i).Xb(0),11),n.d[u.p]=a++,e.c[e.c.length]=u;return a}function Idn(n,t,i){var r,c,a,u,o;return u=n.k,o=t.k,c=MD(edn(n,r=i[u.g][o.g])),a=MD(edn(t,r)),e.Math.max((kW(c),c),(kW(a),a))}function Odn(n,t,e){var i,r,c,a;for(i=e/n.c.length,r=0,a=new Wb(n);a.a<a.c.c.length;)ghn(c=BB(n0(a),200),c.f+i*r),ajn(c,t,i),++r}function Adn(n,t,e){var i,r,c;for(r=BB(RX(n.b,e),177),i=0,c=new Wb(t.j);c.a<c.c.c.length;)r[BB(n0(c),113).d.p]&&++i;return i}function $dn(n){var t,e;return null!=(t=BB(yan(n.a,4),126))?(aHn(t,0,e=x8(dAt,i9n,415,t.length,0,1),0,t.length),e):wAt}function Ldn(){var n;return 0!=ctt&&(n=l5())-att>2e3&&(att=n,utt=e.setTimeout(QE,10)),0==ctt++&&(Onn((sk(),ttt)),!0)}function Ndn(n,t){var e;for(e=new oz(ZL(lbn(n).a.Kc(),new h));dAn(e);)if(BB(U5(e),17).d.i.c==t)return!1;return!0}function xdn(n,t){var e;if(cL(t,245)){e=BB(t,245);try{return 0==n.vd(e)}catch(i){if(!cL(i=lun(i),205))throw Hp(i)}}return!1}function Ddn(){return Error.stackTraceLimit>0?(e.Error.stackTraceLimit=Error.stackTraceLimit=64,!0):"stack"in new Error}function Rdn(n,t){return h$(),h$(),rin(KVn),(e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:n<t?-1:n>t?1:zO(isNaN(n),isNaN(t)))>0}function Kdn(n,t){return h$(),h$(),rin(KVn),(e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:n<t?-1:n>t?1:zO(isNaN(n),isNaN(t)))<0}function _dn(n,t){return h$(),h$(),rin(KVn),(e.Math.abs(n-t)<=KVn||n==t||isNaN(n)&&isNaN(t)?0:n<t?-1:n>t?1:zO(isNaN(n),isNaN(t)))<=0}function Fdn(n,t){for(var e=0;!t[e]||""==t[e];)e++;for(var i=t[e++];e<t.length;e++)t[e]&&""!=t[e]&&(i+=n+t[e]);return i}function Bdn(n,t,i){var r,c,a,u;for(_8(t,a=t+i,n.length),u="",c=t;c<a;)r=e.Math.min(c+1e4,a),u+=WW(n.slice(c,r)),c=r;return u}function Hdn(n){var t,e,i,r;if(null==n)return null;for(r=new Np,e=0,i=(t=ysn(n)).length;e<i;++e)WB(r,FBn(t[e],!0));return r}function qdn(n){var t,e,i,r;if(null==n)return null;for(r=new Np,e=0,i=(t=ysn(n)).length;e<i;++e)WB(r,FBn(t[e],!0));return r}function Gdn(n){var t,e,i,r;if(null==n)return null;for(r=new Np,e=0,i=(t=ysn(n)).length;e<i;++e)WB(r,FBn(t[e],!0));return r}function zdn(n,t){var e,i,r;if(n.c)Sen(n.c,t);else for(e=t-iG(n),r=new Wb(n.d);r.a<r.c.c.length;)zdn(i=BB(n0(r),157),iG(i)+e)}function Udn(n,t){var e,i,r;if(n.c)Men(n.c,t);else for(e=t-eG(n),r=new Wb(n.a);r.a<r.c.c.length;)Udn(i=BB(n0(r),157),eG(i)+e)}function Xdn(n,t){var e,i,r;for(i=new J6(t.gc()),e=t.Kc();e.Ob();)(r=t_n(n,BB(e.Pb(),56)))&&(i.c[i.c.length]=r);return i}function Wdn(n,t){var e,i;return n.qj(),(e=aOn(n,((i=null==t?0:nsn(t))&DWn)%n.d.length,i,t))?(hin(n,e),e.dd()):null}function Vdn(n){var t,e;for(e=uPn(n),t=null;2==n.c;)QXn(n),t||(wWn(),wWn(),tqn(t=new r$(2),e),e=t),e.$l(uPn(n));return e}function Qdn(n){if(!(q6n in n.a))throw Hp(new ek("Every element must have an id."));return kIn(zJ(n,q6n))}function Ydn(n){var t,e,i;if(!(i=n.Zg()))for(t=0,e=n.eh();e;e=e.eh()){if(++t>GQn)return e.fh();if((i=e.Zg())||e==n)break}return i}function Jdn(n){return hZ(),cL(n,156)?BB(RX(hAt,yet),288).vg(n):hU(hAt,tsn(n))?BB(RX(hAt,tsn(n)),288).vg(n):null}function Zdn(n){if(mgn(a5n,n))return hN(),vtt;if(mgn(u5n,n))return hN(),ptt;throw Hp(new _y("Expecting true or false"))}function ngn(n,t){if(t.c==n)return t.d;if(t.d==n)return t.c;throw Hp(new _y("Input edge is not connected to the input port."))}function tgn(n,t){return n.e>t.e?1:n.e<t.e?-1:n.d>t.d?n.e:n.d<t.d?-t.e:n.e*Msn(n.a,t.a,n.d)}function egn(n){return n>=48&&n<48+e.Math.min(10,10)?n-48:n>=97&&n<97?n-97+10:n>=65&&n<65?n-65+10:-1}function ign(n,t){var e;return GI(t)===GI(n)||!!cL(t,21)&&(e=BB(t,21)).gc()==n.gc()&&n.Ic(e)}function rgn(n,t){var e,i,r;return i=n.a.length-1,e=t-n.b&i,r=n.c-t&i,Ex(e<(n.c-n.b&i)),e>=r?(ahn(n,t),-1):(uhn(n,t),1)}function cgn(n,t){var e,i;for(b1(t,n.length),e=n.charCodeAt(t),i=t+1;i<n.length&&(b1(i,n.length),n.charCodeAt(i)==e);)++i;return i-t}function agn(n){switch(n.g){case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:return!0;default:return!1}}function ugn(n,t){var e,i=n.a;t=String(t),i.hasOwnProperty(t)&&(e=i[t]);var r=(Zun(),ftt)[typeof e];return r?r(e):khn(typeof e)}function ogn(n,t){if(n.a<0)throw Hp(new Fy("Did not call before(...) or after(...) before calling add(...)."));return WN(n,n.a,t),n}function sgn(n,t,e,i){var r;0!=t.c.length&&(r=MLn(e,i),JT(ytn(new Rq(null,new w1(uIn(t),1)),new ja),new XV(n,e,r,i)))}function hgn(n,t,e){var i;0!=(n.Db&t)?null==e?WOn(n,t):-1==(i=Rmn(n,t))?n.Eb=e:$X(een(n.Eb),i,e):null!=e&&mxn(n,t,e)}function fgn(n){var t;return 0==(32&n.Db)&&0!=(t=bX(BB(yan(n,16),26)||n.zh())-bX(n.zh()))&&hgn(n,32,x8(Ant,HWn,1,t,5,1)),n}function lgn(n){var t;return n.b||Xj(n,!(t=nK(n.e,n.a))||!mK(u5n,cdn((!t.b&&(t.b=new Jx((gWn(),k$t),X$t,t)),t.b),"qualified"))),n.c}function bgn(n,t,e){var i,r;return((r=(i=BB(Wtn(H7(n.a),t),87)).c||(gWn(),l$t)).kh()?tfn(n.b,BB(r,49)):r)==e?lFn(i):cen(i,e),r}function wgn(n,t){(t||null==console.groupCollapsed?null!=console.group?console.group:console.log:console.groupCollapsed).call(console,n)}function dgn(n,t,e,i){BB(e.b,65),BB(e.b,65),BB(i.b,65),BB(i.b,65).c.b,K8(i,t,n)}function ggn(n){var t,e;for(t=new Wb(n.g);t.a<t.c.c.length;)BB(n0(t),562);zzn(e=new yxn(n.g,Gy(n.a),n.c)),n.g=e.b,n.d=e.a}function pgn(n,t,i){t.b=e.Math.max(t.b,-i.a),t.c=e.Math.max(t.c,i.a-n.a),t.d=e.Math.max(t.d,-i.b),t.a=e.Math.max(t.a,i.b-n.b)}function vgn(n,t){return n.e<t.e?-1:n.e>t.e?1:n.f<t.f?-1:n.f>t.f?1:nsn(n)-nsn(t)}function mgn(n,t){return kW(n),null!=t&&(!!mK(n,t)||n.length==t.length&&mK(n.toLowerCase(),t.toLowerCase()))}function ygn(n,t){var e,i,r,c;for(i=0,r=t.gc();i<r;++i)cL(e=t.il(i),99)&&0!=(BB(e,18).Bb&h6n)&&null!=(c=t.jl(i))&&t_n(n,BB(c,56))}function kgn(n,t,e){var i,r,c;for(c=new Wb(e.a);c.a<c.c.c.length;)r=BB(n0(c),221),i=new C$(BB(RX(n.a,r.b),65)),WB(t.a,i),kgn(n,i,r)}function jgn(n){var t,e;return Vhn(n,-129)>0&&Vhn(n,128)<0?(t=dG(n)+128,!(e=(Eq(),$tt)[t])&&(e=$tt[t]=new Db(n)),e):new Db(n)}function Egn(n,t){var e,i;return(e=t.Hh(n.a))&&null!=(i=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),t8n)))?i:t.ne()}function Tgn(n,t){var e,i;return(e=t.Hh(n.a))&&null!=(i=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),t8n)))?i:t.ne()}function Mgn(n,t){var e,i;for(qZ(),i=new oz(ZL(hbn(n).a.Kc(),new h));dAn(i);)if((e=BB(U5(i),17)).d.i==t||e.c.i==t)return e;return null}function Sgn(n,t,e){this.c=n,this.f=new Np,this.e=new Gj,this.j=new Sq,this.n=new Sq,this.b=t,this.g=new UV(t.c,t.d,t.b,t.a),this.a=e}function Pgn(n){var t,e,i,r;for(this.a=new fA,this.d=new Rv,this.e=0,i=0,r=(e=n).length;i<r;++i)t=e[i],!this.f&&(this.f=t),g2(this,t)}function Cgn(n){ODn(),0==n.length?(this.e=0,this.d=1,this.a=Pun(Gk(ANt,1),hQn,25,15,[0])):(this.e=1,this.d=n.length,this.a=n,X0(this))}function Ign(n,t,e){sm.call(this),this.a=x8(Xit,rJn,212,(Dtn(),Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length,0,1),this.b=n,this.d=t,this.c=e}function Ogn(n){this.d=new Np,this.e=new v4,this.c=x8(ANt,hQn,25,(kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,15,1),this.b=n}function Agn(n){var t,e,i,r;for(hon(r=BB(mMn(n,(hWn(),dlt)),11),Llt,n.i.n.b),e=0,i=(t=Z0(n.e)).length;e<i;++e)MZ(t[e],r)}function $gn(n){var t,e,i,r;for(hon(t=BB(mMn(n,(hWn(),dlt)),11),Llt,n.i.n.b),i=0,r=(e=Z0(n.g)).length;i<r;++i)SZ(e[i],t)}function Lgn(n){var t,e;return!!Lx(n.d.i,(HXn(),Wgt))&&(t=BB(mMn(n.c.i,Wgt),19),e=BB(mMn(n.d.i,Wgt),19),E$(t.a,e.a)>0)}function Ngn(n){var t;GI(ZAn(n,(sWn(),ESt)))===GI((ufn(),vCt))&&(JJ(n)?(t=BB(ZAn(JJ(n),ESt),334),Ypn(n,ESt,t)):Ypn(n,ESt,mCt))}function xgn(n,t,e){var i,r;fMn(n.e,t,e,(kUn(),CIt)),fMn(n.i,t,e,oIt),n.a&&(r=BB(mMn(t,(hWn(),dlt)),11),i=BB(mMn(e,dlt),11),k0(n.g,r,i))}function Dgn(n,t,e){var i,r,c;i=t.c.p,c=t.p,n.b[i][c]=new DY(n,t),e&&(n.a[i][c]=new Bd(t),(r=BB(mMn(t,(hWn(),rlt)),10))&&JIn(n.d,r,t))}function Rgn(n,t){var e,i,r;if(WB(Sct,n),t.Fc(n),e=BB(RX(Mct,n),21))for(r=e.Kc();r.Ob();)i=BB(r.Pb(),33),-1!=E7(Sct,i,0)||Rgn(i,t)}function Kgn(n,t,e){var i;(Wet?(gwn(n),1):Vet||Jet?(lM(),1):Yet&&(lM(),0))&&((i=new i_(t)).b=e,aSn(n,i))}function _gn(n,t){var e;e=!n.A.Hc((mdn(),_It))||n.q==(QEn(),XCt),n.u.Hc((lIn(),eIt))?e?NUn(n,t):aUn(n,t):n.u.Hc(rIt)&&(e?Azn(n,t):JUn(n,t))}function Fgn(n,t){var e,i;++n.j,null!=t&&oOn(t,e=cL(i=n.a.Cb,97)?BB(i,97).Jg():null)?hgn(n.a,4,e):hgn(n.a,4,BB(t,126))}function Bgn(n,t,i){return new UV(e.Math.min(n.a,t.a)-i/2,e.Math.min(n.b,t.b)-i/2,e.Math.abs(n.a-t.a)+i,e.Math.abs(n.b-t.b)+i)}function Hgn(n,t){var e,i;return 0!=(e=E$(n.a.c.p,t.a.c.p))?e:0!=(i=E$(n.a.d.i.p,t.a.d.i.p))?i:E$(t.a.d.p,n.a.d.p)}function qgn(n,t,e){var i,r,c,a;return(c=t.j)!=(a=e.j)?c.g-a.g:(i=n.f[t.p],r=n.f[e.p],0==i&&0==r?0:0==i?-1:0==r?1:Pln(i,r))}function Ggn(n,t,e){var i;if(!e[t.d])for(e[t.d]=!0,i=new Wb(kbn(t));i.a<i.c.c.length;)Ggn(n,Nbn(BB(n0(i),213),t),e)}function zgn(n,t,e){var i;switch(i=e[n.g][t],n.g){case 1:case 3:return new xC(0,i);case 2:case 4:return new xC(i,0);default:return null}}function Ugn(n,t,e){var i;i=BB(sJ(t.f),209);try{i.Ze(n,e),SW(t.f,i)}catch(r){throw cL(r=lun(r),102),Hp(r)}}function Xgn(n,t,e){var i,r,c,a;return i=null,(c=pGn(cin(),t))&&(r=null,null!=(a=Zqn(c,e))&&(r=n.Ye(c,a)),i=r),i}function Wgn(n,t,e,i){var r;return r=new N7(n.e,1,13,t.c||(gWn(),l$t),e.c||(gWn(),l$t),uvn(n,t),!1),i?i.Ei(r):i=r,i}function Vgn(n,t,e,i){var r;if(t>=(r=n.length))return r;for(t=t>0?t:0;t<r&&!ton((b1(t,n.length),n.charCodeAt(t)),e,i);t++);return t}function Qgn(n,t){var e,i;for(i=n.c.length,t.length<i&&(t=qk(new Array(i),t)),e=0;e<i;++e)$X(t,e,n.c[e]);return t.length>i&&$X(t,i,null),t}function Ygn(n,t){var e,i;for(i=n.a.length,t.length<i&&(t=qk(new Array(i),t)),e=0;e<i;++e)$X(t,e,n.a[e]);return t.length>i&&$X(t,i,null),t}function Jgn(n,t,e){var i,r,c;return(r=BB(RX(n.e,t),387))?(c=pR(r,e),uL(n,r),c):(i=new nH(n,t,e),VW(n.e,t,i),kJ(i),null)}function Zgn(n){var t;if(null==n)return null;if(null==(t=L$n(FBn(n,!0))))throw Hp(new ik("Invalid hexBinary value: '"+n+"'"));return t}function npn(n){return ODn(),Vhn(n,0)<0?0!=Vhn(n,-1)?new vEn(-1,j7(n)):Ytt:Vhn(n,10)<=0?Ztt[dG(n)]:new vEn(1,n)}function tpn(){return dWn(),Pun(Gk(Krt,1),$Vn,159,0,[Prt,Srt,Crt,vrt,prt,mrt,jrt,krt,yrt,Mrt,Trt,Ert,drt,wrt,grt,lrt,frt,brt,srt,ort,hrt,Irt])}function epn(n){var t;this.d=new Np,this.j=new Gj,this.g=new Gj,t=n.g.b,this.f=BB(mMn(vW(t),(HXn(),Udt)),103),this.e=Gy(MD(gpn(t,Spt)))}function ipn(n){this.b=new Np,this.e=new Np,this.d=n,this.a=!jE(AV(new Rq(null,new zU(new m6(n.b))),new aw(new Gr))).sd((dM(),tit))}function rpn(){rpn=O,hMt=new AC("PARENTS",0),sMt=new AC("NODES",1),uMt=new AC("EDGES",2),fMt=new AC("PORTS",3),oMt=new AC("LABELS",4)}function cpn(){cpn=O,BCt=new zC("DISTRIBUTED",0),qCt=new zC("JUSTIFIED",1),_Ct=new zC("BEGIN",2),FCt=new zC(eJn,3),HCt=new zC("END",4)}function apn(n){switch(n.yi(null)){case 10:return 0;case 15:return 1;case 14:return 2;case 11:return 3;case 21:return 4}return-1}function upn(n){switch(n.g){case 1:return Ffn(),HPt;case 4:return Ffn(),_Pt;case 2:return Ffn(),FPt;case 3:return Ffn(),KPt}return Ffn(),BPt}function opn(n,t,e){var i;switch((i=e.q.getFullYear()-sQn+sQn)<0&&(i=-i),t){case 1:n.a+=i;break;case 2:Enn(n,i%100,2);break;default:Enn(n,i,t)}}function spn(n,t){var e,i;if(LZ(t,n.b),t>=n.b>>1)for(i=n.c,e=n.b;e>t;--e)i=i.b;else for(i=n.a.a,e=0;e<t;++e)i=i.a;return new ZK(n,t,i)}function hpn(){hpn=O,dit=new FS("NUM_OF_EXTERNAL_SIDES_THAN_NUM_OF_EXTENSIONS_LAST",0),wit=new FS("CORNER_CASES_THAN_SINGLE_SIDE_LAST",1)}function fpn(n){var t,e,i;for(m$(e=uCn(n),But),(i=n.d).c=x8(Ant,HWn,1,0,5,1),t=new Wb(e);t.a<t.c.c.length;)gun(i,BB(n0(t),456).b)}function lpn(n){var t,e;for(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),t=(e=n.o).c.Kc();t.e!=t.i.gc();)BB(t.nj(),42).dd();return A8(e)}function bpn(n){var t;LK(BB(mMn(n,(HXn(),ept)),98))&&(fOn((l1(0,(t=n.b).c.length),BB(t.c[0],29))),fOn(BB(xq(t,t.c.length-1),29)))}function wpn(n,t){var i,r,c,a;for(i=0,c=new Wb(t.a);c.a<c.c.c.length;)a=(r=BB(n0(c),10)).o.a+r.d.c+r.d.b+n.j,i=e.Math.max(i,a);return i}function dpn(n){var t,e,i,r;for(r=0,e=0,i=n.length;e<i;e++)b1(e,n.length),(t=n.charCodeAt(e))>=64&&t<128&&(r=i0(r,yz(1,t-64)));return r}function gpn(n,t){var e,i;return i=null,Lx(n,(sWn(),CPt))&&(e=BB(mMn(n,CPt),94)).Xe(t)&&(i=e.We(t)),null==i&&vW(n)&&(i=mMn(vW(n),t)),i}function ppn(n,t){var e,i,r;(i=(r=t.d.i).k)!=(uSn(),Cut)&&i!=Tut&&dAn(e=new oz(ZL(lbn(r).a.Kc(),new h)))&&VW(n.k,t,BB(U5(e),17))}function vpn(n,t){var e,i,r;return i=itn(n.Tg(),t),(e=t-n.Ah())<0?(r=n.Yg(i))>=0?n.lh(r):qIn(n,i):e<0?qIn(n,i):BB(i,66).Nj().Sj(n,n.yh(),e)}function mpn(n){var t;if(cL(n.a,4)){if(null==(t=Jdn(n.a)))throw Hp(new Fy(o5n+n.b+"'. "+r5n+(ED(bAt),bAt.k)+c5n));return t}return n.a}function ypn(n){var t;if(null==n)return null;if(null==(t=UUn(FBn(n,!0))))throw Hp(new ik("Invalid base64Binary value: '"+n+"'"));return t}function kpn(n){var t;try{return t=n.i.Xb(n.e),n.mj(),n.g=n.e++,t}catch(e){throw cL(e=lun(e),73)?(n.mj(),Hp(new yv)):Hp(e)}}function jpn(n){var t;try{return t=n.c.ki(n.e),n.mj(),n.g=n.e++,t}catch(e){throw cL(e=lun(e),73)?(n.mj(),Hp(new yv)):Hp(e)}}function Epn(){Epn=O,sWn(),Ect=TPt,pct=ySt,lct=cSt,vct=XSt,_kn(),kct=Mit,yct=Eit,jct=Pit,mct=jit,Gsn(),wct=oct,bct=uct,dct=hct,gct=fct}function Tpn(n){switch(jM(),this.c=new Np,this.d=n,n.g){case 0:case 2:this.a=QW(hut),this.b=RQn;break;case 3:case 1:this.a=hut,this.b=KQn}}function Mpn(n,t,e){var i;if(n.c)Pen(n.c,n.c.i+t),Cen(n.c,n.c.j+e);else for(i=new Wb(n.b);i.a<i.c.c.length;)Mpn(BB(n0(i),157),t,e)}function Spn(n,t){var e,i;if(n.j.length!=t.j.length)return!1;for(e=0,i=n.j.length;e<i;e++)if(!mK(n.j[e],t.j[e]))return!1;return!0}function Ppn(n,t,e){var i;t.a.length>0&&(WB(n.b,new VB(t.a,e)),0<(i=t.a.length)?t.a=t.a.substr(0,0):0>i&&(t.a+=rL(x8(ONt,WVn,25,-i,15,1))))}function Cpn(n,t){var e,i,r;for(e=n.o,r=BB(BB(h6(n.r,t),21),84).Kc();r.Ob();)(i=BB(r.Pb(),111)).e.a=dyn(i,e.a),i.e.b=e.b*Gy(MD(i.b.We(Lrt)))}function Ipn(n,t){var e,i,r,c;return r=n.k,e=Gy(MD(mMn(n,(hWn(),Tlt)))),c=t.k,i=Gy(MD(mMn(t,Tlt))),c!=(uSn(),Mut)?-1:r!=Mut?1:e==i?0:e<i?-1:1}function Opn(n,t){var e,i;return e=BB(BB(RX(n.g,t.a),46).a,65),i=BB(BB(RX(n.g,t.b),46).a,65),W8(t.a,t.b)-W8(t.a,_$(e.b))-W8(t.b,_$(i.b))}function Apn(n,t){var e;return e=BB(mMn(n,(HXn(),vgt)),74),tL(t,vut)?e?yQ(e):(e=new km,hon(n,vgt,e)):e&&hon(n,vgt,null),e}function $pn(n){var t;return(t=new Ck).a+="n",n.k!=(uSn(),Cut)&&oO(oO((t.a+="(",t),dx(n.k).toLowerCase()),")"),oO((t.a+="_",t),gyn(n)),t.a}function Lpn(n,t){OTn(t,"Self-Loop post-processing",1),JT(AV(AV(wnn(new Rq(null,new w1(n.b,16)),new xi),new Di),new Ri),new Ki),HSn(t)}function Npn(n,t,e,i){var r;return e>=0?n.hh(t,e,i):(n.eh()&&(i=(r=n.Vg())>=0?n.Qg(i):n.eh().ih(n,-1-r,null,i)),n.Sg(t,e,i))}function xpn(n,t){switch(t){case 7:return!n.e&&(n.e=new hK(_Ot,n,7,4)),void sqn(n.e);case 8:return!n.d&&(n.d=new hK(_Ot,n,8,5)),void sqn(n.d)}Dwn(n,t)}function Dpn(n,t){var e;e=n.Zc(t);try{return e.Pb()}catch(i){throw cL(i=lun(i),109)?Hp(new Ay("Can't get element "+t)):Hp(i)}}function Rpn(n,t){this.e=n,t<XQn?(this.d=1,this.a=Pun(Gk(ANt,1),hQn,25,15,[0|t])):(this.d=2,this.a=Pun(Gk(ANt,1),hQn,25,15,[t%XQn|0,t/XQn|0]))}function Kpn(n,t){var e,i,r,c;for(SQ(),e=n,c=t,cL(n,21)&&!cL(t,21)&&(e=t,c=n),r=e.Kc();r.Ob();)if(i=r.Pb(),c.Hc(i))return!1;return!0}function _pn(n,t,e){var i,r,c,a;return-1!=(i=n.Xc(t))&&(n.ej()?(c=n.fj(),a=Lyn(n,i),r=n.Zi(4,a,null,i,c),e?e.Ei(r):e=r):Lyn(n,i)),e}function Fpn(n,t,e){var i,r,c,a;return-1!=(i=n.Xc(t))&&(n.ej()?(c=n.fj(),a=wq(n,i),r=n.Zi(4,a,null,i,c),e?e.Ei(r):e=r):wq(n,i)),e}function Bpn(n,t){var e;switch(e=BB(oV(n.b,t),124).n,t.g){case 1:n.t>=0&&(e.d=n.t);break;case 3:n.t>=0&&(e.a=n.t)}n.C&&(e.b=n.C.b,e.c=n.C.c)}function Hpn(){Hpn=O,Brt=new _S(mJn,0),Frt=new _S(yJn,1),Hrt=new _S(kJn,2),qrt=new _S(jJn,3),Brt.a=!1,Frt.a=!0,Hrt.a=!1,qrt.a=!0}function qpn(){qpn=O,Zrt=new KS(mJn,0),Jrt=new KS(yJn,1),nct=new KS(kJn,2),tct=new KS(jJn,3),Zrt.a=!1,Jrt.a=!0,nct.a=!1,tct.a=!0}function Gpn(n){var t;t=n.a;do{(t=BB(U5(new oz(ZL(fbn(t).a.Kc(),new h))),17).c.i).k==(uSn(),Put)&&n.b.Fc(t)}while(t.k==(uSn(),Put));n.b=ean(n.b)}function zpn(n){var t,e,i;for(i=n.c.a,n.p=(yX(i),new t_(i)),e=new Wb(i);e.a<e.c.c.length;)(t=BB(n0(e),10)).p=hCn(t).a;SQ(),m$(n.p,new Oc)}function Upn(n){var t,e,i;if(e=0,0==(i=wDn(n)).c.length)return 1;for(t=new Wb(i);t.a<t.c.c.length;)e+=Upn(BB(n0(t),33));return e}function Xpn(n,t){var e,i,r;for(r=0,i=BB(BB(h6(n.r,t),21),84).Kc();i.Ob();)r+=(e=BB(i.Pb(),111)).d.b+e.b.rf().a+e.d.c,i.Ob()&&(r+=n.w);return r}function Wpn(n,t){var e,i,r;for(r=0,i=BB(BB(h6(n.r,t),21),84).Kc();i.Ob();)r+=(e=BB(i.Pb(),111)).d.d+e.b.rf().b+e.d.a,i.Ob()&&(r+=n.w);return r}function Vpn(n,t,e,i){if(t.a<i.a)return!0;if(t.a==i.a){if(t.b<i.b)return!0;if(t.b==i.b&&n.b>e.b)return!0}return!1}function Qpn(n,t){return XI(n)?!!OWn[t]:n.hm?!!n.hm[t]:UI(n)?!!IWn[t]:!!zI(n)&&!!CWn[t]}function Ypn(n,t,e){return null==e?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),Wdn(n.o,t)):(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),vjn(n.o,t,e)),n}function Jpn(n,t,e,i){var r;(r=Xfn(t.Xe((sWn(),DSt))?BB(t.We(DSt),21):n.j))!=(dWn(),Irt)&&(e&&!agn(r)||USn(N$n(n,r,i),t))}function Zpn(n,t,e,i){var r,c,a;return c=itn(n.Tg(),t),(r=t-n.Ah())<0?(a=n.Yg(c))>=0?n._g(a,e,!0):cOn(n,c,e):BB(c,66).Nj().Pj(n,n.yh(),r,e,i)}function nvn(n,t,e,i){var r,c;e.mh(t)&&(ZM(),hnn(t)?ygn(n,BB(e.ah(t),153)):(r=(c=t)?BB(i,49).xh(c):null)&&_p(e.ah(t),r))}function tvn(n){switch(n.g){case 1:return Dan(),Rrt;case 3:return Dan(),Nrt;case 2:return Dan(),Drt;case 4:return Dan(),xrt;default:return null}}function evn(n){switch(typeof n){case NWn:return vvn(n);case LWn:return CJ(n);case $Wn:return hN(),n?1231:1237;default:return null==n?0:PN(n)}}function ivn(n,t,e){if(n.e)switch(n.b){case 1:BQ(n.c,t,e);break;case 0:HQ(n.c,t,e)}else t4(n.c,t,e);n.a[t.p][e.p]=n.c.i,n.a[e.p][t.p]=n.c.e}function rvn(n){var t,e;if(null==n)return null;for(e=x8(Out,sVn,193,n.length,0,2),t=0;t<e.length;t++)e[t]=BB(G9(n[t],n[t].length),193);return e}function cvn(n){var t;if(Ksn(n))return mz(n),n.Lk()&&(t=FIn(n.e,n.b,n.c,n.a,n.j),n.j=t),n.g=n.a,++n.a,++n.c,n.i=0,n.j;throw Hp(new yv)}function avn(n,t){var e,i,r,c;return(c=n.o)<(e=n.p)?c*=c:e*=e,i=c+e,(c=t.o)<(e=t.p)?c*=c:e*=e,i<(r=c+e)?-1:i==r?0:1}function uvn(n,t){var e,i;if((i=Wyn(n,t))>=0)return i;if(n.Fk())for(e=0;e<n.i;++e)if(GI(n.Gk(BB(n.g[e],56)))===GI(t))return e;return-1}function ovn(n,t,e){var i,r;if(t>=(r=n.gc()))throw Hp(new tK(t,r));if(n.hi()&&(i=n.Xc(e))>=0&&i!=t)throw Hp(new _y(a8n));return n.mi(t,e)}function svn(n,t){if(this.a=BB(yX(n),245),this.b=BB(yX(t),245),n.vd(t)>0||n==(ey(),Knt)||t==(ty(),_nt))throw Hp(new _y("Invalid range: "+B3(n,t)))}function hvn(n){var t,e;for(this.b=new Np,this.c=n,this.a=!1,e=new Wb(n.a);e.a<e.c.c.length;)t=BB(n0(e),10),this.a=this.a|t.k==(uSn(),Cut)}function fvn(n,t){var e,i,r;for(e=AN(new qv,n),r=new Wb(t);r.a<r.c.c.length;)i=BB(n0(r),121),UNn(aM(cM(uM(rM(new Hv,0),0),e),i));return e}function lvn(n,t,e){var i,r,c;for(r=new oz(ZL((t?fbn(n):lbn(n)).a.Kc(),new h));dAn(r);)i=BB(U5(r),17),(c=t?i.c.i:i.d.i).k==(uSn(),Sut)&&PZ(c,e)}function bvn(){bvn=O,lvt=new _P(QZn,0),bvt=new _P("PORT_POSITION",1),fvt=new _P("NODE_SIZE_WHERE_SPACE_PERMITS",2),hvt=new _P("NODE_SIZE",3)}function wvn(){wvn=O,CMt=new DC("AUTOMATIC",0),AMt=new DC(cJn,1),$Mt=new DC(aJn,2),LMt=new DC("TOP",3),IMt=new DC(oJn,4),OMt=new DC(eJn,5)}function dvn(n,t,e,i){var r,c;for($On(),r=0,c=0;c<e;c++)r=rbn(cbn(e0(t[c],UQn),e0(i,UQn)),e0(dG(r),UQn)),n[c]=dG(r),r=jz(r,32);return dG(r)}function gvn(n,t,i){var r,c;for(c=0,r=0;r<Zit;r++)c=e.Math.max(c,vhn(n.a[t.g][r],i));return t==(Dtn(),zit)&&n.b&&(c=e.Math.max(c,n.b.b)),c}function pvn(n,t){var e,i;if(Tx(t>0),(t&-t)==t)return CJ(t*H$n(n,31)*4.656612873077393e-10);do{i=(e=H$n(n,31))%t}while(e-i+(t-1)<0);return CJ(i)}function vvn(n){var t,e,i;return r_(),null!=(i=rit[e=":"+n])?CJ((kW(i),i)):(t=null==(i=iit[e])?JNn(n):CJ((kW(i),i)),IQ(),rit[e]=t,t)}function mvn(n,t,e){OTn(e,"Compound graph preprocessor",1),n.a=new pJ,Nzn(n,t,null),GHn(n,t),tNn(n),hon(t,(hWn(),Hft),n.a),n.a=null,$U(n.b),HSn(e)}function yvn(n,t,e){switch(e.g){case 1:n.a=t.a/2,n.b=0;break;case 2:n.a=t.a,n.b=t.b/2;break;case 3:n.a=t.a/2,n.b=t.b;break;case 4:n.a=0,n.b=t.b/2}}function kvn(n){var t,e,i;for(i=BB(h6(n.a,(LEn(),Pst)),15).Kc();i.Ob();)iX(n,e=BB(i.Pb(),101),(t=Hyn(e))[0],(Crn(),xst),0),iX(n,e,t[1],Rst,1)}function jvn(n){var t,e,i;for(i=BB(h6(n.a,(LEn(),Cst)),15).Kc();i.Ob();)iX(n,e=BB(i.Pb(),101),(t=Hyn(e))[0],(Crn(),xst),0),iX(n,e,t[1],Rst,1)}function Evn(n){switch(n.g){case 0:return null;case 1:return new Arn;case 2:return new Jm;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function Tvn(n,t,e){var i,r;for(mun(n,t-n.s,e-n.t),r=new Wb(n.n);r.a<r.c.c.length;)rb(i=BB(n0(r),211),i.e+t-n.s),cb(i,i.f+e-n.t);n.s=t,n.t=e}function Mvn(n){var t,e,i,r;for(e=0,i=new Wb(n.a);i.a<i.c.c.length;)BB(n0(i),121).d=e++;return r=null,(t=wSn(n)).c.length>1&&(r=fvn(n,t)),r}function Svn(n){var t;return n.f&&n.f.kh()&&(t=BB(n.f,49),n.f=BB(tfn(n,t),82),n.f!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,8,t,n.f))),n.f}function Pvn(n){var t;return n.i&&n.i.kh()&&(t=BB(n.i,49),n.i=BB(tfn(n,t),82),n.i!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,7,t,n.i))),n.i}function Cvn(n){var t;return n.b&&0!=(64&n.b.Db)&&(t=n.b,n.b=BB(tfn(n,t),18),n.b!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,21,t,n.b))),n.b}function Ivn(n,t){var e,i,r;null==n.d?(++n.e,++n.f):(i=t.Sh(),fNn(n,n.f+1),r=(i&DWn)%n.d.length,!(e=n.d[r])&&(e=n.d[r]=n.uj()),e.Fc(t),++n.f)}function Ovn(n,t,e){var i;return!t.Kj()&&(-2!=t.Zj()?null==(i=t.zj())?null==e:Nfn(i,e):t.Hj()==n.e.Tg()&&null==e)}function Avn(){var n;lin(16,IVn),n=Jin(16),this.b=x8(Gnt,CVn,317,n,0,1),this.c=x8(Gnt,CVn,317,n,0,1),this.a=null,this.e=null,this.i=0,this.f=n-1,this.g=0}function $vn(n){LR.call(this),this.k=(uSn(),Cut),this.j=(lin(6,AVn),new J6(6)),this.b=(lin(2,AVn),new J6(2)),this.d=new fm,this.f=new wm,this.a=n}function Lvn(n){var t,e;n.c.length<=1||(dPn(n,BB((t=EDn(n,(kUn(),SIt))).a,19).a,BB(t.b,19).a),dPn(n,BB((e=EDn(n,CIt)).a,19).a,BB(e.b,19).a))}function Nvn(){Nvn=O,yvt=new FP("SIMPLE",0),pvt=new FP(B1n,1),vvt=new FP("LINEAR_SEGMENTS",2),gvt=new FP("BRANDES_KOEPF",3),mvt=new FP(j3n,4)}function xvn(n,t,e){LK(BB(mMn(t,(HXn(),ept)),98))||(W7(n,t,DSn(t,e)),W7(n,t,DSn(t,(kUn(),SIt))),W7(n,t,DSn(t,sIt)),SQ(),m$(t.j,new _d(n)))}function Dvn(n,t,e,i){var r;for(r=BB(h6(i?n.a:n.b,t),21).Kc();r.Ob();)if(_Dn(n,e,BB(r.Pb(),33)))return!0;return!1}function Rvn(n){var t,e;for(e=new AL(n);e.e!=e.i.gc();)if((t=BB(kpn(e),87)).e||0!=(!t.d&&(t.d=new $L(VAt,t,1)),t.d).i)return!0;return!1}function Kvn(n){var t,e;for(e=new AL(n);e.e!=e.i.gc();)if((t=BB(kpn(e),87)).e||0!=(!t.d&&(t.d=new $L(VAt,t,1)),t.d).i)return!0;return!1}function _vn(n){var t,e;for(t=0,e=new Wb(n.c.a);e.a<e.c.c.length;)t+=F3(new oz(ZL(lbn(BB(n0(e),10)).a.Kc(),new h)));return t/n.c.a.c.length}function Fvn(n){var t,e;for(n.c||zqn(n),e=new km,n0(t=new Wb(n.a));t.a<t.c.c.length;)DH(e,BB(n0(t),407).a);return Px(0!=e.b),Atn(e,e.c.b),e}function Bvn(){Bvn=O,bRn(),qTt=RTt,BTt=new WA(8),new XA((sWn(),XSt),BTt),new XA(LPt,8),HTt=xTt,_Tt=MTt,FTt=STt,KTt=new XA(lSt,(hN(),!1))}function Hvn(n,t,e,i){switch(t){case 7:return!n.e&&(n.e=new hK(_Ot,n,7,4)),n.e;case 8:return!n.d&&(n.d=new hK(_Ot,n,8,5)),n.d}return Rbn(n,t,e,i)}function qvn(n){var t;return n.a&&n.a.kh()&&(t=BB(n.a,49),n.a=BB(tfn(n,t),138),n.a!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,5,t,n.a))),n.a}function Gvn(n){return n<48||n>102?-1:n<=57?n-48:n<65?-1:n<=70?n-65+10:n<97?-1:n-97+10}function zvn(n,t){if(null==n)throw Hp(new Hy("null key in entry: null="+t));if(null==t)throw Hp(new Hy("null value in entry: "+n+"=null"))}function Uvn(n,t){for(var e,i;n.Ob();){if(!t.Ob())return!1;if(e=n.Pb(),i=t.Pb(),!(GI(e)===GI(i)||null!=e&&Nfn(e,i)))return!1}return!t.Ob()}function Xvn(n,t){var i;return i=Pun(Gk(xNt,1),qQn,25,15,[vhn(n.a[0],t),vhn(n.a[1],t),vhn(n.a[2],t)]),n.d&&(i[0]=e.Math.max(i[0],i[2]),i[2]=i[0]),i}function Wvn(n,t){var i;return i=Pun(Gk(xNt,1),qQn,25,15,[mhn(n.a[0],t),mhn(n.a[1],t),mhn(n.a[2],t)]),n.d&&(i[0]=e.Math.max(i[0],i[2]),i[2]=i[0]),i}function Vvn(){Vvn=O,yht=new SP("GREEDY",0),mht=new SP(H1n,1),jht=new SP(B1n,2),Eht=new SP("MODEL_ORDER",3),kht=new SP("GREEDY_MODEL_ORDER",4)}function Qvn(n,t){var e,i,r;for(n.b[t.g]=1,i=spn(t.d,0);i.b!=i.d.c;)r=(e=BB(b3(i),188)).c,1==n.b[r.g]?DH(n.a,e):2==n.b[r.g]?n.b[r.g]=1:Qvn(n,r)}function Yvn(n,t){var e,i,r;for(r=new J6(t.gc()),i=t.Kc();i.Ob();)(e=BB(i.Pb(),286)).c==e.f?hPn(n,e,e.c):rPn(n,e)||(r.c[r.c.length]=e);return r}function Jvn(n,t,e){var i,r,c,a;for(a=n.r+t,n.r+=t,n.d+=e,i=e/n.n.c.length,r=0,c=new Wb(n.n);c.a<c.c.c.length;)w$n(BB(n0(c),211),a,i,r),++r}function Zvn(n){var t,e;for(my(n.b.a),n.a=x8(bit,HWn,57,n.c.c.a.b.c.length,0,1),t=0,e=new Wb(n.c.c.a.b);e.a<e.c.c.length;)BB(n0(e),57).f=t++}function nmn(n){var t,e;for(my(n.b.a),n.a=x8(Qat,HWn,81,n.c.a.a.b.c.length,0,1),t=0,e=new Wb(n.c.a.a.b);e.a<e.c.c.length;)BB(n0(e),81).i=t++}function tmn(n,t,e){OTn(e,"Shrinking tree compaction",1),qy(TD(mMn(t,(Xcn(),Qrt))))?(irn(n,t.f),unn(t.f,t.c)):unn(t.f,t.c),HSn(e)}function emn(n){var t;if(t=bhn(n),!dAn(n))throw Hp(new Ay("position (0) must be less than the number of elements that remained ("+t+")"));return U5(n)}function imn(n,t,e){try{return vmn(n,t+n.j,e+n.k)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function rmn(n,t,e){try{return mmn(n,t+n.j,e+n.k)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function cmn(n,t,e){try{return ymn(n,t+n.j,e+n.k)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function amn(n){switch(n.g){case 1:return kUn(),CIt;case 4:return kUn(),sIt;case 3:return kUn(),oIt;case 2:return kUn(),SIt;default:return kUn(),PIt}}function umn(n,t,e){t.k==(uSn(),Cut)&&e.k==Put&&(n.d=Efn(t,(kUn(),SIt)),n.b=Efn(t,sIt)),e.k==Cut&&t.k==Put&&(n.d=Efn(e,(kUn(),sIt)),n.b=Efn(e,SIt))}function omn(n,t){var e,i;for(i=abn(n,t).Kc();i.Ob();)if(null!=mMn(e=BB(i.Pb(),11),(hWn(),Elt))||zN(new m6(e.b)))return!0;return!1}function smn(n,t){return Pen(t,n.e+n.d+(0==n.c.c.length?0:n.b)),Cen(t,n.f),n.a=e.Math.max(n.a,t.f),n.d+=t.g+(0==n.c.c.length?0:n.b),WB(n.c,t),!0}function hmn(n,t,e){var i,r,c,a;for(a=0,i=e/n.a.c.length,c=new Wb(n.a);c.a<c.c.c.length;)Tvn(r=BB(n0(c),187),r.s,r.t+a*i),Jvn(r,n.d-r.r+t,i),++a}function fmn(n){var t,e,i;for(e=new Wb(n.b);e.a<e.c.c.length;)for(t=0,i=new Wb(BB(n0(e),29).a);i.a<i.c.c.length;)BB(n0(i),10).p=t++}function lmn(n,t){var e,i,r,c,a,u;for(r=t.length-1,a=0,u=0,i=0;i<=r;i++)c=t[i],e=pSn(r,i)*efn(1-n,r-i)*efn(n,i),a+=c.a*e,u+=c.b*e;return new xC(a,u)}function bmn(n,t){var e,i,r,c,a;for(e=t.gc(),n.qi(n.i+e),c=t.Kc(),a=n.i,n.i+=e,i=a;i<n.i;++i)r=c.Pb(),jL(n,i,n.oi(i,r)),n.bi(i,r),n.ci();return 0!=e}function wmn(n,t,e){var i,r,c;return n.ej()?(i=n.Vi(),c=n.fj(),++n.j,n.Hi(i,n.oi(i,t)),r=n.Zi(3,null,t,i,c),e?e.Ei(r):e=r):ZD(n,n.Vi(),t),e}function dmn(n,t,e){var i,r,c;return(0!=(64&(c=cL(r=(i=BB(Wtn(a4(n.a),t),87)).c,88)?BB(r,26):(gWn(),d$t)).Db)?tfn(n.b,c):c)==e?lFn(i):cen(i,e),c}function gmn(n,t,e,i,r,c,a,u){var o,s;i&&((o=i.a[0])&&gmn(n,t,e,o,r,c,a,u),Iyn(n,e,i.d,r,c,a,u)&&t.Fc(i),(s=i.a[1])&&gmn(n,t,e,s,r,c,a,u))}function pmn(n,t){var e;return n.a||(e=x8(xNt,qQn,25,0,15,1),gE(n.b.a,new bw(e)),e.sort(ien(T.prototype.te,T,[])),n.a=new _K(e,n.d)),K6(n.a,t)}function vmn(n,t,e){try{return QI(trn(n,t,e),1)}catch(i){throw cL(i=lun(i),320)?Hp(new Ay(MJn+n.o+"*"+n.p+SJn+t+FWn+e+PJn)):Hp(i)}}function mmn(n,t,e){try{return QI(trn(n,t,e),0)}catch(i){throw cL(i=lun(i),320)?Hp(new Ay(MJn+n.o+"*"+n.p+SJn+t+FWn+e+PJn)):Hp(i)}}function ymn(n,t,e){try{return QI(trn(n,t,e),2)}catch(i){throw cL(i=lun(i),320)?Hp(new Ay(MJn+n.o+"*"+n.p+SJn+t+FWn+e+PJn)):Hp(i)}}function kmn(n,t){if(-1==n.g)throw Hp(new dv);n.mj();try{n.d._c(n.g,t),n.f=n.d.j}catch(e){throw cL(e=lun(e),73)?Hp(new vv):Hp(e)}}function jmn(n,t,e){OTn(e,"Linear segments node placement",1),n.b=BB(mMn(t,(hWn(),Alt)),304),VXn(n,t),vHn(n,t),QHn(n,t),hXn(n),n.a=null,n.b=null,HSn(e)}function Emn(n,t){var e,i,r,c;for(c=n.gc(),t.length<c&&(t=qk(new Array(c),t)),r=t,i=n.Kc(),e=0;e<c;++e)$X(r,e,i.Pb());return t.length>c&&$X(t,c,null),t}function Tmn(n,t){var e,i;if(i=n.gc(),null==t){for(e=0;e<i;e++)if(null==n.Xb(e))return e}else for(e=0;e<i;e++)if(Nfn(t,n.Xb(e)))return e;return-1}function Mmn(n,t){var e,i,r;return e=t.cd(),r=t.dd(),i=n.xc(e),!(!(GI(r)===GI(i)||null!=r&&Nfn(r,i))||null==i&&!n._b(e))}function Smn(n,t){var e,i,r;return t<=22?(e=n.l&(1<<t)-1,i=r=0):t<=44?(e=n.l,i=n.m&(1<<t-22)-1,r=0):(e=n.l,i=n.m,r=n.h&(1<<t-44)-1),M$(e,i,r)}function Pmn(n,t){switch(t.g){case 1:return n.f.n.d+n.t;case 3:return n.f.n.a+n.t;case 2:return n.f.n.c+n.s;case 4:return n.f.n.b+n.s;default:return 0}}function Cmn(n,t){var e,i;switch(i=t.c,e=t.a,n.b.g){case 0:e.d=n.e-i.a-i.d;break;case 1:e.d+=n.e;break;case 2:e.c=n.e-i.a-i.d;break;case 3:e.c=n.e+i.d}}function Imn(n,t,e,i){var r,c;this.a=t,this.c=i,$l(this,new xC(-(r=n.a).c,-r.d)),UR(this.b,e),c=i/2,t.a?Bx(this.b,0,c):Bx(this.b,c,0),WB(n.c,this)}function Omn(){Omn=O,qjt=new mC(QZn,0),Bjt=new mC(q1n,1),Hjt=new mC("EDGE_LENGTH_BY_POSITION",2),Fjt=new mC("CROSSING_MINIMIZATION_BY_POSITION",3)}function Amn(n,t){var e,i;if(e=BB(sen(n.g,t),33))return e;if(i=BB(sen(n.j,t),118))return i;throw Hp(new ek("Referenced shape does not exist: "+t))}function $mn(n,t){if(n.c==t)return n.d;if(n.d==t)return n.c;throw Hp(new _y("Node 'one' must be either source or target of edge 'edge'."))}function Lmn(n,t){if(n.c.i==t)return n.d.i;if(n.d.i==t)return n.c.i;throw Hp(new _y("Node "+t+" is neither source nor target of edge "+n))}function Nmn(n,t){var e;switch(t.g){case 2:case 4:e=n.a,n.c.d.n.b<e.d.n.b&&(e=n.c),bU(n,t,(Oun(),kst),e);break;case 1:case 3:bU(n,t,(Oun(),vst),null)}}function xmn(n,t,e,i,r,c){var a,u,o,s,h;for(a=ijn(t,e,c),u=e==(kUn(),sIt)||e==CIt?-1:1,s=n[e.g],h=0;h<s.length;h++)(o=s[h])>0&&(o+=r),s[h]=a,a+=u*(o+i)}function Dmn(n){var t,e,i;for(i=n.f,n.n=x8(xNt,qQn,25,i,15,1),n.d=x8(xNt,qQn,25,i,15,1),t=0;t<i;t++)e=BB(xq(n.c.b,t),29),n.n[t]=wpn(n,e),n.d[t]=VLn(n,e)}function Rmn(n,t){var e,i,r;for(r=0,i=2;i<t;i<<=1)0!=(n.Db&i)&&++r;if(0==r){for(e=t<<=1;e<=128;e<<=1)if(0!=(n.Db&e))return 0;return-1}return r}function Kmn(n,t){var e,i,r,c,a;for(a=axn(n.e.Tg(),t),c=null,e=BB(n.g,119),r=0;r<n.i;++r)i=e[r],a.rl(i.ak())&&(!c&&(c=new go),f9(c,i));c&&aXn(n,c)}function _mn(n){var t,e;if(!n)return null;if(n.dc())return"";for(e=new Sk,t=n.Kc();t.Ob();)cO(e,SD(t.Pb())),e.a+=" ";return KO(e,e.a.length-1)}function Fmn(n,t,e){var i,r,c,a;for(con(n),null==n.k&&(n.k=x8(Jnt,sVn,78,0,0,1)),r=0,c=(i=n.k).length;r<c;++r)Fmn(i[r],t,"\t"+e);(a=n.f)&&Fmn(a,t,e)}function Bmn(n,t){var e,i=new Array(t);switch(n){case 14:case 15:e=0;break;case 16:e=!1;break;default:return i}for(var r=0;r<t;++r)i[r]=e;return i}function Hmn(n){var t;for(t=new Wb(n.a.b);t.a<t.c.c.length;)BB(n0(t),57).c.$b();Otn(dA(n.d)?n.a.c:n.a.d,new Mw(n)),n.c.Me(n),_xn(n)}function qmn(n){var t,e,i;for(e=new Wb(n.e.c);e.a<e.c.c.length;){for(i=new Wb((t=BB(n0(e),282)).b);i.a<i.c.c.length;)_Bn(BB(n0(i),447));BCn(t)}}function Gmn(n){var t,i,r,c,a;for(r=0,a=0,c=0,i=new Wb(n.a);i.a<i.c.c.length;)t=BB(n0(i),187),a=e.Math.max(a,t.r),r+=t.d+(c>0?n.c:0),++c;n.b=r,n.d=a}function zmn(n,t){var i,r,c,a,u;for(r=0,c=0,i=0,u=new Wb(t);u.a<u.c.c.length;)a=BB(n0(u),200),r=e.Math.max(r,a.e),c+=a.b+(i>0?n.g:0),++i;n.c=c,n.d=r}function Umn(n,t){var i;return i=Pun(Gk(xNt,1),qQn,25,15,[gvn(n,(Dtn(),Git),t),gvn(n,zit,t),gvn(n,Uit,t)]),n.f&&(i[0]=e.Math.max(i[0],i[2]),i[2]=i[0]),i}function Xmn(n,t,e){try{FRn(n,t+n.j,e+n.k,!1,!0)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function Wmn(n,t,e){try{FRn(n,t+n.j,e+n.k,!0,!1)}catch(i){throw cL(i=lun(i),73)?Hp(new Ay(i.g+CJn+t+FWn+e+").")):Hp(i)}}function Vmn(n){var t;Lx(n,(HXn(),$gt))&&((t=BB(mMn(n,$gt),21)).Hc((n$n(),ICt))?(t.Mc(ICt),t.Fc(ACt)):t.Hc(ACt)&&(t.Mc(ACt),t.Fc(ICt)))}function Qmn(n){var t;Lx(n,(HXn(),$gt))&&((t=BB(mMn(n,$gt),21)).Hc((n$n(),DCt))?(t.Mc(DCt),t.Fc(NCt)):t.Hc(NCt)&&(t.Mc(NCt),t.Fc(DCt)))}function Ymn(n,t,e){OTn(e,"Self-Loop ordering",1),JT($V(AV(AV(wnn(new Rq(null,new w1(t.b,16)),new Ii),new Oi),new Ai),new $i),new bd(n)),HSn(e)}function Jmn(n,t,e,i){var r,c;for(r=t;r<n.c.length;r++){if(l1(r,n.c.length),c=BB(n.c[r],11),!e.Mb(c))return r;i.c[i.c.length]=c}return n.c.length}function Zmn(n,t,e,i){var r,c,a;return null==n.a&&dSn(n,t),a=t.b.j.c.length,c=e.d.p,(r=i.d.p-1)<0&&(r=a-1),c<=r?n.a[r]-n.a[c]:n.a[a-1]-n.a[c]+n.a[r]}function nyn(n){var t,e;if(!n.b)for(n.b=C2(BB(n.f,33).Ag().i),e=new AL(BB(n.f,33).Ag());e.e!=e.i.gc();)t=BB(kpn(e),137),WB(n.b,new Ry(t));return n.b}function tyn(n){var t,e;if(!n.e)for(n.e=C2(yV(BB(n.f,33)).i),e=new AL(yV(BB(n.f,33)));e.e!=e.i.gc();)t=BB(kpn(e),118),WB(n.e,new op(t));return n.e}function eyn(n){var t,e;if(!n.a)for(n.a=C2(YQ(BB(n.f,33)).i),e=new AL(YQ(BB(n.f,33)));e.e!=e.i.gc();)t=BB(kpn(e),33),WB(n.a,new JN(n,t));return n.a}function iyn(n){var t;if(!n.C&&(null!=n.D||null!=n.B))if(t=bzn(n))n.yk(t);else try{n.yk(null)}catch(e){if(!cL(e=lun(e),60))throw Hp(e)}return n.C}function ryn(n){switch(n.q.g){case 5:kjn(n,(kUn(),sIt)),kjn(n,SIt);break;case 4:cGn(n,(kUn(),sIt)),cGn(n,SIt);break;default:FPn(n,(kUn(),sIt)),FPn(n,SIt)}}function cyn(n){switch(n.q.g){case 5:jjn(n,(kUn(),oIt)),jjn(n,CIt);break;case 4:aGn(n,(kUn(),oIt)),aGn(n,CIt);break;default:BPn(n,(kUn(),oIt)),BPn(n,CIt)}}function ayn(n,t){var i,r,c;for(c=new Gj,r=n.Kc();r.Ob();)ZRn(i=BB(r.Pb(),37),c.a,0),c.a+=i.f.a+t,c.b=e.Math.max(c.b,i.f.b);return c.b>0&&(c.b+=t),c}function uyn(n,t){var i,r,c;for(c=new Gj,r=n.Kc();r.Ob();)ZRn(i=BB(r.Pb(),37),0,c.b),c.b+=i.f.b+t,c.a=e.Math.max(c.a,i.f.a);return c.a>0&&(c.a+=t),c}function oyn(n){var t,i,r;for(r=DWn,i=new Wb(n.a);i.a<i.c.c.length;)Lx(t=BB(n0(i),10),(hWn(),wlt))&&(r=e.Math.min(r,BB(mMn(t,wlt),19).a));return r}function syn(n,t){var e,i;if(0==t.length)return 0;for(e=ZX(n.a,t[0],(kUn(),CIt)),e+=ZX(n.a,t[t.length-1],oIt),i=0;i<t.length;i++)e+=qMn(n,i,t);return e}function hyn(){gxn(),this.c=new Np,this.i=new Np,this.e=new fA,this.f=new fA,this.g=new fA,this.j=new Np,this.a=new Np,this.b=new xp,this.k=new xp}function fyn(n,t){var e;return n.Db>>16==6?n.Cb.ih(n,5,GOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||n.zh(),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function lyn(n){PY();var t=n.e;if(t&&t.stack){var e=t.stack,i=t+"\n";return e.substring(0,i.length)==i&&(e=e.substring(i.length)),e.split("\n")}return[]}function byn(n){var t;return Min(),(t=Ott)[n>>>28]|t[n>>24&15]<<4|t[n>>20&15]<<8|t[n>>16&15]<<12|t[n>>12&15]<<16|t[n>>8&15]<<20|t[n>>4&15]<<24|t[15&n]<<28}function wyn(n){var t,i,r;n.b==n.c&&(r=n.a.length,i=kon(e.Math.max(8,r))<<1,0!=n.b?(urn(n,t=SR(n.a,i),r),n.a=t,n.b=0):Pv(n.a,i),n.c=r)}function dyn(n,t){var e;return(e=n.b).Xe((sWn(),aPt))?e.Hf()==(kUn(),CIt)?-e.rf().a-Gy(MD(e.We(aPt))):t+Gy(MD(e.We(aPt))):e.Hf()==(kUn(),CIt)?-e.rf().a:t}function gyn(n){var t;return 0!=n.b.c.length&&BB(xq(n.b,0),70).a?BB(xq(n.b,0),70).a:null!=(t=eQ(n))?t:""+(n.c?E7(n.c.a,n,0):-1)}function pyn(n){var t;return 0!=n.f.c.length&&BB(xq(n.f,0),70).a?BB(xq(n.f,0),70).a:null!=(t=eQ(n))?t:""+(n.i?E7(n.i.j,n,0):-1)}function vyn(n,t){var e,i;if(t<0||t>=n.gc())return null;for(e=t;e<n.gc();++e)if(i=BB(n.Xb(e),128),e==n.gc()-1||!i.o)return new rI(iln(e),i);return null}function myn(n,t,e){var i,r,c,a;for(c=n.c,i=e?n:t,r=(e?t:n).p+1;r<i.p;++r)if((a=BB(xq(c.a,r),10)).k!=(uSn(),Tut)&&!Lkn(a))return!1;return!0}function yyn(n){var t,i,r,c,a;for(a=0,c=KQn,r=0,i=new Wb(n.a);i.a<i.c.c.length;)a+=(t=BB(n0(i),187)).r+(r>0?n.c:0),c=e.Math.max(c,t.d),++r;n.e=a,n.b=c}function kyn(n){var t,e;if(!n.b)for(n.b=C2(BB(n.f,118).Ag().i),e=new AL(BB(n.f,118).Ag());e.e!=e.i.gc();)t=BB(kpn(e),137),WB(n.b,new Ry(t));return n.b}function jyn(n,t){var e,i,r;if(t.dc())return dD(),dD(),pAt;for(e=new aR(n,t.gc()),r=new AL(n);r.e!=r.i.gc();)i=kpn(r),t.Hc(i)&&f9(e,i);return e}function Eyn(n,t,e,i){return 0==t?i?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),n.o):(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),A8(n.o)):Zpn(n,t,e,i)}function Tyn(n){var t,e;if(n.rb)for(t=0,e=n.rb.i;t<e;++t)vx(Wtn(n.rb,t));if(n.vb)for(t=0,e=n.vb.i;t<e;++t)vx(Wtn(n.vb,t));az((IPn(),Z$t),n),n.Bb|=1}function Myn(n,t,e,i,r,c,a,u,o,s,h,f,l,b){return bCn(n,t,i,null,r,c,a,u,o,s,l,!0,b),zln(n,h),cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),2),e&&rrn(n,e),Uln(n,f),n}function Syn(n){var t;if(null==n)return null;t=0;try{t=l_n(n,_Vn,DWn)&QVn}catch(e){if(!cL(e=lun(e),127))throw Hp(e);t=V7(n)[0]}return fun(t)}function Pyn(n){var t;if(null==n)return null;t=0;try{t=l_n(n,_Vn,DWn)&QVn}catch(e){if(!cL(e=lun(e),127))throw Hp(e);t=V7(n)[0]}return fun(t)}function Cyn(n,t){var e,i,r;return!((r=n.h-t.h)<0||(e=n.l-t.l,(r+=(i=n.m-t.m+(e>>22))>>22)<0||(n.l=e&SQn,n.m=i&SQn,n.h=r&PQn,0)))}function Iyn(n,t,e,i,r,c,a){var u,o;return!(t.Ae()&&(o=n.a.ue(e,i),o<0||!r&&0==o)||t.Be()&&(u=n.a.ue(e,c),u>0||!a&&0==u))}function Oyn(n,t){if(zsn(),0!=n.j.g-t.j.g)return 0;switch(n.j.g){case 2:return jbn(t,bst)-jbn(n,bst);case 4:return jbn(n,lst)-jbn(t,lst)}return 0}function Ayn(n){switch(n.g){case 0:return xht;case 1:return Dht;case 2:return Rht;case 3:return Kht;case 4:return _ht;case 5:return Fht;default:return null}}function $yn(n,t,e){var i,r;return Ihn(r=new Lm,t),Nrn(r,e),f9((!n.c&&(n.c=new eU(YAt,n,12,10)),n.c),r),Len(i=r,0),Nen(i,1),nln(i,!0),Yfn(i,!0),i}function Lyn(n,t){var e,i;if(t>=n.i)throw Hp(new LO(t,n.i));return++n.j,e=n.g[t],(i=n.i-t-1)>0&&aHn(n.g,t+1,n.g,t,i),$X(n.g,--n.i,null),n.fi(t,e),n.ci(),e}function Nyn(n,t){var e;return n.Db>>16==17?n.Cb.ih(n,21,qAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||n.zh(),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function xyn(n){var t,e,i;for(SQ(),m$(n.c,n.a),i=new Wb(n.c);i.a<i.c.c.length;)for(e=n0(i),t=new Wb(n.b);t.a<t.c.c.length;)BB(n0(t),679).Ke(e)}function Dyn(n){var t,e,i;for(SQ(),m$(n.c,n.a),i=new Wb(n.c);i.a<i.c.c.length;)for(e=n0(i),t=new Wb(n.b);t.a<t.c.c.length;)BB(n0(t),369).Ke(e)}function Ryn(n){var t,e,i,r,c;for(r=DWn,c=null,i=new Wb(n.d);i.a<i.c.c.length;)(e=BB(n0(i),213)).d.j^e.e.j&&(t=e.e.e-e.d.e-e.a)<r&&(r=t,c=e);return c}function Kyn(){Kyn=O,dat=new $O(NZn,(hN(),!1)),fat=new $O(xZn,100),q7(),lat=new $O(DZn,bat=Oat),wat=new $O(RZn,lZn),gat=new $O(KZn,iln(DWn))}function _yn(n,t,e){var i,r,c,a,u,o;for(o=0,r=0,c=(i=n.a[t]).length;r<c;++r)for(u=Lfn(i[r],e).Kc();u.Ob();)a=BB(u.Pb(),11),VW(n.f,a,iln(o++))}function Fyn(n,t,e){var i,r;if(e)for(r=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);r.Ob();)JIn(n,t,kIn(dnn(e,BB(r.Pb(),19).a)))}function Byn(n,t,e){var i,r;if(e)for(r=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);r.Ob();)JIn(n,t,kIn(dnn(e,BB(r.Pb(),19).a)))}function Hyn(n){var t;return _Mn(),z9(t=BB(Emn(gz(n.k),x8(FIt,YZn,61,2,0,1)),122),0,t.length,null),t[0]==(kUn(),sIt)&&t[1]==CIt&&($X(t,0,CIt),$X(t,1,sIt)),t}function qyn(n,t,e){var i,r,c;return c=sDn(n,r=XNn(n,t,e)),K9(n.b),k0(n,t,e),SQ(),m$(r,new Vd(n)),i=sDn(n,r),K9(n.b),k0(n,e,t),new rI(iln(c),iln(i))}function Gyn(){Gyn=O,Umt=dq(new B2,(yMn(),Bat),(lWn(),dot)),Xmt=new iR("linearSegments.inputPrio",iln(0)),Wmt=new iR("linearSegments.outputPrio",iln(0))}function zyn(){zyn=O,Ryt=new fC("P1_TREEIFICATION",0),Kyt=new fC("P2_NODE_ORDERING",1),_yt=new fC("P3_NODE_PLACEMENT",2),Fyt=new fC("P4_EDGE_ROUTING",3)}function Uyn(){Uyn=O,sWn(),xjt=gPt,Kjt=LPt,Cjt=KSt,Ijt=BSt,Ojt=qSt,Pjt=DSt,Ajt=USt,Njt=fPt,KAn(),Mjt=wjt,Sjt=djt,$jt=pjt,Ljt=mjt,Djt=yjt,Rjt=kjt,_jt=Ejt}function Xyn(){Xyn=O,MCt=new qC("UNKNOWN",0),jCt=new qC("ABOVE",1),ECt=new qC("BELOW",2),TCt=new qC("INLINE",3),new iR("org.eclipse.elk.labelSide",MCt)}function Wyn(n,t){var e;if(n.ni()&&null!=t){for(e=0;e<n.i;++e)if(Nfn(t,n.g[e]))return e}else for(e=0;e<n.i;++e)if(GI(n.g[e])===GI(t))return e;return-1}function Vyn(n,t,e){var i,r;return t.c==(ain(),qvt)&&e.c==Hvt?-1:t.c==Hvt&&e.c==qvt?1:(i=dhn(t.a,n.a),r=dhn(e.a,n.a),t.c==qvt?r-i:i-r)}function Qyn(n,t,e){if(e&&(t<0||t>e.a.c.length))throw Hp(new _y("index must be >= 0 and <= layer node count"));n.c&&y7(n.c.a,n),n.c=e,e&&kG(e.a,t,n)}function Yyn(n,t){var e,i,r;for(i=new oz(ZL(hbn(n).a.Kc(),new h));dAn(i);)return e=BB(U5(i),17),new qf(yX((r=BB(t.Kb(e),10)).n.b+r.o.b/2));return iy(),iy(),Ont}function Jyn(n,t){this.c=new xp,this.a=n,this.b=t,this.d=BB(mMn(n,(hWn(),Alt)),304),GI(mMn(n,(HXn(),Lgt)))===GI((g7(),qht))?this.e=new gm:this.e=new dm}function Zyn(n,t){var i,r,c;for(c=0,r=new Wb(n);r.a<r.c.c.length;)i=BB(n0(r),33),c+=e.Math.pow(i.g*i.f-t,2);return e.Math.sqrt(c/(n.c.length-1))}function nkn(n,t){var e,i;return i=null,n.Xe((sWn(),CPt))&&(e=BB(n.We(CPt),94)).Xe(t)&&(i=e.We(t)),null==i&&n.yf()&&(i=n.yf().We(t)),null==i&&(i=mpn(t)),i}function tkn(n,t){var e,i;e=n.Zc(t);try{return i=e.Pb(),e.Qb(),i}catch(r){throw cL(r=lun(r),109)?Hp(new Ay("Can't remove element "+t)):Hp(r)}}function ekn(n,t){var e,i,r;if(0==(e=DBn(n,t,r=new von((i=new AT).q.getFullYear()-sQn,i.q.getMonth(),i.q.getDate())))||e<t.length)throw Hp(new _y(t));return r}function ikn(n,t){var e,i,r;for(kW(t),Tx(t!=n),r=n.b.c.length,i=t.Kc();i.Ob();)e=i.Pb(),WB(n.b,kW(e));return r!=n.b.c.length&&(Esn(n,0),!0)}function rkn(){rkn=O,sWn(),kat=CSt,new XA(dSt,(hN(),!0)),Tat=KSt,Mat=BSt,Sat=qSt,Eat=DSt,Pat=USt,Cat=fPt,Kyn(),yat=dat,vat=lat,mat=wat,jat=gat,pat=fat}function ckn(n,t){if(t==n.c)return n.d;if(t==n.d)return n.c;throw Hp(new _y("'port' must be either the source port or target port of the edge."))}function akn(n,t,e){var i,r;switch(r=n.o,i=n.d,t.g){case 1:return-i.d-e;case 3:return r.b+i.a+e;case 2:return r.a+i.c+e;case 4:return-i.b-e;default:return 0}}function ukn(n,t,e,i){var r,c,a;for(PZ(t,BB(i.Xb(0),29)),a=i.bd(1,i.gc()),c=BB(e.Kb(t),20).Kc();c.Ob();)ukn(n,(r=BB(c.Pb(),17)).c.i==t?r.d.i:r.c.i,e,a)}function okn(n){var t;return t=new xp,Lx(n,(hWn(),Dlt))?BB(mMn(n,Dlt),83):(JT(AV(new Rq(null,new w1(n.j,16)),new tr),new gd(t)),hon(n,Dlt,t),t)}function skn(n,t){var e;return n.Db>>16==6?n.Cb.ih(n,6,_Ot,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),yOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function hkn(n,t){var e;return n.Db>>16==7?n.Cb.ih(n,1,DOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),jOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function fkn(n,t){var e;return n.Db>>16==9?n.Cb.ih(n,9,UOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),TOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function lkn(n,t){var e;return n.Db>>16==5?n.Cb.ih(n,9,XAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),s$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function bkn(n,t){var e;return n.Db>>16==3?n.Cb.ih(n,0,BOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),e$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function wkn(n,t){var e;return n.Db>>16==7?n.Cb.ih(n,6,GOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),v$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function dkn(){this.a=new lo,this.g=new Avn,this.j=new Avn,this.b=new xp,this.d=new Avn,this.i=new Avn,this.k=new xp,this.c=new xp,this.e=new xp,this.f=new xp}function gkn(n,t,e){var i,r,c;for(e<0&&(e=0),c=n.i,r=e;r<c;r++)if(i=Wtn(n,r),null==t){if(null==i)return r}else if(GI(t)===GI(i)||Nfn(t,i))return r;return-1}function pkn(n,t){var e,i;return(e=t.Hh(n.a))?(i=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),j7n)),mK(E7n,i)?az(n,Utn(t.Hj())):i):null}function vkn(n,t){var e,i;if(t){if(t==n)return!0;for(e=0,i=BB(t,49).eh();i&&i!=t;i=i.eh()){if(++e>GQn)return vkn(n,i);if(i==n)return!0}}return!1}function mkn(n){switch(DN(),n.q.g){case 5:vIn(n,(kUn(),sIt)),vIn(n,SIt);break;case 4:z$n(n,(kUn(),sIt)),z$n(n,SIt);break;default:vUn(n,(kUn(),sIt)),vUn(n,SIt)}}function ykn(n){switch(DN(),n.q.g){case 5:SOn(n,(kUn(),oIt)),SOn(n,CIt);break;case 4:Cpn(n,(kUn(),oIt)),Cpn(n,CIt);break;default:mUn(n,(kUn(),oIt)),mUn(n,CIt)}}function kkn(n){var t,e;(t=BB(mMn(n,(fRn(),nat)),19))?(e=t.a,hon(n,(Mrn(),hat),0==e?new sbn:new C4(e))):hon(n,(Mrn(),hat),new C4(1))}function jkn(n,t){var e;switch(e=n.i,t.g){case 1:return-(n.n.b+n.o.b);case 2:return n.n.a-e.o.a;case 3:return n.n.b-e.o.b;case 4:return-(n.n.a+n.o.a)}return 0}function Ekn(n,t){switch(n.g){case 0:return t==(Tbn(),Flt)?rst:cst;case 1:return t==(Tbn(),Flt)?rst:ist;case 2:return t==(Tbn(),Flt)?ist:cst;default:return ist}}function Tkn(n,t){var i,r,c;for(y7(n.a,t),n.e-=t.r+(0==n.a.c.length?0:n.c),c=n4n,r=new Wb(n.a);r.a<r.c.c.length;)i=BB(n0(r),187),c=e.Math.max(c,i.d);n.b=c}function Mkn(n,t){var e;return n.Db>>16==3?n.Cb.ih(n,12,UOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),mOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Skn(n,t){var e;return n.Db>>16==11?n.Cb.ih(n,10,UOt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(CXn(),EOt),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Pkn(n,t){var e;return n.Db>>16==10?n.Cb.ih(n,11,qAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),g$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Ckn(n,t){var e;return n.Db>>16==10?n.Cb.ih(n,12,QAt,t):(e=Cvn(BB(itn(BB(yan(n,16),26)||(gWn(),m$t),n.Db>>16),18)),n.Cb.ih(n,e.n,e.f,t))}function Ikn(n){var t;return 0==(1&n.Bb)&&n.r&&n.r.kh()&&(t=BB(n.r,49),n.r=BB(tfn(n,t),138),n.r!=t&&0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,8,t,n.r))),n.r}function Okn(n,t,i){var r;return r=Pun(Gk(xNt,1),qQn,25,15,[iMn(n,(Dtn(),Git),t,i),iMn(n,zit,t,i),iMn(n,Uit,t,i)]),n.f&&(r[0]=e.Math.max(r[0],r[2]),r[2]=r[0]),r}function Akn(n,t){var e,i,r;if(0!=(r=Yvn(n,t)).c.length)for(m$(r,new ti),e=r.c.length,i=0;i<e;i++)hPn(n,(l1(i,r.c.length),BB(r.c[i],286)),TDn(n,r,i))}function $kn(n){var t,e,i;for(i=BB(h6(n.a,(LEn(),Tst)),15).Kc();i.Ob();)for(t=gz((e=BB(i.Pb(),101)).k).Kc();t.Ob();)iX(n,e,BB(t.Pb(),61),(Crn(),Dst),1)}function Lkn(n){var t,e;if(n.k==(uSn(),Put))for(e=new oz(ZL(hbn(n).a.Kc(),new h));dAn(e);)if(!b5(t=BB(U5(e),17))&&n.c==Ajn(t,n).c)return!0;return!1}function Nkn(n){var t,e;if(n.k==(uSn(),Put))for(e=new oz(ZL(hbn(n).a.Kc(),new h));dAn(e);)if(!b5(t=BB(U5(e),17))&&t.c.i.c==t.d.i.c)return!0;return!1}function xkn(n,t){var e,i;for(OTn(t,"Dull edge routing",1),i=spn(n.b,0);i.b!=i.d.c;)for(e=spn(BB(b3(i),86).d,0);e.b!=e.d.c;)yQ(BB(b3(e),188).a)}function Dkn(n,t){var e,i,r;if(t)for(r=((e=new hz(t.a.length)).b-e.a)*e.c<0?(eS(),MNt):new XL(e);r.Ob();)(i=x2(t,BB(r.Pb(),19).a))&&O$n(n,i)}function Rkn(){var n;for(tS(),nWn((QX(),t$t)),_Xn(t$t),Tyn(t$t),gWn(),L$t=l$t,n=new Wb(V$t);n.a<n.c.c.length;)azn(BB(n0(n),241),l$t,null);return!0}function Kkn(n,t){var e,i,r,c,a,u;return(a=n.h>>19)!=(u=t.h>>19)?u-a:(i=n.h)!=(c=t.h)?i-c:(e=n.m)!=(r=t.m)?e-r:n.l-t.l}function _kn(){_kn=O,tRn(),Pit=new $O(UYn,Cit=xit),Rnn(),Mit=new $O(XYn,Sit=mit),hpn(),Eit=new $O(WYn,Tit=dit),jit=new $O(VYn,(hN(),!0))}function Fkn(n,t,e){var i,r;i=t*e,cL(n.g,145)?(r=f3(n)).f.d?r.f.a||(n.d.a+=i+fJn):(n.d.d-=i+fJn,n.d.a+=i+fJn):cL(n.g,10)&&(n.d.d-=i,n.d.a+=2*i)}function Bkn(n,t,i){var r,c,a,u,o;for(c=n[i.g],o=new Wb(t.d);o.a<o.c.c.length;)(a=(u=BB(n0(o),101)).i)&&a.i==i&&(c[r=u.d[i.g]]=e.Math.max(c[r],a.j.b))}function Hkn(n,t){var i,r,c,a,u;for(r=0,c=0,i=0,u=new Wb(t.d);u.a<u.c.c.length;)Gmn(a=BB(n0(u),443)),r=e.Math.max(r,a.b),c+=a.d+(i>0?n.g:0),++i;t.b=r,t.e=c}function qkn(n){var t,e,i;if(i=n.b,qT(n.i,i.length)){for(e=2*i.length,n.b=x8(Gnt,CVn,317,e,0,1),n.c=x8(Gnt,CVn,317,e,0,1),n.f=e-1,n.i=0,t=n.a;t;t=t.c)YCn(n,t,t);++n.g}}function Gkn(n,t,e,i){var r,c,a,u;for(r=0;r<t.o;r++)for(c=r-t.j+e,a=0;a<t.p;a++)u=a-t.k+i,vmn(t,r,a)?cmn(n,c,u)||Xmn(n,c,u):ymn(t,r,a)&&(imn(n,c,u)||Wmn(n,c,u))}function zkn(n,t,e){var i;(i=t.c.i).k==(uSn(),Put)?(hon(n,(hWn(),hlt),BB(mMn(i,hlt),11)),hon(n,flt,BB(mMn(i,flt),11))):(hon(n,(hWn(),hlt),t.c),hon(n,flt,e.d))}function Ukn(n,t,i){var r,c,a,u,o,s;return jDn(),u=t/2,a=i/2,o=1,s=1,(r=e.Math.abs(n.a))>u&&(o=u/r),(c=e.Math.abs(n.b))>a&&(s=a/c),kL(n,e.Math.min(o,s)),n}function Xkn(){var n,t;qBn();try{if(t=BB(Xjn((WM(),zAt),y6n),2014))return t}catch(e){if(!cL(e=lun(e),102))throw Hp(e);n=e,uz((u$(),n))}return new ao}function Wkn(){var n,t;d7();try{if(t=BB(Xjn((WM(),zAt),S7n),2024))return t}catch(e){if(!cL(e=lun(e),102))throw Hp(e);n=e,uz((u$(),n))}return new Ds}function Vkn(){var n,t;qBn();try{if(t=BB(Xjn((WM(),zAt),V9n),1941))return t}catch(e){if(!cL(e=lun(e),102))throw Hp(e);n=e,uz((u$(),n))}return new qo}function Qkn(n,t,e){var i,r;return r=n.e,n.e=t,0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,4,r,t),e?e.Ei(i):e=i),r!=t&&(e=azn(n,t?kLn(n,t):n.a,e)),e}function Ykn(){AT.call(this),this.e=-1,this.a=!1,this.p=_Vn,this.k=-1,this.c=-1,this.b=-1,this.g=!1,this.f=-1,this.j=-1,this.n=-1,this.i=-1,this.d=-1,this.o=_Vn}function Jkn(n,t){var e,i,r;if(i=n.b.d.d,n.a||(i+=n.b.d.a),r=t.b.d.d,t.a||(r+=t.b.d.a),0==(e=Pln(i,r))){if(!n.a&&t.a)return-1;if(!t.a&&n.a)return 1}return e}function Zkn(n,t){var e,i,r;if(i=n.b.b.d,n.a||(i+=n.b.b.a),r=t.b.b.d,t.a||(r+=t.b.b.a),0==(e=Pln(i,r))){if(!n.a&&t.a)return-1;if(!t.a&&n.a)return 1}return e}function njn(n,t){var e,i,r;if(i=n.b.g.d,n.a||(i+=n.b.g.a),r=t.b.g.d,t.a||(r+=t.b.g.a),0==(e=Pln(i,r))){if(!n.a&&t.a)return-1;if(!t.a&&n.a)return 1}return e}function tjn(){tjn=O,Nat=WG(dq(dq(dq(new B2,(yMn(),Fat),(lWn(),yot)),Fat,Tot),Bat,Aot),Bat,oot),Dat=dq(dq(new B2,Fat,Jut),Fat,sot),xat=WG(new B2,Bat,fot)}function ejn(n){var t,e,i,r,c;for(t=BB(mMn(n,(hWn(),zft)),83),c=n.n,i=t.Cc().Kc();i.Ob();)(r=(e=BB(i.Pb(),306)).i).c+=c.a,r.d+=c.b,e.c?NDn(e):xDn(e);hon(n,zft,null)}function ijn(n,t,e){var i,r;switch(i=(r=n.b).d,t.g){case 1:return-i.d-e;case 2:return r.o.a+i.c+e;case 3:return r.o.b+i.a+e;case 4:return-i.b-e;default:return-1}}function rjn(n){var t,e,i,r,c;if(i=0,r=ZJn,n.b)for(t=0;t<360;t++)e=.017453292519943295*t,UKn(n,n.d,0,0,Z3n,e),(c=n.b.ig(n.d))<r&&(i=e,r=c);UKn(n,n.d,0,0,Z3n,i)}function cjn(n,t){var e,i,r,c;for(c=new xp,t.e=null,t.f=null,i=new Wb(t.i);i.a<i.c.c.length;)e=BB(n0(i),65),r=BB(RX(n.g,e.a),46),e.a=qz(e.b),VW(c,e.a,r);n.g=c}function ajn(n,t,e){var i,r,c,a,u;for(r=(t-n.e)/n.d.c.length,c=0,u=new Wb(n.d);u.a<u.c.c.length;)a=BB(n0(u),443),i=n.b-a.b+e,kdn(a,a.e+c*r,a.f),hmn(a,r,i),++c}function ujn(n){var t;if(n.f.qj(),-1!=n.b){if(++n.b,t=n.f.d[n.a],n.b<t.i)return;++n.a}for(;n.a<n.f.d.length;++n.a)if((t=n.f.d[n.a])&&0!=t.i)return void(n.b=0);n.b=-1}function ojn(n,t){var e,i,r;for(e=$Cn(n,0==(r=t.c.length)?"":(l1(0,t.c.length),SD(t.c[0]))),i=1;i<r&&e;++i)e=BB(e,49).oh((l1(i,t.c.length),SD(t.c[i])));return e}function sjn(n,t){var e,i;for(i=new Wb(t);i.a<i.c.c.length;)e=BB(n0(i),10),n.c[e.c.p][e.p].a=OG(n.i),n.c[e.c.p][e.p].d=Gy(n.c[e.c.p][e.p].a),n.c[e.c.p][e.p].b=1}function hjn(n,t){var i,r,c;for(c=0,r=new Wb(n);r.a<r.c.c.length;)i=BB(n0(r),157),c+=e.Math.pow(iG(i)*eG(i)-t,2);return e.Math.sqrt(c/(n.c.length-1))}function fjn(n,t,e,i){var r,c,a;return a=NRn(n,c=qRn(n,t,e,i)),fMn(n,t,e,i),K9(n.b),SQ(),m$(c,new Qd(n)),r=NRn(n,c),fMn(n,e,t,i),K9(n.b),new rI(iln(a),iln(r))}function ljn(n,t,e){var i;for(OTn(e,"Interactive node placement",1),n.a=BB(mMn(t,(hWn(),Alt)),304),i=new Wb(t.b);i.a<i.c.c.length;)nDn(n,BB(n0(i),29));HSn(e)}function bjn(n,t){OTn(t,"General Compactor",1),t.n&&n&&y0(t,o2(n),(Bsn(),uOt)),dwn(BB(ZAn(n,(Uyn(),Sjt)),380)).hg(n),t.n&&n&&y0(t,o2(n),(Bsn(),uOt))}function wjn(n,t,e){var i,r;for(CA(n,n.j+t,n.k+e),r=new AL((!n.a&&(n.a=new $L(xOt,n,5)),n.a));r.e!=r.i.gc();)TA(i=BB(kpn(r),469),i.a+t,i.b+e);PA(n,n.b+t,n.c+e)}function djn(n,t,e,i){switch(e){case 7:return!n.e&&(n.e=new hK(_Ot,n,7,4)),Ywn(n.e,t,i);case 8:return!n.d&&(n.d=new hK(_Ot,n,8,5)),Ywn(n.d,t,i)}return FTn(n,t,e,i)}function gjn(n,t,e,i){switch(e){case 7:return!n.e&&(n.e=new hK(_Ot,n,7,4)),_pn(n.e,t,i);case 8:return!n.d&&(n.d=new hK(_Ot,n,8,5)),_pn(n.d,t,i)}return run(n,t,e,i)}function pjn(n,t,e){var i,r,c;if(e)for(c=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);c.Ob();)(r=x2(e,BB(c.Pb(),19).a))&&bIn(n,r,t)}function vjn(n,t,e){var i,r,c;return n.qj(),c=null==t?0:nsn(t),n.f>0&&(r=aOn(n,(c&DWn)%n.d.length,c,t))?r.ed(e):(i=n.tj(c,t,e),n.c.Fc(i),null)}function mjn(n,t){var e,i,r,c;switch(Cfn(n,t)._k()){case 3:case 2:for(r=0,c=(e=YBn(t)).i;r<c;++r)if(5==DW(B7(n,i=BB(Wtn(e,r),34))))return i}return null}function yjn(n){var t,e,i,r,c;if(qT(n.f,n.b.length))for(i=x8(Qnt,CVn,330,2*n.b.length,0,1),n.b=i,r=i.length-1,e=n.a;e!=n;e=e.Rd())t=(c=BB(e,330)).d&r,c.a=i[t],i[t]=c}function kjn(n,t){var i,r,c,a;for(a=0,c=BB(BB(h6(n.r,t),21),84).Kc();c.Ob();)r=BB(c.Pb(),111),a=e.Math.max(a,r.e.a+r.b.rf().a);(i=BB(oV(n.b,t),124)).n.b=0,i.a.a=a}function jjn(n,t){var i,r,c,a;for(i=0,a=BB(BB(h6(n.r,t),21),84).Kc();a.Ob();)c=BB(a.Pb(),111),i=e.Math.max(i,c.e.b+c.b.rf().b);(r=BB(oV(n.b,t),124)).n.d=0,r.a.b=i}function Ejn(n){var t,e;return e=BB(mMn(n,(hWn(),Zft)),21),t=kA(vyt),e.Hc((bDn(),gft))&&Jcn(t,kyt),e.Hc(vft)&&Jcn(t,Eyt),e.Hc(sft)&&Jcn(t,myt),e.Hc(fft)&&Jcn(t,yyt),t}function Tjn(n,t){var e;OTn(t,"Delaunay triangulation",1),e=new Np,Otn(n.i,new yg(e)),qy(TD(mMn(n,(Xcn(),Qrt)))),n.e?Frn(n.e,$Xn(e)):n.e=$Xn(e),HSn(t)}function Mjn(n){if(n<0)throw Hp(new _y("The input must be positive"));return n<MMt.length?j2(MMt[n]):e.Math.sqrt(Z3n*n)*(ifn(n,n)/efn(2.718281828459045,n))}function Sjn(n,t){var e;if(n.ni()&&null!=t){for(e=0;e<n.i;++e)if(Nfn(t,n.g[e]))return!0}else for(e=0;e<n.i;++e)if(GI(n.g[e])===GI(t))return!0;return!1}function Pjn(n,t){if(null==t){for(;n.a.Ob();)if(null==BB(n.a.Pb(),42).dd())return!0}else for(;n.a.Ob();)if(Nfn(t,BB(n.a.Pb(),42).dd()))return!0;return!1}function Cjn(n,t){var e;return t===n||!!cL(t,664)&&(e=BB(t,1947),ign(n.g||(n.g=new Zf(n)),e.g||(e.g=new Zf(e))))}function Ijn(n){var t,i,r;for(t="Sz",i="ez",r=e.Math.min(n.length,5)-1;r>=0;r--)if(mK(n[r].d,t)||mK(n[r].d,i)){n.length>=r+1&&n.splice(0,r+1);break}return n}function Ojn(n,t){var i;return JO(n)&&JO(t)&&$Qn<(i=n/t)&&i<OQn?i<0?e.Math.ceil(i):e.Math.floor(i):uan(Aqn(JO(n)?Pan(n):n,JO(t)?Pan(t):t,!1))}function Ajn(n,t){if(t==n.c.i)return n.d.i;if(t==n.d.i)return n.c.i;throw Hp(new _y("'node' must either be the source node or target node of the edge."))}function $jn(n){var t,e,i,r;if(r=BB(mMn(n,(hWn(),Fft)),37)){for(i=new Gj,t=vW(n.c.i);t!=r;)t=vW(e=t.e),_x(UR(UR(i,e.n),t.c),t.d.b,t.d.d);return i}return Fut}function Ljn(n){var t;JT(wnn(new Rq(null,new w1((t=BB(mMn(n,(hWn(),Olt)),403)).d,16)),new _i),new wd(n)),JT(AV(new Rq(null,new w1(t.d,16)),new Fi),new dd(n))}function Njn(n,t){var e,i;for(e=new oz(ZL((t?lbn(n):fbn(n)).a.Kc(),new h));dAn(e);)if((i=Ajn(BB(U5(e),17),n)).k==(uSn(),Put)&&i.c!=n.c)return i;return null}function xjn(n){var t,i,r;for(i=new Wb(n.p);i.a<i.c.c.length;)(t=BB(n0(i),10)).k==(uSn(),Cut)&&(r=t.o.b,n.i=e.Math.min(n.i,r),n.g=e.Math.max(n.g,r))}function Djn(n,t,e){var i,r,c;for(c=new Wb(t);c.a<c.c.c.length;)i=BB(n0(c),10),n.c[i.c.p][i.p].e=!1;for(r=new Wb(t);r.a<r.c.c.length;)xzn(n,i=BB(n0(r),10),e)}function Rjn(n,t,i){var r,c;(r=Tfn(t.j,i.s,i.c)+Tfn(i.e,t.s,t.c))==(c=Tfn(i.j,t.s,t.c)+Tfn(t.e,i.s,i.c))?r>0&&(n.b+=2,n.a+=r):(n.b+=1,n.a+=e.Math.min(r,c))}function Kjn(n,t){var e;if(e=!1,XI(t)&&(e=!0,nW(n,new GX(SD(t)))),e||cL(t,236)&&(e=!0,nW(n,new Sl(XK(BB(t,236))))),!e)throw Hp(new Ly(H6n))}function _jn(n,t,e,i){var r,c,a;return r=new N7(n.e,1,10,cL(a=t.c,88)?BB(a,26):(gWn(),d$t),cL(c=e.c,88)?BB(c,26):(gWn(),d$t),uvn(n,t),!1),i?i.Ei(r):i=r,i}function Fjn(n){var t,e;switch(BB(mMn(vW(n),(HXn(),pgt)),420).g){case 0:return t=n.n,e=n.o,new xC(t.a+e.a/2,t.b+e.b/2);case 1:return new wA(n.n);default:return null}}function Bjn(){Bjn=O,Qht=new AP(QZn,0),Vht=new AP("LEFTUP",1),Jht=new AP("RIGHTUP",2),Wht=new AP("LEFTDOWN",3),Yht=new AP("RIGHTDOWN",4),Xht=new AP("BALANCED",5)}function Hjn(n,t,e){var i,r,c;if(0==(i=Pln(n.a[t.p],n.a[e.p]))){if(r=BB(mMn(t,(hWn(),clt)),15),c=BB(mMn(e,clt),15),r.Hc(e))return-1;if(c.Hc(t))return 1}return i}function qjn(n){switch(n.g){case 1:return new _a;case 2:return new Fa;case 3:return new Ka;case 0:return null;default:throw Hp(new _y(c4n+(null!=n.f?n.f:""+n.g)))}}function Gjn(n,t,e){switch(t){case 1:return!n.n&&(n.n=new eU(zOt,n,1,7)),sqn(n.n),!n.n&&(n.n=new eU(zOt,n,1,7)),void pX(n.n,BB(e,14));case 2:return void $in(n,SD(e))}rsn(n,t,e)}function zjn(n,t,e){switch(t){case 3:return void Men(n,Gy(MD(e)));case 4:return void Sen(n,Gy(MD(e)));case 5:return void Pen(n,Gy(MD(e)));case 6:return void Cen(n,Gy(MD(e)))}Gjn(n,t,e)}function Ujn(n,t,e){var i,r;(i=HTn(r=new Lm,t,null))&&i.Fi(),Nrn(r,e),f9((!n.c&&(n.c=new eU(YAt,n,12,10)),n.c),r),Len(r,0),Nen(r,1),nln(r,!0),Yfn(r,!0)}function Xjn(n,t){var e,i;return cL(e=hS(n.g,t),235)?((i=BB(e,235)).Qh(),i.Nh()):cL(e,498)?i=BB(e,1938).b:null}function Wjn(n,t,e,i){var r,c;return yX(t),yX(e),R7(!!(c=BB(UK(n.d,t),19)),"Row %s not in %s",t,n.e),R7(!!(r=BB(UK(n.b,e),19)),"Column %s not in %s",e,n.c),Sun(n,c.a,r.a,i)}function Vjn(n,t,e,i,r,c,a){var u,o,s,h,f;if(f=Bmn(u=(s=c==a-1)?i:0,h=r[c]),10!=i&&Pun(Gk(n,a-c),t[c],e[c],u,f),!s)for(++c,o=0;o<h;++o)f[o]=Vjn(n,t,e,i,r,c,a);return f}function Qjn(n){if(-1==n.g)throw Hp(new dv);n.mj();try{n.i.$c(n.g),n.f=n.i.j,n.g<n.e&&--n.e,n.g=-1}catch(t){throw cL(t=lun(t),73)?Hp(new vv):Hp(t)}}function Yjn(n,t){return n.b.a=e.Math.min(n.b.a,t.c),n.b.b=e.Math.min(n.b.b,t.d),n.a.a=e.Math.max(n.a.a,t.c),n.a.b=e.Math.max(n.a.b,t.d),n.c[n.c.length]=t,!0}function Jjn(n){var t,e,i;for(i=-1,e=0,t=new Wb(n);t.a<t.c.c.length;){if(BB(n0(t),243).c==(ain(),Hvt)){i=0==e?0:e-1;break}e==n.c.length-1&&(i=e),e+=1}return i}function Zjn(n){var t,i,r,c;for(c=0,t=0,r=new Wb(n.c);r.a<r.c.c.length;)Pen(i=BB(n0(r),33),n.e+c),Cen(i,n.f),c+=i.g+n.b,t=e.Math.max(t,i.f+n.b);n.d=c-n.b,n.a=t-n.b}function nEn(n){var t,e,i;for(e=new Wb(n.a.b);e.a<e.c.c.length;)i=(t=BB(n0(e),57)).d.c,t.d.c=t.d.d,t.d.d=i,i=t.d.b,t.d.b=t.d.a,t.d.a=i,i=t.b.a,t.b.a=t.b.b,t.b.b=i;yNn(n)}function tEn(n){var t,e,i;for(e=new Wb(n.a.b);e.a<e.c.c.length;)i=(t=BB(n0(e),81)).g.c,t.g.c=t.g.d,t.g.d=i,i=t.g.b,t.g.b=t.g.a,t.g.a=i,i=t.e.a,t.e.a=t.e.b,t.e.b=i;kNn(n)}function eEn(n){var t,e,i,r,c;for(c=gz(n.k),kUn(),i=0,r=(e=Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length;i<r;++i)if((t=e[i])!=PIt&&!c.Hc(t))return t;return null}function iEn(n,t){var e,i;return(i=BB(EN(Qon(AV(new Rq(null,new w1(t.j,16)),new bc))),11))&&(e=BB(xq(i.e,0),17))?BB(mMn(e,(hWn(),wlt)),19).a:gnn(n.b)}function rEn(n,t){var e,i,r;for(r=new Wb(t.a);r.a<r.c.c.length;)for(i=BB(n0(r),10),nk(n.d),e=new oz(ZL(lbn(i).a.Kc(),new h));dAn(e);)XOn(n,i,BB(U5(e),17).d.i)}function cEn(n,t){var e,i;for(y7(n.b,t),i=new Wb(n.n);i.a<i.c.c.length;)if(-1!=E7((e=BB(n0(i),211)).c,t,0)){y7(e.c,t),Zjn(e),0==e.c.c.length&&y7(n.n,e);break}fHn(n)}function aEn(n,t){var i,r,c,a,u;for(u=n.f,c=0,a=0,r=new Wb(n.a);r.a<r.c.c.length;)Tvn(i=BB(n0(r),187),n.e,u),p9(i,t),a=e.Math.max(a,i.r),c=u+=i.d+n.c;n.d=a,n.b=c}function uEn(n){var t,e;return h3(e=wLn(n))?null:(yX(e),t=BB(emn(new oz(ZL(e.a.Kc(),new h))),79),PTn(BB(Wtn((!t.b&&(t.b=new hK(KOt,t,4,7)),t.b),0),82)))}function oEn(n){return n.o||(n.Lj()?n.o=new aW(n,n,null):n.rk()?n.o=new rR(n,null):1==DW(B7((IPn(),Z$t),n))?n.o=new g4(n):n.o=new cR(n,null)),n.o}function sEn(n,t,e,i){var r,c,a,u,o;e.mh(t)&&(r=(a=t)?BB(i,49).xh(a):null)&&(o=e.ah(t),(u=t.t)>1||-1==u?(c=BB(o,15),r.Wb(Xdn(n,c))):r.Wb(t_n(n,BB(o,56))))}function hEn(n,t,e,i){YE();var r=PWn;function c(){for(var n=0;n<r.length;n++)r[n]()}if(n)try{HNt(c)()}catch(a){n(t,a)}else HNt(c)()}function fEn(n){var t,e,i,r,c;for(i=new usn(new Pb(n.b).a);i.b;)t=BB((e=ten(i)).cd(),10),c=BB(BB(e.dd(),46).a,10),r=BB(BB(e.dd(),46).b,8),UR(kO(t.n),UR(B$(c.n),r))}function lEn(n){switch(BB(mMn(n.b,(HXn(),egt)),375).g){case 1:JT($V(wnn(new Rq(null,new w1(n.d,16)),new _r),new Fr),new Br);break;case 2:vRn(n);break;case 0:CCn(n)}}function bEn(n,t,e){OTn(e,"Straight Line Edge Routing",1),e.n&&t&&y0(e,o2(t),(Bsn(),uOt)),mHn(n,BB(ZAn(t,(wD(),Vkt)),33)),e.n&&t&&y0(e,o2(t),(Bsn(),uOt))}function wEn(){wEn=O,ZMt=new RC("V_TOP",0),JMt=new RC("V_CENTER",1),YMt=new RC("V_BOTTOM",2),VMt=new RC("H_LEFT",3),WMt=new RC("H_CENTER",4),QMt=new RC("H_RIGHT",5)}function dEn(n){var t;return 0!=(64&n.Db)?Cwn(n):((t=new fN(Cwn(n))).a+=" (abstract: ",yE(t,0!=(256&n.Bb)),t.a+=", interface: ",yE(t,0!=(512&n.Bb)),t.a+=")",t.a)}function gEn(n,t,e,i){var r,c,a;return mA(n.e)&&(a=LY(n,1,r=t.ak(),t.dd(),c=e.dd(),r.$j()?pBn(n,r,c,cL(r,99)&&0!=(BB(r,18).Bb&BQn)):-1,!0),i?i.Ei(a):i=a),i}function pEn(n){var t;null==n.c&&(t=GI(n.b)===GI(Ynt)?null:n.b,n.d=null==t?zWn:ez(t)?jN(EQ(t)):XI(t)?qVn:nE(tsn(t)),n.a=n.a+": "+(ez(t)?CR(EQ(t)):t+""),n.c="("+n.d+") "+n.a)}function vEn(n,t){this.e=n,QI(e0(t,-4294967296),0)?(this.d=1,this.a=Pun(Gk(ANt,1),hQn,25,15,[dG(t)])):(this.d=2,this.a=Pun(Gk(ANt,1),hQn,25,15,[dG(t),dG(kz(t,32))]))}function mEn(){function n(){try{return(new Map).entries().next().done}catch(n){return!1}}return typeof Map===xWn&&Map.prototype.entries&&n()?Map:bUn()}function yEn(n,t){var e,i,r;for(r=new M2(n.e,0),e=0;r.b<r.d.gc();){if((i=Gy((Px(r.b<r.d.gc()),MD(r.d.Xb(r.c=r.b++))))-t)>D3n)return e;i>-1e-6&&++e}return e}function kEn(n,t){var e;t!=n.b?(e=null,n.b&&(e=oJ(n.b,n,-4,e)),t&&(e=Npn(t,n,-4,e)),(e=Zhn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,t,t))}function jEn(n,t){var e;t!=n.f?(e=null,n.f&&(e=oJ(n.f,n,-1,e)),t&&(e=Npn(t,n,-1,e)),(e=nfn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,0,t,t))}function EEn(n){var t,e,i;if(null==n)return null;if((e=BB(n,15)).dc())return"";for(i=new Sk,t=e.Kc();t.Ob();)cO(i,(Uqn(),SD(t.Pb()))),i.a+=" ";return KO(i,i.a.length-1)}function TEn(n){var t,e,i;if(null==n)return null;if((e=BB(n,15)).dc())return"";for(i=new Sk,t=e.Kc();t.Ob();)cO(i,(Uqn(),SD(t.Pb()))),i.a+=" ";return KO(i,i.a.length-1)}function MEn(n,t,e){var i,r;return i=n.c[t.c.p][t.p],r=n.c[e.c.p][e.p],null!=i.a&&null!=r.a?Tz(i.a,r.a):null!=i.a?-1:null!=r.a?1:0}function SEn(n,t){var e,i,r;if(t)for(r=((e=new hz(t.a.length)).b-e.a)*e.c<0?(eS(),MNt):new XL(e);r.Ob();)i=x2(t,BB(r.Pb(),19).a),OV(new Bg(n).a,i)}function PEn(n,t){var e,i,r;if(t)for(r=((e=new hz(t.a.length)).b-e.a)*e.c<0?(eS(),MNt):new XL(e);r.Ob();)i=x2(t,BB(r.Pb(),19).a),IV(new $g(n).a,i)}function CEn(n){if(null!=n&&n.length>0&&33==fV(n,n.length-1))try{return null==YPn(fx(n,0,n.length-1)).e}catch(t){if(!cL(t=lun(t),32))throw Hp(t)}return!1}function IEn(n,t,e){var i,r,c;return i=t.ak(),c=t.dd(),r=i.$j()?LY(n,3,i,null,c,pBn(n,i,c,cL(i,99)&&0!=(BB(i,18).Bb&BQn)),!0):LY(n,1,i,i.zj(),c,-1,!0),e?e.Ei(r):e=r,e}function OEn(){var n,t,e;for(t=0,n=0;n<1;n++){if(0==(e=QOn((b1(n,1),"X".charCodeAt(n)))))throw Hp(new ak("Unknown Option: "+"X".substr(n)));t|=e}return t}function AEn(n,t,e){var i,r;switch(i=Wln(vW(t)),CZ(r=new CSn,t),e.g){case 1:qCn(r,Tln(hwn(i)));break;case 2:qCn(r,hwn(i))}return hon(r,(HXn(),tpt),MD(mMn(n,tpt))),r}function $En(n){var t,e;return t=BB(U5(new oz(ZL(fbn(n.a).a.Kc(),new h))),17),e=BB(U5(new oz(ZL(lbn(n.a).a.Kc(),new h))),17),qy(TD(mMn(t,(hWn(),Clt))))||qy(TD(mMn(e,Clt)))}function LEn(){LEn=O,Mst=new yP("ONE_SIDE",0),Pst=new yP("TWO_SIDES_CORNER",1),Cst=new yP("TWO_SIDES_OPPOSING",2),Sst=new yP("THREE_SIDES",3),Tst=new yP("FOUR_SIDES",4)}function NEn(n,t,e,i,r){var c,a;c=BB(P4(AV(t.Oc(),new Zr),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),a=BB(gan(n.b,e,i),15),0==r?a.Wc(0,c):a.Gc(c)}function xEn(n,t){var e,i,r;for(i=new Wb(t.a);i.a<i.c.c.length;)for(e=new oz(ZL(fbn(BB(n0(i),10)).a.Kc(),new h));dAn(e);)r=BB(U5(e),17).c.i.p,n.n[r]=n.n[r]-1}function DEn(n,t){var e,i,r,c;for(r=new Wb(t.d);r.a<r.c.c.length;)for(i=BB(n0(r),101),c=BB(RX(n.c,i),112).o,e=new QT(i.b);e.a<e.c.a.length;)g9(i,BB(u4(e),61),c)}function REn(n){var t;for(t=new Wb(n.e.b);t.a<t.c.c.length;)hzn(n,BB(n0(t),29));JT(AV(wnn(wnn(new Rq(null,new w1(n.e.b,16)),new Xc),new Zc),new na),new hg(n))}function KEn(n,t){return!!t&&!n.Di(t)&&(n.i?n.i.Ei(t):cL(t,143)?(n.i=BB(t,143),!0):(n.i=new po,n.i.Ei(t)))}function _En(n){if(n=FBn(n,!0),mK(a5n,n)||mK("1",n))return hN(),vtt;if(mK(u5n,n)||mK("0",n))return hN(),ptt;throw Hp(new ik("Invalid boolean value: '"+n+"'"))}function FEn(n,t,e){var i,r,c;for(r=n.vc().Kc();r.Ob();)if(c=(i=BB(r.Pb(),42)).cd(),GI(t)===GI(c)||null!=t&&Nfn(t,c))return e&&(i=new PS(i.cd(),i.dd()),r.Qb()),i;return null}function BEn(n){var t,e,i;qD(),n.B.Hc((n_n(),qIt))&&(i=n.f.i,t=new gY(n.a.c),(e=new bm).b=t.c-i.c,e.d=t.d-i.d,e.c=i.c+i.b-(t.c+t.b),e.a=i.d+i.a-(t.d+t.a),n.e.Ff(e))}function HEn(n,t,i,r){var c,a,u;for(u=e.Math.min(i,WFn(BB(n.b,65),t,i,r)),a=new Wb(n.a);a.a<a.c.c.length;)(c=BB(n0(a),221))!=t&&(u=e.Math.min(u,HEn(c,t,u,r)));return u}function qEn(n){var t,e,i;for(i=x8(Out,sVn,193,n.b.c.length,0,2),e=new M2(n.b,0);e.b<e.d.gc();)Px(e.b<e.d.gc()),t=BB(e.d.Xb(e.c=e.b++),29),i[e.b-1]=n2(t.a);return i}function GEn(n,t,e,i,r){var c,a,u,o;for(a=nj(Zk(H_(tvn(e)),i),akn(n,e,r)),o=DSn(n,e).Kc();o.Ob();)t[(u=BB(o.Pb(),11)).p]&&(c=t[u.p].i,WB(a.d,new xG(c,kln(a,c))));Pwn(a)}function zEn(n,t){this.f=new xp,this.b=new xp,this.j=new xp,this.a=n,this.c=t,this.c>0&&_yn(this,this.c-1,(kUn(),oIt)),this.c<this.a.length-1&&_yn(this,this.c+1,(kUn(),CIt))}function UEn(n){n.length>0&&n[0].length>0&&(this.c=qy(TD(mMn(vW(n[0][0]),(hWn(),alt))))),this.a=x8(Pmt,sVn,2018,n.length,0,2),this.b=x8(Lmt,sVn,2019,n.length,0,2),this.d=new Thn}function XEn(n){return 0!=n.c.length&&((l1(0,n.c.length),BB(n.c[0],17)).c.i.k==(uSn(),Put)||o5($V(new Rq(null,new w1(n,16)),new Kc),new _c))}function WEn(n,t,e){return OTn(e,"Tree layout",1),h2(n.b),CU(n.b,(zyn(),Ryt),Ryt),CU(n.b,Kyt,Kyt),CU(n.b,_yt,_yt),CU(n.b,Fyt,Fyt),n.a=$qn(n.b,t),lxn(n,t,mcn(e,1)),HSn(e),t}function VEn(n,t){var i,r,c,a,u,o;for(u=wDn(t),c=t.f,o=t.g,a=e.Math.sqrt(c*c+o*o),r=0,i=new Wb(u);i.a<i.c.c.length;)r+=VEn(n,BB(n0(i),33));return e.Math.max(r,a)}function QEn(){QEn=O,YCt=new UC(hJn,0),QCt=new UC("FREE",1),VCt=new UC("FIXED_SIDE",2),UCt=new UC("FIXED_ORDER",3),WCt=new UC("FIXED_RATIO",4),XCt=new UC("FIXED_POS",5)}function YEn(n,t){var e,i,r;if(e=t.Hh(n.a))for(r=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),T7n)),i=1;i<(IPn(),nLt).length;++i)if(mK(nLt[i],r))return i;return 0}function JEn(n){var t,e,i,r;if(null==n)return zWn;for(r=new $an(FWn,"[","]"),e=0,i=(t=n).length;e<i;++e)b6(r,""+t[e]);return r.a?0==r.e.length?r.a.a:r.a.a+""+r.e:r.c}function ZEn(n){var t,e,i,r;if(null==n)return zWn;for(r=new $an(FWn,"[","]"),e=0,i=(t=n).length;e<i;++e)b6(r,""+t[e]);return r.a?0==r.e.length?r.a.a:r.a.a+""+r.e:r.c}function nTn(n){var t,e,i;for(i=new $an(FWn,"{","}"),e=n.vc().Kc();e.Ob();)b6(i,W3(n,(t=BB(e.Pb(),42)).cd())+"="+W3(n,t.dd()));return i.a?0==i.e.length?i.a.a:i.a.a+""+i.e:i.c}function tTn(n){for(var t,e,i,r;!Wy(n.o);)e=BB(dU(n.o),46),i=BB(e.a,121),r=Nbn(t=BB(e.b,213),i),t.e==i?(RN(r.g,t),i.e=r.e+t.a):(RN(r.b,t),i.e=r.e-t.a),WB(n.e.a,i)}function eTn(n,t){var e,i,r;for(e=null,r=BB(t.Kb(n),20).Kc();r.Ob();)if(i=BB(r.Pb(),17),e){if((i.c.i==n?i.d.i:i.c.i)!=e)return!1}else e=i.c.i==n?i.d.i:i.c.i;return!0}function iTn(n,t){var e,i,r;for(i=new Wb(QLn(n,!1,t));i.a<i.c.c.length;)0==(e=BB(n0(i),129)).d?(WZ(e,null),VZ(e,null)):(r=e.a,WZ(e,e.b),VZ(e,r))}function rTn(n){var t,e;return Jcn(t=new B2,Cyt),(e=BB(mMn(n,(hWn(),Zft)),21)).Hc((bDn(),vft))&&Jcn(t,$yt),e.Hc(sft)&&Jcn(t,Iyt),e.Hc(gft)&&Jcn(t,Ayt),e.Hc(fft)&&Jcn(t,Oyt),t}function cTn(n){var t,e,i,r;for(Sqn(n),e=new oz(ZL(hbn(n).a.Kc(),new h));dAn(e);)r=(i=(t=BB(U5(e),17)).c.i==n)?t.d:t.c,i?MZ(t,null):SZ(t,null),hon(t,(hWn(),mlt),r),uAn(n,r.i)}function aTn(n,t,e,i){var r,c;switch(r=e[(c=t.i).g][n.d[c.g]],c.g){case 1:r-=i+t.j.b,t.g.b=r;break;case 3:r+=i,t.g.b=r;break;case 4:r-=i+t.j.a,t.g.a=r;break;case 2:r+=i,t.g.a=r}}function uTn(n){var t,e;for(e=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));e.e!=e.i.gc();)if(!dAn(new oz(ZL(wLn(t=BB(kpn(e),33)).a.Kc(),new h))))return t;return null}function oTn(){var n;return WOt?BB($$n((WM(),zAt),y6n),2016):(n=BB(cL(SJ((WM(),zAt),y6n),555)?SJ(zAt,y6n):new sAn,555),WOt=!0,_Gn(n),jWn(n),Tyn(n),mZ(zAt,y6n,n),n)}function sTn(n,t,e){var i,r;if(0==n.j)return e;if(r=BB(_en(n,t,e),72),!(i=e.ak()).Ij()||!n.a.rl(i))throw Hp(new dy("Invalid entry feature '"+i.Hj().zb+"."+i.ne()+"'"));return r}function hTn(n,t){var e,i,r,c,a,u,o;for(u=0,o=(a=n.a).length;u<o;++u)for(r=0,c=(i=a[u]).length;r<c;++r)if(e=i[r],GI(t)===GI(e)||null!=t&&Nfn(t,e))return!0;return!1}function fTn(n){var t,e,i;return Vhn(n,0)>=0?(e=Ojn(n,AQn),i=ldn(n,AQn)):(e=Ojn(t=jz(n,1),5e8),i=rbn(yz(i=ldn(t,5e8),1),e0(n,1))),i0(yz(i,32),e0(e,UQn))}function lTn(n,t,e){var i;switch(Px(0!=t.b),i=BB(Atn(t,t.a.a),8),e.g){case 0:i.b=0;break;case 2:i.b=n.f;break;case 3:i.a=0;break;default:i.a=n.g}return nX(spn(t,0),i),t}function bTn(n,t,e,i){var r,c,a,u,o;switch(o=n.b,u=zgn(a=(c=t.d).j,o.d[a.g],e),r=UR(B$(c.n),c.a),c.j.g){case 1:case 3:u.a+=r.a;break;case 2:case 4:u.b+=r.b}r5(i,u,i.c.b,i.c)}function wTn(n,t,e){var i,r,c,a;for(a=E7(n.e,t,0),(c=new rm).b=e,i=new M2(n.e,a);i.b<i.d.gc();)Px(i.b<i.d.gc()),(r=BB(i.d.Xb(i.c=i.b++),10)).p=e,WB(c.e,r),fW(i);return c}function dTn(n,t,e,i){var r,c,a,u,o;for(r=null,c=0,u=new Wb(t);u.a<u.c.c.length;)o=(a=BB(n0(u),33)).i+a.g,n<a.j+a.f+i&&(r?e.i-o<e.i-c&&(r=a):r=a,c=r.i+r.g);return r?c+i:0}function gTn(n,t,e,i){var r,c,a,u,o;for(c=null,r=0,u=new Wb(t);u.a<u.c.c.length;)o=(a=BB(n0(u),33)).j+a.f,n<a.i+a.g+i&&(c?e.j-o<e.j-r&&(c=a):c=a,r=c.j+c.f);return c?r+i:0}function pTn(n){var t,e,i;for(t=!1,i=n.b.c.length,e=0;e<i;e++)Yon(BB(xq(n.b,e),434))?!t&&e+1<i&&Yon(BB(xq(n.b,e+1),434))&&(t=!0,BB(xq(n.b,e),434).a=!0):t=!1}function vTn(n,t,e,i,r){var c,a;for(c=0,a=0;a<r;a++)c=rbn(c,ibn(e0(t[a],UQn),e0(i[a],UQn))),n[a]=dG(c),c=kz(c,32);for(;a<e;a++)c=rbn(c,e0(t[a],UQn)),n[a]=dG(c),c=kz(c,32)}function mTn(n,t){var e,i;for($On(),ODn(),i=Jtt,e=n;t>1;t>>=1)0!=(1&t)&&(i=Nnn(i,e)),e=1==e.d?Nnn(e,e):new Cgn(I_n(e.a,e.d,x8(ANt,hQn,25,e.d<<1,15,1)));return i=Nnn(i,e)}function yTn(){var n,t,e,i;for(yTn=O,Oet=x8(xNt,qQn,25,25,15,1),Aet=x8(xNt,qQn,25,33,15,1),i=152587890625e-16,t=32;t>=0;t--)Aet[t]=i,i*=.5;for(e=1,n=24;n>=0;n--)Oet[n]=e,e*=.5}function kTn(n){var t,e;if(qy(TD(ZAn(n,(HXn(),wgt)))))for(e=new oz(ZL(dLn(n).a.Kc(),new h));dAn(e);)if(QIn(t=BB(U5(e),79))&&qy(TD(ZAn(t,dgt))))return!0;return!1}function jTn(n,t){var e,i,r;TU(n.f,t)&&(t.b=n,i=t.c,-1!=E7(n.j,i,0)||WB(n.j,i),r=t.d,-1!=E7(n.j,r,0)||WB(n.j,r),0!=(e=t.a.b).c.length&&(!n.i&&(n.i=new epn(n)),van(n.i,e)))}function ETn(n){var t,e,i,r;return(e=(t=n.c.d).j)==(r=(i=n.d.d).j)?t.p<i.p?0:1:Mln(e)==r?0:Eln(e)==r?1:SN(n.b.b,Mln(e))?0:1}function TTn(){TTn=O,tvt=new RP(j3n,0),Zpt=new RP("LONGEST_PATH",1),Ypt=new RP("COFFMAN_GRAHAM",2),Jpt=new RP(B1n,3),evt=new RP("STRETCH_WIDTH",4),nvt=new RP("MIN_WIDTH",5)}function MTn(n){var t;this.d=new xp,this.c=n.c,this.e=n.d,this.b=n.b,this.f=new sG(n.e),this.a=n.a,n.f?this.g=n.f:this.g=new YK(t=BB(Vj(aAt),9),BB(SR(t,t.length),9),0)}function STn(n,t){var e,i,r,c;!(r=D2(i=n,"layoutOptions"))&&(r=D2(i,M6n)),r&&(e=null,(c=r)&&(e=new TT(c,jrn(c,x8(Qtt,sVn,2,0,6,1)))),e&&e5(e,new wI(c,t)))}function PTn(n){if(cL(n,239))return BB(n,33);if(cL(n,186))return WJ(BB(n,118));throw Hp(n?new tk("Only support nodes and ports."):new Hy(e8n))}function CTn(n,t,e,i){return t>=0&&mK(n.substr(t,3),"GMT")||t>=0&&mK(n.substr(t,3),"UTC")?(e[0]=t+3,y_n(n,e,i)):y_n(n,e,i)}function ITn(n,t){var e,i,r,c,a;for(c=n.g.a,a=n.g.b,i=new Wb(n.d);i.a<i.c.c.length;)(r=(e=BB(n0(i),70)).n).a=c,n.i==(kUn(),sIt)?r.b=a+n.j.b-e.o.b:r.b=a,UR(r,t),c+=e.o.a+n.e}function OTn(n,t,e){if(n.b)throw Hp(new Fy("The task is already done."));return null==n.p&&(n.p=t,n.r=e,n.k&&(n.o=($T(),cbn(fan(Date.now()),VVn))),!0)}function ATn(n){var t;return t=new py,null!=n.tg()&&AH(t,q6n,n.tg()),null!=n.ne()&&AH(t,t8n,n.ne()),null!=n.sg()&&AH(t,"description",n.sg()),t}function $Tn(n,t,e){var i,r,c;return c=n.q,n.q=t,0!=(4&n.Db)&&0==(1&n.Db)&&(r=new nU(n,1,9,c,t),e?e.Ei(r):e=r),t?(i=t.c)!=n.r&&(e=n.nk(i,e)):n.r&&(e=n.nk(null,e)),e}function LTn(n,t,e){var i,r;for(e=Npn(t,n.e,-1-n.c,e),r=new Mp(new usn(new Pb(xW(n.a).a).a));r.a.b;)e=azn(i=BB(ten(r.a).cd(),87),kLn(i,n.a),e);return e}function NTn(n,t,e){var i,r;for(e=oJ(t,n.e,-1-n.c,e),r=new Mp(new usn(new Pb(xW(n.a).a).a));r.a.b;)e=azn(i=BB(ten(r.a).cd(),87),kLn(i,n.a),e);return e}function xTn(n,t,e,i){var r,c,a;if(0==i)aHn(t,0,n,e,n.length-e);else for(a=32-i,n[n.length-1]=0,c=n.length-1;c>e;c--)n[c]|=t[c-e-1]>>>a,n[c-1]=t[c-e-1]<<i;for(r=0;r<e;r++)n[r]=0}function DTn(n){var t,i,r,c,a;for(t=0,i=0,a=n.Kc();a.Ob();)r=BB(a.Pb(),111),t=e.Math.max(t,r.d.b),i=e.Math.max(i,r.d.c);for(c=n.Kc();c.Ob();)(r=BB(c.Pb(),111)).d.b=t,r.d.c=i}function RTn(n){var t,i,r,c,a;for(i=0,t=0,a=n.Kc();a.Ob();)r=BB(a.Pb(),111),i=e.Math.max(i,r.d.d),t=e.Math.max(t,r.d.a);for(c=n.Kc();c.Ob();)(r=BB(c.Pb(),111)).d.d=i,r.d.a=t}function KTn(n,t){var e,i,r,c;for(c=new Np,r=0,i=t.Kc();i.Ob();){for(e=iln(BB(i.Pb(),19).a+r);e.a<n.f&&!tG(n,e.a);)e=iln(e.a+1),++r;if(e.a>=n.f)break;c.c[c.c.length]=e}return c}function _Tn(n){var t,e,i,r;for(t=null,r=new Wb(n.wf());r.a<r.c.c.length;)e=new UV((i=BB(n0(r),181)).qf().a,i.qf().b,i.rf().a,i.rf().b),t?CPn(t,e):t=e;return!t&&(t=new bA),t}function FTn(n,t,e,i){return 1==e?(!n.n&&(n.n=new eU(zOt,n,1,7)),Ywn(n.n,t,i)):BB(itn(BB(yan(n,16),26)||n.zh(),e),66).Nj().Qj(n,fgn(n),e-bX(n.zh()),t,i)}function BTn(n,t,e){var i,r,c,a,u;for(i=e.gc(),n.qi(n.i+i),(u=n.i-t)>0&&aHn(n.g,t,n.g,t+i,u),a=e.Kc(),n.i+=i,r=0;r<i;++r)c=a.Pb(),jL(n,t,n.oi(t,c)),n.bi(t,c),n.ci(),++t;return 0!=i}function HTn(n,t,e){var i;return t!=n.q?(n.q&&(e=oJ(n.q,n,-10,e)),t&&(e=Npn(t,n,-10,e)),e=$Tn(n,t,e)):0!=(4&n.Db)&&0==(1&n.Db)&&(i=new nU(n,1,9,t,t),e?e.Ei(i):e=i),e}function qTn(n,t,e,i){return C_(0==(e&hVn),"flatMap does not support SUBSIZED characteristic"),C_(0==(4&e),"flatMap does not support SORTED characteristic"),yX(n),yX(t),new q2(n,e,i,t)}function GTn(n,t){SU(t,"Cannot suppress a null exception."),vH(t!=n,"Exception can not suppress itself."),n.i||(null==n.k?n.k=Pun(Gk(Jnt,1),sVn,78,0,[t]):n.k[n.k.length]=t)}function zTn(n,t,e,i){var r,c,a,u,o,s;for(a=e.length,c=0,r=-1,s=atn(n.substr(t),(c_(),Tet)),u=0;u<a;++u)(o=e[u].length)>c&&sU(s,atn(e[u],Tet))&&(r=u,c=o);return r>=0&&(i[0]=t+c),r}function UTn(n,t){var e;if(0!=(e=YO(n.b.Hf(),t.b.Hf())))return e;switch(n.b.Hf().g){case 1:case 2:return E$(n.b.sf(),t.b.sf());case 3:case 4:return E$(t.b.sf(),n.b.sf())}return 0}function XTn(n){var t,e,i;for(i=n.e.c.length,n.a=kq(ANt,[sVn,hQn],[48,25],15,[i,i],2),e=new Wb(n.c);e.a<e.c.c.length;)t=BB(n0(e),282),n.a[t.c.b][t.d.b]+=BB(mMn(t,(fRn(),Zct)),19).a}function WTn(n,t,e){OTn(e,"Grow Tree",1),n.b=t.f,qy(TD(mMn(t,(Xcn(),Qrt))))?(n.c=new it,QZ(n,null)):n.c=new it,n.a=!1,FNn(n,t.f),hon(t,Yrt,(hN(),!!n.a)),HSn(e)}function VTn(n,t){var e,i,r,c,a;if(null==n)return null;for(a=x8(ONt,WVn,25,2*t,15,1),i=0,r=0;i<t;++i)e=n[i]>>4&15,c=15&n[i],a[r++]=OOt[e],a[r++]=OOt[c];return Bdn(a,0,a.length)}function QTn(n,t,e){var i,r,c;return i=t.ak(),c=t.dd(),r=i.$j()?LY(n,4,i,c,null,pBn(n,i,c,cL(i,99)&&0!=(BB(i,18).Bb&BQn)),!0):LY(n,i.Kj()?2:1,i,c,i.zj(),-1,!0),e?e.Ei(r):e=r,e}function YTn(n){var t,e;return n>=BQn?(t=HQn+(n-BQn>>10&1023)&QVn,e=56320+(n-BQn&1023)&QVn,String.fromCharCode(t)+""+String.fromCharCode(e)):String.fromCharCode(n&QVn)}function JTn(n,t){var e,i,r,c;return qD(),(r=BB(BB(h6(n.r,t),21),84)).gc()>=2&&(i=BB(r.Kc().Pb(),111),e=n.u.Hc((lIn(),tIt)),c=n.u.Hc(cIt),!i.a&&!e&&(2==r.gc()||c))}function ZTn(n,t,e,i,r){var c,a,u;for(c=eDn(n,t,e,i,r),u=!1;!c;)E$n(n,r,!0),u=!0,c=eDn(n,t,e,i,r);u&&E$n(n,r,!1),0!=(a=Dun(r)).c.length&&(n.d&&n.d.lg(a),ZTn(n,r,e,i,a))}function nMn(){nMn=O,aCt=new BC(QZn,0),rCt=new BC("DIRECTED",1),uCt=new BC("UNDIRECTED",2),eCt=new BC("ASSOCIATION",3),cCt=new BC("GENERALIZATION",4),iCt=new BC("DEPENDENCY",5)}function tMn(n,t){var e;if(!WJ(n))throw Hp(new Fy(F5n));switch(e=WJ(n),t.g){case 1:return-(n.j+n.f);case 2:return n.i-e.g;case 3:return n.j-e.f;case 4:return-(n.i+n.g)}return 0}function eMn(n,t){var e,i;for(kW(t),i=n.b.c.length,WB(n.b,t);i>0;){if(e=i,i=(i-1)/2|0,n.a.ue(xq(n.b,i),t)<=0)return c5(n.b,e,t),!0;c5(n.b,e,xq(n.b,i))}return c5(n.b,i,t),!0}function iMn(n,t,i,r){var c,a;if(c=0,i)c=mhn(n.a[i.g][t.g],r);else for(a=0;a<nrt;a++)c=e.Math.max(c,mhn(n.a[a][t.g],r));return t==(Dtn(),zit)&&n.b&&(c=e.Math.max(c,n.b.a)),c}function rMn(n,t){var e,i,r,c,a;return i=n.i,r=t.i,!(!i||!r)&&i.i==r.i&&i.i!=(kUn(),oIt)&&i.i!=(kUn(),CIt)&&(e=(c=i.g.a)+i.j.a,c<=(a=r.g.a)+r.j.a&&e>=a)}function cMn(n,t,e,i){var r;if(r=!1,XI(i)&&(r=!0,AH(t,e,SD(i))),r||zI(i)&&(r=!0,cMn(n,t,e,i)),r||cL(i,236)&&(r=!0,qQ(t,e,BB(i,236))),!r)throw Hp(new Ly(H6n))}function aMn(n,t){var e,i,r;if((e=t.Hh(n.a))&&null!=(r=cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),F9n)))for(i=1;i<(IPn(),Y$t).length;++i)if(mK(Y$t[i],r))return i;return 0}function uMn(n,t){var e,i,r;if((e=t.Hh(n.a))&&null!=(r=cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),F9n)))for(i=1;i<(IPn(),J$t).length;++i)if(mK(J$t[i],r))return i;return 0}function oMn(n,t){var e,i,r,c;if(kW(t),(c=n.a.gc())<t.gc())for(e=n.a.ec().Kc();e.Ob();)i=e.Pb(),t.Hc(i)&&e.Qb();else for(r=t.Kc();r.Ob();)i=r.Pb(),n.a.Bc(i);return c!=n.a.gc()}function sMn(n){var t,e;switch(e=B$(Aon(Pun(Gk(PMt,1),sVn,8,0,[n.i.n,n.n,n.a]))),t=n.i.d,n.j.g){case 1:e.b-=t.d;break;case 2:e.a+=t.c;break;case 3:e.b+=t.a;break;case 4:e.a-=t.b}return e}function hMn(n){var t;for(Irn(),t=BB(U5(new oz(ZL(fbn(n).a.Kc(),new h))),17).c.i;t.k==(uSn(),Put);)hon(t,(hWn(),olt),(hN(),!0)),t=BB(U5(new oz(ZL(fbn(t).a.Kc(),new h))),17).c.i}function fMn(n,t,e,i){var r,c,a;for(a=Lfn(t,i).Kc();a.Ob();)r=BB(a.Pb(),11),n.d[r.p]=n.d[r.p]+n.c[e.p];for(c=Lfn(e,i).Kc();c.Ob();)r=BB(c.Pb(),11),n.d[r.p]=n.d[r.p]-n.c[t.p]}function lMn(n,t,e){var i,r;for(r=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));r.e!=r.i.gc();)SA(i=BB(kpn(r),33),i.i+t,i.j+e);e5((!n.b&&(n.b=new eU(_Ot,n,12,3)),n.b),new tI(t,e))}function bMn(n,t,e,i){var r,c;for(r=null==(c=t).d||n.a.ue(e.d,c.d)>0?1:0;c.a[r]!=e;)c=c.a[r],r=n.a.ue(e.d,c.d)>0?1:0;c.a[r]=i,i.b=e.b,i.a[0]=e.a[0],i.a[1]=e.a[1],e.a[0]=null,e.a[1]=null}function wMn(n){return lIn(),!(Can(OJ(EG(eIt,Pun(Gk(IIt,1),$Vn,273,0,[rIt])),n))>1||Can(OJ(EG(tIt,Pun(Gk(IIt,1),$Vn,273,0,[nIt,cIt])),n))>1)}function dMn(n,t){cL(SJ((WM(),zAt),n),498)?mZ(zAt,n,new OI(this,t)):mZ(zAt,n,this),iSn(this,t),t==(iE(),n$t)?(this.wb=BB(this,1939),BB(t,1941)):this.wb=(QX(),t$t)}function gMn(n){var t,e;if(null==n)return null;for(t=null,e=0;e<IOt.length;++e)try{return BM(IOt[e],n)}catch(i){if(!cL(i=lun(i),32))throw Hp(i);t=i}throw Hp(new L7(t))}function pMn(){pMn=O,pet=Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]),vet=Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"])}function vMn(n){var t,e,i;(t=mK(typeof t,gYn)?null:new ln)&&(lM(),tW(e=(i=900)>=VVn?"error":i>=900?"warn":i>=800?"info":"log",n.a),n.b&&xNn(t,e,n.b,"Exception: ",!0))}function mMn(n,t){var e,i;return!n.q&&(n.q=new xp),null!=(i=RX(n.q,t))?i:(cL(e=t.wg(),4)&&(null==e?(!n.q&&(n.q=new xp),v6(n.q,t)):(!n.q&&(n.q=new xp),VW(n.q,t,e))),e)}function yMn(){yMn=O,Rat=new VS("P1_CYCLE_BREAKING",0),Kat=new VS("P2_LAYERING",1),_at=new VS("P3_NODE_ORDERING",2),Fat=new VS("P4_NODE_PLACEMENT",3),Bat=new VS("P5_EDGE_ROUTING",4)}function kMn(n,t){var e,i,r,c;for(i=(1==t?Wat:Xat).a.ec().Kc();i.Ob();)for(e=BB(i.Pb(),103),c=BB(h6(n.f.c,e),21).Kc();c.Ob();)r=BB(c.Pb(),46),y7(n.b.b,r.b),y7(n.b.a,BB(r.b,81).d)}function jMn(n,t){var e;if(Dnn(),n.c==t.c){if(n.b==t.b||hcn(n.b,t.b)){if(e=ZO(n.b)?1:-1,n.a&&!t.a)return e;if(!n.a&&t.a)return-e}return E$(n.b.g,t.b.g)}return Pln(n.c,t.c)}function EMn(n,t){var e;OTn(t,"Hierarchical port position processing",1),(e=n.b).c.length>0&&i_n((l1(0,e.c.length),BB(e.c[0],29)),n),e.c.length>1&&i_n(BB(xq(e,e.c.length-1),29),n),HSn(t)}function TMn(n,t){var e,i;if(NMn(n,t))return!0;for(i=new Wb(t);i.a<i.c.c.length;){if(_Dn(n,e=BB(n0(i),33),uEn(e)))return!0;if($hn(n,e)-n.g<=n.a)return!0}return!1}function MMn(){MMn=O,bRn(),kTt=RTt,vTt=LTt,pTt=ATt,dTt=PTt,gTt=ITt,wTt=new WA(8),bTt=new XA((sWn(),XSt),wTt),mTt=new XA(LPt,8),yTt=xTt,hTt=jTt,fTt=TTt,lTt=new XA(lSt,(hN(),!1))}function SMn(){SMn=O,zMt=new WA(15),GMt=new XA((sWn(),XSt),zMt),XMt=new XA(LPt,15),UMt=new XA(pPt,iln(0)),_Mt=jSt,BMt=KSt,qMt=qSt,DMt=new XA(cSt,f5n),FMt=CSt,HMt=BSt,RMt=uSt,KMt=hSt}function PMn(n){if(1!=(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i||1!=(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i)throw Hp(new _y(r8n));return PTn(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82))}function CMn(n){if(1!=(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i||1!=(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i)throw Hp(new _y(r8n));return bun(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82))}function IMn(n){if(1!=(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i||1!=(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i)throw Hp(new _y(r8n));return bun(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))}function OMn(n){if(1!=(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i||1!=(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i)throw Hp(new _y(r8n));return PTn(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))}function AMn(n,t,e){var i,r,c;if(++n.j,t>=(r=n.Vi())||t<0)throw Hp(new Ay(u8n+t+o8n+r));if(e>=r||e<0)throw Hp(new Ay(s8n+e+o8n+r));return t!=e?(c=n.Ti(e),n.Hi(t,c),i=c):i=n.Oi(e),i}function $Mn(n){var t,e,i;if(i=n,n)for(t=0,e=n.Ug();e;e=e.Ug()){if(++t>GQn)return $Mn(e);if(i=e,e==n)throw Hp(new Fy("There is a cycle in the containment hierarchy of "+n))}return i}function LMn(n){var t,e,i;for(i=new $an(FWn,"[","]"),e=n.Kc();e.Ob();)b6(i,GI(t=e.Pb())===GI(n)?"(this Collection)":null==t?zWn:Bbn(t));return i.a?0==i.e.length?i.a.a:i.a.a+""+i.e:i.c}function NMn(n,t){var e,i;if(i=!1,t.gc()<2)return!1;for(e=0;e<t.gc();e++)e<t.gc()-1?i|=_Dn(n,BB(t.Xb(e),33),BB(t.Xb(e+1),33)):i|=_Dn(n,BB(t.Xb(e),33),BB(t.Xb(0),33));return i}function xMn(n,t){var e;t!=n.a?(e=null,n.a&&(e=BB(n.a,49).ih(n,4,GOt,e)),t&&(e=BB(t,49).gh(n,4,GOt,e)),(e=Jhn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,1,t,t))}function DMn(n,t){var e;t!=n.e?(n.e&&_6(xW(n.e),n),t&&(!t.b&&(t.b=new Tp(new xm)),YR(t.b,n)),(e=Qkn(n,t,null))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,4,t,t))}function RMn(n){var t,e,i;for(e=n.length,i=0;i<e&&(b1(i,n.length),n.charCodeAt(i)<=32);)++i;for(t=e;t>i&&(b1(t-1,n.length),n.charCodeAt(t-1)<=32);)--t;return i>0||t<e?n.substr(i,t-i):n}function KMn(n,t){var i;i=t.o,dA(n.f)?(n.j.a=e.Math.max(n.j.a,i.a),n.j.b+=i.b,n.d.c.length>1&&(n.j.b+=n.e)):(n.j.a+=i.a,n.j.b=e.Math.max(n.j.b,i.b),n.d.c.length>1&&(n.j.a+=n.e))}function _Mn(){_Mn=O,$st=Pun(Gk(FIt,1),YZn,61,0,[(kUn(),sIt),oIt,SIt]),Ast=Pun(Gk(FIt,1),YZn,61,0,[oIt,SIt,CIt]),Lst=Pun(Gk(FIt,1),YZn,61,0,[SIt,CIt,sIt]),Nst=Pun(Gk(FIt,1),YZn,61,0,[CIt,sIt,oIt])}function FMn(n,t,e,i){var r,c,a,u,o;if(c=n.c.d,a=n.d.d,c.j!=a.j)for(o=n.b,r=c.j,u=null;r!=a.j;)u=0==t?Mln(r):Eln(r),DH(i,UR(zgn(r,o.d[r.g],e),zgn(u,o.d[u.g],e))),r=u}function BMn(n,t,e,i){var r,c,a,u,o;return u=BB((a=qyn(n.a,t,e)).a,19).a,c=BB(a.b,19).a,i&&(o=BB(mMn(t,(hWn(),Elt)),10),r=BB(mMn(e,Elt),10),o&&r&&(t4(n.b,o,r),u+=n.b.i,c+=n.b.e)),u>c}function HMn(n){var t,e,i,r,c,a,u,o;for(this.a=rvn(n),this.b=new Np,i=0,r=(e=n).length;i<r;++i)for(t=e[i],c=new Np,WB(this.b,c),u=0,o=(a=t).length;u<o;++u)WB(c,new t_(a[u].j))}function qMn(n,t,e){var i,r,c;return c=0,i=e[t],t<e.length-1&&(r=e[t+1],n.b[t]?(c=bWn(n.d,i,r),c+=ZX(n.a,i,(kUn(),oIt)),c+=ZX(n.a,r,CIt)):c=I9(n.a,i,r)),n.c[t]&&(c+=L6(n.a,i)),c}function GMn(n,t,e,i,r){var c,a,u,o;for(o=null,u=new Wb(i);u.a<u.c.c.length;)if((a=BB(n0(u),441))!=e&&-1!=E7(a.e,r,0)){o=a;break}SZ(c=W5(r),e.b),MZ(c,o.b),JIn(n.a,r,new L_(c,t,e.f))}function zMn(n){for(;0!=n.g.c&&0!=n.d.c;)FD(n.g).c>FD(n.d).c?(n.i+=n.g.c,gdn(n.d)):FD(n.d).c>FD(n.g).c?(n.e+=n.d.c,gdn(n.g)):(n.i+=qq(n.g),n.e+=qq(n.d),gdn(n.g),gdn(n.d))}function UMn(n,t,e){var i,r,c,a;for(c=t.q,a=t.r,new zZ((O6(),Tyt),t,c,1),new zZ(Tyt,c,a,1),r=new Wb(e);r.a<r.c.c.length;)(i=BB(n0(r),112))!=c&&i!=t&&i!=a&&(gHn(n.a,i,t),gHn(n.a,i,a))}function XMn(n,t,i,r){n.a.d=e.Math.min(t,i),n.a.a=e.Math.max(t,r)-n.a.d,t<i?(n.b=.5*(t+i),n.g=K3n*n.b+.9*t,n.f=K3n*n.b+.9*i):(n.b=.5*(t+r),n.g=K3n*n.b+.9*r,n.f=K3n*n.b+.9*t)}function WMn(){function n(){return(new Date).getTime()}SWn={},!Array.isArray&&(Array.isArray=function(n){return"[object Array]"===Object.prototype.toString.call(n)}),!Date.now&&(Date.now=n)}function VMn(n,t){var e,i;i=BB(mMn(t,(HXn(),ept)),98),hon(t,(hWn(),ylt),i),(e=t.e)&&(JT(new Rq(null,new w1(e.a,16)),new Rw(n)),JT(wnn(new Rq(null,new w1(e.b,16)),new mt),new Kw(n)))}function QMn(n){var t,i,r,c;if(gA(BB(mMn(n.b,(HXn(),Udt)),103)))return 0;for(t=0,r=new Wb(n.a);r.a<r.c.c.length;)(i=BB(n0(r),10)).k==(uSn(),Cut)&&(c=i.o.a,t=e.Math.max(t,c));return t}function YMn(n){switch(BB(mMn(n,(HXn(),kgt)),163).g){case 1:hon(n,kgt,(Tbn(),Blt));break;case 2:hon(n,kgt,(Tbn(),Hlt));break;case 3:hon(n,kgt,(Tbn(),_lt));break;case 4:hon(n,kgt,(Tbn(),Flt))}}function JMn(){JMn=O,cft=new $P(QZn,0),eft=new $P(cJn,1),aft=new $P(aJn,2),rft=new $P("LEFT_RIGHT_CONSTRAINT_LOCKING",3),ift=new $P("LEFT_RIGHT_CONNECTION_LOCKING",4),tft=new $P(q1n,5)}function ZMn(n,t,i){var r,c,a,u,o,s,h;o=i.a/2,a=i.b/2,s=1,h=1,(r=e.Math.abs(t.a-n.a))>o&&(s=o/r),(c=e.Math.abs(t.b-n.b))>a&&(h=a/c),u=e.Math.min(s,h),n.a+=u*(t.a-n.a),n.b+=u*(t.b-n.b)}function nSn(n,t,e,i,r){var c,a;for(a=!1,c=BB(xq(e.b,0),33);hBn(n,t,c,i,r)&&(a=!0,cEn(e,c),0!=e.b.c.length);)c=BB(xq(e.b,0),33);return 0==e.b.c.length&&Tkn(e.j,e),a&&Gmn(t.q),a}function tSn(n,t){var e,i,r,c;if(jDn(),t.b<2)return!1;for(i=e=BB(b3(c=spn(t,0)),8);c.b!=c.d.c;){if(cNn(n,i,r=BB(b3(c),8)))return!0;i=r}return!!cNn(n,i,e)}function eSn(n,t,e,i){return 0==e?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),BK(n.o,t,i)):BB(itn(BB(yan(n,16),26)||n.zh(),e),66).Nj().Rj(n,fgn(n),e-bX(n.zh()),t,i)}function iSn(n,t){var e;t!=n.sb?(e=null,n.sb&&(e=BB(n.sb,49).ih(n,1,HOt,e)),t&&(e=BB(t,49).gh(n,1,HOt,e)),(e=jfn(n,t,e))&&e.Fi()):0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,4,t,t))}function rSn(n,t){var e,i;if(!t)throw Hp(new ek("All edge sections need an end point."));e=Ren(t,"x"),Ten(new Kg(n).a,(kW(e),e)),i=Ren(t,"y"),Oen(new _g(n).a,(kW(i),i))}function cSn(n,t){var e,i;if(!t)throw Hp(new ek("All edge sections need a start point."));e=Ren(t,"x"),Ien(new xg(n).a,(kW(e),e)),i=Ren(t,"y"),Aen(new Dg(n).a,(kW(i),i))}function aSn(n,t){var e,i,r,c,a;for(i=0,c=psn(n).length;i<c;++i)vMn(t);for(a=!Qet&&n.e?Qet?null:n.d:null;a;){for(e=0,r=psn(a).length;e<r;++e)vMn(t);a=!Qet&&a.e?Qet?null:a.d:null}}function uSn(){uSn=O,Cut=new JS("NORMAL",0),Put=new JS("LONG_EDGE",1),Mut=new JS("EXTERNAL_PORT",2),Iut=new JS("NORTH_SOUTH_PORT",3),Sut=new JS("LABEL",4),Tut=new JS("BREAKING_POINT",5)}function oSn(n){var t,e,i,r;if(t=!1,Lx(n,(hWn(),zft)))for(e=BB(mMn(n,zft),83),r=new Wb(n.j);r.a<r.c.c.length;)J$n(i=BB(n0(r),11))&&(t||(iIn(vW(n)),t=!0),fpn(BB(e.xc(i),306)))}function sSn(n,t,e){var i;OTn(e,"Self-Loop routing",1),i=Vln(t),iO(mMn(t,(C6(),TMt))),JT($V(AV(AV(wnn(new Rq(null,new w1(t.b,16)),new zi),new Ui),new Xi),new Wi),new eP(n,i)),HSn(e)}function hSn(n){var t,e,i;return i=ATn(n),null!=n.e&&AH(i,n8n,n.e),!!n.k&&AH(i,"type",dx(n.k)),!WE(n.j)&&(e=new Cl,rtn(i,N6n,e),t=new cp(e),e5(n.j,t)),i}function fSn(n){var t,e,i,r;for(r=xX((lin(n.gc(),"size"),new Ik),123),i=!0,e=lz(n).Kc();e.Ob();)t=BB(e.Pb(),42),i||(r.a+=FWn),i=!1,uO(xX(uO(r,t.cd()),61),t.dd());return(r.a+="}",r).a}function lSn(n,t){var e,i,r;return(t&=63)<22?(e=n.l<<t,i=n.m<<t|n.l>>22-t,r=n.h<<t|n.m>>22-t):t<44?(e=0,i=n.l<<t-22,r=n.m<<t-22|n.l>>44-t):(e=0,i=0,r=n.l<<t-44),M$(e&SQn,i&SQn,r&PQn)}function bSn(n){if(null==ytt&&(ytt=new RegExp("^\\s*[+-]?(NaN|Infinity|((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?[dDfF]?)\\s*$")),!ytt.test(n))throw Hp(new Mk(DQn+n+'"'));return parseFloat(n)}function wSn(n){var t,e,i,r;for(t=new Np,vU(e=x8($Nt,ZYn,25,n.a.c.length,16,1),e.length),r=new Wb(n.a);r.a<r.c.c.length;)e[(i=BB(n0(r),121)).d]||(t.c[t.c.length]=i,Ggn(n,i,e));return t}function dSn(n,t){var e,i,r,c;for(c=t.b.j,n.a=x8(ANt,hQn,25,c.c.length,15,1),r=0,i=0;i<c.c.length;i++)l1(i,c.c.length),0==(e=BB(c.c[i],11)).e.c.length&&0==e.g.c.length?r+=1:r+=3,n.a[i]=r}function gSn(){gSn=O,Dht=new IP("ALWAYS_UP",0),xht=new IP("ALWAYS_DOWN",1),Kht=new IP("DIRECTION_UP",2),Rht=new IP("DIRECTION_DOWN",3),Fht=new IP("SMART_UP",4),_ht=new IP("SMART_DOWN",5)}function pSn(n,t){if(n<0||t<0)throw Hp(new _y("k and n must be positive"));if(t>n)throw Hp(new _y("k must be smaller than n"));return 0==t||t==n?1:0==n?0:Mjn(n)/(Mjn(t)*Mjn(n-t))}function vSn(n,t){var e,i,r,c;for(e=new OA(n);null!=e.g||e.c?null==e.g||0!=e.i&&BB(e.g[e.i-1],47).Ob():tZ(e);)if(cL(c=BB(aLn(e),56),160))for(i=BB(c,160),r=0;r<t.length;r++)t[r].og(i)}function mSn(n){var t;return 0!=(64&n.Db)?Yln(n):((t=new fN(Yln(n))).a+=" (height: ",vE(t,n.f),t.a+=", width: ",vE(t,n.g),t.a+=", x: ",vE(t,n.i),t.a+=", y: ",vE(t,n.j),t.a+=")",t.a)}function ySn(n){var t,e,i,r,c,a;for(t=new v4,r=0,c=(i=n).length;r<c;++r)if(null!=Jgn(t,a=yX((e=i[r]).cd()),yX(e.dd())))throw Hp(new _y("duplicate key: "+a));this.b=(SQ(),new Xb(t))}function kSn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i<r;++i)t=e[i],b6(c,String.fromCharCode(t));return c.a?0==c.e.length?c.a.a:c.a.a+""+c.e:c.c}function jSn(){jSn=O,Knn(),Ict=new $O(oZn,Oct=Rct),iln(1),Cct=new $O(sZn,iln(300)),iln(0),Lct=new $O(hZn,iln(0)),new $p,Nct=new $O(fZn,lZn),new $p,Act=new $O(bZn,5),xct=Rct,$ct=Dct}function ESn(n,t){var e,i,r,c;for(i=(1==t?Wat:Xat).a.ec().Kc();i.Ob();)for(e=BB(i.Pb(),103),c=BB(h6(n.f.c,e),21).Kc();c.Ob();)r=BB(c.Pb(),46),WB(n.b.b,BB(r.b,81)),WB(n.b.a,BB(r.b,81).d)}function TSn(n,t){var e;if(null!=t&&!n.c.Yj().wj(t))throw e=cL(t,56)?BB(t,56).Tg().zb:nE(tsn(t)),Hp(new Ky(r6n+n.c.ne()+"'s type '"+n.c.Yj().ne()+"' does not permit a value of type '"+e+"'"))}function MSn(n,t,e){var i,r;for(r=new M2(n.b,0);r.b<r.d.gc();)Px(r.b<r.d.gc()),GI(mMn(i=BB(r.d.Xb(r.c=r.b++),70),(hWn(),vlt)))===GI(t)&&(OPn(i.n,vW(n.c.i),e),fW(r),WB(t.b,i))}function SSn(n,t){if(t.a)switch(BB(mMn(t.b,(hWn(),ylt)),98).g){case 0:case 1:lEn(t);case 2:JT(new Rq(null,new w1(t.d,16)),new Li),oAn(n.a,t)}else JT(new Rq(null,new w1(t.d,16)),new Li)}function PSn(n){var t,i;return i=e.Math.sqrt((null==n.k&&(n.k=Wrn(n,new Ec)),Gy(n.k)/(n.b*(null==n.g&&(n.g=Xrn(n,new jc)),Gy(n.g))))),t=dG(fan(e.Math.round(i))),t=e.Math.min(t,n.f)}function CSn(){gcn(),LR.call(this),this.j=(kUn(),PIt),this.a=new Gj,new fm,this.f=(lin(2,AVn),new J6(2)),this.e=(lin(4,AVn),new J6(4)),this.g=(lin(4,AVn),new J6(4)),this.b=new hP(this.e,this.g)}function ISn(n,t){var e;return!qy(TD(mMn(t,(hWn(),Clt))))&&(e=t.c.i,(n!=(Tbn(),_lt)||e.k!=(uSn(),Sut))&&BB(mMn(e,(HXn(),kgt)),163)!=Flt)}function OSn(n,t){var e;return!qy(TD(mMn(t,(hWn(),Clt))))&&(e=t.d.i,(n!=(Tbn(),Blt)||e.k!=(uSn(),Sut))&&BB(mMn(e,(HXn(),kgt)),163)!=Hlt)}function ASn(n,t){var e,i,r,c,a,u,o;for(a=n.d,o=n.o,u=new UV(-a.b,-a.d,a.b+o.a+a.c,a.d+o.b+a.a),r=0,c=(i=t).length;r<c;++r)(e=i[r])&&CPn(u,e.i);a.b=-u.c,a.d=-u.d,a.c=u.b-a.b-o.a,a.a=u.a-a.d-o.b}function $Sn(){$Sn=O,iTt=new MC("CENTER_DISTANCE",0),rTt=new MC("CIRCLE_UNDERLAP",1),uTt=new MC("RECTANGLE_UNDERLAP",2),cTt=new MC("INVERTED_OVERLAP",3),aTt=new MC("MINIMUM_ROOT_DISTANCE",4)}function LSn(n){var t,e,i,r;if(KDn(),null==n)return null;for(i=n.length,t=x8(ONt,WVn,25,2*i,15,1),e=0;e<i;e++)(r=n[e])<0&&(r+=256),t[2*e]=YLt[r>>4],t[2*e+1]=YLt[15&r];return Bdn(t,0,t.length)}function NSn(n){var t;switch(nV(),n.c.length){case 0:return Bnt;case 1:return IH((t=BB(JCn(new Wb(n)),42)).cd(),t.dd());default:return new hy(BB(Qgn(n,x8(Hnt,kVn,42,n.c.length,0,1)),165))}}function xSn(n){var t,e,i,r,c;for(t=new Lp,e=new Lp,d3(t,n),d3(e,n);e.b!=e.c;)for(c=new Wb(BB(dU(e),37).a);c.a<c.c.c.length;)(r=BB(n0(c),10)).e&&(d3(t,i=r.e),d3(e,i));return t}function DSn(n,t){switch(t.g){case 1:return KB(n.j,(gcn(),xut));case 2:return KB(n.j,(gcn(),Lut));case 3:return KB(n.j,(gcn(),Rut));case 4:return KB(n.j,(gcn(),Kut));default:return SQ(),SQ(),set}}function RSn(n,t){var e,i,r;e=sH(t,n.e),i=BB(RX(n.g.f,e),19).a,r=n.a.c.length-1,0!=n.a.c.length&&BB(xq(n.a,r),287).c==i?(++BB(xq(n.a,r),287).a,++BB(xq(n.a,r),287).b):WB(n.a,new Gx(i))}function KSn(n,t,e){var i,r;return 0!=(i=SRn(n,t,e))?i:Lx(t,(hWn(),wlt))&&Lx(e,wlt)?((r=E$(BB(mMn(t,wlt),19).a,BB(mMn(e,wlt),19).a))<0?uKn(n,t,e):r>0&&uKn(n,e,t),r):IOn(n,t,e)}function _Sn(n,t,e){var i,r,c,a;if(0!=t.b){for(i=new YT,a=spn(t,0);a.b!=a.d.c;)Frn(i,xun(c=BB(b3(a),86))),(r=c.e).a=BB(mMn(c,(qqn(),gkt)),19).a,r.b=BB(mMn(c,pkt),19).a;_Sn(n,i,mcn(e,i.b/n.a|0))}}function FSn(n,t){var e,i,r,c,a;if(n.e<=t)return n.g;if(z1(n,n.g,t))return n.g;for(c=n.r,i=n.g,a=n.r,r=(c-i)/2+i;i+1<c;)(e=cHn(n,r,!1)).b<=r&&e.a<=t?(a=r,c=r):i=r,r=(c-i)/2+i;return a}function BSn(n,t,e){OTn(e,"Recursive Graph Layout",hDn(n,t,!0)),vSn(t,Pun(Gk(nMt,1),HWn,527,0,[new $f])),P8(t,(sWn(),mPt))||vSn(t,Pun(Gk(nMt,1),HWn,527,0,[new gu])),lXn(n,t,null,e),HSn(e)}function HSn(n){var t;if(null==n.p)throw Hp(new Fy("The task has not begun yet."));n.b||(n.k&&($T(),t=cbn(fan(Date.now()),VVn),n.q=1e-9*j2(ibn(t,n.o))),n.c<n.r&&qin(n,n.r-n.c),n.b=!0)}function qSn(n){var t,e,i;for(DH(i=new km,new xC(n.j,n.k)),e=new AL((!n.a&&(n.a=new $L(xOt,n,5)),n.a));e.e!=e.i.gc();)DH(i,new xC((t=BB(kpn(e),469)).a,t.b));return DH(i,new xC(n.b,n.c)),i}function GSn(n,t,e,i,r){var c,a,u,o;if(r)for(o=((c=new hz(r.a.length)).b-c.a)*c.c<0?(eS(),MNt):new XL(c);o.Ob();)u=x2(r,BB(o.Pb(),19).a),D_n((a=new hQ(n,t,e,i)).a,a.b,a.c,a.d,u)}function zSn(n,t){var e;if(GI(n)===GI(t))return!0;if(cL(t,21)){e=BB(t,21);try{return n.gc()==e.gc()&&n.Ic(e)}catch(i){if(cL(i=lun(i),173)||cL(i,205))return!1;throw Hp(i)}}return!1}function USn(n,t){var i;WB(n.d,t),i=t.rf(),n.c?(n.e.a=e.Math.max(n.e.a,i.a),n.e.b+=i.b,n.d.c.length>1&&(n.e.b+=n.a)):(n.e.a+=i.a,n.e.b=e.Math.max(n.e.b,i.b),n.d.c.length>1&&(n.e.a+=n.a))}function XSn(n){var t,e,i,r;switch(t=(r=n.i).b,i=r.j,e=r.g,r.a.g){case 0:e.a=(n.g.b.o.a-i.a)/2;break;case 1:e.a=t.d.n.a+t.d.a.a;break;case 2:e.a=t.d.n.a+t.d.a.a-i.a;break;case 3:e.b=t.d.n.b+t.d.a.b}}function WSn(n,t,e,i,r){if(i<t||r<e)throw Hp(new _y("The highx must be bigger then lowx and the highy must be bigger then lowy"));return n.a<t?n.a=t:n.a>i&&(n.a=i),n.b<e?n.b=e:n.b>r&&(n.b=r),n}function VSn(n){if(cL(n,149))return MNn(BB(n,149));if(cL(n,229))return Zbn(BB(n,229));if(cL(n,23))return hSn(BB(n,23));throw Hp(new _y(z6n+LMn(new Jy(Pun(Gk(Ant,1),HWn,1,5,[n])))))}function QSn(n,t,e,i,r){var c,a,u;for(c=!0,a=0;a<i;a++)c&=0==e[a];if(0==r)aHn(e,i,n,0,t),a=t;else{for(u=32-r,c&=e[a]<<u==0,a=0;a<t-1;a++)n[a]=e[a+i]>>>r|e[a+i+1]<<u;n[a]=e[a+i]>>>r,++a}return c}function YSn(n,t,e,i){var r,c;if(t.k==(uSn(),Put))for(c=new oz(ZL(fbn(t).a.Kc(),new h));dAn(c);)if((r=BB(U5(c),17)).c.i.k==Put&&n.c.a[r.c.i.c.p]==i&&n.c.a[t.c.p]==e)return!0;return!1}function JSn(n,t){var e,i,r,c;return t&=63,e=n.h&PQn,t<22?(c=e>>>t,r=n.m>>t|e<<22-t,i=n.l>>t|n.m<<22-t):t<44?(c=0,r=e>>>t-22,i=n.m>>t-22|n.h<<44-t):(c=0,r=0,i=e>>>t-44),M$(i&SQn,r&SQn,c&PQn)}function ZSn(n,t,e,i){var r;this.b=i,this.e=n==(oin(),Amt),r=t[e],this.d=kq($Nt,[sVn,ZYn],[177,25],16,[r.length,r.length],2),this.a=kq(ANt,[sVn,hQn],[48,25],15,[r.length,r.length],2),this.c=new zEn(t,e)}function nPn(n){var t,e,i;for(n.k=new o1((kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,n.j.c.length),i=new Wb(n.j);i.a<i.c.c.length;)t=(e=BB(n0(i),113)).d.j,JIn(n.k,t,e);n.e=iNn(gz(n.k))}function tPn(n,t){var e,i,r;TU(n.d,t),e=new ka,VW(n.c,t,e),e.f=Phn(t.c),e.a=Phn(t.d),e.d=(gxn(),(r=t.c.i.k)==(uSn(),Cut)||r==Tut),e.e=(i=t.d.i.k)==Cut||i==Tut,e.b=t.c.j==(kUn(),CIt),e.c=t.d.j==oIt}function ePn(n){var t,e,i,r,c;for(c=DWn,r=DWn,i=new Wb(kbn(n));i.a<i.c.c.length;)t=(e=BB(n0(i),213)).e.e-e.d.e,e.e==n&&t<r?r=t:t<c&&(c=t);return r==DWn&&(r=-1),c==DWn&&(c=-1),new rI(iln(r),iln(c))}function iPn(n,t){var i,r,c;return c=ZJn,qpn(),r=Zrt,c=e.Math.abs(n.b),(i=e.Math.abs(t.f-n.b))<c&&(c=i,r=nct),(i=e.Math.abs(n.a))<c&&(c=i,r=tct),(i=e.Math.abs(t.g-n.a))<c&&(c=i,r=Jrt),r}function rPn(n,t){var e,i,r;for(e=t.a.o.a,r=new Sb(new s1(vW(t.a).b,t.c,t.f+1));r.b<r.d.gc();)if(Px(r.b<r.d.gc()),(i=BB(r.d.Xb(r.c=r.b++),29)).c.a>=e)return hPn(n,t,i.p),!0;return!1}function cPn(n){var t;return 0!=(64&n.Db)?mSn(n):(t=new lN(Z5n),!n.a||oO(oO((t.a+=' "',t),n.a),'"'),oO(kE(oO(kE(oO(kE(oO(kE((t.a+=" (",t),n.i),","),n.j)," | "),n.g),","),n.f),")"),t.a)}function aPn(n,t,e){var i,r,c,a,u;for(u=axn(n.e.Tg(),t),r=BB(n.g,119),i=0,a=0;a<n.i;++a)if(c=r[a],u.rl(c.ak())){if(i==e)return fDn(n,a),ZM(),BB(t,66).Oj()?c:c.dd();++i}throw Hp(new Ay(e9n+e+o8n+i))}function uPn(n){var t,e,i;if(2==(t=n.c)||7==t||1==t)return wWn(),wWn(),sNt;for(i=OXn(n),e=null;2!=(t=n.c)&&7!=t&&1!=t;)e||(wWn(),wWn(),tqn(e=new r$(1),i),i=e),tqn(e,OXn(n));return i}function oPn(n,t,e){return n<0||n>e?dCn(n,e,"start index"):t<0||t>e?dCn(t,e,"end index"):$Rn("end index (%s) must not be less than start index (%s)",Pun(Gk(Ant,1),HWn,1,5,[iln(t),iln(n)]))}function sPn(n,t){var e,i,r,c;for(i=0,r=n.length;i<r;i++){c=n[i];try{c[1]?c[0].jm()&&(t=TG(t,c)):c[0].jm()}catch(a){if(!cL(a=lun(a),78))throw Hp(a);e=a,Dk(),yY(cL(e,477)?BB(e,477).ae():e)}}return t}function hPn(n,t,i){var r,c;for(i!=t.c+t.b.gc()&&wHn(t.a,ian(t,i-t.c)),c=t.a.c.p,n.a[c]=e.Math.max(n.a[c],t.a.o.a),r=BB(mMn(t.a,(hWn(),Plt)),15).Kc();r.Ob();)hon(BB(r.Pb(),70),tst,(hN(),!0))}function fPn(n,t){var i,r,c;c=qNn(t),hon(t,(hWn(),llt),c),c&&(r=DWn,AY(n.f,c)&&(r=BB(qI(AY(n.f,c)),19).a),qy(TD(mMn(i=BB(xq(t.g,0),17),Clt)))||VW(n,c,iln(e.Math.min(BB(mMn(i,wlt),19).a,r))))}function lPn(n,t,e){var i,r,c,a;for(t.p=-1,a=xwn(t,(ain(),qvt)).Kc();a.Ob();)for(r=new Wb(BB(a.Pb(),11).g);r.a<r.c.c.length;)t!=(c=(i=BB(n0(r),17)).d.i)&&(c.p<0?e.Fc(i):c.p>0&&lPn(n,c,e));t.p=0}function bPn(n){var t;this.c=new YT,this.f=n.e,this.e=n.d,this.i=n.g,this.d=n.c,this.b=n.b,this.k=n.j,this.a=n.a,n.i?this.j=n.i:this.j=new YK(t=BB(Vj(jMt),9),BB(SR(t,t.length),9),0),this.g=n.f}function wPn(n){var t,e,i,r;for(t=xX(oO(new lN("Predicates."),"and"),40),e=!0,r=new Sb(n);r.b<r.d.gc();)Px(r.b<r.d.gc()),i=r.d.Xb(r.c=r.b++),e||(t.a+=","),t.a+=""+i,e=!1;return(t.a+=")",t).a}function dPn(n,t,e){var i,r,c;if(!(e<=t+2))for(r=(e-t)/2|0,i=0;i<r;++i)l1(t+i,n.c.length),c=BB(n.c[t+i],11),c5(n,t+i,(l1(e-i-1,n.c.length),BB(n.c[e-i-1],11))),l1(e-i-1,n.c.length),n.c[e-i-1]=c}function gPn(n,t,e){var i,r,c,a,u,o,s;u=(c=n.d.p).e,o=c.r,n.g=new QK(o),i=(a=n.d.o.c.p)>0?u[a-1]:x8(Out,a1n,10,0,0,1),r=u[a],s=a<u.length-1?u[a+1]:x8(Out,a1n,10,0,0,1),t==e-1?uZ(n.g,r,s):uZ(n.g,i,r)}function pPn(n){var t;this.j=new Np,this.f=new Rv,this.b=new YK(t=BB(Vj(FIt),9),BB(SR(t,t.length),9),0),this.d=x8(ANt,hQn,25,(kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,15,1),this.g=n}function vPn(n,t){var e,i,r;if(0!=t.c.length){for(e=TMn(n,t),r=!1;!e;)E$n(n,t,!0),r=!0,e=TMn(n,t);r&&E$n(n,t,!1),i=Dun(t),n.b&&n.b.lg(i),n.a=$hn(n,(l1(0,t.c.length),BB(t.c[0],33))),vPn(n,i)}}function mPn(n,t){var e,i,r;if(i=itn(n.Tg(),t),(e=t-n.Ah())<0){if(!i)throw Hp(new _y(o6n+t+s6n));if(!i.Ij())throw Hp(new _y(r6n+i.ne()+c6n));(r=n.Yg(i))>=0?n.Bh(r):cIn(n,i)}else qfn(n,e,i)}function yPn(n){var t,e;if(e=null,t=!1,cL(n,204)&&(t=!0,e=BB(n,204).a),t||cL(n,258)&&(t=!0,e=""+BB(n,258).a),t||cL(n,483)&&(t=!0,e=""+BB(n,483).a),!t)throw Hp(new Ly(H6n));return e}function kPn(n,t){var e,i;if(n.f){for(;t.Ob();)if(cL(i=(e=BB(t.Pb(),72)).ak(),99)&&0!=(BB(i,18).Bb&h6n)&&(!n.e||i.Gj()!=NOt||0!=i.aj())&&null!=e.dd())return t.Ub(),!0;return!1}return t.Ob()}function jPn(n,t){var e,i;if(n.f){for(;t.Sb();)if(cL(i=(e=BB(t.Ub(),72)).ak(),99)&&0!=(BB(i,18).Bb&h6n)&&(!n.e||i.Gj()!=NOt||0!=i.aj())&&null!=e.dd())return t.Pb(),!0;return!1}return t.Sb()}function EPn(n,t,e){var i,r,c,a,u,o;for(o=axn(n.e.Tg(),t),i=0,u=n.i,r=BB(n.g,119),a=0;a<n.i;++a)if(c=r[a],o.rl(c.ak())){if(e==i)return a;++i,u=a+1}if(e==i)return u;throw Hp(new Ay(e9n+e+o8n+i))}function TPn(n,t){var i,r,c;if(0==n.f.c.length)return null;for(c=new bA,i=new Wb(n.f);i.a<i.c.c.length;)r=BB(n0(i),70).o,c.b=e.Math.max(c.b,r.a),c.a+=r.b;return c.a+=(n.f.c.length-1)*t,c}function MPn(n,t,e){var i,r,c;for(r=new oz(ZL(hbn(e).a.Kc(),new h));dAn(r);)b5(i=BB(U5(r),17))||!b5(i)&&i.c.i.c==i.d.i.c||(c=zLn(n,i,e,new um)).c.length>1&&(t.c[t.c.length]=c)}function SPn(n){var t,e,i;for(Frn(e=new YT,n.o),i=new om;0!=e.b;)WUn(n,t=BB(0==e.b?null:(Px(0!=e.b),Atn(e,e.a.a)),508),!0)&&WB(i.a,t);for(;0!=i.a.c.length;)WUn(n,t=BB(thn(i),508),!1)}function PPn(){PPn=O,kMt=new $C(hJn,0),wMt=new $C("BOOLEAN",1),vMt=new $C("INT",2),yMt=new $C("STRING",3),dMt=new $C("DOUBLE",4),gMt=new $C("ENUM",5),pMt=new $C("ENUMSET",6),mMt=new $C("OBJECT",7)}function CPn(n,t){var i,r,c,a,u;r=e.Math.min(n.c,t.c),a=e.Math.min(n.d,t.d),(c=e.Math.max(n.c+n.b,t.c+t.b))<r&&(i=r,r=c,c=i),(u=e.Math.max(n.d+n.a,t.d+t.a))<a&&(i=a,a=u,u=i),xH(n,r,a,c-r,u-a)}function IPn(){IPn=O,J$t=Pun(Gk(Qtt,1),sVn,2,6,[w7n,d7n,g7n,p7n,v7n,m7n,n8n]),Y$t=Pun(Gk(Qtt,1),sVn,2,6,[w7n,"empty",d7n,K9n,"elementOnly"]),nLt=Pun(Gk(Qtt,1),sVn,2,6,[w7n,"preserve","replace",y7n]),Z$t=new SH}function OPn(n,t,e){var i,r,c;if(t!=e){i=t;do{UR(n,i.c),(r=i.e)&&(_x(n,(c=i.d).b,c.d),UR(n,r.n),i=vW(r))}while(r);i=e;do{XR(n,i.c),(r=i.e)&&(Bx(n,(c=i.d).b,c.d),XR(n,r.n),i=vW(r))}while(r)}}function APn(n,t,e,i){var r,c,a,u,o;if(i.f.c+i.g.c==0)for(u=0,o=(a=n.a[n.c]).length;u<o;++u)VW(i,c=a[u],new kcn(n,c,e));return(r=BB(qI(AY(i.f,t)),663)).b=0,r.c=r.f,0==r.c||Tb(BB(xq(r.a,r.b),287)),r}function $Pn(){$Pn=O,Zst=new jP("MEDIAN_LAYER",0),tht=new jP("TAIL_LAYER",1),Jst=new jP("HEAD_LAYER",2),nht=new jP("SPACE_EFFICIENT_LAYER",3),eht=new jP("WIDEST_LAYER",4),Yst=new jP("CENTER_LAYER",5)}function LPn(n){switch(n.g){case 0:case 1:case 2:return kUn(),sIt;case 3:case 4:case 5:return kUn(),SIt;case 6:case 7:case 8:return kUn(),CIt;case 9:case 10:case 11:return kUn(),oIt;default:return kUn(),PIt}}function NPn(n,t){var e;return 0!=n.c.length&&(e=tdn((l1(0,n.c.length),BB(n.c[0],17)).c.i),BZ(),e==(bvn(),fvt)||e==hvt||o5($V(new Rq(null,new w1(n,16)),new Fc),new ig(t)))}function xPn(n,t,e){var i,r,c;if(!n.b[t.g]){for(n.b[t.g]=!0,!(i=e)&&(i=new P6),DH(i.b,t),c=n.a[t.g].Kc();c.Ob();)(r=BB(c.Pb(),188)).b!=t&&xPn(n,r.b,i),r.c!=t&&xPn(n,r.c,i),DH(i.a,r);return i}return null}function DPn(){DPn=O,Qyt=new lC("ROOT_PROC",0),Uyt=new lC("FAN_PROC",1),Wyt=new lC("NEIGHBORS_PROC",2),Xyt=new lC("LEVEL_HEIGHT",3),Vyt=new lC("NODE_POSITION_PROC",4),zyt=new lC("DETREEIFYING_PROC",5)}function RPn(n,t){if(cL(t,239))return zA(n,BB(t,33));if(cL(t,186))return UA(n,BB(t,118));if(cL(t,439))return GA(n,BB(t,202));throw Hp(new _y(z6n+LMn(new Jy(Pun(Gk(Ant,1),HWn,1,5,[t])))))}function KPn(n,t,e){var i,r;if(this.f=n,w6(e,r=(i=BB(RX(n.b,t),283))?i.a:0),e>=(r/2|0))for(this.e=i?i.c:null,this.d=r;e++<r;)TZ(this);else for(this.c=i?i.b:null;e-- >0;)EZ(this);this.b=t,this.a=null}function _Pn(n,t){var e,i;t.a?zNn(n,t):(!!(e=BB(kK(n.b,t.b),57))&&e==n.a[t.b.f]&&!!e.a&&e.a!=t.b.a&&e.c.Fc(t.b),!!(i=BB(yK(n.b,t.b),57))&&n.a[i.f]==t.b&&!!i.a&&i.a!=t.b.a&&t.b.c.Fc(i),MN(n.b,t.b))}function FPn(n,t){var e,i;if(e=BB(oV(n.b,t),124),BB(BB(h6(n.r,t),21),84).dc())return e.n.b=0,void(e.n.c=0);e.n.b=n.C.b,e.n.c=n.C.c,n.A.Hc((mdn(),_It))&&yRn(n,t),i=Xpn(n,t),PDn(n,t)==(cpn(),BCt)&&(i+=2*n.w),e.a.a=i}function BPn(n,t){var e,i;if(e=BB(oV(n.b,t),124),BB(BB(h6(n.r,t),21),84).dc())return e.n.d=0,void(e.n.a=0);e.n.d=n.C.d,e.n.a=n.C.a,n.A.Hc((mdn(),_It))&&kRn(n,t),i=Wpn(n,t),PDn(n,t)==(cpn(),BCt)&&(i+=2*n.w),e.a.b=i}function HPn(n,t){var e,i,r,c;for(c=new Np,i=new Wb(t);i.a<i.c.c.length;)WB(c,new RS(e=BB(n0(i),65),!0)),WB(c,new RS(e,!1));my((r=new hY(n)).a.a),e2(c,n.b,new Jy(Pun(Gk(oit,1),HWn,679,0,[r])))}function qPn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w;return u=n.a,f=n.b,o=t.a,l=t.b,s=e.a,b=e.b,new xC(((c=u*l-f*o)*(s-(h=i.a))-(a=s*(w=i.b)-b*h)*(u-o))/(r=(u-o)*(b-w)-(f-l)*(s-h)),(c*(b-w)-a*(f-l))/r)}function GPn(n,t){var e,i,r;if(!n.d[t.p]){for(n.d[t.p]=!0,n.a[t.p]=!0,i=new oz(ZL(lbn(t).a.Kc(),new h));dAn(i);)b5(e=BB(U5(i),17))||(r=e.d.i,n.a[r.p]?WB(n.b,e):GPn(n,r));n.a[t.p]=!1}}function zPn(n,t,e){var i;switch(i=0,BB(mMn(t,(HXn(),kgt)),163).g){case 2:i=2*-e+n.a,++n.a;break;case 1:i=-e;break;case 3:i=e;break;case 4:i=2*e+n.b,++n.b}return Lx(t,(hWn(),wlt))&&(i+=BB(mMn(t,wlt),19).a),i}function UPn(n,t,e){var i,r,c;for(e.zc(t,n),WB(n.n,t),c=n.p.eg(t),t.j==n.p.fg()?Obn(n.e,c):Obn(n.j,c),rX(n),r=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[new Hw(t),new Gw(t)])));dAn(r);)i=BB(U5(r),11),e._b(i)||UPn(n,i,e)}function XPn(n){var t,e;return BB(ZAn(n,(sWn(),KSt)),21).Hc((mdn(),DIt))?(e=BB(ZAn(n,qSt),21),t=new wA(BB(ZAn(n,BSt),8)),e.Hc((n_n(),GIt))&&(t.a<=0&&(t.a=20),t.b<=0&&(t.b=20)),t):new Gj}function WPn(n){var t,e,i;if(!n.b){for(i=new Co,e=new ax(RBn(n));e.e!=e.i.gc();)0!=((t=BB(jpn(e),18)).Bb&h6n)&&f9(i,t);chn(i),n.b=new NO((BB(Wtn(QQ((QX(),t$t).o),8),18),i.i),i.g),P5(n).b&=-9}return n.b}function VPn(n,t){var e,i,r,c,a,u;a=BB(Emn(gz(t.k),x8(FIt,YZn,61,2,0,1)),122),Zmn(n,u=t.g,e=o3(t,a[0]),i=u3(t,a[1]))<=Zmn(n,u,r=o3(t,a[1]),c=u3(t,a[0]))?(t.a=e,t.c=i):(t.a=r,t.c=c)}function QPn(n,t,e){var i,r,c;for(OTn(e,"Processor set neighbors",1),n.a=0==t.b.b?1:t.b.b,r=null,i=spn(t.b,0);!r&&i.b!=i.d.c;)qy(TD(mMn(c=BB(b3(i),86),(qqn(),dkt))))&&(r=c);r&&LDn(n,new bg(r),e),HSn(e)}function YPn(n){var t,e,i,r;return RHn(),t=-1==(i=GO(n,YTn(35)))?n:n.substr(0,i),e=-1==i?null:n.substr(i+1),(r=V3(EAt,t))?null!=e&&(r=Csn(r,(kW(e),e))):(r=WXn(t),a5(EAt,t,r),null!=e&&(r=Csn(r,e))),r}function JPn(n){var t,e,i,r,c,a,u;if(SQ(),cL(n,54))for(c=0,r=n.gc()-1;c<r;++c,--r)t=n.Xb(c),n._c(c,n.Xb(r)),n._c(r,t);else for(e=n.Yc(),a=n.Zc(n.gc());e.Tb()<a.Vb();)i=e.Pb(),u=a.Ub(),e.Wb(u),a.Wb(i)}function ZPn(n,t){var e,i,r;OTn(t,"End label pre-processing",1),e=Gy(MD(mMn(n,(HXn(),jpt)))),i=Gy(MD(mMn(n,Spt))),r=gA(BB(mMn(n,Udt),103)),JT(wnn(new Rq(null,new w1(n.b,16)),new he),new D_(e,i,r)),HSn(t)}function nCn(n,t){var e,i,r,c,a,u;for(u=0,d3(c=new Lp,t);c.b!=c.c;)for(u+=syn((a=BB(dU(c),214)).d,a.e),r=new Wb(a.b);r.a<r.c.c.length;)i=BB(n0(r),37),(e=BB(xq(n.b,i.p),214)).s||(u+=nCn(n,e));return u}function tCn(n,t,i){var r,c;_an(this),t==(dJ(),Lyt)?TU(this.r,n.c):TU(this.w,n.c),TU(i==Lyt?this.r:this.w,n.d),tPn(this,n),XMn(this,r=Phn(n.c),c=Phn(n.d),c),this.o=(gxn(),e.Math.abs(r-c)<.2)}function eCn(n,t,e){var i,r,c,a,u;if(null!=(a=BB(yan(n.a,8),1936)))for(r=0,c=a.length;r<c;++r)null.jm();i=e,0==(1&n.a.Db)&&(u=new uW(n,e,t),i.ui(u)),cL(i,672)?BB(i,672).wi(n.a):i.ti()==n.a&&i.vi(null)}function iCn(){var n;return ZLt?BB($$n((WM(),zAt),S7n),1945):(sUn(),n=BB(cL(SJ((WM(),zAt),S7n),586)?SJ(zAt,S7n):new zW,586),ZLt=!0,gXn(n),pWn(n),VW((VM(),ZAt),n,new Ks),Tyn(n),mZ(zAt,S7n,n),n)}function rCn(n,t,e,i){var r;return(r=zTn(n,e,Pun(Gk(Qtt,1),sVn,2,6,[bQn,wQn,dQn,gQn,pQn,vQn,mQn]),t))<0&&(r=zTn(n,e,Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]),t)),!(r<0||(i.d=r,0))}function cCn(n,t,e,i){var r;return(r=zTn(n,e,Pun(Gk(Qtt,1),sVn,2,6,[bQn,wQn,dQn,gQn,pQn,vQn,mQn]),t))<0&&(r=zTn(n,e,Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]),t)),!(r<0||(i.d=r,0))}function aCn(n){var t,e,i;for(_$n(n),i=new Np,e=new Wb(n.a.a.b);e.a<e.c.c.length;)WB(i,new fP(t=BB(n0(e),81),!0)),WB(i,new fP(t,!1));nmn(n.c),i2(i,n.b,new Jy(Pun(Gk(Jat,1),HWn,369,0,[n.c]))),vAn(n)}function uCn(n){var t,e,i,r;for(e=new xp,r=new Wb(n.d);r.a<r.c.c.length;)i=BB(n0(r),181),t=BB(i.We((hWn(),Uft)),17),AY(e.f,t)||VW(e,t,new TQ(t)),WB(BB(qI(AY(e.f,t)),456).b,i);return new t_(new Ob(e))}function oCn(n,t){var e,i,r,c,a;for(i=new d1(n.j.c.length),e=null,c=new Wb(n.j);c.a<c.c.c.length;)(r=BB(n0(c),11)).j!=e&&(i.b==i.c||F$n(i,e,t),o4(i),e=r.j),(a=mAn(r))&&w3(i,a);i.b==i.c||F$n(i,e,t)}function sCn(n,t){var e,i;for(i=new M2(n.b,0);i.b<i.d.gc();)Px(i.b<i.d.gc()),e=BB(i.d.Xb(i.c=i.b++),70),BB(mMn(e,(HXn(),Ydt)),272)==(Rtn(),UPt)&&(fW(i),WB(t.b,e),Lx(e,(hWn(),Uft))||hon(e,Uft,n))}function hCn(n){var t,i,r;for(t=F3(new oz(ZL(lbn(n).a.Kc(),new h))),i=new oz(ZL(fbn(n).a.Kc(),new h));dAn(i);)r=F3(new oz(ZL(lbn(BB(U5(i),17).c.i).a.Kc(),new h))),t=e.Math.max(t,r);return iln(t)}function fCn(n,t,e){var i,r,c,a;for(OTn(e,"Processor arrange node",1),r=null,c=new YT,i=spn(t.b,0);!r&&i.b!=i.d.c;)qy(TD(mMn(a=BB(b3(i),86),(qqn(),dkt))))&&(r=a);r5(c,r,c.c.b,c.c),Yzn(n,c,mcn(e,1)),HSn(e)}function lCn(n,t,e){var i,r,c;i=BB(ZAn(n,(sWn(),hSt)),21),r=0,c=0,t.a>e.a&&(i.Hc((wEn(),WMt))?r=(t.a-e.a)/2:i.Hc(QMt)&&(r=t.a-e.a)),t.b>e.b&&(i.Hc((wEn(),JMt))?c=(t.b-e.b)/2:i.Hc(YMt)&&(c=t.b-e.b)),lMn(n,r,c)}function bCn(n,t,e,i,r,c,a,u,o,s,h,f,l){cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),4),Nrn(n,e),n.f=a,$ln(n,u),Nln(n,o),Aln(n,s),Lln(n,h),nln(n,f),qln(n,l),Yfn(n,!0),Len(n,r),n.ok(c),Ihn(n,t),null!=i&&(n.i=null,arn(n,i))}function wCn(n){var t,e;if(n.f){for(;n.n>0;){if(cL(e=(t=BB(n.k.Xb(n.n-1),72)).ak(),99)&&0!=(BB(e,18).Bb&h6n)&&(!n.e||e.Gj()!=NOt||0!=e.aj())&&null!=t.dd())return!0;--n.n}return!1}return n.n>0}function dCn(n,t,e){if(n<0)return $Rn(BWn,Pun(Gk(Ant,1),HWn,1,5,[e,iln(n)]));if(t<0)throw Hp(new _y(qWn+t));return $Rn("%s (%s) must not be greater than size (%s)",Pun(Gk(Ant,1),HWn,1,5,[e,iln(n),iln(t)]))}function gCn(n,t,e,i,r,c){var a,u,o;if(i-e<7)$bn(t,e,i,c);else if(gCn(t,n,u=e+r,o=u+((a=i+r)-u>>1),-r,c),gCn(t,n,o,a,-r,c),c.ue(n[o-1],n[o])<=0)for(;e<i;)$X(t,e++,n[u++]);else Gfn(n,u,o,a,t,e,i,c)}function pCn(n,t){var e,i,r;for(r=new Np,i=new Wb(n.c.a.b);i.a<i.c.c.length;)e=BB(n0(i),57),t.Lb(e)&&(WB(r,new OS(e,!0)),WB(r,new OS(e,!1)));Zvn(n.e),e2(r,n.d,new Jy(Pun(Gk(oit,1),HWn,679,0,[n.e])))}function vCn(n,t){var e,i,r,c,a,u,o;for(o=t.d,r=t.b.j,u=new Wb(o);u.a<u.c.c.length;)for(a=BB(n0(u),101),c=x8($Nt,ZYn,25,r.c.length,16,1),VW(n.b,a,c),e=a.a.d.p-1,i=a.c.d.p;e!=i;)c[e=(e+1)%r.c.length]=!0}function mCn(n,t){for(n.r=new Fan(n.p),Jl(n.r,n),Frn(n.r.j,n.j),yQ(n.j),DH(n.j,t),DH(n.r.e,t),rX(n),rX(n.r);0!=n.f.c.length;)G$(BB(xq(n.f,0),129));for(;0!=n.k.c.length;)G$(BB(xq(n.k,0),129));return n.r}function yCn(n,t,e){var i,r,c;if(r=itn(n.Tg(),t),(i=t-n.Ah())<0){if(!r)throw Hp(new _y(o6n+t+s6n));if(!r.Ij())throw Hp(new _y(r6n+r.ne()+c6n));(c=n.Yg(r))>=0?n.sh(c,e):TLn(n,r,e)}else Lbn(n,i,r,e)}function kCn(n){var t,e,i,r;if(e=BB(n,49).qh())try{if(i=null,(t=$$n((WM(),zAt),M_n(_bn(e))))&&(r=t.rh())&&(i=r.Wk(Xy(e.e))),i&&i!=n)return kCn(i)}catch(c){if(!cL(c=lun(c),60))throw Hp(c)}return n}function jCn(n,t,e){var i,r,c,a;if(a=null==t?0:n.b.se(t),0==(r=null==(i=n.a.get(a))?new Array:i).length)n.a.set(a,r);else if(c=hhn(n,t,r))return c.ed(e);return $X(r,r.length,new PS(t,e)),++n.c,oY(n.b),null}function ECn(n,t){var e;return h2(n.a),CU(n.a,(Prn(),Qkt),Qkt),CU(n.a,Ykt,Ykt),dq(e=new B2,Ykt,(Cbn(),ejt)),GI(ZAn(t,(Uyn(),Sjt)))!==GI((Hsn(),sjt))&&dq(e,Ykt,njt),dq(e,Ykt,tjt),aA(n.a,e),$qn(n.a,t)}function TCn(n){if(!n)return lk(),htt;var t=n.valueOf?n.valueOf():n;if(t!==n){var i=ftt[typeof t];return i?i(t):khn(typeof t)}return n instanceof Array||n instanceof e.Array?new Tl(n):new Pl(n)}function MCn(n,t,i){var r,c,a;switch(a=n.o,(c=(r=BB(oV(n.p,i),244)).i).b=SIn(r),c.a=MIn(r),c.b=e.Math.max(c.b,a.a),c.b>a.a&&!t&&(c.b=a.a),c.c=-(c.b-a.a)/2,i.g){case 1:c.d=-c.a;break;case 3:c.d=a.b}_Fn(r),GFn(r)}function SCn(n,t,i){var r,c,a;switch(a=n.o,(c=(r=BB(oV(n.p,i),244)).i).b=SIn(r),c.a=MIn(r),c.a=e.Math.max(c.a,a.b),c.a>a.b&&!t&&(c.a=a.b),c.d=-(c.a-a.b)/2,i.g){case 4:c.c=-c.b;break;case 2:c.c=a.a}_Fn(r),GFn(r)}function PCn(n,t){var e,i,r,c,a;if(!t.dc())if(r=BB(t.Xb(0),128),1!=t.gc())for(e=1;e<t.gc();)!r.j&&r.o||(c=vyn(t,e))&&(i=BB(c.a,19).a,kxn(n,r,a=BB(c.b,128),e,i,t),e=i+1,r=a);else kxn(n,r,r,1,0,t)}function CCn(n){var t,e,i,r;for(m$(r=new t_(n.d),new zr),kDn(),t=Pun(Gk(iht,1),$Vn,270,0,[Bst,Gst,Fst,Xst,qst,Hst,Ust,zst]),e=0,i=new Wb(r);i.a<i.c.c.length;)COn(BB(n0(i),101),t[e%t.length]),++e}function ICn(n,t){var e,i,r,c;if(jDn(),t.b<2)return!1;for(i=e=BB(b3(c=spn(t,0)),8);c.b!=c.d.c;){if(r=BB(b3(c),8),!Dcn(n,i)||!Dcn(n,r))return!1;i=r}return!(!Dcn(n,i)||!Dcn(n,e))}function OCn(n,t){var e,i,r,c,a;return e=Ren(a=n,"x"),nnn(new qg(t).a,e),i=Ren(a,"y"),tnn(new Gg(t).a,i),r=Ren(a,C6n),enn(new zg(t).a,r),c=Ren(a,P6n),inn(new Ug(t).a,c),c}function ACn(n,t){dRn(n,t),0!=(1&n.b)&&(n.a.a=null),0!=(2&n.b)&&(n.a.f=null),0!=(4&n.b)&&(n.a.g=null,n.a.i=null),0!=(16&n.b)&&(n.a.d=null,n.a.e=null),0!=(8&n.b)&&(n.a.b=null),0!=(32&n.b)&&(n.a.j=null,n.a.c=null)}function $Cn(n,t){var e,i;if(i=0,t.length>0)try{i=l_n(t,_Vn,DWn)}catch(r){throw cL(r=lun(r),127)?Hp(new L7(r)):Hp(r)}return!n.a&&(n.a=new Sp(n)),i<(e=n.a).i&&i>=0?BB(Wtn(e,i),56):null}function LCn(n,t){if(n<0)return $Rn(BWn,Pun(Gk(Ant,1),HWn,1,5,["index",iln(n)]));if(t<0)throw Hp(new _y(qWn+t));return $Rn("%s (%s) must be less than size (%s)",Pun(Gk(Ant,1),HWn,1,5,["index",iln(n),iln(t)]))}function NCn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i<r;++i)t=e[i],c.a?oO(c.a,c.b):c.a=new lN(c.d),aO(c.a,""+t);return c.a?0==c.e.length?c.a.a:c.a.a+""+c.e:c.c}function xCn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i<r;++i)t=e[i],c.a?oO(c.a,c.b):c.a=new lN(c.d),aO(c.a,""+t);return c.a?0==c.e.length?c.a.a:c.a.a+""+c.e:c.c}function DCn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i<r;++i)t=e[i],c.a?oO(c.a,c.b):c.a=new lN(c.d),aO(c.a,""+t);return c.a?0==c.e.length?c.a.a:c.a.a+""+c.e:c.c}function RCn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i<r;++i)t=e[i],c.a?oO(c.a,c.b):c.a=new lN(c.d),aO(c.a,""+t);return c.a?0==c.e.length?c.a.a:c.a.a+""+c.e:c.c}function KCn(n,t){var e,i,r,c,a,u;for(e=n.b.c.length,r=xq(n.b,t);2*t+1<e&&(u=c=2*t+1,(a=c+1)<e&&n.a.ue(xq(n.b,a),xq(n.b,c))<0&&(u=a),i=u,!(n.a.ue(r,xq(n.b,i))<0));)c5(n.b,t,xq(n.b,i)),t=i;c5(n.b,t,r)}function _Cn(n,t,i,r,c,a){var u,o,s,h,f;for(GI(n)===GI(i)&&(n=n.slice(t,t+c),t=0),s=i,o=t,h=t+c;o<h;)c=(u=e.Math.min(o+1e4,h))-o,(f=n.slice(o,u)).splice(0,0,r,a?c:0),Array.prototype.splice.apply(s,f),o=u,r+=c}function FCn(n,t,e){var i,r;return i=e.d,r=e.e,n.g[i.d]<=n.i[t.d]&&n.i[t.d]<=n.i[i.d]&&n.g[r.d]<=n.i[t.d]&&n.i[t.d]<=n.i[r.d]?!(n.i[i.d]<n.i[r.d]):n.i[i.d]<n.i[r.d]}function BCn(n){var t,e,i,r,c,a,u;if((i=n.a.c.length)>0)for(a=n.c.d,r=kL(XR(new xC((u=n.d.d).a,u.b),a),1/(i+1)),c=new xC(a.a,a.b),e=new Wb(n.a);e.a<e.c.c.length;)(t=BB(n0(e),559)).d.a=c.a,t.d.b=c.b,UR(c,r)}function HCn(n,t,i){var r,c,a,u,o,s;for(s=RQn,a=new Wb(GLn(n.b));a.a<a.c.c.length;)for(c=BB(n0(a),168),o=new Wb(GLn(t.b));o.a<o.c.c.length;)u=BB(n0(o),168),r=Cun(c.a,c.b,u.a,u.b,i),s=e.Math.min(s,r);return s}function qCn(n,t){if(!t)throw Hp(new gv);if(n.j=t,!n.d)switch(n.j.g){case 1:n.a.a=n.o.a/2,n.a.b=0;break;case 2:n.a.a=n.o.a,n.a.b=n.o.b/2;break;case 3:n.a.a=n.o.a/2,n.a.b=n.o.b;break;case 4:n.a.a=0,n.a.b=n.o.b/2}}function GCn(n,t){var i,r;return cL(t.g,10)&&BB(t.g,10).k==(uSn(),Mut)?RQn:f3(t)?e.Math.max(0,n.b/2-.5):(i=f2(t))?(r=Gy(MD(edn(i,(HXn(),Opt)))),e.Math.max(0,r/2-.5)):RQn}function zCn(n,t){var i,r;return cL(t.g,10)&&BB(t.g,10).k==(uSn(),Mut)?RQn:f3(t)?e.Math.max(0,n.b/2-.5):(i=f2(t))?(r=Gy(MD(edn(i,(HXn(),Opt)))),e.Math.max(0,r/2-.5)):RQn}function UCn(n){var t,e,i,r;for(r=Lfn(n.d,n.e).Kc();r.Ob();)for(i=BB(r.Pb(),11),e=new Wb(n.e==(kUn(),CIt)?i.e:i.g);e.a<e.c.c.length;)b5(t=BB(n0(e),17))||t.c.i.c==t.d.i.c||(RSn(n,t),++n.f,++n.c)}function XCn(n,t){var e,i;if(t.dc())return SQ(),SQ(),set;for(WB(i=new Np,iln(_Vn)),e=1;e<n.f;++e)null==n.a&&wRn(n),n.a[e]&&WB(i,iln(e));return 1==i.c.length?(SQ(),SQ(),set):(WB(i,iln(DWn)),dBn(t,i))}function WCn(n,t){var e,i,r,c,a,u;e=ckn(t,u=t.c.i.k!=(uSn(),Cut)?t.d:t.c).i,r=BB(RX(n.k,u),121),i=n.i[e.p].a,AK(u.i)<(e.c?E7(e.c.a,e,0):-1)?(c=r,a=i):(c=i,a=r),UNn(aM(cM(uM(rM(new Hv,0),4),c),a))}function VCn(n,t,e){var i,r,c;if(e)for(r=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);r.Ob();)(c=Amn(n,kIn(dnn(e,BB(r.Pb(),19).a))))&&(!t.b&&(t.b=new hK(KOt,t,4,7)),f9(t.b,c))}function QCn(n,t,e){var i,r,c;if(e)for(r=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);r.Ob();)(c=Amn(n,kIn(dnn(e,BB(r.Pb(),19).a))))&&(!t.c&&(t.c=new hK(KOt,t,5,8)),f9(t.c,c))}function YCn(n,t,e){var i,r;i=t.a&n.f,t.b=n.b[i],n.b[i]=t,r=t.f&n.f,t.d=n.c[r],n.c[r]=t,e?(t.e=e.e,t.e?t.e.c=t:n.a=t,t.c=e.c,t.c?t.c.e=t:n.e=t):(t.e=n.e,t.c=null,n.e?n.e.c=t:n.a=t,n.e=t),++n.i,++n.g}function JCn(n){var t,e,i;if(t=n.Pb(),!n.Ob())return t;for(i=uO(oO(new Ck,"expected one element but was: <"),t),e=0;e<4&&n.Ob();e++)uO((i.a+=FWn,i),n.Pb());throw n.Ob()&&(i.a+=", ..."),i.a+=">",Hp(new _y(i.a))}function ZCn(n,t){var e;t.d?t.d.b=t.b:n.a=t.b,t.b?t.b.d=t.d:n.e=t.d,t.e||t.c?(--(e=BB(RX(n.b,t.a),283)).a,t.e?t.e.c=t.c:e.b=t.c,t.c?t.c.e=t.e:e.c=t.e):((e=BB(v6(n.b,t.a),283)).a=0,++n.c),--n.d}function nIn(n){var t,e;return e=-n.a,t=Pun(Gk(ONt,1),WVn,25,15,[43,48,48,48,48]),e<0&&(t[0]=45,e=-e),t[1]=t[1]+((e/60|0)/10|0)&QVn,t[2]=t[2]+(e/60|0)%10&QVn,t[3]=t[3]+(e%60/10|0)&QVn,t[4]=t[4]+e%10&QVn,Bdn(t,0,t.length)}function tIn(n,t,e){var i,r;for(i=t.d,r=e.d;i.a-r.a==0&&i.b-r.b==0;)i.a+=H$n(n,26)*rYn+H$n(n,27)*cYn-.5,i.b+=H$n(n,26)*rYn+H$n(n,27)*cYn-.5,r.a+=H$n(n,26)*rYn+H$n(n,27)*cYn-.5,r.b+=H$n(n,26)*rYn+H$n(n,27)*cYn-.5}function eIn(n){var t,e,i,r;for(n.g=new Hbn(BB(yX(FIt),290)),i=0,kUn(),e=sIt,t=0;t<n.j.c.length;t++)(r=BB(xq(n.j,t),11)).j!=e&&(i!=t&&mG(n.g,e,new rI(iln(i),iln(t))),e=r.j,i=t);mG(n.g,e,new rI(iln(i),iln(t)))}function iIn(n){var t,e,i,r,c;for(e=0,t=new Wb(n.b);t.a<t.c.c.length;)for(r=new Wb(BB(n0(t),29).a);r.a<r.c.c.length;)for((i=BB(n0(r),10)).p=e++,c=new Wb(i.j);c.a<c.c.c.length;)BB(n0(c),11).p=e++}function rIn(n,t,e,i,r){var c,a,u,o;if(t)for(a=t.Kc();a.Ob();)for(o=cRn(BB(a.Pb(),10),(ain(),qvt),e).Kc();o.Ob();)u=BB(o.Pb(),11),(c=BB(qI(AY(r.f,u)),112))||(c=new Fan(n.d),i.c[i.c.length]=c,UPn(c,u,r))}function cIn(n,t){var e,i,r;if(!(r=Fqn((IPn(),Z$t),n.Tg(),t)))throw Hp(new _y(r6n+t.ne()+c6n));ZM(),BB(r,66).Oj()||(r=Z1(B7(Z$t,r))),i=BB((e=n.Yg(r))>=0?n._g(e,!0,!0):cOn(n,r,!0),153),BB(i,215).ol(t)}function aIn(n){var t,i;return n>-0x800000000000&&n<0x800000000000?0==n?0:((t=n<0)&&(n=-n),i=CJ(e.Math.floor(e.Math.log(n)/.6931471805599453)),(!t||n!=e.Math.pow(2,i))&&++i,i):Van(fan(n))}function uIn(n){var t,e,i,r,c,a,u;for(c=new fA,e=new Wb(n);e.a<e.c.c.length;)a=(t=BB(n0(e),129)).a,u=t.b,c.a._b(a)||c.a._b(u)||(r=a,i=u,a.e.b+a.j.b>2&&u.e.b+u.j.b<=2&&(r=u,i=a),c.a.zc(r,c),r.q=i);return c}function oIn(n,t){var e,i,r;return qan(i=new $vn(n),t),hon(i,(hWn(),Vft),t),hon(i,(HXn(),ept),(QEn(),XCt)),hon(i,kdt,(wvn(),OMt)),Bl(i,(uSn(),Mut)),CZ(e=new CSn,i),qCn(e,(kUn(),CIt)),CZ(r=new CSn,i),qCn(r,oIt),i}function sIn(n){switch(n.g){case 0:return new Ny((oin(),Omt));case 1:return new df;case 2:return new jf;default:throw Hp(new _y("No implementation is available for the crossing minimizer "+(null!=n.f?n.f:""+n.g)))}}function hIn(n,t){var e,i,r,c;for(n.c[t.p]=!0,WB(n.a,t),c=new Wb(t.j);c.a<c.c.c.length;)for(e=new m6((r=BB(n0(c),11)).b);y$(e.a)||y$(e.b);)i=ngn(r,BB(y$(e.a)?n0(e.a):n0(e.b),17)).i,n.c[i.p]||hIn(n,i)}function fIn(n){var t,i,r,c,a,u,o;for(u=0,i=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));i.e!=i.i.gc();)o=(t=BB(kpn(i),33)).g,c=t.f,r=e.Math.sqrt(o*o+c*c),u=e.Math.max(r,u),a=fIn(t),u=e.Math.max(a,u);return u}function lIn(){lIn=O,rIt=new XC("OUTSIDE",0),eIt=new XC("INSIDE",1),iIt=new XC("NEXT_TO_PORT_IF_POSSIBLE",2),tIt=new XC("ALWAYS_SAME_SIDE",3),nIt=new XC("ALWAYS_OTHER_SAME_SIDE",4),cIt=new XC("SPACE_EFFICIENT",5)}function bIn(n,t,e){var i,r,c,a;return $in(i=K2(n,(tE(),r=new jm,!!e&&nNn(r,e),r),t),R2(t,q6n)),STn(t,i),o$n(t,i),OCn(t,i),c=N2(t,"ports"),PLn((a=new pI(n,i)).a,a.b,c),xon(n,t,i),aun(n,t,i),i}function wIn(n){var t,e;return e=-n.a,t=Pun(Gk(ONt,1),WVn,25,15,[43,48,48,58,48,48]),e<0&&(t[0]=45,e=-e),t[1]=t[1]+((e/60|0)/10|0)&QVn,t[2]=t[2]+(e/60|0)%10&QVn,t[4]=t[4]+(e%60/10|0)&QVn,t[5]=t[5]+e%10&QVn,Bdn(t,0,t.length)}function dIn(n){var t;return t=Pun(Gk(ONt,1),WVn,25,15,[71,77,84,45,48,48,58,48,48]),n<=0&&(t[3]=43,n=-n),t[4]=t[4]+((n/60|0)/10|0)&QVn,t[5]=t[5]+(n/60|0)%10&QVn,t[7]=t[7]+(n%60/10|0)&QVn,t[8]=t[8]+n%10&QVn,Bdn(t,0,t.length)}function gIn(n){var t,e,i,r,c;if(null==n)return zWn;for(c=new $an(FWn,"[","]"),i=0,r=(e=n).length;i<r;++i)t=e[i],c.a?oO(c.a,c.b):c.a=new lN(c.d),aO(c.a,""+vz(t));return c.a?0==c.e.length?c.a.a:c.a.a+""+c.e:c.c}function pIn(n,t){var i,r,c;for(c=DWn,r=new Wb(kbn(t));r.a<r.c.c.length;)(i=BB(n0(r),213)).f&&!n.c[i.c]&&(n.c[i.c]=!0,c=e.Math.min(c,pIn(n,Nbn(i,t))));return n.i[t.d]=n.j,n.g[t.d]=e.Math.min(c,n.j++),n.g[t.d]}function vIn(n,t){var e,i,r;for(r=BB(BB(h6(n.r,t),21),84).Kc();r.Ob();)(i=BB(r.Pb(),111)).e.b=(e=i.b).Xe((sWn(),aPt))?e.Hf()==(kUn(),sIt)?-e.rf().b-Gy(MD(e.We(aPt))):Gy(MD(e.We(aPt))):e.Hf()==(kUn(),sIt)?-e.rf().b:0}function mIn(n){var t,e,i,r,c,a,u;for(e=QA(n.e),c=kL(Bx(B$(VA(n.e)),n.d*n.a,n.c*n.b),-.5),t=e.a-c.a,r=e.b-c.b,u=0;u<n.c;u++){for(i=t,a=0;a<n.d;a++)Wbn(n.e,new UV(i,r,n.a,n.b))&&FRn(n,a,u,!1,!0),i+=n.a;r+=n.b}}function yIn(n){var t,e,i;if(qy(TD(ZAn(n,(sWn(),SSt))))){for(i=new Np,e=new oz(ZL(dLn(n).a.Kc(),new h));dAn(e);)QIn(t=BB(U5(e),79))&&qy(TD(ZAn(t,PSt)))&&(i.c[i.c.length]=t);return i}return SQ(),SQ(),set}function kIn(n){var t;if(t=!1,cL(n,204))return t=!0,BB(n,204).a;if(!t&&cL(n,258)&&BB(n,258).a%1==0)return t=!0,iln(QO(BB(n,258).a));throw Hp(new ek("Id must be a string or an integer: '"+n+"'."))}function jIn(n,t){var e,i,r,c,a,u;for(c=null,r=new rU((!n.a&&(n.a=new Sp(n)),n.a));bOn(r);)if(YBn(a=(e=BB(aLn(r),56)).Tg()),null!=(i=(u=a.o)&&e.mh(u)?pK(uun(u),e.ah(u)):null)&&mK(i,t)){c=e;break}return c}function EIn(n,t,e){var i,r,c,a,u;if(lin(e,"occurrences"),0==e)return(u=BB(lfn(OQ(n.a),t),14))?u.gc():0;if(!(a=BB(lfn(OQ(n.a),t),14)))return 0;if(e>=(c=a.gc()))a.$b();else for(r=a.Kc(),i=0;i<e;i++)r.Pb(),r.Qb();return c}function TIn(n,t,e){var i,r,c;return lin(e,"oldCount"),lin(0,"newCount"),((i=BB(lfn(OQ(n.a),t),14))?i.gc():0)==e&&(lin(0,"count"),(c=-((r=BB(lfn(OQ(n.a),t),14))?r.gc():0))>0?wk():c<0&&EIn(n,t,-c),!0)}function MIn(n){var t,e,i,r,c,a;if(a=0,0==n.b){for(t=0,r=0,c=(i=Xvn(n,!0)).length;r<c;++r)(e=i[r])>0&&(a+=e,++t);t>1&&(a+=n.c*(t-1))}else a=Kk(ecn(LV(AV(LU(n.a),new Mn),new Sn)));return a>0?a+n.n.d+n.n.a:0}function SIn(n){var t,e,i,r,c,a;if(a=0,0==n.b)a=Kk(ecn(LV(AV(LU(n.a),new En),new Tn)));else{for(t=0,r=0,c=(i=Wvn(n,!0)).length;r<c;++r)(e=i[r])>0&&(a+=e,++t);t>1&&(a+=n.c*(t-1))}return a>0?a+n.n.b+n.n.c:0}function PIn(n,t){var i,r,c,a;for(i=(a=BB(oV(n.b,t),124)).a,c=BB(BB(h6(n.r,t),21),84).Kc();c.Ob();)(r=BB(c.Pb(),111)).c&&(i.a=e.Math.max(i.a,VH(r.c)));if(i.a>0)switch(t.g){case 2:a.n.c=n.s;break;case 4:a.n.b=n.s}}function CIn(n,t){var e,i,r;return 0==(e=BB(mMn(t,(fRn(),Zct)),19).a-BB(mMn(n,Zct),19).a)?(i=XR(B$(BB(mMn(n,(Mrn(),uat)),8)),BB(mMn(n,oat),8)),r=XR(B$(BB(mMn(t,uat),8)),BB(mMn(t,oat),8)),Pln(i.a*i.b,r.a*r.b)):e}function IIn(n,t){var e,i,r;return 0==(e=BB(mMn(t,(CAn(),$kt)),19).a-BB(mMn(n,$kt),19).a)?(i=XR(B$(BB(mMn(n,(qqn(),Zyt)),8)),BB(mMn(n,nkt),8)),r=XR(B$(BB(mMn(t,Zyt),8)),BB(mMn(t,nkt),8)),Pln(i.a*i.b,r.a*r.b)):e}function OIn(n){var t,e;return(e=new Ck).a+="e_",null!=(t=Xan(n))&&(e.a+=""+t),n.c&&n.d&&(oO((e.a+=" ",e),pyn(n.c)),oO(uO((e.a+="[",e),n.c.i),"]"),oO((e.a+=e1n,e),pyn(n.d)),oO(uO((e.a+="[",e),n.d.i),"]")),e.a}function AIn(n){switch(n.g){case 0:return new pf;case 1:return new vf;case 2:return new gf;case 3:return new mf;default:throw Hp(new _y("No implementation is available for the layout phase "+(null!=n.f?n.f:""+n.g)))}}function $In(n,t,i,r,c){var a;switch(a=0,c.g){case 1:a=e.Math.max(0,t.b+n.b-(i.b+r));break;case 3:a=e.Math.max(0,-n.b-r);break;case 2:a=e.Math.max(0,-n.a-r);break;case 4:a=e.Math.max(0,t.a+n.a-(i.a+r))}return a}function LIn(n,t,e){var i,r,c;if(e)for(c=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);c.Ob();)r=x2(e,BB(c.Pb(),19).a),L6n in r.a||N6n in r.a?sKn(n,r,t):EXn(n,r,t),PL(BB(RX(n.b,Qdn(r)),79))}function NIn(n){var t,e;switch(n.b){case-1:return!0;case 0:return(e=n.t)>1||-1==e||(t=Ikn(n))&&(ZM(),t.Cj()==E9n)?(n.b=-1,!0):(n.b=1,!1);default:return!1}}function xIn(n,t){var e,i,r,c,a;for(!t.s&&(t.s=new eU(FAt,t,21,17)),c=null,r=0,a=(i=t.s).i;r<a;++r)switch(DW(B7(n,e=BB(Wtn(i,r),170)))){case 2:case 3:!c&&(c=new Np),c.c[c.c.length]=e}return c||(SQ(),SQ(),set)}function DIn(n,t){var e,i,r,c;if(QXn(n),0!=n.c||123!=n.a)throw Hp(new ak(kWn((u$(),P8n))));if(c=112==t,i=n.d,(e=lx(n.i,125,i))<0)throw Hp(new ak(kWn((u$(),C8n))));return r=fx(n.i,i,e),n.d=e+1,b9(r,c,512==(512&n.e))}function RIn(n){var t;if((t=BB(mMn(n,(HXn(),qdt)),314))==(Oin(),hht))throw Hp(new ck("The hierarchy aware processor "+t+" in child node "+n+" is only allowed if the root node specifies the same hierarchical processor."))}function KIn(n,t){var e,i,r,c;for(G_(),e=null,r=t.Kc();r.Ob();)(i=BB(r.Pb(),128)).o||(WB((c=new PBn(F$(i.a),bH(i.a),null,BB(i.d.a.ec().Kc().Pb(),17))).c,i.a),n.c[n.c.length]=c,e&&WB(e.d,c),e=c)}function _In(n,t){var e,i,r;if(t)if(0!=(4&t.i))for(i="[]",e=t.c;;e=e.c){if(0==(4&e.i)){Hin(n,r=Uy((ED(e),e.o+i))),xen(n,r);break}i+="[]"}else Hin(n,r=Uy((ED(t),t.o))),xen(n,r);else Hin(n,null),xen(n,null);n.yk(t)}function FIn(n,t,e,i,r){var c,a,u,o;return GI(o=hD(n,BB(r,56)))!==GI(r)?(u=BB(n.g[e],72),jL(n,e,sTn(n,e,c=Z3(t,o))),mA(n.e)&&(KEn(a=LY(n,9,c.ak(),r,o,i,!1),new N7(n.e,9,n.c,u,c,i,!1)),$7(a)),o):r}function BIn(n,t,e){var i,r,c,a,u,o;for(i=BB(h6(n.c,t),15),r=BB(h6(n.c,e),15),c=i.Zc(i.gc()),a=r.Zc(r.gc());c.Sb()&&a.Sb();)if((u=BB(c.Ub(),19))!=(o=BB(a.Ub(),19)))return E$(u.a,o.a);return c.Ob()||a.Ob()?c.Ob()?1:-1:0}function HIn(n,t){var e,i;try{return X1(n.a,t)}catch(r){if(cL(r=lun(r),32)){try{if(i=l_n(t,_Vn,DWn),e=Vj(n.a),i>=0&&i<e.length)return e[i]}catch(c){if(!cL(c=lun(c),127))throw Hp(c)}return null}throw Hp(r)}}function qIn(n,t){var e,i,r;if(r=Fqn((IPn(),Z$t),n.Tg(),t))return ZM(),BB(r,66).Oj()||(r=Z1(B7(Z$t,r))),i=BB((e=n.Yg(r))>=0?n._g(e,!0,!0):cOn(n,r,!0),153),BB(i,215).ll(t);throw Hp(new _y(r6n+t.ne()+u6n))}function GIn(){var n;return tS(),Q$t?BB($$n((WM(),zAt),V9n),1939):(RO(Hnt,new Cs),nzn(),n=BB(cL(SJ((WM(),zAt),V9n),547)?SJ(zAt,V9n):new UW,547),Q$t=!0,oWn(n),TWn(n),VW((VM(),ZAt),n,new Go),mZ(zAt,V9n,n),n)}function zIn(n,t){var e,i,r,c;n.j=-1,mA(n.e)?(e=n.i,c=0!=n.i,c6(n,t),i=new N7(n.e,3,n.c,null,t,e,c),r=t.Qk(n.e,n.c,null),(r=IEn(n,t,r))?(r.Ei(i),r.Fi()):ban(n.e,i)):(c6(n,t),(r=t.Qk(n.e,n.c,null))&&r.Fi())}function UIn(n,t){var e,i,r;if(r=0,(i=t[0])>=n.length)return-1;for(b1(i,n.length),e=n.charCodeAt(i);e>=48&&e<=57&&(r=10*r+(e-48),!(++i>=n.length));)b1(i,n.length),e=n.charCodeAt(i);return i>t[0]?t[0]=i:r=-1,r}function XIn(n){var t,i,r,c,a;return i=c=BB(n.a,19).a,r=a=BB(n.b,19).a,t=e.Math.max(e.Math.abs(c),e.Math.abs(a)),c<=0&&c==a?(i=0,r=a-1):c==-t&&a!=t?(i=a,r=c,a>=0&&++i):(i=-a,r=c),new rI(iln(i),iln(r))}function WIn(n,t,e,i){var r,c,a,u,o,s;for(r=0;r<t.o;r++)for(c=r-t.j+e,a=0;a<t.p;a++)if(o=c,s=u=a-t.k+i,o+=n.j,s+=n.k,o>=0&&s>=0&&o<n.o&&s<n.p&&(!mmn(t,r,a)&&imn(n,c,u)||vmn(t,r,a)&&!rmn(n,c,u)))return!0;return!1}function VIn(n,t,e){var i,r,c,a;c=n.c,a=n.d,r=(Aon(Pun(Gk(PMt,1),sVn,8,0,[c.i.n,c.n,c.a])).b+Aon(Pun(Gk(PMt,1),sVn,8,0,[a.i.n,a.n,a.a])).b)/2,i=null,i=c.j==(kUn(),oIt)?new xC(t+c.i.c.c.a+e,r):new xC(t-e,r),Kx(n.a,0,i)}function QIn(n){var t,e,i;for(t=null,e=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c)])));dAn(e);)if(i=PTn(BB(U5(e),82)),t){if(t!=i)return!1}else t=i;return!0}function YIn(n,t,e){var i;if(++n.j,t>=n.i)throw Hp(new Ay(u8n+t+o8n+n.i));if(e>=n.i)throw Hp(new Ay(s8n+e+o8n+n.i));return i=n.g[e],t!=e&&(t<e?aHn(n.g,t,n.g,t+1,e-t):aHn(n.g,e+1,n.g,e,t-e),$X(n.g,t,i),n.ei(t,i,e),n.ci()),i}function JIn(n,t,e){var i;if(i=BB(n.c.xc(t),14))return!!i.Fc(e)&&(++n.d,!0);if((i=n.ic(t)).Fc(e))return++n.d,n.c.zc(t,i),!0;throw Hp(new g5("New Collection violated the Collection spec"))}function ZIn(n){var t,e,i;return n<0?0:0==n?32:(e=16-(t=(i=-(n>>16))>>16&16),e+=t=(i=(n>>=t)-256)>>16&8,e+=t=(i=(n<<=t)-_Qn)>>16&4,(e+=t=(i=(n<<=t)-hVn)>>16&2)+2-(t=(i=(n<<=t)>>14)&~(i>>1)))}function nOn(n){var t,e,i,r;for(MQ(),Sct=new Np,Mct=new xp,Tct=new Np,!n.a&&(n.a=new eU(UOt,n,10,11)),xUn(t=n.a),r=new AL(t);r.e!=r.i.gc();)i=BB(kpn(r),33),-1==E7(Sct,i,0)&&(e=new Np,WB(Tct,e),Rgn(i,e));return Tct}function tOn(n,t,e){var i,r,c,a;n.a=e.b.d,cL(t,352)?(e5(c=qSn(r=cDn(BB(t,79),!1,!1)),i=new Nw(n)),VFn(c,r),null!=t.We((sWn(),OSt))&&e5(BB(t.We(OSt),74),i)):((a=BB(t,470)).Hg(a.Dg()+n.a.a),a.Ig(a.Eg()+n.a.b))}function eOn(n,t){var i,r,c,a,u,o,s,h;for(h=Gy(MD(mMn(t,(HXn(),Npt)))),s=n[0].n.a+n[0].o.a+n[0].d.c+h,o=1;o<n.length;o++)r=n[o].n,c=n[o].o,i=n[o].d,(a=r.a-i.b-s)<0&&(r.a-=a),(u=t.f).a=e.Math.max(u.a,r.a+c.a),s=r.a+c.a+i.c+h}function iOn(n,t){var e,i,r,c,a,u;return i=BB(BB(RX(n.g,t.a),46).a,65),r=BB(BB(RX(n.g,t.b),46).a,65),(e=nqn(c=i.b,a=r.b))>=0?e:(u=lW(XR(new xC(a.c+a.b/2,a.d+a.a/2),new xC(c.c+c.b/2,c.d+c.a/2))),-(Y_n(c,a)-1)*u)}function rOn(n,t,e){var i;JT(new Rq(null,(!e.a&&(e.a=new eU(FOt,e,6,6)),new w1(e.a,16))),new eI(n,t)),JT(new Rq(null,(!e.n&&(e.n=new eU(zOt,e,1,7)),new w1(e.n,16))),new iI(n,t)),(i=BB(ZAn(e,(sWn(),OSt)),74))&&Yrn(i,n,t)}function cOn(n,t,e){var i,r,c;if(c=Fqn((IPn(),Z$t),n.Tg(),t))return ZM(),BB(c,66).Oj()||(c=Z1(B7(Z$t,c))),r=BB((i=n.Yg(c))>=0?n._g(i,!0,!0):cOn(n,c,!0),153),BB(r,215).hl(t,e);throw Hp(new _y(r6n+t.ne()+u6n))}function aOn(n,t,e,i){var r,c,a,u,o;if(r=n.d[t])if(c=r.g,o=r.i,null!=i){for(u=0;u<o;++u)if((a=BB(c[u],133)).Sh()==e&&Nfn(i,a.cd()))return a}else for(u=0;u<o;++u)if(GI((a=BB(c[u],133)).cd())===GI(i))return a;return null}function uOn(n,t){var e;if(t<0)throw Hp(new Oy("Negative exponent"));if(0==t)return Jtt;if(1==t||swn(n,Jtt)||swn(n,eet))return n;if(!fAn(n,0)){for(e=1;!fAn(n,e);)++e;return Nnn(vwn(e*t),uOn(z5(n,e),t))}return mTn(n,t)}function oOn(n,t){var e,i,r;if(GI(n)===GI(t))return!0;if(null==n||null==t)return!1;if(n.length!=t.length)return!1;for(e=0;e<n.length;++e)if(i=n[e],r=t[e],!(GI(i)===GI(r)||null!=i&&Nfn(i,r)))return!1;return!0}function sOn(n){var t,e,i;for(kM(),this.b=Vat,this.c=(Ffn(),BPt),this.f=(yM(),zat),this.a=n,tj(this,new Ct),kNn(this),i=new Wb(n.b);i.a<i.c.c.length;)(e=BB(n0(i),81)).d||(t=new Pgn(Pun(Gk(Qat,1),HWn,81,0,[e])),WB(n.a,t))}function hOn(n,t,e){var i,r,c,a,u,o;if(!n||0==n.c.length)return null;for(c=new KY(t,!e),r=new Wb(n);r.a<r.c.c.length;)i=BB(n0(r),70),USn(c,(gM(),new Bw(i)));return(a=c.i).a=(o=c.n,c.e.b+o.d+o.a),a.b=(u=c.n,c.e.a+u.b+u.c),c}function fOn(n){var t,e,i,r,c,a,u;for(hA(u=n2(n.a),new Pe),e=null,c=0,a=(r=u).length;c<a&&(i=r[c]).k==(uSn(),Mut);++c)(t=BB(mMn(i,(hWn(),Qft)),61))!=(kUn(),CIt)&&t!=oIt||(e&&BB(mMn(e,clt),15).Fc(i),e=i)}function lOn(n,t,e){var i,r,c,a,u,o;l1(t,n.c.length),u=BB(n.c[t],329),s6(n,t),u.b/2>=e&&(i=t,c=(o=(u.c+u.a)/2)-e,u.c<=o-e&&kG(n,i++,new kB(u.c,c)),(a=o+e)<=u.a&&(r=new kB(a,u.a),LZ(i,n.c.length),MS(n.c,i,r)))}function bOn(n){var t;if(n.c||null!=n.g){if(null==n.g)return!0;if(0==n.i)return!1;t=BB(n.g[n.i-1],47)}else n.d=n.si(n.f),f9(n,n.d),t=n.d;return t==n.b&&null.km>=null.jm()?(aLn(n),bOn(n)):t.Ob()}function wOn(n,t,e){var i,r,c,a;if(!(a=e)&&(a=LH(new Xm,0)),OTn(a,qZn,1),$Gn(n.c,t),1==(c=RGn(n.a,t)).gc())VHn(BB(c.Xb(0),37),a);else for(r=1/c.gc(),i=c.Kc();i.Ob();)VHn(BB(i.Pb(),37),mcn(a,r));Ek(n.a,c,t),FDn(t),HSn(a)}function dOn(n){if(this.a=n,n.c.i.k==(uSn(),Mut))this.c=n.c,this.d=BB(mMn(n.c.i,(hWn(),Qft)),61);else{if(n.d.i.k!=Mut)throw Hp(new _y("Edge "+n+" is not an external edge."));this.c=n.d,this.d=BB(mMn(n.d.i,(hWn(),Qft)),61)}}function gOn(n,t){var e,i,r;r=n.b,n.b=t,0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,r,n.b)),t?t!=n&&(Nrn(n,t.zb),$en(n,t.d),Fin(n,null==(e=null==(i=t.c)?t.zb:i)||mK(e,t.zb)?null:e)):(Nrn(n,null),$en(n,0),Fin(n,null))}function pOn(n){var t,e;if(n.f){for(;n.n<n.o;){if(cL(e=(t=BB(n.j?n.j.pi(n.n):n.k.Xb(n.n),72)).ak(),99)&&0!=(BB(e,18).Bb&h6n)&&(!n.e||e.Gj()!=NOt||0!=e.aj())&&null!=t.dd())return!0;++n.n}return!1}return n.n<n.o}function vOn(n,t){var e;this.e=(WX(),yX(n),WX(),Nwn(n)),this.c=(yX(t),Nwn(t)),aN(this.e.Hd().dc()==this.c.Hd().dc()),this.d=vbn(this.e),this.b=vbn(this.c),e=kq(Ant,[sVn,HWn],[5,1],5,[this.e.Hd().gc(),this.c.Hd().gc()],2),this.a=e,din(this)}function mOn(n){var t=(!Znt&&(Znt=QUn()),Znt);return'"'+n.replace(/[\x00-\x1f\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200b-\u200f\u2028-\u202e\u2060-\u2064\u206a-\u206f\ufeff\ufff9-\ufffb"\\]/g,(function(n){return IJ(n,t)}))+'"'}function yOn(n){var t,e;for(CQ(),this.b=hit,this.c=lit,this.g=(pM(),sit),this.d=(Ffn(),BPt),this.a=n,yNn(this),e=new Wb(n.b);e.a<e.c.c.length;)!(t=BB(n0(e),57)).a&&IN(Xen(new Xv,Pun(Gk(bit,1),HWn,57,0,[t])),n),t.e=new gY(t.d)}function kOn(n){var t,e,i,r,c;for(r=n.e.c.length,i=x8(Rnt,nZn,15,r,0,1),c=new Wb(n.e);c.a<c.c.c.length;)i[BB(n0(c),144).b]=new YT;for(e=new Wb(n.c);e.a<e.c.c.length;)i[(t=BB(n0(e),282)).c.b].Fc(t),i[t.d.b].Fc(t);return i}function jOn(n){var t,e,i,r,c,a;for(a=sx(n.c.length),r=new Wb(n);r.a<r.c.c.length;){for(i=BB(n0(r),10),c=new Rv,e=new oz(ZL(lbn(i).a.Kc(),new h));dAn(e);)(t=BB(U5(e),17)).c.i==t.d.i||TU(c,t.d.i);a.c[a.c.length]=c}return a}function EOn(n,t){var e,i,r,c,a;if(t>=(a=null==(e=BB(yan(n.a,4),126))?0:e.length))throw Hp(new tK(t,a));return r=e[t],1==a?i=null:(aHn(e,0,i=x8(dAt,i9n,415,a-1,0,1),0,t),(c=a-t-1)>0&&aHn(e,t+1,i,t,c)),Fgn(n,i),eCn(n,t,r),r}function TOn(){TOn=O,lLt=BB(Wtn(QQ((cE(),gLt).qb),6),34),sLt=BB(Wtn(QQ(gLt.qb),3),34),hLt=BB(Wtn(QQ(gLt.qb),4),34),fLt=BB(Wtn(QQ(gLt.qb),5),18),oEn(lLt),oEn(sLt),oEn(hLt),oEn(fLt),bLt=new Jy(Pun(Gk(FAt,1),N9n,170,0,[lLt,sLt]))}function MOn(n,t){var e;this.d=new lm,this.b=t,this.e=new wA(t.qf()),e=n.u.Hc((lIn(),iIt)),n.u.Hc(eIt)?n.D?this.a=e&&!t.If():this.a=!0:n.u.Hc(rIt)?this.a=!!e&&!(t.zf().Kc().Ob()||t.Bf().Kc().Ob()):this.a=!1}function SOn(n,t){var e,i,r,c;for(e=n.o.a,c=BB(BB(h6(n.r,t),21),84).Kc();c.Ob();)(r=BB(c.Pb(),111)).e.a=(i=r.b).Xe((sWn(),aPt))?i.Hf()==(kUn(),CIt)?-i.rf().a-Gy(MD(i.We(aPt))):e+Gy(MD(i.We(aPt))):i.Hf()==(kUn(),CIt)?-i.rf().a:e}function POn(n,t){var e,i,r;e=BB(mMn(n,(HXn(),Udt)),103),r=BB(ZAn(t,upt),61),(i=BB(mMn(n,ept),98))!=(QEn(),QCt)&&i!=YCt?r==(kUn(),PIt)&&(r=OFn(t,e))==PIt&&(r=hwn(e)):r=XHn(t)>0?hwn(e):Tln(hwn(e)),Ypn(t,upt,r)}function COn(n,t){var e,i,r,c,a;for(a=n.j,t.a!=t.b&&m$(a,new Ur),r=a.c.length/2|0,i=0;i<r;i++)l1(i,a.c.length),(c=BB(a.c[i],113)).c&&qCn(c.d,t.a);for(e=r;e<a.c.length;e++)l1(e,a.c.length),(c=BB(a.c[e],113)).c&&qCn(c.d,t.b)}function IOn(n,t,e){var i,r,c;return i=n.c[t.c.p][t.p],r=n.c[e.c.p][e.p],null!=i.a&&null!=r.a?((c=Tz(i.a,r.a))<0?uKn(n,t,e):c>0&&uKn(n,e,t),c):null!=i.a?(uKn(n,t,e),-1):null!=r.a?(uKn(n,e,t),1):0}function OOn(n,t){var e,i,r,c;n.ej()?(e=n.Vi(),c=n.fj(),++n.j,n.Hi(e,n.oi(e,t)),i=n.Zi(3,null,t,e,c),n.bj()&&(r=n.cj(t,null))?(r.Ei(i),r.Fi()):n.$i(i)):(eW(n,t),n.bj()&&(r=n.cj(t,null))&&r.Fi())}function AOn(n,t){var e,i,r,c,a;for(a=axn(n.e.Tg(),t),r=new go,e=BB(n.g,119),c=n.i;--c>=0;)i=e[c],a.rl(i.ak())&&f9(r,i);!aXn(n,r)&&mA(n.e)&&Lv(n,t.$j()?LY(n,6,t,(SQ(),set),null,-1,!1):LY(n,t.Kj()?2:1,t,null,null,-1,!1))}function $On(){var n,t;for($On=O,aet=x8(oet,sVn,91,32,0,1),uet=x8(oet,sVn,91,32,0,1),n=1,t=0;t<=18;t++)aet[t]=npn(n),uet[t]=npn(yz(n,t)),n=cbn(n,5);for(;t<uet.length;t++)aet[t]=Nnn(aet[t-1],aet[1]),uet[t]=Nnn(uet[t-1],(ODn(),net))}function LOn(n,t){var e,i,r,c;return n.a==(JMn(),cft)||(r=t.a.c,e=t.a.c+t.a.b,!(t.j&&(c=(i=t.A).c.c.a-i.o.a/2,r-(i.n.a+i.o.a)>c)||t.q&&(c=(i=t.C).c.c.a-i.o.a/2,i.n.a-e>c)))}function NOn(n,t){OTn(t,"Partition preprocessing",1),JT(BB(P4(AV(wnn(AV(new Rq(null,new w1(n.a,16)),new vi),new mi),new yi),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15).Oc(),new ki),HSn(t)}function xOn(n){var t,e,i,r,c,a;for(qZ(),e=new v4,i=new Wb(n.e.b);i.a<i.c.c.length;)for(c=new Wb(BB(n0(i),29).a);c.a<c.c.c.length;)r=BB(n0(c),10),(t=BB(lnn(e,a=n.g[r.p]),15))||Jgn(e,a,t=new Np),t.Fc(r);return e}function DOn(n,t){var e,i,r,c,a;for(r=t.b.b,n.a=x8(Rnt,nZn,15,r,0,1),n.b=x8($Nt,ZYn,25,r,16,1),a=spn(t.b,0);a.b!=a.d.c;)c=BB(b3(a),86),n.a[c.g]=new YT;for(i=spn(t.a,0);i.b!=i.d.c;)e=BB(b3(i),188),n.a[e.b.g].Fc(e),n.a[e.c.g].Fc(e)}function ROn(n){var t;return 0!=(64&n.Db)?P$n(n):((t=new fN(P$n(n))).a+=" (startX: ",vE(t,n.j),t.a+=", startY: ",vE(t,n.k),t.a+=", endX: ",vE(t,n.b),t.a+=", endY: ",vE(t,n.c),t.a+=", identifier: ",cO(t,n.d),t.a+=")",t.a)}function KOn(n){var t;return 0!=(64&n.Db)?kfn(n):((t=new fN(kfn(n))).a+=" (ordered: ",yE(t,0!=(256&n.Bb)),t.a+=", unique: ",yE(t,0!=(512&n.Bb)),t.a+=", lowerBound: ",mE(t,n.s),t.a+=", upperBound: ",mE(t,n.t),t.a+=")",t.a)}function _On(n,t,e,i,r,c,a,u){var o;return cL(n.Cb,88)&&ACn(P5(BB(n.Cb,88)),4),Nrn(n,e),n.f=i,$ln(n,r),Nln(n,c),Aln(n,a),Lln(n,!1),nln(n,!0),qln(n,u),Yfn(n,!0),Len(n,0),n.b=0,Nen(n,1),(o=HTn(n,t,null))&&o.Fi(),Gln(n,!1),n}function FOn(n,t){var i,r;return BB(SJ(n.a,t),512)||(i=new y5(t),k5(),xK(i,FOn(n,fx(r=Qet?null:i.c,0,e.Math.max(0,mN(r,YTn(46)))))),0==(Qet?null:i.c).length&&zD(i,new X),mZ(n.a,Qet?null:i.c,i),i)}function BOn(n,t){var e;n.b=t,n.g=new Np,e=JOn(n.b),n.e=e,n.f=e,n.c=qy(TD(mMn(n.b,(_kn(),jit)))),n.a=MD(mMn(n.b,(sWn(),cSt))),null==n.a&&(n.a=1),Gy(n.a)>1?n.e*=Gy(n.a):n.f/=Gy(n.a),Chn(n),ggn(n),TRn(n),hon(n.b,(Epn(),gct),n.g)}function HOn(n,t,e){var i,r,c,a,u;for(i=0,u=e,t||(i=e*(n.c.length-1),u*=-1),c=new Wb(n);c.a<c.c.c.length;){for(hon(r=BB(n0(c),10),(HXn(),kdt),(wvn(),OMt)),r.o.a=i,a=DSn(r,(kUn(),oIt)).Kc();a.Ob();)BB(a.Pb(),11).n.a=i;i+=u}}function qOn(n,t,e){var i,r,c;n.ej()?(c=n.fj(),Ifn(n,t,e),i=n.Zi(3,null,e,t,c),n.bj()?(r=n.cj(e,null),n.ij()&&(r=n.jj(e,r)),r?(r.Ei(i),r.Fi()):n.$i(i)):n.$i(i)):(Ifn(n,t,e),n.bj()&&(r=n.cj(e,null))&&r.Fi())}function GOn(n,t,e){var i,r,c,a,u,o;return(u=n.Gk(e))!=e?(a=n.g[t],o=u,jL(n,t,n.oi(t,o)),c=a,n.gi(t,o,c),n.rk()&&(i=e,r=n.dj(i,null),!BB(u,49).eh()&&(r=n.cj(o,r)),r&&r.Fi()),mA(n.e)&&Lv(n,n.Zi(9,e,u,t,!1)),u):e}function zOn(n,t){var e,i,r;for(e=new Wb(n.a.a);e.a<e.c.c.length;)BB(n0(e),189).g=!0;for(r=new Wb(n.a.b);r.a<r.c.c.length;)(i=BB(n0(r),81)).k=qy(TD(n.e.Kb(new rI(i,t)))),i.d.g=i.d.g&qy(TD(n.e.Kb(new rI(i,t))));return n}function UOn(n){var t,e,i,r,c;if(e=new YK(t=BB(Vj(FIt),9),BB(SR(t,t.length),9),0),c=BB(mMn(n,(hWn(),Elt)),10))for(r=new Wb(c.j);r.a<r.c.c.length;)GI(mMn(i=BB(n0(r),11),dlt))===GI(n)&&zN(new m6(i.b))&&orn(e,i.j);return e}function XOn(n,t,e){var i,r,c,a;if(!n.d[e.p]){for(i=new oz(ZL(lbn(e).a.Kc(),new h));dAn(i);){for(c=new oz(ZL(fbn(a=BB(U5(i),17).d.i).a.Kc(),new h));dAn(c);)(r=BB(U5(c),17)).c.i==t&&(n.a[r.p]=!0);XOn(n,t,a)}n.d[e.p]=!0}}function WOn(n,t){var e,i,r,c,a,u,o;if(1==(i=pbn(254&n.Db)))n.Eb=null;else if(c=een(n.Eb),2==i)r=Rmn(n,t),n.Eb=c[0==r?1:0];else{for(a=x8(Ant,HWn,1,i-1,5,1),e=2,u=0,o=0;e<=128;e<<=1)e==t?++u:0!=(n.Db&e)&&(a[o++]=c[u++]);n.Eb=a}n.Db&=~t}function VOn(n,t){var e,i,r,c,a;for(!t.s&&(t.s=new eU(FAt,t,21,17)),c=null,r=0,a=(i=t.s).i;r<a;++r)switch(DW(B7(n,e=BB(Wtn(i,r),170)))){case 4:case 5:case 6:!c&&(c=new Np),c.c[c.c.length]=e}return c||(SQ(),SQ(),set)}function QOn(n){var t;switch(t=0,n){case 105:t=2;break;case 109:t=8;break;case 115:t=4;break;case 120:t=16;break;case 117:t=32;break;case 119:t=64;break;case 70:t=256;break;case 72:t=128;break;case 88:t=512;break;case 44:t=k6n}return t}function YOn(n,t,e,i,r){var c,a,u,o;if(GI(n)!==GI(t)||i!=r)for(u=0;u<i;u++){for(a=0,c=n[u],o=0;o<r;o++)a=rbn(rbn(cbn(e0(c,UQn),e0(t[o],UQn)),e0(e[u+o],UQn)),e0(dG(a),UQn)),e[u+o]=dG(a),a=jz(a,32);e[u+r]=dG(a)}else I_n(n,i,e)}function JOn(n){var t,i,r,c,a,u,o,s,h,f,l;for(f=0,h=0,o=(c=n.a).a.gc(),r=c.a.ec().Kc();r.Ob();)(i=BB(r.Pb(),561)).b&&VBn(i),f+=(l=(t=i.a).a)+(u=t.b),h+=l*u;return s=e.Math.sqrt(400*o*h-4*h+f*f)+f,0==(a=2*(100*o-1))?s:s/a}function ZOn(n,t){0!=t.b&&(isNaN(n.s)?n.s=Gy((Px(0!=t.b),MD(t.a.a.c))):n.s=e.Math.min(n.s,Gy((Px(0!=t.b),MD(t.a.a.c)))),isNaN(n.c)?n.c=Gy((Px(0!=t.b),MD(t.c.b.c))):n.c=e.Math.max(n.c,Gy((Px(0!=t.b),MD(t.c.b.c)))))}function nAn(n){var t,e,i;for(t=null,e=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c)])));dAn(e);)if(i=PTn(BB(U5(e),82)),t){if(t!=JJ(i))return!0}else t=JJ(i);return!1}function tAn(n,t){var e,i,r,c;n.ej()?(e=n.i,c=n.fj(),c6(n,t),i=n.Zi(3,null,t,e,c),n.bj()?(r=n.cj(t,null),n.ij()&&(r=n.jj(t,r)),r?(r.Ei(i),r.Fi()):n.$i(i)):n.$i(i)):(c6(n,t),n.bj()&&(r=n.cj(t,null))&&r.Fi())}function eAn(n,t,e){var i,r,c;n.ej()?(c=n.fj(),++n.j,n.Hi(t,n.oi(t,e)),i=n.Zi(3,null,e,t,c),n.bj()&&(r=n.cj(e,null))?(r.Ei(i),r.Fi()):n.$i(i)):(++n.j,n.Hi(t,n.oi(t,e)),n.bj()&&(r=n.cj(e,null))&&r.Fi())}function iAn(n){var t,e,i,r;for(r=n.length,t=null,i=0;i<r;i++)b1(i,n.length),GO(".*+?{[()|\\^$",YTn(e=n.charCodeAt(i)))>=0?(t||(t=new Pk,i>0&&cO(t,n.substr(0,i))),t.a+="\\",NX(t,e&QVn)):t&&NX(t,e&QVn);return t?t.a:n}function rAn(n){var t;if(!n.a)throw Hp(new Fy("IDataType class expected for layout option "+n.f));if(null==(t=I3(n.a)))throw Hp(new Fy("Couldn't create new instance of property '"+n.f+"'. "+r5n+(ED(bAt),bAt.k)+c5n));return BB(t,414)}function cAn(n){var t,e,i,r,c;return(c=n.eh())&&c.kh()&&(r=tfn(n,c))!=c?(e=n.Vg(),i=(t=n.Vg())>=0?n.Qg(null):n.eh().ih(n,-1-t,null,null),n.Rg(BB(r,49),e),i&&i.Fi(),n.Lg()&&n.Mg()&&e>-1&&ban(n,new nU(n,9,e,c,r)),r):c}function aAn(n){var t,e,i,r,c,a,u;for(c=0,r=n.f.e,e=0;e<r.c.length;++e)for(l1(e,r.c.length),a=BB(r.c[e],144),i=e+1;i<r.c.length;++i)l1(i,r.c.length),u=BB(r.c[i],144),t=W8(a.d,u.d)-n.a[a.b][u.b],c+=n.i[a.b][u.b]*t*t;return c}function uAn(n,t){var e;if(!Lx(t,(HXn(),kgt))&&(e=Ekn(BB(mMn(t,est),360),BB(mMn(n,kgt),163)),hon(t,est,e),!dAn(new oz(ZL(hbn(t).a.Kc(),new h)))))switch(e.g){case 1:hon(t,kgt,(Tbn(),_lt));break;case 2:hon(t,kgt,(Tbn(),Blt))}}function oAn(n,t){var e;mRn(n),n.a=(e=new ok,JT(new Rq(null,new w1(t.d,16)),new Od(e)),e),Mxn(n,BB(mMn(t.b,(HXn(),igt)),376)),kvn(n),OAn(n),$kn(n),jvn(n),jqn(n,t),JT(wnn(new Rq(null,Y0(SX(n.b).a)),new Wr),new Vr),t.a=!1,n.a=null}function sAn(){dMn.call(this,y6n,(tE(),dOt)),this.p=null,this.a=null,this.f=null,this.n=null,this.g=null,this.c=null,this.i=null,this.j=null,this.d=null,this.b=null,this.e=null,this.k=null,this.o=null,this.s=null,this.q=!1,this.r=!1}function hAn(){hAn=O,iAt=new MI(G1n,0),nAt=new MI("INSIDE_SELF_LOOPS",1),tAt=new MI("MULTI_EDGES",2),ZOt=new MI("EDGE_LABELS",3),eAt=new MI("PORTS",4),YOt=new MI("COMPOUND",5),QOt=new MI("CLUSTERS",6),JOt=new MI("DISCONNECTED",7)}function fAn(n,t){var e,i,r;if(0==t)return 0!=(1&n.a[0]);if(t<0)throw Hp(new Oy("Negative bit address"));if((r=t>>5)>=n.d)return n.e<0;if(e=n.a[r],t=1<<(31&t),n.e<0){if(r<(i=Ccn(n)))return!1;e=i==r?-e:~e}return 0!=(e&t)}function lAn(n,t,e,i){var r;BB(e.b,65),BB(e.b,65),BB(i.b,65),BB(i.b,65),NH(r=XR(B$(BB(e.b,65).c),BB(i.b,65).c),HCn(BB(e.b,65),BB(i.b,65),r)),BB(i.b,65),BB(i.b,65),BB(i.b,65).c.a,r.a,BB(i.b,65).c.b,r.b,BB(i.b,65),Otn(i.a,new TB(n,t,i))}function bAn(n,t){var e,i,r,c,a,u,o;if(c=t.e)for(e=cAn(c),i=BB(n.g,674),a=0;a<n.i;++a)if(qvn(o=i[a])==e&&(!o.d&&(o.d=new $L(VAt,o,1)),r=o.d,(u=BB(e.ah(gKn(c,c.Cb,c.Db>>16)),15).Xc(c))<r.i))return bAn(n,BB(Wtn(r,u),87));return t}function wAn(n,t,e){var i,r=SWn,c=r[n],a=c instanceof Array?c[0]:null;c&&!a?MWn=c:(!(i=t&&t.prototype)&&(i=SWn[t]),(MWn=qJ(i)).hm=e,!t&&(MWn.im=I),r[n]=MWn);for(var u=3;u<arguments.length;++u)arguments[u].prototype=MWn;a&&(MWn.gm=a)}function dAn(n){for(var t;!BB(yX(n.a),47).Ob();){if(n.d=osn(n),!n.d)return!1;if(n.a=BB(n.d.Pb(),47),cL(n.a,39)){if(t=BB(n.a,39),n.a=t.a,!n.b&&(n.b=new Lp),d3(n.b,n.d),t.b)for(;!Wy(t.b);)d3(n.b,BB(gU(t.b),47));n.d=t.d}}return!0}function gAn(n,t){var e,i,r,c,a;for(c=null==t?0:n.b.se(t),i=null==(e=n.a.get(c))?new Array:e,a=0;a<i.length;a++)if(r=i[a],n.b.re(t,r.cd()))return 1==i.length?(i.length=0,vR(n.a,c)):i.splice(a,1),--n.c,oY(n.b),r.dd();return null}function pAn(n,t){var e,i,r,c;for(r=1,t.j=!0,c=null,i=new Wb(kbn(t));i.a<i.c.c.length;)e=BB(n0(i),213),n.c[e.c]||(n.c[e.c]=!0,c=Nbn(e,t),e.f?r+=pAn(n,c):c.j||e.a!=e.e.e-e.d.e||(e.f=!0,TU(n.p,e),r+=pAn(n,c)));return r}function vAn(n){var t,i,r;for(i=new Wb(n.a.a.b);i.a<i.c.c.length;)t=BB(n0(i),81),kW(0),(r=0)>0&&((!dA(n.a.c)||!t.n.d)&&(!gA(n.a.c)||!t.n.b)&&(t.g.d+=e.Math.max(0,r/2-.5)),(!dA(n.a.c)||!t.n.a)&&(!gA(n.a.c)||!t.n.c)&&(t.g.a-=r-1))}function mAn(n){var t,i,r,c,a;if(a=K_n(n,c=new Np),t=BB(mMn(n,(hWn(),Elt)),10))for(r=new Wb(t.j);r.a<r.c.c.length;)GI(mMn(i=BB(n0(r),11),dlt))===GI(n)&&(a=e.Math.max(a,K_n(i,c)));return 0==c.c.length||hon(n,blt,a),-1!=a?c:null}function yAn(n,t,e){var i,r,c,a,u,o;r=(i=(c=BB(xq(t.e,0),17).c).i).k,u=(a=(o=BB(xq(e.g,0),17).d).i).k,r==(uSn(),Put)?hon(n,(hWn(),hlt),BB(mMn(i,hlt),11)):hon(n,(hWn(),hlt),c),hon(n,(hWn(),flt),u==Put?BB(mMn(a,flt),11):o)}function kAn(n,t){var e,i,r,c;for(e=(c=dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15))))&n.b.length-1,r=null,i=n.b[e];i;r=i,i=i.a)if(i.d==c&&wW(i.i,t))return r?r.a=i.a:n.b[e]=i.a,kk(i.c,i.f),iv(i.b,i.e),--n.f,++n.e,!0;return!1}function jAn(n,t){var e,i,r,c,a;return t&=63,(i=0!=((e=n.h)&CQn))&&(e|=-1048576),t<22?(a=e>>t,c=n.m>>t|e<<22-t,r=n.l>>t|n.m<<22-t):t<44?(a=i?PQn:0,c=e>>t-22,r=n.m>>t-22|e<<44-t):(a=i?PQn:0,c=i?SQn:0,r=e>>t-44),M$(r&SQn,c&SQn,a&PQn)}function EAn(n){var t,i,r,c,a,u;for(this.c=new Np,this.d=n,r=RQn,c=RQn,t=KQn,i=KQn,u=spn(n,0);u.b!=u.d.c;)a=BB(b3(u),8),r=e.Math.min(r,a.a),c=e.Math.min(c,a.b),t=e.Math.max(t,a.a),i=e.Math.max(i,a.b);this.a=new UV(r,c,t-r,i-c)}function TAn(n,t){var e,i,r,c;for(i=new Wb(n.b);i.a<i.c.c.length;)for(c=new Wb(BB(n0(i),29).a);c.a<c.c.c.length;)for((r=BB(n0(c),10)).k==(uSn(),Sut)&&hFn(r,t),e=new oz(ZL(lbn(r).a.Kc(),new h));dAn(e);)vun(BB(U5(e),17),t)}function MAn(n){var t,e,i;this.c=n,i=BB(mMn(n,(HXn(),Udt)),103),t=Gy(MD(mMn(n,Edt))),e=Gy(MD(mMn(n,Kpt))),i==(Ffn(),_Pt)||i==FPt||i==BPt?this.b=t*e:this.b=1/(t*e),this.j=Gy(MD(mMn(n,Apt))),this.e=Gy(MD(mMn(n,Opt))),this.f=n.b.c.length}function SAn(n){var t,e;for(n.e=x8(ANt,hQn,25,n.p.c.length,15,1),n.k=x8(ANt,hQn,25,n.p.c.length,15,1),e=new Wb(n.p);e.a<e.c.c.length;)t=BB(n0(e),10),n.e[t.p]=F3(new oz(ZL(fbn(t).a.Kc(),new h))),n.k[t.p]=F3(new oz(ZL(lbn(t).a.Kc(),new h)))}function PAn(n){var t,e,i,r,c;for(i=0,n.q=new Np,t=new Rv,c=new Wb(n.p);c.a<c.c.c.length;){for((r=BB(n0(c),10)).p=i,e=new oz(ZL(lbn(r).a.Kc(),new h));dAn(e);)TU(t,BB(U5(e),17).d.i);t.a.Bc(r),WB(n.q,new $q(t)),t.a.$b(),++i}}function CAn(){CAn=O,Okt=new WA(20),Ikt=new XA((sWn(),XSt),Okt),xkt=new XA(LPt,20),jkt=new XA(cSt,dZn),$kt=new XA(pPt,iln(1)),Nkt=new XA(kPt,(hN(),!0)),Ekt=lSt,Mkt=KSt,Skt=BSt,Pkt=qSt,Tkt=DSt,Ckt=USt,Akt=fPt,Ran(),Dkt=ykt,Lkt=vkt}function IAn(n,t){var e,i,r,c,a,u,o,s,h;if(n.a.f>0&&cL(t,42)&&(n.a.qj(),c=null==(o=(s=BB(t,42)).cd())?0:nsn(o),a=eR(n.a,c),e=n.a.d[a]))for(i=BB(e.g,367),h=e.i,u=0;u<h;++u)if((r=i[u]).Sh()==c&&r.Fb(s))return IAn(n,s),!0;return!1}function OAn(n){var t,e,i,r;for(r=BB(h6(n.a,(LEn(),Sst)),15).Kc();r.Ob();)iX(n,i=BB(r.Pb(),101),(e=(t=gz(i.k)).Hc((kUn(),sIt))?t.Hc(oIt)?t.Hc(SIt)?t.Hc(CIt)?null:$st:Nst:Lst:Ast)[0],(Crn(),xst),0),iX(n,i,e[1],Dst,1),iX(n,i,e[2],Rst,1)}function AAn(n,t){var e,i;Jxn(n,t,e=mKn(t)),iTn(n.a,BB(mMn(vW(t.b),(hWn(),Slt)),230)),b_n(n),DEn(n,t),i=x8(ANt,hQn,25,t.b.j.c.length,15,1),szn(n,t,(kUn(),sIt),i,e),szn(n,t,oIt,i,e),szn(n,t,SIt,i,e),szn(n,t,CIt,i,e),n.a=null,n.c=null,n.b=null}function $An(){$An=O,Sbn(),oEt=new $O(E4n,sEt=nEt),aEt=new $O(T4n,(hN(),!0)),iln(-1),iEt=new $O(M4n,iln(-1)),iln(-1),rEt=new $O(S4n,iln(-1)),uEt=new $O(P4n,!1),hEt=new $O(C4n,!0),cEt=new $O(I4n,!1),fEt=new $O(O4n,-1)}function LAn(n,t,e){switch(t){case 7:return!n.e&&(n.e=new hK(_Ot,n,7,4)),sqn(n.e),!n.e&&(n.e=new hK(_Ot,n,7,4)),void pX(n.e,BB(e,14));case 8:return!n.d&&(n.d=new hK(_Ot,n,8,5)),sqn(n.d),!n.d&&(n.d=new hK(_Ot,n,8,5)),void pX(n.d,BB(e,14))}zjn(n,t,e)}function NAn(n,t){var e,i,r,c,a;if(GI(t)===GI(n))return!0;if(!cL(t,15))return!1;if(a=BB(t,15),n.gc()!=a.gc())return!1;for(c=a.Kc(),i=n.Kc();i.Ob();)if(e=i.Pb(),r=c.Pb(),!(GI(e)===GI(r)||null!=e&&Nfn(e,r)))return!1;return!0}function xAn(n,t){var e,i,r,c;for((c=BB(P4(wnn(wnn(new Rq(null,new w1(t.b,16)),new Re),new Ke),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15)).Jc(new _e),e=0,r=c.Kc();r.Ob();)-1==(i=BB(r.Pb(),11)).p&&FAn(n,i,e++)}function DAn(n){switch(n.g){case 0:return new Cf;case 1:return new lf;case 2:return new ff;case 3:return new jI;case 4:return new _G;default:throw Hp(new _y("No implementation is available for the node placer "+(null!=n.f?n.f:""+n.g)))}}function RAn(n){switch(n.g){case 0:return new KG;case 1:return new wf;case 2:return new rf;case 3:return new cf;case 4:return new TI;default:throw Hp(new _y("No implementation is available for the cycle breaker "+(null!=n.f?n.f:""+n.g)))}}function KAn(){KAn=O,mjt=new $O(u4n,iln(0)),yjt=new $O(o4n,0),Hsn(),djt=new $O(s4n,gjt=sjt),iln(0),wjt=new $O(h4n,iln(1)),Bcn(),kjt=new $O(f4n,jjt=Xjt),D9(),Ejt=new $O(l4n,Tjt=ajt),Omn(),pjt=new $O(b4n,vjt=qjt)}function _An(n,t,e){var i;i=null,t&&(i=t.d),Yjn(n,new dP(t.n.a-i.b+e.a,t.n.b-i.d+e.b)),Yjn(n,new dP(t.n.a-i.b+e.a,t.n.b+t.o.b+i.a+e.b)),Yjn(n,new dP(t.n.a+t.o.a+i.c+e.a,t.n.b-i.d+e.b)),Yjn(n,new dP(t.n.a+t.o.a+i.c+e.a,t.n.b+t.o.b+i.a+e.b))}function FAn(n,t,e){var i,r,c;for(t.p=e,c=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[new Hw(t),new Gw(t)])));dAn(c);)-1==(i=BB(U5(c),11)).p&&FAn(n,i,e);if(t.i.k==(uSn(),Put))for(r=new Wb(t.i.j);r.a<r.c.c.length;)(i=BB(n0(r),11))!=t&&-1==i.p&&FAn(n,i,e)}function BAn(n){var t,i,r,c,a;if(c=BB(P4($Z(a1(n)),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),r=ZJn,c.gc()>=2)for(t=MD((i=c.Kc()).Pb());i.Ob();)a=t,t=MD(i.Pb()),r=e.Math.min(r,(kW(t),t-(kW(a),a)));return r}function HAn(n,t){var e,i,r,c,a;r5(i=new YT,t,i.c.b,i.c);do{for(Px(0!=i.b),e=BB(Atn(i,i.a.a),86),n.b[e.g]=1,c=spn(e.d,0);c.b!=c.d.c;)a=(r=BB(b3(c),188)).c,1==n.b[a.g]?DH(n.a,r):2==n.b[a.g]?n.b[a.g]=1:r5(i,a,i.c.b,i.c)}while(0!=i.b)}function qAn(n,t){var e,i,r;if(GI(t)===GI(yX(n)))return!0;if(!cL(t,15))return!1;if(i=BB(t,15),(r=n.gc())!=i.gc())return!1;if(cL(i,54)){for(e=0;e<r;e++)if(!wW(n.Xb(e),i.Xb(e)))return!1;return!0}return Uvn(n.Kc(),i.Kc())}function GAn(n,t){var e;if(0!=n.c.length){if(2==n.c.length)hFn((l1(0,n.c.length),BB(n.c[0],10)),(Xyn(),jCt)),hFn((l1(1,n.c.length),BB(n.c[1],10)),ECt);else for(e=new Wb(n);e.a<e.c.c.length;)hFn(BB(n0(e),10),t);n.c=x8(Ant,HWn,1,0,5,1)}}function zAn(n){var t,e;if(2!=n.c.length)throw Hp(new Fy("Order only allowed for two paths."));l1(0,n.c.length),t=BB(n.c[0],17),l1(1,n.c.length),e=BB(n.c[1],17),t.d.i!=e.c.i&&(n.c=x8(Ant,HWn,1,0,5,1),n.c[n.c.length]=e,n.c[n.c.length]=t)}function UAn(n,t){var e,i,r,c,a;for(i=new v4,c=S4(new Jy(n.g)).a.ec().Kc();c.Ob();){if(!(r=BB(c.Pb(),10))){OH(t,"There are no classes in a balanced layout.");break}(e=BB(lnn(i,a=n.j[r.p]),15))||Jgn(i,a,e=new Np),e.Fc(r)}return i}function XAn(n,t,e){var i,r,c,a;if(e)for(r=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);r.Ob();)(c=x2(e,BB(r.Pb(),19).a))&&(a=Ken(R2(c,O6n),t),VW(n.f,a,c),q6n in c.a&&$in(a,R2(c,q6n)),STn(c,a),OCn(c,a))}function WAn(n,t){var e,i,r;for(OTn(t,"Port side processing",1),r=new Wb(n.a);r.a<r.c.c.length;)cBn(BB(n0(r),10));for(e=new Wb(n.b);e.a<e.c.c.length;)for(i=new Wb(BB(n0(e),29).a);i.a<i.c.c.length;)cBn(BB(n0(i),10));HSn(t)}function VAn(n,t,e){var i,r,c,a,u;if(!(r=n.f)&&(r=BB(n.a.a.ec().Kc().Pb(),57)),Fkn(r,t,e),1!=n.a.a.gc())for(i=t*e,a=n.a.a.ec().Kc();a.Ob();)(c=BB(a.Pb(),57))!=r&&((u=f3(c)).f.d?(c.d.d+=i+fJn,c.d.a-=i+fJn):u.f.a&&(c.d.a-=i+fJn))}function QAn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w;return u=i-n,o=r-t,s=(a=e.Math.atan2(u,o))+JJn,h=a-JJn,f=c*e.Math.sin(s)+n,b=c*e.Math.cos(s)+t,l=c*e.Math.sin(h)+n,w=c*e.Math.cos(h)+t,u6(Pun(Gk(PMt,1),sVn,8,0,[new xC(f,b),new xC(l,w)]))}function YAn(n,t,i,r){var c,a,u,o,s,h,f,l;c=i,a=f=t;do{a=n.a[a.p],l=n.g[a.p],o=Gy(n.p[l.p])+Gy(n.d[a.p])-a.d.d,(s=Ain(a,r))&&(h=n.g[s.p],u=Gy(n.p[h.p])+Gy(n.d[s.p])+s.o.b+s.d.a,c=e.Math.min(c,o-(u+K$(n.k,a,s))))}while(f!=a);return c}function JAn(n,t,i,r){var c,a,u,o,s,h,f,l;c=i,a=f=t;do{a=n.a[a.p],l=n.g[a.p],u=Gy(n.p[l.p])+Gy(n.d[a.p])+a.o.b+a.d.a,(s=_un(a,r))&&(h=n.g[s.p],o=Gy(n.p[h.p])+Gy(n.d[s.p])-s.d.d,c=e.Math.min(c,o-(u+K$(n.k,a,s))))}while(f!=a);return c}function ZAn(n,t){var e,i;return!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),null!=(i=cdn(n.o,t))?i:(cL(e=t.wg(),4)&&(null==e?(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),Wdn(n.o,t)):(!n.o&&(n.o=new y9((CXn(),MOt),rAt,n,0)),vjn(n.o,t,e))),e)}function n$n(){n$n=O,ICt=new GC("H_LEFT",0),CCt=new GC("H_CENTER",1),ACt=new GC("H_RIGHT",2),DCt=new GC("V_TOP",3),xCt=new GC("V_CENTER",4),NCt=new GC("V_BOTTOM",5),$Ct=new GC("INSIDE",6),LCt=new GC("OUTSIDE",7),OCt=new GC("H_PRIORITY",8)}function t$n(n){var t,e,i,r,c,a,u;if((t=n.Hh(V9n))&&null!=(u=SD(cdn((!t.b&&(t.b=new Jx((gWn(),k$t),X$t,t)),t.b),"settingDelegates")))){for(e=new Np,c=0,a=(r=kKn(u,"\\w+")).length;c<a;++c)i=r[c],e.c[e.c.length]=i;return e}return SQ(),SQ(),set}function e$n(n,t){var e,i,r,c,a,u,o;if(!t.f)throw Hp(new _y("The input edge is not a tree edge."));for(c=null,r=DWn,i=new Wb(n.d);i.a<i.c.c.length;)u=(e=BB(n0(i),213)).d,o=e.e,FCn(n,u,t)&&!FCn(n,o,t)&&(a=o.e-u.e-e.a)<r&&(r=a,c=e);return c}function i$n(n){var t,e,i,r,c,a;if(!(n.f.e.c.length<=1)){t=0,r=aAn(n),e=RQn;do{for(t>0&&(r=e),a=new Wb(n.f.e);a.a<a.c.c.length;)qy(TD(mMn(c=BB(n0(a),144),(rkn(),yat))))||(i=Z_n(n,c),UR(kO(c.d),i));e=aAn(n)}while(!JX(n,t++,r,e))}}function r$n(n,t){var e,i,r;for(OTn(t,"Layer constraint preprocessing",1),e=new Np,r=new M2(n.a,0);r.b<r.d.gc();)Px(r.b<r.d.gc()),Wun(i=BB(r.d.Xb(r.c=r.b++),10))&&(cTn(i),e.c[e.c.length]=i,fW(r));0==e.c.length||hon(n,(hWn(),nlt),e),HSn(t)}function c$n(n,t){var e,i,r,c,a;for(c=n.g.a,a=n.g.b,i=new Wb(n.d);i.a<i.c.c.length;)r=(e=BB(n0(i),70)).n,n.a==(Oun(),mst)||n.i==(kUn(),oIt)?r.a=c:n.a==yst||n.i==(kUn(),CIt)?r.a=c+n.j.a-e.o.a:r.a=c+(n.j.a-e.o.a)/2,r.b=a,UR(r,t),a+=e.o.b+n.e}function a$n(n,t,e){var i,r,c,a;for(OTn(e,"Processor set coordinates",1),n.a=0==t.b.b?1:t.b.b,c=null,i=spn(t.b,0);!c&&i.b!=i.d.c;)qy(TD(mMn(a=BB(b3(i),86),(qqn(),dkt))))&&(c=a,(r=a.e).a=BB(mMn(a,gkt),19).a,r.b=0);_Sn(n,xun(c),mcn(e,1)),HSn(e)}function u$n(n,t,e){var i,r,c;for(OTn(e,"Processor determine the height for each level",1),n.a=0==t.b.b?1:t.b.b,r=null,i=spn(t.b,0);!r&&i.b!=i.d.c;)qy(TD(mMn(c=BB(b3(i),86),(qqn(),dkt))))&&(r=c);r&&Zxn(n,u6(Pun(Gk(Yyt,1),tZn,86,0,[r])),e),HSn(e)}function o$n(n,t){var e,i,r,c,a;(c=D2(n,"individualSpacings"))&&(!P8(t,(sWn(),CPt))&&(e=new Yu,Ypn(t,CPt,e)),r=BB(ZAn(t,CPt),373),i=null,(a=c)&&(i=new TT(a,jrn(a,x8(Qtt,sVn,2,0,6,1)))),i&&e5(i,new dI(a,r)))}function s$n(n,t){var e,i,r,c,a,u;return c=null,(J6n in(a=n).a||Z6n in a.a||D6n in a.a)&&(u=qun(t),i=D2(a,J6n),Own(new Hg(u).a,i),r=D2(a,Z6n),Iwn(new Jg(u).a,r),e=N2(a,D6n),PEn(new tp(u).a,e),c=e),c}function h$n(n,t){var e,i,r;if(t===n)return!0;if(cL(t,543)){if(r=BB(t,835),n.a.d!=r.a.d||EV(n).gc()!=EV(r).gc())return!1;for(i=EV(r).Kc();i.Ob();)if(c1(n,(e=BB(i.Pb(),416)).a.cd())!=BB(e.a.dd(),14).gc())return!1;return!0}return!1}function f$n(n){var t,e,i,r;return t=i=BB(n.a,19).a,e=r=BB(n.b,19).a,0==i&&0==r?e-=1:-1==i&&r<=0?(t=0,e-=2):i<=0&&r>0?(t-=1,e-=1):i>=0&&r<0?(t+=1,e+=1):i>0&&r>=0?(t-=1,e+=1):(t+=1,e-=1),new rI(iln(t),iln(e))}function l$n(n,t){return n.c<t.c?-1:n.c>t.c?1:n.b<t.b?-1:n.b>t.b?1:n.a!=t.a?nsn(n.a)-nsn(t.a):n.d==(Q4(),Hmt)&&t.d==Bmt?-1:n.d==Bmt&&t.d==Hmt?1:0}function b$n(n,t){var e,i,r,c,a;return a=(c=t.a).c.i==t.b?c.d:c.c,i=c.c.i==t.b?c.c:c.d,(r=zwn(n.a,a,i))>0&&r<ZJn?(e=YAn(n.a,i.i,r,n.c),ren(n.a,i.i,-e),e>0):r<0&&-r<ZJn&&(e=JAn(n.a,i.i,-r,n.c),ren(n.a,i.i,e),e>0)}function w$n(n,t,e,i){var r,c,a,u,o,s;for(r=(t-n.d)/n.c.c.length,c=0,n.a+=e,n.d=t,s=new Wb(n.c);s.a<s.c.c.length;)u=(o=BB(n0(s),33)).g,a=o.f,Pen(o,o.i+c*r),Cen(o,o.j+i*e),Sen(o,o.g+r),Men(o,n.a),++c,lCn(o,new xC(o.g,o.f),new xC(u,a))}function d$n(n){var t,e,i,r,c,a,u;if(null==n)return null;for(u=n.length,a=x8(NNt,v6n,25,r=(u+1)/2|0,15,1),u%2!=0&&(a[--r]=ZDn((b1(u-1,n.length),n.charCodeAt(u-1)))),e=0,i=0;e<r;++e)t=ZDn(fV(n,i++)),c=ZDn(fV(n,i++)),a[e]=(t<<4|c)<<24>>24;return a}function g$n(n){if(n.pe()){var t=n.c;return t.qe()?n.o="["+t.n:t.pe()?n.o="["+t.ne():n.o="[L"+t.ne()+";",n.b=t.me()+"[]",void(n.k=t.oe()+"[]")}var e=n.j,i=n.d;i=i.split("/"),n.o=Fdn(".",[e,Fdn("$",i)]),n.b=Fdn(".",[e,Fdn(".",i)]),n.k=i[i.length-1]}function p$n(n,t){var e,i,r,c,a;for(a=null,c=new Wb(n.e.a);c.a<c.c.c.length;)if((r=BB(n0(c),121)).b.a.c.length==r.g.a.c.length){for(i=r.e,a=ePn(r),e=r.e-BB(a.a,19).a+1;e<r.e+BB(a.b,19).a;e++)t[e]<t[i]&&(i=e);t[i]<t[r.e]&&(--t[r.e],++t[i],r.e=i)}}function v$n(n){var t,i,r,c,a,u,o;for(r=RQn,i=KQn,t=new Wb(n.e.b);t.a<t.c.c.length;)for(a=new Wb(BB(n0(t),29).a);a.a<a.c.c.length;)c=BB(n0(a),10),u=(o=Gy(n.p[c.p]))+Gy(n.b[n.g[c.p].p]),r=e.Math.min(r,o),i=e.Math.max(i,u);return i-r}function m$n(n,t,e,i){var r,c,a,u,o,s;for(o=null,u=0,s=(r=jKn(n,t)).gc();u<s;++u)if(mK(i,kV(B7(n,c=BB(r.Xb(u),170)))))if(a=jV(B7(n,c)),null==e){if(null==a)return c;!o&&(o=c)}else{if(mK(e,a))return c;null==a&&!o&&(o=c)}return null}function y$n(n,t,e,i){var r,c,a,u,o,s;for(o=null,u=0,s=(r=EKn(n,t)).gc();u<s;++u)if(mK(i,kV(B7(n,c=BB(r.Xb(u),170)))))if(a=jV(B7(n,c)),null==e){if(null==a)return c;!o&&(o=c)}else{if(mK(e,a))return c;null==a&&!o&&(o=c)}return null}function k$n(n,t,e){var i,r,c,a,u,o;if(a=new go,u=axn(n.e.Tg(),t),i=BB(n.g,119),ZM(),BB(t,66).Oj())for(c=0;c<n.i;++c)r=i[c],u.rl(r.ak())&&f9(a,r);else for(c=0;c<n.i;++c)r=i[c],u.rl(r.ak())&&(o=r.dd(),f9(a,e?FIn(n,t,c,a.i,o):o));return N3(a)}function j$n(n,t){var e,i,r,c;for(e=new Hbn(uht),$Pn(),r=0,c=(i=Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])).length;r<c;++r)wR(e,i[r],new Np);return JT($V(AV(wnn(new Rq(null,new w1(n.b,16)),new Ze),new ni),new hd(t)),new fd(e)),e}function E$n(n,t,i){var r,c,a,u,o,s,h,f;for(a=t.Kc();a.Ob();)s=(c=BB(a.Pb(),33)).i+c.g/2,f=c.j+c.f/2,o=s-((u=n.f).i+u.g/2),h=f-(u.j+u.f/2),r=e.Math.sqrt(o*o+h*h),o*=n.e/r,h*=n.e/r,i?(s-=o,f-=h):(s+=o,f+=h),Pen(c,s-c.g/2),Cen(c,f-c.f/2)}function T$n(n){var t,e,i;if(!n.c&&null!=n.b){for(t=n.b.length-4;t>=0;t-=2)for(e=0;e<=t;e+=2)(n.b[e]>n.b[e+2]||n.b[e]===n.b[e+2]&&n.b[e+1]>n.b[e+3])&&(i=n.b[e+2],n.b[e+2]=n.b[e],n.b[e]=i,i=n.b[e+3],n.b[e+3]=n.b[e+1],n.b[e+1]=i);n.c=!0}}function M$n(n,t){var e,i,r,c,a,u;for(c=(1==t?Wat:Xat).a.ec().Kc();c.Ob();)for(r=BB(c.Pb(),103),u=BB(h6(n.f.c,r),21).Kc();u.Ob();)switch(a=BB(u.Pb(),46),i=BB(a.b,81),e=BB(a.a,189).c,r.g){case 2:case 1:i.g.d+=e;break;case 4:case 3:i.g.c+=e}}function S$n(n,t){var e,i,r,c,a,u,o,s,h;for(s=-1,h=0,u=0,o=(a=n).length;u<o;++u){for(c=a[u],e=new kH(-1==s?n[0]:n[s],t,(Mhn(),uvt)),i=0;i<c.length;i++)for(r=i+1;r<c.length;r++)Lx(c[i],(hWn(),wlt))&&Lx(c[r],wlt)&&fXn(e,c[i],c[r])>0&&++h;++s}return h}function P$n(n){var t;return(t=new lN(nE(n.gm))).a+="@",oO(t,(nsn(n)>>>0).toString(16)),n.kh()?(t.a+=" (eProxyURI: ",uO(t,n.qh()),n.$g()&&(t.a+=" eClass: ",uO(t,n.$g())),t.a+=")"):n.$g()&&(t.a+=" (eClass: ",uO(t,n.$g()),t.a+=")"),t.a}function C$n(n){var t,e,i;if(n.e)throw Hp(new Fy((ED(git),AYn+git.k+$Yn)));for(n.d==(Ffn(),BPt)&&Tzn(n,_Pt),e=new Wb(n.a.a);e.a<e.c.c.length;)(t=BB(n0(e),307)).g=t.i;for(i=new Wb(n.a.b);i.a<i.c.c.length;)BB(n0(i),57).i=KQn;return n.b.Le(n),n}function I$n(n,t){var e,i,r,c,a;if(t<2*n.b)throw Hp(new _y("The knot vector must have at least two time the dimension elements."));for(n.f=1,r=0;r<n.b;r++)WB(n.e,0);for(e=a=t+1-2*n.b,c=1;c<a;c++)WB(n.e,c/e);if(n.d)for(i=0;i<n.b;i++)WB(n.e,1)}function O$n(n,t){var e,i,r,c,a;if(c=t,!(a=BB(Uin(PX(n.i),c),33)))throw Hp(new ek("Unable to find elk node for json object '"+R2(c,q6n)+"' Panic!"));i=N2(c,"edges"),LIn((e=new uI(n,a)).a,e.b,i),r=N2(c,A6n),Dkn(new Ng(n).a,r)}function A$n(n,t,e,i){var r,c,a,u,o;if(null!=i){if(r=n.d[t])for(c=r.g,o=r.i,u=0;u<o;++u)if((a=BB(c[u],133)).Sh()==e&&Nfn(i,a.cd()))return u}else if(r=n.d[t])for(c=r.g,o=r.i,u=0;u<o;++u)if(GI((a=BB(c[u],133)).cd())===GI(i))return u;return-1}function $$n(n,t){var e,i;return cL(e=null==t?qI(AY(n.f,null)):hS(n.g,t),235)?((i=BB(e,235)).Qh(),i):cL(e,498)?((i=BB(e,1938).a)&&(null==i.yb||(null==t?jCn(n.f,null,i):ubn(n.g,t,i))),i):null}function L$n(n){var t,e,i,r,c,a,u;if(KDn(),null==n)return null;if((r=n.length)%2!=0)return null;for(t=V7(n),e=x8(NNt,v6n,25,c=r/2|0,15,1),i=0;i<c;i++){if(-1==(a=QLt[t[2*i]]))return null;if(-1==(u=QLt[t[2*i+1]]))return null;e[i]=(a<<4|u)<<24>>24}return e}function N$n(n,t,e){var i,r,c;if(!(r=BB(oV(n.i,t),306)))if(r=new wtn(n.d,t,e),mG(n.i,t,r),agn(t))EL(n.a,t.c,t.b,r);else switch(c=LPn(t),i=BB(oV(n.p,c),244),c.g){case 1:case 3:r.j=!0,jy(i,t.b,r);break;case 4:case 2:r.k=!0,jy(i,t.c,r)}return r}function x$n(n,t,e,i){var r,c,a,u,o,s;if(u=new go,o=axn(n.e.Tg(),t),r=BB(n.g,119),ZM(),BB(t,66).Oj())for(a=0;a<n.i;++a)c=r[a],o.rl(c.ak())&&f9(u,c);else for(a=0;a<n.i;++a)c=r[a],o.rl(c.ak())&&(s=c.dd(),f9(u,i?FIn(n,t,a,u.i,s):s));return Qwn(u,e)}function D$n(n,t){var i,r,c,a,u,o;if((r=n.b[t.p])>=0)return r;for(c=1,a=new Wb(t.j);a.a<a.c.c.length;)for(i=new Wb(BB(n0(a),11).g);i.a<i.c.c.length;)t!=(o=BB(n0(i),17).d.i)&&(u=D$n(n,o),c=e.Math.max(c,u+1));return iwn(n,t,c),c}function R$n(n,t,e){var i,r,c;for(i=1;i<n.c.length;i++){for(l1(i,n.c.length),c=BB(n.c[i],10),r=i;r>0&&t.ue((l1(r-1,n.c.length),BB(n.c[r-1],10)),c)>0;)c5(n,r,(l1(r-1,n.c.length),BB(n.c[r-1],10))),--r;l1(r,n.c.length),n.c[r]=c}e.a=new xp,e.b=new xp}function K$n(n,t,e){var i,r,c,a,u,o,s;for(s=new YK(i=BB(t.e&&t.e(),9),BB(SR(i,i.length),9),0),a=0,u=(c=kKn(e,"[\\[\\]\\s,]+")).length;a<u;++a)if(0!=RMn(r=c[a]).length){if(null==(o=HIn(n,r)))return null;orn(s,BB(o,22))}return s}function _$n(n){var t,i,r;for(i=new Wb(n.a.a.b);i.a<i.c.c.length;)t=BB(n0(i),81),kW(0),(r=0)>0&&((!dA(n.a.c)||!t.n.d)&&(!gA(n.a.c)||!t.n.b)&&(t.g.d-=e.Math.max(0,r/2-.5)),(!dA(n.a.c)||!t.n.a)&&(!gA(n.a.c)||!t.n.c)&&(t.g.a+=e.Math.max(0,r-1)))}function F$n(n,t,e){var i;if(2==(n.c-n.b&n.a.length-1))t==(kUn(),sIt)||t==oIt?(jtn(BB(Eon(n),15),(Xyn(),jCt)),jtn(BB(Eon(n),15),ECt)):(jtn(BB(Eon(n),15),(Xyn(),ECt)),jtn(BB(Eon(n),15),jCt));else for(i=new bV(n);i.a!=i.b;)jtn(BB(_hn(i),15),e)}function B$n(n,t){var e,i,r,c,a,u;for(a=new M2(i=HB(new sp(n)),i.c.length),u=new M2(r=HB(new sp(t)),r.c.length),c=null;a.b>0&&u.b>0&&(Px(a.b>0),e=BB(a.a.Xb(a.c=--a.b),33),Px(u.b>0),e==BB(u.a.Xb(u.c=--u.b),33));)c=e;return c}function H$n(n,t){var i,r,c,a;return c=n.a*aYn+1502*n.b,a=n.b*aYn+11,c+=i=e.Math.floor(a*uYn),a-=i*oYn,c%=oYn,n.a=c,n.b=a,t<=24?e.Math.floor(n.a*Oet[t]):((r=n.a*(1<<t-24)+e.Math.floor(n.b*Aet[t]))>=2147483648&&(r-=XQn),r)}function q$n(n,t,e){var i,r,c,a;w0(n,t)>w0(n,e)?(i=abn(e,(kUn(),oIt)),n.d=i.dc()?0:uq(BB(i.Xb(0),11)),a=abn(t,CIt),n.b=a.dc()?0:uq(BB(a.Xb(0),11))):(r=abn(e,(kUn(),CIt)),n.d=r.dc()?0:uq(BB(r.Xb(0),11)),c=abn(t,oIt),n.b=c.dc()?0:uq(BB(c.Xb(0),11)))}function G$n(n){var t,e,i,r,c,a,u;if(n&&(t=n.Hh(V9n))&&null!=(a=SD(cdn((!t.b&&(t.b=new Jx((gWn(),k$t),X$t,t)),t.b),"conversionDelegates")))){for(u=new Np,r=0,c=(i=kKn(a,"\\w+")).length;r<c;++r)e=i[r],u.c[u.c.length]=e;return u}return SQ(),SQ(),set}function z$n(n,t){var e,i,r,c;for(e=n.o.a,c=BB(BB(h6(n.r,t),21),84).Kc();c.Ob();)(r=BB(c.Pb(),111)).e.a=e*Gy(MD(r.b.We(Lrt))),r.e.b=(i=r.b).Xe((sWn(),aPt))?i.Hf()==(kUn(),sIt)?-i.rf().b-Gy(MD(i.We(aPt))):Gy(MD(i.We(aPt))):i.Hf()==(kUn(),sIt)?-i.rf().b:0}function U$n(n){var t,e,i,r,c,a,u,o;t=!0,r=null,c=null;n:for(o=new Wb(n.a);o.a<o.c.c.length;)for(i=new oz(ZL(fbn(u=BB(n0(o),10)).a.Kc(),new h));dAn(i);){if(e=BB(U5(i),17),r&&r!=u){t=!1;break n}if(r=u,a=e.c.i,c&&c!=a){t=!1;break n}c=a}return t}function X$n(n,t,e){var i,r,c,a,u,o;for(c=-1,u=-1,a=0;a<t.c.length&&(l1(a,t.c.length),!((r=BB(t.c[a],329)).c>n.c));a++)r.a>=n.s&&(c<0&&(c=a),u=a);return o=(n.s+n.c)/2,c>=0&&(o=qM((l1(i=YRn(n,t,c,u),t.c.length),BB(t.c[i],329))),lOn(t,i,e)),o}function W$n(){W$n=O,lEt=new XA((sWn(),cSt),1.3),gEt=jSt,IEt=new WA(15),CEt=new XA(XSt,IEt),$Et=new XA(LPt,15),bEt=hSt,jEt=KSt,EEt=BSt,TEt=qSt,kEt=DSt,MEt=USt,OEt=fPt,$An(),PEt=oEt,yEt=aEt,SEt=uEt,AEt=hEt,pEt=cEt,vEt=CSt,mEt=ISt,dEt=rEt,wEt=iEt,LEt=fEt}function V$n(n,t,e){var i,r,c,a,u;for(Bin(r=new jo,(kW(t),t)),!r.b&&(r.b=new Jx((gWn(),k$t),X$t,r)),u=r.b,a=1;a<e.length;a+=2)vjn(u,e[a-1],e[a]);for(!n.Ab&&(n.Ab=new eU(KAt,n,0,3)),i=n.Ab,c=0;c<0;++c)i=mW(BB(Wtn(i,i.i-1),590));f9(i,r)}function Q$n(n,t,e){var i,r,c;for(LD.call(this,new Np),this.a=t,this.b=e,this.e=n,n.b&&VBn(n),i=n.a,this.d=JV(i.a,this.a),this.c=JV(i.b,this.b),obn(this,this.d,this.c),mIn(this),c=this.e.e.a.ec().Kc();c.Ob();)(r=BB(c.Pb(),266)).c.c.length>0&&xqn(this,r)}function Y$n(n,t,e,i,r,c){var a,u,o;if(!r[t.b]){for(r[t.b]=!0,!(a=i)&&(a=new y6),WB(a.e,t),o=c[t.b].Kc();o.Ob();)(u=BB(o.Pb(),282)).d!=e&&u.c!=e&&(u.c!=t&&Y$n(n,u.c,t,a,r,c),u.d!=t&&Y$n(n,u.d,t,a,r,c),WB(a.c,u),gun(a.d,u.b));return a}return null}function J$n(n){var t,e,i;for(t=0,e=new Wb(n.e);e.a<e.c.c.length;)o5(new Rq(null,new w1(BB(n0(e),17).b,16)),new pe)&&++t;for(i=new Wb(n.g);i.a<i.c.c.length;)o5(new Rq(null,new w1(BB(n0(i),17).b,16)),new ve)&&++t;return t>=2}function Z$n(n,t){var e,i,r,c;for(OTn(t,"Self-Loop pre-processing",1),i=new Wb(n.a);i.a<i.c.c.length;)Kbn(e=BB(n0(i),10))&&(c=new Ogn(e),hon(e,(hWn(),Olt),c),k_n(c),JT($V(wnn(new Rq(null,new w1((r=c).d,16)),new Hi),new qi),new Gi),ixn(r));HSn(t)}function nLn(n,t,e,i,r){var c,a,u,o,s;for(c=n.c.d.j,a=BB(Dpn(e,0),8),s=1;s<e.b;s++)o=BB(Dpn(e,s),8),r5(i,a,i.c.b,i.c),u=kL(UR(new wA(a),o),.5),UR(u,kL(new XZ(hsn(c)),r)),r5(i,u,i.c.b,i.c),a=o,c=0==t?Mln(c):Eln(c);DH(i,(Px(0!=e.b),BB(e.c.b.c,8)))}function tLn(n){return n$n(),!(Can(OJ(EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[LCt])),n))>1||Can(OJ(EG(ICt,Pun(Gk(GCt,1),$Vn,93,0,[CCt,ACt])),n))>1||Can(OJ(EG(DCt,Pun(Gk(GCt,1),$Vn,93,0,[xCt,NCt])),n))>1)}function eLn(n,t){var e,i,r;return(e=t.Hh(n.a))&&null!=(r=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),"affiliation")))?-1==(i=mN(r,YTn(35)))?uln(n,az(n,Utn(t.Hj())),r):0==i?uln(n,null,r.substr(1)):uln(n,r.substr(0,i),r.substr(i+1)):null}function iLn(n){var t,e;try{return null==n?zWn:Bbn(n)}catch(i){if(cL(i=lun(i),102))return t=i,e=nE(tsn(n))+"@"+($T(),(evn(n)>>>0).toString(16)),Kgn(jun(),(lM(),"Exception during lenientFormat for "+e),t),"<"+e+" threw "+nE(t.gm)+">";throw Hp(i)}}function rLn(n){switch(n.g){case 0:return new of;case 1:return new ef;case 2:return new $M;case 3:return new Ic;case 4:return new RR;case 5:return new sf;default:throw Hp(new _y("No implementation is available for the layerer "+(null!=n.f?n.f:""+n.g)))}}function cLn(n,t,e){var i,r,c;for(c=new Wb(n.t);c.a<c.c.c.length;)(i=BB(n0(c),268)).b.s<0&&i.c>0&&(i.b.n-=i.c,i.b.n<=0&&i.b.u>0&&DH(t,i.b));for(r=new Wb(n.i);r.a<r.c.c.length;)(i=BB(n0(r),268)).a.s<0&&i.c>0&&(i.a.u-=i.c,i.a.u<=0&&i.a.n>0&&DH(e,i.a))}function aLn(n){var t,e,i;if(null==n.g&&(n.d=n.si(n.f),f9(n,n.d),n.c))return n.f;if(i=(t=BB(n.g[n.i-1],47)).Pb(),n.e=t,(e=n.si(i)).Ob())n.d=e,f9(n,e);else for(n.d=null;!t.Ob()&&($X(n.g,--n.i,null),0!=n.i);)t=BB(n.g[n.i-1],47);return i}function uLn(n,t){var e,i,r,c,a,u;if(r=(i=t).ak(),$xn(n.e,r)){if(r.hi()&&G3(n,r,i.dd()))return!1}else for(u=axn(n.e.Tg(),r),e=BB(n.g,119),c=0;c<n.i;++c)if(a=e[c],u.rl(a.ak()))return!Nfn(a,i)&&(BB(ovn(n,c,t),72),!0);return f9(n,t)}function oLn(n,t,i,r){var c,a,u;for(Bl(c=new $vn(n),(uSn(),Sut)),hon(c,(hWn(),dlt),t),hon(c,Plt,r),hon(c,(HXn(),ept),(QEn(),XCt)),hon(c,hlt,t.c),hon(c,flt,t.d),zxn(t,c),u=e.Math.floor(i/2),a=new Wb(c.j);a.a<a.c.c.length;)BB(n0(a),11).n.b=u;return c}function sLn(n,t){var e,i,r,c,a,u,o,s,h;for(o=sx(n.c-n.b&n.a.length-1),s=null,h=null,c=new bV(n);c.a!=c.b;)r=BB(_hn(c),10),e=(u=BB(mMn(r,(hWn(),hlt)),11))?u.i:null,i=(a=BB(mMn(r,flt),11))?a.i:null,s==e&&h==i||(GAn(o,t),s=e,h=i),o.c[o.c.length]=r;GAn(o,t)}function hLn(n){var t,i,r,c,a,u;for(t=0,i=new Wb(n.a);i.a<i.c.c.length;)for(c=new oz(ZL(lbn(BB(n0(i),10)).a.Kc(),new h));dAn(c);)n==(r=BB(U5(c),17)).d.i.c&&r.c.j==(kUn(),CIt)&&(a=g1(r.c).b,u=g1(r.d).b,t=e.Math.max(t,e.Math.abs(u-a)));return t}function fLn(n,t,e){var i,r;OTn(e,"Remove overlaps",1),e.n&&t&&y0(e,o2(t),(Bsn(),uOt)),i=BB(ZAn(t,(wD(),Vkt)),33),n.f=i,n.a=Evn(BB(ZAn(t,(Uyn(),Rjt)),293)),ib(n,(kW(r=MD(ZAn(t,(sWn(),LPt)))),r)),Xzn(n,t,wDn(i),e),e.n&&t&&y0(e,o2(t),(Bsn(),uOt))}function lLn(n,t,i){switch(i.g){case 1:return new xC(t.a,e.Math.min(n.d.b,t.b));case 2:return new xC(e.Math.max(n.c.a,t.a),t.b);case 3:return new xC(t.a,e.Math.max(n.c.b,t.b));case 4:return new xC(e.Math.min(t.a,n.d.a),t.b)}return new xC(t.a,t.b)}function bLn(n,t,e,i){var r,c,a,u,o,s,h,f,l;for(f=i?(kUn(),CIt):(kUn(),oIt),r=!1,s=0,h=(o=t[e]).length;s<h;++s)LK(BB(mMn(u=o[s],(HXn(),ept)),98))||(a=u.e,(l=!abn(u,f).dc()&&!!a)&&(c=qEn(a),n.b=new zEn(c,i?0:c.length-1)),r|=c_n(n,u,f,l));return r}function wLn(n){var t,e,i;for(WB(t=sx(1+(!n.c&&(n.c=new eU(XOt,n,9,9)),n.c).i),(!n.d&&(n.d=new hK(_Ot,n,8,5)),n.d)),i=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));i.e!=i.i.gc();)WB(t,(!(e=BB(kpn(i),118)).d&&(e.d=new hK(_Ot,e,8,5)),e.d));return yX(t),new OO(t)}function dLn(n){var t,e,i;for(WB(t=sx(1+(!n.c&&(n.c=new eU(XOt,n,9,9)),n.c).i),(!n.e&&(n.e=new hK(_Ot,n,7,4)),n.e)),i=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));i.e!=i.i.gc();)WB(t,(!(e=BB(kpn(i),118)).e&&(e.e=new hK(_Ot,e,7,4)),e.e));return yX(t),new OO(t)}function gLn(n){var t,e,i,r;if(null==n)return null;if(i=FBn(n,!0),r=x7n.length,mK(i.substr(i.length-r,r),x7n))if(4==(e=i.length)){if(b1(0,i.length),43==(t=i.charCodeAt(0)))return HLt;if(45==t)return BLt}else if(3==e)return HLt;return bSn(i)}function pLn(n){var t,e,i,r;for(t=0,e=0,r=new Wb(n.j);r.a<r.c.c.length;)if(t=dG(rbn(t,q6(AV(new Rq(null,new w1((i=BB(n0(r),11)).e,16)),new Yc)))),e=dG(rbn(e,q6(AV(new Rq(null,new w1(i.g,16)),new Jc)))),t>1||e>1)return 2;return t+e==1?2:0}function vLn(n,t,e){var i,r,c,a;for(OTn(e,"ELK Force",1),qy(TD(ZAn(t,(fRn(),Wct))))||jJ(new Tw((GM(),new Dy(t)))),kkn(a=fon(t)),zon(n,BB(mMn(a,Gct),424)),r=(c=HFn(n.a,a)).Kc();r.Ob();)i=BB(r.Pb(),231),PKn(n.b,i,mcn(e,1/c.gc()));SUn(a=GUn(c)),HSn(e)}function mLn(n,t){var e,i,r;if(OTn(t,"Breaking Point Processor",1),Ozn(n),qy(TD(mMn(n,(HXn(),Gpt))))){for(i=new Wb(n.b);i.a<i.c.c.length;)for(e=0,r=new Wb(BB(n0(i),29).a);r.a<r.c.c.length;)BB(n0(r),10).p=e++;oHn(n),Hxn(n,!0),Hxn(n,!1)}HSn(t)}function yLn(n,t,e){var i,r,c,a,u;for(a=n.c,c=(e.q?e.q:(SQ(),SQ(),het)).vc().Kc();c.Ob();)r=BB(c.Pb(),42),!jE(AV(new Rq(null,new w1(a,16)),new aw(new LC(t,r)))).sd((dM(),tit))&&(cL(u=r.dd(),4)&&null!=(i=Jdn(u))&&(u=i),t.Ye(BB(r.cd(),146),u))}function kLn(n,t){var e,i,r,c;if(t){for(c=!(r=cL(n.Cb,88)||cL(n.Cb,99))&&cL(n.Cb,322),e=new AL((!t.a&&(t.a=new aG(t,VAt,t)),t.a));e.e!=e.i.gc();)if(i=lFn(BB(kpn(e),87)),r?cL(i,88):c?cL(i,148):i)return i;return r?(gWn(),d$t):(gWn(),l$t)}return null}function jLn(n,t){var e,i,r,c,a;for(OTn(t,"Constraints Postprocessor",1),c=0,r=new Wb(n.b);r.a<r.c.c.length;){for(a=0,i=new Wb(BB(n0(r),29).a);i.a<i.c.c.length;)(e=BB(n0(i),10)).k==(uSn(),Cut)&&(hon(e,(HXn(),jgt),iln(c)),hon(e,Bdt,iln(a)),++a);++c}HSn(t)}function ELn(n,t,e,i){var r,c,a,u,o,s;for(XR(u=new xC(e,i),BB(mMn(t,(qqn(),nkt)),8)),s=spn(t.b,0);s.b!=s.d.c;)UR((o=BB(b3(s),86)).e,u),DH(n.b,o);for(a=spn(t.a,0);a.b!=a.d.c;){for(r=spn((c=BB(b3(a),188)).a,0);r.b!=r.d.c;)UR(BB(b3(r),8),u);DH(n.a,c)}}function TLn(n,t,e){var i,r,c;if(!(c=Fqn((IPn(),Z$t),n.Tg(),t)))throw Hp(new _y(r6n+t.ne()+c6n));if(ZM(),!BB(c,66).Oj()&&!(c=Z1(B7(Z$t,c))))throw Hp(new _y(r6n+t.ne()+c6n));r=BB((i=n.Yg(c))>=0?n._g(i,!0,!0):cOn(n,c,!0),153),BB(r,215).ml(t,e)}function MLn(n,t){var e,i,r,c,a;for(e=new Np,r=wnn(new Rq(null,new w1(n,16)),new Ea),c=wnn(new Rq(null,new w1(n,16)),new Ta),a=M7(H6(LV(SNn(Pun(Gk(eit,1),HWn,833,0,[r,c])),new Ma))),i=1;i<a.length;i++)a[i]-a[i-1]>=2*t&&WB(e,new kB(a[i-1]+t,a[i]-t));return e}function SLn(n,t,e){OTn(e,"Eades radial",1),e.n&&t&&y0(e,o2(t),(Bsn(),uOt)),n.d=BB(ZAn(t,(wD(),Vkt)),33),n.c=Gy(MD(ZAn(t,(Uyn(),Djt)))),n.e=Evn(BB(ZAn(t,Rjt),293)),n.a=lwn(BB(ZAn(t,_jt),426)),n.b=qjn(BB(ZAn(t,$jt),340)),rjn(n),e.n&&t&&y0(e,o2(t),(Bsn(),uOt))}function PLn(n,t,e){var i,r,c,a,u;if(e)for(c=((i=new hz(e.a.length)).b-i.a)*i.c<0?(eS(),MNt):new XL(i);c.Ob();)(r=x2(e,BB(c.Pb(),19).a))&&($in(a=$3(n,(tE(),u=new Em,!!t&&BLn(u,t),u),r),R2(r,q6n)),STn(r,a),OCn(r,a),xon(n,r,a))}function CLn(n){var t,e,i,r;if(!n.j){if(r=new Io,null==(t=P$t).a.zc(n,t)){for(i=new AL(kY(n));i.e!=i.i.gc();)pX(r,CLn(e=BB(kpn(i),26))),f9(r,e);t.a.Bc(n)}chn(r),n.j=new NO((BB(Wtn(QQ((QX(),t$t).o),11),18),r.i),r.g),P5(n).b&=-33}return n.j}function ILn(n){var t,e,i,r;if(null==n)return null;if(i=FBn(n,!0),r=x7n.length,mK(i.substr(i.length-r,r),x7n))if(4==(e=i.length)){if(b1(0,i.length),43==(t=i.charCodeAt(0)))return GLt;if(45==t)return qLt}else if(3==e)return GLt;return new Dv(i)}function OLn(n){var t,e,i;return 0!=((e=n.l)&e-1)||0!=((i=n.m)&i-1)||0!=((t=n.h)&t-1)||0==t&&0==i&&0==e?-1:0==t&&0==i&&0!=e?gin(e):0==t&&0!=i&&0==e?gin(i)+22:0!=t&&0==i&&0==e?gin(t)+44:-1}function ALn(n,t){var e,i,r,c;for(OTn(t,"Edge joining",1),e=qy(TD(mMn(n,(HXn(),Dpt)))),i=new Wb(n.b);i.a<i.c.c.length;)for(c=new M2(BB(n0(i),29).a,0);c.b<c.d.gc();)Px(c.b<c.d.gc()),(r=BB(c.d.Xb(c.c=c.b++),10)).k==(uSn(),Put)&&(rGn(r,e),fW(c));HSn(t)}function $Ln(n,t,e){var i;if(h2(n.b),CU(n.b,(Pbn(),HEt),(OM(),GTt)),CU(n.b,qEt,t.g),CU(n.b,GEt,t.a),n.a=$qn(n.b,t),OTn(e,"Compaction by shrinking a tree",n.a.c.length),t.i.c.length>1)for(i=new Wb(n.a);i.a<i.c.c.length;)BB(n0(i),51).pf(t,mcn(e,1));HSn(e)}function LLn(n,t){var e,i,r,c,a;for(r=t.a&n.f,c=null,i=n.b[r];;i=i.b){if(i==t){c?c.b=t.b:n.b[r]=t.b;break}c=i}for(a=t.f&n.f,c=null,e=n.c[a];;e=e.d){if(e==t){c?c.d=t.d:n.c[a]=t.d;break}c=e}t.e?t.e.c=t.c:n.a=t.c,t.c?t.c.e=t.e:n.e=t.e,--n.i,++n.g}function NLn(n){var t,i,r,c,a,u,o,s,h,f;for(i=n.o,t=n.p,u=DWn,c=_Vn,o=DWn,a=_Vn,h=0;h<i;++h)for(f=0;f<t;++f)vmn(n,h,f)&&(u=e.Math.min(u,h),c=e.Math.max(c,h),o=e.Math.min(o,f),a=e.Math.max(a,f));return s=c-u+1,r=a-o+1,new VV(iln(u),iln(o),iln(s),iln(r))}function xLn(n,t){var e,i,r,c;for(Px((c=new M2(n,0)).b<c.d.gc()),e=BB(c.d.Xb(c.c=c.b++),140);c.b<c.d.gc();)Px(c.b<c.d.gc()),r=new mH((i=BB(c.d.Xb(c.c=c.b++),140)).c,e.d,t),Px(c.b>0),c.a.Xb(c.c=--c.b),yR(c,r),Px(c.b<c.d.gc()),c.d.Xb(c.c=c.b++),r.a=!1,e=i}function DLn(n){var t,e,i,r,c;for(i=BB(mMn(n,(hWn(),Kft)),11),c=new Wb(n.j);c.a<c.c.c.length;){for(e=new Wb((r=BB(n0(c),11)).g);e.a<e.c.c.length;)return MZ(BB(n0(e),17),i),r;for(t=new Wb(r.e);t.a<t.c.c.length;)return SZ(BB(n0(t),17),i),r}return null}function RLn(n,t,i){var r,c;Vhn(r=fan(i.q.getTime()),0)<0?(c=VVn-dG(ldn(j7(r),VVn)))==VVn&&(c=0):c=dG(ldn(r,VVn)),1==t?xX(n,48+(c=e.Math.min((c+50)/100|0,9))&QVn):2==t?Enn(n,c=e.Math.min((c+5)/10|0,99),2):(Enn(n,c,3),t>3&&Enn(n,0,t-3))}function KLn(n){var t,e,i,r;return GI(mMn(n,(HXn(),sgt)))===GI((ufn(),pCt))?!n.e&&GI(mMn(n,Rdt))!==GI((Kan(),kft)):(i=BB(mMn(n,Kdt),292),r=qy(TD(mMn(n,Hdt)))||GI(mMn(n,qdt))===GI((Oin(),sht)),t=BB(mMn(n,Ddt),19).a,e=n.a.c.length,!r&&i!=(Kan(),kft)&&(0==t||t>e))}function _Ln(n){var t,e;for(e=0;e<n.c.length&&!(sq((l1(e,n.c.length),BB(n.c[e],113)))>0);e++);if(e>0&&e<n.c.length-1)return e;for(t=0;t<n.c.length&&!(sq((l1(t,n.c.length),BB(n.c[t],113)))>0);t++);return t>0&&e<n.c.length-1?t:n.c.length/2|0}function FLn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=6&&t){if(vkn(n,t))throw Hp(new _y(w6n+ROn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?skn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,6,i)),(i=QD(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,6,t,t))}function BLn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=9&&t){if(vkn(n,t))throw Hp(new _y(w6n+URn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?fkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,9,i)),(i=YD(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,9,t,t))}function HLn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=3&&t){if(vkn(n,t))throw Hp(new _y(w6n+lHn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?Mkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,12,i)),(i=VD(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,t,t))}function qLn(n){var t,e,i,r,c;if(i=Ikn(n),null==(c=n.j)&&i)return n.$j()?null:i.zj();if(cL(i,148)){if((e=i.Aj())&&(r=e.Nh())!=n.i){if((t=BB(i,148)).Ej())try{n.g=r.Kh(t,c)}catch(a){if(!cL(a=lun(a),78))throw Hp(a);n.g=null}n.i=r}return n.g}return null}function GLn(n){var t;return WB(t=new Np,new xS(new xC(n.c,n.d),new xC(n.c+n.b,n.d))),WB(t,new xS(new xC(n.c,n.d),new xC(n.c,n.d+n.a))),WB(t,new xS(new xC(n.c+n.b,n.d+n.a),new xC(n.c+n.b,n.d))),WB(t,new xS(new xC(n.c+n.b,n.d+n.a),new xC(n.c,n.d+n.a))),t}function zLn(n,t,e,i){var r,c,a;if(a=Ajn(t,e),i.c[i.c.length]=t,-1==n.j[a.p]||2==n.j[a.p]||n.a[t.p])return i;for(n.j[a.p]=-1,c=new oz(ZL(hbn(a).a.Kc(),new h));dAn(c);)if(!b5(r=BB(U5(c),17))&&(b5(r)||r.c.i.c!=r.d.i.c)&&r!=t)return zLn(n,r,a,i);return i}function ULn(n,t,e){var i,r;for(r=t.a.ec().Kc();r.Ob();)i=BB(r.Pb(),79),!BB(RX(n.b,i),266)&&(JJ(PMn(i))==JJ(OMn(i))?tDn(n,i,e):PMn(i)==JJ(OMn(i))?null==RX(n.c,i)&&null!=RX(n.b,OMn(i))&&rzn(n,i,e,!1):null==RX(n.d,i)&&null!=RX(n.b,PMn(i))&&rzn(n,i,e,!0))}function XLn(n,t){var e,i,r,c,a,u,o;for(r=n.Kc();r.Ob();)for(i=BB(r.Pb(),10),CZ(u=new CSn,i),qCn(u,(kUn(),oIt)),hon(u,(hWn(),jlt),(hN(),!0)),a=t.Kc();a.Ob();)c=BB(a.Pb(),10),CZ(o=new CSn,c),qCn(o,CIt),hon(o,jlt,!0),hon(e=new wY,jlt,!0),SZ(e,u),MZ(e,o)}function WLn(n,t,e,i){var r,c,a,u;r=Adn(n,t,e),c=Adn(n,e,t),a=BB(RX(n.c,t),112),u=BB(RX(n.c,e),112),r<c?new zZ((O6(),Myt),a,u,c-r):c<r?new zZ((O6(),Myt),u,a,r-c):(0!=r||t.i&&e.i&&i[t.i.c][e.i.c])&&(new zZ((O6(),Myt),a,u,0),new zZ(Myt,u,a,0))}function VLn(n,t){var e,i,r,c,a,u;for(r=0,a=new Wb(t.a);a.a<a.c.c.length;)for(r+=(c=BB(n0(a),10)).o.b+c.d.a+c.d.d+n.e,i=new oz(ZL(fbn(c).a.Kc(),new h));dAn(i);)(e=BB(U5(i),17)).c.i.k==(uSn(),Iut)&&(r+=(u=BB(mMn(e.c.i,(hWn(),dlt)),10)).o.b+u.d.a+u.d.d);return r}function QLn(n,t,e){var i,r,c,a,u,o,s;for(c=new Np,OBn(n,s=new YT,a=new YT,t),Ezn(n,s,a,t,e),o=new Wb(n);o.a<o.c.c.length;)for(r=new Wb((u=BB(n0(o),112)).k);r.a<r.c.c.length;)i=BB(n0(r),129),(!t||i.c==(O6(),Tyt))&&u.g>i.b.g&&(c.c[c.c.length]=i);return c}function YLn(){YLn=O,DEt=new jC("CANDIDATE_POSITION_LAST_PLACED_RIGHT",0),xEt=new jC("CANDIDATE_POSITION_LAST_PLACED_BELOW",1),KEt=new jC("CANDIDATE_POSITION_WHOLE_DRAWING_RIGHT",2),REt=new jC("CANDIDATE_POSITION_WHOLE_DRAWING_BELOW",3),_Et=new jC("WHOLE_DRAWING",4)}function JLn(n,t){if(cL(t,239))return hln(n,BB(t,33));if(cL(t,186))return Dln(n,BB(t,118));if(cL(t,354))return tQ(n,BB(t,137));if(cL(t,352))return JFn(n,BB(t,79));if(t)return null;throw Hp(new _y(z6n+LMn(new Jy(Pun(Gk(Ant,1),HWn,1,5,[t])))))}function ZLn(n){var t,e,i,r,c,a,u;for(c=new YT,r=new Wb(n.d.a);r.a<r.c.c.length;)0==(i=BB(n0(r),121)).b.a.c.length&&r5(c,i,c.c.b,c.c);if(c.b>1)for(t=AN((e=new qv,++n.b,e),n.d),u=spn(c,0);u.b!=u.d.c;)a=BB(b3(u),121),UNn(aM(cM(uM(rM(new Hv,1),0),t),a))}function nNn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=11&&t){if(vkn(n,t))throw Hp(new _y(w6n+zRn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?Skn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=Npn(t,n,10,i)),(i=zR(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,11,t,t))}function tNn(n){var t,e,i,r;for(i=new usn(new Pb(n.b).a);i.b;)r=BB((e=ten(i)).cd(),11),hon(t=BB(e.dd(),10),(hWn(),dlt),r),hon(r,Elt,t),hon(r,elt,(hN(),!0)),qCn(r,BB(mMn(t,Qft),61)),mMn(t,Qft),hon(r.i,(HXn(),ept),(QEn(),VCt)),BB(mMn(vW(r.i),Zft),21).Fc((bDn(),dft))}function eNn(n,t,e){var i,r,c;if(i=0,r=0,n.c)for(c=new Wb(n.d.i.j);c.a<c.c.c.length;)i+=BB(n0(c),11).e.c.length;else i=1;if(n.d)for(c=new Wb(n.c.i.j);c.a<c.c.c.length;)r+=BB(n0(c),11).g.c.length;else r=1;return(e+t)/2+.4*CJ(HH(r-i))*(e-t)}function iNn(n){var t,e;if(LEn(),n.Hc((kUn(),PIt)))throw Hp(new _y("Port sides must not contain UNDEFINED"));switch(n.gc()){case 1:return Mst;case 2:return t=n.Hc(oIt)&&n.Hc(CIt),e=n.Hc(sIt)&&n.Hc(SIt),t||e?Cst:Pst;case 3:return Sst;case 4:return Tst;default:return null}}function rNn(n,t,e){var i,r,c,a;for(OTn(e,"Breaking Point Removing",1),n.a=BB(mMn(t,(HXn(),Zdt)),218),r=new Wb(t.b);r.a<r.c.c.length;)for(a=new Wb(a0(BB(n0(r),29).a));a.a<a.c.c.length;)Jnn(c=BB(n0(a),10))&&!(i=BB(mMn(c,(hWn(),Rft)),305)).d&&zUn(n,i);HSn(e)}function cNn(n,t,e){return jDn(),(!Dcn(n,t)||!Dcn(n,e))&&(mzn(new xC(n.c,n.d),new xC(n.c+n.b,n.d),t,e)||mzn(new xC(n.c+n.b,n.d),new xC(n.c+n.b,n.d+n.a),t,e)||mzn(new xC(n.c+n.b,n.d+n.a),new xC(n.c,n.d+n.a),t,e)||mzn(new xC(n.c,n.d+n.a),new xC(n.c,n.d),t,e))}function aNn(n,t){var e,i,r,c;if(!n.dc())for(e=0,i=n.gc();e<i;++e)if(null==(c=SD(n.Xb(e)))?null==t:mK(c.substr(0,3),"!##")?null!=t&&(r=t.length,!mK(c.substr(c.length-r,r),t)||c.length!=t.length+3)&&!mK(S7n,t):mK(c,P7n)&&!mK(S7n,t)||mK(c,t))return!0;return!1}function uNn(n,t,e,i){var r,c,a,u,o,s;for(a=n.j.c.length,o=x8(art,rJn,306,a,0,1),u=0;u<a;u++)(c=BB(xq(n.j,u),11)).p=u,o[u]=hOn(mAn(c),e,i);for(VNn(n,o,e,t,i),s=new xp,r=0;r<o.length;r++)o[r]&&VW(s,BB(xq(n.j,r),11),o[r]);s.f.c+s.g.c!=0&&(hon(n,(hWn(),zft),s),ASn(n,o))}function oNn(n,t,e){var i,r;for(i=new Wb(n.a.b);i.a<i.c.c.length;)if((r=f2(BB(n0(i),57)))&&r.k==(uSn(),Mut))switch(BB(mMn(r,(hWn(),Qft)),61).g){case 4:r.n.a=t.a;break;case 2:r.n.a=e.a-(r.o.a+r.d.c);break;case 1:r.n.b=t.b;break;case 3:r.n.b=e.b-(r.o.b+r.d.a)}}function sNn(){sNn=O,Ivt=new HP(QZn,0),Tvt=new HP("NIKOLOV",1),Pvt=new HP("NIKOLOV_PIXEL",2),Mvt=new HP("NIKOLOV_IMPROVED",3),Svt=new HP("NIKOLOV_IMPROVED_PIXEL",4),Evt=new HP("DUMMYNODE_PERCENTAGE",5),Cvt=new HP("NODECOUNT_PERCENTAGE",6),Ovt=new HP("NO_BOUNDARY",7)}function hNn(n,t,e){var i,r,c;if(!(r=BB(ZAn(t,(SMn(),UMt)),19))&&(r=iln(0)),!(c=BB(ZAn(e,UMt),19))&&(c=iln(0)),r.a>c.a)return-1;if(r.a<c.a)return 1;if(n.a){if(0!=(i=Pln(t.j,e.j)))return i;if(0!=(i=Pln(t.i,e.i)))return i}return Pln(t.g*t.f,e.g*e.f)}function fNn(n,t){var e,i,r,c,a,u,o,s,h,f;if(++n.e,t>(o=null==n.d?0:n.d.length)){for(h=n.d,n.d=x8(oAt,c9n,63,2*o+4,0,1),c=0;c<o;++c)if(s=h[c])for(i=s.g,f=s.i,u=0;u<f;++u)a=eR(n,(r=BB(i[u],133)).Sh()),!(e=n.d[a])&&(e=n.d[a]=n.uj()),e.Fc(r);return!0}return!1}function lNn(n,t,e){var i,r,c,a,u,o;if(c=(r=e).ak(),$xn(n.e,c)){if(c.hi())for(i=BB(n.g,119),a=0;a<n.i;++a)if(Nfn(u=i[a],r)&&a!=t)throw Hp(new _y(a8n))}else for(o=axn(n.e.Tg(),c),i=BB(n.g,119),a=0;a<n.i;++a)if(u=i[a],o.rl(u.ak()))throw Hp(new _y(I7n));sln(n,t,e)}function bNn(n,t){var e,i,r,c,a,u;for(e=BB(mMn(t,(hWn(),Xft)),21),a=BB(h6((RXn(),fut),e),21),u=BB(h6(put,e),21),c=a.Kc();c.Ob();)if(i=BB(c.Pb(),21),!BB(h6(n.b,i),15).dc())return!1;for(r=u.Kc();r.Ob();)if(i=BB(r.Pb(),21),!BB(h6(n.b,i),15).dc())return!1;return!0}function wNn(n,t){var e,i,r;for(OTn(t,"Partition postprocessing",1),e=new Wb(n.b);e.a<e.c.c.length;)for(i=new Wb(BB(n0(e),29).a);i.a<i.c.c.length;)for(r=new Wb(BB(n0(i),10).j);r.a<r.c.c.length;)qy(TD(mMn(BB(n0(r),11),(hWn(),jlt))))&&AU(r);HSn(t)}function dNn(n,t){var e,i,r,c,a,u,o;if(1==n.a.c.length)return FSn(BB(xq(n.a,0),187),t);for(r=cfn(n),a=0,u=n.d,i=r,o=n.d,c=(u-i)/2+i;i+1<u;){for(a=0,e=new Wb(n.a);e.a<e.c.c.length;)a+=cHn(BB(n0(e),187),c,!1).a;a<t?(o=c,u=c):i=c,c=(u-i)/2+i}return o}function gNn(n){var t,e,i,r;return isNaN(n)?(X7(),gtt):n<-0x8000000000000000?(X7(),wtt):n>=0x8000000000000000?(X7(),btt):(i=!1,n<0&&(i=!0,n=-n),e=0,n>=OQn&&(n-=(e=CJ(n/OQn))*OQn),t=0,n>=IQn&&(n-=(t=CJ(n/IQn))*IQn),r=M$(CJ(n),t,e),i&&Oon(r),r)}function pNn(n,t){var e,i,r,c;for(e=!t||!n.u.Hc((lIn(),eIt)),c=0,r=new Wb(n.e.Cf());r.a<r.c.c.length;){if((i=BB(n0(r),838)).Hf()==(kUn(),PIt))throw Hp(new _y("Label and node size calculator can only be used with ports that have port sides assigned."));i.vf(c++),Whn(n,i,e)}}function vNn(n,t){var e,i,r,c;return(i=t.Hh(n.a))&&(!i.b&&(i.b=new Jx((gWn(),k$t),X$t,i)),null!=(e=SD(cdn(i.b,J9n)))&&cL(c=-1==(r=e.lastIndexOf("#"))?uD(n,t.Aj(),e):0==r?M9(n,null,e.substr(1)):M9(n,e.substr(0,r),e.substr(r+1)),148))?BB(c,148):null}function mNn(n,t){var e,i,r,c;return(e=t.Hh(n.a))&&(!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),null!=(r=SD(cdn(e.b,k7n)))&&cL(c=-1==(i=r.lastIndexOf("#"))?uD(n,t.Aj(),r):0==i?M9(n,null,r.substr(1)):M9(n,r.substr(0,i),r.substr(i+1)),148))?BB(c,148):null}function yNn(n){var t,e,i,r,c;for(e=new Wb(n.a.a);e.a<e.c.c.length;){for((t=BB(n0(e),307)).j=null,c=t.a.a.ec().Kc();c.Ob();)kO((i=BB(c.Pb(),57)).b),(!t.j||i.d.c<t.j.d.c)&&(t.j=i);for(r=t.a.a.ec().Kc();r.Ob();)(i=BB(r.Pb(),57)).b.a=i.d.c-t.j.d.c,i.b.b=i.d.d-t.j.d.d}return n}function kNn(n){var t,e,i,r,c;for(e=new Wb(n.a.a);e.a<e.c.c.length;){for((t=BB(n0(e),189)).f=null,c=t.a.a.ec().Kc();c.Ob();)kO((i=BB(c.Pb(),81)).e),(!t.f||i.g.c<t.f.g.c)&&(t.f=i);for(r=t.a.a.ec().Kc();r.Ob();)(i=BB(r.Pb(),81)).e.a=i.g.c-t.f.g.c,i.e.b=i.g.d-t.f.g.d}return n}function jNn(n){var t,i,r;return i=BB(n.a,19).a,r=BB(n.b,19).a,i<(t=e.Math.max(e.Math.abs(i),e.Math.abs(r)))&&r==-t?new rI(iln(i+1),iln(r)):i==t&&r<t?new rI(iln(i),iln(r+1)):i>=-t&&r==t?new rI(iln(i-1),iln(r)):new rI(iln(i),iln(r-1))}function ENn(){return lWn(),Pun(Gk(ust,1),$Vn,77,0,[rot,tot,cot,kot,Fot,Mot,Uot,Oot,Kot,got,Not,Iot,_ot,lot,Wot,Vut,Lot,Hot,jot,Bot,Qot,Dot,Qut,Rot,Yot,Got,Vot,Eot,sot,Tot,yot,Xot,Zut,uot,Pot,Jut,Cot,vot,bot,Aot,dot,eot,not,mot,wot,$ot,zot,Yut,xot,pot,Sot,hot,oot,qot,aot,fot,iot])}function TNn(n,t,e){n.d=0,n.b=0,t.k==(uSn(),Iut)&&e.k==Iut&&BB(mMn(t,(hWn(),dlt)),10)==BB(mMn(e,dlt),10)&&(S7(t).j==(kUn(),sIt)?q$n(n,t,e):q$n(n,e,t)),t.k==Iut&&e.k==Put?S7(t).j==(kUn(),sIt)?n.d=1:n.b=1:e.k==Iut&&t.k==Put&&(S7(e).j==(kUn(),sIt)?n.b=1:n.d=1),umn(n,t,e)}function MNn(n){var t,e,i,r,c;return c=ATn(n),null!=n.a&&AH(c,"category",n.a),!WE(new Cb(n.d))&&(rtn(c,"knownOptions",i=new Cl),t=new ep(i),e5(new Cb(n.d),t)),!WE(n.g)&&(rtn(c,"supportedFeatures",r=new Cl),e=new ip(r),e5(n.g,e)),c}function SNn(n){var t,e,i,r,c,a,u,o;for(t=336,e=0,r=new sR(n.length),u=0,o=(a=n).length;u<o;++u)Qln(c=a[u]),EW(c),i=c.a,WB(r.a,yX(i)),t&=i.qd(),e=Ysn(e,i.rd());return BB(BB(XU(new Rq(null,qTn(new w1((WX(),Nwn(r.a)),16),new k,t,e)),new El(n)),670),833)}function PNn(n,t){var e;n.d&&(t.c!=n.e.c||fcn(n.e.b,t.b))&&(WB(n.f,n.d),n.a=n.d.c+n.d.b,n.d=null,n.e=null),nA(t.b)?n.c=t:n.b=t,(t.b==(Aun(),Zat)&&!t.a||t.b==nut&&t.a||t.b==tut&&t.a||t.b==eut&&!t.a)&&n.c&&n.b&&(e=new UV(n.a,n.c.d,t.c-n.a,n.b.d-n.c.d),n.d=e,n.e=t)}function CNn(n){var t;if(Ym.call(this),this.i=new lu,this.g=n,this.f=BB(n.e&&n.e(),9).length,0==this.f)throw Hp(new _y("There must be at least one phase in the phase enumeration."));this.c=new YK(t=BB(Vj(this.g),9),BB(SR(t,t.length),9),0),this.a=new B2,this.b=new xp}function INn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=7&&t){if(vkn(n,t))throw Hp(new _y(w6n+cPn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?hkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=BB(t,49).gh(n,1,DOt,i)),(i=VG(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,7,t,t))}function ONn(n,t){var e,i;if(t!=n.Cb||n.Db>>16!=3&&t){if(vkn(n,t))throw Hp(new _y(w6n+Vfn(n)));i=null,n.Cb&&(i=(e=n.Db>>16)>=0?bkn(n,i):n.Cb.ih(n,-1-e,null,i)),t&&(i=BB(t,49).gh(n,0,BOt,i)),(i=QG(n,t,i))&&i.Fi()}else 0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,3,t,t))}function ANn(n,t){var e,i,r,c,a,u,o,s,h;return $On(),t.d>n.d&&(u=n,n=t,t=u),t.d<63?Xxn(n,t):(s=z5(n,a=(-2&n.d)<<4),h=z5(t,a),i=uBn(n,G5(s,a)),r=uBn(t,G5(h,a)),o=ANn(s,h),e=ANn(i,r),c=G5(c=$Hn($Hn(c=ANn(uBn(s,i),uBn(r,h)),o),e),a),$Hn($Hn(o=G5(o,a<<1),c),e))}function $Nn(n,t,e){var i,r,c,a,u;for(a=Lfn(n,e),u=x8(Out,a1n,10,t.length,0,1),i=0,c=a.Kc();c.Ob();)qy(TD(mMn(r=BB(c.Pb(),11),(hWn(),elt))))&&(u[i++]=BB(mMn(r,Elt),10));if(i<t.length)throw Hp(new Fy("Expected "+t.length+" hierarchical ports, but found only "+i+"."));return u}function LNn(n,t){var e,i,r,c,a,u;if(!n.tb){for(!n.rb&&(n.rb=new Jz(n,HAt,n)),u=new XT((c=n.rb).i),r=new AL(c);r.e!=r.i.gc();)i=BB(kpn(r),138),(e=BB(null==(a=i.ne())?jCn(u.f,null,i):ubn(u.g,a,i),138))&&(null==a?jCn(u.f,null,e):ubn(u.g,a,e));n.tb=u}return BB(SJ(n.tb,t),138)}function NNn(n,t){var e,i,r,c,a;if((null==n.i&&qFn(n),n.i).length,!n.p){for(a=new XT(1+(3*n.g.i/2|0)),r=new ax(n.g);r.e!=r.i.gc();)i=BB(jpn(r),170),(e=BB(null==(c=i.ne())?jCn(a.f,null,i):ubn(a.g,c,i),170))&&(null==c?jCn(a.f,null,e):ubn(a.g,c,e));n.p=a}return BB(SJ(n.p,t),170)}function xNn(n,t,e,i,r){var c,a,u,o;for(wgn(i+CY(e,e.$d()),r),tW(t,Lwn(e)),(c=e.f)&&xNn(n,t,c,"Caused by: ",!1),null==e.k&&(e.k=x8(Jnt,sVn,78,0,0,1)),u=0,o=(a=e.k).length;u<o;++u)xNn(n,t,a[u],"Suppressed: ",!1);null!=console.groupEnd&&console.groupEnd.call(console)}function DNn(n,t,e,i){var r,c,a,u;for(a=(u=t.e).length,c=t.q._f(u,e?0:a-1,e),c|=gRn(n,u[e?0:a-1],e,i),r=e?1:a-2;e?r<a:r>=0;r+=e?1:-1)c|=t.c.Sf(u,r,e,i&&!qy(TD(mMn(t.j,(hWn(),Jft))))&&!qy(TD(mMn(t.j,(hWn(),Ilt))))),c|=t.q._f(u,r,e),c|=gRn(n,u[r],e,i);return TU(n.c,t),c}function RNn(n,t,e){var i,r,c,a,u,o,s,h;for(s=0,h=(o=I2(n.j)).length;s<h;++s){if(u=o[s],e==(ain(),Hvt)||e==Gvt)for(c=0,a=(r=Z0(u.g)).length;c<a;++c)OSn(t,i=r[c])&&tBn(i,!0);if(e==qvt||e==Gvt)for(c=0,a=(r=Z0(u.e)).length;c<a;++c)ISn(t,i=r[c])&&tBn(i,!0)}}function KNn(n){var t,e;switch(t=null,e=null,eEn(n).g){case 1:kUn(),t=oIt,e=CIt;break;case 2:kUn(),t=SIt,e=sIt;break;case 3:kUn(),t=CIt,e=oIt;break;case 4:kUn(),t=sIt,e=SIt}Gl(n,BB($N(Oz(BB(h6(n.k,t),15).Oc(),Qst)),113)),ql(n,BB($N(Iz(BB(h6(n.k,e),15).Oc(),Qst)),113))}function _Nn(n){var t,e,i,r,c,a;if((r=BB(xq(n.j,0),11)).e.c.length+r.g.c.length==0)n.n.a=0;else{for(a=0,i=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[new Hw(r),new Gw(r)])));dAn(i);)a+=(e=BB(U5(i),11)).i.n.a+e.n.a+e.a.a;c=(t=BB(mMn(n,(HXn(),npt)),8))?t.a:0,n.n.a=a/(r.e.c.length+r.g.c.length)-c}}function FNn(n,t){var e,i,r;for(i=new Wb(t.a);i.a<i.c.c.length;)e=BB(n0(i),221),LG(BB(e.b,65),XR(B$(BB(t.b,65).c),BB(t.b,65).a)),(r=Y_n(BB(t.b,65).b,BB(e.b,65).b))>1&&(n.a=!0),NG(BB(e.b,65),UR(B$(BB(t.b,65).c),kL(XR(B$(BB(e.b,65).a),BB(t.b,65).a),r))),QZ(n,t),FNn(n,e)}function BNn(n){var t,e,i,r,c,a;for(r=new Wb(n.a.a);r.a<r.c.c.length;)(e=BB(n0(r),189)).e=0,e.d.a.$b();for(i=new Wb(n.a.a);i.a<i.c.c.length;)for(t=(e=BB(n0(i),189)).a.a.ec().Kc();t.Ob();)for(a=BB(t.Pb(),81).f.Kc();a.Ob();)(c=BB(a.Pb(),81)).d!=e&&(TU(e.d,c),++c.d.e)}function HNn(n){var t,e,i,r,c,a,u,o;for(e=0,t=o=n.j.c.length,r=2*o,u=new Wb(n.j);u.a<u.c.c.length;)switch((a=BB(n0(u),11)).j.g){case 2:case 4:a.p=-1;break;case 1:case 3:i=a.e.c.length,c=a.g.c.length,a.p=i>0&&c>0?t++:i>0?e++:c>0?r++:e++}SQ(),m$(n.j,new bi)}function qNn(n){var t,e;e=null,t=BB(xq(n.g,0),17);do{if(Lx(e=t.d.i,(hWn(),flt)))return BB(mMn(e,flt),11).i;if(e.k!=(uSn(),Cut)&&dAn(new oz(ZL(lbn(e).a.Kc(),new h))))t=BB(U5(new oz(ZL(lbn(e).a.Kc(),new h))),17);else if(e.k!=Cut)return null}while(e&&e.k!=(uSn(),Cut));return e}function GNn(n,t){var e,i,r,c,a,u,o,s,h;for(u=t.j,a=t.g,o=BB(xq(u,u.c.length-1),113),l1(0,u.c.length),s=Zmn(n,a,o,h=BB(u.c[0],113)),c=1;c<u.c.length;c++)l1(c-1,u.c.length),e=BB(u.c[c-1],113),l1(c,u.c.length),(i=Zmn(n,a,e,r=BB(u.c[c],113)))>s&&(o=e,h=r,s=i);t.a=h,t.c=o}function zNn(n,t){var e;if(!ZU(n.b,t.b))throw Hp(new Fy("Invalid hitboxes for scanline constraint calculation."));(kun(t.b,BB(MR(n.b,t.b),57))||kun(t.b,BB(TR(n.b,t.b),57)))&&($T(),t.b),n.a[t.b.f]=BB(kK(n.b,t.b),57),(e=BB(yK(n.b,t.b),57))&&(n.a[e.f]=t.b)}function UNn(n){if(!n.a.d||!n.a.e)throw Hp(new Fy((ED(Hit),Hit.k+" must have a source and target "+(ED(qit),qit.k+" specified."))));if(n.a.d==n.a.e)throw Hp(new Fy("Network simplex does not support self-loops: "+n.a+" "+n.a.d+" "+n.a.e));return RN(n.a.d.g,n.a),RN(n.a.e.b,n.a),n.a}function XNn(n,t,e){var i,r,c,a,u,o,s;for(s=new dE(new Jd(n)),u=0,o=(a=Pun(Gk(Gut,1),u1n,11,0,[t,e])).length;u<o;++u)for(c=a[u],Mon(s.a,c,(hN(),ptt)),r=new m6(c.b);y$(r.a)||y$(r.b);)(i=BB(y$(r.a)?n0(r.a):n0(r.b),17)).c==i.d||ZU(s,c==i.c?i.d:i.c);return yX(s),new t_(s)}function WNn(n,t,e){var i,r,c,a,u,o;if(i=0,0!=t.b&&0!=e.b){c=spn(t,0),a=spn(e,0),u=Gy(MD(b3(c))),o=Gy(MD(b3(a))),r=!0;do{if(u>o-n.b&&u<o+n.b)return-1;u>o-n.a&&u<o+n.a&&++i,u<=o&&c.b!=c.d.c?u=Gy(MD(b3(c))):o<=u&&a.b!=a.d.c?o=Gy(MD(b3(a))):r=!1}while(r)}return i}function VNn(n,t,e,i,r){var c,a,u,o;for(o=new YK(c=BB(Vj(FIt),9),BB(SR(c,c.length),9),0),u=new Wb(n.j);u.a<u.c.c.length;)t[(a=BB(n0(u),11)).p]&&(BUn(a,t[a.p],i),orn(o,a.j));r?(GEn(n,t,(kUn(),oIt),2*e,i),GEn(n,t,CIt,2*e,i)):(GEn(n,t,(kUn(),sIt),2*e,i),GEn(n,t,SIt,2*e,i))}function QNn(n){var t,e,i,r,c;if(c=new Np,Otn(n.b,new kw(c)),n.b.c=x8(Ant,HWn,1,0,5,1),0!=c.c.length){for(l1(0,c.c.length),t=BB(c.c[0],78),e=1,i=c.c.length;e<i;++e)l1(e,c.c.length),(r=BB(c.c[e],78))!=t&>n(t,r);if(cL(t,60))throw Hp(BB(t,60));if(cL(t,289))throw Hp(BB(t,289))}}function YNn(n,t){var e,i,r,c;for(n=null==n?zWn:(kW(n),n),e=new Ik,c=0,i=0;i<t.length&&-1!=(r=n.indexOf("%s",c));)oO(e,n.substr(c,r-c)),uO(e,t[i++]),c=r+2;if(oO(e,n.substr(c)),i<t.length){for(e.a+=" [",uO(e,t[i++]);i<t.length;)e.a+=FWn,uO(e,t[i++]);e.a+="]"}return e.a}function JNn(n){var t,e,i,r;for(t=0,r=(i=n.length)-4,e=0;e<r;)b1(e+3,n.length),t=n.charCodeAt(e+3)+(b1(e+2,n.length),31*(n.charCodeAt(e+2)+(b1(e+1,n.length),31*(n.charCodeAt(e+1)+(b1(e,n.length),31*(n.charCodeAt(e)+31*t)))))),t|=0,e+=4;for(;e<i;)t=31*t+fV(n,e++);return t|=0}function ZNn(n){var t;for(t=new oz(ZL(lbn(n).a.Kc(),new h));dAn(t);)if(BB(U5(t),17).d.i.k!=(uSn(),Sut))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to LAST, but has at least one outgoing edge that does not go to a LAST_SEPARATE node. That must not happen."))}function nxn(n,t,i,r){var c,a,u,o,s,f,l;for(o=0,s=new Wb(n.a);s.a<s.c.c.length;){for(u=0,a=new oz(ZL(fbn(BB(n0(s),10)).a.Kc(),new h));dAn(a);)f=g1((c=BB(U5(a),17)).c).b,l=g1(c.d).b,u=e.Math.max(u,e.Math.abs(l-f));o=e.Math.max(o,u)}return r*e.Math.min(1,t/i)*o}function txn(n){var t;return t=new Pk,0!=(256&n)&&(t.a+="F"),0!=(128&n)&&(t.a+="H"),0!=(512&n)&&(t.a+="X"),0!=(2&n)&&(t.a+="i"),0!=(8&n)&&(t.a+="m"),0!=(4&n)&&(t.a+="s"),0!=(32&n)&&(t.a+="u"),0!=(64&n)&&(t.a+="w"),0!=(16&n)&&(t.a+="x"),0!=(n&k6n)&&(t.a+=","),Uy(t.a)}function exn(n,t){var e,i,r;for(OTn(t,"Resize child graph to fit parent.",1),i=new Wb(n.b);i.a<i.c.c.length;)e=BB(n0(i),29),gun(n.a,e.a),e.a.c=x8(Ant,HWn,1,0,5,1);for(r=new Wb(n.a);r.a<r.c.c.length;)PZ(BB(n0(r),10),null);n.b.c=x8(Ant,HWn,1,0,5,1),Bxn(n),n.e&&S_n(n.e,n),HSn(t)}function ixn(n){var t,e,i,r,c,a,u;if(r=(i=n.b).e,c=LK(BB(mMn(i,(HXn(),ept)),98)),e=!!r&&BB(mMn(r,(hWn(),Zft)),21).Hc((bDn(),lft)),!c&&!e)for(u=new Kb(new Ob(n.e).a.vc().Kc());u.a.Ob();)t=BB(u.a.Pb(),42),(a=BB(t.dd(),113)).a&&(CZ(a.d,null),a.c=!0,n.a=!0)}function rxn(n){var t,e,i,r,c,a,u,o,s,h,f,l;for(f=-1,l=0,s=0,h=(o=n).length;s<h;++s){for(a=0,u=(c=o[s]).length;a<u;++a)for(r=c[a],t=new pP(-1==f?n[0]:n[f],okn(r)),e=0;e<r.j.c.length;e++)for(i=e+1;i<r.j.c.length;i++)Nz(t,BB(xq(r.j,e),11),BB(xq(r.j,i),11))>0&&++l;++f}return l}function cxn(n,t){var e,i,r,c,a;for(a=BB(mMn(t,(CAn(),Lkt)),425),c=spn(t.b,0);c.b!=c.d.c;)if(r=BB(b3(c),86),0==n.b[r.g]){switch(a.g){case 0:Qvn(n,r);break;case 1:HAn(n,r)}n.b[r.g]=2}for(i=spn(n.a,0);i.b!=i.d.c;)ywn((e=BB(b3(i),188)).b.d,e,!0),ywn(e.c.b,e,!0);hon(t,(qqn(),lkt),n.a)}function axn(n,t){var e,i,r,c;return ZM(),t?t==(Uqn(),KLt)||(t==yLt||t==vLt||t==mLt)&&n!=pLt?new cUn(n,t):((e=(i=BB(t,677)).pk())||(kV(B7((IPn(),Z$t),t)),e=i.pk()),!e.i&&(e.i=new xp),!(r=BB(qI(AY((c=e.i).f,n)),1942))&&VW(c,n,r=new cUn(n,t)),r):aLt}function uxn(n,t){var e,i,r,c,a,u,o,s;for(u=BB(mMn(n,(hWn(),dlt)),11),o=Aon(Pun(Gk(PMt,1),sVn,8,0,[u.i.n,u.n,u.a])).a,s=n.i.n.b,r=0,c=(i=Z0(n.e)).length;r<c;++r)MZ(e=i[r],u),fO(e.a,new xC(o,s)),t&&((a=BB(mMn(e,(HXn(),vgt)),74))||(a=new km,hon(e,vgt,a)),DH(a,new xC(o,s)))}function oxn(n,t){var e,i,r,c,a,u,o,s;for(i=BB(mMn(n,(hWn(),dlt)),11),o=Aon(Pun(Gk(PMt,1),sVn,8,0,[i.i.n,i.n,i.a])).a,s=n.i.n.b,a=0,u=(c=Z0(n.g)).length;a<u;++a)SZ(r=c[a],i),hO(r.a,new xC(o,s)),t&&((e=BB(mMn(r,(HXn(),vgt)),74))||(e=new km,hon(r,vgt,e)),DH(e,new xC(o,s)))}function sxn(n,t){var e,i,r,c,a;for(n.b=new Np,n.d=BB(mMn(t,(hWn(),Slt)),230),n.e=c0(n.d),c=new YT,r=u6(Pun(Gk(jut,1),JZn,37,0,[t])),a=0;a<r.c.length;)l1(a,r.c.length),(i=BB(r.c[a],37)).p=a++,gun(r,(e=new CGn(i,n.a,n.b)).b),WB(n.b,e),e.s&&nX(spn(c,0),e);return n.c=new Rv,c}function hxn(n,t){var e,i,r,c,a,u;for(a=BB(BB(h6(n.r,t),21),84).Kc();a.Ob();)(e=(c=BB(a.Pb(),111)).c?VH(c.c):0)>0?c.a?e>(u=c.b.rf().a)&&(r=(e-u)/2,c.d.b=r,c.d.c=r):c.d.c=n.s+e:Hz(n.u)&&((i=_Tn(c.b)).c<0&&(c.d.b=-i.c),i.c+i.b>c.b.rf().a&&(c.d.c=i.c+i.b-c.b.rf().a))}function fxn(n,t){var e,i;for(OTn(t,"Semi-Interactive Crossing Minimization Processor",1),e=!1,i=new Wb(n.b);i.a<i.c.c.length;)e|=null!=$fn(ytn(AV(AV(new Rq(null,new w1(BB(n0(i),29).a,16)),new Qi),new Yi),new Ji),new Zi).a;e&&hon(n,(hWn(),alt),(hN(),!0)),HSn(t)}function lxn(n,t,e){var i,r,c;if(!(r=e)&&(r=new Xm),OTn(r,"Layout",n.a.c.length),qy(TD(mMn(t,(CAn(),Ekt)))))for($T(),i=0;i<n.a.c.length;i++)i++,nE(tsn(BB(xq(n.a,i),51)));for(c=new Wb(n.a);c.a<c.c.c.length;)BB(n0(c),51).pf(t,mcn(r,1));HSn(r)}function bxn(n){var t,i;if(t=BB(n.a,19).a,i=BB(n.b,19).a,t>=0){if(t==i)return new rI(iln(-t-1),iln(-t-1));if(t==-i)return new rI(iln(-t),iln(i+1))}return e.Math.abs(t)>e.Math.abs(i)?new rI(iln(-t),iln(t<0?i:i+1)):new rI(iln(t+1),iln(i))}function wxn(n){var t,e;e=BB(mMn(n,(HXn(),kgt)),163),t=BB(mMn(n,(hWn(),ilt)),303),e==(Tbn(),Flt)?(hon(n,kgt,qlt),hon(n,ilt,(z7(),Cft))):e==Hlt?(hon(n,kgt,qlt),hon(n,ilt,(z7(),Sft))):t==(z7(),Cft)?(hon(n,kgt,Flt),hon(n,ilt,Pft)):t==Sft&&(hon(n,kgt,Hlt),hon(n,ilt,Pft))}function dxn(){dxn=O,jyt=new oa,vyt=dq(new B2,(yMn(),_at),(lWn(),jot)),kyt=WG(dq(new B2,_at,Dot),Bat,xot),Eyt=ogn(ogn(FM(WG(dq(new B2,Rat,Uot),Bat,zot),Fat),Got),Xot),myt=WG(dq(dq(dq(new B2,Kat,Mot),Fat,Pot),Fat,Cot),Bat,Sot),yyt=WG(dq(dq(new B2,Fat,Cot),Fat,uot),Bat,aot)}function gxn(){gxn=O,Cyt=dq(WG(new B2,(yMn(),Bat),(lWn(),hot)),_at,jot),$yt=ogn(ogn(FM(WG(dq(new B2,Rat,Uot),Bat,zot),Fat),Got),Xot),Iyt=WG(dq(dq(dq(new B2,Kat,Mot),Fat,Pot),Fat,Cot),Bat,Sot),Ayt=dq(dq(new B2,_at,Dot),Bat,xot),Oyt=WG(dq(dq(new B2,Fat,Cot),Fat,uot),Bat,aot)}function pxn(n,t,e,i,r){var c,a;(b5(t)||t.c.i.c!=t.d.i.c)&&nrn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])),e)||b5(t)||(t.c==r?Kx(t.a,0,new wA(e)):DH(t.a,new wA(e)),i&&!FT(n.a,e)&&((a=BB(mMn(t,(HXn(),vgt)),74))||(a=new km,hon(t,vgt,a)),r5(a,c=new wA(e),a.c.b,a.c),TU(n.a,c)))}function vxn(n){var t;for(t=new oz(ZL(fbn(n).a.Kc(),new h));dAn(t);)if(BB(U5(t),17).c.i.k!=(uSn(),Sut))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to FIRST, but has at least one incoming edge that does not come from a FIRST_SEPARATE node. That must not happen."))}function mxn(n,t,e){var i,r,c,a,u,o;if(0==(r=pbn(254&n.Db)))n.Eb=e;else{if(1==r)a=x8(Ant,HWn,1,2,5,1),0==Rmn(n,t)?(a[0]=e,a[1]=n.Eb):(a[0]=n.Eb,a[1]=e);else for(a=x8(Ant,HWn,1,r+1,5,1),c=een(n.Eb),i=2,u=0,o=0;i<=128;i<<=1)i==t?a[o++]=e:0!=(n.Db&i)&&(a[o++]=c[u++]);n.Eb=a}n.Db|=t}function yxn(n,t,i){var r,c,a,u;for(this.b=new Np,c=0,r=0,u=new Wb(n);u.a<u.c.c.length;)a=BB(n0(u),167),i&&KBn(a),WB(this.b,a),c+=a.o,r+=a.p;this.b.c.length>0&&(c+=(a=BB(xq(this.b,0),167)).o,r+=a.p),c*=2,r*=2,t>1?c=CJ(e.Math.ceil(c*t)):r=CJ(e.Math.ceil(r/t)),this.a=new qwn(c,r)}function kxn(n,t,i,r,c,a){var u,o,s,h,f,l,b,w,d,g;for(h=r,t.j&&t.o?(d=(b=BB(RX(n.f,t.A),57)).d.c+b.d.b,--h):d=t.a.c+t.a.b,f=c,i.q&&i.o?(s=(b=BB(RX(n.f,i.C),57)).d.c,++f):s=i.a.c,w=d+(o=(s-d)/e.Math.max(2,f-h)),l=h;l<f;++l)g=(u=BB(a.Xb(l),128)).a.b,u.a.c=w-g/2,w+=o}function jxn(n,t,e,i,r,c){var a,u,o,s,h,f;for(s=e.c.length,c&&(n.c=x8(ANt,hQn,25,t.length,15,1)),a=r?0:t.length-1;r?a<t.length:a>=0;a+=r?1:-1){for(u=t[a],o=i==(kUn(),oIt)?r?abn(u,i):ean(abn(u,i)):r?ean(abn(u,i)):abn(u,i),c&&(n.c[u.p]=o.gc()),f=o.Kc();f.Ob();)h=BB(f.Pb(),11),n.d[h.p]=s++;gun(e,o)}}function Exn(n,t,e){var i,r,c,a,u,o,s,h;for(c=Gy(MD(n.b.Kc().Pb())),s=Gy(MD(Wan(t.b))),i=kL(B$(n.a),s-e),r=kL(B$(t.a),e-c),kL(h=UR(i,r),1/(s-c)),this.a=h,this.b=new Np,u=!0,(a=n.b.Kc()).Pb();a.Ob();)o=Gy(MD(a.Pb())),u&&o-e>D3n&&(this.b.Fc(e),u=!1),this.b.Fc(o);u&&this.b.Fc(e)}function Txn(n){var t,e,i,r;if(hKn(n,n.n),n.d.c.length>0){for(nk(n.c);pAn(n,BB(n0(new Wb(n.e.a)),121))<n.e.a.c.length;){for(r=(t=Ryn(n)).e.e-t.d.e-t.a,t.e.j&&(r=-r),i=new Wb(n.e.a);i.a<i.c.c.length;)(e=BB(n0(i),121)).j&&(e.e+=r);nk(n.c)}nk(n.c),pIn(n,BB(n0(new Wb(n.e.a)),121)),gGn(n)}}function Mxn(n,t){var e,i,r,c,a;for(r=BB(h6(n.a,(LEn(),Mst)),15).Kc();r.Ob();)switch(i=BB(r.Pb(),101),e=BB(xq(i.j,0),113).d.j,m$(c=new t_(i.j),new Jr),t.g){case 1:NEn(n,c,e,(Crn(),Dst),1);break;case 0:NEn(n,new s1(c,0,a=_Ln(c)),e,(Crn(),Dst),0),NEn(n,new s1(c,a,c.c.length),e,Dst,1)}}function Sxn(n,t){var e,i;if(Nun(),e=T5(cin(),t.tg())){if(i=e.j,cL(n,239))return rZ(BB(n,33))?SN(i,(rpn(),sMt))||SN(i,hMt):SN(i,(rpn(),sMt));if(cL(n,352))return SN(i,(rpn(),uMt));if(cL(n,186))return SN(i,(rpn(),fMt));if(cL(n,354))return SN(i,(rpn(),oMt))}return!0}function Pxn(n,t,e){var i,r,c,a,u,o;if(c=(r=e).ak(),$xn(n.e,c)){if(c.hi())for(i=BB(n.g,119),a=0;a<n.i;++a)if(Nfn(u=i[a],r)&&a!=t)throw Hp(new _y(a8n))}else for(o=axn(n.e.Tg(),c),i=BB(n.g,119),a=0;a<n.i;++a)if(u=i[a],o.rl(u.ak())&&a!=t)throw Hp(new _y(I7n));return BB(ovn(n,t,e),72)}function Cxn(n,t){if(t instanceof Object)try{if(t.__java$exception=n,-1!=navigator.userAgent.toLowerCase().indexOf("msie")&&$doc.documentMode<9)return;var e=n;Object.defineProperties(t,{cause:{get:function(){var n=e.Zd();return n&&n.Xd()}},suppressed:{get:function(){return e.Yd()}}})}catch(i){}}function Ixn(n,t){var e,i,r,c,a;if(i=t>>5,t&=31,i>=n.d)return n.e<0?(ODn(),Ytt):(ODn(),eet);if(c=n.d-i,QSn(r=x8(ANt,hQn,25,c+1,15,1),c,n.a,i,t),n.e<0){for(e=0;e<i&&0==n.a[e];e++);if(e<i||t>0&&n.a[e]<<32-t!=0){for(e=0;e<c&&-1==r[e];e++)r[e]=0;e==c&&++c,++r[e]}}return X0(a=new lU(n.e,c,r)),a}function Oxn(n){var t,e,i,r;return e=new $w(r=WJ(n)),i=new Lw(r),gun(t=new Np,(!n.d&&(n.d=new hK(_Ot,n,8,5)),n.d)),gun(t,(!n.e&&(n.e=new hK(_Ot,n,7,4)),n.e)),BB(P4($V(AV(new Rq(null,new w1(t,16)),e),i),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Xet),Uet]))),21)}function Axn(n,t,e,i){var r,c,a,u,o;if(ZM(),u=BB(t,66).Oj(),$xn(n.e,t)){if(t.hi()&&UFn(n,t,i,cL(t,99)&&0!=(BB(t,18).Bb&BQn)))throw Hp(new _y(a8n))}else for(o=axn(n.e.Tg(),t),r=BB(n.g,119),a=0;a<n.i;++a)if(c=r[a],o.rl(c.ak()))throw Hp(new _y(I7n));sln(n,EPn(n,t,e),u?BB(i,72):Z3(t,i))}function $xn(n,t){var e,i,r;return ZM(),!!t.$j()||-2==t.Zj()&&(t==(TOn(),lLt)||t==sLt||t==hLt||t==fLt||!(Awn(r=n.Tg(),t)>=0)&&(!(e=Fqn((IPn(),Z$t),r,t))||((i=e.Zj())>1||-1==i)&&3!=DW(B7(Z$t,e))))}function Lxn(n,t,e,i){var r,c,a,u,o;return u=PTn(BB(Wtn((!t.b&&(t.b=new hK(KOt,t,4,7)),t.b),0),82)),o=PTn(BB(Wtn((!t.c&&(t.c=new hK(KOt,t,5,8)),t.c),0),82)),JJ(u)==JJ(o)||Ctn(o,u)?null:(a=XJ(t))==e?i:(c=BB(RX(n.a,a),10))&&(r=c.e)?r:null}function Nxn(n,t){var e;switch(OTn(t,"Label side selection ("+(e=BB(mMn(n,(HXn(),Jdt)),276))+")",1),e.g){case 0:TAn(n,(Xyn(),jCt));break;case 1:TAn(n,(Xyn(),ECt));break;case 2:sBn(n,(Xyn(),jCt));break;case 3:sBn(n,(Xyn(),ECt));break;case 4:uDn(n,(Xyn(),jCt));break;case 5:uDn(n,(Xyn(),ECt))}HSn(t)}function xxn(n,t,e){var i,r,c,a,u;if((c=n[lj(e,n.length)])[0].k==(uSn(),Mut))for(r=fj(e,c.length),u=t.j,i=0;i<u.c.length;i++)l1(i,u.c.length),a=BB(u.c[i],11),(e?a.j==(kUn(),oIt):a.j==(kUn(),CIt))&&qy(TD(mMn(a,(hWn(),elt))))&&(c5(u,i,BB(mMn(c[r],(hWn(),dlt)),11)),r+=e?1:-1)}function Dxn(n,t){var e,i,r,c,a;a=new Np,e=t;do{(c=BB(RX(n.b,e),128)).B=e.c,c.D=e.d,a.c[a.c.length]=c,e=BB(RX(n.k,e),17)}while(e);return l1(0,a.c.length),(i=BB(a.c[0],128)).j=!0,i.A=BB(i.d.a.ec().Kc().Pb(),17).c.i,(r=BB(xq(a,a.c.length-1),128)).q=!0,r.C=BB(r.d.a.ec().Kc().Pb(),17).d.i,a}function Rxn(n){if(null==n.g)switch(n.p){case 0:n.g=fZ(n)?(hN(),vtt):(hN(),ptt);break;case 1:n.g=Pnn(D3(n));break;case 2:n.g=fun(Q1(n));break;case 3:n.g=OW(n);break;case 4:n.g=new Nb(IW(n));break;case 6:n.g=jgn(AW(n));break;case 5:n.g=iln(hJ(n));break;case 7:n.g=rln(_3(n))}return n.g}function Kxn(n){if(null==n.n)switch(n.p){case 0:n.n=lZ(n)?(hN(),vtt):(hN(),ptt);break;case 1:n.n=Pnn(R3(n));break;case 2:n.n=fun(Y1(n));break;case 3:n.n=LW(n);break;case 4:n.n=new Nb(NW(n));break;case 6:n.n=jgn($W(n));break;case 5:n.n=iln(fJ(n));break;case 7:n.n=rln(K3(n))}return n.n}function _xn(n){var t,e,i,r,c,a;for(r=new Wb(n.a.a);r.a<r.c.c.length;)(e=BB(n0(r),307)).g=0,e.i=0,e.e.a.$b();for(i=new Wb(n.a.a);i.a<i.c.c.length;)for(t=(e=BB(n0(i),307)).a.a.ec().Kc();t.Ob();)for(a=BB(t.Pb(),57).c.Kc();a.Ob();)(c=BB(a.Pb(),57)).a!=e&&(TU(e.e,c),++c.a.g,++c.a.i)}function Fxn(n,t){var e,i,r;if(!ZU(n.a,t.b))throw Hp(new Fy("Invalid hitboxes for scanline overlap calculation."));for(r=!1,i=new Fb(new BR(new xN(new _b(n.a.a).a).b));aS(i.a.a);)if(e=BB(mx(i.a).cd(),65),eon(t.b,e))xj(n.b.a,t.b,e),r=!0;else if(r)break}function Bxn(n){var t,i,r,c,a;c=BB(mMn(n,(HXn(),Fgt)),21),a=BB(mMn(n,qgt),21),t=new wA(i=new xC(n.f.a+n.d.b+n.d.c,n.f.b+n.d.d+n.d.a)),c.Hc((mdn(),DIt))&&(r=BB(mMn(n,Hgt),8),a.Hc((n_n(),GIt))&&(r.a<=0&&(r.a=20),r.b<=0&&(r.b=20)),t.a=e.Math.max(i.a,r.a),t.b=e.Math.max(i.b,r.b)),XBn(n,i,t)}function Hxn(n,t){var e,i,r,c,a,u,o,s;r=t?new pc:new vc,c=!1;do{for(c=!1,a=(t?ean(n.b):n.b).Kc();a.Ob();)for(s=a0(BB(a.Pb(),29).a),t||new fy(s),o=new Wb(s);o.a<o.c.c.length;)u=BB(n0(o),10),r.Mb(u)&&(i=u,e=BB(mMn(u,(hWn(),Rft)),305),c=eRn(i,t?e.b:e.k,t,!1))}while(c)}function qxn(n,t,e){var i,r,c,a;for(OTn(e,"Longest path layering",1),n.a=t,a=n.a.a,n.b=x8(ANt,hQn,25,a.c.length,15,1),i=0,c=new Wb(a);c.a<c.c.c.length;)BB(n0(c),10).p=i,n.b[i]=-1,++i;for(r=new Wb(a);r.a<r.c.c.length;)D$n(n,BB(n0(r),10));a.c=x8(Ant,HWn,1,0,5,1),n.a=null,n.b=null,HSn(e)}function Gxn(n,t){var e,i,r;t.a?(ZU(n.b,t.b),n.a[t.b.i]=BB(kK(n.b,t.b),81),(e=BB(yK(n.b,t.b),81))&&(n.a[e.i]=t.b)):(!!(i=BB(kK(n.b,t.b),81))&&i==n.a[t.b.i]&&!!i.d&&i.d!=t.b.d&&i.f.Fc(t.b),!!(r=BB(yK(n.b,t.b),81))&&n.a[r.i]==t.b&&!!r.d&&r.d!=t.b.d&&t.b.f.Fc(r),MN(n.b,t.b))}function zxn(n,t){var i,r,c,a,u,o;return a=n.d,(o=Gy(MD(mMn(n,(HXn(),agt)))))<0&&hon(n,agt,o=0),t.o.b=o,u=e.Math.floor(o/2),qCn(r=new CSn,(kUn(),CIt)),CZ(r,t),r.n.b=u,qCn(c=new CSn,oIt),CZ(c,t),c.n.b=u,MZ(n,r),qan(i=new wY,n),hon(i,vgt,null),SZ(i,c),MZ(i,a),jFn(t,n,i),sCn(n,i),i}function Uxn(n){var t,e;return e=BB(mMn(n,(hWn(),Zft)),21),t=new B2,e.Hc((bDn(),bft))&&(Jcn(t,byt),Jcn(t,dyt)),(e.Hc(dft)||qy(TD(mMn(n,(HXn(),ugt)))))&&(Jcn(t,dyt),e.Hc(gft)&&Jcn(t,gyt)),e.Hc(lft)&&Jcn(t,lyt),e.Hc(vft)&&Jcn(t,pyt),e.Hc(wft)&&Jcn(t,wyt),e.Hc(sft)&&Jcn(t,hyt),e.Hc(fft)&&Jcn(t,fyt),t}function Xxn(n,t){var e,i,r,c,a,u,o,s,h;return c=(e=n.d)+(i=t.d),a=n.e!=t.e?-1:1,2==c?(h=dG(o=cbn(e0(n.a[0],UQn),e0(t.a[0],UQn))),0==(s=dG(jz(o,32)))?new X6(a,h):new lU(a,2,Pun(Gk(ANt,1),hQn,25,15,[h,s]))):(Dfn(n.a,e,t.a,i,r=x8(ANt,hQn,25,c,15,1)),X0(u=new lU(a,c,r)),u)}function Wxn(n,t,e,i){var r,c;return t?0==(r=n.a.ue(e.d,t.d))?(i.d=pR(t,e.e),i.b=!0,t):(c=r<0?0:1,t.a[c]=Wxn(n,t.a[c],e,i),Vy(t.a[c])&&(Vy(t.a[1-c])?(t.b=!0,t.a[0].b=!1,t.a[1].b=!1):Vy(t.a[c].a[c])?t=wrn(t,1-c):Vy(t.a[c].a[1-c])&&(t=r2(t,1-c))),t):e}function Vxn(n,t,i){var r,c,a,u;c=n.i,r=n.n,Y5(n,(Dtn(),Git),c.c+r.b,i),Y5(n,Uit,c.c+c.b-r.c-i[2],i),u=c.b-r.b-r.c,i[0]>0&&(i[0]+=n.d,u-=i[0]),i[2]>0&&(i[2]+=n.d,u-=i[2]),a=e.Math.max(0,u),i[1]=e.Math.max(i[1],u),Y5(n,zit,c.c+r.b+i[0]-(i[1]-u)/2,i),t==zit&&(n.c.b=a,n.c.c=c.c+r.b+(a-u)/2)}function Qxn(){this.c=x8(xNt,qQn,25,(kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,15,1),this.b=x8(xNt,qQn,25,Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt]).length,15,1),this.a=x8(xNt,qQn,25,Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt]).length,15,1),mS(this.c,RQn),mS(this.b,KQn),mS(this.a,KQn)}function Yxn(n,t,e){var i,r,c,a;if(t<=e?(r=t,c=e):(r=e,c=t),i=0,null==n.b)n.b=x8(ANt,hQn,25,2,15,1),n.b[0]=r,n.b[1]=c,n.c=!0;else{if(i=n.b.length,n.b[i-1]+1==r)return void(n.b[i-1]=c);a=x8(ANt,hQn,25,i+2,15,1),aHn(n.b,0,a,0,i),n.b=a,n.b[i-1]>=r&&(n.c=!1,n.a=!1),n.b[i++]=r,n.b[i]=c,n.c||T$n(n)}}function Jxn(n,t,e){var i,r,c,a,u,o,s;for(s=t.d,n.a=new J6(s.c.length),n.c=new xp,u=new Wb(s);u.a<u.c.c.length;)a=BB(n0(u),101),c=new Fan(null),WB(n.a,c),VW(n.c,a,c);for(n.b=new xp,vCn(n,t),i=0;i<s.c.length-1;i++)for(o=BB(xq(t.d,i),101),r=i+1;r<s.c.length;r++)WLn(n,o,BB(xq(t.d,r),101),e)}function Zxn(n,t,e){var i,r,c,a,u,o;if(!h3(t)){for(OTn(o=mcn(e,(cL(t,14)?BB(t,14).gc():F3(t.Kc()))/n.a|0),z3n,1),u=new Ia,a=0,c=t.Kc();c.Ob();)i=BB(c.Pb(),86),u=Wen(Pun(Gk(xnt,1),HWn,20,0,[u,new bg(i)])),a<i.f.b&&(a=i.f.b);for(r=t.Kc();r.Ob();)hon(i=BB(r.Pb(),86),(qqn(),ukt),a);HSn(o),Zxn(n,u,e)}}function nDn(n,t){var i,r,c,a,u,o,s;for(i=KQn,uSn(),o=Cut,c=new Wb(t.a);c.a<c.c.c.length;)(a=(r=BB(n0(c),10)).k)!=Cut&&(null==(u=MD(mMn(r,(hWn(),plt))))?(i=e.Math.max(i,0),r.n.b=i+XN(n.a,a,o)):r.n.b=(kW(u),u)),s=XN(n.a,a,o),r.n.b<i+s+r.d.d&&(r.n.b=i+s+r.d.d),i=r.n.b+r.o.b+r.d.a,o=a}function tDn(n,t,e){var i,r,c;for(qan(c=new EAn(XXn(qSn(cDn(t,!1,!1)),Gy(MD(ZAn(t,(Epn(),pct))))+n.a)),t),VW(n.b,t,c),e.c[e.c.length]=c,!t.n&&(t.n=new eU(zOt,t,1,7)),r=new AL(t.n);r.e!=r.i.gc();)i=JRn(n,BB(kpn(r),137),!0,0,0),e.c[e.c.length]=i;return c}function eDn(n,t,e,i,r){var c,a,u;if(n.d&&n.d.lg(r),Dvn(n,e,BB(r.Xb(0),33),!1))return!0;if(Dvn(n,i,BB(r.Xb(r.gc()-1),33),!0))return!0;if(NMn(n,r))return!0;for(u=r.Kc();u.Ob();)for(a=BB(u.Pb(),33),c=t.Kc();c.Ob();)if(_Dn(n,a,BB(c.Pb(),33)))return!0;return!1}function iDn(n,t,e){var i,r,c,a,u,o,s,h,f;f=t.c.length;n:for(c=BB((s=n.Yg(e))>=0?n._g(s,!1,!0):cOn(n,e,!1),58).Kc();c.Ob();){for(r=BB(c.Pb(),56),h=0;h<f;++h)if(l1(h,t.c.length),o=(a=BB(t.c[h],72)).dd(),u=a.ak(),i=r.bh(u,!1),null==o?null!=i:!Nfn(o,i))continue n;return r}return null}function rDn(n,t,e,i){var r,c,a,u;for(r=BB(DSn(t,(kUn(),CIt)).Kc().Pb(),11),c=BB(DSn(t,oIt).Kc().Pb(),11),u=new Wb(n.j);u.a<u.c.c.length;){for(a=BB(n0(u),11);0!=a.e.c.length;)MZ(BB(xq(a.e,0),17),r);for(;0!=a.g.c.length;)SZ(BB(xq(a.g,0),17),c)}e||hon(t,(hWn(),hlt),null),i||hon(t,(hWn(),flt),null)}function cDn(n,t,e){var i,r;if(0==(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)return qun(n);if(i=BB(Wtn((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),0),202),t&&(sqn((!i.a&&(i.a=new $L(xOt,i,5)),i.a)),Ien(i,0),Aen(i,0),Ten(i,0),Oen(i,0)),e)for(!n.a&&(n.a=new eU(FOt,n,6,6)),r=n.a;r.i>1;)fDn(r,r.i-1);return i}function aDn(n,t){var e,i,r,c,a,u,o;for(OTn(t,"Comment post-processing",1),c=new Wb(n.b);c.a<c.c.c.length;){for(r=BB(n0(c),29),i=new Np,u=new Wb(r.a);u.a<u.c.c.length;)a=BB(n0(u),10),o=BB(mMn(a,(hWn(),Klt)),15),e=BB(mMn(a,Dft),15),(o||e)&&(Wzn(a,o,e),o&&gun(i,o),e&&gun(i,e));gun(r.a,i)}HSn(t)}function uDn(n,t){var e,i,r,c,a,u;for(e=new Lp,r=new Wb(n.b);r.a<r.c.c.length;){for(u=!0,i=0,a=new Wb(BB(n0(r),29).a);a.a<a.c.c.length;)switch((c=BB(n0(a),10)).k.g){case 4:++i;case 1:w3(e,c);break;case 0:oCn(c,t);default:e.b==e.c||p_n(e,i,u,!1,t),u=!1,i=0}e.b==e.c||p_n(e,i,u,!0,t)}}function oDn(n,t){var e,i,r,c,a,u;for(r=new Np,e=0;e<=n.i;e++)(i=new HX(t)).p=n.i-e,r.c[r.c.length]=i;for(u=new Wb(n.o);u.a<u.c.c.length;)PZ(a=BB(n0(u),10),BB(xq(r,n.i-n.f[a.p]),29));for(c=new Wb(r);c.a<c.c.c.length;)0==BB(n0(c),29).a.c.length&&AU(c);t.b.c=x8(Ant,HWn,1,0,5,1),gun(t.b,r)}function sDn(n,t){var e,i,r,c,a,u;for(e=0,u=new Wb(t);u.a<u.c.c.length;){for(a=BB(n0(u),11),nhn(n.b,n.d[a.p]),r=new m6(a.b);y$(r.a)||y$(r.b);)(c=ME(n,a==(i=BB(y$(r.a)?n0(r.a):n0(r.b),17)).c?i.d:i.c))>n.d[a.p]&&(e+=n5(n.b,c),d3(n.a,iln(c)));for(;!Wy(n.a);)Mnn(n.b,BB(dU(n.a),19).a)}return e}function hDn(n,t,e){var i,r,c,a;for(c=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,r=new AL((!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));r.e!=r.i.gc();)0==(!(i=BB(kpn(r),33)).a&&(i.a=new eU(UOt,i,10,11)),i.a).i||(c+=hDn(n,i,!1));if(e)for(a=JJ(t);a;)c+=(!a.a&&(a.a=new eU(UOt,a,10,11)),a.a).i,a=JJ(a);return c}function fDn(n,t){var e,i,r,c;return n.ej()?(i=null,r=n.fj(),n.ij()&&(i=n.kj(n.pi(t),null)),e=n.Zi(4,c=Lyn(n,t),null,t,r),n.bj()&&null!=c?(i=n.dj(c,i))?(i.Ei(e),i.Fi()):n.$i(e):i?(i.Ei(e),i.Fi()):n.$i(e),c):(c=Lyn(n,t),n.bj()&&null!=c&&(i=n.dj(c,null))&&i.Fi(),c)}function lDn(n){var t,i,r,c,a,u,o,s,h,f;for(h=n.a,t=new Rv,s=0,r=new Wb(n.d);r.a<r.c.c.length;){for(f=0,_rn((i=BB(n0(r),222)).b,new $n),u=spn(i.b,0);u.b!=u.d.c;)a=BB(b3(u),222),t.a._b(a)&&(c=i.c,f<(o=a.c).d+o.a+h&&f+c.a+h>o.d&&(f=o.d+o.a+h));i.c.d=f,t.a.zc(i,t),s=e.Math.max(s,i.c.d+i.c.a)}return s}function bDn(){bDn=O,hft=new LP("COMMENTS",0),lft=new LP("EXTERNAL_PORTS",1),bft=new LP("HYPEREDGES",2),wft=new LP("HYPERNODES",3),dft=new LP("NON_FREE_PORTS",4),gft=new LP("NORTH_SOUTH_PORTS",5),vft=new LP(G1n,6),sft=new LP("CENTER_LABELS",7),fft=new LP("END_LABELS",8),pft=new LP("PARTITIONS",9)}function wDn(n){var t,e,i,r,c;for(r=new Np,t=new $q((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a)),i=new oz(ZL(dLn(n).a.Kc(),new h));dAn(i);)cL(Wtn((!(e=BB(U5(i),79)).b&&(e.b=new hK(KOt,e,4,7)),e.b),0),186)||(c=PTn(BB(Wtn((!e.c&&(e.c=new hK(KOt,e,5,8)),e.c),0),82)),t.a._b(c)||(r.c[r.c.length]=c));return r}function dDn(n){var t,e,i,r,c;for(r=new Rv,t=new $q((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a)),i=new oz(ZL(dLn(n).a.Kc(),new h));dAn(i);)cL(Wtn((!(e=BB(U5(i),79)).b&&(e.b=new hK(KOt,e,4,7)),e.b),0),186)||(c=PTn(BB(Wtn((!e.c&&(e.c=new hK(KOt,e,5,8)),e.c),0),82)),t.a._b(c)||r.a.zc(c,r));return r}function gDn(n,t,e,i,r){return i<0?((i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn]),t))<0&&(i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),t)),!(i<0||(e.k=i,0))):i>0&&(e.k=i-1,!0)}function pDn(n,t,e,i,r){return i<0?((i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn]),t))<0&&(i=zTn(n,r,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),t)),!(i<0||(e.k=i,0))):i>0&&(e.k=i-1,!0)}function vDn(n,t,e,i,r,c){var a,u,o;if(u=32,i<0){if(t[0]>=n.length)return!1;if(43!=(u=fV(n,t[0]))&&45!=u)return!1;if(++t[0],(i=UIn(n,t))<0)return!1;45==u&&(i=-i)}return 32==u&&t[0]-e==2&&2==r.b&&(a=(o=(new AT).q.getFullYear()-sQn+sQn-80)%100,c.a=i==a,i+=100*(o/100|0)+(i<a?100:0)),c.p=i,!0}function mDn(n,t){var i,r,c;JJ(n)&&(c=BB(mMn(t,(HXn(),Fgt)),174),GI(ZAn(n,ept))===GI((QEn(),YCt))&&Ypn(n,ept,QCt),GM(),r=qzn(new Dy(JJ(n)),new JN(JJ(n)?new Dy(JJ(n)):null,n),!1,!0),orn(c,(mdn(),DIt)),(i=BB(mMn(t,Hgt),8)).a=e.Math.max(r.a,i.a),i.b=e.Math.max(r.b,i.b))}function yDn(n,t,e){var i,r,c,a,u,o;for(a=BB(mMn(n,(hWn(),nlt)),15).Kc();a.Ob();){switch(c=BB(a.Pb(),10),BB(mMn(c,(HXn(),kgt)),163).g){case 2:PZ(c,t);break;case 4:PZ(c,e)}for(r=new oz(ZL(hbn(c).a.Kc(),new h));dAn(r);)(i=BB(U5(r),17)).c&&i.d||(u=!i.d,o=BB(mMn(i,mlt),11),u?MZ(i,o):SZ(i,o))}}function kDn(){kDn=O,Bst=new WV(mJn,0,(kUn(),sIt),sIt),Gst=new WV(kJn,1,SIt,SIt),Fst=new WV(yJn,2,oIt,oIt),Xst=new WV(jJn,3,CIt,CIt),qst=new WV("NORTH_WEST_CORNER",4,CIt,sIt),Hst=new WV("NORTH_EAST_CORNER",5,sIt,oIt),Ust=new WV("SOUTH_WEST_CORNER",6,SIt,CIt),zst=new WV("SOUTH_EAST_CORNER",7,oIt,SIt)}function jDn(){jDn=O,MMt=Pun(Gk(LNt,1),FQn,25,14,[1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368e3,{l:3506176,m:794077,h:1},{l:884736,m:916411,h:20},{l:3342336,m:3912489,h:363},{l:589824,m:3034138,h:6914},{l:3407872,m:1962506,h:138294}]),e.Math.pow(2,-65)}function EDn(n,t){var e,i,r,c,a;if(0==n.c.length)return new rI(iln(0),iln(0));for(e=(l1(0,n.c.length),BB(n.c[0],11)).j,a=0,c=t.g,i=t.g+1;a<n.c.length-1&&e.g<c;)e=(l1(++a,n.c.length),BB(n.c[a],11)).j;for(r=a;r<n.c.length-1&&e.g<i;)++r,e=(l1(a,n.c.length),BB(n.c[a],11)).j;return new rI(iln(a),iln(r))}function TDn(n,t,i){var r,c,a,u,o,s,h,f,l,b;for(a=t.c.length,l1(i,t.c.length),o=(u=BB(t.c[i],286)).a.o.a,l=u.c,b=0,h=u.c;h<=u.f;h++){if(o<=n.a[h])return h;for(f=n.a[h],s=null,c=i+1;c<a;c++)l1(c,t.c.length),(r=BB(t.c[c],286)).c<=h&&r.f>=h&&(s=r);s&&(f=e.Math.max(f,s.a.o.a)),f>b&&(l=h,b=f)}return l}function MDn(n,t,e){var i,r,c;if(n.e=e,n.d=0,n.b=0,n.f=1,n.i=t,16==(16&n.e)&&(n.i=pKn(n.i)),n.j=n.i.length,QXn(n),c=Vdn(n),n.d!=n.j)throw Hp(new ak(kWn((u$(),w8n))));if(n.g){for(i=0;i<n.g.a.c.length;i++)if(r=BB(bW(n.g,i),584),n.f<=r.a)throw Hp(new ak(kWn((u$(),d8n))));n.g.a.c=x8(Ant,HWn,1,0,5,1)}return c}function SDn(n,t){var e,i,r;if(null==t){for(!n.a&&(n.a=new eU(WAt,n,9,5)),i=new AL(n.a);i.e!=i.i.gc();)if(null==(null==(r=(e=BB(kpn(i),678)).c)?e.zb:r))return e}else for(!n.a&&(n.a=new eU(WAt,n,9,5)),i=new AL(n.a);i.e!=i.i.gc();)if(mK(t,null==(r=(e=BB(kpn(i),678)).c)?e.zb:r))return e;return null}function PDn(n,t){var e;switch(e=null,t.g){case 1:n.e.Xe((sWn(),ePt))&&(e=BB(n.e.We(ePt),249));break;case 3:n.e.Xe((sWn(),iPt))&&(e=BB(n.e.We(iPt),249));break;case 2:n.e.Xe((sWn(),tPt))&&(e=BB(n.e.We(tPt),249));break;case 4:n.e.Xe((sWn(),rPt))&&(e=BB(n.e.We(rPt),249))}return!e&&(e=BB(n.e.We((sWn(),ZSt)),249)),e}function CDn(n,t,e){var i,r,c,a,u,o;for(t.p=1,r=t.c,o=xwn(t,(ain(),qvt)).Kc();o.Ob();)for(i=new Wb(BB(o.Pb(),11).g);i.a<i.c.c.length;)t!=(u=BB(n0(i),17).d.i)&&u.c.p<=r.p&&((c=r.p+1)==e.b.c.length?((a=new HX(e)).p=c,WB(e.b,a),PZ(u,a)):PZ(u,a=BB(xq(e.b,c),29)),CDn(n,u,e))}function IDn(n,t,i){var r,c,a,u,o,s;for(c=i,a=0,o=new Wb(t);o.a<o.c.c.length;)Ypn(u=BB(n0(o),33),(Uyn(),Ljt),iln(c++)),s=wDn(u),r=e.Math.atan2(u.j+u.f/2,u.i+u.g/2),(r+=r<0?Z3n:0)<.7853981633974483||r>p4n?m$(s,n.b):r<=p4n&&r>v4n?m$(s,n.d):r<=v4n&&r>m4n?m$(s,n.c):r<=m4n&&m$(s,n.a),a=IDn(n,s,a);return c}function ODn(){var n;for(ODn=O,Jtt=new X6(1,1),net=new X6(1,10),eet=new X6(0,0),Ytt=new X6(-1,1),Ztt=Pun(Gk(oet,1),sVn,91,0,[eet,Jtt,new X6(1,2),new X6(1,3),new X6(1,4),new X6(1,5),new X6(1,6),new X6(1,7),new X6(1,8),new X6(1,9),net]),tet=x8(oet,sVn,91,32,0,1),n=0;n<tet.length;n++)tet[n]=npn(yz(1,n))}function ADn(n,t,e,i,r,c){var a,u,o,s;for(u=!jE(AV(n.Oc(),new aw(new Je))).sd((dM(),tit)),a=n,c==(Ffn(),HPt)&&(a=cL(a,152)?o6(BB(a,152)):cL(a,131)?BB(a,131).a:cL(a,54)?new fy(a):new CT(a)),s=a.Kc();s.Ob();)(o=BB(s.Pb(),70)).n.a=t.a,o.n.b=u?t.b+(i.b-o.o.b)/2:r?t.b:t.b+i.b-o.o.b,t.a+=o.o.a+e}function $Dn(n,t,e,i){var r,c,a,u,o;for(r=(i.c+i.a)/2,yQ(t.j),DH(t.j,r),yQ(e.e),DH(e.e,r),o=new zj,a=new Wb(n.f);a.a<a.c.c.length;)Rjn(o,t,u=BB(n0(a),129).a),Rjn(o,e,u);for(c=new Wb(n.k);c.a<c.c.c.length;)Rjn(o,t,u=BB(n0(c),129).b),Rjn(o,e,u);return o.b+=2,o.a+=LQ(t,n.q),o.a+=LQ(n.q,e),o}function LDn(n,t,e){var i,r,c,a,u;if(!h3(t)){for(OTn(u=mcn(e,(cL(t,14)?BB(t,14).gc():F3(t.Kc()))/n.a|0),z3n,1),a=new Aa,c=null,r=t.Kc();r.Ob();)i=BB(r.Pb(),86),a=Wen(Pun(Gk(xnt,1),HWn,20,0,[a,new bg(i)])),c&&(hon(c,(qqn(),bkt),i),hon(i,ckt,c),G8(i)==G8(c)&&(hon(c,wkt,i),hon(i,akt,c))),c=i;HSn(u),LDn(n,a,e)}}function NDn(n){var t,e,i,r,c,a,u;for(e=n.i,t=n.n,u=e.d,n.f==(G7(),rrt)?u+=(e.a-n.e.b)/2:n.f==irt&&(u+=e.a-n.e.b),r=new Wb(n.d);r.a<r.c.c.length;){switch(a=(i=BB(n0(r),181)).rf(),(c=new Gj).b=u,u+=a.b+n.a,n.b.g){case 0:c.a=e.c+t.b;break;case 1:c.a=e.c+t.b+(e.b-a.a)/2;break;case 2:c.a=e.c+e.b-t.c-a.a}i.tf(c)}}function xDn(n){var t,e,i,r,c,a,u;for(e=n.i,t=n.n,u=e.c,n.b==(J9(),Qit)?u+=(e.b-n.e.a)/2:n.b==Jit&&(u+=e.b-n.e.a),r=new Wb(n.d);r.a<r.c.c.length;){switch(a=(i=BB(n0(r),181)).rf(),(c=new Gj).a=u,u+=a.a+n.a,n.f.g){case 0:c.b=e.d+t.d;break;case 1:c.b=e.d+t.d+(e.a-a.b)/2;break;case 2:c.b=e.d+e.a-t.a-a.b}i.tf(c)}}function DDn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;s=e.a.c,a=e.a.c+e.a.b,l=(c=BB(RX(e.c,t),459)).f,b=c.a,u=new xC(s,l),h=new xC(a,b),r=s,e.p||(r+=n.c),o=new xC(r+=e.F+e.v*n.b,l),f=new xC(r,b),nin(t.a,Pun(Gk(PMt,1),sVn,8,0,[u,o])),e.d.a.gc()>1&&(i=new xC(r,e.b),DH(t.a,i)),nin(t.a,Pun(Gk(PMt,1),sVn,8,0,[f,h]))}function RDn(n){NM(n,new MTn(vj(wj(pj(gj(new du,_5n),"ELK Randomizer"),'Distributes the nodes randomly on the plane, leading to very obfuscating layouts. Can be useful to demonstrate the power of "real" layout algorithms.'),new Qu))),u2(n,_5n,QJn,LIt),u2(n,_5n,vZn,15),u2(n,_5n,yZn,iln(0)),u2(n,_5n,VJn,dZn)}function KDn(){var n,t,e,i,r,c;for(KDn=O,QLt=x8(NNt,v6n,25,255,15,1),YLt=x8(ONt,WVn,25,16,15,1),t=0;t<255;t++)QLt[t]=-1;for(e=57;e>=48;e--)QLt[e]=e-48<<24>>24;for(i=70;i>=65;i--)QLt[i]=i-65+10<<24>>24;for(r=102;r>=97;r--)QLt[r]=r-97+10<<24>>24;for(c=0;c<10;c++)YLt[c]=48+c&QVn;for(n=10;n<=15;n++)YLt[n]=65+n-10&QVn}function _Dn(n,t,e){var i,r,c,a,u,o,s,h;return u=t.i-n.g/2,o=e.i-n.g/2,s=t.j-n.g/2,h=e.j-n.g/2,c=t.g+n.g/2,a=e.g+n.g/2,i=t.f+n.g/2,r=e.f+n.g/2,u<o+a&&o<u&&s<h+r&&h<s||o<u+c&&u<o&&h<s+i&&s<h||u<o+a&&o<u&&s<h&&h<s+i||o<u+c&&u<o&&s<h+r&&h<s}function FDn(n){var t,i,r,c,a;c=BB(mMn(n,(HXn(),Fgt)),21),a=BB(mMn(n,qgt),21),t=new wA(i=new xC(n.f.a+n.d.b+n.d.c,n.f.b+n.d.d+n.d.a)),c.Hc((mdn(),DIt))&&(r=BB(mMn(n,Hgt),8),a.Hc((n_n(),GIt))&&(r.a<=0&&(r.a=20),r.b<=0&&(r.b=20)),t.a=e.Math.max(i.a,r.a),t.b=e.Math.max(i.b,r.b)),qy(TD(mMn(n,Bgt)))||UBn(n,i,t)}function BDn(n,t){var e,i,r,c;for(c=abn(t,(kUn(),SIt)).Kc();c.Ob();)i=BB(c.Pb(),11),(e=BB(mMn(i,(hWn(),Elt)),10))&&UNn(aM(cM(uM(rM(new Hv,0),.1),n.i[t.p].d),n.i[e.p].a));for(r=abn(t,sIt).Kc();r.Ob();)i=BB(r.Pb(),11),(e=BB(mMn(i,(hWn(),Elt)),10))&&UNn(aM(cM(uM(rM(new Hv,0),.1),n.i[e.p].d),n.i[t.p].a))}function HDn(n){var t,e,i,r,c;if(!n.c){if(c=new Eo,null==(t=P$t).a.zc(n,t)){for(i=new AL(a4(n));i.e!=i.i.gc();)cL(r=lFn(e=BB(kpn(i),87)),88)&&pX(c,HDn(BB(r,26))),f9(c,e);t.a.Bc(n),t.a.gc()}$wn(c),chn(c),n.c=new NO((BB(Wtn(QQ((QX(),t$t).o),15),18),c.i),c.g),P5(n).b&=-33}return n.c}function qDn(n){var t;if(10!=n.c)throw Hp(new ak(kWn((u$(),g8n))));switch(t=n.a){case 110:t=10;break;case 114:t=13;break;case 116:t=9;break;case 92:case 124:case 46:case 94:case 45:case 63:case 42:case 43:case 123:case 125:case 40:case 41:case 91:case 93:break;default:throw Hp(new ak(kWn((u$(),U8n))))}return t}function GDn(n){var t,e,i,r;if(0==n.l&&0==n.m&&0==n.h)return"0";if(n.h==CQn&&0==n.m&&0==n.l)return"-9223372036854775808";if(n.h>>19!=0)return"-"+GDn(aon(n));for(e=n,i="";0!=e.l||0!=e.m||0!=e.h;){if(e=Aqn(e,F5(AQn),!0),t=""+TE(ltt),0!=e.l||0!=e.m||0!=e.h)for(r=9-t.length;r>0;r--)t="0"+t;i=t+i}return i}function zDn(){if(!Object.create||!Object.getOwnPropertyNames)return!1;var n="__proto__",t=Object.create(null);return void 0===t[n]&&0==Object.getOwnPropertyNames(t).length&&(t[n]=42,42===t[n]&&0!=Object.getOwnPropertyNames(t).length)}function UDn(n){var t,e,i,r,c,a,u;for(t=!1,e=0,r=new Wb(n.d.b);r.a<r.c.c.length;)for((i=BB(n0(r),29)).p=e++,a=new Wb(i.a);a.a<a.c.c.length;)c=BB(n0(a),10),!t&&!h3(hbn(c))&&(t=!0);u=EG((Ffn(),BPt),Pun(Gk(WPt,1),$Vn,103,0,[_Pt,FPt])),t||(orn(u,HPt),orn(u,KPt)),n.a=new ltn(u),$U(n.f),$U(n.b),$U(n.e),$U(n.g)}function XDn(n,t,e){var i,r,c,a,u,o,s,h,f;for(i=e.c,r=e.d,u=g1(t.c),o=g1(t.d),i==t.c?(u=lLn(n,u,r),o=sMn(t.d)):(u=sMn(t.c),o=lLn(n,o,r)),r5(s=new Kj(t.a),u,s.a,s.a.a),r5(s,o,s.c.b,s.c),a=t.c==i,f=new Jv,c=0;c<s.b-1;++c)h=new rI(BB(Dpn(s,c),8),BB(Dpn(s,c+1),8)),a&&0==c||!a&&c==s.b-2?f.b=h:WB(f.a,h);return f}function WDn(n,t){var e,i,r,c;if(0!=(c=n.j.g-t.j.g))return c;if(e=BB(mMn(n,(HXn(),ipt)),19),i=BB(mMn(t,ipt),19),e&&i&&0!=(r=e.a-i.a))return r;switch(n.j.g){case 1:return Pln(n.n.a,t.n.a);case 2:return Pln(n.n.b,t.n.b);case 3:return Pln(t.n.a,n.n.a);case 4:return Pln(t.n.b,n.n.b);default:throw Hp(new Fy(r1n))}}function VDn(n,t,i,r){var c,a,u,o;if(F3((q_(),new oz(ZL(hbn(t).a.Kc(),new h))))>=n.a)return-1;if(!eTn(t,i))return-1;if(h3(BB(r.Kb(t),20)))return 1;for(c=0,u=BB(r.Kb(t),20).Kc();u.Ob();){if(-1==(o=VDn(n,(a=BB(u.Pb(),17)).c.i==t?a.d.i:a.c.i,i,r)))return-1;if((c=e.Math.max(c,o))>n.c-1)return-1}return c+1}function QDn(n,t){var e,i,r,c,a,u;if(GI(t)===GI(n))return!0;if(!cL(t,15))return!1;if(i=BB(t,15),u=n.gc(),i.gc()!=u)return!1;if(a=i.Kc(),n.ni()){for(e=0;e<u;++e)if(r=n.ki(e),c=a.Pb(),null==r?null!=c:!Nfn(r,c))return!1}else for(e=0;e<u;++e)if(r=n.ki(e),c=a.Pb(),GI(r)!==GI(c))return!1;return!0}function YDn(n,t){var e,i,r,c,a,u;if(n.f>0)if(n.qj(),null!=t){for(c=0;c<n.d.length;++c)if(e=n.d[c])for(i=BB(e.g,367),u=e.i,a=0;a<u;++a)if(Nfn(t,(r=i[a]).dd()))return!0}else for(c=0;c<n.d.length;++c)if(e=n.d[c])for(i=BB(e.g,367),u=e.i,a=0;a<u;++a)if(r=i[a],GI(t)===GI(r.dd()))return!0;return!1}function JDn(n,t,e){var i,r,c,a;OTn(e,"Orthogonally routing hierarchical port edges",1),n.a=0,NGn(t,i=UHn(t)),Qqn(n,t,i),fUn(t),r=BB(mMn(t,(HXn(),ept)),98),Czn((l1(0,(c=t.b).c.length),BB(c.c[0],29)),r,t),Czn(BB(xq(c,c.c.length-1),29),r,t),TBn((l1(0,(a=t.b).c.length),BB(a.c[0],29))),TBn(BB(xq(a,a.c.length-1),29)),HSn(e)}function ZDn(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return n-48<<24>>24;case 97:case 98:case 99:case 100:case 101:case 102:return n-97+10<<24>>24;case 65:case 66:case 67:case 68:case 69:case 70:return n-65+10<<24>>24;default:throw Hp(new Mk("Invalid hexadecimal"))}}function nRn(n,t,e){var i,r,c,a;for(OTn(e,"Processor order nodes",2),n.a=Gy(MD(mMn(t,(CAn(),xkt)))),r=new YT,a=spn(t.b,0);a.b!=a.d.c;)qy(TD(mMn(c=BB(b3(a),86),(qqn(),dkt))))&&r5(r,c,r.c.b,r.c);Px(0!=r.b),KHn(n,i=BB(r.a.a.c,86)),!e.b&&qin(e,1),BRn(n,i,0-Gy(MD(mMn(i,(qqn(),ukt))))/2,0),!e.b&&qin(e,1),HSn(e)}function tRn(){tRn=O,Rit=new HS("SPIRAL",0),$it=new HS("LINE_BY_LINE",1),Lit=new HS("MANHATTAN",2),Ait=new HS("JITTER",3),xit=new HS("QUADRANTS_LINE_BY_LINE",4),Dit=new HS("QUADRANTS_MANHATTAN",5),Nit=new HS("QUADRANTS_JITTER",6),Oit=new HS("COMBINE_LINE_BY_LINE_MANHATTAN",7),Iit=new HS("COMBINE_JITTER_MANHATTAN",8)}function eRn(n,t,e,i){var r,c,a,u,o,s;for(o=Njn(n,e),s=Njn(t,e),r=!1;o&&s&&(i||myn(o,s,e));)a=Njn(o,e),u=Njn(s,e),A7(t),A7(n),c=o.c,rGn(o,!1),rGn(s,!1),e?(Qyn(t,s.p,c),t.p=s.p,Qyn(n,o.p+1,c),n.p=o.p):(Qyn(n,o.p,c),n.p=o.p,Qyn(t,s.p+1,c),t.p=s.p),PZ(o,null),PZ(s,null),o=a,s=u,r=!0;return r}function iRn(n,t,e,i){var r,c,a,u,o;for(r=!1,c=!1,u=new Wb(i.j);u.a<u.c.c.length;)GI(mMn(a=BB(n0(u),11),(hWn(),dlt)))===GI(e)&&(0==a.g.c.length?0==a.e.c.length||(r=!0):c=!0);return o=0,r&&r^c?o=e.j==(kUn(),sIt)?-n.e[i.c.p][i.p]:t-n.e[i.c.p][i.p]:c&&r^c?o=n.e[i.c.p][i.p]+1:r&&c&&(o=e.j==(kUn(),sIt)?0:t/2),o}function rRn(n,t,e,i,r,c,a,u){var o,s,h;for(o=0,null!=t&&(o^=vvn(t.toLowerCase())),null!=e&&(o^=vvn(e)),null!=i&&(o^=vvn(i)),null!=a&&(o^=vvn(a)),null!=u&&(o^=vvn(u)),s=0,h=c.length;s<h;s++)o^=vvn(c[s]);n?o|=256:o&=-257,r?o|=16:o&=-17,this.f=o,this.i=null==t?null:(kW(t),t),this.a=e,this.d=i,this.j=c,this.g=a,this.e=u}function cRn(n,t,e){var i,r;switch(r=null,t.g){case 1:gcn(),r=Nut;break;case 2:gcn(),r=Dut}switch(i=null,e.g){case 1:gcn(),i=xut;break;case 2:gcn(),i=Lut;break;case 3:gcn(),i=Rut;break;case 4:gcn(),i=Kut}return r&&i?KB(n.j,new Hf(new Jy(Pun(Gk(Lnt,1),HWn,169,0,[BB(yX(r),169),BB(yX(i),169)])))):(SQ(),SQ(),set)}function aRn(n){var t,e,i;switch(t=BB(mMn(n,(HXn(),Hgt)),8),hon(n,Hgt,new xC(t.b,t.a)),BB(mMn(n,kdt),248).g){case 1:hon(n,kdt,(wvn(),LMt));break;case 2:hon(n,kdt,(wvn(),IMt));break;case 3:hon(n,kdt,(wvn(),AMt));break;case 4:hon(n,kdt,(wvn(),$Mt))}(n.q?n.q:(SQ(),SQ(),het))._b(spt)&&(i=(e=BB(mMn(n,spt),8)).a,e.a=e.b,e.b=i)}function uRn(n,t,e,i,r,c){if(this.b=e,this.d=r,n>=t.length)throw Hp(new Ay("Greedy SwitchDecider: Free layer not in graph."));this.c=t[n],this.e=new QK(i),yrn(this.e,this.c,(kUn(),CIt)),this.i=new QK(i),yrn(this.i,this.c,oIt),this.f=new lG(this.c),this.a=!c&&r.i&&!r.s&&this.c[0].k==(uSn(),Mut),this.a&&gPn(this,n,t.length)}function oRn(n,t){var e,i,r,c,a,u;c=!n.B.Hc((n_n(),HIt)),a=n.B.Hc(zIt),n.a=new Hwn(a,c,n.c),n.n&&kQ(n.a.n,n.n),jy(n.g,(Dtn(),zit),n.a),t||((i=new Ign(1,c,n.c)).n.a=n.k,mG(n.p,(kUn(),sIt),i),(r=new Ign(1,c,n.c)).n.d=n.k,mG(n.p,SIt,r),(u=new Ign(0,c,n.c)).n.c=n.k,mG(n.p,CIt,u),(e=new Ign(0,c,n.c)).n.b=n.k,mG(n.p,oIt,e))}function sRn(n){var t,e,i;switch((t=BB(mMn(n.d,(HXn(),Zdt)),218)).g){case 2:e=MXn(n);break;case 3:i=new Np,JT(AV($V(wnn(wnn(new Rq(null,new w1(n.d.b,16)),new Or),new Ar),new $r),new pr),new Cd(i)),e=i;break;default:throw Hp(new Fy("Compaction not supported for "+t+" edges."))}gqn(n,e),e5(new Cb(n.g),new Sd(n))}function hRn(n,t){var e;return e=new Zn,t&&qan(e,BB(RX(n.a,DOt),94)),cL(t,470)&&qan(e,BB(RX(n.a,ROt),94)),cL(t,354)?(qan(e,BB(RX(n.a,zOt),94)),e):(cL(t,82)&&qan(e,BB(RX(n.a,KOt),94)),cL(t,239)?(qan(e,BB(RX(n.a,UOt),94)),e):cL(t,186)?(qan(e,BB(RX(n.a,XOt),94)),e):(cL(t,352)&&qan(e,BB(RX(n.a,_Ot),94)),e))}function fRn(){fRn=O,Zct=new XA((sWn(),pPt),iln(1)),cat=new XA(LPt,80),rat=new XA(SPt,5),Fct=new XA(cSt,dZn),nat=new XA(vPt,iln(1)),iat=new XA(kPt,(hN(),!0)),Qct=new WA(50),Vct=new XA(XSt,Qct),Hct=CSt,Yct=uPt,Bct=new XA(dSt,!1),Wct=USt,Xct=qSt,Uct=KSt,zct=DSt,Jct=fPt,jSn(),Gct=Ict,aat=Nct,qct=Cct,tat=Act,eat=Lct}function lRn(n){var t,e,i,r,c,a,u;for(u=new v5,a=new Wb(n.a);a.a<a.c.c.length;)if((c=BB(n0(a),10)).k!=(uSn(),Mut))for(_An(u,c,new Gj),r=new oz(ZL(lbn(c).a.Kc(),new h));dAn(r);)if((i=BB(U5(r),17)).c.i.k!=Mut&&i.d.i.k!=Mut)for(e=spn(i.a,0);e.b!=e.d.c;)Yjn(u,new dP((t=BB(b3(e),8)).a,t.b));return u}function bRn(){bRn=O,RTt=new up(K4n),OM(),xTt=new $O(q4n,DTt=GTt),Lun(),LTt=new $O(_4n,NTt=WTt),$Sn(),ATt=new $O(F4n,$Tt=rTt),PTt=new $O(B4n,null),$6(),ITt=new $O(H4n,OTt=ZEt),CM(),jTt=new $O(G4n,ETt=XEt),TTt=new $O(z4n,(hN(),!1)),MTt=new $O(U4n,iln(64)),STt=new $O(X4n,!0),CTt=nTt}function wRn(n){var t,e,i,r,c;if(null==n.a)if(n.a=x8($Nt,ZYn,25,n.c.b.c.length,16,1),n.a[0]=!1,Lx(n.c,(HXn(),Upt)))for(e=BB(mMn(n.c,Upt),15).Kc();e.Ob();)(t=BB(e.Pb(),19).a)>0&&t<n.a.length&&(n.a[t]=!1);else for((c=new Wb(n.c.b)).a<c.c.c.length&&n0(c),i=1;c.a<c.c.c.length;)r=BB(n0(c),29),n.a[i++]=U$n(r)}function dRn(n,t){var e,i;switch(i=n.b,t){case 1:n.b|=1,n.b|=4,n.b|=8;break;case 2:n.b|=2,n.b|=4,n.b|=8;break;case 4:n.b|=1,n.b|=2,n.b|=4,n.b|=8;break;case 3:n.b|=16,n.b|=8;break;case 0:n.b|=32,n.b|=16,n.b|=8,n.b|=1,n.b|=2,n.b|=4}if(n.b!=i&&n.c)for(e=new AL(n.c);e.e!=e.i.gc();)ACn(P5(BB(kpn(e),473)),t)}function gRn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b;for(r=!1,u=0,o=(a=t).length;u<o;++u)c=a[u],qy((hN(),!!c.e))&&!BB(xq(n.b,c.e.p),214).s&&(r|=(s=c.e,(f=(h=BB(xq(n.b,s.p),214)).e)[l=fj(e,f.length)][0].k==(uSn(),Mut)?f[l]=$Nn(c,f[l],e?(kUn(),CIt):(kUn(),oIt)):h.c.Tf(f,e),b=DNn(n,h,e,i),xxn(h.e,h.o,e),b));return r}function pRn(n,t){var e,i,r,c,a;for(c=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,r=new AL((!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));r.e!=r.i.gc();)GI(ZAn(i=BB(kpn(r),33),(sWn(),ESt)))!==GI((ufn(),mCt))&&((a=BB(ZAn(t,mPt),149))==(e=BB(ZAn(i,mPt),149))||a&&j5(a,e))&&0!=(!i.a&&(i.a=new eU(UOt,i,10,11)),i.a).i&&(c+=pRn(n,i));return c}function vRn(n){var t,e,i,r,c,a,u;for(i=0,u=0,a=new Wb(n.d);a.a<a.c.c.length;)c=BB(n0(a),101),r=BB(P4(AV(new Rq(null,new w1(c.j,16)),new Xr),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),e=null,i<=u?(kUn(),e=sIt,i+=r.gc()):u<i&&(kUn(),e=SIt,u+=r.gc()),t=e,JT($V(r.Oc(),new Hr),new Ad(t))}function mRn(n){var t,e,i,r,c,a,u,o;for(n.b=new vOn(new Jy((kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt]))),new Jy((Crn(),Pun(Gk(Wst,1),$Vn,361,0,[Rst,Dst,xst])))),u=0,o=(a=Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length;u<o;++u)for(c=a[u],i=0,r=(e=Pun(Gk(Wst,1),$Vn,361,0,[Rst,Dst,xst])).length;i<r;++i)t=e[i],Wjn(n.b,c,t,new Np)}function yRn(n,t){var e,i,r,c,a,u,o,s,h,f;if(a=BB(BB(h6(n.r,t),21),84),u=n.u.Hc((lIn(),rIt)),e=n.u.Hc(tIt),i=n.u.Hc(nIt),s=n.u.Hc(cIt),f=n.B.Hc((n_n(),QIt)),h=!e&&!i&&(s||2==a.gc()),hxn(n,t),r=null,o=null,u){for(o=r=BB((c=a.Kc()).Pb(),111);c.Ob();)o=BB(c.Pb(),111);r.d.b=0,o.d.c=0,h&&!r.a&&(r.d.c=0)}f&&(DTn(a),u&&(r.d.b=0,o.d.c=0))}function kRn(n,t){var e,i,r,c,a,u,o,s,h,f;if(a=BB(BB(h6(n.r,t),21),84),u=n.u.Hc((lIn(),rIt)),e=n.u.Hc(tIt),i=n.u.Hc(nIt),o=n.u.Hc(cIt),f=n.B.Hc((n_n(),QIt)),s=!e&&!i&&(o||2==a.gc()),V_n(n,t),h=null,r=null,u){for(r=h=BB((c=a.Kc()).Pb(),111);c.Ob();)r=BB(c.Pb(),111);h.d.d=0,r.d.a=0,s&&!h.a&&(h.d.a=0)}f&&(RTn(a),u&&(h.d.d=0,r.d.a=0))}function jRn(n,t,e){var i,r,c,a,u;if(i=t.k,t.p>=0)return!1;if(t.p=e.b,WB(e.e,t),i==(uSn(),Put)||i==Iut)for(r=new Wb(t.j);r.a<r.c.c.length;)for(u=new zw(new Wb(new Gw(BB(n0(r),11)).a.g));y$(u.a);)if(a=(c=BB(n0(u.a),17).d.i).k,t.c!=c.c&&(a==Put||a==Iut)&&jRn(n,c,e))return!0;return!0}function ERn(n){var t;return 0!=(64&n.Db)?KOn(n):((t=new fN(KOn(n))).a+=" (changeable: ",yE(t,0!=(n.Bb&k6n)),t.a+=", volatile: ",yE(t,0!=(n.Bb&M9n)),t.a+=", transient: ",yE(t,0!=(n.Bb&_Qn)),t.a+=", defaultValueLiteral: ",cO(t,n.j),t.a+=", unsettable: ",yE(t,0!=(n.Bb&T9n)),t.a+=", derived: ",yE(t,0!=(n.Bb&hVn)),t.a+=")",t.a)}function TRn(n){var t,e,i,r,c,a,u,o,s,h;for(e=NLn(n.d),c=(r=BB(mMn(n.b,(Epn(),vct)),116)).b+r.c,a=r.d+r.a,o=e.d.a*n.e+c,u=e.b.a*n.f+a,Ll(n.b,new xC(o,u)),h=new Wb(n.g);h.a<h.c.c.length;)t=UR(Fx(new xC((s=BB(n0(h),562)).g-e.a.a,s.i-e.c.a),s.a,s.b),kL(Bx(B$(VA(s.e)),s.d*s.a,s.c*s.b),-.5)),i=QA(s.e),ij(s.e,XR(t,i))}function MRn(n,t,e,i){var r,c,a,u,o;for(o=x8(xNt,sVn,104,(kUn(),Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length,0,2),a=0,u=(c=Pun(Gk(FIt,1),YZn,61,0,[PIt,sIt,oIt,SIt,CIt])).length;a<u;++a)o[(r=c[a]).g]=x8(xNt,qQn,25,n.c[r.g],15,1);return Bkn(o,n,sIt),Bkn(o,n,SIt),xmn(o,n,sIt,t,e,i),xmn(o,n,oIt,t,e,i),xmn(o,n,SIt,t,e,i),xmn(o,n,CIt,t,e,i),o}function SRn(n,t,e){if(hU(n.a,t)){if(FT(BB(RX(n.a,t),53),e))return 1}else VW(n.a,t,new Rv);if(hU(n.a,e)){if(FT(BB(RX(n.a,e),53),t))return-1}else VW(n.a,e,new Rv);if(hU(n.b,t)){if(FT(BB(RX(n.b,t),53),e))return-1}else VW(n.b,t,new Rv);if(hU(n.b,e)){if(FT(BB(RX(n.b,e),53),t))return 1}else VW(n.b,e,new Rv);return 0}function PRn(n,t,e,i){var r,c,a,u,o,s;if(null==e)for(r=BB(n.g,119),u=0;u<n.i;++u)if((a=r[u]).ak()==t)return _pn(n,a,i);return ZM(),c=BB(t,66).Oj()?BB(e,72):Z3(t,e),mA(n.e)?(s=!adn(n,t),i=Ywn(n,c,i),o=t.$j()?LY(n,3,t,null,e,pBn(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn)),s):LY(n,1,t,t.zj(),e,-1,s),i?i.Ei(o):i=o):i=Ywn(n,c,i),i}function CRn(n){var t,i,r,c,a,u;n.q!=(QEn(),WCt)&&n.q!=XCt&&(c=n.f.n.d+XH(BB(oV(n.b,(kUn(),sIt)),124))+n.c,t=n.f.n.a+XH(BB(oV(n.b,SIt),124))+n.c,r=BB(oV(n.b,oIt),124),u=BB(oV(n.b,CIt),124),a=e.Math.max(0,r.n.d-c),a=e.Math.max(a,u.n.d-c),i=e.Math.max(0,r.n.a-t),i=e.Math.max(i,u.n.a-t),r.n.d=a,u.n.d=a,r.n.a=i,u.n.a=i)}function IRn(n,t){var e,i,r,c,a,u,o;for(OTn(t,"Restoring reversed edges",1),a=new Wb(n.b);a.a<a.c.c.length;)for(u=new Wb(BB(n0(a),29).a);u.a<u.c.c.length;)for(o=new Wb(BB(n0(u),10).j);o.a<o.c.c.length;)for(r=0,c=(i=Z0(BB(n0(o),11).g)).length;r<c;++r)qy(TD(mMn(e=i[r],(hWn(),Clt))))&&tBn(e,!1);HSn(t)}function ORn(){this.b=new v4,this.d=new v4,this.e=new v4,this.c=new v4,this.a=new xp,this.f=new xp,xJ(PMt,new mu,new yu),xJ(NMt,new Au,new $u),xJ(Eut,new Lu,new Nu),xJ(_ut,new Du,new Ru),xJ(hOt,new Ku,new _u),xJ(met,new ku,new ju),xJ(Iet,new Eu,new Tu),xJ(jet,new Mu,new Su),xJ(Eet,new Pu,new Cu),xJ(Bet,new Iu,new Ou)}function ARn(n){var t,e,i,r,c,a;return c=0,(t=Ikn(n)).Bj()&&(c|=4),0!=(n.Bb&T9n)&&(c|=2),cL(n,99)?(r=Cvn(e=BB(n,18)),0!=(e.Bb&h6n)&&(c|=32),r&&(bX(dZ(r)),c|=8,((a=r.t)>1||-1==a)&&(c|=16),0!=(r.Bb&h6n)&&(c|=64)),0!=(e.Bb&BQn)&&(c|=M9n),c|=k6n):cL(t,457)?c|=512:(i=t.Bj())&&0!=(1&i.i)&&(c|=256),0!=(512&n.Bb)&&(c|=128),c}function $Rn(n,t){var e,i,r,c,a;for(n=null==n?zWn:(kW(n),n),r=0;r<t.length;r++)t[r]=iLn(t[r]);for(e=new Ik,a=0,i=0;i<t.length&&-1!=(c=n.indexOf("%s",a));)e.a+=""+fx(null==n?zWn:(kW(n),n),a,c),uO(e,t[i++]),a=c+2;if(G0(e,n,a,n.length),i<t.length){for(e.a+=" [",uO(e,t[i++]);i<t.length;)e.a+=FWn,uO(e,t[i++]);e.a+="]"}return e.a}function LRn(n){var t,e,i,r,c;for(c=new J6(n.a.c.length),r=new Wb(n.a);r.a<r.c.c.length;){switch(i=BB(n0(r),10),t=null,(e=BB(mMn(i,(HXn(),kgt)),163)).g){case 1:case 2:Jun(),t=$ht;break;case 3:case 4:Jun(),t=Oht}t?(hon(i,(hWn(),Gft),(Jun(),$ht)),t==Oht?RNn(i,e,(ain(),Hvt)):t==$ht&&RNn(i,e,(ain(),qvt))):c.c[c.c.length]=i}return c}function NRn(n,t){var e,i,r,c,a,u,o;for(e=0,o=new Wb(t);o.a<o.c.c.length;){for(u=BB(n0(o),11),nhn(n.b,n.d[u.p]),a=0,r=new m6(u.b);y$(r.a)||y$(r.b);)CW(i=BB(y$(r.a)?n0(r.a):n0(r.b),17))?(c=ME(n,u==i.c?i.d:i.c))>n.d[u.p]&&(e+=n5(n.b,c),d3(n.a,iln(c))):++a;for(e+=n.b.d*a;!Wy(n.a);)Mnn(n.b,BB(dU(n.a),19).a)}return e}function xRn(n,t){var e;return n.f==uLt?(e=DW(B7((IPn(),Z$t),t)),n.e?4==e&&t!=(TOn(),lLt)&&t!=(TOn(),sLt)&&t!=(TOn(),hLt)&&t!=(TOn(),fLt):2==e):!(!n.d||!(n.d.Hc(t)||n.d.Hc(Z1(B7((IPn(),Z$t),t)))||n.d.Hc(Fqn((IPn(),Z$t),n.b,t))))||!(!n.f||!aNn((IPn(),n.f),jV(B7(Z$t,t))))&&(e=DW(B7(Z$t,t)),n.e?4==e:2==e)}function DRn(n,t,i,r){var c,a,u,o,s,h,f,l;return s=(u=BB(ZAn(i,(sWn(),gPt)),8)).a,f=u.b+n,(c=e.Math.atan2(f,s))<0&&(c+=Z3n),(c+=t)>Z3n&&(c-=Z3n),h=(o=BB(ZAn(r,gPt),8)).a,l=o.b+n,(a=e.Math.atan2(l,h))<0&&(a+=Z3n),(a+=t)>Z3n&&(a-=Z3n),h$(),rin(1e-10),e.Math.abs(c-a)<=1e-10||c==a||isNaN(c)&&isNaN(a)?0:c<a?-1:c>a?1:zO(isNaN(c),isNaN(a))}function RRn(n){var t,e,i,r,c,a,u;for(u=new xp,i=new Wb(n.a.b);i.a<i.c.c.length;)VW(u,t=BB(n0(i),57),new Np);for(r=new Wb(n.a.b);r.a<r.c.c.length;)for((t=BB(n0(r),57)).i=KQn,a=t.c.Kc();a.Ob();)c=BB(a.Pb(),57),BB(qI(AY(u.f,c)),15).Fc(t);for(e=new Wb(n.a.b);e.a<e.c.c.length;)(t=BB(n0(e),57)).c.$b(),t.c=BB(qI(AY(u.f,t)),15);_xn(n)}function KRn(n){var t,e,i,r,c,a,u;for(u=new xp,i=new Wb(n.a.b);i.a<i.c.c.length;)VW(u,t=BB(n0(i),81),new Np);for(r=new Wb(n.a.b);r.a<r.c.c.length;)for((t=BB(n0(r),81)).o=KQn,a=t.f.Kc();a.Ob();)c=BB(a.Pb(),81),BB(qI(AY(u.f,c)),15).Fc(t);for(e=new Wb(n.a.b);e.a<e.c.c.length;)(t=BB(n0(e),81)).f.$b(),t.f=BB(qI(AY(u.f,t)),15);BNn(n)}function _Rn(n,t,e,i){var r,c;for(Gkn(n,t,e,i),xl(t,n.j-t.j+e),Dl(t,n.k-t.k+i),c=new Wb(t.f);c.a<c.c.c.length;)switch((r=BB(n0(c),324)).a.g){case 0:won(n,t.g+r.b.a,0,t.g+r.c.a,t.i-1);break;case 1:won(n,t.g+t.o,t.i+r.b.a,n.o-1,t.i+r.c.a);break;case 2:won(n,t.g+r.b.a,t.i+t.p,t.g+r.c.a,n.p-1);break;default:won(n,0,t.i+r.b.a,t.g-1,t.i+r.c.a)}}function FRn(n,t,e,i,r){var c,a;try{if(t>=n.o)throw Hp(new Sv);a=t>>5,c=yz(1,dG(yz(31&t,1))),n.n[e][a]=r?i0(n.n[e][a],c):e0(n.n[e][a],uH(c)),c=yz(c,1),n.n[e][a]=i?i0(n.n[e][a],c):e0(n.n[e][a],uH(c))}catch(u){throw cL(u=lun(u),320)?Hp(new Ay(MJn+n.o+"*"+n.p+SJn+t+FWn+e+PJn)):Hp(u)}}function BRn(n,t,i,r){var c,a;t&&(c=Gy(MD(mMn(t,(qqn(),fkt))))+r,a=i+Gy(MD(mMn(t,ukt)))/2,hon(t,gkt,iln(dG(fan(e.Math.round(c))))),hon(t,pkt,iln(dG(fan(e.Math.round(a))))),0==t.d.b||BRn(n,BB(iL(new wg(spn(new bg(t).a.d,0))),86),i+Gy(MD(mMn(t,ukt)))+n.a,r+Gy(MD(mMn(t,okt)))),null!=mMn(t,wkt)&&BRn(n,BB(mMn(t,wkt),86),i,r))}function HRn(n,t){var i,r,c,a,u,o,s,h,f,l,b;for(c=2*Gy(MD(mMn(s=vW(t.a),(HXn(),Tpt)))),f=Gy(MD(mMn(s,Apt))),h=e.Math.max(c,f),a=x8(xNt,qQn,25,t.f-t.c+1,15,1),r=-h,i=0,o=t.b.Kc();o.Ob();)u=BB(o.Pb(),10),r+=n.a[u.c.p]+h,a[i++]=r;for(r+=n.a[t.a.c.p]+h,a[i++]=r,b=new Wb(t.e);b.a<b.c.c.length;)l=BB(n0(b),10),r+=n.a[l.c.p]+h,a[i++]=r;return a}function qRn(n,t,e,i){var r,c,a,u,o,s,h,f;for(f=new dE(new Yd(n)),u=0,o=(a=Pun(Gk(Out,1),a1n,10,0,[t,e])).length;u<o;++u)for(h=Lfn(a[u],i).Kc();h.Ob();)for(c=new m6((s=BB(h.Pb(),11)).b);y$(c.a)||y$(c.b);)b5(r=BB(y$(c.a)?n0(c.a):n0(c.b),17))||(Mon(f.a,s,(hN(),ptt)),CW(r)&&ZU(f,s==r.c?r.d:r.c));return yX(f),new t_(f)}function GRn(n,t){var e,i,r,c;if(0!=(c=BB(ZAn(n,(sWn(),wPt)),61).g-BB(ZAn(t,wPt),61).g))return c;if(e=BB(ZAn(n,sPt),19),i=BB(ZAn(t,sPt),19),e&&i&&0!=(r=e.a-i.a))return r;switch(BB(ZAn(n,wPt),61).g){case 1:return Pln(n.i,t.i);case 2:return Pln(n.j,t.j);case 3:return Pln(t.i,n.i);case 4:return Pln(t.j,n.j);default:throw Hp(new Fy(r1n))}}function zRn(n){var t,e,i;return 0!=(64&n.Db)?mSn(n):(t=new lN(n6n),(e=n.k)?oO(oO((t.a+=' "',t),e),'"'):(!n.n&&(n.n=new eU(zOt,n,1,7)),n.n.i>0&&(!(i=(!n.n&&(n.n=new eU(zOt,n,1,7)),BB(Wtn(n.n,0),137)).a)||oO(oO((t.a+=' "',t),i),'"'))),oO(kE(oO(kE(oO(kE(oO(kE((t.a+=" (",t),n.i),","),n.j)," | "),n.g),","),n.f),")"),t.a)}function URn(n){var t,e,i;return 0!=(64&n.Db)?mSn(n):(t=new lN(t6n),(e=n.k)?oO(oO((t.a+=' "',t),e),'"'):(!n.n&&(n.n=new eU(zOt,n,1,7)),n.n.i>0&&(!(i=(!n.n&&(n.n=new eU(zOt,n,1,7)),BB(Wtn(n.n,0),137)).a)||oO(oO((t.a+=' "',t),i),'"'))),oO(kE(oO(kE(oO(kE(oO(kE((t.a+=" (",t),n.i),","),n.j)," | "),n.g),","),n.f),")"),t.a)}function XRn(n,t){var e,i,r,c,a,u;if(null==t||0==t.length)return null;if(!(r=BB(SJ(n.a,t),149))){for(i=new Kb(new Ob(n.b).a.vc().Kc());i.a.Ob();)if(c=BB(i.a.Pb(),42),a=(e=BB(c.dd(),149)).c,u=t.length,mK(a.substr(a.length-u,u),t)&&(t.length==a.length||46==fV(a,a.length-t.length-1))){if(r)return null;r=e}r&&mZ(n.a,t,r)}return r}function WRn(n,t){var e,i,r;return e=new xn,(i=BB(P4($V(new Rq(null,new w1(n.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Xet),Uet]))),21).gc())<(r=BB(P4($V(new Rq(null,new w1(t.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[Xet,Uet]))),21).gc())?-1:i==r?0:1}function VRn(n){var t,e,i;Lx(n,(HXn(),$gt))&&((i=BB(mMn(n,$gt),21)).dc()||(e=new YK(t=BB(Vj(GCt),9),BB(SR(t,t.length),9),0),i.Hc((n$n(),$Ct))?orn(e,$Ct):orn(e,LCt),i.Hc(OCt)||orn(e,OCt),i.Hc(ICt)?orn(e,DCt):i.Hc(CCt)?orn(e,xCt):i.Hc(ACt)&&orn(e,NCt),i.Hc(DCt)?orn(e,ICt):i.Hc(xCt)?orn(e,CCt):i.Hc(NCt)&&orn(e,ACt),hon(n,$gt,e)))}function QRn(n){var t,e,i,r,c,a,u;for(r=BB(mMn(n,(hWn(),rlt)),10),l1(0,(i=n.j).c.length),e=BB(i.c[0],11),a=new Wb(r.j);a.a<a.c.c.length;)if(GI(c=BB(n0(a),11))===GI(mMn(e,dlt))){c.j==(kUn(),sIt)&&n.p>r.p?(qCn(c,SIt),c.d&&(u=c.o.b,t=c.a.b,c.a.b=u-t)):c.j==SIt&&r.p>n.p&&(qCn(c,sIt),c.d&&(u=c.o.b,t=c.a.b,c.a.b=-(u-t)));break}return r}function YRn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w;if(c=e,e<i)for(b=new Fan(n.p),w=new Fan(n.p),Frn(b.e,n.e),b.q=n.q,b.r=w,rX(b),Frn(w.j,n.j),w.r=b,rX(w),f=BB((l=new rI(b,w)).a,112),h=BB(l.b,112),l1(c,t.c.length),a=$Dn(n,f,h,r=BB(t.c[c],329)),s=e+1;s<=i;s++)l1(s,t.c.length),Vpn(u=BB(t.c[s],329),o=$Dn(n,f,h,u),r,a)&&(r=u,a=o);return c}function JRn(n,t,e,i,r){var c,a,u,o,s,h,f;if(!(cL(t,239)||cL(t,354)||cL(t,186)))throw Hp(new _y("Method only works for ElkNode-, ElkLabel and ElkPort-objects."));return a=n.a/2,o=t.i+i-a,h=t.j+r-a,s=o+t.g+n.a,f=h+t.f+n.a,DH(c=new km,new xC(o,h)),DH(c,new xC(o,f)),DH(c,new xC(s,f)),DH(c,new xC(s,h)),qan(u=new EAn(c),t),e&&VW(n.b,t,u),u}function ZRn(n,t,e){var i,r,c,a,u,o,s,h;for(c=new xC(t,e),s=new Wb(n.a);s.a<s.c.c.length;)for(UR((o=BB(n0(s),10)).n,c),h=new Wb(o.j);h.a<h.c.c.length;)for(r=new Wb(BB(n0(h),11).g);r.a<r.c.c.length;)for(Ztn((i=BB(n0(r),17)).a,c),(a=BB(mMn(i,(HXn(),vgt)),74))&&Ztn(a,c),u=new Wb(i.b);u.a<u.c.c.length;)UR(BB(n0(u),70).n,c)}function nKn(n,t,e){var i,r,c,a,u,o,s,h;for(c=new xC(t,e),s=new Wb(n.a);s.a<s.c.c.length;)for(UR((o=BB(n0(s),10)).n,c),h=new Wb(o.j);h.a<h.c.c.length;)for(r=new Wb(BB(n0(h),11).g);r.a<r.c.c.length;)for(Ztn((i=BB(n0(r),17)).a,c),(a=BB(mMn(i,(HXn(),vgt)),74))&&Ztn(a,c),u=new Wb(i.b);u.a<u.c.c.length;)UR(BB(n0(u),70).n,c)}function tKn(n){if(0==(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i)throw Hp(new ck("Edges must have a source."));if(0==(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i)throw Hp(new ck("Edges must have a target."));if(!n.b&&(n.b=new hK(KOt,n,4,7)),!(n.b.i<=1&&(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c.i<=1)))throw Hp(new ck("Hyperedges are not supported."))}function eKn(n,t){var e,i,r,c,a,u,o,s,h,f;for(f=0,d3(c=new Lp,t);c.b!=c.c;)for(o=BB(dU(c),214),s=0,h=BB(mMn(t.j,(HXn(),Ldt)),339),a=Gy(MD(mMn(t.j,Idt))),u=Gy(MD(mMn(t.j,Odt))),h!=(mon(),Nvt)&&(s+=a*S$n(o.e,h),s+=u*rxn(o.e)),f+=syn(o.d,o.e)+s,r=new Wb(o.b);r.a<r.c.c.length;)i=BB(n0(r),37),(e=BB(xq(n.b,i.p),214)).s||(f+=nCn(n,e));return f}function iKn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(o=b=t.length,b1(0,t.length),45==t.charCodeAt(0)?(f=-1,l=1,--b):(f=1,l=0),r=b/(c=(uHn(),cet)[10])|0,0!=(g=b%c)&&++r,u=x8(ANt,hQn,25,r,15,1),e=ret[8],a=0,w=l+(0==g?c:g),d=l;d<o;w=(d=w)+c)i=l_n(t.substr(d,w-d),_Vn,DWn),$On(),s=dvn(u,u,a,e),s+=Uwn(u,a,i),u[a++]=s;h=a,n.e=f,n.d=h,n.a=u,X0(n)}function rKn(n,t,e,i,r,c,a){if(n.c=i.qf().a,n.d=i.qf().b,r&&(n.c+=r.qf().a,n.d+=r.qf().b),n.b=t.rf().a,n.a=t.rf().b,r)switch(r.Hf().g){case 0:case 2:n.c+=r.rf().a+a+c.a+a;break;case 4:n.c-=a+c.a+a+t.rf().a;break;case 1:n.c+=r.rf().a+a,n.d-=a+c.b+a+t.rf().b;break;case 3:n.c+=r.rf().a+a,n.d+=r.rf().b+a+c.b+a}else e?n.c-=a+t.rf().a:n.c+=i.rf().a+a}function cKn(n,t){var e,i;for(this.b=new Np,this.e=new Np,this.a=n,this.d=t,Gpn(this),pdn(this),this.b.dc()?this.c=n.c.p:this.c=BB(this.b.Xb(0),10).c.p,0==this.e.c.length?this.f=n.c.p:this.f=BB(xq(this.e,this.e.c.length-1),10).c.p,i=BB(mMn(n,(hWn(),Plt)),15).Kc();i.Ob();)if(Lx(e=BB(i.Pb(),70),(HXn(),Vdt))){this.d=BB(mMn(e,Vdt),227);break}}function aKn(n,t,e){var i,r,c,a,u,o,s,h;for(i=BB(RX(n.a,t),53),c=BB(RX(n.a,e),53),r=BB(RX(n.e,t),53),a=BB(RX(n.e,e),53),i.a.zc(e,i),a.a.zc(t,a),h=c.a.ec().Kc();h.Ob();)s=BB(h.Pb(),10),i.a.zc(s,i),TU(BB(RX(n.e,s),53),t),Frn(BB(RX(n.e,s),53),r);for(o=r.a.ec().Kc();o.Ob();)u=BB(o.Pb(),10),a.a.zc(u,a),TU(BB(RX(n.a,u),53),e),Frn(BB(RX(n.a,u),53),c)}function uKn(n,t,e){var i,r,c,a,u,o,s,h;for(i=BB(RX(n.a,t),53),c=BB(RX(n.a,e),53),r=BB(RX(n.b,t),53),a=BB(RX(n.b,e),53),i.a.zc(e,i),a.a.zc(t,a),h=c.a.ec().Kc();h.Ob();)s=BB(h.Pb(),10),i.a.zc(s,i),TU(BB(RX(n.b,s),53),t),Frn(BB(RX(n.b,s),53),r);for(o=r.a.ec().Kc();o.Ob();)u=BB(o.Pb(),10),a.a.zc(u,a),TU(BB(RX(n.a,u),53),e),Frn(BB(RX(n.a,u),53),c)}function oKn(n,t){var e,i,r;switch(OTn(t,"Breaking Point Insertion",1),i=new MAn(n),BB(mMn(n,(HXn(),Bpt)),337).g){case 2:r=new Tc;case 0:r=new wc;break;default:r=new Mc}if(e=r.Vf(n,i),qy(TD(mMn(n,qpt)))&&(e=Dqn(n,e)),!r.Wf()&&Lx(n,Xpt))switch(BB(mMn(n,Xpt),338).g){case 2:e=XCn(i,e);break;case 1:e=KTn(i,e)}e.dc()||tXn(n,e),HSn(t)}function sKn(n,t,e){var i,r,c,a,u,o,s;if(s=t,$in(o=Q3(n,L3(e),s),R2(s,q6n)),a=N2(s,L6n),VCn((i=new oI(n,o)).a,i.b,a),u=N2(s,N6n),QCn((r=new sI(n,o)).a,r.b,u),0==(!o.b&&(o.b=new hK(KOt,o,4,7)),o.b).i||0==(!o.c&&(o.c=new hK(KOt,o,5,8)),o.c).i)throw c=R2(s,q6n),Hp(new ek(X6n+c+W6n));return STn(s,o),sXn(n,s,o),xon(n,s,o)}function hKn(n,t){var i,r,c,a,u,o,s;for(c=x8(ANt,hQn,25,n.e.a.c.length,15,1),u=new Wb(n.e.a);u.a<u.c.c.length;)c[(a=BB(n0(u),121)).d]+=a.b.a.c.length;for(o=zB(t);0!=o.b;)for(r=L9(new Wb((a=BB(0==o.b?null:(Px(0!=o.b),Atn(o,o.a.a)),121)).g.a));r.Ob();)(s=(i=BB(r.Pb(),213)).e).e=e.Math.max(s.e,a.e+i.a),--c[s.d],0==c[s.d]&&r5(o,s,o.c.b,o.c)}function fKn(n){var t,i,r,c,a,u,o,s,h,f,l;for(i=_Vn,c=DWn,o=new Wb(n.e.a);o.a<o.c.c.length;)a=BB(n0(o),121),c=e.Math.min(c,a.e),i=e.Math.max(i,a.e);for(t=x8(ANt,hQn,25,i-c+1,15,1),u=new Wb(n.e.a);u.a<u.c.c.length;)(a=BB(n0(u),121)).e-=c,++t[a.e];if(r=0,null!=n.k)for(f=0,l=(h=n.k).length;f<l&&(s=h[f],t[r++]+=s,t.length!=r);++f);return t}function lKn(n){switch(n.d){case 9:case 8:return!0;case 3:case 5:case 4:case 6:return!1;case 7:return BB(Kxn(n),19).a==n.o;case 1:case 2:if(-2==n.o)return!1;switch(n.p){case 0:case 1:case 2:case 6:case 5:case 7:return QI(n.k,n.f);case 3:case 4:return n.j==n.e;default:return null==n.n?null==n.g:Nfn(n.n,n.g)}default:return!1}}function bKn(n){NM(n,new MTn(vj(wj(pj(gj(new du,K5n),"ELK Fixed"),"Keeps the current layout as it is, without any automatic modification. Optional coordinates can be given for nodes and edge bend points."),new Vu))),u2(n,K5n,QJn,dCt),u2(n,K5n,g3n,mpn(gCt)),u2(n,K5n,g5n,mpn(hCt)),u2(n,K5n,PZn,mpn(fCt)),u2(n,K5n,BZn,mpn(bCt)),u2(n,K5n,Y2n,mpn(lCt))}function wKn(n,t,e){var i,r,c,a;if(i=dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15))),a=dG(cbn(SVn,rV(dG(cbn(null==e?0:nsn(e),PVn)),15))),(c=Jrn(n,t,i))&&a==c.f&&wW(e,c.i))return e;if(Zrn(n,e,a))throw Hp(new _y("value already present: "+e));return r=new qW(t,i,e,a),c?(LLn(n,c),YCn(n,r,c),c.e=null,c.c=null,c.i):(YCn(n,r,null),qkn(n),null)}function dKn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;s=e.a.c,a=e.a.c+e.a.b,l=(c=BB(RX(e.c,t),459)).f,b=c.a,u=c.b?new xC(a,l):new xC(s,l),h=c.c?new xC(s,b):new xC(a,b),r=s,e.p||(r+=n.c),o=new xC(r+=e.F+e.v*n.b,l),f=new xC(r,b),nin(t.a,Pun(Gk(PMt,1),sVn,8,0,[u,o])),e.d.a.gc()>1&&(i=new xC(r,e.b),DH(t.a,i)),nin(t.a,Pun(Gk(PMt,1),sVn,8,0,[f,h]))}function gKn(n,t,e){var i,r,c,a,u,o;if(t){if(e<=-1){if(cL(i=itn(t.Tg(),-1-e),99))return BB(i,18);for(u=0,o=(a=BB(t.ah(i),153)).gc();u<o;++u)if(GI(a.jl(u))===GI(n)&&cL(r=a.il(u),99)&&0!=((c=BB(r,18)).Bb&h6n))return c;throw Hp(new Fy("The containment feature could not be located"))}return Cvn(BB(itn(n.Tg(),e),18))}return null}function pKn(n){var t,e,i,r,c;for(i=n.length,t=new Pk,c=0;c<i;)if(9!=(e=fV(n,c++))&&10!=e&&12!=e&&13!=e&&32!=e)if(35!=e)92==e&&c<i?35==(b1(c,n.length),r=n.charCodeAt(c))||9==r||10==r||12==r||13==r||32==r?(NX(t,r&QVn),++c):(t.a+="\\",NX(t,r&QVn),++c):NX(t,e&QVn);else for(;c<i&&13!=(e=fV(n,c++))&&10!=e;);return t.a}function vKn(n,t){var e,i,r;for(i=new Wb(t);i.a<i.c.c.length;)if(e=BB(n0(i),33),JIn(n.a,e,e),JIn(n.b,e,e),0!=(r=wDn(e)).c.length)for(n.d&&n.d.lg(r),JIn(n.a,e,(l1(0,r.c.length),BB(r.c[0],33))),JIn(n.b,e,BB(xq(r,r.c.length-1),33));0!=Dun(r).c.length;)r=Dun(r),n.d&&n.d.lg(r),JIn(n.a,e,(l1(0,r.c.length),BB(r.c[0],33))),JIn(n.b,e,BB(xq(r,r.c.length-1),33))}function mKn(n){var t,e,i,r,c,a,u,o,s,h;for(e=0,u=new Wb(n.d);u.a<u.c.c.length;)(a=BB(n0(u),101)).i&&(a.i.c=e++);for(t=kq($Nt,[sVn,ZYn],[177,25],16,[e,e],2),h=n.d,r=0;r<h.c.length;r++)if(l1(r,h.c.length),(o=BB(h.c[r],101)).i)for(c=r+1;c<h.c.length;c++)l1(c,h.c.length),(s=BB(h.c[c],101)).i&&(i=rMn(o,s),t[o.i.c][s.i.c]=i,t[s.i.c][o.i.c]=i);return t}function yKn(n,t,e,i){var r,c,a;return a=new yT(t,e),n.a?i?(++(r=BB(RX(n.b,t),283)).a,a.d=i.d,a.e=i.e,a.b=i,a.c=i,i.e?i.e.c=a:BB(RX(n.b,t),283).b=a,i.d?i.d.b=a:n.a=a,i.d=a,i.e=a):(n.e.b=a,a.d=n.e,n.e=a,(r=BB(RX(n.b,t),283))?(++r.a,(c=r.c).c=a,a.e=c,r.c=a):(VW(n.b,t,r=new sY(a)),++n.c)):(n.a=n.e=a,VW(n.b,t,new sY(a)),++n.c),++n.d,a}function kKn(n,t){var e,i,r,c,a,u,o,s;for(e=new RegExp(t,"g"),o=x8(Qtt,sVn,2,0,6,1),i=0,s=n,c=null;;){if(null==(u=e.exec(s))||""==s){o[i]=s;break}a=u.index,o[i]=s.substr(0,a),s=fx(s,a+u[0].length,s.length),e.lastIndex=0,c==s&&(o[i]=s.substr(0,1),s=s.substr(1)),c=s,++i}if(n.length>0){for(r=o.length;r>0&&""==o[r-1];)--r;r<o.length&&(o.length=r)}return o}function jKn(n,t){var e,i,r,c,a,u,o,s;for(u=null,r=!1,c=0,o=a4((s=kY(t)).a).i;c<o;++c)(e=jKn(n,BB(eGn(s,c,cL(a=BB(Wtn(a4(s.a),c),87).c,88)?BB(a,26):(gWn(),d$t)),26))).dc()||(u?(r||(r=!0,u=new rG(u)),u.Gc(e)):u=e);return(i=xIn(n,t)).dc()?u||(SQ(),SQ(),set):u?(r||(u=new rG(u)),u.Gc(i),u):i}function EKn(n,t){var e,i,r,c,a,u,o,s;for(u=null,i=!1,c=0,o=a4((s=kY(t)).a).i;c<o;++c)(e=EKn(n,BB(eGn(s,c,cL(a=BB(Wtn(a4(s.a),c),87).c,88)?BB(a,26):(gWn(),d$t)),26))).dc()||(u?(i||(i=!0,u=new rG(u)),u.Gc(e)):u=e);return(r=VOn(n,t)).dc()?u||(SQ(),SQ(),set):u?(i||(u=new rG(u)),u.Gc(r),u):r}function TKn(n,t,e){var i,r,c,a,u,o;if(cL(t,72))return _pn(n,t,e);for(u=null,c=null,i=BB(n.g,119),a=0;a<n.i;++a)if(Nfn(t,(r=i[a]).dd())&&cL(c=r.ak(),99)&&0!=(BB(c,18).Bb&h6n)){u=r;break}return u&&(mA(n.e)&&(o=c.$j()?LY(n,4,c,t,null,pBn(n,c,t,cL(c,99)&&0!=(BB(c,18).Bb&BQn)),!0):LY(n,c.Kj()?2:1,c,t,c.zj(),-1,!0),e?e.Ei(o):e=o),e=TKn(n,u,e)),e}function MKn(n){var t,i,r,c;r=n.o,qD(),n.A.dc()||Nfn(n.A,$rt)?c=r.a:(c=SIn(n.f),n.A.Hc((mdn(),RIt))&&!n.B.Hc((n_n(),XIt))&&(c=e.Math.max(c,SIn(BB(oV(n.p,(kUn(),sIt)),244))),c=e.Math.max(c,SIn(BB(oV(n.p,SIt),244)))),(t=oan(n))&&(c=e.Math.max(c,t.a))),qy(TD(n.e.yf().We((sWn(),FSt))))?r.a=e.Math.max(r.a,c):r.a=c,(i=n.f.i).c=0,i.b=c,_Fn(n.f)}function SKn(n,t){var e,i,r,c,a,u,o,s,h;if((e=t.Hh(n.a))&&null!=(o=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),"memberTypes")))){for(s=new Np,a=0,u=(c=kKn(o,"\\w")).length;a<u;++a)cL(h=-1==(i=(r=c[a]).lastIndexOf("#"))?uD(n,t.Aj(),r):0==i?M9(n,null,r.substr(1)):M9(n,r.substr(0,i),r.substr(i+1)),148)&&WB(s,BB(h,148));return s}return SQ(),SQ(),set}function PKn(n,t,e){var i,r,c,a,u,o,s,h;for(OTn(e,aZn,1),n.bf(t),c=0;n.df(c);){for(h=new Wb(t.e);h.a<h.c.c.length;)for(o=BB(n0(h),144),u=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[t.e,t.d,t.b])));dAn(u);)(a=BB(U5(u),357))!=o&&(r=n.af(a,o))&&UR(o.a,r);for(s=new Wb(t.e);s.a<s.c.c.length;)WSn(i=(o=BB(n0(s),144)).a,-n.d,-n.d,n.d,n.d),UR(o.d,i),kO(i);n.cf(),++c}HSn(e)}function CKn(n,t,e){var i,r,c,a;if(a=axn(n.e.Tg(),t),i=BB(n.g,119),ZM(),BB(t,66).Oj()){for(c=0;c<n.i;++c)if(r=i[c],a.rl(r.ak())&&Nfn(r,e))return fDn(n,c),!0}else if(null!=e){for(c=0;c<n.i;++c)if(r=i[c],a.rl(r.ak())&&Nfn(e,r.dd()))return fDn(n,c),!0}else for(c=0;c<n.i;++c)if(r=i[c],a.rl(r.ak())&&null==r.dd())return fDn(n,c),!0;return!1}function IKn(n,t){var e,i,r,c,a;for(null==n.c||n.c.length<t.c.length?n.c=x8($Nt,ZYn,25,t.c.length,16,1):nk(n.c),n.a=new Np,i=0,a=new Wb(t);a.a<a.c.c.length;)(r=BB(n0(a),10)).p=i++;for(e=new YT,c=new Wb(t);c.a<c.c.c.length;)r=BB(n0(c),10),n.c[r.p]||(hIn(n,r),0==e.b||(Px(0!=e.b),BB(e.a.a.c,15)).gc()<n.a.c.length?hO(e,n.a):fO(e,n.a),n.a=new Np);return e}function OKn(n,t,e,i){var r,c,a,u,o,s,h;for(Pen(a=BB(Wtn(t,0),33),0),Cen(a,0),(o=new Np).c[o.c.length]=a,u=a,c=new eq(n.a,a.g,a.f,(YLn(),_Et)),s=1;s<t.i;s++)Pen(h=BB(Wtn(t,s),33),(r=aqn(n,nHn(n,DEt,h,u,c,o,e),nHn(n,xEt,h,u,c,o,e),nHn(n,KEt,h,u,c,o,e),nHn(n,REt,h,u,c,o,e),h,u,i)).d),Cen(h,r.e),ab(r,_Et),c=r,u=h,o.c[o.c.length]=h;return c}function AKn(n){NM(n,new MTn(vj(wj(pj(gj(new du,Q4n),"ELK SPOrE Overlap Removal"),'A node overlap removal algorithm proposed by Nachmanson et al. in "Node overlap removal by growing a tree".'),new eu))),u2(n,Q4n,K4n,mpn(qTt)),u2(n,Q4n,QJn,BTt),u2(n,Q4n,vZn,8),u2(n,Q4n,q4n,mpn(HTt)),u2(n,Q4n,U4n,mpn(_Tt)),u2(n,Q4n,X4n,mpn(FTt)),u2(n,Q4n,X2n,(hN(),!1))}function $Kn(n,t,e,i){var r,c,a,u,o,s,h,f;for(a=_x(t.c,e,i),h=new Wb(t.a);h.a<h.c.c.length;){for(UR((s=BB(n0(h),10)).n,a),f=new Wb(s.j);f.a<f.c.c.length;)for(c=new Wb(BB(n0(f),11).g);c.a<c.c.c.length;)for(Ztn((r=BB(n0(c),17)).a,a),(u=BB(mMn(r,(HXn(),vgt)),74))&&Ztn(u,a),o=new Wb(r.b);o.a<o.c.c.length;)UR(BB(n0(o),70).n,a);WB(n.a,s),s.a=n}}function LKn(n,t){var e,i,r,c;if(OTn(t,"Node and Port Label Placement and Node Sizing",1),RA((gM(),new HV(n,!0,!0,new Ve))),BB(mMn(n,(hWn(),Zft)),21).Hc((bDn(),lft)))for(i=(r=BB(mMn(n,(HXn(),cpt)),21)).Hc((lIn(),iIt)),c=qy(TD(mMn(n,apt))),e=new Wb(n.b);e.a<e.c.c.length;)JT(AV(new Rq(null,new w1(BB(n0(e),29).a,16)),new Qe),new K_(r,i,c));HSn(t)}function NKn(n,t){var e,i,r,c,a,u;if((e=t.Hh(n.a))&&null!=(u=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),n8n))))switch(r=mN(u,YTn(35)),i=t.Hj(),-1==r?(a=az(n,Utn(i)),c=u):0==r?(a=null,c=u.substr(1)):(a=u.substr(0,r),c=u.substr(r+1)),DW(B7(n,t))){case 2:case 3:return Don(n,i,a,c);case 0:case 4:case 5:case 6:return Ron(n,i,a,c)}return null}function xKn(n,t,e){var i,r,c,a,u;if(ZM(),a=BB(t,66).Oj(),$xn(n.e,t)){if(t.hi()&&UFn(n,t,e,cL(t,99)&&0!=(BB(t,18).Bb&BQn)))return!1}else for(u=axn(n.e.Tg(),t),i=BB(n.g,119),c=0;c<n.i;++c)if(r=i[c],u.rl(r.ak()))return!(a?Nfn(r,e):null==e?null==r.dd():Nfn(e,r.dd()))&&(BB(ovn(n,c,a?BB(e,72):Z3(t,e)),72),!0);return f9(n,a?BB(e,72):Z3(t,e))}function DKn(n){var t,e,i,r,c;if(n.d)throw Hp(new Fy((ED(Yat),AYn+Yat.k+$Yn)));for(n.c==(Ffn(),BPt)&&Mzn(n,_Pt),t=new Wb(n.a.a);t.a<t.c.c.length;)BB(n0(t),189).e=0;for(r=new Wb(n.a.b);r.a<r.c.c.length;)for((i=BB(n0(r),81)).o=KQn,e=i.f.Kc();e.Ob();)++BB(e.Pb(),81).d.e;for(Gzn(n),c=new Wb(n.a.b);c.a<c.c.c.length;)BB(n0(c),81).k=!0;return n}function RKn(n,t){var e,i,r,c,a,u,o,s;for(u=new pPn(n),r5(e=new YT,t,e.c.b,e.c);0!=e.b;){for((i=BB(0==e.b?null:(Px(0!=e.b),Atn(e,e.a.a)),113)).d.p=1,a=new Wb(i.e);a.a<a.c.c.length;)jTn(u,r=BB(n0(a),409)),0==(s=r.d).d.p&&r5(e,s,e.c.b,e.c);for(c=new Wb(i.b);c.a<c.c.c.length;)jTn(u,r=BB(n0(c),409)),0==(o=r.c).d.p&&r5(e,o,e.c.b,e.c)}return u}function KKn(n){var t,e,i,r,c;if(1!=(i=Gy(MD(ZAn(n,(sWn(),yPt))))))for(MA(n,i*n.g,i*n.f),e=XO(_B((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c),new Bu)),c=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!n.n&&(n.n=new eU(zOt,n,1,7)),n.n),(!n.c&&(n.c=new eU(XOt,n,9,9)),n.c),e])));dAn(c);)(r=BB(U5(c),470)).Gg(i*r.Dg(),i*r.Eg()),r.Fg(i*r.Cg(),i*r.Bg()),(t=BB(r.We(cPt),8))&&(t.a*=i,t.b*=i)}function _Kn(n,t,e,i,r){var c,a,u,o,s,h;for(c=new Wb(n.b);c.a<c.c.c.length;)for(s=0,h=(o=n2(BB(n0(c),29).a)).length;s<h;++s)switch(BB(mMn(u=o[s],(HXn(),kgt)),163).g){case 1:vxn(u),PZ(u,t),lvn(u,!0,i);break;case 3:ZNn(u),PZ(u,e),lvn(u,!1,r)}for(a=new M2(n.b,0);a.b<a.d.gc();)0==(Px(a.b<a.d.gc()),BB(a.d.Xb(a.c=a.b++),29)).a.c.length&&fW(a)}function FKn(n,t){var e,i,r,c,a,u,o;if((e=t.Hh(n.a))&&null!=(o=SD(cdn((!e.b&&(e.b=new Jx((gWn(),k$t),X$t,e)),e.b),M7n)))){for(i=new Np,a=0,u=(c=kKn(o,"\\w")).length;a<u;++a)mK(r=c[a],"##other")?WB(i,"!##"+az(n,Utn(t.Hj()))):mK(r,"##local")?i.c[i.c.length]=null:mK(r,E7n)?WB(i,az(n,Utn(t.Hj()))):i.c[i.c.length]=r;return i}return SQ(),SQ(),set}function BKn(n,t){var e,i,r;return e=new Xn,(i=1==(i=BB(P4($V(new Rq(null,new w1(n.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Xet),Uet]))),21).gc())?1:0)<(r=1==(r=BB(P4($V(new Rq(null,new w1(t.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[Xet,Uet]))),21).gc())?1:0)?-1:i==r?0:1}function HKn(n){var t,e,i,r,c,a,u,o,s,h,f,l;for(r=qy(TD(mMn(u=n.i,(HXn(),wgt)))),h=0,i=0,s=new Wb(n.g);s.a<s.c.c.length;)c=(a=b5(o=BB(n0(s),17)))&&r&&qy(TD(mMn(o,dgt))),l=o.d.i,a&&c?++i:a&&!c?++h:vW(l).e==u?++i:++h;for(e=new Wb(n.e);e.a<e.c.c.length;)c=(a=b5(t=BB(n0(e),17)))&&r&&qy(TD(mMn(t,dgt))),f=t.c.i,a&&c?++h:a&&!c?++i:vW(f).e==u?++h:++i;return h-i}function qKn(n,t,e,i){this.e=n,this.k=BB(mMn(n,(hWn(),Alt)),304),this.g=x8(Out,a1n,10,t,0,1),this.b=x8(Ptt,sVn,333,t,7,1),this.a=x8(Out,a1n,10,t,0,1),this.d=x8(Ptt,sVn,333,t,7,1),this.j=x8(Out,a1n,10,t,0,1),this.i=x8(Ptt,sVn,333,t,7,1),this.p=x8(Ptt,sVn,333,t,7,1),this.n=x8(ktt,sVn,476,t,8,1),yS(this.n,(hN(),!1)),this.f=x8(ktt,sVn,476,t,8,1),yS(this.f,!0),this.o=e,this.c=i}function GKn(n,t){var e,i,r;if(!t.dc())if(BB(t.Xb(0),286).d==($Pn(),nht))Akn(n,t);else for(i=t.Kc();i.Ob();){switch((e=BB(i.Pb(),286)).d.g){case 5:hPn(n,e,Vbn(n,e));break;case 0:hPn(n,e,(r=(e.f-e.c+1-1)/2|0,e.c+r));break;case 4:hPn(n,e,$nn(n,e));break;case 2:Kwn(e),hPn(n,e,$En(e)?e.c:e.f);break;case 1:Kwn(e),hPn(n,e,$En(e)?e.f:e.c)}hMn(e.a)}}function zKn(n,t){var e,i,r,c,a;if(!t.e){for(t.e=!0,i=t.d.a.ec().Kc();i.Ob();)e=BB(i.Pb(),17),t.o&&t.d.a.gc()<=1?(a=new xC((c=t.a.c)+(t.a.c+t.a.b-c)/2,t.b),DH(BB(t.d.a.ec().Kc().Pb(),17).a,a)):(r=BB(RX(t.c,e),459)).b||r.c?dKn(n,e,t):n.d==(Usn(),rmt)&&(r.d||r.e)&&LOn(n,t)&&t.d.a.gc()<=1?dzn(e,t):DDn(n,e,t);t.k&&e5(t.d,new Te)}}function UKn(n,t,i,r,c,a){var u,o,s,h,f,l,b,w,d,g,p,v,m;for(o=(r+c)/2+a,g=i*e.Math.cos(o),p=i*e.Math.sin(o),v=g-t.g/2,m=p-t.f/2,Pen(t,v),Cen(t,m),l=n.a.jg(t),(d=2*e.Math.acos(i/i+n.c))<c-r?(b=d/l,u=(r+c-d)/2):(b=(c-r)/l,u=r),w=wDn(t),n.e&&(n.e.kg(n.d),n.e.lg(w)),h=new Wb(w);h.a<h.c.c.length;)s=BB(n0(h),33),f=n.a.jg(s),UKn(n,s,i+n.c,u,u+b*f,a),u+=b*f}function XKn(n,t,e){var i;switch(i=e.q.getMonth(),t){case 5:oO(n,Pun(Gk(Qtt,1),sVn,2,6,["J","F","M","A","M","J","J","A","S","O","N","D"])[i]);break;case 4:oO(n,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn])[i]);break;case 3:oO(n,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"])[i]);break;default:Enn(n,i+1,t)}}function WKn(n,t){var e,i,r,c;if(OTn(t,"Network simplex",1),n.e.a.c.length<1)HSn(t);else{for(r=new Wb(n.e.a);r.a<r.c.c.length;)BB(n0(r),121).e=0;for((c=n.e.a.c.length>=40)&&EFn(n),BHn(n),Txn(n),e=yln(n),i=0;e&&i<n.f;)e_n(n,e,e$n(n,e)),e=yln(n),++i;c&&tTn(n),n.a?p$n(n,fKn(n)):fKn(n),n.b=null,n.d=null,n.p=null,n.c=null,n.g=null,n.i=null,n.n=null,n.o=null,HSn(t)}}function VKn(n,t,e,i){var r,c,a,u,o,s,h,f;for(XR(u=new xC(e,i),BB(mMn(t,(Mrn(),oat)),8)),f=new Wb(t.e);f.a<f.c.c.length;)UR((h=BB(n0(f),144)).d,u),WB(n.e,h);for(a=new Wb(t.c);a.a<a.c.c.length;){for(r=new Wb((c=BB(n0(a),282)).a);r.a<r.c.c.length;)UR(BB(n0(r),559).d,u);WB(n.c,c)}for(s=new Wb(t.d);s.a<s.c.c.length;)UR((o=BB(n0(s),447)).d,u),WB(n.d,o)}function QKn(n,t){var e,i,r,c,a,u,o,s;for(o=new Wb(t.j);o.a<o.c.c.length;)for(r=new m6((u=BB(n0(o),11)).b);y$(r.a)||y$(r.b);)t!=(c=(e=(i=BB(y$(r.a)?n0(r.a):n0(r.b),17)).c==u?i.d:i.c).i)&&((s=BB(mMn(i,(HXn(),fpt)),19).a)<0&&(s=0),a=c.p,0==n.b[a]&&(i.d==e?(n.a[a]-=s+1,n.a[a]<=0&&n.c[a]>0&&DH(n.f,c)):(n.c[a]-=s+1,n.c[a]<=0&&n.a[a]>0&&DH(n.e,c))))}function YKn(n){var t,e,i,r,c,a,u;for(c=new dE(BB(yX(new Rn),62)),u=KQn,e=new Wb(n.d);e.a<e.c.c.length;){for(u=(t=BB(n0(e),222)).c.c;0!=c.a.c&&(a=BB(MU(q9(c.a)),222)).c.c+a.c.b<u;)$J(c.a,a);for(r=new Fb(new BR(new xN(new _b(c.a).a).b));aS(r.a.a);)DH((i=BB(mx(r.a).cd(),222)).b,t),DH(t.b,i);Mon(c.a,t,(hN(),ptt))}}function JKn(n,t,e){var i,r,c,a,u,o,s,h,f;for(c=new J6(t.c.length),s=new Wb(t);s.a<s.c.c.length;)a=BB(n0(s),10),WB(c,n.b[a.c.p][a.p]);for(mqn(n,c,e),f=null;f=ezn(c);)rBn(n,BB(f.a,233),BB(f.b,233),c);for(t.c=x8(Ant,HWn,1,0,5,1),r=new Wb(c);r.a<r.c.c.length;)for(o=0,h=(u=(i=BB(n0(r),233)).d).length;o<h;++o)a=u[o],t.c[t.c.length]=a,n.a[a.c.p][a.p].a=lL(i.g,i.d[0]).a}function ZKn(n,t){var e,i,r,c;if(0<(cL(n,14)?BB(n,14).gc():F3(n.Kc()))){if(1<(r=t)){for(--r,c=new pa,i=n.Kc();i.Ob();)e=BB(i.Pb(),86),c=Wen(Pun(Gk(xnt,1),HWn,20,0,[c,new bg(e)]));return ZKn(c,r)}if(r<0){for(c=new va,i=n.Kc();i.Ob();)e=BB(i.Pb(),86),c=Wen(Pun(Gk(xnt,1),HWn,20,0,[c,new bg(e)]));if(0<(cL(c,14)?BB(c,14).gc():F3(c.Kc())))return ZKn(c,r)}}return BB(iL(n.Kc()),86)}function n_n(){n_n=O,GIt=new QC("DEFAULT_MINIMUM_SIZE",0),UIt=new QC("MINIMUM_SIZE_ACCOUNTS_FOR_PADDING",1),qIt=new QC("COMPUTE_PADDING",2),XIt=new QC("OUTSIDE_NODE_LABELS_OVERHANG",3),WIt=new QC("PORTS_OVERHANG",4),QIt=new QC("UNIFORM_PORT_SPACING",5),VIt=new QC("SPACE_EFFICIENT_PORT_LABELS",6),zIt=new QC("FORCE_TABULAR_NODE_LABELS",7),HIt=new QC("ASYMMETRICAL",8)}function t_n(n,t){var e,i,r,c,a,u,o,s;if(t){if(e=(c=t.Tg())?Utn(c).Nh().Jh(c):null){for(Jgn(n,t,e),o=0,s=(null==(r=t.Tg()).i&&qFn(r),r.i).length;o<s;++o)null==r.i&&qFn(r),i=r.i,(u=o>=0&&o<i.length?i[o]:null).Ij()&&!u.Jj()&&(cL(u,322)?nvn(n,BB(u,34),t,e):0!=((a=BB(u,18)).Bb&h6n)&&sEn(n,a,t,e));t.kh()&&BB(e,49).vh(BB(t,49).qh())}return e}return null}function e_n(n,t,e){var i,r,c;if(!t.f)throw Hp(new _y("Given leave edge is no tree edge."));if(e.f)throw Hp(new _y("Given enter edge is a tree edge already."));for(t.f=!1,eL(n.p,t),e.f=!0,TU(n.p,e),i=e.e.e-e.d.e-e.a,FCn(n,e.e,t)||(i=-i),c=new Wb(n.e.a);c.a<c.c.c.length;)FCn(n,r=BB(n0(c),121),t)||(r.e+=i);n.j=1,nk(n.c),pIn(n,BB(n0(new Wb(n.e.a)),121)),gGn(n)}function i_n(n,t){var e,i,r,c,a,u;if((u=BB(mMn(t,(HXn(),ept)),98))==(QEn(),WCt)||u==XCt)for(r=new xC(t.f.a+t.d.b+t.d.c,t.f.b+t.d.d+t.d.a).b,a=new Wb(n.a);a.a<a.c.c.length;)(c=BB(n0(a),10)).k==(uSn(),Mut)&&((e=BB(mMn(c,(hWn(),Qft)),61))!=(kUn(),oIt)&&e!=CIt||(i=Gy(MD(mMn(c,Tlt))),u==WCt&&(i*=r),c.n.b=i-BB(mMn(c,npt),8).b,Jan(c,!1,!0)))}function r_n(n,t,e,i){var r,c,a,u,o,s,h,f,l,b;if(Ytn(n,t,e),c=t[e],b=i?(kUn(),CIt):(kUn(),oIt),mL(t.length,e,i)){for(G6(n,r=t[i?e-1:e+1],i?(ain(),qvt):(ain(),Hvt)),h=0,l=(o=c).length;h<l;++h)xvn(n,a=o[h],b);for(G6(n,c,i?(ain(),Hvt):(ain(),qvt)),s=0,f=(u=r).length;s<f;++s)(a=u[s]).e||xvn(n,a,Tln(b))}else for(s=0,f=(u=c).length;s<f;++s)xvn(n,a=u[s],b);return!1}function c_n(n,t,e,i){var r,c,a,u,o;u=abn(t,e),(e==(kUn(),SIt)||e==CIt)&&(u=cL(u,152)?o6(BB(u,152)):cL(u,131)?BB(u,131).a:cL(u,54)?new fy(u):new CT(u)),a=!1;do{for(r=!1,c=0;c<u.gc()-1;c++)BMn(n,BB(u.Xb(c),11),BB(u.Xb(c+1),11),i)&&(a=!0,k0(n.a,BB(u.Xb(c),11),BB(u.Xb(c+1),11)),o=BB(u.Xb(c+1),11),u._c(c+1,BB(u.Xb(c),11)),u._c(c,o),r=!0)}while(r);return a}function a_n(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w;if(!mA(n.e))return BB(YIn(n,t,e),72);if(t!=e&&(a=(b=(r=BB(n.g,119))[e]).ak(),$xn(n.e,a))){for(w=axn(n.e.Tg(),a),o=-1,u=-1,i=0,s=0,f=t>e?t:e;s<=f;++s)s==e?u=i++:(c=r[s],h=w.rl(c.ak()),s==t&&(o=s!=f||h?i:i-1),h&&++i);return l=BB(Iln(n,t,e),72),u!=o&&Lv(n,new j9(n.e,7,a,iln(u),b.dd(),o)),l}return BB(Iln(n,t,e),72)}function u_n(n,t){var e,i,r,c,a,u;for(OTn(t,"Port order processing",1),u=BB(mMn(n,(HXn(),opt)),421),e=new Wb(n.b);e.a<e.c.c.length;)for(r=new Wb(BB(n0(e),29).a);r.a<r.c.c.length;)i=BB(n0(r),10),c=BB(mMn(i,ept),98),a=i.j,c==(QEn(),UCt)||c==WCt||c==XCt?(SQ(),m$(a,sst)):c!=QCt&&c!=YCt&&(SQ(),m$(a,fst),Lvn(a),u==(U7(),_vt)&&m$(a,hst)),i.i=!0,eIn(i);HSn(t)}function o_n(n){var t,i,r,c,a,u,o,s;for(s=new xp,t=new Fv,u=n.Kc();u.Ob();)c=BB(u.Pb(),10),o=AN(oM(new qv,c),t),jCn(s.f,c,o);for(a=n.Kc();a.Ob();)for(r=new oz(ZL(lbn(c=BB(a.Pb(),10)).a.Kc(),new h));dAn(r);)b5(i=BB(U5(r),17))||UNn(aM(cM(rM(uM(new Hv,e.Math.max(1,BB(mMn(i,(HXn(),lpt)),19).a)),1),BB(RX(s,i.c.i),121)),BB(RX(s,i.d.i),121)));return t}function s_n(){s_n=O,byt=dq(new B2,(yMn(),Fat),(lWn(),vot)),dyt=dq(new B2,_at,jot),gyt=WG(dq(new B2,_at,Dot),Bat,xot),lyt=WG(dq(dq(new B2,_at,lot),Fat,bot),Bat,wot),pyt=ogn(ogn(FM(WG(dq(new B2,Rat,Uot),Bat,zot),Fat),Got),Xot),wyt=WG(new B2,Bat,mot),hyt=WG(dq(dq(dq(new B2,Kat,Mot),Fat,Pot),Fat,Cot),Bat,Sot),fyt=WG(dq(dq(new B2,Fat,Cot),Fat,uot),Bat,aot)}function h_n(n,t,e,i,r,c){var a,u,o,s,h,f;for(a=lSn(t,o=jon(t)-jon(n)),u=M$(0,0,0);o>=0&&(!Cyn(n,a)||(o<22?u.l|=1<<o:o<44?u.m|=1<<o-22:u.h|=1<<o-44,0!=n.l||0!=n.m||0!=n.h));)s=a.m,h=a.h,f=a.l,a.h=h>>>1,a.m=s>>>1|(1&h)<<21,a.l=f>>>1|(1&s)<<21,--o;return e&&Oon(u),c&&(i?(ltt=aon(n),r&&(ltt=hun(ltt,(X7(),dtt)))):ltt=M$(n.l,n.m,n.h)),u}function f_n(n,t){var e,i,r,c,a,u,o,s,h,f;for(s=n.e[t.c.p][t.p]+1,o=t.c.a.c.length+1,u=new Wb(n.a);u.a<u.c.c.length;){for(a=BB(n0(u),11),f=0,c=0,r=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[new Hw(a),new Gw(a)])));dAn(r);)(i=BB(U5(r),11)).i.c==t.c&&(f+=bL(n,i.i)+1,++c);e=f/c,(h=a.j)==(kUn(),oIt)?n.f[a.p]=e<s?n.c-e:n.b+(o-e):h==CIt&&(n.f[a.p]=e<s?n.b+e:n.c-(o-e))}}function l_n(n,t,e){var i,r,c,a;if(null==n)throw Hp(new Mk(zWn));for(i=(c=n.length)>0&&(b1(0,n.length),45==n.charCodeAt(0)||(b1(0,n.length),43==n.charCodeAt(0)))?1:0;i<c;i++)if(-1==egn((b1(i,n.length),n.charCodeAt(i))))throw Hp(new Mk(DQn+n+'"'));if(r=(a=parseInt(n,10))<t,isNaN(a))throw Hp(new Mk(DQn+n+'"'));if(r||a>e)throw Hp(new Mk(DQn+n+'"'));return a}function b_n(n){var t,i,r,c,a,u;for(a=new YT,c=new Wb(n.a);c.a<c.c.c.length;)Vl(r=BB(n0(c),112),r.f.c.length),Ql(r,r.k.c.length),0==r.i&&(r.o=0,r5(a,r,a.c.b,a.c));for(;0!=a.b;)for(i=(r=BB(0==a.b?null:(Px(0!=a.b),Atn(a,a.a.a)),112)).o+1,t=new Wb(r.f);t.a<t.c.c.length;)Yl(u=BB(n0(t),129).a,e.Math.max(u.o,i)),Ql(u,u.i-1),0==u.i&&r5(a,u,a.c.b,a.c)}function w_n(n){var t,e,i,r,c,a,u,o;for(a=new Wb(n);a.a<a.c.c.length;){for(c=BB(n0(a),79),u=(i=PTn(BB(Wtn((!c.b&&(c.b=new hK(KOt,c,4,7)),c.b),0),82))).i,o=i.j,CA(r=BB(Wtn((!c.a&&(c.a=new eU(FOt,c,6,6)),c.a),0),202),r.j+u,r.k+o),PA(r,r.b+u,r.c+o),e=new AL((!r.a&&(r.a=new $L(xOt,r,5)),r.a));e.e!=e.i.gc();)TA(t=BB(kpn(e),469),t.a+u,t.b+o);Yrn(BB(ZAn(c,(sWn(),OSt)),74),u,o)}}function d_n(n){switch(n){case 100:return mWn(snt,!0);case 68:return mWn(snt,!1);case 119:return mWn(hnt,!0);case 87:return mWn(hnt,!1);case 115:return mWn(fnt,!0);case 83:return mWn(fnt,!1);case 99:return mWn(lnt,!0);case 67:return mWn(lnt,!1);case 105:return mWn(bnt,!0);case 73:return mWn(bnt,!1);default:throw Hp(new dy(ont+n.toString(16)))}}function g_n(n){var t,i,r,c,a;switch(c=BB(xq(n.a,0),10),t=new $vn(n),WB(n.a,t),t.o.a=e.Math.max(1,c.o.a),t.o.b=e.Math.max(1,c.o.b),t.n.a=c.n.a,t.n.b=c.n.b,BB(mMn(c,(hWn(),Qft)),61).g){case 4:t.n.a+=2;break;case 1:t.n.b+=2;break;case 2:t.n.a-=2;break;case 3:t.n.b-=2}return CZ(r=new CSn,t),SZ(i=new wY,a=BB(xq(c.j,0),11)),MZ(i,r),UR(kO(r.n),a.n),UR(kO(r.a),a.a),t}function p_n(n,t,e,i,r){e&&(!i||(n.c-n.b&n.a.length-1)>1)&&1==t&&BB(n.a[n.b],10).k==(uSn(),Sut)?hFn(BB(n.a[n.b],10),(Xyn(),jCt)):i&&(!e||(n.c-n.b&n.a.length-1)>1)&&1==t&&BB(n.a[n.c-1&n.a.length-1],10).k==(uSn(),Sut)?hFn(BB(n.a[n.c-1&n.a.length-1],10),(Xyn(),ECt)):2==(n.c-n.b&n.a.length-1)?(hFn(BB(Eon(n),10),(Xyn(),jCt)),hFn(BB(Eon(n),10),ECt)):sLn(n,r),o4(n)}function v_n(n,t,i){var r,c,a,u,o;for(a=0,c=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));c.e!=c.i.gc();)u="",0==(!(r=BB(kpn(c),33)).n&&(r.n=new eU(zOt,r,1,7)),r.n).i||(u=BB(Wtn((!r.n&&(r.n=new eU(zOt,r,1,7)),r.n),0),137).a),qan(o=new csn(a++,t,u),r),hon(o,(qqn(),skt),r),o.e.b=r.j+r.f/2,o.f.a=e.Math.max(r.g,1),o.e.a=r.i+r.g/2,o.f.b=e.Math.max(r.f,1),DH(t.b,o),jCn(i.f,r,o)}function m_n(n){var t,e,i,r,c;i=BB(mMn(n,(hWn(),dlt)),33),c=BB(ZAn(i,(HXn(),Fgt)),174).Hc((mdn(),_It)),n.e||(r=BB(mMn(n,Zft),21),t=new xC(n.f.a+n.d.b+n.d.c,n.f.b+n.d.d+n.d.a),r.Hc((bDn(),lft))?(Ypn(i,ept,(QEn(),XCt)),KUn(i,t.a,t.b,!1,!0)):qy(TD(ZAn(i,Bgt)))||KUn(i,t.a,t.b,!0,!0)),Ypn(i,Fgt,c?nbn(_It):new YK(e=BB(Vj(YIt),9),BB(SR(e,e.length),9),0))}function y_n(n,t,e){var i,r,c,a;if(t[0]>=n.length)return e.o=0,!0;switch(fV(n,t[0])){case 43:r=1;break;case 45:r=-1;break;default:return e.o=0,!0}if(++t[0],c=t[0],0==(a=UIn(n,t))&&t[0]==c)return!1;if(t[0]<n.length&&58==fV(n,t[0])){if(i=60*a,++t[0],c=t[0],0==(a=UIn(n,t))&&t[0]==c)return!1;i+=a}else(i=a)<24&&t[0]-c<=2?i*=60:i=i%100+60*(i/100|0);return i*=r,e.o=-i,!0}function k_n(n){var t,e,i,r,c,a,u;for(r=new Np,i=new oz(ZL(lbn(n.b).a.Kc(),new h));dAn(i);)b5(e=BB(U5(i),17))&&WB(r,new j6(e,v9(n,e.c),v9(n,e.d)));for(u=new Kb(new Ob(n.e).a.vc().Kc());u.a.Ob();)t=BB(u.a.Pb(),42),(c=BB(t.dd(),113)).d.p=0;for(a=new Kb(new Ob(n.e).a.vc().Kc());a.a.Ob();)t=BB(a.a.Pb(),42),0==(c=BB(t.dd(),113)).d.p&&WB(n.d,RKn(n,c))}function j_n(n){var t,e,i,r,c;for(c=WJ(n),r=new AL((!n.e&&(n.e=new hK(_Ot,n,7,4)),n.e));r.e!=r.i.gc();)if(i=BB(kpn(r),79),!Ctn(PTn(BB(Wtn((!i.c&&(i.c=new hK(KOt,i,5,8)),i.c),0),82)),c))return!0;for(e=new AL((!n.d&&(n.d=new hK(_Ot,n,8,5)),n.d));e.e!=e.i.gc();)if(t=BB(kpn(e),79),!Ctn(PTn(BB(Wtn((!t.b&&(t.b=new hK(KOt,t,4,7)),t.b),0),82)),c))return!0;return!1}function E_n(n){var t,i,r,c,a,u,o,s;for(s=new km,o=null,i=BB(b3(t=spn(n,0)),8),c=BB(b3(t),8);t.b!=t.d.c;)o=i,i=c,c=BB(b3(t),8),a=ctn(XR(new xC(o.a,o.b),i)),u=ctn(XR(new xC(c.a,c.b),i)),r=10,r=e.Math.min(r,e.Math.abs(a.a+a.b)/2),r=e.Math.min(r,e.Math.abs(u.a+u.b)/2),a.a=HH(a.a)*r,a.b=HH(a.b)*r,u.a=HH(u.a)*r,u.b=HH(u.b)*r,DH(s,UR(a,i)),DH(s,UR(u,i));return s}function T_n(n,t,e,i){var r,c,a,u,o;return a=n.eh(),r=null,(o=n.Zg())?t&&0==(gKn(n,t,e).Bb&BQn)?(i=_pn(o.Vk(),n,i),n.uh(null),r=t.fh()):o=null:(a&&(o=a.fh()),t&&(r=t.fh())),o!=r&&o&&o.Zk(n),u=n.Vg(),n.Rg(t,e),o!=r&&r&&r.Yk(n),n.Lg()&&n.Mg()&&(a&&u>=0&&u!=e&&(c=new nU(n,1,u,a,null),i?i.Ei(c):i=c),e>=0&&(c=new nU(n,1,e,u==e?a:null,t),i?i.Ei(c):i=c)),i}function M_n(n){var t,e,i;if(null==n.b){if(i=new Sk,null!=n.i&&(cO(i,n.i),i.a+=":"),0!=(256&n.f)){for(0!=(256&n.f)&&null!=n.a&&(rQ(n.i)||(i.a+="//"),cO(i,n.a)),null!=n.d&&(i.a+="/",cO(i,n.d)),0!=(16&n.f)&&(i.a+="/"),t=0,e=n.j.length;t<e;t++)0!=t&&(i.a+="/"),cO(i,n.j[t]);null!=n.g&&(i.a+="?",cO(i,n.g))}else cO(i,n.a);null!=n.e&&(i.a+="#",cO(i,n.e)),n.b=i.a}return n.b}function S_n(n,t){var e,i,r,c,a,u;for(r=new Wb(t.a);r.a<r.c.c.length;)cL(c=mMn(i=BB(n0(r),10),(hWn(),dlt)),11)&&(u=yFn(t,i,(a=BB(c,11)).o.a,a.o.b),a.n.a=u.a,a.n.b=u.b,qCn(a,BB(mMn(i,Qft),61)));e=new xC(t.f.a+t.d.b+t.d.c,t.f.b+t.d.d+t.d.a),BB(mMn(t,(hWn(),Zft)),21).Hc((bDn(),lft))?(hon(n,(HXn(),ept),(QEn(),XCt)),BB(mMn(vW(n),Zft),21).Fc(dft),bGn(n,e,!1)):bGn(n,e,!0)}function P_n(n,t,e){var i,r,c,a,u;OTn(e,"Minimize Crossings "+n.a,1),i=0==t.b.c.length||!jE(AV(new Rq(null,new w1(t.b,16)),new aw(new Ac))).sd((dM(),tit)),u=1==t.b.c.length&&1==BB(xq(t.b,0),29).a.c.length,c=GI(mMn(t,(HXn(),sgt)))===GI((ufn(),pCt)),i||u&&!c||(Ssn(r=sxn(n,t),(a=BB(Dpn(r,0),214)).c.Rf()?a.c.Lf()?new Ud(n):new Xd(n):new zd(n)),afn(n)),HSn(e)}function C_n(n,t,e,i){var r,c,a,u;if(u=dG(cbn(SVn,rV(dG(cbn(null==t?0:nsn(t),PVn)),15))),r=dG(cbn(SVn,rV(dG(cbn(null==e?0:nsn(e),PVn)),15))),a=Zrn(n,t,u),c=Jrn(n,e,r),a&&r==a.a&&wW(e,a.g))return e;if(c&&!i)throw Hp(new _y("key already present: "+e));return a&&LLn(n,a),c&&LLn(n,c),YCn(n,new qW(e,r,t,u),c),c&&(c.e=null,c.c=null),a&&(a.e=null,a.c=null),qkn(n),a?a.g:null}function I_n(n,t,e){var i,r,c,a,u;for(c=0;c<t;c++){for(i=0,u=c+1;u<t;u++)i=rbn(rbn(cbn(e0(n[c],UQn),e0(n[u],UQn)),e0(e[c+u],UQn)),e0(dG(i),UQn)),e[c+u]=dG(i),i=jz(i,32);e[c+t]=dG(i)}for(ncn(e,e,t<<1),i=0,r=0,a=0;r<t;++r,a++)i=rbn(rbn(cbn(e0(n[r],UQn),e0(n[r],UQn)),e0(e[a],UQn)),e0(dG(i),UQn)),e[a]=dG(i),i=rbn(i=jz(i,32),e0(e[++a],UQn)),e[a]=dG(i),i=jz(i,32);return e}function O_n(n,t,i){var r,c,a,u,o,s,h,f;if(!h3(t)){for(s=Gy(MD(edn(i.c,(HXn(),Npt)))),!(h=BB(edn(i.c,Lpt),142))&&(h=new lm),r=i.a,c=null,o=t.Kc();o.Ob();)u=BB(o.Pb(),11),f=0,c?(f=s,f+=c.o.b):f=h.d,a=AN(oM(new qv,u),n.f),VW(n.k,u,a),UNn(aM(cM(rM(uM(new Hv,0),CJ(e.Math.ceil(f))),r),a)),c=u,r=a;UNn(aM(cM(rM(uM(new Hv,0),CJ(e.Math.ceil(h.a+c.o.b))),r),i.d))}}function A_n(n,t,e,i,r,c,a,u){var o,s,h;return h=!1,s=c-e.s,o=e.t-t.f+cHn(e,s,!1).a,!(i.g+u>s)&&(o+u+cHn(i,s,!1).a<=t.b&&(p9(e,c-e.s),e.c=!0,p9(i,c-e.s),Tvn(i,e.s,e.t+e.d+u),i.k=!0,xcn(e.q,i),h=!0,r&&(tin(t,i),i.j=t,n.c.length>a&&(Tkn((l1(a,n.c.length),BB(n.c[a],200)),i),0==(l1(a,n.c.length),BB(n.c[a],200)).a.c.length&&s6(n,a)))),h)}function $_n(n,t){var e,i,r,c,a;if(OTn(t,"Partition midprocessing",1),r=new pJ,JT(AV(new Rq(null,new w1(n.a,16)),new di),new ld(r)),0!=r.d){for(a=BB(P4(a1(new Rq(null,(r.i||(r.i=new HL(r,r.c))).Nc())),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),e=BB((i=a.Kc()).Pb(),19);i.Ob();)c=BB(i.Pb(),19),XLn(BB(h6(r,e),21),BB(h6(r,c),21)),e=c;HSn(t)}}function L_n(n,t,e){var i,r,c,a,u;if(0==t.p){for(t.p=1,(r=e)||(r=new rI(new Np,new YK(i=BB(Vj(FIt),9),BB(SR(i,i.length),9),0))),BB(r.a,15).Fc(t),t.k==(uSn(),Mut)&&BB(r.b,21).Fc(BB(mMn(t,(hWn(),Qft)),61)),a=new Wb(t.j);a.a<a.c.c.length;)for(c=BB(n0(a),11),u=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[new Hw(c),new Gw(c)])));dAn(u);)L_n(n,BB(U5(u),11).i,r);return r}return null}function N_n(n,t){var e,i,r,c,a;if(n.Ab)if(n.Ab){if((a=n.Ab.i)>0)if(r=BB(n.Ab.g,1934),null==t){for(c=0;c<a;++c)if(null==(e=r[c]).d)return e}else for(c=0;c<a;++c)if(mK(t,(e=r[c]).d))return e}else if(null==t){for(i=new AL(n.Ab);i.e!=i.i.gc();)if(null==(e=BB(kpn(i),590)).d)return e}else for(i=new AL(n.Ab);i.e!=i.i.gc();)if(mK(t,(e=BB(kpn(i),590)).d))return e;return null}function x_n(n,t){var e,i,r,c,a,u,o;if(null==(o=TD(mMn(t,(CAn(),Nkt))))||(kW(o),o)){for(DOn(n,t),r=new Np,u=spn(t.b,0);u.b!=u.d.c;)(e=xPn(n,BB(b3(u),86),null))&&(qan(e,t),r.c[r.c.length]=e);if(n.a=null,n.b=null,r.c.length>1)for(i=new Wb(r);i.a<i.c.c.length;)for(c=0,a=spn((e=BB(n0(i),135)).b,0);a.b!=a.d.c;)BB(b3(a),86).g=c++;return r}return u6(Pun(Gk(Gyt,1),tZn,135,0,[t]))}function D_n(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p;crn(b=A3(n,qun(t),r),R2(r,q6n)),d=D2(w=r,U6n),cSn(new Lg(b).a,d),g=D2(w,"endPoint"),rSn(new Rg(b).a,g),p=N2(w,D6n),SEn(new Fg(b).a,p),f=R2(r,K6n),qR((c=new hI(n,b)).a,c.b,f),l=R2(r,R6n),GR((a=new fI(n,b)).a,a.b,l),s=N2(r,F6n),Fyn((u=new lI(e,b)).b,u.a,s),h=N2(r,_6n),Byn((o=new bI(i,b)).b,o.a,h)}function R_n(n,t,e){var i,r,c,a,u;switch(u=null,t.g){case 1:for(r=new Wb(n.j);r.a<r.c.c.length;)if(qy(TD(mMn(i=BB(n0(r),11),(hWn(),tlt)))))return i;hon(u=new CSn,(hWn(),tlt),(hN(),!0));break;case 2:for(a=new Wb(n.j);a.a<a.c.c.length;)if(qy(TD(mMn(c=BB(n0(a),11),(hWn(),klt)))))return c;hon(u=new CSn,(hWn(),klt),(hN(),!0))}return u&&(CZ(u,n),qCn(u,e),yvn(u.n,n.o,e)),u}function K_n(n,t){var i,r,c,a,u,o;for(o=-1,u=new YT,r=new m6(n.b);y$(r.a)||y$(r.b);){for(i=BB(y$(r.a)?n0(r.a):n0(r.b),17),o=e.Math.max(o,Gy(MD(mMn(i,(HXn(),agt))))),i.c==n?JT(AV(new Rq(null,new w1(i.b,16)),new fe),new nd(u)):JT(AV(new Rq(null,new w1(i.b,16)),new le),new td(u)),a=spn(u,0);a.b!=a.d.c;)Lx(c=BB(b3(a),70),(hWn(),Uft))||hon(c,Uft,i);gun(t,u),yQ(u)}return o}function __n(n,t,e,i,r){var c,a,u,o;Bl(c=new $vn(n),(uSn(),Iut)),hon(c,(HXn(),ept),(QEn(),XCt)),hon(c,(hWn(),dlt),t.c.i),hon(a=new CSn,dlt,t.c),qCn(a,r),CZ(a,c),hon(t.c,Elt,c),Bl(u=new $vn(n),Iut),hon(u,ept,XCt),hon(u,dlt,t.d.i),hon(o=new CSn,dlt,t.d),qCn(o,r),CZ(o,u),hon(t.d,Elt,u),SZ(t,a),MZ(t,o),LZ(0,e.c.length),MS(e.c,0,c),i.c[i.c.length]=u,hon(c,Bft,iln(1)),hon(u,Bft,iln(1))}function F_n(n,t,i,r,c){var a,u,o,s,h;o=c?r.b:r.a,FT(n.a,r)||(h=o>i.s&&o<i.c,s=!1,0!=i.e.b&&0!=i.j.b&&(s|=e.Math.abs(o-Gy(MD(gx(i.e))))<lZn&&e.Math.abs(o-Gy(MD(gx(i.j))))<lZn,s|=e.Math.abs(o-Gy(MD(px(i.e))))<lZn&&e.Math.abs(o-Gy(MD(px(i.j))))<lZn),(h||s)&&((u=BB(mMn(t,(HXn(),vgt)),74))||(u=new km,hon(t,vgt,u)),r5(u,a=new wA(r),u.c.b,u.c),TU(n.a,a)))}function B_n(n,t,e,i){var r,c,a,u,o,s,h;if(WIn(n,t,e,i))return!0;for(a=new Wb(t.f);a.a<a.c.c.length;){switch(c=BB(n0(a),324),u=!1,s=(o=n.j-t.j+e)+t.o,r=(h=n.k-t.k+i)+t.p,c.a.g){case 0:u=Osn(n,o+c.b.a,0,o+c.c.a,h-1);break;case 1:u=Osn(n,s,h+c.b.a,n.o-1,h+c.c.a);break;case 2:u=Osn(n,o+c.b.a,r,o+c.c.a,n.p-1);break;default:u=Osn(n,0,h+c.b.a,o-1,h+c.c.a)}if(u)return!0}return!1}function H_n(n,t){var e,i,r,c,a,u,o,s;for(c=new Wb(t.b);c.a<c.c.c.length;)for(o=new Wb(BB(n0(c),29).a);o.a<o.c.c.length;){for(u=BB(n0(o),10),s=new Np,a=0,i=new oz(ZL(fbn(u).a.Kc(),new h));dAn(i);)b5(e=BB(U5(i),17))||!b5(e)&&e.c.i.c==e.d.i.c||((r=BB(mMn(e,(HXn(),bpt)),19).a)>a&&(a=r,s.c=x8(Ant,HWn,1,0,5,1)),r==a&&WB(s,new rI(e.c.i,e)));SQ(),m$(s,n.c),kG(n.b,u.p,s)}}function q_n(n,t){var e,i,r,c,a,u,o,s;for(c=new Wb(t.b);c.a<c.c.c.length;)for(o=new Wb(BB(n0(c),29).a);o.a<o.c.c.length;){for(u=BB(n0(o),10),s=new Np,a=0,i=new oz(ZL(lbn(u).a.Kc(),new h));dAn(i);)b5(e=BB(U5(i),17))||!b5(e)&&e.c.i.c==e.d.i.c||((r=BB(mMn(e,(HXn(),bpt)),19).a)>a&&(a=r,s.c=x8(Ant,HWn,1,0,5,1)),r==a&&WB(s,new rI(e.d.i,e)));SQ(),m$(s,n.c),kG(n.f,u.p,s)}}function G_n(n){NM(n,new MTn(vj(wj(pj(gj(new du,l5n),"ELK Box"),"Algorithm for packing of unconnected boxes, i.e. graphs without edges."),new xu))),u2(n,l5n,QJn,zMt),u2(n,l5n,vZn,15),u2(n,l5n,pZn,iln(0)),u2(n,l5n,A4n,mpn(_Mt)),u2(n,l5n,PZn,mpn(BMt)),u2(n,l5n,SZn,mpn(qMt)),u2(n,l5n,VJn,f5n),u2(n,l5n,jZn,mpn(FMt)),u2(n,l5n,BZn,mpn(HMt)),u2(n,l5n,b5n,mpn(RMt)),u2(n,l5n,u3n,mpn(KMt))}function z_n(n,t){var e,i,r,c,a,u,o,s,h;if(a=(r=n.i).o.a,c=r.o.b,a<=0&&c<=0)return kUn(),PIt;switch(s=n.n.a,h=n.n.b,u=n.o.a,e=n.o.b,t.g){case 2:case 1:if(s<0)return kUn(),CIt;if(s+u>a)return kUn(),oIt;break;case 4:case 3:if(h<0)return kUn(),sIt;if(h+e>c)return kUn(),SIt}return(o=(s+u/2)/a)+(i=(h+e/2)/c)<=1&&o-i<=0?(kUn(),CIt):o+i>=1&&o-i>=0?(kUn(),oIt):i<.5?(kUn(),sIt):(kUn(),SIt)}function U_n(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;for(e=!1,o=Gy(MD(mMn(t,(HXn(),Opt)))),l=KVn*o,r=new Wb(t.b);r.a<r.c.c.length;)for(i=BB(n0(r),29),c=BB(n0(u=new Wb(i.a)),10),s=wU(n.a[c.p]);u.a<u.c.c.length;)a=BB(n0(u),10),s!=(h=wU(n.a[a.p]))&&(f=K$(n.b,c,a),c.n.b+c.o.b+c.d.a+s.a+f>a.n.b-a.d.d+h.a+l&&(b=s.g+h.g,h.a=(h.g*h.a+s.g*s.a)/b,h.g=b,s.f=h,e=!0)),c=a,s=h;return e}function X_n(n,t,e,i,r,c,a){var u,o,s,h,f;for(f=new bA,o=t.Kc();o.Ob();)for(h=new Wb(BB(o.Pb(),839).wf());h.a<h.c.c.length;)GI((s=BB(n0(h),181)).We((sWn(),gSt)))===GI((Rtn(),XPt))&&(rKn(f,s,!1,i,r,c,a),CPn(n,f));for(u=e.Kc();u.Ob();)for(h=new Wb(BB(u.Pb(),839).wf());h.a<h.c.c.length;)GI((s=BB(n0(h),181)).We((sWn(),gSt)))===GI((Rtn(),UPt))&&(rKn(f,s,!0,i,r,c,a),CPn(n,f))}function W_n(n,t,e){var i,r,c,a,u,o,s;for(a=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));a.e!=a.i.gc();)for(r=new oz(ZL(dLn(c=BB(kpn(a),33)).a.Kc(),new h));dAn(r);)nAn(i=BB(U5(r),79))||nAn(i)||QIn(i)||(o=BB(qI(AY(e.f,c)),86),s=BB(RX(e,PTn(BB(Wtn((!i.c&&(i.c=new hK(KOt,i,5,8)),i.c),0),82))),86),o&&s&&(hon(u=new UQ(o,s),(qqn(),skt),i),qan(u,i),DH(o.d,u),DH(s.b,u),DH(t.a,u)))}function V_n(n,t){var i,r,c,a,u,o,s;for(o=BB(BB(h6(n.r,t),21),84).Kc();o.Ob();)(r=(u=BB(o.Pb(),111)).c?WH(u.c):0)>0?u.a?r>(s=u.b.rf().b)&&(n.v||1==u.c.d.c.length?(a=(r-s)/2,u.d.d=a,u.d.a=a):(i=(BB(xq(u.c.d,0),181).rf().b-s)/2,u.d.d=e.Math.max(0,i),u.d.a=r-i-s)):u.d.a=n.t+r:Hz(n.u)&&((c=_Tn(u.b)).d<0&&(u.d.d=-c.d),c.d+c.a>u.b.rf().b&&(u.d.a=c.d+c.a-u.b.rf().b))}function Q_n(n,t){var e;switch(vnn(n)){case 6:return XI(t);case 7:return UI(t);case 8:return zI(t);case 3:return Array.isArray(t)&&!((e=vnn(t))>=14&&e<=16);case 11:return null!=t&&typeof t===xWn;case 12:return null!=t&&(typeof t===AWn||typeof t==xWn);case 0:return Qpn(t,n.__elementTypeId$);case 2:return DU(t)&&!(t.im===I);case 1:return DU(t)&&!(t.im===I)||Qpn(t,n.__elementTypeId$);default:return!0}}function Y_n(n,t){var i,r,c,a;return r=e.Math.min(e.Math.abs(n.c-(t.c+t.b)),e.Math.abs(n.c+n.b-t.c)),a=e.Math.min(e.Math.abs(n.d-(t.d+t.a)),e.Math.abs(n.d+n.a-t.d)),(i=e.Math.abs(n.c+n.b/2-(t.c+t.b/2)))>n.b/2+t.b/2||(c=e.Math.abs(n.d+n.a/2-(t.d+t.a/2)))>n.a/2+t.a/2?1:0==i&&0==c?0:0==i?a/c+1:0==c?r/i+1:e.Math.min(r/i,a/c)+1}function J_n(n,t){var i,r,c,a,u,o;return(c=iin(n))==(o=iin(t))?n.e==t.e&&n.a<54&&t.a<54?n.f<t.f?-1:n.f>t.f?1:0:(r=n.e-t.e,(i=(n.d>0?n.d:e.Math.floor((n.a-1)*zQn)+1)-(t.d>0?t.d:e.Math.floor((t.a-1)*zQn)+1))>r+1?c:i<r-1?-c:(!n.c&&(n.c=yhn(n.f)),a=n.c,!t.c&&(t.c=yhn(t.f)),u=t.c,r<0?a=Nnn(a,kBn(-r)):r>0&&(u=Nnn(u,kBn(r))),tgn(a,u))):c<o?-1:1}function Z_n(n,t){var e,i,r,c,a,u,o;for(c=0,u=0,o=0,r=new Wb(n.f.e);r.a<r.c.c.length;)t!=(i=BB(n0(r),144))&&(c+=a=n.i[t.b][i.b],(e=W8(t.d,i.d))>0&&n.d!=(q7(),Aat)&&(u+=a*(i.d.a+n.a[t.b][i.b]*(t.d.a-i.d.a)/e)),e>0&&n.d!=(q7(),Iat)&&(o+=a*(i.d.b+n.a[t.b][i.b]*(t.d.b-i.d.b)/e)));switch(n.d.g){case 1:return new xC(u/c,t.d.b);case 2:return new xC(t.d.a,o/c);default:return new xC(u/c,o/c)}}function nFn(n,t){var e,i,r,c;if(zsn(),c=BB(mMn(n.i,(HXn(),ept)),98),0!=n.j.g-t.j.g||c!=(QEn(),UCt)&&c!=WCt&&c!=XCt)return 0;if(c==(QEn(),UCt)&&(e=BB(mMn(n,ipt),19),i=BB(mMn(t,ipt),19),e&&i&&0!=(r=e.a-i.a)))return r;switch(n.j.g){case 1:return Pln(n.n.a,t.n.a);case 2:return Pln(n.n.b,t.n.b);case 3:return Pln(t.n.a,n.n.a);case 4:return Pln(t.n.b,n.n.b);default:throw Hp(new Fy(r1n))}}function tFn(n){var t,e,i,r,c;for(WB(c=new J6((!n.a&&(n.a=new $L(xOt,n,5)),n.a).i+2),new xC(n.j,n.k)),JT(new Rq(null,(!n.a&&(n.a=new $L(xOt,n,5)),new w1(n.a,16))),new Ig(c)),WB(c,new xC(n.b,n.c)),t=1;t<c.c.length-1;)l1(t-1,c.c.length),e=BB(c.c[t-1],8),l1(t,c.c.length),i=BB(c.c[t],8),l1(t+1,c.c.length),r=BB(c.c[t+1],8),e.a==i.a&&i.a==r.a||e.b==i.b&&i.b==r.b?s6(c,t):++t;return c}function eFn(n,t){var e,i,r,c,a,u,o;for(e=ON(iM(tM(eM(new Wv,t),new gY(t.e)),gst),n.a),0==t.j.c.length||V9(BB(xq(t.j,0),57).a,e),o=new Dp,VW(n.e,e,o),a=new Rv,u=new Rv,c=new Wb(t.k);c.a<c.c.c.length;)TU(a,(r=BB(n0(c),17)).c),TU(u,r.d);(i=a.a.gc()-u.a.gc())<0?(Uun(o,!0,(Ffn(),_Pt)),Uun(o,!1,FPt)):i>0&&(Uun(o,!1,(Ffn(),_Pt)),Uun(o,!0,FPt)),Otn(t.g,new sP(n,e)),VW(n.g,t,e)}function iFn(){var n;for(iFn=O,Ltt=Pun(Gk(ANt,1),hQn,25,15,[-1,-1,30,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5]),Ntt=x8(ANt,hQn,25,37,15,1),xtt=Pun(Gk(ANt,1),hQn,25,15,[-1,-1,63,40,32,28,25,23,21,20,19,19,18,18,17,17,16,16,16,15,15,15,15,14,14,14,14,14,14,13,13,13,13,13,13,13,13]),Dtt=x8(LNt,FQn,25,37,14,1),n=2;n<=36;n++)Ntt[n]=CJ(e.Math.pow(n,Ltt[n])),Dtt[n]=Ojn(bVn,Ntt[n])}function rFn(n){var t;if(1!=(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)throw Hp(new _y(B5n+(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i));return t=new km,bun(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82))&&Frn(t,zXn(n,bun(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)),!1)),bun(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))&&Frn(t,zXn(n,bun(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82)),!0)),t}function cFn(n,t){var e,i,r;for(r=!1,i=new oz(ZL((t.d?n.a.c==(gJ(),tyt)?fbn(t.b):lbn(t.b):n.a.c==(gJ(),nyt)?fbn(t.b):lbn(t.b)).a.Kc(),new h));dAn(i);)if(e=BB(U5(i),17),(qy(n.a.f[n.a.g[t.b.p].p])||b5(e)||e.c.i.c!=e.d.i.c)&&!qy(n.a.n[n.a.g[t.b.p].p])&&!qy(n.a.n[n.a.g[t.b.p].p])&&(r=!0,FT(n.b,n.a.g[Lmn(e,t.b).p])))return t.c=!0,t.a=e,t;return t.c=r,t.a=null,t}function aFn(n,t,e,i,r){var c,a,u,o,s,h,f;for(SQ(),m$(n,new Xu),u=new M2(n,0),f=new Np,c=0;u.b<u.d.gc();)Px(u.b<u.d.gc()),a=BB(u.d.Xb(u.c=u.b++),157),0!=f.c.length&&iG(a)*eG(a)>2*c?(h=new Gtn(f),s=iG(a)/eG(a),o=yXn(h,t,new bm,e,i,r,s),UR(kO(h.e),o),f.c=x8(Ant,HWn,1,0,5,1),c=0,f.c[f.c.length]=h,f.c[f.c.length]=a,c=iG(h)*eG(h)+iG(a)*eG(a)):(f.c[f.c.length]=a,c+=iG(a)*eG(a));return f}function uFn(n,t,e){var i,r,c,a,u,o,s;if(0==(i=e.gc()))return!1;if(n.ej())if(o=n.fj(),kwn(n,t,e),a=1==i?n.Zi(3,null,e.Kc().Pb(),t,o):n.Zi(5,null,e,t,o),n.bj()){for(u=i<100?null:new Fj(i),c=t+i,r=t;r<c;++r)s=n.Oi(r),u=n.cj(s,u);u?(u.Ei(a),u.Fi()):n.$i(a)}else n.$i(a);else if(kwn(n,t,e),n.bj()){for(u=i<100?null:new Fj(i),c=t+i,r=t;r<c;++r)u=n.cj(n.Oi(r),u);u&&u.Fi()}return!0}function oFn(n,t,e){var i,r,c,a;return n.ej()?(r=null,c=n.fj(),i=n.Zi(1,a=n.Ui(t,n.oi(t,e)),e,t,c),n.bj()&&!(n.ni()&&a?Nfn(a,e):GI(a)===GI(e))?(a&&(r=n.dj(a,r)),(r=n.cj(e,r))?(r.Ei(i),r.Fi()):n.$i(i)):r?(r.Ei(i),r.Fi()):n.$i(i),a):(a=n.Ui(t,n.oi(t,e)),n.bj()&&!(n.ni()&&a?Nfn(a,e):GI(a)===GI(e))&&(r=null,a&&(r=n.dj(a,null)),(r=n.cj(e,r))&&r.Fi()),a)}function sFn(n,t){var i,r,c,a,u,o,s,h;if(n.e=t,n.f=BB(mMn(t,(Mrn(),hat)),230),XTn(t),n.d=e.Math.max(16*t.e.c.length+t.c.c.length,256),!qy(TD(mMn(t,(fRn(),Hct)))))for(h=n.e.e.c.length,o=new Wb(t.e);o.a<o.c.c.length;)(s=BB(n0(o),144).d).a=OG(n.f)*h,s.b=OG(n.f)*h;for(i=t.b,a=new Wb(t.c);a.a<a.c.c.length;)if(c=BB(n0(a),282),(r=BB(mMn(c,eat),19).a)>0){for(u=0;u<r;u++)WB(i,new hX(c));BCn(c)}}function hFn(n,t){var i,r,c,a,u;if(n.k==(uSn(),Sut)&&(i=jE(AV(BB(mMn(n,(hWn(),Plt)),15).Oc(),new aw(new ri))).sd((dM(),tit))?t:(Xyn(),TCt),hon(n,ult,i),i!=(Xyn(),ECt)))for(r=BB(mMn(n,dlt),17),u=Gy(MD(mMn(r,(HXn(),agt)))),a=0,i==jCt?a=n.o.b-e.Math.ceil(u/2):i==TCt&&(n.o.b-=Gy(MD(mMn(vW(n),jpt))),a=(n.o.b-e.Math.ceil(u))/2),c=new Wb(n.j);c.a<c.c.c.length;)BB(n0(c),11).n.b=a}function fFn(){fFn=O,JM(),TNt=new Rh,Pun(Gk(A$t,2),sVn,368,0,[Pun(Gk(A$t,1),jnt,592,0,[new UE(z7n)])]),Pun(Gk(A$t,2),sVn,368,0,[Pun(Gk(A$t,1),jnt,592,0,[new UE(U7n)])]),Pun(Gk(A$t,2),sVn,368,0,[Pun(Gk(A$t,1),jnt,592,0,[new UE(X7n)]),Pun(Gk(A$t,1),jnt,592,0,[new UE(U7n)])]),new $A("-1"),Pun(Gk(A$t,2),sVn,368,0,[Pun(Gk(A$t,1),jnt,592,0,[new UE("\\c+")])]),new $A("0"),new $A("0"),new $A("1"),new $A("0"),new $A(int)}function lFn(n){var t,e;return n.c&&n.c.kh()&&(e=BB(n.c,49),n.c=BB(tfn(n,e),138),n.c!=e&&(0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,9,2,e,n.c)),cL(n.Cb,399)?n.Db>>16==-15&&n.Cb.nh()&&$7(new k9(n.Cb,9,13,e,n.c,uvn(H7(BB(n.Cb,59)),n))):cL(n.Cb,88)&&n.Db>>16==-23&&n.Cb.nh()&&(cL(t=n.c,88)||(gWn(),t=d$t),cL(e,88)||(gWn(),e=d$t),$7(new k9(n.Cb,9,10,e,t,uvn(a4(BB(n.Cb,26)),n)))))),n.c}function bFn(n,t){var e,i,r,c,a,u,o,s;for(OTn(t,"Hypernodes processing",1),i=new Wb(n.b);i.a<i.c.c.length;)for(a=new Wb(BB(n0(i),29).a);a.a<a.c.c.length;)if(qy(TD(mMn(c=BB(n0(a),10),(HXn(),bgt))))&&c.j.c.length<=2){for(s=0,o=0,e=0,r=0,u=new Wb(c.j);u.a<u.c.c.length;)switch(BB(n0(u),11).j.g){case 1:++s;break;case 2:++o;break;case 3:++e;break;case 4:++r}0==s&&0==e&&jXn(n,c,r<=o)}HSn(t)}function wFn(n,t){var e,i,r,c,a,u,o,s,h;for(OTn(t,"Layer constraint edge reversal",1),a=new Wb(n.b);a.a<a.c.c.length;){for(c=BB(n0(a),29),h=-1,e=new Np,s=n2(c.a),r=0;r<s.length;r++)i=BB(mMn(s[r],(hWn(),ilt)),303),-1==h?i!=(z7(),Cft)&&(h=r):i==(z7(),Cft)&&(PZ(s[r],null),Qyn(s[r],h++,c)),i==(z7(),Sft)&&WB(e,s[r]);for(o=new Wb(e);o.a<o.c.c.length;)PZ(u=BB(n0(o),10),null),PZ(u,c)}HSn(t)}function dFn(n,t,e){var i,r,c,a,u,o,s,h;for(OTn(e,"Hyperedge merging",1),xAn(n,t),u=new M2(t.b,0);u.b<u.d.gc();)if(Px(u.b<u.d.gc()),0!=(s=BB(u.d.Xb(u.c=u.b++),29).a).c.length)for(i=null,r=null,c=null,a=null,o=0;o<s.c.length;o++)l1(o,s.c.length),(r=(i=BB(s.c[o],10)).k)==(uSn(),Put)&&a==Put&&(h=hHn(i,c)).a&&(rDn(i,c,h.b,h.c),l1(o,s.c.length),PE(s.c,o,1),--o,i=c,r=a),c=i,a=r;HSn(e)}function gFn(n,t){var e,i,r;i=0!=H$n(n.d,1),!qy(TD(mMn(t.j,(hWn(),Jft))))&&!qy(TD(mMn(t.j,Ilt)))||GI(mMn(t.j,(HXn(),Ldt)))===GI((mon(),Nvt))?t.c.Tf(t.e,i):i=qy(TD(mMn(t.j,Jft))),DNn(n,t,i,!0),qy(TD(mMn(t.j,Ilt)))&&hon(t.j,Ilt,(hN(),!1)),qy(TD(mMn(t.j,Jft)))&&(hon(t.j,Jft,(hN(),!1)),hon(t.j,Ilt,!0)),e=eKn(n,t);do{if($rn(n),0==e)return 0;r=e,DNn(n,t,i=!i,!1),e=eKn(n,t)}while(r>e);return r}function pFn(n,t){var e,i,r;i=0!=H$n(n.d,1),!qy(TD(mMn(t.j,(hWn(),Jft))))&&!qy(TD(mMn(t.j,Ilt)))||GI(mMn(t.j,(HXn(),Ldt)))===GI((mon(),Nvt))?t.c.Tf(t.e,i):i=qy(TD(mMn(t.j,Jft))),DNn(n,t,i,!0),qy(TD(mMn(t.j,Ilt)))&&hon(t.j,Ilt,(hN(),!1)),qy(TD(mMn(t.j,Jft)))&&(hon(t.j,Jft,(hN(),!1)),hon(t.j,Ilt,!0)),e=nCn(n,t);do{if($rn(n),0==e)return 0;r=e,DNn(n,t,i=!i,!1),e=nCn(n,t)}while(r>e);return r}function vFn(n,t,e){var i,r,c,a,u,o,s;if(t==e)return!0;if(t=bAn(n,t),e=bAn(n,e),i=qvn(t)){if((o=qvn(e))!=i)return!!o&&(a=i.Dj())==o.Dj()&&null!=a;if(!t.d&&(t.d=new $L(VAt,t,1)),r=(c=t.d).i,!e.d&&(e.d=new $L(VAt,e,1)),r==(s=e.d).i)for(u=0;u<r;++u)if(!vFn(n,BB(Wtn(c,u),87),BB(Wtn(s,u),87)))return!1;return!0}return t.e==e.e}function mFn(n,t,e,i){var r,c,a,u,o,s,h,f;if($xn(n.e,t)){for(f=axn(n.e.Tg(),t),c=BB(n.g,119),h=null,o=-1,u=-1,r=0,s=0;s<n.i;++s)a=c[s],f.rl(a.ak())&&(r==e&&(o=s),r==i&&(u=s,h=a.dd()),++r);if(-1==o)throw Hp(new Ay(u8n+e+o8n+r));if(-1==u)throw Hp(new Ay(s8n+i+o8n+r));return Iln(n,o,u),mA(n.e)&&Lv(n,LY(n,7,t,iln(i),h,e,!0)),h}throw Hp(new _y("The feature must be many-valued to support move"))}function yFn(n,t,e,i){var r,c,a,u,o;switch((o=new wA(t.n)).a+=t.o.a/2,o.b+=t.o.b/2,u=Gy(MD(mMn(t,(HXn(),tpt)))),c=n.f,a=n.d,r=n.c,BB(mMn(t,(hWn(),Qft)),61).g){case 1:o.a+=a.b+r.a-e/2,o.b=-i-u,t.n.b=-(a.d+u+r.b);break;case 2:o.a=c.a+a.b+a.c+u,o.b+=a.d+r.b-i/2,t.n.a=c.a+a.c+u-r.a;break;case 3:o.a+=a.b+r.a-e/2,o.b=c.b+a.d+a.a+u,t.n.b=c.b+a.a+u-r.b;break;case 4:o.a=-e-u,o.b+=a.d+r.b-i/2,t.n.a=-(a.b+u+r.a)}return o}function kFn(n){var t,e,i,r,c,a;return qan(i=new min,n),GI(mMn(i,(HXn(),Udt)))===GI((Ffn(),BPt))&&hon(i,Udt,Wln(i)),null==mMn(i,(C6(),TMt))&&(a=BB($Mn(n),160),hon(i,TMt,iO(a.We(TMt)))),hon(i,(hWn(),dlt),n),hon(i,Zft,new YK(t=BB(Vj(Tft),9),BB(SR(t,t.length),9),0)),r=Pzn((JJ(n)&&(GM(),new Dy(JJ(n))),GM(),new JN(JJ(n)?new Dy(JJ(n)):null,n)),FPt),c=BB(mMn(i,zgt),116),eZ(e=i.d,c),eZ(e,r),i}function jFn(n,t,e){var i,r;i=t.c.i,r=e.d.i,i.k==(uSn(),Put)?(hon(n,(hWn(),hlt),BB(mMn(i,hlt),11)),hon(n,flt,BB(mMn(i,flt),11)),hon(n,slt,TD(mMn(i,slt)))):i.k==Sut?(hon(n,(hWn(),hlt),BB(mMn(i,hlt),11)),hon(n,flt,BB(mMn(i,flt),11)),hon(n,slt,(hN(),!0))):r.k==Sut?(hon(n,(hWn(),hlt),BB(mMn(r,hlt),11)),hon(n,flt,BB(mMn(r,flt),11)),hon(n,slt,(hN(),!0))):(hon(n,(hWn(),hlt),t.c),hon(n,flt,e.d))}function EFn(n){var t,e,i,r,c,a,u;for(n.o=new Lp,i=new YT,a=new Wb(n.e.a);a.a<a.c.c.length;)1==kbn(c=BB(n0(a),121)).c.length&&r5(i,c,i.c.b,i.c);for(;0!=i.b;)0!=kbn(c=BB(0==i.b?null:(Px(0!=i.b),Atn(i,i.a.a)),121)).c.length&&(t=BB(xq(kbn(c),0),213),e=c.g.a.c.length>0,u=Nbn(t,c),KN(e?u.b:u.g,t),1==kbn(u).c.length&&r5(i,u,i.c.b,i.c),r=new rI(c,t),d3(n.o,r),y7(n.e.a,c))}function TFn(n,t){var i,r,c,a;return r=e.Math.abs(qz(n.b).a-qz(t.b).a),a=e.Math.abs(qz(n.b).b-qz(t.b).b),i=1,c=1,r>n.b.b/2+t.b.b/2&&(i=1-e.Math.min(e.Math.abs(n.b.c-(t.b.c+t.b.b)),e.Math.abs(n.b.c+n.b.b-t.b.c))/r),a>n.b.a/2+t.b.a/2&&(c=1-e.Math.min(e.Math.abs(n.b.d-(t.b.d+t.b.a)),e.Math.abs(n.b.d+n.b.a-t.b.d))/a),(1-e.Math.min(i,c))*e.Math.sqrt(r*r+a*a)}function MFn(n){var t,e,i;for(nUn(n,n.e,n.f,(dJ(),Lyt),!0,n.c,n.i),nUn(n,n.e,n.f,Lyt,!1,n.c,n.i),nUn(n,n.e,n.f,Nyt,!0,n.c,n.i),nUn(n,n.e,n.f,Nyt,!1,n.c,n.i),IFn(n,n.c,n.e,n.f,n.i),e=new M2(n.i,0);e.b<e.d.gc();)for(Px(e.b<e.d.gc()),t=BB(e.d.Xb(e.c=e.b++),128),i=new M2(n.i,e.b);i.b<i.d.gc();)Px(i.b<i.d.gc()),Nqn(t,BB(i.d.Xb(i.c=i.b++),128));IXn(n.i,BB(mMn(n.d,(hWn(),Slt)),230)),GGn(n.i)}function SFn(n,t){var e,i;if(null!=t)if(i=iyn(n)){if(0==(1&i.i))return nS(),!(e=BB(RX(mAt,i),55))||e.wj(t);if(i==$Nt)return zI(t);if(i==ANt)return cL(t,19);if(i==DNt)return cL(t,155);if(i==NNt)return cL(t,217);if(i==ONt)return cL(t,172);if(i==xNt)return UI(t);if(i==RNt)return cL(t,184);if(i==LNt)return cL(t,162)}else if(cL(t,56))return n.uk(BB(t,56));return!1}function PFn(){var n,t,e,i,r,c,a,u,o;for(PFn=O,WLt=x8(NNt,v6n,25,255,15,1),VLt=x8(ONt,WVn,25,64,15,1),t=0;t<255;t++)WLt[t]=-1;for(e=90;e>=65;e--)WLt[e]=e-65<<24>>24;for(i=122;i>=97;i--)WLt[i]=i-97+26<<24>>24;for(r=57;r>=48;r--)WLt[r]=r-48+52<<24>>24;for(WLt[43]=62,WLt[47]=63,c=0;c<=25;c++)VLt[c]=65+c&QVn;for(a=26,o=0;a<=51;++a,o++)VLt[a]=97+o&QVn;for(n=52,u=0;n<=61;++n,u++)VLt[n]=48+u&QVn;VLt[62]=43,VLt[63]=47}function CFn(n,t){var i,r,c,a,u,o,s,h,f,l,b;if(n.dc())return new Gj;for(s=0,f=0,r=n.Kc();r.Ob();)c=BB(r.Pb(),37).f,s=e.Math.max(s,c.a),f+=c.a*c.b;for(s=e.Math.max(s,e.Math.sqrt(f)*Gy(MD(mMn(BB(n.Kc().Pb(),37),(HXn(),Edt))))),l=0,b=0,o=0,i=t,u=n.Kc();u.Ob();)l+(h=(a=BB(u.Pb(),37)).f).a>s&&(l=0,b+=o+t,o=0),ZRn(a,l,b),i=e.Math.max(i,l+h.a),o=e.Math.max(o,h.b),l+=h.a+t;return new xC(i+t,b+o+t)}function IFn(n,t,e,i,r){var c,a,u,o,s,h,f;for(a=new Wb(t);a.a<a.c.c.length;){if(o=(c=BB(n0(a),17)).c,e.a._b(o))dJ(),s=Lyt;else{if(!i.a._b(o))throw Hp(new _y("Source port must be in one of the port sets."));dJ(),s=Nyt}if(h=c.d,e.a._b(h))dJ(),f=Lyt;else{if(!i.a._b(h))throw Hp(new _y("Target port must be in one of the port sets."));dJ(),f=Nyt}u=new tCn(c,s,f),VW(n.b,c,u),r.c[r.c.length]=u}}function OFn(n,t){var e,i,r,c,a,u,o;if(!WJ(n))throw Hp(new Fy(F5n));if(c=(i=WJ(n)).g,r=i.f,c<=0&&r<=0)return kUn(),PIt;switch(u=n.i,o=n.j,t.g){case 2:case 1:if(u<0)return kUn(),CIt;if(u+n.g>c)return kUn(),oIt;break;case 4:case 3:if(o<0)return kUn(),sIt;if(o+n.f>r)return kUn(),SIt}return(a=(u+n.g/2)/c)+(e=(o+n.f/2)/r)<=1&&a-e<=0?(kUn(),CIt):a+e>=1&&a-e>=0?(kUn(),oIt):e<.5?(kUn(),sIt):(kUn(),SIt)}function AFn(n,t,e,i,r){var c,a;if(c=rbn(e0(t[0],UQn),e0(i[0],UQn)),n[0]=dG(c),c=kz(c,32),e>=r){for(a=1;a<r;a++)c=rbn(c,rbn(e0(t[a],UQn),e0(i[a],UQn))),n[a]=dG(c),c=kz(c,32);for(;a<e;a++)c=rbn(c,e0(t[a],UQn)),n[a]=dG(c),c=kz(c,32)}else{for(a=1;a<e;a++)c=rbn(c,rbn(e0(t[a],UQn),e0(i[a],UQn))),n[a]=dG(c),c=kz(c,32);for(;a<r;a++)c=rbn(c,e0(i[a],UQn)),n[a]=dG(c),c=kz(c,32)}0!=Vhn(c,0)&&(n[a]=dG(c))}function $Fn(n){var t,e,i,r,c,a;if(wWn(),4!=n.e&&5!=n.e)throw Hp(new _y("Token#complementRanges(): must be RANGE: "+n.e));for(T$n(c=n),qHn(c),i=c.b.length+2,0==c.b[0]&&(i-=2),(e=c.b[c.b.length-1])==unt&&(i-=2),(r=new M0(4)).b=x8(ANt,hQn,25,i,15,1),a=0,c.b[0]>0&&(r.b[a++]=0,r.b[a++]=c.b[0]-1),t=1;t<c.b.length-2;t+=2)r.b[a++]=c.b[t]+1,r.b[a++]=c.b[t+1]-1;return e!=unt&&(r.b[a++]=e+1,r.b[a]=unt),r.a=!0,r}function LFn(n,t,e){var i,r,c,a,u,o,s,h;if(0==(i=e.gc()))return!1;if(n.ej())if(s=n.fj(),BTn(n,t,e),a=1==i?n.Zi(3,null,e.Kc().Pb(),t,s):n.Zi(5,null,e,t,s),n.bj()){for(u=i<100?null:new Fj(i),c=t+i,r=t;r<c;++r)h=n.g[r],u=n.cj(h,u),u=n.jj(h,u);u?(u.Ei(a),u.Fi()):n.$i(a)}else n.$i(a);else if(BTn(n,t,e),n.bj()){for(u=i<100?null:new Fj(i),c=t+i,r=t;r<c;++r)o=n.g[r],u=n.cj(o,u);u&&u.Fi()}return!0}function NFn(n,t,e,i){var r,c,a,u,o;for(a=new Wb(n.k);a.a<a.c.c.length;)r=BB(n0(a),129),i&&r.c!=(O6(),Tyt)||(o=r.b).g<0&&r.d>0&&(Vl(o,o.d-r.d),r.c==(O6(),Tyt)&&Xl(o,o.a-r.d),o.d<=0&&o.i>0&&r5(t,o,t.c.b,t.c));for(c=new Wb(n.f);c.a<c.c.c.length;)r=BB(n0(c),129),i&&r.c!=(O6(),Tyt)||(u=r.a).g<0&&r.d>0&&(Ql(u,u.i-r.d),r.c==(O6(),Tyt)&&Wl(u,u.b-r.d),u.i<=0&&u.d>0&&r5(e,u,e.c.b,e.c))}function xFn(n,t,e){var i,r,c,a,u,o,s,h;for(OTn(e,"Processor compute fanout",1),$U(n.b),$U(n.a),u=null,c=spn(t.b,0);!u&&c.b!=c.d.c;)qy(TD(mMn(s=BB(b3(c),86),(qqn(),dkt))))&&(u=s);for(r5(o=new YT,u,o.c.b,o.c),jUn(n,o),h=spn(t.b,0);h.b!=h.d.c;)a=SD(mMn(s=BB(b3(h),86),(qqn(),rkt))),r=null!=SJ(n.b,a)?BB(SJ(n.b,a),19).a:0,hon(s,ikt,iln(r)),i=1+(null!=SJ(n.a,a)?BB(SJ(n.a,a),19).a:0),hon(s,tkt,iln(i));HSn(e)}function DFn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;for(f=yEn(n,e),u=0;u<t;u++){for(yR(r,e),l=new Np,Px(i.b<i.d.gc()),b=BB(i.d.Xb(i.c=i.b++),407),s=f+u;s<n.b;s++)a=b,Px(i.b<i.d.gc()),WB(l,new Exn(a,b=BB(i.d.Xb(i.c=i.b++),407),e));for(h=f+u;h<n.b;h++)Px(i.b>0),i.a.Xb(i.c=--i.b),h>f+u&&fW(i);for(c=new Wb(l);c.a<c.c.c.length;)yR(i,BB(n0(c),407));if(u<t-1)for(o=f+u;o<n.b;o++)Px(i.b>0),i.a.Xb(i.c=--i.b)}}function RFn(){var n,t,e,i,r,c;if(wWn(),CNt)return CNt;for(sHn(n=new M0(4),ZUn(pnt,!0)),WGn(n,ZUn("M",!0)),WGn(n,ZUn("C",!0)),c=new M0(4),i=0;i<11;i++)Yxn(c,i,i);return sHn(t=new M0(4),ZUn("M",!0)),Yxn(t,4448,4607),Yxn(t,65438,65439),tqn(r=new r$(2),n),tqn(r,sNt),(e=new r$(2)).$l(gG(c,ZUn("L",!0))),e.$l(t),e=new h4(3,e),e=new UU(r,e),CNt=e}function KFn(n){var t,e;if(!Ycn(t=SD(ZAn(n,(sWn(),eSt))),n)&&!P8(n,mPt)&&(0!=(!n.a&&(n.a=new eU(UOt,n,10,11)),n.a).i||qy(TD(ZAn(n,SSt))))){if(null!=t&&0!=RMn(t).length)throw gzn(n,e=oO(oO(new lN("Layout algorithm '"),t),"' not found for ")),Hp(new rk(e.a));if(!Ycn(w1n,n))throw gzn(n,e=oO(oO(new lN("Unable to load default layout algorithm "),w1n)," for unconfigured node ")),Hp(new rk(e.a))}}function _Fn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w;if(i=n.i,t=n.n,0==n.b)for(w=i.c+t.b,b=i.b-t.b-t.c,s=0,f=(u=n.a).length;s<f;++s)UG(c=u[s],w,b);else r=Wvn(n,!1),UG(n.a[0],i.c+t.b,r[0]),UG(n.a[2],i.c+i.b-t.c-r[2],r[2]),l=i.b-t.b-t.c,r[0]>0&&(l-=r[0]+n.c,r[0]+=n.c),r[2]>0&&(l-=r[2]+n.c),r[1]=e.Math.max(r[1],l),UG(n.a[1],i.c+t.b+r[0]-(r[1]-l)/2,r[1]);for(o=0,h=(a=n.a).length;o<h;++o)cL(c=a[o],326)&&BB(c,326).Te()}function FFn(n){var t,e,i,r,c,a,u,o,s,h,f;for((f=new aa).d=0,a=new Wb(n.b);a.a<a.c.c.length;)c=BB(n0(a),29),f.d+=c.a.c.length;for(i=0,r=0,f.a=x8(ANt,hQn,25,n.b.c.length,15,1),s=0,h=0,f.e=x8(ANt,hQn,25,f.d,15,1),e=new Wb(n.b);e.a<e.c.c.length;)for((t=BB(n0(e),29)).p=i++,f.a[t.p]=r++,h=0,o=new Wb(t.a);o.a<o.c.c.length;)(u=BB(n0(o),10)).p=s++,f.e[u.p]=h++;return f.c=new fg(f),f.b=sx(f.d),H_n(f,n),f.f=sx(f.d),q_n(f,n),f}function BFn(n,t){var i,r,c;for(c=BB(xq(n.n,n.n.c.length-1),211).d,n.p=e.Math.min(n.p,t.g),n.r=e.Math.max(n.r,c),n.g=e.Math.max(n.g,t.g+(1==n.b.c.length?0:n.i)),n.o=e.Math.min(n.o,t.f),n.e+=t.f+(1==n.b.c.length?0:n.i),n.f=e.Math.max(n.f,t.f),r=n.n.c.length>0?(n.n.c.length-1)*n.i:0,i=new Wb(n.n);i.a<i.c.c.length;)r+=BB(n0(i),211).a;n.d=r,n.a=n.e/n.b.c.length-n.i*((n.b.c.length-1)/n.b.c.length),yyn(n.j)}function HFn(n,t){var e,i,r,c,a,u,o,s,h;if(null==(s=TD(mMn(t,(fRn(),iat))))||(kW(s),s)){for(h=x8($Nt,ZYn,25,t.e.c.length,16,1),a=kOn(t),r=new YT,o=new Wb(t.e);o.a<o.c.c.length;)(e=Y$n(n,BB(n0(o),144),null,null,h,a))&&(qan(e,t),r5(r,e,r.c.b,r.c));if(r.b>1)for(i=spn(r,0);i.b!=i.d.c;)for(c=0,u=new Wb((e=BB(b3(i),231)).e);u.a<u.c.c.length;)BB(n0(u),144).b=c++;return r}return u6(Pun(Gk(Kct,1),tZn,231,0,[t]))}function qFn(n){var t,e,i,r,c;if(!n.g){if(c=new To,null==(t=P$t).a.zc(n,t)){for(e=new AL(kY(n));e.e!=e.i.gc();)pX(c,qFn(BB(kpn(e),26)));t.a.Bc(n),t.a.gc()}for(i=c.i,!n.s&&(n.s=new eU(FAt,n,21,17)),r=new AL(n.s);r.e!=r.i.gc();++i)ub(BB(kpn(r),449),i);pX(c,(!n.s&&(n.s=new eU(FAt,n,21,17)),n.s)),chn(c),n.g=new don(n,c),n.i=BB(c.g,247),null==n.i&&(n.i=I$t),n.p=null,P5(n).b&=-5}return n.g}function GFn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w;if(r=n.i,i=n.n,0==n.b)t=Xvn(n,!1),XG(n.a[0],r.d+i.d,t[0]),XG(n.a[2],r.d+r.a-i.a-t[2],t[2]),l=r.a-i.d-i.a,t[0]>0&&(t[0]+=n.c,l-=t[0]),t[2]>0&&(l-=t[2]+n.c),t[1]=e.Math.max(t[1],l),XG(n.a[1],r.d+i.d+t[0]-(t[1]-l)/2,t[1]);else for(w=r.d+i.d,b=r.a-i.d-i.a,s=0,f=(u=n.a).length;s<f;++s)XG(c=u[s],w,b);for(o=0,h=(a=n.a).length;o<h;++o)cL(c=a[o],326)&&BB(c,326).Ue()}function zFn(n){var t,e,i,r,c,a,u,o,s;for(s=x8(ANt,hQn,25,n.b.c.length+1,15,1),o=new Rv,i=0,c=new Wb(n.b);c.a<c.c.c.length;){for(r=BB(n0(c),29),s[i++]=o.a.gc(),u=new Wb(r.a);u.a<u.c.c.length;)for(e=new oz(ZL(lbn(BB(n0(u),10)).a.Kc(),new h));dAn(e);)t=BB(U5(e),17),o.a.zc(t,o);for(a=new Wb(r.a);a.a<a.c.c.length;)for(e=new oz(ZL(fbn(BB(n0(a),10)).a.Kc(),new h));dAn(e);)t=BB(U5(e),17),o.a.Bc(t)}return s}function UFn(n,t,e,i){var r,c,a,u,o;if(o=axn(n.e.Tg(),t),r=BB(n.g,119),ZM(),BB(t,66).Oj()){for(a=0;a<n.i;++a)if(c=r[a],o.rl(c.ak())&&Nfn(c,e))return!0}else if(null!=e){for(u=0;u<n.i;++u)if(c=r[u],o.rl(c.ak())&&Nfn(e,c.dd()))return!0;if(i)for(a=0;a<n.i;++a)if(c=r[a],o.rl(c.ak())&&GI(e)===GI(hD(n,BB(c.dd(),56))))return!0}else for(a=0;a<n.i;++a)if(c=r[a],o.rl(c.ak())&&null==c.dd())return!1;return!1}function XFn(n,t,e,i){var r,c,a,u,o,s;if(s=axn(n.e.Tg(),t),a=BB(n.g,119),$xn(n.e,t)){if(t.hi()&&(c=pBn(n,t,i,cL(t,99)&&0!=(BB(t,18).Bb&BQn)))>=0&&c!=e)throw Hp(new _y(a8n));for(r=0,o=0;o<n.i;++o)if(u=a[o],s.rl(u.ak())){if(r==e)return BB(ovn(n,o,(ZM(),BB(t,66).Oj()?BB(i,72):Z3(t,i))),72);++r}throw Hp(new Ay(e9n+e+o8n+r))}for(o=0;o<n.i;++o)if(u=a[o],s.rl(u.ak()))return ZM(),BB(t,66).Oj()?u:u.dd();return null}function WFn(n,t,i,r){var c,a,u,o;for(o=i,u=new Wb(t.a);u.a<u.c.c.length;){if(a=BB(n0(u),221),c=BB(a.b,65),Ibn(n.b.c,c.b.c+c.b.b)<=0&&Ibn(c.b.c,n.b.c+n.b.b)<=0&&Ibn(n.b.d,c.b.d+c.b.a)<=0&&Ibn(c.b.d,n.b.d+n.b.a)<=0){if(0==Ibn(c.b.c,n.b.c+n.b.b)&&r.a<0||0==Ibn(c.b.c+c.b.b,n.b.c)&&r.a>0||0==Ibn(c.b.d,n.b.d+n.b.a)&&r.b<0||0==Ibn(c.b.d+c.b.a,n.b.d)&&r.b>0){o=0;break}}else o=e.Math.min(o,HCn(n,c,r));o=e.Math.min(o,WFn(n,a,o,r))}return o}function VFn(n,t){var e,i,r,c,a,u;if(n.b<2)throw Hp(new _y("The vector chain must contain at least a source and a target point."));for(Px(0!=n.b),CA(t,(i=BB(n.a.a.c,8)).a,i.b),u=new cx((!t.a&&(t.a=new $L(xOt,t,5)),t.a)),c=spn(n,1);c.a<n.b-1;)a=BB(b3(c),8),u.e!=u.i.gc()?e=BB(kpn(u),469):(tE(),odn(u,e=new ro)),TA(e,a.a,a.b);for(;u.e!=u.i.gc();)kpn(u),Qjn(u);Px(0!=n.b),PA(t,(r=BB(n.c.b.c,8)).a,r.b)}function QFn(n,t){var e,i,r,c,a,u,o,s;for(e=0,i=new Wb((l1(0,n.c.length),BB(n.c[0],101)).g.b.j);i.a<i.c.c.length;)BB(n0(i),11).p=e++;for(t==(kUn(),sIt)?m$(n,new nc):m$(n,new tc),a=0,s=n.c.length-1;a<s;)l1(a,n.c.length),c=BB(n.c[a],101),l1(s,n.c.length),o=BB(n.c[s],101),r=t==sIt?c.c:c.a,u=t==sIt?o.a:o.c,bU(c,t,(Oun(),yst),r),bU(o,t,mst,u),++a,--s;a==s&&bU((l1(a,n.c.length),BB(n.c[a],101)),t,(Oun(),vst),null)}function YFn(n,t,e){var i,r,c,a,u,o,s,h,f,l;return h=n.a.i+n.a.g/2,f=n.a.i+n.a.g/2,a=new xC(t.i+t.g/2,t.j+t.f/2),(o=BB(ZAn(t,(sWn(),gPt)),8)).a=o.a+h,o.b=o.b+f,r=(a.b-o.b)/(a.a-o.a),i=a.b-r*a.a,u=new xC(e.i+e.g/2,e.j+e.f/2),(s=BB(ZAn(e,gPt),8)).a=s.a+h,s.b=s.b+f,c=(u.b-s.b)/(u.a-s.a),l=(i-(u.b-c*u.a))/(c-r),!(o.a<l&&a.a<l||l<o.a&&l<a.a||s.a<l&&u.a<l||l<s.a&&l<u.a)}function JFn(n,t){var e,i,r,c,a,u;if(!(a=BB(RX(n.c,t),183)))throw Hp(new ek("Edge did not exist in input."));return i=Qdn(a),!WE((!t.a&&(t.a=new eU(FOt,t,6,6)),t.a))&&(e=new MB(n,i,u=new Cl),wO((!t.a&&(t.a=new eU(FOt,t,6,6)),t.a),e),rtn(a,x6n,u)),P8(t,(sWn(),OSt))&&!(!(r=BB(ZAn(t,OSt),74))||pW(r))&&(e5(r,new Qg(c=new Cl)),rtn(a,"junctionPoints",c)),AH(a,"container",XJ(t).k),null}function ZFn(n,t,e){var i,r,c,a,u,o;this.a=n,this.b=t,this.c=e,this.e=u6(Pun(Gk(uit,1),HWn,168,0,[new xS(n,t),new xS(t,e),new xS(e,n)])),this.f=u6(Pun(Gk(PMt,1),sVn,8,0,[n,t,e])),this.d=(i=XR(B$(this.b),this.a),r=XR(B$(this.c),this.a),c=XR(B$(this.c),this.b),a=i.a*(this.a.a+this.b.a)+i.b*(this.a.b+this.b.b),u=r.a*(this.a.a+this.c.a)+r.b*(this.a.b+this.c.b),o=2*(i.a*c.b-i.b*c.a),new xC((r.b*a-i.b*u)/o,(i.a*u-r.a*a)/o))}function nBn(n,t,e,i){var r,c,a,u,o,s,h,f,l;if(f=new GX(n.p),rtn(t,t8n,f),e&&!(n.f?rY(n.f):null).a.dc())for(rtn(t,"logs",s=new Cl),u=0,l=new qb((n.f?rY(n.f):null).b.Kc());l.b.Ob();)h=new GX(SD(l.b.Pb())),dnn(s,u),r4(s,u,h),++u;if(i&&rtn(t,"executionTime",new Sl(n.q)),!rY(n.a).a.dc())for(a=new Cl,rtn(t,A6n,a),u=0,c=new qb(rY(n.a).b.Kc());c.b.Ob();)r=BB(c.b.Pb(),1949),o=new py,dnn(a,u),r4(a,u,o),nBn(r,o,e,i),++u}function tBn(n,t){var e,i,r,c,a,u;for(c=n.c,a=n.d,SZ(n,null),MZ(n,null),t&&qy(TD(mMn(a,(hWn(),tlt))))?SZ(n,R_n(a.i,(ain(),qvt),(kUn(),oIt))):SZ(n,a),t&&qy(TD(mMn(c,(hWn(),klt))))?MZ(n,R_n(c.i,(ain(),Hvt),(kUn(),CIt))):MZ(n,c),i=new Wb(n.b);i.a<i.c.c.length;)e=BB(n0(i),70),(r=BB(mMn(e,(HXn(),Ydt)),272))==(Rtn(),XPt)?hon(e,Ydt,UPt):r==UPt&&hon(e,Ydt,XPt);u=qy(TD(mMn(n,(hWn(),Clt)))),hon(n,Clt,(hN(),!u)),n.a=Jon(n.a)}function eBn(n,t,i){var r,c,a,u,o;for(r=0,a=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));a.e!=a.i.gc();)u="",0==(!(c=BB(kpn(a),33)).n&&(c.n=new eU(zOt,c,1,7)),c.n).i||(u=BB(Wtn((!c.n&&(c.n=new eU(zOt,c,1,7)),c.n),0),137).a),qan(o=new qX(u),c),hon(o,(Mrn(),sat),c),o.b=r++,o.d.a=c.i+c.g/2,o.d.b=c.j+c.f/2,o.e.a=e.Math.max(c.g,1),o.e.b=e.Math.max(c.f,1),WB(t.e,o),jCn(i.f,c,o),BB(ZAn(c,(fRn(),Yct)),98),QEn()}function iBn(n,t){var i,r,c,a,u,o,s,h,f,l,b;i=AN(new qv,n.f),o=n.i[t.c.i.p],l=n.i[t.d.i.p],u=t.c,f=t.d,a=u.a.b,h=f.a.b,o.b||(a+=u.n.b),l.b||(h+=f.n.b),s=CJ(e.Math.max(0,a-h)),c=CJ(e.Math.max(0,h-a)),b=e.Math.max(1,BB(mMn(t,(HXn(),bpt)),19).a)*X3(t.c.i.k,t.d.i.k),r=new nC(UNn(aM(cM(rM(uM(new Hv,b),c),i),BB(RX(n.k,t.c),121))),UNn(aM(cM(rM(uM(new Hv,b),s),i),BB(RX(n.k,t.d),121)))),n.c[t.p]=r}function rBn(n,t,e,i){var r,c,a,u,o,s;for(a=new uGn(n,t,e),o=new M2(i,0),r=!1;o.b<o.d.gc();)Px(o.b<o.d.gc()),(u=BB(o.d.Xb(o.c=o.b++),233))==t||u==e?fW(o):!r&&Gy(lL(u.g,u.d[0]).a)>Gy(lL(a.g,a.d[0]).a)?(Px(o.b>0),o.a.Xb(o.c=--o.b),yR(o,a),r=!0):u.e&&u.e.gc()>0&&(c=(!u.e&&(u.e=new Np),u.e).Mc(t),s=(!u.e&&(u.e=new Np),u.e).Mc(e),(c||s)&&((!u.e&&(u.e=new Np),u.e).Fc(a),++a.c));r||(i.c[i.c.length]=a)}function cBn(n){var t,e,i;if(vA(BB(mMn(n,(HXn(),ept)),98)))for(e=new Wb(n.j);e.a<e.c.c.length;)(t=BB(n0(e),11)).j==(kUn(),PIt)&&((i=BB(mMn(t,(hWn(),Elt)),10))?qCn(t,BB(mMn(i,Qft),61)):t.e.c.length-t.g.c.length<0?qCn(t,oIt):qCn(t,CIt));else{for(e=new Wb(n.j);e.a<e.c.c.length;)t=BB(n0(e),11),(i=BB(mMn(t,(hWn(),Elt)),10))?qCn(t,BB(mMn(i,Qft),61)):t.e.c.length-t.g.c.length<0?qCn(t,(kUn(),oIt)):qCn(t,(kUn(),CIt));hon(n,ept,(QEn(),VCt))}}function aBn(n){var t,e;switch(n){case 91:case 93:case 45:case 94:case 44:case 92:e="\\"+String.fromCharCode(n&QVn);break;case 12:e="\\f";break;case 10:e="\\n";break;case 13:e="\\r";break;case 9:e="\\t";break;case 27:e="\\e";break;default:e=n<32?"\\x"+fx(t="0"+(n>>>0).toString(16),t.length-2,t.length):n>=BQn?"\\v"+fx(t="0"+(n>>>0).toString(16),t.length-6,t.length):""+String.fromCharCode(n&QVn)}return e}function uBn(n,t){var e,i,r,c,a,u,o,s,h,f;if(a=n.e,0==(o=t.e))return n;if(0==a)return 0==t.e?t:new lU(-t.e,t.d,t.a);if((c=n.d)+(u=t.d)==2)return e=e0(n.a[0],UQn),i=e0(t.a[0],UQn),a<0&&(e=j7(e)),o<0&&(i=j7(i)),npn(ibn(e,i));if(-1==(r=c!=u?c>u?1:-1:Msn(n.a,t.a,c)))f=-o,h=a==o?d6(t.a,u,n.a,c):N8(t.a,u,n.a,c);else if(f=a,a==o){if(0==r)return ODn(),eet;h=d6(n.a,c,t.a,u)}else h=N8(n.a,c,t.a,u);return X0(s=new lU(f,h.length,h)),s}function oBn(n){var t,e,i,r,c,a;for(this.e=new Np,this.a=new Np,e=n.b-1;e<3;e++)Kx(n,0,BB(Dpn(n,0),8));if(n.b<4)throw Hp(new _y("At (least dimension + 1) control points are necessary!"));for(this.b=3,this.d=!0,this.c=!1,I$n(this,n.b+this.b-1),a=new Np,c=new Wb(this.e),t=0;t<this.b-1;t++)WB(a,MD(n0(c)));for(r=spn(n,0);r.b!=r.d.c;)i=BB(b3(r),8),WB(a,MD(n0(c))),WB(this.a,new wJ(i,a)),l1(0,a.c.length),a.c.splice(0,1)}function sBn(n,t){var e,i,r,c,a,u,o;for(r=new Wb(n.b);r.a<r.c.c.length;)for(a=new Wb(BB(n0(r),29).a);a.a<a.c.c.length;)for((c=BB(n0(a),10)).k==(uSn(),Sut)&&(u=BB(U5(new oz(ZL(fbn(c).a.Kc(),new h))),17),o=BB(U5(new oz(ZL(lbn(c).a.Kc(),new h))),17),hFn(c,qy(TD(mMn(u,(hWn(),Clt))))&&qy(TD(mMn(o,Clt)))?Xun(t):t)),i=new oz(ZL(lbn(c).a.Kc(),new h));dAn(i);)vun(e=BB(U5(i),17),qy(TD(mMn(e,(hWn(),Clt))))?Xun(t):t)}function hBn(n,t,e,i,r){var c,a;if(e.f>=t.o&&e.f<=t.f||.5*t.a<=e.f&&1.5*t.a>=e.f){if((c=BB(xq(t.n,t.n.c.length-1),211)).e+c.d+e.g+r<=i&&(BB(xq(t.n,t.n.c.length-1),211).f-n.f+e.f<=n.b||1==n.a.c.length))return ybn(t,e),!0;if(t.s+e.g<=i&&(t.t+t.d+e.f+r<=n.b||1==n.a.c.length))return WB(t.b,e),a=BB(xq(t.n,t.n.c.length-1),211),WB(t.n,new RJ(t.s,a.f+a.a+t.i,t.i)),smn(BB(xq(t.n,t.n.c.length-1),211),e),BFn(t,e),!0}return!1}function fBn(n,t,e){var i,r,c,a;return n.ej()?(r=null,c=n.fj(),i=n.Zi(1,a=onn(n,t,e),e,t,c),n.bj()&&!(n.ni()&&null!=a?Nfn(a,e):GI(a)===GI(e))?(null!=a&&(r=n.dj(a,r)),r=n.cj(e,r),n.ij()&&(r=n.lj(a,e,r)),r?(r.Ei(i),r.Fi()):n.$i(i)):(n.ij()&&(r=n.lj(a,e,r)),r?(r.Ei(i),r.Fi()):n.$i(i)),a):(a=onn(n,t,e),n.bj()&&!(n.ni()&&null!=a?Nfn(a,e):GI(a)===GI(e))&&(r=null,null!=a&&(r=n.dj(a,null)),(r=n.cj(e,r))&&r.Fi()),a)}function lBn(n,t){var i,r,c,a,u,o,s;t%=24,n.q.getHours()!=t&&((i=new e.Date(n.q.getTime())).setDate(i.getDate()+1),(u=n.q.getTimezoneOffset()-i.getTimezoneOffset())>0&&(o=u/60|0,s=u%60,r=n.q.getDate(),n.q.getHours()+o>=24&&++r,c=new e.Date(n.q.getFullYear(),n.q.getMonth(),r,t+o,n.q.getMinutes()+s,n.q.getSeconds(),n.q.getMilliseconds()),n.q.setTime(c.getTime()))),a=n.q.getTime(),n.q.setTime(a+36e5),n.q.getHours()!=t&&n.q.setTime(a)}function bBn(n,t){var e,i,r,c;if(OTn(t,"Path-Like Graph Wrapping",1),0!=n.b.c.length)if(null==(r=new MAn(n)).i&&(r.i=Wrn(r,new kc)),e=Gy(r.i)*r.f/(null==r.i&&(r.i=Wrn(r,new kc)),Gy(r.i)),r.b>e)HSn(t);else{switch(BB(mMn(n,(HXn(),Bpt)),337).g){case 2:c=new Tc;break;case 0:c=new wc;break;default:c=new Mc}if(i=c.Vf(n,r),!c.Wf())switch(BB(mMn(n,Xpt),338).g){case 2:i=XCn(r,i);break;case 1:i=KTn(r,i)}iqn(n,r,i),HSn(t)}else HSn(t)}function wBn(n,t){var e,i,r,c;if(f1(n.d,n.e),n.c.a.$b(),0!=Gy(MD(mMn(t.j,(HXn(),Idt))))||0!=Gy(MD(mMn(t.j,Idt))))for(e=ZJn,GI(mMn(t.j,Ldt))!==GI((mon(),Nvt))&&hon(t.j,(hWn(),Jft),(hN(),!0)),c=BB(mMn(t.j,xpt),19).a,r=0;r<c&&!((i=gFn(n,t))<e&&(e=i,Lrn(n),0==e));r++);else for(e=DWn,GI(mMn(t.j,Ldt))!==GI((mon(),Nvt))&&hon(t.j,(hWn(),Jft),(hN(),!0)),c=BB(mMn(t.j,xpt),19).a,r=0;r<c&&!((i=pFn(n,t))<e&&(e=i,Lrn(n),0==e));r++);}function dBn(n,t){var e,i,r,c,a,u;for(r=new Np,c=0,e=0,a=0;c<t.c.length-1&&e<n.gc();){for(i=BB(n.Xb(e),19).a+a;(l1(c+1,t.c.length),BB(t.c[c+1],19)).a<i;)++c;for(u=0,i-(l1(c,t.c.length),BB(t.c[c],19)).a>(l1(c+1,t.c.length),BB(t.c[c+1],19)).a-i&&++u,WB(r,(l1(c+u,t.c.length),BB(t.c[c+u],19))),a+=(l1(c+u,t.c.length),BB(t.c[c+u],19)).a-i,++e;e<n.gc()&&BB(n.Xb(e),19).a+a<=(l1(c+u,t.c.length),BB(t.c[c+u],19)).a;)++e;c+=1+u}return r}function gBn(n){var t,e,i,r,c;if(!n.d){if(c=new Po,null==(t=P$t).a.zc(n,t)){for(e=new AL(kY(n));e.e!=e.i.gc();)pX(c,gBn(BB(kpn(e),26)));t.a.Bc(n),t.a.gc()}for(r=c.i,!n.q&&(n.q=new eU(QAt,n,11,10)),i=new AL(n.q);i.e!=i.i.gc();++r)BB(kpn(i),399);pX(c,(!n.q&&(n.q=new eU(QAt,n,11,10)),n.q)),chn(c),n.d=new NO((BB(Wtn(QQ((QX(),t$t).o),9),18),c.i),c.g),n.e=BB(c.g,673),null==n.e&&(n.e=C$t),P5(n).b&=-17}return n.d}function pBn(n,t,e,i){var r,c,a,u,o,s;if(s=axn(n.e.Tg(),t),o=0,r=BB(n.g,119),ZM(),BB(t,66).Oj()){for(a=0;a<n.i;++a)if(c=r[a],s.rl(c.ak())){if(Nfn(c,e))return o;++o}}else if(null!=e){for(u=0;u<n.i;++u)if(c=r[u],s.rl(c.ak())){if(Nfn(e,c.dd()))return o;++o}if(i)for(o=0,a=0;a<n.i;++a)if(c=r[a],s.rl(c.ak())){if(GI(e)===GI(hD(n,BB(c.dd(),56))))return o;++o}}else for(a=0;a<n.i;++a)if(c=r[a],s.rl(c.ak())){if(null==c.dd())return o;++o}return-1}function vBn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;for(SQ(),m$(n,new zu),a=zB(n),b=new Np,l=new Np,u=null,o=0;0!=a.b;)c=BB(0==a.b?null:(Px(0!=a.b),Atn(a,a.a.a)),157),!u||iG(u)*eG(u)/2<iG(c)*eG(c)?(u=c,b.c[b.c.length]=c):(o+=iG(c)*eG(c),l.c[l.c.length]=c,l.c.length>1&&(o>iG(u)*eG(u)/2||0==a.b)&&(f=new Gtn(l),h=iG(u)/eG(u),s=yXn(f,t,new bm,e,i,r,h),UR(kO(f.e),s),u=f,b.c[b.c.length]=f,o=0,l.c=x8(Ant,HWn,1,0,5,1)));return gun(b,l),b}function mBn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d;if(e.mh(t)&&(h=(b=t)?BB(i,49).xh(b):null))if(d=e.bh(t,n.a),(w=t.t)>1||-1==w)if(f=BB(d,69),l=BB(h,69),f.dc())l.$b();else for(a=!!Cvn(t),c=0,u=n.a?f.Kc():f.Zh();u.Ob();)s=BB(u.Pb(),56),(r=BB(lnn(n,s),56))?(a?-1==(o=l.Xc(r))?l.Xh(c,r):c!=o&&l.ji(c,r):l.Xh(c,r),++c):n.b&&!a&&(l.Xh(c,s),++c);else null==d?h.Wb(null):null==(r=lnn(n,d))?n.b&&!Cvn(t)&&h.Wb(d):h.Wb(r)}function yBn(n,t){var i,r,c,a,u,o,s,f;for(i=new Le,c=new oz(ZL(fbn(t).a.Kc(),new h));dAn(c);)if(!b5(r=BB(U5(c),17))&&eTn(o=r.c.i,Xut)){if(-1==(f=VDn(n,o,Xut,Uut)))continue;i.b=e.Math.max(i.b,f),!i.a&&(i.a=new Np),WB(i.a,o)}for(u=new oz(ZL(lbn(t).a.Kc(),new h));dAn(u);)if(!b5(a=BB(U5(u),17))&&eTn(s=a.d.i,Uut)){if(-1==(f=VDn(n,s,Uut,Xut)))continue;i.d=e.Math.max(i.d,f),!i.c&&(i.c=new Np),WB(i.c,s)}return i}function kBn(n){var t,e,i,r;if($On(),t=CJ(n),n<uet.length)return uet[t];if(n<=50)return uOn((ODn(),net),t);if(n<=VVn)return G5(uOn(aet[1],t),t);if(n>1e6)throw Hp(new Oy("power of ten too big"));if(n<=DWn)return G5(uOn(aet[1],t),t);for(r=i=uOn(aet[1],DWn),e=fan(n-DWn),t=CJ(n%DWn);Vhn(e,DWn)>0;)r=Nnn(r,i),e=ibn(e,DWn);for(r=G5(r=Nnn(r,uOn(aet[1],t)),DWn),e=fan(n-DWn);Vhn(e,DWn)>0;)r=G5(r,DWn),e=ibn(e,DWn);return r=G5(r,t)}function jBn(n,t){var e,i,r,c,a,u,o,s;for(OTn(t,"Hierarchical port dummy size processing",1),u=new Np,s=new Np,e=2*Gy(MD(mMn(n,(HXn(),kpt)))),r=new Wb(n.b);r.a<r.c.c.length;){for(i=BB(n0(r),29),u.c=x8(Ant,HWn,1,0,5,1),s.c=x8(Ant,HWn,1,0,5,1),a=new Wb(i.a);a.a<a.c.c.length;)(c=BB(n0(a),10)).k==(uSn(),Mut)&&((o=BB(mMn(c,(hWn(),Qft)),61))==(kUn(),sIt)?u.c[u.c.length]=c:o==SIt&&(s.c[s.c.length]=c));HOn(u,!0,e),HOn(s,!1,e)}HSn(t)}function EBn(n,t){var e,i,r,c,a;OTn(t,"Layer constraint postprocessing",1),0!=(a=n.b).c.length&&(l1(0,a.c.length),_Kn(n,BB(a.c[0],29),BB(xq(a,a.c.length-1),29),e=new HX(n),r=new HX(n)),0==e.a.c.length||(LZ(0,a.c.length),MS(a.c,0,e)),0==r.a.c.length||(a.c[a.c.length]=r)),Lx(n,(hWn(),nlt))&&(yDn(n,i=new HX(n),c=new HX(n)),0==i.a.c.length||(LZ(0,a.c.length),MS(a.c,0,i)),0==c.a.c.length||(a.c[a.c.length]=c)),HSn(t)}function TBn(n){var t,e,i,r,c,a,u,o;for(a=new Wb(n.a);a.a<a.c.c.length;)if((c=BB(n0(a),10)).k==(uSn(),Mut)&&((r=BB(mMn(c,(hWn(),Qft)),61))==(kUn(),oIt)||r==CIt))for(i=new oz(ZL(hbn(c).a.Kc(),new h));dAn(i);)0!=(t=(e=BB(U5(i),17)).a).b&&((u=e.c).i==c&&(Px(0!=t.b),BB(t.a.a.c,8).b=Aon(Pun(Gk(PMt,1),sVn,8,0,[u.i.n,u.n,u.a])).b),(o=e.d).i==c&&(Px(0!=t.b),BB(t.c.b.c,8).b=Aon(Pun(Gk(PMt,1),sVn,8,0,[o.i.n,o.n,o.a])).b))}function MBn(n,t){var e,i,r,c,a,u,o;for(OTn(t,"Sort By Input Model "+mMn(n,(HXn(),Ldt)),1),r=0,i=new Wb(n.b);i.a<i.c.c.length;){for(e=BB(n0(i),29),o=0==r?0:r-1,u=BB(xq(n.b,o),29),a=new Wb(e.a);a.a<a.c.c.length;)GI(mMn(c=BB(n0(a),10),ept))!==GI((QEn(),UCt))&&GI(mMn(c,ept))!==GI(XCt)&&(SQ(),m$(c.j,new O7(u,okn(c))),OH(t,"Node "+c+" ports: "+c.j));SQ(),m$(e.a,new Grn(u,BB(mMn(n,Ldt),339),BB(mMn(n,Adt),378))),OH(t,"Layer "+r+": "+e),++r}HSn(t)}function SBn(n,t){var e,i,r;if(r=kFn(t),JT(new Rq(null,(!t.c&&(t.c=new eU(XOt,t,9,9)),new w1(t.c,16))),new Uw(r)),uzn(t,i=BB(mMn(r,(hWn(),Zft)),21)),i.Hc((bDn(),lft)))for(e=new AL((!t.c&&(t.c=new eU(XOt,t,9,9)),t.c));e.e!=e.i.gc();)Qzn(n,t,r,BB(kpn(e),118));return 0!=BB(ZAn(t,(HXn(),Fgt)),174).gc()&&mDn(t,r),qy(TD(mMn(r,Xgt)))&&i.Fc(pft),Lx(r,gpt)&&My(new uwn(Gy(MD(mMn(r,gpt)))),r),GI(ZAn(t,sgt))===GI((ufn(),pCt))?cWn(n,t,r):eXn(n,t,r),r}function PBn(n,t,i,r){var c,a,u;if(this.j=new Np,this.k=new Np,this.b=new Np,this.c=new Np,this.e=new bA,this.i=new km,this.f=new Dp,this.d=new Np,this.g=new Np,WB(this.b,n),WB(this.b,t),this.e.c=e.Math.min(n.a,t.a),this.e.d=e.Math.min(n.b,t.b),this.e.b=e.Math.abs(n.a-t.a),this.e.a=e.Math.abs(n.b-t.b),c=BB(mMn(r,(HXn(),vgt)),74))for(u=spn(c,0);u.b!=u.d.c;)aen((a=BB(b3(u),8)).a,n.a)&&DH(this.i,a);i&&WB(this.j,i),WB(this.k,r)}function CBn(n,t,e){var i,r,c,a,u,o,s,h,f,l;for(h=new Xz(new xw(e)),vU(u=x8($Nt,ZYn,25,n.f.e.c.length,16,1),u.length),e[t.b]=0,s=new Wb(n.f.e);s.a<s.c.c.length;)(o=BB(n0(s),144)).b!=t.b&&(e[o.b]=DWn),F8(eMn(h,o));for(;0!=h.b.c.length;)for(u[(f=BB(mnn(h),144)).b]=!0,c=vN(new mT(n.b,f),0);c.c;)u[(l=$mn(r=BB(EZ(c),282),f)).b]||(a=Lx(r,(rkn(),pat))?Gy(MD(mMn(r,pat))):n.c,(i=e[f.b]+a)<e[l.b]&&(e[l.b]=i,srn(h,l),F8(eMn(h,l))))}function IBn(n,t,e){var i,r,c,a,u,o,s,h,f;for(r=!0,a=new Wb(n.b);a.a<a.c.c.length;){for(c=BB(n0(a),29),s=KQn,h=null,o=new Wb(c.a);o.a<o.c.c.length;){if(u=BB(n0(o),10),f=Gy(t.p[u.p])+Gy(t.d[u.p])-u.d.d,i=Gy(t.p[u.p])+Gy(t.d[u.p])+u.o.b+u.d.a,!(f>s&&i>s)){r=!1,e.n&&OH(e,"bk node placement breaks on "+u+" which should have been after "+h);break}h=u,s=Gy(t.p[u.p])+Gy(t.d[u.p])+u.o.b+u.d.a}if(!r)break}return e.n&&OH(e,t+" is feasible: "+r),r}function OBn(n,t,e,i){var r,c,a,u,o,s,h;for(u=-1,h=new Wb(n);h.a<h.c.c.length;)(s=BB(n0(h),112)).g=u--,a=r=dG(E2(NV(AV(new Rq(null,new w1(s.f,16)),new sa),new ha)).d),o=c=dG(E2(NV(AV(new Rq(null,new w1(s.k,16)),new fa),new la)).d),i||(a=dG(E2(NV(new Rq(null,new w1(s.f,16)),new ba)).d),o=dG(E2(NV(new Rq(null,new w1(s.k,16)),new wa)).d)),s.d=a,s.a=r,s.i=o,s.b=c,0==o?r5(e,s,e.c.b,e.c):0==a&&r5(t,s,t.c.b,t.c)}function ABn(n,t,e,i){var r,c,a,u,o,s,h;if(e.d.i!=t.i){for(Bl(r=new $vn(n),(uSn(),Put)),hon(r,(hWn(),dlt),e),hon(r,(HXn(),ept),(QEn(),XCt)),i.c[i.c.length]=r,CZ(a=new CSn,r),qCn(a,(kUn(),CIt)),CZ(u=new CSn,r),qCn(u,oIt),h=e.d,MZ(e,a),qan(c=new wY,e),hon(c,vgt,null),SZ(c,u),MZ(c,h),s=new M2(e.b,0);s.b<s.d.gc();)Px(s.b<s.d.gc()),GI(mMn(o=BB(s.d.Xb(s.c=s.b++),70),Ydt))===GI((Rtn(),UPt))&&(hon(o,Uft,e),fW(s),WB(c.b,o));yAn(r,a,u)}}function $Bn(n,t,e,i){var r,c,a,u,o,s;if(e.c.i!=t.i)for(Bl(r=new $vn(n),(uSn(),Put)),hon(r,(hWn(),dlt),e),hon(r,(HXn(),ept),(QEn(),XCt)),i.c[i.c.length]=r,CZ(a=new CSn,r),qCn(a,(kUn(),CIt)),CZ(u=new CSn,r),qCn(u,oIt),MZ(e,a),qan(c=new wY,e),hon(c,vgt,null),SZ(c,u),MZ(c,t),yAn(r,a,u),s=new M2(e.b,0);s.b<s.d.gc();)Px(s.b<s.d.gc()),o=BB(s.d.Xb(s.c=s.b++),70),BB(mMn(o,Ydt),272)==(Rtn(),UPt)&&(Lx(o,Uft)||hon(o,Uft,e),fW(s),WB(c.b,o))}function LBn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(l=new Np,p=S4(r),g=t*n.a,w=0,a=new Rv,u=new Rv,o=new Np,v=0,m=0,b=0,d=0,h=0,f=0;0!=p.a.gc();)(s=tbn(p,c,u))&&(p.a.Bc(s),o.c[o.c.length]=s,a.a.zc(s,a),w=n.f[s.p],v+=n.e[s.p]-w*n.b,m+=n.c[s.p]*n.b,f+=w*n.b,d+=n.e[s.p]),(!s||0==p.a.gc()||v>=g&&n.e[s.p]>w*n.b||m>=i*g)&&(l.c[l.c.length]=o,o=new Np,Frn(u,a),a.a.$b(),h-=f,b=e.Math.max(b,h*n.b+d),h+=m,v=m,m=0,f=0,d=0);return new rI(b,l)}function NBn(n){var t,e,i,r,c,a,u,o,s,h,f,l;for(e=new Kb(new Ob(n.c.b).a.vc().Kc());e.a.Ob();)u=BB(e.a.Pb(),42),null==(r=(t=BB(u.dd(),149)).a)&&(r=""),!(i=_D(n.c,r))&&0==r.length&&(i=yfn(n)),i&&!ywn(i.c,t,!1)&&DH(i.c,t);for(a=spn(n.a,0);a.b!=a.d.c;)c=BB(b3(a),478),s=T5(n.c,c.a),l=T5(n.c,c.b),s&&l&&DH(s.c,new rI(l,c.c));for(yQ(n.a),f=spn(n.b,0);f.b!=f.d.c;)h=BB(b3(f),478),t=KD(n.c,h.a),o=T5(n.c,h.b),t&&o&&DM(t,o,h.c);yQ(n.b)}function xBn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;c=new Pl(n),d5((a=new dkn).g),d5(a.j),$U(a.b),d5(a.d),d5(a.i),$U(a.k),$U(a.c),$U(a.e),b=bIn(a,c,null),O$n(a,c),r=b,t&&(u=eHn(s=new Pl(t)),vSn(r,Pun(Gk(nMt,1),HWn,527,0,[u]))),l=!1,f=!1,e&&(s=new Pl(e),l8n in s.a&&(l=zJ(s,l8n).ge().a),b8n in s.a&&(f=zJ(s,b8n).ge().a)),h=$j(Fen(new Xm,l),f),BSn(new su,r,h),l8n in c.a&&rtn(c,l8n,null),(l||f)&&(nBn(h,o=new py,l,f),rtn(c,l8n,o)),i=new Xg(a),Uon(new OA(r),i)}function DBn(n,t,e){var i,r,c,a,u,o,s,h,f;for(a=new Ykn,s=Pun(Gk(ANt,1),hQn,25,15,[0]),r=-1,c=0,i=0,o=0;o<n.b.c.length;++o){if(!((h=BB(xq(n.b,o),434)).b>0)){if(r=-1,32==fV(h.c,0)){if(f=s[0],ynn(t,s),s[0]>f)continue}else if($Y(t,h.c,s[0])){s[0]+=h.c.length;continue}return 0}if(r<0&&h.a&&(r=o,c=s[0],i=0),r>=0){if(u=h.b,o==r&&0==(u-=i++))return 0;if(!LUn(t,s,h,u,a)){o=r-1,s[0]=c;continue}}else if(r=-1,!LUn(t,s,h,0,a))return 0}return dUn(a,e)?s[0]:0}function RBn(n){var t,e,i,r,c,a;if(!n.f){if(a=new Mo,c=new Mo,null==(t=P$t).a.zc(n,t)){for(r=new AL(kY(n));r.e!=r.i.gc();)pX(a,RBn(BB(kpn(r),26)));t.a.Bc(n),t.a.gc()}for(!n.s&&(n.s=new eU(FAt,n,21,17)),i=new AL(n.s);i.e!=i.i.gc();)cL(e=BB(kpn(i),170),99)&&f9(c,BB(e,18));chn(c),n.r=new TH(n,(BB(Wtn(QQ((QX(),t$t).o),6),18),c.i),c.g),pX(a,n.r),chn(a),n.f=new NO((BB(Wtn(QQ(t$t.o),5),18),a.i),a.g),P5(n).b&=-3}return n.f}function KBn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w;for(a=n.o,i=x8(ANt,hQn,25,a,15,1),r=x8(ANt,hQn,25,a,15,1),e=n.p,t=x8(ANt,hQn,25,e,15,1),c=x8(ANt,hQn,25,e,15,1),s=0;s<a;s++){for(f=0;f<e&&!vmn(n,s,f);)++f;i[s]=f}for(h=0;h<a;h++){for(f=e-1;f>=0&&!vmn(n,h,f);)--f;r[h]=f}for(b=0;b<e;b++){for(u=0;u<a&&!vmn(n,u,b);)++u;t[b]=u}for(w=0;w<e;w++){for(u=a-1;u>=0&&!vmn(n,u,w);)--u;c[w]=u}for(o=0;o<a;o++)for(l=0;l<e;l++)o<c[l]&&o>t[l]&&l<r[o]&&l>i[o]&&FRn(n,o,l,!1,!0)}function _Bn(n){var t,e,i,r,c,a,u,o;e=qy(TD(mMn(n,(fRn(),Bct)))),c=n.a.c.d,u=n.a.d.d,e?(a=kL(XR(new xC(u.a,u.b),c),.5),o=kL(B$(n.e),.5),t=XR(UR(new xC(c.a,c.b),a),o),Hx(n.d,t)):(r=Gy(MD(mMn(n.a,rat))),i=n.d,c.a>=u.a?c.b>=u.b?(i.a=u.a+(c.a-u.a)/2+r,i.b=u.b+(c.b-u.b)/2-r-n.e.b):(i.a=u.a+(c.a-u.a)/2+r,i.b=c.b+(u.b-c.b)/2+r):c.b>=u.b?(i.a=c.a+(u.a-c.a)/2+r,i.b=u.b+(c.b-u.b)/2+r):(i.a=c.a+(u.a-c.a)/2+r,i.b=c.b+(u.b-c.b)/2-r-n.e.b))}function FBn(n,t){var e,i,r,c,a,u,o;if(null==n)return null;if(0==(c=n.length))return"";for(o=x8(ONt,WVn,25,c,15,1),_8(0,c,n.length),_8(0,c,o.length),YU(n,0,c,o,0),e=null,u=t,r=0,a=0;r<c;r++)i=o[r],EWn(),i<=32&&0!=(2&JLt[i])?u?(!e&&(e=new fN(n)),aY(e,r-a++)):(u=t,32!=i&&(!e&&(e=new fN(n)),sV(e,r-a,r-a+1,String.fromCharCode(32)))):u=!1;return u?e?(c=e.a.length)>0?fx(e.a,0,c-1):"":n.substr(0,c-1):e?e.a:n}function BBn(n){NM(n,new MTn(vj(wj(pj(gj(new du,UJn),"ELK DisCo"),"Layouter for arranging unconnected subgraphs. The subgraphs themselves are, by default, not laid out."),new at))),u2(n,UJn,XJn,mpn(Ect)),u2(n,UJn,WJn,mpn(pct)),u2(n,UJn,VJn,mpn(lct)),u2(n,UJn,QJn,mpn(vct)),u2(n,UJn,XYn,mpn(kct)),u2(n,UJn,WYn,mpn(yct)),u2(n,UJn,UYn,mpn(jct)),u2(n,UJn,VYn,mpn(mct)),u2(n,UJn,BJn,mpn(wct)),u2(n,UJn,HJn,mpn(bct)),u2(n,UJn,qJn,mpn(dct)),u2(n,UJn,GJn,mpn(gct))}function HBn(n,t,e,i){var r,c,a,u,o,s,h;if(Bl(c=new $vn(n),(uSn(),Iut)),hon(c,(HXn(),ept),(QEn(),XCt)),r=0,t){for(hon(a=new CSn,(hWn(),dlt),t),hon(c,dlt,t.i),qCn(a,(kUn(),CIt)),CZ(a,c),s=0,h=(o=Z0(t.e)).length;s<h;++s)MZ(o[s],a);hon(t,Elt,c),++r}if(e){for(u=new CSn,hon(c,(hWn(),dlt),e.i),hon(u,dlt,e),qCn(u,(kUn(),oIt)),CZ(u,c),s=0,h=(o=Z0(e.g)).length;s<h;++s)SZ(o[s],u);hon(e,Elt,c),++r}return hon(c,(hWn(),Bft),iln(r)),i.c[i.c.length]=c,c}function qBn(){qBn=O,OOt=Pun(Gk(ONt,1),WVn,25,15,[48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70]),AOt=new RegExp("[ \t\n\r\f]+");try{IOt=Pun(Gk(D$t,1),HWn,2015,0,[new vp((s$(),sdn("yyyy-MM-dd'T'HH:mm:ss'.'SSSZ",fR((fk(),fk(),rtt))))),new vp(sdn("yyyy-MM-dd'T'HH:mm:ss'.'SSS",fR(rtt))),new vp(sdn("yyyy-MM-dd'T'HH:mm:ss",fR(rtt))),new vp(sdn("yyyy-MM-dd'T'HH:mm",fR(rtt))),new vp(sdn("yyyy-MM-dd",fR(rtt)))])}catch(n){if(!cL(n=lun(n),78))throw Hp(n)}}function GBn(n){var t,i,r,c;if(r=qXn((!n.c&&(n.c=yhn(n.f)),n.c),0),0==n.e||0==n.a&&-1!=n.f&&n.e<0)return r;if(t=iin(n)<0?1:0,i=n.e,r.length,e.Math.abs(CJ(n.e)),c=new Ik,1==t&&(c.a+="-"),n.e>0)if((i-=r.length-t)>=0){for(c.a+="0.";i>qtt.length;i-=qtt.length)Nq(c,qtt);gR(c,qtt,CJ(i)),oO(c,r.substr(t))}else oO(c,fx(r,t,CJ(i=t-i))),c.a+=".",oO(c,nO(r,CJ(i)));else{for(oO(c,r.substr(t));i<-qtt.length;i+=qtt.length)Nq(c,qtt);gR(c,qtt,CJ(-i))}return c.a}function zBn(n,t,i,r){var c,a,u,o,s,h,f,l,b;return h=(s=XR(new xC(i.a,i.b),n)).a*t.b-s.b*t.a,f=t.a*r.b-t.b*r.a,l=(s.a*r.b-s.b*r.a)/f,b=h/f,0==f?0==h?(a=W8(n,c=UR(new xC(i.a,i.b),kL(new xC(r.a,r.b),.5))),u=W8(UR(new xC(n.a,n.b),t),c),o=.5*e.Math.sqrt(r.a*r.a+r.b*r.b),a<u&&a<=o?new xC(n.a,n.b):u<=o?UR(new xC(n.a,n.b),t):null):null:l>=0&&l<=1&&b>=0&&b<=1?UR(new xC(n.a,n.b),kL(new xC(t.a,t.b),l)):null}function UBn(n,t,e){var i,r,c,a,u;if(i=BB(mMn(n,(HXn(),Ndt)),21),e.a>t.a&&(i.Hc((wEn(),WMt))?n.c.a+=(e.a-t.a)/2:i.Hc(QMt)&&(n.c.a+=e.a-t.a)),e.b>t.b&&(i.Hc((wEn(),JMt))?n.c.b+=(e.b-t.b)/2:i.Hc(YMt)&&(n.c.b+=e.b-t.b)),BB(mMn(n,(hWn(),Zft)),21).Hc((bDn(),lft))&&(e.a>t.a||e.b>t.b))for(u=new Wb(n.a);u.a<u.c.c.length;)(a=BB(n0(u),10)).k==(uSn(),Mut)&&((r=BB(mMn(a,Qft),61))==(kUn(),oIt)?a.n.a+=e.a-t.a:r==SIt&&(a.n.b+=e.b-t.b));c=n.d,n.f.a=e.a-c.b-c.c,n.f.b=e.b-c.d-c.a}function XBn(n,t,e){var i,r,c,a,u;if(i=BB(mMn(n,(HXn(),Ndt)),21),e.a>t.a&&(i.Hc((wEn(),WMt))?n.c.a+=(e.a-t.a)/2:i.Hc(QMt)&&(n.c.a+=e.a-t.a)),e.b>t.b&&(i.Hc((wEn(),JMt))?n.c.b+=(e.b-t.b)/2:i.Hc(YMt)&&(n.c.b+=e.b-t.b)),BB(mMn(n,(hWn(),Zft)),21).Hc((bDn(),lft))&&(e.a>t.a||e.b>t.b))for(a=new Wb(n.a);a.a<a.c.c.length;)(c=BB(n0(a),10)).k==(uSn(),Mut)&&((r=BB(mMn(c,Qft),61))==(kUn(),oIt)?c.n.a+=e.a-t.a:r==SIt&&(c.n.b+=e.b-t.b));u=n.d,n.f.a=e.a-u.b-u.c,n.f.b=e.b-u.d-u.a}function WBn(n){var t,i,r,c,a,u,o,s,h,f;for(s=new Ib(new Cb(xOn(n)).a.vc().Kc());s.a.Ob();){for(r=BB(s.a.Pb(),42),h=0,f=0,h=(o=BB(r.cd(),10)).d.d,f=o.o.b+o.d.a,n.d[o.p]=0,t=o;(c=n.a[t.p])!=o;)i=Mgn(t,c),u=0,u=n.c==(gJ(),nyt)?i.d.n.b+i.d.a.b-i.c.n.b-i.c.a.b:i.c.n.b+i.c.a.b-i.d.n.b-i.d.a.b,a=Gy(n.d[t.p])+u,n.d[c.p]=a,h=e.Math.max(h,c.d.d-a),f=e.Math.max(f,a+c.o.b+c.d.a),t=c;t=o;do{n.d[t.p]=Gy(n.d[t.p])+h,t=n.a[t.p]}while(t!=o);n.b[o.p]=h+f}}function VBn(n){var t,i,r,c,a,u,o,s,h,f,l;for(n.b=!1,f=RQn,o=KQn,l=RQn,s=KQn,i=n.e.a.ec().Kc();i.Ob();)for(r=(t=BB(i.Pb(),266)).a,f=e.Math.min(f,r.c),o=e.Math.max(o,r.c+r.b),l=e.Math.min(l,r.d),s=e.Math.max(s,r.d+r.a),a=new Wb(t.c);a.a<a.c.c.length;)(c=BB(n0(a),395)).a.a?(u=(h=r.d+c.b.b)+c.c,l=e.Math.min(l,h),s=e.Math.max(s,u)):(u=(h=r.c+c.b.a)+c.c,f=e.Math.min(f,h),o=e.Math.max(o,u));n.a=new xC(o-f,s-l),n.c=new xC(f+n.d.a,l+n.d.b)}function QBn(n,t,e){var i,r,c,a,u,o,s,h;for(h=new Np,c=0,tin(s=new x0(0,e),new asn(0,0,s,e)),r=0,o=new AL(n);o.e!=o.i.gc();)u=BB(kpn(o),33),i=BB(xq(s.a,s.a.c.length-1),187),r+u.g+(0==BB(xq(s.a,0),187).b.c.length?0:e)>t&&(r=0,c+=s.b+e,h.c[h.c.length]=s,tin(s=new x0(c,e),i=new asn(0,s.f,s,e)),r=0),0==i.b.c.length||u.f>=i.o&&u.f<=i.f||.5*i.a<=u.f&&1.5*i.a>=u.f?ybn(i,u):(tin(s,a=new asn(i.s+i.r+e,s.f,s,e)),ybn(a,u)),r=u.i+u.g;return h.c[h.c.length]=s,h}function YBn(n){var t,e,i,r,c,a;if(!n.a){if(n.o=null,a=new gp(n),t=new So,null==(e=P$t).a.zc(n,e)){for(c=new AL(kY(n));c.e!=c.i.gc();)pX(a,YBn(BB(kpn(c),26)));e.a.Bc(n),e.a.gc()}for(!n.s&&(n.s=new eU(FAt,n,21,17)),r=new AL(n.s);r.e!=r.i.gc();)cL(i=BB(kpn(r),170),322)&&f9(t,BB(i,34));chn(t),n.k=new EH(n,(BB(Wtn(QQ((QX(),t$t).o),7),18),t.i),t.g),pX(a,n.k),chn(a),n.a=new NO((BB(Wtn(QQ(t$t.o),4),18),a.i),a.g),P5(n).b&=-2}return n.a}function JBn(n,t,e,i,r,c,a){var u,o,s,h,f;return h=!1,u=dNn(e.q,t.f+t.b-e.q.f),!((f=r-(e.q.e+u-a))<i.g)&&(o=c==n.c.length-1&&f>=(l1(c,n.c.length),BB(n.c[c],200)).e,!((s=cHn(i,f,!1).a)>t.b&&!o)&&((o||s<=t.b)&&(o&&s>t.b?(e.d=s,p9(e,FSn(e,s))):(aEn(e.q,u),e.c=!0),p9(i,r-(e.s+e.r)),Tvn(i,e.q.e+e.q.d,t.f),tin(t,i),n.c.length>c&&(Tkn((l1(c,n.c.length),BB(n.c[c],200)),i),0==(l1(c,n.c.length),BB(n.c[c],200)).a.c.length&&s6(n,c)),h=!0),h))}function ZBn(n,t,e,i){var r,c,a,u,o,s,h;if(h=axn(n.e.Tg(),t),r=0,c=BB(n.g,119),o=null,ZM(),BB(t,66).Oj()){for(u=0;u<n.i;++u)if(a=c[u],h.rl(a.ak())){if(Nfn(a,e)){o=a;break}++r}}else if(null!=e){for(u=0;u<n.i;++u)if(a=c[u],h.rl(a.ak())){if(Nfn(e,a.dd())){o=a;break}++r}}else for(u=0;u<n.i;++u)if(a=c[u],h.rl(a.ak())){if(null==a.dd()){o=a;break}++r}return o&&(mA(n.e)&&(s=t.$j()?new b4(n.e,4,t,e,null,r,!0):LY(n,t.Kj()?2:1,t,e,t.zj(),-1,!0),i?i.Ei(s):i=s),i=TKn(n,o,i)),i}function nHn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w,d;switch(w=0,d=0,s=c.c,o=c.b,f=i.f,b=i.g,t.g){case 0:w=r.i+r.g+u,d=n.c?gTn(w,a,r,u):r.j,l=e.Math.max(s,w+b),h=e.Math.max(o,d+f);break;case 1:d=r.j+r.f+u,w=n.c?dTn(d,a,r,u):r.i,l=e.Math.max(s,w+b),h=e.Math.max(o,d+f);break;case 2:w=s+u,d=0,l=s+u+b,h=e.Math.max(o,f);break;case 3:w=0,d=o+u,l=e.Math.max(s,b),h=o+u+f;break;default:throw Hp(new _y("IllegalPlacementOption."))}return new awn(n.a,l,h,t,w,d)}function tHn(n){var t,i,r,c,a,u,o,s,h,f,l,b;if(o=n.d,l=BB(mMn(n,(hWn(),Klt)),15),t=BB(mMn(n,Dft),15),l||t){if(a=Gy(MD(edn(n,(HXn(),ppt)))),u=Gy(MD(edn(n,vpt))),b=0,l){for(h=0,c=l.Kc();c.Ob();)r=BB(c.Pb(),10),h=e.Math.max(h,r.o.b),b+=r.o.a;b+=a*(l.gc()-1),o.d+=h+u}if(i=0,t){for(h=0,c=t.Kc();c.Ob();)r=BB(c.Pb(),10),h=e.Math.max(h,r.o.b),i+=r.o.a;i+=a*(t.gc()-1),o.a+=h+u}(s=e.Math.max(b,i))>n.o.a&&(f=(s-n.o.a)/2,o.b=e.Math.max(o.b,f),o.c=e.Math.max(o.c,f))}}function eHn(n){var t,e,i,r,c,a;for(cA(r=new R0,(Nun(),JTt)),i=new Sb(new Jy(new TT(n,jrn(n,x8(Qtt,sVn,2,0,6,1))).b));i.b<i.d.gc();)Px(i.b<i.d.gc()),e=SD(i.d.Xb(i.c=i.b++)),(c=pGn(lAt,e))&&null!=(a=Zqn(c,(t=zJ(n,e)).je()?t.je().a:t.ge()?""+t.ge().a:t.he()?""+t.he().a:t.Ib()))&&((SN(c.j,(rpn(),sMt))||SN(c.j,hMt))&&son(Ynn(r,UOt),c,a),SN(c.j,uMt)&&son(Ynn(r,_Ot),c,a),SN(c.j,fMt)&&son(Ynn(r,XOt),c,a),SN(c.j,oMt)&&son(Ynn(r,zOt),c,a));return r}function iHn(n,t,e,i){var r,c,a,u,o,s;if(o=axn(n.e.Tg(),t),c=BB(n.g,119),$xn(n.e,t)){for(r=0,u=0;u<n.i;++u)if(a=c[u],o.rl(a.ak())){if(r==e)return ZM(),BB(t,66).Oj()?a:(null!=(s=a.dd())&&i&&cL(t,99)&&0!=(BB(t,18).Bb&BQn)&&(s=FIn(n,t,u,r,s)),s);++r}throw Hp(new Ay(e9n+e+o8n+r))}for(r=0,u=0;u<n.i;++u){if(a=c[u],o.rl(a.ak()))return ZM(),BB(t,66).Oj()?a:(null!=(s=a.dd())&&i&&cL(t,99)&&0!=(BB(t,18).Bb&BQn)&&(s=FIn(n,t,u,r,s)),s);++r}return t.zj()}function rHn(n,t,e){var i,r,c,a,u,o,s,h;if(r=BB(n.g,119),$xn(n.e,t))return ZM(),BB(t,66).Oj()?new lq(t,n):new xI(t,n);for(s=axn(n.e.Tg(),t),i=0,u=0;u<n.i;++u){if(a=(c=r[u]).ak(),s.rl(a)){if(ZM(),BB(t,66).Oj())return c;if(a==(TOn(),lLt)||a==sLt){for(o=new lN(Bbn(c.dd()));++u<n.i;)((a=(c=r[u]).ak())==lLt||a==sLt)&&oO(o,Bbn(c.dd()));return gK(BB(t.Yj(),148),o.a)}return null!=(h=c.dd())&&e&&cL(t,99)&&0!=(BB(t,18).Bb&BQn)&&(h=FIn(n,t,u,i,h)),h}++i}return t.zj()}function cHn(n,t,i){var r,c,a,u,o,s,h,f,l,b;for(a=0,u=n.t,c=0,r=0,s=0,b=0,l=0,i&&(n.n.c=x8(Ant,HWn,1,0,5,1),WB(n.n,new RJ(n.s,n.t,n.i))),o=0,f=new Wb(n.b);f.a<f.c.c.length;)a+(h=BB(n0(f),33)).g+(o>0?n.i:0)>t&&s>0&&(a=0,u+=s+n.i,c=e.Math.max(c,b),r+=s+n.i,s=0,b=0,i&&(++l,WB(n.n,new RJ(n.s,u,n.i))),o=0),b+=h.g+(o>0?n.i:0),s=e.Math.max(s,h.f),i&&smn(BB(xq(n.n,l),211),h),a+=h.g+(o>0?n.i:0),++o;return c=e.Math.max(c,b),r+=s,i&&(n.r=c,n.d=r,yyn(n.j)),new UV(n.s,n.t,c,r)}function aHn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;if($T(),SU(n,"src"),SU(e,"dest"),l=tsn(n),o=tsn(e),pH(0!=(4&l.i),"srcType is not an array"),pH(0!=(4&o.i),"destType is not an array"),f=l.c,a=o.c,pH(0!=(1&f.i)?f==a:0==(1&a.i),"Array types don't match"),b=n.length,s=e.length,t<0||i<0||r<0||t+r>b||i+r>s)throw Hp(new fv);if(0==(1&f.i)&&l!=o)if(h=een(n),c=een(e),GI(n)===GI(e)&&t<i)for(t+=r,u=i+r;u-- >i;)$X(c,u,h[--t]);else for(u=i+r;i<u;)$X(c,i++,h[t++]);else r>0&&_Cn(n,t,e,i,r,!0)}function uHn(){uHn=O,ret=Pun(Gk(ANt,1),hQn,25,15,[_Vn,1162261467,OVn,1220703125,362797056,1977326743,OVn,387420489,AQn,214358881,429981696,815730721,1475789056,170859375,268435456,410338673,612220032,893871739,128e7,1801088541,113379904,148035889,191102976,244140625,308915776,387420489,481890304,594823321,729e6,887503681,OVn,1291467969,1544804416,1838265625,60466176]),cet=Pun(Gk(ANt,1),hQn,25,15,[-1,-1,31,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5])}function oHn(n){var t,e,i,r,c,a,u;for(i=new Wb(n.b);i.a<i.c.c.length;)for(c=new Wb(a0(BB(n0(i),29).a));c.a<c.c.c.length;)if(Znn(r=BB(n0(c),10))&&!(e=BB(mMn(r,(hWn(),Rft)),305)).g&&e.d)for(t=e,u=e.d;u;)eRn(u.i,u.k,!1,!0),A7(t.a),A7(u.i),A7(u.k),A7(u.b),MZ(u.c,t.c.d),MZ(t.c,null),PZ(t.a,null),PZ(u.i,null),PZ(u.k,null),PZ(u.b,null),(a=new v3(t.i,u.a,t.e,u.j,u.f)).k=t.k,a.n=t.n,a.b=t.b,a.c=u.c,a.g=t.g,a.d=u.d,hon(t.i,Rft,a),hon(u.a,Rft,a),u=u.d,t=a}function sHn(n,t){var e,i,r,c,a;if(a=BB(t,136),T$n(n),T$n(a),null!=a.b){if(n.c=!0,null==n.b)return n.b=x8(ANt,hQn,25,a.b.length,15,1),void aHn(a.b,0,n.b,0,a.b.length);for(c=x8(ANt,hQn,25,n.b.length+a.b.length,15,1),e=0,i=0,r=0;e<n.b.length||i<a.b.length;)e>=n.b.length?(c[r++]=a.b[i++],c[r++]=a.b[i++]):i>=a.b.length?(c[r++]=n.b[e++],c[r++]=n.b[e++]):a.b[i]<n.b[e]||a.b[i]===n.b[e]&&a.b[i+1]<n.b[e+1]?(c[r++]=a.b[i++],c[r++]=a.b[i++]):(c[r++]=n.b[e++],c[r++]=n.b[e++]);n.b=c}}function hHn(n,t){var e,i,r,c,a,u,o,s,h,f;return e=qy(TD(mMn(n,(hWn(),slt)))),u=qy(TD(mMn(t,slt))),i=BB(mMn(n,hlt),11),o=BB(mMn(t,hlt),11),r=BB(mMn(n,flt),11),s=BB(mMn(t,flt),11),h=!!i&&i==o,f=!!r&&r==s,e||u?(c=(!qy(TD(mMn(n,slt)))||qy(TD(mMn(n,olt))))&&(!qy(TD(mMn(t,slt)))||qy(TD(mMn(t,olt)))),a=!(qy(TD(mMn(n,slt)))&&qy(TD(mMn(n,olt)))||qy(TD(mMn(t,slt)))&&qy(TD(mMn(t,olt)))),new R_(h&&c||f&&a,h,f)):new R_(BB(n0(new Wb(n.j)),11).p==BB(n0(new Wb(t.j)),11).p,h,f)}function fHn(n){var t,i,r,c,a,u,o,s;for(r=0,i=0,s=new YT,t=0,o=new Wb(n.n);o.a<o.c.c.length;)0==(u=BB(n0(o),211)).c.c.length?r5(s,u,s.c.b,s.c):(r=e.Math.max(r,u.d),i+=u.a+(t>0?n.i:0)),++t;for(nwn(n.n,s),n.d=i,n.r=r,n.g=0,n.f=0,n.e=0,n.o=RQn,n.p=RQn,a=new Wb(n.b);a.a<a.c.c.length;)c=BB(n0(a),33),n.p=e.Math.min(n.p,c.g),n.g=e.Math.max(n.g,c.g),n.f=e.Math.max(n.f,c.f),n.o=e.Math.min(n.o,c.f),n.e+=c.f+n.i;n.a=n.e/n.b.c.length-n.i*((n.b.c.length-1)/n.b.c.length),yyn(n.j)}function lHn(n){var t,e,i,r;return 0!=(64&n.Db)?Yln(n):(t=new lN(V5n),(i=n.k)?oO(oO((t.a+=' "',t),i),'"'):(!n.n&&(n.n=new eU(zOt,n,1,7)),n.n.i>0&&(!(r=(!n.n&&(n.n=new eU(zOt,n,1,7)),BB(Wtn(n.n,0),137)).a)||oO(oO((t.a+=' "',t),r),'"'))),!n.b&&(n.b=new hK(KOt,n,4,7)),e=!(n.b.i<=1&&(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c.i<=1)),t.a+=e?" [":" ",oO(t,JL(new mk,new AL(n.b))),e&&(t.a+="]"),t.a+=e1n,e&&(t.a+="["),oO(t,JL(new mk,new AL(n.c))),e&&(t.a+="]"),t.a)}function bHn(n,t){var e,i,r,c,a,u,o;if(n.a){if(o=null,null!=(u=n.a.ne())?t.a+=""+u:null!=(a=n.a.Dj())&&(-1!=(c=GO(a,YTn(91)))?(o=a.substr(c),t.a+=""+fx(null==a?zWn:(kW(a),a),0,c)):t.a+=""+a),n.d&&0!=n.d.i){for(r=!0,t.a+="<",i=new AL(n.d);i.e!=i.i.gc();)e=BB(kpn(i),87),r?r=!1:t.a+=FWn,bHn(e,t);t.a+=">"}null!=o&&(t.a+=""+o)}else n.e?null!=(u=n.e.zb)&&(t.a+=""+u):(t.a+="?",n.b?(t.a+=" super ",bHn(n.b,t)):n.f&&(t.a+=" extends ",bHn(n.f,t)))}function wHn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M;for(y=n.c,k=t.c,e=E7(y.a,n,0),i=E7(k.a,t,0),v=BB(xwn(n,(ain(),Hvt)).Kc().Pb(),11),T=BB(xwn(n,qvt).Kc().Pb(),11),m=BB(xwn(t,Hvt).Kc().Pb(),11),M=BB(xwn(t,qvt).Kc().Pb(),11),g=Z0(v.e),j=Z0(T.g),p=Z0(m.e),E=Z0(M.g),Qyn(n,i,k),s=0,b=(c=p).length;s<b;++s)MZ(c[s],v);for(h=0,w=(a=E).length;h<w;++h)SZ(a[h],T);for(Qyn(t,e,y),f=0,d=(u=g).length;f<d;++f)MZ(u[f],m);for(o=0,l=(r=j).length;o<l;++o)SZ(r[o],M)}function dHn(n,t,e,i){var r,c,a,u,o,s;if(c=Wln(i),!qy(TD(mMn(i,(HXn(),Igt))))&&!qy(TD(mMn(n,bgt)))||vA(BB(mMn(n,ept),98)))switch(CZ(u=new CSn,n),t?((s=u.n).a=t.a-n.n.a,s.b=t.b-n.n.b,WSn(s,0,0,n.o.a,n.o.b),qCn(u,z_n(u,c))):(r=hwn(c),qCn(u,e==(ain(),qvt)?r:Tln(r))),a=BB(mMn(i,(hWn(),Zft)),21),o=u.j,c.g){case 2:case 1:(o==(kUn(),sIt)||o==SIt)&&a.Fc((bDn(),gft));break;case 4:case 3:(o==(kUn(),oIt)||o==CIt)&&a.Fc((bDn(),gft))}else r=hwn(c),u=R_n(n,e,e==(ain(),qvt)?r:Tln(r));return u}function gHn(n,t,i){var r,c,a,u,o,s,h;return e.Math.abs(t.s-t.c)<lZn||e.Math.abs(i.s-i.c)<lZn?0:(r=WNn(n,t.j,i.e),c=WNn(n,i.j,t.e),a=0,-1==r||-1==c?(-1==r&&(new zZ((O6(),Tyt),i,t,1),++a),-1==c&&(new zZ((O6(),Tyt),t,i,1),++a)):(u=Tfn(t.j,i.s,i.c),u+=Tfn(i.e,t.s,t.c),o=Tfn(i.j,t.s,t.c),(s=r+16*u)<(h=c+16*(o+=Tfn(t.e,i.s,i.c)))?new zZ((O6(),Myt),t,i,h-s):s>h?new zZ((O6(),Myt),i,t,s-h):s>0&&h>0&&(new zZ((O6(),Myt),t,i,0),new zZ(Myt,i,t,0))),a)}function pHn(n,t){var i,r,c,a,u;for(u=new usn(new Pb(n.f.b).a);u.b;){if(c=BB((a=ten(u)).cd(),594),1==t){if(c.gf()!=(Ffn(),HPt)&&c.gf()!=KPt)continue}else if(c.gf()!=(Ffn(),_Pt)&&c.gf()!=FPt)continue;switch(r=BB(BB(a.dd(),46).b,81),i=BB(BB(a.dd(),46).a,189).c,c.gf().g){case 2:r.g.c=n.e.a,r.g.b=e.Math.max(1,r.g.b+i);break;case 1:r.g.c=r.g.c+i,r.g.b=e.Math.max(1,r.g.b-i);break;case 4:r.g.d=n.e.b,r.g.a=e.Math.max(1,r.g.a+i);break;case 3:r.g.d=r.g.d+i,r.g.a=e.Math.max(1,r.g.a-i)}}}function vHn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(o=x8(ANt,hQn,25,t.b.c.length,15,1),h=x8($ut,$Vn,267,t.b.c.length,0,1),s=x8(Out,a1n,10,t.b.c.length,0,1),b=0,w=(l=n.a).length;b<w;++b){for(g=0,u=new Wb((f=l[b]).e);u.a<u.c.c.length;)++o[r=tA((c=BB(n0(u),10)).c)],d=Gy(MD(mMn(t,(HXn(),ypt)))),o[r]>0&&s[r]&&(d=K$(n.b,s[r],c)),g=e.Math.max(g,c.c.c.b+d);for(a=new Wb(f.e);a.a<a.c.c.length;)(c=BB(n0(a),10)).n.b=g+c.d.d,(i=c.c).c.b=g+c.d.d+c.o.b+c.d.a,h[E7(i.b.b,i,0)]=c.k,s[E7(i.b.b,i,0)]=c}}function mHn(n,t){var e,i,r,c,a,u,o,s,f,l,b;for(i=new oz(ZL(dLn(t).a.Kc(),new h));dAn(i);)cL(Wtn((!(e=BB(U5(i),79)).b&&(e.b=new hK(KOt,e,4,7)),e.b),0),186)||(o=PTn(BB(Wtn((!e.c&&(e.c=new hK(KOt,e,5,8)),e.c),0),82)),nAn(e)||(a=t.i+t.g/2,u=t.j+t.f/2,f=o.i+o.g/2,l=o.j+o.f/2,(b=new Gj).a=f-a,b.b=l-u,Ukn(c=new xC(b.a,b.b),t.g,t.f),b.a-=c.a,b.b-=c.b,a=f-b.a,u=l-b.b,Ukn(s=new xC(b.a,b.b),o.g,o.f),b.a-=s.a,b.b-=s.b,f=a+b.a,l=u+b.b,Ien(r=cDn(e,!0,!0),a),Aen(r,u),Ten(r,f),Oen(r,l),mHn(n,o)))}function yHn(n){NM(n,new MTn(vj(wj(pj(gj(new du,R4n),"ELK SPOrE Compaction"),"ShrinkTree is a compaction algorithm that maintains the topology of a layout. The relocation of diagram elements is based on contracting a spanning tree."),new tu))),u2(n,R4n,K4n,mpn(kTt)),u2(n,R4n,_4n,mpn(vTt)),u2(n,R4n,F4n,mpn(pTt)),u2(n,R4n,B4n,mpn(dTt)),u2(n,R4n,H4n,mpn(gTt)),u2(n,R4n,QJn,wTt),u2(n,R4n,vZn,8),u2(n,R4n,q4n,mpn(yTt)),u2(n,R4n,G4n,mpn(hTt)),u2(n,R4n,z4n,mpn(fTt)),u2(n,R4n,X2n,(hN(),!1))}function kHn(n,t){var i,r,c,a,u,o,s,h,f,l;for(OTn(t,"Simple node placement",1),l=BB(mMn(n,(hWn(),Alt)),304),o=0,a=new Wb(n.b);a.a<a.c.c.length;){for((u=(r=BB(n0(a),29)).c).b=0,i=null,h=new Wb(r.a);h.a<h.c.c.length;)s=BB(n0(h),10),i&&(u.b+=Idn(s,i,l.c)),u.b+=s.d.d+s.o.b+s.d.a,i=s;o=e.Math.max(o,u.b)}for(c=new Wb(n.b);c.a<c.c.c.length;)for(f=(o-(u=(r=BB(n0(c),29)).c).b)/2,i=null,h=new Wb(r.a);h.a<h.c.c.length;)s=BB(n0(h),10),i&&(f+=Idn(s,i,l.c)),f+=s.d.d,s.n.b=f,f+=s.o.b+s.d.a,i=s;HSn(t)}function jHn(n,t,e,i){var r,c,a,u,o,s,h,f;if(0==i.gc())return!1;if(ZM(),a=(o=BB(t,66).Oj())?i:new gtn(i.gc()),$xn(n.e,t)){if(t.hi())for(h=i.Kc();h.Ob();)UFn(n,t,s=h.Pb(),cL(t,99)&&0!=(BB(t,18).Bb&BQn))||(c=Z3(t,s),a.Fc(c));else if(!o)for(h=i.Kc();h.Ob();)c=Z3(t,s=h.Pb()),a.Fc(c)}else{for(f=axn(n.e.Tg(),t),r=BB(n.g,119),u=0;u<n.i;++u)if(c=r[u],f.rl(c.ak()))throw Hp(new _y(I7n));if(i.gc()>1)throw Hp(new _y(I7n));o||(c=Z3(t,i.Kc().Pb()),a.Fc(c))}return oon(n,EPn(n,t,e),a)}function EHn(n,t){var e,i,r,c;for(Qtn(t.b.j),JT($V(new Rq(null,new w1(t.d,16)),new cc),new ac),c=new Wb(t.d);c.a<c.c.c.length;){switch((r=BB(n0(c),101)).e.g){case 0:e=BB(xq(r.j,0),113).d.j,Gl(r,BB($N(Oz(BB(h6(r.k,e),15).Oc(),Qst)),113)),ql(r,BB($N(Iz(BB(h6(r.k,e),15).Oc(),Qst)),113));break;case 1:i=Hyn(r),Gl(r,BB($N(Oz(BB(h6(r.k,i[0]),15).Oc(),Qst)),113)),ql(r,BB($N(Iz(BB(h6(r.k,i[1]),15).Oc(),Qst)),113));break;case 2:VPn(n,r);break;case 3:KNn(r);break;case 4:GNn(n,r)}Vtn(r)}n.a=null}function THn(n,t,e){var i,r,c,a,u,o,s,h;return i=n.a.o==(oZ(),cyt)?RQn:KQn,!(u=cFn(n,new aC(t,e))).a&&u.c?(DH(n.d,u),i):u.a?(r=u.a.c,o=u.a.d,e?(s=n.a.c==(gJ(),tyt)?o:r,c=n.a.c==tyt?r:o,a=n.a.g[c.i.p],h=Gy(n.a.p[a.p])+Gy(n.a.d[c.i.p])+c.n.b+c.a.b-Gy(n.a.d[s.i.p])-s.n.b-s.a.b):(s=n.a.c==(gJ(),nyt)?o:r,c=n.a.c==nyt?r:o,h=Gy(n.a.p[n.a.g[c.i.p].p])+Gy(n.a.d[c.i.p])+c.n.b+c.a.b-Gy(n.a.d[s.i.p])-s.n.b-s.a.b),n.a.n[n.a.g[r.i.p].p]=(hN(),!0),n.a.n[n.a.g[o.i.p].p]=!0,h):i}function MHn(n,t,e){var i,r,c,a,u,o,s;if($xn(n.e,t))ZM(),AOn((u=BB(t,66).Oj()?new lq(t,n):new xI(t,n)).c,u.b),Z$(u,BB(e,14));else{for(s=axn(n.e.Tg(),t),i=BB(n.g,119),c=0;c<n.i;++c)if(r=i[c].ak(),s.rl(r)){if(r==(TOn(),lLt)||r==sLt){for(a=c,(o=Ovn(n,t,e))?fDn(n,c):++c;c<n.i;)(r=i[c].ak())==lLt||r==sLt?fDn(n,c):++c;o||BB(ovn(n,a,Z3(t,e)),72)}else Ovn(n,t,e)?fDn(n,c):BB(ovn(n,c,(ZM(),BB(t,66).Oj()?BB(e,72):Z3(t,e))),72);return}Ovn(n,t,e)||f9(n,(ZM(),BB(t,66).Oj()?BB(e,72):Z3(t,e)))}}function SHn(n,t,e){var i,r,c,a,u,o,s,h;return Nfn(e,n.b)||(n.b=e,c=new Jn,a=BB(P4($V(new Rq(null,new w1(e.f,16)),c),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Xet),Uet]))),21),n.e=!0,n.f=!0,n.c=!0,n.d=!0,r=a.Hc((Hpn(),Brt)),i=a.Hc(Hrt),r&&!i&&(n.f=!1),!r&&i&&(n.d=!1),r=a.Hc(Frt),i=a.Hc(qrt),r&&!i&&(n.c=!1),!r&&i&&(n.e=!1)),h=BB(n.a.Ce(t,e),46),o=BB(h.a,19).a,s=BB(h.b,19).a,u=!1,o<0?n.c||(u=!0):n.e||(u=!0),s<0?n.d||(u=!0):n.f||(u=!0),u?SHn(n,h,e):h}function PHn(n){var t,i,r,c;c=n.o,qD(),n.A.dc()||Nfn(n.A,$rt)?t=c.b:(t=MIn(n.f),n.A.Hc((mdn(),RIt))&&!n.B.Hc((n_n(),XIt))&&(t=e.Math.max(t,MIn(BB(oV(n.p,(kUn(),oIt)),244))),t=e.Math.max(t,MIn(BB(oV(n.p,CIt),244)))),(i=oan(n))&&(t=e.Math.max(t,i.b)),n.A.Hc(KIt)&&(n.q!=(QEn(),WCt)&&n.q!=XCt||(t=e.Math.max(t,XH(BB(oV(n.b,(kUn(),oIt)),124))),t=e.Math.max(t,XH(BB(oV(n.b,CIt),124)))))),qy(TD(n.e.yf().We((sWn(),FSt))))?c.b=e.Math.max(c.b,t):c.b=t,(r=n.f.i).d=0,r.a=t,GFn(n.f)}function CHn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;for(h=0;h<t.length;h++){for(a=n.Kc();a.Ob();)BB(a.Pb(),225).Of(h,t);for(f=0;f<t[h].length;f++){for(u=n.Kc();u.Ob();)BB(u.Pb(),225).Pf(h,f,t);for(b=t[h][f].j,l=0;l<b.c.length;l++){for(o=n.Kc();o.Ob();)BB(o.Pb(),225).Qf(h,f,l,t);for(l1(l,b.c.length),e=0,r=new m6(BB(b.c[l],11).b);y$(r.a)||y$(r.b);)for(i=BB(y$(r.a)?n0(r.a):n0(r.b),17),s=n.Kc();s.Ob();)BB(s.Pb(),225).Nf(h,f,l,e++,i,t)}}}for(c=n.Kc();c.Ob();)BB(c.Pb(),225).Mf()}function IHn(n,t){var e,i,r,c,a;for(n.b=Gy(MD(mMn(t,(HXn(),kpt)))),n.c=Gy(MD(mMn(t,Tpt))),n.d=BB(mMn(t,rgt),336),n.a=BB(mMn(t,Pdt),275),fmn(t),r=(c=BB(P4(AV(AV(wnn(wnn(new Rq(null,new w1(t.b,16)),new ye),new ke),new je),new Ee),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15)).Kc();r.Ob();)e=BB(r.Pb(),17),BB(mMn(e,(hWn(),Nlt)),15).Jc(new ed(n)),hon(e,Nlt,null);for(i=c.Kc();i.Ob();)e=BB(i.Pb(),17),a=BB(mMn(e,(hWn(),xlt)),17),FXn(n,BB(mMn(e,$lt),15),a),hon(e,$lt,null)}function OHn(n){n.b=null,n.a=null,n.o=null,n.q=null,n.v=null,n.w=null,n.B=null,n.p=null,n.Q=null,n.R=null,n.S=null,n.T=null,n.U=null,n.V=null,n.W=null,n.bb=null,n.eb=null,n.ab=null,n.H=null,n.db=null,n.c=null,n.d=null,n.f=null,n.n=null,n.r=null,n.s=null,n.u=null,n.G=null,n.J=null,n.e=null,n.j=null,n.i=null,n.g=null,n.k=null,n.t=null,n.F=null,n.I=null,n.L=null,n.M=null,n.O=null,n.P=null,n.$=null,n.N=null,n.Z=null,n.cb=null,n.K=null,n.D=null,n.A=null,n.C=null,n._=null,n.fb=null,n.X=null,n.Y=null,n.gb=!1,n.hb=!1}function AHn(n){var t,e,i,r,c;if(n.k!=(uSn(),Cut))return!1;if(n.j.c.length<=1)return!1;if(BB(mMn(n,(HXn(),ept)),98)==(QEn(),XCt))return!1;if(bvn(),(i=(n.q?n.q:(SQ(),SQ(),het))._b(Rgt)?BB(mMn(n,Rgt),197):BB(mMn(vW(n),Kgt),197))==lvt)return!1;if(i!=fvt&&i!=hvt){if(r=Gy(MD(edn(n,Npt))),!(t=BB(mMn(n,Lpt),142))&&(t=new HR(r,r,r,r)),c=abn(n,(kUn(),CIt)),t.d+t.a+(c.gc()-1)*r>n.o.b)return!1;if(e=abn(n,oIt),t.d+t.a+(e.gc()-1)*r>n.o.b)return!1}return!0}function $Hn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;if(a=n.e,o=t.e,0==a)return t;if(0==o)return n;if((c=n.d)+(u=t.d)==2)return e=e0(n.a[0],UQn),i=e0(t.a[0],UQn),a==o?(w=dG(h=rbn(e,i)),0==(b=dG(jz(h,32)))?new X6(a,w):new lU(a,2,Pun(Gk(ANt,1),hQn,25,15,[w,b]))):npn(a<0?ibn(i,e):ibn(e,i));if(a==o)l=a,f=c>=u?N8(n.a,c,t.a,u):N8(t.a,u,n.a,c);else{if(0==(r=c!=u?c>u?1:-1:Msn(n.a,t.a,c)))return ODn(),eet;1==r?(l=a,f=d6(n.a,c,t.a,u)):(l=o,f=d6(t.a,u,n.a,c))}return X0(s=new lU(l,f.length,f)),s}function LHn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w;return l=qy(TD(mMn(t,(HXn(),Ogt)))),b=null,a==(ain(),Hvt)&&r.c.i==i?b=r.c:a==qvt&&r.d.i==i&&(b=r.d),(h=u)&&l&&!b?(WB(h.e,r),w=e.Math.max(Gy(MD(mMn(h.d,agt))),Gy(MD(mMn(r,agt)))),hon(h.d,agt,w)):(kUn(),f=PIt,b?f=b.j:vA(BB(mMn(i,ept),98))&&(f=a==Hvt?CIt:oIt),s=xHn(n,t,i,a,f,r),o=W5((vW(i),r)),a==Hvt?(SZ(o,BB(xq(s.j,0),11)),MZ(o,c)):(SZ(o,c),MZ(o,BB(xq(s.j,0),11))),h=new zfn(r,o,s,BB(mMn(s,(hWn(),dlt)),11),a,!b)),JIn(n.a,r,new L_(h.d,t,a)),h}function NHn(n,t){var e,i,r,c,a,u,o,s,h,f;if(h=null,n.d&&(h=BB(SJ(n.d,t),138)),!h){if(f=(c=n.a.Mh()).i,!n.d||NT(n.d)!=f){for(o=new xp,n.d&&Tcn(o,n.d),u=s=o.f.c+o.g.c;u<f;++u)i=BB(Wtn(c,u),138),(e=BB(null==(r=Cfn(n.e,i).ne())?jCn(o.f,null,i):ubn(o.g,r,i),138))&&e!=i&&(null==r?jCn(o.f,null,e):ubn(o.g,r,e));if(o.f.c+o.g.c!=f)for(a=0;a<s;++a)i=BB(Wtn(c,a),138),(e=BB(null==(r=Cfn(n.e,i).ne())?jCn(o.f,null,i):ubn(o.g,r,i),138))&&e!=i&&(null==r?jCn(o.f,null,e):ubn(o.g,r,e));n.d=o}h=BB(SJ(n.d,t),138)}return h}function xHn(n,t,e,i,r,c){var a,u,o,s,h,f;return a=null,s=i==(ain(),Hvt)?c.c:c.d,o=Wln(t),s.i==e?(a=BB(RX(n.b,s),10))||(hon(a=bXn(s,BB(mMn(e,(HXn(),ept)),98),r,HKn(s),null,s.n,s.o,o,t),(hWn(),dlt),s),VW(n.b,s,a)):(u=AEn(a=bXn((h=new Zn,f=Gy(MD(mMn(t,(HXn(),ypt))))/2,son(h,tpt,f),h),BB(mMn(e,ept),98),r,i==Hvt?-1:1,null,new Gj,new xC(0,0),o,t),e,i),hon(a,(hWn(),dlt),u),VW(n.b,u,a)),BB(mMn(t,(hWn(),Zft)),21).Fc((bDn(),lft)),vA(BB(mMn(t,(HXn(),ept)),98))?hon(t,ept,(QEn(),VCt)):hon(t,ept,(QEn(),QCt)),a}function DHn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d;OTn(t,"Orthogonal edge routing",1),s=Gy(MD(mMn(n,(HXn(),Apt)))),e=Gy(MD(mMn(n,kpt))),i=Gy(MD(mMn(n,Tpt))),l=new fX(0,e),d=0,a=new M2(n.b,0),u=null,h=null,o=null,f=null;do{f=(h=a.b<a.d.gc()?(Px(a.b<a.d.gc()),BB(a.d.Xb(a.c=a.b++),29)):null)?h.a:null,u&&(Tqn(u,d),d+=u.c.a),w=AGn(l,n,o,f,u?d+i:d),r=!u||VI(o,(dxn(),jyt)),c=!h||VI(f,(dxn(),jyt)),w>0?(b=(w-1)*e,u&&(b+=i),h&&(b+=i),b<s&&!r&&!c&&(b=s),d+=b):!r&&!c&&(d+=s),u=h,o=f}while(h);n.f.a=d,HSn(t)}function RHn(){var n;RHn=O,EAt=new Sm,kAt=x8(Qtt,sVn,2,0,6,1),SAt=i0(Bun(33,58),Bun(1,26)),PAt=i0(Bun(97,122),Bun(65,90)),CAt=Bun(48,57),TAt=i0(SAt,0),MAt=i0(PAt,CAt),IAt=i0(i0(0,Bun(1,6)),Bun(33,38)),OAt=i0(i0(CAt,Bun(65,70)),Bun(97,102)),xAt=i0(TAt,dpn("-_.!~*'()")),DAt=i0(MAt,Xwn("-_.!~*'()")),dpn(u9n),Xwn(u9n),i0(xAt,dpn(";:@&=+$,")),i0(DAt,Xwn(";:@&=+$,")),AAt=dpn(":/?#"),$At=Xwn(":/?#"),LAt=dpn("/?#"),NAt=Xwn("/?#"),(n=new Rv).a.zc("jar",n),n.a.zc("zip",n),n.a.zc("archive",n),SQ(),jAt=new Ak(n)}function KHn(n,t){var e,i,r,c,a;if(hon(t,(qqn(),okt),0),r=BB(mMn(t,akt),86),0==t.d.b)r?(a=Gy(MD(mMn(r,fkt)))+n.a+E5(r,t),hon(t,fkt,a)):hon(t,fkt,0);else{for(e=new wg(spn(new bg(t).a.d,0));EE(e.a);)KHn(n,BB(b3(e.a),188).c);i=BB(iL(new wg(spn(new bg(t).a.d,0))),86),c=(Gy(MD(mMn(BB(TN(new wg(spn(new bg(t).a.d,0))),86),fkt)))+Gy(MD(mMn(i,fkt))))/2,r?(a=Gy(MD(mMn(r,fkt)))+n.a+E5(r,t),hon(t,fkt,a),hon(t,okt,Gy(MD(mMn(t,fkt)))-c),IGn(n,t)):hon(t,fkt,c)}}function _Hn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;u=0,b=0,o=TJ(n.f,n.f.length),c=n.d,a=n.i,i=n.a,r=n.b;do{for(l=0,s=new Wb(n.p);s.a<s.c.c.length;)f=OGn(n,BB(n0(s),10)),e=!0,(n.q==(sNn(),Tvt)||n.q==Pvt)&&(e=qy(TD(f.b))),BB(f.a,19).a<0&&e?(++l,o=TJ(n.f,n.f.length),n.d=n.d+BB(f.a,19).a,b+=c-n.d,c=n.d+BB(f.a,19).a,a=n.i,i=a0(n.a),r=a0(n.b)):(n.f=TJ(o,o.length),n.d=c,n.a=(yX(i),i?new t_(i):HB(new Wb(i))),n.b=(yX(r),r?new t_(r):HB(new Wb(r))),n.i=a);++u,h=0!=l&&qy(TD(t.Kb(new rI(iln(b),iln(u)))))}while(h)}function FHn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;return a=n.f,l=t.f,u=a==(YLn(),xEt)||a==REt,o=a==DEt||a==KEt,b=l==DEt||l==KEt,s=a==DEt||a==xEt,w=l==DEt||l==xEt,!u||l!=xEt&&l!=REt?o&&b?n.f==KEt?n:t:s&&w?(a==DEt?(f=n,h=t):(f=t,h=n),d=i.j+i.f,g=f.e+r.f,p=e.Math.max(d,g)-e.Math.min(i.j,f.e),c=(f.d+r.g-i.i)*p,v=i.i+i.g,m=h.d+r.g,c<=(e.Math.max(v,m)-e.Math.min(i.i,h.d))*(h.e+r.f-i.j)?n.f==DEt?n:t:n.f==xEt?n:t):n:n.f==REt?n:t}function BHn(n){var t,e,i,r,c,a,u,o,s,h;for(s=n.e.a.c.length,c=new Wb(n.e.a);c.a<c.c.c.length;)BB(n0(c),121).j=!1;for(n.i=x8(ANt,hQn,25,s,15,1),n.g=x8(ANt,hQn,25,s,15,1),n.n=new Np,r=0,h=new Np,u=new Wb(n.e.a);u.a<u.c.c.length;)(a=BB(n0(u),121)).d=r++,0==a.b.a.c.length&&WB(n.n,a),gun(h,a.g);for(t=0,i=new Wb(h);i.a<i.c.c.length;)(e=BB(n0(i),213)).c=t++,e.f=!1;o=h.c.length,null==n.b||n.b.length<o?(n.b=x8(xNt,qQn,25,o,15,1),n.c=x8($Nt,ZYn,25,o,16,1)):nk(n.c),n.d=h,n.p=new LN(etn(n.d.c.length)),n.j=1}function HHn(n,t){var e,i,r,c,a,u,o,s,h;if(!(t.e.c.length<=1)){for(n.f=t,n.d=BB(mMn(n.f,(rkn(),vat)),379),n.g=BB(mMn(n.f,jat),19).a,n.e=Gy(MD(mMn(n.f,mat))),n.c=Gy(MD(mMn(n.f,pat))),cX(n.b),r=new Wb(n.f.c);r.a<r.c.c.length;)i=BB(n0(r),282),yKn(n.b,i.c,i,null),yKn(n.b,i.d,i,null);for(u=n.f.e.c.length,n.a=kq(xNt,[sVn,qQn],[104,25],15,[u,u],2),s=new Wb(n.f.e);s.a<s.c.c.length;)CBn(n,o=BB(n0(s),144),n.a[o.b]);for(n.i=kq(xNt,[sVn,qQn],[104,25],15,[u,u],2),c=0;c<u;++c)for(a=0;a<u;++a)h=1/((e=n.a[c][a])*e),n.i[c][a]=h}}function qHn(n){var t,e,i,r;if(!(null==n.b||n.b.length<=2||n.a)){for(t=0,r=0;r<n.b.length;){for(t!=r?(n.b[t]=n.b[r++],n.b[t+1]=n.b[r++]):r+=2,e=n.b[t+1];r<n.b.length&&!(e+1<n.b[r]);)if(e+1==n.b[r])n.b[t+1]=n.b[r+1],e=n.b[t+1],r+=2;else if(e>=n.b[r+1])r+=2;else{if(!(e<n.b[r+1]))throw Hp(new dy("Token#compactRanges(): Internel Error: ["+n.b[t]+","+n.b[t+1]+"] ["+n.b[r]+","+n.b[r+1]+"]"));n.b[t+1]=n.b[r+1],e=n.b[t+1],r+=2}t+=2}t!=n.b.length&&(i=x8(ANt,hQn,25,t,15,1),aHn(n.b,0,i,0,t),n.b=i),n.a=!0}}function GHn(n,t){var e,i,r,c,a,u,o;for(a=gz(n.a).Kc();a.Ob();){if((c=BB(a.Pb(),17)).b.c.length>0)for(i=new t_(BB(h6(n.a,c),21)),SQ(),m$(i,new _w(t)),r=new M2(c.b,0);r.b<r.d.gc();){switch(Px(r.b<r.d.gc()),e=BB(r.d.Xb(r.c=r.b++),70),u=-1,BB(mMn(e,(HXn(),Ydt)),272).g){case 1:u=i.c.length-1;break;case 0:u=Jjn(i);break;case 2:u=0}-1!=u&&(l1(u,i.c.length),WB((o=BB(i.c[u],243)).b.b,e),BB(mMn(vW(o.b.c.i),(hWn(),Zft)),21).Fc((bDn(),fft)),BB(mMn(vW(o.b.c.i),Zft),21).Fc(sft),fW(r),hon(e,vlt,c))}SZ(c,null),MZ(c,null)}}function zHn(n,t){var e,i,r,c;return e=new _n,1==(r=2==(r=(i=BB(P4($V(new Rq(null,new w1(n.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Xet),Uet]))),21)).gc())?1:0)&&QI(ldn(BB(P4(AV(i.Lc(),new Fn),Wcn(jgn(0),new en)),162).a,2),0)&&(r=0),1==(c=2==(c=(i=BB(P4($V(new Rq(null,new w1(t.f,16)),e),x7(new Q,new Y,new cn,new an,Pun(Gk(nit,1),$Vn,132,0,[Xet,Uet]))),21)).gc())?1:0)&&QI(ldn(BB(P4(AV(i.Lc(),new Bn),Wcn(jgn(0),new en)),162).a,2),0)&&(c=0),r<c?-1:r==c?0:1}function UHn(n){var t,e,i,r,c,a,u,o,s,h,f;if(o=new Np,!Lx(n,(hWn(),Wft)))return o;for(i=BB(mMn(n,Wft),15).Kc();i.Ob();)dqn(t=BB(i.Pb(),10),n),o.c[o.c.length]=t;for(r=new Wb(n.b);r.a<r.c.c.length;)for(a=new Wb(BB(n0(r),29).a);a.a<a.c.c.length;)(c=BB(n0(a),10)).k==(uSn(),Mut)&&(u=BB(mMn(c,Vft),10))&&(CZ(s=new CSn,c),qCn(s,BB(mMn(c,Qft),61)),h=BB(xq(u.j,0),11),SZ(f=new wY,s),MZ(f,h));for(e=new Wb(o);e.a<e.c.c.length;)PZ(t=BB(n0(e),10),BB(xq(n.b,n.b.c.length-1),29));return o}function XHn(n){var t,e,i,r,c,a,u,o,s,h,f,l;for(c=qy(TD(ZAn(t=WJ(n),(HXn(),wgt)))),h=0,r=0,s=new AL((!n.e&&(n.e=new hK(_Ot,n,7,4)),n.e));s.e!=s.i.gc();)a=(u=QIn(o=BB(kpn(s),79)))&&c&&qy(TD(ZAn(o,dgt))),l=PTn(BB(Wtn((!o.c&&(o.c=new hK(KOt,o,5,8)),o.c),0),82)),u&&a?++r:u&&!a?++h:JJ(l)==t||l==t?++r:++h;for(i=new AL((!n.d&&(n.d=new hK(_Ot,n,8,5)),n.d));i.e!=i.i.gc();)a=(u=QIn(e=BB(kpn(i),79)))&&c&&qy(TD(ZAn(e,dgt))),f=PTn(BB(Wtn((!e.b&&(e.b=new hK(KOt,e,4,7)),e.b),0),82)),u&&a?++h:u&&!a?++r:JJ(f)==t||f==t?++h:++r;return h-r}function WHn(n,t){var e,i,r,c,a,u,o,s,h;if(OTn(t,"Edge splitting",1),n.b.c.length<=2)HSn(t);else{for(Px((c=new M2(n.b,0)).b<c.d.gc()),a=BB(c.d.Xb(c.c=c.b++),29);c.b<c.d.gc();)for(r=a,Px(c.b<c.d.gc()),a=BB(c.d.Xb(c.c=c.b++),29),u=new Wb(r.a);u.a<u.c.c.length;)for(o=new Wb(BB(n0(u),10).j);o.a<o.c.c.length;)for(i=new Wb(BB(n0(o),11).g);i.a<i.c.c.length;)(s=(e=BB(n0(i),17)).d.i.c)!=r&&s!=a&&zxn(e,(Bl(h=new $vn(n),(uSn(),Put)),hon(h,(hWn(),dlt),e),hon(h,(HXn(),ept),(QEn(),XCt)),PZ(h,a),h));HSn(t)}}function VHn(n,t){var e,i,r,c,a,u,o,s,h;if((a=null!=t.p&&!t.b)||OTn(t,aZn,1),c=1/(e=BB(mMn(n,(hWn(),Mlt)),15)).gc(),t.n)for(OH(t,"ELK Layered uses the following "+e.gc()+" modules:"),h=0,s=e.Kc();s.Ob();)OH(t," Slot "+(h<10?"0":"")+h+++": "+nE(tsn(BB(s.Pb(),51))));for(o=e.Kc();o.Ob();)BB(o.Pb(),51).pf(n,mcn(t,c));for(r=new Wb(n.b);r.a<r.c.c.length;)i=BB(n0(r),29),gun(n.a,i.a),i.a.c=x8(Ant,HWn,1,0,5,1);for(u=new Wb(n.a);u.a<u.c.c.length;)PZ(BB(n0(u),10),null);n.b.c=x8(Ant,HWn,1,0,5,1),a||HSn(t)}function QHn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;r=Gy(MD(mMn(t,(HXn(),Dgt)))),l=4,c=3,j=20/(k=BB(mMn(t,xpt),19).a),b=!1,s=0,u=DWn;do{for(a=1!=s,f=0!=s,E=0,v=0,y=(g=n.a).length;v<y;++v)(w=g[v]).f=null,Bzn(n,w,a,f,r),E+=e.Math.abs(w.a);do{o=U_n(n,t)}while(o);for(p=0,m=(d=n.a).length;p<m;++p)if(0!=(i=wU(w=d[p]).a))for(h=new Wb(w.e);h.a<h.c.c.length;)BB(n0(h),10).n.b+=i;0==s||1==s?--l<=0&&(E<u||-l>k)?(s=2,u=DWn):0==s?(s=1,u=E):(s=0,u=E):(b=E>=u||u-E<j,u=E,b&&--c)}while(!(b&&c<=0))}function YHn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w;for(w=new xp,c=n.a.ec().Kc();c.Ob();)VW(w,i=BB(c.Pb(),168),e.Je(i));for(yX(n),m$(a=n?new t_(n):HB(n.a.ec().Kc()),new Ew(w)),u=S4(a),o=new C$(t),jCn((b=new xp).f,t,o);0!=u.a.gc();){for(s=null,h=null,f=null,r=u.a.ec().Kc();r.Ob();)if(i=BB(r.Pb(),168),Gy(MD(qI(AY(w.f,i))))<=RQn){if(hU(b,i.a)&&!hU(b,i.b)){h=i.b,f=i.a,s=i;break}if(hU(b,i.b)&&!hU(b,i.a)){h=i.a,f=i.b,s=i;break}}if(!s)break;l=new C$(h),WB(BB(qI(AY(b.f,f)),221).a,l),jCn(b.f,h,l),u.a.Bc(s)}return o}function JHn(n,t,e){var i,r,c,a,u,o,s,h;for(OTn(e,"Depth-first cycle removal",1),o=(s=t.a).c.length,n.c=new Np,n.d=x8($Nt,ZYn,25,o,16,1),n.a=x8($Nt,ZYn,25,o,16,1),n.b=new Np,c=0,u=new Wb(s);u.a<u.c.c.length;)(a=BB(n0(u),10)).p=c,h3(fbn(a))&&WB(n.c,a),++c;for(h=new Wb(n.c);h.a<h.c.c.length;)GPn(n,BB(n0(h),10));for(r=0;r<o;r++)n.d[r]||(l1(r,s.c.length),GPn(n,BB(s.c[r],10)));for(i=new Wb(n.b);i.a<i.c.c.length;)tBn(BB(n0(i),17),!0),hon(t,(hWn(),qft),(hN(),!0));n.c=null,n.d=null,n.a=null,n.b=null,HSn(e)}function ZHn(n,t){var e,i,r,c,a,u,o;for(n.a.c=x8(Ant,HWn,1,0,5,1),i=spn(t.b,0);i.b!=i.d.c;)0==(e=BB(b3(i),86)).b.b&&(hon(e,(qqn(),dkt),(hN(),!0)),WB(n.a,e));switch(n.a.c.length){case 0:hon(r=new csn(0,t,"DUMMY_ROOT"),(qqn(),dkt),(hN(),!0)),hon(r,ekt,!0),DH(t.b,r);break;case 1:break;default:for(c=new csn(0,t,"SUPER_ROOT"),u=new Wb(n.a);u.a<u.c.c.length;)hon(o=new UQ(c,a=BB(n0(u),86)),(qqn(),ekt),(hN(),!0)),DH(c.a.a,o),DH(c.d,o),DH(a.b,o),hon(a,dkt,!1);hon(c,(qqn(),dkt),(hN(),!0)),hon(c,ekt,!0),DH(t.b,c)}}function nqn(n,t){var i,r,c,a,u,o;return jDn(),a=t.c-(n.c+n.b),c=n.c-(t.c+t.b),u=n.d-(t.d+t.a),i=t.d-(n.d+n.a),r=e.Math.max(c,a),o=e.Math.max(u,i),h$(),rin(A3n),(e.Math.abs(r)<=A3n||0==r||isNaN(r)&&isNaN(0)?0:r<0?-1:r>0?1:zO(isNaN(r),isNaN(0)))>=0^(rin(A3n),(e.Math.abs(o)<=A3n||0==o||isNaN(o)&&isNaN(0)?0:o<0?-1:o>0?1:zO(isNaN(o),isNaN(0)))>=0)?e.Math.max(o,r):(rin(A3n),(e.Math.abs(r)<=A3n||0==r||isNaN(r)&&isNaN(0)?0:r<0?-1:r>0?1:zO(isNaN(r),isNaN(0)))>0?e.Math.sqrt(o*o+r*r):-e.Math.sqrt(o*o+r*r))}function tqn(n,t){var e,i,r,c,a;if(t)if(!n.a&&(n.a=new _v),2!=n.e)if(1!=t.e)0!=(a=n.a.a.c.length)?0!=(c=BB(bW(n.a,a-1),117)).e&&10!=c.e||0!=t.e&&10!=t.e?Cv(n.a,t):(0==t.e||t.bm().length,0==c.e?(e=new Pk,(i=c._l())>=BQn?cO(e,Xln(i)):NX(e,i&QVn),c=new vJ(10,null,0),kU(n.a,c,a-1)):(c.bm().length,cO(e=new Pk,c.bm())),0==t.e?(i=t._l())>=BQn?cO(e,Xln(i)):NX(e,i&QVn):cO(e,t.bm()),BB(c,521).b=e.a):Cv(n.a,t);else for(r=0;r<t.em();r++)tqn(n,t.am(r));else Cv(n.a,t)}function eqn(n){var t,e,i,r,c;return null!=n.g?n.g:n.a<32?(n.g=DUn(fan(n.f),CJ(n.e)),n.g):(r=qXn((!n.c&&(n.c=yhn(n.f)),n.c),0),0==n.e?r:(t=(!n.c&&(n.c=yhn(n.f)),n.c).e<0?2:1,e=r.length,i=-n.e+e-t,(c=new Ck).a+=""+r,n.e>0&&i>=-6?i>=0?kZ(c,e-CJ(n.e),String.fromCharCode(46)):(c.a=fx(c.a,0,t-1)+"0."+nO(c.a,t-1),kZ(c,t+1,Bdn(qtt,0,-CJ(i)-1))):(e-t>=1&&(kZ(c,t,String.fromCharCode(46)),++e),kZ(c,e,String.fromCharCode(69)),i>0&&kZ(c,++e,String.fromCharCode(43)),kZ(c,++e,""+vz(fan(i)))),n.g=c.a,n.g))}function iqn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(!e.dc()){for(a=0,h=0,l=BB((i=e.Kc()).Pb(),19).a;a<t.f;){if(a==l&&(h=0,l=i.Ob()?BB(i.Pb(),19).a:t.f+1),a!=h)for(b=BB(xq(n.b,a),29),f=BB(xq(n.b,h),29),s=new Wb(a0(b.a));s.a<s.c.c.length;)if(Qyn(o=BB(n0(s),10),f.a.c.length,f),0==h)for(c=new Wb(a0(fbn(o)));c.a<c.c.c.length;)tBn(r=BB(n0(c),17),!0),hon(n,(hWn(),qft),(hN(),!0)),iGn(n,r,1);++h,++a}for(u=new M2(n.b,0);u.b<u.d.gc();)Px(u.b<u.d.gc()),0==BB(u.d.Xb(u.c=u.b++),29).a.c.length&&fW(u)}}function rqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(h=(a=t.b).o,o=a.d,i=Gy(MD(gpn(a,(HXn(),ypt)))),r=Gy(MD(gpn(a,jpt))),s=Gy(MD(gpn(a,$pt))),rH(u=new fm,o.d,o.c,o.a,o.b),l=MRn(t,i,r,s),p=new Wb(t.d);p.a<p.c.c.length;){for(w=(g=BB(n0(p),101)).f.a.ec().Kc();w.Ob();)c=(b=BB(w.Pb(),409)).a,f=ETn(b),v=new km,bTn(b,b.c,l,v),FMn(b,f,l,v),bTn(b,b.d,l,v),e=v,e=n.Uf(b,f,e),yQ(c.a),Frn(c.a,e),JT(new Rq(null,new w1(e,16)),new wP(h,u));(d=g.i)&&(aTn(g,d,l,r),pgn(h,u,m=new wA(d.g)),UR(m,d.j),pgn(h,u,m))}rH(o,u.d,u.c,u.a,u.b)}function cqn(n,t,e){var i,r,c;if((r=BB(mMn(t,(HXn(),Pdt)),275))!=(JMn(),cft)){switch(OTn(e,"Horizontal Compaction",1),n.a=t,Vk(i=new yOn(((c=new I7).d=t,c.c=BB(mMn(c.d,Zdt),218),UDn(c),SGn(c),sRn(c),c.a)),n.b),1===BB(mMn(t,Sdt),422).g?Wk(i,new grn(n.a)):Wk(i,(CQ(),fit)),r.g){case 1:C$n(i);break;case 2:C$n(Tzn(i,(Ffn(),FPt)));break;case 3:C$n(Uk(Tzn(C$n(i),(Ffn(),FPt)),new gr));break;case 4:C$n(Uk(Tzn(C$n(i),(Ffn(),FPt)),new kd(c)));break;case 5:C$n(Xk(i,wst))}Tzn(i,(Ffn(),_Pt)),i.e=!0,Lzn(c),HSn(e)}}function aqn(n,t,e,i,r,c,a,u){var o,s,h,f;switch(o=u6(Pun(Gk(FEt,1),HWn,220,0,[t,e,i,r])),f=null,n.b.g){case 1:f=u6(Pun(Gk(tEt,1),HWn,526,0,[new Ja,new Qa,new Ya]));break;case 0:f=u6(Pun(Gk(tEt,1),HWn,526,0,[new Ya,new Qa,new Ja]));break;case 2:f=u6(Pun(Gk(tEt,1),HWn,526,0,[new Qa,new Ja,new Ya]))}for(h=new Wb(f);h.a<h.c.c.length;)s=BB(n0(h),526),o.c.length>1&&(o=s.mg(o,n.a,u));return 1==o.c.length?BB(xq(o,o.c.length-1),220):2==o.c.length?FHn((l1(0,o.c.length),BB(o.c[0],220)),(l1(1,o.c.length),BB(o.c[1],220)),a,c):null}function uqn(n){var t,i,r,c,a,u;for(Otn(n.a,new nt),i=new Wb(n.a);i.a<i.c.c.length;)t=BB(n0(i),221),r=XR(B$(BB(n.b,65).c),BB(t.b,65).c),ect?(u=BB(n.b,65).b,a=BB(t.b,65).b,e.Math.abs(r.a)>=e.Math.abs(r.b)?(r.b=0,a.d+a.a>u.d&&a.d<u.d+u.a&&NH(r,e.Math.max(u.c-(a.c+a.b),a.c-(u.c+u.b)))):(r.a=0,a.c+a.b>u.c&&a.c<u.c+u.b&&NH(r,e.Math.max(u.d-(a.d+a.a),a.d-(u.d+u.a))))):NH(r,TFn(BB(n.b,65),BB(t.b,65))),c=e.Math.sqrt(r.a*r.a+r.b*r.b),NH(r,c=HEn(Wrt,t,c,r)),LG(BB(t.b,65),r),Otn(t.a,new Aw(r)),BB(Wrt.b,65),K8(Wrt,Vrt,t)}function oqn(n){var t,i,r,c,a,u,o,s,f,l,b,w;for(n.f=new Fv,o=0,r=0,c=new Wb(n.e.b);c.a<c.c.c.length;)for(u=new Wb(BB(n0(c),29).a);u.a<u.c.c.length;){for((a=BB(n0(u),10)).p=o++,i=new oz(ZL(lbn(a).a.Kc(),new h));dAn(i);)BB(U5(i),17).p=r++;for(t=AHn(a),l=new Wb(a.j);l.a<l.c.c.length;)f=BB(n0(l),11),t&&(w=f.a.b)!=e.Math.floor(w)&&(s=w-j2(fan(e.Math.round(w))),f.a.b-=s),(b=f.n.b+f.a.b)!=e.Math.floor(b)&&(s=b-j2(fan(e.Math.round(b))),f.n.b-=s)}n.g=o,n.b=r,n.i=x8(eyt,HWn,401,o,0,1),n.c=x8(Jmt,HWn,649,r,0,1),n.d.a.$b()}function sqn(n){var t,e,i,r,c,a,u,o,s;if(n.ej())if(o=n.fj(),n.i>0){if(t=new DI(n.i,n.g),c=(e=n.i)<100?null:new Fj(e),n.ij())for(i=0;i<n.i;++i)a=n.g[i],c=n.kj(a,c);if(a6(n),r=1==e?n.Zi(4,Wtn(t,0),null,0,o):n.Zi(6,t,null,-1,o),n.bj()){for(i=new ax(t);i.e!=i.i.gc();)c=n.dj(jpn(i),c);c?(c.Ei(r),c.Fi()):n.$i(r)}else c?(c.Ei(r),c.Fi()):n.$i(r)}else a6(n),n.$i(n.Zi(6,(SQ(),set),null,-1,o));else if(n.bj())if(n.i>0){for(u=n.g,s=n.i,a6(n),c=s<100?null:new Fj(s),i=0;i<s;++i)a=u[i],c=n.dj(a,c);c&&c.Fi()}else a6(n);else a6(n)}function hqn(n,t,i){var r,c,a,u,o,s,h,f,l;for(_an(this),i==(dJ(),Lyt)?TU(this.r,n):TU(this.w,n),f=RQn,h=KQn,u=t.a.ec().Kc();u.Ob();)c=BB(u.Pb(),46),o=BB(c.a,455),(s=(r=BB(c.b,17)).c)==n&&(s=r.d),TU(o==Lyt?this.r:this.w,s),l=(kUn(),yIt).Hc(s.j)?Gy(MD(mMn(s,(hWn(),Llt)))):Aon(Pun(Gk(PMt,1),sVn,8,0,[s.i.n,s.n,s.a])).b,f=e.Math.min(f,l),h=e.Math.max(h,l);for(XMn(this,(kUn(),yIt).Hc(n.j)?Gy(MD(mMn(n,(hWn(),Llt)))):Aon(Pun(Gk(PMt,1),sVn,8,0,[n.i.n,n.n,n.a])).b,f,h),a=t.a.ec().Kc();a.Ob();)c=BB(a.Pb(),46),tPn(this,BB(c.b,17));this.o=!1}function fqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;return e=8191&n.l,i=n.l>>13|(15&n.m)<<9,r=n.m>>4&8191,c=n.m>>17|(255&n.h)<<5,a=(1048320&n.h)>>8,g=i*(u=8191&t.l),p=r*u,v=c*u,m=a*u,0!=(o=t.l>>13|(15&t.m)<<9)&&(g+=e*o,p+=i*o,v+=r*o,m+=c*o),0!=(s=t.m>>4&8191)&&(p+=e*s,v+=i*s,m+=r*s),0!=(h=t.m>>17|(255&t.h)<<5)&&(v+=e*h,m+=i*h),0!=(f=(1048320&t.h)>>8)&&(m+=e*f),b=((d=e*u)>>22)+(g>>9)+((262143&p)<<4)+((31&v)<<17),w=(p>>18)+(v>>5)+((4095&m)<<8),w+=(b+=(l=(d&SQn)+((511&g)<<13))>>22)>>22,M$(l&=SQn,b&=SQn,w&=PQn)}function lqn(n){var t,i,r,c,a,u,o;if(0!=(o=BB(xq(n.j,0),11)).g.c.length&&0!=o.e.c.length)throw Hp(new Fy("Interactive layout does not support NORTH/SOUTH ports with incoming _and_ outgoing edges."));if(0!=o.g.c.length){for(a=RQn,i=new Wb(o.g);i.a<i.c.c.length;)t=BB(n0(i),17),r=BB(mMn(u=t.d.i,(HXn(),Cgt)),142),a=e.Math.min(a,u.n.a-r.b);return new qf(yX(a))}if(0!=o.e.c.length){for(c=KQn,i=new Wb(o.e);i.a<i.c.c.length;)t=BB(n0(i),17),r=BB(mMn(u=t.c.i,(HXn(),Cgt)),142),c=e.Math.max(c,u.n.a+u.o.a+r.c);return new qf(yX(c))}return iy(),iy(),Ont}function bqn(n,t){var e,i,r,c,a,u;if(n.Fk()){if(n.i>4){if(!n.wj(t))return!1;if(n.rk()){if(u=(e=(i=BB(t,49)).Ug())==n.e&&(n.Dk()?i.Og(i.Vg(),n.zk())==n.Ak():-1-i.Vg()==n.aj()),n.Ek()&&!u&&!e&&i.Zg())for(r=0;r<n.i;++r)if(GI(n.Gk(BB(n.g[r],56)))===GI(t))return!0;return u}if(n.Dk()&&!n.Ck()){if(GI(c=BB(t,56).ah(Cvn(BB(n.ak(),18))))===GI(n.e))return!0;if(null==c||!BB(c,56).kh())return!1}}if(a=Sjn(n,t),n.Ek()&&!a)for(r=0;r<n.i;++r)if(GI(i=n.Gk(BB(n.g[r],56)))===GI(t))return!0;return a}return Sjn(n,t)}function wqn(n,t){var e,i,r,c,a,u,o,s,h,f,l;for(h=new Np,l=new Rv,a=t.b,r=0;r<a.c.length;r++){for(s=(l1(r,a.c.length),BB(a.c[r],29)).a,h.c=x8(Ant,HWn,1,0,5,1),c=0;c<s.c.length;c++)(u=n.a[r][c]).p=c,u.k==(uSn(),Iut)&&(h.c[h.c.length]=u),c5(BB(xq(t.b,r),29).a,c,u),u.j.c=x8(Ant,HWn,1,0,5,1),gun(u.j,BB(BB(xq(n.b,r),15).Xb(c),14)),LK(BB(mMn(u,(HXn(),ept)),98))||hon(u,ept,(QEn(),UCt));for(i=new Wb(h);i.a<i.c.c.length;)f=QRn(e=BB(n0(i),10)),l.a.zc(f,l),l.a.zc(e,l)}for(o=l.a.ec().Kc();o.Ob();)u=BB(o.Pb(),10),SQ(),m$(u.j,(zsn(),sst)),u.i=!0,eIn(u)}function dqn(n,t){var e,i,r,c,a,u,o,s,h,f;if(h=BB(mMn(n,(hWn(),Qft)),61),i=BB(xq(n.j,0),11),h==(kUn(),sIt)?qCn(i,SIt):h==SIt&&qCn(i,sIt),BB(mMn(t,(HXn(),Fgt)),174).Hc((mdn(),_It))){if(o=Gy(MD(mMn(n,Cpt))),s=Gy(MD(mMn(n,Ipt))),a=Gy(MD(mMn(n,Spt))),(u=BB(mMn(t,cpt),21)).Hc((lIn(),eIt)))for(e=s,f=n.o.a/2-i.n.a,c=new Wb(i.f);c.a<c.c.c.length;)(r=BB(n0(c),70)).n.b=e,r.n.a=f-r.o.a/2,e+=r.o.b+a;else if(u.Hc(rIt))for(c=new Wb(i.f);c.a<c.c.c.length;)(r=BB(n0(c),70)).n.a=o+n.o.a-i.n.a;f0(new Pw((gM(),new HV(t,!1,!1,new Ft))),new __(null,n,!1))}}function gqn(n,t){var i,r,c,a,u,o,s;if(0!=t.c.length){for(SQ(),yG(t.c,t.c.length,null),r=BB(n0(c=new Wb(t)),145);c.a<c.c.c.length;)i=BB(n0(c),145),!aen(r.e.c,i.e.c)||Kdn(BD(r.e).b,i.e.d)||Kdn(BD(i.e).b,r.e.d)?(eFn(n,r),r=i):(gun(r.k,i.k),gun(r.b,i.b),gun(r.c,i.c),Frn(r.i,i.i),gun(r.d,i.d),gun(r.j,i.j),a=e.Math.min(r.e.c,i.e.c),u=e.Math.min(r.e.d,i.e.d),o=e.Math.max(r.e.c+r.e.b,i.e.c+i.e.b)-a,s=e.Math.max(r.e.d+r.e.a,i.e.d+i.e.a)-u,xH(r.e,a,u,o,s),t0(r.f,i.f),!r.a&&(r.a=i.a),gun(r.g,i.g),WB(r.g,i));eFn(n,r)}}function pqn(n,t,e,i){var r,c,a,u,o,s;if((u=n.j)==(kUn(),PIt)&&t!=(QEn(),QCt)&&t!=(QEn(),YCt)&&(qCn(n,u=z_n(n,e)),!(n.q?n.q:(SQ(),SQ(),het))._b((HXn(),tpt))&&u!=PIt&&(0!=n.n.a||0!=n.n.b)&&hon(n,tpt,jkn(n,u))),t==(QEn(),WCt)){switch(s=0,u.g){case 1:case 3:(c=n.i.o.a)>0&&(s=n.n.a/c);break;case 2:case 4:(r=n.i.o.b)>0&&(s=n.n.b/r)}hon(n,(hWn(),Tlt),s)}if(o=n.o,a=n.a,i)a.a=i.a,a.b=i.b,n.d=!0;else if(t!=QCt&&t!=YCt&&u!=PIt)switch(u.g){case 1:a.a=o.a/2;break;case 2:a.a=o.a,a.b=o.b/2;break;case 3:a.a=o.a/2,a.b=o.b;break;case 4:a.b=o.b/2}else a.a=o.a/2,a.b=o.b/2}function vqn(n){var t,e,i,r,c,a,u,o,s,h;if(n.ej())if(h=n.Vi(),o=n.fj(),h>0)if(t=new jcn(n.Gi()),c=(e=h)<100?null:new Fj(e),JD(n,e,t.g),r=1==e?n.Zi(4,Wtn(t,0),null,0,o):n.Zi(6,t,null,-1,o),n.bj()){for(i=new AL(t);i.e!=i.i.gc();)c=n.dj(kpn(i),c);c?(c.Ei(r),c.Fi()):n.$i(r)}else c?(c.Ei(r),c.Fi()):n.$i(r);else JD(n,n.Vi(),n.Wi()),n.$i(n.Zi(6,(SQ(),set),null,-1,o));else if(n.bj())if((h=n.Vi())>0){for(u=n.Wi(),s=h,JD(n,h,u),c=s<100?null:new Fj(s),i=0;i<s;++i)a=u[i],c=n.dj(a,c);c&&c.Fi()}else JD(n,n.Vi(),n.Wi());else JD(n,n.Vi(),n.Wi())}function mqn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;for(u=new Wb(t);u.a<u.c.c.length;)(c=BB(n0(u),233)).e=null,c.c=0;for(o=null,a=new Wb(t);a.a<a.c.c.length;)if(f=(c=BB(n0(a),233)).d[0],!e||f.k==(uSn(),Cut)){for(b=BB(mMn(f,(hWn(),clt)),15).Kc();b.Ob();)l=BB(b.Pb(),10),e&&l.k!=(uSn(),Cut)||((!c.e&&(c.e=new Np),c.e).Fc(n.b[l.c.p][l.p]),++n.b[l.c.p][l.p].c);if(!e&&f.k==(uSn(),Cut)){if(o)for(h=BB(h6(n.d,o),21).Kc();h.Ob();)for(s=BB(h.Pb(),10),r=BB(h6(n.d,f),21).Kc();r.Ob();)i=BB(r.Pb(),10),UB(n.b[s.c.p][s.p]).Fc(n.b[i.c.p][i.p]),++n.b[i.c.p][i.p].c;o=f}}}function yqn(n,t){var e,i,r,c,a,u,o;for(e=0,o=new Np,c=new Wb(t);c.a<c.c.c.length;){switch(r=BB(n0(c),11),nhn(n.b,n.d[r.p]),o.c=x8(Ant,HWn,1,0,5,1),r.i.k.g){case 0:Otn(BB(mMn(r,(hWn(),Elt)),10).j,new Zd(o));break;case 1:S$(Qon(AV(new Rq(null,new w1(r.i.j,16)),new ng(r))),new tg(o));break;case 3:WB(o,new rI(BB(mMn(r,(hWn(),dlt)),11),iln(r.e.c.length+r.g.c.length)))}for(u=new Wb(o);u.a<u.c.c.length;)a=BB(n0(u),46),(i=ME(n,BB(a.a,11)))>n.d[r.p]&&(e+=n5(n.b,i)*BB(a.b,19).a,d3(n.a,iln(i)));for(;!Wy(n.a);)Mnn(n.b,BB(dU(n.a),19).a)}return e}function kqn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w;for((f=new wA(BB(ZAn(n,(SMn(),HMt)),8))).a=e.Math.max(f.a-i.b-i.c,0),f.b=e.Math.max(f.b-i.d-i.a,0),(null==(c=MD(ZAn(n,DMt)))||(kW(c),c<=0))&&(c=1.3),u=new Np,l=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));l.e!=l.i.gc();)a=new zx(BB(kpn(l),33)),u.c[u.c.length]=a;switch(BB(ZAn(n,RMt),311).g){case 3:w=aFn(u,t,f.a,f.b,(s=r,kW(c),s));break;case 1:w=vBn(u,t,f.a,f.b,(h=r,kW(c),h));break;default:w=Mqn(u,t,f.a,f.b,(o=r,kW(c),o))}KUn(n,(b=yXn(new Gtn(w),t,i,f.a,f.b,r,(kW(c),c))).a,b.b,!1,!0)}function jqn(n,t){var e,i,r,c;c=new t_((e=t.b).j),r=0,(i=e.j).c=x8(Ant,HWn,1,0,5,1),eX(BB(gan(n.b,(kUn(),sIt),(Crn(),Rst)),15),e),r=Jmn(c,r,new xr,i),eX(BB(gan(n.b,sIt,Dst),15),e),r=Jmn(c,r,new Nr,i),eX(BB(gan(n.b,sIt,xst),15),e),eX(BB(gan(n.b,oIt,Rst),15),e),eX(BB(gan(n.b,oIt,Dst),15),e),r=Jmn(c,r,new Dr,i),eX(BB(gan(n.b,oIt,xst),15),e),eX(BB(gan(n.b,SIt,Rst),15),e),r=Jmn(c,r,new Rr,i),eX(BB(gan(n.b,SIt,Dst),15),e),r=Jmn(c,r,new Kr,i),eX(BB(gan(n.b,SIt,xst),15),e),eX(BB(gan(n.b,CIt,Rst),15),e),r=Jmn(c,r,new Qr,i),eX(BB(gan(n.b,CIt,Dst),15),e),eX(BB(gan(n.b,CIt,xst),15),e)}function Eqn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(OTn(t,"Layer size calculation",1),f=RQn,h=KQn,c=!1,o=new Wb(n.b);o.a<o.c.c.length;)if((s=(u=BB(n0(o),29)).c).a=0,s.b=0,0!=u.a.c.length){for(c=!0,b=new Wb(u.a);b.a<b.c.c.length;)d=(l=BB(n0(b),10)).o,w=l.d,s.a=e.Math.max(s.a,d.a+w.b+w.c);g=(r=BB(xq(u.a,0),10)).n.b-r.d.d,r.k==(uSn(),Mut)&&(g-=BB(mMn(n,(HXn(),Lpt)),142).d),i=(a=BB(xq(u.a,u.a.c.length-1),10)).n.b+a.o.b+a.d.a,a.k==Mut&&(i+=BB(mMn(n,(HXn(),Lpt)),142).a),s.b=i-g,f=e.Math.min(f,g),h=e.Math.max(h,i)}c||(f=0,h=0),n.f.b=h-f,n.c.b-=f,HSn(t)}function Tqn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;for(c=0,a=0,s=new Wb(n.a);s.a<s.c.c.length;)u=BB(n0(s),10),c=e.Math.max(c,u.d.b),a=e.Math.max(a,u.d.c);for(o=new Wb(n.a);o.a<o.c.c.length;){switch(u=BB(n0(o),10),BB(mMn(u,(HXn(),kdt)),248).g){case 1:w=0;break;case 2:w=1;break;case 5:w=.5;break;default:for(i=0,f=0,b=new Wb(u.j);b.a<b.c.c.length;)0==(l=BB(n0(b),11)).e.c.length||++i,0==l.g.c.length||++f;w=i+f==0?.5:f/(i+f)}g=n.c,h=u.o.a,p=(g.a-h)*w,w>.5?p-=2*a*(w-.5):w<.5&&(p+=2*c*(.5-w)),p<(r=u.d.b)&&(p=r),d=u.d.c,p>g.a-d-h&&(p=g.a-d-h),u.n.a=t+p}}function Mqn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b;for(u=x8(xNt,qQn,25,n.c.length,15,1),ikn(l=new Xz(new Uu),n),s=0,b=new Np;0!=l.b.c.length;)if(a=BB(0==l.b.c.length?null:xq(l.b,0),157),s>1&&iG(a)*eG(a)/2>u[0]){for(c=0;c<b.c.length-1&&iG(a)*eG(a)/2>u[c];)++c;f=new Gtn(new s1(b,0,c+1)),h=iG(a)/eG(a),o=yXn(f,t,new bm,e,i,r,h),UR(kO(f.e),o),F8(eMn(l,f)),ikn(l,new s1(b,c+1,b.c.length)),b.c=x8(Ant,HWn,1,0,5,1),s=0,jG(u,u.length,0)}else null!=(0==l.b.c.length?null:xq(l.b,0))&&hrn(l,0),s>0&&(u[s]=u[s-1]),u[s]+=iG(a)*eG(a),++s,b.c[b.c.length]=a;return b}function Sqn(n){var t,e,i;if((e=BB(mMn(n,(HXn(),kgt)),163))==(Tbn(),Flt)){for(t=new oz(ZL(fbn(n).a.Kc(),new h));dAn(t);)if(!X5(BB(U5(t),17)))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to FIRST_SEPARATE, but has at least one incoming edge. FIRST_SEPARATE nodes must not have incoming edges."))}else if(e==Hlt)for(i=new oz(ZL(lbn(n).a.Kc(),new h));dAn(i);)if(!X5(BB(U5(i),17)))throw Hp(new rk(P1n+gyn(n)+"' has its layer constraint set to LAST_SEPARATE, but has at least one outgoing edge. LAST_SEPARATE nodes must not have outgoing edges."))}function Pqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;for(OTn(t,"Label dummy removal",1),i=Gy(MD(mMn(n,(HXn(),jpt)))),r=Gy(MD(mMn(n,Spt))),o=BB(mMn(n,Udt),103),u=new Wb(n.b);u.a<u.c.c.length;)for(h=new M2(BB(n0(u),29).a,0);h.b<h.d.gc();)Px(h.b<h.d.gc()),(s=BB(h.d.Xb(h.c=h.b++),10)).k==(uSn(),Sut)&&(f=BB(mMn(s,(hWn(),dlt)),17),b=Gy(MD(mMn(f,agt))),a=GI(mMn(s,ult))===GI((Xyn(),ECt)),e=new wA(s.n),a&&(e.b+=b+i),c=new xC(s.o.a,s.o.b-b-i),l=BB(mMn(s,Plt),15),o==(Ffn(),HPt)||o==KPt?ADn(l,e,r,c,a,o):qhn(l,e,r,c),gun(f.b,l),rGn(s,GI(mMn(n,Zdt))===GI((Mbn(),YPt))),fW(h));HSn(t)}function Cqn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y;for(u=new Np,r=new Wb(t.a);r.a<r.c.c.length;)for(a=new Wb(BB(n0(r),10).j);a.a<a.c.c.length;){for(s=null,m=0,y=(v=Z0((c=BB(n0(a),11)).g)).length;m<y;++m)wan((p=v[m]).d.i,e)||((g=LHn(n,t,e,p,p.c,(ain(),qvt),s))!=s&&(u.c[u.c.length]=g),g.c&&(s=g));for(o=null,w=0,d=(b=Z0(c.e)).length;w<d;++w)wan((l=b[w]).c.i,e)||((g=LHn(n,t,e,l,l.d,(ain(),Hvt),o))!=o&&(u.c[u.c.length]=g),g.c&&(o=g))}for(f=new Wb(u);f.a<f.c.c.length;)h=BB(n0(f),441),-1!=E7(t.a,h.a,0)||WB(t.a,h.a),h.c&&(i.c[i.c.length]=h)}function Iqn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w;for(OTn(e,"Interactive cycle breaking",1),h=new Np,l=new Wb(t.a);l.a<l.c.c.length;)for((f=BB(n0(l),10)).p=1,b=Fjn(f).a,s=xwn(f,(ain(),qvt)).Kc();s.Ob();)for(c=new Wb(BB(s.Pb(),11).g);c.a<c.c.c.length;)(w=(i=BB(n0(c),17)).d.i)!=f&&Fjn(w).a<b&&(h.c[h.c.length]=i);for(a=new Wb(h);a.a<a.c.c.length;)tBn(i=BB(n0(a),17),!0);for(h.c=x8(Ant,HWn,1,0,5,1),o=new Wb(t.a);o.a<o.c.c.length;)(u=BB(n0(o),10)).p>0&&lPn(n,u,h);for(r=new Wb(h);r.a<r.c.c.length;)tBn(i=BB(n0(r),17),!0);h.c=x8(Ant,HWn,1,0,5,1),HSn(e)}function Oqn(n,t){var e,i,r,c,a,u,o,s,h;return s="",0==t.length?n.de(XVn,zVn,-1,-1):(mK((h=RMn(t)).substr(0,3),"at ")&&(h=h.substr(3)),-1==(a=(h=h.replace(/\[.*?\]/g,"")).indexOf("("))?-1==(a=h.indexOf("@"))?(s=h,h=""):(s=RMn(h.substr(a+1)),h=RMn(h.substr(0,a))):(e=h.indexOf(")",a),s=h.substr(a+1,e-(a+1)),h=RMn(h.substr(0,a))),-1!=(a=GO(h,YTn(46)))&&(h=h.substr(a+1)),(0==h.length||mK(h,"Anonymous function"))&&(h=zVn),u=mN(s,YTn(58)),r=MK(s,YTn(58),u-1),o=-1,i=-1,c=XVn,-1!=u&&-1!=r&&(c=s.substr(0,r),o=hx(s.substr(r+1,u-(r+1))),i=hx(s.substr(u+1))),n.de(c,h,o,i))}function Aqn(n,t,e){var i,r,c,a,u,o;if(0==t.l&&0==t.m&&0==t.h)throw Hp(new Oy("divide by zero"));if(0==n.l&&0==n.m&&0==n.h)return e&&(ltt=M$(0,0,0)),M$(0,0,0);if(t.h==CQn&&0==t.m&&0==t.l)return Fbn(n,e);if(o=!1,t.h>>19!=0&&(t=aon(t),o=!o),a=OLn(t),c=!1,r=!1,i=!1,n.h==CQn&&0==n.m&&0==n.l){if(r=!0,c=!0,-1!=a)return u=jAn(n,a),o&&Oon(u),e&&(ltt=M$(0,0,0)),u;n=WO((X7(),btt)),i=!0,o=!o}else n.h>>19!=0&&(c=!0,n=aon(n),i=!0,o=!o);return-1!=a?Bon(n,a,o,c,e):Kkn(n,t)<0?(e&&(ltt=c?aon(n):M$(n.l,n.m,n.h)),M$(0,0,0)):h_n(i?n:M$(n.l,n.m,n.h),t,o,c,r,e)}function $qn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;if(n.e&&n.c.c<n.f)throw Hp(new Fy("Expected "+n.f+" phases to be configured; only found "+n.c.c));for(h=BB(Vj(n.g),9),b=sx(n.f),u=0,s=(c=h).length;u<s;++u)(f=BB(D7(n,(i=c[u]).g),246))?WB(b,BB(own(n,f),123)):b.c[b.c.length]=null;for(w=new B2,JT(AV($V(AV(new Rq(null,new w1(b,16)),new hu),new Eg(t)),new fu),new Tg(w)),Jcn(w,n.a),e=new Np,a=0,o=(r=h).length;a<o;++a)gun(e,Eun(n,JQ(BB(D7(w,(i=r[a]).g),20)))),(l=BB(xq(b,i.g),123))&&(e.c[e.c.length]=l);return gun(e,Eun(n,JQ(BB(D7(w,h[h.length-1].g+1),20)))),e}function Lqn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w;for(OTn(i,"Model order cycle breaking",1),n.a=0,n.b=0,l=new Np,h=t.a.c.length,s=new Wb(t.a);s.a<s.c.c.length;)Lx(o=BB(n0(s),10),(hWn(),wlt))&&(h=e.Math.max(h,BB(mMn(o,wlt),19).a+1));for(w=new Wb(t.a);w.a<w.c.c.length;)for(u=zPn(n,b=BB(n0(w),10),h),f=xwn(b,(ain(),qvt)).Kc();f.Ob();)for(a=new Wb(BB(f.Pb(),11).g);a.a<a.c.c.length;)zPn(n,(r=BB(n0(a),17)).d.i,h)<u&&(l.c[l.c.length]=r);for(c=new Wb(l);c.a<c.c.c.length;)tBn(r=BB(n0(c),17),!0),hon(t,(hWn(),qft),(hN(),!0));l.c=x8(Ant,HWn,1,0,5,1),HSn(i)}function Nqn(n,t){var e,i,r,c,a,u,o;if(!(n.g>t.f||t.g>n.f)){for(e=0,i=0,a=n.w.a.ec().Kc();a.Ob();)r=BB(a.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,t.g,t.f)&&++e;for(u=n.r.a.ec().Kc();u.Ob();)r=BB(u.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,t.g,t.f)&&--e;for(o=t.w.a.ec().Kc();o.Ob();)r=BB(o.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,n.g,n.f)&&++i;for(c=t.r.a.ec().Kc();c.Ob();)r=BB(c.Pb(),11),phn(Aon(Pun(Gk(PMt,1),sVn,8,0,[r.i.n,r.n,r.a])).b,n.g,n.f)&&--i;e<i?new S6(n,t,i-e):i<e?new S6(t,n,e-i):(new S6(t,n,0),new S6(n,t,0))}}function xqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(s=t.c,r=QA(n.e),f=kL(Bx(B$(VA(n.e)),n.d*n.a,n.c*n.b),-.5),e=r.a-f.a,i=r.b-f.b,e=(a=t.a).c-e,i=a.d-i,o=new Wb(s);o.a<o.c.c.length;){switch(b=e+(l=(u=BB(n0(o),395)).b).a,g=i+l.b,w=CJ(b/n.a),p=CJ(g/n.b),(c=u.a).g){case 0:Hpn(),h=Brt;break;case 1:Hpn(),h=Frt;break;case 2:Hpn(),h=Hrt;break;default:Hpn(),h=qrt}c.a?(v=CJ((g+u.c)/n.b),WB(n.f,new x_(h,iln(p),iln(v))),c==(qpn(),tct)?won(n,0,p,w,v):won(n,w,p,n.d-1,v)):(d=CJ((b+u.c)/n.a),WB(n.f,new x_(h,iln(w),iln(d))),c==(qpn(),Zrt)?won(n,w,0,d,p):won(n,w,p,d,n.c-1))}}function Dqn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y;for(l=new Np,c=new Np,d=null,u=t.Kc();u.Ob();)a=new Hd(BB(u.Pb(),19).a),c.c[c.c.length]=a,d&&(a.d=d,d.e=a),d=a;for(m=zFn(n),h=0;h<c.c.length;++h){for(b=null,g=D6((l1(0,c.c.length),BB(c.c[0],652))),i=null,r=RQn,f=1;f<n.b.c.length;++f)p=g?e.Math.abs(g.b-f):e.Math.abs(f-b.b)+1,(w=b?e.Math.abs(f-b.b):p+1)<p?(s=b,o=w):(s=g,o=p),y=Gy(MD(mMn(n,(HXn(),Hpt)))),(v=m[f]+e.Math.pow(o,y))<r&&(r=v,(i=s).c=f),g&&f==g.b&&(b=g,g=xz(g));i&&(WB(l,iln(i.c)),i.a=!0,vln(i))}return SQ(),yG(l.c,l.c.length,null),l}function Rqn(n){var t,e,i,r,c,a,u,o,s,h;for(t=new To,e=new To,s=mK(K9n,(r=N_n(n.b,_9n))?SD(cdn((!r.b&&(r.b=new Jx((gWn(),k$t),X$t,r)),r.b),F9n)):null),o=0;o<n.i;++o)cL(u=BB(n.g[o],170),99)?0!=((a=BB(u,18)).Bb&h6n)?(0==(a.Bb&hVn)||!s&&null==((c=N_n(a,_9n))?SD(cdn((!c.b&&(c.b=new Jx((gWn(),k$t),X$t,c)),c.b),n8n)):null))&&f9(t,a):(h=Cvn(a))&&0!=(h.Bb&h6n)||(0==(a.Bb&hVn)||!s&&null==((i=N_n(a,_9n))?SD(cdn((!i.b&&(i.b=new Jx((gWn(),k$t),X$t,i)),i.b),n8n)):null))&&f9(e,a):(ZM(),BB(u,66).Oj()&&(u.Jj()||(f9(t,u),f9(e,u))));chn(t),chn(e),n.a=BB(t.g,247),BB(e.g,247)}function Kqn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;for(o=xSn(t),BB(mMn(t,(HXn(),qdt)),314)!=(Oin(),hht)&&e5(o,new vt),e5(o,new Dw(BB(mMn(t,Rdt),292))),b=0,s=new Np,r=new bV(o);r.a!=r.b;)i=BB(_hn(r),37),$Gn(n.c,i),b+=(f=BB(mMn(i,(hWn(),Mlt)),15)).gc(),WB(s,new rI(i,f.Kc()));for(OTn(e,"Recursive hierarchical layout",b),l=BB(BB(xq(s,s.c.length-1),46).b,47);l.Ob();)for(u=new Wb(s);u.a<u.c.c.length;)for(a=BB(n0(u),46),f=BB(a.b,47),c=BB(a.a,37);f.Ob();){if(cL(h=BB(f.Pb(),51),507)){if(c.e)break;h.pf(c,mcn(e,1));break}h.pf(c,mcn(e,1))}HSn(e)}function _qn(n,t){var e,i,r,c,a,u,o,s;if(b1(u=t.length-1,t.length),93==(a=t.charCodeAt(u))){if((c=GO(t,YTn(91)))>=0)return r=dbn(n,t.substr(1,c-1)),YUn(n,t.substr(c+1,u-(c+1)),r)}else{if(e=-1,null==Ett&&(Ett=new RegExp("\\d")),Ett.test(String.fromCharCode(a))&&(e=MK(t,YTn(46),u-1))>=0){i=BB(V5(n,Ptn(n,t.substr(1,e-1)),!1),58),o=0;try{o=l_n(t.substr(e+1),_Vn,DWn)}catch(h){throw cL(h=lun(h),127)?Hp(new L7(h)):Hp(h)}if(o<i.gc())return cL(s=i.Xb(o),72)&&(s=BB(s,72).dd()),BB(s,56)}if(e<0)return BB(V5(n,Ptn(n,t.substr(1)),!1),56)}return null}function Fqn(n,t,e){var i,r,c,a,u,o,s;if(Awn(t,e)>=0)return e;switch(DW(B7(n,e))){case 2:if(mK("",Cfn(n,e.Hj()).ne())){if(o=m$n(n,t,u=jV(B7(n,e)),kV(B7(n,e))))return o;for(a=0,s=(r=jKn(n,t)).gc();a<s;++a)if(aNn(OU(B7(n,o=BB(r.Xb(a),170))),u))return o}return null;case 4:if(mK("",Cfn(n,e.Hj()).ne())){for(i=e;i;i=J1(B7(n,i)))if(o=y$n(n,t,jV(B7(n,i)),kV(B7(n,i))))return o;if(u=jV(B7(n,e)),mK(S7n,u))return mjn(n,t);for(a=0,s=(c=EKn(n,t)).gc();a<s;++a)if(aNn(OU(B7(n,o=BB(c.Xb(a),170))),u))return o}return null;default:return null}}function Bqn(n,t,e){var i,r,c,a,u,o,s,h;if(0==e.gc())return!1;if(ZM(),c=(u=BB(t,66).Oj())?e:new gtn(e.gc()),$xn(n.e,t)){if(t.hi())for(s=e.Kc();s.Ob();)UFn(n,t,o=s.Pb(),cL(t,99)&&0!=(BB(t,18).Bb&BQn))||(r=Z3(t,o),c.Hc(r)||c.Fc(r));else if(!u)for(s=e.Kc();s.Ob();)r=Z3(t,o=s.Pb()),c.Fc(r)}else{if(e.gc()>1)throw Hp(new _y(I7n));for(h=axn(n.e.Tg(),t),i=BB(n.g,119),a=0;a<n.i;++a)if(r=i[a],h.rl(r.ak())){if(e.Hc(u?r:r.dd()))return!1;for(s=e.Kc();s.Ob();)o=s.Pb(),BB(ovn(n,a,u?BB(o,72):Z3(t,o)),72);return!0}u||(r=Z3(t,e.Kc().Pb()),c.Fc(r))}return pX(n,c)}function Hqn(n,t){var i,r,c,a,u,o,s;for(s=new YT,o=new Kb(new Ob(n.c).a.vc().Kc());o.a.Ob();)c=BB(o.a.Pb(),42),0==(a=BB(c.dd(),458)).b&&r5(s,a,s.c.b,s.c);for(;0!=s.b;)for(null==(a=BB(0==s.b?null:(Px(0!=s.b),Atn(s,s.a.a)),458)).a&&(a.a=0),r=new Wb(a.d);r.a<r.c.c.length;)null==(i=BB(n0(r),654)).b.a?i.b.a=Gy(a.a)+i.a:t.o==(oZ(),ryt)?i.b.a=e.Math.min(Gy(i.b.a),Gy(a.a)+i.a):i.b.a=e.Math.max(Gy(i.b.a),Gy(a.a)+i.a),--i.b.b,0==i.b.b&&DH(s,i.b);for(u=new Kb(new Ob(n.c).a.vc().Kc());u.a.Ob();)c=BB(u.a.Pb(),42),a=BB(c.dd(),458),t.i[a.c.p]=a.a}function qqn(){qqn=O,skt=new up(OZn),new up(AZn),new iR("DEPTH",iln(0)),ikt=new iR("FAN",iln(0)),tkt=new iR(U3n,iln(0)),dkt=new iR("ROOT",(hN(),!1)),ckt=new iR("LEFTNEIGHBOR",null),bkt=new iR("RIGHTNEIGHBOR",null),akt=new iR("LEFTSIBLING",null),wkt=new iR("RIGHTSIBLING",null),ekt=new iR("DUMMY",!1),new iR("LEVEL",iln(0)),lkt=new iR("REMOVABLE_EDGES",new YT),gkt=new iR("XCOOR",iln(0)),pkt=new iR("YCOOR",iln(0)),ukt=new iR("LEVELHEIGHT",0),rkt=new iR("ID",""),hkt=new iR("POSITION",iln(0)),fkt=new iR("PRELIM",0),okt=new iR("MODIFIER",0),nkt=new up($Zn),Zyt=new up(LZn)}function Gqn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w;for(f=i+t.c.c.a,w=new Wb(t.j);w.a<w.c.c.length;){if(b=BB(n0(w),11),c=Aon(Pun(Gk(PMt,1),sVn,8,0,[b.i.n,b.n,b.a])),t.k==(uSn(),Iut)&&(o=BB(mMn(b,(hWn(),dlt)),11),c.a=Aon(Pun(Gk(PMt,1),sVn,8,0,[o.i.n,o.n,o.a])).a,t.n.a=c.a),u=new xC(0,c.b),b.j==(kUn(),oIt))u.a=f;else{if(b.j!=CIt)continue;u.a=i}if(!(e.Math.abs(c.a-u.a)<=r)||Nkn(t))for(a=b.g.c.length+b.e.c.length>1,h=new m6(b.b);y$(h.a)||y$(h.b);)l=(s=BB(y$(h.a)?n0(h.a):n0(h.b),17)).c==b?s.d:s.c,e.Math.abs(Aon(Pun(Gk(PMt,1),sVn,8,0,[l.i.n,l.n,l.a])).b-u.b)>1&&pxn(n,s,u,a,b)}}function zqn(n){var t,i,r,c,a,u;if(c=new M2(n.e,0),r=new M2(n.a,0),n.d)for(i=0;i<n.b;i++)Px(c.b<c.d.gc()),c.d.Xb(c.c=c.b++);else for(i=0;i<n.b-1;i++)Px(c.b<c.d.gc()),c.d.Xb(c.c=c.b++),fW(c);for(t=Gy((Px(c.b<c.d.gc()),MD(c.d.Xb(c.c=c.b++))));n.f-t>D3n;){for(a=t,u=0;e.Math.abs(t-a)<D3n;)++u,t=Gy((Px(c.b<c.d.gc()),MD(c.d.Xb(c.c=c.b++)))),Px(r.b<r.d.gc()),r.d.Xb(r.c=r.b++);u<n.b&&(Px(c.b>0),c.a.Xb(c.c=--c.b),DFn(n,n.b-u,a,r,c),Px(c.b<c.d.gc()),c.d.Xb(c.c=c.b++)),Px(r.b>0),r.a.Xb(r.c=--r.b)}if(!n.d)for(i=0;i<n.b-1;i++)Px(c.b<c.d.gc()),c.d.Xb(c.c=c.b++),fW(c);n.d=!0,n.c=!0}function Uqn(){Uqn=O,pLt=(cE(),gLt).b,yLt=BB(Wtn(QQ(gLt.b),0),34),vLt=BB(Wtn(QQ(gLt.b),1),34),mLt=BB(Wtn(QQ(gLt.b),2),34),OLt=gLt.bb,BB(Wtn(QQ(gLt.bb),0),34),BB(Wtn(QQ(gLt.bb),1),34),$Lt=gLt.fb,LLt=BB(Wtn(QQ(gLt.fb),0),34),BB(Wtn(QQ(gLt.fb),1),34),BB(Wtn(QQ(gLt.fb),2),18),xLt=gLt.qb,KLt=BB(Wtn(QQ(gLt.qb),0),34),BB(Wtn(QQ(gLt.qb),1),18),BB(Wtn(QQ(gLt.qb),2),18),DLt=BB(Wtn(QQ(gLt.qb),3),34),RLt=BB(Wtn(QQ(gLt.qb),4),34),FLt=BB(Wtn(QQ(gLt.qb),6),34),_Lt=BB(Wtn(QQ(gLt.qb),5),18),kLt=gLt.j,jLt=gLt.k,ELt=gLt.q,TLt=gLt.w,MLt=gLt.B,SLt=gLt.A,PLt=gLt.C,CLt=gLt.D,ILt=gLt._,ALt=gLt.cb,NLt=gLt.hb}function Xqn(n,t,i){var r,c,a,u,o,s,h,f,l;n.c=0,n.b=0,r=2*t.c.a.c.length+1;n:for(h=i.Kc();h.Ob();){if(l=0,u=(s=BB(h.Pb(),11)).j==(kUn(),sIt)||s.j==SIt){if(!(f=BB(mMn(s,(hWn(),Elt)),10)))continue;l+=iRn(n,r,s,f)}else{for(o=new Wb(s.g);o.a<o.c.c.length;){if((c=BB(n0(o),17).d).i.c==t.c){WB(n.a,s);continue n}l+=n.g[c.p]}for(a=new Wb(s.e);a.a<a.c.c.length;){if((c=BB(n0(a),17).c).i.c==t.c){WB(n.a,s);continue n}l-=n.g[c.p]}}s.e.c.length+s.g.c.length>0?(n.f[s.p]=l/(s.e.c.length+s.g.c.length),n.c=e.Math.min(n.c,n.f[s.p]),n.b=e.Math.max(n.b,n.f[s.p])):u&&(n.f[s.p]=l)}}function Wqn(n){n.b=null,n.bb=null,n.fb=null,n.qb=null,n.a=null,n.c=null,n.d=null,n.e=null,n.f=null,n.n=null,n.M=null,n.L=null,n.Q=null,n.R=null,n.K=null,n.db=null,n.eb=null,n.g=null,n.i=null,n.j=null,n.k=null,n.gb=null,n.o=null,n.p=null,n.q=null,n.r=null,n.$=null,n.ib=null,n.S=null,n.T=null,n.t=null,n.s=null,n.u=null,n.v=null,n.w=null,n.B=null,n.A=null,n.C=null,n.D=null,n.F=null,n.G=null,n.H=null,n.I=null,n.J=null,n.P=null,n.Z=null,n.U=null,n.V=null,n.W=null,n.X=null,n.Y=null,n._=null,n.ab=null,n.cb=null,n.hb=null,n.nb=null,n.lb=null,n.mb=null,n.ob=null,n.pb=null,n.jb=null,n.kb=null,n.N=!1,n.O=!1}function Vqn(n,t,e){var i,r;for(OTn(e,"Graph transformation ("+n.a+")",1),r=a0(t.a),i=new Wb(t.b);i.a<i.c.c.length;)gun(r,BB(n0(i),29).a);if(BB(mMn(t,(HXn(),Xdt)),419)==(_nn(),Sht))switch(BB(mMn(t,Udt),103).g){case 2:L2(t,r);break;case 3:bdn(t,r);break;case 4:n.a==(Srn(),qut)?(bdn(t,r),$2(t,r)):($2(t,r),bdn(t,r))}else if(n.a==(Srn(),qut))switch(BB(mMn(t,Udt),103).g){case 2:L2(t,r),$2(t,r);break;case 3:bdn(t,r),L2(t,r);break;case 4:L2(t,r),bdn(t,r)}else switch(BB(mMn(t,Udt),103).g){case 2:L2(t,r),$2(t,r);break;case 3:L2(t,r),bdn(t,r);break;case 4:bdn(t,r),L2(t,r)}HSn(e)}function Qqn(n,t,e){var i,r,c,a,u,o,s,f,l,b,w;for(o=new fA,s=new fA,b=new fA,w=new fA,u=Gy(MD(mMn(t,(HXn(),Opt)))),r=Gy(MD(mMn(t,ypt))),a=new Wb(e);a.a<a.c.c.length;)if(c=BB(n0(a),10),(f=BB(mMn(c,(hWn(),Qft)),61))==(kUn(),sIt))for(s.a.zc(c,s),i=new oz(ZL(fbn(c).a.Kc(),new h));dAn(i);)TU(o,BB(U5(i),17).c.i);else if(f==SIt)for(w.a.zc(c,w),i=new oz(ZL(fbn(c).a.Kc(),new h));dAn(i);)TU(b,BB(U5(i),17).c.i);0!=o.a.gc()&&(l=AGn(new fX(2,r),t,o,s,-u-t.c.b))>0&&(n.a=u+(l-1)*r,t.c.b+=n.a,t.f.b+=n.a),0!=b.a.gc()&&(l=AGn(new fX(1,r),t,b,w,t.f.b+u-t.c.b))>0&&(t.f.b+=u+(l-1)*r)}function Yqn(n,t){var e,i,r,c;c=n.F,null==t?(n.F=null,Dsn(n,null)):(n.F=(kW(t),t),-1!=(i=GO(t,YTn(60)))?(r=t.substr(0,i),-1==GO(t,YTn(46))&&!mK(r,$Wn)&&!mK(r,S9n)&&!mK(r,P9n)&&!mK(r,C9n)&&!mK(r,I9n)&&!mK(r,O9n)&&!mK(r,A9n)&&!mK(r,$9n)&&(r=L9n),-1!=(e=mN(t,YTn(62)))&&(r+=""+t.substr(e+1)),Dsn(n,r)):(r=t,-1==GO(t,YTn(46))&&(-1!=(i=GO(t,YTn(91)))&&(r=t.substr(0,i)),mK(r,$Wn)||mK(r,S9n)||mK(r,P9n)||mK(r,C9n)||mK(r,I9n)||mK(r,O9n)||mK(r,A9n)||mK(r,$9n)?r=t:(r=L9n,-1!=i&&(r+=""+t.substr(i)))),Dsn(n,r),r==t&&(n.F=n.D))),0!=(4&n.Db)&&0==(1&n.Db)&&ban(n,new nU(n,1,5,c,t))}function Jqn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;if(!((d=t.b.c.length)<3)){for(b=x8(ANt,hQn,25,d,15,1),f=0,h=new Wb(t.b);h.a<h.c.c.length;)s=BB(n0(h),29),b[f++]=s.a.c.length;for(l=new M2(t.b,2),i=1;i<d-1;i++)for(Px(l.b<l.d.gc()),w=new Wb((e=BB(l.d.Xb(l.c=l.b++),29)).a),c=0,u=0,o=0;o<b[i+1];o++)if(m=BB(n0(w),10),o==b[i+1]-1||YSn(n,m,i+1,i)){for(a=b[i]-1,YSn(n,m,i+1,i)&&(a=n.c.e[BB(BB(BB(xq(n.c.b,m.p),15).Xb(0),46).a,10).p]);u<=o;){if(!YSn(n,v=BB(xq(e.a,u),10),i+1,i))for(p=BB(xq(n.c.b,v.p),15).Kc();p.Ob();)g=BB(p.Pb(),46),((r=n.c.e[BB(g.a,10).p])<c||r>a)&&TU(n.b,BB(g.b,17));++u}c=a}}}function Zqn(n,t){var e;if(null==t||mK(t,zWn))return null;if(0==t.length&&n.k!=(PPn(),pMt))return null;switch(n.k.g){case 1:return mgn(t,a5n)?(hN(),vtt):mgn(t,u5n)?(hN(),ptt):null;case 2:try{return iln(l_n(t,_Vn,DWn))}catch(i){if(cL(i=lun(i),127))return null;throw Hp(i)}case 4:try{return bSn(t)}catch(i){if(cL(i=lun(i),127))return null;throw Hp(i)}case 3:return t;case 5:return rhn(n),HIn(n,t);case 6:return rhn(n),K$n(n,n.a,t);case 7:try{return(e=rAn(n)).Jf(t),e}catch(i){if(cL(i=lun(i),32))return null;throw Hp(i)}default:throw Hp(new Fy("Invalid type set for this layout option."))}}function nGn(n){var t,e,i,r,c,a,u;for(Dnn(),u=new Vv,e=new Wb(n);e.a<e.c.c.length;)t=BB(n0(e),140),(!u.b||t.c>=u.b.c)&&(u.b=t),(!u.c||t.c<=u.c.c)&&(u.d=u.c,u.c=t),(!u.e||t.d>=u.e.d)&&(u.e=t),(!u.f||t.d<=u.f.d)&&(u.f=t);return i=new Tpn((Aun(),Zat)),i2(n,out,new Jy(Pun(Gk(Jat,1),HWn,369,0,[i]))),a=new Tpn(eut),i2(n,uut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[a]))),r=new Tpn(nut),i2(n,aut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[r]))),c=new Tpn(tut),i2(n,cut,new Jy(Pun(Gk(Jat,1),HWn,369,0,[c]))),xLn(i.c,Zat),xLn(r.c,nut),xLn(c.c,tut),xLn(a.c,eut),u.a.c=x8(Ant,HWn,1,0,5,1),gun(u.a,i.c),gun(u.a,ean(r.c)),gun(u.a,c.c),gun(u.a,ean(a.c)),u}function tGn(n){var t;switch(n.d){case 1:if(n.hj())return-2!=n.o;break;case 2:if(n.hj())return-2==n.o;break;case 3:case 5:case 4:case 6:case 7:return n.o>-2;default:return!1}switch(t=n.gj(),n.p){case 0:return null!=t&&qy(TD(t))!=JI(n.k,0);case 1:return null!=t&&BB(t,217).a!=dG(n.k)<<24>>24;case 2:return null!=t&&BB(t,172).a!=(dG(n.k)&QVn);case 6:return null!=t&&JI(BB(t,162).a,n.k);case 5:return null!=t&&BB(t,19).a!=dG(n.k);case 7:return null!=t&&BB(t,184).a!=dG(n.k)<<16>>16;case 3:return null!=t&&Gy(MD(t))!=n.j;case 4:return null!=t&&BB(t,155).a!=n.j;default:return null==t?null!=n.n:!Nfn(t,n.n)}}function eGn(n,t,e){var i,r,c,a;return n.Fk()&&n.Ek()&&GI(a=Gz(n,BB(e,56)))!==GI(e)?(n.Oi(t),n.Ui(t,B9(n,t,a)),n.rk()&&(r=BB(e,49),c=n.Dk()?n.Bk()?r.ih(n.b,Cvn(BB(itn(jY(n.b),n.aj()),18)).n,BB(itn(jY(n.b),n.aj()).Yj(),26).Bj(),null):r.ih(n.b,Awn(r.Tg(),Cvn(BB(itn(jY(n.b),n.aj()),18))),null,null):r.ih(n.b,-1-n.aj(),null,null),!BB(a,49).eh()&&(i=BB(a,49),c=n.Dk()?n.Bk()?i.gh(n.b,Cvn(BB(itn(jY(n.b),n.aj()),18)).n,BB(itn(jY(n.b),n.aj()).Yj(),26).Bj(),c):i.gh(n.b,Awn(i.Tg(),Cvn(BB(itn(jY(n.b),n.aj()),18))),null,c):i.gh(n.b,-1-n.aj(),null,c)),c&&c.Fi()),mA(n.b)&&n.$i(n.Zi(9,e,a,t,!1)),a):e}function iGn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(f=Gy(MD(mMn(n,(HXn(),Ept)))),r=Gy(MD(mMn(n,Rpt))),hon(b=new Yu,Ept,f+r),v=(h=t).d,g=h.c.i,m=h.d.i,p=tA(g.c),y=tA(m.c),c=new Np,l=p;l<=y;l++)Bl(o=new $vn(n),(uSn(),Put)),hon(o,(hWn(),dlt),h),hon(o,ept,(QEn(),XCt)),hon(o,Mpt,b),w=BB(xq(n.b,l),29),l==p?Qyn(o,w.a.c.length-i,w):PZ(o,w),(k=Gy(MD(mMn(h,agt))))<0&&hon(h,agt,k=0),o.o.b=k,d=e.Math.floor(k/2),qCn(u=new CSn,(kUn(),CIt)),CZ(u,o),u.n.b=d,qCn(s=new CSn,oIt),CZ(s,o),s.n.b=d,MZ(h,u),qan(a=new wY,h),hon(a,vgt,null),SZ(a,s),MZ(a,v),zkn(o,h,a),c.c[c.c.length]=a,h=a;return c}function rGn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(u=BB(DSn(n,(kUn(),CIt)).Kc().Pb(),11).e,f=BB(DSn(n,oIt).Kc().Pb(),11).g,a=u.c.length,g=g1(BB(xq(n.j,0),11));a-- >0;){for(l1(0,u.c.length),b=BB(u.c[0],17),l1(0,f.c.length),r=E7((i=BB(f.c[0],17)).d.e,i,0),A2(b,i.d,r),SZ(i,null),MZ(i,null),l=b.a,t&&DH(l,new wA(g)),e=spn(i.a,0);e.b!=e.d.c;)DH(l,new wA(BB(b3(e),8)));for(d=b.b,h=new Wb(i.b);h.a<h.c.c.length;)s=BB(n0(h),70),d.c[d.c.length]=s;if(w=BB(mMn(b,(HXn(),vgt)),74),c=BB(mMn(i,vgt),74))for(w||(w=new km,hon(b,vgt,w)),o=spn(c,0);o.b!=o.d.c;)DH(w,new wA(BB(b3(o),8)))}}function cGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w;if(i=BB(oV(n.b,t),124),(s=BB(BB(h6(n.r,t),21),84)).dc())return i.n.b=0,void(i.n.c=0);for(h=n.u.Hc((lIn(),eIt)),u=0,o=s.Kc(),f=null,l=0,b=0;o.Ob();)c=Gy(MD((r=BB(o.Pb(),111)).b.We((DN(),Lrt)))),a=r.b.rf().a,n.A.Hc((mdn(),_It))&&yRn(n,t),f?(w=b+f.d.c+n.w+r.d.b,u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(l-c)<=fJn||l==c||isNaN(l)&&isNaN(c)?0:w/(c-l)))):n.C&&n.C.b>0&&(u=e.Math.max(u,lcn(n.C.b+r.d.b,c))),f=r,l=c,b=a;n.C&&n.C.c>0&&(w=b+n.C.c,h&&(w+=f.d.c),u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(l-1)<=fJn||1==l||isNaN(l)&&isNaN(1)?0:w/(1-l)))),i.n.b=0,i.a.a=u}function aGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w;if(i=BB(oV(n.b,t),124),(s=BB(BB(h6(n.r,t),21),84)).dc())return i.n.d=0,void(i.n.a=0);for(h=n.u.Hc((lIn(),eIt)),u=0,n.A.Hc((mdn(),_It))&&kRn(n,t),o=s.Kc(),f=null,b=0,l=0;o.Ob();)a=Gy(MD((r=BB(o.Pb(),111)).b.We((DN(),Lrt)))),c=r.b.rf().b,f?(w=l+f.d.a+n.w+r.d.d,u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(b-a)<=fJn||b==a||isNaN(b)&&isNaN(a)?0:w/(a-b)))):n.C&&n.C.d>0&&(u=e.Math.max(u,lcn(n.C.d+r.d.d,a))),f=r,b=a,l=c;n.C&&n.C.a>0&&(w=l+n.C.a,h&&(w+=f.d.a),u=e.Math.max(u,(h$(),rin(fJn),e.Math.abs(b-1)<=fJn||1==b||isNaN(b)&&isNaN(1)?0:w/(1-b)))),i.n.d=0,i.a.b=u}function uGn(n,t,e){var i,r,c,a,u,o;for(this.g=n,u=t.d.length,o=e.d.length,this.d=x8(Out,a1n,10,u+o,0,1),a=0;a<u;a++)this.d[a]=t.d[a];for(c=0;c<o;c++)this.d[u+c]=e.d[c];if(t.e){if(this.e=zB(t.e),this.e.Mc(e),e.e)for(r=e.e.Kc();r.Ob();)(i=BB(r.Pb(),233))!=t&&(this.e.Hc(i)?--i.c:this.e.Fc(i))}else e.e&&(this.e=zB(e.e),this.e.Mc(t));this.f=t.f+e.f,this.a=t.a+e.a,this.a>0?Jtn(this,this.f/this.a):null!=lL(t.g,t.d[0]).a&&null!=lL(e.g,e.d[0]).a?Jtn(this,(Gy(lL(t.g,t.d[0]).a)+Gy(lL(e.g,e.d[0]).a))/2):null!=lL(t.g,t.d[0]).a?Jtn(this,lL(t.g,t.d[0]).a):null!=lL(e.g,e.d[0]).a&&Jtn(this,lL(e.g,e.d[0]).a)}function oGn(n,t){var e,i,r,c,a,u,o,s,h;for(n.a=new BX($cn(WPt)),i=new Wb(t.a);i.a<i.c.c.length;){for(e=BB(n0(i),841),a=new Pgn(Pun(Gk(Qat,1),HWn,81,0,[])),WB(n.a.a,a),o=new Wb(e.d);o.a<o.c.c.length;)FGn(s=new NN(n,u=BB(n0(o),110)),BB(mMn(e.c,(hWn(),Xft)),21)),hU(n.g,e)||(VW(n.g,e,new xC(u.c,u.d)),VW(n.f,e,s)),WB(n.a.b,s),g2(a,s);for(c=new Wb(e.b);c.a<c.c.c.length;)s=new NN(n,(r=BB(n0(c),594)).kf()),VW(n.b,r,new rI(a,s)),FGn(s,BB(mMn(e.c,(hWn(),Xft)),21)),r.hf()&&(FGn(h=new Sgn(n,r.hf(),1),BB(mMn(e.c,Xft),21)),g2(new Pgn(Pun(Gk(Qat,1),HWn,81,0,[])),h),JIn(n.c,r.gf(),new rI(a,h)))}return n.a}function sGn(n){var t;this.a=n,t=(uSn(),Pun(Gk($ut,1),$Vn,267,0,[Cut,Put,Mut,Iut,Sut,Tut])).length,this.b=kq(lMt,[sVn,k3n],[593,146],0,[t,t],2),this.c=kq(lMt,[sVn,k3n],[593,146],0,[t,t],2),FY(this,Cut,(HXn(),Opt),Apt),tun(this,Cut,Put,Ept,Tpt),_Y(this,Cut,Iut,Ept),_Y(this,Cut,Mut,Ept),tun(this,Cut,Sut,Opt,Apt),FY(this,Put,ypt,kpt),_Y(this,Put,Iut,ypt),_Y(this,Put,Mut,ypt),tun(this,Put,Sut,Ept,Tpt),ZA(this,Iut,ypt),_Y(this,Iut,Mut,ypt),_Y(this,Iut,Sut,Ppt),ZA(this,Mut,Npt),tun(this,Mut,Sut,Ipt,Cpt),FY(this,Sut,ypt,ypt),FY(this,Tut,ypt,kpt),tun(this,Tut,Cut,Ept,Tpt),tun(this,Tut,Sut,Ept,Tpt),tun(this,Tut,Put,Ept,Tpt)}function hGn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;if(cL(a=e.ak(),99)&&0!=(BB(a,18).Bb&BQn)&&(l=BB(e.dd(),49),(d=tfn(n.e,l))!=l)){if(jL(n,t,sTn(n,t,h=Z3(a,d))),f=null,mA(n.e)&&(i=Fqn((IPn(),Z$t),n.e.Tg(),a))!=itn(n.e.Tg(),n.c)){for(g=axn(n.e.Tg(),a),u=0,c=BB(n.g,119),o=0;o<t;++o)r=c[o],g.rl(r.ak())&&++u;(f=new b4(n.e,9,i,l,d,u,!1)).Ei(new N7(n.e,9,n.c,e,h,t,!1))}return(b=Cvn(w=BB(a,18)))?(f=l.ih(n.e,Awn(l.Tg(),b),null,f),f=BB(d,49).gh(n.e,Awn(d.Tg(),b),null,f)):0!=(w.Bb&h6n)&&(s=-1-Awn(n.e.Tg(),w),f=l.ih(n.e,s,null,null),!BB(d,49).eh()&&(f=BB(d,49).gh(n.e,s,null,f))),f&&f.Fi(),h}return e}function fGn(n){var t,i,r,c,a,u,o,s;for(a=new Wb(n.a.b);a.a<a.c.c.length;)(c=BB(n0(a),81)).b.c=c.g.c,c.b.d=c.g.d;for(s=new xC(RQn,RQn),t=new xC(KQn,KQn),r=new Wb(n.a.b);r.a<r.c.c.length;)i=BB(n0(r),81),s.a=e.Math.min(s.a,i.g.c),s.b=e.Math.min(s.b,i.g.d),t.a=e.Math.max(t.a,i.g.c+i.g.b),t.b=e.Math.max(t.b,i.g.d+i.g.a);for(o=TX(n.c).a.nc();o.Ob();)u=BB(o.Pb(),46),i=BB(u.b,81),s.a=e.Math.min(s.a,i.g.c),s.b=e.Math.min(s.b,i.g.d),t.a=e.Math.max(t.a,i.g.c+i.g.b),t.b=e.Math.max(t.b,i.g.d+i.g.a);n.d=qx(new xC(s.a,s.b)),n.e=XR(new xC(t.a,t.b),s),n.a.a.c=x8(Ant,HWn,1,0,5,1),n.a.b.c=x8(Ant,HWn,1,0,5,1)}function lGn(n){var t,e,i;for(ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new Nf])),e=new Tl(n),i=0;i<e.a.length;++i)mK(t=dnn(e,i).je().a,"layered")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new hf])):mK(t,"force")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new zh])):mK(t,"stress")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new Xh])):mK(t,"mrtree")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new Pf])):mK(t,"radial")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new yf])):mK(t,"disco")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new Gh,new Hh])):mK(t,"sporeOverlap")||mK(t,"sporeCompaction")?ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new Tf])):mK(t,"rectpacking")&&ksn(lAt,Pun(Gk(_it,1),HWn,130,0,[new Of]))}function bGn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;if(l=new wA(n.o),p=t.a/l.a,u=t.b/l.b,d=t.a-l.a,c=t.b-l.b,e)for(r=GI(mMn(n,(HXn(),ept)))===GI((QEn(),XCt)),w=new Wb(n.j);w.a<w.c.c.length;)switch((b=BB(n0(w),11)).j.g){case 1:r||(b.n.a*=p);break;case 2:b.n.a+=d,r||(b.n.b*=u);break;case 3:r||(b.n.a*=p),b.n.b+=c;break;case 4:r||(b.n.b*=u)}for(s=new Wb(n.b);s.a<s.c.c.length;)h=(o=BB(n0(s),70)).n.a+o.o.a/2,f=o.n.b+o.o.b/2,(g=h/l.a)+(a=f/l.b)>=1&&(g-a>0&&f>=0?(o.n.a+=d,o.n.b+=c*a):g-a<0&&h>=0&&(o.n.a+=d*g,o.n.b+=c));n.o.a=t.a,n.o.b=t.b,hon(n,(HXn(),Fgt),(mdn(),new YK(i=BB(Vj(YIt),9),BB(SR(i,i.length),9),0)))}function wGn(n,t,e,i,r,c){if(null!=t&&Xbn(t,AAt,$At))throw Hp(new _y("invalid scheme: "+t));if(!(n||null!=e&&-1==GO(e,YTn(35))&&e.length>0&&(b1(0,e.length),47!=e.charCodeAt(0))))throw Hp(new _y("invalid opaquePart: "+e));if(n&&(null==t||!xT(jAt,t.toLowerCase()))&&null!=e&&Xbn(e,LAt,NAt))throw Hp(new _y(o9n+e));if(n&&null!=t&&xT(jAt,t.toLowerCase())&&!CEn(e))throw Hp(new _y(o9n+e));if(!Ubn(i))throw Hp(new _y("invalid device: "+i));if(!Rhn(r))throw Hp(new _y(null==r?"invalid segments: null":"invalid segment: "+shn(r)));if(null!=c&&-1!=GO(c,YTn(35)))throw Hp(new _y("invalid query: "+c))}function dGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(OTn(t,"Calculate Graph Size",1),t.n&&n&&y0(t,o2(n),(Bsn(),uOt)),o=ZJn,s=ZJn,a=n4n,u=n4n,l=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));l.e!=l.i.gc();)d=(h=BB(kpn(l),33)).i,g=h.j,v=h.g,r=h.f,c=BB(ZAn(h,(sWn(),$St)),142),o=e.Math.min(o,d-c.b),s=e.Math.min(s,g-c.d),a=e.Math.max(a,d+v+c.c),u=e.Math.max(u,g+r+c.a);for(b=new xC(o-(w=BB(ZAn(n,(sWn(),XSt)),116)).b,s-w.d),f=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));f.e!=f.i.gc();)Pen(h=BB(kpn(f),33),h.i-b.a),Cen(h,h.j-b.b);p=a-o+(w.b+w.c),i=u-s+(w.d+w.a),Sen(n,p),Men(n,i),t.n&&n&&y0(t,o2(n),(Bsn(),uOt))}function gGn(n){var t,e,i,r,c,a,u,o,s,h;for(i=new Np,a=new Wb(n.e.a);a.a<a.c.c.length;){for(h=0,(r=BB(n0(a),121)).k.c=x8(Ant,HWn,1,0,5,1),e=new Wb(kbn(r));e.a<e.c.c.length;)(t=BB(n0(e),213)).f&&(WB(r.k,t),++h);1==h&&(i.c[i.c.length]=r)}for(c=new Wb(i);c.a<c.c.c.length;)for(r=BB(n0(c),121);1==r.k.c.length;){for(s=BB(n0(new Wb(r.k)),213),n.b[s.c]=s.g,u=s.d,o=s.e,e=new Wb(kbn(r));e.a<e.c.c.length;)Nfn(t=BB(n0(e),213),s)||(t.f?u==t.d||o==t.e?n.b[s.c]-=n.b[t.c]-t.g:n.b[s.c]+=n.b[t.c]-t.g:r==u?t.d==r?n.b[s.c]+=t.g:n.b[s.c]-=t.g:t.d==r?n.b[s.c]-=t.g:n.b[s.c]+=t.g);y7(u.k,s),y7(o.k,s),r=u==r?s.e:s.d}}function pGn(n,t){var e,i,r,c,a,u,o,s,h,f,l;if(null==t||0==t.length)return null;if(!(c=BB(SJ(n.f,t),23))){for(r=new Kb(new Ob(n.d).a.vc().Kc());r.a.Ob();)if(a=BB(r.a.Pb(),42),u=(e=BB(a.dd(),23)).f,l=t.length,mK(u.substr(u.length-l,l),t)&&(t.length==u.length||46==fV(u,u.length-t.length-1))){if(c)return null;c=e}if(!c)for(i=new Kb(new Ob(n.d).a.vc().Kc());i.a.Ob();)if(a=BB(i.a.Pb(),42),null!=(f=(e=BB(a.dd(),23)).g))for(s=0,h=(o=f).length;s<h;++s)if(u=o[s],l=t.length,mK(u.substr(u.length-l,l),t)&&(t.length==u.length||46==fV(u,u.length-t.length-1))){if(c)return null;c=e}c&&mZ(n.f,t,c)}return c}function vGn(n,t){var e,i,r,c,a;for(e=new Ik,a=!1,c=0;c<t.length;c++)if(b1(c,t.length),32!=(i=t.charCodeAt(c)))a?39==i?c+1<t.length&&(b1(c+1,t.length),39==t.charCodeAt(c+1))?(e.a+=String.fromCharCode(i),++c):a=!1:e.a+=String.fromCharCode(i):GO("GyMLdkHmsSEcDahKzZv",YTn(i))>0?(Ppn(n,e,0),e.a+=String.fromCharCode(i),Ppn(n,e,r=cgn(t,c)),c+=r-1):39==i?c+1<t.length&&(b1(c+1,t.length),39==t.charCodeAt(c+1))?(e.a+="'",++c):a=!0:e.a+=String.fromCharCode(i);else for(Ppn(n,e,0),e.a+=" ",Ppn(n,e,0);c+1<t.length&&(b1(c+1,t.length),32==t.charCodeAt(c+1));)++c;Ppn(n,e,0),pTn(n)}function mGn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p;if(OTn(i,"Network simplex layering",1),n.b=t,p=4*BB(mMn(t,(HXn(),xpt)),19).a,(g=n.b.a).c.length<1)HSn(i);else{for(d=null,c=spn(a=IKn(n,g),0);c.b!=c.d.c;){for(r=BB(b3(c),15),o=p*CJ(e.Math.sqrt(r.gc())),WKn(Qk(Jk(Yk(B_(u=o_n(r)),o),d),!0),mcn(i,1)),l=n.b.b,w=new Wb(u.a);w.a<w.c.c.length;){for(b=BB(n0(w),121);l.c.length<=b.e;)kG(l,l.c.length,new HX(n.b));PZ(BB(b.f,10),BB(xq(l,b.e),29))}if(a.b>1)for(d=x8(ANt,hQn,25,n.b.b.c.length,15,1),f=0,h=new Wb(n.b.b);h.a<h.c.c.length;)s=BB(n0(h),29),d[f++]=s.a.c.length}g.c=x8(Ant,HWn,1,0,5,1),n.a=null,n.b=null,n.c=null,HSn(i)}}function yGn(n){var t,i,r,c,a,u,o;for(t=0,a=new Wb(n.b.a);a.a<a.c.c.length;)(r=BB(n0(a),189)).b=0,r.c=0;for(ESn(n,0),ewn(n,n.g),kNn(n.c),Zy(n.c),Ffn(),i=_Pt,DKn(eO(Mzn(DKn(eO(Mzn(DKn(Mzn(n.c,i)),jln(i)))),i))),Mzn(n.c,_Pt),Bln(n,n.g),kMn(n,0),pHn(n,0),M$n(n,1),ESn(n,1),ewn(n,n.d),kNn(n.c),u=new Wb(n.b.a);u.a<u.c.c.length;)r=BB(n0(u),189),t+=e.Math.abs(r.c);for(o=new Wb(n.b.a);o.a<o.c.c.length;)(r=BB(n0(o),189)).b=0,r.c=0;for(i=HPt,DKn(eO(Mzn(DKn(eO(Mzn(DKn(Zy(Mzn(n.c,i))),jln(i)))),i))),Mzn(n.c,_Pt),Bln(n,n.d),kMn(n,1),pHn(n,1),M$n(n,0),Zy(n.c),c=new Wb(n.b.a);c.a<c.c.c.length;)r=BB(n0(c),189),t+=e.Math.abs(r.c);return t}function kGn(n,t){var e,i,r,c,a,u,o,s,h;if(null!=(s=t).b&&null!=n.b){for(T$n(n),qHn(n),T$n(s),qHn(s),e=x8(ANt,hQn,25,n.b.length+s.b.length,15,1),h=0,i=0,a=0;i<n.b.length&&a<s.b.length;)if(r=n.b[i],c=n.b[i+1],u=s.b[a],o=s.b[a+1],c<u)i+=2;else if(c>=u&&r<=o)u<=r&&c<=o?(e[h++]=r,e[h++]=c,i+=2):u<=r?(e[h++]=r,e[h++]=o,n.b[i]=o+1,a+=2):c<=o?(e[h++]=u,e[h++]=c,i+=2):(e[h++]=u,e[h++]=o,n.b[i]=o+1);else{if(!(o<r))throw Hp(new dy("Token#intersectRanges(): Internal Error: ["+n.b[i]+","+n.b[i+1]+"] & ["+s.b[a]+","+s.b[a+1]+"]"));a+=2}for(;i<n.b.length;)e[h++]=n.b[i++],e[h++]=n.b[i++];n.b=x8(ANt,hQn,25,h,15,1),aHn(e,0,n.b,0,h)}}function jGn(n){var t,i,r,c,a,u,o;for(t=new Np,n.g=new Np,n.d=new Np,u=new usn(new Pb(n.f.b).a);u.b;)WB(t,BB(BB((a=ten(u)).dd(),46).b,81)),dA(BB(a.cd(),594).gf())?WB(n.d,BB(a.dd(),46)):WB(n.g,BB(a.dd(),46));for(ewn(n,n.d),ewn(n,n.g),n.c=new sOn(n.b),ej(n.c,(vM(),Gat)),Bln(n,n.d),Bln(n,n.g),gun(t,n.c.a.b),n.e=new xC(RQn,RQn),n.a=new xC(KQn,KQn),r=new Wb(t);r.a<r.c.c.length;)i=BB(n0(r),81),n.e.a=e.Math.min(n.e.a,i.g.c),n.e.b=e.Math.min(n.e.b,i.g.d),n.a.a=e.Math.max(n.a.a,i.g.c+i.g.b),n.a.b=e.Math.max(n.a.b,i.g.d+i.g.a);tj(n.c,new jt),o=0;do{c=yGn(n),++o}while((o<2||c>KVn)&&o<10);tj(n.c,new Et),yGn(n),IU(n.c),fGn(n.f)}function EGn(n,t,e){var i,r,c,a,u,o,s,h,f,l;if(qy(TD(mMn(e,(HXn(),wgt)))))for(r=new Wb(e.j);r.a<r.c.c.length;)for(u=0,o=(a=Z0(BB(n0(r),11).g)).length;u<o;++u)(c=a[u]).d.i==e&&qy(TD(mMn(c,dgt)))&&(h=c.c,(s=BB(RX(n.b,h),10))||(hon(s=bXn(h,(QEn(),QCt),h.j,-1,null,null,h.o,BB(mMn(t,Udt),103),t),(hWn(),dlt),h),VW(n.b,h,s),WB(t.a,s)),l=c.d,(f=BB(RX(n.b,l),10))||(hon(f=bXn(l,(QEn(),QCt),l.j,1,null,null,l.o,BB(mMn(t,Udt),103),t),(hWn(),dlt),l),VW(n.b,l,f),WB(t.a,f)),SZ(i=W5(c),BB(xq(s.j,0),11)),MZ(i,BB(xq(f.j,0),11)),JIn(n.a,c,new L_(i,t,(ain(),qvt))),BB(mMn(t,(hWn(),Zft)),21).Fc((bDn(),lft)))}function TGn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w;for(OTn(e,"Label dummy switching",1),i=BB(mMn(t,(HXn(),Vdt)),227),pcn(t),r=j$n(t,i),n.a=x8(xNt,qQn,25,t.b.c.length,15,1),$Pn(),h=0,b=(u=Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])).length;h<b;++h)if(((c=u[h])==eht||c==Yst||c==nht)&&!BB(SN(r.a,c)?r.b[c.g]:null,15).dc()){Zcn(n,t);break}for(f=0,w=(o=Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])).length;f<w;++f)(c=o[f])==eht||c==Yst||c==nht||GKn(n,BB(SN(r.a,c)?r.b[c.g]:null,15));for(s=0,l=(a=Pun(Gk(uht,1),$Vn,227,0,[Zst,tht,Jst,nht,eht,Yst])).length;s<l;++s)((c=a[s])==eht||c==Yst||c==nht)&&GKn(n,BB(SN(r.a,c)?r.b[c.g]:null,15));n.a=null,HSn(e)}function MGn(n,t){var e,i,r,c,a,u,o,s,h,f,l;switch(n.k.g){case 1:if(i=BB(mMn(n,(hWn(),dlt)),17),(e=BB(mMn(i,glt),74))?qy(TD(mMn(i,Clt)))&&(e=Jon(e)):e=new km,s=BB(mMn(n,hlt),11)){if(t<=(h=Aon(Pun(Gk(PMt,1),sVn,8,0,[s.i.n,s.n,s.a]))).a)return h.b;r5(e,h,e.a,e.a.a)}if(f=BB(mMn(n,flt),11)){if((l=Aon(Pun(Gk(PMt,1),sVn,8,0,[f.i.n,f.n,f.a]))).a<=t)return l.b;r5(e,l,e.c.b,e.c)}if(e.b>=2){for(a=BB(b3(o=spn(e,0)),8),u=BB(b3(o),8);u.a<t&&o.b!=o.d.c;)a=u,u=BB(b3(o),8);return a.b+(t-a.a)/(u.a-a.a)*(u.b-a.b)}break;case 3:switch(r=(c=BB(mMn(BB(xq(n.j,0),11),(hWn(),dlt)),11)).i,c.j.g){case 1:return r.n.b;case 3:return r.n.b+r.o.b}}return Fjn(n).b}function SGn(n){var t,e,i,r,c,a,u,o,s,f;for(c=new Wb(n.d.b);c.a<c.c.c.length;)for(u=new Wb(BB(n0(c),29).a);u.a<u.c.c.length;)!qy(TD(mMn(a=BB(n0(u),10),(HXn(),Tdt))))||h3(hbn(a))?(r=new UV(a.n.a-a.d.b,a.n.b-a.d.d,a.o.a+a.d.b+a.d.c,a.o.b+a.d.d+a.d.a),t=ON(iM(tM(eM(new Wv,a),r),dst),n.a),IN(nM(Xen(new Xv,Pun(Gk(bit,1),HWn,57,0,[t])),t),n.a),o=new Dp,VW(n.e,t,o),(e=F3(new oz(ZL(fbn(a).a.Kc(),new h)))-F3(new oz(ZL(lbn(a).a.Kc(),new h))))<0?Uun(o,!0,(Ffn(),_Pt)):e>0&&Uun(o,!0,(Ffn(),FPt)),a.k==(uSn(),Mut)&&wV(o),VW(n.f,a,t)):((s=(i=BB(iY(hbn(a)),17)).c.i)==a&&(s=i.d.i),f=new rI(s,XR(B$(a.n),s.n)),VW(n.b,a,f))}function PGn(n,t,i){var r,c,a,u,o,s,h,f;switch(OTn(i,"Node promotion heuristic",1),n.g=t,yUn(n),n.q=BB(mMn(t,(HXn(),Sgt)),260),f=BB(mMn(n.g,Mgt),19).a,a=new hi,n.q.g){case 2:case 1:default:_Hn(n,a);break;case 3:for(n.q=(sNn(),Ovt),_Hn(n,a),s=0,o=new Wb(n.a);o.a<o.c.c.length;)u=BB(n0(o),19),s=e.Math.max(s,u.a);s>n.j&&(n.q=Tvt,_Hn(n,a));break;case 4:for(n.q=(sNn(),Ovt),_Hn(n,a),h=0,c=new Wb(n.b);c.a<c.c.c.length;)r=MD(n0(c)),h=e.Math.max(h,(kW(r),r));h>n.k&&(n.q=Pvt,_Hn(n,a));break;case 6:_Hn(n,new od(CJ(e.Math.ceil(n.f.length*f/100))));break;case 5:_Hn(n,new sd(CJ(e.Math.ceil(n.d*f/100))))}oDn(n,t),HSn(i)}function CGn(n,t,e){var i,r,c,a;this.j=n,this.e=qEn(n),this.o=this.j.e,this.i=!!this.o,this.p=this.i?BB(xq(e,vW(this.o).p),214):null,r=BB(mMn(n,(hWn(),Zft)),21),this.g=r.Hc((bDn(),lft)),this.b=new Np,this.d=new wdn(this.e),a=BB(mMn(this.j,Slt),230),this.q=Han(t,a,this.e),this.k=new aZ(this),c=u6(Pun(Gk(jst,1),HWn,225,0,[this,this.d,this.k,this.q])),t!=(oin(),Omt)||qy(TD(mMn(n,(HXn(),xdt))))?t==Omt&&qy(TD(mMn(n,(HXn(),xdt))))?(i=new UEn(this.e),c.c[c.c.length]=i,this.c=new prn(i,a,BB(this.q,402))):this.c=new vP(t,this):(i=new UEn(this.e),c.c[c.c.length]=i,this.c=new G2(i,a,BB(this.q,402))),WB(c,this.c),CHn(c,this.e),this.s=wXn(this.k)}function IGn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(l=(s=BB(iL(new wg(spn(new bg(t).a.d,0))),86))?BB(mMn(s,(qqn(),ckt)),86):null,r=1;s&&l;){for(a=0,v=0,e=s,i=l,c=0;c<r;c++)e=G8(e),i=G8(i),v+=Gy(MD(mMn(e,(qqn(),okt)))),a+=Gy(MD(mMn(i,okt)));if(p=Gy(MD(mMn(l,(qqn(),fkt)))),g=Gy(MD(mMn(s,fkt))),h=E5(s,l),0<(f=p+a+n.a+h-g-v)){for(u=t,o=0;u&&u!=i;)++o,u=BB(mMn(u,akt),86);if(!u)return;for(d=f/o,u=t;u!=i;)w=Gy(MD(mMn(u,fkt)))+f,hon(u,fkt,w),b=Gy(MD(mMn(u,okt)))+f,hon(u,okt,b),f-=d,u=BB(mMn(u,akt),86)}++r,l=(s=0==s.d.b?ZKn(new bg(t),r):BB(iL(new wg(spn(new bg(s).a.d,0))),86))?BB(mMn(s,ckt),86):null}}function OGn(n,t){var e,i,r,c,a,u,o,s,f;for(u=!0,r=0,o=n.f[t.p],s=t.o.b+n.n,e=n.c[t.p][2],c5(n.a,o,iln(BB(xq(n.a,o),19).a-1+e)),c5(n.b,o,Gy(MD(xq(n.b,o)))-s+e*n.e),++o>=n.i?(++n.i,WB(n.a,iln(1)),WB(n.b,s)):(i=n.c[t.p][1],c5(n.a,o,iln(BB(xq(n.a,o),19).a+1-i)),c5(n.b,o,Gy(MD(xq(n.b,o)))+s-i*n.e)),(n.q==(sNn(),Tvt)&&(BB(xq(n.a,o),19).a>n.j||BB(xq(n.a,o-1),19).a>n.j)||n.q==Pvt&&(Gy(MD(xq(n.b,o)))>n.k||Gy(MD(xq(n.b,o-1)))>n.k))&&(u=!1),c=new oz(ZL(fbn(t).a.Kc(),new h));dAn(c);)a=BB(U5(c),17).c.i,n.f[a.p]==o&&(r+=BB((f=OGn(n,a)).a,19).a,u=u&&qy(TD(f.b)));return n.f[t.p]=o,new rI(iln(r+=n.c[t.p][0]),(hN(),!!u))}function AGn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v;for(l=new xp,u=new Np,rIn(n,i,n.d.fg(),u,l),rIn(n,r,n.d.gg(),u,l),n.b=.2*(g=BAn(wnn(new Rq(null,new w1(u,16)),new Sa)),p=BAn(wnn(new Rq(null,new w1(u,16)),new Pa)),e.Math.min(g,p)),a=0,o=0;o<u.c.length-1;o++)for(l1(o,u.c.length),s=BB(u.c[o],112),d=o+1;d<u.c.length;d++)a+=gHn(n,s,(l1(d,u.c.length),BB(u.c[d],112)));for(b=BB(mMn(t,(hWn(),Slt)),230),a>=2&&(v=QLn(u,!0,b),!n.e&&(n.e=new lg(n)),sgn(n.e,v,u,n.b)),iTn(u,b),czn(u),w=-1,f=new Wb(u);f.a<f.c.c.length;)h=BB(n0(f),112),e.Math.abs(h.s-h.c)<lZn||(w=e.Math.max(w,h.o),n.d.dg(h,c,n.c));return n.d.a.a.$b(),w+1}function $Gn(n,t){var e,i;Gy(MD(mMn(t,(HXn(),ypt))))<2&&hon(t,ypt,2),BB(mMn(t,Udt),103)==(Ffn(),BPt)&&hon(t,Udt,Wln(t)),0==(e=BB(mMn(t,wpt),19)).a?hon(t,(hWn(),Slt),new sbn):hon(t,(hWn(),Slt),new C4(e.a)),null==TD(mMn(t,xgt))&&hon(t,xgt,(hN(),GI(mMn(t,Zdt))===GI((Mbn(),QPt)))),JT(new Rq(null,new w1(t.a,16)),new Rw(n)),JT(wnn(new Rq(null,new w1(t.b,16)),new mt),new Kw(n)),i=new sGn(t),hon(t,(hWn(),Alt),i),h2(n.a),CU(n.a,(yMn(),Rat),BB(mMn(t,Gdt),246)),CU(n.a,Kat,BB(mMn(t,Pgt),246)),CU(n.a,_at,BB(mMn(t,qdt),246)),CU(n.a,Fat,BB(mMn(t,_gt),246)),CU(n.a,Bat,San(BB(mMn(t,Zdt),218))),aA(n.a,LXn(t)),hon(t,Mlt,$qn(n.a,t))}function LGn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;return l=n.c[t],b=n.c[e],!((w=BB(mMn(l,(hWn(),clt)),15))&&0!=w.gc()&&w.Hc(b)||(d=l.k!=(uSn(),Put)&&b.k!=Put,v=(g=BB(mMn(l,rlt),10))!=(p=BB(mMn(b,rlt),10)),m=!!g&&g!=l||!!p&&p!=b,y=omn(l,(kUn(),sIt)),k=omn(b,SIt),m|=omn(l,SIt)||omn(b,sIt),d&&(m&&v||y||k))||l.k==(uSn(),Iut)&&b.k==Cut||b.k==(uSn(),Iut)&&l.k==Cut)&&(h=n.c[t],c=n.c[e],r=fjn(n.e,h,c,(kUn(),CIt)),o=fjn(n.i,h,c,oIt),TNn(n.f,h,c),s=Nsn(n.b,h,c)+BB(r.a,19).a+BB(o.a,19).a+n.f.d,u=Nsn(n.b,c,h)+BB(r.b,19).a+BB(o.b,19).a+n.f.b,n.a&&(f=BB(mMn(h,dlt),11),a=BB(mMn(c,dlt),11),s+=BB((i=qyn(n.g,f,a)).a,19).a,u+=BB(i.b,19).a),s>u)}function NGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(i=BB(mMn(n,(HXn(),ept)),98),u=n.f,a=n.d,o=u.a+a.b+a.c,s=0-a.d-n.c.b,f=u.b+a.d+a.a-n.c.b,h=new Np,l=new Np,c=new Wb(t);c.a<c.c.c.length;){switch(r=BB(n0(c),10),i.g){case 1:case 2:case 3:_Nn(r);break;case 4:w=(b=BB(mMn(r,npt),8))?b.a:0,r.n.a=o*Gy(MD(mMn(r,(hWn(),Tlt))))-w,Jan(r,!0,!1);break;case 5:g=(d=BB(mMn(r,npt),8))?d.a:0,r.n.a=Gy(MD(mMn(r,(hWn(),Tlt))))-g,Jan(r,!0,!1),u.a=e.Math.max(u.a,r.n.a+r.o.a/2)}switch(BB(mMn(r,(hWn(),Qft)),61).g){case 1:r.n.b=s,h.c[h.c.length]=r;break;case 3:r.n.b=f,l.c[l.c.length]=r}}switch(i.g){case 1:case 2:Rfn(h,n),Rfn(l,n);break;case 3:Kfn(h,n),Kfn(l,n)}}function xGn(n,t){var e,i,r,c,a,u,o,s,h,f;for(h=new Np,f=new Lp,c=null,r=0,i=0;i<t.length;++i)switch(Rsn(c,e=t[i])&&(r=Cdn(n,f,h,Kmt,r)),Lx(e,(hWn(),rlt))&&(c=BB(mMn(e,rlt),10)),e.k.g){case 0:for(o=qA(KB(abn(e,(kUn(),sIt)),new xc));Zin(o);)a=BB(P7(o),11),n.d[a.p]=r++,h.c[h.c.length]=a;for(r=Cdn(n,f,h,Kmt,r),s=qA(KB(abn(e,SIt),new xc));Zin(s);)a=BB(P7(s),11),n.d[a.p]=r++,h.c[h.c.length]=a;break;case 3:abn(e,Rmt).dc()||(a=BB(abn(e,Rmt).Xb(0),11),n.d[a.p]=r++,h.c[h.c.length]=a),abn(e,Kmt).dc()||d3(f,e);break;case 1:for(u=abn(e,(kUn(),CIt)).Kc();u.Ob();)a=BB(u.Pb(),11),n.d[a.p]=r++,h.c[h.c.length]=a;abn(e,oIt).Jc(new ZP(f,e))}return Cdn(n,f,h,Kmt,r),h}function DGn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(h=RQn,f=RQn,o=KQn,s=KQn,b=new Wb(t.i);b.a<b.c.c.length;)l=BB(n0(b),65),SA(c=BB(BB(RX(n.g,l.a),46).b,33),l.b.c,l.b.d),h=e.Math.min(h,c.i),f=e.Math.min(f,c.j),o=e.Math.max(o,c.i+c.g),s=e.Math.max(s,c.j+c.f);for(w=BB(ZAn(n.c,(MMn(),bTt)),116),KUn(n.c,o-h+(w.b+w.c),s-f+(w.d+w.a),!0,!0),lMn(n.c,-h+w.b,-f+w.d),r=new AL(iQ(n.c));r.e!=r.i.gc();)u=cDn(i=BB(kpn(r),79),!0,!0),d=PMn(i),p=OMn(i),g=new xC(d.i+d.g/2,d.j+d.f/2),a=new xC(p.i+p.g/2,p.j+p.f/2),Ukn(v=XR(new xC(a.a,a.b),g),d.g,d.f),UR(g,v),Ukn(m=XR(new xC(g.a,g.b),a),p.g,p.f),UR(a,m),CA(u,g.a,g.b),PA(u,a.a,a.b)}function RGn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b;if(n.c=n.d,l=null==(b=TD(mMn(t,(HXn(),dpt))))||(kW(b),b),c=BB(mMn(t,(hWn(),Zft)),21).Hc((bDn(),lft)),e=!((r=BB(mMn(t,ept),98))==(QEn(),UCt)||r==WCt||r==XCt),!l||!e&&c)f=new Jy(Pun(Gk(jut,1),JZn,37,0,[t]));else{for(h=new Wb(t.a);h.a<h.c.c.length;)BB(n0(h),10).p=0;for(f=new Np,s=new Wb(t.a);s.a<s.c.c.length;)if(i=L_n(n,BB(n0(s),10),null)){for(qan(o=new min,t),hon(o,Xft,BB(i.b,21)),kQ(o.d,t.d),hon(o,Hgt,null),u=BB(i.a,15).Kc();u.Ob();)a=BB(u.Pb(),10),WB(o.a,a),a.a=o;f.Fc(o)}c&&(GI(mMn(t,Cdt))===GI((Bfn(),lut))?n.c=n.b:n.c=n.a)}return GI(mMn(t,Cdt))!==GI((Bfn(),wut))&&(SQ(),f.ad(new xt)),f}function KGn(n){NM(n,new MTn(mj(dj(vj(wj(pj(gj(new du,Q3n),"ELK Mr. Tree"),"Tree-based algorithm provided by the Eclipse Layout Kernel. Computes a spanning tree of the input graph and arranges all nodes according to the resulting parent-children hierarchy. I pity the fool who doesn't use Mr. Tree Layout."),new Na),Y3n),nbn((hAn(),JOt))))),u2(n,Q3n,QJn,Okt),u2(n,Q3n,vZn,20),u2(n,Q3n,VJn,dZn),u2(n,Q3n,pZn,iln(1)),u2(n,Q3n,kZn,(hN(),!0)),u2(n,Q3n,X2n,mpn(Ekt)),u2(n,Q3n,PZn,mpn(Mkt)),u2(n,Q3n,BZn,mpn(Skt)),u2(n,Q3n,SZn,mpn(Pkt)),u2(n,Q3n,CZn,mpn(Tkt)),u2(n,Q3n,MZn,mpn(Ckt)),u2(n,Q3n,IZn,mpn(Akt)),u2(n,Q3n,X3n,mpn(Dkt)),u2(n,Q3n,W3n,mpn(Lkt))}function _Gn(n){n.q||(n.q=!0,n.p=kan(n,0),n.a=kan(n,1),Krn(n.a,0),n.f=kan(n,2),Krn(n.f,1),Rrn(n.f,2),n.n=kan(n,3),Rrn(n.n,3),Rrn(n.n,4),Rrn(n.n,5),Rrn(n.n,6),n.g=kan(n,4),Krn(n.g,7),Rrn(n.g,8),n.c=kan(n,5),Krn(n.c,7),Krn(n.c,8),n.i=kan(n,6),Krn(n.i,9),Krn(n.i,10),Krn(n.i,11),Krn(n.i,12),Rrn(n.i,13),n.j=kan(n,7),Krn(n.j,9),n.d=kan(n,8),Krn(n.d,3),Krn(n.d,4),Krn(n.d,5),Krn(n.d,6),Rrn(n.d,7),Rrn(n.d,8),Rrn(n.d,9),Rrn(n.d,10),n.b=kan(n,9),Rrn(n.b,0),Rrn(n.b,1),n.e=kan(n,10),Rrn(n.e,1),Rrn(n.e,2),Rrn(n.e,3),Rrn(n.e,4),Krn(n.e,5),Krn(n.e,6),Krn(n.e,7),Krn(n.e,8),Krn(n.e,9),Krn(n.e,10),Rrn(n.e,11),n.k=kan(n,11),Rrn(n.k,0),Rrn(n.k,1),n.o=jan(n,12),n.s=jan(n,13))}function FGn(n,t){t.dc()&&eH(n.j,!0,!0,!0,!0),Nfn(t,(kUn(),dIt))&&eH(n.j,!0,!0,!0,!1),Nfn(t,hIt)&&eH(n.j,!1,!0,!0,!0),Nfn(t,EIt)&&eH(n.j,!0,!0,!1,!0),Nfn(t,MIt)&&eH(n.j,!0,!1,!0,!0),Nfn(t,gIt)&&eH(n.j,!1,!0,!0,!1),Nfn(t,fIt)&&eH(n.j,!1,!0,!1,!0),Nfn(t,TIt)&&eH(n.j,!0,!1,!1,!0),Nfn(t,jIt)&&eH(n.j,!0,!1,!0,!1),Nfn(t,yIt)&&eH(n.j,!0,!0,!0,!0),Nfn(t,bIt)&&eH(n.j,!0,!0,!0,!0),Nfn(t,yIt)&&eH(n.j,!0,!0,!0,!0),Nfn(t,lIt)&&eH(n.j,!0,!0,!0,!0),Nfn(t,kIt)&&eH(n.j,!0,!0,!0,!0),Nfn(t,mIt)&&eH(n.j,!0,!0,!0,!0),Nfn(t,vIt)&&eH(n.j,!0,!0,!0,!0)}function BGn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g;for(c=new Np,s=new Wb(i);s.a<s.c.c.length;)if(a=null,(u=BB(n0(s),441)).f==(ain(),qvt))for(w=new Wb(u.e);w.a<w.c.c.length;)vW(g=(b=BB(n0(w),17)).d.i)==t?Stn(n,t,u,b,u.b,b.d):!e||wan(g,e)?GMn(n,t,u,i,b):((l=LHn(n,t,e,b,u.b,qvt,a))!=a&&(c.c[c.c.length]=l),l.c&&(a=l));else for(f=new Wb(u.e);f.a<f.c.c.length;)if(vW(d=(h=BB(n0(f),17)).c.i)==t)Stn(n,t,u,h,h.c,u.b);else{if(!e||wan(d,e))continue;(l=LHn(n,t,e,h,u.b,Hvt,a))!=a&&(c.c[c.c.length]=l),l.c&&(a=l)}for(o=new Wb(c);o.a<o.c.c.length;)u=BB(n0(o),441),-1!=E7(t.a,u.a,0)||WB(t.a,u.a),u.c&&(r.c[r.c.length]=u)}function HGn(n,t,e){var i,r,c,a,u,o,s,h;for(o=new Np,u=new Wb(t.a);u.a<u.c.c.length;)for(h=abn(BB(n0(u),10),(kUn(),oIt)).Kc();h.Ob();)for(r=new Wb(BB(h.Pb(),11).g);r.a<r.c.c.length;)!b5(i=BB(n0(r),17))&&i.c.i.c==i.d.i.c||b5(i)||i.d.i.c!=e||(o.c[o.c.length]=i);for(a=ean(e.a).Kc();a.Ob();)for(h=abn(BB(a.Pb(),10),(kUn(),CIt)).Kc();h.Ob();)for(r=new Wb(BB(h.Pb(),11).e);r.a<r.c.c.length;)if((b5(i=BB(n0(r),17))||i.c.i.c!=i.d.i.c)&&!b5(i)&&i.c.i.c==t){for(Px((s=new M2(o,o.c.length)).b>0),c=BB(s.a.Xb(s.c=--s.b),17);c!=i&&s.b>0;)n.a[c.p]=!0,n.a[i.p]=!0,Px(s.b>0),c=BB(s.a.Xb(s.c=--s.b),17);s.b>0&&fW(s)}}function qGn(n,t,e){var i,r,c,a,u,o,s,h,f;if(n.a!=t.Aj())throw Hp(new _y(d6n+t.ne()+g6n));if(i=Cfn((IPn(),Z$t),t).$k())return i.Aj().Nh().Ih(i,e);if(a=Cfn(Z$t,t).al()){if(null==e)return null;if((u=BB(e,15)).dc())return"";for(f=new Sk,c=u.Kc();c.Ob();)r=c.Pb(),cO(f,a.Aj().Nh().Ih(a,r)),f.a+=" ";return KO(f,f.a.length-1)}if(!(h=Cfn(Z$t,t).bl()).dc()){for(s=h.Kc();s.Ob();)if((o=BB(s.Pb(),148)).wj(e))try{if(null!=(f=o.Aj().Nh().Ih(o,e)))return f}catch(l){if(!cL(l=lun(l),102))throw Hp(l)}throw Hp(new _y("Invalid value: '"+e+"' for datatype :"+t.ne()))}return BB(t,834).Fj(),null==e?null:cL(e,172)?""+BB(e,172).a:tsn(e)==mtt?H$(IOt[0],BB(e,199)):Bbn(e)}function GGn(n){var t,i,r,c,a,u,o,s,h;for(s=new YT,u=new YT,c=new Wb(n);c.a<c.c.c.length;)(i=BB(n0(c),128)).v=0,i.n=i.i.c.length,i.u=i.t.c.length,0==i.n&&r5(s,i,s.c.b,s.c),0==i.u&&0==i.r.a.gc()&&r5(u,i,u.c.b,u.c);for(a=-1;0!=s.b;)for(t=new Wb((i=BB(tkn(s,0),128)).t);t.a<t.c.c.length;)(h=BB(n0(t),268).b).v=e.Math.max(h.v,i.v+1),a=e.Math.max(a,h.v),--h.n,0==h.n&&r5(s,h,s.c.b,s.c);if(a>-1){for(r=spn(u,0);r.b!=r.d.c;)(i=BB(b3(r),128)).v=a;for(;0!=u.b;)for(t=new Wb((i=BB(tkn(u,0),128)).i);t.a<t.c.c.length;)0==(o=BB(n0(t),268).a).r.a.gc()&&(o.v=e.Math.min(o.v,i.v-1),--o.u,0==o.u&&r5(u,o,u.c.b,u.c))}}function zGn(n,t,i,r,c){var a,u,o,s;return s=RQn,u=!1,a=!!(o=zBn(n,XR(new xC(t.a,t.b),n),UR(new xC(i.a,i.b),c),XR(new xC(r.a,r.b),i)))&&!(e.Math.abs(o.a-n.a)<=s5n&&e.Math.abs(o.b-n.b)<=s5n||e.Math.abs(o.a-t.a)<=s5n&&e.Math.abs(o.b-t.b)<=s5n),(o=zBn(n,XR(new xC(t.a,t.b),n),i,c))&&((e.Math.abs(o.a-n.a)<=s5n&&e.Math.abs(o.b-n.b)<=s5n)==(e.Math.abs(o.a-t.a)<=s5n&&e.Math.abs(o.b-t.b)<=s5n)||a?s=e.Math.min(s,lW(XR(o,i))):u=!0),(o=zBn(n,XR(new xC(t.a,t.b),n),r,c))&&(u||(e.Math.abs(o.a-n.a)<=s5n&&e.Math.abs(o.b-n.b)<=s5n)==(e.Math.abs(o.a-t.a)<=s5n&&e.Math.abs(o.b-t.b)<=s5n)||a)&&(s=e.Math.min(s,lW(XR(o,r)))),s}function UGn(n){NM(n,new MTn(dj(vj(wj(pj(gj(new du,_Zn),FZn),"Minimizes the stress within a layout using stress majorization. Stress exists if the euclidean distance between a pair of nodes doesn't match their graph theoretic distance, that is, the shortest path between the two nodes. The method allows to specify individual edge lengths."),new gt),gZn))),u2(n,_Zn,jZn,mpn(kat)),u2(n,_Zn,TZn,(hN(),!0)),u2(n,_Zn,PZn,mpn(Tat)),u2(n,_Zn,BZn,mpn(Mat)),u2(n,_Zn,SZn,mpn(Sat)),u2(n,_Zn,CZn,mpn(Eat)),u2(n,_Zn,MZn,mpn(Pat)),u2(n,_Zn,IZn,mpn(Cat)),u2(n,_Zn,NZn,mpn(yat)),u2(n,_Zn,DZn,mpn(vat)),u2(n,_Zn,RZn,mpn(mat)),u2(n,_Zn,KZn,mpn(jat)),u2(n,_Zn,xZn,mpn(pat))}function XGn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(OTn(t,"Interactive crossing minimization",1),a=0,c=new Wb(n.b);c.a<c.c.c.length;)(i=BB(n0(c),29)).p=a++;for(d=new Rj((l=qEn(n)).length),CHn(new Jy(Pun(Gk(jst,1),HWn,225,0,[d])),l),w=0,a=0,r=new Wb(n.b);r.a<r.c.c.length;){for(e=0,f=0,h=new Wb((i=BB(n0(r),29)).a);h.a<h.c.c.length;)for((o=BB(n0(h),10)).n.a>0&&(e+=o.n.a+o.o.a/2,++f),b=new Wb(o.j);b.a<b.c.c.length;)BB(n0(b),11).p=w++;for(f>0&&(e/=f),g=x8(xNt,qQn,25,i.a.c.length,15,1),u=0,s=new Wb(i.a);s.a<s.c.c.length;)(o=BB(n0(s),10)).p=u++,g[o.p]=MGn(o,e),o.k==(uSn(),Put)&&hon(o,(hWn(),plt),g[o.p]);SQ(),m$(i.a,new Gd(g)),r_n(d,l,a,!0),++a}HSn(t)}function WGn(n,t){var e,i,r,c,a,u,o,s,h;if(5!=t.e){if(null!=(s=t).b&&null!=n.b){for(T$n(n),qHn(n),T$n(s),qHn(s),e=x8(ANt,hQn,25,n.b.length+s.b.length,15,1),h=0,i=0,a=0;i<n.b.length&&a<s.b.length;)if(r=n.b[i],c=n.b[i+1],u=s.b[a],o=s.b[a+1],c<u)e[h++]=n.b[i++],e[h++]=n.b[i++];else if(c>=u&&r<=o)u<=r&&c<=o?i+=2:u<=r?(n.b[i]=o+1,a+=2):c<=o?(e[h++]=r,e[h++]=u-1,i+=2):(e[h++]=r,e[h++]=u-1,n.b[i]=o+1,a+=2);else{if(!(o<r))throw Hp(new dy("Token#subtractRanges(): Internal Error: ["+n.b[i]+","+n.b[i+1]+"] - ["+s.b[a]+","+s.b[a+1]+"]"));a+=2}for(;i<n.b.length;)e[h++]=n.b[i++],e[h++]=n.b[i++];n.b=x8(ANt,hQn,25,h,15,1),aHn(e,0,n.b,0,h)}}else kGn(n,t)}function VGn(n){var t,e,i,r,c,a,u;if(!n.A.dc()){if(n.A.Hc((mdn(),KIt))&&(BB(oV(n.b,(kUn(),sIt)),124).k=!0,BB(oV(n.b,SIt),124).k=!0,t=n.q!=(QEn(),WCt)&&n.q!=XCt,Nl(BB(oV(n.b,oIt),124),t),Nl(BB(oV(n.b,CIt),124),t),Nl(n.g,t),n.A.Hc(_It)&&(BB(oV(n.b,sIt),124).j=!0,BB(oV(n.b,SIt),124).j=!0,BB(oV(n.b,oIt),124).k=!0,BB(oV(n.b,CIt),124).k=!0,n.g.k=!0)),n.A.Hc(RIt))for(n.a.j=!0,n.a.k=!0,n.g.j=!0,n.g.k=!0,u=n.B.Hc((n_n(),XIt)),c=0,a=(r=tpn()).length;c<a;++c)i=r[c],(e=BB(oV(n.i,i),306))&&(agn(i)?(e.j=!0,e.k=!0):(e.j=!u,e.k=!u));n.A.Hc(DIt)&&n.B.Hc((n_n(),UIt))&&(n.g.j=!0,n.g.j=!0,n.a.j||(n.a.j=!0,n.a.k=!0,n.a.e=!0))}}function QGn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d;for(e=new Wb(n.e.b);e.a<e.c.c.length;)for(r=new Wb(BB(n0(e),29).a);r.a<r.c.c.length;)if(i=BB(n0(r),10),o=(f=n.i[i.p]).a.e,u=f.d.e,i.n.b=o,d=u-o-i.o.b,t=AHn(i),bvn(),h=(i.q?i.q:(SQ(),SQ(),het))._b((HXn(),Rgt))?BB(mMn(i,Rgt),197):BB(mMn(vW(i),Kgt),197),t&&(h==fvt||h==hvt)&&(i.o.b+=d),t&&(h==bvt||h==fvt||h==hvt)){for(b=new Wb(i.j);b.a<b.c.c.length;)l=BB(n0(b),11),(kUn(),bIt).Hc(l.j)&&(s=BB(RX(n.k,l),121),l.n.b=s.e-o);for(a=new Wb(i.b);a.a<a.c.c.length;)c=BB(n0(a),70),(w=BB(mMn(i,$gt),21)).Hc((n$n(),NCt))?c.n.b+=d:w.Hc(xCt)&&(c.n.b+=d/2);(h==fvt||h==hvt)&&abn(i,(kUn(),SIt)).Jc(new ag(d))}}function YGn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(!n.b)return!1;for(a=null,l=null,r=1,(o=new H8(null,null)).a[1]=n.b,f=o;f.a[r];)s=r,u=l,l=f,f=f.a[r],r=(i=n.a.ue(t,f.d))<0?0:1,0==i&&(!e.c||cV(f.e,e.d))&&(a=f),f&&f.b||Vy(f.a[r])||(Vy(f.a[1-r])?l=l.a[s]=wrn(f,r):Vy(f.a[1-r])||(b=l.a[1-s])&&(Vy(b.a[1-s])||Vy(b.a[s])?(c=u.a[1]==l?1:0,Vy(b.a[s])?u.a[c]=r2(l,s):Vy(b.a[1-s])&&(u.a[c]=wrn(l,s)),f.b=u.a[c].b=!0,u.a[c].a[0].b=!1,u.a[c].a[1].b=!1):(l.b=!1,b.b=!0,f.b=!0)));return a&&(e.b=!0,e.d=a.e,f!=a&&(bMn(n,o,a,h=new H8(f.d,f.e)),l==a&&(l=h)),l.a[l.a[1]==f?1:0]=f.a[f.a[0]?0:1],--n.c),n.b=o.a[1],n.b&&(n.b.b=!1),e.b}function JGn(n){var t,i,r,c,a,u,o,s,h,f,l,b;for(c=new Wb(n.a.a.b);c.a<c.c.c.length;)for(s=(r=BB(n0(c),57)).c.Kc();s.Ob();)o=BB(s.Pb(),57),r.a!=o.a&&(l=dA(n.a.d)?n.a.g.Oe(r,o):n.a.g.Pe(r,o),a=r.b.a+r.d.b+l-o.b.a,a=e.Math.ceil(a),a=e.Math.max(0,a),Z7(r,o)?(u=AN(new qv,n.d),t=(h=CJ(e.Math.ceil(o.b.a-r.b.a)))-(o.b.a-r.b.a),i=r,(f=f3(r).a)||(f=f3(o).a,t=-t,i=o),f&&(i.b.a-=t,f.n.a-=t),UNn(aM(cM(uM(rM(new Hv,e.Math.max(0,h)),1),u),n.c[r.a.d])),UNn(aM(cM(uM(rM(new Hv,e.Math.max(0,-h)),1),u),n.c[o.a.d]))):(b=1,(cL(r.g,145)&&cL(o.g,10)||cL(o.g,145)&&cL(r.g,10))&&(b=2),UNn(aM(cM(uM(rM(new Hv,CJ(a)),b),n.c[r.a.d]),n.c[o.a.d]))))}function ZGn(n,t,i){var r,c,a,u,o,s,h,f,l,b;if(i)for(r=-1,f=new M2(t,0);f.b<f.d.gc();){if(Px(f.b<f.d.gc()),o=BB(f.d.Xb(f.c=f.b++),10),null==(l=n.c[o.c.p][o.p].a)){for(u=r+1,a=new M2(t,f.b);a.b<a.d.gc();)if(null!=(b=wL(n,(Px(a.b<a.d.gc()),BB(a.d.Xb(a.c=a.b++),10))).a)){kW(b),u=b;break}l=(r+u)/2,n.c[o.c.p][o.p].a=l,n.c[o.c.p][o.p].d=(kW(l),l),n.c[o.c.p][o.p].b=1}kW(l),r=l}else{for(c=0,h=new Wb(t);h.a<h.c.c.length;)o=BB(n0(h),10),null!=n.c[o.c.p][o.p].a&&(c=e.Math.max(c,Gy(n.c[o.c.p][o.p].a)));for(c+=2,s=new Wb(t);s.a<s.c.c.length;)o=BB(n0(s),10),null==n.c[o.c.p][o.p].a&&(l=H$n(n.i,24)*uYn*c-1,n.c[o.c.p][o.p].a=l,n.c[o.c.p][o.p].d=l,n.c[o.c.p][o.p].b=1)}}function nzn(){RO(BAt,new ts),RO(KAt,new ls),RO(qAt,new Es),RO(HAt,new Is),RO(GAt,new Os),RO(XAt,new As),RO(WAt,new $s),RO(HOt,new Ls),RO(BOt,new zo),RO(qOt,new Uo),RO(LOt,new Xo),RO(QAt,new Wo),RO(GOt,new Vo),RO(YAt,new Qo),RO(JAt,new Yo),RO(FAt,new Jo),RO(_At,new Zo),RO(X$t,new ns),RO(VAt,new es),RO(O$t,new is),RO(ktt,new rs),RO(Gk(NNt,1),new cs),RO(Ttt,new as),RO(Stt,new us),RO(mtt,new os),RO(_Nt,new ss),RO(Ptt,new hs),RO(uAt,new fs),RO(yAt,new bs),RO(oLt,new ws),RO($$t,new ds),RO(Ctt,new gs),RO(Att,new ps),RO($nt,new vs),RO(Rtt,new ms),RO(Nnt,new ys),RO(iLt,new ks),RO(FNt,new js),RO(_tt,new Ts),RO(Qtt,new Ms),RO(sAt,new Ss),RO(BNt,new Ps)}function tzn(n,t,e){var i,r,c,a,u,o,s,h,f;for(!e&&(e=Gun(t.q.getTimezoneOffset())),r=6e4*(t.q.getTimezoneOffset()-e.a),o=u=new PD(rbn(fan(t.q.getTime()),r)),u.q.getTimezoneOffset()!=t.q.getTimezoneOffset()&&(r>0?r-=864e5:r+=864e5,o=new PD(rbn(fan(t.q.getTime()),r))),h=new Ik,s=n.a.length,c=0;c<s;)if((i=fV(n.a,c))>=97&&i<=122||i>=65&&i<=90){for(a=c+1;a<s&&fV(n.a,a)==i;++a);aWn(h,i,a-c,u,o,e),c=a}else if(39==i){if(++c<s&&39==fV(n.a,c)){h.a+="'",++c;continue}for(f=!1;!f;){for(a=c;a<s&&39!=fV(n.a,a);)++a;if(a>=s)throw Hp(new _y("Missing trailing '"));a+1<s&&39==fV(n.a,a+1)?++a:f=!0,oO(h,fx(n.a,c,a)),c=a+1}}else h.a+=String.fromCharCode(i),++c;return h.a}function ezn(n){var t,e,i,r,c,a,u,o;for(t=null,i=new Wb(n);i.a<i.c.c.length;)Gy(lL((e=BB(n0(i),233)).g,e.d[0]).a),e.b=null,e.e&&e.e.gc()>0&&0==e.c&&(!t&&(t=new Np),t.c[t.c.length]=e);if(t)for(;0!=t.c.length;){if((e=BB(s6(t,0),233)).b&&e.b.c.length>0)for(!e.b&&(e.b=new Np),c=new Wb(e.b);c.a<c.c.c.length;)if(zy(lL((r=BB(n0(c),233)).g,r.d[0]).a)==zy(lL(e.g,e.d[0]).a)){if(E7(n,r,0)>E7(n,e,0))return new rI(r,e)}else if(Gy(lL(r.g,r.d[0]).a)>Gy(lL(e.g,e.d[0]).a))return new rI(r,e);for(u=(!e.e&&(e.e=new Np),e.e).Kc();u.Ob();)!(a=BB(u.Pb(),233)).b&&(a.b=new Np),LZ(0,(o=a.b).c.length),MS(o.c,0,e),a.c==o.c.length&&(t.c[t.c.length]=a)}return null}function izn(n,t){var e,i,r,c,a,u;if(null==n)return zWn;if(null!=t.a.zc(n,t))return"[...]";for(e=new $an(FWn,"[","]"),c=0,a=(r=n).length;c<a;++c)null!=(i=r[c])&&0!=(4&tsn(i).i)?!Array.isArray(i)||(u=vnn(i))>=14&&u<=16?cL(i,177)?b6(e,RCn(BB(i,177))):cL(i,190)?b6(e,JEn(BB(i,190))):cL(i,195)?b6(e,kSn(BB(i,195))):cL(i,2012)?b6(e,ZEn(BB(i,2012))):cL(i,48)?b6(e,DCn(BB(i,48))):cL(i,364)?b6(e,gIn(BB(i,364))):cL(i,832)?b6(e,xCn(BB(i,832))):cL(i,104)&&b6(e,NCn(BB(i,104))):t.a._b(i)?(e.a?oO(e.a,e.b):e.a=new lN(e.d),aO(e.a,"[...]")):b6(e,izn(een(i),new $q(t))):b6(e,null==i?zWn:Bbn(i));return e.a?0==e.e.length?e.a.a:e.a.a+""+e.e:e.c}function rzn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g;for(w=qSn(cDn(t,!1,!1)),r&&(w=Jon(w)),g=Gy(MD(ZAn(t,(Epn(),pct)))),Px(0!=w.b),b=BB(w.a.a.c,8),h=BB(Dpn(w,1),8),w.b>2?(gun(s=new Np,new s1(w,1,w.b)),qan(d=new EAn(XXn(s,g+n.a)),t),i.c[i.c.length]=d):d=BB(RX(n.b,r?PMn(t):OMn(t)),266),u=PMn(t),r&&(u=OMn(t)),a=iPn(b,u),o=g+n.a,a.a?(o+=e.Math.abs(b.b-h.b),l=new xC(h.a,(h.b+b.b)/2)):(o+=e.Math.abs(b.a-h.a),l=new xC((h.a+b.a)/2,h.b)),VW(r?n.d:n.c,t,new Imn(d,a,l,o)),VW(n.b,t,d),!t.n&&(t.n=new eU(zOt,t,1,7)),f=new AL(t.n);f.e!=f.i.gc();)c=JRn(n,BB(kpn(f),137),!0,0,0),i.c[i.c.length]=c}function czn(n){var t,i,r,c,a,u,o,s,h;for(s=new Np,u=new Np,a=new Wb(n);a.a<a.c.c.length;)Vl(r=BB(n0(a),112),r.f.c.length),Ql(r,r.k.c.length),0==r.d&&(s.c[s.c.length]=r),0==r.i&&0==r.e.b&&(u.c[u.c.length]=r);for(i=-1;0!=s.c.length;)for(t=new Wb((r=BB(s6(s,0),112)).k);t.a<t.c.c.length;)Yl(h=BB(n0(t),129).b,e.Math.max(h.o,r.o+1)),i=e.Math.max(i,h.o),Vl(h,h.d-1),0==h.d&&(s.c[s.c.length]=h);if(i>-1){for(c=new Wb(u);c.a<c.c.c.length;)(r=BB(n0(c),112)).o=i;for(;0!=u.c.length;)for(t=new Wb((r=BB(s6(u,0),112)).f);t.a<t.c.c.length;)(o=BB(n0(t),129).a).e.b>0||(Yl(o,e.Math.min(o.o,r.o-1)),Ql(o,o.i-1),0==o.i&&(u.c[u.c.length]=o))}}function azn(n,t,e){var i,r,c,a,u;if(u=n.c,!t&&(t=L$t),n.c=t,0!=(4&n.Db)&&0==(1&n.Db)&&(a=new nU(n,1,2,u,n.c),e?e.Ei(a):e=a),u!=t)if(cL(n.Cb,284))n.Db>>16==-10?e=BB(n.Cb,284).nk(t,e):n.Db>>16==-15&&(!t&&(gWn(),t=l$t),!u&&(gWn(),u=l$t),n.Cb.nh()&&(a=new N7(n.Cb,1,13,u,t,uvn(H7(BB(n.Cb,59)),n),!1),e?e.Ei(a):e=a));else if(cL(n.Cb,88))n.Db>>16==-23&&(cL(t,88)||(gWn(),t=d$t),cL(u,88)||(gWn(),u=d$t),n.Cb.nh()&&(a=new N7(n.Cb,1,10,u,t,uvn(a4(BB(n.Cb,26)),n),!1),e?e.Ei(a):e=a));else if(cL(n.Cb,444))for(!(c=BB(n.Cb,836)).b&&(c.b=new Tp(new xm)),r=new Mp(new usn(new Pb(c.b.a).a));r.a.b;)e=azn(i=BB(ten(r.a).cd(),87),kLn(i,c),e);return e}function uzn(n,t){var e,i,r,c,a,u,o,s,h,f,l;for(a=qy(TD(ZAn(n,(HXn(),wgt)))),l=BB(ZAn(n,cpt),21),o=!1,s=!1,f=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));!(f.e==f.i.gc()||o&&s);){for(c=BB(kpn(f),118),u=0,r=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!c.d&&(c.d=new hK(_Ot,c,8,5)),c.d),(!c.e&&(c.e=new hK(_Ot,c,7,4)),c.e)])));dAn(r)&&(i=BB(U5(r),79),h=a&&QIn(i)&&qy(TD(ZAn(i,dgt))),e=bqn((!i.b&&(i.b=new hK(KOt,i,4,7)),i.b),c)?n==JJ(PTn(BB(Wtn((!i.c&&(i.c=new hK(KOt,i,5,8)),i.c),0),82))):n==JJ(PTn(BB(Wtn((!i.b&&(i.b=new hK(KOt,i,4,7)),i.b),0),82))),!((h||e)&&++u>1)););(u>0||l.Hc((lIn(),eIt))&&(!c.n&&(c.n=new eU(zOt,c,1,7)),c.n).i>0)&&(o=!0),u>1&&(s=!0)}o&&t.Fc((bDn(),lft)),s&&t.Fc((bDn(),bft))}function ozn(n){var t,i,r,c,a,u,o,s,h,f,l,b;if((b=BB(ZAn(n,(sWn(),KSt)),21)).dc())return null;if(o=0,u=0,b.Hc((mdn(),KIt))){for(f=BB(ZAn(n,uPt),98),r=2,i=2,c=2,a=2,t=JJ(n)?BB(ZAn(JJ(n),bSt),103):BB(ZAn(n,bSt),103),h=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));h.e!=h.i.gc();)if(s=BB(kpn(h),118),(l=BB(ZAn(s,wPt),61))==(kUn(),PIt)&&(l=OFn(s,t),Ypn(s,wPt,l)),f==(QEn(),XCt))switch(l.g){case 1:r=e.Math.max(r,s.i+s.g);break;case 2:i=e.Math.max(i,s.j+s.f);break;case 3:c=e.Math.max(c,s.i+s.g);break;case 4:a=e.Math.max(a,s.j+s.f)}else switch(l.g){case 1:r+=s.g+2;break;case 2:i+=s.f+2;break;case 3:c+=s.g+2;break;case 4:a+=s.f+2}o=e.Math.max(r,c),u=e.Math.max(i,a)}return KUn(n,o,u,!0,!0)}function szn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(m=BB(P4(ytn(AV(new Rq(null,new w1(t.d,16)),new $d(i)),new Ld(i)),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)]))),15),l=DWn,f=_Vn,s=new Wb(t.b.j);s.a<s.c.c.length;)(o=BB(n0(s),11)).j==i&&(l=e.Math.min(l,o.p),f=e.Math.max(f,o.p));if(l==DWn)for(u=0;u<m.gc();u++)g9(BB(m.Xb(u),101),i,u);else for(Zq(y=x8(ANt,hQn,25,c.length,15,1),y.length),v=m.Kc();v.Ob();){for(p=BB(v.Pb(),101),a=BB(RX(n.b,p),177),h=0,g=l;g<=f;g++)a[g]&&(h=e.Math.max(h,r[g]));if(p.i){for(w=p.i.c,k=new Rv,b=0;b<c.length;b++)c[w][b]&&TU(k,iln(y[b]));for(;FT(k,iln(h));)++h}for(g9(p,i,h),d=l;d<=f;d++)a[d]&&(r[d]=h+1);p.i&&(y[p.i.c]=h)}}function hzn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d;for(c=null,r=new Wb(t.a);r.a<r.c.c.length;)AHn(i=BB(n0(r),10))?(h=new GV(i,!0,o=AN(oM(new qv,i),n.f),s=AN(oM(new qv,i),n.f)),f=i.o.b,bvn(),b=1e4,(l=(i.q?i.q:(SQ(),SQ(),het))._b((HXn(),Rgt))?BB(mMn(i,Rgt),197):BB(mMn(vW(i),Kgt),197))==hvt&&(b=1),w=UNn(aM(cM(rM(uM(new Hv,b),CJ(e.Math.ceil(f))),o),s)),l==fvt&&TU(n.d,w),O_n(n,ean(abn(i,(kUn(),CIt))),h),O_n(n,abn(i,oIt),h),a=h):(d=AN(oM(new qv,i),n.f),JT(AV(new Rq(null,new w1(i.j,16)),new Bc),new tC(n,d)),a=new GV(i,!1,d,d)),n.i[i.p]=a,c&&(u=c.c.d.a+K$(n.n,c.c,i)+i.d.d,c.b||(u+=c.c.o.b),UNn(aM(cM(uM(rM(new Hv,CJ(e.Math.ceil(u))),0),c.d),a.a))),c=a}function fzn(n,t){var i,r,c,a,u,o,s,f,l,b,w,d,g;for(OTn(t,"Label dummy insertions",1),b=new Np,u=Gy(MD(mMn(n,(HXn(),jpt)))),f=Gy(MD(mMn(n,Spt))),l=BB(mMn(n,Udt),103),w=new Wb(n.a);w.a<w.c.c.length;)for(a=new oz(ZL(lbn(BB(n0(w),10)).a.Kc(),new h));dAn(a);)if((c=BB(U5(a),17)).c.i!=c.d.i&&tL(c.b,nst)){for(i=oLn(n,c,g=Etn(c),d=sx(c.b.c.length)),b.c[b.c.length]=i,r=i.o,o=new M2(c.b,0);o.b<o.d.gc();)Px(o.b<o.d.gc()),GI(mMn(s=BB(o.d.Xb(o.c=o.b++),70),Ydt))===GI((Rtn(),zPt))&&(l==(Ffn(),HPt)||l==KPt?(r.a+=s.o.a+f,r.b=e.Math.max(r.b,s.o.b)):(r.a=e.Math.max(r.a,s.o.a),r.b+=s.o.b+f),d.c[d.c.length]=s,fW(o));l==(Ffn(),HPt)||l==KPt?(r.a-=f,r.b+=u+g):r.b+=u-f+g}gun(n.a,b),HSn(t)}function lzn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w;for(l=XDn(n,t,a=new dOn(t)),w=e.Math.max(Gy(MD(mMn(t,(HXn(),agt)))),1),f=new Wb(l.a);f.a<f.c.c.length;)h=BB(n0(f),46),s=Bgn(BB(h.a,8),BB(h.b,8),w),zH(i,new xC(s.c,s.d)),zH(i,_x(new xC(s.c,s.d),s.b,0)),zH(i,_x(new xC(s.c,s.d),0,s.a)),zH(i,_x(new xC(s.c,s.d),s.b,s.a));switch(b=a.d,o=Bgn(BB(l.b.a,8),BB(l.b.b,8),w),b==(kUn(),CIt)||b==oIt?(r.c[b.g]=e.Math.min(r.c[b.g],o.d),r.b[b.g]=e.Math.max(r.b[b.g],o.d+o.a)):(r.c[b.g]=e.Math.min(r.c[b.g],o.c),r.b[b.g]=e.Math.max(r.b[b.g],o.c+o.b)),c=KQn,u=a.c.i.d,b.g){case 4:c=u.c;break;case 2:c=u.b;break;case 1:c=u.a;break;case 3:c=u.d}return r.a[b.g]=e.Math.max(r.a[b.g],c),a}function bzn(n){var t,e,i,r;if(-1!=(t=GO(e=null!=n.D?n.D:n.B,YTn(91)))){i=e.substr(0,t),r=new Sk;do{r.a+="["}while(-1!=(t=lx(e,91,++t)));mK(i,$Wn)?r.a+="Z":mK(i,S9n)?r.a+="B":mK(i,P9n)?r.a+="C":mK(i,C9n)?r.a+="D":mK(i,I9n)?r.a+="F":mK(i,O9n)?r.a+="I":mK(i,A9n)?r.a+="J":mK(i,$9n)?r.a+="S":(r.a+="L",r.a+=""+i,r.a+=";");try{return null}catch(c){if(!cL(c=lun(c),60))throw Hp(c)}}else if(-1==GO(e,YTn(46))){if(mK(e,$Wn))return $Nt;if(mK(e,S9n))return NNt;if(mK(e,P9n))return ONt;if(mK(e,C9n))return xNt;if(mK(e,I9n))return DNt;if(mK(e,O9n))return ANt;if(mK(e,A9n))return LNt;if(mK(e,$9n))return RNt}return null}function wzn(n,t,e){var i,r,c,a,u,o,s,h;for(qan(s=new $vn(e),t),hon(s,(hWn(),dlt),t),s.o.a=t.g,s.o.b=t.f,s.n.a=t.i,s.n.b=t.j,WB(e.a,s),VW(n.a,t,s),(0!=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i||qy(TD(ZAn(t,(HXn(),wgt)))))&&hon(s,_ft,(hN(),!0)),o=BB(mMn(e,Zft),21),(h=BB(mMn(s,(HXn(),ept)),98))==(QEn(),YCt)?hon(s,ept,QCt):h!=QCt&&o.Fc((bDn(),dft)),i=BB(mMn(e,Udt),103),u=new AL((!t.c&&(t.c=new eU(XOt,t,9,9)),t.c));u.e!=u.i.gc();)qy(TD(ZAn(a=BB(kpn(u),118),Ggt)))||Zzn(n,a,s,o,i,h);for(c=new AL((!t.n&&(t.n=new eU(zOt,t,1,7)),t.n));c.e!=c.i.gc();)!qy(TD(ZAn(r=BB(kpn(c),137),Ggt)))&&r.a&&WB(s.b,Hhn(r));return qy(TD(mMn(s,Tdt)))&&o.Fc((bDn(),hft)),qy(TD(mMn(s,bgt)))&&(o.Fc((bDn(),wft)),o.Fc(bft),hon(s,ept,QCt)),s}function dzn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T;u=BB(RX(t.c,n),459),g=t.a.c,o=t.a.c+t.a.b,a=(E=u.f)<(T=u.a),b=new xC(g,E),p=new xC(o,T),w=new xC(r=(g+o)/2,E),v=new xC(r,T),c=eNn(n,E,T),y=g1(t.B),k=new xC(r,c),j=g1(t.D),e=lon(Pun(Gk(PMt,1),sVn,8,0,[y,k,j])),f=!1,(d=t.B.i)&&d.c&&u.d&&((s=a&&d.p<d.c.a.c.length-1||!a&&d.p>0)?s&&(h=d.p,a?++h:--h,f=!(cNn(i=ion(BB(xq(d.c.a,h),10)),y,e[0])||Bz(i,y,e[0]))):f=!0),l=!1,(m=t.D.i)&&m.c&&u.e&&(a&&m.p>0||!a&&m.p<m.c.a.c.length-1?(h=m.p,a?--h:++h,l=!(cNn(i=ion(BB(xq(m.c.a,h),10)),e[0],j)||Bz(i,e[0],j))):l=!0),f&&l&&DH(n.a,k),f||nin(n.a,Pun(Gk(PMt,1),sVn,8,0,[b,w])),l||nin(n.a,Pun(Gk(PMt,1),sVn,8,0,[v,p]))}function gzn(n,t){var e,i,r,c,a,u,o;if(cL(n.Ug(),160)?(gzn(BB(n.Ug(),160),t),t.a+=" > "):t.a+="Root ",mK((e=n.Tg().zb).substr(0,3),"Elk")?oO(t,e.substr(3)):t.a+=""+e,r=n.zg())oO((t.a+=" ",t),r);else if(cL(n,354)&&(o=BB(n,137).a))oO((t.a+=" ",t),o);else{for(c=new AL(n.Ag());c.e!=c.i.gc();)if(o=BB(kpn(c),137).a)return void oO((t.a+=" ",t),o);if(cL(n,352)&&(!(i=BB(n,79)).b&&(i.b=new hK(KOt,i,4,7)),0!=i.b.i&&(!i.c&&(i.c=new hK(KOt,i,5,8)),0!=i.c.i))){for(t.a+=" (",a=new cx((!i.b&&(i.b=new hK(KOt,i,4,7)),i.b));a.e!=a.i.gc();)a.e>0&&(t.a+=FWn),gzn(BB(kpn(a),160),t);for(t.a+=e1n,u=new cx((!i.c&&(i.c=new hK(KOt,i,5,8)),i.c));u.e!=u.i.gc();)u.e>0&&(t.a+=FWn),gzn(BB(kpn(u),160),t);t.a+=")"}}}function pzn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(c=BB(mMn(n,(hWn(),dlt)),79)){for(i=n.a,UR(r=new wA(e),$jn(n)),wan(n.d.i,n.c.i)?(l=n.c,XR(f=Aon(Pun(Gk(PMt,1),sVn,8,0,[l.n,l.a])),e)):f=g1(n.c),r5(i,f,i.a,i.a.a),b=g1(n.d),null!=mMn(n,Rlt)&&UR(b,BB(mMn(n,Rlt),8)),r5(i,b,i.c.b,i.c),Ztn(i,r),Lin(a=cDn(c,!0,!0),BB(Wtn((!c.b&&(c.b=new hK(KOt,c,4,7)),c.b),0),82)),Nin(a,BB(Wtn((!c.c&&(c.c=new hK(KOt,c,5,8)),c.c),0),82)),VFn(i,a),h=new Wb(n.b);h.a<h.c.c.length;)s=BB(n0(h),70),Sen(u=BB(mMn(s,dlt),137),s.o.a),Men(u,s.o.b),SA(u,s.n.a+r.a,s.n.b+r.b),Ypn(u,(Irn(),tst),TD(mMn(s,tst)));(o=BB(mMn(n,(HXn(),vgt)),74))?(Ztn(o,r),Ypn(c,vgt,o)):Ypn(c,vgt,null),t==(Mbn(),JPt)?Ypn(c,Zdt,JPt):Ypn(c,Zdt,null)}}function vzn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(b=t.c.length,l=0,f=new Wb(n.b);f.a<f.c.c.length;)if(0!=(p=(h=BB(n0(f),29)).a).c.length){for(s=0,v=null,r=BB(n0(g=new Wb(p)),10),c=null;r;){if((c=BB(xq(t,r.p),257)).c>=0){for(o=null,u=new M2(h.a,s+1);u.b<u.d.gc()&&(Px(u.b<u.d.gc()),a=BB(u.d.Xb(u.c=u.b++),10),!((o=BB(xq(t,a.p),257)).d==c.d&&o.c<c.c));)o=null;o&&(v&&(c5(i,r.p,iln(BB(xq(i,r.p),19).a-1)),BB(xq(e,v.p),15).Mc(c)),c=wTn(c,r,b++),t.c[t.c.length]=c,WB(e,new Np),v?(BB(xq(e,v.p),15).Fc(c),WB(i,iln(1))):WB(i,iln(0)))}w=null,g.a<g.c.c.length&&(w=BB(n0(g),10),d=BB(xq(t,w.p),257),BB(xq(e,r.p),15).Fc(d),c5(i,w.p,iln(BB(xq(i,w.p),19).a+1))),c.d=l,c.c=s++,v=r,r=w}++l}}function mzn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;return o=n,h=XR(new xC(t.a,t.b),n),s=i,f=XR(new xC(r.a,r.b),i),l=o.a,g=o.b,w=s.a,v=s.b,b=h.a,p=h.b,c=(d=f.a)*p-b*(m=f.b),h$(),rin(A3n),!(e.Math.abs(0-c)<=A3n||0==c||isNaN(0)&&isNaN(c))&&(a=1/c*((l-w)*p-(g-v)*b),u=1/c*-(-(l-w)*m+(g-v)*d),rin(A3n),(e.Math.abs(0-a)<=A3n||0==a||isNaN(0)&&isNaN(a)?0:0<a?-1:0>a?1:zO(isNaN(0),isNaN(a)))<0&&(rin(A3n),(e.Math.abs(a-1)<=A3n||1==a||isNaN(a)&&isNaN(1)?0:a<1?-1:a>1?1:zO(isNaN(a),isNaN(1)))<0)&&(rin(A3n),(e.Math.abs(0-u)<=A3n||0==u||isNaN(0)&&isNaN(u)?0:0<u?-1:0>u?1:zO(isNaN(0),isNaN(u)))<0)&&(rin(A3n),(e.Math.abs(u-1)<=A3n||1==u||isNaN(u)&&isNaN(1)?0:u<1?-1:u>1?1:zO(isNaN(u),isNaN(1)))<0))}function yzn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j;for(f=new hW(new iw(n));f.b!=f.c.a.d;)for(u=BB((h=s9(f)).d,56),t=BB(h.e,56),d=0,y=(null==(a=u.Tg()).i&&qFn(a),a.i).length;d<y;++d)if(null==a.i&&qFn(a),c=a.i,(s=d>=0&&d<c.length?c[d]:null).Ij()&&!s.Jj())if(cL(s,99))0==((o=BB(s,18)).Bb&h6n)&&(!(j=Cvn(o))||0==(j.Bb&h6n))&&mBn(n,o,u,t);else if(ZM(),BB(s,66).Oj()&&(e=BB((k=s)?BB(t,49).xh(k):null,153)))for(b=BB(u.ah(s),153),i=e.gc(),g=0,w=b.gc();g<w;++g)if(cL(l=b.il(g),99)){if(null==(r=lnn(n,m=b.jl(g)))&&null!=m){if(v=BB(l,18),!n.b||0!=(v.Bb&h6n)||Cvn(v))continue;r=m}if(!e.dl(l,r))for(p=0;p<i;++p)if(e.il(p)==l&&GI(e.jl(p))===GI(r)){e.ii(e.gc()-1,p),--i;break}}else e.dl(b.il(g),b.jl(g))}function kzn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w,d,g,p,v,m;if(p=QBn(t,i,n.g),c.n&&c.n&&a&&y0(c,o2(a),(Bsn(),uOt)),n.b)for(g=0;g<p.c.length;g++)l1(g,p.c.length),f=BB(p.c[g],200),0!=g&&(l1(g-1,p.c.length),ghn(f,(b=BB(p.c[g-1],200)).f+b.b+n.g)),mXn(g,p,i,n.g),Hkn(n,f),c.n&&a&&y0(c,o2(a),(Bsn(),uOt));else for(d=new Wb(p);d.a<d.c.c.length;)for(h=new Wb((w=BB(n0(d),200)).a);h.a<h.c.c.length;)xcn(v=new KJ((s=BB(n0(h),187)).s,s.t,n.g),s),WB(w.d,v);return zmn(n,p),c.n&&c.n&&a&&y0(c,o2(a),(Bsn(),uOt)),m=e.Math.max(n.d,r.a-(u.b+u.c)),o=(l=e.Math.max(n.c,r.b-(u.d+u.a)))-n.c,n.e&&n.f&&(m/l<n.a?m=l*n.a:o+=m/n.a-l),n.e&&Odn(p,m,o),c.n&&c.n&&a&&y0(c,o2(a),(Bsn(),uOt)),new eq(n.a,m,n.c+o,(YLn(),_Et))}function jzn(n){var t,i,r,c,a,u,o,s,h,f;for(n.j=x8(ANt,hQn,25,n.g,15,1),n.o=new Np,JT(wnn(new Rq(null,new w1(n.e.b,16)),new Wc),new ug(n)),n.a=x8($Nt,ZYn,25,n.b,16,1),$fn(new Rq(null,new w1(n.e.b,16)),new sg(n)),f=new Np,JT(AV(wnn(new Rq(null,new w1(n.e.b,16)),new Qc),new og(n)),new eC(n,f)),o=new Wb(f);o.a<o.c.c.length;)if(!((u=BB(n0(o),508)).c.length<=1))if(2!=u.c.length){if(!XEn(u)&&!NPn(u,new Vc))for(s=new Wb(u),r=null;s.a<s.c.c.length;)t=BB(n0(s),17),i=n.c[t.p],h=!r||s.a>=s.c.c.length?X3((uSn(),Cut),Put):X3((uSn(),Put),Put),h*=2,c=i.a.g,i.a.g=e.Math.max(c,c+(h-c)),a=i.b.g,i.b.g=e.Math.max(a,a+(h-a)),r=t}else zAn(u),AHn((l1(0,u.c.length),BB(u.c[0],17)).d.i)||WB(n.o,u)}function Ezn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(m=GB(n),o=new Np,s=(c=n.c.length)-1,h=c+1;0!=m.a.c;){for(;0!=e.b;)Px(0!=e.b),p=BB(Atn(e,e.a.a),112),$J(m.a,p),p.g=s--,NFn(p,t,e,i);for(;0!=t.b;)Px(0!=t.b),v=BB(Atn(t,t.a.a),112),$J(m.a,v),v.g=h++,NFn(v,t,e,i);for(u=_Vn,d=new Fb(new BR(new xN(new _b(m.a).a).b));aS(d.a.a);){if(w=BB(mx(d.a).cd(),112),!i&&w.b>0&&w.a<=0){o.c=x8(Ant,HWn,1,0,5,1),o.c[o.c.length]=w;break}(b=w.i-w.d)>=u&&(b>u&&(o.c=x8(Ant,HWn,1,0,5,1),u=b),o.c[o.c.length]=w)}0!=o.c.length&&(a=BB(xq(o,pvn(r,o.c.length)),112),$J(m.a,a),a.g=h++,NFn(a,t,e,i),o.c=x8(Ant,HWn,1,0,5,1))}for(g=n.c.length+1,l=new Wb(n);l.a<l.c.c.length;)(f=BB(n0(l),112)).g<c&&(f.g=f.g+g)}function Tzn(n,t){var e;if(n.e)throw Hp(new Fy((ED(git),AYn+git.k+$Yn)));if(!SS(n.a,t))throw Hp(new dy(LYn+t+NYn));if(t==n.d)return n;switch(e=n.d,n.d=t,e.g){case 0:switch(t.g){case 2:Hmn(n);break;case 1:Con(n),Hmn(n);break;case 4:nEn(n),Hmn(n);break;case 3:nEn(n),Con(n),Hmn(n)}break;case 2:switch(t.g){case 1:Con(n),RRn(n);break;case 4:nEn(n),Hmn(n);break;case 3:nEn(n),Con(n),Hmn(n)}break;case 1:switch(t.g){case 2:Con(n),RRn(n);break;case 4:Con(n),nEn(n),Hmn(n);break;case 3:Con(n),nEn(n),Con(n),Hmn(n)}break;case 4:switch(t.g){case 2:nEn(n),Hmn(n);break;case 1:nEn(n),Con(n),Hmn(n);break;case 3:Con(n),RRn(n)}break;case 3:switch(t.g){case 2:Con(n),nEn(n),Hmn(n);break;case 1:Con(n),nEn(n),Con(n),Hmn(n);break;case 4:Con(n),RRn(n)}}return n}function Mzn(n,t){var e;if(n.d)throw Hp(new Fy((ED(Yat),AYn+Yat.k+$Yn)));if(!PC(n.a,t))throw Hp(new dy(LYn+t+NYn));if(t==n.c)return n;switch(e=n.c,n.c=t,e.g){case 0:switch(t.g){case 2:Zon(n);break;case 1:Pon(n),Zon(n);break;case 4:tEn(n),Zon(n);break;case 3:tEn(n),Pon(n),Zon(n)}break;case 2:switch(t.g){case 1:Pon(n),KRn(n);break;case 4:tEn(n),Zon(n);break;case 3:tEn(n),Pon(n),Zon(n)}break;case 1:switch(t.g){case 2:Pon(n),KRn(n);break;case 4:Pon(n),tEn(n),Zon(n);break;case 3:Pon(n),tEn(n),Pon(n),Zon(n)}break;case 4:switch(t.g){case 2:tEn(n),Zon(n);break;case 1:tEn(n),Pon(n),Zon(n);break;case 3:Pon(n),KRn(n)}break;case 3:switch(t.g){case 2:Pon(n),tEn(n),Zon(n);break;case 1:Pon(n),tEn(n),Pon(n),Zon(n);break;case 4:Pon(n),KRn(n)}}return n}function Szn(n,t,i){var r,c,a,u,o,s,f,l;for(s=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));s.e!=s.i.gc();)for(c=new oz(ZL(dLn(o=BB(kpn(s),33)).a.Kc(),new h));dAn(c);){if(!(r=BB(U5(c),79)).b&&(r.b=new hK(KOt,r,4,7)),!(r.b.i<=1&&(!r.c&&(r.c=new hK(KOt,r,5,8)),r.c.i<=1)))throw Hp(new ck("Graph must not contain hyperedges."));if(!nAn(r)&&o!=PTn(BB(Wtn((!r.c&&(r.c=new hK(KOt,r,5,8)),r.c),0),82)))for(qan(f=new IR,r),hon(f,(Mrn(),sat),r),Rl(f,BB(qI(AY(i.f,o)),144)),Kl(f,BB(RX(i,PTn(BB(Wtn((!r.c&&(r.c=new hK(KOt,r,5,8)),r.c),0),82))),144)),WB(t.c,f),u=new AL((!r.n&&(r.n=new eU(zOt,r,1,7)),r.n));u.e!=u.i.gc();)qan(l=new m4(f,(a=BB(kpn(u),137)).a),a),hon(l,sat,a),l.e.a=e.Math.max(a.g,1),l.e.b=e.Math.max(a.f,1),_Bn(l),WB(t.d,l)}}function Pzn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(EJ(l=new eUn(n),!(t==(Ffn(),HPt)||t==KPt)),f=l.a,b=new bm,Dtn(),u=0,s=(c=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;u<s;++u)i=c[u],(h=fL(f,Git,i))&&(b.d=e.Math.max(b.d,h.Re()));for(a=0,o=(r=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;a<o;++a)i=r[a],(h=fL(f,Uit,i))&&(b.a=e.Math.max(b.a,h.Re()));for(p=0,m=(d=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;p<m;++p)(h=fL(f,d[p],Git))&&(b.b=e.Math.max(b.b,h.Se()));for(g=0,v=(w=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;g<v;++g)(h=fL(f,w[g],Uit))&&(b.c=e.Math.max(b.c,h.Se()));return b.d>0&&(b.d+=f.n.d,b.d+=f.d),b.a>0&&(b.a+=f.n.a,b.a+=f.d),b.b>0&&(b.b+=f.n.b,b.b+=f.d),b.c>0&&(b.c+=f.n.c,b.c+=f.d),b}function Czn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d;for(b=i.d,l=i.c,u=(a=new xC(i.f.a+i.d.b+i.d.c,i.f.b+i.d.d+i.d.a)).b,h=new Wb(n.a);h.a<h.c.c.length;)if((o=BB(n0(h),10)).k==(uSn(),Mut)){switch(r=BB(mMn(o,(hWn(),Qft)),61),c=BB(mMn(o,Yft),8),f=o.n,r.g){case 2:f.a=i.f.a+b.c-l.a;break;case 4:f.a=-l.a-b.b}switch(d=0,r.g){case 2:case 4:t==(QEn(),WCt)?(w=Gy(MD(mMn(o,Tlt))),f.b=a.b*w-BB(mMn(o,(HXn(),npt)),8).b,d=f.b+c.b,Jan(o,!1,!0)):t==XCt&&(f.b=Gy(MD(mMn(o,Tlt)))-BB(mMn(o,(HXn(),npt)),8).b,d=f.b+c.b,Jan(o,!1,!0))}u=e.Math.max(u,d)}for(i.f.b+=u-a.b,s=new Wb(n.a);s.a<s.c.c.length;)if((o=BB(n0(s),10)).k==(uSn(),Mut))switch(r=BB(mMn(o,(hWn(),Qft)),61),f=o.n,r.g){case 1:f.b=-l.b-b.d;break;case 3:f.b=i.f.b+b.a-l.b}}function Izn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j;for(r=BB(mMn(n,(qqn(),skt)),33),o=DWn,s=DWn,a=_Vn,u=_Vn,k=spn(n.b,0);k.b!=k.d.c;)w=(m=BB(b3(k),86)).e,d=m.f,o=e.Math.min(o,w.a-d.a/2),s=e.Math.min(s,w.b-d.b/2),a=e.Math.max(a,w.a+d.a/2),u=e.Math.max(u,w.b+d.b/2);for(l=new xC((b=BB(ZAn(r,(CAn(),Ikt)),116)).b-o,b.d-s),y=spn(n.b,0);y.b!=y.d.c;)cL(f=mMn(m=BB(b3(y),86),skt),239)&&SA(c=BB(f,33),(h=UR(m.e,l)).a-c.g/2,h.b-c.f/2);for(v=spn(n.a,0);v.b!=v.d.c;)p=BB(b3(v),188),(i=BB(mMn(p,skt),79))&&(r5(t=p.a,g=new wA(p.b.e),t.a,t.a.a),r5(t,j=new wA(p.c.e),t.c.b,t.c),ZMn(g,BB(Dpn(t,1),8),p.b.f),ZMn(j,BB(Dpn(t,t.b-2),8),p.c.f),VFn(t,cDn(i,!0,!0)));KUn(r,a-o+(b.b+b.c),u-s+(b.d+b.a),!1,!1)}function Ozn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;for(yR(o=new M2(s=n.b,0),new HX(n)),g=!1,c=1;o.b<o.d.gc();){for(Px(o.b<o.d.gc()),u=BB(o.d.Xb(o.c=o.b++),29),l1(c,s.c.length),b=BB(s.c[c],29),d=(w=a0(u.a)).c.length,l=new Wb(w);l.a<l.c.c.length;)PZ(h=BB(n0(l),10),b);if(g){for(f=W1(new fy(w),0);f.c.Sb();)for(r=new Wb(a0(fbn(h=BB(w5(f),10))));r.a<r.c.c.length;)tBn(i=BB(n0(r),17),!0),hon(n,(hWn(),qft),(hN(),!0)),e=iGn(n,i,d),t=BB(mMn(h,Rft),305),p=BB(xq(e,e.c.length-1),17),t.k=p.c.i,t.n=p,t.b=i.d.i,t.c=i;g=!1}else 0!=w.c.length&&(l1(0,w.c.length),BB(w.c[0],10).k==(uSn(),Tut)&&(g=!0,c=-1));++c}for(a=new M2(n.b,0);a.b<a.d.gc();)Px(a.b<a.d.gc()),0==BB(a.d.Xb(a.c=a.b++),29).a.c.length&&fW(a)}function Azn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;if((f=BB(BB(h6(n.r,t),21),84)).gc()<=2||t==(kUn(),oIt)||t==(kUn(),CIt))JUn(n,t);else{for(g=n.u.Hc((lIn(),cIt)),i=t==(kUn(),sIt)?(Dan(),Rrt):(Dan(),Nrt),v=t==sIt?(G7(),irt):(G7(),crt),r=Zk(H_(i),n.s),p=t==sIt?RQn:KQn,h=f.Kc();h.Ob();)!(o=BB(h.Pb(),111)).c||o.c.d.c.length<=0||(d=o.b.rf(),w=o.e,(b=(l=o.c).i).b=(a=l.n,l.e.a+a.b+a.c),b.a=(u=l.n,l.e.b+u.d+u.a),g?(b.c=w.a-(c=l.n,l.e.a+c.b+c.c)-n.s,g=!1):b.c=w.a+d.a+n.s,OY(v,uJn),l.f=v,l9(l,(J9(),Jit)),WB(r.d,new xG(b,kln(r,b))),p=t==sIt?e.Math.min(p,w.b):e.Math.max(p,w.b+o.b.rf().b));for(p+=t==sIt?-n.t:n.t,Pwn((r.e=p,r)),s=f.Kc();s.Ob();)!(o=BB(s.Pb(),111)).c||o.c.d.c.length<=0||((b=o.c.i).c-=o.e.a,b.d-=o.e.b)}}function $zn(n,t,i){var r;if(OTn(i,"StretchWidth layering",1),0!=t.a.c.length){for(n.c=t,n.t=0,n.u=0,n.i=RQn,n.g=KQn,n.d=Gy(MD(mMn(t,(HXn(),ypt)))),zpn(n),PAn(n),SAn(n),xjn(n),ddn(n),n.i=e.Math.max(1,n.i),n.g=e.Math.max(1,n.g),n.d=n.d/n.i,n.f=n.g/n.i,n.s=_vn(n),r=new HX(n.c),WB(n.c.b,r),n.r=a0(n.p),n.n=TJ(n.k,n.k.length);0!=n.r.c.length;)n.o=zhn(n),!n.o||Ton(n)&&0!=n.b.a.gc()?(xEn(n,r),r=new HX(n.c),WB(n.c.b,r),Frn(n.a,n.b),n.b.a.$b(),n.t=n.u,n.u=0):Ton(n)?(n.c.b.c=x8(Ant,HWn,1,0,5,1),r=new HX(n.c),WB(n.c.b,r),n.t=0,n.u=0,n.b.a.$b(),n.a.a.$b(),++n.f,n.r=a0(n.p),n.n=TJ(n.k,n.k.length)):(PZ(n.o,r),y7(n.r,n.o),TU(n.b,n.o),n.t=n.t-n.k[n.o.p]*n.d+n.j[n.o.p],n.u+=n.e[n.o.p]*n.d);t.a.c=x8(Ant,HWn,1,0,5,1),JPn(t.b),HSn(i)}else HSn(i)}function Lzn(n){var t,i,r,c;for(JT(AV(new Rq(null,new w1(n.a.b,16)),new yr),new kr),fEn(n),JT(AV(new Rq(null,new w1(n.a.b,16)),new jr),new Er),n.c==(Mbn(),JPt)&&(JT(AV(wnn(new Rq(null,new w1(new Cb(n.f),1)),new Tr),new Mr),new Md(n)),JT(AV($V(wnn(wnn(new Rq(null,new w1(n.d.b,16)),new Sr),new Pr),new Cr),new Ir),new Pd(n))),c=new xC(RQn,RQn),t=new xC(KQn,KQn),r=new Wb(n.a.b);r.a<r.c.c.length;)i=BB(n0(r),57),c.a=e.Math.min(c.a,i.d.c),c.b=e.Math.min(c.b,i.d.d),t.a=e.Math.max(t.a,i.d.c+i.d.b),t.b=e.Math.max(t.b,i.d.d+i.d.a);UR(kO(n.d.c),qx(new xC(c.a,c.b))),UR(kO(n.d.f),XR(new xC(t.a,t.b),c)),oNn(n,c,t),$U(n.f),$U(n.b),$U(n.g),$U(n.e),n.a.a.c=x8(Ant,HWn,1,0,5,1),n.a.b.c=x8(Ant,HWn,1,0,5,1),n.a=null,n.d=null}function Nzn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(i=new Np,w=new Wb(t.a);w.a<w.c.c.length;)if((l=(b=BB(n0(w),10)).e)&&(gun(i,Nzn(n,l,b)),EGn(n,l,b),BB(mMn(l,(hWn(),Zft)),21).Hc((bDn(),lft))))for(p=BB(mMn(b,(HXn(),ept)),98),f=BB(mMn(b,cpt),174).Hc((lIn(),eIt)),g=new Wb(b.j);g.a<g.c.c.length;)for(d=BB(n0(g),11),(r=BB(RX(n.b,d),10))||(hon(r=bXn(d,p,d.j,-(d.e.c.length-d.g.c.length),null,new Gj,d.o,BB(mMn(l,Udt),103),l),dlt,d),VW(n.b,d,r),WB(l.a,r)),c=BB(xq(r.j,0),11),s=new Wb(d.f);s.a<s.c.c.length;)o=BB(n0(s),70),(a=new qj).o.a=o.o.a,a.o.b=o.o.b,WB(c.f,a),f||(v=d.j,h=0,Hz(BB(mMn(b,cpt),21))&&(h=$In(o.n,o.o,d.o,0,v)),p==(QEn(),QCt)||(kUn(),bIt).Hc(v)?a.o.a=h:a.o.b=h);return BGn(n,t,e,i,u=new Np),e&&Cqn(n,t,e,u),u}function xzn(n,t,e){var i,r,c,a,u,o,s,h;if(!n.c[t.c.p][t.p].e){for(n.c[t.c.p][t.p].e=!0,n.c[t.c.p][t.p].b=0,n.c[t.c.p][t.p].d=0,n.c[t.c.p][t.p].a=null,h=new Wb(t.j);h.a<h.c.c.length;)for(s=BB(n0(h),11),o=(e?new Hw(s):new Gw(s)).Kc();o.Ob();)(a=(u=BB(o.Pb(),11)).i).c==t.c?a!=t&&(xzn(n,a,e),n.c[t.c.p][t.p].b+=n.c[a.c.p][a.p].b,n.c[t.c.p][t.p].d+=n.c[a.c.p][a.p].d):(n.c[t.c.p][t.p].d+=n.g[u.p],++n.c[t.c.p][t.p].b);if(c=BB(mMn(t,(hWn(),xft)),15))for(r=c.Kc();r.Ob();)i=BB(r.Pb(),10),t.c==i.c&&(xzn(n,i,e),n.c[t.c.p][t.p].b+=n.c[i.c.p][i.p].b,n.c[t.c.p][t.p].d+=n.c[i.c.p][i.p].d);n.c[t.c.p][t.p].b>0&&(n.c[t.c.p][t.p].d+=H$n(n.i,24)*uYn*.07000000029802322-.03500000014901161,n.c[t.c.p][t.p].a=n.c[t.c.p][t.p].d/n.c[t.c.p][t.p].b)}}function Dzn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w;for(l=new Wb(n);l.a<l.c.c.length;){for(nx((f=BB(n0(l),10)).n),nx(f.o),V6(f.f),VRn(f),aRn(f),w=new Wb(f.j);w.a<w.c.c.length;){for(nx((b=BB(n0(w),11)).n),nx(b.a),nx(b.o),qCn(b,amn(b.j)),(r=BB(mMn(b,(HXn(),ipt)),19))&&hon(b,ipt,iln(-r.a)),i=new Wb(b.g);i.a<i.c.c.length;){for(t=spn((e=BB(n0(i),17)).a,0);t.b!=t.d.c;)nx(BB(b3(t),8));if(a=BB(mMn(e,vgt),74))for(c=spn(a,0);c.b!=c.d.c;)nx(BB(b3(c),8));for(s=new Wb(e.b);s.a<s.c.c.length;)nx((u=BB(n0(s),70)).n),nx(u.o)}for(h=new Wb(b.f);h.a<h.c.c.length;)nx((u=BB(n0(h),70)).n),nx(u.o)}for(f.k==(uSn(),Mut)&&(hon(f,(hWn(),Qft),amn(BB(mMn(f,Qft),61))),wxn(f)),o=new Wb(f.b);o.a<o.c.c.length;)VRn(u=BB(n0(o),70)),nx(u.o),nx(u.n)}}function Rzn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y;for(n.e=t,u=nOn(t),m=new Np,i=new Wb(u);i.a<i.c.c.length;){for(e=BB(n0(i),15),y=new Np,m.c[m.c.length]=y,o=new Rv,l=e.Kc();l.Ob();){for(c=JRn(n,f=BB(l.Pb(),33),!0,0,0),y.c[y.c.length]=c,new xC(b=f.i,w=f.j),!f.n&&(f.n=new eU(zOt,f,1,7)),h=new AL(f.n);h.e!=h.i.gc();)r=JRn(n,BB(kpn(h),137),!1,b,w),y.c[y.c.length]=r;for(!f.c&&(f.c=new eU(XOt,f,9,9)),g=new AL(f.c);g.e!=g.i.gc();)for(a=JRn(n,d=BB(kpn(g),118),!1,b,w),y.c[y.c.length]=a,p=d.i+b,v=d.j+w,!d.n&&(d.n=new eU(zOt,d,1,7)),s=new AL(d.n);s.e!=s.i.gc();)r=JRn(n,BB(kpn(s),137),!1,p,v),y.c[y.c.length]=r;Frn(o,JQ(Wen(Pun(Gk(xnt,1),HWn,20,0,[dLn(f),wLn(f)]))))}ULn(n,o,y)}return n.f=new _j(m),qan(n.f,t),n.f}function Kzn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g;null==(w=RX(n.e,i))&&(s=BB(w=new py,183),o=new GX(t+"_s"+r),rtn(s,q6n,o)),nW(e,b=BB(w,183)),qQ(g=new py,"x",i.j),qQ(g,"y",i.k),rtn(b,U6n,g),qQ(f=new py,"x",i.b),qQ(f,"y",i.c),rtn(b,"endPoint",f),!WE((!i.a&&(i.a=new $L(xOt,i,5)),i.a))&&(c=new Wg(h=new Cl),e5((!i.a&&(i.a=new $L(xOt,i,5)),i.a),c),rtn(b,D6n,h)),!!Svn(i)&&cMn(n.a,b,K6n,RPn(n,Svn(i))),!!Pvn(i)&&cMn(n.a,b,R6n,RPn(n,Pvn(i))),!(0==(!i.e&&(i.e=new hK(FOt,i,10,9)),i.e).i)&&(a=new SI(n,l=new Cl),e5((!i.e&&(i.e=new hK(FOt,i,10,9)),i.e),a),rtn(b,F6n,l)),0!=(!i.g&&(i.g=new hK(FOt,i,9,10)),i.g).i&&(u=new PI(n,d=new Cl),e5((!i.g&&(i.g=new hK(FOt,i,9,10)),i.g),u),rtn(b,_6n,d))}function _zn(n){var t,i,r,c,a,u,o;for(qD(),r=n.f.n,u=EX(n.r).a.nc();u.Ob();){if(c=0,(a=BB(u.Pb(),111)).b.Xe((sWn(),aPt))&&(c=Gy(MD(a.b.We(aPt))))<0)switch(a.b.Hf().g){case 1:r.d=e.Math.max(r.d,-c);break;case 3:r.a=e.Math.max(r.a,-c);break;case 2:r.c=e.Math.max(r.c,-c);break;case 4:r.b=e.Math.max(r.b,-c)}if(Hz(n.u))switch(t=vcn(a.b,c),o=!BB(n.e.We(qSt),174).Hc((n_n(),HIt)),i=!1,a.b.Hf().g){case 1:i=t>r.d,r.d=e.Math.max(r.d,t),o&&i&&(r.d=e.Math.max(r.d,r.a),r.a=r.d+c);break;case 3:i=t>r.a,r.a=e.Math.max(r.a,t),o&&i&&(r.a=e.Math.max(r.a,r.d),r.d=r.a+c);break;case 2:i=t>r.c,r.c=e.Math.max(r.c,t),o&&i&&(r.c=e.Math.max(r.b,r.c),r.b=r.c+c);break;case 4:i=t>r.b,r.b=e.Math.max(r.b,t),o&&i&&(r.b=e.Math.max(r.b,r.c),r.c=r.b+c)}}}function Fzn(n){var t,e,i,r,c,a,u,o,s,h,f;for(s=new Wb(n);s.a<s.c.c.length;){switch(o=BB(n0(s),10),c=null,(a=BB(mMn(o,(HXn(),kgt)),163)).g){case 1:case 2:Jun(),c=$ht;break;case 3:case 4:Jun(),c=Oht}if(c)hon(o,(hWn(),Gft),(Jun(),$ht)),c==Oht?RNn(o,a,(ain(),Hvt)):c==$ht&&RNn(o,a,(ain(),qvt));else if(vA(BB(mMn(o,ept),98))&&0!=o.j.c.length){for(t=!0,f=new Wb(o.j);f.a<f.c.c.length;){if(!((h=BB(n0(f),11)).j==(kUn(),oIt)&&h.e.c.length-h.g.c.length>0||h.j==CIt&&h.e.c.length-h.g.c.length<0)){t=!1;break}for(r=new Wb(h.g);r.a<r.c.c.length;)if(e=BB(n0(r),17),(u=BB(mMn(e.d.i,kgt),163))==(Tbn(),Blt)||u==Hlt){t=!1;break}for(i=new Wb(h.e);i.a<i.c.c.length;)if(e=BB(n0(i),17),(u=BB(mMn(e.c.i,kgt),163))==(Tbn(),_lt)||u==Flt){t=!1;break}}t&&RNn(o,a,(ain(),Gvt))}}}function Bzn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;for(E=0,w=0,l=new Wb(t.e);l.a<l.c.c.length;){for(f=BB(n0(l),10),b=0,o=0,s=i?BB(mMn(f,Xmt),19).a:_Vn,v=r?BB(mMn(f,Wmt),19).a:_Vn,h=e.Math.max(s,v),y=new Wb(f.j);y.a<y.c.c.length;){if(m=BB(n0(y),11),k=f.n.b+m.n.b+m.a.b,r)for(u=new Wb(m.g);u.a<u.c.c.length;)d=(g=(a=BB(n0(u),17)).d).i,t!=n.a[d.p]&&(p=e.Math.max(BB(mMn(d,Xmt),19).a,BB(mMn(d,Wmt),19).a),(j=BB(mMn(a,(HXn(),bpt)),19).a)>=h&&j>=p&&(b+=d.n.b+g.n.b+g.a.b-k,++o));if(i)for(u=new Wb(m.e);u.a<u.c.c.length;)d=(g=(a=BB(n0(u),17)).c).i,t!=n.a[d.p]&&(p=e.Math.max(BB(mMn(d,Xmt),19).a,BB(mMn(d,Wmt),19).a),(j=BB(mMn(a,(HXn(),bpt)),19).a)>=h&&j>=p&&(b+=d.n.b+g.n.b+g.a.b-k,++o))}o>0&&(E+=b/o,++w)}w>0?(t.a=c*E/w,t.g=w):(t.a=0,t.g=0)}function Hzn(n,t){var e,i,r,c,a,u,o,s,h,f;for(i=new Wb(n.a.b);i.a<i.c.c.length;)for(u=new Wb(BB(n0(i),29).a);u.a<u.c.c.length;)a=BB(n0(u),10),t.j[a.p]=a,t.i[a.p]=t.o==(oZ(),cyt)?KQn:RQn;for($U(n.c),c=n.a.b,t.c==(gJ(),nyt)&&(c=cL(c,152)?o6(BB(c,152)):cL(c,131)?BB(c,131).a:cL(c,54)?new fy(c):new CT(c)),R9(n.e,t,n.b),yS(t.p,null),r=c.Kc();r.Ob();)for(o=BB(r.Pb(),29).a,t.o==(oZ(),cyt)&&(o=cL(o,152)?o6(BB(o,152)):cL(o,131)?BB(o,131).a:cL(o,54)?new fy(o):new CT(o)),f=o.Kc();f.Ob();)h=BB(f.Pb(),10),t.g[h.p]==h&&oXn(n,h,t);for(Hqn(n,t),e=c.Kc();e.Ob();)for(f=new Wb(BB(e.Pb(),29).a);f.a<f.c.c.length;)h=BB(n0(f),10),t.p[h.p]=t.p[t.g[h.p].p],h==t.g[h.p]&&(s=Gy(t.i[t.j[h.p].p]),(t.o==(oZ(),cyt)&&s>KQn||t.o==ryt&&s<RQn)&&(t.p[h.p]=Gy(t.p[h.p])+s));n.e.cg()}function qzn(n,t,e,i){var r,c,a,u,o;return pNn(u=new eUn(t),i),r=!0,n&&n.Xe((sWn(),bSt))&&(r=(c=BB(n.We((sWn(),bSt)),103))==(Ffn(),BPt)||c==_Pt||c==FPt),oRn(u,!1),Otn(u.e.wf(),new $_(u,!1,r)),LJ(u,u.f,(Dtn(),Git),(kUn(),sIt)),LJ(u,u.f,Uit,SIt),LJ(u,u.g,Git,CIt),LJ(u,u.g,Uit,oIt),Bpn(u,sIt),Bpn(u,SIt),hV(u,oIt),hV(u,CIt),qD(),(a=u.A.Hc((mdn(),DIt))&&u.B.Hc((n_n(),UIt))?ndn(u):null)&&rj(u.a,a),_zn(u),ryn(u),cyn(u),VGn(u),MKn(u),mkn(u),_gn(u,sIt),_gn(u,SIt),CRn(u),PHn(u),e?(Gbn(u),ykn(u),_gn(u,oIt),_gn(u,CIt),o=u.B.Hc((n_n(),XIt)),MCn(u,o,sIt),MCn(u,o,SIt),SCn(u,o,oIt),SCn(u,o,CIt),JT(new Rq(null,new w1(new Ob(u.i),0)),new In),JT(AV(new Rq(null,EX(u.r).a.oc()),new On),new An),BEn(u),u.e.uf(u.o),JT(new Rq(null,EX(u.r).a.oc()),new Ln),u.o):u.o}function Gzn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(h=RQn,r=new Wb(n.a.b);r.a<r.c.c.length;)t=BB(n0(r),81),h=e.Math.min(h,t.d.f.g.c+t.e.a);for(w=new YT,u=new Wb(n.a.a);u.a<u.c.c.length;)(a=BB(n0(u),189)).i=h,0==a.e&&r5(w,a,w.c.b,w.c);for(;0!=w.b;){for(c=(a=BB(0==w.b?null:(Px(0!=w.b),Atn(w,w.a.a)),189)).f.g.c,b=a.a.a.ec().Kc();b.Ob();)f=BB(b.Pb(),81),g=a.i+f.e.a,f.d.g||f.g.c<g?f.o=g:f.o=f.g.c;for(c-=a.f.o,a.b+=c,n.c==(Ffn(),FPt)||n.c==KPt?a.c+=c:a.c-=c,l=a.a.a.ec().Kc();l.Ob();)for(s=(f=BB(l.Pb(),81)).f.Kc();s.Ob();)o=BB(s.Pb(),81),d=dA(n.c)?n.f.ef(f,o):n.f.ff(f,o),o.d.i=e.Math.max(o.d.i,f.o+f.g.b+d-o.e.a),o.k||(o.d.i=e.Math.max(o.d.i,o.g.c-o.e.a)),--o.d.e,0==o.d.e&&DH(w,o.d)}for(i=new Wb(n.a.b);i.a<i.c.c.length;)(t=BB(n0(i),81)).g.c=t.o}function zzn(n){var t,e,i,r,c,a,u,o;switch(u=n.b,t=n.a,0===BB(mMn(n,(_kn(),Mit)),427).g?m$(u,new nw(new Gn)):m$(u,new nw(new zn)),1===BB(mMn(n,Eit),428).g?(m$(u,new qn),m$(u,new Un),m$(u,new Kn)):(m$(u,new qn),m$(u,new Hn)),BB(mMn(n,Pit),250).g){case 0:o=new Yn;break;case 1:o=new Vn;break;case 2:o=new Qn;break;case 3:o=new Wn;break;case 5:o=new Ow(new Qn);break;case 4:o=new Ow(new Vn);break;case 7:o=new DS(new Ow(new Vn),new Ow(new Qn));break;case 8:o=new DS(new Ow(new Wn),new Ow(new Qn));break;default:o=new Ow(new Wn)}for(a=new Wb(u);a.a<a.c.c.length;){for(c=BB(n0(a),167),r=0,e=new rI(iln(i=0),iln(r));B_n(t,c,i,r);)e=BB(o.Ce(e,c),46),i=BB(e.a,19).a,r=BB(e.b,19).a;_Rn(t,c,i,r)}}function Uzn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;for(l=(c=n.f.b).a,h=c.b,w=n.e.g,b=n.e.f,MA(n.e,c.a,c.b),j=l/w,E=h/b,s=new AL(mV(n.e));s.e!=s.i.gc();)Pen(o=BB(kpn(s),137),o.i*j),Cen(o,o.j*E);for(v=new AL(yV(n.e));v.e!=v.i.gc();)y=(p=BB(kpn(v),118)).i,k=p.j,y>0&&Pen(p,y*j),k>0&&Cen(p,k*E);for(nan(n.b,new lt),t=new Np,u=new usn(new Pb(n.c).a);u.b;)i=BB((a=ten(u)).cd(),79),e=BB(a.dd(),395).a,r=cDn(i,!1,!1),VFn(f=lTn(PMn(i),qSn(r),e),r),(m=CMn(i))&&-1==E7(t,m,0)&&(t.c[t.c.length]=m,sQ(m,(Px(0!=f.b),BB(f.a.a.c,8)),e));for(g=new usn(new Pb(n.d).a);g.b;)i=BB((d=ten(g)).cd(),79),e=BB(d.dd(),395).a,r=cDn(i,!1,!1),f=lTn(OMn(i),Jon(qSn(r)),e),VFn(f=Jon(f),r),(m=IMn(i))&&-1==E7(t,m,0)&&(t.c[t.c.length]=m,sQ(m,(Px(0!=f.b),BB(f.c.b.c,8)),e))}function Xzn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;if(0!=i.c.length){for(w=new Np,b=new Wb(i);b.a<b.c.c.length;)WB(w,new xC((l=BB(n0(b),33)).i,l.j));for(r.n&&t&&y0(r,o2(t),(Bsn(),uOt));NMn(n,i);)E$n(n,i,!1);for(r.n&&t&&y0(r,o2(t),(Bsn(),uOt)),u=0,o=0,c=null,0!=i.c.length&&(l1(0,i.c.length),u=(c=BB(i.c[0],33)).i-(l1(0,w.c.length),BB(w.c[0],8)).a,o=c.j-(l1(0,w.c.length),BB(w.c[0],8)).b),a=e.Math.sqrt(u*u+o*o),f=Uhn(i);0!=f.a.gc();){for(h=f.a.ec().Kc();h.Ob();)s=BB(h.Pb(),33),g=(d=n.f).i+d.g/2,p=d.j+d.f/2,v=s.i+s.g/2,y=s.j+s.f/2-p,j=(m=v-g)/(k=e.Math.sqrt(m*m+y*y)),E=y/k,Pen(s,s.i+j*a),Cen(s,s.j+E*a);r.n&&t&&y0(r,o2(t),(Bsn(),uOt)),f=Uhn(new t_(f))}n.a&&n.a.lg(new t_(f)),r.n&&t&&y0(r,o2(t),(Bsn(),uOt)),Xzn(n,t,new t_(f),r)}}function Wzn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;if(g=n.n,p=n.o,b=n.d,l=Gy(MD(edn(n,(HXn(),ppt)))),t){for(f=l*(t.gc()-1),w=0,s=t.Kc();s.Ob();)f+=(u=BB(s.Pb(),10)).o.a,w=e.Math.max(w,u.o.b);for(v=g.a-(f-p.a)/2,a=g.b-b.d+w,c=r=p.a/(t.gc()+1),o=t.Kc();o.Ob();)(u=BB(o.Pb(),10)).n.a=v,u.n.b=a-u.o.b,v+=u.o.a+l,(h=DLn(u)).n.a=u.o.a/2-h.a.a,h.n.b=u.o.b,(d=BB(mMn(u,(hWn(),Kft)),11)).e.c.length+d.g.c.length==1&&(d.n.a=c-d.a.a,d.n.b=0,CZ(d,n)),c+=r}if(i){for(f=l*(i.gc()-1),w=0,s=i.Kc();s.Ob();)f+=(u=BB(s.Pb(),10)).o.a,w=e.Math.max(w,u.o.b);for(v=g.a-(f-p.a)/2,a=g.b+p.b+b.a-w,c=r=p.a/(i.gc()+1),o=i.Kc();o.Ob();)(u=BB(o.Pb(),10)).n.a=v,u.n.b=a,v+=u.o.a+l,(h=DLn(u)).n.a=u.o.a/2-h.a.a,h.n.b=0,(d=BB(mMn(u,(hWn(),Kft)),11)).e.c.length+d.g.c.length==1&&(d.n.a=c-d.a.a,d.n.b=p.b,CZ(d,n)),c+=r}}function Vzn(n,t){var i,r,c,a,u,o;if(BB(mMn(t,(hWn(),Zft)),21).Hc((bDn(),lft))){for(o=new Wb(t.a);o.a<o.c.c.length;)(a=BB(n0(o),10)).k==(uSn(),Cut)&&(c=BB(mMn(a,(HXn(),Cgt)),142),n.c=e.Math.min(n.c,a.n.a-c.b),n.a=e.Math.max(n.a,a.n.a+a.o.a+c.c),n.d=e.Math.min(n.d,a.n.b-c.d),n.b=e.Math.max(n.b,a.n.b+a.o.b+c.a));for(u=new Wb(t.a);u.a<u.c.c.length;)if((a=BB(n0(u),10)).k!=(uSn(),Cut))switch(a.k.g){case 2:if((r=BB(mMn(a,(HXn(),kgt)),163))==(Tbn(),Flt)){a.n.a=n.c-10,Yyn(a,new Ge).Jb(new rd(a));break}if(r==Hlt){a.n.a=n.a+10,Yyn(a,new ze).Jb(new cd(a));break}if((i=BB(mMn(a,ilt),303))==(z7(),Cft)){lqn(a).Jb(new ad(a)),a.n.b=n.d-10;break}if(i==Sft){lqn(a).Jb(new ud(a)),a.n.b=n.b+10;break}break;default:throw Hp(new _y("The node type "+a.k+" is not supported by the "+Jot))}}}function Qzn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d;for(o=new xC(i.i+i.g/2,i.j+i.f/2),l=XHn(i),b=BB(ZAn(t,(HXn(),ept)),98),d=BB(ZAn(i,upt),61),BI(lpn(i),tpt)||(w=0==i.i&&0==i.j?0:tMn(i,d),Ypn(i,tpt,w)),hon(r=bXn(i,b,d,l,new xC(t.g,t.f),o,new xC(i.g,i.f),BB(mMn(e,Udt),103),e),(hWn(),dlt),i),Hl(c=BB(xq(r.j,0),11),j_n(i)),hon(r,cpt,(lIn(),nbn(rIt))),h=BB(ZAn(t,cpt),174).Hc(eIt),u=new AL((!i.n&&(i.n=new eU(zOt,i,1,7)),i.n));u.e!=u.i.gc();)if(!qy(TD(ZAn(a=BB(kpn(u),137),Ggt)))&&a.a&&(f=Hhn(a),WB(c.f,f),!h))switch(s=0,Hz(BB(ZAn(t,cpt),21))&&(s=$In(new xC(a.i,a.j),new xC(a.g,a.f),new xC(i.g,i.f),0,d)),d.g){case 2:case 4:f.o.a=s;break;case 1:case 3:f.o.b=s}hon(r,Cpt,MD(ZAn(JJ(t),Cpt))),hon(r,Ipt,MD(ZAn(JJ(t),Ipt))),hon(r,Spt,MD(ZAn(JJ(t),Spt))),WB(e.a,r),VW(n.a,i,r)}function Yzn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(OTn(e,"Processor arrange level",1),h=0,SQ(),_rn(t,new ap((qqn(),ikt))),c=t.b,u=spn(t,t.b),s=!0;s&&u.b.b!=u.d.a;)g=BB(U0(u),86),0==BB(mMn(g,ikt),19).a?--c:s=!1;if(a=new n_(new s1(t,0,c)),o=new n_(new s1(t,c,t.b)),0==a.b)for(b=spn(o,0);b.b!=b.d.c;)hon(BB(b3(b),86),hkt,iln(h++));else for(f=a.b,m=spn(a,0);m.b!=m.d.c;){for(hon(v=BB(b3(m),86),hkt,iln(h++)),Yzn(n,i=xun(v),mcn(e,1/f|0)),_rn(i,QW(new ap(hkt))),l=new YT,p=spn(i,0);p.b!=p.d.c;)for(g=BB(b3(p),86),d=spn(v.d,0);d.b!=d.d.c;)(w=BB(b3(d),188)).c==g&&r5(l,w,l.c.b,l.c);for(yQ(v.d),Frn(v.d,l),u=spn(o,o.b),r=v.d.b,s=!0;0<r&&s&&u.b.b!=u.d.a;)g=BB(U0(u),86),0==BB(mMn(g,ikt),19).a?(hon(g,hkt,iln(h++)),--r,mtn(u)):s=!1}HSn(e)}function Jzn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(OTn(t,"Inverted port preprocessing",1),u=new M2(n.b,0),e=null,g=new Np;u.b<u.d.gc();){for(d=e,Px(u.b<u.d.gc()),e=BB(u.d.Xb(u.c=u.b++),29),h=new Wb(g);h.a<h.c.c.length;)PZ(o=BB(n0(h),10),d);for(g.c=x8(Ant,HWn,1,0,5,1),f=new Wb(e.a);f.a<f.c.c.length;)if((o=BB(n0(f),10)).k==(uSn(),Cut)&&vA(BB(mMn(o,(HXn(),ept)),98))){for(w=cRn(o,(ain(),Hvt),(kUn(),oIt)).Kc();w.Ob();)for(l=BB(w.Pb(),11),r=0,c=(i=BB(Qgn(a=l.e,x8(yut,c1n,17,a.c.length,0,1)),474)).length;r<c;++r)$Bn(n,l,i[r],g);for(b=cRn(o,qvt,CIt).Kc();b.Ob();)for(l=BB(b.Pb(),11),r=0,c=(i=BB(Qgn(a=l.g,x8(yut,c1n,17,a.c.length,0,1)),474)).length;r<c;++r)ABn(n,l,i[r],g)}}for(s=new Wb(g);s.a<s.c.c.length;)PZ(o=BB(n0(s),10),e);HSn(t)}function Zzn(n,t,e,i,r,c){var a,u,o,s,h,f;for(qan(s=new CSn,t),qCn(s,BB(ZAn(t,(HXn(),upt)),61)),hon(s,(hWn(),dlt),t),CZ(s,e),(f=s.o).a=t.g,f.b=t.f,(h=s.n).a=t.i,h.b=t.j,VW(n.a,t,s),(a=o5($V(wnn(new Rq(null,(!t.e&&(t.e=new hK(_Ot,t,7,4)),new w1(t.e,16))),new Vt),new Xt),new Ww(t)))||(a=o5($V(wnn(new Rq(null,(!t.d&&(t.d=new hK(_Ot,t,8,5)),new w1(t.d,16))),new Qt),new Wt),new Vw(t))),a||(a=o5(new Rq(null,(!t.e&&(t.e=new hK(_Ot,t,7,4)),new w1(t.e,16))),new Yt)),hon(s,elt,(hN(),!!a)),pqn(s,c,r,BB(ZAn(t,npt),8)),o=new AL((!t.n&&(t.n=new eU(zOt,t,1,7)),t.n));o.e!=o.i.gc();)!qy(TD(ZAn(u=BB(kpn(o),137),Ggt)))&&u.a&&WB(s.f,Hhn(u));switch(r.g){case 2:case 1:(s.j==(kUn(),sIt)||s.j==SIt)&&i.Fc((bDn(),gft));break;case 4:case 3:(s.j==(kUn(),oIt)||s.j==CIt)&&i.Fc((bDn(),gft))}return s}function nUn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w,d,g,p,v,m;for(l=null,r==(dJ(),Lyt)?l=t:r==Nyt&&(l=i),d=l.a.ec().Kc();d.Ob();){for(w=BB(d.Pb(),11),g=Aon(Pun(Gk(PMt,1),sVn,8,0,[w.i.n,w.n,w.a])).b,m=new Rv,o=new Rv,h=new m6(w.b);y$(h.a)||y$(h.b);)if(qy(TD(mMn(s=BB(y$(h.a)?n0(h.a):n0(h.b),17),(hWn(),Clt))))==c&&-1!=E7(a,s,0)){if(p=s.d==w?s.c:s.d,v=Aon(Pun(Gk(PMt,1),sVn,8,0,[p.i.n,p.n,p.a])).b,e.Math.abs(v-g)<.2)continue;v<g?t.a._b(p)?TU(m,new rI(Lyt,s)):TU(m,new rI(Nyt,s)):t.a._b(p)?TU(o,new rI(Lyt,s)):TU(o,new rI(Nyt,s))}if(m.a.gc()>1)for(e5(m,new sC(n,b=new hqn(w,m,r))),u.c[u.c.length]=b,f=m.a.ec().Kc();f.Ob();)y7(a,BB(f.Pb(),46).b);if(o.a.gc()>1)for(e5(o,new hC(n,b=new hqn(w,o,r))),u.c[u.c.length]=b,f=o.a.ec().Kc();f.Ob();)y7(a,BB(f.Pb(),46).b)}}function tUn(n){NM(n,new MTn(dj(vj(wj(pj(gj(new du,w4n),"ELK Radial"),'A radial layout provider which is based on the algorithm of Peter Eades published in "Drawing free trees.", published by International Institute for Advanced Study of Social Information Science, Fujitsu Limited in 1991. The radial layouter takes a tree and places the nodes in radial order around the root. The nodes of the same tree level are placed on the same radius.'),new Ha),w4n))),u2(n,w4n,g3n,mpn(xjt)),u2(n,w4n,vZn,mpn(Kjt)),u2(n,w4n,PZn,mpn(Cjt)),u2(n,w4n,BZn,mpn(Ijt)),u2(n,w4n,SZn,mpn(Ojt)),u2(n,w4n,CZn,mpn(Pjt)),u2(n,w4n,MZn,mpn(Ajt)),u2(n,w4n,IZn,mpn(Njt)),u2(n,w4n,h4n,mpn(Mjt)),u2(n,w4n,s4n,mpn(Sjt)),u2(n,w4n,b4n,mpn($jt)),u2(n,w4n,u4n,mpn(Ljt)),u2(n,w4n,o4n,mpn(Djt)),u2(n,w4n,f4n,mpn(Rjt)),u2(n,w4n,l4n,mpn(_jt))}function eUn(n){var t;if(this.r=xV(new Pn,new Cn),this.b=new Hbn(BB(yX(FIt),290)),this.p=new Hbn(BB(yX(FIt),290)),this.i=new Hbn(BB(yX(Krt),290)),this.e=n,this.o=new wA(n.rf()),this.D=n.Df()||qy(TD(n.We((sWn(),SSt)))),this.A=BB(n.We((sWn(),KSt)),21),this.B=BB(n.We(qSt),21),this.q=BB(n.We(uPt),98),this.u=BB(n.We(fPt),21),!wMn(this.u))throw Hp(new rk("Invalid port label placement: "+this.u));if(this.v=qy(TD(n.We(bPt))),this.j=BB(n.We(DSt),21),!tLn(this.j))throw Hp(new rk("Invalid node label placement: "+this.j));this.n=BB(nkn(n,NSt),116),this.k=Gy(MD(nkn(n,OPt))),this.d=Gy(MD(nkn(n,IPt))),this.w=Gy(MD(nkn(n,RPt))),this.s=Gy(MD(nkn(n,APt))),this.t=Gy(MD(nkn(n,$Pt))),this.C=BB(nkn(n,xPt),142),this.c=2*this.d,t=!this.B.Hc((n_n(),HIt)),this.f=new Ign(0,t,0),this.g=new Ign(1,t,0),jy(this.f,(Dtn(),zit),this.g)}function iUn(n,t,i,r,c){var a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S;for(y=0,g=0,d=0,w=1,m=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));m.e!=m.i.gc();)w+=F3(new oz(ZL(dLn(p=BB(kpn(m),33)).a.Kc(),new h))),T=p.g,g=e.Math.max(g,T),b=p.f,d=e.Math.max(d,b),y+=T*b;for(u=y+2*r*r*w*(!n.a&&(n.a=new eU(UOt,n,10,11)),n.a).i,a=e.Math.sqrt(u),s=e.Math.max(a*i,g),o=e.Math.max(a/i,d),v=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));v.e!=v.i.gc();)p=BB(kpn(v),33),M=c.b+(H$n(t,26)*rYn+H$n(t,27)*cYn)*(s-p.g),S=c.b+(H$n(t,26)*rYn+H$n(t,27)*cYn)*(o-p.f),Pen(p,M),Cen(p,S);for(E=s+(c.b+c.c),j=o+(c.d+c.a),k=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));k.e!=k.i.gc();)for(l=new oz(ZL(dLn(BB(kpn(k),33)).a.Kc(),new h));dAn(l);)nAn(f=BB(U5(l),79))||BXn(f,t,E,j);KUn(n,E+=c.b+c.c,j+=c.d+c.a,!1,!0)}function rUn(n){var t,e,i,r,c,a,u,o,s,h,f;if(null==n)throw Hp(new Mk(zWn));if(s=n,o=!1,(c=n.length)>0&&(b1(0,n.length),45!=(t=n.charCodeAt(0))&&43!=t||(n=n.substr(1),--c,o=45==t)),0==c)throw Hp(new Mk(DQn+s+'"'));for(;n.length>0&&(b1(0,n.length),48==n.charCodeAt(0));)n=n.substr(1),--c;if(c>(iFn(),xtt)[10])throw Hp(new Mk(DQn+s+'"'));for(r=0;r<c;r++)if(-1==egn((b1(r,n.length),n.charCodeAt(r))))throw Hp(new Mk(DQn+s+'"'));for(f=0,a=Ltt[10],h=Ntt[10],u=j7(Dtt[10]),e=!0,(i=c%a)>0&&(f=-parseInt(n.substr(0,i),10),n=n.substr(i),c-=i,e=!1);c>=a;){if(i=parseInt(n.substr(0,a),10),n=n.substr(a),c-=a,e)e=!1;else{if(Vhn(f,u)<0)throw Hp(new Mk(DQn+s+'"'));f=cbn(f,h)}f=ibn(f,i)}if(Vhn(f,0)>0)throw Hp(new Mk(DQn+s+'"'));if(!o&&Vhn(f=j7(f),0)<0)throw Hp(new Mk(DQn+s+'"'));return f}function cUn(n,t){var e,i,r,c,a,u,o;if(ZH(),this.a=new X$(this),this.b=n,this.c=t,this.f=OU(B7((IPn(),Z$t),t)),this.f.dc())if((u=mjn(Z$t,n))==t)for(this.e=!0,this.d=new Np,this.f=new fo,this.f.Fc(S7n),BB(NHn(F7(Z$t,Utn(n)),""),26)==n&&this.f.Fc(az(Z$t,Utn(n))),r=EKn(Z$t,n).Kc();r.Ob();)switch(i=BB(r.Pb(),170),DW(B7(Z$t,i))){case 4:this.d.Fc(i);break;case 5:this.f.Gc(OU(B7(Z$t,i)))}else if(ZM(),BB(t,66).Oj())for(this.e=!0,this.f=null,this.d=new Np,a=0,o=(null==n.i&&qFn(n),n.i).length;a<o;++a)for(null==n.i&&qFn(n),e=n.i,i=a>=0&&a<e.length?e[a]:null,c=Z1(B7(Z$t,i));c;c=Z1(B7(Z$t,c)))c==t&&this.d.Fc(i);else 1==DW(B7(Z$t,t))&&u?(this.f=null,this.d=(TOn(),bLt)):(this.f=null,this.e=!0,this.d=(SQ(),new Gb(t)));else this.e=5==DW(B7(Z$t,t)),this.f.Fb(uLt)&&(this.f=uLt)}function aUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d;for(i=0,r=Pmn(n,t),b=n.s,w=n.t,h=BB(BB(h6(n.r,t),21),84).Kc();h.Ob();)if((s=BB(h.Pb(),111)).c&&!(s.c.d.c.length<=0)){switch(d=s.b.rf(),o=s.b.Xe((sWn(),aPt))?Gy(MD(s.b.We(aPt))):0,(l=(f=s.c).i).b=(u=f.n,f.e.a+u.b+u.c),l.a=(a=f.n,f.e.b+a.d+a.a),t.g){case 1:l.c=s.a?(d.a-l.b)/2:d.a+b,l.d=d.b+o+r,l9(f,(J9(),Qit)),WD(f,(G7(),crt));break;case 3:l.c=s.a?(d.a-l.b)/2:d.a+b,l.d=-o-r-l.a,l9(f,(J9(),Qit)),WD(f,(G7(),irt));break;case 2:l.c=-o-r-l.b,s.a?(c=n.v?l.a:BB(xq(f.d,0),181).rf().b,l.d=(d.b-c)/2):l.d=d.b+w,l9(f,(J9(),Jit)),WD(f,(G7(),rrt));break;case 4:l.c=d.a+o+r,s.a?(c=n.v?l.a:BB(xq(f.d,0),181).rf().b,l.d=(d.b-c)/2):l.d=d.b+w,l9(f,(J9(),Yit)),WD(f,(G7(),rrt))}(t==(kUn(),sIt)||t==SIt)&&(i=e.Math.max(i,l.a))}i>0&&(BB(oV(n.b,t),124).a.b=i)}function uUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(OTn(t,"Comment pre-processing",1),e=0,o=new Wb(n.a);o.a<o.c.c.length;)if(qy(TD(mMn(u=BB(n0(o),10),(HXn(),Tdt))))){for(++e,r=0,i=null,s=null,w=new Wb(u.j);w.a<w.c.c.length;)r+=(l=BB(n0(w),11)).e.c.length+l.g.c.length,1==l.e.c.length&&(s=(i=BB(xq(l.e,0),17)).c),1==l.g.c.length&&(s=(i=BB(xq(l.g,0),17)).d);if(1!=r||s.e.c.length+s.g.c.length!=1||qy(TD(mMn(s.i,Tdt)))){for(g=new Np,b=new Wb(u.j);b.a<b.c.c.length;){for(f=new Wb((l=BB(n0(b),11)).g);f.a<f.c.c.length;)0==(h=BB(n0(f),17)).d.g.c.length||(g.c[g.c.length]=h);for(a=new Wb(l.e);a.a<a.c.c.length;)0==(c=BB(n0(a),17)).c.e.c.length||(g.c[g.c.length]=c)}for(d=new Wb(g);d.a<d.c.c.length;)tBn(BB(n0(d),17),!0)}else nXn(u,i,s,s.i),AU(o)}t.n&&OH(t,"Found "+e+" comment boxes"),HSn(t)}function oUn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d;if(l=Gy(MD(mMn(n,(HXn(),Cpt)))),b=Gy(MD(mMn(n,Ipt))),f=Gy(MD(mMn(n,Spt))),u=n.o,a=(c=BB(xq(n.j,0),11)).n,d=TPn(c,f)){if(t.Hc((lIn(),eIt)))switch(BB(mMn(n,(hWn(),Qft)),61).g){case 1:d.c=(u.a-d.b)/2-a.a,d.d=b;break;case 3:d.c=(u.a-d.b)/2-a.a,d.d=-b-d.a;break;case 2:e&&0==c.e.c.length&&0==c.g.c.length?(h=i?d.a:BB(xq(c.f,0),70).o.b,d.d=(u.b-h)/2-a.b):d.d=u.b+b-a.b,d.c=-l-d.b;break;case 4:e&&0==c.e.c.length&&0==c.g.c.length?(h=i?d.a:BB(xq(c.f,0),70).o.b,d.d=(u.b-h)/2-a.b):d.d=u.b+b-a.b,d.c=l}else if(t.Hc(rIt))switch(BB(mMn(n,(hWn(),Qft)),61).g){case 1:case 3:d.c=a.a+l;break;case 2:case 4:e&&!c.c?(h=i?d.a:BB(xq(c.f,0),70).o.b,d.d=(u.b-h)/2-a.b):d.d=a.b+b}for(r=d.d,s=new Wb(c.f);s.a<s.c.c.length;)(w=(o=BB(n0(s),70)).n).a=d.c,w.b=r,r+=o.o.b+f}}function sUn(){RO(wLt,new Vs),RO(zLt,new ah),RO(ULt,new ph),RO(XLt,new Ch),RO(Qtt,new $h),RO(Gk(NNt,1),new Lh),RO(ktt,new Nh),RO(Ttt,new xh),RO(Qtt,new _s),RO(Qtt,new Fs),RO(Qtt,new Bs),RO(Ptt,new Hs),RO(Qtt,new qs),RO(Rnt,new Gs),RO(Rnt,new zs),RO(Qtt,new Us),RO(Ctt,new Xs),RO(Qtt,new Ws),RO(Qtt,new Qs),RO(Qtt,new Ys),RO(Qtt,new Js),RO(Qtt,new Zs),RO(Gk(NNt,1),new nh),RO(Qtt,new th),RO(Qtt,new eh),RO(Rnt,new ih),RO(Rnt,new rh),RO(Qtt,new ch),RO(Att,new uh),RO(Qtt,new oh),RO(Rtt,new sh),RO(Qtt,new hh),RO(Qtt,new fh),RO(Qtt,new lh),RO(Qtt,new bh),RO(Rnt,new wh),RO(Rnt,new dh),RO(Qtt,new gh),RO(Qtt,new vh),RO(Qtt,new mh),RO(Qtt,new yh),RO(Qtt,new kh),RO(Qtt,new jh),RO(_tt,new Eh),RO(Qtt,new Th),RO(Qtt,new Mh),RO(Qtt,new Sh),RO(_tt,new Ph),RO(Rtt,new Ih),RO(Qtt,new Oh),RO(Att,new Ah)}function hUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;if((f=t.length)>0&&(b1(0,t.length),64!=(u=t.charCodeAt(0)))){if(37==u&&(o=!1,0!=(h=t.lastIndexOf("%"))&&(h==f-1||(b1(h+1,t.length),o=46==t.charCodeAt(h+1))))){if(v=mK("%",a=t.substr(1,h-1))?null:$Un(a),i=0,o)try{i=l_n(t.substr(h+2),_Vn,DWn)}catch(m){throw cL(m=lun(m),127)?Hp(new L7(m)):Hp(m)}for(d=Ern(n.Wg());d.Ob();)if(cL(b=Man(d),510)&&(p=(r=BB(b,590)).d,(null==v?null==p:mK(v,p))&&0==i--))return r;return null}if(l=-1==(s=t.lastIndexOf("."))?t:t.substr(0,s),e=0,-1!=s)try{e=l_n(t.substr(s+1),_Vn,DWn)}catch(m){if(!cL(m=lun(m),127))throw Hp(m);l=t}for(l=mK("%",l)?null:$Un(l),w=Ern(n.Wg());w.Ob();)if(cL(b=Man(w),191)&&(g=(c=BB(b,191)).ne(),(null==l?null==g:mK(l,g))&&0==e--))return c;return null}return _qn(n,t)}function fUn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T;for(m=new Np,f=new Wb(n.b);f.a<f.c.c.length;)for(w=new Wb(BB(n0(f),29).a);w.a<w.c.c.length;)if((l=BB(n0(w),10)).k==(uSn(),Mut)&&Lx(l,(hWn(),Vft))){for(d=null,p=null,g=null,j=new Wb(l.j);j.a<j.c.c.length;)switch((k=BB(n0(j),11)).j.g){case 4:d=k;break;case 2:p=k;break;default:g=k}for(s=new Kj((v=BB(xq(g.g,0),17)).a),UR(o=new wA(g.n),l.n),nX(spn(s,0),o),y=Jon(v.a),UR(h=new wA(g.n),l.n),r5(y,h,y.c.b,y.c),E=BB(mMn(l,Vft),10),T=BB(xq(E.j,0),11),c=0,u=(i=BB(Qgn(d.e,x8(yut,c1n,17,0,0,1)),474)).length;c<u;++c)MZ(t=i[c],T),Wsn(t.a,t.a.b,s);for(r=0,a=(e=Z0(p.g)).length;r<a;++r)SZ(t=e[r],T),Wsn(t.a,0,y);SZ(v,null),MZ(v,null),m.c[m.c.length]=l}for(b=new Wb(m);b.a<b.c.c.length;)PZ(l=BB(n0(b),10),null)}function lUn(){var n,t,e;for(lUn=O,new knn(1,0),new knn(10,0),new knn(0,0),Htt=x8(iet,sVn,240,11,0,1),qtt=x8(ONt,WVn,25,100,15,1),Gtt=Pun(Gk(xNt,1),qQn,25,15,[1,5,25,125,625,3125,15625,78125,390625,1953125,9765625,48828125,244140625,1220703125,6103515625,30517578125,152587890625,762939453125,3814697265625,19073486328125,95367431640625,476837158203125,0x878678326eac9]),ztt=x8(ANt,hQn,25,Gtt.length,15,1),Utt=Pun(Gk(xNt,1),qQn,25,15,[1,10,100,VVn,1e4,GQn,1e6,1e7,1e8,AQn,1e10,1e11,1e12,1e13,1e14,1e15,1e16]),Xtt=x8(ANt,hQn,25,Utt.length,15,1),Wtt=x8(iet,sVn,240,11,0,1),n=0;n<Wtt.length;n++)Htt[n]=new knn(n,0),Wtt[n]=new knn(0,n),qtt[n]=48;for(;n<qtt.length;n++)qtt[n]=48;for(e=0;e<ztt.length;e++)ztt[e]=aIn(Gtt[e]);for(t=0;t<Xtt.length;t++)Xtt[t]=aIn(Utt[t]);$On()}function bUn(){function n(){this.obj=this.createObject()}return n.prototype.createObject=function(n){return Object.create(null)},n.prototype.get=function(n){return this.obj[n]},n.prototype.set=function(n,t){this.obj[n]=t},n.prototype[iYn]=function(n){delete this.obj[n]},n.prototype.keys=function(){return Object.getOwnPropertyNames(this.obj)},n.prototype.entries=function(){var n=this.keys(),t=this,e=0;return{next:function(){if(e>=n.length)return{done:!0};var i=n[e++];return{value:[i,t.get(i)],done:!1}}}},zDn()||(n.prototype.createObject=function(){return{}},n.prototype.get=function(n){return this.obj[":"+n]},n.prototype.set=function(n,t){this.obj[":"+n]=t},n.prototype[iYn]=function(n){delete this.obj[":"+n]},n.prototype.keys=function(){var n=[];for(var t in this.obj)58==t.charCodeAt(0)&&n.push(t.substring(1));return n}),n}function wUn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d;if(PFn(),null==n)return null;if(0==(f=8*n.length))return"";for(l=f/24|0,c=null,c=x8(ONt,WVn,25,4*(0!=(u=f%24)?l+1:l),15,1),s=0,h=0,t=0,e=0,i=0,a=0,r=0,o=0;o<l;o++)t=n[r++],h=(15&(e=n[r++]))<<24>>24,s=(3&t)<<24>>24,b=0==(-128&t)?t>>2<<24>>24:(t>>2^192)<<24>>24,w=0==(-128&e)?e>>4<<24>>24:(e>>4^240)<<24>>24,d=0==(-128&(i=n[r++]))?i>>6<<24>>24:(i>>6^252)<<24>>24,c[a++]=VLt[b],c[a++]=VLt[w|s<<4],c[a++]=VLt[h<<2|d],c[a++]=VLt[63&i];return 8==u?(s=(3&(t=n[r]))<<24>>24,b=0==(-128&t)?t>>2<<24>>24:(t>>2^192)<<24>>24,c[a++]=VLt[b],c[a++]=VLt[s<<4],c[a++]=61,c[a++]=61):16==u&&(t=n[r],h=(15&(e=n[r+1]))<<24>>24,s=(3&t)<<24>>24,b=0==(-128&t)?t>>2<<24>>24:(t>>2^192)<<24>>24,w=0==(-128&e)?e>>4<<24>>24:(e>>4^240)<<24>>24,c[a++]=VLt[b],c[a++]=VLt[w|s<<4],c[a++]=VLt[h<<2],c[a++]=61),Bdn(c,0,c.length)}function dUn(n,t){var i,r,c,a,u,o;if(0==n.e&&n.p>0&&(n.p=-(n.p-1)),n.p>_Vn&&e4(t,n.p-sQn),u=t.q.getDate(),FJ(t,1),n.k>=0&&vZ(t,n.k),n.c>=0?FJ(t,n.c):n.k>=0?(r=35-new von(t.q.getFullYear()-sQn,t.q.getMonth(),35).q.getDate(),FJ(t,e.Math.min(r,u))):FJ(t,u),n.f<0&&(n.f=t.q.getHours()),n.b>0&&n.f<12&&(n.f+=12),aL(t,24==n.f&&n.g?0:n.f),n.j>=0&&g6(t,n.j),n.n>=0&&U8(t,n.n),n.i>=0&&dO(t,rbn(cbn(Ojn(fan(t.q.getTime()),VVn),VVn),n.i)),n.a&&(e4(c=new AT,c.q.getFullYear()-sQn-80),sS(fan(t.q.getTime()),fan(c.q.getTime()))&&e4(t,c.q.getFullYear()-sQn+100)),n.d>=0)if(-1==n.c)(i=(7+n.d-t.q.getDay())%7)>3&&(i-=7),o=t.q.getMonth(),FJ(t,t.q.getDate()+i),t.q.getMonth()!=o&&FJ(t,t.q.getDate()+(i>0?-7:7));else if(t.q.getDay()!=n.d)return!1;return n.o>_Vn&&(a=t.q.getTimezoneOffset(),dO(t,rbn(fan(t.q.getTime()),60*(n.o-a)*VVn))),!0}function gUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;if(cL(r=mMn(t,(hWn(),dlt)),239)){for(b=BB(r,33),w=t.e,f=new wA(t.c),c=t.d,f.a+=c.b,f.b+=c.d,SN(BB(ZAn(b,(HXn(),qgt)),174),(n_n(),qIt))&&(Ol(l=BB(ZAn(b,zgt),116),c.a),_l(l,c.d),Al(l,c.b),Fl(l,c.c)),e=new Np,s=new Wb(t.a);s.a<s.c.c.length;)for(cL(mMn(u=BB(n0(s),10),dlt),239)?CUn(u,f):cL(mMn(u,dlt),186)&&!w&&SA(i=BB(mMn(u,dlt),118),(g=yFn(t,u,i.g,i.f)).a,g.b),d=new Wb(u.j);d.a<d.c.c.length;)JT(AV(new Rq(null,new w1(BB(n0(d),11).g,16)),new Qw(u)),new Yw(e));if(w)for(d=new Wb(w.j);d.a<d.c.c.length;)JT(AV(new Rq(null,new w1(BB(n0(d),11).g,16)),new Jw(w)),new Zw(e));for(p=BB(ZAn(b,Zdt),218),a=new Wb(e);a.a<a.c.c.length;)pzn(BB(n0(a),17),p,f);for(m_n(t),o=new Wb(t.a);o.a<o.c.c.length;)(h=(u=BB(n0(o),10)).e)&&gUn(n,h)}}function pUn(n){NM(n,new MTn(mj(dj(vj(wj(pj(gj(new du,gZn),"ELK Force"),"Force-based algorithm provided by the Eclipse Layout Kernel. Implements methods that follow physical analogies by simulating forces that move the nodes into a balanced distribution. Currently the original Eades model and the Fruchterman - Reingold model are supported."),new dt),gZn),EG((hAn(),tAt),Pun(Gk(aAt,1),$Vn,237,0,[ZOt]))))),u2(n,gZn,pZn,iln(1)),u2(n,gZn,vZn,80),u2(n,gZn,mZn,5),u2(n,gZn,VJn,dZn),u2(n,gZn,yZn,iln(1)),u2(n,gZn,kZn,(hN(),!0)),u2(n,gZn,QJn,Qct),u2(n,gZn,jZn,mpn(Hct)),u2(n,gZn,EZn,mpn(Yct)),u2(n,gZn,TZn,!1),u2(n,gZn,MZn,mpn(Wct)),u2(n,gZn,SZn,mpn(Xct)),u2(n,gZn,PZn,mpn(Uct)),u2(n,gZn,CZn,mpn(zct)),u2(n,gZn,IZn,mpn(Jct)),u2(n,gZn,oZn,mpn(Gct)),u2(n,gZn,fZn,mpn(aat)),u2(n,gZn,sZn,mpn(qct)),u2(n,gZn,bZn,mpn(tat)),u2(n,gZn,hZn,mpn(eat))}function vUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w;if(!BB(BB(h6(n.r,t),21),84).dc()){if(s=(u=BB(oV(n.b,t),124)).i,o=u.n,f=PDn(n,t),r=s.b-o.b-o.c,c=u.a.a,a=s.c+o.b,w=n.w,f!=(cpn(),BCt)&&f!=qCt||1!=BB(BB(h6(n.r,t),21),84).gc()||(c=f==BCt?c-2*n.w:c,f=FCt),r<c&&!n.B.Hc((n_n(),WIt)))f==BCt?a+=w+=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()+1):w+=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()-1);else switch(r<c&&(c=f==BCt?c-2*n.w:c,f=FCt),f.g){case 3:a+=(r-c)/2;break;case 4:a+=r-c;break;case 0:i=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()+1),a+=w+=e.Math.max(0,i);break;case 1:i=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()-1),w+=e.Math.max(0,i)}for(b=BB(BB(h6(n.r,t),21),84).Kc();b.Ob();)(l=BB(b.Pb(),111)).e.a=a+l.d.b,l.e.b=(h=l.b).Xe((sWn(),aPt))?h.Hf()==(kUn(),sIt)?-h.rf().b-Gy(MD(h.We(aPt))):Gy(MD(h.We(aPt))):h.Hf()==(kUn(),sIt)?-h.rf().b:0,a+=l.d.b+l.b.rf().a+l.d.c+w}}function mUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d;if(!BB(BB(h6(n.r,t),21),84).dc()){if(s=(u=BB(oV(n.b,t),124)).i,o=u.n,l=PDn(n,t),r=s.a-o.d-o.a,c=u.a.b,a=s.d+o.d,d=n.w,h=n.o.a,l!=(cpn(),BCt)&&l!=qCt||1!=BB(BB(h6(n.r,t),21),84).gc()||(c=l==BCt?c-2*n.w:c,l=FCt),r<c&&!n.B.Hc((n_n(),WIt)))l==BCt?a+=d+=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()+1):d+=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()-1);else switch(r<c&&(c=l==BCt?c-2*n.w:c,l=FCt),l.g){case 3:a+=(r-c)/2;break;case 4:a+=r-c;break;case 0:i=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()+1),a+=d+=e.Math.max(0,i);break;case 1:i=(r-c)/(BB(BB(h6(n.r,t),21),84).gc()-1),d+=e.Math.max(0,i)}for(w=BB(BB(h6(n.r,t),21),84).Kc();w.Ob();)(b=BB(w.Pb(),111)).e.a=(f=b.b).Xe((sWn(),aPt))?f.Hf()==(kUn(),CIt)?-f.rf().a-Gy(MD(f.We(aPt))):h+Gy(MD(f.We(aPt))):f.Hf()==(kUn(),CIt)?-f.rf().a:h,b.e.b=a+b.d.d,a+=b.d.d+b.b.rf().b+b.d.a+d}}function yUn(n){var t,i,r,c,a,u,o,s,f,l,b,w,d,g,p;for(n.n=Gy(MD(mMn(n.g,(HXn(),Opt)))),n.e=Gy(MD(mMn(n.g,Tpt))),n.i=n.g.b.c.length,o=n.i-1,w=0,n.j=0,n.k=0,n.a=u6(x8(Att,sVn,19,n.i,0,1)),n.b=u6(x8(Ptt,sVn,333,n.i,7,1)),u=new Wb(n.g.b);u.a<u.c.c.length;){for((c=BB(n0(u),29)).p=o,b=new Wb(c.a);b.a<b.c.c.length;)(l=BB(n0(b),10)).p=w,++w;--o}for(n.f=x8(ANt,hQn,25,w,15,1),n.c=kq(ANt,[sVn,hQn],[48,25],15,[w,3],2),n.o=new Np,n.p=new Np,t=0,n.d=0,a=new Wb(n.g.b);a.a<a.c.c.length;){for(o=(c=BB(n0(a),29)).p,r=0,p=0,s=c.a.c.length,f=0,b=new Wb(c.a);b.a<b.c.c.length;)w=(l=BB(n0(b),10)).p,n.f[w]=l.c.p,f+=l.o.b+n.n,i=F3(new oz(ZL(fbn(l).a.Kc(),new h))),g=F3(new oz(ZL(lbn(l).a.Kc(),new h))),n.c[w][0]=g-i,n.c[w][1]=i,n.c[w][2]=g,r+=i,p+=g,i>0&&WB(n.p,l),WB(n.o,l);d=s+(t-=r),f+=t*n.e,c5(n.a,o,iln(d)),c5(n.b,o,f),n.j=e.Math.max(n.j,d),n.k=e.Math.max(n.k,f),n.d+=t,t+=p}}function kUn(){var n;kUn=O,PIt=new WC(hJn,0),sIt=new WC(mJn,1),oIt=new WC(yJn,2),SIt=new WC(kJn,3),CIt=new WC(jJn,4),SQ(),wIt=new Ak(new YK(n=BB(Vj(FIt),9),BB(SR(n,n.length),9),0)),dIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[]))),hIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[]))),EIt=ffn(EG(SIt,Pun(Gk(FIt,1),YZn,61,0,[]))),MIt=ffn(EG(CIt,Pun(Gk(FIt,1),YZn,61,0,[]))),yIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[SIt]))),bIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[CIt]))),jIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[CIt]))),gIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt]))),TIt=ffn(EG(SIt,Pun(Gk(FIt,1),YZn,61,0,[CIt]))),fIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[SIt]))),mIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt,CIt]))),lIt=ffn(EG(oIt,Pun(Gk(FIt,1),YZn,61,0,[SIt,CIt]))),kIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[SIt,CIt]))),pIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt,SIt]))),vIt=ffn(EG(sIt,Pun(Gk(FIt,1),YZn,61,0,[oIt,SIt,CIt])))}function jUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;if(0!=t.b){for(l=new YT,a=null,b=null,i=CJ(e.Math.floor(e.Math.log(t.b)*e.Math.LOG10E)+1),u=0,v=spn(t,0);v.b!=v.d.c;)for(g=BB(b3(v),86),GI(b)!==GI(mMn(g,(qqn(),rkt)))&&(b=SD(mMn(g,rkt)),u=0),a=null!=b?b+d0(u++,i):d0(u++,i),hon(g,rkt,a),d=new wg(spn(new bg(g).a.d,0));EE(d.a);)r5(l,w=BB(b3(d.a),188).c,l.c.b,l.c),hon(w,rkt,a);for(f=new xp,c=0;c<a.length-i;c++)for(p=spn(t,0);p.b!=p.d.c;)mZ(f,o=fx(SD(mMn(g=BB(b3(p),86),(qqn(),rkt))),0,c+1),iln(null!=(null==o?qI(AY(f.f,null)):hS(f.g,o))?BB(null==o?qI(AY(f.f,null)):hS(f.g,o),19).a+1:1));for(h=new usn(new Pb(f).a);h.b;)s=ten(h),r=iln(null!=RX(n.a,s.cd())?BB(RX(n.a,s.cd()),19).a:0),mZ(n.a,SD(s.cd()),iln(BB(s.dd(),19).a+r.a)),(!(r=BB(RX(n.b,s.cd()),19))||r.a<BB(s.dd(),19).a)&&mZ(n.b,SD(s.cd()),BB(s.dd(),19));jUn(n,l)}}function EUn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(OTn(i,"Interactive node layering",1),r=new Np,w=new Wb(t.a);w.a<w.c.c.length;){for(s=(h=(l=BB(n0(w),10)).n.a)+l.o.a,s=e.Math.max(h+1,s),v=new M2(r,0),c=null;v.b<v.d.gc();){if(Px(v.b<v.d.gc()),(g=BB(v.d.Xb(v.c=v.b++),569)).c>=s){Px(v.b>0),v.a.Xb(v.c=--v.b);break}g.a>h&&(c?(gun(c.b,g.b),c.a=e.Math.max(c.a,g.a),fW(v)):(WB(g.b,l),g.c=e.Math.min(g.c,h),g.a=e.Math.max(g.a,s),c=g))}c||((c=new im).c=h,c.a=s,yR(v,c),WB(c.b,l))}for(o=t.b,f=0,p=new Wb(r);p.a<p.c.c.length;)for(g=BB(n0(p),569),(a=new HX(t)).p=f++,o.c[o.c.length]=a,d=new Wb(g.b);d.a<d.c.c.length;)PZ(l=BB(n0(d),10),a),l.p=0;for(b=new Wb(t.a);b.a<b.c.c.length;)0==(l=BB(n0(b),10)).p&&CDn(n,l,t);for(u=new M2(o,0);u.b<u.d.gc();)0==(Px(u.b<u.d.gc()),BB(u.d.Xb(u.c=u.b++),29)).a.c.length&&fW(u);t.a.c=x8(Ant,HWn,1,0,5,1),HSn(i)}function TUn(n,t,e){var i,r,c,a,u,o,s,h,f,l;if(0!=t.e.c.length&&0!=e.e.c.length){if((i=BB(xq(t.e,0),17).c.i)==(a=BB(xq(e.e,0),17).c.i))return E$(BB(mMn(BB(xq(t.e,0),17),(hWn(),wlt)),19).a,BB(mMn(BB(xq(e.e,0),17),wlt),19).a);for(f=0,l=(h=n.a).length;f<l;++f){if((s=h[f])==i)return 1;if(s==a)return-1}}return 0!=t.g.c.length&&0!=e.g.c.length?(c=BB(mMn(t,(hWn(),llt)),10),o=BB(mMn(e,llt),10),r=0,u=0,Lx(BB(xq(t.g,0),17),wlt)&&(r=BB(mMn(BB(xq(t.g,0),17),wlt),19).a),Lx(BB(xq(e.g,0),17),wlt)&&(u=BB(mMn(BB(xq(t.g,0),17),wlt),19).a),c&&c==o?qy(TD(mMn(BB(xq(t.g,0),17),Clt)))&&!qy(TD(mMn(BB(xq(e.g,0),17),Clt)))?1:!qy(TD(mMn(BB(xq(t.g,0),17),Clt)))&&qy(TD(mMn(BB(xq(e.g,0),17),Clt)))||r<u?-1:r>u?1:0:(n.b&&(n.b._b(c)&&(r=BB(n.b.xc(c),19).a),n.b._b(o)&&(u=BB(n.b.xc(o),19).a)),r<u?-1:r>u?1:0)):0!=t.e.c.length&&0!=e.g.c.length?1:-1}function MUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(OTn(t,O1n,1),w=new Np,y=new Np,s=new Wb(n.b);s.a<s.c.c.length;)for(g=-1,l=0,b=(f=n2((o=BB(n0(s),29)).a)).length;l<b;++l)if(++g,(h=f[l]).k==(uSn(),Cut)&&vA(BB(mMn(h,(HXn(),ept)),98))){for(LK(BB(mMn(h,(HXn(),ept)),98))||HNn(h),hon(h,(hWn(),rlt),h),w.c=x8(Ant,HWn,1,0,5,1),y.c=x8(Ant,HWn,1,0,5,1),e=new Np,qrn(v=new YT,DSn(h,(kUn(),sIt))),AXn(n,v,w,y,e),u=g,k=h,c=new Wb(w);c.a<c.c.c.length;)Qyn(i=BB(n0(c),10),u,o),++g,hon(i,rlt,h),a=BB(xq(i.j,0),11),d=BB(mMn(a,dlt),11),qy(TD(mMn(d,jdt)))||BB(mMn(i,clt),15).Fc(k);for(yQ(v),p=DSn(h,SIt).Kc();p.Ob();)r5(v,BB(p.Pb(),11),v.a,v.a.a);for(AXn(n,v,y,null,e),m=h,r=new Wb(y);r.a<r.c.c.length;)Qyn(i=BB(n0(r),10),++g,o),hon(i,rlt,h),a=BB(xq(i.j,0),11),d=BB(mMn(a,dlt),11),qy(TD(mMn(d,jdt)))||BB(mMn(m,clt),15).Fc(i);0==e.c.length||hon(h,xft,e)}HSn(t)}function SUn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P;for(h=BB(mMn(n,(Mrn(),sat)),33),d=DWn,g=DWn,b=_Vn,w=_Vn,v=new Wb(n.e);v.a<v.c.c.length;)E=(p=BB(n0(v),144)).d,T=p.e,d=e.Math.min(d,E.a-T.a/2),g=e.Math.min(g,E.b-T.b/2),b=e.Math.max(b,E.a+T.a/2),w=e.Math.max(w,E.b+T.b/2);for(k=new xC((j=BB(ZAn(h,(fRn(),Vct)),116)).b-d,j.d-g),o=new Wb(n.e);o.a<o.c.c.length;)cL(y=mMn(u=BB(n0(o),144),sat),239)&&SA(f=BB(y,33),(m=UR(u.d,k)).a-f.g/2,m.b-f.f/2);for(r=new Wb(n.c);r.a<r.c.c.length;)i=BB(n0(r),282),s=cDn(BB(mMn(i,sat),79),!0,!0),Ukn(S=XR(B$(i.d.d),i.c.d),i.c.e.a,i.c.e.b),CA(s,(M=UR(S,i.c.d)).a,M.b),Ukn(P=XR(B$(i.c.d),i.d.d),i.d.e.a,i.d.e.b),PA(s,(t=UR(P,i.d.d)).a,t.b);for(a=new Wb(n.d);a.a<a.c.c.length;)c=BB(n0(a),447),SA(BB(mMn(c,sat),137),(l=UR(c.d,k)).a,l.b);KUn(h,b-d+(j.b+j.c),w-g+(j.d+j.a),!1,!0)}function PUn(n){var t,e,i,r,c,a,u,o,s,h,f;for(e=null,u=null,(r=BB(mMn(n.b,(HXn(),igt)),376))==(A6(),Jvt)&&(e=new Np,u=new Np),a=new Wb(n.d);a.a<a.c.c.length;)if((c=BB(n0(a),101)).i)switch(c.e.g){case 0:t=BB(u4(new QT(c.b)),61),r==Jvt&&t==(kUn(),sIt)?e.c[e.c.length]=c:r==Jvt&&t==(kUn(),SIt)?u.c[u.c.length]=c:Nmn(c,t);break;case 1:o=c.a.d.j,s=c.c.d.j,o==(kUn(),sIt)?bU(c,sIt,(Oun(),mst),c.a):s==sIt?bU(c,sIt,(Oun(),yst),c.c):o==SIt?bU(c,SIt,(Oun(),yst),c.a):s==SIt&&bU(c,SIt,(Oun(),mst),c.c);break;case 2:case 3:SN(i=c.b,(kUn(),sIt))?SN(i,SIt)?SN(i,CIt)?SN(i,oIt)||bU(c,sIt,(Oun(),yst),c.c):bU(c,sIt,(Oun(),mst),c.a):bU(c,sIt,(Oun(),vst),null):bU(c,SIt,(Oun(),vst),null);break;case 4:h=c.a.d.j,f=c.a.d.j,h==(kUn(),sIt)||f==sIt?bU(c,SIt,(Oun(),vst),null):bU(c,sIt,(Oun(),vst),null)}e&&(0==e.c.length||QFn(e,(kUn(),sIt)),0==u.c.length||QFn(u,(kUn(),SIt)))}function CUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;for(i=BB(mMn(n,(hWn(),dlt)),33),b=BB(mMn(n,(HXn(),Bdt)),19).a,c=BB(mMn(n,jgt),19).a,Ypn(i,Bdt,iln(b)),Ypn(i,jgt,iln(c)),Pen(i,n.n.a+t.a),Cen(i,n.n.b+t.b),(0!=BB(ZAn(i,Fgt),174).gc()||n.e||GI(mMn(vW(n),_gt))===GI((Nvn(),mvt))&&pA((bvn(),(n.q?n.q:(SQ(),SQ(),het))._b(Rgt)?BB(mMn(n,Rgt),197):BB(mMn(vW(n),Kgt),197))))&&(Sen(i,n.o.a),Men(i,n.o.b)),f=new Wb(n.j);f.a<f.c.c.length;)cL(w=mMn(s=BB(n0(f),11),dlt),186)&&(SA(r=BB(w,118),s.n.a,s.n.b),Ypn(r,upt,s.j));for(l=0!=BB(mMn(n,$gt),174).gc(),o=new Wb(n.b);o.a<o.c.c.length;)a=BB(n0(o),70),(l||0!=BB(mMn(a,$gt),174).gc())&&(MA(e=BB(mMn(a,dlt),137),a.o.a,a.o.b),SA(e,a.n.a,a.n.b));if(!Hz(BB(mMn(n,cpt),21)))for(h=new Wb(n.j);h.a<h.c.c.length;)for(u=new Wb((s=BB(n0(h),11)).f);u.a<u.c.c.length;)a=BB(n0(u),70),Sen(e=BB(mMn(a,dlt),137),a.o.a),Men(e,a.o.b),SA(e,a.n.a,a.n.b)}function IUn(n){var t,e,i,r,c;switch(OY(n,i8n),(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i+(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i){case 0:throw Hp(new _y("The edge must have at least one source or target."));case 1:return 0==(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i?JJ(PTn(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))):JJ(PTn(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)))}if(1==(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b).i&&1==(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c).i){if(r=PTn(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)),c=PTn(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82)),JJ(r)==JJ(c))return JJ(r);if(r==JJ(c))return r;if(c==JJ(r))return c}for(t=PTn(BB(U5(i=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),(!n.c&&(n.c=new hK(KOt,n,5,8)),n.c)])))),82));dAn(i);)if((e=PTn(BB(U5(i),82)))!=t&&!Ctn(e,t))if(JJ(e)==JJ(t))t=JJ(e);else if(!(t=B$n(t,e)))return null;return t}function OUn(n,t,i){var r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j;for(OTn(i,"Polyline edge routing",1),v=Gy(MD(mMn(t,(HXn(),tgt)))),d=Gy(MD(mMn(t,Apt))),c=Gy(MD(mMn(t,kpt))),r=e.Math.min(1,c/d),k=0,s=0,0!=t.b.c.length&&(k=.4*r*(j=hLn(BB(xq(t.b,0),29)))),o=new M2(t.b,0);o.b<o.d.gc();){for(Px(o.b<o.d.gc()),(a=VI(u=BB(o.d.Xb(o.c=o.b++),29),jyt))&&k>0&&(k-=d),Tqn(u,k),l=0,w=new Wb(u.a);w.a<w.c.c.length;){for(f=0,p=new oz(ZL(lbn(b=BB(n0(w),10)).a.Kc(),new h));dAn(p);)m=g1((g=BB(U5(p),17)).c).b,y=g1(g.d).b,u!=g.d.i.c||b5(g)||(VIn(g,k,.4*r*e.Math.abs(m-y)),g.c.j==(kUn(),CIt)&&(m=0,y=0)),f=e.Math.max(f,e.Math.abs(y-m));switch(b.k.g){case 0:case 4:case 1:case 3:case 5:Gqn(n,b,k,v)}l=e.Math.max(l,f)}o.b<o.d.gc()&&(j=hLn((Px(o.b<o.d.gc()),BB(o.d.Xb(o.c=o.b++),29))),l=e.Math.max(l,j),Px(o.b>0),o.a.Xb(o.c=--o.b)),s=.4*r*l,!a&&o.b<o.d.gc()&&(s+=d),k+=u.c.a+s}n.a.a.$b(),t.f.a=k,HSn(i)}function AUn(n){var t,e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v;for(s=new xp,u=new pJ,i=new Wb(n.a.a.b);i.a<i.c.c.length;)if(o=f2(t=BB(n0(i),57)))jCn(s.f,o,t);else if(v=f3(t))for(r=new Wb(v.k);r.a<r.c.c.length;)JIn(u,BB(n0(r),17),t);for(e=new Wb(n.a.a.b);e.a<e.c.c.length;)if(o=f2(t=BB(n0(e),57)))for(a=new oz(ZL(lbn(o).a.Kc(),new h));dAn(a);)if(!b5(c=BB(U5(a),17))&&(w=c.c,p=c.d,!(kUn(),yIt).Hc(c.c.j)||!yIt.Hc(c.d.j))){if(d=BB(RX(s,c.d.i),57),UNn(aM(cM(uM(rM(new Hv,0),100),n.c[t.a.d]),n.c[d.a.d])),w.j==CIt&&$z((gcn(),w)))for(l=BB(h6(u,c),21).Kc();l.Ob();)if((f=BB(l.Pb(),57)).d.c<t.d.c){if((b=n.c[f.a.d])==(g=n.c[t.a.d]))continue;UNn(aM(cM(uM(rM(new Hv,1),100),b),g))}if(p.j==oIt&&Az((gcn(),p)))for(l=BB(h6(u,c),21).Kc();l.Ob();)if((f=BB(l.Pb(),57)).d.c>t.d.c){if((b=n.c[t.a.d])==(g=n.c[f.a.d]))continue;UNn(aM(cM(uM(rM(new Hv,1),100),b),g))}}}function $Un(n){var t,e,i,r,c,a,u,o;if(RHn(),null==n)return null;if((r=GO(n,YTn(37)))<0)return n;for(o=new lN(n.substr(0,r)),t=x8(NNt,v6n,25,4,15,1),u=0,i=0,a=n.length;r<a;r++)if(b1(r,n.length),37==n.charCodeAt(r)&&n.length>r+2&&ton((b1(r+1,n.length),n.charCodeAt(r+1)),IAt,OAt)&&ton((b1(r+2,n.length),n.charCodeAt(r+2)),IAt,OAt))if(e=CH((b1(r+1,n.length),n.charCodeAt(r+1)),(b1(r+2,n.length),n.charCodeAt(r+2))),r+=2,i>0?128==(192&e)?t[u++]=e<<24>>24:i=0:e>=128&&(192==(224&e)?(t[u++]=e<<24>>24,i=2):224==(240&e)?(t[u++]=e<<24>>24,i=3):240==(248&e)&&(t[u++]=e<<24>>24,i=4)),i>0){if(u==i){switch(u){case 2:xX(o,((31&t[0])<<6|63&t[1])&QVn);break;case 3:xX(o,((15&t[0])<<12|(63&t[1])<<6|63&t[2])&QVn)}u=0,i=0}}else{for(c=0;c<u;++c)xX(o,t[c]&QVn);u=0,o.a+=String.fromCharCode(e)}else{for(c=0;c<u;++c)xX(o,t[c]&QVn);u=0,xX(o,(b1(r,n.length),n.charCodeAt(r)))}return o.a}function LUn(n,t,e,i,r){var c,a,u;if(ynn(n,t),a=t[0],c=fV(e.c,0),u=-1,Yon(e))if(i>0){if(a+i>n.length)return!1;u=UIn(n.substr(0,a+i),t)}else u=UIn(n,t);switch(c){case 71:return u=zTn(n,a,Pun(Gk(Qtt,1),sVn,2,6,[fQn,lQn]),t),r.e=u,!0;case 77:return gDn(n,t,r,u,a);case 76:return pDn(n,t,r,u,a);case 69:return rCn(n,t,a,r);case 99:return cCn(n,t,a,r);case 97:return u=zTn(n,a,Pun(Gk(Qtt,1),sVn,2,6,["AM","PM"]),t),r.b=u,!0;case 121:return vDn(n,t,a,u,e,r);case 100:return!(u<=0||(r.c=u,0));case 83:return!(u<0)&&jwn(u,a,t[0],r);case 104:12==u&&(u=0);case 75:case 72:return!(u<0||(r.f=u,r.g=!1,0));case 107:return!(u<0||(r.f=u,r.g=!0,0));case 109:return!(u<0||(r.j=u,0));case 115:return!(u<0||(r.n=u,0));case 90:if(a<n.length&&(b1(a,n.length),90==n.charCodeAt(a)))return++t[0],r.o=0,!0;case 122:case 118:return CTn(n,a,t,r);default:return!1}}function NUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;if(b=BB(BB(h6(n.r,t),21),84),t!=(kUn(),oIt)&&t!=CIt){for(a=t==sIt?(Dan(),Nrt):(Dan(),Rrt),k=t==sIt?(G7(),crt):(G7(),irt),c=(r=(i=BB(oV(n.b,t),124)).i).c+Lon(Pun(Gk(xNt,1),qQn,25,15,[i.n.b,n.C.b,n.k])),v=r.c+r.b-Lon(Pun(Gk(xNt,1),qQn,25,15,[i.n.c,n.C.c,n.k])),u=Zk(H_(a),n.t),m=t==sIt?KQn:RQn,l=b.Kc();l.Ob();)!(h=BB(l.Pb(),111)).c||h.c.d.c.length<=0||(p=h.b.rf(),g=h.e,(d=(w=h.c).i).b=(s=w.n,w.e.a+s.b+s.c),d.a=(o=w.n,w.e.b+o.d+o.a),OY(k,uJn),w.f=k,l9(w,(J9(),Jit)),d.c=g.a-(d.b-p.a)/2,j=e.Math.min(c,g.a),E=e.Math.max(v,g.a+p.a),d.c<j?d.c=j:d.c+d.b>E&&(d.c=E-d.b),WB(u.d,new xG(d,kln(u,d))),m=t==sIt?e.Math.max(m,g.b+h.b.rf().b):e.Math.min(m,g.b));for(m+=t==sIt?n.t:-n.t,(y=Pwn((u.e=m,u)))>0&&(BB(oV(n.b,t),124).a.b=y),f=b.Kc();f.Ob();)!(h=BB(f.Pb(),111)).c||h.c.d.c.length<=0||((d=h.c.i).c-=h.e.a,d.d-=h.e.b)}else aUn(n,t)}function xUn(n){var t,e,i,r,c,a,u,o,s,f;for(t=new xp,a=new AL(n);a.e!=a.i.gc();){for(c=BB(kpn(a),33),e=new Rv,VW(Mct,c,e),f=new ut,i=BB(P4(new Rq(null,new zU(new oz(ZL(wLn(c).a.Kc(),new h)))),SG(f,m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[(qsn(),Uet)])))),83),Jen(e,BB(i.xc((hN(),!0)),14),new ot),r=BB(P4(AV(BB(i.xc(!1),15).Lc(),new st),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[Uet]))),15).Kc();r.Ob();)(s=CMn(BB(r.Pb(),79)))&&((u=BB(qI(AY(t.f,s)),21))||(u=Oxn(s),jCn(t.f,s,u)),Frn(e,u));for(i=BB(P4(new Rq(null,new zU(new oz(ZL(dLn(c).a.Kc(),new h)))),SG(f,m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[Uet])))),83),Jen(e,BB(i.xc(!0),14),new ht),o=BB(P4(AV(BB(i.xc(!1),15).Lc(),new ft),m9(new H,new B,new rn,Pun(Gk(nit,1),$Vn,132,0,[Uet]))),15).Kc();o.Ob();)(s=IMn(BB(o.Pb(),79)))&&((u=BB(qI(AY(t.f,s)),21))||(u=Oxn(s),jCn(t.f,s,u)),Frn(e,u))}}function DUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d;if(uHn(),(o=Vhn(n,0)<0)&&(n=j7(n)),0==Vhn(n,0))switch(t){case 0:return"0";case 1:return WQn;case 2:return"0.00";case 3:return"0.000";case 4:return"0.0000";case 5:return"0.00000";case 6:return"0.000000";default:return(b=new Ck).a+=t<0?"0E+":"0E",b.a+=t==_Vn?"2147483648":""+-t,b.a}f=x8(ONt,WVn,25,1+(h=18),15,1),e=h,d=n;do{s=d,d=Ojn(d,10),f[--e]=dG(rbn(48,ibn(s,cbn(d,10))))&QVn}while(0!=Vhn(d,0));if(r=ibn(ibn(ibn(h,e),t),1),0==t)return o&&(f[--e]=45),Bdn(f,e,h-e);if(t>0&&Vhn(r,-6)>=0){if(Vhn(r,0)>=0){for(c=e+dG(r),u=h-1;u>=c;u--)f[u+1]=f[u];return f[++c]=46,o&&(f[--e]=45),Bdn(f,e,h-e+1)}for(a=2;sS(a,rbn(j7(r),1));a++)f[--e]=48;return f[--e]=46,f[--e]=48,o&&(f[--e]=45),Bdn(f,e,h-e)}return w=e+1,i=h,l=new Ik,o&&(l.a+="-"),i-w>=1?(xX(l,f[e]),l.a+=".",l.a+=Bdn(f,e+1,h-e-1)):l.a+=Bdn(f,e,h-e),l.a+="E",Vhn(r,0)>0&&(l.a+="+"),l.a+=""+vz(r),l.a}function RUn(n,t,e){var i,r,c,a,u,o,s,h,f,l;if(n.e.a.$b(),n.f.a.$b(),n.c.c=x8(Ant,HWn,1,0,5,1),n.i.c=x8(Ant,HWn,1,0,5,1),n.g.a.$b(),t)for(a=new Wb(t.a);a.a<a.c.c.length;)for(h=DSn(c=BB(n0(a),10),(kUn(),oIt)).Kc();h.Ob();)for(s=BB(h.Pb(),11),TU(n.e,s),r=new Wb(s.g);r.a<r.c.c.length;)b5(i=BB(n0(r),17))||(WB(n.c,i),ppn(n,i),((u=i.c.i.k)==(uSn(),Cut)||u==Iut||u==Mut||u==Tut)&&WB(n.j,i),(f=(l=i.d).i.c)==e?TU(n.f,l):f==t?TU(n.e,l):y7(n.c,i));if(e)for(a=new Wb(e.a);a.a<a.c.c.length;){for(o=new Wb((c=BB(n0(a),10)).j);o.a<o.c.c.length;)for(r=new Wb(BB(n0(o),11).g);r.a<r.c.c.length;)b5(i=BB(n0(r),17))&&TU(n.g,i);for(h=DSn(c,(kUn(),CIt)).Kc();h.Ob();)for(s=BB(h.Pb(),11),TU(n.f,s),r=new Wb(s.g);r.a<r.c.c.length;)b5(i=BB(n0(r),17))||(WB(n.c,i),ppn(n,i),((u=i.c.i.k)==(uSn(),Cut)||u==Iut||u==Mut||u==Tut)&&WB(n.j,i),(f=(l=i.d).i.c)==e?TU(n.f,l):f==t?TU(n.e,l):y7(n.c,i))}}function KUn(n,t,i,r,c){var a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;if(p=new xC(n.g,n.f),(g=XPn(n)).a=e.Math.max(g.a,t),g.b=e.Math.max(g.b,i),E=g.a/p.a,f=g.b/p.b,k=g.a-p.a,s=g.b-p.b,r)for(u=JJ(n)?BB(ZAn(JJ(n),(sWn(),bSt)),103):BB(ZAn(n,(sWn(),bSt)),103),o=GI(ZAn(n,(sWn(),uPt)))===GI((QEn(),XCt)),m=new AL((!n.c&&(n.c=new eU(XOt,n,9,9)),n.c));m.e!=m.i.gc();)switch(v=BB(kpn(m),118),(y=BB(ZAn(v,wPt),61))==(kUn(),PIt)&&(y=OFn(v,u),Ypn(v,wPt,y)),y.g){case 1:o||Pen(v,v.i*E);break;case 2:Pen(v,v.i+k),o||Cen(v,v.j*f);break;case 3:o||Pen(v,v.i*E),Cen(v,v.j+s);break;case 4:o||Cen(v,v.j*f)}if(MA(n,g.a,g.b),c)for(b=new AL((!n.n&&(n.n=new eU(zOt,n,1,7)),n.n));b.e!=b.i.gc();)w=(l=BB(kpn(b),137)).i+l.g/2,d=l.j+l.f/2,(j=w/p.a)+(h=d/p.b)>=1&&(j-h>0&&d>=0?(Pen(l,l.i+k),Cen(l,l.j+s*h)):j-h<0&&w>=0&&(Pen(l,l.i+k*j),Cen(l,l.j+s)));return Ypn(n,(sWn(),KSt),(mdn(),new YK(a=BB(Vj(YIt),9),BB(SR(a,a.length),9),0))),new xC(E,f)}function _Un(n){var t,i,r,c,a,u,o,s,h,f,l;if(f=JJ(PTn(BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)))==JJ(PTn(BB(Wtn((!n.c&&(n.c=new hK(KOt,n,5,8)),n.c),0),82))),u=new Gj,(t=BB(ZAn(n,(Xsn(),hCt)),74))&&t.b>=2){if(0==(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)tE(),i=new co,f9((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),i);else if((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i>1)for(l=new cx((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a));l.e!=l.i.gc();)Qjn(l);VFn(t,BB(Wtn((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),0),202))}if(f)for(r=new AL((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a));r.e!=r.i.gc();)for(s=new AL((!(i=BB(kpn(r),202)).a&&(i.a=new $L(xOt,i,5)),i.a));s.e!=s.i.gc();)o=BB(kpn(s),469),u.a=e.Math.max(u.a,o.a),u.b=e.Math.max(u.b,o.b);for(a=new AL((!n.n&&(n.n=new eU(zOt,n,1,7)),n.n));a.e!=a.i.gc();)c=BB(kpn(a),137),(h=BB(ZAn(c,gCt),8))&&SA(c,h.a,h.b),f&&(u.a=e.Math.max(u.a,c.i+c.g),u.b=e.Math.max(u.b,c.j+c.f));return u}function FUn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;for(v=t.c.length,c=new qKn(n.a,i,null,null),E=x8(xNt,qQn,25,v,15,1),w=x8(xNt,qQn,25,v,15,1),b=x8(xNt,qQn,25,v,15,1),d=0,o=0;o<v;o++)w[o]=DWn,b[o]=_Vn;for(s=0;s<v;s++)for(l1(s,t.c.length),r=BB(t.c[s],180),E[s]=v$n(r),E[d]>E[s]&&(d=s),f=new Wb(n.a.b);f.a<f.c.c.length;)for(p=new Wb(BB(n0(f),29).a);p.a<p.c.c.length;)g=BB(n0(p),10),k=Gy(r.p[g.p])+Gy(r.d[g.p]),w[s]=e.Math.min(w[s],k),b[s]=e.Math.max(b[s],k+g.o.b);for(j=x8(xNt,qQn,25,v,15,1),h=0;h<v;h++)(l1(h,t.c.length),BB(t.c[h],180)).o==(oZ(),ryt)?j[h]=w[d]-w[h]:j[h]=b[d]-b[h];for(a=x8(xNt,qQn,25,v,15,1),l=new Wb(n.a.b);l.a<l.c.c.length;)for(y=new Wb(BB(n0(l),29).a);y.a<y.c.c.length;){for(m=BB(n0(y),10),u=0;u<v;u++)a[u]=Gy((l1(u,t.c.length),BB(t.c[u],180)).p[m.p])+Gy((l1(u,t.c.length),BB(t.c[u],180)).d[m.p])+j[u];a.sort(ien(T.prototype.te,T,[])),c.p[m.p]=(a[1]+a[2])/2,c.d[m.p]=0}return c}function BUn(n,t,e){var i,r,c,a,u;switch(i=t.i,c=n.i.o,r=n.i.d,u=n.n,a=Aon(Pun(Gk(PMt,1),sVn,8,0,[u,n.a])),n.j.g){case 1:WD(t,(G7(),irt)),i.d=-r.d-e-i.a,BB(BB(xq(t.d,0),181).We((hWn(),ult)),285)==(Xyn(),jCt)?(l9(t,(J9(),Jit)),i.c=a.a-Gy(MD(mMn(n,blt)))-e-i.b):(l9(t,(J9(),Yit)),i.c=a.a+Gy(MD(mMn(n,blt)))+e);break;case 2:l9(t,(J9(),Yit)),i.c=c.a+r.c+e,BB(BB(xq(t.d,0),181).We((hWn(),ult)),285)==(Xyn(),jCt)?(WD(t,(G7(),irt)),i.d=a.b-Gy(MD(mMn(n,blt)))-e-i.a):(WD(t,(G7(),crt)),i.d=a.b+Gy(MD(mMn(n,blt)))+e);break;case 3:WD(t,(G7(),crt)),i.d=c.b+r.a+e,BB(BB(xq(t.d,0),181).We((hWn(),ult)),285)==(Xyn(),jCt)?(l9(t,(J9(),Jit)),i.c=a.a-Gy(MD(mMn(n,blt)))-e-i.b):(l9(t,(J9(),Yit)),i.c=a.a+Gy(MD(mMn(n,blt)))+e);break;case 4:l9(t,(J9(),Jit)),i.c=-r.b-e-i.b,BB(BB(xq(t.d,0),181).We((hWn(),ult)),285)==(Xyn(),jCt)?(WD(t,(G7(),irt)),i.d=a.b-Gy(MD(mMn(n,blt)))-e-i.a):(WD(t,(G7(),crt)),i.d=a.b+Gy(MD(mMn(n,blt)))+e)}}function HUn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O;for(w=0,S=0,s=new Wb(n);s.a<s.c.c.length;)ozn(o=BB(n0(s),33)),w=e.Math.max(w,o.g),S+=o.g*o.f;for(M=Zyn(n,S/n.c.length),S+=n.c.length*M,w=e.Math.max(w,e.Math.sqrt(S*u))+i.b,I=i.b,O=i.d,b=0,f=i.b+i.c,DH(T=new YT,iln(0)),j=new YT,h=new M2(n,0);h.b<h.d.gc();)Px(h.b<h.d.gc()),C=(o=BB(h.d.Xb(h.c=h.b++),33)).g,l=o.f,I+C>w&&(a&&(fO(j,b),fO(T,iln(h.b-1))),I=i.b,O+=b+t,b=0,f=e.Math.max(f,i.b+i.c+C)),Pen(o,I),Cen(o,O),f=e.Math.max(f,I+C+i.c),b=e.Math.max(b,l),I+=C+t;if(f=e.Math.max(f,r),(P=O+b+i.a)<c&&(b+=c-P,P=c),a)for(I=i.b,h=new M2(n,0),fO(T,iln(n.c.length)),p=BB(b3(E=spn(T,0)),19).a,fO(j,b),k=spn(j,0),y=0;h.b<h.d.gc();)h.b==p&&(I=i.b,y=Gy(MD(b3(k))),p=BB(b3(E),19).a),Px(h.b<h.d.gc()),v=(o=BB(h.d.Xb(h.c=h.b++),33)).f,Men(o,y),d=y,h.b==p&&(g=f-I-i.c,m=o.g,Sen(o,g),lCn(o,new xC(g,d),new xC(m,v))),I+=o.g+t;return new xC(f,P)}function qUn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S;for(OTn(t,"Compound graph postprocessor",1),i=qy(TD(mMn(n,(HXn(),Dpt)))),o=BB(mMn(n,(hWn(),Hft)),224),f=new Rv,v=o.ec().Kc();v.Ob();){for(p=BB(v.Pb(),17),u=new t_(o.cc(p)),SQ(),m$(u,new _w(n)),j=ccn((l1(0,u.c.length),BB(u.c[0],243))),T=acn(BB(xq(u,u.c.length-1),243)),y=j.i,m=wan(T.i,y)?y.e:vW(y),l=Apn(p,u),yQ(p.a),b=null,a=new Wb(u);a.a<a.c.c.length;)c=BB(n0(a),243),OPn(g=new Gj,c.a,m),w=c.b,Wsn(r=new km,0,w.a),Ztn(r,g),k=new wA(g1(w.c)),E=new wA(g1(w.d)),UR(k,g),UR(E,g),b&&(0==r.b?d=E:(Px(0!=r.b),d=BB(r.a.a.c,8)),M=e.Math.abs(b.a-d.a)>lZn,S=e.Math.abs(b.b-d.b)>lZn,(!i&&M&&S||i&&(M||S))&&DH(p.a,k)),Frn(p.a,r),0==r.b?b=k:(Px(0!=r.b),b=BB(r.c.b.c,8)),Yan(w,l,g),acn(c)==T&&(vW(T.i)!=c.a&&OPn(g=new Gj,vW(T.i),m),hon(p,Rlt,g)),MSn(w,p,m),f.a.zc(w,f);SZ(p,j),MZ(p,T)}for(h=f.a.ec().Kc();h.Ob();)SZ(s=BB(h.Pb(),17),null),MZ(s,null);HSn(t)}function GUn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;if(1==n.gc())return BB(n.Xb(0),231);if(n.gc()<=0)return new y6;for(c=n.Kc();c.Ob();){for(i=BB(c.Pb(),231),d=0,f=DWn,l=DWn,s=_Vn,h=_Vn,w=new Wb(i.e);w.a<w.c.c.length;)b=BB(n0(w),144),d+=BB(mMn(b,(fRn(),Zct)),19).a,f=e.Math.min(f,b.d.a-b.e.a/2),l=e.Math.min(l,b.d.b-b.e.b/2),s=e.Math.max(s,b.d.a+b.e.a/2),h=e.Math.max(h,b.d.b+b.e.b/2);hon(i,(fRn(),Zct),iln(d)),hon(i,(Mrn(),oat),new xC(f,l)),hon(i,uat,new xC(s,h))}for(SQ(),n.ad(new wt),qan(g=new y6,BB(n.Xb(0),94)),o=0,m=0,a=n.Kc();a.Ob();)i=BB(a.Pb(),231),p=XR(B$(BB(mMn(i,(Mrn(),uat)),8)),BB(mMn(i,oat),8)),o=e.Math.max(o,p.a),m+=p.a*p.b;for(o=e.Math.max(o,e.Math.sqrt(m)*Gy(MD(mMn(g,(fRn(),Fct))))),y=0,k=0,u=0,t=v=Gy(MD(mMn(g,cat))),r=n.Kc();r.Ob();)i=BB(r.Pb(),231),y+(p=XR(B$(BB(mMn(i,(Mrn(),uat)),8)),BB(mMn(i,oat),8))).a>o&&(y=0,k+=u+v,u=0),VKn(g,i,y,k),t=e.Math.max(t,y+p.a),u=e.Math.max(u,p.b),y+=p.a+v;return g}function zUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;switch(h=new km,n.a.g){case 3:l=BB(mMn(t.e,(hWn(),Nlt)),15),b=BB(mMn(t.j,Nlt),15),w=BB(mMn(t.f,Nlt),15),e=BB(mMn(t.e,$lt),15),i=BB(mMn(t.j,$lt),15),r=BB(mMn(t.f,$lt),15),gun(a=new Np,l),b.Jc(new yc),gun(a,cL(b,152)?o6(BB(b,152)):cL(b,131)?BB(b,131).a:cL(b,54)?new fy(b):new CT(b)),gun(a,w),gun(c=new Np,e),gun(c,cL(i,152)?o6(BB(i,152)):cL(i,131)?BB(i,131).a:cL(i,54)?new fy(i):new CT(i)),gun(c,r),hon(t.f,Nlt,a),hon(t.f,$lt,c),hon(t.f,xlt,t.f),hon(t.e,Nlt,null),hon(t.e,$lt,null),hon(t.j,Nlt,null),hon(t.j,$lt,null);break;case 1:Frn(h,t.e.a),DH(h,t.i.n),Frn(h,ean(t.j.a)),DH(h,t.a.n),Frn(h,t.f.a);break;default:Frn(h,t.e.a),Frn(h,ean(t.j.a)),Frn(h,t.f.a)}yQ(t.f.a),Frn(t.f.a,h),SZ(t.f,t.e.c),u=BB(mMn(t.e,(HXn(),vgt)),74),s=BB(mMn(t.j,vgt),74),o=BB(mMn(t.f,vgt),74),(u||s||o)&&(PU(f=new km,o),PU(f,s),PU(f,u),hon(t.f,vgt,f)),SZ(t.j,null),MZ(t.j,null),SZ(t.e,null),MZ(t.e,null),PZ(t.a,null),PZ(t.i,null),t.g&&zUn(n,t.g)}function UUn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b,w,d,g;if(PFn(),null==n)return null;if((w=bln(c=V7(n)))%4!=0)return null;if(0==(d=w/4|0))return x8(NNt,v6n,25,0,15,1);for(f=null,t=0,e=0,i=0,r=0,a=0,u=0,o=0,s=0,b=0,l=0,h=0,f=x8(NNt,v6n,25,3*d,15,1);b<d-1;b++){if(!(VE(a=c[h++])&&VE(u=c[h++])&&VE(o=c[h++])&&VE(s=c[h++])))return null;t=WLt[a],e=WLt[u],i=WLt[o],r=WLt[s],f[l++]=(t<<2|e>>4)<<24>>24,f[l++]=((15&e)<<4|i>>2&15)<<24>>24,f[l++]=(i<<6|r)<<24>>24}return VE(a=c[h++])&&VE(u=c[h++])?(t=WLt[a],e=WLt[u],o=c[h++],s=c[h++],-1==WLt[o]||-1==WLt[s]?61==o&&61==s?0!=(15&e)?null:(aHn(f,0,g=x8(NNt,v6n,25,3*b+1,15,1),0,3*b),g[l]=(t<<2|e>>4)<<24>>24,g):61!=o&&61==s?0!=(3&(i=WLt[o]))?null:(aHn(f,0,g=x8(NNt,v6n,25,3*b+2,15,1),0,3*b),g[l++]=(t<<2|e>>4)<<24>>24,g[l]=((15&e)<<4|i>>2&15)<<24>>24,g):null:(i=WLt[o],r=WLt[s],f[l++]=(t<<2|e>>4)<<24>>24,f[l++]=((15&e)<<4|i>>2&15)<<24>>24,f[l++]=(i<<6|r)<<24>>24,f)):null}function XUn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;for(OTn(t,O1n,1),l=BB(mMn(n,(HXn(),Zdt)),218),i=new Wb(n.b);i.a<i.c.c.length;)for(a=0,u=(c=n2(BB(n0(i),29).a)).length;a<u;++a)if((r=c[a]).k==(uSn(),Iut)){if(l==(Mbn(),JPt))for(s=new Wb(r.j);s.a<s.c.c.length;)0==(o=BB(n0(s),11)).e.c.length||Agn(o),0==o.g.c.length||$gn(o);else if(cL(mMn(r,(hWn(),dlt)),17))w=BB(mMn(r,dlt),17),d=BB(DSn(r,(kUn(),CIt)).Kc().Pb(),11),g=BB(DSn(r,oIt).Kc().Pb(),11),p=BB(mMn(d,dlt),11),SZ(w,v=BB(mMn(g,dlt),11)),MZ(w,p),(m=new wA(g.i.n)).a=Aon(Pun(Gk(PMt,1),sVn,8,0,[v.i.n,v.n,v.a])).a,DH(w.a,m),(m=new wA(d.i.n)).a=Aon(Pun(Gk(PMt,1),sVn,8,0,[p.i.n,p.n,p.a])).a,DH(w.a,m);else{if(r.j.c.length>=2){for(b=!0,e=BB(n0(h=new Wb(r.j)),11),f=null;h.a<h.c.c.length;)if(f=e,e=BB(n0(h),11),!Nfn(mMn(f,dlt),mMn(e,dlt))){b=!1;break}}else b=!1;for(s=new Wb(r.j);s.a<s.c.c.length;)0==(o=BB(n0(s),11)).e.c.length||uxn(o,b),0==o.g.c.length||oxn(o,b)}PZ(r,null)}HSn(t)}function WUn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M;return y=n.c[(l1(0,t.c.length),BB(t.c[0],17)).p],T=n.c[(l1(1,t.c.length),BB(t.c[1],17)).p],!(y.a.e.e-y.a.a-(y.b.e.e-y.b.a)==0&&T.a.e.e-T.a.a-(T.b.e.e-T.b.a)==0||!cL(v=y.b.e.f,10)||(p=BB(v,10),j=n.i[p.p],E=p.c?E7(p.c.a,p,0):-1,a=RQn,E>0&&(c=BB(xq(p.c.a,E-1),10),u=n.i[c.p],M=e.Math.ceil(K$(n.n,c,p)),a=j.a.e-p.d.d-(u.a.e+c.o.b+c.d.a)-M),h=RQn,E<p.c.a.c.length-1&&(s=BB(xq(p.c.a,E+1),10),f=n.i[s.p],M=e.Math.ceil(K$(n.n,s,p)),h=f.a.e-s.d.d-(j.a.e+p.o.b+p.d.a)-M),!(i&&(h$(),rin(A3n),e.Math.abs(a-h)<=A3n||a==h||isNaN(a)&&isNaN(h)))&&(r=aX(y.a),o=-aX(y.b),l=-aX(T.a),m=aX(T.b),g=y.a.e.e-y.a.a-(y.b.e.e-y.b.a)>0&&T.a.e.e-T.a.a-(T.b.e.e-T.b.a)<0,d=y.a.e.e-y.a.a-(y.b.e.e-y.b.a)<0&&T.a.e.e-T.a.a-(T.b.e.e-T.b.a)>0,w=y.a.e.e+y.b.a<T.b.e.e+T.a.a,b=y.a.e.e+y.b.a>T.b.e.e+T.a.a,k=0,!g&&!d&&(b?a+l>0?k=l:h-r>0&&(k=r):w&&(a+o>0?k=o:h-m>0&&(k=m))),j.a.e+=k,j.b&&(j.d.e+=k),1)))}function VUn(n,t,i){var r,c,a,u,o,s,h,f,l,b;if(r=new UV(t.qf().a,t.qf().b,t.rf().a,t.rf().b),c=new bA,n.c)for(u=new Wb(t.wf());u.a<u.c.c.length;)a=BB(n0(u),181),c.c=a.qf().a+t.qf().a,c.d=a.qf().b+t.qf().b,c.b=a.rf().a,c.a=a.rf().b,CPn(r,c);for(h=new Wb(t.Cf());h.a<h.c.c.length;){if(f=(s=BB(n0(h),838)).qf().a+t.qf().a,l=s.qf().b+t.qf().b,n.e&&(c.c=f,c.d=l,c.b=s.rf().a,c.a=s.rf().b,CPn(r,c)),n.d)for(u=new Wb(s.wf());u.a<u.c.c.length;)a=BB(n0(u),181),c.c=a.qf().a+f,c.d=a.qf().b+l,c.b=a.rf().a,c.a=a.rf().b,CPn(r,c);if(n.b){if(b=new xC(-i,-i),BB(t.We((sWn(),fPt)),174).Hc((lIn(),rIt)))for(u=new Wb(s.wf());u.a<u.c.c.length;)a=BB(n0(u),181),b.a+=a.rf().a+i,b.b+=a.rf().b+i;b.a=e.Math.max(b.a,0),b.b=e.Math.max(b.b,0),X_n(r,s.Bf(),s.zf(),t,s,b,i)}}n.b&&X_n(r,t.Bf(),t.zf(),t,null,null,i),(o=new A_(t.Af())).d=e.Math.max(0,t.qf().b-r.d),o.a=e.Math.max(0,r.d+r.a-(t.qf().b+t.rf().b)),o.b=e.Math.max(0,t.qf().a-r.c),o.c=e.Math.max(0,r.c+r.b-(t.qf().a+t.rf().a)),t.Ef(o)}function QUn(){var n=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F"];return n[34]='\\"',n[92]="\\\\",n[173]="\\u00ad",n[1536]="\\u0600",n[1537]="\\u0601",n[1538]="\\u0602",n[1539]="\\u0603",n[1757]="\\u06dd",n[1807]="\\u070f",n[6068]="\\u17b4",n[6069]="\\u17b5",n[8203]="\\u200b",n[8204]="\\u200c",n[8205]="\\u200d",n[8206]="\\u200e",n[8207]="\\u200f",n[8232]="\\u2028",n[8233]="\\u2029",n[8234]="\\u202a",n[8235]="\\u202b",n[8236]="\\u202c",n[8237]="\\u202d",n[8238]="\\u202e",n[8288]="\\u2060",n[8289]="\\u2061",n[8290]="\\u2062",n[8291]="\\u2063",n[8292]="\\u2064",n[8298]="\\u206a",n[8299]="\\u206b",n[8300]="\\u206c",n[8301]="\\u206d",n[8302]="\\u206e",n[8303]="\\u206f",n[65279]="\\ufeff",n[65529]="\\ufff9",n[65530]="\\ufffa",n[65531]="\\ufffb",n}function YUn(n,t,e){var i,r,c,a,u,o,s,h,f,l;for(o=new Np,f=t.length,a=Ion(e),s=0;s<f;++s){switch(h=yN(t,YTn(61),s),c=(r=uun(i=fln(a,t.substr(s,h-s)))).Aj().Nh(),fV(t,++h)){case 39:u=lx(t,39,++h),WB(o,new CI(i,YV(t.substr(h,u-h),c,r))),s=u+1;break;case 34:u=lx(t,34,++h),WB(o,new CI(i,YV(t.substr(h,u-h),c,r))),s=u+1;break;case 91:WB(o,new CI(i,l=new Np));n:for(;;){switch(fV(t,++h)){case 39:u=lx(t,39,++h),WB(l,YV(t.substr(h,u-h),c,r)),h=u+1;break;case 34:u=lx(t,34,++h),WB(l,YV(t.substr(h,u-h),c,r)),h=u+1;break;case 110:if(++h,t.indexOf("ull",h)!=h)throw Hp(new dy(a6n));l.c[l.c.length]=null,h+=3}if(!(h<f))break;switch(b1(h,t.length),t.charCodeAt(h)){case 44:break;case 93:break n;default:throw Hp(new dy("Expecting , or ]"))}}s=h+1;break;case 110:if(++h,t.indexOf("ull",h)!=h)throw Hp(new dy(a6n));WB(o,new CI(i,null)),s=h+3}if(!(s<f))break;if(b1(s,t.length),44!=t.charCodeAt(s))throw Hp(new dy("Expecting ,"))}return iDn(n,o,e)}function JUn(n,t){var e,i,r,c,a,u,o,s,h,f,l;for(s=BB(BB(h6(n.r,t),21),84),a=JTn(n,t),e=n.u.Hc((lIn(),nIt)),o=s.Kc();o.Ob();)if((u=BB(o.Pb(),111)).c&&!(u.c.d.c.length<=0)){switch(l=u.b.rf(),(f=(h=u.c).i).b=(c=h.n,h.e.a+c.b+c.c),f.a=(r=h.n,h.e.b+r.d+r.a),t.g){case 1:u.a?(f.c=(l.a-f.b)/2,l9(h,(J9(),Qit))):a||e?(f.c=-f.b-n.s,l9(h,(J9(),Jit))):(f.c=l.a+n.s,l9(h,(J9(),Yit))),f.d=-f.a-n.t,WD(h,(G7(),irt));break;case 3:u.a?(f.c=(l.a-f.b)/2,l9(h,(J9(),Qit))):a||e?(f.c=-f.b-n.s,l9(h,(J9(),Jit))):(f.c=l.a+n.s,l9(h,(J9(),Yit))),f.d=l.b+n.t,WD(h,(G7(),crt));break;case 2:u.a?(i=n.v?f.a:BB(xq(h.d,0),181).rf().b,f.d=(l.b-i)/2,WD(h,(G7(),rrt))):a||e?(f.d=-f.a-n.t,WD(h,(G7(),irt))):(f.d=l.b+n.t,WD(h,(G7(),crt))),f.c=l.a+n.s,l9(h,(J9(),Yit));break;case 4:u.a?(i=n.v?f.a:BB(xq(h.d,0),181).rf().b,f.d=(l.b-i)/2,WD(h,(G7(),rrt))):a||e?(f.d=-f.a-n.t,WD(h,(G7(),irt))):(f.d=l.b+n.t,WD(h,(G7(),crt))),f.c=-f.b-n.s,l9(h,(J9(),Jit))}a=!1}}function ZUn(n,t){var e,i,r,c,a,u,o,s,h,f,l;if(wWn(),0==NT(iNt)){for(f=x8(INt,sVn,117,cNt.length,0,1),a=0;a<f.length;a++)f[a]=new M0(4);for(i=new Pk,c=0;c<eNt.length;c++){if(h=new M0(4),c<84?(b1(u=2*c,vnt.length),l=vnt.charCodeAt(u),b1(u+1,vnt.length),Yxn(h,l,vnt.charCodeAt(u+1))):Yxn(h,aNt[u=2*(c-84)],aNt[u+1]),mK(o=eNt[c],"Specials")&&Yxn(h,65520,65533),mK(o,gnt)&&(Yxn(h,983040,1048573),Yxn(h,1048576,1114109)),mZ(iNt,o,h),mZ(rNt,o,$Fn(h)),0<(s=i.a.length)?i.a=i.a.substr(0,0):0>s&&(i.a+=rL(x8(ONt,WVn,25,-s,15,1))),i.a+="Is",GO(o,YTn(32))>=0)for(r=0;r<o.length;r++)b1(r,o.length),32!=o.charCodeAt(r)&&NX(i,(b1(r,o.length),o.charCodeAt(r)));else i.a+=""+o;Tdn(i.a,o,!0)}Tdn(pnt,"Cn",!1),Tdn(mnt,"Cn",!0),Yxn(e=new M0(4),0,unt),mZ(iNt,"ALL",e),mZ(rNt,"ALL",$Fn(e)),!SNt&&(SNt=new xp),mZ(SNt,pnt,pnt),!SNt&&(SNt=new xp),mZ(SNt,mnt,mnt),!SNt&&(SNt=new xp),mZ(SNt,"ALL","ALL")}return BB(SJ(t?iNt:rNt,n),136)}function nXn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p;if(l=!1,f=!1,vA(BB(mMn(i,(HXn(),ept)),98))){a=!1,u=!1;n:for(w=new Wb(i.j);w.a<w.c.c.length;)for(b=BB(n0(w),11),d=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[new Hw(b),new Gw(b)])));dAn(d);)if(!qy(TD(mMn(BB(U5(d),11).i,Tdt)))){if(b.j==(kUn(),sIt)){a=!0;break n}if(b.j==SIt){u=!0;break n}}l=u&&!a,f=a&&!u}if(l||f||0==i.b.c.length)p=!f;else{for(h=0,s=new Wb(i.b);s.a<s.c.c.length;)h+=(o=BB(n0(s),70)).n.b+o.o.b/2;p=(h/=i.b.c.length)>=i.o.b/2}p?(g=BB(mMn(i,(hWn(),Klt)),15))?l?c=g:(r=BB(mMn(i,Dft),15))?c=g.gc()<=r.gc()?g:r:(c=new Np,hon(i,Dft,c)):(c=new Np,hon(i,Klt,c)):(r=BB(mMn(i,(hWn(),Dft)),15))?f?c=r:(g=BB(mMn(i,Klt),15))?c=r.gc()<=g.gc()?r:g:(c=new Np,hon(i,Klt,c)):(c=new Np,hon(i,Dft,c)),c.Fc(n),hon(n,(hWn(),Kft),e),t.d==e?(MZ(t,null),e.e.c.length+e.g.c.length==0&&CZ(e,null),gsn(e)):(SZ(t,null),e.e.c.length+e.g.c.length==0&&CZ(e,null)),yQ(t.a)}function tXn(n,t){var e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I;for(v=new M2(n.b,0),d=0,s=BB((f=t.Kc()).Pb(),19).a,k=0,e=new Rv,E=new fA;v.b<v.d.gc();){for(Px(v.b<v.d.gc()),y=new Wb(BB(v.d.Xb(v.c=v.b++),29).a);y.a<y.c.c.length;){for(w=new oz(ZL(lbn(m=BB(n0(y),10)).a.Kc(),new h));dAn(w);)l=BB(U5(w),17),E.a.zc(l,E);for(b=new oz(ZL(fbn(m).a.Kc(),new h));dAn(b);)l=BB(U5(b),17),E.a.Bc(l)}if(d+1==s){for(yR(v,r=new HX(n)),yR(v,c=new HX(n)),M=E.a.ec().Kc();M.Ob();)T=BB(M.Pb(),17),e.a._b(T)||(++k,e.a.zc(T,e)),hon(a=new $vn(n),(HXn(),ept),(QEn(),VCt)),PZ(a,r),Bl(a,(uSn(),Tut)),CZ(g=new CSn,a),qCn(g,(kUn(),CIt)),CZ(S=new CSn,a),qCn(S,oIt),hon(i=new $vn(n),ept,VCt),PZ(i,c),Bl(i,Tut),CZ(p=new CSn,i),qCn(p,CIt),CZ(P=new CSn,i),qCn(P,oIt),SZ(j=new wY,T.c),MZ(j,g),SZ(I=new wY,S),MZ(I,p),SZ(T,P),u=new v3(a,i,j,I,T),hon(a,(hWn(),Rft),u),hon(i,Rft,u),(C=j.c.i).k==Tut&&((o=BB(mMn(C,Rft),305)).d=u,u.g=o);if(!f.Ob())break;s=BB(f.Pb(),19).a}++d}return iln(k)}function eXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d;for(f=0,r=new AL((!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));r.e!=r.i.gc();)qy(TD(ZAn(i=BB(kpn(r),33),(HXn(),Ggt))))||(GI(ZAn(t,Ldt))===GI((mon(),Nvt))&&GI(ZAn(t,Gdt))!==GI((Vvn(),Eht))&&GI(ZAn(t,Gdt))!==GI((Vvn(),kht))&&!qy(TD(ZAn(t,xdt)))&&GI(ZAn(t,Cdt))===GI((Bfn(),wut))||qy(TD(ZAn(i,$dt)))||(Ypn(i,(hWn(),wlt),iln(f)),++f),wzn(n,i,e));for(f=0,s=new AL((!t.b&&(t.b=new eU(_Ot,t,12,3)),t.b));s.e!=s.i.gc();)u=BB(kpn(s),79),(GI(ZAn(t,(HXn(),Ldt)))!==GI((mon(),Nvt))||GI(ZAn(t,Gdt))===GI((Vvn(),Eht))||GI(ZAn(t,Gdt))===GI((Vvn(),kht))||qy(TD(ZAn(t,xdt)))||GI(ZAn(t,Cdt))!==GI((Bfn(),wut)))&&(Ypn(u,(hWn(),wlt),iln(f)),++f),w=PMn(u),d=OMn(u),h=qy(TD(ZAn(w,wgt))),b=!qy(TD(ZAn(u,Ggt))),l=h&&QIn(u)&&qy(TD(ZAn(u,dgt))),c=JJ(w)==t&&JJ(w)==JJ(d),a=(JJ(w)==t&&d==t)^(JJ(d)==t&&w==t),b&&!l&&(a||c)&&uWn(n,u,t,e);if(JJ(t))for(o=new AL(iQ(JJ(t)));o.e!=o.i.gc();)(w=PMn(u=BB(kpn(o),79)))==t&&QIn(u)&&(l=qy(TD(ZAn(w,(HXn(),wgt))))&&qy(TD(ZAn(u,dgt))))&&uWn(n,u,t,e)}function iXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A;for(OTn(i,"MinWidth layering",1),w=t.b,T=t.a,A=BB(mMn(t,(HXn(),Egt)),19).a,o=BB(mMn(t,Tgt),19).a,n.b=Gy(MD(mMn(t,ypt))),n.d=RQn,k=new Wb(T);k.a<k.c.c.length;)(m=BB(n0(k),10)).k==(uSn(),Cut)&&(P=m.o.b,n.d=e.Math.min(n.d,P));for(n.d=e.Math.max(1,n.d),M=T.c.length,n.c=x8(ANt,hQn,25,M,15,1),n.f=x8(ANt,hQn,25,M,15,1),n.e=x8(xNt,qQn,25,M,15,1),h=0,n.a=0,j=new Wb(T);j.a<j.c.c.length;)(m=BB(n0(j),10)).p=h++,n.c[m.p]=whn(fbn(m)),n.f[m.p]=whn(lbn(m)),n.e[m.p]=m.o.b/n.d,n.a+=n.e[m.p];for(n.b/=n.d,n.a/=M,E=jOn(T),m$(T,QW(new Kd(n))),g=RQn,d=DWn,u=null,O=A,I=A,a=o,c=o,A<0&&(O=BB(Tmt.a.zd(),19).a,I=BB(Tmt.b.zd(),19).a),o<0&&(a=BB(Emt.a.zd(),19).a,c=BB(Emt.b.zd(),19).a),C=O;C<=I;C++)for(r=a;r<=c;r++)v=Gy(MD((S=LBn(n,C,r,T,E)).a)),p=(b=BB(S.b,15)).gc(),(v<g||v==g&&p<d)&&(g=v,d=p,u=b);for(l=u.Kc();l.Ob();){for(f=BB(l.Pb(),15),s=new HX(t),y=f.Kc();y.Ob();)PZ(m=BB(y.Pb(),10),s);w.c[w.c.length]=s}JPn(w),T.c=x8(Ant,HWn,1,0,5,1),HSn(i)}function rXn(n,t){var i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M;for(n.b=t,n.a=BB(mMn(t,(HXn(),hgt)),19).a,n.c=BB(mMn(t,lgt),19).a,0==n.c&&(n.c=DWn),g=new M2(t.b,0);g.b<g.d.gc();){for(Px(g.b<g.d.gc()),d=BB(g.d.Xb(g.c=g.b++),29),o=new Np,l=-1,y=-1,m=new Wb(d.a);m.a<m.c.c.length;)v=BB(n0(m),10),F3((q_(),new oz(ZL(hbn(v).a.Kc(),new h))))>=n.a&&(r=yBn(n,v),l=e.Math.max(l,r.b),y=e.Math.max(y,r.d),WB(o,new rI(v,r)));for(E=new Np,f=0;f<l;++f)kG(E,0,(Px(g.b>0),g.a.Xb(g.c=--g.b),yR(g,T=new HX(n.b)),Px(g.b<g.d.gc()),g.d.Xb(g.c=g.b++),T));for(u=new Wb(o);u.a<u.c.c.length;)if(c=BB(n0(u),46),w=BB(c.b,571).a)for(b=new Wb(w);b.a<b.c.c.length;)ukn(n,BB(n0(b),10),Uut,E);for(i=new Np,s=0;s<y;++s)WB(i,(yR(g,M=new HX(n.b)),M));for(a=new Wb(o);a.a<a.c.c.length;)if(c=BB(n0(a),46),j=BB(c.b,571).c)for(k=new Wb(j);k.a<k.c.c.length;)ukn(n,BB(n0(k),10),Xut,i)}for(p=new M2(t.b,0);p.b<p.d.gc();)Px(p.b<p.d.gc()),0==BB(p.d.Xb(p.c=p.b++),29).a.c.length&&fW(p)}function cXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(OTn(i,"Spline edge routing",1),0==t.b.c.length)return t.f.a=0,void HSn(i);v=Gy(MD(mMn(t,(HXn(),Apt)))),o=Gy(MD(mMn(t,Tpt))),u=Gy(MD(mMn(t,kpt))),T=BB(mMn(t,rgt),336)==(Usn(),rmt),E=Gy(MD(mMn(t,cgt))),n.d=t,n.j.c=x8(Ant,HWn,1,0,5,1),n.a.c=x8(Ant,HWn,1,0,5,1),$U(n.k),f=VI((s=BB(xq(t.b,0),29)).a,(dxn(),jyt)),l=VI((d=BB(xq(t.b,t.b.c.length-1),29)).a,jyt),g=new Wb(t.b),p=null,C=0;do{for(RUn(n,p,m=g.a<g.c.c.length?BB(n0(g),29):null),MFn(n),P=0,y=C,b=!p||f&&p==s,w=!m||l&&m==d,(M=_k(rcn(NV(AV(new Rq(null,new w1(n.i,16)),new ya),new ma))))>0?(h=0,p&&(h+=o),h+=(M-1)*u,m&&(h+=o),T&&m&&(h=e.Math.max(h,nxn(m,u,v,E))),h<v&&!b&&!w&&(P=(v-h)/2,h=v),y+=h):!b&&!w&&(y+=v),m&&Tqn(m,y),j=new Wb(n.i);j.a<j.c.c.length;)(k=BB(n0(j),128)).a.c=C,k.a.b=y-C,k.F=P,k.p=!p;gun(n.a,n.i),C=y,m&&(C+=m.c.a),p=m,b=w}while(m);for(c=new Wb(n.j);c.a<c.c.c.length;)a=man(n,r=BB(n0(c),17)),hon(r,(hWn(),$lt),a),S=Dxn(n,r),hon(r,Nlt,S);t.f.a=C,n.d=null,HSn(i)}function aXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m;if(d=0!=n.i,v=!1,g=null,mA(n.e)){if((h=t.gc())>0){for(l=h<100?null:new Fj(h),w=(s=new jcn(t)).g,g=x8(ANt,hQn,25,h,15,1),i=0,m=new gtn(h),r=0;r<n.i;++r){b=u=n.g[r];n:for(p=0;p<2;++p){for(o=h;--o>=0;)if(null!=b?Nfn(b,w[o]):GI(b)===GI(w[o])){g.length<=i&&aHn(g,0,g=x8(ANt,hQn,25,2*g.length,15,1),0,i),g[i++]=r,f9(m,w[o]);break n}if(GI(b)===GI(u))break}}if(s=m,w=m.g,h=i,i>g.length&&aHn(g,0,g=x8(ANt,hQn,25,i,15,1),0,i),i>0){for(v=!0,c=0;c<i;++c)l=zK(n,BB(b=w[c],72),l);for(a=i;--a>=0;)Lyn(n,g[a]);if(i!=h){for(r=h;--r>=i;)Lyn(s,r);aHn(g,0,g=x8(ANt,hQn,25,i,15,1),0,i)}t=s}}}else for(t=jyn(n,t),r=n.i;--r>=0;)t.Hc(n.g[r])&&(Lyn(n,r),v=!0);if(v){if(null!=g){for(f=1==(e=t.gc())?yZ(n,4,t.Kc().Pb(),null,g[0],d):yZ(n,6,t,g,g[0],d),l=e<100?null:new Fj(e),r=t.Kc();r.Ob();)l=qK(n,BB(b=r.Pb(),72),l);l?(l.Ei(f),l.Fi()):ban(n.e,f)}else{for(l=$K(t.gc()),r=t.Kc();r.Ob();)l=qK(n,BB(b=r.Pb(),72),l);l&&l.Fi()}return!0}return!1}function uXn(n,t){var e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m;for((e=new hvn(t)).a||g_n(t),s=lRn(t),o=new pJ,g=new Qxn,d=new Wb(t.a);d.a<d.c.c.length;)for(r=new oz(ZL(lbn(BB(n0(d),10)).a.Kc(),new h));dAn(r);)(i=BB(U5(r),17)).c.i.k!=(uSn(),Mut)&&i.d.i.k!=Mut||JIn(o,upn((f=lzn(n,i,s,g)).d),f.a);for(a=new Np,m=BB(mMn(e.c,(hWn(),Xft)),21).Kc();m.Ob();){switch(v=BB(m.Pb(),61),w=g.c[v.g],b=g.b[v.g],u=g.a[v.g],c=null,p=null,v.g){case 4:c=new UV(n.d.a,w,s.b.a-n.d.a,b-w),p=new UV(n.d.a,w,u,b-w),zH(s,new xC(c.c+c.b,c.d)),zH(s,new xC(c.c+c.b,c.d+c.a));break;case 2:c=new UV(s.a.a,w,n.c.a-s.a.a,b-w),p=new UV(n.c.a-u,w,u,b-w),zH(s,new xC(c.c,c.d)),zH(s,new xC(c.c,c.d+c.a));break;case 1:c=new UV(w,n.d.b,b-w,s.b.b-n.d.b),p=new UV(w,n.d.b,b-w,u),zH(s,new xC(c.c,c.d+c.a)),zH(s,new xC(c.c+c.b,c.d+c.a));break;case 3:c=new UV(w,s.a.b,b-w,n.c.b-s.a.b),p=new UV(w,n.c.b-u,b-w,u),zH(s,new xC(c.c,c.d)),zH(s,new xC(c.c+c.b,c.d))}c&&((l=new nm).d=v,l.b=c,l.c=p,l.a=JQ(BB(h6(o,upn(v)),21)),a.c[a.c.length]=l)}return gun(e.b,a),e.d=Bhn(nGn(s)),e}function oXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d;if(null==i.p[t.p]){o=!0,i.p[t.p]=0,u=t,d=i.o==(oZ(),ryt)?KQn:RQn;do{c=n.b.e[u.p],a=u.c.a.c.length,i.o==ryt&&c>0||i.o==cyt&&c<a-1?(s=null,h=null,s=i.o==cyt?BB(xq(u.c.a,c+1),10):BB(xq(u.c.a,c-1),10),oXn(n,h=i.g[s.p],i),d=n.e.bg(d,t,u),i.j[t.p]==t&&(i.j[t.p]=i.j[h.p]),i.j[t.p]==i.j[h.p]?(w=K$(n.d,u,s),i.o==cyt?(r=Gy(i.p[t.p]),l=Gy(i.p[h.p])+Gy(i.d[s.p])-s.d.d-w-u.d.a-u.o.b-Gy(i.d[u.p]),o?(o=!1,i.p[t.p]=e.Math.min(l,d)):i.p[t.p]=e.Math.min(r,e.Math.min(l,d))):(r=Gy(i.p[t.p]),l=Gy(i.p[h.p])+Gy(i.d[s.p])+s.o.b+s.d.a+w+u.d.d-Gy(i.d[u.p]),o?(o=!1,i.p[t.p]=e.Math.max(l,d)):i.p[t.p]=e.Math.max(r,e.Math.max(l,d)))):(w=Gy(MD(mMn(n.a,(HXn(),Opt)))),b=krn(n,i.j[t.p]),f=krn(n,i.j[h.p]),i.o==cyt?U1(b,f,Gy(i.p[t.p])+Gy(i.d[u.p])+u.o.b+u.d.a+w-(Gy(i.p[h.p])+Gy(i.d[s.p])-s.d.d)):U1(b,f,Gy(i.p[t.p])+Gy(i.d[u.p])-u.d.d-Gy(i.p[h.p])-Gy(i.d[s.p])-s.o.b-s.d.a-w))):d=n.e.bg(d,t,u),u=i.a[u.p]}while(u!=t);Ov(n.e,t)}}function sXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;for(f=t,h=new pJ,l=new pJ,c=N2(f,x6n),GSn((i=new fQ(n,e,h,l)).a,i.b,i.c,i.d,c),d=(h.i||(h.i=new HL(h,h.c))).Kc();d.Ob();)for(w=BB(d.Pb(),202),u=BB(h6(h,w),21).Kc();u.Ob();){if(a=u.Pb(),!(b=BB(sen(n.d,a),202)))throw r=R2(f,q6n),Hp(new ek(V6n+a+Q6n+r+W6n));!w.e&&(w.e=new hK(FOt,w,10,9)),f9(w.e,b)}for(p=(l.i||(l.i=new HL(l,l.c))).Kc();p.Ob();)for(g=BB(p.Pb(),202),s=BB(h6(l,g),21).Kc();s.Ob();){if(o=s.Pb(),!(b=BB(sen(n.d,o),202)))throw r=R2(f,q6n),Hp(new ek(V6n+o+Q6n+r+W6n));!g.g&&(g.g=new hK(FOt,g,9,10)),f9(g.g,b)}!e.b&&(e.b=new hK(KOt,e,4,7)),0!=e.b.i&&(!e.c&&(e.c=new hK(KOt,e,5,8)),0!=e.c.i)&&(!e.b&&(e.b=new hK(KOt,e,4,7)),e.b.i<=1&&(!e.c&&(e.c=new hK(KOt,e,5,8)),e.c.i<=1))&&1==(!e.a&&(e.a=new eU(FOt,e,6,6)),e.a).i&&(Svn(v=BB(Wtn((!e.a&&(e.a=new eU(FOt,e,6,6)),e.a),0),202))||Pvn(v)||(Lin(v,BB(Wtn((!e.b&&(e.b=new hK(KOt,e,4,7)),e.b),0),82)),Nin(v,BB(Wtn((!e.c&&(e.c=new hK(KOt,e,5,8)),e.c),0),82))))}function hXn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S;for(y=0,k=(m=n.a).length;y<k;++y){for(v=m[y],s=DWn,h=DWn,w=new Wb(v.e);w.a<w.c.c.length;)(a=(l=BB(n0(w),10)).c?E7(l.c.a,l,0):-1)>0?(f=BB(xq(l.c.a,a-1),10),T=K$(n.b,l,f),g=l.n.b-l.d.d-(f.n.b+f.o.b+f.d.a+T)):g=l.n.b-l.d.d,s=e.Math.min(g,s),a<l.c.a.c.length-1?(f=BB(xq(l.c.a,a+1),10),T=K$(n.b,l,f),p=f.n.b-f.d.d-(l.n.b+l.o.b+l.d.a+T)):p=2*l.n.b,h=e.Math.min(p,h);for(o=DWn,c=!1,S=new Wb((r=BB(xq(v.e,0),10)).j);S.a<S.c.c.length;)for(M=BB(n0(S),11),d=r.n.b+M.n.b+M.a.b,i=new Wb(M.e);i.a<i.c.c.length;)t=(j=BB(n0(i),17).c).i.n.b+j.n.b+j.a.b-d,e.Math.abs(t)<e.Math.abs(o)&&e.Math.abs(t)<(t<0?s:h)&&(o=t,c=!0);for(E=new Wb((u=BB(xq(v.e,v.e.c.length-1),10)).j);E.a<E.c.c.length;)for(j=BB(n0(E),11),d=u.n.b+j.n.b+j.a.b,i=new Wb(j.g);i.a<i.c.c.length;)t=(M=BB(n0(i),17).d).i.n.b+M.n.b+M.a.b-d,e.Math.abs(t)<e.Math.abs(o)&&e.Math.abs(t)<(t<0?s:h)&&(o=t,c=!0);if(c&&0!=o)for(b=new Wb(v.e);b.a<b.c.c.length;)(l=BB(n0(b),10)).n.b+=o}}function fXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g;if(hU(n.a,t)){if(FT(BB(RX(n.a,t),53),e))return 1}else VW(n.a,t,new Rv);if(hU(n.a,e)){if(FT(BB(RX(n.a,e),53),t))return-1}else VW(n.a,e,new Rv);if(hU(n.e,t)){if(FT(BB(RX(n.e,t),53),e))return-1}else VW(n.e,t,new Rv);if(hU(n.e,e)){if(FT(BB(RX(n.a,e),53),t))return 1}else VW(n.e,e,new Rv);if(n.c==(mon(),xvt)||!Lx(t,(hWn(),wlt))||!Lx(e,(hWn(),wlt))){if(o=BB(EN(M4(Qon(AV(new Rq(null,new w1(t.j,16)),new sc)),new hc)),11),h=BB(EN(M4(Qon(AV(new Rq(null,new w1(e.j,16)),new fc)),new lc)),11),o&&h){if(u=o.i,s=h.i,u&&u==s){for(l=new Wb(u.j);l.a<l.c.c.length;){if((f=BB(n0(l),11))==o)return aKn(n,e,t),-1;if(f==h)return aKn(n,t,e),1}return E$(iEn(n,t),iEn(n,e))}for(d=0,g=(w=n.d).length;d<g;++d){if((b=w[d])==u)return aKn(n,e,t),-1;if(b==s)return aKn(n,t,e),1}}if(!Lx(t,(hWn(),wlt))||!Lx(e,wlt))return(r=iEn(n,t))>(a=iEn(n,e))?aKn(n,t,e):aKn(n,e,t),r<a?-1:r>a?1:0}return(i=BB(mMn(t,(hWn(),wlt)),19).a)>(c=BB(mMn(e,wlt),19).a)?aKn(n,t,e):aKn(n,e,t),i<c?-1:i>c?1:0}function lXn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d;if(qy(TD(ZAn(t,(sWn(),zSt)))))return SQ(),SQ(),set;if(o=0!=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,s=!(h=yIn(t)).dc(),o||s){if(!(r=BB(ZAn(t,mPt),149)))throw Hp(new rk("Resolved algorithm is not set; apply a LayoutAlgorithmResolver before computing layout."));if(d=OC(r,(hAn(),nAt)),Ngn(t),!o&&s&&!d)return SQ(),SQ(),set;if(u=new Np,GI(ZAn(t,ESt))===GI((ufn(),pCt))&&(OC(r,YOt)||OC(r,QOt)))for(l=pRn(n,t),Frn(b=new YT,(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));0!=b.b;)Ngn(f=BB(0==b.b?null:(Px(0!=b.b),Atn(b,b.a.a)),33)),GI(ZAn(f,ESt))===GI(mCt)||P8(f,eSt)&&!j5(r,ZAn(f,mPt))?(gun(u,lXn(n,f,e,i)),Ypn(f,ESt,mCt),KKn(f)):Frn(b,(!f.a&&(f.a=new eU(UOt,f,10,11)),f.a));else for(l=(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a).i,a=new AL((!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));a.e!=a.i.gc();)gun(u,lXn(n,c=BB(kpn(a),33),e,i)),KKn(c);for(w=new Wb(u);w.a<w.c.c.length;)Ypn(BB(n0(w),79),zSt,(hN(),!0));return Ugn(t,r,mcn(i,l)),w_n(u),s&&d?h:(SQ(),SQ(),set)}return SQ(),SQ(),set}function bXn(n,t,e,i,r,c,a,u,o){var s,h,f,l,b,w,d;switch(b=e,Bl(h=new $vn(o),(uSn(),Mut)),hon(h,(hWn(),Yft),a),hon(h,(HXn(),ept),(QEn(),XCt)),d=Gy(MD(n.We(tpt))),hon(h,tpt,d),CZ(f=new CSn,h),t!=QCt&&t!=YCt||(b=i>=0?hwn(u):Tln(hwn(u)),n.Ye(upt,b)),s=new Gj,l=!1,n.Xe(npt)?(Hx(s,BB(n.We(npt),8)),l=!0):yL(s,a.a/2,a.b/2),b.g){case 4:hon(h,kgt,(Tbn(),Flt)),hon(h,Gft,(Jun(),$ht)),h.o.b=a.b,d<0&&(h.o.a=-d),qCn(f,(kUn(),oIt)),l||(s.a=a.a),s.a-=a.a;break;case 2:hon(h,kgt,(Tbn(),Hlt)),hon(h,Gft,(Jun(),Oht)),h.o.b=a.b,d<0&&(h.o.a=-d),qCn(f,(kUn(),CIt)),l||(s.a=0);break;case 1:hon(h,ilt,(z7(),Cft)),h.o.a=a.a,d<0&&(h.o.b=-d),qCn(f,(kUn(),SIt)),l||(s.b=a.b),s.b-=a.b;break;case 3:hon(h,ilt,(z7(),Sft)),h.o.a=a.a,d<0&&(h.o.b=-d),qCn(f,(kUn(),sIt)),l||(s.b=0)}if(Hx(f.n,s),hon(h,npt,s),t==UCt||t==WCt||t==XCt){if(w=0,t==UCt&&n.Xe(ipt))switch(b.g){case 1:case 2:w=BB(n.We(ipt),19).a;break;case 3:case 4:w=-BB(n.We(ipt),19).a}else switch(b.g){case 4:case 2:w=c.b,t==WCt&&(w/=r.b);break;case 1:case 3:w=c.a,t==WCt&&(w/=r.a)}hon(h,Tlt,w)}return hon(h,Qft,b),h}function wXn(n){var t,e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E;if((e=Gy(MD(mMn(n.a.j,(HXn(),_dt)))))<-1||!n.a.i||LK(BB(mMn(n.a.o,ept),98))||abn(n.a.o,(kUn(),oIt)).gc()<2&&abn(n.a.o,CIt).gc()<2)return!0;if(n.a.c.Rf())return!1;for(y=0,m=0,v=new Np,o=0,s=(u=n.a.e).length;o<s;++o){for(b=0,d=(l=u[o]).length;b<d;++b)if((f=l[b]).k!=(uSn(),Iut)){for(i=n.b[f.c.p][f.p],f.k==Mut?(i.b=1,BB(mMn(f,(hWn(),dlt)),11).j==(kUn(),oIt)&&(m+=i.a)):(E=abn(f,(kUn(),CIt))).dc()||!tL(E,new Nc)?i.c=1:((r=abn(f,oIt)).dc()||!tL(r,new Lc))&&(y+=i.a),a=new oz(ZL(lbn(f).a.Kc(),new h));dAn(a);)c=BB(U5(a),17),y+=i.c,m+=i.b,X8(n,i,c.d.i);for(j=new oz(new WL((g=Wen(Pun(Gk(xnt,1),HWn,20,0,[abn(f,(kUn(),sIt)),abn(f,SIt)]))).a.length,g.a));dAn(j);)k=BB(U5(j),11),(p=BB(mMn(k,(hWn(),Elt)),10))&&(y+=i.c,m+=i.b,X8(n,i,p))}else v.c[v.c.length]=f;for(w=new Wb(v);w.a<w.c.c.length;)for(f=BB(n0(w),10),i=n.b[f.c.p][f.p],a=new oz(ZL(lbn(f).a.Kc(),new h));dAn(a);)c=BB(U5(a),17),y+=i.c,m+=i.b,X8(n,i,c.d.i);v.c=x8(Ant,HWn,1,0,5,1)}return(0==(t=y+m)?RQn:(y-m)/t)>=e}function dXn(){function n(n){var t=this;this.dispatch=function(t){var e=t.data;switch(e.cmd){case"algorithms":var i=Swn((SQ(),new Hb(new Ob(lAt.b))));n.postMessage({id:e.id,data:i});break;case"categories":var r=Swn((SQ(),new Hb(new Ob(lAt.c))));n.postMessage({id:e.id,data:r});break;case"options":var c=Swn((SQ(),new Hb(new Ob(lAt.d))));n.postMessage({id:e.id,data:c});break;case"register":lGn(e.algorithms),n.postMessage({id:e.id});break;case"layout":xBn(e.graph,e.layoutOptions||{},e.options||{}),n.postMessage({id:e.id,data:e.graph})}},this.saveDispatch=function(e){try{t.dispatch(e)}catch(i){n.postMessage({id:e.data.id,error:i})}}}function e(t){var e=this;this.dispatcher=new n({postMessage:function(n){e.onmessage({data:n})}}),this.postMessage=function(n){setTimeout((function(){e.dispatcher.saveDispatch({data:n})}),0)}}if(aE(),typeof document===gYn&&typeof self!==gYn){var r=new n(self);self.onmessage=r.saveDispatch}else typeof t!==gYn&&t.exports&&(Object.defineProperty(i,"__esModule",{value:!0}),t.exports={default:e,Worker:e})}function gXn(n){n.N||(n.N=!0,n.b=kan(n,0),Rrn(n.b,0),Rrn(n.b,1),Rrn(n.b,2),n.bb=kan(n,1),Rrn(n.bb,0),Rrn(n.bb,1),n.fb=kan(n,2),Rrn(n.fb,3),Rrn(n.fb,4),Krn(n.fb,5),n.qb=kan(n,3),Rrn(n.qb,0),Krn(n.qb,1),Krn(n.qb,2),Rrn(n.qb,3),Rrn(n.qb,4),Krn(n.qb,5),Rrn(n.qb,6),n.a=jan(n,4),n.c=jan(n,5),n.d=jan(n,6),n.e=jan(n,7),n.f=jan(n,8),n.g=jan(n,9),n.i=jan(n,10),n.j=jan(n,11),n.k=jan(n,12),n.n=jan(n,13),n.o=jan(n,14),n.p=jan(n,15),n.q=jan(n,16),n.s=jan(n,17),n.r=jan(n,18),n.t=jan(n,19),n.u=jan(n,20),n.v=jan(n,21),n.w=jan(n,22),n.B=jan(n,23),n.A=jan(n,24),n.C=jan(n,25),n.D=jan(n,26),n.F=jan(n,27),n.G=jan(n,28),n.H=jan(n,29),n.J=jan(n,30),n.I=jan(n,31),n.K=jan(n,32),n.M=jan(n,33),n.L=jan(n,34),n.P=jan(n,35),n.Q=jan(n,36),n.R=jan(n,37),n.S=jan(n,38),n.T=jan(n,39),n.U=jan(n,40),n.V=jan(n,41),n.X=jan(n,42),n.W=jan(n,43),n.Y=jan(n,44),n.Z=jan(n,45),n.$=jan(n,46),n._=jan(n,47),n.ab=jan(n,48),n.cb=jan(n,49),n.db=jan(n,50),n.eb=jan(n,51),n.gb=jan(n,52),n.hb=jan(n,53),n.ib=jan(n,54),n.jb=jan(n,55),n.kb=jan(n,56),n.lb=jan(n,57),n.mb=jan(n,58),n.nb=jan(n,59),n.ob=jan(n,60),n.pb=jan(n,61))}function pXn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;if(m=0,0==t.f.a)for(p=new Wb(n);p.a<p.c.c.length;)d=BB(n0(p),10),m=e.Math.max(m,d.n.a+d.o.a+d.d.c);else m=t.f.a-t.c.a;for(m-=t.c.a,g=new Wb(n);g.a<g.c.c.length;){switch(Zp((d=BB(n0(g),10)).n,m-d.o.a),cH(d.f),Vmn(d),(d.q?d.q:(SQ(),SQ(),het))._b((HXn(),spt))&&Zp(BB(mMn(d,spt),8),m-d.o.a),BB(mMn(d,kdt),248).g){case 1:hon(d,kdt,(wvn(),$Mt));break;case 2:hon(d,kdt,(wvn(),AMt))}for(v=d.o,k=new Wb(d.j);k.a<k.c.c.length;){for(Zp((y=BB(n0(k),11)).n,v.a-y.o.a),Zp(y.a,y.o.a),qCn(y,Icn(y.j)),(u=BB(mMn(y,ipt),19))&&hon(y,ipt,iln(-u.a)),a=new Wb(y.g);a.a<a.c.c.length;){for(r=spn((c=BB(n0(a),17)).a,0);r.b!=r.d.c;)(i=BB(b3(r),8)).a=m-i.a;if(h=BB(mMn(c,vgt),74))for(s=spn(h,0);s.b!=s.d.c;)(o=BB(b3(s),8)).a=m-o.a;for(b=new Wb(c.b);b.a<b.c.c.length;)Zp((f=BB(n0(b),70)).n,m-f.o.a)}for(w=new Wb(y.f);w.a<w.c.c.length;)Zp((f=BB(n0(w),70)).n,y.o.a-f.o.a)}for(d.k==(uSn(),Mut)&&(hon(d,(hWn(),Qft),Icn(BB(mMn(d,Qft),61))),YMn(d)),l=new Wb(d.b);l.a<l.c.c.length;)Vmn(f=BB(n0(l),70)),Zp(f.n,v.a-f.o.a)}}function vXn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;if(m=0,0==t.f.b)for(p=new Wb(n);p.a<p.c.c.length;)d=BB(n0(p),10),m=e.Math.max(m,d.n.b+d.o.b+d.d.a);else m=t.f.b-t.c.b;for(m-=t.c.b,g=new Wb(n);g.a<g.c.c.length;){switch(Jp((d=BB(n0(g),10)).n,m-d.o.b),aH(d.f),Qmn(d),(d.q?d.q:(SQ(),SQ(),het))._b((HXn(),spt))&&Jp(BB(mMn(d,spt),8),m-d.o.b),BB(mMn(d,kdt),248).g){case 3:hon(d,kdt,(wvn(),IMt));break;case 4:hon(d,kdt,(wvn(),LMt))}for(v=d.o,k=new Wb(d.j);k.a<k.c.c.length;){for(Jp((y=BB(n0(k),11)).n,v.b-y.o.b),Jp(y.a,y.o.b),qCn(y,Ocn(y.j)),(u=BB(mMn(y,ipt),19))&&hon(y,ipt,iln(-u.a)),a=new Wb(y.g);a.a<a.c.c.length;){for(r=spn((c=BB(n0(a),17)).a,0);r.b!=r.d.c;)(i=BB(b3(r),8)).b=m-i.b;if(h=BB(mMn(c,vgt),74))for(s=spn(h,0);s.b!=s.d.c;)(o=BB(b3(s),8)).b=m-o.b;for(b=new Wb(c.b);b.a<b.c.c.length;)Jp((f=BB(n0(b),70)).n,m-f.o.b)}for(w=new Wb(y.f);w.a<w.c.c.length;)Jp((f=BB(n0(w),70)).n,y.o.b-f.o.b)}for(d.k==(uSn(),Mut)&&(hon(d,(hWn(),Qft),Ocn(BB(mMn(d,Qft),61))),gln(d)),l=new Wb(d.b);l.a<l.c.c.length;)Qmn(f=BB(n0(l),70)),Jp(f.n,v.b-f.o.b)}}function mXn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b;for(f=!1,s=n+1,l1(n,t.c.length),a=(h=BB(t.c[n],200)).a,u=null,c=0;c<h.a.c.length;c++)if(l1(c,a.c.length),!(r=BB(a.c[c],187)).c)if(0!=r.b.c.length){if(r.k||(u&&Gmn(u),Tvn(r,(u=new KJ(u?u.e+u.d+i:0,h.f,i)).e+u.d,h.f),WB(h.d,u),xcn(u,r),r.k=!0),o=null,b=null,c<h.a.c.length-1?b=BB(xq(h.a,c+1),187):s<t.c.length&&0!=(l1(s,t.c.length),BB(t.c[s],200)).a.c.length&&(b=BB(xq((l1(s,t.c.length),BB(t.c[s],200)).a,0),187)),l=!1,(o=b)&&(l=!Nfn(o.j,h)),o){if(0==o.b.c.length){Tkn(h,o);break}if(p9(r,e-r.s),Gmn(r.q),f|=nSn(h,r,o,e,i),0==o.b.c.length)for(Tkn((l1(s,t.c.length),BB(t.c[s],200)),o),o=null;t.c.length>s&&0==(l1(s,t.c.length),BB(t.c[s],200)).a.c.length;)y7(t,(l1(s,t.c.length),t.c[s]));if(!o){--c;continue}if(A_n(t,h,r,o,l,e,s,i)){f=!0;continue}if(l){if(JBn(t,h,r,o,e,s,i)){f=!0;continue}if(Ahn(h,r)){r.c=!0,f=!0;continue}}else if(Ahn(h,r)){r.c=!0,f=!0;continue}if(f)continue}Ahn(h,r)?(r.c=!0,f=!0,o&&(o.k=!1)):Gmn(r.q)}else $T(),Tkn(h,r),--c,f=!0;return f}function yXn(n,t,i,r,c,a,u){var o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A;for(g=0,P=0,h=new Wb(n.b);h.a<h.c.c.length;)(s=BB(n0(h),157)).c&&ozn(s.c),g=e.Math.max(g,iG(s)),P+=iG(s)*eG(s);for(p=P/n.b.c.length,S=hjn(n.b,p),P+=n.b.c.length*S,g=e.Math.max(g,e.Math.sqrt(P*u))+i.b,O=i.b,A=i.d,w=0,l=i.b+i.c,DH(M=new YT,iln(0)),E=new YT,f=new M2(n.b,0),d=null,o=new Np;f.b<f.d.gc();)Px(f.b<f.d.gc()),I=iG(s=BB(f.d.Xb(f.c=f.b++),157)),b=eG(s),O+I>g&&(a&&(fO(E,w),fO(M,iln(f.b-1)),WB(n.d,d),o.c=x8(Ant,HWn,1,0,5,1)),O=i.b,A+=w+t,w=0,l=e.Math.max(l,i.b+i.c+I)),o.c[o.c.length]=s,Mpn(s,O,A),l=e.Math.max(l,O+I+i.c),w=e.Math.max(w,b),O+=I+t,d=s;if(gun(n.a,o),WB(n.d,BB(xq(o,o.c.length-1),157)),l=e.Math.max(l,r),(C=A+w+i.a)<c&&(w+=c-C,C=c),a)for(O=i.b,f=new M2(n.b,0),fO(M,iln(n.b.c.length)),m=BB(b3(T=spn(M,0)),19).a,fO(E,w),j=spn(E,0),k=0;f.b<f.d.gc();)f.b==m&&(O=i.b,k=Gy(MD(b3(j))),m=BB(b3(T),19).a),Px(f.b<f.d.gc()),Udn(s=BB(f.d.Xb(f.c=f.b++),157),k),f.b==m&&(v=l-O-i.c,y=iG(s),zdn(s,v),Fln(s,(v-y)/2,0)),O+=iG(s)+t;return new xC(l,C)}function kXn(n){var t,e,i,r;switch(r=null,n.c){case 6:return n.Vl();case 13:return n.Wl();case 23:return n.Nl();case 22:return n.Sl();case 18:return n.Pl();case 8:QXn(n),wWn(),r=oNt;break;case 9:return n.vl(!0);case 19:return n.wl();case 10:switch(n.a){case 100:case 68:case 119:case 87:case 115:case 83:return r=n.ul(n.a),QXn(n),r;case 101:case 102:case 110:case 114:case 116:case 117:case 118:case 120:(t=n.tl())<BQn?(wWn(),wWn(),r=new oG(0,t)):r=pz(Xln(t));break;case 99:return n.Fl();case 67:return n.Al();case 105:return n.Il();case 73:return n.Bl();case 103:return n.Gl();case 88:return n.Cl();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return n.xl();case 80:case 112:if(!(r=DIn(n,n.a)))throw Hp(new ak(kWn((u$(),O8n))));break;default:r=QH(n.a)}QXn(n);break;case 0:if(93==n.a||123==n.a||125==n.a)throw Hp(new ak(kWn((u$(),I8n))));r=QH(n.a),e=n.a,QXn(n),(64512&e)==HQn&&0==n.c&&56320==(64512&n.a)&&((i=x8(ONt,WVn,25,2,15,1))[0]=e&QVn,i[1]=n.a&QVn,r=oU(pz(Bdn(i,0,i.length)),0),QXn(n));break;default:throw Hp(new ak(kWn((u$(),I8n))))}return r}function jXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(r=new Np,c=DWn,a=DWn,u=DWn,i)for(c=n.f.a,d=new Wb(t.j);d.a<d.c.c.length;)for(s=new Wb(BB(n0(d),11).g);s.a<s.c.c.length;)0!=(o=BB(n0(s),17)).a.b&&((f=BB(gx(o.a),8)).a<c&&(a=c-f.a,u=DWn,r.c=x8(Ant,HWn,1,0,5,1),c=f.a),f.a<=c&&(r.c[r.c.length]=o,o.a.b>1&&(u=e.Math.min(u,e.Math.abs(BB(Dpn(o.a,1),8).b-f.b)))));else for(d=new Wb(t.j);d.a<d.c.c.length;)for(s=new Wb(BB(n0(d),11).e);s.a<s.c.c.length;)0!=(o=BB(n0(s),17)).a.b&&((b=BB(px(o.a),8)).a>c&&(a=b.a-c,u=DWn,r.c=x8(Ant,HWn,1,0,5,1),c=b.a),b.a>=c&&(r.c[r.c.length]=o,o.a.b>1&&(u=e.Math.min(u,e.Math.abs(BB(Dpn(o.a,o.a.b-2),8).b-b.b)))));if(0!=r.c.length&&a>t.o.a/2&&u>t.o.b/2){for(CZ(w=new CSn,t),qCn(w,(kUn(),sIt)),w.n.a=t.o.a/2,CZ(g=new CSn,t),qCn(g,SIt),g.n.a=t.o.a/2,g.n.b=t.o.b,s=new Wb(r);s.a<s.c.c.length;)o=BB(n0(s),17),i?(h=BB(dH(o.a),8),(0==o.a.b?g1(o.d):BB(gx(o.a),8)).b>=h.b?SZ(o,g):SZ(o,w)):(h=BB(gH(o.a),8),(0==o.a.b?g1(o.c):BB(px(o.a),8)).b>=h.b?MZ(o,g):MZ(o,w)),(l=BB(mMn(o,(HXn(),vgt)),74))&&ywn(l,h,!0);t.n.a=c-t.o.a/2}}function EXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;if(s=t,$in(o=Q3(n,L3(e),s),R2(s,q6n)),h=BB(sen(n.g,kIn(zJ(s,T6n))),33),i=null,(a=zJ(s,"sourcePort"))&&(i=kIn(a)),f=BB(sen(n.j,i),118),!h)throw Hp(new ek("An edge must have a source node (edge id: '"+Qdn(s)+W6n));if(f&&!wW(WJ(f),h))throw Hp(new ek("The source port of an edge must be a port of the edge's source node (edge id: '"+R2(s,q6n)+W6n));if(!o.b&&(o.b=new hK(KOt,o,4,7)),f9(o.b,f||h),l=BB(sen(n.g,kIn(zJ(s,Y6n))),33),r=null,(u=zJ(s,"targetPort"))&&(r=kIn(u)),b=BB(sen(n.j,r),118),!l)throw Hp(new ek("An edge must have a target node (edge id: '"+Qdn(s)+W6n));if(b&&!wW(WJ(b),l))throw Hp(new ek("The target port of an edge must be a port of the edge's target node (edge id: '"+R2(s,q6n)+W6n));if(!o.c&&(o.c=new hK(KOt,o,5,8)),f9(o.c,b||l),0==(!o.b&&(o.b=new hK(KOt,o,4,7)),o.b).i||0==(!o.c&&(o.c=new hK(KOt,o,5,8)),o.c).i)throw c=R2(s,q6n),Hp(new ek(X6n+c+W6n));return STn(s,o),s$n(s,o),xon(n,s,o)}function TXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S;return f=CFn(HN(n,(kUn(),wIt)),t),w=ayn(HN(n,dIt),t),y=ayn(HN(n,EIt),t),T=uyn(HN(n,MIt),t),l=uyn(HN(n,hIt),t),v=ayn(HN(n,jIt),t),d=ayn(HN(n,gIt),t),j=ayn(HN(n,TIt),t),k=ayn(HN(n,fIt),t),M=uyn(HN(n,bIt),t),p=ayn(HN(n,yIt),t),m=ayn(HN(n,mIt),t),E=ayn(HN(n,lIt),t),S=uyn(HN(n,kIt),t),b=uyn(HN(n,pIt),t),g=ayn(HN(n,vIt),t),e=Lon(Pun(Gk(xNt,1),qQn,25,15,[v.a,T.a,j.a,S.a])),i=Lon(Pun(Gk(xNt,1),qQn,25,15,[w.a,f.a,y.a,g.a])),r=p.a,c=Lon(Pun(Gk(xNt,1),qQn,25,15,[d.a,l.a,k.a,b.a])),s=Lon(Pun(Gk(xNt,1),qQn,25,15,[v.b,w.b,d.b,m.b])),o=Lon(Pun(Gk(xNt,1),qQn,25,15,[T.b,f.b,l.b,g.b])),h=M.b,u=Lon(Pun(Gk(xNt,1),qQn,25,15,[j.b,y.b,k.b,E.b])),w9(HN(n,wIt),e+r,s+h),w9(HN(n,vIt),e+r,s+h),w9(HN(n,dIt),e+r,0),w9(HN(n,EIt),e+r,s+h+o),w9(HN(n,MIt),0,s+h),w9(HN(n,hIt),e+r+i,s+h),w9(HN(n,gIt),e+r+i,0),w9(HN(n,TIt),0,s+h+o),w9(HN(n,fIt),e+r+i,s+h+o),w9(HN(n,bIt),0,s),w9(HN(n,yIt),e,0),w9(HN(n,lIt),0,s+h+o),w9(HN(n,pIt),e+r+i,0),(a=new Gj).a=Lon(Pun(Gk(xNt,1),qQn,25,15,[e+i+r+c,M.a,m.a,E.a])),a.b=Lon(Pun(Gk(xNt,1),qQn,25,15,[s+o+h+u,p.b,S.b,b.b])),a}function MXn(n){var t,e,i,r,c,a,u,o,s,f,l,b,w,d,g;for(d=new Np,l=new Wb(n.d.b);l.a<l.c.c.length;)for(w=new Wb(BB(n0(l),29).a);w.a<w.c.c.length;){for(b=BB(n0(w),10),r=BB(RX(n.f,b),57),o=new oz(ZL(lbn(b).a.Kc(),new h));dAn(o);)if(s=!0,f=null,(i=spn((a=BB(U5(o),17)).a,0)).b!=i.d.c){for(t=BB(b3(i),8),e=null,a.c.j==(kUn(),sIt)&&((g=new PBn(t,new xC(t.a,r.d.d),r,a)).f.a=!0,g.a=a.c,d.c[d.c.length]=g),a.c.j==SIt&&((g=new PBn(t,new xC(t.a,r.d.d+r.d.a),r,a)).f.d=!0,g.a=a.c,d.c[d.c.length]=g);i.b!=i.d.c;)e=BB(b3(i),8),aen(t.b,e.b)||(f=new PBn(t,e,null,a),d.c[d.c.length]=f,s&&(s=!1,e.b<r.d.d?f.f.a=!0:e.b>r.d.d+r.d.a?f.f.d=!0:(f.f.d=!0,f.f.a=!0))),i.b!=i.d.c&&(t=e);f&&(c=BB(RX(n.f,a.d.i),57),t.b<c.d.d?f.f.a=!0:t.b>c.d.d+c.d.a?f.f.d=!0:(f.f.d=!0,f.f.a=!0))}for(u=new oz(ZL(fbn(b).a.Kc(),new h));dAn(u);)0!=(a=BB(U5(u),17)).a.b&&(t=BB(px(a.a),8),a.d.j==(kUn(),sIt)&&((g=new PBn(t,new xC(t.a,r.d.d),r,a)).f.a=!0,g.a=a.d,d.c[d.c.length]=g),a.d.j==SIt&&((g=new PBn(t,new xC(t.a,r.d.d+r.d.a),r,a)).f.d=!0,g.a=a.d,d.c[d.c.length]=g))}return d}function SXn(n,t,e){var i,r,c,a,u,o,s;if(OTn(e,"Network simplex node placement",1),n.e=t,n.n=BB(mMn(t,(hWn(),Alt)),304),oqn(n),REn(n),JT(wnn(new Rq(null,new w1(n.e.b,16)),new Hc),new cg(n)),JT(AV(wnn(AV(wnn(new Rq(null,new w1(n.e.b,16)),new ta),new ea),new ia),new ra),new rg(n)),qy(TD(mMn(n.e,(HXn(),xgt))))&&(OTn(c=mcn(e,1),"Straight Edges Pre-Processing",1),jzn(n),HSn(c)),Mvn(n.f),r=BB(mMn(t,xpt),19).a*n.f.a.c.length,WKn(Qk(Yk(B_(n.f),r),!1),mcn(e,1)),0!=n.d.a.gc()){for(OTn(c=mcn(e,1),"Flexible Where Space Processing",1),a=BB($N(Oz($V(new Rq(null,new w1(n.f.a,16)),new qc),new Dc)),19).a,u=BB($N(Iz($V(new Rq(null,new w1(n.f.a,16)),new Gc),new Rc)),19).a-a,o=AN(new qv,n.f),s=AN(new qv,n.f),UNn(aM(cM(rM(uM(new Hv,2e4),u),o),s)),JT(AV(AV(LU(n.i),new zc),new Uc),new zV(a,o,u,s)),i=n.d.a.ec().Kc();i.Ob();)BB(i.Pb(),213).g=1;WKn(Qk(Yk(B_(n.f),r),!1),mcn(c,1)),HSn(c)}qy(TD(mMn(t,xgt)))&&(OTn(c=mcn(e,1),"Straight Edges Post-Processing",1),SPn(n),HSn(c)),QGn(n),n.e=null,n.f=null,n.i=null,n.c=null,$U(n.k),n.j=null,n.a=null,n.o=null,n.d.a.$b(),HSn(e)}function PXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(u=new Wb(n.a.b);u.a<u.c.c.length;)for(m=new Wb(BB(n0(u),29).a);m.a<m.c.c.length;)v=BB(n0(m),10),t.g[v.p]=v,t.a[v.p]=v,t.d[v.p]=0;for(o=n.a.b,t.c==(gJ(),nyt)&&(o=cL(o,152)?o6(BB(o,152)):cL(o,131)?BB(o,131).a:cL(o,54)?new fy(o):new CT(o)),a=o.Kc();a.Ob();)for(b=-1,l=BB(a.Pb(),29).a,t.o==(oZ(),cyt)&&(b=DWn,l=cL(l,152)?o6(BB(l,152)):cL(l,131)?BB(l,131).a:cL(l,54)?new fy(l):new CT(l)),k=l.Kc();k.Ob();)if(y=BB(k.Pb(),10),f=null,(f=t.c==nyt?BB(xq(n.b.f,y.p),15):BB(xq(n.b.b,y.p),15)).gc()>0)if(r=f.gc(),s=CJ(e.Math.floor((r+1)/2))-1,c=CJ(e.Math.ceil((r+1)/2))-1,t.o==cyt)for(h=c;h>=s;h--)t.a[y.p]==y&&(d=BB(f.Xb(h),46),w=BB(d.a,10),!FT(i,d.b)&&b>n.b.e[w.p]&&(t.a[w.p]=y,t.g[y.p]=t.g[w.p],t.a[y.p]=t.g[y.p],t.f[t.g[y.p].p]=(hN(),!!(qy(t.f[t.g[y.p].p])&y.k==(uSn(),Put))),b=n.b.e[w.p]));else for(h=s;h<=c;h++)t.a[y.p]==y&&(p=BB(f.Xb(h),46),g=BB(p.a,10),!FT(i,p.b)&&b<n.b.e[g.p]&&(t.a[g.p]=y,t.g[y.p]=t.g[g.p],t.a[y.p]=t.g[y.p],t.f[t.g[y.p].p]=(hN(),!!(qy(t.f[t.g[y.p].p])&y.k==(uSn(),Put))),b=n.b.e[g.p]))}function CXn(){CXn=O,eE(),POt=gOt.a,BB(Wtn(QQ(gOt.a),0),18),kOt=gOt.f,BB(Wtn(QQ(gOt.f),0),18),BB(Wtn(QQ(gOt.f),1),34),SOt=gOt.n,BB(Wtn(QQ(gOt.n),0),34),BB(Wtn(QQ(gOt.n),1),34),BB(Wtn(QQ(gOt.n),2),34),BB(Wtn(QQ(gOt.n),3),34),jOt=gOt.g,BB(Wtn(QQ(gOt.g),0),18),BB(Wtn(QQ(gOt.g),1),34),vOt=gOt.c,BB(Wtn(QQ(gOt.c),0),18),BB(Wtn(QQ(gOt.c),1),18),EOt=gOt.i,BB(Wtn(QQ(gOt.i),0),18),BB(Wtn(QQ(gOt.i),1),18),BB(Wtn(QQ(gOt.i),2),18),BB(Wtn(QQ(gOt.i),3),18),BB(Wtn(QQ(gOt.i),4),34),TOt=gOt.j,BB(Wtn(QQ(gOt.j),0),18),mOt=gOt.d,BB(Wtn(QQ(gOt.d),0),18),BB(Wtn(QQ(gOt.d),1),18),BB(Wtn(QQ(gOt.d),2),18),BB(Wtn(QQ(gOt.d),3),18),BB(Wtn(QQ(gOt.d),4),34),BB(Wtn(QQ(gOt.d),5),34),BB(Wtn(QQ(gOt.d),6),34),BB(Wtn(QQ(gOt.d),7),34),pOt=gOt.b,BB(Wtn(QQ(gOt.b),0),34),BB(Wtn(QQ(gOt.b),1),34),yOt=gOt.e,BB(Wtn(QQ(gOt.e),0),34),BB(Wtn(QQ(gOt.e),1),34),BB(Wtn(QQ(gOt.e),2),34),BB(Wtn(QQ(gOt.e),3),34),BB(Wtn(QQ(gOt.e),4),18),BB(Wtn(QQ(gOt.e),5),18),BB(Wtn(QQ(gOt.e),6),18),BB(Wtn(QQ(gOt.e),7),18),BB(Wtn(QQ(gOt.e),8),18),BB(Wtn(QQ(gOt.e),9),18),BB(Wtn(QQ(gOt.e),10),34),MOt=gOt.k,BB(Wtn(QQ(gOt.k),0),34),BB(Wtn(QQ(gOt.k),1),34)}function IXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P;for(M=new YT,j=new YT,g=-1,o=new Wb(n);o.a<o.c.c.length;){for((a=BB(n0(o),128)).s=g--,h=0,m=0,c=new Wb(a.t);c.a<c.c.c.length;)m+=(i=BB(n0(c),268)).c;for(r=new Wb(a.i);r.a<r.c.c.length;)h+=(i=BB(n0(r),268)).c;a.n=h,a.u=m,0==m?r5(j,a,j.c.b,j.c):0==h&&r5(M,a,M.c.b,M.c)}for(P=S4(n),d=(f=n.c.length)+1,p=f-1,b=new Np;0!=P.a.gc();){for(;0!=j.b;)Px(0!=j.b),k=BB(Atn(j,j.a.a),128),P.a.Bc(k),k.s=p--,cLn(k,M,j);for(;0!=M.b;)Px(0!=M.b),E=BB(Atn(M,M.a.a),128),P.a.Bc(E),E.s=d++,cLn(E,M,j);for(w=_Vn,s=P.a.ec().Kc();s.Ob();)(v=(a=BB(s.Pb(),128)).u-a.n)>=w&&(v>w&&(b.c=x8(Ant,HWn,1,0,5,1),w=v),b.c[b.c.length]=a);0!=b.c.length&&(l=BB(xq(b,pvn(t,b.c.length)),128),P.a.Bc(l),l.s=d++,cLn(l,M,j),b.c=x8(Ant,HWn,1,0,5,1))}for(y=n.c.length+1,u=new Wb(n);u.a<u.c.c.length;)(a=BB(n0(u),128)).s<f&&(a.s+=y);for(T=new Wb(n);T.a<T.c.c.length;)for(e=new M2((E=BB(n0(T),128)).t,0);e.b<e.d.gc();)Px(e.b<e.d.gc()),S=(i=BB(e.d.Xb(e.c=e.b++),268)).b,E.s>S.s&&(fW(e),y7(S.i,i),i.c>0&&(i.a=S,WB(S.t,i),i.b=E,WB(E.i,i)))}function OXn(n){var t,e,i,r,c;switch(t=n.c){case 11:return n.Ml();case 12:return n.Ol();case 14:return n.Ql();case 15:return n.Tl();case 16:return n.Rl();case 17:return n.Ul();case 21:return QXn(n),wWn(),wWn(),sNt;case 10:switch(n.a){case 65:return n.yl();case 90:return n.Dl();case 122:return n.Kl();case 98:return n.El();case 66:return n.zl();case 60:return n.Jl();case 62:return n.Hl()}}switch(c=kXn(n),t=n.c){case 3:return n.Zl(c);case 4:return n.Xl(c);case 5:return n.Yl(c);case 0:if(123==n.a&&n.d<n.j){if(r=n.d,i=0,e=-1,!((t=fV(n.i,r++))>=48&&t<=57))throw Hp(new ak(kWn((u$(),X8n))));for(i=t-48;r<n.j&&(t=fV(n.i,r++))>=48&&t<=57;)if((i=10*i+t-48)<0)throw Hp(new ak(kWn((u$(),Y8n))));if(e=i,44==t){if(r>=n.j)throw Hp(new ak(kWn((u$(),V8n))));if((t=fV(n.i,r++))>=48&&t<=57){for(e=t-48;r<n.j&&(t=fV(n.i,r++))>=48&&t<=57;)if((e=10*e+t-48)<0)throw Hp(new ak(kWn((u$(),Y8n))));if(i>e)throw Hp(new ak(kWn((u$(),Q8n))))}else e=-1}if(125!=t)throw Hp(new ak(kWn((u$(),W8n))));n.sl(r)?(wWn(),wWn(),c=new h4(9,c),n.d=r+1):(wWn(),wWn(),c=new h4(3,c),n.d=r),c.dm(i),c.cm(e),QXn(n)}}return c}function AXn(n,t,e,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M;for(w=new J6(t.b),v=new J6(t.b),l=new J6(t.b),j=new J6(t.b),d=new J6(t.b),k=spn(t,0);k.b!=k.d.c;)for(u=new Wb((m=BB(b3(k),11)).g);u.a<u.c.c.length;)if((c=BB(n0(u),17)).c.i==c.d.i){if(m.j==c.d.j){j.c[j.c.length]=c;continue}if(m.j==(kUn(),sIt)&&c.d.j==SIt){d.c[d.c.length]=c;continue}}for(o=new Wb(d);o.a<o.c.c.length;)__n(n,c=BB(n0(o),17),e,i,(kUn(),oIt));for(a=new Wb(j);a.a<a.c.c.length;)c=BB(n0(a),17),Bl(E=new $vn(n),(uSn(),Iut)),hon(E,(HXn(),ept),(QEn(),XCt)),hon(E,(hWn(),dlt),c),hon(T=new CSn,dlt,c.d),qCn(T,(kUn(),CIt)),CZ(T,E),hon(M=new CSn,dlt,c.c),qCn(M,oIt),CZ(M,E),hon(c.c,Elt,E),hon(c.d,Elt,E),SZ(c,null),MZ(c,null),e.c[e.c.length]=E,hon(E,Bft,iln(2));for(y=spn(t,0);y.b!=y.d.c;)s=(m=BB(b3(y),11)).e.c.length>0,g=m.g.c.length>0,s&&g?l.c[l.c.length]=m:s?w.c[w.c.length]=m:g&&(v.c[v.c.length]=m);for(b=new Wb(w);b.a<b.c.c.length;)WB(r,HBn(n,BB(n0(b),11),null,e));for(p=new Wb(v);p.a<p.c.c.length;)WB(r,HBn(n,null,BB(n0(p),11),e));for(f=new Wb(l);f.a<f.c.c.length;)WB(r,HBn(n,h=BB(n0(f),11),h,e))}function $Xn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;for(d=new xC(RQn,RQn),t=new xC(KQn,KQn),k=new Wb(n);k.a<k.c.c.length;)y=BB(n0(k),8),d.a=e.Math.min(d.a,y.a),d.b=e.Math.min(d.b,y.b),t.a=e.Math.max(t.a,y.a),t.b=e.Math.max(t.b,y.b);for(s=new xC(t.a-d.a,t.b-d.b),h=new ZFn(new xC(d.a-50,d.b-s.a-50),new xC(d.a-50,t.b+s.a+50),new xC(t.a+s.b/2+50,d.b+s.b/2)),m=new Rv,c=new Np,i=new Np,m.a.zc(h,m),E=new Wb(n);E.a<E.c.c.length;){for(j=BB(n0(E),8),c.c=x8(Ant,HWn,1,0,5,1),v=m.a.ec().Kc();v.Ob();)W8((g=BB(v.Pb(),308)).d,g.a),Ibn(W8(g.d,j),W8(g.d,g.a))<0&&(c.c[c.c.length]=g);for(i.c=x8(Ant,HWn,1,0,5,1),p=new Wb(c);p.a<p.c.c.length;)for(b=new Wb((g=BB(n0(p),308)).e);b.a<b.c.c.length;){for(f=BB(n0(b),168),a=!0,o=new Wb(c);o.a<o.c.c.length;)(u=BB(n0(o),308))!=g&&(cV(f,xq(u.e,0))||cV(f,xq(u.e,1))||cV(f,xq(u.e,2)))&&(a=!1);a&&(i.c[i.c.length]=f)}for(oMn(m,c),e5(m,new bn),l=new Wb(i);l.a<l.c.c.length;)TU(m,new ZFn(j,(f=BB(n0(l),168)).a,f.b))}for(e5(m,new jw(w=new Rv)),r=w.a.ec().Kc();r.Ob();)(K7(h,(f=BB(r.Pb(),168)).a)||K7(h,f.b))&&r.Qb();return e5(w,new wn),w}function LXn(n){var t,e,i;switch(e=BB(mMn(n,(hWn(),Zft)),21),t=kA(Nat),BB(mMn(n,(HXn(),sgt)),334)==(ufn(),pCt)&&Jcn(t,xat),qy(TD(mMn(n,ugt)))?dq(t,(yMn(),Rat),(lWn(),Hot)):dq(t,(yMn(),_at),(lWn(),Hot)),null!=mMn(n,(C6(),TMt))&&Jcn(t,Dat),(qy(TD(mMn(n,ggt)))||qy(TD(mMn(n,ogt))))&&WG(t,(yMn(),Bat),(lWn(),eot)),BB(mMn(n,Udt),103).g){case 2:case 3:case 4:WG(dq(t,(yMn(),Rat),(lWn(),rot)),Bat,iot)}switch(e.Hc((bDn(),hft))&&WG(dq(dq(t,(yMn(),Rat),(lWn(),tot)),Fat,Zut),Bat,not),GI(mMn(n,Sgt))!==GI((sNn(),Ivt))&&dq(t,(yMn(),_at),(lWn(),Not)),e.Hc(pft)&&(dq(t,(yMn(),Rat),(lWn(),Fot)),dq(t,Kat,Kot),dq(t,_at,_ot)),GI(mMn(n,Pdt))!==GI((JMn(),cft))&&GI(mMn(n,Zdt))!==GI((Mbn(),YPt))&&WG(t,(yMn(),Bat),(lWn(),pot)),qy(TD(mMn(n,fgt)))&&dq(t,(yMn(),_at),(lWn(),got)),qy(TD(mMn(n,Hdt)))&&dq(t,(yMn(),_at),(lWn(),Wot)),KLn(n)&&(i=(GI(mMn(n,sgt))===GI(pCt)?BB(mMn(n,Rdt),292):BB(mMn(n,Kdt),292))==(Kan(),jft)?(lWn(),Rot):(lWn(),Yot),dq(t,(yMn(),Fat),i)),BB(mMn(n,zpt),377).g){case 1:dq(t,(yMn(),Fat),(lWn(),Vot));break;case 2:WG(dq(dq(t,(yMn(),_at),(lWn(),Vut)),Fat,Qut),Bat,Yut)}return GI(mMn(n,Ldt))!==GI((mon(),Nvt))&&dq(t,(yMn(),_at),(lWn(),Qot)),t}function NXn(n){NM(n,new MTn(vj(wj(pj(gj(new du,$4n),"ELK Rectangle Packing"),"Algorithm for packing of unconnected boxes, i.e. graphs without edges. The given order of the boxes is always preserved and the main reading direction of the boxes is left to right. The algorithm is divided into two phases. One phase approximates the width in which the rectangles can be placed. The next phase places the rectangles in rows using the previously calculated width as bounding width and bundles rectangles with a similar height in blocks. A compaction step reduces the size of the drawing. Finally, the rectangles are expanded to fill their bounding box and eliminate empty unused spaces."),new Za))),u2(n,$4n,VJn,1.3),u2(n,$4n,A4n,mpn(gEt)),u2(n,$4n,QJn,IEt),u2(n,$4n,vZn,15),u2(n,$4n,u3n,mpn(bEt)),u2(n,$4n,PZn,mpn(jEt)),u2(n,$4n,BZn,mpn(EEt)),u2(n,$4n,SZn,mpn(TEt)),u2(n,$4n,CZn,mpn(kEt)),u2(n,$4n,MZn,mpn(MEt)),u2(n,$4n,IZn,mpn(OEt)),u2(n,$4n,E4n,mpn(PEt)),u2(n,$4n,T4n,mpn(yEt)),u2(n,$4n,P4n,mpn(SEt)),u2(n,$4n,C4n,mpn(AEt)),u2(n,$4n,I4n,mpn(pEt)),u2(n,$4n,jZn,mpn(vEt)),u2(n,$4n,m3n,mpn(mEt)),u2(n,$4n,S4n,mpn(dEt)),u2(n,$4n,M4n,mpn(wEt)),u2(n,$4n,O4n,mpn(LEt))}function xXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d;if(null==e)return null;if(n.a!=t.Aj())throw Hp(new _y(d6n+t.ne()+g6n));if(cL(t,457)){if(!(d=SDn(BB(t,671),e)))throw Hp(new _y(p6n+e+"' is not a valid enumerator of '"+t.ne()+"'"));return d}switch(Cfn((IPn(),Z$t),t).cl()){case 2:e=FBn(e,!1);break;case 3:e=FBn(e,!0)}if(i=Cfn(Z$t,t).$k())return i.Aj().Nh().Kh(i,e);if(f=Cfn(Z$t,t).al()){for(d=new Np,s=0,h=(o=ysn(e)).length;s<h;++s)u=o[s],WB(d,f.Aj().Nh().Kh(f,u));return d}if(!(w=Cfn(Z$t,t).bl()).dc()){for(b=w.Kc();b.Ob();){l=BB(b.Pb(),148);try{if(null!=(d=l.Aj().Nh().Kh(l,e)))return d}catch(g){if(!cL(g=lun(g),60))throw Hp(g)}}throw Hp(new _y(p6n+e+"' does not match any member types of the union datatype '"+t.ne()+"'"))}if(BB(t,834).Fj(),!(r=xfn(t.Bj())))return null;if(r==Stt){c=0;try{c=l_n(e,_Vn,DWn)&QVn}catch(g){if(!cL(g=lun(g),127))throw Hp(g);c=V7(e)[0]}return fun(c)}if(r==mtt){for(a=0;a<IOt.length;++a)try{return BM(IOt[a],e)}catch(g){if(!cL(g=lun(g),32))throw Hp(g)}throw Hp(new _y(p6n+e+"' is not a date formatted string of the form yyyy-MM-dd'T'HH:mm:ss'.'SSSZ or a valid subset thereof"))}throw Hp(new _y(p6n+e+"' is invalid. "))}function DXn(n,t){var e,i,r,c,a,u,o,s;if(e=0,a=0,c=t.length,u=null,s=new Ik,a<c&&(b1(a,t.length),43==t.charCodeAt(a))&&(++e,++a<c&&(b1(a,t.length),43==t.charCodeAt(a)||(b1(a,t.length),45==t.charCodeAt(a)))))throw Hp(new Mk(DQn+t+'"'));for(;a<c&&(b1(a,t.length),46!=t.charCodeAt(a))&&(b1(a,t.length),101!=t.charCodeAt(a))&&(b1(a,t.length),69!=t.charCodeAt(a));)++a;if(s.a+=""+fx(null==t?zWn:(kW(t),t),e,a),a<c&&(b1(a,t.length),46==t.charCodeAt(a))){for(e=++a;a<c&&(b1(a,t.length),101!=t.charCodeAt(a))&&(b1(a,t.length),69!=t.charCodeAt(a));)++a;n.e=a-e,s.a+=""+fx(null==t?zWn:(kW(t),t),e,a)}else n.e=0;if(a<c&&(b1(a,t.length),101==t.charCodeAt(a)||(b1(a,t.length),69==t.charCodeAt(a)))&&(e=++a,a<c&&(b1(a,t.length),43==t.charCodeAt(a))&&++a<c&&(b1(a,t.length),45!=t.charCodeAt(a))&&++e,u=t.substr(e,c-e),n.e=n.e-l_n(u,_Vn,DWn),n.e!=CJ(n.e)))throw Hp(new Mk("Scale out of range."));if((o=s.a).length<16){if(n.f=(null==Vtt&&(Vtt=new RegExp("^[+-]?\\d*$","i")),Vtt.test(o)?parseInt(o,10):NaN),isNaN(n.f))throw Hp(new Mk(DQn+t+'"'));n.a=aIn(n.f)}else fdn(n,new $A(o));for(n.d=s.a.length,r=0;r<s.a.length&&(45==(i=fV(s.a,r))||48==i);++r)--n.d;0==n.d&&(n.d=1)}function RXn(){RXn=O,JIn(fut=new pJ,(kUn(),wIt),vIt),JIn(fut,MIt,vIt),JIn(fut,MIt,kIt),JIn(fut,hIt,pIt),JIn(fut,hIt,vIt),JIn(fut,dIt,vIt),JIn(fut,dIt,mIt),JIn(fut,EIt,lIt),JIn(fut,EIt,vIt),JIn(fut,yIt,bIt),JIn(fut,yIt,vIt),JIn(fut,yIt,mIt),JIn(fut,yIt,lIt),JIn(fut,bIt,yIt),JIn(fut,bIt,kIt),JIn(fut,bIt,pIt),JIn(fut,bIt,vIt),JIn(fut,jIt,jIt),JIn(fut,jIt,mIt),JIn(fut,jIt,kIt),JIn(fut,gIt,gIt),JIn(fut,gIt,mIt),JIn(fut,gIt,pIt),JIn(fut,TIt,TIt),JIn(fut,TIt,lIt),JIn(fut,TIt,kIt),JIn(fut,fIt,fIt),JIn(fut,fIt,lIt),JIn(fut,fIt,pIt),JIn(fut,mIt,dIt),JIn(fut,mIt,yIt),JIn(fut,mIt,jIt),JIn(fut,mIt,gIt),JIn(fut,mIt,vIt),JIn(fut,mIt,mIt),JIn(fut,mIt,kIt),JIn(fut,mIt,pIt),JIn(fut,lIt,EIt),JIn(fut,lIt,yIt),JIn(fut,lIt,TIt),JIn(fut,lIt,fIt),JIn(fut,lIt,lIt),JIn(fut,lIt,kIt),JIn(fut,lIt,pIt),JIn(fut,lIt,vIt),JIn(fut,kIt,MIt),JIn(fut,kIt,bIt),JIn(fut,kIt,jIt),JIn(fut,kIt,TIt),JIn(fut,kIt,mIt),JIn(fut,kIt,lIt),JIn(fut,kIt,kIt),JIn(fut,kIt,vIt),JIn(fut,pIt,hIt),JIn(fut,pIt,bIt),JIn(fut,pIt,gIt),JIn(fut,pIt,fIt),JIn(fut,pIt,mIt),JIn(fut,pIt,lIt),JIn(fut,pIt,pIt),JIn(fut,pIt,vIt),JIn(fut,vIt,wIt),JIn(fut,vIt,MIt),JIn(fut,vIt,hIt),JIn(fut,vIt,dIt),JIn(fut,vIt,EIt),JIn(fut,vIt,yIt),JIn(fut,vIt,bIt),JIn(fut,vIt,mIt),JIn(fut,vIt,lIt),JIn(fut,vIt,kIt),JIn(fut,vIt,pIt),JIn(fut,vIt,vIt)}function KXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T;for(n.d=new xC(RQn,RQn),n.c=new xC(KQn,KQn),l=t.Kc();l.Ob();)for(m=new Wb(BB(l.Pb(),37).a);m.a<m.c.c.length;)v=BB(n0(m),10),n.d.a=e.Math.min(n.d.a,v.n.a-v.d.b),n.d.b=e.Math.min(n.d.b,v.n.b-v.d.d),n.c.a=e.Math.max(n.c.a,v.n.a+v.o.a+v.d.c),n.c.b=e.Math.max(n.c.b,v.n.b+v.o.b+v.d.a);for(o=new Yv,f=t.Kc();f.Ob();)r=uXn(n,BB(f.Pb(),37)),WB(o.a,r),r.a=r.a|!BB(mMn(r.c,(hWn(),Xft)),21).dc();for(n.b=(Shn(),(T=new kt).f=new vin(i),T.b=oGn(T.f,o),T),jGn((w=n.b,new Xm,w)),n.e=new Gj,n.a=n.b.f.e,u=new Wb(o.a);u.a<u.c.c.length;)for(c=BB(n0(u),841),y=AJ(n.b,c),nKn(c.c,y.a,y.b),g=new Wb(c.c.a);g.a<g.c.c.length;)(d=BB(n0(g),10)).k==(uSn(),Mut)&&(p=lLn(n,d.n,BB(mMn(d,(hWn(),Qft)),61)),UR(kO(d.n),p));for(a=new Wb(o.a);a.a<a.c.c.length;)for(h=new Wb(wln(c=BB(n0(a),841)));h.a<h.c.c.length;)for(Kx(E=new Kj((s=BB(n0(h),17)).a),0,g1(s.c)),DH(E,g1(s.d)),b=null,j=spn(E,0);j.b!=j.d.c;)k=BB(b3(j),8),b?(uen(b.a,k.a)?(n.e.a=e.Math.min(n.e.a,b.a),n.a.a=e.Math.max(n.a.a,b.a)):uen(b.b,k.b)&&(n.e.b=e.Math.min(n.e.b,b.b),n.a.b=e.Math.max(n.a.b,b.b)),b=k):b=k;qx(n.e),UR(n.a,n.e)}function _Xn(n){V$n(n.b,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"ConsistentTransient"])),V$n(n.a,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"WellFormedSourceURI"])),V$n(n.o,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"InterfaceIsAbstract AtMostOneID UniqueFeatureNames UniqueOperationSignatures NoCircularSuperTypes WellFormedMapEntryClass ConsistentSuperTypes DisjointFeatureAndOperationSignatures"])),V$n(n.p,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"WellFormedInstanceTypeName UniqueTypeParameterNames"])),V$n(n.v,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"UniqueEnumeratorNames UniqueEnumeratorLiterals"])),V$n(n.R,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"WellFormedName"])),V$n(n.T,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"UniqueParameterNames UniqueTypeParameterNames NoRepeatingVoid"])),V$n(n.U,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"WellFormedNsURI WellFormedNsPrefix UniqueSubpackageNames UniqueClassifierNames UniqueNsURIs"])),V$n(n.W,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"ConsistentOpposite SingleContainer ConsistentKeys ConsistentUnique ConsistentContainer"])),V$n(n.bb,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"ValidDefaultValueLiteral"])),V$n(n.eb,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"ValidLowerBound ValidUpperBound ConsistentBounds ValidType"])),V$n(n.H,V9n,Pun(Gk(Qtt,1),sVn,2,6,[Y9n,"ConsistentType ConsistentBounds ConsistentArguments"]))}function FXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;if(!t.dc()){if(r=new km,f=(a=e||BB(t.Xb(0),17)).c,gxn(),(s=f.i.k)!=(uSn(),Cut)&&s!=Iut&&s!=Mut&&s!=Tut)throw Hp(new _y("The target node of the edge must be a normal node or a northSouthPort."));for(fO(r,Aon(Pun(Gk(PMt,1),sVn,8,0,[f.i.n,f.n,f.a]))),(kUn(),yIt).Hc(f.j)&&(b=Gy(MD(mMn(f,(hWn(),Llt)))),r5(r,new xC(Aon(Pun(Gk(PMt,1),sVn,8,0,[f.i.n,f.n,f.a])).a,b),r.c.b,r.c)),o=null,i=!1,u=t.Kc();u.Ob();)0!=(c=BB(u.Pb(),17).a).b&&(i?(r5(r,kL(UR(o,(Px(0!=c.b),BB(c.a.a.c,8))),.5),r.c.b,r.c),i=!1):i=!0,o=B$((Px(0!=c.b),BB(c.c.b.c,8))),Frn(r,c),yQ(c));l=a.d,yIt.Hc(l.j)&&(b=Gy(MD(mMn(l,(hWn(),Llt)))),r5(r,new xC(Aon(Pun(Gk(PMt,1),sVn,8,0,[l.i.n,l.n,l.a])).a,b),r.c.b,r.c)),fO(r,Aon(Pun(Gk(PMt,1),sVn,8,0,[l.i.n,l.n,l.a]))),n.d==(Usn(),emt)&&(Px(0!=r.b),w=BB(r.a.a.c,8),d=BB(Dpn(r,1),8),(g=new XZ(hsn(f.j))).a*=5,g.b*=5,p=XR(new xC(d.a,d.b),w),UR(v=new xC(iZ(g.a,p.a),iZ(g.b,p.b)),w),nX(spn(r,1),v),Px(0!=r.b),m=BB(r.c.b.c,8),y=BB(Dpn(r,r.b-2),8),(g=new XZ(hsn(l.j))).a*=5,g.b*=5,p=XR(new xC(y.a,y.b),m),UR(k=new xC(iZ(g.a,p.a),iZ(g.b,p.b)),m),Kx(r,r.b-1,k)),h=new oBn(r),Frn(a.a,Fvn(h))}}function BXn(n,t,i,r){var c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A,$,L,N,x;if(y=(v=BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)).Dg(),k=v.Eg(),m=v.Cg()/2,w=v.Bg()/2,cL(v,186)&&(y+=WJ(p=BB(v,118)).i,y+=WJ(p).i),y+=m,k+=w,C=(S=BB(Wtn((!n.b&&(n.b=new hK(KOt,n,4,7)),n.b),0),82)).Dg(),I=S.Eg(),P=S.Cg()/2,j=S.Bg()/2,cL(S,186)&&(C+=WJ(M=BB(S,118)).i,C+=WJ(M).i),C+=P,I+=j,0==(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)tE(),o=new co,f9((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),o);else if((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i>1)for(b=new cx((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a));b.e!=b.i.gc();)Qjn(b);for(d=C,C>y+m?d=y+m:C<y-m&&(d=y-m),g=I,I>k+w?g=k+w:I<k-w&&(g=k-w),d>y-m&&d<y+m&&g>k-w&&g<k+w&&(d=y+m),Ien(u=BB(Wtn((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),0),202),d),Aen(u,g),E=y,y>C+P?E=C+P:y<C-P&&(E=C-P),T=k,k>I+j?T=I+j:k<I-j&&(T=I-j),E>C-P&&E<C+P&&T>I-j&&T<I+j&&(T=I+j),Ten(u,E),Oen(u,T),sqn((!u.a&&(u.a=new $L(xOt,u,5)),u.a)),a=pvn(t,5),v==S&&++a,A=E-d,N=T-g,h=.20000000298023224*e.Math.sqrt(A*A+N*N),$=A/(a+1),x=N/(a+1),O=d,L=g,s=0;s<a;s++)L+=x,(f=(O+=$)+H$n(t,24)*uYn*h-h/2)<0?f=1:f>i&&(f=i-1),(l=L+H$n(t,24)*uYn*h-h/2)<0?l=1:l>r&&(l=r-1),tE(),jen(c=new ro,f),Een(c,l),f9((!u.a&&(u.a=new $L(xOt,u,5)),u.a),c)}function HXn(){HXn=O,sWn(),ppt=jPt,vpt=EPt,mpt=TPt,ypt=MPt,jpt=SPt,Ept=PPt,Spt=IPt,Cpt=APt,Ipt=$Pt,Ppt=OPt,Opt=LPt,$pt=NPt,Npt=RPt,Mpt=CPt,fWn(),gpt=_wt,kpt=Fwt,Tpt=Bwt,Apt=Hwt,hpt=new XA(pPt,iln(0)),fpt=Dwt,lpt=Rwt,bpt=Kwt,zpt=ldt,Rpt=zwt,Kpt=Wwt,Bpt=edt,_pt=Ywt,Fpt=Zwt,Xpt=pdt,Upt=wdt,qpt=odt,Hpt=adt,Gpt=hdt,Rgt=Pwt,Kgt=Cwt,rgt=Kbt,cgt=Bbt,Ugt=new WA(12),zgt=new XA(XSt,Ugt),Mbn(),Zdt=new XA(vSt,ngt=QPt),tpt=new XA(aPt,0),wpt=new XA(vPt,iln(1)),Edt=new XA(cSt,dZn),Ggt=zSt,ept=uPt,upt=wPt,zdt=lSt,kdt=iSt,sgt=ESt,dpt=new XA(kPt,(hN(),!0)),wgt=SSt,dgt=PSt,Fgt=KSt,qgt=qSt,Bgt=FSt,Ffn(),Udt=new XA(bSt,Wdt=BPt),$gt=DSt,Agt=NSt,cpt=fPt,rpt=hPt,apt=bPt,cpn(),new XA(ZSt,Vgt=qCt),Ygt=ePt,Jgt=iPt,Zgt=rPt,Qgt=tPt,Dpt=Gwt,Pgt=lwt,Sgt=hwt,xpt=qwt,kgt=ewt,Gdt=Tbt,qdt=jbt,xdt=ubt,Ddt=obt,Kdt=bbt,Rdt=sbt,Hdt=ybt,Igt=wwt,Ogt=dwt,pgt=Vbt,_gt=$wt,Ngt=mwt,ugt=Gbt,Dgt=Mwt,egt=Nbt,igt=Dbt,Ndt=hSt,Lgt=gwt,Pdt=Qlt,Sdt=Wlt,Mdt=Xlt,fgt=Xbt,hgt=Ubt,lgt=Wbt,Hgt=BSt,vgt=OSt,agt=ySt,Ydt=gSt,Qdt=dSt,_dt=gbt,ipt=sPt,Tdt=sSt,bgt=MSt,npt=cPt,Xgt=VSt,Wgt=YSt,Egt=cwt,Tgt=uwt,spt=gPt,jdt=Ult,Mgt=swt,Jdt=Obt,Vdt=Cbt,Cgt=$St,mgt=Zbt,xgt=jwt,Lpt=xPt,Xdt=Sbt,opt=Nwt,tgt=$bt,ygt=twt,Fdt=vbt,ggt=ISt,jgt=rwt,Bdt=mbt,Ldt=cbt,Adt=ebt,Idt=nbt,Odt=tbt,$dt=rbt,Cdt=Jlt,ogt=zbt}function qXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(uHn(),T=n.e,w=n.d,r=n.a,0==T)switch(t){case 0:return"0";case 1:return WQn;case 2:return"0.00";case 3:return"0.000";case 4:return"0.0000";case 5:return"0.00000";case 6:return"0.000000";default:return(j=new Ck).a+=t<0?"0E+":"0E",j.a+=-t,j.a}if(y=x8(ONt,WVn,25,1+(m=10*w+1+7),15,1),e=m,1==w)if((u=r[0])<0){C=e0(u,UQn);do{d=C,C=Ojn(C,10),y[--e]=48+dG(ibn(d,cbn(C,10)))&QVn}while(0!=Vhn(C,0))}else{C=u;do{d=C,C=C/10|0,y[--e]=d-10*C+48&QVn}while(0!=C)}else{aHn(r,0,S=x8(ANt,hQn,25,w,15,1),0,P=w);n:for(;;){for(E=0,s=P-1;s>=0;s--)p=fTn(rbn(yz(E,32),e0(S[s],UQn))),S[s]=dG(p),E=dG(kz(p,32));v=dG(E),g=e;do{y[--e]=48+v%10&QVn}while(0!=(v=v/10|0)&&0!=e);for(i=9-g+e,o=0;o<i&&e>0;o++)y[--e]=48;for(f=P-1;0==S[f];f--)if(0==f)break n;P=f+1}for(;48==y[e];)++e}if(b=T<0,a=m-e-t-1,0==t)return b&&(y[--e]=45),Bdn(y,e,m-e);if(t>0&&a>=-6){if(a>=0){for(h=e+a,l=m-1;l>=h;l--)y[l+1]=y[l];return y[++h]=46,b&&(y[--e]=45),Bdn(y,e,m-e+1)}for(f=2;f<1-a;f++)y[--e]=48;return y[--e]=46,y[--e]=48,b&&(y[--e]=45),Bdn(y,e,m-e)}return M=e+1,c=m,k=new Ik,b&&(k.a+="-"),c-M>=1?(xX(k,y[e]),k.a+=".",k.a+=Bdn(y,e+1,m-e-1)):k.a+=Bdn(y,e,m-e),k.a+="E",a>0&&(k.a+="+"),k.a+=""+a,k.a}function GXn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;switch(n.c=t,n.g=new xp,GM(),twn(new Pw(new Dy(n.c))),v=SD(ZAn(n.c,(MMn(),dTt))),u=BB(ZAn(n.c,pTt),316),y=BB(ZAn(n.c,vTt),429),c=BB(ZAn(n.c,hTt),482),m=BB(ZAn(n.c,gTt),430),n.j=Gy(MD(ZAn(n.c,mTt))),a=n.a,u.g){case 0:a=n.a;break;case 1:a=n.b;break;case 2:a=n.i;break;case 3:a=n.e;break;case 4:a=n.f;break;default:throw Hp(new _y(N4n+(null!=u.f?u.f:""+u.g)))}if(n.d=new DJ(a,y,c),hon(n.d,(Xcn(),Qrt),TD(ZAn(n.c,lTt))),n.d.c=qy(TD(ZAn(n.c,fTt))),0==YQ(n.c).i)return n.d;for(h=new AL(YQ(n.c));h.e!=h.i.gc();){for(l=(s=BB(kpn(h),33)).g/2,f=s.f/2,k=new xC(s.i+l,s.j+f);hU(n.g,k);)_x(k,(e.Math.random()-.5)*lZn,(e.Math.random()-.5)*lZn);w=BB(ZAn(s,(sWn(),$St)),142),d=new AZ(k,new UV(k.a-l-n.j/2-w.b,k.b-f-n.j/2-w.d,s.g+n.j+(w.b+w.c),s.f+n.j+(w.d+w.a))),WB(n.d.i,d),VW(n.g,k,new rI(d,s))}switch(m.g){case 0:if(null==v)n.d.d=BB(xq(n.d.i,0),65);else for(p=new Wb(n.d.i);p.a<p.c.c.length;)d=BB(n0(p),65),null!=(b=BB(BB(RX(n.g,d.a),46).b,33).zg())&&mK(b,v)&&(n.d.d=d);break;case 1:for((i=new xC(n.c.g,n.c.f)).a*=.5,i.b*=.5,_x(i,n.c.i,n.c.j),r=RQn,g=new Wb(n.d.i);g.a<g.c.c.length;)(o=W8((d=BB(n0(g),65)).a,i))<r&&(r=o,n.d.d=d);break;default:throw Hp(new _y(N4n+(null!=m.f?m.f:""+m.g)))}return n.d}function zXn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E;for(j=BB(Wtn((!n.a&&(n.a=new eU(FOt,n,6,6)),n.a),0),202),f=new km,k=new xp,E=tFn(j),jCn(k.f,j,E),b=new xp,r=new YT,d=NU(Wen(Pun(Gk(xnt,1),HWn,20,0,[(!t.d&&(t.d=new hK(_Ot,t,8,5)),t.d),(!t.e&&(t.e=new hK(_Ot,t,7,4)),t.e)])));dAn(d);){if(w=BB(U5(d),79),1!=(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i)throw Hp(new _y(B5n+(!n.a&&(n.a=new eU(FOt,n,6,6)),n.a).i));w!=n&&(r5(r,p=BB(Wtn((!w.a&&(w.a=new eU(FOt,w,6,6)),w.a),0),202),r.c.b,r.c),(g=BB(qI(AY(k.f,p)),12))||(g=tFn(p),jCn(k.f,p,g)),l=i?XR(new wA(BB(xq(E,E.c.length-1),8)),BB(xq(g,g.c.length-1),8)):XR(new wA((l1(0,E.c.length),BB(E.c[0],8))),(l1(0,g.c.length),BB(g.c[0],8))),jCn(b.f,p,l))}if(0!=r.b)for(v=BB(xq(E,i?E.c.length-1:0),8),h=1;h<E.c.length;h++){for(m=BB(xq(E,i?E.c.length-1-h:h),8),c=spn(r,0);c.b!=c.d.c;)p=BB(b3(c),202),(g=BB(qI(AY(k.f,p)),12)).c.length<=h?mtn(c):(y=UR(new wA(BB(xq(g,i?g.c.length-1-h:h),8)),BB(qI(AY(b.f,p)),8)),m.a==y.a&&m.b==y.b||(a=m.a-v.a,o=m.b-v.b,(u=y.a-v.a)*o==(s=y.b-v.b)*a&&(0==a||isNaN(a)?a:a<0?-1:1)==(0==u||isNaN(u)?u:u<0?-1:1)&&(0==o||isNaN(o)?o:o<0?-1:1)==(0==s||isNaN(s)?s:s<0?-1:1)?(e.Math.abs(a)<e.Math.abs(u)||e.Math.abs(o)<e.Math.abs(s))&&r5(f,m,f.c.b,f.c):h>1&&r5(f,v,f.c.b,f.c),mtn(c)));v=m}return f}function UXn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A;for(OTn(e,"Greedy cycle removal",1),A=(m=t.a).c.length,n.a=x8(ANt,hQn,25,A,15,1),n.c=x8(ANt,hQn,25,A,15,1),n.b=x8(ANt,hQn,25,A,15,1),s=0,p=new Wb(m);p.a<p.c.c.length;){for((d=BB(n0(p),10)).p=s,T=new Wb(d.j);T.a<T.c.c.length;){for(u=new Wb((k=BB(n0(T),11)).e);u.a<u.c.c.length;)(i=BB(n0(u),17)).c.i!=d&&(S=BB(mMn(i,(HXn(),fpt)),19).a,n.a[s]+=S>0?S+1:1);for(a=new Wb(k.g);a.a<a.c.c.length;)(i=BB(n0(a),17)).d.i!=d&&(S=BB(mMn(i,(HXn(),fpt)),19).a,n.c[s]+=S>0?S+1:1)}0==n.c[s]?DH(n.e,d):0==n.a[s]&&DH(n.f,d),++s}for(w=-1,b=1,f=new Np,n.d=BB(mMn(t,(hWn(),Slt)),230);A>0;){for(;0!=n.e.b;)C=BB(dH(n.e),10),n.b[C.p]=w--,QKn(n,C),--A;for(;0!=n.f.b;)I=BB(dH(n.f),10),n.b[I.p]=b++,QKn(n,I),--A;if(A>0){for(l=_Vn,v=new Wb(m);v.a<v.c.c.length;)d=BB(n0(v),10),0==n.b[d.p]&&(y=n.c[d.p]-n.a[d.p])>=l&&(y>l&&(f.c=x8(Ant,HWn,1,0,5,1),l=y),f.c[f.c.length]=d);h=n.Zf(f),n.b[h.p]=b++,QKn(n,h),--A}}for(P=m.c.length+1,s=0;s<m.c.length;s++)n.b[s]<0&&(n.b[s]+=P);for(g=new Wb(m);g.a<g.c.c.length;)for(E=0,M=(j=I2((d=BB(n0(g),10)).j)).length;E<M;++E)for(c=0,o=(r=Z0((k=j[E]).g)).length;c<o;++c)O=(i=r[c]).d.i.p,n.b[d.p]>n.b[O]&&(tBn(i,!0),hon(t,qft,(hN(),!0)));n.a=null,n.c=null,n.b=null,yQ(n.f),yQ(n.e),HSn(e)}function XXn(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;for(i=new Np,u=new Np,g=t/2,b=n.gc(),r=BB(n.Xb(0),8),p=BB(n.Xb(1),8),WB(i,(l1(0,(w=QAn(r.a,r.b,p.a,p.b,g)).c.length),BB(w.c[0],8))),WB(u,(l1(1,w.c.length),BB(w.c[1],8))),s=2;s<b;s++)d=r,r=p,p=BB(n.Xb(s),8),WB(i,(l1(1,(w=QAn(r.a,r.b,d.a,d.b,g)).c.length),BB(w.c[1],8))),WB(u,(l1(0,w.c.length),BB(w.c[0],8))),WB(i,(l1(0,(w=QAn(r.a,r.b,p.a,p.b,g)).c.length),BB(w.c[0],8))),WB(u,(l1(1,w.c.length),BB(w.c[1],8)));for(WB(i,(l1(1,(w=QAn(p.a,p.b,r.a,r.b,g)).c.length),BB(w.c[1],8))),WB(u,(l1(0,w.c.length),BB(w.c[0],8))),e=new km,a=new Np,DH(e,(l1(0,i.c.length),BB(i.c[0],8))),h=1;h<i.c.length-2;h+=2)l1(h,i.c.length),c=BB(i.c[h],8),l=qPn((l1(h-1,i.c.length),BB(i.c[h-1],8)),c,(l1(h+1,i.c.length),BB(i.c[h+1],8)),(l1(h+2,i.c.length),BB(i.c[h+2],8))),isFinite(l.a)&&isFinite(l.b)?r5(e,l,e.c.b,e.c):r5(e,c,e.c.b,e.c);for(DH(e,BB(xq(i,i.c.length-1),8)),WB(a,(l1(0,u.c.length),BB(u.c[0],8))),f=1;f<u.c.length-2;f+=2)l1(f,u.c.length),c=BB(u.c[f],8),l=qPn((l1(f-1,u.c.length),BB(u.c[f-1],8)),c,(l1(f+1,u.c.length),BB(u.c[f+1],8)),(l1(f+2,u.c.length),BB(u.c[f+2],8))),isFinite(l.a)&&isFinite(l.b)?a.c[a.c.length]=l:a.c[a.c.length]=c;for(WB(a,BB(xq(u,u.c.length-1),8)),o=a.c.length-1;o>=0;o--)DH(e,(l1(o,a.c.length),BB(a.c[o],8)));return e}function WXn(n){var t,e,i,r,c,a,u,o,s,h,f,l,b;if(a=!0,f=null,i=null,r=null,t=!1,b=kAt,s=null,c=null,(o=Vgn(n,u=0,AAt,$At))<n.length&&(b1(o,n.length),58==n.charCodeAt(o))&&(f=n.substr(u,o-u),u=o+1),e=null!=f&&xT(jAt,f.toLowerCase())){if(-1==(o=n.lastIndexOf("!/")))throw Hp(new _y("no archive separator"));a=!0,i=fx(n,u,++o),u=o}else u>=0&&mK(n.substr(u,2),"//")?(o=Vgn(n,u+=2,LAt,NAt),i=n.substr(u,o-u),u=o):null==f||u!=n.length&&(b1(u,n.length),47==n.charCodeAt(u))||(a=!1,-1==(o=yN(n,YTn(35),u))&&(o=n.length),i=n.substr(u,o-u),u=o);if(!e&&u<n.length&&(b1(u,n.length),47==n.charCodeAt(u))&&(o=Vgn(n,u+1,LAt,NAt),(h=n.substr(u+1,o-(u+1))).length>0&&58==fV(h,h.length-1)&&(r=h,u=o)),u<n.length&&(b1(u,n.length),47==n.charCodeAt(u))&&(++u,t=!0),u<n.length&&(b1(u,n.length),63!=n.charCodeAt(u))&&(b1(u,n.length),35!=n.charCodeAt(u))){for(l=new Np;u<n.length&&(b1(u,n.length),63!=n.charCodeAt(u))&&(b1(u,n.length),35!=n.charCodeAt(u));)o=Vgn(n,u,LAt,NAt),WB(l,n.substr(u,o-u)),(u=o)<n.length&&(b1(u,n.length),47==n.charCodeAt(u))&&(Qhn(n,++u)||(l.c[l.c.length]=""));Qgn(l,b=x8(Qtt,sVn,2,l.c.length,6,1))}return u<n.length&&(b1(u,n.length),63==n.charCodeAt(u))&&(-1==(o=lx(n,35,++u))&&(o=n.length),s=n.substr(u,o-u),u=o),u<n.length&&(c=nO(n,++u)),wGn(a,f,i,r,b,s),new rRn(a,f,i,r,t,b,s,c)}function VXn(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A,$;for(O=new Np,w=new Wb(t.b);w.a<w.c.c.length;)for(k=new Wb(BB(n0(w),29).a);k.a<k.c.c.length;){for((y=BB(n0(k),10)).p=-1,l=_Vn,T=_Vn,S=new Wb(y.j);S.a<S.c.c.length;){for(c=new Wb((M=BB(n0(S),11)).e);c.a<c.c.c.length;)i=BB(n0(c),17),P=BB(mMn(i,(HXn(),bpt)),19).a,l=e.Math.max(l,P);for(r=new Wb(M.g);r.a<r.c.c.length;)i=BB(n0(r),17),P=BB(mMn(i,(HXn(),bpt)),19).a,T=e.Math.max(T,P)}hon(y,Xmt,iln(l)),hon(y,Wmt,iln(T))}for(p=0,b=new Wb(t.b);b.a<b.c.c.length;)for(k=new Wb(BB(n0(b),29).a);k.a<k.c.c.length;)(y=BB(n0(k),10)).p<0&&((I=new rm).b=p++,jRn(n,y,I),O.c[O.c.length]=I);for(E=sx(O.c.length),f=sx(O.c.length),u=0;u<O.c.length;u++)WB(E,new Np),WB(f,iln(0));for(vzn(t,O,E,f),A=BB(Qgn(O,x8(Ymt,O3n,257,O.c.length,0,1)),840),j=BB(Qgn(E,x8(Rnt,nZn,15,E.c.length,0,1)),192),h=x8(ANt,hQn,25,f.c.length,15,1),o=0;o<h.length;o++)h[o]=(l1(o,f.c.length),BB(f.c[o],19)).a;for(v=0,m=new Np,s=0;s<A.length;s++)0==h[s]&&WB(m,A[s]);for(g=x8(ANt,hQn,25,A.length,15,1);0!=m.c.length;)for(g[(I=BB(s6(m,0),257)).b]=v++;!j[I.b].dc();)--h[($=BB(j[I.b].$c(0),257)).b],0==h[$.b]&&(m.c[m.c.length]=$);for(n.a=x8(Ymt,O3n,257,A.length,0,1),a=0;a<A.length;a++)for(d=A[a],C=g[a],n.a[C]=d,d.b=C,k=new Wb(d.e);k.a<k.c.c.length;)(y=BB(n0(k),10)).p=C;return n.a}function QXn(n){var t,e,i;if(n.d>=n.j)return n.a=-1,void(n.c=1);if(t=fV(n.i,n.d++),n.a=t,1!=n.b){switch(t){case 124:i=2;break;case 42:i=3;break;case 43:i=4;break;case 63:i=5;break;case 41:i=7;break;case 46:i=8;break;case 91:i=9;break;case 94:i=11;break;case 36:i=12;break;case 40:if(i=6,n.d>=n.j)break;if(63!=fV(n.i,n.d))break;if(++n.d>=n.j)throw Hp(new ak(kWn((u$(),p8n))));switch(t=fV(n.i,n.d++)){case 58:i=13;break;case 61:i=14;break;case 33:i=15;break;case 91:i=19;break;case 62:i=18;break;case 60:if(n.d>=n.j)throw Hp(new ak(kWn((u$(),p8n))));if(61==(t=fV(n.i,n.d++)))i=16;else{if(33!=t)throw Hp(new ak(kWn((u$(),v8n))));i=17}break;case 35:for(;n.d<n.j&&41!=(t=fV(n.i,n.d++)););if(41!=t)throw Hp(new ak(kWn((u$(),m8n))));i=21;break;default:if(45==t||97<=t&&t<=122||65<=t&&t<=90){--n.d,i=22;break}if(40==t){i=23;break}throw Hp(new ak(kWn((u$(),p8n))))}break;case 92:if(i=10,n.d>=n.j)throw Hp(new ak(kWn((u$(),g8n))));n.a=fV(n.i,n.d++);break;default:i=0}n.c=i}else{switch(t){case 92:if(i=10,n.d>=n.j)throw Hp(new ak(kWn((u$(),g8n))));n.a=fV(n.i,n.d++);break;case 45:512==(512&n.e)&&n.d<n.j&&91==fV(n.i,n.d)?(++n.d,i=24):i=0;break;case 91:if(512!=(512&n.e)&&n.d<n.j&&58==fV(n.i,n.d)){++n.d,i=20;break}default:(64512&t)==HQn&&n.d<n.j&&56320==(64512&(e=fV(n.i,n.d)))&&(n.a=BQn+(t-HQn<<10)+e-56320,++n.d),i=0}n.c=i}}function YXn(n){var t,e,i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P;if((j=BB(mMn(n,(HXn(),ept)),98))!=(QEn(),QCt)&&j!=YCt){for(s=new J6((lin((b=(w=n.b).c.length)+2,NVn),ttn(rbn(rbn(5,b+2),(b+2)/10|0)))),d=new J6((lin(b+2,NVn),ttn(rbn(rbn(5,b+2),(b+2)/10|0)))),WB(s,new xp),WB(s,new xp),WB(d,new Np),WB(d,new Np),k=new Np,t=0;t<b;t++)for(l1(t,w.c.length),e=BB(w.c[t],29),l1(t,s.c.length),E=BB(s.c[t],83),g=new xp,s.c[s.c.length]=g,l1(t,d.c.length),M=BB(d.c[t],15),v=new Np,d.c[d.c.length]=v,r=new Wb(e.a);r.a<r.c.c.length;)if(cln(i=BB(n0(r),10)))k.c[k.c.length]=i;else{for(o=new oz(ZL(fbn(i).a.Kc(),new h));dAn(o);)cln(S=(a=BB(U5(o),17)).c.i)&&((T=BB(E.xc(mMn(S,(hWn(),dlt))),10))||(T=oIn(n,S),E.zc(mMn(S,dlt),T),M.Fc(T)),SZ(a,BB(xq(T.j,1),11)));for(u=new oz(ZL(lbn(i).a.Kc(),new h));dAn(u);)cln(P=(a=BB(U5(u),17)).d.i)&&((p=BB(RX(g,mMn(P,(hWn(),dlt))),10))||(p=oIn(n,P),VW(g,mMn(P,dlt),p),v.c[v.c.length]=p),MZ(a,BB(xq(p.j,0),11)))}for(f=0;f<d.c.length;f++)if(l1(f,d.c.length),!(m=BB(d.c[f],15)).dc())for(l=null,0==f?(l=new HX(n),LZ(0,w.c.length),MS(w.c,0,l)):f==s.c.length-1?(l=new HX(n),w.c[w.c.length]=l):(l1(f-1,w.c.length),l=BB(w.c[f-1],29)),c=m.Kc();c.Ob();)PZ(BB(c.Pb(),10),l);for(y=new Wb(k);y.a<y.c.c.length;)PZ(BB(n0(y),10),null);hon(n,(hWn(),Wft),k)}}function JXn(n,t,e){var i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j;if(OTn(e,"Coffman-Graham Layering",1),0!=t.a.c.length){for(j=BB(mMn(t,(HXn(),mgt)),19).a,o=0,a=0,b=new Wb(t.a);b.a<b.c.c.length;)for((l=BB(n0(b),10)).p=o++,c=new oz(ZL(lbn(l).a.Kc(),new h));dAn(c);)(r=BB(U5(c),17)).p=a++;for(n.d=x8($Nt,ZYn,25,o,16,1),n.a=x8($Nt,ZYn,25,a,16,1),n.b=x8(ANt,hQn,25,o,15,1),n.e=x8(ANt,hQn,25,o,15,1),n.f=x8(ANt,hQn,25,o,15,1),win(n.c),rEn(n,t),d=new Xz(new Dd(n)),k=new Wb(t.a);k.a<k.c.c.length;){for(c=new oz(ZL(fbn(m=BB(n0(k),10)).a.Kc(),new h));dAn(c);)r=BB(U5(c),17),n.a[r.p]||++n.b[m.p];0==n.b[m.p]&&F8(eMn(d,m))}for(u=0;0!=d.b.c.length;)for(m=BB(mnn(d),10),n.f[m.p]=u++,c=new oz(ZL(lbn(m).a.Kc(),new h));dAn(c);)r=BB(U5(c),17),n.a[r.p]||(p=r.d.i,--n.b[p.p],JIn(n.c,p,iln(n.f[m.p])),0==n.b[p.p]&&F8(eMn(d,p)));for(w=new Xz(new Rd(n)),y=new Wb(t.a);y.a<y.c.c.length;){for(c=new oz(ZL(lbn(m=BB(n0(y),10)).a.Kc(),new h));dAn(c);)r=BB(U5(c),17),n.a[r.p]||++n.e[m.p];0==n.e[m.p]&&F8(eMn(w,m))}for(i=r1(t,f=new Np);0!=w.b.c.length;)for(v=BB(mnn(w),10),(i.a.c.length>=j||!Ndn(v,i))&&(i=r1(t,f)),PZ(v,i),c=new oz(ZL(fbn(v).a.Kc(),new h));dAn(c);)r=BB(U5(c),17),n.a[r.p]||(g=r.c.i,--n.e[g.p],0==n.e[g.p]&&F8(eMn(w,g)));for(s=f.c.length-1;s>=0;--s)WB(t.b,(l1(s,f.c.length),BB(f.c[s],29)));t.a.c=x8(Ant,HWn,1,0,5,1),HSn(e)}else HSn(e)}function ZXn(n){var t,e,i,r,c,a,u,o;for(n.b=1,QXn(n),t=null,0==n.c&&94==n.a?(QXn(n),wWn(),wWn(),Yxn(t=new M0(4),0,unt),a=new M0(4)):(wWn(),wWn(),a=new M0(4)),r=!0;1!=(o=n.c);){if(0==o&&93==n.a&&!r){t&&(WGn(t,a),a=t);break}if(e=n.a,i=!1,10==o)switch(e){case 100:case 68:case 119:case 87:case 115:case 83:sHn(a,d_n(e)),i=!0;break;case 105:case 73:case 99:case 67:sHn(a,d_n(e)),(e=-1)<0&&(i=!0);break;case 112:case 80:if(!(u=DIn(n,e)))throw Hp(new ak(kWn((u$(),O8n))));sHn(a,u),i=!0;break;default:e=qDn(n)}else if(24==o&&!r){if(t&&(WGn(t,a),a=t),WGn(a,ZXn(n)),0!=n.c||93!=n.a)throw Hp(new ak(kWn((u$(),N8n))));break}if(QXn(n),!i){if(0==o){if(91==e)throw Hp(new ak(kWn((u$(),x8n))));if(93==e)throw Hp(new ak(kWn((u$(),D8n))));if(45==e&&!r&&93!=n.a)throw Hp(new ak(kWn((u$(),R8n))))}if(0!=n.c||45!=n.a||45==e&&r)Yxn(a,e,e);else{if(QXn(n),1==(o=n.c))throw Hp(new ak(kWn((u$(),$8n))));if(0==o&&93==n.a)Yxn(a,e,e),Yxn(a,45,45);else{if(0==o&&93==n.a||24==o)throw Hp(new ak(kWn((u$(),R8n))));if(c=n.a,0==o){if(91==c)throw Hp(new ak(kWn((u$(),x8n))));if(93==c)throw Hp(new ak(kWn((u$(),D8n))));if(45==c)throw Hp(new ak(kWn((u$(),R8n))))}else 10==o&&(c=qDn(n));if(QXn(n),e>c)throw Hp(new ak(kWn((u$(),F8n))));Yxn(a,e,c)}}}r=!1}if(1==n.c)throw Hp(new ak(kWn((u$(),$8n))));return T$n(a),qHn(a),n.b=0,QXn(n),a}function nWn(n){V$n(n.c,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#decimal"])),V$n(n.d,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#integer"])),V$n(n.e,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#boolean"])),V$n(n.f,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EBoolean",t8n,"EBoolean:Object"])),V$n(n.i,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#byte"])),V$n(n.g,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#hexBinary"])),V$n(n.j,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EByte",t8n,"EByte:Object"])),V$n(n.n,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EChar",t8n,"EChar:Object"])),V$n(n.t,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#double"])),V$n(n.u,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EDouble",t8n,"EDouble:Object"])),V$n(n.F,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#float"])),V$n(n.G,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EFloat",t8n,"EFloat:Object"])),V$n(n.I,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#int"])),V$n(n.J,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EInt",t8n,"EInt:Object"])),V$n(n.N,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#long"])),V$n(n.O,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"ELong",t8n,"ELong:Object"])),V$n(n.Z,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#short"])),V$n(n.$,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"EShort",t8n,"EShort:Object"])),V$n(n._,_9n,Pun(Gk(Qtt,1),sVn,2,6,[J9n,"http://www.w3.org/2001/XMLSchema#string"]))}function tWn(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(1==n.c.length)return l1(0,n.c.length),BB(n.c[0],135);if(n.c.length<=0)return new P6;for(s=new Wb(n);s.a<s.c.c.length;){for(u=BB(n0(s),135),m=0,d=DWn,g=DWn,b=_Vn,w=_Vn,v=spn(u.b,0);v.b!=v.d.c;)p=BB(b3(v),86),m+=BB(mMn(p,(CAn(),$kt)),19).a,d=e.Math.min(d,p.e.a),g=e.Math.min(g,p.e.b),b=e.Math.max(b,p.e.a+p.f.a),w=e.Math.max(w,p.e.b+p.f.b);hon(u,(CAn(),$kt),iln(m)),hon(u,(qqn(),nkt),new xC(d,g)),hon(u,Zyt,new xC(b,w))}for(SQ(),m$(n,new ga),qan(k=new P6,(l1(0,n.c.length),BB(n.c[0],94))),l=0,S=0,h=new Wb(n);h.a<h.c.c.length;)u=BB(n0(h),135),j=XR(B$(BB(mMn(u,(qqn(),Zyt)),8)),BB(mMn(u,nkt),8)),l=e.Math.max(l,j.a),S+=j.a*j.b;for(l=e.Math.max(l,e.Math.sqrt(S)*Gy(MD(mMn(k,(CAn(),jkt))))),P=0,C=0,f=0,t=E=Gy(MD(mMn(k,xkt))),o=new Wb(n);o.a<o.c.c.length;)u=BB(n0(o),135),P+(j=XR(B$(BB(mMn(u,(qqn(),Zyt)),8)),BB(mMn(u,nkt),8))).a>l&&(P=0,C+=f+E,f=0),ELn(k,u,P,C),t=e.Math.max(t,P+j.a),f=e.Math.max(f,j.b),P+=j.a+E;for(y=new xp,i=new xp,M=new Wb(n);M.a<M.c.c.length;)for(r=qy(TD(mMn(T=BB(n0(M),135),(sWn(),lSt)))),a=(T.q?T.q:het).vc().Kc();a.Ob();)hU(y,(c=BB(a.Pb(),42)).cd())?GI(BB(c.cd(),146).wg())!==GI(c.dd())&&(r&&hU(i,c.cd())?($T(),BB(c.cd(),146).tg()):(VW(y,BB(c.cd(),146),c.dd()),hon(k,BB(c.cd(),146),c.dd()),r&&VW(i,BB(c.cd(),146),c.dd()))):(VW(y,BB(c.cd(),146),c.dd()),hon(k,BB(c.cd(),146),c.dd()));return k}function eWn(){eWn=O,RXn(),JIn(put=new pJ,(kUn(),dIt),wIt),JIn(put,MIt,wIt),JIn(put,gIt,wIt),JIn(put,jIt,wIt),JIn(put,kIt,wIt),JIn(put,mIt,wIt),JIn(put,jIt,dIt),JIn(put,wIt,hIt),JIn(put,dIt,hIt),JIn(put,MIt,hIt),JIn(put,gIt,hIt),JIn(put,yIt,hIt),JIn(put,jIt,hIt),JIn(put,kIt,hIt),JIn(put,mIt,hIt),JIn(put,bIt,hIt),JIn(put,wIt,EIt),JIn(put,dIt,EIt),JIn(put,hIt,EIt),JIn(put,MIt,EIt),JIn(put,gIt,EIt),JIn(put,yIt,EIt),JIn(put,jIt,EIt),JIn(put,bIt,EIt),JIn(put,TIt,EIt),JIn(put,kIt,EIt),JIn(put,pIt,EIt),JIn(put,mIt,EIt),JIn(put,dIt,MIt),JIn(put,gIt,MIt),JIn(put,jIt,MIt),JIn(put,mIt,MIt),JIn(put,dIt,gIt),JIn(put,MIt,gIt),JIn(put,jIt,gIt),JIn(put,gIt,gIt),JIn(put,kIt,gIt),JIn(put,wIt,fIt),JIn(put,dIt,fIt),JIn(put,hIt,fIt),JIn(put,EIt,fIt),JIn(put,MIt,fIt),JIn(put,gIt,fIt),JIn(put,yIt,fIt),JIn(put,jIt,fIt),JIn(put,TIt,fIt),JIn(put,bIt,fIt),JIn(put,mIt,fIt),JIn(put,kIt,fIt),JIn(put,vIt,fIt),JIn(put,wIt,TIt),JIn(put,dIt,TIt),JIn(put,hIt,TIt),JIn(put,MIt,TIt),JIn(put,gIt,TIt),JIn(put,yIt,TIt),JIn(put,jIt,TIt),JIn(put,bIt,TIt),JIn(put,mIt,TIt),JIn(put,pIt,TIt),JIn(put,vIt,TIt),JIn(put,dIt,bIt),JIn(put,MIt,bIt),JIn(put,gIt,bIt),JIn(put,jIt,bIt),JIn(put,TIt,bIt),JIn(put,mIt,bIt),JIn(put,kIt,bIt),JIn(put,wIt,lIt),JIn(put,dIt,lIt),JIn(put,hIt,lIt),JIn(put,MIt,lIt),JIn(put,gIt,lIt),JIn(put,yIt,lIt),JIn(put,jIt,lIt),JIn(put,bIt,lIt),JIn(put,mIt,lIt),JIn(put,dIt,kIt),JIn(put,hIt,kIt),JIn(put,EIt,kIt),JIn(put,gIt,kIt),JIn(put,wIt,pIt),JIn(put,dIt,pIt),JIn(put,EIt,pIt),JIn(put,MIt,pIt),JIn(put,gIt,pIt),JIn(put,yIt,pIt),JIn(put,jIt,pIt),JIn(put,jIt,vIt),JIn(put,gIt,vIt),JIn(put,bIt,wIt),JIn(put,bIt,MIt),JIn(put,bIt,hIt),JIn(put,yIt,wIt),JIn(put,yIt,dIt),JIn(put,yIt,EIt)}function iWn(n,t){switch(n.e){case 0:case 2:case 4:case 6:case 42:case 44:case 46:case 48:case 8:case 10:case 12:case 14:case 16:case 18:case 20:case 22:case 24:case 26:case 28:case 30:case 32:case 34:case 36:case 38:return new zQ(n.b,n.a,t,n.c);case 1:return new LL(n.a,t,Awn(t.Tg(),n.c));case 43:return new xL(n.a,t,Awn(t.Tg(),n.c));case 3:return new $L(n.a,t,Awn(t.Tg(),n.c));case 45:return new NL(n.a,t,Awn(t.Tg(),n.c));case 41:return new y9(BB(Ikn(n.c),26),n.a,t,Awn(t.Tg(),n.c));case 50:return new yin(BB(Ikn(n.c),26),n.a,t,Awn(t.Tg(),n.c));case 5:return new iK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 47:return new rK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 7:return new eU(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 49:return new eK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 9:return new FL(n.a,t,Awn(t.Tg(),n.c));case 11:return new _L(n.a,t,Awn(t.Tg(),n.c));case 13:return new KL(n.a,t,Awn(t.Tg(),n.c));case 15:return new MH(n.a,t,Awn(t.Tg(),n.c));case 17:return new BL(n.a,t,Awn(t.Tg(),n.c));case 19:return new RL(n.a,t,Awn(t.Tg(),n.c));case 21:return new DL(n.a,t,Awn(t.Tg(),n.c));case 23:return new yH(n.a,t,Awn(t.Tg(),n.c));case 25:return new fK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 27:return new hK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 29:return new oK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 31:return new cK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 33:return new sK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 35:return new uK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 37:return new aK(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 39:return new iU(n.a,t,Awn(t.Tg(),n.c),n.d.n);case 40:return new Ecn(t,Awn(t.Tg(),n.c));default:throw Hp(new dy("Unknown feature style: "+n.e))}}function rWn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;switch(OTn(e,"Brandes & Koepf node placement",1),n.a=t,n.c=FFn(t),i=BB(mMn(t,(HXn(),Ngt)),274),b=qy(TD(mMn(t,xgt))),n.d=i==(Bjn(),Qht)&&!b||i==Xht,Jqn(n,t),y=null,k=null,g=null,p=null,lin(4,AVn),d=new J6(4),BB(mMn(t,Ngt),274).g){case 3:g=new qKn(t,n.c.d,(oZ(),ryt),(gJ(),nyt)),d.c[d.c.length]=g;break;case 1:p=new qKn(t,n.c.d,(oZ(),cyt),(gJ(),nyt)),d.c[d.c.length]=p;break;case 4:y=new qKn(t,n.c.d,(oZ(),ryt),(gJ(),tyt)),d.c[d.c.length]=y;break;case 2:k=new qKn(t,n.c.d,(oZ(),cyt),(gJ(),tyt)),d.c[d.c.length]=k;break;default:g=new qKn(t,n.c.d,(oZ(),ryt),(gJ(),nyt)),p=new qKn(t,n.c.d,cyt,nyt),y=new qKn(t,n.c.d,ryt,tyt),k=new qKn(t,n.c.d,cyt,tyt),d.c[d.c.length]=y,d.c[d.c.length]=k,d.c[d.c.length]=g,d.c[d.c.length]=p}for(r=new iC(t,n.c),u=new Wb(d);u.a<u.c.c.length;)PXn(r,c=BB(n0(u),180),n.b),WBn(c);for(l=new Jyn(t,n.c),o=new Wb(d);o.a<o.c.c.length;)Hzn(l,c=BB(n0(o),180));if(e.n)for(s=new Wb(d);s.a<s.c.c.length;)OH(e,(c=BB(n0(s),180))+" size is "+v$n(c));if(f=null,n.d&&IBn(t,h=FUn(n,d,n.c.d),e)&&(f=h),!f)for(s=new Wb(d);s.a<s.c.c.length;)IBn(t,c=BB(n0(s),180),e)&&(!f||v$n(f)>v$n(c))&&(f=c);for(!f&&(l1(0,d.c.length),f=BB(d.c[0],180)),w=new Wb(t.b);w.a<w.c.c.length;)for(m=new Wb(BB(n0(w),29).a);m.a<m.c.c.length;)(v=BB(n0(m),10)).n.b=Gy(f.p[v.p])+Gy(f.d[v.p]);for(e.n&&(OH(e,"Chosen node placement: "+f),OH(e,"Blocks: "+xOn(f)),OH(e,"Classes: "+UAn(f,e)),OH(e,"Marked edges: "+n.b)),a=new Wb(d);a.a<a.c.c.length;)(c=BB(n0(a),180)).g=null,c.b=null,c.a=null,c.d=null,c.j=null,c.i=null,c.p=null;zrn(n.c),n.b.a.$b(),HSn(e)}function cWn(n,t,e){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T;for(a=new YT,v=BB(mMn(e,(HXn(),Udt)),103),w=0,Frn(a,(!t.a&&(t.a=new eU(UOt,t,10,11)),t.a));0!=a.b;)s=BB(0==a.b?null:(Px(0!=a.b),Atn(a,a.a.a)),33),(GI(ZAn(t,Ldt))!==GI((mon(),Nvt))||GI(ZAn(t,Gdt))===GI((Vvn(),Eht))||GI(ZAn(t,Gdt))===GI((Vvn(),kht))||qy(TD(ZAn(t,xdt)))||GI(ZAn(t,Cdt))!==GI((Bfn(),wut)))&&!qy(TD(ZAn(s,$dt)))&&Ypn(s,(hWn(),wlt),iln(w++)),!qy(TD(ZAn(s,Ggt)))&&(f=0!=(!s.a&&(s.a=new eU(UOt,s,10,11)),s.a).i,b=kTn(s),l=GI(ZAn(s,sgt))===GI((ufn(),pCt)),g=null,(T=!P8(s,(sWn(),eSt))||mK(SD(ZAn(s,eSt)),w1n))&&l&&(f||b)&&(hon(g=kFn(s),Udt,v),Lx(g,gpt)&&My(new uwn(Gy(MD(mMn(g,gpt)))),g),0!=BB(ZAn(s,Fgt),174).gc()&&(h=g,JT(new Rq(null,(!s.c&&(s.c=new eU(XOt,s,9,9)),new w1(s.c,16))),new Xw(h)),mDn(s,g))),m=e,(y=BB(RX(n.a,JJ(s)),10))&&(m=y.e),d=wzn(n,s,m),g&&(d.e=g,g.e=d,Frn(a,(!s.a&&(s.a=new eU(UOt,s,10,11)),s.a))));for(w=0,r5(a,t,a.c.b,a.c);0!=a.b;){for(o=new AL((!(c=BB(0==a.b?null:(Px(0!=a.b),Atn(a,a.a.a)),33)).b&&(c.b=new eU(_Ot,c,12,3)),c.b));o.e!=o.i.gc();)tKn(u=BB(kpn(o),79)),(GI(ZAn(t,Ldt))!==GI((mon(),Nvt))||GI(ZAn(t,Gdt))===GI((Vvn(),Eht))||GI(ZAn(t,Gdt))===GI((Vvn(),kht))||qy(TD(ZAn(t,xdt)))||GI(ZAn(t,Cdt))!==GI((Bfn(),wut)))&&Ypn(u,(hWn(),wlt),iln(w++)),j=PTn(BB(Wtn((!u.b&&(u.b=new hK(KOt,u,4,7)),u.b),0),82)),E=PTn(BB(Wtn((!u.c&&(u.c=new hK(KOt,u,5,8)),u.c),0),82)),qy(TD(ZAn(u,Ggt)))||qy(TD(ZAn(j,Ggt)))||qy(TD(ZAn(E,Ggt)))||(p=c,QIn(u)&&qy(TD(ZAn(j,wgt)))&&qy(TD(ZAn(u,dgt)))||Ctn(E,j)?p=j:Ctn(j,E)&&(p=E),m=e,(y=BB(RX(n.a,p),10))&&(m=y.e),hon(uWn(n,u,p,m),(hWn(),Fft),Lxn(n,u,t,e)));if(l=GI(ZAn(c,sgt))===GI((ufn(),pCt)))for(r=new AL((!c.a&&(c.a=new eU(UOt,c,10,11)),c.a));r.e!=r.i.gc();)T=!P8(i=BB(kpn(r),33),(sWn(),eSt))||mK(SD(ZAn(i,eSt)),w1n),k=GI(ZAn(i,sgt))===GI(pCt),T&&k&&r5(a,i,a.c.b,a.c)}}function aWn(n,t,e,i,r,c){var a,u,o,s,h,f,l;switch(t){case 71:a=i.q.getFullYear()-sQn>=-1900?1:0,oO(n,e>=4?Pun(Gk(Qtt,1),sVn,2,6,[fQn,lQn])[a]:Pun(Gk(Qtt,1),sVn,2,6,["BC","AD"])[a]);break;case 121:opn(n,e,i);break;case 77:XKn(n,e,i);break;case 107:Enn(n,0==(u=r.q.getHours())?24:u,e);break;case 83:RLn(n,e,r);break;case 69:o=i.q.getDay(),oO(n,5==e?Pun(Gk(Qtt,1),sVn,2,6,["S","M","T","W","T","F","S"])[o]:4==e?Pun(Gk(Qtt,1),sVn,2,6,[bQn,wQn,dQn,gQn,pQn,vQn,mQn])[o]:Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"])[o]);break;case 97:r.q.getHours()>=12&&r.q.getHours()<24?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["AM","PM"])[1]):oO(n,Pun(Gk(Qtt,1),sVn,2,6,["AM","PM"])[0]);break;case 104:Enn(n,0==(s=r.q.getHours()%12)?12:s,e);break;case 75:Enn(n,r.q.getHours()%12,e);break;case 72:Enn(n,r.q.getHours(),e);break;case 99:h=i.q.getDay(),5==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["S","M","T","W","T","F","S"])[h]):4==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,[bQn,wQn,dQn,gQn,pQn,vQn,mQn])[h]):3==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["Sun","Mon","Tue","Wed","Thu","Fri","Sat"])[h]):Enn(n,h,1);break;case 76:f=i.q.getMonth(),5==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["J","F","M","A","M","J","J","A","S","O","N","D"])[f]):4==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,[YVn,JVn,ZVn,nQn,tQn,eQn,iQn,rQn,cQn,aQn,uQn,oQn])[f]):3==e?oO(n,Pun(Gk(Qtt,1),sVn,2,6,["Jan","Feb","Mar","Apr",tQn,"Jun","Jul","Aug","Sep","Oct","Nov","Dec"])[f]):Enn(n,f+1,e);break;case 81:l=i.q.getMonth()/3|0,oO(n,e<4?Pun(Gk(Qtt,1),sVn,2,6,["Q1","Q2","Q3","Q4"])[l]:Pun(Gk(Qtt,1),sVn,2,6,["1st quarter","2nd quarter","3rd quarter","4th quarter"])[l]);break;case 100:Enn(n,i.q.getDate(),e);break;case 109:Enn(n,r.q.getMinutes(),e);break;case 115:Enn(n,r.q.getSeconds(),e);break;case 122:oO(n,e<4?c.c[0]:c.c[1]);break;case 118:oO(n,c.b);break;case 90:oO(n,e<3?nIn(c):3==e?wIn(c):dIn(c.a));break;default:return!1}return!0}function uWn(n,t,e,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C;if(tKn(t),o=BB(Wtn((!t.b&&(t.b=new hK(KOt,t,4,7)),t.b),0),82),h=BB(Wtn((!t.c&&(t.c=new hK(KOt,t,5,8)),t.c),0),82),u=PTn(o),s=PTn(h),a=0==(!t.a&&(t.a=new eU(FOt,t,6,6)),t.a).i?null:BB(Wtn((!t.a&&(t.a=new eU(FOt,t,6,6)),t.a),0),202),j=BB(RX(n.a,u),10),S=BB(RX(n.a,s),10),E=null,P=null,cL(o,186)&&(cL(k=BB(RX(n.a,o),299),11)?E=BB(k,11):cL(k,10)&&(j=BB(k,10),E=BB(xq(j.j,0),11))),cL(h,186)&&(cL(M=BB(RX(n.a,h),299),11)?P=BB(M,11):cL(M,10)&&(S=BB(M,10),P=BB(xq(S.j,0),11))),!j||!S)throw Hp(new ck("The source or the target of edge "+t+" could not be found. This usually happens when an edge connects a node laid out by ELK Layered to a node in another level of hierarchy laid out by either another instance of ELK Layered or another layout algorithm alltogether. The former can be solved by setting the hierarchyHandling option to INCLUDE_CHILDREN."));for(qan(d=new wY,t),hon(d,(hWn(),dlt),t),hon(d,(HXn(),vgt),null),b=BB(mMn(i,Zft),21),j==S&&b.Fc((bDn(),vft)),E||(ain(),y=qvt,T=null,a&&vA(BB(mMn(j,ept),98))&&(Y3(T=new xC(a.j,a.k),XJ(t)),t5(T,e),Ctn(s,u)&&(y=Hvt,UR(T,j.n))),E=dHn(j,T,y,i)),P||(ain(),y=Hvt,C=null,a&&vA(BB(mMn(S,ept),98))&&(Y3(C=new xC(a.b,a.c),XJ(t)),t5(C,e)),P=dHn(S,C,y,vW(S))),SZ(d,E),MZ(d,P),(E.e.c.length>1||E.g.c.length>1||P.e.c.length>1||P.g.c.length>1)&&b.Fc((bDn(),bft)),l=new AL((!t.n&&(t.n=new eU(zOt,t,1,7)),t.n));l.e!=l.i.gc();)if(!qy(TD(ZAn(f=BB(kpn(l),137),Ggt)))&&f.a)switch(g=Hhn(f),WB(d.b,g),BB(mMn(g,Ydt),272).g){case 1:case 2:b.Fc((bDn(),fft));break;case 0:b.Fc((bDn(),sft)),hon(g,Ydt,(Rtn(),zPt))}if(c=BB(mMn(i,qdt),314),p=BB(mMn(i,_gt),315),r=c==(Oin(),sht)||p==(Nvn(),pvt),a&&0!=(!a.a&&(a.a=new $L(xOt,a,5)),a.a).i&&r){for(v=qSn(a),w=new km,m=spn(v,0);m.b!=m.d.c;)DH(w,new wA(BB(b3(m),8)));hon(d,glt,w)}return d}function oWn(n){n.gb||(n.gb=!0,n.b=kan(n,0),Rrn(n.b,18),Krn(n.b,19),n.a=kan(n,1),Rrn(n.a,1),Krn(n.a,2),Krn(n.a,3),Krn(n.a,4),Krn(n.a,5),n.o=kan(n,2),Rrn(n.o,8),Rrn(n.o,9),Krn(n.o,10),Krn(n.o,11),Krn(n.o,12),Krn(n.o,13),Krn(n.o,14),Krn(n.o,15),Krn(n.o,16),Krn(n.o,17),Krn(n.o,18),Krn(n.o,19),Krn(n.o,20),Krn(n.o,21),Krn(n.o,22),Krn(n.o,23),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),otn(n.o),n.p=kan(n,3),Rrn(n.p,2),Rrn(n.p,3),Rrn(n.p,4),Rrn(n.p,5),Krn(n.p,6),Krn(n.p,7),otn(n.p),otn(n.p),n.q=kan(n,4),Rrn(n.q,8),n.v=kan(n,5),Krn(n.v,9),otn(n.v),otn(n.v),otn(n.v),n.w=kan(n,6),Rrn(n.w,2),Rrn(n.w,3),Rrn(n.w,4),Krn(n.w,5),n.B=kan(n,7),Krn(n.B,1),otn(n.B),otn(n.B),otn(n.B),n.Q=kan(n,8),Krn(n.Q,0),otn(n.Q),n.R=kan(n,9),Rrn(n.R,1),n.S=kan(n,10),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),otn(n.S),n.T=kan(n,11),Krn(n.T,10),Krn(n.T,11),Krn(n.T,12),Krn(n.T,13),Krn(n.T,14),otn(n.T),otn(n.T),n.U=kan(n,12),Rrn(n.U,2),Rrn(n.U,3),Krn(n.U,4),Krn(n.U,5),Krn(n.U,6),Krn(n.U,7),otn(n.U),n.V=kan(n,13),Krn(n.V,10),n.W=kan(n,14),Rrn(n.W,18),Rrn(n.W,19),Rrn(n.W,20),Krn(n.W,21),Krn(n.W,22),Krn(n.W,23),n.bb=kan(n,15),Rrn(n.bb,10),Rrn(n.bb,11),Rrn(n.bb,12),Rrn(n.bb,13),Rrn(n.bb,14),Rrn(n.bb,15),Rrn(n.bb,16),Krn(n.bb,17),otn(n.bb),otn(n.bb),n.eb=kan(n,16),Rrn(n.eb,2),Rrn(n.eb,3),Rrn(n.eb,4),Rrn(n.eb,5),Rrn(n.eb,6),Rrn(n.eb,7),Krn(n.eb,8),Krn(n.eb,9),n.ab=kan(n,17),Rrn(n.ab,0),Rrn(n.ab,1),n.H=kan(n,18),Krn(n.H,0),Krn(n.H,1),Krn(n.H,2),Krn(n.H,3),Krn(n.H,4),Krn(n.H,5),otn(n.H),n.db=kan(n,19),Krn(n.db,2),n.c=jan(n,20),n.d=jan(n,21),n.e=jan(n,22),n.f=jan(n,23),n.i=jan(n,24),n.g=jan(n,25),n.j=jan(n,26),n.k=jan(n,27),n.n=jan(n,28),n.r=jan(n,29),n.s=jan(n,30),n.t=jan(n,31),n.u=jan(n,32),n.fb=jan(n,33),n.A=jan(n,34),n.C=jan(n,35),n.D=jan(n,36),n.F=jan(n,37),n.G=jan(n,38),n.I=jan(n,39),n.J=jan(n,40),n.L=jan(n,41),n.M=jan(n,42),n.N=jan(n,43),n.O=jan(n,44),n.P=jan(n,45),n.X=jan(n,46),n.Y=jan(n,47),n.Z=jan(n,48),n.$=jan(n,49),n._=jan(n,50),n.cb=jan(n,51),n.K=jan(n,52))}function sWn(){var n,t;sWn=O,eSt=new up(w5n),mPt=new up(d5n),wvn(),iSt=new $O(W2n,rSt=CMt),new $p,cSt=new $O(VJn,null),aSt=new up(g5n),wEn(),fSt=EG(ZMt,Pun(Gk(qPt,1),$Vn,291,0,[VMt])),hSt=new $O(u3n,fSt),lSt=new $O(X2n,(hN(),!1)),Ffn(),bSt=new $O(J2n,wSt=BPt),Mbn(),vSt=new $O(y2n,mSt=ZPt),jSt=new $O(A4n,!1),ufn(),ESt=new $O(d2n,TSt=vCt),WSt=new WA(12),XSt=new $O(QJn,WSt),CSt=new $O(jZn,!1),ISt=new $O(m3n,!1),USt=new $O(MZn,!1),QEn(),uPt=new $O(EZn,oPt=YCt),gPt=new up(g3n),pPt=new up(pZn),vPt=new up(yZn),kPt=new up(kZn),ASt=new km,OSt=new $O(o3n,ASt),sSt=new $O(f3n,!1),MSt=new $O(l3n,!1),new up(p5n),LSt=new lm,$St=new $O(p3n,LSt),zSt=new $O(z2n,!1),new $p,yPt=new $O(v5n,1),new $O(m5n,!0),iln(0),new $O(y5n,iln(100)),new $O(k5n,!1),iln(0),new $O(j5n,iln(4e3)),iln(0),new $O(E5n,iln(400)),new $O(T5n,!1),new $O(M5n,!1),new $O(S5n,!0),new $O(P5n,!1),Fwn(),uSt=new $O(b5n,oSt=eOt),jPt=new $O(L2n,10),EPt=new $O(N2n,10),TPt=new $O(XJn,20),MPt=new $O(x2n,10),SPt=new $O(mZn,2),PPt=new $O(D2n,10),IPt=new $O(R2n,0),OPt=new $O(F2n,5),APt=new $O(K2n,1),$Pt=new $O(_2n,1),LPt=new $O(vZn,20),NPt=new $O(B2n,10),RPt=new $O(H2n,10),CPt=new up(q2n),DPt=new lA,xPt=new $O(v3n,DPt),YSt=new up(d3n),VSt=new $O(w3n,QSt=!1),xSt=new WA(5),NSt=new $O(Z2n,xSt),n$n(),t=BB(Vj(GCt),9),RSt=new YK(t,BB(SR(t,t.length),9),0),DSt=new $O(CZn,RSt),cpn(),ZSt=new $O(e3n,nPt=BCt),ePt=new up(i3n),iPt=new up(r3n),rPt=new up(c3n),tPt=new up(a3n),n=BB(Vj(YIt),9),_St=new YK(n,BB(SR(n,n.length),9),0),KSt=new $O(PZn,_St),GSt=nbn((n_n(),GIt)),qSt=new $O(SZn,GSt),HSt=new xC(0,0),BSt=new $O(BZn,HSt),FSt=new $O(Y2n,!1),Rtn(),gSt=new $O(s3n,pSt=zPt),dSt=new $O(TZn,!1),new up(C5n),iln(1),new $O(I5n,null),cPt=new up(b3n),sPt=new up(h3n),kUn(),wPt=new $O(U2n,dPt=PIt),aPt=new up(G2n),lIn(),lPt=nbn(rIt),fPt=new $O(IZn,lPt),hPt=new $O(n3n,!1),bPt=new $O(t3n,!0),SSt=new $O(V2n,!1),PSt=new $O(Q2n,!1),ySt=new $O(WJn,1),nMn(),new $O(O5n,kSt=aCt),JSt=!0}function hWn(){var n,t;hWn=O,dlt=new up(OZn),Fft=new up("coordinateOrigin"),Mlt=new up("processors"),_ft=new iR("compoundNode",(hN(),!1)),elt=new iR("insideConnections",!1),glt=new up("originalBendpoints"),plt=new up("originalDummyNodePosition"),vlt=new up("originalLabelEdge"),Plt=new up("representedLabels"),zft=new up("endLabels"),Uft=new up("endLabel.origin"),ult=new iR("labelSide",(Xyn(),MCt)),blt=new iR("maxEdgeThickness",0),Clt=new iR("reversed",!1),Slt=new up(AZn),hlt=new iR("longEdgeSource",null),flt=new iR("longEdgeTarget",null),slt=new iR("longEdgeHasLabelDummies",!1),olt=new iR("longEdgeBeforeLabelDummy",!1),Gft=new iR("edgeConstraint",(Jun(),Aht)),rlt=new up("inLayerLayoutUnit"),ilt=new iR("inLayerConstraint",(z7(),Pft)),clt=new iR("inLayerSuccessorConstraint",new Np),alt=new iR("inLayerSuccessorConstraintBetweenNonDummies",!1),Elt=new up("portDummy"),Bft=new iR("crossingHint",iln(0)),Zft=new iR("graphProperties",new YK(t=BB(Vj(Tft),9),BB(SR(t,t.length),9),0)),Qft=new iR("externalPortSide",(kUn(),PIt)),Yft=new iR("externalPortSize",new Gj),Wft=new up("externalPortReplacedDummies"),Vft=new up("externalPortReplacedDummy"),Xft=new iR("externalPortConnections",new YK(n=BB(Vj(FIt),9),BB(SR(n,n.length),9),0)),Tlt=new iR(dJn,0),xft=new up("barycenterAssociates"),Klt=new up("TopSideComments"),Dft=new up("BottomSideComments"),Kft=new up("CommentConnectionPort"),tlt=new iR("inputCollect",!1),klt=new iR("outputCollect",!1),qft=new iR("cyclic",!1),Hft=new up("crossHierarchyMap"),Rlt=new up("targetOffset"),new iR("splineLabelSize",new Gj),Alt=new up("spacings"),jlt=new iR("partitionConstraint",!1),Rft=new up("breakingPoint.info"),xlt=new up("splines.survivingEdge"),Nlt=new up("splines.route.start"),$lt=new up("splines.edgeChain"),ylt=new up("originalPortConstraints"),Olt=new up("selfLoopHolder"),Llt=new up("splines.nsPortY"),wlt=new up("modelOrder"),llt=new up("longEdgeTargetNode"),Jft=new iR(z1n,!1),Ilt=new iR(z1n,!1),nlt=new up("layerConstraints.hiddenNodes"),mlt=new up("layerConstraints.opposidePort"),Dlt=new up("targetNode.modelOrder")}function fWn(){fWn=O,_nn(),Sbt=new $O(U1n,Pbt=Sht),Gbt=new $O(X1n,(hN(),!1)),z2(),Vbt=new $O(W1n,Qbt=Aft),wwt=new $O(V1n,!1),dwt=new $O(Q1n,!0),Ult=new $O(Y1n,!1),U7(),Nwt=new $O(J1n,xwt=Kvt),iln(1),qwt=new $O(Z1n,iln(7)),Gwt=new $O(n0n,!1),zbt=new $O(t0n,!1),Vvn(),Tbt=new $O(e0n,Mbt=yht),TTn(),lwt=new $O(i0n,bwt=tvt),Tbn(),ewt=new $O(r0n,iwt=qlt),iln(-1),twt=new $O(c0n,iln(-1)),iln(-1),rwt=new $O(a0n,iln(-1)),iln(-1),cwt=new $O(u0n,iln(4)),iln(-1),uwt=new $O(o0n,iln(2)),sNn(),hwt=new $O(s0n,fwt=Ivt),iln(0),swt=new $O(h0n,iln(0)),Zbt=new $O(f0n,iln(DWn)),Oin(),jbt=new $O(l0n,Ebt=hht),ubt=new $O(b0n,!1),gbt=new $O(w0n,.1),ybt=new $O(d0n,!1),iln(-1),vbt=new $O(g0n,iln(-1)),iln(-1),mbt=new $O(p0n,iln(-1)),iln(0),obt=new $O(v0n,iln(40)),Kan(),bbt=new $O(m0n,wbt=Eft),sbt=new $O(y0n,hbt=kft),Nvn(),$wt=new $O(k0n,Lwt=gvt),jwt=new up(j0n),g7(),gwt=new $O(E0n,pwt=qht),Bjn(),mwt=new $O(T0n,ywt=Qht),new $p,Mwt=new $O(M0n,.3),Pwt=new up(S0n),bvn(),Cwt=new $O(P0n,Iwt=lvt),Hcn(),Nbt=new $O(C0n,xbt=Wvt),A6(),Dbt=new $O(I0n,Rbt=Zvt),Usn(),Kbt=new $O(O0n,_bt=rmt),Bbt=new $O(A0n,.2),$bt=new $O($0n,2),_wt=new $O(L0n,null),Bwt=new $O(N0n,10),Fwt=new $O(x0n,10),Hwt=new $O(D0n,20),iln(0),Dwt=new $O(R0n,iln(0)),iln(0),Rwt=new $O(K0n,iln(0)),iln(0),Kwt=new $O(_0n,iln(0)),Xlt=new $O(F0n,!1),JMn(),Qlt=new $O(B0n,Ylt=cft),V8(),Wlt=new $O(H0n,Vlt=aht),Xbt=new $O(q0n,!1),iln(0),Ubt=new $O(G0n,iln(16)),iln(0),Wbt=new $O(z0n,iln(5)),$un(),ldt=new $O(U0n,bdt=bmt),zwt=new $O(X0n,10),Wwt=new $O(W0n,1),uin(),edt=new $O(V0n,idt=ght),Ywt=new up(Q0n),ndt=iln(1),iln(0),Zwt=new $O(Y0n,ndt),dcn(),pdt=new $O(J0n,vdt=umt),wdt=new up(Z0n),odt=new $O(n2n,!0),adt=new $O(t2n,2),hdt=new $O(e2n,!0),gSn(),Obt=new $O(i2n,Abt=_ht),$Pn(),Cbt=new $O(r2n,Ibt=Zst),mon(),cbt=new $O(c2n,abt=Nvt),rbt=new $O(a2n,!1),Bfn(),Jlt=new $O(u2n,Zlt=wut),Mhn(),ebt=new $O(o2n,ibt=cvt),nbt=new $O(s2n,0),tbt=new $O(h2n,0),Jbt=jht,Ybt=sht,awt=nvt,owt=nvt,nwt=Ypt,ufn(),pbt=pCt,kbt=hht,dbt=hht,fbt=hht,lbt=pCt,Ewt=mvt,Twt=gvt,vwt=gvt,kwt=gvt,Swt=vvt,Awt=mvt,Owt=mvt,Mbn(),Fbt=JPt,Hbt=JPt,qbt=rmt,Lbt=YPt,Uwt=wmt,Xwt=lmt,Vwt=wmt,Qwt=lmt,rdt=wmt,cdt=lmt,Jwt=dht,tdt=ght,mdt=wmt,ydt=lmt,ddt=wmt,gdt=lmt,sdt=lmt,udt=lmt,fdt=lmt}function lWn(){lWn=O,rot=new nP("DIRECTION_PREPROCESSOR",0),tot=new nP("COMMENT_PREPROCESSOR",1),cot=new nP("EDGE_AND_LAYER_CONSTRAINT_EDGE_REVERSER",2),kot=new nP("INTERACTIVE_EXTERNAL_PORT_POSITIONER",3),Fot=new nP("PARTITION_PREPROCESSOR",4),Mot=new nP("LABEL_DUMMY_INSERTER",5),Uot=new nP("SELF_LOOP_PREPROCESSOR",6),Oot=new nP("LAYER_CONSTRAINT_PREPROCESSOR",7),Kot=new nP("PARTITION_MIDPROCESSOR",8),got=new nP("HIGH_DEGREE_NODE_LAYER_PROCESSOR",9),Not=new nP("NODE_PROMOTION",10),Iot=new nP("LAYER_CONSTRAINT_POSTPROCESSOR",11),_ot=new nP("PARTITION_POSTPROCESSOR",12),lot=new nP("HIERARCHICAL_PORT_CONSTRAINT_PROCESSOR",13),Wot=new nP("SEMI_INTERACTIVE_CROSSMIN_PROCESSOR",14),Vut=new nP("BREAKING_POINT_INSERTER",15),Lot=new nP("LONG_EDGE_SPLITTER",16),Hot=new nP("PORT_SIDE_PROCESSOR",17),jot=new nP("INVERTED_PORT_PROCESSOR",18),Bot=new nP("PORT_LIST_SORTER",19),Qot=new nP("SORT_BY_INPUT_ORDER_OF_MODEL",20),Dot=new nP("NORTH_SOUTH_PORT_PREPROCESSOR",21),Qut=new nP("BREAKING_POINT_PROCESSOR",22),Rot=new nP(E1n,23),Yot=new nP(T1n,24),Got=new nP("SELF_LOOP_PORT_RESTORER",25),Vot=new nP("SINGLE_EDGE_GRAPH_WRAPPER",26),Eot=new nP("IN_LAYER_CONSTRAINT_PROCESSOR",27),sot=new nP("END_NODE_PORT_LABEL_MANAGEMENT_PROCESSOR",28),Tot=new nP("LABEL_AND_NODE_SIZE_PROCESSOR",29),yot=new nP("INNERMOST_NODE_MARGIN_CALCULATOR",30),Xot=new nP("SELF_LOOP_ROUTER",31),Zut=new nP("COMMENT_NODE_MARGIN_CALCULATOR",32),uot=new nP("END_LABEL_PREPROCESSOR",33),Pot=new nP("LABEL_DUMMY_SWITCHER",34),Jut=new nP("CENTER_LABEL_MANAGEMENT_PROCESSOR",35),Cot=new nP("LABEL_SIDE_SELECTOR",36),vot=new nP("HYPEREDGE_DUMMY_MERGER",37),bot=new nP("HIERARCHICAL_PORT_DUMMY_SIZE_PROCESSOR",38),Aot=new nP("LAYER_SIZE_AND_GRAPH_HEIGHT_CALCULATOR",39),dot=new nP("HIERARCHICAL_PORT_POSITION_PROCESSOR",40),eot=new nP("CONSTRAINTS_POSTPROCESSOR",41),not=new nP("COMMENT_POSTPROCESSOR",42),mot=new nP("HYPERNODE_PROCESSOR",43),wot=new nP("HIERARCHICAL_PORT_ORTHOGONAL_EDGE_ROUTER",44),$ot=new nP("LONG_EDGE_JOINER",45),zot=new nP("SELF_LOOP_POSTPROCESSOR",46),Yut=new nP("BREAKING_POINT_REMOVER",47),xot=new nP("NORTH_SOUTH_PORT_POSTPROCESSOR",48),pot=new nP("HORIZONTAL_COMPACTOR",49),Sot=new nP("LABEL_DUMMY_REMOVER",50),hot=new nP("FINAL_SPLINE_BENDPOINTS_CALCULATOR",51),oot=new nP("END_LABEL_SORTER",52),qot=new nP("REVERSED_EDGE_RESTORER",53),aot=new nP("END_LABEL_POSTPROCESSOR",54),fot=new nP("HIERARCHICAL_NODE_RESIZER",55),iot=new nP("DIRECTION_POSTPROCESSOR",56)}function bWn(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T,M,S,P,C,I,O,A,$,L,N,x,D,R,K,_,F,B,H,q,G,z,U,X,W,V,Q,Y,J,Z,nn,tn,en,rn,cn,an,un,on;for(J=0,L=0,D=(O=t).length;L<D;++L)for(G=new Wb((C=O[L]).j);G.a<G.c.c.length;){for(U=0,o=new Wb((q=BB(n0(G),11)).g);o.a<o.c.c.length;)u=BB(n0(o),17),C.c!=u.d.i.c&&++U;U>0&&(n.a[q.p]=J++)}for(rn=0,N=0,R=(A=i).length;N<R;++N){for(K=0,G=new Wb((C=A[N]).j);G.a<G.c.c.length&&(q=BB(n0(G),11)).j==(kUn(),sIt);)for(o=new Wb(q.e);o.a<o.c.c.length;)if(u=BB(n0(o),17),C.c!=u.c.i.c){++K;break}for(F=0,X=new M2(C.j,C.j.c.length);X.b>0;){for(Px(X.b>0),U=0,o=new Wb((q=BB(X.a.Xb(X.c=--X.b),11)).e);o.a<o.c.c.length;)u=BB(n0(o),17),C.c!=u.c.i.c&&++U;U>0&&(q.j==(kUn(),sIt)?(n.a[q.p]=rn,++rn):(n.a[q.p]=rn+K+F,++F))}rn+=F}for(z=new xp,d=new fA,$=0,x=(I=t).length;$<x;++$)for(tn=new Wb((C=I[$]).j);tn.a<tn.c.c.length;)for(o=new Wb((nn=BB(n0(tn),11)).g);o.a<o.c.c.length;)if(an=(u=BB(n0(o),17)).d,C.c!=an.i.c)if(Z=BB(qI(AY(z.f,nn)),467),cn=BB(qI(AY(z.f,an)),467),Z||cn)if(Z)if(cn)if(Z==cn)WB(Z.a,u);else{for(WB(Z.a,u),H=new Wb(cn.d);H.a<H.c.c.length;)B=BB(n0(H),11),jCn(z.f,B,Z);gun(Z.a,cn.a),gun(Z.d,cn.d),d.a.Bc(cn)}else WB(Z.a,u),WB(Z.d,an),jCn(z.f,an,Z);else WB(cn.a,u),WB(cn.d,nn),jCn(z.f,nn,cn);else w=new DR,d.a.zc(w,d),WB(w.a,u),WB(w.d,nn),jCn(z.f,nn,w),WB(w.d,an),jCn(z.f,an,w);for(g=BB(Emn(d,x8(Fmt,{3:1,4:1,5:1,1946:1},467,d.a.gc(),0,1)),1946),P=t[0].c,Y=i[0].c,l=0,b=(f=g).length;l<b;++l)for((h=f[l]).e=J,h.f=rn,G=new Wb(h.d);G.a<G.c.c.length;)q=BB(n0(G),11),W=n.a[q.p],q.i.c==P?(W<h.e&&(h.e=W),W>h.b&&(h.b=W)):q.i.c==Y&&(W<h.f&&(h.f=W),W>h.c&&(h.c=W));for(z9(g,0,g.length,null),en=x8(ANt,hQn,25,g.length,15,1),r=x8(ANt,hQn,25,rn+1,15,1),v=0;v<g.length;v++)en[v]=g[v].f,r[en[v]]=1;for(a=0,m=0;m<r.length;m++)1==r[m]?r[m]=a:--a;for(V=0,y=0;y<en.length;y++)en[y]+=r[en[y]],V=e.Math.max(V,en[y]+1);for(s=1;s<V;)s*=2;for(on=2*s-1,s-=1,un=x8(ANt,hQn,25,on,15,1),c=0,M=0;M<en.length;M++)for(++un[T=en[M]+s];T>0;)T%2>0&&(c+=un[T+1]),++un[T=(T-1)/2|0];for(S=x8(qmt,HWn,362,2*g.length,0,1),k=0;k<g.length;k++)S[2*k]=new qV(g[k],g[k].e,g[k].b,(Q4(),Hmt)),S[2*k+1]=new qV(g[k],g[k].b,g[k].e,Bmt);for(z9(S,0,S.length,null),_=0,j=0;j<S.length;j++)switch(S[j].d.g){case 0:++_;break;case 1:c+=--_}for(Q=x8(qmt,HWn,362,2*g.length,0,1),E=0;E<g.length;E++)Q[2*E]=new qV(g[E],g[E].f,g[E].c,(Q4(),Hmt)),Q[2*E+1]=new qV(g[E],g[E].c,g[E].f,Bmt);for(z9(Q,0,Q.length,null),_=0,p=0;p<Q.length;p++)switch(Q[p].d.g){case 0:++_;break;case 1:c+=--_}return c}function wWn(){wWn=O,sNt=new Ap(7),hNt=new oG(8,94),new oG(8,64),fNt=new oG(8,36),pNt=new oG(8,65),vNt=new oG(8,122),mNt=new oG(8,90),jNt=new oG(8,98),dNt=new oG(8,66),yNt=new oG(8,60),ENt=new oG(8,62),oNt=new Ap(11),Yxn(uNt=new M0(4),48,57),Yxn(kNt=new M0(4),48,57),Yxn(kNt,65,90),Yxn(kNt,95,95),Yxn(kNt,97,122),Yxn(gNt=new M0(4),9,9),Yxn(gNt,10,10),Yxn(gNt,12,12),Yxn(gNt,13,13),Yxn(gNt,32,32),lNt=$Fn(uNt),wNt=$Fn(kNt),bNt=$Fn(gNt),iNt=new xp,rNt=new xp,cNt=Pun(Gk(Qtt,1),sVn,2,6,["Cn","Lu","Ll","Lt","Lm","Lo","Mn","Me","Mc","Nd","Nl","No","Zs","Zl","Zp","Cc","Cf",null,"Co","Cs","Pd","Ps","Pe","Pc","Po","Sm","Sc","Sk","So","Pi","Pf","L","M","N","Z","C","P","S"]),eNt=Pun(Gk(Qtt,1),sVn,2,6,["Basic Latin","Latin-1 Supplement","Latin Extended-A","Latin Extended-B","IPA Extensions","Spacing Modifier Letters","Combining Diacritical Marks","Greek","Cyrillic","Armenian","Hebrew","Arabic","Syriac","Thaana","Devanagari","Bengali","Gurmukhi","Gujarati","Oriya","Tamil","Telugu","Kannada","Malayalam","Sinhala","Thai","Lao","Tibetan","Myanmar","Georgian","Hangul Jamo","Ethiopic","Cherokee","Unified Canadian Aboriginal Syllabics","Ogham","Runic","Khmer","Mongolian","Latin Extended Additional","Greek Extended","General Punctuation","Superscripts and Subscripts","Currency Symbols","Combining Marks for Symbols","Letterlike Symbols","Number Forms","Arrows","Mathematical Operators","Miscellaneous Technical","Control Pictures","Optical Character Recognition","Enclosed Alphanumerics","Box Drawing","Block Elements","Geometric Shapes","Miscellaneous Symbols","Dingbats","Braille Patterns","CJK Radicals Supplement","Kangxi Radicals","Ideographic Description Characters","CJK Symbols and Punctuation","Hiragana","Katakana","Bopomofo","Hangul Compatibility Jamo","Kanbun","Bopomofo Extended","Enclosed CJK Letters and Months","CJK Compatibility","CJK Unified Ideographs Extension A","CJK Unified Ideographs","Yi Syllables","Yi Radicals","Hangul Syllables",gnt,"CJK Compatibility Ideographs","Alphabetic Presentation Forms","Arabic Presentation Forms-A","Combining Half Marks","CJK Compatibility Forms","Small Form Variants","Arabic Presentation Forms-B","Specials","Halfwidth and Fullwidth Forms","Old Italic","Gothic","Deseret","Byzantine Musical Symbols","Musical Symbols","Mathematical Alphanumeric Symbols","CJK Unified Ideographs Extension B","CJK Compatibility Ideographs Supplement","Tags"]),aNt=Pun(Gk(ANt,1),hQn,25,15,[66304,66351,66352,66383,66560,66639,118784,119039,119040,119295,119808,120831,131072,173782,194560,195103,917504,917631])}function dWn(){dWn=O,Prt=new ocn("OUT_T_L",0,(J9(),Yit),(G7(),irt),(Dtn(),Git),Git,Pun(Gk(Dnt,1),HWn,21,0,[EG((n$n(),LCt),Pun(Gk(GCt,1),$Vn,93,0,[DCt,ICt]))])),Srt=new ocn("OUT_T_C",1,Qit,irt,Git,zit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[DCt,CCt])),EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[DCt,CCt,OCt]))])),Crt=new ocn("OUT_T_R",2,Jit,irt,Git,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[DCt,ACt]))])),vrt=new ocn("OUT_B_L",3,Yit,crt,Uit,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[NCt,ICt]))])),prt=new ocn("OUT_B_C",4,Qit,crt,Uit,zit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[NCt,CCt])),EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[NCt,CCt,OCt]))])),mrt=new ocn("OUT_B_R",5,Jit,crt,Uit,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[NCt,ACt]))])),jrt=new ocn("OUT_L_T",6,Jit,crt,Git,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ICt,DCt,OCt]))])),krt=new ocn("OUT_L_C",7,Jit,rrt,zit,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ICt,xCt])),EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ICt,xCt,OCt]))])),yrt=new ocn("OUT_L_B",8,Jit,irt,Uit,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ICt,NCt,OCt]))])),Mrt=new ocn("OUT_R_T",9,Yit,crt,Git,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ACt,DCt,OCt]))])),Trt=new ocn("OUT_R_C",10,Yit,rrt,zit,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ACt,xCt])),EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ACt,xCt,OCt]))])),Ert=new ocn("OUT_R_B",11,Yit,irt,Uit,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG(LCt,Pun(Gk(GCt,1),$Vn,93,0,[ACt,NCt,OCt]))])),drt=new ocn("IN_T_L",12,Yit,crt,Git,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[DCt,ICt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[DCt,ICt,OCt]))])),wrt=new ocn("IN_T_C",13,Qit,crt,Git,zit,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[DCt,CCt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[DCt,CCt,OCt]))])),grt=new ocn("IN_T_R",14,Jit,crt,Git,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[DCt,ACt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[DCt,ACt,OCt]))])),lrt=new ocn("IN_C_L",15,Yit,rrt,zit,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[xCt,ICt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[xCt,ICt,OCt]))])),frt=new ocn("IN_C_C",16,Qit,rrt,zit,zit,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[xCt,CCt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[xCt,CCt,OCt]))])),brt=new ocn("IN_C_R",17,Jit,rrt,zit,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[xCt,ACt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[xCt,ACt,OCt]))])),srt=new ocn("IN_B_L",18,Yit,irt,Uit,Git,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[NCt,ICt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[NCt,ICt,OCt]))])),ort=new ocn("IN_B_C",19,Qit,irt,Uit,zit,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[NCt,CCt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[NCt,CCt,OCt]))])),hrt=new ocn("IN_B_R",20,Jit,irt,Uit,Uit,Pun(Gk(Dnt,1),HWn,21,0,[EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[NCt,ACt])),EG($Ct,Pun(Gk(GCt,1),$Vn,93,0,[NCt,ACt,OCt]))])),Irt=new ocn(hJn,21,null,null,null,null,Pun(Gk(Dnt,1),HWn,21,0,[]))}function gWn(){gWn=O,i$t=(QX(),t$t).b,BB(Wtn(QQ(t$t.b),0),34),BB(Wtn(QQ(t$t.b),1),18),e$t=t$t.a,BB(Wtn(QQ(t$t.a),0),34),BB(Wtn(QQ(t$t.a),1),18),BB(Wtn(QQ(t$t.a),2),18),BB(Wtn(QQ(t$t.a),3),18),BB(Wtn(QQ(t$t.a),4),18),r$t=t$t.o,BB(Wtn(QQ(t$t.o),0),34),BB(Wtn(QQ(t$t.o),1),34),a$t=BB(Wtn(QQ(t$t.o),2),18),BB(Wtn(QQ(t$t.o),3),18),BB(Wtn(QQ(t$t.o),4),18),BB(Wtn(QQ(t$t.o),5),18),BB(Wtn(QQ(t$t.o),6),18),BB(Wtn(QQ(t$t.o),7),18),BB(Wtn(QQ(t$t.o),8),18),BB(Wtn(QQ(t$t.o),9),18),BB(Wtn(QQ(t$t.o),10),18),BB(Wtn(QQ(t$t.o),11),18),BB(Wtn(QQ(t$t.o),12),18),BB(Wtn(QQ(t$t.o),13),18),BB(Wtn(QQ(t$t.o),14),18),BB(Wtn(QQ(t$t.o),15),18),BB(Wtn(VQ(t$t.o),0),59),BB(Wtn(VQ(t$t.o),1),59),BB(Wtn(VQ(t$t.o),2),59),BB(Wtn(VQ(t$t.o),3),59),BB(Wtn(VQ(t$t.o),4),59),BB(Wtn(VQ(t$t.o),5),59),BB(Wtn(VQ(t$t.o),6),59),BB(Wtn(VQ(t$t.o),7),59),BB(Wtn(VQ(t$t.o),8),59),BB(Wtn(VQ(t$t.o),9),59),c$t=t$t.p,BB(Wtn(QQ(t$t.p),0),34),BB(Wtn(QQ(t$t.p),1),34),BB(Wtn(QQ(t$t.p),2),34),BB(Wtn(QQ(t$t.p),3),34),BB(Wtn(QQ(t$t.p),4),18),BB(Wtn(QQ(t$t.p),5),18),BB(Wtn(VQ(t$t.p),0),59),BB(Wtn(VQ(t$t.p),1),59),u$t=t$t.q,BB(Wtn(QQ(t$t.q),0),34),o$t=t$t.v,BB(Wtn(QQ(t$t.v),0),18),BB(Wtn(VQ(t$t.v),0),59),BB(Wtn(VQ(t$t.v),1),59),BB(Wtn(VQ(t$t.v),2),59),s$t=t$t.w,BB(Wtn(QQ(t$t.w),0),34),BB(Wtn(QQ(t$t.w),1),34),BB(Wtn(QQ(t$t.w),2),34),BB(Wtn(QQ(t$t.w),3),18),h$t=t$t.B,BB(Wtn(QQ(t$t.B),0),18),BB(Wtn(VQ(t$t.B),0),59),BB(Wtn(VQ(t$t.B),1),59),BB(Wtn(VQ(t$t.B),2),59),b$t=t$t.Q,BB(Wtn(QQ(t$t.Q),0),18),BB(Wtn(VQ(t$t.Q),0),59),w$t=t$t.R,BB(Wtn(QQ(t$t.R),0),34),d$t=t$t.S,BB(Wtn(VQ(t$t.S),0),59),BB(Wtn(VQ(t$t.S),1),59),BB(Wtn(VQ(t$t.S),2),59),BB(Wtn(VQ(t$t.S),3),59),BB(Wtn(VQ(t$t.S),4),59),BB(Wtn(VQ(t$t.S),5),59),BB(Wtn(VQ(t$t.S),6),59),BB(Wtn(VQ(t$t.S),7),59),BB(Wtn(VQ(t$t.S),8),59),BB(Wtn(VQ(t$t.S),9),59),BB(Wtn(VQ(t$t.S),10),59),BB(Wtn(VQ(t$t.S),11),59),BB(Wtn(VQ(t$t.S),12),59),BB(Wtn(VQ(t$t.S),13),59),BB(Wtn(VQ(t$t.S),14),59),g$t=t$t.T,BB(Wtn(QQ(t$t.T),0),18),BB(Wtn(QQ(t$t.T),2),18),p$t=BB(Wtn(QQ(t$t.T),3),18),BB(Wtn(QQ(t$t.T),4),18),BB(Wtn(VQ(t$t.T),0),59),BB(Wtn(VQ(t$t.T),1),59),BB(Wtn(QQ(t$t.T),1),18),v$t=t$t.U,BB(Wtn(QQ(t$t.U),0),34),BB(Wtn(QQ(t$t.U),1),34),BB(Wtn(QQ(t$t.U),2),18),BB(Wtn(QQ(t$t.U),3),18),BB(Wtn(QQ(t$t.U),4),18),BB(Wtn(QQ(t$t.U),5),18),BB(Wtn(VQ(t$t.U),0),59),m$t=t$t.V,BB(Wtn(QQ(t$t.V),0),18),y$t=t$t.W,BB(Wtn(QQ(t$t.W),0),34),BB(Wtn(QQ(t$t.W),1),34),BB(Wtn(QQ(t$t.W),2),34),BB(Wtn(QQ(t$t.W),3),18),BB(Wtn(QQ(t$t.W),4),18),BB(Wtn(QQ(t$t.W),5),18),j$t=t$t.bb,BB(Wtn(QQ(t$t.bb),0),34),BB(Wtn(QQ(t$t.bb),1),34),BB(Wtn(QQ(t$t.bb),2),34),BB(Wtn(QQ(t$t.bb),3),34),BB(Wtn(QQ(t$t.bb),4),34),BB(Wtn(QQ(t$t.bb),5),34),BB(Wtn(QQ(t$t.bb),6),34),BB(Wtn(QQ(t$t.bb),7),18),BB(Wtn(VQ(t$t.bb),0),59),BB(Wtn(VQ(t$t.bb),1),59),E$t=t$t.eb,BB(Wtn(QQ(t$t.eb),0),34),BB(Wtn(QQ(t$t.eb),1),34),BB(Wtn(QQ(t$t.eb),2),34),BB(Wtn(QQ(t$t.eb),3),34),BB(Wtn(QQ(t$t.eb),4),34),BB(Wtn(QQ(t$t.eb),5),34),BB(Wtn(QQ(t$t.eb),6),18),BB(Wtn(QQ(t$t.eb),7),18),k$t=t$t.ab,BB(Wtn(QQ(t$t.ab),0),34),BB(Wtn(QQ(t$t.ab),1),34),f$t=t$t.H,BB(Wtn(QQ(t$t.H),0),18),BB(Wtn(QQ(t$t.H),1),18),BB(Wtn(QQ(t$t.H),2),18),BB(Wtn(QQ(t$t.H),3),18),BB(Wtn(QQ(t$t.H),4),18),BB(Wtn(QQ(t$t.H),5),18),BB(Wtn(VQ(t$t.H),0),59),T$t=t$t.db,BB(Wtn(QQ(t$t.db),0),18),l$t=t$t.M}function pWn(n){var t;n.O||(n.O=!0,Nrn(n,"type"),xrn(n,"ecore.xml.type"),Drn(n,S7n),t=BB($$n((WM(),zAt),S7n),1945),f9(kY(n.fb),n.b),z0(n.b,wLt,"AnyType",!1,!1,!0),ucn(BB(Wtn(QQ(n.b),0),34),n.wb.D,K9n,null,0,-1,wLt,!1,!1,!0,!1,!1,!1),ucn(BB(Wtn(QQ(n.b),1),34),n.wb.D,"any",null,0,-1,wLt,!0,!0,!0,!1,!1,!0),ucn(BB(Wtn(QQ(n.b),2),34),n.wb.D,"anyAttribute",null,0,-1,wLt,!1,!1,!0,!1,!1,!1),z0(n.bb,zLt,A7n,!1,!1,!0),ucn(BB(Wtn(QQ(n.bb),0),34),n.gb,"data",null,0,1,zLt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.bb),1),34),n.gb,Y6n,null,1,1,zLt,!1,!1,!0,!1,!0,!1),z0(n.fb,ULt,$7n,!1,!1,!0),ucn(BB(Wtn(QQ(n.fb),0),34),t.gb,"rawValue",null,0,1,ULt,!0,!0,!0,!1,!0,!0),ucn(BB(Wtn(QQ(n.fb),1),34),t.a,E6n,null,0,1,ULt,!0,!0,!0,!1,!0,!0),Myn(BB(Wtn(QQ(n.fb),2),18),n.wb.q,null,"instanceType",1,1,ULt,!1,!1,!0,!1,!1,!1,!1),z0(n.qb,XLt,L7n,!1,!1,!0),ucn(BB(Wtn(QQ(n.qb),0),34),n.wb.D,K9n,null,0,-1,null,!1,!1,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.qb),1),18),n.wb.ab,null,"xMLNSPrefixMap",0,-1,null,!0,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.qb),2),18),n.wb.ab,null,"xSISchemaLocation",0,-1,null,!0,!1,!0,!0,!1,!1,!1),ucn(BB(Wtn(QQ(n.qb),3),34),n.gb,"cDATA",null,0,-2,null,!0,!0,!0,!1,!1,!0),ucn(BB(Wtn(QQ(n.qb),4),34),n.gb,"comment",null,0,-2,null,!0,!0,!0,!1,!1,!0),Myn(BB(Wtn(QQ(n.qb),5),18),n.bb,null,cnt,0,-2,null,!0,!0,!0,!0,!1,!1,!0),ucn(BB(Wtn(QQ(n.qb),6),34),n.gb,O6n,null,0,-2,null,!0,!0,!0,!1,!1,!0),dV(n.a,Ant,"AnySimpleType",!0),dV(n.c,Qtt,"AnyURI",!0),dV(n.d,Gk(NNt,1),"Base64Binary",!0),dV(n.e,$Nt,"Boolean",!0),dV(n.f,ktt,"BooleanObject",!0),dV(n.g,NNt,"Byte",!0),dV(n.i,Ttt,"ByteObject",!0),dV(n.j,Qtt,"Date",!0),dV(n.k,Qtt,"DateTime",!0),dV(n.n,iet,"Decimal",!0),dV(n.o,xNt,"Double",!0),dV(n.p,Ptt,"DoubleObject",!0),dV(n.q,Qtt,"Duration",!0),dV(n.s,Rnt,"ENTITIES",!0),dV(n.r,Rnt,"ENTITIESBase",!0),dV(n.t,Qtt,_7n,!0),dV(n.u,DNt,"Float",!0),dV(n.v,Ctt,"FloatObject",!0),dV(n.w,Qtt,"GDay",!0),dV(n.B,Qtt,"GMonth",!0),dV(n.A,Qtt,"GMonthDay",!0),dV(n.C,Qtt,"GYear",!0),dV(n.D,Qtt,"GYearMonth",!0),dV(n.F,Gk(NNt,1),"HexBinary",!0),dV(n.G,Qtt,"ID",!0),dV(n.H,Qtt,"IDREF",!0),dV(n.J,Rnt,"IDREFS",!0),dV(n.I,Rnt,"IDREFSBase",!0),dV(n.K,ANt,"Int",!0),dV(n.M,oet,"Integer",!0),dV(n.L,Att,"IntObject",!0),dV(n.P,Qtt,"Language",!0),dV(n.Q,LNt,"Long",!0),dV(n.R,Rtt,"LongObject",!0),dV(n.S,Qtt,"Name",!0),dV(n.T,Qtt,F7n,!0),dV(n.U,oet,"NegativeInteger",!0),dV(n.V,Qtt,Q7n,!0),dV(n.X,Rnt,"NMTOKENS",!0),dV(n.W,Rnt,"NMTOKENSBase",!0),dV(n.Y,oet,"NonNegativeInteger",!0),dV(n.Z,oet,"NonPositiveInteger",!0),dV(n.$,Qtt,"NormalizedString",!0),dV(n._,Qtt,"NOTATION",!0),dV(n.ab,Qtt,"PositiveInteger",!0),dV(n.cb,Qtt,"QName",!0),dV(n.db,RNt,"Short",!0),dV(n.eb,_tt,"ShortObject",!0),dV(n.gb,Qtt,qVn,!0),dV(n.hb,Qtt,"Time",!0),dV(n.ib,Qtt,"Token",!0),dV(n.jb,RNt,"UnsignedByte",!0),dV(n.kb,_tt,"UnsignedByteObject",!0),dV(n.lb,LNt,"UnsignedInt",!0),dV(n.mb,Rtt,"UnsignedIntObject",!0),dV(n.nb,oet,"UnsignedLong",!0),dV(n.ob,ANt,"UnsignedShort",!0),dV(n.pb,Att,"UnsignedShortObject",!0),Lhn(n,S7n),yWn(n))}function vWn(n){NM(n,new MTn(mj(dj(vj(wj(pj(gj(new du,w1n),"ELK Layered"),"Layer-based algorithm provided by the Eclipse Layout Kernel. Arranges as many edges as possible into one direction by placing nodes into subsequent layers. This implementation supports different routing styles (straight, orthogonal, splines); if orthogonal routing is selected, arbitrary port constraints are respected, thus enabling the layout of block diagrams such as actor-oriented models or circuit schematics. Furthermore, full layout of compound graphs with cross-hierarchy edges is supported when the respective option is activated on the top level."),new Cc),w1n),EG((hAn(),iAt),Pun(Gk(aAt,1),$Vn,237,0,[nAt,tAt,ZOt,eAt,YOt,QOt]))))),u2(n,w1n,L2n,mpn(ppt)),u2(n,w1n,N2n,mpn(vpt)),u2(n,w1n,XJn,mpn(mpt)),u2(n,w1n,x2n,mpn(ypt)),u2(n,w1n,mZn,mpn(jpt)),u2(n,w1n,D2n,mpn(Ept)),u2(n,w1n,R2n,mpn(Spt)),u2(n,w1n,K2n,mpn(Cpt)),u2(n,w1n,_2n,mpn(Ipt)),u2(n,w1n,F2n,mpn(Ppt)),u2(n,w1n,vZn,mpn(Opt)),u2(n,w1n,B2n,mpn($pt)),u2(n,w1n,H2n,mpn(Npt)),u2(n,w1n,q2n,mpn(Mpt)),u2(n,w1n,L0n,mpn(gpt)),u2(n,w1n,x0n,mpn(kpt)),u2(n,w1n,N0n,mpn(Tpt)),u2(n,w1n,D0n,mpn(Apt)),u2(n,w1n,pZn,iln(0)),u2(n,w1n,R0n,mpn(fpt)),u2(n,w1n,K0n,mpn(lpt)),u2(n,w1n,_0n,mpn(bpt)),u2(n,w1n,U0n,mpn(zpt)),u2(n,w1n,X0n,mpn(Rpt)),u2(n,w1n,W0n,mpn(Kpt)),u2(n,w1n,V0n,mpn(Bpt)),u2(n,w1n,Q0n,mpn(_pt)),u2(n,w1n,Y0n,mpn(Fpt)),u2(n,w1n,J0n,mpn(Xpt)),u2(n,w1n,Z0n,mpn(Upt)),u2(n,w1n,n2n,mpn(qpt)),u2(n,w1n,t2n,mpn(Hpt)),u2(n,w1n,e2n,mpn(Gpt)),u2(n,w1n,S0n,mpn(Rgt)),u2(n,w1n,P0n,mpn(Kgt)),u2(n,w1n,O0n,mpn(rgt)),u2(n,w1n,A0n,mpn(cgt)),u2(n,w1n,QJn,Ugt),u2(n,w1n,y2n,ngt),u2(n,w1n,G2n,0),u2(n,w1n,yZn,iln(1)),u2(n,w1n,VJn,dZn),u2(n,w1n,z2n,mpn(Ggt)),u2(n,w1n,EZn,mpn(ept)),u2(n,w1n,U2n,mpn(upt)),u2(n,w1n,X2n,mpn(zdt)),u2(n,w1n,W2n,mpn(kdt)),u2(n,w1n,d2n,mpn(sgt)),u2(n,w1n,kZn,(hN(),!0)),u2(n,w1n,V2n,mpn(wgt)),u2(n,w1n,Q2n,mpn(dgt)),u2(n,w1n,PZn,mpn(Fgt)),u2(n,w1n,SZn,mpn(qgt)),u2(n,w1n,Y2n,mpn(Bgt)),u2(n,w1n,J2n,Wdt),u2(n,w1n,CZn,mpn($gt)),u2(n,w1n,Z2n,mpn(Agt)),u2(n,w1n,IZn,mpn(cpt)),u2(n,w1n,n3n,mpn(rpt)),u2(n,w1n,t3n,mpn(apt)),u2(n,w1n,e3n,Vgt),u2(n,w1n,i3n,mpn(Ygt)),u2(n,w1n,r3n,mpn(Jgt)),u2(n,w1n,c3n,mpn(Zgt)),u2(n,w1n,a3n,mpn(Qgt)),u2(n,w1n,n0n,mpn(Dpt)),u2(n,w1n,i0n,mpn(Pgt)),u2(n,w1n,s0n,mpn(Sgt)),u2(n,w1n,Z1n,mpn(xpt)),u2(n,w1n,r0n,mpn(kgt)),u2(n,w1n,e0n,mpn(Gdt)),u2(n,w1n,l0n,mpn(qdt)),u2(n,w1n,b0n,mpn(xdt)),u2(n,w1n,v0n,mpn(Ddt)),u2(n,w1n,m0n,mpn(Kdt)),u2(n,w1n,y0n,mpn(Rdt)),u2(n,w1n,d0n,mpn(Hdt)),u2(n,w1n,V1n,mpn(Igt)),u2(n,w1n,Q1n,mpn(Ogt)),u2(n,w1n,W1n,mpn(pgt)),u2(n,w1n,k0n,mpn(_gt)),u2(n,w1n,T0n,mpn(Ngt)),u2(n,w1n,X1n,mpn(ugt)),u2(n,w1n,M0n,mpn(Dgt)),u2(n,w1n,C0n,mpn(egt)),u2(n,w1n,I0n,mpn(igt)),u2(n,w1n,u3n,mpn(Ndt)),u2(n,w1n,E0n,mpn(Lgt)),u2(n,w1n,B0n,mpn(Pdt)),u2(n,w1n,H0n,mpn(Sdt)),u2(n,w1n,F0n,mpn(Mdt)),u2(n,w1n,q0n,mpn(fgt)),u2(n,w1n,G0n,mpn(hgt)),u2(n,w1n,z0n,mpn(lgt)),u2(n,w1n,BZn,mpn(Hgt)),u2(n,w1n,o3n,mpn(vgt)),u2(n,w1n,WJn,mpn(agt)),u2(n,w1n,s3n,mpn(Ydt)),u2(n,w1n,TZn,mpn(Qdt)),u2(n,w1n,w0n,mpn(_dt)),u2(n,w1n,h3n,mpn(ipt)),u2(n,w1n,f3n,mpn(Tdt)),u2(n,w1n,l3n,mpn(bgt)),u2(n,w1n,b3n,mpn(npt)),u2(n,w1n,w3n,mpn(Xgt)),u2(n,w1n,d3n,mpn(Wgt)),u2(n,w1n,u0n,mpn(Egt)),u2(n,w1n,o0n,mpn(Tgt)),u2(n,w1n,g3n,mpn(spt)),u2(n,w1n,Y1n,mpn(jdt)),u2(n,w1n,h0n,mpn(Mgt)),u2(n,w1n,i2n,mpn(Jdt)),u2(n,w1n,r2n,mpn(Vdt)),u2(n,w1n,p3n,mpn(Cgt)),u2(n,w1n,f0n,mpn(mgt)),u2(n,w1n,j0n,mpn(xgt)),u2(n,w1n,v3n,mpn(Lpt)),u2(n,w1n,U1n,mpn(Xdt)),u2(n,w1n,J1n,mpn(opt)),u2(n,w1n,$0n,mpn(tgt)),u2(n,w1n,c0n,mpn(ygt)),u2(n,w1n,g0n,mpn(Fdt)),u2(n,w1n,m3n,mpn(ggt)),u2(n,w1n,a0n,mpn(jgt)),u2(n,w1n,p0n,mpn(Bdt)),u2(n,w1n,c2n,mpn(Ldt)),u2(n,w1n,o2n,mpn(Adt)),u2(n,w1n,s2n,mpn(Idt)),u2(n,w1n,h2n,mpn(Odt)),u2(n,w1n,a2n,mpn($dt)),u2(n,w1n,u2n,mpn(Cdt)),u2(n,w1n,t0n,mpn(ogt))}function mWn(n,t){var e;return nNt||(nNt=new xp,tNt=new xp,wWn(),wWn(),ydn(e=new M0(4),"\t\n\r\r "),mZ(nNt,fnt,e),mZ(tNt,fnt,$Fn(e)),ydn(e=new M0(4),wnt),mZ(nNt,snt,e),mZ(tNt,snt,$Fn(e)),ydn(e=new M0(4),wnt),mZ(nNt,snt,e),mZ(tNt,snt,$Fn(e)),ydn(e=new M0(4),dnt),sHn(e,BB(SJ(nNt,snt),117)),mZ(nNt,hnt,e),mZ(tNt,hnt,$Fn(e)),ydn(e=new M0(4),"-.0:AZ__az\xb7\xb7\xc0\xd6\xd8\xf6\xf8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u02d0\u02d1\u0300\u0345\u0360\u0361\u0386\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481\u0483\u0486\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9\u0531\u0556\u0559\u0559\u0561\u0586\u0591\u05a1\u05a3\u05b9\u05bb\u05bd\u05bf\u05bf\u05c1\u05c2\u05c4\u05c4\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0640\u0652\u0660\u0669\u0670\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06e8\u06ea\u06ed\u06f0\u06f9\u0901\u0903\u0905\u0939\u093c\u094d\u0951\u0954\u0958\u0963\u0966\u096f\u0981\u0983\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09bc\u09bc\u09be\u09c4\u09c7\u09c8\u09cb\u09cd\u09d7\u09d7\u09dc\u09dd\u09df\u09e3\u09e6\u09f1\u0a02\u0a02\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3c\u0a3e\u0a42\u0a47\u0a48\u0a4b\u0a4d\u0a59\u0a5c\u0a5e\u0a5e\u0a66\u0a74\u0a81\u0a83\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9\u0abc\u0ac5\u0ac7\u0ac9\u0acb\u0acd\u0ae0\u0ae0\u0ae6\u0aef\u0b01\u0b03\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39\u0b3c\u0b43\u0b47\u0b48\u0b4b\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f\u0b61\u0b66\u0b6f\u0b82\u0b83\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd\u0bd7\u0bd7\u0be7\u0bef\u0c01\u0c03\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c3e\u0c44\u0c46\u0c48\u0c4a\u0c4d\u0c55\u0c56\u0c60\u0c61\u0c66\u0c6f\u0c82\u0c83\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cbe\u0cc4\u0cc6\u0cc8\u0cca\u0ccd\u0cd5\u0cd6\u0cde\u0cde\u0ce0\u0ce1\u0ce6\u0cef\u0d02\u0d03\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d3e\u0d43\u0d46\u0d48\u0d4a\u0d4d\u0d57\u0d57\u0d60\u0d61\u0d66\u0d6f\u0e01\u0e2e\u0e30\u0e3a\u0e40\u0e4e\u0e50\u0e59\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb9\u0ebb\u0ebd\u0ec0\u0ec4\u0ec6\u0ec6\u0ec8\u0ecd\u0ed0\u0ed9\u0f18\u0f19\u0f20\u0f29\u0f35\u0f35\u0f37\u0f37\u0f39\u0f39\u0f3e\u0f47\u0f49\u0f69\u0f71\u0f84\u0f86\u0f8b\u0f90\u0f95\u0f97\u0f97\u0f99\u0fad\u0fb1\u0fb7\u0fb9\u0fb9\u10a0\u10c5\u10d0\u10f6\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u20d0\u20dc\u20e1\u20e1\u2126\u2126\u212a\u212b\u212e\u212e\u2180\u2182\u3005\u3005\u3007\u3007\u3021\u302f\u3031\u3035\u3041\u3094\u3099\u309a\u309d\u309e\u30a1\u30fa\u30fc\u30fe\u3105\u312c\u4e00\u9fa5\uac00\ud7a3"),mZ(nNt,lnt,e),mZ(tNt,lnt,$Fn(e)),ydn(e=new M0(4),dnt),Yxn(e,95,95),Yxn(e,58,58),mZ(nNt,bnt,e),mZ(tNt,bnt,$Fn(e))),BB(SJ(t?nNt:tNt,n),136)}function yWn(n){V$n(n.a,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"anySimpleType"])),V$n(n.b,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"anyType",F9n,K9n])),V$n(BB(Wtn(QQ(n.b),0),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,m7n,t8n,":mixed"])),V$n(BB(Wtn(QQ(n.b),1),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,m7n,M7n,P7n,t8n,":1",D7n,"lax"])),V$n(BB(Wtn(QQ(n.b),2),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,p7n,M7n,P7n,t8n,":2",D7n,"lax"])),V$n(n.c,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"anyURI",T7n,y7n])),V$n(n.d,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"base64Binary",T7n,y7n])),V$n(n.e,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,$Wn,T7n,y7n])),V$n(n.f,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"boolean:Object",J9n,$Wn])),V$n(n.g,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,S9n])),V$n(n.i,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"byte:Object",J9n,S9n])),V$n(n.j,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"date",T7n,y7n])),V$n(n.k,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"dateTime",T7n,y7n])),V$n(n.n,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"decimal",T7n,y7n])),V$n(n.o,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,C9n,T7n,y7n])),V$n(n.p,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"double:Object",J9n,C9n])),V$n(n.q,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"duration",T7n,y7n])),V$n(n.s,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"ENTITIES",J9n,R7n,K7n,"1"])),V$n(n.r,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,R7n,k7n,_7n])),V$n(n.t,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,_7n,J9n,F7n])),V$n(n.u,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,I9n,T7n,y7n])),V$n(n.v,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"float:Object",J9n,I9n])),V$n(n.w,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"gDay",T7n,y7n])),V$n(n.B,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"gMonth",T7n,y7n])),V$n(n.A,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"gMonthDay",T7n,y7n])),V$n(n.C,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"gYear",T7n,y7n])),V$n(n.D,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"gYearMonth",T7n,y7n])),V$n(n.F,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"hexBinary",T7n,y7n])),V$n(n.G,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"ID",J9n,F7n])),V$n(n.H,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"IDREF",J9n,F7n])),V$n(n.J,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"IDREFS",J9n,B7n,K7n,"1"])),V$n(n.I,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,B7n,k7n,"IDREF"])),V$n(n.K,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,O9n])),V$n(n.M,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,H7n])),V$n(n.L,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"int:Object",J9n,O9n])),V$n(n.P,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"language",J9n,q7n,G7n,z7n])),V$n(n.Q,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,A9n])),V$n(n.R,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"long:Object",J9n,A9n])),V$n(n.S,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"Name",J9n,q7n,G7n,U7n])),V$n(n.T,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,F7n,J9n,"Name",G7n,X7n])),V$n(n.U,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"negativeInteger",J9n,W7n,V7n,"-1"])),V$n(n.V,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,Q7n,J9n,q7n,G7n,"\\c+"])),V$n(n.X,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"NMTOKENS",J9n,Y7n,K7n,"1"])),V$n(n.W,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,Y7n,k7n,Q7n])),V$n(n.Y,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,J7n,J9n,H7n,Z7n,"0"])),V$n(n.Z,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,W7n,J9n,H7n,V7n,"0"])),V$n(n.$,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,nnt,J9n,NWn,T7n,"replace"])),V$n(n._,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"NOTATION",T7n,y7n])),V$n(n.ab,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"positiveInteger",J9n,J7n,Z7n,"1"])),V$n(n.bb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"processingInstruction_._type",F9n,"empty"])),V$n(BB(Wtn(QQ(n.bb),0),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,g7n,t8n,"data"])),V$n(BB(Wtn(QQ(n.bb),1),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,g7n,t8n,Y6n])),V$n(n.cb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"QName",T7n,y7n])),V$n(n.db,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,$9n])),V$n(n.eb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"short:Object",J9n,$9n])),V$n(n.fb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"simpleAnyType",F9n,d7n])),V$n(BB(Wtn(QQ(n.fb),0),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,":3",F9n,d7n])),V$n(BB(Wtn(QQ(n.fb),1),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,":4",F9n,d7n])),V$n(BB(Wtn(QQ(n.fb),2),18),_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,":5",F9n,d7n])),V$n(n.gb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,NWn,T7n,"preserve"])),V$n(n.hb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"time",T7n,y7n])),V$n(n.ib,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,q7n,J9n,nnt,T7n,y7n])),V$n(n.jb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,tnt,V7n,"255",Z7n,"0"])),V$n(n.kb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"unsignedByte:Object",J9n,tnt])),V$n(n.lb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,ent,V7n,"4294967295",Z7n,"0"])),V$n(n.mb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"unsignedInt:Object",J9n,ent])),V$n(n.nb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"unsignedLong",J9n,J7n,V7n,int,Z7n,"0"])),V$n(n.ob,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,rnt,V7n,"65535",Z7n,"0"])),V$n(n.pb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"unsignedShort:Object",J9n,rnt])),V$n(n.qb,_9n,Pun(Gk(Qtt,1),sVn,2,6,[t8n,"",F9n,K9n])),V$n(BB(Wtn(QQ(n.qb),0),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,m7n,t8n,":mixed"])),V$n(BB(Wtn(QQ(n.qb),1),18),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,g7n,t8n,"xmlns:prefix"])),V$n(BB(Wtn(QQ(n.qb),2),18),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,g7n,t8n,"xsi:schemaLocation"])),V$n(BB(Wtn(QQ(n.qb),3),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,v7n,t8n,"cDATA",j7n,E7n])),V$n(BB(Wtn(QQ(n.qb),4),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,v7n,t8n,"comment",j7n,E7n])),V$n(BB(Wtn(QQ(n.qb),5),18),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,v7n,t8n,cnt,j7n,E7n])),V$n(BB(Wtn(QQ(n.qb),6),34),_9n,Pun(Gk(Qtt,1),sVn,2,6,[F9n,v7n,t8n,O6n,j7n,E7n]))}function kWn(n){return mK("_UI_EMFDiagnostic_marker",n)?"EMF Problem":mK("_UI_CircularContainment_diagnostic",n)?"An object may not circularly contain itself":mK(w8n,n)?"Wrong character.":mK(d8n,n)?"Invalid reference number.":mK(g8n,n)?"A character is required after \\.":mK(p8n,n)?"'?' is not expected. '(?:' or '(?=' or '(?!' or '(?<' or '(?#' or '(?>'?":mK(v8n,n)?"'(?<' or '(?<!' is expected.":mK(m8n,n)?"A comment is not terminated.":mK(y8n,n)?"')' is expected.":mK(k8n,n)?"Unexpected end of the pattern in a modifier group.":mK(j8n,n)?"':' is expected.":mK(E8n,n)?"Unexpected end of the pattern in a conditional group.":mK(T8n,n)?"A back reference or an anchor or a lookahead or a look-behind is expected in a conditional pattern.":mK(M8n,n)?"There are more than three choices in a conditional group.":mK(S8n,n)?"A character in U+0040-U+005f must follow \\c.":mK(P8n,n)?"A '{' is required before a character category.":mK(C8n,n)?"A property name is not closed by '}'.":mK(I8n,n)?"Unexpected meta character.":mK(O8n,n)?"Unknown property.":mK(A8n,n)?"A POSIX character class must be closed by ':]'.":mK($8n,n)?"Unexpected end of the pattern in a character class.":mK(L8n,n)?"Unknown name for a POSIX character class.":mK("parser.cc.4",n)?"'-' is invalid here.":mK(N8n,n)?"']' is expected.":mK(x8n,n)?"'[' is invalid in a character class. Write '\\['.":mK(D8n,n)?"']' is invalid in a character class. Write '\\]'.":mK(R8n,n)?"'-' is an invalid character range. Write '\\-'.":mK(K8n,n)?"'[' is expected.":mK(_8n,n)?"')' or '-[' or '+[' or '&[' is expected.":mK(F8n,n)?"The range end code point is less than the start code point.":mK(B8n,n)?"Invalid Unicode hex notation.":mK(H8n,n)?"Overflow in a hex notation.":mK(q8n,n)?"'\\x{' must be closed by '}'.":mK(G8n,n)?"Invalid Unicode code point.":mK(z8n,n)?"An anchor must not be here.":mK(U8n,n)?"This expression is not supported in the current option setting.":mK(X8n,n)?"Invalid quantifier. A digit is expected.":mK(W8n,n)?"Invalid quantifier. Invalid quantity or a '}' is missing.":mK(V8n,n)?"Invalid quantifier. A digit or '}' is expected.":mK(Q8n,n)?"Invalid quantifier. A min quantity must be <= a max quantity.":mK(Y8n,n)?"Invalid quantifier. A quantity value overflow.":mK("_UI_PackageRegistry_extensionpoint",n)?"Ecore Package Registry for Generated Packages":mK("_UI_DynamicPackageRegistry_extensionpoint",n)?"Ecore Package Registry for Dynamic Packages":mK("_UI_FactoryRegistry_extensionpoint",n)?"Ecore Factory Override Registry":mK("_UI_URIExtensionParserRegistry_extensionpoint",n)?"URI Extension Parser Registry":mK("_UI_URIProtocolParserRegistry_extensionpoint",n)?"URI Protocol Parser Registry":mK("_UI_URIContentParserRegistry_extensionpoint",n)?"URI Content Parser Registry":mK("_UI_ContentHandlerRegistry_extensionpoint",n)?"Content Handler Registry":mK("_UI_URIMappingRegistry_extensionpoint",n)?"URI Converter Mapping Registry":mK("_UI_PackageRegistryImplementation_extensionpoint",n)?"Ecore Package Registry Implementation":mK("_UI_ValidationDelegateRegistry_extensionpoint",n)?"Validation Delegate Registry":mK("_UI_SettingDelegateRegistry_extensionpoint",n)?"Feature Setting Delegate Factory Registry":mK("_UI_InvocationDelegateRegistry_extensionpoint",n)?"Operation Invocation Delegate Factory Registry":mK("_UI_EClassInterfaceNotAbstract_diagnostic",n)?"A class that is an interface must also be abstract":mK("_UI_EClassNoCircularSuperTypes_diagnostic",n)?"A class may not be a super type of itself":mK("_UI_EClassNotWellFormedMapEntryNoInstanceClassName_diagnostic",n)?"A class that inherits from a map entry class must have instance class name 'java.util.Map$Entry'":mK("_UI_EReferenceOppositeOfOppositeInconsistent_diagnostic",n)?"The opposite of the opposite may not be a reference different from this one":mK("_UI_EReferenceOppositeNotFeatureOfType_diagnostic",n)?"The opposite must be a feature of the reference's type":mK("_UI_EReferenceTransientOppositeNotTransient_diagnostic",n)?"The opposite of a transient reference must be transient if it is proxy resolving":mK("_UI_EReferenceOppositeBothContainment_diagnostic",n)?"The opposite of a containment reference must not be a containment reference":mK("_UI_EReferenceConsistentUnique_diagnostic",n)?"A containment or bidirectional reference must be unique if its upper bound is different from 1":mK("_UI_ETypedElementNoType_diagnostic",n)?"The typed element must have a type":mK("_UI_EAttributeNoDataType_diagnostic",n)?"The generic attribute type must not refer to a class":mK("_UI_EReferenceNoClass_diagnostic",n)?"The generic reference type must not refer to a data type":mK("_UI_EGenericTypeNoTypeParameterAndClassifier_diagnostic",n)?"A generic type can't refer to both a type parameter and a classifier":mK("_UI_EGenericTypeNoClass_diagnostic",n)?"A generic super type must refer to a class":mK("_UI_EGenericTypeNoTypeParameterOrClassifier_diagnostic",n)?"A generic type in this context must refer to a classifier or a type parameter":mK("_UI_EGenericTypeBoundsOnlyForTypeArgument_diagnostic",n)?"A generic type may have bounds only when used as a type argument":mK("_UI_EGenericTypeNoUpperAndLowerBound_diagnostic",n)?"A generic type must not have both a lower and an upper bound":mK("_UI_EGenericTypeNoTypeParameterOrClassifierAndBound_diagnostic",n)?"A generic type with bounds must not also refer to a type parameter or classifier":mK("_UI_EGenericTypeNoArguments_diagnostic",n)?"A generic type may have arguments only if it refers to a classifier":mK("_UI_EGenericTypeOutOfScopeTypeParameter_diagnostic",n)?"A generic type may only refer to a type parameter that is in scope":n}function jWn(n){var t,e,i,r,c,a,u;n.r||(n.r=!0,Nrn(n,"graph"),xrn(n,"graph"),Drn(n,y6n),cun(n.o,"T"),f9(kY(n.a),n.p),f9(kY(n.f),n.a),f9(kY(n.n),n.f),f9(kY(n.g),n.n),f9(kY(n.c),n.n),f9(kY(n.i),n.c),f9(kY(n.j),n.c),f9(kY(n.d),n.f),f9(kY(n.e),n.a),z0(n.p,Xrt,OJn,!0,!0,!1),u=Tun(a=msn(n.p,n.p,"setProperty")),t=ZV(n.o),e=new Kp,f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),kEn(e,i=nQ(u)),Ujn(a,t,j6n),Ujn(a,t=nQ(u),E6n),u=Tun(a=msn(n.p,null,"getProperty")),t=ZV(n.o),e=nQ(u),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),Ujn(a,t,j6n),(c=HTn(a,t=nQ(u),null))&&c.Fi(),a=msn(n.p,n.wb.e,"hasProperty"),t=ZV(n.o),e=new Kp,f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),Ujn(a,t,j6n),$yn(a=msn(n.p,n.p,"copyProperties"),n.p,T6n),a=msn(n.p,null,"getAllProperties"),t=ZV(n.wb.P),e=ZV(n.o),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),i=new Kp,f9((!e.d&&(e.d=new $L(VAt,e,1)),e.d),i),e=ZV(n.wb.M),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),(r=HTn(a,t,null))&&r.Fi(),z0(n.a,NOt,z5n,!0,!1,!0),Myn(BB(Wtn(QQ(n.a),0),18),n.k,null,M6n,0,-1,NOt,!1,!1,!0,!0,!1,!1,!1),z0(n.f,DOt,X5n,!0,!1,!0),Myn(BB(Wtn(QQ(n.f),0),18),n.g,BB(Wtn(QQ(n.g),0),18),"labels",0,-1,DOt,!1,!1,!0,!0,!1,!1,!1),ucn(BB(Wtn(QQ(n.f),1),34),n.wb._,S6n,null,0,1,DOt,!1,!1,!0,!1,!0,!1),z0(n.n,ROt,"ElkShape",!0,!1,!0),ucn(BB(Wtn(QQ(n.n),0),34),n.wb.t,P6n,WQn,1,1,ROt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.n),1),34),n.wb.t,C6n,WQn,1,1,ROt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.n),2),34),n.wb.t,"x",WQn,1,1,ROt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.n),3),34),n.wb.t,"y",WQn,1,1,ROt,!1,!1,!0,!1,!0,!1),$yn(a=msn(n.n,null,"setDimensions"),n.wb.t,C6n),$yn(a,n.wb.t,P6n),$yn(a=msn(n.n,null,"setLocation"),n.wb.t,"x"),$yn(a,n.wb.t,"y"),z0(n.g,zOt,Z5n,!1,!1,!0),Myn(BB(Wtn(QQ(n.g),0),18),n.f,BB(Wtn(QQ(n.f),0),18),I6n,0,1,zOt,!1,!1,!0,!1,!1,!1,!1),ucn(BB(Wtn(QQ(n.g),1),34),n.wb._,O6n,"",0,1,zOt,!1,!1,!0,!1,!0,!1),z0(n.c,KOt,W5n,!0,!1,!0),Myn(BB(Wtn(QQ(n.c),0),18),n.d,BB(Wtn(QQ(n.d),1),18),"outgoingEdges",0,-1,KOt,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.c),1),18),n.d,BB(Wtn(QQ(n.d),2),18),"incomingEdges",0,-1,KOt,!1,!1,!0,!1,!0,!1,!1),z0(n.i,UOt,n6n,!1,!1,!0),Myn(BB(Wtn(QQ(n.i),0),18),n.j,BB(Wtn(QQ(n.j),0),18),"ports",0,-1,UOt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.i),1),18),n.i,BB(Wtn(QQ(n.i),2),18),A6n,0,-1,UOt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.i),2),18),n.i,BB(Wtn(QQ(n.i),1),18),I6n,0,1,UOt,!1,!1,!0,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.i),3),18),n.d,BB(Wtn(QQ(n.d),0),18),"containedEdges",0,-1,UOt,!1,!1,!0,!0,!1,!1,!1),ucn(BB(Wtn(QQ(n.i),4),34),n.wb.e,$6n,null,0,1,UOt,!0,!0,!1,!1,!0,!0),z0(n.j,XOt,t6n,!1,!1,!0),Myn(BB(Wtn(QQ(n.j),0),18),n.i,BB(Wtn(QQ(n.i),0),18),I6n,0,1,XOt,!1,!1,!0,!1,!1,!1,!1),z0(n.d,_Ot,V5n,!1,!1,!0),Myn(BB(Wtn(QQ(n.d),0),18),n.i,BB(Wtn(QQ(n.i),3),18),"containingNode",0,1,_Ot,!1,!1,!0,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.d),1),18),n.c,BB(Wtn(QQ(n.c),0),18),L6n,0,-1,_Ot,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.d),2),18),n.c,BB(Wtn(QQ(n.c),1),18),N6n,0,-1,_Ot,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.d),3),18),n.e,BB(Wtn(QQ(n.e),5),18),x6n,0,-1,_Ot,!1,!1,!0,!0,!1,!1,!1),ucn(BB(Wtn(QQ(n.d),4),34),n.wb.e,"hyperedge",null,0,1,_Ot,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.d),5),34),n.wb.e,$6n,null,0,1,_Ot,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.d),6),34),n.wb.e,"selfloop",null,0,1,_Ot,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.d),7),34),n.wb.e,"connected",null,0,1,_Ot,!0,!0,!1,!1,!0,!0),z0(n.b,xOt,U5n,!1,!1,!0),ucn(BB(Wtn(QQ(n.b),0),34),n.wb.t,"x",WQn,1,1,xOt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.b),1),34),n.wb.t,"y",WQn,1,1,xOt,!1,!1,!0,!1,!0,!1),$yn(a=msn(n.b,null,"set"),n.wb.t,"x"),$yn(a,n.wb.t,"y"),z0(n.e,FOt,Q5n,!1,!1,!0),ucn(BB(Wtn(QQ(n.e),0),34),n.wb.t,"startX",null,0,1,FOt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.e),1),34),n.wb.t,"startY",null,0,1,FOt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.e),2),34),n.wb.t,"endX",null,0,1,FOt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.e),3),34),n.wb.t,"endY",null,0,1,FOt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.e),4),18),n.b,null,D6n,0,-1,FOt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.e),5),18),n.d,BB(Wtn(QQ(n.d),3),18),I6n,0,1,FOt,!1,!1,!0,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.e),6),18),n.c,null,R6n,0,1,FOt,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.e),7),18),n.c,null,K6n,0,1,FOt,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.e),8),18),n.e,BB(Wtn(QQ(n.e),9),18),_6n,0,-1,FOt,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.e),9),18),n.e,BB(Wtn(QQ(n.e),8),18),F6n,0,-1,FOt,!1,!1,!0,!1,!0,!1,!1),ucn(BB(Wtn(QQ(n.e),10),34),n.wb._,S6n,null,0,1,FOt,!1,!1,!0,!1,!0,!1),$yn(a=msn(n.e,null,"setStartLocation"),n.wb.t,"x"),$yn(a,n.wb.t,"y"),$yn(a=msn(n.e,null,"setEndLocation"),n.wb.t,"x"),$yn(a,n.wb.t,"y"),z0(n.k,Hnt,"ElkPropertyToValueMapEntry",!1,!1,!1),t=ZV(n.o),e=new Kp,f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),_On(BB(Wtn(QQ(n.k),0),34),t,"key",Hnt,!1,!1,!0,!1),ucn(BB(Wtn(QQ(n.k),1),34),n.s,E6n,null,0,1,Hnt,!1,!1,!0,!1,!0,!1),dV(n.o,lMt,"IProperty",!0),dV(n.s,Ant,"PropertyValue",!0),Lhn(n,y6n))}function EWn(){EWn=O,(JLt=x8(NNt,v6n,25,BQn,15,1))[9]=35,JLt[10]=19,JLt[13]=19,JLt[32]=51,JLt[33]=49,JLt[34]=33,yU(JLt,35,38,49),JLt[38]=1,yU(JLt,39,45,49),yU(JLt,45,47,-71),JLt[47]=49,yU(JLt,48,58,-71),JLt[58]=61,JLt[59]=49,JLt[60]=1,JLt[61]=49,JLt[62]=33,yU(JLt,63,65,49),yU(JLt,65,91,-3),yU(JLt,91,93,33),JLt[93]=1,JLt[94]=33,JLt[95]=-3,JLt[96]=33,yU(JLt,97,123,-3),yU(JLt,123,183,33),JLt[183]=-87,yU(JLt,184,192,33),yU(JLt,192,215,-19),JLt[215]=33,yU(JLt,216,247,-19),JLt[247]=33,yU(JLt,248,306,-19),yU(JLt,306,308,33),yU(JLt,308,319,-19),yU(JLt,319,321,33),yU(JLt,321,329,-19),JLt[329]=33,yU(JLt,330,383,-19),JLt[383]=33,yU(JLt,384,452,-19),yU(JLt,452,461,33),yU(JLt,461,497,-19),yU(JLt,497,500,33),yU(JLt,500,502,-19),yU(JLt,502,506,33),yU(JLt,506,536,-19),yU(JLt,536,592,33),yU(JLt,592,681,-19),yU(JLt,681,699,33),yU(JLt,699,706,-19),yU(JLt,706,720,33),yU(JLt,720,722,-87),yU(JLt,722,768,33),yU(JLt,768,838,-87),yU(JLt,838,864,33),yU(JLt,864,866,-87),yU(JLt,866,902,33),JLt[902]=-19,JLt[903]=-87,yU(JLt,904,907,-19),JLt[907]=33,JLt[908]=-19,JLt[909]=33,yU(JLt,910,930,-19),JLt[930]=33,yU(JLt,931,975,-19),JLt[975]=33,yU(JLt,976,983,-19),yU(JLt,983,986,33),JLt[986]=-19,JLt[987]=33,JLt[988]=-19,JLt[989]=33,JLt[990]=-19,JLt[991]=33,JLt[992]=-19,JLt[993]=33,yU(JLt,994,1012,-19),yU(JLt,1012,1025,33),yU(JLt,1025,1037,-19),JLt[1037]=33,yU(JLt,1038,1104,-19),JLt[1104]=33,yU(JLt,1105,1117,-19),JLt[1117]=33,yU(JLt,1118,1154,-19),JLt[1154]=33,yU(JLt,1155,1159,-87),yU(JLt,1159,1168,33),yU(JLt,1168,1221,-19),yU(JLt,1221,1223,33),yU(JLt,1223,1225,-19),yU(JLt,1225,1227,33),yU(JLt,1227,1229,-19),yU(JLt,1229,1232,33),yU(JLt,1232,1260,-19),yU(JLt,1260,1262,33),yU(JLt,1262,1270,-19),yU(JLt,1270,1272,33),yU(JLt,1272,1274,-19),yU(JLt,1274,1329,33),yU(JLt,1329,1367,-19),yU(JLt,1367,1369,33),JLt[1369]=-19,yU(JLt,1370,1377,33),yU(JLt,1377,1415,-19),yU(JLt,1415,1425,33),yU(JLt,1425,1442,-87),JLt[1442]=33,yU(JLt,1443,1466,-87),JLt[1466]=33,yU(JLt,1467,1470,-87),JLt[1470]=33,JLt[1471]=-87,JLt[1472]=33,yU(JLt,1473,1475,-87),JLt[1475]=33,JLt[1476]=-87,yU(JLt,1477,1488,33),yU(JLt,1488,1515,-19),yU(JLt,1515,1520,33),yU(JLt,1520,1523,-19),yU(JLt,1523,1569,33),yU(JLt,1569,1595,-19),yU(JLt,1595,1600,33),JLt[1600]=-87,yU(JLt,1601,1611,-19),yU(JLt,1611,1619,-87),yU(JLt,1619,1632,33),yU(JLt,1632,1642,-87),yU(JLt,1642,1648,33),JLt[1648]=-87,yU(JLt,1649,1720,-19),yU(JLt,1720,1722,33),yU(JLt,1722,1727,-19),JLt[1727]=33,yU(JLt,1728,1743,-19),JLt[1743]=33,yU(JLt,1744,1748,-19),JLt[1748]=33,JLt[1749]=-19,yU(JLt,1750,1765,-87),yU(JLt,1765,1767,-19),yU(JLt,1767,1769,-87),JLt[1769]=33,yU(JLt,1770,1774,-87),yU(JLt,1774,1776,33),yU(JLt,1776,1786,-87),yU(JLt,1786,2305,33),yU(JLt,2305,2308,-87),JLt[2308]=33,yU(JLt,2309,2362,-19),yU(JLt,2362,2364,33),JLt[2364]=-87,JLt[2365]=-19,yU(JLt,2366,2382,-87),yU(JLt,2382,2385,33),yU(JLt,2385,2389,-87),yU(JLt,2389,2392,33),yU(JLt,2392,2402,-19),yU(JLt,2402,2404,-87),yU(JLt,2404,2406,33),yU(JLt,2406,2416,-87),yU(JLt,2416,2433,33),yU(JLt,2433,2436,-87),JLt[2436]=33,yU(JLt,2437,2445,-19),yU(JLt,2445,2447,33),yU(JLt,2447,2449,-19),yU(JLt,2449,2451,33),yU(JLt,2451,2473,-19),JLt[2473]=33,yU(JLt,2474,2481,-19),JLt[2481]=33,JLt[2482]=-19,yU(JLt,2483,2486,33),yU(JLt,2486,2490,-19),yU(JLt,2490,2492,33),JLt[2492]=-87,JLt[2493]=33,yU(JLt,2494,2501,-87),yU(JLt,2501,2503,33),yU(JLt,2503,2505,-87),yU(JLt,2505,2507,33),yU(JLt,2507,2510,-87),yU(JLt,2510,2519,33),JLt[2519]=-87,yU(JLt,2520,2524,33),yU(JLt,2524,2526,-19),JLt[2526]=33,yU(JLt,2527,2530,-19),yU(JLt,2530,2532,-87),yU(JLt,2532,2534,33),yU(JLt,2534,2544,-87),yU(JLt,2544,2546,-19),yU(JLt,2546,2562,33),JLt[2562]=-87,yU(JLt,2563,2565,33),yU(JLt,2565,2571,-19),yU(JLt,2571,2575,33),yU(JLt,2575,2577,-19),yU(JLt,2577,2579,33),yU(JLt,2579,2601,-19),JLt[2601]=33,yU(JLt,2602,2609,-19),JLt[2609]=33,yU(JLt,2610,2612,-19),JLt[2612]=33,yU(JLt,2613,2615,-19),JLt[2615]=33,yU(JLt,2616,2618,-19),yU(JLt,2618,2620,33),JLt[2620]=-87,JLt[2621]=33,yU(JLt,2622,2627,-87),yU(JLt,2627,2631,33),yU(JLt,2631,2633,-87),yU(JLt,2633,2635,33),yU(JLt,2635,2638,-87),yU(JLt,2638,2649,33),yU(JLt,2649,2653,-19),JLt[2653]=33,JLt[2654]=-19,yU(JLt,2655,2662,33),yU(JLt,2662,2674,-87),yU(JLt,2674,2677,-19),yU(JLt,2677,2689,33),yU(JLt,2689,2692,-87),JLt[2692]=33,yU(JLt,2693,2700,-19),JLt[2700]=33,JLt[2701]=-19,JLt[2702]=33,yU(JLt,2703,2706,-19),JLt[2706]=33,yU(JLt,2707,2729,-19),JLt[2729]=33,yU(JLt,2730,2737,-19),JLt[2737]=33,yU(JLt,2738,2740,-19),JLt[2740]=33,yU(JLt,2741,2746,-19),yU(JLt,2746,2748,33),JLt[2748]=-87,JLt[2749]=-19,yU(JLt,2750,2758,-87),JLt[2758]=33,yU(JLt,2759,2762,-87),JLt[2762]=33,yU(JLt,2763,2766,-87),yU(JLt,2766,2784,33),JLt[2784]=-19,yU(JLt,2785,2790,33),yU(JLt,2790,2800,-87),yU(JLt,2800,2817,33),yU(JLt,2817,2820,-87),JLt[2820]=33,yU(JLt,2821,2829,-19),yU(JLt,2829,2831,33),yU(JLt,2831,2833,-19),yU(JLt,2833,2835,33),yU(JLt,2835,2857,-19),JLt[2857]=33,yU(JLt,2858,2865,-19),JLt[2865]=33,yU(JLt,2866,2868,-19),yU(JLt,2868,2870,33),yU(JLt,2870,2874,-19),yU(JLt,2874,2876,33),JLt[2876]=-87,JLt[2877]=-19,yU(JLt,2878,2884,-87),yU(JLt,2884,2887,33),yU(JLt,2887,2889,-87),yU(JLt,2889,2891,33),yU(JLt,2891,2894,-87),yU(JLt,2894,2902,33),yU(JLt,2902,2904,-87),yU(JLt,2904,2908,33),yU(JLt,2908,2910,-19),JLt[2910]=33,yU(JLt,2911,2914,-19),yU(JLt,2914,2918,33),yU(JLt,2918,2928,-87),yU(JLt,2928,2946,33),yU(JLt,2946,2948,-87),JLt[2948]=33,yU(JLt,2949,2955,-19),yU(JLt,2955,2958,33),yU(JLt,2958,2961,-19),JLt[2961]=33,yU(JLt,2962,2966,-19),yU(JLt,2966,2969,33),yU(JLt,2969,2971,-19),JLt[2971]=33,JLt[2972]=-19,JLt[2973]=33,yU(JLt,2974,2976,-19),yU(JLt,2976,2979,33),yU(JLt,2979,2981,-19),yU(JLt,2981,2984,33),yU(JLt,2984,2987,-19),yU(JLt,2987,2990,33),yU(JLt,2990,2998,-19),JLt[2998]=33,yU(JLt,2999,3002,-19),yU(JLt,3002,3006,33),yU(JLt,3006,3011,-87),yU(JLt,3011,3014,33),yU(JLt,3014,3017,-87),JLt[3017]=33,yU(JLt,3018,3022,-87),yU(JLt,3022,3031,33),JLt[3031]=-87,yU(JLt,3032,3047,33),yU(JLt,3047,3056,-87),yU(JLt,3056,3073,33),yU(JLt,3073,3076,-87),JLt[3076]=33,yU(JLt,3077,3085,-19),JLt[3085]=33,yU(JLt,3086,3089,-19),JLt[3089]=33,yU(JLt,3090,3113,-19),JLt[3113]=33,yU(JLt,3114,3124,-19),JLt[3124]=33,yU(JLt,3125,3130,-19),yU(JLt,3130,3134,33),yU(JLt,3134,3141,-87),JLt[3141]=33,yU(JLt,3142,3145,-87),JLt[3145]=33,yU(JLt,3146,3150,-87),yU(JLt,3150,3157,33),yU(JLt,3157,3159,-87),yU(JLt,3159,3168,33),yU(JLt,3168,3170,-19),yU(JLt,3170,3174,33),yU(JLt,3174,3184,-87),yU(JLt,3184,3202,33),yU(JLt,3202,3204,-87),JLt[3204]=33,yU(JLt,3205,3213,-19),JLt[3213]=33,yU(JLt,3214,3217,-19),JLt[3217]=33,yU(JLt,3218,3241,-19),JLt[3241]=33,yU(JLt,3242,3252,-19),JLt[3252]=33,yU(JLt,3253,3258,-19),yU(JLt,3258,3262,33),yU(JLt,3262,3269,-87),JLt[3269]=33,yU(JLt,3270,3273,-87),JLt[3273]=33,yU(JLt,3274,3278,-87),yU(JLt,3278,3285,33),yU(JLt,3285,3287,-87),yU(JLt,3287,3294,33),JLt[3294]=-19,JLt[3295]=33,yU(JLt,3296,3298,-19),yU(JLt,3298,3302,33),yU(JLt,3302,3312,-87),yU(JLt,3312,3330,33),yU(JLt,3330,3332,-87),JLt[3332]=33,yU(JLt,3333,3341,-19),JLt[3341]=33,yU(JLt,3342,3345,-19),JLt[3345]=33,yU(JLt,3346,3369,-19),JLt[3369]=33,yU(JLt,3370,3386,-19),yU(JLt,3386,3390,33),yU(JLt,3390,3396,-87),yU(JLt,3396,3398,33),yU(JLt,3398,3401,-87),JLt[3401]=33,yU(JLt,3402,3406,-87),yU(JLt,3406,3415,33),JLt[3415]=-87,yU(JLt,3416,3424,33),yU(JLt,3424,3426,-19),yU(JLt,3426,3430,33),yU(JLt,3430,3440,-87),yU(JLt,3440,3585,33),yU(JLt,3585,3631,-19),JLt[3631]=33,JLt[3632]=-19,JLt[3633]=-87,yU(JLt,3634,3636,-19),yU(JLt,3636,3643,-87),yU(JLt,3643,3648,33),yU(JLt,3648,3654,-19),yU(JLt,3654,3663,-87),JLt[3663]=33,yU(JLt,3664,3674,-87),yU(JLt,3674,3713,33),yU(JLt,3713,3715,-19),JLt[3715]=33,JLt[3716]=-19,yU(JLt,3717,3719,33),yU(JLt,3719,3721,-19),JLt[3721]=33,JLt[3722]=-19,yU(JLt,3723,3725,33),JLt[3725]=-19,yU(JLt,3726,3732,33),yU(JLt,3732,3736,-19),JLt[3736]=33,yU(JLt,3737,3744,-19),JLt[3744]=33,yU(JLt,3745,3748,-19),JLt[3748]=33,JLt[3749]=-19,JLt[3750]=33,JLt[3751]=-19,yU(JLt,3752,3754,33),yU(JLt,3754,3756,-19),JLt[3756]=33,yU(JLt,3757,3759,-19),JLt[3759]=33,JLt[3760]=-19,JLt[3761]=-87,yU(JLt,3762,3764,-19),yU(JLt,3764,3770,-87),JLt[3770]=33,yU(JLt,3771,3773,-87),JLt[3773]=-19,yU(JLt,3774,3776,33),yU(JLt,3776,3781,-19),JLt[3781]=33,JLt[3782]=-87,JLt[3783]=33,yU(JLt,3784,3790,-87),yU(JLt,3790,3792,33),yU(JLt,3792,3802,-87),yU(JLt,3802,3864,33),yU(JLt,3864,3866,-87),yU(JLt,3866,3872,33),yU(JLt,3872,3882,-87),yU(JLt,3882,3893,33),JLt[3893]=-87,JLt[3894]=33,JLt[3895]=-87,JLt[3896]=33,JLt[3897]=-87,yU(JLt,3898,3902,33),yU(JLt,3902,3904,-87),yU(JLt,3904,3912,-19),JLt[3912]=33,yU(JLt,3913,3946,-19),yU(JLt,3946,3953,33),yU(JLt,3953,3973,-87),JLt[3973]=33,yU(JLt,3974,3980,-87),yU(JLt,3980,3984,33),yU(JLt,3984,3990,-87),JLt[3990]=33,JLt[3991]=-87,JLt[3992]=33,yU(JLt,3993,4014,-87),yU(JLt,4014,4017,33),yU(JLt,4017,4024,-87),JLt[4024]=33,JLt[4025]=-87,yU(JLt,4026,4256,33),yU(JLt,4256,4294,-19),yU(JLt,4294,4304,33),yU(JLt,4304,4343,-19),yU(JLt,4343,4352,33),JLt[4352]=-19,JLt[4353]=33,yU(JLt,4354,4356,-19),JLt[4356]=33,yU(JLt,4357,4360,-19),JLt[4360]=33,JLt[4361]=-19,JLt[4362]=33,yU(JLt,4363,4365,-19),JLt[4365]=33,yU(JLt,4366,4371,-19),yU(JLt,4371,4412,33),JLt[4412]=-19,JLt[4413]=33,JLt[4414]=-19,JLt[4415]=33,JLt[4416]=-19,yU(JLt,4417,4428,33),JLt[4428]=-19,JLt[4429]=33,JLt[4430]=-19,JLt[4431]=33,JLt[4432]=-19,yU(JLt,4433,4436,33),yU(JLt,4436,4438,-19),yU(JLt,4438,4441,33),JLt[4441]=-19,yU(JLt,4442,4447,33),yU(JLt,4447,4450,-19),JLt[4450]=33,JLt[4451]=-19,JLt[4452]=33,JLt[4453]=-19,JLt[4454]=33,JLt[4455]=-19,JLt[4456]=33,JLt[4457]=-19,yU(JLt,4458,4461,33),yU(JLt,4461,4463,-19),yU(JLt,4463,4466,33),yU(JLt,4466,4468,-19),JLt[4468]=33,JLt[4469]=-19,yU(JLt,4470,4510,33),JLt[4510]=-19,yU(JLt,4511,4520,33),JLt[4520]=-19,yU(JLt,4521,4523,33),JLt[4523]=-19,yU(JLt,4524,4526,33),yU(JLt,4526,4528,-19),yU(JLt,4528,4535,33),yU(JLt,4535,4537,-19),JLt[4537]=33,JLt[4538]=-19,JLt[4539]=33,yU(JLt,4540,4547,-19),yU(JLt,4547,4587,33),JLt[4587]=-19,yU(JLt,4588,4592,33),JLt[4592]=-19,yU(JLt,4593,4601,33),JLt[4601]=-19,yU(JLt,4602,7680,33),yU(JLt,7680,7836,-19),yU(JLt,7836,7840,33),yU(JLt,7840,7930,-19),yU(JLt,7930,7936,33),yU(JLt,7936,7958,-19),yU(JLt,7958,7960,33),yU(JLt,7960,7966,-19),yU(JLt,7966,7968,33),yU(JLt,7968,8006,-19),yU(JLt,8006,8008,33),yU(JLt,8008,8014,-19),yU(JLt,8014,8016,33),yU(JLt,8016,8024,-19),JLt[8024]=33,JLt[8025]=-19,JLt[8026]=33,JLt[8027]=-19,JLt[8028]=33,JLt[8029]=-19,JLt[8030]=33,yU(JLt,8031,8062,-19),yU(JLt,8062,8064,33),yU(JLt,8064,8117,-19),JLt[8117]=33,yU(JLt,8118,8125,-19),JLt[8125]=33,JLt[8126]=-19,yU(JLt,8127,8130,33),yU(JLt,8130,8133,-19),JLt[8133]=33,yU(JLt,8134,8141,-19),yU(JLt,8141,8144,33),yU(JLt,8144,8148,-19),yU(JLt,8148,8150,33),yU(JLt,8150,8156,-19),yU(JLt,8156,8160,33),yU(JLt,8160,8173,-19),yU(JLt,8173,8178,33),yU(JLt,8178,8181,-19),JLt[8181]=33,yU(JLt,8182,8189,-19),yU(JLt,8189,8400,33),yU(JLt,8400,8413,-87),yU(JLt,8413,8417,33),JLt[8417]=-87,yU(JLt,8418,8486,33),JLt[8486]=-19,yU(JLt,8487,8490,33),yU(JLt,8490,8492,-19),yU(JLt,8492,8494,33),JLt[8494]=-19,yU(JLt,8495,8576,33),yU(JLt,8576,8579,-19),yU(JLt,8579,12293,33),JLt[12293]=-87,JLt[12294]=33,JLt[12295]=-19,yU(JLt,12296,12321,33),yU(JLt,12321,12330,-19),yU(JLt,12330,12336,-87),JLt[12336]=33,yU(JLt,12337,12342,-87),yU(JLt,12342,12353,33),yU(JLt,12353,12437,-19),yU(JLt,12437,12441,33),yU(JLt,12441,12443,-87),yU(JLt,12443,12445,33),yU(JLt,12445,12447,-87),yU(JLt,12447,12449,33),yU(JLt,12449,12539,-19),JLt[12539]=33,yU(JLt,12540,12543,-87),yU(JLt,12543,12549,33),yU(JLt,12549,12589,-19),yU(JLt,12589,19968,33),yU(JLt,19968,40870,-19),yU(JLt,40870,44032,33),yU(JLt,44032,55204,-19),yU(JLt,55204,HQn,33),yU(JLt,57344,65534,33)}function TWn(n){var t,e,i,r,c,a,u;n.hb||(n.hb=!0,Nrn(n,"ecore"),xrn(n,"ecore"),Drn(n,V9n),cun(n.fb,"E"),cun(n.L,"T"),cun(n.P,"K"),cun(n.P,"V"),cun(n.cb,"E"),f9(kY(n.b),n.bb),f9(kY(n.a),n.Q),f9(kY(n.o),n.p),f9(kY(n.p),n.R),f9(kY(n.q),n.p),f9(kY(n.v),n.q),f9(kY(n.w),n.R),f9(kY(n.B),n.Q),f9(kY(n.R),n.Q),f9(kY(n.T),n.eb),f9(kY(n.U),n.R),f9(kY(n.V),n.eb),f9(kY(n.W),n.bb),f9(kY(n.bb),n.eb),f9(kY(n.eb),n.R),f9(kY(n.db),n.R),z0(n.b,BAt,l9n,!1,!1,!0),ucn(BB(Wtn(QQ(n.b),0),34),n.e,"iD",null,0,1,BAt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.b),1),18),n.q,null,"eAttributeType",1,1,BAt,!0,!0,!1,!1,!0,!1,!0),z0(n.a,KAt,s9n,!1,!1,!0),ucn(BB(Wtn(QQ(n.a),0),34),n._,T6n,null,0,1,KAt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.a),1),18),n.ab,null,"details",0,-1,KAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.a),2),18),n.Q,BB(Wtn(QQ(n.Q),0),18),"eModelElement",0,1,KAt,!0,!1,!0,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.a),3),18),n.S,null,"contents",0,-1,KAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.a),4),18),n.S,null,"references",0,-1,KAt,!1,!1,!0,!1,!0,!1,!1),z0(n.o,qAt,"EClass",!1,!1,!0),ucn(BB(Wtn(QQ(n.o),0),34),n.e,"abstract",null,0,1,qAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.o),1),34),n.e,"interface",null,0,1,qAt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.o),2),18),n.o,null,"eSuperTypes",0,-1,qAt,!1,!1,!0,!1,!0,!0,!1),Myn(BB(Wtn(QQ(n.o),3),18),n.T,BB(Wtn(QQ(n.T),0),18),"eOperations",0,-1,qAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.o),4),18),n.b,null,"eAllAttributes",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),5),18),n.W,null,"eAllReferences",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),6),18),n.W,null,"eReferences",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),7),18),n.b,null,"eAttributes",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),8),18),n.W,null,"eAllContainments",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),9),18),n.T,null,"eAllOperations",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),10),18),n.bb,null,"eAllStructuralFeatures",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),11),18),n.o,null,"eAllSuperTypes",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.o),12),18),n.b,null,"eIDAttribute",0,1,qAt,!0,!0,!1,!1,!1,!1,!0),Myn(BB(Wtn(QQ(n.o),13),18),n.bb,BB(Wtn(QQ(n.bb),7),18),"eStructuralFeatures",0,-1,qAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.o),14),18),n.H,null,"eGenericSuperTypes",0,-1,qAt,!1,!1,!0,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.o),15),18),n.H,null,"eAllGenericSuperTypes",0,-1,qAt,!0,!0,!1,!1,!0,!1,!0),$yn(u=fin(BB(Wtn(VQ(n.o),0),59),n.e,"isSuperTypeOf"),n.o,"someClass"),fin(BB(Wtn(VQ(n.o),1),59),n.I,"getFeatureCount"),$yn(u=fin(BB(Wtn(VQ(n.o),2),59),n.bb,Z9n),n.I,"featureID"),$yn(u=fin(BB(Wtn(VQ(n.o),3),59),n.I,n7n),n.bb,t7n),$yn(u=fin(BB(Wtn(VQ(n.o),4),59),n.bb,Z9n),n._,"featureName"),fin(BB(Wtn(VQ(n.o),5),59),n.I,"getOperationCount"),$yn(u=fin(BB(Wtn(VQ(n.o),6),59),n.T,"getEOperation"),n.I,"operationID"),$yn(u=fin(BB(Wtn(VQ(n.o),7),59),n.I,e7n),n.T,i7n),$yn(u=fin(BB(Wtn(VQ(n.o),8),59),n.T,"getOverride"),n.T,i7n),$yn(u=fin(BB(Wtn(VQ(n.o),9),59),n.H,"getFeatureType"),n.bb,t7n),z0(n.p,HAt,b9n,!0,!1,!0),ucn(BB(Wtn(QQ(n.p),0),34),n._,"instanceClassName",null,0,1,HAt,!1,!0,!0,!0,!0,!1),t=ZV(n.L),e=s2(),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),_On(BB(Wtn(QQ(n.p),1),34),t,"instanceClass",HAt,!0,!0,!1,!0),ucn(BB(Wtn(QQ(n.p),2),34),n.M,r7n,null,0,1,HAt,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.p),3),34),n._,"instanceTypeName",null,0,1,HAt,!1,!0,!0,!0,!0,!1),Myn(BB(Wtn(QQ(n.p),4),18),n.U,BB(Wtn(QQ(n.U),3),18),"ePackage",0,1,HAt,!0,!1,!1,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.p),5),18),n.db,null,c7n,0,-1,HAt,!1,!1,!0,!0,!0,!1,!1),$yn(u=fin(BB(Wtn(VQ(n.p),0),59),n.e,a7n),n.M,AWn),fin(BB(Wtn(VQ(n.p),1),59),n.I,"getClassifierID"),z0(n.q,GAt,"EDataType",!1,!1,!0),ucn(BB(Wtn(QQ(n.q),0),34),n.e,"serializable",a5n,0,1,GAt,!1,!1,!0,!1,!0,!1),z0(n.v,XAt,"EEnum",!1,!1,!0),Myn(BB(Wtn(QQ(n.v),0),18),n.w,BB(Wtn(QQ(n.w),3),18),"eLiterals",0,-1,XAt,!1,!1,!0,!0,!1,!1,!1),$yn(u=fin(BB(Wtn(VQ(n.v),0),59),n.w,u7n),n._,t8n),$yn(u=fin(BB(Wtn(VQ(n.v),1),59),n.w,u7n),n.I,E6n),$yn(u=fin(BB(Wtn(VQ(n.v),2),59),n.w,"getEEnumLiteralByLiteral"),n._,"literal"),z0(n.w,WAt,w9n,!1,!1,!0),ucn(BB(Wtn(QQ(n.w),0),34),n.I,E6n,null,0,1,WAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.w),1),34),n.A,"instance",null,0,1,WAt,!0,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.w),2),34),n._,"literal",null,0,1,WAt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.w),3),18),n.v,BB(Wtn(QQ(n.v),0),18),"eEnum",0,1,WAt,!0,!1,!1,!1,!1,!1,!1),z0(n.B,HOt,"EFactory",!1,!1,!0),Myn(BB(Wtn(QQ(n.B),0),18),n.U,BB(Wtn(QQ(n.U),2),18),"ePackage",1,1,HOt,!0,!1,!0,!1,!1,!1,!1),$yn(u=fin(BB(Wtn(VQ(n.B),0),59),n.S,"create"),n.o,"eClass"),$yn(u=fin(BB(Wtn(VQ(n.B),1),59),n.M,"createFromString"),n.q,"eDataType"),$yn(u,n._,"literalValue"),$yn(u=fin(BB(Wtn(VQ(n.B),2),59),n._,"convertToString"),n.q,"eDataType"),$yn(u,n.M,"instanceValue"),z0(n.Q,BOt,Y5n,!0,!1,!0),Myn(BB(Wtn(QQ(n.Q),0),18),n.a,BB(Wtn(QQ(n.a),2),18),"eAnnotations",0,-1,BOt,!1,!1,!0,!0,!1,!1,!1),$yn(u=fin(BB(Wtn(VQ(n.Q),0),59),n.a,"getEAnnotation"),n._,T6n),z0(n.R,qOt,J5n,!0,!1,!0),ucn(BB(Wtn(QQ(n.R),0),34),n._,t8n,null,0,1,qOt,!1,!1,!0,!1,!0,!1),z0(n.S,LOt,"EObject",!1,!1,!0),fin(BB(Wtn(VQ(n.S),0),59),n.o,"eClass"),fin(BB(Wtn(VQ(n.S),1),59),n.e,"eIsProxy"),fin(BB(Wtn(VQ(n.S),2),59),n.X,"eResource"),fin(BB(Wtn(VQ(n.S),3),59),n.S,"eContainer"),fin(BB(Wtn(VQ(n.S),4),59),n.bb,"eContainingFeature"),fin(BB(Wtn(VQ(n.S),5),59),n.W,"eContainmentFeature"),u=fin(BB(Wtn(VQ(n.S),6),59),null,"eContents"),t=ZV(n.fb),e=ZV(n.S),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),(r=HTn(u,t,null))&&r.Fi(),u=fin(BB(Wtn(VQ(n.S),7),59),null,"eAllContents"),t=ZV(n.cb),e=ZV(n.S),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),(c=HTn(u,t,null))&&c.Fi(),u=fin(BB(Wtn(VQ(n.S),8),59),null,"eCrossReferences"),t=ZV(n.fb),e=ZV(n.S),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),(a=HTn(u,t,null))&&a.Fi(),$yn(u=fin(BB(Wtn(VQ(n.S),9),59),n.M,"eGet"),n.bb,t7n),$yn(u=fin(BB(Wtn(VQ(n.S),10),59),n.M,"eGet"),n.bb,t7n),$yn(u,n.e,"resolve"),$yn(u=fin(BB(Wtn(VQ(n.S),11),59),null,"eSet"),n.bb,t7n),$yn(u,n.M,"newValue"),$yn(u=fin(BB(Wtn(VQ(n.S),12),59),n.e,"eIsSet"),n.bb,t7n),$yn(u=fin(BB(Wtn(VQ(n.S),13),59),null,"eUnset"),n.bb,t7n),$yn(u=fin(BB(Wtn(VQ(n.S),14),59),n.M,"eInvoke"),n.T,i7n),t=ZV(n.fb),e=s2(),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),Ujn(u,t,"arguments"),_W(u,n.K),z0(n.T,QAt,g9n,!1,!1,!0),Myn(BB(Wtn(QQ(n.T),0),18),n.o,BB(Wtn(QQ(n.o),3),18),o7n,0,1,QAt,!0,!1,!1,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.T),1),18),n.db,null,c7n,0,-1,QAt,!1,!1,!0,!0,!0,!1,!1),Myn(BB(Wtn(QQ(n.T),2),18),n.V,BB(Wtn(QQ(n.V),0),18),"eParameters",0,-1,QAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.T),3),18),n.p,null,"eExceptions",0,-1,QAt,!1,!1,!0,!1,!0,!0,!1),Myn(BB(Wtn(QQ(n.T),4),18),n.H,null,"eGenericExceptions",0,-1,QAt,!1,!1,!0,!0,!1,!0,!1),fin(BB(Wtn(VQ(n.T),0),59),n.I,e7n),$yn(u=fin(BB(Wtn(VQ(n.T),1),59),n.e,"isOverrideOf"),n.T,"someOperation"),z0(n.U,GOt,"EPackage",!1,!1,!0),ucn(BB(Wtn(QQ(n.U),0),34),n._,"nsURI",null,0,1,GOt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.U),1),34),n._,"nsPrefix",null,0,1,GOt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.U),2),18),n.B,BB(Wtn(QQ(n.B),0),18),"eFactoryInstance",1,1,GOt,!0,!1,!0,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.U),3),18),n.p,BB(Wtn(QQ(n.p),4),18),"eClassifiers",0,-1,GOt,!1,!1,!0,!0,!0,!1,!1),Myn(BB(Wtn(QQ(n.U),4),18),n.U,BB(Wtn(QQ(n.U),5),18),"eSubpackages",0,-1,GOt,!1,!1,!0,!0,!0,!1,!1),Myn(BB(Wtn(QQ(n.U),5),18),n.U,BB(Wtn(QQ(n.U),4),18),"eSuperPackage",0,1,GOt,!0,!1,!1,!1,!0,!1,!1),$yn(u=fin(BB(Wtn(VQ(n.U),0),59),n.p,"getEClassifier"),n._,t8n),z0(n.V,YAt,p9n,!1,!1,!0),Myn(BB(Wtn(QQ(n.V),0),18),n.T,BB(Wtn(QQ(n.T),2),18),"eOperation",0,1,YAt,!0,!1,!1,!1,!1,!1,!1),z0(n.W,JAt,v9n,!1,!1,!0),ucn(BB(Wtn(QQ(n.W),0),34),n.e,"containment",null,0,1,JAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.W),1),34),n.e,"container",null,0,1,JAt,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.W),2),34),n.e,"resolveProxies",a5n,0,1,JAt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.W),3),18),n.W,null,"eOpposite",0,1,JAt,!1,!1,!0,!1,!0,!1,!1),Myn(BB(Wtn(QQ(n.W),4),18),n.o,null,"eReferenceType",1,1,JAt,!0,!0,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.W),5),18),n.b,null,"eKeys",0,-1,JAt,!1,!1,!0,!1,!0,!1,!1),z0(n.bb,FAt,f9n,!0,!1,!0),ucn(BB(Wtn(QQ(n.bb),0),34),n.e,"changeable",a5n,0,1,FAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.bb),1),34),n.e,"volatile",null,0,1,FAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.bb),2),34),n.e,"transient",null,0,1,FAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.bb),3),34),n._,"defaultValueLiteral",null,0,1,FAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.bb),4),34),n.M,r7n,null,0,1,FAt,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.bb),5),34),n.e,"unsettable",null,0,1,FAt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.bb),6),34),n.e,"derived",null,0,1,FAt,!1,!1,!0,!1,!0,!1),Myn(BB(Wtn(QQ(n.bb),7),18),n.o,BB(Wtn(QQ(n.o),13),18),o7n,0,1,FAt,!0,!1,!1,!1,!1,!1,!1),fin(BB(Wtn(VQ(n.bb),0),59),n.I,n7n),u=fin(BB(Wtn(VQ(n.bb),1),59),null,"getContainerClass"),t=ZV(n.L),e=s2(),f9((!t.d&&(t.d=new $L(VAt,t,1)),t.d),e),(i=HTn(u,t,null))&&i.Fi(),z0(n.eb,_At,h9n,!0,!1,!0),ucn(BB(Wtn(QQ(n.eb),0),34),n.e,"ordered",a5n,0,1,_At,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.eb),1),34),n.e,"unique",a5n,0,1,_At,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.eb),2),34),n.I,"lowerBound",null,0,1,_At,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.eb),3),34),n.I,"upperBound","1",0,1,_At,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.eb),4),34),n.e,"many",null,0,1,_At,!0,!0,!1,!1,!0,!0),ucn(BB(Wtn(QQ(n.eb),5),34),n.e,"required",null,0,1,_At,!0,!0,!1,!1,!0,!0),Myn(BB(Wtn(QQ(n.eb),6),18),n.p,null,"eType",0,1,_At,!1,!0,!0,!1,!0,!0,!1),Myn(BB(Wtn(QQ(n.eb),7),18),n.H,null,"eGenericType",0,1,_At,!1,!0,!0,!0,!1,!0,!1),z0(n.ab,Hnt,"EStringToStringMapEntry",!1,!1,!1),ucn(BB(Wtn(QQ(n.ab),0),34),n._,"key",null,0,1,Hnt,!1,!1,!0,!1,!0,!1),ucn(BB(Wtn(QQ(n.ab),1),34),n._,E6n,null,0,1,Hnt,!1,!1,!0,!1,!0,!1),z0(n.H,VAt,d9n,!1,!1,!0),Myn(BB(Wtn(QQ(n.H),0),18),n.H,null,"eUpperBound",0,1,VAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.H),1),18),n.H,null,"eTypeArguments",0,-1,VAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.H),2),18),n.p,null,"eRawType",1,1,VAt,!0,!1,!1,!1,!0,!1,!0),Myn(BB(Wtn(QQ(n.H),3),18),n.H,null,"eLowerBound",0,1,VAt,!1,!1,!0,!0,!1,!1,!1),Myn(BB(Wtn(QQ(n.H),4),18),n.db,null,"eTypeParameter",0,1,VAt,!1,!1,!0,!1,!1,!1,!1),Myn(BB(Wtn(QQ(n.H),5),18),n.p,null,"eClassifier",0,1,VAt,!1,!1,!0,!1,!0,!1,!1),$yn(u=fin(BB(Wtn(VQ(n.H),0),59),n.e,a7n),n.M,AWn),z0(n.db,O$t,m9n,!1,!1,!0),Myn(BB(Wtn(QQ(n.db),0),18),n.H,null,"eBounds",0,-1,O$t,!1,!1,!0,!0,!1,!1,!1),dV(n.c,iet,"EBigDecimal",!0),dV(n.d,oet,"EBigInteger",!0),dV(n.e,$Nt,"EBoolean",!0),dV(n.f,ktt,"EBooleanObject",!0),dV(n.i,NNt,"EByte",!0),dV(n.g,Gk(NNt,1),"EByteArray",!0),dV(n.j,Ttt,"EByteObject",!0),dV(n.k,ONt,"EChar",!0),dV(n.n,Stt,"ECharacterObject",!0),dV(n.r,mtt,"EDate",!0),dV(n.s,_Nt,"EDiagnosticChain",!1),dV(n.t,xNt,"EDouble",!0),dV(n.u,Ptt,"EDoubleObject",!0),dV(n.fb,uAt,"EEList",!1),dV(n.A,yAt,"EEnumerator",!1),dV(n.C,oLt,"EFeatureMap",!1),dV(n.D,$$t,"EFeatureMapEntry",!1),dV(n.F,DNt,"EFloat",!0),dV(n.G,Ctt,"EFloatObject",!0),dV(n.I,ANt,"EInt",!0),dV(n.J,Att,"EIntegerObject",!0),dV(n.L,$nt,"EJavaClass",!0),dV(n.M,Ant,"EJavaObject",!0),dV(n.N,LNt,"ELong",!0),dV(n.O,Rtt,"ELongObject",!0),dV(n.P,Nnt,"EMap",!1),dV(n.X,iLt,"EResource",!1),dV(n.Y,FNt,"EResourceSet",!1),dV(n.Z,RNt,"EShort",!0),dV(n.$,_tt,"EShortObject",!0),dV(n._,Qtt,"EString",!0),dV(n.cb,sAt,"ETreeIterator",!1),dV(n.K,BNt,"EInvocationTargetException",!1),Lhn(n,V9n))}"undefined"!=typeof window?e=window:void 0!==n?e=n:"undefined"!=typeof self&&(e=self);var MWn,SWn,PWn,CWn,IWn,OWn,AWn="object",$Wn="boolean",LWn="number",NWn="string",xWn="function",DWn=2147483647,RWn="java.lang",KWn={3:1},_Wn="com.google.common.base",FWn=", ",BWn="%s (%s) must not be negative",HWn={3:1,4:1,5:1},qWn="negative size: ",GWn="Optional.of(",zWn="null",UWn={198:1,47:1},XWn="com.google.common.collect",WWn={198:1,47:1,125:1},VWn={224:1,3:1},QWn={47:1},YWn="java.util",JWn={83:1},ZWn={20:1,28:1,14:1},nVn=1965,tVn={20:1,28:1,14:1,21:1},eVn={83:1,171:1,161:1},iVn={20:1,28:1,14:1,21:1,84:1},rVn={20:1,28:1,14:1,271:1,21:1,84:1},cVn={47:1,125:1},aVn={345:1,42:1},uVn="AbstractMapEntry",oVn="expectedValuesPerKey",sVn={3:1,6:1,4:1,5:1},hVn=16384,fVn={164:1},lVn={38:1},bVn={l:4194303,m:4194303,h:524287},wVn={196:1},dVn={245:1,3:1,35:1},gVn="range unbounded on this side",pVn={20:1},vVn={20:1,14:1},mVn={3:1,20:1,28:1,14:1},yVn={152:1,3:1,20:1,28:1,14:1,15:1,54:1},kVn={3:1,4:1,5:1,165:1},jVn={3:1,83:1},EVn={20:1,14:1,21:1},TVn={3:1,20:1,28:1,14:1,21:1},MVn={20:1,14:1,21:1,84:1},SVn=461845907,PVn=-862048943,CVn={3:1,6:1,4:1,5:1,165:1},IVn="expectedSize",OVn=1073741824,AVn="initialArraySize",$Vn={3:1,6:1,4:1,9:1,5:1},LVn={20:1,28:1,52:1,14:1,15:1},NVn="arraySize",xVn={20:1,28:1,52:1,14:1,15:1,54:1},DVn={45:1},RVn={365:1},KVn=1e-4,_Vn=-2147483648,FVn="__noinit__",BVn={3:1,102:1,60:1,78:1},HVn="com.google.gwt.core.client.impl",qVn="String",GVn="com.google.gwt.core.client",zVn="anonymous",UVn="fnStack",XVn="Unknown",WVn={195:1,3:1,4:1},VVn=1e3,QVn=65535,YVn="January",JVn="February",ZVn="March",nQn="April",tQn="May",eQn="June",iQn="July",rQn="August",cQn="September",aQn="October",uQn="November",oQn="December",sQn=1900,hQn={48:1,3:1,4:1},fQn="Before Christ",lQn="Anno Domini",bQn="Sunday",wQn="Monday",dQn="Tuesday",gQn="Wednesday",pQn="Thursday",vQn="Friday",mQn="Saturday",yQn="com.google.gwt.i18n.shared",kQn="DateTimeFormat",jQn="com.google.gwt.i18n.client",EQn="DefaultDateTimeFormatInfo",TQn={3:1,4:1,35:1,199:1},MQn="com.google.gwt.json.client",SQn=4194303,PQn=1048575,CQn=524288,IQn=4194304,OQn=17592186044416,AQn=1e9,$Qn=-17592186044416,LQn="java.io",NQn={3:1,102:1,73:1,60:1,78:1},xQn={3:1,289:1,78:1},DQn='For input string: "',RQn=1/0,KQn=-1/0,_Qn=4096,FQn={3:1,4:1,364:1},BQn=65536,HQn=55296,qQn={104:1,3:1,4:1},GQn=1e5,zQn=.3010299956639812,UQn=4294967295,XQn=4294967296,WQn="0.0",VQn={42:1},QQn={3:1,4:1,20:1,28:1,52:1,12:1,14:1,15:1,54:1},YQn={3:1,20:1,28:1,52:1,14:1,15:1,54:1},JQn={20:1,14:1,15:1},ZQn={3:1,62:1},nYn={182:1},tYn={3:1,4:1,83:1},eYn={3:1,4:1,20:1,28:1,14:1,53:1,21:1},iYn="delete",rYn=1.4901161193847656e-8,cYn=11102230246251565e-32,aYn=15525485,uYn=5.960464477539063e-8,oYn=16777216,sYn=16777215,hYn=", length: ",fYn={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1},lYn={3:1,35:1,22:1,297:1},bYn="java.util.function",wYn="java.util.logging",dYn={3:1,4:1,5:1,842:1},gYn="undefined",pYn="java.util.stream",vYn={525:1,670:1},mYn="fromIndex: ",yYn=" > toIndex: ",kYn=", toIndex: ",jYn="Index: ",EYn=", Size: ",TYn="org.eclipse.elk.alg.common",MYn={62:1},SYn="org.eclipse.elk.alg.common.compaction",PYn="Scanline/EventHandler",CYn="org.eclipse.elk.alg.common.compaction.oned",IYn="CNode belongs to another CGroup.",OYn="ISpacingsHandler/1",AYn="The ",$Yn=" instance has been finished already.",LYn="The direction ",NYn=" is not supported by the CGraph instance.",xYn="OneDimensionalCompactor",DYn="OneDimensionalCompactor/lambda$0$Type",RYn="Quadruplet",KYn="ScanlineConstraintCalculator",_Yn="ScanlineConstraintCalculator/ConstraintsScanlineHandler",FYn="ScanlineConstraintCalculator/ConstraintsScanlineHandler/lambda$0$Type",BYn="ScanlineConstraintCalculator/Timestamp",HYn="ScanlineConstraintCalculator/lambda$0$Type",qYn={169:1,45:1},GYn="org.eclipse.elk.alg.common.compaction.options",zYn="org.eclipse.elk.core.data",UYn="org.eclipse.elk.polyomino.traversalStrategy",XYn="org.eclipse.elk.polyomino.lowLevelSort",WYn="org.eclipse.elk.polyomino.highLevelSort",VYn="org.eclipse.elk.polyomino.fill",QYn={130:1},YYn="polyomino",JYn="org.eclipse.elk.alg.common.networksimplex",ZYn={177:1,3:1,4:1},nJn="org.eclipse.elk.alg.common.nodespacing",tJn="org.eclipse.elk.alg.common.nodespacing.cellsystem",eJn="CENTER",iJn={212:1,326:1},rJn={3:1,4:1,5:1,595:1},cJn="LEFT",aJn="RIGHT",uJn="Vertical alignment cannot be null",oJn="BOTTOM",sJn="org.eclipse.elk.alg.common.nodespacing.internal",hJn="UNDEFINED",fJn=.01,lJn="org.eclipse.elk.alg.common.nodespacing.internal.algorithm",bJn="LabelPlacer/lambda$0$Type",wJn="LabelPlacer/lambda$1$Type",dJn="portRatioOrPosition",gJn="org.eclipse.elk.alg.common.overlaps",pJn="DOWN",vJn="org.eclipse.elk.alg.common.polyomino",mJn="NORTH",yJn="EAST",kJn="SOUTH",jJn="WEST",EJn="org.eclipse.elk.alg.common.polyomino.structures",TJn="Direction",MJn="Grid is only of size ",SJn=". Requested point (",PJn=") is out of bounds.",CJn=" Given center based coordinates were (",IJn="org.eclipse.elk.graph.properties",OJn="IPropertyHolder",AJn={3:1,94:1,134:1},$Jn="org.eclipse.elk.alg.common.spore",LJn="org.eclipse.elk.alg.common.utils",NJn={209:1},xJn="org.eclipse.elk.core",DJn="Connected Components Compaction",RJn="org.eclipse.elk.alg.disco",KJn="org.eclipse.elk.alg.disco.graph",_Jn="org.eclipse.elk.alg.disco.options",FJn="CompactionStrategy",BJn="org.eclipse.elk.disco.componentCompaction.strategy",HJn="org.eclipse.elk.disco.componentCompaction.componentLayoutAlgorithm",qJn="org.eclipse.elk.disco.debug.discoGraph",GJn="org.eclipse.elk.disco.debug.discoPolys",zJn="componentCompaction",UJn="org.eclipse.elk.disco",XJn="org.eclipse.elk.spacing.componentComponent",WJn="org.eclipse.elk.edge.thickness",VJn="org.eclipse.elk.aspectRatio",QJn="org.eclipse.elk.padding",YJn="org.eclipse.elk.alg.disco.transform",JJn=1.5707963267948966,ZJn=17976931348623157e292,nZn={3:1,4:1,5:1,192:1},tZn={3:1,6:1,4:1,5:1,106:1,120:1},eZn="org.eclipse.elk.alg.force",iZn="ComponentsProcessor",rZn="ComponentsProcessor/1",cZn="org.eclipse.elk.alg.force.graph",aZn="Component Layout",uZn="org.eclipse.elk.alg.force.model",oZn="org.eclipse.elk.force.model",sZn="org.eclipse.elk.force.iterations",hZn="org.eclipse.elk.force.repulsivePower",fZn="org.eclipse.elk.force.temperature",lZn=.001,bZn="org.eclipse.elk.force.repulsion",wZn="org.eclipse.elk.alg.force.options",dZn=1.600000023841858,gZn="org.eclipse.elk.force",pZn="org.eclipse.elk.priority",vZn="org.eclipse.elk.spacing.nodeNode",mZn="org.eclipse.elk.spacing.edgeLabel",yZn="org.eclipse.elk.randomSeed",kZn="org.eclipse.elk.separateConnectedComponents",jZn="org.eclipse.elk.interactive",EZn="org.eclipse.elk.portConstraints",TZn="org.eclipse.elk.edgeLabels.inline",MZn="org.eclipse.elk.omitNodeMicroLayout",SZn="org.eclipse.elk.nodeSize.options",PZn="org.eclipse.elk.nodeSize.constraints",CZn="org.eclipse.elk.nodeLabels.placement",IZn="org.eclipse.elk.portLabels.placement",OZn="origin",AZn="random",$Zn="boundingBox.upLeft",LZn="boundingBox.lowRight",NZn="org.eclipse.elk.stress.fixed",xZn="org.eclipse.elk.stress.desiredEdgeLength",DZn="org.eclipse.elk.stress.dimension",RZn="org.eclipse.elk.stress.epsilon",KZn="org.eclipse.elk.stress.iterationLimit",_Zn="org.eclipse.elk.stress",FZn="ELK Stress",BZn="org.eclipse.elk.nodeSize.minimum",HZn="org.eclipse.elk.alg.force.stress",qZn="Layered layout",GZn="org.eclipse.elk.alg.layered",zZn="org.eclipse.elk.alg.layered.compaction.components",UZn="org.eclipse.elk.alg.layered.compaction.oned",XZn="org.eclipse.elk.alg.layered.compaction.oned.algs",WZn="org.eclipse.elk.alg.layered.compaction.recthull",VZn="org.eclipse.elk.alg.layered.components",QZn="NONE",YZn={3:1,6:1,4:1,9:1,5:1,122:1},JZn={3:1,6:1,4:1,5:1,141:1,106:1,120:1},ZZn="org.eclipse.elk.alg.layered.compound",n1n={51:1},t1n="org.eclipse.elk.alg.layered.graph",e1n=" -> ",i1n="Not supported by LGraph",r1n="Port side is undefined",c1n={3:1,6:1,4:1,5:1,474:1,141:1,106:1,120:1},a1n={3:1,6:1,4:1,5:1,141:1,193:1,203:1,106:1,120:1},u1n={3:1,6:1,4:1,5:1,141:1,1943:1,203:1,106:1,120:1},o1n="([{\"' \t\r\n",s1n=")]}\"' \t\r\n",h1n="The given string contains parts that cannot be parsed as numbers.",f1n="org.eclipse.elk.core.math",l1n={3:1,4:1,142:1,207:1,414:1},b1n={3:1,4:1,116:1,207:1,414:1},w1n="org.eclipse.elk.layered",d1n="org.eclipse.elk.alg.layered.graph.transform",g1n="ElkGraphImporter",p1n="ElkGraphImporter/lambda$0$Type",v1n="ElkGraphImporter/lambda$1$Type",m1n="ElkGraphImporter/lambda$2$Type",y1n="ElkGraphImporter/lambda$4$Type",k1n="Node margin calculation",j1n="org.eclipse.elk.alg.layered.intermediate",E1n="ONE_SIDED_GREEDY_SWITCH",T1n="TWO_SIDED_GREEDY_SWITCH",M1n="No implementation is available for the layout processor ",S1n="IntermediateProcessorStrategy",P1n="Node '",C1n="FIRST_SEPARATE",I1n="LAST_SEPARATE",O1n="Odd port side processing",A1n="org.eclipse.elk.alg.layered.intermediate.compaction",$1n="org.eclipse.elk.alg.layered.intermediate.greedyswitch",L1n="org.eclipse.elk.alg.layered.p3order.counting",N1n={225:1},x1n="org.eclipse.elk.alg.layered.intermediate.loops",D1n="org.eclipse.elk.alg.layered.intermediate.loops.ordering",R1n="org.eclipse.elk.alg.layered.intermediate.loops.routing",K1n="org.eclipse.elk.alg.layered.intermediate.preserveorder",_1n="org.eclipse.elk.alg.layered.intermediate.wrapping",F1n="org.eclipse.elk.alg.layered.options",B1n="INTERACTIVE",H1n="DEPTH_FIRST",q1n="EDGE_LENGTH",G1n="SELF_LOOPS",z1n="firstTryWithInitialOrder",U1n="org.eclipse.elk.layered.directionCongruency",X1n="org.eclipse.elk.layered.feedbackEdges",W1n="org.eclipse.elk.layered.interactiveReferencePoint",V1n="org.eclipse.elk.layered.mergeEdges",Q1n="org.eclipse.elk.layered.mergeHierarchyEdges",Y1n="org.eclipse.elk.layered.allowNonFlowPortsToSwitchSides",J1n="org.eclipse.elk.layered.portSortingStrategy",Z1n="org.eclipse.elk.layered.thoroughness",n0n="org.eclipse.elk.layered.unnecessaryBendpoints",t0n="org.eclipse.elk.layered.generatePositionAndLayerIds",e0n="org.eclipse.elk.layered.cycleBreaking.strategy",i0n="org.eclipse.elk.layered.layering.strategy",r0n="org.eclipse.elk.layered.layering.layerConstraint",c0n="org.eclipse.elk.layered.layering.layerChoiceConstraint",a0n="org.eclipse.elk.layered.layering.layerId",u0n="org.eclipse.elk.layered.layering.minWidth.upperBoundOnWidth",o0n="org.eclipse.elk.layered.layering.minWidth.upperLayerEstimationScalingFactor",s0n="org.eclipse.elk.layered.layering.nodePromotion.strategy",h0n="org.eclipse.elk.layered.layering.nodePromotion.maxIterations",f0n="org.eclipse.elk.layered.layering.coffmanGraham.layerBound",l0n="org.eclipse.elk.layered.crossingMinimization.strategy",b0n="org.eclipse.elk.layered.crossingMinimization.forceNodeModelOrder",w0n="org.eclipse.elk.layered.crossingMinimization.hierarchicalSweepiness",d0n="org.eclipse.elk.layered.crossingMinimization.semiInteractive",g0n="org.eclipse.elk.layered.crossingMinimization.positionChoiceConstraint",p0n="org.eclipse.elk.layered.crossingMinimization.positionId",v0n="org.eclipse.elk.layered.crossingMinimization.greedySwitch.activationThreshold",m0n="org.eclipse.elk.layered.crossingMinimization.greedySwitch.type",y0n="org.eclipse.elk.layered.crossingMinimization.greedySwitchHierarchical.type",k0n="org.eclipse.elk.layered.nodePlacement.strategy",j0n="org.eclipse.elk.layered.nodePlacement.favorStraightEdges",E0n="org.eclipse.elk.layered.nodePlacement.bk.edgeStraightening",T0n="org.eclipse.elk.layered.nodePlacement.bk.fixedAlignment",M0n="org.eclipse.elk.layered.nodePlacement.linearSegments.deflectionDampening",S0n="org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility",P0n="org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility.default",C0n="org.eclipse.elk.layered.edgeRouting.selfLoopDistribution",I0n="org.eclipse.elk.layered.edgeRouting.selfLoopOrdering",O0n="org.eclipse.elk.layered.edgeRouting.splines.mode",A0n="org.eclipse.elk.layered.edgeRouting.splines.sloppy.layerSpacingFactor",$0n="org.eclipse.elk.layered.edgeRouting.polyline.slopedEdgeZoneWidth",L0n="org.eclipse.elk.layered.spacing.baseValue",N0n="org.eclipse.elk.layered.spacing.edgeNodeBetweenLayers",x0n="org.eclipse.elk.layered.spacing.edgeEdgeBetweenLayers",D0n="org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers",R0n="org.eclipse.elk.layered.priority.direction",K0n="org.eclipse.elk.layered.priority.shortness",_0n="org.eclipse.elk.layered.priority.straightness",F0n="org.eclipse.elk.layered.compaction.connectedComponents",B0n="org.eclipse.elk.layered.compaction.postCompaction.strategy",H0n="org.eclipse.elk.layered.compaction.postCompaction.constraints",q0n="org.eclipse.elk.layered.highDegreeNodes.treatment",G0n="org.eclipse.elk.layered.highDegreeNodes.threshold",z0n="org.eclipse.elk.layered.highDegreeNodes.treeHeight",U0n="org.eclipse.elk.layered.wrapping.strategy",X0n="org.eclipse.elk.layered.wrapping.additionalEdgeSpacing",W0n="org.eclipse.elk.layered.wrapping.correctionFactor",V0n="org.eclipse.elk.layered.wrapping.cutting.strategy",Q0n="org.eclipse.elk.layered.wrapping.cutting.cuts",Y0n="org.eclipse.elk.layered.wrapping.cutting.msd.freedom",J0n="org.eclipse.elk.layered.wrapping.validify.strategy",Z0n="org.eclipse.elk.layered.wrapping.validify.forbiddenIndices",n2n="org.eclipse.elk.layered.wrapping.multiEdge.improveCuts",t2n="org.eclipse.elk.layered.wrapping.multiEdge.distancePenalty",e2n="org.eclipse.elk.layered.wrapping.multiEdge.improveWrappedEdges",i2n="org.eclipse.elk.layered.edgeLabels.sideSelection",r2n="org.eclipse.elk.layered.edgeLabels.centerLabelPlacementStrategy",c2n="org.eclipse.elk.layered.considerModelOrder.strategy",a2n="org.eclipse.elk.layered.considerModelOrder.noModelOrder",u2n="org.eclipse.elk.layered.considerModelOrder.components",o2n="org.eclipse.elk.layered.considerModelOrder.longEdgeStrategy",s2n="org.eclipse.elk.layered.considerModelOrder.crossingCounterNodeInfluence",h2n="org.eclipse.elk.layered.considerModelOrder.crossingCounterPortInfluence",f2n="layering",l2n="layering.minWidth",b2n="layering.nodePromotion",w2n="crossingMinimization",d2n="org.eclipse.elk.hierarchyHandling",g2n="crossingMinimization.greedySwitch",p2n="nodePlacement",v2n="nodePlacement.bk",m2n="edgeRouting",y2n="org.eclipse.elk.edgeRouting",k2n="spacing",j2n="priority",E2n="compaction",T2n="compaction.postCompaction",M2n="Specifies whether and how post-process compaction is applied.",S2n="highDegreeNodes",P2n="wrapping",C2n="wrapping.cutting",I2n="wrapping.validify",O2n="wrapping.multiEdge",A2n="edgeLabels",$2n="considerModelOrder",L2n="org.eclipse.elk.spacing.commentComment",N2n="org.eclipse.elk.spacing.commentNode",x2n="org.eclipse.elk.spacing.edgeEdge",D2n="org.eclipse.elk.spacing.edgeNode",R2n="org.eclipse.elk.spacing.labelLabel",K2n="org.eclipse.elk.spacing.labelPortHorizontal",_2n="org.eclipse.elk.spacing.labelPortVertical",F2n="org.eclipse.elk.spacing.labelNode",B2n="org.eclipse.elk.spacing.nodeSelfLoop",H2n="org.eclipse.elk.spacing.portPort",q2n="org.eclipse.elk.spacing.individual",G2n="org.eclipse.elk.port.borderOffset",z2n="org.eclipse.elk.noLayout",U2n="org.eclipse.elk.port.side",X2n="org.eclipse.elk.debugMode",W2n="org.eclipse.elk.alignment",V2n="org.eclipse.elk.insideSelfLoops.activate",Q2n="org.eclipse.elk.insideSelfLoops.yo",Y2n="org.eclipse.elk.nodeSize.fixedGraphSize",J2n="org.eclipse.elk.direction",Z2n="org.eclipse.elk.nodeLabels.padding",n3n="org.eclipse.elk.portLabels.nextToPortIfPossible",t3n="org.eclipse.elk.portLabels.treatAsGroup",e3n="org.eclipse.elk.portAlignment.default",i3n="org.eclipse.elk.portAlignment.north",r3n="org.eclipse.elk.portAlignment.south",c3n="org.eclipse.elk.portAlignment.west",a3n="org.eclipse.elk.portAlignment.east",u3n="org.eclipse.elk.contentAlignment",o3n="org.eclipse.elk.junctionPoints",s3n="org.eclipse.elk.edgeLabels.placement",h3n="org.eclipse.elk.port.index",f3n="org.eclipse.elk.commentBox",l3n="org.eclipse.elk.hypernode",b3n="org.eclipse.elk.port.anchor",w3n="org.eclipse.elk.partitioning.activate",d3n="org.eclipse.elk.partitioning.partition",g3n="org.eclipse.elk.position",p3n="org.eclipse.elk.margins",v3n="org.eclipse.elk.spacing.portsSurrounding",m3n="org.eclipse.elk.interactiveLayout",y3n="org.eclipse.elk.core.util",k3n={3:1,4:1,5:1,593:1},j3n="NETWORK_SIMPLEX",E3n={123:1,51:1},T3n="org.eclipse.elk.alg.layered.p1cycles",M3n="org.eclipse.elk.alg.layered.p2layers",S3n={402:1,225:1},P3n={832:1,3:1,4:1},C3n="org.eclipse.elk.alg.layered.p3order",I3n="org.eclipse.elk.alg.layered.p4nodes",O3n={3:1,4:1,5:1,840:1},A3n=1e-5,$3n="org.eclipse.elk.alg.layered.p4nodes.bk",L3n="org.eclipse.elk.alg.layered.p5edges",N3n="org.eclipse.elk.alg.layered.p5edges.orthogonal",x3n="org.eclipse.elk.alg.layered.p5edges.orthogonal.direction",D3n=1e-6,R3n="org.eclipse.elk.alg.layered.p5edges.splines",K3n=.09999999999999998,_3n=1e-8,F3n=4.71238898038469,B3n=3.141592653589793,H3n="org.eclipse.elk.alg.mrtree",q3n="org.eclipse.elk.alg.mrtree.graph",G3n="org.eclipse.elk.alg.mrtree.intermediate",z3n="Set neighbors in level",U3n="DESCENDANTS",X3n="org.eclipse.elk.mrtree.weighting",W3n="org.eclipse.elk.mrtree.searchOrder",V3n="org.eclipse.elk.alg.mrtree.options",Q3n="org.eclipse.elk.mrtree",Y3n="org.eclipse.elk.tree",J3n="org.eclipse.elk.alg.radial",Z3n=6.283185307179586,n4n=5e-324,t4n="org.eclipse.elk.alg.radial.intermediate",e4n="org.eclipse.elk.alg.radial.intermediate.compaction",i4n={3:1,4:1,5:1,106:1},r4n="org.eclipse.elk.alg.radial.intermediate.optimization",c4n="No implementation is available for the layout option ",a4n="org.eclipse.elk.alg.radial.options",u4n="org.eclipse.elk.radial.orderId",o4n="org.eclipse.elk.radial.radius",s4n="org.eclipse.elk.radial.compactor",h4n="org.eclipse.elk.radial.compactionStepSize",f4n="org.eclipse.elk.radial.sorter",l4n="org.eclipse.elk.radial.wedgeCriteria",b4n="org.eclipse.elk.radial.optimizationCriteria",w4n="org.eclipse.elk.radial",d4n="org.eclipse.elk.alg.radial.p1position.wedge",g4n="org.eclipse.elk.alg.radial.sorting",p4n=5.497787143782138,v4n=3.9269908169872414,m4n=2.356194490192345,y4n="org.eclipse.elk.alg.rectpacking",k4n="org.eclipse.elk.alg.rectpacking.firstiteration",j4n="org.eclipse.elk.alg.rectpacking.options",E4n="org.eclipse.elk.rectpacking.optimizationGoal",T4n="org.eclipse.elk.rectpacking.lastPlaceShift",M4n="org.eclipse.elk.rectpacking.currentPosition",S4n="org.eclipse.elk.rectpacking.desiredPosition",P4n="org.eclipse.elk.rectpacking.onlyFirstIteration",C4n="org.eclipse.elk.rectpacking.rowCompaction",I4n="org.eclipse.elk.rectpacking.expandToAspectRatio",O4n="org.eclipse.elk.rectpacking.targetWidth",A4n="org.eclipse.elk.expandNodes",$4n="org.eclipse.elk.rectpacking",L4n="org.eclipse.elk.alg.rectpacking.util",N4n="No implementation available for ",x4n="org.eclipse.elk.alg.spore",D4n="org.eclipse.elk.alg.spore.options",R4n="org.eclipse.elk.sporeCompaction",K4n="org.eclipse.elk.underlyingLayoutAlgorithm",_4n="org.eclipse.elk.processingOrder.treeConstruction",F4n="org.eclipse.elk.processingOrder.spanningTreeCostFunction",B4n="org.eclipse.elk.processingOrder.preferredRoot",H4n="org.eclipse.elk.processingOrder.rootSelection",q4n="org.eclipse.elk.structure.structureExtractionStrategy",G4n="org.eclipse.elk.compaction.compactionStrategy",z4n="org.eclipse.elk.compaction.orthogonal",U4n="org.eclipse.elk.overlapRemoval.maxIterations",X4n="org.eclipse.elk.overlapRemoval.runScanline",W4n="processingOrder",V4n="overlapRemoval",Q4n="org.eclipse.elk.sporeOverlap",Y4n="org.eclipse.elk.alg.spore.p1structure",J4n="org.eclipse.elk.alg.spore.p2processingorder",Z4n="org.eclipse.elk.alg.spore.p3execution",n5n="Invalid index: ",t5n="org.eclipse.elk.core.alg",e5n={331:1},i5n={288:1},r5n="Make sure its type is registered with the ",c5n=" utility class.",a5n="true",u5n="false",o5n="Couldn't clone property '",s5n=.05,h5n="org.eclipse.elk.core.options",f5n=1.2999999523162842,l5n="org.eclipse.elk.box",b5n="org.eclipse.elk.box.packingMode",w5n="org.eclipse.elk.algorithm",d5n="org.eclipse.elk.resolvedAlgorithm",g5n="org.eclipse.elk.bendPoints",p5n="org.eclipse.elk.labelManager",v5n="org.eclipse.elk.scaleFactor",m5n="org.eclipse.elk.animate",y5n="org.eclipse.elk.animTimeFactor",k5n="org.eclipse.elk.layoutAncestors",j5n="org.eclipse.elk.maxAnimTime",E5n="org.eclipse.elk.minAnimTime",T5n="org.eclipse.elk.progressBar",M5n="org.eclipse.elk.validateGraph",S5n="org.eclipse.elk.validateOptions",P5n="org.eclipse.elk.zoomToFit",C5n="org.eclipse.elk.font.name",I5n="org.eclipse.elk.font.size",O5n="org.eclipse.elk.edge.type",A5n="partitioning",$5n="nodeLabels",L5n="portAlignment",N5n="nodeSize",x5n="port",D5n="portLabels",R5n="insideSelfLoops",K5n="org.eclipse.elk.fixed",_5n="org.eclipse.elk.random",F5n="port must have a parent node to calculate the port side",B5n="The edge needs to have exactly one edge section. Found: ",H5n="org.eclipse.elk.core.util.adapters",q5n="org.eclipse.emf.ecore",G5n="org.eclipse.elk.graph",z5n="EMapPropertyHolder",U5n="ElkBendPoint",X5n="ElkGraphElement",W5n="ElkConnectableShape",V5n="ElkEdge",Q5n="ElkEdgeSection",Y5n="EModelElement",J5n="ENamedElement",Z5n="ElkLabel",n6n="ElkNode",t6n="ElkPort",e6n={92:1,90:1},i6n="org.eclipse.emf.common.notify.impl",r6n="The feature '",c6n="' is not a valid changeable feature",a6n="Expecting null",u6n="' is not a valid feature",o6n="The feature ID",s6n=" is not a valid feature ID",h6n=32768,f6n={105:1,92:1,90:1,56:1,49:1,97:1},l6n="org.eclipse.emf.ecore.impl",b6n="org.eclipse.elk.graph.impl",w6n="Recursive containment not allowed for ",d6n="The datatype '",g6n="' is not a valid classifier",p6n="The value '",v6n={190:1,3:1,4:1},m6n="The class '",y6n="http://www.eclipse.org/elk/ElkGraph",k6n=1024,j6n="property",E6n="value",T6n="source",M6n="properties",S6n="identifier",P6n="height",C6n="width",I6n="parent",O6n="text",A6n="children",$6n="hierarchical",L6n="sources",N6n="targets",x6n="sections",D6n="bendPoints",R6n="outgoingShape",K6n="incomingShape",_6n="outgoingSections",F6n="incomingSections",B6n="org.eclipse.emf.common.util",H6n="Severe implementation error in the Json to ElkGraph importer.",q6n="id",G6n="org.eclipse.elk.graph.json",z6n="Unhandled parameter types: ",U6n="startPoint",X6n="An edge must have at least one source and one target (edge id: '",W6n="').",V6n="Referenced edge section does not exist: ",Q6n=" (edge id: '",Y6n="target",J6n="sourcePoint",Z6n="targetPoint",n8n="group",t8n="name",e8n="connectableShape cannot be null",i8n="edge cannot be null",r8n="Passed edge is not 'simple'.",c8n="org.eclipse.elk.graph.util",a8n="The 'no duplicates' constraint is violated",u8n="targetIndex=",o8n=", size=",s8n="sourceIndex=",h8n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1},f8n={3:1,4:1,20:1,28:1,52:1,14:1,47:1,15:1,54:1,67:1,63:1,58:1,588:1},l8n="logging",b8n="measureExecutionTime",w8n="parser.parse.1",d8n="parser.parse.2",g8n="parser.next.1",p8n="parser.next.2",v8n="parser.next.3",m8n="parser.next.4",y8n="parser.factor.1",k8n="parser.factor.2",j8n="parser.factor.3",E8n="parser.factor.4",T8n="parser.factor.5",M8n="parser.factor.6",S8n="parser.atom.1",P8n="parser.atom.2",C8n="parser.atom.3",I8n="parser.atom.4",O8n="parser.atom.5",A8n="parser.cc.1",$8n="parser.cc.2",L8n="parser.cc.3",N8n="parser.cc.5",x8n="parser.cc.6",D8n="parser.cc.7",R8n="parser.cc.8",K8n="parser.ope.1",_8n="parser.ope.2",F8n="parser.ope.3",B8n="parser.descape.1",H8n="parser.descape.2",q8n="parser.descape.3",G8n="parser.descape.4",z8n="parser.descape.5",U8n="parser.process.1",X8n="parser.quantifier.1",W8n="parser.quantifier.2",V8n="parser.quantifier.3",Q8n="parser.quantifier.4",Y8n="parser.quantifier.5",J8n="org.eclipse.emf.common.notify",Z8n={415:1,672:1},n9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1},t9n={366:1,143:1},e9n="index=",i9n={3:1,4:1,5:1,126:1},r9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,58:1},c9n={3:1,6:1,4:1,5:1,192:1},a9n={3:1,4:1,5:1,165:1,367:1},u9n=";/?:@&=+$,",o9n="invalid authority: ",s9n="EAnnotation",h9n="ETypedElement",f9n="EStructuralFeature",l9n="EAttribute",b9n="EClassifier",w9n="EEnumLiteral",d9n="EGenericType",g9n="EOperation",p9n="EParameter",v9n="EReference",m9n="ETypeParameter",y9n="org.eclipse.emf.ecore.util",k9n={76:1},j9n={3:1,20:1,14:1,15:1,58:1,589:1,76:1,69:1,95:1},E9n="org.eclipse.emf.ecore.util.FeatureMap$Entry",T9n=8192,M9n=2048,S9n="byte",P9n="char",C9n="double",I9n="float",O9n="int",A9n="long",$9n="short",L9n="java.lang.Object",N9n={3:1,4:1,5:1,247:1},x9n={3:1,4:1,5:1,673:1},D9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,69:1},R9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,69:1,95:1},K9n="mixed",_9n="http:///org/eclipse/emf/ecore/util/ExtendedMetaData",F9n="kind",B9n={3:1,4:1,5:1,674:1},H9n={3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1,76:1,69:1,95:1},q9n={20:1,28:1,52:1,14:1,15:1,58:1,69:1},G9n={47:1,125:1,279:1},z9n={72:1,332:1},U9n="The value of type '",X9n="' must be of type '",W9n=1316,V9n="http://www.eclipse.org/emf/2002/Ecore",Q9n=-32768,Y9n="constraints",J9n="baseType",Z9n="getEStructuralFeature",n7n="getFeatureID",t7n="feature",e7n="getOperationID",i7n="operation",r7n="defaultValue",c7n="eTypeParameters",a7n="isInstance",u7n="getEEnumLiteral",o7n="eContainingClass",s7n={55:1},h7n={3:1,4:1,5:1,119:1},f7n="org.eclipse.emf.ecore.resource",l7n={92:1,90:1,591:1,1935:1},b7n="org.eclipse.emf.ecore.resource.impl",w7n="unspecified",d7n="simple",g7n="attribute",p7n="attributeWildcard",v7n="element",m7n="elementWildcard",y7n="collapse",k7n="itemType",j7n="namespace",E7n="##targetNamespace",T7n="whiteSpace",M7n="wildcards",S7n="http://www.eclipse.org/emf/2003/XMLType",P7n="##any",C7n="uninitialized",I7n="The multiplicity constraint is violated",O7n="org.eclipse.emf.ecore.xml.type",A7n="ProcessingInstruction",$7n="SimpleAnyType",L7n="XMLTypeDocumentRoot",N7n="org.eclipse.emf.ecore.xml.type.impl",x7n="INF",D7n="processing",R7n="ENTITIES_._base",K7n="minLength",_7n="ENTITY",F7n="NCName",B7n="IDREFS_._base",H7n="integer",q7n="token",G7n="pattern",z7n="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*",U7n="\\i\\c*",X7n="[\\i-[:]][\\c-[:]]*",W7n="nonPositiveInteger",V7n="maxInclusive",Q7n="NMTOKEN",Y7n="NMTOKENS_._base",J7n="nonNegativeInteger",Z7n="minInclusive",nnt="normalizedString",tnt="unsignedByte",ent="unsignedInt",int="18446744073709551615",rnt="unsignedShort",cnt="processingInstruction",ant="org.eclipse.emf.ecore.xml.type.internal",unt=1114111,ont="Internal Error: shorthands: \\u",snt="xml:isDigit",hnt="xml:isWord",fnt="xml:isSpace",lnt="xml:isNameChar",bnt="xml:isInitialNameChar",wnt="09\u0660\u0669\u06f0\u06f9\u0966\u096f\u09e6\u09ef\u0a66\u0a6f\u0ae6\u0aef\u0b66\u0b6f\u0be7\u0bef\u0c66\u0c6f\u0ce6\u0cef\u0d66\u0d6f\u0e50\u0e59\u0ed0\u0ed9\u0f20\u0f29",dnt="AZaz\xc0\xd6\xd8\xf6\xf8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u0386\u0386\u0388\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9\u0531\u0556\u0559\u0559\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06d5\u06e5\u06e6\u0905\u0939\u093d\u093d\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a5e\u0a5e\u0a72\u0a74\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9\u0abd\u0abd\u0ae0\u0ae0\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39\u0b3d\u0b3d\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cde\u0cde\u0ce0\u0ce1\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e30\u0e30\u0e32\u0e33\u0e40\u0e45\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb0\u0eb2\u0eb3\u0ebd\u0ebd\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69\u10a0\u10c5\u10d0\u10f6\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u2126\u2126\u212a\u212b\u212e\u212e\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30a1\u30fa\u3105\u312c\u4e00\u9fa5\uac00\ud7a3",gnt="Private Use",pnt="ASSIGNED",vnt="\0\x7f\x80\xff\u0100\u017f\u0180\u024f\u0250\u02af\u02b0\u02ff\u0300\u036f\u0370\u03ff\u0400\u04ff\u0530\u058f\u0590\u05ff\u0600\u06ff\u0700\u074f\u0780\u07bf\u0900\u097f\u0980\u09ff\u0a00\u0a7f\u0a80\u0aff\u0b00\u0b7f\u0b80\u0bff\u0c00\u0c7f\u0c80\u0cff\u0d00\u0d7f\u0d80\u0dff\u0e00\u0e7f\u0e80\u0eff\u0f00\u0fff\u1000\u109f\u10a0\u10ff\u1100\u11ff\u1200\u137f\u13a0\u13ff\u1400\u167f\u1680\u169f\u16a0\u16ff\u1780\u17ff\u1800\u18af\u1e00\u1eff\u1f00\u1fff\u2000\u206f\u2070\u209f\u20a0\u20cf\u20d0\u20ff\u2100\u214f\u2150\u218f\u2190\u21ff\u2200\u22ff\u2300\u23ff\u2400\u243f\u2440\u245f\u2460\u24ff\u2500\u257f\u2580\u259f\u25a0\u25ff\u2600\u26ff\u2700\u27bf\u2800\u28ff\u2e80\u2eff\u2f00\u2fdf\u2ff0\u2fff\u3000\u303f\u3040\u309f\u30a0\u30ff\u3100\u312f\u3130\u318f\u3190\u319f\u31a0\u31bf\u3200\u32ff\u3300\u33ff\u3400\u4db5\u4e00\u9fff\ua000\ua48f\ua490\ua4cf\uac00\ud7a3\ue000\uf8ff\uf900\ufaff\ufb00\ufb4f\ufb50\ufdff\ufe20\ufe2f\ufe30\ufe4f\ufe50\ufe6f\ufe70\ufefe\ufeff\ufeff\uff00\uffef",mnt="UNASSIGNED",ynt={3:1,117:1},knt="org.eclipse.emf.ecore.xml.type.util",jnt={3:1,4:1,5:1,368:1},Ent="org.eclipse.xtext.xbase.lib",Tnt="Cannot add elements to a Range",Mnt="Cannot set elements in a Range",Snt="Cannot remove elements from a Range",Pnt="locale",Cnt="default",Int="user.agent";e.goog=e.goog||{},e.goog.global=e.goog.global||e,WMn(),wAn(1,null,{},r),MWn.Fb=function(n){return FO(this,n)},MWn.Gb=function(){return this.gm},MWn.Hb=function(){return PN(this)},MWn.Ib=function(){return nE(tsn(this))+"@"+(nsn(this)>>>0).toString(16)},MWn.equals=function(n){return this.Fb(n)},MWn.hashCode=function(){return this.Hb()},MWn.toString=function(){return this.Ib()},wAn(290,1,{290:1,2026:1},pon),MWn.le=function(n){var t;return(t=new pon).i=4,t.c=n>1?gZ(this,n-1):this,t},MWn.me=function(){return ED(this),this.b},MWn.ne=function(){return nE(this)},MWn.oe=function(){return ED(this),this.k},MWn.pe=function(){return 0!=(4&this.i)},MWn.qe=function(){return 0!=(1&this.i)},MWn.Ib=function(){return utn(this)},MWn.i=0;var Ont,Ant=vX(RWn,"Object",1),$nt=vX(RWn,"Class",290);wAn(1998,1,KWn),vX(_Wn,"Optional",1998),wAn(1170,1998,KWn,c),MWn.Fb=function(n){return n===this},MWn.Hb=function(){return 2040732332},MWn.Ib=function(){return"Optional.absent()"},MWn.Jb=function(n){return yX(n),iy(),Ont},vX(_Wn,"Absent",1170),wAn(628,1,{},mk),vX(_Wn,"Joiner",628);var Lnt=bq(_Wn,"Predicate");wAn(582,1,{169:1,582:1,3:1,45:1},Hf),MWn.Mb=function(n){return Kon(this,n)},MWn.Lb=function(n){return Kon(this,n)},MWn.Fb=function(n){var t;return!!cL(n,582)&&(t=BB(n,582),NAn(this.a,t.a))},MWn.Hb=function(){return Fon(this.a)+306654252},MWn.Ib=function(){return wPn(this.a)},vX(_Wn,"Predicates/AndPredicate",582),wAn(408,1998,{408:1,3:1},qf),MWn.Fb=function(n){var t;return!!cL(n,408)&&(t=BB(n,408),Nfn(this.a,t.a))},MWn.Hb=function(){return 1502476572+nsn(this.a)},MWn.Ib=function(){return GWn+this.a+")"},MWn.Jb=function(n){return new qf(WQ(n.Kb(this.a),"the Function passed to Optional.transform() must not return null."))},vX(_Wn,"Present",408),wAn(198,1,UWn),MWn.Nb=function(n){fU(this,n)},MWn.Qb=function(){bk()},vX(XWn,"UnmodifiableIterator",198),wAn(1978,198,WWn),MWn.Qb=function(){bk()},MWn.Rb=function(n){throw Hp(new pv)},MWn.Wb=function(n){throw Hp(new pv)},vX(XWn,"UnmodifiableListIterator",1978),wAn(386,1978,WWn),MWn.Ob=function(){return this.c<this.d},MWn.Sb=function(){return this.c>0},MWn.Pb=function(){if(this.c>=this.d)throw Hp(new yv);return this.Xb(this.c++)},MWn.Tb=function(){return this.c},MWn.Ub=function(){if(this.c<=0)throw Hp(new yv);return this.Xb(--this.c)},MWn.Vb=function(){return this.c-1},MWn.c=0,MWn.d=0,vX(XWn,"AbstractIndexedListIterator",386),wAn(699,198,UWn),MWn.Ob=function(){return Zin(this)},MWn.Pb=function(){return P7(this)},MWn.e=1,vX(XWn,"AbstractIterator",699),wAn(1986,1,{224:1}),MWn.Zb=function(){return this.f||(this.f=this.ac())},MWn.Fb=function(n){return jsn(this,n)},MWn.Hb=function(){return nsn(this.Zb())},MWn.dc=function(){return 0==this.gc()},MWn.ec=function(){return gz(this)},MWn.Ib=function(){return Bbn(this.Zb())},vX(XWn,"AbstractMultimap",1986),wAn(726,1986,VWn),MWn.$b=function(){win(this)},MWn._b=function(n){return Wj(this,n)},MWn.ac=function(){return new pT(this,this.c)},MWn.ic=function(n){return this.hc()},MWn.bc=function(){return new HL(this,this.c)},MWn.jc=function(){return this.mc(this.hc())},MWn.kc=function(){return new Hm(this)},MWn.lc=function(){return qTn(this.c.vc().Nc(),new u,64,this.d)},MWn.cc=function(n){return h6(this,n)},MWn.fc=function(n){return Nhn(this,n)},MWn.gc=function(){return this.d},MWn.mc=function(n){return SQ(),new Hb(n)},MWn.nc=function(){return new Bm(this)},MWn.oc=function(){return qTn(this.c.Cc().Nc(),new a,64,this.d)},MWn.pc=function(n,t){return new W6(this,n,t,null)},MWn.d=0,vX(XWn,"AbstractMapBasedMultimap",726),wAn(1631,726,VWn),MWn.hc=function(){return new J6(this.a)},MWn.jc=function(){return SQ(),SQ(),set},MWn.cc=function(n){return BB(h6(this,n),15)},MWn.fc=function(n){return BB(Nhn(this,n),15)},MWn.Zb=function(){return OQ(this)},MWn.Fb=function(n){return jsn(this,n)},MWn.qc=function(n){return BB(h6(this,n),15)},MWn.rc=function(n){return BB(Nhn(this,n),15)},MWn.mc=function(n){return rY(BB(n,15))},MWn.pc=function(n,t){return i3(this,n,BB(t,15),null)},vX(XWn,"AbstractListMultimap",1631),wAn(732,1,QWn),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.c.Ob()||this.e.Ob()},MWn.Pb=function(){var n;return this.e.Ob()||(n=BB(this.c.Pb(),42),this.b=n.cd(),this.a=BB(n.dd(),14),this.e=this.a.Kc()),this.sc(this.b,this.e.Pb())},MWn.Qb=function(){this.e.Qb(),this.a.dc()&&this.c.Qb(),--this.d.d},vX(XWn,"AbstractMapBasedMultimap/Itr",732),wAn(1099,732,QWn,Bm),MWn.sc=function(n,t){return t},vX(XWn,"AbstractMapBasedMultimap/1",1099),wAn(1100,1,{},a),MWn.Kb=function(n){return BB(n,14).Nc()},vX(XWn,"AbstractMapBasedMultimap/1methodref$spliterator$Type",1100),wAn(1101,732,QWn,Hm),MWn.sc=function(n,t){return new vT(n,t)},vX(XWn,"AbstractMapBasedMultimap/2",1101);var Nnt=bq(YWn,"Map");wAn(1967,1,JWn),MWn.wc=function(n){nan(this,n)},MWn.yc=function(n,t,e){return Zln(this,n,t,e)},MWn.$b=function(){this.vc().$b()},MWn.tc=function(n){return Mmn(this,n)},MWn._b=function(n){return!!FEn(this,n,!1)},MWn.uc=function(n){var t,e;for(t=this.vc().Kc();t.Ob();)if(e=BB(t.Pb(),42).dd(),GI(n)===GI(e)||null!=n&&Nfn(n,e))return!0;return!1},MWn.Fb=function(n){var t,e,i;if(n===this)return!0;if(!cL(n,83))return!1;if(i=BB(n,83),this.gc()!=i.gc())return!1;for(e=i.vc().Kc();e.Ob();)if(t=BB(e.Pb(),42),!this.tc(t))return!1;return!0},MWn.xc=function(n){return qI(FEn(this,n,!1))},MWn.Hb=function(){return Hun(this.vc())},MWn.dc=function(){return 0==this.gc()},MWn.ec=function(){return new Cb(this)},MWn.zc=function(n,t){throw Hp(new tk("Put not supported on this map"))},MWn.Ac=function(n){Tcn(this,n)},MWn.Bc=function(n){return qI(FEn(this,n,!0))},MWn.gc=function(){return this.vc().gc()},MWn.Ib=function(){return nTn(this)},MWn.Cc=function(){return new Ob(this)},vX(YWn,"AbstractMap",1967),wAn(1987,1967,JWn),MWn.bc=function(){return new ST(this)},MWn.vc=function(){return dz(this)},MWn.ec=function(){return this.g||(this.g=this.bc())},MWn.Cc=function(){return this.i||(this.i=new PT(this))},vX(XWn,"Maps/ViewCachingAbstractMap",1987),wAn(389,1987,JWn,pT),MWn.xc=function(n){return ktn(this,n)},MWn.Bc=function(n){return Zsn(this,n)},MWn.$b=function(){this.d==this.e.c?this.e.$b():Cq(new Oq(this))},MWn._b=function(n){return gfn(this.d,n)},MWn.Ec=function(){return new Xf(this)},MWn.Dc=function(){return this.Ec()},MWn.Fb=function(n){return this===n||Nfn(this.d,n)},MWn.Hb=function(){return nsn(this.d)},MWn.ec=function(){return this.e.ec()},MWn.gc=function(){return this.d.gc()},MWn.Ib=function(){return Bbn(this.d)},vX(XWn,"AbstractMapBasedMultimap/AsMap",389);var xnt=bq(RWn,"Iterable");wAn(28,1,ZWn),MWn.Jc=function(n){e5(this,n)},MWn.Lc=function(){return this.Oc()},MWn.Nc=function(){return new w1(this,0)},MWn.Oc=function(){return new Rq(null,this.Nc())},MWn.Fc=function(n){throw Hp(new tk("Add not supported on this collection"))},MWn.Gc=function(n){return Frn(this,n)},MWn.$b=function(){TV(this)},MWn.Hc=function(n){return ywn(this,n,!1)},MWn.Ic=function(n){return oun(this,n)},MWn.dc=function(){return 0==this.gc()},MWn.Mc=function(n){return ywn(this,n,!0)},MWn.Pc=function(){return cz(this)},MWn.Qc=function(n){return Emn(this,n)},MWn.Ib=function(){return LMn(this)},vX(YWn,"AbstractCollection",28);var Dnt=bq(YWn,"Set");wAn(nVn,28,tVn),MWn.Nc=function(){return new w1(this,1)},MWn.Fb=function(n){return ign(this,n)},MWn.Hb=function(){return Hun(this)},vX(YWn,"AbstractSet",nVn),wAn(1970,nVn,tVn),vX(XWn,"Sets/ImprovedAbstractSet",1970),wAn(1971,1970,tVn),MWn.$b=function(){this.Rc().$b()},MWn.Hc=function(n){return idn(this,n)},MWn.dc=function(){return this.Rc().dc()},MWn.Mc=function(n){var t;return!!this.Hc(n)&&(t=BB(n,42),this.Rc().ec().Mc(t.cd()))},MWn.gc=function(){return this.Rc().gc()},vX(XWn,"Maps/EntrySet",1971),wAn(1097,1971,tVn,Xf),MWn.Hc=function(n){return wfn(this.a.d.vc(),n)},MWn.Kc=function(){return new Oq(this.a)},MWn.Rc=function(){return this.a},MWn.Mc=function(n){var t;return!!wfn(this.a.d.vc(),n)&&(t=BB(n,42),H5(this.a.e,t.cd()),!0)},MWn.Nc=function(){return RB(this.a.d.vc().Nc(),new Wf(this.a))},vX(XWn,"AbstractMapBasedMultimap/AsMap/AsMapEntries",1097),wAn(1098,1,{},Wf),MWn.Kb=function(n){return i5(this.a,BB(n,42))},vX(XWn,"AbstractMapBasedMultimap/AsMap/AsMapEntries/0methodref$wrapEntry$Type",1098),wAn(730,1,QWn,Oq),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){var n;return n=BB(this.b.Pb(),42),this.a=BB(n.dd(),14),i5(this.c,n)},MWn.Ob=function(){return this.b.Ob()},MWn.Qb=function(){han(!!this.a),this.b.Qb(),this.c.e.d-=this.a.gc(),this.a.$b(),this.a=null},vX(XWn,"AbstractMapBasedMultimap/AsMap/AsMapIterator",730),wAn(532,1970,tVn,ST),MWn.$b=function(){this.b.$b()},MWn.Hc=function(n){return this.b._b(n)},MWn.Jc=function(n){yX(n),this.b.wc(new vl(n))},MWn.dc=function(){return this.b.dc()},MWn.Kc=function(){return new ly(this.b.vc().Kc())},MWn.Mc=function(n){return!!this.b._b(n)&&(this.b.Bc(n),!0)},MWn.gc=function(){return this.b.gc()},vX(XWn,"Maps/KeySet",532),wAn(318,532,tVn,HL),MWn.$b=function(){Cq(new eT(this,this.b.vc().Kc()))},MWn.Ic=function(n){return this.b.ec().Ic(n)},MWn.Fb=function(n){return this===n||Nfn(this.b.ec(),n)},MWn.Hb=function(){return nsn(this.b.ec())},MWn.Kc=function(){return new eT(this,this.b.vc().Kc())},MWn.Mc=function(n){var t,e;return e=0,(t=BB(this.b.Bc(n),14))&&(e=t.gc(),t.$b(),this.a.d-=e),e>0},MWn.Nc=function(){return this.b.ec().Nc()},vX(XWn,"AbstractMapBasedMultimap/KeySet",318),wAn(731,1,QWn,eT),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.c.Ob()},MWn.Pb=function(){return this.a=BB(this.c.Pb(),42),this.a.cd()},MWn.Qb=function(){var n;han(!!this.a),n=BB(this.a.dd(),14),this.c.Qb(),this.b.a.d-=n.gc(),n.$b(),this.a=null},vX(XWn,"AbstractMapBasedMultimap/KeySet/1",731),wAn(491,389,{83:1,161:1},CD),MWn.bc=function(){return this.Sc()},MWn.ec=function(){return this.Tc()},MWn.Sc=function(){return new nT(this.c,this.Uc())},MWn.Tc=function(){return this.b||(this.b=this.Sc())},MWn.Uc=function(){return BB(this.d,161)},vX(XWn,"AbstractMapBasedMultimap/SortedAsMap",491),wAn(542,491,eVn,ID),MWn.bc=function(){return new tT(this.a,BB(BB(this.d,161),171))},MWn.Sc=function(){return new tT(this.a,BB(BB(this.d,161),171))},MWn.ec=function(){return BB(this.b||(this.b=new tT(this.a,BB(BB(this.d,161),171))),271)},MWn.Tc=function(){return BB(this.b||(this.b=new tT(this.a,BB(BB(this.d,161),171))),271)},MWn.Uc=function(){return BB(BB(this.d,161),171)},vX(XWn,"AbstractMapBasedMultimap/NavigableAsMap",542),wAn(490,318,iVn,nT),MWn.Nc=function(){return this.b.ec().Nc()},vX(XWn,"AbstractMapBasedMultimap/SortedKeySet",490),wAn(388,490,rVn,tT),vX(XWn,"AbstractMapBasedMultimap/NavigableKeySet",388),wAn(541,28,ZWn,W6),MWn.Fc=function(n){var t,e;return zbn(this),e=this.d.dc(),(t=this.d.Fc(n))&&(++this.f.d,e&&jR(this)),t},MWn.Gc=function(n){var t,e,i;return!n.dc()&&(zbn(this),i=this.d.gc(),(t=this.d.Gc(n))&&(e=this.d.gc(),this.f.d+=e-i,0==i&&jR(this)),t)},MWn.$b=function(){var n;zbn(this),0!=(n=this.d.gc())&&(this.d.$b(),this.f.d-=n,$G(this))},MWn.Hc=function(n){return zbn(this),this.d.Hc(n)},MWn.Ic=function(n){return zbn(this),this.d.Ic(n)},MWn.Fb=function(n){return n===this||(zbn(this),Nfn(this.d,n))},MWn.Hb=function(){return zbn(this),nsn(this.d)},MWn.Kc=function(){return zbn(this),new QB(this)},MWn.Mc=function(n){var t;return zbn(this),(t=this.d.Mc(n))&&(--this.f.d,$G(this)),t},MWn.gc=function(){return tO(this)},MWn.Nc=function(){return zbn(this),this.d.Nc()},MWn.Ib=function(){return zbn(this),Bbn(this.d)},vX(XWn,"AbstractMapBasedMultimap/WrappedCollection",541);var Rnt=bq(YWn,"List");wAn(728,541,{20:1,28:1,14:1,15:1},sz),MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return zbn(this),this.d.Nc()},MWn.Vc=function(n,t){var e;zbn(this),e=this.d.dc(),BB(this.d,15).Vc(n,t),++this.a.d,e&&jR(this)},MWn.Wc=function(n,t){var e,i,r;return!t.dc()&&(zbn(this),r=this.d.gc(),(e=BB(this.d,15).Wc(n,t))&&(i=this.d.gc(),this.a.d+=i-r,0==r&&jR(this)),e)},MWn.Xb=function(n){return zbn(this),BB(this.d,15).Xb(n)},MWn.Xc=function(n){return zbn(this),BB(this.d,15).Xc(n)},MWn.Yc=function(){return zbn(this),new g$(this)},MWn.Zc=function(n){return zbn(this),new gQ(this,n)},MWn.$c=function(n){var t;return zbn(this),t=BB(this.d,15).$c(n),--this.a.d,$G(this),t},MWn._c=function(n,t){return zbn(this),BB(this.d,15)._c(n,t)},MWn.bd=function(n,t){return zbn(this),i3(this.a,this.e,BB(this.d,15).bd(n,t),this.b?this.b:this)},vX(XWn,"AbstractMapBasedMultimap/WrappedList",728),wAn(1096,728,{20:1,28:1,14:1,15:1,54:1},Ox),vX(XWn,"AbstractMapBasedMultimap/RandomAccessWrappedList",1096),wAn(620,1,QWn,QB),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return MV(this),this.b.Ob()},MWn.Pb=function(){return MV(this),this.b.Pb()},MWn.Qb=function(){eN(this)},vX(XWn,"AbstractMapBasedMultimap/WrappedCollection/WrappedIterator",620),wAn(729,620,cVn,g$,gQ),MWn.Qb=function(){eN(this)},MWn.Rb=function(n){var t;t=0==tO(this.a),(MV(this),BB(this.b,125)).Rb(n),++this.a.a.d,t&&jR(this.a)},MWn.Sb=function(){return(MV(this),BB(this.b,125)).Sb()},MWn.Tb=function(){return(MV(this),BB(this.b,125)).Tb()},MWn.Ub=function(){return(MV(this),BB(this.b,125)).Ub()},MWn.Vb=function(){return(MV(this),BB(this.b,125)).Vb()},MWn.Wb=function(n){(MV(this),BB(this.b,125)).Wb(n)},vX(XWn,"AbstractMapBasedMultimap/WrappedList/WrappedListIterator",729),wAn(727,541,iVn,ND),MWn.Nc=function(){return zbn(this),this.d.Nc()},vX(XWn,"AbstractMapBasedMultimap/WrappedSortedSet",727),wAn(1095,727,rVn,AA),vX(XWn,"AbstractMapBasedMultimap/WrappedNavigableSet",1095),wAn(1094,541,tVn,xD),MWn.Nc=function(){return zbn(this),this.d.Nc()},vX(XWn,"AbstractMapBasedMultimap/WrappedSet",1094),wAn(1103,1,{},u),MWn.Kb=function(n){return F6(BB(n,42))},vX(XWn,"AbstractMapBasedMultimap/lambda$1$Type",1103),wAn(1102,1,{},Vf),MWn.Kb=function(n){return new vT(this.a,n)},vX(XWn,"AbstractMapBasedMultimap/lambda$2$Type",1102);var Knt,_nt,Fnt,Bnt,Hnt=bq(YWn,"Map/Entry");wAn(345,1,aVn),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),wW(this.cd(),t.cd())&&wW(this.dd(),t.dd()))},MWn.Hb=function(){var n,t;return n=this.cd(),t=this.dd(),(null==n?0:nsn(n))^(null==t?0:nsn(t))},MWn.ed=function(n){throw Hp(new pv)},MWn.Ib=function(){return this.cd()+"="+this.dd()},vX(XWn,uVn,345),wAn(1988,28,ZWn),MWn.$b=function(){this.fd().$b()},MWn.Hc=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),H0(this.fd(),t.cd(),t.dd()))},MWn.Mc=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),q0(this.fd(),t.cd(),t.dd()))},MWn.gc=function(){return this.fd().d},vX(XWn,"Multimaps/Entries",1988),wAn(733,1988,ZWn,Qf),MWn.Kc=function(){return this.a.kc()},MWn.fd=function(){return this.a},MWn.Nc=function(){return this.a.lc()},vX(XWn,"AbstractMultimap/Entries",733),wAn(734,733,tVn,qm),MWn.Nc=function(){return this.a.lc()},MWn.Fb=function(n){return zSn(this,n)},MWn.Hb=function(){return Brn(this)},vX(XWn,"AbstractMultimap/EntrySet",734),wAn(735,28,ZWn,Yf),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return Isn(this.a,n)},MWn.Kc=function(){return this.a.nc()},MWn.gc=function(){return this.a.d},MWn.Nc=function(){return this.a.oc()},vX(XWn,"AbstractMultimap/Values",735),wAn(1989,28,{835:1,20:1,28:1,14:1}),MWn.Jc=function(n){yX(n),EV(this).Jc(new pl(n))},MWn.Nc=function(){var n;return qTn(n=EV(this).Nc(),new y,64|1296&n.qd(),this.a.d)},MWn.Fc=function(n){return wk(),!0},MWn.Gc=function(n){return yX(this),yX(n),cL(n,543)?l2(BB(n,835)):!n.dc()&&fnn(this,n.Kc())},MWn.Hc=function(n){var t;return((t=BB(lfn(OQ(this.a),n),14))?t.gc():0)>0},MWn.Fb=function(n){return h$n(this,n)},MWn.Hb=function(){return nsn(EV(this))},MWn.dc=function(){return EV(this).dc()},MWn.Mc=function(n){return EIn(this,n,1)>0},MWn.Ib=function(){return Bbn(EV(this))},vX(XWn,"AbstractMultiset",1989),wAn(1991,1970,tVn),MWn.$b=function(){win(this.a.a)},MWn.Hc=function(n){var t;return!(!cL(n,492)||(t=BB(n,416),BB(t.a.dd(),14).gc()<=0||c1(this.a,t.a.cd())!=BB(t.a.dd(),14).gc()))},MWn.Mc=function(n){var t,e,i;return!(!cL(n,492)||(t=(e=BB(n,416)).a.cd(),0==(i=BB(e.a.dd(),14).gc())))&&TIn(this.a,t,i)},vX(XWn,"Multisets/EntrySet",1991),wAn(1109,1991,tVn,Jf),MWn.Kc=function(){return new wy(dz(OQ(this.a.a)).Kc())},MWn.gc=function(){return OQ(this.a.a).gc()},vX(XWn,"AbstractMultiset/EntrySet",1109),wAn(619,726,VWn),MWn.hc=function(){return this.gd()},MWn.jc=function(){return this.hd()},MWn.cc=function(n){return this.jd(n)},MWn.fc=function(n){return this.kd(n)},MWn.Zb=function(){return this.f||(this.f=this.ac())},MWn.hd=function(){return SQ(),SQ(),fet},MWn.Fb=function(n){return jsn(this,n)},MWn.jd=function(n){return BB(h6(this,n),21)},MWn.kd=function(n){return BB(Nhn(this,n),21)},MWn.mc=function(n){return SQ(),new Ak(BB(n,21))},MWn.pc=function(n,t){return new xD(this,n,BB(t,21))},vX(XWn,"AbstractSetMultimap",619),wAn(1657,619,VWn),MWn.hc=function(){return new dE(this.b)},MWn.gd=function(){return new dE(this.b)},MWn.jc=function(){return IX(new dE(this.b))},MWn.hd=function(){return IX(new dE(this.b))},MWn.cc=function(n){return BB(BB(h6(this,n),21),84)},MWn.jd=function(n){return BB(BB(h6(this,n),21),84)},MWn.fc=function(n){return BB(BB(Nhn(this,n),21),84)},MWn.kd=function(n){return BB(BB(Nhn(this,n),21),84)},MWn.mc=function(n){return cL(n,271)?IX(BB(n,271)):(SQ(),new dN(BB(n,84)))},MWn.Zb=function(){return this.f||(this.f=cL(this.c,171)?new ID(this,BB(this.c,171)):cL(this.c,161)?new CD(this,BB(this.c,161)):new pT(this,this.c))},MWn.pc=function(n,t){return cL(t,271)?new AA(this,n,BB(t,271)):new ND(this,n,BB(t,84))},vX(XWn,"AbstractSortedSetMultimap",1657),wAn(1658,1657,VWn),MWn.Zb=function(){return BB(BB(this.f||(this.f=cL(this.c,171)?new ID(this,BB(this.c,171)):cL(this.c,161)?new CD(this,BB(this.c,161)):new pT(this,this.c)),161),171)},MWn.ec=function(){return BB(BB(this.i||(this.i=cL(this.c,171)?new tT(this,BB(this.c,171)):cL(this.c,161)?new nT(this,BB(this.c,161)):new HL(this,this.c)),84),271)},MWn.bc=function(){return cL(this.c,171)?new tT(this,BB(this.c,171)):cL(this.c,161)?new nT(this,BB(this.c,161)):new HL(this,this.c)},vX(XWn,"AbstractSortedKeySortedSetMultimap",1658),wAn(2010,1,{1947:1}),MWn.Fb=function(n){return Cjn(this,n)},MWn.Hb=function(){return Hun(this.g||(this.g=new Zf(this)))},MWn.Ib=function(){return nTn(this.f||(this.f=new UL(this)))},vX(XWn,"AbstractTable",2010),wAn(665,nVn,tVn,Zf),MWn.$b=function(){dk()},MWn.Hc=function(n){var t,e;return!!cL(n,468)&&(t=BB(n,682),!!(e=BB(lfn(jX(this.a),WI(t.c.e,t.b)),83))&&wfn(e.vc(),new vT(WI(t.c.c,t.a),U6(t.c,t.b,t.a))))},MWn.Kc=function(){return ZQ(this.a)},MWn.Mc=function(n){var t,e;return!!cL(n,468)&&(t=BB(n,682),!!(e=BB(lfn(jX(this.a),WI(t.c.e,t.b)),83))&&dfn(e.vc(),new vT(WI(t.c.c,t.a),U6(t.c,t.b,t.a))))},MWn.gc=function(){return zq(this.a)},MWn.Nc=function(){return P2(this.a)},vX(XWn,"AbstractTable/CellSet",665),wAn(1928,28,ZWn,nl),MWn.$b=function(){dk()},MWn.Hc=function(n){return hTn(this.a,n)},MWn.Kc=function(){return nY(this.a)},MWn.gc=function(){return zq(this.a)},MWn.Nc=function(){return Y0(this.a)},vX(XWn,"AbstractTable/Values",1928),wAn(1632,1631,VWn),vX(XWn,"ArrayListMultimapGwtSerializationDependencies",1632),wAn(513,1632,VWn,ok,o1),MWn.hc=function(){return new J6(this.a)},MWn.a=0,vX(XWn,"ArrayListMultimap",513),wAn(664,2010,{664:1,1947:1,3:1},vOn),vX(XWn,"ArrayTable",664),wAn(1924,386,WWn,qL),MWn.Xb=function(n){return new gon(this.a,n)},vX(XWn,"ArrayTable/1",1924),wAn(1925,1,{},Gf),MWn.ld=function(n){return new gon(this.a,n)},vX(XWn,"ArrayTable/1methodref$getCell$Type",1925),wAn(2011,1,{682:1}),MWn.Fb=function(n){var t;return n===this||!!cL(n,468)&&(t=BB(n,682),wW(WI(this.c.e,this.b),WI(t.c.e,t.b))&&wW(WI(this.c.c,this.a),WI(t.c.c,t.a))&&wW(U6(this.c,this.b,this.a),U6(t.c,t.b,t.a)))},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[WI(this.c.e,this.b),WI(this.c.c,this.a),U6(this.c,this.b,this.a)]))},MWn.Ib=function(){return"("+WI(this.c.e,this.b)+","+WI(this.c.c,this.a)+")="+U6(this.c,this.b,this.a)},vX(XWn,"Tables/AbstractCell",2011),wAn(468,2011,{468:1,682:1},gon),MWn.a=0,MWn.b=0,MWn.d=0,vX(XWn,"ArrayTable/2",468),wAn(1927,1,{},zf),MWn.ld=function(n){return Y9(this.a,n)},vX(XWn,"ArrayTable/2methodref$getValue$Type",1927),wAn(1926,386,WWn,GL),MWn.Xb=function(n){return Y9(this.a,n)},vX(XWn,"ArrayTable/3",1926),wAn(1979,1967,JWn),MWn.$b=function(){Cq(this.kc())},MWn.vc=function(){return new ml(this)},MWn.lc=function(){return new CV(this.kc(),this.gc())},vX(XWn,"Maps/IteratorBasedAbstractMap",1979),wAn(828,1979,JWn),MWn.$b=function(){throw Hp(new pv)},MWn._b=function(n){return Yj(this.c,n)},MWn.kc=function(){return new zL(this,this.c.b.c.gc())},MWn.lc=function(){return yq(this.c.b.c.gc(),16,new Uf(this))},MWn.xc=function(n){var t;return(t=BB(UK(this.c,n),19))?this.nd(t.a):null},MWn.dc=function(){return this.c.b.c.dc()},MWn.ec=function(){return bz(this.c)},MWn.zc=function(n,t){var e;if(!(e=BB(UK(this.c,n),19)))throw Hp(new _y(this.md()+" "+n+" not in "+bz(this.c)));return this.od(e.a,t)},MWn.Bc=function(n){throw Hp(new pv)},MWn.gc=function(){return this.c.b.c.gc()},vX(XWn,"ArrayTable/ArrayMap",828),wAn(1923,1,{},Uf),MWn.ld=function(n){return OX(this.a,n)},vX(XWn,"ArrayTable/ArrayMap/0methodref$getEntry$Type",1923),wAn(1921,345,aVn,sT),MWn.cd=function(){return YL(this.a,this.b)},MWn.dd=function(){return this.a.nd(this.b)},MWn.ed=function(n){return this.a.od(this.b,n)},MWn.b=0,vX(XWn,"ArrayTable/ArrayMap/1",1921),wAn(1922,386,WWn,zL),MWn.Xb=function(n){return OX(this.a,n)},vX(XWn,"ArrayTable/ArrayMap/2",1922),wAn(1920,828,JWn,cU),MWn.md=function(){return"Column"},MWn.nd=function(n){return U6(this.b,this.a,n)},MWn.od=function(n,t){return Sun(this.b,this.a,n,t)},MWn.a=0,vX(XWn,"ArrayTable/Row",1920),wAn(829,828,JWn,UL),MWn.nd=function(n){return new cU(this.a,n)},MWn.zc=function(n,t){return BB(t,83),gk()},MWn.od=function(n,t){return BB(t,83),pk()},MWn.md=function(){return"Row"},vX(XWn,"ArrayTable/RowMap",829),wAn(1120,1,fVn,hT),MWn.qd=function(){return-262&this.a.qd()},MWn.rd=function(){return this.a.rd()},MWn.Nb=function(n){this.a.Nb(new cT(n,this.b))},MWn.sd=function(n){return this.a.sd(new rT(n,this.b))},vX(XWn,"CollectSpliterators/1",1120),wAn(1121,1,lVn,rT),MWn.td=function(n){this.a.td(this.b.Kb(n))},vX(XWn,"CollectSpliterators/1/lambda$0$Type",1121),wAn(1122,1,lVn,cT),MWn.td=function(n){this.a.td(this.b.Kb(n))},vX(XWn,"CollectSpliterators/1/lambda$1$Type",1122),wAn(1123,1,fVn,q2),MWn.qd=function(){return this.a},MWn.rd=function(){return this.d&&(this.b=T$(this.b,this.d.rd())),T$(this.b,0)},MWn.Nb=function(n){this.d&&(this.d.Nb(n),this.d=null),this.c.Nb(new iT(this.e,n)),this.b=0},MWn.sd=function(n){for(;;){if(this.d&&this.d.sd(n))return JI(this.b,bVn)&&(this.b=ibn(this.b,1)),!0;if(this.d=null,!this.c.sd(new aT(this,this.e)))return!1}},MWn.a=0,MWn.b=0,vX(XWn,"CollectSpliterators/1FlatMapSpliterator",1123),wAn(1124,1,lVn,aT),MWn.td=function(n){dK(this.a,this.b,n)},vX(XWn,"CollectSpliterators/1FlatMapSpliterator/lambda$0$Type",1124),wAn(1125,1,lVn,iT),MWn.td=function(n){oL(this.b,this.a,n)},vX(XWn,"CollectSpliterators/1FlatMapSpliterator/lambda$1$Type",1125),wAn(1117,1,fVn,wK),MWn.qd=function(){return 16464|this.b},MWn.rd=function(){return this.a.rd()},MWn.Nb=function(n){this.a.xe(new oT(n,this.c))},MWn.sd=function(n){return this.a.ye(new uT(n,this.c))},MWn.b=0,vX(XWn,"CollectSpliterators/1WithCharacteristics",1117),wAn(1118,1,wVn,uT),MWn.ud=function(n){this.a.td(this.b.ld(n))},vX(XWn,"CollectSpliterators/1WithCharacteristics/lambda$0$Type",1118),wAn(1119,1,wVn,oT),MWn.ud=function(n){this.a.td(this.b.ld(n))},vX(XWn,"CollectSpliterators/1WithCharacteristics/lambda$1$Type",1119),wAn(245,1,dVn),MWn.wd=function(n){return this.vd(BB(n,245))},MWn.vd=function(n){var t;return n==(ty(),_nt)?1:n==(ey(),Knt)?-1:(nq(),0!=(t=Ncn(this.a,n.a))?t:cL(this,519)==cL(n,519)?0:cL(this,519)?1:-1)},MWn.zd=function(){return this.a},MWn.Fb=function(n){return xdn(this,n)},vX(XWn,"Cut",245),wAn(1761,245,dVn,Nk),MWn.vd=function(n){return n==this?0:1},MWn.xd=function(n){throw Hp(new hv)},MWn.yd=function(n){n.a+="+\u221e)"},MWn.zd=function(){throw Hp(new Fy(gVn))},MWn.Hb=function(){return $T(),evn(this)},MWn.Ad=function(n){return!1},MWn.Ib=function(){return"+\u221e"},vX(XWn,"Cut/AboveAll",1761),wAn(519,245,{245:1,519:1,3:1,35:1},iN),MWn.xd=function(n){uO((n.a+="(",n),this.a)},MWn.yd=function(n){xX(uO(n,this.a),93)},MWn.Hb=function(){return~nsn(this.a)},MWn.Ad=function(n){return nq(),Ncn(this.a,n)<0},MWn.Ib=function(){return"/"+this.a+"\\"},vX(XWn,"Cut/AboveValue",519),wAn(1760,245,dVn,xk),MWn.vd=function(n){return n==this?0:-1},MWn.xd=function(n){n.a+="(-\u221e"},MWn.yd=function(n){throw Hp(new hv)},MWn.zd=function(){throw Hp(new Fy(gVn))},MWn.Hb=function(){return $T(),evn(this)},MWn.Ad=function(n){return!0},MWn.Ib=function(){return"-\u221e"},vX(XWn,"Cut/BelowAll",1760),wAn(1762,245,dVn,rN),MWn.xd=function(n){uO((n.a+="[",n),this.a)},MWn.yd=function(n){xX(uO(n,this.a),41)},MWn.Hb=function(){return nsn(this.a)},MWn.Ad=function(n){return nq(),Ncn(this.a,n)<=0},MWn.Ib=function(){return"\\"+this.a+"/"},vX(XWn,"Cut/BelowValue",1762),wAn(537,1,pVn),MWn.Jc=function(n){e5(this,n)},MWn.Ib=function(){return Hln(BB(WQ(this,"use Optional.orNull() instead of Optional.or(null)"),20).Kc())},vX(XWn,"FluentIterable",537),wAn(433,537,pVn,OO),MWn.Kc=function(){return new oz(ZL(this.a.Kc(),new h))},vX(XWn,"FluentIterable/2",433),wAn(1046,537,pVn,AO),MWn.Kc=function(){return NU(this)},vX(XWn,"FluentIterable/3",1046),wAn(708,386,WWn,WL),MWn.Xb=function(n){return this.a[n].Kc()},vX(XWn,"FluentIterable/3/1",708),wAn(1972,1,{}),MWn.Ib=function(){return Bbn(this.Bd().b)},vX(XWn,"ForwardingObject",1972),wAn(1973,1972,vVn),MWn.Bd=function(){return this.Cd()},MWn.Jc=function(n){e5(this,n)},MWn.Lc=function(){return this.Oc()},MWn.Nc=function(){return new w1(this,0)},MWn.Oc=function(){return new Rq(null,this.Nc())},MWn.Fc=function(n){return this.Cd(),oE()},MWn.Gc=function(n){return this.Cd(),sE()},MWn.$b=function(){this.Cd(),hE()},MWn.Hc=function(n){return this.Cd().Hc(n)},MWn.Ic=function(n){return this.Cd().Ic(n)},MWn.dc=function(){return this.Cd().b.dc()},MWn.Kc=function(){return this.Cd().Kc()},MWn.Mc=function(n){return this.Cd(),fE()},MWn.gc=function(){return this.Cd().b.gc()},MWn.Pc=function(){return this.Cd().Pc()},MWn.Qc=function(n){return this.Cd().Qc(n)},vX(XWn,"ForwardingCollection",1973),wAn(1980,28,mVn),MWn.Kc=function(){return this.Ed()},MWn.Fc=function(n){throw Hp(new pv)},MWn.Gc=function(n){throw Hp(new pv)},MWn.$b=function(){throw Hp(new pv)},MWn.Hc=function(n){return null!=n&&ywn(this,n,!1)},MWn.Dd=function(){switch(this.gc()){case 0:return WX(),WX(),Fnt;case 1:return WX(),new Pq(yX(this.Ed().Pb()));default:return new aU(this,this.Pc())}},MWn.Mc=function(n){throw Hp(new pv)},vX(XWn,"ImmutableCollection",1980),wAn(712,1980,mVn,rv),MWn.Kc=function(){return L9(this.a.Kc())},MWn.Hc=function(n){return null!=n&&this.a.Hc(n)},MWn.Ic=function(n){return this.a.Ic(n)},MWn.dc=function(){return this.a.dc()},MWn.Ed=function(){return L9(this.a.Kc())},MWn.gc=function(){return this.a.gc()},MWn.Pc=function(){return this.a.Pc()},MWn.Qc=function(n){return this.a.Qc(n)},MWn.Ib=function(){return Bbn(this.a)},vX(XWn,"ForwardingImmutableCollection",712),wAn(152,1980,yVn),MWn.Kc=function(){return this.Ed()},MWn.Yc=function(){return this.Fd(0)},MWn.Zc=function(n){return this.Fd(n)},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.bd=function(n,t){return this.Gd(n,t)},MWn.Vc=function(n,t){throw Hp(new pv)},MWn.Wc=function(n,t){throw Hp(new pv)},MWn.Fb=function(n){return qAn(this,n)},MWn.Hb=function(){return Ian(this)},MWn.Xc=function(n){return null==n?-1:Tmn(this,n)},MWn.Ed=function(){return this.Fd(0)},MWn.Fd=function(n){return ix(this,n)},MWn.$c=function(n){throw Hp(new pv)},MWn._c=function(n,t){throw Hp(new pv)},MWn.Gd=function(n,t){return sfn(new s1(new IT(this),n,t))},vX(XWn,"ImmutableList",152),wAn(2006,152,yVn),MWn.Kc=function(){return L9(this.Hd().Kc())},MWn.bd=function(n,t){return sfn(this.Hd().bd(n,t))},MWn.Hc=function(n){return null!=n&&this.Hd().Hc(n)},MWn.Ic=function(n){return this.Hd().Ic(n)},MWn.Fb=function(n){return Nfn(this.Hd(),n)},MWn.Xb=function(n){return WI(this,n)},MWn.Hb=function(){return nsn(this.Hd())},MWn.Xc=function(n){return this.Hd().Xc(n)},MWn.dc=function(){return this.Hd().dc()},MWn.Ed=function(){return L9(this.Hd().Kc())},MWn.gc=function(){return this.Hd().gc()},MWn.Gd=function(n,t){return sfn(this.Hd().bd(n,t))},MWn.Pc=function(){return this.Hd().Qc(x8(Ant,HWn,1,this.Hd().gc(),5,1))},MWn.Qc=function(n){return this.Hd().Qc(n)},MWn.Ib=function(){return Bbn(this.Hd())},vX(XWn,"ForwardingImmutableList",2006),wAn(714,1,jVn),MWn.vc=function(){return lz(this)},MWn.wc=function(n){nan(this,n)},MWn.ec=function(){return bz(this)},MWn.yc=function(n,t,e){return Zln(this,n,t,e)},MWn.Cc=function(){return this.Ld()},MWn.$b=function(){throw Hp(new pv)},MWn._b=function(n){return null!=this.xc(n)},MWn.uc=function(n){return this.Ld().Hc(n)},MWn.Jd=function(){return new cv(this)},MWn.Kd=function(){return new av(this)},MWn.Fb=function(n){return $sn(this,n)},MWn.Hb=function(){return lz(this).Hb()},MWn.dc=function(){return 0==this.gc()},MWn.zc=function(n,t){return vk()},MWn.Bc=function(n){throw Hp(new pv)},MWn.Ib=function(){return fSn(this)},MWn.Ld=function(){return this.e?this.e:this.e=this.Kd()},MWn.c=null,MWn.d=null,MWn.e=null,vX(XWn,"ImmutableMap",714),wAn(715,714,jVn),MWn._b=function(n){return Yj(this,n)},MWn.uc=function(n){return _T(this.b,n)},MWn.Id=function(){return hfn(new el(this))},MWn.Jd=function(){return hfn(iV(this.b))},MWn.Kd=function(){return s_(),new rv(tV(this.b))},MWn.Fb=function(n){return BT(this.b,n)},MWn.xc=function(n){return UK(this,n)},MWn.Hb=function(){return nsn(this.b.c)},MWn.dc=function(){return this.b.c.dc()},MWn.gc=function(){return this.b.c.gc()},MWn.Ib=function(){return Bbn(this.b.c)},vX(XWn,"ForwardingImmutableMap",715),wAn(1974,1973,EVn),MWn.Bd=function(){return this.Md()},MWn.Cd=function(){return this.Md()},MWn.Nc=function(){return new w1(this,1)},MWn.Fb=function(n){return n===this||this.Md().Fb(n)},MWn.Hb=function(){return this.Md().Hb()},vX(XWn,"ForwardingSet",1974),wAn(1069,1974,EVn,el),MWn.Bd=function(){return eV(this.a.b)},MWn.Cd=function(){return eV(this.a.b)},MWn.Hc=function(n){if(cL(n,42)&&null==BB(n,42).cd())return!1;try{return KT(eV(this.a.b),n)}catch(t){if(cL(t=lun(t),205))return!1;throw Hp(t)}},MWn.Md=function(){return eV(this.a.b)},MWn.Qc=function(n){var t;return t=IY(eV(this.a.b),n),eV(this.a.b).b.gc()<t.length&&$X(t,eV(this.a.b).b.gc(),null),t},vX(XWn,"ForwardingImmutableMap/1",1069),wAn(1981,1980,TVn),MWn.Kc=function(){return this.Ed()},MWn.Nc=function(){return new w1(this,1)},MWn.Fb=function(n){return zSn(this,n)},MWn.Hb=function(){return Brn(this)},vX(XWn,"ImmutableSet",1981),wAn(703,1981,TVn),MWn.Kc=function(){return L9(new qb(this.a.b.Kc()))},MWn.Hc=function(n){return null!=n&&xT(this.a,n)},MWn.Ic=function(n){return DT(this.a,n)},MWn.Hb=function(){return nsn(this.a.b)},MWn.dc=function(){return this.a.b.dc()},MWn.Ed=function(){return L9(new qb(this.a.b.Kc()))},MWn.gc=function(){return this.a.b.gc()},MWn.Pc=function(){return this.a.b.Pc()},MWn.Qc=function(n){return RT(this.a,n)},MWn.Ib=function(){return Bbn(this.a.b)},vX(XWn,"ForwardingImmutableSet",703),wAn(1975,1974,MVn),MWn.Bd=function(){return this.b},MWn.Cd=function(){return this.b},MWn.Md=function(){return this.b},MWn.Nc=function(){return new wS(this)},vX(XWn,"ForwardingSortedSet",1975),wAn(533,1979,jVn,Avn),MWn.Ac=function(n){Tcn(this,n)},MWn.Cc=function(){return new p$(this.d||(this.d=new il(this)))},MWn.$b=function(){d5(this)},MWn._b=function(n){return!!Jrn(this,n,dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15))))},MWn.uc=function(n){return Ltn(this,n)},MWn.kc=function(){return new VL(this,this)},MWn.wc=function(n){BJ(this,n)},MWn.xc=function(n){return sen(this,n)},MWn.ec=function(){return new v$(this)},MWn.zc=function(n,t){return wKn(this,n,t)},MWn.Bc=function(n){var t;return(t=Jrn(this,n,dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15)))))?(LLn(this,t),t.e=null,t.c=null,t.i):null},MWn.gc=function(){return this.i},MWn.pd=function(){return new p$(this.d||(this.d=new il(this)))},MWn.f=0,MWn.g=0,MWn.i=0,vX(XWn,"HashBiMap",533),wAn(534,1,QWn),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return l3(this)},MWn.Pb=function(){var n;if(!l3(this))throw Hp(new yv);return n=this.c,this.c=n.c,this.f=n,--this.d,this.Nd(n)},MWn.Qb=function(){if(this.e.g!=this.b)throw Hp(new vv);han(!!this.f),LLn(this.e,this.f),this.b=this.e.g,this.f=null},MWn.b=0,MWn.d=0,MWn.f=null,vX(XWn,"HashBiMap/Itr",534),wAn(1011,534,QWn,VL),MWn.Nd=function(n){return new bT(this,n)},vX(XWn,"HashBiMap/1",1011),wAn(1012,345,aVn,bT),MWn.cd=function(){return this.a.g},MWn.dd=function(){return this.a.i},MWn.ed=function(n){var t,e,i;return e=this.a.i,(i=dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15))))==this.a.f&&(GI(n)===GI(e)||null!=n&&Nfn(n,e))?n:(yun(!Zrn(this.b.a,n,i),n),LLn(this.b.a,this.a),t=new qW(this.a.g,this.a.a,n,i),YCn(this.b.a,t,this.a),this.a.e=null,this.a.c=null,this.b.b=this.b.a.g,this.b.f==this.a&&(this.b.f=t),this.a=t,e)},vX(XWn,"HashBiMap/1/MapEntry",1012),wAn(238,345,{345:1,238:1,3:1,42:1},vT),MWn.cd=function(){return this.g},MWn.dd=function(){return this.i},MWn.ed=function(n){throw Hp(new pv)},vX(XWn,"ImmutableEntry",238),wAn(317,238,{345:1,317:1,238:1,3:1,42:1},qW),MWn.a=0,MWn.f=0;var qnt,Gnt=vX(XWn,"HashBiMap/BiEntry",317);wAn(610,1979,jVn,il),MWn.Ac=function(n){Tcn(this,n)},MWn.Cc=function(){return new v$(this.a)},MWn.$b=function(){d5(this.a)},MWn._b=function(n){return Ltn(this.a,n)},MWn.kc=function(){return new QL(this,this.a)},MWn.wc=function(n){yX(n),BJ(this.a,new rl(n))},MWn.xc=function(n){return Uin(this,n)},MWn.ec=function(){return new p$(this)},MWn.zc=function(n,t){return C_n(this.a,n,t,!1)},MWn.Bc=function(n){var t;return(t=Zrn(this.a,n,dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15)))))?(LLn(this.a,t),t.e=null,t.c=null,t.g):null},MWn.gc=function(){return this.a.i},MWn.pd=function(){return new v$(this.a)},vX(XWn,"HashBiMap/Inverse",610),wAn(1008,534,QWn,QL),MWn.Nd=function(n){return new wT(this,n)},vX(XWn,"HashBiMap/Inverse/1",1008),wAn(1009,345,aVn,wT),MWn.cd=function(){return this.a.i},MWn.dd=function(){return this.a.g},MWn.ed=function(n){var t,e,i;return i=this.a.g,(t=dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15))))==this.a.a&&(GI(n)===GI(i)||null!=n&&Nfn(n,i))?n:(yun(!Jrn(this.b.a.a,n,t),n),LLn(this.b.a.a,this.a),e=new qW(n,t,this.a.i,this.a.f),this.a=e,YCn(this.b.a.a,e,null),this.b.b=this.b.a.a.g,i)},vX(XWn,"HashBiMap/Inverse/1/InverseEntry",1009),wAn(611,532,tVn,p$),MWn.Kc=function(){return new uy(this.a.a)},MWn.Mc=function(n){var t;return!!(t=Zrn(this.a.a,n,dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15)))))&&(LLn(this.a.a,t),!0)},vX(XWn,"HashBiMap/Inverse/InverseKeySet",611),wAn(1007,534,QWn,uy),MWn.Nd=function(n){return n.i},vX(XWn,"HashBiMap/Inverse/InverseKeySet/1",1007),wAn(1010,1,{},rl),MWn.Od=function(n,t){ev(this.a,n,t)},vX(XWn,"HashBiMap/Inverse/lambda$0$Type",1010),wAn(609,532,tVn,v$),MWn.Kc=function(){return new oy(this.a)},MWn.Mc=function(n){var t;return!!(t=Jrn(this.a,n,dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15)))))&&(LLn(this.a,t),t.e=null,t.c=null,!0)},vX(XWn,"HashBiMap/KeySet",609),wAn(1006,534,QWn,oy),MWn.Nd=function(n){return n.g},vX(XWn,"HashBiMap/KeySet/1",1006),wAn(1093,619,VWn),vX(XWn,"HashMultimapGwtSerializationDependencies",1093),wAn(265,1093,VWn,pJ),MWn.hc=function(){return new bE(etn(this.a))},MWn.gd=function(){return new bE(etn(this.a))},MWn.a=2,vX(XWn,"HashMultimap",265),wAn(1999,152,yVn),MWn.Hc=function(n){return this.Pd().Hc(n)},MWn.dc=function(){return this.Pd().dc()},MWn.gc=function(){return this.Pd().gc()},vX(XWn,"ImmutableAsList",1999),wAn(1931,715,jVn),MWn.Ld=function(){return s_(),new yk(this.a)},MWn.Cc=function(){return s_(),new yk(this.a)},MWn.pd=function(){return s_(),new yk(this.a)},vX(XWn,"ImmutableBiMap",1931),wAn(1977,1,{}),vX(XWn,"ImmutableCollection/Builder",1977),wAn(1022,703,TVn,sy),vX(XWn,"ImmutableEnumSet",1022),wAn(969,386,WWn,bK),MWn.Xb=function(n){return this.a.Xb(n)},vX(XWn,"ImmutableList/1",969),wAn(968,1977,{},sR),vX(XWn,"ImmutableList/Builder",968),wAn(614,198,UWn,cl),MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return BB(this.a.Pb(),42).cd()},vX(XWn,"ImmutableMap/1",614),wAn(1041,1,{},o),MWn.Kb=function(n){return BB(n,42).cd()},vX(XWn,"ImmutableMap/2methodref$getKey$Type",1041),wAn(1040,1,{},hR),vX(XWn,"ImmutableMap/Builder",1040),wAn(2e3,1981,TVn),MWn.Kc=function(){return new cl(lz(this.a).Ed())},MWn.Dd=function(){return new uv(this)},MWn.Jc=function(n){var t,e;for(yX(n),e=this.gc(),t=0;t<e;t++)n.td(BB(wz(lz(this.a)).Xb(t),42).cd())},MWn.Ed=function(){var n;return(n=this.c,n||(this.c=new uv(this))).Ed()},MWn.Nc=function(){return yq(this.gc(),1296,new ul(this))},vX(XWn,"IndexedImmutableSet",2e3),wAn(1180,2e3,TVn,cv),MWn.Kc=function(){return new cl(lz(this.a).Ed())},MWn.Hc=function(n){return this.a._b(n)},MWn.Jc=function(n){yX(n),nan(this.a,new al(n))},MWn.Ed=function(){return new cl(lz(this.a).Ed())},MWn.gc=function(){return this.a.gc()},MWn.Nc=function(){return RB(lz(this.a).Nc(),new o)},vX(XWn,"ImmutableMapKeySet",1180),wAn(1181,1,{},al),MWn.Od=function(n,t){s_(),this.a.td(n)},vX(XWn,"ImmutableMapKeySet/lambda$0$Type",1181),wAn(1178,1980,mVn,av),MWn.Kc=function(){return new KH(this)},MWn.Hc=function(n){return null!=n&&Pjn(new KH(this),n)},MWn.Ed=function(){return new KH(this)},MWn.gc=function(){return this.a.gc()},MWn.Nc=function(){return RB(lz(this.a).Nc(),new s)},vX(XWn,"ImmutableMapValues",1178),wAn(1179,1,{},s),MWn.Kb=function(n){return BB(n,42).dd()},vX(XWn,"ImmutableMapValues/0methodref$getValue$Type",1179),wAn(626,198,UWn,KH),MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return BB(this.a.Pb(),42).dd()},vX(XWn,"ImmutableMapValues/1",626),wAn(1182,1,{},ul),MWn.ld=function(n){return HU(this.a,n)},vX(XWn,"IndexedImmutableSet/0methodref$get$Type",1182),wAn(752,1999,yVn,uv),MWn.Pd=function(){return this.a},MWn.Xb=function(n){return HU(this.a,n)},MWn.gc=function(){return this.a.a.gc()},vX(XWn,"IndexedImmutableSet/1",752),wAn(44,1,{},h),MWn.Kb=function(n){return BB(n,20).Kc()},MWn.Fb=function(n){return this===n},vX(XWn,"Iterables/10",44),wAn(1042,537,pVn,_H),MWn.Jc=function(n){yX(n),this.b.Jc(new dT(this.a,n))},MWn.Kc=function(){return qA(this)},vX(XWn,"Iterables/4",1042),wAn(1043,1,lVn,dT),MWn.td=function(n){TS(this.b,this.a,n)},vX(XWn,"Iterables/4/lambda$0$Type",1043),wAn(1044,537,pVn,FH),MWn.Jc=function(n){yX(n),e5(this.a,new fT(n,this.b))},MWn.Kc=function(){return ZL(new AL(this.a),this.b)},vX(XWn,"Iterables/5",1044),wAn(1045,1,lVn,fT),MWn.td=function(n){this.a.td(yA(n))},vX(XWn,"Iterables/5/lambda$0$Type",1045),wAn(1071,198,UWn,ol),MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return this.a.Pb()},vX(XWn,"Iterators/1",1071),wAn(1072,699,UWn,lT),MWn.Yb=function(){for(var n;this.b.Ob();)if(n=this.b.Pb(),this.a.Lb(n))return n;return this.e=2,null},vX(XWn,"Iterators/5",1072),wAn(487,1,QWn),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.b.Ob()},MWn.Pb=function(){return this.Qd(this.b.Pb())},MWn.Qb=function(){this.b.Qb()},vX(XWn,"TransformedIterator",487),wAn(1073,487,QWn,nN),MWn.Qd=function(n){return this.a.Kb(n)},vX(XWn,"Iterators/6",1073),wAn(717,198,UWn,sl),MWn.Ob=function(){return!this.a},MWn.Pb=function(){if(this.a)throw Hp(new yv);return this.a=!0,this.b},MWn.a=!1,vX(XWn,"Iterators/9",717),wAn(1070,386,WWn,fG),MWn.Xb=function(n){return this.a[this.b+n]},MWn.b=0,vX(XWn,"Iterators/ArrayItr",1070),wAn(39,1,{39:1,47:1},oz),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return dAn(this)},MWn.Pb=function(){return U5(this)},MWn.Qb=function(){han(!!this.c),this.c.Qb(),this.c=null},vX(XWn,"Iterators/ConcatenatedIterator",39),wAn(22,1,{3:1,35:1,22:1}),MWn.wd=function(n){return Py(this,BB(n,22))},MWn.Fb=function(n){return this===n},MWn.Hb=function(){return PN(this)},MWn.Ib=function(){return dx(this)},MWn.g=0;var znt,Unt=vX(RWn,"Enum",22);wAn(538,22,{538:1,3:1,35:1,22:1,47:1},cN),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return!1},MWn.Pb=function(){throw Hp(new yv)},MWn.Qb=function(){han(!1)};var Xnt,Wnt=Ben(XWn,"Iterators/EmptyModifiableIterator",538,Unt,oX,rx);wAn(1834,619,VWn),vX(XWn,"LinkedHashMultimapGwtSerializationDependencies",1834),wAn(1835,1834,VWn,Thn),MWn.hc=function(){return new LN(etn(this.b))},MWn.$b=function(){win(this),iv(this.a,this.a)},MWn.gd=function(){return new LN(etn(this.b))},MWn.ic=function(n){return new Tsn(this,n,this.b)},MWn.kc=function(){return new tN(this)},MWn.lc=function(){return new w1(BB(this.g||(this.g=new qm(this)),21),17)},MWn.ec=function(){return this.i||(this.i=new HL(this,this.c))},MWn.nc=function(){return new by(new tN(this))},MWn.oc=function(){return RB(new w1(BB(this.g||(this.g=new qm(this)),21),17),new f)},MWn.b=2,vX(XWn,"LinkedHashMultimap",1835),wAn(1838,1,{},f),MWn.Kb=function(n){return BB(n,42).dd()},vX(XWn,"LinkedHashMultimap/0methodref$getValue$Type",1838),wAn(824,1,QWn,tN),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return vtn(this)},MWn.Ob=function(){return this.a!=this.b.a},MWn.Qb=function(){han(!!this.c),q0(this.b,this.c.g,this.c.i),this.c=null},vX(XWn,"LinkedHashMultimap/1",824),wAn(330,238,{345:1,238:1,330:1,2020:1,3:1,42:1},HW),MWn.Rd=function(){return this.f},MWn.Sd=function(n){this.c=n},MWn.Td=function(n){this.f=n},MWn.d=0;var Vnt,Qnt=vX(XWn,"LinkedHashMultimap/ValueEntry",330);wAn(1836,1970,{2020:1,20:1,28:1,14:1,21:1},Tsn),MWn.Fc=function(n){var t,e,i,r,c;for(t=(c=dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15))))&this.b.length-1,e=r=this.b[t];e;e=e.a)if(e.d==c&&wW(e.i,n))return!1;return i=new HW(this.c,n,c,r),kk(this.d,i),i.f=this,this.d=i,iv(this.g.a.b,i),iv(i,this.g.a),this.b[t]=i,++this.f,++this.e,yjn(this),!0},MWn.$b=function(){var n,t;for(yS(this.b,null),this.f=0,n=this.a;n!=this;n=n.Rd())iv((t=BB(n,330)).b,t.e);this.a=this,this.d=this,++this.e},MWn.Hc=function(n){var t,e;for(e=dG(cbn(SVn,rV(dG(cbn(null==n?0:nsn(n),PVn)),15))),t=this.b[e&this.b.length-1];t;t=t.a)if(t.d==e&&wW(t.i,n))return!0;return!1},MWn.Jc=function(n){var t;for(yX(n),t=this.a;t!=this;t=t.Rd())n.td(BB(t,330).i)},MWn.Rd=function(){return this.a},MWn.Kc=function(){return new sW(this)},MWn.Mc=function(n){return kAn(this,n)},MWn.Sd=function(n){this.d=n},MWn.Td=function(n){this.a=n},MWn.gc=function(){return this.f},MWn.e=0,MWn.f=0,vX(XWn,"LinkedHashMultimap/ValueSet",1836),wAn(1837,1,QWn,sW),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return wG(this),this.b!=this.c},MWn.Pb=function(){var n,t;if(wG(this),this.b==this.c)throw Hp(new yv);return t=(n=BB(this.b,330)).i,this.d=n,this.b=n.f,t},MWn.Qb=function(){wG(this),han(!!this.d),kAn(this.c,this.d.i),this.a=this.c.e,this.d=null},MWn.a=0,vX(XWn,"LinkedHashMultimap/ValueSet/1",1837),wAn(766,1986,VWn,PO),MWn.Zb=function(){return this.f||(this.f=new rS(this))},MWn.Fb=function(n){return jsn(this,n)},MWn.cc=function(n){return new mT(this,n)},MWn.fc=function(n){return J3(this,n)},MWn.$b=function(){cX(this)},MWn._b=function(n){return HT(this,n)},MWn.ac=function(){return new rS(this)},MWn.bc=function(){return new yl(this)},MWn.qc=function(n){return new mT(this,n)},MWn.dc=function(){return!this.a},MWn.rc=function(n){return J3(this,n)},MWn.gc=function(){return this.d},MWn.c=0,MWn.d=0,vX(XWn,"LinkedListMultimap",766),wAn(52,28,LVn),MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Vc=function(n,t){throw Hp(new tk("Add not supported on this list"))},MWn.Fc=function(n){return this.Vc(this.gc(),n),!0},MWn.Wc=function(n,t){var e,i,r;for(kW(t),e=!1,r=t.Kc();r.Ob();)i=r.Pb(),this.Vc(n++,i),e=!0;return e},MWn.$b=function(){this.Ud(0,this.gc())},MWn.Fb=function(n){return NAn(this,n)},MWn.Hb=function(){return Fon(this)},MWn.Xc=function(n){return bin(this,n)},MWn.Kc=function(){return new Sb(this)},MWn.Yc=function(){return this.Zc(0)},MWn.Zc=function(n){return new M2(this,n)},MWn.$c=function(n){throw Hp(new tk("Remove not supported on this list"))},MWn.Ud=function(n,t){var e,i;for(i=this.Zc(n),e=n;e<t;++e)i.Pb(),i.Qb()},MWn._c=function(n,t){throw Hp(new tk("Set not supported on this list"))},MWn.bd=function(n,t){return new s1(this,n,t)},MWn.j=0,vX(YWn,"AbstractList",52),wAn(1964,52,LVn),MWn.Vc=function(n,t){Kx(this,n,t)},MWn.Wc=function(n,t){return Asn(this,n,t)},MWn.Xb=function(n){return Dpn(this,n)},MWn.Kc=function(){return this.Zc(0)},MWn.$c=function(n){return tkn(this,n)},MWn._c=function(n,t){var e,i;e=this.Zc(n);try{return i=e.Pb(),e.Wb(t),i}catch(r){throw cL(r=lun(r),109)?Hp(new Ay("Can't set element "+n)):Hp(r)}},vX(YWn,"AbstractSequentialList",1964),wAn(636,1964,LVn,mT),MWn.Zc=function(n){return vN(this,n)},MWn.gc=function(){var n;return(n=BB(RX(this.a.b,this.b),283))?n.a:0},vX(XWn,"LinkedListMultimap/1",636),wAn(1297,1970,tVn,yl),MWn.Hc=function(n){return HT(this.a,n)},MWn.Kc=function(){return new vrn(this.a)},MWn.Mc=function(n){return!J3(this.a,n).a.dc()},MWn.gc=function(){return NT(this.a.b)},vX(XWn,"LinkedListMultimap/1KeySetImpl",1297),wAn(1296,1,QWn,vrn),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return bG(this),!!this.c},MWn.Pb=function(){bG(this),oN(this.c),this.a=this.c,TU(this.d,this.a.a);do{this.c=this.c.b}while(this.c&&!TU(this.d,this.c.a));return this.a.a},MWn.Qb=function(){bG(this),han(!!this.a),Cq(new C7(this.e,this.a.a)),this.a=null,this.b=this.e.c},MWn.b=0,vX(XWn,"LinkedListMultimap/DistinctKeyIterator",1296),wAn(283,1,{283:1},sY),MWn.a=0,vX(XWn,"LinkedListMultimap/KeyList",283),wAn(1295,345,aVn,yT),MWn.cd=function(){return this.a},MWn.dd=function(){return this.f},MWn.ed=function(n){var t;return t=this.f,this.f=n,t},vX(XWn,"LinkedListMultimap/Node",1295),wAn(560,1,cVn,C7,KPn),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){this.e=yKn(this.f,this.b,n,this.c),++this.d,this.a=null},MWn.Ob=function(){return!!this.c},MWn.Sb=function(){return!!this.e},MWn.Pb=function(){return EZ(this)},MWn.Tb=function(){return this.d},MWn.Ub=function(){return TZ(this)},MWn.Vb=function(){return this.d-1},MWn.Qb=function(){han(!!this.a),this.a!=this.c?(this.e=this.a.e,--this.d):this.c=this.a.c,ZCn(this.f,this.a),this.a=null},MWn.Wb=function(n){uN(!!this.a),this.a.f=n},MWn.d=0,vX(XWn,"LinkedListMultimap/ValueForKeyIterator",560),wAn(1018,52,LVn),MWn.Vc=function(n,t){this.a.Vc(n,t)},MWn.Wc=function(n,t){return this.a.Wc(n,t)},MWn.Hc=function(n){return this.a.Hc(n)},MWn.Xb=function(n){return this.a.Xb(n)},MWn.$c=function(n){return this.a.$c(n)},MWn._c=function(n,t){return this.a._c(n,t)},MWn.gc=function(){return this.a.gc()},vX(XWn,"Lists/AbstractListWrapper",1018),wAn(1019,1018,xVn),vX(XWn,"Lists/RandomAccessListWrapper",1019),wAn(1021,1019,xVn,IT),MWn.Zc=function(n){return this.a.Zc(n)},vX(XWn,"Lists/1",1021),wAn(131,52,{131:1,20:1,28:1,52:1,14:1,15:1},CT),MWn.Vc=function(n,t){this.a.Vc(pU(this,n),t)},MWn.$b=function(){this.a.$b()},MWn.Xb=function(n){return this.a.Xb(LX(this,n))},MWn.Kc=function(){return W1(this,0)},MWn.Zc=function(n){return W1(this,n)},MWn.$c=function(n){return this.a.$c(LX(this,n))},MWn.Ud=function(n,t){(d2(n,t,this.a.gc()),ean(this.a.bd(pU(this,t),pU(this,n)))).$b()},MWn._c=function(n,t){return this.a._c(LX(this,n),t)},MWn.gc=function(){return this.a.gc()},MWn.bd=function(n,t){return d2(n,t,this.a.gc()),ean(this.a.bd(pU(this,t),pU(this,n)))},vX(XWn,"Lists/ReverseList",131),wAn(280,131,{131:1,20:1,28:1,52:1,14:1,15:1,54:1},fy),vX(XWn,"Lists/RandomAccessReverseList",280),wAn(1020,1,cVn,kT),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){this.c.Rb(n),this.c.Ub(),this.a=!1},MWn.Ob=function(){return this.c.Sb()},MWn.Sb=function(){return this.c.Ob()},MWn.Pb=function(){return w5(this)},MWn.Tb=function(){return pU(this.b,this.c.Tb())},MWn.Ub=function(){if(!this.c.Ob())throw Hp(new yv);return this.a=!0,this.c.Pb()},MWn.Vb=function(){return pU(this.b,this.c.Tb())-1},MWn.Qb=function(){han(this.a),this.c.Qb(),this.a=!1},MWn.Wb=function(n){uN(this.a),this.c.Wb(n)},MWn.a=!1,vX(XWn,"Lists/ReverseList/1",1020),wAn(432,487,QWn,ly),MWn.Qd=function(n){return cS(n)},vX(XWn,"Maps/1",432),wAn(698,487,QWn,by),MWn.Qd=function(n){return BB(n,42).dd()},vX(XWn,"Maps/2",698),wAn(962,487,QWn,pN),MWn.Qd=function(n){return new vT(n,_O(this.a,n))},vX(XWn,"Maps/3",962),wAn(959,1971,tVn,ml),MWn.Jc=function(n){xv(this.a,n)},MWn.Kc=function(){return this.a.kc()},MWn.Rc=function(){return this.a},MWn.Nc=function(){return this.a.lc()},vX(XWn,"Maps/IteratorBasedAbstractMap/1",959),wAn(960,1,{},vl),MWn.Od=function(n,t){this.a.td(n)},vX(XWn,"Maps/KeySet/lambda$0$Type",960),wAn(958,28,ZWn,PT),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return this.a.uc(n)},MWn.Jc=function(n){yX(n),this.a.wc(new ll(n))},MWn.dc=function(){return this.a.dc()},MWn.Kc=function(){return new by(this.a.vc().Kc())},MWn.Mc=function(n){var t,e;try{return ywn(this,n,!0)}catch(i){if(cL(i=lun(i),41)){for(e=this.a.vc().Kc();e.Ob();)if(wW(n,(t=BB(e.Pb(),42)).dd()))return this.a.Bc(t.cd()),!0;return!1}throw Hp(i)}},MWn.gc=function(){return this.a.gc()},vX(XWn,"Maps/Values",958),wAn(961,1,{},ll),MWn.Od=function(n,t){this.a.td(t)},vX(XWn,"Maps/Values/lambda$0$Type",961),wAn(736,1987,JWn,rS),MWn.xc=function(n){return this.a._b(n)?this.a.cc(n):null},MWn.Bc=function(n){return this.a._b(n)?this.a.fc(n):null},MWn.$b=function(){this.a.$b()},MWn._b=function(n){return this.a._b(n)},MWn.Ec=function(){return new fl(this)},MWn.Dc=function(){return this.Ec()},MWn.dc=function(){return this.a.dc()},MWn.ec=function(){return this.a.ec()},MWn.gc=function(){return this.a.ec().gc()},vX(XWn,"Multimaps/AsMap",736),wAn(1104,1971,tVn,fl),MWn.Kc=function(){return nL(this.a.a.ec(),new bl(this))},MWn.Rc=function(){return this.a},MWn.Mc=function(n){var t;return!!idn(this,n)&&(t=BB(n,42),jk(this.a,t.cd()),!0)},vX(XWn,"Multimaps/AsMap/EntrySet",1104),wAn(1108,1,{},bl),MWn.Kb=function(n){return _O(this,n)},MWn.Fb=function(n){return this===n},vX(XWn,"Multimaps/AsMap/EntrySet/1",1108),wAn(543,1989,{543:1,835:1,20:1,28:1,14:1},wl),MWn.$b=function(){win(this.a)},MWn.Hc=function(n){return Wj(this.a,n)},MWn.Jc=function(n){yX(n),e5(MX(this.a),new gl(n))},MWn.Kc=function(){return new ly(MX(this.a).a.kc())},MWn.gc=function(){return this.a.d},MWn.Nc=function(){return RB(MX(this.a).Nc(),new l)},vX(XWn,"Multimaps/Keys",543),wAn(1106,1,{},l),MWn.Kb=function(n){return BB(n,42).cd()},vX(XWn,"Multimaps/Keys/0methodref$getKey$Type",1106),wAn(1105,487,QWn,wy),MWn.Qd=function(n){return new dl(BB(n,42))},vX(XWn,"Multimaps/Keys/1",1105),wAn(1990,1,{416:1}),MWn.Fb=function(n){var t;return!!cL(n,492)&&(t=BB(n,416),BB(this.a.dd(),14).gc()==BB(t.a.dd(),14).gc()&&wW(this.a.cd(),t.a.cd()))},MWn.Hb=function(){var n;return(null==(n=this.a.cd())?0:nsn(n))^BB(this.a.dd(),14).gc()},MWn.Ib=function(){var n,t;return t=kN(this.a.cd()),1==(n=BB(this.a.dd(),14).gc())?t:t+" x "+n},vX(XWn,"Multisets/AbstractEntry",1990),wAn(492,1990,{492:1,416:1},dl),vX(XWn,"Multimaps/Keys/1/1",492),wAn(1107,1,lVn,gl),MWn.td=function(n){this.a.td(BB(n,42).cd())},vX(XWn,"Multimaps/Keys/lambda$1$Type",1107),wAn(1110,1,lVn,b),MWn.td=function(n){Iq(BB(n,416))},vX(XWn,"Multiset/lambda$0$Type",1110),wAn(737,1,lVn,pl),MWn.td=function(n){Itn(this.a,BB(n,416))},vX(XWn,"Multiset/lambda$1$Type",737),wAn(1111,1,{},m),vX(XWn,"Multisets/0methodref$add$Type",1111),wAn(738,1,{},y),MWn.Kb=function(n){return s3(BB(n,416))},vX(XWn,"Multisets/lambda$3$Type",738),wAn(2008,1,KWn),vX(XWn,"RangeGwtSerializationDependencies",2008),wAn(514,2008,{169:1,514:1,3:1,45:1},svn),MWn.Lb=function(n){return Mz(this,BB(n,35))},MWn.Mb=function(n){return Mz(this,BB(n,35))},MWn.Fb=function(n){var t;return!!cL(n,514)&&(t=BB(n,514),xdn(this.a,t.a)&&xdn(this.b,t.b))},MWn.Hb=function(){return 31*this.a.Hb()+this.b.Hb()},MWn.Ib=function(){return B3(this.a,this.b)},vX(XWn,"Range",514),wAn(778,1999,yVn,aU),MWn.Zc=function(n){return ix(this.b,n)},MWn.Pd=function(){return this.a},MWn.Xb=function(n){return WI(this.b,n)},MWn.Fd=function(n){return ix(this.b,n)},vX(XWn,"RegularImmutableAsList",778),wAn(646,2006,yVn,SY),MWn.Hd=function(){return this.a},vX(XWn,"RegularImmutableList",646),wAn(616,715,jVn,hy),vX(XWn,"RegularImmutableMap",616),wAn(716,703,TVn,vS),vX(XWn,"RegularImmutableSet",716),wAn(1976,nVn,tVn),MWn.Kc=function(){return new SV(this.a,this.b)},MWn.Fc=function(n){throw Hp(new pv)},MWn.Gc=function(n){throw Hp(new pv)},MWn.$b=function(){throw Hp(new pv)},MWn.Mc=function(n){throw Hp(new pv)},vX(XWn,"Sets/SetView",1976),wAn(963,1976,tVn,ET),MWn.Kc=function(){return new SV(this.a,this.b)},MWn.Hc=function(n){return CG(this.a,n)&&this.b.Hc(n)},MWn.Ic=function(n){return oun(this.a,n)&&this.b.Ic(n)},MWn.dc=function(){return Kpn(this.b,this.a)},MWn.Lc=function(){return AV(new Rq(null,new w1(this.a,1)),new jl(this.b))},MWn.gc=function(){return Can(this)},MWn.Oc=function(){return AV(new Rq(null,new w1(this.a,1)),new kl(this.b))},vX(XWn,"Sets/2",963),wAn(700,699,UWn,SV),MWn.Yb=function(){for(var n;k$(this.a);)if(n=u4(this.a),this.c.Hc(n))return n;return this.e=2,null},vX(XWn,"Sets/2/1",700),wAn(964,1,DVn,kl),MWn.Mb=function(n){return this.a.Hc(n)},vX(XWn,"Sets/2/4methodref$contains$Type",964),wAn(965,1,DVn,jl),MWn.Mb=function(n){return this.a.Hc(n)},vX(XWn,"Sets/2/5methodref$contains$Type",965),wAn(607,1975,{607:1,3:1,20:1,14:1,271:1,21:1,84:1},bJ),MWn.Bd=function(){return this.b},MWn.Cd=function(){return this.b},MWn.Md=function(){return this.b},MWn.Jc=function(n){this.a.Jc(n)},MWn.Lc=function(){return this.a.Lc()},MWn.Oc=function(){return this.a.Oc()},vX(XWn,"Sets/UnmodifiableNavigableSet",607),wAn(1932,1931,jVn,GW),MWn.Ld=function(){return s_(),new yk(this.a)},MWn.Cc=function(){return s_(),new yk(this.a)},MWn.pd=function(){return s_(),new yk(this.a)},vX(XWn,"SingletonImmutableBiMap",1932),wAn(647,2006,yVn,Pq),MWn.Hd=function(){return this.a},vX(XWn,"SingletonImmutableList",647),wAn(350,1981,TVn,yk),MWn.Kc=function(){return new sl(this.a)},MWn.Hc=function(n){return Nfn(this.a,n)},MWn.Ed=function(){return new sl(this.a)},MWn.gc=function(){return 1},vX(XWn,"SingletonImmutableSet",350),wAn(1115,1,{},k),MWn.Kb=function(n){return BB(n,164)},vX(XWn,"Streams/lambda$0$Type",1115),wAn(1116,1,RVn,El),MWn.Vd=function(){B5(this.a)},vX(XWn,"Streams/lambda$1$Type",1116),wAn(1659,1658,VWn,pY),MWn.Zb=function(){return BB(BB(this.f||(this.f=cL(this.c,171)?new ID(this,BB(this.c,171)):cL(this.c,161)?new CD(this,BB(this.c,161)):new pT(this,this.c)),161),171)},MWn.hc=function(){return new dE(this.b)},MWn.gd=function(){return new dE(this.b)},MWn.ec=function(){return BB(BB(this.i||(this.i=cL(this.c,171)?new tT(this,BB(this.c,171)):cL(this.c,161)?new nT(this,BB(this.c,161)):new HL(this,this.c)),84),271)},MWn.ac=function(){return cL(this.c,171)?new ID(this,BB(this.c,171)):cL(this.c,161)?new CD(this,BB(this.c,161)):new pT(this,this.c)},MWn.ic=function(n){return null==n&&this.a.ue(n,n),new dE(this.b)},vX(XWn,"TreeMultimap",1659),wAn(78,1,{3:1,78:1}),MWn.Wd=function(n){return new Error(n)},MWn.Xd=function(){return this.e},MWn.Yd=function(){return _wn($V(LU((null==this.k&&(this.k=x8(Jnt,sVn,78,0,0,1)),this.k)),new x),new on)},MWn.Zd=function(){return this.f},MWn.$d=function(){return this.g},MWn._d=function(){yy(this,b2(this.Wd(CY(this,this.g)))),ov(this)},MWn.Ib=function(){return CY(this,this.$d())},MWn.e=FVn,MWn.i=!1,MWn.n=!0;var Ynt,Jnt=vX(RWn,"Throwable",78);wAn(102,78,{3:1,102:1,78:1}),vX(RWn,"Exception",102),wAn(60,102,BVn,sv,dy),vX(RWn,"RuntimeException",60),wAn(598,60,BVn),vX(RWn,"JsException",598),wAn(863,598,BVn),vX(HVn,"JavaScriptExceptionBase",863),wAn(477,863,{477:1,3:1,102:1,60:1,78:1},jhn),MWn.$d=function(){return pEn(this),this.c},MWn.ae=function(){return GI(this.b)===GI(Ynt)?null:this.b},vX(GVn,"JavaScriptException",477);var Znt,ntt=vX(GVn,"JavaScriptObject$",0);wAn(1948,1,{}),vX(GVn,"Scheduler",1948);var ttt,ett,itt,rtt,ctt=0,att=0,utt=-1;wAn(890,1948,{},j),vX(HVn,"SchedulerImpl",890),wAn(1960,1,{}),vX(HVn,"StackTraceCreator/Collector",1960),wAn(864,1960,{},E),MWn.be=function(n){var t={},e=[];n[UVn]=e;for(var i=arguments.callee.caller;i;){var r=(PY(),i.name||(i.name=Ven(i.toString())));e.push(r);var c,a,u=":"+r,o=t[u];if(o)for(c=0,a=o.length;c<a;c++)if(o[c]===i)return;(o||(t[u]=[])).push(i),i=i.caller}},MWn.ce=function(n){var t,e,i,r;for(PY(),e=(i=n&&n[UVn]?n[UVn]:[]).length,r=x8(Ftt,sVn,310,e,0,1),t=0;t<e;t++)r[t]=new PV(i[t],null,-1);return r},vX(HVn,"StackTraceCreator/CollectorLegacy",864),wAn(1961,1960,{}),MWn.be=function(n){},MWn.de=function(n,t,e,i){return new PV(t,n+"@"+i,e<0?-1:e)},MWn.ce=function(n){var t,e,i,r,c,a;if(r=lyn(n),c=x8(Ftt,sVn,310,0,0,1),t=0,0==(i=r.length))return c;for(mK((a=Oqn(this,r[0])).d,zVn)||(c[t++]=a),e=1;e<i;e++)c[t++]=Oqn(this,r[e]);return c},vX(HVn,"StackTraceCreator/CollectorModern",1961),wAn(865,1961,{},d),MWn.de=function(n,t,e,i){return new PV(t,n,-1)},vX(HVn,"StackTraceCreator/CollectorModernNoSourceMap",865),wAn(1050,1,{}),vX(yQn,kQn,1050),wAn(615,1050,{615:1},zX),vX(jQn,kQn,615),wAn(2001,1,{}),vX(yQn,EQn,2001),wAn(2002,2001,{}),vX(jQn,EQn,2002),wAn(1090,1,{},g),vX(jQn,"LocaleInfo",1090),wAn(1918,1,{},p),MWn.a=0,vX(jQn,"TimeZone",1918),wAn(1258,2002,{},w),vX("com.google.gwt.i18n.client.impl.cldr","DateTimeFormatInfoImpl",1258),wAn(434,1,{434:1},VB),MWn.a=!1,MWn.b=0,vX(yQn,"DateTimeFormat/PatternPart",434),wAn(199,1,TQn,AT,von,PD),MWn.wd=function(n){return J0(this,BB(n,199))},MWn.Fb=function(n){return cL(n,199)&&QI(fan(this.q.getTime()),fan(BB(n,199).q.getTime()))},MWn.Hb=function(){var n;return dG(r0(n=fan(this.q.getTime()),jz(n,32)))},MWn.Ib=function(){var n,t,i;return n=((i=-this.q.getTimezoneOffset())>=0?"+":"")+(i/60|0),t=UO(e.Math.abs(i)%60),(pMn(),pet)[this.q.getDay()]+" "+vet[this.q.getMonth()]+" "+UO(this.q.getDate())+" "+UO(this.q.getHours())+":"+UO(this.q.getMinutes())+":"+UO(this.q.getSeconds())+" GMT"+n+t+" "+this.q.getFullYear()};var ott,stt,htt,ftt,ltt,btt,wtt,dtt,gtt,ptt,vtt,mtt=vX(YWn,"Date",199);wAn(1915,199,TQn,Ykn),MWn.a=!1,MWn.b=0,MWn.c=0,MWn.d=0,MWn.e=0,MWn.f=0,MWn.g=!1,MWn.i=0,MWn.j=0,MWn.k=0,MWn.n=0,MWn.o=0,MWn.p=0,vX("com.google.gwt.i18n.shared.impl","DateRecord",1915),wAn(1966,1,{}),MWn.fe=function(){return null},MWn.ge=function(){return null},MWn.he=function(){return null},MWn.ie=function(){return null},MWn.je=function(){return null},vX(MQn,"JSONValue",1966),wAn(216,1966,{216:1},Cl,Tl),MWn.Fb=function(n){return!!cL(n,216)&&v0(this.a,BB(n,216).a)},MWn.ee=function(){return qp},MWn.Hb=function(){return tY(this.a)},MWn.fe=function(){return this},MWn.Ib=function(){var n,t,e;for(e=new lN("["),t=0,n=this.a.length;t<n;t++)t>0&&(e.a+=","),uO(e,dnn(this,t));return e.a+="]",e.a},vX(MQn,"JSONArray",216),wAn(483,1966,{483:1},Ml),MWn.ee=function(){return Gp},MWn.ge=function(){return this},MWn.Ib=function(){return hN(),""+this.a},MWn.a=!1,vX(MQn,"JSONBoolean",483),wAn(985,60,BVn,gy),vX(MQn,"JSONException",985),wAn(1023,1966,{},v),MWn.ee=function(){return Vp},MWn.Ib=function(){return zWn},vX(MQn,"JSONNull",1023),wAn(258,1966,{258:1},Sl),MWn.Fb=function(n){return!!cL(n,258)&&this.a==BB(n,258).a},MWn.ee=function(){return zp},MWn.Hb=function(){return VO(this.a)},MWn.he=function(){return this},MWn.Ib=function(){return this.a+""},MWn.a=0,vX(MQn,"JSONNumber",258),wAn(183,1966,{183:1},py,Pl),MWn.Fb=function(n){return!!cL(n,183)&&v0(this.a,BB(n,183).a)},MWn.ee=function(){return Up},MWn.Hb=function(){return tY(this.a)},MWn.ie=function(){return this},MWn.Ib=function(){var n,t,e,i,r,c;for(c=new lN("{"),n=!0,i=0,r=(e=jrn(this,x8(Qtt,sVn,2,0,6,1))).length;i<r;++i)t=e[i],n?n=!1:c.a+=FWn,oO(c,mOn(t)),c.a+=":",uO(c,zJ(this,t));return c.a+="}",c.a},vX(MQn,"JSONObject",183),wAn(596,nVn,tVn,TT),MWn.Hc=function(n){return XI(n)&&zk(this.a,SD(n))},MWn.Kc=function(){return new Sb(new Jy(this.b))},MWn.gc=function(){return this.b.length},vX(MQn,"JSONObject/1",596),wAn(204,1966,{204:1},GX),MWn.Fb=function(n){return!!cL(n,204)&&mK(this.a,BB(n,204).a)},MWn.ee=function(){return Xp},MWn.Hb=function(){return vvn(this.a)},MWn.je=function(){return this},MWn.Ib=function(){return mOn(this.a)},vX(MQn,"JSONString",204),wAn(1962,1,{525:1}),vX(LQn,"OutputStream",1962),wAn(1963,1962,{525:1}),vX(LQn,"FilterOutputStream",1963),wAn(866,1963,{525:1},A),vX(LQn,"PrintStream",866),wAn(418,1,{475:1}),MWn.Ib=function(){return this.a},vX(RWn,"AbstractStringBuilder",418),wAn(529,60,BVn,Oy),vX(RWn,"ArithmeticException",529),wAn(73,60,NQn,fv,Ay),vX(RWn,"IndexOutOfBoundsException",73),wAn(320,73,{3:1,320:1,102:1,73:1,60:1,78:1},Sv,Tk),vX(RWn,"ArrayIndexOutOfBoundsException",320),wAn(528,60,BVn,lv,$y),vX(RWn,"ArrayStoreException",528),wAn(289,78,xQn,Ly),vX(RWn,"Error",289),wAn(194,289,xQn,hv,g5),vX(RWn,"AssertionError",194),CWn={3:1,476:1,35:1};var ytt,ktt=vX(RWn,"Boolean",476);wAn(236,1,{3:1,236:1}),vX(RWn,"Number",236),wAn(217,236,{3:1,217:1,35:1,236:1},$b),MWn.wd=function(n){return Fk(this,BB(n,217))},MWn.ke=function(){return this.a},MWn.Fb=function(n){return cL(n,217)&&BB(n,217).a==this.a},MWn.Hb=function(){return this.a},MWn.Ib=function(){return""+this.a},MWn.a=0;var jtt,Ett,Ttt=vX(RWn,"Byte",217);wAn(172,1,{3:1,172:1,35:1},Lb),MWn.wd=function(n){return Bk(this,BB(n,172))},MWn.Fb=function(n){return cL(n,172)&&BB(n,172).a==this.a},MWn.Hb=function(){return this.a},MWn.Ib=function(){return String.fromCharCode(this.a)},MWn.a=0;var Mtt,Stt=vX(RWn,"Character",172);wAn(205,60,{3:1,205:1,102:1,60:1,78:1},bv,Ky),vX(RWn,"ClassCastException",205),IWn={3:1,35:1,333:1,236:1};var Ptt=vX(RWn,"Double",333);wAn(155,236,{3:1,35:1,155:1,236:1},Nb,Dv),MWn.wd=function(n){return BO(this,BB(n,155))},MWn.ke=function(){return this.a},MWn.Fb=function(n){return cL(n,155)&&vK(this.a,BB(n,155).a)},MWn.Hb=function(){return CJ(this.a)},MWn.Ib=function(){return""+this.a},MWn.a=0;var Ctt=vX(RWn,"Float",155);wAn(32,60,{3:1,102:1,32:1,60:1,78:1},wv,_y,Fsn),vX(RWn,"IllegalArgumentException",32),wAn(71,60,BVn,dv,Fy),vX(RWn,"IllegalStateException",71),wAn(19,236,{3:1,35:1,19:1,236:1},xb),MWn.wd=function(n){return HO(this,BB(n,19))},MWn.ke=function(){return this.a},MWn.Fb=function(n){return cL(n,19)&&BB(n,19).a==this.a},MWn.Hb=function(){return this.a},MWn.Ib=function(){return""+this.a},MWn.a=0;var Itt,Ott,Att=vX(RWn,"Integer",19);wAn(162,236,{3:1,35:1,162:1,236:1},Db),MWn.wd=function(n){return qO(this,BB(n,162))},MWn.ke=function(){return j2(this.a)},MWn.Fb=function(n){return cL(n,162)&&QI(BB(n,162).a,this.a)},MWn.Hb=function(){return dG(this.a)},MWn.Ib=function(){return""+vz(this.a)},MWn.a=0;var $tt,Ltt,Ntt,xtt,Dtt,Rtt=vX(RWn,"Long",162);wAn(2039,1,{}),wAn(1831,60,BVn,By),vX(RWn,"NegativeArraySizeException",1831),wAn(173,598,{3:1,102:1,173:1,60:1,78:1},gv,Hy),MWn.Wd=function(n){return new TypeError(n)},vX(RWn,"NullPointerException",173),wAn(127,32,{3:1,102:1,32:1,127:1,60:1,78:1},Mk),vX(RWn,"NumberFormatException",127),wAn(184,236,{3:1,35:1,236:1,184:1},Rb),MWn.wd=function(n){return Hk(this,BB(n,184))},MWn.ke=function(){return this.a},MWn.Fb=function(n){return cL(n,184)&&BB(n,184).a==this.a},MWn.Hb=function(){return this.a},MWn.Ib=function(){return""+this.a},MWn.a=0;var Ktt,_tt=vX(RWn,"Short",184);wAn(310,1,{3:1,310:1},PV),MWn.Fb=function(n){var t;return!!cL(n,310)&&(t=BB(n,310),this.c==t.c&&this.d==t.d&&this.a==t.a&&this.b==t.b)},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[iln(this.c),this.a,this.d,this.b]))},MWn.Ib=function(){return this.a+"."+this.d+"("+(null!=this.b?this.b:"Unknown Source")+(this.c>=0?":"+this.c:"")+")"},MWn.c=0;var Ftt=vX(RWn,"StackTraceElement",310);OWn={3:1,475:1,35:1,2:1};var Btt,Htt,qtt,Gtt,ztt,Utt,Xtt,Wtt,Vtt,Qtt=vX(RWn,qVn,2);wAn(107,418,{475:1},Sk,Pk,fN),vX(RWn,"StringBuffer",107),wAn(100,418,{475:1},Ck,Ik,lN),vX(RWn,"StringBuilder",100),wAn(687,73,NQn,Ok),vX(RWn,"StringIndexOutOfBoundsException",687),wAn(2043,1,{}),wAn(844,1,{},x),MWn.Kb=function(n){return BB(n,78).e},vX(RWn,"Throwable/lambda$0$Type",844),wAn(41,60,{3:1,102:1,60:1,78:1,41:1},pv,tk),vX(RWn,"UnsupportedOperationException",41),wAn(240,236,{3:1,35:1,236:1,240:1},knn,wE),MWn.wd=function(n){return J_n(this,BB(n,240))},MWn.ke=function(){return bSn(eqn(this))},MWn.Fb=function(n){var t;return this===n||!!cL(n,240)&&(t=BB(n,240),this.e==t.e&&0==J_n(this,t))},MWn.Hb=function(){var n;return 0!=this.b?this.b:this.a<54?(n=fan(this.f),this.b=dG(e0(n,-1)),this.b=33*this.b+dG(e0(kz(n,32),-1)),this.b=17*this.b+CJ(this.e),this.b):(this.b=17*Khn(this.c)+CJ(this.e),this.b)},MWn.Ib=function(){return eqn(this)},MWn.a=0,MWn.b=0,MWn.d=0,MWn.e=0,MWn.f=0;var Ytt,Jtt,Ztt,net,tet,eet,iet=vX("java.math","BigDecimal",240);wAn(91,236,{3:1,35:1,236:1,91:1},Rpn,X6,lU,vEn,Cgn,$A),MWn.wd=function(n){return tgn(this,BB(n,91))},MWn.ke=function(){return bSn(qXn(this,0))},MWn.Fb=function(n){return swn(this,n)},MWn.Hb=function(){return Khn(this)},MWn.Ib=function(){return qXn(this,0)},MWn.b=-2,MWn.c=0,MWn.d=0,MWn.e=0;var ret,cet,aet,uet,oet=vX("java.math","BigInteger",91);wAn(488,1967,JWn),MWn.$b=function(){$U(this)},MWn._b=function(n){return hU(this,n)},MWn.uc=function(n){return Lsn(this,n,this.g)||Lsn(this,n,this.f)},MWn.vc=function(){return new Pb(this)},MWn.xc=function(n){return RX(this,n)},MWn.zc=function(n,t){return VW(this,n,t)},MWn.Bc=function(n){return v6(this,n)},MWn.gc=function(){return NT(this)},vX(YWn,"AbstractHashMap",488),wAn(261,nVn,tVn,Pb),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return m2(this,n)},MWn.Kc=function(){return new usn(this.a)},MWn.Mc=function(n){var t;return!!m2(this,n)&&(t=BB(n,42).cd(),this.a.Bc(t),!0)},MWn.gc=function(){return this.a.gc()},vX(YWn,"AbstractHashMap/EntrySet",261),wAn(262,1,QWn,usn),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return ten(this)},MWn.Ob=function(){return this.b},MWn.Qb=function(){o9(this)},MWn.b=!1,vX(YWn,"AbstractHashMap/EntrySetIterator",262),wAn(417,1,QWn,Sb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return aS(this)},MWn.Pb=function(){return mQ(this)},MWn.Qb=function(){fW(this)},MWn.b=0,MWn.c=-1,vX(YWn,"AbstractList/IteratorImpl",417),wAn(96,417,cVn,M2),MWn.Qb=function(){fW(this)},MWn.Rb=function(n){yR(this,n)},MWn.Sb=function(){return this.b>0},MWn.Tb=function(){return this.b},MWn.Ub=function(){return Px(this.b>0),this.a.Xb(this.c=--this.b)},MWn.Vb=function(){return this.b-1},MWn.Wb=function(n){Mx(-1!=this.c),this.a._c(this.c,n)},vX(YWn,"AbstractList/ListIteratorImpl",96),wAn(219,52,LVn,s1),MWn.Vc=function(n,t){LZ(n,this.b),this.c.Vc(this.a+n,t),++this.b},MWn.Xb=function(n){return l1(n,this.b),this.c.Xb(this.a+n)},MWn.$c=function(n){var t;return l1(n,this.b),t=this.c.$c(this.a+n),--this.b,t},MWn._c=function(n,t){return l1(n,this.b),this.c._c(this.a+n,t)},MWn.gc=function(){return this.b},MWn.a=0,MWn.b=0,vX(YWn,"AbstractList/SubList",219),wAn(384,nVn,tVn,Cb),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return this.a._b(n)},MWn.Kc=function(){return new Ib(this.a.vc().Kc())},MWn.Mc=function(n){return!!this.a._b(n)&&(this.a.Bc(n),!0)},MWn.gc=function(){return this.a.gc()},vX(YWn,"AbstractMap/1",384),wAn(691,1,QWn,Ib),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return BB(this.a.Pb(),42).cd()},MWn.Qb=function(){this.a.Qb()},vX(YWn,"AbstractMap/1/1",691),wAn(226,28,ZWn,Ob),MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return this.a.uc(n)},MWn.Kc=function(){return new Kb(this.a.vc().Kc())},MWn.gc=function(){return this.a.gc()},vX(YWn,"AbstractMap/2",226),wAn(294,1,QWn,Kb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a.Ob()},MWn.Pb=function(){return BB(this.a.Pb(),42).dd()},MWn.Qb=function(){this.a.Qb()},vX(YWn,"AbstractMap/2/1",294),wAn(484,1,{484:1,42:1}),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),cV(this.d,t.cd())&&cV(this.e,t.dd()))},MWn.cd=function(){return this.d},MWn.dd=function(){return this.e},MWn.Hb=function(){return KA(this.d)^KA(this.e)},MWn.ed=function(n){return pR(this,n)},MWn.Ib=function(){return this.d+"="+this.e},vX(YWn,"AbstractMap/AbstractEntry",484),wAn(383,484,{484:1,383:1,42:1},PS),vX(YWn,"AbstractMap/SimpleEntry",383),wAn(1984,1,VQn),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),cV(this.cd(),t.cd())&&cV(this.dd(),t.dd()))},MWn.Hb=function(){return KA(this.cd())^KA(this.dd())},MWn.Ib=function(){return this.cd()+"="+this.dd()},vX(YWn,uVn,1984),wAn(1992,1967,eVn),MWn.tc=function(n){return q5(this,n)},MWn._b=function(n){return DK(this,n)},MWn.vc=function(){return new Bb(this)},MWn.xc=function(n){return qI(lsn(this,n))},MWn.ec=function(){return new _b(this)},vX(YWn,"AbstractNavigableMap",1992),wAn(739,nVn,tVn,Bb),MWn.Hc=function(n){return cL(n,42)&&q5(this.b,BB(n,42))},MWn.Kc=function(){return new BR(this.b)},MWn.Mc=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),z8(this.b,t))},MWn.gc=function(){return this.b.c},vX(YWn,"AbstractNavigableMap/EntrySet",739),wAn(493,nVn,rVn,_b),MWn.Nc=function(){return new wS(this)},MWn.$b=function(){my(this.a)},MWn.Hc=function(n){return DK(this.a,n)},MWn.Kc=function(){return new Fb(new BR(new xN(this.a).b))},MWn.Mc=function(n){return!!DK(this.a,n)&&($J(this.a,n),!0)},MWn.gc=function(){return this.a.c},vX(YWn,"AbstractNavigableMap/NavigableKeySet",493),wAn(494,1,QWn,Fb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return aS(this.a.a)},MWn.Pb=function(){return mx(this.a).cd()},MWn.Qb=function(){e_(this.a)},vX(YWn,"AbstractNavigableMap/NavigableKeySet/1",494),wAn(2004,28,ZWn),MWn.Fc=function(n){return F8(eMn(this,n)),!0},MWn.Gc=function(n){return kW(n),vH(n!=this,"Can't add a queue to itself"),Frn(this,n)},MWn.$b=function(){for(;null!=mnn(this););},vX(YWn,"AbstractQueue",2004),wAn(302,28,{4:1,20:1,28:1,14:1},Lp,d1),MWn.Fc=function(n){return w3(this,n),!0},MWn.$b=function(){o4(this)},MWn.Hc=function(n){return wun(new bV(this),n)},MWn.dc=function(){return Wy(this)},MWn.Kc=function(){return new bV(this)},MWn.Mc=function(n){return GJ(new bV(this),n)},MWn.gc=function(){return this.c-this.b&this.a.length-1},MWn.Nc=function(){return new w1(this,272)},MWn.Qc=function(n){var t;return t=this.c-this.b&this.a.length-1,n.length<t&&(n=qk(new Array(t),n)),urn(this,n,t),n.length>t&&$X(n,t,null),n},MWn.b=0,MWn.c=0,vX(YWn,"ArrayDeque",302),wAn(446,1,QWn,bV),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a!=this.b},MWn.Pb=function(){return _hn(this)},MWn.Qb=function(){ein(this)},MWn.a=0,MWn.b=0,MWn.c=-1,vX(YWn,"ArrayDeque/IteratorImpl",446),wAn(12,52,QQn,Np,J6,t_),MWn.Vc=function(n,t){kG(this,n,t)},MWn.Fc=function(n){return WB(this,n)},MWn.Wc=function(n,t){return ohn(this,n,t)},MWn.Gc=function(n){return gun(this,n)},MWn.$b=function(){this.c=x8(Ant,HWn,1,0,5,1)},MWn.Hc=function(n){return-1!=E7(this,n,0)},MWn.Jc=function(n){Otn(this,n)},MWn.Xb=function(n){return xq(this,n)},MWn.Xc=function(n){return E7(this,n,0)},MWn.dc=function(){return 0==this.c.length},MWn.Kc=function(){return new Wb(this)},MWn.$c=function(n){return s6(this,n)},MWn.Mc=function(n){return y7(this,n)},MWn.Ud=function(n,t){h1(this,n,t)},MWn._c=function(n,t){return c5(this,n,t)},MWn.gc=function(){return this.c.length},MWn.ad=function(n){m$(this,n)},MWn.Pc=function(){return bx(this)},MWn.Qc=function(n){return Qgn(this,n)};var set,het,fet,bet,wet,det,get,pet,vet,met=vX(YWn,"ArrayList",12);wAn(7,1,QWn,Wb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return y$(this)},MWn.Pb=function(){return n0(this)},MWn.Qb=function(){AU(this)},MWn.a=0,MWn.b=-1,vX(YWn,"ArrayList/1",7),wAn(2013,e.Function,{},T),MWn.te=function(n,t){return Pln(n,t)},wAn(154,52,YQn,Jy),MWn.Hc=function(n){return-1!=bin(this,n)},MWn.Jc=function(n){var t,e,i,r;for(kW(n),i=0,r=(e=this.a).length;i<r;++i)t=e[i],n.td(t)},MWn.Xb=function(n){return Dq(this,n)},MWn._c=function(n,t){var e;return l1(n,this.a.length),e=this.a[n],$X(this.a,n,t),e},MWn.gc=function(){return this.a.length},MWn.ad=function(n){yG(this.a,this.a.length,n)},MWn.Pc=function(){return Ygn(this,x8(Ant,HWn,1,this.a.length,5,1))},MWn.Qc=function(n){return Ygn(this,n)},vX(YWn,"Arrays/ArrayList",154),wAn(940,52,YQn,S),MWn.Hc=function(n){return!1},MWn.Xb=function(n){return yO(n)},MWn.Kc=function(){return SQ(),LT(),bet},MWn.Yc=function(){return SQ(),LT(),bet},MWn.gc=function(){return 0},vX(YWn,"Collections/EmptyList",940),wAn(941,1,cVn,P),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){throw Hp(new pv)},MWn.Ob=function(){return!1},MWn.Sb=function(){return!1},MWn.Pb=function(){throw Hp(new yv)},MWn.Tb=function(){return 0},MWn.Ub=function(){throw Hp(new yv)},MWn.Vb=function(){return-1},MWn.Qb=function(){throw Hp(new dv)},MWn.Wb=function(n){throw Hp(new dv)},vX(YWn,"Collections/EmptyListIterator",941),wAn(943,1967,jVn,C),MWn._b=function(n){return!1},MWn.uc=function(n){return!1},MWn.vc=function(){return SQ(),fet},MWn.xc=function(n){return null},MWn.ec=function(){return SQ(),fet},MWn.gc=function(){return 0},MWn.Cc=function(){return SQ(),set},vX(YWn,"Collections/EmptyMap",943),wAn(942,nVn,TVn,M),MWn.Hc=function(n){return!1},MWn.Kc=function(){return SQ(),LT(),bet},MWn.gc=function(){return 0},vX(YWn,"Collections/EmptySet",942),wAn(599,52,{3:1,20:1,28:1,52:1,14:1,15:1},Gb),MWn.Hc=function(n){return cV(this.a,n)},MWn.Xb=function(n){return l1(n,1),this.a},MWn.gc=function(){return 1},vX(YWn,"Collections/SingletonList",599),wAn(372,1,vVn,Hb),MWn.Jc=function(n){e5(this,n)},MWn.Lc=function(){return new Rq(null,this.Nc())},MWn.Nc=function(){return new w1(this,0)},MWn.Oc=function(){return new Rq(null,this.Nc())},MWn.Fc=function(n){return oE()},MWn.Gc=function(n){return sE()},MWn.$b=function(){hE()},MWn.Hc=function(n){return xT(this,n)},MWn.Ic=function(n){return DT(this,n)},MWn.dc=function(){return this.b.dc()},MWn.Kc=function(){return new qb(this.b.Kc())},MWn.Mc=function(n){return fE()},MWn.gc=function(){return this.b.gc()},MWn.Pc=function(){return this.b.Pc()},MWn.Qc=function(n){return RT(this,n)},MWn.Ib=function(){return Bbn(this.b)},vX(YWn,"Collections/UnmodifiableCollection",372),wAn(371,1,QWn,qb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.b.Ob()},MWn.Pb=function(){return this.b.Pb()},MWn.Qb=function(){lE()},vX(YWn,"Collections/UnmodifiableCollectionIterator",371),wAn(531,372,JQn,bN),MWn.Nc=function(){return new w1(this,16)},MWn.Vc=function(n,t){throw Hp(new pv)},MWn.Wc=function(n,t){throw Hp(new pv)},MWn.Fb=function(n){return Nfn(this.a,n)},MWn.Xb=function(n){return this.a.Xb(n)},MWn.Hb=function(){return nsn(this.a)},MWn.Xc=function(n){return this.a.Xc(n)},MWn.dc=function(){return this.a.dc()},MWn.Yc=function(){return new wN(this.a.Zc(0))},MWn.Zc=function(n){return new wN(this.a.Zc(n))},MWn.$c=function(n){throw Hp(new pv)},MWn._c=function(n,t){throw Hp(new pv)},MWn.ad=function(n){throw Hp(new pv)},MWn.bd=function(n,t){return new bN(this.a.bd(n,t))},vX(YWn,"Collections/UnmodifiableList",531),wAn(690,371,cVn,wN),MWn.Qb=function(){lE()},MWn.Rb=function(n){throw Hp(new pv)},MWn.Sb=function(){return this.a.Sb()},MWn.Tb=function(){return this.a.Tb()},MWn.Ub=function(){return this.a.Ub()},MWn.Vb=function(){return this.a.Vb()},MWn.Wb=function(n){throw Hp(new pv)},vX(YWn,"Collections/UnmodifiableListIterator",690),wAn(600,1,JWn,Xb),MWn.wc=function(n){nan(this,n)},MWn.yc=function(n,t,e){return Zln(this,n,t,e)},MWn.$b=function(){throw Hp(new pv)},MWn._b=function(n){return this.c._b(n)},MWn.uc=function(n){return _T(this,n)},MWn.vc=function(){return eV(this)},MWn.Fb=function(n){return BT(this,n)},MWn.xc=function(n){return this.c.xc(n)},MWn.Hb=function(){return nsn(this.c)},MWn.dc=function(){return this.c.dc()},MWn.ec=function(){return iV(this)},MWn.zc=function(n,t){throw Hp(new pv)},MWn.Bc=function(n){throw Hp(new pv)},MWn.gc=function(){return this.c.gc()},MWn.Ib=function(){return Bbn(this.c)},MWn.Cc=function(){return tV(this)},vX(YWn,"Collections/UnmodifiableMap",600),wAn(382,372,EVn,Ak),MWn.Nc=function(){return new w1(this,1)},MWn.Fb=function(n){return Nfn(this.b,n)},MWn.Hb=function(){return nsn(this.b)},vX(YWn,"Collections/UnmodifiableSet",382),wAn(944,382,EVn,Lk),MWn.Hc=function(n){return KT(this,n)},MWn.Ic=function(n){return this.b.Ic(n)},MWn.Kc=function(){return new zb(this.b.Kc())},MWn.Pc=function(){var n;return j4(n=this.b.Pc(),n.length),n},MWn.Qc=function(n){return IY(this,n)},vX(YWn,"Collections/UnmodifiableMap/UnmodifiableEntrySet",944),wAn(945,1,QWn,zb),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return new Ub(BB(this.a.Pb(),42))},MWn.Ob=function(){return this.a.Ob()},MWn.Qb=function(){throw Hp(new pv)},vX(YWn,"Collections/UnmodifiableMap/UnmodifiableEntrySet/1",945),wAn(688,1,VQn,Ub),MWn.Fb=function(n){return this.a.Fb(n)},MWn.cd=function(){return this.a.cd()},MWn.dd=function(){return this.a.dd()},MWn.Hb=function(){return this.a.Hb()},MWn.ed=function(n){throw Hp(new pv)},MWn.Ib=function(){return Bbn(this.a)},vX(YWn,"Collections/UnmodifiableMap/UnmodifiableEntrySet/UnmodifiableEntry",688),wAn(601,531,{20:1,14:1,15:1,54:1},$k),vX(YWn,"Collections/UnmodifiableRandomAccessList",601),wAn(689,382,MVn,dN),MWn.Nc=function(){return new wS(this)},MWn.Fb=function(n){return Nfn(this.a,n)},MWn.Hb=function(){return nsn(this.a)},vX(YWn,"Collections/UnmodifiableSortedSet",689),wAn(847,1,ZQn,D),MWn.ue=function(n,t){var e;return 0!=(e=T4(BB(n,11),BB(t,11)))?e:nFn(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(YWn,"Comparator/lambda$0$Type",847),wAn(751,1,ZQn,R),MWn.ue=function(n,t){return _q(BB(n,35),BB(t,35))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return PQ(),get},vX(YWn,"Comparators/NaturalOrderComparator",751),wAn(1177,1,ZQn,K),MWn.ue=function(n,t){return Fq(BB(n,35),BB(t,35))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return PQ(),det},vX(YWn,"Comparators/ReverseNaturalOrderComparator",1177),wAn(64,1,ZQn,nw),MWn.Fb=function(n){return this===n},MWn.ue=function(n,t){return this.a.ue(t,n)},MWn.ve=function(){return this.a},vX(YWn,"Comparators/ReversedComparator",64),wAn(166,60,BVn,vv),vX(YWn,"ConcurrentModificationException",166),wAn(1904,1,nYn,_),MWn.we=function(n){hdn(this,n)},MWn.Ib=function(){return"DoubleSummaryStatistics[count = "+vz(this.a)+", avg = "+(oS(this.a,0)?l6(this)/j2(this.a):0)+", min = "+this.c+", max = "+this.b+", sum = "+l6(this)+"]"},MWn.a=0,MWn.b=KQn,MWn.c=RQn,MWn.d=0,MWn.e=0,MWn.f=0,vX(YWn,"DoubleSummaryStatistics",1904),wAn(1805,60,BVn,mv),vX(YWn,"EmptyStackException",1805),wAn(451,1967,JWn,Hbn),MWn.zc=function(n,t){return wR(this,n,t)},MWn.$b=function(){TW(this)},MWn._b=function(n){return uS(this,n)},MWn.uc=function(n){var t,e;for(e=new QT(this.a);e.a<e.c.a.length;)if(t=u4(e),cV(n,this.b[t.g]))return!0;return!1},MWn.vc=function(){return new tw(this)},MWn.xc=function(n){return oV(this,n)},MWn.Bc=function(n){return NZ(this,n)},MWn.gc=function(){return this.a.c},vX(YWn,"EnumMap",451),wAn(1352,nVn,tVn,tw),MWn.$b=function(){TW(this.a)},MWn.Hc=function(n){return v2(this,n)},MWn.Kc=function(){return new Aq(this.a)},MWn.Mc=function(n){var t;return!!v2(this,n)&&(t=BB(n,42).cd(),NZ(this.a,t),!0)},MWn.gc=function(){return this.a.a.c},vX(YWn,"EnumMap/EntrySet",1352),wAn(1353,1,QWn,Aq),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return this.b=u4(this.a),new CS(this.c,this.b)},MWn.Ob=function(){return k$(this.a)},MWn.Qb=function(){Mx(!!this.b),NZ(this.c,this.b),this.b=null},vX(YWn,"EnumMap/EntrySetIterator",1353),wAn(1354,1984,VQn,CS),MWn.cd=function(){return this.a},MWn.dd=function(){return this.b.b[this.a.g]},MWn.ed=function(n){return EU(this.b,this.a.g,n)},vX(YWn,"EnumMap/MapEntry",1354),wAn(174,nVn,{20:1,28:1,14:1,174:1,21:1});var yet=vX(YWn,"EnumSet",174);wAn(156,174,{20:1,28:1,14:1,174:1,156:1,21:1},YK),MWn.Fc=function(n){return orn(this,BB(n,22))},MWn.Hc=function(n){return CG(this,n)},MWn.Kc=function(){return new QT(this)},MWn.Mc=function(n){return IG(this,n)},MWn.gc=function(){return this.c},MWn.c=0,vX(YWn,"EnumSet/EnumSetImpl",156),wAn(343,1,QWn,QT),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return u4(this)},MWn.Ob=function(){return k$(this)},MWn.Qb=function(){Mx(-1!=this.b),$X(this.c.b,this.b,null),--this.c.c,this.b=-1},MWn.a=-1,MWn.b=-1,vX(YWn,"EnumSet/EnumSetImpl/IteratorImpl",343),wAn(43,488,tYn,xp,XT,mO),MWn.re=function(n,t){return GI(n)===GI(t)||null!=n&&Nfn(n,t)},MWn.se=function(n){return 0|nsn(n)},vX(YWn,"HashMap",43),wAn(53,nVn,eYn,Rv,bE,$q),MWn.Fc=function(n){return TU(this,n)},MWn.$b=function(){this.a.$b()},MWn.Hc=function(n){return FT(this,n)},MWn.dc=function(){return 0==this.a.gc()},MWn.Kc=function(){return this.a.ec().Kc()},MWn.Mc=function(n){return eL(this,n)},MWn.gc=function(){return this.a.gc()};var ket,jet=vX(YWn,"HashSet",53);wAn(1781,1,wVn,F),MWn.ud=function(n){ran(this,n)},MWn.Ib=function(){return"IntSummaryStatistics[count = "+vz(this.a)+", avg = "+(oS(this.a,0)?j2(this.d)/j2(this.a):0)+", min = "+this.c+", max = "+this.b+", sum = "+vz(this.d)+"]"},MWn.a=0,MWn.b=_Vn,MWn.c=DWn,MWn.d=0,vX(YWn,"IntSummaryStatistics",1781),wAn(1049,1,pVn,eA),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new S2(this)},MWn.c=0,vX(YWn,"InternalHashCodeMap",1049),wAn(711,1,QWn,S2),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return this.d=this.a[this.c++],this.d},MWn.Ob=function(){var n;return this.c<this.a.length||!(n=this.b.next()).done&&(this.a=n.value[1],this.c=0,!0)},MWn.Qb=function(){gAn(this.e,this.d.cd()),0!=this.c&&--this.c},MWn.c=0,MWn.d=null,vX(YWn,"InternalHashCodeMap/1",711),wAn(1047,1,pVn,iA),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new p4(this)},MWn.c=0,MWn.d=0,vX(YWn,"InternalStringMap",1047),wAn(710,1,QWn,p4),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return this.c=this.a,this.a=this.b.next(),new JK(this.d,this.c,this.d.d)},MWn.Ob=function(){return!this.a.done},MWn.Qb=function(){Gan(this.d,this.c.value[0])},vX(YWn,"InternalStringMap/1",710),wAn(1048,1984,VQn,JK),MWn.cd=function(){return this.b.value[0]},MWn.dd=function(){return this.a.d!=this.c?hS(this.a,this.b.value[0]):this.b.value[1]},MWn.ed=function(n){return ubn(this.a,this.b.value[0],n)},MWn.c=0,vX(YWn,"InternalStringMap/2",1048),wAn(228,43,tYn,v4,q8),MWn.$b=function(){kR(this)},MWn._b=function(n){return lS(this,n)},MWn.uc=function(n){var t;for(t=this.d.a;t!=this.d;){if(cV(t.e,n))return!0;t=t.a}return!1},MWn.vc=function(){return new iw(this)},MWn.xc=function(n){return lnn(this,n)},MWn.zc=function(n,t){return Jgn(this,n,t)},MWn.Bc=function(n){return k7(this,n)},MWn.gc=function(){return NT(this.e)},MWn.c=!1,vX(YWn,"LinkedHashMap",228),wAn(387,383,{484:1,383:1,387:1,42:1},Cx,nH),vX(YWn,"LinkedHashMap/ChainEntry",387),wAn(701,nVn,tVn,iw),MWn.$b=function(){kR(this.a)},MWn.Hc=function(n){return y2(this,n)},MWn.Kc=function(){return new hW(this)},MWn.Mc=function(n){var t;return!!y2(this,n)&&(t=BB(n,42).cd(),k7(this.a,t),!0)},MWn.gc=function(){return NT(this.a.e)},vX(YWn,"LinkedHashMap/EntrySet",701),wAn(702,1,QWn,hW),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return s9(this)},MWn.Ob=function(){return this.b!=this.c.a.d},MWn.Qb=function(){Mx(!!this.a),p2(this.c.a.e,this),RH(this.a),v6(this.c.a.e,this.a.d),bD(this.c.a.e,this),this.a=null},vX(YWn,"LinkedHashMap/EntrySet/EntryIterator",702),wAn(178,53,eYn,fA,LN,Lq);var Eet=vX(YWn,"LinkedHashSet",178);wAn(68,1964,{3:1,4:1,20:1,28:1,52:1,14:1,68:1,15:1},YT,n_),MWn.Fc=function(n){return DH(this,n)},MWn.$b=function(){yQ(this)},MWn.Zc=function(n){return spn(this,n)},MWn.gc=function(){return this.b},MWn.b=0;var Tet,Met,Set,Pet,Cet,Iet=vX(YWn,"LinkedList",68);wAn(970,1,cVn,ZK),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){nX(this,n)},MWn.Ob=function(){return EE(this)},MWn.Sb=function(){return this.b.b!=this.d.a},MWn.Pb=function(){return b3(this)},MWn.Tb=function(){return this.a},MWn.Ub=function(){return U0(this)},MWn.Vb=function(){return this.a-1},MWn.Qb=function(){mtn(this)},MWn.Wb=function(n){Mx(!!this.c),this.c.c=n},MWn.a=0,MWn.c=null,vX(YWn,"LinkedList/ListIteratorImpl",970),wAn(608,1,{},$),vX(YWn,"LinkedList/Node",608),wAn(1959,1,{}),vX(YWn,"Locale",1959),wAn(861,1959,{},L),MWn.Ib=function(){return""},vX(YWn,"Locale/1",861),wAn(862,1959,{},N),MWn.Ib=function(){return"unknown"},vX(YWn,"Locale/4",862),wAn(109,60,{3:1,102:1,60:1,78:1,109:1},yv,lV),vX(YWn,"NoSuchElementException",109),wAn(404,1,{404:1},vy),MWn.Fb=function(n){var t;return n===this||!!cL(n,404)&&(t=BB(n,404),cV(this.a,t.a))},MWn.Hb=function(){return KA(this.a)},MWn.Ib=function(){return null!=this.a?GWn+kN(this.a)+")":"Optional.empty()"},vX(YWn,"Optional",404),wAn(463,1,{463:1},CO,yx),MWn.Fb=function(n){var t;return n===this||!!cL(n,463)&&(t=BB(n,463),this.a==t.a&&0==Pln(this.b,t.b))},MWn.Hb=function(){return this.a?CJ(this.b):0},MWn.Ib=function(){return this.a?"OptionalDouble.of("+this.b+")":"OptionalDouble.empty()"},MWn.a=!1,MWn.b=0,vX(YWn,"OptionalDouble",463),wAn(517,1,{517:1},IO,kx),MWn.Fb=function(n){var t;return n===this||!!cL(n,517)&&(t=BB(n,517),this.a==t.a&&0==E$(this.b,t.b))},MWn.Hb=function(){return this.a?this.b:0},MWn.Ib=function(){return this.a?"OptionalInt.of("+this.b+")":"OptionalInt.empty()"},MWn.a=!1,MWn.b=0,vX(YWn,"OptionalInt",517),wAn(503,2004,ZWn,Xz),MWn.Gc=function(n){return ikn(this,n)},MWn.$b=function(){this.b.c=x8(Ant,HWn,1,0,5,1)},MWn.Hc=function(n){return-1!=(null==n?-1:E7(this.b,n,0))},MWn.Kc=function(){return new Vb(this)},MWn.Mc=function(n){return srn(this,n)},MWn.gc=function(){return this.b.c.length},MWn.Nc=function(){return new w1(this,256)},MWn.Pc=function(){return bx(this.b)},MWn.Qc=function(n){return Qgn(this.b,n)},vX(YWn,"PriorityQueue",503),wAn(1277,1,QWn,Vb),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return this.a<this.c.b.c.length},MWn.Pb=function(){return Px(this.a<this.c.b.c.length),this.b=this.a++,xq(this.c.b,this.b)},MWn.Qb=function(){Mx(-1!=this.b),hrn(this.c,this.a=this.b),this.b=-1},MWn.a=0,MWn.b=-1,vX(YWn,"PriorityQueue/1",1277),wAn(230,1,{230:1},sbn,C4),MWn.a=0,MWn.b=0;var Oet,Aet,$et,Let=0;vX(YWn,"Random",230),wAn(27,1,fVn,w1,zU,CV),MWn.qd=function(){return this.a},MWn.rd=function(){return Dz(this),this.c},MWn.Nb=function(n){Dz(this),this.d.Nb(n)},MWn.sd=function(n){return ntn(this,n)},MWn.a=0,MWn.c=0,vX(YWn,"Spliterators/IteratorSpliterator",27),wAn(485,27,fVn,wS),vX(YWn,"SortedSet/1",485),wAn(602,1,nYn,Qb),MWn.we=function(n){this.a.td(n)},vX(YWn,"Spliterator/OfDouble/0methodref$accept$Type",602),wAn(603,1,nYn,Yb),MWn.we=function(n){this.a.td(n)},vX(YWn,"Spliterator/OfDouble/1methodref$accept$Type",603),wAn(604,1,wVn,Jb),MWn.ud=function(n){this.a.td(iln(n))},vX(YWn,"Spliterator/OfInt/2methodref$accept$Type",604),wAn(605,1,wVn,Zb),MWn.ud=function(n){this.a.td(iln(n))},vX(YWn,"Spliterator/OfInt/3methodref$accept$Type",605),wAn(617,1,fVn),MWn.Nb=function(n){pE(this,n)},MWn.qd=function(){return this.d},MWn.rd=function(){return this.e},MWn.d=0,MWn.e=0,vX(YWn,"Spliterators/BaseSpliterator",617),wAn(721,617,fVn),MWn.xe=function(n){gE(this,n)},MWn.Nb=function(n){cL(n,182)?gE(this,BB(n,182)):gE(this,new Yb(n))},MWn.sd=function(n){return cL(n,182)?this.ye(BB(n,182)):this.ye(new Qb(n))},vX(YWn,"Spliterators/AbstractDoubleSpliterator",721),wAn(720,617,fVn),MWn.xe=function(n){gE(this,n)},MWn.Nb=function(n){cL(n,196)?gE(this,BB(n,196)):gE(this,new Zb(n))},MWn.sd=function(n){return cL(n,196)?this.ye(BB(n,196)):this.ye(new Jb(n))},vX(YWn,"Spliterators/AbstractIntSpliterator",720),wAn(540,617,fVn),vX(YWn,"Spliterators/AbstractSpliterator",540),wAn(692,1,fVn),MWn.Nb=function(n){pE(this,n)},MWn.qd=function(){return this.b},MWn.rd=function(){return this.d-this.c},MWn.b=0,MWn.c=0,MWn.d=0,vX(YWn,"Spliterators/BaseArraySpliterator",692),wAn(947,692,fVn,BH),MWn.ze=function(n,t){cj(this,BB(n,38),t)},MWn.Nb=function(n){DX(this,n)},MWn.sd=function(n){return K6(this,n)},vX(YWn,"Spliterators/ArraySpliterator",947),wAn(693,692,fVn,_K),MWn.ze=function(n,t){aj(this,BB(n,182),t)},MWn.xe=function(n){DX(this,n)},MWn.Nb=function(n){cL(n,182)?DX(this,BB(n,182)):DX(this,new Yb(n))},MWn.ye=function(n){return K6(this,n)},MWn.sd=function(n){return cL(n,182)?K6(this,BB(n,182)):K6(this,new Qb(n))},vX(YWn,"Spliterators/DoubleArraySpliterator",693),wAn(1968,1,fVn),MWn.Nb=function(n){pE(this,n)},MWn.qd=function(){return 16448},MWn.rd=function(){return 0},vX(YWn,"Spliterators/EmptySpliterator",1968),wAn(946,1968,fVn,z),MWn.xe=function(n){Bf(n)},MWn.Nb=function(n){cL(n,196)?Bf(BB(n,196)):Bf(new Zb(n))},MWn.ye=function(n){return bS(n)},MWn.sd=function(n){return cL(n,196)?bS(BB(n,196)):bS(new Jb(n))},vX(YWn,"Spliterators/EmptySpliterator/OfInt",946),wAn(580,52,fYn,_v),MWn.Vc=function(n,t){Kz(n,this.a.c.length+1),kG(this.a,n,t)},MWn.Fc=function(n){return WB(this.a,n)},MWn.Wc=function(n,t){return Kz(n,this.a.c.length+1),ohn(this.a,n,t)},MWn.Gc=function(n){return gun(this.a,n)},MWn.$b=function(){this.a.c=x8(Ant,HWn,1,0,5,1)},MWn.Hc=function(n){return-1!=E7(this.a,n,0)},MWn.Ic=function(n){return oun(this.a,n)},MWn.Jc=function(n){Otn(this.a,n)},MWn.Xb=function(n){return Kz(n,this.a.c.length),xq(this.a,n)},MWn.Xc=function(n){return E7(this.a,n,0)},MWn.dc=function(){return 0==this.a.c.length},MWn.Kc=function(){return new Wb(this.a)},MWn.$c=function(n){return Kz(n,this.a.c.length),s6(this.a,n)},MWn.Ud=function(n,t){h1(this.a,n,t)},MWn._c=function(n,t){return Kz(n,this.a.c.length),c5(this.a,n,t)},MWn.gc=function(){return this.a.c.length},MWn.ad=function(n){m$(this.a,n)},MWn.bd=function(n,t){return new s1(this.a,n,t)},MWn.Pc=function(){return bx(this.a)},MWn.Qc=function(n){return Qgn(this.a,n)},MWn.Ib=function(){return LMn(this.a)},vX(YWn,"Vector",580),wAn(809,580,fYn,om),vX(YWn,"Stack",809),wAn(206,1,{206:1},$an),MWn.Ib=function(){return W0(this)},vX(YWn,"StringJoiner",206),wAn(544,1992,{3:1,83:1,171:1,161:1},WT,Wz),MWn.$b=function(){my(this)},MWn.vc=function(){return new xN(this)},MWn.zc=function(n,t){return Mon(this,n,t)},MWn.Bc=function(n){return $J(this,n)},MWn.gc=function(){return this.c},MWn.c=0,vX(YWn,"TreeMap",544),wAn(390,1,QWn,BR),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return mx(this)},MWn.Ob=function(){return aS(this.a)},MWn.Qb=function(){e_(this)},vX(YWn,"TreeMap/EntryIterator",390),wAn(435,739,tVn,xN),MWn.$b=function(){my(this.a)},vX(YWn,"TreeMap/EntrySet",435),wAn(436,383,{484:1,383:1,42:1,436:1},H8),MWn.b=!1;var Net,xet,Det,Ret,Ket=vX(YWn,"TreeMap/Node",436);wAn(621,1,{},q),MWn.Ib=function(){return"State: mv="+this.c+" value="+this.d+" done="+this.a+" found="+this.b},MWn.a=!1,MWn.b=!1,MWn.c=!1,vX(YWn,"TreeMap/State",621),wAn(297,22,lYn,gS),MWn.Ae=function(){return!1},MWn.Be=function(){return!1};var _et,Fet=Ben(YWn,"TreeMap/SubMapType",297,Unt,J2,h_);wAn(1112,297,lYn,LA),MWn.Be=function(){return!0},Ben(YWn,"TreeMap/SubMapType/1",1112,Fet,null,null),wAn(1113,297,lYn,A$),MWn.Ae=function(){return!0},MWn.Be=function(){return!0},Ben(YWn,"TreeMap/SubMapType/2",1113,Fet,null,null),wAn(1114,297,lYn,NA),MWn.Ae=function(){return!0},Ben(YWn,"TreeMap/SubMapType/3",1114,Fet,null,null),wAn(208,nVn,{3:1,20:1,28:1,14:1,271:1,21:1,84:1,208:1},zv,dE),MWn.Nc=function(){return new wS(this)},MWn.Fc=function(n){return ZU(this,n)},MWn.$b=function(){my(this.a)},MWn.Hc=function(n){return DK(this.a,n)},MWn.Kc=function(){return new Fb(new BR(new xN(new _b(this.a).a).b))},MWn.Mc=function(n){return MN(this,n)},MWn.gc=function(){return this.a.c};var Bet=vX(YWn,"TreeSet",208);wAn(966,1,{},rw),MWn.Ce=function(n,t){return DD(this.a,n,t)},vX(bYn,"BinaryOperator/lambda$0$Type",966),wAn(967,1,{},cw),MWn.Ce=function(n,t){return RD(this.a,n,t)},vX(bYn,"BinaryOperator/lambda$1$Type",967),wAn(846,1,{},G),MWn.Kb=function(n){return n},vX(bYn,"Function/lambda$0$Type",846),wAn(431,1,DVn,aw),MWn.Mb=function(n){return!this.a.Mb(n)},vX(bYn,"Predicate/lambda$2$Type",431),wAn(572,1,{572:1});var Het,qet,Get=vX(wYn,"Handler",572);wAn(2007,1,KWn),MWn.ne=function(){return"DUMMY"},MWn.Ib=function(){return this.ne()},vX(wYn,"Level",2007),wAn(1621,2007,KWn,U),MWn.ne=function(){return"INFO"},vX(wYn,"Level/LevelInfo",1621),wAn(1640,1,{},Kv),vX(wYn,"LogManager",1640),wAn(1780,1,KWn,i_),MWn.b=null,vX(wYn,"LogRecord",1780),wAn(512,1,{512:1},y5),MWn.e=!1;var zet,Uet,Xet,Wet=!1,Vet=!1,Qet=!1,Yet=!1,Jet=!1;vX(wYn,"Logger",512),wAn(819,572,{572:1},X),vX(wYn,"SimpleConsoleLogHandler",819),wAn(132,22,{3:1,35:1,22:1,132:1},pS);var Zet,nit=Ben(pYn,"Collector/Characteristics",132,Unt,p1,f_);wAn(744,1,{},jU),vX(pYn,"CollectorImpl",744),wAn(1060,1,{},W),MWn.Ce=function(n,t){return Ofn(BB(n,206),BB(t,206))},vX(pYn,"Collectors/10methodref$merge$Type",1060),wAn(1061,1,{},V),MWn.Kb=function(n){return W0(BB(n,206))},vX(pYn,"Collectors/11methodref$toString$Type",1061),wAn(1062,1,{},uw),MWn.Kb=function(n){return hN(),!!TO(n)},vX(pYn,"Collectors/12methodref$test$Type",1062),wAn(251,1,{},B),MWn.Od=function(n,t){BB(n,14).Fc(t)},vX(pYn,"Collectors/20methodref$add$Type",251),wAn(253,1,{},H),MWn.Ee=function(){return new Np},vX(pYn,"Collectors/21methodref$ctor$Type",253),wAn(346,1,{},Q),MWn.Ee=function(){return new Rv},vX(pYn,"Collectors/23methodref$ctor$Type",346),wAn(347,1,{},Y),MWn.Od=function(n,t){TU(BB(n,53),t)},vX(pYn,"Collectors/24methodref$add$Type",347),wAn(1055,1,{},J),MWn.Ce=function(n,t){return ZT(BB(n,15),BB(t,14))},vX(pYn,"Collectors/4methodref$addAll$Type",1055),wAn(1059,1,{},Z),MWn.Od=function(n,t){b6(BB(n,206),BB(t,475))},vX(pYn,"Collectors/9methodref$add$Type",1059),wAn(1058,1,{},YB),MWn.Ee=function(){return new $an(this.a,this.b,this.c)},vX(pYn,"Collectors/lambda$15$Type",1058),wAn(1063,1,{},nn),MWn.Ee=function(){var n;return Jgn(n=new v4,(hN(),!1),new Np),Jgn(n,!0,new Np),n},vX(pYn,"Collectors/lambda$22$Type",1063),wAn(1064,1,{},ow),MWn.Ee=function(){return Pun(Gk(Ant,1),HWn,1,5,[this.a])},vX(pYn,"Collectors/lambda$25$Type",1064),wAn(1065,1,{},sw),MWn.Od=function(n,t){Bq(this.a,een(n))},vX(pYn,"Collectors/lambda$26$Type",1065),wAn(1066,1,{},hw),MWn.Ce=function(n,t){return _z(this.a,een(n),een(t))},vX(pYn,"Collectors/lambda$27$Type",1066),wAn(1067,1,{},tn),MWn.Kb=function(n){return een(n)[0]},vX(pYn,"Collectors/lambda$28$Type",1067),wAn(713,1,{},en),MWn.Ce=function(n,t){return Hq(n,t)},vX(pYn,"Collectors/lambda$4$Type",713),wAn(252,1,{},rn),MWn.Ce=function(n,t){return GT(BB(n,14),BB(t,14))},vX(pYn,"Collectors/lambda$42$Type",252),wAn(348,1,{},cn),MWn.Ce=function(n,t){return zT(BB(n,53),BB(t,53))},vX(pYn,"Collectors/lambda$50$Type",348),wAn(349,1,{},an),MWn.Kb=function(n){return BB(n,53)},vX(pYn,"Collectors/lambda$51$Type",349),wAn(1054,1,{},fw),MWn.Od=function(n,t){bsn(this.a,BB(n,83),t)},vX(pYn,"Collectors/lambda$7$Type",1054),wAn(1056,1,{},un),MWn.Ce=function(n,t){return pun(BB(n,83),BB(t,83),new J)},vX(pYn,"Collectors/lambda$8$Type",1056),wAn(1057,1,{},lw),MWn.Kb=function(n){return mbn(this.a,BB(n,83))},vX(pYn,"Collectors/lambda$9$Type",1057),wAn(539,1,{}),MWn.He=function(){jW(this)},MWn.d=!1,vX(pYn,"TerminatableStream",539),wAn(812,539,vYn,AD),MWn.He=function(){jW(this)},vX(pYn,"DoubleStreamImpl",812),wAn(1784,721,fVn,ZB),MWn.ye=function(n){return pmn(this,BB(n,182))},MWn.a=null,vX(pYn,"DoubleStreamImpl/2",1784),wAn(1785,1,nYn,bw),MWn.we=function(n){HA(this.a,n)},vX(pYn,"DoubleStreamImpl/2/lambda$0$Type",1785),wAn(1782,1,nYn,ww),MWn.we=function(n){BA(this.a,n)},vX(pYn,"DoubleStreamImpl/lambda$0$Type",1782),wAn(1783,1,nYn,dw),MWn.we=function(n){hdn(this.a,n)},vX(pYn,"DoubleStreamImpl/lambda$2$Type",1783),wAn(1358,720,fVn,m5),MWn.ye=function(n){return k2(this,BB(n,196))},MWn.a=0,MWn.b=0,MWn.c=0,vX(pYn,"IntStream/5",1358),wAn(787,539,vYn,$D),MWn.He=function(){jW(this)},MWn.Ie=function(){return EW(this),this.a},vX(pYn,"IntStreamImpl",787),wAn(788,539,vYn,VT),MWn.He=function(){jW(this)},MWn.Ie=function(){return EW(this),IL(),$et},vX(pYn,"IntStreamImpl/Empty",788),wAn(1463,1,wVn,gw),MWn.ud=function(n){ran(this.a,n)},vX(pYn,"IntStreamImpl/lambda$4$Type",1463);var tit,eit=bq(pYn,"Stream");wAn(30,539,{525:1,670:1,833:1},Rq),MWn.He=function(){jW(this)},vX(pYn,"StreamImpl",30),wAn(845,1,{},on),MWn.ld=function(n){return lH(n)},vX(pYn,"StreamImpl/0methodref$lambda$2$Type",845),wAn(1084,540,fVn,KK),MWn.sd=function(n){for(;$9(this);){if(this.a.sd(n))return!0;jW(this.b),this.b=null,this.a=null}return!1},vX(pYn,"StreamImpl/1",1084),wAn(1085,1,lVn,pw),MWn.td=function(n){iH(this.a,BB(n,833))},vX(pYn,"StreamImpl/1/lambda$0$Type",1085),wAn(1086,1,DVn,vw),MWn.Mb=function(n){return TU(this.a,n)},vX(pYn,"StreamImpl/1methodref$add$Type",1086),wAn(1087,540,fVn,vQ),MWn.sd=function(n){var t;return this.a||(t=new Np,this.b.a.Nb(new mw(t)),SQ(),m$(t,this.c),this.a=new w1(t,16)),ntn(this.a,n)},MWn.a=null,vX(pYn,"StreamImpl/5",1087),wAn(1088,1,lVn,mw),MWn.td=function(n){WB(this.a,n)},vX(pYn,"StreamImpl/5/2methodref$add$Type",1088),wAn(722,540,fVn,Q9),MWn.sd=function(n){for(this.b=!1;!this.b&&this.c.sd(new AS(this,n)););return this.b},MWn.b=!1,vX(pYn,"StreamImpl/FilterSpliterator",722),wAn(1079,1,lVn,AS),MWn.td=function(n){Rz(this.a,this.b,n)},vX(pYn,"StreamImpl/FilterSpliterator/lambda$0$Type",1079),wAn(1075,721,fVn,E6),MWn.ye=function(n){return jK(this,BB(n,182))},vX(pYn,"StreamImpl/MapToDoubleSpliterator",1075),wAn(1078,1,lVn,$S),MWn.td=function(n){jS(this.a,this.b,n)},vX(pYn,"StreamImpl/MapToDoubleSpliterator/lambda$0$Type",1078),wAn(1074,720,fVn,T6),MWn.ye=function(n){return EK(this,BB(n,196))},vX(pYn,"StreamImpl/MapToIntSpliterator",1074),wAn(1077,1,lVn,LS),MWn.td=function(n){kS(this.a,this.b,n)},vX(pYn,"StreamImpl/MapToIntSpliterator/lambda$0$Type",1077),wAn(719,540,fVn,M6),MWn.sd=function(n){return TK(this,n)},vX(pYn,"StreamImpl/MapToObjSpliterator",719),wAn(1076,1,lVn,NS),MWn.td=function(n){ES(this.a,this.b,n)},vX(pYn,"StreamImpl/MapToObjSpliterator/lambda$0$Type",1076),wAn(618,1,lVn,sn),MWn.td=function(n){Il(this,n)},vX(pYn,"StreamImpl/ValueConsumer",618),wAn(1080,1,lVn,hn),MWn.td=function(n){dM()},vX(pYn,"StreamImpl/lambda$0$Type",1080),wAn(1081,1,lVn,fn),MWn.td=function(n){dM()},vX(pYn,"StreamImpl/lambda$1$Type",1081),wAn(1082,1,{},yw),MWn.Ce=function(n,t){return F_(this.a,n,t)},vX(pYn,"StreamImpl/lambda$4$Type",1082),wAn(1083,1,lVn,IS),MWn.td=function(n){ER(this.b,this.a,n)},vX(pYn,"StreamImpl/lambda$5$Type",1083),wAn(1089,1,lVn,kw),MWn.td=function(n){Hon(this.a,BB(n,365))},vX(pYn,"TerminatableStream/lambda$0$Type",1089),wAn(2041,1,{}),wAn(1914,1,{},ln),vX("javaemul.internal","ConsoleLogger",1914),wAn(2038,1,{});var iit,rit,cit=0,ait=0;wAn(1768,1,lVn,bn),MWn.td=function(n){BB(n,308)},vX(TYn,"BowyerWatsonTriangulation/lambda$0$Type",1768),wAn(1769,1,lVn,jw),MWn.td=function(n){Frn(this.a,BB(n,308).e)},vX(TYn,"BowyerWatsonTriangulation/lambda$1$Type",1769),wAn(1770,1,lVn,wn),MWn.td=function(n){BB(n,168)},vX(TYn,"BowyerWatsonTriangulation/lambda$2$Type",1770),wAn(1765,1,MYn,Ew),MWn.ue=function(n,t){return q3(this.a,BB(n,168),BB(t,168))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(TYn,"NaiveMinST/lambda$0$Type",1765),wAn(499,1,{},Tw),vX(TYn,"NodeMicroLayout",499),wAn(168,1,{168:1},xS),MWn.Fb=function(n){var t;return!!cL(n,168)&&(t=BB(n,168),cV(this.a,t.a)&&cV(this.b,t.b)||cV(this.a,t.b)&&cV(this.b,t.a))},MWn.Hb=function(){return KA(this.a)+KA(this.b)};var uit=vX(TYn,"TEdge",168);wAn(308,1,{308:1},ZFn),MWn.Fb=function(n){var t;return!!cL(n,308)&&K7(this,(t=BB(n,308)).a)&&K7(this,t.b)&&K7(this,t.c)},MWn.Hb=function(){return KA(this.a)+KA(this.b)+KA(this.c)},vX(TYn,"TTriangle",308),wAn(221,1,{221:1},C$),vX(TYn,"Tree",221),wAn(1254,1,{},IZ),vX(SYn,"Scanline",1254);var oit=bq(SYn,PYn);wAn(1692,1,{},ltn),vX(CYn,"CGraph",1692),wAn(307,1,{307:1},cZ),MWn.b=0,MWn.c=0,MWn.d=0,MWn.g=0,MWn.i=0,MWn.k=KQn,vX(CYn,"CGroup",307),wAn(815,1,{},Xv),vX(CYn,"CGroup/CGroupBuilder",815),wAn(57,1,{57:1},AR),MWn.Ib=function(){return this.j?SD(this.j.Kb(this)):(ED(bit),bit.o+"@"+(PN(this)>>>0).toString(16))},MWn.f=0,MWn.i=KQn;var sit,hit,fit,lit,bit=vX(CYn,"CNode",57);wAn(814,1,{},Wv),vX(CYn,"CNode/CNodeBuilder",814),wAn(1525,1,{},dn),MWn.Oe=function(n,t){return 0},MWn.Pe=function(n,t){return 0},vX(CYn,OYn,1525),wAn(1790,1,{},gn),MWn.Le=function(n){var t,i,r,c,a,u,o,s,h,f,l,b,w,d,g;for(h=RQn,r=new Wb(n.a.b);r.a<r.c.c.length;)t=BB(n0(r),57),h=e.Math.min(h,t.a.j.d.c+t.b.a);for(w=new YT,u=new Wb(n.a.a);u.a<u.c.c.length;)(a=BB(n0(u),307)).k=h,0==a.g&&r5(w,a,w.c.b,w.c);for(;0!=w.b;){for(c=(a=BB(0==w.b?null:(Px(0!=w.b),Atn(w,w.a.a)),307)).j.d.c,b=a.a.a.ec().Kc();b.Ob();)f=BB(b.Pb(),57),g=a.k+f.b.a,!Ghn(n,a,n.d)||f.d.c<g?f.i=g:f.i=f.d.c;for(c-=a.j.i,a.b+=c,n.d==(Ffn(),FPt)||n.d==KPt?a.c+=c:a.c-=c,l=a.a.a.ec().Kc();l.Ob();)for(s=(f=BB(l.Pb(),57)).c.Kc();s.Ob();)o=BB(s.Pb(),57),d=dA(n.d)?n.g.Oe(f,o):n.g.Pe(f,o),o.a.k=e.Math.max(o.a.k,f.i+f.d.b+d-o.b.a),cY(n,o,n.d)&&(o.a.k=e.Math.max(o.a.k,o.d.c-o.b.a)),--o.a.g,0==o.a.g&&DH(w,o.a)}for(i=new Wb(n.a.b);i.a<i.c.c.length;)(t=BB(n0(i),57)).d.c=t.i},vX(CYn,"LongestPathCompaction",1790),wAn(1690,1,{},yOn),MWn.e=!1;var wit,dit,git=vX(CYn,xYn,1690);wAn(1691,1,lVn,Mw),MWn.td=function(n){iun(this.a,BB(n,46))},vX(CYn,DYn,1691),wAn(1791,1,{},pn),MWn.Me=function(n){var t,e,i,r,c,a;for(t=new Wb(n.a.b);t.a<t.c.c.length;)BB(n0(t),57).c.$b();for(i=new Wb(n.a.b);i.a<i.c.c.length;)for(e=BB(n0(i),57),c=new Wb(n.a.b);c.a<c.c.c.length;)e!=(r=BB(n0(c),57))&&(e.a&&e.a==r.a||(a=dA(n.d)?n.g.Pe(e,r):n.g.Oe(e,r),(r.d.c>e.d.c||e.d.c==r.d.c&&e.d.b<r.d.b)&&Rdn(r.d.d+r.d.a+a,e.d.d)&&Kdn(r.d.d,e.d.d+e.d.a+a)&&e.c.Fc(r)))},vX(CYn,"QuadraticConstraintCalculation",1791),wAn(522,1,{522:1},Dp),MWn.a=!1,MWn.b=!1,MWn.c=!1,MWn.d=!1,vX(CYn,RYn,522),wAn(803,1,{},RG),MWn.Me=function(n){this.c=n,pCn(this,new yn)},vX(CYn,KYn,803),wAn(1718,1,{679:1},fY),MWn.Ke=function(n){_Pn(this,BB(n,464))},vX(CYn,_Yn,1718),wAn(1719,1,MYn,vn),MWn.ue=function(n,t){return uQ(BB(n,57),BB(t,57))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(CYn,FYn,1719),wAn(464,1,{464:1},OS),MWn.a=!1,vX(CYn,BYn,464),wAn(1720,1,MYn,mn),MWn.ue=function(n,t){return Jkn(BB(n,464),BB(t,464))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(CYn,HYn,1720),wAn(1721,1,qYn,yn),MWn.Lb=function(n){return BB(n,57),!0},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return BB(n,57),!0},vX(CYn,"ScanlineConstraintCalculator/lambda$1$Type",1721),wAn(428,22,{3:1,35:1,22:1,428:1},FS);var pit,vit,mit,yit=Ben(GYn,"HighLevelSortingCriterion",428,Unt,rJ,l_);wAn(427,22,{3:1,35:1,22:1,427:1},BS);var kit,jit,Eit,Tit,Mit,Sit,Pit,Cit,Iit,Oit,Ait,$it,Lit,Nit,xit,Dit,Rit,Kit=Ben(GYn,"LowLevelSortingCriterion",427,Unt,cJ,b_),_it=bq(zYn,"ILayoutMetaDataProvider");wAn(853,1,QYn,Gh),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,UYn),YYn),"Polyomino Traversal Strategy"),"Traversal strategy for trying different candidate positions for polyominoes."),Cit),(PPn(),gMt)),Bit),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,XYn),YYn),"Polyomino Secondary Sorting Criterion"),"Possible secondary sorting criteria for the processing order of polyominoes. They are used when polyominoes are equal according to the primary sorting criterion HighLevelSortingCriterion."),Sit),gMt),Kit),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,WYn),YYn),"Polyomino Primary Sorting Criterion"),"Possible primary sorting criteria for the processing order of polyominoes."),Tit),gMt),yit),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,VYn),YYn),"Fill Polyominoes"),"Use the Profile Fill algorithm to fill polyominoes to prevent small polyominoes from being placed inside of big polyominoes with large holes. Might increase packing area."),(hN(),!0)),wMt),ktt),nbn(hMt))))},vX(GYn,"PolyominoOptions",853),wAn(250,22,{3:1,35:1,22:1,250:1},HS);var Fit,Bit=Ben(GYn,"TraversalStrategy",250,Unt,Tin,w_);wAn(213,1,{213:1},kn),MWn.Ib=function(){return"NEdge[id="+this.b+" w="+this.g+" d="+this.a+"]"},MWn.a=1,MWn.b=0,MWn.c=0,MWn.f=!1,MWn.g=0;var Hit=vX(JYn,"NEdge",213);wAn(176,1,{},Hv),vX(JYn,"NEdge/NEdgeBuilder",176),wAn(653,1,{},Fv),vX(JYn,"NGraph",653),wAn(121,1,{121:1},k6),MWn.c=-1,MWn.d=0,MWn.e=0,MWn.i=-1,MWn.j=!1;var qit=vX(JYn,"NNode",121);wAn(795,1,JQn,Bv),MWn.Jc=function(n){e5(this,n)},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.Vc=function(n,t){++this.b,kG(this.a,n,t)},MWn.Fc=function(n){return RN(this,n)},MWn.Wc=function(n,t){return++this.b,ohn(this.a,n,t)},MWn.Gc=function(n){return++this.b,gun(this.a,n)},MWn.$b=function(){++this.b,this.a.c=x8(Ant,HWn,1,0,5,1)},MWn.Hc=function(n){return-1!=E7(this.a,n,0)},MWn.Ic=function(n){return oun(this.a,n)},MWn.Xb=function(n){return xq(this.a,n)},MWn.Xc=function(n){return E7(this.a,n,0)},MWn.dc=function(){return 0==this.a.c.length},MWn.Kc=function(){return L9(new Wb(this.a))},MWn.Yc=function(){throw Hp(new pv)},MWn.Zc=function(n){throw Hp(new pv)},MWn.$c=function(n){return++this.b,s6(this.a,n)},MWn.Mc=function(n){return KN(this,n)},MWn._c=function(n,t){return++this.b,c5(this.a,n,t)},MWn.gc=function(){return this.a.c.length},MWn.bd=function(n,t){return new s1(this.a,n,t)},MWn.Pc=function(){return bx(this.a)},MWn.Qc=function(n){return Qgn(this.a,n)},MWn.b=0,vX(JYn,"NNode/ChangeAwareArrayList",795),wAn(269,1,{},qv),vX(JYn,"NNode/NNodeBuilder",269),wAn(1630,1,{},jn),MWn.a=!1,MWn.f=DWn,MWn.j=0,vX(JYn,"NetworkSimplex",1630),wAn(1294,1,lVn,Sw),MWn.td=function(n){qzn(this.a,BB(n,680),!0,!1)},vX(nJn,"NodeLabelAndSizeCalculator/lambda$0$Type",1294),wAn(558,1,{},Pw),MWn.b=!0,MWn.c=!0,MWn.d=!0,MWn.e=!0,vX(nJn,"NodeMarginCalculator",558),wAn(212,1,{212:1}),MWn.j=!1,MWn.k=!1;var Git,zit,Uit,Xit=vX(tJn,"Cell",212);wAn(124,212,{124:1,212:1},FR),MWn.Re=function(){return XH(this)},MWn.Se=function(){var n;return n=this.n,this.a.a+n.b+n.c},vX(tJn,"AtomicCell",124),wAn(232,22,{3:1,35:1,22:1,232:1},qS);var Wit,Vit=Ben(tJn,"ContainerArea",232,Unt,v1,d_);wAn(326,212,iJn),vX(tJn,"ContainerCell",326),wAn(1473,326,iJn,Hwn),MWn.Re=function(){var n;return n=0,this.e?this.b?n=this.b.b:this.a[1][1]&&(n=this.a[1][1].Re()):n=Ybn(this,Umn(this,!0)),n>0?n+this.n.d+this.n.a:0},MWn.Se=function(){var n,t,i,r,c;if(c=0,this.e)this.b?c=this.b.a:this.a[1][1]&&(c=this.a[1][1].Se());else if(this.g)c=Ybn(this,Okn(this,null,!0));else for(Dtn(),i=0,r=(t=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;i<r;++i)n=t[i],c=e.Math.max(c,Ybn(this,Okn(this,n,!0)));return c>0?c+this.n.b+this.n.c:0},MWn.Te=function(){var n,t,e,i,r;if(this.g)for(n=Okn(this,null,!1),Dtn(),i=0,r=(e=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;i<r;++i)Vxn(this,t=e[i],n);else for(Dtn(),i=0,r=(e=Pun(Gk(Vit,1),$Vn,232,0,[Git,zit,Uit])).length;i<r;++i)Vxn(this,t=e[i],n=Okn(this,t,!1))},MWn.Ue=function(){var n,t,i,r;t=this.i,n=this.n,r=Umn(this,!1),Q5(this,(Dtn(),Git),t.d+n.d,r),Q5(this,Uit,t.d+t.a-n.a-r[2],r),i=t.a-n.d-n.a,r[0]>0&&(r[0]+=this.d,i-=r[0]),r[2]>0&&(r[2]+=this.d,i-=r[2]),this.c.a=e.Math.max(0,i),this.c.d=t.d+n.d+(this.c.a-i)/2,r[1]=e.Math.max(r[1],i),Q5(this,zit,t.d+n.d+r[0]-(r[1]-i)/2,r)},MWn.b=null,MWn.d=0,MWn.e=!1,MWn.f=!1,MWn.g=!1;var Qit,Yit,Jit,Zit=0,nrt=0;vX(tJn,"GridContainerCell",1473),wAn(461,22,{3:1,35:1,22:1,461:1},GS);var trt,ert=Ben(tJn,"HorizontalLabelAlignment",461,Unt,m1,g_);wAn(306,212,{212:1,306:1},yJ,wtn,KY),MWn.Re=function(){return WH(this)},MWn.Se=function(){return VH(this)},MWn.a=0,MWn.c=!1;var irt,rrt,crt,art=vX(tJn,"LabelCell",306);wAn(244,326,{212:1,326:1,244:1},Ign),MWn.Re=function(){return MIn(this)},MWn.Se=function(){return SIn(this)},MWn.Te=function(){_Fn(this)},MWn.Ue=function(){GFn(this)},MWn.b=0,MWn.c=0,MWn.d=!1,vX(tJn,"StripContainerCell",244),wAn(1626,1,DVn,En),MWn.Mb=function(n){return Qy(BB(n,212))},vX(tJn,"StripContainerCell/lambda$0$Type",1626),wAn(1627,1,{},Tn),MWn.Fe=function(n){return BB(n,212).Se()},vX(tJn,"StripContainerCell/lambda$1$Type",1627),wAn(1628,1,DVn,Mn),MWn.Mb=function(n){return Yy(BB(n,212))},vX(tJn,"StripContainerCell/lambda$2$Type",1628),wAn(1629,1,{},Sn),MWn.Fe=function(n){return BB(n,212).Re()},vX(tJn,"StripContainerCell/lambda$3$Type",1629),wAn(462,22,{3:1,35:1,22:1,462:1},zS);var urt,ort,srt,hrt,frt,lrt,brt,wrt,drt,grt,prt,vrt,mrt,yrt,krt,jrt,Ert,Trt,Mrt,Srt,Prt,Crt,Irt,Ort=Ben(tJn,"VerticalLabelAlignment",462,Unt,y1,p_);wAn(789,1,{},eUn),MWn.c=0,MWn.d=0,MWn.k=0,MWn.s=0,MWn.t=0,MWn.v=!1,MWn.w=0,MWn.D=!1,vX(sJn,"NodeContext",789),wAn(1471,1,MYn,Pn),MWn.ue=function(n,t){return YO(BB(n,61),BB(t,61))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(sJn,"NodeContext/0methodref$comparePortSides$Type",1471),wAn(1472,1,MYn,Cn),MWn.ue=function(n,t){return UTn(BB(n,111),BB(t,111))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(sJn,"NodeContext/1methodref$comparePortContexts$Type",1472),wAn(159,22,{3:1,35:1,22:1,159:1},ocn);var Art,$rt,Lrt,Nrt,xrt,Drt,Rrt,Krt=Ben(sJn,"NodeLabelLocation",159,Unt,tpn,v_);wAn(111,1,{111:1},MOn),MWn.a=!1,vX(sJn,"PortContext",111),wAn(1476,1,lVn,In),MWn.td=function(n){CE(BB(n,306))},vX(lJn,bJn,1476),wAn(1477,1,DVn,On),MWn.Mb=function(n){return!!BB(n,111).c},vX(lJn,wJn,1477),wAn(1478,1,lVn,An),MWn.td=function(n){CE(BB(n,111).c)},vX(lJn,"LabelPlacer/lambda$2$Type",1478),wAn(1475,1,lVn,Ln),MWn.td=function(n){qD(),Yp(BB(n,111))},vX(lJn,"NodeLabelAndSizeUtilities/lambda$0$Type",1475),wAn(790,1,lVn,$_),MWn.td=function(n){RM(this.b,this.c,this.a,BB(n,181))},MWn.a=!1,MWn.c=!1,vX(lJn,"NodeLabelCellCreator/lambda$0$Type",790),wAn(1474,1,lVn,Cw),MWn.td=function(n){Iv(this.a,BB(n,181))},vX(lJn,"PortContextCreator/lambda$0$Type",1474),wAn(1829,1,{},Nn),vX(gJn,"GreedyRectangleStripOverlapRemover",1829),wAn(1830,1,MYn,$n),MWn.ue=function(n,t){return FN(BB(n,222),BB(t,222))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(gJn,"GreedyRectangleStripOverlapRemover/0methodref$compareByYCoordinate$Type",1830),wAn(1786,1,{},Zv),MWn.a=5,MWn.e=0,vX(gJn,"RectangleStripOverlapRemover",1786),wAn(1787,1,MYn,Dn),MWn.ue=function(n,t){return BN(BB(n,222),BB(t,222))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(gJn,"RectangleStripOverlapRemover/0methodref$compareLeftRectangleBorders$Type",1787),wAn(1789,1,MYn,Rn),MWn.ue=function(n,t){return JU(BB(n,222),BB(t,222))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(gJn,"RectangleStripOverlapRemover/1methodref$compareRightRectangleBorders$Type",1789),wAn(406,22,{3:1,35:1,22:1,406:1},US);var _rt,Frt,Brt,Hrt,qrt,Grt=Ben(gJn,"RectangleStripOverlapRemover/OverlapRemovalDirection",406,Unt,Y2,m_);wAn(222,1,{222:1},xG),vX(gJn,"RectangleStripOverlapRemover/RectangleNode",222),wAn(1788,1,lVn,Iw),MWn.td=function(n){Cmn(this.a,BB(n,222))},vX(gJn,"RectangleStripOverlapRemover/lambda$1$Type",1788),wAn(1304,1,MYn,Kn),MWn.ue=function(n,t){return zHn(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator",1304),wAn(1307,1,{},_n),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$0$Type",1307),wAn(1308,1,DVn,Fn),MWn.Mb=function(n){return BB(n,323).a},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$1$Type",1308),wAn(1309,1,DVn,Bn),MWn.Mb=function(n){return BB(n,323).a},vX(vJn,"PolyominoCompactor/CornerCasesGreaterThanRestComparator/lambda$2$Type",1309),wAn(1302,1,MYn,Hn),MWn.ue=function(n,t){return WRn(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinNumOfExtensionDirectionsComparator",1302),wAn(1305,1,{},xn),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"PolyominoCompactor/MinNumOfExtensionDirectionsComparator/lambda$0$Type",1305),wAn(767,1,MYn,qn),MWn.ue=function(n,t){return Uan(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinNumOfExtensionsComparator",767),wAn(1300,1,MYn,Gn),MWn.ue=function(n,t){return Qin(BB(n,321),BB(t,321))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinPerimeterComparator",1300),wAn(1301,1,MYn,zn),MWn.ue=function(n,t){return avn(BB(n,321),BB(t,321))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/MinPerimeterComparatorWithShape",1301),wAn(1303,1,MYn,Un),MWn.ue=function(n,t){return BKn(BB(n,167),BB(t,167))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(vJn,"PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator",1303),wAn(1306,1,{},Xn),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"PolyominoCompactor/SingleExtensionSideGreaterThanRestComparator/lambda$0$Type",1306),wAn(777,1,{},DS),MWn.Ce=function(n,t){return O2(this,BB(n,46),BB(t,167))},vX(vJn,"SuccessorCombination",777),wAn(644,1,{},Wn),MWn.Ce=function(n,t){var e;return XIn((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorJitter",644),wAn(643,1,{},Vn),MWn.Ce=function(n,t){var e;return bxn((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorLineByLine",643),wAn(568,1,{},Qn),MWn.Ce=function(n,t){var e;return f$n((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorManhattan",568),wAn(1356,1,{},Yn),MWn.Ce=function(n,t){var e;return jNn((e=BB(n,46),BB(t,167),e))},vX(vJn,"SuccessorMaxNormWindingInMathPosSense",1356),wAn(400,1,{},Ow),MWn.Ce=function(n,t){return BU(this,n,t)},MWn.c=!1,MWn.d=!1,MWn.e=!1,MWn.f=!1,vX(vJn,"SuccessorQuadrantsGeneric",400),wAn(1357,1,{},Jn),MWn.Kb=function(n){return BB(n,324).a},vX(vJn,"SuccessorQuadrantsGeneric/lambda$0$Type",1357),wAn(323,22,{3:1,35:1,22:1,323:1},_S),MWn.a=!1;var zrt,Urt=Ben(EJn,TJn,323,Unt,n3,y_);wAn(1298,1,{}),MWn.Ib=function(){var n,t,e,i,r,c;for(e=" ",n=iln(0),r=0;r<this.o;r++)e+=""+n.a,n=iln(lR(n.a));for(e+="\n",n=iln(0),c=0;c<this.p;c++){for(e+=""+n.a,n=iln(lR(n.a)),i=0;i<this.o;i++)0==Vhn(t=trn(this,i,c),0)?e+="_":0==Vhn(t,1)?e+="X":e+="0";e+="\n"}return fx(e,0,e.length-1)},MWn.o=0,MWn.p=0,vX(EJn,"TwoBitGrid",1298),wAn(321,1298,{321:1},qwn),MWn.j=0,MWn.k=0,vX(EJn,"PlanarGrid",321),wAn(167,321,{321:1,167:1}),MWn.g=0,MWn.i=0,vX(EJn,"Polyomino",167);var Xrt=bq(IJn,OJn);wAn(134,1,AJn,Zn),MWn.Ye=function(n,t){return son(this,n,t)},MWn.Ve=function(){return Gq(this)},MWn.We=function(n){return mMn(this,n)},MWn.Xe=function(n){return Lx(this,n)},vX(IJn,"MapPropertyHolder",134),wAn(1299,134,AJn,yxn),vX(EJn,"Polyominoes",1299);var Wrt,Vrt,Qrt,Yrt,Jrt,Zrt,nct,tct,ect=!1;wAn(1766,1,lVn,nt),MWn.td=function(n){uqn(BB(n,221))},vX($Jn,"DepthFirstCompaction/0methodref$compactTree$Type",1766),wAn(810,1,lVn,Aw),MWn.td=function(n){KW(this.a,BB(n,221))},vX($Jn,"DepthFirstCompaction/lambda$1$Type",810),wAn(1767,1,lVn,N_),MWn.td=function(n){dgn(this.a,this.b,this.c,BB(n,221))},vX($Jn,"DepthFirstCompaction/lambda$2$Type",1767),wAn(65,1,{65:1},AZ),vX($Jn,"Node",65),wAn(1250,1,{},I$),vX($Jn,"ScanlineOverlapCheck",1250),wAn(1251,1,{679:1},hY),MWn.Ke=function(n){GD(this,BB(n,440))},vX($Jn,"ScanlineOverlapCheck/OverlapsScanlineHandler",1251),wAn(1252,1,MYn,tt),MWn.ue=function(n,t){return xln(BB(n,65),BB(t,65))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX($Jn,"ScanlineOverlapCheck/OverlapsScanlineHandler/lambda$0$Type",1252),wAn(440,1,{440:1},RS),MWn.a=!1,vX($Jn,"ScanlineOverlapCheck/Timestamp",440),wAn(1253,1,MYn,et),MWn.ue=function(n,t){return Zkn(BB(n,440),BB(t,440))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX($Jn,"ScanlineOverlapCheck/lambda$0$Type",1253),wAn(550,1,{},it),vX(LJn,"SVGImage",550),wAn(324,1,{324:1},x_),MWn.Ib=function(){return"("+this.a+FWn+this.b+FWn+this.c+")"},vX(LJn,"UniqueTriple",324),wAn(209,1,NJn),vX(xJn,"AbstractLayoutProvider",209),wAn(1132,209,NJn,rt),MWn.Ze=function(n,t){var e,i,r;OTn(t,DJn,1),this.a=Gy(MD(ZAn(n,(Epn(),Ect)))),P8(n,bct)&&(i=SD(ZAn(n,bct)),(e=XRn(cin(),i))&&BB(sJ(e.f),209).Ze(n,mcn(t,1))),r=new s4(this.a),this.b=Rzn(r,n),0===BB(ZAn(n,(Gsn(),oct)),481).g?(BOn(new ct,this.b),Ypn(n,gct,mMn(this.b,gct))):$T(),Uzn(r),Ypn(n,dct,this.b),HSn(t)},MWn.a=0,vX(RJn,"DisCoLayoutProvider",1132),wAn(1244,1,{},ct),MWn.c=!1,MWn.e=0,MWn.f=0,vX(RJn,"DisCoPolyominoCompactor",1244),wAn(561,1,{561:1},hG),MWn.b=!0,vX(KJn,"DCComponent",561),wAn(394,22,{3:1,35:1,22:1,394:1},KS),MWn.a=!1;var ict,rct,cct=Ben(KJn,"DCDirection",394,Unt,Z2,k_);wAn(266,134,{3:1,266:1,94:1,134:1},EAn),vX(KJn,"DCElement",266),wAn(395,1,{395:1},Imn),MWn.c=0,vX(KJn,"DCExtension",395),wAn(755,134,AJn,_j),vX(KJn,"DCGraph",755),wAn(481,22,{3:1,35:1,22:1,481:1},Ix);var act,uct,oct,sct,hct,fct,lct,bct,wct,dct,gct,pct,vct,mct,yct,kct,jct,Ect,Tct,Mct,Sct,Pct=Ben(_Jn,FJn,481,Unt,RV,j_);wAn(854,1,QYn,Hh),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,BJn),zJn),"Connected Components Compaction Strategy"),"Strategy for packing different connected components in order to save space and enhance readability of a graph."),sct),(PPn(),gMt)),Pct),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,HJn),zJn),"Connected Components Layout Algorithm"),"A layout algorithm that is to be applied to each connected component before the components themselves are compacted. If unspecified, the positions of the components' nodes are not altered."),yMt),Qtt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,qJn),"debug"),"DCGraph"),"Access to the DCGraph is intended for the debug view,"),mMt),Ant),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,GJn),"debug"),"List of Polyominoes"),"Access to the polyominoes is intended for the debug view,"),mMt),Ant),nbn(hMt)))),BBn((new qh,n))},vX(_Jn,"DisCoMetaDataProvider",854),wAn(998,1,QYn,qh),MWn.Qe=function(n){BBn(n)},vX(_Jn,"DisCoOptions",998),wAn(999,1,{},at),MWn.$e=function(){return new rt},MWn._e=function(n){},vX(_Jn,"DisCoOptions/DiscoFactory",999),wAn(562,167,{321:1,167:1,562:1},Q$n),MWn.a=0,MWn.b=0,MWn.c=0,MWn.d=0,vX("org.eclipse.elk.alg.disco.structures","DCPolyomino",562),wAn(1268,1,DVn,ut),MWn.Mb=function(n){return TO(n)},vX(YJn,"ElkGraphComponentsProcessor/lambda$0$Type",1268),wAn(1269,1,{},ot),MWn.Kb=function(n){return MQ(),PMn(BB(n,79))},vX(YJn,"ElkGraphComponentsProcessor/lambda$1$Type",1269),wAn(1270,1,DVn,st),MWn.Mb=function(n){return qH(BB(n,79))},vX(YJn,"ElkGraphComponentsProcessor/lambda$2$Type",1270),wAn(1271,1,{},ht),MWn.Kb=function(n){return MQ(),OMn(BB(n,79))},vX(YJn,"ElkGraphComponentsProcessor/lambda$3$Type",1271),wAn(1272,1,DVn,ft),MWn.Mb=function(n){return GH(BB(n,79))},vX(YJn,"ElkGraphComponentsProcessor/lambda$4$Type",1272),wAn(1273,1,DVn,$w),MWn.Mb=function(n){return MJ(this.a,BB(n,79))},vX(YJn,"ElkGraphComponentsProcessor/lambda$5$Type",1273),wAn(1274,1,{},Lw),MWn.Kb=function(n){return KX(this.a,BB(n,79))},vX(YJn,"ElkGraphComponentsProcessor/lambda$6$Type",1274),wAn(1241,1,{},s4),MWn.a=0,vX(YJn,"ElkGraphTransformer",1241),wAn(1242,1,{},lt),MWn.Od=function(n,t){tOn(this,BB(n,160),BB(t,266))},vX(YJn,"ElkGraphTransformer/OffsetApplier",1242),wAn(1243,1,lVn,Nw),MWn.td=function(n){TL(this,BB(n,8))},vX(YJn,"ElkGraphTransformer/OffsetApplier/OffSetToChainApplier",1243),wAn(753,1,{},bt),vX(eZn,iZn,753),wAn(1232,1,MYn,wt),MWn.ue=function(n,t){return CIn(BB(n,231),BB(t,231))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(eZn,rZn,1232),wAn(740,209,NJn,Gv),MWn.Ze=function(n,t){vLn(this,n,t)},vX(eZn,"ForceLayoutProvider",740),wAn(357,134,{3:1,357:1,94:1,134:1}),vX(cZn,"FParticle",357),wAn(559,357,{3:1,559:1,357:1,94:1,134:1},hX),MWn.Ib=function(){var n;return this.a?(n=E7(this.a.a,this,0))>=0?"b"+n+"["+u5(this.a)+"]":"b["+u5(this.a)+"]":"b_"+PN(this)},vX(cZn,"FBendpoint",559),wAn(282,134,{3:1,282:1,94:1,134:1},IR),MWn.Ib=function(){return u5(this)},vX(cZn,"FEdge",282),wAn(231,134,{3:1,231:1,94:1,134:1},y6);var Cct,Ict,Oct,Act,$ct,Lct,Nct,xct,Dct,Rct,Kct=vX(cZn,"FGraph",231);wAn(447,357,{3:1,447:1,357:1,94:1,134:1},m4),MWn.Ib=function(){return null==this.b||0==this.b.length?"l["+u5(this.a)+"]":"l_"+this.b},vX(cZn,"FLabel",447),wAn(144,357,{3:1,144:1,357:1,94:1,134:1},qX),MWn.Ib=function(){return p0(this)},MWn.b=0,vX(cZn,"FNode",144),wAn(2003,1,{}),MWn.bf=function(n){sFn(this,n)},MWn.cf=function(){qmn(this)},MWn.d=0,vX(uZn,"AbstractForceModel",2003),wAn(631,2003,{631:1},Lan),MWn.af=function(n,t){var i,r,c,a;return tIn(this.f,n,t),c=XR(B$(t.d),n.d),a=e.Math.sqrt(c.a*c.a+c.b*c.b),r=e.Math.max(0,a-lW(n.e)/2-lW(t.e)/2),kL(c,((i=qon(this.e,n,t))>0?-_U(r,this.c)*i:xx(r,this.b)*BB(mMn(n,(fRn(),Zct)),19).a)/a),c},MWn.bf=function(n){sFn(this,n),this.a=BB(mMn(n,(fRn(),qct)),19).a,this.c=Gy(MD(mMn(n,cat))),this.b=Gy(MD(mMn(n,tat)))},MWn.df=function(n){return n<this.a},MWn.a=0,MWn.b=0,MWn.c=0,vX(uZn,"EadesModel",631),wAn(632,2003,{632:1},fH),MWn.af=function(n,t){var i,r,c,a,u;return tIn(this.f,n,t),c=XR(B$(t.d),n.d),u=e.Math.sqrt(c.a*c.a+c.b*c.b),a=Nx(r=e.Math.max(0,u-lW(n.e)/2-lW(t.e)/2),this.a)*BB(mMn(n,(fRn(),Zct)),19).a,(i=qon(this.e,n,t))>0&&(a-=Sy(r,this.a)*i),kL(c,a*this.b/u),c},MWn.bf=function(n){var t,i,r,c,a,u,o;for(sFn(this,n),this.b=Gy(MD(mMn(n,(fRn(),aat)))),this.c=this.b/BB(mMn(n,qct),19).a,r=n.e.c.length,a=0,c=0,o=new Wb(n.e);o.a<o.c.c.length;)a+=(u=BB(n0(o),144)).e.a,c+=u.e.b;t=a*c,i=Gy(MD(mMn(n,cat)))*fJn,this.a=e.Math.sqrt(t/(2*r))*i},MWn.cf=function(){qmn(this),this.b-=this.c},MWn.df=function(n){return this.b>0},MWn.a=0,MWn.b=0,MWn.c=0,vX(uZn,"FruchtermanReingoldModel",632),wAn(849,1,QYn,zh),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,oZn),""),"Force Model"),"Determines the model for force calculation."),Oct),(PPn(),gMt)),$at),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,sZn),""),"Iterations"),"The number of iterations on the force model."),iln(300)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,hZn),""),"Repulsive Power"),"Determines how many bend points are added to the edge; such bend points are regarded as repelling particles in the force model"),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,fZn),""),"FR Temperature"),"The temperature is used as a scaling factor for particle displacements."),lZn),dMt),Ptt),nbn(hMt)))),a2(n,fZn,oZn,xct),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,bZn),""),"Eades Repulsion"),"Factor for repulsive forces in Eades' model."),5),dMt),Ptt),nbn(hMt)))),a2(n,bZn,oZn,$ct),pUn((new Uh,n))},vX(wZn,"ForceMetaDataProvider",849),wAn(424,22,{3:1,35:1,22:1,424:1},XS);var _ct,Fct,Bct,Hct,qct,Gct,zct,Uct,Xct,Wct,Vct,Qct,Yct,Jct,Zct,nat,tat,eat,iat,rat,cat,aat,uat,oat,sat,hat,fat,lat,bat,wat,dat,gat,pat,vat,mat,yat,kat,jat,Eat,Tat,Mat,Sat,Pat,Cat,Iat,Oat,Aat,$at=Ben(wZn,"ForceModelStrategy",424,Unt,aJ,E_);wAn(988,1,QYn,Uh),MWn.Qe=function(n){pUn(n)},vX(wZn,"ForceOptions",988),wAn(989,1,{},dt),MWn.$e=function(){return new Gv},MWn._e=function(n){},vX(wZn,"ForceOptions/ForceFactory",989),wAn(850,1,QYn,Xh),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,NZn),""),"Fixed Position"),"Prevent that the node is moved by the layout algorithm."),(hN(),!1)),(PPn(),wMt)),ktt),nbn((rpn(),sMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,xZn),""),"Desired Edge Length"),"Either specified for parent nodes or for individual edges, where the latter takes higher precedence."),100),dMt),Ptt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,DZn),""),"Layout Dimension"),"Dimensions that are permitted to be altered during layout."),bat),gMt),Hat),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,RZn),""),"Stress Epsilon"),"Termination criterion for the iterative process."),lZn),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,KZn),""),"Iteration Limit"),"Maximum number of performed iterations. Takes higher precedence than 'epsilon'."),iln(DWn)),vMt),Att),nbn(hMt)))),UGn((new Wh,n))},vX(wZn,"StressMetaDataProvider",850),wAn(992,1,QYn,Wh),MWn.Qe=function(n){UGn(n)},vX(wZn,"StressOptions",992),wAn(993,1,{},gt),MWn.$e=function(){return new OR},MWn._e=function(n){},vX(wZn,"StressOptions/StressFactory",993),wAn(1128,209,NJn,OR),MWn.Ze=function(n,t){var e,i,r,c;for(OTn(t,FZn,1),qy(TD(ZAn(n,(rkn(),kat))))?qy(TD(ZAn(n,Pat)))||jJ(new Tw((GM(),new Dy(n)))):vLn(new Gv,n,mcn(t,1)),i=fon(n),c=(e=HFn(this.a,i)).Kc();c.Ob();)(r=BB(c.Pb(),231)).e.c.length<=1||(HHn(this.b,r),i$n(this.b),Otn(r.d,new pt));SUn(i=GUn(e)),HSn(t)},vX(HZn,"StressLayoutProvider",1128),wAn(1129,1,lVn,pt),MWn.td=function(n){_Bn(BB(n,447))},vX(HZn,"StressLayoutProvider/lambda$0$Type",1129),wAn(990,1,{},Tv),MWn.c=0,MWn.e=0,MWn.g=0,vX(HZn,"StressMajorization",990),wAn(379,22,{3:1,35:1,22:1,379:1},WS);var Lat,Nat,xat,Dat,Rat,Kat,_at,Fat,Bat,Hat=Ben(HZn,"StressMajorization/Dimension",379,Unt,j1,T_);wAn(991,1,MYn,xw),MWn.ue=function(n,t){return SK(this.a,BB(n,144),BB(t,144))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(HZn,"StressMajorization/lambda$0$Type",991),wAn(1229,1,{},D0),vX(GZn,"ElkLayered",1229),wAn(1230,1,lVn,vt),MWn.td=function(n){RIn(BB(n,37))},vX(GZn,"ElkLayered/lambda$0$Type",1230),wAn(1231,1,lVn,Dw),MWn.td=function(n){PK(this.a,BB(n,37))},vX(GZn,"ElkLayered/lambda$1$Type",1231),wAn(1263,1,{},$$),vX(GZn,"GraphConfigurator",1263),wAn(759,1,lVn,Rw),MWn.td=function(n){VMn(this.a,BB(n,10))},vX(GZn,"GraphConfigurator/lambda$0$Type",759),wAn(760,1,{},mt),MWn.Kb=function(n){return tjn(),new Rq(null,new w1(BB(n,29).a,16))},vX(GZn,"GraphConfigurator/lambda$1$Type",760),wAn(761,1,lVn,Kw),MWn.td=function(n){VMn(this.a,BB(n,10))},vX(GZn,"GraphConfigurator/lambda$2$Type",761),wAn(1127,209,NJn,Uv),MWn.Ze=function(n,t){var e;e=SBn(new tm,n),GI(ZAn(n,(HXn(),sgt)))===GI((ufn(),pCt))?rwn(this.a,e,t):wOn(this.a,e,t),gUn(new Qh,e)},vX(GZn,"LayeredLayoutProvider",1127),wAn(356,22,{3:1,35:1,22:1,356:1},VS);var qat,Gat,zat,Uat=Ben(GZn,"LayeredPhases",356,Unt,s5,M_);wAn(1651,1,{},vin),MWn.i=0,vX(zZn,"ComponentsToCGraphTransformer",1651),wAn(1652,1,{},yt),MWn.ef=function(n,t){return e.Math.min(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},MWn.ff=function(n,t){return e.Math.min(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},vX(zZn,"ComponentsToCGraphTransformer/1",1652),wAn(81,1,{81:1}),MWn.i=0,MWn.k=!0,MWn.o=KQn;var Xat,Wat,Vat,Qat=vX(UZn,"CNode",81);wAn(460,81,{460:1,81:1},NN,Sgn),MWn.Ib=function(){return""},vX(zZn,"ComponentsToCGraphTransformer/CRectNode",460),wAn(1623,1,{},kt),vX(zZn,"OneDimensionalComponentsCompaction",1623),wAn(1624,1,{},jt),MWn.Kb=function(n){return xZ(BB(n,46))},MWn.Fb=function(n){return this===n},vX(zZn,"OneDimensionalComponentsCompaction/lambda$0$Type",1624),wAn(1625,1,{},Et),MWn.Kb=function(n){return Ewn(BB(n,46))},MWn.Fb=function(n){return this===n},vX(zZn,"OneDimensionalComponentsCompaction/lambda$1$Type",1625),wAn(1654,1,{},BX),vX(UZn,"CGraph",1654),wAn(189,1,{189:1},Pgn),MWn.b=0,MWn.c=0,MWn.e=0,MWn.g=!0,MWn.i=KQn,vX(UZn,"CGroup",189),wAn(1653,1,{},Pt),MWn.ef=function(n,t){return e.Math.max(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},MWn.ff=function(n,t){return e.Math.max(null!=n.a?Gy(n.a):n.c.i,null!=t.a?Gy(t.a):t.c.i)},vX(UZn,OYn,1653),wAn(1655,1,{},sOn),MWn.d=!1;var Yat=vX(UZn,xYn,1655);wAn(1656,1,{},Ct),MWn.Kb=function(n){return kM(),hN(),0!=BB(BB(n,46).a,81).d.e},MWn.Fb=function(n){return this===n},vX(UZn,DYn,1656),wAn(823,1,{},Sq),MWn.a=!1,MWn.b=!1,MWn.c=!1,MWn.d=!1,vX(UZn,RYn,823),wAn(1825,1,{},DG),vX(XZn,KYn,1825);var Jat=bq(WZn,PYn);wAn(1826,1,{369:1},lY),MWn.Ke=function(n){Gxn(this,BB(n,466))},vX(XZn,_Yn,1826),wAn(1827,1,MYn,It),MWn.ue=function(n,t){return oQ(BB(n,81),BB(t,81))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(XZn,FYn,1827),wAn(466,1,{466:1},fP),MWn.a=!1,vX(XZn,BYn,466),wAn(1828,1,MYn,Ot),MWn.ue=function(n,t){return njn(BB(n,466),BB(t,466))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(XZn,HYn,1828),wAn(140,1,{140:1},dP,mH),MWn.Fb=function(n){var t;return null!=n&&iut==tsn(n)&&(t=BB(n,140),cV(this.c,t.c)&&cV(this.d,t.d))},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[this.c,this.d]))},MWn.Ib=function(){return"("+this.c+FWn+this.d+(this.a?"cx":"")+this.b+")"},MWn.a=!0,MWn.c=0,MWn.d=0;var Zat,nut,tut,eut,iut=vX(WZn,"Point",140);wAn(405,22,{3:1,35:1,22:1,405:1},QS);var rut,cut,aut,uut,out,sut,hut,fut,lut,but,wut,dut=Ben(WZn,"Point/Quadrant",405,Unt,t3,S_);wAn(1642,1,{},Vv),MWn.b=null,MWn.c=null,MWn.d=null,MWn.e=null,MWn.f=null,vX(WZn,"RectilinearConvexHull",1642),wAn(574,1,{369:1},Tpn),MWn.Ke=function(n){_9(this,BB(n,140))},MWn.b=0,vX(WZn,"RectilinearConvexHull/MaximalElementsEventHandler",574),wAn(1644,1,MYn,Mt),MWn.ue=function(n,t){return DV(MD(n),MD(t))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/MaximalElementsEventHandler/lambda$0$Type",1644),wAn(1643,1,{369:1},ftn),MWn.Ke=function(n){PNn(this,BB(n,140))},MWn.a=0,MWn.b=null,MWn.c=null,MWn.d=null,MWn.e=null,vX(WZn,"RectilinearConvexHull/RectangleEventHandler",1643),wAn(1645,1,MYn,St),MWn.ue=function(n,t){return u0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$0$Type",1645),wAn(1646,1,MYn,Tt),MWn.ue=function(n,t){return o0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$1$Type",1646),wAn(1647,1,MYn,At),MWn.ue=function(n,t){return h0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$2$Type",1647),wAn(1648,1,MYn,$t),MWn.ue=function(n,t){return s0(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$3$Type",1648),wAn(1649,1,MYn,Lt),MWn.ue=function(n,t){return jMn(BB(n,140),BB(t,140))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(WZn,"RectilinearConvexHull/lambda$4$Type",1649),wAn(1650,1,{},OZ),vX(WZn,"Scanline",1650),wAn(2005,1,{}),vX(VZn,"AbstractGraphPlacer",2005),wAn(325,1,{325:1},Xx),MWn.mf=function(n){return!!this.nf(n)&&(JIn(this.b,BB(mMn(n,(hWn(),Xft)),21),n),!0)},MWn.nf=function(n){var t,e,i;for(t=BB(mMn(n,(hWn(),Xft)),21),i=BB(h6(fut,t),21).Kc();i.Ob();)if(e=BB(i.Pb(),21),!BB(h6(this.b,e),15).dc())return!1;return!0},vX(VZn,"ComponentGroup",325),wAn(765,2005,{},Qv),MWn.of=function(n){var t;for(t=new Wb(this.a);t.a<t.c.c.length;)if(BB(n0(t),325).mf(n))return;WB(this.a,new Xx(n))},MWn.lf=function(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w;if(this.a.c=x8(Ant,HWn,1,0,5,1),t.a.c=x8(Ant,HWn,1,0,5,1),n.dc())return t.f.a=0,void(t.f.b=0);for(qan(t,a=BB(n.Xb(0),37)),r=n.Kc();r.Ob();)i=BB(r.Pb(),37),this.of(i);for(w=new Gj,c=Gy(MD(mMn(a,(HXn(),mpt)))),s=new Wb(this.a);s.a<s.c.c.length;)h=TXn(u=BB(n0(s),325),c),w9(TX(u.b),w.a,w.b),w.a+=h.a,w.b+=h.b;if(t.f.a=w.a-c,t.f.b=w.b-c,qy(TD(mMn(a,Mdt)))&&GI(mMn(a,Zdt))===GI((Mbn(),QPt))){for(b=n.Kc();b.Ob();)ZRn(f=BB(b.Pb(),37),f.c.a,f.c.b);for(KXn(e=new Nt,n,c),l=n.Kc();l.Ob();)UR(kO((f=BB(l.Pb(),37)).c),e.e);UR(kO(t.f),e.a)}for(o=new Wb(this.a);o.a<o.c.c.length;)d9(t,TX((u=BB(n0(o),325)).b))},vX(VZn,"ComponentGroupGraphPlacer",765),wAn(1293,765,{},hm),MWn.of=function(n){pfn(this,n)},MWn.lf=function(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v;if(this.a.c=x8(Ant,HWn,1,0,5,1),t.a.c=x8(Ant,HWn,1,0,5,1),n.dc())return t.f.a=0,void(t.f.b=0);for(qan(t,a=BB(n.Xb(0),37)),r=n.Kc();r.Ob();)pfn(this,BB(r.Pb(),37));for(v=new Gj,p=new Gj,d=new Gj,w=new Gj,c=Gy(MD(mMn(a,(HXn(),mpt)))),s=new Wb(this.a);s.a<s.c.c.length;){if(u=BB(n0(s),325),dA(BB(mMn(t,(sWn(),bSt)),103))){for(d.a=v.a,g=new ly(MX(kX(u.b).a).a.kc());g.b.Ob();)if(BB(cS(g.b.Pb()),21).Hc((kUn(),sIt))){d.a=p.a;break}}else if(gA(BB(mMn(t,bSt),103)))for(d.b=v.b,g=new ly(MX(kX(u.b).a).a.kc());g.b.Ob();)if(BB(cS(g.b.Pb()),21).Hc((kUn(),CIt))){d.b=p.b;break}if(h=TXn(BB(u,570),c),w9(TX(u.b),d.a,d.b),dA(BB(mMn(t,bSt),103))){for(p.a=d.a+h.a,w.a=e.Math.max(w.a,p.a),g=new ly(MX(kX(u.b).a).a.kc());g.b.Ob();)if(BB(cS(g.b.Pb()),21).Hc((kUn(),SIt))){v.a=d.a+h.a;break}p.b=d.b+h.b,d.b=p.b,w.b=e.Math.max(w.b,d.b)}else if(gA(BB(mMn(t,bSt),103))){for(p.b=d.b+h.b,w.b=e.Math.max(w.b,p.b),g=new ly(MX(kX(u.b).a).a.kc());g.b.Ob();)if(BB(cS(g.b.Pb()),21).Hc((kUn(),oIt))){v.b=d.b+h.b;break}p.a=d.a+h.a,d.a=p.a,w.a=e.Math.max(w.a,d.a)}}if(t.f.a=w.a-c,t.f.b=w.b-c,qy(TD(mMn(a,Mdt)))&&GI(mMn(a,Zdt))===GI((Mbn(),QPt))){for(b=n.Kc();b.Ob();)ZRn(f=BB(b.Pb(),37),f.c.a,f.c.b);for(KXn(i=new Nt,n,c),l=n.Kc();l.Ob();)UR(kO((f=BB(l.Pb(),37)).c),i.e);UR(kO(t.f),i.a)}for(o=new Wb(this.a);o.a<o.c.c.length;)d9(t,TX((u=BB(n0(o),325)).b))},vX(VZn,"ComponentGroupModelOrderGraphPlacer",1293),wAn(423,22,{3:1,35:1,22:1,423:1},YS);var gut,put,vut,mut=Ben(VZn,"ComponentOrderingStrategy",423,Unt,k1,P_);wAn(650,1,{},Nt),vX(VZn,"ComponentsCompactor",650),wAn(1468,12,QQn,v5),MWn.Fc=function(n){return Yjn(this,BB(n,140))},vX(VZn,"ComponentsCompactor/Hullpoints",1468),wAn(1465,1,{841:1},hvn),MWn.a=!1,vX(VZn,"ComponentsCompactor/InternalComponent",1465),wAn(1464,1,pVn,Yv),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new Wb(this.a)},vX(VZn,"ComponentsCompactor/InternalConnectedComponents",1464),wAn(1467,1,{594:1},dOn),MWn.hf=function(){return null},MWn.jf=function(){return this.a},MWn.gf=function(){return upn(this.d)},MWn.kf=function(){return this.b},vX(VZn,"ComponentsCompactor/InternalExternalExtension",1467),wAn(1466,1,{594:1},nm),MWn.jf=function(){return this.a},MWn.gf=function(){return upn(this.d)},MWn.hf=function(){return this.c},MWn.kf=function(){return this.b},vX(VZn,"ComponentsCompactor/InternalUnionExternalExtension",1466),wAn(1470,1,{},Qxn),vX(VZn,"ComponentsCompactor/OuterSegments",1470),wAn(1469,1,{},Jv),vX(VZn,"ComponentsCompactor/Segments",1469),wAn(1264,1,{},bY),vX(VZn,iZn,1264),wAn(1265,1,MYn,xt),MWn.ue=function(n,t){return b0(BB(n,37),BB(t,37))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(VZn,"ComponentsProcessor/lambda$0$Type",1265),wAn(570,325,{325:1,570:1},p5),MWn.mf=function(n){return dsn(this,n)},MWn.nf=function(n){return bNn(this,n)},vX(VZn,"ModelOrderComponentGroup",570),wAn(1291,2005,{},Dt),MWn.lf=function(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j;if(1!=n.gc()){if(n.dc())return t.a.c=x8(Ant,HWn,1,0,5,1),t.f.a=0,void(t.f.b=0);if(GI(mMn(t,(HXn(),Cdt)))===GI((Bfn(),wut))){for(s=n.Kc();s.Ob();){for(p=0,d=new Wb((u=BB(s.Pb(),37)).a);d.a<d.c.c.length;)w=BB(n0(d),10),p+=BB(mMn(w,hpt),19).a;u.p=p}SQ(),n.ad(new Rt)}for(a=BB(n.Xb(0),37),t.a.c=x8(Ant,HWn,1,0,5,1),qan(t,a),b=0,y=0,h=n.Kc();h.Ob();)v=(u=BB(h.Pb(),37)).f,b=e.Math.max(b,v.a),y+=v.a*v.b;for(b=e.Math.max(b,e.Math.sqrt(y)*Gy(MD(mMn(t,Edt)))),k=0,j=0,l=0,i=c=Gy(MD(mMn(t,mpt))),o=n.Kc();o.Ob();)k+(v=(u=BB(o.Pb(),37)).f).a>b&&(k=0,j+=l+c,l=0),ZRn(u,k+(g=u.c).a,j+g.b),kO(g),i=e.Math.max(i,k+v.a),l=e.Math.max(l,v.b),k+=v.a+c;if(t.f.a=i,t.f.b=j+l,qy(TD(mMn(a,Mdt)))){for(KXn(r=new Nt,n,c),f=n.Kc();f.Ob();)UR(kO(BB(f.Pb(),37).c),r.e);UR(kO(t.f),r.a)}d9(t,n)}else(m=BB(n.Xb(0),37))!=t&&(t.a.c=x8(Ant,HWn,1,0,5,1),$Kn(t,m,0,0),qan(t,m),kQ(t.d,m.d),t.f.a=m.f.a,t.f.b=m.f.b)},vX(VZn,"SimpleRowGraphPlacer",1291),wAn(1292,1,MYn,Rt),MWn.ue=function(n,t){return zan(BB(n,37),BB(t,37))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(VZn,"SimpleRowGraphPlacer/1",1292),wAn(1262,1,qYn,Kt),MWn.Lb=function(n){var t;return!!(t=BB(mMn(BB(n,243).b,(HXn(),vgt)),74))&&0!=t.b},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){var t;return!!(t=BB(mMn(BB(n,243).b,(HXn(),vgt)),74))&&0!=t.b},vX(ZZn,"CompoundGraphPostprocessor/1",1262),wAn(1261,1,n1n,em),MWn.pf=function(n,t){mvn(this,BB(n,37),t)},vX(ZZn,"CompoundGraphPreprocessor",1261),wAn(441,1,{441:1},zfn),MWn.c=!1,vX(ZZn,"CompoundGraphPreprocessor/ExternalPort",441),wAn(243,1,{243:1},L_),MWn.Ib=function(){return dx(this.c)+":"+OIn(this.b)},vX(ZZn,"CrossHierarchyEdge",243),wAn(763,1,MYn,_w),MWn.ue=function(n,t){return Vyn(this,BB(n,243),BB(t,243))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(ZZn,"CrossHierarchyEdgeComparator",763),wAn(299,134,{3:1,299:1,94:1,134:1}),MWn.p=0,vX(t1n,"LGraphElement",299),wAn(17,299,{3:1,17:1,299:1,94:1,134:1},wY),MWn.Ib=function(){return OIn(this)};var yut=vX(t1n,"LEdge",17);wAn(37,299,{3:1,20:1,37:1,299:1,94:1,134:1},min),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new Wb(this.b)},MWn.Ib=function(){return 0==this.b.c.length?"G-unlayered"+LMn(this.a):0==this.a.c.length?"G-layered"+LMn(this.b):"G[layerless"+LMn(this.a)+", layers"+LMn(this.b)+"]"};var kut,jut=vX(t1n,"LGraph",37);wAn(657,1,{}),MWn.qf=function(){return this.e.n},MWn.We=function(n){return mMn(this.e,n)},MWn.rf=function(){return this.e.o},MWn.sf=function(){return this.e.p},MWn.Xe=function(n){return Lx(this.e,n)},MWn.tf=function(n){this.e.n.a=n.a,this.e.n.b=n.b},MWn.uf=function(n){this.e.o.a=n.a,this.e.o.b=n.b},MWn.vf=function(n){this.e.p=n},vX(t1n,"LGraphAdapters/AbstractLShapeAdapter",657),wAn(577,1,{839:1},Fw),MWn.wf=function(){var n,t;if(!this.b)for(this.b=sx(this.a.b.c.length),t=new Wb(this.a.b);t.a<t.c.c.length;)n=BB(n0(t),70),WB(this.b,new Bw(n));return this.b},MWn.b=null,vX(t1n,"LGraphAdapters/LEdgeAdapter",577),wAn(656,1,{},HV),MWn.xf=function(){var n,t,e,i,r;if(!this.b)for(this.b=new Np,e=new Wb(this.a.b);e.a<e.c.c.length;)for(r=new Wb(BB(n0(e),29).a);r.a<r.c.c.length;)if(i=BB(n0(r),10),this.c.Mb(i)&&(WB(this.b,new __(this,i,this.e)),this.d)){if(Lx(i,(hWn(),Klt)))for(t=BB(mMn(i,Klt),15).Kc();t.Ob();)n=BB(t.Pb(),10),WB(this.b,new __(this,n,!1));if(Lx(i,Dft))for(t=BB(mMn(i,Dft),15).Kc();t.Ob();)n=BB(t.Pb(),10),WB(this.b,new __(this,n,!1))}return this.b},MWn.qf=function(){throw Hp(new tk(i1n))},MWn.We=function(n){return mMn(this.a,n)},MWn.rf=function(){return this.a.f},MWn.sf=function(){return this.a.p},MWn.Xe=function(n){return Lx(this.a,n)},MWn.tf=function(n){throw Hp(new tk(i1n))},MWn.uf=function(n){this.a.f.a=n.a,this.a.f.b=n.b},MWn.vf=function(n){this.a.p=n},MWn.b=null,MWn.d=!1,MWn.e=!1,vX(t1n,"LGraphAdapters/LGraphAdapter",656),wAn(576,657,{181:1},Bw),vX(t1n,"LGraphAdapters/LLabelAdapter",576),wAn(575,657,{680:1},__),MWn.yf=function(){return this.b},MWn.zf=function(){return SQ(),SQ(),set},MWn.wf=function(){var n,t;if(!this.a)for(this.a=sx(BB(this.e,10).b.c.length),t=new Wb(BB(this.e,10).b);t.a<t.c.c.length;)n=BB(n0(t),70),WB(this.a,new Bw(n));return this.a},MWn.Af=function(){var n;return new HR((n=BB(this.e,10).d).d,n.c,n.a,n.b)},MWn.Bf=function(){return SQ(),SQ(),set},MWn.Cf=function(){var n,t;if(!this.c)for(this.c=sx(BB(this.e,10).j.c.length),t=new Wb(BB(this.e,10).j);t.a<t.c.c.length;)n=BB(n0(t),11),WB(this.c,new gP(n,this.d));return this.c},MWn.Df=function(){return qy(TD(mMn(BB(this.e,10),(hWn(),_ft))))},MWn.Ef=function(n){BB(this.e,10).d.b=n.b,BB(this.e,10).d.d=n.d,BB(this.e,10).d.c=n.c,BB(this.e,10).d.a=n.a},MWn.Ff=function(n){BB(this.e,10).f.b=n.b,BB(this.e,10).f.d=n.d,BB(this.e,10).f.c=n.c,BB(this.e,10).f.a=n.a},MWn.Gf=function(){Ntn(this,(gM(),kut))},MWn.a=null,MWn.b=null,MWn.c=null,MWn.d=!1,vX(t1n,"LGraphAdapters/LNodeAdapter",575),wAn(1722,657,{838:1},gP),MWn.zf=function(){var n,t,e,i;if(this.d&&BB(this.e,11).i.k==(uSn(),Iut))return SQ(),SQ(),set;if(!this.a){for(this.a=new Np,e=new Wb(BB(this.e,11).e);e.a<e.c.c.length;)n=BB(n0(e),17),WB(this.a,new Fw(n));if(this.d&&(i=BB(mMn(BB(this.e,11),(hWn(),Elt)),10)))for(t=new oz(ZL(fbn(i).a.Kc(),new h));dAn(t);)n=BB(U5(t),17),WB(this.a,new Fw(n))}return this.a},MWn.wf=function(){var n,t;if(!this.b)for(this.b=sx(BB(this.e,11).f.c.length),t=new Wb(BB(this.e,11).f);t.a<t.c.c.length;)n=BB(n0(t),70),WB(this.b,new Bw(n));return this.b},MWn.Bf=function(){var n,t,e,i;if(this.d&&BB(this.e,11).i.k==(uSn(),Iut))return SQ(),SQ(),set;if(!this.c){for(this.c=new Np,e=new Wb(BB(this.e,11).g);e.a<e.c.c.length;)n=BB(n0(e),17),WB(this.c,new Fw(n));if(this.d&&(i=BB(mMn(BB(this.e,11),(hWn(),Elt)),10)))for(t=new oz(ZL(lbn(i).a.Kc(),new h));dAn(t);)n=BB(U5(t),17),WB(this.c,new Fw(n))}return this.c},MWn.Hf=function(){return BB(this.e,11).j},MWn.If=function(){return qy(TD(mMn(BB(this.e,11),(hWn(),elt))))},MWn.a=null,MWn.b=null,MWn.c=null,MWn.d=!1,vX(t1n,"LGraphAdapters/LPortAdapter",1722),wAn(1723,1,MYn,_t),MWn.ue=function(n,t){return WDn(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(t1n,"LGraphAdapters/PortComparator",1723),wAn(804,1,DVn,Ft),MWn.Mb=function(n){return BB(n,10),gM(),!0},vX(t1n,"LGraphAdapters/lambda$0$Type",804),wAn(392,299,{3:1,299:1,392:1,94:1,134:1}),vX(t1n,"LShape",392),wAn(70,392,{3:1,299:1,70:1,392:1,94:1,134:1},qj,O$),MWn.Ib=function(){var n;return null==(n=YH(this))?"label":"l_"+n},vX(t1n,"LLabel",70),wAn(207,1,{3:1,4:1,207:1,414:1}),MWn.Fb=function(n){var t;return!!cL(n,207)&&(t=BB(n,207),this.d==t.d&&this.a==t.a&&this.b==t.b&&this.c==t.c)},MWn.Hb=function(){var n,t;return n=VO(this.b)<<16,n|=VO(this.a)&QVn,t=VO(this.c)<<16,n^(t|=VO(this.d)&QVn)},MWn.Jf=function(n){var t,e,i,r,c,a,u,o,s;for(r=0;r<n.length&&Dhn((b1(r,n.length),n.charCodeAt(r)),o1n);)++r;for(t=n.length;t>0&&Dhn((b1(t-1,n.length),n.charCodeAt(t-1)),s1n);)--t;if(r<t){o=kKn(n.substr(r,t-r),",|;");try{for(a=0,u=(c=o).length;a<u;++a){if(2!=(i=kKn(c[a],"=")).length)throw Hp(new _y("Expecting a list of key-value pairs."));e=RMn(i[0]),s=bSn(RMn(i[1])),mK(e,"top")?this.d=s:mK(e,"left")?this.b=s:mK(e,"bottom")?this.a=s:mK(e,"right")&&(this.c=s)}}catch(h){throw cL(h=lun(h),127)?Hp(new _y(h1n+h)):Hp(h)}}},MWn.Ib=function(){return"[top="+this.d+",left="+this.b+",bottom="+this.a+",right="+this.c+"]"},MWn.a=0,MWn.b=0,MWn.c=0,MWn.d=0,vX(f1n,"Spacing",207),wAn(142,207,l1n,lm,lA,HR,A_);var Eut=vX(f1n,"ElkMargin",142);wAn(651,142,l1n,fm),vX(t1n,"LMargin",651),wAn(10,392,{3:1,299:1,10:1,392:1,94:1,134:1},$vn),MWn.Ib=function(){return $pn(this)},MWn.i=!1;var Tut,Mut,Sut,Put,Cut,Iut,Out=vX(t1n,"LNode",10);wAn(267,22,{3:1,35:1,22:1,267:1},JS);var Aut,$ut=Ben(t1n,"LNode/NodeType",267,Unt,u9,I_);wAn(116,207,b1n,bm,WA,O_);var Lut,Nut,xut,Dut,Rut,Kut,_ut=vX(f1n,"ElkPadding",116);wAn(764,116,b1n,wm),vX(t1n,"LPadding",764),wAn(11,392,{3:1,299:1,11:1,392:1,94:1,134:1},CSn),MWn.Ib=function(){var n,t,e;return oO(((n=new Ck).a+="p_",n),pyn(this)),this.i&&oO(uO((n.a+="[",n),this.i),"]"),1==this.e.c.length&&0==this.g.c.length&&BB(xq(this.e,0),17).c!=this&&(t=BB(xq(this.e,0),17).c,oO((n.a+=" << ",n),pyn(t)),oO(uO((n.a+="[",n),t.i),"]")),0==this.e.c.length&&1==this.g.c.length&&BB(xq(this.g,0),17).d!=this&&(e=BB(xq(this.g,0),17).d,oO((n.a+=" >> ",n),pyn(e)),oO(uO((n.a+="[",n),e.i),"]")),n.a},MWn.c=!0,MWn.d=!1;var Fut,But,Hut,qut,Gut=vX(t1n,"LPort",11);wAn(397,1,pVn,Hw),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new qw(new Wb(this.a.e))},vX(t1n,"LPort/1",397),wAn(1290,1,QWn,qw),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(n0(this.a),17).c},MWn.Ob=function(){return y$(this.a)},MWn.Qb=function(){AU(this.a)},vX(t1n,"LPort/1/1",1290),wAn(359,1,pVn,Gw),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new zw(new Wb(this.a.g))},vX(t1n,"LPort/2",359),wAn(762,1,QWn,zw),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(n0(this.a),17).d},MWn.Ob=function(){return y$(this.a)},MWn.Qb=function(){AU(this.a)},vX(t1n,"LPort/2/1",762),wAn(1283,1,pVn,hP),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new m6(this)},vX(t1n,"LPort/CombineIter",1283),wAn(201,1,QWn,m6),MWn.Nb=function(n){fU(this,n)},MWn.Qb=function(){uE()},MWn.Ob=function(){return zN(this)},MWn.Pb=function(){return y$(this.a)?n0(this.a):n0(this.b)},vX(t1n,"LPort/CombineIter/1",201),wAn(1285,1,qYn,Bt),MWn.Lb=function(n){return Az(n)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),0!=BB(n,11).e.c.length},vX(t1n,"LPort/lambda$0$Type",1285),wAn(1284,1,qYn,Ht),MWn.Lb=function(n){return $z(n)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),0!=BB(n,11).g.c.length},vX(t1n,"LPort/lambda$1$Type",1284),wAn(1286,1,qYn,qt),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),sIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),sIt)},vX(t1n,"LPort/lambda$2$Type",1286),wAn(1287,1,qYn,Gt),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),oIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),oIt)},vX(t1n,"LPort/lambda$3$Type",1287),wAn(1288,1,qYn,zt),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),SIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),SIt)},vX(t1n,"LPort/lambda$4$Type",1288),wAn(1289,1,qYn,Ut),MWn.Lb=function(n){return gcn(),BB(n,11).j==(kUn(),CIt)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return gcn(),BB(n,11).j==(kUn(),CIt)},vX(t1n,"LPort/lambda$5$Type",1289),wAn(29,299,{3:1,20:1,299:1,29:1,94:1,134:1},HX),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new Wb(this.a)},MWn.Ib=function(){return"L_"+E7(this.b.b,this,0)+LMn(this.a)},vX(t1n,"Layer",29),wAn(1342,1,{},tm),vX(d1n,g1n,1342),wAn(1346,1,{},Xt),MWn.Kb=function(n){return PTn(BB(n,82))},vX(d1n,"ElkGraphImporter/0methodref$connectableShapeToNode$Type",1346),wAn(1349,1,{},Wt),MWn.Kb=function(n){return PTn(BB(n,82))},vX(d1n,"ElkGraphImporter/1methodref$connectableShapeToNode$Type",1349),wAn(1343,1,lVn,Uw),MWn.td=function(n){POn(this.a,BB(n,118))},vX(d1n,p1n,1343),wAn(1344,1,lVn,Xw),MWn.td=function(n){POn(this.a,BB(n,118))},vX(d1n,v1n,1344),wAn(1345,1,{},Vt),MWn.Kb=function(n){return new Rq(null,new w1(pV(BB(n,79)),16))},vX(d1n,m1n,1345),wAn(1347,1,DVn,Ww),MWn.Mb=function(n){return _A(this.a,BB(n,33))},vX(d1n,y1n,1347),wAn(1348,1,{},Qt),MWn.Kb=function(n){return new Rq(null,new w1(vV(BB(n,79)),16))},vX(d1n,"ElkGraphImporter/lambda$5$Type",1348),wAn(1350,1,DVn,Vw),MWn.Mb=function(n){return FA(this.a,BB(n,33))},vX(d1n,"ElkGraphImporter/lambda$7$Type",1350),wAn(1351,1,DVn,Yt),MWn.Mb=function(n){return AQ(BB(n,79))},vX(d1n,"ElkGraphImporter/lambda$8$Type",1351),wAn(1278,1,{},Qh),vX(d1n,"ElkGraphLayoutTransferrer",1278),wAn(1279,1,DVn,Qw),MWn.Mb=function(n){return JR(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$0$Type",1279),wAn(1280,1,lVn,Yw),MWn.td=function(n){mM(),WB(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$1$Type",1280),wAn(1281,1,DVn,Jw),MWn.Mb=function(n){return UD(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$2$Type",1281),wAn(1282,1,lVn,Zw),MWn.td=function(n){mM(),WB(this.a,BB(n,17))},vX(d1n,"ElkGraphLayoutTransferrer/lambda$3$Type",1282),wAn(1485,1,n1n,Jt),MWn.pf=function(n,t){Vrn(BB(n,37),t)},vX(j1n,"CommentNodeMarginCalculator",1485),wAn(1486,1,{},Zt),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"CommentNodeMarginCalculator/lambda$0$Type",1486),wAn(1487,1,lVn,ne),MWn.td=function(n){tHn(BB(n,10))},vX(j1n,"CommentNodeMarginCalculator/lambda$1$Type",1487),wAn(1488,1,n1n,te),MWn.pf=function(n,t){aDn(BB(n,37),t)},vX(j1n,"CommentPostprocessor",1488),wAn(1489,1,n1n,ee),MWn.pf=function(n,t){uUn(BB(n,37),t)},vX(j1n,"CommentPreprocessor",1489),wAn(1490,1,n1n,ie),MWn.pf=function(n,t){jLn(BB(n,37),t)},vX(j1n,"ConstraintsPostprocessor",1490),wAn(1491,1,n1n,re),MWn.pf=function(n,t){can(BB(n,37),t)},vX(j1n,"EdgeAndLayerConstraintEdgeReverser",1491),wAn(1492,1,n1n,ce),MWn.pf=function(n,t){Gwn(BB(n,37),t)},vX(j1n,"EndLabelPostprocessor",1492),wAn(1493,1,{},ae),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"EndLabelPostprocessor/lambda$0$Type",1493),wAn(1494,1,DVn,ue),MWn.Mb=function(n){return MY(BB(n,10))},vX(j1n,"EndLabelPostprocessor/lambda$1$Type",1494),wAn(1495,1,lVn,oe),MWn.td=function(n){ejn(BB(n,10))},vX(j1n,"EndLabelPostprocessor/lambda$2$Type",1495),wAn(1496,1,n1n,se),MWn.pf=function(n,t){ZPn(BB(n,37),t)},vX(j1n,"EndLabelPreprocessor",1496),wAn(1497,1,{},he),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"EndLabelPreprocessor/lambda$0$Type",1497),wAn(1498,1,lVn,D_),MWn.td=function(n){KM(this.a,this.b,this.c,BB(n,10))},MWn.a=0,MWn.b=0,MWn.c=!1,vX(j1n,"EndLabelPreprocessor/lambda$1$Type",1498),wAn(1499,1,DVn,fe),MWn.Mb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),XPt))},vX(j1n,"EndLabelPreprocessor/lambda$2$Type",1499),wAn(1500,1,lVn,nd),MWn.td=function(n){DH(this.a,BB(n,70))},vX(j1n,"EndLabelPreprocessor/lambda$3$Type",1500),wAn(1501,1,DVn,le),MWn.Mb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),UPt))},vX(j1n,"EndLabelPreprocessor/lambda$4$Type",1501),wAn(1502,1,lVn,td),MWn.td=function(n){DH(this.a,BB(n,70))},vX(j1n,"EndLabelPreprocessor/lambda$5$Type",1502),wAn(1551,1,n1n,Vh),MWn.pf=function(n,t){Cln(BB(n,37),t)},vX(j1n,"EndLabelSorter",1551),wAn(1552,1,MYn,be),MWn.ue=function(n,t){return Hgn(BB(n,456),BB(t,456))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"EndLabelSorter/1",1552),wAn(456,1,{456:1},TQ),vX(j1n,"EndLabelSorter/LabelGroup",456),wAn(1553,1,{},we),MWn.Kb=function(n){return EM(),new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"EndLabelSorter/lambda$0$Type",1553),wAn(1554,1,DVn,de),MWn.Mb=function(n){return EM(),BB(n,10).k==(uSn(),Cut)},vX(j1n,"EndLabelSorter/lambda$1$Type",1554),wAn(1555,1,lVn,ge),MWn.td=function(n){oSn(BB(n,10))},vX(j1n,"EndLabelSorter/lambda$2$Type",1555),wAn(1556,1,DVn,pe),MWn.Mb=function(n){return EM(),GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),UPt))},vX(j1n,"EndLabelSorter/lambda$3$Type",1556),wAn(1557,1,DVn,ve),MWn.Mb=function(n){return EM(),GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),XPt))},vX(j1n,"EndLabelSorter/lambda$4$Type",1557),wAn(1503,1,n1n,me),MWn.pf=function(n,t){IHn(this,BB(n,37))},MWn.b=0,MWn.c=0,vX(j1n,"FinalSplineBendpointsCalculator",1503),wAn(1504,1,{},ye),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$0$Type",1504),wAn(1505,1,{},ke),MWn.Kb=function(n){return new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$1$Type",1505),wAn(1506,1,DVn,je),MWn.Mb=function(n){return!b5(BB(n,17))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$2$Type",1506),wAn(1507,1,DVn,Ee),MWn.Mb=function(n){return Lx(BB(n,17),(hWn(),Nlt))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$3$Type",1507),wAn(1508,1,lVn,ed),MWn.td=function(n){zKn(this.a,BB(n,128))},vX(j1n,"FinalSplineBendpointsCalculator/lambda$4$Type",1508),wAn(1509,1,lVn,Te),MWn.td=function(n){JPn(BB(n,17).a)},vX(j1n,"FinalSplineBendpointsCalculator/lambda$5$Type",1509),wAn(792,1,n1n,id),MWn.pf=function(n,t){Vqn(this,BB(n,37),t)},vX(j1n,"GraphTransformer",792),wAn(511,22,{3:1,35:1,22:1,511:1},ZS);var zut,Uut,Xut,Wut=Ben(j1n,"GraphTransformer/Mode",511,Unt,uJ,tB);wAn(1510,1,n1n,Me),MWn.pf=function(n,t){exn(BB(n,37),t)},vX(j1n,"HierarchicalNodeResizingProcessor",1510),wAn(1511,1,n1n,Se),MWn.pf=function(n,t){lrn(BB(n,37),t)},vX(j1n,"HierarchicalPortConstraintProcessor",1511),wAn(1512,1,MYn,Pe),MWn.ue=function(n,t){return Ipn(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"HierarchicalPortConstraintProcessor/NodeComparator",1512),wAn(1513,1,n1n,Ce),MWn.pf=function(n,t){jBn(BB(n,37),t)},vX(j1n,"HierarchicalPortDummySizeProcessor",1513),wAn(1514,1,n1n,Ie),MWn.pf=function(n,t){JDn(this,BB(n,37),t)},MWn.a=0,vX(j1n,"HierarchicalPortOrthogonalEdgeRouter",1514),wAn(1515,1,MYn,Oe),MWn.ue=function(n,t){return _N(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"HierarchicalPortOrthogonalEdgeRouter/1",1515),wAn(1516,1,MYn,Ae),MWn.ue=function(n,t){return P9(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"HierarchicalPortOrthogonalEdgeRouter/2",1516),wAn(1517,1,n1n,$e),MWn.pf=function(n,t){EMn(BB(n,37),t)},vX(j1n,"HierarchicalPortPositionProcessor",1517),wAn(1518,1,n1n,Yh),MWn.pf=function(n,t){rXn(this,BB(n,37))},MWn.a=0,MWn.c=0,vX(j1n,"HighDegreeNodeLayeringProcessor",1518),wAn(571,1,{571:1},Le),MWn.b=-1,MWn.d=-1,vX(j1n,"HighDegreeNodeLayeringProcessor/HighDegreeNodeInformation",571),wAn(1519,1,{},Ne),MWn.Kb=function(n){return q_(),fbn(BB(n,10))},MWn.Fb=function(n){return this===n},vX(j1n,"HighDegreeNodeLayeringProcessor/lambda$0$Type",1519),wAn(1520,1,{},xe),MWn.Kb=function(n){return q_(),lbn(BB(n,10))},MWn.Fb=function(n){return this===n},vX(j1n,"HighDegreeNodeLayeringProcessor/lambda$1$Type",1520),wAn(1526,1,n1n,De),MWn.pf=function(n,t){dFn(this,BB(n,37),t)},vX(j1n,"HyperedgeDummyMerger",1526),wAn(793,1,{},R_),MWn.a=!1,MWn.b=!1,MWn.c=!1,vX(j1n,"HyperedgeDummyMerger/MergeState",793),wAn(1527,1,{},Re),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"HyperedgeDummyMerger/lambda$0$Type",1527),wAn(1528,1,{},Ke),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,10).j,16))},vX(j1n,"HyperedgeDummyMerger/lambda$1$Type",1528),wAn(1529,1,lVn,_e),MWn.td=function(n){BB(n,11).p=-1},vX(j1n,"HyperedgeDummyMerger/lambda$2$Type",1529),wAn(1530,1,n1n,Fe),MWn.pf=function(n,t){bFn(BB(n,37),t)},vX(j1n,"HypernodesProcessor",1530),wAn(1531,1,n1n,Be),MWn.pf=function(n,t){wFn(BB(n,37),t)},vX(j1n,"InLayerConstraintProcessor",1531),wAn(1532,1,n1n,He),MWn.pf=function(n,t){Lcn(BB(n,37),t)},vX(j1n,"InnermostNodeMarginCalculator",1532),wAn(1533,1,n1n,qe),MWn.pf=function(n,t){Vzn(this,BB(n,37))},MWn.a=KQn,MWn.b=KQn,MWn.c=RQn,MWn.d=RQn;var Vut,Qut,Yut,Jut,Zut,not,tot,eot,iot,rot,cot,aot,uot,oot,sot,hot,fot,lot,bot,wot,dot,got,pot,vot,mot,yot,kot,jot,Eot,Tot,Mot,Sot,Pot,Cot,Iot,Oot,Aot,$ot,Lot,Not,xot,Dot,Rot,Kot,_ot,Fot,Bot,Hot,qot,Got,zot,Uot,Xot,Wot,Vot,Qot,Yot,Jot=vX(j1n,"InteractiveExternalPortPositioner",1533);wAn(1534,1,{},Ge),MWn.Kb=function(n){return BB(n,17).d.i},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$0$Type",1534),wAn(1535,1,{},rd),MWn.Kb=function(n){return qN(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$1$Type",1535),wAn(1536,1,{},ze),MWn.Kb=function(n){return BB(n,17).c.i},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$2$Type",1536),wAn(1537,1,{},cd),MWn.Kb=function(n){return GN(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$3$Type",1537),wAn(1538,1,{},ad),MWn.Kb=function(n){return WR(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$4$Type",1538),wAn(1539,1,{},ud),MWn.Kb=function(n){return VR(this.a,MD(n))},MWn.Fb=function(n){return this===n},vX(j1n,"InteractiveExternalPortPositioner/lambda$5$Type",1539),wAn(77,22,{3:1,35:1,22:1,77:1,234:1},nP),MWn.Kf=function(){switch(this.g){case 15:return new dc;case 22:return new gc;case 47:return new mc;case 28:case 35:return new ei;case 32:return new Jt;case 42:return new te;case 1:return new ee;case 41:return new ie;case 56:return new id((Srn(),qut));case 0:return new id((Srn(),Hut));case 2:return new re;case 54:return new ce;case 33:return new se;case 51:return new me;case 55:return new Me;case 13:return new Se;case 38:return new Ce;case 44:return new Ie;case 40:return new $e;case 9:return new Yh;case 49:return new ox;case 37:return new De;case 43:return new Fe;case 27:return new Be;case 30:return new He;case 3:return new qe;case 18:return new Xe;case 29:return new We;case 5:return new Jh;case 50:return new Ue;case 34:return new Zh;case 36:return new ii;case 52:return new Vh;case 11:return new ci;case 7:return new tf;case 39:return new ai;case 45:return new ui;case 16:return new oi;case 10:return new si;case 48:return new fi;case 21:return new li;case 23:return new Ny((oin(),Amt));case 8:return new wi;case 12:return new gi;case 4:return new pi;case 19:return new af;case 17:return new Pi;case 53:return new Ci;case 6:return new Bi;case 25:return new am;case 46:return new Ni;case 31:return new xR;case 14:return new Vi;case 26:return new Sc;case 20:return new nr;case 24:return new Ny((oin(),$mt));default:throw Hp(new _y(M1n+(null!=this.f?this.f:""+this.g)))}};var Zot,nst,tst,est,ist,rst,cst,ast,ust=Ben(j1n,S1n,77,Unt,ENn,nB);wAn(1540,1,n1n,Xe),MWn.pf=function(n,t){Jzn(BB(n,37),t)},vX(j1n,"InvertedPortProcessor",1540),wAn(1541,1,n1n,We),MWn.pf=function(n,t){LKn(BB(n,37),t)},vX(j1n,"LabelAndNodeSizeProcessor",1541),wAn(1542,1,DVn,Ve),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"LabelAndNodeSizeProcessor/lambda$0$Type",1542),wAn(1543,1,DVn,Qe),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Mut)},vX(j1n,"LabelAndNodeSizeProcessor/lambda$1$Type",1543),wAn(1544,1,lVn,K_),MWn.td=function(n){_M(this.b,this.a,this.c,BB(n,10))},MWn.a=!1,MWn.c=!1,vX(j1n,"LabelAndNodeSizeProcessor/lambda$2$Type",1544),wAn(1545,1,n1n,Jh),MWn.pf=function(n,t){fzn(BB(n,37),t)},vX(j1n,"LabelDummyInserter",1545),wAn(1546,1,qYn,Ye),MWn.Lb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),zPt))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return GI(mMn(BB(n,70),(HXn(),Ydt)))===GI((Rtn(),zPt))},vX(j1n,"LabelDummyInserter/1",1546),wAn(1547,1,n1n,Ue),MWn.pf=function(n,t){Pqn(BB(n,37),t)},vX(j1n,"LabelDummyRemover",1547),wAn(1548,1,DVn,Je),MWn.Mb=function(n){return qy(TD(mMn(BB(n,70),(HXn(),Qdt))))},vX(j1n,"LabelDummyRemover/lambda$0$Type",1548),wAn(1359,1,n1n,Zh),MWn.pf=function(n,t){TGn(this,BB(n,37),t)},MWn.a=null,vX(j1n,"LabelDummySwitcher",1359),wAn(286,1,{286:1},cKn),MWn.c=0,MWn.d=null,MWn.f=0,vX(j1n,"LabelDummySwitcher/LabelDummyInfo",286),wAn(1360,1,{},Ze),MWn.Kb=function(n){return Irn(),new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"LabelDummySwitcher/lambda$0$Type",1360),wAn(1361,1,DVn,ni),MWn.Mb=function(n){return Irn(),BB(n,10).k==(uSn(),Sut)},vX(j1n,"LabelDummySwitcher/lambda$1$Type",1361),wAn(1362,1,{},hd),MWn.Kb=function(n){return XD(this.a,BB(n,10))},vX(j1n,"LabelDummySwitcher/lambda$2$Type",1362),wAn(1363,1,lVn,fd),MWn.td=function(n){YX(this.a,BB(n,286))},vX(j1n,"LabelDummySwitcher/lambda$3$Type",1363),wAn(1364,1,MYn,ti),MWn.ue=function(n,t){return Lz(BB(n,286),BB(t,286))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"LabelDummySwitcher/lambda$4$Type",1364),wAn(791,1,n1n,ei),MWn.pf=function(n,t){Y6(BB(n,37),t)},vX(j1n,"LabelManagementProcessor",791),wAn(1549,1,n1n,ii),MWn.pf=function(n,t){Nxn(BB(n,37),t)},vX(j1n,"LabelSideSelector",1549),wAn(1550,1,DVn,ri),MWn.Mb=function(n){return qy(TD(mMn(BB(n,70),(HXn(),Qdt))))},vX(j1n,"LabelSideSelector/lambda$0$Type",1550),wAn(1558,1,n1n,ci),MWn.pf=function(n,t){EBn(BB(n,37),t)},vX(j1n,"LayerConstraintPostprocessor",1558),wAn(1559,1,n1n,tf),MWn.pf=function(n,t){r$n(BB(n,37),t)},vX(j1n,"LayerConstraintPreprocessor",1559),wAn(360,22,{3:1,35:1,22:1,360:1},tP);var ost,sst,hst,fst,lst,bst,wst,dst,gst,pst=Ben(j1n,"LayerConstraintPreprocessor/HiddenNodeConnections",360,Unt,e3,z_);wAn(1560,1,n1n,ai),MWn.pf=function(n,t){Eqn(BB(n,37),t)},vX(j1n,"LayerSizeAndGraphHeightCalculator",1560),wAn(1561,1,n1n,ui),MWn.pf=function(n,t){ALn(BB(n,37),t)},vX(j1n,"LongEdgeJoiner",1561),wAn(1562,1,n1n,oi),MWn.pf=function(n,t){WHn(BB(n,37),t)},vX(j1n,"LongEdgeSplitter",1562),wAn(1563,1,n1n,si),MWn.pf=function(n,t){PGn(this,BB(n,37),t)},MWn.d=0,MWn.e=0,MWn.i=0,MWn.j=0,MWn.k=0,MWn.n=0,vX(j1n,"NodePromotion",1563),wAn(1564,1,{},hi),MWn.Kb=function(n){return BB(n,46),hN(),!0},MWn.Fb=function(n){return this===n},vX(j1n,"NodePromotion/lambda$0$Type",1564),wAn(1565,1,{},od),MWn.Kb=function(n){return aV(this.a,BB(n,46))},MWn.Fb=function(n){return this===n},MWn.a=0,vX(j1n,"NodePromotion/lambda$1$Type",1565),wAn(1566,1,{},sd),MWn.Kb=function(n){return uV(this.a,BB(n,46))},MWn.Fb=function(n){return this===n},MWn.a=0,vX(j1n,"NodePromotion/lambda$2$Type",1566),wAn(1567,1,n1n,fi),MWn.pf=function(n,t){XUn(BB(n,37),t)},vX(j1n,"NorthSouthPortPostprocessor",1567),wAn(1568,1,n1n,li),MWn.pf=function(n,t){MUn(BB(n,37),t)},vX(j1n,"NorthSouthPortPreprocessor",1568),wAn(1569,1,MYn,bi),MWn.ue=function(n,t){return Zan(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"NorthSouthPortPreprocessor/lambda$0$Type",1569),wAn(1570,1,n1n,wi),MWn.pf=function(n,t){$_n(BB(n,37),t)},vX(j1n,"PartitionMidprocessor",1570),wAn(1571,1,DVn,di),MWn.Mb=function(n){return Lx(BB(n,10),(HXn(),Wgt))},vX(j1n,"PartitionMidprocessor/lambda$0$Type",1571),wAn(1572,1,lVn,ld),MWn.td=function(n){$Q(this.a,BB(n,10))},vX(j1n,"PartitionMidprocessor/lambda$1$Type",1572),wAn(1573,1,n1n,gi),MWn.pf=function(n,t){wNn(BB(n,37),t)},vX(j1n,"PartitionPostprocessor",1573),wAn(1574,1,n1n,pi),MWn.pf=function(n,t){NOn(BB(n,37),t)},vX(j1n,"PartitionPreprocessor",1574),wAn(1575,1,DVn,vi),MWn.Mb=function(n){return Lx(BB(n,10),(HXn(),Wgt))},vX(j1n,"PartitionPreprocessor/lambda$0$Type",1575),wAn(1576,1,{},mi),MWn.Kb=function(n){return new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(j1n,"PartitionPreprocessor/lambda$1$Type",1576),wAn(1577,1,DVn,yi),MWn.Mb=function(n){return Lgn(BB(n,17))},vX(j1n,"PartitionPreprocessor/lambda$2$Type",1577),wAn(1578,1,lVn,ki),MWn.td=function(n){Run(BB(n,17))},vX(j1n,"PartitionPreprocessor/lambda$3$Type",1578),wAn(1579,1,n1n,af),MWn.pf=function(n,t){u_n(BB(n,37),t)},vX(j1n,"PortListSorter",1579),wAn(1580,1,{},ji),MWn.Kb=function(n){return zsn(),BB(n,11).e},vX(j1n,"PortListSorter/lambda$0$Type",1580),wAn(1581,1,{},Ei),MWn.Kb=function(n){return zsn(),BB(n,11).g},vX(j1n,"PortListSorter/lambda$1$Type",1581),wAn(1582,1,MYn,Ti),MWn.ue=function(n,t){return T4(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"PortListSorter/lambda$2$Type",1582),wAn(1583,1,MYn,Mi),MWn.ue=function(n,t){return Oyn(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"PortListSorter/lambda$3$Type",1583),wAn(1584,1,MYn,Si),MWn.ue=function(n,t){return nFn(BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"PortListSorter/lambda$4$Type",1584),wAn(1585,1,n1n,Pi),MWn.pf=function(n,t){WAn(BB(n,37),t)},vX(j1n,"PortSideProcessor",1585),wAn(1586,1,n1n,Ci),MWn.pf=function(n,t){IRn(BB(n,37),t)},vX(j1n,"ReversedEdgeRestorer",1586),wAn(1591,1,n1n,am),MWn.pf=function(n,t){Ymn(this,BB(n,37),t)},vX(j1n,"SelfLoopPortRestorer",1591),wAn(1592,1,{},Ii),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"SelfLoopPortRestorer/lambda$0$Type",1592),wAn(1593,1,DVn,Oi),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SelfLoopPortRestorer/lambda$1$Type",1593),wAn(1594,1,DVn,Ai),MWn.Mb=function(n){return Lx(BB(n,10),(hWn(),Olt))},vX(j1n,"SelfLoopPortRestorer/lambda$2$Type",1594),wAn(1595,1,{},$i),MWn.Kb=function(n){return BB(mMn(BB(n,10),(hWn(),Olt)),403)},vX(j1n,"SelfLoopPortRestorer/lambda$3$Type",1595),wAn(1596,1,lVn,bd),MWn.td=function(n){SSn(this.a,BB(n,403))},vX(j1n,"SelfLoopPortRestorer/lambda$4$Type",1596),wAn(794,1,lVn,Li),MWn.td=function(n){nPn(BB(n,101))},vX(j1n,"SelfLoopPortRestorer/lambda$5$Type",794),wAn(1597,1,n1n,Ni),MWn.pf=function(n,t){Lpn(BB(n,37),t)},vX(j1n,"SelfLoopPostProcessor",1597),wAn(1598,1,{},xi),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"SelfLoopPostProcessor/lambda$0$Type",1598),wAn(1599,1,DVn,Di),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SelfLoopPostProcessor/lambda$1$Type",1599),wAn(1600,1,DVn,Ri),MWn.Mb=function(n){return Lx(BB(n,10),(hWn(),Olt))},vX(j1n,"SelfLoopPostProcessor/lambda$2$Type",1600),wAn(1601,1,lVn,Ki),MWn.td=function(n){Ljn(BB(n,10))},vX(j1n,"SelfLoopPostProcessor/lambda$3$Type",1601),wAn(1602,1,{},_i),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,101).f,1))},vX(j1n,"SelfLoopPostProcessor/lambda$4$Type",1602),wAn(1603,1,lVn,wd),MWn.td=function(n){a3(this.a,BB(n,409))},vX(j1n,"SelfLoopPostProcessor/lambda$5$Type",1603),wAn(1604,1,DVn,Fi),MWn.Mb=function(n){return!!BB(n,101).i},vX(j1n,"SelfLoopPostProcessor/lambda$6$Type",1604),wAn(1605,1,lVn,dd),MWn.td=function(n){Ty(this.a,BB(n,101))},vX(j1n,"SelfLoopPostProcessor/lambda$7$Type",1605),wAn(1587,1,n1n,Bi),MWn.pf=function(n,t){Z$n(BB(n,37),t)},vX(j1n,"SelfLoopPreProcessor",1587),wAn(1588,1,{},Hi),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,101).f,1))},vX(j1n,"SelfLoopPreProcessor/lambda$0$Type",1588),wAn(1589,1,{},qi),MWn.Kb=function(n){return BB(n,409).a},vX(j1n,"SelfLoopPreProcessor/lambda$1$Type",1589),wAn(1590,1,lVn,Gi),MWn.td=function(n){q$(BB(n,17))},vX(j1n,"SelfLoopPreProcessor/lambda$2$Type",1590),wAn(1606,1,n1n,xR),MWn.pf=function(n,t){sSn(this,BB(n,37),t)},vX(j1n,"SelfLoopRouter",1606),wAn(1607,1,{},zi),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,29).a,16))},vX(j1n,"SelfLoopRouter/lambda$0$Type",1607),wAn(1608,1,DVn,Ui),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SelfLoopRouter/lambda$1$Type",1608),wAn(1609,1,DVn,Xi),MWn.Mb=function(n){return Lx(BB(n,10),(hWn(),Olt))},vX(j1n,"SelfLoopRouter/lambda$2$Type",1609),wAn(1610,1,{},Wi),MWn.Kb=function(n){return BB(mMn(BB(n,10),(hWn(),Olt)),403)},vX(j1n,"SelfLoopRouter/lambda$3$Type",1610),wAn(1611,1,lVn,eP),MWn.td=function(n){QV(this.a,this.b,BB(n,403))},vX(j1n,"SelfLoopRouter/lambda$4$Type",1611),wAn(1612,1,n1n,Vi),MWn.pf=function(n,t){fxn(BB(n,37),t)},vX(j1n,"SemiInteractiveCrossMinProcessor",1612),wAn(1613,1,DVn,Qi),MWn.Mb=function(n){return BB(n,10).k==(uSn(),Cut)},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$0$Type",1613),wAn(1614,1,DVn,Yi),MWn.Mb=function(n){return Gq(BB(n,10))._b((HXn(),spt))},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$1$Type",1614),wAn(1615,1,MYn,Ji),MWn.ue=function(n,t){return drn(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$2$Type",1615),wAn(1616,1,{},Zi),MWn.Ce=function(n,t){return XQ(BB(n,10),BB(t,10))},vX(j1n,"SemiInteractiveCrossMinProcessor/lambda$3$Type",1616),wAn(1618,1,n1n,nr),MWn.pf=function(n,t){MBn(BB(n,37),t)},vX(j1n,"SortByInputModelProcessor",1618),wAn(1619,1,DVn,tr),MWn.Mb=function(n){return 0!=BB(n,11).g.c.length},vX(j1n,"SortByInputModelProcessor/lambda$0$Type",1619),wAn(1620,1,lVn,gd),MWn.td=function(n){fPn(this.a,BB(n,11))},vX(j1n,"SortByInputModelProcessor/lambda$1$Type",1620),wAn(1693,803,{},grn),MWn.Me=function(n){var t,e,i,r;switch(this.c=n,this.a.g){case 2:t=new Np,JT(AV(new Rq(null,new w1(this.c.a.b,16)),new dr),new uP(this,t)),pCn(this,new rr),Otn(t,new cr),t.c=x8(Ant,HWn,1,0,5,1),JT(AV(new Rq(null,new w1(this.c.a.b,16)),new ar),new vd(t)),pCn(this,new ur),Otn(t,new or),t.c=x8(Ant,HWn,1,0,5,1),e=j$(icn(LV(new Rq(null,new w1(this.c.a.b,16)),new md(this))),new sr),JT(new Rq(null,new w1(this.c.a.a,16)),new rP(e,t)),pCn(this,new fr),Otn(t,new er),t.c=x8(Ant,HWn,1,0,5,1);break;case 3:i=new Np,pCn(this,new ir),r=j$(icn(LV(new Rq(null,new w1(this.c.a.b,16)),new pd(this))),new hr),JT(AV(new Rq(null,new w1(this.c.a.b,16)),new lr),new aP(r,i)),pCn(this,new br),Otn(i,new wr),i.c=x8(Ant,HWn,1,0,5,1);break;default:throw Hp(new kv)}},MWn.b=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation",1693),wAn(1694,1,qYn,ir),MWn.Lb=function(n){return cL(BB(n,57).g,145)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return cL(BB(n,57).g,145)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$0$Type",1694),wAn(1695,1,{},pd),MWn.Fe=function(n){return GCn(this.a,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$1$Type",1695),wAn(1703,1,RVn,iP),MWn.Vd=function(){Fkn(this.a,this.b,-1)},MWn.b=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$10$Type",1703),wAn(1705,1,qYn,rr),MWn.Lb=function(n){return cL(BB(n,57).g,145)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return cL(BB(n,57).g,145)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$11$Type",1705),wAn(1706,1,lVn,cr),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$12$Type",1706),wAn(1707,1,DVn,ar),MWn.Mb=function(n){return cL(BB(n,57).g,10)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$13$Type",1707),wAn(1709,1,lVn,vd),MWn.td=function(n){Ebn(this.a,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$14$Type",1709),wAn(1708,1,RVn,lP),MWn.Vd=function(){Fkn(this.b,this.a,-1)},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$15$Type",1708),wAn(1710,1,qYn,ur),MWn.Lb=function(n){return cL(BB(n,57).g,10)},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return cL(BB(n,57).g,10)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$16$Type",1710),wAn(1711,1,lVn,or),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$17$Type",1711),wAn(1712,1,{},md),MWn.Fe=function(n){return zCn(this.a,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$18$Type",1712),wAn(1713,1,{},sr),MWn.De=function(){return 0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$19$Type",1713),wAn(1696,1,{},hr),MWn.De=function(){return 0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$2$Type",1696),wAn(1715,1,lVn,rP),MWn.td=function(n){HG(this.a,this.b,BB(n,307))},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$20$Type",1715),wAn(1714,1,RVn,cP),MWn.Vd=function(){VAn(this.a,this.b,-1)},MWn.b=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$21$Type",1714),wAn(1716,1,qYn,fr),MWn.Lb=function(n){return BB(n,57),!0},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return BB(n,57),!0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$22$Type",1716),wAn(1717,1,lVn,er),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$23$Type",1717),wAn(1697,1,DVn,lr),MWn.Mb=function(n){return cL(BB(n,57).g,10)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$3$Type",1697),wAn(1699,1,lVn,aP),MWn.td=function(n){qG(this.a,this.b,BB(n,57))},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$4$Type",1699),wAn(1698,1,RVn,bP),MWn.Vd=function(){Fkn(this.b,this.a,-1)},MWn.a=0,vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$5$Type",1698),wAn(1700,1,qYn,br),MWn.Lb=function(n){return BB(n,57),!0},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return BB(n,57),!0},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$6$Type",1700),wAn(1701,1,lVn,wr),MWn.td=function(n){BB(n,365).Vd()},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$7$Type",1701),wAn(1702,1,DVn,dr),MWn.Mb=function(n){return cL(BB(n,57).g,145)},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$8$Type",1702),wAn(1704,1,lVn,uP),MWn.td=function(n){Ttn(this.a,this.b,BB(n,57))},vX(A1n,"EdgeAwareScanlineConstraintCalculation/lambda$9$Type",1704),wAn(1521,1,n1n,ox),MWn.pf=function(n,t){cqn(this,BB(n,37),t)},vX(A1n,"HorizontalGraphCompactor",1521),wAn(1522,1,{},yd),MWn.Oe=function(n,t){var e,i;return Z7(n,t)?0:(e=f2(n),i=f2(t),e&&e.k==(uSn(),Mut)||i&&i.k==(uSn(),Mut)?0:UN(BB(mMn(this.a.a,(hWn(),Alt)),304),e?e.k:(uSn(),Put),i?i.k:(uSn(),Put)))},MWn.Pe=function(n,t){var e,i;return Z7(n,t)?1:(e=f2(n),i=f2(t),XN(BB(mMn(this.a.a,(hWn(),Alt)),304),e?e.k:(uSn(),Put),i?i.k:(uSn(),Put)))},vX(A1n,"HorizontalGraphCompactor/1",1522),wAn(1523,1,{},gr),MWn.Ne=function(n,t){return MM(),0==n.a.i},vX(A1n,"HorizontalGraphCompactor/lambda$0$Type",1523),wAn(1524,1,{},kd),MWn.Ne=function(n,t){return _Q(this.a,n,t)},vX(A1n,"HorizontalGraphCompactor/lambda$1$Type",1524),wAn(1664,1,{},I7),vX(A1n,"LGraphToCGraphTransformer",1664),wAn(1672,1,DVn,pr),MWn.Mb=function(n){return null!=n},vX(A1n,"LGraphToCGraphTransformer/0methodref$nonNull$Type",1672),wAn(1665,1,{},vr),MWn.Kb=function(n){return G_(),Bbn(mMn(BB(BB(n,57).g,10),(hWn(),dlt)))},vX(A1n,"LGraphToCGraphTransformer/lambda$0$Type",1665),wAn(1666,1,{},mr),MWn.Kb=function(n){return G_(),mfn(BB(BB(n,57).g,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$1$Type",1666),wAn(1675,1,DVn,yr),MWn.Mb=function(n){return G_(),cL(BB(n,57).g,10)},vX(A1n,"LGraphToCGraphTransformer/lambda$10$Type",1675),wAn(1676,1,lVn,kr),MWn.td=function(n){KQ(BB(n,57))},vX(A1n,"LGraphToCGraphTransformer/lambda$11$Type",1676),wAn(1677,1,DVn,jr),MWn.Mb=function(n){return G_(),cL(BB(n,57).g,145)},vX(A1n,"LGraphToCGraphTransformer/lambda$12$Type",1677),wAn(1681,1,lVn,Er),MWn.td=function(n){vfn(BB(n,57))},vX(A1n,"LGraphToCGraphTransformer/lambda$13$Type",1681),wAn(1678,1,lVn,jd),MWn.td=function(n){uA(this.a,BB(n,8))},MWn.a=0,vX(A1n,"LGraphToCGraphTransformer/lambda$14$Type",1678),wAn(1679,1,lVn,Ed),MWn.td=function(n){sA(this.a,BB(n,110))},MWn.a=0,vX(A1n,"LGraphToCGraphTransformer/lambda$15$Type",1679),wAn(1680,1,lVn,Td),MWn.td=function(n){oA(this.a,BB(n,8))},MWn.a=0,vX(A1n,"LGraphToCGraphTransformer/lambda$16$Type",1680),wAn(1682,1,{},Tr),MWn.Kb=function(n){return G_(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(A1n,"LGraphToCGraphTransformer/lambda$17$Type",1682),wAn(1683,1,DVn,Mr),MWn.Mb=function(n){return G_(),b5(BB(n,17))},vX(A1n,"LGraphToCGraphTransformer/lambda$18$Type",1683),wAn(1684,1,lVn,Md),MWn.td=function(n){Snn(this.a,BB(n,17))},vX(A1n,"LGraphToCGraphTransformer/lambda$19$Type",1684),wAn(1668,1,lVn,Sd),MWn.td=function(n){l0(this.a,BB(n,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$2$Type",1668),wAn(1685,1,{},Sr),MWn.Kb=function(n){return G_(),new Rq(null,new w1(BB(n,29).a,16))},vX(A1n,"LGraphToCGraphTransformer/lambda$20$Type",1685),wAn(1686,1,{},Pr),MWn.Kb=function(n){return G_(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(A1n,"LGraphToCGraphTransformer/lambda$21$Type",1686),wAn(1687,1,{},Cr),MWn.Kb=function(n){return G_(),BB(mMn(BB(n,17),(hWn(),Nlt)),15)},vX(A1n,"LGraphToCGraphTransformer/lambda$22$Type",1687),wAn(1688,1,DVn,Ir),MWn.Mb=function(n){return tx(BB(n,15))},vX(A1n,"LGraphToCGraphTransformer/lambda$23$Type",1688),wAn(1689,1,lVn,Pd),MWn.td=function(n){PCn(this.a,BB(n,15))},vX(A1n,"LGraphToCGraphTransformer/lambda$24$Type",1689),wAn(1667,1,lVn,oP),MWn.td=function(n){H3(this.a,this.b,BB(n,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$3$Type",1667),wAn(1669,1,{},Or),MWn.Kb=function(n){return G_(),new Rq(null,new w1(BB(n,29).a,16))},vX(A1n,"LGraphToCGraphTransformer/lambda$4$Type",1669),wAn(1670,1,{},Ar),MWn.Kb=function(n){return G_(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(A1n,"LGraphToCGraphTransformer/lambda$5$Type",1670),wAn(1671,1,{},$r),MWn.Kb=function(n){return G_(),BB(mMn(BB(n,17),(hWn(),Nlt)),15)},vX(A1n,"LGraphToCGraphTransformer/lambda$6$Type",1671),wAn(1673,1,lVn,Cd),MWn.td=function(n){KIn(this.a,BB(n,15))},vX(A1n,"LGraphToCGraphTransformer/lambda$8$Type",1673),wAn(1674,1,lVn,sP),MWn.td=function(n){x$(this.a,this.b,BB(n,145))},vX(A1n,"LGraphToCGraphTransformer/lambda$9$Type",1674),wAn(1663,1,{},Lr),MWn.Le=function(n){var t,e,i,r,c;for(this.a=n,this.d=new Fv,this.c=x8(qit,HWn,121,this.a.a.a.c.length,0,1),this.b=0,e=new Wb(this.a.a.a);e.a<e.c.c.length;)(t=BB(n0(e),307)).d=this.b,c=AN(oM(new qv,t),this.d),this.c[this.b]=c,++this.b;for(JGn(this),AUn(this),ZLn(this),WKn(B_(this.d),new Xm),r=new Wb(this.a.a.b);r.a<r.c.c.length;)(i=BB(n0(r),57)).d.c=this.c[i.a.d].e+i.b.a},MWn.b=0,vX(A1n,"NetworkSimplexCompaction",1663),wAn(145,1,{35:1,145:1},PBn),MWn.wd=function(n){return Lnn(this,BB(n,145))},MWn.Ib=function(){return mfn(this)},vX(A1n,"VerticalSegment",145),wAn(827,1,{},zEn),MWn.c=0,MWn.e=0,MWn.i=0,vX($1n,"BetweenLayerEdgeTwoNodeCrossingsCounter",827),wAn(663,1,{663:1},kcn),MWn.Ib=function(){return"AdjacencyList [node="+this.d+", adjacencies= "+this.a+"]"},MWn.b=0,MWn.c=0,MWn.f=0,vX($1n,"BetweenLayerEdgeTwoNodeCrossingsCounter/AdjacencyList",663),wAn(287,1,{35:1,287:1},Gx),MWn.wd=function(n){return aq(this,BB(n,287))},MWn.Ib=function(){return"Adjacency [position="+this.c+", cardinality="+this.a+", currentCardinality="+this.b+"]"},MWn.a=0,MWn.b=0,MWn.c=0,vX($1n,"BetweenLayerEdgeTwoNodeCrossingsCounter/AdjacencyList/Adjacency",287),wAn(1929,1,{},ZSn),MWn.b=0,MWn.e=!1,vX($1n,"CrossingMatrixFiller",1929);var vst,mst,yst,kst,jst=bq(L1n,"IInitializable");wAn(1804,1,N1n,vP),MWn.Nf=function(n,t,e,i,r,c){},MWn.Pf=function(n,t,e){},MWn.Lf=function(){return this.c!=(oin(),Amt)},MWn.Mf=function(){this.e=x8(ANt,hQn,25,this.d,15,1)},MWn.Of=function(n,t){t[n][0].c.p=n},MWn.Qf=function(n,t,e,i){++this.d},MWn.Rf=function(){return!0},MWn.Sf=function(n,t,e,i){return Yhn(this,n,t,e),Z4(this,t)},MWn.Tf=function(n,t){var e;return Yhn(this,n,e=hj(t,n.length),t),bon(this,e)},MWn.d=0,vX($1n,"GreedySwitchHeuristic",1804),wAn(1930,1,{},lG),MWn.b=0,MWn.d=0,vX($1n,"NorthSouthEdgeNeighbouringNodeCrossingsCounter",1930),wAn(1917,1,{},uRn),MWn.a=!1,vX($1n,"SwitchDecider",1917),wAn(101,1,{101:1},pPn),MWn.a=null,MWn.c=null,MWn.i=null,vX(x1n,"SelfHyperLoop",101),wAn(1916,1,{},epn),MWn.c=0,MWn.e=0,vX(x1n,"SelfHyperLoopLabels",1916),wAn(411,22,{3:1,35:1,22:1,411:1},mP);var Est,Tst,Mst,Sst,Pst,Cst,Ist=Ben(x1n,"SelfHyperLoopLabels/Alignment",411,Unt,r3,U_);wAn(409,1,{409:1},j6),vX(x1n,"SelfLoopEdge",409),wAn(403,1,{403:1},Ogn),MWn.a=!1,vX(x1n,"SelfLoopHolder",403),wAn(1724,1,DVn,qr),MWn.Mb=function(n){return b5(BB(n,17))},vX(x1n,"SelfLoopHolder/lambda$0$Type",1724),wAn(113,1,{113:1},ipn),MWn.a=!1,MWn.c=!1,vX(x1n,"SelfLoopPort",113),wAn(1792,1,DVn,Gr),MWn.Mb=function(n){return b5(BB(n,17))},vX(x1n,"SelfLoopPort/lambda$0$Type",1792),wAn(363,22,{3:1,35:1,22:1,363:1},yP);var Ost,Ast,$st,Lst,Nst,xst,Dst,Rst,Kst=Ben(x1n,"SelfLoopType",363,Unt,x5,Y_);wAn(1732,1,{},uf),vX(D1n,"PortRestorer",1732),wAn(361,22,{3:1,35:1,22:1,361:1},kP);var _st,Fst,Bst,Hst,qst,Gst,zst,Ust,Xst,Wst=Ben(D1n,"PortRestorer/PortSideArea",361,Unt,P1,J_);wAn(1733,1,{},Wr),MWn.Kb=function(n){return _Mn(),BB(n,15).Oc()},vX(D1n,"PortRestorer/lambda$0$Type",1733),wAn(1734,1,lVn,Vr),MWn.td=function(n){_Mn(),BB(n,113).c=!1},vX(D1n,"PortRestorer/lambda$1$Type",1734),wAn(1743,1,DVn,Qr),MWn.Mb=function(n){return _Mn(),BB(n,11).j==(kUn(),CIt)},vX(D1n,"PortRestorer/lambda$10$Type",1743),wAn(1744,1,{},Yr),MWn.Kb=function(n){return _Mn(),BB(n,113).d},vX(D1n,"PortRestorer/lambda$11$Type",1744),wAn(1745,1,lVn,Id),MWn.td=function(n){Nj(this.a,BB(n,11))},vX(D1n,"PortRestorer/lambda$12$Type",1745),wAn(1735,1,lVn,Od),MWn.td=function(n){Ax(this.a,BB(n,101))},vX(D1n,"PortRestorer/lambda$2$Type",1735),wAn(1736,1,MYn,Jr),MWn.ue=function(n,t){return oen(BB(n,113),BB(t,113))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(D1n,"PortRestorer/lambda$3$Type",1736),wAn(1737,1,DVn,Zr),MWn.Mb=function(n){return _Mn(),BB(n,113).c},vX(D1n,"PortRestorer/lambda$4$Type",1737),wAn(1738,1,DVn,xr),MWn.Mb=function(n){return Acn(BB(n,11))},vX(D1n,"PortRestorer/lambda$5$Type",1738),wAn(1739,1,DVn,Nr),MWn.Mb=function(n){return _Mn(),BB(n,11).j==(kUn(),sIt)},vX(D1n,"PortRestorer/lambda$6$Type",1739),wAn(1740,1,DVn,Dr),MWn.Mb=function(n){return _Mn(),BB(n,11).j==(kUn(),oIt)},vX(D1n,"PortRestorer/lambda$7$Type",1740),wAn(1741,1,DVn,Rr),MWn.Mb=function(n){return c3(BB(n,11))},vX(D1n,"PortRestorer/lambda$8$Type",1741),wAn(1742,1,DVn,Kr),MWn.Mb=function(n){return _Mn(),BB(n,11).j==(kUn(),SIt)},vX(D1n,"PortRestorer/lambda$9$Type",1742),wAn(270,22,{3:1,35:1,22:1,270:1},WV);var Vst,Qst,Yst,Jst,Zst,nht,tht,eht,iht=Ben(D1n,"PortSideAssigner/Target",270,Unt,Ftn,X_);wAn(1725,1,{},_r),MWn.Kb=function(n){return AV(new Rq(null,new w1(BB(n,101).j,16)),new Xr)},vX(D1n,"PortSideAssigner/lambda$1$Type",1725),wAn(1726,1,{},Fr),MWn.Kb=function(n){return BB(n,113).d},vX(D1n,"PortSideAssigner/lambda$2$Type",1726),wAn(1727,1,lVn,Br),MWn.td=function(n){qCn(BB(n,11),(kUn(),sIt))},vX(D1n,"PortSideAssigner/lambda$3$Type",1727),wAn(1728,1,{},Hr),MWn.Kb=function(n){return BB(n,113).d},vX(D1n,"PortSideAssigner/lambda$4$Type",1728),wAn(1729,1,lVn,Ad),MWn.td=function(n){tv(this.a,BB(n,11))},vX(D1n,"PortSideAssigner/lambda$5$Type",1729),wAn(1730,1,MYn,zr),MWn.ue=function(n,t){return MW(BB(n,101),BB(t,101))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(D1n,"PortSideAssigner/lambda$6$Type",1730),wAn(1731,1,MYn,Ur),MWn.ue=function(n,t){return oH(BB(n,113),BB(t,113))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(D1n,"PortSideAssigner/lambda$7$Type",1731),wAn(805,1,DVn,Xr),MWn.Mb=function(n){return BB(n,113).c},vX(D1n,"PortSideAssigner/lambda$8$Type",805),wAn(2009,1,{}),vX(R1n,"AbstractSelfLoopRouter",2009),wAn(1750,1,MYn,nc),MWn.ue=function(n,t){return IK(BB(n,101),BB(t,101))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(R1n,bJn,1750),wAn(1751,1,MYn,tc),MWn.ue=function(n,t){return CK(BB(n,101),BB(t,101))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(R1n,wJn,1751),wAn(1793,2009,{},ec),MWn.Uf=function(n,t,e){return e},vX(R1n,"OrthogonalSelfLoopRouter",1793),wAn(1795,1,lVn,wP),MWn.td=function(n){pgn(this.b,this.a,BB(n,8))},vX(R1n,"OrthogonalSelfLoopRouter/lambda$0$Type",1795),wAn(1794,1793,{},ic),MWn.Uf=function(n,t,e){var i,r;return Kx(e,0,UR(B$((i=n.c.d).n),i.a)),DH(e,UR(B$((r=n.d.d).n),r.a)),E_n(e)},vX(R1n,"PolylineSelfLoopRouter",1794),wAn(1746,1,{},nf),MWn.a=null,vX(R1n,"RoutingDirector",1746),wAn(1747,1,MYn,rc),MWn.ue=function(n,t){return wH(BB(n,113),BB(t,113))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(R1n,"RoutingDirector/lambda$0$Type",1747),wAn(1748,1,{},cc),MWn.Kb=function(n){return SM(),BB(n,101).j},vX(R1n,"RoutingDirector/lambda$1$Type",1748),wAn(1749,1,lVn,ac),MWn.td=function(n){SM(),BB(n,15).ad(Qst)},vX(R1n,"RoutingDirector/lambda$2$Type",1749),wAn(1752,1,{},uc),vX(R1n,"RoutingSlotAssigner",1752),wAn(1753,1,DVn,$d),MWn.Mb=function(n){return CC(this.a,BB(n,101))},vX(R1n,"RoutingSlotAssigner/lambda$0$Type",1753),wAn(1754,1,MYn,Ld),MWn.ue=function(n,t){return Uq(this.a,BB(n,101),BB(t,101))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(R1n,"RoutingSlotAssigner/lambda$1$Type",1754),wAn(1796,1793,{},oc),MWn.Uf=function(n,t,e){var i,r,c,a;return i=Gy(MD(gpn(n.b.g.b,(HXn(),jpt)))),nLn(n,t,e,a=new Ux(Pun(Gk(PMt,1),sVn,8,0,[(c=n.c.d,UR(new wA(c.n),c.a))])),i),DH(a,UR(new wA((r=n.d.d).n),r.a)),Fvn(new oBn(a))},vX(R1n,"SplineSelfLoopRouter",1796),wAn(578,1,MYn,Grn,kH),MWn.ue=function(n,t){return fXn(this,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(K1n,"ModelOrderNodeComparator",578),wAn(1755,1,DVn,sc),MWn.Mb=function(n){return 0!=BB(n,11).e.c.length},vX(K1n,"ModelOrderNodeComparator/lambda$0$Type",1755),wAn(1756,1,{},hc),MWn.Kb=function(n){return BB(xq(BB(n,11).e,0),17).c},vX(K1n,"ModelOrderNodeComparator/lambda$1$Type",1756),wAn(1757,1,DVn,fc),MWn.Mb=function(n){return 0!=BB(n,11).e.c.length},vX(K1n,"ModelOrderNodeComparator/lambda$2$Type",1757),wAn(1758,1,{},lc),MWn.Kb=function(n){return BB(xq(BB(n,11).e,0),17).c},vX(K1n,"ModelOrderNodeComparator/lambda$3$Type",1758),wAn(1759,1,DVn,bc),MWn.Mb=function(n){return 0!=BB(n,11).e.c.length},vX(K1n,"ModelOrderNodeComparator/lambda$4$Type",1759),wAn(806,1,MYn,O7,pP),MWn.ue=function(n,t){return Nz(this,n,t)},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(K1n,"ModelOrderPortComparator",806),wAn(801,1,{},wc),MWn.Vf=function(n,t){var i,r,c,a;for(c=PSn(t),i=new Np,a=t.f/c,r=1;r<c;++r)WB(i,iln(dG(fan(e.Math.round(r*a)))));return i},MWn.Wf=function(){return!1},vX(_1n,"ARDCutIndexHeuristic",801),wAn(1479,1,n1n,dc),MWn.pf=function(n,t){oKn(BB(n,37),t)},vX(_1n,"BreakingPointInserter",1479),wAn(305,1,{305:1},v3),MWn.Ib=function(){var n;return(n=new Ck).a+="BPInfo[",n.a+="\n\tstart=",uO(n,this.i),n.a+="\n\tend=",uO(n,this.a),n.a+="\n\tnodeStartEdge=",uO(n,this.e),n.a+="\n\tstartEndEdge=",uO(n,this.j),n.a+="\n\toriginalEdge=",uO(n,this.f),n.a+="\n\tstartInLayerDummy=",uO(n,this.k),n.a+="\n\tstartInLayerEdge=",uO(n,this.n),n.a+="\n\tendInLayerDummy=",uO(n,this.b),n.a+="\n\tendInLayerEdge=",uO(n,this.c),n.a},vX(_1n,"BreakingPointInserter/BPInfo",305),wAn(652,1,{652:1},Hd),MWn.a=!1,MWn.b=0,MWn.c=0,vX(_1n,"BreakingPointInserter/Cut",652),wAn(1480,1,n1n,gc),MWn.pf=function(n,t){mLn(BB(n,37),t)},vX(_1n,"BreakingPointProcessor",1480),wAn(1481,1,DVn,pc),MWn.Mb=function(n){return Jnn(BB(n,10))},vX(_1n,"BreakingPointProcessor/0methodref$isEnd$Type",1481),wAn(1482,1,DVn,vc),MWn.Mb=function(n){return Znn(BB(n,10))},vX(_1n,"BreakingPointProcessor/1methodref$isStart$Type",1482),wAn(1483,1,n1n,mc),MWn.pf=function(n,t){rNn(this,BB(n,37),t)},vX(_1n,"BreakingPointRemover",1483),wAn(1484,1,lVn,yc),MWn.td=function(n){BB(n,128).k=!0},vX(_1n,"BreakingPointRemover/lambda$0$Type",1484),wAn(797,1,{},MAn),MWn.b=0,MWn.e=0,MWn.f=0,MWn.j=0,vX(_1n,"GraphStats",797),wAn(798,1,{},kc),MWn.Ce=function(n,t){return e.Math.max(Gy(MD(n)),Gy(MD(t)))},vX(_1n,"GraphStats/0methodref$max$Type",798),wAn(799,1,{},jc),MWn.Ce=function(n,t){return e.Math.max(Gy(MD(n)),Gy(MD(t)))},vX(_1n,"GraphStats/2methodref$max$Type",799),wAn(1660,1,{},Ec),MWn.Ce=function(n,t){return vB(MD(n),MD(t))},vX(_1n,"GraphStats/lambda$1$Type",1660),wAn(1661,1,{},Nd),MWn.Kb=function(n){return wpn(this.a,BB(n,29))},vX(_1n,"GraphStats/lambda$2$Type",1661),wAn(1662,1,{},xd),MWn.Kb=function(n){return VLn(this.a,BB(n,29))},vX(_1n,"GraphStats/lambda$6$Type",1662),wAn(800,1,{},Tc),MWn.Vf=function(n,t){return BB(mMn(n,(HXn(),_pt)),15)||(SQ(),SQ(),set)},MWn.Wf=function(){return!1},vX(_1n,"ICutIndexCalculator/ManualCutIndexCalculator",800),wAn(802,1,{},Mc),MWn.Vf=function(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k;for(null==t.n&&Dmn(t),k=t.n,null==t.d&&Dmn(t),s=t.d,(y=x8(xNt,qQn,25,k.length,15,1))[0]=k[0],v=k[0],h=1;h<k.length;h++)y[h]=y[h-1]+k[h],v+=k[h];for(c=PSn(t)-1,u=BB(mMn(n,(HXn(),Fpt)),19).a,r=KQn,i=new Np,b=e.Math.max(0,c-u);b<=e.Math.min(t.f-1,c+u);b++){if(g=v/(b+1),p=0,f=1,a=new Np,m=KQn,l=0,o=0,d=s[0],0==b)m=v,null==t.g&&(t.g=Xrn(t,new jc)),o=Gy(t.g);else{for(;f<t.f;)y[f-1]-p>=g&&(WB(a,iln(f)),m=e.Math.max(m,y[f-1]-l),o+=d,p+=y[f-1]-p,l=y[f-1],d=s[f]),d=e.Math.max(d,s[f]),++f;o+=d}(w=e.Math.min(1/m,1/t.b/o))>r&&(r=w,i=a)}return i},MWn.Wf=function(){return!1},vX(_1n,"MSDCutIndexHeuristic",802),wAn(1617,1,n1n,Sc),MWn.pf=function(n,t){bBn(BB(n,37),t)},vX(_1n,"SingleEdgeGraphWrapper",1617),wAn(227,22,{3:1,35:1,22:1,227:1},jP);var rht,cht,aht,uht=Ben(F1n,"CenterEdgeLabelPlacementStrategy",227,Unt,Z8,W_);wAn(422,22,{3:1,35:1,22:1,422:1},EP);var oht,sht,hht,fht,lht=Ben(F1n,"ConstraintCalculationStrategy",422,Unt,GY,V_);wAn(314,22,{3:1,35:1,22:1,314:1,246:1,234:1},TP),MWn.Kf=function(){return sIn(this)},MWn.Xf=function(){return sIn(this)};var bht,wht,dht,ght,pht=Ben(F1n,"CrossingMinimizationStrategy",314,Unt,T1,Q_);wAn(337,22,{3:1,35:1,22:1,337:1},MP);var vht,mht,yht,kht,jht,Eht,Tht=Ben(F1n,"CuttingStrategy",337,Unt,M1,Z_);wAn(335,22,{3:1,35:1,22:1,335:1,246:1,234:1},SP),MWn.Kf=function(){return RAn(this)},MWn.Xf=function(){return RAn(this)};var Mht,Sht,Pht,Cht=Ben(F1n,"CycleBreakingStrategy",335,Unt,L5,nF);wAn(419,22,{3:1,35:1,22:1,419:1},PP);var Iht,Oht,Aht,$ht,Lht=Ben(F1n,"DirectionCongruency",419,Unt,qY,tF);wAn(450,22,{3:1,35:1,22:1,450:1},CP);var Nht,xht,Dht,Rht,Kht,_ht,Fht,Bht=Ben(F1n,"EdgeConstraint",450,Unt,S1,eF);wAn(276,22,{3:1,35:1,22:1,276:1},IP);var Hht,qht,Ght,zht=Ben(F1n,"EdgeLabelSideSelection",276,Unt,i9,iF);wAn(479,22,{3:1,35:1,22:1,479:1},OP);var Uht,Xht,Wht,Vht,Qht,Yht,Jht,Zht=Ben(F1n,"EdgeStraighteningStrategy",479,Unt,HY,rF);wAn(274,22,{3:1,35:1,22:1,274:1},AP);var nft,tft,eft,ift,rft,cft,aft,uft=Ben(F1n,"FixedAlignment",274,Unt,t9,cF);wAn(275,22,{3:1,35:1,22:1,275:1},$P);var oft,sft,hft,fft,lft,bft,wft,dft,gft,pft,vft,mft=Ben(F1n,"GraphCompactionStrategy",275,Unt,n9,aF);wAn(256,22,{3:1,35:1,22:1,256:1},LP);var yft,kft,jft,Eft,Tft=Ben(F1n,"GraphProperties",256,Unt,bcn,uF);wAn(292,22,{3:1,35:1,22:1,292:1},NP);var Mft,Sft,Pft,Cft,Ift=Ben(F1n,"GreedySwitchType",292,Unt,I1,oF);wAn(303,22,{3:1,35:1,22:1,303:1},xP);var Oft,Aft,$ft,Lft=Ben(F1n,"InLayerConstraint",303,Unt,C1,sF);wAn(420,22,{3:1,35:1,22:1,420:1},DP);var Nft,xft,Dft,Rft,Kft,_ft,Fft,Bft,Hft,qft,Gft,zft,Uft,Xft,Wft,Vft,Qft,Yft,Jft,Zft,nlt,tlt,elt,ilt,rlt,clt,alt,ult,olt,slt,hlt,flt,llt,blt,wlt,dlt,glt,plt,vlt,mlt,ylt,klt,jlt,Elt,Tlt,Mlt,Slt,Plt,Clt,Ilt,Olt,Alt,$lt,Llt,Nlt,xlt,Dlt,Rlt,Klt,_lt,Flt,Blt,Hlt,qlt,Glt=Ben(F1n,"InteractiveReferencePoint",420,Unt,zY,hF);wAn(163,22,{3:1,35:1,22:1,163:1},BP);var zlt,Ult,Xlt,Wlt,Vlt,Qlt,Ylt,Jlt,Zlt,nbt,tbt,ebt,ibt,rbt,cbt,abt,ubt,obt,sbt,hbt,fbt,lbt,bbt,wbt,dbt,gbt,pbt,vbt,mbt,ybt,kbt,jbt,Ebt,Tbt,Mbt,Sbt,Pbt,Cbt,Ibt,Obt,Abt,$bt,Lbt,Nbt,xbt,Dbt,Rbt,Kbt,_bt,Fbt,Bbt,Hbt,qbt,Gbt,zbt,Ubt,Xbt,Wbt,Vbt,Qbt,Ybt,Jbt,Zbt,nwt,twt,ewt,iwt,rwt,cwt,awt,uwt,owt,swt,hwt,fwt,lwt,bwt,wwt,dwt,gwt,pwt,vwt,mwt,ywt,kwt,jwt,Ewt,Twt,Mwt,Swt,Pwt,Cwt,Iwt,Owt,Awt,$wt,Lwt,Nwt,xwt,Dwt,Rwt,Kwt,_wt,Fwt,Bwt,Hwt,qwt,Gwt,zwt,Uwt,Xwt,Wwt,Vwt,Qwt,Ywt,Jwt,Zwt,ndt,tdt,edt,idt,rdt,cdt,adt,udt,odt,sdt,hdt,fdt,ldt,bdt,wdt,ddt,gdt,pdt,vdt,mdt,ydt,kdt,jdt,Edt,Tdt,Mdt,Sdt,Pdt,Cdt,Idt,Odt,Adt,$dt,Ldt,Ndt,xdt,Ddt,Rdt,Kdt,_dt,Fdt,Bdt,Hdt,qdt,Gdt,zdt,Udt,Xdt,Wdt,Vdt,Qdt,Ydt,Jdt,Zdt,ngt,tgt,egt,igt,rgt,cgt,agt,ugt,ogt,sgt,hgt,fgt,lgt,bgt,wgt,dgt,ggt,pgt,vgt,mgt,ygt,kgt,jgt,Egt,Tgt,Mgt,Sgt,Pgt,Cgt,Igt,Ogt,Agt,$gt,Lgt,Ngt,xgt,Dgt,Rgt,Kgt,_gt,Fgt,Bgt,Hgt,qgt,Ggt,zgt,Ugt,Xgt,Wgt,Vgt,Qgt,Ygt,Jgt,Zgt,npt,tpt,ept,ipt,rpt,cpt,apt,upt,opt,spt,hpt,fpt,lpt,bpt,wpt,dpt,gpt,ppt,vpt,mpt,ypt,kpt,jpt,Ept,Tpt,Mpt,Spt,Ppt,Cpt,Ipt,Opt,Apt,$pt,Lpt,Npt,xpt,Dpt,Rpt,Kpt,_pt,Fpt,Bpt,Hpt,qpt,Gpt,zpt,Upt,Xpt,Wpt,Vpt,Qpt,Ypt,Jpt,Zpt,nvt,tvt,evt,ivt=Ben(F1n,"LayerConstraint",163,Unt,D5,fF);wAn(848,1,QYn,hf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U1n),""),"Direction Congruency"),"Specifies how drawings of the same graph with different layout directions compare to each other: either a natural reading direction is preserved or the drawings are rotated versions of each other."),Pbt),(PPn(),gMt)),Lht),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X1n),""),"Feedback Edges"),"Whether feedback edges should be highlighted by routing around the nodes."),(hN(),!1)),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W1n),""),"Interactive Reference Point"),"Determines which point of a node is considered by interactive layout phases."),Qbt),gMt),Glt),nbn(hMt)))),a2(n,W1n,e0n,Jbt),a2(n,W1n,l0n,Ybt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,V1n),""),"Merge Edges"),"Edges that have no ports are merged so they touch the connected nodes at the same points. When this option is disabled, one port is created for each edge directly connected to a node. When it is enabled, all such incoming edges share an input port, and all outgoing edges share an output port."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Q1n),""),"Merge Hierarchy-Crossing Edges"),"If hierarchical layout is active, hierarchy-crossing edges use as few hierarchical ports as possible. They are broken by the algorithm, with hierarchical ports inserted as required. Usually, one such port is created for each edge at each hierarchy crossing point. With this option set to true, we try to create as few hierarchical ports as possible in the process. In particular, all edges that form a hyperedge can share a port."),!0),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Pj(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Y1n),""),"Allow Non-Flow Ports To Switch Sides"),"Specifies whether non-flow ports may switch sides if their node's port constraints are either FIXED_SIDE or FIXED_ORDER. A non-flow port is a port on a side that is not part of the currently configured layout flow. For instance, given a left-to-right layout direction, north and south ports would be considered non-flow ports. Further note that the underlying criterium whether to switch sides or not solely relies on the minimization of edge crossings. Hence, edge length and other aesthetics criteria are not addressed."),!1),wMt),ktt),nbn(fMt)),Pun(Gk(Qtt,1),sVn,2,6,["org.eclipse.elk.layered.northOrSouthPort"])))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,J1n),""),"Port Sorting Strategy"),"Only relevant for nodes with FIXED_SIDE port constraints. Determines the way a node's ports are distributed on the sides of a node if their order is not prescribed. The option is set on parent nodes."),xwt),gMt),zvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Z1n),""),"Thoroughness"),"How much effort should be spent to produce a nice layout."),iln(7)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,n0n),""),"Add Unnecessary Bendpoints"),"Adds bend points even if an edge does not change direction. If true, each long edge dummy will contribute a bend point to its edges and hierarchy-crossing edges will always get a bend point where they cross hierarchy boundaries. By default, bend points are only added where an edge changes direction."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,t0n),""),"Generate Position and Layer IDs"),"If enabled position id and layer id are generated, which are usually only used internally when setting the interactiveLayout option. This option should be specified on the root node."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,e0n),"cycleBreaking"),"Cycle Breaking Strategy"),"Strategy for cycle breaking. Cycle breaking looks for cycles in the graph and determines which edges to reverse to break the cycles. Reversed edges will end up pointing to the opposite direction of regular edges (that is, reversed edges will point left if edges usually point right)."),Mbt),gMt),Cht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,i0n),f2n),"Node Layering Strategy"),"Strategy for node layering."),bwt),gMt),ovt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,r0n),f2n),"Layer Constraint"),"Determines a constraint on the placement of the node regarding the layering."),iwt),gMt),ivt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,c0n),f2n),"Layer Choice Constraint"),"Allows to set a constraint regarding the layer placement of a node. Let i be the value of teh constraint. Assumed the drawing has n layers and i < n. If set to i, it expresses that the node should be placed in i-th layer. Should i>=n be true then the node is placed in the last layer of the drawing. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,a0n),f2n),"Layer ID"),"Layer identifier that was calculated by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u0n),l2n),"Upper Bound On Width [MinWidth Layerer]"),"Defines a loose upper bound on the width of the MinWidth layerer. If set to '-1' multiple values are tested and the best result is selected."),iln(4)),vMt),Att),nbn(hMt)))),a2(n,u0n,i0n,awt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o0n),l2n),"Upper Layer Estimation Scaling Factor [MinWidth Layerer]"),"Multiplied with Upper Bound On Width for defining an upper bound on the width of layers which haven't been determined yet, but whose maximum width had been (roughly) estimated by the MinWidth algorithm. Compensates for too high estimations. If set to '-1' multiple values are tested and the best result is selected."),iln(2)),vMt),Att),nbn(hMt)))),a2(n,o0n,i0n,owt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s0n),b2n),"Node Promotion Strategy"),"Reduces number of dummy nodes after layering phase (if possible)."),fwt),gMt),Dvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,h0n),b2n),"Max Node Promotion Iterations"),"Limits the number of iterations for node promotion."),iln(0)),vMt),Att),nbn(hMt)))),a2(n,h0n,s0n,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,f0n),"layering.coffmanGraham"),"Layer Bound"),"The maximum number of nodes allowed per layer."),iln(DWn)),vMt),Att),nbn(hMt)))),a2(n,f0n,i0n,nwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,l0n),w2n),"Crossing Minimization Strategy"),"Strategy for crossing minimization."),Ebt),gMt),pht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,b0n),w2n),"Force Node Model Order"),"The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,w0n),w2n),"Hierarchical Sweepiness"),"How likely it is to use cross-hierarchy (1) vs bottom-up (-1)."),.1),dMt),Ptt),nbn(hMt)))),a2(n,w0n,d2n,pbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,d0n),w2n),"Semi-Interactive Crossing Minimization"),"Preserves the order of nodes within a layer but still minimizes crossings between edges connecting long edge dummies. Derives the desired order from positions specified by the 'org.eclipse.elk.position' layout option. Requires a crossing minimization strategy that is able to process 'in-layer' constraints."),!1),wMt),ktt),nbn(hMt)))),a2(n,d0n,l0n,kbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,g0n),w2n),"Position Choice Constraint"),"Allows to set a constraint regarding the position placement of a node in a layer. Assumed the layer in which the node placed includes n other nodes and i < n. If set to i, it expresses that the node should be placed at the i-th position. Should i>=n be true then the node is placed at the last position in the layer. Note that this option is not part of any of ELK Layered's default configurations but is only evaluated as part of the `InteractiveLayeredGraphVisitor`, which must be applied manually or used via the `DiagramLayoutEngine."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,p0n),w2n),"Position ID"),"Position within a layer that was determined by ELK Layered for a node. This is only generated if interactiveLayot or generatePositionAndLayerIds is set."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,v0n),g2n),"Greedy Switch Activation Threshold"),"By default it is decided automatically if the greedy switch is activated or not. The decision is based on whether the size of the input graph (without dummy nodes) is smaller than the value of this option. A '0' enforces the activation."),iln(40)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,m0n),g2n),"Greedy Switch Crossing Minimization"),"Greedy Switch strategy for crossing minimization. The greedy switch heuristic is executed after the regular crossing minimization as a post-processor. Note that if 'hierarchyHandling' is set to 'INCLUDE_CHILDREN', the 'greedySwitchHierarchical.type' option must be used."),wbt),gMt),Ift),nbn(hMt)))),a2(n,m0n,l0n,dbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,y0n),"crossingMinimization.greedySwitchHierarchical"),"Greedy Switch Crossing Minimization (hierarchical)"),"Activates the greedy switch heuristic in case hierarchical layout is used. The differences to the non-hierarchical case (see 'greedySwitch.type') are: 1) greedy switch is inactive by default, 3) only the option value set on the node at which hierarchical layout starts is relevant, and 2) if it's activated by the user, it properly addresses hierarchy-crossing edges."),hbt),gMt),Ift),nbn(hMt)))),a2(n,y0n,l0n,fbt),a2(n,y0n,d2n,lbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,k0n),p2n),"Node Placement Strategy"),"Strategy for node placement."),Lwt),gMt),Avt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,j0n),p2n),"Favor Straight Edges Over Balancing"),"Favor straight edges over a balanced node placement. The default behavior is determined automatically based on the used 'edgeRouting'. For an orthogonal style it is set to true, for all other styles to false."),wMt),ktt),nbn(hMt)))),a2(n,j0n,k0n,Ewt),a2(n,j0n,k0n,Twt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,E0n),v2n),"BK Edge Straightening"),"Specifies whether the Brandes Koepf node placer tries to increase the number of straight edges at the expense of diagram size. There is a subtle difference to the 'favorStraightEdges' option, which decides whether a balanced placement of the nodes is desired, or not. In bk terms this means combining the four alignments into a single balanced one, or not. This option on the other hand tries to straighten additional edges during the creation of each of the four alignments."),pwt),gMt),Zht),nbn(hMt)))),a2(n,E0n,k0n,vwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,T0n),v2n),"BK Fixed Alignment"),"Tells the BK node placer to use a certain alignment (out of its four) instead of the one producing the smallest height, or the combination of all four."),ywt),gMt),uft),nbn(hMt)))),a2(n,T0n,k0n,kwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,M0n),"nodePlacement.linearSegments"),"Linear Segments Deflection Dampening"),"Dampens the movement of nodes to keep the diagram from getting too large."),.3),dMt),Ptt),nbn(hMt)))),a2(n,M0n,k0n,Swt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,S0n),"nodePlacement.networkSimplex"),"Node Flexibility"),"Aims at shorter and straighter edges. Two configurations are possible: (a) allow ports to move freely on the side they are assigned to (the order is always defined beforehand), (b) additionally allow to enlarge a node wherever it helps. If this option is not configured for a node, the 'nodeFlexibility.default' value is used, which is specified for the node's parent."),gMt),kvt),nbn(sMt)))),a2(n,S0n,k0n,Awt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,P0n),"nodePlacement.networkSimplex.nodeFlexibility"),"Node Flexibility Default"),"Default value of the 'nodeFlexibility' option for the children of a hierarchical node."),Iwt),gMt),kvt),nbn(hMt)))),a2(n,P0n,k0n,Owt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,C0n),m2n),"Self-Loop Distribution"),"Alter the distribution of the loops around the node. It only takes effect for PortConstraints.FREE."),xbt),gMt),nmt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,I0n),m2n),"Self-Loop Ordering"),"Alter the ordering of the loops they can either be stacked or sequenced. It only takes effect for PortConstraints.FREE."),Rbt),gMt),cmt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,O0n),"edgeRouting.splines"),"Spline Routing Mode"),"Specifies the way control points are assembled for each individual edge. CONSERVATIVE ensures that edges are properly routed around the nodes but feels rather orthogonal at times. SLOPPY uses fewer control points to obtain curvier edge routes but may result in edges overlapping nodes."),_bt),gMt),hmt),nbn(hMt)))),a2(n,O0n,y2n,Fbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,A0n),"edgeRouting.splines.sloppy"),"Sloppy Spline Layer Spacing Factor"),"Spacing factor for routing area between layers when using sloppy spline routing."),.2),dMt),Ptt),nbn(hMt)))),a2(n,A0n,y2n,Hbt),a2(n,A0n,O0n,qbt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,$0n),"edgeRouting.polyline"),"Sloped Edge Zone Width"),"Width of the strip to the left and to the right of each layer where the polyline edge router is allowed to refrain from ensuring that edges are routed horizontally. This prevents awkward bend points for nodes that extent almost to the edge of their layer."),2),dMt),Ptt),nbn(hMt)))),a2(n,$0n,y2n,Lbt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,L0n),k2n),"Spacing Base Value"),"An optional base value for all other layout options of the 'spacing' group. It can be used to conveniently alter the overall 'spaciousness' of the drawing. Whenever an explicit value is set for the other layout options, this base value will have no effect. The base value is not inherited, i.e. it must be set for each hierarchical node."),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,N0n),k2n),"Edge Node Between Layers Spacing"),"The spacing to be preserved between nodes and edges that are routed next to the node's layer. For the spacing between nodes and edges that cross the node's layer 'spacing.edgeNode' is used."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,x0n),k2n),"Edge Edge Between Layer Spacing"),"Spacing to be preserved between pairs of edges that are routed between the same pair of layers. Note that 'spacing.edgeEdge' is used for the spacing between pairs of edges crossing the same layer."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,D0n),k2n),"Node Node Between Layers Spacing"),"The spacing to be preserved between any pair of nodes of two adjacent layers. Note that 'spacing.nodeNode' is used for the spacing between nodes within the layer itself."),20),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,R0n),j2n),"Direction Priority"),"Defines how important it is to have a certain edge point into the direction of the overall layout. This option is evaluated during the cycle breaking phase."),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,K0n),j2n),"Shortness Priority"),"Defines how important it is to keep an edge as short as possible. This option is evaluated during the layering phase."),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,_0n),j2n),"Straightness Priority"),"Defines how important it is to keep an edge straight, i.e. aligned with one of the two axes. This option is evaluated during node placement."),iln(0)),vMt),Att),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,F0n),E2n),DJn),"Tries to further compact components (disconnected sub-graphs)."),!1),wMt),ktt),nbn(hMt)))),a2(n,F0n,kZn,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,B0n),T2n),"Post Compaction Strategy"),M2n),Ylt),gMt),mft),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,H0n),T2n),"Post Compaction Constraint Calculation"),M2n),Vlt),gMt),lht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,q0n),S2n),"High Degree Node Treatment"),"Makes room around high degree nodes to place leafs and trees."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,G0n),S2n),"High Degree Node Threshold"),"Whether a node is considered to have a high degree."),iln(16)),vMt),Att),nbn(hMt)))),a2(n,G0n,q0n,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,z0n),S2n),"High Degree Node Maximum Tree Height"),"Maximum height of a subtree connected to a high degree node to be moved to separate layers."),iln(5)),vMt),Att),nbn(hMt)))),a2(n,z0n,q0n,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U0n),P2n),"Graph Wrapping Strategy"),"For certain graphs and certain prescribed drawing areas it may be desirable to split the laid out graph into chunks that are placed side by side. The edges that connect different chunks are 'wrapped' around from the end of one chunk to the start of the other chunk. The points between the chunks are referred to as 'cuts'."),bdt),gMt),Smt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X0n),P2n),"Additional Wrapped Edges Spacing"),"To visually separate edges that are wrapped from regularly routed edges an additional spacing value can be specified in form of this layout option. The spacing is added to the regular edgeNode spacing."),10),dMt),Ptt),nbn(hMt)))),a2(n,X0n,U0n,Uwt),a2(n,X0n,U0n,Xwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W0n),P2n),"Correction Factor for Wrapping"),"At times and for certain types of graphs the executed wrapping may produce results that are consistently biased in the same fashion: either wrapping to often or to rarely. This factor can be used to correct the bias. Internally, it is simply multiplied with the 'aspect ratio' layout option."),1),dMt),Ptt),nbn(hMt)))),a2(n,W0n,U0n,Vwt),a2(n,W0n,U0n,Qwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,V0n),C2n),"Cutting Strategy"),"The strategy by which the layer indexes are determined at which the layering crumbles into chunks."),idt),gMt),Tht),nbn(hMt)))),a2(n,V0n,U0n,rdt),a2(n,V0n,U0n,cdt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,Q0n),C2n),"Manually Specified Cuts"),"Allows the user to specify her own cuts for a certain graph."),mMt),Rnt),nbn(hMt)))),a2(n,Q0n,V0n,Jwt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Y0n),"wrapping.cutting.msd"),"MSD Freedom"),"The MSD cutting strategy starts with an initial guess on the number of chunks the graph should be split into. The freedom specifies how much the strategy may deviate from this guess. E.g. if an initial number of 3 is computed, a freedom of 1 allows 2, 3, and 4 cuts."),ndt),vMt),Att),nbn(hMt)))),a2(n,Y0n,V0n,tdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,J0n),I2n),"Validification Strategy"),"When wrapping graphs, one can specify indices that are not allowed as split points. The validification strategy makes sure every computed split point is allowed."),vdt),gMt),dmt),nbn(hMt)))),a2(n,J0n,U0n,mdt),a2(n,J0n,U0n,ydt),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,Z0n),I2n),"Valid Indices for Wrapping"),null),mMt),Rnt),nbn(hMt)))),a2(n,Z0n,U0n,ddt),a2(n,Z0n,U0n,gdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,n2n),O2n),"Improve Cuts"),"For general graphs it is important that not too many edges wrap backwards. Thus a compromise between evenly-distributed cuts and the total number of cut edges is sought."),!0),wMt),ktt),nbn(hMt)))),a2(n,n2n,U0n,sdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,t2n),O2n),"Distance Penalty When Improving Cuts"),null),2),dMt),Ptt),nbn(hMt)))),a2(n,t2n,U0n,udt),a2(n,t2n,n2n,!0),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,e2n),O2n),"Improve Wrapped Edges"),"The initial wrapping is performed in a very simple way. As a consequence, edges that wrap from one chunk to another may be unnecessarily long. Activating this option tries to shorten such edges."),!0),wMt),ktt),nbn(hMt)))),a2(n,e2n,U0n,fdt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,i2n),A2n),"Edge Label Side Selection"),"Method to decide on edge label sides."),Abt),gMt),zht),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,r2n),A2n),"Edge Center Label Placement Strategy"),"Determines in which layer center labels of long edges should be placed."),Ibt),gMt),uht),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,c2n),$2n),"Consider Model Order"),"Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting."),abt),gMt),Fvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,a2n),$2n),"No Model Order"),"Set on a node to not set a model order for this node even though it is a real node."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u2n),$2n),"Consider Model Order for Components"),"If set to NONE the usual ordering strategy (by cumulative node priority and size of nodes) is used. INSIDE_PORT_SIDES orders the components with external ports only inside the groups with the same port side. FORCE_MODEL_ORDER enforces the mode order on components. This option might produce bad alignments and sub optimal drawings in terms of used area since the ordering should be respected."),Zlt),gMt),mut),nbn(hMt)))),a2(n,u2n,kZn,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o2n),$2n),"Long Edge Ordering Strategy"),"Indicates whether long edges are sorted under, over, or equal to nodes that have no connection to a previous layer in a left-to-right or right-to-left layout. Under and over changes to right and left in a vertical layout."),ibt),gMt),wvt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s2n),$2n),"Crossing Counter Node Order Influence"),"Indicates with what percentage (1 for 100%) violations of the node model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal node order. Defaults to no influence (0)."),0),dMt),Ptt),nbn(hMt)))),a2(n,s2n,c2n,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,h2n),$2n),"Crossing Counter Port Order Influence"),"Indicates with what percentage (1 for 100%) violations of the port model order are weighted against the crossings e.g. a value of 0.5 means two model order violations are as important as on edge crossing. This allows some edge crossings in favor of preserving the model order. It is advised to set this value to a very small positive value (e.g. 0.001) to have minimal crossing and a optimal port order. Defaults to no influence (0)."),0),dMt),Ptt),nbn(hMt)))),a2(n,h2n,c2n,null),vWn((new bf,n))},vX(F1n,"LayeredMetaDataProvider",848),wAn(986,1,QYn,bf),MWn.Qe=function(n){vWn(n)},vX(F1n,"LayeredOptions",986),wAn(987,1,{},Cc),MWn.$e=function(){return new Uv},MWn._e=function(n){},vX(F1n,"LayeredOptions/LayeredFactory",987),wAn(1372,1,{}),MWn.a=0,vX(y3n,"ElkSpacings/AbstractSpacingsBuilder",1372),wAn(779,1372,{},uwn),vX(F1n,"LayeredSpacings/LayeredSpacingsBuilder",779),wAn(313,22,{3:1,35:1,22:1,313:1,246:1,234:1},RP),MWn.Kf=function(){return rLn(this)},MWn.Xf=function(){return rLn(this)};var rvt,cvt,avt,uvt,ovt=Ben(F1n,"LayeringStrategy",313,Unt,e9,lF);wAn(378,22,{3:1,35:1,22:1,378:1},KP);var svt,hvt,fvt,lvt,bvt,wvt=Ben(F1n,"LongEdgeOrderingStrategy",378,Unt,E1,bF);wAn(197,22,{3:1,35:1,22:1,197:1},_P);var dvt,gvt,pvt,vvt,mvt,yvt,kvt=Ben(F1n,"NodeFlexibility",197,Unt,k3,wF);wAn(315,22,{3:1,35:1,22:1,315:1,246:1,234:1},FP),MWn.Kf=function(){return DAn(this)},MWn.Xf=function(){return DAn(this)};var jvt,Evt,Tvt,Mvt,Svt,Pvt,Cvt,Ivt,Ovt,Avt=Ben(F1n,"NodePlacementStrategy",315,Unt,$5,yF);wAn(260,22,{3:1,35:1,22:1,260:1},HP);var $vt,Lvt,Nvt,xvt,Dvt=Ben(F1n,"NodePromotionStrategy",260,Unt,Btn,gF);wAn(339,22,{3:1,35:1,22:1,339:1},qP);var Rvt,Kvt,_vt,Fvt=Ben(F1n,"OrderingStrategy",339,Unt,A1,pF);wAn(421,22,{3:1,35:1,22:1,421:1},GP);var Bvt,Hvt,qvt,Gvt,zvt=Ben(F1n,"PortSortingStrategy",421,Unt,UY,vF);wAn(452,22,{3:1,35:1,22:1,452:1},zP);var Uvt,Xvt,Wvt,Vvt,Qvt=Ben(F1n,"PortType",452,Unt,O1,dF);wAn(375,22,{3:1,35:1,22:1,375:1},UP);var Yvt,Jvt,Zvt,nmt=Ben(F1n,"SelfLoopDistributionStrategy",375,Unt,$1,mF);wAn(376,22,{3:1,35:1,22:1,376:1},XP);var tmt,emt,imt,rmt,cmt=Ben(F1n,"SelfLoopOrderingStrategy",376,Unt,BY,kF);wAn(304,1,{304:1},sGn),vX(F1n,"Spacings",304),wAn(336,22,{3:1,35:1,22:1,336:1},WP);var amt,umt,omt,smt,hmt=Ben(F1n,"SplineRoutingMode",336,Unt,N1,jF);wAn(338,22,{3:1,35:1,22:1,338:1},VP);var fmt,lmt,bmt,wmt,dmt=Ben(F1n,"ValidifyStrategy",338,Unt,x1,EF);wAn(377,22,{3:1,35:1,22:1,377:1},QP);var gmt,pmt,vmt,mmt,ymt,kmt,jmt,Emt,Tmt,Mmt,Smt=Ben(F1n,"WrappingStrategy",377,Unt,L1,TF);wAn(1383,1,E3n,wf),MWn.Yf=function(n){return BB(n,37),pmt},MWn.pf=function(n,t){JHn(this,BB(n,37),t)},vX(T3n,"DepthFirstCycleBreaker",1383),wAn(782,1,E3n,KG),MWn.Yf=function(n){return BB(n,37),vmt},MWn.pf=function(n,t){UXn(this,BB(n,37),t)},MWn.Zf=function(n){return BB(xq(n,pvn(this.d,n.c.length)),10)},vX(T3n,"GreedyCycleBreaker",782),wAn(1386,782,E3n,TI),MWn.Zf=function(n){var t,e,i,r;for(r=null,t=DWn,i=new Wb(n);i.a<i.c.c.length;)Lx(e=BB(n0(i),10),(hWn(),wlt))&&BB(mMn(e,wlt),19).a<t&&(t=BB(mMn(e,wlt),19).a,r=e);return r||BB(xq(n,pvn(this.d,n.c.length)),10)},vX(T3n,"GreedyModelOrderCycleBreaker",1386),wAn(1384,1,E3n,rf),MWn.Yf=function(n){return BB(n,37),mmt},MWn.pf=function(n,t){Iqn(this,BB(n,37),t)},vX(T3n,"InteractiveCycleBreaker",1384),wAn(1385,1,E3n,cf),MWn.Yf=function(n){return BB(n,37),ymt},MWn.pf=function(n,t){Lqn(this,BB(n,37),t)},MWn.a=0,MWn.b=0,vX(T3n,"ModelOrderCycleBreaker",1385),wAn(1389,1,E3n,$M),MWn.Yf=function(n){return BB(n,37),kmt},MWn.pf=function(n,t){JXn(this,BB(n,37),t)},vX(M3n,"CoffmanGrahamLayerer",1389),wAn(1390,1,MYn,Dd),MWn.ue=function(n,t){return BIn(this.a,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(M3n,"CoffmanGrahamLayerer/0methodref$compareNodesInTopo$Type",1390),wAn(1391,1,MYn,Rd),MWn.ue=function(n,t){return zG(this.a,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(M3n,"CoffmanGrahamLayerer/lambda$1$Type",1391),wAn(1392,1,E3n,Ic),MWn.Yf=function(n){return BB(n,37),dq(dq(dq(new B2,(yMn(),Rat),(lWn(),kot)),Kat,Oot),_at,Iot)},MWn.pf=function(n,t){EUn(this,BB(n,37),t)},vX(M3n,"InteractiveLayerer",1392),wAn(569,1,{569:1},im),MWn.a=0,MWn.c=0,vX(M3n,"InteractiveLayerer/LayerSpan",569),wAn(1388,1,E3n,ef),MWn.Yf=function(n){return BB(n,37),jmt},MWn.pf=function(n,t){qxn(this,BB(n,37),t)},vX(M3n,"LongestPathLayerer",1388),wAn(1395,1,E3n,sf),MWn.Yf=function(n){return BB(n,37),dq(dq(dq(new B2,(yMn(),Rat),(lWn(),cot)),Kat,Oot),_at,Iot)},MWn.pf=function(n,t){iXn(this,BB(n,37),t)},MWn.a=0,MWn.b=0,MWn.d=0,vX(M3n,"MinWidthLayerer",1395),wAn(1396,1,MYn,Kd),MWn.ue=function(n,t){return dan(this,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(M3n,"MinWidthLayerer/MinOutgoingEdgesComparator",1396),wAn(1387,1,E3n,of),MWn.Yf=function(n){return BB(n,37),Mmt},MWn.pf=function(n,t){mGn(this,BB(n,37),t)},vX(M3n,"NetworkSimplexLayerer",1387),wAn(1393,1,E3n,RR),MWn.Yf=function(n){return BB(n,37),dq(dq(dq(new B2,(yMn(),Rat),(lWn(),cot)),Kat,Oot),_at,Iot)},MWn.pf=function(n,t){$zn(this,BB(n,37),t)},MWn.d=0,MWn.f=0,MWn.g=0,MWn.i=0,MWn.s=0,MWn.t=0,MWn.u=0,vX(M3n,"StretchWidthLayerer",1393),wAn(1394,1,MYn,Oc),MWn.ue=function(n,t){return R6(BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(M3n,"StretchWidthLayerer/1",1394),wAn(402,1,S3n),MWn.Nf=function(n,t,e,i,r,c){},MWn._f=function(n,t,e){return r_n(this,n,t,e)},MWn.Mf=function(){this.g=x8(DNt,P3n,25,this.d,15,1),this.f=x8(DNt,P3n,25,this.d,15,1)},MWn.Of=function(n,t){this.e[n]=x8(ANt,hQn,25,t[n].length,15,1)},MWn.Pf=function(n,t,e){e[n][t].p=t,this.e[n][t]=t},MWn.Qf=function(n,t,e,i){BB(xq(i[n][t].j,e),11).p=this.d++},MWn.b=0,MWn.c=0,MWn.d=0,vX(C3n,"AbstractBarycenterPortDistributor",402),wAn(1633,1,MYn,_d),MWn.ue=function(n,t){return qgn(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(C3n,"AbstractBarycenterPortDistributor/lambda$0$Type",1633),wAn(817,1,N1n,G2),MWn.Nf=function(n,t,e,i,r,c){},MWn.Pf=function(n,t,e){},MWn.Qf=function(n,t,e,i){},MWn.Lf=function(){return!1},MWn.Mf=function(){this.c=this.e.a,this.g=this.f.g},MWn.Of=function(n,t){t[n][0].c.p=n},MWn.Rf=function(){return!1},MWn.ag=function(n,t,e,i){e?sjn(this,n):(Djn(this,n,i),ZGn(this,n,t)),n.c.length>1&&(qy(TD(mMn(vW((l1(0,n.c.length),BB(n.c[0],10))),(HXn(),xdt))))?R$n(n,this.d,BB(this,660)):(SQ(),m$(n,this.d)),Ban(this.e,n))},MWn.Sf=function(n,t,e,i){var r,c,a,u,o,s,h;for(t!=Jq(e,n.length)&&(c=n[t-(e?1:-1)],G6(this.f,c,e?(ain(),qvt):(ain(),Hvt))),r=n[t][0],h=!i||r.k==(uSn(),Mut),s=u6(n[t]),this.ag(s,h,!1,e),a=0,o=new Wb(s);o.a<o.c.c.length;)u=BB(n0(o),10),n[t][a++]=u;return!1},MWn.Tf=function(n,t){var e,i,r,c,a;for(c=u6(n[a=Jq(t,n.length)]),this.ag(c,!1,!0,t),e=0,r=new Wb(c);r.a<r.c.c.length;)i=BB(n0(r),10),n[a][e++]=i;return!1},vX(C3n,"BarycenterHeuristic",817),wAn(658,1,{658:1},Bd),MWn.Ib=function(){return"BarycenterState [node="+this.c+", summedWeight="+this.d+", degree="+this.b+", barycenter="+this.a+", visited="+this.e+"]"},MWn.b=0,MWn.d=0,MWn.e=!1;var Pmt=vX(C3n,"BarycenterHeuristic/BarycenterState",658);wAn(1802,1,MYn,Fd),MWn.ue=function(n,t){return MEn(this.a,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(C3n,"BarycenterHeuristic/lambda$0$Type",1802),wAn(816,1,N1n,UEn),MWn.Mf=function(){},MWn.Nf=function(n,t,e,i,r,c){},MWn.Qf=function(n,t,e,i){},MWn.Of=function(n,t){this.a[n]=x8(Pmt,{3:1,4:1,5:1,2018:1},658,t[n].length,0,1),this.b[n]=x8(Lmt,{3:1,4:1,5:1,2019:1},233,t[n].length,0,1)},MWn.Pf=function(n,t,e){Dgn(this,e[n][t],!0)},MWn.c=!1,vX(C3n,"ForsterConstraintResolver",816),wAn(233,1,{233:1},DY,uGn),MWn.Ib=function(){var n,t;for((t=new Ck).a+="[",n=0;n<this.d.length;n++)oO(t,$pn(this.d[n])),null!=lL(this.g,this.d[0]).a&&oO(oO((t.a+="<",t),ZI(lL(this.g,this.d[0]).a)),">"),n<this.d.length-1&&(t.a+=FWn);return(t.a+="]",t).a},MWn.a=0,MWn.c=0,MWn.f=0;var Cmt,Imt,Omt,Amt,$mt,Lmt=vX(C3n,"ForsterConstraintResolver/ConstraintGroup",233);wAn(1797,1,lVn,qd),MWn.td=function(n){Dgn(this.a,BB(n,10),!1)},vX(C3n,"ForsterConstraintResolver/lambda$0$Type",1797),wAn(214,1,{214:1,225:1},CGn),MWn.Nf=function(n,t,e,i,r,c){},MWn.Of=function(n,t){},MWn.Mf=function(){this.r=x8(ANt,hQn,25,this.n,15,1)},MWn.Pf=function(n,t,e){var i;(i=e[n][t].e)&&WB(this.b,i)},MWn.Qf=function(n,t,e,i){++this.n},MWn.Ib=function(){return izn(this.e,new Rv)},MWn.g=!1,MWn.i=!1,MWn.n=0,MWn.s=!1,vX(C3n,"GraphInfoHolder",214),wAn(1832,1,N1n,Pc),MWn.Nf=function(n,t,e,i,r,c){},MWn.Of=function(n,t){},MWn.Qf=function(n,t,e,i){},MWn._f=function(n,t,e){return e&&t>0?uZ(this.a,n[t-1],n[t]):!e&&t<n.length-1?uZ(this.a,n[t],n[t+1]):yrn(this.a,n[t],e?(kUn(),CIt):(kUn(),oIt)),bLn(this,n,t,e)},MWn.Mf=function(){this.d=x8(ANt,hQn,25,this.c,15,1),this.a=new QK(this.d)},MWn.Pf=function(n,t,e){var i;i=e[n][t],this.c+=i.j.c.length},MWn.c=0,vX(C3n,"GreedyPortDistributor",1832),wAn(1401,1,E3n,df),MWn.Yf=function(n){return Xhn(BB(n,37))},MWn.pf=function(n,t){XGn(BB(n,37),t)},vX(C3n,"InteractiveCrossingMinimizer",1401),wAn(1402,1,MYn,Gd),MWn.ue=function(n,t){return Hjn(this,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(C3n,"InteractiveCrossingMinimizer/1",1402),wAn(507,1,{507:1,123:1,51:1},Ny),MWn.Yf=function(n){var t;return BB(n,37),dq(t=kA(Imt),(yMn(),_at),(lWn(),Bot)),t},MWn.pf=function(n,t){P_n(this,BB(n,37),t)},MWn.e=0,vX(C3n,"LayerSweepCrossingMinimizer",507),wAn(1398,1,lVn,zd),MWn.td=function(n){wBn(this.a,BB(n,214))},vX(C3n,"LayerSweepCrossingMinimizer/0methodref$compareDifferentRandomizedLayouts$Type",1398),wAn(1399,1,lVn,Ud),MWn.td=function(n){Ohn(this.a,BB(n,214))},vX(C3n,"LayerSweepCrossingMinimizer/1methodref$minimizeCrossingsNoCounter$Type",1399),wAn(1400,1,lVn,Xd),MWn.td=function(n){pFn(this.a,BB(n,214))},vX(C3n,"LayerSweepCrossingMinimizer/2methodref$minimizeCrossingsWithCounter$Type",1400),wAn(454,22,{3:1,35:1,22:1,454:1},YP);var Nmt,xmt=Ben(C3n,"LayerSweepCrossingMinimizer/CrossMinType",454,Unt,D1,MF);wAn(1397,1,DVn,Ac),MWn.Mb=function(n){return _cn(),0==BB(n,29).a.c.length},vX(C3n,"LayerSweepCrossingMinimizer/lambda$0$Type",1397),wAn(1799,1,N1n,aZ),MWn.Mf=function(){},MWn.Nf=function(n,t,e,i,r,c){},MWn.Qf=function(n,t,e,i){},MWn.Of=function(n,t){t[n][0].c.p=n,this.b[n]=x8(_mt,{3:1,4:1,5:1,1944:1},659,t[n].length,0,1)},MWn.Pf=function(n,t,e){e[n][t].p=t,$X(this.b[n],t,new $c)},vX(C3n,"LayerSweepTypeDecider",1799),wAn(659,1,{659:1},$c),MWn.Ib=function(){return"NodeInfo [connectedEdges="+this.a+", hierarchicalInfluence="+this.b+", randomInfluence="+this.c+"]"},MWn.a=0,MWn.b=0,MWn.c=0;var Dmt,Rmt,Kmt,_mt=vX(C3n,"LayerSweepTypeDecider/NodeInfo",659);wAn(1800,1,qYn,Lc),MWn.Lb=function(n){return zN(new m6(BB(n,11).b))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return zN(new m6(BB(n,11).b))},vX(C3n,"LayerSweepTypeDecider/lambda$0$Type",1800),wAn(1801,1,qYn,Nc),MWn.Lb=function(n){return zN(new m6(BB(n,11).b))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return zN(new m6(BB(n,11).b))},vX(C3n,"LayerSweepTypeDecider/lambda$1$Type",1801),wAn(1833,402,S3n,Dj),MWn.$f=function(n,t,e){var i,r,c,a,u,o,s,h,f;switch(s=this.g,e.g){case 1:for(i=0,r=0,o=new Wb(n.j);o.a<o.c.c.length;)0!=(a=BB(n0(o),11)).e.c.length&&(++i,a.j==(kUn(),sIt)&&++r);for(c=t+r,f=t+i,u=xwn(n,(ain(),Hvt)).Kc();u.Ob();)(a=BB(u.Pb(),11)).j==(kUn(),sIt)?(s[a.p]=c,--c):(s[a.p]=f,--f);return i;case 2:for(h=0,u=xwn(n,(ain(),qvt)).Kc();u.Ob();)++h,s[(a=BB(u.Pb(),11)).p]=t+h;return h;default:throw Hp(new wv)}},vX(C3n,"LayerTotalPortDistributor",1833),wAn(660,817,{660:1,225:1},prn),MWn.ag=function(n,t,e,i){e?sjn(this,n):(Djn(this,n,i),ZGn(this,n,t)),n.c.length>1&&(qy(TD(mMn(vW((l1(0,n.c.length),BB(n.c[0],10))),(HXn(),xdt))))?R$n(n,this.d,this):(SQ(),m$(n,this.d)),qy(TD(mMn(vW((l1(0,n.c.length),BB(n.c[0],10))),xdt)))||Ban(this.e,n))},vX(C3n,"ModelOrderBarycenterHeuristic",660),wAn(1803,1,MYn,Wd),MWn.ue=function(n,t){return KSn(this.a,BB(n,10),BB(t,10))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(C3n,"ModelOrderBarycenterHeuristic/lambda$0$Type",1803),wAn(1403,1,E3n,jf),MWn.Yf=function(n){var t;return BB(n,37),dq(t=kA(Dmt),(yMn(),_at),(lWn(),Bot)),t},MWn.pf=function(n,t){mY((BB(n,37),t))},vX(C3n,"NoCrossingMinimizer",1403),wAn(796,402,S3n,Rj),MWn.$f=function(n,t,e){var i,r,c,a,u,o,s,h,f,l,b;switch(f=this.g,e.g){case 1:for(r=0,c=0,h=new Wb(n.j);h.a<h.c.c.length;)0!=(o=BB(n0(h),11)).e.c.length&&(++r,o.j==(kUn(),sIt)&&++c);for(a=t+c*(i=1/(r+1)),b=t+1-i,s=xwn(n,(ain(),Hvt)).Kc();s.Ob();)(o=BB(s.Pb(),11)).j==(kUn(),sIt)?(f[o.p]=a,a-=i):(f[o.p]=b,b-=i);break;case 2:for(u=0,h=new Wb(n.j);h.a<h.c.c.length;)0==(o=BB(n0(h),11)).g.c.length||++u;for(l=t+(i=1/(u+1)),s=xwn(n,(ain(),qvt)).Kc();s.Ob();)f[(o=BB(s.Pb(),11)).p]=l,l+=i;break;default:throw Hp(new _y("Port type is undefined"))}return 1},vX(C3n,"NodeRelativePortDistributor",796),wAn(807,1,{},Vz,HMn),vX(C3n,"SweepCopy",807),wAn(1798,1,N1n,wdn),MWn.Of=function(n,t){},MWn.Mf=function(){var n;n=x8(ANt,hQn,25,this.f,15,1),this.d=new eg(n),this.a=new QK(n)},MWn.Nf=function(n,t,e,i,r,c){var a;a=BB(xq(c[n][t].j,e),11),r.c==a&&r.c.i.c==r.d.i.c&&++this.e[n]},MWn.Pf=function(n,t,e){var i;i=e[n][t],this.c[n]=this.c[n]|i.k==(uSn(),Iut)},MWn.Qf=function(n,t,e,i){var r;(r=BB(xq(i[n][t].j,e),11)).p=this.f++,r.g.c.length+r.e.c.length>1&&(r.j==(kUn(),oIt)?this.b[n]=!0:r.j==CIt&&n>0&&(this.b[n-1]=!0))},MWn.f=0,vX(L1n,"AllCrossingsCounter",1798),wAn(587,1,{},mrn),MWn.b=0,MWn.d=0,vX(L1n,"BinaryIndexedTree",587),wAn(524,1,{},QK),vX(L1n,"CrossingsCounter",524),wAn(1906,1,MYn,Vd),MWn.ue=function(n,t){return Xq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$0$Type",1906),wAn(1907,1,MYn,Qd),MWn.ue=function(n,t){return Wq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$1$Type",1907),wAn(1908,1,MYn,Yd),MWn.ue=function(n,t){return Vq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$2$Type",1908),wAn(1909,1,MYn,Jd),MWn.ue=function(n,t){return Qq(this.a,BB(n,11),BB(t,11))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(L1n,"CrossingsCounter/lambda$3$Type",1909),wAn(1910,1,lVn,Zd),MWn.td=function(n){p7(this.a,BB(n,11))},vX(L1n,"CrossingsCounter/lambda$4$Type",1910),wAn(1911,1,DVn,ng),MWn.Mb=function(n){return yI(this.a,BB(n,11))},vX(L1n,"CrossingsCounter/lambda$5$Type",1911),wAn(1912,1,lVn,tg),MWn.td=function(n){mI(this,n)},vX(L1n,"CrossingsCounter/lambda$6$Type",1912),wAn(1913,1,lVn,ZP),MWn.td=function(n){var t;hH(),d3(this.b,(t=this.a,BB(n,11),t))},vX(L1n,"CrossingsCounter/lambda$7$Type",1913),wAn(826,1,qYn,xc),MWn.Lb=function(n){return hH(),Lx(BB(n,11),(hWn(),Elt))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return hH(),Lx(BB(n,11),(hWn(),Elt))},vX(L1n,"CrossingsCounter/lambda$8$Type",826),wAn(1905,1,{},eg),vX(L1n,"HyperedgeCrossingsCounter",1905),wAn(467,1,{35:1,467:1},DR),MWn.wd=function(n){return vgn(this,BB(n,467))},MWn.b=0,MWn.c=0,MWn.e=0,MWn.f=0;var Fmt=vX(L1n,"HyperedgeCrossingsCounter/Hyperedge",467);wAn(362,1,{35:1,362:1},qV),MWn.wd=function(n){return l$n(this,BB(n,362))},MWn.b=0,MWn.c=0;var Bmt,Hmt,qmt=vX(L1n,"HyperedgeCrossingsCounter/HyperedgeCorner",362);wAn(523,22,{3:1,35:1,22:1,523:1},JP);var Gmt,zmt,Umt,Xmt,Wmt,Vmt=Ben(L1n,"HyperedgeCrossingsCounter/HyperedgeCorner/Type",523,Unt,XY,SF);wAn(1405,1,E3n,lf),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?zmt:null},MWn.pf=function(n,t){ljn(this,BB(n,37),t)},vX(I3n,"InteractiveNodePlacer",1405),wAn(1406,1,E3n,ff),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?Umt:null},MWn.pf=function(n,t){jmn(this,BB(n,37),t)},vX(I3n,"LinearSegmentsNodePlacer",1406),wAn(257,1,{35:1,257:1},rm),MWn.wd=function(n){return uj(this,BB(n,257))},MWn.Fb=function(n){var t;return!!cL(n,257)&&(t=BB(n,257),this.b==t.b)},MWn.Hb=function(){return this.b},MWn.Ib=function(){return"ls"+LMn(this.e)},MWn.a=0,MWn.b=0,MWn.c=-1,MWn.d=-1,MWn.g=0;var Qmt,Ymt=vX(I3n,"LinearSegmentsNodePlacer/LinearSegment",257);wAn(1408,1,E3n,_G),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?Qmt:null},MWn.pf=function(n,t){SXn(this,BB(n,37),t)},MWn.b=0,MWn.g=0,vX(I3n,"NetworkSimplexPlacer",1408),wAn(1427,1,MYn,Dc),MWn.ue=function(n,t){return E$(BB(n,19).a,BB(t,19).a)},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(I3n,"NetworkSimplexPlacer/0methodref$compare$Type",1427),wAn(1429,1,MYn,Rc),MWn.ue=function(n,t){return E$(BB(n,19).a,BB(t,19).a)},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(I3n,"NetworkSimplexPlacer/1methodref$compare$Type",1429),wAn(649,1,{649:1},nC);var Jmt=vX(I3n,"NetworkSimplexPlacer/EdgeRep",649);wAn(401,1,{401:1},GV),MWn.b=!1;var Zmt,nyt,tyt,eyt=vX(I3n,"NetworkSimplexPlacer/NodeRep",401);wAn(508,12,{3:1,4:1,20:1,28:1,52:1,12:1,14:1,15:1,54:1,508:1},um),vX(I3n,"NetworkSimplexPlacer/Path",508),wAn(1409,1,{},Kc),MWn.Kb=function(n){return BB(n,17).d.i.k},vX(I3n,"NetworkSimplexPlacer/Path/lambda$0$Type",1409),wAn(1410,1,DVn,_c),MWn.Mb=function(n){return BB(n,267)==(uSn(),Put)},vX(I3n,"NetworkSimplexPlacer/Path/lambda$1$Type",1410),wAn(1411,1,{},Fc),MWn.Kb=function(n){return BB(n,17).d.i},vX(I3n,"NetworkSimplexPlacer/Path/lambda$2$Type",1411),wAn(1412,1,DVn,ig),MWn.Mb=function(n){return HD(tdn(BB(n,10)))},vX(I3n,"NetworkSimplexPlacer/Path/lambda$3$Type",1412),wAn(1413,1,DVn,Bc),MWn.Mb=function(n){return hq(BB(n,11))},vX(I3n,"NetworkSimplexPlacer/lambda$0$Type",1413),wAn(1414,1,lVn,tC),MWn.td=function(n){D$(this.a,this.b,BB(n,11))},vX(I3n,"NetworkSimplexPlacer/lambda$1$Type",1414),wAn(1423,1,lVn,rg),MWn.td=function(n){WCn(this.a,BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$10$Type",1423),wAn(1424,1,{},Hc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$11$Type",1424),wAn(1425,1,lVn,cg),MWn.td=function(n){BDn(this.a,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$12$Type",1425),wAn(1426,1,{},qc),MWn.Kb=function(n){return BZ(),iln(BB(n,121).e)},vX(I3n,"NetworkSimplexPlacer/lambda$13$Type",1426),wAn(1428,1,{},Gc),MWn.Kb=function(n){return BZ(),iln(BB(n,121).e)},vX(I3n,"NetworkSimplexPlacer/lambda$15$Type",1428),wAn(1430,1,DVn,zc),MWn.Mb=function(n){return BZ(),BB(n,401).c.k==(uSn(),Cut)},vX(I3n,"NetworkSimplexPlacer/lambda$17$Type",1430),wAn(1431,1,DVn,Uc),MWn.Mb=function(n){return BZ(),BB(n,401).c.j.c.length>1},vX(I3n,"NetworkSimplexPlacer/lambda$18$Type",1431),wAn(1432,1,lVn,zV),MWn.td=function(n){cwn(this.c,this.b,this.d,this.a,BB(n,401))},MWn.c=0,MWn.d=0,vX(I3n,"NetworkSimplexPlacer/lambda$19$Type",1432),wAn(1415,1,{},Xc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$2$Type",1415),wAn(1433,1,lVn,ag),MWn.td=function(n){N$(this.a,BB(n,11))},MWn.a=0,vX(I3n,"NetworkSimplexPlacer/lambda$20$Type",1433),wAn(1434,1,{},Wc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$21$Type",1434),wAn(1435,1,lVn,ug),MWn.td=function(n){dL(this.a,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$22$Type",1435),wAn(1436,1,DVn,Vc),MWn.Mb=function(n){return HD(n)},vX(I3n,"NetworkSimplexPlacer/lambda$23$Type",1436),wAn(1437,1,{},Qc),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$24$Type",1437),wAn(1438,1,DVn,og),MWn.Mb=function(n){return EO(this.a,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$25$Type",1438),wAn(1439,1,lVn,eC),MWn.td=function(n){MPn(this.a,this.b,BB(n,10))},vX(I3n,"NetworkSimplexPlacer/lambda$26$Type",1439),wAn(1440,1,DVn,Yc),MWn.Mb=function(n){return BZ(),!b5(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$27$Type",1440),wAn(1441,1,DVn,Jc),MWn.Mb=function(n){return BZ(),!b5(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$28$Type",1441),wAn(1442,1,{},sg),MWn.Ce=function(n,t){return sL(this.a,BB(n,29),BB(t,29))},vX(I3n,"NetworkSimplexPlacer/lambda$29$Type",1442),wAn(1416,1,{},Zc),MWn.Kb=function(n){return BZ(),new Rq(null,new zU(new oz(ZL(lbn(BB(n,10)).a.Kc(),new h))))},vX(I3n,"NetworkSimplexPlacer/lambda$3$Type",1416),wAn(1417,1,DVn,na),MWn.Mb=function(n){return BZ(),t2(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$4$Type",1417),wAn(1418,1,lVn,hg),MWn.td=function(n){iBn(this.a,BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$5$Type",1418),wAn(1419,1,{},ta),MWn.Kb=function(n){return BZ(),new Rq(null,new w1(BB(n,29).a,16))},vX(I3n,"NetworkSimplexPlacer/lambda$6$Type",1419),wAn(1420,1,DVn,ea),MWn.Mb=function(n){return BZ(),BB(n,10).k==(uSn(),Cut)},vX(I3n,"NetworkSimplexPlacer/lambda$7$Type",1420),wAn(1421,1,{},ia),MWn.Kb=function(n){return BZ(),new Rq(null,new zU(new oz(ZL(hbn(BB(n,10)).a.Kc(),new h))))},vX(I3n,"NetworkSimplexPlacer/lambda$8$Type",1421),wAn(1422,1,DVn,ra),MWn.Mb=function(n){return BZ(),UH(BB(n,17))},vX(I3n,"NetworkSimplexPlacer/lambda$9$Type",1422),wAn(1404,1,E3n,Cf),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?Zmt:null},MWn.pf=function(n,t){kHn(BB(n,37),t)},vX(I3n,"SimpleNodePlacer",1404),wAn(180,1,{180:1},qKn),MWn.Ib=function(){var n;return n="",this.c==(gJ(),tyt)?n+=aJn:this.c==nyt&&(n+=cJn),this.o==(oZ(),ryt)?n+=pJn:this.o==cyt?n+="UP":n+="BALANCED",n},vX($3n,"BKAlignedLayout",180),wAn(516,22,{3:1,35:1,22:1,516:1},cC);var iyt,ryt,cyt,ayt=Ben($3n,"BKAlignedLayout/HDirection",516,Unt,VY,PF);wAn(515,22,{3:1,35:1,22:1,515:1},rC);var uyt,oyt,syt,hyt,fyt,lyt,byt,wyt,dyt,gyt,pyt,vyt,myt,yyt,kyt,jyt,Eyt,Tyt,Myt,Syt=Ben($3n,"BKAlignedLayout/VDirection",515,Unt,QY,CF);wAn(1634,1,{},iC),vX($3n,"BKAligner",1634),wAn(1637,1,{},Jyn),vX($3n,"BKCompactor",1637),wAn(654,1,{654:1},ca),MWn.a=0,vX($3n,"BKCompactor/ClassEdge",654),wAn(458,1,{458:1},cm),MWn.a=null,MWn.b=0,vX($3n,"BKCompactor/ClassNode",458),wAn(1407,1,E3n,jI),MWn.Yf=function(n){return BB(mMn(BB(n,37),(hWn(),Zft)),21).Hc((bDn(),lft))?oyt:null},MWn.pf=function(n,t){rWn(this,BB(n,37),t)},MWn.d=!1,vX($3n,"BKNodePlacer",1407),wAn(1635,1,{},aa),MWn.d=0,vX($3n,"NeighborhoodInformation",1635),wAn(1636,1,MYn,fg),MWn.ue=function(n,t){return Mtn(this,BB(n,46),BB(t,46))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX($3n,"NeighborhoodInformation/NeighborComparator",1636),wAn(808,1,{}),vX($3n,"ThresholdStrategy",808),wAn(1763,808,{},dm),MWn.bg=function(n,t,e){return this.a.o==(oZ(),cyt)?RQn:KQn},MWn.cg=function(){},vX($3n,"ThresholdStrategy/NullThresholdStrategy",1763),wAn(579,1,{579:1},aC),MWn.c=!1,MWn.d=!1,vX($3n,"ThresholdStrategy/Postprocessable",579),wAn(1764,808,{},gm),MWn.bg=function(n,t,e){var i,r,c;return r=t==e,i=this.a.a[e.p]==t,r||i?(c=n,this.a.c,gJ(),r&&(c=THn(this,t,!0)),!isNaN(c)&&!isFinite(c)&&i&&(c=THn(this,e,!1)),c):n},MWn.cg=function(){for(var n,t,e;0!=this.d.b;)(t=cFn(this,e=BB(PJ(this.d),579))).a&&(n=t.a,(qy(this.a.f[this.a.g[e.b.p].p])||b5(n)||n.c.i.c!=n.d.i.c)&&(b$n(this,e)||rA(this.e,e)));for(;0!=this.e.a.c.length;)b$n(this,BB(thn(this.e),579))},vX($3n,"ThresholdStrategy/SimpleThresholdStrategy",1764),wAn(635,1,{635:1,246:1,234:1},ua),MWn.Kf=function(){return Tan(this)},MWn.Xf=function(){return Tan(this)},vX(L3n,"EdgeRouterFactory",635),wAn(1458,1,E3n,If),MWn.Yf=function(n){return Uxn(BB(n,37))},MWn.pf=function(n,t){DHn(BB(n,37),t)},vX(L3n,"OrthogonalEdgeRouter",1458),wAn(1451,1,E3n,EI),MWn.Yf=function(n){return Ejn(BB(n,37))},MWn.pf=function(n,t){OUn(this,BB(n,37),t)},vX(L3n,"PolylineEdgeRouter",1451),wAn(1452,1,qYn,oa),MWn.Lb=function(n){return Qan(BB(n,10))},MWn.Fb=function(n){return this===n},MWn.Mb=function(n){return Qan(BB(n,10))},vX(L3n,"PolylineEdgeRouter/1",1452),wAn(1809,1,DVn,sa),MWn.Mb=function(n){return BB(n,129).c==(O6(),Tyt)},vX(N3n,"HyperEdgeCycleDetector/lambda$0$Type",1809),wAn(1810,1,{},ha),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$1$Type",1810),wAn(1811,1,DVn,fa),MWn.Mb=function(n){return BB(n,129).c==(O6(),Tyt)},vX(N3n,"HyperEdgeCycleDetector/lambda$2$Type",1811),wAn(1812,1,{},la),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$3$Type",1812),wAn(1813,1,{},ba),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$4$Type",1813),wAn(1814,1,{},wa),MWn.Ge=function(n){return BB(n,129).d},vX(N3n,"HyperEdgeCycleDetector/lambda$5$Type",1814),wAn(112,1,{35:1,112:1},Fan),MWn.wd=function(n){return oj(this,BB(n,112))},MWn.Fb=function(n){var t;return!!cL(n,112)&&(t=BB(n,112),this.g==t.g)},MWn.Hb=function(){return this.g},MWn.Ib=function(){var n,t,e,i;for(n=new lN("{"),i=new Wb(this.n);i.a<i.c.c.length;)null==(t=gyn((e=BB(n0(i),11)).i))&&(t="n"+AK(e.i)),n.a+=""+t,i.a<i.c.c.length&&(n.a+=",");return n.a+="}",n.a},MWn.a=0,MWn.b=0,MWn.c=NaN,MWn.d=0,MWn.g=0,MWn.i=0,MWn.o=0,MWn.s=NaN,vX(N3n,"HyperEdgeSegment",112),wAn(129,1,{129:1},zZ),MWn.Ib=function(){return this.a+"->"+this.b+" ("+wx(this.c)+")"},MWn.d=0,vX(N3n,"HyperEdgeSegmentDependency",129),wAn(520,22,{3:1,35:1,22:1,520:1},uC);var Pyt,Cyt,Iyt,Oyt,Ayt,$yt,Lyt,Nyt,xyt=Ben(N3n,"HyperEdgeSegmentDependency/DependencyType",520,Unt,WY,IF);wAn(1815,1,{},lg),vX(N3n,"HyperEdgeSegmentSplitter",1815),wAn(1816,1,{},zj),MWn.a=0,MWn.b=0,vX(N3n,"HyperEdgeSegmentSplitter/AreaRating",1816),wAn(329,1,{329:1},kB),MWn.a=0,MWn.b=0,MWn.c=0,vX(N3n,"HyperEdgeSegmentSplitter/FreeArea",329),wAn(1817,1,MYn,ja),MWn.ue=function(n,t){return OK(BB(n,112),BB(t,112))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(N3n,"HyperEdgeSegmentSplitter/lambda$0$Type",1817),wAn(1818,1,lVn,XV),MWn.td=function(n){n4(this.a,this.d,this.c,this.b,BB(n,112))},MWn.b=0,vX(N3n,"HyperEdgeSegmentSplitter/lambda$1$Type",1818),wAn(1819,1,{},Ea),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).e,16))},vX(N3n,"HyperEdgeSegmentSplitter/lambda$2$Type",1819),wAn(1820,1,{},Ta),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).j,16))},vX(N3n,"HyperEdgeSegmentSplitter/lambda$3$Type",1820),wAn(1821,1,{},Ma),MWn.Fe=function(n){return Gy(MD(n))},vX(N3n,"HyperEdgeSegmentSplitter/lambda$4$Type",1821),wAn(655,1,{},fX),MWn.a=0,MWn.b=0,MWn.c=0,vX(N3n,"OrthogonalRoutingGenerator",655),wAn(1638,1,{},Sa),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).e,16))},vX(N3n,"OrthogonalRoutingGenerator/lambda$0$Type",1638),wAn(1639,1,{},Pa),MWn.Kb=function(n){return new Rq(null,new w1(BB(n,112).j,16))},vX(N3n,"OrthogonalRoutingGenerator/lambda$1$Type",1639),wAn(661,1,{}),vX(x3n,"BaseRoutingDirectionStrategy",661),wAn(1807,661,{},pm),MWn.dg=function(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(!n.r||n.q)for(f=t+n.o*i,h=new Wb(n.n);h.a<h.c.c.length;)for(s=BB(n0(h),11),l=Aon(Pun(Gk(PMt,1),sVn,8,0,[s.i.n,s.n,s.a])).a,o=new Wb(s.g);o.a<o.c.c.length;)b5(u=BB(n0(o),17))||(d=u.d,g=Aon(Pun(Gk(PMt,1),sVn,8,0,[d.i.n,d.n,d.a])).a,e.Math.abs(l-g)>lZn&&(c=n,r=new xC(l,a=f),DH(u.a,r),F_n(this,u,c,r,!1),(b=n.r)&&(r=new xC(w=Gy(MD(Dpn(b.e,0))),a),DH(u.a,r),F_n(this,u,c,r,!1),c=b,r=new xC(w,a=t+b.o*i),DH(u.a,r),F_n(this,u,c,r,!1)),r=new xC(g,a),DH(u.a,r),F_n(this,u,c,r,!1)))},MWn.eg=function(n){return n.i.n.a+n.n.a+n.a.a},MWn.fg=function(){return kUn(),SIt},MWn.gg=function(){return kUn(),sIt},vX(x3n,"NorthToSouthRoutingStrategy",1807),wAn(1808,661,{},vm),MWn.dg=function(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(!n.r||n.q)for(f=t-n.o*i,h=new Wb(n.n);h.a<h.c.c.length;)for(s=BB(n0(h),11),l=Aon(Pun(Gk(PMt,1),sVn,8,0,[s.i.n,s.n,s.a])).a,o=new Wb(s.g);o.a<o.c.c.length;)b5(u=BB(n0(o),17))||(d=u.d,g=Aon(Pun(Gk(PMt,1),sVn,8,0,[d.i.n,d.n,d.a])).a,e.Math.abs(l-g)>lZn&&(c=n,r=new xC(l,a=f),DH(u.a,r),F_n(this,u,c,r,!1),(b=n.r)&&(r=new xC(w=Gy(MD(Dpn(b.e,0))),a),DH(u.a,r),F_n(this,u,c,r,!1),c=b,r=new xC(w,a=t-b.o*i),DH(u.a,r),F_n(this,u,c,r,!1)),r=new xC(g,a),DH(u.a,r),F_n(this,u,c,r,!1)))},MWn.eg=function(n){return n.i.n.a+n.n.a+n.a.a},MWn.fg=function(){return kUn(),sIt},MWn.gg=function(){return kUn(),SIt},vX(x3n,"SouthToNorthRoutingStrategy",1808),wAn(1806,661,{},mm),MWn.dg=function(n,t,i){var r,c,a,u,o,s,h,f,l,b,w,d,g;if(!n.r||n.q)for(f=t+n.o*i,h=new Wb(n.n);h.a<h.c.c.length;)for(s=BB(n0(h),11),l=Aon(Pun(Gk(PMt,1),sVn,8,0,[s.i.n,s.n,s.a])).b,o=new Wb(s.g);o.a<o.c.c.length;)b5(u=BB(n0(o),17))||(d=u.d,g=Aon(Pun(Gk(PMt,1),sVn,8,0,[d.i.n,d.n,d.a])).b,e.Math.abs(l-g)>lZn&&(c=n,r=new xC(a=f,l),DH(u.a,r),F_n(this,u,c,r,!0),(b=n.r)&&(r=new xC(a,w=Gy(MD(Dpn(b.e,0)))),DH(u.a,r),F_n(this,u,c,r,!0),c=b,r=new xC(a=t+b.o*i,w),DH(u.a,r),F_n(this,u,c,r,!0)),r=new xC(a,g),DH(u.a,r),F_n(this,u,c,r,!0)))},MWn.eg=function(n){return n.i.n.b+n.n.b+n.a.b},MWn.fg=function(){return kUn(),oIt},MWn.gg=function(){return kUn(),CIt},vX(x3n,"WestToEastRoutingStrategy",1806),wAn(813,1,{},oBn),MWn.Ib=function(){return LMn(this.a)},MWn.b=0,MWn.c=!1,MWn.d=!1,MWn.f=0,vX(R3n,"NubSpline",813),wAn(407,1,{407:1},Exn,wJ),vX(R3n,"NubSpline/PolarCP",407),wAn(1453,1,E3n,hyn),MWn.Yf=function(n){return rTn(BB(n,37))},MWn.pf=function(n,t){cXn(this,BB(n,37),t)},vX(R3n,"SplineEdgeRouter",1453),wAn(268,1,{268:1},S6),MWn.Ib=function(){return this.a+" ->("+this.c+") "+this.b},MWn.c=0,vX(R3n,"SplineEdgeRouter/Dependency",268),wAn(455,22,{3:1,35:1,22:1,455:1},oC);var Dyt,Ryt,Kyt,_yt,Fyt,Byt=Ben(R3n,"SplineEdgeRouter/SideToProcess",455,Unt,YY,OF);wAn(1454,1,DVn,ya),MWn.Mb=function(n){return gxn(),!BB(n,128).o},vX(R3n,"SplineEdgeRouter/lambda$0$Type",1454),wAn(1455,1,{},ma),MWn.Ge=function(n){return gxn(),BB(n,128).v+1},vX(R3n,"SplineEdgeRouter/lambda$1$Type",1455),wAn(1456,1,lVn,sC),MWn.td=function(n){iq(this.a,this.b,BB(n,46))},vX(R3n,"SplineEdgeRouter/lambda$2$Type",1456),wAn(1457,1,lVn,hC),MWn.td=function(n){rq(this.a,this.b,BB(n,46))},vX(R3n,"SplineEdgeRouter/lambda$3$Type",1457),wAn(128,1,{35:1,128:1},tCn,hqn),MWn.wd=function(n){return sj(this,BB(n,128))},MWn.b=0,MWn.e=!1,MWn.f=0,MWn.g=0,MWn.j=!1,MWn.k=!1,MWn.n=0,MWn.o=!1,MWn.p=!1,MWn.q=!1,MWn.s=0,MWn.u=0,MWn.v=0,MWn.F=0,vX(R3n,"SplineSegment",128),wAn(459,1,{459:1},ka),MWn.a=0,MWn.b=!1,MWn.c=!1,MWn.d=!1,MWn.e=!1,MWn.f=0,vX(R3n,"SplineSegment/EdgeInformation",459),wAn(1234,1,{},da),vX(H3n,iZn,1234),wAn(1235,1,MYn,ga),MWn.ue=function(n,t){return IIn(BB(n,135),BB(t,135))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(H3n,rZn,1235),wAn(1233,1,{},AE),vX(H3n,"MrTree",1233),wAn(393,22,{3:1,35:1,22:1,393:1,246:1,234:1},fC),MWn.Kf=function(){return AIn(this)},MWn.Xf=function(){return AIn(this)};var Hyt,qyt=Ben(H3n,"TreeLayoutPhases",393,Unt,j3,AF);wAn(1130,209,NJn,_R),MWn.Ze=function(n,t){var e,i,r,c,a,u;for(qy(TD(ZAn(n,(CAn(),Ckt))))||jJ(new Tw((GM(),new Dy(n)))),qan(a=new P6,n),hon(a,(qqn(),skt),n),v_n(n,a,u=new xp),W_n(n,a,u),c=a,i=new Wb(r=x_n(this.a,c));i.a<i.c.c.length;)e=BB(n0(i),135),WEn(this.b,e,mcn(t,1/r.c.length));Izn(c=tWn(r))},vX(H3n,"TreeLayoutProvider",1130),wAn(1847,1,pVn,pa),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return SQ(),LT(),bet},vX(H3n,"TreeUtil/1",1847),wAn(1848,1,pVn,va),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return SQ(),LT(),bet},vX(H3n,"TreeUtil/2",1848),wAn(502,134,{3:1,502:1,94:1,134:1}),MWn.g=0,vX(q3n,"TGraphElement",502),wAn(188,502,{3:1,188:1,502:1,94:1,134:1},UQ),MWn.Ib=function(){return this.b&&this.c?g0(this.b)+"->"+g0(this.c):"e_"+nsn(this)},vX(q3n,"TEdge",188),wAn(135,134,{3:1,135:1,94:1,134:1},P6),MWn.Ib=function(){var n,t,e,i,r;for(r=null,i=spn(this.b,0);i.b!=i.d.c;)r+=(null==(e=BB(b3(i),86)).c||0==e.c.length?"n_"+e.g:"n_"+e.c)+"\n";for(t=spn(this.a,0);t.b!=t.d.c;)r+=((n=BB(b3(t),188)).b&&n.c?g0(n.b)+"->"+g0(n.c):"e_"+nsn(n))+"\n";return r};var Gyt=vX(q3n,"TGraph",135);wAn(633,502,{3:1,502:1,633:1,94:1,134:1}),vX(q3n,"TShape",633),wAn(86,633,{3:1,502:1,86:1,633:1,94:1,134:1},csn),MWn.Ib=function(){return g0(this)};var zyt,Uyt,Xyt,Wyt,Vyt,Qyt,Yyt=vX(q3n,"TNode",86);wAn(255,1,pVn,bg),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return new wg(spn(this.a.d,0))},vX(q3n,"TNode/2",255),wAn(358,1,QWn,wg),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(b3(this.a),188).c},MWn.Ob=function(){return EE(this.a)},MWn.Qb=function(){mtn(this.a)},vX(q3n,"TNode/2/1",358),wAn(1840,1,n1n,KR),MWn.pf=function(n,t){xFn(this,BB(n,135),t)},vX(G3n,"FanProcessor",1840),wAn(327,22,{3:1,35:1,22:1,327:1,234:1},lC),MWn.Kf=function(){switch(this.g){case 0:return new Qm;case 1:return new KR;case 2:return new Oa;case 3:return new Ca;case 4:return new $a;case 5:return new La;default:throw Hp(new _y(M1n+(null!=this.f?this.f:""+this.g)))}};var Jyt,Zyt,nkt,tkt,ekt,ikt,rkt,ckt,akt,ukt,okt,skt,hkt,fkt,lkt,bkt,wkt,dkt,gkt,pkt,vkt,mkt,ykt,kkt,jkt,Ekt,Tkt,Mkt,Skt,Pkt,Ckt,Ikt,Okt,Akt,$kt,Lkt,Nkt,xkt,Dkt,Rkt,Kkt,_kt=Ben(G3n,S1n,327,Unt,r9,$F);wAn(1843,1,n1n,Ca),MWn.pf=function(n,t){u$n(this,BB(n,135),t)},MWn.a=0,vX(G3n,"LevelHeightProcessor",1843),wAn(1844,1,pVn,Ia),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return SQ(),LT(),bet},vX(G3n,"LevelHeightProcessor/1",1844),wAn(1841,1,n1n,Oa),MWn.pf=function(n,t){QPn(this,BB(n,135),t)},MWn.a=0,vX(G3n,"NeighborsProcessor",1841),wAn(1842,1,pVn,Aa),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return SQ(),LT(),bet},vX(G3n,"NeighborsProcessor/1",1842),wAn(1845,1,n1n,$a),MWn.pf=function(n,t){a$n(this,BB(n,135),t)},MWn.a=0,vX(G3n,"NodePositionProcessor",1845),wAn(1839,1,n1n,Qm),MWn.pf=function(n,t){ZHn(this,BB(n,135))},vX(G3n,"RootProcessor",1839),wAn(1846,1,n1n,La),MWn.pf=function(n,t){dln(BB(n,135))},vX(G3n,"Untreeifyer",1846),wAn(851,1,QYn,Pf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X3n),""),"Weighting of Nodes"),"Which weighting to use when computing a node order."),kkt),(PPn(),gMt)),qkt),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W3n),""),"Search Order"),"Which search order to use when computing a spanning tree."),mkt),gMt),Jkt),nbn(hMt)))),KGn((new Sf,n))},vX(V3n,"MrTreeMetaDataProvider",851),wAn(994,1,QYn,Sf),MWn.Qe=function(n){KGn(n)},vX(V3n,"MrTreeOptions",994),wAn(995,1,{},Na),MWn.$e=function(){return new _R},MWn._e=function(n){},vX(V3n,"MrTreeOptions/MrtreeFactory",995),wAn(480,22,{3:1,35:1,22:1,480:1},bC);var Fkt,Bkt,Hkt,qkt=Ben(V3n,"OrderWeighting",480,Unt,ZY,LF);wAn(425,22,{3:1,35:1,22:1,425:1},wC);var Gkt,zkt,Ukt,Xkt,Wkt,Vkt,Qkt,Ykt,Jkt=Ben(V3n,"TreeifyingOrder",425,Unt,JY,xF);wAn(1459,1,E3n,pf),MWn.Yf=function(n){return BB(n,135),zkt},MWn.pf=function(n,t){ycn(this,BB(n,135),t)},vX("org.eclipse.elk.alg.mrtree.p1treeify","DFSTreeifyer",1459),wAn(1460,1,E3n,vf),MWn.Yf=function(n){return BB(n,135),Ukt},MWn.pf=function(n,t){fCn(this,BB(n,135),t)},vX("org.eclipse.elk.alg.mrtree.p2order","NodeOrderer",1460),wAn(1461,1,E3n,gf),MWn.Yf=function(n){return BB(n,135),Xkt},MWn.pf=function(n,t){nRn(this,BB(n,135),t)},MWn.a=0,vX("org.eclipse.elk.alg.mrtree.p3place","NodePlacer",1461),wAn(1462,1,E3n,mf),MWn.Yf=function(n){return BB(n,135),Wkt},MWn.pf=function(n,t){xkn(BB(n,135),t)},vX("org.eclipse.elk.alg.mrtree.p4route","EdgeRouter",1462),wAn(495,22,{3:1,35:1,22:1,495:1,246:1,234:1},dC),MWn.Kf=function(){return bwn(this)},MWn.Xf=function(){return bwn(this)};var Zkt,njt,tjt,ejt,ijt=Ben(J3n,"RadialLayoutPhases",495,Unt,nJ,NF);wAn(1131,209,NJn,OE),MWn.Ze=function(n,t){var e,i,r;if(OTn(t,"Radial layout",ECn(this,n).c.length),qy(TD(ZAn(n,(Uyn(),Ajt))))||jJ(new Tw((GM(),new Dy(n)))),r=uTn(n),Ypn(n,(wD(),Vkt),r),!r)throw Hp(new _y("The given graph is not a tree!"));for(0==(e=Gy(MD(ZAn(n,Djt))))&&(e=fIn(n)),Ypn(n,Djt,e),i=new Wb(ECn(this,n));i.a<i.c.c.length;)BB(n0(i),51).pf(n,mcn(t,1));HSn(t)},vX(J3n,"RadialLayoutProvider",1131),wAn(549,1,MYn,IE),MWn.ue=function(n,t){return DRn(this.a,this.b,BB(n,33),BB(t,33))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},MWn.a=0,MWn.b=0,vX(J3n,"RadialUtil/lambda$0$Type",549),wAn(1375,1,n1n,Da),MWn.pf=function(n,t){dGn(BB(n,33),t)},vX(t4n,"CalculateGraphSize",1375),wAn(442,22,{3:1,35:1,22:1,442:1,234:1},gC),MWn.Kf=function(){switch(this.g){case 0:return new Ba;case 1:return new xa;case 2:return new Da;default:throw Hp(new _y(M1n+(null!=this.f?this.f:""+this.g)))}};var rjt,cjt,ajt,ujt=Ben(t4n,S1n,442,Unt,R1,DF);wAn(645,1,{}),MWn.e=1,MWn.g=0,vX(e4n,"AbstractRadiusExtensionCompaction",645),wAn(1772,645,{},gD),MWn.hg=function(n){var t,e,i,r,c,a,u,o,s;for(this.c=BB(ZAn(n,(wD(),Vkt)),33),eb(this,this.c),this.d=Evn(BB(ZAn(n,(Uyn(),Rjt)),293)),(o=BB(ZAn(n,Mjt),19))&&tb(this,o.a),ib(this,(kW(u=MD(ZAn(n,(sWn(),LPt)))),u)),s=wDn(this.c),this.d&&this.d.lg(s),vKn(this,s),a=new Jy(Pun(Gk(UOt,1),i4n,33,0,[this.c])),e=0;e<2;e++)for(t=0;t<s.c.length;t++)r=new Jy(Pun(Gk(UOt,1),i4n,33,0,[(l1(t,s.c.length),BB(s.c[t],33))])),c=t<s.c.length-1?(l1(t+1,s.c.length),BB(s.c[t+1],33)):(l1(0,s.c.length),BB(s.c[0],33)),i=0==t?BB(xq(s,s.c.length-1),33):(l1(t-1,s.c.length),BB(s.c[t-1],33)),ZTn(this,(l1(t,s.c.length),BB(s.c[t],33),a),i,c,r)},vX(e4n,"AnnulusWedgeCompaction",1772),wAn(1374,1,n1n,xa),MWn.pf=function(n,t){bjn(BB(n,33),t)},vX(e4n,"GeneralCompactor",1374),wAn(1771,645,{},Ra),MWn.hg=function(n){var t,e,i,r;e=BB(ZAn(n,(wD(),Vkt)),33),this.f=e,this.b=Evn(BB(ZAn(n,(Uyn(),Rjt)),293)),(r=BB(ZAn(n,Mjt),19))&&tb(this,r.a),ib(this,(kW(i=MD(ZAn(n,(sWn(),LPt)))),i)),t=wDn(e),this.b&&this.b.lg(t),vPn(this,t)},MWn.a=0,vX(e4n,"RadialCompaction",1771),wAn(1779,1,{},Ka),MWn.ig=function(n){var t,e,i,r,c,a;for(this.a=n,t=0,i=0,c=new Wb(a=wDn(n));c.a<c.c.c.length;)for(r=BB(n0(c),33),e=++i;e<a.c.length;e++)YFn(this,r,(l1(e,a.c.length),BB(a.c[e],33)))&&(t+=1);return t},vX(r4n,"CrossingMinimizationPosition",1779),wAn(1777,1,{},_a),MWn.ig=function(n){var t,i,r,c,a,u,o,s,f,l,b,w,d;for(r=0,i=new oz(ZL(dLn(n).a.Kc(),new h));dAn(i);)t=BB(U5(i),79),f=(o=PTn(BB(Wtn((!t.c&&(t.c=new hK(KOt,t,5,8)),t.c),0),82))).i+o.g/2,l=o.j+o.f/2,c=n.i+n.g/2,a=n.j+n.f/2,(b=new Gj).a=f-c,b.b=l-a,Ukn(u=new xC(b.a,b.b),n.g,n.f),b.a-=u.a,b.b-=u.b,c=f-b.a,a=l-b.b,Ukn(s=new xC(b.a,b.b),o.g,o.f),b.a-=s.a,b.b-=s.b,w=(f=c+b.a)-c,d=(l=a+b.b)-a,r+=e.Math.sqrt(w*w+d*d);return r},vX(r4n,"EdgeLengthOptimization",1777),wAn(1778,1,{},Fa),MWn.ig=function(n){var t,i,r,c,a,u,o,s,f;for(r=0,i=new oz(ZL(dLn(n).a.Kc(),new h));dAn(i);)t=BB(U5(i),79),u=(a=PTn(BB(Wtn((!t.c&&(t.c=new hK(KOt,t,5,8)),t.c),0),82))).i+a.g/2,o=a.j+a.f/2,c=BB(ZAn(a,(sWn(),gPt)),8),s=u-(n.i+c.a+n.g/2),f=o-(n.j+c.b+n.f),r+=e.Math.sqrt(s*s+f*f);return r},vX(r4n,"EdgeLengthPositionOptimization",1778),wAn(1373,645,n1n,Ba),MWn.pf=function(n,t){fLn(this,BB(n,33),t)},vX("org.eclipse.elk.alg.radial.intermediate.overlaps","RadiusExtensionOverlapRemoval",1373),wAn(426,22,{3:1,35:1,22:1,426:1},pC);var ojt,sjt,hjt,fjt,ljt=Ben(a4n,"AnnulusWedgeCriteria",426,Unt,tJ,RF);wAn(380,22,{3:1,35:1,22:1,380:1},vC);var bjt,wjt,djt,gjt,pjt,vjt,mjt,yjt,kjt,jjt,Ejt,Tjt,Mjt,Sjt,Pjt,Cjt,Ijt,Ojt,Ajt,$jt,Ljt,Njt,xjt,Djt,Rjt,Kjt,_jt,Fjt,Bjt,Hjt,qjt,Gjt=Ben(a4n,FJn,380,Unt,K1,KF);wAn(852,1,QYn,yf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u4n),""),"Order ID"),"The id can be used to define an order for nodes of one radius. This can be used to sort them in the layer accordingly."),iln(0)),(PPn(),vMt)),Att),nbn((rpn(),sMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o4n),""),"Radius"),"The radius option can be used to set the initial radius for the radial layouter."),0),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s4n),""),"Compaction"),"With the compacter option it can be determined how compaction on the graph is done. It can be chosen between none, the radial compaction or the compaction of wedges separately."),gjt),gMt),Gjt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,h4n),""),"Compaction Step Size"),"Determine the size of steps with which the compaction is done. Step size 1 correlates to a compaction of 1 pixel per Iteration."),iln(1)),vMt),Att),nbn(hMt)))),a2(n,h4n,s4n,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,f4n),""),"Sorter"),"Sort the nodes per radius according to the sorting algorithm. The strategies are none, by the given order id, or sorting them by polar coordinates."),jjt),gMt),Yjt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,l4n),""),"Annulus Wedge Criteria"),"Determine how the wedge for the node placement is calculated. It can be chosen between wedge determination by the number of leaves or by the maximum sum of diagonals."),Tjt),gMt),ljt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,b4n),""),"Translation Optimization"),"Find the optimal translation of the nodes of the first radii according to this criteria. For example edge crossings can be minimized."),vjt),gMt),Vjt),nbn(hMt)))),tUn((new kf,n))},vX(a4n,"RadialMetaDataProvider",852),wAn(996,1,QYn,kf),MWn.Qe=function(n){tUn(n)},vX(a4n,"RadialOptions",996),wAn(997,1,{},Ha),MWn.$e=function(){return new OE},MWn._e=function(n){},vX(a4n,"RadialOptions/RadialFactory",997),wAn(340,22,{3:1,35:1,22:1,340:1},mC);var zjt,Ujt,Xjt,Wjt,Vjt=Ben(a4n,"RadialTranslationStrategy",340,Unt,E3,_F);wAn(293,22,{3:1,35:1,22:1,293:1},yC);var Qjt,Yjt=Ben(a4n,"SortingStrategy",293,Unt,F1,FF);wAn(1449,1,E3n,qa),MWn.Yf=function(n){return BB(n,33),null},MWn.pf=function(n,t){SLn(this,BB(n,33),t)},MWn.c=0,vX("org.eclipse.elk.alg.radial.p1position","EadesRadial",1449),wAn(1775,1,{},Ga),MWn.jg=function(n){return Upn(n)},vX(d4n,"AnnulusWedgeByLeafs",1775),wAn(1776,1,{},za),MWn.jg=function(n){return VEn(this,n)},vX(d4n,"AnnulusWedgeByNodeSpace",1776),wAn(1450,1,E3n,Ua),MWn.Yf=function(n){return BB(n,33),null},MWn.pf=function(n,t){bEn(this,BB(n,33),t)},vX("org.eclipse.elk.alg.radial.p2routing","StraightLineEdgeRouter",1450),wAn(811,1,{},Jm),MWn.kg=function(n){},MWn.lg=function(n){nv(this,n)},vX(g4n,"IDSorter",811),wAn(1774,1,MYn,Xa),MWn.ue=function(n,t){return Qrn(BB(n,33),BB(t,33))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(g4n,"IDSorter/lambda$0$Type",1774),wAn(1773,1,{},Arn),MWn.kg=function(n){c2(this,n)},MWn.lg=function(n){n.dc()||(this.e||c2(this,nG(BB(n.Xb(0),33))),nv(this.e,n))},vX(g4n,"PolarCoordinateSorter",1773),wAn(1136,209,NJn,Wa),MWn.Ze=function(n,t){var i,r,c,a,u,o,s,h,f,l,b,w,d,g,p,v,m,y,k,j,E,T;if(OTn(t,"Rectangle Packing",1),t.n&&t.n&&n&&y0(t,o2(n),(Bsn(),uOt)),i=Gy(MD(ZAn(n,(W$n(),lEt)))),w=BB(ZAn(n,PEt),381),p=qy(TD(ZAn(n,yEt))),y=qy(TD(ZAn(n,SEt))),f=qy(TD(ZAn(n,gEt))),k=BB(ZAn(n,CEt),116),m=Gy(MD(ZAn(n,$Et))),r=qy(TD(ZAn(n,AEt))),l=qy(TD(ZAn(n,pEt))),g=qy(TD(ZAn(n,vEt))),T=Gy(MD(ZAn(n,LEt))),!n.a&&(n.a=new eU(UOt,n,10,11)),Trn(E=n.a),g){for(b=new Np,o=new AL(E);o.e!=o.i.gc();)P8(a=BB(kpn(o),33),dEt)&&(b.c[b.c.length]=a);for(s=new Wb(b);s.a<s.c.c.length;)snn(E,a=BB(n0(s),33));for(SQ(),m$(b,new Va),h=new Wb(b);h.a<h.c.c.length;)a=BB(n0(h),33),j=BB(ZAn(a,dEt),19).a,sln(E,j=e.Math.min(j,E.i),a);for(d=0,u=new AL(E);u.e!=u.i.gc();)Ypn(a=BB(kpn(u),33),wEt,iln(d)),++d}(v=XPn(n)).a-=k.b+k.c,v.b-=k.d+k.a,v.a,T<0||T<v.a?(c=OKn(new jB(i,w,p),E,m,k),t.n&&t.n&&n&&y0(t,o2(n),(Bsn(),uOt))):c=new eq(i,T,0,(YLn(),_Et)),v.a+=k.b+k.c,v.b+=k.d+k.a,y||(Trn(E),c=kzn(new m3(i,f,l,r,m),E,e.Math.max(v.a,c.c),v,t,n,k)),pan(E,k),KUn(n,c.c+(k.b+k.c),c.b+(k.d+k.a),!1,!0),qy(TD(ZAn(n,MEt)))||jJ(new Tw((GM(),new Dy(n)))),t.n&&t.n&&n&&y0(t,o2(n),(Bsn(),uOt)),HSn(t)},vX(y4n,"RectPackingLayoutProvider",1136),wAn(1137,1,MYn,Va),MWn.ue=function(n,t){return wsn(BB(n,33),BB(t,33))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y4n,"RectPackingLayoutProvider/lambda$0$Type",1137),wAn(1256,1,{},jB),MWn.a=0,MWn.c=!1,vX(k4n,"AreaApproximation",1256);var Jjt,Zjt,nEt,tEt=bq(k4n,"BestCandidateFilter");wAn(638,1,{526:1},Qa),MWn.mg=function(n,t,i){var r,c,a,u,o,s;for(s=new Np,a=RQn,o=new Wb(n);o.a<o.c.c.length;)u=BB(n0(o),220),a=e.Math.min(a,(u.c+(i.b+i.c))*(u.b+(i.d+i.a)));for(c=new Wb(n);c.a<c.c.c.length;)((r=BB(n0(c),220)).c+(i.b+i.c))*(r.b+(i.d+i.a))==a&&(s.c[s.c.length]=r);return s},vX(k4n,"AreaFilter",638),wAn(639,1,{526:1},Ya),MWn.mg=function(n,t,i){var r,c,a,u,o,s;for(o=new Np,s=RQn,u=new Wb(n);u.a<u.c.c.length;)a=BB(n0(u),220),s=e.Math.min(s,e.Math.abs((a.c+(i.b+i.c))/(a.b+(i.d+i.a))-t));for(c=new Wb(n);c.a<c.c.c.length;)r=BB(n0(c),220),e.Math.abs((r.c+(i.b+i.c))/(r.b+(i.d+i.a))-t)==s&&(o.c[o.c.length]=r);return o},vX(k4n,"AspectRatioFilter",639),wAn(637,1,{526:1},Ja),MWn.mg=function(n,t,i){var r,c,a,u,o,s;for(s=new Np,a=KQn,o=new Wb(n);o.a<o.c.c.length;)u=BB(n0(o),220),a=e.Math.max(a,Yq(u.c+(i.b+i.c),u.b+(i.d+i.a),u.a));for(c=new Wb(n);c.a<c.c.c.length;)Yq((r=BB(n0(c),220)).c+(i.b+i.c),r.b+(i.d+i.a),r.a)==a&&(s.c[s.c.length]=r);return s},vX(k4n,"ScaleMeasureFilter",637),wAn(381,22,{3:1,35:1,22:1,381:1},kC);var eEt,iEt,rEt,cEt,aEt,uEt,oEt,sEt,hEt,fEt,lEt,bEt,wEt,dEt,gEt,pEt,vEt,mEt,yEt,kEt,jEt,EEt,TEt,MEt,SEt,PEt,CEt,IEt,OEt,AEt,$Et,LEt,NEt=Ben(j4n,"OptimizationGoal",381,Unt,_1,BF);wAn(856,1,QYn,Of),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,E4n),""),"Optimization Goal"),"Optimization goal for approximation of the bounding box given by the first iteration. Determines whether layout is sorted by the maximum scaling, aspect ratio, or area. Depending on the strategy the aspect ratio might be nearly ignored."),sEt),(PPn(),gMt)),NEt),nbn((rpn(),sMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,T4n),""),"Shift Last Placed."),"When placing a rectangle behind or below the last placed rectangle in the first iteration, it is sometimes possible to shift the rectangle further to the left or right, resulting in less whitespace. True (default) enables the shift and false disables it. Disabling the shift produces a greater approximated area by the first iteration and a layout, when using ONLY the first iteration (default not the case), where it is sometimes impossible to implement a size transformation of rectangles that will fill the bounding box and eliminate empty spaces."),(hN(),!0)),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,M4n),""),"Current position of a node in the order of nodes"),"The rectangles are ordered. Normally according to their definition the the model. This option specifies the current position of a node."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,S4n),""),"Desired index of node"),"The rectangles are ordered. Normally according to their definition the the model. This option allows to specify a desired position that has preference over the original position."),iln(-1)),vMt),Att),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,P4n),""),"Only Area Approximation"),"If enabled only the width approximation step is executed and the nodes are placed accordingly. The nodes are layouted according to the packingStrategy. If set to true not expansion of nodes is taking place."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,C4n),""),"Compact Rows"),"Enables compaction. Compacts blocks if they do not use the full height of the row. This option allows to have a smaller drawing. If this option is disabled all nodes are placed next to each other in rows."),!0),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,I4n),""),"Fit Aspect Ratio"),"Expands nodes if expandNodes is true to fit the aspect ratio instead of only in their bounds. The option is only useful if the used packingStrategy is ASPECT_RATIO_DRIVEN, otherwise this may result in unreasonable ndoe expansion."),!1),wMt),ktt),nbn(sMt)))),a2(n,I4n,A4n,null),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,O4n),""),"Target Width"),"Option to place the rectangles in the given target width instead of approximating the width using the desired aspect ratio. The padding is not included in this. Meaning a drawing will have width of targetwidth + horizontal padding."),-1),dMt),Ptt),nbn(sMt)))),NXn((new Af,n))},vX(j4n,"RectPackingMetaDataProvider",856),wAn(1004,1,QYn,Af),MWn.Qe=function(n){NXn(n)},vX(j4n,"RectPackingOptions",1004),wAn(1005,1,{},Za),MWn.$e=function(){return new Wa},MWn._e=function(n){},vX(j4n,"RectPackingOptions/RectpackingFactory",1005),wAn(1257,1,{},m3),MWn.a=0,MWn.b=!1,MWn.c=0,MWn.d=0,MWn.e=!1,MWn.f=!1,MWn.g=0,vX("org.eclipse.elk.alg.rectpacking.seconditeration","RowFillingAndCompaction",1257),wAn(187,1,{187:1},asn),MWn.a=0,MWn.c=!1,MWn.d=0,MWn.e=0,MWn.f=0,MWn.g=0,MWn.i=0,MWn.k=!1,MWn.o=RQn,MWn.p=RQn,MWn.r=0,MWn.s=0,MWn.t=0,vX(L4n,"Block",187),wAn(211,1,{211:1},RJ),MWn.a=0,MWn.b=0,MWn.d=0,MWn.e=0,MWn.f=0,vX(L4n,"BlockRow",211),wAn(443,1,{443:1},KJ),MWn.b=0,MWn.c=0,MWn.d=0,MWn.e=0,MWn.f=0,vX(L4n,"BlockStack",443),wAn(220,1,{220:1},eq,awn),MWn.a=0,MWn.b=0,MWn.c=0,MWn.d=0,MWn.e=0;var xEt,DEt,REt,KEt,_Et,FEt=vX(L4n,"DrawingData",220);wAn(355,22,{3:1,35:1,22:1,355:1},jC);var BEt,HEt,qEt,GEt,zEt=Ben(L4n,"DrawingDataDescriptor",355,Unt,N5,HF);wAn(200,1,{200:1},x0),MWn.b=0,MWn.c=0,MWn.e=0,MWn.f=0,vX(L4n,"RectRow",200),wAn(756,1,{},Ehn),MWn.j=0,vX(x4n,g1n,756),wAn(1245,1,{},nu),MWn.Je=function(n){return W8(n.a,n.b)},vX(x4n,p1n,1245),wAn(1246,1,{},dg),MWn.Je=function(n){return p6(this.a,n)},vX(x4n,v1n,1246),wAn(1247,1,{},gg),MWn.Je=function(n){return Opn(this.a,n)},vX(x4n,m1n,1247),wAn(1248,1,{},pg),MWn.Je=function(n){return uon(this.a,n)},vX(x4n,"ElkGraphImporter/lambda$3$Type",1248),wAn(1249,1,{},vg),MWn.Je=function(n){return iOn(this.a,n)},vX(x4n,y1n,1249),wAn(1133,209,NJn,$E),MWn.Ze=function(n,t){var e,i,r,c,a,u,o,s,h,f;for(P8(n,(MMn(),kTt))&&(f=SD(ZAn(n,(Bvn(),qTt))),(c=XRn(cin(),f))&&BB(sJ(c.f),209).Ze(n,mcn(t,1))),Ypn(n,gTt,($6(),ZEt)),Ypn(n,pTt,($Sn(),cTt)),Ypn(n,vTt,(Lun(),WTt)),a=BB(ZAn(n,(Bvn(),_Tt)),19).a,OTn(t,"Overlap removal",1),qy(TD(ZAn(n,KTt))),o=new mg(u=new Rv),e=GXn(i=new Ehn,n),s=!0,r=0;r<a&&s;){if(qy(TD(ZAn(n,FTt)))){if(u.a.$b(),HPn(new I$(o),e.i),0==u.a.gc())break;e.e=u}for(h2(this.b),CU(this.b,(Pbn(),HEt),(OM(),GTt)),CU(this.b,qEt,e.g),CU(this.b,GEt,(IM(),QEt)),this.a=$qn(this.b,e),h=new Wb(this.a);h.a<h.c.c.length;)BB(n0(h),51).pf(e,mcn(t,1));cjn(i,e),s=qy(TD(mMn(e,(Xcn(),Yrt)))),++r}DGn(i,e),HSn(t)},vX(x4n,"OverlapRemovalLayoutProvider",1133),wAn(1134,1,{},mg),vX(x4n,"OverlapRemovalLayoutProvider/lambda$0$Type",1134),wAn(437,22,{3:1,35:1,22:1,437:1},EC);var UEt,XEt,WEt=Ben(x4n,"SPOrEPhases",437,Unt,B1,qF);wAn(1255,1,{},LE),vX(x4n,"ShrinkTree",1255),wAn(1135,209,NJn,Zm),MWn.Ze=function(n,t){var e,i,r,c;P8(n,(MMn(),kTt))&&(c=SD(ZAn(n,kTt)),(r=XRn(cin(),c))&&BB(sJ(r.f),209).Ze(n,mcn(t,1))),e=GXn(i=new Ehn,n),$Ln(this.a,e,mcn(t,1)),DGn(i,e)},vX(x4n,"ShrinkTreeLayoutProvider",1135),wAn(300,134,{3:1,300:1,94:1,134:1},DJ),MWn.c=!1,vX("org.eclipse.elk.alg.spore.graph","Graph",300),wAn(482,22,{3:1,35:1,22:1,482:1,246:1,234:1},LM),MWn.Kf=function(){return esn(this)},MWn.Xf=function(){return esn(this)};var VEt,QEt,YEt=Ben(D4n,FJn,482,Unt,KV,GF);wAn(551,22,{3:1,35:1,22:1,551:1,246:1,234:1},vD),MWn.Kf=function(){return new ru},MWn.Xf=function(){return new ru};var JEt,ZEt,nTt,tTt=Ben(D4n,"OverlapRemovalStrategy",551,Unt,_V,zF);wAn(430,22,{3:1,35:1,22:1,430:1},TC);var eTt,iTt,rTt,cTt,aTt,uTt,oTt=Ben(D4n,"RootSelection",430,Unt,iJ,UF);wAn(316,22,{3:1,35:1,22:1,316:1},MC);var sTt,hTt,fTt,lTt,bTt,wTt,dTt,gTt,pTt,vTt,mTt,yTt,kTt,jTt,ETt,TTt,MTt,STt,PTt,CTt,ITt,OTt,ATt,$Tt,LTt,NTt,xTt,DTt,RTt,KTt,_Tt,FTt,BTt,HTt,qTt,GTt,zTt=Ben(D4n,"SpanningTreeCostFunction",316,Unt,A5,XF);wAn(1002,1,QYn,Ef),MWn.Qe=function(n){yHn(n)},vX(D4n,"SporeCompactionOptions",1002),wAn(1003,1,{},tu),MWn.$e=function(){return new Zm},MWn._e=function(n){},vX(D4n,"SporeCompactionOptions/SporeCompactionFactory",1003),wAn(855,1,QYn,Tf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,K4n),""),"Underlying Layout Algorithm"),"A layout algorithm that is applied to the graph before it is compacted. If this is null, nothing is applied before compaction."),(PPn(),yMt)),Qtt),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,q4n),"structure"),"Structure Extraction Strategy"),"This option defines what kind of triangulation or other partitioning of the plane is applied to the vertices."),DTt),gMt),VTt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,_4n),W4n),"Tree Construction Strategy"),"Whether a minimum spanning tree or a maximum spanning tree should be constructed."),NTt),gMt),YTt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,F4n),W4n),"Cost Function for Spanning Tree"),"The cost function is used in the creation of the spanning tree."),$Tt),gMt),zTt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,B4n),W4n),"Root node for spanning tree construction"),"The identifier of the node that is preferred as the root of the spanning tree. If this is null, the first node is chosen."),null),yMt),Qtt),nbn(hMt)))),a2(n,B4n,H4n,CTt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,H4n),W4n),"Root selection for spanning tree"),"This sets the method used to select a root node for the construction of a spanning tree"),OTt),gMt),oTt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,G4n),E2n),"Compaction Strategy"),"This option defines how the compaction is applied."),ETt),gMt),YEt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,z4n),E2n),"Orthogonal Compaction"),"Restricts the translation of nodes to orthogonal directions in the compaction phase."),(hN(),!1)),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U4n),V4n),"Upper limit for iterations of overlap removal"),null),iln(64)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X4n),V4n),"Whether to run a supplementary scanline overlap check."),null),!0),wMt),ktt),nbn(hMt)))),AKn((new Mf,n)),yHn((new Ef,n))},vX(D4n,"SporeMetaDataProvider",855),wAn(VVn,1,QYn,Mf),MWn.Qe=function(n){AKn(n)},vX(D4n,"SporeOverlapRemovalOptions",VVn),wAn(1001,1,{},eu),MWn.$e=function(){return new $E},MWn._e=function(n){},vX(D4n,"SporeOverlapRemovalOptions/SporeOverlapFactory",1001),wAn(530,22,{3:1,35:1,22:1,530:1,246:1,234:1},XW),MWn.Kf=function(){return isn(this)},MWn.Xf=function(){return isn(this)};var UTt,XTt,WTt,VTt=Ben(D4n,"StructureExtractionStrategy",530,Unt,FV,WF);wAn(429,22,{3:1,35:1,22:1,429:1,246:1,234:1},SC),MWn.Kf=function(){return wwn(this)},MWn.Xf=function(){return wwn(this)};var QTt,YTt=Ben(D4n,"TreeConstructionStrategy",429,Unt,eJ,VF);wAn(1443,1,E3n,iu),MWn.Yf=function(n){return BB(n,300),new B2},MWn.pf=function(n,t){Tjn(BB(n,300),t)},vX(Y4n,"DelaunayTriangulationPhase",1443),wAn(1444,1,lVn,yg),MWn.td=function(n){WB(this.a,BB(n,65).a)},vX(Y4n,"DelaunayTriangulationPhase/lambda$0$Type",1444),wAn(783,1,E3n,Vm),MWn.Yf=function(n){return BB(n,300),new B2},MWn.pf=function(n,t){this.ng(BB(n,300),t)},MWn.ng=function(n,t){var e;OTn(t,"Minimum spanning tree construction",1),e=n.d?n.d.a:BB(xq(n.i,0),65).a,Kun(this,(qy(TD(mMn(n,(Xcn(),Qrt)))),YHn(n.e,e,n.b)),n),HSn(t)},vX(J4n,"MinSTPhase",783),wAn(1446,783,E3n,ym),MWn.ng=function(n,t){var e,i;OTn(t,"Maximum spanning tree construction",1),e=new kg(n),i=n.d?n.d.c:BB(xq(n.i,0),65).c,Kun(this,(qy(TD(mMn(n,(Xcn(),Qrt)))),YHn(n.e,i,e)),n),HSn(t)},vX(J4n,"MaxSTPhase",1446),wAn(1447,1,{},kg),MWn.Je=function(n){return IC(this.a,n)},vX(J4n,"MaxSTPhase/lambda$0$Type",1447),wAn(1445,1,lVn,jg),MWn.td=function(n){R$(this.a,BB(n,65))},vX(J4n,"MinSTPhase/lambda$0$Type",1445),wAn(785,1,E3n,ru),MWn.Yf=function(n){return BB(n,300),new B2},MWn.pf=function(n,t){WTn(this,BB(n,300),t)},MWn.a=!1,vX(Z4n,"GrowTreePhase",785),wAn(786,1,lVn,EB),MWn.td=function(n){eun(this.a,this.b,this.c,BB(n,221))},vX(Z4n,"GrowTreePhase/lambda$0$Type",786),wAn(1448,1,E3n,cu),MWn.Yf=function(n){return BB(n,300),new B2},MWn.pf=function(n,t){tmn(this,BB(n,300),t)},vX(Z4n,"ShrinkTreeCompactionPhase",1448),wAn(784,1,lVn,TB),MWn.td=function(n){lAn(this.a,this.b,this.c,BB(n,221))},vX(Z4n,"ShrinkTreeCompactionPhase/lambda$0$Type",784);var JTt,ZTt,nMt=bq(y3n,"IGraphElementVisitor");wAn(860,1,{527:1},R0),MWn.og=function(n){var t;qan(t=hRn(this,n),BB(RX(this.b,n),94)),yLn(this,n,t)},vX(xJn,"LayoutConfigurator",860);var tMt,eMt,iMt,rMt=bq(xJn,"LayoutConfigurator/IPropertyHolderOptionFilter");wAn(932,1,{1933:1},au),MWn.pg=function(n,t){return Nun(),!n.Xe(t)},vX(xJn,"LayoutConfigurator/lambda$0$Type",932),wAn(933,1,{1933:1},uu),MWn.pg=function(n,t){return SE(n,t)},vX(xJn,"LayoutConfigurator/lambda$1$Type",933),wAn(931,1,{831:1},ou),MWn.qg=function(n,t){return Nun(),!n.Xe(t)},vX(xJn,"LayoutConfigurator/lambda$2$Type",931),wAn(934,1,DVn,LC),MWn.Mb=function(n){return YW(this.a,this.b,BB(n,1933))},vX(xJn,"LayoutConfigurator/lambda$3$Type",934),wAn(858,1,{},su),vX(xJn,"RecursiveGraphLayoutEngine",858),wAn(296,60,BVn,kv,rk),vX(xJn,"UnsupportedConfigurationException",296),wAn(453,60,BVn,ck),vX(xJn,"UnsupportedGraphException",453),wAn(754,1,{}),vX(y3n,"AbstractRandomListAccessor",754),wAn(500,754,{},CNn),MWn.rg=function(){return null},MWn.d=!0,MWn.e=!0,MWn.f=0,vX(t5n,"AlgorithmAssembler",500),wAn(1236,1,DVn,hu),MWn.Mb=function(n){return!!BB(n,123)},vX(t5n,"AlgorithmAssembler/lambda$0$Type",1236),wAn(1237,1,{},Eg),MWn.Kb=function(n){return bj(this.a,BB(n,123))},vX(t5n,"AlgorithmAssembler/lambda$1$Type",1237),wAn(1238,1,DVn,fu),MWn.Mb=function(n){return!!BB(n,80)},vX(t5n,"AlgorithmAssembler/lambda$2$Type",1238),wAn(1239,1,lVn,Tg),MWn.td=function(n){Jcn(this.a,BB(n,80))},vX(t5n,"AlgorithmAssembler/lambda$3$Type",1239),wAn(1240,1,lVn,NC),MWn.td=function(n){Dx(this.a,this.b,BB(n,234))},vX(t5n,"AlgorithmAssembler/lambda$4$Type",1240),wAn(1355,1,MYn,lu),MWn.ue=function(n,t){return FQ(BB(n,234),BB(t,234))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(t5n,"EnumBasedFactoryComparator",1355),wAn(80,754,{80:1},B2),MWn.rg=function(){return new Rv},MWn.a=0,vX(t5n,"LayoutProcessorConfiguration",80),wAn(1013,1,{527:1},$f),MWn.og=function(n){nan(eMt,new Mg(n))},vX(zYn,"DeprecatedLayoutOptionReplacer",1013),wAn(1014,1,lVn,bu),MWn.td=function(n){N9(BB(n,160))},vX(zYn,"DeprecatedLayoutOptionReplacer/lambda$0$Type",1014),wAn(1015,1,lVn,wu),MWn.td=function(n){Twn(BB(n,160))},vX(zYn,"DeprecatedLayoutOptionReplacer/lambda$1$Type",1015),wAn(1016,1,{},Mg),MWn.Od=function(n,t){Rx(this.a,BB(n,146),BB(t,38))},vX(zYn,"DeprecatedLayoutOptionReplacer/lambda$2$Type",1016),wAn(149,1,{686:1,149:1},MTn),MWn.Fb=function(n){return j5(this,n)},MWn.sg=function(){return this.b},MWn.tg=function(){return this.c},MWn.ne=function(){return this.e},MWn.Hb=function(){return vvn(this.c)},MWn.Ib=function(){return"Layout Algorithm: "+this.c};var cMt,aMt=vX(zYn,"LayoutAlgorithmData",149);wAn(263,1,{},du),vX(zYn,"LayoutAlgorithmData/Builder",263),wAn(1017,1,{527:1},gu),MWn.og=function(n){cL(n,239)&&!qy(TD(n.We((sWn(),zSt))))&&KFn(BB(n,33))},vX(zYn,"LayoutAlgorithmResolver",1017),wAn(229,1,{686:1,229:1},UZ),MWn.Fb=function(n){return!!cL(n,229)&&mK(this.b,BB(n,229).b)},MWn.sg=function(){return this.a},MWn.tg=function(){return this.b},MWn.ne=function(){return this.d},MWn.Hb=function(){return vvn(this.b)},MWn.Ib=function(){return"Layout Type: "+this.b},vX(zYn,"LayoutCategoryData",229),wAn(344,1,{},pu),vX(zYn,"LayoutCategoryData/Builder",344),wAn(867,1,{},ORn),vX(zYn,"LayoutMetaDataService",867),wAn(868,1,{},UX),vX(zYn,"LayoutMetaDataService/Registry",868),wAn(478,1,{478:1},vu),vX(zYn,"LayoutMetaDataService/Registry/Triple",478),wAn(869,1,e5n,mu),MWn.ug=function(){return new Gj},vX(zYn,"LayoutMetaDataService/lambda$0$Type",869),wAn(870,1,i5n,yu),MWn.vg=function(n){return B$(BB(n,8))},vX(zYn,"LayoutMetaDataService/lambda$1$Type",870),wAn(879,1,e5n,ku),MWn.ug=function(){return new Np},vX(zYn,"LayoutMetaDataService/lambda$10$Type",879),wAn(880,1,i5n,ju),MWn.vg=function(n){return new t_(BB(n,12))},vX(zYn,"LayoutMetaDataService/lambda$11$Type",880),wAn(881,1,e5n,Eu),MWn.ug=function(){return new YT},vX(zYn,"LayoutMetaDataService/lambda$12$Type",881),wAn(882,1,i5n,Tu),MWn.vg=function(n){return zB(BB(n,68))},vX(zYn,"LayoutMetaDataService/lambda$13$Type",882),wAn(883,1,e5n,Mu),MWn.ug=function(){return new Rv},vX(zYn,"LayoutMetaDataService/lambda$14$Type",883),wAn(884,1,i5n,Su),MWn.vg=function(n){return JQ(BB(n,53))},vX(zYn,"LayoutMetaDataService/lambda$15$Type",884),wAn(885,1,e5n,Pu),MWn.ug=function(){return new fA},vX(zYn,"LayoutMetaDataService/lambda$16$Type",885),wAn(886,1,i5n,Cu),MWn.vg=function(n){return S4(BB(n,53))},vX(zYn,"LayoutMetaDataService/lambda$17$Type",886),wAn(887,1,e5n,Iu),MWn.ug=function(){return new zv},vX(zYn,"LayoutMetaDataService/lambda$18$Type",887),wAn(888,1,i5n,Ou),MWn.vg=function(n){return GB(BB(n,208))},vX(zYn,"LayoutMetaDataService/lambda$19$Type",888),wAn(871,1,e5n,Au),MWn.ug=function(){return new km},vX(zYn,"LayoutMetaDataService/lambda$2$Type",871),wAn(872,1,i5n,$u),MWn.vg=function(n){return new Kj(BB(n,74))},vX(zYn,"LayoutMetaDataService/lambda$3$Type",872),wAn(873,1,e5n,Lu),MWn.ug=function(){return new lm},vX(zYn,"LayoutMetaDataService/lambda$4$Type",873),wAn(874,1,i5n,Nu),MWn.vg=function(n){return new A_(BB(n,142))},vX(zYn,"LayoutMetaDataService/lambda$5$Type",874),wAn(875,1,e5n,Du),MWn.ug=function(){return new bm},vX(zYn,"LayoutMetaDataService/lambda$6$Type",875),wAn(876,1,i5n,Ru),MWn.vg=function(n){return new O_(BB(n,116))},vX(zYn,"LayoutMetaDataService/lambda$7$Type",876),wAn(877,1,e5n,Ku),MWn.ug=function(){return new Yu},vX(zYn,"LayoutMetaDataService/lambda$8$Type",877),wAn(878,1,i5n,_u),MWn.vg=function(n){return new rnn(BB(n,373))},vX(zYn,"LayoutMetaDataService/lambda$9$Type",878);var uMt,oMt,sMt,hMt,fMt,lMt=bq(IJn,"IProperty");wAn(23,1,{35:1,686:1,23:1,146:1},bPn),MWn.wd=function(n){return gL(this,BB(n,146))},MWn.Fb=function(n){return cL(n,23)?mK(this.f,BB(n,23).f):cL(n,146)&&mK(this.f,BB(n,146).tg())},MWn.wg=function(){var n;if(cL(this.b,4)){if(null==(n=Jdn(this.b)))throw Hp(new Fy(o5n+this.f+"'. Make sure it's type is registered with the "+(ED(bAt),bAt.k)+c5n));return n}return this.b},MWn.sg=function(){return this.d},MWn.tg=function(){return this.f},MWn.ne=function(){return this.i},MWn.Hb=function(){return vvn(this.f)},MWn.Ib=function(){return"Layout Option: "+this.f},vX(zYn,"LayoutOptionData",23),wAn(24,1,{},Fu),vX(zYn,"LayoutOptionData/Builder",24),wAn(175,22,{3:1,35:1,22:1,175:1},AC);var bMt,wMt,dMt,gMt,pMt,vMt,mMt,yMt,kMt,jMt=Ben(zYn,"LayoutOptionData/Target",175,Unt,O5,QF);wAn(277,22,{3:1,35:1,22:1,277:1},$C);var EMt,TMt,MMt,SMt=Ben(zYn,"LayoutOptionData/Type",277,Unt,_tn,YF);wAn(110,1,{110:1},bA,UV,gY),MWn.Fb=function(n){var t;return!(null==n||!cL(n,110))&&(t=BB(n,110),cV(this.c,t.c)&&cV(this.d,t.d)&&cV(this.b,t.b)&&cV(this.a,t.a))},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[this.c,this.d,this.b,this.a]))},MWn.Ib=function(){return"Rect[x="+this.c+",y="+this.d+",w="+this.b+",h="+this.a+"]"},MWn.a=0,MWn.b=0,MWn.c=0,MWn.d=0,vX(f1n,"ElkRectangle",110),wAn(8,1,{3:1,4:1,8:1,414:1},Gj,XZ,xC,wA),MWn.Fb=function(n){return nrn(this,n)},MWn.Hb=function(){return VO(this.a)+byn(VO(this.b))},MWn.Jf=function(n){var t,e,i;for(e=0;e<n.length&&xhn((b1(e,n.length),n.charCodeAt(e)),o1n);)++e;for(t=n.length;t>0&&xhn((b1(t-1,n.length),n.charCodeAt(t-1)),s1n);)--t;if(e>=t)throw Hp(new _y("The given string does not contain any numbers."));if(2!=(i=kKn(n.substr(e,t-e),",|;|\r|\n")).length)throw Hp(new _y("Exactly two numbers are expected, "+i.length+" were found."));try{this.a=bSn(RMn(i[0])),this.b=bSn(RMn(i[1]))}catch(r){throw cL(r=lun(r),127)?Hp(new _y(h1n+r)):Hp(r)}},MWn.Ib=function(){return"("+this.a+","+this.b+")"},MWn.a=0,MWn.b=0;var PMt=vX(f1n,"KVector",8);wAn(74,68,{3:1,4:1,20:1,28:1,52:1,14:1,68:1,15:1,74:1,414:1},km,Kj,Ux),MWn.Pc=function(){return Vsn(this)},MWn.Jf=function(n){var t,e,i,r,c;e=kKn(n,",|;|\\(|\\)|\\[|\\]|\\{|\\}| |\t|\n"),yQ(this);try{for(t=0,r=0,i=0,c=0;t<e.length;)null!=e[t]&&RMn(e[t]).length>0&&(r%2==0?i=bSn(e[t]):c=bSn(e[t]),r>0&&r%2!=0&&DH(this,new xC(i,c)),++r),++t}catch(a){throw cL(a=lun(a),127)?Hp(new _y("The given string does not match the expected format for vectors."+a)):Hp(a)}},MWn.Ib=function(){var n,t,e;for(n=new lN("("),t=spn(this,0);t.b!=t.d.c;)oO(n,(e=BB(b3(t),8)).a+","+e.b),t.b!=t.d.c&&(n.a+="; ");return(n.a+=")",n).a};var CMt,IMt,OMt,AMt,$Mt,LMt,NMt=vX(f1n,"KVectorChain",74);wAn(248,22,{3:1,35:1,22:1,248:1},DC);var xMt,DMt,RMt,KMt,_Mt,FMt,BMt,HMt,qMt,GMt,zMt,UMt,XMt,WMt,VMt,QMt,YMt,JMt,ZMt,nSt=Ben(h5n,"Alignment",248,Unt,J8,JF);wAn(979,1,QYn,Lf),MWn.Qe=function(n){G_n(n)},vX(h5n,"BoxLayouterOptions",979),wAn(980,1,{},xu),MWn.$e=function(){return new Gu},MWn._e=function(n){},vX(h5n,"BoxLayouterOptions/BoxFactory",980),wAn(291,22,{3:1,35:1,22:1,291:1},RC);var tSt,eSt,iSt,rSt,cSt,aSt,uSt,oSt,sSt,hSt,fSt,lSt,bSt,wSt,dSt,gSt,pSt,vSt,mSt,ySt,kSt,jSt,ESt,TSt,MSt,SSt,PSt,CSt,ISt,OSt,ASt,$St,LSt,NSt,xSt,DSt,RSt,KSt,_St,FSt,BSt,HSt,qSt,GSt,zSt,USt,XSt,WSt,VSt,QSt,YSt,JSt,ZSt,nPt,tPt,ePt,iPt,rPt,cPt,aPt,uPt,oPt,sPt,hPt,fPt,lPt,bPt,wPt,dPt,gPt,pPt,vPt,mPt,yPt,kPt,jPt,EPt,TPt,MPt,SPt,PPt,CPt,IPt,OPt,APt,$Pt,LPt,NPt,xPt,DPt,RPt,KPt,_Pt,FPt,BPt,HPt,qPt=Ben(h5n,"ContentAlignment",291,Unt,Y8,ZF);wAn(684,1,QYn,Nf),MWn.Qe=function(n){Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,w5n),""),"Layout Algorithm"),"Select a specific layout algorithm."),(PPn(),yMt)),Qtt),nbn((rpn(),hMt))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,d5n),""),"Resolved Layout Algorithm"),"Meta data associated with the selected algorithm."),mMt),aMt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,W2n),""),"Alignment"),"Alignment of the selected node relative to other nodes; the exact meaning depends on the used algorithm."),rSt),gMt),nSt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,VJn),""),"Aspect Ratio"),"The desired aspect ratio of the drawing, that is the quotient of width by height."),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,g5n),""),"Bend Points"),"A fixed list of bend points for the edge. This is used by the 'Fixed Layout' algorithm to specify a pre-defined routing for an edge. The vector chain must include the source point, any bend points, and the target point, so it must have at least two points."),mMt),NMt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,u3n),""),"Content Alignment"),"Specifies how the content of a node are aligned. Each node can individually control the alignment of its contents. I.e. if a node should be aligned top left in its parent node, the parent node should specify that option."),fSt),pMt),qPt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,X2n),""),"Debug Mode"),"Whether additional debug information shall be generated."),(hN(),!1)),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,J2n),""),TJn),"Overall direction of edges: horizontal (right / left) or vertical (down / up)."),wSt),gMt),WPt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,y2n),""),"Edge Routing"),"What kind of edge routing style should be applied for the content of a parent node. Algorithms may also set this option to single edges in order to mark them as splines. The bend point list of edges with this option set to SPLINES must be interpreted as control points for a piecewise cubic spline."),mSt),gMt),oCt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,A4n),""),"Expand Nodes"),"If active, nodes are expanded to fill the area of their parent."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,d2n),""),"Hierarchy Handling"),"Determines whether separate layout runs are triggered for different compound nodes in a hierarchical graph. Setting a node's hierarchy handling to `INCLUDE_CHILDREN` will lay out that node and all of its descendants in a single layout run, until a descendant is encountered which has its hierarchy handling set to `SEPARATE_CHILDREN`. In general, `SEPARATE_CHILDREN` will ensure that a new layout run is triggered for a node with that setting. Including multiple levels of hierarchy in a single layout run may allow cross-hierarchical edges to be laid out properly. If the root node is set to `INHERIT` (or not set at all), the default behavior is `SEPARATE_CHILDREN`."),TSt),gMt),SCt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,QJn),""),"Padding"),"The padding to be left to a parent element's border when placing child elements. This can also serve as an output option of a layout algorithm if node size calculation is setup appropriately."),WSt),mMt),_ut),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,jZn),""),"Interactive"),"Whether the algorithm should be run in interactive mode for the content of a parent node. What this means exactly depends on how the specific algorithm interprets this option. Usually in the interactive mode algorithms try to modify the current layout as little as possible."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,m3n),""),"interactive Layout"),"Whether the graph should be changeable interactively and by setting constraints"),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,MZn),""),"Omit Node Micro Layout"),"Node micro layout comprises the computation of node dimensions (if requested), the placement of ports and their labels, and the placement of node labels. The functionality is implemented independent of any specific layout algorithm and shouldn't have any negative impact on the layout algorithm's performance itself. Yet, if any unforeseen behavior occurs, this option allows to deactivate the micro layout."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,EZn),""),"Port Constraints"),"Defines constraints of the position of the ports of a node."),oPt),gMt),aIt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,g3n),""),"Position"),"The position of a node, port, or label. This is used by the 'Fixed Layout' algorithm to specify a pre-defined position."),mMt),PMt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[fMt,oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,pZn),""),"Priority"),"Defines the priority of an object; its meaning depends on the specific layout algorithm and the context where it is used."),vMt),Att),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,yZn),""),"Randomization Seed"),"Seed used for pseudo-random number generators to control the layout algorithm. If the value is 0, the seed shall be determined pseudo-randomly (e.g. from the system time)."),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,kZn),""),"Separate Connected Components"),"Whether each connected component should be processed separately."),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,o3n),""),"Junction Points"),"This option is not used as option, but as output of the layout algorithms. It is attached to edges and determines the points where junction symbols should be drawn in order to represent hyperedges with orthogonal routing. Whether such points are computed depends on the chosen layout algorithm and edge routing style. The points are put into the vector chain with no specific order."),ASt),mMt),NMt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,f3n),""),"Comment Box"),"Whether the node should be regarded as a comment box instead of a regular node. In that case its placement should be similar to how labels are handled. Any edges incident to a comment box specify to which graph elements the comment is related."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,l3n),""),"Hypernode"),"Whether the node should be handled as a hypernode."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,p5n),""),"Label Manager"),"Label managers can shorten labels upon a layout algorithm's request."),mMt),KNt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,p3n),""),"Margins"),"Margins define additional space around the actual bounds of a graph element. For instance, ports or labels being placed on the outside of a node's border might introduce such a margin. The margin is used to guarantee non-overlap of other graph elements with those ports or labels."),LSt),mMt),Eut),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,z2n),""),"No Layout"),"No layout is done for the associated element. This is used to mark parts of a diagram to avoid their inclusion in the layout graph, or to mark parts of the layout graph to prevent layout engines from processing them. If you wish to exclude the contents of a compound node from automatic layout, while the node itself is still considered on its own layer, use the 'Fixed Layout' algorithm for that node."),!1),wMt),ktt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt,fMt,oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,v5n),""),"Scale Factor"),"The scaling factor to be applied to the corresponding node in recursive layout. It causes the corresponding node's size to be adjusted, and its ports and labels to be sized and placed accordingly after the layout of that node has been determined (and before the node itself and its siblings are arranged). The scaling is not reverted afterwards, so the resulting layout graph contains the adjusted size and position data. This option is currently not supported if 'Layout Hierarchy' is set."),1),dMt),Ptt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,m5n),""),"Animate"),"Whether the shift from the old layout to the new computed layout shall be animated."),!0),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,y5n),""),"Animation Time Factor"),"Factor for computation of animation time. The higher the value, the longer the animation time. If the value is 0, the resulting time is always equal to the minimum defined by 'Minimal Animation Time'."),iln(100)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,k5n),""),"Layout Ancestors"),"Whether the hierarchy levels on the path from the selected element to the root of the diagram shall be included in the layout process."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,j5n),""),"Maximal Animation Time"),"The maximal time for animations, in milliseconds."),iln(4e3)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,E5n),""),"Minimal Animation Time"),"The minimal time for animations, in milliseconds."),iln(400)),vMt),Att),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,T5n),""),"Progress Bar"),"Whether a progress bar shall be displayed during layout computations."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,M5n),""),"Validate Graph"),"Whether the graph shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,S5n),""),"Validate Options"),"Whether layout options shall be validated before any layout algorithm is applied. If this option is enabled and at least one error is found, the layout process is aborted and a message is shown to the user."),!0),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,P5n),""),"Zoom to Fit"),"Whether the zoom level shall be set to view the whole diagram after layout."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,b5n),"box"),"Box Layout Mode"),"Configures the packing mode used by the {@link BoxLayoutProvider}. If SIMPLE is not required (neither priorities are used nor the interactive mode), GROUP_DEC can improve the packing and decrease the area. GROUP_MIXED and GROUP_INC may, in very specific scenarios, work better."),oSt),gMt),cOt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,L2n),k2n),"Comment Comment Spacing"),"Spacing to be preserved between a comment box and other comment boxes connected to the same node. The space left between comment boxes of different nodes is controlled by the node-node spacing."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,N2n),k2n),"Comment Node Spacing"),"Spacing to be preserved between a node and its connected comment boxes. The space left between a node and the comments of another node is controlled by the node-node spacing."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,XJn),k2n),"Components Spacing"),"Spacing to be preserved between pairs of connected components. This option is only relevant if 'separateConnectedComponents' is activated."),20),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,x2n),k2n),"Edge Spacing"),"Spacing to be preserved between any two edges. Note that while this can somewhat easily be satisfied for the segments of orthogonally drawn edges, it is harder for general polylines or splines."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,mZn),k2n),"Edge Label Spacing"),"The minimal distance to be preserved between a label and the edge it is associated with. Note that the placement of a label is influenced by the 'edgelabels.placement' option."),2),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,D2n),k2n),"Edge Node Spacing"),"Spacing to be preserved between nodes and edges."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,R2n),k2n),"Label Spacing"),"Determines the amount of space to be left between two labels of the same graph element."),0),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,F2n),k2n),"Label Node Spacing"),"Spacing to be preserved between labels and the border of node they are associated with. Note that the placement of a label is influenced by the 'nodelabels.placement' option."),5),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,K2n),k2n),"Horizontal spacing between Label and Port"),"Horizontal spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,_2n),k2n),"Vertical spacing between Label and Port"),"Vertical spacing to be preserved between labels and the ports they are associated with. Note that the placement of a label is influenced by the 'portlabels.placement' option."),1),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,vZn),k2n),"Node Spacing"),"The minimal distance to be preserved between each two nodes."),20),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,B2n),k2n),"Node Self Loop Spacing"),"Spacing to be preserved between a node and its self loops."),10),dMt),Ptt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,H2n),k2n),"Port Spacing"),"Spacing between pairs of ports of the same node."),10),dMt),Ptt),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,q2n),k2n),"Individual Spacing"),"Allows to specify individual spacing values for graph elements that shall be different from the value specified for the element's parent."),mMt),hOt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[uMt,fMt,oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,v3n),k2n),"Additional Port Space"),"Additional space around the sets of ports on each node side. For each side of a node, this option can reserve additional space before and after the ports on each side. For example, a top spacing of 20 makes sure that the first port on the western and eastern side is 20 units away from the northern border."),DPt),mMt),Eut),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,d3n),A5n),"Layout Partition"),"Partition to which the node belongs. This requires Layout Partitioning to be active. Nodes with lower partition IDs will appear to the left of nodes with higher partition IDs (assuming a left-to-right layout direction)."),vMt),Att),EG(hMt,Pun(Gk(jMt,1),$Vn,175,0,[sMt]))))),a2(n,d3n,w3n,JSt),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,w3n),A5n),"Layout Partitioning"),"Whether to activate partitioned layout. This will allow to group nodes through the Layout Partition option. a pair of nodes with different partition indices is then placed such that the node with lower index is placed to the left of the other node (with left-to-right layout direction). Depending on the layout algorithm, this may only be guaranteed to work if all nodes have a layout partition configured, or at least if edges that cross partitions are not part of a partition-crossing cycle."),QSt),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Z2n),$5n),"Node Label Padding"),"Define padding for node labels that are placed inside of a node."),xSt),mMt),_ut),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,CZn),$5n),"Node Label Placement"),"Hints for where node labels are to be placed; if empty, the node label's position is not modified."),RSt),pMt),GCt),EG(sMt,Pun(Gk(jMt,1),$Vn,175,0,[oMt]))))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,e3n),L5n),"Port Alignment"),"Defines the default port distribution for a node. May be overridden for each side individually."),nPt),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,i3n),L5n),"Port Alignment (North)"),"Defines how ports on the northern side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,r3n),L5n),"Port Alignment (South)"),"Defines how ports on the southern side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,c3n),L5n),"Port Alignment (West)"),"Defines how ports on the western side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,a3n),L5n),"Port Alignment (East)"),"Defines how ports on the eastern side are placed, overriding the node's general port alignment."),gMt),JCt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,PZn),N5n),"Node Size Constraints"),"What should be taken into account when calculating a node's size. Empty size constraints specify that a node's size is already fixed and should not be changed."),_St),pMt),YIt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,SZn),N5n),"Node Size Options"),"Options modifying the behavior of the size constraints set on a node. Each member of the set specifies something that should be taken into account when calculating node sizes. The empty set corresponds to no further modifications."),GSt),pMt),iOt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,BZn),N5n),"Node Size Minimum"),"The minimal size to which a node can be reduced."),HSt),mMt),PMt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Y2n),N5n),"Fixed Graph Size"),"By default, the fixed layout provider will enlarge a graph until it is large enough to contain its children. If this option is set, it won't do so."),!1),wMt),ktt),nbn(hMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,s3n),A2n),"Edge Label Placement"),"Gives a hint on where to put edge labels."),pSt),gMt),nCt),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,TZn),A2n),"Inline Edge Labels"),"If true, an edge label is placed directly on its edge. May only apply to center edge labels. This kind of label placement is only advisable if the label's rendering is such that it is not crossed by its edge and thus stays legible."),!1),wMt),ktt),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,C5n),"font"),"Font Name"),"Font name used for a label."),yMt),Qtt),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,I5n),"font"),"Font Size"),"Font size used for a label."),vMt),Att),nbn(oMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,b3n),x5n),"Port Anchor Offset"),"The offset to the port position where connections shall be attached."),mMt),PMt),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,h3n),x5n),"Port Index"),"The index of a port in the fixed order around a node. The order is assumed as clockwise, starting with the leftmost port on the top side. This option must be set if 'Port Constraints' is set to FIXED_ORDER and no specific positions are given for the ports. Additionally, the option 'Port Side' must be defined in this case."),vMt),Att),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,U2n),x5n),"Port Side"),"The side of a node on which a port is situated. This option must be set if 'Port Constraints' is set to FIXED_SIDE or FIXED_ORDER and no specific positions are given for the ports."),dPt),gMt),FIt),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Ej(Cj(Mj(Sj(new Fu,G2n),x5n),"Port Border Offset"),"The offset of ports on the node border. With a positive offset the port is moved outside of the node, while with a negative offset the port is moved towards the inside. An offset of 0 means that the port is placed directly on the node border, i.e. if the port side is north, the port's south border touches the nodes's north border; if the port side is east, the port's west border touches the nodes's east border; if the port side is south, the port's north border touches the node's south border; if the port side is west, the port's east border touches the node's west border."),dMt),Ptt),nbn(fMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,IZn),D5n),"Port Label Placement"),"Decides on a placement method for port labels; if empty, the node label's position is not modified."),lPt),pMt),IIt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,n3n),D5n),"Port Labels Next to Port"),"Use 'portLabels.placement': NEXT_TO_PORT_OF_POSSIBLE."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,t3n),D5n),"Treat Port Labels as Group"),"If this option is true (default), the labels of a port will be treated as a group when it comes to centering them next to their port. If this option is false, only the first label will be centered next to the port, with the others being placed below. This only applies to labels of eastern and western ports and will have no effect if labels are not placed next to their port."),!0),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,V2n),R5n),"Activate Inside Self Loops"),"Whether this node allows to route self loops inside of it instead of around it. If set to true, this will make the node a compound node if it isn't already, and will require the layout algorithm to support compound nodes with hierarchical ports."),!1),wMt),ktt),nbn(sMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,Q2n),R5n),"Inside Self Loop"),"Whether a self loop should be routed inside a node instead of around that node."),!1),wMt),ktt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,WJn),"edge"),"Edge Thickness"),"The thickness of an edge. This is a hint on the line width used to draw an edge, possibly requiring more space to be reserved for it."),1),dMt),Ptt),nbn(uMt)))),Abn(n,new bPn(Oj(Ij(Aj(Tj(Ej(Cj(Mj(Sj(new Fu,O5n),"edge"),"Edge Type"),"The type of an edge. This is usually used for UML class diagrams, where associations must be handled differently from generalizations."),kSt),gMt),yCt),nbn(uMt)))),xM(n,new UZ(yj(jj(kj(new pu,w1n),"Layered"),'The layer-based method was introduced by Sugiyama, Tagawa and Toda in 1981. It emphasizes the direction of edges by pointing as many edges as possible into the same direction. The nodes are arranged in layers, which are sometimes called "hierarchies", and then reordered such that the number of edge crossings is minimized. Afterwards, concrete coordinates are computed for the nodes and edge bend points.'))),xM(n,new UZ(yj(jj(kj(new pu,"org.eclipse.elk.orthogonal"),"Orthogonal"),'Orthogonal methods that follow the "topology-shape-metrics" approach by Batini, Nardelli and Tamassia \'86. The first phase determines the topology of the drawing by applying a planarization technique, which results in a planar representation of the graph. The orthogonal shape is computed in the second phase, which aims at minimizing the number of edge bends, and is called orthogonalization. The third phase leads to concrete coordinates for nodes and edge bend points by applying a compaction method, thus defining the metrics.'))),xM(n,new UZ(yj(jj(kj(new pu,gZn),"Force"),"Layout algorithms that follow physical analogies by simulating a system of attractive and repulsive forces. The first successful method of this kind was proposed by Eades in 1984."))),xM(n,new UZ(yj(jj(kj(new pu,"org.eclipse.elk.circle"),"Circle"),"Circular layout algorithms emphasize cycles or biconnected components of a graph by arranging them in circles. This is useful if a drawing is desired where such components are clearly grouped, or where cycles are shown as prominent OPTIONS of the graph."))),xM(n,new UZ(yj(jj(kj(new pu,Y3n),"Tree"),"Specialized layout methods for trees, i.e. acyclic graphs. The regular structure of graphs that have no undirected cycles can be emphasized using an algorithm of this type."))),xM(n,new UZ(yj(jj(kj(new pu,"org.eclipse.elk.planar"),"Planar"),"Algorithms that require a planar or upward planar graph. Most of these algorithms are theoretically interesting, but not practically usable."))),xM(n,new UZ(yj(jj(kj(new pu,w4n),"Radial"),"Radial layout algorithms usually position the nodes of the graph on concentric circles."))),bKn((new xf,n)),G_n((new Lf,n)),RDn((new Df,n))},vX(h5n,"CoreOptions",684),wAn(103,22,{3:1,35:1,22:1,103:1},KC);var GPt,zPt,UPt,XPt,WPt=Ben(h5n,TJn,103,Unt,C5,eB);wAn(272,22,{3:1,35:1,22:1,272:1},_C);var VPt,QPt,YPt,JPt,ZPt,nCt=Ben(h5n,"EdgeLabelPlacement",272,Unt,q1,iB);wAn(218,22,{3:1,35:1,22:1,218:1},FC);var tCt,eCt,iCt,rCt,cCt,aCt,uCt,oCt=Ben(h5n,"EdgeRouting",218,Unt,S3,rB);wAn(312,22,{3:1,35:1,22:1,312:1},BC);var sCt,hCt,fCt,lCt,bCt,wCt,dCt,gCt,pCt,vCt,mCt,yCt=Ben(h5n,"EdgeType",312,Unt,a9,cB);wAn(977,1,QYn,xf),MWn.Qe=function(n){bKn(n)},vX(h5n,"FixedLayouterOptions",977),wAn(978,1,{},Vu),MWn.$e=function(){return new Hu},MWn._e=function(n){},vX(h5n,"FixedLayouterOptions/FixedFactory",978),wAn(334,22,{3:1,35:1,22:1,334:1},HC);var kCt,jCt,ECt,TCt,MCt,SCt=Ben(h5n,"HierarchyHandling",334,Unt,H1,aB);wAn(285,22,{3:1,35:1,22:1,285:1},qC);var PCt,CCt,ICt,OCt,ACt,$Ct,LCt,NCt,xCt,DCt,RCt=Ben(h5n,"LabelSide",285,Unt,M3,uB);wAn(93,22,{3:1,35:1,22:1,93:1},GC);var KCt,_Ct,FCt,BCt,HCt,qCt,GCt=Ben(h5n,"NodeLabelPlacement",93,Unt,ken,oB);wAn(249,22,{3:1,35:1,22:1,249:1},zC);var zCt,UCt,XCt,WCt,VCt,QCt,YCt,JCt=Ben(h5n,"PortAlignment",249,Unt,I5,sB);wAn(98,22,{3:1,35:1,22:1,98:1},UC);var ZCt,nIt,tIt,eIt,iIt,rIt,cIt,aIt=Ben(h5n,"PortConstraints",98,Unt,S8,hB);wAn(273,22,{3:1,35:1,22:1,273:1},XC);var uIt,oIt,sIt,hIt,fIt,lIt,bIt,wIt,dIt,gIt,pIt,vIt,mIt,yIt,kIt,jIt,EIt,TIt,MIt,SIt,PIt,CIt,IIt=Ben(h5n,"PortLabelPlacement",273,Unt,c9,fB);wAn(61,22,{3:1,35:1,22:1,61:1},WC);var OIt,AIt,$It,LIt,NIt,xIt,DIt,RIt,KIt,_It,FIt=Ben(h5n,"PortSide",61,Unt,h5,wB);wAn(981,1,QYn,Df),MWn.Qe=function(n){RDn(n)},vX(h5n,"RandomLayouterOptions",981),wAn(982,1,{},Qu),MWn.$e=function(){return new no},MWn._e=function(n){},vX(h5n,"RandomLayouterOptions/RandomFactory",982),wAn(374,22,{3:1,35:1,22:1,374:1},VC);var BIt,HIt,qIt,GIt,zIt,UIt,XIt,WIt,VIt,QIt,YIt=Ben(h5n,"SizeConstraint",374,Unt,T3,lB);wAn(259,22,{3:1,35:1,22:1,259:1},QC);var JIt,ZIt,nOt,tOt,eOt,iOt=Ben(h5n,"SizeOptions",259,Unt,Ein,bB);wAn(370,1,{1949:1},Xm),MWn.b=!1,MWn.c=0,MWn.d=-1,MWn.e=null,MWn.f=null,MWn.g=-1,MWn.j=!1,MWn.k=!1,MWn.n=!1,MWn.o=0,MWn.q=0,MWn.r=0,vX(y3n,"BasicProgressMonitor",370),wAn(972,209,NJn,Gu),MWn.Ze=function(n,t){var e,i,r,c,a,u,o,s,h;OTn(t,"Box layout",2),r=zy(MD(ZAn(n,(SMn(),XMt)))),c=BB(ZAn(n,GMt),116),e=qy(TD(ZAn(n,_Mt))),i=qy(TD(ZAn(n,FMt))),0===BB(ZAn(n,RMt),311).g?(u=new t_((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a)),SQ(),m$(u,new Sg(i)),a=u,o=XPn(n),(null==(s=MD(ZAn(n,DMt)))||(kW(s),s<=0))&&(s=1.3),KUn(n,(h=HUn(a,r,c,o.a,o.b,e,(kW(s),s))).a,h.b,!1,!0)):kqn(n,r,c,e),HSn(t)},vX(y3n,"BoxLayoutProvider",972),wAn(973,1,MYn,Sg),MWn.ue=function(n,t){return hNn(this,BB(n,33),BB(t,33))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},MWn.a=!1,vX(y3n,"BoxLayoutProvider/1",973),wAn(157,1,{157:1},Gtn,zx),MWn.Ib=function(){return this.c?zRn(this.c):LMn(this.b)},vX(y3n,"BoxLayoutProvider/Group",157),wAn(311,22,{3:1,35:1,22:1,311:1},YC);var rOt,cOt=Ben(y3n,"BoxLayoutProvider/PackingMode",311,Unt,P3,dB);wAn(974,1,MYn,zu),MWn.ue=function(n,t){return DQ(BB(n,157),BB(t,157))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y3n,"BoxLayoutProvider/lambda$0$Type",974),wAn(975,1,MYn,Uu),MWn.ue=function(n,t){return cQ(BB(n,157),BB(t,157))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y3n,"BoxLayoutProvider/lambda$1$Type",975),wAn(976,1,MYn,Xu),MWn.ue=function(n,t){return aQ(BB(n,157),BB(t,157))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(y3n,"BoxLayoutProvider/lambda$2$Type",976),wAn(1365,1,{831:1},Wu),MWn.qg=function(n,t){return AM(),!cL(t,160)||SE((Nun(),BB(n,160)),t)},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$0$Type",1365),wAn(1366,1,lVn,Pg),MWn.td=function(n){Jsn(this.a,BB(n,146))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$1$Type",1366),wAn(1367,1,lVn,qu),MWn.td=function(n){BB(n,94),AM()},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$2$Type",1367),wAn(1371,1,lVn,Cg),MWn.td=function(n){Orn(this.a,BB(n,94))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$3$Type",1371),wAn(1369,1,DVn,JC),MWn.Mb=function(n){return Von(this.a,this.b,BB(n,146))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$4$Type",1369),wAn(1368,1,DVn,ZC),MWn.Mb=function(n){return $x(this.a,this.b,BB(n,831))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$5$Type",1368),wAn(1370,1,lVn,nI),MWn.td=function(n){Fz(this.a,this.b,BB(n,146))},vX(y3n,"ElkSpacings/AbstractSpacingsBuilder/lambda$6$Type",1370),wAn(935,1,{},Bu),MWn.Kb=function(n){return yA(n)},MWn.Fb=function(n){return this===n},vX(y3n,"ElkUtil/lambda$0$Type",935),wAn(936,1,lVn,tI),MWn.td=function(n){rOn(this.a,this.b,BB(n,79))},MWn.a=0,MWn.b=0,vX(y3n,"ElkUtil/lambda$1$Type",936),wAn(937,1,lVn,eI),MWn.td=function(n){Ey(this.a,this.b,BB(n,202))},MWn.a=0,MWn.b=0,vX(y3n,"ElkUtil/lambda$2$Type",937),wAn(938,1,lVn,iI),MWn.td=function(n){t$(this.a,this.b,BB(n,137))},MWn.a=0,MWn.b=0,vX(y3n,"ElkUtil/lambda$3$Type",938),wAn(939,1,lVn,Ig),MWn.td=function(n){cq(this.a,BB(n,469))},vX(y3n,"ElkUtil/lambda$4$Type",939),wAn(342,1,{35:1,342:1},$p),MWn.wd=function(n){return vL(this,BB(n,236))},MWn.Fb=function(n){var t;return!!cL(n,342)&&(t=BB(n,342),this.a==t.a)},MWn.Hb=function(){return CJ(this.a)},MWn.Ib=function(){return this.a+" (exclusive)"},MWn.a=0,vX(y3n,"ExclusiveBounds/ExclusiveLowerBound",342),wAn(1138,209,NJn,Hu),MWn.Ze=function(n,t){var i,r,c,a,u,o,s,f,l,b,w,d,g,p,v,m,y,k,j,E,T;for(OTn(t,"Fixed Layout",1),a=BB(ZAn(n,(sWn(),vSt)),218),b=0,w=0,v=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));v.e!=v.i.gc();){for(g=BB(kpn(v),33),(T=BB(ZAn(g,(Xsn(),gCt)),8))&&(SA(g,T.a,T.b),BB(ZAn(g,fCt),174).Hc((mdn(),DIt))&&(d=BB(ZAn(g,bCt),8)).a>0&&d.b>0&&KUn(g,d.a,d.b,!0,!0)),b=e.Math.max(b,g.i+g.g),w=e.Math.max(w,g.j+g.f),f=new AL((!g.n&&(g.n=new eU(zOt,g,1,7)),g.n));f.e!=f.i.gc();)o=BB(kpn(f),137),(T=BB(ZAn(o,gCt),8))&&SA(o,T.a,T.b),b=e.Math.max(b,g.i+o.i+o.g),w=e.Math.max(w,g.j+o.j+o.f);for(k=new AL((!g.c&&(g.c=new eU(XOt,g,9,9)),g.c));k.e!=k.i.gc();)for(y=BB(kpn(k),118),(T=BB(ZAn(y,gCt),8))&&SA(y,T.a,T.b),j=g.i+y.i,E=g.j+y.j,b=e.Math.max(b,j+y.g),w=e.Math.max(w,E+y.f),s=new AL((!y.n&&(y.n=new eU(zOt,y,1,7)),y.n));s.e!=s.i.gc();)o=BB(kpn(s),137),(T=BB(ZAn(o,gCt),8))&&SA(o,T.a,T.b),b=e.Math.max(b,j+o.i+o.g),w=e.Math.max(w,E+o.j+o.f);for(c=new oz(ZL(dLn(g).a.Kc(),new h));dAn(c);)l=_Un(i=BB(U5(c),79)),b=e.Math.max(b,l.a),w=e.Math.max(w,l.b);for(r=new oz(ZL(wLn(g).a.Kc(),new h));dAn(r);)JJ(PMn(i=BB(U5(r),79)))!=n&&(l=_Un(i),b=e.Math.max(b,l.a),w=e.Math.max(w,l.b))}if(a==(Mbn(),QPt))for(p=new AL((!n.a&&(n.a=new eU(UOt,n,10,11)),n.a));p.e!=p.i.gc();)for(r=new oz(ZL(dLn(g=BB(kpn(p),33)).a.Kc(),new h));dAn(r);)0==(u=rFn(i=BB(U5(r),79))).b?Ypn(i,OSt,null):Ypn(i,OSt,u);qy(TD(ZAn(n,(Xsn(),lCt))))||KUn(n,b+(m=BB(ZAn(n,wCt),116)).b+m.c,w+m.d+m.a,!0,!0),HSn(t)},vX(y3n,"FixedLayoutProvider",1138),wAn(373,134,{3:1,414:1,373:1,94:1,134:1},Yu,rnn),MWn.Jf=function(n){var t,e,i,r,c,a,u;if(n)try{for(a=kKn(n,";,;"),r=0,c=(i=a).length;r<c;++r){if(t=kKn(i[r],"\\:"),!(e=pGn(cin(),t[0])))throw Hp(new _y("Invalid option id: "+t[0]));if(null==(u=Zqn(e,t[1])))throw Hp(new _y("Invalid option value: "+t[1]));null==u?(!this.q&&(this.q=new xp),v6(this.q,e)):(!this.q&&(this.q=new xp),VW(this.q,e,u))}}catch(o){throw cL(o=lun(o),102)?Hp(new Fsn(o)):Hp(o)}},MWn.Ib=function(){return SD(P4($V((this.q?this.q:(SQ(),SQ(),het)).vc().Oc(),new Ju),x7(new YB,new Z,new W,new V,Pun(Gk(nit,1),$Vn,132,0,[]))))};var aOt,uOt,oOt,sOt,hOt=vX(y3n,"IndividualSpacings",373);wAn(971,1,{},Ju),MWn.Kb=function(n){return RQ(BB(n,42))},vX(y3n,"IndividualSpacings/lambda$0$Type",971),wAn(709,1,{},sG),MWn.c=0,vX(y3n,"InstancePool",709),wAn(1275,1,{},Zu),vX(y3n,"LoggedGraph",1275),wAn(396,22,{3:1,35:1,22:1,396:1},cI);var fOt,lOt,bOt,wOt=Ben(y3n,"LoggedGraph/Type",396,Unt,C3,gB);wAn(46,1,{20:1,46:1},rI),MWn.Jc=function(n){e5(this,n)},MWn.Fb=function(n){var t,e,i;return!!cL(n,46)&&(e=BB(n,46),t=null==this.a?null==e.a:Nfn(this.a,e.a),i=null==this.b?null==e.b:Nfn(this.b,e.b),t&&i)},MWn.Hb=function(){var n,t,e;return n=-65536&(t=null==this.a?0:nsn(this.a)),t&QVn^(-65536&(e=null==this.b?0:nsn(this.b)))>>16&QVn|n^(e&QVn)<<16},MWn.Kc=function(){return new Og(this)},MWn.Ib=function(){return null==this.a&&null==this.b?"pair(null,null)":null==this.a?"pair(null,"+Bbn(this.b)+")":null==this.b?"pair("+Bbn(this.a)+",null)":"pair("+Bbn(this.a)+","+Bbn(this.b)+")"},vX(y3n,"Pair",46),wAn(983,1,QWn,Og),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return!this.c&&(!this.b&&null!=this.a.a||null!=this.a.b)},MWn.Pb=function(){if(!this.c&&!this.b&&null!=this.a.a)return this.b=!0,this.a.a;if(!this.c&&null!=this.a.b)return this.c=!0,this.a.b;throw Hp(new yv)},MWn.Qb=function(){throw this.c&&null!=this.a.b?this.a.b=null:this.b&&null!=this.a.a&&(this.a.a=null),Hp(new dv)},MWn.b=!1,MWn.c=!1,vX(y3n,"Pair/1",983),wAn(448,1,{448:1},VV),MWn.Fb=function(n){return cV(this.a,BB(n,448).a)&&cV(this.c,BB(n,448).c)&&cV(this.d,BB(n,448).d)&&cV(this.b,BB(n,448).b)},MWn.Hb=function(){return fhn(Pun(Gk(Ant,1),HWn,1,5,[this.a,this.c,this.d,this.b]))},MWn.Ib=function(){return"("+this.a+FWn+this.c+FWn+this.d+FWn+this.b+")"},vX(y3n,"Quadruple",448),wAn(1126,209,NJn,no),MWn.Ze=function(n,t){var e;OTn(t,"Random Layout",1),0!=(!n.a&&(n.a=new eU(UOt,n,10,11)),n.a).i?(iUn(n,(e=BB(ZAn(n,(vdn(),NIt)),19))&&0!=e.a?new C4(e.a):new sbn,zy(MD(ZAn(n,AIt))),zy(MD(ZAn(n,xIt))),BB(ZAn(n,$It),116)),HSn(t)):HSn(t)},vX(y3n,"RandomLayoutProvider",1126),wAn(553,1,{}),MWn.qf=function(){return new xC(this.f.i,this.f.j)},MWn.We=function(n){return EY(n,(sWn(),aPt))?ZAn(this.f,bOt):ZAn(this.f,n)},MWn.rf=function(){return new xC(this.f.g,this.f.f)},MWn.sf=function(){return this.g},MWn.Xe=function(n){return P8(this.f,n)},MWn.tf=function(n){Pen(this.f,n.a),Cen(this.f,n.b)},MWn.uf=function(n){Sen(this.f,n.a),Men(this.f,n.b)},MWn.vf=function(n){this.g=n},MWn.g=0,vX(H5n,"ElkGraphAdapters/AbstractElkGraphElementAdapter",553),wAn(554,1,{839:1},Ag),MWn.wf=function(){var n,t;if(!this.b)for(this.b=C2(mV(this.a).i),t=new AL(mV(this.a));t.e!=t.i.gc();)n=BB(kpn(t),137),WB(this.b,new Ry(n));return this.b},MWn.b=null,vX(H5n,"ElkGraphAdapters/ElkEdgeAdapter",554),wAn(301,553,{},Dy),MWn.xf=function(){return eyn(this)},MWn.a=null,vX(H5n,"ElkGraphAdapters/ElkGraphAdapter",301),wAn(630,553,{181:1},Ry),vX(H5n,"ElkGraphAdapters/ElkLabelAdapter",630),wAn(629,553,{680:1},JN),MWn.wf=function(){return nyn(this)},MWn.Af=function(){var n;return!(n=BB(ZAn(this.f,(sWn(),$St)),142))&&(n=new lm),n},MWn.Cf=function(){return tyn(this)},MWn.Ef=function(n){var t;t=new A_(n),Ypn(this.f,(sWn(),$St),t)},MWn.Ff=function(n){Ypn(this.f,(sWn(),XSt),new O_(n))},MWn.yf=function(){return this.d},MWn.zf=function(){var n,t;if(!this.a)for(this.a=new Np,t=new oz(ZL(wLn(BB(this.f,33)).a.Kc(),new h));dAn(t);)n=BB(U5(t),79),WB(this.a,new Ag(n));return this.a},MWn.Bf=function(){var n,t;if(!this.c)for(this.c=new Np,t=new oz(ZL(dLn(BB(this.f,33)).a.Kc(),new h));dAn(t);)n=BB(U5(t),79),WB(this.c,new Ag(n));return this.c},MWn.Df=function(){return 0!=YQ(BB(this.f,33)).i||qy(TD(BB(this.f,33).We((sWn(),SSt))))},MWn.Gf=function(){_7(this,(GM(),lOt))},MWn.a=null,MWn.b=null,MWn.c=null,MWn.d=null,MWn.e=null,vX(H5n,"ElkGraphAdapters/ElkNodeAdapter",629),wAn(1266,553,{838:1},op),MWn.wf=function(){return kyn(this)},MWn.zf=function(){var n,t;if(!this.a)for(this.a=sx(BB(this.f,118).xg().i),t=new AL(BB(this.f,118).xg());t.e!=t.i.gc();)n=BB(kpn(t),79),WB(this.a,new Ag(n));return this.a},MWn.Bf=function(){var n,t;if(!this.c)for(this.c=sx(BB(this.f,118).yg().i),t=new AL(BB(this.f,118).yg());t.e!=t.i.gc();)n=BB(kpn(t),79),WB(this.c,new Ag(n));return this.c},MWn.Hf=function(){return BB(BB(this.f,118).We((sWn(),wPt)),61)},MWn.If=function(){var n,t,e,i,r,c,a;for(i=WJ(BB(this.f,118)),e=new AL(BB(this.f,118).yg());e.e!=e.i.gc();)for(a=new AL((!(n=BB(kpn(e),79)).c&&(n.c=new hK(KOt,n,5,8)),n.c));a.e!=a.i.gc();){if(Ctn(PTn(c=BB(kpn(a),82)),i))return!0;if(PTn(c)==i&&qy(TD(ZAn(n,(sWn(),PSt)))))return!0}for(t=new AL(BB(this.f,118).xg());t.e!=t.i.gc();)for(r=new AL((!(n=BB(kpn(t),79)).b&&(n.b=new hK(KOt,n,4,7)),n.b));r.e!=r.i.gc();)if(Ctn(PTn(BB(kpn(r),82)),i))return!0;return!1},MWn.a=null,MWn.b=null,MWn.c=null,vX(H5n,"ElkGraphAdapters/ElkPortAdapter",1266),wAn(1267,1,MYn,to),MWn.ue=function(n,t){return GRn(BB(n,118),BB(t,118))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(H5n,"ElkGraphAdapters/PortComparator",1267);var dOt,gOt,pOt,vOt,mOt,yOt,kOt,jOt,EOt,TOt,MOt,SOt,POt,COt,IOt,OOt,AOt,$Ot,LOt=bq(q5n,"EObject"),NOt=bq(G5n,z5n),xOt=bq(G5n,U5n),DOt=bq(G5n,X5n),ROt=bq(G5n,"ElkShape"),KOt=bq(G5n,W5n),_Ot=bq(G5n,V5n),FOt=bq(G5n,Q5n),BOt=bq(q5n,Y5n),HOt=bq(q5n,"EFactory"),qOt=bq(q5n,J5n),GOt=bq(q5n,"EPackage"),zOt=bq(G5n,Z5n),UOt=bq(G5n,n6n),XOt=bq(G5n,t6n);wAn(90,1,e6n),MWn.Jg=function(){return this.Kg(),null},MWn.Kg=function(){return null},MWn.Lg=function(){return this.Kg(),!1},MWn.Mg=function(){return!1},MWn.Ng=function(n){ban(this,n)},vX(i6n,"BasicNotifierImpl",90),wAn(97,90,f6n),MWn.nh=function(){return mA(this)},MWn.Og=function(n,t){return n},MWn.Pg=function(){throw Hp(new pv)},MWn.Qg=function(n){var t;return t=Cvn(BB(itn(this.Tg(),this.Vg()),18)),this.eh().ih(this,t.n,t.f,n)},MWn.Rg=function(n,t){throw Hp(new pv)},MWn.Sg=function(n,t,e){return T_n(this,n,t,e)},MWn.Tg=function(){var n;return this.Pg()&&(n=this.Pg().ck())?n:this.zh()},MWn.Ug=function(){return cAn(this)},MWn.Vg=function(){throw Hp(new pv)},MWn.Wg=function(){var n,t;return!(t=this.ph().dk())&&this.Pg().ik((QM(),t=null==(n=lJ(qFn(this.Tg())))?N$t:new QN(this,n))),t},MWn.Xg=function(n,t){return n},MWn.Yg=function(n){return n.Gj()?n.aj():Awn(this.Tg(),n)},MWn.Zg=function(){var n;return(n=this.Pg())?n.fk():null},MWn.$g=function(){return this.Pg()?this.Pg().ck():null},MWn._g=function(n,t,e){return Zpn(this,n,t,e)},MWn.ah=function(n){return S9(this,n)},MWn.bh=function(n,t){return V5(this,n,t)},MWn.dh=function(){var n;return!!(n=this.Pg())&&n.gk()},MWn.eh=function(){throw Hp(new pv)},MWn.fh=function(){return Ydn(this)},MWn.gh=function(n,t,e,i){return Npn(this,n,t,i)},MWn.hh=function(n,t,e){return BB(itn(this.Tg(),t),66).Nj().Qj(this,this.yh(),t-this.Ah(),n,e)},MWn.ih=function(n,t,e,i){return oJ(this,n,t,i)},MWn.jh=function(n,t,e){return BB(itn(this.Tg(),t),66).Nj().Rj(this,this.yh(),t-this.Ah(),n,e)},MWn.kh=function(){return!!this.Pg()&&!!this.Pg().ek()},MWn.lh=function(n){return vpn(this,n)},MWn.mh=function(n){return ZJ(this,n)},MWn.oh=function(n){return _qn(this,n)},MWn.ph=function(){throw Hp(new pv)},MWn.qh=function(){return this.Pg()?this.Pg().ek():null},MWn.rh=function(){return Ydn(this)},MWn.sh=function(n,t){yCn(this,n,t)},MWn.th=function(n){this.ph().hk(n)},MWn.uh=function(n){this.ph().kk(n)},MWn.vh=function(n){this.ph().jk(n)},MWn.wh=function(n,t){var e,i,r,c;return(c=this.Zg())&&n&&(t=_pn(c.Vk(),this,t),c.Zk(this)),(i=this.eh())&&(0!=(gKn(this,this.eh(),this.Vg()).Bb&BQn)?(r=i.fh())&&(n?!c&&r.Zk(this):r.Yk(this)):(t=(e=this.Vg())>=0?this.Qg(t):this.eh().ih(this,-1-e,null,t),t=this.Sg(null,-1,t))),this.uh(n),t},MWn.xh=function(n){var t,e,i,r,c,a,u;if((c=Awn(e=this.Tg(),n))>=(t=this.Ah()))return BB(n,66).Nj().Uj(this,this.yh(),c-t);if(c<=-1){if(!(a=Fqn((IPn(),Z$t),e,n)))throw Hp(new _y(r6n+n.ne()+u6n));if(ZM(),BB(a,66).Oj()||(a=Z1(B7(Z$t,a))),r=BB((i=this.Yg(a))>=0?this._g(i,!0,!0):cOn(this,a,!0),153),(u=a.Zj())>1||-1==u)return BB(BB(r,215).hl(n,!1),76)}else if(n.$j())return BB((i=this.Yg(n))>=0?this._g(i,!1,!0):cOn(this,n,!1),76);return new II(this,n)},MWn.yh=function(){return Q7(this)},MWn.zh=function(){return(QX(),t$t).S},MWn.Ah=function(){return bX(this.zh())},MWn.Bh=function(n){mPn(this,n)},MWn.Ib=function(){return P$n(this)},vX(l6n,"BasicEObjectImpl",97),wAn(114,97,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1}),MWn.Ch=function(n){return Y7(this)[n]},MWn.Dh=function(n,t){$X(Y7(this),n,t)},MWn.Eh=function(n){$X(Y7(this),n,null)},MWn.Jg=function(){return BB(yan(this,4),126)},MWn.Kg=function(){throw Hp(new pv)},MWn.Lg=function(){return 0!=(4&this.Db)},MWn.Pg=function(){throw Hp(new pv)},MWn.Fh=function(n){hgn(this,2,n)},MWn.Rg=function(n,t){this.Db=t<<16|255&this.Db,this.Fh(n)},MWn.Tg=function(){return jY(this)},MWn.Vg=function(){return this.Db>>16},MWn.Wg=function(){var n;return QM(),null==(n=lJ(qFn(BB(yan(this,16),26)||this.zh())))?N$t:new QN(this,n)},MWn.Mg=function(){return 0==(1&this.Db)},MWn.Zg=function(){return BB(yan(this,128),1935)},MWn.$g=function(){return BB(yan(this,16),26)},MWn.dh=function(){return 0!=(32&this.Db)},MWn.eh=function(){return BB(yan(this,2),49)},MWn.kh=function(){return 0!=(64&this.Db)},MWn.ph=function(){throw Hp(new pv)},MWn.qh=function(){return BB(yan(this,64),281)},MWn.th=function(n){hgn(this,16,n)},MWn.uh=function(n){hgn(this,128,n)},MWn.vh=function(n){hgn(this,64,n)},MWn.yh=function(){return fgn(this)},MWn.Db=0,vX(l6n,"MinimalEObjectImpl",114),wAn(115,114,{105:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn.Fh=function(n){this.Cb=n},MWn.eh=function(){return this.Cb},vX(l6n,"MinimalEObjectImpl/Container",115),wAn(1985,115,{105:1,413:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return Eyn(this,n,t,e)},MWn.jh=function(n,t,e){return eSn(this,n,t,e)},MWn.lh=function(n){return m0(this,n)},MWn.sh=function(n,t){rsn(this,n,t)},MWn.zh=function(){return CXn(),POt},MWn.Bh=function(n){zun(this,n)},MWn.Ve=function(){return lpn(this)},MWn.We=function(n){return ZAn(this,n)},MWn.Xe=function(n){return P8(this,n)},MWn.Ye=function(n,t){return Ypn(this,n,t)},vX(b6n,"EMapPropertyHolderImpl",1985),wAn(567,115,{105:1,469:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},ro),MWn._g=function(n,t,e){switch(n){case 0:return this.a;case 1:return this.b}return Zpn(this,n,t,e)},MWn.lh=function(n){switch(n){case 0:return 0!=this.a;case 1:return 0!=this.b}return vpn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return void jen(this,Gy(MD(t)));case 1:return void Een(this,Gy(MD(t)))}yCn(this,n,t)},MWn.zh=function(){return CXn(),pOt},MWn.Bh=function(n){switch(n){case 0:return void jen(this,0);case 1:return void Een(this,0)}mPn(this,n)},MWn.Ib=function(){var n;return 0!=(64&this.Db)?P$n(this):((n=new fN(P$n(this))).a+=" (x: ",vE(n,this.a),n.a+=", y: ",vE(n,this.b),n.a+=")",n.a)},MWn.a=0,MWn.b=0,vX(b6n,"ElkBendPointImpl",567),wAn(723,1985,{105:1,413:1,160:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return _fn(this,n,t,e)},MWn.hh=function(n,t,e){return FTn(this,n,t,e)},MWn.jh=function(n,t,e){return run(this,n,t,e)},MWn.lh=function(n){return Ean(this,n)},MWn.sh=function(n,t){Gjn(this,n,t)},MWn.zh=function(){return CXn(),kOt},MWn.Bh=function(n){ofn(this,n)},MWn.zg=function(){return this.k},MWn.Ag=function(){return mV(this)},MWn.Ib=function(){return Yln(this)},MWn.k=null,vX(b6n,"ElkGraphElementImpl",723),wAn(724,723,{105:1,413:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return Rbn(this,n,t,e)},MWn.lh=function(n){return fwn(this,n)},MWn.sh=function(n,t){zjn(this,n,t)},MWn.zh=function(){return CXn(),SOt},MWn.Bh=function(n){Dwn(this,n)},MWn.Bg=function(){return this.f},MWn.Cg=function(){return this.g},MWn.Dg=function(){return this.i},MWn.Eg=function(){return this.j},MWn.Fg=function(n,t){MA(this,n,t)},MWn.Gg=function(n,t){SA(this,n,t)},MWn.Hg=function(n){Pen(this,n)},MWn.Ig=function(n){Cen(this,n)},MWn.Ib=function(){return mSn(this)},MWn.f=0,MWn.g=0,MWn.i=0,MWn.j=0,vX(b6n,"ElkShapeImpl",724),wAn(725,724,{105:1,413:1,82:1,160:1,470:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1}),MWn._g=function(n,t,e){return Hvn(this,n,t,e)},MWn.hh=function(n,t,e){return djn(this,n,t,e)},MWn.jh=function(n,t,e){return gjn(this,n,t,e)},MWn.lh=function(n){return Gon(this,n)},MWn.sh=function(n,t){LAn(this,n,t)},MWn.zh=function(){return CXn(),vOt},MWn.Bh=function(n){xpn(this,n)},MWn.xg=function(){return!this.d&&(this.d=new hK(_Ot,this,8,5)),this.d},MWn.yg=function(){return!this.e&&(this.e=new hK(_Ot,this,7,4)),this.e},vX(b6n,"ElkConnectableShapeImpl",725),wAn(352,723,{105:1,413:1,79:1,160:1,352:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},io),MWn.Qg=function(n){return Mkn(this,n)},MWn._g=function(n,t,e){switch(n){case 3:return XJ(this);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),this.b;case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),this.c;case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),this.a;case 7:return hN(),!this.b&&(this.b=new hK(KOt,this,4,7)),!(this.b.i<=1&&(!this.c&&(this.c=new hK(KOt,this,5,8)),this.c.i<=1));case 8:return hN(),!!nAn(this);case 9:return hN(),!!QIn(this);case 10:return hN(),!this.b&&(this.b=new hK(KOt,this,4,7)),0!=this.b.i&&(!this.c&&(this.c=new hK(KOt,this,5,8)),0!=this.c.i)}return _fn(this,n,t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 3:return this.Cb&&(e=(i=this.Db>>16)>=0?Mkn(this,e):this.Cb.ih(this,-1-i,null,e)),VD(this,BB(n,33),e);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),Ywn(this.b,n,e);case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),Ywn(this.c,n,e);case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),Ywn(this.a,n,e)}return FTn(this,n,t,e)},MWn.jh=function(n,t,e){switch(t){case 3:return VD(this,null,e);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),_pn(this.b,n,e);case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),_pn(this.c,n,e);case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),_pn(this.a,n,e)}return run(this,n,t,e)},MWn.lh=function(n){switch(n){case 3:return!!XJ(this);case 4:return!!this.b&&0!=this.b.i;case 5:return!!this.c&&0!=this.c.i;case 6:return!!this.a&&0!=this.a.i;case 7:return!this.b&&(this.b=new hK(KOt,this,4,7)),!(this.b.i<=1&&(!this.c&&(this.c=new hK(KOt,this,5,8)),this.c.i<=1));case 8:return nAn(this);case 9:return QIn(this);case 10:return!this.b&&(this.b=new hK(KOt,this,4,7)),0!=this.b.i&&(!this.c&&(this.c=new hK(KOt,this,5,8)),0!=this.c.i)}return Ean(this,n)},MWn.sh=function(n,t){switch(n){case 3:return void HLn(this,BB(t,33));case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),sqn(this.b),!this.b&&(this.b=new hK(KOt,this,4,7)),void pX(this.b,BB(t,14));case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),sqn(this.c),!this.c&&(this.c=new hK(KOt,this,5,8)),void pX(this.c,BB(t,14));case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),sqn(this.a),!this.a&&(this.a=new eU(FOt,this,6,6)),void pX(this.a,BB(t,14))}Gjn(this,n,t)},MWn.zh=function(){return CXn(),mOt},MWn.Bh=function(n){switch(n){case 3:return void HLn(this,null);case 4:return!this.b&&(this.b=new hK(KOt,this,4,7)),void sqn(this.b);case 5:return!this.c&&(this.c=new hK(KOt,this,5,8)),void sqn(this.c);case 6:return!this.a&&(this.a=new eU(FOt,this,6,6)),void sqn(this.a)}ofn(this,n)},MWn.Ib=function(){return lHn(this)},vX(b6n,"ElkEdgeImpl",352),wAn(439,1985,{105:1,413:1,202:1,439:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},co),MWn.Qg=function(n){return skn(this,n)},MWn._g=function(n,t,e){switch(n){case 1:return this.j;case 2:return this.k;case 3:return this.b;case 4:return this.c;case 5:return!this.a&&(this.a=new $L(xOt,this,5)),this.a;case 6:return VJ(this);case 7:return t?Pvn(this):this.i;case 8:return t?Svn(this):this.f;case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),this.g;case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),this.e;case 11:return this.d}return Eyn(this,n,t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?skn(this,e):this.Cb.ih(this,-1-i,null,e)),QD(this,BB(n,79),e);case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),Ywn(this.g,n,e);case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),Ywn(this.e,n,e)}return BB(itn(BB(yan(this,16),26)||(CXn(),yOt),t),66).Nj().Qj(this,fgn(this),t-bX((CXn(),yOt)),n,e)},MWn.jh=function(n,t,e){switch(t){case 5:return!this.a&&(this.a=new $L(xOt,this,5)),_pn(this.a,n,e);case 6:return QD(this,null,e);case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),_pn(this.g,n,e);case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),_pn(this.e,n,e)}return eSn(this,n,t,e)},MWn.lh=function(n){switch(n){case 1:return 0!=this.j;case 2:return 0!=this.k;case 3:return 0!=this.b;case 4:return 0!=this.c;case 5:return!!this.a&&0!=this.a.i;case 6:return!!VJ(this);case 7:return!!this.i;case 8:return!!this.f;case 9:return!!this.g&&0!=this.g.i;case 10:return!!this.e&&0!=this.e.i;case 11:return null!=this.d}return m0(this,n)},MWn.sh=function(n,t){switch(n){case 1:return void Ien(this,Gy(MD(t)));case 2:return void Aen(this,Gy(MD(t)));case 3:return void Ten(this,Gy(MD(t)));case 4:return void Oen(this,Gy(MD(t)));case 5:return!this.a&&(this.a=new $L(xOt,this,5)),sqn(this.a),!this.a&&(this.a=new $L(xOt,this,5)),void pX(this.a,BB(t,14));case 6:return void FLn(this,BB(t,79));case 7:return void Nin(this,BB(t,82));case 8:return void Lin(this,BB(t,82));case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),sqn(this.g),!this.g&&(this.g=new hK(FOt,this,9,10)),void pX(this.g,BB(t,14));case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),sqn(this.e),!this.e&&(this.e=new hK(FOt,this,10,9)),void pX(this.e,BB(t,14));case 11:return void crn(this,SD(t))}rsn(this,n,t)},MWn.zh=function(){return CXn(),yOt},MWn.Bh=function(n){switch(n){case 1:return void Ien(this,0);case 2:return void Aen(this,0);case 3:return void Ten(this,0);case 4:return void Oen(this,0);case 5:return!this.a&&(this.a=new $L(xOt,this,5)),void sqn(this.a);case 6:return void FLn(this,null);case 7:return void Nin(this,null);case 8:return void Lin(this,null);case 9:return!this.g&&(this.g=new hK(FOt,this,9,10)),void sqn(this.g);case 10:return!this.e&&(this.e=new hK(FOt,this,10,9)),void sqn(this.e);case 11:return void crn(this,null)}zun(this,n)},MWn.Ib=function(){return ROn(this)},MWn.b=0,MWn.c=0,MWn.d=null,MWn.j=0,MWn.k=0,vX(b6n,"ElkEdgeSectionImpl",439),wAn(150,115,{105:1,92:1,90:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1}),MWn._g=function(n,t,e){return 0==n?(!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab):U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.hh=function(n,t,e){return 0==t?(!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e)):BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Qj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.jh=function(n,t,e){return 0==t?(!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e)):BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){return 0==n?!!this.Ab&&0!=this.Ab.i:O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.oh=function(n){return hUn(this,n)},MWn.sh=function(n,t){if(0===n)return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.uh=function(n){hgn(this,128,n)},MWn.zh=function(){return gWn(),b$t},MWn.Bh=function(n){if(0===n)return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){this.Bb|=1},MWn.Hh=function(n){return N_n(this,n)},MWn.Bb=0,vX(l6n,"EModelElementImpl",150),wAn(704,150,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},Rf),MWn.Ih=function(n,t){return qGn(this,n,t)},MWn.Jh=function(n){var t,e,i,r;if(this.a!=Utn(n)||0!=(256&n.Bb))throw Hp(new _y(m6n+n.zb+g6n));for(e=kY(n);0!=a4(e.a).i;){if(iyn(t=BB(eGn(e,0,cL(r=BB(Wtn(a4(e.a),0),87).c,88)?BB(r,26):(gWn(),d$t)),26)))return BB(i=Utn(t).Nh().Jh(t),49).th(n),i;e=kY(t)}return"java.util.Map$Entry"==(null!=n.D?n.D:n.B)?new fq(n):new jH(n)},MWn.Kh=function(n,t){return xXn(this,n,t)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.a}return U9(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n),t,e)},MWn.hh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 1:return this.a&&(e=BB(this.a,49).ih(this,4,GOt,e)),Jhn(this,BB(n,235),e)}return BB(itn(BB(yan(this,16),26)||(gWn(),h$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),h$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 1:return Jhn(this,null,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),h$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),h$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return!!this.a}return O3(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void xMn(this,BB(t,235))}Lbn(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n),t)},MWn.zh=function(){return gWn(),h$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void xMn(this,null)}qfn(this,n-bX((gWn(),h$t)),itn(BB(yan(this,16),26)||h$t,n))},vX(l6n,"EFactoryImpl",704),wAn(k6n,704,{105:1,2014:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1},ao),MWn.Ih=function(n,t){switch(n.yj()){case 12:return BB(t,146).tg();case 13:return Bbn(t);default:throw Hp(new _y(d6n+n.ne()+g6n))}},MWn.Jh=function(n){var t;switch(-1==n.G&&(n.G=(t=Utn(n))?uvn(t.Mh(),n):-1),n.G){case 4:return new uo;case 6:return new jm;case 7:return new Em;case 8:return new io;case 9:return new ro;case 10:return new co;case 11:return new so;default:throw Hp(new _y(m6n+n.zb+g6n))}},MWn.Kh=function(n,t){switch(n.yj()){case 13:case 12:return null;default:throw Hp(new _y(d6n+n.ne()+g6n))}},vX(b6n,"ElkGraphFactoryImpl",k6n),wAn(438,150,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1}),MWn.Wg=function(){var n;return null==(n=lJ(qFn(BB(yan(this,16),26)||this.zh())))?(QM(),QM(),N$t):new Wx(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.ne()}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void this.Lh(SD(t))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),w$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void this.Lh(null)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.ne=function(){return this.zb},MWn.Lh=function(n){Nrn(this,n)},MWn.Ib=function(){return kfn(this)},MWn.zb=null,vX(l6n,"ENamedElementImpl",438),wAn(179,438,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},vY),MWn.Qg=function(n){return wkn(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return this.yb;case 3:return this.xb;case 4:return this.sb;case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),this.rb;case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),this.vb;case 7:return t?this.Db>>16==7?BB(this.Cb,235):null:QJ(this)}return U9(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 4:return this.sb&&(e=BB(this.sb,49).ih(this,1,HOt,e)),jfn(this,BB(n,471),e);case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),Ywn(this.rb,n,e);case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),Ywn(this.vb,n,e);case 7:return this.Cb&&(e=(i=this.Db>>16)>=0?wkn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,7,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),v$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),v$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 4:return jfn(this,null,e);case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),_pn(this.rb,n,e);case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),_pn(this.vb,n,e);case 7:return T_n(this,null,7,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),v$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),v$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.yb;case 3:return null!=this.xb;case 4:return!!this.sb;case 5:return!!this.rb&&0!=this.rb.i;case 6:return!!this.vb&&0!=this.vb.i;case 7:return!!QJ(this)}return O3(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n))},MWn.oh=function(n){return LNn(this,n)||hUn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return void Drn(this,SD(t));case 3:return void xrn(this,SD(t));case 4:return void iSn(this,BB(t,471));case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),sqn(this.rb),!this.rb&&(this.rb=new Jz(this,HAt,this)),void pX(this.rb,BB(t,14));case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),sqn(this.vb),!this.vb&&(this.vb=new eK(GOt,this,6,7)),void pX(this.vb,BB(t,14))}Lbn(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n),t)},MWn.vh=function(n){var t,e;if(n&&this.rb)for(e=new AL(this.rb);e.e!=e.i.gc();)cL(t=kpn(e),351)&&(BB(t,351).w=null);hgn(this,64,n)},MWn.zh=function(){return gWn(),v$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return void Drn(this,null);case 3:return void xrn(this,null);case 4:return void iSn(this,null);case 5:return!this.rb&&(this.rb=new Jz(this,HAt,this)),void sqn(this.rb);case 6:return!this.vb&&(this.vb=new eK(GOt,this,6,7)),void sqn(this.vb)}qfn(this,n-bX((gWn(),v$t)),itn(BB(yan(this,16),26)||v$t,n))},MWn.Gh=function(){Tyn(this)},MWn.Mh=function(){return!this.rb&&(this.rb=new Jz(this,HAt,this)),this.rb},MWn.Nh=function(){return this.sb},MWn.Oh=function(){return this.ub},MWn.Ph=function(){return this.xb},MWn.Qh=function(){return this.yb},MWn.Rh=function(n){this.ub=n},MWn.Ib=function(){var n;return 0!=(64&this.Db)?kfn(this):((n=new fN(kfn(this))).a+=" (nsURI: ",cO(n,this.yb),n.a+=", nsPrefix: ",cO(n,this.xb),n.a+=")",n.a)},MWn.xb=null,MWn.yb=null,vX(l6n,"EPackageImpl",179),wAn(555,179,{105:1,2016:1,555:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1},sAn),MWn.q=!1,MWn.r=!1;var WOt=!1;vX(b6n,"ElkGraphPackageImpl",555),wAn(354,724,{105:1,413:1,160:1,137:1,470:1,354:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},uo),MWn.Qg=function(n){return hkn(this,n)},MWn._g=function(n,t,e){switch(n){case 7:return YJ(this);case 8:return this.a}return Rbn(this,n,t,e)},MWn.hh=function(n,t,e){var i;return 7===t?(this.Cb&&(e=(i=this.Db>>16)>=0?hkn(this,e):this.Cb.ih(this,-1-i,null,e)),VG(this,BB(n,160),e)):FTn(this,n,t,e)},MWn.jh=function(n,t,e){return 7==t?VG(this,null,e):run(this,n,t,e)},MWn.lh=function(n){switch(n){case 7:return!!YJ(this);case 8:return!mK("",this.a)}return fwn(this,n)},MWn.sh=function(n,t){switch(n){case 7:return void INn(this,BB(t,160));case 8:return void xin(this,SD(t))}zjn(this,n,t)},MWn.zh=function(){return CXn(),jOt},MWn.Bh=function(n){switch(n){case 7:return void INn(this,null);case 8:return void xin(this,"")}Dwn(this,n)},MWn.Ib=function(){return cPn(this)},MWn.a="",vX(b6n,"ElkLabelImpl",354),wAn(239,725,{105:1,413:1,82:1,160:1,33:1,470:1,239:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},jm),MWn.Qg=function(n){return Skn(this,n)},MWn._g=function(n,t,e){switch(n){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),this.c;case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),this.a;case 11:return JJ(this);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),this.b;case 13:return hN(),!this.a&&(this.a=new eU(UOt,this,10,11)),this.a.i>0}return Hvn(this,n,t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),Ywn(this.c,n,e);case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),Ywn(this.a,n,e);case 11:return this.Cb&&(e=(i=this.Db>>16)>=0?Skn(this,e):this.Cb.ih(this,-1-i,null,e)),zR(this,BB(n,33),e);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),Ywn(this.b,n,e)}return djn(this,n,t,e)},MWn.jh=function(n,t,e){switch(t){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),_pn(this.c,n,e);case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),_pn(this.a,n,e);case 11:return zR(this,null,e);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),_pn(this.b,n,e)}return gjn(this,n,t,e)},MWn.lh=function(n){switch(n){case 9:return!!this.c&&0!=this.c.i;case 10:return!!this.a&&0!=this.a.i;case 11:return!!JJ(this);case 12:return!!this.b&&0!=this.b.i;case 13:return!this.a&&(this.a=new eU(UOt,this,10,11)),this.a.i>0}return Gon(this,n)},MWn.sh=function(n,t){switch(n){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),sqn(this.c),!this.c&&(this.c=new eU(XOt,this,9,9)),void pX(this.c,BB(t,14));case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),sqn(this.a),!this.a&&(this.a=new eU(UOt,this,10,11)),void pX(this.a,BB(t,14));case 11:return void nNn(this,BB(t,33));case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),sqn(this.b),!this.b&&(this.b=new eU(_Ot,this,12,3)),void pX(this.b,BB(t,14))}LAn(this,n,t)},MWn.zh=function(){return CXn(),EOt},MWn.Bh=function(n){switch(n){case 9:return!this.c&&(this.c=new eU(XOt,this,9,9)),void sqn(this.c);case 10:return!this.a&&(this.a=new eU(UOt,this,10,11)),void sqn(this.a);case 11:return void nNn(this,null);case 12:return!this.b&&(this.b=new eU(_Ot,this,12,3)),void sqn(this.b)}xpn(this,n)},MWn.Ib=function(){return zRn(this)},vX(b6n,"ElkNodeImpl",239),wAn(186,725,{105:1,413:1,82:1,160:1,118:1,470:1,186:1,94:1,92:1,90:1,56:1,108:1,49:1,97:1,114:1,115:1},Em),MWn.Qg=function(n){return fkn(this,n)},MWn._g=function(n,t,e){return 9==n?WJ(this):Hvn(this,n,t,e)},MWn.hh=function(n,t,e){var i;return 9===t?(this.Cb&&(e=(i=this.Db>>16)>=0?fkn(this,e):this.Cb.ih(this,-1-i,null,e)),YD(this,BB(n,33),e)):djn(this,n,t,e)},MWn.jh=function(n,t,e){return 9==t?YD(this,null,e):gjn(this,n,t,e)},MWn.lh=function(n){return 9==n?!!WJ(this):Gon(this,n)},MWn.sh=function(n,t){9!==n?LAn(this,n,t):BLn(this,BB(t,33))},MWn.zh=function(){return CXn(),TOt},MWn.Bh=function(n){9!==n?xpn(this,n):BLn(this,null)},MWn.Ib=function(){return URn(this)},vX(b6n,"ElkPortImpl",186);var VOt=bq(B6n,"BasicEMap/Entry");wAn(1092,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,114:1,115:1},so),MWn.Fb=function(n){return this===n},MWn.cd=function(){return this.b},MWn.Hb=function(){return PN(this)},MWn.Uh=function(n){Din(this,BB(n,146))},MWn._g=function(n,t,e){switch(n){case 0:return this.b;case 1:return this.c}return Zpn(this,n,t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.b;case 1:return null!=this.c}return vpn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return void Din(this,BB(t,146));case 1:return void _in(this,t)}yCn(this,n,t)},MWn.zh=function(){return CXn(),MOt},MWn.Bh=function(n){switch(n){case 0:return void Din(this,null);case 1:return void _in(this,null)}mPn(this,n)},MWn.Sh=function(){var n;return-1==this.a&&(n=this.b,this.a=n?nsn(n):0),this.a},MWn.dd=function(){return this.c},MWn.Th=function(n){this.a=n},MWn.ed=function(n){var t;return t=this.c,_in(this,n),t},MWn.Ib=function(){var n;return 0!=(64&this.Db)?P$n(this):(oO(oO(oO(n=new Ck,this.b?this.b.tg():zWn),e1n),kN(this.c)),n.a)},MWn.a=-1,MWn.c=null;var QOt,YOt,JOt,ZOt,nAt,tAt,eAt,iAt,rAt=vX(b6n,"ElkPropertyToValueMapEntryImpl",1092);wAn(984,1,{},lo),vX(G6n,"JsonAdapter",984),wAn(210,60,BVn,ek),vX(G6n,"JsonImportException",210),wAn(857,1,{},dkn),vX(G6n,"JsonImporter",857),wAn(891,1,{},aI),vX(G6n,"JsonImporter/lambda$0$Type",891),wAn(892,1,{},uI),vX(G6n,"JsonImporter/lambda$1$Type",892),wAn(900,1,{},$g),vX(G6n,"JsonImporter/lambda$10$Type",900),wAn(902,1,{},oI),vX(G6n,"JsonImporter/lambda$11$Type",902),wAn(903,1,{},sI),vX(G6n,"JsonImporter/lambda$12$Type",903),wAn(909,1,{},fQ),vX(G6n,"JsonImporter/lambda$13$Type",909),wAn(908,1,{},hQ),vX(G6n,"JsonImporter/lambda$14$Type",908),wAn(904,1,{},hI),vX(G6n,"JsonImporter/lambda$15$Type",904),wAn(905,1,{},fI),vX(G6n,"JsonImporter/lambda$16$Type",905),wAn(906,1,{},lI),vX(G6n,"JsonImporter/lambda$17$Type",906),wAn(907,1,{},bI),vX(G6n,"JsonImporter/lambda$18$Type",907),wAn(912,1,{},Lg),vX(G6n,"JsonImporter/lambda$19$Type",912),wAn(893,1,{},Ng),vX(G6n,"JsonImporter/lambda$2$Type",893),wAn(910,1,{},xg),vX(G6n,"JsonImporter/lambda$20$Type",910),wAn(911,1,{},Dg),vX(G6n,"JsonImporter/lambda$21$Type",911),wAn(915,1,{},Rg),vX(G6n,"JsonImporter/lambda$22$Type",915),wAn(913,1,{},Kg),vX(G6n,"JsonImporter/lambda$23$Type",913),wAn(914,1,{},_g),vX(G6n,"JsonImporter/lambda$24$Type",914),wAn(917,1,{},Fg),vX(G6n,"JsonImporter/lambda$25$Type",917),wAn(916,1,{},Bg),vX(G6n,"JsonImporter/lambda$26$Type",916),wAn(918,1,lVn,wI),MWn.td=function(n){E9(this.b,this.a,SD(n))},vX(G6n,"JsonImporter/lambda$27$Type",918),wAn(919,1,lVn,dI),MWn.td=function(n){T9(this.b,this.a,SD(n))},vX(G6n,"JsonImporter/lambda$28$Type",919),wAn(920,1,{},gI),vX(G6n,"JsonImporter/lambda$29$Type",920),wAn(896,1,{},Hg),vX(G6n,"JsonImporter/lambda$3$Type",896),wAn(921,1,{},pI),vX(G6n,"JsonImporter/lambda$30$Type",921),wAn(922,1,{},qg),vX(G6n,"JsonImporter/lambda$31$Type",922),wAn(923,1,{},Gg),vX(G6n,"JsonImporter/lambda$32$Type",923),wAn(924,1,{},zg),vX(G6n,"JsonImporter/lambda$33$Type",924),wAn(925,1,{},Ug),vX(G6n,"JsonImporter/lambda$34$Type",925),wAn(859,1,{},Xg),vX(G6n,"JsonImporter/lambda$35$Type",859),wAn(929,1,{},MB),vX(G6n,"JsonImporter/lambda$36$Type",929),wAn(926,1,lVn,Wg),MWn.td=function(n){Y4(this.a,BB(n,469))},vX(G6n,"JsonImporter/lambda$37$Type",926),wAn(927,1,lVn,SI),MWn.td=function(n){lO(this.a,this.b,BB(n,202))},vX(G6n,"JsonImporter/lambda$38$Type",927),wAn(928,1,lVn,PI),MWn.td=function(n){bO(this.a,this.b,BB(n,202))},vX(G6n,"JsonImporter/lambda$39$Type",928),wAn(894,1,{},Vg),vX(G6n,"JsonImporter/lambda$4$Type",894),wAn(930,1,lVn,Qg),MWn.td=function(n){J4(this.a,BB(n,8))},vX(G6n,"JsonImporter/lambda$40$Type",930),wAn(895,1,{},Yg),vX(G6n,"JsonImporter/lambda$5$Type",895),wAn(899,1,{},Jg),vX(G6n,"JsonImporter/lambda$6$Type",899),wAn(897,1,{},Zg),vX(G6n,"JsonImporter/lambda$7$Type",897),wAn(898,1,{},np),vX(G6n,"JsonImporter/lambda$8$Type",898),wAn(901,1,{},tp),vX(G6n,"JsonImporter/lambda$9$Type",901),wAn(948,1,lVn,ep),MWn.td=function(n){nW(this.a,new GX(SD(n)))},vX(G6n,"JsonMetaDataConverter/lambda$0$Type",948),wAn(949,1,lVn,ip),MWn.td=function(n){_X(this.a,BB(n,237))},vX(G6n,"JsonMetaDataConverter/lambda$1$Type",949),wAn(950,1,lVn,rp),MWn.td=function(n){t1(this.a,BB(n,149))},vX(G6n,"JsonMetaDataConverter/lambda$2$Type",950),wAn(951,1,lVn,cp),MWn.td=function(n){FX(this.a,BB(n,175))},vX(G6n,"JsonMetaDataConverter/lambda$3$Type",951),wAn(237,22,{3:1,35:1,22:1,237:1},MI);var cAt,aAt=Ben(IJn,"GraphFeature",237,Unt,Ktn,pB);wAn(13,1,{35:1,146:1},up,iR,$O,XA),MWn.wd=function(n){return pL(this,BB(n,146))},MWn.Fb=function(n){return EY(this,n)},MWn.wg=function(){return mpn(this)},MWn.tg=function(){return this.b},MWn.Hb=function(){return vvn(this.b)},MWn.Ib=function(){return this.b},vX(IJn,"Property",13),wAn(818,1,MYn,ap),MWn.ue=function(n,t){return _ln(this,BB(n,94),BB(t,94))},MWn.Fb=function(n){return this===n},MWn.ve=function(){return new nw(this)},vX(IJn,"PropertyHolderComparator",818),wAn(695,1,QWn,sp),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return A9(this)},MWn.Qb=function(){uE()},MWn.Ob=function(){return!!this.a},vX(c8n,"ElkGraphUtil/AncestorIterator",695);var uAt=bq(B6n,"EList");wAn(67,52,{20:1,28:1,52:1,14:1,15:1,67:1,58:1}),MWn.Vc=function(n,t){sln(this,n,t)},MWn.Fc=function(n){return f9(this,n)},MWn.Wc=function(n,t){return oon(this,n,t)},MWn.Gc=function(n){return pX(this,n)},MWn.Zh=function(){return new ax(this)},MWn.$h=function(){return new ux(this)},MWn._h=function(n){return sin(this,n)},MWn.ai=function(){return!0},MWn.bi=function(n,t){},MWn.ci=function(){},MWn.di=function(n,t){L8(this,n,t)},MWn.ei=function(n,t,e){},MWn.fi=function(n,t){},MWn.gi=function(n,t,e){},MWn.Fb=function(n){return QDn(this,n)},MWn.Hb=function(){return Mun(this)},MWn.hi=function(){return!1},MWn.Kc=function(){return new AL(this)},MWn.Yc=function(){return new cx(this)},MWn.Zc=function(n){var t;if(t=this.gc(),n<0||n>t)throw Hp(new tK(n,t));return new GU(this,n)},MWn.ji=function(n,t){this.ii(n,this.Xc(t))},MWn.Mc=function(n){return snn(this,n)},MWn.li=function(n,t){return t},MWn._c=function(n,t){return ovn(this,n,t)},MWn.Ib=function(){return Jbn(this)},MWn.ni=function(){return!0},MWn.oi=function(n,t){return xsn(this,t)},vX(B6n,"AbstractEList",67),wAn(63,67,h8n,go,gtn,jcn),MWn.Vh=function(n,t){return BTn(this,n,t)},MWn.Wh=function(n){return bmn(this,n)},MWn.Xh=function(n,t){Ifn(this,n,t)},MWn.Yh=function(n){c6(this,n)},MWn.pi=function(n){return F9(this,n)},MWn.$b=function(){a6(this)},MWn.Hc=function(n){return Sjn(this,n)},MWn.Xb=function(n){return Wtn(this,n)},MWn.qi=function(n){var t,e,i;++this.j,n>(e=null==this.g?0:this.g.length)&&(i=this.g,(t=e+(e/2|0)+4)<n&&(t=n),this.g=this.ri(t),null!=i&&aHn(i,0,this.g,0,this.i))},MWn.Xc=function(n){return Wyn(this,n)},MWn.dc=function(){return 0==this.i},MWn.ii=function(n,t){return YIn(this,n,t)},MWn.ri=function(n){return x8(Ant,HWn,1,n,5,1)},MWn.ki=function(n){return this.g[n]},MWn.$c=function(n){return Lyn(this,n)},MWn.mi=function(n,t){return onn(this,n,t)},MWn.gc=function(){return this.i},MWn.Pc=function(){return N3(this)},MWn.Qc=function(n){return Qwn(this,n)},MWn.i=0;var oAt=vX(B6n,"BasicEList",63),sAt=bq(B6n,"TreeIterator");wAn(694,63,f8n),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return null!=this.g||this.c?null==this.g||0!=this.i&&BB(this.g[this.i-1],47).Ob():tZ(this)},MWn.Pb=function(){return aLn(this)},MWn.Qb=function(){if(!this.e)throw Hp(new Fy("There is no valid object to remove."));this.e.Qb()},MWn.c=!1,vX(B6n,"AbstractTreeIterator",694),wAn(685,694,f8n,OA),MWn.si=function(n){var t;return cL(t=BB(n,56).Wg().Kc(),279)&&BB(t,279).Nk(new bo),t},vX(c8n,"ElkGraphUtil/PropertiesSkippingTreeIterator",685),wAn(952,1,{},bo),vX(c8n,"ElkGraphUtil/PropertiesSkippingTreeIterator/1",952);var hAt,fAt,lAt,bAt=vX(c8n,"ElkReflect",null);wAn(889,1,i5n,wo),MWn.vg=function(n){return hZ(),B6(BB(n,174))},vX(c8n,"ElkReflect/lambda$0$Type",889),bq(B6n,"ResourceLocator"),wAn(1051,1,{}),vX(B6n,"DelegatingResourceLocator",1051),wAn(1052,1051,{}),vX("org.eclipse.emf.common","EMFPlugin",1052);var wAt,dAt=bq(J8n,"Adapter"),gAt=bq(J8n,"Notification");wAn(1153,1,Z8n),MWn.ti=function(){return this.d},MWn.ui=function(n){},MWn.vi=function(n){this.d=n},MWn.wi=function(n){this.d==n&&(this.d=null)},MWn.d=null,vX(i6n,"AdapterImpl",1153),wAn(1995,67,n9n),MWn.Vh=function(n,t){return kwn(this,n,t)},MWn.Wh=function(n){var t,e,i;if(++this.j,n.dc())return!1;for(t=this.Vi(),i=n.Kc();i.Ob();)e=i.Pb(),this.Ii(this.oi(t,e)),++t;return!0},MWn.Xh=function(n,t){ZD(this,n,t)},MWn.Yh=function(n){eW(this,n)},MWn.Gi=function(){return this.Ji()},MWn.$b=function(){JD(this,this.Vi(),this.Wi())},MWn.Hc=function(n){return this.Li(n)},MWn.Ic=function(n){return this.Mi(n)},MWn.Hi=function(n,t){this.Si().jm()},MWn.Ii=function(n){this.Si().jm()},MWn.Ji=function(){return this.Si()},MWn.Ki=function(){this.Si().jm()},MWn.Li=function(n){return this.Si().jm()},MWn.Mi=function(n){return this.Si().jm()},MWn.Ni=function(n){return this.Si().jm()},MWn.Oi=function(n){return this.Si().jm()},MWn.Pi=function(){return this.Si().jm()},MWn.Qi=function(n){return this.Si().jm()},MWn.Ri=function(){return this.Si().jm()},MWn.Ti=function(n){return this.Si().jm()},MWn.Ui=function(n,t){return this.Si().jm()},MWn.Vi=function(){return this.Si().jm()},MWn.Wi=function(){return this.Si().jm()},MWn.Xi=function(n){return this.Si().jm()},MWn.Yi=function(){return this.Si().jm()},MWn.Fb=function(n){return this.Ni(n)},MWn.Xb=function(n){return this.li(n,this.Oi(n))},MWn.Hb=function(){return this.Pi()},MWn.Xc=function(n){return this.Qi(n)},MWn.dc=function(){return this.Ri()},MWn.ii=function(n,t){return AMn(this,n,t)},MWn.ki=function(n){return this.Oi(n)},MWn.$c=function(n){return wq(this,n)},MWn.Mc=function(n){var t;return(t=this.Xc(n))>=0&&(this.$c(t),!0)},MWn.mi=function(n,t){return this.Ui(n,this.oi(n,t))},MWn.gc=function(){return this.Vi()},MWn.Pc=function(){return this.Wi()},MWn.Qc=function(n){return this.Xi(n)},MWn.Ib=function(){return this.Yi()},vX(B6n,"DelegatingEList",1995),wAn(1996,1995,n9n),MWn.Vh=function(n,t){return uFn(this,n,t)},MWn.Wh=function(n){return this.Vh(this.Vi(),n)},MWn.Xh=function(n,t){eAn(this,n,t)},MWn.Yh=function(n){OOn(this,n)},MWn.ai=function(){return!this.bj()},MWn.$b=function(){vqn(this)},MWn.Zi=function(n,t,e,i,r){return new NY(this,n,t,e,i,r)},MWn.$i=function(n){ban(this.Ai(),n)},MWn._i=function(){return null},MWn.aj=function(){return-1},MWn.Ai=function(){return null},MWn.bj=function(){return!1},MWn.cj=function(n,t){return t},MWn.dj=function(n,t){return t},MWn.ej=function(){return!1},MWn.fj=function(){return!this.Ri()},MWn.ii=function(n,t){var e,i;return this.ej()?(i=this.fj(),e=AMn(this,n,t),this.$i(this.Zi(7,iln(t),e,n,i)),e):AMn(this,n,t)},MWn.$c=function(n){var t,e,i,r;return this.ej()?(e=null,i=this.fj(),t=this.Zi(4,r=wq(this,n),null,n,i),this.bj()&&r?(e=this.dj(r,e))?(e.Ei(t),e.Fi()):this.$i(t):e?(e.Ei(t),e.Fi()):this.$i(t),r):(r=wq(this,n),this.bj()&&r&&(e=this.dj(r,null))&&e.Fi(),r)},MWn.mi=function(n,t){return oFn(this,n,t)},vX(i6n,"DelegatingNotifyingListImpl",1996),wAn(143,1,t9n),MWn.Ei=function(n){return KEn(this,n)},MWn.Fi=function(){$7(this)},MWn.xi=function(){return this.d},MWn._i=function(){return null},MWn.gj=function(){return null},MWn.yi=function(n){return-1},MWn.zi=function(){return Rxn(this)},MWn.Ai=function(){return null},MWn.Bi=function(){return Kxn(this)},MWn.Ci=function(){return this.o<0?this.o<-2?-2-this.o-1:-1:this.o},MWn.hj=function(){return!1},MWn.Di=function(n){var t,e,i,r,c,a,u,o;switch(this.d){case 1:case 2:switch(n.xi()){case 1:case 2:if(GI(n.Ai())===GI(this.Ai())&&this.yi(null)==n.yi(null))return this.g=n.zi(),1==n.xi()&&(this.d=1),!0}case 4:if(4===n.xi()&&GI(n.Ai())===GI(this.Ai())&&this.yi(null)==n.yi(null))return a=tGn(this),c=this.o<0?this.o<-2?-2-this.o-1:-1:this.o,i=n.Ci(),this.d=6,o=new gtn(2),c<=i?(f9(o,this.n),f9(o,n.Bi()),this.g=Pun(Gk(ANt,1),hQn,25,15,[this.o=c,i+1])):(f9(o,n.Bi()),f9(o,this.n),this.g=Pun(Gk(ANt,1),hQn,25,15,[this.o=i,c])),this.n=o,a||(this.o=-2-this.o-1),!0;break;case 6:if(4===n.xi()&&GI(n.Ai())===GI(this.Ai())&&this.yi(null)==n.yi(null)){for(a=tGn(this),i=n.Ci(),u=BB(this.g,48),e=x8(ANt,hQn,25,u.length+1,15,1),t=0;t<u.length&&(r=u[t])<=i;)e[t++]=r,++i;for(BB(this.n,15).Vc(t,n.Bi()),e[t]=i;++t<e.length;)e[t]=u[t-1];return this.g=e,a||(this.o=-2-e[0]),!0}}return!1},MWn.Ib=function(){var n,t,e;switch((e=new fN(nE(this.gm)+"@"+(nsn(this)>>>0).toString(16))).a+=" (eventType: ",this.d){case 1:e.a+="SET";break;case 2:e.a+="UNSET";break;case 3:e.a+="ADD";break;case 5:e.a+="ADD_MANY";break;case 4:e.a+="REMOVE";break;case 6:e.a+="REMOVE_MANY";break;case 7:e.a+="MOVE";break;case 8:e.a+="REMOVING_ADAPTER";break;case 9:e.a+="RESOLVE";break;default:mE(e,this.d)}if(lKn(this)&&(e.a+=", touch: true"),e.a+=", position: ",mE(e,this.o<0?this.o<-2?-2-this.o-1:-1:this.o),e.a+=", notifier: ",rO(e,this.Ai()),e.a+=", feature: ",rO(e,this._i()),e.a+=", oldValue: ",rO(e,Kxn(this)),e.a+=", newValue: ",6==this.d&&cL(this.g,48)){for(t=BB(this.g,48),e.a+="[",n=0;n<t.length;)e.a+=t[n],++n<t.length&&(e.a+=FWn);e.a+="]"}else rO(e,Rxn(this));return e.a+=", isTouch: ",yE(e,lKn(this)),e.a+=", wasSet: ",yE(e,tGn(this)),e.a+=")",e.a},MWn.d=0,MWn.e=0,MWn.f=0,MWn.j=0,MWn.k=0,MWn.o=0,MWn.p=0,vX(i6n,"NotificationImpl",143),wAn(1167,143,t9n,NY),MWn._i=function(){return this.a._i()},MWn.yi=function(n){return this.a.aj()},MWn.Ai=function(){return this.a.Ai()},vX(i6n,"DelegatingNotifyingListImpl/1",1167),wAn(242,63,h8n,po,Fj),MWn.Fc=function(n){return Mwn(this,BB(n,366))},MWn.Ei=function(n){return Mwn(this,n)},MWn.Fi=function(){var n,t,e;for(n=0;n<this.i;++n)null!=(e=(t=BB(this.g[n],366)).Ai())&&-1!=t.xi()&&BB(e,92).Ng(t)},MWn.ri=function(n){return x8(gAt,HWn,366,n,0,1)},vX(i6n,"NotificationChainImpl",242),wAn(1378,90,e6n),MWn.Kg=function(){return this.e},MWn.Mg=function(){return 0!=(1&this.f)},MWn.f=1,vX(i6n,"NotifierImpl",1378),wAn(1993,63,h8n),MWn.Vh=function(n,t){return LFn(this,n,t)},MWn.Wh=function(n){return this.Vh(this.i,n)},MWn.Xh=function(n,t){qOn(this,n,t)},MWn.Yh=function(n){tAn(this,n)},MWn.ai=function(){return!this.bj()},MWn.$b=function(){sqn(this)},MWn.Zi=function(n,t,e,i,r){return new xY(this,n,t,e,i,r)},MWn.$i=function(n){ban(this.Ai(),n)},MWn._i=function(){return null},MWn.aj=function(){return-1},MWn.Ai=function(){return null},MWn.bj=function(){return!1},MWn.ij=function(){return!1},MWn.cj=function(n,t){return t},MWn.dj=function(n,t){return t},MWn.ej=function(){return!1},MWn.fj=function(){return 0!=this.i},MWn.ii=function(n,t){return Iln(this,n,t)},MWn.$c=function(n){return fDn(this,n)},MWn.mi=function(n,t){return fBn(this,n,t)},MWn.jj=function(n,t){return t},MWn.kj=function(n,t){return t},MWn.lj=function(n,t,e){return e},vX(i6n,"NotifyingListImpl",1993),wAn(1166,143,t9n,xY),MWn._i=function(){return this.a._i()},MWn.yi=function(n){return this.a.aj()},MWn.Ai=function(){return this.a.Ai()},vX(i6n,"NotifyingListImpl/1",1166),wAn(953,63,h8n,aR),MWn.Hc=function(n){return this.i>10?(this.b&&this.c.j==this.a||(this.b=new $q(this),this.a=this.j),FT(this.b,n)):Sjn(this,n)},MWn.ni=function(){return!0},MWn.a=0,vX(B6n,"AbstractEList/1",953),wAn(295,73,NQn,tK),vX(B6n,"AbstractEList/BasicIndexOutOfBoundsException",295),wAn(40,1,QWn,AL),MWn.Nb=function(n){fU(this,n)},MWn.mj=function(){if(this.i.j!=this.f)throw Hp(new vv)},MWn.nj=function(){return kpn(this)},MWn.Ob=function(){return this.e!=this.i.gc()},MWn.Pb=function(){return this.nj()},MWn.Qb=function(){Qjn(this)},MWn.e=0,MWn.f=0,MWn.g=-1,vX(B6n,"AbstractEList/EIterator",40),wAn(278,40,cVn,cx,GU),MWn.Qb=function(){Qjn(this)},MWn.Rb=function(n){odn(this,n)},MWn.oj=function(){var n;try{return n=this.d.Xb(--this.e),this.mj(),this.g=this.e,n}catch(t){throw cL(t=lun(t),73)?(this.mj(),Hp(new yv)):Hp(t)}},MWn.pj=function(n){kmn(this,n)},MWn.Sb=function(){return 0!=this.e},MWn.Tb=function(){return this.e},MWn.Ub=function(){return this.oj()},MWn.Vb=function(){return this.e-1},MWn.Wb=function(n){this.pj(n)},vX(B6n,"AbstractEList/EListIterator",278),wAn(341,40,QWn,ax),MWn.nj=function(){return jpn(this)},MWn.Qb=function(){throw Hp(new pv)},vX(B6n,"AbstractEList/NonResolvingEIterator",341),wAn(385,278,cVn,ux,RK),MWn.Rb=function(n){throw Hp(new pv)},MWn.nj=function(){var n;try{return n=this.c.ki(this.e),this.mj(),this.g=this.e++,n}catch(t){throw cL(t=lun(t),73)?(this.mj(),Hp(new yv)):Hp(t)}},MWn.oj=function(){var n;try{return n=this.c.ki(--this.e),this.mj(),this.g=this.e,n}catch(t){throw cL(t=lun(t),73)?(this.mj(),Hp(new yv)):Hp(t)}},MWn.Qb=function(){throw Hp(new pv)},MWn.Wb=function(n){throw Hp(new pv)},vX(B6n,"AbstractEList/NonResolvingEListIterator",385),wAn(1982,67,r9n),MWn.Vh=function(n,t){var e,i,r,c,a,u,o,s,h;if(0!=(i=t.gc())){for(e=Psn(this,(s=null==(o=BB(yan(this.a,4),126))?0:o.length)+i),(h=s-n)>0&&aHn(o,n,e,n+i,h),u=t.Kc(),c=0;c<i;++c)JA(e,n+c,xsn(this,a=u.Pb()));for(Fgn(this,e),r=0;r<i;++r)a=e[n],this.bi(n,a),++n;return!0}return++this.j,!1},MWn.Wh=function(n){var t,e,i,r,c,a,u,o,s;if(0!=(i=n.gc())){for(t=Psn(this,s=(o=null==(e=BB(yan(this.a,4),126))?0:e.length)+i),u=n.Kc(),c=o;c<s;++c)JA(t,c,xsn(this,a=u.Pb()));for(Fgn(this,t),r=o;r<s;++r)a=t[r],this.bi(r,a);return!0}return++this.j,!1},MWn.Xh=function(n,t){var e,i,r,c;e=Psn(this,(r=null==(i=BB(yan(this.a,4),126))?0:i.length)+1),c=xsn(this,t),n!=r&&aHn(i,n,e,n+1,r-n),$X(e,n,c),Fgn(this,e),this.bi(n,t)},MWn.Yh=function(n){var t,e,i;JA(t=Psn(this,(i=null==(e=BB(yan(this.a,4),126))?0:e.length)+1),i,xsn(this,n)),Fgn(this,t),this.bi(i,n)},MWn.Zh=function(){return new S5(this)},MWn.$h=function(){return new Yz(this)},MWn._h=function(n){var t,e;if(e=null==(t=BB(yan(this.a,4),126))?0:t.length,n<0||n>e)throw Hp(new tK(n,e));return new BW(this,n)},MWn.$b=function(){var n,t;++this.j,t=null==(n=BB(yan(this.a,4),126))?0:n.length,Fgn(this,null),L8(this,t,n)},MWn.Hc=function(n){var t,e,i,r;if(null!=(t=BB(yan(this.a,4),126)))if(null!=n){for(i=0,r=(e=t).length;i<r;++i)if(Nfn(n,e[i]))return!0}else for(i=0,r=(e=t).length;i<r;++i)if(GI(e[i])===GI(n))return!0;return!1},MWn.Xb=function(n){var t,e;if(n>=(e=null==(t=BB(yan(this.a,4),126))?0:t.length))throw Hp(new tK(n,e));return t[n]},MWn.Xc=function(n){var t,e,i;if(null!=(t=BB(yan(this.a,4),126)))if(null!=n){for(e=0,i=t.length;e<i;++e)if(Nfn(n,t[e]))return e}else for(e=0,i=t.length;e<i;++e)if(GI(t[e])===GI(n))return e;return-1},MWn.dc=function(){return null==BB(yan(this.a,4),126)},MWn.Kc=function(){return new M5(this)},MWn.Yc=function(){return new Qz(this)},MWn.Zc=function(n){var t,e;if(e=null==(t=BB(yan(this.a,4),126))?0:t.length,n<0||n>e)throw Hp(new tK(n,e));return new FW(this,n)},MWn.ii=function(n,t){var e,i,r;if(n>=(r=null==(e=$dn(this))?0:e.length))throw Hp(new Ay(u8n+n+o8n+r));if(t>=r)throw Hp(new Ay(s8n+t+o8n+r));return i=e[t],n!=t&&(n<t?aHn(e,n,e,n+1,t-n):aHn(e,t+1,e,t,n-t),$X(e,n,i),Fgn(this,e)),i},MWn.ki=function(n){return BB(yan(this.a,4),126)[n]},MWn.$c=function(n){return EOn(this,n)},MWn.mi=function(n,t){var e,i;return i=(e=$dn(this))[n],JA(e,n,xsn(this,t)),Fgn(this,e),i},MWn.gc=function(){var n;return null==(n=BB(yan(this.a,4),126))?0:n.length},MWn.Pc=function(){var n,t,e;return e=null==(n=BB(yan(this.a,4),126))?0:n.length,t=x8(dAt,i9n,415,e,0,1),e>0&&aHn(n,0,t,0,e),t},MWn.Qc=function(n){var t,e;return(e=null==(t=BB(yan(this.a,4),126))?0:t.length)>0&&(n.length<e&&(n=Den(tsn(n).c,e)),aHn(t,0,n,0,e)),n.length>e&&$X(n,e,null),n},vX(B6n,"ArrayDelegatingEList",1982),wAn(1038,40,QWn,M5),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},MWn.Qb=function(){Qjn(this),this.a=BB(yan(this.b.a,4),126)},vX(B6n,"ArrayDelegatingEList/EIterator",1038),wAn(706,278,cVn,Qz,FW),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},MWn.pj=function(n){kmn(this,n),this.a=BB(yan(this.b.a,4),126)},MWn.Qb=function(){Qjn(this),this.a=BB(yan(this.b.a,4),126)},vX(B6n,"ArrayDelegatingEList/EListIterator",706),wAn(1039,341,QWn,S5),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},vX(B6n,"ArrayDelegatingEList/NonResolvingEIterator",1039),wAn(707,385,cVn,Yz,BW),MWn.mj=function(){if(this.b.j!=this.f||GI(BB(yan(this.b.a,4),126))!==GI(this.a))throw Hp(new vv)},vX(B6n,"ArrayDelegatingEList/NonResolvingEListIterator",707),wAn(606,295,NQn,LO),vX(B6n,"BasicEList/BasicIndexOutOfBoundsException",606),wAn(696,63,h8n,DI),MWn.Vc=function(n,t){throw Hp(new pv)},MWn.Fc=function(n){throw Hp(new pv)},MWn.Wc=function(n,t){throw Hp(new pv)},MWn.Gc=function(n){throw Hp(new pv)},MWn.$b=function(){throw Hp(new pv)},MWn.qi=function(n){throw Hp(new pv)},MWn.Kc=function(){return this.Zh()},MWn.Yc=function(){return this.$h()},MWn.Zc=function(n){return this._h(n)},MWn.ii=function(n,t){throw Hp(new pv)},MWn.ji=function(n,t){throw Hp(new pv)},MWn.$c=function(n){throw Hp(new pv)},MWn.Mc=function(n){throw Hp(new pv)},MWn._c=function(n,t){throw Hp(new pv)},vX(B6n,"BasicEList/UnmodifiableEList",696),wAn(705,1,{3:1,20:1,14:1,15:1,58:1,589:1}),MWn.Vc=function(n,t){Q$(this,n,BB(t,42))},MWn.Fc=function(n){return aD(this,BB(n,42))},MWn.Jc=function(n){e5(this,n)},MWn.Xb=function(n){return BB(Wtn(this.c,n),133)},MWn.ii=function(n,t){return BB(this.c.ii(n,t),42)},MWn.ji=function(n,t){Y$(this,n,BB(t,42))},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.$c=function(n){return BB(this.c.$c(n),42)},MWn._c=function(n,t){return uX(this,n,BB(t,42))},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.Wc=function(n,t){return this.c.Wc(n,t)},MWn.Gc=function(n){return this.c.Gc(n)},MWn.$b=function(){this.c.$b()},MWn.Hc=function(n){return this.c.Hc(n)},MWn.Ic=function(n){return oun(this.c,n)},MWn.qj=function(){var n,t;if(null==this.d){for(this.d=x8(oAt,c9n,63,2*this.f+1,0,1),t=this.e,this.f=0,n=this.c.Kc();n.e!=n.i.gc();)Ivn(this,BB(n.nj(),133));this.e=t}},MWn.Fb=function(n){return NK(this,n)},MWn.Hb=function(){return Mun(this.c)},MWn.Xc=function(n){return this.c.Xc(n)},MWn.rj=function(){this.c=new hp(this)},MWn.dc=function(){return 0==this.f},MWn.Kc=function(){return this.c.Kc()},MWn.Yc=function(){return this.c.Yc()},MWn.Zc=function(n){return this.c.Zc(n)},MWn.sj=function(){return A8(this)},MWn.tj=function(n,t,e){return new SB(n,t,e)},MWn.uj=function(){return new vo},MWn.Mc=function(n){return hin(this,n)},MWn.gc=function(){return this.f},MWn.bd=function(n,t){return new s1(this.c,n,t)},MWn.Pc=function(){return this.c.Pc()},MWn.Qc=function(n){return this.c.Qc(n)},MWn.Ib=function(){return Jbn(this.c)},MWn.e=0,MWn.f=0,vX(B6n,"BasicEMap",705),wAn(1033,63,h8n,hp),MWn.bi=function(n,t){Av(this,BB(t,133))},MWn.ei=function(n,t,e){var i;++(i=this,BB(t,133),i).a.e},MWn.fi=function(n,t){$v(this,BB(t,133))},MWn.gi=function(n,t,e){VN(this,BB(t,133),BB(e,133))},MWn.di=function(n,t){aan(this.a)},vX(B6n,"BasicEMap/1",1033),wAn(1034,63,h8n,vo),MWn.ri=function(n){return x8(vAt,a9n,612,n,0,1)},vX(B6n,"BasicEMap/2",1034),wAn(1035,nVn,tVn,fp),MWn.$b=function(){this.a.c.$b()},MWn.Hc=function(n){return rdn(this.a,n)},MWn.Kc=function(){return 0==this.a.f?(dD(),pAt.a):new Bj(this.a)},MWn.Mc=function(n){var t;return t=this.a.f,Wdn(this.a,n),this.a.f!=t},MWn.gc=function(){return this.a.f},vX(B6n,"BasicEMap/3",1035),wAn(1036,28,ZWn,lp),MWn.$b=function(){this.a.c.$b()},MWn.Hc=function(n){return YDn(this.a,n)},MWn.Kc=function(){return 0==this.a.f?(dD(),pAt.a):new Hj(this.a)},MWn.gc=function(){return this.a.f},vX(B6n,"BasicEMap/4",1036),wAn(1037,nVn,tVn,bp),MWn.$b=function(){this.a.c.$b()},MWn.Hc=function(n){var t,e,i,r,c,a,u,o,s;if(this.a.f>0&&cL(n,42)&&(this.a.qj(),r=null==(u=(o=BB(n,42)).cd())?0:nsn(u),c=eR(this.a,r),t=this.a.d[c]))for(e=BB(t.g,367),s=t.i,a=0;a<s;++a)if((i=e[a]).Sh()==r&&i.Fb(o))return!0;return!1},MWn.Kc=function(){return 0==this.a.f?(dD(),pAt.a):new pQ(this.a)},MWn.Mc=function(n){return IAn(this,n)},MWn.gc=function(){return this.a.f},vX(B6n,"BasicEMap/5",1037),wAn(613,1,QWn,pQ),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return-1!=this.b},MWn.Pb=function(){var n;if(this.f.e!=this.c)throw Hp(new vv);if(-1==this.b)throw Hp(new yv);return this.d=this.a,this.e=this.b,ujn(this),n=BB(this.f.d[this.d].g[this.e],133),this.vj(n)},MWn.Qb=function(){if(this.f.e!=this.c)throw Hp(new vv);if(-1==this.e)throw Hp(new dv);this.f.c.Mc(Wtn(this.f.d[this.d],this.e)),this.c=this.f.e,this.e=-1,this.a==this.d&&-1!=this.b&&--this.b},MWn.vj=function(n){return n},MWn.a=0,MWn.b=-1,MWn.c=0,MWn.d=0,MWn.e=0,vX(B6n,"BasicEMap/BasicEMapIterator",613),wAn(1031,613,QWn,Bj),MWn.vj=function(n){return n.cd()},vX(B6n,"BasicEMap/BasicEMapKeyIterator",1031),wAn(1032,613,QWn,Hj),MWn.vj=function(n){return n.dd()},vX(B6n,"BasicEMap/BasicEMapValueIterator",1032),wAn(1030,1,JWn,wp),MWn.wc=function(n){nan(this,n)},MWn.yc=function(n,t,e){return Zln(this,n,t,e)},MWn.$b=function(){this.a.c.$b()},MWn._b=function(n){return BI(this,n)},MWn.uc=function(n){return YDn(this.a,n)},MWn.vc=function(){return I8(this.a)},MWn.Fb=function(n){return NK(this.a,n)},MWn.xc=function(n){return cdn(this.a,n)},MWn.Hb=function(){return Mun(this.a.c)},MWn.dc=function(){return 0==this.a.f},MWn.ec=function(){return O8(this.a)},MWn.zc=function(n,t){return vjn(this.a,n,t)},MWn.Bc=function(n){return Wdn(this.a,n)},MWn.gc=function(){return this.a.f},MWn.Ib=function(){return Jbn(this.a.c)},MWn.Cc=function(){return C8(this.a)},vX(B6n,"BasicEMap/DelegatingMap",1030),wAn(612,1,{42:1,133:1,612:1},SB),MWn.Fb=function(n){var t;return!!cL(n,42)&&(t=BB(n,42),(null!=this.b?Nfn(this.b,t.cd()):GI(this.b)===GI(t.cd()))&&(null!=this.c?Nfn(this.c,t.dd()):GI(this.c)===GI(t.dd())))},MWn.Sh=function(){return this.a},MWn.cd=function(){return this.b},MWn.dd=function(){return this.c},MWn.Hb=function(){return this.a^(null==this.c?0:nsn(this.c))},MWn.Th=function(n){this.a=n},MWn.Uh=function(n){throw Hp(new sv)},MWn.ed=function(n){var t;return t=this.c,this.c=n,t},MWn.Ib=function(){return this.b+"->"+this.c},MWn.a=0;var pAt,vAt=vX(B6n,"BasicEMap/EntryImpl",612);wAn(536,1,{},oo),vX(B6n,"BasicEMap/View",536),wAn(768,1,{}),MWn.Fb=function(n){return NAn((SQ(),set),n)},MWn.Hb=function(){return Fon((SQ(),set))},MWn.Ib=function(){return LMn((SQ(),set))},vX(B6n,"ECollections/BasicEmptyUnmodifiableEList",768),wAn(1312,1,cVn,mo),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){throw Hp(new pv)},MWn.Ob=function(){return!1},MWn.Sb=function(){return!1},MWn.Pb=function(){throw Hp(new yv)},MWn.Tb=function(){return 0},MWn.Ub=function(){throw Hp(new yv)},MWn.Vb=function(){return-1},MWn.Qb=function(){throw Hp(new pv)},MWn.Wb=function(n){throw Hp(new pv)},vX(B6n,"ECollections/BasicEmptyUnmodifiableEList/1",1312),wAn(1310,768,{20:1,14:1,15:1,58:1},Tm),MWn.Vc=function(n,t){NE()},MWn.Fc=function(n){return xE()},MWn.Wc=function(n,t){return DE()},MWn.Gc=function(n){return RE()},MWn.$b=function(){KE()},MWn.Hc=function(n){return!1},MWn.Ic=function(n){return!1},MWn.Jc=function(n){e5(this,n)},MWn.Xb=function(n){return yO((SQ(),n)),null},MWn.Xc=function(n){return-1},MWn.dc=function(){return!0},MWn.Kc=function(){return this.a},MWn.Yc=function(){return this.a},MWn.Zc=function(n){return this.a},MWn.ii=function(n,t){return _E()},MWn.ji=function(n,t){FE()},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.$c=function(n){return BE()},MWn.Mc=function(n){return HE()},MWn._c=function(n,t){return qE()},MWn.gc=function(){return 0},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.bd=function(n,t){return SQ(),new s1(set,n,t)},MWn.Pc=function(){return cz((SQ(),set))},MWn.Qc=function(n){return SQ(),Emn(set,n)},vX(B6n,"ECollections/EmptyUnmodifiableEList",1310),wAn(1311,768,{20:1,14:1,15:1,58:1,589:1},Mm),MWn.Vc=function(n,t){NE()},MWn.Fc=function(n){return xE()},MWn.Wc=function(n,t){return DE()},MWn.Gc=function(n){return RE()},MWn.$b=function(){KE()},MWn.Hc=function(n){return!1},MWn.Ic=function(n){return!1},MWn.Jc=function(n){e5(this,n)},MWn.Xb=function(n){return yO((SQ(),n)),null},MWn.Xc=function(n){return-1},MWn.dc=function(){return!0},MWn.Kc=function(){return this.a},MWn.Yc=function(){return this.a},MWn.Zc=function(n){return this.a},MWn.ii=function(n,t){return _E()},MWn.ji=function(n,t){FE()},MWn.Lc=function(){return new Rq(null,new w1(this,16))},MWn.$c=function(n){return BE()},MWn.Mc=function(n){return HE()},MWn._c=function(n,t){return qE()},MWn.gc=function(){return 0},MWn.ad=function(n){_rn(this,n)},MWn.Nc=function(){return new w1(this,16)},MWn.Oc=function(){return new Rq(null,new w1(this,16))},MWn.bd=function(n,t){return SQ(),new s1(set,n,t)},MWn.Pc=function(){return cz((SQ(),set))},MWn.Qc=function(n){return SQ(),Emn(set,n)},MWn.sj=function(){return SQ(),SQ(),het},vX(B6n,"ECollections/EmptyUnmodifiableEMap",1311);var mAt,yAt=bq(B6n,"Enumerator");wAn(281,1,{281:1},rRn),MWn.Fb=function(n){var t;return this===n||!!cL(n,281)&&(t=BB(n,281),this.f==t.f&&vG(this.i,t.i)&&pG(this.a,0!=(256&this.f)?0!=(256&t.f)?t.a:null:0!=(256&t.f)?null:t.a)&&pG(this.d,t.d)&&pG(this.g,t.g)&&pG(this.e,t.e)&&Spn(this,t))},MWn.Hb=function(){return this.f},MWn.Ib=function(){return M_n(this)},MWn.f=0;var kAt,jAt,EAt,TAt=0,MAt=0,SAt=0,PAt=0,CAt=0,IAt=0,OAt=0,AAt=0,$At=0,LAt=0,NAt=0,xAt=0,DAt=0;vX(B6n,"URI",281),wAn(1091,43,tYn,Sm),MWn.zc=function(n,t){return BB(mZ(this,SD(n),BB(t,281)),281)},vX(B6n,"URI/URICache",1091),wAn(497,63,h8n,fo,rG),MWn.hi=function(){return!0},vX(B6n,"UniqueEList",497),wAn(581,60,BVn,L7),vX(B6n,"WrappedException",581);var RAt,KAt=bq(q5n,s9n),_At=bq(q5n,h9n),FAt=bq(q5n,f9n),BAt=bq(q5n,l9n),HAt=bq(q5n,b9n),qAt=bq(q5n,"EClass"),GAt=bq(q5n,"EDataType");wAn(1183,43,tYn,Pm),MWn.xc=function(n){return XI(n)?SJ(this,n):qI(AY(this.f,n))},vX(q5n,"EDataType/Internal/ConversionDelegate/Factory/Registry/Impl",1183);var zAt,UAt,XAt=bq(q5n,"EEnum"),WAt=bq(q5n,w9n),VAt=bq(q5n,d9n),QAt=bq(q5n,g9n),YAt=bq(q5n,p9n),JAt=bq(q5n,v9n);wAn(1029,1,{},ho),MWn.Ib=function(){return"NIL"},vX(q5n,"EStructuralFeature/Internal/DynamicValueHolder/1",1029),wAn(1028,43,tYn,Cm),MWn.xc=function(n){return XI(n)?SJ(this,n):qI(AY(this.f,n))},vX(q5n,"EStructuralFeature/Internal/SettingDelegate/Factory/Registry/Impl",1028);var ZAt,n$t,t$t,e$t,i$t,r$t,c$t,a$t,u$t,o$t,s$t,h$t,f$t,l$t,b$t,w$t,d$t,g$t,p$t,v$t,m$t,y$t,k$t,j$t,E$t,T$t,M$t,S$t,P$t,C$t,I$t,O$t=bq(q5n,m9n),A$t=bq(q5n,"EValidator/PatternMatcher"),$$t=bq(y9n,"FeatureMap/Entry");wAn(535,1,{72:1},CI),MWn.ak=function(){return this.a},MWn.dd=function(){return this.b},vX(l6n,"BasicEObjectImpl/1",535),wAn(1027,1,k9n,II),MWn.Wj=function(n){return V5(this.a,this.b,n)},MWn.fj=function(){return ZJ(this.a,this.b)},MWn.Wb=function(n){NJ(this.a,this.b,n)},MWn.Xj=function(){PW(this.a,this.b)},vX(l6n,"BasicEObjectImpl/4",1027),wAn(1983,1,{108:1}),MWn.bk=function(n){this.e=0==n?M$t:x8(Ant,HWn,1,n,5,1)},MWn.Ch=function(n){return this.e[n]},MWn.Dh=function(n,t){this.e[n]=t},MWn.Eh=function(n){this.e[n]=null},MWn.ck=function(){return this.c},MWn.dk=function(){throw Hp(new pv)},MWn.ek=function(){throw Hp(new pv)},MWn.fk=function(){return this.d},MWn.gk=function(){return null!=this.e},MWn.hk=function(n){this.c=n},MWn.ik=function(n){throw Hp(new pv)},MWn.jk=function(n){throw Hp(new pv)},MWn.kk=function(n){this.d=n},vX(l6n,"BasicEObjectImpl/EPropertiesHolderBaseImpl",1983),wAn(185,1983,{108:1},Kf),MWn.dk=function(){return this.a},MWn.ek=function(){return this.b},MWn.ik=function(n){this.a=n},MWn.jk=function(n){this.b=n},vX(l6n,"BasicEObjectImpl/EPropertiesHolderImpl",185),wAn(506,97,f6n,yo),MWn.Kg=function(){return this.f},MWn.Pg=function(){return this.k},MWn.Rg=function(n,t){this.g=n,this.i=t},MWn.Tg=function(){return 0==(2&this.j)?this.zh():this.ph().ck()},MWn.Vg=function(){return this.i},MWn.Mg=function(){return 0!=(1&this.j)},MWn.eh=function(){return this.g},MWn.kh=function(){return 0!=(4&this.j)},MWn.ph=function(){return!this.k&&(this.k=new Kf),this.k},MWn.th=function(n){this.ph().hk(n),n?this.j|=2:this.j&=-3},MWn.vh=function(n){this.ph().jk(n),n?this.j|=4:this.j&=-5},MWn.zh=function(){return(QX(),t$t).S},MWn.i=0,MWn.j=1,vX(l6n,"EObjectImpl",506),wAn(780,506,{105:1,92:1,90:1,56:1,108:1,49:1,97:1},jH),MWn.Ch=function(n){return this.e[n]},MWn.Dh=function(n,t){this.e[n]=t},MWn.Eh=function(n){this.e[n]=null},MWn.Tg=function(){return this.d},MWn.Yg=function(n){return Awn(this.d,n)},MWn.$g=function(){return this.d},MWn.dh=function(){return null!=this.e},MWn.ph=function(){return!this.k&&(this.k=new ko),this.k},MWn.th=function(n){this.d=n},MWn.yh=function(){var n;return null==this.e&&(n=bX(this.d),this.e=0==n?S$t:x8(Ant,HWn,1,n,5,1)),this},MWn.Ah=function(){return 0},vX(l6n,"DynamicEObjectImpl",780),wAn(1376,780,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1},fq),MWn.Fb=function(n){return this===n},MWn.Hb=function(){return PN(this)},MWn.th=function(n){this.d=n,this.b=NNn(n,"key"),this.c=NNn(n,E6n)},MWn.Sh=function(){var n;return-1==this.a&&(n=J7(this,this.b),this.a=null==n?0:nsn(n)),this.a},MWn.cd=function(){return J7(this,this.b)},MWn.dd=function(){return J7(this,this.c)},MWn.Th=function(n){this.a=n},MWn.Uh=function(n){NJ(this,this.b,n)},MWn.ed=function(n){var t;return t=J7(this,this.c),NJ(this,this.c,n),t},MWn.a=0,vX(l6n,"DynamicEObjectImpl/BasicEMapEntry",1376),wAn(1377,1,{108:1},ko),MWn.bk=function(n){throw Hp(new pv)},MWn.Ch=function(n){throw Hp(new pv)},MWn.Dh=function(n,t){throw Hp(new pv)},MWn.Eh=function(n){throw Hp(new pv)},MWn.ck=function(){throw Hp(new pv)},MWn.dk=function(){return this.a},MWn.ek=function(){return this.b},MWn.fk=function(){return this.c},MWn.gk=function(){throw Hp(new pv)},MWn.hk=function(n){throw Hp(new pv)},MWn.ik=function(n){this.a=n},MWn.jk=function(n){this.b=n},MWn.kk=function(n){this.c=n},vX(l6n,"DynamicEObjectImpl/DynamicEPropertiesHolderImpl",1377),wAn(510,150,{105:1,92:1,90:1,590:1,147:1,56:1,108:1,49:1,97:1,510:1,150:1,114:1,115:1},jo),MWn.Qg=function(n){return bkn(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.d;case 2:return e?(!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),this.b):(!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),A8(this.b));case 3:return bZ(this);case 4:return!this.a&&(this.a=new $L(LOt,this,4)),this.a;case 5:return!this.c&&(this.c=new RL(LOt,this,5)),this.c}return U9(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 3:return this.Cb&&(e=(i=this.Db>>16)>=0?bkn(this,e):this.Cb.ih(this,-1-i,null,e)),QG(this,BB(n,147),e)}return BB(itn(BB(yan(this,16),26)||(gWn(),e$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),e$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 2:return!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),BK(this.b,n,e);case 3:return QG(this,null,e);case 4:return!this.a&&(this.a=new $L(LOt,this,4)),_pn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),e$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),e$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.d;case 2:return!!this.b&&0!=this.b.f;case 3:return!!bZ(this);case 4:return!!this.a&&0!=this.a.i;case 5:return!!this.c&&0!=this.c.i}return O3(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void pq(this,SD(t));case 2:return!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),void tan(this.b,t);case 3:return void ONn(this,BB(t,147));case 4:return!this.a&&(this.a=new $L(LOt,this,4)),sqn(this.a),!this.a&&(this.a=new $L(LOt,this,4)),void pX(this.a,BB(t,14));case 5:return!this.c&&(this.c=new RL(LOt,this,5)),sqn(this.c),!this.c&&(this.c=new RL(LOt,this,5)),void pX(this.c,BB(t,14))}Lbn(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n),t)},MWn.zh=function(){return gWn(),e$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Bin(this,null);case 2:return!this.b&&(this.b=new Jx((gWn(),k$t),X$t,this)),void this.b.c.$b();case 3:return void ONn(this,null);case 4:return!this.a&&(this.a=new $L(LOt,this,4)),void sqn(this.a);case 5:return!this.c&&(this.c=new RL(LOt,this,5)),void sqn(this.c)}qfn(this,n-bX((gWn(),e$t)),itn(BB(yan(this,16),26)||e$t,n))},MWn.Ib=function(){return Vfn(this)},MWn.d=null,vX(l6n,"EAnnotationImpl",510),wAn(151,705,j9n,y9),MWn.Xh=function(n,t){n$(this,n,BB(t,42))},MWn.lk=function(n,t){return FK(this,BB(n,42),t)},MWn.pi=function(n){return BB(BB(this.c,69).pi(n),133)},MWn.Zh=function(){return BB(this.c,69).Zh()},MWn.$h=function(){return BB(this.c,69).$h()},MWn._h=function(n){return BB(this.c,69)._h(n)},MWn.mk=function(n,t){return BK(this,n,t)},MWn.Wj=function(n){return BB(this.c,76).Wj(n)},MWn.rj=function(){},MWn.fj=function(){return BB(this.c,76).fj()},MWn.tj=function(n,t,e){var i;return(i=BB(Utn(this.b).Nh().Jh(this.b),133)).Th(n),i.Uh(t),i.ed(e),i},MWn.uj=function(){return new Ip(this)},MWn.Wb=function(n){tan(this,n)},MWn.Xj=function(){BB(this.c,76).Xj()},vX(y9n,"EcoreEMap",151),wAn(158,151,j9n,Jx),MWn.qj=function(){var n,t,e,i,r;if(null==this.d){for(r=x8(oAt,c9n,63,2*this.f+1,0,1),e=this.c.Kc();e.e!=e.i.gc();)!(n=r[i=((t=BB(e.nj(),133)).Sh()&DWn)%r.length])&&(n=r[i]=new Ip(this)),n.Fc(t);this.d=r}},vX(l6n,"EAnnotationImpl/1",158),wAn(284,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,472:1,49:1,97:1,150:1,284:1,114:1,115:1}),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),!!this.$j();case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return this.$j();case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i)}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void this.Lh(SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void this.ok(BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi())}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),E$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void this.Lh(null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void this.ok(1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi())}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){Ikn(this),this.Bb|=1},MWn.Yj=function(){return Ikn(this)},MWn.Zj=function(){return this.t},MWn.$j=function(){var n;return(n=this.t)>1||-1==n},MWn.hi=function(){return 0!=(512&this.Bb)},MWn.nk=function(n,t){return Pfn(this,n,t)},MWn.ok=function(n){Nen(this,n)},MWn.Ib=function(){return KOn(this)},MWn.s=0,MWn.t=1,vX(l6n,"ETypedElementImpl",284),wAn(449,284,{105:1,92:1,90:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,449:1,284:1,114:1,115:1,677:1}),MWn.Qg=function(n){return Nyn(this,n)},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),!!this.$j();case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return hN(),0!=(this.Bb&k6n);case 11:return hN(),0!=(this.Bb&M9n);case 12:return hN(),0!=(this.Bb&_Qn);case 13:return this.j;case 14:return qLn(this);case 15:return hN(),0!=(this.Bb&T9n);case 16:return hN(),0!=(this.Bb&hVn);case 17:return dZ(this)}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 17:return this.Cb&&(e=(i=this.Db>>16)>=0?Nyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,17,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Qj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e);case 17:return T_n(this,null,17,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return this.$j();case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return 0==(this.Bb&k6n);case 11:return 0!=(this.Bb&M9n);case 12:return 0!=(this.Bb&_Qn);case 13:return null!=this.j;case 14:return null!=qLn(this);case 15:return 0!=(this.Bb&T9n);case 16:return 0!=(this.Bb&hVn);case 17:return!!dZ(this)}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void JZ(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void this.ok(BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 10:return void Aln(this,qy(TD(t)));case 11:return void Nln(this,qy(TD(t)));case 12:return void $ln(this,qy(TD(t)));case 13:return void _I(this,SD(t));case 15:return void Lln(this,qy(TD(t)));case 16:return void qln(this,qy(TD(t)))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),j$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),4),void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void this.ok(1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 10:return void Aln(this,!0);case 11:return void Nln(this,!1);case 12:return void $ln(this,!1);case 13:return this.i=null,void arn(this,null);case 15:return void Lln(this,!1);case 16:return void qln(this,!1)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){kV(B7((IPn(),Z$t),this)),Ikn(this),this.Bb|=1},MWn.Gj=function(){return this.f},MWn.zj=function(){return qLn(this)},MWn.Hj=function(){return dZ(this)},MWn.Lj=function(){return null},MWn.pk=function(){return this.k},MWn.aj=function(){return this.n},MWn.Mj=function(){return oEn(this)},MWn.Nj=function(){var n,t,e,i,r,c,a,u,o;return this.p||((null==(e=dZ(this)).i&&qFn(e),e.i).length,(i=this.Lj())&&bX(dZ(i)),n=(a=(r=Ikn(this)).Bj())?0!=(1&a.i)?a==$Nt?ktt:a==ANt?Att:a==DNt?Ctt:a==xNt?Ptt:a==LNt?Rtt:a==RNt?_tt:a==NNt?Ttt:Stt:a:null,t=qLn(this),u=r.zj(),bbn(this),0!=(this.Bb&hVn)&&((c=mjn((IPn(),Z$t),e))&&c!=this||(c=Z1(B7(Z$t,this))))?this.p=new AI(this,c):this.$j()?this.rk()?i?0!=(this.Bb&T9n)?n?this.sk()?this.p=new lQ(47,n,this,i):this.p=new lQ(5,n,this,i):this.sk()?this.p=new w4(46,this,i):this.p=new w4(4,this,i):n?this.sk()?this.p=new lQ(49,n,this,i):this.p=new lQ(7,n,this,i):this.sk()?this.p=new w4(48,this,i):this.p=new w4(6,this,i):0!=(this.Bb&T9n)?n?n==Hnt?this.p=new PB(50,VOt,this):this.sk()?this.p=new PB(43,n,this):this.p=new PB(1,n,this):this.sk()?this.p=new RY(42,this):this.p=new RY(0,this):n?n==Hnt?this.p=new PB(41,VOt,this):this.sk()?this.p=new PB(45,n,this):this.p=new PB(3,n,this):this.sk()?this.p=new RY(44,this):this.p=new RY(2,this):cL(r,148)?n==$$t?this.p=new RY(40,this):0!=(512&this.Bb)?0!=(this.Bb&T9n)?this.p=n?new PB(9,n,this):new RY(8,this):this.p=n?new PB(11,n,this):new RY(10,this):0!=(this.Bb&T9n)?this.p=n?new PB(13,n,this):new RY(12,this):this.p=n?new PB(15,n,this):new RY(14,this):i?(o=i.t)>1||-1==o?this.sk()?0!=(this.Bb&T9n)?this.p=n?new lQ(25,n,this,i):new w4(24,this,i):this.p=n?new lQ(27,n,this,i):new w4(26,this,i):0!=(this.Bb&T9n)?this.p=n?new lQ(29,n,this,i):new w4(28,this,i):this.p=n?new lQ(31,n,this,i):new w4(30,this,i):this.sk()?0!=(this.Bb&T9n)?this.p=n?new lQ(33,n,this,i):new w4(32,this,i):this.p=n?new lQ(35,n,this,i):new w4(34,this,i):0!=(this.Bb&T9n)?this.p=n?new lQ(37,n,this,i):new w4(36,this,i):this.p=n?new lQ(39,n,this,i):new w4(38,this,i):this.sk()?0!=(this.Bb&T9n)?this.p=n?new PB(17,n,this):new RY(16,this):this.p=n?new PB(19,n,this):new RY(18,this):0!=(this.Bb&T9n)?this.p=n?new PB(21,n,this):new RY(20,this):this.p=n?new PB(23,n,this):new RY(22,this):this.qk()?this.sk()?this.p=new CB(BB(r,26),this,i):this.p=new mJ(BB(r,26),this,i):cL(r,148)?n==$$t?this.p=new RY(40,this):0!=(this.Bb&T9n)?this.p=n?new nz(t,u,this,(Bwn(),a==ANt?q$t:a==$Nt?K$t:a==LNt?G$t:a==DNt?H$t:a==xNt?B$t:a==RNt?U$t:a==NNt?_$t:a==ONt?F$t:z$t)):new dQ(BB(r,148),t,u,this):this.p=n?new ZG(t,u,this,(Bwn(),a==ANt?q$t:a==$Nt?K$t:a==LNt?G$t:a==DNt?H$t:a==xNt?B$t:a==RNt?U$t:a==NNt?_$t:a==ONt?F$t:z$t)):new wQ(BB(r,148),t,u,this):this.rk()?i?0!=(this.Bb&T9n)?this.sk()?this.p=new NB(BB(r,26),this,i):this.p=new LB(BB(r,26),this,i):this.sk()?this.p=new $B(BB(r,26),this,i):this.p=new IB(BB(r,26),this,i):0!=(this.Bb&T9n)?this.sk()?this.p=new eD(BB(r,26),this):this.p=new tD(BB(r,26),this):this.sk()?this.p=new nD(BB(r,26),this):this.p=new Zx(BB(r,26),this):this.sk()?i?0!=(this.Bb&T9n)?this.p=new xB(BB(r,26),this,i):this.p=new OB(BB(r,26),this,i):0!=(this.Bb&T9n)?this.p=new rD(BB(r,26),this):this.p=new iD(BB(r,26),this):i?0!=(this.Bb&T9n)?this.p=new DB(BB(r,26),this,i):this.p=new AB(BB(r,26),this,i):0!=(this.Bb&T9n)?this.p=new cD(BB(r,26),this):this.p=new cG(BB(r,26),this)),this.p},MWn.Ij=function(){return 0!=(this.Bb&k6n)},MWn.qk=function(){return!1},MWn.rk=function(){return!1},MWn.Jj=function(){return 0!=(this.Bb&hVn)},MWn.Oj=function(){return hnn(this)},MWn.sk=function(){return!1},MWn.Kj=function(){return 0!=(this.Bb&T9n)},MWn.tk=function(n){this.k=n},MWn.Lh=function(n){JZ(this,n)},MWn.Ib=function(){return ERn(this)},MWn.e=!1,MWn.n=0,vX(l6n,"EStructuralFeatureImpl",449),wAn(322,449,{105:1,92:1,90:1,34:1,147:1,191:1,56:1,170:1,66:1,108:1,472:1,49:1,97:1,322:1,150:1,449:1,284:1,114:1,115:1,677:1},Om),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),!!NIn(this);case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return hN(),0!=(this.Bb&k6n);case 11:return hN(),0!=(this.Bb&M9n);case 12:return hN(),0!=(this.Bb&_Qn);case 13:return this.j;case 14:return qLn(this);case 15:return hN(),0!=(this.Bb&T9n);case 16:return hN(),0!=(this.Bb&hVn);case 17:return dZ(this);case 18:return hN(),0!=(this.Bb&h6n);case 19:return t?uun(this):x6(this)}return U9(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return NIn(this);case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return 0==(this.Bb&k6n);case 11:return 0!=(this.Bb&M9n);case 12:return 0!=(this.Bb&_Qn);case 13:return null!=this.j;case 14:return null!=qLn(this);case 15:return 0!=(this.Bb&T9n);case 16:return 0!=(this.Bb&hVn);case 17:return!!dZ(this);case 18:return 0!=(this.Bb&h6n);case 19:return!!x6(this)}return O3(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void JZ(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void Uj(this,BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 10:return void Aln(this,qy(TD(t)));case 11:return void Nln(this,qy(TD(t)));case 12:return void $ln(this,qy(TD(t)));case 13:return void _I(this,SD(t));case 15:return void Lln(this,qy(TD(t)));case 16:return void qln(this,qy(TD(t)));case 18:return void Gln(this,qy(TD(t)))}Lbn(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n),t)},MWn.zh=function(){return gWn(),i$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),4),void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return this.b=0,void Nen(this,1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 10:return void Aln(this,!0);case 11:return void Nln(this,!1);case 12:return void $ln(this,!1);case 13:return this.i=null,void arn(this,null);case 15:return void Lln(this,!1);case 16:return void qln(this,!1);case 18:return void Gln(this,!1)}qfn(this,n-bX((gWn(),i$t)),itn(BB(yan(this,16),26)||i$t,n))},MWn.Gh=function(){uun(this),kV(B7((IPn(),Z$t),this)),Ikn(this),this.Bb|=1},MWn.$j=function(){return NIn(this)},MWn.nk=function(n,t){return this.b=0,this.a=null,Pfn(this,n,t)},MWn.ok=function(n){Uj(this,n)},MWn.Ib=function(){var n;return 0!=(64&this.Db)?ERn(this):((n=new fN(ERn(this))).a+=" (iD: ",yE(n,0!=(this.Bb&h6n)),n.a+=")",n.a)},MWn.b=0,vX(l6n,"EAttributeImpl",322),wAn(351,438,{105:1,92:1,90:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,351:1,150:1,114:1,115:1,676:1}),MWn.uk=function(n){return n.Tg()==this},MWn.Qg=function(n){return fyn(this,n)},MWn.Rg=function(n,t){this.w=null,this.Db=t<<16|255&this.Db,this.Cb=n},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return null!=this.D?this.D:this.B;case 3:return iyn(this);case 4:return this.zj();case 5:return this.F;case 6:return t?Utn(this):wZ(this);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),this.A}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?fyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,6,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Qj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 6:return T_n(this,null,6,e);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),_pn(this.A,n,e)}return BB(itn(BB(yan(this,16),26)||this.zh(),t),66).Nj().Rj(this,fgn(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return null!=this.zj();case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),c$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.yj=function(){var n;return-1==this.G&&(this.G=(n=Utn(this))?uvn(n.Mh(),this):-1),this.G},MWn.zj=function(){return null},MWn.Aj=function(){return Utn(this)},MWn.vk=function(){return this.v},MWn.Bj=function(){return iyn(this)},MWn.Cj=function(){return null!=this.D?this.D:this.B},MWn.Dj=function(){return this.F},MWn.wj=function(n){return SFn(this,n)},MWn.wk=function(n){this.v=n},MWn.xk=function(n){Urn(this,n)},MWn.yk=function(n){this.C=n},MWn.Lh=function(n){ZZ(this,n)},MWn.Ib=function(){return Cwn(this)},MWn.C=null,MWn.D=null,MWn.G=-1,vX(l6n,"EClassifierImpl",351),wAn(88,351,{105:1,92:1,90:1,26:1,138:1,147:1,191:1,56:1,108:1,49:1,97:1,88:1,351:1,150:1,473:1,114:1,115:1,676:1},_f),MWn.uk=function(n){return QR(this,n.Tg())},MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return null!=this.D?this.D:this.B;case 3:return iyn(this);case 4:return null;case 5:return this.F;case 6:return t?Utn(this):wZ(this);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),this.A;case 8:return hN(),0!=(256&this.Bb);case 9:return hN(),0!=(512&this.Bb);case 10:return kY(this);case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),this.q;case 12:return YBn(this);case 13:return RBn(this);case 14:return RBn(this),this.r;case 15:return YBn(this),this.k;case 16:return WPn(this);case 17:return gBn(this);case 18:return qFn(this);case 19:return CLn(this);case 20:return YBn(this),this.o;case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),this.s;case 22:return a4(this);case 23:return HDn(this)}return U9(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?fyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,6,e);case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),Ywn(this.q,n,e);case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),Ywn(this.s,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),r$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),r$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 6:return T_n(this,null,6,e);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),_pn(this.A,n,e);case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),_pn(this.q,n,e);case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),_pn(this.s,n,e);case 22:return _pn(a4(this),n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),r$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),r$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return!1;case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i;case 8:return 0!=(256&this.Bb);case 9:return 0!=(512&this.Bb);case 10:return!(!this.u||0==a4(this.u.a).i||this.n&&Rvn(this.n));case 11:return!!this.q&&0!=this.q.i;case 12:return 0!=YBn(this).i;case 13:return 0!=RBn(this).i;case 14:return RBn(this),0!=this.r.i;case 15:return YBn(this),0!=this.k.i;case 16:return 0!=WPn(this).i;case 17:return 0!=gBn(this).i;case 18:return 0!=qFn(this).i;case 19:return 0!=CLn(this).i;case 20:return YBn(this),!!this.o;case 21:return!!this.s&&0!=this.s.i;case 22:return!!this.n&&Rvn(this.n);case 23:return 0!=HDn(this).i}return O3(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n))},MWn.oh=function(n){return(null==this.i||this.q&&0!=this.q.i?null:NNn(this,n))||hUn(this,n)},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14));case 8:return void Jfn(this,qy(TD(t)));case 9:return void tln(this,qy(TD(t)));case 10:return vqn(kY(this)),void pX(kY(this),BB(t,14));case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),sqn(this.q),!this.q&&(this.q=new eU(QAt,this,11,10)),void pX(this.q,BB(t,14));case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),sqn(this.s),!this.s&&(this.s=new eU(FAt,this,21,17)),void pX(this.s,BB(t,14));case 22:return sqn(a4(this)),void pX(a4(this),BB(t,14))}Lbn(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n),t)},MWn.zh=function(){return gWn(),r$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A);case 8:return void Jfn(this,!1);case 9:return void tln(this,!1);case 10:return void(this.u&&vqn(this.u));case 11:return!this.q&&(this.q=new eU(QAt,this,11,10)),void sqn(this.q);case 21:return!this.s&&(this.s=new eU(FAt,this,21,17)),void sqn(this.s);case 22:return void(this.n&&sqn(this.n))}qfn(this,n-bX((gWn(),r$t)),itn(BB(yan(this,16),26)||r$t,n))},MWn.Gh=function(){var n,t;if(YBn(this),RBn(this),WPn(this),gBn(this),qFn(this),CLn(this),HDn(this),a6(XB(P5(this))),this.s)for(n=0,t=this.s.i;n<t;++n)vx(Wtn(this.s,n));if(this.q)for(n=0,t=this.q.i;n<t;++n)vx(Wtn(this.q,n));Cfn((IPn(),Z$t),this).ne(),this.Bb|=1},MWn.Ib=function(){return dEn(this)},MWn.k=null,MWn.r=null,vX(l6n,"EClassImpl",88),wAn(1994,1993,D9n),MWn.Vh=function(n,t){return LFn(this,n,t)},MWn.Wh=function(n){return LFn(this,this.i,n)},MWn.Xh=function(n,t){qOn(this,n,t)},MWn.Yh=function(n){tAn(this,n)},MWn.lk=function(n,t){return Ywn(this,n,t)},MWn.pi=function(n){return F9(this,n)},MWn.mk=function(n,t){return _pn(this,n,t)},MWn.mi=function(n,t){return fBn(this,n,t)},MWn.Zh=function(){return new ax(this)},MWn.$h=function(){return new ux(this)},MWn._h=function(n){return sin(this,n)},vX(y9n,"NotifyingInternalEListImpl",1994),wAn(622,1994,R9n),MWn.Hc=function(n){return bqn(this,n)},MWn.Zi=function(n,t,e,i,r){return yZ(this,n,t,e,i,r)},MWn.$i=function(n){Lv(this,n)},MWn.Wj=function(n){return this},MWn.ak=function(){return itn(this.e.Tg(),this.aj())},MWn._i=function(){return this.ak()},MWn.aj=function(){return Awn(this.e.Tg(),this.ak())},MWn.zk=function(){return BB(this.ak().Yj(),26).Bj()},MWn.Ak=function(){return Cvn(BB(this.ak(),18)).n},MWn.Ai=function(){return this.e},MWn.Bk=function(){return!0},MWn.Ck=function(){return!1},MWn.Dk=function(){return!1},MWn.Ek=function(){return!1},MWn.Xc=function(n){return uvn(this,n)},MWn.cj=function(n,t){var e;return e=BB(n,49),this.Dk()?this.Bk()?e.gh(this.e,this.Ak(),this.zk(),t):e.gh(this.e,Awn(e.Tg(),Cvn(BB(this.ak(),18))),null,t):e.gh(this.e,-1-this.aj(),null,t)},MWn.dj=function(n,t){var e;return e=BB(n,49),this.Dk()?this.Bk()?e.ih(this.e,this.Ak(),this.zk(),t):e.ih(this.e,Awn(e.Tg(),Cvn(BB(this.ak(),18))),null,t):e.ih(this.e,-1-this.aj(),null,t)},MWn.rk=function(){return!1},MWn.Fk=function(){return!0},MWn.wj=function(n){return x3(this.d,n)},MWn.ej=function(){return mA(this.e)},MWn.fj=function(){return 0!=this.i},MWn.ri=function(n){return Den(this.d,n)},MWn.li=function(n,t){return this.Fk()&&this.Ek()?GOn(this,n,BB(t,56)):t},MWn.Gk=function(n){return n.kh()?tfn(this.e,BB(n,49)):n},MWn.Wb=function(n){J$(this,n)},MWn.Pc=function(){return H9(this)},MWn.Qc=function(n){var t;if(this.Ek())for(t=this.i-1;t>=0;--t)Wtn(this,t);return Qwn(this,n)},MWn.Xj=function(){sqn(this)},MWn.oi=function(n,t){return _en(this,n,t)},vX(y9n,"EcoreEList",622),wAn(496,622,R9n,yH),MWn.ai=function(){return!1},MWn.aj=function(){return this.c},MWn.bj=function(){return!1},MWn.Fk=function(){return!0},MWn.hi=function(){return!0},MWn.li=function(n,t){return t},MWn.ni=function(){return!1},MWn.c=0,vX(y9n,"EObjectEList",496),wAn(85,496,R9n,$L),MWn.bj=function(){return!0},MWn.Dk=function(){return!1},MWn.rk=function(){return!0},vX(y9n,"EObjectContainmentEList",85),wAn(545,85,R9n,LL),MWn.ci=function(){this.b=!0},MWn.fj=function(){return this.b},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.b,this.b=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.b=!1},MWn.b=!1,vX(y9n,"EObjectContainmentEList/Unsettable",545),wAn(1140,545,R9n,YG),MWn.ii=function(n,t){var e,i;return e=BB(Iln(this,n,t),87),mA(this.e)&&Lv(this,new j9(this.a,7,(gWn(),a$t),iln(t),cL(i=e.c,88)?BB(i,26):d$t,n)),e},MWn.jj=function(n,t){return Zwn(this,BB(n,87),t)},MWn.kj=function(n,t){return Jwn(this,BB(n,87),t)},MWn.lj=function(n,t,e){return _jn(this,BB(n,87),BB(t,87),e)},MWn.Zi=function(n,t,e,i,r){switch(n){case 3:return yZ(this,n,t,e,i,this.i>1);case 5:return yZ(this,n,t,e,i,this.i-BB(e,15).gc()>0);default:return new N7(this.e,n,this.c,t,e,i,!0)}},MWn.ij=function(){return!0},MWn.fj=function(){return Rvn(this)},MWn.Xj=function(){sqn(this)},vX(l6n,"EClassImpl/1",1140),wAn(1154,1153,Z8n),MWn.ui=function(n){var t,e,i,r,c,a,u;if(8!=(e=n.xi())){if(0==(i=apn(n)))switch(e){case 1:case 9:null!=(u=n.Bi())&&(!(t=P5(BB(u,473))).c&&(t.c=new Bo),snn(t.c,n.Ai())),null!=(a=n.zi())&&0==(1&(r=BB(a,473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),f9(t.c,BB(n.Ai(),26)));break;case 3:null!=(a=n.zi())&&0==(1&(r=BB(a,473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),f9(t.c,BB(n.Ai(),26)));break;case 5:if(null!=(a=n.zi()))for(c=BB(a,14).Kc();c.Ob();)0==(1&(r=BB(c.Pb(),473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),f9(t.c,BB(n.Ai(),26)));break;case 4:null!=(u=n.Bi())&&0==(1&(r=BB(u,473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),snn(t.c,n.Ai()));break;case 6:if(null!=(u=n.Bi()))for(c=BB(u,14).Kc();c.Ob();)0==(1&(r=BB(c.Pb(),473)).Bb)&&(!(t=P5(r)).c&&(t.c=new Bo),snn(t.c,n.Ai()))}this.Hk(i)}},MWn.Hk=function(n){dRn(this,n)},MWn.b=63,vX(l6n,"ESuperAdapter",1154),wAn(1155,1154,Z8n,dp),MWn.Hk=function(n){ACn(this,n)},vX(l6n,"EClassImpl/10",1155),wAn(1144,696,R9n),MWn.Vh=function(n,t){return BTn(this,n,t)},MWn.Wh=function(n){return bmn(this,n)},MWn.Xh=function(n,t){Ifn(this,n,t)},MWn.Yh=function(n){c6(this,n)},MWn.pi=function(n){return F9(this,n)},MWn.mi=function(n,t){return onn(this,n,t)},MWn.lk=function(n,t){throw Hp(new pv)},MWn.Zh=function(){return new ax(this)},MWn.$h=function(){return new ux(this)},MWn._h=function(n){return sin(this,n)},MWn.mk=function(n,t){throw Hp(new pv)},MWn.Wj=function(n){return this},MWn.fj=function(){return 0!=this.i},MWn.Wb=function(n){throw Hp(new pv)},MWn.Xj=function(){throw Hp(new pv)},vX(y9n,"EcoreEList/UnmodifiableEList",1144),wAn(319,1144,R9n,NO),MWn.ni=function(){return!1},vX(y9n,"EcoreEList/UnmodifiableEList/FastCompare",319),wAn(1147,319,R9n,don),MWn.Xc=function(n){var t,e;if(cL(n,170)&&-1!=(t=BB(n,170).aj()))for(e=this.i;t<e;++t)if(GI(this.g[t])===GI(n))return t;return-1},vX(l6n,"EClassImpl/1EAllStructuralFeaturesList",1147),wAn(1141,497,h8n,Eo),MWn.ri=function(n){return x8(VAt,B9n,87,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/1EGenericSuperTypeEList",1141),wAn(623,497,h8n,To),MWn.ri=function(n){return x8(FAt,N9n,170,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/1EStructuralFeatureUniqueEList",623),wAn(741,497,h8n,Mo),MWn.ri=function(n){return x8(JAt,N9n,18,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/1ReferenceList",741),wAn(1142,497,h8n,gp),MWn.bi=function(n,t){tz(this,BB(t,34))},MWn.ri=function(n){return x8(BAt,N9n,34,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/2",1142),wAn(1143,497,h8n,So),MWn.ri=function(n){return x8(BAt,N9n,34,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/3",1143),wAn(1145,319,R9n,EH),MWn.Fc=function(n){return mB(this,BB(n,34))},MWn.Yh=function(n){JE(this,BB(n,34))},vX(l6n,"EClassImpl/4",1145),wAn(1146,319,R9n,TH),MWn.Fc=function(n){return yB(this,BB(n,18))},MWn.Yh=function(n){ZE(this,BB(n,18))},vX(l6n,"EClassImpl/5",1146),wAn(1148,497,h8n,Po),MWn.ri=function(n){return x8(QAt,x9n,59,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/6",1148),wAn(1149,497,h8n,Co),MWn.ri=function(n){return x8(JAt,N9n,18,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/7",1149),wAn(1997,1996,{3:1,4:1,20:1,28:1,52:1,14:1,15:1,67:1,58:1,69:1}),MWn.Vh=function(n,t){return uFn(this,n,t)},MWn.Wh=function(n){return uFn(this,this.Vi(),n)},MWn.Xh=function(n,t){eAn(this,n,t)},MWn.Yh=function(n){OOn(this,n)},MWn.lk=function(n,t){return wmn(this,n,t)},MWn.mk=function(n,t){return Fpn(this,n,t)},MWn.mi=function(n,t){return oFn(this,n,t)},MWn.pi=function(n){return this.Oi(n)},MWn.Zh=function(){return new ax(this)},MWn.Gi=function(){return this.Ji()},MWn.$h=function(){return new ux(this)},MWn._h=function(n){return sin(this,n)},vX(y9n,"DelegatingNotifyingInternalEListImpl",1997),wAn(742,1997,H9n),MWn.ai=function(){var n;return cL(n=itn(jY(this.b),this.aj()).Yj(),148)&&!cL(n,457)&&0==(1&n.Bj().i)},MWn.Hc=function(n){var t,e,i,r,c,a,u;if(this.Fk()){if((u=this.Vi())>4){if(!this.wj(n))return!1;if(this.rk()){if(a=(t=(e=BB(n,49)).Ug())==this.b&&(this.Dk()?e.Og(e.Vg(),BB(itn(jY(this.b),this.aj()).Yj(),26).Bj())==Cvn(BB(itn(jY(this.b),this.aj()),18)).n:-1-e.Vg()==this.aj()),this.Ek()&&!a&&!t&&e.Zg())for(i=0;i<u;++i)if(GI(Gz(this,this.Oi(i)))===GI(n))return!0;return a}if(this.Dk()&&!this.Ck()){if(GI(r=BB(n,56).ah(Cvn(BB(itn(jY(this.b),this.aj()),18))))===GI(this.b))return!0;if(null==r||!BB(r,56).kh())return!1}}if(c=this.Li(n),this.Ek()&&!c)for(i=0;i<u;++i)if(GI(e=Gz(this,this.Oi(i)))===GI(n))return!0;return c}return this.Li(n)},MWn.Zi=function(n,t,e,i,r){return new N7(this.b,n,this.aj(),t,e,i,r)},MWn.$i=function(n){ban(this.b,n)},MWn.Wj=function(n){return this},MWn._i=function(){return itn(jY(this.b),this.aj())},MWn.aj=function(){return Awn(jY(this.b),itn(jY(this.b),this.aj()))},MWn.Ai=function(){return this.b},MWn.Bk=function(){return!!itn(jY(this.b),this.aj()).Yj().Bj()},MWn.bj=function(){var n;return!(!cL(n=itn(jY(this.b),this.aj()),99)||0==(BB(n,18).Bb&h6n)&&!Cvn(BB(n,18)))},MWn.Ck=function(){var n,t,e;return!!cL(n=itn(jY(this.b),this.aj()),99)&&!!(t=Cvn(BB(n,18)))&&((e=t.t)>1||-1==e)},MWn.Dk=function(){var n;return!!cL(n=itn(jY(this.b),this.aj()),99)&&!!Cvn(BB(n,18))},MWn.Ek=function(){var n;return!!cL(n=itn(jY(this.b),this.aj()),99)&&0!=(BB(n,18).Bb&BQn)},MWn.Xc=function(n){var t,e,i;if((e=this.Qi(n))>=0)return e;if(this.Fk())for(t=0,i=this.Vi();t<i;++t)if(GI(Gz(this,this.Oi(t)))===GI(n))return t;return-1},MWn.cj=function(n,t){var e;return e=BB(n,49),this.Dk()?this.Bk()?e.gh(this.b,Cvn(BB(itn(jY(this.b),this.aj()),18)).n,BB(itn(jY(this.b),this.aj()).Yj(),26).Bj(),t):e.gh(this.b,Awn(e.Tg(),Cvn(BB(itn(jY(this.b),this.aj()),18))),null,t):e.gh(this.b,-1-this.aj(),null,t)},MWn.dj=function(n,t){var e;return e=BB(n,49),this.Dk()?this.Bk()?e.ih(this.b,Cvn(BB(itn(jY(this.b),this.aj()),18)).n,BB(itn(jY(this.b),this.aj()).Yj(),26).Bj(),t):e.ih(this.b,Awn(e.Tg(),Cvn(BB(itn(jY(this.b),this.aj()),18))),null,t):e.ih(this.b,-1-this.aj(),null,t)},MWn.rk=function(){var n;return!!cL(n=itn(jY(this.b),this.aj()),99)&&0!=(BB(n,18).Bb&h6n)},MWn.Fk=function(){return cL(itn(jY(this.b),this.aj()).Yj(),88)},MWn.wj=function(n){return itn(jY(this.b),this.aj()).Yj().wj(n)},MWn.ej=function(){return mA(this.b)},MWn.fj=function(){return!this.Ri()},MWn.hi=function(){return itn(jY(this.b),this.aj()).hi()},MWn.li=function(n,t){return eGn(this,n,t)},MWn.Wb=function(n){vqn(this),pX(this,BB(n,15))},MWn.Pc=function(){var n;if(this.Ek())for(n=this.Vi()-1;n>=0;--n)eGn(this,n,this.Oi(n));return this.Wi()},MWn.Qc=function(n){var t;if(this.Ek())for(t=this.Vi()-1;t>=0;--t)eGn(this,t,this.Oi(t));return this.Xi(n)},MWn.Xj=function(){vqn(this)},MWn.oi=function(n,t){return B9(this,n,t)},vX(y9n,"DelegatingEcoreEList",742),wAn(1150,742,H9n,uR),MWn.Hi=function(n,t){lD(this,n,BB(t,26))},MWn.Ii=function(n){e$(this,BB(n,26))},MWn.Oi=function(n){var t;return cL(t=BB(Wtn(a4(this.a),n),87).c,88)?BB(t,26):(gWn(),d$t)},MWn.Ti=function(n){var t;return cL(t=BB(fDn(a4(this.a),n),87).c,88)?BB(t,26):(gWn(),d$t)},MWn.Ui=function(n,t){return dmn(this,n,BB(t,26))},MWn.ai=function(){return!1},MWn.Zi=function(n,t,e,i,r){return null},MWn.Ji=function(){return new pp(this)},MWn.Ki=function(){sqn(a4(this.a))},MWn.Li=function(n){return Ufn(this,n)},MWn.Mi=function(n){var t;for(t=n.Kc();t.Ob();)if(!Ufn(this,t.Pb()))return!1;return!0},MWn.Ni=function(n){var t,e,i;if(cL(n,15)&&(i=BB(n,15)).gc()==a4(this.a).i){for(t=i.Kc(),e=new AL(this);t.Ob();)if(GI(t.Pb())!==GI(kpn(e)))return!1;return!0}return!1},MWn.Pi=function(){var n,t,e,i;for(t=1,n=new AL(a4(this.a));n.e!=n.i.gc();)t=31*t+((e=cL(i=BB(kpn(n),87).c,88)?BB(i,26):(gWn(),d$t))?PN(e):0);return t},MWn.Qi=function(n){var t,e,i,r;for(i=0,e=new AL(a4(this.a));e.e!=e.i.gc();){if(t=BB(kpn(e),87),GI(n)===GI(cL(r=t.c,88)?BB(r,26):(gWn(),d$t)))return i;++i}return-1},MWn.Ri=function(){return 0==a4(this.a).i},MWn.Si=function(){return null},MWn.Vi=function(){return a4(this.a).i},MWn.Wi=function(){var n,t,e,i,r,c;for(c=a4(this.a).i,r=x8(Ant,HWn,1,c,5,1),e=0,t=new AL(a4(this.a));t.e!=t.i.gc();)n=BB(kpn(t),87),r[e++]=cL(i=n.c,88)?BB(i,26):(gWn(),d$t);return r},MWn.Xi=function(n){var t,e,i,r;for(r=a4(this.a).i,n.length<r&&(n=Den(tsn(n).c,r)),n.length>r&&$X(n,r,null),e=0,t=new AL(a4(this.a));t.e!=t.i.gc();)$X(n,e++,cL(i=BB(kpn(t),87).c,88)?BB(i,26):(gWn(),d$t));return n},MWn.Yi=function(){var n,t,e,i,r;for((r=new Sk).a+="[",n=a4(this.a),t=0,i=a4(this.a).i;t<i;)cO(r,kN(cL(e=BB(Wtn(n,t),87).c,88)?BB(e,26):(gWn(),d$t))),++t<i&&(r.a+=FWn);return r.a+="]",r.a},MWn.$i=function(n){},MWn.aj=function(){return 10},MWn.Bk=function(){return!0},MWn.bj=function(){return!1},MWn.Ck=function(){return!1},MWn.Dk=function(){return!1},MWn.Ek=function(){return!0},MWn.rk=function(){return!1},MWn.Fk=function(){return!0},MWn.wj=function(n){return cL(n,88)},MWn.fj=function(){return Q0(this.a)},MWn.hi=function(){return!0},MWn.ni=function(){return!0},vX(l6n,"EClassImpl/8",1150),wAn(1151,1964,LVn,pp),MWn.Zc=function(n){return sin(this.a,n)},MWn.gc=function(){return a4(this.a.a).i},vX(l6n,"EClassImpl/8/1",1151),wAn(1152,497,h8n,Io),MWn.ri=function(n){return x8(HAt,HWn,138,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"EClassImpl/9",1152),wAn(1139,53,eYn,Im),vX(l6n,"EClassImpl/MyHashSet",1139),wAn(566,351,{105:1,92:1,90:1,138:1,148:1,834:1,147:1,191:1,56:1,108:1,49:1,97:1,351:1,150:1,114:1,115:1,676:1},Ev),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return null!=this.D?this.D:this.B;case 3:return iyn(this);case 4:return this.zj();case 5:return this.F;case 6:return t?Utn(this):wZ(this);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),this.A;case 8:return hN(),0!=(256&this.Bb)}return U9(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return null!=this.zj();case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i;case 8:return 0==(256&this.Bb)}return O3(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14));case 8:return void Zfn(this,qy(TD(t)))}Lbn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n),t)},MWn.zh=function(){return gWn(),u$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A);case 8:return void Zfn(this,!0)}qfn(this,n-bX(this.zh()),itn(BB(yan(this,16),26)||this.zh(),n))},MWn.Gh=function(){Cfn((IPn(),Z$t),this).ne(),this.Bb|=1},MWn.Fj=function(){var n,t;if(!this.c&&!(n=G$n(Utn(this))).dc())for(t=n.Kc();t.Ob();)N_n(this,SD(t.Pb()))&&Rln(this);return this.b},MWn.zj=function(){var n;if(!this.e){n=null;try{n=iyn(this)}catch(t){if(!cL(t=lun(t),102))throw Hp(t)}this.d=null,n&&0!=(1&n.i)&&(this.d=n==$Nt?(hN(),ptt):n==ANt?iln(0):n==DNt?new Nb(0):n==xNt?0:n==LNt?jgn(0):n==RNt?rln(0):n==NNt?Pnn(0):fun(0)),this.e=!0}return this.d},MWn.Ej=function(){return 0!=(256&this.Bb)},MWn.Ik=function(n){n&&(this.D="org.eclipse.emf.common.util.AbstractEnumerator")},MWn.xk=function(n){Urn(this,n),this.Ik(n)},MWn.yk=function(n){this.C=n,this.e=!1},MWn.Ib=function(){var n;return 0!=(64&this.Db)?Cwn(this):((n=new fN(Cwn(this))).a+=" (serializable: ",yE(n,0!=(256&this.Bb)),n.a+=")",n.a)},MWn.c=!1,MWn.d=null,MWn.e=!1,vX(l6n,"EDataTypeImpl",566),wAn(457,566,{105:1,92:1,90:1,138:1,148:1,834:1,671:1,147:1,191:1,56:1,108:1,49:1,97:1,351:1,457:1,150:1,114:1,115:1,676:1},Am),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return null!=this.D?this.D:this.B;case 3:return iyn(this);case 4:return Qsn(this);case 5:return this.F;case 6:return t?Utn(this):wZ(this);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),this.A;case 8:return hN(),0!=(256&this.Bb);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),this.a}return U9(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 6:return this.Cb&&(e=(i=this.Db>>16)>=0?fyn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,6,e);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),Ywn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),o$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),o$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 6:return T_n(this,null,6,e);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),_pn(this.A,n,e);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),_pn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),o$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),o$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return null!=this.D&&this.D==this.F;case 3:return!!iyn(this);case 4:return!!Qsn(this);case 5:return null!=this.F&&this.F!=this.D&&this.F!=this.B;case 6:return!!wZ(this);case 7:return!!this.A&&0!=this.A.i;case 8:return 0==(256&this.Bb);case 9:return!!this.a&&0!=this.a.i}return O3(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void ZZ(this,SD(t));case 2:return void IA(this,SD(t));case 5:return void Yqn(this,SD(t));case 7:return!this.A&&(this.A=new NL(O$t,this,7)),sqn(this.A),!this.A&&(this.A=new NL(O$t,this,7)),void pX(this.A,BB(t,14));case 8:return void Zfn(this,qy(TD(t)));case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),sqn(this.a),!this.a&&(this.a=new eU(WAt,this,9,5)),void pX(this.a,BB(t,14))}Lbn(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n),t)},MWn.zh=function(){return gWn(),o$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,179)&&(BB(this.Cb,179).tb=null),void Nrn(this,null);case 2:return Dsn(this,null),void xen(this,this.D);case 5:return void Yqn(this,null);case 7:return!this.A&&(this.A=new NL(O$t,this,7)),void sqn(this.A);case 8:return void Zfn(this,!0);case 9:return!this.a&&(this.a=new eU(WAt,this,9,5)),void sqn(this.a)}qfn(this,n-bX((gWn(),o$t)),itn(BB(yan(this,16),26)||o$t,n))},MWn.Gh=function(){var n,t;if(this.a)for(n=0,t=this.a.i;n<t;++n)vx(Wtn(this.a,n));Cfn((IPn(),Z$t),this).ne(),this.Bb|=1},MWn.zj=function(){return Qsn(this)},MWn.wj=function(n){return null!=n},MWn.Ik=function(n){},vX(l6n,"EEnumImpl",457),wAn(573,438,{105:1,92:1,90:1,1940:1,678:1,147:1,191:1,56:1,108:1,49:1,97:1,573:1,150:1,114:1,115:1},jv),MWn.ne=function(){return this.zb},MWn.Qg=function(n){return lkn(this,n)},MWn._g=function(n,t,e){var i;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return iln(this.d);case 3:return this.b?this.b:this.a;case 4:return null==(i=this.c)?this.zb:i;case 5:return this.Db>>16==5?BB(this.Cb,671):null}return U9(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 5:return this.Cb&&(e=(i=this.Db>>16)>=0?lkn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,5,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),s$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),s$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 5:return T_n(this,null,5,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),s$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),s$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0!=this.d;case 3:return!!this.b;case 4:return null!=this.c;case 5:return!(this.Db>>16!=5||!BB(this.Cb,671))}return O3(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return void $en(this,BB(t,19).a);case 3:return void gOn(this,BB(t,1940));case 4:return void Fin(this,SD(t))}Lbn(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n),t)},MWn.zh=function(){return gWn(),s$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return void $en(this,0);case 3:return void gOn(this,null);case 4:return void Fin(this,null)}qfn(this,n-bX((gWn(),s$t)),itn(BB(yan(this,16),26)||s$t,n))},MWn.Ib=function(){var n;return null==(n=this.c)?this.zb:n},MWn.b=null,MWn.c=null,MWn.d=0,vX(l6n,"EEnumLiteralImpl",573);var L$t,N$t,x$t,D$t=bq(l6n,"EFactoryImpl/InternalEDateTimeFormat");wAn(489,1,{2015:1},vp),vX(l6n,"EFactoryImpl/1ClientInternalEDateTimeFormat",489),wAn(241,115,{105:1,92:1,90:1,87:1,56:1,108:1,49:1,97:1,241:1,114:1,115:1},Kp),MWn.Sg=function(n,t,e){var i;return e=T_n(this,n,t,e),this.e&&cL(n,170)&&(i=kLn(this,this.e))!=this.c&&(e=azn(this,i,e)),e},MWn._g=function(n,t,e){switch(n){case 0:return this.f;case 1:return!this.d&&(this.d=new $L(VAt,this,1)),this.d;case 2:return t?lFn(this):this.c;case 3:return this.b;case 4:return this.e;case 5:return t?qvn(this):this.a}return U9(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return nfn(this,null,e);case 1:return!this.d&&(this.d=new $L(VAt,this,1)),_pn(this.d,n,e);case 3:return Zhn(this,null,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),f$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),f$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.f;case 1:return!!this.d&&0!=this.d.i;case 2:return!!this.c;case 3:return!!this.b;case 4:return!!this.e;case 5:return!!this.a}return O3(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n))},MWn.sh=function(n,t){switch(n){case 0:return void jEn(this,BB(t,87));case 1:return!this.d&&(this.d=new $L(VAt,this,1)),sqn(this.d),!this.d&&(this.d=new $L(VAt,this,1)),void pX(this.d,BB(t,14));case 3:return void kEn(this,BB(t,87));case 4:return void DMn(this,BB(t,836));case 5:return void cen(this,BB(t,138))}Lbn(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n),t)},MWn.zh=function(){return gWn(),f$t},MWn.Bh=function(n){switch(n){case 0:return void jEn(this,null);case 1:return!this.d&&(this.d=new $L(VAt,this,1)),void sqn(this.d);case 3:return void kEn(this,null);case 4:return void DMn(this,null);case 5:return void cen(this,null)}qfn(this,n-bX((gWn(),f$t)),itn(BB(yan(this,16),26)||f$t,n))},MWn.Ib=function(){var n;return(n=new lN(P$n(this))).a+=" (expression: ",bHn(this,n),n.a+=")",n.a},vX(l6n,"EGenericTypeImpl",241),wAn(1969,1964,q9n),MWn.Xh=function(n,t){nR(this,n,t)},MWn.lk=function(n,t){return nR(this,this.gc(),n),t},MWn.pi=function(n){return Dpn(this.Gi(),n)},MWn.Zh=function(){return this.$h()},MWn.Gi=function(){return new Pp(this)},MWn.$h=function(){return this._h(0)},MWn._h=function(n){return this.Gi().Zc(n)},MWn.mk=function(n,t){return ywn(this,n,!0),t},MWn.ii=function(n,t){var e;return e=tkn(this,t),this.Zc(n).Rb(e),e},MWn.ji=function(n,t){ywn(this,t,!0),this.Zc(n).Rb(t)},vX(y9n,"AbstractSequentialInternalEList",1969),wAn(486,1969,q9n,QN),MWn.pi=function(n){return Dpn(this.Gi(),n)},MWn.Zh=function(){return null==this.b?(YM(),YM(),x$t):this.Jk()},MWn.Gi=function(){return new DO(this.a,this.b)},MWn.$h=function(){return null==this.b?(YM(),YM(),x$t):this.Jk()},MWn._h=function(n){var t,e;if(null==this.b){if(n<0||n>1)throw Hp(new Ay(e9n+n+", size=0"));return YM(),YM(),x$t}for(e=this.Jk(),t=0;t<n;++t)Man(e);return e},MWn.dc=function(){var n,t,e,i,r,c;if(null!=this.b)for(e=0;e<this.b.length;++e)if(n=this.b[e],!this.Mk()||this.a.mh(n))if(c=this.a.bh(n,!1),ZM(),BB(n,66).Oj()){for(i=0,r=(t=BB(c,153)).gc();i<r;++i)if(wX(t.il(i))&&null!=t.jl(i))return!1}else if(n.$j()){if(!BB(c,14).dc())return!1}else if(null!=c)return!1;return!0},MWn.Kc=function(){return Ern(this)},MWn.Zc=function(n){var t,e;if(null==this.b){if(0!=n)throw Hp(new Ay(e9n+n+", size=0"));return YM(),YM(),x$t}for(e=this.Lk()?this.Kk():this.Jk(),t=0;t<n;++t)Man(e);return e},MWn.ii=function(n,t){throw Hp(new pv)},MWn.ji=function(n,t){throw Hp(new pv)},MWn.Jk=function(){return new YN(this.a,this.b)},MWn.Kk=function(){return new Vx(this.a,this.b)},MWn.Lk=function(){return!0},MWn.gc=function(){var n,t,e,i,r,c,a;if(r=0,null!=this.b)for(e=0;e<this.b.length;++e)if(n=this.b[e],!this.Mk()||this.a.mh(n))if(a=this.a.bh(n,!1),ZM(),BB(n,66).Oj())for(i=0,c=(t=BB(a,153)).gc();i<c;++i)wX(t.il(i))&&null!=t.jl(i)&&++r;else n.$j()?r+=BB(a,14).gc():null!=a&&++r;return r},MWn.Mk=function(){return!0},vX(y9n,"EContentsEList",486),wAn(1156,486,q9n,Wx),MWn.Jk=function(){return new Qx(this.a,this.b)},MWn.Kk=function(){return new Yx(this.a,this.b)},MWn.Mk=function(){return!1},vX(l6n,"ENamedElementImpl/1",1156),wAn(279,1,G9n,YN),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){throw Hp(new pv)},MWn.Nk=function(n){if(0!=this.g||this.e)throw Hp(new Fy("Iterator already in use or already filtered"));this.e=n},MWn.Ob=function(){var n,t,e,i,r,c;switch(this.g){case 3:case 2:return!0;case 1:return!1;case-3:this.p?this.p.Pb():++this.n;default:if(this.k&&(this.p?kPn(this,this.p):pOn(this)))return r=this.p?this.p.Pb():this.j?this.j.pi(this.n++):this.k.Xb(this.n++),this.f?((n=BB(r,72)).ak(),e=n.dd(),this.i=e):(e=r,this.i=e),this.g=3,!0;for(;this.d<this.c.length;)if(t=this.c[this.d++],(!this.e||t.Gj()!=NOt||0!=t.aj())&&(!this.Mk()||this.b.mh(t)))if(c=this.b.bh(t,this.Lk()),this.f=(ZM(),BB(t,66).Oj()),this.f||t.$j()){if(this.Lk()?(i=BB(c,15),this.k=i):(i=BB(c,69),this.k=this.j=i),cL(this.k,54)?(this.p=null,this.o=this.k.gc(),this.n=0):this.p=this.j?this.j.$h():this.k.Yc(),this.p?kPn(this,this.p):pOn(this))return r=this.p?this.p.Pb():this.j?this.j.pi(this.n++):this.k.Xb(this.n++),this.f?((n=BB(r,72)).ak(),e=n.dd(),this.i=e):(e=r,this.i=e),this.g=3,!0}else if(null!=c)return this.k=null,this.p=null,e=c,this.i=e,this.g=2,!0;return this.k=null,this.p=null,this.f=!1,this.g=1,!1}},MWn.Sb=function(){var n,t,e,i,r,c;switch(this.g){case-3:case-2:return!0;case-1:return!1;case 3:this.p?this.p.Ub():--this.n;default:if(this.k&&(this.p?jPn(this,this.p):wCn(this)))return r=this.p?this.p.Ub():this.j?this.j.pi(--this.n):this.k.Xb(--this.n),this.f?((n=BB(r,72)).ak(),e=n.dd(),this.i=e):(e=r,this.i=e),this.g=-3,!0;for(;this.d>0;)if(t=this.c[--this.d],(!this.e||t.Gj()!=NOt||0!=t.aj())&&(!this.Mk()||this.b.mh(t)))if(c=this.b.bh(t,this.Lk()),this.f=(ZM(),BB(t,66).Oj()),this.f||t.$j()){if(this.Lk()?(i=BB(c,15),this.k=i):(i=BB(c,69),this.k=this.j=i),cL(this.k,54)?(this.o=this.k.gc(),this.n=this.o):this.p=this.j?this.j._h(this.k.gc()):this.k.Zc(this.k.gc()),this.p?jPn(this,this.p):wCn(this))return r=this.p?this.p.Ub():this.j?this.j.pi(--this.n):this.k.Xb(--this.n),this.f?((n=BB(r,72)).ak(),e=n.dd(),this.i=e):(e=r,this.i=e),this.g=-3,!0}else if(null!=c)return this.k=null,this.p=null,e=c,this.i=e,this.g=-2,!0;return this.k=null,this.p=null,this.g=-1,!1}},MWn.Pb=function(){return Man(this)},MWn.Tb=function(){return this.a},MWn.Ub=function(){var n;if(this.g<-1||this.Sb())return--this.a,this.g=0,n=this.i,this.Sb(),n;throw Hp(new yv)},MWn.Vb=function(){return this.a-1},MWn.Qb=function(){throw Hp(new pv)},MWn.Lk=function(){return!1},MWn.Wb=function(n){throw Hp(new pv)},MWn.Mk=function(){return!0},MWn.a=0,MWn.d=0,MWn.f=!1,MWn.g=0,MWn.n=0,MWn.o=0,vX(y9n,"EContentsEList/FeatureIteratorImpl",279),wAn(697,279,G9n,Vx),MWn.Lk=function(){return!0},vX(y9n,"EContentsEList/ResolvingFeatureIteratorImpl",697),wAn(1157,697,G9n,Yx),MWn.Mk=function(){return!1},vX(l6n,"ENamedElementImpl/1/1",1157),wAn(1158,279,G9n,Qx),MWn.Mk=function(){return!1},vX(l6n,"ENamedElementImpl/1/2",1158),wAn(36,143,t9n,f4,l4,nU,k9,N7,t6,Hen,S0,qen,P0,J5,C0,Uen,I0,Z5,O0,Gen,A0,tU,j9,GQ,zen,$0,n6,L0),MWn._i=function(){return h9(this)},MWn.gj=function(){var n;return(n=h9(this))?n.zj():null},MWn.yi=function(n){return-1==this.b&&this.a&&(this.b=this.c.Xg(this.a.aj(),this.a.Gj())),this.c.Og(this.b,n)},MWn.Ai=function(){return this.c},MWn.hj=function(){var n;return!!(n=h9(this))&&n.Kj()},MWn.b=-1,vX(l6n,"ENotificationImpl",36),wAn(399,284,{105:1,92:1,90:1,147:1,191:1,56:1,59:1,108:1,472:1,49:1,97:1,150:1,399:1,284:1,114:1,115:1},$m),MWn.Qg=function(n){return Pkn(this,n)},MWn._g=function(n,t,e){var i;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),(i=this.t)>1||-1==i;case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return this.Db>>16==10?BB(this.Cb,26):null;case 11:return!this.d&&(this.d=new NL(O$t,this,11)),this.d;case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),this.c;case 13:return!this.a&&(this.a=new oR(this,this)),this.a;case 14:return H7(this)}return U9(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 10:return this.Cb&&(e=(i=this.Db>>16)>=0?Pkn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,10,e);case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),Ywn(this.c,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),g$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),g$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e);case 10:return T_n(this,null,10,e);case 11:return!this.d&&(this.d=new NL(O$t,this,11)),_pn(this.d,n,e);case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),_pn(this.c,n,e);case 14:return _pn(H7(this),n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),g$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),g$t)),n,e)},MWn.lh=function(n){var t;switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return(t=this.t)>1||-1==t;case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return!(this.Db>>16!=10||!BB(this.Cb,26));case 11:return!!this.d&&0!=this.d.i;case 12:return!!this.c&&0!=this.c.i;case 13:return!(!this.a||0==H7(this.a.a).i||this.b&&Kvn(this.b));case 14:return!!this.b&&Kvn(this.b)}return O3(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void Nen(this,BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 11:return!this.d&&(this.d=new NL(O$t,this,11)),sqn(this.d),!this.d&&(this.d=new NL(O$t,this,11)),void pX(this.d,BB(t,14));case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),sqn(this.c),!this.c&&(this.c=new eU(YAt,this,12,10)),void pX(this.c,BB(t,14));case 13:return!this.a&&(this.a=new oR(this,this)),vqn(this.a),!this.a&&(this.a=new oR(this,this)),void pX(this.a,BB(t,14));case 14:return sqn(H7(this)),void pX(H7(this),BB(t,14))}Lbn(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n),t)},MWn.zh=function(){return gWn(),g$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void Nen(this,1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 11:return!this.d&&(this.d=new NL(O$t,this,11)),void sqn(this.d);case 12:return!this.c&&(this.c=new eU(YAt,this,12,10)),void sqn(this.c);case 13:return void(this.a&&vqn(this.a));case 14:return void(this.b&&sqn(this.b))}qfn(this,n-bX((gWn(),g$t)),itn(BB(yan(this,16),26)||g$t,n))},MWn.Gh=function(){var n,t;if(this.c)for(n=0,t=this.c.i;n<t;++n)vx(Wtn(this.c,n));Ikn(this),this.Bb|=1},vX(l6n,"EOperationImpl",399),wAn(505,742,H9n,oR),MWn.Hi=function(n,t){fD(this,n,BB(t,138))},MWn.Ii=function(n){i$(this,BB(n,138))},MWn.Oi=function(n){return BB(Wtn(H7(this.a),n),87).c||(gWn(),l$t)},MWn.Ti=function(n){return BB(fDn(H7(this.a),n),87).c||(gWn(),l$t)},MWn.Ui=function(n,t){return bgn(this,n,BB(t,138))},MWn.ai=function(){return!1},MWn.Zi=function(n,t,e,i,r){return null},MWn.Ji=function(){return new mp(this)},MWn.Ki=function(){sqn(H7(this.a))},MWn.Li=function(n){return oln(this,n)},MWn.Mi=function(n){var t;for(t=n.Kc();t.Ob();)if(!oln(this,t.Pb()))return!1;return!0},MWn.Ni=function(n){var t,e,i;if(cL(n,15)&&(i=BB(n,15)).gc()==H7(this.a).i){for(t=i.Kc(),e=new AL(this);t.Ob();)if(GI(t.Pb())!==GI(kpn(e)))return!1;return!0}return!1},MWn.Pi=function(){var n,t,e;for(t=1,n=new AL(H7(this.a));n.e!=n.i.gc();)t=31*t+((e=BB(kpn(n),87).c||(gWn(),l$t))?nsn(e):0);return t},MWn.Qi=function(n){var t,e,i;for(i=0,e=new AL(H7(this.a));e.e!=e.i.gc();){if(t=BB(kpn(e),87),GI(n)===GI(t.c||(gWn(),l$t)))return i;++i}return-1},MWn.Ri=function(){return 0==H7(this.a).i},MWn.Si=function(){return null},MWn.Vi=function(){return H7(this.a).i},MWn.Wi=function(){var n,t,e,i,r;for(r=H7(this.a).i,i=x8(Ant,HWn,1,r,5,1),e=0,t=new AL(H7(this.a));t.e!=t.i.gc();)n=BB(kpn(t),87),i[e++]=n.c||(gWn(),l$t);return i},MWn.Xi=function(n){var t,e,i;for(i=H7(this.a).i,n.length<i&&(n=Den(tsn(n).c,i)),n.length>i&&$X(n,i,null),e=0,t=new AL(H7(this.a));t.e!=t.i.gc();)$X(n,e++,BB(kpn(t),87).c||(gWn(),l$t));return n},MWn.Yi=function(){var n,t,e,i;for((i=new Sk).a+="[",n=H7(this.a),t=0,e=H7(this.a).i;t<e;)cO(i,kN(BB(Wtn(n,t),87).c||(gWn(),l$t))),++t<e&&(i.a+=FWn);return i.a+="]",i.a},MWn.$i=function(n){},MWn.aj=function(){return 13},MWn.Bk=function(){return!0},MWn.bj=function(){return!1},MWn.Ck=function(){return!1},MWn.Dk=function(){return!1},MWn.Ek=function(){return!0},MWn.rk=function(){return!1},MWn.Fk=function(){return!0},MWn.wj=function(n){return cL(n,138)},MWn.fj=function(){return V0(this.a)},MWn.hi=function(){return!0},MWn.ni=function(){return!0},vX(l6n,"EOperationImpl/1",505),wAn(1340,1964,LVn,mp),MWn.Zc=function(n){return sin(this.a,n)},MWn.gc=function(){return H7(this.a.a).i},vX(l6n,"EOperationImpl/1/1",1340),wAn(1341,545,R9n,JG),MWn.ii=function(n,t){var e;return e=BB(Iln(this,n,t),87),mA(this.e)&&Lv(this,new j9(this.a,7,(gWn(),p$t),iln(t),e.c||l$t,n)),e},MWn.jj=function(n,t){return Mfn(this,BB(n,87),t)},MWn.kj=function(n,t){return Sfn(this,BB(n,87),t)},MWn.lj=function(n,t,e){return Wgn(this,BB(n,87),BB(t,87),e)},MWn.Zi=function(n,t,e,i,r){switch(n){case 3:return yZ(this,n,t,e,i,this.i>1);case 5:return yZ(this,n,t,e,i,this.i-BB(e,15).gc()>0);default:return new N7(this.e,n,this.c,t,e,i,!0)}},MWn.ij=function(){return!0},MWn.fj=function(){return Kvn(this)},MWn.Xj=function(){sqn(this)},vX(l6n,"EOperationImpl/2",1341),wAn(498,1,{1938:1,498:1},OI),vX(l6n,"EPackageImpl/1",498),wAn(16,85,R9n,eU),MWn.zk=function(){return this.d},MWn.Ak=function(){return this.b},MWn.Dk=function(){return!0},MWn.b=0,vX(y9n,"EObjectContainmentWithInverseEList",16),wAn(353,16,R9n,eK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentWithInverseEList/Resolving",353),wAn(298,353,R9n,Jz),MWn.ci=function(){this.a.tb=null},vX(l6n,"EPackageImpl/2",298),wAn(1228,1,{},Oo),vX(l6n,"EPackageImpl/3",1228),wAn(718,43,tYn,Nm),MWn._b=function(n){return XI(n)?eY(this,n):!!AY(this.f,n)},vX(l6n,"EPackageRegistryImpl",718),wAn(509,284,{105:1,92:1,90:1,147:1,191:1,56:1,2017:1,108:1,472:1,49:1,97:1,150:1,509:1,284:1,114:1,115:1},Lm),MWn.Qg=function(n){return Ckn(this,n)},MWn._g=function(n,t,e){var i;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),(i=this.t)>1||-1==i;case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return this.Db>>16==10?BB(this.Cb,59):null}return U9(this,n-bX((gWn(),m$t)),itn(BB(yan(this,16),26)||m$t,n),t,e)},MWn.hh=function(n,t,e){var i;switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),Ywn(this.Ab,n,e);case 10:return this.Cb&&(e=(i=this.Db>>16)>=0?Ckn(this,e):this.Cb.ih(this,-1-i,null,e)),T_n(this,n,10,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),m$t),t),66).Nj().Qj(this,fgn(this),t-bX((gWn(),m$t)),n,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 9:return gX(this,e);case 10:return T_n(this,null,10,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),m$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),m$t)),n,e)},MWn.lh=function(n){var t;switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return(t=this.t)>1||-1==t;case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return!(this.Db>>16!=10||!BB(this.Cb,59))}return O3(this,n-bX((gWn(),m$t)),itn(BB(yan(this,16),26)||m$t,n))},MWn.zh=function(){return gWn(),m$t},vX(l6n,"EParameterImpl",509),wAn(99,449,{105:1,92:1,90:1,147:1,191:1,56:1,18:1,170:1,66:1,108:1,472:1,49:1,97:1,150:1,99:1,449:1,284:1,114:1,115:1,677:1},pD),MWn._g=function(n,t,e){var i,r;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return hN(),0!=(256&this.Bb);case 3:return hN(),0!=(512&this.Bb);case 4:return iln(this.s);case 5:return iln(this.t);case 6:return hN(),(r=this.t)>1||-1==r;case 7:return hN(),this.s>=1;case 8:return t?Ikn(this):this.r;case 9:return this.q;case 10:return hN(),0!=(this.Bb&k6n);case 11:return hN(),0!=(this.Bb&M9n);case 12:return hN(),0!=(this.Bb&_Qn);case 13:return this.j;case 14:return qLn(this);case 15:return hN(),0!=(this.Bb&T9n);case 16:return hN(),0!=(this.Bb&hVn);case 17:return dZ(this);case 18:return hN(),0!=(this.Bb&h6n);case 19:return hN(),!(!(i=Cvn(this))||0==(i.Bb&h6n));case 20:return hN(),0!=(this.Bb&BQn);case 21:return t?Cvn(this):this.b;case 22:return t?Ion(this):K5(this);case 23:return!this.a&&(this.a=new RL(BAt,this,23)),this.a}return U9(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n),t,e)},MWn.lh=function(n){var t,e;switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return 0==(256&this.Bb);case 3:return 0==(512&this.Bb);case 4:return 0!=this.s;case 5:return 1!=this.t;case 6:return(e=this.t)>1||-1==e;case 7:return this.s>=1;case 8:return!!this.r&&!this.q.e&&0==yW(this.q).i;case 9:return!(!this.q||this.r&&!this.q.e&&0==yW(this.q).i);case 10:return 0==(this.Bb&k6n);case 11:return 0!=(this.Bb&M9n);case 12:return 0!=(this.Bb&_Qn);case 13:return null!=this.j;case 14:return null!=qLn(this);case 15:return 0!=(this.Bb&T9n);case 16:return 0!=(this.Bb&hVn);case 17:return!!dZ(this);case 18:return 0!=(this.Bb&h6n);case 19:return!!(t=Cvn(this))&&0!=(t.Bb&h6n);case 20:return 0==(this.Bb&BQn);case 21:return!!this.b;case 22:return!!K5(this);case 23:return!!this.a&&0!=this.a.i}return O3(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n))},MWn.sh=function(n,t){var e;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void JZ(this,SD(t));case 2:return void Yfn(this,qy(TD(t)));case 3:return void nln(this,qy(TD(t)));case 4:return void Len(this,BB(t,19).a);case 5:return void Nen(this,BB(t,19).a);case 8:return void Ihn(this,BB(t,138));case 9:return void((e=HTn(this,BB(t,87),null))&&e.Fi());case 10:return void Aln(this,qy(TD(t)));case 11:return void Nln(this,qy(TD(t)));case 12:return void $ln(this,qy(TD(t)));case 13:return void _I(this,SD(t));case 15:return void Lln(this,qy(TD(t)));case 16:return void qln(this,qy(TD(t)));case 18:return void YZ(this,qy(TD(t)));case 20:return void Uln(this,qy(TD(t)));case 21:return void rrn(this,BB(t,18));case 23:return!this.a&&(this.a=new RL(BAt,this,23)),sqn(this.a),!this.a&&(this.a=new RL(BAt,this,23)),void pX(this.a,BB(t,14))}Lbn(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n),t)},MWn.zh=function(){return gWn(),y$t},MWn.Bh=function(n){var t;switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),4),void Nrn(this,null);case 2:return void Yfn(this,!0);case 3:return void nln(this,!0);case 4:return void Len(this,0);case 5:return void Nen(this,1);case 8:return void Ihn(this,null);case 9:return void((t=HTn(this,null,null))&&t.Fi());case 10:return void Aln(this,!0);case 11:return void Nln(this,!1);case 12:return void $ln(this,!1);case 13:return this.i=null,void arn(this,null);case 15:return void Lln(this,!1);case 16:return void qln(this,!1);case 18:return zln(this,!1),void(cL(this.Cb,88)&&ACn(P5(BB(this.Cb,88)),2));case 20:return void Uln(this,!0);case 21:return void rrn(this,null);case 23:return!this.a&&(this.a=new RL(BAt,this,23)),void sqn(this.a)}qfn(this,n-bX((gWn(),y$t)),itn(BB(yan(this,16),26)||y$t,n))},MWn.Gh=function(){Ion(this),kV(B7((IPn(),Z$t),this)),Ikn(this),this.Bb|=1},MWn.Lj=function(){return Cvn(this)},MWn.qk=function(){var n;return!!(n=Cvn(this))&&0!=(n.Bb&h6n)},MWn.rk=function(){return 0!=(this.Bb&h6n)},MWn.sk=function(){return 0!=(this.Bb&BQn)},MWn.nk=function(n,t){return this.c=null,Pfn(this,n,t)},MWn.Ib=function(){var n;return 0!=(64&this.Db)?ERn(this):((n=new fN(ERn(this))).a+=" (containment: ",yE(n,0!=(this.Bb&h6n)),n.a+=", resolveProxies: ",yE(n,0!=(this.Bb&BQn)),n.a+=")",n.a)},vX(l6n,"EReferenceImpl",99),wAn(548,115,{105:1,42:1,92:1,90:1,133:1,56:1,108:1,49:1,97:1,548:1,114:1,115:1},Ao),MWn.Fb=function(n){return this===n},MWn.cd=function(){return this.b},MWn.dd=function(){return this.c},MWn.Hb=function(){return PN(this)},MWn.Uh=function(n){vq(this,SD(n))},MWn.ed=function(n){return $H(this,SD(n))},MWn._g=function(n,t,e){switch(n){case 0:return this.b;case 1:return this.c}return U9(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n),t,e)},MWn.lh=function(n){switch(n){case 0:return null!=this.b;case 1:return null!=this.c}return O3(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n))},MWn.sh=function(n,t){switch(n){case 0:return void mq(this,SD(t));case 1:return void Kin(this,SD(t))}Lbn(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n),t)},MWn.zh=function(){return gWn(),k$t},MWn.Bh=function(n){switch(n){case 0:return void Rin(this,null);case 1:return void Kin(this,null)}qfn(this,n-bX((gWn(),k$t)),itn(BB(yan(this,16),26)||k$t,n))},MWn.Sh=function(){var n;return-1==this.a&&(n=this.b,this.a=null==n?0:vvn(n)),this.a},MWn.Th=function(n){this.a=n},MWn.Ib=function(){var n;return 0!=(64&this.Db)?P$n(this):((n=new fN(P$n(this))).a+=" (key: ",cO(n,this.b),n.a+=", value: ",cO(n,this.c),n.a+=")",n.a)},MWn.a=-1,MWn.b=null,MWn.c=null;var R$t,K$t,_$t,F$t,B$t,H$t,q$t,G$t,z$t,U$t,X$t=vX(l6n,"EStringToStringMapEntryImpl",548),W$t=bq(y9n,"FeatureMap/Entry/Internal");wAn(565,1,z9n),MWn.Ok=function(n){return this.Pk(BB(n,49))},MWn.Pk=function(n){return this.Ok(n)},MWn.Fb=function(n){var t,e;return this===n||!!cL(n,72)&&(t=BB(n,72)).ak()==this.c&&(null==(e=this.dd())?null==t.dd():Nfn(e,t.dd()))},MWn.ak=function(){return this.c},MWn.Hb=function(){var n;return n=this.dd(),nsn(this.c)^(null==n?0:nsn(n))},MWn.Ib=function(){var n,t;return t=Utn((n=this.c).Hj()).Ph(),n.ne(),(null!=t&&0!=t.length?t+":"+n.ne():n.ne())+"="+this.dd()},vX(l6n,"EStructuralFeatureImpl/BasicFeatureMapEntry",565),wAn(776,565,z9n,rR),MWn.Pk=function(n){return new rR(this.c,n)},MWn.dd=function(){return this.a},MWn.Qk=function(n,t,e){return Scn(this,n,this.a,t,e)},MWn.Rk=function(n,t,e){return Pcn(this,n,this.a,t,e)},vX(l6n,"EStructuralFeatureImpl/ContainmentUpdatingFeatureMapEntry",776),wAn(1314,1,{},AI),MWn.Pj=function(n,t,e,i,r){return BB(S9(n,this.b),215).nl(this.a).Wj(i)},MWn.Qj=function(n,t,e,i,r){return BB(S9(n,this.b),215).el(this.a,i,r)},MWn.Rj=function(n,t,e,i,r){return BB(S9(n,this.b),215).fl(this.a,i,r)},MWn.Sj=function(n,t,e){return BB(S9(n,this.b),215).nl(this.a).fj()},MWn.Tj=function(n,t,e,i){BB(S9(n,this.b),215).nl(this.a).Wb(i)},MWn.Uj=function(n,t,e){return BB(S9(n,this.b),215).nl(this.a)},MWn.Vj=function(n,t,e){BB(S9(n,this.b),215).nl(this.a).Xj()},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateFeatureMapDelegator",1314),wAn(89,1,{},PB,lQ,RY,w4),MWn.Pj=function(n,t,e,i,r){var c;if(null==(c=t.Ch(e))&&t.Dh(e,c=iWn(this,n)),!r)switch(this.e){case 50:case 41:return BB(c,589).sj();case 40:return BB(c,215).kl()}return c},MWn.Qj=function(n,t,e,i,r){var c;return null==(c=t.Ch(e))&&t.Dh(e,c=iWn(this,n)),BB(c,69).lk(i,r)},MWn.Rj=function(n,t,e,i,r){var c;return null!=(c=t.Ch(e))&&(r=BB(c,69).mk(i,r)),r},MWn.Sj=function(n,t,e){var i;return null!=(i=t.Ch(e))&&BB(i,76).fj()},MWn.Tj=function(n,t,e,i){var r;!(r=BB(t.Ch(e),76))&&t.Dh(e,r=iWn(this,n)),r.Wb(i)},MWn.Uj=function(n,t,e){var i;return null==(i=t.Ch(e))&&t.Dh(e,i=iWn(this,n)),cL(i,76)?BB(i,76):new Ep(BB(t.Ch(e),15))},MWn.Vj=function(n,t,e){var i;!(i=BB(t.Ch(e),76))&&t.Dh(e,i=iWn(this,n)),i.Xj()},MWn.b=0,MWn.e=0,vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateMany",89),wAn(504,1,{}),MWn.Qj=function(n,t,e,i,r){throw Hp(new pv)},MWn.Rj=function(n,t,e,i,r){throw Hp(new pv)},MWn.Uj=function(n,t,e){return new bQ(this,n,t,e)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingle",504),wAn(1331,1,k9n,bQ),MWn.Wj=function(n){return this.a.Pj(this.c,this.d,this.b,n,!0)},MWn.fj=function(){return this.a.Sj(this.c,this.d,this.b)},MWn.Wb=function(n){this.a.Tj(this.c,this.d,this.b,n)},MWn.Xj=function(){this.a.Vj(this.c,this.d,this.b)},MWn.b=0,vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingle/1",1331),wAn(769,504,{},mJ),MWn.Pj=function(n,t,e,i,r){return gKn(n,n.eh(),n.Vg())==this.b?this.sk()&&i?cAn(n):n.eh():null},MWn.Qj=function(n,t,e,i,r){var c,a;return n.eh()&&(r=(c=n.Vg())>=0?n.Qg(r):n.eh().ih(n,-1-c,null,r)),a=Awn(n.Tg(),this.e),n.Sg(i,a,r)},MWn.Rj=function(n,t,e,i,r){var c;return c=Awn(n.Tg(),this.e),n.Sg(null,c,r)},MWn.Sj=function(n,t,e){var i;return i=Awn(n.Tg(),this.e),!!n.eh()&&n.Vg()==i},MWn.Tj=function(n,t,e,i){var r,c,a,u,o;if(null!=i&&!SFn(this.a,i))throw Hp(new Ky(U9n+(cL(i,56)?dEn(BB(i,56).Tg()):utn(tsn(i)))+X9n+this.a+"'"));if(r=n.eh(),a=Awn(n.Tg(),this.e),GI(i)!==GI(r)||n.Vg()!=a&&null!=i){if(vkn(n,BB(i,56)))throw Hp(new _y(w6n+n.Ib()));o=null,r&&(o=(c=n.Vg())>=0?n.Qg(o):n.eh().ih(n,-1-c,null,o)),(u=BB(i,49))&&(o=u.gh(n,Awn(u.Tg(),this.b),null,o)),(o=n.Sg(u,a,o))&&o.Fi()}else n.Lg()&&n.Mg()&&ban(n,new nU(n,1,a,i,i))},MWn.Vj=function(n,t,e){var i,r,c;n.eh()?(c=(i=n.Vg())>=0?n.Qg(null):n.eh().ih(n,-1-i,null,null),r=Awn(n.Tg(),this.e),(c=n.Sg(null,r,c))&&c.Fi()):n.Lg()&&n.Mg()&&ban(n,new tU(n,1,this.e,null,null))},MWn.sk=function(){return!1},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleContainer",769),wAn(1315,769,{},CB),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleContainerResolving",1315),wAn(563,504,{}),MWn.Pj=function(n,t,e,i,r){var c;return null==(c=t.Ch(e))?this.b:GI(c)===GI(R$t)?null:c},MWn.Sj=function(n,t,e){var i;return null!=(i=t.Ch(e))&&(GI(i)===GI(R$t)||!Nfn(i,this.b))},MWn.Tj=function(n,t,e,i){var r,c;n.Lg()&&n.Mg()?(r=null==(c=t.Ch(e))?this.b:GI(c)===GI(R$t)?null:c,null==i?null!=this.c?(t.Dh(e,null),i=this.b):null!=this.b?t.Dh(e,R$t):t.Dh(e,null):(this.Sk(i),t.Dh(e,i)),ban(n,this.d.Tk(n,1,this.e,r,i))):null==i?null!=this.c?t.Dh(e,null):null!=this.b?t.Dh(e,R$t):t.Dh(e,null):(this.Sk(i),t.Dh(e,i))},MWn.Vj=function(n,t,e){var i,r;n.Lg()&&n.Mg()?(i=null==(r=t.Ch(e))?this.b:GI(r)===GI(R$t)?null:r,t.Eh(e),ban(n,this.d.Tk(n,1,this.e,i,this.b))):t.Eh(e)},MWn.Sk=function(n){throw Hp(new bv)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData",563),wAn(W9n,1,{},$o),MWn.Tk=function(n,t,e,i,r){return new tU(n,t,e,i,r)},MWn.Uk=function(n,t,e,i,r,c){return new GQ(n,t,e,i,r,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator",W9n),wAn(1332,W9n,{},Lo),MWn.Tk=function(n,t,e,i,r){return new n6(n,t,e,qy(TD(i)),qy(TD(r)))},MWn.Uk=function(n,t,e,i,r,c){return new L0(n,t,e,qy(TD(i)),qy(TD(r)),c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/1",1332),wAn(1333,W9n,{},No),MWn.Tk=function(n,t,e,i,r){return new Hen(n,t,e,BB(i,217).a,BB(r,217).a)},MWn.Uk=function(n,t,e,i,r,c){return new S0(n,t,e,BB(i,217).a,BB(r,217).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/2",1333),wAn(1334,W9n,{},xo),MWn.Tk=function(n,t,e,i,r){return new qen(n,t,e,BB(i,172).a,BB(r,172).a)},MWn.Uk=function(n,t,e,i,r,c){return new P0(n,t,e,BB(i,172).a,BB(r,172).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/3",1334),wAn(1335,W9n,{},Do),MWn.Tk=function(n,t,e,i,r){return new J5(n,t,e,Gy(MD(i)),Gy(MD(r)))},MWn.Uk=function(n,t,e,i,r,c){return new C0(n,t,e,Gy(MD(i)),Gy(MD(r)),c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/4",1335),wAn(1336,W9n,{},Ro),MWn.Tk=function(n,t,e,i,r){return new Uen(n,t,e,BB(i,155).a,BB(r,155).a)},MWn.Uk=function(n,t,e,i,r,c){return new I0(n,t,e,BB(i,155).a,BB(r,155).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/5",1336),wAn(1337,W9n,{},Ko),MWn.Tk=function(n,t,e,i,r){return new Z5(n,t,e,BB(i,19).a,BB(r,19).a)},MWn.Uk=function(n,t,e,i,r,c){return new O0(n,t,e,BB(i,19).a,BB(r,19).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/6",1337),wAn(1338,W9n,{},_o),MWn.Tk=function(n,t,e,i,r){return new Gen(n,t,e,BB(i,162).a,BB(r,162).a)},MWn.Uk=function(n,t,e,i,r,c){return new A0(n,t,e,BB(i,162).a,BB(r,162).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/7",1338),wAn(1339,W9n,{},Fo),MWn.Tk=function(n,t,e,i,r){return new zen(n,t,e,BB(i,184).a,BB(r,184).a)},MWn.Uk=function(n,t,e,i,r,c){return new $0(n,t,e,BB(i,184).a,BB(r,184).a,c)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleData/NotificationCreator/8",1339),wAn(1317,563,{},wQ),MWn.Sk=function(n){if(!this.a.wj(n))throw Hp(new Ky(U9n+tsn(n)+X9n+this.a+"'"))},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataDynamic",1317),wAn(1318,563,{},ZG),MWn.Sk=function(n){},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataStatic",1318),wAn(770,563,{}),MWn.Sj=function(n,t,e){return null!=t.Ch(e)},MWn.Tj=function(n,t,e,i){var r,c;n.Lg()&&n.Mg()?(r=!0,null==(c=t.Ch(e))?(r=!1,c=this.b):GI(c)===GI(R$t)&&(c=null),null==i?null!=this.c?(t.Dh(e,null),i=this.b):t.Dh(e,R$t):(this.Sk(i),t.Dh(e,i)),ban(n,this.d.Uk(n,1,this.e,c,i,!r))):null==i?null!=this.c?t.Dh(e,null):t.Dh(e,R$t):(this.Sk(i),t.Dh(e,i))},MWn.Vj=function(n,t,e){var i,r;n.Lg()&&n.Mg()?(i=!0,null==(r=t.Ch(e))?(i=!1,r=this.b):GI(r)===GI(R$t)&&(r=null),t.Eh(e),ban(n,this.d.Uk(n,2,this.e,r,this.b,i))):t.Eh(e)},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettable",770),wAn(1319,770,{},dQ),MWn.Sk=function(n){if(!this.a.wj(n))throw Hp(new Ky(U9n+tsn(n)+X9n+this.a+"'"))},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableDynamic",1319),wAn(1320,770,{},nz),MWn.Sk=function(n){},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleDataUnsettableStatic",1320),wAn(398,504,{},cG),MWn.Pj=function(n,t,e,i,r){var c,a,u,o,s;if(s=t.Ch(e),this.Kj()&&GI(s)===GI(R$t))return null;if(this.sk()&&i&&null!=s){if((u=BB(s,49)).kh()&&u!=(o=tfn(n,u))){if(!SFn(this.a,o))throw Hp(new Ky(U9n+tsn(o)+X9n+this.a+"'"));t.Dh(e,s=o),this.rk()&&(c=BB(o,49),a=u.ih(n,this.b?Awn(u.Tg(),this.b):-1-Awn(n.Tg(),this.e),null,null),!c.eh()&&(a=c.gh(n,this.b?Awn(c.Tg(),this.b):-1-Awn(n.Tg(),this.e),null,a)),a&&a.Fi()),n.Lg()&&n.Mg()&&ban(n,new tU(n,9,this.e,u,o))}return s}return s},MWn.Qj=function(n,t,e,i,r){var c,a;return GI(a=t.Ch(e))===GI(R$t)&&(a=null),t.Dh(e,i),this.bj()?GI(a)!==GI(i)&&null!=a&&(r=(c=BB(a,49)).ih(n,Awn(c.Tg(),this.b),null,r)):this.rk()&&null!=a&&(r=BB(a,49).ih(n,-1-Awn(n.Tg(),this.e),null,r)),n.Lg()&&n.Mg()&&(!r&&(r=new Fj(4)),r.Ei(new tU(n,1,this.e,a,i))),r},MWn.Rj=function(n,t,e,i,r){var c;return GI(c=t.Ch(e))===GI(R$t)&&(c=null),t.Eh(e),n.Lg()&&n.Mg()&&(!r&&(r=new Fj(4)),this.Kj()?r.Ei(new tU(n,2,this.e,c,null)):r.Ei(new tU(n,1,this.e,c,null))),r},MWn.Sj=function(n,t,e){return null!=t.Ch(e)},MWn.Tj=function(n,t,e,i){var r,c,a,u,o;if(null!=i&&!SFn(this.a,i))throw Hp(new Ky(U9n+(cL(i,56)?dEn(BB(i,56).Tg()):utn(tsn(i)))+X9n+this.a+"'"));u=null!=(o=t.Ch(e)),this.Kj()&&GI(o)===GI(R$t)&&(o=null),a=null,this.bj()?GI(o)!==GI(i)&&(null!=o&&(a=(r=BB(o,49)).ih(n,Awn(r.Tg(),this.b),null,a)),null!=i&&(a=(r=BB(i,49)).gh(n,Awn(r.Tg(),this.b),null,a))):this.rk()&&GI(o)!==GI(i)&&(null!=o&&(a=BB(o,49).ih(n,-1-Awn(n.Tg(),this.e),null,a)),null!=i&&(a=BB(i,49).gh(n,-1-Awn(n.Tg(),this.e),null,a))),null==i&&this.Kj()?t.Dh(e,R$t):t.Dh(e,i),n.Lg()&&n.Mg()?(c=new GQ(n,1,this.e,o,i,this.Kj()&&!u),a?(a.Ei(c),a.Fi()):ban(n,c)):a&&a.Fi()},MWn.Vj=function(n,t,e){var i,r,c,a,u;a=null!=(u=t.Ch(e)),this.Kj()&&GI(u)===GI(R$t)&&(u=null),c=null,null!=u&&(this.bj()?c=(i=BB(u,49)).ih(n,Awn(i.Tg(),this.b),null,c):this.rk()&&(c=BB(u,49).ih(n,-1-Awn(n.Tg(),this.e),null,c))),t.Eh(e),n.Lg()&&n.Mg()?(r=new GQ(n,this.Kj()?2:1,this.e,u,null,a),c?(c.Ei(r),c.Fi()):ban(n,r)):c&&c.Fi()},MWn.bj=function(){return!1},MWn.rk=function(){return!1},MWn.sk=function(){return!1},MWn.Kj=function(){return!1},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObject",398),wAn(564,398,{},Zx),MWn.rk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainment",564),wAn(1323,564,{},nD),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentResolving",1323),wAn(772,564,{},tD),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettable",772),wAn(1325,772,{},eD),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentUnsettableResolving",1325),wAn(640,564,{},IB),MWn.bj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverse",640),wAn(1324,640,{},$B),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseResolving",1324),wAn(773,640,{},LB),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettable",773),wAn(1326,773,{},NB),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectContainmentWithInverseUnsettableResolving",1326),wAn(641,398,{},iD),MWn.sk=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolving",641),wAn(1327,641,{},rD),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingUnsettable",1327),wAn(774,641,{},OB),MWn.bj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverse",774),wAn(1328,774,{},xB),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectResolvingWithInverseUnsettable",1328),wAn(1321,398,{},cD),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectUnsettable",1321),wAn(771,398,{},AB),MWn.bj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverse",771),wAn(1322,771,{},DB),MWn.Kj=function(){return!0},vX(l6n,"EStructuralFeatureImpl/InternalSettingDelegateSingleEObjectWithInverseUnsettable",1322),wAn(775,565,z9n,aW),MWn.Pk=function(n){return new aW(this.a,this.c,n)},MWn.dd=function(){return this.b},MWn.Qk=function(n,t,e){return D8(this,n,this.b,e)},MWn.Rk=function(n,t,e){return R8(this,n,this.b,e)},vX(l6n,"EStructuralFeatureImpl/InverseUpdatingFeatureMapEntry",775),wAn(1329,1,k9n,Ep),MWn.Wj=function(n){return this.a},MWn.fj=function(){return cL(this.a,95)?BB(this.a,95).fj():!this.a.dc()},MWn.Wb=function(n){this.a.$b(),this.a.Gc(BB(n,15))},MWn.Xj=function(){cL(this.a,95)?BB(this.a,95).Xj():this.a.$b()},vX(l6n,"EStructuralFeatureImpl/SettingMany",1329),wAn(1330,565,z9n,g4),MWn.Ok=function(n){return new cR((Uqn(),FLt),this.b.Ih(this.a,n))},MWn.dd=function(){return null},MWn.Qk=function(n,t,e){return e},MWn.Rk=function(n,t,e){return e},vX(l6n,"EStructuralFeatureImpl/SimpleContentFeatureMapEntry",1330),wAn(642,565,z9n,cR),MWn.Ok=function(n){return new cR(this.c,n)},MWn.dd=function(){return this.a},MWn.Qk=function(n,t,e){return e},MWn.Rk=function(n,t,e){return e},vX(l6n,"EStructuralFeatureImpl/SimpleFeatureMapEntry",642),wAn(391,497,h8n,Bo),MWn.ri=function(n){return x8(qAt,HWn,26,n,0,1)},MWn.ni=function(){return!1},vX(l6n,"ESuperAdapter/1",391),wAn(444,438,{105:1,92:1,90:1,147:1,191:1,56:1,108:1,836:1,49:1,97:1,150:1,444:1,114:1,115:1},Ho),MWn._g=function(n,t,e){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),this.Ab;case 1:return this.zb;case 2:return!this.a&&(this.a=new aG(this,VAt,this)),this.a}return U9(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),_pn(this.Ab,n,e);case 2:return!this.a&&(this.a=new aG(this,VAt,this)),_pn(this.a,n,e)}return BB(itn(BB(yan(this,16),26)||(gWn(),T$t),t),66).Nj().Rj(this,fgn(this),t-bX((gWn(),T$t)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.Ab&&0!=this.Ab.i;case 1:return null!=this.zb;case 2:return!!this.a&&0!=this.a.i}return O3(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n))},MWn.sh=function(n,t){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),sqn(this.Ab),!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void pX(this.Ab,BB(t,14));case 1:return void Nrn(this,SD(t));case 2:return!this.a&&(this.a=new aG(this,VAt,this)),sqn(this.a),!this.a&&(this.a=new aG(this,VAt,this)),void pX(this.a,BB(t,14))}Lbn(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n),t)},MWn.zh=function(){return gWn(),T$t},MWn.Bh=function(n){switch(n){case 0:return!this.Ab&&(this.Ab=new eU(KAt,this,0,3)),void sqn(this.Ab);case 1:return void Nrn(this,null);case 2:return!this.a&&(this.a=new aG(this,VAt,this)),void sqn(this.a)}qfn(this,n-bX((gWn(),T$t)),itn(BB(yan(this,16),26)||T$t,n))},vX(l6n,"ETypeParameterImpl",444),wAn(445,85,R9n,aG),MWn.cj=function(n,t){return LTn(this,BB(n,87),t)},MWn.dj=function(n,t){return NTn(this,BB(n,87),t)},vX(l6n,"ETypeParameterImpl/1",445),wAn(634,43,tYn,xm),MWn.ec=function(){return new Tp(this)},vX(l6n,"ETypeParameterImpl/2",634),wAn(556,nVn,tVn,Tp),MWn.Fc=function(n){return YR(this,BB(n,87))},MWn.Gc=function(n){var t,e,i;for(i=!1,e=n.Kc();e.Ob();)t=BB(e.Pb(),87),null==VW(this.a,t,"")&&(i=!0);return i},MWn.$b=function(){$U(this.a)},MWn.Hc=function(n){return hU(this.a,n)},MWn.Kc=function(){return new Mp(new usn(new Pb(this.a).a))},MWn.Mc=function(n){return _6(this,n)},MWn.gc=function(){return NT(this.a)},vX(l6n,"ETypeParameterImpl/2/1",556),wAn(557,1,QWn,Mp),MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return BB(ten(this.a).cd(),87)},MWn.Ob=function(){return this.a.b},MWn.Qb=function(){o9(this.a)},vX(l6n,"ETypeParameterImpl/2/1/1",557),wAn(1276,43,tYn,Dm),MWn._b=function(n){return XI(n)?eY(this,n):!!AY(this.f,n)},MWn.xc=function(n){var t;return cL(t=XI(n)?SJ(this,n):qI(AY(this.f,n)),837)?(t=BB(t,837)._j(),VW(this,BB(n,235),t),t):null!=t?t:null==n?(JM(),rLt):null},vX(l6n,"EValidatorRegistryImpl",1276),wAn(1313,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,1941:1,49:1,97:1,150:1,114:1,115:1},qo),MWn.Ih=function(n,t){switch(n.yj()){case 21:case 22:case 23:case 24:case 26:case 31:case 32:case 37:case 38:case 39:case 40:case 43:case 44:case 48:case 49:case 20:return null==t?null:Bbn(t);case 25:return Xtn(t);case 27:return X9(t);case 28:return W9(t);case 29:return null==t?null:H$(IOt[0],BB(t,199));case 41:return null==t?"":nE(BB(t,290));case 42:return Bbn(t);case 50:return SD(t);default:throw Hp(new _y(d6n+n.ne()+g6n))}},MWn.Jh=function(n){var t;switch(-1==n.G&&(n.G=(t=Utn(n))?uvn(t.Mh(),n):-1),n.G){case 0:return new Om;case 1:return new jo;case 2:return new _f;case 4:return new Ev;case 5:return new Am;case 6:return new jv;case 7:return new Rf;case 10:return new yo;case 11:return new $m;case 12:return new vY;case 13:return new Lm;case 14:return new pD;case 17:return new Ao;case 18:return new Kp;case 19:return new Ho;default:throw Hp(new _y(m6n+n.zb+g6n))}},MWn.Kh=function(n,t){switch(n.yj()){case 20:return null==t?null:new wE(t);case 21:return null==t?null:new $A(t);case 23:case 22:return null==t?null:Zdn(t);case 26:case 24:return null==t?null:Pnn(l_n(t,-128,127)<<24>>24);case 25:return d$n(t);case 27:return Syn(t);case 28:return Pyn(t);case 29:return gMn(t);case 32:case 31:return null==t?null:bSn(t);case 38:case 37:return null==t?null:new Dv(t);case 40:case 39:return null==t?null:iln(l_n(t,_Vn,DWn));case 41:case 42:return null;case 44:case 43:return null==t?null:jgn(rUn(t));case 49:case 48:return null==t?null:rln(l_n(t,Q9n,32767)<<16>>16);case 50:return t;default:throw Hp(new _y(d6n+n.ne()+g6n))}},vX(l6n,"EcoreFactoryImpl",1313),wAn(547,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,1939:1,49:1,97:1,150:1,179:1,547:1,114:1,115:1,675:1},UW),MWn.gb=!1,MWn.hb=!1;var V$t,Q$t=!1;vX(l6n,"EcorePackageImpl",547),wAn(1184,1,{837:1},Go),MWn._j=function(){return sN(),cLt},vX(l6n,"EcorePackageImpl/1",1184),wAn(1193,1,s7n,zo),MWn.wj=function(n){return cL(n,147)},MWn.xj=function(n){return x8(BOt,HWn,147,n,0,1)},vX(l6n,"EcorePackageImpl/10",1193),wAn(1194,1,s7n,Uo),MWn.wj=function(n){return cL(n,191)},MWn.xj=function(n){return x8(qOt,HWn,191,n,0,1)},vX(l6n,"EcorePackageImpl/11",1194),wAn(1195,1,s7n,Xo),MWn.wj=function(n){return cL(n,56)},MWn.xj=function(n){return x8(LOt,HWn,56,n,0,1)},vX(l6n,"EcorePackageImpl/12",1195),wAn(1196,1,s7n,Wo),MWn.wj=function(n){return cL(n,399)},MWn.xj=function(n){return x8(QAt,x9n,59,n,0,1)},vX(l6n,"EcorePackageImpl/13",1196),wAn(1197,1,s7n,Vo),MWn.wj=function(n){return cL(n,235)},MWn.xj=function(n){return x8(GOt,HWn,235,n,0,1)},vX(l6n,"EcorePackageImpl/14",1197),wAn(1198,1,s7n,Qo),MWn.wj=function(n){return cL(n,509)},MWn.xj=function(n){return x8(YAt,HWn,2017,n,0,1)},vX(l6n,"EcorePackageImpl/15",1198),wAn(1199,1,s7n,Yo),MWn.wj=function(n){return cL(n,99)},MWn.xj=function(n){return x8(JAt,N9n,18,n,0,1)},vX(l6n,"EcorePackageImpl/16",1199),wAn(1200,1,s7n,Jo),MWn.wj=function(n){return cL(n,170)},MWn.xj=function(n){return x8(FAt,N9n,170,n,0,1)},vX(l6n,"EcorePackageImpl/17",1200),wAn(1201,1,s7n,Zo),MWn.wj=function(n){return cL(n,472)},MWn.xj=function(n){return x8(_At,HWn,472,n,0,1)},vX(l6n,"EcorePackageImpl/18",1201),wAn(1202,1,s7n,ns),MWn.wj=function(n){return cL(n,548)},MWn.xj=function(n){return x8(X$t,a9n,548,n,0,1)},vX(l6n,"EcorePackageImpl/19",1202),wAn(1185,1,s7n,ts),MWn.wj=function(n){return cL(n,322)},MWn.xj=function(n){return x8(BAt,N9n,34,n,0,1)},vX(l6n,"EcorePackageImpl/2",1185),wAn(1203,1,s7n,es),MWn.wj=function(n){return cL(n,241)},MWn.xj=function(n){return x8(VAt,B9n,87,n,0,1)},vX(l6n,"EcorePackageImpl/20",1203),wAn(1204,1,s7n,is),MWn.wj=function(n){return cL(n,444)},MWn.xj=function(n){return x8(O$t,HWn,836,n,0,1)},vX(l6n,"EcorePackageImpl/21",1204),wAn(1205,1,s7n,rs),MWn.wj=function(n){return zI(n)},MWn.xj=function(n){return x8(ktt,sVn,476,n,8,1)},vX(l6n,"EcorePackageImpl/22",1205),wAn(1206,1,s7n,cs),MWn.wj=function(n){return cL(n,190)},MWn.xj=function(n){return x8(NNt,sVn,190,n,0,2)},vX(l6n,"EcorePackageImpl/23",1206),wAn(1207,1,s7n,as),MWn.wj=function(n){return cL(n,217)},MWn.xj=function(n){return x8(Ttt,sVn,217,n,0,1)},vX(l6n,"EcorePackageImpl/24",1207),wAn(1208,1,s7n,us),MWn.wj=function(n){return cL(n,172)},MWn.xj=function(n){return x8(Stt,sVn,172,n,0,1)},vX(l6n,"EcorePackageImpl/25",1208),wAn(1209,1,s7n,os),MWn.wj=function(n){return cL(n,199)},MWn.xj=function(n){return x8(mtt,sVn,199,n,0,1)},vX(l6n,"EcorePackageImpl/26",1209),wAn(1210,1,s7n,ss),MWn.wj=function(n){return!1},MWn.xj=function(n){return x8(_Nt,HWn,2110,n,0,1)},vX(l6n,"EcorePackageImpl/27",1210),wAn(1211,1,s7n,hs),MWn.wj=function(n){return UI(n)},MWn.xj=function(n){return x8(Ptt,sVn,333,n,7,1)},vX(l6n,"EcorePackageImpl/28",1211),wAn(1212,1,s7n,fs),MWn.wj=function(n){return cL(n,58)},MWn.xj=function(n){return x8(uAt,nZn,58,n,0,1)},vX(l6n,"EcorePackageImpl/29",1212),wAn(1186,1,s7n,ls),MWn.wj=function(n){return cL(n,510)},MWn.xj=function(n){return x8(KAt,{3:1,4:1,5:1,1934:1},590,n,0,1)},vX(l6n,"EcorePackageImpl/3",1186),wAn(1213,1,s7n,bs),MWn.wj=function(n){return cL(n,573)},MWn.xj=function(n){return x8(yAt,HWn,1940,n,0,1)},vX(l6n,"EcorePackageImpl/30",1213),wAn(1214,1,s7n,ws),MWn.wj=function(n){return cL(n,153)},MWn.xj=function(n){return x8(oLt,nZn,153,n,0,1)},vX(l6n,"EcorePackageImpl/31",1214),wAn(1215,1,s7n,ds),MWn.wj=function(n){return cL(n,72)},MWn.xj=function(n){return x8($$t,h7n,72,n,0,1)},vX(l6n,"EcorePackageImpl/32",1215),wAn(1216,1,s7n,gs),MWn.wj=function(n){return cL(n,155)},MWn.xj=function(n){return x8(Ctt,sVn,155,n,0,1)},vX(l6n,"EcorePackageImpl/33",1216),wAn(1217,1,s7n,ps),MWn.wj=function(n){return cL(n,19)},MWn.xj=function(n){return x8(Att,sVn,19,n,0,1)},vX(l6n,"EcorePackageImpl/34",1217),wAn(1218,1,s7n,vs),MWn.wj=function(n){return cL(n,290)},MWn.xj=function(n){return x8($nt,HWn,290,n,0,1)},vX(l6n,"EcorePackageImpl/35",1218),wAn(1219,1,s7n,ms),MWn.wj=function(n){return cL(n,162)},MWn.xj=function(n){return x8(Rtt,sVn,162,n,0,1)},vX(l6n,"EcorePackageImpl/36",1219),wAn(1220,1,s7n,ys),MWn.wj=function(n){return cL(n,83)},MWn.xj=function(n){return x8(Nnt,HWn,83,n,0,1)},vX(l6n,"EcorePackageImpl/37",1220),wAn(1221,1,s7n,ks),MWn.wj=function(n){return cL(n,591)},MWn.xj=function(n){return x8(iLt,HWn,591,n,0,1)},vX(l6n,"EcorePackageImpl/38",1221),wAn(1222,1,s7n,js),MWn.wj=function(n){return!1},MWn.xj=function(n){return x8(FNt,HWn,2111,n,0,1)},vX(l6n,"EcorePackageImpl/39",1222),wAn(1187,1,s7n,Es),MWn.wj=function(n){return cL(n,88)},MWn.xj=function(n){return x8(qAt,HWn,26,n,0,1)},vX(l6n,"EcorePackageImpl/4",1187),wAn(1223,1,s7n,Ts),MWn.wj=function(n){return cL(n,184)},MWn.xj=function(n){return x8(_tt,sVn,184,n,0,1)},vX(l6n,"EcorePackageImpl/40",1223),wAn(1224,1,s7n,Ms),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(l6n,"EcorePackageImpl/41",1224),wAn(1225,1,s7n,Ss),MWn.wj=function(n){return cL(n,588)},MWn.xj=function(n){return x8(sAt,HWn,588,n,0,1)},vX(l6n,"EcorePackageImpl/42",1225),wAn(1226,1,s7n,Ps),MWn.wj=function(n){return!1},MWn.xj=function(n){return x8(BNt,sVn,2112,n,0,1)},vX(l6n,"EcorePackageImpl/43",1226),wAn(1227,1,s7n,Cs),MWn.wj=function(n){return cL(n,42)},MWn.xj=function(n){return x8(Hnt,kVn,42,n,0,1)},vX(l6n,"EcorePackageImpl/44",1227),wAn(1188,1,s7n,Is),MWn.wj=function(n){return cL(n,138)},MWn.xj=function(n){return x8(HAt,HWn,138,n,0,1)},vX(l6n,"EcorePackageImpl/5",1188),wAn(1189,1,s7n,Os),MWn.wj=function(n){return cL(n,148)},MWn.xj=function(n){return x8(GAt,HWn,148,n,0,1)},vX(l6n,"EcorePackageImpl/6",1189),wAn(1190,1,s7n,As),MWn.wj=function(n){return cL(n,457)},MWn.xj=function(n){return x8(XAt,HWn,671,n,0,1)},vX(l6n,"EcorePackageImpl/7",1190),wAn(1191,1,s7n,$s),MWn.wj=function(n){return cL(n,573)},MWn.xj=function(n){return x8(WAt,HWn,678,n,0,1)},vX(l6n,"EcorePackageImpl/8",1191),wAn(1192,1,s7n,Ls),MWn.wj=function(n){return cL(n,471)},MWn.xj=function(n){return x8(HOt,HWn,471,n,0,1)},vX(l6n,"EcorePackageImpl/9",1192),wAn(1025,1982,r9n,xy),MWn.bi=function(n,t){Afn(this,BB(t,415))},MWn.fi=function(n,t){eCn(this,n,BB(t,415))},vX(l6n,"MinimalEObjectImpl/1ArrayDelegatingAdapterList",1025),wAn(1026,143,t9n,uW),MWn.Ai=function(){return this.a.a},vX(l6n,"MinimalEObjectImpl/1ArrayDelegatingAdapterList/1",1026),wAn(1053,1052,{},o$),vX("org.eclipse.emf.ecore.plugin","EcorePlugin",1053);var Y$t,J$t,Z$t,nLt,tLt,eLt,iLt=bq(f7n,"Resource");wAn(781,1378,l7n),MWn.Yk=function(n){},MWn.Zk=function(n){},MWn.Vk=function(){return!this.a&&(this.a=new Sp(this)),this.a},MWn.Wk=function(n){var t,e,i,r,c;if((i=n.length)>0){if(b1(0,n.length),47==n.charCodeAt(0)){for(c=new J6(4),r=1,t=1;t<i;++t)b1(t,n.length),47==n.charCodeAt(t)&&(WB(c,r==t?"":n.substr(r,t-r)),r=t+1);return WB(c,n.substr(r)),ojn(this,c)}b1(i-1,n.length),63==n.charCodeAt(i-1)&&(e=MK(n,YTn(63),i-2))>0&&(n=n.substr(0,e))}return jIn(this,n)},MWn.Xk=function(){return this.c},MWn.Ib=function(){return nE(this.gm)+"@"+(nsn(this)>>>0).toString(16)+" uri='"+this.d+"'"},MWn.b=!1,vX(b7n,"ResourceImpl",781),wAn(1379,781,l7n,Cp),vX(b7n,"BinaryResourceImpl",1379),wAn(1169,694,f8n),MWn.si=function(n){return cL(n,56)?TY(this,BB(n,56)):cL(n,591)?new AL(BB(n,591).Vk()):GI(n)===GI(this.f)?BB(n,14).Kc():(dD(),pAt.a)},MWn.Ob=function(){return bOn(this)},MWn.a=!1,vX(y9n,"EcoreUtil/ContentTreeIterator",1169),wAn(1380,1169,f8n,rU),MWn.si=function(n){return GI(n)===GI(this.f)?BB(n,15).Kc():new F2(BB(n,56))},vX(b7n,"ResourceImpl/5",1380),wAn(648,1994,D9n,Sp),MWn.Hc=function(n){return this.i<=4?Sjn(this,n):cL(n,49)&&BB(n,49).Zg()==this.a},MWn.bi=function(n,t){n==this.i-1&&(this.a.b||(this.a.b=!0))},MWn.di=function(n,t){0==n?this.a.b||(this.a.b=!0):L8(this,n,t)},MWn.fi=function(n,t){},MWn.gi=function(n,t,e){},MWn.aj=function(){return 2},MWn.Ai=function(){return this.a},MWn.bj=function(){return!0},MWn.cj=function(n,t){return t=BB(n,49).wh(this.a,t)},MWn.dj=function(n,t){return BB(n,49).wh(null,t)},MWn.ej=function(){return!1},MWn.hi=function(){return!0},MWn.ri=function(n){return x8(LOt,HWn,56,n,0,1)},MWn.ni=function(){return!1},vX(b7n,"ResourceImpl/ContentsEList",648),wAn(957,1964,LVn,Pp),MWn.Zc=function(n){return this.a._h(n)},MWn.gc=function(){return this.a.gc()},vX(y9n,"AbstractSequentialInternalEList/1",957),wAn(624,1,{},SH),vX(y9n,"BasicExtendedMetaData",624),wAn(1160,1,{},$I),MWn.$k=function(){return null},MWn._k=function(){return-2==this.a&&ob(this,aMn(this.d,this.b)),this.a},MWn.al=function(){return null},MWn.bl=function(){return SQ(),SQ(),set},MWn.ne=function(){return this.c==C7n&&hb(this,Egn(this.d,this.b)),this.c},MWn.cl=function(){return 0},MWn.a=-2,MWn.c=C7n,vX(y9n,"BasicExtendedMetaData/EClassExtendedMetaDataImpl",1160),wAn(1161,1,{},_0),MWn.$k=function(){return this.a==(R5(),tLt)&&sb(this,vNn(this.f,this.b)),this.a},MWn._k=function(){return 0},MWn.al=function(){return this.c==(R5(),tLt)&&fb(this,mNn(this.f,this.b)),this.c},MWn.bl=function(){return!this.d&&lb(this,SKn(this.f,this.b)),this.d},MWn.ne=function(){return this.e==C7n&&bb(this,Egn(this.f,this.b)),this.e},MWn.cl=function(){return-2==this.g&&wb(this,YEn(this.f,this.b)),this.g},MWn.e=C7n,MWn.g=-2,vX(y9n,"BasicExtendedMetaData/EDataTypeExtendedMetaDataImpl",1161),wAn(1159,1,{},RI),MWn.b=!1,MWn.c=!1,vX(y9n,"BasicExtendedMetaData/EPackageExtendedMetaDataImpl",1159),wAn(1162,1,{},K0),MWn.c=-2,MWn.e=C7n,MWn.f=C7n,vX(y9n,"BasicExtendedMetaData/EStructuralFeatureExtendedMetaDataImpl",1162),wAn(585,622,R9n,MH),MWn.aj=function(){return this.c},MWn.Fk=function(){return!1},MWn.li=function(n,t){return t},MWn.c=0,vX(y9n,"EDataTypeEList",585);var rLt,cLt,aLt,uLt,oLt=bq(y9n,"FeatureMap");wAn(75,585,{3:1,4:1,20:1,28:1,52:1,14:1,15:1,54:1,67:1,63:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},Ecn),MWn.Vc=function(n,t){lNn(this,n,BB(t,72))},MWn.Fc=function(n){return uLn(this,BB(n,72))},MWn.Yh=function(n){dX(this,BB(n,72))},MWn.cj=function(n,t){return HK(this,BB(n,72),t)},MWn.dj=function(n,t){return qK(this,BB(n,72),t)},MWn.ii=function(n,t){return a_n(this,n,t)},MWn.li=function(n,t){return hGn(this,n,BB(t,72))},MWn._c=function(n,t){return Pxn(this,n,BB(t,72))},MWn.jj=function(n,t){return GK(this,BB(n,72),t)},MWn.kj=function(n,t){return zK(this,BB(n,72),t)},MWn.lj=function(n,t,e){return gEn(this,BB(n,72),BB(t,72),e)},MWn.oi=function(n,t){return sTn(this,n,BB(t,72))},MWn.dl=function(n,t){return xKn(this,n,t)},MWn.Wc=function(n,t){var e,i,r,c,a,u,o,s,h;for(s=new gtn(t.gc()),r=t.Kc();r.Ob();)if(c=(i=BB(r.Pb(),72)).ak(),$xn(this.e,c))(!c.hi()||!G3(this,c,i.dd())&&!Sjn(s,i))&&f9(s,i);else{for(h=axn(this.e.Tg(),c),e=BB(this.g,119),a=!0,u=0;u<this.i;++u)if(o=e[u],h.rl(o.ak())){BB(ovn(this,u,i),72),a=!1;break}a&&f9(s,i)}return oon(this,n,s)},MWn.Gc=function(n){var t,e,i,r,c,a,u,o,s;for(o=new gtn(n.gc()),i=n.Kc();i.Ob();)if(r=(e=BB(i.Pb(),72)).ak(),$xn(this.e,r))(!r.hi()||!G3(this,r,e.dd())&&!Sjn(o,e))&&f9(o,e);else{for(s=axn(this.e.Tg(),r),t=BB(this.g,119),c=!0,a=0;a<this.i;++a)if(u=t[a],s.rl(u.ak())){BB(ovn(this,a,e),72),c=!1;break}c&&f9(o,e)}return pX(this,o)},MWn.Wh=function(n){return this.j=-1,LFn(this,this.i,n)},MWn.el=function(n,t,e){return PRn(this,n,t,e)},MWn.mk=function(n,t){return TKn(this,n,t)},MWn.fl=function(n,t,e){return ZBn(this,n,t,e)},MWn.gl=function(){return this},MWn.hl=function(n,t){return rHn(this,n,t)},MWn.il=function(n){return BB(Wtn(this,n),72).ak()},MWn.jl=function(n){return BB(Wtn(this,n),72).dd()},MWn.kl=function(){return this.b},MWn.bj=function(){return!0},MWn.ij=function(){return!0},MWn.ll=function(n){return!adn(this,n)},MWn.ri=function(n){return x8(W$t,h7n,332,n,0,1)},MWn.Gk=function(n){return hD(this,n)},MWn.Wb=function(n){tX(this,n)},MWn.ml=function(n,t){MHn(this,n,t)},MWn.nl=function(n){return zin(this,n)},MWn.ol=function(n){Kmn(this,n)},vX(y9n,"BasicFeatureMap",75),wAn(1851,1,cVn),MWn.Nb=function(n){fU(this,n)},MWn.Rb=function(n){if(-1==this.g)throw Hp(new dv);mz(this);try{Axn(this.e,this.b,this.a,n),this.d=this.e.j,cvn(this)}catch(t){throw cL(t=lun(t),73)?Hp(new vv):Hp(t)}},MWn.Ob=function(){return Ksn(this)},MWn.Sb=function(){return _sn(this)},MWn.Pb=function(){return cvn(this)},MWn.Tb=function(){return this.a},MWn.Ub=function(){var n;if(_sn(this))return mz(this),this.g=--this.a,this.Lk()&&(n=FIn(this.e,this.b,this.c,this.a,this.j),this.j=n),this.i=0,this.j;throw Hp(new yv)},MWn.Vb=function(){return this.a-1},MWn.Qb=function(){if(-1==this.g)throw Hp(new dv);mz(this);try{aPn(this.e,this.b,this.g),this.d=this.e.j,this.g<this.a&&(--this.a,--this.c),--this.g}catch(n){throw cL(n=lun(n),73)?Hp(new vv):Hp(n)}},MWn.Lk=function(){return!1},MWn.Wb=function(n){if(-1==this.g)throw Hp(new dv);mz(this);try{XFn(this.e,this.b,this.g,n),this.d=this.e.j}catch(t){throw cL(t=lun(t),73)?Hp(new vv):Hp(t)}},MWn.a=0,MWn.c=0,MWn.d=0,MWn.f=!1,MWn.g=0,MWn.i=0,vX(y9n,"FeatureMapUtil/BasicFeatureEIterator",1851),wAn(410,1851,cVn,Aan),MWn.pl=function(){var n,t,e;for(e=this.e.i,n=BB(this.e.g,119);this.c<e;){if(t=n[this.c],this.k.rl(t.ak()))return this.j=this.f?t:t.dd(),this.i=2,!0;++this.c}return this.i=1,this.g=-1,!1},MWn.ql=function(){var n,t;for(n=BB(this.e.g,119);--this.c>=0;)if(t=n[this.c],this.k.rl(t.ak()))return this.j=this.f?t:t.dd(),this.i=-2,!0;return this.i=-1,this.g=-1,!1},vX(y9n,"BasicFeatureMap/FeatureEIterator",410),wAn(662,410,cVn,xO),MWn.Lk=function(){return!0},vX(y9n,"BasicFeatureMap/ResolvingFeatureEIterator",662),wAn(955,486,q9n,z$),MWn.Gi=function(){return this},vX(y9n,"EContentsEList/1",955),wAn(956,486,q9n,DO),MWn.Lk=function(){return!1},vX(y9n,"EContentsEList/2",956),wAn(954,279,G9n,U$),MWn.Nk=function(n){},MWn.Ob=function(){return!1},MWn.Sb=function(){return!1},vX(y9n,"EContentsEList/FeatureIteratorImpl/1",954),wAn(825,585,R9n,KL),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EDataTypeEList/Unsettable",825),wAn(1849,585,R9n,_L),MWn.hi=function(){return!0},vX(y9n,"EDataTypeUniqueEList",1849),wAn(1850,825,R9n,FL),MWn.hi=function(){return!0},vX(y9n,"EDataTypeUniqueEList/Unsettable",1850),wAn(139,85,R9n,NL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentEList/Resolving",139),wAn(1163,545,R9n,xL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentEList/Unsettable/Resolving",1163),wAn(748,16,R9n,iK),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EObjectContainmentWithInverseEList/Unsettable",748),wAn(1173,748,R9n,rK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectContainmentWithInverseEList/Unsettable/Resolving",1173),wAn(743,496,R9n,DL),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EObjectEList/Unsettable",743),wAn(328,496,R9n,RL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectResolvingEList",328),wAn(1641,743,R9n,BL),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectResolvingEList/Unsettable",1641),wAn(1381,1,{},Ns),vX(y9n,"EObjectValidator",1381),wAn(546,496,R9n,iU),MWn.zk=function(){return this.d},MWn.Ak=function(){return this.b},MWn.bj=function(){return!0},MWn.Dk=function(){return!0},MWn.b=0,vX(y9n,"EObjectWithInverseEList",546),wAn(1176,546,R9n,cK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseEList/ManyInverse",1176),wAn(625,546,R9n,aK),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EObjectWithInverseEList/Unsettable",625),wAn(1175,625,R9n,oK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseEList/Unsettable/ManyInverse",1175),wAn(749,546,R9n,uK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectWithInverseResolvingEList",749),wAn(31,749,R9n,hK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseResolvingEList/ManyInverse",31),wAn(750,625,R9n,sK),MWn.Ek=function(){return!0},MWn.li=function(n,t){return GOn(this,n,BB(t,56))},vX(y9n,"EObjectWithInverseResolvingEList/Unsettable",750),wAn(1174,750,R9n,fK),MWn.Ck=function(){return!0},vX(y9n,"EObjectWithInverseResolvingEList/Unsettable/ManyInverse",1174),wAn(1164,622,R9n),MWn.ai=function(){return 0==(1792&this.b)},MWn.ci=function(){this.b|=1},MWn.Bk=function(){return 0!=(4&this.b)},MWn.bj=function(){return 0!=(40&this.b)},MWn.Ck=function(){return 0!=(16&this.b)},MWn.Dk=function(){return 0!=(8&this.b)},MWn.Ek=function(){return 0!=(this.b&M9n)},MWn.rk=function(){return 0!=(32&this.b)},MWn.Fk=function(){return 0!=(this.b&k6n)},MWn.wj=function(n){return this.d?x3(this.d,n):this.ak().Yj().wj(n)},MWn.fj=function(){return 0!=(2&this.b)?0!=(1&this.b):0!=this.i},MWn.hi=function(){return 0!=(128&this.b)},MWn.Xj=function(){var n;sqn(this),0!=(2&this.b)&&(mA(this.e)?(n=0!=(1&this.b),this.b&=-2,Lv(this,new t6(this.e,2,Awn(this.e.Tg(),this.ak()),n,!1))):this.b&=-2)},MWn.ni=function(){return 0==(1536&this.b)},MWn.b=0,vX(y9n,"EcoreEList/Generic",1164),wAn(1165,1164,R9n,zQ),MWn.ak=function(){return this.a},vX(y9n,"EcoreEList/Dynamic",1165),wAn(747,63,h8n,Ip),MWn.ri=function(n){return Den(this.a.a,n)},vX(y9n,"EcoreEMap/1",747),wAn(746,85,R9n,Zz),MWn.bi=function(n,t){Ivn(this.b,BB(t,133))},MWn.di=function(n,t){aan(this.b)},MWn.ei=function(n,t,e){var i;++(i=this.b,BB(t,133),i).e},MWn.fi=function(n,t){Oln(this.b,BB(t,133))},MWn.gi=function(n,t,e){Oln(this.b,BB(e,133)),GI(e)===GI(t)&&BB(e,133).Th(c$(BB(t,133).cd())),Ivn(this.b,BB(t,133))},vX(y9n,"EcoreEMap/DelegateEObjectContainmentEList",746),wAn(1171,151,j9n,yin),vX(y9n,"EcoreEMap/Unsettable",1171),wAn(1172,746,R9n,lK),MWn.ci=function(){this.a=!0},MWn.fj=function(){return this.a},MWn.Xj=function(){var n;sqn(this),mA(this.e)?(n=this.a,this.a=!1,ban(this.e,new t6(this.e,2,this.c,n,!1))):this.a=!1},MWn.a=!1,vX(y9n,"EcoreEMap/Unsettable/UnsettableDelegateEObjectContainmentEList",1172),wAn(1168,228,tYn,lX),MWn.a=!1,MWn.b=!1,vX(y9n,"EcoreUtil/Copier",1168),wAn(745,1,QWn,F2),MWn.Nb=function(n){fU(this,n)},MWn.Ob=function(){return udn(this)},MWn.Pb=function(){var n;return udn(this),n=this.b,this.b=null,n},MWn.Qb=function(){this.a.Qb()},vX(y9n,"EcoreUtil/ProperContentIterator",745),wAn(1382,1381,{},Ff),vX(y9n,"EcoreValidator",1382),bq(y9n,"FeatureMapUtil/Validator"),wAn(1260,1,{1942:1},xs),MWn.rl=function(n){return!0},vX(y9n,"FeatureMapUtil/1",1260),wAn(757,1,{1942:1},cUn),MWn.rl=function(n){var t;return this.c==n||(null==(t=TD(RX(this.a,n)))?xRn(this,n)?(r6(this.a,n,(hN(),vtt)),!0):(r6(this.a,n,(hN(),ptt)),!1):t==(hN(),vtt))},MWn.e=!1,vX(y9n,"FeatureMapUtil/BasicValidator",757),wAn(758,43,tYn,X$),vX(y9n,"FeatureMapUtil/BasicValidator/Cache",758),wAn(501,52,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,69:1,95:1},xI),MWn.Vc=function(n,t){Axn(this.c,this.b,n,t)},MWn.Fc=function(n){return xKn(this.c,this.b,n)},MWn.Wc=function(n,t){return jHn(this.c,this.b,n,t)},MWn.Gc=function(n){return Z$(this,n)},MWn.Xh=function(n,t){htn(this.c,this.b,n,t)},MWn.lk=function(n,t){return PRn(this.c,this.b,n,t)},MWn.pi=function(n){return iHn(this.c,this.b,n,!1)},MWn.Zh=function(){return jA(this.c,this.b)},MWn.$h=function(){return EA(this.c,this.b)},MWn._h=function(n){return $8(this.c,this.b,n)},MWn.mk=function(n,t){return tR(this,n,t)},MWn.$b=function(){Nv(this)},MWn.Hc=function(n){return G3(this.c,this.b,n)},MWn.Ic=function(n){return Mcn(this.c,this.b,n)},MWn.Xb=function(n){return iHn(this.c,this.b,n,!0)},MWn.Wj=function(n){return this},MWn.Xc=function(n){return z3(this.c,this.b,n)},MWn.dc=function(){return HI(this)},MWn.fj=function(){return!adn(this.c,this.b)},MWn.Kc=function(){return cnn(this.c,this.b)},MWn.Yc=function(){return ann(this.c,this.b)},MWn.Zc=function(n){return lln(this.c,this.b,n)},MWn.ii=function(n,t){return mFn(this.c,this.b,n,t)},MWn.ji=function(n,t){Q6(this.c,this.b,n,t)},MWn.$c=function(n){return aPn(this.c,this.b,n)},MWn.Mc=function(n){return CKn(this.c,this.b,n)},MWn._c=function(n,t){return XFn(this.c,this.b,n,t)},MWn.Wb=function(n){AOn(this.c,this.b),Z$(this,BB(n,15))},MWn.gc=function(){return Kln(this.c,this.b)},MWn.Pc=function(){return G1(this.c,this.b)},MWn.Qc=function(n){return U3(this.c,this.b,n)},MWn.Ib=function(){var n,t;for((t=new Sk).a+="[",n=jA(this.c,this.b);Ksn(n);)cO(t,kN(cvn(n))),Ksn(n)&&(t.a+=FWn);return t.a+="]",t.a},MWn.Xj=function(){AOn(this.c,this.b)},vX(y9n,"FeatureMapUtil/FeatureEList",501),wAn(627,36,t9n,b4),MWn.yi=function(n){return eln(this,n)},MWn.Di=function(n){var t,e,i,r;switch(this.d){case 1:case 2:if(GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.g=n.zi(),1==n.xi()&&(this.d=1),!0;break;case 3:if(3===n.xi()&&GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.d=5,f9(t=new gtn(2),this.g),f9(t,n.zi()),this.g=t,!0;break;case 5:if(3===n.xi()&&GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return BB(this.g,14).Fc(n.zi()),!0;break;case 4:switch(n.xi()){case 3:if(GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.d=1,this.g=n.zi(),!0;break;case 4:if(GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return this.d=6,f9(r=new gtn(2),this.n),f9(r,n.Bi()),this.n=r,i=Pun(Gk(ANt,1),hQn,25,15,[this.o,n.Ci()]),this.g=i,!0}break;case 6:if(4===n.xi()&&GI(n.Ai())===GI(this.c)&&eln(this,null)==n.yi(null))return BB(this.n,14).Fc(n.Bi()),aHn(i=BB(this.g,48),0,e=x8(ANt,hQn,25,i.length+1,15,1),0,i.length),e[i.length]=n.Ci(),this.g=e,!0}return!1},vX(y9n,"FeatureMapUtil/FeatureENotificationImpl",627),wAn(552,501,{20:1,28:1,52:1,14:1,15:1,58:1,76:1,153:1,215:1,1937:1,69:1,95:1},lq),MWn.dl=function(n,t){return xKn(this.c,n,t)},MWn.el=function(n,t,e){return PRn(this.c,n,t,e)},MWn.fl=function(n,t,e){return ZBn(this.c,n,t,e)},MWn.gl=function(){return this},MWn.hl=function(n,t){return rHn(this.c,n,t)},MWn.il=function(n){return BB(iHn(this.c,this.b,n,!1),72).ak()},MWn.jl=function(n){return BB(iHn(this.c,this.b,n,!1),72).dd()},MWn.kl=function(){return this.a},MWn.ll=function(n){return!adn(this.c,n)},MWn.ml=function(n,t){MHn(this.c,n,t)},MWn.nl=function(n){return zin(this.c,n)},MWn.ol=function(n){Kmn(this.c,n)},vX(y9n,"FeatureMapUtil/FeatureFeatureMap",552),wAn(1259,1,k9n,KI),MWn.Wj=function(n){return iHn(this.b,this.a,-1,n)},MWn.fj=function(){return!adn(this.b,this.a)},MWn.Wb=function(n){MHn(this.b,this.a,n)},MWn.Xj=function(){AOn(this.b,this.a)},vX(y9n,"FeatureMapUtil/FeatureValue",1259);var sLt,hLt,fLt,lLt,bLt,wLt=bq(O7n,"AnyType");wAn(666,60,BVn,ik),vX(O7n,"InvalidDatatypeValueException",666);var dLt,gLt,pLt,vLt,mLt,yLt,kLt,jLt,ELt,TLt,MLt,SLt,PLt,CLt,ILt,OLt,ALt,$Lt,LLt,NLt,xLt,DLt,RLt,KLt,_Lt,FLt,BLt,HLt,qLt,GLt,zLt=bq(O7n,A7n),ULt=bq(O7n,$7n),XLt=bq(O7n,L7n);wAn(830,506,{105:1,92:1,90:1,56:1,49:1,97:1,843:1},Rm),MWn._g=function(n,t,e){switch(n){case 0:return e?(!this.c&&(this.c=new Ecn(this,0)),this.c):(!this.c&&(this.c=new Ecn(this,0)),this.c.b);case 1:return e?(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)):(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).kl();case 2:return e?(!this.b&&(this.b=new Ecn(this,2)),this.b):(!this.b&&(this.b=new Ecn(this,2)),this.b.b)}return U9(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.c&&(this.c=new Ecn(this,0)),TKn(this.c,n,e);case 1:return(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),69)).mk(n,e);case 2:return!this.b&&(this.b=new Ecn(this,2)),TKn(this.b,n,e)}return BB(itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),t),66).Nj().Rj(this,Q7(this),t-bX(this.zh()),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.c&&0!=this.c.i;case 1:return!(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).dc();case 2:return!!this.b&&0!=this.b.i}return O3(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void tX(this.c,t);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).Wb(t);case 2:return!this.b&&(this.b=new Ecn(this,2)),void tX(this.b,t)}Lbn(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),pLt},MWn.Bh=function(n){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void sqn(this.c);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).$b();case 2:return!this.b&&(this.b=new Ecn(this,2)),void sqn(this.b)}qfn(this,n-bX(this.zh()),itn(0==(2&this.j)?this.zh():(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.Ib=function(){var n;return 0!=(4&this.j)?P$n(this):((n=new fN(P$n(this))).a+=" (mixed: ",rO(n,this.c),n.a+=", anyAttribute: ",rO(n,this.b),n.a+=")",n.a)},vX(N7n,"AnyTypeImpl",830),wAn(667,506,{105:1,92:1,90:1,56:1,49:1,97:1,2021:1,667:1},Rs),MWn._g=function(n,t,e){switch(n){case 0:return this.a;case 1:return this.b}return U9(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return null!=this.a;case 1:return null!=this.b}return O3(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return void kb(this,SD(t));case 1:return void jb(this,SD(t))}Lbn(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),OLt},MWn.Bh=function(n){switch(n){case 0:return void(this.a=null);case 1:return void(this.b=null)}qfn(this,n-bX((Uqn(),OLt)),itn(0==(2&this.j)?OLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.Ib=function(){var n;return 0!=(4&this.j)?P$n(this):((n=new fN(P$n(this))).a+=" (data: ",cO(n,this.a),n.a+=", target: ",cO(n,this.b),n.a+=")",n.a)},MWn.a=null,MWn.b=null,vX(N7n,"ProcessingInstructionImpl",667),wAn(668,830,{105:1,92:1,90:1,56:1,49:1,97:1,843:1,2022:1,668:1},_m),MWn._g=function(n,t,e){switch(n){case 0:return e?(!this.c&&(this.c=new Ecn(this,0)),this.c):(!this.c&&(this.c=new Ecn(this,0)),this.c.b);case 1:return e?(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)):(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).kl();case 2:return e?(!this.b&&(this.b=new Ecn(this,2)),this.b):(!this.b&&(this.b=new Ecn(this,2)),this.b.b);case 3:return!this.c&&(this.c=new Ecn(this,0)),SD(rHn(this.c,(Uqn(),LLt),!0));case 4:return gK(this.a,(!this.c&&(this.c=new Ecn(this,0)),SD(rHn(this.c,(Uqn(),LLt),!0))));case 5:return this.a}return U9(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.lh=function(n){switch(n){case 0:return!!this.c&&0!=this.c.i;case 1:return!(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).dc();case 2:return!!this.b&&0!=this.b.i;case 3:return!this.c&&(this.c=new Ecn(this,0)),null!=SD(rHn(this.c,(Uqn(),LLt),!0));case 4:return null!=gK(this.a,(!this.c&&(this.c=new Ecn(this,0)),SD(rHn(this.c,(Uqn(),LLt),!0))));case 5:return!!this.a}return O3(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void tX(this.c,t);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(BB(n1(this.c,(Uqn(),vLt)),153),215)).Wb(t);case 2:return!this.b&&(this.b=new Ecn(this,2)),void tX(this.b,t);case 3:return void F0(this,SD(t));case 4:return void F0(this,pK(this.a,t));case 5:return void Eb(this,BB(t,148))}Lbn(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),$Lt},MWn.Bh=function(n){switch(n){case 0:return!this.c&&(this.c=new Ecn(this,0)),void sqn(this.c);case 1:return void(!this.c&&(this.c=new Ecn(this,0)),BB(n1(this.c,(Uqn(),vLt)),153)).$b();case 2:return!this.b&&(this.b=new Ecn(this,2)),void sqn(this.b);case 3:return!this.c&&(this.c=new Ecn(this,0)),void MHn(this.c,(Uqn(),LLt),null);case 4:return void F0(this,pK(this.a,null));case 5:return void(this.a=null)}qfn(this,n-bX((Uqn(),$Lt)),itn(0==(2&this.j)?$Lt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},vX(N7n,"SimpleAnyTypeImpl",668),wAn(669,506,{105:1,92:1,90:1,56:1,49:1,97:1,2023:1,669:1},Km),MWn._g=function(n,t,e){switch(n){case 0:return e?(!this.a&&(this.a=new Ecn(this,0)),this.a):(!this.a&&(this.a=new Ecn(this,0)),this.a.b);case 1:return e?(!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),this.b):(!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),A8(this.b));case 2:return e?(!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),this.c):(!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),A8(this.c));case 3:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),DLt));case 4:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),RLt));case 5:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),_Lt));case 6:return!this.a&&(this.a=new Ecn(this,0)),n1(this.a,(Uqn(),FLt))}return U9(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t,e)},MWn.jh=function(n,t,e){switch(t){case 0:return!this.a&&(this.a=new Ecn(this,0)),TKn(this.a,n,e);case 1:return!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),BK(this.b,n,e);case 2:return!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),BK(this.c,n,e);case 5:return!this.a&&(this.a=new Ecn(this,0)),tR(n1(this.a,(Uqn(),_Lt)),n,e)}return BB(itn(0==(2&this.j)?(Uqn(),xLt):(!this.k&&(this.k=new Kf),this.k).ck(),t),66).Nj().Rj(this,Q7(this),t-bX((Uqn(),xLt)),n,e)},MWn.lh=function(n){switch(n){case 0:return!!this.a&&0!=this.a.i;case 1:return!!this.b&&0!=this.b.f;case 2:return!!this.c&&0!=this.c.f;case 3:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),DLt)));case 4:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),RLt)));case 5:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),_Lt)));case 6:return!this.a&&(this.a=new Ecn(this,0)),!HI(n1(this.a,(Uqn(),FLt)))}return O3(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.sh=function(n,t){switch(n){case 0:return!this.a&&(this.a=new Ecn(this,0)),void tX(this.a,t);case 1:return!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),void tan(this.b,t);case 2:return!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),void tan(this.c,t);case 3:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),DLt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,DLt),BB(t,14));case 4:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),RLt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,RLt),BB(t,14));case 5:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),_Lt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,_Lt),BB(t,14));case 6:return!this.a&&(this.a=new Ecn(this,0)),Nv(n1(this.a,(Uqn(),FLt))),!this.a&&(this.a=new Ecn(this,0)),void Z$(n1(this.a,FLt),BB(t,14))}Lbn(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n),t)},MWn.zh=function(){return Uqn(),xLt},MWn.Bh=function(n){switch(n){case 0:return!this.a&&(this.a=new Ecn(this,0)),void sqn(this.a);case 1:return!this.b&&(this.b=new y9((gWn(),k$t),X$t,this,1)),void this.b.c.$b();case 2:return!this.c&&(this.c=new y9((gWn(),k$t),X$t,this,2)),void this.c.c.$b();case 3:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),DLt)));case 4:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),RLt)));case 5:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),_Lt)));case 6:return!this.a&&(this.a=new Ecn(this,0)),void Nv(n1(this.a,(Uqn(),FLt)))}qfn(this,n-bX((Uqn(),xLt)),itn(0==(2&this.j)?xLt:(!this.k&&(this.k=new Kf),this.k).ck(),n))},MWn.Ib=function(){var n;return 0!=(4&this.j)?P$n(this):((n=new fN(P$n(this))).a+=" (mixed: ",rO(n,this.a),n.a+=")",n.a)},vX(N7n,"XMLTypeDocumentRootImpl",669),wAn(1919,704,{105:1,92:1,90:1,471:1,147:1,56:1,108:1,49:1,97:1,150:1,114:1,115:1,2024:1},Ds),MWn.Ih=function(n,t){switch(n.yj()){case 7:case 8:case 9:case 10:case 16:case 22:case 23:case 24:case 25:case 26:case 32:case 33:case 34:case 36:case 37:case 44:case 45:case 50:case 51:case 53:case 55:case 56:case 57:case 58:case 60:case 61:case 4:return null==t?null:Bbn(t);case 19:case 28:case 29:case 35:case 38:case 39:case 41:case 46:case 52:case 54:case 5:return SD(t);case 6:return mD(BB(t,190));case 12:case 47:case 49:case 11:return qGn(this,n,t);case 13:return null==t?null:GBn(BB(t,240));case 15:case 14:return null==t?null:RU(Gy(MD(t)));case 17:return EEn((Uqn(),t));case 18:return EEn(t);case 21:case 20:return null==t?null:KU(BB(t,155).a);case 27:return yD(BB(t,190));case 30:return _mn((Uqn(),BB(t,15)));case 31:return _mn(BB(t,15));case 40:return jD((Uqn(),t));case 42:return TEn((Uqn(),t));case 43:return TEn(t);case 59:case 48:return kD((Uqn(),t));default:throw Hp(new _y(d6n+n.ne()+g6n))}},MWn.Jh=function(n){var t;switch(-1==n.G&&(n.G=(t=Utn(n))?uvn(t.Mh(),n):-1),n.G){case 0:return new Rm;case 1:return new Rs;case 2:return new _m;case 3:return new Km;default:throw Hp(new _y(m6n+n.zb+g6n))}},MWn.Kh=function(n,t){var e,i,r,c,a,u,o,s,h,f,l,b,w,d,g,p;switch(n.yj()){case 5:case 52:case 4:return t;case 6:return ypn(t);case 8:case 7:return null==t?null:_En(t);case 9:return null==t?null:Pnn(l_n((i=FBn(t,!0)).length>0&&(b1(0,i.length),43==i.charCodeAt(0))?i.substr(1):i,-128,127)<<24>>24);case 10:return null==t?null:Pnn(l_n((r=FBn(t,!0)).length>0&&(b1(0,r.length),43==r.charCodeAt(0))?r.substr(1):r,-128,127)<<24>>24);case 11:return SD(xXn(this,(Uqn(),kLt),t));case 12:return SD(xXn(this,(Uqn(),jLt),t));case 13:return null==t?null:new wE(FBn(t,!0));case 15:case 14:return gLn(t);case 16:return SD(xXn(this,(Uqn(),ELt),t));case 17:return Hdn((Uqn(),t));case 18:return Hdn(t);case 28:case 29:case 35:case 38:case 39:case 41:case 54:case 19:return FBn(t,!0);case 21:case 20:return ILn(t);case 22:return SD(xXn(this,(Uqn(),TLt),t));case 23:return SD(xXn(this,(Uqn(),MLt),t));case 24:return SD(xXn(this,(Uqn(),SLt),t));case 25:return SD(xXn(this,(Uqn(),PLt),t));case 26:return SD(xXn(this,(Uqn(),CLt),t));case 27:return Zgn(t);case 30:return qdn((Uqn(),t));case 31:return qdn(t);case 32:return null==t?null:iln(l_n((h=FBn(t,!0)).length>0&&(b1(0,h.length),43==h.charCodeAt(0))?h.substr(1):h,_Vn,DWn));case 33:return null==t?null:new $A((f=FBn(t,!0)).length>0&&(b1(0,f.length),43==f.charCodeAt(0))?f.substr(1):f);case 34:return null==t?null:iln(l_n((l=FBn(t,!0)).length>0&&(b1(0,l.length),43==l.charCodeAt(0))?l.substr(1):l,_Vn,DWn));case 36:return null==t?null:jgn(rUn((b=FBn(t,!0)).length>0&&(b1(0,b.length),43==b.charCodeAt(0))?b.substr(1):b));case 37:return null==t?null:jgn(rUn((w=FBn(t,!0)).length>0&&(b1(0,w.length),43==w.charCodeAt(0))?w.substr(1):w));case 40:return Vwn((Uqn(),t));case 42:return Gdn((Uqn(),t));case 43:return Gdn(t);case 44:return null==t?null:new $A((d=FBn(t,!0)).length>0&&(b1(0,d.length),43==d.charCodeAt(0))?d.substr(1):d);case 45:return null==t?null:new $A((g=FBn(t,!0)).length>0&&(b1(0,g.length),43==g.charCodeAt(0))?g.substr(1):g);case 46:return FBn(t,!1);case 47:return SD(xXn(this,(Uqn(),ILt),t));case 59:case 48:return Wwn((Uqn(),t));case 49:return SD(xXn(this,(Uqn(),ALt),t));case 50:return null==t?null:rln(l_n((p=FBn(t,!0)).length>0&&(b1(0,p.length),43==p.charCodeAt(0))?p.substr(1):p,Q9n,32767)<<16>>16);case 51:return null==t?null:rln(l_n((c=FBn(t,!0)).length>0&&(b1(0,c.length),43==c.charCodeAt(0))?c.substr(1):c,Q9n,32767)<<16>>16);case 53:return SD(xXn(this,(Uqn(),NLt),t));case 55:return null==t?null:rln(l_n((a=FBn(t,!0)).length>0&&(b1(0,a.length),43==a.charCodeAt(0))?a.substr(1):a,Q9n,32767)<<16>>16);case 56:return null==t?null:rln(l_n((u=FBn(t,!0)).length>0&&(b1(0,u.length),43==u.charCodeAt(0))?u.substr(1):u,Q9n,32767)<<16>>16);case 57:return null==t?null:jgn(rUn((o=FBn(t,!0)).length>0&&(b1(0,o.length),43==o.charCodeAt(0))?o.substr(1):o));case 58:return null==t?null:jgn(rUn((s=FBn(t,!0)).length>0&&(b1(0,s.length),43==s.charCodeAt(0))?s.substr(1):s));case 60:return null==t?null:iln(l_n((e=FBn(t,!0)).length>0&&(b1(0,e.length),43==e.charCodeAt(0))?e.substr(1):e,_Vn,DWn));case 61:return null==t?null:iln(l_n(FBn(t,!0),_Vn,DWn));default:throw Hp(new _y(d6n+n.ne()+g6n))}},vX(N7n,"XMLTypeFactoryImpl",1919),wAn(586,179,{105:1,92:1,90:1,147:1,191:1,56:1,235:1,108:1,49:1,97:1,150:1,179:1,114:1,115:1,675:1,1945:1,586:1},zW),MWn.N=!1,MWn.O=!1;var WLt,VLt,QLt,YLt,JLt,ZLt=!1;vX(N7n,"XMLTypePackageImpl",586),wAn(1852,1,{837:1},Ks),MWn._j=function(){return fFn(),TNt},vX(N7n,"XMLTypePackageImpl/1",1852),wAn(1861,1,s7n,_s),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/10",1861),wAn(1862,1,s7n,Fs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/11",1862),wAn(1863,1,s7n,Bs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/12",1863),wAn(1864,1,s7n,Hs),MWn.wj=function(n){return UI(n)},MWn.xj=function(n){return x8(Ptt,sVn,333,n,7,1)},vX(N7n,"XMLTypePackageImpl/13",1864),wAn(1865,1,s7n,qs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/14",1865),wAn(1866,1,s7n,Gs),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/15",1866),wAn(1867,1,s7n,zs),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/16",1867),wAn(1868,1,s7n,Us),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/17",1868),wAn(1869,1,s7n,Xs),MWn.wj=function(n){return cL(n,155)},MWn.xj=function(n){return x8(Ctt,sVn,155,n,0,1)},vX(N7n,"XMLTypePackageImpl/18",1869),wAn(1870,1,s7n,Ws),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/19",1870),wAn(1853,1,s7n,Vs),MWn.wj=function(n){return cL(n,843)},MWn.xj=function(n){return x8(wLt,HWn,843,n,0,1)},vX(N7n,"XMLTypePackageImpl/2",1853),wAn(1871,1,s7n,Qs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/20",1871),wAn(1872,1,s7n,Ys),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/21",1872),wAn(1873,1,s7n,Js),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/22",1873),wAn(1874,1,s7n,Zs),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/23",1874),wAn(1875,1,s7n,nh),MWn.wj=function(n){return cL(n,190)},MWn.xj=function(n){return x8(NNt,sVn,190,n,0,2)},vX(N7n,"XMLTypePackageImpl/24",1875),wAn(1876,1,s7n,th),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/25",1876),wAn(1877,1,s7n,eh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/26",1877),wAn(1878,1,s7n,ih),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/27",1878),wAn(1879,1,s7n,rh),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/28",1879),wAn(1880,1,s7n,ch),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/29",1880),wAn(1854,1,s7n,ah),MWn.wj=function(n){return cL(n,667)},MWn.xj=function(n){return x8(zLt,HWn,2021,n,0,1)},vX(N7n,"XMLTypePackageImpl/3",1854),wAn(1881,1,s7n,uh),MWn.wj=function(n){return cL(n,19)},MWn.xj=function(n){return x8(Att,sVn,19,n,0,1)},vX(N7n,"XMLTypePackageImpl/30",1881),wAn(1882,1,s7n,oh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/31",1882),wAn(1883,1,s7n,sh),MWn.wj=function(n){return cL(n,162)},MWn.xj=function(n){return x8(Rtt,sVn,162,n,0,1)},vX(N7n,"XMLTypePackageImpl/32",1883),wAn(1884,1,s7n,hh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/33",1884),wAn(1885,1,s7n,fh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/34",1885),wAn(1886,1,s7n,lh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/35",1886),wAn(1887,1,s7n,bh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/36",1887),wAn(1888,1,s7n,wh),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/37",1888),wAn(1889,1,s7n,dh),MWn.wj=function(n){return cL(n,15)},MWn.xj=function(n){return x8(Rnt,nZn,15,n,0,1)},vX(N7n,"XMLTypePackageImpl/38",1889),wAn(1890,1,s7n,gh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/39",1890),wAn(1855,1,s7n,ph),MWn.wj=function(n){return cL(n,668)},MWn.xj=function(n){return x8(ULt,HWn,2022,n,0,1)},vX(N7n,"XMLTypePackageImpl/4",1855),wAn(1891,1,s7n,vh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/40",1891),wAn(1892,1,s7n,mh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/41",1892),wAn(1893,1,s7n,yh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/42",1893),wAn(1894,1,s7n,kh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/43",1894),wAn(1895,1,s7n,jh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/44",1895),wAn(1896,1,s7n,Eh),MWn.wj=function(n){return cL(n,184)},MWn.xj=function(n){return x8(_tt,sVn,184,n,0,1)},vX(N7n,"XMLTypePackageImpl/45",1896),wAn(1897,1,s7n,Th),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/46",1897),wAn(1898,1,s7n,Mh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/47",1898),wAn(1899,1,s7n,Sh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/48",1899),wAn(sQn,1,s7n,Ph),MWn.wj=function(n){return cL(n,184)},MWn.xj=function(n){return x8(_tt,sVn,184,n,0,1)},vX(N7n,"XMLTypePackageImpl/49",sQn),wAn(1856,1,s7n,Ch),MWn.wj=function(n){return cL(n,669)},MWn.xj=function(n){return x8(XLt,HWn,2023,n,0,1)},vX(N7n,"XMLTypePackageImpl/5",1856),wAn(1901,1,s7n,Ih),MWn.wj=function(n){return cL(n,162)},MWn.xj=function(n){return x8(Rtt,sVn,162,n,0,1)},vX(N7n,"XMLTypePackageImpl/50",1901),wAn(1902,1,s7n,Oh),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/51",1902),wAn(1903,1,s7n,Ah),MWn.wj=function(n){return cL(n,19)},MWn.xj=function(n){return x8(Att,sVn,19,n,0,1)},vX(N7n,"XMLTypePackageImpl/52",1903),wAn(1857,1,s7n,$h),MWn.wj=function(n){return XI(n)},MWn.xj=function(n){return x8(Qtt,sVn,2,n,6,1)},vX(N7n,"XMLTypePackageImpl/6",1857),wAn(1858,1,s7n,Lh),MWn.wj=function(n){return cL(n,190)},MWn.xj=function(n){return x8(NNt,sVn,190,n,0,2)},vX(N7n,"XMLTypePackageImpl/7",1858),wAn(1859,1,s7n,Nh),MWn.wj=function(n){return zI(n)},MWn.xj=function(n){return x8(ktt,sVn,476,n,8,1)},vX(N7n,"XMLTypePackageImpl/8",1859),wAn(1860,1,s7n,xh),MWn.wj=function(n){return cL(n,217)},MWn.xj=function(n){return x8(Ttt,sVn,217,n,0,1)},vX(N7n,"XMLTypePackageImpl/9",1860),wAn(50,60,BVn,ak),vX(ant,"RegEx/ParseException",50),wAn(820,1,{},Dh),MWn.sl=function(n){return n<this.j&&63==fV(this.i,n)},MWn.tl=function(){var n,t,e,i,r;if(10!=this.c)throw Hp(new ak(kWn((u$(),g8n))));switch(n=this.a){case 101:n=27;break;case 102:n=12;break;case 110:n=10;break;case 114:n=13;break;case 116:n=9;break;case 120:if(QXn(this),0!=this.c)throw Hp(new ak(kWn((u$(),B8n))));if(123==this.a){for(r=0,e=0;;){if(QXn(this),0!=this.c)throw Hp(new ak(kWn((u$(),B8n))));if((r=Gvn(this.a))<0)break;if(e>16*e)throw Hp(new ak(kWn((u$(),H8n))));e=16*e+r}if(125!=this.a)throw Hp(new ak(kWn((u$(),q8n))));if(e>unt)throw Hp(new ak(kWn((u$(),G8n))));n=e}else{if(r=0,0!=this.c||(r=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(e=r,QXn(this),0!=this.c||(r=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));n=e=16*e+r}break;case 117:if(i=0,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));n=t=16*t+i;break;case 118:if(QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if(t=16*t+i,QXn(this),0!=this.c||(i=Gvn(this.a))<0)throw Hp(new ak(kWn((u$(),B8n))));if((t=16*t+i)>unt)throw Hp(new ak(kWn((u$(),"parser.descappe.4"))));n=t;break;case 65:case 90:case 122:throw Hp(new ak(kWn((u$(),z8n))))}return n},MWn.ul=function(n){var t;switch(n){case 100:t=32==(32&this.e)?ZUn("Nd",!0):(wWn(),uNt);break;case 68:t=32==(32&this.e)?ZUn("Nd",!1):(wWn(),lNt);break;case 119:t=32==(32&this.e)?ZUn("IsWord",!0):(wWn(),kNt);break;case 87:t=32==(32&this.e)?ZUn("IsWord",!1):(wWn(),wNt);break;case 115:t=32==(32&this.e)?ZUn("IsSpace",!0):(wWn(),gNt);break;case 83:t=32==(32&this.e)?ZUn("IsSpace",!1):(wWn(),bNt);break;default:throw Hp(new dy(ont+n.toString(16)))}return t},MWn.vl=function(n){var t,e,i,r,c,a,u,o,s,h,f;for(this.b=1,QXn(this),t=null,0==this.c&&94==this.a?(QXn(this),n?(wWn(),wWn(),s=new M0(5)):(wWn(),wWn(),Yxn(t=new M0(4),0,unt),s=new M0(4))):(wWn(),wWn(),s=new M0(4)),r=!0;1!=(f=this.c)&&(0!=f||93!=this.a||r);){if(r=!1,e=this.a,i=!1,10==f)switch(e){case 100:case 68:case 119:case 87:case 115:case 83:sHn(s,this.ul(e)),i=!0;break;case 105:case 73:case 99:case 67:(e=this.Ll(s,e))<0&&(i=!0);break;case 112:case 80:if(!(h=DIn(this,e)))throw Hp(new ak(kWn((u$(),O8n))));sHn(s,h),i=!0;break;default:e=this.tl()}else if(20==f){if((c=lx(this.i,58,this.d))<0)throw Hp(new ak(kWn((u$(),A8n))));if(a=!0,94==fV(this.i,this.d)&&(++this.d,a=!1),!(u=b9(fx(this.i,this.d,c),a,512==(512&this.e))))throw Hp(new ak(kWn((u$(),L8n))));if(sHn(s,u),i=!0,c+1>=this.j||93!=fV(this.i,c+1))throw Hp(new ak(kWn((u$(),A8n))));this.d=c+2}if(QXn(this),!i)if(0!=this.c||45!=this.a)Yxn(s,e,e);else{if(QXn(this),1==(f=this.c))throw Hp(new ak(kWn((u$(),$8n))));0==f&&93==this.a?(Yxn(s,e,e),Yxn(s,45,45)):(o=this.a,10==f&&(o=this.tl()),QXn(this),Yxn(s,e,o))}(this.e&k6n)==k6n&&0==this.c&&44==this.a&&QXn(this)}if(1==this.c)throw Hp(new ak(kWn((u$(),$8n))));return t&&(WGn(t,s),s=t),T$n(s),qHn(s),this.b=0,QXn(this),s},MWn.wl=function(){var n,t,e,i;for(e=this.vl(!1);7!=(i=this.c);){if(n=this.a,(0!=i||45!=n&&38!=n)&&4!=i)throw Hp(new ak(kWn((u$(),_8n))));if(QXn(this),9!=this.c)throw Hp(new ak(kWn((u$(),K8n))));if(t=this.vl(!1),4==i)sHn(e,t);else if(45==n)WGn(e,t);else{if(38!=n)throw Hp(new dy("ASSERT"));kGn(e,t)}}return QXn(this),e},MWn.xl=function(){var n,t;return n=this.a-48,wWn(),wWn(),t=new vJ(12,null,n),!this.g&&(this.g=new _v),Cv(this.g,new Op(n)),QXn(this),t},MWn.yl=function(){return QXn(this),wWn(),pNt},MWn.zl=function(){return QXn(this),wWn(),dNt},MWn.Al=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Bl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Cl=function(){return QXn(this),fsn()},MWn.Dl=function(){return QXn(this),wWn(),mNt},MWn.El=function(){return QXn(this),wWn(),jNt},MWn.Fl=function(){var n;if(this.d>=this.j||64!=(65504&(n=fV(this.i,this.d++))))throw Hp(new ak(kWn((u$(),S8n))));return QXn(this),wWn(),wWn(),new oG(0,n-64)},MWn.Gl=function(){return QXn(this),RFn()},MWn.Hl=function(){return QXn(this),wWn(),ENt},MWn.Il=function(){var n;return wWn(),wWn(),n=new oG(0,105),QXn(this),n},MWn.Jl=function(){return QXn(this),wWn(),yNt},MWn.Kl=function(){return QXn(this),wWn(),vNt},MWn.Ll=function(n,t){return this.tl()},MWn.Ml=function(){return QXn(this),wWn(),hNt},MWn.Nl=function(){var n,t,e,i,r;if(this.d+1>=this.j)throw Hp(new ak(kWn((u$(),E8n))));if(i=-1,t=null,49<=(n=fV(this.i,this.d))&&n<=57){if(i=n-48,!this.g&&(this.g=new _v),Cv(this.g,new Op(i)),++this.d,41!=fV(this.i,this.d))throw Hp(new ak(kWn((u$(),y8n))));++this.d}else switch(63==n&&--this.d,QXn(this),(t=OXn(this)).e){case 20:case 21:case 22:case 23:break;case 8:if(7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));break;default:throw Hp(new ak(kWn((u$(),T8n))))}if(QXn(this),e=null,2==(r=Vdn(this)).e){if(2!=r.em())throw Hp(new ak(kWn((u$(),M8n))));e=r.am(1),r=r.am(0)}if(7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),wWn(),wWn(),new jnn(i,t,r,e)},MWn.Ol=function(){return QXn(this),wWn(),fNt},MWn.Pl=function(){var n;if(QXn(this),n=uU(24,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Ql=function(){var n;if(QXn(this),n=uU(20,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Rl=function(){var n;if(QXn(this),n=uU(22,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Sl=function(){var n,t,e,i,r;for(n=0,e=0,t=-1;this.d<this.j&&0!=(r=QOn(t=fV(this.i,this.d)));)n|=r,++this.d;if(this.d>=this.j)throw Hp(new ak(kWn((u$(),k8n))));if(45==t){for(++this.d;this.d<this.j&&0!=(r=QOn(t=fV(this.i,this.d)));)e|=r,++this.d;if(this.d>=this.j)throw Hp(new ak(kWn((u$(),k8n))))}if(58==t){if(++this.d,QXn(this),i=AX(Vdn(this),n,e),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));QXn(this)}else{if(41!=t)throw Hp(new ak(kWn((u$(),j8n))));++this.d,QXn(this),i=AX(Vdn(this),n,e)}return i},MWn.Tl=function(){var n;if(QXn(this),n=uU(21,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Ul=function(){var n;if(QXn(this),n=uU(23,Vdn(this)),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Vl=function(){var n,t;if(QXn(this),n=this.f++,t=oU(Vdn(this),n),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),t},MWn.Wl=function(){var n;if(QXn(this),n=oU(Vdn(this),0),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Xl=function(n){return QXn(this),5==this.c?(QXn(this),gG(n,(wWn(),wWn(),new h4(9,n)))):gG(n,(wWn(),wWn(),new h4(3,n)))},MWn.Yl=function(n){var t;return QXn(this),wWn(),wWn(),t=new r$(2),5==this.c?(QXn(this),tqn(t,sNt),tqn(t,n)):(tqn(t,n),tqn(t,sNt)),t},MWn.Zl=function(n){return QXn(this),5==this.c?(QXn(this),wWn(),wWn(),new h4(9,n)):(wWn(),wWn(),new h4(3,n))},MWn.a=0,MWn.b=0,MWn.c=0,MWn.d=0,MWn.e=0,MWn.f=1,MWn.g=null,MWn.j=0,vX(ant,"RegEx/RegexParser",820),wAn(1824,820,{},Fm),MWn.sl=function(n){return!1},MWn.tl=function(){return qDn(this)},MWn.ul=function(n){return d_n(n)},MWn.vl=function(n){return ZXn(this)},MWn.wl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.xl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.yl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.zl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Al=function(){return QXn(this),d_n(67)},MWn.Bl=function(){return QXn(this),d_n(73)},MWn.Cl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Dl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.El=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Fl=function(){return QXn(this),d_n(99)},MWn.Gl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Hl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Il=function(){return QXn(this),d_n(105)},MWn.Jl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Kl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ll=function(n,t){return sHn(n,d_n(t)),-1},MWn.Ml=function(){return QXn(this),wWn(),wWn(),new oG(0,94)},MWn.Nl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ol=function(){return QXn(this),wWn(),wWn(),new oG(0,36)},MWn.Pl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ql=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Rl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Sl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Tl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Ul=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Vl=function(){var n;if(QXn(this),n=oU(Vdn(this),0),7!=this.c)throw Hp(new ak(kWn((u$(),y8n))));return QXn(this),n},MWn.Wl=function(){throw Hp(new ak(kWn((u$(),U8n))))},MWn.Xl=function(n){return QXn(this),gG(n,(wWn(),wWn(),new h4(3,n)))},MWn.Yl=function(n){var t;return QXn(this),wWn(),wWn(),tqn(t=new r$(2),n),tqn(t,sNt),t},MWn.Zl=function(n){return QXn(this),wWn(),wWn(),new h4(3,n)};var nNt=null,tNt=null;vX(ant,"RegEx/ParserForXMLSchema",1824),wAn(117,1,ynt,Ap),MWn.$l=function(n){throw Hp(new dy("Not supported."))},MWn._l=function(){return-1},MWn.am=function(n){return null},MWn.bm=function(){return null},MWn.cm=function(n){},MWn.dm=function(n){},MWn.em=function(){return 0},MWn.Ib=function(){return this.fm(0)},MWn.fm=function(n){return 11==this.e?".":""},MWn.e=0;var eNt,iNt,rNt,cNt,aNt,uNt,oNt,sNt,hNt,fNt,lNt,bNt,wNt,dNt,gNt,pNt,vNt,mNt,yNt,kNt,jNt,ENt,TNt,MNt,SNt=null,PNt=null,CNt=null,INt=vX(ant,"RegEx/Token",117);wAn(136,117,{3:1,136:1,117:1},M0),MWn.fm=function(n){var t,e,i;if(4==this.e)if(this==oNt)e=".";else if(this==uNt)e="\\d";else if(this==kNt)e="\\w";else if(this==gNt)e="\\s";else{for((i=new Sk).a+="[",t=0;t<this.b.length;t+=2)0!=(n&k6n)&&t>0&&(i.a+=","),this.b[t]===this.b[t+1]?cO(i,aBn(this.b[t])):(cO(i,aBn(this.b[t])),i.a+="-",cO(i,aBn(this.b[t+1])));i.a+="]",e=i.a}else if(this==lNt)e="\\D";else if(this==wNt)e="\\W";else if(this==bNt)e="\\S";else{for((i=new Sk).a+="[^",t=0;t<this.b.length;t+=2)0!=(n&k6n)&&t>0&&(i.a+=","),this.b[t]===this.b[t+1]?cO(i,aBn(this.b[t])):(cO(i,aBn(this.b[t])),i.a+="-",cO(i,aBn(this.b[t+1])));i.a+="]",e=i.a}return e},MWn.a=!1,MWn.c=!1,vX(ant,"RegEx/RangeToken",136),wAn(584,1,{584:1},Op),MWn.a=0,vX(ant,"RegEx/RegexParser/ReferencePosition",584),wAn(583,1,{3:1,583:1},XE),MWn.Fb=function(n){var t;return null!=n&&!!cL(n,583)&&(t=BB(n,583),mK(this.b,t.b)&&this.a==t.a)},MWn.Hb=function(){return vvn(this.b+"/"+txn(this.a))},MWn.Ib=function(){return this.c.fm(this.a)},MWn.a=0,vX(ant,"RegEx/RegularExpression",583),wAn(223,117,ynt,oG),MWn._l=function(){return this.a},MWn.fm=function(n){var t,e;switch(this.e){case 0:switch(this.a){case 124:case 42:case 43:case 63:case 40:case 41:case 46:case 91:case 123:case 92:e="\\"+PR(this.a&QVn);break;case 12:e="\\f";break;case 10:e="\\n";break;case 13:e="\\r";break;case 9:e="\\t";break;case 27:e="\\e";break;default:e=this.a>=BQn?"\\v"+fx(t="0"+(this.a>>>0).toString(16),t.length-6,t.length):""+PR(this.a&QVn)}break;case 8:e=this==hNt||this==fNt?""+PR(this.a&QVn):"\\"+PR(this.a&QVn);break;default:e=null}return e},MWn.a=0,vX(ant,"RegEx/Token/CharToken",223),wAn(309,117,ynt,h4),MWn.am=function(n){return this.a},MWn.cm=function(n){this.b=n},MWn.dm=function(n){this.c=n},MWn.em=function(){return 1},MWn.fm=function(n){var t;if(3==this.e)if(this.c<0&&this.b<0)t=this.a.fm(n)+"*";else if(this.c==this.b)t=this.a.fm(n)+"{"+this.c+"}";else if(this.c>=0&&this.b>=0)t=this.a.fm(n)+"{"+this.c+","+this.b+"}";else{if(!(this.c>=0&&this.b<0))throw Hp(new dy("Token#toString(): CLOSURE "+this.c+FWn+this.b));t=this.a.fm(n)+"{"+this.c+",}"}else if(this.c<0&&this.b<0)t=this.a.fm(n)+"*?";else if(this.c==this.b)t=this.a.fm(n)+"{"+this.c+"}?";else if(this.c>=0&&this.b>=0)t=this.a.fm(n)+"{"+this.c+","+this.b+"}?";else{if(!(this.c>=0&&this.b<0))throw Hp(new dy("Token#toString(): NONGREEDYCLOSURE "+this.c+FWn+this.b));t=this.a.fm(n)+"{"+this.c+",}?"}return t},MWn.b=0,MWn.c=0,vX(ant,"RegEx/Token/ClosureToken",309),wAn(821,117,ynt,UU),MWn.am=function(n){return 0==n?this.a:this.b},MWn.em=function(){return 2},MWn.fm=function(n){return 3==this.b.e&&this.b.am(0)==this.a?this.a.fm(n)+"+":9==this.b.e&&this.b.am(0)==this.a?this.a.fm(n)+"+?":this.a.fm(n)+""+this.b.fm(n)},vX(ant,"RegEx/Token/ConcatToken",821),wAn(1822,117,ynt,jnn),MWn.am=function(n){if(0==n)return this.d;if(1==n)return this.b;throw Hp(new dy("Internal Error: "+n))},MWn.em=function(){return this.b?2:1},MWn.fm=function(n){var t;return t=this.c>0?"(?("+this.c+")":8==this.a.e?"(?("+this.a+")":"(?"+this.a,this.b?t+=this.d+"|"+this.b+")":t+=this.d+")",t},MWn.c=0,vX(ant,"RegEx/Token/ConditionToken",1822),wAn(1823,117,ynt,T0),MWn.am=function(n){return this.b},MWn.em=function(){return 1},MWn.fm=function(n){return"(?"+(0==this.a?"":txn(this.a))+(0==this.c?"":txn(this.c))+":"+this.b.fm(n)+")"},MWn.a=0,MWn.c=0,vX(ant,"RegEx/Token/ModifierToken",1823),wAn(822,117,ynt,cW),MWn.am=function(n){return this.a},MWn.em=function(){return 1},MWn.fm=function(n){var t;switch(t=null,this.e){case 6:t=0==this.b?"(?:"+this.a.fm(n)+")":"("+this.a.fm(n)+")";break;case 20:t="(?="+this.a.fm(n)+")";break;case 21:t="(?!"+this.a.fm(n)+")";break;case 22:t="(?<="+this.a.fm(n)+")";break;case 23:t="(?<!"+this.a.fm(n)+")";break;case 24:t="(?>"+this.a.fm(n)+")"}return t},MWn.b=0,vX(ant,"RegEx/Token/ParenToken",822),wAn(521,117,{3:1,117:1,521:1},vJ),MWn.bm=function(){return this.b},MWn.fm=function(n){return 12==this.e?"\\"+this.a:iAn(this.b)},MWn.a=0,vX(ant,"RegEx/Token/StringToken",521),wAn(465,117,ynt,r$),MWn.$l=function(n){tqn(this,n)},MWn.am=function(n){return BB(bW(this.a,n),117)},MWn.em=function(){return this.a?this.a.a.c.length:0},MWn.fm=function(n){var t,e,i,r,c;if(1==this.e){if(2==this.a.a.c.length)t=BB(bW(this.a,0),117),r=3==(e=BB(bW(this.a,1),117)).e&&e.am(0)==t?t.fm(n)+"+":9==e.e&&e.am(0)==t?t.fm(n)+"+?":t.fm(n)+""+e.fm(n);else{for(c=new Sk,i=0;i<this.a.a.c.length;i++)cO(c,BB(bW(this.a,i),117).fm(n));r=c.a}return r}if(2==this.a.a.c.length&&7==BB(bW(this.a,1),117).e)r=BB(bW(this.a,0),117).fm(n)+"?";else if(2==this.a.a.c.length&&7==BB(bW(this.a,0),117).e)r=BB(bW(this.a,1),117).fm(n)+"??";else{for(cO(c=new Sk,BB(bW(this.a,0),117).fm(n)),i=1;i<this.a.a.c.length;i++)c.a+="|",cO(c,BB(bW(this.a,i),117).fm(n));r=c.a}return r},vX(ant,"RegEx/Token/UnionToken",465),wAn(518,1,{592:1},UE),MWn.Ib=function(){return this.a.b},vX(knt,"XMLTypeUtil/PatternMatcherImpl",518),wAn(1622,1381,{},Rh),vX(knt,"XMLTypeValidator",1622),wAn(264,1,pVn,hz),MWn.Jc=function(n){e5(this,n)},MWn.Kc=function(){return(this.b-this.a)*this.c<0?MNt:new XL(this)},MWn.a=0,MWn.b=0,MWn.c=0,vX(Ent,"ExclusiveRange",264),wAn(1068,1,cVn,Kh),MWn.Rb=function(n){BB(n,19),l$()},MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return GE()},MWn.Ub=function(){return zE()},MWn.Wb=function(n){BB(n,19),w$()},MWn.Ob=function(){return!1},MWn.Sb=function(){return!1},MWn.Tb=function(){return-1},MWn.Vb=function(){return-1},MWn.Qb=function(){throw Hp(new tk(Snt))},vX(Ent,"ExclusiveRange/1",1068),wAn(254,1,cVn,XL),MWn.Rb=function(n){BB(n,19),b$()},MWn.Nb=function(n){fU(this,n)},MWn.Pb=function(){return Fhn(this)},MWn.Ub=function(){return O9(this)},MWn.Wb=function(n){BB(n,19),d$()},MWn.Ob=function(){return this.c.c<0?this.a>=this.c.b:this.a<=this.c.b},MWn.Sb=function(){return this.b>0},MWn.Tb=function(){return this.b},MWn.Vb=function(){return this.b-1},MWn.Qb=function(){throw Hp(new tk(Snt))},MWn.a=0,MWn.b=0,vX(Ent,"ExclusiveRange/RangeIterator",254);var ONt=RW(P9n,"C"),ANt=RW(O9n,"I"),$Nt=RW($Wn,"Z"),LNt=RW(A9n,"J"),NNt=RW(S9n,"B"),xNt=RW(C9n,"D"),DNt=RW(I9n,"F"),RNt=RW($9n,"S"),KNt=bq("org.eclipse.elk.core.labels","ILabelManager"),_Nt=bq(B6n,"DiagnosticChain"),FNt=bq(f7n,"ResourceSet"),BNt=vX(B6n,"InvocationTargetException",null),HNt=(Dk(),f5),qNt=qNt=hEn;Zen(Qp),scn("permProps",[[[Pnt,Cnt],[Int,"gecko1_8"]],[[Pnt,Cnt],[Int,"ie10"]],[[Pnt,Cnt],[Int,"ie8"]],[[Pnt,Cnt],[Int,"ie9"]],[[Pnt,Cnt],[Int,"safari"]]]),qNt(null,"elk",null)}).call(this)}).call(this,void 0!==e.g?e.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(n,t,e){"use strict";function i(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function r(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?n:t}function c(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}var a=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var c=Object.assign({},t),a=!1;try{n.resolve("web-worker"),a=!0}catch(s){}if(t.workerUrl)if(a){var u=n("web-worker");c.workerFactory=function(n){return new u(n)}}else console.warn("Web worker requested but 'web-worker' package not installed. \nConsider installing the package or pass your own 'workerFactory' to ELK's constructor.\n... Falling back to non-web worker version.");if(!c.workerFactory){var o=n("./elk-worker.min.js").Worker;c.workerFactory=function(n){return new o(n)}}return r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c))}return c(e,t),e}(n("./elk-api.js").default);Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports=a,a.default=a},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(n,t,e){t.exports=Worker},{}]},{},[3])(3)},64178:(n,t,e)=>{"use strict";e.d(t,{diagram:()=>k});var i=e(90829),r=e(5949),c=e(96157),a=e(26746),u=e.n(a);e(27693),e(7608),e(31699),e(86161),e(88472),e(76576),e(77567),e(57635),e(69746),e(79580);const o=new(u()),s={},h={};let f={};const l=(n,t,e)=>{const r={TB:{in:{north:"north"},out:{south:"west",west:"east",east:"south"}},LR:{in:{west:"west"},out:{east:"south",south:"north",north:"east"}},RL:{in:{east:"east"},out:{west:"north",north:"south",south:"west"}},BT:{in:{south:"south"},out:{north:"east",east:"west",west:"north"}}};return r.TD=r.TB,i.l.info("abc88",e,t,n),r[e][t][n]},b=(n,t,e)=>{if(i.l.info("getNextPort abc88",{node:n,edgeDirection:t,graphDirection:e}),!s[n])switch(e){case"TB":case"TD":s[n]={inPosition:"north",outPosition:"south"};break;case"BT":s[n]={inPosition:"south",outPosition:"north"};break;case"RL":s[n]={inPosition:"east",outPosition:"west"};break;case"LR":s[n]={inPosition:"west",outPosition:"east"}}const r="in"===t?s[n].inPosition:s[n].outPosition;return"in"===t?s[n].inPosition=l(s[n].inPosition,t,e):s[n].outPosition=l(s[n].outPosition,t,e),r},w=function(n,t,e,c){i.l.info("abc78 edges = ",n);const a=c.insert("g").attr("class","edgeLabels");let u,o,s={},l=t.db.getDirection();if(void 0!==n.defaultStyle){const t=(0,i.a)(n.defaultStyle);u=t.style,o=t.labelStyle}return n.forEach((function(t){var c="L-"+t.start+"-"+t.end;void 0===s[c]?(s[c]=0,i.l.info("abc78 new entry",c,s[c])):(s[c]++,i.l.info("abc78 new entry",c,s[c]));let w=c+"-"+s[c];i.l.info("abc78 new link id to be used is",c,w,s[c]);var d="LS-"+t.start,g="LE-"+t.end;const p={style:"",labelStyle:""};switch(p.minlen=t.length||1,"arrow_open"===t.type?p.arrowhead="none":p.arrowhead="normal",p.arrowTypeStart="arrow_open",p.arrowTypeEnd="arrow_open",t.type){case"double_arrow_cross":p.arrowTypeStart="arrow_cross";case"arrow_cross":p.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":p.arrowTypeStart="arrow_point";case"arrow_point":p.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":p.arrowTypeStart="arrow_circle";case"arrow_circle":p.arrowTypeEnd="arrow_circle"}let v="",m="";switch(t.stroke){case"normal":v="fill:none;",void 0!==u&&(v=u),void 0!==o&&(m=o),p.thickness="normal",p.pattern="solid";break;case"dotted":p.thickness="normal",p.pattern="dotted",p.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":p.thickness="thick",p.pattern="solid",p.style="stroke-width: 3.5px;fill:none;"}if(void 0!==t.style){const n=(0,i.a)(t.style);v=n.style,m=n.labelStyle}p.style=p.style+=v,p.labelStyle=p.labelStyle+=m,void 0!==t.interpolate?p.curve=(0,i.d)(t.interpolate,r.c_6):void 0!==n.defaultInterpolate?p.curve=(0,i.d)(n.defaultInterpolate,r.c_6):p.curve=(0,i.d)(h.curve,r.c_6),void 0===t.text?void 0!==t.style&&(p.arrowheadStyle="fill: #333"):(p.arrowheadStyle="fill: #333",p.labelpos="c"),p.labelType="text",p.label=t.text.replace(i.c.lineBreakRegex,"\n"),void 0===t.style&&(p.style=p.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),p.labelStyle=p.labelStyle.replace("color:","fill:"),p.id=w,p.classes="flowchart-link "+d+" "+g;const y=(0,i.f)(a,p),{source:k,target:j}=((n,t)=>{let e=n.start,i=n.end;const r=f[e],c=f[i];return r&&c?("diamond"===r.type&&(e=`${e}-${b(e,"out",t)}`),"diamond"===c.type&&(i=`${i}-${b(i,"in",t)}`),{source:e,target:i}):{source:e,target:i}})(t,l);i.l.debug("abc78 source and target",k,j),e.edges.push({id:"e"+t.start+t.end,sources:[k],targets:[j],labelEl:y,labels:[{width:p.width,height:p.height,orgWidth:p.width,orgHeight:p.height,text:p.label,layoutOptions:{"edgeLabels.inline":"true","edgeLabels.placement":"CENTER"}}],edgeData:p})})),e},d=function(n,t,e){const i=((n,t,e)=>{const{parentById:i}=e,r=new Set;let c=n;for(;c;){if(r.add(c),c===t)return c;c=i[c]}for(c=t;c;){if(r.has(c))return c;c=i[c]}return"root"})(n,t,e);if(void 0===i||"root"===i)return{x:0,y:0};const r=f[i].offset;return{x:r.posX,y:r.posY}},g=function(n,t,e,i,c){const a=d(t.sources[0],t.targets[0],c),u=t.sections[0].startPoint,o=t.sections[0].endPoint,s=(t.sections[0].bendPoints?t.sections[0].bendPoints:[]).map((n=>[n.x+a.x,n.y+a.y])),h=[[u.x+a.x,u.y+a.y],...s,[o.x+a.x,o.y+a.y]],f=(0,r.jvg)().curve(r.c_6),l=n.insert("path").attr("d",f(h)).attr("class","path").attr("fill","none"),b=n.insert("g").attr("class","edgeLabel"),w=(0,r.Ys)(b.node().appendChild(t.labelEl)),g=w.node().firstChild.getBoundingClientRect();w.attr("width",g.width),w.attr("height",g.height),b.attr("transform",`translate(${t.labels[0].x+a.x}, ${t.labels[0].y+a.y})`),function(n,t,e,i){let r="";switch(i&&(r=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,r=r.replace(/\(/g,"\\("),r=r.replace(/\)/g,"\\)")),t.arrowTypeStart){case"arrow_cross":n.attr("marker-start","url("+r+"#"+e+"-crossStart)");break;case"arrow_point":n.attr("marker-start","url("+r+"#"+e+"-pointStart)");break;case"arrow_barb":n.attr("marker-start","url("+r+"#"+e+"-barbStart)");break;case"arrow_circle":n.attr("marker-start","url("+r+"#"+e+"-circleStart)");break;case"aggregation":n.attr("marker-start","url("+r+"#"+e+"-aggregationStart)");break;case"extension":n.attr("marker-start","url("+r+"#"+e+"-extensionStart)");break;case"composition":n.attr("marker-start","url("+r+"#"+e+"-compositionStart)");break;case"dependency":n.attr("marker-start","url("+r+"#"+e+"-dependencyStart)");break;case"lollipop":n.attr("marker-start","url("+r+"#"+e+"-lollipopStart)")}switch(t.arrowTypeEnd){case"arrow_cross":n.attr("marker-end","url("+r+"#"+e+"-crossEnd)");break;case"arrow_point":n.attr("marker-end","url("+r+"#"+e+"-pointEnd)");break;case"arrow_barb":n.attr("marker-end","url("+r+"#"+e+"-barbEnd)");break;case"arrow_circle":n.attr("marker-end","url("+r+"#"+e+"-circleEnd)");break;case"aggregation":n.attr("marker-end","url("+r+"#"+e+"-aggregationEnd)");break;case"extension":n.attr("marker-end","url("+r+"#"+e+"-extensionEnd)");break;case"composition":n.attr("marker-end","url("+r+"#"+e+"-compositionEnd)");break;case"dependency":n.attr("marker-end","url("+r+"#"+e+"-dependencyEnd)");break;case"lollipop":n.attr("marker-end","url("+r+"#"+e+"-lollipopEnd)")}}(l,e,i.type,i.arrowMarkerAbsolute)},p=(n,t)=>{n.forEach((n=>{n.children||(n.children=[]);const e=t.childrenById[n.id];e&&e.forEach((t=>{n.children.push(f[t])})),p(n.children,t)}))},v=(n,t,e,r,c,a,u)=>{e.forEach((function(e){if(e)if(f[e.id].offset={posX:e.x+n,posY:e.y+t,x:n,y:t,depth:u,width:e.width,height:e.height},"group"===e.type){const r=c.insert("g").attr("class","subgraph");r.insert("rect").attr("class","subgraph subgraph-lvl-"+u%5+" node").attr("x",e.x+n).attr("y",e.y+t).attr("width",e.width).attr("height",e.height);const a=r.insert("g").attr("class","label");a.attr("transform",`translate(${e.labels[0].x+n+e.x}, ${e.labels[0].y+t+e.y})`),a.node().appendChild(e.labelData.labelNode),i.l.info("Id (UGH)= ",e.type,e.labels)}else i.l.info("Id (UGH)= ",e.id),e.el.attr("transform",`translate(${e.x+n+e.width/2}, ${e.y+t+e.height/2})`)})),e.forEach((function(e){e&&"group"===e.type&&v(n+e.x,t+e.y,e.children,r,c,a,u+1)}))},m={getClasses:function(n,t){i.l.info("Extracting classes"),t.db.clear("ver-2");try{return t.parse(n),t.db.getClasses()}catch(e){return{}}},draw:async function(n,t,e,a){var u;a.db.clear(),f={},a.db.setGen("gen-2"),a.parser.parse(n);const s=(0,r.Ys)("body").append("div").attr("style","height:400px").attr("id","cy");let h={id:"root",layoutOptions:{"elk.hierarchyHandling":"INCLUDE_CHILDREN","org.eclipse.elk.padding":"[top=100, left=100, bottom=110, right=110]","elk.layered.spacing.edgeNodeBetweenLayers":"30","elk.direction":"DOWN"},children:[],edges:[]};switch(i.l.info("Drawing flowchart using v3 renderer",o),a.db.getDirection()){case"BT":h.layoutOptions["elk.direction"]="UP";break;case"TB":h.layoutOptions["elk.direction"]="DOWN";break;case"LR":h.layoutOptions["elk.direction"]="RIGHT";break;case"RL":h.layoutOptions["elk.direction"]="LEFT"}const{securityLevel:l,flowchart:b}=(0,i.g)();let d;"sandbox"===l&&(d=(0,r.Ys)("#i"+t));const m="sandbox"===l?(0,r.Ys)(d.nodes()[0].contentDocument.body):(0,r.Ys)("body"),y="sandbox"===l?d.nodes()[0].contentDocument:document,k=m.select(`[id="${t}"]`);(0,i.i)(k,["point","circle","cross"],a.type,a.arrowMarkerAbsolute);const j=a.db.getVertices();let E;const T=a.db.getSubGraphs();i.l.info("Subgraphs - ",T);for(let i=T.length-1;i>=0;i--)E=T[i],a.db.addVertex(E.id,E.title,"group",void 0,E.classes,E.dir);const M=k.insert("g").attr("class","subgraphs"),S=function(n){const t={parentById:{},childrenById:{}},e=n.getSubGraphs();return i.l.info("Subgraphs - ",e),e.forEach((function(n){n.nodes.forEach((function(e){t.parentById[e]=n.id,void 0===t.childrenById[n.id]&&(t.childrenById[n.id]=[]),t.childrenById[n.id].push(e)}))})),e.forEach((function(n){n.id,void 0!==t.parentById[n.id]&&t.parentById[n.id]})),t}(a.db);h=function(n,t,e,r,a,u,o){const s=e.select(`[id="${t}"]`),h=s.insert("g").attr("class","nodes");return Object.keys(n).forEach((function(t){const e=n[t];let o="default";e.classes.length>0&&(o=e.classes.join(" "));const l=(0,i.a)(e.styles);let b,w=void 0!==e.text?e.text:e.id;const d={width:0,height:0};if((0,i.e)((0,i.g)().flowchart.htmlLabels)){const n={label:w.replace(/fa[blrs]?:fa-[\w-]+/g,(n=>`<i class='${n.replace(":"," ")}'></i>`))};b=(0,c.a)(s,n).node();const t=b.getBBox();d.width=t.width,d.height=t.height,d.labelNode=b,b.parentNode.removeChild(b)}else{const n=r.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("style",l.labelStyle.replace("color:","fill:"));const t=w.split(i.c.lineBreakRegex);for(const i of t){const t=r.createElementNS("http://www.w3.org/2000/svg","tspan");t.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),t.setAttribute("dy","1em"),t.setAttribute("x","1"),t.textContent=i,n.appendChild(t)}b=n;const e=b.getBBox();d.width=e.width,d.height=e.height,d.labelNode=b}const g=[{id:e.id+"-west",layoutOptions:{"port.side":"WEST"}},{id:e.id+"-east",layoutOptions:{"port.side":"EAST"}},{id:e.id+"-south",layoutOptions:{"port.side":"SOUTH"}},{id:e.id+"-north",layoutOptions:{"port.side":"NORTH"}}];let p=0,v="",m={};switch(e.type){case"round":p=5,v="rect";break;case"square":case"group":default:v="rect";break;case"diamond":v="question",m={portConstraints:"FIXED_SIDE"};break;case"hexagon":v="hexagon";break;case"odd":case"odd_right":v="rect_left_inv_arrow";break;case"lean_right":v="lean_right";break;case"lean_left":v="lean_left";break;case"trapezoid":v="trapezoid";break;case"inv_trapezoid":v="inv_trapezoid";break;case"circle":v="circle";break;case"ellipse":v="ellipse";break;case"stadium":v="stadium";break;case"subroutine":v="subroutine";break;case"cylinder":v="cylinder";break;case"doublecircle":v="doublecircle"}const y={labelStyle:l.labelStyle,shape:v,labelText:w,rx:p,ry:p,class:o,style:l.style,id:e.id,link:e.link,linkTarget:e.linkTarget,tooltip:a.db.getTooltip(e.id)||"",domId:a.db.lookUpDomId(e.id),haveCallback:e.haveCallback,width:"group"===e.type?500:void 0,dir:e.dir,type:e.type,props:e.props,padding:(0,i.g)().flowchart.padding};let k,j;"group"!==y.type&&(j=(0,i.b)(h,y,e.dir),k=j.node().getBBox());const E={id:e.id,ports:"diamond"===e.type?g:[],layoutOptions:m,labelText:w,labelData:d,domId:a.db.lookUpDomId(e.id),width:null==k?void 0:k.width,height:null==k?void 0:k.height,type:e.type,el:j,parent:u.parentById[e.id]};f[y.id]=E})),o}(j,t,m,y,a,S,h);const P=k.insert("g").attr("class","edges edgePath"),C=a.db.getEdges();h=w(C,a,h,k);Object.keys(f).forEach((n=>{const t=f[n];t.parent||h.children.push(t),void 0!==S.childrenById[n]&&(t.labels=[{text:t.labelText,layoutOptions:{"nodeLabels.placement":"[H_CENTER, V_TOP, INSIDE]"},width:t.labelData.width,height:t.labelData.height}],delete t.x,delete t.y,delete t.width,delete t.height)})),p(h.children,S),i.l.info("after layout",JSON.stringify(h,null,2));const I=await o.layout(h);v(0,0,I.children,k,M,a,0),i.l.info("after layout",I),null==(u=I.edges)||u.map((n=>{g(P,n,n.edgeData,a,S)})),(0,i.s)({},k,b.diagramPadding,b.useMaxWidth),s.remove()}},y=n=>`.label {\n font-family: ${n.fontFamily};\n color: ${n.nodeTextColor||n.textColor};\n }\n .cluster-label text {\n fill: ${n.titleColor};\n }\n .cluster-label span {\n color: ${n.titleColor};\n }\n\n .label text,span {\n fill: ${n.nodeTextColor||n.textColor};\n color: ${n.nodeTextColor||n.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${n.mainBkg};\n stroke: ${n.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${n.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${n.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${n.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${n.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${n.edgeLabelBackground};\n fill: ${n.edgeLabelBackground};\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ${n.clusterBkg};\n stroke: ${n.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${n.titleColor};\n }\n\n .cluster span {\n color: ${n.titleColor};\n }\n /* .cluster div {\n color: ${n.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${n.fontFamily};\n font-size: 12px;\n background: ${n.tertiaryColor};\n border: 1px solid ${n.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${n.textColor};\n }\n .subgraph {\n stroke-width:2;\n rx:3;\n }\n // .subgraph-lvl-1 {\n // fill:#ccc;\n // // stroke:black;\n // }\n ${(n=>{let t="";for(let e=0;e<5;e++)t+=`\n .subgraph-lvl-${e} {\n fill: ${n[`surface${e}`]};\n stroke: ${n[`surfacePeer${e}`]};\n }\n `;return t})(n)}\n`,k={db:i.h,renderer:m,parser:i.p,styles:y}}}]); \ No newline at end of file diff --git a/assets/js/41c96264.2d96b2a7.js b/assets/js/41c96264.2d96b2a7.js new file mode 100644 index 00000000000..ffa51fd58de --- /dev/null +++ b/assets/js/41c96264.2d96b2a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8885],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>v});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,v=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(v,i(i({ref:t},c),{},{components:n})):a.createElement(v,i({ref:t},c))}));function v(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:r,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},76663:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(25773),r=(n(27378),n(35318));const o={title:"Development Gateway",sidebar_position:1e3,description:"Learn how to use the DeviceScript cloud agnostic API to send and receive JSON messages, connect to the Development Gateway, and utilize application telemetry and message queues.",keywords:["DeviceScript","cloud API","JSON messages","Development Gateway","application telemetry"]},i="Development Gateway",l={unversionedId:"developer/development-gateway/index",id:"developer/development-gateway/index",title:"Development Gateway",description:"Learn how to use the DeviceScript cloud agnostic API to send and receive JSON messages, connect to the Development Gateway, and utilize application telemetry and message queues.",source:"@site/docs/developer/development-gateway/index.mdx",sourceDirName:"developer/development-gateway",slug:"/developer/development-gateway/",permalink:"/devicescript/developer/development-gateway/",draft:!1,tags:[],version:"current",sidebarPosition:1e3,frontMatter:{title:"Development Gateway",sidebar_position:1e3,description:"Learn how to use the DeviceScript cloud agnostic API to send and receive JSON messages, connect to the Development Gateway, and utilize application telemetry and message queues.",keywords:["DeviceScript","cloud API","JSON messages","Development Gateway","application telemetry"]},sidebar:"tutorialSidebar",previous:{title:"Cryptography",permalink:"/devicescript/developer/crypto"},next:{title:"Messages",permalink:"/devicescript/developer/development-gateway/messages"}},p={},s=[{value:"Usage",id:"usage",level:2},{value:"Development Gateway",id:"development-gateway-1",level:2},{value:"View in Visual Studio Code",id:"view-in-visual-studio-code",level:2}],c={toc:s},d="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"development-gateway"},"Development Gateway"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@devicescript/cloud")," ",(0,r.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," provides a cloud agnostic device to cloud API\nthat allows to send and receive small JSON messages to an online gateway.\nThe gateway can route the messages into any further cloud service."),(0,r.kt)("p",null,"As a proof of concept, DeviceScript can be connected to the Development Gateway."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This API is only supported on ESP32 devices currently.")),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/developer/development-gateway/telemetry"},"Application Telemetry"),", track application usage and errors"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/developer/development-gateway/messages"},"Message queues"),", upload and subscribe to message queues")),(0,r.kt)("h2",{id:"development-gateway-1"},"Development Gateway"),(0,r.kt)("p",null,"This package relies on a prototype Development Gateway that needs to be deployed prior to using it."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/developer/development-gateway/gateway"},"Development Gateway"))),(0,r.kt)("h2",{id:"view-in-visual-studio-code"},"View in Visual Studio Code"),(0,r.kt)("p",null,"The view is hidden by default and needs to be show once. Click on ",(0,r.kt)("strong",{parentName:"p"},"View"),", ",(0,r.kt)("strong",{parentName:"p"},"Open View...")," and selet\n",(0,r.kt)("strong",{parentName:"p"},"Development Gateway")," under ",(0,r.kt)("strong",{parentName:"p"},"DeviceScript"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4258b118.7bb45cb2.js b/assets/js/4258b118.7bb45cb2.js new file mode 100644 index 00000000000..a192c5128b8 --- /dev/null +++ b/assets/js/4258b118.7bb45cb2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2139],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),u=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(c.Provider,{value:t},e.children)},l="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),l=u(r),m=o,f=l["".concat(c,".").concat(m)]||l[m]||d[m]||i;return r?n.createElement(f,a(a({ref:t},p),{},{components:r})):n.createElement(f,a({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[l]="string"==typeof e?e:o,a[1]=s;for(var u=2;u<i;u++)a[u]=r[u];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},15081:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(25773),o=(r(27378),r(35318));const i={description:"Mounts a HID mouse server",title:"HID Mouse"},a="HID Mouse",s={unversionedId:"api/drivers/hidmouse",id:"api/drivers/hidmouse",title:"HID Mouse",description:"Mounts a HID mouse server",source:"@site/docs/api/drivers/hidmouse.md",sourceDirName:"api/drivers",slug:"/api/drivers/hidmouse",permalink:"/devicescript/api/drivers/hidmouse",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a HID mouse server",title:"HID Mouse"},sidebar:"tutorialSidebar",previous:{title:"HID Keyboard",permalink:"/devicescript/api/drivers/hidkeyboard"},next:{title:"Light bulb",permalink:"/devicescript/api/drivers/lightbulb"}},c={},u=[],p={toc:u},l="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(l,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"hid-mouse"},"HID Mouse"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startHidMouse")," function starts a ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/hidmouse"},"relay")," server on the device\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/hidmouse"},"client"),"."),(0,o.kt)("p",null,"The server emulates a mouse and can be used to send mouse movement, wheel or clicksF to a computer."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { startHidMouse } from "@devicescript/servers"\n\nconst mouse = startHidMouse({})\n')),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"mouse"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/42ad4eab.5a9c16ce.js b/assets/js/42ad4eab.5a9c16ce.js new file mode 100644 index 00000000000..5b71cad3b43 --- /dev/null +++ b/assets/js/42ad4eab.5a9c16ce.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7228],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var i=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},c=Object.keys(e);for(i=0;i<c.length;i++)r=c[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;i<c.length;i++)r=c[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var a=i.createContext({}),p=function(e){var t=i.useContext(a),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=p(e.components);return i.createElement(a.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,c=e.originalType,a=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=n,f=d["".concat(a,".").concat(m)]||d[m]||u[m]||c;return r?i.createElement(f,o(o({ref:t},l),{},{components:r})):i.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var c=r.length,o=new Array(c);o[0]=m;var s={};for(var a in t)hasOwnProperty.call(t,a)&&(s[a]=t[a]);s.originalType=e,s[d]="string"==typeof e?e:n,o[1]=s;for(var p=2;p<c;p++)o[p]=r[p];return i.createElement.apply(null,o)}return i.createElement.apply(null,r)}m.displayName="MDXCreateElement"},18644:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>c,metadata:()=>s,toc:()=>p});var i=r(25773),n=(r(27378),r(35318));const c={title:"Pico Bricks"},o="Pico Bricks",s={unversionedId:"devices/shields/pico-bricks",id:"devices/shields/pico-bricks",title:"Pico Bricks",description:"- Device: Raspberry Pi Pico W",source:"@site/docs/devices/shields/pico-bricks.mdx",sourceDirName:"devices/shields",slug:"/devices/shields/pico-bricks",permalink:"/devicescript/devices/shields/pico-bricks",draft:!1,tags:[],version:"current",frontMatter:{title:"Pico Bricks"},sidebar:"tutorialSidebar",previous:{title:"Shields",permalink:"/devicescript/devices/shields/"},next:{title:"Pimoroni Badger RP2040",permalink:"/devicescript/devices/shields/pimoroni-pico-badger"}},a={},p=[{value:"DeviceScript import",id:"devicescript-import",level:2}],l={toc:p},d="wrapper";function u(e){let{components:t,...c}=e;return(0,n.kt)(d,(0,i.Z)({},l,c,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"pico-bricks"},"Pico Bricks"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Device: ",(0,n.kt)("a",{parentName:"li",href:"/devices/rp2040/pico-w"},"Raspberry Pi Pico W")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://picobricks.com/"},"Home"))),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"PicoBricks image",src:r(7683).Z,width:"680",height:"520"})),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must import ",(0,n.kt)("inlineCode",{parentName:"p"},"PicoBricks")," to access the shield services."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "PicoBricks".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { PicoBricks } from "@devicescript/drivers"\nconst shield = new PicoBricks()\n\nconst motor1 = shield.startMotor1()\n')))}u.isMDXComponent=!0},7683:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/pico-bricks-9426bc01d401be67e5c8c356abb07848.jpg"}}]); \ No newline at end of file diff --git a/assets/js/437cc37c.fc0944e7.js b/assets/js/437cc37c.fc0944e7.js new file mode 100644 index 00000000000..ca1000b568d --- /dev/null +++ b/assets/js/437cc37c.fc0944e7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7609],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(n),m=a,k=c["".concat(p,".").concat(m)]||c[m]||d[m]||i;return n?r.createElement(k,o(o({ref:t},u),{},{components:n})):r.createElement(k,o({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:a,o[1]=l;for(var s=2;s<i;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},37440:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Button service"},o="Button",l={unversionedId:"api/clients/button",id:"api/clients/button",title:"Button",description:"DeviceScript client for Button service",source:"@site/docs/api/clients/button.md",sourceDirName:"api/clients",slug:"/api/clients/button",permalink:"/devicescript/api/clients/button",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Button service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"analog",id:"const:analog",level:3},{value:"pressed",id:"ro:pressed",level:3},{value:"Events",id:"events",level:2},{value:"down",id:"down",level:3},{value:"up",id:"up",level:3},{value:"hold",id:"hold",level:3}],u={toc:s},c="wrapper";function d(e){let{components:t,...n}=e;return(0,a.kt)(c,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"button"},"Button"),(0,a.kt)("p",null,"A push-button, which returns to inactive position when not operated anymore."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\n\nconst button = new Button()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Indicates the pressure state of the button, where ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," is open."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\n\nconst button = new Button()\n// ...\nconst value = await button.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\n\nconst button = new Button()\n// ...\nbutton.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:analog"},"analog"),(0,a.kt)("p",null,"Indicates if the button provides analog ",(0,a.kt)("inlineCode",{parentName:"p"},"pressure")," readings."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Button } from "@devicescript/core"\n\nconst button = new Button()\n// ...\nconst value = await button.analog.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:pressed"},"pressed"),(0,a.kt)("p",null,"Determines if the button is pressed currently."),(0,a.kt)("p",null,"If the event ",(0,a.kt)("inlineCode",{parentName:"p"},"down")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"hold")," is observed, ",(0,a.kt)("inlineCode",{parentName:"p"},"pressed")," becomes true; if ",(0,a.kt)("inlineCode",{parentName:"p"},"up")," is observed, ",(0,a.kt)("inlineCode",{parentName:"p"},"pressed")," becomes false.\nThe client should initialize ",(0,a.kt)("inlineCode",{parentName:"p"},"pressed")," to false."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Button } from "@devicescript/core"\n\nconst button = new Button()\n// ...\nconst value = await button.pressed.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Button } from "@devicescript/core"\n\nconst button = new Button()\n// ...\nbutton.pressed.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h2",{id:"events"},"Events"),(0,a.kt)("h3",{id:"down"},"down"),(0,a.kt)("p",null,"Emitted when button goes from inactive to active."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"button.down.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"up"},"up"),(0,a.kt)("p",null,"Emitted when button goes from active to inactive. The 'time' parameter\nrecords the amount of time between the down and up events."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"button.up.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"hold"},"hold"),(0,a.kt)("p",null,"Emitted when the press time is greater than 500ms, and then at least every 500ms\nas long as the button remains pressed. The 'time' parameter records the the amount of time\nthat the button has been held (since the down event)."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"button.hold.subscribe(() => {\n\n})\n")),(0,a.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/43d8caec.91f72ecc.js b/assets/js/43d8caec.91f72ecc.js new file mode 100644 index 00000000000..dd0a93b3219 --- /dev/null +++ b/assets/js/43d8caec.91f72ecc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9020],{35318:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>y});var r=t(27378);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},c=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,y=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?r.createElement(y,l(l({ref:n},c),{},{components:t})):r.createElement(y,l({ref:n},c))}));function y(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,l=new Array(i);l[0]=m;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[u]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<i;s++)l[s]=t[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}m.displayName="MDXCreateElement"},79198:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var r=t(25773),a=(t(27378),t(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound player service"},l="SoundPlayer",o={unversionedId:"api/clients/soundplayer",id:"api/clients/soundplayer",title:"SoundPlayer",description:"DeviceScript client for Sound player service",source:"@site/docs/api/clients/soundplayer.md",sourceDirName:"api/clients",slug:"/api/clients/soundplayer",permalink:"/devicescript/api/clients/soundplayer",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound player service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Commands",id:"commands",level:2},{value:"play",id:"play",level:3},{value:"cancel",id:"cancel",level:3},{value:"Registers",id:"registers",level:2},{value:"intensity",id:"rw:intensity",level:3}],c={toc:s},u="wrapper";function d(e){let{components:n,...t}=e;return(0,a.kt)(u,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"soundplayer"},"SoundPlayer"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A device that can play various sounds stored locally. This service is typically paired with a ",(0,a.kt)("inlineCode",{parentName:"p"},"storage")," service for storing sounds."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoundPlayer } from "@devicescript/core"\n\nconst soundPlayer = new SoundPlayer()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"play"},"play"),(0,a.kt)("p",null,"Starts playing a sound."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundPlayer.play(name: string): Promise<void>\n")),(0,a.kt)("h3",{id:"cancel"},"cancel"),(0,a.kt)("p",null,"Cancel any sound playing."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundPlayer.cancel(): Promise<void>\n")),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:intensity"},"intensity"),(0,a.kt)("p",null,"Global volume of the output. ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," means completely off. This volume is mixed with each play volumes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundPlayer } from "@devicescript/core"\n\nconst soundPlayer = new SoundPlayer()\n// ...\nconst value = await soundPlayer.intensity.read()\nawait soundPlayer.intensity.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundPlayer } from "@devicescript/core"\n\nconst soundPlayer = new SoundPlayer()\n// ...\nsoundPlayer.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/44d3e5f5.8a750fb2.js b/assets/js/44d3e5f5.8a750fb2.js new file mode 100644 index 00000000000..cc5b2098d3c --- /dev/null +++ b/assets/js/44d3e5f5.8a750fb2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1409],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},k=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),k=r,m=u["".concat(s,".").concat(k)]||u[k]||d[k]||a;return n?i.createElement(m,o(o({ref:t},c),{},{components:n})):i.createElement(m,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,o=new Array(a);o[0]=k;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:r,o[1]=l;for(var p=2;p<a;p++)o[p]=n[p];return i.createElement.apply(null,o)}return i.createElement.apply(null,n)}k.displayName="MDXCreateElement"},86802:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var i=n(25773),r=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for HID Joystick service"},o="HidJoystick",l={unversionedId:"api/clients/hidjoystick",id:"api/clients/hidjoystick",title:"HidJoystick",description:"DeviceScript client for HID Joystick service",source:"@site/docs/api/clients/hidjoystick.md",sourceDirName:"api/clients",slug:"/api/clients/hidjoystick",permalink:"/devicescript/api/clients/hidjoystick",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for HID Joystick service"},sidebar:"tutorialSidebar"},s={},p=[{value:"Commands",id:"commands",level:2},{value:"setButtons",id:"setbuttons",level:3},{value:"setAxis",id:"setaxis",level:3},{value:"Registers",id:"registers",level:2},{value:"buttonCount",id:"const:buttonCount",level:3},{value:"buttonsAnalog",id:"const:buttonsAnalog",level:3},{value:"axisCount",id:"const:axisCount",level:3}],c={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,r.kt)(u,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"hidjoystick"},"HidJoystick"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"Controls a HID joystick."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { HidJoystick } from "@devicescript/core"\n\nconst hidJoystick = new HidJoystick()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"setbuttons"},"setButtons"),(0,r.kt)("p",null,"Sets the up/down button state, one byte per button, supports analog buttons. For digital buttons, use ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," for released, ",(0,r.kt)("inlineCode",{parentName:"p"},"1")," for pressed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"hidJoystick.setButtons(...pressure: number[]): Promise<void>\n")),(0,r.kt)("h3",{id:"setaxis"},"setAxis"),(0,r.kt)("p",null,"Sets the state of analog inputs."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"hidJoystick.setAxis(...position: number[]): Promise<void>\n")),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"const:buttonCount"},"buttonCount"),(0,r.kt)("p",null,"Number of button report supported"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HidJoystick } from "@devicescript/core"\n\nconst hidJoystick = new HidJoystick()\n// ...\nconst value = await hidJoystick.buttonCount.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:buttonsAnalog"},"buttonsAnalog"),(0,r.kt)("p",null,"A bitset that indicates which button is analog."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HidJoystick } from "@devicescript/core"\n\nconst hidJoystick = new HidJoystick()\n// ...\nconst value = await hidJoystick.buttonsAnalog.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:axisCount"},"axisCount"),(0,r.kt)("p",null,"Number of analog input supported"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HidJoystick } from "@devicescript/core"\n\nconst hidJoystick = new HidJoystick()\n// ...\nconst value = await hidJoystick.axisCount.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4612ab74.279acea7.js b/assets/js/4612ab74.279acea7.js new file mode 100644 index 00000000000..1670bc4c753 --- /dev/null +++ b/assets/js/4612ab74.279acea7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7641],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=l(r),y=i,d=u["".concat(s,".").concat(y)]||u[y]||f[y]||a;return r?n.createElement(d,o(o({ref:t},p),{},{components:r})):n.createElement(d,o({ref:t},p))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=y;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[u]="string"==typeof e?e:i,o[1]=c;for(var l=2;l<a;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},88778:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>f,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,unlisted:!0},o="Wssk",c={unversionedId:"api/clients/wssk",id:"api/clients/wssk",title:"Wssk",description:"The WSSK service is used internally by the runtime",source:"@site/docs/api/clients/wssk.md",sourceDirName:"api/clients",slug:"/api/clients/wssk",permalink:"/devicescript/api/clients/wssk",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},s={},l=[],p={toc:l},u="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"wssk"},"Wssk"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/wssk/"},"WSSK service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4670.275fd1d9.js b/assets/js/4670.275fd1d9.js new file mode 100644 index 00000000000..153779e9b83 --- /dev/null +++ b/assets/js/4670.275fd1d9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4670],{34670:(e,s,b)=>{b.r(s)}}]); \ No newline at end of file diff --git a/assets/js/49a92887.8f3bf6ab.js b/assets/js/49a92887.8f3bf6ab.js new file mode 100644 index 00000000000..ebf1fa2f27b --- /dev/null +++ b/assets/js/49a92887.8f3bf6ab.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5875],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),l=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),p=l(n),m=i,f=p["".concat(s,".").concat(m)]||p[m]||u[m]||r;return n?a.createElement(f,o(o({ref:t},d),{},{components:n})):a.createElement(f,o({ref:t},d))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:i,o[1]=c;for(var l=2;l<r;l++)o[l]=n[l];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},2002:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>l});var a=n(25773),i=(n(27378),n(35318));const r={description:"Learn how to create a new board configuration in DeviceScript for supported chipset architectures.",sidebar_position:10,keywords:["DeviceScript","board configuration","Visual Studio Code","command line","flash firmware"]},o="Add Board",c={unversionedId:"devices/add-board",id:"devices/add-board",title:"Add Board",description:"Learn how to create a new board configuration in DeviceScript for supported chipset architectures.",source:"@site/docs/devices/add-board.mdx",sourceDirName:"devices",slug:"/devices/add-board",permalink:"/devicescript/devices/add-board",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{description:"Learn how to create a new board configuration in DeviceScript for supported chipset architectures.",sidebar_position:10,keywords:["DeviceScript","board configuration","Visual Studio Code","command line","flash firmware"]},sidebar:"tutorialSidebar",previous:{title:"Xiao ESP32-C3 Expansion Board",permalink:"/devicescript/devices/shields/xiao-expansion-board"},next:{title:"Add SoC/MCU",permalink:"/devicescript/devices/add-soc"}},s={},l=[{value:"How to create a new board configuration",id:"how-to-create-a-new-board-configuration",level:2},{value:"Create the new <code>board.json</code> file",id:"create-the-new-boardjson-file",level:3},{value:"Editing the generated Device configuration (.json) file",id:"editing-the-generated-device-configuration-json-file",level:3},{value:"Services",id:"services",level:4},{value:"Flash the new configuration",id:"flash-the-new-configuration",level:3},{value:"Contributing",id:"contributing",level:2}],d={toc:l},p="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(p,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"add-board"},"Add Board"),(0,i.kt)("p",null,"In DeviceScript, we commonly refere a Device Configuration as a ",(0,i.kt)("inlineCode",{parentName:"p"},"board"),".\nYou can see examples of configuration in each device page (",(0,i.kt)("a",{parentName:"p",href:"/devices/esp32/seeed-xiao-esp32c3#configuration"},"like this one"),")"),(0,i.kt)("p",null,"If your device is already using a supported system-on-a-chip (SoC) or MCU (ESP32, RP2040, ...),\nyou can create a new ",(0,i.kt)("inlineCode",{parentName:"p"},"board")," configuration in your project to support it in DeviceScript.\nYou do ",(0,i.kt)("strong",{parentName:"p"},"not")," need to build a new firmware."),(0,i.kt)("p",null,"If you want to add a new system-on-a-chip (SoC), ",(0,i.kt)("a",{parentName:"p",href:"/devices/add-soc"},"follow the add Soc guide"),"."),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"If you just need to reconfigure a couple pins, you can also use\nthe ",(0,i.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configureHardware")," function and skip the creation of a new board.")),(0,i.kt)("h2",{id:"how-to-create-a-new-board-configuration"},"How to create a new board configuration"),(0,i.kt)("h3",{id:"create-the-new-boardjson-file"},"Create the new ",(0,i.kt)("inlineCode",{parentName:"h3"},"board.json")," file"),(0,i.kt)("p",null,"You will need three pieces of information to start a new board: (1) the existing configuration\nyou will fork, (2) a name and (3) an identifier."),(0,i.kt)("p",null,"In ",(0,i.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nselect ",(0,i.kt)("strong",{parentName:"p"},"DeviceScript: Add Board...")," from the command palette."),(0,i.kt)("p",null,"Using the ",(0,i.kt)("a",{parentName:"p",href:"/getting-started/cli"},"Command Line"),", use the ",(0,i.kt)("inlineCode",{parentName:"p"},"add board")," command and follow the instructions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"devs add board\n")),(0,i.kt)("p",null,"After this process, you wil have a new JSON under ",(0,i.kt)("inlineCode",{parentName:"p"},"/boards/"),". The command line and\nVisual Studio Code will automatically integrate any configuration files in the ",(0,i.kt)("inlineCode",{parentName:"p"},"/boards")," folder."),(0,i.kt)("h3",{id:"editing-the-generated-device-configuration-json-file"},"Editing the generated Device configuration (.json) file"),(0,i.kt)("p",null,"The new configuration file is a schematized JSON file.\nIn Visual Studio Code, you will get tooltip, completion, syntax errors and auto-completion."),(0,i.kt)("ul",{className:"contains-task-list"},(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","A new product identifier was automatically generated for you (but ",(0,i.kt)("a",{parentName:"li",href:"https://microsoft.github.io/jacdac-docs/ddk/device-definition/"},"you can regenerate a new one as well"),").")),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"The product identifier is used to identify devices in the ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/devices/"},"Jacdac device catalog"),"\nwhich is leveraged by the simulator dashboard.")),(0,i.kt)("ul",{className:"contains-task-list"},(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","configure the status light LED. DeviceScript supports monochrome LEDs, RGB LEDs,\nWS2812B, APA102, SK9822 and more (refer to the schema information).")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},' "led": {\n "pin": 7,\n "isMono": true\n },\n')),(0,i.kt)("ul",{className:"contains-task-list"},(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","configure the system logging pin")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},' "log": {\n "baud": 115200,\n "pinTX": 0\n },\n')),(0,i.kt)("ul",{className:"contains-task-list"},(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","configure I2C pins, add ",(0,i.kt)("inlineCode",{parentName:"li"},"$connector")," only if there is a standardized connector")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},' "i2c": {\n "pinSCL": 5,\n "pinSDA": 4,\n },\n')),(0,i.kt)("ul",{className:"contains-task-list"},(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","Update the pin map")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},' "pins": {\n "P1": 1,\n "P11": 11,\n "P13": 13,\n "P14": 14,\n ...\n }\n')),(0,i.kt)("ul",{className:"contains-task-list"},(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","Update the board description"),(0,i.kt)("li",{parentName:"ul",className:"task-list-item"},(0,i.kt)("input",{parentName:"li",type:"checkbox",checked:!1,disabled:!0})," ","If available, provide a URL where the board can be purchased")),(0,i.kt)("p",null,"Build the project to test the board definition."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm run build\n")),(0,i.kt)("h4",{id:"services"},"Services"),(0,i.kt)("p",null,"Note that there is two ways of defining services in the ",(0,i.kt)("inlineCode",{parentName:"p"},".board.json")," file.\nThe ones listed under ",(0,i.kt)("inlineCode",{parentName:"p"},'"$services": [ ... ]')," will generate ",(0,i.kt)("inlineCode",{parentName:"p"},"startFoo()")," functions,\nwhich need to be called for the service to be started.\nThe ones under ",(0,i.kt)("inlineCode",{parentName:"p"},'"services": [ ... ]')," are always started; this is typically only\nused for ",(0,i.kt)("inlineCode",{parentName:"p"},"power")," service."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},' "$services": [\n {\n "service": "buzzer",\n "pin": 20,\n "name": "buzzer"\n },\n ...\n ]\n')),(0,i.kt)("h3",{id:"flash-the-new-configuration"},"Flash the new configuration"),(0,i.kt)("p",null,"The command line and Visual Studio will automatically integrate\nany configuration file in the ",(0,i.kt)("inlineCode",{parentName:"p"},"boards/")," folder.\nThe first time you deploy a program with a new hardware configuration, it will reset the device."),(0,i.kt)("h2",{id:"contributing"},"Contributing"),(0,i.kt)("p",null,"If you have successfully crafted a configuration for your Device and you would like to share it with other users,\nyou can open a GitHub Issue at ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript"},"https://github.com/microsoft/devicescript")," and attach the .JSON file. The file will\nbe reviewed and integrate into the built-in list."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4a3643e7.4b474de6.js b/assets/js/4a3643e7.4b474de6.js new file mode 100644 index 00000000000..41b0b61f86c --- /dev/null +++ b/assets/js/4a3643e7.4b474de6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6127],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>u});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=c(r),g=i,u=m["".concat(l,".").concat(g)]||m[g]||d[g]||a;return r?n.createElement(u,o(o({ref:t},s),{},{components:r})):n.createElement(u,o({ref:t},s))}));function u(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=g;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[m]="string"==typeof e?e:i,o[1]=p;for(var c=2;c<a;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}g.displayName="MDXCreateElement"},47205:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=r(25773),i=(r(27378),r(35318));const a={sidebar_position:1,title:"Image"},o="Image",p={unversionedId:"developer/graphics/image",id:"developer/graphics/image",title:"Image",description:"The Image represents a space-optimized pateletted image, with either 1 or 4 bit per pixels.",source:"@site/docs/developer/graphics/image.mdx",sourceDirName:"developer/graphics",slug:"/developer/graphics/image",permalink:"/devicescript/developer/graphics/image",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"Image"},sidebar:"tutorialSidebar",previous:{title:"Graphics",permalink:"/devicescript/developer/graphics/"},next:{title:"Display",permalink:"/devicescript/developer/graphics/display"}},l={},c=[{value:"<code>img</code>",id:"img",level:2},{value:"Rendering context",id:"rendering-context",level:2}],s={toc:c},m="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(m,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"image"},"Image"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"Image")," represents a space-optimized pateletted image, with either 1 or 4 bit per pixels."),(0,i.kt)("h2",{id:"img"},(0,i.kt)("inlineCode",{parentName:"h2"},"img")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"img")," is a ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals"},"template literal")," that allows defining images in form of ASCII Art.\nThe compiler will automatically generate an image, stored efficiently in flash memory.\nThis image is initially readonly; if you modify it, the runtime will internally allocate a buffer in RAM for it."),(0,i.kt)("p",null,"The image format is the grid of pixels with either ",(0,i.kt)("inlineCode",{parentName:"p"},".")," or the palette color index (",(0,i.kt)("inlineCode",{parentName:"p"},"#")," treated as 1)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { img } from "@devicescript/graphics"\n\nconst i = img`\n . . . 4 . . . . . .\n . 2 2 2 2 2 . . . .\n . 2 7 7 . 2 . . . .\n . 2 7 7 . 2 . . . .\n . 2 . . . 2 . . . .\n . 2 2 2 2 2 . . . .\n . . . . . . . . . .`\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"You can use the ",(0,i.kt)("a",{parentName:"p",href:"https://arcade.makecode.com/#pub:40169-42646-95097-89627"},"MakeCode Arcade")," sprite editor to create images and copy them back to DeviceScript!")),(0,i.kt)("h2",{id:"rendering-context"},"Rendering context"),(0,i.kt)("p",null,"You can create a rendering context for an image; that provides a HTML canvas-like API (smaller subset)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Image } from "@devicescript/graphics"\n\nconst img = Image.alloc(128, 64, 1)\nconst ctx = img.allocContext()\n\nctx.fillText(":)", 0, 0)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4aae093d.ff5f4488.js b/assets/js/4aae093d.ff5f4488.js new file mode 100644 index 00000000000..f7a447b0cb6 --- /dev/null +++ b/assets/js/4aae093d.ff5f4488.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1180],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>y});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),s=u(n),d=o,y=s["".concat(l,".").concat(d)]||s[d]||f[d]||i;return n?r.createElement(y,a(a({ref:t},p),{},{components:n})):r.createElement(y,a({ref:t},p))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[s]="string"==typeof e?e:o,a[1]=c;for(var u=2;u<i;u++)a[u]=n[u];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},53771:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(25773),o=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,unlisted:!0},a="CloudConfiguration",c={unversionedId:"api/clients/cloudconfiguration",id:"api/clients/cloudconfiguration",title:"CloudConfiguration",description:"The Cloud Configuration service is used internally by the runtime",source:"@site/docs/api/clients/cloudconfiguration.md",sourceDirName:"api/clients",slug:"/api/clients/cloudconfiguration",permalink:"/devicescript/api/clients/cloudconfiguration",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},u=[],p={toc:u},s="wrapper";function f(e){let{components:t,...n}=e;return(0,o.kt)(s,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"cloudconfiguration"},"CloudConfiguration"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/cloudconfiguration/"},"Cloud Configuration service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,o.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4c0cf505.d4194e93.js b/assets/js/4c0cf505.d4194e93.js new file mode 100644 index 00000000000..83ffc54cf23 --- /dev/null +++ b/assets/js/4c0cf505.d4194e93.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[845],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=p(n),u=i,f=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<a;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},2239:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={description:"Mounts an analog sensor",title:"Analog",sidebar_position:10},o="Analog",l={unversionedId:"developer/drivers/analog",id:"developer/drivers/analog",title:"Analog",description:"Mounts an analog sensor",source:"@site/docs/developer/drivers/analog.mdx",sourceDirName:"developer/drivers",slug:"/developer/drivers/analog",permalink:"/devicescript/developer/drivers/analog",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{description:"Mounts an analog sensor",title:"Analog",sidebar_position:10},sidebar:"tutorialSidebar",previous:{title:"Wire",permalink:"/devicescript/developer/drivers/digital-io/wire"},next:{title:"SPI",permalink:"/devicescript/developer/drivers/spi"}},s={},p=[{value:"Scaling",id:"scaling",level:2},{value:"Limiting power consumption",id:"limiting-power-consumption",level:2},{value:"Timings",id:"timings",level:2}],c={toc:p},m="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"analog"},"Analog"),(0,i.kt)("p",null,"There is a number of functions that start a simple analog sensor server.\nWe'll use ",(0,i.kt)("inlineCode",{parentName:"p"},"startPotentiometer()")," as an example, but you can use any of the following,\nas they all use the same configuration."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/drivers/lightlevel"},"LightLevel")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/drivers/reflectedlight"},"ReflectedLight")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/drivers/waterlevel"},"WaterLevel")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/drivers/soundlevel"},"SoundLevel")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/drivers/soilmoisture"},"SoilMoisture")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/drivers/potentiometer"},"Potentiometer"))),(0,i.kt)("p",null,"In the simplest case, you just pass the pin to ",(0,i.kt)("inlineCode",{parentName:"p"},"startPotentiometer()"),".\nThe voltage on the pin (typically between 0V (GND) and 3.3V (VCC)) will be translated to a number between 0 and 1."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startPotentiometer } from "@devicescript/servers"\n\nconst slider = startPotentiometer({\n pin: ds.gpio(3),\n})\nslider.reading.subscribe(v => console.data({ value: 100 * v }))\n')),(0,i.kt)("h2",{id:"scaling"},"Scaling"),(0,i.kt)("p",null,"There are two settings, ",(0,i.kt)("inlineCode",{parentName:"p"},"offset")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"scale")," that let you modify the value read from the sensor.\nThe actual reported reading is ",(0,i.kt)("inlineCode",{parentName:"p"},"(offset + (raw_reading * scale) / 1024) / 0xffff"),"\nclamped to ",(0,i.kt)("inlineCode",{parentName:"p"},"0 ... 1")," range.\nThe range of ",(0,i.kt)("inlineCode",{parentName:"p"},"raw_reading")," is ",(0,i.kt)("inlineCode",{parentName:"p"},"0 ... 0xffff"),".\nThe defaults are ",(0,i.kt)("inlineCode",{parentName:"p"},"{ offset: 0, scale: 1024 }")," so the ",(0,i.kt)("inlineCode",{parentName:"p"},"raw_reading")," is just reported back."),(0,i.kt)("p",null,"For example, if you find you can never quite reach the ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," values, you can try the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startPotentiometer } from "@devicescript/servers"\n\nconst slider = startPotentiometer({\n pin: ds.gpio(3),\n offset: 0x1000,\n scale: 900,\n})\n')),(0,i.kt)("h2",{id:"limiting-power-consumption"},"Limiting power consumption"),(0,i.kt)("p",null,"A potentiometer typically has 3 terminals, let's call them L, M, R.\nYou connect L to GND, R to VCC and M (middle) to the sensing pin.\nThe M terminal will then get a voltage proportional to the position of the knob."),(0,i.kt)("p",null,"However, the current (0.3mA with typical 10kOhm potentiometer) will always flow from L to R,\nregardless if you measure it or not.\nTo improve power consumption, you may connect say R to a GPIO and configure the service like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startPotentiometer } from "@devicescript/servers"\n\nconst slider = startPotentiometer({\n pin: ds.gpio(3),\n pinHigh: ds.gpio(7),\n})\n')),(0,i.kt)("p",null,"This tells the driver to set GPIO7 (",(0,i.kt)("inlineCode",{parentName:"p"},"pinHigh"),") to 1 (3.3V) before taking the measurement\nfrom GPIO3 (",(0,i.kt)("inlineCode",{parentName:"p"},"pin"),").\nAfter taking the measurement, ",(0,i.kt)("inlineCode",{parentName:"p"},"pinHigh")," will be left floating, so no current will flow through the potentiometer."),(0,i.kt)("p",null,"You can also set ",(0,i.kt)("inlineCode",{parentName:"p"},"pinLow")," (which is set to 0 before taking measurement) or both ",(0,i.kt)("inlineCode",{parentName:"p"},"pinHigh")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"pinLow"),",\nbut typically one is enough."),(0,i.kt)("h2",{id:"timings"},"Timings"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"samplingItv")," settings defaults to 9 milliseconds and specifies how often to sample the sensor."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"streamingItv")," setting defaults to 100 milliseconds and specifies how often to stream values\non the Jacdac bus.\nThe client can override this through ",(0,i.kt)("inlineCode",{parentName:"p"},"streaming_interval")," Jacdac register."),(0,i.kt)("p",null,"Additionally, you can set ",(0,i.kt)("inlineCode",{parentName:"p"},"samplingDelay")," to a number of milliseconds to wait after setting ",(0,i.kt)("inlineCode",{parentName:"p"},"pinHigh"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"pinLow"),"\nbefore taking the measurement\n(default is 0, so effectively a few microseconds (not milliseconds))."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4c197666.c0b6c1f1.js b/assets/js/4c197666.c0b6c1f1.js new file mode 100644 index 00000000000..64f517d25fe --- /dev/null +++ b/assets/js/4c197666.c0b6c1f1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9234],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>g});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),u=a,g=d["".concat(p,".").concat(u)]||d[u]||m[u]||i;return r?n.createElement(g,o(o({ref:t},c),{},{components:r})):n.createElement(g,o({ref:t},c))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:a,o[1]=l;for(var s=2;s<i;s++)o[s]=r[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},45155:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var n=r(25773),a=(r(27378),r(35318));const i={title:"LED Driver"},o="LED Driver",l={unversionedId:"developer/leds/driver",id:"developer/leds/driver",title:"LED Driver",description:"You can start a driver for WS2812B, APA102, or SK9822 using startLed.",source:"@site/docs/developer/leds/driver.mdx",sourceDirName:"developer/leds",slug:"/developer/leds/driver",permalink:"/devicescript/developer/leds/driver",draft:!1,tags:[],version:"current",frontMatter:{title:"LED Driver"},sidebar:"tutorialSidebar",previous:{title:"Display",permalink:"/devicescript/developer/leds/display"},next:{title:"MCU Temperature",permalink:"/devicescript/developer/mcu-temperature"}},p={},s=[{value:"Gamma correction",id:"gamma-correction",level:2},{value:"Topology",id:"topology",level:2},{value:"Maximum power consumption",id:"maximum-power-consumption",level:2}],c={toc:s},d="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(d,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"led-driver"},"LED Driver"),(0,a.kt)("p",null,"You can start a driver for WS2812B, APA102, or SK9822 using ",(0,a.kt)("inlineCode",{parentName:"p"},"startLed"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedVariant, LedStripLightType } from "@devicescript/core"\nimport { startLed } from "@devicescript/drivers"\nimport { pins } from "@dsboard/adafruit_qt_py_c3"\n\n// highlight-start\nconst led = await startLed({\n length: 32,\n variant: LedVariant.Ring,\n hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: pins.A0_D0 },\n})\n// highlight-end\n')),(0,a.kt)("h2",{id:"gamma-correction"},"Gamma correction"),(0,a.kt)("p",null,"The Led supports ",(0,a.kt)("a",{parentName:"p",href:"https://cdn-learn.adafruit.com/downloads/pdf/led-tricks-gamma-correction.pdf"},"Gamma correction"),",\nbut it is disabled by default. Gamma correction is applied before rendering the colors\nto account for how our eyes sense the light created by LEDs."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"const led = await startLed({\n // highlight-next-line\n gamma: 2.8,\n})\n")),(0,a.kt)("h2",{id:"topology"},"Topology"),(0,a.kt)("p",null,"You can specify the topology of the LED strip by using the ",(0,a.kt)("inlineCode",{parentName:"p"},"variant")," register. The default is a flexible strip\nbut other popular options like ",(0,a.kt)("inlineCode",{parentName:"p"},"ring")," are also available."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'// highlight-next-line\nimport { LedVariant } from "@devicescript/core"\n\nconst led = await startLed({\n // highlight-next-line\n variant: LedVariant.Ring,\n})\n')),(0,a.kt)("p",null,"For LED ",(0,a.kt)("inlineCode",{parentName:"p"},"matrix")," with row major, you should also specify the number of columns."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'// highlight-next-line\nimport { LedVariant } from "@devicescript/core"\n\nconst led = await startLed({\n length: 64 // 8x8\n // highlight-next-line\n variant: LedVariant.Matrix,\n // highlight-next-line\n columns: 8\n})\n')),(0,a.kt)("p",null,"To work on the LEDs as it if was an image, use the ",(0,a.kt)("a",{parentName:"p",href:"./display"},"startLedDisplay")," helper."),(0,a.kt)("h2",{id:"maximum-power-consumption"},"Maximum power consumption"),(0,a.kt)("p",null,"A large number of LED consuming maximum power can lead to an impressive surge of\npower consumption. The LED driver allows to specify a maximum power (in watts)\nand a LED power consumption model. Given those information"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"const led = await startLed({\n maxPower: 5, // watts\n})\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4cf0c468.b549dce9.js b/assets/js/4cf0c468.b549dce9.js new file mode 100644 index 00000000000..c99d05ceab7 --- /dev/null +++ b/assets/js/4cf0c468.b549dce9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1500],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var a=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),u=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(r),m=n,f=d["".concat(s,".").concat(m)]||d[m]||c[m]||i;return r?a.createElement(f,o(o({ref:t},p),{},{components:r})):a.createElement(f,o({ref:t},p))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:n,o[1]=l;for(var u=2;u<i;u++)o[u]=r[u];return a.createElement.apply(null,o)}return a.createElement.apply(null,r)}m.displayName="MDXCreateElement"},65374:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var a=r(25773),n=(r(27378),r(35318));const i={title:"Adafruit.io",sidebar_position:2},o="Adafruit.io",l={unversionedId:"developer/iot/adafruit-io/index",id:"developer/iot/adafruit-io/index",title:"Adafruit.io",description:"In this sample, we upload temperature readings to Adafruit.io.",source:"@site/docs/developer/iot/adafruit-io/index.mdx",sourceDirName:"developer/iot/adafruit-io",slug:"/developer/iot/adafruit-io/",permalink:"/devicescript/developer/iot/adafruit-io/",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{title:"Adafruit.io",sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"IoT",permalink:"/devicescript/developer/iot/"},next:{title:"Blues.io Notecard",permalink:"/devicescript/developer/iot/blues-io/"}},s={},u=[{value:"Hardware setup",id:"hardware-setup",level:2},{value:"Firmware setup",id:"firmware-setup",level:2},{value:"Adafruit.io Configuration",id:"adafruitio-configuration",level:2},{value:"Settings configuration",id:"settings-configuration",level:2},{value:"Code",id:"code",level:2},{value:"More on Adafruit.IO",id:"more-on-adafruitio",level:2}],p={toc:u},d="wrapper";function c(e){let{components:t,...i}=e;return(0,n.kt)(d,(0,a.Z)({},p,i,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"adafruitio"},"Adafruit.io"),(0,n.kt)("p",null,"In this sample, we upload temperature readings to ",(0,n.kt)("a",{parentName:"p",href:"https://io.adafruit.com/"},"Adafruit.io"),".\nIt is free for up to 30 data points per minute. This is a great way to get started with IoT."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Screenshot of temperature chart",src:r(43054).Z,width:"1354",height:"611"})),(0,n.kt)("admonition",{type:"tip"},(0,n.kt)("p",{parentName:"admonition"},"In this sample, we use the REST APIs to access the Adafruit cloud.\nYou can also use the ",(0,n.kt)("a",{parentName:"p",href:"https://io.adafruit.com/api/docs/mqtt.html#adafruit-io-mqtt-api"},"MQTT APIs"),"\nwith the ",(0,n.kt)("a",{parentName:"p",href:"/developer/net/mqtt/"},"MQTT client"),".")),(0,n.kt)("p",null,"We'll assume you have Visual Studio Code installed and the DeviceScript extension installed."),(0,n.kt)("p",null,"To get started create a new project by using ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Create New Project..."),"."),(0,n.kt)("h2",{id:"hardware-setup"},"Hardware setup"),(0,n.kt)("p",null,"We'll use the Qt Py and a SHTC3 from Adafruit for this sample."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("img",{parentName:"li",src:"https://microsoft.github.io/jacdac-docs/images/devices/adafruit/qtpyesp32c3wifidevboardv10.avatar.jpg",alt:null})," ",(0,n.kt)("a",{parentName:"li",href:"https://www.adafruit.com/product/5405"},"Adafruit QT Py ESP32-C3 WiFi")," (",(0,n.kt)("a",{parentName:"li",href:"/devices/esp32/adafruit-qt-py-c3"},"configuration"),")"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.adafruit.com/product/4636"},"Adafruit Sensirion SHTC3 Temperature & Humidity Sensor - STEMMA QT / Qwiic"))),(0,n.kt)("p",null,"Make sure to connect the SHTC3 to the QT Py using the Qwiic connector."),(0,n.kt)("h2",{id:"firmware-setup"},"Firmware setup"),(0,n.kt)("p",null,"The Qt Py firmware might need to be updated to the latest version."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"connect the QT Py to your computer"),(0,n.kt)("li",{parentName:"ul"},"Click on the ",(0,n.kt)("strong",{parentName:"li"},"plug")," icon in the DeviceScript explorer and select ",(0,n.kt)("strong",{parentName:"li"},"Flash firmware...")),(0,n.kt)("li",{parentName:"ul"},"select ",(0,n.kt)("strong",{parentName:"li"},"Adafruit QT Py ESP32-C3 WiFi"))),(0,n.kt)("p",null,"Once the flashing is done (you may need to install ",(0,n.kt)("inlineCode",{parentName:"p"},"esptool"),"), re-connect to the device. If all goes well, it will appear in the device explorer."),(0,n.kt)("h2",{id:"adafruitio-configuration"},"Adafruit.io Configuration"),(0,n.kt)("p",null,"Navigate to ",(0,n.kt)("a",{parentName:"p",href:"https://io.adafruit.com/"},"Adafruit.io")," and create an account.\nThen create a new feed and name it ",(0,n.kt)("inlineCode",{parentName:"p"},"temperature"),"."),(0,n.kt)("p",null,"Make note of your user name and the access key. We'll need those shortly."),(0,n.kt)("h2",{id:"settings-configuration"},"Settings configuration"),(0,n.kt)("p",null,"Before writing the logic of the application, we want to configure the script\nfor the current hardware. We will need settings to store WiFi configuration, the Adafruit.io secret key,\nthe pin mapping for the Qt Py and the SHTC3 driver."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"click on the ",(0,n.kt)("strong",{parentName:"li"},"wand")," icon in the file editor menu"),(0,n.kt)("li",{parentName:"ul"},"select the ",(0,n.kt)("strong",{parentName:"li"},"Adafruit QT Py ESP32-C3 WiFi")),(0,n.kt)("li",{parentName:"ul"},"select ",(0,n.kt)("strong",{parentName:"li"},"Sensirion SHTC3")),(0,n.kt)("li",{parentName:"ul"},"click on the ",(0,n.kt)("strong",{parentName:"li"},"wand")," again"),(0,n.kt)("li",{parentName:"ul"},"select ",(0,n.kt)("strong",{parentName:"li"},"Add Device Settings..."))),(0,n.kt)("p",null,"Edit ",(0,n.kt)("inlineCode",{parentName:"p"},".env.local")," and add your Adafruit.io secret key."),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"\u26a0\ufe0f ",(0,n.kt)("inlineCode",{parentName:"p"},".env.local")," should not be committed to source control.")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-yaml"},"# env.defaults\n# public settings, commit to source control\nWIFI_SSID=your-wifi-ssid\n")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-yaml"},"# env.local\n# secrets, don't commit to source control\nIO_KEY=your-secret-key\nWIFI_PWD=your-wifi-password\n")),(0,n.kt)("h2",{id:"code"},"Code"),(0,n.kt)("p",null,"This annotated code sample schedules a task that reads a temperature sensor\nand uploads the value to Adafruit.io every minute."),(0,n.kt)("p",null,"We use the REST API and the ",(0,n.kt)("strong",{parentName:"p"},"fetch")," method to send the data."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'// hardware configuration and drivers\nimport { pins, board } from "@dsboard/adafruit_qt_py_c3"\nimport { startSHTC3 } from "@devicescript/drivers"\n// extra APIs\nimport { readSetting } from "@devicescript/settings"\nimport { schedule } from "@devicescript/runtime"\nimport { fetch } from "@devicescript/net"\n\n// mounting a temperature server for the SHTC3 sensor\nconst { temperature, humidity } = await startSHTC3()\n\n// feed configuration\nconst user = "user"\nconst feed = "temperature"\n// this secret is stored in the .env.local and uploaded to the device settings\nconst key = await readSetting("IO_KEY")\n\n// Adafruit IO API https://io.adafruit.com/api/docs/#create-data\nconst url = `https://io.adafruit.com/api/v2/${user}/feeds/${feed}/data`\nconst headers = { "X-AIO-Key": key, "Content-Type": "application/json" }\n\nconsole.log({ url })\n\n// run after 1 second and then every minute\nschedule(\n async () => {\n // read data from temperature sensor\n const value = await temperature.reading.read()\n // craft Adafruit.io payload\n const body = { value }\n // send request\n const { status } = await fetch(url, {\n method: "POST",\n headers,\n body: JSON.stringify(body),\n })\n // print HTTP status\n console.log({ value, status })\n },\n { timeout: 1000, interval: 60000 }\n)\n')),(0,n.kt)("h2",{id:"more-on-adafruitio"},"More on Adafruit.IO"),(0,n.kt)("p",null,"If you don't want to remember the REST API syntax, you can use some packages that wrap the Adafruit.io API."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/pelikhan/devicescript-adafruit-io/"},"https://github.com/pelikhan/devicescript-adafruit-io/"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { pins, board } from "@dsboard/adafruit_qt_py_c3"\nimport { startSHTC3 } from "@devicescript/drivers"\nimport { schedule } from "@devicescript/runtime"\n// highlight-next-line\nimport { createData } from "devicescript-adafruit-io"\n\nconst { temperature, humidity } = await startSHTC3()\n\nschedule(\n async () => {\n const value = await temperature.reading.read()\n // highlight-next-line\n await createData(value)\n },\n { timeout: 1000, interval: 60000 }\n)\n')))}c.isMDXComponent=!0},43054:(e,t,r)=>{r.d(t,{Z:()=>a});const a=r.p+"assets/images/adafruitio-158caa745d4965548591ec514d363ef2.png"}}]); \ No newline at end of file diff --git a/assets/js/4cf2e415.61af5777.js b/assets/js/4cf2e415.61af5777.js new file mode 100644 index 00000000000..77b3a271c3f --- /dev/null +++ b/assets/js/4cf2e415.61af5777.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4625],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},v=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),u=s(r),v=i,f=u["".concat(p,".").concat(v)]||u[v]||d[v]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,c=new Array(a);c[0]=v;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,c[1]=o;for(var s=2;s<a;s++)c[s]=r[s];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}v.displayName="MDXCreateElement"},45018:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var n=r(25773),i=(r(27378),r(35318));const a={sidebar_position:100,description:"A comprehensive guide to the differences in semantics between DeviceScript and EcmaScript/JavaScript/TypeScript.",keywords:["DeviceScript","JavaScript","TypeScript","EcmaScript","semantics"]},c="Other differences with JavaScript",o={unversionedId:"language/devicescript-vs-javascript",id:"language/devicescript-vs-javascript",title:"Other differences with JavaScript",description:"A comprehensive guide to the differences in semantics between DeviceScript and EcmaScript/JavaScript/TypeScript.",source:"@site/docs/language/devicescript-vs-javascript.mdx",sourceDirName:"language",slug:"/language/devicescript-vs-javascript",permalink:"/devicescript/language/devicescript-vs-javascript",draft:!1,tags:[],version:"current",sidebarPosition:100,frontMatter:{sidebar_position:100,description:"A comprehensive guide to the differences in semantics between DeviceScript and EcmaScript/JavaScript/TypeScript.",keywords:["DeviceScript","JavaScript","TypeScript","EcmaScript","semantics"]},sidebar:"tutorialSidebar",previous:{title:"Bytecode",permalink:"/devicescript/language/bytecode"},next:{title:"Hex template literal",permalink:"/devicescript/language/hex"}},p={},s=[{value:"Subnormals",id:"subnormals",level:2}],l={toc:s},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"other-differences-with-javascript"},"Other differences with JavaScript"),(0,i.kt)("p",null,"This document lists differences in semantics between DeviceScript and EcmaScript/JavaScript/TypeScript\n(referred to as JS in this document)."),(0,i.kt)("h2",{id:"subnormals"},"Subnormals"),(0,i.kt)("p",null,"DeviceScript doesn't support subnormals, that is numbers is range around ",(0,i.kt)("inlineCode",{parentName:"p"},"-5e-324")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"5e-324")," are rounded to zero\n(it follows that negative zero is not supported).\nSubnormals are ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE"},"not required by the JS specs"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4d478ee4.ed2fdb35.js b/assets/js/4d478ee4.ed2fdb35.js new file mode 100644 index 00000000000..9d9ef78a11e --- /dev/null +++ b/assets/js/4d478ee4.ed2fdb35.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5542],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=s(n),d=r,k=u["".concat(p,".").concat(d)]||u[d]||c[d]||i;return n?a.createElement(k,l(l({ref:t},m),{},{components:n})):a.createElement(k,l({ref:t},m))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:r,l[1]=o;for(var s=2;s<i;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},25239:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Servo service"},l="Servo",o={unversionedId:"api/clients/servo",id:"api/clients/servo",title:"Servo",description:"DeviceScript client for Servo service",source:"@site/docs/api/clients/servo.md",sourceDirName:"api/clients",slug:"/api/clients/servo",permalink:"/devicescript/api/clients/servo",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Servo service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"angle",id:"rw:angle",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"offset",id:"rw:offset",level:3},{value:"minValue",id:"const:minValue",level:3},{value:"minPulse",id:"rw:minPulse",level:3},{value:"maxValue",id:"const:maxValue",level:3},{value:"maxPulse",id:"rw:maxPulse",level:3},{value:"stallTorque",id:"const:stallTorque",level:3},{value:"responseSpeed",id:"const:responseSpeed",level:3},{value:"reading",id:"ro:reading",level:3}],m={toc:s},u="wrapper";function c(e){let{components:t,...n}=e;return(0,r.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"servo"},"Servo"),(0,r.kt)("p",null,"Servo is a small motor with arm that can be pointing at a specific direction.\nTypically a servo angle is between 0\xb0 and 180\xb0 where 90\xb0 is the middle resting position."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"min_pulse/max_pulse")," may be read-only if the servo is permanently affixed to its Jacdac controller."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:angle"},"angle"),(0,r.kt)("p",null,"Specifies the angle of the arm (request)."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.angle.read()\nawait servo.angle.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nservo.angle.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:enabled"},"enabled"),(0,r.kt)("p",null,"Turn the power to the servo on/off."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.enabled.read()\nawait servo.enabled.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nservo.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:offset"},"offset"),(0,r.kt)("p",null,"Correction applied to the angle to account for the servo arm drift."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.offset.read()\nawait servo.offset.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nservo.offset.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:minValue"},"minValue"),(0,r.kt)("p",null,"Lowest angle that can be set, typiclly 0 \xb0."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.minValue.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:minPulse"},"minPulse"),(0,r.kt)("p",null,"The length of pulse corresponding to lowest angle."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.minPulse.read()\nawait servo.minPulse.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nservo.minPulse.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxValue"},"maxValue"),(0,r.kt)("p",null,"Highest angle that can be set, typically 180\xb0."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.maxValue.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:maxPulse"},"maxPulse"),(0,r.kt)("p",null,"The length of pulse corresponding to highest angle."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.maxPulse.read()\nawait servo.maxPulse.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nservo.maxPulse.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:stallTorque"},"stallTorque"),(0,r.kt)("p",null,"The servo motor will stop rotating when it is trying to move a ",(0,r.kt)("inlineCode",{parentName:"p"},"stall_torque")," weight at a radial distance of ",(0,r.kt)("inlineCode",{parentName:"p"},"1.0")," cm."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.stallTorque.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:responseSpeed"},"responseSpeed"),(0,r.kt)("p",null,"Time to move 60\xb0."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.responseSpeed.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"The current physical position of the arm, if the device has a way to sense the position."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nconst value = await servo.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Servo } from "@devicescript/core"\n\nconst servo = new Servo()\n// ...\nservo.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4d64fe70.55ffdd1e.js b/assets/js/4d64fe70.55ffdd1e.js new file mode 100644 index 00000000000..7353f8a25ba --- /dev/null +++ b/assets/js/4d64fe70.55ffdd1e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5091],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(27378);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){o(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},v=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(t),v=o,m=d["".concat(p,".").concat(v)]||d[v]||u[v]||i;return t?n.createElement(m,a(a({ref:r},l),{},{components:t})):n.createElement(m,a({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=v;var c={};for(var p in r)hasOwnProperty.call(r,p)&&(c[p]=r[p]);c.originalType=e,c[d]="string"==typeof e?e:o,a[1]=c;for(var s=2;s<i;s++)a[s]=t[s];return n.createElement.apply(null,a)}return n.createElement.apply(null,t)}v.displayName="MDXCreateElement"},45493:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var n=t(25773),o=(t(27378),t(35318));const i={description:"Mounts a rotary encoder server",title:"Rotary Encoder"},a="Rotary Encoder",c={unversionedId:"api/drivers/rotaryencoder",id:"api/drivers/rotaryencoder",title:"Rotary Encoder",description:"Mounts a rotary encoder server",source:"@site/docs/api/drivers/rotaryencoder.md",sourceDirName:"api/drivers",slug:"/api/drivers/rotaryencoder",permalink:"/devicescript/api/drivers/rotaryencoder",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a rotary encoder server",title:"Rotary Encoder"},sidebar:"tutorialSidebar",previous:{title:"Relay",permalink:"/devicescript/api/drivers/relay"},next:{title:"Servo",permalink:"/devicescript/api/drivers/servo"}},p={},s=[{value:"Options",id:"options",level:2},{value:"pin0, pin1",id:"pin0-pin1",level:3},{value:"clicksPerTurn (optional)",id:"clicksperturn-optional",level:3},{value:"dense (optional)",id:"dense-optional",level:3},{value:"inverted (optional)",id:"inverted-optional",level:3}],l={toc:s},d="wrapper";function u(e){let{components:r,...t}=e;return(0,o.kt)(d,(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"rotary-encoder"},"Rotary Encoder"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startRotaryEncoder")," function starts a ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/rotaryencoder"},"Rotary Encoder")," server on the device\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/rotaryencoder"},"client"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startRotaryEncoder } from "@devicescript/servers"\n\nconst dialA = startRotaryEncoder({\n pin0: gpio(2),\n pin1: gpio(3),\n})\n')),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"RotadialA"),"."),(0,o.kt)("h2",{id:"options"},"Options"),(0,o.kt)("h3",{id:"pin0-pin1"},"pin0, pin1"),(0,o.kt)("p",null,"The pin hardware identifiers on which to mount the Rotary Encoder."),(0,o.kt)("h3",{id:"clicksperturn-optional"},"clicksPerTurn (optional)"),(0,o.kt)("p",null,"Number of reported clicks per full rotation. Default is 12."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startRotaryEncoder } from "@devicescript/servers"\n\nconst dialA = startRotaryEncoder({\n pin0: gpio(2),\n pin1: gpio(3),\n // highlight-next-line\n clicksPerTurn: 24,\n})\n')),(0,o.kt)("h3",{id:"dense-optional"},"dense (optional)"),(0,o.kt)("p",null,'Encoder supports "half-clicks". Default is false.'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startRotaryEncoder } from "@devicescript/servers"\n\nconst dialA = startRotaryEncoder({\n pin0: gpio(2),\n pin1: gpio(3),\n // highlight-next-line\n dense: true,\n})\n')),(0,o.kt)("h3",{id:"inverted-optional"},"inverted (optional)"),(0,o.kt)("p",null,"Invert direction. Default is false."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startRotaryEncoder } from "@devicescript/servers"\n\nconst dialA = startRotaryEncoder({\n pin0: gpio(2),\n pin1: gpio(3),\n // highlight-next-line\n inverted: true,\n})\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5015016c.0761b550.js b/assets/js/5015016c.0761b550.js new file mode 100644 index 00000000000..bd2bfdeb03e --- /dev/null +++ b/assets/js/5015016c.0761b550.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7497],{35318:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>y});var n=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function l(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},s=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,y=u["".concat(c,".").concat(m)]||u[m]||f[m]||o;return t?n.createElement(y,i(i({ref:r},s),{},{components:t})):n.createElement(y,i({ref:r},s))}));function y(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=m;var l={};for(var c in r)hasOwnProperty.call(r,c)&&(l[c]=r[c]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var p=2;p<o;p++)i[p]=t[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"},9455:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>f,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var n=t(25773),a=(t(27378),t(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},i="RoleManager",l={unversionedId:"api/clients/rolemanager",id:"api/clients/rolemanager",title:"RoleManager",description:"The Role Manager service is used internally by the runtime",source:"@site/docs/api/clients/rolemanager.md",sourceDirName:"api/clients",slug:"/api/clients/rolemanager",permalink:"/devicescript/api/clients/rolemanager",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},c={},p=[],s={toc:p},u="wrapper";function f(e){let{components:r,...t}=e;return(0,a.kt)(u,(0,n.Z)({},s,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"rolemanager"},"RoleManager"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/rolemanager/"},"Role Manager service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,a.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5046913c.d5497ef3.js b/assets/js/5046913c.d5497ef3.js new file mode 100644 index 00000000000..3066de2956a --- /dev/null +++ b/assets/js/5046913c.d5497ef3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9531],{35318:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>k});var i=t(27378);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function p(e,n){if(null==e)return{};var t,i,r=function(e,n){if(null==e)return{};var t,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)t=a[i],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)t=a[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=i.createContext({}),d=function(e){var n=i.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=d(e.components);return i.createElement(o.Provider,{value:n},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=d(t),u=r,k=c["".concat(o,".").concat(u)]||c[u]||m[u]||a;return t?i.createElement(k,l(l({ref:n},s),{},{components:t})):i.createElement(k,l({ref:n},s))}));function k(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,l=new Array(a);l[0]=u;var p={};for(var o in n)hasOwnProperty.call(n,o)&&(p[o]=n[o]);p.originalType=e,p[c]="string"==typeof e?e:r,l[1]=p;for(var d=2;d<a;d++)l[d]=t[d];return i.createElement.apply(null,l)}return i.createElement.apply(null,t)}u.displayName="MDXCreateElement"},57213:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>p,toc:()=>d});var i=t(25773),r=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Indexed screen service"},l="IndexedScreen",p={unversionedId:"api/clients/indexedscreen",id:"api/clients/indexedscreen",title:"IndexedScreen",description:"DeviceScript client for Indexed screen service",source:"@site/docs/api/clients/indexedscreen.md",sourceDirName:"api/clients",slug:"/api/clients/indexedscreen",permalink:"/devicescript/api/clients/indexedscreen",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Indexed screen service"},sidebar:"tutorialSidebar"},o={},d=[{value:"Commands",id:"commands",level:2},{value:"startUpdate",id:"startupdate",level:3},{value:"setPixels",id:"setpixels",level:3},{value:"Registers",id:"registers",level:2},{value:"intensity",id:"rw:intensity",level:3},{value:"palette",id:"rw:palette",level:3},{value:"bitsPerPixel",id:"const:bitsPerPixel",level:3},{value:"width",id:"const:width",level:3},{value:"height",id:"const:height",level:3},{value:"widthMajor",id:"rw:widthMajor",level:3},{value:"upSampling",id:"rw:upSampling",level:3},{value:"rotation",id:"rw:rotation",level:3}],s={toc:d},c="wrapper";function m(e){let{components:n,...t}=e;return(0,r.kt)(c,(0,i.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"indexedscreen"},"IndexedScreen"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,r.kt)("p",null,"A screen with indexed colors from a palette."),(0,r.kt)("p",null,"This is often run over an SPI connection or directly on the MCU, not regular single-wire Jacdac."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"startupdate"},"startUpdate"),(0,r.kt)("p",null,"Sets the update window for subsequent ",(0,r.kt)("inlineCode",{parentName:"p"},"set_pixels")," commands."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"indexedScreen.startUpdate(x: number, y: number, width: number, height: number): Promise<void>\n")),(0,r.kt)("h3",{id:"setpixels"},"setPixels"),(0,r.kt)("p",null,'Set pixels in current window, according to current palette.\nEach "line" of data is aligned to a byte.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"indexedScreen.setPixels(pixels: Buffer): Promise<void>\n")),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:intensity"},"intensity"),(0,r.kt)("p",null,"Set backlight brightness.\nIf set to ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," the display may go to sleep."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.intensity.read()\nawait indexedScreen.intensity.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nindexedScreen.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:palette"},"palette"),(0,r.kt)("p",null,"The current palette. The colors are ",(0,r.kt)("inlineCode",{parentName:"p"},"[r,g,b, padding]")," 32bit color entries.\nThe color entry repeats ",(0,r.kt)("inlineCode",{parentName:"p"},"1 << bits_per_pixel")," times.\nThis register may be write-only."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<Buffer>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"b"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"track incoming values"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nindexedScreen.palette.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:bitsPerPixel"},"bitsPerPixel"),(0,r.kt)("p",null,"Determines the number of palette entries.\nTypical values are 1 or 4."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.bitsPerPixel.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:width"},"width"),(0,r.kt)("p",null,'Screen width in "natural" orientation.'),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.width.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:height"},"height"),(0,r.kt)("p",null,'Screen height in "natural" orientation.'),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.height.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:widthMajor"},"widthMajor"),(0,r.kt)("p",null,'If true, consecutive pixels in the "width" direction are sent next to each other (this is typical for graphics cards).\nIf false, consecutive pixels in the "height" direction are sent next to each other.\nFor embedded screen controllers, this is typically true iff ',(0,r.kt)("inlineCode",{parentName:"p"},"width < height"),"\n(in other words, it's only true for portrait orientation screens).\nSome controllers may allow the user to change this (though the refresh order may not be optimal then).\nThis is independent of the ",(0,r.kt)("inlineCode",{parentName:"p"},"rotation")," register."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.widthMajor.read()\nawait indexedScreen.widthMajor.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nindexedScreen.widthMajor.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:upSampling"},"upSampling"),(0,r.kt)("p",null,"Every pixel sent over wire is represented by ",(0,r.kt)("inlineCode",{parentName:"p"},"up_sampling x up_sampling")," square of physical pixels.\nSome displays may allow changing this (which will also result in changes to ",(0,r.kt)("inlineCode",{parentName:"p"},"width")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"height"),").\nTypical values are 1 and 2."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.upSampling.read()\nawait indexedScreen.upSampling.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nindexedScreen.upSampling.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:rotation"},"rotation"),(0,r.kt)("p",null,"Possible values are 0, 90, 180 and 270 only.\nWrite to this register do not affect ",(0,r.kt)("inlineCode",{parentName:"p"},"width")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"height")," registers,\nand may be ignored by some screens."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nconst value = await indexedScreen.rotation.read()\nawait indexedScreen.rotation.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { IndexedScreen } from "@devicescript/core"\n\nconst indexedScreen = new IndexedScreen()\n// ...\nindexedScreen.rotation.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/51e07670.6254db6a.js b/assets/js/51e07670.6254db6a.js new file mode 100644 index 00000000000..36482d779e7 --- /dev/null +++ b/assets/js/51e07670.6254db6a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9859],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=l(r),d=a,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||i;return r?n.createElement(f,o(o({ref:t},s),{},{components:r})):n.createElement(f,o({ref:t},s))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[u]="string"==typeof e?e:a,o[1]=p;for(var l=2;l<i;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},75527:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const i={},o="AHT20",p={unversionedId:"api/drivers/aht20",id:"api/drivers/aht20",title:"AHT20",description:"Driver for AHT20 temperature/humidity sensor at I2C address 0x38.",source:"@site/docs/api/drivers/aht20.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/aht20",permalink:"/devicescript/api/drivers/aht20",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Accelerometer",permalink:"/devicescript/api/drivers/accelerometer"},next:{title:"BME680",permalink:"/devicescript/api/drivers/bme680"}},c={},l=[{value:"Usage",id:"usage",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:l},u="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"aht20"},"AHT20"),(0,a.kt)("p",null,"Driver for AHT20 temperature/humidity sensor at I2C address ",(0,a.kt)("inlineCode",{parentName:"p"},"0x38"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Services: ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/temperature/"},"temperature"),", ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/humidity/"},"humidity")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://asairsensors.com/wp-content/uploads/2021/09/Data-Sheet-AHT20-Humidity-and-Temperature-Sensor-ASAIR-V1.0.03.pdf"},"Datasheet")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/aht20.ts"},"Source"))),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { startAHT20 } from "@devicescript/drivers"\nconst { temperature, humidity } = await startAHT20()\n')),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Configure I2C throught the ",(0,a.kt)("a",{parentName:"li",href:"/developer/board-configuration"},"board configuration"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/546bdb9a.109ac07e.js b/assets/js/546bdb9a.109ac07e.js new file mode 100644 index 00000000000..aa4e0eba709 --- /dev/null +++ b/assets/js/546bdb9a.109ac07e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4480],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>v});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,v=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(v,s(s({ref:t},p),{},{components:r})):n.createElement(v,s({ref:t},p))}));function v(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var l=2;l<a;l++)s[l]=r[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},3884:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var n=r(25773),o=(r(27378),r(35318));const a={sidebar_position:2,description:"Learn how to use clients and roles in DeviceScript to interact with Jacdac services for sensors and actuators in a home heating system example.",keywords:["DeviceScript","Jacdac","clients","roles","home automation"]},s="Clients",i={unversionedId:"developer/clients",id:"developer/clients",title:"Clients",description:"Learn how to use clients and roles in DeviceScript to interact with Jacdac services for sensors and actuators in a home heating system example.",source:"@site/docs/developer/clients.mdx",sourceDirName:"developer",slug:"/developer/clients",permalink:"/devicescript/developer/clients",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Learn how to use clients and roles in DeviceScript to interact with Jacdac services for sensors and actuators in a home heating system example.",keywords:["DeviceScript","Jacdac","clients","roles","home automation"]},sidebar:"tutorialSidebar",previous:{title:"Status Light",permalink:"/devicescript/developer/status-light"},next:{title:"Board Configuration",permalink:"/devicescript/developer/board-configuration"}},c={},l=[{value:"Onboard servers",id:"onboard-servers",level:2}],p={toc:l},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"clients"},"Clients"),(0,o.kt)("p",null,"In DeviceScript, all access to sensors, actuators or other hardware components\nare abstracted through ",(0,o.kt)("strong",{parentName:"p"},"services"),".\nSensors act as ",(0,o.kt)("strong",{parentName:"p"},"servers")," and your scripts connects ",(0,o.kt)("strong",{parentName:"p"},"clients")," to interact with them.\nServers are implemented by ",(0,o.kt)("strong",{parentName:"p"},"drivers"),", which may provide one or more services."),(0,o.kt)("p",null,"To interact with servers, you start clients, known as ",(0,o.kt)("strong",{parentName:"p"},"roles"),", for each service you need."),(0,o.kt)("p",null,"Let's illustrate these concept with a controller for a home heating system.\nThe heating system has a relay to turn on/off the furnace, a temperature sensor and\nrotary encoder to change the desired temperature.\nTherefore, we declare 3 roles."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature, Relay } from "@devicescript/core"\n\nconst thermometer = new Temperature()\nconst thermometer2 = new Temperature()\nconst relay = new Relay()\n')),(0,o.kt)("h2",{id:"onboard-servers"},"Onboard servers"),(0,o.kt)("p",null,"You can also start servers for onboard sensors and actuators. For example, the ",(0,o.kt)("inlineCode",{parentName:"p"},"startBME680")," function maps a BME680 sensor to 4 roles: temperature, humidity, pressure and air quality index."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { startBME680 } from "@devicescript/drivers"\n\n// mount services on a BME680\n// highlight-next-line\nconst { temperature, humidity, pressure, airQualityIndex } = await startBME680()\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/54d266d7.bfd982ff.js b/assets/js/54d266d7.bfd982ff.js new file mode 100644 index 00000000000..3aef555eb32 --- /dev/null +++ b/assets/js/54d266d7.bfd982ff.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7704],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>b});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),m=l(r),d=i,b=m["".concat(p,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(b,s(s({ref:t},c),{},{components:r})):n.createElement(b,s({ref:t},c))}));function b(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,s=new Array(o);s[0]=d;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[m]="string"==typeof e?e:i,s[1]=a;for(var l=2;l<o;l++)s[l]=r[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},23904:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const o={sidebar_position:3.2,title:"Dimmer",hide_table_of_contents:!0},s="Dimmer",a={unversionedId:"samples/dimmer",id:"samples/dimmer",title:"Dimmer",description:"A potentiometer (slider or rotary) is used to control the brightness (intensity register)",source:"@site/docs/samples/dimmer.mdx",sourceDirName:"samples",slug:"/samples/dimmer",permalink:"/devicescript/samples/dimmer",draft:!1,tags:[],version:"current",sidebarPosition:3.2,frontMatter:{sidebar_position:3.2,title:"Dimmer",hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Button LED",permalink:"/devicescript/samples/button-led"},next:{title:"Weather Display",permalink:"/devicescript/samples/weather-display"}},p={},l=[],c={toc:l},m="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(m,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"dimmer"},"Dimmer"),(0,i.kt)("p",null,"A potentiometer (slider or rotary) is used to control the brightness (intensity register)\nof a light bulb. This example uses a ",(0,i.kt)("a",{parentName:"p",href:"/devices/rp2040/pico"},"Raspberry Pi pico")," but could be redone using ",(0,i.kt)("a",{parentName:"p",href:"/devices"},"other devices"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/pico"\nimport { startLightBulb, startPotentiometer } from "@devicescript/servers"\n\n// starting a potentiometer driver on GP26\n// pinout https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#pinout-and-design-files\nconst slider = startPotentiometer({\n pin: pins.GP26,\n})\n// starting a dimmieable light on pin GP2\nconst led = startLightBulb({\n pin: pins.GP7,\n dimmable: true,\n})\n\n// subscribing to the slider readings and sending them to the intensity register\nslider.reading.subscribe(async level => {\n await led.intensity.write(level)\n})\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/55133214.1717a4d5.js b/assets/js/55133214.1717a4d5.js new file mode 100644 index 00000000000..c5abb8eeb3e --- /dev/null +++ b/assets/js/55133214.1717a4d5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[960],{35318:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>k});var a=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,a,i=function(e,n){if(null==e)return{};var t,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=i,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return t?a.createElement(k,o(o({ref:n},d),{},{components:t})):a.createElement(k,o({ref:n},d))}));function k(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<r;p++)o[p]=t[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,t)}m.displayName="MDXCreateElement"},13668:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=t(25773),i=(t(27378),t(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for bit:radio service"},o="BitRadio",l={unversionedId:"api/clients/bitradio",id:"api/clients/bitradio",title:"BitRadio",description:"DeviceScript client for bit:radio service",source:"@site/docs/api/clients/bitradio.md",sourceDirName:"api/clients",slug:"/api/clients/bitradio",permalink:"/devicescript/api/clients/bitradio",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for bit:radio service"},sidebar:"tutorialSidebar"},s={},p=[{value:"Commands",id:"commands",level:2},{value:"sendString",id:"sendstring",level:3},{value:"sendNumber",id:"sendnumber",level:3},{value:"sendValue",id:"sendvalue",level:3},{value:"sendBuffer",id:"sendbuffer",level:3},{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"group",id:"rw:group",level:3},{value:"transmissionPower",id:"rw:transmissionPower",level:3},{value:"frequencyBand",id:"rw:frequencyBand",level:3}],d={toc:p},u="wrapper";function c(e){let{components:n,...t}=e;return(0,i.kt)(u,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"bitradio"},"BitRadio"),(0,i.kt)("p",null,"Support for sending and receiving packets using the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/pxt-common-packages/blob/master/libs/radio/docs/reference/radio.md"},"Bit Radio protocol"),", typically used between micro:bit devices."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"sendstring"},"sendString"),(0,i.kt)("p",null,"Sends a string payload as a radio message, maximum 18 characters."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"bitRadio.sendString(message: string): Promise<void>\n")),(0,i.kt)("h3",{id:"sendnumber"},"sendNumber"),(0,i.kt)("p",null,"Sends a double precision number payload as a radio message"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"bitRadio.sendNumber(value: number): Promise<void>\n")),(0,i.kt)("h3",{id:"sendvalue"},"sendValue"),(0,i.kt)("p",null,"Sends a double precision number and a name payload as a radio message"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"bitRadio.sendValue(value: number, name: string): Promise<void>\n")),(0,i.kt)("h3",{id:"sendbuffer"},"sendBuffer"),(0,i.kt)("p",null,"Sends a payload of bytes as a radio message"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"bitRadio.sendBuffer(data: Buffer): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Turns on/off the radio antenna."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nconst value = await bitRadio.enabled.read()\nawait bitRadio.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nbitRadio.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:group"},"group"),(0,i.kt)("p",null,"Group used to filter packets"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nconst value = await bitRadio.group.read()\nawait bitRadio.group.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nbitRadio.group.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:transmissionPower"},"transmissionPower"),(0,i.kt)("p",null,"Antenna power to increase or decrease range."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nconst value = await bitRadio.transmissionPower.read()\nawait bitRadio.transmissionPower.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nbitRadio.transmissionPower.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:frequencyBand"},"frequencyBand"),(0,i.kt)("p",null,"Change the transmission and reception band of the radio to the given channel."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nconst value = await bitRadio.frequencyBand.read()\nawait bitRadio.frequencyBand.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { BitRadio } from "@devicescript/core"\n\nconst bitRadio = new BitRadio()\n// ...\nbitRadio.frequencyBand.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/55d44c10.f12aa602.js b/assets/js/55d44c10.f12aa602.js new file mode 100644 index 00000000000..895be0c30d5 --- /dev/null +++ b/assets/js/55d44c10.f12aa602.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5998],{35318:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>v});var r=t(27378);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),s=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=s(e.components);return r.createElement(c.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=s(t),m=o,v=p["".concat(c,".").concat(m)]||p[m]||d[m]||i;return t?r.createElement(v,a(a({ref:n},u),{},{components:t})):r.createElement(v,a({ref:n},u))}));function v(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=m;var l={};for(var c in n)hasOwnProperty.call(n,c)&&(l[c]=n[c]);l.originalType=e,l[p]="string"==typeof e?e:o,a[1]=l;for(var s=2;s<i;s++)a[s]=t[s];return r.createElement.apply(null,a)}return r.createElement.apply(null,t)}m.displayName="MDXCreateElement"},46254:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=t(25773),o=(t(27378),t(35318));const i={sidebar_position:3,description:"Learn how to configure and manage environment settings using Devicescript Cloud, OpenAPI, and Visual Studio Code extension.",keywords:["devicescript cloud","environment configuration","OpenAPI","Visual Studio Code extension","environment management"]},a="Environment",l={unversionedId:"developer/development-gateway/environment",id:"developer/development-gateway/environment",title:"Environment",description:"Learn how to configure and manage environment settings using Devicescript Cloud, OpenAPI, and Visual Studio Code extension.",source:"@site/docs/developer/development-gateway/environment.mdx",sourceDirName:"developer/development-gateway",slug:"/developer/development-gateway/environment",permalink:"/devicescript/developer/development-gateway/environment",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Learn how to configure and manage environment settings using Devicescript Cloud, OpenAPI, and Visual Studio Code extension.",keywords:["devicescript cloud","environment configuration","OpenAPI","Visual Studio Code extension","environment management"]},sidebar:"tutorialSidebar",previous:{title:"Application Telemetry",permalink:"/devicescript/developer/development-gateway/telemetry"},next:{title:"Configuration",permalink:"/devicescript/developer/development-gateway/configuration"}},c={},s=[{value:"value",id:"value",level:2},{value:"subscribe",id:"subscribe",level:2}],u={toc:s},p="wrapper";function d(e){let{components:n,...t}=e;return(0,o.kt)(p,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"environment"},"Environment"),(0,o.kt)("p",null,"An configuration object pushed from the cloud as an observable. The environment can be configured\nthrough the gateway OpenAPI or the Visual Studio Code extension."),(0,o.kt)("p",null,"The environment is cached locally in the settings to handle offline scenarios."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { environment } from "@devicescript/cloud"\n\n// highlight-next-line\nconst env = await environment<{ target: number }>()\n')),(0,o.kt)("h2",{id:"value"},"value"),(0,o.kt)("p",null,"Reads the current value of the environment."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { environment } from "@devicescript/cloud"\nconst env = await environment<{ target: number }>()\n\n// highlight-next-line\nconst { target } = await env.read()\n')),(0,o.kt)("h2",{id:"subscribe"},"subscribe"),(0,o.kt)("p",null,"Subscribes to updates to the environment values."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { environment } from "@devicescript/cloud"\nconst env = await environment<{ target: number }>()\n\n// highlight-next-line\nenv.subscribe(async ({ target }) => {\n console.log(target)\n})\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/56f2b0c6.ca2a10b1.js b/assets/js/56f2b0c6.ca2a10b1.js new file mode 100644 index 00000000000..5c1a8b792a8 --- /dev/null +++ b/assets/js/56f2b0c6.ca2a10b1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5363],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(r),y=o,d=u["".concat(l,".").concat(y)]||u[y]||f[y]||i;return r?n.createElement(d,a(a({ref:t},s),{},{components:r})):n.createElement(d,a({ref:t},s))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=y;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:o,a[1]=c;for(var p=2;p<i;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},7344:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,unlisted:!0},a="ProtoTest",c={unversionedId:"api/clients/prototest",id:"api/clients/prototest",title:"ProtoTest",description:"The Protocol Test service is used internally by the runtime",source:"@site/docs/api/clients/prototest.md",sourceDirName:"api/clients",slug:"/api/clients/prototest",permalink:"/devicescript/api/clients/prototest",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},p=[],s={toc:p},u="wrapper";function f(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prototest"},"ProtoTest"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/prototest/"},"Protocol Test service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,o.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/57b44454.2e757ec0.js b/assets/js/57b44454.2e757ec0.js new file mode 100644 index 00000000000..0e3f7920572 --- /dev/null +++ b/assets/js/57b44454.2e757ec0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4450],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=p(n),d=i,f=c["".concat(l,".").concat(d)]||c[d]||m[d]||o;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:i,a[1]=s;for(var p=2;p<o;p++)a[p]=n[p];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},85208:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>m,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for HID Mouse service"},a="HidMouse",s={unversionedId:"api/clients/hidmouse",id:"api/clients/hidmouse",title:"HidMouse",description:"DeviceScript client for HID Mouse service",source:"@site/docs/api/clients/hidmouse.md",sourceDirName:"api/clients",slug:"/api/clients/hidmouse",permalink:"/devicescript/api/clients/hidmouse",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for HID Mouse service"},sidebar:"tutorialSidebar"},l={},p=[{value:"Commands",id:"commands",level:2},{value:"setButton",id:"setbutton",level:3},{value:"move",id:"move",level:3},{value:"wheel",id:"wheel",level:3}],u={toc:p},c="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(c,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"hidmouse"},"HidMouse"),(0,i.kt)("p",null,"Controls a HID mouse."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { HidMouse } from "@devicescript/core"\n\nconst hidMouse = new HidMouse()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"setbutton"},"setButton"),(0,i.kt)("p",null,"Sets the up/down state of one or more buttons.\nA ",(0,i.kt)("inlineCode",{parentName:"p"},"Click")," is the same as ",(0,i.kt)("inlineCode",{parentName:"p"},"Down")," followed by ",(0,i.kt)("inlineCode",{parentName:"p"},"Up")," after 100ms.\nA ",(0,i.kt)("inlineCode",{parentName:"p"},"DoubleClick")," is two clicks with ",(0,i.kt)("inlineCode",{parentName:"p"},"150ms")," gap between them (that is, ",(0,i.kt)("inlineCode",{parentName:"p"},"100ms")," first click, ",(0,i.kt)("inlineCode",{parentName:"p"},"150ms")," gap, ",(0,i.kt)("inlineCode",{parentName:"p"},"100ms")," second click)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"hidMouse.setButton(buttons: HidMouseButton, ev: HidMouseButtonEvent): Promise<void>\n")),(0,i.kt)("h3",{id:"move"},"move"),(0,i.kt)("p",null,"Moves the mouse by the distance specified.\nIf the time is positive, it specifies how long to make the move."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"hidMouse.move(dx: number, dy: number, time: number): Promise<void>\n")),(0,i.kt)("h3",{id:"wheel"},"wheel"),(0,i.kt)("p",null,"Turns the wheel up or down. Positive if scrolling up.\nIf the time is positive, it specifies how long to make the move."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"hidMouse.wheel(dy: number, time: number): Promise<void>\n")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/57c4248f.60304d87.js b/assets/js/57c4248f.60304d87.js new file mode 100644 index 00000000000..47a0b05b87d --- /dev/null +++ b/assets/js/57c4248f.60304d87.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7425],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>y});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,y=u["".concat(l,".").concat(f)]||u[f]||g[f]||i;return r?n.createElement(y,a(a({ref:t},s),{},{components:r})):n.createElement(y,a({ref:t},s))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:o,a[1]=c;for(var p=2;p<i;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},99563:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>g,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,unlisted:!0},a="Logger",c={unversionedId:"api/clients/logger",id:"api/clients/logger",title:"Logger",description:"The Logger service is used internally by the runtime",source:"@site/docs/api/clients/logger.md",sourceDirName:"api/clients",slug:"/api/clients/logger",permalink:"/devicescript/api/clients/logger",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},p=[],s={toc:p},u="wrapper";function g(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"logger"},"Logger"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/logger/"},"Logger service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,o.kt)("p",null))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5943acca.0bf90ce0.js b/assets/js/5943acca.0bf90ce0.js new file mode 100644 index 00000000000..2c500a0bafc --- /dev/null +++ b/assets/js/5943acca.0bf90ce0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2652],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,k=u["".concat(p,".").concat(d)]||u[d]||m[d]||i;return n?r.createElement(k,l(l({ref:t},s),{},{components:n})):r.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:a,l[1]=o;for(var c=2;c<i;c++)l[c]=n[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},19636:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Heart Rate service"},l="HeartRate",o={unversionedId:"api/clients/heartrate",id:"api/clients/heartrate",title:"HeartRate",description:"DeviceScript client for Heart Rate service",source:"@site/docs/api/clients/heartrate.md",sourceDirName:"api/clients",slug:"/api/clients/heartrate",permalink:"/devicescript/api/clients/heartrate",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Heart Rate service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"heartrate"},"HeartRate"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A sensor approximating the heart rate. "),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Jacdac is NOT suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.")),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { HeartRate } from "@devicescript/core"\n\nconst heartRate = new HeartRate()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The estimated heart rate."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HeartRate } from "@devicescript/core"\n\nconst heartRate = new HeartRate()\n// ...\nconst value = await heartRate.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HeartRate } from "@devicescript/core"\n\nconst heartRate = new HeartRate()\n// ...\nheartRate.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"The estimated error on the reported sensor data."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HeartRate } from "@devicescript/core"\n\nconst heartRate = new HeartRate()\n// ...\nconst value = await heartRate.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HeartRate } from "@devicescript/core"\n\nconst heartRate = new HeartRate()\n// ...\nheartRate.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"The type of physical sensor"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { HeartRate } from "@devicescript/core"\n\nconst heartRate = new HeartRate()\n// ...\nconst value = await heartRate.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5b9becab.6c2a2c25.js b/assets/js/5b9becab.6c2a2c25.js new file mode 100644 index 00000000000..7fde82676f4 --- /dev/null +++ b/assets/js/5b9becab.6c2a2c25.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1382],{35318:(e,t,i)=>{i.d(t,{Zo:()=>m,kt:()=>h});var n=i(27378);function r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function o(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function l(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},a=Object.keys(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),i=t;return e&&(i="function"==typeof e?e(t):o(o({},t),e)),i},m=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var i=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),d=p(i),c=r,h=d["".concat(s,".").concat(c)]||d[c]||u[c]||a;return i?n.createElement(h,o(o({ref:t},m),{},{components:i})):n.createElement(h,o({ref:t},m))}));function h(e,t){var i=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=i.length,o=new Array(a);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:r,o[1]=l;for(var p=2;p<a;p++)o[p]=i[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,i)}c.displayName="MDXCreateElement"},61776:(e,t,i)=>{i.r(t),i.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var n=i(25773),r=(i(27378),i(35318));const a={sidebar_position:6,description:"Learn how to integrate a humidity sensor with HomeKit using HomeBridge, MQTT server, and DeviceScript Gateway.",keywords:["Homebridge","HomeKit","humidity sensor","MQTT","DeviceScript Gateway"],hide_table_of_contents:!0},o="Homebridge + Humidity Sensor",l={unversionedId:"samples/homebridge-humidity",id:"samples/homebridge-humidity",title:"Homebridge + Humidity Sensor",description:"Learn how to integrate a humidity sensor with HomeKit using HomeBridge, MQTT server, and DeviceScript Gateway.",source:"@site/docs/samples/homebridge-humidity.mdx",sourceDirName:"samples",slug:"/samples/homebridge-humidity",permalink:"/devicescript/samples/homebridge-humidity",draft:!1,tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,description:"Learn how to integrate a humidity sensor with HomeKit using HomeBridge, MQTT server, and DeviceScript Gateway.",keywords:["Homebridge","HomeKit","humidity sensor","MQTT","DeviceScript Gateway"],hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Temperature + MQTT",permalink:"/devicescript/samples/temperature-mqtt"},next:{title:"Thermostat + Gateway",permalink:"/devicescript/samples/thermostat-gateway"}},s={},p=[{value:"MQTT server configuration",id:"mqtt-server-configuration",level:2},{value:"Device Gateway configuration",id:"device-gateway-configuration",level:2},{value:"HomeBridge configuration",id:"homebridge-configuration",level:2},{value:"Programming with simulators",id:"programming-with-simulators",level:2},{value:"Programming hardware",id:"programming-hardware",level:2},{value:"Managing the device with the Gateway",id:"managing-the-device-with-the-gateway",level:2},{value:"Next steps",id:"next-steps",level:2}],m={toc:p},d="wrapper";function u(e){let{components:t,...i}=e;return(0,r.kt)(d,(0,n.Z)({},m,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"homebridge--humidity-sensor"},"Homebridge + Humidity Sensor"),(0,r.kt)("p",null,"In this sample, we will use ",(0,r.kt)("a",{parentName:"p",href:"https://homebridge.io/"},"HomeBridge")," to integrate our device with Apple HomeKit. As an example, we will expose a humidity sensor to HomeKit."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://homebridge.io/"},"HomeBridge")," allows you to integrate with smart home devices that do not natively support HomeKit.\nUsing the ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/homebridge-mqttthing"},"HomeBridge MQTTThing plugin"),", you can integrate your MQTT Things with HomeKit.\nThe ",(0,r.kt)("a",{parentName:"p",href:"/developer/development-gateway/gateway"},"DeviceScript Gateway")," can be configured to route ",(0,r.kt)("a",{parentName:"p",href:"/developer/development-gateway/messages"},"cloud messages")," to a MQTT server which can then be used by HomeBridge."),(0,r.kt)("mermaid",{value:"stateDiagram-v2\n device --\x3e gateway\n gateway --\x3e MQTT\n MQTT --\x3e hb\n hb --\x3e HomeKit\n\n MQTT: MQTT server\n gateway: DeviceScript Gateway\n hb: HomeBridge\n hb: HomeBridge MQTTThing"}),(0,r.kt)("h2",{id:"mqtt-server-configuration"},"MQTT server configuration"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Start a MQTT server. You can find a ",(0,r.kt)("a",{parentName:"li",href:"https://mqtt.org/software/"},"list of servers here"),".")),(0,r.kt)("p",null,"You will need the URL, port and optionaly username, password to configure the gateway."),(0,r.kt)("h2",{id:"device-gateway-configuration"},"Device Gateway configuration"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Clone or create a ",(0,r.kt)("a",{parentName:"li",href:"/developer/development-gateway/gateway"},"DeviceScript Gateway")," (by starting a GitHub Codespace for example)"),(0,r.kt)("li",{parentName:"ul"},"Configure it to route the messages to the MQTT server"),(0,r.kt)("li",{parentName:"ul"},"Start the development server. If you are using GitHub Codespaces, make sure to change the visibility of the port to ",(0,r.kt)("inlineCode",{parentName:"li"},"Public")," in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Ports")," pane."),(0,r.kt)("li",{parentName:"ul"},"Copy the connection string that is printed in the terminal output and enter it in the ",(0,r.kt)("inlineCode",{parentName:"li"},"DeviceScript Gateway")," pane in Visual Studio Code. You should get a confirmation that the gateway is connected.")),(0,r.kt)("h2",{id:"homebridge-configuration"},"HomeBridge configuration"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://homebridge.io/"},"HomeBridge")),(0,r.kt)("li",{parentName:"ul"},"Open the plugins pane and install the ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/homebridge-mqttthing"},"HomeBridge MQTTThing plugin")," plugin"),(0,r.kt)("li",{parentName:"ul"},"Click on ",(0,r.kt)("inlineCode",{parentName:"li"},"SETTINGS")," for the MQTTThing plugin and add a ",(0,r.kt)("strong",{parentName:"li"},"Humidity Sensor")," accessory"),(0,r.kt)("li",{parentName:"ul"},"Configure the MQTT settings to connect to the MQTT server"),(0,r.kt)("li",{parentName:"ul"},"Scroll down to the ",(0,r.kt)("strong",{parentName:"li"},"MQTT topics")," and set the ",(0,r.kt)("inlineCode",{parentName:"li"},"get Humidity")," topic to ",(0,r.kt)("inlineCode",{parentName:"li"},"humidity"))),(0,r.kt)("h2",{id:"programming-with-simulators"},"Programming with simulators"),(0,r.kt)("p",null,"We can start programming with devicescript by using the simulator. The simulator allows you to test your code without having to deploy it to a physical device."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Create a new DeviceScript project using the ",(0,r.kt)("inlineCode",{parentName:"li"},"DeviceScript: New Project")," command"),(0,r.kt)("li",{parentName:"ul"},"Open ",(0,r.kt)("inlineCode",{parentName:"li"},"main.ts")," and add the following code and click the ",(0,r.kt)("inlineCode",{parentName:"li"},"Run")," icon on the file menu.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\nimport { throttleTime } from "@devicescript/observables"\n\nconst sensor = new Humidity()\nsensor.reading.pipe(throttleTime(5000)).subscribe(humidity => {\n console.data({ humidity })\n})\n')),(0,r.kt)("p",null,"Once the simulator is running and you start the humidity sensor simulator, you should see the humidity readings in the console."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Open the ",(0,r.kt)("inlineCode",{parentName:"li"},"DeviceScript Gateway")," pane"),(0,r.kt)("li",{parentName:"ul"},"Click on the ",(0,r.kt)("inlineCode",{parentName:"li"},"+")," near devices to register the simulator")),(0,r.kt)("p",null,"Update the program to publish the humidity readings to the cloud."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\nimport { throttleTime } from "@devicescript/observables"\n// highlight-next-line\nimport { publishMessage } from "@devicescript/cloud"\n\nconst sensor = new Humidity()\nsensor.reading.pipe(throttleTime(5000)).subscribe(async humidity => {\n console.data({ humidity })\n // highlight-next-line\n await publishMessage("/humidity", { humidity })\n})\n')),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Notice that the topic starts with ",(0,r.kt)("inlineCode",{parentName:"p"},"/"),". By default DeviceScript routes topics to ",(0,r.kt)("inlineCode",{parentName:"p"},"devs/{deviceid}/from/{topic}"),". Starting the topic with ",(0,r.kt)("inlineCode",{parentName:"p"},"/")," disables this mode.")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"open HomeBridge and you should see the humidity being updated from the values on the sensor. Try to move the slider on the humidity sensor simulator to verify that the values are updated.")),(0,r.kt)("h2",{id:"programming-hardware"},"Programming hardware"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Click the ",(0,r.kt)("inlineCode",{parentName:"li"},"plug")," icon and connect your device"),(0,r.kt)("li",{parentName:"ul"},"Click on the magic wand icon on the file menu and select your hardware device. Then add the code to connect to the ",(0,r.kt)("inlineCode",{parentName:"li"},"startSHTC3"),".")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\nimport { throttleTime } from "@devicescript/observables"\nimport { publishMessage } from "@devicescript/cloud"\n// highlight-next-line\nimport { startSHTC3 } from "@devicescript/drivers"\n\n// highlight-next-line\nconst { humidity: sensor } = await startSHTC3()\n\nsensor.reading.pipe(throttleTime(5000)).subscribe(async humidity => {\n console.data({ humidity })\n await publishMessage("/humidity", { humidity })\n})\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Click the play button to deploy the script to your board and test it.")),(0,r.kt)("h2",{id:"managing-the-device-with-the-gateway"},"Managing the device with the Gateway"),(0,r.kt)("p",null,"The last step is to upload the script to the gateway and assign this script to the device. The gateway will automatically deploy the script to the device."),(0,r.kt)("p",null,"In the Device Gateway view,"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Click ",(0,r.kt)("inlineCode",{parentName:"li"},"+")," next to script and add your script"),(0,r.kt)("li",{parentName:"ul"},"Click ",(0,r.kt)("inlineCode",{parentName:"li"},"script")," icon near the device and assign the script you've just uploaded")),(0,r.kt)("h2",{id:"next-steps"},"Next steps"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"If you want to continue iterating locally, make sure to clear the script assigned to your device (the extension will remind)."),(0,r.kt)("li",{parentName:"ul"},"If you upload a new version of the script, make sure to update the assigned script on the device too.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5ce11ed9.bc202e97.js b/assets/js/5ce11ed9.bc202e97.js new file mode 100644 index 00000000000..6279c44c4cc --- /dev/null +++ b/assets/js/5ce11ed9.bc202e97.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5336],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),m=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=m(e.components);return r.createElement(p.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),s=m(n),d=a,g=s["".concat(p,".").concat(d)]||s[d]||u[d]||i;return n?r.createElement(g,o(o({ref:t},c),{},{components:n})):r.createElement(g,o({ref:t},c))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[s]="string"==typeof e?e:a,o[1]=l;for(var m=2;m<i;m++)o[m]=n[m];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},84642:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>m});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Magnetometer service"},o="Magnetometer",l={unversionedId:"api/clients/magnetomer",id:"api/clients/magnetomer",title:"Magnetometer",description:"DeviceScript client for Magnetometer service",source:"@site/docs/api/clients/magnetomer.md",sourceDirName:"api/clients",slug:"/api/clients/magnetomer",permalink:"/devicescript/api/clients/magnetomer",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Magnetometer service"},sidebar:"tutorialSidebar"},p={},m=[{value:"Commands",id:"commands",level:2},{value:"calibrate",id:"calibrate",level:3},{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3}],c={toc:m},s="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(s,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"magnetometer"},"Magnetometer"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A 3-axis magnetometer."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Magnetometer } from "@devicescript/core"\n\nconst magnetometer = new Magnetometer()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"calibrate"},"calibrate"),(0,a.kt)("p",null,"Forces a calibration sequence where the user/device\nmight have to rotate to be calibrated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"magnetometer.calibrate(): Promise<void>\n")),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Indicates the current magnetic field on magnetometer.\nFor reference: ",(0,a.kt)("inlineCode",{parentName:"p"},"1 mgauss")," is ",(0,a.kt)("inlineCode",{parentName:"p"},"100 nT")," (and ",(0,a.kt)("inlineCode",{parentName:"p"},"1 gauss")," is ",(0,a.kt)("inlineCode",{parentName:"p"},"100 000 nT"),")."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i32 i32 i32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Magnetometer } from "@devicescript/core"\n\nconst magnetometer = new Magnetometer()\n// ...\nmagnetometer.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Absolute estimated error on the readings."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Magnetometer } from "@devicescript/core"\n\nconst magnetometer = new Magnetometer()\n// ...\nconst value = await magnetometer.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Magnetometer } from "@devicescript/core"\n\nconst magnetometer = new Magnetometer()\n// ...\nmagnetometer.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5dd58d1c.a1b06d6e.js b/assets/js/5dd58d1c.a1b06d6e.js new file mode 100644 index 00000000000..cc3a193730d --- /dev/null +++ b/assets/js/5dd58d1c.a1b06d6e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7238],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var i=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,i,a=function(e,t){if(null==e)return{};var n,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var o=i.createContext({}),c=function(e){var t=i.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=c(e.components);return i.createElement(o.Provider,{value:t},e.children)},s="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},u=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),s=c(n),u=a,k=s["".concat(o,".").concat(u)]||s[u]||m[u]||r;return n?i.createElement(k,l(l({ref:t},d),{},{components:n})):i.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,l=new Array(r);l[0]=u;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[s]="string"==typeof e?e:a,l[1]=p;for(var c=2;c<r;c++)l[c]=n[c];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}u.displayName="MDXCreateElement"},44130:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>c});var i=n(25773),a=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Acidity service"},l="Acidity",p={unversionedId:"api/clients/acidity",id:"api/clients/acidity",title:"Acidity",description:"DeviceScript client for Acidity service",source:"@site/docs/api/clients/acidity.md",sourceDirName:"api/clients",slug:"/api/clients/acidity",permalink:"/devicescript/api/clients/acidity",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Acidity service"},sidebar:"tutorialSidebar"},o={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],d={toc:c},s="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(s,(0,i.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"acidity"},"Acidity"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A sensor measuring water acidity, commonly called pH."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The acidity, pH, of water."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u4.12"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n// ...\nconst value = await acidity.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n// ...\nacidity.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Error on the acidity reading."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u4.12"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n// ...\nconst value = await acidity.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n// ...\nacidity.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:minReading"},"minReading"),(0,a.kt)("p",null,"Lowest acidity that can be reported."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u4.12"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n// ...\nconst value = await acidity.minReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,a.kt)("p",null,"Highest acidity that can be reported."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u4.12"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Acidity } from "@devicescript/core"\n\nconst acidity = new Acidity()\n// ...\nconst value = await acidity.maxReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5eb65f11.9b5c2303.js b/assets/js/5eb65f11.9b5c2303.js new file mode 100644 index 00000000000..349bc227523 --- /dev/null +++ b/assets/js/5eb65f11.9b5c2303.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4700],{35318:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var n=a(27378);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||i;return a?n.createElement(k,l(l({ref:t},u),{},{components:a})):n.createElement(k,l({ref:t},u))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:r,l[1]=o;for(var p=2;p<i;p++)l[p]=a[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},39798:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(27378),r=a(38944);const i={tabItem:"tabItem_wHwb"};function l(e){let{children:t,hidden:a,className:l}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(i.tabItem,l),hidden:a},t)}},23930:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(25773),r=a(27378),i=a(38944),l=a(83457),o=a(3620),s=a(30654),p=a(70784),u=a(71819);function c(e){return function(e){return r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function d(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??c(a);return function(e){const t=(0,p.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,o.k6)(),i=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,s._X)(i),(0,r.useCallback)((e=>{if(!i)return;const t=new URLSearchParams(n.location.search);t.set(i,e),n.replace({...n.location,search:t.toString()})}),[i,n])]}function b(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,i=d(e),[l,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:i}))),[s,p]=k({queryString:a,groupId:n}),[c,b]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,i]=(0,u.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&i.set(e)}),[a,i])]}({groupId:n}),h=(()=>{const e=s??c;return m({value:e,tabValues:i})?e:null})();(0,r.useLayoutEffect)((()=>{h&&o(h)}),[h]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:i}))throw new Error(`Can't select invalid tab value=${e}`);o(e),p(e),b(e)}),[p,b,i]),tabValues:i}}var h=a(76457);const g={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function f(e){let{className:t,block:a,selectedValue:o,selectValue:s,tabValues:p}=e;const u=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),d=e=>{const t=e.currentTarget,a=u.indexOf(t),n=p[a].value;n!==o&&(c(t),s(n))},m=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const a=u.indexOf(e.currentTarget)+1;t=u[a]??u[0];break}case"ArrowLeft":{const a=u.indexOf(e.currentTarget)-1;t=u[a]??u[u.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,i.Z)("tabs",{"tabs--block":a},t)},p.map((e=>{let{value:t,label:a,attributes:l}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>u.push(e),onKeyDown:m,onClick:d},l,{className:(0,i.Z)("tabs__item",g.tabItem,l?.className,{"tabs__item--active":o===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const i=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},i.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=b(e);return r.createElement("div",{className:(0,i.Z)("tabs-container",g.tabList)},r.createElement(f,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function N(e){const t=(0,h.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},96035:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var n=a(25773),r=(a(27378),a(35318)),i=a(23930),l=a(39798);const o={title:"Custom Packages"},s="Publishing a DeviceScript package",p={unversionedId:"developer/packages/custom",id:"developer/packages/custom",title:"Custom Packages",description:"Using npm, GitHub releases, or other package manager is the recommended way to share your DeviceScript code.",source:"@site/docs/developer/packages/custom.mdx",sourceDirName:"developer/packages",slug:"/developer/packages/custom",permalink:"/devicescript/developer/packages/custom",draft:!1,tags:[],version:"current",frontMatter:{title:"Custom Packages"},sidebar:"tutorialSidebar",previous:{title:"Packages",permalink:"/devicescript/developer/packages/"},next:{title:"Bundled firmware",permalink:"/devicescript/developer/bundle"}},u={},c=[{value:"TL;DR: Creating a new package",id:"tldr-creating-a-new-package",level:2},{value:"Getting started",id:"getting-started",level:2},{value:"Naming convention",id:"naming-convention",level:2},{value:"Publishing",id:"publishing",level:2},{value:"TypeDoc",id:"typedoc",level:2},{value:"Development notes",id:"development-notes",level:2}],d={toc:c},m="wrapper";function k(e){let{components:t,...a}=e;return(0,r.kt)(m,(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"publishing-a-devicescript-package"},"Publishing a DeviceScript package"),(0,r.kt)("p",null,"Using npm, GitHub releases, or other package manager is the recommended way to share your DeviceScript code.\nThe process is very similar to publishing packages for node.js/web on npm."),(0,r.kt)("p",null,"Here are some examples of custom packages:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/pelikhan/devicescript-adafruit-io/"},"Adafruit.io create data")," to upload sensor data to io.adafruit.com"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/pelikhan/devicescript-note"},"Blues.io note api")," to interact with blues.io notecard"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/pelikhan/devicescript-blynk"},"Blynk.io")," to upload data to blynk.io"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/pelikhan/devicescript-pico-bricks"},"devicescrit-pico-bricks"),", a driver for the Pico Bricks shield"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/mmoskal/devicescript-waveshare-pico-lcd"},"WaveShare Pico-LCD drivers")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/pelikhan/devicescript-pid/"},"devicescript-pid"),", a PID controller")),(0,r.kt)("h2",{id:"tldr-creating-a-new-package"},"TL;DR: Creating a new package"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"install command line tools: ",(0,r.kt)("inlineCode",{parentName:"li"},"npm install -g @devicescript/cli")),(0,r.kt)("li",{parentName:"ul"},"install yarn if you don't have it: ",(0,r.kt)("inlineCode",{parentName:"li"},"npm install -g yarn")),(0,r.kt)("li",{parentName:"ul"},"create folder for your package: ",(0,r.kt)("inlineCode",{parentName:"li"},"mkdir devicescript-my-package")," (best if it starts with ",(0,r.kt)("inlineCode",{parentName:"li"},"devicescript-"),")"),(0,r.kt)("li",{parentName:"ul"},"in that folder run ",(0,r.kt)("inlineCode",{parentName:"li"},"devs init --yarn")," and then ",(0,r.kt)("inlineCode",{parentName:"li"},"devs add npm")),(0,r.kt)("li",{parentName:"ul"},"run VS Code: ",(0,r.kt)("inlineCode",{parentName:"li"},"code .")),(0,r.kt)("li",{parentName:"ul"},'go to "Source Control" side panel, select "Publish to GitHub"')),(0,r.kt)("p",null,"Now you can start building your library."),(0,r.kt)("p",null,"To publish to ",(0,r.kt)("inlineCode",{parentName:"p"},"npm")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"yarn publish")," - it will ask you for version, tag the repo, and publish.\nDon't forget to ",(0,r.kt)("inlineCode",{parentName:"p"},"git push --tags"),"."),(0,r.kt)("h2",{id:"getting-started"},"Getting started"),(0,r.kt)("p",null,"To create a DeviceScript library from your project, run this command\nor use ",(0,r.kt)("strong",{parentName:"p"},"DeviceScript: Add npm...")," from the command palette in Visual Studio Code."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn devs add npm\n")),(0,r.kt)("p",null,"This will:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"remove the ",(0,r.kt)("inlineCode",{parentName:"li"},'"private"')," field from ",(0,r.kt)("inlineCode",{parentName:"li"},"package.json")),(0,r.kt)("li",{parentName:"ul"},"add ",(0,r.kt)("inlineCode",{parentName:"li"},'"devicescript": { "library": true }')," (this is required)"),(0,r.kt)("li",{parentName:"ul"},"set ",(0,r.kt)("inlineCode",{parentName:"li"},'"main": "src/index.ts"')," (",(0,r.kt)("inlineCode",{parentName:"li"},"src/index.ts")," is created if missing)"),(0,r.kt)("li",{parentName:"ul"},"set ",(0,r.kt)("inlineCode",{parentName:"li"},'"files"')," field"),(0,r.kt)("li",{parentName:"ul"},"add ",(0,r.kt)("inlineCode",{parentName:"li"},'"license"')),(0,r.kt)("li",{parentName:"ul"},"add ",(0,r.kt)("inlineCode",{parentName:"li"},'"keywords": ["devicescript"]')," - keep this so npm search works better!"),(0,r.kt)("li",{parentName:"ul"},"add ",(0,r.kt)("inlineCode",{parentName:"li"},'"author"')," and ",(0,r.kt)("inlineCode",{parentName:"li"},'"repository"')," if they can be inferred")),(0,r.kt)("p",null,"All of these can be of course edited in ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," afterwards."),(0,r.kt)("h2",{id:"naming-convention"},"Naming convention"),(0,r.kt)("p",null,"In particular it's recommended to name your package ",(0,r.kt)("inlineCode",{parentName:"p"},"devicescript-something"),"."),(0,r.kt)("h2",{id:"publishing"},"Publishing"),(0,r.kt)("p",null,"After this step, you can publish your package using your favorite npm publishing pipeline."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"A DeviceScript does not require any special build assets.\nYou can create a GitHub release and use as a dependency in your projects."),(0,r.kt)(i.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install --save user/repo@version\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn add user/repo@version\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm add user/repo@version\n"))))),(0,r.kt)("h2",{id:"typedoc"},"TypeDoc"),(0,r.kt)("p",null,"The package templates also adds a script ",(0,r.kt)("inlineCode",{parentName:"p"},"build:docs")," to generate an API documentation\nsite using ",(0,r.kt)("a",{parentName:"p",href:"https://typedoc.org/"},"TypeDoc"),".\nThe ",(0,r.kt)("a",{parentName:"p",href:"https://pelikhan.github.io/devicescript-pico-bricks"},"devicescript-pico-bricks")," is an example of this web site."),(0,r.kt)(i.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm run build:docs\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn build:docs\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run build:docs\n")))),(0,r.kt)("p",null,"You can configure GitHub pages to use the generated site under ",(0,r.kt)("inlineCode",{parentName:"p"},"./docs"),"."),(0,r.kt)("h2",{id:"development-notes"},"Development notes"),(0,r.kt)("p",null,"Note that regular DeviceScript applications typically use ",(0,r.kt)("inlineCode",{parentName:"p"},"src/main.ts")," (or ",(0,r.kt)("inlineCode",{parentName:"p"},"src/mainSomething.ts"),")\nas the application entry point.\nThis is typically, ",(0,r.kt)("strong",{parentName:"p"},"not")," the right choice for ",(0,r.kt)("strong",{parentName:"p"},"library")," entry point."),(0,r.kt)("p",null,"You can keep your ",(0,r.kt)("inlineCode",{parentName:"p"},"src/main.ts")," file as an example or test for the library,\nbut best to stick to ",(0,r.kt)("inlineCode",{parentName:"p"},'"main": "src/index.ts"')," in ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json"),"."))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f7ad2e3.ad9915d5.js b/assets/js/5f7ad2e3.ad9915d5.js new file mode 100644 index 00000000000..ee583c4d1e6 --- /dev/null +++ b/assets/js/5f7ad2e3.ad9915d5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9962],{35318:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>g});var n=t(27378);function s(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){s(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function o(e,r){if(null==e)return{};var t,n,s=function(e,r){if(null==e)return{};var t,n,s={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(s[t]=e[t]);return s}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(s[t]=e[t])}return s}var c=n.createContext({}),l=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},u=function(e){var r=l(e.components);return n.createElement(c.Provider,{value:r},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},b=n.forwardRef((function(e,r){var t=e.components,s=e.mdxType,a=e.originalType,c=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),p=l(t),b=s,g=p["".concat(c,".").concat(b)]||p[b]||d[b]||a;return t?n.createElement(g,i(i({ref:r},u),{},{components:t})):n.createElement(g,i({ref:r},u))}));function g(e,r){var t=arguments,s=r&&r.mdxType;if("string"==typeof e||s){var a=t.length,i=new Array(a);i[0]=b;var o={};for(var c in r)hasOwnProperty.call(r,c)&&(o[c]=r[c]);o.originalType=e,o[p]="string"==typeof e?e:s,i[1]=o;for(var l=2;l<a;l++)i[l]=t[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}b.displayName="MDXCreateElement"},47403:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>l});var n=t(25773),s=(t(27378),t(35318));const a={sidebar_position:3,description:"Learn how to read air pressure sensor data using `AirPressure` client. Subscribe to changes or read the data directly."},i="Register",o={unversionedId:"developer/register",id:"developer/register",title:"Register",description:"Learn how to read air pressure sensor data using `AirPressure` client. Subscribe to changes or read the data directly.",source:"@site/docs/developer/register.mdx",sourceDirName:"developer",slug:"/developer/register",permalink:"/devicescript/developer/register",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,description:"Learn how to read air pressure sensor data using `AirPressure` client. Subscribe to changes or read the data directly."},sidebar:"tutorialSidebar",previous:{title:"Board Configuration",permalink:"/devicescript/developer/board-configuration"},next:{title:"Commands",permalink:"/devicescript/developer/commands"}},c={},l=[{value:"subscribe",id:"subscribe",level:2},{value:"unsubscribe",id:"unsubscribe",level:2},{value:"read",id:"read",level:2}],u={toc:l},p="wrapper";function d(e){let{components:r,...t}=e;return(0,s.kt)(p,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,s.kt)("h1",{id:"register"},"Register"),(0,s.kt)("p",null,"The ",(0,s.kt)("inlineCode",{parentName:"p"},"sensor")," client exposes ",(0,s.kt)("inlineCode",{parentName:"p"},"pressure")," register object.\nWe can read the register value to retreive the air pressure\nsensor last reading. The reading is in ",(0,s.kt)("inlineCode",{parentName:"p"},"hPa")," and should be around 1000."),(0,s.kt)("h2",{id:"subscribe"},"subscribe"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts",metastring:"edit",edit:!0},"const sensor = new ds.AirPressure()\n// highlight-next-line\nsensor.reading.subscribe(async pressure => {\n console.data({ pressure })\n})\n")),(0,s.kt)("p",null,"To apply filtering or thresholding on the changes, see ",(0,s.kt)("a",{parentName:"p",href:"/developer/observables"},"observables"),"."),(0,s.kt)("h2",{id:"unsubscribe"},"unsubscribe"),(0,s.kt)("p",null,"The ",(0,s.kt)("inlineCode",{parentName:"p"},"subscribe")," method returns an ",(0,s.kt)("inlineCode",{parentName:"p"},"unsubscribe")," callback."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts",metastring:"edit",edit:!0},"const sensor = new ds.AirPressure()\nconst unsubscribe = sensor.reading.subscribe(async pressure =>\n console.data({ pressure })\n)\n\n// cleanup\n// highlight-next-line\nunsubscribe()\n")),(0,s.kt)("h2",{id:"read"},"read"),(0,s.kt)("p",null,"You can also read the sensor data using the ",(0,s.kt)("inlineCode",{parentName:"p"},"read")," function."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"const sensor = new ds.AirPressure()\n\n// highlight-next-line\nconst pressure = await sensor.reading.read()\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5fb0aa51.fedc3ad4.js b/assets/js/5fb0aa51.fedc3ad4.js new file mode 100644 index 00000000000..246c75322f2 --- /dev/null +++ b/assets/js/5fb0aa51.fedc3ad4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3709],{35318:(t,e,r)=>{r.d(e,{Zo:()=>m,kt:()=>g});var a=r(27378);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){if(null==t)return{};var r,a,n=function(t,e){if(null==t)return{};var r,a,n={},i=Object.keys(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var l=a.createContext({}),d=function(t){var e=a.useContext(l),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},m=function(t){var e=d(t.components);return a.createElement(l.Provider,{value:e},t.children)},s="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var r=t.components,n=t.mdxType,i=t.originalType,l=t.parentName,m=o(t,["components","mdxType","originalType","parentName"]),s=d(r),k=n,g=s["".concat(l,".").concat(k)]||s[k]||c[k]||i;return r?a.createElement(g,p(p({ref:e},m),{},{components:r})):a.createElement(g,p({ref:e},m))}));function g(t,e){var r=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=r.length,p=new Array(i);p[0]=k;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o[s]="string"==typeof t?t:n,p[1]=o;for(var d=2;d<i;d++)p[d]=r[d];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}k.displayName="MDXCreateElement"},90565:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>l,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var a=r(25773),n=(r(27378),r(35318));const i={description:"Raspberry Pi Pico W"},p="Raspberry Pi Pico W",o={unversionedId:"devices/rp2040/pico-w",id:"devices/rp2040/pico-w",title:"Raspberry Pi Pico W",description:"Raspberry Pi Pico W",source:"@site/docs/devices/rp2040/pico-w.mdx",sourceDirName:"devices/rp2040",slug:"/devices/rp2040/pico-w",permalink:"/devicescript/devices/rp2040/pico-w",draft:!1,tags:[],version:"current",frontMatter:{description:"Raspberry Pi Pico W"},sidebar:"tutorialSidebar",previous:{title:"MSR Brain RP2040 59 v0.1",permalink:"/devicescript/devices/rp2040/msr59"},next:{title:"Raspberry Pi Pico",permalink:"/devicescript/devices/rp2040/pico"}},l={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],m={toc:d},s="wrapper";function c(t){let{components:e,...r}=t;return(0,n.kt)(s,(0,a.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"raspberry-pi-pico-w"},"Raspberry Pi Pico W"),(0,n.kt)("p",null,"RP2040 board from Raspberry Pi with a WiFi chip."),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/raspberry-pi/picowv00.catalog.jpg",alt:"Raspberry Pi Pico W picture"})),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"custom LED (use ",(0,n.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html"},"https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.raspberrypi.com/products/raspberry-pi-pico/"},"https://www.raspberrypi.com/products/raspberry-pi-pico/"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP11")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP12")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP15")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP16")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP17")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP19")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO19"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP20")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP22")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO22"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP26")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO26"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP27")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO27"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP28")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO28"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"led.pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO25"),(0,n.kt)("td",{parentName:"tr",align:"right"},"led.pin, wifi")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Raspberry Pi Pico W".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/pico_w"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board pico_w\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040w-pico_w.uf2"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="pico_w.json"',title:'"pico_w.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",\n "id": "pico_w",\n "devName": "Raspberry Pi Pico W",\n "productId": "0x3a513204",\n "$description": "RP2040 board from Raspberry Pi with a WiFi chip.",\n "archId": "rp2040w",\n "url": "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html",\n "led": {\n "#": "type=100 - special handling for Pico LED",\n "pin": 25,\n "type": 100\n },\n "pins": {\n "GP0": 0,\n "GP1": 1,\n "GP10": 10,\n "GP11": 11,\n "GP12": 12,\n "GP13": 13,\n "GP14": 14,\n "GP15": 15,\n "GP16": 16,\n "GP17": 17,\n "GP18": 18,\n "GP19": 19,\n "GP2": 2,\n "GP20": 20,\n "GP21": 21,\n "GP22": 22,\n "GP26": 26,\n "GP27": 27,\n "GP28": 28,\n "GP3": 3,\n "GP4": 4,\n "GP5": 5,\n "GP6": 6,\n "GP7": 7,\n "GP8": 8,\n "GP9": 9\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/612d74b3.3f0e0d42.js b/assets/js/612d74b3.3f0e0d42.js new file mode 100644 index 00000000000..c5cd190d1df --- /dev/null +++ b/assets/js/612d74b3.3f0e0d42.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8272],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>v});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,v=u["".concat(p,".").concat(d)]||u[d]||m[d]||i;return n?r.createElement(v,l(l({ref:t},s),{},{components:n})):r.createElement(v,l({ref:t},s))}));function v(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:a,l[1]=o;for(var c=2;c<i;c++)l[c]=n[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},96927:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Water level service"},l="WaterLevel",o={unversionedId:"api/clients/waterlevel",id:"api/clients/waterlevel",title:"WaterLevel",description:"DeviceScript client for Water level service",source:"@site/docs/api/clients/waterlevel.md",sourceDirName:"api/clients",slug:"/api/clients/waterlevel",permalink:"/devicescript/api/clients/waterlevel",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Water level service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"waterlevel"},"WaterLevel"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A sensor that measures liquid/water level."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { WaterLevel } from "@devicescript/core"\n\nconst waterLevel = new WaterLevel()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The reported water level."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WaterLevel } from "@devicescript/core"\n\nconst waterLevel = new WaterLevel()\n// ...\nconst value = await waterLevel.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WaterLevel } from "@devicescript/core"\n\nconst waterLevel = new WaterLevel()\n// ...\nwaterLevel.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"The error rage on the current reading"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WaterLevel } from "@devicescript/core"\n\nconst waterLevel = new WaterLevel()\n// ...\nconst value = await waterLevel.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WaterLevel } from "@devicescript/core"\n\nconst waterLevel = new WaterLevel()\n// ...\nwaterLevel.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"The type of physical sensor."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WaterLevel } from "@devicescript/core"\n\nconst waterLevel = new WaterLevel()\n// ...\nconst value = await waterLevel.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/61556d62.9eea0422.js b/assets/js/61556d62.9eea0422.js new file mode 100644 index 00000000000..595a25a2737 --- /dev/null +++ b/assets/js/61556d62.9eea0422.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8244],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(r),y=o,d=u["".concat(l,".").concat(y)]||u[y]||f[y]||i;return r?n.createElement(d,a(a({ref:t},s),{},{components:r})):n.createElement(d,a({ref:t},s))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=y;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:o,a[1]=c;for(var p=2;p<i;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},4096:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,unlisted:!0},a="Control",c={unversionedId:"api/clients/control",id:"api/clients/control",title:"Control",description:"The Control service is used internally by the runtime",source:"@site/docs/api/clients/control.md",sourceDirName:"api/clients",slug:"/api/clients/control",permalink:"/devicescript/api/clients/control",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},p=[],s={toc:p},u="wrapper";function f(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"control"},"Control"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/control/"},"Control service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,o.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/61debf69.226cf674.js b/assets/js/61debf69.226cf674.js new file mode 100644 index 00000000000..7640b65d7fb --- /dev/null +++ b/assets/js/61debf69.226cf674.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2135],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=o,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(g,a(a({ref:t},p),{},{components:n})):r.createElement(g,a({ref:t},p))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:o,a[1]=l;for(var s=2;s<i;s++)a[s]=n[s];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},66300:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(25773),o=(n(27378),n(35318));const i={sidebar_position:2,description:"Learn how to set up and use the DeviceScript command line tool for creating and managing projects, and improve your development workflow.",keywords:["DeviceScript","command line","CLI","project setup","development workflow"]},a="Command Line",l={unversionedId:"getting-started/cli",id:"getting-started/cli",title:"Command Line",description:"Learn how to set up and use the DeviceScript command line tool for creating and managing projects, and improve your development workflow.",source:"@site/docs/getting-started/cli.mdx",sourceDirName:"getting-started",slug:"/getting-started/cli",permalink:"/devicescript/getting-started/cli",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Learn how to set up and use the DeviceScript command line tool for creating and managing projects, and improve your development workflow.",keywords:["DeviceScript","command line","CLI","project setup","development workflow"]},sidebar:"tutorialSidebar",previous:{title:"Local and Remote Workspaces",permalink:"/devicescript/getting-started/vscode/workspaces"},next:{title:"Developer",permalink:"/devicescript/developer/"}},c={},s=[{value:"Setting up the project",id:"setting-up-the-project",level:2},{value:"Launch the build watch",id:"launch-the-build-watch",level:2},{value:"Edit, deploy, debug loop",id:"edit-deploy-debug-loop",level:2}],p={toc:s},d="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(d,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"command-line"},"Command Line"),(0,o.kt)("p",null,"The command line tool is compatible with container and virtual machines so you can run it\nin Docker, GitHub Codespaces, ..."),(0,o.kt)("h2",{id:"setting-up-the-project"},"Setting up the project"),(0,o.kt)("p",null,"Let's get started by installing the ",(0,o.kt)("a",{parentName:"p",href:"/api/cli"},"DeviceScript command line")," and create an empty project"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Open a terminal in a new folder"),(0,o.kt)("li",{parentName:"ul"},"install ",(0,o.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/"},"Node.js 16+")," if not already installed"),(0,o.kt)("li",{parentName:"ul"},"Use the ",(0,o.kt)("inlineCode",{parentName:"li"},"init")," command to setup a new project")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npx --yes @devicescript/cli@latest init\n")),(0,o.kt)("p",null,"You will have the following files created."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},".devicescript/ reserved folder for devicescript generated files\npackage.json project configuration\ndevsconfig.json configure the DeviceScript compiler with additional flags,\n also used by VSCode extension to activate.\nsrc/ directory for DeviceScript sources\nsrc/main.ts usual name for your entry point application\nsrc/tsconfig.json configure the TypeScript compiler to compile DeviceScript syntax\n...\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"open ",(0,o.kt)("inlineCode",{parentName:"li"},"src/main.ts")," and copy the following code")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="src/main.ts"',title:'"src/main.ts"'},'import * as ds from "@devicescript/core"\nimport { debounceTime, filter } from "@devicescript/observables"\n\nconst sensor = new ds.AirPressure()\nconst mouse = new ds.HidMouse()\n// listen for pressure changes\nsensor.reading\n .pipe(\n filter(pressure => pressure > 1400),\n debounceTime(500)\n )\n .subscribe(async () => {\n console.log(`click!`)\n await mouse.setButton(\n ds.HidMouseButton.Left,\n ds.HidMouseButtonEvent.Click\n )\n })\n')),(0,o.kt)("h2",{id:"launch-the-build-watch"},"Launch the build watch"),(0,o.kt)("p",null,"Assuming ",(0,o.kt)("inlineCode",{parentName:"p"},"src/main.ts")," is the root file of your application,\nlaunch a compilation task in watch mode using this command."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"devs devtools src/main.ts\n")),(0,o.kt)("p",null,"or, for short,"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"yarn watch\n")),(0,o.kt)("p",null,"The command line task will also start a local web server that will send the compiled bytecode\nto a developer tools page similar to the one hosted in the docs."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"open the developer tools page, typically http://localhost:8081/ (see cli output)"),(0,o.kt)("li",{parentName:"ul"},"use te developer tools page similarly to the embedded docs page")),(0,o.kt)("h2",{id:"edit-deploy-debug-loop"},"Edit, deploy, debug loop"),(0,o.kt)("p",null,"From here, your developer inner loop will be very similar to building/debugging a web site with hot reload."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"make an edit in your source file, say ",(0,o.kt)("inlineCode",{parentName:"li"},"src/main.ts")),(0,o.kt)("li",{parentName:"ul"},"after a couple seconds, the compiler picks up the changes, produces a new bytecode and sends it to the developer tools"),(0,o.kt)("li",{parentName:"ul"},"the developer tools automatically deploy the bytecode to the selected device (by default the simulator)"),(0,o.kt)("li",{parentName:"ul"},"switch from VS Code to the browser and debug your new code")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/63a77b62.7992a01d.js b/assets/js/63a77b62.7992a01d.js new file mode 100644 index 00000000000..ecace51432e --- /dev/null +++ b/assets/js/63a77b62.7992a01d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5851],{35318:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>N});var r=a(27378);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function i(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,r)}return a}function p(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?i(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function l(t,e){if(null==t)return{};var a,r,n=function(t,e){if(null==t)return{};var a,r,n={},i=Object.keys(t);for(r=0;r<i.length;r++)a=i[r],e.indexOf(a)>=0||(n[a]=t[a]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)a=i[r],e.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}var o=r.createContext({}),d=function(t){var e=r.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},s=function(t){var e=d(t.components);return r.createElement(o.Provider,{value:e},t.children)},m="mdxType",g={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},k=r.forwardRef((function(t,e){var a=t.components,n=t.mdxType,i=t.originalType,o=t.parentName,s=l(t,["components","mdxType","originalType","parentName"]),m=d(a),k=n,N=m["".concat(o,".").concat(k)]||m[k]||g[k]||i;return a?r.createElement(N,p(p({ref:e},s),{},{components:a})):r.createElement(N,p({ref:e},s))}));function N(t,e){var a=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=a.length,p=new Array(i);p[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[m]="string"==typeof t?t:n,p[1]=l;for(var d=2;d<i;d++)p[d]=a[d];return r.createElement.apply(null,p)}return r.createElement.apply(null,a)}k.displayName="MDXCreateElement"},17935:(t,e,a)=>{a.r(e),a.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=a(25773),n=(a(27378),a(35318));const i={description:"Espressif ESP32-S3 (bare)"},p="Espressif ESP32-S3 (bare)",l={unversionedId:"devices/esp32/esp32s3-bare",id:"devices/esp32/esp32s3-bare",title:"Espressif ESP32-S3 (bare)",description:"Espressif ESP32-S3 (bare)",source:"@site/docs/devices/esp32/esp32s3-bare.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32s3-bare",permalink:"/devicescript/devices/esp32/esp32s3-bare",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32-S3 (bare)"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32-S2 (bare)",permalink:"/devicescript/devices/esp32/esp32s2-bare"},next:{title:"Espressif ESP32-S3 DevKitM",permalink:"/devicescript/devices/esp32/esp32s3-devkit-m"}},o={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:d},m="wrapper";function g(t){let{components:e,...a}=t;return(0,n.kt)(m,(0,r.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"espressif-esp32-s3-bare"},"Espressif ESP32-S3 (bare)"),(0,n.kt)("p",null,"A bare ESP32-S3 board without any pin functions."),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Serial logging on pin P43 at 115200 8N1")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.espressif.com/en/products/socs/esp32-s3"},"https://www.espressif.com/en/products/socs/esp32-s3"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P11")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P12")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P15")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P16")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P17")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P33")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P34")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P38")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P39")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO39"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P40")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO40"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P41")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO41"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P42")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO42"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P43")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,n.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P44")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO44"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P45")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO45"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P46")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO46"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P47")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO47"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P48")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO48"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32-S3 (bare)".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32s3_bare"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32s3_bare\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s3-esp32s3_bare-0x0.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32s3_bare.json"',title:'"esp32s3_bare.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32s3_bare",\n "devName": "Espressif ESP32-S3 (bare)",\n "productId": "0x3e121501",\n "$description": "A bare ESP32-S3 board without any pin functions.",\n "archId": "esp32s3",\n "url": "https://www.espressif.com/en/products/socs/esp32-s3",\n "log": {\n "pinTX": "P43"\n },\n "pins": {\n "#P35": 35,\n "#P36": 36,\n "#P37": 37,\n "P0": 0,\n "P1": 1,\n "P10": 10,\n "P11": 11,\n "P12": 12,\n "P13": 13,\n "P14": 14,\n "P15": 15,\n "P16": 16,\n "P17": 17,\n "P18": 18,\n "P2": 2,\n "P21": 21,\n "P3": 3,\n "P33": 33,\n "P34": 34,\n "P38": 38,\n "P39": 39,\n "P4": 4,\n "P40": 40,\n "P41": 41,\n "P42": 42,\n "P43": 43,\n "P44": 44,\n "P45": 45,\n "P46": 46,\n "P47": 47,\n "P48": 48,\n "P5": 5,\n "P6": 6,\n "P7": 7,\n "P8": 8,\n "P9": 9\n }\n}\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6407abb7.b6fb693e.js b/assets/js/6407abb7.b6fb693e.js new file mode 100644 index 00000000000..2934918a6eb --- /dev/null +++ b/assets/js/6407abb7.b6fb693e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6512],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var n=t(27378);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){o(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},u="mdxType",v={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),d=o,f=u["".concat(c,".").concat(d)]||u[d]||v[d]||a;return t?n.createElement(f,i(i({ref:r},l),{},{components:t})):n.createElement(f,i({ref:r},l))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=d;var s={};for(var c in r)hasOwnProperty.call(r,c)&&(s[c]=r[c]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=t[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}d.displayName="MDXCreateElement"},30914:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>v,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=t(25773),o=(t(27378),t(35318));const a={description:"Mounts a servo",title:"Servo"},i="Servo",s={unversionedId:"api/drivers/servo",id:"api/drivers/servo",title:"Servo",description:"Mounts a servo",source:"@site/docs/api/drivers/servo.md",sourceDirName:"api/drivers",slug:"/api/drivers/servo",permalink:"/devicescript/api/drivers/servo",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a servo",title:"Servo"},sidebar:"tutorialSidebar",previous:{title:"Rotary Encoder",permalink:"/devicescript/api/drivers/rotaryencoder"},next:{title:"SHT30",permalink:"/devicescript/api/drivers/sht30"}},c={},p=[],l={toc:p},u="wrapper";function v(e){let{components:r,...t}=e;return(0,o.kt)(u,(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"servo"},"Servo"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startServo")," function starts on-board server for servo,\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/servo"},"client")," bound to the server."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio, delay } from "@devicescript/core"\nimport { startServo } from "@devicescript/servers"\n\nconst sensor = startServo({\n pin: ds.gpio(3),\n})\nsetInterval(async () => {\n await sensor.angle.write(-45)\n await delay(1000)\n await sensor.angle.write(45)\n}, 1000)\n')))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6496ecc8.327c78ba.js b/assets/js/6496ecc8.327c78ba.js new file mode 100644 index 00000000000..a328c0892da --- /dev/null +++ b/assets/js/6496ecc8.327c78ba.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7086],{35318:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var n=t(27378);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){o(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),p=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},c=function(e){var r=p(e.components);return n.createElement(l.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},v=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(t),v=o,f=u["".concat(l,".").concat(v)]||u[v]||d[v]||i;return t?n.createElement(f,a(a({ref:r},c),{},{components:t})):n.createElement(f,a({ref:r},c))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=v;var s={};for(var l in r)hasOwnProperty.call(r,l)&&(s[l]=r[l]);s.originalType=e,s[u]="string"==typeof e?e:o,a[1]=s;for(var p=2;p<i;p++)a[p]=t[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,t)}v.displayName="MDXCreateElement"},84525:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var n=t(25773),o=(t(27378),t(35318));const i={description:"Mounts a sound level sensor",title:"Sound Level"},a="Soil Moisture",s={unversionedId:"api/drivers/soundlevel",id:"api/drivers/soundlevel",title:"Sound Level",description:"Mounts a sound level sensor",source:"@site/docs/api/drivers/soundlevel.md",sourceDirName:"api/drivers",slug:"/api/drivers/soundlevel",permalink:"/devicescript/api/drivers/soundlevel",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a sound level sensor",title:"Sound Level"},sidebar:"tutorialSidebar",previous:{title:"Soil Moisture",permalink:"/devicescript/api/drivers/soilmoisture"},next:{title:"SSD1306",permalink:"/devicescript/api/drivers/ssd1306"}},l={},p=[],c={toc:p},u="wrapper";function d(e){let{components:r,...t}=e;return(0,o.kt)(u,(0,n.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"soil-moisture"},"Soil Moisture"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startSoundLevel")," starts a simple analog sensor server that models a sound level sensor\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/soundlevel"},"client")," bound to the server."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Please refer to the ",(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("a",{parentName:"strong",href:"/developer/drivers/analog/"},"analog documentation"))," for details.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startSoundLevel } from "@devicescript/servers"\n\nconst sensor = startSoundLevel({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(level => console.data({ level }))\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6711afe8.232e3e5e.js b/assets/js/6711afe8.232e3e5e.js new file mode 100644 index 00000000000..23c797e1371 --- /dev/null +++ b/assets/js/6711afe8.232e3e5e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6291],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var c=a.createContext({}),d=function(e){var t=a.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=d(e.components);return a.createElement(c.Provider,{value:t},e.children)},l="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),l=d(r),h=n,m=l["".concat(c,".").concat(h)]||l[h]||u[h]||i;return r?a.createElement(m,o(o({ref:t},p),{},{components:r})):a.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,o=new Array(i);o[0]=h;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[l]="string"==typeof e?e:n,o[1]=s;for(var d=2;d<i;d++)o[d]=r[d];return a.createElement.apply(null,o)}return a.createElement.apply(null,r)}h.displayName="MDXCreateElement"},55950:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=r(25773),n=(r(27378),r(35318));const i={sidebar_position:3.9,hide_table_of_contents:!0},o="Weather Dashboard",s={unversionedId:"samples/weather-dashboard",id:"samples/weather-dashboard",title:"Weather Dashboard",description:"This sample uses a ValueDashboard to render temperature, humidity readings",source:"@site/docs/samples/weather-dashboard.mdx",sourceDirName:"samples",slug:"/samples/weather-dashboard",permalink:"/devicescript/samples/weather-dashboard",draft:!1,tags:[],version:"current",sidebarPosition:3.9,frontMatter:{sidebar_position:3.9,hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Weather Display",permalink:"/devicescript/samples/weather-display"},next:{title:"Copy Paste Button",permalink:"/devicescript/samples/copy-paste-button"}},c={},d=[{value:"Xiao + Expansion board + BME680",id:"xiao--expansion-board--bme680",level:2}],p={toc:d},l="wrapper";function u(e){let{components:t,...r}=e;return(0,n.kt)(l,(0,a.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"weather-dashboard"},"Weather Dashboard"),(0,n.kt)("p",null,"This sample uses a ",(0,n.kt)("inlineCode",{parentName:"p"},"ValueDashboard")," to render temperature, humidity readings\non a character screen. A character screen could be a LCD screen or a OLED/TFT display."),(0,n.kt)("p",null,"The ",(0,n.kt)("inlineCode",{parentName:"p"},"ValueDashboard")," is a helper class that renders the value. It is generic\nand takes the list of data row to display in the constructor to provide a better\ncompletion experience."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { CharacterScreen } from "@devicescript/core"\n// highlight-next-line\nimport { ValueDashboard } from "@devicescript/runtime"\n\nconst screen = new CharacterScreen()\n// highlight-start\nconst dashboard = new ValueDashboard(screen, {\n temperature: { digits: 1, unit: "C" },\n humi: { digits: 0, unit: "%" },\n})\n// highlight-end\n')),(0,n.kt)("p",null,"Once the dashboard is setup, you can update the ",(0,n.kt)("inlineCode",{parentName:"p"},"values")," record and call ",(0,n.kt)("inlineCode",{parentName:"p"},"show")," to render again."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { CharacterScreen, Humidity, Temperature } from "@devicescript/core"\nimport { ValueDashboard } from "@devicescript/runtime"\n\nconst temperature = new Temperature()\nconst humidity = new Humidity()\nconst screen = new CharacterScreen()\nconst dashboard = new ValueDashboard(screen, {\n temperature: { digits: 1, unit: "C" },\n humi: { digits: 0, unit: "%" },\n})\nsetInterval(async () => {\n // highlight-start\n dashboard.values.temperature = await temperature.reading.read()\n dashboard.values.humi = await humidity.reading.read()\n await dashboard.show()\n // highlight-end\n}, 1000)\n')),(0,n.kt)("h2",{id:"xiao--expansion-board--bme680"},"Xiao + Expansion board + BME680"),(0,n.kt)("p",null,"The generic sample above can be specialized to run on a Xiao ESP32-C3 with expansion board."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import {\n XiaoExpansionBoard,\n startCharacterScreen,\n startBME680,\n} from "@devicescript/drivers"\nimport { ValueDashboard } from "@devicescript/runtime"\n\nconst board = new XiaoExpansionBoard()\nconst { temperature, humidity } = await startBME680({\n address: 0x76\n})\nconst display = await board.startDisplay()\nconst screen = await startCharacterScreen(display)\n\nconst dashboard = new ValueDashboard(screen, {\n temperature: { digits: 1, unit: "C" },\n humi: { digits: 0, unit: "%" },\n})\n\nsetInterval(async () => {\n dashboard.values.temperature = await temperature.reading.read()\n dashboard.values.humi = await humidity.reading.read()\n await dashboard.show()\n}, 1000)\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/67482af5.ad84dde0.js b/assets/js/67482af5.ad84dde0.js new file mode 100644 index 00000000000..49f4f4d4eaa --- /dev/null +++ b/assets/js/67482af5.ad84dde0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1030],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),s=u(n),m=i,k=s["".concat(l,".").concat(m)]||s[m]||d[m]||a;return n?r.createElement(k,o(o({ref:t},c),{},{components:n})):r.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[s]="string"==typeof e?e:i,o[1]=p;for(var u=2;u<a;u++)o[u]=n[u];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},46070:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for MIDI output service"},o="MidiOutput",p={unversionedId:"api/clients/midioutput",id:"api/clients/midioutput",title:"MidiOutput",description:"DeviceScript client for MIDI output service",source:"@site/docs/api/clients/midioutput.md",sourceDirName:"api/clients",slug:"/api/clients/midioutput",permalink:"/devicescript/api/clients/midioutput",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for MIDI output service"},sidebar:"tutorialSidebar"},l={},u=[{value:"Commands",id:"commands",level:2},{value:"clear",id:"clear",level:3},{value:"send",id:"send",level:3},{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3}],c={toc:u},s="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(s,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"midioutput"},"MidiOutput"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A MIDI output device."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { MidiOutput } from "@devicescript/core"\n\nconst midiOutput = new MidiOutput()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"clear"},"clear"),(0,i.kt)("p",null,"Clears any pending send data that has not yet been sent from the MIDIOutput's queue."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"midiOutput.clear(): Promise<void>\n")),(0,i.kt)("h3",{id:"send"},"send"),(0,i.kt)("p",null,"Enqueues the message to be sent to the corresponding MIDI port"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"midiOutput.send(data: Buffer): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Opens or closes the port to the MIDI device"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MidiOutput } from "@devicescript/core"\n\nconst midiOutput = new MidiOutput()\n// ...\nconst value = await midiOutput.enabled.read()\nawait midiOutput.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MidiOutput } from "@devicescript/core"\n\nconst midiOutput = new MidiOutput()\n// ...\nmidiOutput.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/67ed5e14.6790e347.js b/assets/js/67ed5e14.6790e347.js new file mode 100644 index 00000000000..198802314d9 --- /dev/null +++ b/assets/js/67ed5e14.6790e347.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5820],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>g});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),d=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=d(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=d(r),u=a,g=c["".concat(l,".").concat(u)]||c[u]||m[u]||i;return r?n.createElement(g,o(o({ref:t},s),{},{components:r})):n.createElement(g,o({ref:t},s))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=u;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[c]="string"==typeof e?e:a,o[1]=p;for(var d=2;d<i;d++)o[d]=r[d];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},70445:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=r(25773),a=(r(27378),r(35318));const i={description:"Seeed Studio XIAO ESP32C3"},o="Seeed Studio XIAO ESP32C3",p={unversionedId:"devices/esp32/seeed-xiao-esp32c3",id:"devices/esp32/seeed-xiao-esp32c3",title:"Seeed Studio XIAO ESP32C3",description:"Seeed Studio XIAO ESP32C3",source:"@site/docs/devices/esp32/seeed-xiao-esp32c3.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/seeed-xiao-esp32c3",permalink:"/devicescript/devices/esp32/seeed-xiao-esp32c3",draft:!1,tags:[],version:"current",frontMatter:{description:"Seeed Studio XIAO ESP32C3"},sidebar:"tutorialSidebar",previous:{title:"Seeed Studio XIAO ESP32C3 with MSR218 base",permalink:"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218"},next:{title:"RP2040",permalink:"/devicescript/devices/rp2040/"}},l={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:d},c="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(c,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"seeed-studio-xiao-esp32c3"},"Seeed Studio XIAO ESP32C3"),(0,a.kt)("p",null,"A tiny ESP32-C3 board."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/seeed-studio/xiaoesp32c3v00.catalog.jpg",alt:"Seeed Studio XIAO ESP32C3 picture"})),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin TX_D6 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: buttonBOOT (button)")),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,a.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html"},"https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html"))),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"A0_D0")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"A1_D1")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"A2_D2")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"A3_D3")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"MISO_D9")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,a.kt)("td",{parentName:"tr",align:"right"},"$services.buttonBOOT","[0]",".pin, boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"MOSI_D10")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"RX_D7")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,a.kt)("td",{parentName:"tr",align:"right"},"bootUart, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"SCK_D8")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"SCL_D5")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"SDA_D4")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"TX_D6")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, bootUart, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Seeed Studio XIAO ESP32C3".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/seeed_xiao_esp32c3"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board seeed_xiao_esp32c3\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="seeed_xiao_esp32c3.json"',title:'"seeed_xiao_esp32c3.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "seeed_xiao_esp32c3",\n "devName": "Seeed Studio XIAO ESP32C3",\n "productId": "0x3eff6b51",\n "$description": "A tiny ESP32-C3 board.",\n "archId": "esp32c3",\n "url": "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html",\n "$services": [\n {\n "name": "buttonBOOT",\n "pin": "MISO_D9",\n "service": "button"\n }\n ],\n "log": {\n "pinTX": "TX_D6"\n },\n "pins": {\n "A0_D0": 2,\n "A1_D1": 3,\n "A2_D2": 4,\n "A3_D3": 5,\n "MISO_D9": 9,\n "MOSI_D10": 10,\n "RX_D7": 20,\n "SCK_D8": 8,\n "SCL_D5": 7,\n "SDA_D4": 6,\n "TX_D6": 21\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/68830679.2fd9c54a.js b/assets/js/68830679.2fd9c54a.js new file mode 100644 index 00000000000..6e6078f3a80 --- /dev/null +++ b/assets/js/68830679.2fd9c54a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1495],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>b});var n=r(27378);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),p=l(r),m=s,b=p["".concat(c,".").concat(m)]||p[m]||d[m]||o;return r?n.createElement(b,i(i({ref:t},u),{},{components:r})):n.createElement(b,i({ref:t},u))}));function b(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,i=new Array(o);i[0]=m;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[p]="string"==typeof e?e:s,i[1]=a;for(var l=2;l<o;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},90705:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var n=r(25773),s=(r(27378),r(35318));const o={sidebar_position:3.01,description:"Learn how to generate a mouse click with an air pressure sensor using TypeScript and the HidMouse class from the ds library. Tune the pressure threshold to detect a user blowing on the sensor and optimize debouncing with observables.",keywords:["air pressure sensor","mouse click","TypeScript","HidMouse","ds library"]},i="Commands",a={unversionedId:"developer/commands",id:"developer/commands",title:"Commands",description:"Learn how to generate a mouse click with an air pressure sensor using TypeScript and the HidMouse class from the ds library. Tune the pressure threshold to detect a user blowing on the sensor and optimize debouncing with observables.",source:"@site/docs/developer/commands.mdx",sourceDirName:"developer",slug:"/developer/commands",permalink:"/devicescript/developer/commands",draft:!1,tags:[],version:"current",sidebarPosition:3.01,frontMatter:{sidebar_position:3.01,description:"Learn how to generate a mouse click with an air pressure sensor using TypeScript and the HidMouse class from the ds library. Tune the pressure threshold to detect a user blowing on the sensor and optimize debouncing with observables.",keywords:["air pressure sensor","mouse click","TypeScript","HidMouse","ds library"]},sidebar:"tutorialSidebar",previous:{title:"Register",permalink:"/devicescript/developer/register"},next:{title:"Drivers",permalink:"/devicescript/developer/drivers/"}},c={},l=[],u={toc:l},p="wrapper";function d(e){let{components:t,...r}=e;return(0,s.kt)(p,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("h1",{id:"commands"},"Commands"),(0,s.kt)("p",null,"Let's assume that ",(0,s.kt)("inlineCode",{parentName:"p"},"1400")," hPa is a threshold high enough\nto detect a user blowing on the sensor; then we\ncan add code to generate a mouse click."),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"1400")," is rater arbitrary and this is the kind of constants\nthat you will want to tune using the actual hardware sensors,\nnot just a simulator."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"if (pressure > 1400) {\n await mouse.setButton(ds.HidMouseButton.Left, ds.HidMouseButtonEvent.Click)\n}\n")),(0,s.kt)("p",null,"The full sample looks like this."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts",metastring:"edit",edit:!0},'console.log("starting...")\nconst sensor = new ds.AirPressure()\nconst mouse = new ds.HidMouse()\n// listen for pressure changes\nsensor.reading.subscribe(async pressure => {\n console.log(pressure)\n // user blows in straw\n if (pressure > 1400) {\n // click!\n console.log(`click!`)\n await mouse.setButton(\n ds.HidMouseButton.Left,\n ds.HidMouseButtonEvent.Click\n )\n // debouncing\n await ds.sleep(50)\n }\n})\n')),(0,s.kt)("p",null,"To get better debouncing, see ",(0,s.kt)("a",{parentName:"p",href:"/developer/observables"},"observables"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6a0d6083.6bd16d8c.js b/assets/js/6a0d6083.6bd16d8c.js new file mode 100644 index 00000000000..935855c2fe6 --- /dev/null +++ b/assets/js/6a0d6083.6bd16d8c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8634],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(27378);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,l=function(e,t){if(null==e)return{};var n,r,l={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,l=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=c(n),f=l,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return n?r.createElement(m,a(a({ref:t},s),{},{components:n})):r.createElement(m,a({ref:t},s))}));function m(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var i=n.length,a=new Array(i);a[0]=f;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[d]="string"==typeof e?e:l,a[1]=o;for(var c=2;c<i;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},85972:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(25773),l=(n(27378),n(35318));const i={},a="PixelBuffer",o={unversionedId:"api/runtime/pixelbuffer",id:"api/runtime/pixelbuffer",title:"PixelBuffer",description:"A 1D color vector to support color manipulation of LED strips. All colors are 24bit RGB colors.",source:"@site/docs/api/runtime/pixelbuffer.mdx",sourceDirName:"api/runtime",slug:"/api/runtime/pixelbuffer",permalink:"/devicescript/api/runtime/pixelbuffer",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Palette",permalink:"/devicescript/api/runtime/palette"},next:{title:"schedule",permalink:"/devicescript/api/runtime/schedule"}},p={},c=[{value:"Usage",id:"usage",level:2},{value:"<code>at</code>, <code>setAt</code>",id:"at-setat",level:3},{value:"<code>clear</code>",id:"clear",level:3},{value:"<code>view</code>",id:"view",level:3},{value:"<code>correctGamma</code>",id:"correctgamma",level:3},{value:"<code>rotate</code>",id:"rotate",level:3},{value:"Helpers",id:"helpers",level:2},{value:"<code>fillSolid</code>",id:"fillsolid",level:3},{value:"<code>fillRainbow</code>",id:"fillrainbow",level:3},{value:"<code>fillGradient</code>",id:"fillgradient",level:3},{value:"<code>fillPalette</code>",id:"fillpalette",level:3},{value:"<code>fillBarGraph</code>",id:"fillbargraph",level:3}],s={toc:c},d="wrapper";function u(e){let{components:t,...n}=e;return(0,l.kt)(d,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"pixelbuffer"},"PixelBuffer"),(0,l.kt)("p",null,"A 1D color vector to support color manipulation of LED strips. All colors are 24bit RGB colors."),(0,l.kt)("p",null,"The pixel buffer is typically accessed through a ",(0,l.kt)("a",{parentName:"p",href:"/api/clients/led"},"Led")," client."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport "@devicescript/runtime"\n\nconst led = new Led()\n// highlight-next-line\nconst pixels = await led.buffer()\n')),(0,l.kt)("p",null,"It can also be allocated using ",(0,l.kt)("inlineCode",{parentName:"p"},"pixelBuffer"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { PixelBuffer } from "@devicescript/runtime"\n\n// highlight-next-line\nconst pixels = PixelBuffer.alloc(32)\n')),(0,l.kt)("h2",{id:"usage"},"Usage"),(0,l.kt)("h3",{id:"at-setat"},(0,l.kt)("inlineCode",{parentName:"h3"},"at"),", ",(0,l.kt)("inlineCode",{parentName:"h3"},"setAt")),(0,l.kt)("p",null,"Indexing functions similar to ",(0,l.kt)("inlineCode",{parentName:"p"},"Array.at"),", they allow to set color of individual LEDs and support negative indices."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"const c0 = pixels.at(0)\npixels.setAt(1, c0)\n")),(0,l.kt)("h3",{id:"clear"},(0,l.kt)("inlineCode",{parentName:"h3"},"clear")),(0,l.kt)("p",null,"Clears all colors to ",(0,l.kt)("inlineCode",{parentName:"p"},"#000000"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"pixels.clear()\n")),(0,l.kt)("h3",{id:"view"},(0,l.kt)("inlineCode",{parentName:"h3"},"view")),(0,l.kt)("p",null,"Creates a aliased range view of the buffer so that you can apply operations on a subset of the colors."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"const view = pixels.view(5, 10)\nview.clear()\n")),(0,l.kt)("h3",{id:"correctgamma"},(0,l.kt)("inlineCode",{parentName:"h3"},"correctGamma")),(0,l.kt)("p",null,"Applies gamma correction to compensate LED and eye perception"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"// highlight-next-line\npixels.correctGamma()\n")),(0,l.kt)("h3",{id:"rotate"},(0,l.kt)("inlineCode",{parentName:"h3"},"rotate")),(0,l.kt)("p",null,"Shifts the colors in the buffer by the given offset. Use a negative offset to shift right."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"pixels.rotate(-1)\n")),(0,l.kt)("h2",{id:"helpers"},"Helpers"),(0,l.kt)("p",null,"Here are a few helpers built for ",(0,l.kt)("inlineCode",{parentName:"p"},"PixelBuffer"),", but many other could be added!"),(0,l.kt)("h3",{id:"fillsolid"},(0,l.kt)("inlineCode",{parentName:"h3"},"fillSolid")),(0,l.kt)("p",null,"This helper function asigns the given color to the entire range."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport { fillSolid } from "@devicescript/runtime"\n\nconst led = new Led()\nconst pixels = await led.buffer()\n\n// highlight-next-line\nfillSolid(pixels, 0x00_ff_00)\n\nawait led.show()\n')),(0,l.kt)("h3",{id:"fillrainbow"},(0,l.kt)("inlineCode",{parentName:"h3"},"fillRainbow")),(0,l.kt)("p",null,"Fills the buffer by interpolating the hue of ",(0,l.kt)("inlineCode",{parentName:"p"},"hsv")," colors."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport { fillRainbow } from "@devicescript/runtime"\n\nconst led = new Led()\nconst pixels = await led.buffer()\n\n// highlight-next-line\nfillRainbow(pixels)\n\nawait led.show()\n')),(0,l.kt)("p",null,"By default, the helper interpolates between ",(0,l.kt)("inlineCode",{parentName:"p"},"0")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"0xff"),",\nbut this can be changed with optional parameters."),(0,l.kt)("h3",{id:"fillgradient"},(0,l.kt)("inlineCode",{parentName:"h3"},"fillGradient")),(0,l.kt)("p",null,"Fills with a linear interpolation of two colors accross the RGB space."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport { fillGradient } from "@devicescript/runtime"\n\nconst led = new Led()\nconst pixels = await led.buffer()\n\n// highlight-next-line\nfillGradient(pixels, 0x00_ff_00, 0x00_00_ff, { circular: true })\n\nawait led.show()\n')),(0,l.kt)("h3",{id:"fillpalette"},(0,l.kt)("inlineCode",{parentName:"h3"},"fillPalette")),(0,l.kt)("p",null,"Fills by interpolating the colors of a palette."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport { Palette } from "@devicescript/graphics"\nimport { fillPalette } from "@devicescript/runtime"\n\nconst led = new Led()\nconst pixels = await led.buffer()\nconst palette = Palette.arcade()\n\n// highlight-next-line\nfillPalette(pixels, palette)\n\nawait led.show()\n')),(0,l.kt)("h3",{id:"fillbargraph"},(0,l.kt)("inlineCode",{parentName:"h3"},"fillBarGraph")),(0,l.kt)("p",null,"A tiny bar chart engine to render on a value on a LED strip"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport { fillBarGraph } from "@devicescript/runtime"\n\nconst led = new Led()\nconst pixels = await led.buffer()\n\nconst current = 25\nconst max = 100\n\n// highlight-next-line\nfillBarGraph(pixels, current, max)\n\nawait led.show()\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6a350437.7eac9e08.js b/assets/js/6a350437.7eac9e08.js new file mode 100644 index 00000000000..2006d961892 --- /dev/null +++ b/assets/js/6a350437.7eac9e08.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[49],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=i,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(g,a(a({ref:t},p),{},{components:n})):r.createElement(g,a({ref:t},p))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[d]="string"==typeof e?e:i,a[1]=s;for(var l=2;l<o;l++)a[l]=n[l];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},85829:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var r=n(25773),i=(n(27378),n(35318));const o={sidebar_position:2,description:"Learn how the toString() method works in DeviceScript and how it helps in string conversion for objects with limited stack space on embedded devices.",keywords:["DeviceScript","toString method","string conversion","embedded devices","util.inspect"]},a="toString() method",s={unversionedId:"language/tostring",id:"language/tostring",title:"toString() method",description:"Learn how the toString() method works in DeviceScript and how it helps in string conversion for objects with limited stack space on embedded devices.",source:"@site/docs/language/tostring.mdx",sourceDirName:"language",slug:"/language/tostring",permalink:"/devicescript/language/tostring",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Learn how the toString() method works in DeviceScript and how it helps in string conversion for objects with limited stack space on embedded devices.",keywords:["DeviceScript","toString method","string conversion","embedded devices","util.inspect"]},sidebar:"tutorialSidebar",previous:{title:"Async/await and promises",permalink:"/devicescript/language/async"},next:{title:"Strings and Unicode",permalink:"/devicescript/language/strings"}},c={},l=[],p={toc:l},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"tostring-method"},"toString() method"),(0,i.kt)("p",null,"ECMAScript spec requires converting values to string, deep in the internals of the runtime\n(in particular, in ",(0,i.kt)("inlineCode",{parentName:"p"},"a + b"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a[b]"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a == b"),", etc.).\nIt also mandates that these conversions use the ",(0,i.kt)("inlineCode",{parentName:"p"},".toString()")," method if provided on the object\nby the user."),(0,i.kt)("p",null,"These are complex to implement in very limited stack space available on embedded devices.\nConsider the following: ",(0,i.kt)("inlineCode",{parentName:"p"},".toString()")," triggers code execution with\nsay property indexing, which triggers another ",(0,i.kt)("inlineCode",{parentName:"p"},".toString()"),", etc.\nSee ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/issues/41"},"issue"),"."),(0,i.kt)("p",null,"To alleviate this problem, the built-in string conversion for objects in DeviceScript\nis similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"util.inspect()")," in node.js - it will show a limited number of object fields.\nFor example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'const o = { x: 1, y: ["foo", 2] }\nconsole.log("o=", o)\nconsole.log("o=" + o)\nconsole.log(`o=${o}`)\n')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-console",metastring:'title="Output"',title:'"Output"'},'o={x:1,y:["foo",2]}\no={x:1,y:["foo",2]}\no={x:1,y:["foo",2]}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6b7af4fc.172dec19.js b/assets/js/6b7af4fc.172dec19.js new file mode 100644 index 00000000000..80616e42978 --- /dev/null +++ b/assets/js/6b7af4fc.172dec19.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8785],{35318:(e,t,i)=>{i.d(t,{Zo:()=>d,kt:()=>v});var a=i(27378);function r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,a)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function o(e,t){if(null==e)return{};var i,a,r=function(e,t){if(null==e)return{};var i,a,r={},n=Object.keys(e);for(a=0;a<n.length;a++)i=n[a],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)i=n[a],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var p=a.createContext({}),c=function(e){var t=a.useContext(p),i=t;return e&&(i="function"==typeof e?e(t):s(s({},t),e)),i},d=function(e){var t=c(e.components);return a.createElement(p.Provider,{value:t},e.children)},l="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var i=e.components,r=e.mdxType,n=e.originalType,p=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),l=c(i),m=r,v=l["".concat(p,".").concat(m)]||l[m]||u[m]||n;return i?a.createElement(v,s(s({ref:t},d),{},{components:i})):a.createElement(v,s({ref:t},d))}));function v(e,t){var i=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var n=i.length,s=new Array(n);s[0]=m;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[l]="string"==typeof e?e:r,s[1]=o;for(var c=2;c<n;c++)s[c]=i[c];return a.createElement.apply(null,s)}return a.createElement.apply(null,i)}m.displayName="MDXCreateElement"},15468:(e,t,i)=>{i.d(t,{Z:()=>s});var a=i(98948),r=i(27378);const n={device__photo:"device__photo_XeRs"};function s(e){const{image:t,imageAlt:i,description:s,title:o,href:p}=e,c=(0,a.Z)(p);return r.createElement("a",{href:c,className:"avatar margin-vert--md"},r.createElement("img",{className:`avatar__photo-link avatar__photo avatar__photo--xl ${n.device__photo}`,alt:i||`photograph of ${o}`,src:t}),r.createElement("div",{className:"avatar__intro"},r.createElement("div",{className:"avatar__name"},o),s?r.createElement("small",{className:"avatar__subtitle"},s):null))}},31745:(e,t,i)=>{i.r(t),i.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>d});var a=i(25773),r=(i(27378),i(35318)),n=i(15468);const s={},o="ESP32",p={unversionedId:"devices/esp32/index",id:"devices/esp32/index",title:"ESP32",description:"The following devices use the firmware from https://github.com/microsoft/devicescript-esp32 which builds on top of ESP-IDF.",source:"@site/docs/devices/esp32/index.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/",permalink:"/devicescript/devices/esp32/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Devices",permalink:"/devicescript/devices/"},next:{title:"Adafruit Feather ESP32-S2",permalink:"/devicescript/devices/esp32/adafruit-feather-esp32-s2"}},c={},d=[{value:"Requirements",id:"requirements",level:2},{value:"Usage",id:"usage",level:2},{value:"Listing boards",id:"listing-boards",level:3},{value:"Targeting a specific board",id:"targeting-a-specific-board",level:3},{value:"Custom <code>write_flash</code> argument",id:"custom-write_flash-argument",level:3}],l={toc:d},u="wrapper";function m(e){let{components:t,...i}=e;return(0,r.kt)(u,(0,a.Z)({},l,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"esp32"},"ESP32"),(0,r.kt)("p",null,"The following devices use the firmware from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript-esp32"},"https://github.com/microsoft/devicescript-esp32")," which builds on top of ESP-IDF."),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/seeed-studio/xiaoesp32c3v00.preview.jpg",href:"/devices/esp32/seeed-xiao-esp32c3",title:"Seeed Studio XIAO ESP32C3",description:"A tiny ESP32-C3 board.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/adafruit/qtpyesp32c3wifidevboardv10.preview.jpg",href:"/devices/esp32/adafruit-qt-py-c3",title:"Adafruit QT Py ESP32-C3 WiFi",description:"A tiny ESP32-C3 board.",mdxType:"DeviceCard"}),(0,r.kt)("p",null,"and more..."),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/adafruit/qtpyesp32c3wifidevboardv10.preview.jpg",href:"/devices/esp32/adafruit-qt-py-c3",title:"Adafruit QT Py ESP32-C3 WiFi",description:"A tiny ESP32-C3 board.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/01space/esp32c3fh4rgbv10.preview.jpg",href:"/devices/esp32/esp32-c3fh4-rgb",title:"ESP32-C3FH4-RGB",description:"A tiny ESP32-C3 board with 5x5 LED array.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/espressif/esp32devkitcdevicescriptv40.preview.jpg",href:"/devices/esp32/esp32-devkit-c",title:"Espressif ESP32-DevKitC",description:"There are currently issues with serial chip on these, best avoid.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/espressif/esp32c3rustdevkitv12a.preview.jpg",href:"/devices/esp32/esp32c3-rust-devkit",title:"Espressif ESP32-C3-RUST-DevKit",description:"A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/espressif/esp32s3devkitmv10.preview.jpg",href:"/devices/esp32/esp32s3-devkit-m",title:"Espressif ESP32-S3 DevKitM",description:"ESP32-S3 DevKitM development board.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/unexpected-maker/feathers2esp32s2v20.preview.jpg",href:"/devices/esp32/feather-s2",title:"Unexpected Maker FeatherS2 ESP32-S2",description:"ESP32-S2 based development board in a Feather format.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/seeed-studio/xiaoesp32c3v00.preview.jpg",href:"/devices/esp32/seeed-xiao-esp32c3",title:"Seeed Studio XIAO ESP32C3",description:"A tiny ESP32-C3 board.",mdxType:"DeviceCard"}),(0,r.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/seeed-studio/xiaoesp32c3withmsr218base218v46.preview.jpg",href:"/devices/esp32/seeed-xiao-esp32c3-msr218",title:"Seeed Studio XIAO ESP32C3 with MSR218 base",description:"A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors.",mdxType:"DeviceCard"}),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Your device is not in the list? ",(0,r.kt)("a",{parentName:"p",href:"/devices/add-board"},"Add a new Device Configuration")," in your project.")),(0,r.kt)("h2",{id:"requirements"},"Requirements"),(0,r.kt)("p",null,"You will need to install ",(0,r.kt)("inlineCode",{parentName:"p"},"esptool.py")," first - you can do that using ",(0,r.kt)("a",{parentName:"p",href:"https://pip.pypa.io/en/stable/"},"pip"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pip install esptool\n")),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"Connect your ESP32 board and run ",(0,r.kt)("inlineCode",{parentName:"p"},"devicescript flash esp32")," to flash DeviceScript runtime on it."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash esp32\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-console",metastring:'title="Output"',title:'"Output"'},"$ devicescript flash esp32\nusing serial port /dev/cu.usbmodem01 at 1500000\nesptool: /usr/local/bin/esptool.py\nIdentify arch\nesptool.py v4.5\nSerial port /dev/cu.usbmodem01\nConnecting...\nDetecting chip type... Unsupported detection protocol, switching and trying again...\nDetecting chip type... ESP32-S2\nChip is ESP32-S2 (revision v0.0)\nFeatures: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V1\nCrystal is 40MHz\nMAC: 7c:df:a1:03:99:f4\nUploading stub...\nRunning stub...\nStub running...\nChanging baud rate to 1500000\nChanged.\nWarning: ESP32-S2 has no Chip ID. Reading MAC instead.\nMAC: 7c:df:a1:03:99:f4\nStaying in bootloader.\nPlease select board, available options:\n --board msr207_v42 JM Brain S2-mini 207 v4.2\n --board msr207_v43 JM Brain S2-mini 207 v4.3\n --board msr48 JacdacIoT 48 v0.2\n$\n")),(0,r.kt)("h3",{id:"listing-boards"},"Listing boards"),(0,r.kt)("p",null,"You can also get a full list of ESP32 boards without attempting any auto-detect."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash esp32 --board list\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-console",metastring:'title="Output"',title:'"Output"'},"$ devicescript flash esp32 --board list\nPlease select board, available options:\n --board msr207_v42 JM Brain S2-mini 207 v4.2\n --board msr207_v43 JM Brain S2-mini 207 v4.3\n --board msr48 JacdacIoT 48 v0.2\n --board adafruit_qt_py_c3 Adafruit QT Py ESP32-C3 WiFi Dev Board\n --board esp32_devkit_c Espressif ESP32-DevKitC\n")),(0,r.kt)("h3",{id:"targeting-a-specific-board"},"Targeting a specific board"),(0,r.kt)("p",null,"Let's say your board is ",(0,r.kt)("inlineCode",{parentName:"p"},"adafruit_qt_py_c3"),". To target this board, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"--board [boardid]")," flag."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash esp32 --board adafruit_qt_py_c3\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-console",metastring:'title="Output"',title:'"Output"'},"$ devicescript flash esp32 --board adafruit_qt_py_c3\nusing serial port /dev/cu.usbmodem14211401 at 1500000\nesptool: /usr/local/bin/esptool.py\nfetch https://github.com/microsoft/jacdac-esp32/releases/latest/download/devicescript-esp32c3-adafruit_qt_py_c3-0x0.bin\nsaved .devicescript/cache/devicescript-esp32c3-adafruit_qt_py_c3-0x0.bin 982208 bytes\nesptool.py v4.5\nSerial port /dev/cu.usbmodem14211401\nConnecting....\nDetecting chip type... ESP32-C3\nChip is ESP32-C3 (revision v0.3)\nFeatures: WiFi, BLE\nCrystal is 40MHz\nMAC: 34:b4:72:ea:17:88\nUploading stub...\nRunning stub...\nStub running...\nChanging baud rate to 1500000\nChanged.\nConfiguring flash size...\nFlash will be erased from 0x00000000 to 0x000effff...\nCompressed 982208 bytes to 532293...\nWriting at 0x00000000... (3 %)\nWriting at 0x00011e9e... (6 %)\n[...snip...]\nWriting at 0x000e576f... (96 %)\nWriting at 0x000ec5d7... (100 %)\nWrote 982208 bytes (532293 compressed) at 0x00000000 in 7.5 seconds (effective 1042.1 kbit/s)...\nHash of data verified.\n\nLeaving...\nHard resetting via RTS pin...\n$\n")),(0,r.kt)("p",null,"After flashing, your board has the DeviceScript runtime and you can program it using DeviceScript."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Check out the ",(0,r.kt)("a",{parentName:"p",href:"/developer/errors"},"errors")," page if you run into any issues.")),(0,r.kt)("h3",{id:"custom-write_flash-argument"},"Custom ",(0,r.kt)("inlineCode",{parentName:"h3"},"write_flash")," argument"),(0,r.kt)("p",null,"Use the ",(0,r.kt)("inlineCode",{parentName:"p"},"$flashToolArguments")," field in the board definition to specify additional arguments to ",(0,r.kt)("inlineCode",{parentName:"p"},"esptool")," ",(0,r.kt)("inlineCode",{parentName:"p"},"write_flash"),", such as ",(0,r.kt)("inlineCode",{parentName:"p"},"--flash_mode"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6b92a77b.a0205e6c.js b/assets/js/6b92a77b.a0205e6c.js new file mode 100644 index 00000000000..ff38eefe4f8 --- /dev/null +++ b/assets/js/6b92a77b.a0205e6c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8796],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:i,o[1]=l;for(var c=2;c<a;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},24604:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={title:"Bundled firmware",sidebar_position:20},o="Bundled Firmware",l={unversionedId:"developer/bundle",id:"developer/bundle",title:"Bundled firmware",description:"A firmware image can be bundled together with a DeviceScript program and settings",source:"@site/docs/developer/bundle.mdx",sourceDirName:"developer",slug:"/developer/bundle",permalink:"/devicescript/developer/bundle",draft:!1,tags:[],version:"current",sidebarPosition:20,frontMatter:{title:"Bundled firmware",sidebar_position:20},sidebar:"tutorialSidebar",previous:{title:"Custom Packages",permalink:"/devicescript/developer/packages/custom"},next:{title:"Simulation",permalink:"/devicescript/developer/simulation"}},s={},c=[],p={toc:c},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"bundled-firmware"},"Bundled Firmware"),(0,i.kt)("p",null,"A firmware image can be bundled together with a DeviceScript program and settings\ninto a single image that can be flashed at once\nusing the platform native tools.\xcf"),(0,i.kt)("p",null,"Let's assume you're developing for ",(0,i.kt)("inlineCode",{parentName:"p"},"seeed_xiao_esp32c3")," board.\nInside your project folder run using the ",(0,i.kt)("a",{parentName:"p",href:"/api/cli"},"CLI"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"devs bundle --board seeed_xiao_esp32c3 src/main.ts\n")),(0,i.kt)("p",null,"This will bundle the program from ",(0,i.kt)("inlineCode",{parentName:"p"},"src/main.ts")," as well as any ",(0,i.kt)("a",{parentName:"p",href:"/developer/settings"},"settings"),"\nin ",(0,i.kt)("inlineCode",{parentName:"p"},".env")," and ",(0,i.kt)("inlineCode",{parentName:"p"},".env.local")," files."),(0,i.kt)("p",null,"You should get something similar to the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-console"},"...\ndeploy to ZX81\n --\x3e done, 4kb\nfetch https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin\nsaved .devicescript/cache/devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin 1277952 bytes\nwriting 1875968 bytes to .devicescript/bin/bundle-devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin\n")),(0,i.kt)("p",null,"The file ",(0,i.kt)("inlineCode",{parentName:"p"},".devicescript/bin/bundle-devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin")," can be now flashed\nto the device.\nYou can do it using ",(0,i.kt)("inlineCode",{parentName:"p"},"esptool")," or in case of Pico by just copying the ",(0,i.kt)("inlineCode",{parentName:"p"},".UF2")," file.\nOr use ",(0,i.kt)("inlineCode",{parentName:"p"},"devs flash --file")," command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"devs flash --board seeed_xiao_esp32c3 --file .devicescript/bin/bundle-devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6c9194df.57a5bc1a.js b/assets/js/6c9194df.57a5bc1a.js new file mode 100644 index 00000000000..699dc9fd189 --- /dev/null +++ b/assets/js/6c9194df.57a5bc1a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2948],{35318:(e,r,t)=>{t.d(r,{Zo:()=>d,kt:()=>f});var i=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,i,a=function(e,r){if(null==e)return{};var t,i,a={},n=Object.keys(e);for(i=0;i<n.length;i++)t=n[i],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)t=n[i],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=i.createContext({}),l=function(e){var r=i.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},d=function(e){var r=l(e.components);return i.createElement(c.Provider,{value:r},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return i.createElement(i.Fragment,{},r)}},m=i.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=l(t),m=a,f=p["".concat(c,".").concat(m)]||p[m]||u[m]||n;return t?i.createElement(f,o(o({ref:r},d),{},{components:t})):i.createElement(f,o({ref:r},d))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,o=new Array(n);o[0]=m;var s={};for(var c in r)hasOwnProperty.call(r,c)&&(s[c]=r[c]);s.originalType=e,s[p]="string"==typeof e?e:a,o[1]=s;for(var l=2;l<n;l++)o[l]=t[l];return i.createElement.apply(null,o)}return i.createElement.apply(null,t)}m.displayName="MDXCreateElement"},15468:(e,r,t)=>{t.d(r,{Z:()=>o});var i=t(98948),a=t(27378);const n={device__photo:"device__photo_XeRs"};function o(e){const{image:r,imageAlt:t,description:o,title:s,href:c}=e,l=(0,i.Z)(c);return a.createElement("a",{href:l,className:"avatar margin-vert--md"},a.createElement("img",{className:`avatar__photo-link avatar__photo avatar__photo--xl ${n.device__photo}`,alt:t||`photograph of ${s}`,src:r}),a.createElement("div",{className:"avatar__intro"},a.createElement("div",{className:"avatar__name"},s),o?a.createElement("small",{className:"avatar__subtitle"},o):null))}},33298:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>m,contentTitle:()=>p,default:()=>h,frontMatter:()=>d,metadata:()=>u,toc:()=>f});var i=t(25773),a=(t(27378),t(35318));const n=t.p+"assets/images/xiao-expansion-board-bbb3d8fc7f164a7cd68228e074554200.jpg",o=t.p+"assets/images/waveshare-pico-lcd-114-6b2f09270d3b6ef99a8c1d095a807a44.png",s=t.p+"assets/images/pico-bricks-9426bc01d401be67e5c8c356abb07848.jpg",c=t.p+"assets/images/pimoroni-pico-badger-bc230e17191d6b4a8df0b57ae03d77c9.jpg";var l=t(15468);const d={title:"Shields"},p="Shields",u={unversionedId:"devices/shields/index",id:"devices/shields/index",title:"Shields",description:"Shields typically bundle a number of sensor and connectors to accelerate the use of general purpose boards.",source:"@site/docs/devices/shields/index.mdx",sourceDirName:"devices/shields",slug:"/devices/shields/",permalink:"/devicescript/devices/shields/",draft:!1,tags:[],version:"current",frontMatter:{title:"Shields"},sidebar:"tutorialSidebar",previous:{title:"Raspberry Pi Pico",permalink:"/devicescript/devices/rp2040/pico"},next:{title:"Pico Bricks",permalink:"/devicescript/devices/shields/pico-bricks"}},m={},f=[{value:"See Also",id:"see-also",level:2}],v={toc:f},b="wrapper";function h(e){let{components:r,...t}=e;return(0,a.kt)(b,(0,i.Z)({},v,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"shields"},"Shields"),(0,a.kt)("p",null,'Shields typically bundle a number of sensor and connectors to accelerate the use of general purpose boards.\nDeviceScript provides support for a few shield "out of box" but more can be contributed or loaded through a package.'),(0,a.kt)(l.Z,{image:n,href:"/devices/shields/xiao-expansion-board",title:"Xiao Expansion Board",description:"For Xiao ESP32-C3 and similar boards.",mdxType:"DeviceCard"}),(0,a.kt)(l.Z,{image:s,href:"/devices/shields/pico-bricks",title:"Pico Bricks",description:"For Raspberry Pi Pico and Pico-W",mdxType:"DeviceCard"}),(0,a.kt)(l.Z,{image:o,href:"/devices/shields/waveshare-pico-lcd-114",title:"WaveShare Pico LCD 114",description:"For Raspberry Pi Pico and Pico-W",mdxType:"DeviceCard"}),(0,a.kt)(l.Z,{image:c,href:"/devices/shields/pimoroni-pico-badger",title:"Pimoroni Pico Badger",description:"For Raspberry Pi Pico and Pico-W",mdxType:"DeviceCard"}),(0,a.kt)("h2",{id:"see-also"},"See Also"),(0,a.kt)("p",null,"See ",(0,a.kt)("a",{parentName:"p",href:"/devices/add-shield"},"Add a new shield"),"."))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6cc4cf7a.950d3b52.js b/assets/js/6cc4cf7a.950d3b52.js new file mode 100644 index 00000000000..2a5e7c3f184 --- /dev/null +++ b/assets/js/6cc4cf7a.950d3b52.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6141],{35318:(t,e,r)=>{r.d(e,{Zo:()=>m,kt:()=>g});var a=r(27378);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){if(null==t)return{};var r,a,n=function(t,e){if(null==t)return{};var r,a,n={},i=Object.keys(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var l=a.createContext({}),d=function(t){var e=a.useContext(l),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},m=function(t){var e=d(t.components);return a.createElement(l.Provider,{value:e},t.children)},s="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var r=t.components,n=t.mdxType,i=t.originalType,l=t.parentName,m=o(t,["components","mdxType","originalType","parentName"]),s=d(r),k=n,g=s["".concat(l,".").concat(k)]||s[k]||c[k]||i;return r?a.createElement(g,p(p({ref:e},m),{},{components:r})):a.createElement(g,p({ref:e},m))}));function g(t,e){var r=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=r.length,p=new Array(i);p[0]=k;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o[s]="string"==typeof t?t:n,p[1]=o;for(var d=2;d<i;d++)p[d]=r[d];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}k.displayName="MDXCreateElement"},33908:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>l,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var a=r(25773),n=(r(27378),r(35318));const i={description:"Raspberry Pi Pico"},p="Raspberry Pi Pico",o={unversionedId:"devices/rp2040/pico",id:"devices/rp2040/pico",title:"Raspberry Pi Pico",description:"Raspberry Pi Pico",source:"@site/docs/devices/rp2040/pico.mdx",sourceDirName:"devices/rp2040",slug:"/devices/rp2040/pico",permalink:"/devicescript/devices/rp2040/pico",draft:!1,tags:[],version:"current",frontMatter:{description:"Raspberry Pi Pico"},sidebar:"tutorialSidebar",previous:{title:"Raspberry Pi Pico W",permalink:"/devicescript/devices/rp2040/pico-w"},next:{title:"Shields",permalink:"/devicescript/devices/shields/"}},l={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],m={toc:d},s="wrapper";function c(t){let{components:e,...r}=t;return(0,n.kt)(s,(0,a.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"raspberry-pi-pico"},"Raspberry Pi Pico"),(0,n.kt)("p",null,"RP2040 board from Raspberry Pi."),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/raspberry-pi/picov00.catalog.jpg",alt:"Raspberry Pi Pico picture"})),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"custom LED (use ",(0,n.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html"},"https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.raspberrypi.com/products/raspberry-pi-pico/"},"https://www.raspberrypi.com/products/raspberry-pi-pico/"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP11")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP12")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP15")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP16")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP17")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP19")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO19"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP20")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP22")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO22"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP26")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO26"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP27")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO27"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP28")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO28"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"GP9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"led.pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO25"),(0,n.kt)("td",{parentName:"tr",align:"right"},"led.pin, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Raspberry Pi Pico".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/pico"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board pico\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-pico.uf2"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="pico.json"',title:'"pico.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",\n "id": "pico",\n "devName": "Raspberry Pi Pico",\n "productId": "0x3f6e1f0c",\n "$description": "RP2040 board from Raspberry Pi.",\n "archId": "rp2040",\n "url": "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html",\n "led": {\n "#": "type=100 - special handling for Pico LED",\n "pin": 25,\n "type": 100\n },\n "pins": {\n "GP0": 0,\n "GP1": 1,\n "GP10": 10,\n "GP11": 11,\n "GP12": 12,\n "GP13": 13,\n "GP14": 14,\n "GP15": 15,\n "GP16": 16,\n "GP17": 17,\n "GP18": 18,\n "GP19": 19,\n "GP2": 2,\n "GP20": 20,\n "GP21": 21,\n "GP22": 22,\n "GP26": 26,\n "GP27": 27,\n "GP28": 28,\n "GP3": 3,\n "GP4": 4,\n "GP5": 5,\n "GP6": 6,\n "GP7": 7,\n "GP8": 8,\n "GP9": 9\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6d697ca4.5d95df8b.js b/assets/js/6d697ca4.5d95df8b.js new file mode 100644 index 00000000000..bdb57f3017b --- /dev/null +++ b/assets/js/6d697ca4.5d95df8b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1806],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},s="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(r),d=o,f=s["".concat(c,".").concat(d)]||s[d]||m[d]||a;return r?n.createElement(f,i(i({ref:t},u),{},{components:r})):n.createElement(f,i({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[s]="string"==typeof e?e:o,i[1]=p;for(var l=2;l<a;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},79258:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var n=r(25773),o=(r(27378),r(35318));const a={sidebar_position:10.5},i="MCU Temperature",p={unversionedId:"developer/mcu-temperature",id:"developer/mcu-temperature",title:"MCU Temperature",description:"Microcontrollers typically have a temperature sensor built in. This is a great way to monitor the temperature of the MCU itself.",source:"@site/docs/developer/mcu-temperature.mdx",sourceDirName:"developer",slug:"/developer/mcu-temperature",permalink:"/devicescript/developer/mcu-temperature",draft:!1,tags:[],version:"current",sidebarPosition:10.5,frontMatter:{sidebar_position:10.5},sidebar:"tutorialSidebar",previous:{title:"LED Driver",permalink:"/devicescript/developer/leds/driver"},next:{title:"Low Power",permalink:"/devicescript/developer/low-power"}},c={},l=[],u={toc:l},s="wrapper";function m(e){let{components:t,...r}=e;return(0,o.kt)(s,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"mcu-temperature"},"MCU Temperature"),(0,o.kt)("p",null,"Microcontrollers typically have a temperature sensor built in. This is a great way to monitor the temperature of the MCU itself.\nThe temperature sensor is not very accurate, but it is good enough to detect if the MCU is overheating."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"mcuTemperature")," function returns the temperature in degrees Celsius."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { mcuTemperature } from "@devicescript/runtime"\n\nsetInterval(async () => {\n const temp = await mcuTemperature()\n console.log({ temp })\n}, 1000)\n')),(0,o.kt)("p",null,"The simulator temperature is alwasy 21 degrees Celsius."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6dde451c.9355257b.js b/assets/js/6dde451c.9355257b.js new file mode 100644 index 00000000000..e4e77616cf2 --- /dev/null +++ b/assets/js/6dde451c.9355257b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[39],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>v});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},m="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=c(n),d=a,v=m["".concat(p,".").concat(d)]||m[d]||s[d]||i;return n?r.createElement(v,o(o({ref:t},u),{},{components:n})):r.createElement(v,o({ref:t},u))}));function v(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:a,o[1]=l;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},49959:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>s,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Total Volatile organic compound service"},o="Tvoc",l={unversionedId:"api/clients/tvoc",id:"api/clients/tvoc",title:"Tvoc",description:"DeviceScript client for Total Volatile organic compound service",source:"@site/docs/api/clients/tvoc.md",sourceDirName:"api/clients",slug:"/api/clients/tvoc",permalink:"/devicescript/api/clients/tvoc",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Total Volatile organic compound service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],u={toc:c},m="wrapper";function s(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"tvoc"},"Tvoc"),(0,a.kt)("p",null,"Measures equivalent Total Volatile Organic Compound levels."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Total volatile organic compound readings in parts per billion."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n// ...\nconst value = await tvoc.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n// ...\ntvoc.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Error on the reading data"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n// ...\nconst value = await tvoc.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n// ...\ntvoc.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:minReading"},"minReading"),(0,a.kt)("p",null,"Minimum measurable value"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n// ...\nconst value = await tvoc.minReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,a.kt)("p",null,"Minimum measurable value."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Tvoc } from "@devicescript/core"\n\nconst tvoc = new Tvoc()\n// ...\nconst value = await tvoc.maxReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6ea5afa0.2f0199ec.js b/assets/js/6ea5afa0.2f0199ec.js new file mode 100644 index 00000000000..69dc2a95b78 --- /dev/null +++ b/assets/js/6ea5afa0.2f0199ec.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3482],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},k=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),k=r,m=d["".concat(s,".").concat(k)]||d[k]||u[k]||a;return n?i.createElement(m,o(o({ref:t},c),{},{components:n})):i.createElement(m,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,o=new Array(a);o[0]=k;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:r,o[1]=l;for(var p=2;p<a;p++)o[p]=n[p];return i.createElement.apply(null,o)}return i.createElement.apply(null,n)}k.displayName="MDXCreateElement"},99499:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var i=n(25773),r=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for WIFI service"},o="Wifi",l={unversionedId:"api/clients/wifi",id:"api/clients/wifi",title:"Wifi",description:"DeviceScript client for WIFI service",source:"@site/docs/api/clients/wifi.md",sourceDirName:"api/clients",slug:"/api/clients/wifi",permalink:"/devicescript/api/clients/wifi",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for WIFI service"},sidebar:"tutorialSidebar"},s={},p=[{value:"About",id:"about",level:2},{value:"Connection",id:"connection",level:2},{value:"Captive portals",id:"captive-portals",level:2},{value:"Commands",id:"commands",level:2},{value:"addNetwork",id:"addnetwork",level:3},{value:"reconnect",id:"reconnect",level:3},{value:"forgetNetwork",id:"forgetnetwork",level:3},{value:"forgetAllNetworks",id:"forgetallnetworks",level:3},{value:"setNetworkPriority",id:"setnetworkpriority",level:3},{value:"scan",id:"scan",level:3},{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"ipAddress",id:"ro:ipAddress",level:3},{value:"eui48",id:"const:eui48",level:3},{value:"ssid",id:"ro:ssid",level:3},{value:"Events",id:"events",level:2},{value:"gotIp",id:"gotip",level:3},{value:"lostIp",id:"lostip",level:3},{value:"scanComplete",id:"scancomplete",level:3},{value:"networksChanged",id:"networkschanged",level:3},{value:"connectionFailed",id:"connectionfailed",level:3}],c={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"wifi"},"Wifi"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,r.kt)("p",null,"Discovery and connection to WiFi networks. Separate TCP service can be used for data transfer."),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"about"},"About"),(0,r.kt)("h2",{id:"connection"},"Connection"),(0,r.kt)("p",null,"The device controlled by this service is meant to connect automatically, once configured.\nTo that end, it keeps a list of known WiFi networks, with priorities and passwords.\nIt will connect to the available network with numerically highest priority,\nbreaking ties in priority by signal strength (typically all known networks have priority of ",(0,r.kt)("inlineCode",{parentName:"p"},"0"),").\nIf the connection fails (due to wrong password, radio failure, or other problem)\nan ",(0,r.kt)("inlineCode",{parentName:"p"},"connection_failed")," event is emitted, and the device will try to connect to the next eligible network.\nWhen networks are exhausted, the scan is performed again and the connection process restarts."),(0,r.kt)("p",null,"Updating networks (setting password, priorties, forgetting) does not trigger an automatic reconnect."),(0,r.kt)("h2",{id:"captive-portals"},"Captive portals"),(0,r.kt)("p",null,"If the Wifi is not able to join an AP because it needs to receive a password, it may decide to enter a mode\nwhere it waits for user input. Typical example of this mode would be a captive portal or waiting for a BLE interaction.\nIn that situation, the ",(0,r.kt)("inlineCode",{parentName:"p"},"status_code")," should set to ",(0,r.kt)("inlineCode",{parentName:"p"},"WaitingForInput"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"addnetwork"},"addNetwork"),(0,r.kt)("p",null,"Automatically connect to named network if available. Also set password if network is not open."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.addNetwork(ssid: string, password: string): Promise<void>\n")),(0,r.kt)("h3",{id:"reconnect"},"reconnect"),(0,r.kt)("p",null,"Enable the WiFi (if disabled), initiate a scan, wait for results, disconnect from current WiFi network if any,\nand then reconnect (using regular algorithm, see ",(0,r.kt)("inlineCode",{parentName:"p"},"set_network_priority"),")."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.reconnect(): Promise<void>\n")),(0,r.kt)("h3",{id:"forgetnetwork"},"forgetNetwork"),(0,r.kt)("p",null,"Prevent from automatically connecting to named network in future.\nForgetting a network resets its priority to ",(0,r.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.forgetNetwork(ssid: string): Promise<void>\n")),(0,r.kt)("h3",{id:"forgetallnetworks"},"forgetAllNetworks"),(0,r.kt)("p",null,"Clear the list of known networks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.forgetAllNetworks(): Promise<void>\n")),(0,r.kt)("h3",{id:"setnetworkpriority"},"setNetworkPriority"),(0,r.kt)("p",null,"Set connection priority for a network.\nBy default, all known networks have priority of ",(0,r.kt)("inlineCode",{parentName:"p"},"0"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.setNetworkPriority(priority: number, ssid: string): Promise<void>\n")),(0,r.kt)("h3",{id:"scan"},"scan"),(0,r.kt)("p",null,"Initiate search for WiFi networks. Generates ",(0,r.kt)("inlineCode",{parentName:"p"},"scan_complete")," event."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.scan(): Promise<void>\n")),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"Current signal strength. Returns -128 when not connected."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nconst value = await wifi.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nwifi.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:enabled"},"enabled"),(0,r.kt)("p",null,"Determines whether the WiFi radio is enabled. It starts enabled upon reset."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nconst value = await wifi.enabled.read()\nawait wifi.enabled.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nwifi.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:ipAddress"},"ipAddress"),(0,r.kt)("p",null,"0, 4 or 16 byte buffer with the IPv4 or IPv6 address assigned to device if any."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<Buffer>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"b[16]"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"track incoming values"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nwifi.ipAddress.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:eui48"},"eui48"),(0,r.kt)("p",null,'The 6-byte MAC address of the device. If a device does MAC address randomization it will have to "restart".'),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: ",(0,r.kt)("inlineCode",{parentName:"li"},"Register<Buffer>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"li"},"b[6]"),")"),(0,r.kt)("li",{parentName:"ul"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:ssid"},"ssid"),(0,r.kt)("p",null,"SSID of the access-point to which device is currently connected.\nEmpty string if not connected."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"s[32]"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nconst value = await wifi.ssid.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Wifi } from "@devicescript/core"\n\nconst wifi = new Wifi()\n// ...\nwifi.ssid.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h2",{id:"events"},"Events"),(0,r.kt)("h3",{id:"gotip"},"gotIp"),(0,r.kt)("p",null,"Emitted upon successful join and IP address assignment."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.gotIp.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"lostip"},"lostIp"),(0,r.kt)("p",null,"Emitted when disconnected from network."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.lostIp.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"scancomplete"},"scanComplete"),(0,r.kt)("p",null,"A WiFi network scan has completed. Results can be read with the ",(0,r.kt)("inlineCode",{parentName:"p"},"last_scan_results")," command.\nThe event indicates how many networks where found, and how many are considered\nas candidates for connection."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.scanComplete.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"networkschanged"},"networksChanged"),(0,r.kt)("p",null,"Emitted whenever the list of known networks is updated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.networksChanged.subscribe(() => {\n\n})\n")),(0,r.kt)("h3",{id:"connectionfailed"},"connectionFailed"),(0,r.kt)("p",null,"Emitted when when a network was detected in scan, the device tried to connect to it\nand failed.\nThis may be because of wrong password or other random failure."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"wifi.connectionFailed.subscribe(() => {\n\n})\n")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6f141d43.5fcabf8d.js b/assets/js/6f141d43.5fcabf8d.js new file mode 100644 index 00000000000..e8c22ca9d1c --- /dev/null +++ b/assets/js/6f141d43.5fcabf8d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4886],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>y});var r=n(27378);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,l=function(e,t){if(null==e)return{};var n,r,l={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var o=r.createContext({}),s=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(o.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,l=e.mdxType,a=e.originalType,o=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(n),m=l,y=u["".concat(o,".").concat(m)]||u[m]||d[m]||a;return n?r.createElement(y,i(i({ref:t},c),{},{components:n})):r.createElement(y,i({ref:t},c))}));function y(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var a=n.length,i=new Array(a);i[0]=m;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[u]="string"==typeof e?e:l,i[1]=p;for(var s=2;s<a;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},71070:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>s});var r=n(25773),l=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Braille display service"},i="BrailleDisplay",p={unversionedId:"api/clients/brailledisplay",id:"api/clients/brailledisplay",title:"BrailleDisplay",description:"DeviceScript client for Braille display service",source:"@site/docs/api/clients/brailledisplay.md",sourceDirName:"api/clients",slug:"/api/clients/brailledisplay",permalink:"/devicescript/api/clients/brailledisplay",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Braille display service"},sidebar:"tutorialSidebar"},o={},s=[{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"length",id:"const:length",level:3}],c={toc:s},u="wrapper";function d(e){let{components:t,...n}=e;return(0,l.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"brailledisplay"},"BrailleDisplay"),(0,l.kt)("p",null,"A Braille pattern display module. This module display ",(0,l.kt)("a",{parentName:"p",href:"https://www.unicode.org/charts/PDF/U2800.pdf"},"unicode braille patterns"),", country specific encoding have to be implemented by the clients."),(0,l.kt)("p",null),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { BrailleDisplay } from "@devicescript/core"\n\nconst brailleDisplay = new BrailleDisplay()\n')),(0,l.kt)("p",null),(0,l.kt)("h2",{id:"registers"},"Registers"),(0,l.kt)("p",null),(0,l.kt)("h3",{id:"rw:enabled"},"enabled"),(0,l.kt)("p",null,"Determines if the braille display is active."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"type: ",(0,l.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,l.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"read and write"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { BrailleDisplay } from "@devicescript/core"\n\nconst brailleDisplay = new BrailleDisplay()\n// ...\nconst value = await brailleDisplay.enabled.read()\nawait brailleDisplay.enabled.write(value)\n')),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"track incoming values")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { BrailleDisplay } from "@devicescript/core"\n\nconst brailleDisplay = new BrailleDisplay()\n// ...\nbrailleDisplay.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},(0,l.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,l.kt)("h3",{id:"const:length"},"length"),(0,l.kt)("p",null,"Gets the number of patterns that can be displayed."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"type: ",(0,l.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,l.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"read only"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { BrailleDisplay } from "@devicescript/core"\n\nconst brailleDisplay = new BrailleDisplay()\n// ...\nconst value = await brailleDisplay.length.read()\n')),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},(0,l.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,l.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/700d2df6.599de86f.js b/assets/js/700d2df6.599de86f.js new file mode 100644 index 00000000000..6339af23a33 --- /dev/null +++ b/assets/js/700d2df6.599de86f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8893],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>b});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(r),u=i,b=m["".concat(c,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,o(o({ref:t},p),{},{components:r})):n.createElement(b,o({ref:t},p))}));function b(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[m]="string"==typeof e?e:i,o[1]=s;for(var l=2;l<a;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},58100:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(27378);const i={borderRadius:"0.5rem",marginTop:"1rem",marginBottom:"1rem",maxHeight:"40rem",maxWidth:"40rem"};function a(e){const{name:t,style:r=i,webm:a}=e,o=(0,n.useRef)(null);return n.createElement("video",{ref:o,style:r,poster:`/devicescript/videos/${t}.jpg`,playsInline:!0,controls:!0,preload:"metadata"},n.createElement("source",{src:`/devicescript/videos/${t}.mp4`,type:"video/mp4"}),n.createElement("p",null,"Your browser doesn't support HTML video. Here is a",n.createElement("a",{href:`/devicescript/videos/${t}.mp4`},"link to the video")," ","instead."))}},23413:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>p});var n=r(25773),i=(r(27378),r(35318)),a=r(58100);const o={sidebar_position:2,description:"Learn how to create the classic LED blinking program on Raspberry Pi Pico and ESP32 using DeviceScript.",keywords:["Raspberry Pi Pico","ESP32","LED blinking","DeviceScript","microcontroller programming"],hide_table_of_contents:!0},s="Blinky",c={unversionedId:"samples/blinky",id:"samples/blinky",title:"Blinky",description:"Learn how to create the classic LED blinking program on Raspberry Pi Pico and ESP32 using DeviceScript.",source:"@site/docs/samples/blinky.mdx",sourceDirName:"samples",slug:"/samples/blinky",permalink:"/devicescript/samples/blinky",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,description:"Learn how to create the classic LED blinking program on Raspberry Pi Pico and ESP32 using DeviceScript.",keywords:["Raspberry Pi Pico","ESP32","LED blinking","DeviceScript","microcontroller programming"],hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Status Light Blinky",permalink:"/devicescript/samples/status-light-blinky"},next:{title:"Schedule Blinky",permalink:"/devicescript/samples/schedule-blinky"}},l={},p=[{value:"ESP32",id:"esp32",level:2}],m={toc:p},d="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"blinky"},"Blinky"),(0,i.kt)("p",null,"The classic LED blinking program on a ",(0,i.kt)("a",{parentName:"p",href:"/devices/rp2040"},"Raspberry Pi Pico"),". The LED is connected to the Pico's pin GP1 (2 on the silk)"),(0,i.kt)(a.Z,{name:"blinky",mdxType:"StaticVideo"}),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/pico"\nimport { startLightBulb } from "@devicescript/servers"\n\n// start a lightbulb server on pin GP1\n// and store client in `led` variable\nconst led = startLightBulb({\n pin: pins.GP1,\n})\n\n// start interval timer every 1000ms\nsetInterval(async () => {\n // read current brightness\n const brightness = await led.intensity.read()\n // toggle on/off\n const newbrightness = brightness > 0 ? 0 : 1\n // apply new brightness\n await led.intensity.write(newbrightness)\n}, 1000)\n')),(0,i.kt)("h2",{id:"esp32"},"ESP32"),(0,i.kt)("p",null,"The classic LED blinking program on a ",(0,i.kt)("a",{parentName:"p",href:"/devices/esp32"},"ESP32"),"\nis similar. The LED is connected to the pin ",(0,i.kt)("inlineCode",{parentName:"p"},"A0"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { startLightBulb } from "@devicescript/servers"\n\nconst lightBulb = startLightBulb({\n pin: pins.A0_D0,\n})\n\nsetInterval(async () => {\n await lightBulb.toggle()\n}, 500)\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7017c395.d785f5d1.js b/assets/js/7017c395.d785f5d1.js new file mode 100644 index 00000000000..6172f04f82c --- /dev/null +++ b/assets/js/7017c395.d785f5d1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7262],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>d});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),o=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=o(e.components);return r.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),m=o(n),k=a,d=m["".concat(p,".").concat(k)]||m[k]||u[k]||i;return n?r.createElement(d,c(c({ref:t},s),{},{components:n})):r.createElement(d,c({ref:t},s))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,c=new Array(i);c[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:a,c[1]=l;for(var o=2;o<i;o++)c[o]=n[o];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}k.displayName="MDXCreateElement"},30981:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>o});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Character Screen service"},c="CharacterScreen",l={unversionedId:"api/clients/characterscreen",id:"api/clients/characterscreen",title:"CharacterScreen",description:"DeviceScript client for Character Screen service",source:"@site/docs/api/clients/characterscreen.md",sourceDirName:"api/clients",slug:"/api/clients/characterscreen",permalink:"/devicescript/api/clients/characterscreen",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Character Screen service"},sidebar:"tutorialSidebar"},p={},o=[{value:"Registers",id:"registers",level:2},{value:"message",id:"rw:message",level:3},{value:"intensity",id:"rw:intensity",level:3},{value:"variant",id:"const:variant",level:3},{value:"textDirection",id:"rw:textDirection",level:3},{value:"rows",id:"const:rows",level:3},{value:"columns",id:"const:columns",level:3}],s={toc:o},m="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"characterscreen"},"CharacterScreen"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A screen that displays characters, typically a LCD/OLED character screen."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:message"},"message"),(0,a.kt)("p",null,"Text to show. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"\\n")," to break lines."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"s"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\nconst value = await characterScreen.message.read()\nawait characterScreen.message.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\ncharacterScreen.message.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:intensity"},"intensity"),(0,a.kt)("p",null,"Brightness of the screen. ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," means off."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\nconst value = await characterScreen.intensity.read()\nawait characterScreen.intensity.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\ncharacterScreen.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"Describes the type of character LED screen."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\nconst value = await characterScreen.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:textDirection"},"textDirection"),(0,a.kt)("p",null,"Specifies the RTL or LTR direction of the text."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\nconst value = await characterScreen.textDirection.read()\nawait characterScreen.textDirection.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\ncharacterScreen.textDirection.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:rows"},"rows"),(0,a.kt)("p",null,"Gets the number of rows."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\nconst value = await characterScreen.rows.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:columns"},"columns"),(0,a.kt)("p",null,"Gets the number of columns."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CharacterScreen } from "@devicescript/core"\n\nconst characterScreen = new CharacterScreen()\n// ...\nconst value = await characterScreen.columns.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/706ab872.1f7f93b5.js b/assets/js/706ab872.1f7f93b5.js new file mode 100644 index 00000000000..0a4e45f23d3 --- /dev/null +++ b/assets/js/706ab872.1f7f93b5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[648],{35318:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>v});var r=t(27378);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),c=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",s={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=c(t),m=a,v=d["".concat(p,".").concat(m)]||d[m]||s[m]||i;return t?r.createElement(v,l(l({ref:n},u),{},{components:t})):r.createElement(v,l({ref:n},u))}));function v(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,l=new Array(i);l[0]=m;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[d]="string"==typeof e?e:a,l[1]=o;for(var c=2;c<i;c++)l[c]=t[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}m.displayName="MDXCreateElement"},16366:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=t(25773),a=(t(27378),t(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for UV index service"},l="UvIndex",o={unversionedId:"api/clients/uvindex",id:"api/clients/uvindex",title:"UvIndex",description:"DeviceScript client for UV index service",source:"@site/docs/api/clients/uvindex.md",sourceDirName:"api/clients",slug:"/api/clients/uvindex",permalink:"/devicescript/api/clients/uvindex",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for UV index service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"variant",id:"const:variant",level:3}],u={toc:c},d="wrapper";function s(e){let{components:n,...t}=e;return(0,a.kt)(d,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"uvindex"},"UvIndex"),(0,a.kt)("p",null,"The UV Index is a measure of the intensity of ultraviolet (UV) rays from the Sun."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { UvIndex } from "@devicescript/core"\n\nconst uvIndex = new UvIndex()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Ultraviolet index, typically refreshed every second."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { UvIndex } from "@devicescript/core"\n\nconst uvIndex = new UvIndex()\n// ...\nconst value = await uvIndex.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { UvIndex } from "@devicescript/core"\n\nconst uvIndex = new UvIndex()\n// ...\nuvIndex.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"Error on the UV measure."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { UvIndex } from "@devicescript/core"\n\nconst uvIndex = new UvIndex()\n// ...\nconst value = await uvIndex.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { UvIndex } from "@devicescript/core"\n\nconst uvIndex = new UvIndex()\n// ...\nuvIndex.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"The type of physical sensor and capabilities."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { UvIndex } from "@devicescript/core"\n\nconst uvIndex = new UvIndex()\n// ...\nconst value = await uvIndex.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7171.7ab7832b.js b/assets/js/7171.7ab7832b.js new file mode 100644 index 00000000000..ab3fea9e38b --- /dev/null +++ b/assets/js/7171.7ab7832b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7171],{67171:(t,e,n)=>{n.d(e,{diagram:()=>A});var i=n(90829),s=n(5949),r=n(75627),a=n(36304),o=n(54628),c=(n(27693),n(7608),n(31699),n(86161),n(88472),n(76576),n(77567),n(57635),n(69746),n(79580),function(){var t=function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},e=[1,2],n=[1,5],i=[6,9,11,17,18,20,22,23,26,27,28],s=[1,15],r=[1,16],a=[1,17],o=[1,18],c=[1,19],l=[1,23],h=[1,24],d=[1,27],u=[4,6,9,11,17,18,20,22,23,26,27,28],p={trace:function(){},yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,period_statement:24,event_statement:25,period:26,event:27,open_directive:28,type_directive:29,arg_directive:30,close_directive:31,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",26:"period",27:"event",28:"open_directive",29:"type_directive",30:"arg_directive",31:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[24,1],[25,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,i,s,r,a){var o=r.length-1;switch(s){case 1:return r[o-1];case 3:case 7:case 8:this.$=[];break;case 4:r[o-1].push(r[o]),this.$=r[o-1];break;case 5:case 6:this.$=r[o];break;case 11:i.getCommonDb().setDiagramTitle(r[o].substr(6)),this.$=r[o].substr(6);break;case 12:this.$=r[o].trim(),i.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=r[o].trim(),i.getCommonDb().setAccDescription(this.$);break;case 15:i.addSection(r[o].substr(8)),this.$=r[o].substr(8);break;case 19:i.addTask(r[o],0,""),this.$=r[o];break;case 20:i.addEvent(r[o].substr(2)),this.$=r[o];break;case 21:i.parseDirective("%%{","open_directive");break;case 22:i.parseDirective(r[o],"type_directive");break;case 23:r[o]=r[o].trim().replace(/'/g,'"'),i.parseDirective(r[o],"arg_directive");break;case 24:i.parseDirective("}%%","close_directive","timeline")}},table:[{3:1,4:e,7:3,12:4,28:n},{1:[3]},t(i,[2,3],{5:6}),{3:7,4:e,7:3,12:4,28:n},{13:8,29:[1,9]},{29:[2,21]},{6:[1,10],7:22,8:11,9:[1,12],10:13,11:[1,14],12:4,17:s,18:r,20:a,22:o,23:c,24:20,25:21,26:l,27:h,28:n},{1:[2,2]},{14:25,15:[1,26],31:d},t([15,31],[2,22]),t(i,[2,8],{1:[2,1]}),t(i,[2,4]),{7:22,10:28,12:4,17:s,18:r,20:a,22:o,23:c,24:20,25:21,26:l,27:h,28:n},t(i,[2,6]),t(i,[2,7]),t(i,[2,11]),{19:[1,29]},{21:[1,30]},t(i,[2,14]),t(i,[2,15]),t(i,[2,16]),t(i,[2,17]),t(i,[2,18]),t(i,[2,19]),t(i,[2,20]),{11:[1,31]},{16:32,30:[1,33]},{11:[2,24]},t(i,[2,5]),t(i,[2,12]),t(i,[2,13]),t(u,[2,9]),{14:34,31:d},{31:[2,23]},{11:[1,35]},t(u,[2,10])],defaultActions:{5:[2,21],7:[2,2],27:[2,24],33:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],i=[],s=[null],r=[],a=this.table,o="",c=0,l=0,h=r.slice.call(arguments,1),d=Object.create(this.lexer),u={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(u.yy[p]=this.yy[p]);d.setInput(t,u.yy),u.yy.lexer=d,u.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var y=d.yylloc;r.push(y);var g=d.options&&d.options.ranges;"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var f,m,_,b,k,x,v,w,S,$={};;){if(m=n[n.length-1],this.defaultActions[m]?_=this.defaultActions[m]:(null==f&&(S=void 0,"number"!=typeof(S=i.pop()||d.lex()||1)&&(S instanceof Array&&(S=(i=S).pop()),S=e.symbols_[S]||S),f=S),_=a[m]&&a[m][f]),void 0===_||!_.length||!_[0]){var E="";for(k in w=[],a[m])this.terminals_[k]&&k>2&&w.push("'"+this.terminals_[k]+"'");E=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(E,{text:d.match,token:this.terminals_[f]||f,line:d.yylineno,loc:y,expected:w})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+f);switch(_[0]){case 1:n.push(f),s.push(d.yytext),r.push(d.yylloc),n.push(_[1]),f=null,l=d.yyleng,o=d.yytext,c=d.yylineno,y=d.yylloc;break;case 2:if(x=this.productions_[_[1]][1],$.$=s[s.length-x],$._$={first_line:r[r.length-(x||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(x||1)].first_column,last_column:r[r.length-1].last_column},g&&($._$.range=[r[r.length-(x||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply($,[o,l,c,u.yy,_[1],s,r].concat(h))))return b;x&&(n=n.slice(0,-1*x*2),s=s.slice(0,-1*x),r=r.slice(0,-1*x)),n.push(this.productions_[_[1]][0]),s.push($.$),r.push($._$),v=a[n[n.length-2]][n[n.length-1]],n.push(v);break;case 3:return!0}}return!0}},y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,i,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((n=this._input.match(this.rules[s[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,i){switch(n){case 0:return this.begin("open_directive"),28;case 1:return this.begin("type_directive"),29;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),31;case 4:return 30;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 27;case 21:return 26;case 22:return 6;case 23:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?::\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23],inclusive:!0}}};function g(){this.yy={}}return p.lexer=y,g.prototype=p,p.Parser=g,new g}());c.parser=c;const l=c;let h="",d=0;const u=[],p=[],y=[],g=()=>i.j,f=(t,e,n)=>{(0,i.k)(globalThis,t,e,n)},m=function(){u.length=0,p.length=0,h="",y.length=0,(0,i.m)()},_=function(t){h=t,u.push(t)},b=function(){return u},k=function(){let t=S();let e=0;for(;!t&&e<100;)t=S(),e++;return p.push(...y),p},x=function(t,e,n){const i={id:d++,section:h,type:h,task:t,score:e||0,events:n?[n]:[]};y.push(i)},v=function(t){y.find((t=>t.id===d-1)).events.push(t)},w=function(t){const e={section:h,type:h,description:t,task:t,classes:[]};p.push(e)},S=function(){let t=!0;for(const[e,n]of y.entries())y[e].processed,t=t&&n.processed;return t},$={clear:m,getCommonDb:g,addSection:_,getSections:b,getTasks:k,addTask:x,addTaskOrg:w,addEvent:v,parseDirective:f},E=Object.freeze(Object.defineProperty({__proto__:null,addEvent:v,addSection:_,addTask:x,addTaskOrg:w,clear:m,default:$,getCommonDb:g,getSections:b,getTasks:k,parseDirective:f},Symbol.toStringTag,{value:"Module"}));!function(){function t(t,e,n,s,r,a,o,c){i(e.append("text").attr("x",n+r/2).attr("y",s+a/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function e(t,e,n,s,r,a,o,c,l){const{taskFontSize:h,taskFontFamily:d}=c,u=t.split(/<br\s*\/?>/gi);for(let p=0;p<u.length;p++){const t=p*h-h*(u.length-1)/2,c=e.append("text").attr("x",n+r/2).attr("y",s).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",d);c.append("tspan").attr("x",n+r/2).attr("dy",t).text(u[p]),c.attr("y",s+a/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(c,o)}}function n(t,n,s,r,a,o,c,l){const h=n.append("switch"),d=h.append("foreignObject").attr("x",s).attr("y",r).attr("width",a).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,s,r,a,o,c,l),i(d,c)}function i(t,e){for(const n in e)n in e&&t.attr(n,e[n])}}();function I(t,e){t.each((function(){var t,n=(0,s.Ys)(this),i=n.text().split(/(\s+|<br>)/).reverse(),r=[],a=n.attr("y"),o=parseFloat(n.attr("dy")),c=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",o+"em");for(let s=0;s<i.length;s++)t=i[i.length-1-s],r.push(t),c.text(r.join(" ").trim()),(c.node().getComputedTextLength()>e||"<br>"===t)&&(r.pop(),c.text(r.join(" ").trim()),r="<br>"===t?[""]:[t],c=n.append("tspan").attr("x",0).attr("y",a).attr("dy","1.1em").text(t))}))}const T=function(t,e,n){t.append("path").attr("id","node-"+e.id).attr("class","node-bkg node-"+e.type).attr("d",`M0 ${e.height-5} v${10-e.height} q0,-5 5,-5 h${e.width-10} q5,0 5,5 v${e.height-5} H0 Z`),t.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",e.height).attr("x2",e.width).attr("y2",e.height)},D=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},L=function(t,e,n,i){const s=n%12-1,r=t.append("g");e.section=s,r.attr("class",(e.class?e.class+" ":"")+"timeline-node section-"+s);const a=r.append("g"),o=r.append("g"),c=o.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(I,e.width).node().getBBox(),l=i.fontSize&&i.fontSize.replace?i.fontSize.replace("px",""):i.fontSize;return e.height=c.height+1.1*l*.5+e.padding,e.height=Math.max(e.height,e.maxHeight),e.width=e.width+2*e.padding,o.attr("transform","translate("+e.width/2+", "+e.padding/2+")"),T(a,e,s),e},C=function(t,e,n){const i=t.append("g"),s=i.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(I,e.width).node().getBBox(),r=n.fontSize&&n.fontSize.replace?n.fontSize.replace("px",""):n.fontSize;return i.remove(),s.height+1.1*r*.5+e.padding},M=function(t,e,n,s,r,a,o,c,l,h,d){for(const u of e){const e={descr:u.task,section:n,number:n,width:150,padding:20,maxHeight:a};i.l.debug("taskNode",e);const c=t.append("g").attr("class","taskWrapper"),p=L(c,e,n,o).height;if(i.l.debug("taskHeight after draw",p),c.attr("transform",`translate(${s}, ${r})`),a=Math.max(a,p),u.events){const e=t.append("g").attr("class","lineWrapper");let i=a;r+=100,i+=O(t,u.events,n,s,r,o),r-=100,e.append("line").attr("x1",s+95).attr("y1",r+a).attr("x2",s+95).attr("y2",r+a+(d?a:h)+l+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}s+=200,d&&!(0,i.g)().timeline.disableMulticolor&&n++}r-=10},O=function(t,e,n,s,r,a){let o=0;const c=r;r+=100;for(const l of e){const e={descr:l,section:n,number:n,width:150,padding:20,maxHeight:50};i.l.debug("eventNode",e);const c=t.append("g").attr("class","eventWrapper"),h=L(c,e,n,a).height;o+=h,c.attr("transform",`translate(${s}, ${r})`),r=r+10+h}return r=c,o},A={db:E,renderer:{setConf:function(t){Object.keys(t).forEach((function(e){conf[e]=t[e]}))},draw:function(t,e,n,r){const a=(0,i.g)(),o=a.leftMargin?a.leftMargin:50;r.db.clear(),r.parser.parse(t+"\n"),i.l.debug("timeline",r.db);const c=a.securityLevel;let l;"sandbox"===c&&(l=(0,s.Ys)("#i"+e));const h=("sandbox"===c?(0,s.Ys)(l.nodes()[0].contentDocument.body):(0,s.Ys)("body")).select("#"+e);h.append("g");const d=r.db.getTasks(),u=r.db.getCommonDb().getDiagramTitle();i.l.debug("task",d),D(h);const p=r.db.getSections();i.l.debug("sections",p);let y=0,g=0,f=0,m=0,_=50+o,b=50;m=50;let k=0,x=!0;p.forEach((function(t){const e=C(h,{number:k,descr:t,section:k,width:150,padding:20,maxHeight:y},a);i.l.debug("sectionHeight before draw",e),y=Math.max(y,e+20)}));let v=0,w=0;i.l.debug("tasks.length",d.length);for(const[s,$]of d.entries()){const t={number:s,descr:$,section:$.section,width:150,padding:20,maxHeight:g},e=C(h,t,a);i.l.debug("taskHeight before draw",e),g=Math.max(g,e+20),v=Math.max(v,$.events.length);let n=0;for(let i=0;i<$.events.length;i++){const t={descr:$.events[i],section:$.section,number:$.section,width:150,padding:20,maxHeight:50};n+=C(h,t,a)}w=Math.max(w,n)}i.l.debug("maxSectionHeight before draw",y),i.l.debug("maxTaskHeight before draw",g),p&&p.length>0?p.forEach((t=>{const e={number:k,descr:t,section:k,width:150,padding:20,maxHeight:y};i.l.debug("sectionNode",e);const n=h.append("g"),s=L(n,e,k,a);i.l.debug("sectionNode output",s),n.attr("transform",`translate(${_}, 50)`),b+=y+50;const r=d.filter((e=>e.section===t));r.length>0&&M(h,r,k,_,b,g,a,v,w,y,!1),_+=200*Math.max(r.length,1),b=50,k++})):(x=!1,M(h,d,k,_,b,g,a,v,w,y,!0));const S=h.node().getBBox();i.l.debug("bounds",S),u&&h.append("text").text(u).attr("x",S.width/2-o).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),f=x?y+g+150:g+100;h.append("g").attr("class","lineWrapper").append("line").attr("x1",o).attr("y1",f).attr("x2",S.width+3*o).attr("y2",f).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),(0,i.s)(void 0,h,a.timeline.padding?a.timeline.padding:50,!!a.timeline.useMaxWidth&&a.timeline.useMaxWidth)}},parser:l,styles:t=>`\n .edge {\n stroke-width: 3;\n }\n ${(t=>{let e="";for(let n=0;n<t.THEME_COLOR_LIMIT;n++)t["lineColor"+n]=t["lineColor"+n]||t["cScaleInv"+n],(0,r.Z)(t["lineColor"+n])?t["lineColor"+n]=(0,a.Z)(t["lineColor"+n],20):t["lineColor"+n]=(0,o.Z)(t["lineColor"+n],20);for(let n=0;n<t.THEME_COLOR_LIMIT;n++){const i=""+(17-3*n);e+=`\n .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} path {\n fill: ${t["cScale"+n]};\n }\n .section-${n-1} text {\n fill: ${t["cScaleLabel"+n]};\n }\n .node-icon-${n-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+n]};\n }\n .section-edge-${n-1}{\n stroke: ${t["cScale"+n]};\n }\n .edge-depth-${n-1}{\n stroke-width: ${i};\n }\n .section-${n-1} line {\n stroke: ${t["cScaleInv"+n]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${t["cScaleLabel"+n]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: lightgray;\n }\n .disabled text {\n fill: #efefef;\n }\n `}return e})(t)}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`}},75627:(t,e,n)=>{n.d(e,{Z:()=>o});var i=n(83445),s=n(31739);const r=t=>{const{r:e,g:n,b:r}=s.Z.parse(t),a=.2126*i.Z.channel.toLinear(e)+.7152*i.Z.channel.toLinear(n)+.0722*i.Z.channel.toLinear(r);return i.Z.lang.round(a)},a=t=>r(t)>=.5,o=t=>!a(t)}}]); \ No newline at end of file diff --git a/assets/js/72451d75.45e40fb2.js b/assets/js/72451d75.45e40fb2.js new file mode 100644 index 00000000000..4b48e4d6f35 --- /dev/null +++ b/assets/js/72451d75.45e40fb2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7394],{35318:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>k});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},m="mdxType",s={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(t),d=i,k=m["".concat(c,".").concat(d)]||m[d]||s[d]||a;return t?r.createElement(k,l(l({ref:n},u),{},{components:t})):r.createElement(k,l({ref:n},u))}));function k(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,l=new Array(a);l[0]=d;var o={};for(var c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);o.originalType=e,o[m]="string"==typeof e?e:i,l[1]=o;for(var p=2;p<a;p++)l[p]=t[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}d.displayName="MDXCreateElement"},67919:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>s,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var r=t(25773),i=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Illuminance service"},l="Illuminance",o={unversionedId:"api/clients/illuminance",id:"api/clients/illuminance",title:"Illuminance",description:"DeviceScript client for Illuminance service",source:"@site/docs/api/clients/illuminance.md",sourceDirName:"api/clients",slug:"/api/clients/illuminance",permalink:"/devicescript/api/clients/illuminance",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Illuminance service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3}],u={toc:p},m="wrapper";function s(e){let{components:n,...t}=e;return(0,i.kt)(m,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"illuminance"},"Illuminance"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"Detects the amount of light falling onto a given surface area."),(0,i.kt)("p",null,"Note that this is different from ",(0,i.kt)("em",{parentName:"p"},"luminance"),", the amount of light that passes through, emits from, or reflects off an object."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Illuminance } from "@devicescript/core"\n\nconst illuminance = new Illuminance()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The amount of illuminance, as lumens per square metre."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Illuminance } from "@devicescript/core"\n\nconst illuminance = new Illuminance()\n// ...\nconst value = await illuminance.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Illuminance } from "@devicescript/core"\n\nconst illuminance = new Illuminance()\n// ...\nilluminance.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"Error on the reported sensor value."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Illuminance } from "@devicescript/core"\n\nconst illuminance = new Illuminance()\n// ...\nconst value = await illuminance.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Illuminance } from "@devicescript/core"\n\nconst illuminance = new Illuminance()\n// ...\nilluminance.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/72a427b3.c3d3d89d.js b/assets/js/72a427b3.c3d3d89d.js new file mode 100644 index 00000000000..e7863cac931 --- /dev/null +++ b/assets/js/72a427b3.c3d3d89d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5360],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var i=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(e,t){if(null==e)return{};var n,i,a=function(e,t){if(null==e)return{};var n,i,a={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return n?i.createElement(k,l(l({ref:t},u),{},{components:n})):i.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:a,l[1]=r;for(var p=2;p<o;p++)l[p]=n[p];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}m.displayName="MDXCreateElement"},82177:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>p});var i=n(25773),a=(n(27378),n(35318));const o={sidebar_position:101,title:"Contributing"},l="Contributing",r={unversionedId:"contributing",id:"contributing",title:"Contributing",description:"Contributions are welcome!",source:"@site/docs/contributing.mdx",sourceDirName:".",slug:"/contributing",permalink:"/devicescript/contributing",draft:!1,tags:[],version:"current",sidebarPosition:101,frontMatter:{sidebar_position:101,title:"Contributing"},sidebar:"tutorialSidebar",previous:{title:"Release Notes",permalink:"/devicescript/changelog"}},s={},p=[{value:"Contributionut",id:"contributionut",level:2},{value:"Add Core JavaScript APIs",id:"add-core-javascript-apis",level:3},{value:"Samples",id:"samples",level:3},{value:"Documenting/patching console output",id:"documentingpatching-console-output",level:3},{value:"Adding Builtin Packages",id:"adding-builtin-packages",level:3},{value:"Local development",id:"local-development",level:2},{value:"Repository structure",id:"repository-structure",level:3},{value:"Compiler, runtime and command line",id:"compiler-runtime-and-command-line",level:3},{value:"Visual Studio Extension",id:"visual-studio-extension",level:3},{value:"Building packages",id:"building-packages",level:3},{value:"Documentation",id:"documentation",level:3},{value:"Release process",id:"release-process",level:2},{value:"Legal",id:"legal",level:2}],u={toc:p},c="wrapper";function d(e){let{components:t,...n}=e;return(0,a.kt)(c,(0,i.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Contributions are welcome!")),(0,a.kt)("h2",{id:"contributionut"},"Contributionut"),(0,a.kt)("h3",{id:"add-core-javascript-apis"},"Add Core JavaScript APIs"),(0,a.kt)("p",null,"The DeviceScript ",(0,a.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects"},"core js library")," is not complete; but it is possible to fill the gaps\nas needed. The requests are tracked by the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/issues?q=is%3Aissue+is%3Aopen+label%3A%22core+js%22"},"core js issue label"),"."),(0,a.kt)("p",null,"You will need a local development setup for these tasks."),(0,a.kt)("p",null,"If you want to add a new function:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"find the corresponding function definition in one of the ",(0,a.kt)("inlineCode",{parentName:"li"},"lib/es....d.ts")," file."),(0,a.kt)("li",{parentName:"ul"},"copy the definition in the corresponding interface in ",(0,a.kt)("inlineCode",{parentName:"li"},"packages/core/src/corelib.d.ts")),(0,a.kt)("li",{parentName:"ul"},"implement the function in the implementation file of the type (see ",(0,a.kt)("inlineCode",{parentName:"li"},"packages/core/src/array.ts")," for example).\nIf you are adding a new file, make sure to import it in ",(0,a.kt)("inlineCode",{parentName:"li"},"packages/core/src/index.ts"),"."),(0,a.kt)("li",{parentName:"ul"},"add test cases in the corresponding test file under ",(0,a.kt)("inlineCode",{parentName:"li"},"devs/run-tests")),(0,a.kt)("li",{parentName:"ul"},"build and test"),(0,a.kt)("li",{parentName:"ul"},"create a pull request and go!")),(0,a.kt)("p",null,"If you want to add a new Type, we currently have a limitation with the ",(0,a.kt)("inlineCode",{parentName:"p"},"core")," package and you will need to add it to the ",(0,a.kt)("inlineCode",{parentName:"p"},"runtime")," package:s"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"implement the class in the implementation file of the type (see ",(0,a.kt)("inlineCode",{parentName:"li"},"packages/runtime/src/map.ts")," for example).\nIf you are adding a new file, make sure to import it in ",(0,a.kt)("inlineCode",{parentName:"li"},"packages/runtime/src/map.ts"),"."),(0,a.kt)("li",{parentName:"ul"},"add test cases in the corresponding test file under ",(0,a.kt)("inlineCode",{parentName:"li"},"packages/runtime/src/main.ts")),(0,a.kt)("li",{parentName:"ul"},"build and test"),(0,a.kt)("li",{parentName:"ul"},"create a pull request and go!")),(0,a.kt)("h3",{id:"samples"},"Samples"),(0,a.kt)("p",null,"Documentation samples are located under ",(0,a.kt)("inlineCode",{parentName:"p"},"website/docs/samples"),".\nEach ",(0,a.kt)("inlineCode",{parentName:"p"},".mdx")," file contains a single self-contained sample."),(0,a.kt)("p",null,"It is typically easiest to develop a sample in a dedicate ",(0,a.kt)("inlineCode",{parentName:"p"},".ts")," file\nto leverage the editor's features, and then copy it to the ",(0,a.kt)("inlineCode",{parentName:"p"},".mdx")," file."),(0,a.kt)("p",null,"To run the docs locally, run ",(0,a.kt)("inlineCode",{parentName:"p"},"yarn docs"),". This will launch the docusaurus development server\nand refresh the documentation page on each edit."),(0,a.kt)("p",null,"If your sample requires multiple files, such as images,"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"create a folder with the same name as the ",(0,a.kt)("inlineCode",{parentName:"li"},".mdx")," file"),(0,a.kt)("li",{parentName:"ul"},"move your ",(0,a.kt)("inlineCode",{parentName:"li"},".mdx")," file and rename it to ",(0,a.kt)("inlineCode",{parentName:"li"},"index.mdx")),(0,a.kt)("li",{parentName:"ul"},"add a ",(0,a.kt)("inlineCode",{parentName:"li"},"_category_.json")," file with the front matter")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json"},'{\n "label": "Samples",\n "position": 3\n}\n')),(0,a.kt)("h3",{id:"documentingpatching-console-output"},"Documenting/patching console output"),(0,a.kt)("p",null,"To add new substitions from console output message to pretty text + URL, do the following."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"website/docs/developer/errors.mdx")," gets parsed by builderrors.mjs.\nThe hash of the H2 titles is the console log look up key (replacing - with spaces) and the H2 text will replace that key + URL."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"loopback rx ovf --\x3e Loopback buffer overflow (....#loopback-rx-ovf)\n")),(0,a.kt)("h3",{id:"adding-builtin-packages"},"Adding Builtin Packages"),(0,a.kt)("p",null,"Adding a new package is more advanced scenario and most likely we should have a discussion prior to start this work. You are welcome to publish packages under your account in npm."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"A good question to start with: Do we need a new builtin package or should it be a new npm package?")),(0,a.kt)("p",null,"Generally, search for ",(0,a.kt)("inlineCode",{parentName:"p"},"@devicescript/gpio")," within the workspace. The main places that need updating is:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"this file, ",(0,a.kt)("inlineCode",{parentName:"li"},"website/docs/developer/packages.mdx")),(0,a.kt)("li",{parentName:"ul"},"list in ",(0,a.kt)("inlineCode",{parentName:"li"},"plugin/src/plugin.ts")),(0,a.kt)("li",{parentName:"ul"},"list in ",(0,a.kt)("inlineCode",{parentName:"li"},"devs/run-test/allcompile.ts"))),(0,a.kt)("p",null,"After adding a new packages, run ",(0,a.kt)("inlineCode",{parentName:"p"},"yarn")," at the top-level to update workspace links,\nfollowed by the usual ",(0,a.kt)("inlineCode",{parentName:"p"},"yarn build"),"."),(0,a.kt)("h2",{id:"local-development"},"Local development"),(0,a.kt)("p",null,"The development requirement will vary (widely) depending\non which part of DeviceScript you want to work on."),(0,a.kt)("p",null,"Using Visual Studio Code is strongly recommended."),(0,a.kt)("h3",{id:"repository-structure"},"Repository structure"),(0,a.kt)("p",null,"This repository contains:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/jacdac-c"},"jacdac-c submodule"),", including sources for Jacdac client libraries and DeviceScript VM"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"compiler/")," - sources for DeviceScript compiler"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"runtime/devicescript-vm/")," - glue files to build DeviceScript VM as WASM module using ",(0,a.kt)("a",{parentName:"li",href:"https://emscripten.org/"},"emscripten"),"; ",(0,a.kt)("inlineCode",{parentName:"li"},"vm/dist/")," contain pre-built files"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"packages")," - builtin packages and sample project (",(0,a.kt)("inlineCode",{parentName:"li"},"packages/sampleprj"),")"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"runtime/posix/")," - implementation of Jacdac SDK HAL for grown-up POSIX-like operating systems (as opposed to embedded platforms)"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"vscode")," - Visual Studio Code extension"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"website")," - docusaurus documentation side")),(0,a.kt)("h3",{id:"compiler-runtime-and-command-line"},"Compiler, runtime and command line"),(0,a.kt)("p",null,"You can use the devcontainer to build. The instructions are tested for a Unix terminal."),(0,a.kt)("p",null,"If you want to build locally you need to install node.js. After cloning, the repo run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"yarn setup\n")),(0,a.kt)("p",null,"To run a watch build and the docs, run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"nvm use 18\nyarn dev\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"start ",(0,a.kt)("inlineCode",{parentName:"li"},"jacdac devtools")," (the npm version) and let it run"),(0,a.kt)("li",{parentName:"ul"},'open this folder in VSCode; use "Reopen in Container" if needed'),(0,a.kt)("li",{parentName:"ul"},"start Terminal in VSCode"),(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"yarn install")),(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"yarn build")),(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"yarn devs run devs/samples/something.ts")," - this will execute given DeviceScript program using the WASM binary")),(0,a.kt)("p",null,"If you want to develop the runtime (as opposed to compiler or website), you will also need\nGNU Make, C compiler, and ",(0,a.kt)("a",{parentName:"p",href:"https://emscripten.org/docs/getting_started/downloads.html"},"emscripten"),".\nOnce you have it all:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"make native")," to compile using native C compiler"),(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"yarn devs crun devs/samples/something.ts")," - this will execute given DeviceScript program using the POSIX/native binary"),(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"./runtime/built/jdcli 8082")," - this will run the POSIX/native DeviceScript server, which can be accessed from the devtools dashboard"),(0,a.kt)("li",{parentName:"ul"},"run ",(0,a.kt)("inlineCode",{parentName:"li"},"make em")," to compile using emscripten")),(0,a.kt)("h3",{id:"visual-studio-extension"},"Visual Studio Extension"),(0,a.kt)("p",null,"Open the Debug view in VSCode and run the ",(0,a.kt)("inlineCode",{parentName:"p"},"VSCode Extension")," configuration. This will launch a new VSCode instance with the extension loaded. A build is automatically triggered before launch VSCode."),(0,a.kt)("h3",{id:"building-packages"},"Building packages"),(0,a.kt)("p",null,"Similar to working on the Visual Studio Code extension, lunch the ",(0,a.kt)("inlineCode",{parentName:"p"},"VSCode Extension")," debugger configuration. This will launch a new VSCode instance with the extension loaded.\nIt should also open the ",(0,a.kt)("inlineCode",{parentName:"p"},"packages")," folder which will allow you to work on the built-in packages."),(0,a.kt)("h3",{id:"documentation"},"Documentation"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"yarn docs")," and edit any markdown file in the ",(0,a.kt)("inlineCode",{parentName:"p"},"website/docs")," folder. The changes should be automatically picked up and rendered by docusaurus."),(0,a.kt)("h2",{id:"release-process"},"Release process"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"yarn bump")," (or ",(0,a.kt)("inlineCode",{parentName:"p"},"make bump"),"). Alternatively, edit ",(0,a.kt)("inlineCode",{parentName:"p"},"img_version_patch")," in ",(0,a.kt)("inlineCode",{parentName:"p"},"bytecode/bytecode.md")," and push."),(0,a.kt)("p",null,"The cloud build will rebuild and check-in the VM, update version numbers in all ",(0,a.kt)("inlineCode",{parentName:"p"},"package.json")," files, and publish them."),(0,a.kt)("p",null,"If you bump minor, you need to also bump the firmware repos:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"go to each firmware repo (",(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32"},"https://github.com/microsoft/devicescript-esp32"),", ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-pico"},"https://github.com/microsoft/devicescript-pico"),", ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-stm32"},"https://github.com/microsoft/devicescript-stm32"),")"),(0,a.kt)("li",{parentName:"ul"},"update the ",(0,a.kt)("inlineCode",{parentName:"li"},"devicescript")," submodule"),(0,a.kt)("li",{parentName:"ul"},"run")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"make bump\n")),(0,a.kt)("h2",{id:"legal"},"Legal"),(0,a.kt)("p",null,"This project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit ",(0,a.kt)("a",{parentName:"p",href:"https://cla.opensource.microsoft.com"},"https://cla.opensource.microsoft.com"),"."),(0,a.kt)("p",null,"When you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA."),(0,a.kt)("p",null,"This project has adopted the ",(0,a.kt)("a",{parentName:"p",href:"https://opensource.microsoft.com/codeofconduct/"},"Microsoft Open Source Code of Conduct"),".\nFor more information see the ",(0,a.kt)("a",{parentName:"p",href:"https://opensource.microsoft.com/codeofconduct/faq/"},"Code of Conduct FAQ")," or\ncontact ",(0,a.kt)("a",{parentName:"p",href:"mailto:opencode@microsoft.com"},"opencode@microsoft.com")," with any additional questions or comments."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/735.2ada5507.js b/assets/js/735.2ada5507.js new file mode 100644 index 00000000000..becc13df2d8 --- /dev/null +++ b/assets/js/735.2ada5507.js @@ -0,0 +1,41590 @@ +exports.id = 735; +exports.ids = [735]; +exports.modules = { + +/***/ 43203: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(__webpack_require__(54899)); + else {} +})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_643__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_643__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_643__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __nested_webpack_require_643__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __nested_webpack_require_643__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __nested_webpack_require_643__.d = function(exports, name, getter) { +/******/ if(!__nested_webpack_require_643__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __nested_webpack_require_643__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __nested_webpack_require_643__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __nested_webpack_require_643__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_643__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_643__(__nested_webpack_require_643__.s = 7); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_0__; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __nested_webpack_require_3185__) { + +"use strict"; + + +var FDLayoutConstants = __nested_webpack_require_3185__(0).FDLayoutConstants; + +function CoSEConstants() {} + +//CoSEConstants inherits static props in FDLayoutConstants +for (var prop in FDLayoutConstants) { + CoSEConstants[prop] = FDLayoutConstants[prop]; +} + +CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false; +CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH; +CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60; +CoSEConstants.TILE = true; +CoSEConstants.TILING_PADDING_VERTICAL = 10; +CoSEConstants.TILING_PADDING_HORIZONTAL = 10; +CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false; // make this true when cose is used incrementally as a part of other non-incremental layout + +module.exports = CoSEConstants; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __nested_webpack_require_4002__) { + +"use strict"; + + +var FDLayoutEdge = __nested_webpack_require_4002__(0).FDLayoutEdge; + +function CoSEEdge(source, target, vEdge) { + FDLayoutEdge.call(this, source, target, vEdge); +} + +CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype); +for (var prop in FDLayoutEdge) { + CoSEEdge[prop] = FDLayoutEdge[prop]; +} + +module.exports = CoSEEdge; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __nested_webpack_require_4409__) { + +"use strict"; + + +var LGraph = __nested_webpack_require_4409__(0).LGraph; + +function CoSEGraph(parent, graphMgr, vGraph) { + LGraph.call(this, parent, graphMgr, vGraph); +} + +CoSEGraph.prototype = Object.create(LGraph.prototype); +for (var prop in LGraph) { + CoSEGraph[prop] = LGraph[prop]; +} + +module.exports = CoSEGraph; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __nested_webpack_require_4790__) { + +"use strict"; + + +var LGraphManager = __nested_webpack_require_4790__(0).LGraphManager; + +function CoSEGraphManager(layout) { + LGraphManager.call(this, layout); +} + +CoSEGraphManager.prototype = Object.create(LGraphManager.prototype); +for (var prop in LGraphManager) { + CoSEGraphManager[prop] = LGraphManager[prop]; +} + +module.exports = CoSEGraphManager; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __nested_webpack_require_5205__) { + +"use strict"; + + +var FDLayoutNode = __nested_webpack_require_5205__(0).FDLayoutNode; +var IMath = __nested_webpack_require_5205__(0).IMath; + +function CoSENode(gm, loc, size, vNode) { + FDLayoutNode.call(this, gm, loc, size, vNode); +} + +CoSENode.prototype = Object.create(FDLayoutNode.prototype); +for (var prop in FDLayoutNode) { + CoSENode[prop] = FDLayoutNode[prop]; +} + +CoSENode.prototype.move = function () { + var layout = this.graphManager.getLayout(); + this.displacementX = layout.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren; + this.displacementY = layout.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren; + + if (Math.abs(this.displacementX) > layout.coolingFactor * layout.maxNodeDisplacement) { + this.displacementX = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementX); + } + + if (Math.abs(this.displacementY) > layout.coolingFactor * layout.maxNodeDisplacement) { + this.displacementY = layout.coolingFactor * layout.maxNodeDisplacement * IMath.sign(this.displacementY); + } + + // a simple node, just move it + if (this.child == null) { + this.moveBy(this.displacementX, this.displacementY); + } + // an empty compound node, again just move it + else if (this.child.getNodes().length == 0) { + this.moveBy(this.displacementX, this.displacementY); + } + // non-empty compound node, propogate movement to children as well + else { + this.propogateDisplacementToChildren(this.displacementX, this.displacementY); + } + + layout.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY); + + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + this.displacementX = 0; + this.displacementY = 0; +}; + +CoSENode.prototype.propogateDisplacementToChildren = function (dX, dY) { + var nodes = this.getChild().getNodes(); + var node; + for (var i = 0; i < nodes.length; i++) { + node = nodes[i]; + if (node.getChild() == null) { + node.moveBy(dX, dY); + node.displacementX += dX; + node.displacementY += dY; + } else { + node.propogateDisplacementToChildren(dX, dY); + } + } +}; + +CoSENode.prototype.setPred1 = function (pred1) { + this.pred1 = pred1; +}; + +CoSENode.prototype.getPred1 = function () { + return pred1; +}; + +CoSENode.prototype.getPred2 = function () { + return pred2; +}; + +CoSENode.prototype.setNext = function (next) { + this.next = next; +}; + +CoSENode.prototype.getNext = function () { + return next; +}; + +CoSENode.prototype.setProcessed = function (processed) { + this.processed = processed; +}; + +CoSENode.prototype.isProcessed = function () { + return processed; +}; + +module.exports = CoSENode; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __nested_webpack_require_8085__) { + +"use strict"; + + +var FDLayout = __nested_webpack_require_8085__(0).FDLayout; +var CoSEGraphManager = __nested_webpack_require_8085__(4); +var CoSEGraph = __nested_webpack_require_8085__(3); +var CoSENode = __nested_webpack_require_8085__(5); +var CoSEEdge = __nested_webpack_require_8085__(2); +var CoSEConstants = __nested_webpack_require_8085__(1); +var FDLayoutConstants = __nested_webpack_require_8085__(0).FDLayoutConstants; +var LayoutConstants = __nested_webpack_require_8085__(0).LayoutConstants; +var Point = __nested_webpack_require_8085__(0).Point; +var PointD = __nested_webpack_require_8085__(0).PointD; +var Layout = __nested_webpack_require_8085__(0).Layout; +var Integer = __nested_webpack_require_8085__(0).Integer; +var IGeometry = __nested_webpack_require_8085__(0).IGeometry; +var LGraph = __nested_webpack_require_8085__(0).LGraph; +var Transform = __nested_webpack_require_8085__(0).Transform; + +function CoSELayout() { + FDLayout.call(this); + + this.toBeTiled = {}; // Memorize if a node is to be tiled or is tiled +} + +CoSELayout.prototype = Object.create(FDLayout.prototype); + +for (var prop in FDLayout) { + CoSELayout[prop] = FDLayout[prop]; +} + +CoSELayout.prototype.newGraphManager = function () { + var gm = new CoSEGraphManager(this); + this.graphManager = gm; + return gm; +}; + +CoSELayout.prototype.newGraph = function (vGraph) { + return new CoSEGraph(null, this.graphManager, vGraph); +}; + +CoSELayout.prototype.newNode = function (vNode) { + return new CoSENode(this.graphManager, vNode); +}; + +CoSELayout.prototype.newEdge = function (vEdge) { + return new CoSEEdge(null, null, vEdge); +}; + +CoSELayout.prototype.initParameters = function () { + FDLayout.prototype.initParameters.call(this, arguments); + if (!this.isSubLayout) { + if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) { + this.idealEdgeLength = 10; + } else { + this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH; + } + + this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + + // variables for tree reduction support + this.prunedNodesAll = []; + this.growTreeIterations = 0; + this.afterGrowthIterations = 0; + this.isTreeGrowing = false; + this.isGrowthFinished = false; + + // variables for cooling + this.coolingCycle = 0; + this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD; + this.finalTemperature = FDLayoutConstants.CONVERGENCE_CHECK_PERIOD / this.maxIterations; + this.coolingAdjuster = 1; + } +}; + +CoSELayout.prototype.layout = function () { + var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + if (createBendsAsNeeded) { + this.createBendpoints(); + this.graphManager.resetAllEdges(); + } + + this.level = 0; + return this.classicLayout(); +}; + +CoSELayout.prototype.classicLayout = function () { + this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(); + this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity); + this.calcNoOfChildrenForAllNodes(); + this.graphManager.calcLowestCommonAncestors(); + this.graphManager.calcInclusionTreeDepths(); + this.graphManager.getRoot().calcEstimatedSize(); + this.calcIdealEdgeLengths(); + + if (!this.incremental) { + var forest = this.getFlatForest(); + + // The graph associated with this layout is flat and a forest + if (forest.length > 0) { + this.positionNodesRadially(forest); + } + // The graph associated with this layout is not flat or a forest + else { + // Reduce the trees when incremental mode is not enabled and graph is not a forest + this.reduceTrees(); + // Update nodes that gravity will be applied + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection = this.nodesWithGravity.filter(function (x) { + return allNodes.has(x); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection); + + this.positionNodesRandomly(); + } + } else { + if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) { + // Reduce the trees in incremental mode if only this constant is set to true + this.reduceTrees(); + // Update nodes that gravity will be applied + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection = this.nodesWithGravity.filter(function (x) { + return allNodes.has(x); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection); + } + } + + this.initSpringEmbedder(); + this.runSpringEmbedder(); + + return true; +}; + +CoSELayout.prototype.tick = function () { + this.totalIterations++; + + if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + + if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.isConverged()) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + + this.coolingCycle++; + + if (this.layoutQuality == 0) { + // quality - "draft" + this.coolingAdjuster = this.coolingCycle; + } else if (this.layoutQuality == 1) { + // quality - "default" + this.coolingAdjuster = this.coolingCycle / 3; + } + + // cooling schedule is based on http://www.btluke.com/simanf1.html -> cooling schedule 3 + this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature); + this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor)); + } + // Operations while tree is growing again + if (this.isTreeGrowing) { + if (this.growTreeIterations % 10 == 0) { + if (this.prunedNodesAll.length > 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + this.growTree(this.prunedNodesAll); + // Update nodes that gravity will be applied + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection = this.nodesWithGravity.filter(function (x) { + return allNodes.has(x); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection); + + this.graphManager.updateBounds(); + this.updateGrid(); + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + } else { + this.isTreeGrowing = false; + this.isGrowthFinished = true; + } + } + this.growTreeIterations++; + } + // Operations after growth is finished + if (this.isGrowthFinished) { + if (this.isConverged()) { + return true; + } + if (this.afterGrowthIterations % 10 == 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + } + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100); + this.afterGrowthIterations++; + } + + var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished; + var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished; + + this.totalDisplacement = 0; + this.graphManager.updateBounds(); + this.calcSpringForces(); + this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate); + this.calcGravitationalForces(); + this.moveNodes(); + this.animate(); + + return false; // Layout is not ended yet return false +}; + +CoSELayout.prototype.getPositionsData = function () { + var allNodes = this.graphManager.getAllNodes(); + var pData = {}; + for (var i = 0; i < allNodes.length; i++) { + var rect = allNodes[i].rect; + var id = allNodes[i].id; + pData[id] = { + id: id, + x: rect.getCenterX(), + y: rect.getCenterY(), + w: rect.width, + h: rect.height + }; + } + + return pData; +}; + +CoSELayout.prototype.runSpringEmbedder = function () { + this.initialAnimationPeriod = 25; + this.animationPeriod = this.initialAnimationPeriod; + var layoutEnded = false; + + // If aminate option is 'during' signal that layout is supposed to start iterating + if (FDLayoutConstants.ANIMATE === 'during') { + this.emit('layoutstarted'); + } else { + // If aminate option is 'during' tick() function will be called on index.js + while (!layoutEnded) { + layoutEnded = this.tick(); + } + + this.graphManager.updateBounds(); + } +}; + +CoSELayout.prototype.calculateNodesToApplyGravitationTo = function () { + var nodeList = []; + var graph; + + var graphs = this.graphManager.getGraphs(); + var size = graphs.length; + var i; + for (i = 0; i < size; i++) { + graph = graphs[i]; + + graph.updateConnected(); + + if (!graph.isConnected) { + nodeList = nodeList.concat(graph.getNodes()); + } + } + + return nodeList; +}; + +CoSELayout.prototype.createBendpoints = function () { + var edges = []; + edges = edges.concat(this.graphManager.getAllEdges()); + var visited = new Set(); + var i; + for (i = 0; i < edges.length; i++) { + var edge = edges[i]; + + if (!visited.has(edge)) { + var source = edge.getSource(); + var target = edge.getTarget(); + + if (source == target) { + edge.getBendpoints().push(new PointD()); + edge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(edge); + visited.add(edge); + } else { + var edgeList = []; + + edgeList = edgeList.concat(source.getEdgeListToNode(target)); + edgeList = edgeList.concat(target.getEdgeListToNode(source)); + + if (!visited.has(edgeList[0])) { + if (edgeList.length > 1) { + var k; + for (k = 0; k < edgeList.length; k++) { + var multiEdge = edgeList[k]; + multiEdge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(multiEdge); + } + } + edgeList.forEach(function (edge) { + visited.add(edge); + }); + } + } + } + + if (visited.size == edges.length) { + break; + } + } +}; + +CoSELayout.prototype.positionNodesRadially = function (forest) { + // We tile the trees to a grid row by row; first tree starts at (0,0) + var currentStartingPoint = new Point(0, 0); + var numberOfColumns = Math.ceil(Math.sqrt(forest.length)); + var height = 0; + var currentY = 0; + var currentX = 0; + var point = new PointD(0, 0); + + for (var i = 0; i < forest.length; i++) { + if (i % numberOfColumns == 0) { + // Start of a new row, make the x coordinate 0, increment the + // y coordinate with the max height of the previous row + currentX = 0; + currentY = height; + + if (i != 0) { + currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION; + } + + height = 0; + } + + var tree = forest[i]; + + // Find the center of the tree + var centerNode = Layout.findCenterOfTree(tree); + + // Set the staring point of the next tree + currentStartingPoint.x = currentX; + currentStartingPoint.y = currentY; + + // Do a radial layout starting with the center + point = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint); + + if (point.y > height) { + height = Math.floor(point.y); + } + + currentX = Math.floor(point.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION); + } + + this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point.x / 2, LayoutConstants.WORLD_CENTER_Y - point.y / 2)); +}; + +CoSELayout.radialLayout = function (tree, centerNode, startingPoint) { + var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION); + CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep); + var bounds = LGraph.calculateBounds(tree); + + var transform = new Transform(); + transform.setDeviceOrgX(bounds.getMinX()); + transform.setDeviceOrgY(bounds.getMinY()); + transform.setWorldOrgX(startingPoint.x); + transform.setWorldOrgY(startingPoint.y); + + for (var i = 0; i < tree.length; i++) { + var node = tree[i]; + node.transform(transform); + } + + var bottomRight = new PointD(bounds.getMaxX(), bounds.getMaxY()); + + return transform.inverseTransformPoint(bottomRight); +}; + +CoSELayout.branchRadialLayout = function (node, parentOfNode, startAngle, endAngle, distance, radialSeparation) { + // First, position this node by finding its angle. + var halfInterval = (endAngle - startAngle + 1) / 2; + + if (halfInterval < 0) { + halfInterval += 180; + } + + var nodeAngle = (halfInterval + startAngle) % 360; + var teta = nodeAngle * IGeometry.TWO_PI / 360; + + // Make polar to java cordinate conversion. + var cos_teta = Math.cos(teta); + var x_ = distance * Math.cos(teta); + var y_ = distance * Math.sin(teta); + + node.setCenter(x_, y_); + + // Traverse all neighbors of this node and recursively call this + // function. + var neighborEdges = []; + neighborEdges = neighborEdges.concat(node.getEdges()); + var childCount = neighborEdges.length; + + if (parentOfNode != null) { + childCount--; + } + + var branchCount = 0; + + var incEdgesCount = neighborEdges.length; + var startIndex; + + var edges = node.getEdgesBetween(parentOfNode); + + // If there are multiple edges, prune them until there remains only one + // edge. + while (edges.length > 1) { + //neighborEdges.remove(edges.remove(0)); + var temp = edges[0]; + edges.splice(0, 1); + var index = neighborEdges.indexOf(temp); + if (index >= 0) { + neighborEdges.splice(index, 1); + } + incEdgesCount--; + childCount--; + } + + if (parentOfNode != null) { + //assert edges.length == 1; + startIndex = (neighborEdges.indexOf(edges[0]) + 1) % incEdgesCount; + } else { + startIndex = 0; + } + + var stepAngle = Math.abs(endAngle - startAngle) / childCount; + + for (var i = startIndex; branchCount != childCount; i = ++i % incEdgesCount) { + var currentNeighbor = neighborEdges[i].getOtherEnd(node); + + // Don't back traverse to root node in current tree. + if (currentNeighbor == parentOfNode) { + continue; + } + + var childStartAngle = (startAngle + branchCount * stepAngle) % 360; + var childEndAngle = (childStartAngle + stepAngle) % 360; + + CoSELayout.branchRadialLayout(currentNeighbor, node, childStartAngle, childEndAngle, distance + radialSeparation, radialSeparation); + + branchCount++; + } +}; + +CoSELayout.maxDiagonalInTree = function (tree) { + var maxDiagonal = Integer.MIN_VALUE; + + for (var i = 0; i < tree.length; i++) { + var node = tree[i]; + var diagonal = node.getDiagonal(); + + if (diagonal > maxDiagonal) { + maxDiagonal = diagonal; + } + } + + return maxDiagonal; +}; + +CoSELayout.prototype.calcRepulsionRange = function () { + // formula is 2 x (level + 1) x idealEdgeLength + return 2 * (this.level + 1) * this.idealEdgeLength; +}; + +// Tiling methods + +// Group zero degree members whose parents are not to be tiled, create dummy parents where needed and fill memberGroups by their dummp parent id's +CoSELayout.prototype.groupZeroDegreeMembers = function () { + var self = this; + // array of [parent_id x oneDegreeNode_id] + var tempMemberGroups = {}; // A temporary map of parent node and its zero degree members + this.memberGroups = {}; // A map of dummy parent node and its zero degree members whose parents are not to be tiled + this.idToDummyNode = {}; // A map of id to dummy node + + var zeroDegree = []; // List of zero degree nodes whose parents are not to be tiled + var allNodes = this.graphManager.getAllNodes(); + + // Fill zero degree list + for (var i = 0; i < allNodes.length; i++) { + var node = allNodes[i]; + var parent = node.getParent(); + // If a node has zero degree and its parent is not to be tiled if exists add that node to zeroDegres list + if (this.getNodeDegreeWithChildren(node) === 0 && (parent.id == undefined || !this.getToBeTiled(parent))) { + zeroDegree.push(node); + } + } + + // Create a map of parent node and its zero degree members + for (var i = 0; i < zeroDegree.length; i++) { + var node = zeroDegree[i]; // Zero degree node itself + var p_id = node.getParent().id; // Parent id + + if (typeof tempMemberGroups[p_id] === "undefined") tempMemberGroups[p_id] = []; + + tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node); // Push node to the list belongs to its parent in tempMemberGroups + } + + // If there are at least two nodes at a level, create a dummy compound for them + Object.keys(tempMemberGroups).forEach(function (p_id) { + if (tempMemberGroups[p_id].length > 1) { + var dummyCompoundId = "DummyCompound_" + p_id; // The id of dummy compound which will be created soon + self.memberGroups[dummyCompoundId] = tempMemberGroups[p_id]; // Add dummy compound to memberGroups + + var parent = tempMemberGroups[p_id][0].getParent(); // The parent of zero degree nodes will be the parent of new dummy compound + + // Create a dummy compound with calculated id + var dummyCompound = new CoSENode(self.graphManager); + dummyCompound.id = dummyCompoundId; + dummyCompound.paddingLeft = parent.paddingLeft || 0; + dummyCompound.paddingRight = parent.paddingRight || 0; + dummyCompound.paddingBottom = parent.paddingBottom || 0; + dummyCompound.paddingTop = parent.paddingTop || 0; + + self.idToDummyNode[dummyCompoundId] = dummyCompound; + + var dummyParentGraph = self.getGraphManager().add(self.newGraph(), dummyCompound); + var parentGraph = parent.getChild(); + + // Add dummy compound to parent the graph + parentGraph.add(dummyCompound); + + // For each zero degree node in this level remove it from its parent graph and add it to the graph of dummy parent + for (var i = 0; i < tempMemberGroups[p_id].length; i++) { + var node = tempMemberGroups[p_id][i]; + + parentGraph.remove(node); + dummyParentGraph.add(node); + } + } + }); +}; + +CoSELayout.prototype.clearCompounds = function () { + var childGraphMap = {}; + var idToNode = {}; + + // Get compound ordering by finding the inner one first + this.performDFSOnCompounds(); + + for (var i = 0; i < this.compoundOrder.length; i++) { + + idToNode[this.compoundOrder[i].id] = this.compoundOrder[i]; + childGraphMap[this.compoundOrder[i].id] = [].concat(this.compoundOrder[i].getChild().getNodes()); + + // Remove children of compounds + this.graphManager.remove(this.compoundOrder[i].getChild()); + this.compoundOrder[i].child = null; + } + + this.graphManager.resetAllNodes(); + + // Tile the removed children + this.tileCompoundMembers(childGraphMap, idToNode); +}; + +CoSELayout.prototype.clearZeroDegreeMembers = function () { + var self = this; + var tiledZeroDegreePack = this.tiledZeroDegreePack = []; + + Object.keys(this.memberGroups).forEach(function (id) { + var compoundNode = self.idToDummyNode[id]; // Get the dummy compound + + tiledZeroDegreePack[id] = self.tileNodes(self.memberGroups[id], compoundNode.paddingLeft + compoundNode.paddingRight); + + // Set the width and height of the dummy compound as calculated + compoundNode.rect.width = tiledZeroDegreePack[id].width; + compoundNode.rect.height = tiledZeroDegreePack[id].height; + }); +}; + +CoSELayout.prototype.repopulateCompounds = function () { + for (var i = this.compoundOrder.length - 1; i >= 0; i--) { + var lCompoundNode = this.compoundOrder[i]; + var id = lCompoundNode.id; + var horizontalMargin = lCompoundNode.paddingLeft; + var verticalMargin = lCompoundNode.paddingTop; + + this.adjustLocations(this.tiledMemberPack[id], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin); + } +}; + +CoSELayout.prototype.repopulateZeroDegreeMembers = function () { + var self = this; + var tiledPack = this.tiledZeroDegreePack; + + Object.keys(tiledPack).forEach(function (id) { + var compoundNode = self.idToDummyNode[id]; // Get the dummy compound by its id + var horizontalMargin = compoundNode.paddingLeft; + var verticalMargin = compoundNode.paddingTop; + + // Adjust the positions of nodes wrt its compound + self.adjustLocations(tiledPack[id], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin); + }); +}; + +CoSELayout.prototype.getToBeTiled = function (node) { + var id = node.id; + //firstly check the previous results + if (this.toBeTiled[id] != null) { + return this.toBeTiled[id]; + } + + //only compound nodes are to be tiled + var childGraph = node.getChild(); + if (childGraph == null) { + this.toBeTiled[id] = false; + return false; + } + + var children = childGraph.getNodes(); // Get the children nodes + + //a compound node is not to be tiled if all of its compound children are not to be tiled + for (var i = 0; i < children.length; i++) { + var theChild = children[i]; + + if (this.getNodeDegree(theChild) > 0) { + this.toBeTiled[id] = false; + return false; + } + + //pass the children not having the compound structure + if (theChild.getChild() == null) { + this.toBeTiled[theChild.id] = false; + continue; + } + + if (!this.getToBeTiled(theChild)) { + this.toBeTiled[id] = false; + return false; + } + } + this.toBeTiled[id] = true; + return true; +}; + +// Get degree of a node depending of its edges and independent of its children +CoSELayout.prototype.getNodeDegree = function (node) { + var id = node.id; + var edges = node.getEdges(); + var degree = 0; + + // For the edges connected + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + if (edge.getSource().id !== edge.getTarget().id) { + degree = degree + 1; + } + } + return degree; +}; + +// Get degree of a node with its children +CoSELayout.prototype.getNodeDegreeWithChildren = function (node) { + var degree = this.getNodeDegree(node); + if (node.getChild() == null) { + return degree; + } + var children = node.getChild().getNodes(); + for (var i = 0; i < children.length; i++) { + var child = children[i]; + degree += this.getNodeDegreeWithChildren(child); + } + return degree; +}; + +CoSELayout.prototype.performDFSOnCompounds = function () { + this.compoundOrder = []; + this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes()); +}; + +CoSELayout.prototype.fillCompexOrderByDFS = function (children) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.getChild() != null) { + this.fillCompexOrderByDFS(child.getChild().getNodes()); + } + if (this.getToBeTiled(child)) { + this.compoundOrder.push(child); + } + } +}; + +/** +* This method places each zero degree member wrt given (x,y) coordinates (top left). +*/ +CoSELayout.prototype.adjustLocations = function (organization, x, y, compoundHorizontalMargin, compoundVerticalMargin) { + x += compoundHorizontalMargin; + y += compoundVerticalMargin; + + var left = x; + + for (var i = 0; i < organization.rows.length; i++) { + var row = organization.rows[i]; + x = left; + var maxHeight = 0; + + for (var j = 0; j < row.length; j++) { + var lnode = row[j]; + + lnode.rect.x = x; // + lnode.rect.width / 2; + lnode.rect.y = y; // + lnode.rect.height / 2; + + x += lnode.rect.width + organization.horizontalPadding; + + if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height; + } + + y += maxHeight + organization.verticalPadding; + } +}; + +CoSELayout.prototype.tileCompoundMembers = function (childGraphMap, idToNode) { + var self = this; + this.tiledMemberPack = []; + + Object.keys(childGraphMap).forEach(function (id) { + // Get the compound node + var compoundNode = idToNode[id]; + + self.tiledMemberPack[id] = self.tileNodes(childGraphMap[id], compoundNode.paddingLeft + compoundNode.paddingRight); + + compoundNode.rect.width = self.tiledMemberPack[id].width; + compoundNode.rect.height = self.tiledMemberPack[id].height; + }); +}; + +CoSELayout.prototype.tileNodes = function (nodes, minWidth) { + var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL; + var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL; + var organization = { + rows: [], + rowWidth: [], + rowHeight: [], + width: 0, + height: minWidth, // assume minHeight equals to minWidth + verticalPadding: verticalPadding, + horizontalPadding: horizontalPadding + }; + + // Sort the nodes in ascending order of their areas + nodes.sort(function (n1, n2) { + if (n1.rect.width * n1.rect.height > n2.rect.width * n2.rect.height) return -1; + if (n1.rect.width * n1.rect.height < n2.rect.width * n2.rect.height) return 1; + return 0; + }); + + // Create the organization -> tile members + for (var i = 0; i < nodes.length; i++) { + var lNode = nodes[i]; + + if (organization.rows.length == 0) { + this.insertNodeToRow(organization, lNode, 0, minWidth); + } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) { + this.insertNodeToRow(organization, lNode, this.getShortestRowIndex(organization), minWidth); + } else { + this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth); + } + + this.shiftToLastRow(organization); + } + + return organization; +}; + +CoSELayout.prototype.insertNodeToRow = function (organization, node, rowIndex, minWidth) { + var minCompoundSize = minWidth; + + // Add new row if needed + if (rowIndex == organization.rows.length) { + var secondDimension = []; + + organization.rows.push(secondDimension); + organization.rowWidth.push(minCompoundSize); + organization.rowHeight.push(0); + } + + // Update row width + var w = organization.rowWidth[rowIndex] + node.rect.width; + + if (organization.rows[rowIndex].length > 0) { + w += organization.horizontalPadding; + } + + organization.rowWidth[rowIndex] = w; + // Update compound width + if (organization.width < w) { + organization.width = w; + } + + // Update height + var h = node.rect.height; + if (rowIndex > 0) h += organization.verticalPadding; + + var extraHeight = 0; + if (h > organization.rowHeight[rowIndex]) { + extraHeight = organization.rowHeight[rowIndex]; + organization.rowHeight[rowIndex] = h; + extraHeight = organization.rowHeight[rowIndex] - extraHeight; + } + + organization.height += extraHeight; + + // Insert node + organization.rows[rowIndex].push(node); +}; + +//Scans the rows of an organization and returns the one with the min width +CoSELayout.prototype.getShortestRowIndex = function (organization) { + var r = -1; + var min = Number.MAX_VALUE; + + for (var i = 0; i < organization.rows.length; i++) { + if (organization.rowWidth[i] < min) { + r = i; + min = organization.rowWidth[i]; + } + } + return r; +}; + +//Scans the rows of an organization and returns the one with the max width +CoSELayout.prototype.getLongestRowIndex = function (organization) { + var r = -1; + var max = Number.MIN_VALUE; + + for (var i = 0; i < organization.rows.length; i++) { + + if (organization.rowWidth[i] > max) { + r = i; + max = organization.rowWidth[i]; + } + } + + return r; +}; + +/** +* This method checks whether adding extra width to the organization violates +* the aspect ratio(1) or not. +*/ +CoSELayout.prototype.canAddHorizontal = function (organization, extraWidth, extraHeight) { + + var sri = this.getShortestRowIndex(organization); + + if (sri < 0) { + return true; + } + + var min = organization.rowWidth[sri]; + + if (min + organization.horizontalPadding + extraWidth <= organization.width) return true; + + var hDiff = 0; + + // Adding to an existing row + if (organization.rowHeight[sri] < extraHeight) { + if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri]; + } + + var add_to_row_ratio; + if (organization.width - min >= extraWidth + organization.horizontalPadding) { + add_to_row_ratio = (organization.height + hDiff) / (min + extraWidth + organization.horizontalPadding); + } else { + add_to_row_ratio = (organization.height + hDiff) / organization.width; + } + + // Adding a new row for this node + hDiff = extraHeight + organization.verticalPadding; + var add_new_row_ratio; + if (organization.width < extraWidth) { + add_new_row_ratio = (organization.height + hDiff) / extraWidth; + } else { + add_new_row_ratio = (organization.height + hDiff) / organization.width; + } + + if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio; + + if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio; + + return add_to_row_ratio < add_new_row_ratio; +}; + +//If moving the last node from the longest row and adding it to the last +//row makes the bounding box smaller, do it. +CoSELayout.prototype.shiftToLastRow = function (organization) { + var longest = this.getLongestRowIndex(organization); + var last = organization.rowWidth.length - 1; + var row = organization.rows[longest]; + var node = row[row.length - 1]; + + var diff = node.width + organization.horizontalPadding; + + // Check if there is enough space on the last row + if (organization.width - organization.rowWidth[last] > diff && longest != last) { + // Remove the last element of the longest row + row.splice(-1, 1); + + // Push it to the last row + organization.rows[last].push(node); + + organization.rowWidth[longest] = organization.rowWidth[longest] - diff; + organization.rowWidth[last] = organization.rowWidth[last] + diff; + organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)]; + + // Update heights of the organization + var maxHeight = Number.MIN_VALUE; + for (var i = 0; i < row.length; i++) { + if (row[i].height > maxHeight) maxHeight = row[i].height; + } + if (longest > 0) maxHeight += organization.verticalPadding; + + var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last]; + + organization.rowHeight[longest] = maxHeight; + if (organization.rowHeight[last] < node.height + organization.verticalPadding) organization.rowHeight[last] = node.height + organization.verticalPadding; + + var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last]; + organization.height += finalTotal - prevTotal; + + this.shiftToLastRow(organization); + } +}; + +CoSELayout.prototype.tilingPreLayout = function () { + if (CoSEConstants.TILE) { + // Find zero degree nodes and create a compound for each level + this.groupZeroDegreeMembers(); + // Tile and clear children of each compound + this.clearCompounds(); + // Separately tile and clear zero degree nodes for each level + this.clearZeroDegreeMembers(); + } +}; + +CoSELayout.prototype.tilingPostLayout = function () { + if (CoSEConstants.TILE) { + this.repopulateZeroDegreeMembers(); + this.repopulateCompounds(); + } +}; + +// ----------------------------------------------------------------------------- +// Section: Tree Reduction methods +// ----------------------------------------------------------------------------- +// Reduce trees +CoSELayout.prototype.reduceTrees = function () { + var prunedNodesAll = []; + var containsLeaf = true; + var node; + + while (containsLeaf) { + var allNodes = this.graphManager.getAllNodes(); + var prunedNodesInStepTemp = []; + containsLeaf = false; + + for (var i = 0; i < allNodes.length; i++) { + node = allNodes[i]; + if (node.getEdges().length == 1 && !node.getEdges()[0].isInterGraph && node.getChild() == null) { + prunedNodesInStepTemp.push([node, node.getEdges()[0], node.getOwner()]); + containsLeaf = true; + } + } + if (containsLeaf == true) { + var prunedNodesInStep = []; + for (var j = 0; j < prunedNodesInStepTemp.length; j++) { + if (prunedNodesInStepTemp[j][0].getEdges().length == 1) { + prunedNodesInStep.push(prunedNodesInStepTemp[j]); + prunedNodesInStepTemp[j][0].getOwner().remove(prunedNodesInStepTemp[j][0]); + } + } + prunedNodesAll.push(prunedNodesInStep); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); + } + } + this.prunedNodesAll = prunedNodesAll; +}; + +// Grow tree one step +CoSELayout.prototype.growTree = function (prunedNodesAll) { + var lengthOfPrunedNodesInStep = prunedNodesAll.length; + var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1]; + + var nodeData; + for (var i = 0; i < prunedNodesInStep.length; i++) { + nodeData = prunedNodesInStep[i]; + + this.findPlaceforPrunedNode(nodeData); + + nodeData[2].add(nodeData[0]); + nodeData[2].add(nodeData[1], nodeData[1].source, nodeData[1].target); + } + + prunedNodesAll.splice(prunedNodesAll.length - 1, 1); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); +}; + +// Find an appropriate position to replace pruned node, this method can be improved +CoSELayout.prototype.findPlaceforPrunedNode = function (nodeData) { + + var gridForPrunedNode; + var nodeToConnect; + var prunedNode = nodeData[0]; + if (prunedNode == nodeData[1].source) { + nodeToConnect = nodeData[1].target; + } else { + nodeToConnect = nodeData[1].source; + } + var startGridX = nodeToConnect.startX; + var finishGridX = nodeToConnect.finishX; + var startGridY = nodeToConnect.startY; + var finishGridY = nodeToConnect.finishY; + + var upNodeCount = 0; + var downNodeCount = 0; + var rightNodeCount = 0; + var leftNodeCount = 0; + var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount]; + + if (startGridY > 0) { + for (var i = startGridX; i <= finishGridX; i++) { + controlRegions[0] += this.grid[i][startGridY - 1].length + this.grid[i][startGridY].length - 1; + } + } + if (finishGridX < this.grid.length - 1) { + for (var i = startGridY; i <= finishGridY; i++) { + controlRegions[1] += this.grid[finishGridX + 1][i].length + this.grid[finishGridX][i].length - 1; + } + } + if (finishGridY < this.grid[0].length - 1) { + for (var i = startGridX; i <= finishGridX; i++) { + controlRegions[2] += this.grid[i][finishGridY + 1].length + this.grid[i][finishGridY].length - 1; + } + } + if (startGridX > 0) { + for (var i = startGridY; i <= finishGridY; i++) { + controlRegions[3] += this.grid[startGridX - 1][i].length + this.grid[startGridX][i].length - 1; + } + } + var min = Integer.MAX_VALUE; + var minCount; + var minIndex; + for (var j = 0; j < controlRegions.length; j++) { + if (controlRegions[j] < min) { + min = controlRegions[j]; + minCount = 1; + minIndex = j; + } else if (controlRegions[j] == min) { + minCount++; + } + } + + if (minCount == 3 && min == 0) { + if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) { + gridForPrunedNode = 1; + } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 0; + } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 3; + } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 2; + } + } else if (minCount == 2 && min == 0) { + var random = Math.floor(Math.random() * 2); + if (controlRegions[0] == 0 && controlRegions[1] == 0) { + ; + if (random == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 1; + } + } else if (controlRegions[0] == 0 && controlRegions[2] == 0) { + if (random == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[0] == 0 && controlRegions[3] == 0) { + if (random == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 3; + } + } else if (controlRegions[1] == 0 && controlRegions[2] == 0) { + if (random == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[1] == 0 && controlRegions[3] == 0) { + if (random == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 3; + } + } else { + if (random == 0) { + gridForPrunedNode = 2; + } else { + gridForPrunedNode = 3; + } + } + } else if (minCount == 4 && min == 0) { + var random = Math.floor(Math.random() * 4); + gridForPrunedNode = random; + } else { + gridForPrunedNode = minIndex; + } + + if (gridForPrunedNode == 0) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2); + } else if (gridForPrunedNode == 1) { + prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } else if (gridForPrunedNode == 2) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2); + } else { + prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } +}; + +module.exports = CoSELayout; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __nested_webpack_require_45620__) { + +"use strict"; + + +var coseBase = {}; + +coseBase.layoutBase = __nested_webpack_require_45620__(0); +coseBase.CoSEConstants = __nested_webpack_require_45620__(1); +coseBase.CoSEEdge = __nested_webpack_require_45620__(2); +coseBase.CoSEGraph = __nested_webpack_require_45620__(3); +coseBase.CoSEGraphManager = __nested_webpack_require_45620__(4); +coseBase.CoSELayout = __nested_webpack_require_45620__(6); +coseBase.CoSENode = __nested_webpack_require_45620__(5); + +module.exports = coseBase; + +/***/ }) +/******/ ]); +}); + +/***/ }), + +/***/ 35302: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(__webpack_require__(43203)); + else {} +})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_659__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_659__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_659__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __nested_webpack_require_659__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __nested_webpack_require_659__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __nested_webpack_require_659__.d = function(exports, name, getter) { +/******/ if(!__nested_webpack_require_659__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __nested_webpack_require_659__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __nested_webpack_require_659__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __nested_webpack_require_659__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_659__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_659__(__nested_webpack_require_659__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_0__; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __nested_webpack_require_3201__) { + +"use strict"; + + +var LayoutConstants = __nested_webpack_require_3201__(0).layoutBase.LayoutConstants; +var FDLayoutConstants = __nested_webpack_require_3201__(0).layoutBase.FDLayoutConstants; +var CoSEConstants = __nested_webpack_require_3201__(0).CoSEConstants; +var CoSELayout = __nested_webpack_require_3201__(0).CoSELayout; +var CoSENode = __nested_webpack_require_3201__(0).CoSENode; +var PointD = __nested_webpack_require_3201__(0).layoutBase.PointD; +var DimensionD = __nested_webpack_require_3201__(0).layoutBase.DimensionD; + +var defaults = { + // Called on `layoutready` + ready: function ready() {}, + // Called on `layoutstop` + stop: function stop() {}, + // 'draft', 'default' or 'proof" + // - 'draft' fast cooling rate + // - 'default' moderate cooling rate + // - "proof" slow cooling rate + quality: 'default', + // include labels in node dimensions + nodeDimensionsIncludeLabels: false, + // number of ticks per frame; higher is faster but more jerky + refresh: 30, + // Whether to fit the network view after when done + fit: true, + // Padding on fit + padding: 10, + // Whether to enable incremental mode + randomize: true, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: 4500, + // Ideal edge (non nested) length + idealEdgeLength: 50, + // Divisor to compute edge forces + edgeElasticity: 0.45, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 0.1, + // Gravity force (constant) + gravity: 0.25, + // Maximum number of iterations to perform + numIter: 2500, + // For enabling tiling + tile: true, + // Type of layout animation. The option set is {'during', 'end', false} + animate: 'end', + // Duration for animate:end + animationDuration: 500, + // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingVertical: 10, + // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingHorizontal: 10, + // Gravity range (constant) for compounds + gravityRangeCompound: 1.5, + // Gravity force (constant) for compounds + gravityCompound: 1.0, + // Gravity range (constant) + gravityRange: 3.8, + // Initial cooling factor for incremental layout + initialEnergyOnIncremental: 0.5 +}; + +function extend(defaults, options) { + var obj = {}; + + for (var i in defaults) { + obj[i] = defaults[i]; + } + + for (var i in options) { + obj[i] = options[i]; + } + + return obj; +}; + +function _CoSELayout(_options) { + this.options = extend(defaults, _options); + getUserOptions(this.options); +} + +var getUserOptions = function getUserOptions(options) { + if (options.nodeRepulsion != null) CoSEConstants.DEFAULT_REPULSION_STRENGTH = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = options.nodeRepulsion; + if (options.idealEdgeLength != null) CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options.idealEdgeLength; + if (options.edgeElasticity != null) CoSEConstants.DEFAULT_SPRING_STRENGTH = FDLayoutConstants.DEFAULT_SPRING_STRENGTH = options.edgeElasticity; + if (options.nestingFactor != null) CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options.nestingFactor; + if (options.gravity != null) CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options.gravity; + if (options.numIter != null) CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options.numIter; + if (options.gravityRange != null) CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options.gravityRange; + if (options.gravityCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options.gravityCompound; + if (options.gravityRangeCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options.gravityRangeCompound; + if (options.initialEnergyOnIncremental != null) CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options.initialEnergyOnIncremental; + + if (options.quality == 'draft') LayoutConstants.QUALITY = 0;else if (options.quality == 'proof') LayoutConstants.QUALITY = 2;else LayoutConstants.QUALITY = 1; + + CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options.nodeDimensionsIncludeLabels; + CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options.randomize; + CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options.animate; + CoSEConstants.TILE = options.tile; + CoSEConstants.TILING_PADDING_VERTICAL = typeof options.tilingPaddingVertical === 'function' ? options.tilingPaddingVertical.call() : options.tilingPaddingVertical; + CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options.tilingPaddingHorizontal === 'function' ? options.tilingPaddingHorizontal.call() : options.tilingPaddingHorizontal; +}; + +_CoSELayout.prototype.run = function () { + var ready; + var frameId; + var options = this.options; + var idToLNode = this.idToLNode = {}; + var layout = this.layout = new CoSELayout(); + var self = this; + + self.stopped = false; + + this.cy = this.options.cy; + + this.cy.trigger({ type: 'layoutstart', layout: this }); + + var gm = layout.newGraphManager(); + this.gm = gm; + + var nodes = this.options.eles.nodes(); + var edges = this.options.eles.edges(); + + this.root = gm.addRoot(); + this.processChildrenList(this.root, this.getTopMostNodes(nodes), layout); + + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var sourceNode = this.idToLNode[edge.data("source")]; + var targetNode = this.idToLNode[edge.data("target")]; + if (sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) { + var e1 = gm.add(layout.newEdge(), sourceNode, targetNode); + e1.id = edge.id(); + } + } + + var getPositions = function getPositions(ele, i) { + if (typeof ele === "number") { + ele = i; + } + var theId = ele.data('id'); + var lNode = self.idToLNode[theId]; + + return { + x: lNode.getRect().getCenterX(), + y: lNode.getRect().getCenterY() + }; + }; + + /* + * Reposition nodes in iterations animatedly + */ + var iterateAnimated = function iterateAnimated() { + // Thigs to perform after nodes are repositioned on screen + var afterReposition = function afterReposition() { + if (options.fit) { + options.cy.fit(options.eles, options.padding); + } + + if (!ready) { + ready = true; + self.cy.one('layoutready', options.ready); + self.cy.trigger({ type: 'layoutready', layout: self }); + } + }; + + var ticksPerFrame = self.options.refresh; + var isDone; + + for (var i = 0; i < ticksPerFrame && !isDone; i++) { + isDone = self.stopped || self.layout.tick(); + } + + // If layout is done + if (isDone) { + // If the layout is not a sublayout and it is successful perform post layout. + if (layout.checkLayoutSuccess() && !layout.isSubLayout) { + layout.doPostLayout(); + } + + // If layout has a tilingPostLayout function property call it. + if (layout.tilingPostLayout) { + layout.tilingPostLayout(); + } + + layout.isLayoutFinished = true; + + self.options.eles.nodes().positions(getPositions); + + afterReposition(); + + // trigger layoutstop when the layout stops (e.g. finishes) + self.cy.one('layoutstop', self.options.stop); + self.cy.trigger({ type: 'layoutstop', layout: self }); + + if (frameId) { + cancelAnimationFrame(frameId); + } + + ready = false; + return; + } + + var animationData = self.layout.getPositionsData(); // Get positions of layout nodes note that all nodes may not be layout nodes because of tiling + + // Position nodes, for the nodes whose id does not included in data (because they are removed from their parents and included in dummy compounds) + // use position of their ancestors or dummy ancestors + options.eles.nodes().positions(function (ele, i) { + if (typeof ele === "number") { + ele = i; + } + // If ele is a compound node, then its position will be defined by its children + if (!ele.isParent()) { + var theId = ele.id(); + var pNode = animationData[theId]; + var temp = ele; + // If pNode is undefined search until finding position data of its first ancestor (It may be dummy as well) + while (pNode == null) { + pNode = animationData[temp.data('parent')] || animationData['DummyCompound_' + temp.data('parent')]; + animationData[theId] = pNode; + temp = temp.parent()[0]; + if (temp == undefined) { + break; + } + } + if (pNode != null) { + return { + x: pNode.x, + y: pNode.y + }; + } else { + return { + x: ele.position('x'), + y: ele.position('y') + }; + } + } + }); + + afterReposition(); + + frameId = requestAnimationFrame(iterateAnimated); + }; + + /* + * Listen 'layoutstarted' event and start animated iteration if animate option is 'during' + */ + layout.addListener('layoutstarted', function () { + if (self.options.animate === 'during') { + frameId = requestAnimationFrame(iterateAnimated); + } + }); + + layout.runLayout(); // Run cose layout + + /* + * If animate option is not 'during' ('end' or false) perform these here (If it is 'during' similar things are already performed) + */ + if (this.options.animate !== "during") { + self.options.eles.nodes().not(":parent").layoutPositions(self, self.options, getPositions); // Use layout positions to reposition the nodes it considers the options parameter + ready = false; + } + + return this; // chaining +}; + +//Get the top most ones of a list of nodes +_CoSELayout.prototype.getTopMostNodes = function (nodes) { + var nodesMap = {}; + for (var i = 0; i < nodes.length; i++) { + nodesMap[nodes[i].id()] = true; + } + var roots = nodes.filter(function (ele, i) { + if (typeof ele === "number") { + ele = i; + } + var parent = ele.parent()[0]; + while (parent != null) { + if (nodesMap[parent.id()]) { + return false; + } + parent = parent.parent()[0]; + } + return true; + }); + + return roots; +}; + +_CoSELayout.prototype.processChildrenList = function (parent, children, layout) { + var size = children.length; + for (var i = 0; i < size; i++) { + var theChild = children[i]; + var children_of_children = theChild.children(); + var theNode; + + var dimensions = theChild.layoutDimensions({ + nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels + }); + + if (theChild.outerWidth() != null && theChild.outerHeight() != null) { + theNode = parent.add(new CoSENode(layout.graphManager, new PointD(theChild.position('x') - dimensions.w / 2, theChild.position('y') - dimensions.h / 2), new DimensionD(parseFloat(dimensions.w), parseFloat(dimensions.h)))); + } else { + theNode = parent.add(new CoSENode(this.graphManager)); + } + // Attach id to the layout node + theNode.id = theChild.data("id"); + // Attach the paddings of cy node to layout node + theNode.paddingLeft = parseInt(theChild.css('padding')); + theNode.paddingTop = parseInt(theChild.css('padding')); + theNode.paddingRight = parseInt(theChild.css('padding')); + theNode.paddingBottom = parseInt(theChild.css('padding')); + + //Attach the label properties to compound if labels will be included in node dimensions + if (this.options.nodeDimensionsIncludeLabels) { + if (theChild.isParent()) { + var labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w; + var labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h; + var labelPos = theChild.css("text-halign"); + theNode.labelWidth = labelWidth; + theNode.labelHeight = labelHeight; + theNode.labelPos = labelPos; + } + } + + // Map the layout node + this.idToLNode[theChild.data("id")] = theNode; + + if (isNaN(theNode.rect.x)) { + theNode.rect.x = 0; + } + + if (isNaN(theNode.rect.y)) { + theNode.rect.y = 0; + } + + if (children_of_children != null && children_of_children.length > 0) { + var theNewGraph; + theNewGraph = layout.getGraphManager().add(layout.newGraph(), theNode); + this.processChildrenList(theNewGraph, children_of_children, layout); + } + } +}; + +/** + * @brief : called on continuous layouts to stop them before they finish + */ +_CoSELayout.prototype.stop = function () { + this.stopped = true; + + return this; // chaining +}; + +var register = function register(cytoscape) { + // var Layout = getLayout( cytoscape ); + + cytoscape('layout', 'cose-bilkent', _CoSELayout); +}; + +// auto reg for globals +if (typeof cytoscape !== 'undefined') { + register(cytoscape); +} + +module.exports = register; + +/***/ }) +/******/ ]); +}); + +/***/ }), + +/***/ 14413: +/***/ (function(module) { + +/** + * Copyright (c) 2016-2023, The Cytoscape Consortium. + * + * 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. + */ + +(function (global, factory) { + true ? module.exports = factory() : + 0; +})(this, (function () { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function _defineProperty$1(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArrayLimit(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + + var _s, _e; + + try { + for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var window$1 = typeof window === 'undefined' ? null : window; // eslint-disable-line no-undef + + var navigator = window$1 ? window$1.navigator : null; + window$1 ? window$1.document : null; + + var typeofstr = _typeof(''); + + var typeofobj = _typeof({}); + + var typeoffn = _typeof(function () {}); + + var typeofhtmlele = typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement); + + var instanceStr = function instanceStr(obj) { + return obj && obj.instanceString && fn$6(obj.instanceString) ? obj.instanceString() : null; + }; + + var string = function string(obj) { + return obj != null && _typeof(obj) == typeofstr; + }; + var fn$6 = function fn(obj) { + return obj != null && _typeof(obj) === typeoffn; + }; + var array = function array(obj) { + return !elementOrCollection(obj) && (Array.isArray ? Array.isArray(obj) : obj != null && obj instanceof Array); + }; + var plainObject = function plainObject(obj) { + return obj != null && _typeof(obj) === typeofobj && !array(obj) && obj.constructor === Object; + }; + var object = function object(obj) { + return obj != null && _typeof(obj) === typeofobj; + }; + var number$1 = function number(obj) { + return obj != null && _typeof(obj) === _typeof(1) && !isNaN(obj); + }; + var integer = function integer(obj) { + return number$1(obj) && Math.floor(obj) === obj; + }; + var htmlElement = function htmlElement(obj) { + if ('undefined' === typeofhtmlele) { + return undefined; + } else { + return null != obj && obj instanceof HTMLElement; + } + }; + var elementOrCollection = function elementOrCollection(obj) { + return element(obj) || collection(obj); + }; + var element = function element(obj) { + return instanceStr(obj) === 'collection' && obj._private.single; + }; + var collection = function collection(obj) { + return instanceStr(obj) === 'collection' && !obj._private.single; + }; + var core = function core(obj) { + return instanceStr(obj) === 'core'; + }; + var stylesheet = function stylesheet(obj) { + return instanceStr(obj) === 'stylesheet'; + }; + var event = function event(obj) { + return instanceStr(obj) === 'event'; + }; + var emptyString = function emptyString(obj) { + if (obj === undefined || obj === null) { + // null is empty + return true; + } else if (obj === '' || obj.match(/^\s+$/)) { + return true; // empty string is empty + } + + return false; // otherwise, we don't know what we've got + }; + var domElement = function domElement(obj) { + if (typeof HTMLElement === 'undefined') { + return false; // we're not in a browser so it doesn't matter + } else { + return obj instanceof HTMLElement; + } + }; + var boundingBox = function boundingBox(obj) { + return plainObject(obj) && number$1(obj.x1) && number$1(obj.x2) && number$1(obj.y1) && number$1(obj.y2); + }; + var promise = function promise(obj) { + return object(obj) && fn$6(obj.then); + }; + var ms = function ms() { + return navigator && navigator.userAgent.match(/msie|trident|edge/i); + }; // probably a better way to detect this... + + var memoize$1 = function memoize(fn, keyFn) { + if (!keyFn) { + keyFn = function keyFn() { + if (arguments.length === 1) { + return arguments[0]; + } else if (arguments.length === 0) { + return 'undefined'; + } + + var args = []; + + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + + return args.join('$'); + }; + } + + var memoizedFn = function memoizedFn() { + var self = this; + var args = arguments; + var ret; + var k = keyFn.apply(self, args); + var cache = memoizedFn.cache; + + if (!(ret = cache[k])) { + ret = cache[k] = fn.apply(self, args); + } + + return ret; + }; + + memoizedFn.cache = {}; + return memoizedFn; + }; + + var camel2dash = memoize$1(function (str) { + return str.replace(/([A-Z])/g, function (v) { + return '-' + v.toLowerCase(); + }); + }); + var dash2camel = memoize$1(function (str) { + return str.replace(/(-\w)/g, function (v) { + return v[1].toUpperCase(); + }); + }); + var prependCamel = memoize$1(function (prefix, str) { + return prefix + str[0].toUpperCase() + str.substring(1); + }, function (prefix, str) { + return prefix + '$' + str; + }); + var capitalize = function capitalize(str) { + if (emptyString(str)) { + return str; + } + + return str.charAt(0).toUpperCase() + str.substring(1); + }; + + var number = '(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))'; + var rgba = 'rgb[a]?\\((' + number + '[%]?)\\s*,\\s*(' + number + '[%]?)\\s*,\\s*(' + number + '[%]?)(?:\\s*,\\s*(' + number + '))?\\)'; + var rgbaNoBackRefs = 'rgb[a]?\\((?:' + number + '[%]?)\\s*,\\s*(?:' + number + '[%]?)\\s*,\\s*(?:' + number + '[%]?)(?:\\s*,\\s*(?:' + number + '))?\\)'; + var hsla = 'hsl[a]?\\((' + number + ')\\s*,\\s*(' + number + '[%])\\s*,\\s*(' + number + '[%])(?:\\s*,\\s*(' + number + '))?\\)'; + var hslaNoBackRefs = 'hsl[a]?\\((?:' + number + ')\\s*,\\s*(?:' + number + '[%])\\s*,\\s*(?:' + number + '[%])(?:\\s*,\\s*(?:' + number + '))?\\)'; + var hex3 = '\\#[0-9a-fA-F]{3}'; + var hex6 = '\\#[0-9a-fA-F]{6}'; + + var ascending = function ascending(a, b) { + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } + }; + var descending = function descending(a, b) { + return -1 * ascending(a, b); + }; + + var extend = Object.assign != null ? Object.assign.bind(Object) : function (tgt) { + var args = arguments; + + for (var i = 1; i < args.length; i++) { + var obj = args[i]; + + if (obj == null) { + continue; + } + + var keys = Object.keys(obj); + + for (var j = 0; j < keys.length; j++) { + var k = keys[j]; + tgt[k] = obj[k]; + } + } + + return tgt; + }; + + var hex2tuple = function hex2tuple(hex) { + if (!(hex.length === 4 || hex.length === 7) || hex[0] !== '#') { + return; + } + + var shortHex = hex.length === 4; + var r, g, b; + var base = 16; + + if (shortHex) { + r = parseInt(hex[1] + hex[1], base); + g = parseInt(hex[2] + hex[2], base); + b = parseInt(hex[3] + hex[3], base); + } else { + r = parseInt(hex[1] + hex[2], base); + g = parseInt(hex[3] + hex[4], base); + b = parseInt(hex[5] + hex[6], base); + } + + return [r, g, b]; + }; // get [r, g, b, a] from hsl(0, 0, 0) or hsla(0, 0, 0, 0) + + var hsl2tuple = function hsl2tuple(hsl) { + var ret; + var h, s, l, a, r, g, b; + + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + + var m = new RegExp('^' + hsla + '$').exec(hsl); + + if (m) { + // get hue + h = parseInt(m[1]); + + if (h < 0) { + h = (360 - -1 * h % 360) % 360; + } else if (h > 360) { + h = h % 360; + } + + h /= 360; // normalise on [0, 1] + + s = parseFloat(m[2]); + + if (s < 0 || s > 100) { + return; + } // saturation is [0, 100] + + + s = s / 100; // normalise on [0, 1] + + l = parseFloat(m[3]); + + if (l < 0 || l > 100) { + return; + } // lightness is [0, 100] + + + l = l / 100; // normalise on [0, 1] + + a = m[4]; + + if (a !== undefined) { + a = parseFloat(a); + + if (a < 0 || a > 1) { + return; + } // alpha is [0, 1] + + } // now, convert to rgb + // code from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + + + if (s === 0) { + r = g = b = Math.round(l * 255); // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = Math.round(255 * hue2rgb(p, q, h + 1 / 3)); + g = Math.round(255 * hue2rgb(p, q, h)); + b = Math.round(255 * hue2rgb(p, q, h - 1 / 3)); + } + + ret = [r, g, b, a]; + } + + return ret; + }; // get [r, g, b, a] from rgb(0, 0, 0) or rgba(0, 0, 0, 0) + + var rgb2tuple = function rgb2tuple(rgb) { + var ret; + var m = new RegExp('^' + rgba + '$').exec(rgb); + + if (m) { + ret = []; + var isPct = []; + + for (var i = 1; i <= 3; i++) { + var channel = m[i]; + + if (channel[channel.length - 1] === '%') { + isPct[i] = true; + } + + channel = parseFloat(channel); + + if (isPct[i]) { + channel = channel / 100 * 255; // normalise to [0, 255] + } + + if (channel < 0 || channel > 255) { + return; + } // invalid channel value + + + ret.push(Math.floor(channel)); + } + + var atLeastOneIsPct = isPct[1] || isPct[2] || isPct[3]; + var allArePct = isPct[1] && isPct[2] && isPct[3]; + + if (atLeastOneIsPct && !allArePct) { + return; + } // must all be percent values if one is + + + var alpha = m[4]; + + if (alpha !== undefined) { + alpha = parseFloat(alpha); + + if (alpha < 0 || alpha > 1) { + return; + } // invalid alpha value + + + ret.push(alpha); + } + } + + return ret; + }; + var colorname2tuple = function colorname2tuple(color) { + return colors[color.toLowerCase()]; + }; + var color2tuple = function color2tuple(color) { + return (array(color) ? color : null) || colorname2tuple(color) || hex2tuple(color) || rgb2tuple(color) || hsl2tuple(color); + }; + var colors = { + // special colour names + transparent: [0, 0, 0, 0], + // NB alpha === 0 + // regular colours + aliceblue: [240, 248, 255], + antiquewhite: [250, 235, 215], + aqua: [0, 255, 255], + aquamarine: [127, 255, 212], + azure: [240, 255, 255], + beige: [245, 245, 220], + bisque: [255, 228, 196], + black: [0, 0, 0], + blanchedalmond: [255, 235, 205], + blue: [0, 0, 255], + blueviolet: [138, 43, 226], + brown: [165, 42, 42], + burlywood: [222, 184, 135], + cadetblue: [95, 158, 160], + chartreuse: [127, 255, 0], + chocolate: [210, 105, 30], + coral: [255, 127, 80], + cornflowerblue: [100, 149, 237], + cornsilk: [255, 248, 220], + crimson: [220, 20, 60], + cyan: [0, 255, 255], + darkblue: [0, 0, 139], + darkcyan: [0, 139, 139], + darkgoldenrod: [184, 134, 11], + darkgray: [169, 169, 169], + darkgreen: [0, 100, 0], + darkgrey: [169, 169, 169], + darkkhaki: [189, 183, 107], + darkmagenta: [139, 0, 139], + darkolivegreen: [85, 107, 47], + darkorange: [255, 140, 0], + darkorchid: [153, 50, 204], + darkred: [139, 0, 0], + darksalmon: [233, 150, 122], + darkseagreen: [143, 188, 143], + darkslateblue: [72, 61, 139], + darkslategray: [47, 79, 79], + darkslategrey: [47, 79, 79], + darkturquoise: [0, 206, 209], + darkviolet: [148, 0, 211], + deeppink: [255, 20, 147], + deepskyblue: [0, 191, 255], + dimgray: [105, 105, 105], + dimgrey: [105, 105, 105], + dodgerblue: [30, 144, 255], + firebrick: [178, 34, 34], + floralwhite: [255, 250, 240], + forestgreen: [34, 139, 34], + fuchsia: [255, 0, 255], + gainsboro: [220, 220, 220], + ghostwhite: [248, 248, 255], + gold: [255, 215, 0], + goldenrod: [218, 165, 32], + gray: [128, 128, 128], + grey: [128, 128, 128], + green: [0, 128, 0], + greenyellow: [173, 255, 47], + honeydew: [240, 255, 240], + hotpink: [255, 105, 180], + indianred: [205, 92, 92], + indigo: [75, 0, 130], + ivory: [255, 255, 240], + khaki: [240, 230, 140], + lavender: [230, 230, 250], + lavenderblush: [255, 240, 245], + lawngreen: [124, 252, 0], + lemonchiffon: [255, 250, 205], + lightblue: [173, 216, 230], + lightcoral: [240, 128, 128], + lightcyan: [224, 255, 255], + lightgoldenrodyellow: [250, 250, 210], + lightgray: [211, 211, 211], + lightgreen: [144, 238, 144], + lightgrey: [211, 211, 211], + lightpink: [255, 182, 193], + lightsalmon: [255, 160, 122], + lightseagreen: [32, 178, 170], + lightskyblue: [135, 206, 250], + lightslategray: [119, 136, 153], + lightslategrey: [119, 136, 153], + lightsteelblue: [176, 196, 222], + lightyellow: [255, 255, 224], + lime: [0, 255, 0], + limegreen: [50, 205, 50], + linen: [250, 240, 230], + magenta: [255, 0, 255], + maroon: [128, 0, 0], + mediumaquamarine: [102, 205, 170], + mediumblue: [0, 0, 205], + mediumorchid: [186, 85, 211], + mediumpurple: [147, 112, 219], + mediumseagreen: [60, 179, 113], + mediumslateblue: [123, 104, 238], + mediumspringgreen: [0, 250, 154], + mediumturquoise: [72, 209, 204], + mediumvioletred: [199, 21, 133], + midnightblue: [25, 25, 112], + mintcream: [245, 255, 250], + mistyrose: [255, 228, 225], + moccasin: [255, 228, 181], + navajowhite: [255, 222, 173], + navy: [0, 0, 128], + oldlace: [253, 245, 230], + olive: [128, 128, 0], + olivedrab: [107, 142, 35], + orange: [255, 165, 0], + orangered: [255, 69, 0], + orchid: [218, 112, 214], + palegoldenrod: [238, 232, 170], + palegreen: [152, 251, 152], + paleturquoise: [175, 238, 238], + palevioletred: [219, 112, 147], + papayawhip: [255, 239, 213], + peachpuff: [255, 218, 185], + peru: [205, 133, 63], + pink: [255, 192, 203], + plum: [221, 160, 221], + powderblue: [176, 224, 230], + purple: [128, 0, 128], + red: [255, 0, 0], + rosybrown: [188, 143, 143], + royalblue: [65, 105, 225], + saddlebrown: [139, 69, 19], + salmon: [250, 128, 114], + sandybrown: [244, 164, 96], + seagreen: [46, 139, 87], + seashell: [255, 245, 238], + sienna: [160, 82, 45], + silver: [192, 192, 192], + skyblue: [135, 206, 235], + slateblue: [106, 90, 205], + slategray: [112, 128, 144], + slategrey: [112, 128, 144], + snow: [255, 250, 250], + springgreen: [0, 255, 127], + steelblue: [70, 130, 180], + tan: [210, 180, 140], + teal: [0, 128, 128], + thistle: [216, 191, 216], + tomato: [255, 99, 71], + turquoise: [64, 224, 208], + violet: [238, 130, 238], + wheat: [245, 222, 179], + white: [255, 255, 255], + whitesmoke: [245, 245, 245], + yellow: [255, 255, 0], + yellowgreen: [154, 205, 50] + }; + + var setMap = function setMap(options) { + var obj = options.map; + var keys = options.keys; + var l = keys.length; + + for (var i = 0; i < l; i++) { + var key = keys[i]; + + if (plainObject(key)) { + throw Error('Tried to set map with object key'); + } + + if (i < keys.length - 1) { + // extend the map if necessary + if (obj[key] == null) { + obj[key] = {}; + } + + obj = obj[key]; + } else { + // set the value + obj[key] = options.value; + } + } + }; // gets the value in a map even if it's not built in places + + var getMap = function getMap(options) { + var obj = options.map; + var keys = options.keys; + var l = keys.length; + + for (var i = 0; i < l; i++) { + var key = keys[i]; + + if (plainObject(key)) { + throw Error('Tried to get map with object key'); + } + + obj = obj[key]; + + if (obj == null) { + return obj; + } + } + + return obj; + }; // deletes the entry in the map + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); + } + + var isObject_1 = isObject; + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; + + var _freeGlobal = freeGlobal; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = _freeGlobal || freeSelf || Function('return this')(); + + var _root = root; + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = function() { + return _root.Date.now(); + }; + + var now_1 = now; + + /** Used to match a single whitespace character. */ + var reWhitespace = /\s/; + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; + } + + var _trimmedEndIndex = trimmedEndIndex; + + /** Used to match leading whitespace. */ + var reTrimStart = /^\s+/; + + /** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function baseTrim(string) { + return string + ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; + } + + var _baseTrim = baseTrim; + + /** Built-in value references. */ + var Symbol$1 = _root.Symbol; + + var _Symbol = Symbol$1; + + /** Used for built-in method references. */ + var objectProto$5 = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty$4 = objectProto$5.hasOwnProperty; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString$1 = objectProto$5.toString; + + /** Built-in value references. */ + var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined; + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty$4.call(value, symToStringTag$1), + tag = value[symToStringTag$1]; + + try { + value[symToStringTag$1] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString$1.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag$1] = tag; + } else { + delete value[symToStringTag$1]; + } + } + return result; + } + + var _getRawTag = getRawTag; + + /** Used for built-in method references. */ + var objectProto$4 = Object.prototype; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto$4.toString; + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + var _objectToString = objectToString; + + /** `Object#toString` result references. */ + var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + + /** Built-in value references. */ + var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? _getRawTag(value) + : _objectToString(value); + } + + var _baseGetTag = baseGetTag; + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + var isObjectLike_1 = isObjectLike; + + /** `Object#toString` result references. */ + var symbolTag = '[object Symbol]'; + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike_1(value) && _baseGetTag(value) == symbolTag); + } + + var isSymbol_1 = isSymbol; + + /** Used as references for various `Number` constants. */ + var NAN = 0 / 0; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Built-in method references without a dependency on `root`. */ + var freeParseInt = parseInt; + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol_1(value)) { + return NAN; + } + if (isObject_1(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject_1(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = _baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + var toNumber_1 = toNumber; + + /** Error message constants. */ + var FUNC_ERROR_TEXT$1 = 'Expected a function'; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max, + nativeMin = Math.min; + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT$1); + } + wait = toNumber_1(wait) || 0; + if (isObject_1(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber_1(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now_1(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now_1()); + } + + function debounced() { + var time = now_1(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + var debounce_1 = debounce; + + var performance = window$1 ? window$1.performance : null; + var pnow = performance && performance.now ? function () { + return performance.now(); + } : function () { + return Date.now(); + }; + + var raf = function () { + if (window$1) { + if (window$1.requestAnimationFrame) { + return function (fn) { + window$1.requestAnimationFrame(fn); + }; + } else if (window$1.mozRequestAnimationFrame) { + return function (fn) { + window$1.mozRequestAnimationFrame(fn); + }; + } else if (window$1.webkitRequestAnimationFrame) { + return function (fn) { + window$1.webkitRequestAnimationFrame(fn); + }; + } else if (window$1.msRequestAnimationFrame) { + return function (fn) { + window$1.msRequestAnimationFrame(fn); + }; + } + } + + return function (fn) { + if (fn) { + setTimeout(function () { + fn(pnow()); + }, 1000 / 60); + } + }; + }(); + + var requestAnimationFrame = function requestAnimationFrame(fn) { + return raf(fn); + }; + var performanceNow = pnow; + + var DEFAULT_HASH_SEED = 9261; + var K = 65599; // 37 also works pretty well + + var DEFAULT_HASH_SEED_ALT = 5381; + var hashIterableInts = function hashIterableInts(iterator) { + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HASH_SEED; + // sdbm/string-hash + var hash = seed; + var entry; + + for (;;) { + entry = iterator.next(); + + if (entry.done) { + break; + } + + hash = hash * K + entry.value | 0; + } + + return hash; + }; + var hashInt = function hashInt(num) { + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HASH_SEED; + // sdbm/string-hash + return seed * K + num | 0; + }; + var hashIntAlt = function hashIntAlt(num) { + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_HASH_SEED_ALT; + // djb2/string-hash + return (seed << 5) + seed + num | 0; + }; + var combineHashes = function combineHashes(hash1, hash2) { + return hash1 * 0x200000 + hash2; + }; + var combineHashesArray = function combineHashesArray(hashes) { + return hashes[0] * 0x200000 + hashes[1]; + }; + var hashArrays = function hashArrays(hashes1, hashes2) { + return [hashInt(hashes1[0], hashes2[0]), hashIntAlt(hashes1[1], hashes2[1])]; + }; + var hashIntsArray = function hashIntsArray(ints, seed) { + var entry = { + value: 0, + done: false + }; + var i = 0; + var length = ints.length; + var iterator = { + next: function next() { + if (i < length) { + entry.value = ints[i++]; + } else { + entry.done = true; + } + + return entry; + } + }; + return hashIterableInts(iterator, seed); + }; + var hashString = function hashString(str, seed) { + var entry = { + value: 0, + done: false + }; + var i = 0; + var length = str.length; + var iterator = { + next: function next() { + if (i < length) { + entry.value = str.charCodeAt(i++); + } else { + entry.done = true; + } + + return entry; + } + }; + return hashIterableInts(iterator, seed); + }; + var hashStrings = function hashStrings() { + return hashStringsArray(arguments); + }; + var hashStringsArray = function hashStringsArray(strs) { + var hash; + + for (var i = 0; i < strs.length; i++) { + var str = strs[i]; + + if (i === 0) { + hash = hashString(str); + } else { + hash = hashString(str, hash); + } + } + + return hash; + }; + + /*global console */ + var warningsEnabled = true; + var warnSupported = console.warn != null; // eslint-disable-line no-console + + var traceSupported = console.trace != null; // eslint-disable-line no-console + + var MAX_INT$1 = Number.MAX_SAFE_INTEGER || 9007199254740991; + var trueify = function trueify() { + return true; + }; + var falsify = function falsify() { + return false; + }; + var zeroify = function zeroify() { + return 0; + }; + var noop$1 = function noop() {}; + var error = function error(msg) { + throw new Error(msg); + }; + var warnings = function warnings(enabled) { + if (enabled !== undefined) { + warningsEnabled = !!enabled; + } else { + return warningsEnabled; + } + }; + var warn = function warn(msg) { + /* eslint-disable no-console */ + if (!warnings()) { + return; + } + + if (warnSupported) { + console.warn(msg); + } else { + console.log(msg); + + if (traceSupported) { + console.trace(); + } + } + }; + /* eslint-enable */ + + var clone = function clone(obj) { + return extend({}, obj); + }; // gets a shallow copy of the argument + + var copy = function copy(obj) { + if (obj == null) { + return obj; + } + + if (array(obj)) { + return obj.slice(); + } else if (plainObject(obj)) { + return clone(obj); + } else { + return obj; + } + }; + var copyArray$1 = function copyArray(arr) { + return arr.slice(); + }; + var uuid = function uuid(a, b + /* placeholders */ + ) { + for ( // loop :) + b = a = ''; // b - result , a - numeric letiable + a++ < 36; // + b += a * 51 & 52 // if "a" is not 9 or 14 or 19 or 24 + ? // return a random number or 4 + (a ^ 15 // if "a" is not 15 + ? // generate a random number from 0 to 15 + 8 ^ Math.random() * (a ^ 20 ? 16 : 4) // unless "a" is 20, in which case a random number from 8 to 11 + : 4 // otherwise 4 + ).toString(16) : '-' // in other cases (if "a" is 9,14,19,24) insert "-" + ) { + } + + return b; + }; + var _staticEmptyObject = {}; + var staticEmptyObject = function staticEmptyObject() { + return _staticEmptyObject; + }; + var defaults$g = function defaults(_defaults) { + var keys = Object.keys(_defaults); + return function (opts) { + var filledOpts = {}; + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var optVal = opts == null ? undefined : opts[key]; + filledOpts[key] = optVal === undefined ? _defaults[key] : optVal; + } + + return filledOpts; + }; + }; + var removeFromArray = function removeFromArray(arr, ele, oneCopy) { + for (var i = arr.length - 1; i >= 0; i--) { + if (arr[i] === ele) { + arr.splice(i, 1); + + if (oneCopy) { + break; + } + } + } + }; + var clearArray = function clearArray(arr) { + arr.splice(0, arr.length); + }; + var push = function push(arr, otherArr) { + for (var i = 0; i < otherArr.length; i++) { + var el = otherArr[i]; + arr.push(el); + } + }; + var getPrefixedProperty = function getPrefixedProperty(obj, propName, prefix) { + if (prefix) { + propName = prependCamel(prefix, propName); // e.g. (labelWidth, source) => sourceLabelWidth + } + + return obj[propName]; + }; + var setPrefixedProperty = function setPrefixedProperty(obj, propName, prefix, value) { + if (prefix) { + propName = prependCamel(prefix, propName); // e.g. (labelWidth, source) => sourceLabelWidth + } + + obj[propName] = value; + }; + + /* global Map */ + var ObjectMap = /*#__PURE__*/function () { + function ObjectMap() { + _classCallCheck(this, ObjectMap); + + this._obj = {}; + } + + _createClass(ObjectMap, [{ + key: "set", + value: function set(key, val) { + this._obj[key] = val; + return this; + } + }, { + key: "delete", + value: function _delete(key) { + this._obj[key] = undefined; + return this; + } + }, { + key: "clear", + value: function clear() { + this._obj = {}; + } + }, { + key: "has", + value: function has(key) { + return this._obj[key] !== undefined; + } + }, { + key: "get", + value: function get(key) { + return this._obj[key]; + } + }]); + + return ObjectMap; + }(); + + var Map$2 = typeof Map !== 'undefined' ? Map : ObjectMap; + + /* global Set */ + var undef = "undefined" ; + + var ObjectSet = /*#__PURE__*/function () { + function ObjectSet(arrayOrObjectSet) { + _classCallCheck(this, ObjectSet); + + this._obj = Object.create(null); + this.size = 0; + + if (arrayOrObjectSet != null) { + var arr; + + if (arrayOrObjectSet.instanceString != null && arrayOrObjectSet.instanceString() === this.instanceString()) { + arr = arrayOrObjectSet.toArray(); + } else { + arr = arrayOrObjectSet; + } + + for (var i = 0; i < arr.length; i++) { + this.add(arr[i]); + } + } + } + + _createClass(ObjectSet, [{ + key: "instanceString", + value: function instanceString() { + return 'set'; + } + }, { + key: "add", + value: function add(val) { + var o = this._obj; + + if (o[val] !== 1) { + o[val] = 1; + this.size++; + } + } + }, { + key: "delete", + value: function _delete(val) { + var o = this._obj; + + if (o[val] === 1) { + o[val] = 0; + this.size--; + } + } + }, { + key: "clear", + value: function clear() { + this._obj = Object.create(null); + } + }, { + key: "has", + value: function has(val) { + return this._obj[val] === 1; + } + }, { + key: "toArray", + value: function toArray() { + var _this = this; + + return Object.keys(this._obj).filter(function (key) { + return _this.has(key); + }); + } + }, { + key: "forEach", + value: function forEach(callback, thisArg) { + return this.toArray().forEach(callback, thisArg); + } + }]); + + return ObjectSet; + }(); + + var Set$1 = (typeof Set === "undefined" ? "undefined" : _typeof(Set)) !== undef ? Set : ObjectSet; + + var Element = function Element(cy, params) { + var restore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + + if (cy === undefined || params === undefined || !core(cy)) { + error('An element must have a core reference and parameters set'); + return; + } + + var group = params.group; // try to automatically infer the group if unspecified + + if (group == null) { + if (params.data && params.data.source != null && params.data.target != null) { + group = 'edges'; + } else { + group = 'nodes'; + } + } // validate group + + + if (group !== 'nodes' && group !== 'edges') { + error('An element must be of type `nodes` or `edges`; you specified `' + group + '`'); + return; + } // make the element array-like, just like a collection + + + this.length = 1; + this[0] = this; // NOTE: when something is added here, add also to ele.json() + + var _p = this._private = { + cy: cy, + single: true, + // indicates this is an element + data: params.data || {}, + // data object + position: params.position || { + x: 0, + y: 0 + }, + // (x, y) position pair + autoWidth: undefined, + // width and height of nodes calculated by the renderer when set to special 'auto' value + autoHeight: undefined, + autoPadding: undefined, + compoundBoundsClean: false, + // whether the compound dimensions need to be recalculated the next time dimensions are read + listeners: [], + // array of bound listeners + group: group, + // string; 'nodes' or 'edges' + style: {}, + // properties as set by the style + rstyle: {}, + // properties for style sent from the renderer to the core + styleCxts: [], + // applied style contexts from the styler + styleKeys: {}, + // per-group keys of style property values + removed: true, + // whether it's inside the vis; true if removed (set true here since we call restore) + selected: params.selected ? true : false, + // whether it's selected + selectable: params.selectable === undefined ? true : params.selectable ? true : false, + // whether it's selectable + locked: params.locked ? true : false, + // whether the element is locked (cannot be moved) + grabbed: false, + // whether the element is grabbed by the mouse; renderer sets this privately + grabbable: params.grabbable === undefined ? true : params.grabbable ? true : false, + // whether the element can be grabbed + pannable: params.pannable === undefined ? group === 'edges' ? true : false : params.pannable ? true : false, + // whether the element has passthrough panning enabled + active: false, + // whether the element is active from user interaction + classes: new Set$1(), + // map ( className => true ) + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + rscratch: {}, + // object in which the renderer can store information + scratch: params.scratch || {}, + // scratch objects + edges: [], + // array of connected edges + children: [], + // array of children + parent: params.parent && params.parent.isNode() ? params.parent : null, + // parent ref + traversalCache: {}, + // cache of output of traversal functions + backgrounding: false, + // whether background images are loading + bbCache: null, + // cache of the current bounding box + bbCacheShift: { + x: 0, + y: 0 + }, + // shift applied to cached bb to be applied on next get + bodyBounds: null, + // bounds cache of element body, w/o overlay + overlayBounds: null, + // bounds cache of element body, including overlay + labelBounds: { + // bounds cache of labels + all: null, + source: null, + target: null, + main: null + }, + arrowBounds: { + // bounds cache of edge arrows + source: null, + target: null, + 'mid-source': null, + 'mid-target': null + } + }; + + if (_p.position.x == null) { + _p.position.x = 0; + } + + if (_p.position.y == null) { + _p.position.y = 0; + } // renderedPosition overrides if specified + + + if (params.renderedPosition) { + var rpos = params.renderedPosition; + var pan = cy.pan(); + var zoom = cy.zoom(); + _p.position = { + x: (rpos.x - pan.x) / zoom, + y: (rpos.y - pan.y) / zoom + }; + } + + var classes = []; + + if (array(params.classes)) { + classes = params.classes; + } else if (string(params.classes)) { + classes = params.classes.split(/\s+/); + } + + for (var i = 0, l = classes.length; i < l; i++) { + var cls = classes[i]; + + if (!cls || cls === '') { + continue; + } + + _p.classes.add(cls); + } + + this.createEmitter(); + var bypass = params.style || params.css; + + if (bypass) { + warn('Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead.'); + this.style(bypass); + } + + if (restore === undefined || restore) { + this.restore(); + } + }; + + var defineSearch = function defineSearch(params) { + params = { + bfs: params.bfs || !params.dfs, + dfs: params.dfs || !params.bfs + }; // from pseudocode on wikipedia + + return function searchFn(roots, fn, directed) { + var options; + + if (plainObject(roots) && !elementOrCollection(roots)) { + options = roots; + roots = options.roots || options.root; + fn = options.visit; + directed = options.directed; + } + + directed = arguments.length === 2 && !fn$6(fn) ? fn : directed; + fn = fn$6(fn) ? fn : function () {}; + var cy = this._private.cy; + var v = roots = string(roots) ? this.filter(roots) : roots; + var Q = []; + var connectedNodes = []; + var connectedBy = {}; + var id2depth = {}; + var V = {}; + var j = 0; + var found; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; // enqueue v + + + for (var i = 0; i < v.length; i++) { + var vi = v[i]; + var viId = vi.id(); + + if (vi.isNode()) { + Q.unshift(vi); + + if (params.bfs) { + V[viId] = true; + connectedNodes.push(vi); + } + + id2depth[viId] = 0; + } + } + + var _loop = function _loop() { + var v = params.bfs ? Q.shift() : Q.pop(); + var vId = v.id(); + + if (params.dfs) { + if (V[vId]) { + return "continue"; + } + + V[vId] = true; + connectedNodes.push(v); + } + + var depth = id2depth[vId]; + var prevEdge = connectedBy[vId]; + var src = prevEdge != null ? prevEdge.source() : null; + var tgt = prevEdge != null ? prevEdge.target() : null; + var prevNode = prevEdge == null ? undefined : v.same(src) ? tgt[0] : src[0]; + var ret = void 0; + ret = fn(v, prevEdge, prevNode, j++, depth); + + if (ret === true) { + found = v; + return "break"; + } + + if (ret === false) { + return "break"; + } + + var vwEdges = v.connectedEdges().filter(function (e) { + return (!directed || e.source().same(v)) && edges.has(e); + }); + + for (var _i2 = 0; _i2 < vwEdges.length; _i2++) { + var e = vwEdges[_i2]; + var w = e.connectedNodes().filter(function (n) { + return !n.same(v) && nodes.has(n); + }); + var wId = w.id(); + + if (w.length !== 0 && !V[wId]) { + w = w[0]; + Q.push(w); + + if (params.bfs) { + V[wId] = true; + connectedNodes.push(w); + } + + connectedBy[wId] = e; + id2depth[wId] = id2depth[vId] + 1; + } + } + }; + + while (Q.length !== 0) { + var _ret = _loop(); + + if (_ret === "continue") continue; + if (_ret === "break") break; + } + + var connectedEles = cy.collection(); + + for (var _i = 0; _i < connectedNodes.length; _i++) { + var node = connectedNodes[_i]; + var edge = connectedBy[node.id()]; + + if (edge != null) { + connectedEles.push(edge); + } + + connectedEles.push(node); + } + + return { + path: cy.collection(connectedEles), + found: cy.collection(found) + }; + }; + }; // search, spanning trees, etc + + + var elesfn$v = { + breadthFirstSearch: defineSearch({ + bfs: true + }), + depthFirstSearch: defineSearch({ + dfs: true + }) + }; // nice, short mathematical alias + + elesfn$v.bfs = elesfn$v.breadthFirstSearch; + elesfn$v.dfs = elesfn$v.depthFirstSearch; + + var heap$1 = createCommonjsModule(function (module, exports) { + // Generated by CoffeeScript 1.8.0 + (function() { + var Heap, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min, nlargest, nsmallest, updateItem, _siftdown, _siftup; + + floor = Math.floor, min = Math.min; + + + /* + Default comparison function to be used + */ + + defaultCmp = function(x, y) { + if (x < y) { + return -1; + } + if (x > y) { + return 1; + } + return 0; + }; + + + /* + Insert item x in list a, and keep it sorted assuming a is sorted. + + If x is already in a, insert it to the right of the rightmost x. + + Optional args lo (default 0) and hi (default a.length) bound the slice + of a to be searched. + */ + + insort = function(a, x, lo, hi, cmp) { + var mid; + if (lo == null) { + lo = 0; + } + if (cmp == null) { + cmp = defaultCmp; + } + if (lo < 0) { + throw new Error('lo must be non-negative'); + } + if (hi == null) { + hi = a.length; + } + while (lo < hi) { + mid = floor((lo + hi) / 2); + if (cmp(x, a[mid]) < 0) { + hi = mid; + } else { + lo = mid + 1; + } + } + return ([].splice.apply(a, [lo, lo - lo].concat(x)), x); + }; + + + /* + Push item onto heap, maintaining the heap invariant. + */ + + heappush = function(array, item, cmp) { + if (cmp == null) { + cmp = defaultCmp; + } + array.push(item); + return _siftdown(array, 0, array.length - 1, cmp); + }; + + + /* + Pop the smallest item off the heap, maintaining the heap invariant. + */ + + heappop = function(array, cmp) { + var lastelt, returnitem; + if (cmp == null) { + cmp = defaultCmp; + } + lastelt = array.pop(); + if (array.length) { + returnitem = array[0]; + array[0] = lastelt; + _siftup(array, 0, cmp); + } else { + returnitem = lastelt; + } + return returnitem; + }; + + + /* + Pop and return the current smallest value, and add the new item. + + This is more efficient than heappop() followed by heappush(), and can be + more appropriate when using a fixed size heap. Note that the value + returned may be larger than item! That constrains reasonable use of + this routine unless written as part of a conditional replacement: + if item > array[0] + item = heapreplace(array, item) + */ + + heapreplace = function(array, item, cmp) { + var returnitem; + if (cmp == null) { + cmp = defaultCmp; + } + returnitem = array[0]; + array[0] = item; + _siftup(array, 0, cmp); + return returnitem; + }; + + + /* + Fast version of a heappush followed by a heappop. + */ + + heappushpop = function(array, item, cmp) { + var _ref; + if (cmp == null) { + cmp = defaultCmp; + } + if (array.length && cmp(array[0], item) < 0) { + _ref = [array[0], item], item = _ref[0], array[0] = _ref[1]; + _siftup(array, 0, cmp); + } + return item; + }; + + + /* + Transform list into a heap, in-place, in O(array.length) time. + */ + + heapify = function(array, cmp) { + var i, _i, _len, _ref1, _results, _results1; + if (cmp == null) { + cmp = defaultCmp; + } + _ref1 = (function() { + _results1 = []; + for (var _j = 0, _ref = floor(array.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--){ _results1.push(_j); } + return _results1; + }).apply(this).reverse(); + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + i = _ref1[_i]; + _results.push(_siftup(array, i, cmp)); + } + return _results; + }; + + + /* + Update the position of the given item in the heap. + This function should be called every time the item is being modified. + */ + + updateItem = function(array, item, cmp) { + var pos; + if (cmp == null) { + cmp = defaultCmp; + } + pos = array.indexOf(item); + if (pos === -1) { + return; + } + _siftdown(array, 0, pos, cmp); + return _siftup(array, pos, cmp); + }; + + + /* + Find the n largest elements in a dataset. + */ + + nlargest = function(array, n, cmp) { + var elem, result, _i, _len, _ref; + if (cmp == null) { + cmp = defaultCmp; + } + result = array.slice(0, n); + if (!result.length) { + return result; + } + heapify(result, cmp); + _ref = array.slice(n); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + heappushpop(result, elem, cmp); + } + return result.sort(cmp).reverse(); + }; + + + /* + Find the n smallest elements in a dataset. + */ + + nsmallest = function(array, n, cmp) { + var elem, los, result, _i, _j, _len, _ref, _ref1, _results; + if (cmp == null) { + cmp = defaultCmp; + } + if (n * 10 <= array.length) { + result = array.slice(0, n).sort(cmp); + if (!result.length) { + return result; + } + los = result[result.length - 1]; + _ref = array.slice(n); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + if (cmp(elem, los) < 0) { + insort(result, elem, 0, null, cmp); + result.pop(); + los = result[result.length - 1]; + } + } + return result; + } + heapify(array, cmp); + _results = []; + for (_j = 0, _ref1 = min(n, array.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; 0 <= _ref1 ? ++_j : --_j) { + _results.push(heappop(array, cmp)); + } + return _results; + }; + + _siftdown = function(array, startpos, pos, cmp) { + var newitem, parent, parentpos; + if (cmp == null) { + cmp = defaultCmp; + } + newitem = array[pos]; + while (pos > startpos) { + parentpos = (pos - 1) >> 1; + parent = array[parentpos]; + if (cmp(newitem, parent) < 0) { + array[pos] = parent; + pos = parentpos; + continue; + } + break; + } + return array[pos] = newitem; + }; + + _siftup = function(array, pos, cmp) { + var childpos, endpos, newitem, rightpos, startpos; + if (cmp == null) { + cmp = defaultCmp; + } + endpos = array.length; + startpos = pos; + newitem = array[pos]; + childpos = 2 * pos + 1; + while (childpos < endpos) { + rightpos = childpos + 1; + if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) { + childpos = rightpos; + } + array[pos] = array[childpos]; + pos = childpos; + childpos = 2 * pos + 1; + } + array[pos] = newitem; + return _siftdown(array, startpos, pos, cmp); + }; + + Heap = (function() { + Heap.push = heappush; + + Heap.pop = heappop; + + Heap.replace = heapreplace; + + Heap.pushpop = heappushpop; + + Heap.heapify = heapify; + + Heap.updateItem = updateItem; + + Heap.nlargest = nlargest; + + Heap.nsmallest = nsmallest; + + function Heap(cmp) { + this.cmp = cmp != null ? cmp : defaultCmp; + this.nodes = []; + } + + Heap.prototype.push = function(x) { + return heappush(this.nodes, x, this.cmp); + }; + + Heap.prototype.pop = function() { + return heappop(this.nodes, this.cmp); + }; + + Heap.prototype.peek = function() { + return this.nodes[0]; + }; + + Heap.prototype.contains = function(x) { + return this.nodes.indexOf(x) !== -1; + }; + + Heap.prototype.replace = function(x) { + return heapreplace(this.nodes, x, this.cmp); + }; + + Heap.prototype.pushpop = function(x) { + return heappushpop(this.nodes, x, this.cmp); + }; + + Heap.prototype.heapify = function() { + return heapify(this.nodes, this.cmp); + }; + + Heap.prototype.updateItem = function(x) { + return updateItem(this.nodes, x, this.cmp); + }; + + Heap.prototype.clear = function() { + return this.nodes = []; + }; + + Heap.prototype.empty = function() { + return this.nodes.length === 0; + }; + + Heap.prototype.size = function() { + return this.nodes.length; + }; + + Heap.prototype.clone = function() { + var heap; + heap = new Heap(); + heap.nodes = this.nodes.slice(0); + return heap; + }; + + Heap.prototype.toArray = function() { + return this.nodes.slice(0); + }; + + Heap.prototype.insert = Heap.prototype.push; + + Heap.prototype.top = Heap.prototype.peek; + + Heap.prototype.front = Heap.prototype.peek; + + Heap.prototype.has = Heap.prototype.contains; + + Heap.prototype.copy = Heap.prototype.clone; + + return Heap; + + })(); + + (function(root, factory) { + { + return module.exports = factory(); + } + })(this, function() { + return Heap; + }); + + }).call(commonjsGlobal); + }); + + var heap = heap$1; + + var dijkstraDefaults = defaults$g({ + root: null, + weight: function weight(edge) { + return 1; + }, + directed: false + }); + var elesfn$u = { + dijkstra: function dijkstra(options) { + if (!plainObject(options)) { + var args = arguments; + options = { + root: args[0], + weight: args[1], + directed: args[2] + }; + } + + var _dijkstraDefaults = dijkstraDefaults(options), + root = _dijkstraDefaults.root, + weight = _dijkstraDefaults.weight, + directed = _dijkstraDefaults.directed; + + var eles = this; + var weightFn = weight; + var source = string(root) ? this.filter(root)[0] : root[0]; + var dist = {}; + var prev = {}; + var knownDist = {}; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + edges.unmergeBy(function (ele) { + return ele.isLoop(); + }); + + var getDist = function getDist(node) { + return dist[node.id()]; + }; + + var setDist = function setDist(node, d) { + dist[node.id()] = d; + Q.updateItem(node); + }; + + var Q = new heap(function (a, b) { + return getDist(a) - getDist(b); + }); + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + dist[node.id()] = node.same(source) ? 0 : Infinity; + Q.push(node); + } + + var distBetween = function distBetween(u, v) { + var uvs = (directed ? u.edgesTo(v) : u.edgesWith(v)).intersect(edges); + var smallestDistance = Infinity; + var smallestEdge; + + for (var _i = 0; _i < uvs.length; _i++) { + var edge = uvs[_i]; + + var _weight = weightFn(edge); + + if (_weight < smallestDistance || !smallestEdge) { + smallestDistance = _weight; + smallestEdge = edge; + } + } + + return { + edge: smallestEdge, + dist: smallestDistance + }; + }; + + while (Q.size() > 0) { + var u = Q.pop(); + var smalletsDist = getDist(u); + var uid = u.id(); + knownDist[uid] = smalletsDist; + + if (smalletsDist === Infinity) { + continue; + } + + var neighbors = u.neighborhood().intersect(nodes); + + for (var _i2 = 0; _i2 < neighbors.length; _i2++) { + var v = neighbors[_i2]; + var vid = v.id(); + var vDist = distBetween(u, v); + var alt = smalletsDist + vDist.dist; + + if (alt < getDist(v)) { + setDist(v, alt); + prev[vid] = { + node: u, + edge: vDist.edge + }; + } + } // for + + } // while + + + return { + distanceTo: function distanceTo(node) { + var target = string(node) ? nodes.filter(node)[0] : node[0]; + return knownDist[target.id()]; + }, + pathTo: function pathTo(node) { + var target = string(node) ? nodes.filter(node)[0] : node[0]; + var S = []; + var u = target; + var uid = u.id(); + + if (target.length > 0) { + S.unshift(target); + + while (prev[uid]) { + var p = prev[uid]; + S.unshift(p.edge); + S.unshift(p.node); + u = p.node; + uid = u.id(); + } + } + + return eles.spawn(S); + } + }; + } + }; + + var elesfn$t = { + // kruskal's algorithm (finds min spanning tree, assuming undirected graph) + // implemented from pseudocode from wikipedia + kruskal: function kruskal(weightFn) { + weightFn = weightFn || function (edge) { + return 1; + }; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + var numNodes = nodes.length; + var forest = new Array(numNodes); + var A = nodes; // assumes byGroup() creates new collections that can be safely mutated + + var findSetIndex = function findSetIndex(ele) { + for (var i = 0; i < forest.length; i++) { + var eles = forest[i]; + + if (eles.has(ele)) { + return i; + } + } + }; // start with one forest per node + + + for (var i = 0; i < numNodes; i++) { + forest[i] = this.spawn(nodes[i]); + } + + var S = edges.sort(function (a, b) { + return weightFn(a) - weightFn(b); + }); + + for (var _i = 0; _i < S.length; _i++) { + var edge = S[_i]; + var u = edge.source()[0]; + var v = edge.target()[0]; + var setUIndex = findSetIndex(u); + var setVIndex = findSetIndex(v); + var setU = forest[setUIndex]; + var setV = forest[setVIndex]; + + if (setUIndex !== setVIndex) { + A.merge(edge); // combine forests for u and v + + setU.merge(setV); + forest.splice(setVIndex, 1); + } + } + + return A; + } + }; + + var aStarDefaults = defaults$g({ + root: null, + goal: null, + weight: function weight(edge) { + return 1; + }, + heuristic: function heuristic(edge) { + return 0; + }, + directed: false + }); + var elesfn$s = { + // Implemented from pseudocode from wikipedia + aStar: function aStar(options) { + var cy = this.cy(); + + var _aStarDefaults = aStarDefaults(options), + root = _aStarDefaults.root, + goal = _aStarDefaults.goal, + heuristic = _aStarDefaults.heuristic, + directed = _aStarDefaults.directed, + weight = _aStarDefaults.weight; + + root = cy.collection(root)[0]; + goal = cy.collection(goal)[0]; + var sid = root.id(); + var tid = goal.id(); + var gScore = {}; + var fScore = {}; + var closedSetIds = {}; + var openSet = new heap(function (a, b) { + return fScore[a.id()] - fScore[b.id()]; + }); + var openSetIds = new Set$1(); + var cameFrom = {}; + var cameFromEdge = {}; + + var addToOpenSet = function addToOpenSet(ele, id) { + openSet.push(ele); + openSetIds.add(id); + }; + + var cMin, cMinId; + + var popFromOpenSet = function popFromOpenSet() { + cMin = openSet.pop(); + cMinId = cMin.id(); + openSetIds["delete"](cMinId); + }; + + var isInOpenSet = function isInOpenSet(id) { + return openSetIds.has(id); + }; + + addToOpenSet(root, sid); + gScore[sid] = 0; + fScore[sid] = heuristic(root); // Counter + + var steps = 0; // Main loop + + while (openSet.size() > 0) { + popFromOpenSet(); + steps++; // If we've found our goal, then we are done + + if (cMinId === tid) { + var path = []; + var pathNode = goal; + var pathNodeId = tid; + var pathEdge = cameFromEdge[pathNodeId]; + + for (;;) { + path.unshift(pathNode); + + if (pathEdge != null) { + path.unshift(pathEdge); + } + + pathNode = cameFrom[pathNodeId]; + + if (pathNode == null) { + break; + } + + pathNodeId = pathNode.id(); + pathEdge = cameFromEdge[pathNodeId]; + } + + return { + found: true, + distance: gScore[cMinId], + path: this.spawn(path), + steps: steps + }; + } // Add cMin to processed nodes + + + closedSetIds[cMinId] = true; // Update scores for neighbors of cMin + // Take into account if graph is directed or not + + var vwEdges = cMin._private.edges; + + for (var i = 0; i < vwEdges.length; i++) { + var e = vwEdges[i]; // edge must be in set of calling eles + + if (!this.hasElementWithId(e.id())) { + continue; + } // cMin must be the source of edge if directed + + + if (directed && e.data('source') !== cMinId) { + continue; + } + + var wSrc = e.source(); + var wTgt = e.target(); + var w = wSrc.id() !== cMinId ? wSrc : wTgt; + var wid = w.id(); // node must be in set of calling eles + + if (!this.hasElementWithId(wid)) { + continue; + } // if node is in closedSet, ignore it + + + if (closedSetIds[wid]) { + continue; + } // New tentative score for node w + + + var tempScore = gScore[cMinId] + weight(e); // Update gScore for node w if: + // w not present in openSet + // OR + // tentative gScore is less than previous value + // w not in openSet + + if (!isInOpenSet(wid)) { + gScore[wid] = tempScore; + fScore[wid] = tempScore + heuristic(w); + addToOpenSet(w, wid); + cameFrom[wid] = cMin; + cameFromEdge[wid] = e; + continue; + } // w already in openSet, but with greater gScore + + + if (tempScore < gScore[wid]) { + gScore[wid] = tempScore; + fScore[wid] = tempScore + heuristic(w); + cameFrom[wid] = cMin; + cameFromEdge[wid] = e; + } + } // End of neighbors update + + } // End of main loop + // If we've reached here, then we've not reached our goal + + + return { + found: false, + distance: undefined, + path: undefined, + steps: steps + }; + } + }; // elesfn + + var floydWarshallDefaults = defaults$g({ + weight: function weight(edge) { + return 1; + }, + directed: false + }); + var elesfn$r = { + // Implemented from pseudocode from wikipedia + floydWarshall: function floydWarshall(options) { + var cy = this.cy(); + + var _floydWarshallDefault = floydWarshallDefaults(options), + weight = _floydWarshallDefault.weight, + directed = _floydWarshallDefault.directed; + + var weightFn = weight; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + var N = nodes.length; + var Nsq = N * N; + + var indexOf = function indexOf(node) { + return nodes.indexOf(node); + }; + + var atIndex = function atIndex(i) { + return nodes[i]; + }; // Initialize distance matrix + + + var dist = new Array(Nsq); + + for (var n = 0; n < Nsq; n++) { + var j = n % N; + var i = (n - j) / N; + + if (i === j) { + dist[n] = 0; + } else { + dist[n] = Infinity; + } + } // Initialize matrix used for path reconstruction + // Initialize distance matrix + + + var next = new Array(Nsq); + var edgeNext = new Array(Nsq); // Process edges + + for (var _i = 0; _i < edges.length; _i++) { + var edge = edges[_i]; + var src = edge.source()[0]; + var tgt = edge.target()[0]; + + if (src === tgt) { + continue; + } // exclude loops + + + var s = indexOf(src); + var t = indexOf(tgt); + var st = s * N + t; // source to target index + + var _weight = weightFn(edge); // Check if already process another edge between same 2 nodes + + + if (dist[st] > _weight) { + dist[st] = _weight; + next[st] = t; + edgeNext[st] = edge; + } // If undirected graph, process 'reversed' edge + + + if (!directed) { + var ts = t * N + s; // target to source index + + if (!directed && dist[ts] > _weight) { + dist[ts] = _weight; + next[ts] = s; + edgeNext[ts] = edge; + } + } + } // Main loop + + + for (var k = 0; k < N; k++) { + for (var _i2 = 0; _i2 < N; _i2++) { + var ik = _i2 * N + k; + + for (var _j = 0; _j < N; _j++) { + var ij = _i2 * N + _j; + var kj = k * N + _j; + + if (dist[ik] + dist[kj] < dist[ij]) { + dist[ij] = dist[ik] + dist[kj]; + next[ij] = next[ik]; + } + } + } + } + + var getArgEle = function getArgEle(ele) { + return (string(ele) ? cy.filter(ele) : ele)[0]; + }; + + var indexOfArgEle = function indexOfArgEle(ele) { + return indexOf(getArgEle(ele)); + }; + + var res = { + distance: function distance(from, to) { + var i = indexOfArgEle(from); + var j = indexOfArgEle(to); + return dist[i * N + j]; + }, + path: function path(from, to) { + var i = indexOfArgEle(from); + var j = indexOfArgEle(to); + var fromNode = atIndex(i); + + if (i === j) { + return fromNode.collection(); + } + + if (next[i * N + j] == null) { + return cy.collection(); + } + + var path = cy.collection(); + var prev = i; + var edge; + path.merge(fromNode); + + while (i !== j) { + prev = i; + i = next[i * N + j]; + edge = edgeNext[prev * N + i]; + path.merge(edge); + path.merge(atIndex(i)); + } + + return path; + } + }; + return res; + } // floydWarshall + + }; // elesfn + + var bellmanFordDefaults = defaults$g({ + weight: function weight(edge) { + return 1; + }, + directed: false, + root: null + }); + var elesfn$q = { + // Implemented from pseudocode from wikipedia + bellmanFord: function bellmanFord(options) { + var _this = this; + + var _bellmanFordDefaults = bellmanFordDefaults(options), + weight = _bellmanFordDefaults.weight, + directed = _bellmanFordDefaults.directed, + root = _bellmanFordDefaults.root; + + var weightFn = weight; + var eles = this; + var cy = this.cy(); + + var _this$byGroup = this.byGroup(), + edges = _this$byGroup.edges, + nodes = _this$byGroup.nodes; + + var numNodes = nodes.length; + var infoMap = new Map$2(); + var hasNegativeWeightCycle = false; + var negativeWeightCycles = []; + root = cy.collection(root)[0]; // in case selector passed + + edges.unmergeBy(function (edge) { + return edge.isLoop(); + }); + var numEdges = edges.length; + + var getInfo = function getInfo(node) { + var obj = infoMap.get(node.id()); + + if (!obj) { + obj = {}; + infoMap.set(node.id(), obj); + } + + return obj; + }; + + var getNodeFromTo = function getNodeFromTo(to) { + return (string(to) ? cy.$(to) : to)[0]; + }; + + var distanceTo = function distanceTo(to) { + return getInfo(getNodeFromTo(to)).dist; + }; + + var pathTo = function pathTo(to) { + var thisStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : root; + var end = getNodeFromTo(to); + var path = []; + var node = end; + + for (;;) { + if (node == null) { + return _this.spawn(); + } + + var _getInfo = getInfo(node), + edge = _getInfo.edge, + pred = _getInfo.pred; + + path.unshift(node[0]); + + if (node.same(thisStart) && path.length > 0) { + break; + } + + if (edge != null) { + path.unshift(edge); + } + + node = pred; + } + + return eles.spawn(path); + }; // Initializations { dist, pred, edge } + + + for (var i = 0; i < numNodes; i++) { + var node = nodes[i]; + var info = getInfo(node); + + if (node.same(root)) { + info.dist = 0; + } else { + info.dist = Infinity; + } + + info.pred = null; + info.edge = null; + } // Edges relaxation + + + var replacedEdge = false; + + var checkForEdgeReplacement = function checkForEdgeReplacement(node1, node2, edge, info1, info2, weight) { + var dist = info1.dist + weight; + + if (dist < info2.dist && !edge.same(info1.edge)) { + info2.dist = dist; + info2.pred = node1; + info2.edge = edge; + replacedEdge = true; + } + }; + + for (var _i = 1; _i < numNodes; _i++) { + replacedEdge = false; + + for (var e = 0; e < numEdges; e++) { + var edge = edges[e]; + var src = edge.source(); + var tgt = edge.target(); + + var _weight = weightFn(edge); + + var srcInfo = getInfo(src); + var tgtInfo = getInfo(tgt); + checkForEdgeReplacement(src, tgt, edge, srcInfo, tgtInfo, _weight); // If undirected graph, we need to take into account the 'reverse' edge + + if (!directed) { + checkForEdgeReplacement(tgt, src, edge, tgtInfo, srcInfo, _weight); + } + } + + if (!replacedEdge) { + break; + } + } + + if (replacedEdge) { + // Check for negative weight cycles + var negativeWeightCycleIds = []; + + for (var _e = 0; _e < numEdges; _e++) { + var _edge = edges[_e]; + + var _src = _edge.source(); + + var _tgt = _edge.target(); + + var _weight2 = weightFn(_edge); + + var srcDist = getInfo(_src).dist; + var tgtDist = getInfo(_tgt).dist; + + if (srcDist + _weight2 < tgtDist || !directed && tgtDist + _weight2 < srcDist) { + if (!hasNegativeWeightCycle) { + warn('Graph contains a negative weight cycle for Bellman-Ford'); + hasNegativeWeightCycle = true; + } + + if (options.findNegativeWeightCycles !== false) { + var negativeNodes = []; + + if (srcDist + _weight2 < tgtDist) { + negativeNodes.push(_src); + } + + if (!directed && tgtDist + _weight2 < srcDist) { + negativeNodes.push(_tgt); + } + + var numNegativeNodes = negativeNodes.length; + + for (var n = 0; n < numNegativeNodes; n++) { + var start = negativeNodes[n]; + var cycle = [start]; + cycle.push(getInfo(start).edge); + var _node = getInfo(start).pred; + + while (cycle.indexOf(_node) === -1) { + cycle.push(_node); + cycle.push(getInfo(_node).edge); + _node = getInfo(_node).pred; + } + + cycle = cycle.slice(cycle.indexOf(_node)); + var smallestId = cycle[0].id(); + var smallestIndex = 0; + + for (var c = 2; c < cycle.length; c += 2) { + if (cycle[c].id() < smallestId) { + smallestId = cycle[c].id(); + smallestIndex = c; + } + } + + cycle = cycle.slice(smallestIndex).concat(cycle.slice(0, smallestIndex)); + cycle.push(cycle[0]); + var cycleId = cycle.map(function (el) { + return el.id(); + }).join(","); + + if (negativeWeightCycleIds.indexOf(cycleId) === -1) { + negativeWeightCycles.push(eles.spawn(cycle)); + negativeWeightCycleIds.push(cycleId); + } + } + } else { + break; + } + } + } + } + + return { + distanceTo: distanceTo, + pathTo: pathTo, + hasNegativeWeightCycle: hasNegativeWeightCycle, + negativeWeightCycles: negativeWeightCycles + }; + } // bellmanFord + + }; // elesfn + + var sqrt2 = Math.sqrt(2); // Function which colapses 2 (meta) nodes into one + // Updates the remaining edge lists + // Receives as a paramater the edge which causes the collapse + + var collapse = function collapse(edgeIndex, nodeMap, remainingEdges) { + if (remainingEdges.length === 0) { + error("Karger-Stein must be run on a connected (sub)graph"); + } + + var edgeInfo = remainingEdges[edgeIndex]; + var sourceIn = edgeInfo[1]; + var targetIn = edgeInfo[2]; + var partition1 = nodeMap[sourceIn]; + var partition2 = nodeMap[targetIn]; + var newEdges = remainingEdges; // re-use array + // Delete all edges between partition1 and partition2 + + for (var i = newEdges.length - 1; i >= 0; i--) { + var edge = newEdges[i]; + var src = edge[1]; + var tgt = edge[2]; + + if (nodeMap[src] === partition1 && nodeMap[tgt] === partition2 || nodeMap[src] === partition2 && nodeMap[tgt] === partition1) { + newEdges.splice(i, 1); + } + } // All edges pointing to partition2 should now point to partition1 + + + for (var _i = 0; _i < newEdges.length; _i++) { + var _edge = newEdges[_i]; + + if (_edge[1] === partition2) { + // Check source + newEdges[_i] = _edge.slice(); // copy + + newEdges[_i][1] = partition1; + } else if (_edge[2] === partition2) { + // Check target + newEdges[_i] = _edge.slice(); // copy + + newEdges[_i][2] = partition1; + } + } // Move all nodes from partition2 to partition1 + + + for (var _i2 = 0; _i2 < nodeMap.length; _i2++) { + if (nodeMap[_i2] === partition2) { + nodeMap[_i2] = partition1; + } + } + + return newEdges; + }; // Contracts a graph until we reach a certain number of meta nodes + + + var contractUntil = function contractUntil(metaNodeMap, remainingEdges, size, sizeLimit) { + while (size > sizeLimit) { + // Choose an edge randomly + var edgeIndex = Math.floor(Math.random() * remainingEdges.length); // Collapse graph based on edge + + remainingEdges = collapse(edgeIndex, metaNodeMap, remainingEdges); + size--; + } + + return remainingEdges; + }; + + var elesfn$p = { + // Computes the minimum cut of an undirected graph + // Returns the correct answer with high probability + kargerStein: function kargerStein() { + var _this = this; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + edges.unmergeBy(function (edge) { + return edge.isLoop(); + }); + var numNodes = nodes.length; + var numEdges = edges.length; + var numIter = Math.ceil(Math.pow(Math.log(numNodes) / Math.LN2, 2)); + var stopSize = Math.floor(numNodes / sqrt2); + + if (numNodes < 2) { + error('At least 2 nodes are required for Karger-Stein algorithm'); + return undefined; + } // Now store edge destination as indexes + // Format for each edge (edge index, source node index, target node index) + + + var edgeIndexes = []; + + for (var i = 0; i < numEdges; i++) { + var e = edges[i]; + edgeIndexes.push([i, nodes.indexOf(e.source()), nodes.indexOf(e.target())]); + } // We will store the best cut found here + + + var minCutSize = Infinity; + var minCutEdgeIndexes = []; + var minCutNodeMap = new Array(numNodes); // Initial meta node partition + + var metaNodeMap = new Array(numNodes); + var metaNodeMap2 = new Array(numNodes); + + var copyNodesMap = function copyNodesMap(from, to) { + for (var _i3 = 0; _i3 < numNodes; _i3++) { + to[_i3] = from[_i3]; + } + }; // Main loop + + + for (var iter = 0; iter <= numIter; iter++) { + // Reset meta node partition + for (var _i4 = 0; _i4 < numNodes; _i4++) { + metaNodeMap[_i4] = _i4; + } // Contract until stop point (stopSize nodes) + + + var edgesState = contractUntil(metaNodeMap, edgeIndexes.slice(), numNodes, stopSize); + var edgesState2 = edgesState.slice(); // copy + // Create a copy of the colapsed nodes state + + copyNodesMap(metaNodeMap, metaNodeMap2); // Run 2 iterations starting in the stop state + + var res1 = contractUntil(metaNodeMap, edgesState, stopSize, 2); + var res2 = contractUntil(metaNodeMap2, edgesState2, stopSize, 2); // Is any of the 2 results the best cut so far? + + if (res1.length <= res2.length && res1.length < minCutSize) { + minCutSize = res1.length; + minCutEdgeIndexes = res1; + copyNodesMap(metaNodeMap, minCutNodeMap); + } else if (res2.length <= res1.length && res2.length < minCutSize) { + minCutSize = res2.length; + minCutEdgeIndexes = res2; + copyNodesMap(metaNodeMap2, minCutNodeMap); + } + } // end of main loop + // Construct result + + + var cut = this.spawn(minCutEdgeIndexes.map(function (e) { + return edges[e[0]]; + })); + var partition1 = this.spawn(); + var partition2 = this.spawn(); // traverse metaNodeMap for best cut + + var witnessNodePartition = minCutNodeMap[0]; + + for (var _i5 = 0; _i5 < minCutNodeMap.length; _i5++) { + var partitionId = minCutNodeMap[_i5]; + var node = nodes[_i5]; + + if (partitionId === witnessNodePartition) { + partition1.merge(node); + } else { + partition2.merge(node); + } + } // construct components corresponding to each disjoint subset of nodes + + + var constructComponent = function constructComponent(subset) { + var component = _this.spawn(); + + subset.forEach(function (node) { + component.merge(node); + node.connectedEdges().forEach(function (edge) { + // ensure edge is within calling collection and edge is not in cut + if (_this.contains(edge) && !cut.contains(edge)) { + component.merge(edge); + } + }); + }); + return component; + }; + + var components = [constructComponent(partition1), constructComponent(partition2)]; + var ret = { + cut: cut, + components: components, + // n.b. partitions are included to be compatible with the old api spec + // (could be removed in a future major version) + partition1: partition1, + partition2: partition2 + }; + return ret; + } + }; // elesfn + + var copyPosition = function copyPosition(p) { + return { + x: p.x, + y: p.y + }; + }; + var modelToRenderedPosition = function modelToRenderedPosition(p, zoom, pan) { + return { + x: p.x * zoom + pan.x, + y: p.y * zoom + pan.y + }; + }; + var renderedToModelPosition = function renderedToModelPosition(p, zoom, pan) { + return { + x: (p.x - pan.x) / zoom, + y: (p.y - pan.y) / zoom + }; + }; + var array2point = function array2point(arr) { + return { + x: arr[0], + y: arr[1] + }; + }; + var min = function min(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var min = Infinity; + + for (var i = begin; i < end; i++) { + var val = arr[i]; + + if (isFinite(val)) { + min = Math.min(val, min); + } + } + + return min; + }; + var max = function max(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var max = -Infinity; + + for (var i = begin; i < end; i++) { + var val = arr[i]; + + if (isFinite(val)) { + max = Math.max(val, max); + } + } + + return max; + }; + var mean = function mean(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var total = 0; + var n = 0; + + for (var i = begin; i < end; i++) { + var val = arr[i]; + + if (isFinite(val)) { + total += val; + n++; + } + } + + return total / n; + }; + var median = function median(arr) { + var begin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : arr.length; + var copy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var sort = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var includeHoles = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + + if (copy) { + arr = arr.slice(begin, end); + } else { + if (end < arr.length) { + arr.splice(end, arr.length - end); + } + + if (begin > 0) { + arr.splice(0, begin); + } + } // all non finite (e.g. Infinity, NaN) elements must be -Infinity so they go to the start + + + var off = 0; // offset from non-finite values + + for (var i = arr.length - 1; i >= 0; i--) { + var v = arr[i]; + + if (includeHoles) { + if (!isFinite(v)) { + arr[i] = -Infinity; + off++; + } + } else { + // just remove it if we don't want to consider holes + arr.splice(i, 1); + } + } + + if (sort) { + arr.sort(function (a, b) { + return a - b; + }); // requires copy = true if you don't want to change the orig + } + + var len = arr.length; + var mid = Math.floor(len / 2); + + if (len % 2 !== 0) { + return arr[mid + 1 + off]; + } else { + return (arr[mid - 1 + off] + arr[mid + off]) / 2; + } + }; + var deg2rad = function deg2rad(deg) { + return Math.PI * deg / 180; + }; + var getAngleFromDisp = function getAngleFromDisp(dispX, dispY) { + return Math.atan2(dispY, dispX) - Math.PI / 2; + }; + var log2 = Math.log2 || function (n) { + return Math.log(n) / Math.log(2); + }; + var signum = function signum(x) { + if (x > 0) { + return 1; + } else if (x < 0) { + return -1; + } else { + return 0; + } + }; + var dist = function dist(p1, p2) { + return Math.sqrt(sqdist(p1, p2)); + }; + var sqdist = function sqdist(p1, p2) { + var dx = p2.x - p1.x; + var dy = p2.y - p1.y; + return dx * dx + dy * dy; + }; + var inPlaceSumNormalize = function inPlaceSumNormalize(v) { + var length = v.length; // First, get sum of all elements + + var total = 0; + + for (var i = 0; i < length; i++) { + total += v[i]; + } // Now, divide each by the sum of all elements + + + for (var _i = 0; _i < length; _i++) { + v[_i] = v[_i] / total; + } + + return v; + }; + + var qbezierAt = function qbezierAt(p0, p1, p2, t) { + return (1 - t) * (1 - t) * p0 + 2 * (1 - t) * t * p1 + t * t * p2; + }; + var qbezierPtAt = function qbezierPtAt(p0, p1, p2, t) { + return { + x: qbezierAt(p0.x, p1.x, p2.x, t), + y: qbezierAt(p0.y, p1.y, p2.y, t) + }; + }; + var lineAt = function lineAt(p0, p1, t, d) { + var vec = { + x: p1.x - p0.x, + y: p1.y - p0.y + }; + var vecDist = dist(p0, p1); + var normVec = { + x: vec.x / vecDist, + y: vec.y / vecDist + }; + t = t == null ? 0 : t; + d = d != null ? d : t * vecDist; + return { + x: p0.x + normVec.x * d, + y: p0.y + normVec.y * d + }; + }; + var bound = function bound(min, val, max) { + return Math.max(min, Math.min(max, val)); + }; // makes a full bb (x1, y1, x2, y2, w, h) from implicit params + + var makeBoundingBox = function makeBoundingBox(bb) { + if (bb == null) { + return { + x1: Infinity, + y1: Infinity, + x2: -Infinity, + y2: -Infinity, + w: 0, + h: 0 + }; + } else if (bb.x1 != null && bb.y1 != null) { + if (bb.x2 != null && bb.y2 != null && bb.x2 >= bb.x1 && bb.y2 >= bb.y1) { + return { + x1: bb.x1, + y1: bb.y1, + x2: bb.x2, + y2: bb.y2, + w: bb.x2 - bb.x1, + h: bb.y2 - bb.y1 + }; + } else if (bb.w != null && bb.h != null && bb.w >= 0 && bb.h >= 0) { + return { + x1: bb.x1, + y1: bb.y1, + x2: bb.x1 + bb.w, + y2: bb.y1 + bb.h, + w: bb.w, + h: bb.h + }; + } + } + }; + var copyBoundingBox = function copyBoundingBox(bb) { + return { + x1: bb.x1, + x2: bb.x2, + w: bb.w, + y1: bb.y1, + y2: bb.y2, + h: bb.h + }; + }; + var clearBoundingBox = function clearBoundingBox(bb) { + bb.x1 = Infinity; + bb.y1 = Infinity; + bb.x2 = -Infinity; + bb.y2 = -Infinity; + bb.w = 0; + bb.h = 0; + }; + var updateBoundingBox = function updateBoundingBox(bb1, bb2) { + // update bb1 with bb2 bounds + bb1.x1 = Math.min(bb1.x1, bb2.x1); + bb1.x2 = Math.max(bb1.x2, bb2.x2); + bb1.w = bb1.x2 - bb1.x1; + bb1.y1 = Math.min(bb1.y1, bb2.y1); + bb1.y2 = Math.max(bb1.y2, bb2.y2); + bb1.h = bb1.y2 - bb1.y1; + }; + var expandBoundingBoxByPoint = function expandBoundingBoxByPoint(bb, x, y) { + bb.x1 = Math.min(bb.x1, x); + bb.x2 = Math.max(bb.x2, x); + bb.w = bb.x2 - bb.x1; + bb.y1 = Math.min(bb.y1, y); + bb.y2 = Math.max(bb.y2, y); + bb.h = bb.y2 - bb.y1; + }; + var expandBoundingBox = function expandBoundingBox(bb) { + var padding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + bb.x1 -= padding; + bb.x2 += padding; + bb.y1 -= padding; + bb.y2 += padding; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + return bb; + }; + var expandBoundingBoxSides = function expandBoundingBoxSides(bb) { + var padding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0]; + var top, right, bottom, left; + + if (padding.length === 1) { + top = right = bottom = left = padding[0]; + } else if (padding.length === 2) { + top = bottom = padding[0]; + left = right = padding[1]; + } else if (padding.length === 4) { + var _padding = _slicedToArray(padding, 4); + + top = _padding[0]; + right = _padding[1]; + bottom = _padding[2]; + left = _padding[3]; + } + + bb.x1 -= left; + bb.x2 += right; + bb.y1 -= top; + bb.y2 += bottom; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + return bb; + }; + + var assignBoundingBox = function assignBoundingBox(bb1, bb2) { + bb1.x1 = bb2.x1; + bb1.y1 = bb2.y1; + bb1.x2 = bb2.x2; + bb1.y2 = bb2.y2; + bb1.w = bb1.x2 - bb1.x1; + bb1.h = bb1.y2 - bb1.y1; + }; + var boundingBoxesIntersect = function boundingBoxesIntersect(bb1, bb2) { + // case: one bb to right of other + if (bb1.x1 > bb2.x2) { + return false; + } + + if (bb2.x1 > bb1.x2) { + return false; + } // case: one bb to left of other + + + if (bb1.x2 < bb2.x1) { + return false; + } + + if (bb2.x2 < bb1.x1) { + return false; + } // case: one bb above other + + + if (bb1.y2 < bb2.y1) { + return false; + } + + if (bb2.y2 < bb1.y1) { + return false; + } // case: one bb below other + + + if (bb1.y1 > bb2.y2) { + return false; + } + + if (bb2.y1 > bb1.y2) { + return false; + } // otherwise, must have some overlap + + + return true; + }; + var inBoundingBox = function inBoundingBox(bb, x, y) { + return bb.x1 <= x && x <= bb.x2 && bb.y1 <= y && y <= bb.y2; + }; + var pointInBoundingBox = function pointInBoundingBox(bb, pt) { + return inBoundingBox(bb, pt.x, pt.y); + }; + var boundingBoxInBoundingBox = function boundingBoxInBoundingBox(bb1, bb2) { + return inBoundingBox(bb1, bb2.x1, bb2.y1) && inBoundingBox(bb1, bb2.x2, bb2.y2); + }; + var roundRectangleIntersectLine = function roundRectangleIntersectLine(x, y, nodeX, nodeY, width, height, padding) { + var cornerRadius = getRoundRectangleRadius(width, height); + var halfWidth = width / 2; + var halfHeight = height / 2; // Check intersections with straight line segments + + var straightLineIntersections; // Top segment, left to right + + { + var topStartX = nodeX - halfWidth + cornerRadius - padding; + var topStartY = nodeY - halfHeight - padding; + var topEndX = nodeX + halfWidth - cornerRadius + padding; + var topEndY = topStartY; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Right segment, top to bottom + + { + var rightStartX = nodeX + halfWidth + padding; + var rightStartY = nodeY - halfHeight + cornerRadius - padding; + var rightEndX = rightStartX; + var rightEndY = nodeY + halfHeight - cornerRadius + padding; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, rightStartX, rightStartY, rightEndX, rightEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Bottom segment, left to right + + { + var bottomStartX = nodeX - halfWidth + cornerRadius - padding; + var bottomStartY = nodeY + halfHeight + padding; + var bottomEndX = nodeX + halfWidth - cornerRadius + padding; + var bottomEndY = bottomStartY; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, bottomStartX, bottomStartY, bottomEndX, bottomEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Left segment, top to bottom + + { + var leftStartX = nodeX - halfWidth - padding; + var leftStartY = nodeY - halfHeight + cornerRadius - padding; + var leftEndX = leftStartX; + var leftEndY = nodeY + halfHeight - cornerRadius + padding; + straightLineIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, leftStartX, leftStartY, leftEndX, leftEndY, false); + + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } // Check intersections with arc segments + + var arcIntersections; // Top Left + + { + var topLeftCenterX = nodeX - halfWidth + cornerRadius; + var topLeftCenterY = nodeY - halfHeight + cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, topLeftCenterX, topLeftCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] <= topLeftCenterX && arcIntersections[1] <= topLeftCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } // Top Right + + { + var topRightCenterX = nodeX + halfWidth - cornerRadius; + var topRightCenterY = nodeY - halfHeight + cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, topRightCenterX, topRightCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] >= topRightCenterX && arcIntersections[1] <= topRightCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } // Bottom Right + + { + var bottomRightCenterX = nodeX + halfWidth - cornerRadius; + var bottomRightCenterY = nodeY + halfHeight - cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, bottomRightCenterX, bottomRightCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] >= bottomRightCenterX && arcIntersections[1] >= bottomRightCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } // Bottom Left + + { + var bottomLeftCenterX = nodeX - halfWidth + cornerRadius; + var bottomLeftCenterY = nodeY + halfHeight - cornerRadius; + arcIntersections = intersectLineCircle(x, y, nodeX, nodeY, bottomLeftCenterX, bottomLeftCenterY, cornerRadius + padding); // Ensure the intersection is on the desired quarter of the circle + + if (arcIntersections.length > 0 && arcIntersections[0] <= bottomLeftCenterX && arcIntersections[1] >= bottomLeftCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } + return []; // if nothing + }; + var inLineVicinity = function inLineVicinity(x, y, lx1, ly1, lx2, ly2, tolerance) { + var t = tolerance; + var x1 = Math.min(lx1, lx2); + var x2 = Math.max(lx1, lx2); + var y1 = Math.min(ly1, ly2); + var y2 = Math.max(ly1, ly2); + return x1 - t <= x && x <= x2 + t && y1 - t <= y && y <= y2 + t; + }; + var inBezierVicinity = function inBezierVicinity(x, y, x1, y1, x2, y2, x3, y3, tolerance) { + var bb = { + x1: Math.min(x1, x3, x2) - tolerance, + x2: Math.max(x1, x3, x2) + tolerance, + y1: Math.min(y1, y3, y2) - tolerance, + y2: Math.max(y1, y3, y2) + tolerance + }; // if outside the rough bounding box for the bezier, then it can't be a hit + + if (x < bb.x1 || x > bb.x2 || y < bb.y1 || y > bb.y2) { + // console.log('bezier out of rough bb') + return false; + } else { + // console.log('do more expensive check'); + return true; + } + }; + var solveQuadratic = function solveQuadratic(a, b, c, val) { + c -= val; + var r = b * b - 4 * a * c; + + if (r < 0) { + return []; + } + + var sqrtR = Math.sqrt(r); + var denom = 2 * a; + var root1 = (-b + sqrtR) / denom; + var root2 = (-b - sqrtR) / denom; + return [root1, root2]; + }; + var solveCubic = function solveCubic(a, b, c, d, result) { + // Solves a cubic function, returns root in form [r1, i1, r2, i2, r3, i3], where + // r is the real component, i is the imaginary component + // An implementation of the Cardano method from the year 1545 + // http://en.wikipedia.org/wiki/Cubic_function#The_nature_of_the_roots + var epsilon = 0.00001; // avoid division by zero while keeping the overall expression close in value + + if (a === 0) { + a = epsilon; + } + + b /= a; + c /= a; + d /= a; + var discriminant, q, r, dum1, s, t, term1, r13; + q = (3.0 * c - b * b) / 9.0; + r = -(27.0 * d) + b * (9.0 * c - 2.0 * (b * b)); + r /= 54.0; + discriminant = q * q * q + r * r; + result[1] = 0; + term1 = b / 3.0; + + if (discriminant > 0) { + s = r + Math.sqrt(discriminant); + s = s < 0 ? -Math.pow(-s, 1.0 / 3.0) : Math.pow(s, 1.0 / 3.0); + t = r - Math.sqrt(discriminant); + t = t < 0 ? -Math.pow(-t, 1.0 / 3.0) : Math.pow(t, 1.0 / 3.0); + result[0] = -term1 + s + t; + term1 += (s + t) / 2.0; + result[4] = result[2] = -term1; + term1 = Math.sqrt(3.0) * (-t + s) / 2; + result[3] = term1; + result[5] = -term1; + return; + } + + result[5] = result[3] = 0; + + if (discriminant === 0) { + r13 = r < 0 ? -Math.pow(-r, 1.0 / 3.0) : Math.pow(r, 1.0 / 3.0); + result[0] = -term1 + 2.0 * r13; + result[4] = result[2] = -(r13 + term1); + return; + } + + q = -q; + dum1 = q * q * q; + dum1 = Math.acos(r / Math.sqrt(dum1)); + r13 = 2.0 * Math.sqrt(q); + result[0] = -term1 + r13 * Math.cos(dum1 / 3.0); + result[2] = -term1 + r13 * Math.cos((dum1 + 2.0 * Math.PI) / 3.0); + result[4] = -term1 + r13 * Math.cos((dum1 + 4.0 * Math.PI) / 3.0); + return; + }; + var sqdistToQuadraticBezier = function sqdistToQuadraticBezier(x, y, x1, y1, x2, y2, x3, y3) { + // Find minimum distance by using the minimum of the distance + // function between the given point and the curve + // This gives the coefficients of the resulting cubic equation + // whose roots tell us where a possible minimum is + // (Coefficients are divided by 4) + var a = 1.0 * x1 * x1 - 4 * x1 * x2 + 2 * x1 * x3 + 4 * x2 * x2 - 4 * x2 * x3 + x3 * x3 + y1 * y1 - 4 * y1 * y2 + 2 * y1 * y3 + 4 * y2 * y2 - 4 * y2 * y3 + y3 * y3; + var b = 1.0 * 9 * x1 * x2 - 3 * x1 * x1 - 3 * x1 * x3 - 6 * x2 * x2 + 3 * x2 * x3 + 9 * y1 * y2 - 3 * y1 * y1 - 3 * y1 * y3 - 6 * y2 * y2 + 3 * y2 * y3; + var c = 1.0 * 3 * x1 * x1 - 6 * x1 * x2 + x1 * x3 - x1 * x + 2 * x2 * x2 + 2 * x2 * x - x3 * x + 3 * y1 * y1 - 6 * y1 * y2 + y1 * y3 - y1 * y + 2 * y2 * y2 + 2 * y2 * y - y3 * y; + var d = 1.0 * x1 * x2 - x1 * x1 + x1 * x - x2 * x + y1 * y2 - y1 * y1 + y1 * y - y2 * y; // debug("coefficients: " + a / a + ", " + b / a + ", " + c / a + ", " + d / a); + + var roots = []; // Use the cubic solving algorithm + + solveCubic(a, b, c, d, roots); + var zeroThreshold = 0.0000001; + var params = []; + + for (var index = 0; index < 6; index += 2) { + if (Math.abs(roots[index + 1]) < zeroThreshold && roots[index] >= 0 && roots[index] <= 1.0) { + params.push(roots[index]); + } + } + + params.push(1.0); + params.push(0.0); + var minDistanceSquared = -1; + var curX, curY, distSquared; + + for (var i = 0; i < params.length; i++) { + curX = Math.pow(1.0 - params[i], 2.0) * x1 + 2.0 * (1 - params[i]) * params[i] * x2 + params[i] * params[i] * x3; + curY = Math.pow(1 - params[i], 2.0) * y1 + 2 * (1.0 - params[i]) * params[i] * y2 + params[i] * params[i] * y3; + distSquared = Math.pow(curX - x, 2) + Math.pow(curY - y, 2); // debug('distance for param ' + params[i] + ": " + Math.sqrt(distSquared)); + + if (minDistanceSquared >= 0) { + if (distSquared < minDistanceSquared) { + minDistanceSquared = distSquared; + } + } else { + minDistanceSquared = distSquared; + } + } + + return minDistanceSquared; + }; + var sqdistToFiniteLine = function sqdistToFiniteLine(x, y, x1, y1, x2, y2) { + var offset = [x - x1, y - y1]; + var line = [x2 - x1, y2 - y1]; + var lineSq = line[0] * line[0] + line[1] * line[1]; + var hypSq = offset[0] * offset[0] + offset[1] * offset[1]; + var dotProduct = offset[0] * line[0] + offset[1] * line[1]; + var adjSq = dotProduct * dotProduct / lineSq; + + if (dotProduct < 0) { + return hypSq; + } + + if (adjSq > lineSq) { + return (x - x2) * (x - x2) + (y - y2) * (y - y2); + } + + return hypSq - adjSq; + }; + var pointInsidePolygonPoints = function pointInsidePolygonPoints(x, y, points) { + var x1, y1, x2, y2; + var y3; // Intersect with vertical line through (x, y) + + var up = 0; // let down = 0; + + for (var i = 0; i < points.length / 2; i++) { + x1 = points[i * 2]; + y1 = points[i * 2 + 1]; + + if (i + 1 < points.length / 2) { + x2 = points[(i + 1) * 2]; + y2 = points[(i + 1) * 2 + 1]; + } else { + x2 = points[(i + 1 - points.length / 2) * 2]; + y2 = points[(i + 1 - points.length / 2) * 2 + 1]; + } + + if (x1 == x && x2 == x) ; else if (x1 >= x && x >= x2 || x1 <= x && x <= x2) { + y3 = (x - x1) / (x2 - x1) * (y2 - y1) + y1; + + if (y3 > y) { + up++; + } // if( y3 < y ){ + // down++; + // } + + } else { + continue; + } + } + + if (up % 2 === 0) { + return false; + } else { + return true; + } + }; + var pointInsidePolygon = function pointInsidePolygon(x, y, basePoints, centerX, centerY, width, height, direction, padding) { + var transformedPoints = new Array(basePoints.length); // Gives negative angle + + var angle; + + if (direction[0] != null) { + angle = Math.atan(direction[1] / direction[0]); + + if (direction[0] < 0) { + angle = angle + Math.PI / 2; + } else { + angle = -angle - Math.PI / 2; + } + } else { + angle = direction; + } + + var cos = Math.cos(-angle); + var sin = Math.sin(-angle); // console.log("base: " + basePoints); + + for (var i = 0; i < transformedPoints.length / 2; i++) { + transformedPoints[i * 2] = width / 2 * (basePoints[i * 2] * cos - basePoints[i * 2 + 1] * sin); + transformedPoints[i * 2 + 1] = height / 2 * (basePoints[i * 2 + 1] * cos + basePoints[i * 2] * sin); + transformedPoints[i * 2] += centerX; + transformedPoints[i * 2 + 1] += centerY; + } + + var points; + + if (padding > 0) { + var expandedLineSet = expandPolygon(transformedPoints, -padding); + points = joinLines(expandedLineSet); + } else { + points = transformedPoints; + } + + return pointInsidePolygonPoints(x, y, points); + }; + var pointInsideRoundPolygon = function pointInsideRoundPolygon(x, y, basePoints, centerX, centerY, width, height) { + var cutPolygonPoints = new Array(basePoints.length); + var halfW = width / 2; + var halfH = height / 2; + var cornerRadius = getRoundPolygonRadius(width, height); + var squaredCornerRadius = cornerRadius * cornerRadius; + + for (var i = 0; i < basePoints.length / 4; i++) { + var sourceUv = void 0, + destUv = void 0; + + if (i === 0) { + sourceUv = basePoints.length - 2; + } else { + sourceUv = i * 4 - 2; + } + + destUv = i * 4 + 2; + var px = centerX + halfW * basePoints[i * 4]; + var py = centerY + halfH * basePoints[i * 4 + 1]; + var cosTheta = -basePoints[sourceUv] * basePoints[destUv] - basePoints[sourceUv + 1] * basePoints[destUv + 1]; + var offset = cornerRadius / Math.tan(Math.acos(cosTheta) / 2); + var cp0x = px - offset * basePoints[sourceUv]; + var cp0y = py - offset * basePoints[sourceUv + 1]; + var cp1x = px + offset * basePoints[destUv]; + var cp1y = py + offset * basePoints[destUv + 1]; + cutPolygonPoints[i * 4] = cp0x; + cutPolygonPoints[i * 4 + 1] = cp0y; + cutPolygonPoints[i * 4 + 2] = cp1x; + cutPolygonPoints[i * 4 + 3] = cp1y; + var orthx = basePoints[sourceUv + 1]; + var orthy = -basePoints[sourceUv]; + var cosAlpha = orthx * basePoints[destUv] + orthy * basePoints[destUv + 1]; + + if (cosAlpha < 0) { + orthx *= -1; + orthy *= -1; + } + + var cx = cp0x + orthx * cornerRadius; + var cy = cp0y + orthy * cornerRadius; + var squaredDistance = Math.pow(cx - x, 2) + Math.pow(cy - y, 2); + + if (squaredDistance <= squaredCornerRadius) { + return true; + } + } + + return pointInsidePolygonPoints(x, y, cutPolygonPoints); + }; + var joinLines = function joinLines(lineSet) { + var vertices = new Array(lineSet.length / 2); + var currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY; + var nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY; + + for (var i = 0; i < lineSet.length / 4; i++) { + currentLineStartX = lineSet[i * 4]; + currentLineStartY = lineSet[i * 4 + 1]; + currentLineEndX = lineSet[i * 4 + 2]; + currentLineEndY = lineSet[i * 4 + 3]; + + if (i < lineSet.length / 4 - 1) { + nextLineStartX = lineSet[(i + 1) * 4]; + nextLineStartY = lineSet[(i + 1) * 4 + 1]; + nextLineEndX = lineSet[(i + 1) * 4 + 2]; + nextLineEndY = lineSet[(i + 1) * 4 + 3]; + } else { + nextLineStartX = lineSet[0]; + nextLineStartY = lineSet[1]; + nextLineEndX = lineSet[2]; + nextLineEndY = lineSet[3]; + } + + var intersection = finiteLinesIntersect(currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY, nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY, true); + vertices[i * 2] = intersection[0]; + vertices[i * 2 + 1] = intersection[1]; + } + + return vertices; + }; + var expandPolygon = function expandPolygon(points, pad) { + var expandedLineSet = new Array(points.length * 2); + var currentPointX, currentPointY, nextPointX, nextPointY; + + for (var i = 0; i < points.length / 2; i++) { + currentPointX = points[i * 2]; + currentPointY = points[i * 2 + 1]; + + if (i < points.length / 2 - 1) { + nextPointX = points[(i + 1) * 2]; + nextPointY = points[(i + 1) * 2 + 1]; + } else { + nextPointX = points[0]; + nextPointY = points[1]; + } // Current line: [currentPointX, currentPointY] to [nextPointX, nextPointY] + // Assume CCW polygon winding + + + var offsetX = nextPointY - currentPointY; + var offsetY = -(nextPointX - currentPointX); // Normalize + + var offsetLength = Math.sqrt(offsetX * offsetX + offsetY * offsetY); + var normalizedOffsetX = offsetX / offsetLength; + var normalizedOffsetY = offsetY / offsetLength; + expandedLineSet[i * 4] = currentPointX + normalizedOffsetX * pad; + expandedLineSet[i * 4 + 1] = currentPointY + normalizedOffsetY * pad; + expandedLineSet[i * 4 + 2] = nextPointX + normalizedOffsetX * pad; + expandedLineSet[i * 4 + 3] = nextPointY + normalizedOffsetY * pad; + } + + return expandedLineSet; + }; + var intersectLineEllipse = function intersectLineEllipse(x, y, centerX, centerY, ellipseWradius, ellipseHradius) { + var dispX = centerX - x; + var dispY = centerY - y; + dispX /= ellipseWradius; + dispY /= ellipseHradius; + var len = Math.sqrt(dispX * dispX + dispY * dispY); + var newLength = len - 1; + + if (newLength < 0) { + return []; + } + + var lenProportion = newLength / len; + return [(centerX - x) * lenProportion + x, (centerY - y) * lenProportion + y]; + }; + var checkInEllipse = function checkInEllipse(x, y, width, height, centerX, centerY, padding) { + x -= centerX; + y -= centerY; + x /= width / 2 + padding; + y /= height / 2 + padding; + return x * x + y * y <= 1; + }; // Returns intersections of increasing distance from line's start point + + var intersectLineCircle = function intersectLineCircle(x1, y1, x2, y2, centerX, centerY, radius) { + // Calculate d, direction vector of line + var d = [x2 - x1, y2 - y1]; // Direction vector of line + + var f = [x1 - centerX, y1 - centerY]; + var a = d[0] * d[0] + d[1] * d[1]; + var b = 2 * (f[0] * d[0] + f[1] * d[1]); + var c = f[0] * f[0] + f[1] * f[1] - radius * radius; + var discriminant = b * b - 4 * a * c; + + if (discriminant < 0) { + return []; + } + + var t1 = (-b + Math.sqrt(discriminant)) / (2 * a); + var t2 = (-b - Math.sqrt(discriminant)) / (2 * a); + var tMin = Math.min(t1, t2); + var tMax = Math.max(t1, t2); + var inRangeParams = []; + + if (tMin >= 0 && tMin <= 1) { + inRangeParams.push(tMin); + } + + if (tMax >= 0 && tMax <= 1) { + inRangeParams.push(tMax); + } + + if (inRangeParams.length === 0) { + return []; + } + + var nearIntersectionX = inRangeParams[0] * d[0] + x1; + var nearIntersectionY = inRangeParams[0] * d[1] + y1; + + if (inRangeParams.length > 1) { + if (inRangeParams[0] == inRangeParams[1]) { + return [nearIntersectionX, nearIntersectionY]; + } else { + var farIntersectionX = inRangeParams[1] * d[0] + x1; + var farIntersectionY = inRangeParams[1] * d[1] + y1; + return [nearIntersectionX, nearIntersectionY, farIntersectionX, farIntersectionY]; + } + } else { + return [nearIntersectionX, nearIntersectionY]; + } + }; + var midOfThree = function midOfThree(a, b, c) { + if (b <= a && a <= c || c <= a && a <= b) { + return a; + } else if (a <= b && b <= c || c <= b && b <= a) { + return b; + } else { + return c; + } + }; // (x1,y1)=>(x2,y2) intersect with (x3,y3)=>(x4,y4) + + var finiteLinesIntersect = function finiteLinesIntersect(x1, y1, x2, y2, x3, y3, x4, y4, infiniteLines) { + var dx13 = x1 - x3; + var dx21 = x2 - x1; + var dx43 = x4 - x3; + var dy13 = y1 - y3; + var dy21 = y2 - y1; + var dy43 = y4 - y3; + var ua_t = dx43 * dy13 - dy43 * dx13; + var ub_t = dx21 * dy13 - dy21 * dx13; + var u_b = dy43 * dx21 - dx43 * dy21; + + if (u_b !== 0) { + var ua = ua_t / u_b; + var ub = ub_t / u_b; + var flptThreshold = 0.001; + + var _min = 0 - flptThreshold; + + var _max = 1 + flptThreshold; + + if (_min <= ua && ua <= _max && _min <= ub && ub <= _max) { + return [x1 + ua * dx21, y1 + ua * dy21]; + } else { + if (!infiniteLines) { + return []; + } else { + return [x1 + ua * dx21, y1 + ua * dy21]; + } + } + } else { + if (ua_t === 0 || ub_t === 0) { + // Parallel, coincident lines. Check if overlap + // Check endpoint of second line + if (midOfThree(x1, x2, x4) === x4) { + return [x4, y4]; + } // Check start point of second line + + + if (midOfThree(x1, x2, x3) === x3) { + return [x3, y3]; + } // Endpoint of first line + + + if (midOfThree(x3, x4, x2) === x2) { + return [x2, y2]; + } + + return []; + } else { + // Parallel, non-coincident + return []; + } + } + }; // math.polygonIntersectLine( x, y, basePoints, centerX, centerY, width, height, padding ) + // intersect a node polygon (pts transformed) + // + // math.polygonIntersectLine( x, y, basePoints, centerX, centerY ) + // intersect the points (no transform) + + var polygonIntersectLine = function polygonIntersectLine(x, y, basePoints, centerX, centerY, width, height, padding) { + var intersections = []; + var intersection; + var transformedPoints = new Array(basePoints.length); + var doTransform = true; + + if (width == null) { + doTransform = false; + } + + var points; + + if (doTransform) { + for (var i = 0; i < transformedPoints.length / 2; i++) { + transformedPoints[i * 2] = basePoints[i * 2] * width + centerX; + transformedPoints[i * 2 + 1] = basePoints[i * 2 + 1] * height + centerY; + } + + if (padding > 0) { + var expandedLineSet = expandPolygon(transformedPoints, -padding); + points = joinLines(expandedLineSet); + } else { + points = transformedPoints; + } + } else { + points = basePoints; + } + + var currentX, currentY, nextX, nextY; + + for (var _i2 = 0; _i2 < points.length / 2; _i2++) { + currentX = points[_i2 * 2]; + currentY = points[_i2 * 2 + 1]; + + if (_i2 < points.length / 2 - 1) { + nextX = points[(_i2 + 1) * 2]; + nextY = points[(_i2 + 1) * 2 + 1]; + } else { + nextX = points[0]; + nextY = points[1]; + } + + intersection = finiteLinesIntersect(x, y, centerX, centerY, currentX, currentY, nextX, nextY); + + if (intersection.length !== 0) { + intersections.push(intersection[0], intersection[1]); + } + } + + return intersections; + }; + var roundPolygonIntersectLine = function roundPolygonIntersectLine(x, y, basePoints, centerX, centerY, width, height, padding) { + var intersections = []; + var intersection; + var lines = new Array(basePoints.length); + var halfW = width / 2; + var halfH = height / 2; + var cornerRadius = getRoundPolygonRadius(width, height); + + for (var i = 0; i < basePoints.length / 4; i++) { + var sourceUv = void 0, + destUv = void 0; + + if (i === 0) { + sourceUv = basePoints.length - 2; + } else { + sourceUv = i * 4 - 2; + } + + destUv = i * 4 + 2; + var px = centerX + halfW * basePoints[i * 4]; + var py = centerY + halfH * basePoints[i * 4 + 1]; + var cosTheta = -basePoints[sourceUv] * basePoints[destUv] - basePoints[sourceUv + 1] * basePoints[destUv + 1]; + var offset = cornerRadius / Math.tan(Math.acos(cosTheta) / 2); + var cp0x = px - offset * basePoints[sourceUv]; + var cp0y = py - offset * basePoints[sourceUv + 1]; + var cp1x = px + offset * basePoints[destUv]; + var cp1y = py + offset * basePoints[destUv + 1]; + + if (i === 0) { + lines[basePoints.length - 2] = cp0x; + lines[basePoints.length - 1] = cp0y; + } else { + lines[i * 4 - 2] = cp0x; + lines[i * 4 - 1] = cp0y; + } + + lines[i * 4] = cp1x; + lines[i * 4 + 1] = cp1y; + var orthx = basePoints[sourceUv + 1]; + var orthy = -basePoints[sourceUv]; + var cosAlpha = orthx * basePoints[destUv] + orthy * basePoints[destUv + 1]; + + if (cosAlpha < 0) { + orthx *= -1; + orthy *= -1; + } + + var cx = cp0x + orthx * cornerRadius; + var cy = cp0y + orthy * cornerRadius; + intersection = intersectLineCircle(x, y, centerX, centerY, cx, cy, cornerRadius); + + if (intersection.length !== 0) { + intersections.push(intersection[0], intersection[1]); + } + } + + for (var _i3 = 0; _i3 < lines.length / 4; _i3++) { + intersection = finiteLinesIntersect(x, y, centerX, centerY, lines[_i3 * 4], lines[_i3 * 4 + 1], lines[_i3 * 4 + 2], lines[_i3 * 4 + 3], false); + + if (intersection.length !== 0) { + intersections.push(intersection[0], intersection[1]); + } + } + + if (intersections.length > 2) { + var lowestIntersection = [intersections[0], intersections[1]]; + var lowestSquaredDistance = Math.pow(lowestIntersection[0] - x, 2) + Math.pow(lowestIntersection[1] - y, 2); + + for (var _i4 = 1; _i4 < intersections.length / 2; _i4++) { + var squaredDistance = Math.pow(intersections[_i4 * 2] - x, 2) + Math.pow(intersections[_i4 * 2 + 1] - y, 2); + + if (squaredDistance <= lowestSquaredDistance) { + lowestIntersection[0] = intersections[_i4 * 2]; + lowestIntersection[1] = intersections[_i4 * 2 + 1]; + lowestSquaredDistance = squaredDistance; + } + } + + return lowestIntersection; + } + + return intersections; + }; + var shortenIntersection = function shortenIntersection(intersection, offset, amount) { + var disp = [intersection[0] - offset[0], intersection[1] - offset[1]]; + var length = Math.sqrt(disp[0] * disp[0] + disp[1] * disp[1]); + var lenRatio = (length - amount) / length; + + if (lenRatio < 0) { + lenRatio = 0.00001; + } + + return [offset[0] + lenRatio * disp[0], offset[1] + lenRatio * disp[1]]; + }; + var generateUnitNgonPointsFitToSquare = function generateUnitNgonPointsFitToSquare(sides, rotationRadians) { + var points = generateUnitNgonPoints(sides, rotationRadians); + points = fitPolygonToSquare(points); + return points; + }; + var fitPolygonToSquare = function fitPolygonToSquare(points) { + var x, y; + var sides = points.length / 2; + var minX = Infinity, + minY = Infinity, + maxX = -Infinity, + maxY = -Infinity; + + for (var i = 0; i < sides; i++) { + x = points[2 * i]; + y = points[2 * i + 1]; + minX = Math.min(minX, x); + maxX = Math.max(maxX, x); + minY = Math.min(minY, y); + maxY = Math.max(maxY, y); + } // stretch factors + + + var sx = 2 / (maxX - minX); + var sy = 2 / (maxY - minY); + + for (var _i5 = 0; _i5 < sides; _i5++) { + x = points[2 * _i5] = points[2 * _i5] * sx; + y = points[2 * _i5 + 1] = points[2 * _i5 + 1] * sy; + minX = Math.min(minX, x); + maxX = Math.max(maxX, x); + minY = Math.min(minY, y); + maxY = Math.max(maxY, y); + } + + if (minY < -1) { + for (var _i6 = 0; _i6 < sides; _i6++) { + y = points[2 * _i6 + 1] = points[2 * _i6 + 1] + (-1 - minY); + } + } + + return points; + }; + var generateUnitNgonPoints = function generateUnitNgonPoints(sides, rotationRadians) { + var increment = 1.0 / sides * 2 * Math.PI; + var startAngle = sides % 2 === 0 ? Math.PI / 2.0 + increment / 2.0 : Math.PI / 2.0; + startAngle += rotationRadians; + var points = new Array(sides * 2); + var currentAngle; + + for (var i = 0; i < sides; i++) { + currentAngle = i * increment + startAngle; + points[2 * i] = Math.cos(currentAngle); // x + + points[2 * i + 1] = Math.sin(-currentAngle); // y + } + + return points; + }; // Set the default radius, unless half of width or height is smaller than default + + var getRoundRectangleRadius = function getRoundRectangleRadius(width, height) { + return Math.min(width / 4, height / 4, 8); + }; // Set the default radius + + var getRoundPolygonRadius = function getRoundPolygonRadius(width, height) { + return Math.min(width / 10, height / 10, 8); + }; + var getCutRectangleCornerLength = function getCutRectangleCornerLength() { + return 8; + }; + var bezierPtsToQuadCoeff = function bezierPtsToQuadCoeff(p0, p1, p2) { + return [p0 - 2 * p1 + p2, 2 * (p1 - p0), p0]; + }; // get curve width, height, and control point position offsets as a percentage of node height / width + + var getBarrelCurveConstants = function getBarrelCurveConstants(width, height) { + return { + heightOffset: Math.min(15, 0.05 * height), + widthOffset: Math.min(100, 0.25 * width), + ctrlPtOffsetPct: 0.05 + }; + }; + + var pageRankDefaults = defaults$g({ + dampingFactor: 0.8, + precision: 0.000001, + iterations: 200, + weight: function weight(edge) { + return 1; + } + }); + var elesfn$o = { + pageRank: function pageRank(options) { + var _pageRankDefaults = pageRankDefaults(options), + dampingFactor = _pageRankDefaults.dampingFactor, + precision = _pageRankDefaults.precision, + iterations = _pageRankDefaults.iterations, + weight = _pageRankDefaults.weight; + + var cy = this._private.cy; + + var _this$byGroup = this.byGroup(), + nodes = _this$byGroup.nodes, + edges = _this$byGroup.edges; + + var numNodes = nodes.length; + var numNodesSqd = numNodes * numNodes; + var numEdges = edges.length; // Construct transposed adjacency matrix + // First lets have a zeroed matrix of the right size + // We'll also keep track of the sum of each column + + var matrix = new Array(numNodesSqd); + var columnSum = new Array(numNodes); + var additionalProb = (1 - dampingFactor) / numNodes; // Create null matrix + + for (var i = 0; i < numNodes; i++) { + for (var j = 0; j < numNodes; j++) { + var n = i * numNodes + j; + matrix[n] = 0; + } + + columnSum[i] = 0; + } // Now, process edges + + + for (var _i = 0; _i < numEdges; _i++) { + var edge = edges[_i]; + var srcId = edge.data('source'); + var tgtId = edge.data('target'); // Don't include loops in the matrix + + if (srcId === tgtId) { + continue; + } + + var s = nodes.indexOfId(srcId); + var t = nodes.indexOfId(tgtId); + var w = weight(edge); + + var _n = t * numNodes + s; // Update matrix + + + matrix[_n] += w; // Update column sum + + columnSum[s] += w; + } // Add additional probability based on damping factor + // Also, take into account columns that have sum = 0 + + + var p = 1.0 / numNodes + additionalProb; // Shorthand + // Traverse matrix, column by column + + for (var _j = 0; _j < numNodes; _j++) { + if (columnSum[_j] === 0) { + // No 'links' out from node jth, assume equal probability for each possible node + for (var _i2 = 0; _i2 < numNodes; _i2++) { + var _n2 = _i2 * numNodes + _j; + + matrix[_n2] = p; + } + } else { + // Node jth has outgoing link, compute normalized probabilities + for (var _i3 = 0; _i3 < numNodes; _i3++) { + var _n3 = _i3 * numNodes + _j; + + matrix[_n3] = matrix[_n3] / columnSum[_j] + additionalProb; + } + } + } // Compute dominant eigenvector using power method + + + var eigenvector = new Array(numNodes); + var temp = new Array(numNodes); + var previous; // Start with a vector of all 1's + // Also, initialize a null vector which will be used as shorthand + + for (var _i4 = 0; _i4 < numNodes; _i4++) { + eigenvector[_i4] = 1; + } + + for (var iter = 0; iter < iterations; iter++) { + // Temp array with all 0's + for (var _i5 = 0; _i5 < numNodes; _i5++) { + temp[_i5] = 0; + } // Multiply matrix with previous result + + + for (var _i6 = 0; _i6 < numNodes; _i6++) { + for (var _j2 = 0; _j2 < numNodes; _j2++) { + var _n4 = _i6 * numNodes + _j2; + + temp[_i6] += matrix[_n4] * eigenvector[_j2]; + } + } + + inPlaceSumNormalize(temp); + previous = eigenvector; + eigenvector = temp; + temp = previous; + var diff = 0; // Compute difference (squared module) of both vectors + + for (var _i7 = 0; _i7 < numNodes; _i7++) { + var delta = previous[_i7] - eigenvector[_i7]; + diff += delta * delta; + } // If difference is less than the desired threshold, stop iterating + + + if (diff < precision) { + break; + } + } // Construct result + + + var res = { + rank: function rank(node) { + node = cy.collection(node)[0]; + return eigenvector[nodes.indexOf(node)]; + } + }; + return res; + } // pageRank + + }; // elesfn + + var defaults$f = defaults$g({ + root: null, + weight: function weight(edge) { + return 1; + }, + directed: false, + alpha: 0 + }); + var elesfn$n = { + degreeCentralityNormalized: function degreeCentralityNormalized(options) { + options = defaults$f(options); + var cy = this.cy(); + var nodes = this.nodes(); + var numNodes = nodes.length; + + if (!options.directed) { + var degrees = {}; + var maxDegree = 0; + + for (var i = 0; i < numNodes; i++) { + var node = nodes[i]; // add current node to the current options object and call degreeCentrality + + options.root = node; + var currDegree = this.degreeCentrality(options); + + if (maxDegree < currDegree.degree) { + maxDegree = currDegree.degree; + } + + degrees[node.id()] = currDegree.degree; + } + + return { + degree: function degree(node) { + if (maxDegree === 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node); + } + + return degrees[node.id()] / maxDegree; + } + }; + } else { + var indegrees = {}; + var outdegrees = {}; + var maxIndegree = 0; + var maxOutdegree = 0; + + for (var _i = 0; _i < numNodes; _i++) { + var _node = nodes[_i]; + + var id = _node.id(); // add current node to the current options object and call degreeCentrality + + + options.root = _node; + + var _currDegree = this.degreeCentrality(options); + + if (maxIndegree < _currDegree.indegree) maxIndegree = _currDegree.indegree; + if (maxOutdegree < _currDegree.outdegree) maxOutdegree = _currDegree.outdegree; + indegrees[id] = _currDegree.indegree; + outdegrees[id] = _currDegree.outdegree; + } + + return { + indegree: function indegree(node) { + if (maxIndegree == 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node); + } + + return indegrees[node.id()] / maxIndegree; + }, + outdegree: function outdegree(node) { + if (maxOutdegree === 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node); + } + + return outdegrees[node.id()] / maxOutdegree; + } + }; + } + }, + // degreeCentralityNormalized + // Implemented from the algorithm in Opsahl's paper + // "Node centrality in weighted networks: Generalizing degree and shortest paths" + // check the heading 2 "Degree" + degreeCentrality: function degreeCentrality(options) { + options = defaults$f(options); + var cy = this.cy(); + var callingEles = this; + var _options = options, + root = _options.root, + weight = _options.weight, + directed = _options.directed, + alpha = _options.alpha; + root = cy.collection(root)[0]; + + if (!directed) { + var connEdges = root.connectedEdges().intersection(callingEles); + var k = connEdges.length; + var s = 0; // Now, sum edge weights + + for (var i = 0; i < connEdges.length; i++) { + s += weight(connEdges[i]); + } + + return { + degree: Math.pow(k, 1 - alpha) * Math.pow(s, alpha) + }; + } else { + var edges = root.connectedEdges(); + var incoming = edges.filter(function (edge) { + return edge.target().same(root) && callingEles.has(edge); + }); + var outgoing = edges.filter(function (edge) { + return edge.source().same(root) && callingEles.has(edge); + }); + var k_in = incoming.length; + var k_out = outgoing.length; + var s_in = 0; + var s_out = 0; // Now, sum incoming edge weights + + for (var _i2 = 0; _i2 < incoming.length; _i2++) { + s_in += weight(incoming[_i2]); + } // Now, sum outgoing edge weights + + + for (var _i3 = 0; _i3 < outgoing.length; _i3++) { + s_out += weight(outgoing[_i3]); + } + + return { + indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha), + outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha) + }; + } + } // degreeCentrality + + }; // elesfn + // nice, short mathematical alias + + elesfn$n.dc = elesfn$n.degreeCentrality; + elesfn$n.dcn = elesfn$n.degreeCentralityNormalised = elesfn$n.degreeCentralityNormalized; + + var defaults$e = defaults$g({ + harmonic: true, + weight: function weight() { + return 1; + }, + directed: false, + root: null + }); + var elesfn$m = { + closenessCentralityNormalized: function closenessCentralityNormalized(options) { + var _defaults = defaults$e(options), + harmonic = _defaults.harmonic, + weight = _defaults.weight, + directed = _defaults.directed; + + var cy = this.cy(); + var closenesses = {}; + var maxCloseness = 0; + var nodes = this.nodes(); + var fw = this.floydWarshall({ + weight: weight, + directed: directed + }); // Compute closeness for every node and find the maximum closeness + + for (var i = 0; i < nodes.length; i++) { + var currCloseness = 0; + var node_i = nodes[i]; + + for (var j = 0; j < nodes.length; j++) { + if (i !== j) { + var d = fw.distance(node_i, nodes[j]); + + if (harmonic) { + currCloseness += 1 / d; + } else { + currCloseness += d; + } + } + } + + if (!harmonic) { + currCloseness = 1 / currCloseness; + } + + if (maxCloseness < currCloseness) { + maxCloseness = currCloseness; + } + + closenesses[node_i.id()] = currCloseness; + } + + return { + closeness: function closeness(node) { + if (maxCloseness == 0) { + return 0; + } + + if (string(node)) { + // from is a selector string + node = cy.filter(node)[0].id(); + } else { + // from is a node + node = node.id(); + } + + return closenesses[node] / maxCloseness; + } + }; + }, + // Implemented from pseudocode from wikipedia + closenessCentrality: function closenessCentrality(options) { + var _defaults2 = defaults$e(options), + root = _defaults2.root, + weight = _defaults2.weight, + directed = _defaults2.directed, + harmonic = _defaults2.harmonic; + + root = this.filter(root)[0]; // we need distance from this node to every other node + + var dijkstra = this.dijkstra({ + root: root, + weight: weight, + directed: directed + }); + var totalDistance = 0; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + + if (!n.same(root)) { + var d = dijkstra.distanceTo(n); + + if (harmonic) { + totalDistance += 1 / d; + } else { + totalDistance += d; + } + } + } + + return harmonic ? totalDistance : 1 / totalDistance; + } // closenessCentrality + + }; // elesfn + // nice, short mathematical alias + + elesfn$m.cc = elesfn$m.closenessCentrality; + elesfn$m.ccn = elesfn$m.closenessCentralityNormalised = elesfn$m.closenessCentralityNormalized; + + var defaults$d = defaults$g({ + weight: null, + directed: false + }); + var elesfn$l = { + // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes + betweennessCentrality: function betweennessCentrality(options) { + var _defaults = defaults$d(options), + directed = _defaults.directed, + weight = _defaults.weight; + + var weighted = weight != null; + var cy = this.cy(); // starting + + var V = this.nodes(); + var A = {}; + var _C = {}; + var max = 0; + var C = { + set: function set(key, val) { + _C[key] = val; + + if (val > max) { + max = val; + } + }, + get: function get(key) { + return _C[key]; + } + }; // A contains the neighborhoods of every node + + for (var i = 0; i < V.length; i++) { + var v = V[i]; + var vid = v.id(); + + if (directed) { + A[vid] = v.outgoers().nodes(); // get outgoers of every node + } else { + A[vid] = v.openNeighborhood().nodes(); // get neighbors of every node + } + + C.set(vid, 0); + } + + var _loop = function _loop(s) { + var sid = V[s].id(); + var S = []; // stack + + var P = {}; + var g = {}; + var d = {}; + var Q = new heap(function (a, b) { + return d[a] - d[b]; + }); // queue + // init dictionaries + + for (var _i = 0; _i < V.length; _i++) { + var _vid = V[_i].id(); + + P[_vid] = []; + g[_vid] = 0; + d[_vid] = Infinity; + } + + g[sid] = 1; // sigma + + d[sid] = 0; // distance to s + + Q.push(sid); + + while (!Q.empty()) { + var _v = Q.pop(); + + S.push(_v); + + if (weighted) { + for (var j = 0; j < A[_v].length; j++) { + var w = A[_v][j]; + var vEle = cy.getElementById(_v); + var edge = void 0; + + if (vEle.edgesTo(w).length > 0) { + edge = vEle.edgesTo(w)[0]; + } else { + edge = w.edgesTo(vEle)[0]; + } + + var edgeWeight = weight(edge); + w = w.id(); + + if (d[w] > d[_v] + edgeWeight) { + d[w] = d[_v] + edgeWeight; + + if (Q.nodes.indexOf(w) < 0) { + //if w is not in Q + Q.push(w); + } else { + // update position if w is in Q + Q.updateItem(w); + } + + g[w] = 0; + P[w] = []; + } + + if (d[w] == d[_v] + edgeWeight) { + g[w] = g[w] + g[_v]; + P[w].push(_v); + } + } + } else { + for (var _j = 0; _j < A[_v].length; _j++) { + var _w = A[_v][_j].id(); + + if (d[_w] == Infinity) { + Q.push(_w); + d[_w] = d[_v] + 1; + } + + if (d[_w] == d[_v] + 1) { + g[_w] = g[_w] + g[_v]; + + P[_w].push(_v); + } + } + } + } + + var e = {}; + + for (var _i2 = 0; _i2 < V.length; _i2++) { + e[V[_i2].id()] = 0; + } + + while (S.length > 0) { + var _w2 = S.pop(); + + for (var _j2 = 0; _j2 < P[_w2].length; _j2++) { + var _v2 = P[_w2][_j2]; + e[_v2] = e[_v2] + g[_v2] / g[_w2] * (1 + e[_w2]); + } + + if (_w2 != V[s].id()) { + C.set(_w2, C.get(_w2) + e[_w2]); + } + } + }; + + for (var s = 0; s < V.length; s++) { + _loop(s); + } + + var ret = { + betweenness: function betweenness(node) { + var id = cy.collection(node).id(); + return C.get(id); + }, + betweennessNormalized: function betweennessNormalized(node) { + if (max == 0) { + return 0; + } + + var id = cy.collection(node).id(); + return C.get(id) / max; + } + }; // alias + + ret.betweennessNormalised = ret.betweennessNormalized; + return ret; + } // betweennessCentrality + + }; // elesfn + // nice, short mathematical alias + + elesfn$l.bc = elesfn$l.betweennessCentrality; + + // Implemented by Zoe Xi @zoexi for GSOC 2016 + /* eslint-disable no-unused-vars */ + + var defaults$c = defaults$g({ + expandFactor: 2, + // affects time of computation and cluster granularity to some extent: M * M + inflateFactor: 2, + // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j) + multFactor: 1, + // optional self loops for each node. Use a neutral value to improve cluster computations. + maxIterations: 20, + // maximum number of iterations of the MCL algorithm in a single run + attributes: [// attributes/features used to group nodes, ie. similarity values between nodes + function (edge) { + return 1; + }] + }); + /* eslint-enable */ + + var setOptions$3 = function setOptions(options) { + return defaults$c(options); + }; + /* eslint-enable */ + + + var getSimilarity$1 = function getSimilarity(edge, attributes) { + var total = 0; + + for (var i = 0; i < attributes.length; i++) { + total += attributes[i](edge); + } + + return total; + }; + + var addLoops = function addLoops(M, n, val) { + for (var i = 0; i < n; i++) { + M[i * n + i] = val; + } + }; + + var normalize = function normalize(M, n) { + var sum; + + for (var col = 0; col < n; col++) { + sum = 0; + + for (var row = 0; row < n; row++) { + sum += M[row * n + col]; + } + + for (var _row = 0; _row < n; _row++) { + M[_row * n + col] = M[_row * n + col] / sum; + } + } + }; // TODO: blocked matrix multiplication? + + + var mmult = function mmult(A, B, n) { + var C = new Array(n * n); + + for (var i = 0; i < n; i++) { + for (var j = 0; j < n; j++) { + C[i * n + j] = 0; + } + + for (var k = 0; k < n; k++) { + for (var _j = 0; _j < n; _j++) { + C[i * n + _j] += A[i * n + k] * B[k * n + _j]; + } + } + } + + return C; + }; + + var expand = function expand(M, n, expandFactor + /** power **/ + ) { + var _M = M.slice(0); + + for (var p = 1; p < expandFactor; p++) { + M = mmult(M, _M, n); + } + + return M; + }; + + var inflate = function inflate(M, n, inflateFactor + /** r **/ + ) { + var _M = new Array(n * n); // M(i,j) ^ inflatePower + + + for (var i = 0; i < n * n; i++) { + _M[i] = Math.pow(M[i], inflateFactor); + } + + normalize(_M, n); + return _M; + }; + + var hasConverged = function hasConverged(M, _M, n2, roundFactor) { + // Check that both matrices have the same elements (i,j) + for (var i = 0; i < n2; i++) { + var v1 = Math.round(M[i] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor); // truncate to 'roundFactor' decimal places + + var v2 = Math.round(_M[i] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor); + + if (v1 !== v2) { + return false; + } + } + + return true; + }; + + var assign$2 = function assign(M, n, nodes, cy) { + var clusters = []; + + for (var i = 0; i < n; i++) { + var cluster = []; + + for (var j = 0; j < n; j++) { + // Row-wise attractors and elements that they attract belong in same cluster + if (Math.round(M[i * n + j] * 1000) / 1000 > 0) { + cluster.push(nodes[j]); + } + } + + if (cluster.length !== 0) { + clusters.push(cy.collection(cluster)); + } + } + + return clusters; + }; + + var isDuplicate = function isDuplicate(c1, c2) { + for (var i = 0; i < c1.length; i++) { + if (!c2[i] || c1[i].id() !== c2[i].id()) { + return false; + } + } + + return true; + }; + + var removeDuplicates = function removeDuplicates(clusters) { + for (var i = 0; i < clusters.length; i++) { + for (var j = 0; j < clusters.length; j++) { + if (i != j && isDuplicate(clusters[i], clusters[j])) { + clusters.splice(j, 1); + } + } + } + + return clusters; + }; + + var markovClustering = function markovClustering(options) { + var nodes = this.nodes(); + var edges = this.edges(); + var cy = this.cy(); // Set parameters of algorithm: + + var opts = setOptions$3(options); // Map each node to its position in node array + + var id2position = {}; + + for (var i = 0; i < nodes.length; i++) { + id2position[nodes[i].id()] = i; + } // Generate stochastic matrix M from input graph G (should be symmetric/undirected) + + + var n = nodes.length, + n2 = n * n; + + var M = new Array(n2), + _M; + + for (var _i = 0; _i < n2; _i++) { + M[_i] = 0; + } + + for (var e = 0; e < edges.length; e++) { + var edge = edges[e]; + var _i2 = id2position[edge.source().id()]; + var j = id2position[edge.target().id()]; + var sim = getSimilarity$1(edge, opts.attributes); + M[_i2 * n + j] += sim; // G should be symmetric and undirected + + M[j * n + _i2] += sim; + } // Begin Markov cluster algorithm + // Step 1: Add self loops to each node, ie. add multFactor to matrix diagonal + + + addLoops(M, n, opts.multFactor); // Step 2: M = normalize( M ); + + normalize(M, n); + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + isStillMoving = false; // Step 3: + + _M = expand(M, n, opts.expandFactor); // Step 4: + + M = inflate(_M, n, opts.inflateFactor); // Step 5: check to see if ~steady state has been reached + + if (!hasConverged(M, _M, n2, 4)) { + isStillMoving = true; + } + + iterations++; + } // Build clusters from matrix + + + var clusters = assign$2(M, n, nodes, cy); // Remove duplicate clusters due to symmetry of graph and M matrix + + clusters = removeDuplicates(clusters); + return clusters; + }; + + var markovClustering$1 = { + markovClustering: markovClustering, + mcl: markovClustering + }; + + // Common distance metrics for clustering algorithms + + var identity = function identity(x) { + return x; + }; + + var absDiff = function absDiff(p, q) { + return Math.abs(q - p); + }; + + var addAbsDiff = function addAbsDiff(total, p, q) { + return total + absDiff(p, q); + }; + + var addSquaredDiff = function addSquaredDiff(total, p, q) { + return total + Math.pow(q - p, 2); + }; + + var sqrt = function sqrt(x) { + return Math.sqrt(x); + }; + + var maxAbsDiff = function maxAbsDiff(currentMax, p, q) { + return Math.max(currentMax, absDiff(p, q)); + }; + + var getDistance = function getDistance(length, getP, getQ, init, visit) { + var post = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : identity; + var ret = init; + var p, q; + + for (var dim = 0; dim < length; dim++) { + p = getP(dim); + q = getQ(dim); + ret = visit(ret, p, q); + } + + return post(ret); + }; + + var distances = { + euclidean: function euclidean(length, getP, getQ) { + if (length >= 2) { + return getDistance(length, getP, getQ, 0, addSquaredDiff, sqrt); + } else { + // for single attr case, more efficient to avoid sqrt + return getDistance(length, getP, getQ, 0, addAbsDiff); + } + }, + squaredEuclidean: function squaredEuclidean(length, getP, getQ) { + return getDistance(length, getP, getQ, 0, addSquaredDiff); + }, + manhattan: function manhattan(length, getP, getQ) { + return getDistance(length, getP, getQ, 0, addAbsDiff); + }, + max: function max(length, getP, getQ) { + return getDistance(length, getP, getQ, -Infinity, maxAbsDiff); + } + }; // in case the user accidentally doesn't use camel case + + distances['squared-euclidean'] = distances['squaredEuclidean']; + distances['squaredeuclidean'] = distances['squaredEuclidean']; + function clusteringDistance (method, length, getP, getQ, nodeP, nodeQ) { + var impl; + + if (fn$6(method)) { + impl = method; + } else { + impl = distances[method] || distances.euclidean; + } + + if (length === 0 && fn$6(method)) { + return impl(nodeP, nodeQ); + } else { + return impl(length, getP, getQ, nodeP, nodeQ); + } + } + + var defaults$b = defaults$g({ + k: 2, + m: 2, + sensitivityThreshold: 0.0001, + distance: 'euclidean', + maxIterations: 10, + attributes: [], + testMode: false, + testCentroids: null + }); + + var setOptions$2 = function setOptions(options) { + return defaults$b(options); + }; + /* eslint-enable */ + + + var getDist = function getDist(type, node, centroid, attributes, mode) { + var noNodeP = mode !== 'kMedoids'; + var getP = noNodeP ? function (i) { + return centroid[i]; + } : function (i) { + return attributes[i](centroid); + }; + + var getQ = function getQ(i) { + return attributes[i](node); + }; + + var nodeP = centroid; + var nodeQ = node; + return clusteringDistance(type, attributes.length, getP, getQ, nodeP, nodeQ); + }; + + var randomCentroids = function randomCentroids(nodes, k, attributes) { + var ndim = attributes.length; + var min = new Array(ndim); + var max = new Array(ndim); + var centroids = new Array(k); + var centroid = null; // Find min, max values for each attribute dimension + + for (var i = 0; i < ndim; i++) { + min[i] = nodes.min(attributes[i]).value; + max[i] = nodes.max(attributes[i]).value; + } // Build k centroids, each represented as an n-dim feature vector + + + for (var c = 0; c < k; c++) { + centroid = []; + + for (var _i = 0; _i < ndim; _i++) { + centroid[_i] = Math.random() * (max[_i] - min[_i]) + min[_i]; // random initial value + } + + centroids[c] = centroid; + } + + return centroids; + }; + + var classify = function classify(node, centroids, distance, attributes, type) { + var min = Infinity; + var index = 0; + + for (var i = 0; i < centroids.length; i++) { + var dist = getDist(distance, node, centroids[i], attributes, type); + + if (dist < min) { + min = dist; + index = i; + } + } + + return index; + }; + + var buildCluster = function buildCluster(centroid, nodes, assignment) { + var cluster = []; + var node = null; + + for (var n = 0; n < nodes.length; n++) { + node = nodes[n]; + + if (assignment[node.id()] === centroid) { + //console.log("Node " + node.id() + " is associated with medoid #: " + m); + cluster.push(node); + } + } + + return cluster; + }; + + var haveValuesConverged = function haveValuesConverged(v1, v2, sensitivityThreshold) { + return Math.abs(v2 - v1) <= sensitivityThreshold; + }; + + var haveMatricesConverged = function haveMatricesConverged(v1, v2, sensitivityThreshold) { + for (var i = 0; i < v1.length; i++) { + for (var j = 0; j < v1[i].length; j++) { + var diff = Math.abs(v1[i][j] - v2[i][j]); + + if (diff > sensitivityThreshold) { + return false; + } + } + } + + return true; + }; + + var seenBefore = function seenBefore(node, medoids, n) { + for (var i = 0; i < n; i++) { + if (node === medoids[i]) return true; + } + + return false; + }; + + var randomMedoids = function randomMedoids(nodes, k) { + var medoids = new Array(k); // For small data sets, the probability of medoid conflict is greater, + // so we need to check to see if we've already seen or chose this node before. + + if (nodes.length < 50) { + // Randomly select k medoids from the n nodes + for (var i = 0; i < k; i++) { + var node = nodes[Math.floor(Math.random() * nodes.length)]; // If we've already chosen this node to be a medoid, don't choose it again (for small data sets). + // Instead choose a different random node. + + while (seenBefore(node, medoids, i)) { + node = nodes[Math.floor(Math.random() * nodes.length)]; + } + + medoids[i] = node; + } + } else { + // Relatively large data set, so pretty safe to not check and just select random nodes + for (var _i2 = 0; _i2 < k; _i2++) { + medoids[_i2] = nodes[Math.floor(Math.random() * nodes.length)]; + } + } + + return medoids; + }; + + var findCost = function findCost(potentialNewMedoid, cluster, attributes) { + var cost = 0; + + for (var n = 0; n < cluster.length; n++) { + cost += getDist('manhattan', cluster[n], potentialNewMedoid, attributes, 'kMedoids'); + } + + return cost; + }; + + var kMeans = function kMeans(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var node = null; // Set parameters of algorithm: # of clusters, distance metric, etc. + + var opts = setOptions$2(options); // Begin k-means algorithm + + var clusters = new Array(opts.k); + var assignment = {}; + var centroids; // Step 1: Initialize centroid positions + + if (opts.testMode) { + if (typeof opts.testCentroids === 'number') { + // TODO: implement a seeded random number generator. + opts.testCentroids; + centroids = randomCentroids(nodes, opts.k, opts.attributes); + } else if (_typeof(opts.testCentroids) === 'object') { + centroids = opts.testCentroids; + } else { + centroids = randomCentroids(nodes, opts.k, opts.attributes); + } + } else { + centroids = randomCentroids(nodes, opts.k, opts.attributes); + } + + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + // Step 2: Assign nodes to the nearest centroid + for (var n = 0; n < nodes.length; n++) { + node = nodes[n]; // Determine which cluster this node belongs to: node id => cluster # + + assignment[node.id()] = classify(node, centroids, opts.distance, opts.attributes, 'kMeans'); + } // Step 3: For each of the k clusters, update its centroid + + + isStillMoving = false; + + for (var c = 0; c < opts.k; c++) { + // Get all nodes that belong to this cluster + var cluster = buildCluster(c, nodes, assignment); + + if (cluster.length === 0) { + // If cluster is empty, break out early & move to next cluster + continue; + } // Update centroids by calculating avg of all nodes within the cluster. + + + var ndim = opts.attributes.length; + var centroid = centroids[c]; // [ dim_1, dim_2, dim_3, ... , dim_n ] + + var newCentroid = new Array(ndim); + var sum = new Array(ndim); + + for (var d = 0; d < ndim; d++) { + sum[d] = 0.0; + + for (var i = 0; i < cluster.length; i++) { + node = cluster[i]; + sum[d] += opts.attributes[d](node); + } + + newCentroid[d] = sum[d] / cluster.length; // Check to see if algorithm has converged, i.e. when centroids no longer change + + if (!haveValuesConverged(newCentroid[d], centroid[d], opts.sensitivityThreshold)) { + isStillMoving = true; + } + } + + centroids[c] = newCentroid; + clusters[c] = cy.collection(cluster); + } + + iterations++; + } + + return clusters; + }; + + var kMedoids = function kMedoids(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var node = null; + var opts = setOptions$2(options); // Begin k-medoids algorithm + + var clusters = new Array(opts.k); + var medoids; + var assignment = {}; + var curCost; + var minCosts = new Array(opts.k); // minimum cost configuration for each cluster + // Step 1: Initialize k medoids + + if (opts.testMode) { + if (typeof opts.testCentroids === 'number') ; else if (_typeof(opts.testCentroids) === 'object') { + medoids = opts.testCentroids; + } else { + medoids = randomMedoids(nodes, opts.k); + } + } else { + medoids = randomMedoids(nodes, opts.k); + } + + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + // Step 2: Assign nodes to the nearest medoid + for (var n = 0; n < nodes.length; n++) { + node = nodes[n]; // Determine which cluster this node belongs to: node id => cluster # + + assignment[node.id()] = classify(node, medoids, opts.distance, opts.attributes, 'kMedoids'); + } + + isStillMoving = false; // Step 3: For each medoid m, and for each node associated with mediod m, + // select the node with the lowest configuration cost as new medoid. + + for (var m = 0; m < medoids.length; m++) { + // Get all nodes that belong to this medoid + var cluster = buildCluster(m, nodes, assignment); + + if (cluster.length === 0) { + // If cluster is empty, break out early & move to next cluster + continue; + } + + minCosts[m] = findCost(medoids[m], cluster, opts.attributes); // original cost + // Select different medoid if its configuration has the lowest cost + + for (var _n = 0; _n < cluster.length; _n++) { + curCost = findCost(cluster[_n], cluster, opts.attributes); + + if (curCost < minCosts[m]) { + minCosts[m] = curCost; + medoids[m] = cluster[_n]; + isStillMoving = true; + } + } + + clusters[m] = cy.collection(cluster); + } + + iterations++; + } + + return clusters; + }; + + var updateCentroids = function updateCentroids(centroids, nodes, U, weight, opts) { + var numerator, denominator; + + for (var n = 0; n < nodes.length; n++) { + for (var c = 0; c < centroids.length; c++) { + weight[n][c] = Math.pow(U[n][c], opts.m); + } + } + + for (var _c = 0; _c < centroids.length; _c++) { + for (var dim = 0; dim < opts.attributes.length; dim++) { + numerator = 0; + denominator = 0; + + for (var _n2 = 0; _n2 < nodes.length; _n2++) { + numerator += weight[_n2][_c] * opts.attributes[dim](nodes[_n2]); + denominator += weight[_n2][_c]; + } + + centroids[_c][dim] = numerator / denominator; + } + } + }; + + var updateMembership = function updateMembership(U, _U, centroids, nodes, opts) { + // Save previous step + for (var i = 0; i < U.length; i++) { + _U[i] = U[i].slice(); + } + + var sum, numerator, denominator; + var pow = 2 / (opts.m - 1); + + for (var c = 0; c < centroids.length; c++) { + for (var n = 0; n < nodes.length; n++) { + sum = 0; + + for (var k = 0; k < centroids.length; k++) { + // against all other centroids + numerator = getDist(opts.distance, nodes[n], centroids[c], opts.attributes, 'cmeans'); + denominator = getDist(opts.distance, nodes[n], centroids[k], opts.attributes, 'cmeans'); + sum += Math.pow(numerator / denominator, pow); + } + + U[n][c] = 1 / sum; + } + } + }; + + var assign$1 = function assign(nodes, U, opts, cy) { + var clusters = new Array(opts.k); + + for (var c = 0; c < clusters.length; c++) { + clusters[c] = []; + } + + var max; + var index; + + for (var n = 0; n < U.length; n++) { + // for each node (U is N x C matrix) + max = -Infinity; + index = -1; // Determine which cluster the node is most likely to belong in + + for (var _c2 = 0; _c2 < U[0].length; _c2++) { + if (U[n][_c2] > max) { + max = U[n][_c2]; + index = _c2; + } + } + + clusters[index].push(nodes[n]); + } // Turn every array into a collection of nodes + + + for (var _c3 = 0; _c3 < clusters.length; _c3++) { + clusters[_c3] = cy.collection(clusters[_c3]); + } + + return clusters; + }; + + var fuzzyCMeans = function fuzzyCMeans(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var opts = setOptions$2(options); // Begin fuzzy c-means algorithm + + var clusters; + var centroids; + var U; + + var _U; + + var weight; // Step 1: Initialize letiables. + + _U = new Array(nodes.length); + + for (var i = 0; i < nodes.length; i++) { + // N x C matrix + _U[i] = new Array(opts.k); + } + + U = new Array(nodes.length); + + for (var _i3 = 0; _i3 < nodes.length; _i3++) { + // N x C matrix + U[_i3] = new Array(opts.k); + } + + for (var _i4 = 0; _i4 < nodes.length; _i4++) { + var total = 0; + + for (var j = 0; j < opts.k; j++) { + U[_i4][j] = Math.random(); + total += U[_i4][j]; + } + + for (var _j = 0; _j < opts.k; _j++) { + U[_i4][_j] = U[_i4][_j] / total; + } + } + + centroids = new Array(opts.k); + + for (var _i5 = 0; _i5 < opts.k; _i5++) { + centroids[_i5] = new Array(opts.attributes.length); + } + + weight = new Array(nodes.length); + + for (var _i6 = 0; _i6 < nodes.length; _i6++) { + // N x C matrix + weight[_i6] = new Array(opts.k); + } // end init FCM + + + var isStillMoving = true; + var iterations = 0; + + while (isStillMoving && iterations < opts.maxIterations) { + isStillMoving = false; // Step 2: Calculate the centroids for each step. + + updateCentroids(centroids, nodes, U, weight, opts); // Step 3: Update the partition matrix U. + + updateMembership(U, _U, centroids, nodes, opts); // Step 4: Check for convergence. + + if (!haveMatricesConverged(U, _U, opts.sensitivityThreshold)) { + isStillMoving = true; + } + + iterations++; + } // Assign nodes to clusters with highest probability. + + + clusters = assign$1(nodes, U, opts, cy); + return { + clusters: clusters, + degreeOfMembership: U + }; + }; + + var kClustering = { + kMeans: kMeans, + kMedoids: kMedoids, + fuzzyCMeans: fuzzyCMeans, + fcm: fuzzyCMeans + }; + + // Implemented by Zoe Xi @zoexi for GSOC 2016 + var defaults$a = defaults$g({ + distance: 'euclidean', + // distance metric to compare nodes + linkage: 'min', + // linkage criterion : how to determine the distance between clusters of nodes + mode: 'threshold', + // mode:'threshold' => clusters must be threshold distance apart + threshold: Infinity, + // the distance threshold + // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters + addDendrogram: false, + // whether to add the dendrogram to the graph for viz + dendrogramDepth: 0, + // depth at which dendrogram branches are merged into the returned clusters + attributes: [] // array of attr functions + + }); + var linkageAliases = { + 'single': 'min', + 'complete': 'max' + }; + + var setOptions$1 = function setOptions(options) { + var opts = defaults$a(options); + var preferredAlias = linkageAliases[opts.linkage]; + + if (preferredAlias != null) { + opts.linkage = preferredAlias; + } + + return opts; + }; + + var mergeClosest = function mergeClosest(clusters, index, dists, mins, opts) { + // Find two closest clusters from cached mins + var minKey = 0; + var min = Infinity; + var dist; + var attrs = opts.attributes; + + var getDist = function getDist(n1, n2) { + return clusteringDistance(opts.distance, attrs.length, function (i) { + return attrs[i](n1); + }, function (i) { + return attrs[i](n2); + }, n1, n2); + }; + + for (var i = 0; i < clusters.length; i++) { + var key = clusters[i].key; + var _dist = dists[key][mins[key]]; + + if (_dist < min) { + minKey = key; + min = _dist; + } + } + + if (opts.mode === 'threshold' && min >= opts.threshold || opts.mode === 'dendrogram' && clusters.length === 1) { + return false; + } + + var c1 = index[minKey]; + var c2 = index[mins[minKey]]; + var merged; // Merge two closest clusters + + if (opts.mode === 'dendrogram') { + merged = { + left: c1, + right: c2, + key: c1.key + }; + } else { + merged = { + value: c1.value.concat(c2.value), + key: c1.key + }; + } + + clusters[c1.index] = merged; + clusters.splice(c2.index, 1); + index[c1.key] = merged; // Update distances with new merged cluster + + for (var _i = 0; _i < clusters.length; _i++) { + var cur = clusters[_i]; + + if (c1.key === cur.key) { + dist = Infinity; + } else if (opts.linkage === 'min') { + dist = dists[c1.key][cur.key]; + + if (dists[c1.key][cur.key] > dists[c2.key][cur.key]) { + dist = dists[c2.key][cur.key]; + } + } else if (opts.linkage === 'max') { + dist = dists[c1.key][cur.key]; + + if (dists[c1.key][cur.key] < dists[c2.key][cur.key]) { + dist = dists[c2.key][cur.key]; + } + } else if (opts.linkage === 'mean') { + dist = (dists[c1.key][cur.key] * c1.size + dists[c2.key][cur.key] * c2.size) / (c1.size + c2.size); + } else { + if (opts.mode === 'dendrogram') dist = getDist(cur.value, c1.value);else dist = getDist(cur.value[0], c1.value[0]); + } + + dists[c1.key][cur.key] = dists[cur.key][c1.key] = dist; // distance matrix is symmetric + } // Update cached mins + + + for (var _i2 = 0; _i2 < clusters.length; _i2++) { + var key1 = clusters[_i2].key; + + if (mins[key1] === c1.key || mins[key1] === c2.key) { + var _min = key1; + + for (var j = 0; j < clusters.length; j++) { + var key2 = clusters[j].key; + + if (dists[key1][key2] < dists[key1][_min]) { + _min = key2; + } + } + + mins[key1] = _min; + } + + clusters[_i2].index = _i2; + } // Clean up meta data used for clustering + + + c1.key = c2.key = c1.index = c2.index = null; + return true; + }; + + var getAllChildren = function getAllChildren(root, arr, cy) { + if (!root) return; + + if (root.value) { + arr.push(root.value); + } else { + if (root.left) getAllChildren(root.left, arr); + if (root.right) getAllChildren(root.right, arr); + } + }; + + var buildDendrogram = function buildDendrogram(root, cy) { + if (!root) return ''; + + if (root.left && root.right) { + var leftStr = buildDendrogram(root.left, cy); + var rightStr = buildDendrogram(root.right, cy); + var node = cy.add({ + group: 'nodes', + data: { + id: leftStr + ',' + rightStr + } + }); + cy.add({ + group: 'edges', + data: { + source: leftStr, + target: node.id() + } + }); + cy.add({ + group: 'edges', + data: { + source: rightStr, + target: node.id() + } + }); + return node.id(); + } else if (root.value) { + return root.value.id(); + } + }; + + var buildClustersFromTree = function buildClustersFromTree(root, k, cy) { + if (!root) return []; + var left = [], + right = [], + leaves = []; + + if (k === 0) { + // don't cut tree, simply return all nodes as 1 single cluster + if (root.left) getAllChildren(root.left, left); + if (root.right) getAllChildren(root.right, right); + leaves = left.concat(right); + return [cy.collection(leaves)]; + } else if (k === 1) { + // cut at root + if (root.value) { + // leaf node + return [cy.collection(root.value)]; + } else { + if (root.left) getAllChildren(root.left, left); + if (root.right) getAllChildren(root.right, right); + return [cy.collection(left), cy.collection(right)]; + } + } else { + if (root.value) { + return [cy.collection(root.value)]; + } else { + if (root.left) left = buildClustersFromTree(root.left, k - 1, cy); + if (root.right) right = buildClustersFromTree(root.right, k - 1, cy); + return left.concat(right); + } + } + }; + /* eslint-enable */ + + + var hierarchicalClustering = function hierarchicalClustering(options) { + var cy = this.cy(); + var nodes = this.nodes(); // Set parameters of algorithm: linkage type, distance metric, etc. + + var opts = setOptions$1(options); + var attrs = opts.attributes; + + var getDist = function getDist(n1, n2) { + return clusteringDistance(opts.distance, attrs.length, function (i) { + return attrs[i](n1); + }, function (i) { + return attrs[i](n2); + }, n1, n2); + }; // Begin hierarchical algorithm + + + var clusters = []; + var dists = []; // distances between each pair of clusters + + var mins = []; // closest cluster for each cluster + + var index = []; // hash of all clusters by key + // In agglomerative (bottom-up) clustering, each node starts as its own cluster + + for (var n = 0; n < nodes.length; n++) { + var cluster = { + value: opts.mode === 'dendrogram' ? nodes[n] : [nodes[n]], + key: n, + index: n + }; + clusters[n] = cluster; + index[n] = cluster; + dists[n] = []; + mins[n] = 0; + } // Calculate the distance between each pair of clusters + + + for (var i = 0; i < clusters.length; i++) { + for (var j = 0; j <= i; j++) { + var dist = void 0; + + if (opts.mode === 'dendrogram') { + // modes store cluster values differently + dist = i === j ? Infinity : getDist(clusters[i].value, clusters[j].value); + } else { + dist = i === j ? Infinity : getDist(clusters[i].value[0], clusters[j].value[0]); + } + + dists[i][j] = dist; + dists[j][i] = dist; + + if (dist < dists[i][mins[i]]) { + mins[i] = j; // Cache mins: closest cluster to cluster i is cluster j + } + } + } // Find the closest pair of clusters and merge them into a single cluster. + // Update distances between new cluster and each of the old clusters, and loop until threshold reached. + + + var merged = mergeClosest(clusters, index, dists, mins, opts); + + while (merged) { + merged = mergeClosest(clusters, index, dists, mins, opts); + } + + var retClusters; // Dendrogram mode builds the hierarchy and adds intermediary nodes + edges + // in addition to returning the clusters. + + if (opts.mode === 'dendrogram') { + retClusters = buildClustersFromTree(clusters[0], opts.dendrogramDepth, cy); + if (opts.addDendrogram) buildDendrogram(clusters[0], cy); + } else { + // Regular mode simply returns the clusters + retClusters = new Array(clusters.length); + clusters.forEach(function (cluster, i) { + // Clean up meta data used for clustering + cluster.key = cluster.index = null; + retClusters[i] = cy.collection(cluster.value); + }); + } + + return retClusters; + }; + + var hierarchicalClustering$1 = { + hierarchicalClustering: hierarchicalClustering, + hca: hierarchicalClustering + }; + + // Implemented by Zoe Xi @zoexi for GSOC 2016 + var defaults$9 = defaults$g({ + distance: 'euclidean', + // distance metric to compare attributes between two nodes + preference: 'median', + // suitability of a data point to serve as an exemplar + damping: 0.8, + // damping factor between [0.5, 1) + maxIterations: 1000, + // max number of iterations to run + minIterations: 100, + // min number of iterations to run in order for clustering to stop + attributes: [// functions to quantify the similarity between any two points + // e.g. node => node.data('weight') + ] + }); + + var setOptions = function setOptions(options) { + var dmp = options.damping; + var pref = options.preference; + + if (!(0.5 <= dmp && dmp < 1)) { + error("Damping must range on [0.5, 1). Got: ".concat(dmp)); + } + + var validPrefs = ['median', 'mean', 'min', 'max']; + + if (!(validPrefs.some(function (v) { + return v === pref; + }) || number$1(pref))) { + error("Preference must be one of [".concat(validPrefs.map(function (p) { + return "'".concat(p, "'"); + }).join(', '), "] or a number. Got: ").concat(pref)); + } + + return defaults$9(options); + }; + /* eslint-enable */ + + + var getSimilarity = function getSimilarity(type, n1, n2, attributes) { + var attr = function attr(n, i) { + return attributes[i](n); + }; // nb negative because similarity should have an inverse relationship to distance + + + return -clusteringDistance(type, attributes.length, function (i) { + return attr(n1, i); + }, function (i) { + return attr(n2, i); + }, n1, n2); + }; + + var getPreference = function getPreference(S, preference) { + // larger preference = greater # of clusters + var p = null; + + if (preference === 'median') { + p = median(S); + } else if (preference === 'mean') { + p = mean(S); + } else if (preference === 'min') { + p = min(S); + } else if (preference === 'max') { + p = max(S); + } else { + // Custom preference number, as set by user + p = preference; + } + + return p; + }; + + var findExemplars = function findExemplars(n, R, A) { + var indices = []; + + for (var i = 0; i < n; i++) { + if (R[i * n + i] + A[i * n + i] > 0) { + indices.push(i); + } + } + + return indices; + }; + + var assignClusters = function assignClusters(n, S, exemplars) { + var clusters = []; + + for (var i = 0; i < n; i++) { + var index = -1; + var max = -Infinity; + + for (var ei = 0; ei < exemplars.length; ei++) { + var e = exemplars[ei]; + + if (S[i * n + e] > max) { + index = e; + max = S[i * n + e]; + } + } + + if (index > 0) { + clusters.push(index); + } + } + + for (var _ei = 0; _ei < exemplars.length; _ei++) { + clusters[exemplars[_ei]] = exemplars[_ei]; + } + + return clusters; + }; + + var assign = function assign(n, S, exemplars) { + var clusters = assignClusters(n, S, exemplars); + + for (var ei = 0; ei < exemplars.length; ei++) { + var ii = []; + + for (var c = 0; c < clusters.length; c++) { + if (clusters[c] === exemplars[ei]) { + ii.push(c); + } + } + + var maxI = -1; + var maxSum = -Infinity; + + for (var i = 0; i < ii.length; i++) { + var sum = 0; + + for (var j = 0; j < ii.length; j++) { + sum += S[ii[j] * n + ii[i]]; + } + + if (sum > maxSum) { + maxI = i; + maxSum = sum; + } + } + + exemplars[ei] = ii[maxI]; + } + + clusters = assignClusters(n, S, exemplars); + return clusters; + }; + + var affinityPropagation = function affinityPropagation(options) { + var cy = this.cy(); + var nodes = this.nodes(); + var opts = setOptions(options); // Map each node to its position in node array + + var id2position = {}; + + for (var i = 0; i < nodes.length; i++) { + id2position[nodes[i].id()] = i; + } // Begin affinity propagation algorithm + + + var n; // number of data points + + var n2; // size of matrices + + var S; // similarity matrix (1D array) + + var p; // preference/suitability of a data point to serve as an exemplar + + var R; // responsibility matrix (1D array) + + var A; // availability matrix (1D array) + + n = nodes.length; + n2 = n * n; // Initialize and build S similarity matrix + + S = new Array(n2); + + for (var _i = 0; _i < n2; _i++) { + S[_i] = -Infinity; // for cases where two data points shouldn't be linked together + } + + for (var _i2 = 0; _i2 < n; _i2++) { + for (var j = 0; j < n; j++) { + if (_i2 !== j) { + S[_i2 * n + j] = getSimilarity(opts.distance, nodes[_i2], nodes[j], opts.attributes); + } + } + } // Place preferences on the diagonal of S + + + p = getPreference(S, opts.preference); + + for (var _i3 = 0; _i3 < n; _i3++) { + S[_i3 * n + _i3] = p; + } // Initialize R responsibility matrix + + + R = new Array(n2); + + for (var _i4 = 0; _i4 < n2; _i4++) { + R[_i4] = 0.0; + } // Initialize A availability matrix + + + A = new Array(n2); + + for (var _i5 = 0; _i5 < n2; _i5++) { + A[_i5] = 0.0; + } + + var old = new Array(n); + var Rp = new Array(n); + var se = new Array(n); + + for (var _i6 = 0; _i6 < n; _i6++) { + old[_i6] = 0.0; + Rp[_i6] = 0.0; + se[_i6] = 0; + } + + var e = new Array(n * opts.minIterations); + + for (var _i7 = 0; _i7 < e.length; _i7++) { + e[_i7] = 0; + } + + var iter; + + for (iter = 0; iter < opts.maxIterations; iter++) { + // main algorithmic loop + // Update R responsibility matrix + for (var _i8 = 0; _i8 < n; _i8++) { + var max = -Infinity, + max2 = -Infinity, + maxI = -1, + AS = 0.0; + + for (var _j = 0; _j < n; _j++) { + old[_j] = R[_i8 * n + _j]; + AS = A[_i8 * n + _j] + S[_i8 * n + _j]; + + if (AS >= max) { + max2 = max; + max = AS; + maxI = _j; + } else if (AS > max2) { + max2 = AS; + } + } + + for (var _j2 = 0; _j2 < n; _j2++) { + R[_i8 * n + _j2] = (1 - opts.damping) * (S[_i8 * n + _j2] - max) + opts.damping * old[_j2]; + } + + R[_i8 * n + maxI] = (1 - opts.damping) * (S[_i8 * n + maxI] - max2) + opts.damping * old[maxI]; + } // Update A availability matrix + + + for (var _i9 = 0; _i9 < n; _i9++) { + var sum = 0; + + for (var _j3 = 0; _j3 < n; _j3++) { + old[_j3] = A[_j3 * n + _i9]; + Rp[_j3] = Math.max(0, R[_j3 * n + _i9]); + sum += Rp[_j3]; + } + + sum -= Rp[_i9]; + Rp[_i9] = R[_i9 * n + _i9]; + sum += Rp[_i9]; + + for (var _j4 = 0; _j4 < n; _j4++) { + A[_j4 * n + _i9] = (1 - opts.damping) * Math.min(0, sum - Rp[_j4]) + opts.damping * old[_j4]; + } + + A[_i9 * n + _i9] = (1 - opts.damping) * (sum - Rp[_i9]) + opts.damping * old[_i9]; + } // Check for convergence + + + var K = 0; + + for (var _i10 = 0; _i10 < n; _i10++) { + var E = A[_i10 * n + _i10] + R[_i10 * n + _i10] > 0 ? 1 : 0; + e[iter % opts.minIterations * n + _i10] = E; + K += E; + } + + if (K > 0 && (iter >= opts.minIterations - 1 || iter == opts.maxIterations - 1)) { + var _sum = 0; + + for (var _i11 = 0; _i11 < n; _i11++) { + se[_i11] = 0; + + for (var _j5 = 0; _j5 < opts.minIterations; _j5++) { + se[_i11] += e[_j5 * n + _i11]; + } + + if (se[_i11] === 0 || se[_i11] === opts.minIterations) { + _sum++; + } + } + + if (_sum === n) { + // then we have convergence + break; + } + } + } // Identify exemplars (cluster centers) + + + var exemplarsIndices = findExemplars(n, R, A); // Assign nodes to clusters + + var clusterIndices = assign(n, S, exemplarsIndices); + var clusters = {}; + + for (var c = 0; c < exemplarsIndices.length; c++) { + clusters[exemplarsIndices[c]] = []; + } + + for (var _i12 = 0; _i12 < nodes.length; _i12++) { + var pos = id2position[nodes[_i12].id()]; + + var clusterIndex = clusterIndices[pos]; + + if (clusterIndex != null) { + // the node may have not been assigned a cluster if no valid attributes were specified + clusters[clusterIndex].push(nodes[_i12]); + } + } + + var retClusters = new Array(exemplarsIndices.length); + + for (var _c = 0; _c < exemplarsIndices.length; _c++) { + retClusters[_c] = cy.collection(clusters[exemplarsIndices[_c]]); + } + + return retClusters; + }; + + var affinityPropagation$1 = { + affinityPropagation: affinityPropagation, + ap: affinityPropagation + }; + + var hierholzerDefaults = defaults$g({ + root: undefined, + directed: false + }); + var elesfn$k = { + hierholzer: function hierholzer(options) { + if (!plainObject(options)) { + var args = arguments; + options = { + root: args[0], + directed: args[1] + }; + } + + var _hierholzerDefaults = hierholzerDefaults(options), + root = _hierholzerDefaults.root, + directed = _hierholzerDefaults.directed; + + var eles = this; + var dflag = false; + var oddIn; + var oddOut; + var startVertex; + if (root) startVertex = string(root) ? this.filter(root)[0].id() : root[0].id(); + var nodes = {}; + var edges = {}; + + if (directed) { + eles.forEach(function (ele) { + var id = ele.id(); + + if (ele.isNode()) { + var ind = ele.indegree(true); + var outd = ele.outdegree(true); + var d1 = ind - outd; + var d2 = outd - ind; + + if (d1 == 1) { + if (oddIn) dflag = true;else oddIn = id; + } else if (d2 == 1) { + if (oddOut) dflag = true;else oddOut = id; + } else if (d2 > 1 || d1 > 1) { + dflag = true; + } + + nodes[id] = []; + ele.outgoers().forEach(function (e) { + if (e.isEdge()) nodes[id].push(e.id()); + }); + } else { + edges[id] = [undefined, ele.target().id()]; + } + }); + } else { + eles.forEach(function (ele) { + var id = ele.id(); + + if (ele.isNode()) { + var d = ele.degree(true); + + if (d % 2) { + if (!oddIn) oddIn = id;else if (!oddOut) oddOut = id;else dflag = true; + } + + nodes[id] = []; + ele.connectedEdges().forEach(function (e) { + return nodes[id].push(e.id()); + }); + } else { + edges[id] = [ele.source().id(), ele.target().id()]; + } + }); + } + + var result = { + found: false, + trail: undefined + }; + if (dflag) return result;else if (oddOut && oddIn) { + if (directed) { + if (startVertex && oddOut != startVertex) { + return result; + } + + startVertex = oddOut; + } else { + if (startVertex && oddOut != startVertex && oddIn != startVertex) { + return result; + } else if (!startVertex) { + startVertex = oddOut; + } + } + } else { + if (!startVertex) startVertex = eles[0].id(); + } + + var walk = function walk(v) { + var currentNode = v; + var subtour = [v]; + var adj, adjTail, adjHead; + + while (nodes[currentNode].length) { + adj = nodes[currentNode].shift(); + adjTail = edges[adj][0]; + adjHead = edges[adj][1]; + + if (currentNode != adjHead) { + nodes[adjHead] = nodes[adjHead].filter(function (e) { + return e != adj; + }); + currentNode = adjHead; + } else if (!directed && currentNode != adjTail) { + nodes[adjTail] = nodes[adjTail].filter(function (e) { + return e != adj; + }); + currentNode = adjTail; + } + + subtour.unshift(adj); + subtour.unshift(currentNode); + } + + return subtour; + }; + + var trail = []; + var subtour = []; + subtour = walk(startVertex); + + while (subtour.length != 1) { + if (nodes[subtour[0]].length == 0) { + trail.unshift(eles.getElementById(subtour.shift())); + trail.unshift(eles.getElementById(subtour.shift())); + } else { + subtour = walk(subtour.shift()).concat(subtour); + } + } + + trail.unshift(eles.getElementById(subtour.shift())); // final node + + for (var d in nodes) { + if (nodes[d].length) { + return result; + } + } + + result.found = true; + result.trail = this.spawn(trail, true); + return result; + } + }; + + var hopcroftTarjanBiconnected = function hopcroftTarjanBiconnected() { + var eles = this; + var nodes = {}; + var id = 0; + var edgeCount = 0; + var components = []; + var stack = []; + var visitedEdges = {}; + + var buildComponent = function buildComponent(x, y) { + var i = stack.length - 1; + var cutset = []; + var component = eles.spawn(); + + while (stack[i].x != x || stack[i].y != y) { + cutset.push(stack.pop().edge); + i--; + } + + cutset.push(stack.pop().edge); + cutset.forEach(function (edge) { + var connectedNodes = edge.connectedNodes().intersection(eles); + component.merge(edge); + connectedNodes.forEach(function (node) { + var nodeId = node.id(); + var connectedEdges = node.connectedEdges().intersection(eles); + component.merge(node); + + if (!nodes[nodeId].cutVertex) { + component.merge(connectedEdges); + } else { + component.merge(connectedEdges.filter(function (edge) { + return edge.isLoop(); + })); + } + }); + }); + components.push(component); + }; + + var biconnectedSearch = function biconnectedSearch(root, currentNode, parent) { + if (root === parent) edgeCount += 1; + nodes[currentNode] = { + id: id, + low: id++, + cutVertex: false + }; + var edges = eles.getElementById(currentNode).connectedEdges().intersection(eles); + + if (edges.size() === 0) { + components.push(eles.spawn(eles.getElementById(currentNode))); + } else { + var sourceId, targetId, otherNodeId, edgeId; + edges.forEach(function (edge) { + sourceId = edge.source().id(); + targetId = edge.target().id(); + otherNodeId = sourceId === currentNode ? targetId : sourceId; + + if (otherNodeId !== parent) { + edgeId = edge.id(); + + if (!visitedEdges[edgeId]) { + visitedEdges[edgeId] = true; + stack.push({ + x: currentNode, + y: otherNodeId, + edge: edge + }); + } + + if (!(otherNodeId in nodes)) { + biconnectedSearch(root, otherNodeId, currentNode); + nodes[currentNode].low = Math.min(nodes[currentNode].low, nodes[otherNodeId].low); + + if (nodes[currentNode].id <= nodes[otherNodeId].low) { + nodes[currentNode].cutVertex = true; + buildComponent(currentNode, otherNodeId); + } + } else { + nodes[currentNode].low = Math.min(nodes[currentNode].low, nodes[otherNodeId].id); + } + } + }); + } + }; + + eles.forEach(function (ele) { + if (ele.isNode()) { + var nodeId = ele.id(); + + if (!(nodeId in nodes)) { + edgeCount = 0; + biconnectedSearch(nodeId, nodeId); + nodes[nodeId].cutVertex = edgeCount > 1; + } + } + }); + var cutVertices = Object.keys(nodes).filter(function (id) { + return nodes[id].cutVertex; + }).map(function (id) { + return eles.getElementById(id); + }); + return { + cut: eles.spawn(cutVertices), + components: components + }; + }; + + var hopcroftTarjanBiconnected$1 = { + hopcroftTarjanBiconnected: hopcroftTarjanBiconnected, + htbc: hopcroftTarjanBiconnected, + htb: hopcroftTarjanBiconnected, + hopcroftTarjanBiconnectedComponents: hopcroftTarjanBiconnected + }; + + var tarjanStronglyConnected = function tarjanStronglyConnected() { + var eles = this; + var nodes = {}; + var index = 0; + var components = []; + var stack = []; + var cut = eles.spawn(eles); + + var stronglyConnectedSearch = function stronglyConnectedSearch(sourceNodeId) { + stack.push(sourceNodeId); + nodes[sourceNodeId] = { + index: index, + low: index++, + explored: false + }; + var connectedEdges = eles.getElementById(sourceNodeId).connectedEdges().intersection(eles); + connectedEdges.forEach(function (edge) { + var targetNodeId = edge.target().id(); + + if (targetNodeId !== sourceNodeId) { + if (!(targetNodeId in nodes)) { + stronglyConnectedSearch(targetNodeId); + } + + if (!nodes[targetNodeId].explored) { + nodes[sourceNodeId].low = Math.min(nodes[sourceNodeId].low, nodes[targetNodeId].low); + } + } + }); + + if (nodes[sourceNodeId].index === nodes[sourceNodeId].low) { + var componentNodes = eles.spawn(); + + for (;;) { + var nodeId = stack.pop(); + componentNodes.merge(eles.getElementById(nodeId)); + nodes[nodeId].low = nodes[sourceNodeId].index; + nodes[nodeId].explored = true; + + if (nodeId === sourceNodeId) { + break; + } + } + + var componentEdges = componentNodes.edgesWith(componentNodes); + var component = componentNodes.merge(componentEdges); + components.push(component); + cut = cut.difference(component); + } + }; + + eles.forEach(function (ele) { + if (ele.isNode()) { + var nodeId = ele.id(); + + if (!(nodeId in nodes)) { + stronglyConnectedSearch(nodeId); + } + } + }); + return { + cut: cut, + components: components + }; + }; + + var tarjanStronglyConnected$1 = { + tarjanStronglyConnected: tarjanStronglyConnected, + tsc: tarjanStronglyConnected, + tscc: tarjanStronglyConnected, + tarjanStronglyConnectedComponents: tarjanStronglyConnected + }; + + var elesfn$j = {}; + [elesfn$v, elesfn$u, elesfn$t, elesfn$s, elesfn$r, elesfn$q, elesfn$p, elesfn$o, elesfn$n, elesfn$m, elesfn$l, markovClustering$1, kClustering, hierarchicalClustering$1, affinityPropagation$1, elesfn$k, hopcroftTarjanBiconnected$1, tarjanStronglyConnected$1].forEach(function (props) { + extend(elesfn$j, props); + }); + + /*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ + + /* promise states [Promises/A+ 2.1] */ + var STATE_PENDING = 0; + /* [Promises/A+ 2.1.1] */ + + var STATE_FULFILLED = 1; + /* [Promises/A+ 2.1.2] */ + + var STATE_REJECTED = 2; + /* [Promises/A+ 2.1.3] */ + + /* promise object constructor */ + + var api = function api(executor) { + /* optionally support non-constructor/plain-function call */ + if (!(this instanceof api)) return new api(executor); + /* initialize object */ + + this.id = 'Thenable/1.0.7'; + this.state = STATE_PENDING; + /* initial state */ + + this.fulfillValue = undefined; + /* initial value */ + + /* [Promises/A+ 1.3, 2.1.2.2] */ + + this.rejectReason = undefined; + /* initial reason */ + + /* [Promises/A+ 1.5, 2.1.3.2] */ + + this.onFulfilled = []; + /* initial handlers */ + + this.onRejected = []; + /* initial handlers */ + + /* provide optional information-hiding proxy */ + + this.proxy = { + then: this.then.bind(this) + }; + /* support optional executor function */ + + if (typeof executor === 'function') executor.call(this, this.fulfill.bind(this), this.reject.bind(this)); + }; + /* promise API methods */ + + + api.prototype = { + /* promise resolving methods */ + fulfill: function fulfill(value) { + return deliver(this, STATE_FULFILLED, 'fulfillValue', value); + }, + reject: function reject(value) { + return deliver(this, STATE_REJECTED, 'rejectReason', value); + }, + + /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */ + then: function then(onFulfilled, onRejected) { + var curr = this; + var next = new api(); + /* [Promises/A+ 2.2.7] */ + + curr.onFulfilled.push(resolver(onFulfilled, next, 'fulfill')); + /* [Promises/A+ 2.2.2/2.2.6] */ + + curr.onRejected.push(resolver(onRejected, next, 'reject')); + /* [Promises/A+ 2.2.3/2.2.6] */ + + execute(curr); + return next.proxy; + /* [Promises/A+ 2.2.7, 3.3] */ + } + }; + /* deliver an action */ + + var deliver = function deliver(curr, state, name, value) { + if (curr.state === STATE_PENDING) { + curr.state = state; + /* [Promises/A+ 2.1.2.1, 2.1.3.1] */ + + curr[name] = value; + /* [Promises/A+ 2.1.2.2, 2.1.3.2] */ + + execute(curr); + } + + return curr; + }; + /* execute all handlers */ + + + var execute = function execute(curr) { + if (curr.state === STATE_FULFILLED) execute_handlers(curr, 'onFulfilled', curr.fulfillValue);else if (curr.state === STATE_REJECTED) execute_handlers(curr, 'onRejected', curr.rejectReason); + }; + /* execute particular set of handlers */ + + + var execute_handlers = function execute_handlers(curr, name, value) { + /* global setImmediate: true */ + + /* global setTimeout: true */ + + /* short-circuit processing */ + if (curr[name].length === 0) return; + /* iterate over all handlers, exactly once */ + + var handlers = curr[name]; + curr[name] = []; + /* [Promises/A+ 2.2.2.3, 2.2.3.3] */ + + var func = function func() { + for (var i = 0; i < handlers.length; i++) { + handlers[i](value); + } + /* [Promises/A+ 2.2.5] */ + + }; + /* execute procedure asynchronously */ + + /* [Promises/A+ 2.2.4, 3.1] */ + + + if (typeof setImmediate === 'function') setImmediate(func);else setTimeout(func, 0); + }; + /* generate a resolver function */ + + + var resolver = function resolver(cb, next, method) { + return function (value) { + if (typeof cb !== 'function') + /* [Promises/A+ 2.2.1, 2.2.7.3, 2.2.7.4] */ + next[method].call(next, value); + /* [Promises/A+ 2.2.7.3, 2.2.7.4] */ + else { + var result; + + try { + result = cb(value); + } + /* [Promises/A+ 2.2.2.1, 2.2.3.1, 2.2.5, 3.2] */ + catch (e) { + next.reject(e); + /* [Promises/A+ 2.2.7.2] */ + + return; + } + + resolve(next, result); + /* [Promises/A+ 2.2.7.1] */ + } + }; + }; + /* "Promise Resolution Procedure" */ + + /* [Promises/A+ 2.3] */ + + + var resolve = function resolve(promise, x) { + /* sanity check arguments */ + + /* [Promises/A+ 2.3.1] */ + if (promise === x || promise.proxy === x) { + promise.reject(new TypeError('cannot resolve promise with itself')); + return; + } + /* surgically check for a "then" method + (mainly to just call the "getter" of "then" only once) */ + + + var then; + + if (_typeof(x) === 'object' && x !== null || typeof x === 'function') { + try { + then = x.then; + } + /* [Promises/A+ 2.3.3.1, 3.5] */ + catch (e) { + promise.reject(e); + /* [Promises/A+ 2.3.3.2] */ + + return; + } + } + /* handle own Thenables [Promises/A+ 2.3.2] + and similar "thenables" [Promises/A+ 2.3.3] */ + + + if (typeof then === 'function') { + var resolved = false; + + try { + /* call retrieved "then" method */ + + /* [Promises/A+ 2.3.3.3] */ + then.call(x, + /* resolvePromise */ + + /* [Promises/A+ 2.3.3.3.1] */ + function (y) { + if (resolved) return; + resolved = true; + /* [Promises/A+ 2.3.3.3.3] */ + + if (y === x) + /* [Promises/A+ 3.6] */ + promise.reject(new TypeError('circular thenable chain'));else resolve(promise, y); + }, + /* rejectPromise */ + + /* [Promises/A+ 2.3.3.3.2] */ + function (r) { + if (resolved) return; + resolved = true; + /* [Promises/A+ 2.3.3.3.3] */ + + promise.reject(r); + }); + } catch (e) { + if (!resolved) + /* [Promises/A+ 2.3.3.3.3] */ + promise.reject(e); + /* [Promises/A+ 2.3.3.3.4] */ + } + + return; + } + /* handle other values */ + + + promise.fulfill(x); + /* [Promises/A+ 2.3.4, 2.3.3.4] */ + }; // so we always have Promise.all() + + + api.all = function (ps) { + return new api(function (resolveAll, rejectAll) { + var vals = new Array(ps.length); + var doneCount = 0; + + var fulfill = function fulfill(i, val) { + vals[i] = val; + doneCount++; + + if (doneCount === ps.length) { + resolveAll(vals); + } + }; + + for (var i = 0; i < ps.length; i++) { + (function (i) { + var p = ps[i]; + var isPromise = p != null && p.then != null; + + if (isPromise) { + p.then(function (val) { + fulfill(i, val); + }, function (err) { + rejectAll(err); + }); + } else { + var val = p; + fulfill(i, val); + } + })(i); + } + }); + }; + + api.resolve = function (val) { + return new api(function (resolve, reject) { + resolve(val); + }); + }; + + api.reject = function (val) { + return new api(function (resolve, reject) { + reject(val); + }); + }; + + var Promise$1 = typeof Promise !== 'undefined' ? Promise : api; // eslint-disable-line no-undef + + var Animation = function Animation(target, opts, opts2) { + var isCore = core(target); + var isEle = !isCore; + + var _p = this._private = extend({ + duration: 1000 + }, opts, opts2); + + _p.target = target; + _p.style = _p.style || _p.css; + _p.started = false; + _p.playing = false; + _p.hooked = false; + _p.applying = false; + _p.progress = 0; + _p.completes = []; + _p.frames = []; + + if (_p.complete && fn$6(_p.complete)) { + _p.completes.push(_p.complete); + } + + if (isEle) { + var pos = target.position(); + _p.startPosition = _p.startPosition || { + x: pos.x, + y: pos.y + }; + _p.startStyle = _p.startStyle || target.cy().style().getAnimationStartStyle(target, _p.style); + } + + if (isCore) { + var pan = target.pan(); + _p.startPan = { + x: pan.x, + y: pan.y + }; + _p.startZoom = target.zoom(); + } // for future timeline/animations impl + + + this.length = 1; + this[0] = this; + }; + + var anifn = Animation.prototype; + extend(anifn, { + instanceString: function instanceString() { + return 'animation'; + }, + hook: function hook() { + var _p = this._private; + + if (!_p.hooked) { + // add to target's animation queue + var q; + var tAni = _p.target._private.animation; + + if (_p.queue) { + q = tAni.queue; + } else { + q = tAni.current; + } + + q.push(this); // add to the animation loop pool + + if (elementOrCollection(_p.target)) { + _p.target.cy().addToAnimationPool(_p.target); + } + + _p.hooked = true; + } + + return this; + }, + play: function play() { + var _p = this._private; // autorewind + + if (_p.progress === 1) { + _p.progress = 0; + } + + _p.playing = true; + _p.started = false; // needs to be started by animation loop + + _p.stopped = false; + this.hook(); // the animation loop will start the animation... + + return this; + }, + playing: function playing() { + return this._private.playing; + }, + apply: function apply() { + var _p = this._private; + _p.applying = true; + _p.started = false; // needs to be started by animation loop + + _p.stopped = false; + this.hook(); // the animation loop will apply the animation at this progress + + return this; + }, + applying: function applying() { + return this._private.applying; + }, + pause: function pause() { + var _p = this._private; + _p.playing = false; + _p.started = false; + return this; + }, + stop: function stop() { + var _p = this._private; + _p.playing = false; + _p.started = false; + _p.stopped = true; // to be removed from animation queues + + return this; + }, + rewind: function rewind() { + return this.progress(0); + }, + fastforward: function fastforward() { + return this.progress(1); + }, + time: function time(t) { + var _p = this._private; + + if (t === undefined) { + return _p.progress * _p.duration; + } else { + return this.progress(t / _p.duration); + } + }, + progress: function progress(p) { + var _p = this._private; + var wasPlaying = _p.playing; + + if (p === undefined) { + return _p.progress; + } else { + if (wasPlaying) { + this.pause(); + } + + _p.progress = p; + _p.started = false; + + if (wasPlaying) { + this.play(); + } + } + + return this; + }, + completed: function completed() { + return this._private.progress === 1; + }, + reverse: function reverse() { + var _p = this._private; + var wasPlaying = _p.playing; + + if (wasPlaying) { + this.pause(); + } + + _p.progress = 1 - _p.progress; + _p.started = false; + + var swap = function swap(a, b) { + var _pa = _p[a]; + + if (_pa == null) { + return; + } + + _p[a] = _p[b]; + _p[b] = _pa; + }; + + swap('zoom', 'startZoom'); + swap('pan', 'startPan'); + swap('position', 'startPosition'); // swap styles + + if (_p.style) { + for (var i = 0; i < _p.style.length; i++) { + var prop = _p.style[i]; + var name = prop.name; + var startStyleProp = _p.startStyle[name]; + _p.startStyle[name] = prop; + _p.style[i] = startStyleProp; + } + } + + if (wasPlaying) { + this.play(); + } + + return this; + }, + promise: function promise(type) { + var _p = this._private; + var arr; + + switch (type) { + case 'frame': + arr = _p.frames; + break; + + default: + case 'complete': + case 'completed': + arr = _p.completes; + } + + return new Promise$1(function (resolve, reject) { + arr.push(function () { + resolve(); + }); + }); + } + }); + anifn.complete = anifn.completed; + anifn.run = anifn.play; + anifn.running = anifn.playing; + + var define$3 = { + animated: function animated() { + return function animatedImpl() { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return false; + } + + var ele = all[0]; + + if (ele) { + return ele._private.animation.current.length > 0; + } + }; + }, + // animated + clearQueue: function clearQueue() { + return function clearQueueImpl() { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + for (var i = 0; i < all.length; i++) { + var ele = all[i]; + ele._private.animation.queue = []; + } + + return this; + }; + }, + // clearQueue + delay: function delay() { + return function delayImpl(time, complete) { + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + return this.animate({ + delay: time, + duration: time, + complete: complete + }); + }; + }, + // delay + delayAnimation: function delayAnimation() { + return function delayAnimationImpl(time, complete) { + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + return this.animation({ + delay: time, + duration: time, + complete: complete + }); + }; + }, + // delay + animation: function animation() { + return function animationImpl(properties, params) { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + var isCore = !selfIsArrayLike; + var isEles = !isCore; + + if (!cy.styleEnabled()) { + return this; + } + + var style = cy.style(); + properties = extend({}, properties, params); + var propertiesEmpty = Object.keys(properties).length === 0; + + if (propertiesEmpty) { + return new Animation(all[0], properties); // nothing to animate + } + + if (properties.duration === undefined) { + properties.duration = 400; + } + + switch (properties.duration) { + case 'slow': + properties.duration = 600; + break; + + case 'fast': + properties.duration = 200; + break; + } + + if (isEles) { + properties.style = style.getPropsList(properties.style || properties.css); + properties.css = undefined; + } + + if (isEles && properties.renderedPosition != null) { + var rpos = properties.renderedPosition; + var pan = cy.pan(); + var zoom = cy.zoom(); + properties.position = renderedToModelPosition(rpos, zoom, pan); + } // override pan w/ panBy if set + + + if (isCore && properties.panBy != null) { + var panBy = properties.panBy; + var cyPan = cy.pan(); + properties.pan = { + x: cyPan.x + panBy.x, + y: cyPan.y + panBy.y + }; + } // override pan w/ center if set + + + var center = properties.center || properties.centre; + + if (isCore && center != null) { + var centerPan = cy.getCenterPan(center.eles, properties.zoom); + + if (centerPan != null) { + properties.pan = centerPan; + } + } // override pan & zoom w/ fit if set + + + if (isCore && properties.fit != null) { + var fit = properties.fit; + var fitVp = cy.getFitViewport(fit.eles || fit.boundingBox, fit.padding); + + if (fitVp != null) { + properties.pan = fitVp.pan; + properties.zoom = fitVp.zoom; + } + } // override zoom (& potentially pan) w/ zoom obj if set + + + if (isCore && plainObject(properties.zoom)) { + var vp = cy.getZoomedViewport(properties.zoom); + + if (vp != null) { + if (vp.zoomed) { + properties.zoom = vp.zoom; + } + + if (vp.panned) { + properties.pan = vp.pan; + } + } else { + properties.zoom = null; // an inavalid zoom (e.g. no delta) gets automatically destroyed + } + } + + return new Animation(all[0], properties); + }; + }, + // animate + animate: function animate() { + return function animateImpl(properties, params) { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + if (params) { + properties = extend({}, properties, params); + } // manually hook and run the animation + + + for (var i = 0; i < all.length; i++) { + var ele = all[i]; + var queue = ele.animated() && (properties.queue === undefined || properties.queue); + var ani = ele.animation(properties, queue ? { + queue: true + } : undefined); + ani.play(); + } + + return this; // chaining + }; + }, + // animate + stop: function stop() { + return function stopImpl(clearQueue, jumpToEnd) { + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var cy = this._private.cy || this; + + if (!cy.styleEnabled()) { + return this; + } + + for (var i = 0; i < all.length; i++) { + var ele = all[i]; + var _p = ele._private; + var anis = _p.animation.current; + + for (var j = 0; j < anis.length; j++) { + var ani = anis[j]; + var ani_p = ani._private; + + if (jumpToEnd) { + // next iteration of the animation loop, the animation + // will go straight to the end and be removed + ani_p.duration = 0; + } + } // clear the queue of future animations + + + if (clearQueue) { + _p.animation.queue = []; + } + + if (!jumpToEnd) { + _p.animation.current = []; + } + } // we have to notify (the animation loop doesn't do it for us on `stop`) + + + cy.notify('draw'); + return this; + }; + } // stop + + }; // define + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + var isArray_1 = isArray; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray_1(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol_1(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + var _isKey = isKey; + + /** `Object#toString` result references. */ + var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject_1(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = _baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + var isFunction_1 = isFunction; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = _root['__core-js_shared__']; + + var _coreJsData = coreJsData; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + var _isMasked = isMasked; + + /** Used for built-in method references. */ + var funcProto$1 = Function.prototype; + + /** Used to resolve the decompiled source of functions. */ + var funcToString$1 = funcProto$1.toString; + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString$1.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + var _toSource = toSource; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used for built-in method references. */ + var funcProto = Function.prototype, + objectProto$3 = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty$3 = objectProto$3.hasOwnProperty; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty$3).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject_1(value) || _isMasked(value)) { + return false; + } + var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor; + return pattern.test(_toSource(value)); + } + + var _baseIsNative = baseIsNative; + + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue$1(object, key) { + return object == null ? undefined : object[key]; + } + + var _getValue = getValue$1; + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = _getValue(object, key); + return _baseIsNative(value) ? value : undefined; + } + + var _getNative = getNative; + + /* Built-in method references that are verified to be native. */ + var nativeCreate = _getNative(Object, 'create'); + + var _nativeCreate = nativeCreate; + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = _nativeCreate ? _nativeCreate(null) : {}; + this.size = 0; + } + + var _hashClear = hashClear; + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + var _hashDelete = hashDelete; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; + + /** Used for built-in method references. */ + var objectProto$2 = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty$2 = objectProto$2.hasOwnProperty; + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (_nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED$1 ? undefined : result; + } + return hasOwnProperty$2.call(data, key) ? data[key] : undefined; + } + + var _hashGet = hashGet; + + /** Used for built-in method references. */ + var objectProto$1 = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty$1 = objectProto$1.hasOwnProperty; + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$1.call(data, key); + } + + var _hashHas = hashHas; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; + } + + var _hashSet = hashSet; + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + // Add methods to `Hash`. + Hash.prototype.clear = _hashClear; + Hash.prototype['delete'] = _hashDelete; + Hash.prototype.get = _hashGet; + Hash.prototype.has = _hashHas; + Hash.prototype.set = _hashSet; + + var _Hash = Hash; + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + var _listCacheClear = listCacheClear; + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || (value !== value && other !== other); + } + + var eq_1 = eq; + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq_1(array[length][0], key)) { + return length; + } + } + return -1; + } + + var _assocIndexOf = assocIndexOf; + + /** Used for built-in method references. */ + var arrayProto = Array.prototype; + + /** Built-in value references. */ + var splice = arrayProto.splice; + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = _assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + var _listCacheDelete = listCacheDelete; + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = _assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; + } + + var _listCacheGet = listCacheGet; + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return _assocIndexOf(this.__data__, key) > -1; + } + + var _listCacheHas = listCacheHas; + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = _assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + var _listCacheSet = listCacheSet; + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = _listCacheClear; + ListCache.prototype['delete'] = _listCacheDelete; + ListCache.prototype.get = _listCacheGet; + ListCache.prototype.has = _listCacheHas; + ListCache.prototype.set = _listCacheSet; + + var _ListCache = ListCache; + + /* Built-in method references that are verified to be native. */ + var Map$1 = _getNative(_root, 'Map'); + + var _Map = Map$1; + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new _Hash, + 'map': new (_Map || _ListCache), + 'string': new _Hash + }; + } + + var _mapCacheClear = mapCacheClear; + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); + } + + var _isKeyable = isKeyable; + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return _isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; + } + + var _getMapData = getMapData; + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = _getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + var _mapCacheDelete = mapCacheDelete; + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return _getMapData(this, key).get(key); + } + + var _mapCacheGet = mapCacheGet; + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return _getMapData(this, key).has(key); + } + + var _mapCacheHas = mapCacheHas; + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = _getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + var _mapCacheSet = mapCacheSet; + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = _mapCacheClear; + MapCache.prototype['delete'] = _mapCacheDelete; + MapCache.prototype.get = _mapCacheGet; + MapCache.prototype.has = _mapCacheHas; + MapCache.prototype.set = _mapCacheSet; + + var _MapCache = MapCache; + + /** Error message constants. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || _MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = _MapCache; + + var memoize_1 = memoize; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize_1(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + var _memoizeCapped = memoizeCapped; + + /** Used to match property names within property paths. */ + var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = _memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + var _stringToPath = stringToPath; + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + var _arrayMap = arrayMap; + + /** Used as references for various `Number` constants. */ + var INFINITY$1 = 1 / 0; + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray_1(value)) { + // Recursively convert values (susceptible to call stack limits). + return _arrayMap(value, baseToString) + ''; + } + if (isSymbol_1(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result; + } + + var _baseToString = baseToString; + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString$1(value) { + return value == null ? '' : _baseToString(value); + } + + var toString_1 = toString$1; + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray_1(value)) { + return value; + } + return _isKey(value, object) ? [value] : _stringToPath(toString_1(value)); + } + + var _castPath = castPath; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0; + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol_1(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + var _toKey = toKey; + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = _castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[_toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; + } + + var _baseGet = baseGet; + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : _baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + var get_1 = get; + + var defineProperty = (function() { + try { + var func = _getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + var _defineProperty = defineProperty; + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && _defineProperty) { + _defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + var _baseAssignValue = baseAssignValue; + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq_1(objValue, value)) || + (value === undefined && !(key in object))) { + _baseAssignValue(object, key, value); + } + } + + var _assignValue = assignValue; + + /** Used as references for various `Number` constants. */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + var _isIndex = isIndex; + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject_1(object)) { + return object; + } + path = _castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = _toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject_1(objValue) + ? objValue + : (_isIndex(path[index + 1]) ? [] : {}); + } + } + _assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + var _baseSet = baseSet; + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : _baseSet(object, path, value); + } + + var set_1 = set; + + /** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ + function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + var _copyArray = copyArray; + + /** + * Converts `value` to a property path array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Util + * @param {*} value The value to convert. + * @returns {Array} Returns the new property path array. + * @example + * + * _.toPath('a.b.c'); + * // => ['a', 'b', 'c'] + * + * _.toPath('a[0].b.c'); + * // => ['a', '0', 'b', 'c'] + */ + function toPath(value) { + if (isArray_1(value)) { + return _arrayMap(value, _toKey); + } + return isSymbol_1(value) ? [value] : _copyArray(_stringToPath(toString_1(value))); + } + + var toPath_1 = toPath; + + var define$2 = { + // access data field + data: function data(params) { + var defaults = { + field: 'data', + bindingEvent: 'data', + allowBinding: false, + allowSetting: false, + allowGetting: false, + settingEvent: 'data', + settingTriggersEvent: false, + triggerFnName: 'trigger', + immutableKeys: {}, + // key => true if immutable + updateStyle: false, + beforeGet: function beforeGet(self) {}, + beforeSet: function beforeSet(self, obj) {}, + onSet: function onSet(self) {}, + canSet: function canSet(self) { + return true; + } + }; + params = extend({}, defaults, params); + return function dataImpl(name, value) { + var p = params; + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + + var single = selfIsArrayLike ? self[0] : self; // .data('foo', ...) + + if (string(name)) { + // set or get property + var isPathLike = name.indexOf('.') !== -1; // there might be a normal field with a dot + + var path = isPathLike && toPath_1(name); // .data('foo') + + if (p.allowGetting && value === undefined) { + // get + var ret; + + if (single) { + p.beforeGet(single); // check if it's path and a field with the same name doesn't exist + + if (path && single._private[p.field][name] === undefined) { + ret = get_1(single._private[p.field], path); + } else { + ret = single._private[p.field][name]; + } + } + + return ret; // .data('foo', 'bar') + } else if (p.allowSetting && value !== undefined) { + // set + var valid = !p.immutableKeys[name]; + + if (valid) { + var change = _defineProperty$1({}, name, value); + + p.beforeSet(self, change); + + for (var i = 0, l = all.length; i < l; i++) { + var ele = all[i]; + + if (p.canSet(ele)) { + if (path && single._private[p.field][name] === undefined) { + set_1(ele._private[p.field], path, value); + } else { + ele._private[p.field][name] = value; + } + } + } // update mappers if asked + + + if (p.updateStyle) { + self.updateStyle(); + } // call onSet callback + + + p.onSet(self); + + if (p.settingTriggersEvent) { + self[p.triggerFnName](p.settingEvent); + } + } + } // .data({ 'foo': 'bar' }) + + } else if (p.allowSetting && plainObject(name)) { + // extend + var obj = name; + var k, v; + var keys = Object.keys(obj); + p.beforeSet(self, obj); + + for (var _i = 0; _i < keys.length; _i++) { + k = keys[_i]; + v = obj[k]; + + var _valid = !p.immutableKeys[k]; + + if (_valid) { + for (var j = 0; j < all.length; j++) { + var _ele = all[j]; + + if (p.canSet(_ele)) { + _ele._private[p.field][k] = v; + } + } + } + } // update mappers if asked + + + if (p.updateStyle) { + self.updateStyle(); + } // call onSet callback + + + p.onSet(self); + + if (p.settingTriggersEvent) { + self[p.triggerFnName](p.settingEvent); + } // .data(function(){ ... }) + + } else if (p.allowBinding && fn$6(name)) { + // bind to event + var fn = name; + self.on(p.bindingEvent, fn); // .data() + } else if (p.allowGetting && name === undefined) { + // get whole object + var _ret; + + if (single) { + p.beforeGet(single); + _ret = single._private[p.field]; + } + + return _ret; + } + + return self; // maintain chainability + }; // function + }, + // data + // remove data field + removeData: function removeData(params) { + var defaults = { + field: 'data', + event: 'data', + triggerFnName: 'trigger', + triggerEvent: false, + immutableKeys: {} // key => true if immutable + + }; + params = extend({}, defaults, params); + return function removeDataImpl(names) { + var p = params; + var self = this; + var selfIsArrayLike = self.length !== undefined; + var all = selfIsArrayLike ? self : [self]; // put in array if not array-like + // .removeData('foo bar') + + if (string(names)) { + // then get the list of keys, and delete them + var keys = names.split(/\s+/); + var l = keys.length; + + for (var i = 0; i < l; i++) { + // delete each non-empty key + var key = keys[i]; + + if (emptyString(key)) { + continue; + } + + var valid = !p.immutableKeys[key]; // not valid if immutable + + if (valid) { + for (var i_a = 0, l_a = all.length; i_a < l_a; i_a++) { + all[i_a]._private[p.field][key] = undefined; + } + } + } + + if (p.triggerEvent) { + self[p.triggerFnName](p.event); + } // .removeData() + + } else if (names === undefined) { + // then delete all keys + for (var _i_a = 0, _l_a = all.length; _i_a < _l_a; _i_a++) { + var _privateFields = all[_i_a]._private[p.field]; + + var _keys = Object.keys(_privateFields); + + for (var _i2 = 0; _i2 < _keys.length; _i2++) { + var _key = _keys[_i2]; + var validKeyToDelete = !p.immutableKeys[_key]; + + if (validKeyToDelete) { + _privateFields[_key] = undefined; + } + } + } + + if (p.triggerEvent) { + self[p.triggerFnName](p.event); + } + } + + return self; // maintain chaining + }; // function + } // removeData + + }; // define + + var define$1 = { + eventAliasesOn: function eventAliasesOn(proto) { + var p = proto; + p.addListener = p.listen = p.bind = p.on; + p.unlisten = p.unbind = p.off = p.removeListener; + p.trigger = p.emit; // this is just a wrapper alias of .on() + + p.pon = p.promiseOn = function (events, selector) { + var self = this; + var args = Array.prototype.slice.call(arguments, 0); + return new Promise$1(function (resolve, reject) { + var callback = function callback(e) { + self.off.apply(self, offArgs); + resolve(e); + }; + + var onArgs = args.concat([callback]); + var offArgs = onArgs.concat([]); + self.on.apply(self, onArgs); + }); + }; + } + }; // define + + // use this module to cherry pick functions into your prototype + var define = {}; + [define$3, define$2, define$1].forEach(function (m) { + extend(define, m); + }); + + var elesfn$i = { + animate: define.animate(), + animation: define.animation(), + animated: define.animated(), + clearQueue: define.clearQueue(), + delay: define.delay(), + delayAnimation: define.delayAnimation(), + stop: define.stop() + }; + + var elesfn$h = { + classes: function classes(_classes) { + var self = this; + + if (_classes === undefined) { + var ret = []; + + self[0]._private.classes.forEach(function (cls) { + return ret.push(cls); + }); + + return ret; + } else if (!array(_classes)) { + // extract classes from string + _classes = (_classes || '').match(/\S+/g) || []; + } + + var changed = []; + var classesSet = new Set$1(_classes); // check and update each ele + + for (var j = 0; j < self.length; j++) { + var ele = self[j]; + var _p = ele._private; + var eleClasses = _p.classes; + var changedEle = false; // check if ele has all of the passed classes + + for (var i = 0; i < _classes.length; i++) { + var cls = _classes[i]; + var eleHasClass = eleClasses.has(cls); + + if (!eleHasClass) { + changedEle = true; + break; + } + } // check if ele has classes outside of those passed + + + if (!changedEle) { + changedEle = eleClasses.size !== _classes.length; + } + + if (changedEle) { + _p.classes = classesSet; + changed.push(ele); + } + } // trigger update style on those eles that had class changes + + + if (changed.length > 0) { + this.spawn(changed).updateStyle().emit('class'); + } + + return self; + }, + addClass: function addClass(classes) { + return this.toggleClass(classes, true); + }, + hasClass: function hasClass(className) { + var ele = this[0]; + return ele != null && ele._private.classes.has(className); + }, + toggleClass: function toggleClass(classes, toggle) { + if (!array(classes)) { + // extract classes from string + classes = classes.match(/\S+/g) || []; + } + + var self = this; + var toggleUndefd = toggle === undefined; + var changed = []; // eles who had classes changed + + for (var i = 0, il = self.length; i < il; i++) { + var ele = self[i]; + var eleClasses = ele._private.classes; + var changedEle = false; + + for (var j = 0; j < classes.length; j++) { + var cls = classes[j]; + var hasClass = eleClasses.has(cls); + var changedNow = false; + + if (toggle || toggleUndefd && !hasClass) { + eleClasses.add(cls); + changedNow = true; + } else if (!toggle || toggleUndefd && hasClass) { + eleClasses["delete"](cls); + changedNow = true; + } + + if (!changedEle && changedNow) { + changed.push(ele); + changedEle = true; + } + } // for j classes + + } // for i eles + // trigger update style on those eles that had class changes + + + if (changed.length > 0) { + this.spawn(changed).updateStyle().emit('class'); + } + + return self; + }, + removeClass: function removeClass(classes) { + return this.toggleClass(classes, false); + }, + flashClass: function flashClass(classes, duration) { + var self = this; + + if (duration == null) { + duration = 250; + } else if (duration === 0) { + return self; // nothing to do really + } + + self.addClass(classes); + setTimeout(function () { + self.removeClass(classes); + }, duration); + return self; + } + }; + elesfn$h.className = elesfn$h.classNames = elesfn$h.classes; + + var tokens = { + metaChar: '[\\!\\"\\#\\$\\%\\&\\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]', + // chars we need to escape in let names, etc + comparatorOp: '=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=', + // binary comparison op (used in data selectors) + boolOp: '\\?|\\!|\\^', + // boolean (unary) operators (used in data selectors) + string: '"(?:\\\\"|[^"])*"' + '|' + "'(?:\\\\'|[^'])*'", + // string literals (used in data selectors) -- doublequotes | singlequotes + number: number, + // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123 + meta: 'degree|indegree|outdegree', + // allowed metadata fields (i.e. allowed functions to use from Collection) + separator: '\\s*,\\s*', + // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass + descendant: '\\s+', + child: '\\s+>\\s+', + subject: '\\$', + group: 'node|edge|\\*', + directedEdge: '\\s+->\\s+', + undirectedEdge: '\\s+<->\\s+' + }; + tokens.variable = '(?:[\\w-.]|(?:\\\\' + tokens.metaChar + '))+'; // a variable name can have letters, numbers, dashes, and periods + + tokens.className = '(?:[\\w-]|(?:\\\\' + tokens.metaChar + '))+'; // a class name has the same rules as a variable except it can't have a '.' in the name + + tokens.value = tokens.string + '|' + tokens.number; // a value literal, either a string or number + + tokens.id = tokens.variable; // an element id (follows variable conventions) + + (function () { + var ops, op, i; // add @ variants to comparatorOp + + ops = tokens.comparatorOp.split('|'); + + for (i = 0; i < ops.length; i++) { + op = ops[i]; + tokens.comparatorOp += '|@' + op; + } // add ! variants to comparatorOp + + + ops = tokens.comparatorOp.split('|'); + + for (i = 0; i < ops.length; i++) { + op = ops[i]; + + if (op.indexOf('!') >= 0) { + continue; + } // skip ops that explicitly contain ! + + + if (op === '=') { + continue; + } // skip = b/c != is explicitly defined + + + tokens.comparatorOp += '|\\!' + op; + } + })(); + + /** + * Make a new query object + * + * @prop type {Type} The type enum (int) of the query + * @prop checks List of checks to make against an ele to test for a match + */ + var newQuery = function newQuery() { + return { + checks: [] + }; + }; + + /** + * A check type enum-like object. Uses integer values for fast match() lookup. + * The ordering does not matter as long as the ints are unique. + */ + var Type = { + /** E.g. node */ + GROUP: 0, + + /** A collection of elements */ + COLLECTION: 1, + + /** A filter(ele) function */ + FILTER: 2, + + /** E.g. [foo > 1] */ + DATA_COMPARE: 3, + + /** E.g. [foo] */ + DATA_EXIST: 4, + + /** E.g. [?foo] */ + DATA_BOOL: 5, + + /** E.g. [[degree > 2]] */ + META_COMPARE: 6, + + /** E.g. :selected */ + STATE: 7, + + /** E.g. #foo */ + ID: 8, + + /** E.g. .foo */ + CLASS: 9, + + /** E.g. #foo <-> #bar */ + UNDIRECTED_EDGE: 10, + + /** E.g. #foo -> #bar */ + DIRECTED_EDGE: 11, + + /** E.g. $#foo -> #bar */ + NODE_SOURCE: 12, + + /** E.g. #foo -> $#bar */ + NODE_TARGET: 13, + + /** E.g. $#foo <-> #bar */ + NODE_NEIGHBOR: 14, + + /** E.g. #foo > #bar */ + CHILD: 15, + + /** E.g. #foo #bar */ + DESCENDANT: 16, + + /** E.g. $#foo > #bar */ + PARENT: 17, + + /** E.g. $#foo #bar */ + ANCESTOR: 18, + + /** E.g. #foo > $bar > #baz */ + COMPOUND_SPLIT: 19, + + /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */ + TRUE: 20 + }; + + var stateSelectors = [{ + selector: ':selected', + matches: function matches(ele) { + return ele.selected(); + } + }, { + selector: ':unselected', + matches: function matches(ele) { + return !ele.selected(); + } + }, { + selector: ':selectable', + matches: function matches(ele) { + return ele.selectable(); + } + }, { + selector: ':unselectable', + matches: function matches(ele) { + return !ele.selectable(); + } + }, { + selector: ':locked', + matches: function matches(ele) { + return ele.locked(); + } + }, { + selector: ':unlocked', + matches: function matches(ele) { + return !ele.locked(); + } + }, { + selector: ':visible', + matches: function matches(ele) { + return ele.visible(); + } + }, { + selector: ':hidden', + matches: function matches(ele) { + return !ele.visible(); + } + }, { + selector: ':transparent', + matches: function matches(ele) { + return ele.transparent(); + } + }, { + selector: ':grabbed', + matches: function matches(ele) { + return ele.grabbed(); + } + }, { + selector: ':free', + matches: function matches(ele) { + return !ele.grabbed(); + } + }, { + selector: ':removed', + matches: function matches(ele) { + return ele.removed(); + } + }, { + selector: ':inside', + matches: function matches(ele) { + return !ele.removed(); + } + }, { + selector: ':grabbable', + matches: function matches(ele) { + return ele.grabbable(); + } + }, { + selector: ':ungrabbable', + matches: function matches(ele) { + return !ele.grabbable(); + } + }, { + selector: ':animated', + matches: function matches(ele) { + return ele.animated(); + } + }, { + selector: ':unanimated', + matches: function matches(ele) { + return !ele.animated(); + } + }, { + selector: ':parent', + matches: function matches(ele) { + return ele.isParent(); + } + }, { + selector: ':childless', + matches: function matches(ele) { + return ele.isChildless(); + } + }, { + selector: ':child', + matches: function matches(ele) { + return ele.isChild(); + } + }, { + selector: ':orphan', + matches: function matches(ele) { + return ele.isOrphan(); + } + }, { + selector: ':nonorphan', + matches: function matches(ele) { + return ele.isChild(); + } + }, { + selector: ':compound', + matches: function matches(ele) { + if (ele.isNode()) { + return ele.isParent(); + } else { + return ele.source().isParent() || ele.target().isParent(); + } + } + }, { + selector: ':loop', + matches: function matches(ele) { + return ele.isLoop(); + } + }, { + selector: ':simple', + matches: function matches(ele) { + return ele.isSimple(); + } + }, { + selector: ':active', + matches: function matches(ele) { + return ele.active(); + } + }, { + selector: ':inactive', + matches: function matches(ele) { + return !ele.active(); + } + }, { + selector: ':backgrounding', + matches: function matches(ele) { + return ele.backgrounding(); + } + }, { + selector: ':nonbackgrounding', + matches: function matches(ele) { + return !ele.backgrounding(); + } + }].sort(function (a, b) { + // n.b. selectors that are starting substrings of others must have the longer ones first + return descending(a.selector, b.selector); + }); + + var lookup = function () { + var selToFn = {}; + var s; + + for (var i = 0; i < stateSelectors.length; i++) { + s = stateSelectors[i]; + selToFn[s.selector] = s.matches; + } + + return selToFn; + }(); + + var stateSelectorMatches = function stateSelectorMatches(sel, ele) { + return lookup[sel](ele); + }; + var stateSelectorRegex = '(' + stateSelectors.map(function (s) { + return s.selector; + }).join('|') + ')'; + + // so that values get compared properly in Selector.filter() + + var cleanMetaChars = function cleanMetaChars(str) { + return str.replace(new RegExp('\\\\(' + tokens.metaChar + ')', 'g'), function (match, $1) { + return $1; + }); + }; + + var replaceLastQuery = function replaceLastQuery(selector, examiningQuery, replacementQuery) { + selector[selector.length - 1] = replacementQuery; + }; // NOTE: add new expression syntax here to have it recognised by the parser; + // - a query contains all adjacent (i.e. no separator in between) expressions; + // - the current query is stored in selector[i] + // - you need to check the query objects in match() for it actually filter properly, but that's pretty straight forward + + + var exprs = [{ + name: 'group', + // just used for identifying when debugging + query: true, + regex: '(' + tokens.group + ')', + populate: function populate(selector, query, _ref) { + var _ref2 = _slicedToArray(_ref, 1), + group = _ref2[0]; + + query.checks.push({ + type: Type.GROUP, + value: group === '*' ? group : group + 's' + }); + } + }, { + name: 'state', + query: true, + regex: stateSelectorRegex, + populate: function populate(selector, query, _ref3) { + var _ref4 = _slicedToArray(_ref3, 1), + state = _ref4[0]; + + query.checks.push({ + type: Type.STATE, + value: state + }); + } + }, { + name: 'id', + query: true, + regex: '\\#(' + tokens.id + ')', + populate: function populate(selector, query, _ref5) { + var _ref6 = _slicedToArray(_ref5, 1), + id = _ref6[0]; + + query.checks.push({ + type: Type.ID, + value: cleanMetaChars(id) + }); + } + }, { + name: 'className', + query: true, + regex: '\\.(' + tokens.className + ')', + populate: function populate(selector, query, _ref7) { + var _ref8 = _slicedToArray(_ref7, 1), + className = _ref8[0]; + + query.checks.push({ + type: Type.CLASS, + value: cleanMetaChars(className) + }); + } + }, { + name: 'dataExists', + query: true, + regex: '\\[\\s*(' + tokens.variable + ')\\s*\\]', + populate: function populate(selector, query, _ref9) { + var _ref10 = _slicedToArray(_ref9, 1), + variable = _ref10[0]; + + query.checks.push({ + type: Type.DATA_EXIST, + field: cleanMetaChars(variable) + }); + } + }, { + name: 'dataCompare', + query: true, + regex: '\\[\\s*(' + tokens.variable + ')\\s*(' + tokens.comparatorOp + ')\\s*(' + tokens.value + ')\\s*\\]', + populate: function populate(selector, query, _ref11) { + var _ref12 = _slicedToArray(_ref11, 3), + variable = _ref12[0], + comparatorOp = _ref12[1], + value = _ref12[2]; + + var valueIsString = new RegExp('^' + tokens.string + '$').exec(value) != null; + + if (valueIsString) { + value = value.substring(1, value.length - 1); + } else { + value = parseFloat(value); + } + + query.checks.push({ + type: Type.DATA_COMPARE, + field: cleanMetaChars(variable), + operator: comparatorOp, + value: value + }); + } + }, { + name: 'dataBool', + query: true, + regex: '\\[\\s*(' + tokens.boolOp + ')\\s*(' + tokens.variable + ')\\s*\\]', + populate: function populate(selector, query, _ref13) { + var _ref14 = _slicedToArray(_ref13, 2), + boolOp = _ref14[0], + variable = _ref14[1]; + + query.checks.push({ + type: Type.DATA_BOOL, + field: cleanMetaChars(variable), + operator: boolOp + }); + } + }, { + name: 'metaCompare', + query: true, + regex: '\\[\\[\\s*(' + tokens.meta + ')\\s*(' + tokens.comparatorOp + ')\\s*(' + tokens.number + ')\\s*\\]\\]', + populate: function populate(selector, query, _ref15) { + var _ref16 = _slicedToArray(_ref15, 3), + meta = _ref16[0], + comparatorOp = _ref16[1], + number = _ref16[2]; + + query.checks.push({ + type: Type.META_COMPARE, + field: cleanMetaChars(meta), + operator: comparatorOp, + value: parseFloat(number) + }); + } + }, { + name: 'nextQuery', + separator: true, + regex: tokens.separator, + populate: function populate(selector, query) { + var currentSubject = selector.currentSubject; + var edgeCount = selector.edgeCount; + var compoundCount = selector.compoundCount; + var lastQ = selector[selector.length - 1]; + + if (currentSubject != null) { + lastQ.subject = currentSubject; + selector.currentSubject = null; + } + + lastQ.edgeCount = edgeCount; + lastQ.compoundCount = compoundCount; + selector.edgeCount = 0; + selector.compoundCount = 0; // go on to next query + + var nextQuery = selector[selector.length++] = newQuery(); + return nextQuery; // this is the new query to be filled by the following exprs + } + }, { + name: 'directedEdge', + separator: true, + regex: tokens.directedEdge, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // undirected edge + var edgeQuery = newQuery(); + var source = query; + var target = newQuery(); + edgeQuery.checks.push({ + type: Type.DIRECTED_EDGE, + source: source, + target: target + }); // the query in the selector should be the edge rather than the source + + replaceLastQuery(selector, query, edgeQuery); + selector.edgeCount++; // we're now populating the target query with expressions that follow + + return target; + } else { + // source/target + var srcTgtQ = newQuery(); + var _source = query; + + var _target = newQuery(); + + srcTgtQ.checks.push({ + type: Type.NODE_SOURCE, + source: _source, + target: _target + }); // the query in the selector should be the neighbourhood rather than the node + + replaceLastQuery(selector, query, srcTgtQ); + selector.edgeCount++; + return _target; // now populating the target with the following expressions + } + } + }, { + name: 'undirectedEdge', + separator: true, + regex: tokens.undirectedEdge, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // undirected edge + var edgeQuery = newQuery(); + var source = query; + var target = newQuery(); + edgeQuery.checks.push({ + type: Type.UNDIRECTED_EDGE, + nodes: [source, target] + }); // the query in the selector should be the edge rather than the source + + replaceLastQuery(selector, query, edgeQuery); + selector.edgeCount++; // we're now populating the target query with expressions that follow + + return target; + } else { + // neighbourhood + var nhoodQ = newQuery(); + var node = query; + var neighbor = newQuery(); + nhoodQ.checks.push({ + type: Type.NODE_NEIGHBOR, + node: node, + neighbor: neighbor + }); // the query in the selector should be the neighbourhood rather than the node + + replaceLastQuery(selector, query, nhoodQ); + return neighbor; // now populating the neighbor with following expressions + } + } + }, { + name: 'child', + separator: true, + regex: tokens.child, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // default: child query + var parentChildQuery = newQuery(); + var child = newQuery(); + var parent = selector[selector.length - 1]; + parentChildQuery.checks.push({ + type: Type.CHILD, + parent: parent, + child: child + }); // the query in the selector should be the '>' itself + + replaceLastQuery(selector, query, parentChildQuery); + selector.compoundCount++; // we're now populating the child query with expressions that follow + + return child; + } else if (selector.currentSubject === query) { + // compound split query + var compound = newQuery(); + var left = selector[selector.length - 1]; + var right = newQuery(); + var subject = newQuery(); + + var _child = newQuery(); + + var _parent = newQuery(); // set up the root compound q + + + compound.checks.push({ + type: Type.COMPOUND_SPLIT, + left: left, + right: right, + subject: subject + }); // populate the subject and replace the q at the old spot (within left) with TRUE + + subject.checks = query.checks; // take the checks from the left + + query.checks = [{ + type: Type.TRUE + }]; // checks under left refs the subject implicitly + // set up the right q + + _parent.checks.push({ + type: Type.TRUE + }); // parent implicitly refs the subject + + + right.checks.push({ + type: Type.PARENT, + // type is swapped on right side queries + parent: _parent, + child: _child // empty for now + + }); + replaceLastQuery(selector, left, compound); // update the ref since we moved things around for `query` + + selector.currentSubject = subject; + selector.compoundCount++; + return _child; // now populating the right side's child + } else { + // parent query + // info for parent query + var _parent2 = newQuery(); + + var _child2 = newQuery(); + + var pcQChecks = [{ + type: Type.PARENT, + parent: _parent2, + child: _child2 + }]; // the parent-child query takes the place of the query previously being populated + + _parent2.checks = query.checks; // the previous query contains the checks for the parent + + query.checks = pcQChecks; // pc query takes over + + selector.compoundCount++; + return _child2; // we're now populating the child + } + } + }, { + name: 'descendant', + separator: true, + regex: tokens.descendant, + populate: function populate(selector, query) { + if (selector.currentSubject == null) { + // default: descendant query + var ancChQuery = newQuery(); + var descendant = newQuery(); + var ancestor = selector[selector.length - 1]; + ancChQuery.checks.push({ + type: Type.DESCENDANT, + ancestor: ancestor, + descendant: descendant + }); // the query in the selector should be the '>' itself + + replaceLastQuery(selector, query, ancChQuery); + selector.compoundCount++; // we're now populating the descendant query with expressions that follow + + return descendant; + } else if (selector.currentSubject === query) { + // compound split query + var compound = newQuery(); + var left = selector[selector.length - 1]; + var right = newQuery(); + var subject = newQuery(); + + var _descendant = newQuery(); + + var _ancestor = newQuery(); // set up the root compound q + + + compound.checks.push({ + type: Type.COMPOUND_SPLIT, + left: left, + right: right, + subject: subject + }); // populate the subject and replace the q at the old spot (within left) with TRUE + + subject.checks = query.checks; // take the checks from the left + + query.checks = [{ + type: Type.TRUE + }]; // checks under left refs the subject implicitly + // set up the right q + + _ancestor.checks.push({ + type: Type.TRUE + }); // ancestor implicitly refs the subject + + + right.checks.push({ + type: Type.ANCESTOR, + // type is swapped on right side queries + ancestor: _ancestor, + descendant: _descendant // empty for now + + }); + replaceLastQuery(selector, left, compound); // update the ref since we moved things around for `query` + + selector.currentSubject = subject; + selector.compoundCount++; + return _descendant; // now populating the right side's descendant + } else { + // ancestor query + // info for parent query + var _ancestor2 = newQuery(); + + var _descendant2 = newQuery(); + + var adQChecks = [{ + type: Type.ANCESTOR, + ancestor: _ancestor2, + descendant: _descendant2 + }]; // the parent-child query takes the place of the query previously being populated + + _ancestor2.checks = query.checks; // the previous query contains the checks for the parent + + query.checks = adQChecks; // pc query takes over + + selector.compoundCount++; + return _descendant2; // we're now populating the child + } + } + }, { + name: 'subject', + modifier: true, + regex: tokens.subject, + populate: function populate(selector, query) { + if (selector.currentSubject != null && selector.currentSubject !== query) { + warn('Redefinition of subject in selector `' + selector.toString() + '`'); + return false; + } + + selector.currentSubject = query; + var topQ = selector[selector.length - 1]; + var topChk = topQ.checks[0]; + var topType = topChk == null ? null : topChk.type; + + if (topType === Type.DIRECTED_EDGE) { + // directed edge with subject on the target + // change to target node check + topChk.type = Type.NODE_TARGET; + } else if (topType === Type.UNDIRECTED_EDGE) { + // undirected edge with subject on the second node + // change to neighbor check + topChk.type = Type.NODE_NEIGHBOR; + topChk.node = topChk.nodes[1]; // second node is subject + + topChk.neighbor = topChk.nodes[0]; // clean up unused fields for new type + + topChk.nodes = null; + } + } + }]; + exprs.forEach(function (e) { + return e.regexObj = new RegExp('^' + e.regex); + }); + + /** + * Of all the expressions, find the first match in the remaining text. + * @param {string} remaining The remaining text to parse + * @returns The matched expression and the newly remaining text `{ expr, match, name, remaining }` + */ + + var consumeExpr = function consumeExpr(remaining) { + var expr; + var match; + var name; + + for (var j = 0; j < exprs.length; j++) { + var e = exprs[j]; + var n = e.name; + var m = remaining.match(e.regexObj); + + if (m != null) { + match = m; + expr = e; + name = n; + var consumed = m[0]; + remaining = remaining.substring(consumed.length); + break; // we've consumed one expr, so we can return now + } + } + + return { + expr: expr, + match: match, + name: name, + remaining: remaining + }; + }; + /** + * Consume all the leading whitespace + * @param {string} remaining The text to consume + * @returns The text with the leading whitespace removed + */ + + + var consumeWhitespace = function consumeWhitespace(remaining) { + var match = remaining.match(/^\s+/); + + if (match) { + var consumed = match[0]; + remaining = remaining.substring(consumed.length); + } + + return remaining; + }; + /** + * Parse the string and store the parsed representation in the Selector. + * @param {string} selector The selector string + * @returns `true` if the selector was successfully parsed, `false` otherwise + */ + + + var parse = function parse(selector) { + var self = this; + var remaining = self.inputText = selector; + var currentQuery = self[0] = newQuery(); + self.length = 1; + remaining = consumeWhitespace(remaining); // get rid of leading whitespace + + for (;;) { + var exprInfo = consumeExpr(remaining); + + if (exprInfo.expr == null) { + warn('The selector `' + selector + '`is invalid'); + return false; + } else { + var args = exprInfo.match.slice(1); // let the token populate the selector object in currentQuery + + var ret = exprInfo.expr.populate(self, currentQuery, args); + + if (ret === false) { + return false; // exit if population failed + } else if (ret != null) { + currentQuery = ret; // change the current query to be filled if the expr specifies + } + } + + remaining = exprInfo.remaining; // we're done when there's nothing left to parse + + if (remaining.match(/^\s*$/)) { + break; + } + } + + var lastQ = self[self.length - 1]; + + if (self.currentSubject != null) { + lastQ.subject = self.currentSubject; + } + + lastQ.edgeCount = self.edgeCount; + lastQ.compoundCount = self.compoundCount; + + for (var i = 0; i < self.length; i++) { + var q = self[i]; // in future, this could potentially be allowed if there were operator precedence and detection of invalid combinations + + if (q.compoundCount > 0 && q.edgeCount > 0) { + warn('The selector `' + selector + '` is invalid because it uses both a compound selector and an edge selector'); + return false; + } + + if (q.edgeCount > 1) { + warn('The selector `' + selector + '` is invalid because it uses multiple edge selectors'); + return false; + } else if (q.edgeCount === 1) { + warn('The selector `' + selector + '` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.'); + } + } + + return true; // success + }; + /** + * Get the selector represented as a string. This value uses default formatting, + * so things like spacing may differ from the input text passed to the constructor. + * @returns {string} The selector string + */ + + + var toString = function toString() { + if (this.toStringCache != null) { + return this.toStringCache; + } + + var clean = function clean(obj) { + if (obj == null) { + return ''; + } else { + return obj; + } + }; + + var cleanVal = function cleanVal(val) { + if (string(val)) { + return '"' + val + '"'; + } else { + return clean(val); + } + }; + + var space = function space(val) { + return ' ' + val + ' '; + }; + + var checkToString = function checkToString(check, subject) { + var type = check.type, + value = check.value; + + switch (type) { + case Type.GROUP: + { + var group = clean(value); + return group.substring(0, group.length - 1); + } + + case Type.DATA_COMPARE: + { + var field = check.field, + operator = check.operator; + return '[' + field + space(clean(operator)) + cleanVal(value) + ']'; + } + + case Type.DATA_BOOL: + { + var _operator = check.operator, + _field = check.field; + return '[' + clean(_operator) + _field + ']'; + } + + case Type.DATA_EXIST: + { + var _field2 = check.field; + return '[' + _field2 + ']'; + } + + case Type.META_COMPARE: + { + var _operator2 = check.operator, + _field3 = check.field; + return '[[' + _field3 + space(clean(_operator2)) + cleanVal(value) + ']]'; + } + + case Type.STATE: + { + return value; + } + + case Type.ID: + { + return '#' + value; + } + + case Type.CLASS: + { + return '.' + value; + } + + case Type.PARENT: + case Type.CHILD: + { + return queryToString(check.parent, subject) + space('>') + queryToString(check.child, subject); + } + + case Type.ANCESTOR: + case Type.DESCENDANT: + { + return queryToString(check.ancestor, subject) + ' ' + queryToString(check.descendant, subject); + } + + case Type.COMPOUND_SPLIT: + { + var lhs = queryToString(check.left, subject); + var sub = queryToString(check.subject, subject); + var rhs = queryToString(check.right, subject); + return lhs + (lhs.length > 0 ? ' ' : '') + sub + rhs; + } + + case Type.TRUE: + { + return ''; + } + } + }; + + var queryToString = function queryToString(query, subject) { + return query.checks.reduce(function (str, chk, i) { + return str + (subject === query && i === 0 ? '$' : '') + checkToString(chk, subject); + }, ''); + }; + + var str = ''; + + for (var i = 0; i < this.length; i++) { + var query = this[i]; + str += queryToString(query, query.subject); + + if (this.length > 1 && i < this.length - 1) { + str += ', '; + } + } + + this.toStringCache = str; + return str; + }; + var parse$1 = { + parse: parse, + toString: toString + }; + + var valCmp = function valCmp(fieldVal, operator, value) { + var matches; + var isFieldStr = string(fieldVal); + var isFieldNum = number$1(fieldVal); + var isValStr = string(value); + var fieldStr, valStr; + var caseInsensitive = false; + var notExpr = false; + var isIneqCmp = false; + + if (operator.indexOf('!') >= 0) { + operator = operator.replace('!', ''); + notExpr = true; + } + + if (operator.indexOf('@') >= 0) { + operator = operator.replace('@', ''); + caseInsensitive = true; + } + + if (isFieldStr || isValStr || caseInsensitive) { + fieldStr = !isFieldStr && !isFieldNum ? '' : '' + fieldVal; + valStr = '' + value; + } // if we're doing a case insensitive comparison, then we're using a STRING comparison + // even if we're comparing numbers + + + if (caseInsensitive) { + fieldVal = fieldStr = fieldStr.toLowerCase(); + value = valStr = valStr.toLowerCase(); + } + + switch (operator) { + case '*=': + matches = fieldStr.indexOf(valStr) >= 0; + break; + + case '$=': + matches = fieldStr.indexOf(valStr, fieldStr.length - valStr.length) >= 0; + break; + + case '^=': + matches = fieldStr.indexOf(valStr) === 0; + break; + + case '=': + matches = fieldVal === value; + break; + + case '>': + isIneqCmp = true; + matches = fieldVal > value; + break; + + case '>=': + isIneqCmp = true; + matches = fieldVal >= value; + break; + + case '<': + isIneqCmp = true; + matches = fieldVal < value; + break; + + case '<=': + isIneqCmp = true; + matches = fieldVal <= value; + break; + + default: + matches = false; + break; + } // apply the not op, but null vals for inequalities should always stay non-matching + + + if (notExpr && (fieldVal != null || !isIneqCmp)) { + matches = !matches; + } + + return matches; + }; + var boolCmp = function boolCmp(fieldVal, operator) { + switch (operator) { + case '?': + return fieldVal ? true : false; + + case '!': + return fieldVal ? false : true; + + case '^': + return fieldVal === undefined; + } + }; + var existCmp = function existCmp(fieldVal) { + return fieldVal !== undefined; + }; + var data$1 = function data(ele, field) { + return ele.data(field); + }; + var meta = function meta(ele, field) { + return ele[field](); + }; + + /** A lookup of `match(check, ele)` functions by `Type` int */ + + var match = []; + /** + * Returns whether the query matches for the element + * @param query The `{ type, value, ... }` query object + * @param ele The element to compare against + */ + + var matches$1 = function matches(query, ele) { + return query.checks.every(function (chk) { + return match[chk.type](chk, ele); + }); + }; + + match[Type.GROUP] = function (check, ele) { + var group = check.value; + return group === '*' || group === ele.group(); + }; + + match[Type.STATE] = function (check, ele) { + var stateSelector = check.value; + return stateSelectorMatches(stateSelector, ele); + }; + + match[Type.ID] = function (check, ele) { + var id = check.value; + return ele.id() === id; + }; + + match[Type.CLASS] = function (check, ele) { + var cls = check.value; + return ele.hasClass(cls); + }; + + match[Type.META_COMPARE] = function (check, ele) { + var field = check.field, + operator = check.operator, + value = check.value; + return valCmp(meta(ele, field), operator, value); + }; + + match[Type.DATA_COMPARE] = function (check, ele) { + var field = check.field, + operator = check.operator, + value = check.value; + return valCmp(data$1(ele, field), operator, value); + }; + + match[Type.DATA_BOOL] = function (check, ele) { + var field = check.field, + operator = check.operator; + return boolCmp(data$1(ele, field), operator); + }; + + match[Type.DATA_EXIST] = function (check, ele) { + var field = check.field; + check.operator; + return existCmp(data$1(ele, field)); + }; + + match[Type.UNDIRECTED_EDGE] = function (check, ele) { + var qA = check.nodes[0]; + var qB = check.nodes[1]; + var src = ele.source(); + var tgt = ele.target(); + return matches$1(qA, src) && matches$1(qB, tgt) || matches$1(qB, src) && matches$1(qA, tgt); + }; + + match[Type.NODE_NEIGHBOR] = function (check, ele) { + return matches$1(check.node, ele) && ele.neighborhood().some(function (n) { + return n.isNode() && matches$1(check.neighbor, n); + }); + }; + + match[Type.DIRECTED_EDGE] = function (check, ele) { + return matches$1(check.source, ele.source()) && matches$1(check.target, ele.target()); + }; + + match[Type.NODE_SOURCE] = function (check, ele) { + return matches$1(check.source, ele) && ele.outgoers().some(function (n) { + return n.isNode() && matches$1(check.target, n); + }); + }; + + match[Type.NODE_TARGET] = function (check, ele) { + return matches$1(check.target, ele) && ele.incomers().some(function (n) { + return n.isNode() && matches$1(check.source, n); + }); + }; + + match[Type.CHILD] = function (check, ele) { + return matches$1(check.child, ele) && matches$1(check.parent, ele.parent()); + }; + + match[Type.PARENT] = function (check, ele) { + return matches$1(check.parent, ele) && ele.children().some(function (c) { + return matches$1(check.child, c); + }); + }; + + match[Type.DESCENDANT] = function (check, ele) { + return matches$1(check.descendant, ele) && ele.ancestors().some(function (a) { + return matches$1(check.ancestor, a); + }); + }; + + match[Type.ANCESTOR] = function (check, ele) { + return matches$1(check.ancestor, ele) && ele.descendants().some(function (d) { + return matches$1(check.descendant, d); + }); + }; + + match[Type.COMPOUND_SPLIT] = function (check, ele) { + return matches$1(check.subject, ele) && matches$1(check.left, ele) && matches$1(check.right, ele); + }; + + match[Type.TRUE] = function () { + return true; + }; + + match[Type.COLLECTION] = function (check, ele) { + var collection = check.value; + return collection.has(ele); + }; + + match[Type.FILTER] = function (check, ele) { + var filter = check.value; + return filter(ele); + }; + + var filter = function filter(collection) { + var self = this; // for 1 id #foo queries, just get the element + + if (self.length === 1 && self[0].checks.length === 1 && self[0].checks[0].type === Type.ID) { + return collection.getElementById(self[0].checks[0].value).collection(); + } + + var selectorFunction = function selectorFunction(element) { + for (var j = 0; j < self.length; j++) { + var query = self[j]; + + if (matches$1(query, element)) { + return true; + } + } + + return false; + }; + + if (self.text() == null) { + selectorFunction = function selectorFunction() { + return true; + }; + } + + return collection.filter(selectorFunction); + }; // filter + // does selector match a single element? + + + var matches = function matches(ele) { + var self = this; + + for (var j = 0; j < self.length; j++) { + var query = self[j]; + + if (matches$1(query, ele)) { + return true; + } + } + + return false; + }; // matches + + + var matching = { + matches: matches, + filter: filter + }; + + var Selector = function Selector(selector) { + this.inputText = selector; + this.currentSubject = null; + this.compoundCount = 0; + this.edgeCount = 0; + this.length = 0; + + if (selector == null || string(selector) && selector.match(/^\s*$/)) ; else if (elementOrCollection(selector)) { + this.addQuery({ + checks: [{ + type: Type.COLLECTION, + value: selector.collection() + }] + }); + } else if (fn$6(selector)) { + this.addQuery({ + checks: [{ + type: Type.FILTER, + value: selector + }] + }); + } else if (string(selector)) { + if (!this.parse(selector)) { + this.invalid = true; + } + } else { + error('A selector must be created from a string; found '); + } + }; + + var selfn = Selector.prototype; + [parse$1, matching].forEach(function (p) { + return extend(selfn, p); + }); + + selfn.text = function () { + return this.inputText; + }; + + selfn.size = function () { + return this.length; + }; + + selfn.eq = function (i) { + return this[i]; + }; + + selfn.sameText = function (otherSel) { + return !this.invalid && !otherSel.invalid && this.text() === otherSel.text(); + }; + + selfn.addQuery = function (q) { + this[this.length++] = q; + }; + + selfn.selector = selfn.toString; + + var elesfn$g = { + allAre: function allAre(selector) { + var selObj = new Selector(selector); + return this.every(function (ele) { + return selObj.matches(ele); + }); + }, + is: function is(selector) { + var selObj = new Selector(selector); + return this.some(function (ele) { + return selObj.matches(ele); + }); + }, + some: function some(fn, thisArg) { + for (var i = 0; i < this.length; i++) { + var ret = !thisArg ? fn(this[i], i, this) : fn.apply(thisArg, [this[i], i, this]); + + if (ret) { + return true; + } + } + + return false; + }, + every: function every(fn, thisArg) { + for (var i = 0; i < this.length; i++) { + var ret = !thisArg ? fn(this[i], i, this) : fn.apply(thisArg, [this[i], i, this]); + + if (!ret) { + return false; + } + } + + return true; + }, + same: function same(collection) { + // cheap collection ref check + if (this === collection) { + return true; + } + + collection = this.cy().collection(collection); + var thisLength = this.length; + var collectionLength = collection.length; // cheap length check + + if (thisLength !== collectionLength) { + return false; + } // cheap element ref check + + + if (thisLength === 1) { + return this[0] === collection[0]; + } + + return this.every(function (ele) { + return collection.hasElementWithId(ele.id()); + }); + }, + anySame: function anySame(collection) { + collection = this.cy().collection(collection); + return this.some(function (ele) { + return collection.hasElementWithId(ele.id()); + }); + }, + allAreNeighbors: function allAreNeighbors(collection) { + collection = this.cy().collection(collection); + var nhood = this.neighborhood(); + return collection.every(function (ele) { + return nhood.hasElementWithId(ele.id()); + }); + }, + contains: function contains(collection) { + collection = this.cy().collection(collection); + var self = this; + return collection.every(function (ele) { + return self.hasElementWithId(ele.id()); + }); + } + }; + elesfn$g.allAreNeighbours = elesfn$g.allAreNeighbors; + elesfn$g.has = elesfn$g.contains; + elesfn$g.equal = elesfn$g.equals = elesfn$g.same; + + var cache = function cache(fn, name) { + return function traversalCache(arg1, arg2, arg3, arg4) { + var selectorOrEles = arg1; + var eles = this; + var key; + + if (selectorOrEles == null) { + key = ''; + } else if (elementOrCollection(selectorOrEles) && selectorOrEles.length === 1) { + key = selectorOrEles.id(); + } + + if (eles.length === 1 && key) { + var _p = eles[0]._private; + var tch = _p.traversalCache = _p.traversalCache || {}; + var ch = tch[name] = tch[name] || []; + var hash = hashString(key); + var cacheHit = ch[hash]; + + if (cacheHit) { + return cacheHit; + } else { + return ch[hash] = fn.call(eles, arg1, arg2, arg3, arg4); + } + } else { + return fn.call(eles, arg1, arg2, arg3, arg4); + } + }; + }; + + var elesfn$f = { + parent: function parent(selector) { + var parents = []; // optimisation for single ele call + + if (this.length === 1) { + var parent = this[0]._private.parent; + + if (parent) { + return parent; + } + } + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var _parent = ele._private.parent; + + if (_parent) { + parents.push(_parent); + } + } + + return this.spawn(parents, true).filter(selector); + }, + parents: function parents(selector) { + var parents = []; + var eles = this.parent(); + + while (eles.nonempty()) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + parents.push(ele); + } + + eles = eles.parent(); + } + + return this.spawn(parents, true).filter(selector); + }, + commonAncestors: function commonAncestors(selector) { + var ancestors; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var parents = ele.parents(); + ancestors = ancestors || parents; + ancestors = ancestors.intersect(parents); // current list must be common with current ele parents set + } + + return ancestors.filter(selector); + }, + orphans: function orphans(selector) { + return this.stdFilter(function (ele) { + return ele.isOrphan(); + }).filter(selector); + }, + nonorphans: function nonorphans(selector) { + return this.stdFilter(function (ele) { + return ele.isChild(); + }).filter(selector); + }, + children: cache(function (selector) { + var children = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var eleChildren = ele._private.children; + + for (var j = 0; j < eleChildren.length; j++) { + children.push(eleChildren[j]); + } + } + + return this.spawn(children, true).filter(selector); + }, 'children'), + siblings: function siblings(selector) { + return this.parent().children().not(this).filter(selector); + }, + isParent: function isParent() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.children.length !== 0; + } + }, + isChildless: function isChildless() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.children.length === 0; + } + }, + isChild: function isChild() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.parent != null; + } + }, + isOrphan: function isOrphan() { + var ele = this[0]; + + if (ele) { + return ele.isNode() && ele._private.parent == null; + } + }, + descendants: function descendants(selector) { + var elements = []; + + function add(eles) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + elements.push(ele); + + if (ele.children().nonempty()) { + add(ele.children()); + } + } + } + + add(this.children()); + return this.spawn(elements, true).filter(selector); + } + }; + + function forEachCompound(eles, fn, includeSelf, recursiveStep) { + var q = []; + var did = new Set$1(); + var cy = eles.cy(); + var hasCompounds = cy.hasCompoundNodes(); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (includeSelf) { + q.push(ele); + } else if (hasCompounds) { + recursiveStep(q, did, ele); + } + } + + while (q.length > 0) { + var _ele = q.shift(); + + fn(_ele); + did.add(_ele.id()); + + if (hasCompounds) { + recursiveStep(q, did, _ele); + } + } + + return eles; + } + + function addChildren(q, did, ele) { + if (ele.isParent()) { + var children = ele._private.children; + + for (var i = 0; i < children.length; i++) { + var child = children[i]; + + if (!did.has(child.id())) { + q.push(child); + } + } + } + } // very efficient version of eles.add( eles.descendants() ).forEach() + // for internal use + + + elesfn$f.forEachDown = function (fn) { + var includeSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return forEachCompound(this, fn, includeSelf, addChildren); + }; + + function addParent(q, did, ele) { + if (ele.isChild()) { + var parent = ele._private.parent; + + if (!did.has(parent.id())) { + q.push(parent); + } + } + } + + elesfn$f.forEachUp = function (fn) { + var includeSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return forEachCompound(this, fn, includeSelf, addParent); + }; + + function addParentAndChildren(q, did, ele) { + addParent(q, did, ele); + addChildren(q, did, ele); + } + + elesfn$f.forEachUpAndDown = function (fn) { + var includeSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return forEachCompound(this, fn, includeSelf, addParentAndChildren); + }; // aliases + + + elesfn$f.ancestors = elesfn$f.parents; + + var fn$5, elesfn$e; + fn$5 = elesfn$e = { + data: define.data({ + field: 'data', + bindingEvent: 'data', + allowBinding: true, + allowSetting: true, + settingEvent: 'data', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + immutableKeys: { + 'id': true, + 'source': true, + 'target': true, + 'parent': true + }, + updateStyle: true + }), + removeData: define.removeData({ + field: 'data', + event: 'data', + triggerFnName: 'trigger', + triggerEvent: true, + immutableKeys: { + 'id': true, + 'source': true, + 'target': true, + 'parent': true + }, + updateStyle: true + }), + scratch: define.data({ + field: 'scratch', + bindingEvent: 'scratch', + allowBinding: true, + allowSetting: true, + settingEvent: 'scratch', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + updateStyle: true + }), + removeScratch: define.removeData({ + field: 'scratch', + event: 'scratch', + triggerFnName: 'trigger', + triggerEvent: true, + updateStyle: true + }), + rscratch: define.data({ + field: 'rscratch', + allowBinding: false, + allowSetting: true, + settingTriggersEvent: false, + allowGetting: true + }), + removeRscratch: define.removeData({ + field: 'rscratch', + triggerEvent: false + }), + id: function id() { + var ele = this[0]; + + if (ele) { + return ele._private.data.id; + } + } + }; // aliases + + fn$5.attr = fn$5.data; + fn$5.removeAttr = fn$5.removeData; + var data = elesfn$e; + + var elesfn$d = {}; + + function defineDegreeFunction(callback) { + return function (includeLoops) { + var self = this; + + if (includeLoops === undefined) { + includeLoops = true; + } + + if (self.length === 0) { + return; + } + + if (self.isNode() && !self.removed()) { + var degree = 0; + var node = self[0]; + var connectedEdges = node._private.edges; + + for (var i = 0; i < connectedEdges.length; i++) { + var edge = connectedEdges[i]; + + if (!includeLoops && edge.isLoop()) { + continue; + } + + degree += callback(node, edge); + } + + return degree; + } else { + return; + } + }; + } + + extend(elesfn$d, { + degree: defineDegreeFunction(function (node, edge) { + if (edge.source().same(edge.target())) { + return 2; + } else { + return 1; + } + }), + indegree: defineDegreeFunction(function (node, edge) { + if (edge.target().same(node)) { + return 1; + } else { + return 0; + } + }), + outdegree: defineDegreeFunction(function (node, edge) { + if (edge.source().same(node)) { + return 1; + } else { + return 0; + } + }) + }); + + function defineDegreeBoundsFunction(degreeFn, callback) { + return function (includeLoops) { + var ret; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + var ele = nodes[i]; + var degree = ele[degreeFn](includeLoops); + + if (degree !== undefined && (ret === undefined || callback(degree, ret))) { + ret = degree; + } + } + + return ret; + }; + } + + extend(elesfn$d, { + minDegree: defineDegreeBoundsFunction('degree', function (degree, min) { + return degree < min; + }), + maxDegree: defineDegreeBoundsFunction('degree', function (degree, max) { + return degree > max; + }), + minIndegree: defineDegreeBoundsFunction('indegree', function (degree, min) { + return degree < min; + }), + maxIndegree: defineDegreeBoundsFunction('indegree', function (degree, max) { + return degree > max; + }), + minOutdegree: defineDegreeBoundsFunction('outdegree', function (degree, min) { + return degree < min; + }), + maxOutdegree: defineDegreeBoundsFunction('outdegree', function (degree, max) { + return degree > max; + }) + }); + extend(elesfn$d, { + totalDegree: function totalDegree(includeLoops) { + var total = 0; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + total += nodes[i].degree(includeLoops); + } + + return total; + } + }); + + var fn$4, elesfn$c; + + var beforePositionSet = function beforePositionSet(eles, newPos, silent) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.locked()) { + var oldPos = ele._private.position; + var delta = { + x: newPos.x != null ? newPos.x - oldPos.x : 0, + y: newPos.y != null ? newPos.y - oldPos.y : 0 + }; + + if (ele.isParent() && !(delta.x === 0 && delta.y === 0)) { + ele.children().shift(delta, silent); + } + + ele.dirtyBoundingBoxCache(); + } + } + }; + + var positionDef = { + field: 'position', + bindingEvent: 'position', + allowBinding: true, + allowSetting: true, + settingEvent: 'position', + settingTriggersEvent: true, + triggerFnName: 'emitAndNotify', + allowGetting: true, + validKeys: ['x', 'y'], + beforeGet: function beforeGet(ele) { + ele.updateCompoundBounds(); + }, + beforeSet: function beforeSet(eles, newPos) { + beforePositionSet(eles, newPos, false); + }, + onSet: function onSet(eles) { + eles.dirtyCompoundBoundsCache(); + }, + canSet: function canSet(ele) { + return !ele.locked(); + } + }; + fn$4 = elesfn$c = { + position: define.data(positionDef), + // position but no notification to renderer + silentPosition: define.data(extend({}, positionDef, { + allowBinding: false, + allowSetting: true, + settingTriggersEvent: false, + allowGetting: false, + beforeSet: function beforeSet(eles, newPos) { + beforePositionSet(eles, newPos, true); + }, + onSet: function onSet(eles) { + eles.dirtyCompoundBoundsCache(); + } + })), + positions: function positions(pos, silent) { + if (plainObject(pos)) { + if (silent) { + this.silentPosition(pos); + } else { + this.position(pos); + } + } else if (fn$6(pos)) { + var _fn = pos; + var cy = this.cy(); + cy.startBatch(); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + + var _pos = void 0; + + if (_pos = _fn(ele, i)) { + if (silent) { + ele.silentPosition(_pos); + } else { + ele.position(_pos); + } + } + } + + cy.endBatch(); + } + + return this; // chaining + }, + silentPositions: function silentPositions(pos) { + return this.positions(pos, true); + }, + shift: function shift(dim, val, silent) { + var delta; + + if (plainObject(dim)) { + delta = { + x: number$1(dim.x) ? dim.x : 0, + y: number$1(dim.y) ? dim.y : 0 + }; + silent = val; + } else if (string(dim) && number$1(val)) { + delta = { + x: 0, + y: 0 + }; + delta[dim] = val; + } + + if (delta != null) { + var cy = this.cy(); + cy.startBatch(); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; // exclude any node that is a descendant of the calling collection + + if (cy.hasCompoundNodes() && ele.isChild() && ele.ancestors().anySame(this)) { + continue; + } + + var pos = ele.position(); + var newPos = { + x: pos.x + delta.x, + y: pos.y + delta.y + }; + + if (silent) { + ele.silentPosition(newPos); + } else { + ele.position(newPos); + } + } + + cy.endBatch(); + } + + return this; + }, + silentShift: function silentShift(dim, val) { + if (plainObject(dim)) { + this.shift(dim, true); + } else if (string(dim) && number$1(val)) { + this.shift(dim, val, true); + } + + return this; + }, + // get/set the rendered (i.e. on screen) positon of the element + renderedPosition: function renderedPosition(dim, val) { + var ele = this[0]; + var cy = this.cy(); + var zoom = cy.zoom(); + var pan = cy.pan(); + var rpos = plainObject(dim) ? dim : undefined; + var setting = rpos !== undefined || val !== undefined && string(dim); + + if (ele && ele.isNode()) { + // must have an element and must be a node to return position + if (setting) { + for (var i = 0; i < this.length; i++) { + var _ele = this[i]; + + if (val !== undefined) { + // set one dimension + _ele.position(dim, (val - pan[dim]) / zoom); + } else if (rpos !== undefined) { + // set whole position + _ele.position(renderedToModelPosition(rpos, zoom, pan)); + } + } + } else { + // getting + var pos = ele.position(); + rpos = modelToRenderedPosition(pos, zoom, pan); + + if (dim === undefined) { + // then return the whole rendered position + return rpos; + } else { + // then return the specified dimension + return rpos[dim]; + } + } + } else if (!setting) { + return undefined; // for empty collection case + } + + return this; // chaining + }, + // get/set the position relative to the parent + relativePosition: function relativePosition(dim, val) { + var ele = this[0]; + var cy = this.cy(); + var ppos = plainObject(dim) ? dim : undefined; + var setting = ppos !== undefined || val !== undefined && string(dim); + var hasCompoundNodes = cy.hasCompoundNodes(); + + if (ele && ele.isNode()) { + // must have an element and must be a node to return position + if (setting) { + for (var i = 0; i < this.length; i++) { + var _ele2 = this[i]; + var parent = hasCompoundNodes ? _ele2.parent() : null; + var hasParent = parent && parent.length > 0; + var relativeToParent = hasParent; + + if (hasParent) { + parent = parent[0]; + } + + var origin = relativeToParent ? parent.position() : { + x: 0, + y: 0 + }; + + if (val !== undefined) { + // set one dimension + _ele2.position(dim, val + origin[dim]); + } else if (ppos !== undefined) { + // set whole position + _ele2.position({ + x: ppos.x + origin.x, + y: ppos.y + origin.y + }); + } + } + } else { + // getting + var pos = ele.position(); + + var _parent = hasCompoundNodes ? ele.parent() : null; + + var _hasParent = _parent && _parent.length > 0; + + var _relativeToParent = _hasParent; + + if (_hasParent) { + _parent = _parent[0]; + } + + var _origin = _relativeToParent ? _parent.position() : { + x: 0, + y: 0 + }; + + ppos = { + x: pos.x - _origin.x, + y: pos.y - _origin.y + }; + + if (dim === undefined) { + // then return the whole rendered position + return ppos; + } else { + // then return the specified dimension + return ppos[dim]; + } + } + } else if (!setting) { + return undefined; // for empty collection case + } + + return this; // chaining + } + }; // aliases + + fn$4.modelPosition = fn$4.point = fn$4.position; + fn$4.modelPositions = fn$4.points = fn$4.positions; + fn$4.renderedPoint = fn$4.renderedPosition; + fn$4.relativePoint = fn$4.relativePosition; + var position = elesfn$c; + + var fn$3, elesfn$b; + fn$3 = elesfn$b = {}; + + elesfn$b.renderedBoundingBox = function (options) { + var bb = this.boundingBox(options); + var cy = this.cy(); + var zoom = cy.zoom(); + var pan = cy.pan(); + var x1 = bb.x1 * zoom + pan.x; + var x2 = bb.x2 * zoom + pan.x; + var y1 = bb.y1 * zoom + pan.y; + var y2 = bb.y2 * zoom + pan.y; + return { + x1: x1, + x2: x2, + y1: y1, + y2: y2, + w: x2 - x1, + h: y2 - y1 + }; + }; + + elesfn$b.dirtyCompoundBoundsCache = function () { + var silent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var cy = this.cy(); + + if (!cy.styleEnabled() || !cy.hasCompoundNodes()) { + return this; + } + + this.forEachUp(function (ele) { + if (ele.isParent()) { + var _p = ele._private; + _p.compoundBoundsClean = false; + _p.bbCache = null; + + if (!silent) { + ele.emitAndNotify('bounds'); + } + } + }); + return this; + }; + + elesfn$b.updateCompoundBounds = function () { + var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var cy = this.cy(); // not possible to do on non-compound graphs or with the style disabled + + if (!cy.styleEnabled() || !cy.hasCompoundNodes()) { + return this; + } // save cycles when batching -- but bounds will be stale (or not exist yet) + + + if (!force && cy.batching()) { + return this; + } + + function update(parent) { + if (!parent.isParent()) { + return; + } + + var _p = parent._private; + var children = parent.children(); + var includeLabels = parent.pstyle('compound-sizing-wrt-labels').value === 'include'; + var min = { + width: { + val: parent.pstyle('min-width').pfValue, + left: parent.pstyle('min-width-bias-left'), + right: parent.pstyle('min-width-bias-right') + }, + height: { + val: parent.pstyle('min-height').pfValue, + top: parent.pstyle('min-height-bias-top'), + bottom: parent.pstyle('min-height-bias-bottom') + } + }; + var bb = children.boundingBox({ + includeLabels: includeLabels, + includeOverlays: false, + // updating the compound bounds happens outside of the regular + // cache cycle (i.e. before fired events) + useCache: false + }); + var pos = _p.position; // if children take up zero area then keep position and fall back on stylesheet w/h + + if (bb.w === 0 || bb.h === 0) { + bb = { + w: parent.pstyle('width').pfValue, + h: parent.pstyle('height').pfValue + }; + bb.x1 = pos.x - bb.w / 2; + bb.x2 = pos.x + bb.w / 2; + bb.y1 = pos.y - bb.h / 2; + bb.y2 = pos.y + bb.h / 2; + } + + function computeBiasValues(propDiff, propBias, propBiasComplement) { + var biasDiff = 0; + var biasComplementDiff = 0; + var biasTotal = propBias + propBiasComplement; + + if (propDiff > 0 && biasTotal > 0) { + biasDiff = propBias / biasTotal * propDiff; + biasComplementDiff = propBiasComplement / biasTotal * propDiff; + } + + return { + biasDiff: biasDiff, + biasComplementDiff: biasComplementDiff + }; + } + + function computePaddingValues(width, height, paddingObject, relativeTo) { + // Assuming percentage is number from 0 to 1 + if (paddingObject.units === '%') { + switch (relativeTo) { + case 'width': + return width > 0 ? paddingObject.pfValue * width : 0; + + case 'height': + return height > 0 ? paddingObject.pfValue * height : 0; + + case 'average': + return width > 0 && height > 0 ? paddingObject.pfValue * (width + height) / 2 : 0; + + case 'min': + return width > 0 && height > 0 ? width > height ? paddingObject.pfValue * height : paddingObject.pfValue * width : 0; + + case 'max': + return width > 0 && height > 0 ? width > height ? paddingObject.pfValue * width : paddingObject.pfValue * height : 0; + + default: + return 0; + } + } else if (paddingObject.units === 'px') { + return paddingObject.pfValue; + } else { + return 0; + } + } + + var leftVal = min.width.left.value; + + if (min.width.left.units === 'px' && min.width.val > 0) { + leftVal = leftVal * 100 / min.width.val; + } + + var rightVal = min.width.right.value; + + if (min.width.right.units === 'px' && min.width.val > 0) { + rightVal = rightVal * 100 / min.width.val; + } + + var topVal = min.height.top.value; + + if (min.height.top.units === 'px' && min.height.val > 0) { + topVal = topVal * 100 / min.height.val; + } + + var bottomVal = min.height.bottom.value; + + if (min.height.bottom.units === 'px' && min.height.val > 0) { + bottomVal = bottomVal * 100 / min.height.val; + } + + var widthBiasDiffs = computeBiasValues(min.width.val - bb.w, leftVal, rightVal); + var diffLeft = widthBiasDiffs.biasDiff; + var diffRight = widthBiasDiffs.biasComplementDiff; + var heightBiasDiffs = computeBiasValues(min.height.val - bb.h, topVal, bottomVal); + var diffTop = heightBiasDiffs.biasDiff; + var diffBottom = heightBiasDiffs.biasComplementDiff; + _p.autoPadding = computePaddingValues(bb.w, bb.h, parent.pstyle('padding'), parent.pstyle('padding-relative-to').value); + _p.autoWidth = Math.max(bb.w, min.width.val); + pos.x = (-diffLeft + bb.x1 + bb.x2 + diffRight) / 2; + _p.autoHeight = Math.max(bb.h, min.height.val); + pos.y = (-diffTop + bb.y1 + bb.y2 + diffBottom) / 2; + } + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var _p = ele._private; + + if (!_p.compoundBoundsClean || force) { + update(ele); + + if (!cy.batching()) { + _p.compoundBoundsClean = true; + } + } + } + + return this; + }; + + var noninf = function noninf(x) { + if (x === Infinity || x === -Infinity) { + return 0; + } + + return x; + }; + + var updateBounds = function updateBounds(b, x1, y1, x2, y2) { + // don't update with zero area boxes + if (x2 - x1 === 0 || y2 - y1 === 0) { + return; + } // don't update with null dim + + + if (x1 == null || y1 == null || x2 == null || y2 == null) { + return; + } + + b.x1 = x1 < b.x1 ? x1 : b.x1; + b.x2 = x2 > b.x2 ? x2 : b.x2; + b.y1 = y1 < b.y1 ? y1 : b.y1; + b.y2 = y2 > b.y2 ? y2 : b.y2; + b.w = b.x2 - b.x1; + b.h = b.y2 - b.y1; + }; + + var updateBoundsFromBox = function updateBoundsFromBox(b, b2) { + if (b2 == null) { + return b; + } + + return updateBounds(b, b2.x1, b2.y1, b2.x2, b2.y2); + }; + + var prefixedProperty = function prefixedProperty(obj, field, prefix) { + return getPrefixedProperty(obj, field, prefix); + }; + + var updateBoundsFromArrow = function updateBoundsFromArrow(bounds, ele, prefix) { + if (ele.cy().headless()) { + return; + } + + var _p = ele._private; + var rstyle = _p.rstyle; + var halfArW = rstyle.arrowWidth / 2; + var arrowType = ele.pstyle(prefix + '-arrow-shape').value; + var x; + var y; + + if (arrowType !== 'none') { + if (prefix === 'source') { + x = rstyle.srcX; + y = rstyle.srcY; + } else if (prefix === 'target') { + x = rstyle.tgtX; + y = rstyle.tgtY; + } else { + x = rstyle.midX; + y = rstyle.midY; + } // always store the individual arrow bounds + + + var bbs = _p.arrowBounds = _p.arrowBounds || {}; + var bb = bbs[prefix] = bbs[prefix] || {}; + bb.x1 = x - halfArW; + bb.y1 = y - halfArW; + bb.x2 = x + halfArW; + bb.y2 = y + halfArW; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + expandBoundingBox(bb, 1); + updateBounds(bounds, bb.x1, bb.y1, bb.x2, bb.y2); + } + }; + + var updateBoundsFromLabel = function updateBoundsFromLabel(bounds, ele, prefix) { + if (ele.cy().headless()) { + return; + } + + var prefixDash; + + if (prefix) { + prefixDash = prefix + '-'; + } else { + prefixDash = ''; + } + + var _p = ele._private; + var rstyle = _p.rstyle; + var label = ele.pstyle(prefixDash + 'label').strValue; + + if (label) { + var halign = ele.pstyle('text-halign'); + var valign = ele.pstyle('text-valign'); + var labelWidth = prefixedProperty(rstyle, 'labelWidth', prefix); + var labelHeight = prefixedProperty(rstyle, 'labelHeight', prefix); + var labelX = prefixedProperty(rstyle, 'labelX', prefix); + var labelY = prefixedProperty(rstyle, 'labelY', prefix); + var marginX = ele.pstyle(prefixDash + 'text-margin-x').pfValue; + var marginY = ele.pstyle(prefixDash + 'text-margin-y').pfValue; + var isEdge = ele.isEdge(); + var rotation = ele.pstyle(prefixDash + 'text-rotation'); + var outlineWidth = ele.pstyle('text-outline-width').pfValue; + var borderWidth = ele.pstyle('text-border-width').pfValue; + var halfBorderWidth = borderWidth / 2; + var padding = ele.pstyle('text-background-padding').pfValue; + var marginOfError = 2; // expand to work around browser dimension inaccuracies + + var lh = labelHeight; + var lw = labelWidth; + var lw_2 = lw / 2; + var lh_2 = lh / 2; + var lx1, lx2, ly1, ly2; + + if (isEdge) { + lx1 = labelX - lw_2; + lx2 = labelX + lw_2; + ly1 = labelY - lh_2; + ly2 = labelY + lh_2; + } else { + switch (halign.value) { + case 'left': + lx1 = labelX - lw; + lx2 = labelX; + break; + + case 'center': + lx1 = labelX - lw_2; + lx2 = labelX + lw_2; + break; + + case 'right': + lx1 = labelX; + lx2 = labelX + lw; + break; + } + + switch (valign.value) { + case 'top': + ly1 = labelY - lh; + ly2 = labelY; + break; + + case 'center': + ly1 = labelY - lh_2; + ly2 = labelY + lh_2; + break; + + case 'bottom': + ly1 = labelY; + ly2 = labelY + lh; + break; + } + } // shift by margin and expand by outline and border + + + lx1 += marginX - Math.max(outlineWidth, halfBorderWidth) - padding - marginOfError; + lx2 += marginX + Math.max(outlineWidth, halfBorderWidth) + padding + marginOfError; + ly1 += marginY - Math.max(outlineWidth, halfBorderWidth) - padding - marginOfError; + ly2 += marginY + Math.max(outlineWidth, halfBorderWidth) + padding + marginOfError; // always store the unrotated label bounds separately + + var bbPrefix = prefix || 'main'; + var bbs = _p.labelBounds; + var bb = bbs[bbPrefix] = bbs[bbPrefix] || {}; + bb.x1 = lx1; + bb.y1 = ly1; + bb.x2 = lx2; + bb.y2 = ly2; + bb.w = lx2 - lx1; + bb.h = ly2 - ly1; + var isAutorotate = isEdge && rotation.strValue === 'autorotate'; + var isPfValue = rotation.pfValue != null && rotation.pfValue !== 0; + + if (isAutorotate || isPfValue) { + var theta = isAutorotate ? prefixedProperty(_p.rstyle, 'labelAngle', prefix) : rotation.pfValue; + var cos = Math.cos(theta); + var sin = Math.sin(theta); // rotation point (default value for center-center) + + var xo = (lx1 + lx2) / 2; + var yo = (ly1 + ly2) / 2; + + if (!isEdge) { + switch (halign.value) { + case 'left': + xo = lx2; + break; + + case 'right': + xo = lx1; + break; + } + + switch (valign.value) { + case 'top': + yo = ly2; + break; + + case 'bottom': + yo = ly1; + break; + } + } + + var rotate = function rotate(x, y) { + x = x - xo; + y = y - yo; + return { + x: x * cos - y * sin + xo, + y: x * sin + y * cos + yo + }; + }; + + var px1y1 = rotate(lx1, ly1); + var px1y2 = rotate(lx1, ly2); + var px2y1 = rotate(lx2, ly1); + var px2y2 = rotate(lx2, ly2); + lx1 = Math.min(px1y1.x, px1y2.x, px2y1.x, px2y2.x); + lx2 = Math.max(px1y1.x, px1y2.x, px2y1.x, px2y2.x); + ly1 = Math.min(px1y1.y, px1y2.y, px2y1.y, px2y2.y); + ly2 = Math.max(px1y1.y, px1y2.y, px2y1.y, px2y2.y); + } + + var bbPrefixRot = bbPrefix + 'Rot'; + var bbRot = bbs[bbPrefixRot] = bbs[bbPrefixRot] || {}; + bbRot.x1 = lx1; + bbRot.y1 = ly1; + bbRot.x2 = lx2; + bbRot.y2 = ly2; + bbRot.w = lx2 - lx1; + bbRot.h = ly2 - ly1; + updateBounds(bounds, lx1, ly1, lx2, ly2); + updateBounds(_p.labelBounds.all, lx1, ly1, lx2, ly2); + } + + return bounds; + }; // get the bounding box of the elements (in raw model position) + + + var boundingBoxImpl = function boundingBoxImpl(ele, options) { + var cy = ele._private.cy; + var styleEnabled = cy.styleEnabled(); + var headless = cy.headless(); + var bounds = makeBoundingBox(); + var _p = ele._private; + var isNode = ele.isNode(); + var isEdge = ele.isEdge(); + var ex1, ex2, ey1, ey2; // extrema of body / lines + + var x, y; // node pos + + var rstyle = _p.rstyle; + var manualExpansion = isNode && styleEnabled ? ele.pstyle('bounds-expansion').pfValue : [0]; // must use `display` prop only, as reading `compound.width()` causes recursion + // (other factors like width values will be considered later in this function anyway) + + var isDisplayed = function isDisplayed(ele) { + return ele.pstyle('display').value !== 'none'; + }; + + var displayed = !styleEnabled || isDisplayed(ele) // must take into account connected nodes b/c of implicit edge hiding on display:none node + && (!isEdge || isDisplayed(ele.source()) && isDisplayed(ele.target())); + + if (displayed) { + // displayed suffices, since we will find zero area eles anyway + var overlayOpacity = 0; + var overlayPadding = 0; + + if (styleEnabled && options.includeOverlays) { + overlayOpacity = ele.pstyle('overlay-opacity').value; + + if (overlayOpacity !== 0) { + overlayPadding = ele.pstyle('overlay-padding').value; + } + } + + var underlayOpacity = 0; + var underlayPadding = 0; + + if (styleEnabled && options.includeUnderlays) { + underlayOpacity = ele.pstyle('underlay-opacity').value; + + if (underlayOpacity !== 0) { + underlayPadding = ele.pstyle('underlay-padding').value; + } + } + + var padding = Math.max(overlayPadding, underlayPadding); + var w = 0; + var wHalf = 0; + + if (styleEnabled) { + w = ele.pstyle('width').pfValue; + wHalf = w / 2; + } + + if (isNode && options.includeNodes) { + var pos = ele.position(); + x = pos.x; + y = pos.y; + + var _w = ele.outerWidth(); + + var halfW = _w / 2; + var h = ele.outerHeight(); + var halfH = h / 2; // handle node dimensions + ///////////////////////// + + ex1 = x - halfW; + ex2 = x + halfW; + ey1 = y - halfH; + ey2 = y + halfH; + updateBounds(bounds, ex1, ey1, ex2, ey2); + } else if (isEdge && options.includeEdges) { + if (styleEnabled && !headless) { + var curveStyle = ele.pstyle('curve-style').strValue; // handle edge dimensions (rough box estimate) + ////////////////////////////////////////////// + + ex1 = Math.min(rstyle.srcX, rstyle.midX, rstyle.tgtX); + ex2 = Math.max(rstyle.srcX, rstyle.midX, rstyle.tgtX); + ey1 = Math.min(rstyle.srcY, rstyle.midY, rstyle.tgtY); + ey2 = Math.max(rstyle.srcY, rstyle.midY, rstyle.tgtY); // take into account edge width + + ex1 -= wHalf; + ex2 += wHalf; + ey1 -= wHalf; + ey2 += wHalf; + updateBounds(bounds, ex1, ey1, ex2, ey2); // precise edges + //////////////// + + if (curveStyle === 'haystack') { + var hpts = rstyle.haystackPts; + + if (hpts && hpts.length === 2) { + ex1 = hpts[0].x; + ey1 = hpts[0].y; + ex2 = hpts[1].x; + ey2 = hpts[1].y; + + if (ex1 > ex2) { + var temp = ex1; + ex1 = ex2; + ex2 = temp; + } + + if (ey1 > ey2) { + var _temp = ey1; + ey1 = ey2; + ey2 = _temp; + } + + updateBounds(bounds, ex1 - wHalf, ey1 - wHalf, ex2 + wHalf, ey2 + wHalf); + } + } else if (curveStyle === 'bezier' || curveStyle === 'unbundled-bezier' || curveStyle === 'segments' || curveStyle === 'taxi') { + var pts; + + switch (curveStyle) { + case 'bezier': + case 'unbundled-bezier': + pts = rstyle.bezierPts; + break; + + case 'segments': + case 'taxi': + pts = rstyle.linePts; + break; + } + + if (pts != null) { + for (var j = 0; j < pts.length; j++) { + var pt = pts[j]; + ex1 = pt.x - wHalf; + ex2 = pt.x + wHalf; + ey1 = pt.y - wHalf; + ey2 = pt.y + wHalf; + updateBounds(bounds, ex1, ey1, ex2, ey2); + } + } + } // bezier-like or segment-like edge + + } else { + // headless or style disabled + // fallback on source and target positions + ////////////////////////////////////////// + var n1 = ele.source(); + var n1pos = n1.position(); + var n2 = ele.target(); + var n2pos = n2.position(); + ex1 = n1pos.x; + ex2 = n2pos.x; + ey1 = n1pos.y; + ey2 = n2pos.y; + + if (ex1 > ex2) { + var _temp2 = ex1; + ex1 = ex2; + ex2 = _temp2; + } + + if (ey1 > ey2) { + var _temp3 = ey1; + ey1 = ey2; + ey2 = _temp3; + } // take into account edge width + + + ex1 -= wHalf; + ex2 += wHalf; + ey1 -= wHalf; + ey2 += wHalf; + updateBounds(bounds, ex1, ey1, ex2, ey2); + } // headless or style disabled + + } // edges + // handle edge arrow size + ///////////////////////// + + + if (styleEnabled && options.includeEdges && isEdge) { + updateBoundsFromArrow(bounds, ele, 'mid-source'); + updateBoundsFromArrow(bounds, ele, 'mid-target'); + updateBoundsFromArrow(bounds, ele, 'source'); + updateBoundsFromArrow(bounds, ele, 'target'); + } // ghost + //////// + + + if (styleEnabled) { + var ghost = ele.pstyle('ghost').value === 'yes'; + + if (ghost) { + var gx = ele.pstyle('ghost-offset-x').pfValue; + var gy = ele.pstyle('ghost-offset-y').pfValue; + updateBounds(bounds, bounds.x1 + gx, bounds.y1 + gy, bounds.x2 + gx, bounds.y2 + gy); + } + } // always store the body bounds separately from the labels + + + var bbBody = _p.bodyBounds = _p.bodyBounds || {}; + assignBoundingBox(bbBody, bounds); + expandBoundingBoxSides(bbBody, manualExpansion); + expandBoundingBox(bbBody, 1); // expand to work around browser dimension inaccuracies + // overlay + ////////// + + if (styleEnabled) { + ex1 = bounds.x1; + ex2 = bounds.x2; + ey1 = bounds.y1; + ey2 = bounds.y2; + updateBounds(bounds, ex1 - padding, ey1 - padding, ex2 + padding, ey2 + padding); + } // always store the body bounds separately from the labels + + + var bbOverlay = _p.overlayBounds = _p.overlayBounds || {}; + assignBoundingBox(bbOverlay, bounds); + expandBoundingBoxSides(bbOverlay, manualExpansion); + expandBoundingBox(bbOverlay, 1); // expand to work around browser dimension inaccuracies + // handle label dimensions + ////////////////////////// + + var bbLabels = _p.labelBounds = _p.labelBounds || {}; + + if (bbLabels.all != null) { + clearBoundingBox(bbLabels.all); + } else { + bbLabels.all = makeBoundingBox(); + } + + if (styleEnabled && options.includeLabels) { + if (options.includeMainLabels) { + updateBoundsFromLabel(bounds, ele, null); + } + + if (isEdge) { + if (options.includeSourceLabels) { + updateBoundsFromLabel(bounds, ele, 'source'); + } + + if (options.includeTargetLabels) { + updateBoundsFromLabel(bounds, ele, 'target'); + } + } + } // style enabled for labels + + } // if displayed + + + bounds.x1 = noninf(bounds.x1); + bounds.y1 = noninf(bounds.y1); + bounds.x2 = noninf(bounds.x2); + bounds.y2 = noninf(bounds.y2); + bounds.w = noninf(bounds.x2 - bounds.x1); + bounds.h = noninf(bounds.y2 - bounds.y1); + + if (bounds.w > 0 && bounds.h > 0 && displayed) { + expandBoundingBoxSides(bounds, manualExpansion); // expand bounds by 1 because antialiasing can increase the visual/effective size by 1 on all sides + + expandBoundingBox(bounds, 1); + } + + return bounds; + }; + + var getKey = function getKey(opts) { + var i = 0; + + var tf = function tf(val) { + return (val ? 1 : 0) << i++; + }; + + var key = 0; + key += tf(opts.incudeNodes); + key += tf(opts.includeEdges); + key += tf(opts.includeLabels); + key += tf(opts.includeMainLabels); + key += tf(opts.includeSourceLabels); + key += tf(opts.includeTargetLabels); + key += tf(opts.includeOverlays); + return key; + }; + + var getBoundingBoxPosKey = function getBoundingBoxPosKey(ele) { + if (ele.isEdge()) { + var p1 = ele.source().position(); + var p2 = ele.target().position(); + + var r = function r(x) { + return Math.round(x); + }; + + return hashIntsArray([r(p1.x), r(p1.y), r(p2.x), r(p2.y)]); + } else { + return 0; + } + }; + + var cachedBoundingBoxImpl = function cachedBoundingBoxImpl(ele, opts) { + var _p = ele._private; + var bb; + var isEdge = ele.isEdge(); + var key = opts == null ? defBbOptsKey : getKey(opts); + var usingDefOpts = key === defBbOptsKey; + var currPosKey = getBoundingBoxPosKey(ele); + var isPosKeySame = _p.bbCachePosKey === currPosKey; + var useCache = opts.useCache && isPosKeySame; + + var isDirty = function isDirty(ele) { + return ele._private.bbCache == null || ele._private.styleDirty; + }; + + var needRecalc = !useCache || isDirty(ele) || isEdge && isDirty(ele.source()) || isDirty(ele.target()); + + if (needRecalc) { + if (!isPosKeySame) { + ele.recalculateRenderedStyle(useCache); + } + + bb = boundingBoxImpl(ele, defBbOpts); + _p.bbCache = bb; + _p.bbCachePosKey = currPosKey; + } else { + bb = _p.bbCache; + } // not using def opts => need to build up bb from combination of sub bbs + + + if (!usingDefOpts) { + var isNode = ele.isNode(); + bb = makeBoundingBox(); + + if (opts.includeNodes && isNode || opts.includeEdges && !isNode) { + if (opts.includeOverlays) { + updateBoundsFromBox(bb, _p.overlayBounds); + } else { + updateBoundsFromBox(bb, _p.bodyBounds); + } + } + + if (opts.includeLabels) { + if (opts.includeMainLabels && (!isEdge || opts.includeSourceLabels && opts.includeTargetLabels)) { + updateBoundsFromBox(bb, _p.labelBounds.all); + } else { + if (opts.includeMainLabels) { + updateBoundsFromBox(bb, _p.labelBounds.mainRot); + } + + if (opts.includeSourceLabels) { + updateBoundsFromBox(bb, _p.labelBounds.sourceRot); + } + + if (opts.includeTargetLabels) { + updateBoundsFromBox(bb, _p.labelBounds.targetRot); + } + } + } + + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + } + + return bb; + }; + + var defBbOpts = { + includeNodes: true, + includeEdges: true, + includeLabels: true, + includeMainLabels: true, + includeSourceLabels: true, + includeTargetLabels: true, + includeOverlays: true, + includeUnderlays: true, + useCache: true + }; + var defBbOptsKey = getKey(defBbOpts); + var filledBbOpts = defaults$g(defBbOpts); + + elesfn$b.boundingBox = function (options) { + var bounds; // the main usecase is ele.boundingBox() for a single element with no/def options + // specified s.t. the cache is used, so check for this case to make it faster by + // avoiding the overhead of the rest of the function + + if (this.length === 1 && this[0]._private.bbCache != null && !this[0]._private.styleDirty && (options === undefined || options.useCache === undefined || options.useCache === true)) { + if (options === undefined) { + options = defBbOpts; + } else { + options = filledBbOpts(options); + } + + bounds = cachedBoundingBoxImpl(this[0], options); + } else { + bounds = makeBoundingBox(); + options = options || defBbOpts; + var opts = filledBbOpts(options); + var eles = this; + var cy = eles.cy(); + var styleEnabled = cy.styleEnabled(); + + if (styleEnabled) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _p = ele._private; + var currPosKey = getBoundingBoxPosKey(ele); + var isPosKeySame = _p.bbCachePosKey === currPosKey; + var useCache = opts.useCache && isPosKeySame && !_p.styleDirty; + ele.recalculateRenderedStyle(useCache); + } + } + + this.updateCompoundBounds(!options.useCache); + + for (var _i = 0; _i < eles.length; _i++) { + var _ele = eles[_i]; + updateBoundsFromBox(bounds, cachedBoundingBoxImpl(_ele, opts)); + } + } + + bounds.x1 = noninf(bounds.x1); + bounds.y1 = noninf(bounds.y1); + bounds.x2 = noninf(bounds.x2); + bounds.y2 = noninf(bounds.y2); + bounds.w = noninf(bounds.x2 - bounds.x1); + bounds.h = noninf(bounds.y2 - bounds.y1); + return bounds; + }; + + elesfn$b.dirtyBoundingBoxCache = function () { + for (var i = 0; i < this.length; i++) { + var _p = this[i]._private; + _p.bbCache = null; + _p.bbCachePosKey = null; + _p.bodyBounds = null; + _p.overlayBounds = null; + _p.labelBounds.all = null; + _p.labelBounds.source = null; + _p.labelBounds.target = null; + _p.labelBounds.main = null; + _p.labelBounds.sourceRot = null; + _p.labelBounds.targetRot = null; + _p.labelBounds.mainRot = null; + _p.arrowBounds.source = null; + _p.arrowBounds.target = null; + _p.arrowBounds['mid-source'] = null; + _p.arrowBounds['mid-target'] = null; + } + + this.emitAndNotify('bounds'); + return this; + }; // private helper to get bounding box for custom node positions + // - good for perf in certain cases but currently requires dirtying the rendered style + // - would be better to not modify the nodes but the nodes are read directly everywhere in the renderer... + // - try to use for only things like discrete layouts where the node position would change anyway + + + elesfn$b.boundingBoxAt = function (fn) { + var nodes = this.nodes(); + var cy = this.cy(); + var hasCompoundNodes = cy.hasCompoundNodes(); + var parents = cy.collection(); + + if (hasCompoundNodes) { + parents = nodes.filter(function (node) { + return node.isParent(); + }); + nodes = nodes.not(parents); + } + + if (plainObject(fn)) { + var obj = fn; + + fn = function fn() { + return obj; + }; + } + + var storeOldPos = function storeOldPos(node, i) { + return node._private.bbAtOldPos = fn(node, i); + }; + + var getOldPos = function getOldPos(node) { + return node._private.bbAtOldPos; + }; + + cy.startBatch(); + nodes.forEach(storeOldPos).silentPositions(fn); + + if (hasCompoundNodes) { + parents.dirtyCompoundBoundsCache(); + parents.dirtyBoundingBoxCache(); + parents.updateCompoundBounds(true); // force update b/c we're inside a batch cycle + } + + var bb = copyBoundingBox(this.boundingBox({ + useCache: false + })); + nodes.silentPositions(getOldPos); + + if (hasCompoundNodes) { + parents.dirtyCompoundBoundsCache(); + parents.dirtyBoundingBoxCache(); + parents.updateCompoundBounds(true); // force update b/c we're inside a batch cycle + } + + cy.endBatch(); + return bb; + }; + + fn$3.boundingbox = fn$3.bb = fn$3.boundingBox; + fn$3.renderedBoundingbox = fn$3.renderedBoundingBox; + var bounds = elesfn$b; + + var fn$2, elesfn$a; + fn$2 = elesfn$a = {}; + + var defineDimFns = function defineDimFns(opts) { + opts.uppercaseName = capitalize(opts.name); + opts.autoName = 'auto' + opts.uppercaseName; + opts.labelName = 'label' + opts.uppercaseName; + opts.outerName = 'outer' + opts.uppercaseName; + opts.uppercaseOuterName = capitalize(opts.outerName); + + fn$2[opts.name] = function dimImpl() { + var ele = this[0]; + var _p = ele._private; + var cy = _p.cy; + var styleEnabled = cy._private.styleEnabled; + + if (ele) { + if (styleEnabled) { + if (ele.isParent()) { + ele.updateCompoundBounds(); + return _p[opts.autoName] || 0; + } + + var d = ele.pstyle(opts.name); + + switch (d.strValue) { + case 'label': + ele.recalculateRenderedStyle(); + return _p.rstyle[opts.labelName] || 0; + + default: + return d.pfValue; + } + } else { + return 1; + } + } + }; + + fn$2['outer' + opts.uppercaseName] = function outerDimImpl() { + var ele = this[0]; + var _p = ele._private; + var cy = _p.cy; + var styleEnabled = cy._private.styleEnabled; + + if (ele) { + if (styleEnabled) { + var dim = ele[opts.name](); + var border = ele.pstyle('border-width').pfValue; // n.b. 1/2 each side + + var padding = 2 * ele.padding(); + return dim + border + padding; + } else { + return 1; + } + } + }; + + fn$2['rendered' + opts.uppercaseName] = function renderedDimImpl() { + var ele = this[0]; + + if (ele) { + var d = ele[opts.name](); + return d * this.cy().zoom(); + } + }; + + fn$2['rendered' + opts.uppercaseOuterName] = function renderedOuterDimImpl() { + var ele = this[0]; + + if (ele) { + var od = ele[opts.outerName](); + return od * this.cy().zoom(); + } + }; + }; + + defineDimFns({ + name: 'width' + }); + defineDimFns({ + name: 'height' + }); + + elesfn$a.padding = function () { + var ele = this[0]; + var _p = ele._private; + + if (ele.isParent()) { + ele.updateCompoundBounds(); + + if (_p.autoPadding !== undefined) { + return _p.autoPadding; + } else { + return ele.pstyle('padding').pfValue; + } + } else { + return ele.pstyle('padding').pfValue; + } + }; + + elesfn$a.paddedHeight = function () { + var ele = this[0]; + return ele.height() + 2 * ele.padding(); + }; + + elesfn$a.paddedWidth = function () { + var ele = this[0]; + return ele.width() + 2 * ele.padding(); + }; + + var widthHeight = elesfn$a; + + var ifEdge = function ifEdge(ele, getValue) { + if (ele.isEdge()) { + return getValue(ele); + } + }; + + var ifEdgeRenderedPosition = function ifEdgeRenderedPosition(ele, getPoint) { + if (ele.isEdge()) { + var cy = ele.cy(); + return modelToRenderedPosition(getPoint(ele), cy.zoom(), cy.pan()); + } + }; + + var ifEdgeRenderedPositions = function ifEdgeRenderedPositions(ele, getPoints) { + if (ele.isEdge()) { + var cy = ele.cy(); + var pan = cy.pan(); + var zoom = cy.zoom(); + return getPoints(ele).map(function (p) { + return modelToRenderedPosition(p, zoom, pan); + }); + } + }; + + var controlPoints = function controlPoints(ele) { + return ele.renderer().getControlPoints(ele); + }; + + var segmentPoints = function segmentPoints(ele) { + return ele.renderer().getSegmentPoints(ele); + }; + + var sourceEndpoint = function sourceEndpoint(ele) { + return ele.renderer().getSourceEndpoint(ele); + }; + + var targetEndpoint = function targetEndpoint(ele) { + return ele.renderer().getTargetEndpoint(ele); + }; + + var midpoint = function midpoint(ele) { + return ele.renderer().getEdgeMidpoint(ele); + }; + + var pts = { + controlPoints: { + get: controlPoints, + mult: true + }, + segmentPoints: { + get: segmentPoints, + mult: true + }, + sourceEndpoint: { + get: sourceEndpoint + }, + targetEndpoint: { + get: targetEndpoint + }, + midpoint: { + get: midpoint + } + }; + + var renderedName = function renderedName(name) { + return 'rendered' + name[0].toUpperCase() + name.substr(1); + }; + + var edgePoints = Object.keys(pts).reduce(function (obj, name) { + var spec = pts[name]; + var rName = renderedName(name); + + obj[name] = function () { + return ifEdge(this, spec.get); + }; + + if (spec.mult) { + obj[rName] = function () { + return ifEdgeRenderedPositions(this, spec.get); + }; + } else { + obj[rName] = function () { + return ifEdgeRenderedPosition(this, spec.get); + }; + } + + return obj; + }, {}); + + var dimensions = extend({}, position, bounds, widthHeight, edgePoints); + + /*! + Event object based on jQuery events, MIT license + + https://jquery.org/license/ + https://tldrlegal.com/license/mit-license + https://github.com/jquery/jquery/blob/master/src/event.js + */ + var Event = function Event(src, props) { + this.recycle(src, props); + }; + + function returnFalse() { + return false; + } + + function returnTrue() { + return true; + } // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html + + + Event.prototype = { + instanceString: function instanceString() { + return 'event'; + }, + recycle: function recycle(src, props) { + this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = returnFalse; + + if (src != null && src.preventDefault) { + // Browser Event object + this.type = src.type; // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + + this.isDefaultPrevented = src.defaultPrevented ? returnTrue : returnFalse; + } else if (src != null && src.type) { + // Plain object containing all event details + props = src; + } else { + // Event string + this.type = src; + } // Put explicitly provided properties onto the event object + + + if (props != null) { + // more efficient to manually copy fields we use + this.originalEvent = props.originalEvent; + this.type = props.type != null ? props.type : this.type; + this.cy = props.cy; + this.target = props.target; + this.position = props.position; + this.renderedPosition = props.renderedPosition; + this.namespace = props.namespace; + this.layout = props.layout; + } + + if (this.cy != null && this.position != null && this.renderedPosition == null) { + // create a rendered position based on the passed position + var pos = this.position; + var zoom = this.cy.zoom(); + var pan = this.cy.pan(); + this.renderedPosition = { + x: pos.x * zoom + pan.x, + y: pos.y * zoom + pan.y + }; + } // Create a timestamp if incoming event doesn't have one + + + this.timeStamp = src && src.timeStamp || Date.now(); + }, + preventDefault: function preventDefault() { + this.isDefaultPrevented = returnTrue; + var e = this.originalEvent; + + if (!e) { + return; + } // if preventDefault exists run it on the original event + + + if (e.preventDefault) { + e.preventDefault(); + } + }, + stopPropagation: function stopPropagation() { + this.isPropagationStopped = returnTrue; + var e = this.originalEvent; + + if (!e) { + return; + } // if stopPropagation exists run it on the original event + + + if (e.stopPropagation) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function stopImmediatePropagation() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse + }; + + var eventRegex = /^([^.]+)(\.(?:[^.]+))?$/; // regex for matching event strings (e.g. "click.namespace") + + var universalNamespace = '.*'; // matches as if no namespace specified and prevents users from unbinding accidentally + + var defaults$8 = { + qualifierCompare: function qualifierCompare(q1, q2) { + return q1 === q2; + }, + eventMatches: function + /*context, listener, eventObj*/ + eventMatches() { + return true; + }, + addEventFields: function + /*context, evt*/ + addEventFields() {}, + callbackContext: function callbackContext(context + /*, listener, eventObj*/ + ) { + return context; + }, + beforeEmit: function + /* context, listener, eventObj */ + beforeEmit() {}, + afterEmit: function + /* context, listener, eventObj */ + afterEmit() {}, + bubble: function + /*context*/ + bubble() { + return false; + }, + parent: function + /*context*/ + parent() { + return null; + }, + context: null + }; + var defaultsKeys = Object.keys(defaults$8); + var emptyOpts = {}; + + function Emitter() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : emptyOpts; + var context = arguments.length > 1 ? arguments[1] : undefined; + + // micro-optimisation vs Object.assign() -- reduces Element instantiation time + for (var i = 0; i < defaultsKeys.length; i++) { + var key = defaultsKeys[i]; + this[key] = opts[key] || defaults$8[key]; + } + + this.context = context || this.context; + this.listeners = []; + this.emitting = 0; + } + + var p = Emitter.prototype; + + var forEachEvent = function forEachEvent(self, handler, events, qualifier, callback, conf, confOverrides) { + if (fn$6(qualifier)) { + callback = qualifier; + qualifier = null; + } + + if (confOverrides) { + if (conf == null) { + conf = confOverrides; + } else { + conf = extend({}, conf, confOverrides); + } + } + + var eventList = array(events) ? events : events.split(/\s+/); + + for (var i = 0; i < eventList.length; i++) { + var evt = eventList[i]; + + if (emptyString(evt)) { + continue; + } + + var match = evt.match(eventRegex); // type[.namespace] + + if (match) { + var type = match[1]; + var namespace = match[2] ? match[2] : null; + var ret = handler(self, evt, type, namespace, qualifier, callback, conf); + + if (ret === false) { + break; + } // allow exiting early + + } + } + }; + + var makeEventObj = function makeEventObj(self, obj) { + self.addEventFields(self.context, obj); + return new Event(obj.type, obj); + }; + + var forEachEventObj = function forEachEventObj(self, handler, events) { + if (event(events)) { + handler(self, events); + return; + } else if (plainObject(events)) { + handler(self, makeEventObj(self, events)); + return; + } + + var eventList = array(events) ? events : events.split(/\s+/); + + for (var i = 0; i < eventList.length; i++) { + var evt = eventList[i]; + + if (emptyString(evt)) { + continue; + } + + var match = evt.match(eventRegex); // type[.namespace] + + if (match) { + var type = match[1]; + var namespace = match[2] ? match[2] : null; + var eventObj = makeEventObj(self, { + type: type, + namespace: namespace, + target: self.context + }); + handler(self, eventObj); + } + } + }; + + p.on = p.addListener = function (events, qualifier, callback, conf, confOverrides) { + forEachEvent(this, function (self, event, type, namespace, qualifier, callback, conf) { + if (fn$6(callback)) { + self.listeners.push({ + event: event, + // full event string + callback: callback, + // callback to run + type: type, + // the event type (e.g. 'click') + namespace: namespace, + // the event namespace (e.g. ".foo") + qualifier: qualifier, + // a restriction on whether to match this emitter + conf: conf // additional configuration + + }); + } + }, events, qualifier, callback, conf, confOverrides); + return this; + }; + + p.one = function (events, qualifier, callback, conf) { + return this.on(events, qualifier, callback, conf, { + one: true + }); + }; + + p.removeListener = p.off = function (events, qualifier, callback, conf) { + var _this = this; + + if (this.emitting !== 0) { + this.listeners = copyArray$1(this.listeners); + } + + var listeners = this.listeners; + + var _loop = function _loop(i) { + var listener = listeners[i]; + forEachEvent(_this, function (self, event, type, namespace, qualifier, callback + /*, conf*/ + ) { + if ((listener.type === type || events === '*') && (!namespace && listener.namespace !== '.*' || listener.namespace === namespace) && (!qualifier || self.qualifierCompare(listener.qualifier, qualifier)) && (!callback || listener.callback === callback)) { + listeners.splice(i, 1); + return false; + } + }, events, qualifier, callback, conf); + }; + + for (var i = listeners.length - 1; i >= 0; i--) { + _loop(i); + } + + return this; + }; + + p.removeAllListeners = function () { + return this.removeListener('*'); + }; + + p.emit = p.trigger = function (events, extraParams, manualCallback) { + var listeners = this.listeners; + var numListenersBeforeEmit = listeners.length; + this.emitting++; + + if (!array(extraParams)) { + extraParams = [extraParams]; + } + + forEachEventObj(this, function (self, eventObj) { + if (manualCallback != null) { + listeners = [{ + event: eventObj.event, + type: eventObj.type, + namespace: eventObj.namespace, + callback: manualCallback + }]; + numListenersBeforeEmit = listeners.length; + } + + var _loop2 = function _loop2(i) { + var listener = listeners[i]; + + if (listener.type === eventObj.type && (!listener.namespace || listener.namespace === eventObj.namespace || listener.namespace === universalNamespace) && self.eventMatches(self.context, listener, eventObj)) { + var args = [eventObj]; + + if (extraParams != null) { + push(args, extraParams); + } + + self.beforeEmit(self.context, listener, eventObj); + + if (listener.conf && listener.conf.one) { + self.listeners = self.listeners.filter(function (l) { + return l !== listener; + }); + } + + var context = self.callbackContext(self.context, listener, eventObj); + var ret = listener.callback.apply(context, args); + self.afterEmit(self.context, listener, eventObj); + + if (ret === false) { + eventObj.stopPropagation(); + eventObj.preventDefault(); + } + } // if listener matches + + }; + + for (var i = 0; i < numListenersBeforeEmit; i++) { + _loop2(i); + } // for listener + + + if (self.bubble(self.context) && !eventObj.isPropagationStopped()) { + self.parent(self.context).emit(eventObj, extraParams); + } + }, events); + this.emitting--; + return this; + }; + + var emitterOptions$1 = { + qualifierCompare: function qualifierCompare(selector1, selector2) { + if (selector1 == null || selector2 == null) { + return selector1 == null && selector2 == null; + } else { + return selector1.sameText(selector2); + } + }, + eventMatches: function eventMatches(ele, listener, eventObj) { + var selector = listener.qualifier; + + if (selector != null) { + return ele !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target); + } + + return true; + }, + addEventFields: function addEventFields(ele, evt) { + evt.cy = ele.cy(); + evt.target = ele; + }, + callbackContext: function callbackContext(ele, listener, eventObj) { + return listener.qualifier != null ? eventObj.target : ele; + }, + beforeEmit: function beforeEmit(context, listener + /*, eventObj*/ + ) { + if (listener.conf && listener.conf.once) { + listener.conf.onceCollection.removeListener(listener.event, listener.qualifier, listener.callback); + } + }, + bubble: function bubble() { + return true; + }, + parent: function parent(ele) { + return ele.isChild() ? ele.parent() : ele.cy(); + } + }; + + var argSelector$1 = function argSelector(arg) { + if (string(arg)) { + return new Selector(arg); + } else { + return arg; + } + }; + + var elesfn$9 = { + createEmitter: function createEmitter() { + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var _p = ele._private; + + if (!_p.emitter) { + _p.emitter = new Emitter(emitterOptions$1, ele); + } + } + + return this; + }, + emitter: function emitter() { + return this._private.emitter; + }, + on: function on(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().on(events, argSel, callback); + } + + return this; + }, + removeListener: function removeListener(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().removeListener(events, argSel, callback); + } + + return this; + }, + removeAllListeners: function removeAllListeners() { + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().removeAllListeners(); + } + + return this; + }, + one: function one(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().one(events, argSel, callback); + } + + return this; + }, + once: function once(events, selector, callback) { + var argSel = argSelector$1(selector); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().on(events, argSel, callback, { + once: true, + onceCollection: this + }); + } + }, + emit: function emit(events, extraParams) { + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + ele.emitter().emit(events, extraParams); + } + + return this; + }, + emitAndNotify: function emitAndNotify(event, extraParams) { + // for internal use only + if (this.length === 0) { + return; + } // empty collections don't need to notify anything + // notify renderer + + + this.cy().notify(event, this); + this.emit(event, extraParams); + return this; + } + }; + define.eventAliasesOn(elesfn$9); + + var elesfn$8 = { + nodes: function nodes(selector) { + return this.filter(function (ele) { + return ele.isNode(); + }).filter(selector); + }, + edges: function edges(selector) { + return this.filter(function (ele) { + return ele.isEdge(); + }).filter(selector); + }, + // internal helper to get nodes and edges as separate collections with single iteration over elements + byGroup: function byGroup() { + var nodes = this.spawn(); + var edges = this.spawn(); + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + + if (ele.isNode()) { + nodes.push(ele); + } else { + edges.push(ele); + } + } + + return { + nodes: nodes, + edges: edges + }; + }, + filter: function filter(_filter, thisArg) { + if (_filter === undefined) { + // check this first b/c it's the most common/performant case + return this; + } else if (string(_filter) || elementOrCollection(_filter)) { + return new Selector(_filter).filter(this); + } else if (fn$6(_filter)) { + var filterEles = this.spawn(); + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var include = thisArg ? _filter.apply(thisArg, [ele, i, eles]) : _filter(ele, i, eles); + + if (include) { + filterEles.push(ele); + } + } + + return filterEles; + } + + return this.spawn(); // if not handled by above, give 'em an empty collection + }, + not: function not(toRemove) { + if (!toRemove) { + return this; + } else { + if (string(toRemove)) { + toRemove = this.filter(toRemove); + } + + var elements = this.spawn(); + + for (var i = 0; i < this.length; i++) { + var element = this[i]; + var remove = toRemove.has(element); + + if (!remove) { + elements.push(element); + } + } + + return elements; + } + }, + absoluteComplement: function absoluteComplement() { + var cy = this.cy(); + return cy.mutableElements().not(this); + }, + intersect: function intersect(other) { + // if a selector is specified, then filter by it instead + if (string(other)) { + var selector = other; + return this.filter(selector); + } + + var elements = this.spawn(); + var col1 = this; + var col2 = other; + var col1Smaller = this.length < other.length; + var colS = col1Smaller ? col1 : col2; + var colL = col1Smaller ? col2 : col1; + + for (var i = 0; i < colS.length; i++) { + var ele = colS[i]; + + if (colL.has(ele)) { + elements.push(ele); + } + } + + return elements; + }, + xor: function xor(other) { + var cy = this._private.cy; + + if (string(other)) { + other = cy.$(other); + } + + var elements = this.spawn(); + var col1 = this; + var col2 = other; + + var add = function add(col, other) { + for (var i = 0; i < col.length; i++) { + var ele = col[i]; + var id = ele._private.data.id; + var inOther = other.hasElementWithId(id); + + if (!inOther) { + elements.push(ele); + } + } + }; + + add(col1, col2); + add(col2, col1); + return elements; + }, + diff: function diff(other) { + var cy = this._private.cy; + + if (string(other)) { + other = cy.$(other); + } + + var left = this.spawn(); + var right = this.spawn(); + var both = this.spawn(); + var col1 = this; + var col2 = other; + + var add = function add(col, other, retEles) { + for (var i = 0; i < col.length; i++) { + var ele = col[i]; + var id = ele._private.data.id; + var inOther = other.hasElementWithId(id); + + if (inOther) { + both.merge(ele); + } else { + retEles.push(ele); + } + } + }; + + add(col1, col2, left); + add(col2, col1, right); + return { + left: left, + right: right, + both: both + }; + }, + add: function add(toAdd) { + var cy = this._private.cy; + + if (!toAdd) { + return this; + } + + if (string(toAdd)) { + var selector = toAdd; + toAdd = cy.mutableElements().filter(selector); + } + + var elements = this.spawnSelf(); + + for (var i = 0; i < toAdd.length; i++) { + var ele = toAdd[i]; + var add = !this.has(ele); + + if (add) { + elements.push(ele); + } + } + + return elements; + }, + // in place merge on calling collection + merge: function merge(toAdd) { + var _p = this._private; + var cy = _p.cy; + + if (!toAdd) { + return this; + } + + if (toAdd && string(toAdd)) { + var selector = toAdd; + toAdd = cy.mutableElements().filter(selector); + } + + var map = _p.map; + + for (var i = 0; i < toAdd.length; i++) { + var toAddEle = toAdd[i]; + var id = toAddEle._private.data.id; + var add = !map.has(id); + + if (add) { + var index = this.length++; + this[index] = toAddEle; + map.set(id, { + ele: toAddEle, + index: index + }); + } + } + + return this; // chaining + }, + unmergeAt: function unmergeAt(i) { + var ele = this[i]; + var id = ele.id(); + var _p = this._private; + var map = _p.map; // remove ele + + this[i] = undefined; + map["delete"](id); + var unmergedLastEle = i === this.length - 1; // replace empty spot with last ele in collection + + if (this.length > 1 && !unmergedLastEle) { + var lastEleI = this.length - 1; + var lastEle = this[lastEleI]; + var lastEleId = lastEle._private.data.id; + this[lastEleI] = undefined; + this[i] = lastEle; + map.set(lastEleId, { + ele: lastEle, + index: i + }); + } // the collection is now 1 ele smaller + + + this.length--; + return this; + }, + // remove single ele in place in calling collection + unmergeOne: function unmergeOne(ele) { + ele = ele[0]; + var _p = this._private; + var id = ele._private.data.id; + var map = _p.map; + var entry = map.get(id); + + if (!entry) { + return this; // no need to remove + } + + var i = entry.index; + this.unmergeAt(i); + return this; + }, + // remove eles in place on calling collection + unmerge: function unmerge(toRemove) { + var cy = this._private.cy; + + if (!toRemove) { + return this; + } + + if (toRemove && string(toRemove)) { + var selector = toRemove; + toRemove = cy.mutableElements().filter(selector); + } + + for (var i = 0; i < toRemove.length; i++) { + this.unmergeOne(toRemove[i]); + } + + return this; // chaining + }, + unmergeBy: function unmergeBy(toRmFn) { + for (var i = this.length - 1; i >= 0; i--) { + var ele = this[i]; + + if (toRmFn(ele)) { + this.unmergeAt(i); + } + } + + return this; + }, + map: function map(mapFn, thisArg) { + var arr = []; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var ret = thisArg ? mapFn.apply(thisArg, [ele, i, eles]) : mapFn(ele, i, eles); + arr.push(ret); + } + + return arr; + }, + reduce: function reduce(fn, initialValue) { + var val = initialValue; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + val = fn(val, eles[i], i, eles); + } + + return val; + }, + max: function max(valFn, thisArg) { + var max = -Infinity; + var maxEle; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var val = thisArg ? valFn.apply(thisArg, [ele, i, eles]) : valFn(ele, i, eles); + + if (val > max) { + max = val; + maxEle = ele; + } + } + + return { + value: max, + ele: maxEle + }; + }, + min: function min(valFn, thisArg) { + var min = Infinity; + var minEle; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var val = thisArg ? valFn.apply(thisArg, [ele, i, eles]) : valFn(ele, i, eles); + + if (val < min) { + min = val; + minEle = ele; + } + } + + return { + value: min, + ele: minEle + }; + } + }; // aliases + + var fn$1 = elesfn$8; + fn$1['u'] = fn$1['|'] = fn$1['+'] = fn$1.union = fn$1.or = fn$1.add; + fn$1['\\'] = fn$1['!'] = fn$1['-'] = fn$1.difference = fn$1.relativeComplement = fn$1.subtract = fn$1.not; + fn$1['n'] = fn$1['&'] = fn$1['.'] = fn$1.and = fn$1.intersection = fn$1.intersect; + fn$1['^'] = fn$1['(+)'] = fn$1['(-)'] = fn$1.symmetricDifference = fn$1.symdiff = fn$1.xor; + fn$1.fnFilter = fn$1.filterFn = fn$1.stdFilter = fn$1.filter; + fn$1.complement = fn$1.abscomp = fn$1.absoluteComplement; + + var elesfn$7 = { + isNode: function isNode() { + return this.group() === 'nodes'; + }, + isEdge: function isEdge() { + return this.group() === 'edges'; + }, + isLoop: function isLoop() { + return this.isEdge() && this.source()[0] === this.target()[0]; + }, + isSimple: function isSimple() { + return this.isEdge() && this.source()[0] !== this.target()[0]; + }, + group: function group() { + var ele = this[0]; + + if (ele) { + return ele._private.group; + } + } + }; + + /** + * Elements are drawn in a specific order based on compound depth (low to high), the element type (nodes above edges), + * and z-index (low to high). These styles affect how this applies: + * + * z-compound-depth: May be `bottom | orphan | auto | top`. The first drawn is `bottom`, then `orphan` which is the + * same depth as the root of the compound graph, followed by the default value `auto` which draws in order from + * root to leaves of the compound graph. The last drawn is `top`. + * z-index-compare: May be `auto | manual`. The default value is `auto` which always draws edges under nodes. + * `manual` ignores this convention and draws based on the `z-index` value setting. + * z-index: An integer value that affects the relative draw order of elements. In general, an element with a higher + * `z-index` will be drawn on top of an element with a lower `z-index`. + */ + + var zIndexSort = function zIndexSort(a, b) { + var cy = a.cy(); + var hasCompoundNodes = cy.hasCompoundNodes(); + + function getDepth(ele) { + var style = ele.pstyle('z-compound-depth'); + + if (style.value === 'auto') { + return hasCompoundNodes ? ele.zDepth() : 0; + } else if (style.value === 'bottom') { + return -1; + } else if (style.value === 'top') { + return MAX_INT$1; + } // 'orphan' + + + return 0; + } + + var depthDiff = getDepth(a) - getDepth(b); + + if (depthDiff !== 0) { + return depthDiff; + } + + function getEleDepth(ele) { + var style = ele.pstyle('z-index-compare'); + + if (style.value === 'auto') { + return ele.isNode() ? 1 : 0; + } // 'manual' + + + return 0; + } + + var eleDiff = getEleDepth(a) - getEleDepth(b); + + if (eleDiff !== 0) { + return eleDiff; + } + + var zDiff = a.pstyle('z-index').value - b.pstyle('z-index').value; + + if (zDiff !== 0) { + return zDiff; + } // compare indices in the core (order added to graph w/ last on top) + + + return a.poolIndex() - b.poolIndex(); + }; + + var elesfn$6 = { + forEach: function forEach(fn, thisArg) { + if (fn$6(fn)) { + var N = this.length; + + for (var i = 0; i < N; i++) { + var ele = this[i]; + var ret = thisArg ? fn.apply(thisArg, [ele, i, this]) : fn(ele, i, this); + + if (ret === false) { + break; + } // exit each early on return false + + } + } + + return this; + }, + toArray: function toArray() { + var array = []; + + for (var i = 0; i < this.length; i++) { + array.push(this[i]); + } + + return array; + }, + slice: function slice(start, end) { + var array = []; + var thisSize = this.length; + + if (end == null) { + end = thisSize; + } + + if (start == null) { + start = 0; + } + + if (start < 0) { + start = thisSize + start; + } + + if (end < 0) { + end = thisSize + end; + } + + for (var i = start; i >= 0 && i < end && i < thisSize; i++) { + array.push(this[i]); + } + + return this.spawn(array); + }, + size: function size() { + return this.length; + }, + eq: function eq(i) { + return this[i] || this.spawn(); + }, + first: function first() { + return this[0] || this.spawn(); + }, + last: function last() { + return this[this.length - 1] || this.spawn(); + }, + empty: function empty() { + return this.length === 0; + }, + nonempty: function nonempty() { + return !this.empty(); + }, + sort: function sort(sortFn) { + if (!fn$6(sortFn)) { + return this; + } + + var sorted = this.toArray().sort(sortFn); + return this.spawn(sorted); + }, + sortByZIndex: function sortByZIndex() { + return this.sort(zIndexSort); + }, + zDepth: function zDepth() { + var ele = this[0]; + + if (!ele) { + return undefined; + } // let cy = ele.cy(); + + + var _p = ele._private; + var group = _p.group; + + if (group === 'nodes') { + var depth = _p.data.parent ? ele.parents().size() : 0; + + if (!ele.isParent()) { + return MAX_INT$1 - 1; // childless nodes always on top + } + + return depth; + } else { + var src = _p.source; + var tgt = _p.target; + var srcDepth = src.zDepth(); + var tgtDepth = tgt.zDepth(); + return Math.max(srcDepth, tgtDepth, 0); // depth of deepest parent + } + } + }; + elesfn$6.each = elesfn$6.forEach; + + var defineSymbolIterator = function defineSymbolIterator() { + var typeofUndef = "undefined" ; + var isIteratorSupported = (typeof Symbol === "undefined" ? "undefined" : _typeof(Symbol)) != typeofUndef && _typeof(Symbol.iterator) != typeofUndef; // eslint-disable-line no-undef + + if (isIteratorSupported) { + elesfn$6[Symbol.iterator] = function () { + var _this = this; + + // eslint-disable-line no-undef + var entry = { + value: undefined, + done: false + }; + var i = 0; + var length = this.length; + return _defineProperty$1({ + next: function next() { + if (i < length) { + entry.value = _this[i++]; + } else { + entry.value = undefined; + entry.done = true; + } + + return entry; + } + }, Symbol.iterator, function () { + // eslint-disable-line no-undef + return this; + }); + }; + } + }; + + defineSymbolIterator(); + + var getLayoutDimensionOptions = defaults$g({ + nodeDimensionsIncludeLabels: false + }); + var elesfn$5 = { + // Calculates and returns node dimensions { x, y } based on options given + layoutDimensions: function layoutDimensions(options) { + options = getLayoutDimensionOptions(options); + var dims; + + if (!this.takesUpSpace()) { + dims = { + w: 0, + h: 0 + }; + } else if (options.nodeDimensionsIncludeLabels) { + var bbDim = this.boundingBox(); + dims = { + w: bbDim.w, + h: bbDim.h + }; + } else { + dims = { + w: this.outerWidth(), + h: this.outerHeight() + }; + } // sanitise the dimensions for external layouts (avoid division by zero) + + + if (dims.w === 0 || dims.h === 0) { + dims.w = dims.h = 1; + } + + return dims; + }, + // using standard layout options, apply position function (w/ or w/o animation) + layoutPositions: function layoutPositions(layout, options, fn) { + var nodes = this.nodes().filter(function (n) { + return !n.isParent(); + }); + var cy = this.cy(); + var layoutEles = options.eles; // nodes & edges + + var getMemoizeKey = function getMemoizeKey(node) { + return node.id(); + }; + + var fnMem = memoize$1(fn, getMemoizeKey); // memoized version of position function + + layout.emit({ + type: 'layoutstart', + layout: layout + }); + layout.animations = []; + + var calculateSpacing = function calculateSpacing(spacing, nodesBb, pos) { + var center = { + x: nodesBb.x1 + nodesBb.w / 2, + y: nodesBb.y1 + nodesBb.h / 2 + }; + var spacingVector = { + // scale from center of bounding box (not necessarily 0,0) + x: (pos.x - center.x) * spacing, + y: (pos.y - center.y) * spacing + }; + return { + x: center.x + spacingVector.x, + y: center.y + spacingVector.y + }; + }; + + var useSpacingFactor = options.spacingFactor && options.spacingFactor !== 1; + + var spacingBb = function spacingBb() { + if (!useSpacingFactor) { + return null; + } + + var bb = makeBoundingBox(); + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var pos = fnMem(node, i); + expandBoundingBoxByPoint(bb, pos.x, pos.y); + } + + return bb; + }; + + var bb = spacingBb(); + var getFinalPos = memoize$1(function (node, i) { + var newPos = fnMem(node, i); + + if (useSpacingFactor) { + var spacing = Math.abs(options.spacingFactor); + newPos = calculateSpacing(spacing, bb, newPos); + } + + if (options.transform != null) { + newPos = options.transform(node, newPos); + } + + return newPos; + }, getMemoizeKey); + + if (options.animate) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var newPos = getFinalPos(node, i); + var animateNode = options.animateFilter == null || options.animateFilter(node, i); + + if (animateNode) { + var ani = node.animation({ + position: newPos, + duration: options.animationDuration, + easing: options.animationEasing + }); + layout.animations.push(ani); + } else { + node.position(newPos); + } + } + + if (options.fit) { + var fitAni = cy.animation({ + fit: { + boundingBox: layoutEles.boundingBoxAt(getFinalPos), + padding: options.padding + }, + duration: options.animationDuration, + easing: options.animationEasing + }); + layout.animations.push(fitAni); + } else if (options.zoom !== undefined && options.pan !== undefined) { + var zoomPanAni = cy.animation({ + zoom: options.zoom, + pan: options.pan, + duration: options.animationDuration, + easing: options.animationEasing + }); + layout.animations.push(zoomPanAni); + } + + layout.animations.forEach(function (ani) { + return ani.play(); + }); + layout.one('layoutready', options.ready); + layout.emit({ + type: 'layoutready', + layout: layout + }); + Promise$1.all(layout.animations.map(function (ani) { + return ani.promise(); + })).then(function () { + layout.one('layoutstop', options.stop); + layout.emit({ + type: 'layoutstop', + layout: layout + }); + }); + } else { + nodes.positions(getFinalPos); + + if (options.fit) { + cy.fit(options.eles, options.padding); + } + + if (options.zoom != null) { + cy.zoom(options.zoom); + } + + if (options.pan) { + cy.pan(options.pan); + } + + layout.one('layoutready', options.ready); + layout.emit({ + type: 'layoutready', + layout: layout + }); + layout.one('layoutstop', options.stop); + layout.emit({ + type: 'layoutstop', + layout: layout + }); + } + + return this; // chaining + }, + layout: function layout(options) { + var cy = this.cy(); + return cy.makeLayout(extend({}, options, { + eles: this + })); + } + }; // aliases: + + elesfn$5.createLayout = elesfn$5.makeLayout = elesfn$5.layout; + + function styleCache(key, fn, ele) { + var _p = ele._private; + var cache = _p.styleCache = _p.styleCache || []; + var val; + + if ((val = cache[key]) != null) { + return val; + } else { + val = cache[key] = fn(ele); + return val; + } + } + + function cacheStyleFunction(key, fn) { + key = hashString(key); + return function cachedStyleFunction(ele) { + return styleCache(key, fn, ele); + }; + } + + function cachePrototypeStyleFunction(key, fn) { + key = hashString(key); + + var selfFn = function selfFn(ele) { + return fn.call(ele); + }; + + return function cachedPrototypeStyleFunction() { + var ele = this[0]; + + if (ele) { + return styleCache(key, selfFn, ele); + } + }; + } + + var elesfn$4 = { + recalculateRenderedStyle: function recalculateRenderedStyle(useCache) { + var cy = this.cy(); + var renderer = cy.renderer(); + var styleEnabled = cy.styleEnabled(); + + if (renderer && styleEnabled) { + renderer.recalculateRenderedStyle(this, useCache); + } + + return this; + }, + dirtyStyleCache: function dirtyStyleCache() { + var cy = this.cy(); + + var dirty = function dirty(ele) { + return ele._private.styleCache = null; + }; + + if (cy.hasCompoundNodes()) { + var eles; + eles = this.spawnSelf().merge(this.descendants()).merge(this.parents()); + eles.merge(eles.connectedEdges()); + eles.forEach(dirty); + } else { + this.forEach(function (ele) { + dirty(ele); + ele.connectedEdges().forEach(dirty); + }); + } + + return this; + }, + // fully updates (recalculates) the style for the elements + updateStyle: function updateStyle(notifyRenderer) { + var cy = this._private.cy; + + if (!cy.styleEnabled()) { + return this; + } + + if (cy.batching()) { + var bEles = cy._private.batchStyleEles; + bEles.merge(this); + return this; // chaining and exit early when batching + } + + var hasCompounds = cy.hasCompoundNodes(); + var updatedEles = this; + notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false; + + if (hasCompounds) { + // then add everything up and down for compound selector checks + updatedEles = this.spawnSelf().merge(this.descendants()).merge(this.parents()); + } // let changedEles = style.apply( updatedEles ); + + + var changedEles = updatedEles; + + if (notifyRenderer) { + changedEles.emitAndNotify('style'); // let renderer know we changed style + } else { + changedEles.emit('style'); // just fire the event + } + + updatedEles.forEach(function (ele) { + return ele._private.styleDirty = true; + }); + return this; // chaining + }, + // private: clears dirty flag and recalculates style + cleanStyle: function cleanStyle() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return; + } + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + + if (ele._private.styleDirty) { + // n.b. this flag should be set before apply() to avoid potential infinite recursion + ele._private.styleDirty = false; + cy.style().apply(ele); + } + } + }, + // get the internal parsed style object for the specified property + parsedStyle: function parsedStyle(property) { + var includeNonDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var ele = this[0]; + var cy = ele.cy(); + + if (!cy.styleEnabled()) { + return; + } + + if (ele) { + this.cleanStyle(); + var overriddenStyle = ele._private.style[property]; + + if (overriddenStyle != null) { + return overriddenStyle; + } else if (includeNonDefault) { + return cy.style().getDefaultProperty(property); + } else { + return null; + } + } + }, + numericStyle: function numericStyle(property) { + var ele = this[0]; + + if (!ele.cy().styleEnabled()) { + return; + } + + if (ele) { + var pstyle = ele.pstyle(property); + return pstyle.pfValue !== undefined ? pstyle.pfValue : pstyle.value; + } + }, + numericStyleUnits: function numericStyleUnits(property) { + var ele = this[0]; + + if (!ele.cy().styleEnabled()) { + return; + } + + if (ele) { + return ele.pstyle(property).units; + } + }, + // get the specified css property as a rendered value (i.e. on-screen value) + // or get the whole rendered style if no property specified (NB doesn't allow setting) + renderedStyle: function renderedStyle(property) { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return this; + } + + var ele = this[0]; + + if (ele) { + return cy.style().getRenderedStyle(ele, property); + } + }, + // read the calculated css style of the element or override the style (via a bypass) + style: function style(name, value) { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return this; + } + + var updateTransitions = false; + var style = cy.style(); + + if (plainObject(name)) { + // then extend the bypass + var props = name; + style.applyBypass(this, props, updateTransitions); + this.emitAndNotify('style'); // let the renderer know we've updated style + } else if (string(name)) { + if (value === undefined) { + // then get the property from the style + var ele = this[0]; + + if (ele) { + return style.getStylePropertyValue(ele, name); + } else { + // empty collection => can't get any value + return; + } + } else { + // then set the bypass with the property value + style.applyBypass(this, name, value, updateTransitions); + this.emitAndNotify('style'); // let the renderer know we've updated style + } + } else if (name === undefined) { + var _ele = this[0]; + + if (_ele) { + return style.getRawStyle(_ele); + } else { + // empty collection => can't get any value + return; + } + } + + return this; // chaining + }, + removeStyle: function removeStyle(names) { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return this; + } + + var updateTransitions = false; + var style = cy.style(); + var eles = this; + + if (names === undefined) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + style.removeAllBypasses(ele, updateTransitions); + } + } else { + names = names.split(/\s+/); + + for (var _i = 0; _i < eles.length; _i++) { + var _ele2 = eles[_i]; + style.removeBypasses(_ele2, names, updateTransitions); + } + } + + this.emitAndNotify('style'); // let the renderer know we've updated style + + return this; // chaining + }, + show: function show() { + this.css('display', 'element'); + return this; // chaining + }, + hide: function hide() { + this.css('display', 'none'); + return this; // chaining + }, + effectiveOpacity: function effectiveOpacity() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return 1; + } + + var hasCompoundNodes = cy.hasCompoundNodes(); + var ele = this[0]; + + if (ele) { + var _p = ele._private; + var parentOpacity = ele.pstyle('opacity').value; + + if (!hasCompoundNodes) { + return parentOpacity; + } + + var parents = !_p.data.parent ? null : ele.parents(); + + if (parents) { + for (var i = 0; i < parents.length; i++) { + var parent = parents[i]; + var opacity = parent.pstyle('opacity').value; + parentOpacity = opacity * parentOpacity; + } + } + + return parentOpacity; + } + }, + transparent: function transparent() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return false; + } + + var ele = this[0]; + var hasCompoundNodes = ele.cy().hasCompoundNodes(); + + if (ele) { + if (!hasCompoundNodes) { + return ele.pstyle('opacity').value === 0; + } else { + return ele.effectiveOpacity() === 0; + } + } + }, + backgrounding: function backgrounding() { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return false; + } + + var ele = this[0]; + return ele._private.backgrounding ? true : false; + } + }; + + function checkCompound(ele, parentOk) { + var _p = ele._private; + var parents = _p.data.parent ? ele.parents() : null; + + if (parents) { + for (var i = 0; i < parents.length; i++) { + var parent = parents[i]; + + if (!parentOk(parent)) { + return false; + } + } + } + + return true; + } + + function defineDerivedStateFunction(specs) { + var ok = specs.ok; + var edgeOkViaNode = specs.edgeOkViaNode || specs.ok; + var parentOk = specs.parentOk || specs.ok; + return function () { + var cy = this.cy(); + + if (!cy.styleEnabled()) { + return true; + } + + var ele = this[0]; + var hasCompoundNodes = cy.hasCompoundNodes(); + + if (ele) { + var _p = ele._private; + + if (!ok(ele)) { + return false; + } + + if (ele.isNode()) { + return !hasCompoundNodes || checkCompound(ele, parentOk); + } else { + var src = _p.source; + var tgt = _p.target; + return edgeOkViaNode(src) && (!hasCompoundNodes || checkCompound(src, edgeOkViaNode)) && (src === tgt || edgeOkViaNode(tgt) && (!hasCompoundNodes || checkCompound(tgt, edgeOkViaNode))); + } + } + }; + } + + var eleTakesUpSpace = cacheStyleFunction('eleTakesUpSpace', function (ele) { + return ele.pstyle('display').value === 'element' && ele.width() !== 0 && (ele.isNode() ? ele.height() !== 0 : true); + }); + elesfn$4.takesUpSpace = cachePrototypeStyleFunction('takesUpSpace', defineDerivedStateFunction({ + ok: eleTakesUpSpace + })); + var eleInteractive = cacheStyleFunction('eleInteractive', function (ele) { + return ele.pstyle('events').value === 'yes' && ele.pstyle('visibility').value === 'visible' && eleTakesUpSpace(ele); + }); + var parentInteractive = cacheStyleFunction('parentInteractive', function (parent) { + return parent.pstyle('visibility').value === 'visible' && eleTakesUpSpace(parent); + }); + elesfn$4.interactive = cachePrototypeStyleFunction('interactive', defineDerivedStateFunction({ + ok: eleInteractive, + parentOk: parentInteractive, + edgeOkViaNode: eleTakesUpSpace + })); + + elesfn$4.noninteractive = function () { + var ele = this[0]; + + if (ele) { + return !ele.interactive(); + } + }; + + var eleVisible = cacheStyleFunction('eleVisible', function (ele) { + return ele.pstyle('visibility').value === 'visible' && ele.pstyle('opacity').pfValue !== 0 && eleTakesUpSpace(ele); + }); + var edgeVisibleViaNode = eleTakesUpSpace; + elesfn$4.visible = cachePrototypeStyleFunction('visible', defineDerivedStateFunction({ + ok: eleVisible, + edgeOkViaNode: edgeVisibleViaNode + })); + + elesfn$4.hidden = function () { + var ele = this[0]; + + if (ele) { + return !ele.visible(); + } + }; + + elesfn$4.isBundledBezier = cachePrototypeStyleFunction('isBundledBezier', function () { + if (!this.cy().styleEnabled()) { + return false; + } + + return !this.removed() && this.pstyle('curve-style').value === 'bezier' && this.takesUpSpace(); + }); + elesfn$4.bypass = elesfn$4.css = elesfn$4.style; + elesfn$4.renderedCss = elesfn$4.renderedStyle; + elesfn$4.removeBypass = elesfn$4.removeCss = elesfn$4.removeStyle; + elesfn$4.pstyle = elesfn$4.parsedStyle; + + var elesfn$3 = {}; + + function defineSwitchFunction(params) { + return function () { + var args = arguments; + var changedEles = []; // e.g. cy.nodes().select( data, handler ) + + if (args.length === 2) { + var data = args[0]; + var handler = args[1]; + this.on(params.event, data, handler); + } // e.g. cy.nodes().select( handler ) + else if (args.length === 1 && fn$6(args[0])) { + var _handler = args[0]; + this.on(params.event, _handler); + } // e.g. cy.nodes().select() + // e.g. (private) cy.nodes().select(['tapselect']) + else if (args.length === 0 || args.length === 1 && array(args[0])) { + var addlEvents = args.length === 1 ? args[0] : null; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var able = !params.ableField || ele._private[params.ableField]; + var changed = ele._private[params.field] != params.value; + + if (params.overrideAble) { + var overrideAble = params.overrideAble(ele); + + if (overrideAble !== undefined) { + able = overrideAble; + + if (!overrideAble) { + return this; + } // to save cycles assume not able for all on override + + } + } + + if (able) { + ele._private[params.field] = params.value; + + if (changed) { + changedEles.push(ele); + } + } + } + + var changedColl = this.spawn(changedEles); + changedColl.updateStyle(); // change of state => possible change of style + + changedColl.emit(params.event); + + if (addlEvents) { + changedColl.emit(addlEvents); + } + } + + return this; + }; + } + + function defineSwitchSet(params) { + elesfn$3[params.field] = function () { + var ele = this[0]; + + if (ele) { + if (params.overrideField) { + var val = params.overrideField(ele); + + if (val !== undefined) { + return val; + } + } + + return ele._private[params.field]; + } + }; + + elesfn$3[params.on] = defineSwitchFunction({ + event: params.on, + field: params.field, + ableField: params.ableField, + overrideAble: params.overrideAble, + value: true + }); + elesfn$3[params.off] = defineSwitchFunction({ + event: params.off, + field: params.field, + ableField: params.ableField, + overrideAble: params.overrideAble, + value: false + }); + } + + defineSwitchSet({ + field: 'locked', + overrideField: function overrideField(ele) { + return ele.cy().autolock() ? true : undefined; + }, + on: 'lock', + off: 'unlock' + }); + defineSwitchSet({ + field: 'grabbable', + overrideField: function overrideField(ele) { + return ele.cy().autoungrabify() || ele.pannable() ? false : undefined; + }, + on: 'grabify', + off: 'ungrabify' + }); + defineSwitchSet({ + field: 'selected', + ableField: 'selectable', + overrideAble: function overrideAble(ele) { + return ele.cy().autounselectify() ? false : undefined; + }, + on: 'select', + off: 'unselect' + }); + defineSwitchSet({ + field: 'selectable', + overrideField: function overrideField(ele) { + return ele.cy().autounselectify() ? false : undefined; + }, + on: 'selectify', + off: 'unselectify' + }); + elesfn$3.deselect = elesfn$3.unselect; + + elesfn$3.grabbed = function () { + var ele = this[0]; + + if (ele) { + return ele._private.grabbed; + } + }; + + defineSwitchSet({ + field: 'active', + on: 'activate', + off: 'unactivate' + }); + defineSwitchSet({ + field: 'pannable', + on: 'panify', + off: 'unpanify' + }); + + elesfn$3.inactive = function () { + var ele = this[0]; + + if (ele) { + return !ele._private.active; + } + }; + + var elesfn$2 = {}; // DAG functions + //////////////// + + var defineDagExtremity = function defineDagExtremity(params) { + return function dagExtremityImpl(selector) { + var eles = this; + var ret = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.isNode()) { + continue; + } + + var disqualified = false; + var edges = ele.connectedEdges(); + + for (var j = 0; j < edges.length; j++) { + var edge = edges[j]; + var src = edge.source(); + var tgt = edge.target(); + + if (params.noIncomingEdges && tgt === ele && src !== ele || params.noOutgoingEdges && src === ele && tgt !== ele) { + disqualified = true; + break; + } + } + + if (!disqualified) { + ret.push(ele); + } + } + + return this.spawn(ret, true).filter(selector); + }; + }; + + var defineDagOneHop = function defineDagOneHop(params) { + return function (selector) { + var eles = this; + var oEles = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.isNode()) { + continue; + } + + var edges = ele.connectedEdges(); + + for (var j = 0; j < edges.length; j++) { + var edge = edges[j]; + var src = edge.source(); + var tgt = edge.target(); + + if (params.outgoing && src === ele) { + oEles.push(edge); + oEles.push(tgt); + } else if (params.incoming && tgt === ele) { + oEles.push(edge); + oEles.push(src); + } + } + } + + return this.spawn(oEles, true).filter(selector); + }; + }; + + var defineDagAllHops = function defineDagAllHops(params) { + return function (selector) { + var eles = this; + var sEles = []; + var sElesIds = {}; + + for (;;) { + var next = params.outgoing ? eles.outgoers() : eles.incomers(); + + if (next.length === 0) { + break; + } // done if none left + + + var newNext = false; + + for (var i = 0; i < next.length; i++) { + var n = next[i]; + var nid = n.id(); + + if (!sElesIds[nid]) { + sElesIds[nid] = true; + sEles.push(n); + newNext = true; + } + } + + if (!newNext) { + break; + } // done if touched all outgoers already + + + eles = next; + } + + return this.spawn(sEles, true).filter(selector); + }; + }; + + elesfn$2.clearTraversalCache = function () { + for (var i = 0; i < this.length; i++) { + this[i]._private.traversalCache = null; + } + }; + + extend(elesfn$2, { + // get the root nodes in the DAG + roots: defineDagExtremity({ + noIncomingEdges: true + }), + // get the leaf nodes in the DAG + leaves: defineDagExtremity({ + noOutgoingEdges: true + }), + // normally called children in graph theory + // these nodes =edges=> outgoing nodes + outgoers: cache(defineDagOneHop({ + outgoing: true + }), 'outgoers'), + // aka DAG descendants + successors: defineDagAllHops({ + outgoing: true + }), + // normally called parents in graph theory + // these nodes <=edges= incoming nodes + incomers: cache(defineDagOneHop({ + incoming: true + }), 'incomers'), + // aka DAG ancestors + predecessors: defineDagAllHops({ + incoming: true + }) + }); // Neighbourhood functions + ////////////////////////// + + extend(elesfn$2, { + neighborhood: cache(function (selector) { + var elements = []; + var nodes = this.nodes(); + + for (var i = 0; i < nodes.length; i++) { + // for all nodes + var node = nodes[i]; + var connectedEdges = node.connectedEdges(); // for each connected edge, add the edge and the other node + + for (var j = 0; j < connectedEdges.length; j++) { + var edge = connectedEdges[j]; + var src = edge.source(); + var tgt = edge.target(); + var otherNode = node === src ? tgt : src; // need check in case of loop + + if (otherNode.length > 0) { + elements.push(otherNode[0]); // add node 1 hop away + } // add connected edge + + + elements.push(edge[0]); + } + } + + return this.spawn(elements, true).filter(selector); + }, 'neighborhood'), + closedNeighborhood: function closedNeighborhood(selector) { + return this.neighborhood().add(this).filter(selector); + }, + openNeighborhood: function openNeighborhood(selector) { + return this.neighborhood(selector); + } + }); // aliases + + elesfn$2.neighbourhood = elesfn$2.neighborhood; + elesfn$2.closedNeighbourhood = elesfn$2.closedNeighborhood; + elesfn$2.openNeighbourhood = elesfn$2.openNeighborhood; // Edge functions + ///////////////// + + extend(elesfn$2, { + source: cache(function sourceImpl(selector) { + var ele = this[0]; + var src; + + if (ele) { + src = ele._private.source || ele.cy().collection(); + } + + return src && selector ? src.filter(selector) : src; + }, 'source'), + target: cache(function targetImpl(selector) { + var ele = this[0]; + var tgt; + + if (ele) { + tgt = ele._private.target || ele.cy().collection(); + } + + return tgt && selector ? tgt.filter(selector) : tgt; + }, 'target'), + sources: defineSourceFunction({ + attr: 'source' + }), + targets: defineSourceFunction({ + attr: 'target' + }) + }); + + function defineSourceFunction(params) { + return function sourceImpl(selector) { + var sources = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var src = ele._private[params.attr]; + + if (src) { + sources.push(src); + } + } + + return this.spawn(sources, true).filter(selector); + }; + } + + extend(elesfn$2, { + edgesWith: cache(defineEdgesWithFunction(), 'edgesWith'), + edgesTo: cache(defineEdgesWithFunction({ + thisIsSrc: true + }), 'edgesTo') + }); + + function defineEdgesWithFunction(params) { + return function edgesWithImpl(otherNodes) { + var elements = []; + var cy = this._private.cy; + var p = params || {}; // get elements if a selector is specified + + if (string(otherNodes)) { + otherNodes = cy.$(otherNodes); + } + + for (var h = 0; h < otherNodes.length; h++) { + var edges = otherNodes[h]._private.edges; + + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var edgeData = edge._private.data; + var thisToOther = this.hasElementWithId(edgeData.source) && otherNodes.hasElementWithId(edgeData.target); + var otherToThis = otherNodes.hasElementWithId(edgeData.source) && this.hasElementWithId(edgeData.target); + var edgeConnectsThisAndOther = thisToOther || otherToThis; + + if (!edgeConnectsThisAndOther) { + continue; + } + + if (p.thisIsSrc || p.thisIsTgt) { + if (p.thisIsSrc && !thisToOther) { + continue; + } + + if (p.thisIsTgt && !otherToThis) { + continue; + } + } + + elements.push(edge); + } + } + + return this.spawn(elements, true); + }; + } + + extend(elesfn$2, { + connectedEdges: cache(function (selector) { + var retEles = []; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var node = eles[i]; + + if (!node.isNode()) { + continue; + } + + var edges = node._private.edges; + + for (var j = 0; j < edges.length; j++) { + var edge = edges[j]; + retEles.push(edge); + } + } + + return this.spawn(retEles, true).filter(selector); + }, 'connectedEdges'), + connectedNodes: cache(function (selector) { + var retEles = []; + var eles = this; + + for (var i = 0; i < eles.length; i++) { + var edge = eles[i]; + + if (!edge.isEdge()) { + continue; + } + + retEles.push(edge.source()[0]); + retEles.push(edge.target()[0]); + } + + return this.spawn(retEles, true).filter(selector); + }, 'connectedNodes'), + parallelEdges: cache(defineParallelEdgesFunction(), 'parallelEdges'), + codirectedEdges: cache(defineParallelEdgesFunction({ + codirected: true + }), 'codirectedEdges') + }); + + function defineParallelEdgesFunction(params) { + var defaults = { + codirected: false + }; + params = extend({}, defaults, params); + return function parallelEdgesImpl(selector) { + // micro-optimised for renderer + var elements = []; + var edges = this.edges(); + var p = params; // look at all the edges in the collection + + for (var i = 0; i < edges.length; i++) { + var edge1 = edges[i]; + var edge1_p = edge1._private; + var src1 = edge1_p.source; + var srcid1 = src1._private.data.id; + var tgtid1 = edge1_p.data.target; + var srcEdges1 = src1._private.edges; // look at edges connected to the src node of this edge + + for (var j = 0; j < srcEdges1.length; j++) { + var edge2 = srcEdges1[j]; + var edge2data = edge2._private.data; + var tgtid2 = edge2data.target; + var srcid2 = edge2data.source; + var codirected = tgtid2 === tgtid1 && srcid2 === srcid1; + var oppdirected = srcid1 === tgtid2 && tgtid1 === srcid2; + + if (p.codirected && codirected || !p.codirected && (codirected || oppdirected)) { + elements.push(edge2); + } + } + } + + return this.spawn(elements, true).filter(selector); + }; + } // Misc functions + ///////////////// + + + extend(elesfn$2, { + components: function components(root) { + var self = this; + var cy = self.cy(); + var visited = cy.collection(); + var unvisited = root == null ? self.nodes() : root.nodes(); + var components = []; + + if (root != null && unvisited.empty()) { + // root may contain only edges + unvisited = root.sources(); // doesn't matter which node to use (undirected), so just use the source sides + } + + var visitInComponent = function visitInComponent(node, component) { + visited.merge(node); + unvisited.unmerge(node); + component.merge(node); + }; + + if (unvisited.empty()) { + return self.spawn(); + } + + var _loop = function _loop() { + // each iteration yields a component + var cmpt = cy.collection(); + components.push(cmpt); + var root = unvisited[0]; + visitInComponent(root, cmpt); + self.bfs({ + directed: false, + roots: root, + visit: function visit(v) { + return visitInComponent(v, cmpt); + } + }); + cmpt.forEach(function (node) { + node.connectedEdges().forEach(function (e) { + // connectedEdges() usually cached + if (self.has(e) && cmpt.has(e.source()) && cmpt.has(e.target())) { + // has() is cheap + cmpt.merge(e); // forEach() only considers nodes -- sets N at call time + } + }); + }); + }; + + do { + _loop(); + } while (unvisited.length > 0); + + return components; + }, + component: function component() { + var ele = this[0]; + return ele.cy().mutableElements().components(ele)[0]; + } + }); + elesfn$2.componentsOf = elesfn$2.components; + + var Collection = function Collection(cy, elements) { + var unique = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var removed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + if (cy === undefined) { + error('A collection must have a reference to the core'); + return; + } + + var map = new Map$2(); + var createdElements = false; + + if (!elements) { + elements = []; + } else if (elements.length > 0 && plainObject(elements[0]) && !element(elements[0])) { + createdElements = true; // make elements from json and restore all at once later + + var eles = []; + var elesIds = new Set$1(); + + for (var i = 0, l = elements.length; i < l; i++) { + var json = elements[i]; + + if (json.data == null) { + json.data = {}; + } + + var _data = json.data; // make sure newly created elements have valid ids + + if (_data.id == null) { + _data.id = uuid(); + } else if (cy.hasElementWithId(_data.id) || elesIds.has(_data.id)) { + continue; // can't create element if prior id already exists + } + + var ele = new Element(cy, json, false); + eles.push(ele); + elesIds.add(_data.id); + } + + elements = eles; + } + + this.length = 0; + + for (var _i = 0, _l = elements.length; _i < _l; _i++) { + var element$1 = elements[_i][0]; // [0] in case elements is an array of collections, rather than array of elements + + if (element$1 == null) { + continue; + } + + var id = element$1._private.data.id; + + if (!unique || !map.has(id)) { + if (unique) { + map.set(id, { + index: this.length, + ele: element$1 + }); + } + + this[this.length] = element$1; + this.length++; + } + } + + this._private = { + eles: this, + cy: cy, + + get map() { + if (this.lazyMap == null) { + this.rebuildMap(); + } + + return this.lazyMap; + }, + + set map(m) { + this.lazyMap = m; + }, + + rebuildMap: function rebuildMap() { + var m = this.lazyMap = new Map$2(); + var eles = this.eles; + + for (var _i2 = 0; _i2 < eles.length; _i2++) { + var _ele = eles[_i2]; + m.set(_ele.id(), { + index: _i2, + ele: _ele + }); + } + } + }; + + if (unique) { + this._private.map = map; + } // restore the elements if we created them from json + + + if (createdElements && !removed) { + this.restore(); + } + }; // Functions + //////////////////////////////////////////////////////////////////////////////////////////////////// + // keep the prototypes in sync (an element has the same functions as a collection) + // and use elefn and elesfn as shorthands to the prototypes + + + var elesfn$1 = Element.prototype = Collection.prototype = Object.create(Array.prototype); + + elesfn$1.instanceString = function () { + return 'collection'; + }; + + elesfn$1.spawn = function (eles, unique) { + return new Collection(this.cy(), eles, unique); + }; + + elesfn$1.spawnSelf = function () { + return this.spawn(this); + }; + + elesfn$1.cy = function () { + return this._private.cy; + }; + + elesfn$1.renderer = function () { + return this._private.cy.renderer(); + }; + + elesfn$1.element = function () { + return this[0]; + }; + + elesfn$1.collection = function () { + if (collection(this)) { + return this; + } else { + // an element + return new Collection(this._private.cy, [this]); + } + }; + + elesfn$1.unique = function () { + return new Collection(this._private.cy, this, true); + }; + + elesfn$1.hasElementWithId = function (id) { + id = '' + id; // id must be string + + return this._private.map.has(id); + }; + + elesfn$1.getElementById = function (id) { + id = '' + id; // id must be string + + var cy = this._private.cy; + + var entry = this._private.map.get(id); + + return entry ? entry.ele : new Collection(cy); // get ele or empty collection + }; + + elesfn$1.$id = elesfn$1.getElementById; + + elesfn$1.poolIndex = function () { + var cy = this._private.cy; + var eles = cy._private.elements; + var id = this[0]._private.data.id; + return eles._private.map.get(id).index; + }; + + elesfn$1.indexOf = function (ele) { + var id = ele[0]._private.data.id; + return this._private.map.get(id).index; + }; + + elesfn$1.indexOfId = function (id) { + id = '' + id; // id must be string + + return this._private.map.get(id).index; + }; + + elesfn$1.json = function (obj) { + var ele = this.element(); + var cy = this.cy(); + + if (ele == null && obj) { + return this; + } // can't set to no eles + + + if (ele == null) { + return undefined; + } // can't get from no eles + + + var p = ele._private; + + if (plainObject(obj)) { + // set + cy.startBatch(); + + if (obj.data) { + ele.data(obj.data); + var _data2 = p.data; + + if (ele.isEdge()) { + // source and target are immutable via data() + var move = false; + var spec = {}; + var src = obj.data.source; + var tgt = obj.data.target; + + if (src != null && src != _data2.source) { + spec.source = '' + src; // id must be string + + move = true; + } + + if (tgt != null && tgt != _data2.target) { + spec.target = '' + tgt; // id must be string + + move = true; + } + + if (move) { + ele = ele.move(spec); + } + } else { + // parent is immutable via data() + var newParentValSpecd = ('parent' in obj.data); + var parent = obj.data.parent; + + if (newParentValSpecd && (parent != null || _data2.parent != null) && parent != _data2.parent) { + if (parent === undefined) { + // can't set undefined imperatively, so use null + parent = null; + } + + if (parent != null) { + parent = '' + parent; // id must be string + } + + ele = ele.move({ + parent: parent + }); + } + } + } + + if (obj.position) { + ele.position(obj.position); + } // ignore group -- immutable + + + var checkSwitch = function checkSwitch(k, trueFnName, falseFnName) { + var obj_k = obj[k]; + + if (obj_k != null && obj_k !== p[k]) { + if (obj_k) { + ele[trueFnName](); + } else { + ele[falseFnName](); + } + } + }; + + checkSwitch('removed', 'remove', 'restore'); + checkSwitch('selected', 'select', 'unselect'); + checkSwitch('selectable', 'selectify', 'unselectify'); + checkSwitch('locked', 'lock', 'unlock'); + checkSwitch('grabbable', 'grabify', 'ungrabify'); + checkSwitch('pannable', 'panify', 'unpanify'); + + if (obj.classes != null) { + ele.classes(obj.classes); + } + + cy.endBatch(); + return this; + } else if (obj === undefined) { + // get + var json = { + data: copy(p.data), + position: copy(p.position), + group: p.group, + removed: p.removed, + selected: p.selected, + selectable: p.selectable, + locked: p.locked, + grabbable: p.grabbable, + pannable: p.pannable, + classes: null + }; + json.classes = ''; + var i = 0; + p.classes.forEach(function (cls) { + return json.classes += i++ === 0 ? cls : ' ' + cls; + }); + return json; + } + }; + + elesfn$1.jsons = function () { + var jsons = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var json = ele.json(); + jsons.push(json); + } + + return jsons; + }; + + elesfn$1.clone = function () { + var cy = this.cy(); + var elesArr = []; + + for (var i = 0; i < this.length; i++) { + var ele = this[i]; + var json = ele.json(); + var clone = new Element(cy, json, false); // NB no restore + + elesArr.push(clone); + } + + return new Collection(cy, elesArr); + }; + + elesfn$1.copy = elesfn$1.clone; + + elesfn$1.restore = function () { + var notifyRenderer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var addToPool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var self = this; + var cy = self.cy(); + var cy_p = cy._private; // create arrays of nodes and edges, since we need to + // restore the nodes first + + var nodes = []; + var edges = []; + var elements; + + for (var _i3 = 0, l = self.length; _i3 < l; _i3++) { + var ele = self[_i3]; + + if (addToPool && !ele.removed()) { + // don't need to handle this ele + continue; + } // keep nodes first in the array and edges after + + + if (ele.isNode()) { + // put to front of array if node + nodes.push(ele); + } else { + // put to end of array if edge + edges.push(ele); + } + } + + elements = nodes.concat(edges); + var i; + + var removeFromElements = function removeFromElements() { + elements.splice(i, 1); + i--; + }; // now, restore each element + + + for (i = 0; i < elements.length; i++) { + var _ele2 = elements[i]; + var _private = _ele2._private; + var _data3 = _private.data; // the traversal cache should start fresh when ele is added + + _ele2.clearTraversalCache(); // set id and validate + + + if (!addToPool && !_private.removed) ; else if (_data3.id === undefined) { + _data3.id = uuid(); + } else if (number$1(_data3.id)) { + _data3.id = '' + _data3.id; // now it's a string + } else if (emptyString(_data3.id) || !string(_data3.id)) { + error('Can not create element with invalid string ID `' + _data3.id + '`'); // can't create element if it has empty string as id or non-string id + + removeFromElements(); + continue; + } else if (cy.hasElementWithId(_data3.id)) { + error('Can not create second element with ID `' + _data3.id + '`'); // can't create element if one already has that id + + removeFromElements(); + continue; + } + + var id = _data3.id; // id is finalised, now let's keep a ref + + if (_ele2.isNode()) { + // extra checks for nodes + var pos = _private.position; // make sure the nodes have a defined position + + if (pos.x == null) { + pos.x = 0; + } + + if (pos.y == null) { + pos.y = 0; + } + } + + if (_ele2.isEdge()) { + // extra checks for edges + var edge = _ele2; + var fields = ['source', 'target']; + var fieldsLength = fields.length; + var badSourceOrTarget = false; + + for (var j = 0; j < fieldsLength; j++) { + var field = fields[j]; + var val = _data3[field]; + + if (number$1(val)) { + val = _data3[field] = '' + _data3[field]; // now string + } + + if (val == null || val === '') { + // can't create if source or target is not defined properly + error('Can not create edge `' + id + '` with unspecified ' + field); + badSourceOrTarget = true; + } else if (!cy.hasElementWithId(val)) { + // can't create edge if one of its nodes doesn't exist + error('Can not create edge `' + id + '` with nonexistant ' + field + ' `' + val + '`'); + badSourceOrTarget = true; + } + } + + if (badSourceOrTarget) { + removeFromElements(); + continue; + } // can't create this + + + var src = cy.getElementById(_data3.source); + var tgt = cy.getElementById(_data3.target); // only one edge in node if loop + + if (src.same(tgt)) { + src._private.edges.push(edge); + } else { + src._private.edges.push(edge); + + tgt._private.edges.push(edge); + } + + edge._private.source = src; + edge._private.target = tgt; + } // if is edge + // create mock ids / indexes maps for element so it can be used like collections + + + _private.map = new Map$2(); + + _private.map.set(id, { + ele: _ele2, + index: 0 + }); + + _private.removed = false; + + if (addToPool) { + cy.addToPool(_ele2); + } + } // for each element + // do compound node sanity checks + + + for (var _i4 = 0; _i4 < nodes.length; _i4++) { + // each node + var node = nodes[_i4]; + var _data4 = node._private.data; + + if (number$1(_data4.parent)) { + // then automake string + _data4.parent = '' + _data4.parent; + } + + var parentId = _data4.parent; + var specifiedParent = parentId != null; + + if (specifiedParent || node._private.parent) { + var parent = node._private.parent ? cy.collection().merge(node._private.parent) : cy.getElementById(parentId); + + if (parent.empty()) { + // non-existant parent; just remove it + _data4.parent = undefined; + } else if (parent[0].removed()) { + warn('Node added with missing parent, reference to parent removed'); + _data4.parent = undefined; + node._private.parent = null; + } else { + var selfAsParent = false; + var ancestor = parent; + + while (!ancestor.empty()) { + if (node.same(ancestor)) { + // mark self as parent and remove from data + selfAsParent = true; + _data4.parent = undefined; // remove parent reference + // exit or we loop forever + + break; + } + + ancestor = ancestor.parent(); + } + + if (!selfAsParent) { + // connect with children + parent[0]._private.children.push(node); + + node._private.parent = parent[0]; // let the core know we have a compound graph + + cy_p.hasCompoundNodes = true; + } + } // else + + } // if specified parent + + } // for each node + + + if (elements.length > 0) { + var restored = elements.length === self.length ? self : new Collection(cy, elements); + + for (var _i5 = 0; _i5 < restored.length; _i5++) { + var _ele3 = restored[_i5]; + + if (_ele3.isNode()) { + continue; + } // adding an edge invalidates the traversal caches for the parallel edges + + + _ele3.parallelEdges().clearTraversalCache(); // adding an edge invalidates the traversal cache for the connected nodes + + + _ele3.source().clearTraversalCache(); + + _ele3.target().clearTraversalCache(); + } + + var toUpdateStyle; + + if (cy_p.hasCompoundNodes) { + toUpdateStyle = cy.collection().merge(restored).merge(restored.connectedNodes()).merge(restored.parent()); + } else { + toUpdateStyle = restored; + } + + toUpdateStyle.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(notifyRenderer); + + if (notifyRenderer) { + restored.emitAndNotify('add'); + } else if (addToPool) { + restored.emit('add'); + } + } + + return self; // chainability + }; + + elesfn$1.removed = function () { + var ele = this[0]; + return ele && ele._private.removed; + }; + + elesfn$1.inside = function () { + var ele = this[0]; + return ele && !ele._private.removed; + }; + + elesfn$1.remove = function () { + var notifyRenderer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var removeFromPool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var self = this; + var elesToRemove = []; + var elesToRemoveIds = {}; + var cy = self._private.cy; // add connected edges + + function addConnectedEdges(node) { + var edges = node._private.edges; + + for (var i = 0; i < edges.length; i++) { + add(edges[i]); + } + } // add descendant nodes + + + function addChildren(node) { + var children = node._private.children; + + for (var i = 0; i < children.length; i++) { + add(children[i]); + } + } + + function add(ele) { + var alreadyAdded = elesToRemoveIds[ele.id()]; + + if (removeFromPool && ele.removed() || alreadyAdded) { + return; + } else { + elesToRemoveIds[ele.id()] = true; + } + + if (ele.isNode()) { + elesToRemove.push(ele); // nodes are removed last + + addConnectedEdges(ele); + addChildren(ele); + } else { + elesToRemove.unshift(ele); // edges are removed first + } + } // make the list of elements to remove + // (may be removing more than specified due to connected edges etc) + + + for (var i = 0, l = self.length; i < l; i++) { + var ele = self[i]; + add(ele); + } + + function removeEdgeRef(node, edge) { + var connectedEdges = node._private.edges; + removeFromArray(connectedEdges, edge); // removing an edges invalidates the traversal cache for its nodes + + node.clearTraversalCache(); + } + + function removeParallelRef(pllEdge) { + // removing an edge invalidates the traversal caches for the parallel edges + pllEdge.clearTraversalCache(); + } + + var alteredParents = []; + alteredParents.ids = {}; + + function removeChildRef(parent, ele) { + ele = ele[0]; + parent = parent[0]; + var children = parent._private.children; + var pid = parent.id(); + removeFromArray(children, ele); // remove parent => child ref + + ele._private.parent = null; // remove child => parent ref + + if (!alteredParents.ids[pid]) { + alteredParents.ids[pid] = true; + alteredParents.push(parent); + } + } + + self.dirtyCompoundBoundsCache(); + + if (removeFromPool) { + cy.removeFromPool(elesToRemove); // remove from core pool + } + + for (var _i6 = 0; _i6 < elesToRemove.length; _i6++) { + var _ele4 = elesToRemove[_i6]; + + if (_ele4.isEdge()) { + // remove references to this edge in its connected nodes + var src = _ele4.source()[0]; + + var tgt = _ele4.target()[0]; + + removeEdgeRef(src, _ele4); + removeEdgeRef(tgt, _ele4); + + var pllEdges = _ele4.parallelEdges(); + + for (var j = 0; j < pllEdges.length; j++) { + var pllEdge = pllEdges[j]; + removeParallelRef(pllEdge); + + if (pllEdge.isBundledBezier()) { + pllEdge.dirtyBoundingBoxCache(); + } + } + } else { + // remove reference to parent + var parent = _ele4.parent(); + + if (parent.length !== 0) { + removeChildRef(parent, _ele4); + } + } + + if (removeFromPool) { + // mark as removed + _ele4._private.removed = true; + } + } // check to see if we have a compound graph or not + + + var elesStillInside = cy._private.elements; + cy._private.hasCompoundNodes = false; + + for (var _i7 = 0; _i7 < elesStillInside.length; _i7++) { + var _ele5 = elesStillInside[_i7]; + + if (_ele5.isParent()) { + cy._private.hasCompoundNodes = true; + break; + } + } + + var removedElements = new Collection(this.cy(), elesToRemove); + + if (removedElements.size() > 0) { + // must manually notify since trigger won't do this automatically once removed + if (notifyRenderer) { + removedElements.emitAndNotify('remove'); + } else if (removeFromPool) { + removedElements.emit('remove'); + } + } // the parents who were modified by the removal need their style updated + + + for (var _i8 = 0; _i8 < alteredParents.length; _i8++) { + var _ele6 = alteredParents[_i8]; + + if (!removeFromPool || !_ele6.removed()) { + _ele6.updateStyle(); + } + } + + return removedElements; + }; + + elesfn$1.move = function (struct) { + var cy = this._private.cy; + var eles = this; // just clean up refs, caches, etc. in the same way as when removing and then restoring + // (our calls to remove/restore do not remove from the graph or make events) + + var notifyRenderer = false; + var modifyPool = false; + + var toString = function toString(id) { + return id == null ? id : '' + id; + }; // id must be string + + + if (struct.source !== undefined || struct.target !== undefined) { + var srcId = toString(struct.source); + var tgtId = toString(struct.target); + var srcExists = srcId != null && cy.hasElementWithId(srcId); + var tgtExists = tgtId != null && cy.hasElementWithId(tgtId); + + if (srcExists || tgtExists) { + cy.batch(function () { + // avoid duplicate style updates + eles.remove(notifyRenderer, modifyPool); // clean up refs etc. + + eles.emitAndNotify('moveout'); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _data5 = ele._private.data; + + if (ele.isEdge()) { + if (srcExists) { + _data5.source = srcId; + } + + if (tgtExists) { + _data5.target = tgtId; + } + } + } + + eles.restore(notifyRenderer, modifyPool); // make new refs, style, etc. + }); + eles.emitAndNotify('move'); + } + } else if (struct.parent !== undefined) { + // move node to new parent + var parentId = toString(struct.parent); + var parentExists = parentId === null || cy.hasElementWithId(parentId); + + if (parentExists) { + var pidToAssign = parentId === null ? undefined : parentId; + cy.batch(function () { + // avoid duplicate style updates + var updated = eles.remove(notifyRenderer, modifyPool); // clean up refs etc. + + updated.emitAndNotify('moveout'); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _data6 = ele._private.data; + + if (ele.isNode()) { + _data6.parent = pidToAssign; + } + } + + updated.restore(notifyRenderer, modifyPool); // make new refs, style, etc. + }); + eles.emitAndNotify('move'); + } + } + + return this; + }; + + [elesfn$j, elesfn$i, elesfn$h, elesfn$g, elesfn$f, data, elesfn$d, dimensions, elesfn$9, elesfn$8, elesfn$7, elesfn$6, elesfn$5, elesfn$4, elesfn$3, elesfn$2].forEach(function (props) { + extend(elesfn$1, props); + }); + + var corefn$9 = { + add: function add(opts) { + var elements; + var cy = this; // add the elements + + if (elementOrCollection(opts)) { + var eles = opts; + + if (eles._private.cy === cy) { + // same instance => just restore + elements = eles.restore(); + } else { + // otherwise, copy from json + var jsons = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + jsons.push(ele.json()); + } + + elements = new Collection(cy, jsons); + } + } // specify an array of options + else if (array(opts)) { + var _jsons = opts; + elements = new Collection(cy, _jsons); + } // specify via opts.nodes and opts.edges + else if (plainObject(opts) && (array(opts.nodes) || array(opts.edges))) { + var elesByGroup = opts; + var _jsons2 = []; + var grs = ['nodes', 'edges']; + + for (var _i = 0, il = grs.length; _i < il; _i++) { + var group = grs[_i]; + var elesArray = elesByGroup[group]; + + if (array(elesArray)) { + for (var j = 0, jl = elesArray.length; j < jl; j++) { + var json = extend({ + group: group + }, elesArray[j]); + + _jsons2.push(json); + } + } + } + + elements = new Collection(cy, _jsons2); + } // specify options for one element + else { + var _json = opts; + elements = new Element(cy, _json).collection(); + } + + return elements; + }, + remove: function remove(collection) { + if (elementOrCollection(collection)) ; else if (string(collection)) { + var selector = collection; + collection = this.$(selector); + } + + return collection.remove(); + } + }; + + /* global Float32Array */ + + /*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ + function generateCubicBezier(mX1, mY1, mX2, mY2) { + var NEWTON_ITERATIONS = 4, + NEWTON_MIN_SLOPE = 0.001, + SUBDIVISION_PRECISION = 0.0000001, + SUBDIVISION_MAX_ITERATIONS = 10, + kSplineTableSize = 11, + kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), + float32ArraySupported = typeof Float32Array !== 'undefined'; + /* Must contain four arguments. */ + + if (arguments.length !== 4) { + return false; + } + /* Arguments must be numbers. */ + + + for (var i = 0; i < 4; ++i) { + if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { + return false; + } + } + /* X values must be in the [0, 1] range. */ + + + mX1 = Math.min(mX1, 1); + mX2 = Math.min(mX2, 1); + mX1 = Math.max(mX1, 0); + mX2 = Math.max(mX2, 0); + var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); + + function A(aA1, aA2) { + return 1.0 - 3.0 * aA2 + 3.0 * aA1; + } + + function B(aA1, aA2) { + return 3.0 * aA2 - 6.0 * aA1; + } + + function C(aA1) { + return 3.0 * aA1; + } + + function calcBezier(aT, aA1, aA2) { + return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; + } + + function getSlope(aT, aA1, aA2) { + return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); + } + + function newtonRaphsonIterate(aX, aGuessT) { + for (var _i = 0; _i < NEWTON_ITERATIONS; ++_i) { + var currentSlope = getSlope(aGuessT, mX1, mX2); + + if (currentSlope === 0.0) { + return aGuessT; + } + + var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + aGuessT -= currentX / currentSlope; + } + + return aGuessT; + } + + function calcSampleValues() { + for (var _i2 = 0; _i2 < kSplineTableSize; ++_i2) { + mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2); + } + } + + function binarySubdivide(aX, aA, aB) { + var currentX, + currentT, + i = 0; + + do { + currentT = aA + (aB - aA) / 2.0; + currentX = calcBezier(currentT, mX1, mX2) - aX; + + if (currentX > 0.0) { + aB = currentT; + } else { + aA = currentT; + } + } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); + + return currentT; + } + + function getTForX(aX) { + var intervalStart = 0.0, + currentSample = 1, + lastSample = kSplineTableSize - 1; + + for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { + intervalStart += kSampleStepSize; + } + + --currentSample; + var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), + guessForT = intervalStart + dist * kSampleStepSize, + initialSlope = getSlope(guessForT, mX1, mX2); + + if (initialSlope >= NEWTON_MIN_SLOPE) { + return newtonRaphsonIterate(aX, guessForT); + } else if (initialSlope === 0.0) { + return guessForT; + } else { + return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); + } + } + + var _precomputed = false; + + function precompute() { + _precomputed = true; + + if (mX1 !== mY1 || mX2 !== mY2) { + calcSampleValues(); + } + } + + var f = function f(aX) { + if (!_precomputed) { + precompute(); + } + + if (mX1 === mY1 && mX2 === mY2) { + return aX; + } + + if (aX === 0) { + return 0; + } + + if (aX === 1) { + return 1; + } + + return calcBezier(getTForX(aX), mY1, mY2); + }; + + f.getControlPoints = function () { + return [{ + x: mX1, + y: mY1 + }, { + x: mX2, + y: mY2 + }]; + }; + + var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; + + f.toString = function () { + return str; + }; + + return f; + } + + /*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ + + /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass + then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ + var generateSpringRK4 = function () { + function springAccelerationForState(state) { + return -state.tension * state.x - state.friction * state.v; + } + + function springEvaluateStateWithDerivative(initialState, dt, derivative) { + var state = { + x: initialState.x + derivative.dx * dt, + v: initialState.v + derivative.dv * dt, + tension: initialState.tension, + friction: initialState.friction + }; + return { + dx: state.v, + dv: springAccelerationForState(state) + }; + } + + function springIntegrateState(state, dt) { + var a = { + dx: state.v, + dv: springAccelerationForState(state) + }, + b = springEvaluateStateWithDerivative(state, dt * 0.5, a), + c = springEvaluateStateWithDerivative(state, dt * 0.5, b), + d = springEvaluateStateWithDerivative(state, dt, c), + dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), + dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); + state.x = state.x + dxdt * dt; + state.v = state.v + dvdt * dt; + return state; + } + + return function springRK4Factory(tension, friction, duration) { + var initState = { + x: -1, + v: 0, + tension: null, + friction: null + }, + path = [0], + time_lapsed = 0, + tolerance = 1 / 10000, + DT = 16 / 1000, + have_duration, + dt, + last_state; + tension = parseFloat(tension) || 500; + friction = parseFloat(friction) || 20; + duration = duration || null; + initState.tension = tension; + initState.friction = friction; + have_duration = duration !== null; + /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ + + if (have_duration) { + /* Run the simulation without a duration. */ + time_lapsed = springRK4Factory(tension, friction); + /* Compute the adjusted time delta. */ + + dt = time_lapsed / duration * DT; + } else { + dt = DT; + } + + for (;;) { + /* Next/step function .*/ + last_state = springIntegrateState(last_state || initState, dt); + /* Store the position. */ + + path.push(1 + last_state.x); + time_lapsed += 16; + /* If the change threshold is reached, break. */ + + if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { + break; + } + } + /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the + computed path and returns a snapshot of the position according to a given percentComplete. */ + + + return !have_duration ? time_lapsed : function (percentComplete) { + return path[percentComplete * (path.length - 1) | 0]; + }; + }; + }(); + + var cubicBezier = function cubicBezier(t1, p1, t2, p2) { + var bezier = generateCubicBezier(t1, p1, t2, p2); + return function (start, end, percent) { + return start + (end - start) * bezier(percent); + }; + }; + + var easings = { + 'linear': function linear(start, end, percent) { + return start + (end - start) * percent; + }, + // default easings + 'ease': cubicBezier(0.25, 0.1, 0.25, 1), + 'ease-in': cubicBezier(0.42, 0, 1, 1), + 'ease-out': cubicBezier(0, 0, 0.58, 1), + 'ease-in-out': cubicBezier(0.42, 0, 0.58, 1), + // sine + 'ease-in-sine': cubicBezier(0.47, 0, 0.745, 0.715), + 'ease-out-sine': cubicBezier(0.39, 0.575, 0.565, 1), + 'ease-in-out-sine': cubicBezier(0.445, 0.05, 0.55, 0.95), + // quad + 'ease-in-quad': cubicBezier(0.55, 0.085, 0.68, 0.53), + 'ease-out-quad': cubicBezier(0.25, 0.46, 0.45, 0.94), + 'ease-in-out-quad': cubicBezier(0.455, 0.03, 0.515, 0.955), + // cubic + 'ease-in-cubic': cubicBezier(0.55, 0.055, 0.675, 0.19), + 'ease-out-cubic': cubicBezier(0.215, 0.61, 0.355, 1), + 'ease-in-out-cubic': cubicBezier(0.645, 0.045, 0.355, 1), + // quart + 'ease-in-quart': cubicBezier(0.895, 0.03, 0.685, 0.22), + 'ease-out-quart': cubicBezier(0.165, 0.84, 0.44, 1), + 'ease-in-out-quart': cubicBezier(0.77, 0, 0.175, 1), + // quint + 'ease-in-quint': cubicBezier(0.755, 0.05, 0.855, 0.06), + 'ease-out-quint': cubicBezier(0.23, 1, 0.32, 1), + 'ease-in-out-quint': cubicBezier(0.86, 0, 0.07, 1), + // expo + 'ease-in-expo': cubicBezier(0.95, 0.05, 0.795, 0.035), + 'ease-out-expo': cubicBezier(0.19, 1, 0.22, 1), + 'ease-in-out-expo': cubicBezier(1, 0, 0, 1), + // circ + 'ease-in-circ': cubicBezier(0.6, 0.04, 0.98, 0.335), + 'ease-out-circ': cubicBezier(0.075, 0.82, 0.165, 1), + 'ease-in-out-circ': cubicBezier(0.785, 0.135, 0.15, 0.86), + // user param easings... + 'spring': function spring(tension, friction, duration) { + if (duration === 0) { + // can't get a spring w/ duration 0 + return easings.linear; // duration 0 => jump to end so impl doesn't matter + } + + var spring = generateSpringRK4(tension, friction, duration); + return function (start, end, percent) { + return start + (end - start) * spring(percent); + }; + }, + 'cubic-bezier': cubicBezier + }; + + function getEasedValue(type, start, end, percent, easingFn) { + if (percent === 1) { + return end; + } + + if (start === end) { + return end; + } + + var val = easingFn(start, end, percent); + + if (type == null) { + return val; + } + + if (type.roundValue || type.color) { + val = Math.round(val); + } + + if (type.min !== undefined) { + val = Math.max(val, type.min); + } + + if (type.max !== undefined) { + val = Math.min(val, type.max); + } + + return val; + } + + function getValue(prop, spec) { + if (prop.pfValue != null || prop.value != null) { + if (prop.pfValue != null && (spec == null || spec.type.units !== '%')) { + return prop.pfValue; + } else { + return prop.value; + } + } else { + return prop; + } + } + + function ease(startProp, endProp, percent, easingFn, propSpec) { + var type = propSpec != null ? propSpec.type : null; + + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + + var start = getValue(startProp, propSpec); + var end = getValue(endProp, propSpec); + + if (number$1(start) && number$1(end)) { + return getEasedValue(type, start, end, percent, easingFn); + } else if (array(start) && array(end)) { + var easedArr = []; + + for (var i = 0; i < end.length; i++) { + var si = start[i]; + var ei = end[i]; + + if (si != null && ei != null) { + var val = getEasedValue(type, si, ei, percent, easingFn); + easedArr.push(val); + } else { + easedArr.push(ei); + } + } + + return easedArr; + } + + return undefined; + } + + function step$1(self, ani, now, isCore) { + var isEles = !isCore; + var _p = self._private; + var ani_p = ani._private; + var pEasing = ani_p.easing; + var startTime = ani_p.startTime; + var cy = isCore ? self : self.cy(); + var style = cy.style(); + + if (!ani_p.easingImpl) { + if (pEasing == null) { + // use default + ani_p.easingImpl = easings['linear']; + } else { + // then define w/ name + var easingVals; + + if (string(pEasing)) { + var easingProp = style.parse('transition-timing-function', pEasing); + easingVals = easingProp.value; + } else { + // then assume preparsed array + easingVals = pEasing; + } + + var name, args; + + if (string(easingVals)) { + name = easingVals; + args = []; + } else { + name = easingVals[1]; + args = easingVals.slice(2).map(function (n) { + return +n; + }); + } + + if (args.length > 0) { + // create with args + if (name === 'spring') { + args.push(ani_p.duration); // need duration to generate spring + } + + ani_p.easingImpl = easings[name].apply(null, args); + } else { + // static impl by name + ani_p.easingImpl = easings[name]; + } + } + } + + var easing = ani_p.easingImpl; + var percent; + + if (ani_p.duration === 0) { + percent = 1; + } else { + percent = (now - startTime) / ani_p.duration; + } + + if (ani_p.applying) { + percent = ani_p.progress; + } + + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + + if (ani_p.delay == null) { + // then update + var startPos = ani_p.startPosition; + var endPos = ani_p.position; + + if (endPos && isEles && !self.locked()) { + var newPos = {}; + + if (valid(startPos.x, endPos.x)) { + newPos.x = ease(startPos.x, endPos.x, percent, easing); + } + + if (valid(startPos.y, endPos.y)) { + newPos.y = ease(startPos.y, endPos.y, percent, easing); + } + + self.position(newPos); + } + + var startPan = ani_p.startPan; + var endPan = ani_p.pan; + var pan = _p.pan; + var animatingPan = endPan != null && isCore; + + if (animatingPan) { + if (valid(startPan.x, endPan.x)) { + pan.x = ease(startPan.x, endPan.x, percent, easing); + } + + if (valid(startPan.y, endPan.y)) { + pan.y = ease(startPan.y, endPan.y, percent, easing); + } + + self.emit('pan'); + } + + var startZoom = ani_p.startZoom; + var endZoom = ani_p.zoom; + var animatingZoom = endZoom != null && isCore; + + if (animatingZoom) { + if (valid(startZoom, endZoom)) { + _p.zoom = bound(_p.minZoom, ease(startZoom, endZoom, percent, easing), _p.maxZoom); + } + + self.emit('zoom'); + } + + if (animatingPan || animatingZoom) { + self.emit('viewport'); + } + + var props = ani_p.style; + + if (props && props.length > 0 && isEles) { + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + var _name = prop.name; + var end = prop; + var start = ani_p.startStyle[_name]; + var propSpec = style.properties[start.name]; + var easedVal = ease(start, end, percent, easing, propSpec); + style.overrideBypass(self, _name, easedVal); + } // for props + + + self.emit('style'); + } // if + + } + + ani_p.progress = percent; + return percent; + } + + function valid(start, end) { + if (start == null || end == null) { + return false; + } + + if (number$1(start) && number$1(end)) { + return true; + } else if (start && end) { + return true; + } + + return false; + } + + function startAnimation(self, ani, now, isCore) { + var ani_p = ani._private; + ani_p.started = true; + ani_p.startTime = now - ani_p.progress * ani_p.duration; + } + + function stepAll(now, cy) { + var eles = cy._private.aniEles; + var doneEles = []; + + function stepOne(ele, isCore) { + var _p = ele._private; + var current = _p.animation.current; + var queue = _p.animation.queue; + var ranAnis = false; // if nothing currently animating, get something from the queue + + if (current.length === 0) { + var next = queue.shift(); + + if (next) { + current.push(next); + } + } + + var callbacks = function callbacks(_callbacks) { + for (var j = _callbacks.length - 1; j >= 0; j--) { + var cb = _callbacks[j]; + cb(); + } + + _callbacks.splice(0, _callbacks.length); + }; // step and remove if done + + + for (var i = current.length - 1; i >= 0; i--) { + var ani = current[i]; + var ani_p = ani._private; + + if (ani_p.stopped) { + current.splice(i, 1); + ani_p.hooked = false; + ani_p.playing = false; + ani_p.started = false; + callbacks(ani_p.frames); + continue; + } + + if (!ani_p.playing && !ani_p.applying) { + continue; + } // an apply() while playing shouldn't do anything + + + if (ani_p.playing && ani_p.applying) { + ani_p.applying = false; + } + + if (!ani_p.started) { + startAnimation(ele, ani, now); + } + + step$1(ele, ani, now, isCore); + + if (ani_p.applying) { + ani_p.applying = false; + } + + callbacks(ani_p.frames); + + if (ani_p.step != null) { + ani_p.step(now); + } + + if (ani.completed()) { + current.splice(i, 1); + ani_p.hooked = false; + ani_p.playing = false; + ani_p.started = false; + callbacks(ani_p.completes); + } + + ranAnis = true; + } + + if (!isCore && current.length === 0 && queue.length === 0) { + doneEles.push(ele); + } + + return ranAnis; + } // stepElement + // handle all eles + + + var ranEleAni = false; + + for (var e = 0; e < eles.length; e++) { + var ele = eles[e]; + var handledThisEle = stepOne(ele); + ranEleAni = ranEleAni || handledThisEle; + } // each element + + + var ranCoreAni = stepOne(cy, true); // notify renderer + + if (ranEleAni || ranCoreAni) { + if (eles.length > 0) { + cy.notify('draw', eles); + } else { + cy.notify('draw'); + } + } // remove elements from list of currently animating if its queues are empty + + + eles.unmerge(doneEles); + cy.emit('step'); + } // stepAll + + var corefn$8 = { + // pull in animation functions + animate: define.animate(), + animation: define.animation(), + animated: define.animated(), + clearQueue: define.clearQueue(), + delay: define.delay(), + delayAnimation: define.delayAnimation(), + stop: define.stop(), + addToAnimationPool: function addToAnimationPool(eles) { + var cy = this; + + if (!cy.styleEnabled()) { + return; + } // save cycles when no style used + + + cy._private.aniEles.merge(eles); + }, + stopAnimationLoop: function stopAnimationLoop() { + this._private.animationsRunning = false; + }, + startAnimationLoop: function startAnimationLoop() { + var cy = this; + cy._private.animationsRunning = true; + + if (!cy.styleEnabled()) { + return; + } // save cycles when no style used + // NB the animation loop will exec in headless environments if style enabled + // and explicit cy.destroy() is necessary to stop the loop + + + function headlessStep() { + if (!cy._private.animationsRunning) { + return; + } + + requestAnimationFrame(function animationStep(now) { + stepAll(now, cy); + headlessStep(); + }); + } + + var renderer = cy.renderer(); + + if (renderer && renderer.beforeRender) { + // let the renderer schedule animations + renderer.beforeRender(function rendererAnimationStep(willDraw, now) { + stepAll(now, cy); + }, renderer.beforeRenderPriorities.animations); + } else { + // manage the animation loop ourselves + headlessStep(); // first call + } + } + }; + + var emitterOptions = { + qualifierCompare: function qualifierCompare(selector1, selector2) { + if (selector1 == null || selector2 == null) { + return selector1 == null && selector2 == null; + } else { + return selector1.sameText(selector2); + } + }, + eventMatches: function eventMatches(cy, listener, eventObj) { + var selector = listener.qualifier; + + if (selector != null) { + return cy !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target); + } + + return true; + }, + addEventFields: function addEventFields(cy, evt) { + evt.cy = cy; + evt.target = cy; + }, + callbackContext: function callbackContext(cy, listener, eventObj) { + return listener.qualifier != null ? eventObj.target : cy; + } + }; + + var argSelector = function argSelector(arg) { + if (string(arg)) { + return new Selector(arg); + } else { + return arg; + } + }; + + var elesfn = { + createEmitter: function createEmitter() { + var _p = this._private; + + if (!_p.emitter) { + _p.emitter = new Emitter(emitterOptions, this); + } + + return this; + }, + emitter: function emitter() { + return this._private.emitter; + }, + on: function on(events, selector, callback) { + this.emitter().on(events, argSelector(selector), callback); + return this; + }, + removeListener: function removeListener(events, selector, callback) { + this.emitter().removeListener(events, argSelector(selector), callback); + return this; + }, + removeAllListeners: function removeAllListeners() { + this.emitter().removeAllListeners(); + return this; + }, + one: function one(events, selector, callback) { + this.emitter().one(events, argSelector(selector), callback); + return this; + }, + once: function once(events, selector, callback) { + this.emitter().one(events, argSelector(selector), callback); + return this; + }, + emit: function emit(events, extraParams) { + this.emitter().emit(events, extraParams); + return this; + }, + emitAndNotify: function emitAndNotify(event, eles) { + this.emit(event); + this.notify(event, eles); + return this; + } + }; + define.eventAliasesOn(elesfn); + + var corefn$7 = { + png: function png(options) { + var renderer = this._private.renderer; + options = options || {}; + return renderer.png(options); + }, + jpg: function jpg(options) { + var renderer = this._private.renderer; + options = options || {}; + options.bg = options.bg || '#fff'; + return renderer.jpg(options); + } + }; + corefn$7.jpeg = corefn$7.jpg; + + var corefn$6 = { + layout: function layout(options) { + var cy = this; + + if (options == null) { + error('Layout options must be specified to make a layout'); + return; + } + + if (options.name == null) { + error('A `name` must be specified to make a layout'); + return; + } + + var name = options.name; + var Layout = cy.extension('layout', name); + + if (Layout == null) { + error('No such layout `' + name + '` found. Did you forget to import it and `cytoscape.use()` it?'); + return; + } + + var eles; + + if (string(options.eles)) { + eles = cy.$(options.eles); + } else { + eles = options.eles != null ? options.eles : cy.$(); + } + + var layout = new Layout(extend({}, options, { + cy: cy, + eles: eles + })); + return layout; + } + }; + corefn$6.createLayout = corefn$6.makeLayout = corefn$6.layout; + + var corefn$5 = { + notify: function notify(eventName, eventEles) { + var _p = this._private; + + if (this.batching()) { + _p.batchNotifications = _p.batchNotifications || {}; + var eles = _p.batchNotifications[eventName] = _p.batchNotifications[eventName] || this.collection(); + + if (eventEles != null) { + eles.merge(eventEles); + } + + return; // notifications are disabled during batching + } + + if (!_p.notificationsEnabled) { + return; + } // exit on disabled + + + var renderer = this.renderer(); // exit if destroy() called on core or renderer in between frames #1499 #1528 + + if (this.destroyed() || !renderer) { + return; + } + + renderer.notify(eventName, eventEles); + }, + notifications: function notifications(bool) { + var p = this._private; + + if (bool === undefined) { + return p.notificationsEnabled; + } else { + p.notificationsEnabled = bool ? true : false; + } + + return this; + }, + noNotifications: function noNotifications(callback) { + this.notifications(false); + callback(); + this.notifications(true); + }, + batching: function batching() { + return this._private.batchCount > 0; + }, + startBatch: function startBatch() { + var _p = this._private; + + if (_p.batchCount == null) { + _p.batchCount = 0; + } + + if (_p.batchCount === 0) { + _p.batchStyleEles = this.collection(); + _p.batchNotifications = {}; + } + + _p.batchCount++; + return this; + }, + endBatch: function endBatch() { + var _p = this._private; + + if (_p.batchCount === 0) { + return this; + } + + _p.batchCount--; + + if (_p.batchCount === 0) { + // update style for dirty eles + _p.batchStyleEles.updateStyle(); + + var renderer = this.renderer(); // notify the renderer of queued eles and event types + + Object.keys(_p.batchNotifications).forEach(function (eventName) { + var eles = _p.batchNotifications[eventName]; + + if (eles.empty()) { + renderer.notify(eventName); + } else { + renderer.notify(eventName, eles); + } + }); + } + + return this; + }, + batch: function batch(callback) { + this.startBatch(); + callback(); + this.endBatch(); + return this; + }, + // for backwards compatibility + batchData: function batchData(map) { + var cy = this; + return this.batch(function () { + var ids = Object.keys(map); + + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + var data = map[id]; + var ele = cy.getElementById(id); + ele.data(data); + } + }); + } + }; + + var rendererDefaults = defaults$g({ + hideEdgesOnViewport: false, + textureOnViewport: false, + motionBlur: false, + motionBlurOpacity: 0.05, + pixelRatio: undefined, + desktopTapThreshold: 4, + touchTapThreshold: 8, + wheelSensitivity: 1, + debug: false, + showFps: false + }); + var corefn$4 = { + renderTo: function renderTo(context, zoom, pan, pxRatio) { + var r = this._private.renderer; + r.renderTo(context, zoom, pan, pxRatio); + return this; + }, + renderer: function renderer() { + return this._private.renderer; + }, + forceRender: function forceRender() { + this.notify('draw'); + return this; + }, + resize: function resize() { + this.invalidateSize(); + this.emitAndNotify('resize'); + return this; + }, + initRenderer: function initRenderer(options) { + var cy = this; + var RendererProto = cy.extension('renderer', options.name); + + if (RendererProto == null) { + error("Can not initialise: No such renderer `".concat(options.name, "` found. Did you forget to import it and `cytoscape.use()` it?")); + return; + } + + if (options.wheelSensitivity !== undefined) { + warn("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine."); + } + + var rOpts = rendererDefaults(options); + rOpts.cy = cy; + cy._private.renderer = new RendererProto(rOpts); + this.notify('init'); + }, + destroyRenderer: function destroyRenderer() { + var cy = this; + cy.notify('destroy'); // destroy the renderer + + var domEle = cy.container(); + + if (domEle) { + domEle._cyreg = null; + + while (domEle.childNodes.length > 0) { + domEle.removeChild(domEle.childNodes[0]); + } + } + + cy._private.renderer = null; // to be extra safe, remove the ref + + cy.mutableElements().forEach(function (ele) { + var _p = ele._private; + _p.rscratch = {}; + _p.rstyle = {}; + _p.animation.current = []; + _p.animation.queue = []; + }); + }, + onRender: function onRender(fn) { + return this.on('render', fn); + }, + offRender: function offRender(fn) { + return this.off('render', fn); + } + }; + corefn$4.invalidateDimensions = corefn$4.resize; + + var corefn$3 = { + // get a collection + // - empty collection on no args + // - collection of elements in the graph on selector arg + // - guarantee a returned collection when elements or collection specified + collection: function collection(eles, opts) { + if (string(eles)) { + return this.$(eles); + } else if (elementOrCollection(eles)) { + return eles.collection(); + } else if (array(eles)) { + if (!opts) { + opts = {}; + } + + return new Collection(this, eles, opts.unique, opts.removed); + } + + return new Collection(this); + }, + nodes: function nodes(selector) { + var nodes = this.$(function (ele) { + return ele.isNode(); + }); + + if (selector) { + return nodes.filter(selector); + } + + return nodes; + }, + edges: function edges(selector) { + var edges = this.$(function (ele) { + return ele.isEdge(); + }); + + if (selector) { + return edges.filter(selector); + } + + return edges; + }, + // search the graph like jQuery + $: function $(selector) { + var eles = this._private.elements; + + if (selector) { + return eles.filter(selector); + } else { + return eles.spawnSelf(); + } + }, + mutableElements: function mutableElements() { + return this._private.elements; + } + }; // aliases + + corefn$3.elements = corefn$3.filter = corefn$3.$; + + var styfn$8 = {}; // keys for style blocks, e.g. ttfftt + + var TRUE = 't'; + var FALSE = 'f'; // (potentially expensive calculation) + // apply the style to the element based on + // - its bypass + // - what selectors match it + + styfn$8.apply = function (eles) { + var self = this; + var _p = self._private; + var cy = _p.cy; + var updatedEles = cy.collection(); + + for (var ie = 0; ie < eles.length; ie++) { + var ele = eles[ie]; + var cxtMeta = self.getContextMeta(ele); + + if (cxtMeta.empty) { + continue; + } + + var cxtStyle = self.getContextStyle(cxtMeta); + var app = self.applyContextStyle(cxtMeta, cxtStyle, ele); + + if (ele._private.appliedInitStyle) { + self.updateTransitions(ele, app.diffProps); + } else { + ele._private.appliedInitStyle = true; + } + + var hintsDiff = self.updateStyleHints(ele); + + if (hintsDiff) { + updatedEles.push(ele); + } + } // for elements + + + return updatedEles; + }; + + styfn$8.getPropertiesDiff = function (oldCxtKey, newCxtKey) { + var self = this; + var cache = self._private.propDiffs = self._private.propDiffs || {}; + var dualCxtKey = oldCxtKey + '-' + newCxtKey; + var cachedVal = cache[dualCxtKey]; + + if (cachedVal) { + return cachedVal; + } + + var diffProps = []; + var addedProp = {}; + + for (var i = 0; i < self.length; i++) { + var cxt = self[i]; + var oldHasCxt = oldCxtKey[i] === TRUE; + var newHasCxt = newCxtKey[i] === TRUE; + var cxtHasDiffed = oldHasCxt !== newHasCxt; + var cxtHasMappedProps = cxt.mappedProperties.length > 0; + + if (cxtHasDiffed || newHasCxt && cxtHasMappedProps) { + var props = void 0; + + if (cxtHasDiffed && cxtHasMappedProps) { + props = cxt.properties; // suffices b/c mappedProperties is a subset of properties + } else if (cxtHasDiffed) { + props = cxt.properties; // need to check them all + } else if (cxtHasMappedProps) { + props = cxt.mappedProperties; // only need to check mapped + } + + for (var j = 0; j < props.length; j++) { + var prop = props[j]; + var name = prop.name; // if a later context overrides this property, then the fact that this context has switched/diffed doesn't matter + // (semi expensive check since it makes this function O(n^2) on context length, but worth it since overall result + // is cached) + + var laterCxtOverrides = false; + + for (var k = i + 1; k < self.length; k++) { + var laterCxt = self[k]; + var hasLaterCxt = newCxtKey[k] === TRUE; + + if (!hasLaterCxt) { + continue; + } // can't override unless the context is active + + + laterCxtOverrides = laterCxt.properties[prop.name] != null; + + if (laterCxtOverrides) { + break; + } // exit early as long as one later context overrides + + } + + if (!addedProp[name] && !laterCxtOverrides) { + addedProp[name] = true; + diffProps.push(name); + } + } // for props + + } // if + + } // for contexts + + + cache[dualCxtKey] = diffProps; + return diffProps; + }; + + styfn$8.getContextMeta = function (ele) { + var self = this; + var cxtKey = ''; + var diffProps; + var prevKey = ele._private.styleCxtKey || ''; // get the cxt key + + for (var i = 0; i < self.length; i++) { + var context = self[i]; + var contextSelectorMatches = context.selector && context.selector.matches(ele); // NB: context.selector may be null for 'core' + + if (contextSelectorMatches) { + cxtKey += TRUE; + } else { + cxtKey += FALSE; + } + } // for context + + + diffProps = self.getPropertiesDiff(prevKey, cxtKey); + ele._private.styleCxtKey = cxtKey; + return { + key: cxtKey, + diffPropNames: diffProps, + empty: diffProps.length === 0 + }; + }; // gets a computed ele style object based on matched contexts + + + styfn$8.getContextStyle = function (cxtMeta) { + var cxtKey = cxtMeta.key; + var self = this; + var cxtStyles = this._private.contextStyles = this._private.contextStyles || {}; // if already computed style, returned cached copy + + if (cxtStyles[cxtKey]) { + return cxtStyles[cxtKey]; + } + + var style = { + _private: { + key: cxtKey + } + }; + + for (var i = 0; i < self.length; i++) { + var cxt = self[i]; + var hasCxt = cxtKey[i] === TRUE; + + if (!hasCxt) { + continue; + } + + for (var j = 0; j < cxt.properties.length; j++) { + var prop = cxt.properties[j]; + style[prop.name] = prop; + } + } + + cxtStyles[cxtKey] = style; + return style; + }; + + styfn$8.applyContextStyle = function (cxtMeta, cxtStyle, ele) { + var self = this; + var diffProps = cxtMeta.diffPropNames; + var retDiffProps = {}; + var types = self.types; + + for (var i = 0; i < diffProps.length; i++) { + var diffPropName = diffProps[i]; + var cxtProp = cxtStyle[diffPropName]; + var eleProp = ele.pstyle(diffPropName); + + if (!cxtProp) { + // no context prop means delete + if (!eleProp) { + continue; // no existing prop means nothing needs to be removed + // nb affects initial application on mapped values like control-point-distances + } else if (eleProp.bypass) { + cxtProp = { + name: diffPropName, + deleteBypassed: true + }; + } else { + cxtProp = { + name: diffPropName, + "delete": true + }; + } + } // save cycles when the context prop doesn't need to be applied + + + if (eleProp === cxtProp) { + continue; + } // save cycles when a mapped context prop doesn't need to be applied + + + if (cxtProp.mapped === types.fn // context prop is function mapper + && eleProp != null // some props can be null even by default (e.g. a prop that overrides another one) + && eleProp.mapping != null // ele prop is a concrete value from from a mapper + && eleProp.mapping.value === cxtProp.value // the current prop on the ele is a flat prop value for the function mapper + ) { + // NB don't write to cxtProp, as it's shared among eles (stored in stylesheet) + var mapping = eleProp.mapping; // can write to mapping, as it's a per-ele copy + + var fnValue = mapping.fnValue = cxtProp.value(ele); // temporarily cache the value in case of a miss + + if (fnValue === mapping.prevFnValue) { + continue; + } + } + + var retDiffProp = retDiffProps[diffPropName] = { + prev: eleProp + }; + self.applyParsedProperty(ele, cxtProp); + retDiffProp.next = ele.pstyle(diffPropName); + + if (retDiffProp.next && retDiffProp.next.bypass) { + retDiffProp.next = retDiffProp.next.bypassed; + } + } + + return { + diffProps: retDiffProps + }; + }; + + styfn$8.updateStyleHints = function (ele) { + var _p = ele._private; + var self = this; + var propNames = self.propertyGroupNames; + var propGrKeys = self.propertyGroupKeys; + + var propHash = function propHash(ele, propNames, seedKey) { + return self.getPropertiesHash(ele, propNames, seedKey); + }; + + var oldStyleKey = _p.styleKey; + + if (ele.removed()) { + return false; + } + + var isNode = _p.group === 'nodes'; // get the style key hashes per prop group + // but lazily -- only use non-default prop values to reduce the number of hashes + // + + var overriddenStyles = ele._private.style; + propNames = Object.keys(overriddenStyles); + + for (var i = 0; i < propGrKeys.length; i++) { + var grKey = propGrKeys[i]; + _p.styleKeys[grKey] = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]; + } + + var updateGrKey1 = function updateGrKey1(val, grKey) { + return _p.styleKeys[grKey][0] = hashInt(val, _p.styleKeys[grKey][0]); + }; + + var updateGrKey2 = function updateGrKey2(val, grKey) { + return _p.styleKeys[grKey][1] = hashIntAlt(val, _p.styleKeys[grKey][1]); + }; + + var updateGrKey = function updateGrKey(val, grKey) { + updateGrKey1(val, grKey); + updateGrKey2(val, grKey); + }; + + var updateGrKeyWStr = function updateGrKeyWStr(strVal, grKey) { + for (var j = 0; j < strVal.length; j++) { + var ch = strVal.charCodeAt(j); + updateGrKey1(ch, grKey); + updateGrKey2(ch, grKey); + } + }; // - hashing works on 32 bit ints b/c we use bitwise ops + // - small numbers get cut off (e.g. 0.123 is seen as 0 by the hashing function) + // - raise up small numbers so more significant digits are seen by hashing + // - make small numbers larger than a normal value to avoid collisions + // - works in practice and it's relatively cheap + + + var N = 2000000000; + + var cleanNum = function cleanNum(val) { + return -128 < val && val < 128 && Math.floor(val) !== val ? N - (val * 1024 | 0) : val; + }; + + for (var _i = 0; _i < propNames.length; _i++) { + var name = propNames[_i]; + var parsedProp = overriddenStyles[name]; + + if (parsedProp == null) { + continue; + } + + var propInfo = this.properties[name]; + var type = propInfo.type; + var _grKey = propInfo.groupKey; + var normalizedNumberVal = void 0; + + if (propInfo.hashOverride != null) { + normalizedNumberVal = propInfo.hashOverride(ele, parsedProp); + } else if (parsedProp.pfValue != null) { + normalizedNumberVal = parsedProp.pfValue; + } // might not be a number if it allows enums + + + var numberVal = propInfo.enums == null ? parsedProp.value : null; + var haveNormNum = normalizedNumberVal != null; + var haveUnitedNum = numberVal != null; + var haveNum = haveNormNum || haveUnitedNum; + var units = parsedProp.units; // numbers are cheaper to hash than strings + // 1 hash op vs n hash ops (for length n string) + + if (type.number && haveNum && !type.multiple) { + var v = haveNormNum ? normalizedNumberVal : numberVal; + updateGrKey(cleanNum(v), _grKey); + + if (!haveNormNum && units != null) { + updateGrKeyWStr(units, _grKey); + } + } else { + updateGrKeyWStr(parsedProp.strValue, _grKey); + } + } // overall style key + // + + + var hash = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]; + + for (var _i2 = 0; _i2 < propGrKeys.length; _i2++) { + var _grKey2 = propGrKeys[_i2]; + var grHash = _p.styleKeys[_grKey2]; + hash[0] = hashInt(grHash[0], hash[0]); + hash[1] = hashIntAlt(grHash[1], hash[1]); + } + + _p.styleKey = combineHashes(hash[0], hash[1]); // label dims + // + + var sk = _p.styleKeys; + _p.labelDimsKey = combineHashesArray(sk.labelDimensions); + var labelKeys = propHash(ele, ['label'], sk.labelDimensions); + _p.labelKey = combineHashesArray(labelKeys); + _p.labelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, labelKeys)); + + if (!isNode) { + var sourceLabelKeys = propHash(ele, ['source-label'], sk.labelDimensions); + _p.sourceLabelKey = combineHashesArray(sourceLabelKeys); + _p.sourceLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, sourceLabelKeys)); + var targetLabelKeys = propHash(ele, ['target-label'], sk.labelDimensions); + _p.targetLabelKey = combineHashesArray(targetLabelKeys); + _p.targetLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, targetLabelKeys)); + } // node + // + + + if (isNode) { + var _p$styleKeys = _p.styleKeys, + nodeBody = _p$styleKeys.nodeBody, + nodeBorder = _p$styleKeys.nodeBorder, + backgroundImage = _p$styleKeys.backgroundImage, + compound = _p$styleKeys.compound, + pie = _p$styleKeys.pie; + var nodeKeys = [nodeBody, nodeBorder, backgroundImage, compound, pie].filter(function (k) { + return k != null; + }).reduce(hashArrays, [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]); + _p.nodeKey = combineHashesArray(nodeKeys); + _p.hasPie = pie != null && pie[0] !== DEFAULT_HASH_SEED && pie[1] !== DEFAULT_HASH_SEED_ALT; + } + + return oldStyleKey !== _p.styleKey; + }; + + styfn$8.clearStyleHints = function (ele) { + var _p = ele._private; + _p.styleCxtKey = ''; + _p.styleKeys = {}; + _p.styleKey = null; + _p.labelKey = null; + _p.labelStyleKey = null; + _p.sourceLabelKey = null; + _p.sourceLabelStyleKey = null; + _p.targetLabelKey = null; + _p.targetLabelStyleKey = null; + _p.nodeKey = null; + _p.hasPie = null; + }; // apply a property to the style (for internal use) + // returns whether application was successful + // + // now, this function flattens the property, and here's how: + // + // for parsedProp:{ bypass: true, deleteBypass: true } + // no property is generated, instead the bypass property in the + // element's style is replaced by what's pointed to by the `bypassed` + // field in the bypass property (i.e. restoring the property the + // bypass was overriding) + // + // for parsedProp:{ mapped: truthy } + // the generated flattenedProp:{ mapping: prop } + // + // for parsedProp:{ bypass: true } + // the generated flattenedProp:{ bypassed: parsedProp } + + + styfn$8.applyParsedProperty = function (ele, parsedProp) { + var self = this; + var prop = parsedProp; + var style = ele._private.style; + var flatProp; + var types = self.types; + var type = self.properties[prop.name].type; + var propIsBypass = prop.bypass; + var origProp = style[prop.name]; + var origPropIsBypass = origProp && origProp.bypass; + var _p = ele._private; + var flatPropMapping = 'mapping'; + + var getVal = function getVal(p) { + if (p == null) { + return null; + } else if (p.pfValue != null) { + return p.pfValue; + } else { + return p.value; + } + }; + + var checkTriggers = function checkTriggers() { + var fromVal = getVal(origProp); + var toVal = getVal(prop); + self.checkTriggers(ele, prop.name, fromVal, toVal); + }; + + if (prop && prop.name.substr(0, 3) === 'pie') { + warn('The pie style properties are deprecated. Create charts using background images instead.'); + } // edge sanity checks to prevent the client from making serious mistakes + + + if (parsedProp.name === 'curve-style' && ele.isEdge() && ( // loops must be bundled beziers + parsedProp.value !== 'bezier' && ele.isLoop() || // edges connected to compound nodes can not be haystacks + parsedProp.value === 'haystack' && (ele.source().isParent() || ele.target().isParent()))) { + prop = parsedProp = this.parse(parsedProp.name, 'bezier', propIsBypass); + } + + if (prop["delete"]) { + // delete the property and use the default value on falsey value + style[prop.name] = undefined; + checkTriggers(); + return true; + } + + if (prop.deleteBypassed) { + // delete the property that the + if (!origProp) { + checkTriggers(); + return true; // can't delete if no prop + } else if (origProp.bypass) { + // delete bypassed + origProp.bypassed = undefined; + checkTriggers(); + return true; + } else { + return false; // we're unsuccessful deleting the bypassed + } + } // check if we need to delete the current bypass + + + if (prop.deleteBypass) { + // then this property is just here to indicate we need to delete + if (!origProp) { + checkTriggers(); + return true; // property is already not defined + } else if (origProp.bypass) { + // then replace the bypass property with the original + // because the bypassed property was already applied (and therefore parsed), we can just replace it (no reapplying necessary) + style[prop.name] = origProp.bypassed; + checkTriggers(); + return true; + } else { + return false; // we're unsuccessful deleting the bypass + } + } + + var printMappingErr = function printMappingErr() { + warn('Do not assign mappings to elements without corresponding data (i.e. ele `' + ele.id() + '` has no mapping for property `' + prop.name + '` with data field `' + prop.field + '`); try a `[' + prop.field + ']` selector to limit scope to elements with `' + prop.field + '` defined'); + }; // put the property in the style objects + + + switch (prop.mapped) { + // flatten the property if mapped + case types.mapData: + { + // flatten the field (e.g. data.foo.bar) + var fields = prop.field.split('.'); + var fieldVal = _p.data; + + for (var i = 0; i < fields.length && fieldVal; i++) { + var field = fields[i]; + fieldVal = fieldVal[field]; + } + + if (fieldVal == null) { + printMappingErr(); + return false; + } + + var percent; + + if (!number$1(fieldVal)) { + // then don't apply and fall back on the existing style + warn('Do not use continuous mappers without specifying numeric data (i.e. `' + prop.field + ': ' + fieldVal + '` for `' + ele.id() + '` is non-numeric)'); + return false; + } else { + var fieldWidth = prop.fieldMax - prop.fieldMin; + + if (fieldWidth === 0) { + // safety check -- not strictly necessary as no props of zero range should be passed here + percent = 0; + } else { + percent = (fieldVal - prop.fieldMin) / fieldWidth; + } + } // make sure to bound percent value + + + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + + if (type.color) { + var r1 = prop.valueMin[0]; + var r2 = prop.valueMax[0]; + var g1 = prop.valueMin[1]; + var g2 = prop.valueMax[1]; + var b1 = prop.valueMin[2]; + var b2 = prop.valueMax[2]; + var a1 = prop.valueMin[3] == null ? 1 : prop.valueMin[3]; + var a2 = prop.valueMax[3] == null ? 1 : prop.valueMax[3]; + var clr = [Math.round(r1 + (r2 - r1) * percent), Math.round(g1 + (g2 - g1) * percent), Math.round(b1 + (b2 - b1) * percent), Math.round(a1 + (a2 - a1) * percent)]; + flatProp = { + // colours are simple, so just create the flat property instead of expensive string parsing + bypass: prop.bypass, + // we're a bypass if the mapping property is a bypass + name: prop.name, + value: clr, + strValue: 'rgb(' + clr[0] + ', ' + clr[1] + ', ' + clr[2] + ')' + }; + } else if (type.number) { + var calcValue = prop.valueMin + (prop.valueMax - prop.valueMin) * percent; + flatProp = this.parse(prop.name, calcValue, prop.bypass, flatPropMapping); + } else { + return false; // can only map to colours and numbers + } + + if (!flatProp) { + // if we can't flatten the property, then don't apply the property and fall back on the existing style + printMappingErr(); + return false; + } + + flatProp.mapping = prop; // keep a reference to the mapping + + prop = flatProp; // the flattened (mapped) property is the one we want + + break; + } + // direct mapping + + case types.data: + { + // flatten the field (e.g. data.foo.bar) + var _fields = prop.field.split('.'); + + var _fieldVal = _p.data; + + for (var _i3 = 0; _i3 < _fields.length && _fieldVal; _i3++) { + var _field = _fields[_i3]; + _fieldVal = _fieldVal[_field]; + } + + if (_fieldVal != null) { + flatProp = this.parse(prop.name, _fieldVal, prop.bypass, flatPropMapping); + } + + if (!flatProp) { + // if we can't flatten the property, then don't apply and fall back on the existing style + printMappingErr(); + return false; + } + + flatProp.mapping = prop; // keep a reference to the mapping + + prop = flatProp; // the flattened (mapped) property is the one we want + + break; + } + + case types.fn: + { + var fn = prop.value; + var fnRetVal = prop.fnValue != null ? prop.fnValue : fn(ele); // check for cached value before calling function + + prop.prevFnValue = fnRetVal; + + if (fnRetVal == null) { + warn('Custom function mappers may not return null (i.e. `' + prop.name + '` for ele `' + ele.id() + '` is null)'); + return false; + } + + flatProp = this.parse(prop.name, fnRetVal, prop.bypass, flatPropMapping); + + if (!flatProp) { + warn('Custom function mappers may not return invalid values for the property type (i.e. `' + prop.name + '` for ele `' + ele.id() + '` is invalid)'); + return false; + } + + flatProp.mapping = copy(prop); // keep a reference to the mapping + + prop = flatProp; // the flattened (mapped) property is the one we want + + break; + } + + case undefined: + break; + // just set the property + + default: + return false; + // not a valid mapping + } // if the property is a bypass property, then link the resultant property to the original one + + + if (propIsBypass) { + if (origPropIsBypass) { + // then this bypass overrides the existing one + prop.bypassed = origProp.bypassed; // steal bypassed prop from old bypass + } else { + // then link the orig prop to the new bypass + prop.bypassed = origProp; + } + + style[prop.name] = prop; // and set + } else { + // prop is not bypass + if (origPropIsBypass) { + // then keep the orig prop (since it's a bypass) and link to the new prop + origProp.bypassed = prop; + } else { + // then just replace the old prop with the new one + style[prop.name] = prop; + } + } + + checkTriggers(); + return true; + }; + + styfn$8.cleanElements = function (eles, keepBypasses) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + this.clearStyleHints(ele); + ele.dirtyCompoundBoundsCache(); + ele.dirtyBoundingBoxCache(); + + if (!keepBypasses) { + ele._private.style = {}; + } else { + var style = ele._private.style; + var propNames = Object.keys(style); + + for (var j = 0; j < propNames.length; j++) { + var propName = propNames[j]; + var eleProp = style[propName]; + + if (eleProp != null) { + if (eleProp.bypass) { + eleProp.bypassed = null; + } else { + style[propName] = null; + } + } + } + } + } + }; // updates the visual style for all elements (useful for manual style modification after init) + + + styfn$8.update = function () { + var cy = this._private.cy; + var eles = cy.mutableElements(); + eles.updateStyle(); + }; // diffProps : { name => { prev, next } } + + + styfn$8.updateTransitions = function (ele, diffProps) { + var self = this; + var _p = ele._private; + var props = ele.pstyle('transition-property').value; + var duration = ele.pstyle('transition-duration').pfValue; + var delay = ele.pstyle('transition-delay').pfValue; + + if (props.length > 0 && duration > 0) { + var style = {}; // build up the style to animate towards + + var anyPrev = false; + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + var styProp = ele.pstyle(prop); + var diffProp = diffProps[prop]; + + if (!diffProp) { + continue; + } + + var prevProp = diffProp.prev; + var fromProp = prevProp; + var toProp = diffProp.next != null ? diffProp.next : styProp; + var diff = false; + var initVal = void 0; + var initDt = 0.000001; // delta time % value for initVal (allows animating out of init zero opacity) + + if (!fromProp) { + continue; + } // consider px values + + + if (number$1(fromProp.pfValue) && number$1(toProp.pfValue)) { + diff = toProp.pfValue - fromProp.pfValue; // nonzero is truthy + + initVal = fromProp.pfValue + initDt * diff; // consider numerical values + } else if (number$1(fromProp.value) && number$1(toProp.value)) { + diff = toProp.value - fromProp.value; // nonzero is truthy + + initVal = fromProp.value + initDt * diff; // consider colour values + } else if (array(fromProp.value) && array(toProp.value)) { + diff = fromProp.value[0] !== toProp.value[0] || fromProp.value[1] !== toProp.value[1] || fromProp.value[2] !== toProp.value[2]; + initVal = fromProp.strValue; + } // the previous value is good for an animation only if it's different + + + if (diff) { + style[prop] = toProp.strValue; // to val + + this.applyBypass(ele, prop, initVal); // from val + + anyPrev = true; + } + } // end if props allow ani + // can't transition if there's nothing previous to transition from + + + if (!anyPrev) { + return; + } + + _p.transitioning = true; + new Promise$1(function (resolve) { + if (delay > 0) { + ele.delayAnimation(delay).play().promise().then(resolve); + } else { + resolve(); + } + }).then(function () { + return ele.animation({ + style: style, + duration: duration, + easing: ele.pstyle('transition-timing-function').value, + queue: false + }).play().promise(); + }).then(function () { + // if( !isBypass ){ + self.removeBypasses(ele, props); + ele.emitAndNotify('style'); // } + + _p.transitioning = false; + }); + } else if (_p.transitioning) { + this.removeBypasses(ele, props); + ele.emitAndNotify('style'); + _p.transitioning = false; + } + }; + + styfn$8.checkTrigger = function (ele, name, fromValue, toValue, getTrigger, onTrigger) { + var prop = this.properties[name]; + var triggerCheck = getTrigger(prop); + + if (triggerCheck != null && triggerCheck(fromValue, toValue)) { + onTrigger(prop); + } + }; + + styfn$8.checkZOrderTrigger = function (ele, name, fromValue, toValue) { + var _this = this; + + this.checkTrigger(ele, name, fromValue, toValue, function (prop) { + return prop.triggersZOrder; + }, function () { + _this._private.cy.notify('zorder', ele); + }); + }; + + styfn$8.checkBoundsTrigger = function (ele, name, fromValue, toValue) { + this.checkTrigger(ele, name, fromValue, toValue, function (prop) { + return prop.triggersBounds; + }, function (prop) { + ele.dirtyCompoundBoundsCache(); + ele.dirtyBoundingBoxCache(); // if the prop change makes the bb of pll bezier edges invalid, + // then dirty the pll edge bb cache as well + + if ( // only for beziers -- so performance of other edges isn't affected + prop.triggersBoundsOfParallelBeziers && (name === 'curve-style' && (fromValue === 'bezier' || toValue === 'bezier') || name === 'display' && (fromValue === 'none' || toValue === 'none'))) { + ele.parallelEdges().forEach(function (pllEdge) { + if (pllEdge.isBundledBezier()) { + pllEdge.dirtyBoundingBoxCache(); + } + }); + } + }); + }; + + styfn$8.checkTriggers = function (ele, name, fromValue, toValue) { + ele.dirtyStyleCache(); + this.checkZOrderTrigger(ele, name, fromValue, toValue); + this.checkBoundsTrigger(ele, name, fromValue, toValue); + }; + + var styfn$7 = {}; // bypasses are applied to an existing style on an element, and just tacked on temporarily + // returns true iff application was successful for at least 1 specified property + + styfn$7.applyBypass = function (eles, name, value, updateTransitions) { + var self = this; + var props = []; + var isBypass = true; // put all the properties (can specify one or many) in an array after parsing them + + if (name === '*' || name === '**') { + // apply to all property names + if (value !== undefined) { + for (var i = 0; i < self.properties.length; i++) { + var prop = self.properties[i]; + var _name = prop.name; + var parsedProp = this.parse(_name, value, true); + + if (parsedProp) { + props.push(parsedProp); + } + } + } + } else if (string(name)) { + // then parse the single property + var _parsedProp = this.parse(name, value, true); + + if (_parsedProp) { + props.push(_parsedProp); + } + } else if (plainObject(name)) { + // then parse each property + var specifiedProps = name; + updateTransitions = value; + var names = Object.keys(specifiedProps); + + for (var _i = 0; _i < names.length; _i++) { + var _name2 = names[_i]; + var _value = specifiedProps[_name2]; + + if (_value === undefined) { + // try camel case name too + _value = specifiedProps[dash2camel(_name2)]; + } + + if (_value !== undefined) { + var _parsedProp2 = this.parse(_name2, _value, true); + + if (_parsedProp2) { + props.push(_parsedProp2); + } + } + } + } else { + // can't do anything without well defined properties + return false; + } // we've failed if there are no valid properties + + + if (props.length === 0) { + return false; + } // now, apply the bypass properties on the elements + + + var ret = false; // return true if at least one succesful bypass applied + + for (var _i2 = 0; _i2 < eles.length; _i2++) { + // for each ele + var ele = eles[_i2]; + var diffProps = {}; + var diffProp = void 0; + + for (var j = 0; j < props.length; j++) { + // for each prop + var _prop = props[j]; + + if (updateTransitions) { + var prevProp = ele.pstyle(_prop.name); + diffProp = diffProps[_prop.name] = { + prev: prevProp + }; + } + + ret = this.applyParsedProperty(ele, copy(_prop)) || ret; + + if (updateTransitions) { + diffProp.next = ele.pstyle(_prop.name); + } + } // for props + + + if (ret) { + this.updateStyleHints(ele); + } + + if (updateTransitions) { + this.updateTransitions(ele, diffProps, isBypass); + } + } // for eles + + + return ret; + }; // only useful in specific cases like animation + + + styfn$7.overrideBypass = function (eles, name, value) { + name = camel2dash(name); + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var prop = ele._private.style[name]; + var type = this.properties[name].type; + var isColor = type.color; + var isMulti = type.mutiple; + var oldValue = !prop ? null : prop.pfValue != null ? prop.pfValue : prop.value; + + if (!prop || !prop.bypass) { + // need a bypass if one doesn't exist + this.applyBypass(ele, name, value); + } else { + prop.value = value; + + if (prop.pfValue != null) { + prop.pfValue = value; + } + + if (isColor) { + prop.strValue = 'rgb(' + value.join(',') + ')'; + } else if (isMulti) { + prop.strValue = value.join(' '); + } else { + prop.strValue = '' + value; + } + + this.updateStyleHints(ele); + } + + this.checkTriggers(ele, name, oldValue, value); + } + }; + + styfn$7.removeAllBypasses = function (eles, updateTransitions) { + return this.removeBypasses(eles, this.propertyNames, updateTransitions); + }; + + styfn$7.removeBypasses = function (eles, props, updateTransitions) { + var isBypass = true; + + for (var j = 0; j < eles.length; j++) { + var ele = eles[j]; + var diffProps = {}; + + for (var i = 0; i < props.length; i++) { + var name = props[i]; + var prop = this.properties[name]; + var prevProp = ele.pstyle(prop.name); + + if (!prevProp || !prevProp.bypass) { + // if a bypass doesn't exist for the prop, nothing needs to be removed + continue; + } + + var value = ''; // empty => remove bypass + + var parsedProp = this.parse(name, value, true); + var diffProp = diffProps[prop.name] = { + prev: prevProp + }; + this.applyParsedProperty(ele, parsedProp); + diffProp.next = ele.pstyle(prop.name); + } // for props + + + this.updateStyleHints(ele); + + if (updateTransitions) { + this.updateTransitions(ele, diffProps, isBypass); + } + } // for eles + + }; + + var styfn$6 = {}; // gets what an em size corresponds to in pixels relative to a dom element + + styfn$6.getEmSizeInPixels = function () { + var px = this.containerCss('font-size'); + + if (px != null) { + return parseFloat(px); + } else { + return 1; // for headless + } + }; // gets css property from the core container + + + styfn$6.containerCss = function (propName) { + var cy = this._private.cy; + var domElement = cy.container(); + + if (window$1 && domElement && window$1.getComputedStyle) { + return window$1.getComputedStyle(domElement).getPropertyValue(propName); + } + }; + + var styfn$5 = {}; // gets the rendered style for an element + + styfn$5.getRenderedStyle = function (ele, prop) { + if (prop) { + return this.getStylePropertyValue(ele, prop, true); + } else { + return this.getRawStyle(ele, true); + } + }; // gets the raw style for an element + + + styfn$5.getRawStyle = function (ele, isRenderedVal) { + var self = this; + ele = ele[0]; // insure it's an element + + if (ele) { + var rstyle = {}; + + for (var i = 0; i < self.properties.length; i++) { + var prop = self.properties[i]; + var val = self.getStylePropertyValue(ele, prop.name, isRenderedVal); + + if (val != null) { + rstyle[prop.name] = val; + rstyle[dash2camel(prop.name)] = val; + } + } + + return rstyle; + } + }; + + styfn$5.getIndexedStyle = function (ele, property, subproperty, index) { + var pstyle = ele.pstyle(property)[subproperty][index]; + return pstyle != null ? pstyle : ele.cy().style().getDefaultProperty(property)[subproperty][0]; + }; + + styfn$5.getStylePropertyValue = function (ele, propName, isRenderedVal) { + var self = this; + ele = ele[0]; // insure it's an element + + if (ele) { + var prop = self.properties[propName]; + + if (prop.alias) { + prop = prop.pointsTo; + } + + var type = prop.type; + var styleProp = ele.pstyle(prop.name); + + if (styleProp) { + var value = styleProp.value, + units = styleProp.units, + strValue = styleProp.strValue; + + if (isRenderedVal && type.number && value != null && number$1(value)) { + var zoom = ele.cy().zoom(); + + var getRenderedValue = function getRenderedValue(val) { + return val * zoom; + }; + + var getValueStringWithUnits = function getValueStringWithUnits(val, units) { + return getRenderedValue(val) + units; + }; + + var isArrayValue = array(value); + var haveUnits = isArrayValue ? units.every(function (u) { + return u != null; + }) : units != null; + + if (haveUnits) { + if (isArrayValue) { + return value.map(function (v, i) { + return getValueStringWithUnits(v, units[i]); + }).join(' '); + } else { + return getValueStringWithUnits(value, units); + } + } else { + if (isArrayValue) { + return value.map(function (v) { + return string(v) ? v : '' + getRenderedValue(v); + }).join(' '); + } else { + return '' + getRenderedValue(value); + } + } + } else if (strValue != null) { + return strValue; + } + } + + return null; + } + }; + + styfn$5.getAnimationStartStyle = function (ele, aniProps) { + var rstyle = {}; + + for (var i = 0; i < aniProps.length; i++) { + var aniProp = aniProps[i]; + var name = aniProp.name; + var styleProp = ele.pstyle(name); + + if (styleProp !== undefined) { + // then make a prop of it + if (plainObject(styleProp)) { + styleProp = this.parse(name, styleProp.strValue); + } else { + styleProp = this.parse(name, styleProp); + } + } + + if (styleProp) { + rstyle[name] = styleProp; + } + } + + return rstyle; + }; + + styfn$5.getPropsList = function (propsObj) { + var self = this; + var rstyle = []; + var style = propsObj; + var props = self.properties; + + if (style) { + var names = Object.keys(style); + + for (var i = 0; i < names.length; i++) { + var name = names[i]; + var val = style[name]; + var prop = props[name] || props[camel2dash(name)]; + var styleProp = this.parse(prop.name, val); + + if (styleProp) { + rstyle.push(styleProp); + } + } + } + + return rstyle; + }; + + styfn$5.getNonDefaultPropertiesHash = function (ele, propNames, seed) { + var hash = seed.slice(); + var name, val, strVal, chVal; + var i, j; + + for (i = 0; i < propNames.length; i++) { + name = propNames[i]; + val = ele.pstyle(name, false); + + if (val == null) { + continue; + } else if (val.pfValue != null) { + hash[0] = hashInt(chVal, hash[0]); + hash[1] = hashIntAlt(chVal, hash[1]); + } else { + strVal = val.strValue; + + for (j = 0; j < strVal.length; j++) { + chVal = strVal.charCodeAt(j); + hash[0] = hashInt(chVal, hash[0]); + hash[1] = hashIntAlt(chVal, hash[1]); + } + } + } + + return hash; + }; + + styfn$5.getPropertiesHash = styfn$5.getNonDefaultPropertiesHash; + + var styfn$4 = {}; + + styfn$4.appendFromJson = function (json) { + var style = this; + + for (var i = 0; i < json.length; i++) { + var context = json[i]; + var selector = context.selector; + var props = context.style || context.css; + var names = Object.keys(props); + style.selector(selector); // apply selector + + for (var j = 0; j < names.length; j++) { + var name = names[j]; + var value = props[name]; + style.css(name, value); // apply property + } + } + + return style; + }; // accessible cy.style() function + + + styfn$4.fromJson = function (json) { + var style = this; + style.resetToDefault(); + style.appendFromJson(json); + return style; + }; // get json from cy.style() api + + + styfn$4.json = function () { + var json = []; + + for (var i = this.defaultLength; i < this.length; i++) { + var cxt = this[i]; + var selector = cxt.selector; + var props = cxt.properties; + var css = {}; + + for (var j = 0; j < props.length; j++) { + var prop = props[j]; + css[prop.name] = prop.strValue; + } + + json.push({ + selector: !selector ? 'core' : selector.toString(), + style: css + }); + } + + return json; + }; + + var styfn$3 = {}; + + styfn$3.appendFromString = function (string) { + var self = this; + var style = this; + var remaining = '' + string; + var selAndBlockStr; + var blockRem; + var propAndValStr; // remove comments from the style string + + remaining = remaining.replace(/[/][*](\s|.)+?[*][/]/g, ''); + + function removeSelAndBlockFromRemaining() { + // remove the parsed selector and block from the remaining text to parse + if (remaining.length > selAndBlockStr.length) { + remaining = remaining.substr(selAndBlockStr.length); + } else { + remaining = ''; + } + } + + function removePropAndValFromRem() { + // remove the parsed property and value from the remaining block text to parse + if (blockRem.length > propAndValStr.length) { + blockRem = blockRem.substr(propAndValStr.length); + } else { + blockRem = ''; + } + } + + for (;;) { + var nothingLeftToParse = remaining.match(/^\s*$/); + + if (nothingLeftToParse) { + break; + } + + var selAndBlock = remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/); + + if (!selAndBlock) { + warn('Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: ' + remaining); + break; + } + + selAndBlockStr = selAndBlock[0]; // parse the selector + + var selectorStr = selAndBlock[1]; + + if (selectorStr !== 'core') { + var selector = new Selector(selectorStr); + + if (selector.invalid) { + warn('Skipping parsing of block: Invalid selector found in string stylesheet: ' + selectorStr); // skip this selector and block + + removeSelAndBlockFromRemaining(); + continue; + } + } // parse the block of properties and values + + + var blockStr = selAndBlock[2]; + var invalidBlock = false; + blockRem = blockStr; + var props = []; + + for (;;) { + var _nothingLeftToParse = blockRem.match(/^\s*$/); + + if (_nothingLeftToParse) { + break; + } + + var propAndVal = blockRem.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/); + + if (!propAndVal) { + warn('Skipping parsing of block: Invalid formatting of style property and value definitions found in:' + blockStr); + invalidBlock = true; + break; + } + + propAndValStr = propAndVal[0]; + var propStr = propAndVal[1]; + var valStr = propAndVal[2]; + var prop = self.properties[propStr]; + + if (!prop) { + warn('Skipping property: Invalid property name in: ' + propAndValStr); // skip this property in the block + + removePropAndValFromRem(); + continue; + } + + var parsedProp = style.parse(propStr, valStr); + + if (!parsedProp) { + warn('Skipping property: Invalid property definition in: ' + propAndValStr); // skip this property in the block + + removePropAndValFromRem(); + continue; + } + + props.push({ + name: propStr, + val: valStr + }); + removePropAndValFromRem(); + } + + if (invalidBlock) { + removeSelAndBlockFromRemaining(); + break; + } // put the parsed block in the style + + + style.selector(selectorStr); + + for (var i = 0; i < props.length; i++) { + var _prop = props[i]; + style.css(_prop.name, _prop.val); + } + + removeSelAndBlockFromRemaining(); + } + + return style; + }; + + styfn$3.fromString = function (string) { + var style = this; + style.resetToDefault(); + style.appendFromString(string); + return style; + }; + + var styfn$2 = {}; + + (function () { + var number$1 = number; + var rgba = rgbaNoBackRefs; + var hsla = hslaNoBackRefs; + var hex3$1 = hex3; + var hex6$1 = hex6; + + var data = function data(prefix) { + return '^' + prefix + '\\s*\\(\\s*([\\w\\.]+)\\s*\\)$'; + }; + + var mapData = function mapData(prefix) { + var mapArg = number$1 + '|\\w+|' + rgba + '|' + hsla + '|' + hex3$1 + '|' + hex6$1; + return '^' + prefix + '\\s*\\(([\\w\\.]+)\\s*\\,\\s*(' + number$1 + ')\\s*\\,\\s*(' + number$1 + ')\\s*,\\s*(' + mapArg + ')\\s*\\,\\s*(' + mapArg + ')\\)$'; + }; + + var urlRegexes = ['^url\\s*\\(\\s*[\'"]?(.+?)[\'"]?\\s*\\)$', '^(none)$', '^(.+)$']; // each visual style property has a type and needs to be validated according to it + + styfn$2.types = { + time: { + number: true, + min: 0, + units: 's|ms', + implicitUnits: 'ms' + }, + percent: { + number: true, + min: 0, + max: 100, + units: '%', + implicitUnits: '%' + }, + percentages: { + number: true, + min: 0, + max: 100, + units: '%', + implicitUnits: '%', + multiple: true + }, + zeroOneNumber: { + number: true, + min: 0, + max: 1, + unitless: true + }, + zeroOneNumbers: { + number: true, + min: 0, + max: 1, + unitless: true, + multiple: true + }, + nOneOneNumber: { + number: true, + min: -1, + max: 1, + unitless: true + }, + nonNegativeInt: { + number: true, + min: 0, + integer: true, + unitless: true + }, + position: { + enums: ['parent', 'origin'] + }, + nodeSize: { + number: true, + min: 0, + enums: ['label'] + }, + number: { + number: true, + unitless: true + }, + numbers: { + number: true, + unitless: true, + multiple: true + }, + positiveNumber: { + number: true, + unitless: true, + min: 0, + strictMin: true + }, + size: { + number: true, + min: 0 + }, + bidirectionalSize: { + number: true + }, + // allows negative + bidirectionalSizeMaybePercent: { + number: true, + allowPercent: true + }, + // allows negative + bidirectionalSizes: { + number: true, + multiple: true + }, + // allows negative + sizeMaybePercent: { + number: true, + min: 0, + allowPercent: true + }, + axisDirection: { + enums: ['horizontal', 'leftward', 'rightward', 'vertical', 'upward', 'downward', 'auto'] + }, + paddingRelativeTo: { + enums: ['width', 'height', 'average', 'min', 'max'] + }, + bgWH: { + number: true, + min: 0, + allowPercent: true, + enums: ['auto'], + multiple: true + }, + bgPos: { + number: true, + allowPercent: true, + multiple: true + }, + bgRelativeTo: { + enums: ['inner', 'include-padding'], + multiple: true + }, + bgRepeat: { + enums: ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'], + multiple: true + }, + bgFit: { + enums: ['none', 'contain', 'cover'], + multiple: true + }, + bgCrossOrigin: { + enums: ['anonymous', 'use-credentials', 'null'], + multiple: true + }, + bgClip: { + enums: ['none', 'node'], + multiple: true + }, + bgContainment: { + enums: ['inside', 'over'], + multiple: true + }, + color: { + color: true + }, + colors: { + color: true, + multiple: true + }, + fill: { + enums: ['solid', 'linear-gradient', 'radial-gradient'] + }, + bool: { + enums: ['yes', 'no'] + }, + bools: { + enums: ['yes', 'no'], + multiple: true + }, + lineStyle: { + enums: ['solid', 'dotted', 'dashed'] + }, + lineCap: { + enums: ['butt', 'round', 'square'] + }, + borderStyle: { + enums: ['solid', 'dotted', 'dashed', 'double'] + }, + curveStyle: { + enums: ['bezier', 'unbundled-bezier', 'haystack', 'segments', 'straight', 'straight-triangle', 'taxi'] + }, + fontFamily: { + regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$' + }, + fontStyle: { + enums: ['italic', 'normal', 'oblique'] + }, + fontWeight: { + enums: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '800', '900', 100, 200, 300, 400, 500, 600, 700, 800, 900] + }, + textDecoration: { + enums: ['none', 'underline', 'overline', 'line-through'] + }, + textTransform: { + enums: ['none', 'uppercase', 'lowercase'] + }, + textWrap: { + enums: ['none', 'wrap', 'ellipsis'] + }, + textOverflowWrap: { + enums: ['whitespace', 'anywhere'] + }, + textBackgroundShape: { + enums: ['rectangle', 'roundrectangle', 'round-rectangle'] + }, + nodeShape: { + enums: ['rectangle', 'roundrectangle', 'round-rectangle', 'cutrectangle', 'cut-rectangle', 'bottomroundrectangle', 'bottom-round-rectangle', 'barrel', 'ellipse', 'triangle', 'round-triangle', 'square', 'pentagon', 'round-pentagon', 'hexagon', 'round-hexagon', 'concavehexagon', 'concave-hexagon', 'heptagon', 'round-heptagon', 'octagon', 'round-octagon', 'tag', 'round-tag', 'star', 'diamond', 'round-diamond', 'vee', 'rhomboid', 'right-rhomboid', 'polygon'] + }, + overlayShape: { + enums: ['roundrectangle', 'round-rectangle', 'ellipse'] + }, + compoundIncludeLabels: { + enums: ['include', 'exclude'] + }, + arrowShape: { + enums: ['tee', 'triangle', 'triangle-tee', 'circle-triangle', 'triangle-cross', 'triangle-backcurve', 'vee', 'square', 'circle', 'diamond', 'chevron', 'none'] + }, + arrowFill: { + enums: ['filled', 'hollow'] + }, + display: { + enums: ['element', 'none'] + }, + visibility: { + enums: ['hidden', 'visible'] + }, + zCompoundDepth: { + enums: ['bottom', 'orphan', 'auto', 'top'] + }, + zIndexCompare: { + enums: ['auto', 'manual'] + }, + valign: { + enums: ['top', 'center', 'bottom'] + }, + halign: { + enums: ['left', 'center', 'right'] + }, + justification: { + enums: ['left', 'center', 'right', 'auto'] + }, + text: { + string: true + }, + data: { + mapping: true, + regex: data('data') + }, + layoutData: { + mapping: true, + regex: data('layoutData') + }, + scratch: { + mapping: true, + regex: data('scratch') + }, + mapData: { + mapping: true, + regex: mapData('mapData') + }, + mapLayoutData: { + mapping: true, + regex: mapData('mapLayoutData') + }, + mapScratch: { + mapping: true, + regex: mapData('mapScratch') + }, + fn: { + mapping: true, + fn: true + }, + url: { + regexes: urlRegexes, + singleRegexMatchValue: true + }, + urls: { + regexes: urlRegexes, + singleRegexMatchValue: true, + multiple: true + }, + propList: { + propList: true + }, + angle: { + number: true, + units: 'deg|rad', + implicitUnits: 'rad' + }, + textRotation: { + number: true, + units: 'deg|rad', + implicitUnits: 'rad', + enums: ['none', 'autorotate'] + }, + polygonPointList: { + number: true, + multiple: true, + evenMultiple: true, + min: -1, + max: 1, + unitless: true + }, + edgeDistances: { + enums: ['intersection', 'node-position'] + }, + edgeEndpoint: { + number: true, + multiple: true, + units: '%|px|em|deg|rad', + implicitUnits: 'px', + enums: ['inside-to-node', 'outside-to-node', 'outside-to-node-or-label', 'outside-to-line', 'outside-to-line-or-label'], + singleEnum: true, + validate: function validate(valArr, unitsArr) { + switch (valArr.length) { + case 2: + // can be % or px only + return unitsArr[0] !== 'deg' && unitsArr[0] !== 'rad' && unitsArr[1] !== 'deg' && unitsArr[1] !== 'rad'; + + case 1: + // can be enum, deg, or rad only + return string(valArr[0]) || unitsArr[0] === 'deg' || unitsArr[0] === 'rad'; + + default: + return false; + } + } + }, + easing: { + regexes: ['^(spring)\\s*\\(\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*\\)$', '^(cubic-bezier)\\s*\\(\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*,\\s*(' + number$1 + ')\\s*\\)$'], + enums: ['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'ease-in-sine', 'ease-out-sine', 'ease-in-out-sine', 'ease-in-quad', 'ease-out-quad', 'ease-in-out-quad', 'ease-in-cubic', 'ease-out-cubic', 'ease-in-out-cubic', 'ease-in-quart', 'ease-out-quart', 'ease-in-out-quart', 'ease-in-quint', 'ease-out-quint', 'ease-in-out-quint', 'ease-in-expo', 'ease-out-expo', 'ease-in-out-expo', 'ease-in-circ', 'ease-out-circ', 'ease-in-out-circ'] + }, + gradientDirection: { + enums: ['to-bottom', 'to-top', 'to-left', 'to-right', 'to-bottom-right', 'to-bottom-left', 'to-top-right', 'to-top-left', 'to-right-bottom', 'to-left-bottom', 'to-right-top', 'to-left-top' // different order + ] + }, + boundsExpansion: { + number: true, + multiple: true, + min: 0, + validate: function validate(valArr) { + var length = valArr.length; + return length === 1 || length === 2 || length === 4; + } + } + }; + var diff = { + zeroNonZero: function zeroNonZero(val1, val2) { + if ((val1 == null || val2 == null) && val1 !== val2) { + return true; // null cases could represent any value + } + + if (val1 == 0 && val2 != 0) { + return true; + } else if (val1 != 0 && val2 == 0) { + return true; + } else { + return false; + } + }, + any: function any(val1, val2) { + return val1 != val2; + }, + emptyNonEmpty: function emptyNonEmpty(str1, str2) { + var empty1 = emptyString(str1); + var empty2 = emptyString(str2); + return empty1 && !empty2 || !empty1 && empty2; + } + }; // define visual style properties + // + // - n.b. adding a new group of props may require updates to updateStyleHints() + // - adding new props to an existing group gets handled automatically + + var t = styfn$2.types; + var mainLabel = [{ + name: 'label', + type: t.text, + triggersBounds: diff.any, + triggersZOrder: diff.emptyNonEmpty + }, { + name: 'text-rotation', + type: t.textRotation, + triggersBounds: diff.any + }, { + name: 'text-margin-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'text-margin-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }]; + var sourceLabel = [{ + name: 'source-label', + type: t.text, + triggersBounds: diff.any + }, { + name: 'source-text-rotation', + type: t.textRotation, + triggersBounds: diff.any + }, { + name: 'source-text-margin-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'source-text-margin-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'source-text-offset', + type: t.size, + triggersBounds: diff.any + }]; + var targetLabel = [{ + name: 'target-label', + type: t.text, + triggersBounds: diff.any + }, { + name: 'target-text-rotation', + type: t.textRotation, + triggersBounds: diff.any + }, { + name: 'target-text-margin-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'target-text-margin-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'target-text-offset', + type: t.size, + triggersBounds: diff.any + }]; + var labelDimensions = [{ + name: 'font-family', + type: t.fontFamily, + triggersBounds: diff.any + }, { + name: 'font-style', + type: t.fontStyle, + triggersBounds: diff.any + }, { + name: 'font-weight', + type: t.fontWeight, + triggersBounds: diff.any + }, { + name: 'font-size', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-transform', + type: t.textTransform, + triggersBounds: diff.any + }, { + name: 'text-wrap', + type: t.textWrap, + triggersBounds: diff.any + }, { + name: 'text-overflow-wrap', + type: t.textOverflowWrap, + triggersBounds: diff.any + }, { + name: 'text-max-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-outline-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'line-height', + type: t.positiveNumber, + triggersBounds: diff.any + }]; + var commonLabel = [{ + name: 'text-valign', + type: t.valign, + triggersBounds: diff.any + }, { + name: 'text-halign', + type: t.halign, + triggersBounds: diff.any + }, { + name: 'color', + type: t.color + }, { + name: 'text-outline-color', + type: t.color + }, { + name: 'text-outline-opacity', + type: t.zeroOneNumber + }, { + name: 'text-background-color', + type: t.color + }, { + name: 'text-background-opacity', + type: t.zeroOneNumber + }, { + name: 'text-background-padding', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-border-opacity', + type: t.zeroOneNumber + }, { + name: 'text-border-color', + type: t.color + }, { + name: 'text-border-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'text-border-style', + type: t.borderStyle, + triggersBounds: diff.any + }, { + name: 'text-background-shape', + type: t.textBackgroundShape, + triggersBounds: diff.any + }, { + name: 'text-justification', + type: t.justification + }]; + var behavior = [{ + name: 'events', + type: t.bool + }, { + name: 'text-events', + type: t.bool + }]; + var visibility = [{ + name: 'display', + type: t.display, + triggersZOrder: diff.any, + triggersBounds: diff.any, + triggersBoundsOfParallelBeziers: true + }, { + name: 'visibility', + type: t.visibility, + triggersZOrder: diff.any + }, { + name: 'opacity', + type: t.zeroOneNumber, + triggersZOrder: diff.zeroNonZero + }, { + name: 'text-opacity', + type: t.zeroOneNumber + }, { + name: 'min-zoomed-font-size', + type: t.size + }, { + name: 'z-compound-depth', + type: t.zCompoundDepth, + triggersZOrder: diff.any + }, { + name: 'z-index-compare', + type: t.zIndexCompare, + triggersZOrder: diff.any + }, { + name: 'z-index', + type: t.nonNegativeInt, + triggersZOrder: diff.any + }]; + var overlay = [{ + name: 'overlay-padding', + type: t.size, + triggersBounds: diff.any + }, { + name: 'overlay-color', + type: t.color + }, { + name: 'overlay-opacity', + type: t.zeroOneNumber, + triggersBounds: diff.zeroNonZero + }, { + name: 'overlay-shape', + type: t.overlayShape, + triggersBounds: diff.any + }]; + var underlay = [{ + name: 'underlay-padding', + type: t.size, + triggersBounds: diff.any + }, { + name: 'underlay-color', + type: t.color + }, { + name: 'underlay-opacity', + type: t.zeroOneNumber, + triggersBounds: diff.zeroNonZero + }, { + name: 'underlay-shape', + type: t.overlayShape, + triggersBounds: diff.any + }]; + var transition = [{ + name: 'transition-property', + type: t.propList + }, { + name: 'transition-duration', + type: t.time + }, { + name: 'transition-delay', + type: t.time + }, { + name: 'transition-timing-function', + type: t.easing + }]; + + var nodeSizeHashOverride = function nodeSizeHashOverride(ele, parsedProp) { + if (parsedProp.value === 'label') { + return -ele.poolIndex(); // no hash key hits is using label size (hitrate for perf probably low anyway) + } else { + return parsedProp.pfValue; + } + }; + + var nodeBody = [{ + name: 'height', + type: t.nodeSize, + triggersBounds: diff.any, + hashOverride: nodeSizeHashOverride + }, { + name: 'width', + type: t.nodeSize, + triggersBounds: diff.any, + hashOverride: nodeSizeHashOverride + }, { + name: 'shape', + type: t.nodeShape, + triggersBounds: diff.any + }, { + name: 'shape-polygon-points', + type: t.polygonPointList, + triggersBounds: diff.any + }, { + name: 'background-color', + type: t.color + }, { + name: 'background-fill', + type: t.fill + }, { + name: 'background-opacity', + type: t.zeroOneNumber + }, { + name: 'background-blacken', + type: t.nOneOneNumber + }, { + name: 'background-gradient-stop-colors', + type: t.colors + }, { + name: 'background-gradient-stop-positions', + type: t.percentages + }, { + name: 'background-gradient-direction', + type: t.gradientDirection + }, { + name: 'padding', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'padding-relative-to', + type: t.paddingRelativeTo, + triggersBounds: diff.any + }, { + name: 'bounds-expansion', + type: t.boundsExpansion, + triggersBounds: diff.any + }]; + var nodeBorder = [{ + name: 'border-color', + type: t.color + }, { + name: 'border-opacity', + type: t.zeroOneNumber + }, { + name: 'border-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'border-style', + type: t.borderStyle + }]; + var backgroundImage = [{ + name: 'background-image', + type: t.urls + }, { + name: 'background-image-crossorigin', + type: t.bgCrossOrigin + }, { + name: 'background-image-opacity', + type: t.zeroOneNumbers + }, { + name: 'background-image-containment', + type: t.bgContainment + }, { + name: 'background-image-smoothing', + type: t.bools + }, { + name: 'background-position-x', + type: t.bgPos + }, { + name: 'background-position-y', + type: t.bgPos + }, { + name: 'background-width-relative-to', + type: t.bgRelativeTo + }, { + name: 'background-height-relative-to', + type: t.bgRelativeTo + }, { + name: 'background-repeat', + type: t.bgRepeat + }, { + name: 'background-fit', + type: t.bgFit + }, { + name: 'background-clip', + type: t.bgClip + }, { + name: 'background-width', + type: t.bgWH + }, { + name: 'background-height', + type: t.bgWH + }, { + name: 'background-offset-x', + type: t.bgPos + }, { + name: 'background-offset-y', + type: t.bgPos + }]; + var compound = [{ + name: 'position', + type: t.position, + triggersBounds: diff.any + }, { + name: 'compound-sizing-wrt-labels', + type: t.compoundIncludeLabels, + triggersBounds: diff.any + }, { + name: 'min-width', + type: t.size, + triggersBounds: diff.any + }, { + name: 'min-width-bias-left', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'min-width-bias-right', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'min-height', + type: t.size, + triggersBounds: diff.any + }, { + name: 'min-height-bias-top', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'min-height-bias-bottom', + type: t.sizeMaybePercent, + triggersBounds: diff.any + }]; + var edgeLine = [{ + name: 'line-style', + type: t.lineStyle + }, { + name: 'line-color', + type: t.color + }, { + name: 'line-fill', + type: t.fill + }, { + name: 'line-cap', + type: t.lineCap + }, { + name: 'line-opacity', + type: t.zeroOneNumber + }, { + name: 'line-dash-pattern', + type: t.numbers + }, { + name: 'line-dash-offset', + type: t.number + }, { + name: 'line-gradient-stop-colors', + type: t.colors + }, { + name: 'line-gradient-stop-positions', + type: t.percentages + }, { + name: 'curve-style', + type: t.curveStyle, + triggersBounds: diff.any, + triggersBoundsOfParallelBeziers: true + }, { + name: 'haystack-radius', + type: t.zeroOneNumber, + triggersBounds: diff.any + }, { + name: 'source-endpoint', + type: t.edgeEndpoint, + triggersBounds: diff.any + }, { + name: 'target-endpoint', + type: t.edgeEndpoint, + triggersBounds: diff.any + }, { + name: 'control-point-step-size', + type: t.size, + triggersBounds: diff.any + }, { + name: 'control-point-distances', + type: t.bidirectionalSizes, + triggersBounds: diff.any + }, { + name: 'control-point-weights', + type: t.numbers, + triggersBounds: diff.any + }, { + name: 'segment-distances', + type: t.bidirectionalSizes, + triggersBounds: diff.any + }, { + name: 'segment-weights', + type: t.numbers, + triggersBounds: diff.any + }, { + name: 'taxi-turn', + type: t.bidirectionalSizeMaybePercent, + triggersBounds: diff.any + }, { + name: 'taxi-turn-min-distance', + type: t.size, + triggersBounds: diff.any + }, { + name: 'taxi-direction', + type: t.axisDirection, + triggersBounds: diff.any + }, { + name: 'edge-distances', + type: t.edgeDistances, + triggersBounds: diff.any + }, { + name: 'arrow-scale', + type: t.positiveNumber, + triggersBounds: diff.any + }, { + name: 'loop-direction', + type: t.angle, + triggersBounds: diff.any + }, { + name: 'loop-sweep', + type: t.angle, + triggersBounds: diff.any + }, { + name: 'source-distance-from-node', + type: t.size, + triggersBounds: diff.any + }, { + name: 'target-distance-from-node', + type: t.size, + triggersBounds: diff.any + }]; + var ghost = [{ + name: 'ghost', + type: t.bool, + triggersBounds: diff.any + }, { + name: 'ghost-offset-x', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'ghost-offset-y', + type: t.bidirectionalSize, + triggersBounds: diff.any + }, { + name: 'ghost-opacity', + type: t.zeroOneNumber + }]; + var core = [{ + name: 'selection-box-color', + type: t.color + }, { + name: 'selection-box-opacity', + type: t.zeroOneNumber + }, { + name: 'selection-box-border-color', + type: t.color + }, { + name: 'selection-box-border-width', + type: t.size + }, { + name: 'active-bg-color', + type: t.color + }, { + name: 'active-bg-opacity', + type: t.zeroOneNumber + }, { + name: 'active-bg-size', + type: t.size + }, { + name: 'outside-texture-bg-color', + type: t.color + }, { + name: 'outside-texture-bg-opacity', + type: t.zeroOneNumber + }]; // pie backgrounds for nodes + + var pie = []; + styfn$2.pieBackgroundN = 16; // because the pie properties are numbered, give access to a constant N (for renderer use) + + pie.push({ + name: 'pie-size', + type: t.sizeMaybePercent + }); + + for (var i = 1; i <= styfn$2.pieBackgroundN; i++) { + pie.push({ + name: 'pie-' + i + '-background-color', + type: t.color + }); + pie.push({ + name: 'pie-' + i + '-background-size', + type: t.percent + }); + pie.push({ + name: 'pie-' + i + '-background-opacity', + type: t.zeroOneNumber + }); + } // edge arrows + + + var edgeArrow = []; + var arrowPrefixes = styfn$2.arrowPrefixes = ['source', 'mid-source', 'target', 'mid-target']; + [{ + name: 'arrow-shape', + type: t.arrowShape, + triggersBounds: diff.any + }, { + name: 'arrow-color', + type: t.color + }, { + name: 'arrow-fill', + type: t.arrowFill + }].forEach(function (prop) { + arrowPrefixes.forEach(function (prefix) { + var name = prefix + '-' + prop.name; + var type = prop.type, + triggersBounds = prop.triggersBounds; + edgeArrow.push({ + name: name, + type: type, + triggersBounds: triggersBounds + }); + }); + }, {}); + var props = styfn$2.properties = [].concat(behavior, transition, visibility, overlay, underlay, ghost, commonLabel, labelDimensions, mainLabel, sourceLabel, targetLabel, nodeBody, nodeBorder, backgroundImage, pie, compound, edgeLine, edgeArrow, core); + var propGroups = styfn$2.propertyGroups = { + // common to all eles + behavior: behavior, + transition: transition, + visibility: visibility, + overlay: overlay, + underlay: underlay, + ghost: ghost, + // labels + commonLabel: commonLabel, + labelDimensions: labelDimensions, + mainLabel: mainLabel, + sourceLabel: sourceLabel, + targetLabel: targetLabel, + // node props + nodeBody: nodeBody, + nodeBorder: nodeBorder, + backgroundImage: backgroundImage, + pie: pie, + compound: compound, + // edge props + edgeLine: edgeLine, + edgeArrow: edgeArrow, + core: core + }; + var propGroupNames = styfn$2.propertyGroupNames = {}; + var propGroupKeys = styfn$2.propertyGroupKeys = Object.keys(propGroups); + propGroupKeys.forEach(function (key) { + propGroupNames[key] = propGroups[key].map(function (prop) { + return prop.name; + }); + propGroups[key].forEach(function (prop) { + return prop.groupKey = key; + }); + }); // define aliases + + var aliases = styfn$2.aliases = [{ + name: 'content', + pointsTo: 'label' + }, { + name: 'control-point-distance', + pointsTo: 'control-point-distances' + }, { + name: 'control-point-weight', + pointsTo: 'control-point-weights' + }, { + name: 'edge-text-rotation', + pointsTo: 'text-rotation' + }, { + name: 'padding-left', + pointsTo: 'padding' + }, { + name: 'padding-right', + pointsTo: 'padding' + }, { + name: 'padding-top', + pointsTo: 'padding' + }, { + name: 'padding-bottom', + pointsTo: 'padding' + }]; // list of property names + + styfn$2.propertyNames = props.map(function (p) { + return p.name; + }); // allow access of properties by name ( e.g. style.properties.height ) + + for (var _i = 0; _i < props.length; _i++) { + var prop = props[_i]; + props[prop.name] = prop; // allow lookup by name + } // map aliases + + + for (var _i2 = 0; _i2 < aliases.length; _i2++) { + var alias = aliases[_i2]; + var pointsToProp = props[alias.pointsTo]; + var aliasProp = { + name: alias.name, + alias: true, + pointsTo: pointsToProp + }; // add alias prop for parsing + + props.push(aliasProp); + props[alias.name] = aliasProp; // allow lookup by name + } + })(); + + styfn$2.getDefaultProperty = function (name) { + return this.getDefaultProperties()[name]; + }; + + styfn$2.getDefaultProperties = function () { + var _p = this._private; + + if (_p.defaultProperties != null) { + return _p.defaultProperties; + } + + var rawProps = extend({ + // core props + 'selection-box-color': '#ddd', + 'selection-box-opacity': 0.65, + 'selection-box-border-color': '#aaa', + 'selection-box-border-width': 1, + 'active-bg-color': 'black', + 'active-bg-opacity': 0.15, + 'active-bg-size': 30, + 'outside-texture-bg-color': '#000', + 'outside-texture-bg-opacity': 0.125, + // common node/edge props + 'events': 'yes', + 'text-events': 'no', + 'text-valign': 'top', + 'text-halign': 'center', + 'text-justification': 'auto', + 'line-height': 1, + 'color': '#000', + 'text-outline-color': '#000', + 'text-outline-width': 0, + 'text-outline-opacity': 1, + 'text-opacity': 1, + 'text-decoration': 'none', + 'text-transform': 'none', + 'text-wrap': 'none', + 'text-overflow-wrap': 'whitespace', + 'text-max-width': 9999, + 'text-background-color': '#000', + 'text-background-opacity': 0, + 'text-background-shape': 'rectangle', + 'text-background-padding': 0, + 'text-border-opacity': 0, + 'text-border-width': 0, + 'text-border-style': 'solid', + 'text-border-color': '#000', + 'font-family': 'Helvetica Neue, Helvetica, sans-serif', + 'font-style': 'normal', + 'font-weight': 'normal', + 'font-size': 16, + 'min-zoomed-font-size': 0, + 'text-rotation': 'none', + 'source-text-rotation': 'none', + 'target-text-rotation': 'none', + 'visibility': 'visible', + 'display': 'element', + 'opacity': 1, + 'z-compound-depth': 'auto', + 'z-index-compare': 'auto', + 'z-index': 0, + 'label': '', + 'text-margin-x': 0, + 'text-margin-y': 0, + 'source-label': '', + 'source-text-offset': 0, + 'source-text-margin-x': 0, + 'source-text-margin-y': 0, + 'target-label': '', + 'target-text-offset': 0, + 'target-text-margin-x': 0, + 'target-text-margin-y': 0, + 'overlay-opacity': 0, + 'overlay-color': '#000', + 'overlay-padding': 10, + 'overlay-shape': 'round-rectangle', + 'underlay-opacity': 0, + 'underlay-color': '#000', + 'underlay-padding': 10, + 'underlay-shape': 'round-rectangle', + 'transition-property': 'none', + 'transition-duration': 0, + 'transition-delay': 0, + 'transition-timing-function': 'linear', + // node props + 'background-blacken': 0, + 'background-color': '#999', + 'background-fill': 'solid', + 'background-opacity': 1, + 'background-image': 'none', + 'background-image-crossorigin': 'anonymous', + 'background-image-opacity': 1, + 'background-image-containment': 'inside', + 'background-image-smoothing': 'yes', + 'background-position-x': '50%', + 'background-position-y': '50%', + 'background-offset-x': 0, + 'background-offset-y': 0, + 'background-width-relative-to': 'include-padding', + 'background-height-relative-to': 'include-padding', + 'background-repeat': 'no-repeat', + 'background-fit': 'none', + 'background-clip': 'node', + 'background-width': 'auto', + 'background-height': 'auto', + 'border-color': '#000', + 'border-opacity': 1, + 'border-width': 0, + 'border-style': 'solid', + 'height': 30, + 'width': 30, + 'shape': 'ellipse', + 'shape-polygon-points': '-1, -1, 1, -1, 1, 1, -1, 1', + 'bounds-expansion': 0, + // node gradient + 'background-gradient-direction': 'to-bottom', + 'background-gradient-stop-colors': '#999', + 'background-gradient-stop-positions': '0%', + // ghost props + 'ghost': 'no', + 'ghost-offset-y': 0, + 'ghost-offset-x': 0, + 'ghost-opacity': 0, + // compound props + 'padding': 0, + 'padding-relative-to': 'width', + 'position': 'origin', + 'compound-sizing-wrt-labels': 'include', + 'min-width': 0, + 'min-width-bias-left': 0, + 'min-width-bias-right': 0, + 'min-height': 0, + 'min-height-bias-top': 0, + 'min-height-bias-bottom': 0 + }, { + // node pie bg + 'pie-size': '100%' + }, [{ + name: 'pie-{{i}}-background-color', + value: 'black' + }, { + name: 'pie-{{i}}-background-size', + value: '0%' + }, { + name: 'pie-{{i}}-background-opacity', + value: 1 + }].reduce(function (css, prop) { + for (var i = 1; i <= styfn$2.pieBackgroundN; i++) { + var name = prop.name.replace('{{i}}', i); + var val = prop.value; + css[name] = val; + } + + return css; + }, {}), { + // edge props + 'line-style': 'solid', + 'line-color': '#999', + 'line-fill': 'solid', + 'line-cap': 'butt', + 'line-opacity': 1, + 'line-gradient-stop-colors': '#999', + 'line-gradient-stop-positions': '0%', + 'control-point-step-size': 40, + 'control-point-weights': 0.5, + 'segment-weights': 0.5, + 'segment-distances': 20, + 'taxi-turn': '50%', + 'taxi-turn-min-distance': 10, + 'taxi-direction': 'auto', + 'edge-distances': 'intersection', + 'curve-style': 'haystack', + 'haystack-radius': 0, + 'arrow-scale': 1, + 'loop-direction': '-45deg', + 'loop-sweep': '-90deg', + 'source-distance-from-node': 0, + 'target-distance-from-node': 0, + 'source-endpoint': 'outside-to-node', + 'target-endpoint': 'outside-to-node', + 'line-dash-pattern': [6, 3], + 'line-dash-offset': 0 + }, [{ + name: 'arrow-shape', + value: 'none' + }, { + name: 'arrow-color', + value: '#999' + }, { + name: 'arrow-fill', + value: 'filled' + }].reduce(function (css, prop) { + styfn$2.arrowPrefixes.forEach(function (prefix) { + var name = prefix + '-' + prop.name; + var val = prop.value; + css[name] = val; + }); + return css; + }, {})); + var parsedProps = {}; + + for (var i = 0; i < this.properties.length; i++) { + var prop = this.properties[i]; + + if (prop.pointsTo) { + continue; + } + + var name = prop.name; + var val = rawProps[name]; + var parsedProp = this.parse(name, val); + parsedProps[name] = parsedProp; + } + + _p.defaultProperties = parsedProps; + return _p.defaultProperties; + }; + + styfn$2.addDefaultStylesheet = function () { + this.selector(':parent').css({ + 'shape': 'rectangle', + 'padding': 10, + 'background-color': '#eee', + 'border-color': '#ccc', + 'border-width': 1 + }).selector('edge').css({ + 'width': 3 + }).selector(':loop').css({ + 'curve-style': 'bezier' + }).selector('edge:compound').css({ + 'curve-style': 'bezier', + 'source-endpoint': 'outside-to-line', + 'target-endpoint': 'outside-to-line' + }).selector(':selected').css({ + 'background-color': '#0169D9', + 'line-color': '#0169D9', + 'source-arrow-color': '#0169D9', + 'target-arrow-color': '#0169D9', + 'mid-source-arrow-color': '#0169D9', + 'mid-target-arrow-color': '#0169D9' + }).selector(':parent:selected').css({ + 'background-color': '#CCE1F9', + 'border-color': '#aec8e5' + }).selector(':active').css({ + 'overlay-color': 'black', + 'overlay-padding': 10, + 'overlay-opacity': 0.25 + }); + this.defaultLength = this.length; + }; + + var styfn$1 = {}; // a caching layer for property parsing + + styfn$1.parse = function (name, value, propIsBypass, propIsFlat) { + var self = this; // function values can't be cached in all cases, and there isn't much benefit of caching them anyway + + if (fn$6(value)) { + return self.parseImplWarn(name, value, propIsBypass, propIsFlat); + } + + var flatKey = propIsFlat === 'mapping' || propIsFlat === true || propIsFlat === false || propIsFlat == null ? 'dontcare' : propIsFlat; + var bypassKey = propIsBypass ? 't' : 'f'; + var valueKey = '' + value; + var argHash = hashStrings(name, valueKey, bypassKey, flatKey); + var propCache = self.propCache = self.propCache || []; + var ret; + + if (!(ret = propCache[argHash])) { + ret = propCache[argHash] = self.parseImplWarn(name, value, propIsBypass, propIsFlat); + } // - bypasses can't be shared b/c the value can be changed by animations or otherwise overridden + // - mappings can't be shared b/c mappings are per-element + + + if (propIsBypass || propIsFlat === 'mapping') { + // need a copy since props are mutated later in their lifecycles + ret = copy(ret); + + if (ret) { + ret.value = copy(ret.value); // because it could be an array, e.g. colour + } + } + + return ret; + }; + + styfn$1.parseImplWarn = function (name, value, propIsBypass, propIsFlat) { + var prop = this.parseImpl(name, value, propIsBypass, propIsFlat); + + if (!prop && value != null) { + warn("The style property `".concat(name, ": ").concat(value, "` is invalid")); + } + + if (prop && (prop.name === 'width' || prop.name === 'height') && value === 'label') { + warn('The style value of `label` is deprecated for `' + prop.name + '`'); + } + + return prop; + }; // parse a property; return null on invalid; return parsed property otherwise + // fields : + // - name : the name of the property + // - value : the parsed, native-typed value of the property + // - strValue : a string value that represents the property value in valid css + // - bypass : true iff the property is a bypass property + + + styfn$1.parseImpl = function (name, value, propIsBypass, propIsFlat) { + var self = this; + name = camel2dash(name); // make sure the property name is in dash form (e.g. 'property-name' not 'propertyName') + + var property = self.properties[name]; + var passedValue = value; + var types = self.types; + + if (!property) { + return null; + } // return null on property of unknown name + + + if (value === undefined) { + return null; + } // can't assign undefined + // the property may be an alias + + + if (property.alias) { + property = property.pointsTo; + name = property.name; + } + + var valueIsString = string(value); + + if (valueIsString) { + // trim the value to make parsing easier + value = value.trim(); + } + + var type = property.type; + + if (!type) { + return null; + } // no type, no luck + // check if bypass is null or empty string (i.e. indication to delete bypass property) + + + if (propIsBypass && (value === '' || value === null)) { + return { + name: name, + value: value, + bypass: true, + deleteBypass: true + }; + } // check if value is a function used as a mapper + + + if (fn$6(value)) { + return { + name: name, + value: value, + strValue: 'fn', + mapped: types.fn, + bypass: propIsBypass + }; + } // check if value is mapped + + + var data, mapData; + + if (!valueIsString || propIsFlat || value.length < 7 || value[1] !== 'a') ; else if (value.length >= 7 && value[0] === 'd' && (data = new RegExp(types.data.regex).exec(value))) { + if (propIsBypass) { + return false; + } // mappers not allowed in bypass + + + var mapped = types.data; + return { + name: name, + value: data, + strValue: '' + value, + mapped: mapped, + field: data[1], + bypass: propIsBypass + }; + } else if (value.length >= 10 && value[0] === 'm' && (mapData = new RegExp(types.mapData.regex).exec(value))) { + if (propIsBypass) { + return false; + } // mappers not allowed in bypass + + + if (type.multiple) { + return false; + } // impossible to map to num + + + var _mapped = types.mapData; // we can map only if the type is a colour or a number + + if (!(type.color || type.number)) { + return false; + } + + var valueMin = this.parse(name, mapData[4]); // parse to validate + + if (!valueMin || valueMin.mapped) { + return false; + } // can't be invalid or mapped + + + var valueMax = this.parse(name, mapData[5]); // parse to validate + + if (!valueMax || valueMax.mapped) { + return false; + } // can't be invalid or mapped + // check if valueMin and valueMax are the same + + + if (valueMin.pfValue === valueMax.pfValue || valueMin.strValue === valueMax.strValue) { + warn('`' + name + ': ' + value + '` is not a valid mapper because the output range is zero; converting to `' + name + ': ' + valueMin.strValue + '`'); + return this.parse(name, valueMin.strValue); // can't make much of a mapper without a range + } else if (type.color) { + var c1 = valueMin.value; + var c2 = valueMax.value; + var same = c1[0] === c2[0] // red + && c1[1] === c2[1] // green + && c1[2] === c2[2] // blue + && ( // optional alpha + c1[3] === c2[3] // same alpha outright + || (c1[3] == null || c1[3] === 1 // full opacity for colour 1? + ) && (c2[3] == null || c2[3] === 1) // full opacity for colour 2? + ); + + if (same) { + return false; + } // can't make a mapper without a range + + } + + return { + name: name, + value: mapData, + strValue: '' + value, + mapped: _mapped, + field: mapData[1], + fieldMin: parseFloat(mapData[2]), + // min & max are numeric + fieldMax: parseFloat(mapData[3]), + valueMin: valueMin.value, + valueMax: valueMax.value, + bypass: propIsBypass + }; + } + + if (type.multiple && propIsFlat !== 'multiple') { + var vals; + + if (valueIsString) { + vals = value.split(/\s+/); + } else if (array(value)) { + vals = value; + } else { + vals = [value]; + } + + if (type.evenMultiple && vals.length % 2 !== 0) { + return null; + } + + var valArr = []; + var unitsArr = []; + var pfValArr = []; + var strVal = ''; + var hasEnum = false; + + for (var i = 0; i < vals.length; i++) { + var p = self.parse(name, vals[i], propIsBypass, 'multiple'); + hasEnum = hasEnum || string(p.value); + valArr.push(p.value); + pfValArr.push(p.pfValue != null ? p.pfValue : p.value); + unitsArr.push(p.units); + strVal += (i > 0 ? ' ' : '') + p.strValue; + } + + if (type.validate && !type.validate(valArr, unitsArr)) { + return null; + } + + if (type.singleEnum && hasEnum) { + if (valArr.length === 1 && string(valArr[0])) { + return { + name: name, + value: valArr[0], + strValue: valArr[0], + bypass: propIsBypass + }; + } else { + return null; + } + } + + return { + name: name, + value: valArr, + pfValue: pfValArr, + strValue: strVal, + bypass: propIsBypass, + units: unitsArr + }; + } // several types also allow enums + + + var checkEnums = function checkEnums() { + for (var _i = 0; _i < type.enums.length; _i++) { + var en = type.enums[_i]; + + if (en === value) { + return { + name: name, + value: value, + strValue: '' + value, + bypass: propIsBypass + }; + } + } + + return null; + }; // check the type and return the appropriate object + + + if (type.number) { + var units; + var implicitUnits = 'px'; // not set => px + + if (type.units) { + // use specified units if set + units = type.units; + } + + if (type.implicitUnits) { + implicitUnits = type.implicitUnits; + } + + if (!type.unitless) { + if (valueIsString) { + var unitsRegex = 'px|em' + (type.allowPercent ? '|\\%' : ''); + + if (units) { + unitsRegex = units; + } // only allow explicit units if so set + + + var match = value.match('^(' + number + ')(' + unitsRegex + ')?' + '$'); + + if (match) { + value = match[1]; + units = match[2] || implicitUnits; + } + } else if (!units || type.implicitUnits) { + units = implicitUnits; // implicitly px if unspecified + } + } + + value = parseFloat(value); // if not a number and enums not allowed, then the value is invalid + + if (isNaN(value) && type.enums === undefined) { + return null; + } // check if this number type also accepts special keywords in place of numbers + // (i.e. `left`, `auto`, etc) + + + if (isNaN(value) && type.enums !== undefined) { + value = passedValue; + return checkEnums(); + } // check if value must be an integer + + + if (type.integer && !integer(value)) { + return null; + } // check value is within range + + + if (type.min !== undefined && (value < type.min || type.strictMin && value === type.min) || type.max !== undefined && (value > type.max || type.strictMax && value === type.max)) { + return null; + } + + var ret = { + name: name, + value: value, + strValue: '' + value + (units ? units : ''), + units: units, + bypass: propIsBypass + }; // normalise value in pixels + + if (type.unitless || units !== 'px' && units !== 'em') { + ret.pfValue = value; + } else { + ret.pfValue = units === 'px' || !units ? value : this.getEmSizeInPixels() * value; + } // normalise value in ms + + + if (units === 'ms' || units === 's') { + ret.pfValue = units === 'ms' ? value : 1000 * value; + } // normalise value in rad + + + if (units === 'deg' || units === 'rad') { + ret.pfValue = units === 'rad' ? value : deg2rad(value); + } // normalize value in % + + + if (units === '%') { + ret.pfValue = value / 100; + } + + return ret; + } else if (type.propList) { + var props = []; + var propsStr = '' + value; + + if (propsStr === 'none') ; else { + // go over each prop + var propsSplit = propsStr.split(/\s*,\s*|\s+/); + + for (var _i2 = 0; _i2 < propsSplit.length; _i2++) { + var propName = propsSplit[_i2].trim(); + + if (self.properties[propName]) { + props.push(propName); + } else { + warn('`' + propName + '` is not a valid property name'); + } + } + + if (props.length === 0) { + return null; + } + } + + return { + name: name, + value: props, + strValue: props.length === 0 ? 'none' : props.join(' '), + bypass: propIsBypass + }; + } else if (type.color) { + var tuple = color2tuple(value); + + if (!tuple) { + return null; + } + + return { + name: name, + value: tuple, + pfValue: tuple, + strValue: 'rgb(' + tuple[0] + ',' + tuple[1] + ',' + tuple[2] + ')', + // n.b. no spaces b/c of multiple support + bypass: propIsBypass + }; + } else if (type.regex || type.regexes) { + // first check enums + if (type.enums) { + var enumProp = checkEnums(); + + if (enumProp) { + return enumProp; + } + } + + var regexes = type.regexes ? type.regexes : [type.regex]; + + for (var _i3 = 0; _i3 < regexes.length; _i3++) { + var regex = new RegExp(regexes[_i3]); // make a regex from the type string + + var m = regex.exec(value); + + if (m) { + // regex matches + return { + name: name, + value: type.singleRegexMatchValue ? m[1] : m, + strValue: '' + value, + bypass: propIsBypass + }; + } + } + + return null; // didn't match any + } else if (type.string) { + // just return + return { + name: name, + value: '' + value, + strValue: '' + value, + bypass: propIsBypass + }; + } else if (type.enums) { + // check enums last because it's a combo type in others + return checkEnums(); + } else { + return null; // not a type we can handle + } + }; + + var Style = function Style(cy) { + if (!(this instanceof Style)) { + return new Style(cy); + } + + if (!core(cy)) { + error('A style must have a core reference'); + return; + } + + this._private = { + cy: cy, + coreStyle: {} + }; + this.length = 0; + this.resetToDefault(); + }; + + var styfn = Style.prototype; + + styfn.instanceString = function () { + return 'style'; + }; // remove all contexts + + + styfn.clear = function () { + var _p = this._private; + var cy = _p.cy; + var eles = cy.elements(); + + for (var i = 0; i < this.length; i++) { + this[i] = undefined; + } + + this.length = 0; + _p.contextStyles = {}; + _p.propDiffs = {}; + this.cleanElements(eles, true); + eles.forEach(function (ele) { + var ele_p = ele[0]._private; + ele_p.styleDirty = true; + ele_p.appliedInitStyle = false; + }); + return this; // chaining + }; + + styfn.resetToDefault = function () { + this.clear(); + this.addDefaultStylesheet(); + return this; + }; // builds a style object for the 'core' selector + + + styfn.core = function (propName) { + return this._private.coreStyle[propName] || this.getDefaultProperty(propName); + }; // create a new context from the specified selector string and switch to that context + + + styfn.selector = function (selectorStr) { + // 'core' is a special case and does not need a selector + var selector = selectorStr === 'core' ? null : new Selector(selectorStr); + var i = this.length++; // new context means new index + + this[i] = { + selector: selector, + properties: [], + mappedProperties: [], + index: i + }; + return this; // chaining + }; // add one or many css rules to the current context + + + styfn.css = function () { + var self = this; + var args = arguments; + + if (args.length === 1) { + var map = args[0]; + + for (var i = 0; i < self.properties.length; i++) { + var prop = self.properties[i]; + var mapVal = map[prop.name]; + + if (mapVal === undefined) { + mapVal = map[dash2camel(prop.name)]; + } + + if (mapVal !== undefined) { + this.cssRule(prop.name, mapVal); + } + } + } else if (args.length === 2) { + this.cssRule(args[0], args[1]); + } // do nothing if args are invalid + + + return this; // chaining + }; + + styfn.style = styfn.css; // add a single css rule to the current context + + styfn.cssRule = function (name, value) { + // name-value pair + var property = this.parse(name, value); // add property to current context if valid + + if (property) { + var i = this.length - 1; + this[i].properties.push(property); + this[i].properties[property.name] = property; // allow access by name as well + + if (property.name.match(/pie-(\d+)-background-size/) && property.value) { + this._private.hasPie = true; + } + + if (property.mapped) { + this[i].mappedProperties.push(property); + } // add to core style if necessary + + + var currentSelectorIsCore = !this[i].selector; + + if (currentSelectorIsCore) { + this._private.coreStyle[property.name] = property; + } + } + + return this; // chaining + }; + + styfn.append = function (style) { + if (stylesheet(style)) { + style.appendToStyle(this); + } else if (array(style)) { + this.appendFromJson(style); + } else if (string(style)) { + this.appendFromString(style); + } // you probably wouldn't want to append a Style, since you'd duplicate the default parts + + + return this; + }; // static function + + + Style.fromJson = function (cy, json) { + var style = new Style(cy); + style.fromJson(json); + return style; + }; + + Style.fromString = function (cy, string) { + return new Style(cy).fromString(string); + }; + + [styfn$8, styfn$7, styfn$6, styfn$5, styfn$4, styfn$3, styfn$2, styfn$1].forEach(function (props) { + extend(styfn, props); + }); + Style.types = styfn.types; + Style.properties = styfn.properties; + Style.propertyGroups = styfn.propertyGroups; + Style.propertyGroupNames = styfn.propertyGroupNames; + Style.propertyGroupKeys = styfn.propertyGroupKeys; + + var corefn$2 = { + style: function style(newStyle) { + if (newStyle) { + var s = this.setStyle(newStyle); + s.update(); + } + + return this._private.style; + }, + setStyle: function setStyle(style) { + var _p = this._private; + + if (stylesheet(style)) { + _p.style = style.generateStyle(this); + } else if (array(style)) { + _p.style = Style.fromJson(this, style); + } else if (string(style)) { + _p.style = Style.fromString(this, style); + } else { + _p.style = Style(this); + } + + return _p.style; + }, + // e.g. cy.data() changed => recalc ele mappers + updateStyle: function updateStyle() { + this.mutableElements().updateStyle(); // just send to all eles + } + }; + + var defaultSelectionType = 'single'; + var corefn$1 = { + autolock: function autolock(bool) { + if (bool !== undefined) { + this._private.autolock = bool ? true : false; + } else { + return this._private.autolock; + } + + return this; // chaining + }, + autoungrabify: function autoungrabify(bool) { + if (bool !== undefined) { + this._private.autoungrabify = bool ? true : false; + } else { + return this._private.autoungrabify; + } + + return this; // chaining + }, + autounselectify: function autounselectify(bool) { + if (bool !== undefined) { + this._private.autounselectify = bool ? true : false; + } else { + return this._private.autounselectify; + } + + return this; // chaining + }, + selectionType: function selectionType(selType) { + var _p = this._private; + + if (_p.selectionType == null) { + _p.selectionType = defaultSelectionType; + } + + if (selType !== undefined) { + if (selType === 'additive' || selType === 'single') { + _p.selectionType = selType; + } + } else { + return _p.selectionType; + } + + return this; + }, + panningEnabled: function panningEnabled(bool) { + if (bool !== undefined) { + this._private.panningEnabled = bool ? true : false; + } else { + return this._private.panningEnabled; + } + + return this; // chaining + }, + userPanningEnabled: function userPanningEnabled(bool) { + if (bool !== undefined) { + this._private.userPanningEnabled = bool ? true : false; + } else { + return this._private.userPanningEnabled; + } + + return this; // chaining + }, + zoomingEnabled: function zoomingEnabled(bool) { + if (bool !== undefined) { + this._private.zoomingEnabled = bool ? true : false; + } else { + return this._private.zoomingEnabled; + } + + return this; // chaining + }, + userZoomingEnabled: function userZoomingEnabled(bool) { + if (bool !== undefined) { + this._private.userZoomingEnabled = bool ? true : false; + } else { + return this._private.userZoomingEnabled; + } + + return this; // chaining + }, + boxSelectionEnabled: function boxSelectionEnabled(bool) { + if (bool !== undefined) { + this._private.boxSelectionEnabled = bool ? true : false; + } else { + return this._private.boxSelectionEnabled; + } + + return this; // chaining + }, + pan: function pan() { + var args = arguments; + var pan = this._private.pan; + var dim, val, dims, x, y; + + switch (args.length) { + case 0: + // .pan() + return pan; + + case 1: + if (string(args[0])) { + // .pan('x') + dim = args[0]; + return pan[dim]; + } else if (plainObject(args[0])) { + // .pan({ x: 0, y: 100 }) + if (!this._private.panningEnabled) { + return this; + } + + dims = args[0]; + x = dims.x; + y = dims.y; + + if (number$1(x)) { + pan.x = x; + } + + if (number$1(y)) { + pan.y = y; + } + + this.emit('pan viewport'); + } + + break; + + case 2: + // .pan('x', 100) + if (!this._private.panningEnabled) { + return this; + } + + dim = args[0]; + val = args[1]; + + if ((dim === 'x' || dim === 'y') && number$1(val)) { + pan[dim] = val; + } + + this.emit('pan viewport'); + break; + // invalid + } + + this.notify('viewport'); + return this; // chaining + }, + panBy: function panBy(arg0, arg1) { + var args = arguments; + var pan = this._private.pan; + var dim, val, dims, x, y; + + if (!this._private.panningEnabled) { + return this; + } + + switch (args.length) { + case 1: + if (plainObject(arg0)) { + // .panBy({ x: 0, y: 100 }) + dims = args[0]; + x = dims.x; + y = dims.y; + + if (number$1(x)) { + pan.x += x; + } + + if (number$1(y)) { + pan.y += y; + } + + this.emit('pan viewport'); + } + + break; + + case 2: + // .panBy('x', 100) + dim = arg0; + val = arg1; + + if ((dim === 'x' || dim === 'y') && number$1(val)) { + pan[dim] += val; + } + + this.emit('pan viewport'); + break; + // invalid + } + + this.notify('viewport'); + return this; // chaining + }, + fit: function fit(elements, padding) { + var viewportState = this.getFitViewport(elements, padding); + + if (viewportState) { + var _p = this._private; + _p.zoom = viewportState.zoom; + _p.pan = viewportState.pan; + this.emit('pan zoom viewport'); + this.notify('viewport'); + } + + return this; // chaining + }, + getFitViewport: function getFitViewport(elements, padding) { + if (number$1(elements) && padding === undefined) { + // elements is optional + padding = elements; + elements = undefined; + } + + if (!this._private.panningEnabled || !this._private.zoomingEnabled) { + return; + } + + var bb; + + if (string(elements)) { + var sel = elements; + elements = this.$(sel); + } else if (boundingBox(elements)) { + // assume bb + var bbe = elements; + bb = { + x1: bbe.x1, + y1: bbe.y1, + x2: bbe.x2, + y2: bbe.y2 + }; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + } else if (!elementOrCollection(elements)) { + elements = this.mutableElements(); + } + + if (elementOrCollection(elements) && elements.empty()) { + return; + } // can't fit to nothing + + + bb = bb || elements.boundingBox(); + var w = this.width(); + var h = this.height(); + var zoom; + padding = number$1(padding) ? padding : 0; + + if (!isNaN(w) && !isNaN(h) && w > 0 && h > 0 && !isNaN(bb.w) && !isNaN(bb.h) && bb.w > 0 && bb.h > 0) { + zoom = Math.min((w - 2 * padding) / bb.w, (h - 2 * padding) / bb.h); // crop zoom + + zoom = zoom > this._private.maxZoom ? this._private.maxZoom : zoom; + zoom = zoom < this._private.minZoom ? this._private.minZoom : zoom; + var pan = { + // now pan to middle + x: (w - zoom * (bb.x1 + bb.x2)) / 2, + y: (h - zoom * (bb.y1 + bb.y2)) / 2 + }; + return { + zoom: zoom, + pan: pan + }; + } + + return; + }, + zoomRange: function zoomRange(min, max) { + var _p = this._private; + + if (max == null) { + var opts = min; + min = opts.min; + max = opts.max; + } + + if (number$1(min) && number$1(max) && min <= max) { + _p.minZoom = min; + _p.maxZoom = max; + } else if (number$1(min) && max === undefined && min <= _p.maxZoom) { + _p.minZoom = min; + } else if (number$1(max) && min === undefined && max >= _p.minZoom) { + _p.maxZoom = max; + } + + return this; + }, + minZoom: function minZoom(zoom) { + if (zoom === undefined) { + return this._private.minZoom; + } else { + return this.zoomRange({ + min: zoom + }); + } + }, + maxZoom: function maxZoom(zoom) { + if (zoom === undefined) { + return this._private.maxZoom; + } else { + return this.zoomRange({ + max: zoom + }); + } + }, + getZoomedViewport: function getZoomedViewport(params) { + var _p = this._private; + var currentPan = _p.pan; + var currentZoom = _p.zoom; + var pos; // in rendered px + + var zoom; + var bail = false; + + if (!_p.zoomingEnabled) { + // zooming disabled + bail = true; + } + + if (number$1(params)) { + // then set the zoom + zoom = params; + } else if (plainObject(params)) { + // then zoom about a point + zoom = params.level; + + if (params.position != null) { + pos = modelToRenderedPosition(params.position, currentZoom, currentPan); + } else if (params.renderedPosition != null) { + pos = params.renderedPosition; + } + + if (pos != null && !_p.panningEnabled) { + // panning disabled + bail = true; + } + } // crop zoom + + + zoom = zoom > _p.maxZoom ? _p.maxZoom : zoom; + zoom = zoom < _p.minZoom ? _p.minZoom : zoom; // can't zoom with invalid params + + if (bail || !number$1(zoom) || zoom === currentZoom || pos != null && (!number$1(pos.x) || !number$1(pos.y))) { + return null; + } + + if (pos != null) { + // set zoom about position + var pan1 = currentPan; + var zoom1 = currentZoom; + var zoom2 = zoom; + var pan2 = { + x: -zoom2 / zoom1 * (pos.x - pan1.x) + pos.x, + y: -zoom2 / zoom1 * (pos.y - pan1.y) + pos.y + }; + return { + zoomed: true, + panned: true, + zoom: zoom2, + pan: pan2 + }; + } else { + // just set the zoom + return { + zoomed: true, + panned: false, + zoom: zoom, + pan: currentPan + }; + } + }, + zoom: function zoom(params) { + if (params === undefined) { + // get + return this._private.zoom; + } else { + // set + var vp = this.getZoomedViewport(params); + var _p = this._private; + + if (vp == null || !vp.zoomed) { + return this; + } + + _p.zoom = vp.zoom; + + if (vp.panned) { + _p.pan.x = vp.pan.x; + _p.pan.y = vp.pan.y; + } + + this.emit('zoom' + (vp.panned ? ' pan' : '') + ' viewport'); + this.notify('viewport'); + return this; // chaining + } + }, + viewport: function viewport(opts) { + var _p = this._private; + var zoomDefd = true; + var panDefd = true; + var events = []; // to trigger + + var zoomFailed = false; + var panFailed = false; + + if (!opts) { + return this; + } + + if (!number$1(opts.zoom)) { + zoomDefd = false; + } + + if (!plainObject(opts.pan)) { + panDefd = false; + } + + if (!zoomDefd && !panDefd) { + return this; + } + + if (zoomDefd) { + var z = opts.zoom; + + if (z < _p.minZoom || z > _p.maxZoom || !_p.zoomingEnabled) { + zoomFailed = true; + } else { + _p.zoom = z; + events.push('zoom'); + } + } + + if (panDefd && (!zoomFailed || !opts.cancelOnFailedZoom) && _p.panningEnabled) { + var p = opts.pan; + + if (number$1(p.x)) { + _p.pan.x = p.x; + panFailed = false; + } + + if (number$1(p.y)) { + _p.pan.y = p.y; + panFailed = false; + } + + if (!panFailed) { + events.push('pan'); + } + } + + if (events.length > 0) { + events.push('viewport'); + this.emit(events.join(' ')); + this.notify('viewport'); + } + + return this; // chaining + }, + center: function center(elements) { + var pan = this.getCenterPan(elements); + + if (pan) { + this._private.pan = pan; + this.emit('pan viewport'); + this.notify('viewport'); + } + + return this; // chaining + }, + getCenterPan: function getCenterPan(elements, zoom) { + if (!this._private.panningEnabled) { + return; + } + + if (string(elements)) { + var selector = elements; + elements = this.mutableElements().filter(selector); + } else if (!elementOrCollection(elements)) { + elements = this.mutableElements(); + } + + if (elements.length === 0) { + return; + } // can't centre pan to nothing + + + var bb = elements.boundingBox(); + var w = this.width(); + var h = this.height(); + zoom = zoom === undefined ? this._private.zoom : zoom; + var pan = { + // middle + x: (w - zoom * (bb.x1 + bb.x2)) / 2, + y: (h - zoom * (bb.y1 + bb.y2)) / 2 + }; + return pan; + }, + reset: function reset() { + if (!this._private.panningEnabled || !this._private.zoomingEnabled) { + return this; + } + + this.viewport({ + pan: { + x: 0, + y: 0 + }, + zoom: 1 + }); + return this; // chaining + }, + invalidateSize: function invalidateSize() { + this._private.sizeCache = null; + }, + size: function size() { + var _p = this._private; + var container = _p.container; + return _p.sizeCache = _p.sizeCache || (container ? function () { + var style = window$1.getComputedStyle(container); + + var val = function val(name) { + return parseFloat(style.getPropertyValue(name)); + }; + + return { + width: container.clientWidth - val('padding-left') - val('padding-right'), + height: container.clientHeight - val('padding-top') - val('padding-bottom') + }; + }() : { + // fallback if no container (not 0 b/c can be used for dividing etc) + width: 1, + height: 1 + }); + }, + width: function width() { + return this.size().width; + }, + height: function height() { + return this.size().height; + }, + extent: function extent() { + var pan = this._private.pan; + var zoom = this._private.zoom; + var rb = this.renderedExtent(); + var b = { + x1: (rb.x1 - pan.x) / zoom, + x2: (rb.x2 - pan.x) / zoom, + y1: (rb.y1 - pan.y) / zoom, + y2: (rb.y2 - pan.y) / zoom + }; + b.w = b.x2 - b.x1; + b.h = b.y2 - b.y1; + return b; + }, + renderedExtent: function renderedExtent() { + var width = this.width(); + var height = this.height(); + return { + x1: 0, + y1: 0, + x2: width, + y2: height, + w: width, + h: height + }; + }, + multiClickDebounceTime: function multiClickDebounceTime(_int) { + if (_int) this._private.multiClickDebounceTime = _int;else return this._private.multiClickDebounceTime; + return this; // chaining + } + }; // aliases + + corefn$1.centre = corefn$1.center; // backwards compatibility + + corefn$1.autolockNodes = corefn$1.autolock; + corefn$1.autoungrabifyNodes = corefn$1.autoungrabify; + + var fn = { + data: define.data({ + field: 'data', + bindingEvent: 'data', + allowBinding: true, + allowSetting: true, + settingEvent: 'data', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + updateStyle: true + }), + removeData: define.removeData({ + field: 'data', + event: 'data', + triggerFnName: 'trigger', + triggerEvent: true, + updateStyle: true + }), + scratch: define.data({ + field: 'scratch', + bindingEvent: 'scratch', + allowBinding: true, + allowSetting: true, + settingEvent: 'scratch', + settingTriggersEvent: true, + triggerFnName: 'trigger', + allowGetting: true, + updateStyle: true + }), + removeScratch: define.removeData({ + field: 'scratch', + event: 'scratch', + triggerFnName: 'trigger', + triggerEvent: true, + updateStyle: true + }) + }; // aliases + + fn.attr = fn.data; + fn.removeAttr = fn.removeData; + + var Core = function Core(opts) { + var cy = this; + opts = extend({}, opts); + var container = opts.container; // allow for passing a wrapped jquery object + // e.g. cytoscape({ container: $('#cy') }) + + if (container && !htmlElement(container) && htmlElement(container[0])) { + container = container[0]; + } + + var reg = container ? container._cyreg : null; // e.g. already registered some info (e.g. readies) via jquery + + reg = reg || {}; + + if (reg && reg.cy) { + reg.cy.destroy(); + reg = {}; // old instance => replace reg completely + } + + var readies = reg.readies = reg.readies || []; + + if (container) { + container._cyreg = reg; + } // make sure container assoc'd reg points to this cy + + + reg.cy = cy; + var head = window$1 !== undefined && container !== undefined && !opts.headless; + var options = opts; + options.layout = extend({ + name: head ? 'grid' : 'null' + }, options.layout); + options.renderer = extend({ + name: head ? 'canvas' : 'null' + }, options.renderer); + + var defVal = function defVal(def, val, altVal) { + if (val !== undefined) { + return val; + } else if (altVal !== undefined) { + return altVal; + } else { + return def; + } + }; + + var _p = this._private = { + container: container, + // html dom ele container + ready: false, + // whether ready has been triggered + options: options, + // cached options + elements: new Collection(this), + // elements in the graph + listeners: [], + // list of listeners + aniEles: new Collection(this), + // elements being animated + data: options.data || {}, + // data for the core + scratch: {}, + // scratch object for core + layout: null, + renderer: null, + destroyed: false, + // whether destroy was called + notificationsEnabled: true, + // whether notifications are sent to the renderer + minZoom: 1e-50, + maxZoom: 1e50, + zoomingEnabled: defVal(true, options.zoomingEnabled), + userZoomingEnabled: defVal(true, options.userZoomingEnabled), + panningEnabled: defVal(true, options.panningEnabled), + userPanningEnabled: defVal(true, options.userPanningEnabled), + boxSelectionEnabled: defVal(true, options.boxSelectionEnabled), + autolock: defVal(false, options.autolock, options.autolockNodes), + autoungrabify: defVal(false, options.autoungrabify, options.autoungrabifyNodes), + autounselectify: defVal(false, options.autounselectify), + styleEnabled: options.styleEnabled === undefined ? head : options.styleEnabled, + zoom: number$1(options.zoom) ? options.zoom : 1, + pan: { + x: plainObject(options.pan) && number$1(options.pan.x) ? options.pan.x : 0, + y: plainObject(options.pan) && number$1(options.pan.y) ? options.pan.y : 0 + }, + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + hasCompoundNodes: false, + multiClickDebounceTime: defVal(250, options.multiClickDebounceTime) + }; + + this.createEmitter(); // set selection type + + this.selectionType(options.selectionType); // init zoom bounds + + this.zoomRange({ + min: options.minZoom, + max: options.maxZoom + }); + + var loadExtData = function loadExtData(extData, next) { + var anyIsPromise = extData.some(promise); + + if (anyIsPromise) { + return Promise$1.all(extData).then(next); // load all data asynchronously, then exec rest of init + } else { + next(extData); // exec synchronously for convenience + } + }; // start with the default stylesheet so we have something before loading an external stylesheet + + + if (_p.styleEnabled) { + cy.setStyle([]); + } // create the renderer + + + var rendererOptions = extend({}, options, options.renderer); // allow rendering hints in top level options + + cy.initRenderer(rendererOptions); + + var setElesAndLayout = function setElesAndLayout(elements, onload, ondone) { + cy.notifications(false); // remove old elements + + var oldEles = cy.mutableElements(); + + if (oldEles.length > 0) { + oldEles.remove(); + } + + if (elements != null) { + if (plainObject(elements) || array(elements)) { + cy.add(elements); + } + } + + cy.one('layoutready', function (e) { + cy.notifications(true); + cy.emit(e); // we missed this event by turning notifications off, so pass it on + + cy.one('load', onload); + cy.emitAndNotify('load'); + }).one('layoutstop', function () { + cy.one('done', ondone); + cy.emit('done'); + }); + var layoutOpts = extend({}, cy._private.options.layout); + layoutOpts.eles = cy.elements(); + cy.layout(layoutOpts).run(); + }; + + loadExtData([options.style, options.elements], function (thens) { + var initStyle = thens[0]; + var initEles = thens[1]; // init style + + if (_p.styleEnabled) { + cy.style().append(initStyle); + } // initial load + + + setElesAndLayout(initEles, function () { + // onready + cy.startAnimationLoop(); + _p.ready = true; // if a ready callback is specified as an option, the bind it + + if (fn$6(options.ready)) { + cy.on('ready', options.ready); + } // bind all the ready handlers registered before creating this instance + + + for (var i = 0; i < readies.length; i++) { + var fn = readies[i]; + cy.on('ready', fn); + } + + if (reg) { + reg.readies = []; + } // clear b/c we've bound them all and don't want to keep it around in case a new core uses the same div etc + + + cy.emit('ready'); + }, options.done); + }); + }; + + var corefn = Core.prototype; // short alias + + extend(corefn, { + instanceString: function instanceString() { + return 'core'; + }, + isReady: function isReady() { + return this._private.ready; + }, + destroyed: function destroyed() { + return this._private.destroyed; + }, + ready: function ready(fn) { + if (this.isReady()) { + this.emitter().emit('ready', [], fn); // just calls fn as though triggered via ready event + } else { + this.on('ready', fn); + } + + return this; + }, + destroy: function destroy() { + var cy = this; + if (cy.destroyed()) return; + cy.stopAnimationLoop(); + cy.destroyRenderer(); + this.emit('destroy'); + cy._private.destroyed = true; + return cy; + }, + hasElementWithId: function hasElementWithId(id) { + return this._private.elements.hasElementWithId(id); + }, + getElementById: function getElementById(id) { + return this._private.elements.getElementById(id); + }, + hasCompoundNodes: function hasCompoundNodes() { + return this._private.hasCompoundNodes; + }, + headless: function headless() { + return this._private.renderer.isHeadless(); + }, + styleEnabled: function styleEnabled() { + return this._private.styleEnabled; + }, + addToPool: function addToPool(eles) { + this._private.elements.merge(eles); + + return this; // chaining + }, + removeFromPool: function removeFromPool(eles) { + this._private.elements.unmerge(eles); + + return this; + }, + container: function container() { + return this._private.container || null; + }, + mount: function mount(container) { + if (container == null) { + return; + } + + var cy = this; + var _p = cy._private; + var options = _p.options; + + if (!htmlElement(container) && htmlElement(container[0])) { + container = container[0]; + } + + cy.stopAnimationLoop(); + cy.destroyRenderer(); + _p.container = container; + _p.styleEnabled = true; + cy.invalidateSize(); + cy.initRenderer(extend({}, options, options.renderer, { + // allow custom renderer name to be re-used, otherwise use canvas + name: options.renderer.name === 'null' ? 'canvas' : options.renderer.name + })); + cy.startAnimationLoop(); + cy.style(options.style); + cy.emit('mount'); + return cy; + }, + unmount: function unmount() { + var cy = this; + cy.stopAnimationLoop(); + cy.destroyRenderer(); + cy.initRenderer({ + name: 'null' + }); + cy.emit('unmount'); + return cy; + }, + options: function options() { + return copy(this._private.options); + }, + json: function json(obj) { + var cy = this; + var _p = cy._private; + var eles = cy.mutableElements(); + + var getFreshRef = function getFreshRef(ele) { + return cy.getElementById(ele.id()); + }; + + if (plainObject(obj)) { + // set + cy.startBatch(); + + if (obj.elements) { + var idInJson = {}; + + var updateEles = function updateEles(jsons, gr) { + var toAdd = []; + var toMod = []; + + for (var i = 0; i < jsons.length; i++) { + var json = jsons[i]; + + if (!json.data.id) { + warn('cy.json() cannot handle elements without an ID attribute'); + continue; + } + + var id = '' + json.data.id; // id must be string + + var ele = cy.getElementById(id); + idInJson[id] = true; + + if (ele.length !== 0) { + // existing element should be updated + toMod.push({ + ele: ele, + json: json + }); + } else { + // otherwise should be added + if (gr) { + json.group = gr; + toAdd.push(json); + } else { + toAdd.push(json); + } + } + } + + cy.add(toAdd); + + for (var _i = 0; _i < toMod.length; _i++) { + var _toMod$_i = toMod[_i], + _ele = _toMod$_i.ele, + _json = _toMod$_i.json; + + _ele.json(_json); + } + }; + + if (array(obj.elements)) { + // elements: [] + updateEles(obj.elements); + } else { + // elements: { nodes: [], edges: [] } + var grs = ['nodes', 'edges']; + + for (var i = 0; i < grs.length; i++) { + var gr = grs[i]; + var elements = obj.elements[gr]; + + if (array(elements)) { + updateEles(elements, gr); + } + } + } + + var parentsToRemove = cy.collection(); + eles.filter(function (ele) { + return !idInJson[ele.id()]; + }).forEach(function (ele) { + if (ele.isParent()) { + parentsToRemove.merge(ele); + } else { + ele.remove(); + } + }); // so that children are not removed w/parent + + parentsToRemove.forEach(function (ele) { + return ele.children().move({ + parent: null + }); + }); // intermediate parents may be moved by prior line, so make sure we remove by fresh refs + + parentsToRemove.forEach(function (ele) { + return getFreshRef(ele).remove(); + }); + } + + if (obj.style) { + cy.style(obj.style); + } + + if (obj.zoom != null && obj.zoom !== _p.zoom) { + cy.zoom(obj.zoom); + } + + if (obj.pan) { + if (obj.pan.x !== _p.pan.x || obj.pan.y !== _p.pan.y) { + cy.pan(obj.pan); + } + } + + if (obj.data) { + cy.data(obj.data); + } + + var fields = ['minZoom', 'maxZoom', 'zoomingEnabled', 'userZoomingEnabled', 'panningEnabled', 'userPanningEnabled', 'boxSelectionEnabled', 'autolock', 'autoungrabify', 'autounselectify', 'multiClickDebounceTime']; + + for (var _i2 = 0; _i2 < fields.length; _i2++) { + var f = fields[_i2]; + + if (obj[f] != null) { + cy[f](obj[f]); + } + } + + cy.endBatch(); + return this; // chaining + } else { + // get + var flat = !!obj; + var json = {}; + + if (flat) { + json.elements = this.elements().map(function (ele) { + return ele.json(); + }); + } else { + json.elements = {}; + eles.forEach(function (ele) { + var group = ele.group(); + + if (!json.elements[group]) { + json.elements[group] = []; + } + + json.elements[group].push(ele.json()); + }); + } + + if (this._private.styleEnabled) { + json.style = cy.style().json(); + } + + json.data = copy(cy.data()); + var options = _p.options; + json.zoomingEnabled = _p.zoomingEnabled; + json.userZoomingEnabled = _p.userZoomingEnabled; + json.zoom = _p.zoom; + json.minZoom = _p.minZoom; + json.maxZoom = _p.maxZoom; + json.panningEnabled = _p.panningEnabled; + json.userPanningEnabled = _p.userPanningEnabled; + json.pan = copy(_p.pan); + json.boxSelectionEnabled = _p.boxSelectionEnabled; + json.renderer = copy(options.renderer); + json.hideEdgesOnViewport = options.hideEdgesOnViewport; + json.textureOnViewport = options.textureOnViewport; + json.wheelSensitivity = options.wheelSensitivity; + json.motionBlur = options.motionBlur; + json.multiClickDebounceTime = options.multiClickDebounceTime; + return json; + } + } + }); + corefn.$id = corefn.getElementById; + [corefn$9, corefn$8, elesfn, corefn$7, corefn$6, corefn$5, corefn$4, corefn$3, corefn$2, corefn$1, fn].forEach(function (props) { + extend(corefn, props); + }); + + /* eslint-disable no-unused-vars */ + + var defaults$7 = { + fit: true, + // whether to fit the viewport to the graph + directed: false, + // whether the tree is directed downwards (or edges can point in any direction if false) + padding: 30, + // padding on fit + circle: false, + // put depths in concentric circles if true, put depths top down if false + grid: false, + // whether to create an even grid into which the DAG is placed (circle:false only) + spacingFactor: 1.75, + // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap) + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + roots: undefined, + // the roots of the trees + depthSort: undefined, + // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled, + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + + }; + var deprecatedOptionDefaults = { + maximal: false, + // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also + acyclic: false // whether the tree is acyclic and thus a node could be shifted (due to the maximal option) multiple times without causing an infinite loop; setting to true sets maximal to true also; if you are uncertain whether a tree is acyclic, set to false to avoid potential infinite loops + + }; + /* eslint-enable */ + + var getInfo = function getInfo(ele) { + return ele.scratch('breadthfirst'); + }; + + var setInfo = function setInfo(ele, obj) { + return ele.scratch('breadthfirst', obj); + }; + + function BreadthFirstLayout(options) { + this.options = extend({}, defaults$7, deprecatedOptionDefaults, options); + } + + BreadthFirstLayout.prototype.run = function () { + var params = this.options; + var options = params; + var cy = params.cy; + var eles = options.eles; + var nodes = eles.nodes().filter(function (n) { + return !n.isParent(); + }); + var graph = eles; + var directed = options.directed; + var maximal = options.acyclic || options.maximal || options.maximalAdjustments > 0; // maximalAdjustments for compat. w/ old code; also, setting acyclic to true sets maximal to true + + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var roots; + + if (elementOrCollection(options.roots)) { + roots = options.roots; + } else if (array(options.roots)) { + var rootsArray = []; + + for (var i = 0; i < options.roots.length; i++) { + var id = options.roots[i]; + var ele = cy.getElementById(id); + rootsArray.push(ele); + } + + roots = cy.collection(rootsArray); + } else if (string(options.roots)) { + roots = cy.$(options.roots); + } else { + if (directed) { + roots = nodes.roots(); + } else { + var components = eles.components(); + roots = cy.collection(); + + var _loop = function _loop(_i) { + var comp = components[_i]; + var maxDegree = comp.maxDegree(false); + var compRoots = comp.filter(function (ele) { + return ele.degree(false) === maxDegree; + }); + roots = roots.add(compRoots); + }; + + for (var _i = 0; _i < components.length; _i++) { + _loop(_i); + } + } + } + + var depths = []; + var foundByBfs = {}; + + var addToDepth = function addToDepth(ele, d) { + if (depths[d] == null) { + depths[d] = []; + } + + var i = depths[d].length; + depths[d].push(ele); + setInfo(ele, { + index: i, + depth: d + }); + }; + + var changeDepth = function changeDepth(ele, newDepth) { + var _getInfo = getInfo(ele), + depth = _getInfo.depth, + index = _getInfo.index; + + depths[depth][index] = null; + addToDepth(ele, newDepth); + }; // find the depths of the nodes + + + graph.bfs({ + roots: roots, + directed: options.directed, + visit: function visit(node, edge, pNode, i, depth) { + var ele = node[0]; + var id = ele.id(); + addToDepth(ele, depth); + foundByBfs[id] = true; + } + }); // check for nodes not found by bfs + + var orphanNodes = []; + + for (var _i2 = 0; _i2 < nodes.length; _i2++) { + var _ele = nodes[_i2]; + + if (foundByBfs[_ele.id()]) { + continue; + } else { + orphanNodes.push(_ele); + } + } // assign the nodes a depth and index + + + var assignDepthsAt = function assignDepthsAt(i) { + var eles = depths[i]; + + for (var j = 0; j < eles.length; j++) { + var _ele2 = eles[j]; + + if (_ele2 == null) { + eles.splice(j, 1); + j--; + continue; + } + + setInfo(_ele2, { + depth: i, + index: j + }); + } + }; + + var assignDepths = function assignDepths() { + for (var _i3 = 0; _i3 < depths.length; _i3++) { + assignDepthsAt(_i3); + } + }; + + var adjustMaximally = function adjustMaximally(ele, shifted) { + var eInfo = getInfo(ele); + var incomers = ele.incomers().filter(function (el) { + return el.isNode() && eles.has(el); + }); + var maxDepth = -1; + var id = ele.id(); + + for (var k = 0; k < incomers.length; k++) { + var incmr = incomers[k]; + var iInfo = getInfo(incmr); + maxDepth = Math.max(maxDepth, iInfo.depth); + } + + if (eInfo.depth <= maxDepth) { + if (!options.acyclic && shifted[id]) { + return null; + } + + var newDepth = maxDepth + 1; + changeDepth(ele, newDepth); + shifted[id] = newDepth; + return true; + } + + return false; + }; // for the directed case, try to make the edges all go down (i.e. depth i => depth i + 1) + + + if (directed && maximal) { + var Q = []; + var shifted = {}; + + var enqueue = function enqueue(n) { + return Q.push(n); + }; + + var dequeue = function dequeue() { + return Q.shift(); + }; + + nodes.forEach(function (n) { + return Q.push(n); + }); + + while (Q.length > 0) { + var _ele3 = dequeue(); + + var didShift = adjustMaximally(_ele3, shifted); + + if (didShift) { + _ele3.outgoers().filter(function (el) { + return el.isNode() && eles.has(el); + }).forEach(enqueue); + } else if (didShift === null) { + warn('Detected double maximal shift for node `' + _ele3.id() + '`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.'); + break; // exit on failure + } + } + } + + assignDepths(); // clear holes + // find min distance we need to leave between nodes + + var minDistance = 0; + + if (options.avoidOverlap) { + for (var _i4 = 0; _i4 < nodes.length; _i4++) { + var n = nodes[_i4]; + var nbb = n.layoutDimensions(options); + var w = nbb.w; + var h = nbb.h; + minDistance = Math.max(minDistance, w, h); + } + } // get the weighted percent for an element based on its connectivity to other levels + + + var cachedWeightedPercent = {}; + + var getWeightedPercent = function getWeightedPercent(ele) { + if (cachedWeightedPercent[ele.id()]) { + return cachedWeightedPercent[ele.id()]; + } + + var eleDepth = getInfo(ele).depth; + var neighbors = ele.neighborhood(); + var percent = 0; + var samples = 0; + + for (var _i5 = 0; _i5 < neighbors.length; _i5++) { + var neighbor = neighbors[_i5]; + + if (neighbor.isEdge() || neighbor.isParent() || !nodes.has(neighbor)) { + continue; + } + + var bf = getInfo(neighbor); + + if (bf == null) { + continue; + } + + var index = bf.index; + var depth = bf.depth; // unassigned neighbours shouldn't affect the ordering + + if (index == null || depth == null) { + continue; + } + + var nDepth = depths[depth].length; + + if (depth < eleDepth) { + // only get influenced by elements above + percent += index / nDepth; + samples++; + } + } + + samples = Math.max(1, samples); + percent = percent / samples; + + if (samples === 0) { + // put lone nodes at the start + percent = 0; + } + + cachedWeightedPercent[ele.id()] = percent; + return percent; + }; // rearrange the indices in each depth level based on connectivity + + + var sortFn = function sortFn(a, b) { + var apct = getWeightedPercent(a); + var bpct = getWeightedPercent(b); + var diff = apct - bpct; + + if (diff === 0) { + return ascending(a.id(), b.id()); // make sure sort doesn't have don't-care comparisons + } else { + return diff; + } + }; + + if (options.depthSort !== undefined) { + sortFn = options.depthSort; + } // sort each level to make connected nodes closer + + + for (var _i6 = 0; _i6 < depths.length; _i6++) { + depths[_i6].sort(sortFn); + + assignDepthsAt(_i6); + } // assign orphan nodes to a new top-level depth + + + var orphanDepth = []; + + for (var _i7 = 0; _i7 < orphanNodes.length; _i7++) { + orphanDepth.push(orphanNodes[_i7]); + } + + depths.unshift(orphanDepth); + assignDepths(); + var biggestDepthSize = 0; + + for (var _i8 = 0; _i8 < depths.length; _i8++) { + biggestDepthSize = Math.max(depths[_i8].length, biggestDepthSize); + } + + var center = { + x: bb.x1 + bb.w / 2, + y: bb.x1 + bb.h / 2 + }; + var maxDepthSize = depths.reduce(function (max, eles) { + return Math.max(max, eles.length); + }, 0); + + var getPosition = function getPosition(ele) { + var _getInfo2 = getInfo(ele), + depth = _getInfo2.depth, + index = _getInfo2.index; + + var depthSize = depths[depth].length; + var distanceX = Math.max(bb.w / ((options.grid ? maxDepthSize : depthSize) + 1), minDistance); + var distanceY = Math.max(bb.h / (depths.length + 1), minDistance); + var radiusStepSize = Math.min(bb.w / 2 / depths.length, bb.h / 2 / depths.length); + radiusStepSize = Math.max(radiusStepSize, minDistance); + + if (!options.circle) { + var epos = { + x: center.x + (index + 1 - (depthSize + 1) / 2) * distanceX, + y: (depth + 1) * distanceY + }; + return epos; + } else { + var radius = radiusStepSize * depth + radiusStepSize - (depths.length > 0 && depths[0].length <= 3 ? radiusStepSize / 2 : 0); + var theta = 2 * Math.PI / depths[depth].length * index; + + if (depth === 0 && depths[0].length === 1) { + radius = 1; + } + + return { + x: center.x + radius * Math.cos(theta), + y: center.y + radius * Math.sin(theta) + }; + } + }; + + eles.nodes().layoutPositions(this, options, getPosition); + return this; // chaining + }; + + var defaults$6 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox and radius if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + radius: undefined, + // the radius of the circle + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: undefined, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: true, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + sort: undefined, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + + }; + + function CircleLayout(options) { + this.options = extend({}, defaults$6, options); + } + + CircleLayout.prototype.run = function () { + var params = this.options; + var options = params; + var cy = params.cy; + var eles = options.eles; + var clockwise = options.counterclockwise !== undefined ? !options.counterclockwise : options.clockwise; + var nodes = eles.nodes().not(':parent'); + + if (options.sort) { + nodes = nodes.sort(options.sort); + } + + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var center = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var sweep = options.sweep === undefined ? 2 * Math.PI - 2 * Math.PI / nodes.length : options.sweep; + var dTheta = sweep / Math.max(1, nodes.length - 1); + var r; + var minDistance = 0; + + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + var nbb = n.layoutDimensions(options); + var w = nbb.w; + var h = nbb.h; + minDistance = Math.max(minDistance, w, h); + } + + if (number$1(options.radius)) { + r = options.radius; + } else if (nodes.length <= 1) { + r = 0; + } else { + r = Math.min(bb.h, bb.w) / 2 - minDistance; + } // calculate the radius + + + if (nodes.length > 1 && options.avoidOverlap) { + // but only if more than one node (can't overlap) + minDistance *= 1.75; // just to have some nice spacing + + var dcos = Math.cos(dTheta) - Math.cos(0); + var dsin = Math.sin(dTheta) - Math.sin(0); + var rMin = Math.sqrt(minDistance * minDistance / (dcos * dcos + dsin * dsin)); // s.t. no nodes overlapping + + r = Math.max(rMin, r); + } + + var getPos = function getPos(ele, i) { + var theta = options.startAngle + i * dTheta * (clockwise ? 1 : -1); + var rx = r * Math.cos(theta); + var ry = r * Math.sin(theta); + var pos = { + x: center.x + rx, + y: center.y + ry + }; + return pos; + }; + + eles.nodes().layoutPositions(this, options, getPos); + return this; // chaining + }; + + var defaults$5 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: undefined, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: true, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + equidistant: false, + // whether levels have an equal radial distance betwen them, may cause bounding box overflow + minNodeSpacing: 10, + // min spacing between outside of nodes (used for radius adjustment) + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + height: undefined, + // height of layout area (overrides container height) + width: undefined, + // width of layout area (overrides container width) + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + concentric: function concentric(node) { + // returns numeric value for each node, placing higher nodes in levels towards the centre + return node.degree(); + }, + levelWidth: function levelWidth(nodes) { + // the variation of concentric values in each level + return nodes.maxDegree() / 4; + }, + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + + }; + + function ConcentricLayout(options) { + this.options = extend({}, defaults$5, options); + } + + ConcentricLayout.prototype.run = function () { + var params = this.options; + var options = params; + var clockwise = options.counterclockwise !== undefined ? !options.counterclockwise : options.clockwise; + var cy = params.cy; + var eles = options.eles; + var nodes = eles.nodes().not(':parent'); + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var center = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var nodeValues = []; // { node, value } + + var maxNodeSize = 0; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var value = void 0; // calculate the node value + + value = options.concentric(node); + nodeValues.push({ + value: value, + node: node + }); // for style mapping + + node._private.scratch.concentric = value; + } // in case we used the `concentric` in style + + + nodes.updateStyle(); // calculate max size now based on potentially updated mappers + + for (var _i = 0; _i < nodes.length; _i++) { + var _node = nodes[_i]; + + var nbb = _node.layoutDimensions(options); + + maxNodeSize = Math.max(maxNodeSize, nbb.w, nbb.h); + } // sort node values in descreasing order + + + nodeValues.sort(function (a, b) { + return b.value - a.value; + }); + var levelWidth = options.levelWidth(nodes); // put the values into levels + + var levels = [[]]; + var currentLevel = levels[0]; + + for (var _i2 = 0; _i2 < nodeValues.length; _i2++) { + var val = nodeValues[_i2]; + + if (currentLevel.length > 0) { + var diff = Math.abs(currentLevel[0].value - val.value); + + if (diff >= levelWidth) { + currentLevel = []; + levels.push(currentLevel); + } + } + + currentLevel.push(val); + } // create positions from levels + + + var minDist = maxNodeSize + options.minNodeSpacing; // min dist between nodes + + if (!options.avoidOverlap) { + // then strictly constrain to bb + var firstLvlHasMulti = levels.length > 0 && levels[0].length > 1; + var maxR = Math.min(bb.w, bb.h) / 2 - minDist; + var rStep = maxR / (levels.length + firstLvlHasMulti ? 1 : 0); + minDist = Math.min(minDist, rStep); + } // find the metrics for each level + + + var r = 0; + + for (var _i3 = 0; _i3 < levels.length; _i3++) { + var level = levels[_i3]; + var sweep = options.sweep === undefined ? 2 * Math.PI - 2 * Math.PI / level.length : options.sweep; + var dTheta = level.dTheta = sweep / Math.max(1, level.length - 1); // calculate the radius + + if (level.length > 1 && options.avoidOverlap) { + // but only if more than one node (can't overlap) + var dcos = Math.cos(dTheta) - Math.cos(0); + var dsin = Math.sin(dTheta) - Math.sin(0); + var rMin = Math.sqrt(minDist * minDist / (dcos * dcos + dsin * dsin)); // s.t. no nodes overlapping + + r = Math.max(rMin, r); + } + + level.r = r; + r += minDist; + } + + if (options.equidistant) { + var rDeltaMax = 0; + var _r = 0; + + for (var _i4 = 0; _i4 < levels.length; _i4++) { + var _level = levels[_i4]; + var rDelta = _level.r - _r; + rDeltaMax = Math.max(rDeltaMax, rDelta); + } + + _r = 0; + + for (var _i5 = 0; _i5 < levels.length; _i5++) { + var _level2 = levels[_i5]; + + if (_i5 === 0) { + _r = _level2.r; + } + + _level2.r = _r; + _r += rDeltaMax; + } + } // calculate the node positions + + + var pos = {}; // id => position + + for (var _i6 = 0; _i6 < levels.length; _i6++) { + var _level3 = levels[_i6]; + var _dTheta = _level3.dTheta; + var _r2 = _level3.r; + + for (var j = 0; j < _level3.length; j++) { + var _val = _level3[j]; + var theta = options.startAngle + (clockwise ? 1 : -1) * _dTheta * j; + var p = { + x: center.x + _r2 * Math.cos(theta), + y: center.y + _r2 * Math.sin(theta) + }; + pos[_val.node.id()] = p; + } + } // position the nodes + + + eles.nodes().layoutPositions(this, options, function (ele) { + var id = ele.id(); + return pos[id]; + }); + return this; // chaining + }; + + /* + The CoSE layout was written by Gerardo Huck. + https://www.linkedin.com/in/gerardohuck/ + + Based on the following article: + http://dl.acm.org/citation.cfm?id=1498047 + + Modifications tracked on Github. + */ + var DEBUG; + /** + * @brief : default layout options + */ + + var defaults$4 = { + // Called on `layoutready` + ready: function ready() {}, + // Called on `layoutstop` + stop: function stop() {}, + // Whether to animate while running the layout + // true : Animate continuously as the layout is running + // false : Just show the end result + // 'end' : Animate with the end result, from the initial positions to the end positions + animate: true, + // Easing of the animation for animate:'end' + animationEasing: undefined, + // The duration of the animation for animate:'end' + animationDuration: undefined, + // A function that determines whether the node should be animated + // All nodes animated by default on animate enabled + // Non-animated nodes are positioned immediately when the layout starts + animateFilter: function animateFilter(node, i) { + return true; + }, + // The layout animates only after this many milliseconds for animate:true + // (prevents flashing on fast runs) + animationThreshold: 250, + // Number of iterations between consecutive screen positions update + refresh: 20, + // Whether to fit the network view after when done + fit: true, + // Padding on fit + padding: 30, + // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + boundingBox: undefined, + // Excludes the label when calculating node bounding boxes for the layout algorithm + nodeDimensionsIncludeLabels: false, + // Randomize the initial positions of the nodes (true) or use existing positions (false) + randomize: false, + // Extra spacing between components in non-compound graphs + componentSpacing: 40, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: function nodeRepulsion(node) { + return 2048; + }, + // Node repulsion (overlapping) multiplier + nodeOverlap: 4, + // Ideal edge (non nested) length + idealEdgeLength: function idealEdgeLength(edge) { + return 32; + }, + // Divisor to compute edge forces + edgeElasticity: function edgeElasticity(edge) { + return 32; + }, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 1.2, + // Gravity force (constant) + gravity: 1, + // Maximum number of iterations to perform + numIter: 1000, + // Initial temperature (maximum node displacement) + initialTemp: 1000, + // Cooling factor (how the temperature is reduced between consecutive iterations + coolingFactor: 0.99, + // Lower temperature threshold (below this point the layout will end) + minTemp: 1.0 + }; + /** + * @brief : constructor + * @arg options : object containing layout options + */ + + function CoseLayout(options) { + this.options = extend({}, defaults$4, options); + this.options.layout = this; + } + /** + * @brief : runs the layout + */ + + + CoseLayout.prototype.run = function () { + var options = this.options; + var cy = options.cy; + var layout = this; + layout.stopped = false; + + if (options.animate === true || options.animate === false) { + layout.emit({ + type: 'layoutstart', + layout: layout + }); + } // Set DEBUG - Global variable + + + if (true === options.debug) { + DEBUG = true; + } else { + DEBUG = false; + } // Initialize layout info + + + var layoutInfo = createLayoutInfo(cy, layout, options); // Show LayoutInfo contents if debugging + + if (DEBUG) { + printLayoutInfo(layoutInfo); + } // If required, randomize node positions + + + if (options.randomize) { + randomizePositions(layoutInfo); + } + + var startTime = performanceNow(); + + var refresh = function refresh() { + refreshPositions(layoutInfo, cy, options); // Fit the graph if necessary + + if (true === options.fit) { + cy.fit(options.padding); + } + }; + + var mainLoop = function mainLoop(i) { + if (layout.stopped || i >= options.numIter) { + // logDebug("Layout manually stopped. Stopping computation in step " + i); + return false; + } // Do one step in the phisical simulation + + + step(layoutInfo, options); // Update temperature + + layoutInfo.temperature = layoutInfo.temperature * options.coolingFactor; // logDebug("New temperature: " + layoutInfo.temperature); + + if (layoutInfo.temperature < options.minTemp) { + // logDebug("Temperature drop below minimum threshold. Stopping computation in step " + i); + return false; + } + + return true; + }; + + var done = function done() { + if (options.animate === true || options.animate === false) { + refresh(); // Layout has finished + + layout.one('layoutstop', options.stop); + layout.emit({ + type: 'layoutstop', + layout: layout + }); + } else { + var nodes = options.eles.nodes(); + var getScaledPos = getScaleInBoundsFn(layoutInfo, options, nodes); + nodes.layoutPositions(layout, options, getScaledPos); + } + }; + + var i = 0; + var loopRet = true; + + if (options.animate === true) { + var frame = function frame() { + var f = 0; + + while (loopRet && f < options.refresh) { + loopRet = mainLoop(i); + i++; + f++; + } + + if (!loopRet) { + // it's done + separateComponents(layoutInfo, options); + done(); + } else { + var now = performanceNow(); + + if (now - startTime >= options.animationThreshold) { + refresh(); + } + + requestAnimationFrame(frame); + } + }; + + frame(); + } else { + while (loopRet) { + loopRet = mainLoop(i); + i++; + } + + separateComponents(layoutInfo, options); + done(); + } + + return this; // chaining + }; + /** + * @brief : called on continuous layouts to stop them before they finish + */ + + + CoseLayout.prototype.stop = function () { + this.stopped = true; + + if (this.thread) { + this.thread.stop(); + } + + this.emit('layoutstop'); + return this; // chaining + }; + + CoseLayout.prototype.destroy = function () { + if (this.thread) { + this.thread.stop(); + } + + return this; // chaining + }; + /** + * @brief : Creates an object which is contains all the data + * used in the layout process + * @arg cy : cytoscape.js object + * @return : layoutInfo object initialized + */ + + + var createLayoutInfo = function createLayoutInfo(cy, layout, options) { + // Shortcut + var edges = options.eles.edges(); + var nodes = options.eles.nodes(); + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var layoutInfo = { + isCompound: cy.hasCompoundNodes(), + layoutNodes: [], + idToIndex: {}, + nodeSize: nodes.size(), + graphSet: [], + indexToGraph: [], + layoutEdges: [], + edgeSize: edges.size(), + temperature: options.initialTemp, + clientWidth: bb.w, + clientHeight: bb.h, + boundingBox: bb + }; + var components = options.eles.components(); + var id2cmptId = {}; + + for (var i = 0; i < components.length; i++) { + var component = components[i]; + + for (var j = 0; j < component.length; j++) { + var node = component[j]; + id2cmptId[node.id()] = i; + } + } // Iterate over all nodes, creating layout nodes + + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = nodes[i]; + var nbb = n.layoutDimensions(options); + var tempNode = {}; + tempNode.isLocked = n.locked(); + tempNode.id = n.data('id'); + tempNode.parentId = n.data('parent'); + tempNode.cmptId = id2cmptId[n.id()]; + tempNode.children = []; + tempNode.positionX = n.position('x'); + tempNode.positionY = n.position('y'); + tempNode.offsetX = 0; + tempNode.offsetY = 0; + tempNode.height = nbb.w; + tempNode.width = nbb.h; + tempNode.maxX = tempNode.positionX + tempNode.width / 2; + tempNode.minX = tempNode.positionX - tempNode.width / 2; + tempNode.maxY = tempNode.positionY + tempNode.height / 2; + tempNode.minY = tempNode.positionY - tempNode.height / 2; + tempNode.padLeft = parseFloat(n.style('padding')); + tempNode.padRight = parseFloat(n.style('padding')); + tempNode.padTop = parseFloat(n.style('padding')); + tempNode.padBottom = parseFloat(n.style('padding')); // forces + + tempNode.nodeRepulsion = fn$6(options.nodeRepulsion) ? options.nodeRepulsion(n) : options.nodeRepulsion; // Add new node + + layoutInfo.layoutNodes.push(tempNode); // Add entry to id-index map + + layoutInfo.idToIndex[tempNode.id] = i; + } // Inline implementation of a queue, used for traversing the graph in BFS order + + + var queue = []; + var start = 0; // Points to the start the queue + + var end = -1; // Points to the end of the queue + + var tempGraph = []; // Second pass to add child information and + // initialize queue for hierarchical traversal + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + var p_id = n.parentId; // Check if node n has a parent node + + if (null != p_id) { + // Add node Id to parent's list of children + layoutInfo.layoutNodes[layoutInfo.idToIndex[p_id]].children.push(n.id); + } else { + // If a node doesn't have a parent, then it's in the root graph + queue[++end] = n.id; + tempGraph.push(n.id); + } + } // Add root graph to graphSet + + + layoutInfo.graphSet.push(tempGraph); // Traverse the graph, level by level, + + while (start <= end) { + // Get the node to visit and remove it from queue + var node_id = queue[start++]; + var node_ix = layoutInfo.idToIndex[node_id]; + var node = layoutInfo.layoutNodes[node_ix]; + var children = node.children; + + if (children.length > 0) { + // Add children nodes as a new graph to graph set + layoutInfo.graphSet.push(children); // Add children to que queue to be visited + + for (var i = 0; i < children.length; i++) { + queue[++end] = children[i]; + } + } + } // Create indexToGraph map + + + for (var i = 0; i < layoutInfo.graphSet.length; i++) { + var graph = layoutInfo.graphSet[i]; + + for (var j = 0; j < graph.length; j++) { + var index = layoutInfo.idToIndex[graph[j]]; + layoutInfo.indexToGraph[index] = i; + } + } // Iterate over all edges, creating Layout Edges + + + for (var i = 0; i < layoutInfo.edgeSize; i++) { + var e = edges[i]; + var tempEdge = {}; + tempEdge.id = e.data('id'); + tempEdge.sourceId = e.data('source'); + tempEdge.targetId = e.data('target'); // Compute ideal length + + var idealLength = fn$6(options.idealEdgeLength) ? options.idealEdgeLength(e) : options.idealEdgeLength; + var elasticity = fn$6(options.edgeElasticity) ? options.edgeElasticity(e) : options.edgeElasticity; // Check if it's an inter graph edge + + var sourceIx = layoutInfo.idToIndex[tempEdge.sourceId]; + var targetIx = layoutInfo.idToIndex[tempEdge.targetId]; + var sourceGraph = layoutInfo.indexToGraph[sourceIx]; + var targetGraph = layoutInfo.indexToGraph[targetIx]; + + if (sourceGraph != targetGraph) { + // Find lowest common graph ancestor + var lca = findLCA(tempEdge.sourceId, tempEdge.targetId, layoutInfo); // Compute sum of node depths, relative to lca graph + + var lcaGraph = layoutInfo.graphSet[lca]; + var depth = 0; // Source depth + + var tempNode = layoutInfo.layoutNodes[sourceIx]; + + while (-1 === lcaGraph.indexOf(tempNode.id)) { + tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]]; + depth++; + } // Target depth + + + tempNode = layoutInfo.layoutNodes[targetIx]; + + while (-1 === lcaGraph.indexOf(tempNode.id)) { + tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]]; + depth++; + } // logDebug('LCA of nodes ' + tempEdge.sourceId + ' and ' + tempEdge.targetId + + // ". Index: " + lca + " Contents: " + lcaGraph.toString() + + // ". Depth: " + depth); + // Update idealLength + + + idealLength *= depth * options.nestingFactor; + } + + tempEdge.idealLength = idealLength; + tempEdge.elasticity = elasticity; + layoutInfo.layoutEdges.push(tempEdge); + } // Finally, return layoutInfo object + + + return layoutInfo; + }; + /** + * @brief : This function finds the index of the lowest common + * graph ancestor between 2 nodes in the subtree + * (from the graph hierarchy induced tree) whose + * root is graphIx + * + * @arg node1: node1's ID + * @arg node2: node2's ID + * @arg layoutInfo: layoutInfo object + * + */ + + + var findLCA = function findLCA(node1, node2, layoutInfo) { + // Find their common ancester, starting from the root graph + var res = findLCA_aux(node1, node2, 0, layoutInfo); + + if (2 > res.count) { + // If aux function couldn't find the common ancester, + // then it is the root graph + return 0; + } else { + return res.graph; + } + }; + /** + * @brief : Auxiliary function used for LCA computation + * + * @arg node1 : node1's ID + * @arg node2 : node2's ID + * @arg graphIx : subgraph index + * @arg layoutInfo : layoutInfo object + * + * @return : object of the form {count: X, graph: Y}, where: + * X is the number of ancestors (max: 2) found in + * graphIx (and it's subgraphs), + * Y is the graph index of the lowest graph containing + * all X nodes + */ + + + var findLCA_aux = function findLCA_aux(node1, node2, graphIx, layoutInfo) { + var graph = layoutInfo.graphSet[graphIx]; // If both nodes belongs to graphIx + + if (-1 < graph.indexOf(node1) && -1 < graph.indexOf(node2)) { + return { + count: 2, + graph: graphIx + }; + } // Make recursive calls for all subgraphs + + + var c = 0; + + for (var i = 0; i < graph.length; i++) { + var nodeId = graph[i]; + var nodeIx = layoutInfo.idToIndex[nodeId]; + var children = layoutInfo.layoutNodes[nodeIx].children; // If the node has no child, skip it + + if (0 === children.length) { + continue; + } + + var childGraphIx = layoutInfo.indexToGraph[layoutInfo.idToIndex[children[0]]]; + var result = findLCA_aux(node1, node2, childGraphIx, layoutInfo); + + if (0 === result.count) { + // Neither node1 nor node2 are present in this subgraph + continue; + } else if (1 === result.count) { + // One of (node1, node2) is present in this subgraph + c++; + + if (2 === c) { + // We've already found both nodes, no need to keep searching + break; + } + } else { + // Both nodes are present in this subgraph + return result; + } + } + + return { + count: c, + graph: graphIx + }; + }; + /** + * @brief: printsLayoutInfo into js console + * Only used for debbuging + */ + + +var printLayoutInfo; + /** + * @brief : Randomizes the position of all nodes + */ + + + var randomizePositions = function randomizePositions(layoutInfo, cy) { + var width = layoutInfo.clientWidth; + var height = layoutInfo.clientHeight; + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; // No need to randomize compound nodes or locked nodes + + if (0 === n.children.length && !n.isLocked) { + n.positionX = Math.random() * width; + n.positionY = Math.random() * height; + } + } + }; + + var getScaleInBoundsFn = function getScaleInBoundsFn(layoutInfo, options, nodes) { + var bb = layoutInfo.boundingBox; + var coseBB = { + x1: Infinity, + x2: -Infinity, + y1: Infinity, + y2: -Infinity + }; + + if (options.boundingBox) { + nodes.forEach(function (node) { + var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[node.data('id')]]; + coseBB.x1 = Math.min(coseBB.x1, lnode.positionX); + coseBB.x2 = Math.max(coseBB.x2, lnode.positionX); + coseBB.y1 = Math.min(coseBB.y1, lnode.positionY); + coseBB.y2 = Math.max(coseBB.y2, lnode.positionY); + }); + coseBB.w = coseBB.x2 - coseBB.x1; + coseBB.h = coseBB.y2 - coseBB.y1; + } + + return function (ele, i) { + var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[ele.data('id')]]; + + if (options.boundingBox) { + // then add extra bounding box constraint + var pctX = (lnode.positionX - coseBB.x1) / coseBB.w; + var pctY = (lnode.positionY - coseBB.y1) / coseBB.h; + return { + x: bb.x1 + pctX * bb.w, + y: bb.y1 + pctY * bb.h + }; + } else { + return { + x: lnode.positionX, + y: lnode.positionY + }; + } + }; + }; + /** + * @brief : Updates the positions of nodes in the network + * @arg layoutInfo : LayoutInfo object + * @arg cy : Cytoscape object + * @arg options : Layout options + */ + + + var refreshPositions = function refreshPositions(layoutInfo, cy, options) { + // var s = 'Refreshing positions'; + // logDebug(s); + var layout = options.layout; + var nodes = options.eles.nodes(); + var getScaledPos = getScaleInBoundsFn(layoutInfo, options, nodes); + nodes.positions(getScaledPos); // Trigger layoutReady only on first call + + if (true !== layoutInfo.ready) { + // s = 'Triggering layoutready'; + // logDebug(s); + layoutInfo.ready = true; + layout.one('layoutready', options.ready); + layout.emit({ + type: 'layoutready', + layout: this + }); + } + }; + /** + * @brief : Logs a debug message in JS console, if DEBUG is ON + */ + // var logDebug = function(text) { + // if (DEBUG) { + // console.debug(text); + // } + // }; + + /** + * @brief : Performs one iteration of the physical simulation + * @arg layoutInfo : LayoutInfo object already initialized + * @arg cy : Cytoscape object + * @arg options : Layout options + */ + + + var step = function step(layoutInfo, options, _step) { + // var s = "\n\n###############################"; + // s += "\nSTEP: " + step; + // s += "\n###############################\n"; + // logDebug(s); + // Calculate node repulsions + calculateNodeForces(layoutInfo, options); // Calculate edge forces + + calculateEdgeForces(layoutInfo); // Calculate gravity forces + + calculateGravityForces(layoutInfo, options); // Propagate forces from parent to child + + propagateForces(layoutInfo); // Update positions based on calculated forces + + updatePositions(layoutInfo); + }; + /** + * @brief : Computes the node repulsion forces + */ + + + var calculateNodeForces = function calculateNodeForces(layoutInfo, options) { + // Go through each of the graphs in graphSet + // Nodes only repel each other if they belong to the same graph + // var s = 'calculateNodeForces'; + // logDebug(s); + for (var i = 0; i < layoutInfo.graphSet.length; i++) { + var graph = layoutInfo.graphSet[i]; + var numNodes = graph.length; // s = "Set: " + graph.toString(); + // logDebug(s); + // Now get all the pairs of nodes + // Only get each pair once, (A, B) = (B, A) + + for (var j = 0; j < numNodes; j++) { + var node1 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j]]]; + + for (var k = j + 1; k < numNodes; k++) { + var node2 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[k]]]; + nodeRepulsion(node1, node2, layoutInfo, options); + } + } + } + }; + + var randomDistance = function randomDistance(max) { + return -max + 2 * max * Math.random(); + }; + /** + * @brief : Compute the node repulsion forces between a pair of nodes + */ + + + var nodeRepulsion = function nodeRepulsion(node1, node2, layoutInfo, options) { + // var s = "Node repulsion. Node1: " + node1.id + " Node2: " + node2.id; + var cmptId1 = node1.cmptId; + var cmptId2 = node2.cmptId; + + if (cmptId1 !== cmptId2 && !layoutInfo.isCompound) { + return; + } // Get direction of line connecting both node centers + + + var directionX = node2.positionX - node1.positionX; + var directionY = node2.positionY - node1.positionY; + var maxRandDist = 1; // s += "\ndirectionX: " + directionX + ", directionY: " + directionY; + // If both centers are the same, apply a random force + + if (0 === directionX && 0 === directionY) { + directionX = randomDistance(maxRandDist); + directionY = randomDistance(maxRandDist); + } + + var overlap = nodesOverlap(node1, node2, directionX, directionY); + + if (overlap > 0) { + // s += "\nNodes DO overlap."; + // s += "\nOverlap: " + overlap; + // If nodes overlap, repulsion force is proportional + // to the overlap + var force = options.nodeOverlap * overlap; // Compute the module and components of the force vector + + var distance = Math.sqrt(directionX * directionX + directionY * directionY); // s += "\nDistance: " + distance; + + var forceX = force * directionX / distance; + var forceY = force * directionY / distance; + } else { + // s += "\nNodes do NOT overlap."; + // If there's no overlap, force is inversely proportional + // to squared distance + // Get clipping points for both nodes + var point1 = findClippingPoint(node1, directionX, directionY); + var point2 = findClippingPoint(node2, -1 * directionX, -1 * directionY); // Use clipping points to compute distance + + var distanceX = point2.x - point1.x; + var distanceY = point2.y - point1.y; + var distanceSqr = distanceX * distanceX + distanceY * distanceY; + var distance = Math.sqrt(distanceSqr); // s += "\nDistance: " + distance; + // Compute the module and components of the force vector + + var force = (node1.nodeRepulsion + node2.nodeRepulsion) / distanceSqr; + var forceX = force * distanceX / distance; + var forceY = force * distanceY / distance; + } // Apply force + + + if (!node1.isLocked) { + node1.offsetX -= forceX; + node1.offsetY -= forceY; + } + + if (!node2.isLocked) { + node2.offsetX += forceX; + node2.offsetY += forceY; + } // s += "\nForceX: " + forceX + " ForceY: " + forceY; + // logDebug(s); + + + return; + }; + /** + * @brief : Determines whether two nodes overlap or not + * @return : Amount of overlapping (0 => no overlap) + */ + + + var nodesOverlap = function nodesOverlap(node1, node2, dX, dY) { + if (dX > 0) { + var overlapX = node1.maxX - node2.minX; + } else { + var overlapX = node2.maxX - node1.minX; + } + + if (dY > 0) { + var overlapY = node1.maxY - node2.minY; + } else { + var overlapY = node2.maxY - node1.minY; + } + + if (overlapX >= 0 && overlapY >= 0) { + return Math.sqrt(overlapX * overlapX + overlapY * overlapY); + } else { + return 0; + } + }; + /** + * @brief : Finds the point in which an edge (direction dX, dY) intersects + * the rectangular bounding box of it's source/target node + */ + + + var findClippingPoint = function findClippingPoint(node, dX, dY) { + // Shorcuts + var X = node.positionX; + var Y = node.positionY; + var H = node.height || 1; + var W = node.width || 1; + var dirSlope = dY / dX; + var nodeSlope = H / W; // var s = 'Computing clipping point of node ' + node.id + + // " . Height: " + H + ", Width: " + W + + // "\nDirection " + dX + ", " + dY; + // + // Compute intersection + + var res = {}; // Case: Vertical direction (up) + + if (0 === dX && 0 < dY) { + res.x = X; // s += "\nUp direction"; + + res.y = Y + H / 2; + return res; + } // Case: Vertical direction (down) + + + if (0 === dX && 0 > dY) { + res.x = X; + res.y = Y + H / 2; // s += "\nDown direction"; + + return res; + } // Case: Intersects the right border + + + if (0 < dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) { + res.x = X + W / 2; + res.y = Y + W * dY / 2 / dX; // s += "\nRightborder"; + + return res; + } // Case: Intersects the left border + + + if (0 > dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) { + res.x = X - W / 2; + res.y = Y - W * dY / 2 / dX; // s += "\nLeftborder"; + + return res; + } // Case: Intersects the top border + + + if (0 < dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) { + res.x = X + H * dX / 2 / dY; + res.y = Y + H / 2; // s += "\nTop border"; + + return res; + } // Case: Intersects the bottom border + + + if (0 > dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) { + res.x = X - H * dX / 2 / dY; + res.y = Y - H / 2; // s += "\nBottom border"; + + return res; + } // s += "\nClipping point found at " + res.x + ", " + res.y; + // logDebug(s); + + + return res; + }; + /** + * @brief : Calculates all edge forces + */ + + + var calculateEdgeForces = function calculateEdgeForces(layoutInfo, options) { + // Iterate over all edges + for (var i = 0; i < layoutInfo.edgeSize; i++) { + // Get edge, source & target nodes + var edge = layoutInfo.layoutEdges[i]; + var sourceIx = layoutInfo.idToIndex[edge.sourceId]; + var source = layoutInfo.layoutNodes[sourceIx]; + var targetIx = layoutInfo.idToIndex[edge.targetId]; + var target = layoutInfo.layoutNodes[targetIx]; // Get direction of line connecting both node centers + + var directionX = target.positionX - source.positionX; + var directionY = target.positionY - source.positionY; // If both centers are the same, do nothing. + // A random force has already been applied as node repulsion + + if (0 === directionX && 0 === directionY) { + continue; + } // Get clipping points for both nodes + + + var point1 = findClippingPoint(source, directionX, directionY); + var point2 = findClippingPoint(target, -1 * directionX, -1 * directionY); + var lx = point2.x - point1.x; + var ly = point2.y - point1.y; + var l = Math.sqrt(lx * lx + ly * ly); + var force = Math.pow(edge.idealLength - l, 2) / edge.elasticity; + + if (0 !== l) { + var forceX = force * lx / l; + var forceY = force * ly / l; + } else { + var forceX = 0; + var forceY = 0; + } // Add this force to target and source nodes + + + if (!source.isLocked) { + source.offsetX += forceX; + source.offsetY += forceY; + } + + if (!target.isLocked) { + target.offsetX -= forceX; + target.offsetY -= forceY; + } // var s = 'Edge force between nodes ' + source.id + ' and ' + target.id; + // s += "\nDistance: " + l + " Force: (" + forceX + ", " + forceY + ")"; + // logDebug(s); + + } + }; + /** + * @brief : Computes gravity forces for all nodes + */ + + + var calculateGravityForces = function calculateGravityForces(layoutInfo, options) { + if (options.gravity === 0) { + return; + } + + var distThreshold = 1; // var s = 'calculateGravityForces'; + // logDebug(s); + + for (var i = 0; i < layoutInfo.graphSet.length; i++) { + var graph = layoutInfo.graphSet[i]; + var numNodes = graph.length; // s = "Set: " + graph.toString(); + // logDebug(s); + // Compute graph center + + if (0 === i) { + var centerX = layoutInfo.clientHeight / 2; + var centerY = layoutInfo.clientWidth / 2; + } else { + // Get Parent node for this graph, and use its position as center + var temp = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[0]]]; + var parent = layoutInfo.layoutNodes[layoutInfo.idToIndex[temp.parentId]]; + var centerX = parent.positionX; + var centerY = parent.positionY; + } // s = "Center found at: " + centerX + ", " + centerY; + // logDebug(s); + // Apply force to all nodes in graph + + + for (var j = 0; j < numNodes; j++) { + var node = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j]]]; // s = "Node: " + node.id; + + if (node.isLocked) { + continue; + } + + var dx = centerX - node.positionX; + var dy = centerY - node.positionY; + var d = Math.sqrt(dx * dx + dy * dy); + + if (d > distThreshold) { + var fx = options.gravity * dx / d; + var fy = options.gravity * dy / d; + node.offsetX += fx; + node.offsetY += fy; // s += ": Applied force: " + fx + ", " + fy; + } // logDebug(s); + + } + } + }; + /** + * @brief : This function propagates the existing offsets from + * parent nodes to its descendents. + * @arg layoutInfo : layoutInfo Object + * @arg cy : cytoscape Object + * @arg options : Layout options + */ + + + var propagateForces = function propagateForces(layoutInfo, options) { + // Inline implementation of a queue, used for traversing the graph in BFS order + var queue = []; + var start = 0; // Points to the start the queue + + var end = -1; // Points to the end of the queue + // logDebug('propagateForces'); + // Start by visiting the nodes in the root graph + + queue.push.apply(queue, layoutInfo.graphSet[0]); + end += layoutInfo.graphSet[0].length; // Traverse the graph, level by level, + + while (start <= end) { + // Get the node to visit and remove it from queue + var nodeId = queue[start++]; + var nodeIndex = layoutInfo.idToIndex[nodeId]; + var node = layoutInfo.layoutNodes[nodeIndex]; + var children = node.children; // We only need to process the node if it's compound + + if (0 < children.length && !node.isLocked) { + var offX = node.offsetX; + var offY = node.offsetY; // var s = "Propagating offset from parent node : " + node.id + + // ". OffsetX: " + offX + ". OffsetY: " + offY; + // s += "\n Children: " + children.toString(); + // logDebug(s); + + for (var i = 0; i < children.length; i++) { + var childNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[children[i]]]; // Propagate offset + + childNode.offsetX += offX; + childNode.offsetY += offY; // Add children to queue to be visited + + queue[++end] = children[i]; + } // Reset parent offsets + + + node.offsetX = 0; + node.offsetY = 0; + } + } + }; + /** + * @brief : Updates the layout model positions, based on + * the accumulated forces + */ + + + var updatePositions = function updatePositions(layoutInfo, options) { + // var s = 'Updating positions'; + // logDebug(s); + // Reset boundaries for compound nodes + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + + if (0 < n.children.length) { + // logDebug("Resetting boundaries of compound node: " + n.id); + n.maxX = undefined; + n.minX = undefined; + n.maxY = undefined; + n.minY = undefined; + } + } + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + + if (0 < n.children.length || n.isLocked) { + // No need to set compound or locked node position + // logDebug("Skipping position update of node: " + n.id); + continue; + } // s = "Node: " + n.id + " Previous position: (" + + // n.positionX + ", " + n.positionY + ")."; + // Limit displacement in order to improve stability + + + var tempForce = limitForce(n.offsetX, n.offsetY, layoutInfo.temperature); + n.positionX += tempForce.x; + n.positionY += tempForce.y; + n.offsetX = 0; + n.offsetY = 0; + n.minX = n.positionX - n.width; + n.maxX = n.positionX + n.width; + n.minY = n.positionY - n.height; + n.maxY = n.positionY + n.height; // s += " New Position: (" + n.positionX + ", " + n.positionY + ")."; + // logDebug(s); + // Update ancestry boudaries + + updateAncestryBoundaries(n, layoutInfo); + } // Update size, position of compund nodes + + + for (var i = 0; i < layoutInfo.nodeSize; i++) { + var n = layoutInfo.layoutNodes[i]; + + if (0 < n.children.length && !n.isLocked) { + n.positionX = (n.maxX + n.minX) / 2; + n.positionY = (n.maxY + n.minY) / 2; + n.width = n.maxX - n.minX; + n.height = n.maxY - n.minY; // s = "Updating position, size of compound node " + n.id; + // s += "\nPositionX: " + n.positionX + ", PositionY: " + n.positionY; + // s += "\nWidth: " + n.width + ", Height: " + n.height; + // logDebug(s); + } + } + }; + /** + * @brief : Limits a force (forceX, forceY) to be not + * greater (in modulo) than max. + 8 Preserves force direction. + */ + + + var limitForce = function limitForce(forceX, forceY, max) { + // var s = "Limiting force: (" + forceX + ", " + forceY + "). Max: " + max; + var force = Math.sqrt(forceX * forceX + forceY * forceY); + + if (force > max) { + var res = { + x: max * forceX / force, + y: max * forceY / force + }; + } else { + var res = { + x: forceX, + y: forceY + }; + } // s += ".\nResult: (" + res.x + ", " + res.y + ")"; + // logDebug(s); + + + return res; + }; + /** + * @brief : Function used for keeping track of compound node + * sizes, since they should bound all their subnodes. + */ + + + var updateAncestryBoundaries = function updateAncestryBoundaries(node, layoutInfo) { + // var s = "Propagating new position/size of node " + node.id; + var parentId = node.parentId; + + if (null == parentId) { + // If there's no parent, we are done + // s += ". No parent node."; + // logDebug(s); + return; + } // Get Parent Node + + + var p = layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]]; + var flag = false; // MaxX + + if (null == p.maxX || node.maxX + p.padRight > p.maxX) { + p.maxX = node.maxX + p.padRight; + flag = true; // s += "\nNew maxX for parent node " + p.id + ": " + p.maxX; + } // MinX + + + if (null == p.minX || node.minX - p.padLeft < p.minX) { + p.minX = node.minX - p.padLeft; + flag = true; // s += "\nNew minX for parent node " + p.id + ": " + p.minX; + } // MaxY + + + if (null == p.maxY || node.maxY + p.padBottom > p.maxY) { + p.maxY = node.maxY + p.padBottom; + flag = true; // s += "\nNew maxY for parent node " + p.id + ": " + p.maxY; + } // MinY + + + if (null == p.minY || node.minY - p.padTop < p.minY) { + p.minY = node.minY - p.padTop; + flag = true; // s += "\nNew minY for parent node " + p.id + ": " + p.minY; + } // If updated boundaries, propagate changes upward + + + if (flag) { + // logDebug(s); + return updateAncestryBoundaries(p, layoutInfo); + } // s += ". No changes in boundaries/position of parent node " + p.id; + // logDebug(s); + + + return; + }; + + var separateComponents = function separateComponents(layoutInfo, options) { + var nodes = layoutInfo.layoutNodes; + var components = []; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var cid = node.cmptId; + var component = components[cid] = components[cid] || []; + component.push(node); + } + + var totalA = 0; + + for (var i = 0; i < components.length; i++) { + var c = components[i]; + + if (!c) { + continue; + } + + c.x1 = Infinity; + c.x2 = -Infinity; + c.y1 = Infinity; + c.y2 = -Infinity; + + for (var j = 0; j < c.length; j++) { + var n = c[j]; + c.x1 = Math.min(c.x1, n.positionX - n.width / 2); + c.x2 = Math.max(c.x2, n.positionX + n.width / 2); + c.y1 = Math.min(c.y1, n.positionY - n.height / 2); + c.y2 = Math.max(c.y2, n.positionY + n.height / 2); + } + + c.w = c.x2 - c.x1; + c.h = c.y2 - c.y1; + totalA += c.w * c.h; + } + + components.sort(function (c1, c2) { + return c2.w * c2.h - c1.w * c1.h; + }); + var x = 0; + var y = 0; + var usedW = 0; + var rowH = 0; + var maxRowW = Math.sqrt(totalA) * layoutInfo.clientWidth / layoutInfo.clientHeight; + + for (var i = 0; i < components.length; i++) { + var c = components[i]; + + if (!c) { + continue; + } + + for (var j = 0; j < c.length; j++) { + var n = c[j]; + + if (!n.isLocked) { + n.positionX += x - c.x1; + n.positionY += y - c.y1; + } + } + + x += c.w + options.componentSpacing; + usedW += c.w + options.componentSpacing; + rowH = Math.max(rowH, c.h); + + if (usedW > maxRowW) { + y += rowH + options.componentSpacing; + x = 0; + usedW = 0; + rowH = 0; + } + } + }; + + var defaults$3 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // padding used on fit + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + avoidOverlapPadding: 10, + // extra spacing around nodes when avoidOverlap: true + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: undefined, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + condense: false, + // uses all available space on false, uses minimal space on true + rows: undefined, + // force num of rows in the grid + cols: undefined, + // force num of columns in the grid + position: function position(node) {}, + // returns { row, col } for element + sort: undefined, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + + }; + + function GridLayout(options) { + this.options = extend({}, defaults$3, options); + } + + GridLayout.prototype.run = function () { + var params = this.options; + var options = params; + var cy = params.cy; + var eles = options.eles; + var nodes = eles.nodes().not(':parent'); + + if (options.sort) { + nodes = nodes.sort(options.sort); + } + + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + + if (bb.h === 0 || bb.w === 0) { + eles.nodes().layoutPositions(this, options, function (ele) { + return { + x: bb.x1, + y: bb.y1 + }; + }); + } else { + // width/height * splits^2 = cells where splits is number of times to split width + var cells = nodes.size(); + var splits = Math.sqrt(cells * bb.h / bb.w); + var rows = Math.round(splits); + var cols = Math.round(bb.w / bb.h * splits); + + var small = function small(val) { + if (val == null) { + return Math.min(rows, cols); + } else { + var min = Math.min(rows, cols); + + if (min == rows) { + rows = val; + } else { + cols = val; + } + } + }; + + var large = function large(val) { + if (val == null) { + return Math.max(rows, cols); + } else { + var max = Math.max(rows, cols); + + if (max == rows) { + rows = val; + } else { + cols = val; + } + } + }; + + var oRows = options.rows; + var oCols = options.cols != null ? options.cols : options.columns; // if rows or columns were set in options, use those values + + if (oRows != null && oCols != null) { + rows = oRows; + cols = oCols; + } else if (oRows != null && oCols == null) { + rows = oRows; + cols = Math.ceil(cells / rows); + } else if (oRows == null && oCols != null) { + cols = oCols; + rows = Math.ceil(cells / cols); + } // otherwise use the automatic values and adjust accordingly + // if rounding was up, see if we can reduce rows or columns + else if (cols * rows > cells) { + var sm = small(); + var lg = large(); // reducing the small side takes away the most cells, so try it first + + if ((sm - 1) * lg >= cells) { + small(sm - 1); + } else if ((lg - 1) * sm >= cells) { + large(lg - 1); + } + } else { + // if rounding was too low, add rows or columns + while (cols * rows < cells) { + var _sm = small(); + + var _lg = large(); // try to add to larger side first (adds less in multiplication) + + + if ((_lg + 1) * _sm >= cells) { + large(_lg + 1); + } else { + small(_sm + 1); + } + } + } + + var cellWidth = bb.w / cols; + var cellHeight = bb.h / rows; + + if (options.condense) { + cellWidth = 0; + cellHeight = 0; + } + + if (options.avoidOverlap) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var pos = node._private.position; + + if (pos.x == null || pos.y == null) { + // for bb + pos.x = 0; + pos.y = 0; + } + + var nbb = node.layoutDimensions(options); + var p = options.avoidOverlapPadding; + var w = nbb.w + p; + var h = nbb.h + p; + cellWidth = Math.max(cellWidth, w); + cellHeight = Math.max(cellHeight, h); + } + } + + var cellUsed = {}; // e.g. 'c-0-2' => true + + var used = function used(row, col) { + return cellUsed['c-' + row + '-' + col] ? true : false; + }; + + var use = function use(row, col) { + cellUsed['c-' + row + '-' + col] = true; + }; // to keep track of current cell position + + + var row = 0; + var col = 0; + + var moveToNextCell = function moveToNextCell() { + col++; + + if (col >= cols) { + col = 0; + row++; + } + }; // get a cache of all the manual positions + + + var id2manPos = {}; + + for (var _i = 0; _i < nodes.length; _i++) { + var _node = nodes[_i]; + var rcPos = options.position(_node); + + if (rcPos && (rcPos.row !== undefined || rcPos.col !== undefined)) { + // must have at least row or col def'd + var _pos = { + row: rcPos.row, + col: rcPos.col + }; + + if (_pos.col === undefined) { + // find unused col + _pos.col = 0; + + while (used(_pos.row, _pos.col)) { + _pos.col++; + } + } else if (_pos.row === undefined) { + // find unused row + _pos.row = 0; + + while (used(_pos.row, _pos.col)) { + _pos.row++; + } + } + + id2manPos[_node.id()] = _pos; + use(_pos.row, _pos.col); + } + } + + var getPos = function getPos(element, i) { + var x, y; + + if (element.locked() || element.isParent()) { + return false; + } // see if we have a manual position set + + + var rcPos = id2manPos[element.id()]; + + if (rcPos) { + x = rcPos.col * cellWidth + cellWidth / 2 + bb.x1; + y = rcPos.row * cellHeight + cellHeight / 2 + bb.y1; + } else { + // otherwise set automatically + while (used(row, col)) { + moveToNextCell(); + } + + x = col * cellWidth + cellWidth / 2 + bb.x1; + y = row * cellHeight + cellHeight / 2 + bb.y1; + use(row, col); + moveToNextCell(); + } + + return { + x: x, + y: y + }; + }; + + nodes.layoutPositions(this, options, getPos); + } + + return this; // chaining + }; + + var defaults$2 = { + ready: function ready() {}, + // on layoutready + stop: function stop() {} // on layoutstop + + }; // constructor + // options : object containing layout options + + function NullLayout(options) { + this.options = extend({}, defaults$2, options); + } // runs the layout + + + NullLayout.prototype.run = function () { + var options = this.options; + var eles = options.eles; // elements to consider in the layout + + var layout = this; // cy is automatically populated for us in the constructor + // (disable eslint for next line as this serves as example layout code to external developers) + // eslint-disable-next-line no-unused-vars + + options.cy; + layout.emit('layoutstart'); // puts all nodes at (0, 0) + // n.b. most layouts would use layoutPositions(), instead of positions() and manual events + + eles.nodes().positions(function () { + return { + x: 0, + y: 0 + }; + }); // trigger layoutready when each node has had its position set at least once + + layout.one('layoutready', options.ready); + layout.emit('layoutready'); // trigger layoutstop when the layout stops (e.g. finishes) + + layout.one('layoutstop', options.stop); + layout.emit('layoutstop'); + return this; // chaining + }; // called on continuous layouts to stop them before they finish + + + NullLayout.prototype.stop = function () { + return this; // chaining + }; + + var defaults$1 = { + positions: undefined, + // map of (node id) => (position obj); or function(node){ return somPos; } + zoom: undefined, + // the zoom level to set (prob want fit = false if set) + pan: undefined, + // the pan level to set (prob want fit = false if set) + fit: true, + // whether to fit to viewport + padding: 30, + // padding on fit + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + + }; + + function PresetLayout(options) { + this.options = extend({}, defaults$1, options); + } + + PresetLayout.prototype.run = function () { + var options = this.options; + var eles = options.eles; + var nodes = eles.nodes(); + var posIsFn = fn$6(options.positions); + + function getPosition(node) { + if (options.positions == null) { + return copyPosition(node.position()); + } + + if (posIsFn) { + return options.positions(node); + } + + var pos = options.positions[node._private.data.id]; + + if (pos == null) { + return null; + } + + return pos; + } + + nodes.layoutPositions(this, options, function (node, i) { + var position = getPosition(node); + + if (node.locked() || position == null) { + return false; + } + + return position; + }); + return this; // chaining + }; + + var defaults = { + fit: true, + // whether to fit to viewport + padding: 30, + // fit padding + boundingBox: undefined, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: undefined, + // easing of animation if enabled + animateFilter: function animateFilter(node, i) { + return true; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: undefined, + // callback on layoutready + stop: undefined, + // callback on layoutstop + transform: function transform(node, position) { + return position; + } // transform a given node position. Useful for changing flow direction in discrete layouts + + }; + + function RandomLayout(options) { + this.options = extend({}, defaults, options); + } + + RandomLayout.prototype.run = function () { + var options = this.options; + var cy = options.cy; + var eles = options.eles; + var bb = makeBoundingBox(options.boundingBox ? options.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + + var getPos = function getPos(node, i) { + return { + x: bb.x1 + Math.round(Math.random() * bb.w), + y: bb.y1 + Math.round(Math.random() * bb.h) + }; + }; + + eles.nodes().layoutPositions(this, options, getPos); + return this; // chaining + }; + + var layout = [{ + name: 'breadthfirst', + impl: BreadthFirstLayout + }, { + name: 'circle', + impl: CircleLayout + }, { + name: 'concentric', + impl: ConcentricLayout + }, { + name: 'cose', + impl: CoseLayout + }, { + name: 'grid', + impl: GridLayout + }, { + name: 'null', + impl: NullLayout + }, { + name: 'preset', + impl: PresetLayout + }, { + name: 'random', + impl: RandomLayout + }]; + + function NullRenderer(options) { + this.options = options; + this.notifications = 0; // for testing + } + + var noop = function noop() {}; + + var throwImgErr = function throwImgErr() { + throw new Error('A headless instance can not render images'); + }; + + NullRenderer.prototype = { + recalculateRenderedStyle: noop, + notify: function notify() { + this.notifications++; + }, + init: noop, + isHeadless: function isHeadless() { + return true; + }, + png: throwImgErr, + jpg: throwImgErr + }; + + var BRp$f = {}; + BRp$f.arrowShapeWidth = 0.3; + + BRp$f.registerArrowShapes = function () { + var arrowShapes = this.arrowShapes = {}; + var renderer = this; // Contract for arrow shapes: + // 0, 0 is arrow tip + // (0, 1) is direction towards node + // (1, 0) is right + // + // functional api: + // collide: check x, y in shape + // roughCollide: called before collide, no false negatives + // draw: draw + // spacing: dist(arrowTip, nodeBoundary) + // gap: dist(edgeTip, nodeBoundary), edgeTip may != arrowTip + + var bbCollide = function bbCollide(x, y, size, angle, translation, edgeWidth, padding) { + var x1 = translation.x - size / 2 - padding; + var x2 = translation.x + size / 2 + padding; + var y1 = translation.y - size / 2 - padding; + var y2 = translation.y + size / 2 + padding; + var inside = x1 <= x && x <= x2 && y1 <= y && y <= y2; + return inside; + }; + + var transform = function transform(x, y, size, angle, translation) { + var xRotated = x * Math.cos(angle) - y * Math.sin(angle); + var yRotated = x * Math.sin(angle) + y * Math.cos(angle); + var xScaled = xRotated * size; + var yScaled = yRotated * size; + var xTranslated = xScaled + translation.x; + var yTranslated = yScaled + translation.y; + return { + x: xTranslated, + y: yTranslated + }; + }; + + var transformPoints = function transformPoints(pts, size, angle, translation) { + var retPts = []; + + for (var i = 0; i < pts.length; i += 2) { + var x = pts[i]; + var y = pts[i + 1]; + retPts.push(transform(x, y, size, angle, translation)); + } + + return retPts; + }; + + var pointsToArr = function pointsToArr(pts) { + var ret = []; + + for (var i = 0; i < pts.length; i++) { + var p = pts[i]; + ret.push(p.x, p.y); + } + + return ret; + }; + + var standardGap = function standardGap(edge) { + return edge.pstyle('width').pfValue * edge.pstyle('arrow-scale').pfValue * 2; + }; + + var defineArrowShape = function defineArrowShape(name, defn) { + if (string(defn)) { + defn = arrowShapes[defn]; + } + + arrowShapes[name] = extend({ + name: name, + points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3], + collide: function collide(x, y, size, angle, translation, padding) { + var points = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + var inside = pointInsidePolygonPoints(x, y, points); + return inside; + }, + roughCollide: bbCollide, + draw: function draw(context, size, angle, translation) { + var points = transformPoints(this.points, size, angle, translation); + renderer.arrowShapeImpl('polygon')(context, points); + }, + spacing: function spacing(edge) { + return 0; + }, + gap: standardGap + }, defn); + }; + + defineArrowShape('none', { + collide: falsify, + roughCollide: falsify, + draw: noop$1, + spacing: zeroify, + gap: zeroify + }); + defineArrowShape('triangle', { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3] + }); + defineArrowShape('arrow', 'triangle'); + defineArrowShape('triangle-backcurve', { + points: arrowShapes['triangle'].points, + controlPoint: [0, -0.15], + roughCollide: bbCollide, + draw: function draw(context, size, angle, translation, edgeWidth) { + var ptsTrans = transformPoints(this.points, size, angle, translation); + var ctrlPt = this.controlPoint; + var ctrlPtTrans = transform(ctrlPt[0], ctrlPt[1], size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, ptsTrans, ctrlPtTrans); + }, + gap: function gap(edge) { + return standardGap(edge) * 0.8; + } + }); + defineArrowShape('triangle-tee', { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4], + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + var teePts = pointsToArr(transformPoints(this.pointsTee, size + 2 * padding, angle, translation)); + var inside = pointInsidePolygonPoints(x, y, triPts) || pointInsidePolygonPoints(x, y, teePts); + return inside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + var triPts = transformPoints(this.points, size, angle, translation); + var teePts = transformPoints(this.pointsTee, size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, triPts, teePts); + } + }); + defineArrowShape('circle-triangle', { + radius: 0.15, + pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15], + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var t = translation; + var circleInside = Math.pow(t.x - x, 2) + Math.pow(t.y - y, 2) <= Math.pow((size + 2 * padding) * this.radius, 2); + var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + return pointInsidePolygonPoints(x, y, triPts) || circleInside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + var triPts = transformPoints(this.pointsTr, size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, triPts, translation.x, translation.y, this.radius * size); + }, + spacing: function spacing(edge) { + return renderer.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.radius; + } + }); + defineArrowShape('triangle-cross', { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + baseCrossLinePts: [-0.15, -0.4, // first half of the rectangle + -0.15, -0.4, 0.15, -0.4, // second half of the rectangle + 0.15, -0.4], + crossLinePts: function crossLinePts(size, edgeWidth) { + // shift points so that the distance between the cross points matches edge width + var p = this.baseCrossLinePts.slice(); + var shiftFactor = edgeWidth / size; + var y0 = 3; + var y1 = 5; + p[y0] = p[y0] - shiftFactor; + p[y1] = p[y1] - shiftFactor; + return p; + }, + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var triPts = pointsToArr(transformPoints(this.points, size + 2 * padding, angle, translation)); + var teePts = pointsToArr(transformPoints(this.crossLinePts(size, edgeWidth), size + 2 * padding, angle, translation)); + var inside = pointInsidePolygonPoints(x, y, triPts) || pointInsidePolygonPoints(x, y, teePts); + return inside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + var triPts = transformPoints(this.points, size, angle, translation); + var crossLinePts = transformPoints(this.crossLinePts(size, edgeWidth), size, angle, translation); + renderer.arrowShapeImpl(this.name)(context, triPts, crossLinePts); + } + }); + defineArrowShape('vee', { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15], + gap: function gap(edge) { + return standardGap(edge) * 0.525; + } + }); + defineArrowShape('circle', { + radius: 0.15, + collide: function collide(x, y, size, angle, translation, edgeWidth, padding) { + var t = translation; + var inside = Math.pow(t.x - x, 2) + Math.pow(t.y - y, 2) <= Math.pow((size + 2 * padding) * this.radius, 2); + return inside; + }, + draw: function draw(context, size, angle, translation, edgeWidth) { + renderer.arrowShapeImpl(this.name)(context, translation.x, translation.y, this.radius * size); + }, + spacing: function spacing(edge) { + return renderer.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.radius; + } + }); + defineArrowShape('tee', { + points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0], + spacing: function spacing(edge) { + return 1; + }, + gap: function gap(edge) { + return 1; + } + }); + defineArrowShape('square', { + points: [-0.15, 0.00, 0.15, 0.00, 0.15, -0.3, -0.15, -0.3] + }); + defineArrowShape('diamond', { + points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0], + gap: function gap(edge) { + return edge.pstyle('width').pfValue * edge.pstyle('arrow-scale').value; + } + }); + defineArrowShape('chevron', { + points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15], + gap: function gap(edge) { + return 0.95 * edge.pstyle('width').pfValue * edge.pstyle('arrow-scale').value; + } + }); + }; + + var BRp$e = {}; // Project mouse + + BRp$e.projectIntoViewport = function (clientX, clientY) { + var cy = this.cy; + var offsets = this.findContainerClientCoords(); + var offsetLeft = offsets[0]; + var offsetTop = offsets[1]; + var scale = offsets[4]; + var pan = cy.pan(); + var zoom = cy.zoom(); + var x = ((clientX - offsetLeft) / scale - pan.x) / zoom; + var y = ((clientY - offsetTop) / scale - pan.y) / zoom; + return [x, y]; + }; + + BRp$e.findContainerClientCoords = function () { + if (this.containerBB) { + return this.containerBB; + } + + var container = this.container; + var rect = container.getBoundingClientRect(); + var style = window$1.getComputedStyle(container); + + var styleValue = function styleValue(name) { + return parseFloat(style.getPropertyValue(name)); + }; + + var padding = { + left: styleValue('padding-left'), + right: styleValue('padding-right'), + top: styleValue('padding-top'), + bottom: styleValue('padding-bottom') + }; + var border = { + left: styleValue('border-left-width'), + right: styleValue('border-right-width'), + top: styleValue('border-top-width'), + bottom: styleValue('border-bottom-width') + }; + var clientWidth = container.clientWidth; + var clientHeight = container.clientHeight; + var paddingHor = padding.left + padding.right; + var paddingVer = padding.top + padding.bottom; + var borderHor = border.left + border.right; + var scale = rect.width / (clientWidth + borderHor); + var unscaledW = clientWidth - paddingHor; + var unscaledH = clientHeight - paddingVer; + var left = rect.left + padding.left + border.left; + var top = rect.top + padding.top + border.top; + return this.containerBB = [left, top, unscaledW, unscaledH, scale]; + }; + + BRp$e.invalidateContainerClientCoordsCache = function () { + this.containerBB = null; + }; + + BRp$e.findNearestElement = function (x, y, interactiveElementsOnly, isTouch) { + return this.findNearestElements(x, y, interactiveElementsOnly, isTouch)[0]; + }; + + BRp$e.findNearestElements = function (x, y, interactiveElementsOnly, isTouch) { + var self = this; + var r = this; + var eles = r.getCachedZSortedEles(); + var near = []; // 1 node max, 1 edge max + + var zoom = r.cy.zoom(); + var hasCompounds = r.cy.hasCompoundNodes(); + var edgeThreshold = (isTouch ? 24 : 8) / zoom; + var nodeThreshold = (isTouch ? 8 : 2) / zoom; + var labelThreshold = (isTouch ? 8 : 2) / zoom; + var minSqDist = Infinity; + var nearEdge; + var nearNode; + + if (interactiveElementsOnly) { + eles = eles.interactive; + } + + function addEle(ele, sqDist) { + if (ele.isNode()) { + if (nearNode) { + return; // can't replace node + } else { + nearNode = ele; + near.push(ele); + } + } + + if (ele.isEdge() && (sqDist == null || sqDist < minSqDist)) { + if (nearEdge) { + // then replace existing edge + // can replace only if same z-index + if (nearEdge.pstyle('z-compound-depth').value === ele.pstyle('z-compound-depth').value && nearEdge.pstyle('z-compound-depth').value === ele.pstyle('z-compound-depth').value) { + for (var i = 0; i < near.length; i++) { + if (near[i].isEdge()) { + near[i] = ele; + nearEdge = ele; + minSqDist = sqDist != null ? sqDist : minSqDist; + break; + } + } + } + } else { + near.push(ele); + nearEdge = ele; + minSqDist = sqDist != null ? sqDist : minSqDist; + } + } + } + + function checkNode(node) { + var width = node.outerWidth() + 2 * nodeThreshold; + var height = node.outerHeight() + 2 * nodeThreshold; + var hw = width / 2; + var hh = height / 2; + var pos = node.position(); + + if (pos.x - hw <= x && x <= pos.x + hw // bb check x + && pos.y - hh <= y && y <= pos.y + hh // bb check y + ) { + var shape = r.nodeShapes[self.getNodeShape(node)]; + + if (shape.checkPoint(x, y, 0, width, height, pos.x, pos.y)) { + addEle(node, 0); + return true; + } + } + } + + function checkEdge(edge) { + var _p = edge._private; + var rs = _p.rscratch; + var styleWidth = edge.pstyle('width').pfValue; + var scale = edge.pstyle('arrow-scale').value; + var width = styleWidth / 2 + edgeThreshold; // more like a distance radius from centre + + var widthSq = width * width; + var width2 = width * 2; + var src = _p.source; + var tgt = _p.target; + var sqDist; + + if (rs.edgeType === 'segments' || rs.edgeType === 'straight' || rs.edgeType === 'haystack') { + var pts = rs.allpts; + + for (var i = 0; i + 3 < pts.length; i += 2) { + if (inLineVicinity(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3], width2) && widthSq > (sqDist = sqdistToFiniteLine(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3]))) { + addEle(edge, sqDist); + return true; + } + } + } else if (rs.edgeType === 'bezier' || rs.edgeType === 'multibezier' || rs.edgeType === 'self' || rs.edgeType === 'compound') { + var pts = rs.allpts; + + for (var i = 0; i + 5 < rs.allpts.length; i += 4) { + if (inBezierVicinity(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3], pts[i + 4], pts[i + 5], width2) && widthSq > (sqDist = sqdistToQuadraticBezier(x, y, pts[i], pts[i + 1], pts[i + 2], pts[i + 3], pts[i + 4], pts[i + 5]))) { + addEle(edge, sqDist); + return true; + } + } + } // if we're close to the edge but didn't hit it, maybe we hit its arrows + + + var src = src || _p.source; + var tgt = tgt || _p.target; + var arSize = self.getArrowWidth(styleWidth, scale); + var arrows = [{ + name: 'source', + x: rs.arrowStartX, + y: rs.arrowStartY, + angle: rs.srcArrowAngle + }, { + name: 'target', + x: rs.arrowEndX, + y: rs.arrowEndY, + angle: rs.tgtArrowAngle + }, { + name: 'mid-source', + x: rs.midX, + y: rs.midY, + angle: rs.midsrcArrowAngle + }, { + name: 'mid-target', + x: rs.midX, + y: rs.midY, + angle: rs.midtgtArrowAngle + }]; + + for (var i = 0; i < arrows.length; i++) { + var ar = arrows[i]; + var shape = r.arrowShapes[edge.pstyle(ar.name + '-arrow-shape').value]; + var edgeWidth = edge.pstyle('width').pfValue; + + if (shape.roughCollide(x, y, arSize, ar.angle, { + x: ar.x, + y: ar.y + }, edgeWidth, edgeThreshold) && shape.collide(x, y, arSize, ar.angle, { + x: ar.x, + y: ar.y + }, edgeWidth, edgeThreshold)) { + addEle(edge); + return true; + } + } // for compound graphs, hitting edge may actually want a connected node instead (b/c edge may have greater z-index precedence) + + + if (hasCompounds && near.length > 0) { + checkNode(src); + checkNode(tgt); + } + } + + function preprop(obj, name, pre) { + return getPrefixedProperty(obj, name, pre); + } + + function checkLabel(ele, prefix) { + var _p = ele._private; + var th = labelThreshold; + var prefixDash; + + if (prefix) { + prefixDash = prefix + '-'; + } else { + prefixDash = ''; + } + + ele.boundingBox(); + var bb = _p.labelBounds[prefix || 'main']; + var text = ele.pstyle(prefixDash + 'label').value; + var eventsEnabled = ele.pstyle('text-events').strValue === 'yes'; + + if (!eventsEnabled || !text) { + return; + } + + var lx = preprop(_p.rscratch, 'labelX', prefix); + var ly = preprop(_p.rscratch, 'labelY', prefix); + var theta = preprop(_p.rscratch, 'labelAngle', prefix); + var ox = ele.pstyle(prefixDash + 'text-margin-x').pfValue; + var oy = ele.pstyle(prefixDash + 'text-margin-y').pfValue; + var lx1 = bb.x1 - th - ox; // (-ox, -oy) as bb already includes margin + + var lx2 = bb.x2 + th - ox; // and rotation is about (lx, ly) + + var ly1 = bb.y1 - th - oy; + var ly2 = bb.y2 + th - oy; + + if (theta) { + var cos = Math.cos(theta); + var sin = Math.sin(theta); + + var rotate = function rotate(x, y) { + x = x - lx; + y = y - ly; + return { + x: x * cos - y * sin + lx, + y: x * sin + y * cos + ly + }; + }; + + var px1y1 = rotate(lx1, ly1); + var px1y2 = rotate(lx1, ly2); + var px2y1 = rotate(lx2, ly1); + var px2y2 = rotate(lx2, ly2); + var points = [// with the margin added after the rotation is applied + px1y1.x + ox, px1y1.y + oy, px2y1.x + ox, px2y1.y + oy, px2y2.x + ox, px2y2.y + oy, px1y2.x + ox, px1y2.y + oy]; + + if (pointInsidePolygonPoints(x, y, points)) { + addEle(ele); + return true; + } + } else { + // do a cheaper bb check + if (inBoundingBox(bb, x, y)) { + addEle(ele); + return true; + } + } + } + + for (var i = eles.length - 1; i >= 0; i--) { + // reverse order for precedence + var ele = eles[i]; + + if (ele.isNode()) { + checkNode(ele) || checkLabel(ele); + } else { + // then edge + checkEdge(ele) || checkLabel(ele) || checkLabel(ele, 'source') || checkLabel(ele, 'target'); + } + } + + return near; + }; // 'Give me everything from this box' + + + BRp$e.getAllInBox = function (x1, y1, x2, y2) { + var eles = this.getCachedZSortedEles().interactive; + var box = []; + var x1c = Math.min(x1, x2); + var x2c = Math.max(x1, x2); + var y1c = Math.min(y1, y2); + var y2c = Math.max(y1, y2); + x1 = x1c; + x2 = x2c; + y1 = y1c; + y2 = y2c; + var boxBb = makeBoundingBox({ + x1: x1, + y1: y1, + x2: x2, + y2: y2 + }); + + for (var e = 0; e < eles.length; e++) { + var ele = eles[e]; + + if (ele.isNode()) { + var node = ele; + var nodeBb = node.boundingBox({ + includeNodes: true, + includeEdges: false, + includeLabels: false + }); + + if (boundingBoxesIntersect(boxBb, nodeBb) && !boundingBoxInBoundingBox(nodeBb, boxBb)) { + box.push(node); + } + } else { + var edge = ele; + var _p = edge._private; + var rs = _p.rscratch; + + if (rs.startX != null && rs.startY != null && !inBoundingBox(boxBb, rs.startX, rs.startY)) { + continue; + } + + if (rs.endX != null && rs.endY != null && !inBoundingBox(boxBb, rs.endX, rs.endY)) { + continue; + } + + if (rs.edgeType === 'bezier' || rs.edgeType === 'multibezier' || rs.edgeType === 'self' || rs.edgeType === 'compound' || rs.edgeType === 'segments' || rs.edgeType === 'haystack') { + var pts = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts; + var allInside = true; + + for (var i = 0; i < pts.length; i++) { + if (!pointInBoundingBox(boxBb, pts[i])) { + allInside = false; + break; + } + } + + if (allInside) { + box.push(edge); + } + } else if (rs.edgeType === 'haystack' || rs.edgeType === 'straight') { + box.push(edge); + } + } + } + + return box; + }; + + var BRp$d = {}; + + BRp$d.calculateArrowAngles = function (edge) { + var rs = edge._private.rscratch; + var isHaystack = rs.edgeType === 'haystack'; + var isBezier = rs.edgeType === 'bezier'; + var isMultibezier = rs.edgeType === 'multibezier'; + var isSegments = rs.edgeType === 'segments'; + var isCompound = rs.edgeType === 'compound'; + var isSelf = rs.edgeType === 'self'; // Displacement gives direction for arrowhead orientation + + var dispX, dispY; + var startX, startY, endX, endY, midX, midY; + + if (isHaystack) { + startX = rs.haystackPts[0]; + startY = rs.haystackPts[1]; + endX = rs.haystackPts[2]; + endY = rs.haystackPts[3]; + } else { + startX = rs.arrowStartX; + startY = rs.arrowStartY; + endX = rs.arrowEndX; + endY = rs.arrowEndY; + } + + midX = rs.midX; + midY = rs.midY; // source + // + + if (isSegments) { + dispX = startX - rs.segpts[0]; + dispY = startY - rs.segpts[1]; + } else if (isMultibezier || isCompound || isSelf || isBezier) { + var pts = rs.allpts; + var bX = qbezierAt(pts[0], pts[2], pts[4], 0.1); + var bY = qbezierAt(pts[1], pts[3], pts[5], 0.1); + dispX = startX - bX; + dispY = startY - bY; + } else { + dispX = startX - midX; + dispY = startY - midY; + } + + rs.srcArrowAngle = getAngleFromDisp(dispX, dispY); // mid target + // + + var midX = rs.midX; + var midY = rs.midY; + + if (isHaystack) { + midX = (startX + endX) / 2; + midY = (startY + endY) / 2; + } + + dispX = endX - startX; + dispY = endY - startY; + + if (isSegments) { + var pts = rs.allpts; + + if (pts.length / 2 % 2 === 0) { + var i2 = pts.length / 2; + var i1 = i2 - 2; + dispX = pts[i2] - pts[i1]; + dispY = pts[i2 + 1] - pts[i1 + 1]; + } else { + var i2 = pts.length / 2 - 1; + var i1 = i2 - 2; + var i3 = i2 + 2; + dispX = pts[i2] - pts[i1]; + dispY = pts[i2 + 1] - pts[i1 + 1]; + } + } else if (isMultibezier || isCompound || isSelf) { + var pts = rs.allpts; + var cpts = rs.ctrlpts; + var bp0x, bp0y; + var bp1x, bp1y; + + if (cpts.length / 2 % 2 === 0) { + var p0 = pts.length / 2 - 1; // startpt + + var ic = p0 + 2; + var p1 = ic + 2; + bp0x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.0); + bp0y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.0); + bp1x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.0001); + bp1y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.0001); + } else { + var ic = pts.length / 2 - 1; // ctrpt + + var p0 = ic - 2; // startpt + + var p1 = ic + 2; // endpt + + bp0x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.4999); + bp0y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.4999); + bp1x = qbezierAt(pts[p0], pts[ic], pts[p1], 0.5); + bp1y = qbezierAt(pts[p0 + 1], pts[ic + 1], pts[p1 + 1], 0.5); + } + + dispX = bp1x - bp0x; + dispY = bp1y - bp0y; + } + + rs.midtgtArrowAngle = getAngleFromDisp(dispX, dispY); + rs.midDispX = dispX; + rs.midDispY = dispY; // mid source + // + + dispX *= -1; + dispY *= -1; + + if (isSegments) { + var pts = rs.allpts; + + if (pts.length / 2 % 2 === 0) ; else { + var i2 = pts.length / 2 - 1; + var i3 = i2 + 2; + dispX = -(pts[i3] - pts[i2]); + dispY = -(pts[i3 + 1] - pts[i2 + 1]); + } + } + + rs.midsrcArrowAngle = getAngleFromDisp(dispX, dispY); // target + // + + if (isSegments) { + dispX = endX - rs.segpts[rs.segpts.length - 2]; + dispY = endY - rs.segpts[rs.segpts.length - 1]; + } else if (isMultibezier || isCompound || isSelf || isBezier) { + var pts = rs.allpts; + var l = pts.length; + var bX = qbezierAt(pts[l - 6], pts[l - 4], pts[l - 2], 0.9); + var bY = qbezierAt(pts[l - 5], pts[l - 3], pts[l - 1], 0.9); + dispX = endX - bX; + dispY = endY - bY; + } else { + dispX = endX - midX; + dispY = endY - midY; + } + + rs.tgtArrowAngle = getAngleFromDisp(dispX, dispY); + }; + + BRp$d.getArrowWidth = BRp$d.getArrowHeight = function (edgeWidth, scale) { + var cache = this.arrowWidthCache = this.arrowWidthCache || {}; + var cachedVal = cache[edgeWidth + ', ' + scale]; + + if (cachedVal) { + return cachedVal; + } + + cachedVal = Math.max(Math.pow(edgeWidth * 13.37, 0.9), 29) * scale; + cache[edgeWidth + ', ' + scale] = cachedVal; + return cachedVal; + }; + + var BRp$c = {}; + + BRp$c.findHaystackPoints = function (edges) { + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var _p = edge._private; + var rs = _p.rscratch; + + if (!rs.haystack) { + var angle = Math.random() * 2 * Math.PI; + rs.source = { + x: Math.cos(angle), + y: Math.sin(angle) + }; + angle = Math.random() * 2 * Math.PI; + rs.target = { + x: Math.cos(angle), + y: Math.sin(angle) + }; + } + + var src = _p.source; + var tgt = _p.target; + var srcPos = src.position(); + var tgtPos = tgt.position(); + var srcW = src.width(); + var tgtW = tgt.width(); + var srcH = src.height(); + var tgtH = tgt.height(); + var radius = edge.pstyle('haystack-radius').value; + var halfRadius = radius / 2; // b/c have to half width/height + + rs.haystackPts = rs.allpts = [rs.source.x * srcW * halfRadius + srcPos.x, rs.source.y * srcH * halfRadius + srcPos.y, rs.target.x * tgtW * halfRadius + tgtPos.x, rs.target.y * tgtH * halfRadius + tgtPos.y]; + rs.midX = (rs.allpts[0] + rs.allpts[2]) / 2; + rs.midY = (rs.allpts[1] + rs.allpts[3]) / 2; // always override as haystack in case set to different type previously + + rs.edgeType = 'haystack'; + rs.haystack = true; + this.storeEdgeProjections(edge); + this.calculateArrowAngles(edge); + this.recalculateEdgeLabelProjections(edge); + this.calculateLabelAngles(edge); + } + }; + + BRp$c.findSegmentsPoints = function (edge, pairInfo) { + // Segments (multiple straight lines) + var rs = edge._private.rscratch; + var posPts = pairInfo.posPts, + intersectionPts = pairInfo.intersectionPts, + vectorNormInverse = pairInfo.vectorNormInverse; + var edgeDistances = edge.pstyle('edge-distances').value; + var segmentWs = edge.pstyle('segment-weights'); + var segmentDs = edge.pstyle('segment-distances'); + var segmentsN = Math.min(segmentWs.pfValue.length, segmentDs.pfValue.length); + rs.edgeType = 'segments'; + rs.segpts = []; + + for (var s = 0; s < segmentsN; s++) { + var w = segmentWs.pfValue[s]; + var d = segmentDs.pfValue[s]; + var w1 = 1 - w; + var w2 = w; + var midptPts = edgeDistances === 'node-position' ? posPts : intersectionPts; + var adjustedMidpt = { + x: midptPts.x1 * w1 + midptPts.x2 * w2, + y: midptPts.y1 * w1 + midptPts.y2 * w2 + }; + rs.segpts.push(adjustedMidpt.x + vectorNormInverse.x * d, adjustedMidpt.y + vectorNormInverse.y * d); + } + }; + + BRp$c.findLoopPoints = function (edge, pairInfo, i, edgeIsUnbundled) { + // Self-edge + var rs = edge._private.rscratch; + var dirCounts = pairInfo.dirCounts, + srcPos = pairInfo.srcPos; + var ctrlptDists = edge.pstyle('control-point-distances'); + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : undefined; + var loopDir = edge.pstyle('loop-direction').pfValue; + var loopSwp = edge.pstyle('loop-sweep').pfValue; + var stepSize = edge.pstyle('control-point-step-size').pfValue; + rs.edgeType = 'self'; + var j = i; + var loopDist = stepSize; + + if (edgeIsUnbundled) { + j = 0; + loopDist = ctrlptDist; + } + + var loopAngle = loopDir - Math.PI / 2; + var outAngle = loopAngle - loopSwp / 2; + var inAngle = loopAngle + loopSwp / 2; // increase by step size for overlapping loops, keyed on direction and sweep values + + var dc = String(loopDir + '_' + loopSwp); + j = dirCounts[dc] === undefined ? dirCounts[dc] = 0 : ++dirCounts[dc]; + rs.ctrlpts = [srcPos.x + Math.cos(outAngle) * 1.4 * loopDist * (j / 3 + 1), srcPos.y + Math.sin(outAngle) * 1.4 * loopDist * (j / 3 + 1), srcPos.x + Math.cos(inAngle) * 1.4 * loopDist * (j / 3 + 1), srcPos.y + Math.sin(inAngle) * 1.4 * loopDist * (j / 3 + 1)]; + }; + + BRp$c.findCompoundLoopPoints = function (edge, pairInfo, i, edgeIsUnbundled) { + // Compound edge + var rs = edge._private.rscratch; + rs.edgeType = 'compound'; + var srcPos = pairInfo.srcPos, + tgtPos = pairInfo.tgtPos, + srcW = pairInfo.srcW, + srcH = pairInfo.srcH, + tgtW = pairInfo.tgtW, + tgtH = pairInfo.tgtH; + var stepSize = edge.pstyle('control-point-step-size').pfValue; + var ctrlptDists = edge.pstyle('control-point-distances'); + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : undefined; + var j = i; + var loopDist = stepSize; + + if (edgeIsUnbundled) { + j = 0; + loopDist = ctrlptDist; + } + + var loopW = 50; + var loopaPos = { + x: srcPos.x - srcW / 2, + y: srcPos.y - srcH / 2 + }; + var loopbPos = { + x: tgtPos.x - tgtW / 2, + y: tgtPos.y - tgtH / 2 + }; + var loopPos = { + x: Math.min(loopaPos.x, loopbPos.x), + y: Math.min(loopaPos.y, loopbPos.y) + }; // avoids cases with impossible beziers + + var minCompoundStretch = 0.5; + var compoundStretchA = Math.max(minCompoundStretch, Math.log(srcW * 0.01)); + var compoundStretchB = Math.max(minCompoundStretch, Math.log(tgtW * 0.01)); + rs.ctrlpts = [loopPos.x, loopPos.y - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j / 3 + 1) * compoundStretchA, loopPos.x - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j / 3 + 1) * compoundStretchB, loopPos.y]; + }; + + BRp$c.findStraightEdgePoints = function (edge) { + // Straight edge within bundle + edge._private.rscratch.edgeType = 'straight'; + }; + + BRp$c.findBezierPoints = function (edge, pairInfo, i, edgeIsUnbundled, edgeIsSwapped) { + var rs = edge._private.rscratch; + var vectorNormInverse = pairInfo.vectorNormInverse, + posPts = pairInfo.posPts, + intersectionPts = pairInfo.intersectionPts; + var edgeDistances = edge.pstyle('edge-distances').value; + var stepSize = edge.pstyle('control-point-step-size').pfValue; + var ctrlptDists = edge.pstyle('control-point-distances'); + var ctrlptWs = edge.pstyle('control-point-weights'); + var bezierN = ctrlptDists && ctrlptWs ? Math.min(ctrlptDists.value.length, ctrlptWs.value.length) : 1; + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : undefined; + var ctrlptWeight = ctrlptWs.value[0]; // (Multi)bezier + + var multi = edgeIsUnbundled; + rs.edgeType = multi ? 'multibezier' : 'bezier'; + rs.ctrlpts = []; + + for (var b = 0; b < bezierN; b++) { + var normctrlptDist = (0.5 - pairInfo.eles.length / 2 + i) * stepSize * (edgeIsSwapped ? -1 : 1); + var manctrlptDist = void 0; + var sign = signum(normctrlptDist); + + if (multi) { + ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[b] : stepSize; // fall back on step size + + ctrlptWeight = ctrlptWs.value[b]; + } + + if (edgeIsUnbundled) { + // multi or single unbundled + manctrlptDist = ctrlptDist; + } else { + manctrlptDist = ctrlptDist !== undefined ? sign * ctrlptDist : undefined; + } + + var distanceFromMidpoint = manctrlptDist !== undefined ? manctrlptDist : normctrlptDist; + var w1 = 1 - ctrlptWeight; + var w2 = ctrlptWeight; + var midptPts = edgeDistances === 'node-position' ? posPts : intersectionPts; + var adjustedMidpt = { + x: midptPts.x1 * w1 + midptPts.x2 * w2, + y: midptPts.y1 * w1 + midptPts.y2 * w2 + }; + rs.ctrlpts.push(adjustedMidpt.x + vectorNormInverse.x * distanceFromMidpoint, adjustedMidpt.y + vectorNormInverse.y * distanceFromMidpoint); + } + }; + + BRp$c.findTaxiPoints = function (edge, pairInfo) { + // Taxicab geometry with two turns maximum + var rs = edge._private.rscratch; + rs.edgeType = 'segments'; + var VERTICAL = 'vertical'; + var HORIZONTAL = 'horizontal'; + var LEFTWARD = 'leftward'; + var RIGHTWARD = 'rightward'; + var DOWNWARD = 'downward'; + var UPWARD = 'upward'; + var AUTO = 'auto'; + var posPts = pairInfo.posPts, + srcW = pairInfo.srcW, + srcH = pairInfo.srcH, + tgtW = pairInfo.tgtW, + tgtH = pairInfo.tgtH; + var edgeDistances = edge.pstyle('edge-distances').value; + var dIncludesNodeBody = edgeDistances !== 'node-position'; + var taxiDir = edge.pstyle('taxi-direction').value; + var rawTaxiDir = taxiDir; // unprocessed value + + var taxiTurn = edge.pstyle('taxi-turn'); + var turnIsPercent = taxiTurn.units === '%'; + var taxiTurnPfVal = taxiTurn.pfValue; + var turnIsNegative = taxiTurnPfVal < 0; // i.e. from target side + + var minD = edge.pstyle('taxi-turn-min-distance').pfValue; + var dw = dIncludesNodeBody ? (srcW + tgtW) / 2 : 0; + var dh = dIncludesNodeBody ? (srcH + tgtH) / 2 : 0; + var pdx = posPts.x2 - posPts.x1; + var pdy = posPts.y2 - posPts.y1; // take away the effective w/h from the magnitude of the delta value + + var subDWH = function subDWH(dxy, dwh) { + if (dxy > 0) { + return Math.max(dxy - dwh, 0); + } else { + return Math.min(dxy + dwh, 0); + } + }; + + var dx = subDWH(pdx, dw); + var dy = subDWH(pdy, dh); + var isExplicitDir = false; + + if (rawTaxiDir === AUTO) { + taxiDir = Math.abs(dx) > Math.abs(dy) ? HORIZONTAL : VERTICAL; + } else if (rawTaxiDir === UPWARD || rawTaxiDir === DOWNWARD) { + taxiDir = VERTICAL; + isExplicitDir = true; + } else if (rawTaxiDir === LEFTWARD || rawTaxiDir === RIGHTWARD) { + taxiDir = HORIZONTAL; + isExplicitDir = true; + } + + var isVert = taxiDir === VERTICAL; + var l = isVert ? dy : dx; + var pl = isVert ? pdy : pdx; + var sgnL = signum(pl); + var forcedDir = false; + + if (!(isExplicitDir && (turnIsPercent || turnIsNegative)) // forcing in this case would cause weird growing in the opposite direction + && (rawTaxiDir === DOWNWARD && pl < 0 || rawTaxiDir === UPWARD && pl > 0 || rawTaxiDir === LEFTWARD && pl > 0 || rawTaxiDir === RIGHTWARD && pl < 0)) { + sgnL *= -1; + l = sgnL * Math.abs(l); + forcedDir = true; + } + + var d; + + if (turnIsPercent) { + var p = taxiTurnPfVal < 0 ? 1 + taxiTurnPfVal : taxiTurnPfVal; + d = p * l; + } else { + var k = taxiTurnPfVal < 0 ? l : 0; + d = k + taxiTurnPfVal * sgnL; + } + + var getIsTooClose = function getIsTooClose(d) { + return Math.abs(d) < minD || Math.abs(d) >= Math.abs(l); + }; + + var isTooCloseSrc = getIsTooClose(d); + var isTooCloseTgt = getIsTooClose(Math.abs(l) - Math.abs(d)); + var isTooClose = isTooCloseSrc || isTooCloseTgt; + + if (isTooClose && !forcedDir) { + // non-ideal routing + if (isVert) { + // vertical fallbacks + var lShapeInsideSrc = Math.abs(pl) <= srcH / 2; + var lShapeInsideTgt = Math.abs(pdx) <= tgtW / 2; + + if (lShapeInsideSrc) { + // horizontal Z-shape (direction not respected) + var x = (posPts.x1 + posPts.x2) / 2; + var y1 = posPts.y1, + y2 = posPts.y2; + rs.segpts = [x, y1, x, y2]; + } else if (lShapeInsideTgt) { + // vertical Z-shape (distance not respected) + var y = (posPts.y1 + posPts.y2) / 2; + var x1 = posPts.x1, + x2 = posPts.x2; + rs.segpts = [x1, y, x2, y]; + } else { + // L-shape fallback (turn distance not respected, but works well with tree siblings) + rs.segpts = [posPts.x1, posPts.y2]; + } + } else { + // horizontal fallbacks + var _lShapeInsideSrc = Math.abs(pl) <= srcW / 2; + + var _lShapeInsideTgt = Math.abs(pdy) <= tgtH / 2; + + if (_lShapeInsideSrc) { + // vertical Z-shape (direction not respected) + var _y = (posPts.y1 + posPts.y2) / 2; + + var _x = posPts.x1, + _x2 = posPts.x2; + rs.segpts = [_x, _y, _x2, _y]; + } else if (_lShapeInsideTgt) { + // horizontal Z-shape (turn distance not respected) + var _x3 = (posPts.x1 + posPts.x2) / 2; + + var _y2 = posPts.y1, + _y3 = posPts.y2; + rs.segpts = [_x3, _y2, _x3, _y3]; + } else { + // L-shape (turn distance not respected, but works well for tree siblings) + rs.segpts = [posPts.x2, posPts.y1]; + } + } + } else { + // ideal routing + if (isVert) { + var _y4 = posPts.y1 + d + (dIncludesNodeBody ? srcH / 2 * sgnL : 0); + + var _x4 = posPts.x1, + _x5 = posPts.x2; + rs.segpts = [_x4, _y4, _x5, _y4]; + } else { + // horizontal + var _x6 = posPts.x1 + d + (dIncludesNodeBody ? srcW / 2 * sgnL : 0); + + var _y5 = posPts.y1, + _y6 = posPts.y2; + rs.segpts = [_x6, _y5, _x6, _y6]; + } + } + }; + + BRp$c.tryToCorrectInvalidPoints = function (edge, pairInfo) { + var rs = edge._private.rscratch; // can only correct beziers for now... + + if (rs.edgeType === 'bezier') { + var srcPos = pairInfo.srcPos, + tgtPos = pairInfo.tgtPos, + srcW = pairInfo.srcW, + srcH = pairInfo.srcH, + tgtW = pairInfo.tgtW, + tgtH = pairInfo.tgtH, + srcShape = pairInfo.srcShape, + tgtShape = pairInfo.tgtShape; + var badStart = !number$1(rs.startX) || !number$1(rs.startY); + var badAStart = !number$1(rs.arrowStartX) || !number$1(rs.arrowStartY); + var badEnd = !number$1(rs.endX) || !number$1(rs.endY); + var badAEnd = !number$1(rs.arrowEndX) || !number$1(rs.arrowEndY); + var minCpADistFactor = 3; + var arrowW = this.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.arrowShapeWidth; + var minCpADist = minCpADistFactor * arrowW; + var startACpDist = dist({ + x: rs.ctrlpts[0], + y: rs.ctrlpts[1] + }, { + x: rs.startX, + y: rs.startY + }); + var closeStartACp = startACpDist < minCpADist; + var endACpDist = dist({ + x: rs.ctrlpts[0], + y: rs.ctrlpts[1] + }, { + x: rs.endX, + y: rs.endY + }); + var closeEndACp = endACpDist < minCpADist; + var overlapping = false; + + if (badStart || badAStart || closeStartACp) { + overlapping = true; // project control point along line from src centre to outside the src shape + // (otherwise intersection will yield nothing) + + var cpD = { + // delta + x: rs.ctrlpts[0] - srcPos.x, + y: rs.ctrlpts[1] - srcPos.y + }; + var cpL = Math.sqrt(cpD.x * cpD.x + cpD.y * cpD.y); // length of line + + var cpM = { + // normalised delta + x: cpD.x / cpL, + y: cpD.y / cpL + }; + var radius = Math.max(srcW, srcH); + var cpProj = { + // *2 radius guarantees outside shape + x: rs.ctrlpts[0] + cpM.x * 2 * radius, + y: rs.ctrlpts[1] + cpM.y * 2 * radius + }; + var srcCtrlPtIntn = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, cpProj.x, cpProj.y, 0); + + if (closeStartACp) { + rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (minCpADist - startACpDist); + rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (minCpADist - startACpDist); + } else { + rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpADist; + rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpADist; + } + } + + if (badEnd || badAEnd || closeEndACp) { + overlapping = true; // project control point along line from tgt centre to outside the tgt shape + // (otherwise intersection will yield nothing) + + var _cpD = { + // delta + x: rs.ctrlpts[0] - tgtPos.x, + y: rs.ctrlpts[1] - tgtPos.y + }; + + var _cpL = Math.sqrt(_cpD.x * _cpD.x + _cpD.y * _cpD.y); // length of line + + + var _cpM = { + // normalised delta + x: _cpD.x / _cpL, + y: _cpD.y / _cpL + }; + + var _radius = Math.max(srcW, srcH); + + var _cpProj = { + // *2 radius guarantees outside shape + x: rs.ctrlpts[0] + _cpM.x * 2 * _radius, + y: rs.ctrlpts[1] + _cpM.y * 2 * _radius + }; + var tgtCtrlPtIntn = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, _cpProj.x, _cpProj.y, 0); + + if (closeEndACp) { + rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (minCpADist - endACpDist); + rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (minCpADist - endACpDist); + } else { + rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpADist; + rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpADist; + } + } + + if (overlapping) { + // recalc endpts + this.findEndpoints(edge); + } + } + }; + + BRp$c.storeAllpts = function (edge) { + var rs = edge._private.rscratch; + + if (rs.edgeType === 'multibezier' || rs.edgeType === 'bezier' || rs.edgeType === 'self' || rs.edgeType === 'compound') { + rs.allpts = []; + rs.allpts.push(rs.startX, rs.startY); + + for (var b = 0; b + 1 < rs.ctrlpts.length; b += 2) { + // ctrl pt itself + rs.allpts.push(rs.ctrlpts[b], rs.ctrlpts[b + 1]); // the midpt between ctrlpts as intermediate destination pts + + if (b + 3 < rs.ctrlpts.length) { + rs.allpts.push((rs.ctrlpts[b] + rs.ctrlpts[b + 2]) / 2, (rs.ctrlpts[b + 1] + rs.ctrlpts[b + 3]) / 2); + } + } + + rs.allpts.push(rs.endX, rs.endY); + var m, mt; + + if (rs.ctrlpts.length / 2 % 2 === 0) { + m = rs.allpts.length / 2 - 1; + rs.midX = rs.allpts[m]; + rs.midY = rs.allpts[m + 1]; + } else { + m = rs.allpts.length / 2 - 3; + mt = 0.5; + rs.midX = qbezierAt(rs.allpts[m], rs.allpts[m + 2], rs.allpts[m + 4], mt); + rs.midY = qbezierAt(rs.allpts[m + 1], rs.allpts[m + 3], rs.allpts[m + 5], mt); + } + } else if (rs.edgeType === 'straight') { + // need to calc these after endpts + rs.allpts = [rs.startX, rs.startY, rs.endX, rs.endY]; // default midpt for labels etc + + rs.midX = (rs.startX + rs.endX + rs.arrowStartX + rs.arrowEndX) / 4; + rs.midY = (rs.startY + rs.endY + rs.arrowStartY + rs.arrowEndY) / 4; + } else if (rs.edgeType === 'segments') { + rs.allpts = []; + rs.allpts.push(rs.startX, rs.startY); + rs.allpts.push.apply(rs.allpts, rs.segpts); + rs.allpts.push(rs.endX, rs.endY); + + if (rs.segpts.length % 4 === 0) { + var i2 = rs.segpts.length / 2; + var i1 = i2 - 2; + rs.midX = (rs.segpts[i1] + rs.segpts[i2]) / 2; + rs.midY = (rs.segpts[i1 + 1] + rs.segpts[i2 + 1]) / 2; + } else { + var _i = rs.segpts.length / 2 - 1; + + rs.midX = rs.segpts[_i]; + rs.midY = rs.segpts[_i + 1]; + } + } + }; + + BRp$c.checkForInvalidEdgeWarning = function (edge) { + var rs = edge[0]._private.rscratch; + + if (rs.nodesOverlap || number$1(rs.startX) && number$1(rs.startY) && number$1(rs.endX) && number$1(rs.endY)) { + rs.loggedErr = false; + } else { + if (!rs.loggedErr) { + rs.loggedErr = true; + warn('Edge `' + edge.id() + '` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap.'); + } + } + }; + + BRp$c.findEdgeControlPoints = function (edges) { + var _this = this; + + if (!edges || edges.length === 0) { + return; + } + + var r = this; + var cy = r.cy; + var hasCompounds = cy.hasCompoundNodes(); + var hashTable = { + map: new Map$2(), + get: function get(pairId) { + var map2 = this.map.get(pairId[0]); + + if (map2 != null) { + return map2.get(pairId[1]); + } else { + return null; + } + }, + set: function set(pairId, val) { + var map2 = this.map.get(pairId[0]); + + if (map2 == null) { + map2 = new Map$2(); + this.map.set(pairId[0], map2); + } + + map2.set(pairId[1], val); + } + }; + var pairIds = []; + var haystackEdges = []; // create a table of edge (src, tgt) => list of edges between them + + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + var _p = edge._private; + var curveStyle = edge.pstyle('curve-style').value; // ignore edges who are not to be displayed + // they shouldn't take up space + + if (edge.removed() || !edge.takesUpSpace()) { + continue; + } + + if (curveStyle === 'haystack') { + haystackEdges.push(edge); + continue; + } + + var edgeIsUnbundled = curveStyle === 'unbundled-bezier' || curveStyle === 'segments' || curveStyle === 'straight' || curveStyle === 'straight-triangle' || curveStyle === 'taxi'; + var edgeIsBezier = curveStyle === 'unbundled-bezier' || curveStyle === 'bezier'; + var src = _p.source; + var tgt = _p.target; + var srcIndex = src.poolIndex(); + var tgtIndex = tgt.poolIndex(); + var pairId = [srcIndex, tgtIndex].sort(); + var tableEntry = hashTable.get(pairId); + + if (tableEntry == null) { + tableEntry = { + eles: [] + }; + hashTable.set(pairId, tableEntry); + pairIds.push(pairId); + } + + tableEntry.eles.push(edge); + + if (edgeIsUnbundled) { + tableEntry.hasUnbundled = true; + } + + if (edgeIsBezier) { + tableEntry.hasBezier = true; + } + } // for each pair (src, tgt), create the ctrl pts + // Nested for loop is OK; total number of iterations for both loops = edgeCount + + + var _loop = function _loop(p) { + var pairId = pairIds[p]; + var pairInfo = hashTable.get(pairId); + var swappedpairInfo = void 0; + + if (!pairInfo.hasUnbundled) { + var pllEdges = pairInfo.eles[0].parallelEdges().filter(function (e) { + return e.isBundledBezier(); + }); + clearArray(pairInfo.eles); + pllEdges.forEach(function (edge) { + return pairInfo.eles.push(edge); + }); // for each pair id, the edges should be sorted by index + + pairInfo.eles.sort(function (edge1, edge2) { + return edge1.poolIndex() - edge2.poolIndex(); + }); + } + + var firstEdge = pairInfo.eles[0]; + var src = firstEdge.source(); + var tgt = firstEdge.target(); // make sure src/tgt distinction is consistent w.r.t. pairId + + if (src.poolIndex() > tgt.poolIndex()) { + var temp = src; + src = tgt; + tgt = temp; + } + + var srcPos = pairInfo.srcPos = src.position(); + var tgtPos = pairInfo.tgtPos = tgt.position(); + var srcW = pairInfo.srcW = src.outerWidth(); + var srcH = pairInfo.srcH = src.outerHeight(); + var tgtW = pairInfo.tgtW = tgt.outerWidth(); + var tgtH = pairInfo.tgtH = tgt.outerHeight(); + + var srcShape = pairInfo.srcShape = r.nodeShapes[_this.getNodeShape(src)]; + + var tgtShape = pairInfo.tgtShape = r.nodeShapes[_this.getNodeShape(tgt)]; + + pairInfo.dirCounts = { + 'north': 0, + 'west': 0, + 'south': 0, + 'east': 0, + 'northwest': 0, + 'southwest': 0, + 'northeast': 0, + 'southeast': 0 + }; + + for (var _i2 = 0; _i2 < pairInfo.eles.length; _i2++) { + var _edge = pairInfo.eles[_i2]; + var rs = _edge[0]._private.rscratch; + + var _curveStyle = _edge.pstyle('curve-style').value; + + var _edgeIsUnbundled = _curveStyle === 'unbundled-bezier' || _curveStyle === 'segments' || _curveStyle === 'taxi'; // whether the normalised pair order is the reverse of the edge's src-tgt order + + + var edgeIsSwapped = !src.same(_edge.source()); + + if (!pairInfo.calculatedIntersection && src !== tgt && (pairInfo.hasBezier || pairInfo.hasUnbundled)) { + pairInfo.calculatedIntersection = true; // pt outside src shape to calc distance/displacement from src to tgt + + var srcOutside = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, tgtPos.x, tgtPos.y, 0); + var srcIntn = pairInfo.srcIntn = srcOutside; // pt outside tgt shape to calc distance/displacement from src to tgt + + var tgtOutside = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, srcPos.x, srcPos.y, 0); + var tgtIntn = pairInfo.tgtIntn = tgtOutside; + var intersectionPts = pairInfo.intersectionPts = { + x1: srcOutside[0], + x2: tgtOutside[0], + y1: srcOutside[1], + y2: tgtOutside[1] + }; + var posPts = pairInfo.posPts = { + x1: srcPos.x, + x2: tgtPos.x, + y1: srcPos.y, + y2: tgtPos.y + }; + var dy = tgtOutside[1] - srcOutside[1]; + var dx = tgtOutside[0] - srcOutside[0]; + var l = Math.sqrt(dx * dx + dy * dy); + var vector = pairInfo.vector = { + x: dx, + y: dy + }; + var vectorNorm = pairInfo.vectorNorm = { + x: vector.x / l, + y: vector.y / l + }; + var vectorNormInverse = { + x: -vectorNorm.y, + y: vectorNorm.x + }; // if node shapes overlap, then no ctrl pts to draw + + pairInfo.nodesOverlap = !number$1(l) || tgtShape.checkPoint(srcOutside[0], srcOutside[1], 0, tgtW, tgtH, tgtPos.x, tgtPos.y) || srcShape.checkPoint(tgtOutside[0], tgtOutside[1], 0, srcW, srcH, srcPos.x, srcPos.y); + pairInfo.vectorNormInverse = vectorNormInverse; + swappedpairInfo = { + nodesOverlap: pairInfo.nodesOverlap, + dirCounts: pairInfo.dirCounts, + calculatedIntersection: true, + hasBezier: pairInfo.hasBezier, + hasUnbundled: pairInfo.hasUnbundled, + eles: pairInfo.eles, + srcPos: tgtPos, + tgtPos: srcPos, + srcW: tgtW, + srcH: tgtH, + tgtW: srcW, + tgtH: srcH, + srcIntn: tgtIntn, + tgtIntn: srcIntn, + srcShape: tgtShape, + tgtShape: srcShape, + posPts: { + x1: posPts.x2, + y1: posPts.y2, + x2: posPts.x1, + y2: posPts.y1 + }, + intersectionPts: { + x1: intersectionPts.x2, + y1: intersectionPts.y2, + x2: intersectionPts.x1, + y2: intersectionPts.y1 + }, + vector: { + x: -vector.x, + y: -vector.y + }, + vectorNorm: { + x: -vectorNorm.x, + y: -vectorNorm.y + }, + vectorNormInverse: { + x: -vectorNormInverse.x, + y: -vectorNormInverse.y + } + }; + } + + var passedPairInfo = edgeIsSwapped ? swappedpairInfo : pairInfo; + rs.nodesOverlap = passedPairInfo.nodesOverlap; + rs.srcIntn = passedPairInfo.srcIntn; + rs.tgtIntn = passedPairInfo.tgtIntn; + + if (hasCompounds && (src.isParent() || src.isChild() || tgt.isParent() || tgt.isChild()) && (src.parents().anySame(tgt) || tgt.parents().anySame(src) || src.same(tgt) && src.isParent())) { + _this.findCompoundLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); + } else if (src === tgt) { + _this.findLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); + } else if (_curveStyle === 'segments') { + _this.findSegmentsPoints(_edge, passedPairInfo); + } else if (_curveStyle === 'taxi') { + _this.findTaxiPoints(_edge, passedPairInfo); + } else if (_curveStyle === 'straight' || !_edgeIsUnbundled && pairInfo.eles.length % 2 === 1 && _i2 === Math.floor(pairInfo.eles.length / 2)) { + _this.findStraightEdgePoints(_edge); + } else { + _this.findBezierPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled, edgeIsSwapped); + } + + _this.findEndpoints(_edge); + + _this.tryToCorrectInvalidPoints(_edge, passedPairInfo); + + _this.checkForInvalidEdgeWarning(_edge); + + _this.storeAllpts(_edge); + + _this.storeEdgeProjections(_edge); + + _this.calculateArrowAngles(_edge); + + _this.recalculateEdgeLabelProjections(_edge); + + _this.calculateLabelAngles(_edge); + } // for pair edges + + }; + + for (var p = 0; p < pairIds.length; p++) { + _loop(p); + } // for pair ids + // haystacks avoid the expense of pairInfo stuff (intersections etc.) + + + this.findHaystackPoints(haystackEdges); + }; + + function getPts(pts) { + var retPts = []; + + if (pts == null) { + return; + } + + for (var i = 0; i < pts.length; i += 2) { + var x = pts[i]; + var y = pts[i + 1]; + retPts.push({ + x: x, + y: y + }); + } + + return retPts; + } + + BRp$c.getSegmentPoints = function (edge) { + var rs = edge[0]._private.rscratch; + var type = rs.edgeType; + + if (type === 'segments') { + this.recalculateRenderedStyle(edge); + return getPts(rs.segpts); + } + }; + + BRp$c.getControlPoints = function (edge) { + var rs = edge[0]._private.rscratch; + var type = rs.edgeType; + + if (type === 'bezier' || type === 'multibezier' || type === 'self' || type === 'compound') { + this.recalculateRenderedStyle(edge); + return getPts(rs.ctrlpts); + } + }; + + BRp$c.getEdgeMidpoint = function (edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + return { + x: rs.midX, + y: rs.midY + }; + }; + + var BRp$b = {}; + + BRp$b.manualEndptToPx = function (node, prop) { + var r = this; + var npos = node.position(); + var w = node.outerWidth(); + var h = node.outerHeight(); + + if (prop.value.length === 2) { + var p = [prop.pfValue[0], prop.pfValue[1]]; + + if (prop.units[0] === '%') { + p[0] = p[0] * w; + } + + if (prop.units[1] === '%') { + p[1] = p[1] * h; + } + + p[0] += npos.x; + p[1] += npos.y; + return p; + } else { + var angle = prop.pfValue[0]; + angle = -Math.PI / 2 + angle; // start at 12 o'clock + + var l = 2 * Math.max(w, h); + var _p = [npos.x + Math.cos(angle) * l, npos.y + Math.sin(angle) * l]; + return r.nodeShapes[this.getNodeShape(node)].intersectLine(npos.x, npos.y, w, h, _p[0], _p[1], 0); + } + }; + + BRp$b.findEndpoints = function (edge) { + var r = this; + var intersect; + var source = edge.source()[0]; + var target = edge.target()[0]; + var srcPos = source.position(); + var tgtPos = target.position(); + var tgtArShape = edge.pstyle('target-arrow-shape').value; + var srcArShape = edge.pstyle('source-arrow-shape').value; + var tgtDist = edge.pstyle('target-distance-from-node').pfValue; + var srcDist = edge.pstyle('source-distance-from-node').pfValue; + var curveStyle = edge.pstyle('curve-style').value; + var rs = edge._private.rscratch; + var et = rs.edgeType; + var taxi = curveStyle === 'taxi'; + var self = et === 'self' || et === 'compound'; + var bezier = et === 'bezier' || et === 'multibezier' || self; + var multi = et !== 'bezier'; + var lines = et === 'straight' || et === 'segments'; + var segments = et === 'segments'; + var hasEndpts = bezier || multi || lines; + var overrideEndpts = self || taxi; + var srcManEndpt = edge.pstyle('source-endpoint'); + var srcManEndptVal = overrideEndpts ? 'outside-to-node' : srcManEndpt.value; + var tgtManEndpt = edge.pstyle('target-endpoint'); + var tgtManEndptVal = overrideEndpts ? 'outside-to-node' : tgtManEndpt.value; + rs.srcManEndpt = srcManEndpt; + rs.tgtManEndpt = tgtManEndpt; + var p1; // last known point of edge on target side + + var p2; // last known point of edge on source side + + var p1_i; // point to intersect with target shape + + var p2_i; // point to intersect with source shape + + if (bezier) { + var cpStart = [rs.ctrlpts[0], rs.ctrlpts[1]]; + var cpEnd = multi ? [rs.ctrlpts[rs.ctrlpts.length - 2], rs.ctrlpts[rs.ctrlpts.length - 1]] : cpStart; + p1 = cpEnd; + p2 = cpStart; + } else if (lines) { + var srcArrowFromPt = !segments ? [tgtPos.x, tgtPos.y] : rs.segpts.slice(0, 2); + var tgtArrowFromPt = !segments ? [srcPos.x, srcPos.y] : rs.segpts.slice(rs.segpts.length - 2); + p1 = tgtArrowFromPt; + p2 = srcArrowFromPt; + } + + if (tgtManEndptVal === 'inside-to-node') { + intersect = [tgtPos.x, tgtPos.y]; + } else if (tgtManEndpt.units) { + intersect = this.manualEndptToPx(target, tgtManEndpt); + } else if (tgtManEndptVal === 'outside-to-line') { + intersect = rs.tgtIntn; // use cached value from ctrlpt calc + } else { + if (tgtManEndptVal === 'outside-to-node' || tgtManEndptVal === 'outside-to-node-or-label') { + p1_i = p1; + } else if (tgtManEndptVal === 'outside-to-line' || tgtManEndptVal === 'outside-to-line-or-label') { + p1_i = [srcPos.x, srcPos.y]; + } + + intersect = r.nodeShapes[this.getNodeShape(target)].intersectLine(tgtPos.x, tgtPos.y, target.outerWidth(), target.outerHeight(), p1_i[0], p1_i[1], 0); + + if (tgtManEndptVal === 'outside-to-node-or-label' || tgtManEndptVal === 'outside-to-line-or-label') { + var trs = target._private.rscratch; + var lw = trs.labelWidth; + var lh = trs.labelHeight; + var lx = trs.labelX; + var ly = trs.labelY; + var lw2 = lw / 2; + var lh2 = lh / 2; + var va = target.pstyle('text-valign').value; + + if (va === 'top') { + ly -= lh2; + } else if (va === 'bottom') { + ly += lh2; + } + + var ha = target.pstyle('text-halign').value; + + if (ha === 'left') { + lx -= lw2; + } else if (ha === 'right') { + lx += lw2; + } + + var labelIntersect = polygonIntersectLine(p1_i[0], p1_i[1], [lx - lw2, ly - lh2, lx + lw2, ly - lh2, lx + lw2, ly + lh2, lx - lw2, ly + lh2], tgtPos.x, tgtPos.y); + + if (labelIntersect.length > 0) { + var refPt = srcPos; + var intSqdist = sqdist(refPt, array2point(intersect)); + var labIntSqdist = sqdist(refPt, array2point(labelIntersect)); + var minSqDist = intSqdist; + + if (labIntSqdist < intSqdist) { + intersect = labelIntersect; + minSqDist = labIntSqdist; + } + + if (labelIntersect.length > 2) { + var labInt2SqDist = sqdist(refPt, { + x: labelIntersect[2], + y: labelIntersect[3] + }); + + if (labInt2SqDist < minSqDist) { + intersect = [labelIntersect[2], labelIntersect[3]]; + } + } + } + } + } + + var arrowEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].spacing(edge) + tgtDist); + var edgeEnd = shortenIntersection(intersect, p1, r.arrowShapes[tgtArShape].gap(edge) + tgtDist); + rs.endX = edgeEnd[0]; + rs.endY = edgeEnd[1]; + rs.arrowEndX = arrowEnd[0]; + rs.arrowEndY = arrowEnd[1]; + + if (srcManEndptVal === 'inside-to-node') { + intersect = [srcPos.x, srcPos.y]; + } else if (srcManEndpt.units) { + intersect = this.manualEndptToPx(source, srcManEndpt); + } else if (srcManEndptVal === 'outside-to-line') { + intersect = rs.srcIntn; // use cached value from ctrlpt calc + } else { + if (srcManEndptVal === 'outside-to-node' || srcManEndptVal === 'outside-to-node-or-label') { + p2_i = p2; + } else if (srcManEndptVal === 'outside-to-line' || srcManEndptVal === 'outside-to-line-or-label') { + p2_i = [tgtPos.x, tgtPos.y]; + } + + intersect = r.nodeShapes[this.getNodeShape(source)].intersectLine(srcPos.x, srcPos.y, source.outerWidth(), source.outerHeight(), p2_i[0], p2_i[1], 0); + + if (srcManEndptVal === 'outside-to-node-or-label' || srcManEndptVal === 'outside-to-line-or-label') { + var srs = source._private.rscratch; + var _lw = srs.labelWidth; + var _lh = srs.labelHeight; + var _lx = srs.labelX; + var _ly = srs.labelY; + + var _lw2 = _lw / 2; + + var _lh2 = _lh / 2; + + var _va = source.pstyle('text-valign').value; + + if (_va === 'top') { + _ly -= _lh2; + } else if (_va === 'bottom') { + _ly += _lh2; + } + + var _ha = source.pstyle('text-halign').value; + + if (_ha === 'left') { + _lx -= _lw2; + } else if (_ha === 'right') { + _lx += _lw2; + } + + var _labelIntersect = polygonIntersectLine(p2_i[0], p2_i[1], [_lx - _lw2, _ly - _lh2, _lx + _lw2, _ly - _lh2, _lx + _lw2, _ly + _lh2, _lx - _lw2, _ly + _lh2], srcPos.x, srcPos.y); + + if (_labelIntersect.length > 0) { + var _refPt = tgtPos; + + var _intSqdist = sqdist(_refPt, array2point(intersect)); + + var _labIntSqdist = sqdist(_refPt, array2point(_labelIntersect)); + + var _minSqDist = _intSqdist; + + if (_labIntSqdist < _intSqdist) { + intersect = [_labelIntersect[0], _labelIntersect[1]]; + _minSqDist = _labIntSqdist; + } + + if (_labelIntersect.length > 2) { + var _labInt2SqDist = sqdist(_refPt, { + x: _labelIntersect[2], + y: _labelIntersect[3] + }); + + if (_labInt2SqDist < _minSqDist) { + intersect = [_labelIntersect[2], _labelIntersect[3]]; + } + } + } + } + } + + var arrowStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].spacing(edge) + srcDist); + var edgeStart = shortenIntersection(intersect, p2, r.arrowShapes[srcArShape].gap(edge) + srcDist); + rs.startX = edgeStart[0]; + rs.startY = edgeStart[1]; + rs.arrowStartX = arrowStart[0]; + rs.arrowStartY = arrowStart[1]; + + if (hasEndpts) { + if (!number$1(rs.startX) || !number$1(rs.startY) || !number$1(rs.endX) || !number$1(rs.endY)) { + rs.badLine = true; + } else { + rs.badLine = false; + } + } + }; + + BRp$b.getSourceEndpoint = function (edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + + switch (rs.edgeType) { + case 'haystack': + return { + x: rs.haystackPts[0], + y: rs.haystackPts[1] + }; + + default: + return { + x: rs.arrowStartX, + y: rs.arrowStartY + }; + } + }; + + BRp$b.getTargetEndpoint = function (edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + + switch (rs.edgeType) { + case 'haystack': + return { + x: rs.haystackPts[2], + y: rs.haystackPts[3] + }; + + default: + return { + x: rs.arrowEndX, + y: rs.arrowEndY + }; + } + }; + + var BRp$a = {}; + + function pushBezierPts(r, edge, pts) { + var qbezierAt$1 = function qbezierAt$1(p1, p2, p3, t) { + return qbezierAt(p1, p2, p3, t); + }; + + var _p = edge._private; + var bpts = _p.rstyle.bezierPts; + + for (var i = 0; i < r.bezierProjPcts.length; i++) { + var p = r.bezierProjPcts[i]; + bpts.push({ + x: qbezierAt$1(pts[0], pts[2], pts[4], p), + y: qbezierAt$1(pts[1], pts[3], pts[5], p) + }); + } + } + + BRp$a.storeEdgeProjections = function (edge) { + var _p = edge._private; + var rs = _p.rscratch; + var et = rs.edgeType; // clear the cached points state + + _p.rstyle.bezierPts = null; + _p.rstyle.linePts = null; + _p.rstyle.haystackPts = null; + + if (et === 'multibezier' || et === 'bezier' || et === 'self' || et === 'compound') { + _p.rstyle.bezierPts = []; + + for (var i = 0; i + 5 < rs.allpts.length; i += 4) { + pushBezierPts(this, edge, rs.allpts.slice(i, i + 6)); + } + } else if (et === 'segments') { + var lpts = _p.rstyle.linePts = []; + + for (var i = 0; i + 1 < rs.allpts.length; i += 2) { + lpts.push({ + x: rs.allpts[i], + y: rs.allpts[i + 1] + }); + } + } else if (et === 'haystack') { + var hpts = rs.haystackPts; + _p.rstyle.haystackPts = [{ + x: hpts[0], + y: hpts[1] + }, { + x: hpts[2], + y: hpts[3] + }]; + } + + _p.rstyle.arrowWidth = this.getArrowWidth(edge.pstyle('width').pfValue, edge.pstyle('arrow-scale').value) * this.arrowShapeWidth; + }; + + BRp$a.recalculateEdgeProjections = function (edges) { + this.findEdgeControlPoints(edges); + }; + + /* global document */ + + var BRp$9 = {}; + + BRp$9.recalculateNodeLabelProjection = function (node) { + var content = node.pstyle('label').strValue; + + if (emptyString(content)) { + return; + } + + var textX, textY; + var _p = node._private; + var nodeWidth = node.width(); + var nodeHeight = node.height(); + var padding = node.padding(); + var nodePos = node.position(); + var textHalign = node.pstyle('text-halign').strValue; + var textValign = node.pstyle('text-valign').strValue; + var rs = _p.rscratch; + var rstyle = _p.rstyle; + + switch (textHalign) { + case 'left': + textX = nodePos.x - nodeWidth / 2 - padding; + break; + + case 'right': + textX = nodePos.x + nodeWidth / 2 + padding; + break; + + default: + // e.g. center + textX = nodePos.x; + } + + switch (textValign) { + case 'top': + textY = nodePos.y - nodeHeight / 2 - padding; + break; + + case 'bottom': + textY = nodePos.y + nodeHeight / 2 + padding; + break; + + default: + // e.g. middle + textY = nodePos.y; + } + + rs.labelX = textX; + rs.labelY = textY; + rstyle.labelX = textX; + rstyle.labelY = textY; + this.calculateLabelAngles(node); + this.applyLabelDimensions(node); + }; + + var lineAngleFromDelta = function lineAngleFromDelta(dx, dy) { + var angle = Math.atan(dy / dx); + + if (dx === 0 && angle < 0) { + angle = angle * -1; + } + + return angle; + }; + + var lineAngle = function lineAngle(p0, p1) { + var dx = p1.x - p0.x; + var dy = p1.y - p0.y; + return lineAngleFromDelta(dx, dy); + }; + + var bezierAngle = function bezierAngle(p0, p1, p2, t) { + var t0 = bound(0, t - 0.001, 1); + var t1 = bound(0, t + 0.001, 1); + var lp0 = qbezierPtAt(p0, p1, p2, t0); + var lp1 = qbezierPtAt(p0, p1, p2, t1); + return lineAngle(lp0, lp1); + }; + + BRp$9.recalculateEdgeLabelProjections = function (edge) { + var p; + var _p = edge._private; + var rs = _p.rscratch; + var r = this; + var content = { + mid: edge.pstyle('label').strValue, + source: edge.pstyle('source-label').strValue, + target: edge.pstyle('target-label').strValue + }; + + if (content.mid || content.source || content.target) ; else { + return; // no labels => no calcs + } // add center point to style so bounding box calculations can use it + // + + + p = { + x: rs.midX, + y: rs.midY + }; + + var setRs = function setRs(propName, prefix, value) { + setPrefixedProperty(_p.rscratch, propName, prefix, value); + setPrefixedProperty(_p.rstyle, propName, prefix, value); + }; + + setRs('labelX', null, p.x); + setRs('labelY', null, p.y); + var midAngle = lineAngleFromDelta(rs.midDispX, rs.midDispY); + setRs('labelAutoAngle', null, midAngle); + + var createControlPointInfo = function createControlPointInfo() { + if (createControlPointInfo.cache) { + return createControlPointInfo.cache; + } // use cache so only 1x per edge + + + var ctrlpts = []; // store each ctrlpt info init + + for (var i = 0; i + 5 < rs.allpts.length; i += 4) { + var p0 = { + x: rs.allpts[i], + y: rs.allpts[i + 1] + }; + var p1 = { + x: rs.allpts[i + 2], + y: rs.allpts[i + 3] + }; // ctrlpt + + var p2 = { + x: rs.allpts[i + 4], + y: rs.allpts[i + 5] + }; + ctrlpts.push({ + p0: p0, + p1: p1, + p2: p2, + startDist: 0, + length: 0, + segments: [] + }); + } + + var bpts = _p.rstyle.bezierPts; + var nProjs = r.bezierProjPcts.length; + + function addSegment(cp, p0, p1, t0, t1) { + var length = dist(p0, p1); + var prevSegment = cp.segments[cp.segments.length - 1]; + var segment = { + p0: p0, + p1: p1, + t0: t0, + t1: t1, + startDist: prevSegment ? prevSegment.startDist + prevSegment.length : 0, + length: length + }; + cp.segments.push(segment); + cp.length += length; + } // update each ctrlpt with segment info + + + for (var _i = 0; _i < ctrlpts.length; _i++) { + var cp = ctrlpts[_i]; + var prevCp = ctrlpts[_i - 1]; + + if (prevCp) { + cp.startDist = prevCp.startDist + prevCp.length; + } + + addSegment(cp, cp.p0, bpts[_i * nProjs], 0, r.bezierProjPcts[0]); // first + + for (var j = 0; j < nProjs - 1; j++) { + addSegment(cp, bpts[_i * nProjs + j], bpts[_i * nProjs + j + 1], r.bezierProjPcts[j], r.bezierProjPcts[j + 1]); + } + + addSegment(cp, bpts[_i * nProjs + nProjs - 1], cp.p2, r.bezierProjPcts[nProjs - 1], 1); // last + } + + return createControlPointInfo.cache = ctrlpts; + }; + + var calculateEndProjection = function calculateEndProjection(prefix) { + var angle; + var isSrc = prefix === 'source'; + + if (!content[prefix]) { + return; + } + + var offset = edge.pstyle(prefix + '-text-offset').pfValue; + + switch (rs.edgeType) { + case 'self': + case 'compound': + case 'bezier': + case 'multibezier': + { + var cps = createControlPointInfo(); + var selected; + var startDist = 0; + var totalDist = 0; // find the segment we're on + + for (var i = 0; i < cps.length; i++) { + var _cp = cps[isSrc ? i : cps.length - 1 - i]; + + for (var j = 0; j < _cp.segments.length; j++) { + var _seg = _cp.segments[isSrc ? j : _cp.segments.length - 1 - j]; + var lastSeg = i === cps.length - 1 && j === _cp.segments.length - 1; + startDist = totalDist; + totalDist += _seg.length; + + if (totalDist >= offset || lastSeg) { + selected = { + cp: _cp, + segment: _seg + }; + break; + } + } + + if (selected) { + break; + } + } + + var cp = selected.cp; + var seg = selected.segment; + var tSegment = (offset - startDist) / seg.length; + var segDt = seg.t1 - seg.t0; + var t = isSrc ? seg.t0 + segDt * tSegment : seg.t1 - segDt * tSegment; + t = bound(0, t, 1); + p = qbezierPtAt(cp.p0, cp.p1, cp.p2, t); + angle = bezierAngle(cp.p0, cp.p1, cp.p2, t); + break; + } + + case 'straight': + case 'segments': + case 'haystack': + { + var d = 0, + di, + d0; + var p0, p1; + var l = rs.allpts.length; + + for (var _i2 = 0; _i2 + 3 < l; _i2 += 2) { + if (isSrc) { + p0 = { + x: rs.allpts[_i2], + y: rs.allpts[_i2 + 1] + }; + p1 = { + x: rs.allpts[_i2 + 2], + y: rs.allpts[_i2 + 3] + }; + } else { + p0 = { + x: rs.allpts[l - 2 - _i2], + y: rs.allpts[l - 1 - _i2] + }; + p1 = { + x: rs.allpts[l - 4 - _i2], + y: rs.allpts[l - 3 - _i2] + }; + } + + di = dist(p0, p1); + d0 = d; + d += di; + + if (d >= offset) { + break; + } + } + + var pD = offset - d0; + + var _t = pD / di; + + _t = bound(0, _t, 1); + p = lineAt(p0, p1, _t); + angle = lineAngle(p0, p1); + break; + } + } + + setRs('labelX', prefix, p.x); + setRs('labelY', prefix, p.y); + setRs('labelAutoAngle', prefix, angle); + }; + + calculateEndProjection('source'); + calculateEndProjection('target'); + this.applyLabelDimensions(edge); + }; + + BRp$9.applyLabelDimensions = function (ele) { + this.applyPrefixedLabelDimensions(ele); + + if (ele.isEdge()) { + this.applyPrefixedLabelDimensions(ele, 'source'); + this.applyPrefixedLabelDimensions(ele, 'target'); + } + }; + + BRp$9.applyPrefixedLabelDimensions = function (ele, prefix) { + var _p = ele._private; + var text = this.getLabelText(ele, prefix); + var labelDims = this.calculateLabelDimensions(ele, text); + var lineHeight = ele.pstyle('line-height').pfValue; + var textWrap = ele.pstyle('text-wrap').strValue; + var lines = getPrefixedProperty(_p.rscratch, 'labelWrapCachedLines', prefix) || []; + var numLines = textWrap !== 'wrap' ? 1 : Math.max(lines.length, 1); + var normPerLineHeight = labelDims.height / numLines; + var labelLineHeight = normPerLineHeight * lineHeight; + var width = labelDims.width; + var height = labelDims.height + (numLines - 1) * (lineHeight - 1) * normPerLineHeight; + setPrefixedProperty(_p.rstyle, 'labelWidth', prefix, width); + setPrefixedProperty(_p.rscratch, 'labelWidth', prefix, width); + setPrefixedProperty(_p.rstyle, 'labelHeight', prefix, height); + setPrefixedProperty(_p.rscratch, 'labelHeight', prefix, height); + setPrefixedProperty(_p.rscratch, 'labelLineHeight', prefix, labelLineHeight); + }; + + BRp$9.getLabelText = function (ele, prefix) { + var _p = ele._private; + var pfd = prefix ? prefix + '-' : ''; + var text = ele.pstyle(pfd + 'label').strValue; + var textTransform = ele.pstyle('text-transform').value; + + var rscratch = function rscratch(propName, value) { + if (value) { + setPrefixedProperty(_p.rscratch, propName, prefix, value); + return value; + } else { + return getPrefixedProperty(_p.rscratch, propName, prefix); + } + }; // for empty text, skip all processing + + + if (!text) { + return ''; + } + + if (textTransform == 'none') ; else if (textTransform == 'uppercase') { + text = text.toUpperCase(); + } else if (textTransform == 'lowercase') { + text = text.toLowerCase(); + } + + var wrapStyle = ele.pstyle('text-wrap').value; + + if (wrapStyle === 'wrap') { + var labelKey = rscratch('labelKey'); // save recalc if the label is the same as before + + if (labelKey != null && rscratch('labelWrapKey') === labelKey) { + return rscratch('labelWrapCachedText'); + } + + var zwsp = "\u200B"; + var lines = text.split('\n'); + var maxW = ele.pstyle('text-max-width').pfValue; + var overflow = ele.pstyle('text-overflow-wrap').value; + var overflowAny = overflow === 'anywhere'; + var wrappedLines = []; + var wordsRegex = /[\s\u200b]+/; + var wordSeparator = overflowAny ? '' : ' '; + + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + var lineDims = this.calculateLabelDimensions(ele, line); + var lineW = lineDims.width; + + if (overflowAny) { + var processedLine = line.split('').join(zwsp); + line = processedLine; + } + + if (lineW > maxW) { + // line is too long + var words = line.split(wordsRegex); + var subline = ''; + + for (var w = 0; w < words.length; w++) { + var word = words[w]; + var testLine = subline.length === 0 ? word : subline + wordSeparator + word; + var testDims = this.calculateLabelDimensions(ele, testLine); + var testW = testDims.width; + + if (testW <= maxW) { + // word fits on current line + subline += word + wordSeparator; + } else { + // word starts new line + if (subline) { + wrappedLines.push(subline); + } + + subline = word + wordSeparator; + } + } // if there's remaining text, put it in a wrapped line + + + if (!subline.match(/^[\s\u200b]+$/)) { + wrappedLines.push(subline); + } + } else { + // line is already short enough + wrappedLines.push(line); + } + } // for + + + rscratch('labelWrapCachedLines', wrappedLines); + text = rscratch('labelWrapCachedText', wrappedLines.join('\n')); + rscratch('labelWrapKey', labelKey); + } else if (wrapStyle === 'ellipsis') { + var _maxW = ele.pstyle('text-max-width').pfValue; + var ellipsized = ''; + var ellipsis = "\u2026"; + var incLastCh = false; + + if (this.calculateLabelDimensions(ele, text).width < _maxW) { + // the label already fits + return text; + } + + for (var i = 0; i < text.length; i++) { + var widthWithNextCh = this.calculateLabelDimensions(ele, ellipsized + text[i] + ellipsis).width; + + if (widthWithNextCh > _maxW) { + break; + } + + ellipsized += text[i]; + + if (i === text.length - 1) { + incLastCh = true; + } + } + + if (!incLastCh) { + ellipsized += ellipsis; + } + + return ellipsized; + } // if ellipsize + + + return text; + }; + + BRp$9.getLabelJustification = function (ele) { + var justification = ele.pstyle('text-justification').strValue; + var textHalign = ele.pstyle('text-halign').strValue; + + if (justification === 'auto') { + if (ele.isNode()) { + switch (textHalign) { + case 'left': + return 'right'; + + case 'right': + return 'left'; + + default: + return 'center'; + } + } else { + return 'center'; + } + } else { + return justification; + } + }; + + BRp$9.calculateLabelDimensions = function (ele, text) { + var r = this; + var cacheKey = hashString(text, ele._private.labelDimsKey); + var cache = r.labelDimCache || (r.labelDimCache = []); + var existingVal = cache[cacheKey]; + + if (existingVal != null) { + return existingVal; + } + + var padding = 0; // add padding around text dims, as the measurement isn't that accurate + + var fStyle = ele.pstyle('font-style').strValue; + var size = ele.pstyle('font-size').pfValue; + var family = ele.pstyle('font-family').strValue; + var weight = ele.pstyle('font-weight').strValue; + var canvas = this.labelCalcCanvas; + var c2d = this.labelCalcCanvasContext; + + if (!canvas) { + canvas = this.labelCalcCanvas = document.createElement('canvas'); + c2d = this.labelCalcCanvasContext = canvas.getContext('2d'); + var ds = canvas.style; + ds.position = 'absolute'; + ds.left = '-9999px'; + ds.top = '-9999px'; + ds.zIndex = '-1'; + ds.visibility = 'hidden'; + ds.pointerEvents = 'none'; + } + + c2d.font = "".concat(fStyle, " ").concat(weight, " ").concat(size, "px ").concat(family); + var width = 0; + var height = 0; + var lines = text.split('\n'); + + for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + var metrics = c2d.measureText(line); + var w = Math.ceil(metrics.width); + var h = size; + width = Math.max(w, width); + height += h; + } + + width += padding; + height += padding; + return cache[cacheKey] = { + width: width, + height: height + }; + }; + + BRp$9.calculateLabelAngle = function (ele, prefix) { + var _p = ele._private; + var rs = _p.rscratch; + var isEdge = ele.isEdge(); + var prefixDash = prefix ? prefix + '-' : ''; + var rot = ele.pstyle(prefixDash + 'text-rotation'); + var rotStr = rot.strValue; + + if (rotStr === 'none') { + return 0; + } else if (isEdge && rotStr === 'autorotate') { + return rs.labelAutoAngle; + } else if (rotStr === 'autorotate') { + return 0; + } else { + return rot.pfValue; + } + }; + + BRp$9.calculateLabelAngles = function (ele) { + var r = this; + var isEdge = ele.isEdge(); + var _p = ele._private; + var rs = _p.rscratch; + rs.labelAngle = r.calculateLabelAngle(ele); + + if (isEdge) { + rs.sourceLabelAngle = r.calculateLabelAngle(ele, 'source'); + rs.targetLabelAngle = r.calculateLabelAngle(ele, 'target'); + } + }; + + var BRp$8 = {}; + var TOO_SMALL_CUT_RECT = 28; + var warnedCutRect = false; + + BRp$8.getNodeShape = function (node) { + var r = this; + var shape = node.pstyle('shape').value; + + if (shape === 'cutrectangle' && (node.width() < TOO_SMALL_CUT_RECT || node.height() < TOO_SMALL_CUT_RECT)) { + if (!warnedCutRect) { + warn('The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead'); + warnedCutRect = true; + } + + return 'rectangle'; + } + + if (node.isParent()) { + if (shape === 'rectangle' || shape === 'roundrectangle' || shape === 'round-rectangle' || shape === 'cutrectangle' || shape === 'cut-rectangle' || shape === 'barrel') { + return shape; + } else { + return 'rectangle'; + } + } + + if (shape === 'polygon') { + var points = node.pstyle('shape-polygon-points').value; + return r.nodeShapes.makePolygon(points).name; + } + + return shape; + }; + + var BRp$7 = {}; + + BRp$7.registerCalculationListeners = function () { + var cy = this.cy; + var elesToUpdate = cy.collection(); + var r = this; + + var enqueue = function enqueue(eles) { + var dirtyStyleCaches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + elesToUpdate.merge(eles); + + if (dirtyStyleCaches) { + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _p = ele._private; + var rstyle = _p.rstyle; + rstyle.clean = false; + rstyle.cleanConnected = false; + } + } + }; + + r.binder(cy).on('bounds.* dirty.*', function onDirtyBounds(e) { + var ele = e.target; + enqueue(ele); + }).on('style.* background.*', function onDirtyStyle(e) { + var ele = e.target; + enqueue(ele, false); + }); + + var updateEleCalcs = function updateEleCalcs(willDraw) { + if (willDraw) { + var fns = r.onUpdateEleCalcsFns; // because we need to have up-to-date style (e.g. stylesheet mappers) + // before calculating rendered style (and pstyle might not be called yet) + + elesToUpdate.cleanStyle(); + + for (var i = 0; i < elesToUpdate.length; i++) { + var ele = elesToUpdate[i]; + var rstyle = ele._private.rstyle; + + if (ele.isNode() && !rstyle.cleanConnected) { + enqueue(ele.connectedEdges()); + rstyle.cleanConnected = true; + } + } + + if (fns) { + for (var _i = 0; _i < fns.length; _i++) { + var fn = fns[_i]; + fn(willDraw, elesToUpdate); + } + } + + r.recalculateRenderedStyle(elesToUpdate); + elesToUpdate = cy.collection(); + } + }; + + r.flushRenderedStyleQueue = function () { + updateEleCalcs(true); + }; + + r.beforeRender(updateEleCalcs, r.beforeRenderPriorities.eleCalcs); + }; + + BRp$7.onUpdateEleCalcs = function (fn) { + var fns = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || []; + fns.push(fn); + }; + + BRp$7.recalculateRenderedStyle = function (eles, useCache) { + var isCleanConnected = function isCleanConnected(ele) { + return ele._private.rstyle.cleanConnected; + }; + + var edges = []; + var nodes = []; // the renderer can't be used for calcs when destroyed, e.g. ele.boundingBox() + + if (this.destroyed) { + return; + } // use cache by default for perf + + + if (useCache === undefined) { + useCache = true; + } + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var _p = ele._private; + var rstyle = _p.rstyle; // an edge may be implicitly dirty b/c of one of its connected nodes + // (and a request for recalc may come in between frames) + + if (ele.isEdge() && (!isCleanConnected(ele.source()) || !isCleanConnected(ele.target()))) { + rstyle.clean = false; + } // only update if dirty and in graph + + + if (useCache && rstyle.clean || ele.removed()) { + continue; + } // only update if not display: none + + + if (ele.pstyle('display').value === 'none') { + continue; + } + + if (_p.group === 'nodes') { + nodes.push(ele); + } else { + // edges + edges.push(ele); + } + + rstyle.clean = true; + } // update node data from projections + + + for (var _i2 = 0; _i2 < nodes.length; _i2++) { + var _ele = nodes[_i2]; + var _p2 = _ele._private; + var _rstyle = _p2.rstyle; + + var pos = _ele.position(); + + this.recalculateNodeLabelProjection(_ele); + _rstyle.nodeX = pos.x; + _rstyle.nodeY = pos.y; + _rstyle.nodeW = _ele.pstyle('width').pfValue; + _rstyle.nodeH = _ele.pstyle('height').pfValue; + } + + this.recalculateEdgeProjections(edges); // update edge data from projections + + for (var _i3 = 0; _i3 < edges.length; _i3++) { + var _ele2 = edges[_i3]; + var _p3 = _ele2._private; + var _rstyle2 = _p3.rstyle; + var rs = _p3.rscratch; // update rstyle positions + + _rstyle2.srcX = rs.arrowStartX; + _rstyle2.srcY = rs.arrowStartY; + _rstyle2.tgtX = rs.arrowEndX; + _rstyle2.tgtY = rs.arrowEndY; + _rstyle2.midX = rs.midX; + _rstyle2.midY = rs.midY; + _rstyle2.labelAngle = rs.labelAngle; + _rstyle2.sourceLabelAngle = rs.sourceLabelAngle; + _rstyle2.targetLabelAngle = rs.targetLabelAngle; + } + }; + + var BRp$6 = {}; + + BRp$6.updateCachedGrabbedEles = function () { + var eles = this.cachedZSortedEles; + + if (!eles) { + // just let this be recalculated on the next z sort tick + return; + } + + eles.drag = []; + eles.nondrag = []; + var grabTargets = []; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var rs = ele._private.rscratch; + + if (ele.grabbed() && !ele.isParent()) { + grabTargets.push(ele); + } else if (rs.inDragLayer) { + eles.drag.push(ele); + } else { + eles.nondrag.push(ele); + } + } // put the grab target nodes last so it's on top of its neighbourhood + + + for (var i = 0; i < grabTargets.length; i++) { + var ele = grabTargets[i]; + eles.drag.push(ele); + } + }; + + BRp$6.invalidateCachedZSortedEles = function () { + this.cachedZSortedEles = null; + }; + + BRp$6.getCachedZSortedEles = function (forceRecalc) { + if (forceRecalc || !this.cachedZSortedEles) { + var eles = this.cy.mutableElements().toArray(); + eles.sort(zIndexSort); + eles.interactive = eles.filter(function (ele) { + return ele.interactive(); + }); + this.cachedZSortedEles = eles; + this.updateCachedGrabbedEles(); + } else { + eles = this.cachedZSortedEles; + } + + return eles; + }; + + var BRp$5 = {}; + [BRp$e, BRp$d, BRp$c, BRp$b, BRp$a, BRp$9, BRp$8, BRp$7, BRp$6].forEach(function (props) { + extend(BRp$5, props); + }); + + var BRp$4 = {}; + + BRp$4.getCachedImage = function (url, crossOrigin, onLoad) { + var r = this; + var imageCache = r.imageCache = r.imageCache || {}; + var cache = imageCache[url]; + + if (cache) { + if (!cache.image.complete) { + cache.image.addEventListener('load', onLoad); + } + + return cache.image; + } else { + cache = imageCache[url] = imageCache[url] || {}; + var image = cache.image = new Image(); // eslint-disable-line no-undef + + image.addEventListener('load', onLoad); + image.addEventListener('error', function () { + image.error = true; + }); // #1582 safari doesn't load data uris with crossOrigin properly + // https://bugs.webkit.org/show_bug.cgi?id=123978 + + var dataUriPrefix = 'data:'; + var isDataUri = url.substring(0, dataUriPrefix.length).toLowerCase() === dataUriPrefix; + + if (!isDataUri) { + // if crossorigin is 'null'(stringified), then manually set it to null + crossOrigin = crossOrigin === 'null' ? null : crossOrigin; + image.crossOrigin = crossOrigin; // prevent tainted canvas + } + + image.src = url; + return image; + } + }; + + var BRp$3 = {}; + /* global document, window, ResizeObserver, MutationObserver */ + + BRp$3.registerBinding = function (target, event, handler, useCapture) { + // eslint-disable-line no-unused-vars + var args = Array.prototype.slice.apply(arguments, [1]); // copy + + var b = this.binder(target); + return b.on.apply(b, args); + }; + + BRp$3.binder = function (tgt) { + var r = this; + var tgtIsDom = tgt === window || tgt === document || tgt === document.body || domElement(tgt); + + if (r.supportsPassiveEvents == null) { + // from https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection + var supportsPassive = false; + + try { + var opts = Object.defineProperty({}, 'passive', { + get: function get() { + supportsPassive = true; + return true; + } + }); + window.addEventListener('test', null, opts); + } catch (err) {// not supported + } + + r.supportsPassiveEvents = supportsPassive; + } + + var on = function on(event, handler, useCapture) { + var args = Array.prototype.slice.call(arguments); + + if (tgtIsDom && r.supportsPassiveEvents) { + // replace useCapture w/ opts obj + args[2] = { + capture: useCapture != null ? useCapture : false, + passive: false, + once: false + }; + } + + r.bindings.push({ + target: tgt, + args: args + }); + (tgt.addEventListener || tgt.on).apply(tgt, args); + return this; + }; + + return { + on: on, + addEventListener: on, + addListener: on, + bind: on + }; + }; + + BRp$3.nodeIsDraggable = function (node) { + return node && node.isNode() && !node.locked() && node.grabbable(); + }; + + BRp$3.nodeIsGrabbable = function (node) { + return this.nodeIsDraggable(node) && node.interactive(); + }; + + BRp$3.load = function () { + var r = this; + + var isSelected = function isSelected(ele) { + return ele.selected(); + }; + + var triggerEvents = function triggerEvents(target, names, e, position) { + if (target == null) { + target = r.cy; + } + + for (var i = 0; i < names.length; i++) { + var name = names[i]; + target.emit({ + originalEvent: e, + type: name, + position: position + }); + } + }; + + var isMultSelKeyDown = function isMultSelKeyDown(e) { + return e.shiftKey || e.metaKey || e.ctrlKey; // maybe e.altKey + }; + + var allowPanningPassthrough = function allowPanningPassthrough(down, downs) { + var allowPassthrough = true; + + if (r.cy.hasCompoundNodes() && down && down.pannable()) { + // a grabbable compound node below the ele => no passthrough panning + for (var i = 0; downs && i < downs.length; i++) { + var down = downs[i]; //if any parent node in event hierarchy isn't pannable, reject passthrough + + if (down.isNode() && down.isParent() && !down.pannable()) { + allowPassthrough = false; + break; + } + } + } else { + allowPassthrough = true; + } + + return allowPassthrough; + }; + + var setGrabbed = function setGrabbed(ele) { + ele[0]._private.grabbed = true; + }; + + var setFreed = function setFreed(ele) { + ele[0]._private.grabbed = false; + }; + + var setInDragLayer = function setInDragLayer(ele) { + ele[0]._private.rscratch.inDragLayer = true; + }; + + var setOutDragLayer = function setOutDragLayer(ele) { + ele[0]._private.rscratch.inDragLayer = false; + }; + + var setGrabTarget = function setGrabTarget(ele) { + ele[0]._private.rscratch.isGrabTarget = true; + }; + + var removeGrabTarget = function removeGrabTarget(ele) { + ele[0]._private.rscratch.isGrabTarget = false; + }; + + var addToDragList = function addToDragList(ele, opts) { + var list = opts.addToList; + var listHasEle = list.has(ele); + + if (!listHasEle && ele.grabbable() && !ele.locked()) { + list.merge(ele); + setGrabbed(ele); + } + }; // helper function to determine which child nodes and inner edges + // of a compound node to be dragged as well as the grabbed and selected nodes + + + var addDescendantsToDrag = function addDescendantsToDrag(node, opts) { + if (!node.cy().hasCompoundNodes()) { + return; + } + + if (opts.inDragLayer == null && opts.addToList == null) { + return; + } // nothing to do + + + var innerNodes = node.descendants(); + + if (opts.inDragLayer) { + innerNodes.forEach(setInDragLayer); + innerNodes.connectedEdges().forEach(setInDragLayer); + } + + if (opts.addToList) { + addToDragList(innerNodes, opts); + } + }; // adds the given nodes and its neighbourhood to the drag layer + + + var addNodesToDrag = function addNodesToDrag(nodes, opts) { + opts = opts || {}; + var hasCompoundNodes = nodes.cy().hasCompoundNodes(); + + if (opts.inDragLayer) { + nodes.forEach(setInDragLayer); + nodes.neighborhood().stdFilter(function (ele) { + return !hasCompoundNodes || ele.isEdge(); + }).forEach(setInDragLayer); + } + + if (opts.addToList) { + nodes.forEach(function (ele) { + addToDragList(ele, opts); + }); + } + + addDescendantsToDrag(nodes, opts); // always add to drag + // also add nodes and edges related to the topmost ancestor + + updateAncestorsInDragLayer(nodes, { + inDragLayer: opts.inDragLayer + }); + r.updateCachedGrabbedEles(); + }; + + var addNodeToDrag = addNodesToDrag; + + var freeDraggedElements = function freeDraggedElements(grabbedEles) { + if (!grabbedEles) { + return; + } // just go over all elements rather than doing a bunch of (possibly expensive) traversals + + + r.getCachedZSortedEles().forEach(function (ele) { + setFreed(ele); + setOutDragLayer(ele); + removeGrabTarget(ele); + }); + r.updateCachedGrabbedEles(); + }; // helper function to determine which ancestor nodes and edges should go + // to the drag layer (or should be removed from drag layer). + + + var updateAncestorsInDragLayer = function updateAncestorsInDragLayer(node, opts) { + if (opts.inDragLayer == null && opts.addToList == null) { + return; + } // nothing to do + + + if (!node.cy().hasCompoundNodes()) { + return; + } // find top-level parent + + + var parent = node.ancestors().orphans(); // no parent node: no nodes to add to the drag layer + + if (parent.same(node)) { + return; + } + + var nodes = parent.descendants().spawnSelf().merge(parent).unmerge(node).unmerge(node.descendants()); + var edges = nodes.connectedEdges(); + + if (opts.inDragLayer) { + edges.forEach(setInDragLayer); + nodes.forEach(setInDragLayer); + } + + if (opts.addToList) { + nodes.forEach(function (ele) { + addToDragList(ele, opts); + }); + } + }; + + var blurActiveDomElement = function blurActiveDomElement() { + if (document.activeElement != null && document.activeElement.blur != null) { + document.activeElement.blur(); + } + }; + + var haveMutationsApi = typeof MutationObserver !== 'undefined'; + var haveResizeObserverApi = typeof ResizeObserver !== 'undefined'; // watch for when the cy container is removed from the dom + + if (haveMutationsApi) { + r.removeObserver = new MutationObserver(function (mutns) { + // eslint-disable-line no-undef + for (var i = 0; i < mutns.length; i++) { + var mutn = mutns[i]; + var rNodes = mutn.removedNodes; + + if (rNodes) { + for (var j = 0; j < rNodes.length; j++) { + var rNode = rNodes[j]; + + if (rNode === r.container) { + r.destroy(); + break; + } + } + } + } + }); + + if (r.container.parentNode) { + r.removeObserver.observe(r.container.parentNode, { + childList: true + }); + } + } else { + r.registerBinding(r.container, 'DOMNodeRemoved', function (e) { + // eslint-disable-line no-unused-vars + r.destroy(); + }); + } + + var onResize = debounce_1(function () { + r.cy.resize(); + }, 100); + + if (haveMutationsApi) { + r.styleObserver = new MutationObserver(onResize); // eslint-disable-line no-undef + + r.styleObserver.observe(r.container, { + attributes: true + }); + } // auto resize + + + r.registerBinding(window, 'resize', onResize); // eslint-disable-line no-undef + + if (haveResizeObserverApi) { + r.resizeObserver = new ResizeObserver(onResize); // eslint-disable-line no-undef + + r.resizeObserver.observe(r.container); + } + + var forEachUp = function forEachUp(domEle, fn) { + while (domEle != null) { + fn(domEle); + domEle = domEle.parentNode; + } + }; + + var invalidateCoords = function invalidateCoords() { + r.invalidateContainerClientCoordsCache(); + }; + + forEachUp(r.container, function (domEle) { + r.registerBinding(domEle, 'transitionend', invalidateCoords); + r.registerBinding(domEle, 'animationend', invalidateCoords); + r.registerBinding(domEle, 'scroll', invalidateCoords); + }); // stop right click menu from appearing on cy + + r.registerBinding(r.container, 'contextmenu', function (e) { + e.preventDefault(); + }); + + var inBoxSelection = function inBoxSelection() { + return r.selection[4] !== 0; + }; + + var eventInContainer = function eventInContainer(e) { + // save cycles if mouse events aren't to be captured + var containerPageCoords = r.findContainerClientCoords(); + var x = containerPageCoords[0]; + var y = containerPageCoords[1]; + var width = containerPageCoords[2]; + var height = containerPageCoords[3]; + var positions = e.touches ? e.touches : [e]; + var atLeastOnePosInside = false; + + for (var i = 0; i < positions.length; i++) { + var p = positions[i]; + + if (x <= p.clientX && p.clientX <= x + width && y <= p.clientY && p.clientY <= y + height) { + atLeastOnePosInside = true; + break; + } + } + + if (!atLeastOnePosInside) { + return false; + } + + var container = r.container; + var target = e.target; + var tParent = target.parentNode; + var containerIsTarget = false; + + while (tParent) { + if (tParent === container) { + containerIsTarget = true; + break; + } + + tParent = tParent.parentNode; + } + + if (!containerIsTarget) { + return false; + } // if target is outisde cy container, then this event is not for us + + + return true; + }; // Primary key + + + r.registerBinding(r.container, 'mousedown', function mousedownHandler(e) { + if (!eventInContainer(e)) { + return; + } + + e.preventDefault(); + blurActiveDomElement(); + r.hoverData.capture = true; + r.hoverData.which = e.which; + var cy = r.cy; + var gpos = [e.clientX, e.clientY]; + var pos = r.projectIntoViewport(gpos[0], gpos[1]); + var select = r.selection; + var nears = r.findNearestElements(pos[0], pos[1], true, false); + var near = nears[0]; + var draggedElements = r.dragData.possibleDragElements; + r.hoverData.mdownPos = pos; + r.hoverData.mdownGPos = gpos; + + var checkForTaphold = function checkForTaphold() { + r.hoverData.tapholdCancelled = false; + clearTimeout(r.hoverData.tapholdTimeout); + r.hoverData.tapholdTimeout = setTimeout(function () { + if (r.hoverData.tapholdCancelled) { + return; + } else { + var ele = r.hoverData.down; + + if (ele) { + ele.emit({ + originalEvent: e, + type: 'taphold', + position: { + x: pos[0], + y: pos[1] + } + }); + } else { + cy.emit({ + originalEvent: e, + type: 'taphold', + position: { + x: pos[0], + y: pos[1] + } + }); + } + } + }, r.tapholdDuration); + }; // Right click button + + + if (e.which == 3) { + r.hoverData.cxtStarted = true; + var cxtEvt = { + originalEvent: e, + type: 'cxttapstart', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (near) { + near.activate(); + near.emit(cxtEvt); + r.hoverData.down = near; + } else { + cy.emit(cxtEvt); + } + + r.hoverData.downTime = new Date().getTime(); + r.hoverData.cxtDragged = false; // Primary button + } else if (e.which == 1) { + if (near) { + near.activate(); + } // Element dragging + + + { + // If something is under the cursor and it is draggable, prepare to grab it + if (near != null) { + if (r.nodeIsGrabbable(near)) { + var makeEvent = function makeEvent(type) { + return { + originalEvent: e, + type: type, + position: { + x: pos[0], + y: pos[1] + } + }; + }; + + var triggerGrab = function triggerGrab(ele) { + ele.emit(makeEvent('grab')); + }; + + setGrabTarget(near); + + if (!near.selected()) { + draggedElements = r.dragData.possibleDragElements = cy.collection(); + addNodeToDrag(near, { + addToList: draggedElements + }); + near.emit(makeEvent('grabon')).emit(makeEvent('grab')); + } else { + draggedElements = r.dragData.possibleDragElements = cy.collection(); + var selectedNodes = cy.$(function (ele) { + return ele.isNode() && ele.selected() && r.nodeIsGrabbable(ele); + }); + addNodesToDrag(selectedNodes, { + addToList: draggedElements + }); + near.emit(makeEvent('grabon')); + selectedNodes.forEach(triggerGrab); + } + + r.redrawHint('eles', true); + r.redrawHint('drag', true); + } + } + + r.hoverData.down = near; + r.hoverData.downs = nears; + r.hoverData.downTime = new Date().getTime(); + } + triggerEvents(near, ['mousedown', 'tapstart', 'vmousedown'], e, { + x: pos[0], + y: pos[1] + }); + + if (near == null) { + select[4] = 1; + r.data.bgActivePosistion = { + x: pos[0], + y: pos[1] + }; + r.redrawHint('select', true); + r.redraw(); + } else if (near.pannable()) { + select[4] = 1; // for future pan + } + + checkForTaphold(); + } // Initialize selection box coordinates + + + select[0] = select[2] = pos[0]; + select[1] = select[3] = pos[1]; + }, false); + r.registerBinding(window, 'mousemove', function mousemoveHandler(e) { + // eslint-disable-line no-undef + var capture = r.hoverData.capture; + + if (!capture && !eventInContainer(e)) { + return; + } + + var preventDefault = false; + var cy = r.cy; + var zoom = cy.zoom(); + var gpos = [e.clientX, e.clientY]; + var pos = r.projectIntoViewport(gpos[0], gpos[1]); + var mdownPos = r.hoverData.mdownPos; + var mdownGPos = r.hoverData.mdownGPos; + var select = r.selection; + var near = null; + + if (!r.hoverData.draggingEles && !r.hoverData.dragging && !r.hoverData.selecting) { + near = r.findNearestElement(pos[0], pos[1], true, false); + } + + var last = r.hoverData.last; + var down = r.hoverData.down; + var disp = [pos[0] - select[2], pos[1] - select[3]]; + var draggedElements = r.dragData.possibleDragElements; + var isOverThresholdDrag; + + if (mdownGPos) { + var dx = gpos[0] - mdownGPos[0]; + var dx2 = dx * dx; + var dy = gpos[1] - mdownGPos[1]; + var dy2 = dy * dy; + var dist2 = dx2 + dy2; + r.hoverData.isOverThresholdDrag = isOverThresholdDrag = dist2 >= r.desktopTapThreshold2; + } + + var multSelKeyDown = isMultSelKeyDown(e); + + if (isOverThresholdDrag) { + r.hoverData.tapholdCancelled = true; + } + + var updateDragDelta = function updateDragDelta() { + var dragDelta = r.hoverData.dragDelta = r.hoverData.dragDelta || []; + + if (dragDelta.length === 0) { + dragDelta.push(disp[0]); + dragDelta.push(disp[1]); + } else { + dragDelta[0] += disp[0]; + dragDelta[1] += disp[1]; + } + }; + + preventDefault = true; + triggerEvents(near, ['mousemove', 'vmousemove', 'tapdrag'], e, { + x: pos[0], + y: pos[1] + }); + + var goIntoBoxMode = function goIntoBoxMode() { + r.data.bgActivePosistion = undefined; + + if (!r.hoverData.selecting) { + cy.emit({ + originalEvent: e, + type: 'boxstart', + position: { + x: pos[0], + y: pos[1] + } + }); + } + + select[4] = 1; + r.hoverData.selecting = true; + r.redrawHint('select', true); + r.redraw(); + }; // trigger context drag if rmouse down + + + if (r.hoverData.which === 3) { + // but only if over threshold + if (isOverThresholdDrag) { + var cxtEvt = { + originalEvent: e, + type: 'cxtdrag', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (down) { + down.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + + r.hoverData.cxtDragged = true; + + if (!r.hoverData.cxtOver || near !== r.hoverData.cxtOver) { + if (r.hoverData.cxtOver) { + r.hoverData.cxtOver.emit({ + originalEvent: e, + type: 'cxtdragout', + position: { + x: pos[0], + y: pos[1] + } + }); + } + + r.hoverData.cxtOver = near; + + if (near) { + near.emit({ + originalEvent: e, + type: 'cxtdragover', + position: { + x: pos[0], + y: pos[1] + } + }); + } + } + } // Check if we are drag panning the entire graph + + } else if (r.hoverData.dragging) { + preventDefault = true; + + if (cy.panningEnabled() && cy.userPanningEnabled()) { + var deltaP; + + if (r.hoverData.justStartedPan) { + var mdPos = r.hoverData.mdownPos; + deltaP = { + x: (pos[0] - mdPos[0]) * zoom, + y: (pos[1] - mdPos[1]) * zoom + }; + r.hoverData.justStartedPan = false; + } else { + deltaP = { + x: disp[0] * zoom, + y: disp[1] * zoom + }; + } + + cy.panBy(deltaP); + cy.emit('dragpan'); + r.hoverData.dragged = true; + } // Needs reproject due to pan changing viewport + + + pos = r.projectIntoViewport(e.clientX, e.clientY); // Checks primary button down & out of time & mouse not moved much + } else if (select[4] == 1 && (down == null || down.pannable())) { + if (isOverThresholdDrag) { + if (!r.hoverData.dragging && cy.boxSelectionEnabled() && (multSelKeyDown || !cy.panningEnabled() || !cy.userPanningEnabled())) { + goIntoBoxMode(); + } else if (!r.hoverData.selecting && cy.panningEnabled() && cy.userPanningEnabled()) { + var allowPassthrough = allowPanningPassthrough(down, r.hoverData.downs); + + if (allowPassthrough) { + r.hoverData.dragging = true; + r.hoverData.justStartedPan = true; + select[4] = 0; + r.data.bgActivePosistion = array2point(mdownPos); + r.redrawHint('select', true); + r.redraw(); + } + } + + if (down && down.pannable() && down.active()) { + down.unactivate(); + } + } + } else { + if (down && down.pannable() && down.active()) { + down.unactivate(); + } + + if ((!down || !down.grabbed()) && near != last) { + if (last) { + triggerEvents(last, ['mouseout', 'tapdragout'], e, { + x: pos[0], + y: pos[1] + }); + } + + if (near) { + triggerEvents(near, ['mouseover', 'tapdragover'], e, { + x: pos[0], + y: pos[1] + }); + } + + r.hoverData.last = near; + } + + if (down) { + if (isOverThresholdDrag) { + // then we can take action + if (cy.boxSelectionEnabled() && multSelKeyDown) { + // then selection overrides + if (down && down.grabbed()) { + freeDraggedElements(draggedElements); + down.emit('freeon'); + draggedElements.emit('free'); + + if (r.dragData.didDrag) { + down.emit('dragfreeon'); + draggedElements.emit('dragfree'); + } + } + + goIntoBoxMode(); + } else if (down && down.grabbed() && r.nodeIsDraggable(down)) { + // drag node + var justStartedDrag = !r.dragData.didDrag; + + if (justStartedDrag) { + r.redrawHint('eles', true); + } + + r.dragData.didDrag = true; // indicate that we actually did drag the node + // now, add the elements to the drag layer if not done already + + if (!r.hoverData.draggingEles) { + addNodesToDrag(draggedElements, { + inDragLayer: true + }); + } + + var totalShift = { + x: 0, + y: 0 + }; + + if (number$1(disp[0]) && number$1(disp[1])) { + totalShift.x += disp[0]; + totalShift.y += disp[1]; + + if (justStartedDrag) { + var dragDelta = r.hoverData.dragDelta; + + if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) { + totalShift.x += dragDelta[0]; + totalShift.y += dragDelta[1]; + } + } + } + + r.hoverData.draggingEles = true; + draggedElements.silentShift(totalShift).emit('position drag'); + r.redrawHint('drag', true); + r.redraw(); + } + } else { + // otherwise save drag delta for when we actually start dragging so the relative grab pos is constant + updateDragDelta(); + } + } // prevent the dragging from triggering text selection on the page + + + preventDefault = true; + } + + select[2] = pos[0]; + select[3] = pos[1]; + + if (preventDefault) { + if (e.stopPropagation) e.stopPropagation(); + if (e.preventDefault) e.preventDefault(); + return false; + } + }, false); + var clickTimeout, didDoubleClick, prevClickTimeStamp; + r.registerBinding(window, 'mouseup', function mouseupHandler(e) { + // eslint-disable-line no-undef + var capture = r.hoverData.capture; + + if (!capture) { + return; + } + + r.hoverData.capture = false; + var cy = r.cy; + var pos = r.projectIntoViewport(e.clientX, e.clientY); + var select = r.selection; + var near = r.findNearestElement(pos[0], pos[1], true, false); + var draggedElements = r.dragData.possibleDragElements; + var down = r.hoverData.down; + var multSelKeyDown = isMultSelKeyDown(e); + + if (r.data.bgActivePosistion) { + r.redrawHint('select', true); + r.redraw(); + } + + r.hoverData.tapholdCancelled = true; + r.data.bgActivePosistion = undefined; // not active bg now + + if (down) { + down.unactivate(); + } + + if (r.hoverData.which === 3) { + var cxtEvt = { + originalEvent: e, + type: 'cxttapend', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (down) { + down.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + + if (!r.hoverData.cxtDragged) { + var cxtTap = { + originalEvent: e, + type: 'cxttap', + position: { + x: pos[0], + y: pos[1] + } + }; + + if (down) { + down.emit(cxtTap); + } else { + cy.emit(cxtTap); + } + } + + r.hoverData.cxtDragged = false; + r.hoverData.which = null; + } else if (r.hoverData.which === 1) { + triggerEvents(near, ['mouseup', 'tapend', 'vmouseup'], e, { + x: pos[0], + y: pos[1] + }); + + if (!r.dragData.didDrag && // didn't move a node around + !r.hoverData.dragged && // didn't pan + !r.hoverData.selecting && // not box selection + !r.hoverData.isOverThresholdDrag // didn't move too much + ) { + triggerEvents(down, ["click", "tap", "vclick"], e, { + x: pos[0], + y: pos[1] + }); + didDoubleClick = false; + + if (e.timeStamp - prevClickTimeStamp <= cy.multiClickDebounceTime()) { + clickTimeout && clearTimeout(clickTimeout); + didDoubleClick = true; + prevClickTimeStamp = null; + triggerEvents(down, ["dblclick", "dbltap", "vdblclick"], e, { + x: pos[0], + y: pos[1] + }); + } else { + clickTimeout = setTimeout(function () { + if (didDoubleClick) return; + triggerEvents(down, ["oneclick", "onetap", "voneclick"], e, { + x: pos[0], + y: pos[1] + }); + }, cy.multiClickDebounceTime()); + prevClickTimeStamp = e.timeStamp; + } + } // Deselect all elements if nothing is currently under the mouse cursor and we aren't dragging something + + + if (down == null // not mousedown on node + && !r.dragData.didDrag // didn't move the node around + && !r.hoverData.selecting // not box selection + && !r.hoverData.dragged // didn't pan + && !isMultSelKeyDown(e)) { + cy.$(isSelected).unselect(['tapunselect']); + + if (draggedElements.length > 0) { + r.redrawHint('eles', true); + } + + r.dragData.possibleDragElements = draggedElements = cy.collection(); + } // Single selection + + + if (near == down && !r.dragData.didDrag && !r.hoverData.selecting) { + if (near != null && near._private.selectable) { + if (r.hoverData.dragging) ; else if (cy.selectionType() === 'additive' || multSelKeyDown) { + if (near.selected()) { + near.unselect(['tapunselect']); + } else { + near.select(['tapselect']); + } + } else { + if (!multSelKeyDown) { + cy.$(isSelected).unmerge(near).unselect(['tapunselect']); + near.select(['tapselect']); + } + } + + r.redrawHint('eles', true); + } + } + + if (r.hoverData.selecting) { + var box = cy.collection(r.getAllInBox(select[0], select[1], select[2], select[3])); + r.redrawHint('select', true); + + if (box.length > 0) { + r.redrawHint('eles', true); + } + + cy.emit({ + type: 'boxend', + originalEvent: e, + position: { + x: pos[0], + y: pos[1] + } + }); + + var eleWouldBeSelected = function eleWouldBeSelected(ele) { + return ele.selectable() && !ele.selected(); + }; + + if (cy.selectionType() === 'additive') { + box.emit('box').stdFilter(eleWouldBeSelected).select().emit('boxselect'); + } else { + if (!multSelKeyDown) { + cy.$(isSelected).unmerge(box).unselect(); + } + + box.emit('box').stdFilter(eleWouldBeSelected).select().emit('boxselect'); + } // always need redraw in case eles unselectable + + + r.redraw(); + } // Cancel drag pan + + + if (r.hoverData.dragging) { + r.hoverData.dragging = false; + r.redrawHint('select', true); + r.redrawHint('eles', true); + r.redraw(); + } + + if (!select[4]) { + r.redrawHint('drag', true); + r.redrawHint('eles', true); + var downWasGrabbed = down && down.grabbed(); + freeDraggedElements(draggedElements); + + if (downWasGrabbed) { + down.emit('freeon'); + draggedElements.emit('free'); + + if (r.dragData.didDrag) { + down.emit('dragfreeon'); + draggedElements.emit('dragfree'); + } + } + } + } // else not right mouse + + + select[4] = 0; + r.hoverData.down = null; + r.hoverData.cxtStarted = false; + r.hoverData.draggingEles = false; + r.hoverData.selecting = false; + r.hoverData.isOverThresholdDrag = false; + r.dragData.didDrag = false; + r.hoverData.dragged = false; + r.hoverData.dragDelta = []; + r.hoverData.mdownPos = null; + r.hoverData.mdownGPos = null; + }, false); + + var wheelHandler = function wheelHandler(e) { + if (r.scrollingPage) { + return; + } // while scrolling, ignore wheel-to-zoom + + + var cy = r.cy; + var zoom = cy.zoom(); + var pan = cy.pan(); + var pos = r.projectIntoViewport(e.clientX, e.clientY); + var rpos = [pos[0] * zoom + pan.x, pos[1] * zoom + pan.y]; + + if (r.hoverData.draggingEles || r.hoverData.dragging || r.hoverData.cxtStarted || inBoxSelection()) { + // if pan dragging or cxt dragging, wheel movements make no zoom + e.preventDefault(); + return; + } + + if (cy.panningEnabled() && cy.userPanningEnabled() && cy.zoomingEnabled() && cy.userZoomingEnabled()) { + e.preventDefault(); + r.data.wheelZooming = true; + clearTimeout(r.data.wheelTimeout); + r.data.wheelTimeout = setTimeout(function () { + r.data.wheelZooming = false; + r.redrawHint('eles', true); + r.redraw(); + }, 150); + var diff; + + if (e.deltaY != null) { + diff = e.deltaY / -250; + } else if (e.wheelDeltaY != null) { + diff = e.wheelDeltaY / 1000; + } else { + diff = e.wheelDelta / 1000; + } + + diff = diff * r.wheelSensitivity; + var needsWheelFix = e.deltaMode === 1; + + if (needsWheelFix) { + // fixes slow wheel events on ff/linux and ff/windows + diff *= 33; + } + + var newZoom = cy.zoom() * Math.pow(10, diff); + + if (e.type === 'gesturechange') { + newZoom = r.gestureStartZoom * e.scale; + } + + cy.zoom({ + level: newZoom, + renderedPosition: { + x: rpos[0], + y: rpos[1] + } + }); + cy.emit(e.type === 'gesturechange' ? 'pinchzoom' : 'scrollzoom'); + } + }; // Functions to help with whether mouse wheel should trigger zooming + // -- + + + r.registerBinding(r.container, 'wheel', wheelHandler, true); // disable nonstandard wheel events + // r.registerBinding(r.container, 'mousewheel', wheelHandler, true); + // r.registerBinding(r.container, 'DOMMouseScroll', wheelHandler, true); + // r.registerBinding(r.container, 'MozMousePixelScroll', wheelHandler, true); // older firefox + + r.registerBinding(window, 'scroll', function scrollHandler(e) { + // eslint-disable-line no-unused-vars + r.scrollingPage = true; + clearTimeout(r.scrollingPageTimeout); + r.scrollingPageTimeout = setTimeout(function () { + r.scrollingPage = false; + }, 250); + }, true); // desktop safari pinch to zoom start + + r.registerBinding(r.container, 'gesturestart', function gestureStartHandler(e) { + r.gestureStartZoom = r.cy.zoom(); + + if (!r.hasTouchStarted) { + // don't affect touch devices like iphone + e.preventDefault(); + } + }, true); + r.registerBinding(r.container, 'gesturechange', function (e) { + if (!r.hasTouchStarted) { + // don't affect touch devices like iphone + wheelHandler(e); + } + }, true); // Functions to help with handling mouseout/mouseover on the Cytoscape container + // Handle mouseout on Cytoscape container + + r.registerBinding(r.container, 'mouseout', function mouseOutHandler(e) { + var pos = r.projectIntoViewport(e.clientX, e.clientY); + r.cy.emit({ + originalEvent: e, + type: 'mouseout', + position: { + x: pos[0], + y: pos[1] + } + }); + }, false); + r.registerBinding(r.container, 'mouseover', function mouseOverHandler(e) { + var pos = r.projectIntoViewport(e.clientX, e.clientY); + r.cy.emit({ + originalEvent: e, + type: 'mouseover', + position: { + x: pos[0], + y: pos[1] + } + }); + }, false); + var f1x1, f1y1, f2x1, f2y1; // starting points for pinch-to-zoom + + var distance1, distance1Sq; // initial distance between finger 1 and finger 2 for pinch-to-zoom + + var center1, modelCenter1; // center point on start pinch to zoom + + var offsetLeft, offsetTop; + var containerWidth, containerHeight; + var twoFingersStartInside; + + var distance = function distance(x1, y1, x2, y2) { + return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); + }; + + var distanceSq = function distanceSq(x1, y1, x2, y2) { + return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); + }; + + var touchstartHandler; + r.registerBinding(r.container, 'touchstart', touchstartHandler = function touchstartHandler(e) { + r.hasTouchStarted = true; + + if (!eventInContainer(e)) { + return; + } + + blurActiveDomElement(); + r.touchData.capture = true; + r.data.bgActivePosistion = undefined; + var cy = r.cy; + var now = r.touchData.now; + var earlier = r.touchData.earlier; + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } // record starting points for pinch-to-zoom + + + if (e.touches[1]) { + r.touchData.singleTouchMoved = true; + freeDraggedElements(r.dragData.touchDragEles); + var offsets = r.findContainerClientCoords(); + offsetLeft = offsets[0]; + offsetTop = offsets[1]; + containerWidth = offsets[2]; + containerHeight = offsets[3]; + f1x1 = e.touches[0].clientX - offsetLeft; + f1y1 = e.touches[0].clientY - offsetTop; + f2x1 = e.touches[1].clientX - offsetLeft; + f2y1 = e.touches[1].clientY - offsetTop; + twoFingersStartInside = 0 <= f1x1 && f1x1 <= containerWidth && 0 <= f2x1 && f2x1 <= containerWidth && 0 <= f1y1 && f1y1 <= containerHeight && 0 <= f2y1 && f2y1 <= containerHeight; + var pan = cy.pan(); + var zoom = cy.zoom(); + distance1 = distance(f1x1, f1y1, f2x1, f2y1); + distance1Sq = distanceSq(f1x1, f1y1, f2x1, f2y1); + center1 = [(f1x1 + f2x1) / 2, (f1y1 + f2y1) / 2]; + modelCenter1 = [(center1[0] - pan.x) / zoom, (center1[1] - pan.y) / zoom]; // consider context tap + + var cxtDistThreshold = 200; + var cxtDistThresholdSq = cxtDistThreshold * cxtDistThreshold; + + if (distance1Sq < cxtDistThresholdSq && !e.touches[2]) { + var near1 = r.findNearestElement(now[0], now[1], true, true); + var near2 = r.findNearestElement(now[2], now[3], true, true); + + if (near1 && near1.isNode()) { + near1.activate().emit({ + originalEvent: e, + type: 'cxttapstart', + position: { + x: now[0], + y: now[1] + } + }); + r.touchData.start = near1; + } else if (near2 && near2.isNode()) { + near2.activate().emit({ + originalEvent: e, + type: 'cxttapstart', + position: { + x: now[0], + y: now[1] + } + }); + r.touchData.start = near2; + } else { + cy.emit({ + originalEvent: e, + type: 'cxttapstart', + position: { + x: now[0], + y: now[1] + } + }); + } + + if (r.touchData.start) { + r.touchData.start._private.grabbed = false; + } + + r.touchData.cxt = true; + r.touchData.cxtDragged = false; + r.data.bgActivePosistion = undefined; + r.redraw(); + return; + } + } + + if (e.touches[2]) { + // ignore + // safari on ios pans the page otherwise (normally you should be able to preventdefault on touchmove...) + if (cy.boxSelectionEnabled()) { + e.preventDefault(); + } + } else if (e.touches[1]) ; else if (e.touches[0]) { + var nears = r.findNearestElements(now[0], now[1], true, true); + var near = nears[0]; + + if (near != null) { + near.activate(); + r.touchData.start = near; + r.touchData.starts = nears; + + if (r.nodeIsGrabbable(near)) { + var draggedEles = r.dragData.touchDragEles = cy.collection(); + var selectedNodes = null; + r.redrawHint('eles', true); + r.redrawHint('drag', true); + + if (near.selected()) { + // reset drag elements, since near will be added again + selectedNodes = cy.$(function (ele) { + return ele.selected() && r.nodeIsGrabbable(ele); + }); + addNodesToDrag(selectedNodes, { + addToList: draggedEles + }); + } else { + addNodeToDrag(near, { + addToList: draggedEles + }); + } + + setGrabTarget(near); + + var makeEvent = function makeEvent(type) { + return { + originalEvent: e, + type: type, + position: { + x: now[0], + y: now[1] + } + }; + }; + + near.emit(makeEvent('grabon')); + + if (selectedNodes) { + selectedNodes.forEach(function (n) { + n.emit(makeEvent('grab')); + }); + } else { + near.emit(makeEvent('grab')); + } + } + } + + triggerEvents(near, ['touchstart', 'tapstart', 'vmousedown'], e, { + x: now[0], + y: now[1] + }); + + if (near == null) { + r.data.bgActivePosistion = { + x: pos[0], + y: pos[1] + }; + r.redrawHint('select', true); + r.redraw(); + } // Tap, taphold + // ----- + + + r.touchData.singleTouchMoved = false; + r.touchData.singleTouchStartTime = +new Date(); + clearTimeout(r.touchData.tapholdTimeout); + r.touchData.tapholdTimeout = setTimeout(function () { + if (r.touchData.singleTouchMoved === false && !r.pinching // if pinching, then taphold unselect shouldn't take effect + && !r.touchData.selecting // box selection shouldn't allow taphold through + ) { + triggerEvents(r.touchData.start, ['taphold'], e, { + x: now[0], + y: now[1] + }); + } + }, r.tapholdDuration); + } + + if (e.touches.length >= 1) { + var sPos = r.touchData.startPosition = []; + + for (var i = 0; i < now.length; i++) { + sPos[i] = earlier[i] = now[i]; + } + + var touch0 = e.touches[0]; + r.touchData.startGPosition = [touch0.clientX, touch0.clientY]; + } + }, false); + var touchmoveHandler; + r.registerBinding(window, 'touchmove', touchmoveHandler = function touchmoveHandler(e) { + // eslint-disable-line no-undef + var capture = r.touchData.capture; + + if (!capture && !eventInContainer(e)) { + return; + } + + var select = r.selection; + var cy = r.cy; + var now = r.touchData.now; + var earlier = r.touchData.earlier; + var zoom = cy.zoom(); + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } + + var startGPos = r.touchData.startGPosition; + var isOverThresholdDrag; + + if (capture && e.touches[0] && startGPos) { + var disp = []; + + for (var j = 0; j < now.length; j++) { + disp[j] = now[j] - earlier[j]; + } + + var dx = e.touches[0].clientX - startGPos[0]; + var dx2 = dx * dx; + var dy = e.touches[0].clientY - startGPos[1]; + var dy2 = dy * dy; + var dist2 = dx2 + dy2; + isOverThresholdDrag = dist2 >= r.touchTapThreshold2; + } // context swipe cancelling + + + if (capture && r.touchData.cxt) { + e.preventDefault(); + var f1x2 = e.touches[0].clientX - offsetLeft, + f1y2 = e.touches[0].clientY - offsetTop; + var f2x2 = e.touches[1].clientX - offsetLeft, + f2y2 = e.touches[1].clientY - offsetTop; // var distance2 = distance( f1x2, f1y2, f2x2, f2y2 ); + + var distance2Sq = distanceSq(f1x2, f1y2, f2x2, f2y2); + var factorSq = distance2Sq / distance1Sq; + var distThreshold = 150; + var distThresholdSq = distThreshold * distThreshold; + var factorThreshold = 1.5; + var factorThresholdSq = factorThreshold * factorThreshold; // cancel ctx gestures if the distance b/t the fingers increases + + if (factorSq >= factorThresholdSq || distance2Sq >= distThresholdSq) { + r.touchData.cxt = false; + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + var cxtEvt = { + originalEvent: e, + type: 'cxttapend', + position: { + x: now[0], + y: now[1] + } + }; + + if (r.touchData.start) { + r.touchData.start.unactivate().emit(cxtEvt); + r.touchData.start = null; + } else { + cy.emit(cxtEvt); + } + } + } // context swipe + + + if (capture && r.touchData.cxt) { + var cxtEvt = { + originalEvent: e, + type: 'cxtdrag', + position: { + x: now[0], + y: now[1] + } + }; + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + + if (r.touchData.start) { + r.touchData.start.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + + if (r.touchData.start) { + r.touchData.start._private.grabbed = false; + } + + r.touchData.cxtDragged = true; + var near = r.findNearestElement(now[0], now[1], true, true); + + if (!r.touchData.cxtOver || near !== r.touchData.cxtOver) { + if (r.touchData.cxtOver) { + r.touchData.cxtOver.emit({ + originalEvent: e, + type: 'cxtdragout', + position: { + x: now[0], + y: now[1] + } + }); + } + + r.touchData.cxtOver = near; + + if (near) { + near.emit({ + originalEvent: e, + type: 'cxtdragover', + position: { + x: now[0], + y: now[1] + } + }); + } + } // box selection + + } else if (capture && e.touches[2] && cy.boxSelectionEnabled()) { + e.preventDefault(); + r.data.bgActivePosistion = undefined; + this.lastThreeTouch = +new Date(); + + if (!r.touchData.selecting) { + cy.emit({ + originalEvent: e, + type: 'boxstart', + position: { + x: now[0], + y: now[1] + } + }); + } + + r.touchData.selecting = true; + r.touchData.didSelect = true; + select[4] = 1; + + if (!select || select.length === 0 || select[0] === undefined) { + select[0] = (now[0] + now[2] + now[4]) / 3; + select[1] = (now[1] + now[3] + now[5]) / 3; + select[2] = (now[0] + now[2] + now[4]) / 3 + 1; + select[3] = (now[1] + now[3] + now[5]) / 3 + 1; + } else { + select[2] = (now[0] + now[2] + now[4]) / 3; + select[3] = (now[1] + now[3] + now[5]) / 3; + } + + r.redrawHint('select', true); + r.redraw(); // pinch to zoom + } else if (capture && e.touches[1] && !r.touchData.didSelect // don't allow box selection to degrade to pinch-to-zoom + && cy.zoomingEnabled() && cy.panningEnabled() && cy.userZoomingEnabled() && cy.userPanningEnabled()) { + // two fingers => pinch to zoom + e.preventDefault(); + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + var draggedEles = r.dragData.touchDragEles; + + if (draggedEles) { + r.redrawHint('drag', true); + + for (var i = 0; i < draggedEles.length; i++) { + var de_p = draggedEles[i]._private; + de_p.grabbed = false; + de_p.rscratch.inDragLayer = false; + } + } + + var _start = r.touchData.start; // (x2, y2) for fingers 1 and 2 + + var f1x2 = e.touches[0].clientX - offsetLeft, + f1y2 = e.touches[0].clientY - offsetTop; + var f2x2 = e.touches[1].clientX - offsetLeft, + f2y2 = e.touches[1].clientY - offsetTop; + var distance2 = distance(f1x2, f1y2, f2x2, f2y2); // var distance2Sq = distanceSq( f1x2, f1y2, f2x2, f2y2 ); + // var factor = Math.sqrt( distance2Sq ) / Math.sqrt( distance1Sq ); + + var factor = distance2 / distance1; + + if (twoFingersStartInside) { + // delta finger1 + var df1x = f1x2 - f1x1; + var df1y = f1y2 - f1y1; // delta finger 2 + + var df2x = f2x2 - f2x1; + var df2y = f2y2 - f2y1; // translation is the normalised vector of the two fingers movement + // i.e. so pinching cancels out and moving together pans + + var tx = (df1x + df2x) / 2; + var ty = (df1y + df2y) / 2; // now calculate the zoom + + var zoom1 = cy.zoom(); + var zoom2 = zoom1 * factor; + var pan1 = cy.pan(); // the model center point converted to the current rendered pos + + var ctrx = modelCenter1[0] * zoom1 + pan1.x; + var ctry = modelCenter1[1] * zoom1 + pan1.y; + var pan2 = { + x: -zoom2 / zoom1 * (ctrx - pan1.x - tx) + ctrx, + y: -zoom2 / zoom1 * (ctry - pan1.y - ty) + ctry + }; // remove dragged eles + + if (_start && _start.active()) { + var draggedEles = r.dragData.touchDragEles; + freeDraggedElements(draggedEles); + r.redrawHint('drag', true); + r.redrawHint('eles', true); + + _start.unactivate().emit('freeon'); + + draggedEles.emit('free'); + + if (r.dragData.didDrag) { + _start.emit('dragfreeon'); + + draggedEles.emit('dragfree'); + } + } + + cy.viewport({ + zoom: zoom2, + pan: pan2, + cancelOnFailedZoom: true + }); + cy.emit('pinchzoom'); + distance1 = distance2; + f1x1 = f1x2; + f1y1 = f1y2; + f2x1 = f2x2; + f2y1 = f2y2; + r.pinching = true; + } // Re-project + + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } + } else if (e.touches[0] && !r.touchData.didSelect // don't allow box selection to degrade to single finger events like panning + ) { + var start = r.touchData.start; + var last = r.touchData.last; + var near; + + if (!r.hoverData.draggingEles && !r.swipePanning) { + near = r.findNearestElement(now[0], now[1], true, true); + } + + if (capture && start != null) { + e.preventDefault(); + } // dragging nodes + + + if (capture && start != null && r.nodeIsDraggable(start)) { + if (isOverThresholdDrag) { + // then dragging can happen + var draggedEles = r.dragData.touchDragEles; + var justStartedDrag = !r.dragData.didDrag; + + if (justStartedDrag) { + addNodesToDrag(draggedEles, { + inDragLayer: true + }); + } + + r.dragData.didDrag = true; + var totalShift = { + x: 0, + y: 0 + }; + + if (number$1(disp[0]) && number$1(disp[1])) { + totalShift.x += disp[0]; + totalShift.y += disp[1]; + + if (justStartedDrag) { + r.redrawHint('eles', true); + var dragDelta = r.touchData.dragDelta; + + if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) { + totalShift.x += dragDelta[0]; + totalShift.y += dragDelta[1]; + } + } + } + + r.hoverData.draggingEles = true; + draggedEles.silentShift(totalShift).emit('position drag'); + r.redrawHint('drag', true); + + if (r.touchData.startPosition[0] == earlier[0] && r.touchData.startPosition[1] == earlier[1]) { + r.redrawHint('eles', true); + } + + r.redraw(); + } else { + // otherwise keep track of drag delta for later + var dragDelta = r.touchData.dragDelta = r.touchData.dragDelta || []; + + if (dragDelta.length === 0) { + dragDelta.push(disp[0]); + dragDelta.push(disp[1]); + } else { + dragDelta[0] += disp[0]; + dragDelta[1] += disp[1]; + } + } + } // touchmove + + + { + triggerEvents(start || near, ['touchmove', 'tapdrag', 'vmousemove'], e, { + x: now[0], + y: now[1] + }); + + if ((!start || !start.grabbed()) && near != last) { + if (last) { + last.emit({ + originalEvent: e, + type: 'tapdragout', + position: { + x: now[0], + y: now[1] + } + }); + } + + if (near) { + near.emit({ + originalEvent: e, + type: 'tapdragover', + position: { + x: now[0], + y: now[1] + } + }); + } + } + + r.touchData.last = near; + } // check to cancel taphold + + if (capture) { + for (var i = 0; i < now.length; i++) { + if (now[i] && r.touchData.startPosition[i] && isOverThresholdDrag) { + r.touchData.singleTouchMoved = true; + } + } + } // panning + + + if (capture && (start == null || start.pannable()) && cy.panningEnabled() && cy.userPanningEnabled()) { + var allowPassthrough = allowPanningPassthrough(start, r.touchData.starts); + + if (allowPassthrough) { + e.preventDefault(); + + if (!r.data.bgActivePosistion) { + r.data.bgActivePosistion = array2point(r.touchData.startPosition); + } + + if (r.swipePanning) { + cy.panBy({ + x: disp[0] * zoom, + y: disp[1] * zoom + }); + cy.emit('dragpan'); + } else if (isOverThresholdDrag) { + r.swipePanning = true; + cy.panBy({ + x: dx * zoom, + y: dy * zoom + }); + cy.emit('dragpan'); + + if (start) { + start.unactivate(); + r.redrawHint('select', true); + r.touchData.start = null; + } + } + } // Re-project + + + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + } + + for (var j = 0; j < now.length; j++) { + earlier[j] = now[j]; + } // the active bg indicator should be removed when making a swipe that is neither for dragging nodes or panning + + + if (capture && e.touches.length > 0 && !r.hoverData.draggingEles && !r.swipePanning && r.data.bgActivePosistion != null) { + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + r.redraw(); + } + }, false); + var touchcancelHandler; + r.registerBinding(window, 'touchcancel', touchcancelHandler = function touchcancelHandler(e) { + // eslint-disable-line no-unused-vars + var start = r.touchData.start; + r.touchData.capture = false; + + if (start) { + start.unactivate(); + } + }); + var touchendHandler, didDoubleTouch, touchTimeout, prevTouchTimeStamp; + r.registerBinding(window, 'touchend', touchendHandler = function touchendHandler(e) { + // eslint-disable-line no-unused-vars + var start = r.touchData.start; + var capture = r.touchData.capture; + + if (capture) { + if (e.touches.length === 0) { + r.touchData.capture = false; + } + + e.preventDefault(); + } else { + return; + } + + var select = r.selection; + r.swipePanning = false; + r.hoverData.draggingEles = false; + var cy = r.cy; + var zoom = cy.zoom(); + var now = r.touchData.now; + var earlier = r.touchData.earlier; + + if (e.touches[0]) { + var pos = r.projectIntoViewport(e.touches[0].clientX, e.touches[0].clientY); + now[0] = pos[0]; + now[1] = pos[1]; + } + + if (e.touches[1]) { + var pos = r.projectIntoViewport(e.touches[1].clientX, e.touches[1].clientY); + now[2] = pos[0]; + now[3] = pos[1]; + } + + if (e.touches[2]) { + var pos = r.projectIntoViewport(e.touches[2].clientX, e.touches[2].clientY); + now[4] = pos[0]; + now[5] = pos[1]; + } + + if (start) { + start.unactivate(); + } + + var ctxTapend; + + if (r.touchData.cxt) { + ctxTapend = { + originalEvent: e, + type: 'cxttapend', + position: { + x: now[0], + y: now[1] + } + }; + + if (start) { + start.emit(ctxTapend); + } else { + cy.emit(ctxTapend); + } + + if (!r.touchData.cxtDragged) { + var ctxTap = { + originalEvent: e, + type: 'cxttap', + position: { + x: now[0], + y: now[1] + } + }; + + if (start) { + start.emit(ctxTap); + } else { + cy.emit(ctxTap); + } + } + + if (r.touchData.start) { + r.touchData.start._private.grabbed = false; + } + + r.touchData.cxt = false; + r.touchData.start = null; + r.redraw(); + return; + } // no more box selection if we don't have three fingers + + + if (!e.touches[2] && cy.boxSelectionEnabled() && r.touchData.selecting) { + r.touchData.selecting = false; + var box = cy.collection(r.getAllInBox(select[0], select[1], select[2], select[3])); + select[0] = undefined; + select[1] = undefined; + select[2] = undefined; + select[3] = undefined; + select[4] = 0; + r.redrawHint('select', true); + cy.emit({ + type: 'boxend', + originalEvent: e, + position: { + x: now[0], + y: now[1] + } + }); + + var eleWouldBeSelected = function eleWouldBeSelected(ele) { + return ele.selectable() && !ele.selected(); + }; + + box.emit('box').stdFilter(eleWouldBeSelected).select().emit('boxselect'); + + if (box.nonempty()) { + r.redrawHint('eles', true); + } + + r.redraw(); + } + + if (start != null) { + start.unactivate(); + } + + if (e.touches[2]) { + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + } else if (e.touches[1]) ; else if (e.touches[0]) ; else if (!e.touches[0]) { + r.data.bgActivePosistion = undefined; + r.redrawHint('select', true); + var draggedEles = r.dragData.touchDragEles; + + if (start != null) { + var startWasGrabbed = start._private.grabbed; + freeDraggedElements(draggedEles); + r.redrawHint('drag', true); + r.redrawHint('eles', true); + + if (startWasGrabbed) { + start.emit('freeon'); + draggedEles.emit('free'); + + if (r.dragData.didDrag) { + start.emit('dragfreeon'); + draggedEles.emit('dragfree'); + } + } + + triggerEvents(start, ['touchend', 'tapend', 'vmouseup', 'tapdragout'], e, { + x: now[0], + y: now[1] + }); + start.unactivate(); + r.touchData.start = null; + } else { + var near = r.findNearestElement(now[0], now[1], true, true); + triggerEvents(near, ['touchend', 'tapend', 'vmouseup', 'tapdragout'], e, { + x: now[0], + y: now[1] + }); + } + + var dx = r.touchData.startPosition[0] - now[0]; + var dx2 = dx * dx; + var dy = r.touchData.startPosition[1] - now[1]; + var dy2 = dy * dy; + var dist2 = dx2 + dy2; + var rdist2 = dist2 * zoom * zoom; // Tap event, roughly same as mouse click event for touch + + if (!r.touchData.singleTouchMoved) { + if (!start) { + cy.$(':selected').unselect(['tapunselect']); + } + + triggerEvents(start, ['tap', 'vclick'], e, { + x: now[0], + y: now[1] + }); + didDoubleTouch = false; + + if (e.timeStamp - prevTouchTimeStamp <= cy.multiClickDebounceTime()) { + touchTimeout && clearTimeout(touchTimeout); + didDoubleTouch = true; + prevTouchTimeStamp = null; + triggerEvents(start, ['dbltap', 'vdblclick'], e, { + x: now[0], + y: now[1] + }); + } else { + touchTimeout = setTimeout(function () { + if (didDoubleTouch) return; + triggerEvents(start, ['onetap', 'voneclick'], e, { + x: now[0], + y: now[1] + }); + }, cy.multiClickDebounceTime()); + prevTouchTimeStamp = e.timeStamp; + } + } // Prepare to select the currently touched node, only if it hasn't been dragged past a certain distance + + + if (start != null && !r.dragData.didDrag // didn't drag nodes around + && start._private.selectable && rdist2 < r.touchTapThreshold2 && !r.pinching // pinch to zoom should not affect selection + ) { + if (cy.selectionType() === 'single') { + cy.$(isSelected).unmerge(start).unselect(['tapunselect']); + start.select(['tapselect']); + } else { + if (start.selected()) { + start.unselect(['tapunselect']); + } else { + start.select(['tapselect']); + } + } + + r.redrawHint('eles', true); + } + + r.touchData.singleTouchMoved = true; + } + + for (var j = 0; j < now.length; j++) { + earlier[j] = now[j]; + } + + r.dragData.didDrag = false; // reset for next touchstart + + if (e.touches.length === 0) { + r.touchData.dragDelta = []; + r.touchData.startPosition = null; + r.touchData.startGPosition = null; + r.touchData.didSelect = false; + } + + if (e.touches.length < 2) { + if (e.touches.length === 1) { + // the old start global pos'n may not be the same finger that remains + r.touchData.startGPosition = [e.touches[0].clientX, e.touches[0].clientY]; + } + + r.pinching = false; + r.redrawHint('eles', true); + r.redraw(); + } //r.redraw(); + + }, false); // fallback compatibility layer for ms pointer events + + if (typeof TouchEvent === 'undefined') { + var pointers = []; + + var makeTouch = function makeTouch(e) { + return { + clientX: e.clientX, + clientY: e.clientY, + force: 1, + identifier: e.pointerId, + pageX: e.pageX, + pageY: e.pageY, + radiusX: e.width / 2, + radiusY: e.height / 2, + screenX: e.screenX, + screenY: e.screenY, + target: e.target + }; + }; + + var makePointer = function makePointer(e) { + return { + event: e, + touch: makeTouch(e) + }; + }; + + var addPointer = function addPointer(e) { + pointers.push(makePointer(e)); + }; + + var removePointer = function removePointer(e) { + for (var i = 0; i < pointers.length; i++) { + var p = pointers[i]; + + if (p.event.pointerId === e.pointerId) { + pointers.splice(i, 1); + return; + } + } + }; + + var updatePointer = function updatePointer(e) { + var p = pointers.filter(function (p) { + return p.event.pointerId === e.pointerId; + })[0]; + p.event = e; + p.touch = makeTouch(e); + }; + + var addTouchesToEvent = function addTouchesToEvent(e) { + e.touches = pointers.map(function (p) { + return p.touch; + }); + }; + + var pointerIsMouse = function pointerIsMouse(e) { + return e.pointerType === 'mouse' || e.pointerType === 4; + }; + + r.registerBinding(r.container, 'pointerdown', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + e.preventDefault(); + addPointer(e); + addTouchesToEvent(e); + touchstartHandler(e); + }); + r.registerBinding(r.container, 'pointerup', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + removePointer(e); + addTouchesToEvent(e); + touchendHandler(e); + }); + r.registerBinding(r.container, 'pointercancel', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + removePointer(e); + addTouchesToEvent(e); + touchcancelHandler(e); + }); + r.registerBinding(r.container, 'pointermove', function (e) { + if (pointerIsMouse(e)) { + return; + } // mouse already handled + + + e.preventDefault(); + updatePointer(e); + addTouchesToEvent(e); + touchmoveHandler(e); + }); + } + }; + + var BRp$2 = {}; + + BRp$2.generatePolygon = function (name, points) { + return this.nodeShapes[name] = { + renderer: this, + name: name, + points: points, + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl('polygon', context, centerX, centerY, width, height, this.points); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return polygonIntersectLine(x, y, this.points, nodeX, nodeY, width / 2, height / 2, padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + return pointInsidePolygon(x, y, this.points, centerX, centerY, width, height, [0, -1], padding); + } + }; + }; + + BRp$2.generateEllipse = function () { + return this.nodeShapes['ellipse'] = { + renderer: this, + name: 'ellipse', + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return intersectLineEllipse(x, y, nodeX, nodeY, width / 2 + padding, height / 2 + padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + return checkInEllipse(x, y, width, height, centerX, centerY, padding); + } + }; + }; + + BRp$2.generateRoundPolygon = function (name, points) { + // Pre-compute control points + // Since these points depend on the radius length (which in turns depend on the width/height of the node) we will only pre-compute + // the unit vectors. + // For simplicity the layout will be: + // [ p0, UnitVectorP0P1, p1, UniVectorP1P2, ..., pn, UnitVectorPnP0 ] + var allPoints = new Array(points.length * 2); + + for (var i = 0; i < points.length / 2; i++) { + var sourceIndex = i * 2; + var destIndex = void 0; + + if (i < points.length / 2 - 1) { + destIndex = (i + 1) * 2; + } else { + destIndex = 0; + } + + allPoints[i * 4] = points[sourceIndex]; + allPoints[i * 4 + 1] = points[sourceIndex + 1]; + var xDest = points[destIndex] - points[sourceIndex]; + var yDest = points[destIndex + 1] - points[sourceIndex + 1]; + var norm = Math.sqrt(xDest * xDest + yDest * yDest); + allPoints[i * 4 + 2] = xDest / norm; + allPoints[i * 4 + 3] = yDest / norm; + } + + return this.nodeShapes[name] = { + renderer: this, + name: name, + points: allPoints, + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl('round-polygon', context, centerX, centerY, width, height, this.points); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return roundPolygonIntersectLine(x, y, this.points, nodeX, nodeY, width, height); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + return pointInsideRoundPolygon(x, y, this.points, centerX, centerY, width, height); + } + }; + }; + + BRp$2.generateRoundRectangle = function () { + return this.nodeShapes['round-rectangle'] = this.nodeShapes['roundrectangle'] = { + renderer: this, + name: 'round-rectangle', + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + return roundRectangleIntersectLine(x, y, nodeX, nodeY, width, height, padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + var cornerRadius = getRoundRectangleRadius(width, height); + var diam = cornerRadius * 2; // Check hBox + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - diam, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - diam, height, [0, -1], padding)) { + return true; + } // Check top left quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX - width / 2 + cornerRadius, centerY - height / 2 + cornerRadius, padding)) { + return true; + } // Check top right quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX + width / 2 - cornerRadius, centerY - height / 2 + cornerRadius, padding)) { + return true; + } // Check bottom right quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX + width / 2 - cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } // Check bottom left quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX - width / 2 + cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } + + return false; + } + }; + }; + + BRp$2.generateCutRectangle = function () { + return this.nodeShapes['cut-rectangle'] = this.nodeShapes['cutrectangle'] = { + renderer: this, + name: 'cut-rectangle', + cornerLength: getCutRectangleCornerLength(), + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + generateCutTrianglePts: function generateCutTrianglePts(width, height, centerX, centerY) { + var cl = this.cornerLength; + var hh = height / 2; + var hw = width / 2; + var xBegin = centerX - hw; + var xEnd = centerX + hw; + var yBegin = centerY - hh; + var yEnd = centerY + hh; // points are in clockwise order, inner (imaginary) triangle pt on [4, 5] + + return { + topLeft: [xBegin, yBegin + cl, xBegin + cl, yBegin, xBegin + cl, yBegin + cl], + topRight: [xEnd - cl, yBegin, xEnd, yBegin + cl, xEnd - cl, yBegin + cl], + bottomRight: [xEnd, yEnd - cl, xEnd - cl, yEnd, xEnd - cl, yEnd - cl], + bottomLeft: [xBegin + cl, yEnd, xBegin, yEnd - cl, xBegin + cl, yEnd - cl] + }; + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + var cPts = this.generateCutTrianglePts(width + 2 * padding, height + 2 * padding, nodeX, nodeY); + var pts = [].concat.apply([], [cPts.topLeft.splice(0, 4), cPts.topRight.splice(0, 4), cPts.bottomRight.splice(0, 4), cPts.bottomLeft.splice(0, 4)]); + return polygonIntersectLine(x, y, pts, nodeX, nodeY); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + // Check hBox + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - 2 * this.cornerLength, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - 2 * this.cornerLength, height, [0, -1], padding)) { + return true; + } + + var cutTrianglePts = this.generateCutTrianglePts(width, height, centerX, centerY); + return pointInsidePolygonPoints(x, y, cutTrianglePts.topLeft) || pointInsidePolygonPoints(x, y, cutTrianglePts.topRight) || pointInsidePolygonPoints(x, y, cutTrianglePts.bottomRight) || pointInsidePolygonPoints(x, y, cutTrianglePts.bottomLeft); + } + }; + }; + + BRp$2.generateBarrel = function () { + return this.nodeShapes['barrel'] = { + renderer: this, + name: 'barrel', + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + // use two fixed t values for the bezier curve approximation + var t0 = 0.15; + var t1 = 0.5; + var t2 = 0.85; + var bPts = this.generateBarrelBezierPts(width + 2 * padding, height + 2 * padding, nodeX, nodeY); + + var approximateBarrelCurvePts = function approximateBarrelCurvePts(pts) { + // approximate curve pts based on the two t values + var m0 = qbezierPtAt({ + x: pts[0], + y: pts[1] + }, { + x: pts[2], + y: pts[3] + }, { + x: pts[4], + y: pts[5] + }, t0); + var m1 = qbezierPtAt({ + x: pts[0], + y: pts[1] + }, { + x: pts[2], + y: pts[3] + }, { + x: pts[4], + y: pts[5] + }, t1); + var m2 = qbezierPtAt({ + x: pts[0], + y: pts[1] + }, { + x: pts[2], + y: pts[3] + }, { + x: pts[4], + y: pts[5] + }, t2); + return [pts[0], pts[1], m0.x, m0.y, m1.x, m1.y, m2.x, m2.y, pts[4], pts[5]]; + }; + + var pts = [].concat(approximateBarrelCurvePts(bPts.topLeft), approximateBarrelCurvePts(bPts.topRight), approximateBarrelCurvePts(bPts.bottomRight), approximateBarrelCurvePts(bPts.bottomLeft)); + return polygonIntersectLine(x, y, pts, nodeX, nodeY); + }, + generateBarrelBezierPts: function generateBarrelBezierPts(width, height, centerX, centerY) { + var hh = height / 2; + var hw = width / 2; + var xBegin = centerX - hw; + var xEnd = centerX + hw; + var yBegin = centerY - hh; + var yEnd = centerY + hh; + var curveConstants = getBarrelCurveConstants(width, height); + var hOffset = curveConstants.heightOffset; + var wOffset = curveConstants.widthOffset; + var ctrlPtXOffset = curveConstants.ctrlPtOffsetPct * width; // points are in clockwise order, inner (imaginary) control pt on [4, 5] + + var pts = { + topLeft: [xBegin, yBegin + hOffset, xBegin + ctrlPtXOffset, yBegin, xBegin + wOffset, yBegin], + topRight: [xEnd - wOffset, yBegin, xEnd - ctrlPtXOffset, yBegin, xEnd, yBegin + hOffset], + bottomRight: [xEnd, yEnd - hOffset, xEnd - ctrlPtXOffset, yEnd, xEnd - wOffset, yEnd], + bottomLeft: [xBegin + wOffset, yEnd, xBegin + ctrlPtXOffset, yEnd, xBegin, yEnd - hOffset] + }; + pts.topLeft.isTop = true; + pts.topRight.isTop = true; + pts.bottomLeft.isBottom = true; + pts.bottomRight.isBottom = true; + return pts; + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + var curveConstants = getBarrelCurveConstants(width, height); + var hOffset = curveConstants.heightOffset; + var wOffset = curveConstants.widthOffset; // Check hBox + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - 2 * hOffset, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - 2 * wOffset, height, [0, -1], padding)) { + return true; + } + + var barrelCurvePts = this.generateBarrelBezierPts(width, height, centerX, centerY); + + var getCurveT = function getCurveT(x, y, curvePts) { + var x0 = curvePts[4]; + var x1 = curvePts[2]; + var x2 = curvePts[0]; + var y0 = curvePts[5]; // var y1 = curvePts[ 3 ]; + + var y2 = curvePts[1]; + var xMin = Math.min(x0, x2); + var xMax = Math.max(x0, x2); + var yMin = Math.min(y0, y2); + var yMax = Math.max(y0, y2); + + if (xMin <= x && x <= xMax && yMin <= y && y <= yMax) { + var coeff = bezierPtsToQuadCoeff(x0, x1, x2); + var roots = solveQuadratic(coeff[0], coeff[1], coeff[2], x); + var validRoots = roots.filter(function (r) { + return 0 <= r && r <= 1; + }); + + if (validRoots.length > 0) { + return validRoots[0]; + } + } + + return null; + }; + + var curveRegions = Object.keys(barrelCurvePts); + + for (var i = 0; i < curveRegions.length; i++) { + var corner = curveRegions[i]; + var cornerPts = barrelCurvePts[corner]; + var t = getCurveT(x, y, cornerPts); + + if (t == null) { + continue; + } + + var y0 = cornerPts[5]; + var y1 = cornerPts[3]; + var y2 = cornerPts[1]; + var bezY = qbezierAt(y0, y1, y2, t); + + if (cornerPts.isTop && bezY <= y) { + return true; + } + + if (cornerPts.isBottom && y <= bezY) { + return true; + } + } + + return false; + } + }; + }; + + BRp$2.generateBottomRoundrectangle = function () { + return this.nodeShapes['bottom-round-rectangle'] = this.nodeShapes['bottomroundrectangle'] = { + renderer: this, + name: 'bottom-round-rectangle', + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: function draw(context, centerX, centerY, width, height) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width, height); + }, + intersectLine: function intersectLine(nodeX, nodeY, width, height, x, y, padding) { + var topStartX = nodeX - (width / 2 + padding); + var topStartY = nodeY - (height / 2 + padding); + var topEndY = topStartY; + var topEndX = nodeX + (width / 2 + padding); + var topIntersections = finiteLinesIntersect(x, y, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false); + + if (topIntersections.length > 0) { + return topIntersections; + } + + return roundRectangleIntersectLine(x, y, nodeX, nodeY, width, height, padding); + }, + checkPoint: function checkPoint(x, y, padding, width, height, centerX, centerY) { + var cornerRadius = getRoundRectangleRadius(width, height); + var diam = 2 * cornerRadius; // Check hBox + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width, height - diam, [0, -1], padding)) { + return true; + } // Check vBox + + + if (pointInsidePolygon(x, y, this.points, centerX, centerY, width - diam, height, [0, -1], padding)) { + return true; + } // check non-rounded top side + + + var outerWidth = width / 2 + 2 * padding; + var outerHeight = height / 2 + 2 * padding; + var points = [centerX - outerWidth, centerY - outerHeight, centerX - outerWidth, centerY, centerX + outerWidth, centerY, centerX + outerWidth, centerY - outerHeight]; + + if (pointInsidePolygonPoints(x, y, points)) { + return true; + } // Check bottom right quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX + width / 2 - cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } // Check bottom left quarter circle + + + if (checkInEllipse(x, y, diam, diam, centerX - width / 2 + cornerRadius, centerY + height / 2 - cornerRadius, padding)) { + return true; + } + + return false; + } + }; + }; + + BRp$2.registerNodeShapes = function () { + var nodeShapes = this.nodeShapes = {}; + var renderer = this; + this.generateEllipse(); + this.generatePolygon('triangle', generateUnitNgonPointsFitToSquare(3, 0)); + this.generateRoundPolygon('round-triangle', generateUnitNgonPointsFitToSquare(3, 0)); + this.generatePolygon('rectangle', generateUnitNgonPointsFitToSquare(4, 0)); + nodeShapes['square'] = nodeShapes['rectangle']; + this.generateRoundRectangle(); + this.generateCutRectangle(); + this.generateBarrel(); + this.generateBottomRoundrectangle(); + { + var diamondPoints = [0, 1, 1, 0, 0, -1, -1, 0]; + this.generatePolygon('diamond', diamondPoints); + this.generateRoundPolygon('round-diamond', diamondPoints); + } + this.generatePolygon('pentagon', generateUnitNgonPointsFitToSquare(5, 0)); + this.generateRoundPolygon('round-pentagon', generateUnitNgonPointsFitToSquare(5, 0)); + this.generatePolygon('hexagon', generateUnitNgonPointsFitToSquare(6, 0)); + this.generateRoundPolygon('round-hexagon', generateUnitNgonPointsFitToSquare(6, 0)); + this.generatePolygon('heptagon', generateUnitNgonPointsFitToSquare(7, 0)); + this.generateRoundPolygon('round-heptagon', generateUnitNgonPointsFitToSquare(7, 0)); + this.generatePolygon('octagon', generateUnitNgonPointsFitToSquare(8, 0)); + this.generateRoundPolygon('round-octagon', generateUnitNgonPointsFitToSquare(8, 0)); + var star5Points = new Array(20); + { + var outerPoints = generateUnitNgonPoints(5, 0); + var innerPoints = generateUnitNgonPoints(5, Math.PI / 5); // Outer radius is 1; inner radius of star is smaller + + var innerRadius = 0.5 * (3 - Math.sqrt(5)); + innerRadius *= 1.57; + + for (var i = 0; i < innerPoints.length / 2; i++) { + innerPoints[i * 2] *= innerRadius; + innerPoints[i * 2 + 1] *= innerRadius; + } + + for (var i = 0; i < 20 / 4; i++) { + star5Points[i * 4] = outerPoints[i * 2]; + star5Points[i * 4 + 1] = outerPoints[i * 2 + 1]; + star5Points[i * 4 + 2] = innerPoints[i * 2]; + star5Points[i * 4 + 3] = innerPoints[i * 2 + 1]; + } + } + star5Points = fitPolygonToSquare(star5Points); + this.generatePolygon('star', star5Points); + this.generatePolygon('vee', [-1, -1, 0, -0.333, 1, -1, 0, 1]); + this.generatePolygon('rhomboid', [-1, -1, 0.333, -1, 1, 1, -0.333, 1]); + this.generatePolygon('right-rhomboid', [-0.333, -1, 1, -1, 0.333, 1, -1, 1]); + this.nodeShapes['concavehexagon'] = this.generatePolygon('concave-hexagon', [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]); + { + var tagPoints = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1]; + this.generatePolygon('tag', tagPoints); + this.generateRoundPolygon('round-tag', tagPoints); + } + + nodeShapes.makePolygon = function (points) { + // use caching on user-specified polygons so they are as fast as native shapes + var key = points.join('$'); + var name = 'polygon-' + key; + var shape; + + if (shape = this[name]) { + // got cached shape + return shape; + } // create and cache new shape + + + return renderer.generatePolygon(name, points); + }; + }; + + var BRp$1 = {}; + + BRp$1.timeToRender = function () { + return this.redrawTotalTime / this.redrawCount; + }; + + BRp$1.redraw = function (options) { + options = options || staticEmptyObject(); + var r = this; + + if (r.averageRedrawTime === undefined) { + r.averageRedrawTime = 0; + } + + if (r.lastRedrawTime === undefined) { + r.lastRedrawTime = 0; + } + + if (r.lastDrawTime === undefined) { + r.lastDrawTime = 0; + } + + r.requestedFrame = true; + r.renderOptions = options; + }; + + BRp$1.beforeRender = function (fn, priority) { + // the renderer can't add tick callbacks when destroyed + if (this.destroyed) { + return; + } + + if (priority == null) { + error('Priority is not optional for beforeRender'); + } + + var cbs = this.beforeRenderCallbacks; + cbs.push({ + fn: fn, + priority: priority + }); // higher priority callbacks executed first + + cbs.sort(function (a, b) { + return b.priority - a.priority; + }); + }; + + var beforeRenderCallbacks = function beforeRenderCallbacks(r, willDraw, startTime) { + var cbs = r.beforeRenderCallbacks; + + for (var i = 0; i < cbs.length; i++) { + cbs[i].fn(willDraw, startTime); + } + }; + + BRp$1.startRenderLoop = function () { + var r = this; + var cy = r.cy; + + if (r.renderLoopStarted) { + return; + } else { + r.renderLoopStarted = true; + } + + var renderFn = function renderFn(requestTime) { + if (r.destroyed) { + return; + } + + if (cy.batching()) ; else if (r.requestedFrame && !r.skipFrame) { + beforeRenderCallbacks(r, true, requestTime); + var startTime = performanceNow(); + r.render(r.renderOptions); + var endTime = r.lastDrawTime = performanceNow(); + + if (r.averageRedrawTime === undefined) { + r.averageRedrawTime = endTime - startTime; + } + + if (r.redrawCount === undefined) { + r.redrawCount = 0; + } + + r.redrawCount++; + + if (r.redrawTotalTime === undefined) { + r.redrawTotalTime = 0; + } + + var duration = endTime - startTime; + r.redrawTotalTime += duration; + r.lastRedrawTime = duration; // use a weighted average with a bias from the previous average so we don't spike so easily + + r.averageRedrawTime = r.averageRedrawTime / 2 + duration / 2; + r.requestedFrame = false; + } else { + beforeRenderCallbacks(r, false, requestTime); + } + + r.skipFrame = false; + requestAnimationFrame(renderFn); + }; + + requestAnimationFrame(renderFn); + }; + + var BaseRenderer = function BaseRenderer(options) { + this.init(options); + }; + + var BR = BaseRenderer; + var BRp = BR.prototype; + BRp.clientFunctions = ['redrawHint', 'render', 'renderTo', 'matchCanvasSize', 'nodeShapeImpl', 'arrowShapeImpl']; + + BRp.init = function (options) { + var r = this; + r.options = options; + r.cy = options.cy; + var ctr = r.container = options.cy.container(); // prepend a stylesheet in the head such that + + if (window$1) { + var document = window$1.document; + var head = document.head; + var stylesheetId = '__________cytoscape_stylesheet'; + var className = '__________cytoscape_container'; + var stylesheetAlreadyExists = document.getElementById(stylesheetId) != null; + + if (ctr.className.indexOf(className) < 0) { + ctr.className = (ctr.className || '') + ' ' + className; + } + + if (!stylesheetAlreadyExists) { + var stylesheet = document.createElement('style'); + stylesheet.id = stylesheetId; + stylesheet.textContent = '.' + className + ' { position: relative; }'; + head.insertBefore(stylesheet, head.children[0]); // first so lowest priority + } + + var computedStyle = window$1.getComputedStyle(ctr); + var position = computedStyle.getPropertyValue('position'); + + if (position === 'static') { + warn('A Cytoscape container has style position:static and so can not use UI extensions properly'); + } + } + + r.selection = [undefined, undefined, undefined, undefined, 0]; // Coordinates for selection box, plus enabled flag + + r.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95]; //--Pointer-related data + + r.hoverData = { + down: null, + last: null, + downTime: null, + triggerMode: null, + dragging: false, + initialPan: [null, null], + capture: false + }; + r.dragData = { + possibleDragElements: [] + }; + r.touchData = { + start: null, + capture: false, + // These 3 fields related to tap, taphold events + startPosition: [null, null, null, null, null, null], + singleTouchStartTime: null, + singleTouchMoved: true, + now: [null, null, null, null, null, null], + earlier: [null, null, null, null, null, null] + }; + r.redraws = 0; + r.showFps = options.showFps; + r.debug = options.debug; + r.hideEdgesOnViewport = options.hideEdgesOnViewport; + r.textureOnViewport = options.textureOnViewport; + r.wheelSensitivity = options.wheelSensitivity; + r.motionBlurEnabled = options.motionBlur; // on by default + + r.forcedPixelRatio = number$1(options.pixelRatio) ? options.pixelRatio : null; + r.motionBlur = options.motionBlur; // for initial kick off + + r.motionBlurOpacity = options.motionBlurOpacity; + r.motionBlurTransparency = 1 - r.motionBlurOpacity; + r.motionBlurPxRatio = 1; + r.mbPxRBlurry = 1; //0.8; + + r.minMbLowQualFrames = 4; + r.fullQualityMb = false; + r.clearedForMotionBlur = []; + r.desktopTapThreshold = options.desktopTapThreshold; + r.desktopTapThreshold2 = options.desktopTapThreshold * options.desktopTapThreshold; + r.touchTapThreshold = options.touchTapThreshold; + r.touchTapThreshold2 = options.touchTapThreshold * options.touchTapThreshold; + r.tapholdDuration = 500; + r.bindings = []; + r.beforeRenderCallbacks = []; + r.beforeRenderPriorities = { + // higher priority execs before lower one + animations: 400, + eleCalcs: 300, + eleTxrDeq: 200, + lyrTxrDeq: 150, + lyrTxrSkip: 100 + }; + r.registerNodeShapes(); + r.registerArrowShapes(); + r.registerCalculationListeners(); + }; + + BRp.notify = function (eventName, eles) { + var r = this; + var cy = r.cy; // the renderer can't be notified after it's destroyed + + if (this.destroyed) { + return; + } + + if (eventName === 'init') { + r.load(); + return; + } + + if (eventName === 'destroy') { + r.destroy(); + return; + } + + if (eventName === 'add' || eventName === 'remove' || eventName === 'move' && cy.hasCompoundNodes() || eventName === 'load' || eventName === 'zorder' || eventName === 'mount') { + r.invalidateCachedZSortedEles(); + } + + if (eventName === 'viewport') { + r.redrawHint('select', true); + } + + if (eventName === 'load' || eventName === 'resize' || eventName === 'mount') { + r.invalidateContainerClientCoordsCache(); + r.matchCanvasSize(r.container); + } + + r.redrawHint('eles', true); + r.redrawHint('drag', true); + this.startRenderLoop(); + this.redraw(); + }; + + BRp.destroy = function () { + var r = this; + r.destroyed = true; + r.cy.stopAnimationLoop(); + + for (var i = 0; i < r.bindings.length; i++) { + var binding = r.bindings[i]; + var b = binding; + var tgt = b.target; + (tgt.off || tgt.removeEventListener).apply(tgt, b.args); + } + + r.bindings = []; + r.beforeRenderCallbacks = []; + r.onUpdateEleCalcsFns = []; + + if (r.removeObserver) { + r.removeObserver.disconnect(); + } + + if (r.styleObserver) { + r.styleObserver.disconnect(); + } + + if (r.resizeObserver) { + r.resizeObserver.disconnect(); + } + + if (r.labelCalcDiv) { + try { + document.body.removeChild(r.labelCalcDiv); // eslint-disable-line no-undef + } catch (e) {// ie10 issue #1014 + } + } + }; + + BRp.isHeadless = function () { + return false; + }; + + [BRp$f, BRp$5, BRp$4, BRp$3, BRp$2, BRp$1].forEach(function (props) { + extend(BRp, props); + }); + + var fullFpsTime = 1000 / 60; // assume 60 frames per second + + var defs = { + setupDequeueing: function setupDequeueing(opts) { + return function setupDequeueingImpl() { + var self = this; + var r = this.renderer; + + if (self.dequeueingSetup) { + return; + } else { + self.dequeueingSetup = true; + } + + var queueRedraw = debounce_1(function () { + r.redrawHint('eles', true); + r.redrawHint('drag', true); + r.redraw(); + }, opts.deqRedrawThreshold); + + var dequeue = function dequeue(willDraw, frameStartTime) { + var startTime = performanceNow(); + var avgRenderTime = r.averageRedrawTime; + var renderTime = r.lastRedrawTime; + var deqd = []; + var extent = r.cy.extent(); + var pixelRatio = r.getPixelRatio(); // if we aren't in a tick that causes a draw, then the rendered style + // queue won't automatically be flushed before dequeueing starts + + if (!willDraw) { + r.flushRenderedStyleQueue(); + } + + while (true) { + // eslint-disable-line no-constant-condition + var now = performanceNow(); + var duration = now - startTime; + var frameDuration = now - frameStartTime; + + if (renderTime < fullFpsTime) { + // if we're rendering faster than the ideal fps, then do dequeueing + // during all of the remaining frame time + var timeAvailable = fullFpsTime - (willDraw ? avgRenderTime : 0); + + if (frameDuration >= opts.deqFastCost * timeAvailable) { + break; + } + } else { + if (willDraw) { + if (duration >= opts.deqCost * renderTime || duration >= opts.deqAvgCost * avgRenderTime) { + break; + } + } else if (frameDuration >= opts.deqNoDrawCost * fullFpsTime) { + break; + } + } + + var thisDeqd = opts.deq(self, pixelRatio, extent); + + if (thisDeqd.length > 0) { + for (var i = 0; i < thisDeqd.length; i++) { + deqd.push(thisDeqd[i]); + } + } else { + break; + } + } // callbacks on dequeue + + + if (deqd.length > 0) { + opts.onDeqd(self, deqd); + + if (!willDraw && opts.shouldRedraw(self, deqd, pixelRatio, extent)) { + queueRedraw(); + } + } + }; + + var priority = opts.priority || noop$1; + r.beforeRender(dequeue, priority(self)); + }; + } + }; + + // Uses keys so elements may share the same cache. + + var ElementTextureCacheLookup = /*#__PURE__*/function () { + function ElementTextureCacheLookup(getKey) { + var doesEleInvalidateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : falsify; + + _classCallCheck(this, ElementTextureCacheLookup); + + this.idsByKey = new Map$2(); + this.keyForId = new Map$2(); + this.cachesByLvl = new Map$2(); + this.lvls = []; + this.getKey = getKey; + this.doesEleInvalidateKey = doesEleInvalidateKey; + } + + _createClass(ElementTextureCacheLookup, [{ + key: "getIdsFor", + value: function getIdsFor(key) { + if (key == null) { + error("Can not get id list for null key"); + } + + var idsByKey = this.idsByKey; + var ids = this.idsByKey.get(key); + + if (!ids) { + ids = new Set$1(); + idsByKey.set(key, ids); + } + + return ids; + } + }, { + key: "addIdForKey", + value: function addIdForKey(key, id) { + if (key != null) { + this.getIdsFor(key).add(id); + } + } + }, { + key: "deleteIdForKey", + value: function deleteIdForKey(key, id) { + if (key != null) { + this.getIdsFor(key)["delete"](id); + } + } + }, { + key: "getNumberOfIdsForKey", + value: function getNumberOfIdsForKey(key) { + if (key == null) { + return 0; + } else { + return this.getIdsFor(key).size; + } + } + }, { + key: "updateKeyMappingFor", + value: function updateKeyMappingFor(ele) { + var id = ele.id(); + var prevKey = this.keyForId.get(id); + var currKey = this.getKey(ele); + this.deleteIdForKey(prevKey, id); + this.addIdForKey(currKey, id); + this.keyForId.set(id, currKey); + } + }, { + key: "deleteKeyMappingFor", + value: function deleteKeyMappingFor(ele) { + var id = ele.id(); + var prevKey = this.keyForId.get(id); + this.deleteIdForKey(prevKey, id); + this.keyForId["delete"](id); + } + }, { + key: "keyHasChangedFor", + value: function keyHasChangedFor(ele) { + var id = ele.id(); + var prevKey = this.keyForId.get(id); + var newKey = this.getKey(ele); + return prevKey !== newKey; + } + }, { + key: "isInvalid", + value: function isInvalid(ele) { + return this.keyHasChangedFor(ele) || this.doesEleInvalidateKey(ele); + } + }, { + key: "getCachesAt", + value: function getCachesAt(lvl) { + var cachesByLvl = this.cachesByLvl, + lvls = this.lvls; + var caches = cachesByLvl.get(lvl); + + if (!caches) { + caches = new Map$2(); + cachesByLvl.set(lvl, caches); + lvls.push(lvl); + } + + return caches; + } + }, { + key: "getCache", + value: function getCache(key, lvl) { + return this.getCachesAt(lvl).get(key); + } + }, { + key: "get", + value: function get(ele, lvl) { + var key = this.getKey(ele); + var cache = this.getCache(key, lvl); // getting for an element may need to add to the id list b/c eles can share keys + + if (cache != null) { + this.updateKeyMappingFor(ele); + } + + return cache; + } + }, { + key: "getForCachedKey", + value: function getForCachedKey(ele, lvl) { + var key = this.keyForId.get(ele.id()); // n.b. use cached key, not newly computed key + + var cache = this.getCache(key, lvl); + return cache; + } + }, { + key: "hasCache", + value: function hasCache(key, lvl) { + return this.getCachesAt(lvl).has(key); + } + }, { + key: "has", + value: function has(ele, lvl) { + var key = this.getKey(ele); + return this.hasCache(key, lvl); + } + }, { + key: "setCache", + value: function setCache(key, lvl, cache) { + cache.key = key; + this.getCachesAt(lvl).set(key, cache); + } + }, { + key: "set", + value: function set(ele, lvl, cache) { + var key = this.getKey(ele); + this.setCache(key, lvl, cache); + this.updateKeyMappingFor(ele); + } + }, { + key: "deleteCache", + value: function deleteCache(key, lvl) { + this.getCachesAt(lvl)["delete"](key); + } + }, { + key: "delete", + value: function _delete(ele, lvl) { + var key = this.getKey(ele); + this.deleteCache(key, lvl); + } + }, { + key: "invalidateKey", + value: function invalidateKey(key) { + var _this = this; + + this.lvls.forEach(function (lvl) { + return _this.deleteCache(key, lvl); + }); + } // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key) + + }, { + key: "invalidate", + value: function invalidate(ele) { + var id = ele.id(); + var key = this.keyForId.get(id); // n.b. use stored key rather than current (potential key) + + this.deleteKeyMappingFor(ele); + var entireKeyInvalidated = this.doesEleInvalidateKey(ele); + + if (entireKeyInvalidated) { + // clear mapping for current key + this.invalidateKey(key); + } + + return entireKeyInvalidated || this.getNumberOfIdsForKey(key) === 0; + } + }]); + + return ElementTextureCacheLookup; + }(); + + var minTxrH = 25; // the size of the texture cache for small height eles (special case) + + var txrStepH = 50; // the min size of the regular cache, and the size it increases with each step up + + var minLvl$1 = -4; // when scaling smaller than that we don't need to re-render + + var maxLvl$1 = 3; // when larger than this scale just render directly (caching is not helpful) + + var maxZoom$1 = 7.99; // beyond this zoom level, layered textures are not used + + var eleTxrSpacing = 8; // spacing between elements on textures to avoid blitting overlaps + + var defTxrWidth = 1024; // default/minimum texture width + + var maxTxrW = 1024; // the maximum width of a texture + + var maxTxrH = 1024; // the maximum height of a texture + + var minUtility = 0.2; // if usage of texture is less than this, it is retired + + var maxFullness = 0.8; // fullness of texture after which queue removal is checked + + var maxFullnessChecks = 10; // dequeued after this many checks + + var deqCost$1 = 0.15; // % of add'l rendering cost allowed for dequeuing ele caches each frame + + var deqAvgCost$1 = 0.1; // % of add'l rendering cost compared to average overall redraw time + + var deqNoDrawCost$1 = 0.9; // % of avg frame time that can be used for dequeueing when not drawing + + var deqFastCost$1 = 0.9; // % of frame time to be used when >60fps + + var deqRedrawThreshold$1 = 100; // time to batch redraws together from dequeueing to allow more dequeueing calcs to happen in the meanwhile + + var maxDeqSize$1 = 1; // number of eles to dequeue and render at higher texture in each batch + + var getTxrReasons = { + dequeue: 'dequeue', + downscale: 'downscale', + highQuality: 'highQuality' + }; + var initDefaults = defaults$g({ + getKey: null, + doesEleInvalidateKey: falsify, + drawElement: null, + getBoundingBox: null, + getRotationPoint: null, + getRotationOffset: null, + isVisible: trueify, + allowEdgeTxrCaching: true, + allowParentTxrCaching: true + }); + + var ElementTextureCache = function ElementTextureCache(renderer, initOptions) { + var self = this; + self.renderer = renderer; + self.onDequeues = []; + var opts = initDefaults(initOptions); + extend(self, opts); + self.lookup = new ElementTextureCacheLookup(opts.getKey, opts.doesEleInvalidateKey); + self.setupDequeueing(); + }; + + var ETCp = ElementTextureCache.prototype; + ETCp.reasons = getTxrReasons; // the list of textures in which new subtextures for elements can be placed + + ETCp.getTextureQueue = function (txrH) { + var self = this; + self.eleImgCaches = self.eleImgCaches || {}; + return self.eleImgCaches[txrH] = self.eleImgCaches[txrH] || []; + }; // the list of usused textures which can be recycled (in use in texture queue) + + + ETCp.getRetiredTextureQueue = function (txrH) { + var self = this; + var rtxtrQs = self.eleImgCaches.retired = self.eleImgCaches.retired || {}; + var rtxtrQ = rtxtrQs[txrH] = rtxtrQs[txrH] || []; + return rtxtrQ; + }; // queue of element draw requests at different scale levels + + + ETCp.getElementQueue = function () { + var self = this; + var q = self.eleCacheQueue = self.eleCacheQueue || new heap(function (a, b) { + return b.reqs - a.reqs; + }); + return q; + }; // queue of element draw requests at different scale levels (element id lookup) + + + ETCp.getElementKeyToQueue = function () { + var self = this; + var k2q = self.eleKeyToCacheQueue = self.eleKeyToCacheQueue || {}; + return k2q; + }; + + ETCp.getElement = function (ele, bb, pxRatio, lvl, reason) { + var self = this; + var r = this.renderer; + var zoom = r.cy.zoom(); + var lookup = this.lookup; + + if (!bb || bb.w === 0 || bb.h === 0 || isNaN(bb.w) || isNaN(bb.h) || !ele.visible() || ele.removed()) { + return null; + } + + if (!self.allowEdgeTxrCaching && ele.isEdge() || !self.allowParentTxrCaching && ele.isParent()) { + return null; + } + + if (lvl == null) { + lvl = Math.ceil(log2(zoom * pxRatio)); + } + + if (lvl < minLvl$1) { + lvl = minLvl$1; + } else if (zoom >= maxZoom$1 || lvl > maxLvl$1) { + return null; + } + + var scale = Math.pow(2, lvl); + var eleScaledH = bb.h * scale; + var eleScaledW = bb.w * scale; + var scaledLabelShown = r.eleTextBiggerThanMin(ele, scale); + + if (!this.isVisible(ele, scaledLabelShown)) { + return null; + } + + var eleCache = lookup.get(ele, lvl); // if this get was on an unused/invalidated cache, then restore the texture usage metric + + if (eleCache && eleCache.invalidated) { + eleCache.invalidated = false; + eleCache.texture.invalidatedWidth -= eleCache.width; + } + + if (eleCache) { + return eleCache; + } + + var txrH; // which texture height this ele belongs to + + if (eleScaledH <= minTxrH) { + txrH = minTxrH; + } else if (eleScaledH <= txrStepH) { + txrH = txrStepH; + } else { + txrH = Math.ceil(eleScaledH / txrStepH) * txrStepH; + } + + if (eleScaledH > maxTxrH || eleScaledW > maxTxrW) { + return null; // caching large elements is not efficient + } + + var txrQ = self.getTextureQueue(txrH); // first try the second last one in case it has space at the end + + var txr = txrQ[txrQ.length - 2]; + + var addNewTxr = function addNewTxr() { + return self.recycleTexture(txrH, eleScaledW) || self.addTexture(txrH, eleScaledW); + }; // try the last one if there is no second last one + + + if (!txr) { + txr = txrQ[txrQ.length - 1]; + } // if the last one doesn't exist, we need a first one + + + if (!txr) { + txr = addNewTxr(); + } // if there's no room in the current texture, we need a new one + + + if (txr.width - txr.usedWidth < eleScaledW) { + txr = addNewTxr(); + } + + var scalableFrom = function scalableFrom(otherCache) { + return otherCache && otherCache.scaledLabelShown === scaledLabelShown; + }; + + var deqing = reason && reason === getTxrReasons.dequeue; + var highQualityReq = reason && reason === getTxrReasons.highQuality; + var downscaleReq = reason && reason === getTxrReasons.downscale; + var higherCache; // the nearest cache with a higher level + + for (var l = lvl + 1; l <= maxLvl$1; l++) { + var c = lookup.get(ele, l); + + if (c) { + higherCache = c; + break; + } + } + + var oneUpCache = higherCache && higherCache.level === lvl + 1 ? higherCache : null; + + var downscale = function downscale() { + txr.context.drawImage(oneUpCache.texture.canvas, oneUpCache.x, 0, oneUpCache.width, oneUpCache.height, txr.usedWidth, 0, eleScaledW, eleScaledH); + }; // reset ele area in texture + + + txr.context.setTransform(1, 0, 0, 1, 0, 0); + txr.context.clearRect(txr.usedWidth, 0, eleScaledW, txrH); + + if (scalableFrom(oneUpCache)) { + // then we can relatively cheaply rescale the existing image w/o rerendering + downscale(); + } else if (scalableFrom(higherCache)) { + // then use the higher cache for now and queue the next level down + // to cheaply scale towards the smaller level + if (highQualityReq) { + for (var _l = higherCache.level; _l > lvl; _l--) { + oneUpCache = self.getElement(ele, bb, pxRatio, _l, getTxrReasons.downscale); + } + + downscale(); + } else { + self.queueElement(ele, higherCache.level - 1); + return higherCache; + } + } else { + var lowerCache; // the nearest cache with a lower level + + if (!deqing && !highQualityReq && !downscaleReq) { + for (var _l2 = lvl - 1; _l2 >= minLvl$1; _l2--) { + var _c = lookup.get(ele, _l2); + + if (_c) { + lowerCache = _c; + break; + } + } + } + + if (scalableFrom(lowerCache)) { + // then use the lower quality cache for now and queue the better one for later + self.queueElement(ele, lvl); + return lowerCache; + } + + txr.context.translate(txr.usedWidth, 0); + txr.context.scale(scale, scale); + this.drawElement(txr.context, ele, bb, scaledLabelShown, false); + txr.context.scale(1 / scale, 1 / scale); + txr.context.translate(-txr.usedWidth, 0); + } + + eleCache = { + x: txr.usedWidth, + texture: txr, + level: lvl, + scale: scale, + width: eleScaledW, + height: eleScaledH, + scaledLabelShown: scaledLabelShown + }; + txr.usedWidth += Math.ceil(eleScaledW + eleTxrSpacing); + txr.eleCaches.push(eleCache); + lookup.set(ele, lvl, eleCache); + self.checkTextureFullness(txr); + return eleCache; + }; + + ETCp.invalidateElements = function (eles) { + for (var i = 0; i < eles.length; i++) { + this.invalidateElement(eles[i]); + } + }; + + ETCp.invalidateElement = function (ele) { + var self = this; + var lookup = self.lookup; + var caches = []; + var invalid = lookup.isInvalid(ele); + + if (!invalid) { + return; // override the invalidation request if the element key has not changed + } + + for (var lvl = minLvl$1; lvl <= maxLvl$1; lvl++) { + var cache = lookup.getForCachedKey(ele, lvl); + + if (cache) { + caches.push(cache); + } + } + + var noOtherElesUseCache = lookup.invalidate(ele); + + if (noOtherElesUseCache) { + for (var i = 0; i < caches.length; i++) { + var _cache = caches[i]; + var txr = _cache.texture; // remove space from the texture it belongs to + + txr.invalidatedWidth += _cache.width; // mark the cache as invalidated + + _cache.invalidated = true; // retire the texture if its utility is low + + self.checkTextureUtility(txr); + } + } // remove from queue since the old req was for the old state + + + self.removeFromQueue(ele); + }; + + ETCp.checkTextureUtility = function (txr) { + // invalidate all entries in the cache if the cache size is small + if (txr.invalidatedWidth >= minUtility * txr.width) { + this.retireTexture(txr); + } + }; + + ETCp.checkTextureFullness = function (txr) { + // if texture has been mostly filled and passed over several times, remove + // it from the queue so we don't need to waste time looking at it to put new things + var self = this; + var txrQ = self.getTextureQueue(txr.height); + + if (txr.usedWidth / txr.width > maxFullness && txr.fullnessChecks >= maxFullnessChecks) { + removeFromArray(txrQ, txr); + } else { + txr.fullnessChecks++; + } + }; + + ETCp.retireTexture = function (txr) { + var self = this; + var txrH = txr.height; + var txrQ = self.getTextureQueue(txrH); + var lookup = this.lookup; // retire the texture from the active / searchable queue: + + removeFromArray(txrQ, txr); + txr.retired = true; // remove the refs from the eles to the caches: + + var eleCaches = txr.eleCaches; + + for (var i = 0; i < eleCaches.length; i++) { + var eleCache = eleCaches[i]; + lookup.deleteCache(eleCache.key, eleCache.level); + } + + clearArray(eleCaches); // add the texture to a retired queue so it can be recycled in future: + + var rtxtrQ = self.getRetiredTextureQueue(txrH); + rtxtrQ.push(txr); + }; + + ETCp.addTexture = function (txrH, minW) { + var self = this; + var txrQ = self.getTextureQueue(txrH); + var txr = {}; + txrQ.push(txr); + txr.eleCaches = []; + txr.height = txrH; + txr.width = Math.max(defTxrWidth, minW); + txr.usedWidth = 0; + txr.invalidatedWidth = 0; + txr.fullnessChecks = 0; + txr.canvas = self.renderer.makeOffscreenCanvas(txr.width, txr.height); + txr.context = txr.canvas.getContext('2d'); + return txr; + }; + + ETCp.recycleTexture = function (txrH, minW) { + var self = this; + var txrQ = self.getTextureQueue(txrH); + var rtxtrQ = self.getRetiredTextureQueue(txrH); + + for (var i = 0; i < rtxtrQ.length; i++) { + var txr = rtxtrQ[i]; + + if (txr.width >= minW) { + txr.retired = false; + txr.usedWidth = 0; + txr.invalidatedWidth = 0; + txr.fullnessChecks = 0; + clearArray(txr.eleCaches); + txr.context.setTransform(1, 0, 0, 1, 0, 0); + txr.context.clearRect(0, 0, txr.width, txr.height); + removeFromArray(rtxtrQ, txr); + txrQ.push(txr); + return txr; + } + } + }; + + ETCp.queueElement = function (ele, lvl) { + var self = this; + var q = self.getElementQueue(); + var k2q = self.getElementKeyToQueue(); + var key = this.getKey(ele); + var existingReq = k2q[key]; + + if (existingReq) { + // use the max lvl b/c in between lvls are cheap to make + existingReq.level = Math.max(existingReq.level, lvl); + existingReq.eles.merge(ele); + existingReq.reqs++; + q.updateItem(existingReq); + } else { + var req = { + eles: ele.spawn().merge(ele), + level: lvl, + reqs: 1, + key: key + }; + q.push(req); + k2q[key] = req; + } + }; + + ETCp.dequeue = function (pxRatio + /*, extent*/ + ) { + var self = this; + var q = self.getElementQueue(); + var k2q = self.getElementKeyToQueue(); + var dequeued = []; + var lookup = self.lookup; + + for (var i = 0; i < maxDeqSize$1; i++) { + if (q.size() > 0) { + var req = q.pop(); + var key = req.key; + var ele = req.eles[0]; // all eles have the same key + + var cacheExists = lookup.hasCache(ele, req.level); // clear out the key to req lookup + + k2q[key] = null; // dequeueing isn't necessary with an existing cache + + if (cacheExists) { + continue; + } + + dequeued.push(req); + var bb = self.getBoundingBox(ele); + self.getElement(ele, bb, pxRatio, req.level, getTxrReasons.dequeue); + } else { + break; + } + } + + return dequeued; + }; + + ETCp.removeFromQueue = function (ele) { + var self = this; + var q = self.getElementQueue(); + var k2q = self.getElementKeyToQueue(); + var key = this.getKey(ele); + var req = k2q[key]; + + if (req != null) { + if (req.eles.length === 1) { + // remove if last ele in the req + // bring to front of queue + req.reqs = MAX_INT$1; + q.updateItem(req); + q.pop(); // remove from queue + + k2q[key] = null; // remove from lookup map + } else { + // otherwise just remove ele from req + req.eles.unmerge(ele); + } + } + }; + + ETCp.onDequeue = function (fn) { + this.onDequeues.push(fn); + }; + + ETCp.offDequeue = function (fn) { + removeFromArray(this.onDequeues, fn); + }; + + ETCp.setupDequeueing = defs.setupDequeueing({ + deqRedrawThreshold: deqRedrawThreshold$1, + deqCost: deqCost$1, + deqAvgCost: deqAvgCost$1, + deqNoDrawCost: deqNoDrawCost$1, + deqFastCost: deqFastCost$1, + deq: function deq(self, pxRatio, extent) { + return self.dequeue(pxRatio, extent); + }, + onDeqd: function onDeqd(self, deqd) { + for (var i = 0; i < self.onDequeues.length; i++) { + var fn = self.onDequeues[i]; + fn(deqd); + } + }, + shouldRedraw: function shouldRedraw(self, deqd, pxRatio, extent) { + for (var i = 0; i < deqd.length; i++) { + var eles = deqd[i].eles; + + for (var j = 0; j < eles.length; j++) { + var bb = eles[j].boundingBox(); + + if (boundingBoxesIntersect(bb, extent)) { + return true; + } + } + } + + return false; + }, + priority: function priority(self) { + return self.renderer.beforeRenderPriorities.eleTxrDeq; + } + }); + + var defNumLayers = 1; // default number of layers to use + + var minLvl = -4; // when scaling smaller than that we don't need to re-render + + var maxLvl = 2; // when larger than this scale just render directly (caching is not helpful) + + var maxZoom = 3.99; // beyond this zoom level, layered textures are not used + + var deqRedrawThreshold = 50; // time to batch redraws together from dequeueing to allow more dequeueing calcs to happen in the meanwhile + + var refineEleDebounceTime = 50; // time to debounce sharper ele texture updates + + var deqCost = 0.15; // % of add'l rendering cost allowed for dequeuing ele caches each frame + + var deqAvgCost = 0.1; // % of add'l rendering cost compared to average overall redraw time + + var deqNoDrawCost = 0.9; // % of avg frame time that can be used for dequeueing when not drawing + + var deqFastCost = 0.9; // % of frame time to be used when >60fps + + var maxDeqSize = 1; // number of eles to dequeue and render at higher texture in each batch + + var invalidThreshold = 250; // time threshold for disabling b/c of invalidations + + var maxLayerArea = 4000 * 4000; // layers can't be bigger than this + + var useHighQualityEleTxrReqs = true; // whether to use high quality ele txr requests (generally faster and cheaper in the longterm) + // var log = function(){ console.log.apply( console, arguments ); }; + + var LayeredTextureCache = function LayeredTextureCache(renderer) { + var self = this; + var r = self.renderer = renderer; + var cy = r.cy; + self.layersByLevel = {}; // e.g. 2 => [ layer1, layer2, ..., layerN ] + + self.firstGet = true; + self.lastInvalidationTime = performanceNow() - 2 * invalidThreshold; + self.skipping = false; + self.eleTxrDeqs = cy.collection(); + self.scheduleElementRefinement = debounce_1(function () { + self.refineElementTextures(self.eleTxrDeqs); + self.eleTxrDeqs.unmerge(self.eleTxrDeqs); + }, refineEleDebounceTime); + r.beforeRender(function (willDraw, now) { + if (now - self.lastInvalidationTime <= invalidThreshold) { + self.skipping = true; + } else { + self.skipping = false; + } + }, r.beforeRenderPriorities.lyrTxrSkip); + + var qSort = function qSort(a, b) { + return b.reqs - a.reqs; + }; + + self.layersQueue = new heap(qSort); + self.setupDequeueing(); + }; + + var LTCp = LayeredTextureCache.prototype; + var layerIdPool = 0; + var MAX_INT = Math.pow(2, 53) - 1; + + LTCp.makeLayer = function (bb, lvl) { + var scale = Math.pow(2, lvl); + var w = Math.ceil(bb.w * scale); + var h = Math.ceil(bb.h * scale); + var canvas = this.renderer.makeOffscreenCanvas(w, h); + var layer = { + id: layerIdPool = ++layerIdPool % MAX_INT, + bb: bb, + level: lvl, + width: w, + height: h, + canvas: canvas, + context: canvas.getContext('2d'), + eles: [], + elesQueue: [], + reqs: 0 + }; // log('make layer %s with w %s and h %s and lvl %s', layer.id, layer.width, layer.height, layer.level); + + var cxt = layer.context; + var dx = -layer.bb.x1; + var dy = -layer.bb.y1; // do the transform on creation to save cycles (it's the same for all eles) + + cxt.scale(scale, scale); + cxt.translate(dx, dy); + return layer; + }; + + LTCp.getLayers = function (eles, pxRatio, lvl) { + var self = this; + var r = self.renderer; + var cy = r.cy; + var zoom = cy.zoom(); + var firstGet = self.firstGet; + self.firstGet = false; // log('--\nget layers with %s eles', eles.length); + //log eles.map(function(ele){ return ele.id() }) ); + + if (lvl == null) { + lvl = Math.ceil(log2(zoom * pxRatio)); + + if (lvl < minLvl) { + lvl = minLvl; + } else if (zoom >= maxZoom || lvl > maxLvl) { + return null; + } + } + + self.validateLayersElesOrdering(lvl, eles); + var layersByLvl = self.layersByLevel; + var scale = Math.pow(2, lvl); + var layers = layersByLvl[lvl] = layersByLvl[lvl] || []; + var bb; + var lvlComplete = self.levelIsComplete(lvl, eles); + var tmpLayers; + + var checkTempLevels = function checkTempLevels() { + var canUseAsTmpLvl = function canUseAsTmpLvl(l) { + self.validateLayersElesOrdering(l, eles); + + if (self.levelIsComplete(l, eles)) { + tmpLayers = layersByLvl[l]; + return true; + } + }; + + var checkLvls = function checkLvls(dir) { + if (tmpLayers) { + return; + } + + for (var l = lvl + dir; minLvl <= l && l <= maxLvl; l += dir) { + if (canUseAsTmpLvl(l)) { + break; + } + } + }; + + checkLvls(+1); + checkLvls(-1); // remove the invalid layers; they will be replaced as needed later in this function + + for (var i = layers.length - 1; i >= 0; i--) { + var layer = layers[i]; + + if (layer.invalid) { + removeFromArray(layers, layer); + } + } + }; + + if (!lvlComplete) { + // if the current level is incomplete, then use the closest, best quality layerset temporarily + // and later queue the current layerset so we can get the proper quality level soon + checkTempLevels(); + } else { + // log('level complete, using existing layers\n--'); + return layers; + } + + var getBb = function getBb() { + if (!bb) { + bb = makeBoundingBox(); + + for (var i = 0; i < eles.length; i++) { + updateBoundingBox(bb, eles[i].boundingBox()); + } + } + + return bb; + }; + + var makeLayer = function makeLayer(opts) { + opts = opts || {}; + var after = opts.after; + getBb(); + var area = bb.w * scale * (bb.h * scale); + + if (area > maxLayerArea) { + return null; + } + + var layer = self.makeLayer(bb, lvl); + + if (after != null) { + var index = layers.indexOf(after) + 1; + layers.splice(index, 0, layer); + } else if (opts.insert === undefined || opts.insert) { + // no after specified => first layer made so put at start + layers.unshift(layer); + } // if( tmpLayers ){ + //self.queueLayer( layer ); + // } + + + return layer; + }; + + if (self.skipping && !firstGet) { + // log('skip layers'); + return null; + } // log('do layers'); + + + var layer = null; + var maxElesPerLayer = eles.length / defNumLayers; + var allowLazyQueueing = !firstGet; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + var rs = ele._private.rscratch; + var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; // log('look at ele', ele.id()); + + var existingLayer = caches[lvl]; + + if (existingLayer) { + // reuse layer for later eles + // log('reuse layer for', ele.id()); + layer = existingLayer; + continue; + } + + if (!layer || layer.eles.length >= maxElesPerLayer || !boundingBoxInBoundingBox(layer.bb, ele.boundingBox())) { + // log('make new layer for ele %s', ele.id()); + layer = makeLayer({ + insert: true, + after: layer + }); // if now layer can be built then we can't use layers at this level + + if (!layer) { + return null; + } // log('new layer with id %s', layer.id); + + } + + if (tmpLayers || allowLazyQueueing) { + // log('queue ele %s in layer %s', ele.id(), layer.id); + self.queueLayer(layer, ele); + } else { + // log('draw ele %s in layer %s', ele.id(), layer.id); + self.drawEleInLayer(layer, ele, lvl, pxRatio); + } + + layer.eles.push(ele); + caches[lvl] = layer; + } // log('--'); + + + if (tmpLayers) { + // then we only queued the current layerset and can't draw it yet + return tmpLayers; + } + + if (allowLazyQueueing) { + // log('lazy queue level', lvl); + return null; + } + + return layers; + }; // a layer may want to use an ele cache of a higher level to avoid blurriness + // so the layer level might not equal the ele level + + + LTCp.getEleLevelForLayerLevel = function (lvl, pxRatio) { + return lvl; + }; + + LTCp.drawEleInLayer = function (layer, ele, lvl, pxRatio) { + var self = this; + var r = this.renderer; + var context = layer.context; + var bb = ele.boundingBox(); + + if (bb.w === 0 || bb.h === 0 || !ele.visible()) { + return; + } + + lvl = self.getEleLevelForLayerLevel(lvl, pxRatio); + + { + r.setImgSmoothing(context, false); + } + + { + r.drawCachedElement(context, ele, null, null, lvl, useHighQualityEleTxrReqs); + } + + { + r.setImgSmoothing(context, true); + } + }; + + LTCp.levelIsComplete = function (lvl, eles) { + var self = this; + var layers = self.layersByLevel[lvl]; + + if (!layers || layers.length === 0) { + return false; + } + + var numElesInLayers = 0; + + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; // if there are any eles needed to be drawn yet, the level is not complete + + if (layer.reqs > 0) { + return false; + } // if the layer is invalid, the level is not complete + + + if (layer.invalid) { + return false; + } + + numElesInLayers += layer.eles.length; + } // we should have exactly the number of eles passed in to be complete + + + if (numElesInLayers !== eles.length) { + return false; + } + + return true; + }; + + LTCp.validateLayersElesOrdering = function (lvl, eles) { + var layers = this.layersByLevel[lvl]; + + if (!layers) { + return; + } // if in a layer the eles are not in the same order, then the layer is invalid + // (i.e. there is an ele in between the eles in the layer) + + + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; + var offset = -1; // find the offset + + for (var j = 0; j < eles.length; j++) { + if (layer.eles[0] === eles[j]) { + offset = j; + break; + } + } + + if (offset < 0) { + // then the layer has nonexistent elements and is invalid + this.invalidateLayer(layer); + continue; + } // the eles in the layer must be in the same continuous order, else the layer is invalid + + + var o = offset; + + for (var j = 0; j < layer.eles.length; j++) { + if (layer.eles[j] !== eles[o + j]) { + // log('invalidate based on ordering', layer.id); + this.invalidateLayer(layer); + break; + } + } + } + }; + + LTCp.updateElementsInLayers = function (eles, update) { + var self = this; + var isEles = element(eles[0]); // collect udpated elements (cascaded from the layers) and update each + // layer itself along the way + + for (var i = 0; i < eles.length; i++) { + var req = isEles ? null : eles[i]; + var ele = isEles ? eles[i] : eles[i].ele; + var rs = ele._private.rscratch; + var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; + + for (var l = minLvl; l <= maxLvl; l++) { + var layer = caches[l]; + + if (!layer) { + continue; + } // if update is a request from the ele cache, then it affects only + // the matching level + + + if (req && self.getEleLevelForLayerLevel(layer.level) !== req.level) { + continue; + } + + update(layer, ele, req); + } + } + }; + + LTCp.haveLayers = function () { + var self = this; + var haveLayers = false; + + for (var l = minLvl; l <= maxLvl; l++) { + var layers = self.layersByLevel[l]; + + if (layers && layers.length > 0) { + haveLayers = true; + break; + } + } + + return haveLayers; + }; + + LTCp.invalidateElements = function (eles) { + var self = this; + + if (eles.length === 0) { + return; + } + + self.lastInvalidationTime = performanceNow(); // log('update invalidate layer time from eles'); + + if (eles.length === 0 || !self.haveLayers()) { + return; + } + + self.updateElementsInLayers(eles, function invalAssocLayers(layer, ele, req) { + self.invalidateLayer(layer); + }); + }; + + LTCp.invalidateLayer = function (layer) { + // log('update invalidate layer time'); + this.lastInvalidationTime = performanceNow(); + + if (layer.invalid) { + return; + } // save cycles + + + var lvl = layer.level; + var eles = layer.eles; + var layers = this.layersByLevel[lvl]; // log('invalidate layer', layer.id ); + + removeFromArray(layers, layer); // layer.eles = []; + + layer.elesQueue = []; + layer.invalid = true; + + if (layer.replacement) { + layer.replacement.invalid = true; + } + + for (var i = 0; i < eles.length; i++) { + var caches = eles[i]._private.rscratch.imgLayerCaches; + + if (caches) { + caches[lvl] = null; + } + } + }; + + LTCp.refineElementTextures = function (eles) { + var self = this; // log('refine', eles.length); + + self.updateElementsInLayers(eles, function refineEachEle(layer, ele, req) { + var rLyr = layer.replacement; + + if (!rLyr) { + rLyr = layer.replacement = self.makeLayer(layer.bb, layer.level); + rLyr.replaces = layer; + rLyr.eles = layer.eles; // log('make replacement layer %s for %s with level %s', rLyr.id, layer.id, rLyr.level); + } + + if (!rLyr.reqs) { + for (var i = 0; i < rLyr.eles.length; i++) { + self.queueLayer(rLyr, rLyr.eles[i]); + } // log('queue replacement layer refinement', rLyr.id); + + } + }); + }; + + LTCp.enqueueElementRefinement = function (ele) { + + this.eleTxrDeqs.merge(ele); + this.scheduleElementRefinement(); + }; + + LTCp.queueLayer = function (layer, ele) { + var self = this; + var q = self.layersQueue; + var elesQ = layer.elesQueue; + var hasId = elesQ.hasId = elesQ.hasId || {}; // if a layer is going to be replaced, queuing is a waste of time + + if (layer.replacement) { + return; + } + + if (ele) { + if (hasId[ele.id()]) { + return; + } + + elesQ.push(ele); + hasId[ele.id()] = true; + } + + if (layer.reqs) { + layer.reqs++; + q.updateItem(layer); + } else { + layer.reqs = 1; + q.push(layer); + } + }; + + LTCp.dequeue = function (pxRatio) { + var self = this; + var q = self.layersQueue; + var deqd = []; + var eleDeqs = 0; + + while (eleDeqs < maxDeqSize) { + if (q.size() === 0) { + break; + } + + var layer = q.peek(); // if a layer has been or will be replaced, then don't waste time with it + + if (layer.replacement) { + // log('layer %s in queue skipped b/c it already has a replacement', layer.id); + q.pop(); + continue; + } // if this is a replacement layer that has been superceded, then forget it + + + if (layer.replaces && layer !== layer.replaces.replacement) { + // log('layer is no longer the most uptodate replacement; dequeued', layer.id) + q.pop(); + continue; + } + + if (layer.invalid) { + // log('replacement layer %s is invalid; dequeued', layer.id); + q.pop(); + continue; + } + + var ele = layer.elesQueue.shift(); + + if (ele) { + // log('dequeue layer %s', layer.id); + self.drawEleInLayer(layer, ele, layer.level, pxRatio); + eleDeqs++; + } + + if (deqd.length === 0) { + // we need only one entry in deqd to queue redrawing etc + deqd.push(true); + } // if the layer has all its eles done, then remove from the queue + + + if (layer.elesQueue.length === 0) { + q.pop(); + layer.reqs = 0; // log('dequeue of layer %s complete', layer.id); + // when a replacement layer is dequeued, it replaces the old layer in the level + + if (layer.replaces) { + self.applyLayerReplacement(layer); + } + + self.requestRedraw(); + } + } + + return deqd; + }; + + LTCp.applyLayerReplacement = function (layer) { + var self = this; + var layersInLevel = self.layersByLevel[layer.level]; + var replaced = layer.replaces; + var index = layersInLevel.indexOf(replaced); // if the replaced layer is not in the active list for the level, then replacing + // refs would be a mistake (i.e. overwriting the true active layer) + + if (index < 0 || replaced.invalid) { + // log('replacement layer would have no effect', layer.id); + return; + } + + layersInLevel[index] = layer; // replace level ref + // replace refs in eles + + for (var i = 0; i < layer.eles.length; i++) { + var _p = layer.eles[i]._private; + var cache = _p.imgLayerCaches = _p.imgLayerCaches || {}; + + if (cache) { + cache[layer.level] = layer; + } + } // log('apply replacement layer %s over %s', layer.id, replaced.id); + + + self.requestRedraw(); + }; + + LTCp.requestRedraw = debounce_1(function () { + var r = this.renderer; + r.redrawHint('eles', true); + r.redrawHint('drag', true); + r.redraw(); + }, 100); + LTCp.setupDequeueing = defs.setupDequeueing({ + deqRedrawThreshold: deqRedrawThreshold, + deqCost: deqCost, + deqAvgCost: deqAvgCost, + deqNoDrawCost: deqNoDrawCost, + deqFastCost: deqFastCost, + deq: function deq(self, pxRatio) { + return self.dequeue(pxRatio); + }, + onDeqd: noop$1, + shouldRedraw: trueify, + priority: function priority(self) { + return self.renderer.beforeRenderPriorities.lyrTxrDeq; + } + }); + + var CRp$a = {}; + var impl; + + function polygon(context, points) { + for (var i = 0; i < points.length; i++) { + var pt = points[i]; + context.lineTo(pt.x, pt.y); + } + } + + function triangleBackcurve(context, points, controlPoint) { + var firstPt; + + for (var i = 0; i < points.length; i++) { + var pt = points[i]; + + if (i === 0) { + firstPt = pt; + } + + context.lineTo(pt.x, pt.y); + } + + context.quadraticCurveTo(controlPoint.x, controlPoint.y, firstPt.x, firstPt.y); + } + + function triangleTee(context, trianglePoints, teePoints) { + if (context.beginPath) { + context.beginPath(); + } + + var triPts = trianglePoints; + + for (var i = 0; i < triPts.length; i++) { + var pt = triPts[i]; + context.lineTo(pt.x, pt.y); + } + + var teePts = teePoints; + var firstTeePt = teePoints[0]; + context.moveTo(firstTeePt.x, firstTeePt.y); + + for (var i = 1; i < teePts.length; i++) { + var pt = teePts[i]; + context.lineTo(pt.x, pt.y); + } + + if (context.closePath) { + context.closePath(); + } + } + + function circleTriangle(context, trianglePoints, rx, ry, r) { + if (context.beginPath) { + context.beginPath(); + } + + context.arc(rx, ry, r, 0, Math.PI * 2, false); + var triPts = trianglePoints; + var firstTrPt = triPts[0]; + context.moveTo(firstTrPt.x, firstTrPt.y); + + for (var i = 0; i < triPts.length; i++) { + var pt = triPts[i]; + context.lineTo(pt.x, pt.y); + } + + if (context.closePath) { + context.closePath(); + } + } + + function circle(context, rx, ry, r) { + context.arc(rx, ry, r, 0, Math.PI * 2, false); + } + + CRp$a.arrowShapeImpl = function (name) { + return (impl || (impl = { + 'polygon': polygon, + 'triangle-backcurve': triangleBackcurve, + 'triangle-tee': triangleTee, + 'circle-triangle': circleTriangle, + 'triangle-cross': triangleTee, + 'circle': circle + }))[name]; + }; + + var CRp$9 = {}; + + CRp$9.drawElement = function (context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity) { + var r = this; + + if (ele.isNode()) { + r.drawNode(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity); + } else { + r.drawEdge(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity); + } + }; + + CRp$9.drawElementOverlay = function (context, ele) { + var r = this; + + if (ele.isNode()) { + r.drawNodeOverlay(context, ele); + } else { + r.drawEdgeOverlay(context, ele); + } + }; + + CRp$9.drawElementUnderlay = function (context, ele) { + var r = this; + + if (ele.isNode()) { + r.drawNodeUnderlay(context, ele); + } else { + r.drawEdgeUnderlay(context, ele); + } + }; + + CRp$9.drawCachedElementPortion = function (context, ele, eleTxrCache, pxRatio, lvl, reason, getRotation, getOpacity) { + var r = this; + var bb = eleTxrCache.getBoundingBox(ele); + + if (bb.w === 0 || bb.h === 0) { + return; + } // ignore zero size case + + + var eleCache = eleTxrCache.getElement(ele, bb, pxRatio, lvl, reason); + + if (eleCache != null) { + var opacity = getOpacity(r, ele); + + if (opacity === 0) { + return; + } + + var theta = getRotation(r, ele); + var x1 = bb.x1, + y1 = bb.y1, + w = bb.w, + h = bb.h; + var x, y, sx, sy, smooth; + + if (theta !== 0) { + var rotPt = eleTxrCache.getRotationPoint(ele); + sx = rotPt.x; + sy = rotPt.y; + context.translate(sx, sy); + context.rotate(theta); + smooth = r.getImgSmoothing(context); + + if (!smooth) { + r.setImgSmoothing(context, true); + } + + var off = eleTxrCache.getRotationOffset(ele); + x = off.x; + y = off.y; + } else { + x = x1; + y = y1; + } + + var oldGlobalAlpha; + + if (opacity !== 1) { + oldGlobalAlpha = context.globalAlpha; + context.globalAlpha = oldGlobalAlpha * opacity; + } + + context.drawImage(eleCache.texture.canvas, eleCache.x, 0, eleCache.width, eleCache.height, x, y, w, h); + + if (opacity !== 1) { + context.globalAlpha = oldGlobalAlpha; + } + + if (theta !== 0) { + context.rotate(-theta); + context.translate(-sx, -sy); + + if (!smooth) { + r.setImgSmoothing(context, false); + } + } + } else { + eleTxrCache.drawElement(context, ele); // direct draw fallback + } + }; + + var getZeroRotation = function getZeroRotation() { + return 0; + }; + + var getLabelRotation = function getLabelRotation(r, ele) { + return r.getTextAngle(ele, null); + }; + + var getSourceLabelRotation = function getSourceLabelRotation(r, ele) { + return r.getTextAngle(ele, 'source'); + }; + + var getTargetLabelRotation = function getTargetLabelRotation(r, ele) { + return r.getTextAngle(ele, 'target'); + }; + + var getOpacity = function getOpacity(r, ele) { + return ele.effectiveOpacity(); + }; + + var getTextOpacity = function getTextOpacity(e, ele) { + return ele.pstyle('text-opacity').pfValue * ele.effectiveOpacity(); + }; + + CRp$9.drawCachedElement = function (context, ele, pxRatio, extent, lvl, requestHighQuality) { + var r = this; + var _r$data = r.data, + eleTxrCache = _r$data.eleTxrCache, + lblTxrCache = _r$data.lblTxrCache, + slbTxrCache = _r$data.slbTxrCache, + tlbTxrCache = _r$data.tlbTxrCache; + var bb = ele.boundingBox(); + var reason = requestHighQuality === true ? eleTxrCache.reasons.highQuality : null; + + if (bb.w === 0 || bb.h === 0 || !ele.visible()) { + return; + } + + if (!extent || boundingBoxesIntersect(bb, extent)) { + var isEdge = ele.isEdge(); + + var badLine = ele.element()._private.rscratch.badLine; + + r.drawElementUnderlay(context, ele); + r.drawCachedElementPortion(context, ele, eleTxrCache, pxRatio, lvl, reason, getZeroRotation, getOpacity); + + if (!isEdge || !badLine) { + r.drawCachedElementPortion(context, ele, lblTxrCache, pxRatio, lvl, reason, getLabelRotation, getTextOpacity); + } + + if (isEdge && !badLine) { + r.drawCachedElementPortion(context, ele, slbTxrCache, pxRatio, lvl, reason, getSourceLabelRotation, getTextOpacity); + r.drawCachedElementPortion(context, ele, tlbTxrCache, pxRatio, lvl, reason, getTargetLabelRotation, getTextOpacity); + } + + r.drawElementOverlay(context, ele); + } + }; + + CRp$9.drawElements = function (context, eles) { + var r = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + r.drawElement(context, ele); + } + }; + + CRp$9.drawCachedElements = function (context, eles, pxRatio, extent) { + var r = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + r.drawCachedElement(context, ele, pxRatio, extent); + } + }; + + CRp$9.drawCachedNodes = function (context, eles, pxRatio, extent) { + var r = this; + + for (var i = 0; i < eles.length; i++) { + var ele = eles[i]; + + if (!ele.isNode()) { + continue; + } + + r.drawCachedElement(context, ele, pxRatio, extent); + } + }; + + CRp$9.drawLayeredElements = function (context, eles, pxRatio, extent) { + var r = this; + var layers = r.data.lyrTxrCache.getLayers(eles, pxRatio); + + if (layers) { + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; + var bb = layer.bb; + + if (bb.w === 0 || bb.h === 0) { + continue; + } + + context.drawImage(layer.canvas, bb.x1, bb.y1, bb.w, bb.h); + } + } else { + // fall back on plain caching if no layers + r.drawCachedElements(context, eles, pxRatio, extent); + } + }; + + /* global Path2D */ + var CRp$8 = {}; + + CRp$8.drawEdge = function (context, edge, shiftToOriginWithBb) { + var drawLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + var r = this; + var rs = edge._private.rscratch; + + if (shouldDrawOpacity && !edge.visible()) { + return; + } // if bezier ctrl pts can not be calculated, then die + + + if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) { + // isNaN in case edge is impossible and browser bugs (e.g. safari) + return; + } + + var bb; + + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + + var opacity = shouldDrawOpacity ? edge.pstyle('opacity').value : 1; + var lineOpacity = shouldDrawOpacity ? edge.pstyle('line-opacity').value : 1; + var curveStyle = edge.pstyle('curve-style').value; + var lineStyle = edge.pstyle('line-style').value; + var edgeWidth = edge.pstyle('width').pfValue; + var lineCap = edge.pstyle('line-cap').value; + var effectiveLineOpacity = opacity * lineOpacity; // separate arrow opacity would require arrow-opacity property + + var effectiveArrowOpacity = opacity * lineOpacity; + + var drawLine = function drawLine() { + var strokeOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : effectiveLineOpacity; + + if (curveStyle === 'straight-triangle') { + r.eleStrokeStyle(context, edge, strokeOpacity); + r.drawEdgeTrianglePath(edge, context, rs.allpts); + } else { + context.lineWidth = edgeWidth; + context.lineCap = lineCap; + r.eleStrokeStyle(context, edge, strokeOpacity); + r.drawEdgePath(edge, context, rs.allpts, lineStyle); + context.lineCap = 'butt'; // reset for other drawing functions + } + }; + + var drawOverlay = function drawOverlay() { + if (!shouldDrawOverlay) { + return; + } + + r.drawEdgeOverlay(context, edge); + }; + + var drawUnderlay = function drawUnderlay() { + if (!shouldDrawOverlay) { + return; + } + + r.drawEdgeUnderlay(context, edge); + }; + + var drawArrows = function drawArrows() { + var arrowOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : effectiveArrowOpacity; + r.drawArrowheads(context, edge, arrowOpacity); + }; + + var drawText = function drawText() { + r.drawElementText(context, edge, null, drawLabel); + }; + + context.lineJoin = 'round'; + var ghost = edge.pstyle('ghost').value === 'yes'; + + if (ghost) { + var gx = edge.pstyle('ghost-offset-x').pfValue; + var gy = edge.pstyle('ghost-offset-y').pfValue; + var ghostOpacity = edge.pstyle('ghost-opacity').value; + var effectiveGhostOpacity = effectiveLineOpacity * ghostOpacity; + context.translate(gx, gy); + drawLine(effectiveGhostOpacity); + drawArrows(effectiveGhostOpacity); + context.translate(-gx, -gy); + } + + drawUnderlay(); + drawLine(); + drawArrows(); + drawOverlay(); + drawText(); + + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } + }; + + var drawEdgeOverlayUnderlay = function drawEdgeOverlayUnderlay(overlayOrUnderlay) { + if (!['overlay', 'underlay'].includes(overlayOrUnderlay)) { + throw new Error('Invalid state'); + } + + return function (context, edge) { + if (!edge.visible()) { + return; + } + + var opacity = edge.pstyle("".concat(overlayOrUnderlay, "-opacity")).value; + + if (opacity === 0) { + return; + } + + var r = this; + var usePaths = r.usePaths(); + var rs = edge._private.rscratch; + var padding = edge.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; + var width = 2 * padding; + var color = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value; + context.lineWidth = width; + + if (rs.edgeType === 'self' && !usePaths) { + context.lineCap = 'butt'; + } else { + context.lineCap = 'round'; + } + + r.colorStrokeStyle(context, color[0], color[1], color[2], opacity); + r.drawEdgePath(edge, context, rs.allpts, 'solid'); + }; + }; + + CRp$8.drawEdgeOverlay = drawEdgeOverlayUnderlay('overlay'); + CRp$8.drawEdgeUnderlay = drawEdgeOverlayUnderlay('underlay'); + + CRp$8.drawEdgePath = function (edge, context, pts, type) { + var rs = edge._private.rscratch; + var canvasCxt = context; + var path; + var pathCacheHit = false; + var usePaths = this.usePaths(); + var lineDashPattern = edge.pstyle('line-dash-pattern').pfValue; + var lineDashOffset = edge.pstyle('line-dash-offset').pfValue; + + if (usePaths) { + var pathCacheKey = pts.join('$'); + var keyMatches = rs.pathCacheKey && rs.pathCacheKey === pathCacheKey; + + if (keyMatches) { + path = context = rs.pathCache; + pathCacheHit = true; + } else { + path = context = new Path2D(); + rs.pathCacheKey = pathCacheKey; + rs.pathCache = path; + } + } + + if (canvasCxt.setLineDash) { + // for very outofdate browsers + switch (type) { + case 'dotted': + canvasCxt.setLineDash([1, 1]); + break; + + case 'dashed': + canvasCxt.setLineDash(lineDashPattern); + canvasCxt.lineDashOffset = lineDashOffset; + break; + + case 'solid': + canvasCxt.setLineDash([]); + break; + } + } + + if (!pathCacheHit && !rs.badLine) { + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(pts[0], pts[1]); + + switch (rs.edgeType) { + case 'bezier': + case 'self': + case 'compound': + case 'multibezier': + for (var i = 2; i + 3 < pts.length; i += 4) { + context.quadraticCurveTo(pts[i], pts[i + 1], pts[i + 2], pts[i + 3]); + } + + break; + + case 'straight': + case 'segments': + case 'haystack': + for (var _i = 2; _i + 1 < pts.length; _i += 2) { + context.lineTo(pts[_i], pts[_i + 1]); + } + + break; + } + } + + context = canvasCxt; + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } // reset any line dashes + + + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } + }; + + CRp$8.drawEdgeTrianglePath = function (edge, context, pts) { + // use line stroke style for triangle fill style + context.fillStyle = context.strokeStyle; + var edgeWidth = edge.pstyle('width').pfValue; + + for (var i = 0; i + 1 < pts.length; i += 2) { + var vector = [pts[i + 2] - pts[i], pts[i + 3] - pts[i + 1]]; + var length = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]); + var normal = [vector[1] / length, -vector[0] / length]; + var triangleHead = [normal[0] * edgeWidth / 2, normal[1] * edgeWidth / 2]; + context.beginPath(); + context.moveTo(pts[i] - triangleHead[0], pts[i + 1] - triangleHead[1]); + context.lineTo(pts[i] + triangleHead[0], pts[i + 1] + triangleHead[1]); + context.lineTo(pts[i + 2], pts[i + 3]); + context.closePath(); + context.fill(); + } + }; + + CRp$8.drawArrowheads = function (context, edge, opacity) { + var rs = edge._private.rscratch; + var isHaystack = rs.edgeType === 'haystack'; + + if (!isHaystack) { + this.drawArrowhead(context, edge, 'source', rs.arrowStartX, rs.arrowStartY, rs.srcArrowAngle, opacity); + } + + this.drawArrowhead(context, edge, 'mid-target', rs.midX, rs.midY, rs.midtgtArrowAngle, opacity); + this.drawArrowhead(context, edge, 'mid-source', rs.midX, rs.midY, rs.midsrcArrowAngle, opacity); + + if (!isHaystack) { + this.drawArrowhead(context, edge, 'target', rs.arrowEndX, rs.arrowEndY, rs.tgtArrowAngle, opacity); + } + }; + + CRp$8.drawArrowhead = function (context, edge, prefix, x, y, angle, opacity) { + if (isNaN(x) || x == null || isNaN(y) || y == null || isNaN(angle) || angle == null) { + return; + } + + var self = this; + var arrowShape = edge.pstyle(prefix + '-arrow-shape').value; + + if (arrowShape === 'none') { + return; + } + + var arrowClearFill = edge.pstyle(prefix + '-arrow-fill').value === 'hollow' ? 'both' : 'filled'; + var arrowFill = edge.pstyle(prefix + '-arrow-fill').value; + var edgeWidth = edge.pstyle('width').pfValue; + var edgeOpacity = edge.pstyle('opacity').value; + + if (opacity === undefined) { + opacity = edgeOpacity; + } + + var gco = context.globalCompositeOperation; + + if (opacity !== 1 || arrowFill === 'hollow') { + // then extra clear is needed + context.globalCompositeOperation = 'destination-out'; + self.colorFillStyle(context, 255, 255, 255, 1); + self.colorStrokeStyle(context, 255, 255, 255, 1); + self.drawArrowShape(edge, context, arrowClearFill, edgeWidth, arrowShape, x, y, angle); + context.globalCompositeOperation = gco; + } // otherwise, the opaque arrow clears it for free :) + + + var color = edge.pstyle(prefix + '-arrow-color').value; + self.colorFillStyle(context, color[0], color[1], color[2], opacity); + self.colorStrokeStyle(context, color[0], color[1], color[2], opacity); + self.drawArrowShape(edge, context, arrowFill, edgeWidth, arrowShape, x, y, angle); + }; + + CRp$8.drawArrowShape = function (edge, context, fill, edgeWidth, shape, x, y, angle) { + var r = this; + var usePaths = this.usePaths() && shape !== 'triangle-cross'; + var pathCacheHit = false; + var path; + var canvasContext = context; + var translation = { + x: x, + y: y + }; + var scale = edge.pstyle('arrow-scale').value; + var size = this.getArrowWidth(edgeWidth, scale); + var shapeImpl = r.arrowShapes[shape]; + + if (usePaths) { + var cache = r.arrowPathCache = r.arrowPathCache || []; + var key = hashString(shape); + var cachedPath = cache[key]; + + if (cachedPath != null) { + path = context = cachedPath; + pathCacheHit = true; + } else { + path = context = new Path2D(); + cache[key] = path; + } + } + + if (!pathCacheHit) { + if (context.beginPath) { + context.beginPath(); + } + + if (usePaths) { + // store in the path cache with values easily manipulated later + shapeImpl.draw(context, 1, 0, { + x: 0, + y: 0 + }, 1); + } else { + shapeImpl.draw(context, size, angle, translation, edgeWidth); + } + + if (context.closePath) { + context.closePath(); + } + } + + context = canvasContext; + + if (usePaths) { + // set transform to arrow position/orientation + context.translate(x, y); + context.rotate(angle); + context.scale(size, size); + } + + if (fill === 'filled' || fill === 'both') { + if (usePaths) { + context.fill(path); + } else { + context.fill(); + } + } + + if (fill === 'hollow' || fill === 'both') { + context.lineWidth = (shapeImpl.matchEdgeWidth ? edgeWidth : 1) / (usePaths ? size : 1); + context.lineJoin = 'miter'; + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } + } + + if (usePaths) { + // reset transform by applying inverse + context.scale(1 / size, 1 / size); + context.rotate(-angle); + context.translate(-x, -y); + } + }; + + var CRp$7 = {}; + + CRp$7.safeDrawImage = function (context, img, ix, iy, iw, ih, x, y, w, h) { + // detect problematic cases for old browsers with bad images (cheaper than try-catch) + if (iw <= 0 || ih <= 0 || w <= 0 || h <= 0) { + return; + } + + try { + context.drawImage(img, ix, iy, iw, ih, x, y, w, h); + } catch (e) { + warn(e); + } + }; + + CRp$7.drawInscribedImage = function (context, img, node, index, nodeOpacity) { + var r = this; + var pos = node.position(); + var nodeX = pos.x; + var nodeY = pos.y; + var styleObj = node.cy().style(); + var getIndexedStyle = styleObj.getIndexedStyle.bind(styleObj); + var fit = getIndexedStyle(node, 'background-fit', 'value', index); + var repeat = getIndexedStyle(node, 'background-repeat', 'value', index); + var nodeW = node.width(); + var nodeH = node.height(); + var paddingX2 = node.padding() * 2; + var nodeTW = nodeW + (getIndexedStyle(node, 'background-width-relative-to', 'value', index) === 'inner' ? 0 : paddingX2); + var nodeTH = nodeH + (getIndexedStyle(node, 'background-height-relative-to', 'value', index) === 'inner' ? 0 : paddingX2); + var rs = node._private.rscratch; + var clip = getIndexedStyle(node, 'background-clip', 'value', index); + var shouldClip = clip === 'node'; + var imgOpacity = getIndexedStyle(node, 'background-image-opacity', 'value', index) * nodeOpacity; + var smooth = getIndexedStyle(node, 'background-image-smoothing', 'value', index); + var imgW = img.width || img.cachedW; + var imgH = img.height || img.cachedH; // workaround for broken browsers like ie + + if (null == imgW || null == imgH) { + document.body.appendChild(img); // eslint-disable-line no-undef + + imgW = img.cachedW = img.width || img.offsetWidth; + imgH = img.cachedH = img.height || img.offsetHeight; + document.body.removeChild(img); // eslint-disable-line no-undef + } + + var w = imgW; + var h = imgH; + + if (getIndexedStyle(node, 'background-width', 'value', index) !== 'auto') { + if (getIndexedStyle(node, 'background-width', 'units', index) === '%') { + w = getIndexedStyle(node, 'background-width', 'pfValue', index) * nodeTW; + } else { + w = getIndexedStyle(node, 'background-width', 'pfValue', index); + } + } + + if (getIndexedStyle(node, 'background-height', 'value', index) !== 'auto') { + if (getIndexedStyle(node, 'background-height', 'units', index) === '%') { + h = getIndexedStyle(node, 'background-height', 'pfValue', index) * nodeTH; + } else { + h = getIndexedStyle(node, 'background-height', 'pfValue', index); + } + } + + if (w === 0 || h === 0) { + return; // no point in drawing empty image (and chrome is broken in this case) + } + + if (fit === 'contain') { + var scale = Math.min(nodeTW / w, nodeTH / h); + w *= scale; + h *= scale; + } else if (fit === 'cover') { + var scale = Math.max(nodeTW / w, nodeTH / h); + w *= scale; + h *= scale; + } + + var x = nodeX - nodeTW / 2; // left + + var posXUnits = getIndexedStyle(node, 'background-position-x', 'units', index); + var posXPfVal = getIndexedStyle(node, 'background-position-x', 'pfValue', index); + + if (posXUnits === '%') { + x += (nodeTW - w) * posXPfVal; + } else { + x += posXPfVal; + } + + var offXUnits = getIndexedStyle(node, 'background-offset-x', 'units', index); + var offXPfVal = getIndexedStyle(node, 'background-offset-x', 'pfValue', index); + + if (offXUnits === '%') { + x += (nodeTW - w) * offXPfVal; + } else { + x += offXPfVal; + } + + var y = nodeY - nodeTH / 2; // top + + var posYUnits = getIndexedStyle(node, 'background-position-y', 'units', index); + var posYPfVal = getIndexedStyle(node, 'background-position-y', 'pfValue', index); + + if (posYUnits === '%') { + y += (nodeTH - h) * posYPfVal; + } else { + y += posYPfVal; + } + + var offYUnits = getIndexedStyle(node, 'background-offset-y', 'units', index); + var offYPfVal = getIndexedStyle(node, 'background-offset-y', 'pfValue', index); + + if (offYUnits === '%') { + y += (nodeTH - h) * offYPfVal; + } else { + y += offYPfVal; + } + + if (rs.pathCache) { + x -= nodeX; + y -= nodeY; + nodeX = 0; + nodeY = 0; + } + + var gAlpha = context.globalAlpha; + context.globalAlpha = imgOpacity; + var smoothingEnabled = r.getImgSmoothing(context); + var isSmoothingSwitched = false; + + if (smooth === 'no' && smoothingEnabled) { + r.setImgSmoothing(context, false); + isSmoothingSwitched = true; + } else if (smooth === 'yes' && !smoothingEnabled) { + r.setImgSmoothing(context, true); + isSmoothingSwitched = true; + } + + if (repeat === 'no-repeat') { + if (shouldClip) { + context.save(); + + if (rs.pathCache) { + context.clip(rs.pathCache); + } else { + r.nodeShapes[r.getNodeShape(node)].draw(context, nodeX, nodeY, nodeTW, nodeTH); + context.clip(); + } + } + + r.safeDrawImage(context, img, 0, 0, imgW, imgH, x, y, w, h); + + if (shouldClip) { + context.restore(); + } + } else { + var pattern = context.createPattern(img, repeat); + context.fillStyle = pattern; + r.nodeShapes[r.getNodeShape(node)].draw(context, nodeX, nodeY, nodeTW, nodeTH); + context.translate(x, y); + context.fill(); + context.translate(-x, -y); + } + + context.globalAlpha = gAlpha; + + if (isSmoothingSwitched) { + r.setImgSmoothing(context, smoothingEnabled); + } + }; + + var CRp$6 = {}; + + CRp$6.eleTextBiggerThanMin = function (ele, scale) { + if (!scale) { + var zoom = ele.cy().zoom(); + var pxRatio = this.getPixelRatio(); + var lvl = Math.ceil(log2(zoom * pxRatio)); // the effective texture level + + scale = Math.pow(2, lvl); + } + + var computedSize = ele.pstyle('font-size').pfValue * scale; + var minSize = ele.pstyle('min-zoomed-font-size').pfValue; + + if (computedSize < minSize) { + return false; + } + + return true; + }; + + CRp$6.drawElementText = function (context, ele, shiftToOriginWithBb, force, prefix) { + var useEleOpacity = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + var r = this; + + if (force == null) { + if (useEleOpacity && !r.eleTextBiggerThanMin(ele)) { + return; + } + } else if (force === false) { + return; + } + + if (ele.isNode()) { + var label = ele.pstyle('label'); + + if (!label || !label.value) { + return; + } + + var justification = r.getLabelJustification(ele); + context.textAlign = justification; + context.textBaseline = 'bottom'; + } else { + var badLine = ele.element()._private.rscratch.badLine; + + var _label = ele.pstyle('label'); + + var srcLabel = ele.pstyle('source-label'); + var tgtLabel = ele.pstyle('target-label'); + + if (badLine || (!_label || !_label.value) && (!srcLabel || !srcLabel.value) && (!tgtLabel || !tgtLabel.value)) { + return; + } + + context.textAlign = 'center'; + context.textBaseline = 'bottom'; + } + + var applyRotation = !shiftToOriginWithBb; + var bb; + + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + + if (prefix == null) { + r.drawText(context, ele, null, applyRotation, useEleOpacity); + + if (ele.isEdge()) { + r.drawText(context, ele, 'source', applyRotation, useEleOpacity); + r.drawText(context, ele, 'target', applyRotation, useEleOpacity); + } + } else { + r.drawText(context, ele, prefix, applyRotation, useEleOpacity); + } + + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } + }; + + CRp$6.getFontCache = function (context) { + var cache; + this.fontCaches = this.fontCaches || []; + + for (var i = 0; i < this.fontCaches.length; i++) { + cache = this.fontCaches[i]; + + if (cache.context === context) { + return cache; + } + } + + cache = { + context: context + }; + this.fontCaches.push(cache); + return cache; + }; // set up canvas context with font + // returns transformed text string + + + CRp$6.setupTextStyle = function (context, ele) { + var useEleOpacity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + // Font style + var labelStyle = ele.pstyle('font-style').strValue; + var labelSize = ele.pstyle('font-size').pfValue + 'px'; + var labelFamily = ele.pstyle('font-family').strValue; + var labelWeight = ele.pstyle('font-weight').strValue; + var opacity = useEleOpacity ? ele.effectiveOpacity() * ele.pstyle('text-opacity').value : 1; + var outlineOpacity = ele.pstyle('text-outline-opacity').value * opacity; + var color = ele.pstyle('color').value; + var outlineColor = ele.pstyle('text-outline-color').value; + context.font = labelStyle + ' ' + labelWeight + ' ' + labelSize + ' ' + labelFamily; + context.lineJoin = 'round'; // so text outlines aren't jagged + + this.colorFillStyle(context, color[0], color[1], color[2], opacity); + this.colorStrokeStyle(context, outlineColor[0], outlineColor[1], outlineColor[2], outlineOpacity); + }; // TODO ensure re-used + + + function roundRect(ctx, x, y, width, height) { + var radius = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 5; + ctx.beginPath(); + ctx.moveTo(x + radius, y); + ctx.lineTo(x + width - radius, y); + ctx.quadraticCurveTo(x + width, y, x + width, y + radius); + ctx.lineTo(x + width, y + height - radius); + ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); + ctx.lineTo(x + radius, y + height); + ctx.quadraticCurveTo(x, y + height, x, y + height - radius); + ctx.lineTo(x, y + radius); + ctx.quadraticCurveTo(x, y, x + radius, y); + ctx.closePath(); + ctx.fill(); + } + + CRp$6.getTextAngle = function (ele, prefix) { + var theta; + var _p = ele._private; + var rscratch = _p.rscratch; + var pdash = prefix ? prefix + '-' : ''; + var rotation = ele.pstyle(pdash + 'text-rotation'); + var textAngle = getPrefixedProperty(rscratch, 'labelAngle', prefix); + + if (rotation.strValue === 'autorotate') { + theta = ele.isEdge() ? textAngle : 0; + } else if (rotation.strValue === 'none') { + theta = 0; + } else { + theta = rotation.pfValue; + } + + return theta; + }; + + CRp$6.drawText = function (context, ele, prefix) { + var applyRotation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var useEleOpacity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var _p = ele._private; + var rscratch = _p.rscratch; + var parentOpacity = useEleOpacity ? ele.effectiveOpacity() : 1; + + if (useEleOpacity && (parentOpacity === 0 || ele.pstyle('text-opacity').value === 0)) { + return; + } // use 'main' as an alias for the main label (i.e. null prefix) + + + if (prefix === 'main') { + prefix = null; + } + + var textX = getPrefixedProperty(rscratch, 'labelX', prefix); + var textY = getPrefixedProperty(rscratch, 'labelY', prefix); + var orgTextX, orgTextY; // used for rotation + + var text = this.getLabelText(ele, prefix); + + if (text != null && text !== '' && !isNaN(textX) && !isNaN(textY)) { + this.setupTextStyle(context, ele, useEleOpacity); + var pdash = prefix ? prefix + '-' : ''; + var textW = getPrefixedProperty(rscratch, 'labelWidth', prefix); + var textH = getPrefixedProperty(rscratch, 'labelHeight', prefix); + var marginX = ele.pstyle(pdash + 'text-margin-x').pfValue; + var marginY = ele.pstyle(pdash + 'text-margin-y').pfValue; + var isEdge = ele.isEdge(); + var halign = ele.pstyle('text-halign').value; + var valign = ele.pstyle('text-valign').value; + + if (isEdge) { + halign = 'center'; + valign = 'center'; + } + + textX += marginX; + textY += marginY; + var theta; + + if (!applyRotation) { + theta = 0; + } else { + theta = this.getTextAngle(ele, prefix); + } + + if (theta !== 0) { + orgTextX = textX; + orgTextY = textY; + context.translate(orgTextX, orgTextY); + context.rotate(theta); + textX = 0; + textY = 0; + } + + switch (valign) { + case 'top': + break; + + case 'center': + textY += textH / 2; + break; + + case 'bottom': + textY += textH; + break; + } + + var backgroundOpacity = ele.pstyle('text-background-opacity').value; + var borderOpacity = ele.pstyle('text-border-opacity').value; + var textBorderWidth = ele.pstyle('text-border-width').pfValue; + var backgroundPadding = ele.pstyle('text-background-padding').pfValue; + + if (backgroundOpacity > 0 || textBorderWidth > 0 && borderOpacity > 0) { + var bgX = textX - backgroundPadding; + + switch (halign) { + case 'left': + bgX -= textW; + break; + + case 'center': + bgX -= textW / 2; + break; + } + + var bgY = textY - textH - backgroundPadding; + var bgW = textW + 2 * backgroundPadding; + var bgH = textH + 2 * backgroundPadding; + + if (backgroundOpacity > 0) { + var textFill = context.fillStyle; + var textBackgroundColor = ele.pstyle('text-background-color').value; + context.fillStyle = 'rgba(' + textBackgroundColor[0] + ',' + textBackgroundColor[1] + ',' + textBackgroundColor[2] + ',' + backgroundOpacity * parentOpacity + ')'; + var styleShape = ele.pstyle('text-background-shape').strValue; + + if (styleShape.indexOf('round') === 0) { + roundRect(context, bgX, bgY, bgW, bgH, 2); + } else { + context.fillRect(bgX, bgY, bgW, bgH); + } + + context.fillStyle = textFill; + } + + if (textBorderWidth > 0 && borderOpacity > 0) { + var textStroke = context.strokeStyle; + var textLineWidth = context.lineWidth; + var textBorderColor = ele.pstyle('text-border-color').value; + var textBorderStyle = ele.pstyle('text-border-style').value; + context.strokeStyle = 'rgba(' + textBorderColor[0] + ',' + textBorderColor[1] + ',' + textBorderColor[2] + ',' + borderOpacity * parentOpacity + ')'; + context.lineWidth = textBorderWidth; + + if (context.setLineDash) { + // for very outofdate browsers + switch (textBorderStyle) { + case 'dotted': + context.setLineDash([1, 1]); + break; + + case 'dashed': + context.setLineDash([4, 2]); + break; + + case 'double': + context.lineWidth = textBorderWidth / 4; // 50% reserved for white between the two borders + + context.setLineDash([]); + break; + + case 'solid': + context.setLineDash([]); + break; + } + } + + context.strokeRect(bgX, bgY, bgW, bgH); + + if (textBorderStyle === 'double') { + var whiteWidth = textBorderWidth / 2; + context.strokeRect(bgX + whiteWidth, bgY + whiteWidth, bgW - whiteWidth * 2, bgH - whiteWidth * 2); + } + + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } + + context.lineWidth = textLineWidth; + context.strokeStyle = textStroke; + } + } + + var lineWidth = 2 * ele.pstyle('text-outline-width').pfValue; // *2 b/c the stroke is drawn centred on the middle + + if (lineWidth > 0) { + context.lineWidth = lineWidth; + } + + if (ele.pstyle('text-wrap').value === 'wrap') { + var lines = getPrefixedProperty(rscratch, 'labelWrapCachedLines', prefix); + var lineHeight = getPrefixedProperty(rscratch, 'labelLineHeight', prefix); + var halfTextW = textW / 2; + var justification = this.getLabelJustification(ele); + + if (justification === 'auto') ; else if (halign === 'left') { + // auto justification : right + if (justification === 'left') { + textX += -textW; + } else if (justification === 'center') { + textX += -halfTextW; + } // else same as auto + + } else if (halign === 'center') { + // auto justfication : center + if (justification === 'left') { + textX += -halfTextW; + } else if (justification === 'right') { + textX += halfTextW; + } // else same as auto + + } else if (halign === 'right') { + // auto justification : left + if (justification === 'center') { + textX += halfTextW; + } else if (justification === 'right') { + textX += textW; + } // else same as auto + + } + + switch (valign) { + case 'top': + textY -= (lines.length - 1) * lineHeight; + break; + + case 'center': + case 'bottom': + textY -= (lines.length - 1) * lineHeight; + break; + } + + for (var l = 0; l < lines.length; l++) { + if (lineWidth > 0) { + context.strokeText(lines[l], textX, textY); + } + + context.fillText(lines[l], textX, textY); + textY += lineHeight; + } + } else { + if (lineWidth > 0) { + context.strokeText(text, textX, textY); + } + + context.fillText(text, textX, textY); + } + + if (theta !== 0) { + context.rotate(-theta); + context.translate(-orgTextX, -orgTextY); + } + } + }; + + /* global Path2D */ + var CRp$5 = {}; + + CRp$5.drawNode = function (context, node, shiftToOriginWithBb) { + var drawLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; + var r = this; + var nodeWidth, nodeHeight; + var _p = node._private; + var rs = _p.rscratch; + var pos = node.position(); + + if (!number$1(pos.x) || !number$1(pos.y)) { + return; // can't draw node with undefined position + } + + if (shouldDrawOpacity && !node.visible()) { + return; + } + + var eleOpacity = shouldDrawOpacity ? node.effectiveOpacity() : 1; + var usePaths = r.usePaths(); + var path; + var pathCacheHit = false; + var padding = node.padding(); + nodeWidth = node.width() + 2 * padding; + nodeHeight = node.height() + 2 * padding; // + // setup shift + + var bb; + + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } // + // load bg image + + + var bgImgProp = node.pstyle('background-image'); + var urls = bgImgProp.value; + var urlDefined = new Array(urls.length); + var image = new Array(urls.length); + var numImages = 0; + + for (var i = 0; i < urls.length; i++) { + var url = urls[i]; + var defd = urlDefined[i] = url != null && url !== 'none'; + + if (defd) { + var bgImgCrossOrigin = node.cy().style().getIndexedStyle(node, 'background-image-crossorigin', 'value', i); + numImages++; // get image, and if not loaded then ask to redraw when later loaded + + image[i] = r.getCachedImage(url, bgImgCrossOrigin, function () { + _p.backgroundTimestamp = Date.now(); + node.emitAndNotify('background'); + }); + } + } // + // setup styles + + + var darkness = node.pstyle('background-blacken').value; + var borderWidth = node.pstyle('border-width').pfValue; + var bgOpacity = node.pstyle('background-opacity').value * eleOpacity; + var borderColor = node.pstyle('border-color').value; + var borderStyle = node.pstyle('border-style').value; + var borderOpacity = node.pstyle('border-opacity').value * eleOpacity; + context.lineJoin = 'miter'; // so borders are square with the node shape + + var setupShapeColor = function setupShapeColor() { + var bgOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : bgOpacity; + r.eleFillStyle(context, node, bgOpy); + }; + + var setupBorderColor = function setupBorderColor() { + var bdrOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : borderOpacity; + r.colorStrokeStyle(context, borderColor[0], borderColor[1], borderColor[2], bdrOpy); + }; // + // setup shape + + + var styleShape = node.pstyle('shape').strValue; + var shapePts = node.pstyle('shape-polygon-points').pfValue; + + if (usePaths) { + context.translate(pos.x, pos.y); + var pathCache = r.nodePathCache = r.nodePathCache || []; + var key = hashStrings(styleShape === 'polygon' ? styleShape + ',' + shapePts.join(',') : styleShape, '' + nodeHeight, '' + nodeWidth); + var cachedPath = pathCache[key]; + + if (cachedPath != null) { + path = cachedPath; + pathCacheHit = true; + rs.pathCache = path; + } else { + path = new Path2D(); + pathCache[key] = rs.pathCache = path; + } + } + + var drawShape = function drawShape() { + if (!pathCacheHit) { + var npos = pos; + + if (usePaths) { + npos = { + x: 0, + y: 0 + }; + } + + r.nodeShapes[r.getNodeShape(node)].draw(path || context, npos.x, npos.y, nodeWidth, nodeHeight); + } + + if (usePaths) { + context.fill(path); + } else { + context.fill(); + } + }; + + var drawImages = function drawImages() { + var nodeOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : eleOpacity; + var inside = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var prevBging = _p.backgrounding; + var totalCompleted = 0; + + for (var _i = 0; _i < image.length; _i++) { + var bgContainment = node.cy().style().getIndexedStyle(node, 'background-image-containment', 'value', _i); + + if (inside && bgContainment === 'over' || !inside && bgContainment === 'inside') { + totalCompleted++; + continue; + } + + if (urlDefined[_i] && image[_i].complete && !image[_i].error) { + totalCompleted++; + r.drawInscribedImage(context, image[_i], node, _i, nodeOpacity); + } + } + + _p.backgrounding = !(totalCompleted === numImages); + + if (prevBging !== _p.backgrounding) { + // update style b/c :backgrounding state changed + node.updateStyle(false); + } + }; + + var drawPie = function drawPie() { + var redrawShape = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var pieOpacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : eleOpacity; + + if (r.hasPie(node)) { + r.drawPie(context, node, pieOpacity); // redraw/restore path if steps after pie need it + + if (redrawShape) { + if (!usePaths) { + r.nodeShapes[r.getNodeShape(node)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight); + } + } + } + }; + + var darken = function darken() { + var darkenOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : eleOpacity; + var opacity = (darkness > 0 ? darkness : -darkness) * darkenOpacity; + var c = darkness > 0 ? 0 : 255; + + if (darkness !== 0) { + r.colorFillStyle(context, c, c, c, opacity); + + if (usePaths) { + context.fill(path); + } else { + context.fill(); + } + } + }; + + var drawBorder = function drawBorder() { + if (borderWidth > 0) { + context.lineWidth = borderWidth; + context.lineCap = 'butt'; + + if (context.setLineDash) { + // for very outofdate browsers + switch (borderStyle) { + case 'dotted': + context.setLineDash([1, 1]); + break; + + case 'dashed': + context.setLineDash([4, 2]); + break; + + case 'solid': + case 'double': + context.setLineDash([]); + break; + } + } + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } + + if (borderStyle === 'double') { + context.lineWidth = borderWidth / 3; + var gco = context.globalCompositeOperation; + context.globalCompositeOperation = 'destination-out'; + + if (usePaths) { + context.stroke(path); + } else { + context.stroke(); + } + + context.globalCompositeOperation = gco; + } // reset in case we changed the border style + + + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } + } + }; + + var drawOverlay = function drawOverlay() { + if (shouldDrawOverlay) { + r.drawNodeOverlay(context, node, pos, nodeWidth, nodeHeight); + } + }; + + var drawUnderlay = function drawUnderlay() { + if (shouldDrawOverlay) { + r.drawNodeUnderlay(context, node, pos, nodeWidth, nodeHeight); + } + }; + + var drawText = function drawText() { + r.drawElementText(context, node, null, drawLabel); + }; + + var ghost = node.pstyle('ghost').value === 'yes'; + + if (ghost) { + var gx = node.pstyle('ghost-offset-x').pfValue; + var gy = node.pstyle('ghost-offset-y').pfValue; + var ghostOpacity = node.pstyle('ghost-opacity').value; + var effGhostOpacity = ghostOpacity * eleOpacity; + context.translate(gx, gy); + setupShapeColor(ghostOpacity * bgOpacity); + drawShape(); + drawImages(effGhostOpacity, true); + setupBorderColor(ghostOpacity * borderOpacity); + drawBorder(); + drawPie(darkness !== 0 || borderWidth !== 0); + drawImages(effGhostOpacity, false); + darken(effGhostOpacity); + context.translate(-gx, -gy); + } + + if (usePaths) { + context.translate(-pos.x, -pos.y); + } + + drawUnderlay(); + + if (usePaths) { + context.translate(pos.x, pos.y); + } + + setupShapeColor(); + drawShape(); + drawImages(eleOpacity, true); + setupBorderColor(); + drawBorder(); + drawPie(darkness !== 0 || borderWidth !== 0); + drawImages(eleOpacity, false); + darken(); + + if (usePaths) { + context.translate(-pos.x, -pos.y); + } + + drawText(); + drawOverlay(); // + // clean up shift + + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } + }; + + var drawNodeOverlayUnderlay = function drawNodeOverlayUnderlay(overlayOrUnderlay) { + if (!['overlay', 'underlay'].includes(overlayOrUnderlay)) { + throw new Error('Invalid state'); + } + + return function (context, node, pos, nodeWidth, nodeHeight) { + var r = this; + + if (!node.visible()) { + return; + } + + var padding = node.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; + var opacity = node.pstyle("".concat(overlayOrUnderlay, "-opacity")).value; + var color = node.pstyle("".concat(overlayOrUnderlay, "-color")).value; + var shape = node.pstyle("".concat(overlayOrUnderlay, "-shape")).value; + + if (opacity > 0) { + pos = pos || node.position(); + + if (nodeWidth == null || nodeHeight == null) { + var _padding = node.padding(); + + nodeWidth = node.width() + 2 * _padding; + nodeHeight = node.height() + 2 * _padding; + } + + r.colorFillStyle(context, color[0], color[1], color[2], opacity); + r.nodeShapes[shape].draw(context, pos.x, pos.y, nodeWidth + padding * 2, nodeHeight + padding * 2); + context.fill(); + } + }; + }; + + CRp$5.drawNodeOverlay = drawNodeOverlayUnderlay('overlay'); + CRp$5.drawNodeUnderlay = drawNodeOverlayUnderlay('underlay'); // does the node have at least one pie piece? + + CRp$5.hasPie = function (node) { + node = node[0]; // ensure ele ref + + return node._private.hasPie; + }; + + CRp$5.drawPie = function (context, node, nodeOpacity, pos) { + node = node[0]; // ensure ele ref + + pos = pos || node.position(); + var cyStyle = node.cy().style(); + var pieSize = node.pstyle('pie-size'); + var x = pos.x; + var y = pos.y; + var nodeW = node.width(); + var nodeH = node.height(); + var radius = Math.min(nodeW, nodeH) / 2; // must fit in node + + var lastPercent = 0; // what % to continue drawing pie slices from on [0, 1] + + var usePaths = this.usePaths(); + + if (usePaths) { + x = 0; + y = 0; + } + + if (pieSize.units === '%') { + radius = radius * pieSize.pfValue; + } else if (pieSize.pfValue !== undefined) { + radius = pieSize.pfValue / 2; + } + + for (var i = 1; i <= cyStyle.pieBackgroundN; i++) { + // 1..N + var size = node.pstyle('pie-' + i + '-background-size').value; + var color = node.pstyle('pie-' + i + '-background-color').value; + var opacity = node.pstyle('pie-' + i + '-background-opacity').value * nodeOpacity; + var percent = size / 100; // map integer range [0, 100] to [0, 1] + // percent can't push beyond 1 + + if (percent + lastPercent > 1) { + percent = 1 - lastPercent; + } + + var angleStart = 1.5 * Math.PI + 2 * Math.PI * lastPercent; // start at 12 o'clock and go clockwise + + var angleDelta = 2 * Math.PI * percent; + var angleEnd = angleStart + angleDelta; // ignore if + // - zero size + // - we're already beyond the full circle + // - adding the current slice would go beyond the full circle + + if (size === 0 || lastPercent >= 1 || lastPercent + percent > 1) { + continue; + } + + context.beginPath(); + context.moveTo(x, y); + context.arc(x, y, radius, angleStart, angleEnd); + context.closePath(); + this.colorFillStyle(context, color[0], color[1], color[2], opacity); + context.fill(); + lastPercent += percent; + } + }; + + var CRp$4 = {}; + var motionBlurDelay = 100; // var isFirefox = typeof InstallTrigger !== 'undefined'; + + CRp$4.getPixelRatio = function () { + var context = this.data.contexts[0]; + + if (this.forcedPixelRatio != null) { + return this.forcedPixelRatio; + } + + var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; + return (window.devicePixelRatio || 1) / backingStore; // eslint-disable-line no-undef + }; + + CRp$4.paintCache = function (context) { + var caches = this.paintCaches = this.paintCaches || []; + var needToCreateCache = true; + var cache; + + for (var i = 0; i < caches.length; i++) { + cache = caches[i]; + + if (cache.context === context) { + needToCreateCache = false; + break; + } + } + + if (needToCreateCache) { + cache = { + context: context + }; + caches.push(cache); + } + + return cache; + }; + + CRp$4.createGradientStyleFor = function (context, shapeStyleName, ele, fill, opacity) { + var gradientStyle; + var usePaths = this.usePaths(); + var colors = ele.pstyle(shapeStyleName + '-gradient-stop-colors').value, + positions = ele.pstyle(shapeStyleName + '-gradient-stop-positions').pfValue; + + if (fill === 'radial-gradient') { + if (ele.isEdge()) { + var start = ele.sourceEndpoint(), + end = ele.targetEndpoint(), + mid = ele.midpoint(); + var d1 = dist(start, mid); + var d2 = dist(end, mid); + gradientStyle = context.createRadialGradient(mid.x, mid.y, 0, mid.x, mid.y, Math.max(d1, d2)); + } else { + var pos = usePaths ? { + x: 0, + y: 0 + } : ele.position(), + width = ele.paddedWidth(), + height = ele.paddedHeight(); + gradientStyle = context.createRadialGradient(pos.x, pos.y, 0, pos.x, pos.y, Math.max(width, height)); + } + } else { + if (ele.isEdge()) { + var _start = ele.sourceEndpoint(), + _end = ele.targetEndpoint(); + + gradientStyle = context.createLinearGradient(_start.x, _start.y, _end.x, _end.y); + } else { + var _pos = usePaths ? { + x: 0, + y: 0 + } : ele.position(), + _width = ele.paddedWidth(), + _height = ele.paddedHeight(), + halfWidth = _width / 2, + halfHeight = _height / 2; + + var direction = ele.pstyle('background-gradient-direction').value; + + switch (direction) { + case 'to-bottom': + gradientStyle = context.createLinearGradient(_pos.x, _pos.y - halfHeight, _pos.x, _pos.y + halfHeight); + break; + + case 'to-top': + gradientStyle = context.createLinearGradient(_pos.x, _pos.y + halfHeight, _pos.x, _pos.y - halfHeight); + break; + + case 'to-left': + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y, _pos.x - halfWidth, _pos.y); + break; + + case 'to-right': + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y, _pos.x + halfWidth, _pos.y); + break; + + case 'to-bottom-right': + case 'to-right-bottom': + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y - halfHeight, _pos.x + halfWidth, _pos.y + halfHeight); + break; + + case 'to-top-right': + case 'to-right-top': + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y + halfHeight, _pos.x + halfWidth, _pos.y - halfHeight); + break; + + case 'to-bottom-left': + case 'to-left-bottom': + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y - halfHeight, _pos.x - halfWidth, _pos.y + halfHeight); + break; + + case 'to-top-left': + case 'to-left-top': + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y + halfHeight, _pos.x - halfWidth, _pos.y - halfHeight); + break; + } + } + } + + if (!gradientStyle) return null; // invalid gradient style + + var hasPositions = positions.length === colors.length; + var length = colors.length; + + for (var i = 0; i < length; i++) { + gradientStyle.addColorStop(hasPositions ? positions[i] : i / (length - 1), 'rgba(' + colors[i][0] + ',' + colors[i][1] + ',' + colors[i][2] + ',' + opacity + ')'); + } + + return gradientStyle; + }; + + CRp$4.gradientFillStyle = function (context, ele, fill, opacity) { + var gradientStyle = this.createGradientStyleFor(context, 'background', ele, fill, opacity); + if (!gradientStyle) return null; // error + + context.fillStyle = gradientStyle; + }; + + CRp$4.colorFillStyle = function (context, r, g, b, a) { + context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; // turn off for now, seems context does its own caching + // var cache = this.paintCache(context); + // var fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; + // if( cache.fillStyle !== fillStyle ){ + // context.fillStyle = cache.fillStyle = fillStyle; + // } + }; + + CRp$4.eleFillStyle = function (context, ele, opacity) { + var backgroundFill = ele.pstyle('background-fill').value; + + if (backgroundFill === 'linear-gradient' || backgroundFill === 'radial-gradient') { + this.gradientFillStyle(context, ele, backgroundFill, opacity); + } else { + var backgroundColor = ele.pstyle('background-color').value; + this.colorFillStyle(context, backgroundColor[0], backgroundColor[1], backgroundColor[2], opacity); + } + }; + + CRp$4.gradientStrokeStyle = function (context, ele, fill, opacity) { + var gradientStyle = this.createGradientStyleFor(context, 'line', ele, fill, opacity); + if (!gradientStyle) return null; // error + + context.strokeStyle = gradientStyle; + }; + + CRp$4.colorStrokeStyle = function (context, r, g, b, a) { + context.strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; // turn off for now, seems context does its own caching + // var cache = this.paintCache(context); + // var strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; + // if( cache.strokeStyle !== strokeStyle ){ + // context.strokeStyle = cache.strokeStyle = strokeStyle; + // } + }; + + CRp$4.eleStrokeStyle = function (context, ele, opacity) { + var lineFill = ele.pstyle('line-fill').value; + + if (lineFill === 'linear-gradient' || lineFill === 'radial-gradient') { + this.gradientStrokeStyle(context, ele, lineFill, opacity); + } else { + var lineColor = ele.pstyle('line-color').value; + this.colorStrokeStyle(context, lineColor[0], lineColor[1], lineColor[2], opacity); + } + }; // Resize canvas + + + CRp$4.matchCanvasSize = function (container) { + var r = this; + var data = r.data; + var bb = r.findContainerClientCoords(); + var width = bb[2]; + var height = bb[3]; + var pixelRatio = r.getPixelRatio(); + var mbPxRatio = r.motionBlurPxRatio; + + if (container === r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE] || container === r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG]) { + pixelRatio = mbPxRatio; + } + + var canvasWidth = width * pixelRatio; + var canvasHeight = height * pixelRatio; + var canvas; + + if (canvasWidth === r.canvasWidth && canvasHeight === r.canvasHeight) { + return; // save cycles if same + } + + r.fontCaches = null; // resizing resets the style + + var canvasContainer = data.canvasContainer; + canvasContainer.style.width = width + 'px'; + canvasContainer.style.height = height + 'px'; + + for (var i = 0; i < r.CANVAS_LAYERS; i++) { + canvas = data.canvases[i]; + canvas.width = canvasWidth; + canvas.height = canvasHeight; + canvas.style.width = width + 'px'; + canvas.style.height = height + 'px'; + } + + for (var i = 0; i < r.BUFFER_COUNT; i++) { + canvas = data.bufferCanvases[i]; + canvas.width = canvasWidth; + canvas.height = canvasHeight; + canvas.style.width = width + 'px'; + canvas.style.height = height + 'px'; + } + + r.textureMult = 1; + + if (pixelRatio <= 1) { + canvas = data.bufferCanvases[r.TEXTURE_BUFFER]; + r.textureMult = 2; + canvas.width = canvasWidth * r.textureMult; + canvas.height = canvasHeight * r.textureMult; + } + + r.canvasWidth = canvasWidth; + r.canvasHeight = canvasHeight; + }; + + CRp$4.renderTo = function (cxt, zoom, pan, pxRatio) { + this.render({ + forcedContext: cxt, + forcedZoom: zoom, + forcedPan: pan, + drawAllLayers: true, + forcedPxRatio: pxRatio + }); + }; + + CRp$4.render = function (options) { + options = options || staticEmptyObject(); + var forcedContext = options.forcedContext; + var drawAllLayers = options.drawAllLayers; + var drawOnlyNodeLayer = options.drawOnlyNodeLayer; + var forcedZoom = options.forcedZoom; + var forcedPan = options.forcedPan; + var r = this; + var pixelRatio = options.forcedPxRatio === undefined ? this.getPixelRatio() : options.forcedPxRatio; + var cy = r.cy; + var data = r.data; + var needDraw = data.canvasNeedsRedraw; + var textureDraw = r.textureOnViewport && !forcedContext && (r.pinching || r.hoverData.dragging || r.swipePanning || r.data.wheelZooming); + var motionBlur = options.motionBlur !== undefined ? options.motionBlur : r.motionBlur; + var mbPxRatio = r.motionBlurPxRatio; + var hasCompoundNodes = cy.hasCompoundNodes(); + var inNodeDragGesture = r.hoverData.draggingEles; + var inBoxSelection = r.hoverData.selecting || r.touchData.selecting ? true : false; + motionBlur = motionBlur && !forcedContext && r.motionBlurEnabled && !inBoxSelection; + var motionBlurFadeEffect = motionBlur; + + if (!forcedContext) { + if (r.prevPxRatio !== pixelRatio) { + r.invalidateContainerClientCoordsCache(); + r.matchCanvasSize(r.container); + r.redrawHint('eles', true); + r.redrawHint('drag', true); + } + + r.prevPxRatio = pixelRatio; + } + + if (!forcedContext && r.motionBlurTimeout) { + clearTimeout(r.motionBlurTimeout); + } + + if (motionBlur) { + if (r.mbFrames == null) { + r.mbFrames = 0; + } + + r.mbFrames++; + + if (r.mbFrames < 3) { + // need several frames before even high quality motionblur + motionBlurFadeEffect = false; + } // go to lower quality blurry frames when several m/b frames have been rendered (avoids flashing) + + + if (r.mbFrames > r.minMbLowQualFrames) { + //r.fullQualityMb = false; + r.motionBlurPxRatio = r.mbPxRBlurry; + } + } + + if (r.clearingMotionBlur) { + r.motionBlurPxRatio = 1; + } // b/c drawToContext() may be async w.r.t. redraw(), keep track of last texture frame + // because a rogue async texture frame would clear needDraw + + + if (r.textureDrawLastFrame && !textureDraw) { + needDraw[r.NODE] = true; + needDraw[r.SELECT_BOX] = true; + } + + var style = cy.style(); + var zoom = cy.zoom(); + var effectiveZoom = forcedZoom !== undefined ? forcedZoom : zoom; + var pan = cy.pan(); + var effectivePan = { + x: pan.x, + y: pan.y + }; + var vp = { + zoom: zoom, + pan: { + x: pan.x, + y: pan.y + } + }; + var prevVp = r.prevViewport; + var viewportIsDiff = prevVp === undefined || vp.zoom !== prevVp.zoom || vp.pan.x !== prevVp.pan.x || vp.pan.y !== prevVp.pan.y; // we want the low quality motionblur only when the viewport is being manipulated etc (where it's not noticed) + + if (!viewportIsDiff && !(inNodeDragGesture && !hasCompoundNodes)) { + r.motionBlurPxRatio = 1; + } + + if (forcedPan) { + effectivePan = forcedPan; + } // apply pixel ratio + + + effectiveZoom *= pixelRatio; + effectivePan.x *= pixelRatio; + effectivePan.y *= pixelRatio; + var eles = r.getCachedZSortedEles(); + + function mbclear(context, x, y, w, h) { + var gco = context.globalCompositeOperation; + context.globalCompositeOperation = 'destination-out'; + r.colorFillStyle(context, 255, 255, 255, r.motionBlurTransparency); + context.fillRect(x, y, w, h); + context.globalCompositeOperation = gco; + } + + function setContextTransform(context, clear) { + var ePan, eZoom, w, h; + + if (!r.clearingMotionBlur && (context === data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE] || context === data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG])) { + ePan = { + x: pan.x * mbPxRatio, + y: pan.y * mbPxRatio + }; + eZoom = zoom * mbPxRatio; + w = r.canvasWidth * mbPxRatio; + h = r.canvasHeight * mbPxRatio; + } else { + ePan = effectivePan; + eZoom = effectiveZoom; + w = r.canvasWidth; + h = r.canvasHeight; + } + + context.setTransform(1, 0, 0, 1, 0, 0); + + if (clear === 'motionBlur') { + mbclear(context, 0, 0, w, h); + } else if (!forcedContext && (clear === undefined || clear)) { + context.clearRect(0, 0, w, h); + } + + if (!drawAllLayers) { + context.translate(ePan.x, ePan.y); + context.scale(eZoom, eZoom); + } + + if (forcedPan) { + context.translate(forcedPan.x, forcedPan.y); + } + + if (forcedZoom) { + context.scale(forcedZoom, forcedZoom); + } + } + + if (!textureDraw) { + r.textureDrawLastFrame = false; + } + + if (textureDraw) { + r.textureDrawLastFrame = true; + + if (!r.textureCache) { + r.textureCache = {}; + r.textureCache.bb = cy.mutableElements().boundingBox(); + r.textureCache.texture = r.data.bufferCanvases[r.TEXTURE_BUFFER]; + var cxt = r.data.bufferContexts[r.TEXTURE_BUFFER]; + cxt.setTransform(1, 0, 0, 1, 0, 0); + cxt.clearRect(0, 0, r.canvasWidth * r.textureMult, r.canvasHeight * r.textureMult); + r.render({ + forcedContext: cxt, + drawOnlyNodeLayer: true, + forcedPxRatio: pixelRatio * r.textureMult + }); + var vp = r.textureCache.viewport = { + zoom: cy.zoom(), + pan: cy.pan(), + width: r.canvasWidth, + height: r.canvasHeight + }; + vp.mpan = { + x: (0 - vp.pan.x) / vp.zoom, + y: (0 - vp.pan.y) / vp.zoom + }; + } + + needDraw[r.DRAG] = false; + needDraw[r.NODE] = false; + var context = data.contexts[r.NODE]; + var texture = r.textureCache.texture; + var vp = r.textureCache.viewport; + context.setTransform(1, 0, 0, 1, 0, 0); + + if (motionBlur) { + mbclear(context, 0, 0, vp.width, vp.height); + } else { + context.clearRect(0, 0, vp.width, vp.height); + } + + var outsideBgColor = style.core('outside-texture-bg-color').value; + var outsideBgOpacity = style.core('outside-texture-bg-opacity').value; + r.colorFillStyle(context, outsideBgColor[0], outsideBgColor[1], outsideBgColor[2], outsideBgOpacity); + context.fillRect(0, 0, vp.width, vp.height); + var zoom = cy.zoom(); + setContextTransform(context, false); + context.clearRect(vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio); + context.drawImage(texture, vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio); + } else if (r.textureOnViewport && !forcedContext) { + // clear the cache since we don't need it + r.textureCache = null; + } + + var extent = cy.extent(); + var vpManip = r.pinching || r.hoverData.dragging || r.swipePanning || r.data.wheelZooming || r.hoverData.draggingEles || r.cy.animated(); + var hideEdges = r.hideEdgesOnViewport && vpManip; + var needMbClear = []; + needMbClear[r.NODE] = !needDraw[r.NODE] && motionBlur && !r.clearedForMotionBlur[r.NODE] || r.clearingMotionBlur; + + if (needMbClear[r.NODE]) { + r.clearedForMotionBlur[r.NODE] = true; + } + + needMbClear[r.DRAG] = !needDraw[r.DRAG] && motionBlur && !r.clearedForMotionBlur[r.DRAG] || r.clearingMotionBlur; + + if (needMbClear[r.DRAG]) { + r.clearedForMotionBlur[r.DRAG] = true; + } + + if (needDraw[r.NODE] || drawAllLayers || drawOnlyNodeLayer || needMbClear[r.NODE]) { + var useBuffer = motionBlur && !needMbClear[r.NODE] && mbPxRatio !== 1; + var context = forcedContext || (useBuffer ? r.data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE] : data.contexts[r.NODE]); + var clear = motionBlur && !useBuffer ? 'motionBlur' : undefined; + setContextTransform(context, clear); + + if (hideEdges) { + r.drawCachedNodes(context, eles.nondrag, pixelRatio, extent); + } else { + r.drawLayeredElements(context, eles.nondrag, pixelRatio, extent); + } + + if (r.debug) { + r.drawDebugPoints(context, eles.nondrag); + } + + if (!drawAllLayers && !motionBlur) { + needDraw[r.NODE] = false; + } + } + + if (!drawOnlyNodeLayer && (needDraw[r.DRAG] || drawAllLayers || needMbClear[r.DRAG])) { + var useBuffer = motionBlur && !needMbClear[r.DRAG] && mbPxRatio !== 1; + var context = forcedContext || (useBuffer ? r.data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG] : data.contexts[r.DRAG]); + setContextTransform(context, motionBlur && !useBuffer ? 'motionBlur' : undefined); + + if (hideEdges) { + r.drawCachedNodes(context, eles.drag, pixelRatio, extent); + } else { + r.drawCachedElements(context, eles.drag, pixelRatio, extent); + } + + if (r.debug) { + r.drawDebugPoints(context, eles.drag); + } + + if (!drawAllLayers && !motionBlur) { + needDraw[r.DRAG] = false; + } + } + + if (r.showFps || !drawOnlyNodeLayer && needDraw[r.SELECT_BOX] && !drawAllLayers) { + var context = forcedContext || data.contexts[r.SELECT_BOX]; + setContextTransform(context); + + if (r.selection[4] == 1 && (r.hoverData.selecting || r.touchData.selecting)) { + var zoom = r.cy.zoom(); + var borderWidth = style.core('selection-box-border-width').value / zoom; + context.lineWidth = borderWidth; + context.fillStyle = 'rgba(' + style.core('selection-box-color').value[0] + ',' + style.core('selection-box-color').value[1] + ',' + style.core('selection-box-color').value[2] + ',' + style.core('selection-box-opacity').value + ')'; + context.fillRect(r.selection[0], r.selection[1], r.selection[2] - r.selection[0], r.selection[3] - r.selection[1]); + + if (borderWidth > 0) { + context.strokeStyle = 'rgba(' + style.core('selection-box-border-color').value[0] + ',' + style.core('selection-box-border-color').value[1] + ',' + style.core('selection-box-border-color').value[2] + ',' + style.core('selection-box-opacity').value + ')'; + context.strokeRect(r.selection[0], r.selection[1], r.selection[2] - r.selection[0], r.selection[3] - r.selection[1]); + } + } + + if (data.bgActivePosistion && !r.hoverData.selecting) { + var zoom = r.cy.zoom(); + var pos = data.bgActivePosistion; + context.fillStyle = 'rgba(' + style.core('active-bg-color').value[0] + ',' + style.core('active-bg-color').value[1] + ',' + style.core('active-bg-color').value[2] + ',' + style.core('active-bg-opacity').value + ')'; + context.beginPath(); + context.arc(pos.x, pos.y, style.core('active-bg-size').pfValue / zoom, 0, 2 * Math.PI); + context.fill(); + } + + var timeToRender = r.lastRedrawTime; + + if (r.showFps && timeToRender) { + timeToRender = Math.round(timeToRender); + var fps = Math.round(1000 / timeToRender); + context.setTransform(1, 0, 0, 1, 0, 0); + context.fillStyle = 'rgba(255, 0, 0, 0.75)'; + context.strokeStyle = 'rgba(255, 0, 0, 0.75)'; + context.lineWidth = 1; + context.fillText('1 frame = ' + timeToRender + ' ms = ' + fps + ' fps', 0, 20); + var maxFps = 60; + context.strokeRect(0, 30, 250, 20); + context.fillRect(0, 30, 250 * Math.min(fps / maxFps, 1), 20); + } + + if (!drawAllLayers) { + needDraw[r.SELECT_BOX] = false; + } + } // motionblur: blit rendered blurry frames + + + if (motionBlur && mbPxRatio !== 1) { + var cxtNode = data.contexts[r.NODE]; + var txtNode = r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE]; + var cxtDrag = data.contexts[r.DRAG]; + var txtDrag = r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG]; + + var drawMotionBlur = function drawMotionBlur(cxt, txt, needClear) { + cxt.setTransform(1, 0, 0, 1, 0, 0); + + if (needClear || !motionBlurFadeEffect) { + cxt.clearRect(0, 0, r.canvasWidth, r.canvasHeight); + } else { + mbclear(cxt, 0, 0, r.canvasWidth, r.canvasHeight); + } + + var pxr = mbPxRatio; + cxt.drawImage(txt, // img + 0, 0, // sx, sy + r.canvasWidth * pxr, r.canvasHeight * pxr, // sw, sh + 0, 0, // x, y + r.canvasWidth, r.canvasHeight // w, h + ); + }; + + if (needDraw[r.NODE] || needMbClear[r.NODE]) { + drawMotionBlur(cxtNode, txtNode, needMbClear[r.NODE]); + needDraw[r.NODE] = false; + } + + if (needDraw[r.DRAG] || needMbClear[r.DRAG]) { + drawMotionBlur(cxtDrag, txtDrag, needMbClear[r.DRAG]); + needDraw[r.DRAG] = false; + } + } + + r.prevViewport = vp; + + if (r.clearingMotionBlur) { + r.clearingMotionBlur = false; + r.motionBlurCleared = true; + r.motionBlur = true; + } + + if (motionBlur) { + r.motionBlurTimeout = setTimeout(function () { + r.motionBlurTimeout = null; + r.clearedForMotionBlur[r.NODE] = false; + r.clearedForMotionBlur[r.DRAG] = false; + r.motionBlur = false; + r.clearingMotionBlur = !textureDraw; + r.mbFrames = 0; + needDraw[r.NODE] = true; + needDraw[r.DRAG] = true; + r.redraw(); + }, motionBlurDelay); + } + + if (!forcedContext) { + cy.emit('render'); + } + }; + + var CRp$3 = {}; // @O Polygon drawing + + CRp$3.drawPolygonPath = function (context, x, y, width, height, points) { + var halfW = width / 2; + var halfH = height / 2; + + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(x + halfW * points[0], y + halfH * points[1]); + + for (var i = 1; i < points.length / 2; i++) { + context.lineTo(x + halfW * points[i * 2], y + halfH * points[i * 2 + 1]); + } + + context.closePath(); + }; + + CRp$3.drawRoundPolygonPath = function (context, x, y, width, height, points) { + var halfW = width / 2; + var halfH = height / 2; + var cornerRadius = getRoundPolygonRadius(width, height); + + if (context.beginPath) { + context.beginPath(); + } + + for (var _i = 0; _i < points.length / 4; _i++) { + var sourceUv = void 0, + destUv = void 0; + + if (_i === 0) { + sourceUv = points.length - 2; + } else { + sourceUv = _i * 4 - 2; + } + + destUv = _i * 4 + 2; + var px = x + halfW * points[_i * 4]; + var py = y + halfH * points[_i * 4 + 1]; + var cosTheta = -points[sourceUv] * points[destUv] - points[sourceUv + 1] * points[destUv + 1]; + var offset = cornerRadius / Math.tan(Math.acos(cosTheta) / 2); + var cp0x = px - offset * points[sourceUv]; + var cp0y = py - offset * points[sourceUv + 1]; + var cp1x = px + offset * points[destUv]; + var cp1y = py + offset * points[destUv + 1]; + + if (_i === 0) { + context.moveTo(cp0x, cp0y); + } else { + context.lineTo(cp0x, cp0y); + } + + context.arcTo(px, py, cp1x, cp1y, cornerRadius); + } + + context.closePath(); + }; // Round rectangle drawing + + + CRp$3.drawRoundRectanglePath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var cornerRadius = getRoundRectangleRadius(width, height); + + if (context.beginPath) { + context.beginPath(); + } // Start at top middle + + + context.moveTo(x, y - halfHeight); // Arc from middle top to right side + + context.arcTo(x + halfWidth, y - halfHeight, x + halfWidth, y, cornerRadius); // Arc from right side to bottom + + context.arcTo(x + halfWidth, y + halfHeight, x, y + halfHeight, cornerRadius); // Arc from bottom to left side + + context.arcTo(x - halfWidth, y + halfHeight, x - halfWidth, y, cornerRadius); // Arc from left side to topBorder + + context.arcTo(x - halfWidth, y - halfHeight, x, y - halfHeight, cornerRadius); // Join line + + context.lineTo(x, y - halfHeight); + context.closePath(); + }; + + CRp$3.drawBottomRoundRectanglePath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var cornerRadius = getRoundRectangleRadius(width, height); + + if (context.beginPath) { + context.beginPath(); + } // Start at top middle + + + context.moveTo(x, y - halfHeight); + context.lineTo(x + halfWidth, y - halfHeight); + context.lineTo(x + halfWidth, y); + context.arcTo(x + halfWidth, y + halfHeight, x, y + halfHeight, cornerRadius); + context.arcTo(x - halfWidth, y + halfHeight, x - halfWidth, y, cornerRadius); + context.lineTo(x - halfWidth, y - halfHeight); + context.lineTo(x, y - halfHeight); + context.closePath(); + }; + + CRp$3.drawCutRectanglePath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var cornerLength = getCutRectangleCornerLength(); + + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(x - halfWidth + cornerLength, y - halfHeight); + context.lineTo(x + halfWidth - cornerLength, y - halfHeight); + context.lineTo(x + halfWidth, y - halfHeight + cornerLength); + context.lineTo(x + halfWidth, y + halfHeight - cornerLength); + context.lineTo(x + halfWidth - cornerLength, y + halfHeight); + context.lineTo(x - halfWidth + cornerLength, y + halfHeight); + context.lineTo(x - halfWidth, y + halfHeight - cornerLength); + context.lineTo(x - halfWidth, y - halfHeight + cornerLength); + context.closePath(); + }; + + CRp$3.drawBarrelPath = function (context, x, y, width, height) { + var halfWidth = width / 2; + var halfHeight = height / 2; + var xBegin = x - halfWidth; + var xEnd = x + halfWidth; + var yBegin = y - halfHeight; + var yEnd = y + halfHeight; + var barrelCurveConstants = getBarrelCurveConstants(width, height); + var wOffset = barrelCurveConstants.widthOffset; + var hOffset = barrelCurveConstants.heightOffset; + var ctrlPtXOffset = barrelCurveConstants.ctrlPtOffsetPct * wOffset; + + if (context.beginPath) { + context.beginPath(); + } + + context.moveTo(xBegin, yBegin + hOffset); + context.lineTo(xBegin, yEnd - hOffset); + context.quadraticCurveTo(xBegin + ctrlPtXOffset, yEnd, xBegin + wOffset, yEnd); + context.lineTo(xEnd - wOffset, yEnd); + context.quadraticCurveTo(xEnd - ctrlPtXOffset, yEnd, xEnd, yEnd - hOffset); + context.lineTo(xEnd, yBegin + hOffset); + context.quadraticCurveTo(xEnd - ctrlPtXOffset, yBegin, xEnd - wOffset, yBegin); + context.lineTo(xBegin + wOffset, yBegin); + context.quadraticCurveTo(xBegin + ctrlPtXOffset, yBegin, xBegin, yBegin + hOffset); + context.closePath(); + }; + + var sin0 = Math.sin(0); + var cos0 = Math.cos(0); + var sin = {}; + var cos = {}; + var ellipseStepSize = Math.PI / 40; + + for (var i = 0 * Math.PI; i < 2 * Math.PI; i += ellipseStepSize) { + sin[i] = Math.sin(i); + cos[i] = Math.cos(i); + } + + CRp$3.drawEllipsePath = function (context, centerX, centerY, width, height) { + if (context.beginPath) { + context.beginPath(); + } + + if (context.ellipse) { + context.ellipse(centerX, centerY, width / 2, height / 2, 0, 0, 2 * Math.PI); + } else { + var xPos, yPos; + var rw = width / 2; + var rh = height / 2; + + for (var i = 0 * Math.PI; i < 2 * Math.PI; i += ellipseStepSize) { + xPos = centerX - rw * sin[i] * sin0 + rw * cos[i] * cos0; + yPos = centerY + rh * cos[i] * sin0 + rh * sin[i] * cos0; + + if (i === 0) { + context.moveTo(xPos, yPos); + } else { + context.lineTo(xPos, yPos); + } + } + } + + context.closePath(); + }; + + /* global atob, ArrayBuffer, Uint8Array, Blob */ + var CRp$2 = {}; + + CRp$2.createBuffer = function (w, h) { + var buffer = document.createElement('canvas'); // eslint-disable-line no-undef + + buffer.width = w; + buffer.height = h; + return [buffer, buffer.getContext('2d')]; + }; + + CRp$2.bufferCanvasImage = function (options) { + var cy = this.cy; + var eles = cy.mutableElements(); + var bb = eles.boundingBox(); + var ctrRect = this.findContainerClientCoords(); + var width = options.full ? Math.ceil(bb.w) : ctrRect[2]; + var height = options.full ? Math.ceil(bb.h) : ctrRect[3]; + var specdMaxDims = number$1(options.maxWidth) || number$1(options.maxHeight); + var pxRatio = this.getPixelRatio(); + var scale = 1; + + if (options.scale !== undefined) { + width *= options.scale; + height *= options.scale; + scale = options.scale; + } else if (specdMaxDims) { + var maxScaleW = Infinity; + var maxScaleH = Infinity; + + if (number$1(options.maxWidth)) { + maxScaleW = scale * options.maxWidth / width; + } + + if (number$1(options.maxHeight)) { + maxScaleH = scale * options.maxHeight / height; + } + + scale = Math.min(maxScaleW, maxScaleH); + width *= scale; + height *= scale; + } + + if (!specdMaxDims) { + width *= pxRatio; + height *= pxRatio; + scale *= pxRatio; + } + + var buffCanvas = document.createElement('canvas'); // eslint-disable-line no-undef + + buffCanvas.width = width; + buffCanvas.height = height; + buffCanvas.style.width = width + 'px'; + buffCanvas.style.height = height + 'px'; + var buffCxt = buffCanvas.getContext('2d'); // Rasterize the layers, but only if container has nonzero size + + if (width > 0 && height > 0) { + buffCxt.clearRect(0, 0, width, height); + buffCxt.globalCompositeOperation = 'source-over'; + var zsortedEles = this.getCachedZSortedEles(); + + if (options.full) { + // draw the full bounds of the graph + buffCxt.translate(-bb.x1 * scale, -bb.y1 * scale); + buffCxt.scale(scale, scale); + this.drawElements(buffCxt, zsortedEles); + buffCxt.scale(1 / scale, 1 / scale); + buffCxt.translate(bb.x1 * scale, bb.y1 * scale); + } else { + // draw the current view + var pan = cy.pan(); + var translation = { + x: pan.x * scale, + y: pan.y * scale + }; + scale *= cy.zoom(); + buffCxt.translate(translation.x, translation.y); + buffCxt.scale(scale, scale); + this.drawElements(buffCxt, zsortedEles); + buffCxt.scale(1 / scale, 1 / scale); + buffCxt.translate(-translation.x, -translation.y); + } // need to fill bg at end like this in order to fill cleared transparent pixels in jpgs + + + if (options.bg) { + buffCxt.globalCompositeOperation = 'destination-over'; + buffCxt.fillStyle = options.bg; + buffCxt.rect(0, 0, width, height); + buffCxt.fill(); + } + } + + return buffCanvas; + }; + + function b64ToBlob(b64, mimeType) { + var bytes = atob(b64); + var buff = new ArrayBuffer(bytes.length); + var buffUint8 = new Uint8Array(buff); + + for (var i = 0; i < bytes.length; i++) { + buffUint8[i] = bytes.charCodeAt(i); + } + + return new Blob([buff], { + type: mimeType + }); + } + + function b64UriToB64(b64uri) { + var i = b64uri.indexOf(','); + return b64uri.substr(i + 1); + } + + function output(options, canvas, mimeType) { + var getB64Uri = function getB64Uri() { + return canvas.toDataURL(mimeType, options.quality); + }; + + switch (options.output) { + case 'blob-promise': + return new Promise$1(function (resolve, reject) { + try { + canvas.toBlob(function (blob) { + if (blob != null) { + resolve(blob); + } else { + reject(new Error('`canvas.toBlob()` sent a null value in its callback')); + } + }, mimeType, options.quality); + } catch (err) { + reject(err); + } + }); + + case 'blob': + return b64ToBlob(b64UriToB64(getB64Uri()), mimeType); + + case 'base64': + return b64UriToB64(getB64Uri()); + + case 'base64uri': + default: + return getB64Uri(); + } + } + + CRp$2.png = function (options) { + return output(options, this.bufferCanvasImage(options), 'image/png'); + }; + + CRp$2.jpg = function (options) { + return output(options, this.bufferCanvasImage(options), 'image/jpeg'); + }; + + var CRp$1 = {}; + + CRp$1.nodeShapeImpl = function (name, context, centerX, centerY, width, height, points) { + switch (name) { + case 'ellipse': + return this.drawEllipsePath(context, centerX, centerY, width, height); + + case 'polygon': + return this.drawPolygonPath(context, centerX, centerY, width, height, points); + + case 'round-polygon': + return this.drawRoundPolygonPath(context, centerX, centerY, width, height, points); + + case 'roundrectangle': + case 'round-rectangle': + return this.drawRoundRectanglePath(context, centerX, centerY, width, height); + + case 'cutrectangle': + case 'cut-rectangle': + return this.drawCutRectanglePath(context, centerX, centerY, width, height); + + case 'bottomroundrectangle': + case 'bottom-round-rectangle': + return this.drawBottomRoundRectanglePath(context, centerX, centerY, width, height); + + case 'barrel': + return this.drawBarrelPath(context, centerX, centerY, width, height); + } + }; + + var CR = CanvasRenderer; + var CRp = CanvasRenderer.prototype; + CRp.CANVAS_LAYERS = 3; // + + CRp.SELECT_BOX = 0; + CRp.DRAG = 1; + CRp.NODE = 2; + CRp.BUFFER_COUNT = 3; // + + CRp.TEXTURE_BUFFER = 0; + CRp.MOTIONBLUR_BUFFER_NODE = 1; + CRp.MOTIONBLUR_BUFFER_DRAG = 2; + + function CanvasRenderer(options) { + var r = this; + r.data = { + canvases: new Array(CRp.CANVAS_LAYERS), + contexts: new Array(CRp.CANVAS_LAYERS), + canvasNeedsRedraw: new Array(CRp.CANVAS_LAYERS), + bufferCanvases: new Array(CRp.BUFFER_COUNT), + bufferContexts: new Array(CRp.CANVAS_LAYERS) + }; + var tapHlOffAttr = '-webkit-tap-highlight-color'; + var tapHlOffStyle = 'rgba(0,0,0,0)'; + r.data.canvasContainer = document.createElement('div'); // eslint-disable-line no-undef + + var containerStyle = r.data.canvasContainer.style; + r.data.canvasContainer.style[tapHlOffAttr] = tapHlOffStyle; + containerStyle.position = 'relative'; + containerStyle.zIndex = '0'; + containerStyle.overflow = 'hidden'; + var container = options.cy.container(); + container.appendChild(r.data.canvasContainer); + container.style[tapHlOffAttr] = tapHlOffStyle; + var styleMap = { + '-webkit-user-select': 'none', + '-moz-user-select': '-moz-none', + 'user-select': 'none', + '-webkit-tap-highlight-color': 'rgba(0,0,0,0)', + 'outline-style': 'none' + }; + + if (ms()) { + styleMap['-ms-touch-action'] = 'none'; + styleMap['touch-action'] = 'none'; + } + + for (var i = 0; i < CRp.CANVAS_LAYERS; i++) { + var canvas = r.data.canvases[i] = document.createElement('canvas'); // eslint-disable-line no-undef + + r.data.contexts[i] = canvas.getContext('2d'); + Object.keys(styleMap).forEach(function (k) { + canvas.style[k] = styleMap[k]; + }); + canvas.style.position = 'absolute'; + canvas.setAttribute('data-id', 'layer' + i); + canvas.style.zIndex = String(CRp.CANVAS_LAYERS - i); + r.data.canvasContainer.appendChild(canvas); + r.data.canvasNeedsRedraw[i] = false; + } + + r.data.topCanvas = r.data.canvases[0]; + r.data.canvases[CRp.NODE].setAttribute('data-id', 'layer' + CRp.NODE + '-node'); + r.data.canvases[CRp.SELECT_BOX].setAttribute('data-id', 'layer' + CRp.SELECT_BOX + '-selectbox'); + r.data.canvases[CRp.DRAG].setAttribute('data-id', 'layer' + CRp.DRAG + '-drag'); + + for (var i = 0; i < CRp.BUFFER_COUNT; i++) { + r.data.bufferCanvases[i] = document.createElement('canvas'); // eslint-disable-line no-undef + + r.data.bufferContexts[i] = r.data.bufferCanvases[i].getContext('2d'); + r.data.bufferCanvases[i].style.position = 'absolute'; + r.data.bufferCanvases[i].setAttribute('data-id', 'buffer' + i); + r.data.bufferCanvases[i].style.zIndex = String(-i - 1); + r.data.bufferCanvases[i].style.visibility = 'hidden'; //r.data.canvasContainer.appendChild(r.data.bufferCanvases[i]); + } + + r.pathsEnabled = true; + var emptyBb = makeBoundingBox(); + + var getBoxCenter = function getBoxCenter(bb) { + return { + x: (bb.x1 + bb.x2) / 2, + y: (bb.y1 + bb.y2) / 2 + }; + }; + + var getCenterOffset = function getCenterOffset(bb) { + return { + x: -bb.w / 2, + y: -bb.h / 2 + }; + }; + + var backgroundTimestampHasChanged = function backgroundTimestampHasChanged(ele) { + var _p = ele[0]._private; + var same = _p.oldBackgroundTimestamp === _p.backgroundTimestamp; + return !same; + }; + + var getStyleKey = function getStyleKey(ele) { + return ele[0]._private.nodeKey; + }; + + var getLabelKey = function getLabelKey(ele) { + return ele[0]._private.labelStyleKey; + }; + + var getSourceLabelKey = function getSourceLabelKey(ele) { + return ele[0]._private.sourceLabelStyleKey; + }; + + var getTargetLabelKey = function getTargetLabelKey(ele) { + return ele[0]._private.targetLabelStyleKey; + }; + + var drawElement = function drawElement(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElement(context, ele, bb, false, false, useEleOpacity); + }; + + var drawLabel = function drawLabel(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElementText(context, ele, bb, scaledLabelShown, 'main', useEleOpacity); + }; + + var drawSourceLabel = function drawSourceLabel(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElementText(context, ele, bb, scaledLabelShown, 'source', useEleOpacity); + }; + + var drawTargetLabel = function drawTargetLabel(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r.drawElementText(context, ele, bb, scaledLabelShown, 'target', useEleOpacity); + }; + + var getElementBox = function getElementBox(ele) { + ele.boundingBox(); + return ele[0]._private.bodyBounds; + }; + + var getLabelBox = function getLabelBox(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.main || emptyBb; + }; + + var getSourceLabelBox = function getSourceLabelBox(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.source || emptyBb; + }; + + var getTargetLabelBox = function getTargetLabelBox(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.target || emptyBb; + }; + + var isLabelVisibleAtScale = function isLabelVisibleAtScale(ele, scaledLabelShown) { + return scaledLabelShown; + }; + + var getElementRotationPoint = function getElementRotationPoint(ele) { + return getBoxCenter(getElementBox(ele)); + }; + + var addTextMargin = function addTextMargin(prefix, pt, ele) { + var pre = prefix ? prefix + '-' : ''; + return { + x: pt.x + ele.pstyle(pre + 'text-margin-x').pfValue, + y: pt.y + ele.pstyle(pre + 'text-margin-y').pfValue + }; + }; + + var getRsPt = function getRsPt(ele, x, y) { + var rs = ele[0]._private.rscratch; + return { + x: rs[x], + y: rs[y] + }; + }; + + var getLabelRotationPoint = function getLabelRotationPoint(ele) { + return addTextMargin('', getRsPt(ele, 'labelX', 'labelY'), ele); + }; + + var getSourceLabelRotationPoint = function getSourceLabelRotationPoint(ele) { + return addTextMargin('source', getRsPt(ele, 'sourceLabelX', 'sourceLabelY'), ele); + }; + + var getTargetLabelRotationPoint = function getTargetLabelRotationPoint(ele) { + return addTextMargin('target', getRsPt(ele, 'targetLabelX', 'targetLabelY'), ele); + }; + + var getElementRotationOffset = function getElementRotationOffset(ele) { + return getCenterOffset(getElementBox(ele)); + }; + + var getSourceLabelRotationOffset = function getSourceLabelRotationOffset(ele) { + return getCenterOffset(getSourceLabelBox(ele)); + }; + + var getTargetLabelRotationOffset = function getTargetLabelRotationOffset(ele) { + return getCenterOffset(getTargetLabelBox(ele)); + }; + + var getLabelRotationOffset = function getLabelRotationOffset(ele) { + var bb = getLabelBox(ele); + var p = getCenterOffset(getLabelBox(ele)); + + if (ele.isNode()) { + switch (ele.pstyle('text-halign').value) { + case 'left': + p.x = -bb.w; + break; + + case 'right': + p.x = 0; + break; + } + + switch (ele.pstyle('text-valign').value) { + case 'top': + p.y = -bb.h; + break; + + case 'bottom': + p.y = 0; + break; + } + } + + return p; + }; + + var eleTxrCache = r.data.eleTxrCache = new ElementTextureCache(r, { + getKey: getStyleKey, + doesEleInvalidateKey: backgroundTimestampHasChanged, + drawElement: drawElement, + getBoundingBox: getElementBox, + getRotationPoint: getElementRotationPoint, + getRotationOffset: getElementRotationOffset, + allowEdgeTxrCaching: false, + allowParentTxrCaching: false + }); + var lblTxrCache = r.data.lblTxrCache = new ElementTextureCache(r, { + getKey: getLabelKey, + drawElement: drawLabel, + getBoundingBox: getLabelBox, + getRotationPoint: getLabelRotationPoint, + getRotationOffset: getLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var slbTxrCache = r.data.slbTxrCache = new ElementTextureCache(r, { + getKey: getSourceLabelKey, + drawElement: drawSourceLabel, + getBoundingBox: getSourceLabelBox, + getRotationPoint: getSourceLabelRotationPoint, + getRotationOffset: getSourceLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var tlbTxrCache = r.data.tlbTxrCache = new ElementTextureCache(r, { + getKey: getTargetLabelKey, + drawElement: drawTargetLabel, + getBoundingBox: getTargetLabelBox, + getRotationPoint: getTargetLabelRotationPoint, + getRotationOffset: getTargetLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var lyrTxrCache = r.data.lyrTxrCache = new LayeredTextureCache(r); + r.onUpdateEleCalcs(function invalidateTextureCaches(willDraw, eles) { + // each cache should check for sub-key diff to see that the update affects that cache particularly + eleTxrCache.invalidateElements(eles); + lblTxrCache.invalidateElements(eles); + slbTxrCache.invalidateElements(eles); + tlbTxrCache.invalidateElements(eles); // any change invalidates the layers + + lyrTxrCache.invalidateElements(eles); // update the old bg timestamp so diffs can be done in the ele txr caches + + for (var _i = 0; _i < eles.length; _i++) { + var _p = eles[_i]._private; + _p.oldBackgroundTimestamp = _p.backgroundTimestamp; + } + }); + + var refineInLayers = function refineInLayers(reqs) { + for (var i = 0; i < reqs.length; i++) { + lyrTxrCache.enqueueElementRefinement(reqs[i].ele); + } + }; + + eleTxrCache.onDequeue(refineInLayers); + lblTxrCache.onDequeue(refineInLayers); + slbTxrCache.onDequeue(refineInLayers); + tlbTxrCache.onDequeue(refineInLayers); + } + + CRp.redrawHint = function (group, bool) { + var r = this; + + switch (group) { + case 'eles': + r.data.canvasNeedsRedraw[CRp.NODE] = bool; + break; + + case 'drag': + r.data.canvasNeedsRedraw[CRp.DRAG] = bool; + break; + + case 'select': + r.data.canvasNeedsRedraw[CRp.SELECT_BOX] = bool; + break; + } + }; // whether to use Path2D caching for drawing + + + var pathsImpld = typeof Path2D !== 'undefined'; + + CRp.path2dEnabled = function (on) { + if (on === undefined) { + return this.pathsEnabled; + } + + this.pathsEnabled = on ? true : false; + }; + + CRp.usePaths = function () { + return pathsImpld && this.pathsEnabled; + }; + + CRp.setImgSmoothing = function (context, bool) { + if (context.imageSmoothingEnabled != null) { + context.imageSmoothingEnabled = bool; + } else { + context.webkitImageSmoothingEnabled = bool; + context.mozImageSmoothingEnabled = bool; + context.msImageSmoothingEnabled = bool; + } + }; + + CRp.getImgSmoothing = function (context) { + if (context.imageSmoothingEnabled != null) { + return context.imageSmoothingEnabled; + } else { + return context.webkitImageSmoothingEnabled || context.mozImageSmoothingEnabled || context.msImageSmoothingEnabled; + } + }; + + CRp.makeOffscreenCanvas = function (width, height) { + var canvas; + + if ((typeof OffscreenCanvas === "undefined" ? "undefined" : _typeof(OffscreenCanvas)) !== ("undefined" )) { + canvas = new OffscreenCanvas(width, height); + } else { + canvas = document.createElement('canvas'); // eslint-disable-line no-undef + + canvas.width = width; + canvas.height = height; + } + + return canvas; + }; + + [CRp$a, CRp$9, CRp$8, CRp$7, CRp$6, CRp$5, CRp$4, CRp$3, CRp$2, CRp$1].forEach(function (props) { + extend(CRp, props); + }); + + var renderer = [{ + name: 'null', + impl: NullRenderer + }, { + name: 'base', + impl: BR + }, { + name: 'canvas', + impl: CR + }]; + + var incExts = [{ + type: 'layout', + extensions: layout + }, { + type: 'renderer', + extensions: renderer + }]; + + var extensions = {}; // registered modules for extensions, indexed by name + + var modules = {}; + + function setExtension(type, name, registrant) { + var ext = registrant; + + var overrideErr = function overrideErr(field) { + warn('Can not register `' + name + '` for `' + type + '` since `' + field + '` already exists in the prototype and can not be overridden'); + }; + + if (type === 'core') { + if (Core.prototype[name]) { + return overrideErr(name); + } else { + Core.prototype[name] = registrant; + } + } else if (type === 'collection') { + if (Collection.prototype[name]) { + return overrideErr(name); + } else { + Collection.prototype[name] = registrant; + } + } else if (type === 'layout') { + // fill in missing layout functions in the prototype + var Layout = function Layout(options) { + this.options = options; + registrant.call(this, options); // make sure layout has _private for use w/ std apis like .on() + + if (!plainObject(this._private)) { + this._private = {}; + } + + this._private.cy = options.cy; + this._private.listeners = []; + this.createEmitter(); + }; + + var layoutProto = Layout.prototype = Object.create(registrant.prototype); + var optLayoutFns = []; + + for (var i = 0; i < optLayoutFns.length; i++) { + var fnName = optLayoutFns[i]; + + layoutProto[fnName] = layoutProto[fnName] || function () { + return this; + }; + } // either .start() or .run() is defined, so autogen the other + + + if (layoutProto.start && !layoutProto.run) { + layoutProto.run = function () { + this.start(); + return this; + }; + } else if (!layoutProto.start && layoutProto.run) { + layoutProto.start = function () { + this.run(); + return this; + }; + } + + var regStop = registrant.prototype.stop; + + layoutProto.stop = function () { + var opts = this.options; + + if (opts && opts.animate) { + var anis = this.animations; + + if (anis) { + for (var _i = 0; _i < anis.length; _i++) { + anis[_i].stop(); + } + } + } + + if (regStop) { + regStop.call(this); + } else { + this.emit('layoutstop'); + } + + return this; + }; + + if (!layoutProto.destroy) { + layoutProto.destroy = function () { + return this; + }; + } + + layoutProto.cy = function () { + return this._private.cy; + }; + + var getCy = function getCy(layout) { + return layout._private.cy; + }; + + var emitterOpts = { + addEventFields: function addEventFields(layout, evt) { + evt.layout = layout; + evt.cy = getCy(layout); + evt.target = layout; + }, + bubble: function bubble() { + return true; + }, + parent: function parent(layout) { + return getCy(layout); + } + }; + extend(layoutProto, { + createEmitter: function createEmitter() { + this._private.emitter = new Emitter(emitterOpts, this); + return this; + }, + emitter: function emitter() { + return this._private.emitter; + }, + on: function on(evt, cb) { + this.emitter().on(evt, cb); + return this; + }, + one: function one(evt, cb) { + this.emitter().one(evt, cb); + return this; + }, + once: function once(evt, cb) { + this.emitter().one(evt, cb); + return this; + }, + removeListener: function removeListener(evt, cb) { + this.emitter().removeListener(evt, cb); + return this; + }, + removeAllListeners: function removeAllListeners() { + this.emitter().removeAllListeners(); + return this; + }, + emit: function emit(evt, params) { + this.emitter().emit(evt, params); + return this; + } + }); + define.eventAliasesOn(layoutProto); + ext = Layout; // replace with our wrapped layout + } else if (type === 'renderer' && name !== 'null' && name !== 'base') { + // user registered renderers inherit from base + var BaseRenderer = getExtension('renderer', 'base'); + var bProto = BaseRenderer.prototype; + var RegistrantRenderer = registrant; + var rProto = registrant.prototype; + + var Renderer = function Renderer() { + BaseRenderer.apply(this, arguments); + RegistrantRenderer.apply(this, arguments); + }; + + var proto = Renderer.prototype; + + for (var pName in bProto) { + var pVal = bProto[pName]; + var existsInR = rProto[pName] != null; + + if (existsInR) { + return overrideErr(pName); + } + + proto[pName] = pVal; // take impl from base + } + + for (var _pName in rProto) { + proto[_pName] = rProto[_pName]; // take impl from registrant + } + + bProto.clientFunctions.forEach(function (name) { + proto[name] = proto[name] || function () { + error('Renderer does not implement `renderer.' + name + '()` on its prototype'); + }; + }); + ext = Renderer; + } else if (type === '__proto__' || type === 'constructor' || type === 'prototype') { + // to avoid potential prototype pollution + return error(type + ' is an illegal type to be registered, possibly lead to prototype pollutions'); + } + + return setMap({ + map: extensions, + keys: [type, name], + value: ext + }); + } + + function getExtension(type, name) { + return getMap({ + map: extensions, + keys: [type, name] + }); + } + + function setModule(type, name, moduleType, moduleName, registrant) { + return setMap({ + map: modules, + keys: [type, name, moduleType, moduleName], + value: registrant + }); + } + + function getModule(type, name, moduleType, moduleName) { + return getMap({ + map: modules, + keys: [type, name, moduleType, moduleName] + }); + } + + var extension = function extension() { + // e.g. extension('renderer', 'svg') + if (arguments.length === 2) { + return getExtension.apply(null, arguments); + } // e.g. extension('renderer', 'svg', { ... }) + else if (arguments.length === 3) { + return setExtension.apply(null, arguments); + } // e.g. extension('renderer', 'svg', 'nodeShape', 'ellipse') + else if (arguments.length === 4) { + return getModule.apply(null, arguments); + } // e.g. extension('renderer', 'svg', 'nodeShape', 'ellipse', { ... }) + else if (arguments.length === 5) { + return setModule.apply(null, arguments); + } else { + error('Invalid extension access syntax'); + } + }; // allows a core instance to access extensions internally + + + Core.prototype.extension = extension; // included extensions + + incExts.forEach(function (group) { + group.extensions.forEach(function (ext) { + setExtension(group.type, ext.name, ext.impl); + }); + }); + + // (useful for init) + + var Stylesheet = function Stylesheet() { + if (!(this instanceof Stylesheet)) { + return new Stylesheet(); + } + + this.length = 0; + }; + + var sheetfn = Stylesheet.prototype; + + sheetfn.instanceString = function () { + return 'stylesheet'; + }; // just store the selector to be parsed later + + + sheetfn.selector = function (selector) { + var i = this.length++; + this[i] = { + selector: selector, + properties: [] + }; + return this; // chaining + }; // just store the property to be parsed later + + + sheetfn.css = function (name, value) { + var i = this.length - 1; + + if (string(name)) { + this[i].properties.push({ + name: name, + value: value + }); + } else if (plainObject(name)) { + var map = name; + var propNames = Object.keys(map); + + for (var j = 0; j < propNames.length; j++) { + var key = propNames[j]; + var mapVal = map[key]; + + if (mapVal == null) { + continue; + } + + var prop = Style.properties[key] || Style.properties[dash2camel(key)]; + + if (prop == null) { + continue; + } + + var _name = prop.name; + var _value = mapVal; + this[i].properties.push({ + name: _name, + value: _value + }); + } + } + + return this; // chaining + }; + + sheetfn.style = sheetfn.css; // generate a real style object from the dummy stylesheet + + sheetfn.generateStyle = function (cy) { + var style = new Style(cy); + return this.appendToStyle(style); + }; // append a dummy stylesheet object on a real style object + + + sheetfn.appendToStyle = function (style) { + for (var i = 0; i < this.length; i++) { + var context = this[i]; + var selector = context.selector; + var props = context.properties; + style.selector(selector); // apply selector + + for (var j = 0; j < props.length; j++) { + var prop = props[j]; + style.css(prop.name, prop.value); // apply property + } + } + + return style; + }; + + var version = "3.25.0"; + + var cytoscape = function cytoscape(options) { + // if no options specified, use default + if (options === undefined) { + options = {}; + } // create instance + + + if (plainObject(options)) { + return new Core(options); + } // allow for registration of extensions + else if (string(options)) { + return extension.apply(extension, arguments); + } + }; // e.g. cytoscape.use( require('cytoscape-foo'), bar ) + + + cytoscape.use = function (ext) { + var args = Array.prototype.slice.call(arguments, 1); // args to pass to ext + + args.unshift(cytoscape); // cytoscape is first arg to ext + + ext.apply(null, args); + return this; + }; + + cytoscape.warnings = function (bool) { + return warnings(bool); + }; // replaced by build system + + + cytoscape.version = version; // expose public apis (mostly for extensions) + + cytoscape.stylesheet = cytoscape.Stylesheet = Stylesheet; + + return cytoscape; + +})); + + +/***/ }), + +/***/ 54899: +/***/ (function(module) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else {} +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_543__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_543__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_543__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __nested_webpack_require_543__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __nested_webpack_require_543__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __nested_webpack_require_543__.d = function(exports, name, getter) { +/******/ if(!__nested_webpack_require_543__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __nested_webpack_require_543__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __nested_webpack_require_543__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __nested_webpack_require_543__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_543__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_543__(__nested_webpack_require_543__.s = 26); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function LayoutConstants() {} + +/** + * Layout Quality: 0:draft, 1:default, 2:proof + */ +LayoutConstants.QUALITY = 1; + +/** + * Default parameters + */ +LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false; +LayoutConstants.DEFAULT_INCREMENTAL = false; +LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true; +LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false; +LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50; +LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false; + +// ----------------------------------------------------------------------------- +// Section: General other constants +// ----------------------------------------------------------------------------- +/* + * Margins of a graph to be applied on bouding rectangle of its contents. We + * assume margins on all four sides to be uniform. + */ +LayoutConstants.DEFAULT_GRAPH_MARGIN = 15; + +/* + * Whether to consider labels in node dimensions or not + */ +LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false; + +/* + * Default dimension of a non-compound node. + */ +LayoutConstants.SIMPLE_NODE_SIZE = 40; + +/* + * Default dimension of a non-compound node. + */ +LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2; + +/* + * Empty compound node size. When a compound node is empty, its both + * dimensions should be of this value. + */ +LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40; + +/* + * Minimum length that an edge should take during layout + */ +LayoutConstants.MIN_EDGE_LENGTH = 1; + +/* + * World boundaries that layout operates on + */ +LayoutConstants.WORLD_BOUNDARY = 1000000; + +/* + * World boundaries that random positioning can be performed with + */ +LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1000; + +/* + * Coordinates of the world center + */ +LayoutConstants.WORLD_CENTER_X = 1200; +LayoutConstants.WORLD_CENTER_Y = 900; + +module.exports = LayoutConstants; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __nested_webpack_require_4947__) { + +"use strict"; + + +var LGraphObject = __nested_webpack_require_4947__(2); +var IGeometry = __nested_webpack_require_4947__(8); +var IMath = __nested_webpack_require_4947__(9); + +function LEdge(source, target, vEdge) { + LGraphObject.call(this, vEdge); + + this.isOverlapingSourceAndTarget = false; + this.vGraphObject = vEdge; + this.bendpoints = []; + this.source = source; + this.target = target; +} + +LEdge.prototype = Object.create(LGraphObject.prototype); + +for (var prop in LGraphObject) { + LEdge[prop] = LGraphObject[prop]; +} + +LEdge.prototype.getSource = function () { + return this.source; +}; + +LEdge.prototype.getTarget = function () { + return this.target; +}; + +LEdge.prototype.isInterGraph = function () { + return this.isInterGraph; +}; + +LEdge.prototype.getLength = function () { + return this.length; +}; + +LEdge.prototype.isOverlapingSourceAndTarget = function () { + return this.isOverlapingSourceAndTarget; +}; + +LEdge.prototype.getBendpoints = function () { + return this.bendpoints; +}; + +LEdge.prototype.getLca = function () { + return this.lca; +}; + +LEdge.prototype.getSourceInLca = function () { + return this.sourceInLca; +}; + +LEdge.prototype.getTargetInLca = function () { + return this.targetInLca; +}; + +LEdge.prototype.getOtherEnd = function (node) { + if (this.source === node) { + return this.target; + } else if (this.target === node) { + return this.source; + } else { + throw "Node is not incident with this edge"; + } +}; + +LEdge.prototype.getOtherEndInGraph = function (node, graph) { + var otherEnd = this.getOtherEnd(node); + var root = graph.getGraphManager().getRoot(); + + while (true) { + if (otherEnd.getOwner() == graph) { + return otherEnd; + } + + if (otherEnd.getOwner() == root) { + break; + } + + otherEnd = otherEnd.getOwner().getParent(); + } + + return null; +}; + +LEdge.prototype.updateLength = function () { + var clipPointCoordinates = new Array(4); + + this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates); + + if (!this.isOverlapingSourceAndTarget) { + this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2]; + this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3]; + + if (Math.abs(this.lengthX) < 1.0) { + this.lengthX = IMath.sign(this.lengthX); + } + + if (Math.abs(this.lengthY) < 1.0) { + this.lengthY = IMath.sign(this.lengthY); + } + + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + } +}; + +LEdge.prototype.updateLengthSimple = function () { + this.lengthX = this.target.getCenterX() - this.source.getCenterX(); + this.lengthY = this.target.getCenterY() - this.source.getCenterY(); + + if (Math.abs(this.lengthX) < 1.0) { + this.lengthX = IMath.sign(this.lengthX); + } + + if (Math.abs(this.lengthY) < 1.0) { + this.lengthY = IMath.sign(this.lengthY); + } + + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); +}; + +module.exports = LEdge; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function LGraphObject(vGraphObject) { + this.vGraphObject = vGraphObject; +} + +module.exports = LGraphObject; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __nested_webpack_require_8167__) { + +"use strict"; + + +var LGraphObject = __nested_webpack_require_8167__(2); +var Integer = __nested_webpack_require_8167__(10); +var RectangleD = __nested_webpack_require_8167__(13); +var LayoutConstants = __nested_webpack_require_8167__(0); +var RandomSeed = __nested_webpack_require_8167__(16); +var PointD = __nested_webpack_require_8167__(4); + +function LNode(gm, loc, size, vNode) { + //Alternative constructor 1 : LNode(LGraphManager gm, Point loc, Dimension size, Object vNode) + if (size == null && vNode == null) { + vNode = loc; + } + + LGraphObject.call(this, vNode); + + //Alternative constructor 2 : LNode(Layout layout, Object vNode) + if (gm.graphManager != null) gm = gm.graphManager; + + this.estimatedSize = Integer.MIN_VALUE; + this.inclusionTreeDepth = Integer.MAX_VALUE; + this.vGraphObject = vNode; + this.edges = []; + this.graphManager = gm; + + if (size != null && loc != null) this.rect = new RectangleD(loc.x, loc.y, size.width, size.height);else this.rect = new RectangleD(); +} + +LNode.prototype = Object.create(LGraphObject.prototype); +for (var prop in LGraphObject) { + LNode[prop] = LGraphObject[prop]; +} + +LNode.prototype.getEdges = function () { + return this.edges; +}; + +LNode.prototype.getChild = function () { + return this.child; +}; + +LNode.prototype.getOwner = function () { + // if (this.owner != null) { + // if (!(this.owner == null || this.owner.getNodes().indexOf(this) > -1)) { + // throw "assert failed"; + // } + // } + + return this.owner; +}; + +LNode.prototype.getWidth = function () { + return this.rect.width; +}; + +LNode.prototype.setWidth = function (width) { + this.rect.width = width; +}; + +LNode.prototype.getHeight = function () { + return this.rect.height; +}; + +LNode.prototype.setHeight = function (height) { + this.rect.height = height; +}; + +LNode.prototype.getCenterX = function () { + return this.rect.x + this.rect.width / 2; +}; + +LNode.prototype.getCenterY = function () { + return this.rect.y + this.rect.height / 2; +}; + +LNode.prototype.getCenter = function () { + return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2); +}; + +LNode.prototype.getLocation = function () { + return new PointD(this.rect.x, this.rect.y); +}; + +LNode.prototype.getRect = function () { + return this.rect; +}; + +LNode.prototype.getDiagonal = function () { + return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height); +}; + +/** + * This method returns half the diagonal length of this node. + */ +LNode.prototype.getHalfTheDiagonal = function () { + return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2; +}; + +LNode.prototype.setRect = function (upperLeft, dimension) { + this.rect.x = upperLeft.x; + this.rect.y = upperLeft.y; + this.rect.width = dimension.width; + this.rect.height = dimension.height; +}; + +LNode.prototype.setCenter = function (cx, cy) { + this.rect.x = cx - this.rect.width / 2; + this.rect.y = cy - this.rect.height / 2; +}; + +LNode.prototype.setLocation = function (x, y) { + this.rect.x = x; + this.rect.y = y; +}; + +LNode.prototype.moveBy = function (dx, dy) { + this.rect.x += dx; + this.rect.y += dy; +}; + +LNode.prototype.getEdgeListToNode = function (to) { + var edgeList = []; + var edge; + var self = this; + + self.edges.forEach(function (edge) { + + if (edge.target == to) { + if (edge.source != self) throw "Incorrect edge source!"; + + edgeList.push(edge); + } + }); + + return edgeList; +}; + +LNode.prototype.getEdgesBetween = function (other) { + var edgeList = []; + var edge; + + var self = this; + self.edges.forEach(function (edge) { + + if (!(edge.source == self || edge.target == self)) throw "Incorrect edge source and/or target"; + + if (edge.target == other || edge.source == other) { + edgeList.push(edge); + } + }); + + return edgeList; +}; + +LNode.prototype.getNeighborsList = function () { + var neighbors = new Set(); + + var self = this; + self.edges.forEach(function (edge) { + + if (edge.source == self) { + neighbors.add(edge.target); + } else { + if (edge.target != self) { + throw "Incorrect incidency!"; + } + + neighbors.add(edge.source); + } + }); + + return neighbors; +}; + +LNode.prototype.withChildren = function () { + var withNeighborsList = new Set(); + var childNode; + var children; + + withNeighborsList.add(this); + + if (this.child != null) { + var nodes = this.child.getNodes(); + for (var i = 0; i < nodes.length; i++) { + childNode = nodes[i]; + children = childNode.withChildren(); + children.forEach(function (node) { + withNeighborsList.add(node); + }); + } + } + + return withNeighborsList; +}; + +LNode.prototype.getNoOfChildren = function () { + var noOfChildren = 0; + var childNode; + + if (this.child == null) { + noOfChildren = 1; + } else { + var nodes = this.child.getNodes(); + for (var i = 0; i < nodes.length; i++) { + childNode = nodes[i]; + + noOfChildren += childNode.getNoOfChildren(); + } + } + + if (noOfChildren == 0) { + noOfChildren = 1; + } + return noOfChildren; +}; + +LNode.prototype.getEstimatedSize = function () { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; +}; + +LNode.prototype.calcEstimatedSize = function () { + if (this.child == null) { + return this.estimatedSize = (this.rect.width + this.rect.height) / 2; + } else { + this.estimatedSize = this.child.calcEstimatedSize(); + this.rect.width = this.estimatedSize; + this.rect.height = this.estimatedSize; + + return this.estimatedSize; + } +}; + +LNode.prototype.scatter = function () { + var randomCenterX; + var randomCenterY; + + var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX; + + var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY; + + this.rect.x = randomCenterX; + this.rect.y = randomCenterY; +}; + +LNode.prototype.updateBounds = function () { + if (this.getChild() == null) { + throw "assert failed"; + } + if (this.getChild().getNodes().length != 0) { + // wrap the children nodes by re-arranging the boundaries + var childGraph = this.getChild(); + childGraph.updateBounds(true); + + this.rect.x = childGraph.getLeft(); + this.rect.y = childGraph.getTop(); + + this.setWidth(childGraph.getRight() - childGraph.getLeft()); + this.setHeight(childGraph.getBottom() - childGraph.getTop()); + + // Update compound bounds considering its label properties + if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) { + + var width = childGraph.getRight() - childGraph.getLeft(); + var height = childGraph.getBottom() - childGraph.getTop(); + + if (this.labelWidth > width) { + this.rect.x -= (this.labelWidth - width) / 2; + this.setWidth(this.labelWidth); + } + + if (this.labelHeight > height) { + if (this.labelPos == "center") { + this.rect.y -= (this.labelHeight - height) / 2; + } else if (this.labelPos == "top") { + this.rect.y -= this.labelHeight - height; + } + this.setHeight(this.labelHeight); + } + } + } +}; + +LNode.prototype.getInclusionTreeDepth = function () { + if (this.inclusionTreeDepth == Integer.MAX_VALUE) { + throw "assert failed"; + } + return this.inclusionTreeDepth; +}; + +LNode.prototype.transform = function (trans) { + var left = this.rect.x; + + if (left > LayoutConstants.WORLD_BOUNDARY) { + left = LayoutConstants.WORLD_BOUNDARY; + } else if (left < -LayoutConstants.WORLD_BOUNDARY) { + left = -LayoutConstants.WORLD_BOUNDARY; + } + + var top = this.rect.y; + + if (top > LayoutConstants.WORLD_BOUNDARY) { + top = LayoutConstants.WORLD_BOUNDARY; + } else if (top < -LayoutConstants.WORLD_BOUNDARY) { + top = -LayoutConstants.WORLD_BOUNDARY; + } + + var leftTop = new PointD(left, top); + var vLeftTop = trans.inverseTransformPoint(leftTop); + + this.setLocation(vLeftTop.x, vLeftTop.y); +}; + +LNode.prototype.getLeft = function () { + return this.rect.x; +}; + +LNode.prototype.getRight = function () { + return this.rect.x + this.rect.width; +}; + +LNode.prototype.getTop = function () { + return this.rect.y; +}; + +LNode.prototype.getBottom = function () { + return this.rect.y + this.rect.height; +}; + +LNode.prototype.getParent = function () { + if (this.owner == null) { + return null; + } + + return this.owner.getParent(); +}; + +module.exports = LNode; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function PointD(x, y) { + if (x == null && y == null) { + this.x = 0; + this.y = 0; + } else { + this.x = x; + this.y = y; + } +} + +PointD.prototype.getX = function () { + return this.x; +}; + +PointD.prototype.getY = function () { + return this.y; +}; + +PointD.prototype.setX = function (x) { + this.x = x; +}; + +PointD.prototype.setY = function (y) { + this.y = y; +}; + +PointD.prototype.getDifference = function (pt) { + return new DimensionD(this.x - pt.x, this.y - pt.y); +}; + +PointD.prototype.getCopy = function () { + return new PointD(this.x, this.y); +}; + +PointD.prototype.translate = function (dim) { + this.x += dim.width; + this.y += dim.height; + return this; +}; + +module.exports = PointD; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __nested_webpack_require_17549__) { + +"use strict"; + + +var LGraphObject = __nested_webpack_require_17549__(2); +var Integer = __nested_webpack_require_17549__(10); +var LayoutConstants = __nested_webpack_require_17549__(0); +var LGraphManager = __nested_webpack_require_17549__(6); +var LNode = __nested_webpack_require_17549__(3); +var LEdge = __nested_webpack_require_17549__(1); +var RectangleD = __nested_webpack_require_17549__(13); +var Point = __nested_webpack_require_17549__(12); +var LinkedList = __nested_webpack_require_17549__(11); + +function LGraph(parent, obj2, vGraph) { + LGraphObject.call(this, vGraph); + this.estimatedSize = Integer.MIN_VALUE; + this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN; + this.edges = []; + this.nodes = []; + this.isConnected = false; + this.parent = parent; + + if (obj2 != null && obj2 instanceof LGraphManager) { + this.graphManager = obj2; + } else if (obj2 != null && obj2 instanceof Layout) { + this.graphManager = obj2.graphManager; + } +} + +LGraph.prototype = Object.create(LGraphObject.prototype); +for (var prop in LGraphObject) { + LGraph[prop] = LGraphObject[prop]; +} + +LGraph.prototype.getNodes = function () { + return this.nodes; +}; + +LGraph.prototype.getEdges = function () { + return this.edges; +}; + +LGraph.prototype.getGraphManager = function () { + return this.graphManager; +}; + +LGraph.prototype.getParent = function () { + return this.parent; +}; + +LGraph.prototype.getLeft = function () { + return this.left; +}; + +LGraph.prototype.getRight = function () { + return this.right; +}; + +LGraph.prototype.getTop = function () { + return this.top; +}; + +LGraph.prototype.getBottom = function () { + return this.bottom; +}; + +LGraph.prototype.isConnected = function () { + return this.isConnected; +}; + +LGraph.prototype.add = function (obj1, sourceNode, targetNode) { + if (sourceNode == null && targetNode == null) { + var newNode = obj1; + if (this.graphManager == null) { + throw "Graph has no graph mgr!"; + } + if (this.getNodes().indexOf(newNode) > -1) { + throw "Node already in graph!"; + } + newNode.owner = this; + this.getNodes().push(newNode); + + return newNode; + } else { + var newEdge = obj1; + if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) { + throw "Source or target not in graph!"; + } + + if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) { + throw "Both owners must be this graph!"; + } + + if (sourceNode.owner != targetNode.owner) { + return null; + } + + // set source and target + newEdge.source = sourceNode; + newEdge.target = targetNode; + + // set as intra-graph edge + newEdge.isInterGraph = false; + + // add to graph edge list + this.getEdges().push(newEdge); + + // add to incidency lists + sourceNode.edges.push(newEdge); + + if (targetNode != sourceNode) { + targetNode.edges.push(newEdge); + } + + return newEdge; + } +}; + +LGraph.prototype.remove = function (obj) { + var node = obj; + if (obj instanceof LNode) { + if (node == null) { + throw "Node is null!"; + } + if (!(node.owner != null && node.owner == this)) { + throw "Owner graph is invalid!"; + } + if (this.graphManager == null) { + throw "Owner graph manager is invalid!"; + } + // remove incident edges first (make a copy to do it safely) + var edgesToBeRemoved = node.edges.slice(); + var edge; + var s = edgesToBeRemoved.length; + for (var i = 0; i < s; i++) { + edge = edgesToBeRemoved[i]; + + if (edge.isInterGraph) { + this.graphManager.remove(edge); + } else { + edge.source.owner.remove(edge); + } + } + + // now the node itself + var index = this.nodes.indexOf(node); + if (index == -1) { + throw "Node not in owner node list!"; + } + + this.nodes.splice(index, 1); + } else if (obj instanceof LEdge) { + var edge = obj; + if (edge == null) { + throw "Edge is null!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) { + throw "Source and/or target owner is invalid!"; + } + + var sourceIndex = edge.source.edges.indexOf(edge); + var targetIndex = edge.target.edges.indexOf(edge); + if (!(sourceIndex > -1 && targetIndex > -1)) { + throw "Source and/or target doesn't know this edge!"; + } + + edge.source.edges.splice(sourceIndex, 1); + + if (edge.target != edge.source) { + edge.target.edges.splice(targetIndex, 1); + } + + var index = edge.source.owner.getEdges().indexOf(edge); + if (index == -1) { + throw "Not in owner's edge list!"; + } + + edge.source.owner.getEdges().splice(index, 1); + } +}; + +LGraph.prototype.updateLeftTop = function () { + var top = Integer.MAX_VALUE; + var left = Integer.MAX_VALUE; + var nodeTop; + var nodeLeft; + var margin; + + var nodes = this.getNodes(); + var s = nodes.length; + + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + nodeTop = lNode.getTop(); + nodeLeft = lNode.getLeft(); + + if (top > nodeTop) { + top = nodeTop; + } + + if (left > nodeLeft) { + left = nodeLeft; + } + } + + // Do we have any nodes in this graph? + if (top == Integer.MAX_VALUE) { + return null; + } + + if (nodes[0].getParent().paddingLeft != undefined) { + margin = nodes[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + + this.left = left - margin; + this.top = top - margin; + + // Apply the margins and return the result + return new Point(this.left, this.top); +}; + +LGraph.prototype.updateBounds = function (recursive) { + // calculate bounds + var left = Integer.MAX_VALUE; + var right = -Integer.MAX_VALUE; + var top = Integer.MAX_VALUE; + var bottom = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + var margin; + + var nodes = this.nodes; + var s = nodes.length; + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + + if (recursive && lNode.child != null) { + lNode.updateBounds(); + } + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + + if (left > nodeLeft) { + left = nodeLeft; + } + + if (right < nodeRight) { + right = nodeRight; + } + + if (top > nodeTop) { + top = nodeTop; + } + + if (bottom < nodeBottom) { + bottom = nodeBottom; + } + } + + var boundingRect = new RectangleD(left, top, right - left, bottom - top); + if (left == Integer.MAX_VALUE) { + this.left = this.parent.getLeft(); + this.right = this.parent.getRight(); + this.top = this.parent.getTop(); + this.bottom = this.parent.getBottom(); + } + + if (nodes[0].getParent().paddingLeft != undefined) { + margin = nodes[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + + this.left = boundingRect.x - margin; + this.right = boundingRect.x + boundingRect.width + margin; + this.top = boundingRect.y - margin; + this.bottom = boundingRect.y + boundingRect.height + margin; +}; + +LGraph.calculateBounds = function (nodes) { + var left = Integer.MAX_VALUE; + var right = -Integer.MAX_VALUE; + var top = Integer.MAX_VALUE; + var bottom = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + + var s = nodes.length; + + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + + if (left > nodeLeft) { + left = nodeLeft; + } + + if (right < nodeRight) { + right = nodeRight; + } + + if (top > nodeTop) { + top = nodeTop; + } + + if (bottom < nodeBottom) { + bottom = nodeBottom; + } + } + + var boundingRect = new RectangleD(left, top, right - left, bottom - top); + + return boundingRect; +}; + +LGraph.prototype.getInclusionTreeDepth = function () { + if (this == this.graphManager.getRoot()) { + return 1; + } else { + return this.parent.getInclusionTreeDepth(); + } +}; + +LGraph.prototype.getEstimatedSize = function () { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; +}; + +LGraph.prototype.calcEstimatedSize = function () { + var size = 0; + var nodes = this.nodes; + var s = nodes.length; + + for (var i = 0; i < s; i++) { + var lNode = nodes[i]; + size += lNode.calcEstimatedSize(); + } + + if (size == 0) { + this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE; + } else { + this.estimatedSize = size / Math.sqrt(this.nodes.length); + } + + return this.estimatedSize; +}; + +LGraph.prototype.updateConnected = function () { + var self = this; + if (this.nodes.length == 0) { + this.isConnected = true; + return; + } + + var queue = new LinkedList(); + var visited = new Set(); + var currentNode = this.nodes[0]; + var neighborEdges; + var currentNeighbor; + var childrenOfNode = currentNode.withChildren(); + childrenOfNode.forEach(function (node) { + queue.push(node); + visited.add(node); + }); + + while (queue.length !== 0) { + currentNode = queue.shift(); + + // Traverse all neighbors of this node + neighborEdges = currentNode.getEdges(); + var size = neighborEdges.length; + for (var i = 0; i < size; i++) { + var neighborEdge = neighborEdges[i]; + currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this); + + // Add unvisited neighbors to the list to visit + if (currentNeighbor != null && !visited.has(currentNeighbor)) { + var childrenOfNeighbor = currentNeighbor.withChildren(); + + childrenOfNeighbor.forEach(function (node) { + queue.push(node); + visited.add(node); + }); + } + } + } + + this.isConnected = false; + + if (visited.size >= this.nodes.length) { + var noOfVisitedInThisGraph = 0; + + visited.forEach(function (visitedNode) { + if (visitedNode.owner == self) { + noOfVisitedInThisGraph++; + } + }); + + if (noOfVisitedInThisGraph == this.nodes.length) { + this.isConnected = true; + } + } +}; + +module.exports = LGraph; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __nested_webpack_require_27617__) { + +"use strict"; + + +var LGraph; +var LEdge = __nested_webpack_require_27617__(1); + +function LGraphManager(layout) { + LGraph = __nested_webpack_require_27617__(5); // It may be better to initilize this out of this function but it gives an error (Right-hand side of 'instanceof' is not callable) now. + this.layout = layout; + + this.graphs = []; + this.edges = []; +} + +LGraphManager.prototype.addRoot = function () { + var ngraph = this.layout.newGraph(); + var nnode = this.layout.newNode(null); + var root = this.add(ngraph, nnode); + this.setRootGraph(root); + return this.rootGraph; +}; + +LGraphManager.prototype.add = function (newGraph, parentNode, newEdge, sourceNode, targetNode) { + //there are just 2 parameters are passed then it adds an LGraph else it adds an LEdge + if (newEdge == null && sourceNode == null && targetNode == null) { + if (newGraph == null) { + throw "Graph is null!"; + } + if (parentNode == null) { + throw "Parent node is null!"; + } + if (this.graphs.indexOf(newGraph) > -1) { + throw "Graph already in this graph mgr!"; + } + + this.graphs.push(newGraph); + + if (newGraph.parent != null) { + throw "Already has a parent!"; + } + if (parentNode.child != null) { + throw "Already has a child!"; + } + + newGraph.parent = parentNode; + parentNode.child = newGraph; + + return newGraph; + } else { + //change the order of the parameters + targetNode = newEdge; + sourceNode = parentNode; + newEdge = newGraph; + var sourceGraph = sourceNode.getOwner(); + var targetGraph = targetNode.getOwner(); + + if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) { + throw "Source not in this graph mgr!"; + } + if (!(targetGraph != null && targetGraph.getGraphManager() == this)) { + throw "Target not in this graph mgr!"; + } + + if (sourceGraph == targetGraph) { + newEdge.isInterGraph = false; + return sourceGraph.add(newEdge, sourceNode, targetNode); + } else { + newEdge.isInterGraph = true; + + // set source and target + newEdge.source = sourceNode; + newEdge.target = targetNode; + + // add edge to inter-graph edge list + if (this.edges.indexOf(newEdge) > -1) { + throw "Edge already in inter-graph edge list!"; + } + + this.edges.push(newEdge); + + // add edge to source and target incidency lists + if (!(newEdge.source != null && newEdge.target != null)) { + throw "Edge source and/or target is null!"; + } + + if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) { + throw "Edge already in source and/or target incidency list!"; + } + + newEdge.source.edges.push(newEdge); + newEdge.target.edges.push(newEdge); + + return newEdge; + } + } +}; + +LGraphManager.prototype.remove = function (lObj) { + if (lObj instanceof LGraph) { + var graph = lObj; + if (graph.getGraphManager() != this) { + throw "Graph not in this graph mgr"; + } + if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) { + throw "Invalid parent node!"; + } + + // first the edges (make a copy to do it safely) + var edgesToBeRemoved = []; + + edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges()); + + var edge; + var s = edgesToBeRemoved.length; + for (var i = 0; i < s; i++) { + edge = edgesToBeRemoved[i]; + graph.remove(edge); + } + + // then the nodes (make a copy to do it safely) + var nodesToBeRemoved = []; + + nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes()); + + var node; + s = nodesToBeRemoved.length; + for (var i = 0; i < s; i++) { + node = nodesToBeRemoved[i]; + graph.remove(node); + } + + // check if graph is the root + if (graph == this.rootGraph) { + this.setRootGraph(null); + } + + // now remove the graph itself + var index = this.graphs.indexOf(graph); + this.graphs.splice(index, 1); + + // also reset the parent of the graph + graph.parent = null; + } else if (lObj instanceof LEdge) { + edge = lObj; + if (edge == null) { + throw "Edge is null!"; + } + if (!edge.isInterGraph) { + throw "Not an inter-graph edge!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + + // remove edge from source and target nodes' incidency lists + + if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) { + throw "Source and/or target doesn't know this edge!"; + } + + var index = edge.source.edges.indexOf(edge); + edge.source.edges.splice(index, 1); + index = edge.target.edges.indexOf(edge); + edge.target.edges.splice(index, 1); + + // remove edge from owner graph manager's inter-graph edge list + + if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) { + throw "Edge owner graph or owner graph manager is null!"; + } + if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) { + throw "Not in owner graph manager's edge list!"; + } + + var index = edge.source.owner.getGraphManager().edges.indexOf(edge); + edge.source.owner.getGraphManager().edges.splice(index, 1); + } +}; + +LGraphManager.prototype.updateBounds = function () { + this.rootGraph.updateBounds(true); +}; + +LGraphManager.prototype.getGraphs = function () { + return this.graphs; +}; + +LGraphManager.prototype.getAllNodes = function () { + if (this.allNodes == null) { + var nodeList = []; + var graphs = this.getGraphs(); + var s = graphs.length; + for (var i = 0; i < s; i++) { + nodeList = nodeList.concat(graphs[i].getNodes()); + } + this.allNodes = nodeList; + } + return this.allNodes; +}; + +LGraphManager.prototype.resetAllNodes = function () { + this.allNodes = null; +}; + +LGraphManager.prototype.resetAllEdges = function () { + this.allEdges = null; +}; + +LGraphManager.prototype.resetAllNodesToApplyGravitation = function () { + this.allNodesToApplyGravitation = null; +}; + +LGraphManager.prototype.getAllEdges = function () { + if (this.allEdges == null) { + var edgeList = []; + var graphs = this.getGraphs(); + var s = graphs.length; + for (var i = 0; i < graphs.length; i++) { + edgeList = edgeList.concat(graphs[i].getEdges()); + } + + edgeList = edgeList.concat(this.edges); + + this.allEdges = edgeList; + } + return this.allEdges; +}; + +LGraphManager.prototype.getAllNodesToApplyGravitation = function () { + return this.allNodesToApplyGravitation; +}; + +LGraphManager.prototype.setAllNodesToApplyGravitation = function (nodeList) { + if (this.allNodesToApplyGravitation != null) { + throw "assert failed"; + } + + this.allNodesToApplyGravitation = nodeList; +}; + +LGraphManager.prototype.getRoot = function () { + return this.rootGraph; +}; + +LGraphManager.prototype.setRootGraph = function (graph) { + if (graph.getGraphManager() != this) { + throw "Root not in this graph mgr!"; + } + + this.rootGraph = graph; + // root graph must have a root node associated with it for convenience + if (graph.parent == null) { + graph.parent = this.layout.newNode("Root node"); + } +}; + +LGraphManager.prototype.getLayout = function () { + return this.layout; +}; + +LGraphManager.prototype.isOneAncestorOfOther = function (firstNode, secondNode) { + if (!(firstNode != null && secondNode != null)) { + throw "assert failed"; + } + + if (firstNode == secondNode) { + return true; + } + // Is second node an ancestor of the first one? + var ownerGraph = firstNode.getOwner(); + var parentNode; + + do { + parentNode = ownerGraph.getParent(); + + if (parentNode == null) { + break; + } + + if (parentNode == secondNode) { + return true; + } + + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + // Is first node an ancestor of the second one? + ownerGraph = secondNode.getOwner(); + + do { + parentNode = ownerGraph.getParent(); + + if (parentNode == null) { + break; + } + + if (parentNode == firstNode) { + return true; + } + + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + + return false; +}; + +LGraphManager.prototype.calcLowestCommonAncestors = function () { + var edge; + var sourceNode; + var targetNode; + var sourceAncestorGraph; + var targetAncestorGraph; + + var edges = this.getAllEdges(); + var s = edges.length; + for (var i = 0; i < s; i++) { + edge = edges[i]; + + sourceNode = edge.source; + targetNode = edge.target; + edge.lca = null; + edge.sourceInLca = sourceNode; + edge.targetInLca = targetNode; + + if (sourceNode == targetNode) { + edge.lca = sourceNode.getOwner(); + continue; + } + + sourceAncestorGraph = sourceNode.getOwner(); + + while (edge.lca == null) { + edge.targetInLca = targetNode; + targetAncestorGraph = targetNode.getOwner(); + + while (edge.lca == null) { + if (targetAncestorGraph == sourceAncestorGraph) { + edge.lca = targetAncestorGraph; + break; + } + + if (targetAncestorGraph == this.rootGraph) { + break; + } + + if (edge.lca != null) { + throw "assert failed"; + } + edge.targetInLca = targetAncestorGraph.getParent(); + targetAncestorGraph = edge.targetInLca.getOwner(); + } + + if (sourceAncestorGraph == this.rootGraph) { + break; + } + + if (edge.lca == null) { + edge.sourceInLca = sourceAncestorGraph.getParent(); + sourceAncestorGraph = edge.sourceInLca.getOwner(); + } + } + + if (edge.lca == null) { + throw "assert failed"; + } + } +}; + +LGraphManager.prototype.calcLowestCommonAncestor = function (firstNode, secondNode) { + if (firstNode == secondNode) { + return firstNode.getOwner(); + } + var firstOwnerGraph = firstNode.getOwner(); + + do { + if (firstOwnerGraph == null) { + break; + } + var secondOwnerGraph = secondNode.getOwner(); + + do { + if (secondOwnerGraph == null) { + break; + } + + if (secondOwnerGraph == firstOwnerGraph) { + return secondOwnerGraph; + } + secondOwnerGraph = secondOwnerGraph.getParent().getOwner(); + } while (true); + + firstOwnerGraph = firstOwnerGraph.getParent().getOwner(); + } while (true); + + return firstOwnerGraph; +}; + +LGraphManager.prototype.calcInclusionTreeDepths = function (graph, depth) { + if (graph == null && depth == null) { + graph = this.rootGraph; + depth = 1; + } + var node; + + var nodes = graph.getNodes(); + var s = nodes.length; + for (var i = 0; i < s; i++) { + node = nodes[i]; + node.inclusionTreeDepth = depth; + + if (node.child != null) { + this.calcInclusionTreeDepths(node.child, depth + 1); + } + } +}; + +LGraphManager.prototype.includesInvalidEdge = function () { + var edge; + + var s = this.edges.length; + for (var i = 0; i < s; i++) { + edge = this.edges[i]; + + if (this.isOneAncestorOfOther(edge.source, edge.target)) { + return true; + } + } + return false; +}; + +module.exports = LGraphManager; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __nested_webpack_require_38707__) { + +"use strict"; + + +var LayoutConstants = __nested_webpack_require_38707__(0); + +function FDLayoutConstants() {} + +//FDLayoutConstants inherits static props in LayoutConstants +for (var prop in LayoutConstants) { + FDLayoutConstants[prop] = LayoutConstants[prop]; +} + +FDLayoutConstants.MAX_ITERATIONS = 2500; + +FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50; +FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45; +FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500.0; +FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4; +FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1.0; +FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8; +FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5; +FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true; +FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true; +FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3; +FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33; +FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1000; +FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5000; +FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100.0; +FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3; +FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10.0; +FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100; +FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1; +FDLayoutConstants.MIN_EDGE_LENGTH = 1; +FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10; + +module.exports = FDLayoutConstants; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __nested_webpack_require_40298__) { + +"use strict"; + + +/** + * This class maintains a list of static geometry related utility methods. + * + * + * Copyright: i-Vis Research Group, Bilkent University, 2007 - present + */ + +var Point = __nested_webpack_require_40298__(12); + +function IGeometry() {} + +/** + * This method calculates *half* the amount in x and y directions of the two + * input rectangles needed to separate them keeping their respective + * positioning, and returns the result in the input array. An input + * separation buffer added to the amount in both directions. We assume that + * the two rectangles do intersect. + */ +IGeometry.calcSeparationAmount = function (rectA, rectB, overlapAmount, separationBuffer) { + if (!rectA.intersects(rectB)) { + throw "assert failed"; + } + + var directions = new Array(2); + + this.decideDirectionsForOverlappingNodes(rectA, rectB, directions); + + overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x); + overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y); + + // update the overlapping amounts for the following cases: + if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) { + /* Case x.1: + * + * rectA + * | | + * | _________ | + * | | | | + * |________|_______|______| + * | | + * | | + * rectB + */ + overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight()); + } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) { + /* Case x.2: + * + * rectB + * | | + * | _________ | + * | | | | + * |________|_______|______| + * | | + * | | + * rectA + */ + overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight()); + } + if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) { + /* Case y.1: + * ________ rectA + * | + * | + * ______|____ rectB + * | | + * | | + * ______|____| + * | + * | + * |________ + * + */ + overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom()); + } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) { + /* Case y.2: + * ________ rectB + * | + * | + * ______|____ rectA + * | | + * | | + * ______|____| + * | + * | + * |________ + * + */ + overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom()); + } + + // find slope of the line passes two centers + var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX())); + // if centers are overlapped + if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) { + // assume the slope is 1 (45 degree) + slope = 1.0; + } + + var moveByY = slope * overlapAmount[0]; + var moveByX = overlapAmount[1] / slope; + if (overlapAmount[0] < moveByX) { + moveByX = overlapAmount[0]; + } else { + moveByY = overlapAmount[1]; + } + // return half the amount so that if each rectangle is moved by these + // amounts in opposite directions, overlap will be resolved + overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer); + overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer); +}; + +/** + * This method decides the separation direction of overlapping nodes + * + * if directions[0] = -1, then rectA goes left + * if directions[0] = 1, then rectA goes right + * if directions[1] = -1, then rectA goes up + * if directions[1] = 1, then rectA goes down + */ +IGeometry.decideDirectionsForOverlappingNodes = function (rectA, rectB, directions) { + if (rectA.getCenterX() < rectB.getCenterX()) { + directions[0] = -1; + } else { + directions[0] = 1; + } + + if (rectA.getCenterY() < rectB.getCenterY()) { + directions[1] = -1; + } else { + directions[1] = 1; + } +}; + +/** + * This method calculates the intersection (clipping) points of the two + * input rectangles with line segment defined by the centers of these two + * rectangles. The clipping points are saved in the input double array and + * whether or not the two rectangles overlap is returned. + */ +IGeometry.getIntersection2 = function (rectA, rectB, result) { + //result[0-1] will contain clipPoint of rectA, result[2-3] will contain clipPoint of rectB + var p1x = rectA.getCenterX(); + var p1y = rectA.getCenterY(); + var p2x = rectB.getCenterX(); + var p2y = rectB.getCenterY(); + + //if two rectangles intersect, then clipping points are centers + if (rectA.intersects(rectB)) { + result[0] = p1x; + result[1] = p1y; + result[2] = p2x; + result[3] = p2y; + return true; + } + //variables for rectA + var topLeftAx = rectA.getX(); + var topLeftAy = rectA.getY(); + var topRightAx = rectA.getRight(); + var bottomLeftAx = rectA.getX(); + var bottomLeftAy = rectA.getBottom(); + var bottomRightAx = rectA.getRight(); + var halfWidthA = rectA.getWidthHalf(); + var halfHeightA = rectA.getHeightHalf(); + //variables for rectB + var topLeftBx = rectB.getX(); + var topLeftBy = rectB.getY(); + var topRightBx = rectB.getRight(); + var bottomLeftBx = rectB.getX(); + var bottomLeftBy = rectB.getBottom(); + var bottomRightBx = rectB.getRight(); + var halfWidthB = rectB.getWidthHalf(); + var halfHeightB = rectB.getHeightHalf(); + + //flag whether clipping points are found + var clipPointAFound = false; + var clipPointBFound = false; + + // line is vertical + if (p1x === p2x) { + if (p1y > p2y) { + result[0] = p1x; + result[1] = topLeftAy; + result[2] = p2x; + result[3] = bottomLeftBy; + return false; + } else if (p1y < p2y) { + result[0] = p1x; + result[1] = bottomLeftAy; + result[2] = p2x; + result[3] = topLeftBy; + return false; + } else { + //not line, return null; + } + } + // line is horizontal + else if (p1y === p2y) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = p1y; + result[2] = topRightBx; + result[3] = p2y; + return false; + } else if (p1x < p2x) { + result[0] = topRightAx; + result[1] = p1y; + result[2] = topLeftBx; + result[3] = p2y; + return false; + } else { + //not valid line, return null; + } + } else { + //slopes of rectA's and rectB's diagonals + var slopeA = rectA.height / rectA.width; + var slopeB = rectB.height / rectB.width; + + //slope of line between center of rectA and center of rectB + var slopePrime = (p2y - p1y) / (p2x - p1x); + var cardinalDirectionA = void 0; + var cardinalDirectionB = void 0; + var tempPointAx = void 0; + var tempPointAy = void 0; + var tempPointBx = void 0; + var tempPointBy = void 0; + + //determine whether clipping point is the corner of nodeA + if (-slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = bottomLeftAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } else { + result[0] = topRightAx; + result[1] = topLeftAy; + clipPointAFound = true; + } + } else if (slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = topLeftAy; + clipPointAFound = true; + } else { + result[0] = bottomRightAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } + } + + //determine whether clipping point is the corner of nodeB + if (-slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = bottomLeftBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } else { + result[2] = topRightBx; + result[3] = topLeftBy; + clipPointBFound = true; + } + } else if (slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = topLeftBx; + result[3] = topLeftBy; + clipPointBFound = true; + } else { + result[2] = bottomRightBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } + } + + //if both clipping points are corners + if (clipPointAFound && clipPointBFound) { + return false; + } + + //determine Cardinal Direction of rectangles + if (p1x > p2x) { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2); + } else { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1); + } + } else { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3); + } else { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4); + } + } + //calculate clipping Point if it is not found before + if (!clipPointAFound) { + switch (cardinalDirectionA) { + case 1: + tempPointAy = topLeftAy; + tempPointAx = p1x + -halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 2: + tempPointAx = bottomRightAx; + tempPointAy = p1y + halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 3: + tempPointAy = bottomLeftAy; + tempPointAx = p1x + halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 4: + tempPointAx = bottomLeftAx; + tempPointAy = p1y + -halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + } + } + if (!clipPointBFound) { + switch (cardinalDirectionB) { + case 1: + tempPointBy = topLeftBy; + tempPointBx = p2x + -halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 2: + tempPointBx = bottomRightBx; + tempPointBy = p2y + halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 3: + tempPointBy = bottomLeftBy; + tempPointBx = p2x + halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 4: + tempPointBx = bottomLeftBx; + tempPointBy = p2y + -halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + } + } + } + return false; +}; + +/** + * This method returns in which cardinal direction does input point stays + * 1: North + * 2: East + * 3: South + * 4: West + */ +IGeometry.getCardinalDirection = function (slope, slopePrime, line) { + if (slope > slopePrime) { + return line; + } else { + return 1 + line % 4; + } +}; + +/** + * This method calculates the intersection of the two lines defined by + * point pairs (s1,s2) and (f1,f2). + */ +IGeometry.getIntersection = function (s1, s2, f1, f2) { + if (f2 == null) { + return this.getIntersection2(s1, s2, f1); + } + + var x1 = s1.x; + var y1 = s1.y; + var x2 = s2.x; + var y2 = s2.y; + var x3 = f1.x; + var y3 = f1.y; + var x4 = f2.x; + var y4 = f2.y; + var x = void 0, + y = void 0; // intersection point + var a1 = void 0, + a2 = void 0, + b1 = void 0, + b2 = void 0, + c1 = void 0, + c2 = void 0; // coefficients of line eqns. + var denom = void 0; + + a1 = y2 - y1; + b1 = x1 - x2; + c1 = x2 * y1 - x1 * y2; // { a1*x + b1*y + c1 = 0 is line 1 } + + a2 = y4 - y3; + b2 = x3 - x4; + c2 = x4 * y3 - x3 * y4; // { a2*x + b2*y + c2 = 0 is line 2 } + + denom = a1 * b2 - a2 * b1; + + if (denom === 0) { + return null; + } + + x = (b1 * c2 - b2 * c1) / denom; + y = (a2 * c1 - a1 * c2) / denom; + + return new Point(x, y); +}; + +/** + * This method finds and returns the angle of the vector from the + x-axis + * in clockwise direction (compatible w/ Java coordinate system!). + */ +IGeometry.angleOfVector = function (Cx, Cy, Nx, Ny) { + var C_angle = void 0; + + if (Cx !== Nx) { + C_angle = Math.atan((Ny - Cy) / (Nx - Cx)); + + if (Nx < Cx) { + C_angle += Math.PI; + } else if (Ny < Cy) { + C_angle += this.TWO_PI; + } + } else if (Ny < Cy) { + C_angle = this.ONE_AND_HALF_PI; // 270 degrees + } else { + C_angle = this.HALF_PI; // 90 degrees + } + + return C_angle; +}; + +/** + * This method checks whether the given two line segments (one with point + * p1 and p2, the other with point p3 and p4) intersect at a point other + * than these points. + */ +IGeometry.doIntersect = function (p1, p2, p3, p4) { + var a = p1.x; + var b = p1.y; + var c = p2.x; + var d = p2.y; + var p = p3.x; + var q = p3.y; + var r = p4.x; + var s = p4.y; + var det = (c - a) * (s - q) - (r - p) * (d - b); + + if (det === 0) { + return false; + } else { + var lambda = ((s - q) * (r - a) + (p - r) * (s - b)) / det; + var gamma = ((b - d) * (r - a) + (c - a) * (s - b)) / det; + return 0 < lambda && lambda < 1 && 0 < gamma && gamma < 1; + } +}; + +// ----------------------------------------------------------------------------- +// Section: Class Constants +// ----------------------------------------------------------------------------- +/** + * Some useful pre-calculated constants + */ +IGeometry.HALF_PI = 0.5 * Math.PI; +IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI; +IGeometry.TWO_PI = 2.0 * Math.PI; +IGeometry.THREE_PI = 3.0 * Math.PI; + +module.exports = IGeometry; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function IMath() {} + +/** + * This method returns the sign of the input value. + */ +IMath.sign = function (value) { + if (value > 0) { + return 1; + } else if (value < 0) { + return -1; + } else { + return 0; + } +}; + +IMath.floor = function (value) { + return value < 0 ? Math.ceil(value) : Math.floor(value); +}; + +IMath.ceil = function (value) { + return value < 0 ? Math.floor(value) : Math.ceil(value); +}; + +module.exports = IMath; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function Integer() {} + +Integer.MAX_VALUE = 2147483647; +Integer.MIN_VALUE = -2147483648; + +module.exports = Integer; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var nodeFrom = function nodeFrom(value) { + return { value: value, next: null, prev: null }; +}; + +var add = function add(prev, node, next, list) { + if (prev !== null) { + prev.next = node; + } else { + list.head = node; + } + + if (next !== null) { + next.prev = node; + } else { + list.tail = node; + } + + node.prev = prev; + node.next = next; + + list.length++; + + return node; +}; + +var _remove = function _remove(node, list) { + var prev = node.prev, + next = node.next; + + + if (prev !== null) { + prev.next = next; + } else { + list.head = next; + } + + if (next !== null) { + next.prev = prev; + } else { + list.tail = prev; + } + + node.prev = node.next = null; + + list.length--; + + return node; +}; + +var LinkedList = function () { + function LinkedList(vals) { + var _this = this; + + _classCallCheck(this, LinkedList); + + this.length = 0; + this.head = null; + this.tail = null; + + if (vals != null) { + vals.forEach(function (v) { + return _this.push(v); + }); + } + } + + _createClass(LinkedList, [{ + key: "size", + value: function size() { + return this.length; + } + }, { + key: "insertBefore", + value: function insertBefore(val, otherNode) { + return add(otherNode.prev, nodeFrom(val), otherNode, this); + } + }, { + key: "insertAfter", + value: function insertAfter(val, otherNode) { + return add(otherNode, nodeFrom(val), otherNode.next, this); + } + }, { + key: "insertNodeBefore", + value: function insertNodeBefore(newNode, otherNode) { + return add(otherNode.prev, newNode, otherNode, this); + } + }, { + key: "insertNodeAfter", + value: function insertNodeAfter(newNode, otherNode) { + return add(otherNode, newNode, otherNode.next, this); + } + }, { + key: "push", + value: function push(val) { + return add(this.tail, nodeFrom(val), null, this); + } + }, { + key: "unshift", + value: function unshift(val) { + return add(null, nodeFrom(val), this.head, this); + } + }, { + key: "remove", + value: function remove(node) { + return _remove(node, this); + } + }, { + key: "pop", + value: function pop() { + return _remove(this.tail, this).value; + } + }, { + key: "popNode", + value: function popNode() { + return _remove(this.tail, this); + } + }, { + key: "shift", + value: function shift() { + return _remove(this.head, this).value; + } + }, { + key: "shiftNode", + value: function shiftNode() { + return _remove(this.head, this); + } + }, { + key: "get_object_at", + value: function get_object_at(index) { + if (index <= this.length()) { + var i = 1; + var current = this.head; + while (i < index) { + current = current.next; + i++; + } + return current.value; + } + } + }, { + key: "set_object_at", + value: function set_object_at(index, value) { + if (index <= this.length()) { + var i = 1; + var current = this.head; + while (i < index) { + current = current.next; + i++; + } + current.value = value; + } + } + }]); + + return LinkedList; +}(); + +module.exports = LinkedList; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* + *This class is the javascript implementation of the Point.java class in jdk + */ +function Point(x, y, p) { + this.x = null; + this.y = null; + if (x == null && y == null && p == null) { + this.x = 0; + this.y = 0; + } else if (typeof x == 'number' && typeof y == 'number' && p == null) { + this.x = x; + this.y = y; + } else if (x.constructor.name == 'Point' && y == null && p == null) { + p = x; + this.x = p.x; + this.y = p.y; + } +} + +Point.prototype.getX = function () { + return this.x; +}; + +Point.prototype.getY = function () { + return this.y; +}; + +Point.prototype.getLocation = function () { + return new Point(this.x, this.y); +}; + +Point.prototype.setLocation = function (x, y, p) { + if (x.constructor.name == 'Point' && y == null && p == null) { + p = x; + this.setLocation(p.x, p.y); + } else if (typeof x == 'number' && typeof y == 'number' && p == null) { + //if both parameters are integer just move (x,y) location + if (parseInt(x) == x && parseInt(y) == y) { + this.move(x, y); + } else { + this.x = Math.floor(x + 0.5); + this.y = Math.floor(y + 0.5); + } + } +}; + +Point.prototype.move = function (x, y) { + this.x = x; + this.y = y; +}; + +Point.prototype.translate = function (dx, dy) { + this.x += dx; + this.y += dy; +}; + +Point.prototype.equals = function (obj) { + if (obj.constructor.name == "Point") { + var pt = obj; + return this.x == pt.x && this.y == pt.y; + } + return this == obj; +}; + +Point.prototype.toString = function () { + return new Point().constructor.name + "[x=" + this.x + ",y=" + this.y + "]"; +}; + +module.exports = Point; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function RectangleD(x, y, width, height) { + this.x = 0; + this.y = 0; + this.width = 0; + this.height = 0; + + if (x != null && y != null && width != null && height != null) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } +} + +RectangleD.prototype.getX = function () { + return this.x; +}; + +RectangleD.prototype.setX = function (x) { + this.x = x; +}; + +RectangleD.prototype.getY = function () { + return this.y; +}; + +RectangleD.prototype.setY = function (y) { + this.y = y; +}; + +RectangleD.prototype.getWidth = function () { + return this.width; +}; + +RectangleD.prototype.setWidth = function (width) { + this.width = width; +}; + +RectangleD.prototype.getHeight = function () { + return this.height; +}; + +RectangleD.prototype.setHeight = function (height) { + this.height = height; +}; + +RectangleD.prototype.getRight = function () { + return this.x + this.width; +}; + +RectangleD.prototype.getBottom = function () { + return this.y + this.height; +}; + +RectangleD.prototype.intersects = function (a) { + if (this.getRight() < a.x) { + return false; + } + + if (this.getBottom() < a.y) { + return false; + } + + if (a.getRight() < this.x) { + return false; + } + + if (a.getBottom() < this.y) { + return false; + } + + return true; +}; + +RectangleD.prototype.getCenterX = function () { + return this.x + this.width / 2; +}; + +RectangleD.prototype.getMinX = function () { + return this.getX(); +}; + +RectangleD.prototype.getMaxX = function () { + return this.getX() + this.width; +}; + +RectangleD.prototype.getCenterY = function () { + return this.y + this.height / 2; +}; + +RectangleD.prototype.getMinY = function () { + return this.getY(); +}; + +RectangleD.prototype.getMaxY = function () { + return this.getY() + this.height; +}; + +RectangleD.prototype.getWidthHalf = function () { + return this.width / 2; +}; + +RectangleD.prototype.getHeightHalf = function () { + return this.height / 2; +}; + +module.exports = RectangleD; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +function UniqueIDGeneretor() {} + +UniqueIDGeneretor.lastID = 0; + +UniqueIDGeneretor.createID = function (obj) { + if (UniqueIDGeneretor.isPrimitive(obj)) { + return obj; + } + if (obj.uniqueID != null) { + return obj.uniqueID; + } + obj.uniqueID = UniqueIDGeneretor.getString(); + UniqueIDGeneretor.lastID++; + return obj.uniqueID; +}; + +UniqueIDGeneretor.getString = function (id) { + if (id == null) id = UniqueIDGeneretor.lastID; + return "Object#" + id + ""; +}; + +UniqueIDGeneretor.isPrimitive = function (arg) { + var type = typeof arg === "undefined" ? "undefined" : _typeof(arg); + return arg == null || type != "object" && type != "function"; +}; + +module.exports = UniqueIDGeneretor; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __nested_webpack_require_64072__) { + +"use strict"; + + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var LayoutConstants = __nested_webpack_require_64072__(0); +var LGraphManager = __nested_webpack_require_64072__(6); +var LNode = __nested_webpack_require_64072__(3); +var LEdge = __nested_webpack_require_64072__(1); +var LGraph = __nested_webpack_require_64072__(5); +var PointD = __nested_webpack_require_64072__(4); +var Transform = __nested_webpack_require_64072__(17); +var Emitter = __nested_webpack_require_64072__(27); + +function Layout(isRemoteUse) { + Emitter.call(this); + + //Layout Quality: 0:draft, 1:default, 2:proof + this.layoutQuality = LayoutConstants.QUALITY; + //Whether layout should create bendpoints as needed or not + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + //Whether layout should be incremental or not + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + //Whether we animate from before to after layout node positions + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + //Whether we animate the layout process or not + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + //Number iterations that should be done between two successive animations + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + /** + * Whether or not leaf nodes (non-compound nodes) are of uniform sizes. When + * they are, both spring and repulsion forces between two leaf nodes can be + * calculated without the expensive clipping point calculations, resulting + * in major speed-up. + */ + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + /** + * This is used for creation of bendpoints by using dummy nodes and edges. + * Maps an LEdge to its dummy bendpoint path. + */ + this.edgeToDummyNodes = new Map(); + this.graphManager = new LGraphManager(this); + this.isLayoutFinished = false; + this.isSubLayout = false; + this.isRemoteUse = false; + + if (isRemoteUse != null) { + this.isRemoteUse = isRemoteUse; + } +} + +Layout.RANDOM_SEED = 1; + +Layout.prototype = Object.create(Emitter.prototype); + +Layout.prototype.getGraphManager = function () { + return this.graphManager; +}; + +Layout.prototype.getAllNodes = function () { + return this.graphManager.getAllNodes(); +}; + +Layout.prototype.getAllEdges = function () { + return this.graphManager.getAllEdges(); +}; + +Layout.prototype.getAllNodesToApplyGravitation = function () { + return this.graphManager.getAllNodesToApplyGravitation(); +}; + +Layout.prototype.newGraphManager = function () { + var gm = new LGraphManager(this); + this.graphManager = gm; + return gm; +}; + +Layout.prototype.newGraph = function (vGraph) { + return new LGraph(null, this.graphManager, vGraph); +}; + +Layout.prototype.newNode = function (vNode) { + return new LNode(this.graphManager, vNode); +}; + +Layout.prototype.newEdge = function (vEdge) { + return new LEdge(null, null, vEdge); +}; + +Layout.prototype.checkLayoutSuccess = function () { + return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge(); +}; + +Layout.prototype.runLayout = function () { + this.isLayoutFinished = false; + + if (this.tilingPreLayout) { + this.tilingPreLayout(); + } + + this.initParameters(); + var isLayoutSuccessfull; + + if (this.checkLayoutSuccess()) { + isLayoutSuccessfull = false; + } else { + isLayoutSuccessfull = this.layout(); + } + + if (LayoutConstants.ANIMATE === 'during') { + // If this is a 'during' layout animation. Layout is not finished yet. + // We need to perform these in index.js when layout is really finished. + return false; + } + + if (isLayoutSuccessfull) { + if (!this.isSubLayout) { + this.doPostLayout(); + } + } + + if (this.tilingPostLayout) { + this.tilingPostLayout(); + } + + this.isLayoutFinished = true; + + return isLayoutSuccessfull; +}; + +/** + * This method performs the operations required after layout. + */ +Layout.prototype.doPostLayout = function () { + //assert !isSubLayout : "Should not be called on sub-layout!"; + // Propagate geometric changes to v-level objects + if (!this.incremental) { + this.transform(); + } + this.update(); +}; + +/** + * This method updates the geometry of the target graph according to + * calculated layout. + */ +Layout.prototype.update2 = function () { + // update bend points + if (this.createBendsAsNeeded) { + this.createBendpointsFromDummyNodes(); + + // reset all edges, since the topology has changed + this.graphManager.resetAllEdges(); + } + + // perform edge, node and root updates if layout is not called + // remotely + if (!this.isRemoteUse) { + // update all edges + var edge; + var allEdges = this.graphManager.getAllEdges(); + for (var i = 0; i < allEdges.length; i++) { + edge = allEdges[i]; + // this.update(edge); + } + + // recursively update nodes + var node; + var nodes = this.graphManager.getRoot().getNodes(); + for (var i = 0; i < nodes.length; i++) { + node = nodes[i]; + // this.update(node); + } + + // update root graph + this.update(this.graphManager.getRoot()); + } +}; + +Layout.prototype.update = function (obj) { + if (obj == null) { + this.update2(); + } else if (obj instanceof LNode) { + var node = obj; + if (node.getChild() != null) { + // since node is compound, recursively update child nodes + var nodes = node.getChild().getNodes(); + for (var i = 0; i < nodes.length; i++) { + update(nodes[i]); + } + } + + // if the l-level node is associated with a v-level graph object, + // then it is assumed that the v-level node implements the + // interface Updatable. + if (node.vGraphObject != null) { + // cast to Updatable without any type check + var vNode = node.vGraphObject; + + // call the update method of the interface + vNode.update(node); + } + } else if (obj instanceof LEdge) { + var edge = obj; + // if the l-level edge is associated with a v-level graph object, + // then it is assumed that the v-level edge implements the + // interface Updatable. + + if (edge.vGraphObject != null) { + // cast to Updatable without any type check + var vEdge = edge.vGraphObject; + + // call the update method of the interface + vEdge.update(edge); + } + } else if (obj instanceof LGraph) { + var graph = obj; + // if the l-level graph is associated with a v-level graph object, + // then it is assumed that the v-level object implements the + // interface Updatable. + + if (graph.vGraphObject != null) { + // cast to Updatable without any type check + var vGraph = graph.vGraphObject; + + // call the update method of the interface + vGraph.update(graph); + } + } +}; + +/** + * This method is used to set all layout parameters to default values + * determined at compile time. + */ +Layout.prototype.initParameters = function () { + if (!this.isSubLayout) { + this.layoutQuality = LayoutConstants.QUALITY; + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + } + + if (this.animationDuringLayout) { + this.animationOnLayout = false; + } +}; + +Layout.prototype.transform = function (newLeftTop) { + if (newLeftTop == undefined) { + this.transform(new PointD(0, 0)); + } else { + // create a transformation object (from Eclipse to layout). When an + // inverse transform is applied, we get upper-left coordinate of the + // drawing or the root graph at given input coordinate (some margins + // already included in calculation of left-top). + + var trans = new Transform(); + var leftTop = this.graphManager.getRoot().updateLeftTop(); + + if (leftTop != null) { + trans.setWorldOrgX(newLeftTop.x); + trans.setWorldOrgY(newLeftTop.y); + + trans.setDeviceOrgX(leftTop.x); + trans.setDeviceOrgY(leftTop.y); + + var nodes = this.getAllNodes(); + var node; + + for (var i = 0; i < nodes.length; i++) { + node = nodes[i]; + node.transform(trans); + } + } + } +}; + +Layout.prototype.positionNodesRandomly = function (graph) { + + if (graph == undefined) { + //assert !this.incremental; + this.positionNodesRandomly(this.getGraphManager().getRoot()); + this.getGraphManager().getRoot().updateBounds(true); + } else { + var lNode; + var childGraph; + + var nodes = graph.getNodes(); + for (var i = 0; i < nodes.length; i++) { + lNode = nodes[i]; + childGraph = lNode.getChild(); + + if (childGraph == null) { + lNode.scatter(); + } else if (childGraph.getNodes().length == 0) { + lNode.scatter(); + } else { + this.positionNodesRandomly(childGraph); + lNode.updateBounds(); + } + } + } +}; + +/** + * This method returns a list of trees where each tree is represented as a + * list of l-nodes. The method returns a list of size 0 when: + * - The graph is not flat or + * - One of the component(s) of the graph is not a tree. + */ +Layout.prototype.getFlatForest = function () { + var flatForest = []; + var isForest = true; + + // Quick reference for all nodes in the graph manager associated with + // this layout. The list should not be changed. + var allNodes = this.graphManager.getRoot().getNodes(); + + // First be sure that the graph is flat + var isFlat = true; + + for (var i = 0; i < allNodes.length; i++) { + if (allNodes[i].getChild() != null) { + isFlat = false; + } + } + + // Return empty forest if the graph is not flat. + if (!isFlat) { + return flatForest; + } + + // Run BFS for each component of the graph. + + var visited = new Set(); + var toBeVisited = []; + var parents = new Map(); + var unProcessedNodes = []; + + unProcessedNodes = unProcessedNodes.concat(allNodes); + + // Each iteration of this loop finds a component of the graph and + // decides whether it is a tree or not. If it is a tree, adds it to the + // forest and continued with the next component. + + while (unProcessedNodes.length > 0 && isForest) { + toBeVisited.push(unProcessedNodes[0]); + + // Start the BFS. Each iteration of this loop visits a node in a + // BFS manner. + while (toBeVisited.length > 0 && isForest) { + //pool operation + var currentNode = toBeVisited[0]; + toBeVisited.splice(0, 1); + visited.add(currentNode); + + // Traverse all neighbors of this node + var neighborEdges = currentNode.getEdges(); + + for (var i = 0; i < neighborEdges.length; i++) { + var currentNeighbor = neighborEdges[i].getOtherEnd(currentNode); + + // If BFS is not growing from this neighbor. + if (parents.get(currentNode) != currentNeighbor) { + // We haven't previously visited this neighbor. + if (!visited.has(currentNeighbor)) { + toBeVisited.push(currentNeighbor); + parents.set(currentNeighbor, currentNode); + } + // Since we have previously visited this neighbor and + // this neighbor is not parent of currentNode, given + // graph contains a component that is not tree, hence + // it is not a forest. + else { + isForest = false; + break; + } + } + } + } + + // The graph contains a component that is not a tree. Empty + // previously found trees. The method will end. + if (!isForest) { + flatForest = []; + } + // Save currently visited nodes as a tree in our forest. Reset + // visited and parents lists. Continue with the next component of + // the graph, if any. + else { + var temp = [].concat(_toConsumableArray(visited)); + flatForest.push(temp); + //flatForest = flatForest.concat(temp); + //unProcessedNodes.removeAll(visited); + for (var i = 0; i < temp.length; i++) { + var value = temp[i]; + var index = unProcessedNodes.indexOf(value); + if (index > -1) { + unProcessedNodes.splice(index, 1); + } + } + visited = new Set(); + parents = new Map(); + } + } + + return flatForest; +}; + +/** + * This method creates dummy nodes (an l-level node with minimal dimensions) + * for the given edge (one per bendpoint). The existing l-level structure + * is updated accordingly. + */ +Layout.prototype.createDummyNodesForBendpoints = function (edge) { + var dummyNodes = []; + var prev = edge.source; + + var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target); + + for (var i = 0; i < edge.bendpoints.length; i++) { + // create new dummy node + var dummyNode = this.newNode(null); + dummyNode.setRect(new Point(0, 0), new Dimension(1, 1)); + + graph.add(dummyNode); + + // create new dummy edge between prev and dummy node + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev, dummyNode); + + dummyNodes.add(dummyNode); + prev = dummyNode; + } + + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev, edge.target); + + this.edgeToDummyNodes.set(edge, dummyNodes); + + // remove real edge from graph manager if it is inter-graph + if (edge.isInterGraph()) { + this.graphManager.remove(edge); + } + // else, remove the edge from the current graph + else { + graph.remove(edge); + } + + return dummyNodes; +}; + +/** + * This method creates bendpoints for edges from the dummy nodes + * at l-level. + */ +Layout.prototype.createBendpointsFromDummyNodes = function () { + var edges = []; + edges = edges.concat(this.graphManager.getAllEdges()); + edges = [].concat(_toConsumableArray(this.edgeToDummyNodes.keys())).concat(edges); + + for (var k = 0; k < edges.length; k++) { + var lEdge = edges[k]; + + if (lEdge.bendpoints.length > 0) { + var path = this.edgeToDummyNodes.get(lEdge); + + for (var i = 0; i < path.length; i++) { + var dummyNode = path[i]; + var p = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY()); + + // update bendpoint's location according to dummy node + var ebp = lEdge.bendpoints.get(i); + ebp.x = p.x; + ebp.y = p.y; + + // remove the dummy node, dummy edges incident with this + // dummy node is also removed (within the remove method) + dummyNode.getOwner().remove(dummyNode); + } + + // add the real edge to graph + this.graphManager.add(lEdge, lEdge.source, lEdge.target); + } + } +}; + +Layout.transform = function (sliderValue, defaultValue, minDiv, maxMul) { + if (minDiv != undefined && maxMul != undefined) { + var value = defaultValue; + + if (sliderValue <= 50) { + var minValue = defaultValue / minDiv; + value -= (defaultValue - minValue) / 50 * (50 - sliderValue); + } else { + var maxValue = defaultValue * maxMul; + value += (maxValue - defaultValue) / 50 * (sliderValue - 50); + } + + return value; + } else { + var a, b; + + if (sliderValue <= 50) { + a = 9.0 * defaultValue / 500.0; + b = defaultValue / 10.0; + } else { + a = 9.0 * defaultValue / 50.0; + b = -8 * defaultValue; + } + + return a * sliderValue + b; + } +}; + +/** + * This method finds and returns the center of the given nodes, assuming + * that the given nodes form a tree in themselves. + */ +Layout.findCenterOfTree = function (nodes) { + var list = []; + list = list.concat(nodes); + + var removedNodes = []; + var remainingDegrees = new Map(); + var foundCenter = false; + var centerNode = null; + + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + + for (var i = 0; i < list.length; i++) { + var node = list[i]; + var degree = node.getNeighborsList().size; + remainingDegrees.set(node, node.getNeighborsList().size); + + if (degree == 1) { + removedNodes.push(node); + } + } + + var tempList = []; + tempList = tempList.concat(removedNodes); + + while (!foundCenter) { + var tempList2 = []; + tempList2 = tempList2.concat(tempList); + tempList = []; + + for (var i = 0; i < list.length; i++) { + var node = list[i]; + + var index = list.indexOf(node); + if (index >= 0) { + list.splice(index, 1); + } + + var neighbours = node.getNeighborsList(); + + neighbours.forEach(function (neighbour) { + if (removedNodes.indexOf(neighbour) < 0) { + var otherDegree = remainingDegrees.get(neighbour); + var newDegree = otherDegree - 1; + + if (newDegree == 1) { + tempList.push(neighbour); + } + + remainingDegrees.set(neighbour, newDegree); + } + }); + } + + removedNodes = removedNodes.concat(tempList); + + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + } + + return centerNode; +}; + +/** + * During the coarsening process, this layout may be referenced by two graph managers + * this setter function grants access to change the currently being used graph manager + */ +Layout.prototype.setGraphManager = function (gm) { + this.graphManager = gm; +}; + +module.exports = Layout; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function RandomSeed() {} +// adapted from: https://stackoverflow.com/a/19303725 +RandomSeed.seed = 1; +RandomSeed.x = 0; + +RandomSeed.nextDouble = function () { + RandomSeed.x = Math.sin(RandomSeed.seed++) * 10000; + return RandomSeed.x - Math.floor(RandomSeed.x); +}; + +module.exports = RandomSeed; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __nested_webpack_require_81860__) { + +"use strict"; + + +var PointD = __nested_webpack_require_81860__(4); + +function Transform(x, y) { + this.lworldOrgX = 0.0; + this.lworldOrgY = 0.0; + this.ldeviceOrgX = 0.0; + this.ldeviceOrgY = 0.0; + this.lworldExtX = 1.0; + this.lworldExtY = 1.0; + this.ldeviceExtX = 1.0; + this.ldeviceExtY = 1.0; +} + +Transform.prototype.getWorldOrgX = function () { + return this.lworldOrgX; +}; + +Transform.prototype.setWorldOrgX = function (wox) { + this.lworldOrgX = wox; +}; + +Transform.prototype.getWorldOrgY = function () { + return this.lworldOrgY; +}; + +Transform.prototype.setWorldOrgY = function (woy) { + this.lworldOrgY = woy; +}; + +Transform.prototype.getWorldExtX = function () { + return this.lworldExtX; +}; + +Transform.prototype.setWorldExtX = function (wex) { + this.lworldExtX = wex; +}; + +Transform.prototype.getWorldExtY = function () { + return this.lworldExtY; +}; + +Transform.prototype.setWorldExtY = function (wey) { + this.lworldExtY = wey; +}; + +/* Device related */ + +Transform.prototype.getDeviceOrgX = function () { + return this.ldeviceOrgX; +}; + +Transform.prototype.setDeviceOrgX = function (dox) { + this.ldeviceOrgX = dox; +}; + +Transform.prototype.getDeviceOrgY = function () { + return this.ldeviceOrgY; +}; + +Transform.prototype.setDeviceOrgY = function (doy) { + this.ldeviceOrgY = doy; +}; + +Transform.prototype.getDeviceExtX = function () { + return this.ldeviceExtX; +}; + +Transform.prototype.setDeviceExtX = function (dex) { + this.ldeviceExtX = dex; +}; + +Transform.prototype.getDeviceExtY = function () { + return this.ldeviceExtY; +}; + +Transform.prototype.setDeviceExtY = function (dey) { + this.ldeviceExtY = dey; +}; + +Transform.prototype.transformX = function (x) { + var xDevice = 0.0; + var worldExtX = this.lworldExtX; + if (worldExtX != 0.0) { + xDevice = this.ldeviceOrgX + (x - this.lworldOrgX) * this.ldeviceExtX / worldExtX; + } + + return xDevice; +}; + +Transform.prototype.transformY = function (y) { + var yDevice = 0.0; + var worldExtY = this.lworldExtY; + if (worldExtY != 0.0) { + yDevice = this.ldeviceOrgY + (y - this.lworldOrgY) * this.ldeviceExtY / worldExtY; + } + + return yDevice; +}; + +Transform.prototype.inverseTransformX = function (x) { + var xWorld = 0.0; + var deviceExtX = this.ldeviceExtX; + if (deviceExtX != 0.0) { + xWorld = this.lworldOrgX + (x - this.ldeviceOrgX) * this.lworldExtX / deviceExtX; + } + + return xWorld; +}; + +Transform.prototype.inverseTransformY = function (y) { + var yWorld = 0.0; + var deviceExtY = this.ldeviceExtY; + if (deviceExtY != 0.0) { + yWorld = this.lworldOrgY + (y - this.ldeviceOrgY) * this.lworldExtY / deviceExtY; + } + return yWorld; +}; + +Transform.prototype.inverseTransformPoint = function (inPoint) { + var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y)); + return outPoint; +}; + +module.exports = Transform; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __nested_webpack_require_84747__) { + +"use strict"; + + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var Layout = __nested_webpack_require_84747__(15); +var FDLayoutConstants = __nested_webpack_require_84747__(7); +var LayoutConstants = __nested_webpack_require_84747__(0); +var IGeometry = __nested_webpack_require_84747__(8); +var IMath = __nested_webpack_require_84747__(9); + +function FDLayout() { + Layout.call(this); + + this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.idealEdgeLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + this.displacementThresholdPerNode = 3.0 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100; + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.totalDisplacement = 0.0; + this.oldTotalDisplacement = 0.0; + this.maxIterations = FDLayoutConstants.MAX_ITERATIONS; +} + +FDLayout.prototype = Object.create(Layout.prototype); + +for (var prop in Layout) { + FDLayout[prop] = Layout[prop]; +} + +FDLayout.prototype.initParameters = function () { + Layout.prototype.initParameters.call(this, arguments); + + this.totalIterations = 0; + this.notAnimatedIterations = 0; + + this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION; + + this.grid = []; +}; + +FDLayout.prototype.calcIdealEdgeLengths = function () { + var edge; + var lcaDepth; + var source; + var target; + var sizeOfSourceInLca; + var sizeOfTargetInLca; + + var allEdges = this.getGraphManager().getAllEdges(); + for (var i = 0; i < allEdges.length; i++) { + edge = allEdges[i]; + + edge.idealLength = this.idealEdgeLength; + + if (edge.isInterGraph) { + source = edge.getSource(); + target = edge.getTarget(); + + sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize(); + sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize(); + + if (this.useSmartIdealEdgeLengthCalculation) { + edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE; + } + + lcaDepth = edge.getLca().getInclusionTreeDepth(); + + edge.idealLength += FDLayoutConstants.DEFAULT_EDGE_LENGTH * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth); + } + } +}; + +FDLayout.prototype.initSpringEmbedder = function () { + + var s = this.getAllNodes().length; + if (this.incremental) { + if (s > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL; + } else { + if (s > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1.0 - (s - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } else { + this.coolingFactor = 1.0; + } + this.initialCoolingFactor = this.coolingFactor; + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT; + } + + this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations); + + this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length; + + this.repulsionRange = this.calcRepulsionRange(); +}; + +FDLayout.prototype.calcSpringForces = function () { + var lEdges = this.getAllEdges(); + var edge; + + for (var i = 0; i < lEdges.length; i++) { + edge = lEdges[i]; + + this.calcSpringForce(edge, edge.idealLength); + } +}; + +FDLayout.prototype.calcRepulsionForces = function () { + var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var i, j; + var nodeA, nodeB; + var lNodes = this.getAllNodes(); + var processedNodeSet; + + if (this.useFRGridVariant) { + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) { + this.updateGrid(); + } + + processedNodeSet = new Set(); + + // calculate repulsion forces between each nodes and its surrounding + for (i = 0; i < lNodes.length; i++) { + nodeA = lNodes[i]; + this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate); + processedNodeSet.add(nodeA); + } + } else { + for (i = 0; i < lNodes.length; i++) { + nodeA = lNodes[i]; + + for (j = i + 1; j < lNodes.length; j++) { + nodeB = lNodes[j]; + + // If both nodes are not members of the same graph, skip. + if (nodeA.getOwner() != nodeB.getOwner()) { + continue; + } + + this.calcRepulsionForce(nodeA, nodeB); + } + } + } +}; + +FDLayout.prototype.calcGravitationalForces = function () { + var node; + var lNodes = this.getAllNodesToApplyGravitation(); + + for (var i = 0; i < lNodes.length; i++) { + node = lNodes[i]; + this.calcGravitationalForce(node); + } +}; + +FDLayout.prototype.moveNodes = function () { + var lNodes = this.getAllNodes(); + var node; + + for (var i = 0; i < lNodes.length; i++) { + node = lNodes[i]; + node.move(); + } +}; + +FDLayout.prototype.calcSpringForce = function (edge, idealLength) { + var sourceNode = edge.getSource(); + var targetNode = edge.getTarget(); + + var length; + var springForce; + var springForceX; + var springForceY; + + // Update edge length + if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) { + edge.updateLengthSimple(); + } else { + edge.updateLength(); + + if (edge.isOverlapingSourceAndTarget) { + return; + } + } + + length = edge.getLength(); + + if (length == 0) return; + + // Calculate spring forces + springForce = this.springConstant * (length - idealLength); + + // Project force onto x and y axes + springForceX = springForce * (edge.lengthX / length); + springForceY = springForce * (edge.lengthY / length); + + // Apply forces on the end nodes + sourceNode.springForceX += springForceX; + sourceNode.springForceY += springForceY; + targetNode.springForceX -= springForceX; + targetNode.springForceY -= springForceY; +}; + +FDLayout.prototype.calcRepulsionForce = function (nodeA, nodeB) { + var rectA = nodeA.getRect(); + var rectB = nodeB.getRect(); + var overlapAmount = new Array(2); + var clipPoints = new Array(4); + var distanceX; + var distanceY; + var distanceSquared; + var distance; + var repulsionForce; + var repulsionForceX; + var repulsionForceY; + + if (rectA.intersects(rectB)) // two nodes overlap + { + // calculate separation amount in x and y directions + IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2.0); + + repulsionForceX = 2 * overlapAmount[0]; + repulsionForceY = 2 * overlapAmount[1]; + + var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren); + + // Apply forces on the two nodes + nodeA.repulsionForceX -= childrenConstant * repulsionForceX; + nodeA.repulsionForceY -= childrenConstant * repulsionForceY; + nodeB.repulsionForceX += childrenConstant * repulsionForceX; + nodeB.repulsionForceY += childrenConstant * repulsionForceY; + } else // no overlap + { + // calculate distance + + if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) // simply base repulsion on distance of node centers + { + distanceX = rectB.getCenterX() - rectA.getCenterX(); + distanceY = rectB.getCenterY() - rectA.getCenterY(); + } else // use clipping points + { + IGeometry.getIntersection(rectA, rectB, clipPoints); + + distanceX = clipPoints[2] - clipPoints[0]; + distanceY = clipPoints[3] - clipPoints[1]; + } + + // No repulsion range. FR grid variant should take care of this. + if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST; + } + + if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST; + } + + distanceSquared = distanceX * distanceX + distanceY * distanceY; + distance = Math.sqrt(distanceSquared); + + repulsionForce = this.repulsionConstant * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared; + + // Project force onto x and y axes + repulsionForceX = repulsionForce * distanceX / distance; + repulsionForceY = repulsionForce * distanceY / distance; + + // Apply forces on the two nodes + nodeA.repulsionForceX -= repulsionForceX; + nodeA.repulsionForceY -= repulsionForceY; + nodeB.repulsionForceX += repulsionForceX; + nodeB.repulsionForceY += repulsionForceY; + } +}; + +FDLayout.prototype.calcGravitationalForce = function (node) { + var ownerGraph; + var ownerCenterX; + var ownerCenterY; + var distanceX; + var distanceY; + var absDistanceX; + var absDistanceY; + var estimatedSize; + ownerGraph = node.getOwner(); + + ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2; + ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2; + distanceX = node.getCenterX() - ownerCenterX; + distanceY = node.getCenterY() - ownerCenterY; + absDistanceX = Math.abs(distanceX) + node.getWidth() / 2; + absDistanceY = Math.abs(distanceY) + node.getHeight() / 2; + + if (node.getOwner() == this.graphManager.getRoot()) // in the root graph + { + estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor; + + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node.gravitationForceX = -this.gravityConstant * distanceX; + node.gravitationForceY = -this.gravityConstant * distanceY; + } + } else // inside a compound + { + estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor; + + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant; + node.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant; + } + } +}; + +FDLayout.prototype.isConverged = function () { + var converged; + var oscilating = false; + + if (this.totalIterations > this.maxIterations / 3) { + oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2; + } + + converged = this.totalDisplacement < this.totalDisplacementThreshold; + + this.oldTotalDisplacement = this.totalDisplacement; + + return converged || oscilating; +}; + +FDLayout.prototype.animate = function () { + if (this.animationDuringLayout && !this.isSubLayout) { + if (this.notAnimatedIterations == this.animationPeriod) { + this.update(); + this.notAnimatedIterations = 0; + } else { + this.notAnimatedIterations++; + } + } +}; + +//This method calculates the number of children (weight) for all nodes +FDLayout.prototype.calcNoOfChildrenForAllNodes = function () { + var node; + var allNodes = this.graphManager.getAllNodes(); + + for (var i = 0; i < allNodes.length; i++) { + node = allNodes[i]; + node.noOfChildren = node.getNoOfChildren(); + } +}; + +// ----------------------------------------------------------------------------- +// Section: FR-Grid Variant Repulsion Force Calculation +// ----------------------------------------------------------------------------- + +FDLayout.prototype.calcGrid = function (graph) { + + var sizeX = 0; + var sizeY = 0; + + sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange)); + sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange)); + + var grid = new Array(sizeX); + + for (var i = 0; i < sizeX; i++) { + grid[i] = new Array(sizeY); + } + + for (var i = 0; i < sizeX; i++) { + for (var j = 0; j < sizeY; j++) { + grid[i][j] = new Array(); + } + } + + return grid; +}; + +FDLayout.prototype.addNodeToGrid = function (v, left, top) { + + var startX = 0; + var finishX = 0; + var startY = 0; + var finishY = 0; + + startX = parseInt(Math.floor((v.getRect().x - left) / this.repulsionRange)); + finishX = parseInt(Math.floor((v.getRect().width + v.getRect().x - left) / this.repulsionRange)); + startY = parseInt(Math.floor((v.getRect().y - top) / this.repulsionRange)); + finishY = parseInt(Math.floor((v.getRect().height + v.getRect().y - top) / this.repulsionRange)); + + for (var i = startX; i <= finishX; i++) { + for (var j = startY; j <= finishY; j++) { + this.grid[i][j].push(v); + v.setGridCoordinates(startX, finishX, startY, finishY); + } + } +}; + +FDLayout.prototype.updateGrid = function () { + var i; + var nodeA; + var lNodes = this.getAllNodes(); + + this.grid = this.calcGrid(this.graphManager.getRoot()); + + // put all nodes to proper grid cells + for (i = 0; i < lNodes.length; i++) { + nodeA = lNodes[i]; + this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop()); + } +}; + +FDLayout.prototype.calculateRepulsionForceOfANode = function (nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) { + + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) { + var surrounding = new Set(); + nodeA.surrounding = new Array(); + var nodeB; + var grid = this.grid; + + for (var i = nodeA.startX - 1; i < nodeA.finishX + 2; i++) { + for (var j = nodeA.startY - 1; j < nodeA.finishY + 2; j++) { + if (!(i < 0 || j < 0 || i >= grid.length || j >= grid[0].length)) { + for (var k = 0; k < grid[i][j].length; k++) { + nodeB = grid[i][j][k]; + + // If both nodes are not members of the same graph, + // or both nodes are the same, skip. + if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) { + continue; + } + + // check if the repulsion force between + // nodeA and nodeB has already been calculated + if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) { + var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2); + var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2); + + // if the distance between nodeA and nodeB + // is less then calculation range + if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) { + //then add nodeB to surrounding of nodeA + surrounding.add(nodeB); + } + } + } + } + } + } + + nodeA.surrounding = [].concat(_toConsumableArray(surrounding)); + } + for (i = 0; i < nodeA.surrounding.length; i++) { + this.calcRepulsionForce(nodeA, nodeA.surrounding[i]); + } +}; + +FDLayout.prototype.calcRepulsionRange = function () { + return 0.0; +}; + +module.exports = FDLayout; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __nested_webpack_require_100902__) { + +"use strict"; + + +var LEdge = __nested_webpack_require_100902__(1); +var FDLayoutConstants = __nested_webpack_require_100902__(7); + +function FDLayoutEdge(source, target, vEdge) { + LEdge.call(this, source, target, vEdge); + this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; +} + +FDLayoutEdge.prototype = Object.create(LEdge.prototype); + +for (var prop in LEdge) { + FDLayoutEdge[prop] = LEdge[prop]; +} + +module.exports = FDLayoutEdge; + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __nested_webpack_require_101387__) { + +"use strict"; + + +var LNode = __nested_webpack_require_101387__(3); + +function FDLayoutNode(gm, loc, size, vNode) { + // alternative constructor is handled inside LNode + LNode.call(this, gm, loc, size, vNode); + //Spring, repulsion and gravitational forces acting on this node + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + //Amount by which this node is to be moved in this iteration + this.displacementX = 0; + this.displacementY = 0; + + //Start and finish grid coordinates that this node is fallen into + this.startX = 0; + this.finishX = 0; + this.startY = 0; + this.finishY = 0; + + //Geometric neighbors of this node + this.surrounding = []; +} + +FDLayoutNode.prototype = Object.create(LNode.prototype); + +for (var prop in LNode) { + FDLayoutNode[prop] = LNode[prop]; +} + +FDLayoutNode.prototype.setGridCoordinates = function (_startX, _finishX, _startY, _finishY) { + this.startX = _startX; + this.finishX = _finishX; + this.startY = _startY; + this.finishY = _finishY; +}; + +module.exports = FDLayoutNode; + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function DimensionD(width, height) { + this.width = 0; + this.height = 0; + if (width !== null && height !== null) { + this.height = height; + this.width = width; + } +} + +DimensionD.prototype.getWidth = function () { + return this.width; +}; + +DimensionD.prototype.setWidth = function (width) { + this.width = width; +}; + +DimensionD.prototype.getHeight = function () { + return this.height; +}; + +DimensionD.prototype.setHeight = function (height) { + this.height = height; +}; + +module.exports = DimensionD; + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __nested_webpack_require_103173__) { + +"use strict"; + + +var UniqueIDGeneretor = __nested_webpack_require_103173__(14); + +function HashMap() { + this.map = {}; + this.keys = []; +} + +HashMap.prototype.put = function (key, value) { + var theId = UniqueIDGeneretor.createID(key); + if (!this.contains(theId)) { + this.map[theId] = value; + this.keys.push(key); + } +}; + +HashMap.prototype.contains = function (key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[key] != null; +}; + +HashMap.prototype.get = function (key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[theId]; +}; + +HashMap.prototype.keySet = function () { + return this.keys; +}; + +module.exports = HashMap; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __nested_webpack_require_103901__) { + +"use strict"; + + +var UniqueIDGeneretor = __nested_webpack_require_103901__(14); + +function HashSet() { + this.set = {}; +} +; + +HashSet.prototype.add = function (obj) { + var theId = UniqueIDGeneretor.createID(obj); + if (!this.contains(theId)) this.set[theId] = obj; +}; + +HashSet.prototype.remove = function (obj) { + delete this.set[UniqueIDGeneretor.createID(obj)]; +}; + +HashSet.prototype.clear = function () { + this.set = {}; +}; + +HashSet.prototype.contains = function (obj) { + return this.set[UniqueIDGeneretor.createID(obj)] == obj; +}; + +HashSet.prototype.isEmpty = function () { + return this.size() === 0; +}; + +HashSet.prototype.size = function () { + return Object.keys(this.set).length; +}; + +//concats this.set to the given list +HashSet.prototype.addAllTo = function (list) { + var keys = Object.keys(this.set); + var length = keys.length; + for (var i = 0; i < length; i++) { + list.push(this.set[keys[i]]); + } +}; + +HashSet.prototype.size = function () { + return Object.keys(this.set).length; +}; + +HashSet.prototype.addAll = function (list) { + var s = list.length; + for (var i = 0; i < s; i++) { + var v = list[i]; + this.add(v); + } +}; + +module.exports = HashSet; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __nested_webpack_require_105138__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * A classic Quicksort algorithm with Hoare's partition + * - Works also on LinkedList objects + * + * Copyright: i-Vis Research Group, Bilkent University, 2007 - present + */ + +var LinkedList = __nested_webpack_require_105138__(11); + +var Quicksort = function () { + function Quicksort(A, compareFunction) { + _classCallCheck(this, Quicksort); + + if (compareFunction !== null || compareFunction !== undefined) this.compareFunction = this._defaultCompareFunction; + + var length = void 0; + if (A instanceof LinkedList) length = A.size();else length = A.length; + + this._quicksort(A, 0, length - 1); + } + + _createClass(Quicksort, [{ + key: '_quicksort', + value: function _quicksort(A, p, r) { + if (p < r) { + var q = this._partition(A, p, r); + this._quicksort(A, p, q); + this._quicksort(A, q + 1, r); + } + } + }, { + key: '_partition', + value: function _partition(A, p, r) { + var x = this._get(A, p); + var i = p; + var j = r; + while (true) { + while (this.compareFunction(x, this._get(A, j))) { + j--; + }while (this.compareFunction(this._get(A, i), x)) { + i++; + }if (i < j) { + this._swap(A, i, j); + i++; + j--; + } else return j; + } + } + }, { + key: '_get', + value: function _get(object, index) { + if (object instanceof LinkedList) return object.get_object_at(index);else return object[index]; + } + }, { + key: '_set', + value: function _set(object, index, value) { + if (object instanceof LinkedList) object.set_object_at(index, value);else object[index] = value; + } + }, { + key: '_swap', + value: function _swap(A, i, j) { + var temp = this._get(A, i); + this._set(A, i, this._get(A, j)); + this._set(A, j, temp); + } + }, { + key: '_defaultCompareFunction', + value: function _defaultCompareFunction(a, b) { + return b > a; + } + }]); + + return Quicksort; +}(); + +module.exports = Quicksort; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Needleman-Wunsch algorithm is an procedure to compute the optimal global alignment of two string + * sequences by S.B.Needleman and C.D.Wunsch (1970). + * + * Aside from the inputs, you can assign the scores for, + * - Match: The two characters at the current index are same. + * - Mismatch: The two characters at the current index are different. + * - Insertion/Deletion(gaps): The best alignment involves one letter aligning to a gap in the other string. + */ + +var NeedlemanWunsch = function () { + function NeedlemanWunsch(sequence1, sequence2) { + var match_score = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var mismatch_penalty = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1; + var gap_penalty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1; + + _classCallCheck(this, NeedlemanWunsch); + + this.sequence1 = sequence1; + this.sequence2 = sequence2; + this.match_score = match_score; + this.mismatch_penalty = mismatch_penalty; + this.gap_penalty = gap_penalty; + + // Just the remove redundancy + this.iMax = sequence1.length + 1; + this.jMax = sequence2.length + 1; + + // Grid matrix of scores + this.grid = new Array(this.iMax); + for (var i = 0; i < this.iMax; i++) { + this.grid[i] = new Array(this.jMax); + + for (var j = 0; j < this.jMax; j++) { + this.grid[i][j] = 0; + } + } + + // Traceback matrix (2D array, each cell is an array of boolean values for [`Diag`, `Up`, `Left`] positions) + this.tracebackGrid = new Array(this.iMax); + for (var _i = 0; _i < this.iMax; _i++) { + this.tracebackGrid[_i] = new Array(this.jMax); + + for (var _j = 0; _j < this.jMax; _j++) { + this.tracebackGrid[_i][_j] = [null, null, null]; + } + } + + // The aligned sequences (return multiple possibilities) + this.alignments = []; + + // Final alignment score + this.score = -1; + + // Calculate scores and tracebacks + this.computeGrids(); + } + + _createClass(NeedlemanWunsch, [{ + key: "getScore", + value: function getScore() { + return this.score; + } + }, { + key: "getAlignments", + value: function getAlignments() { + return this.alignments; + } + + // Main dynamic programming procedure + + }, { + key: "computeGrids", + value: function computeGrids() { + // Fill in the first row + for (var j = 1; j < this.jMax; j++) { + this.grid[0][j] = this.grid[0][j - 1] + this.gap_penalty; + this.tracebackGrid[0][j] = [false, false, true]; + } + + // Fill in the first column + for (var i = 1; i < this.iMax; i++) { + this.grid[i][0] = this.grid[i - 1][0] + this.gap_penalty; + this.tracebackGrid[i][0] = [false, true, false]; + } + + // Fill the rest of the grid + for (var _i2 = 1; _i2 < this.iMax; _i2++) { + for (var _j2 = 1; _j2 < this.jMax; _j2++) { + // Find the max score(s) among [`Diag`, `Up`, `Left`] + var diag = void 0; + if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1]) diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score;else diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty; + + var up = this.grid[_i2 - 1][_j2] + this.gap_penalty; + var left = this.grid[_i2][_j2 - 1] + this.gap_penalty; + + // If there exists multiple max values, capture them for multiple paths + var maxOf = [diag, up, left]; + var indices = this.arrayAllMaxIndexes(maxOf); + + // Update Grids + this.grid[_i2][_j2] = maxOf[indices[0]]; + this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)]; + } + } + + // Update alignment score + this.score = this.grid[this.iMax - 1][this.jMax - 1]; + } + + // Gets all possible valid sequence combinations + + }, { + key: "alignmentTraceback", + value: function alignmentTraceback() { + var inProcessAlignments = []; + + inProcessAlignments.push({ pos: [this.sequence1.length, this.sequence2.length], + seq1: "", + seq2: "" + }); + + while (inProcessAlignments[0]) { + var current = inProcessAlignments[0]; + var directions = this.tracebackGrid[current.pos[0]][current.pos[1]]; + + if (directions[0]) { + inProcessAlignments.push({ pos: [current.pos[0] - 1, current.pos[1] - 1], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + if (directions[1]) { + inProcessAlignments.push({ pos: [current.pos[0] - 1, current.pos[1]], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: '-' + current.seq2 + }); + } + if (directions[2]) { + inProcessAlignments.push({ pos: [current.pos[0], current.pos[1] - 1], + seq1: '-' + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + + if (current.pos[0] === 0 && current.pos[1] === 0) this.alignments.push({ sequence1: current.seq1, + sequence2: current.seq2 + }); + + inProcessAlignments.shift(); + } + + return this.alignments; + } + + // Helper Functions + + }, { + key: "getAllIndexes", + value: function getAllIndexes(arr, val) { + var indexes = [], + i = -1; + while ((i = arr.indexOf(val, i + 1)) !== -1) { + indexes.push(i); + } + return indexes; + } + }, { + key: "arrayAllMaxIndexes", + value: function arrayAllMaxIndexes(array) { + return this.getAllIndexes(array, Math.max.apply(null, array)); + } + }]); + + return NeedlemanWunsch; +}(); + +module.exports = NeedlemanWunsch; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __nested_webpack_require_115611__) { + +"use strict"; + + +var layoutBase = function layoutBase() { + return; +}; + +layoutBase.FDLayout = __nested_webpack_require_115611__(18); +layoutBase.FDLayoutConstants = __nested_webpack_require_115611__(7); +layoutBase.FDLayoutEdge = __nested_webpack_require_115611__(19); +layoutBase.FDLayoutNode = __nested_webpack_require_115611__(20); +layoutBase.DimensionD = __nested_webpack_require_115611__(21); +layoutBase.HashMap = __nested_webpack_require_115611__(22); +layoutBase.HashSet = __nested_webpack_require_115611__(23); +layoutBase.IGeometry = __nested_webpack_require_115611__(8); +layoutBase.IMath = __nested_webpack_require_115611__(9); +layoutBase.Integer = __nested_webpack_require_115611__(10); +layoutBase.Point = __nested_webpack_require_115611__(12); +layoutBase.PointD = __nested_webpack_require_115611__(4); +layoutBase.RandomSeed = __nested_webpack_require_115611__(16); +layoutBase.RectangleD = __nested_webpack_require_115611__(13); +layoutBase.Transform = __nested_webpack_require_115611__(17); +layoutBase.UniqueIDGeneretor = __nested_webpack_require_115611__(14); +layoutBase.Quicksort = __nested_webpack_require_115611__(24); +layoutBase.LinkedList = __nested_webpack_require_115611__(11); +layoutBase.LGraphObject = __nested_webpack_require_115611__(2); +layoutBase.LGraph = __nested_webpack_require_115611__(5); +layoutBase.LEdge = __nested_webpack_require_115611__(1); +layoutBase.LGraphManager = __nested_webpack_require_115611__(6); +layoutBase.LNode = __nested_webpack_require_115611__(3); +layoutBase.Layout = __nested_webpack_require_115611__(15); +layoutBase.LayoutConstants = __nested_webpack_require_115611__(0); +layoutBase.NeedlemanWunsch = __nested_webpack_require_115611__(25); + +module.exports = layoutBase; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function Emitter() { + this.listeners = []; +} + +var p = Emitter.prototype; + +p.addListener = function (event, callback) { + this.listeners.push({ + event: event, + callback: callback + }); +}; + +p.removeListener = function (event, callback) { + for (var i = this.listeners.length; i >= 0; i--) { + var l = this.listeners[i]; + + if (l.event === event && l.callback === callback) { + this.listeners.splice(i, 1); + } + } +}; + +p.emit = function (event, data) { + for (var i = 0; i < this.listeners.length; i++) { + var l = this.listeners[i]; + + if (event === l.event) { + l.callback(data); + } + } +}; + +module.exports = Emitter; + +/***/ }) +/******/ ]); +}); + +/***/ }), + +/***/ 37735: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ diagram: () => (/* binding */ diagram) +/* harmony export */ }); +/* harmony import */ var _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(99255); +/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5949); +/* harmony import */ var cytoscape_dist_cytoscape_umd_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14413); +/* harmony import */ var cytoscape_dist_cytoscape_umd_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cytoscape_dist_cytoscape_umd_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35302); +/* harmony import */ var cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(75627); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(36304); +/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(54628); +/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27693); +/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7608); +/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(42605); +/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(86161); +/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(88472); +/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76576); +/* harmony import */ var dagre_d3_es__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(77567); +/* harmony import */ var dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57635); +/* harmony import */ var dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_isoWeek_js__WEBPACK_IMPORTED_MODULE_10__); +/* harmony import */ var dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(69746); +/* harmony import */ var dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_customParseFormat_js__WEBPACK_IMPORTED_MODULE_11__); +/* harmony import */ var dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(79580); +/* harmony import */ var dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(dayjs_plugin_advancedFormat_js__WEBPACK_IMPORTED_MODULE_12__); + + + + + + + + + + + + + + + + + + + + + + + + +var parser = function() { + var o = function(k, v, o2, l) { + for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) + ; + return o2; + }, $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22]; + var parser2 = { + trace: function trace() { + }, + yy: {}, + symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" }, + productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 6: + case 7: + return yy; + case 8: + yy.getLogger().trace("Stop NL "); + break; + case 9: + yy.getLogger().trace("Stop EOF "); + break; + case 11: + yy.getLogger().trace("Stop NL2 "); + break; + case 12: + yy.getLogger().trace("Stop EOF2 "); + break; + case 15: + yy.getLogger().info("Node: ", $$[$0].id); + yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 16: + yy.getLogger().trace("Icon: ", $$[$0]); + yy.decorateNode({ icon: $$[$0] }); + break; + case 17: + case 21: + yy.decorateNode({ class: $$[$0] }); + break; + case 18: + yy.getLogger().trace("SPACELIST"); + break; + case 19: + yy.getLogger().trace("Node: ", $$[$0].id); + yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 20: + yy.decorateNode({ icon: $$[$0] }); + break; + case 25: + yy.getLogger().trace("node found ..", $$[$0 - 2]); + this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + case 26: + this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT }; + break; + case 27: + yy.getLogger().trace("node found ..", $$[$0 - 3]); + this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + } + }, + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($V7, [2, 3]), { 1: [2, 2] }, o($V7, [2, 4]), o($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o($Vb, [2, 18]), o($Vb, [2, 19]), o($Vb, [2, 20]), o($Vb, [2, 21]), o($Vb, [2, 23]), o($Vb, [2, 24]), o($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o($Vf, [2, 8]), o($Vf, [2, 9]), o($Vf, [2, 10]), o($Vb, [2, 15]), o($Vb, [2, 16]), o($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o($Vf, [2, 11]), o($Vf, [2, 12]), { 21: [1, 37] }, o($Vb, [2, 25]), o($Vb, [2, 27])], + defaultActions: { 2: [2, 1], 6: [2, 2] }, + parseError: function parseError2(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } + }, + parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function lex() { + var token; + token = tstack.pop() || lexer2.lex() || EOF; + if (typeof token !== "number") { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, state, action, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + var lexer = function() { + var lexer2 = { + EOF: 1, + parseError: function parseError2(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + // resets the lexer, sets new input + setInput: function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function() { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function(n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function(match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + for (var k in backup) { + this[k] = backup[k]; + } + return false; + } + return false; + }, + // return next match in input + next: function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: { "case-insensitive": true }, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + switch ($avoiding_name_collisions) { + case 0: + yy.getLogger().trace("Found comment", yy_.yytext); + break; + case 1: + return 8; + case 2: + this.begin("CLASS"); + break; + case 3: + this.popState(); + return 16; + case 4: + this.popState(); + break; + case 5: + yy.getLogger().trace("Begin icon"); + this.begin("ICON"); + break; + case 6: + yy.getLogger().trace("SPACELINE"); + return 6; + case 7: + return 7; + case 8: + return 15; + case 9: + yy.getLogger().trace("end icon"); + this.popState(); + break; + case 10: + yy.getLogger().trace("Exploding node"); + this.begin("NODE"); + return 19; + case 11: + yy.getLogger().trace("Cloud"); + this.begin("NODE"); + return 19; + case 12: + yy.getLogger().trace("Explosion Bang"); + this.begin("NODE"); + return 19; + case 13: + yy.getLogger().trace("Cloud Bang"); + this.begin("NODE"); + return 19; + case 14: + this.begin("NODE"); + return 19; + case 15: + this.begin("NODE"); + return 19; + case 16: + this.begin("NODE"); + return 19; + case 17: + this.begin("NODE"); + return 19; + case 18: + return 13; + case 19: + return 22; + case 20: + return 11; + case 21: + yy.getLogger().trace("Starting NSTR"); + this.begin("NSTR"); + break; + case 22: + yy.getLogger().trace("description:", yy_.yytext); + return "NODE_DESCR"; + case 23: + this.popState(); + break; + case 24: + this.popState(); + yy.getLogger().trace("node end ))"); + return "NODE_DEND"; + case 25: + this.popState(); + yy.getLogger().trace("node end )"); + return "NODE_DEND"; + case 26: + this.popState(); + yy.getLogger().trace("node end ...", yy_.yytext); + return "NODE_DEND"; + case 27: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + case 28: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + case 29: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + case 30: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + case 31: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + case 32: + yy.getLogger().trace("Long description:", yy_.yytext); + return 20; + case 33: + yy.getLogger().trace("Long description:", yy_.yytext); + return 20; + } + }, + rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\-\)\{\}]+)/i, /^(?:$)/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i], + conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR": { "rules": [22, 23], "inclusive": false }, "NODE": { "rules": [21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } } + }; + return lexer2; + }(); + parser2.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser2; + parser2.Parser = Parser; + return new Parser(); +}(); +parser.parser = parser; +const mindmapParser = parser; +const sanitizeText = (text) => (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.n)(text, (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.g)()); +let nodes = []; +let cnt = 0; +let elements = {}; +const clear = () => { + nodes = []; + cnt = 0; + elements = {}; +}; +const getParent = function(level) { + for (let i = nodes.length - 1; i >= 0; i--) { + if (nodes[i].level < level) { + return nodes[i]; + } + } + return null; +}; +const getMindmap = () => { + return nodes.length > 0 ? nodes[0] : null; +}; +const addNode = (level, id, descr, type) => { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l.info("addNode", level, id, descr, type); + const conf = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.g)(); + const node = { + id: cnt++, + nodeId: sanitizeText(id), + level, + descr: sanitizeText(descr), + type, + children: [], + width: (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.g)().mindmap.maxNodeWidth + }; + switch (node.type) { + case nodeType.ROUNDED_RECT: + node.padding = 2 * conf.mindmap.padding; + break; + case nodeType.RECT: + node.padding = 2 * conf.mindmap.padding; + break; + case nodeType.HEXAGON: + node.padding = 2 * conf.mindmap.padding; + break; + default: + node.padding = conf.mindmap.padding; + } + const parent = getParent(level); + if (parent) { + parent.children.push(node); + nodes.push(node); + } else { + if (nodes.length === 0) { + nodes.push(node); + } else { + let error = new Error( + 'There can be only one root. No parent could be found for ("' + node.descr + '")' + ); + error.hash = { + text: "branch " + name, + token: "branch " + name, + line: "1", + loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 }, + expected: ['"checkout ' + name + '"'] + }; + throw error; + } + } +}; +const nodeType = { + DEFAULT: 0, + NO_BORDER: 0, + ROUNDED_RECT: 1, + RECT: 2, + CIRCLE: 3, + CLOUD: 4, + BANG: 5, + HEXAGON: 6 +}; +const getType = (startStr, endStr) => { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l.debug("In get type", startStr, endStr); + switch (startStr) { + case "[": + return nodeType.RECT; + case "(": + return endStr === ")" ? nodeType.ROUNDED_RECT : nodeType.CLOUD; + case "((": + return nodeType.CIRCLE; + case ")": + return nodeType.CLOUD; + case "))": + return nodeType.BANG; + case "{{": + return nodeType.HEXAGON; + default: + return nodeType.DEFAULT; + } +}; +const setElementForId = (id, element) => { + elements[id] = element; +}; +const decorateNode = (decoration) => { + const node = nodes[nodes.length - 1]; + if (decoration && decoration.icon) { + node.icon = sanitizeText(decoration.icon); + } + if (decoration && decoration.class) { + node.class = sanitizeText(decoration.class); + } +}; +const type2Str = (type) => { + switch (type) { + case nodeType.DEFAULT: + return "no-border"; + case nodeType.RECT: + return "rect"; + case nodeType.ROUNDED_RECT: + return "rounded-rect"; + case nodeType.CIRCLE: + return "circle"; + case nodeType.CLOUD: + return "cloud"; + case nodeType.BANG: + return "bang"; + case nodeType.HEXAGON: + return "hexgon"; + default: + return "no-border"; + } +}; +let parseError; +const setErrorHandler = (handler) => { + parseError = handler; +}; +const getLogger = () => _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l; +const getNodeById = (id) => nodes[id]; +const getElementById = (id) => elements[id]; +const mindmapDb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addNode, + clear, + decorateNode, + getElementById, + getLogger, + getMindmap, + getNodeById, + getType, + nodeType, + get parseError() { + return parseError; + }, + sanitizeText, + setElementForId, + setErrorHandler, + type2Str +}, Symbol.toStringTag, { value: "Module" })); +const MAX_SECTIONS = 12; +function wrap(text, width) { + text.each(function() { + var text2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(this), words = text2.text().split(/(\s+|<br>)/).reverse(), word, line = [], lineHeight = 1.1, y = text2.attr("y"), dy = parseFloat(text2.attr("dy")), tspan = text2.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em"); + for (let j = 0; j < words.length; j++) { + word = words[words.length - 1 - j]; + line.push(word); + tspan.text(line.join(" ").trim()); + if (tspan.node().getComputedTextLength() > width || word === "<br>") { + line.pop(); + tspan.text(line.join(" ").trim()); + if (word === "<br>") { + line = [""]; + } else { + line = [word]; + } + tspan = text2.append("tspan").attr("x", 0).attr("y", y).attr("dy", lineHeight + "em").text(word); + } + } + }); +} +const defaultBkg = function(elem, node, section) { + const rd = 5; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr( + "d", + `M0 ${node.height - rd} v${-node.height + 2 * rd} q0,-5 5,-5 h${node.width - 2 * rd} q5,0 5,5 v${node.height - rd} H0 Z` + ); + elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node.height).attr("x2", node.width).attr("y2", node.height); +}; +const rectBkg = function(elem, node) { + elem.append("rect").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr("height", node.height).attr("width", node.width); +}; +const cloudBkg = function(elem, node) { + const w = node.width; + const h = node.height; + const r1 = 0.15 * w; + const r2 = 0.25 * w; + const r3 = 0.35 * w; + const r4 = 0.2 * w; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr( + "d", + `M0 0 a${r1},${r1} 0 0,1 ${w * 0.25},${-1 * w * 0.1} + a${r3},${r3} 1 0,1 ${w * 0.4},${-1 * w * 0.1} + a${r2},${r2} 1 0,1 ${w * 0.35},${1 * w * 0.2} + + a${r1},${r1} 1 0,1 ${w * 0.15},${1 * h * 0.35} + a${r4},${r4} 1 0,1 ${-1 * w * 0.15},${1 * h * 0.65} + + a${r2},${r1} 1 0,1 ${-1 * w * 0.25},${w * 0.15} + a${r3},${r3} 1 0,1 ${-1 * w * 0.5},${0} + a${r1},${r1} 1 0,1 ${-1 * w * 0.25},${-1 * w * 0.15} + + a${r1},${r1} 1 0,1 ${-1 * w * 0.1},${-1 * h * 0.35} + a${r4},${r4} 1 0,1 ${w * 0.1},${-1 * h * 0.65} + + H0 V0 Z` + ); +}; +const bangBkg = function(elem, node) { + const w = node.width; + const h = node.height; + const r = 0.15 * w; + elem.append("path").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr( + "d", + `M0 0 a${r},${r} 1 0,0 ${w * 0.25},${-1 * h * 0.1} + a${r},${r} 1 0,0 ${w * 0.25},${0} + a${r},${r} 1 0,0 ${w * 0.25},${0} + a${r},${r} 1 0,0 ${w * 0.25},${1 * h * 0.1} + + a${r},${r} 1 0,0 ${w * 0.15},${1 * h * 0.33} + a${r * 0.8},${r * 0.8} 1 0,0 ${0},${1 * h * 0.34} + a${r},${r} 1 0,0 ${-1 * w * 0.15},${1 * h * 0.33} + + a${r},${r} 1 0,0 ${-1 * w * 0.25},${h * 0.15} + a${r},${r} 1 0,0 ${-1 * w * 0.25},${0} + a${r},${r} 1 0,0 ${-1 * w * 0.25},${0} + a${r},${r} 1 0,0 ${-1 * w * 0.25},${-1 * h * 0.15} + + a${r},${r} 1 0,0 ${-1 * w * 0.1},${-1 * h * 0.33} + a${r * 0.8},${r * 0.8} 1 0,0 ${0},${-1 * h * 0.34} + a${r},${r} 1 0,0 ${w * 0.1},${-1 * h * 0.33} + + H0 V0 Z` + ); +}; +const circleBkg = function(elem, node) { + elem.append("circle").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr("r", node.width / 2); +}; +function insertPolygonShape(parent, w, h, points, node) { + return parent.insert("polygon", ":first-child").attr( + "points", + points.map(function(d) { + return d.x + "," + d.y; + }).join(" ") + ).attr("transform", "translate(" + (node.width - w) / 2 + ", " + h + ")"); +} +const hexagonBkg = function(elem, node) { + const h = node.height; + const f = 4; + const m = h / f; + const w = node.width - node.padding + 2 * m; + const points = [ + { x: m, y: 0 }, + { x: w - m, y: 0 }, + { x: w, y: -h / 2 }, + { x: w - m, y: -h }, + { x: m, y: -h }, + { x: 0, y: -h / 2 } + ]; + insertPolygonShape(elem, w, h, points, node); +}; +const roundedRectBkg = function(elem, node) { + elem.append("rect").attr("id", "node-" + node.id).attr("class", "node-bkg node-" + type2Str(node.type)).attr("height", node.height).attr("rx", node.padding).attr("ry", node.padding).attr("width", node.width); +}; +const drawNode = function(elem, node, fullSection, conf) { + const section = fullSection % (MAX_SECTIONS - 1); + const nodeElem = elem.append("g"); + node.section = section; + let sectionClass = "section-" + section; + if (section < 0) { + sectionClass += " section-root"; + } + nodeElem.attr("class", (node.class ? node.class + " " : "") + "mindmap-node " + sectionClass); + const bkgElem = nodeElem.append("g"); + const textElem = nodeElem.append("g"); + const txt = textElem.append("text").text(node.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap, node.width); + const bbox = txt.node().getBBox(); + const fontSize = conf.fontSize.replace ? conf.fontSize.replace("px", "") : conf.fontSize; + node.height = bbox.height + fontSize * 1.1 * 0.5 + node.padding; + node.width = bbox.width + 2 * node.padding; + if (node.icon) { + if (node.type === nodeType.CIRCLE) { + node.height += 50; + node.width += 50; + const icon = nodeElem.append("foreignObject").attr("height", "50px").attr("width", node.width).attr("style", "text-align: center;"); + icon.append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + section + " " + node.icon); + textElem.attr( + "transform", + "translate(" + node.width / 2 + ", " + (node.height / 2 - 1.5 * node.padding) + ")" + ); + } else { + node.width += 50; + const orgHeight = node.height; + node.height = Math.max(orgHeight, 60); + const heightDiff = Math.abs(node.height - orgHeight); + const icon = nodeElem.append("foreignObject").attr("width", "60px").attr("height", node.height).attr("style", "text-align: center;margin-top:" + heightDiff / 2 + "px;"); + icon.append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + section + " " + node.icon); + textElem.attr( + "transform", + "translate(" + (25 + node.width / 2) + ", " + (heightDiff / 2 + node.padding / 2) + ")" + ); + } + } else { + textElem.attr("transform", "translate(" + node.width / 2 + ", " + node.padding / 2 + ")"); + } + switch (node.type) { + case nodeType.DEFAULT: + defaultBkg(bkgElem, node, section); + break; + case nodeType.ROUNDED_RECT: + roundedRectBkg(bkgElem, node); + break; + case nodeType.RECT: + rectBkg(bkgElem, node); + break; + case nodeType.CIRCLE: + bkgElem.attr("transform", "translate(" + node.width / 2 + ", " + +node.height / 2 + ")"); + circleBkg(bkgElem, node); + break; + case nodeType.CLOUD: + cloudBkg(bkgElem, node); + break; + case nodeType.BANG: + bangBkg(bkgElem, node); + break; + case nodeType.HEXAGON: + hexagonBkg(bkgElem, node); + break; + } + setElementForId(node.id, nodeElem); + return node.height; +}; +const drawEdge = function drawEdge2(edgesElem, mindmap, parent, depth, fullSection) { + const section = fullSection % (MAX_SECTIONS - 1); + const sx = parent.x + parent.width / 2; + const sy = parent.y + parent.height / 2; + const ex = mindmap.x + mindmap.width / 2; + const ey = mindmap.y + mindmap.height / 2; + const mx = ex > sx ? sx + Math.abs(sx - ex) / 2 : sx - Math.abs(sx - ex) / 2; + const my = ey > sy ? sy + Math.abs(sy - ey) / 2 : sy - Math.abs(sy - ey) / 2; + const qx = ex > sx ? Math.abs(sx - mx) / 2 + sx : -Math.abs(sx - mx) / 2 + sx; + const qy = ey > sy ? Math.abs(sy - my) / 2 + sy : -Math.abs(sy - my) / 2 + sy; + edgesElem.append("path").attr( + "d", + parent.direction === "TB" || parent.direction === "BT" ? `M${sx},${sy} Q${sx},${qy} ${mx},${my} T${ex},${ey}` : `M${sx},${sy} Q${qx},${sy} ${mx},${my} T${ex},${ey}` + ).attr("class", "edge section-edge-" + section + " edge-depth-" + depth); +}; +const positionNode = function(node) { + const nodeElem = getElementById(node.id); + const x = node.x || 0; + const y = node.y || 0; + nodeElem.attr("transform", "translate(" + x + "," + y + ")"); +}; +const svgDraw = { drawNode, positionNode, drawEdge }; +cytoscape_dist_cytoscape_umd_js__WEBPACK_IMPORTED_MODULE_1___default().use((cytoscape_cose_bilkent__WEBPACK_IMPORTED_MODULE_2___default())); +function drawNodes(svg, mindmap, section, conf) { + svgDraw.drawNode(svg, mindmap, section, conf); + if (mindmap.children) { + mindmap.children.forEach((child, index) => { + drawNodes(svg, child, section < 0 ? index : section, conf); + }); + } +} +function drawEdges(edgesEl, cy) { + cy.edges().map((edge, id) => { + const data = edge.data(); + if (edge[0]._private.bodyBounds) { + const bounds = edge[0]._private.rscratch; + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l.trace("Edge: ", id, data); + edgesEl.insert("path").attr( + "d", + `M ${bounds.startX},${bounds.startY} L ${bounds.midX},${bounds.midY} L${bounds.endX},${bounds.endY} ` + ).attr("class", "edge section-edge-" + data.section + " edge-depth-" + data.depth); + } + }); +} +function addNodes(mindmap, cy, conf, level) { + cy.add({ + group: "nodes", + data: { + id: mindmap.id, + labelText: mindmap.descr, + height: mindmap.height, + width: mindmap.width, + level, + nodeId: mindmap.id, + padding: mindmap.padding, + type: mindmap.type + }, + position: { + x: mindmap.x, + y: mindmap.y + } + }); + if (mindmap.children) { + mindmap.children.forEach((child) => { + addNodes(child, cy, conf, level + 1); + cy.add({ + group: "edges", + data: { + id: `${mindmap.id}_${child.id}`, + source: mindmap.id, + target: child.id, + depth: level, + section: child.section + } + }); + }); + } +} +function layoutMindmap(node, conf) { + return new Promise((resolve) => { + const renderEl = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body").append("div").attr("id", "cy").attr("style", "display:none"); + const cy = cytoscape_dist_cytoscape_umd_js__WEBPACK_IMPORTED_MODULE_1___default()({ + container: document.getElementById("cy"), + // container to render in + style: [ + { + selector: "edge", + style: { + "curve-style": "bezier" + } + } + ] + }); + renderEl.remove(); + addNodes(node, cy, conf, 0); + cy.nodes().forEach(function(n) { + n.layoutDimensions = () => { + const data = n.data(); + return { w: data.width, h: data.height }; + }; + }); + cy.layout({ + name: "cose-bilkent", + quality: "proof", + // headless: true, + styleEnabled: false, + animate: false + }).run(); + cy.ready((e) => { + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l.info("Ready", e); + resolve(cy); + }); + }); +} +function positionNodes(cy) { + cy.nodes().map((node, id) => { + const data = node.data(); + data.x = node.position().x; + data.y = node.position().y; + svgDraw.positionNode(data); + const el = getElementById(data.nodeId); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l.info("Id:", id, "Position: (", node.position().x, ", ", node.position().y, ")", data); + el.attr( + "transform", + `translate(${node.position().x - data.width / 2}, ${node.position().y - data.height / 2})` + ); + el.attr("attr", `apa-${id})`); + }); +} +const draw = async (text, id, version, diagObj) => { + const conf = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.g)(); + diagObj.db.clear(); + diagObj.parser.parse(text); + _mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.l.debug("Renering info diagram\n" + text); + const securityLevel = (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.g)().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("#i" + id); + } + const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__/* .select */ .Ys)("body"); + const svg = root.select("#" + id); + svg.append("g"); + const mm = diagObj.db.getMindmap(); + const edgesElem = svg.append("g"); + edgesElem.attr("class", "mindmap-edges"); + const nodesElem = svg.append("g"); + nodesElem.attr("class", "mindmap-nodes"); + drawNodes(nodesElem, mm, -1, conf); + const cy = await layoutMindmap(mm, conf); + drawEdges(edgesElem, cy); + positionNodes(cy); + (0,_mermaid_ae477ddf_js__WEBPACK_IMPORTED_MODULE_13__.s)(void 0, svg, conf.mindmap.padding, conf.mindmap.useMaxWidth); +}; +const mindmapRenderer = { + draw +}; +const genSections = (options) => { + let sections = ""; + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i]; + if ((0,khroma__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z)(options["lineColor" + i])) { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } else { + options["lineColor" + i] = (0,khroma__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z)(options["lineColor" + i], 20); + } + } + for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) { + const sw = "" + (17 - 3 * i); + sections += ` + .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} polygon, .section-${i - 1} path { + fill: ${options["cScale" + i]}; + } + .section-${i - 1} text { + fill: ${options["cScaleLabel" + i]}; + } + .node-icon-${i - 1} { + font-size: 40px; + color: ${options["cScaleLabel" + i]}; + } + .section-edge-${i - 1}{ + stroke: ${options["cScale" + i]}; + } + .edge-depth-${i - 1}{ + stroke-width: ${sw}; + } + .section-${i - 1} line { + stroke: ${options["cScaleInv" + i]} ; + stroke-width: 3; + } + + .disabled, .disabled circle, .disabled text { + fill: lightgray; + } + .disabled text { + fill: #efefef; + } + `; + } + return sections; +}; +const getStyles = (options) => ` + .edge { + stroke-width: 3; + } + ${genSections(options)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${options.git0}; + } + .section-root text { + fill: ${options.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } +`; +const mindmapStyles = getStyles; +const diagram = { + db: mindmapDb, + renderer: mindmapRenderer, + parser: mindmapParser, + styles: mindmapStyles +}; + +//# sourceMappingURL=mindmap-definition-44684416.js.map + + +/***/ }), + +/***/ 75627: +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + Z: () => (/* binding */ is_dark) +}); + +// EXTERNAL MODULE: ../node_modules/khroma/dist/utils/index.js + 3 modules +var utils = __webpack_require__(83445); +// EXTERNAL MODULE: ../node_modules/khroma/dist/color/index.js + 4 modules +var dist_color = __webpack_require__(31739); +;// CONCATENATED MODULE: ../node_modules/khroma/dist/methods/luminance.js +/* IMPORT */ + + +/* MAIN */ +//SOURCE: https://planetcalc.com/7779 +const luminance = (color) => { + const { r, g, b } = dist_color/* default */.Z.parse(color); + const luminance = .2126 * utils/* default */.Z.channel.toLinear(r) + .7152 * utils/* default */.Z.channel.toLinear(g) + .0722 * utils/* default */.Z.channel.toLinear(b); + return utils/* default */.Z.lang.round(luminance); +}; +/* EXPORT */ +/* harmony default export */ const methods_luminance = (luminance); + +;// CONCATENATED MODULE: ../node_modules/khroma/dist/methods/is_light.js +/* IMPORT */ + +/* MAIN */ +const isLight = (color) => { + return methods_luminance(color) >= .5; +}; +/* EXPORT */ +/* harmony default export */ const is_light = (isLight); + +;// CONCATENATED MODULE: ../node_modules/khroma/dist/methods/is_dark.js +/* IMPORT */ + +/* MAIN */ +const isDark = (color) => { + return !is_light(color); +}; +/* EXPORT */ +/* harmony default export */ const is_dark = (isDark); + + +/***/ }) + +}; +; \ No newline at end of file diff --git a/assets/js/735d0569.40c9c906.js b/assets/js/735d0569.40c9c906.js new file mode 100644 index 00000000000..295a31ff2d8 --- /dev/null +++ b/assets/js/735d0569.40c9c906.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7445],{35318:(e,t,a)=>{a.d(t,{Zo:()=>n,kt:()=>u});var i=a(27378);function c(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){c(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function m(e,t){if(null==e)return{};var a,i,c=function(e,t){if(null==e)return{};var a,i,c={},r=Object.keys(e);for(i=0;i<r.length;i++)a=r[i],t.indexOf(a)>=0||(c[a]=e[a]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)a=r[i],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(c[a]=e[a])}return c}var l=i.createContext({}),p=function(e){var t=i.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},n=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},f=i.forwardRef((function(e,t){var a=e.components,c=e.mdxType,r=e.originalType,l=e.parentName,n=m(e,["components","mdxType","originalType","parentName"]),d=p(a),f=c,u=d["".concat(l,".").concat(f)]||d[f]||s[f]||r;return a?i.createElement(u,o(o({ref:t},n),{},{components:a})):i.createElement(u,o({ref:t},n))}));function u(e,t){var a=arguments,c=t&&t.mdxType;if("string"==typeof e||c){var r=a.length,o=new Array(r);o[0]=f;var m={};for(var l in t)hasOwnProperty.call(t,l)&&(m[l]=t[l]);m.originalType=e,m[d]="string"==typeof e?e:c,o[1]=m;for(var p=2;p<r;p++)o[p]=a[p];return i.createElement.apply(null,o)}return i.createElement.apply(null,a)}f.displayName="MDXCreateElement"},34007:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>s,frontMatter:()=>r,metadata:()=>m,toc:()=>p});var i=a(25773),c=(a(27378),a(35318));const r={sidebar_position:100,title:"Release Notes"},o=void 0,m={unversionedId:"changelog",id:"changelog",title:"Release Notes",description:"{@import ../../vscode/CHANGELOG.md}",source:"@site/docs/changelog.mdx",sourceDirName:".",slug:"/changelog",permalink:"/devicescript/changelog",draft:!1,tags:[],version:"current",sidebarPosition:100,frontMatter:{sidebar_position:100,title:"Release Notes"},sidebar:"tutorialSidebar",previous:{title:"SPI",permalink:"/devicescript/api/spi"},next:{title:"Contributing",permalink:"/devicescript/contributing"}},l={},p=[{value:"Changelog",id:"changelog",level:3},{value:"v2.15.5",id:"v2155",level:4},{value:"v2.15.4",id:"v2154",level:4},{value:"v2.15.3",id:"v2153",level:4},{value:"v2.15.2",id:"v2152",level:4},{value:"v2.15.1",id:"v2151",level:4},{value:"v2.15.0",id:"v2150",level:4},{value:"v2.14.16",id:"v21416",level:4},{value:"v2.14.15",id:"v21415",level:4},{value:"v2.14.14",id:"v21414",level:4},{value:"v2.14.13",id:"v21413",level:4},{value:"v2.14.12",id:"v21412",level:4},{value:"v2.14.11",id:"v21411",level:4},{value:"v2.14.10",id:"v21410",level:4},{value:"v2.14.9",id:"v2149",level:4},{value:"v2.14.8",id:"v2148",level:4},{value:"v2.14.7",id:"v2147",level:4},{value:"v2.14.6",id:"v2146",level:4},{value:"v2.14.5",id:"v2145",level:4},{value:"v2.14.4",id:"v2144",level:4},{value:"v2.14.3",id:"v2143",level:4},{value:"v2.14.2",id:"v2142",level:4},{value:"v2.14.1",id:"v2141",level:4},{value:"v2.14.0",id:"v2140",level:4},{value:"v2.13.10",id:"v21310",level:4},{value:"v2.13.9",id:"v2139",level:4},{value:"v2.13.8",id:"v2138",level:4},{value:"v2.13.7",id:"v2137",level:4},{value:"v2.13.6",id:"v2136",level:4},{value:"v2.13.5",id:"v2135",level:4},{value:"v2.13.3",id:"v2133",level:4},{value:"v2.13.2",id:"v2132",level:4},{value:"v2.13.1",id:"v2131",level:4},{value:"v2.13.0",id:"v2130",level:4},{value:"v2.12.3",id:"v2123",level:4},{value:"v2.12.2",id:"v2122",level:4},{value:"v2.12.1",id:"v2121",level:4},{value:"v2.12.0",id:"v2120",level:4},{value:"v2.11.6",id:"v2116",level:4},{value:"v2.11.5",id:"v2115",level:4},{value:"v2.11.4",id:"v2114",level:4},{value:"v2.11.3",id:"v2113",level:4},{value:"v2.11.2",id:"v2112",level:4},{value:"v2.11.1",id:"v2111",level:4},{value:"v2.11.0",id:"v2110",level:4},{value:"v2.10.10",id:"v21010",level:4},{value:"v2.10.9",id:"v2109",level:4},{value:"v2.10.8",id:"v2108",level:4},{value:"v2.10.7",id:"v2107",level:4},{value:"v2.10.6",id:"v2106",level:4},{value:"v2.10.5",id:"v2105",level:4},{value:"v2.10.4",id:"v2104",level:4},{value:"v2.10.3",id:"v2103",level:4},{value:"v2.10.2",id:"v2102",level:4},{value:"v2.10.1",id:"v2101",level:4},{value:"v2.10.0",id:"v2100",level:4},{value:"v2.9.16",id:"v2916",level:4},{value:"v2.9.15",id:"v2915",level:4},{value:"v2.9.14",id:"v2914",level:4},{value:"v2.9.13",id:"v2913",level:4},{value:"v2.9.12",id:"v2912",level:4},{value:"v2.9.11",id:"v2911",level:4},{value:"v2.9.10",id:"v2910",level:4},{value:"v2.9.9",id:"v299",level:4},{value:"v2.9.8",id:"v298",level:4},{value:"v2.9.7",id:"v297",level:4},{value:"v2.9.6",id:"v296",level:4},{value:"v2.9.5",id:"v295",level:4},{value:"v2.9.4",id:"v294",level:4},{value:"v2.9.3",id:"v293",level:4},{value:"v2.9.2",id:"v292",level:4},{value:"v2.9.1",id:"v291",level:4},{value:"v2.9.0",id:"v290",level:4},{value:"v2.8.3",id:"v283",level:4},{value:"v2.8.2",id:"v282",level:4},{value:"v2.8.1",id:"v281",level:4},{value:"v2.8.0",id:"v280",level:4},{value:"v2.7.11",id:"v2711",level:4},{value:"v2.7.10",id:"v2710",level:4},{value:"v2.7.9",id:"v279",level:4},{value:"v2.7.7",id:"v277",level:4},{value:"v2.7.4",id:"v274",level:4},{value:"v2.7.3",id:"v273",level:4},{value:"v2.7.2",id:"v272",level:4},{value:"v2.7.1",id:"v271",level:4},{value:"v2.7.0",id:"v270",level:4},{value:"v2.6.2",id:"v262",level:4},{value:"v2.6.1",id:"v261",level:4},{value:"v2.6.0",id:"v260",level:4},{value:"v2.5.0",id:"v250",level:4},{value:"v2.4.4",id:"v244",level:4},{value:"v2.4.3",id:"v243",level:4},{value:"v2.4.2",id:"v242",level:4},{value:"v2.4.1",id:"v241",level:4},{value:"v2.4.0",id:"v240",level:4},{value:"v2.3.4",id:"v234",level:4},{value:"v2.3.3",id:"v233",level:4},{value:"v2.3.2",id:"v232",level:4},{value:"v2.3.1",id:"v231",level:4},{value:"v2.3.0",id:"v230",level:4},{value:"v2.2.29",id:"v2229",level:4},{value:"v2.2.28",id:"v2228",level:4},{value:"v2.2.27",id:"v2227",level:4},{value:"v2.2.26",id:"v2226",level:4},{value:"v2.2.24",id:"v2224",level:4},{value:"v2.2.22",id:"v2222",level:4},{value:"v2.2.21",id:"v2221",level:4},{value:"v2.2.20",id:"v2220",level:4},{value:"v2.2.19",id:"v2219",level:4},{value:"v2.2.18",id:"v2218",level:4},{value:"v2.2.16",id:"v2216",level:4},{value:"v2.2.15",id:"v2215",level:4},{value:"v2.2.14",id:"v2214",level:4},{value:"v2.2.13",id:"v2213",level:4},{value:"v2.2.12",id:"v2212",level:4},{value:"v2.2.11",id:"v2211",level:4},{value:"v2.2.10",id:"v2210",level:4},{value:"v2.2.8",id:"v228",level:4},{value:"v2.2.6",id:"v226",level:4},{value:"v2.2.5",id:"v225",level:4},{value:"v2.2.4",id:"v224",level:4},{value:"v2.2.3",id:"v223",level:4},{value:"v2.2.2",id:"v222",level:4},{value:"v2.2.1",id:"v221",level:4},{value:"v2.2.0",id:"v220",level:4},{value:"v2.1.0",id:"v210",level:4},{value:"v2.0.9",id:"v209",level:4},{value:"v2.0.8",id:"v208",level:4},{value:"v2.0.7",id:"v207",level:4},{value:"v2.0.6",id:"v206",level:4},{value:"v2.0.5",id:"v205",level:4},{value:"v2.0.4",id:"v204",level:4},{value:"v2.0.3",id:"v203",level:4},{value:"v2.0.2",id:"v202",level:4},{value:"v2.0.1",id:"v201",level:4}],n={toc:p},d="wrapper";function s(e){let{components:t,...a}=e;return(0,c.kt)(d,(0,i.Z)({},n,a,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("h3",{id:"changelog"},"Changelog"),(0,c.kt)("p",null,"All notable changes to this project will be documented in this file. Dates are displayed in UTC."),(0,c.kt)("h4",{id:"v2155"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.15.4...v2.15.5"},"v2.15.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"15 September 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add more shields ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ce4e9b15e98969a706163f9f03b7c094b3e3f3b4"},(0,c.kt)("inlineCode",{parentName:"a"},"ce4e9b1"))),(0,c.kt)("li",{parentName:"ul"},"adding shield docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2ef0b0d081c26a49fd416de0d35043ac1b344a92"},(0,c.kt)("inlineCode",{parentName:"a"},"2ef0b0d"))),(0,c.kt)("li",{parentName:"ul"},"added waveshare shield ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2190c91d971e2dc75d2885e467219c16266af50b"},(0,c.kt)("inlineCode",{parentName:"a"},"2190c91")))),(0,c.kt)("h4",{id:"v2154"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.15.3...v2.15.4"},"v2.15.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"12 September 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"update boards (c3fh4-rgb) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/47e9b87048fd21760c961827cb4a5722596a3859"},(0,c.kt)("inlineCode",{parentName:"a"},"47e9b87"))),(0,c.kt)("li",{parentName:"ul"},"updated jacdac specs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/cca3c5cde7b749042b6c68e78b91e330f6d90cae"},(0,c.kt)("inlineCode",{parentName:"a"},"cca3c5c")))),(0,c.kt)("h4",{id:"v2153"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.15.2...v2.15.3"},"v2.15.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 September 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"remove emsdk cache files ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/dab4af55392a52bd1a88325d0a76c3dbd3292818"},(0,c.kt)("inlineCode",{parentName:"a"},"dab4af5"))),(0,c.kt)("li",{parentName:"ul"},"don't release through yarn ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2f19a3a8300aed6e31d3ceb18be811417f22d41b"},(0,c.kt)("inlineCode",{parentName:"a"},"2f19a3a")))),(0,c.kt)("h4",{id:"v2152"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.15.1...v2.15.2"},"v2.15.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 September 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Number.isInteger implementation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/608"},(0,c.kt)("inlineCode",{parentName:"a"},"#608"))),(0,c.kt)("li",{parentName:"ul"},"pixelBuffer -",">"," PixelBuffer.alloc ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/609"},(0,c.kt)("inlineCode",{parentName:"a"},"#609"))),(0,c.kt)("li",{parentName:"ul"},"generate back link to device page in dsboard jsdocs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8b97b871b9004b74a1840993f34d5e0c45e61282"},(0,c.kt)("inlineCode",{parentName:"a"},"8b97b87"))),(0,c.kt)("li",{parentName:"ul"},"added devkicc + ssd1306 sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/64ecea623d2824c2278a4b5d2dcd1c77102021c9"},(0,c.kt)("inlineCode",{parentName:"a"},"64ecea6"))),(0,c.kt)("li",{parentName:"ul"},"rename event worker to avoid confusion with UART ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fc94f8a96b9a18ba221c2d578e8845bf1ed083da"},(0,c.kt)("inlineCode",{parentName:"a"},"fc94f8a")))),(0,c.kt)("h4",{id:"v2151"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.15.0...v2.15.1"},"v2.15.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"14 August 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Array 'With' method implementation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/605"},(0,c.kt)("inlineCode",{parentName:"a"},"#605"))),(0,c.kt)("li",{parentName:"ul"},"fix for ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/604"},"https://github.com/microsoft/devicescript/issues/604")," ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/43d78699e2bf05e92674979d5115670de9b2c136"},(0,c.kt)("inlineCode",{parentName:"a"},"43d7869"))),(0,c.kt)("li",{parentName:"ul"},"fix test suite chunking ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/cf17631685cc38841ef1d1be0ce7a757ead13230"},(0,c.kt)("inlineCode",{parentName:"a"},"cf17631"))),(0,c.kt)("li",{parentName:"ul"},"fixed docs link ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fa3785781d9f75e73fd3f14f0b2be1a583f574fa"},(0,c.kt)("inlineCode",{parentName:"a"},"fa37857")))),(0,c.kt)("h4",{id:"v2150"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.16...v2.15.0"},"v2.15.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"14 August 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Array sort ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/603"},(0,c.kt)("inlineCode",{parentName:"a"},"#603"))),(0,c.kt)("li",{parentName:"ul"},"allow sending events from DS; fixes #373 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/373"},(0,c.kt)("inlineCode",{parentName:"a"},"#373"))),(0,c.kt)("li",{parentName:"ul"},"update add-board docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7d4ae148bf494a139682ef2ba5ce12df40a1a6a3"},(0,c.kt)("inlineCode",{parentName:"a"},"7d4ae14")))),(0,c.kt)("h4",{id:"v21416"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.15...v2.14.16"},"v2.14.16")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 August 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"set prototype in JSON.parse; fixes #578 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/578"},(0,c.kt)("inlineCode",{parentName:"a"},"#578"))),(0,c.kt)("li",{parentName:"ul"},"fix #536: tree-shaking of devsNative protos ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/536"},(0,c.kt)("inlineCode",{parentName:"a"},"#536"))),(0,c.kt)("li",{parentName:"ul"},"Add Buffer.rotate; see #596 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d4d6bd1a63a6a7c54acb4c25241d73075cb1fd01"},(0,c.kt)("inlineCode",{parentName:"a"},"d4d6bd1"))),(0,c.kt)("li",{parentName:"ul"},"document led hw support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a7262f03c4261e6790f4ebafa9b076ab65ec6789"},(0,c.kt)("inlineCode",{parentName:"a"},"a7262f0"))),(0,c.kt)("li",{parentName:"ul"},"no led show on simulator ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/960c0d7861b7f732ba450e3828b7d8f372782e6b"},(0,c.kt)("inlineCode",{parentName:"a"},"960c0d7")))),(0,c.kt)("h4",{id:"v21415"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.14...v2.14.15"},"v2.14.15")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 August 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"show Leds on hardware ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/cf4a0e374d6dc034f9d30596972b17ac1edc02ed"},(0,c.kt)("inlineCode",{parentName:"a"},"cf4a0e3"))),(0,c.kt)("li",{parentName:"ul"},"fix samples and silly crash ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c29a06cb12e8b36caffa26d7ee9c561df6de094d"},(0,c.kt)("inlineCode",{parentName:"a"},"c29a06c"))),(0,c.kt)("li",{parentName:"ul"},"add ledStripSend; v2.14.15 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/785314d1b4ec2e558ad500a97398deb8cf08f863"},(0,c.kt)("inlineCode",{parentName:"a"},"785314d")))),(0,c.kt)("h4",{id:"v21414"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.13...v2.14.14"},"v2.14.14")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"5 August 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Document/implement LED operations ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/595"},(0,c.kt)("inlineCode",{parentName:"a"},"#595"))),(0,c.kt)("li",{parentName:"ul"},"better connect dialog for remote scenario ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ba05db13c5505afb8663bcd65bfa8a4179e7d918"},(0,c.kt)("inlineCode",{parentName:"a"},"ba05db1"))),(0,c.kt)("li",{parentName:"ul"},"hide gateway by default ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/09ab30b899dd037eda6e296b30928d0fefd6b60b"},(0,c.kt)("inlineCode",{parentName:"a"},"09ab30b"))),(0,c.kt)("li",{parentName:"ul"},"add info link to nvm ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c816704ea0007abf98aa45710d971e7fb2794548"},(0,c.kt)("inlineCode",{parentName:"a"},"c816704")))),(0,c.kt)("h4",{id:"v21413"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.12...v2.14.13"},"v2.14.13")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix for #591 (attempt) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e4e22370e5f3e524c3cfc10c9a9aa0b2f85098d3"},(0,c.kt)("inlineCode",{parentName:"a"},"e4e2237"))),(0,c.kt)("li",{parentName:"ul"},"adding more images ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/87307b6171cd1db5453ed7ba8a413803a299c982"},(0,c.kt)("inlineCode",{parentName:"a"},"87307b6")))),(0,c.kt)("h4",{id:"v21412"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.11...v2.14.12"},"v2.14.12")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Remote connect ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/589"},(0,c.kt)("inlineCode",{parentName:"a"},"#589"))),(0,c.kt)("li",{parentName:"ul"},"typo in contributing file name ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f2656dac1579586a23ea51baddd115053c1e35ca"},(0,c.kt)("inlineCode",{parentName:"a"},"f2656da")))),(0,c.kt)("h4",{id:"v21411"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.10...v2.14.11"},"v2.14.11")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix for ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/588"},"https://github.com/microsoft/devicescript/issues/588")," ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ba80cc269609697c3599e2ff9c79fbbe86476909"},(0,c.kt)("inlineCode",{parentName:"a"},"ba80cc2")))),(0,c.kt)("h4",{id:"v21410"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.9...v2.14.10"},"v2.14.10")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"better handling of running init on an existing project ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f368b0f5cc4ea8bf3c837096e0c466f0256e61cb"},(0,c.kt)("inlineCode",{parentName:"a"},"f368b0f"))),(0,c.kt)("li",{parentName:"ul"},"detect yarn.lock/package.lock when initiaizing existing project ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a91f43840f23856cafa8326911bff6324df48ccb"},(0,c.kt)("inlineCode",{parentName:"a"},"a91f438"))),(0,c.kt)("li",{parentName:"ul"},'rename "add settings..." to "add device settings..." ',(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5ae40720067612f33e6ec7c9728a30b6e817a703"},(0,c.kt)("inlineCode",{parentName:"a"},"5ae4072")))),(0,c.kt)("h4",{id:"v2149"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.8...v2.14.9"},"v2.14.9")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"24 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"support for LED driver + simulation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/580"},(0,c.kt)("inlineCode",{parentName:"a"},"#580"))),(0,c.kt)("li",{parentName:"ul"},"deprecated Math.clamp in favor of constrain ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0e2ee131bbf5c1babe285e5e2e7a11244568c5b0"},(0,c.kt)("inlineCode",{parentName:"a"},"0e2ee13"))),(0,c.kt)("li",{parentName:"ul"},"fix gpiorelay sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/621c7792e384ae6934002db93f6db890f4c6e5e8"},(0,c.kt)("inlineCode",{parentName:"a"},"621c779"))),(0,c.kt)("li",{parentName:"ul"},"ask for npm/yarn when creating new project ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b0e34d642d7c284672ea11f3229fb1f15f5f8f3e"},(0,c.kt)("inlineCode",{parentName:"a"},"b0e34d6")))),(0,c.kt)("h4",{id:"v2148"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.7...v2.14.8"},"v2.14.8")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"use server id in twin message ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/576"},(0,c.kt)("inlineCode",{parentName:"a"},"#576"))),(0,c.kt)("li",{parentName:"ul"},"updated jacdac-ts ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a87665fffc5584611e85889945bebc383e5fd91e"},(0,c.kt)("inlineCode",{parentName:"a"},"a87665f")))),(0,c.kt)("h4",{id:"v2147"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.6...v2.14.7"},"v2.14.7")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"traffic light server ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/574"},(0,c.kt)("inlineCode",{parentName:"a"},"#574"))),(0,c.kt)("li",{parentName:"ul"},"gamepad client apis ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/573"},(0,c.kt)("inlineCode",{parentName:"a"},"#573"))),(0,c.kt)("li",{parentName:"ul"},"more error handling on missing @devicescript/cli ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d6cf35577076b36b49856efce8d1249aae6feee5"},(0,c.kt)("inlineCode",{parentName:"a"},"d6cf355"))),(0,c.kt)("li",{parentName:"ul"},"ensure that @devicescript/cli is locally installed ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a3b15cd8177139d39d1c4ac1e94a0037c3d863c3"},(0,c.kt)("inlineCode",{parentName:"a"},"a3b15cd"))),(0,c.kt)("li",{parentName:"ul"},"traffic light sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2544de05e56455a0f7abd3252adb1a994a6d1920"},(0,c.kt)("inlineCode",{parentName:"a"},"2544de0")))),(0,c.kt)("h4",{id:"v2146"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.5...v2.14.6"},"v2.14.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"better error messages on missing node ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/941084f4ad58e701bbad6dfdf4a166eff6d66a60"},(0,c.kt)("inlineCode",{parentName:"a"},"941084f"))),(0,c.kt)("li",{parentName:"ul"},"updated pico_w samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8368737ff2a70f7cfdf602fdb1ae21672ca43c19"},(0,c.kt)("inlineCode",{parentName:"a"},"8368737"))),(0,c.kt)("li",{parentName:"ul"},"support for large frames over tcp ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3cebccbb00386e96a7de3d53a23330e3ec77e3c4"},(0,c.kt)("inlineCode",{parentName:"a"},"3cebccb")))),(0,c.kt)("h4",{id:"v2145"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.4...v2.14.5"},"v2.14.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"setup gh action for yarn if detected ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/076418b7469bf16f41c5f628e0d32c0010cdd4ba"},(0,c.kt)("inlineCode",{parentName:"a"},"076418b"))),(0,c.kt)("li",{parentName:"ul"},"link pico-lcd pkg ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a9d46ce305739dfc539d2e2d49efc03a462050c1"},(0,c.kt)("inlineCode",{parentName:"a"},"a9d46ce")))),(0,c.kt)("h4",{id:"v2144"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.3...v2.14.4"},"v2.14.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add UC8151 docs; fixes #543 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/543"},(0,c.kt)("inlineCode",{parentName:"a"},"#543"))),(0,c.kt)("li",{parentName:"ul"},"document other ST* drivers; fixes #552 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/552"},(0,c.kt)("inlineCode",{parentName:"a"},"#552"))),(0,c.kt)("li",{parentName:"ul"},"add devs init --yarn; fixes for devs add npm ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/dd75d94e3586ccb41741ca4a586ad87f7ef55a3e"},(0,c.kt)("inlineCode",{parentName:"a"},"dd75d94"))),(0,c.kt)("li",{parentName:"ul"},"updated shield info ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3fdb86db5a05ea025aa575e23f85c2169e8607cb"},(0,c.kt)("inlineCode",{parentName:"a"},"3fdb86d"))),(0,c.kt)("li",{parentName:"ul"},"more info on shields ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/de363e843552e75e1d1aaf9a5d8976ff8a9d9624"},(0,c.kt)("inlineCode",{parentName:"a"},"de363e8")))),(0,c.kt)("h4",{id:"v2143"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.2...v2.14.3"},"v2.14.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Server to drivers, Display documentation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/566"},(0,c.kt)("inlineCode",{parentName:"a"},"#566"))),(0,c.kt)("li",{parentName:"ul"},"Indexed screen support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/564"},(0,c.kt)("inlineCode",{parentName:"a"},"#564"))),(0,c.kt)("li",{parentName:"ul"},"sample TSX UI ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/547"},(0,c.kt)("inlineCode",{parentName:"a"},"#547"))),(0,c.kt)("li",{parentName:"ul"},"add st7709 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/05e88868cce6e503e95a5a18e97ef9d7cbad4e4f"},(0,c.kt)("inlineCode",{parentName:"a"},"05e8886"))),(0,c.kt)("li",{parentName:"ul"},"updated ssd1306 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8140a775233f0202fb659b12cb5874d1d13bda5c"},(0,c.kt)("inlineCode",{parentName:"a"},"8140a77"))),(0,c.kt)("li",{parentName:"ul"},"reference help when inserting board configs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8cd1019828556c66ba4f3c41b78f902aea74a822"},(0,c.kt)("inlineCode",{parentName:"a"},"8cd1019")))),(0,c.kt)("h4",{id:"v2142"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.1...v2.14.2"},"v2.14.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"16 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add command to upgrade tools ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/562"},(0,c.kt)("inlineCode",{parentName:"a"},"#562"))),(0,c.kt)("li",{parentName:"ul"},"project init (create new project) with board ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/561"},(0,c.kt)("inlineCode",{parentName:"a"},"#561")))),(0,c.kt)("h4",{id:"v2141"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.14.0...v2.14.1"},"v2.14.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"16 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"more docs on i2c issues ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/560"},(0,c.kt)("inlineCode",{parentName:"a"},"#560"))),(0,c.kt)("li",{parentName:"ul"},"added encodeURIComponent function interface and tests ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/558"},(0,c.kt)("inlineCode",{parentName:"a"},"#558"))),(0,c.kt)("li",{parentName:"ul"},"Implement es Set class #496 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/556"},(0,c.kt)("inlineCode",{parentName:"a"},"#556"))),(0,c.kt)("li",{parentName:"ul"},"Implement es Map class #497 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/538"},(0,c.kt)("inlineCode",{parentName:"a"},"#538"))),(0,c.kt)("li",{parentName:"ul"},"led strip encoder ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/557"},(0,c.kt)("inlineCode",{parentName:"a"},"#557"))),(0,c.kt)("li",{parentName:"ul"},"Sample weather display #525 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/555"},(0,c.kt)("inlineCode",{parentName:"a"},"#555"))),(0,c.kt)("li",{parentName:"ul"},"Added findLastIndex ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/550"},(0,c.kt)("inlineCode",{parentName:"a"},"#550"))),(0,c.kt)("li",{parentName:"ul"},"button led / potentiometer led samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/541"},(0,c.kt)("inlineCode",{parentName:"a"},"#541"))),(0,c.kt)("li",{parentName:"ul"},"array findLast ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/549"},(0,c.kt)("inlineCode",{parentName:"a"},"#549"))),(0,c.kt)("li",{parentName:"ul"},"added array fill ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/548"},(0,c.kt)("inlineCode",{parentName:"a"},"#548"))),(0,c.kt)("li",{parentName:"ul"},"value dashboard rendering ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/540"},(0,c.kt)("inlineCode",{parentName:"a"},"#540"))),(0,c.kt)("li",{parentName:"ul"},"Organize servers docs into drivers ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/546"},(0,c.kt)("inlineCode",{parentName:"a"},"#546"))),(0,c.kt)("li",{parentName:"ul"},"reduce deps of cli (200M-",">","38M) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/531"},(0,c.kt)("inlineCode",{parentName:"a"},"#531"))),(0,c.kt)("li",{parentName:"ul"},"support for typedoc ready projects ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/545"},(0,c.kt)("inlineCode",{parentName:"a"},"#545"))),(0,c.kt)("li",{parentName:"ul"},"Support for JSX/TSX ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/542"},(0,c.kt)("inlineCode",{parentName:"a"},"#542"))),(0,c.kt)("li",{parentName:"ul"},"added add-board docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8644ddd78f1a8a13aec82fa6abf0fdbb8028c870"},(0,c.kt)("inlineCode",{parentName:"a"},"8644ddd"))),(0,c.kt)("li",{parentName:"ul"},"add docs on adding new SoCs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/169f37b513d4a4176c0427fb457ec807f8f5c3b4"},(0,c.kt)("inlineCode",{parentName:"a"},"169f37b"))),(0,c.kt)("li",{parentName:"ul"},"updated admonitions ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/250328dfa914ea01c1346de4703bfacd6af7a4e8"},(0,c.kt)("inlineCode",{parentName:"a"},"250328d")))),(0,c.kt)("h4",{id:"v2140"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.10...v2.14.0"},"v2.14.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"5 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix duplicate role tree node warning ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/539"},(0,c.kt)("inlineCode",{parentName:"a"},"#539"))),(0,c.kt)("li",{parentName:"ul"},"add schemas for board defs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2ebe4e753db44aba43f6734bdf0865b7a2fae332"},(0,c.kt)("inlineCode",{parentName:"a"},"2ebe4e7"))),(0,c.kt)("li",{parentName:"ul"},"re-work pin names ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f094f29b4752c51a957db586f217dcbcb4f1a907"},(0,c.kt)("inlineCode",{parentName:"a"},"f094f29"))),(0,c.kt)("li",{parentName:"ul"},"add support for UC8151 e-ink display ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d4bdc0b97a488f45586ef6e35b4164231bc38a63"},(0,c.kt)("inlineCode",{parentName:"a"},"d4bdc0b")))),(0,c.kt)("h4",{id:"v21310"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.9...v2.13.10"},"v2.13.10")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add support for ST7789 screen ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f9292eff96bb7a8a93254018288485797f87f594"},(0,c.kt)("inlineCode",{parentName:"a"},"f9292ef"))),(0,c.kt)("li",{parentName:"ul"},"add support for ?? operator ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b03d062b4241073bc29d45a9ced026774b7b356d"},(0,c.kt)("inlineCode",{parentName:"a"},"b03d062"))),(0,c.kt)("li",{parentName:"ul"},"allow comments in hex literals ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ef179c26210bd84550d93000116be142b9b9d001"},(0,c.kt)("inlineCode",{parentName:"a"},"ef179c2")))),(0,c.kt)("h4",{id:"v2139"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.8...v2.13.9"},"v2.13.9")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 July 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Fix typos in website API docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/522"},(0,c.kt)("inlineCode",{parentName:"a"},"#522"))),(0,c.kt)("li",{parentName:"ul"},"Fixing spelling in getting started ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/521"},(0,c.kt)("inlineCode",{parentName:"a"},"#521"))),(0,c.kt)("li",{parentName:"ul"},"added Array.at array package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/520"},(0,c.kt)("inlineCode",{parentName:"a"},"#520"))),(0,c.kt)("li",{parentName:"ul"},"added schedule blinky sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b142b1c82e57bab81fa97c8edc35a8967d1da582"},(0,c.kt)("inlineCode",{parentName:"a"},"b142b1c"))),(0,c.kt)("li",{parentName:"ul"},"added doubleblinky sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6a14ed9f3507d576973dc06e90d537bb5edeb577"},(0,c.kt)("inlineCode",{parentName:"a"},"6a14ed9"))),(0,c.kt)("li",{parentName:"ul"},"less aggressive about showing the simulator pane ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fcffd49fee2c31f192e0569d2838bf5d72b43998"},(0,c.kt)("inlineCode",{parentName:"a"},"fcffd49")))),(0,c.kt)("h4",{id:"v2138"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.7...v2.13.8"},"v2.13.8")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"30 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"MQTT updates ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/516"},(0,c.kt)("inlineCode",{parentName:"a"},"#516"))),(0,c.kt)("li",{parentName:"ul"},"mqtt: better handling of disconnection ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/851582a57b599ce5de23fb8cff51318de0cd925b"},(0,c.kt)("inlineCode",{parentName:"a"},"851582a"))),(0,c.kt)("li",{parentName:"ul"},"added mqtt sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c09018d1ac28df16b7069cc3f6c61b4c932ccf14"},(0,c.kt)("inlineCode",{parentName:"a"},"c09018d"))),(0,c.kt)("li",{parentName:"ul"},"more configuration options ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6685ff0bbedaf7b9ffef5a93777096e0a5b07483"},(0,c.kt)("inlineCode",{parentName:"a"},"6685ff0")))),(0,c.kt)("h4",{id:"v2137"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.6...v2.13.7"},"v2.13.7")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"MQTT ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/513"},(0,c.kt)("inlineCode",{parentName:"a"},"#513"))),(0,c.kt)("li",{parentName:"ul"},"Palette, display in graphics ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/511"},(0,c.kt)("inlineCode",{parentName:"a"},"#511"))),(0,c.kt)("li",{parentName:"ul"},"removing eventtarget ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/66fdd86202c86931a80dacb4bcd2e7f597498a50"},(0,c.kt)("inlineCode",{parentName:"a"},"66fdd86"))),(0,c.kt)("li",{parentName:"ul"},"add DOM-like EventTarget ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/dcb40e13fa081269c41d8e44c47d4a0cc44e9c6e"},(0,c.kt)("inlineCode",{parentName:"a"},"dcb40e1"))),(0,c.kt)("li",{parentName:"ul"},"add common events on socket type ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/56b4f2a0382c32371a5511281d849e6385281372"},(0,c.kt)("inlineCode",{parentName:"a"},"56b4f2a")))),(0,c.kt)("h4",{id:"v2136"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.5...v2.13.6"},"v2.13.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Node v16 minimal support (v18 not required) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/510"},(0,c.kt)("inlineCode",{parentName:"a"},"#510"))),(0,c.kt)("li",{parentName:"ul"},"support for switchMap in observables ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/508"},(0,c.kt)("inlineCode",{parentName:"a"},"#508"))),(0,c.kt)("li",{parentName:"ul"},"add thingspeak ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4cf9b54efa6878aade25ce9c30d547783b0e00c5"},(0,c.kt)("inlineCode",{parentName:"a"},"4cf9b54"))),(0,c.kt)("li",{parentName:"ul"},"missing awaits ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/64668d0e1286ddf74d16b8d6d684bc5baada5a8f"},(0,c.kt)("inlineCode",{parentName:"a"},"64668d0"))),(0,c.kt)("li",{parentName:"ul"},"add node.js diag ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8bdd1c6fb23339f8855b93fd62805c58897e1b65"},(0,c.kt)("inlineCode",{parentName:"a"},"8bdd1c6")))),(0,c.kt)("h4",{id:"v2135"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.3...v2.13.5"},"v2.13.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"25 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add for-in statement; fixes #500 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/500"},(0,c.kt)("inlineCode",{parentName:"a"},"#500"))),(0,c.kt)("li",{parentName:"ul"},"added blynk example ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/449a09e037c2e5e451b52ac52749e6aec391775e"},(0,c.kt)("inlineCode",{parentName:"a"},"449a09e"))),(0,c.kt)("li",{parentName:"ul"},"updated contributing ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fcbde777d11cdf3cef86d1d2e9faba78b6909ce7"},(0,c.kt)("inlineCode",{parentName:"a"},"fcbde77"))),(0,c.kt)("li",{parentName:"ul"},"more docs on packages ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9a5e463057cff88d81c381f7c01e319675cc0093"},(0,c.kt)("inlineCode",{parentName:"a"},"9a5e463")))),(0,c.kt)("h4",{id:"v2133"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.2...v2.13.3"},"v2.13.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"jd-c with startMotor(); fixes #461 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/461"},(0,c.kt)("inlineCode",{parentName:"a"},"#461"))),(0,c.kt)("li",{parentName:"ul"},"add additional array ctor, see #501 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9b1c21261489b1f6645a4064ecc588e6478d6dcc"},(0,c.kt)("inlineCode",{parentName:"a"},"9b1c212"))),(0,c.kt)("li",{parentName:"ul"},"add Object and Array ctors; see #501 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/731c85dab82844a6450fa4934f8a329913599b09"},(0,c.kt)("inlineCode",{parentName:"a"},"731c85d")))),(0,c.kt)("h4",{id:"v2132"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.1...v2.13.2"},"v2.13.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"more contrivuting to docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f191669fb457d7ebef6b0dce5230470f3bf3f2b3"},(0,c.kt)("inlineCode",{parentName:"a"},"f191669"))),(0,c.kt)("li",{parentName:"ul"},"reorg contributions page ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/63ade1db678fda30cd356e17695d722f6dc57f18"},(0,c.kt)("inlineCode",{parentName:"a"},"63ade1d"))),(0,c.kt)("li",{parentName:"ul"},"don't use GPIO0 as TX by default on pico ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e74b6c1c7863fe01625b2eee1b2780aa77c4705b"},(0,c.kt)("inlineCode",{parentName:"a"},"e74b6c1")))),(0,c.kt)("h4",{id:"v2131"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.13.0...v2.13.1"},"v2.13.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"allow arbitrary config in configureHardware(); fixes #473 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/473"},(0,c.kt)("inlineCode",{parentName:"a"},"#473"))),(0,c.kt)("li",{parentName:"ul"},"add memory docs; fixes #397 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/397"},(0,c.kt)("inlineCode",{parentName:"a"},"#397"))),(0,c.kt)("li",{parentName:"ul"},"remove _ from role names; fixes #389 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/389"},(0,c.kt)("inlineCode",{parentName:"a"},"#389"))),(0,c.kt)("li",{parentName:"ul"},"add docs on services vs $services; fixes #459 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/459"},(0,c.kt)("inlineCode",{parentName:"a"},"#459"))),(0,c.kt)("li",{parentName:"ul"},"add docs for ",(0,c.kt)("inlineCode",{parentName:"li"},"devs bundle"),"; fixes #495 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/495"},(0,c.kt)("inlineCode",{parentName:"a"},"#495"))),(0,c.kt)("li",{parentName:"ul"},"add devkitM S3 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b6782cb61ea2fde285c5ed7c732bf04176a5f3ac"},(0,c.kt)("inlineCode",{parentName:"a"},"b6782cb"))),(0,c.kt)("li",{parentName:"ul"},"use HKDF in encryptedFetch() ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4ca8550a2148f0dc84f46ada32bf727236e1a181"},(0,c.kt)("inlineCode",{parentName:"a"},"4ca8550"))),(0,c.kt)("li",{parentName:"ul"},"picture for devkitM ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5ba81f0ac3142b52046228abc0c2e8c7cef5dfa9"},(0,c.kt)("inlineCode",{parentName:"a"},"5ba81f0")))),(0,c.kt)("h4",{id:"v2130"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.12.3...v2.13.0"},"v2.13.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"22 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add 'devs bundle' command ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/de9532d0cf68a5d4a76b58f118e65159ff3d8be0"},(0,c.kt)("inlineCode",{parentName:"a"},"de9532d"))),(0,c.kt)("li",{parentName:"ul"},"update board definitions ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ba705d3f0455d0357a2cd5c6a77b93a187cd3870"},(0,c.kt)("inlineCode",{parentName:"a"},"ba705d3"))),(0,c.kt)("li",{parentName:"ul"},"add encryptedFetch() ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/714f0eda364a5acdc0b994c28ac10c3cc9332526"},(0,c.kt)("inlineCode",{parentName:"a"},"714f0ed")))),(0,c.kt)("h4",{id:"v2123"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.12.2...v2.12.3"},"v2.12.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"allow hex encoding in Buffer.from(); 2.12.3 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5c2a4d8d52e98057bec4f5d6782937bf96be285a"},(0,c.kt)("inlineCode",{parentName:"a"},"5c2a4d8")))),(0,c.kt)("h4",{id:"v2122"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.12.1...v2.12.2"},"v2.12.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Node version detect ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/493"},(0,c.kt)("inlineCode",{parentName:"a"},"#493"))),(0,c.kt)("li",{parentName:"ul"},"add readme linking to proper docs; fixes #476 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/476"},(0,c.kt)("inlineCode",{parentName:"a"},"#476"))),(0,c.kt)("li",{parentName:"ul"},"add @devicescript/crypto ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4e07577c5d97c2a24e25e8df4e5d5cc201b224a5"},(0,c.kt)("inlineCode",{parentName:"a"},"4e07577"))),(0,c.kt)("li",{parentName:"ul"},"allow for arbitrary tag size in AES CCM ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ee8a6880ae113407e465f2625a35beaac704d64c"},(0,c.kt)("inlineCode",{parentName:"a"},"ee8a688")))),(0,c.kt)("h4",{id:"v2121"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.12.0...v2.12.1"},"v2.12.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add Image.buffer property ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7c520f61a8fda3bf797a2b747bfe5461959f12f3"},(0,c.kt)("inlineCode",{parentName:"a"},"7c520f6")))),(0,c.kt)("h4",{id:"v2120"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.6...v2.12.0"},"v2.12.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"20 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"native GPIO, SPI image send, and ST7735 screens support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/490"},(0,c.kt)("inlineCode",{parentName:"a"},"#490"))),(0,c.kt)("li",{parentName:"ul"},"fix port parsing ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/491"},(0,c.kt)("inlineCode",{parentName:"a"},"#491"))),(0,c.kt)("li",{parentName:"ul"},"Misc word/grammar fixes to index.mdx ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/483"},(0,c.kt)("inlineCode",{parentName:"a"},"#483"))),(0,c.kt)("li",{parentName:"ul"},"Dotmatrix over image implementation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/480"},(0,c.kt)("inlineCode",{parentName:"a"},"#480"))),(0,c.kt)("li",{parentName:"ul"},"ImageRenderingContext ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/478"},(0,c.kt)("inlineCode",{parentName:"a"},"#478"))),(0,c.kt)("li",{parentName:"ul"},"math.map helper class ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/477"},(0,c.kt)("inlineCode",{parentName:"a"},"#477"))),(0,c.kt)("li",{parentName:"ul"},"doc reorg ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ce12d80a4d8119e117c884ec00897ca239c9d586"},(0,c.kt)("inlineCode",{parentName:"a"},"ce12d80"))),(0,c.kt)("li",{parentName:"ul"},"docs update ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5ad5a930f205033c626875b6263c980ef5c753b0"},(0,c.kt)("inlineCode",{parentName:"a"},"5ad5a93"))),(0,c.kt)("li",{parentName:"ul"},"introduce common Display interface ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e6a6115e3051b6aff01263c3ec137fb2c97b0301"},(0,c.kt)("inlineCode",{parentName:"a"},"e6a6115")))),(0,c.kt)("h4",{id:"v2116"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.5...v2.11.6"},"v2.11.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"10 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"String.split support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/463"},(0,c.kt)("inlineCode",{parentName:"a"},"#463"))),(0,c.kt)("li",{parentName:"ul"},"character screen server ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/462"},(0,c.kt)("inlineCode",{parentName:"a"},"#462"))),(0,c.kt)("li",{parentName:"ul"},"blynk HTTP support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/475"},(0,c.kt)("inlineCode",{parentName:"a"},"#475"))),(0,c.kt)("li",{parentName:"ul"},"added socket example, use same api as node ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/470"},(0,c.kt)("inlineCode",{parentName:"a"},"#470"))),(0,c.kt)("li",{parentName:"ul"},"more runtime docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/55e8f993441fd36e818fcd790e4814a3488d8243"},(0,c.kt)("inlineCode",{parentName:"a"},"55e8f99"))),(0,c.kt)("li",{parentName:"ul"},"use singleton for spi to match i2c ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fcae930d59308ff84b971183a2aa0e681a03a9f6"},(0,c.kt)("inlineCode",{parentName:"a"},"fcae930"))),(0,c.kt)("li",{parentName:"ul"},"add devcontainer to project template ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6bb6e9ca0bc81fd68b1faad1e036734ce76bef2c"},(0,c.kt)("inlineCode",{parentName:"a"},"6bb6e9c")))),(0,c.kt)("h4",{id:"v2115"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.4...v2.11.5"},"v2.11.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"9 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"refactoring iot docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/469"},(0,c.kt)("inlineCode",{parentName:"a"},"#469"))),(0,c.kt)("li",{parentName:"ul"},"remove professional from docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/467"},(0,c.kt)("inlineCode",{parentName:"a"},"#467"))),(0,c.kt)("li",{parentName:"ul"},"fix #466 I2C bug; 2.11.5 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/466"},(0,c.kt)("inlineCode",{parentName:"a"},"#466"))),(0,c.kt)("li",{parentName:"ul"},"Fix SPI mention ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/919ce817889b5579da8589e28cd9e9e52fdf6672"},(0,c.kt)("inlineCode",{parentName:"a"},"919ce81")))),(0,c.kt)("h4",{id:"v2114"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.3...v2.11.4"},"v2.11.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"9 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix typo; thank you Benjamin_Dobell ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a59e8aafce2b66c602c60bc82bb1bfd23298e5db"},(0,c.kt)("inlineCode",{parentName:"a"},"a59e8aa"))),(0,c.kt)("li",{parentName:"ul"},"handle syntactic difference of npm ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/cb4533ecc1b65f365efa627da77de2291b17b71b"},(0,c.kt)("inlineCode",{parentName:"a"},"cb4533e")))),(0,c.kt)("h4",{id:"v2113"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.2...v2.11.3"},"v2.11.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"9 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"added shtc3 example ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/314dcb691a2ff1fb8e74ef842287b9468506f515"},(0,c.kt)("inlineCode",{parentName:"a"},"314dcb6"))),(0,c.kt)("li",{parentName:"ul"},"fix deadlock when upgrading cli tools ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/32fe8adb462e31a39c422cdea5701e11528a0e59"},(0,c.kt)("inlineCode",{parentName:"a"},"32fe8ad"))),(0,c.kt)("li",{parentName:"ul"},"add bytecode to docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0881e6d1687eaa472cbe0d5754e00b52bf129216"},(0,c.kt)("inlineCode",{parentName:"a"},"0881e6d")))),(0,c.kt)("h4",{id:"v2112"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.1...v2.11.2"},"v2.11.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"9 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix issue with npm upgrade detection ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9312277490d75408c4da5de97f7bf394756618c2"},(0,c.kt)("inlineCode",{parentName:"a"},"9312277"))),(0,c.kt)("li",{parentName:"ul"},"docs about adding boards ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/30234ae255174443a62e27c26f331fbd4c26fad1"},(0,c.kt)("inlineCode",{parentName:"a"},"30234ae"))),(0,c.kt)("li",{parentName:"ul"},"Update README.md ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/439463a54b7c01f52d1c5be20bf58bf3ba35b235"},(0,c.kt)("inlineCode",{parentName:"a"},"439463a")))),(0,c.kt)("h4",{id:"v2111"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.11.0...v2.11.1"},"v2.11.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"8 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"added blues docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/55a0526d3ac8c36baaff41b25bc843ac7c4aa0a0"},(0,c.kt)("inlineCode",{parentName:"a"},"55a0526"))),(0,c.kt)("li",{parentName:"ul"},"skip blues sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a0650adcd792750bcbe7116265b23f952f13c6c5"},(0,c.kt)("inlineCode",{parentName:"a"},"a0650ad")))),(0,c.kt)("h4",{id:"v2110"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.10...v2.11.0"},"v2.11.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"8 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add built-in Image type ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/423"},(0,c.kt)("inlineCode",{parentName:"a"},"#423"))),(0,c.kt)("li",{parentName:"ul"},"Wifi settings ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/457"},(0,c.kt)("inlineCode",{parentName:"a"},"#457"))),(0,c.kt)("li",{parentName:"ul"},"mcuTemperature API + docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/454"},(0,c.kt)("inlineCode",{parentName:"a"},"#454"))),(0,c.kt)("li",{parentName:"ul"},"add adafruit.io example ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/bea432d7c228bb4e67a34fa7a959113989e3bcc4"},(0,c.kt)("inlineCode",{parentName:"a"},"bea432d"))),(0,c.kt)("li",{parentName:"ul"},"updated build status sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c11926c438dc2ca2a0a887b99d6507e2180c6ae6"},(0,c.kt)("inlineCode",{parentName:"a"},"c11926c"))),(0,c.kt)("li",{parentName:"ul"},"more samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4ed8968f9b693ba025f9fdaa05a5c107ea72f049"},(0,c.kt)("inlineCode",{parentName:"a"},"4ed8968")))),(0,c.kt)("h4",{id:"v21010"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.9...v2.10.10"},"v2.10.10")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"8 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Minor Style fixes no section 5. ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/453"},(0,c.kt)("inlineCode",{parentName:"a"},"#453"))),(0,c.kt)("li",{parentName:"ul"},"updated docs on custom packages ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/83f1bad5f62a9a43280d18035a5141d8d0580e6b"},(0,c.kt)("inlineCode",{parentName:"a"},"83f1bad"))),(0,c.kt)("li",{parentName:"ul"},"stabler serial connection ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0d33b15d80a6e7d0167691707856147f144d05cc"},(0,c.kt)("inlineCode",{parentName:"a"},"0d33b15"))),(0,c.kt)("li",{parentName:"ul"},"add github action file for npm package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/bec68bea45b9f7fdfdd5a9089c59dd453fda212e"},(0,c.kt)("inlineCode",{parentName:"a"},"bec68be")))),(0,c.kt)("h4",{id:"v2109"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.8...v2.10.9"},"v2.10.9")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"7 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"disable auto-start when connected with vscode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/451"},(0,c.kt)("inlineCode",{parentName:"a"},"#451"))),(0,c.kt)("li",{parentName:"ul"},"updated error generation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/611ab5c6b192c3e9be1c314ddfa68964d2ae5090"},(0,c.kt)("inlineCode",{parentName:"a"},"611ab5c"))),(0,c.kt)("li",{parentName:"ul"},"keep GC heap around ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a7f9948463388c99345ac0d13f44481c968859ba"},(0,c.kt)("inlineCode",{parentName:"a"},"a7f9948"))),(0,c.kt)("li",{parentName:"ul"},"add special ds._panic(0xab04711) for low-level panic ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a53ea323cd5527874a4acfdf1436fd0382a68589"},(0,c.kt)("inlineCode",{parentName:"a"},"a53ea32")))),(0,c.kt)("h4",{id:"v2108"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.7...v2.10.8"},"v2.10.8")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"7 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"adding error infrastructure ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/21905013dd1fdb74b84ce40d99f07b002a670941"},(0,c.kt)("inlineCode",{parentName:"a"},"2190501"))),(0,c.kt)("li",{parentName:"ul"},"trap long settings at compile time ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4e3b71094c1ba89556b1f8867dce90e0a32570ba"},(0,c.kt)("inlineCode",{parentName:"a"},"4e3b710"))),(0,c.kt)("li",{parentName:"ul"},"more logging ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b4c77aa90bb319a82b357805ebedb38c5ad457f5"},(0,c.kt)("inlineCode",{parentName:"a"},"b4c77aa")))),(0,c.kt)("h4",{id:"v2107"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.6...v2.10.7"},"v2.10.7")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"7 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"stop simulator when physical device connects ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5911164ba4ebceba3c320f3ce517cc2d52ab41cf"},(0,c.kt)("inlineCode",{parentName:"a"},"5911164")))),(0,c.kt)("h4",{id:"v2106"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.5...v2.10.6"},"v2.10.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"7 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"don't use yarn ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/443"},(0,c.kt)("inlineCode",{parentName:"a"},"#443"))),(0,c.kt)("li",{parentName:"ul"},"adding worksho info ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d7f0539be064afcf3f908c962bb361cbe70b1e3f"},(0,c.kt)("inlineCode",{parentName:"a"},"d7f0539"))),(0,c.kt)("li",{parentName:"ul"},"updated workshop info ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/be75cdb8df454dc811724d186a61a58fb52452e6"},(0,c.kt)("inlineCode",{parentName:"a"},"be75cdb"))),(0,c.kt)("li",{parentName:"ul"},"update buzzer docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0113838efc041ea694c76b34a97d70f8491b6e92"},(0,c.kt)("inlineCode",{parentName:"a"},"0113838")))),(0,c.kt)("h4",{id:"v2105"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.4...v2.10.5"},"v2.10.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"6 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"throttle outgoing packets (50/s) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6a3a631b61f6fd9bf7cb09a216fb556440467e06"},(0,c.kt)("inlineCode",{parentName:"a"},"6a3a631"))),(0,c.kt)("li",{parentName:"ul"},"tweak GC trigger heuristic ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f9ba2cf7198337e954d40d93a66a83cac9031bda"},(0,c.kt)("inlineCode",{parentName:"a"},"f9ba2cf"))),(0,c.kt)("li",{parentName:"ul"},"simplify gc trigger logic ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/00b0b21b2dea0cf1d969d85d40970a11d70c61fe"},(0,c.kt)("inlineCode",{parentName:"a"},"00b0b21")))),(0,c.kt)("h4",{id:"v2104"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.3...v2.10.4"},"v2.10.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"6 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add clean option in UI ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ad1f4a19c50cac0d6826b787a3d0f78d39089c7f"},(0,c.kt)("inlineCode",{parentName:"a"},"ad1f4a1"))),(0,c.kt)("li",{parentName:"ul"},"better error reporting ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/48c00b687a3b72abfa2860f8d5b25d57d08d069c"},(0,c.kt)("inlineCode",{parentName:"a"},"48c00b6"))),(0,c.kt)("li",{parentName:"ul"},"revert clean option ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ffcf1895a025f9b033c9689ac87a80cec68910da"},(0,c.kt)("inlineCode",{parentName:"a"},"ffcf189")))),(0,c.kt)("h4",{id:"v2103"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.2...v2.10.3"},"v2.10.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"6 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"use python extension to resolve python path ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0e859405b080cae3b62147f775e8a1a4833b3b3f"},(0,c.kt)("inlineCode",{parentName:"a"},"0e85940"))),(0,c.kt)("li",{parentName:"ul"},"adding schedule function ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/98ed6473c4bee6e996288d285a530562ca593bd5"},(0,c.kt)("inlineCode",{parentName:"a"},"98ed647"))),(0,c.kt)("li",{parentName:"ul"},"collect version number when reporting issue ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/354b272d7e49580a0d36de6b44b117393ea3b6d4"},(0,c.kt)("inlineCode",{parentName:"a"},"354b272")))),(0,c.kt)("h4",{id:"v2102"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.1...v2.10.2"},"v2.10.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"6 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add 'devs flash --clean ...' ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c94fb7963d376377e6b0f233fffd35c52236fb1f"},(0,c.kt)("inlineCode",{parentName:"a"},"c94fb79"))),(0,c.kt)("li",{parentName:"ul"},"updated github build sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b4b9f001d8f3fd78f9caaa74a6ccfc7029146e11"},(0,c.kt)("inlineCode",{parentName:"a"},"b4b9f00"))),(0,c.kt)("li",{parentName:"ul"},"unicode trim(); info on ASCII toLowerCase() ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f337581b40994adceb2ce9c496ca26c1dd6e7d38"},(0,c.kt)("inlineCode",{parentName:"a"},"f337581")))),(0,c.kt)("h4",{id:"v2101"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.10.0...v2.10.1"},"v2.10.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"5 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"auto install esptool on flash ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/437"},(0,c.kt)("inlineCode",{parentName:"a"},"#437"))),(0,c.kt)("li",{parentName:"ul"},"sample using fetch ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/435"},(0,c.kt)("inlineCode",{parentName:"a"},"#435"))),(0,c.kt)("li",{parentName:"ul"},"add option to add settings, tests in wand ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/436"},(0,c.kt)("inlineCode",{parentName:"a"},"#436"))),(0,c.kt)("li",{parentName:"ul"},"tcp/tls sockets for wasm ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/73b688ef36e8dfa80912a5074723bf6452799ec2"},(0,c.kt)("inlineCode",{parentName:"a"},"73b688e"))),(0,c.kt)("li",{parentName:"ul"},"add observable timestamp operator ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0f4bf6195f2fed6593ee28bec107f6a74ecaf59a"},(0,c.kt)("inlineCode",{parentName:"a"},"0f4bf61"))),(0,c.kt)("li",{parentName:"ul"},"more aggressive GC; 2.10.1 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fbefb8d851e77b3b5502e2546beaf6312cbf2d07"},(0,c.kt)("inlineCode",{parentName:"a"},"fbefb8d")))),(0,c.kt)("h4",{id:"v2100"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.16...v2.10.0"},"v2.10.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"5 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"2.10.0: add net.Socket, net.fetch and more String/Buffer methods ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/433"},(0,c.kt)("inlineCode",{parentName:"a"},"#433"))),(0,c.kt)("li",{parentName:"ul"},"Fix trivial typo in CLI docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/431"},(0,c.kt)("inlineCode",{parentName:"a"},"#431"))),(0,c.kt)("li",{parentName:"ul"},"ROS ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/430"},(0,c.kt)("inlineCode",{parentName:"a"},"#430"))),(0,c.kt)("li",{parentName:"ul"},"fix docs codegen for builtin packages ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/22c688d7545f7842f4ecfe27891c178d835b7315"},(0,c.kt)("inlineCode",{parentName:"a"},"22c688d"))),(0,c.kt)("li",{parentName:"ul"},"fix new gcc warning: int foo() -",">"," int foo(void) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/615e1ebdee4566e57ca30dbcd54b9c8f3474e7e6"},(0,c.kt)("inlineCode",{parentName:"a"},"615e1eb"))),(0,c.kt)("li",{parentName:"ul"},"remove it support in tests ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a8bb583fcfa22ef1b41d87d5d297b65d897947af"},(0,c.kt)("inlineCode",{parentName:"a"},"a8bb583")))),(0,c.kt)("h4",{id:"v2916"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.15...v2.9.16"},"v2.9.16")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"more docs on settings ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/46f16338aa34da4fa36e416328dd5e167a4272dc"},(0,c.kt)("inlineCode",{parentName:"a"},"46f1633"))),(0,c.kt)("li",{parentName:"ul"},"more docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/172645dd94286c8b2df860b698b89357c09669eb"},(0,c.kt)("inlineCode",{parentName:"a"},"172645d"))),(0,c.kt)("li",{parentName:"ul"},"add issue reporting ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5f57c621a2ef518ef1d9d4b586472a3775d006fc"},(0,c.kt)("inlineCode",{parentName:"a"},"5f57c62")))),(0,c.kt)("h4",{id:"v2915"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.14...v2.9.15"},"v2.9.15")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"barebone docs on spi ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0f568ac607e9364017e34eadab8fae321ac278fc"},(0,c.kt)("inlineCode",{parentName:"a"},"0f568ac"))),(0,c.kt)("li",{parentName:"ul"},"add note about network support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d5aac7525b7c3234665e503a697581f339a634f2"},(0,c.kt)("inlineCode",{parentName:"a"},"d5aac75"))),(0,c.kt)("li",{parentName:"ul"},"add settings clear menu item ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2188d0bc064faef5215b3434c8a741991f0809ad"},(0,c.kt)("inlineCode",{parentName:"a"},"2188d0b")))),(0,c.kt)("h4",{id:"v2914"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.13...v2.9.14"},"v2.9.14")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 June 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"support for .env file ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/426"},(0,c.kt)("inlineCode",{parentName:"a"},"#426"))),(0,c.kt)("li",{parentName:"ul"},"tsdoc attributes normalization ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/424"},(0,c.kt)("inlineCode",{parentName:"a"},"#424"))),(0,c.kt)("li",{parentName:"ul"},"docs: fix broken HomeBridge hyperlink ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/422"},(0,c.kt)("inlineCode",{parentName:"a"},"#422"))),(0,c.kt)("li",{parentName:"ul"},"Update index.mdx ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/417"},(0,c.kt)("inlineCode",{parentName:"a"},"#417"))),(0,c.kt)("li",{parentName:"ul"},"Typo fix in CONTRIBUTING.md ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/416"},(0,c.kt)("inlineCode",{parentName:"a"},"#416"))),(0,c.kt)("li",{parentName:"ul"},"Fix documentation typos ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/415"},(0,c.kt)("inlineCode",{parentName:"a"},"#415"))),(0,c.kt)("li",{parentName:"ul"},"allow @ds-when-used attributes; fixes #332 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/332"},(0,c.kt)("inlineCode",{parentName:"a"},"#332"))),(0,c.kt)("li",{parentName:"ul"},"updated docs about status light ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ecb7c7be5ab9c882e6194880e63d4ba60932fd06"},(0,c.kt)("inlineCode",{parentName:"a"},"ecb7c7b"))),(0,c.kt)("li",{parentName:"ul"},"Update issue templates ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/05fc469c3f8d25781a18f1b8e37ca24e9f95f43e"},(0,c.kt)("inlineCode",{parentName:"a"},"05fc469"))),(0,c.kt)("li",{parentName:"ul"},"Update issue templates ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/509ce4fc77a5fa88ca5773e47ba66911b84f8c1f"},(0,c.kt)("inlineCode",{parentName:"a"},"509ce4f")))),(0,c.kt)("h4",{id:"v2913"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.12...v2.9.13"},"v2.9.13")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"25 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"support for yarn 2.0 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/406"},(0,c.kt)("inlineCode",{parentName:"a"},"#406"))),(0,c.kt)("li",{parentName:"ul"},"Fix typo in events.md ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/399"},(0,c.kt)("inlineCode",{parentName:"a"},"#399"))),(0,c.kt)("li",{parentName:"ul"},"Fix typo in add-board.mdx ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/400"},(0,c.kt)("inlineCode",{parentName:"a"},"#400"))),(0,c.kt)("li",{parentName:"ul"},"Update json.mdx ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/398"},(0,c.kt)("inlineCode",{parentName:"a"},"#398"))),(0,c.kt)("li",{parentName:"ul"},"add csv history ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/48500b38d465a24996430f6e8a78c9151b4d9002"},(0,c.kt)("inlineCode",{parentName:"a"},"48500b3"))),(0,c.kt)("li",{parentName:"ul"},"simplify sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7ba4133371eef1be7985d72f304cebedacaae890"},(0,c.kt)("inlineCode",{parentName:"a"},"7ba4133"))),(0,c.kt)("li",{parentName:"ul"},"add @devicescript/spi module ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/05feaaf3ff42a5161b788fc461b421aa1f491b4c"},(0,c.kt)("inlineCode",{parentName:"a"},"05feaaf")))),(0,c.kt)("h4",{id:"v2912"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.11...v2.9.12"},"v2.9.12")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"18 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"more led runtime ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d49250b1bba6c3804f01988a091fdde6ceec7037"},(0,c.kt)("inlineCode",{parentName:"a"},"d49250b"))),(0,c.kt)("li",{parentName:"ul"},"allow address setting on BME680; defl to 0x76 (Seeed) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6f5594a8d9ee91d3394be06c175552538777fc62"},(0,c.kt)("inlineCode",{parentName:"a"},"6f5594a"))),(0,c.kt)("li",{parentName:"ul"},"updated gateway docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2168e56d166905dc0c6b7733e893611d2f50ef7f"},(0,c.kt)("inlineCode",{parentName:"a"},"2168e56")))),(0,c.kt)("h4",{id:"v2911"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.10...v2.9.11"},"v2.9.11")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"17 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"cleanup client commands ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/99bd7d89964a4ebd7c8ce6a2ce7d947f78a5f77c"},(0,c.kt)("inlineCode",{parentName:"a"},"99bd7d8"))),(0,c.kt)("li",{parentName:"ul"},"support F shortcut in all videos ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f923ab95d0b1cfaacbab17131b3ed0666874dfe2"},(0,c.kt)("inlineCode",{parentName:"a"},"f923ab9"))),(0,c.kt)("li",{parentName:"ul"},"support F key for full screen ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b23be3ed6f9dae0ebcab661a2f69ada725278415"},(0,c.kt)("inlineCode",{parentName:"a"},"b23be3e")))),(0,c.kt)("h4",{id:"v2910"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.9...v2.9.10"},"v2.9.10")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"15 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix crash in role mgr; bump jd-c ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3bb6e6300487668f24b72dce4166790babd1f5ee"},(0,c.kt)("inlineCode",{parentName:"a"},"3bb6e63"))),(0,c.kt)("li",{parentName:"ul"},"docs: statics supported ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3ef6df29ee3b4d21fa253bec2a373667c210c8dc"},(0,c.kt)("inlineCode",{parentName:"a"},"3ef6df2")))),(0,c.kt)("h4",{id:"v299"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.8...v2.9.9"},"v2.9.9")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"15 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"cleanout peripherical docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5f3340ad17a26ffde208ded7a11b4ce48b0bf572"},(0,c.kt)("inlineCode",{parentName:"a"},"5f3340a"))),(0,c.kt)("li",{parentName:"ul"},"updated role tree item ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/488fc110efa6593c8b1650f6112470c51ab2f20c"},(0,c.kt)("inlineCode",{parentName:"a"},"488fc11"))),(0,c.kt)("li",{parentName:"ul"},"add rolemanager pretty render ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4f4619894672e7c6960c895401d237068c0b9b1e"},(0,c.kt)("inlineCode",{parentName:"a"},"4f46198")))),(0,c.kt)("h4",{id:"v298"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.7...v2.9.8"},"v2.9.8")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"10 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"document, cleanup some i2c drivers ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f2c21a779a91f0528ec13889f80844b1e4153ce1"},(0,c.kt)("inlineCode",{parentName:"a"},"f2c21a7"))),(0,c.kt)("li",{parentName:"ul"},"add switch docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9ac76154312b26fbca9779abfc35952b9b77ffa2"},(0,c.kt)("inlineCode",{parentName:"a"},"9ac7615"))),(0,c.kt)("li",{parentName:"ul"},"use named imports in docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/dac34315726b91eb8209e3d5105a52e49ca216de"},(0,c.kt)("inlineCode",{parentName:"a"},"dac3431")))),(0,c.kt)("h4",{id:"v297"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.6...v2.9.7"},"v2.9.7")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"10 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"move rgb/hsl into runtime module ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/388"},(0,c.kt)("inlineCode",{parentName:"a"},"#388"))),(0,c.kt)("li",{parentName:"ul"},"a couple more color helpers ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5268c7f4895b84fd6644e332f062a7a2d0c35f91"},(0,c.kt)("inlineCode",{parentName:"a"},"5268c7f"))),(0,c.kt)("li",{parentName:"ul"},"add color buffer ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/11eb0da79b9456fee5db6ba2365f28a717390dbb"},(0,c.kt)("inlineCode",{parentName:"a"},"11eb0da"))),(0,c.kt)("li",{parentName:"ul"},"update docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fb192e7778f51c91c5fb9037bb568932634d2300"},(0,c.kt)("inlineCode",{parentName:"a"},"fb192e7")))),(0,c.kt)("h4",{id:"v296"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.5...v2.9.6"},"v2.9.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"9 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"updated docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/1f77b35cc9420a73391ed66b9f5ee59c40f20ee4"},(0,c.kt)("inlineCode",{parentName:"a"},"1f77b35"))),(0,c.kt)("li",{parentName:"ul"},"standby ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/603c81cf5299301bcb233465c1b326f52d8324fa"},(0,c.kt)("inlineCode",{parentName:"a"},"603c81c"))),(0,c.kt)("li",{parentName:"ul"},"fix snippets ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9374b2b1c6e1a97da8e65920f51ca75c2cec3779"},(0,c.kt)("inlineCode",{parentName:"a"},"9374b2b")))),(0,c.kt)("h4",{id:"v295"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.4...v2.9.5"},"v2.9.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"8 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"adding some led options ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/383"},(0,c.kt)("inlineCode",{parentName:"a"},"#383"))),(0,c.kt)("li",{parentName:"ul"},"generate server-info.json for DS drivers; fixes #381 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/381"},(0,c.kt)("inlineCode",{parentName:"a"},"#381"))),(0,c.kt)("li",{parentName:"ul"},"updated samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/76dcddad26701c0fc1035048fb416917c16b24af"},(0,c.kt)("inlineCode",{parentName:"a"},"76dcdda"))),(0,c.kt)("li",{parentName:"ul"},"search npm ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5b0c36022e6f32e3635d401b9ccdcd03d2736505"},(0,c.kt)("inlineCode",{parentName:"a"},"5b0c360"))),(0,c.kt)("li",{parentName:"ul"},"handle deploying to a device that is managed by a gateway ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6021672436e3111404d806f3276dfc08677063e2"},(0,c.kt)("inlineCode",{parentName:"a"},"6021672")))),(0,c.kt)("h4",{id:"v294"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.3...v2.9.4"},"v2.9.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"5 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add disconnect ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/34e810c7bf59d1b8349e3adf0c76f4720d6e1278"},(0,c.kt)("inlineCode",{parentName:"a"},"34e810c"))),(0,c.kt)("li",{parentName:"ul"},"handle missing data download ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/164d01d816eb344a147d8555487650fb8f74aa66"},(0,c.kt)("inlineCode",{parentName:"a"},"164d01d"))),(0,c.kt)("li",{parentName:"ul"},"updated mqtt docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/223330cc5f488f7531d1b916e5757d1c33c493cb"},(0,c.kt)("inlineCode",{parentName:"a"},"223330c")))),(0,c.kt)("h4",{id:"v293"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.2...v2.9.3"},"v2.9.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"4 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add wifi config info ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d9f3ccdae7716c2e25fe91eac313e8b8a5ccb15d"},(0,c.kt)("inlineCode",{parentName:"a"},"d9f3ccd"))),(0,c.kt)("li",{parentName:"ul"},"environment docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5e5b32f4e36233e4fd516deb057cfbdde9243ead"},(0,c.kt)("inlineCode",{parentName:"a"},"5e5b32f"))),(0,c.kt)("li",{parentName:"ul"},"more gateweay docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3a3efe1ee943c40dd44db7a5da8991820d86235f"},(0,c.kt)("inlineCode",{parentName:"a"},"3a3efe1")))),(0,c.kt)("h4",{id:"v292"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.1...v2.9.2"},"v2.9.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"3 May 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"support for TLS ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ce21748b3f343a5376e3d7e4e29a21e1ef0e2995"},(0,c.kt)("inlineCode",{parentName:"a"},"ce21748"))),(0,c.kt)("li",{parentName:"ul"},"uploadMessage -",">"," publishMessage ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4bc8e3a567395df20232d314a3045f28f53eddfd"},(0,c.kt)("inlineCode",{parentName:"a"},"4bc8e3a"))),(0,c.kt)("li",{parentName:"ul"},"surface mqtt info in tooltips ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/44418a7845ea76eb6aaee9ef91691bb6b27e76cc"},(0,c.kt)("inlineCode",{parentName:"a"},"44418a7")))),(0,c.kt)("h4",{id:"v291"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.9.0...v2.9.1"},"v2.9.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"refactor magic helpers ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/378"},(0,c.kt)("inlineCode",{parentName:"a"},"#378"))),(0,c.kt)("li",{parentName:"ul"},"hardwareConfig -",">"," configureHardware ? ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/375"},(0,c.kt)("inlineCode",{parentName:"a"},"#375"))),(0,c.kt)("li",{parentName:"ul"},"fix name resolution of entry when uploading scripts to gateway ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fdb6f65f5d7f0cfc0cfe64a75cdc3a8a8b130c4e"},(0,c.kt)("inlineCode",{parentName:"a"},"fdb6f65"))),(0,c.kt)("li",{parentName:"ul"},"expose self-control service (eg for standby()) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/abae36b1ab9ed72fdb43e3b8195a9b67926cb058"},(0,c.kt)("inlineCode",{parentName:"a"},"abae36b"))),(0,c.kt)("li",{parentName:"ul"},"add codesandbox info ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e16053e73408ad6524482135cd9a360642f55095"},(0,c.kt)("inlineCode",{parentName:"a"},"e16053e")))),(0,c.kt)("h4",{id:"v290"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.8.3...v2.9.0"},"v2.9.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"support for static class members; fixes #337; 2.9.0 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/337"},(0,c.kt)("inlineCode",{parentName:"a"},"#337"))),(0,c.kt)("li",{parentName:"ul"},"filter out more commits from changelog ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/cf5883fc8307b3ad779cb9e24fc64b6b07518567"},(0,c.kt)("inlineCode",{parentName:"a"},"cf5883f"))),(0,c.kt)("li",{parentName:"ul"},"store list of services in device meta ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7ca544c77ee788333e92042503365ca61456b956"},(0,c.kt)("inlineCode",{parentName:"a"},"7ca544c")))),(0,c.kt)("h4",{id:"v283"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.8.2...v2.8.3"},"v2.8.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"automatic update of changelog ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/705037bfac7518756cd277502106afebba82286c"},(0,c.kt)("inlineCode",{parentName:"a"},"705037b"))),(0,c.kt)("li",{parentName:"ul"},"updated docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b84256ade132070330e49679dff7a23965cdb355"},(0,c.kt)("inlineCode",{parentName:"a"},"b84256a")))),(0,c.kt)("h4",{id:"v282"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.8.1...v2.8.2"},"v2.8.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fixes around frame sending ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/81547c8e5ed6bc861b15c9f4961b8de4c5241774"},(0,c.kt)("inlineCode",{parentName:"a"},"81547c8"))),(0,c.kt)("li",{parentName:"ul"},"use new jd_need_to_send() ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/92620b06e3f23b4b637b91c06d4dce6fb67491fa"},(0,c.kt)("inlineCode",{parentName:"a"},"92620b0"))),(0,c.kt)("li",{parentName:"ul"},"bump jd-c; 2.8.2 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/22a66fff6381a5ed8bf5deca5de723480b9ccfc5"},(0,c.kt)("inlineCode",{parentName:"a"},"22a66ff")))),(0,c.kt)("h4",{id:"v281"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.8.0...v2.8.1"},"v2.8.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"indicate what user program is run; also more debug logging ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4d7617b776b3987ae5998f30235b61b29de0aca7"},(0,c.kt)("inlineCode",{parentName:"a"},"4d7617b"))),(0,c.kt)("li",{parentName:"ul"},"update jd-c/ts ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7ccd32a0a31eb0fe4d45af067831054d9b2ac212"},(0,c.kt)("inlineCode",{parentName:"a"},"7ccd32a"))),(0,c.kt)("li",{parentName:"ul"},"use correct APIs for frame reception when hosted ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/65b0c5302d5433422345f456a5988fbde4b287ff"},(0,c.kt)("inlineCode",{parentName:"a"},"65b0c53")))),(0,c.kt)("h4",{id:"v280"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.11...v2.8.0"},"v2.8.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add devNetwork dcfg flag ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ef3036c1a26c362ba14eb9703c011f972b62387e"},(0,c.kt)("inlineCode",{parentName:"a"},"ef3036c"))),(0,c.kt)("li",{parentName:"ul"},"fix build ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5cc7a31137cc99b9c78738f3678a77765cb80a0a"},(0,c.kt)("inlineCode",{parentName:"a"},"5cc7a31")))),(0,c.kt)("h4",{id:"v2711"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.10...v2.7.11"},"v2.7.11")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"subscribeMessages -",">"," subscribeMessage ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/abf685d524dcd968d64cba982fa53977c0c1f271"},(0,c.kt)("inlineCode",{parentName:"a"},"abf685d"))),(0,c.kt)("li",{parentName:"ul"},"better logic to generate device name ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2c6378882293dc33abf2001d6875214a5c0af254"},(0,c.kt)("inlineCode",{parentName:"a"},"2c63788"))),(0,c.kt)("li",{parentName:"ul"},"optionaly try to publish to vscode marketplace ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9aafc3749de288eaf0a7cad68c797bc7cea22c8d"},(0,c.kt)("inlineCode",{parentName:"a"},"9aafc37")))),(0,c.kt)("h4",{id:"v2710"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.9...v2.7.10"},"v2.7.10")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add BME680 driver ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/eb399791d0b13f306617c786c4849134c82f7a90"},(0,c.kt)("inlineCode",{parentName:"a"},"eb39979"))),(0,c.kt)("li",{parentName:"ul"},"add Buffer.concat,set,slice ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f4328b7fb3bfc3c6956753df104909c7ebcda738"},(0,c.kt)("inlineCode",{parentName:"a"},"f4328b7"))),(0,c.kt)("li",{parentName:"ul"},"more gateway docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5fd5ee283e64bbb4a849353ad9ab3410563eedbd"},(0,c.kt)("inlineCode",{parentName:"a"},"5fd5ee2")))),(0,c.kt)("h4",{id:"v279"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.7...v2.7.9"},"v2.7.9")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix zx syntax ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6ff9b87c18d7d4e7c78f1de5d4c3bf4028a165eb"},(0,c.kt)("inlineCode",{parentName:"a"},"6ff9b87"))),(0,c.kt)("li",{parentName:"ul"},"other attempt using env var ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/aff328364a34481a07b298cb50b1aceffe47e635"},(0,c.kt)("inlineCode",{parentName:"a"},"aff3283")))),(0,c.kt)("h4",{id:"v277"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.4...v2.7.7"},"v2.7.7")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"updatd support link ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/adae14bb78756ad9a92833c88f42778f17d8065e"},(0,c.kt)("inlineCode",{parentName:"a"},"adae14b"))),(0,c.kt)("li",{parentName:"ul"},"check env before running build ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/1bfb701aeeab6534f3ca7e857de574ac20dca3cd"},(0,c.kt)("inlineCode",{parentName:"a"},"1bfb701"))),(0,c.kt)("li",{parentName:"ul"},"use correct name ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ddd01cab799da20635ba43c91497b7e45bd3f4fd"},(0,c.kt)("inlineCode",{parentName:"a"},"ddd01ca")))),(0,c.kt)("h4",{id:"v274"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.3...v2.7.4"},"v2.7.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add tags ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e7227fa20827ebdec4382112d16446507938bbe7"},(0,c.kt)("inlineCode",{parentName:"a"},"e7227fa"))),(0,c.kt)("li",{parentName:"ul"},"fix make release ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2914a7214fe9fd2c25a2012a34d117f1ac14742e"},(0,c.kt)("inlineCode",{parentName:"a"},"2914a72")))),(0,c.kt)("h4",{id:"v273"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.2...v2.7.3"},"v2.7.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"updated marketplace docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5ad36629755974bb906bbd59fe3528e905dc32b2"},(0,c.kt)("inlineCode",{parentName:"a"},"5ad3662"))),(0,c.kt)("li",{parentName:"ul"},"publish to marketplace ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9b066bb2a7385def0fc5996be378ca39e7d3fc92"},(0,c.kt)("inlineCode",{parentName:"a"},"9b066bb"))),(0,c.kt)("li",{parentName:"ul"},"ignore galleryBanner ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9396c4f474379418d150e407b2b260231eb5dac5"},(0,c.kt)("inlineCode",{parentName:"a"},"9396c4f")))),(0,c.kt)("h4",{id:"v272"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.1...v2.7.2"},"v2.7.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"26 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Environment support in vscode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/371"},(0,c.kt)("inlineCode",{parentName:"a"},"#371"))),(0,c.kt)("li",{parentName:"ul"},"restart program on sha-matching deploy; fixes #372 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/372"},(0,c.kt)("inlineCode",{parentName:"a"},"#372"))),(0,c.kt)("li",{parentName:"ul"},"add motion service; fixes #364 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/364"},(0,c.kt)("inlineCode",{parentName:"a"},"#364"))),(0,c.kt)("li",{parentName:"ul"},"use common names for common registers ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/714d920a8c6b863885e798728eae38b2122e95d8"},(0,c.kt)("inlineCode",{parentName:"a"},"714d920"))),(0,c.kt)("li",{parentName:"ul"},"don't compile .ts in docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9479a865b38142a707aa080b1e9d884a581834a2"},(0,c.kt)("inlineCode",{parentName:"a"},"9479a86"))),(0,c.kt)("li",{parentName:"ul"},"accessbiilty fixes ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7c4ea1b959b2d45950501229d0052b1c1d33ac4a"},(0,c.kt)("inlineCode",{parentName:"a"},"7c4ea1b")))),(0,c.kt)("h4",{id:"v271"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.7.0...v2.7.1"},"v2.7.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"24 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"i2c scan off by default; fixes #352 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/352"},(0,c.kt)("inlineCode",{parentName:"a"},"#352"))),(0,c.kt)("li",{parentName:"ul"},"add .toString() warning; fixes #345 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/345"},(0,c.kt)("inlineCode",{parentName:"a"},"#345"))),(0,c.kt)("li",{parentName:"ul"},"fix ctor arg refs; fixes #357 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/357"},(0,c.kt)("inlineCode",{parentName:"a"},"#357"))),(0,c.kt)("li",{parentName:"ul"},'Revert "only one copy of boards.json please" ',(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7fd5b3e57740d4572bdb7dd5ddcf20134ff9ec68"},(0,c.kt)("inlineCode",{parentName:"a"},"7fd5b3e"))),(0,c.kt)("li",{parentName:"ul"},"only one copy of boards.json please ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a34571217dec093fa8dabfa69f89612fdbf95d45"},(0,c.kt)("inlineCode",{parentName:"a"},"a345712"))),(0,c.kt)("li",{parentName:"ul"},"update boards.json (fixing doc-gen) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e8bdd0cc4955813904dd5a6484830af87cfa36a1"},(0,c.kt)("inlineCode",{parentName:"a"},"e8bdd0c")))),(0,c.kt)("h4",{id:"v270"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.6.2...v2.7.0"},"v2.7.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"I2c driver ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/353"},(0,c.kt)("inlineCode",{parentName:"a"},"#353"))),(0,c.kt)("li",{parentName:"ul"},"Minor server refactorings ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/350"},(0,c.kt)("inlineCode",{parentName:"a"},"#350"))),(0,c.kt)("li",{parentName:"ul"},"treat roles as regular objects ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5acb1f481443413f2fa348a13df34d448118a2c8"},(0,c.kt)("inlineCode",{parentName:"a"},"5acb1f4"))),(0,c.kt)("li",{parentName:"ul"},"update boards ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/718f718b010afb8760f1d87a278a77869e2b71b8"},(0,c.kt)("inlineCode",{parentName:"a"},"718f718"))),(0,c.kt)("li",{parentName:"ul"},"use board.startButtonBOOT() etc ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ff5582b4decfb649c562aaac68391fd4c57cf2c2"},(0,c.kt)("inlineCode",{parentName:"a"},"ff5582b")))),(0,c.kt)("h4",{id:"v262"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.6.1...v2.6.2"},"v2.6.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"19 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add GPIO service; 2.6.2 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c7da058ad0fa7999e0b02e534492ae57a53e09a1"},(0,c.kt)("inlineCode",{parentName:"a"},"c7da058"))),(0,c.kt)("li",{parentName:"ul"},"update rise4fun tools ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/70399caee5effe5d21e1c081960f3e907abadd91"},(0,c.kt)("inlineCode",{parentName:"a"},"70399ca")))),(0,c.kt)("h4",{id:"v261"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.6.0...v2.6.1"},"v2.6.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"19 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"upgrade to docusaurus 2.4.0 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/348"},(0,c.kt)("inlineCode",{parentName:"a"},"#348"))),(0,c.kt)("li",{parentName:"ul"},"split clientcmds further ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/85580ea7c9735e7af2d9be03db800b6c8e02f025"},(0,c.kt)("inlineCode",{parentName:"a"},"85580ea"))),(0,c.kt)("li",{parentName:"ul"},"more docs updates ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/561f4eca915a353cd88c349dce710a1c88127b9a"},(0,c.kt)("inlineCode",{parentName:"a"},"561f4ec"))),(0,c.kt)("li",{parentName:"ul"},"add RotaryEncoder.asPotentiometer() ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/50752976cbe0c575a6fcf5dd7b89bc6aae8358c5"},(0,c.kt)("inlineCode",{parentName:"a"},"5075297")))),(0,c.kt)("h4",{id:"v260"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.5.0...v2.6.0"},"v2.6.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"18 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"first draft of drivers package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/346"},(0,c.kt)("inlineCode",{parentName:"a"},"#346"))),(0,c.kt)("li",{parentName:"ul"},"add buffer decoding tests; fixes #40 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/40"},(0,c.kt)("inlineCode",{parentName:"a"},"#40"))),(0,c.kt)("li",{parentName:"ul"},"move code from clientcmds.ts to array.ts and i2c package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f2eac1a1bb9eb3c5bbffb318f390834361e3bf66"},(0,c.kt)("inlineCode",{parentName:"a"},"f2eac1a"))),(0,c.kt)("li",{parentName:"ul"},"add ds.actionReport() for action responses ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4c8cbad044349d936770df6238186c9dd1d834a1"},(0,c.kt)("inlineCode",{parentName:"a"},"4c8cbad"))),(0,c.kt)("li",{parentName:"ul"},"add Role.report and utility functions around it ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d782aa8ab6d8f8e329063dcb25bdf2f7a0c7b3cf"},(0,c.kt)("inlineCode",{parentName:"a"},"d782aa8")))),(0,c.kt)("h4",{id:"v250"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.4.4...v2.5.0"},"v2.5.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"14 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"initial work on UTF8 strings ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/747d802196ff62d07bfae199fcfdb1865efaf4f6"},(0,c.kt)("inlineCode",{parentName:"a"},"747d802"))),(0,c.kt)("li",{parentName:"ul"},"Add String.join() ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/487f1ee2f351d1de4620f963d360303a9e2f04e3"},(0,c.kt)("inlineCode",{parentName:"a"},"487f1ee"))),(0,c.kt)("li",{parentName:"ul"},"add unicode test from pxt ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/402c3d6bb89b9d5e2278051cc76cd52a8a68a686"},(0,c.kt)("inlineCode",{parentName:"a"},"402c3d6")))),(0,c.kt)("h4",{id:"v244"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.4.3...v2.4.4"},"v2.4.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fixes for allocation sizes ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c2cafd4722b2e237378aac1f35992d7acb7a4477"},(0,c.kt)("inlineCode",{parentName:"a"},"c2cafd4")))),(0,c.kt)("h4",{id:"v243"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.4.2...v2.4.3"},"v2.4.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"implement assignment chaining; fixes #339 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/339"},(0,c.kt)("inlineCode",{parentName:"a"},"#339"))),(0,c.kt)("li",{parentName:"ul"},"add compiler-everything test; fix sources; fixes #268 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/268"},(0,c.kt)("inlineCode",{parentName:"a"},"#268"))),(0,c.kt)("li",{parentName:"ul"},"throttle setInterval() with async; fixes #289 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/289"},(0,c.kt)("inlineCode",{parentName:"a"},"#289"))),(0,c.kt)("li",{parentName:"ul"},"re-generate board files (new repo names) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/de6a90631cbf6e28fb56d8f9bf85f12e7d4ffe42"},(0,c.kt)("inlineCode",{parentName:"a"},"de6a906"))),(0,c.kt)("li",{parentName:"ul"},"add adafruit feather s2 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4b9c90977e90b90b1046dd17f018dd3c40d9ce6b"},(0,c.kt)("inlineCode",{parentName:"a"},"4b9c909"))),(0,c.kt)("li",{parentName:"ul"},"limit call stack depth ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7319b6fb5116881162a79484ac2e8992282fcbdf"},(0,c.kt)("inlineCode",{parentName:"a"},"7319b6f")))),(0,c.kt)("h4",{id:"v242"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.4.1...v2.4.2"},"v2.4.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"11 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add xiao c3 board ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c694cbccb6669555837e069250ee83c454da6149"},(0,c.kt)("inlineCode",{parentName:"a"},"c694cbc"))),(0,c.kt)("li",{parentName:"ul"},"add globals in debugger ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6ad095221c177470a86222bd03ad9b84c6ca78a9"},(0,c.kt)("inlineCode",{parentName:"a"},"6ad0952"))),(0,c.kt)("li",{parentName:"ul"},"add missing pull ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/17a78f92e4c2f730d577b970722f67b8888cff04"},(0,c.kt)("inlineCode",{parentName:"a"},"17a78f9")))),(0,c.kt)("h4",{id:"v241"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.4.0...v2.4.1"},"v2.4.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"10 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix auto-imports and plugin; 2.4.1 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e3ff69f8f782037c80215762a48e18b99ccb6241"},(0,c.kt)("inlineCode",{parentName:"a"},"e3ff69f"))),(0,c.kt)("li",{parentName:"ul"},"update jd-c ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/04a8ef58e23ff3680039634e9c2ff4060b582f01"},(0,c.kt)("inlineCode",{parentName:"a"},"04a8ef5")))),(0,c.kt)("h4",{id:"v240"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.3.4...v2.4.0"},"v2.4.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"10 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"allow Jacdac servers implemented in TS ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/335"},(0,c.kt)("inlineCode",{parentName:"a"},"#335"))),(0,c.kt)("li",{parentName:"ul"},"updated samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0a3244e9ff61e1ebe809a50b1a70c98ba36b5d41"},(0,c.kt)("inlineCode",{parentName:"a"},"0a3244e"))),(0,c.kt)("li",{parentName:"ul"},"updated gateway docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c2b57b92b7a0ebb2fc0fce5547171c54f73c8d49"},(0,c.kt)("inlineCode",{parentName:"a"},"c2b57b9"))),(0,c.kt)("li",{parentName:"ul"},"add sensor server; 2.4.0 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7989afe8eff16d1c0adb159bdd65e77d70ddee0a"},(0,c.kt)("inlineCode",{parentName:"a"},"7989afe")))),(0,c.kt)("h4",{id:"v234"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.3.3...v2.3.4"},"v2.3.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"4 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"show watches in debug mode, cleanout context on unload ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3e5a42b881209ddafa7966765a7ec996c002e8a1"},(0,c.kt)("inlineCode",{parentName:"a"},"3e5a42b"))),(0,c.kt)("li",{parentName:"ul"},'handle "run" to open simulators view ',(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e56c704ce9b2225f0e2e83719e70e3a0fc2695e6"},(0,c.kt)("inlineCode",{parentName:"a"},"e56c704"))),(0,c.kt)("li",{parentName:"ul"},"add console data image ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5d3cba1e2b1cf3f247c3381aea46717776634070"},(0,c.kt)("inlineCode",{parentName:"a"},"5d3cba1")))),(0,c.kt)("h4",{id:"v233"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.3.2...v2.3.3"},"v2.3.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"4 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"updated generated notebook ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d3953a0487ee9cdbfd90ba41a63fade9b5fe027b"},(0,c.kt)("inlineCode",{parentName:"a"},"d3953a0")))),(0,c.kt)("h4",{id:"v232"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.3.1...v2.3.2"},"v2.3.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"4 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add notebook ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0d769cdb7262288e8e6c1ff997587dfbd36ca95e"},(0,c.kt)("inlineCode",{parentName:"a"},"0d769cd"))),(0,c.kt)("li",{parentName:"ul"},"fix: support for generating note ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fbe4dd6c3f76c45b5edbfec40602f39a94604620"},(0,c.kt)("inlineCode",{parentName:"a"},"fbe4dd6"))),(0,c.kt)("li",{parentName:"ul"},"updated suggested extensions ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8d7e80f44ea42cf846b42baef55e44f4c0198f52"},(0,c.kt)("inlineCode",{parentName:"a"},"8d7e80f")))),(0,c.kt)("h4",{id:"v231"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.3.0...v2.3.1"},"v2.3.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"4 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"updated cloud docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/424eb0e07c0b5261cb9a098e59f2baabea7eaea0"},(0,c.kt)("inlineCode",{parentName:"a"},"424eb0e"))),(0,c.kt)("li",{parentName:"ul"},"reorg data recorder ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/86e433169c7d12bd8a7b97eeedfc244b70014e51"},(0,c.kt)("inlineCode",{parentName:"a"},"86e4331"))),(0,c.kt)("li",{parentName:"ul"},"add esp blinky ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d2bf9e01b48d862450f7678399efc640d89f0876"},(0,c.kt)("inlineCode",{parentName:"a"},"d2bf9e0")))),(0,c.kt)("h4",{id:"v230"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.29...v2.3.0"},"v2.3.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"copy-paste sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3a0a5cffe55443248bf2a772782007afc457212d"},(0,c.kt)("inlineCode",{parentName:"a"},"3a0a5cf"))),(0,c.kt)("li",{parentName:"ul"},"better insertion logic ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/06ed39932e9b2b84d5be16856307715745ff416a"},(0,c.kt)("inlineCode",{parentName:"a"},"06ed399"))),(0,c.kt)("li",{parentName:"ul"},"add toggle on lightbulb ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/bfd25a43c7e45bbeacc544c7adc30f9c3a44305f"},(0,c.kt)("inlineCode",{parentName:"a"},"bfd25a4")))),(0,c.kt)("h4",{id:"v2229"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.28...v2.2.29"},"v2.2.29")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"1 April 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"organize peripherical docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/405d77ccd99e38780b7b3b30ed163eafbfd7a0ea"},(0,c.kt)("inlineCode",{parentName:"a"},"405d77c"))),(0,c.kt)("li",{parentName:"ul"},"adding new hid keyboard sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9fc249e8037753b6284350804677cd61e7bf5d6a"},(0,c.kt)("inlineCode",{parentName:"a"},"9fc249e"))),(0,c.kt)("li",{parentName:"ul"},"add samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/885e08e47ea9d88d248060fa2ffb4ba423c98546"},(0,c.kt)("inlineCode",{parentName:"a"},"885e08e")))),(0,c.kt)("h4",{id:"v2228"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.27...v2.2.28"},"v2.2.28")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"31 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"missing legal stuff ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/70d704aed9b185cc4a71168c5af67f98168f0ad3"},(0,c.kt)("inlineCode",{parentName:"a"},"70d704a"))),(0,c.kt)("li",{parentName:"ul"},"moving packages out of vscode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f356fbb6cad680a947487bc513e1ec32d0626e59"},(0,c.kt)("inlineCode",{parentName:"a"},"f356fbb"))),(0,c.kt)("li",{parentName:"ul"},"updated link ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8b93bd95871b5ec4b28fe44ddcc3cf4263e2883f"},(0,c.kt)("inlineCode",{parentName:"a"},"8b93bd9")))),(0,c.kt)("h4",{id:"v2227"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.26...v2.2.27"},"v2.2.27")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"31 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"attempt at fixing publshing ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a2db8e2516e52e9be7530f1f50bf8ae025548d9b"},(0,c.kt)("inlineCode",{parentName:"a"},"a2db8e2")))),(0,c.kt)("h4",{id:"v2226"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.24...v2.2.26"},"v2.2.26")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"31 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add video to home screen ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f655de2533121e5b679b0b0b6184286704e2c11f"},(0,c.kt)("inlineCode",{parentName:"a"},"f655de2"))),(0,c.kt)("li",{parentName:"ul"},"fix observables tests ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/238de35cca343be5375f8924ce888dfc0463e01f"},(0,c.kt)("inlineCode",{parentName:"a"},"238de35"))),(0,c.kt)("li",{parentName:"ul"},"try yarn publish ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7a89f1e5568c906014f07b5c94892a7cf1fc3760"},(0,c.kt)("inlineCode",{parentName:"a"},"7a89f1e")))),(0,c.kt)("h4",{id:"v2224"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.22...v2.2.24"},"v2.2.24")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"31 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix: package of depdencies in vscode extension ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4a38ede443367a1d45b7a19a8823db2c19bd16c7"},(0,c.kt)("inlineCode",{parentName:"a"},"4a38ede"))),(0,c.kt)("li",{parentName:"ul"},"fix bump.js ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/916c820db2ac90430504140af5ab9328d7c4b974"},(0,c.kt)("inlineCode",{parentName:"a"},"916c820")))),(0,c.kt)("h4",{id:"v2222"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.21...v2.2.22"},"v2.2.22")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"31 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix: build vsix after patching resources ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/53ba99eeb516fd50067826abe28b71f37f17870a"},(0,c.kt)("inlineCode",{parentName:"a"},"53ba99e"))),(0,c.kt)("li",{parentName:"ul"},"updated output channel name ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0fd9cd3624ddf70f2b3a126f83b6b7d5fa19d59f"},(0,c.kt)("inlineCode",{parentName:"a"},"0fd9cd3")))),(0,c.kt)("h4",{id:"v2221"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.20...v2.2.21"},"v2.2.21")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"31 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix: start devs when opening an entry point and not running ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/538ddf409c0d7cd0a7f9ca5f83e7a55b15674b77"},(0,c.kt)("inlineCode",{parentName:"a"},"538ddf4"))),(0,c.kt)("li",{parentName:"ul"},"sort boards and hide protos in non-developer mode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/3402616406f35289b05b1b06a2871e9ea4f96d06"},(0,c.kt)("inlineCode",{parentName:"a"},"3402616"))),(0,c.kt)("li",{parentName:"ul"},"Update README.md ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ba16684aa11d67bf9c8cb683a1aec6c94ba82575"},(0,c.kt)("inlineCode",{parentName:"a"},"ba16684")))),(0,c.kt)("h4",{id:"v2220"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.19...v2.2.20"},"v2.2.20")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"30 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Developer mode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/308"},(0,c.kt)("inlineCode",{parentName:"a"},"#308"))),(0,c.kt)("li",{parentName:"ul"},"docs updates ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ed55aff5a6345f178567673ce40c1f5fa3d9f807"},(0,c.kt)("inlineCode",{parentName:"a"},"ed55aff"))),(0,c.kt)("li",{parentName:"ul"},"more server docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a73f1cf2acd9e6bd6e4c3d127bd0dceaa7f57150"},(0,c.kt)("inlineCode",{parentName:"a"},"a73f1cf"))),(0,c.kt)("li",{parentName:"ul"},"remove Condition (we now have Fiber.suspend etc) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/054cd29355fe957248c503999b80346b798f2dc7"},(0,c.kt)("inlineCode",{parentName:"a"},"054cd29")))),(0,c.kt)("h4",{id:"v2219"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.18...v2.2.19"},"v2.2.19")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"sync subscribe in observables ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/298"},(0,c.kt)("inlineCode",{parentName:"a"},"#298"))),(0,c.kt)("li",{parentName:"ul"},"gateway connection message ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/685aaa28ede16a1c402c95528977abf008b6c6c2"},(0,c.kt)("inlineCode",{parentName:"a"},"685aaa2")))),(0,c.kt)("h4",{id:"v2218"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.16...v2.2.18"},"v2.2.18")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix: @devicescript/cloud dependencies ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/51dbf67c04f8e8a30eb0295863d6b3eb39cd6d96"},(0,c.kt)("inlineCode",{parentName:"a"},"51dbf67"))),(0,c.kt)("li",{parentName:"ul"},"observable docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/77b4280b480656ab45dfe935e5ae6bc00a373666"},(0,c.kt)("inlineCode",{parentName:"a"},"77b4280"))),(0,c.kt)("li",{parentName:"ul"},"add test as a devdependency ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/a5f865227f79ac739ec52ed7687586a857038780"},(0,c.kt)("inlineCode",{parentName:"a"},"a5f8652")))),(0,c.kt)("h4",{id:"v2216"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.15...v2.2.16"},"v2.2.16")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"better handling of initial connection ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5f2e2e32097901d9e3c6331a5d3e2f3ed23255ce"},(0,c.kt)("inlineCode",{parentName:"a"},"5f2e2e3"))),(0,c.kt)("li",{parentName:"ul"},"clear token with api root ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9f1137224150116f805a18f27d6e7bf0718746ff"},(0,c.kt)("inlineCode",{parentName:"a"},"9f11372"))),(0,c.kt)("li",{parentName:"ul"},"duplicate copy button ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/89f52e645120b772173c5ff22331ce32370da556"},(0,c.kt)("inlineCode",{parentName:"a"},"89f52e6")))),(0,c.kt)("h4",{id:"v2215"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.14...v2.2.15"},"v2.2.15")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"vscode should not reference compiler ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d3ab38b3bdfd5426a7930f638afaf9d1cf8f7bf3"},(0,c.kt)("inlineCode",{parentName:"a"},"d3ab38b"))),(0,c.kt)("li",{parentName:"ul"},"fix jacdac-c? ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b1c5d324ae9235cccce855311737b632f689175e"},(0,c.kt)("inlineCode",{parentName:"a"},"b1c5d32")))),(0,c.kt)("h4",{id:"v2214"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.13...v2.2.14"},"v2.2.14")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"29 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"introduce hash in dcfg; restart when it changes ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/63937b7b06733e10256d247e64c52ac399d5fb61"},(0,c.kt)("inlineCode",{parentName:"a"},"63937b7"))),(0,c.kt)("li",{parentName:"ul"},"rename progName/Version fields to @name/@version ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8f37511605d13b22f9c0747633be885412cf26ad"},(0,c.kt)("inlineCode",{parentName:"a"},"8f37511"))),(0,c.kt)("li",{parentName:"ul"},"debug fixes; 2.2.14 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/11eeea627ba8e293a62fe6f504a102ecef6c1eba"},(0,c.kt)("inlineCode",{parentName:"a"},"11eeea6")))),(0,c.kt)("h4",{id:"v2213"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.12...v2.2.13"},"v2.2.13")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix: add json5 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/186"},(0,c.kt)("inlineCode",{parentName:"a"},"#186"))),(0,c.kt)("li",{parentName:"ul"},"corrrectly display data ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/832aae028933953bf43921f043e0144ea533224e"},(0,c.kt)("inlineCode",{parentName:"a"},"832aae0"))),(0,c.kt)("li",{parentName:"ul"},"save file to 'data', normalize time to seconds ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0482692d707278c351bed7eead5e59511aae6fe0"},(0,c.kt)("inlineCode",{parentName:"a"},"0482692"))),(0,c.kt)("li",{parentName:"ul"},"ds.reboot()-",">","ds.restart(); ds.reboot() now reboots ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e43fd0a2a0c08798879cb3f1a04eea71f0c8561b"},(0,c.kt)("inlineCode",{parentName:"a"},"e43fd0a")))),(0,c.kt)("h4",{id:"v2212"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.11...v2.2.12"},"v2.2.12")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"automtic data output parsing ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8843f2424a72f0ee33e823f4e6bab8f3c51336ac"},(0,c.kt)("inlineCode",{parentName:"a"},"8843f24"))),(0,c.kt)("li",{parentName:"ul"},"docs update ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/961dbc543b7351a2a27f5557328a532d0fdacbdf"},(0,c.kt)("inlineCode",{parentName:"a"},"961dbc5"))),(0,c.kt)("li",{parentName:"ul"},"updated docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e141d7413132f7d5afc0fc5e89ada842b01cf063"},(0,c.kt)("inlineCode",{parentName:"a"},"e141d74")))),(0,c.kt)("h4",{id:"v2211"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.10...v2.2.11"},"v2.2.11")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"28 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"use fspath in file context ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2b06715ac9f26f5ff91ea9f2190a02de27dc602b"},(0,c.kt)("inlineCode",{parentName:"a"},"2b06715"))),(0,c.kt)("li",{parentName:"ul"},"faster initial devtools connect ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/dd319467d9f304c63c2ff1ab7b6d535b04ee0339"},(0,c.kt)("inlineCode",{parentName:"a"},"dd31946"))),(0,c.kt)("li",{parentName:"ul"},"updated jacdac-ts ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/5db40ff7d9817ed7c9765afc79eb2d2f750bdf71"},(0,c.kt)("inlineCode",{parentName:"a"},"5db40ff")))),(0,c.kt)("h4",{id:"v2210"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.9...v2.2.10"},"v2.2.10")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"cheesy homepage ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/6da6dfa364f0eb44afffd484457fbb44aca153c5"},(0,c.kt)("inlineCode",{parentName:"a"},"6da6dfa"))),(0,c.kt)("li",{parentName:"ul"},"fix: don't ask for workspace folder if only one ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7d327cebc10c35ddc7f7a2dd9b6888e1f776e843"},(0,c.kt)("inlineCode",{parentName:"a"},"7d327ce")))),(0,c.kt)("h4",{id:"v228"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.6...v2.2.8"},"v2.2.8")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add update-notifier library ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/244"},(0,c.kt)("inlineCode",{parentName:"a"},"#244"))),(0,c.kt)("li",{parentName:"ul"},"add language docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/11f0ce113f6442baa3ed1e398da4c8e560d78433"},(0,c.kt)("inlineCode",{parentName:"a"},"11f0ce1"))),(0,c.kt)("li",{parentName:"ul"},"level detector ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/634edbc36c4c475ae487ce9d73ed366be8eb7bb6"},(0,c.kt)("inlineCode",{parentName:"a"},"634edbc"))),(0,c.kt)("li",{parentName:"ul"},"more on fibers ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/fcd4459ad2a89c2dcc4b9e64e3ab23c31e42c698"},(0,c.kt)("inlineCode",{parentName:"a"},"fcd4459")))),(0,c.kt)("h4",{id:"v226"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.5...v2.2.6"},"v2.2.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"updated docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4347b04c91569ed21da3d28b1c1853a97515b3a8"},(0,c.kt)("inlineCode",{parentName:"a"},"4347b04"))),(0,c.kt)("li",{parentName:"ul"},"added some links ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/39d51afeb2b2fc685cc32b983ca229950dca039d"},(0,c.kt)("inlineCode",{parentName:"a"},"39d51af"))),(0,c.kt)("li",{parentName:"ul"},"updated readme ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c7ac8732a43fc80d03dfd29fcc3e79ffd6bd51b6"},(0,c.kt)("inlineCode",{parentName:"a"},"c7ac873")))),(0,c.kt)("h4",{id:"v225"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.4...v2.2.5"},"v2.2.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"27 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"don't use activetexteditor ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/279"},(0,c.kt)("inlineCode",{parentName:"a"},"#279"))),(0,c.kt)("li",{parentName:"ul"},"use observable streams instead ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/272"},(0,c.kt)("inlineCode",{parentName:"a"},"#272"))),(0,c.kt)("li",{parentName:"ul"},"Configure hw ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/270"},(0,c.kt)("inlineCode",{parentName:"a"},"#270"))),(0,c.kt)("li",{parentName:"ul"},"I2c package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/267"},(0,c.kt)("inlineCode",{parentName:"a"},"#267"))),(0,c.kt)("li",{parentName:"ul"},"I2c documentation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/263"},(0,c.kt)("inlineCode",{parentName:"a"},"#263"))),(0,c.kt)("li",{parentName:"ul"},"implement object inspection; fixes #275 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/275"},(0,c.kt)("inlineCode",{parentName:"a"},"#275"))),(0,c.kt)("li",{parentName:"ul"},"add startServer() wizard; fixes #258 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/258"},(0,c.kt)("inlineCode",{parentName:"a"},"#258"))),(0,c.kt)("li",{parentName:"ul"},"fix #277 (dbg crash) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/277"},(0,c.kt)("inlineCode",{parentName:"a"},"#277"))),(0,c.kt)("li",{parentName:"ul"},"add buzzer and dimmable light bulb ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4e37c9a538b75c2f40ac7fcfcefa3be9cb5d9a88"},(0,c.kt)("inlineCode",{parentName:"a"},"4e37c9a"))),(0,c.kt)("li",{parentName:"ul"},"catchError support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/83d63a164c1e459a6b431e8a600e63ecd1d51110"},(0,c.kt)("inlineCode",{parentName:"a"},"83d63a1"))),(0,c.kt)("li",{parentName:"ul"},"fix: start sim auto on debug if no debice connected ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/116ead56c17af38c404c30a60ff33f188407f149"},(0,c.kt)("inlineCode",{parentName:"a"},"116ead5")))),(0,c.kt)("h4",{id:"v224"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.3...v2.2.4"},"v2.2.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"24 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix windows build ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/266"},(0,c.kt)("inlineCode",{parentName:"a"},"#266"))),(0,c.kt)("li",{parentName:"ul"},"use telemetry for showError messages ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/264"},(0,c.kt)("inlineCode",{parentName:"a"},"#264"))),(0,c.kt)("li",{parentName:"ul"},"I2c reg buf ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/254"},(0,c.kt)("inlineCode",{parentName:"a"},"#254"))),(0,c.kt)("li",{parentName:"ul"},"add new functions ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/253"},(0,c.kt)("inlineCode",{parentName:"a"},"#253"))),(0,c.kt)("li",{parentName:"ul"},"Register observable ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/252"},(0,c.kt)("inlineCode",{parentName:"a"},"#252"))),(0,c.kt)("li",{parentName:"ul"},"fix #259 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/259"},(0,c.kt)("inlineCode",{parentName:"a"},"#259"))),(0,c.kt)("li",{parentName:"ul"},"add race observable ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/df9a232d9a5ffa39ecec5cba132c6526a1c4a643"},(0,c.kt)("inlineCode",{parentName:"a"},"df9a232"))),(0,c.kt)("li",{parentName:"ul"},"fix new project ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9f8d99f45578f838e3a619258acdc672959e1fe6"},(0,c.kt)("inlineCode",{parentName:"a"},"9f8d99f"))),(0,c.kt)("li",{parentName:"ul"},"add logging on folder issue ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/14f6749c1a02f6414d1402f4ca9d87d50f3f1eff"},(0,c.kt)("inlineCode",{parentName:"a"},"14f6749")))),(0,c.kt)("h4",{id:"v223"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.2...v2.2.3"},"v2.2.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"24 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add lightbulb ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/7d61ed060ce3cb53279f4e09a3824f69265625cb"},(0,c.kt)("inlineCode",{parentName:"a"},"7d61ed0"))),(0,c.kt)("li",{parentName:"ul"},"windows breakpoint fix ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/60d985626a589838ef9d3e108460c2b31278cba7"},(0,c.kt)("inlineCode",{parentName:"a"},"60d9856")))),(0,c.kt)("h4",{id:"v222"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.1...v2.2.2"},"v2.2.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"24 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"added new sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/9c9b82957fea0774a09982c2b25110cf4799d03d"},(0,c.kt)("inlineCode",{parentName:"a"},"9c9b829"))),(0,c.kt)("li",{parentName:"ul"},"work on sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f35e0b95fbacbb864f994f8518bed47832b247f5"},(0,c.kt)("inlineCode",{parentName:"a"},"f35e0b9")))),(0,c.kt)("h4",{id:"v221"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.2.0...v2.2.1"},"v2.2.1")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"try to fix debug paths ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/31d7669f6da6836b714112158ee51d2a08ee8ccb"},(0,c.kt)("inlineCode",{parentName:"a"},"31d7669"))),(0,c.kt)("li",{parentName:"ul"},"more logging ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/bb6ce05898167c770e7d168df260c631a68ecb0c"},(0,c.kt)("inlineCode",{parentName:"a"},"bb6ce05")))),(0,c.kt)("h4",{id:"v220"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.1.0...v2.2.0"},"v2.2.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Settings ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/251"},(0,c.kt)("inlineCode",{parentName:"a"},"#251"))),(0,c.kt)("li",{parentName:"ul"},"don't run git commands if no .git folder ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/830bcebeaa7a3e371a247f661206cd4e1e478fe8"},(0,c.kt)("inlineCode",{parentName:"a"},"830bceb"))),(0,c.kt)("li",{parentName:"ul"},"use fiber suspend in setTimeout(); v2.2.0 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/ba3b780c61f778ee2c69f8b76970e6efcb1deb80"},(0,c.kt)("inlineCode",{parentName:"a"},"ba3b780"))),(0,c.kt)("li",{parentName:"ul"},"implement debug pause button ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4fbe25d6403d63bac535f0957bdce8623c7b0c18"},(0,c.kt)("inlineCode",{parentName:"a"},"4fbe25d")))),(0,c.kt)("h4",{id:"v210"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.9...v2.1.0"},"v2.1.0")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add Buffer.from(); also hex toString(); v2.1.0 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/12032837b00407537b7f90e90d93ed48db2ee565"},(0,c.kt)("inlineCode",{parentName:"a"},"1203283"))),(0,c.kt)("li",{parentName:"ul"},"simplify bump ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/0db3c27b7d1af95f904885dc6f5d30d0500f0dc9"},(0,c.kt)("inlineCode",{parentName:"a"},"0db3c27")))),(0,c.kt)("h4",{id:"v209"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.8...v2.0.9"},"v2.0.9")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"23 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add native clear-settings; fixes #240 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/240"},(0,c.kt)("inlineCode",{parentName:"a"},"#240"))),(0,c.kt)("li",{parentName:"ul"},"feat: pir, rolling average ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/b12290cfa368cacce2f422d6f7518631938bd3bd"},(0,c.kt)("inlineCode",{parentName:"a"},"b12290c"))),(0,c.kt)("li",{parentName:"ul"},"fix: added emwa ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/be56296ee48df6e71f51d8d18369da1d099f98e5"},(0,c.kt)("inlineCode",{parentName:"a"},"be56296"))),(0,c.kt)("li",{parentName:"ul"},"set version in npms, publish extension ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e6a398dfaa9706cf0d396fabf7a6999bec959615"},(0,c.kt)("inlineCode",{parentName:"a"},"e6a398d")))),(0,c.kt)("h4",{id:"v208"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.7...v2.0.8"},"v2.0.8")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"22 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add analog docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/61d3c214e88c1b7133e893189157254ab78ef90b"},(0,c.kt)("inlineCode",{parentName:"a"},"61d3c21"))),(0,c.kt)("li",{parentName:"ul"},"bump jd-c ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c51e9aa8e56e7d93b9da2447abc147d4d9b307c1"},(0,c.kt)("inlineCode",{parentName:"a"},"c51e9aa")))),(0,c.kt)("h4",{id:"v207"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.6...v2.0.7"},"v2.0.7")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"22 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"build before publish ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/e9e7ee34ced4cd0e57376d4ebd62c85c9dc5d9db"},(0,c.kt)("inlineCode",{parentName:"a"},"e9e7ee3")))),(0,c.kt)("h4",{id:"v206"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.5...v2.0.6"},"v2.0.6")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"22 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"improve esptool detection ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/113a590d60f86490f52231228e3f32be76c9be13"},(0,c.kt)("inlineCode",{parentName:"a"},"113a590"))),(0,c.kt)("li",{parentName:"ul"},"fix 'devs flash esp32 --board xyz' ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f8d05c09cc32e466eb825497e3e825858c666256"},(0,c.kt)("inlineCode",{parentName:"a"},"f8d05c0"))),(0,c.kt)("li",{parentName:"ul"},"generate meta files with sizes ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/4c9fa0b2121ac6dfcb40e4d930837674848fa1a4"},(0,c.kt)("inlineCode",{parentName:"a"},"4c9fa0b")))),(0,c.kt)("h4",{id:"v205"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.4...v2.0.5"},"v2.0.5")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"22 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"Clear flash UI ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/241"},(0,c.kt)("inlineCode",{parentName:"a"},"#241"))),(0,c.kt)("li",{parentName:"ul"},"docs about vscode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/acccdbd36dc3494f06f0928f7aebd6b60ae6c277"},(0,c.kt)("inlineCode",{parentName:"a"},"acccdbd"))),(0,c.kt)("li",{parentName:"ul"},"initial i2c list ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d8799793b7de0b3443c04c52ebf43dd5cef16bf8"},(0,c.kt)("inlineCode",{parentName:"a"},"d879979"))),(0,c.kt)("li",{parentName:"ul"},"relative path generation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/d8c20269df08a081e80c53ecbc3330b9b59e9a38"},(0,c.kt)("inlineCode",{parentName:"a"},"d8c2026")))),(0,c.kt)("h4",{id:"v204"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.3...v2.0.4"},"v2.0.4")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"add Module.clearFlash(); fixes #240 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/240"},(0,c.kt)("inlineCode",{parentName:"a"},"#240"))),(0,c.kt)("li",{parentName:"ul"},"re-generate boards.json; bump jd-c ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/807735a1b59eb880fd778c32c58a73494cc3f47d"},(0,c.kt)("inlineCode",{parentName:"a"},"807735a"))),(0,c.kt)("li",{parentName:"ul"},"fix no wifi build ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/c632efc4ab98f54a226d9d9d3c03daaa1dc39f7b"},(0,c.kt)("inlineCode",{parentName:"a"},"c632efc"))),(0,c.kt)("li",{parentName:"ul"},"add hid sample ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2ace98777370ca830b4e742027d061a8ff3aff06"},(0,c.kt)("inlineCode",{parentName:"a"},"2ace987")))),(0,c.kt)("h4",{id:"v203"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.2...v2.0.3"},"v2.0.3")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"fix: beforeeach, aftereach in tests ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8a49c33e10db05fdd02025b27a23be9ca11bd1a3"},(0,c.kt)("inlineCode",{parentName:"a"},"8a49c33"))),(0,c.kt)("li",{parentName:"ul"},"try to fix npm 402 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/f1c9551a3c41e9ffd0809b40b84f1fed7c3240de"},(0,c.kt)("inlineCode",{parentName:"a"},"f1c9551"))),(0,c.kt)("li",{parentName:"ul"},"don't build C if tools not installed ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/8dbeeaead6f0bc7958a20bbe8aecc71f6d8e55a5"},(0,c.kt)("inlineCode",{parentName:"a"},"8dbeeae")))),(0,c.kt)("h4",{id:"v202"},(0,c.kt)("a",{parentName:"h4",href:"https://github.com/microsoft/devicescript/compare/v2.0.1...v2.0.2"},"v2.0.2")),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"try fixing npm publish ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/15b4cf1b69166127fc4db7b99d4bf92a9dda5fb1"},(0,c.kt)("inlineCode",{parentName:"a"},"15b4cf1")))),(0,c.kt)("h4",{id:"v201"},"v2.0.1"),(0,c.kt)("blockquote",null,(0,c.kt)("p",{parentName:"blockquote"},"21 March 2023")),(0,c.kt)("ul",null,(0,c.kt)("li",{parentName:"ul"},"synchronized bump script ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/238"},(0,c.kt)("inlineCode",{parentName:"a"},"#238"))),(0,c.kt)("li",{parentName:"ul"},"fix: replace * with ^version in packaged files ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/236"},(0,c.kt)("inlineCode",{parentName:"a"},"#236"))),(0,c.kt)("li",{parentName:"ul"},"fix: ability to open socket streaming device logging ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/230"},(0,c.kt)("inlineCode",{parentName:"a"},"#230"))),(0,c.kt)("li",{parentName:"ul"},"fix: update trackException ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/226"},(0,c.kt)("inlineCode",{parentName:"a"},"#226"))),(0,c.kt)("li",{parentName:"ul"},"fix: cleaning out role.connected ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/195"},(0,c.kt)("inlineCode",{parentName:"a"},"#195"))),(0,c.kt)("li",{parentName:"ul"},"feat: cloud api package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/193"},(0,c.kt)("inlineCode",{parentName:"a"},"#193"))),(0,c.kt)("li",{parentName:"ul"},"add marble rendering ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/190"},(0,c.kt)("inlineCode",{parentName:"a"},"#190"))),(0,c.kt)("li",{parentName:"ul"},"cloud simplification ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/187"},(0,c.kt)("inlineCode",{parentName:"a"},"#187"))),(0,c.kt)("li",{parentName:"ul"},"cleanup container experience ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/172"},(0,c.kt)("inlineCode",{parentName:"a"},"#172"))),(0,c.kt)("li",{parentName:"ul"},"pass over doc ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/145"},(0,c.kt)("inlineCode",{parentName:"a"},"#145"))),(0,c.kt)("li",{parentName:"ul"},"fix: use vscode built-in file system watcher ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/159"},(0,c.kt)("inlineCode",{parentName:"a"},"#159"))),(0,c.kt)("li",{parentName:"ul"},"start building on load extension ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/157"},(0,c.kt)("inlineCode",{parentName:"a"},"#157"))),(0,c.kt)("li",{parentName:"ul"},"fix: start build on start, update specs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/155"},(0,c.kt)("inlineCode",{parentName:"a"},"#155"))),(0,c.kt)("li",{parentName:"ul"},"feat: node.js simulation support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/154"},(0,c.kt)("inlineCode",{parentName:"a"},"#154"))),(0,c.kt)("li",{parentName:"ul"},"feat: add board command ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/152"},(0,c.kt)("inlineCode",{parentName:"a"},"#152"))),(0,c.kt)("li",{parentName:"ul"},"flash device as palette command ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/146"},(0,c.kt)("inlineCode",{parentName:"a"},"#146"))),(0,c.kt)("li",{parentName:"ul"},"feat: Custom service compilation ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/143"},(0,c.kt)("inlineCode",{parentName:"a"},"#143"))),(0,c.kt)("li",{parentName:"ul"},"Catalog ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/144"},(0,c.kt)("inlineCode",{parentName:"a"},"#144"))),(0,c.kt)("li",{parentName:"ul"},"feat: support --install flag in init ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/142"},(0,c.kt)("inlineCode",{parentName:"a"},"#142"))),(0,c.kt)("li",{parentName:"ul"},"feat: no-colors mode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/140"},(0,c.kt)("inlineCode",{parentName:"a"},"#140"))),(0,c.kt)("li",{parentName:"ul"},"cloud tree items ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/135"},(0,c.kt)("inlineCode",{parentName:"a"},"#135"))),(0,c.kt)("li",{parentName:"ul"},"fix: tree unsubscription ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/131"},(0,c.kt)("inlineCode",{parentName:"a"},"#131"))),(0,c.kt)("li",{parentName:"ul"},"fix: nag user to start dashboard on debugger start + missing roles ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/123"},(0,c.kt)("inlineCode",{parentName:"a"},"#123"))),(0,c.kt)("li",{parentName:"ul"},"trying to fix ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/120"},(0,c.kt)("inlineCode",{parentName:"a"},"#120"))),(0,c.kt)("li",{parentName:"ul"},"fix: stop vm worker on debug session close ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/118"},(0,c.kt)("inlineCode",{parentName:"a"},"#118"))),(0,c.kt)("li",{parentName:"ul"},"more aggressive about killing worker ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/114"},(0,c.kt)("inlineCode",{parentName:"a"},"#114"))),(0,c.kt)("li",{parentName:"ul"},"fix: telemetry + windows ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/104"},(0,c.kt)("inlineCode",{parentName:"a"},"#104"))),(0,c.kt)("li",{parentName:"ul"},"fix: better support for empty workspace, remote ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/102"},(0,c.kt)("inlineCode",{parentName:"a"},"#102"))),(0,c.kt)("li",{parentName:"ul"},"Docusaurus2.3 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/91"},(0,c.kt)("inlineCode",{parentName:"a"},"#91"))),(0,c.kt)("li",{parentName:"ul"},"fix: update cli info about build --watch ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/90"},(0,c.kt)("inlineCode",{parentName:"a"},"#90"))),(0,c.kt)("li",{parentName:"ul"},"support for cloud management of devices ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/88"},(0,c.kt)("inlineCode",{parentName:"a"},"#88"))),(0,c.kt)("li",{parentName:"ul"},"contribute icons to vscode ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/87"},(0,c.kt)("inlineCode",{parentName:"a"},"#87"))),(0,c.kt)("li",{parentName:"ul"},"actively check version numbers + debugger start fix ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/76"},(0,c.kt)("inlineCode",{parentName:"a"},"#76"))),(0,c.kt)("li",{parentName:"ul"},"Device pick and remember ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/62"},(0,c.kt)("inlineCode",{parentName:"a"},"#62"))),(0,c.kt)("li",{parentName:"ul"},"devtools cli refactor ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/61"},(0,c.kt)("inlineCode",{parentName:"a"},"#61"))),(0,c.kt)("li",{parentName:"ul"},"Device Tree in VS Code ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/60"},(0,c.kt)("inlineCode",{parentName:"a"},"#60"))),(0,c.kt)("li",{parentName:"ul"},"more tooling support through rise4fun ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/57"},(0,c.kt)("inlineCode",{parentName:"a"},"#57"))),(0,c.kt)("li",{parentName:"ul"},"patch: document vm apis ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/52"},(0,c.kt)("inlineCode",{parentName:"a"},"#52"))),(0,c.kt)("li",{parentName:"ul"},"patch: support for runtime_version ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/51"},(0,c.kt)("inlineCode",{parentName:"a"},"#51"))),(0,c.kt)("li",{parentName:"ul"},"add runtime version reg ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/44"},(0,c.kt)("inlineCode",{parentName:"a"},"#44"))),(0,c.kt)("li",{parentName:"ul"},"Api comments ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/50"},(0,c.kt)("inlineCode",{parentName:"a"},"#50"))),(0,c.kt)("li",{parentName:"ul"},"patch: rename registernumber ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/49"},(0,c.kt)("inlineCode",{parentName:"a"},"#49"))),(0,c.kt)("li",{parentName:"ul"},"patch: concurrent execution of compiles ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/42"},(0,c.kt)("inlineCode",{parentName:"a"},"#42"))),(0,c.kt)("li",{parentName:"ul"},"Markdown docs: generate markdown files for DS services ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/38"},(0,c.kt)("inlineCode",{parentName:"a"},"#38"))),(0,c.kt)("li",{parentName:"ul"},"test breaking build ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/37"},(0,c.kt)("inlineCode",{parentName:"a"},"#37"))),(0,c.kt)("li",{parentName:"ul"},"patch: rename generate compiler files ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/30"},(0,c.kt)("inlineCode",{parentName:"a"},"#30"))),(0,c.kt)("li",{parentName:"ul"},"fix: codesandbox support ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/29"},(0,c.kt)("inlineCode",{parentName:"a"},"#29"))),(0,c.kt)("li",{parentName:"ul"},"patch: specify to embed built files in package ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/24"},(0,c.kt)("inlineCode",{parentName:"a"},"#24"))),(0,c.kt)("li",{parentName:"ul"},"feat: support for init command ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/23"},(0,c.kt)("inlineCode",{parentName:"a"},"#23"))),(0,c.kt)("li",{parentName:"ul"},"better control of simulator in docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/22"},(0,c.kt)("inlineCode",{parentName:"a"},"#22"))),(0,c.kt)("li",{parentName:"ul"},"patch: add devtools options ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/21"},(0,c.kt)("inlineCode",{parentName:"a"},"#21"))),(0,c.kt)("li",{parentName:"ul"},"patch: build --watch ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/20"},(0,c.kt)("inlineCode",{parentName:"a"},"#20"))),(0,c.kt)("li",{parentName:"ul"},"add semantic release build files ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/19"},(0,c.kt)("inlineCode",{parentName:"a"},"#19"))),(0,c.kt)("li",{parentName:"ul"},"Const samples ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/17"},(0,c.kt)("inlineCode",{parentName:"a"},"#17"))),(0,c.kt)("li",{parentName:"ul"},"Removing monaco editor ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/14"},(0,c.kt)("inlineCode",{parentName:"a"},"#14"))),(0,c.kt)("li",{parentName:"ul"},"show jacdac dasboard as split pane ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/13"},(0,c.kt)("inlineCode",{parentName:"a"},"#13"))),(0,c.kt)("li",{parentName:"ul"},"cleaning up cli ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/12"},(0,c.kt)("inlineCode",{parentName:"a"},"#12"))),(0,c.kt)("li",{parentName:"ul"},"export compile function ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/11"},(0,c.kt)("inlineCode",{parentName:"a"},"#11"))),(0,c.kt)("li",{parentName:"ul"},"build compiler into web site ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/10"},(0,c.kt)("inlineCode",{parentName:"a"},"#10"))),(0,c.kt)("li",{parentName:"ul"},"pre-compile samples in docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/5"},(0,c.kt)("inlineCode",{parentName:"a"},"#5"))),(0,c.kt)("li",{parentName:"ul"},"support for mermaid for docs ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/3"},(0,c.kt)("inlineCode",{parentName:"a"},"#3"))),(0,c.kt)("li",{parentName:"ul"},"creating docs web site ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/pull/2"},(0,c.kt)("inlineCode",{parentName:"a"},"#2"))),(0,c.kt)("li",{parentName:"ul"},"support ignored &&; fixes #184 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/184"},(0,c.kt)("inlineCode",{parentName:"a"},"#184"))),(0,c.kt)("li",{parentName:"ul"},"isConnected -",">"," isBound; fixes #196 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/196"},(0,c.kt)("inlineCode",{parentName:"a"},"#196"))),(0,c.kt)("li",{parentName:"ul"},"better start server docs; fixes #215 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/215"},(0,c.kt)("inlineCode",{parentName:"a"},"#215"))),(0,c.kt)("li",{parentName:"ul"},"sleepMs-",">","sleep; fixes #214 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/214"},(0,c.kt)("inlineCode",{parentName:"a"},"#214"))),(0,c.kt)("li",{parentName:"ul"},"fix pointer checks; fixes #203 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/203"},(0,c.kt)("inlineCode",{parentName:"a"},"#203"))),(0,c.kt)("li",{parentName:"ul"},"add ds.isSimulator(); fixes #119 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/119"},(0,c.kt)("inlineCode",{parentName:"a"},"#119"))),(0,c.kt)("li",{parentName:"ul"},"support for program name/version; fixes #170 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/170"},(0,c.kt)("inlineCode",{parentName:"a"},"#170"))),(0,c.kt)("li",{parentName:"ul"},"fix #199 (super call) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/199"},(0,c.kt)("inlineCode",{parentName:"a"},"#199"))),(0,c.kt)("li",{parentName:"ul"},"disallow 'var'; fixes #4 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/4"},(0,c.kt)("inlineCode",{parentName:"a"},"#4"))),(0,c.kt)("li",{parentName:"ul"},"remove _onstart; fixes #183 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/183"},(0,c.kt)("inlineCode",{parentName:"a"},"#183"))),(0,c.kt)("li",{parentName:"ul"},"fix 'extends Error'; fixes #176 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/176"},(0,c.kt)("inlineCode",{parentName:"a"},"#176"))),(0,c.kt)("li",{parentName:"ul"},"don't mask exception from compilation process ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/171"},(0,c.kt)("inlineCode",{parentName:"a"},"#171"))),(0,c.kt)("li",{parentName:"ul"},"add --quiet option, fix #166 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/166"},(0,c.kt)("inlineCode",{parentName:"a"},"#166"))),(0,c.kt)("li",{parentName:"ul"},"cut down devs init, add devs add sim/service; fixes #165 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/165"},(0,c.kt)("inlineCode",{parentName:"a"},"#165"))),(0,c.kt)("li",{parentName:"ul"},"always use fancy logging; fixes #103 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/103"},(0,c.kt)("inlineCode",{parentName:"a"},"#103"))),(0,c.kt)("li",{parentName:"ul"},"rename devices, fix #77 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/77"},(0,c.kt)("inlineCode",{parentName:"a"},"#77"))),(0,c.kt)("li",{parentName:"ul"},"try to fix cli deps; fixes #70 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/70"},(0,c.kt)("inlineCode",{parentName:"a"},"#70"))),(0,c.kt)("li",{parentName:"ul"},"better error object (fixes #15) ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/15"},(0,c.kt)("inlineCode",{parentName:"a"},"#15"))),(0,c.kt)("li",{parentName:"ul"},"remove junk; fixes #16 ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/issues/16"},(0,c.kt)("inlineCode",{parentName:"a"},"#16"))),(0,c.kt)("li",{parentName:"ul"},"moving projects around ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2e25a9c1ee5633c232a070dc2d2643d24f6ac783"},(0,c.kt)("inlineCode",{parentName:"a"},"2e25a9c"))),(0,c.kt)("li",{parentName:"ul"},"more docs updates ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/2b61362b6d606b2a4f543c397f665df4492ea5dd"},(0,c.kt)("inlineCode",{parentName:"a"},"2b61362"))),(0,c.kt)("li",{parentName:"ul"},"refactor and hide pipe for now ",(0,c.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/commit/dd04b265f78e1abca8d1cae8b80adee79bb54b96"},(0,c.kt)("inlineCode",{parentName:"a"},"dd04b26")))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7735.117b16ff.js b/assets/js/7735.117b16ff.js new file mode 100644 index 00000000000..7022d2ae25a --- /dev/null +++ b/assets/js/7735.117b16ff.js @@ -0,0 +1,2 @@ +/*! For license information please see 7735.117b16ff.js.LICENSE.txt */ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7735],{43203:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i<r.length;i++)null==(n=r[i]).getChild()?(n.moveBy(e,t),n.displacementX+=e,n.displacementY+=t):n.propogateDisplacementToChildren(e,t)},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a},function(e,t,n){"use strict";var r=n(0).FDLayout,i=n(4),a=n(3),o=n(5),s=n(2),l=n(1),u=n(0).FDLayoutConstants,c=n(0).LayoutConstants,h=n(0).Point,d=n(0).PointD,p=n(0).Layout,g=n(0).Integer,f=n(0).IGeometry,v=n(0).LGraph,y=n(0).Transform;function m(){r.call(this),this.toBeTiled={}}for(var b in m.prototype=Object.create(r.prototype),r)m[b]=r[b];m.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},m.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},m.prototype.newNode=function(e){return new o(this.graphManager,e)},m.prototype.newEdge=function(e){return new s(null,null,e)},m.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=u.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=u.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=u.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=u.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=u.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/u.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=u.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},m.prototype.layout=function(){return c.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},m.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)l.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)})),this.graphManager.setAllNodesToApplyGravitation(n));else{var e=this.getFlatForest();if(e.length>0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},m.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},m.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},m.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if("during"===u.ANIMATE)this.emit("layoutstarted");else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},m.prototype.calculateNodesToApplyGravitationTo=function(){var e,t,n=[],r=this.graphManager.getGraphs(),i=r.length;for(t=0;t<i;t++)(e=r[t]).updateConnected(),e.isConnected||(n=n.concat(e.getNodes()));return n},m.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t,n=new Set;for(t=0;t<e.length;t++){var r=e[t];if(!n.has(r)){var i=r.getSource(),a=r.getTarget();if(i==a)r.getBendpoints().push(new d),r.getBendpoints().push(new d),this.createDummyNodesForBendpoints(r),n.add(r);else{var o=[];if(o=(o=o.concat(i.getEdgeListToNode(a))).concat(a.getEdgeListToNode(i)),!n.has(o[0])){var s;if(o.length>1)for(s=0;s<o.length;s++){var l=o[s];l.getBendpoints().push(new d),this.createDummyNodesForBendpoints(l)}o.forEach((function(e){n.add(e)}))}}}if(n.size==e.length)break}},m.prototype.positionNodesRadially=function(e){for(var t=new h(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new d(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,0!=s&&(i+=l.DEFAULT_COMPONENT_SEPERATION),r=0);var u=e[s],g=p.findCenterOfTree(u);t.x=a,t.y=i,(o=m.radialLayout(u,g,t)).y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(c.WORLD_CENTER_X-o.x/2,c.WORLD_CENTER_Y-o.y/2))},m.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);m.branchRadialLayout(t,null,0,359,0,r);var i=v.calculateBounds(e),a=new y;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new d(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},m.branchRadialLayout=function(e,t,n,r,i,a){var o=(r-n+1)/2;o<0&&(o+=180);var s=(o+n)%360*f.TWO_PI/360,l=(Math.cos(s),i*Math.cos(s)),u=i*Math.sin(s);e.setCenter(l,u);var c=[],h=(c=c.concat(e.getEdges())).length;null!=t&&h--;for(var d,p=0,g=c.length,v=e.getEdgesBetween(t);v.length>1;){var y=v[0];v.splice(0,1);var b=c.indexOf(y);b>=0&&c.splice(b,1),g--,h--}d=null!=t?(c.indexOf(v[0])+1)%g:0;for(var x=Math.abs(r-n)/h,w=d;p!=h;w=++w%g){var E=c[w].getOtherEnd(e);if(E!=t){var T=(n+p*x)%360,_=(T+x)%360;m.branchRadialLayout(E,e,T,_,i+a,a),p++}}},m.maxDiagonalInTree=function(e){for(var t=g.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},m.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},m.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=(s=r[i]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=a.id&&this.getToBeTiled(a)||n.push(s)}for(i=0;i<n.length;i++){var s,l=(s=n[i]).getParent().id;void 0===t[l]&&(t[l]=[]),t[l]=t[l].concat(s)}Object.keys(t).forEach((function(n){if(t[n].length>1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u<t[n].length;u++){var c=t[n][u];l.remove(c),s.add(c)}}}))},m.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},m.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(n){var r=e.idToDummyNode[n];t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height}))},m.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},m.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach((function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)}))},m.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(null!=a.getChild()){if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}else this.toBeTiled[a.id]=!1}return this.toBeTiled[t]=!0,!0},m.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},m.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(null==e.getChild())return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},m.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},m.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];null!=n.getChild()&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},m.prototype.adjustLocations=function(e,t,n,r,i){n+=i;for(var a=t+=r,o=0;o<e.rows.length;o++){var s=e.rows[o];t=a;for(var l=0,u=0;u<s.length;u++){var c=s[u];c.rect.x=t,c.rect.y=n,t+=c.rect.width+e.horizontalPadding,c.rect.height>l&&(l=c.rect.height)}n+=l+e.verticalPadding}},m.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach((function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height}))},m.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:l.TILING_PADDING_VERTICAL,horizontalPadding:l.TILING_PADDING_HORIZONTAL};e.sort((function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height<t.rect.width*t.rect.height?1:0}));for(var r=0;r<e.length;r++){var i=e[r];0==n.rows.length?this.insertNodeToRow(n,i,0,t):this.canAddHorizontal(n,i.rect.width,i.rect.height)?this.insertNodeToRow(n,i,this.getShortestRowIndex(n),t):this.insertNodeToRow(n,i,n.rows.length,t),this.shiftToLastRow(n)}return n},m.prototype.insertNodeToRow=function(e,t,n,r){var i=r;n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(i),e.rowHeight.push(0));var a=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width<a&&(e.width=a);var o=t.rect.height;n>0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},m.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},m.prototype.getLongestRowIndex=function(e){for(var t=-1,n=Number.MIN_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},m.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a,o,s=0;return e.rowHeight[r]<n&&r>0&&(s=n+e.verticalPadding-e.rowHeight[r]),a=e.width-i>=t+e.horizontalPadding?(e.height+s)/(i+t+e.horizontalPadding):(e.height+s)/e.width,s=n+e.verticalPadding,(o=e.width<t?(e.height+s)/t:(e.height+s)/e.width)<1&&(o=1/o),a<1&&(a=1/a),a<o},m.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var u=e.rowHeight[t]+e.rowHeight[n];e.height+=u-l,this.shiftToLastRow(e)}},m.prototype.tilingPreLayout=function(){l.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},m.prototype.tilingPostLayout=function(){l.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},m.prototype.reduceTrees=function(){for(var e,t=[],n=!0;n;){var r=this.graphManager.getAllNodes(),i=[];n=!1;for(var a=0;a<r.length;a++)1!=(e=r[a]).getEdges().length||e.getEdges()[0].isInterGraph||null!=e.getChild()||(i.push([e,e.getEdges()[0],e.getOwner()]),n=!0);if(1==n){for(var o=[],s=0;s<i.length;s++)1==i[s][0].getEdges().length&&(o.push(i[s]),i[s][0].getOwner().remove(i[s][0]));t.push(o),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},m.prototype.growTree=function(e){for(var t,n=e[e.length-1],r=0;r<n.length;r++)t=n[r],this.findPlaceforPrunedNode(t),t[2].add(t[0]),t[2].add(t[1],t[1].source,t[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},m.prototype.findPlaceforPrunedNode=function(e){var t,n,r=e[0],i=(n=r==e[1].source?e[1].target:e[1].source).startX,a=n.finishX,o=n.startY,s=n.finishY,l=[0,0,0,0];if(o>0)for(var c=i;c<=a;c++)l[0]+=this.grid[c][o-1].length+this.grid[c][o].length-1;if(a<this.grid.length-1)for(c=o;c<=s;c++)l[1]+=this.grid[a+1][c].length+this.grid[a][c].length-1;if(s<this.grid[0].length-1)for(c=i;c<=a;c++)l[2]+=this.grid[c][s+1].length+this.grid[c][s].length-1;if(i>0)for(c=o;c<=s;c++)l[3]+=this.grid[i-1][c].length+this.grid[i][c].length-1;for(var h,d,p=g.MAX_VALUE,f=0;f<l.length;f++)l[f]<p?(p=l[f],h=1,d=f):l[f]==p&&h++;if(3==h&&0==p)0==l[0]&&0==l[1]&&0==l[2]?t=1:0==l[0]&&0==l[1]&&0==l[3]?t=0:0==l[0]&&0==l[2]&&0==l[3]?t=3:0==l[1]&&0==l[2]&&0==l[3]&&(t=2);else if(2==h&&0==p){var v=Math.floor(2*Math.random());t=0==l[0]&&0==l[1]?0==v?0:1:0==l[0]&&0==l[2]?0==v?0:2:0==l[0]&&0==l[3]?0==v?0:3:0==l[1]&&0==l[2]?0==v?1:2:0==l[1]&&0==l[3]?0==v?1:3:0==v?2:3}else t=4==h&&0==p?v=Math.floor(4*Math.random()):d;0==t?r.setCenter(n.getCenterX(),n.getCenterY()-n.getHeight()/2-u.DEFAULT_EDGE_LENGTH-r.getHeight()/2):1==t?r.setCenter(n.getCenterX()+n.getWidth()/2+u.DEFAULT_EDGE_LENGTH+r.getWidth()/2,n.getCenterY()):2==t?r.setCenter(n.getCenterX(),n.getCenterY()+n.getHeight()/2+u.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(n.getCenterX()-n.getWidth()/2-u.DEFAULT_EDGE_LENGTH-r.getWidth()/2,n.getCenterY())},e.exports=m},function(e,t,n){"use strict";var r={};r.layoutBase=n(0),r.CoSEConstants=n(1),r.CoSEEdge=n(2),r.CoSEGraph=n(3),r.CoSEGraphManager=n(4),r.CoSELayout=n(6),r.CoSENode=n(5),e.exports=r}])},e.exports=r(n(54899))},35302:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(0).layoutBase.LayoutConstants,i=n(0).layoutBase.FDLayoutConstants,a=n(0).CoSEConstants,o=n(0).CoSELayout,s=n(0).CoSENode,l=n(0).layoutBase.PointD,u=n(0).layoutBase.DimensionD,c={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function h(e){this.options=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}(c,e),d(this.options)}var d=function(e){null!=e.nodeRepulsion&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),null!=e.idealEdgeLength&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),null!=e.edgeElasticity&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),null!=e.nestingFactor&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),"draft"==e.quality?r.QUALITY=0:"proof"==e.quality?r.QUALITY=2:r.QUALITY=1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=r.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL="function"==typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL="function"==typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};h.prototype.run=function(){var e,t,n=this.options,r=(this.idToLNode={},this.layout=new o),i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var a=r.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),l=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),r);for(var u=0;u<l.length;u++){var c=l[u],h=this.idToLNode[c.data("source")],d=this.idToLNode[c.data("target")];h!==d&&0==h.getEdgesBetween(d).length&&(a.add(r.newEdge(),h,d).id=c.id())}var p=function(e,t){"number"==typeof e&&(e=t);var n=e.data("id"),r=i.idToLNode[n];return{x:r.getRect().getCenterX(),y:r.getRect().getCenterY()}},g=function a(){for(var o,s=function(){n.fit&&n.cy.fit(n.eles,n.padding),e||(e=!0,i.cy.one("layoutready",n.ready),i.cy.trigger({type:"layoutready",layout:i}))},l=i.options.refresh,u=0;u<l&&!o;u++)o=i.stopped||i.layout.tick();if(o)return r.checkLayoutSuccess()&&!r.isSubLayout&&r.doPostLayout(),r.tilingPostLayout&&r.tilingPostLayout(),r.isLayoutFinished=!0,i.options.eles.nodes().positions(p),s(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t&&cancelAnimationFrame(t),void(e=!1);var c=i.layout.getPositionsData();n.eles.nodes().positions((function(e,t){if("number"==typeof e&&(e=t),!e.isParent()){for(var n=e.id(),r=c[n],i=e;null==r&&(r=c[i.data("parent")]||c["DummyCompound_"+i.data("parent")],c[n]=r,null!=(i=i.parent()[0])););return null!=r?{x:r.x,y:r.y}:{x:e.position("x"),y:e.position("y")}}})),s(),t=requestAnimationFrame(a)};return r.addListener("layoutstarted",(function(){"during"===i.options.animate&&(t=requestAnimationFrame(g))})),r.runLayout(),"during"!==this.options.animate&&(i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,p),e=!1),this},h.prototype.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;var r=e.filter((function(e,n){"number"==typeof e&&(e=n);for(var r=e.parent()[0];null!=r;){if(t[r.id()])return!1;r=r.parent()[0]}return!0}));return r},h.prototype.processChildrenList=function(e,t,n){for(var r=t.length,i=0;i<r;i++){var a,o,c=t[i],h=c.children(),d=c.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if((a=null!=c.outerWidth()&&null!=c.outerHeight()?e.add(new s(n.graphManager,new l(c.position("x")-d.w/2,c.position("y")-d.h/2),new u(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager))).id=c.data("id"),a.paddingLeft=parseInt(c.css("padding")),a.paddingTop=parseInt(c.css("padding")),a.paddingRight=parseInt(c.css("padding")),a.paddingBottom=parseInt(c.css("padding")),this.options.nodeDimensionsIncludeLabels&&c.isParent()){var p=c.boundingBox({includeLabels:!0,includeNodes:!1}).w,g=c.boundingBox({includeLabels:!0,includeNodes:!1}).h,f=c.css("text-halign");a.labelWidth=p,a.labelHeight=g,a.labelPos=f}this.idToLNode[c.data("id")]=a,isNaN(a.rect.x)&&(a.rect.x=0),isNaN(a.rect.y)&&(a.rect.y=0),null!=h&&h.length>0&&(o=n.getGraphManager().add(n.newGraph(),a),this.processChildrenList(o,h,n))}},h.prototype.stop=function(){return this.stopped=!0,this};var p=function(e){e("layout","cose-bilkent",h)};"undefined"!=typeof cytoscape&&p(cytoscape),e.exports=p}])},e.exports=r(n(43203))},14413:function(e,t,n){e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return s(e)||l(e,t)||u(e,t)||h()}function s(e){if(Array.isArray(e))return e}function l(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(l){s=!0,i=l}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d="undefined"==typeof window?null:window,p=d?d.navigator:null;d&&d.document;var g=e(""),f=e({}),v=e((function(){})),y="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),m=function(e){return e&&e.instanceString&&x(e.instanceString)?e.instanceString():null},b=function(t){return null!=t&&e(t)==g},x=function(t){return null!=t&&e(t)===v},w=function(e){return!N(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},E=function(t){return null!=t&&e(t)===f&&!w(t)&&t.constructor===Object},T=function(t){return null!=t&&e(t)===f},_=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},D=function(e){return _(e)&&Math.floor(e)===e},C=function(e){return"undefined"===y?void 0:null!=e&&e instanceof HTMLElement},N=function(e){return A(e)||L(e)},A=function(e){return"collection"===m(e)&&e._private.single},L=function(e){return"collection"===m(e)&&!e._private.single},S=function(e){return"core"===m(e)},O=function(e){return"stylesheet"===m(e)},I=function(e){return"event"===m(e)},k=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},M=function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement},P=function(e){return E(e)&&_(e.x1)&&_(e.x2)&&_(e.y1)&&_(e.y2)},R=function(e){return T(e)&&x(e.then)},B=function(){return p&&p.userAgent.match(/msie|trident|edge/i)},F=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,i=this,a=arguments,o=t.apply(i,a),s=n.cache;return(r=s[o])||(r=s[o]=e.apply(i,a)),r};return n.cache={},n},z=F((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),G=F((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),Y=F((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),X=function(e){return k(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},V="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",U="rgb[a]?\\(("+V+"[%]?)\\s*,\\s*("+V+"[%]?)\\s*,\\s*("+V+"[%]?)(?:\\s*,\\s*("+V+"))?\\)",j="rgb[a]?\\((?:"+V+"[%]?)\\s*,\\s*(?:"+V+"[%]?)\\s*,\\s*(?:"+V+"[%]?)(?:\\s*,\\s*(?:"+V+"))?\\)",H="hsl[a]?\\(("+V+")\\s*,\\s*("+V+"[%])\\s*,\\s*("+V+"[%])(?:\\s*,\\s*("+V+"))?\\)",q="hsl[a]?\\((?:"+V+")\\s*,\\s*(?:"+V+"[%])\\s*,\\s*(?:"+V+"[%])(?:\\s*,\\s*(?:"+V+"))?\\)",W="\\#[0-9a-fA-F]{3}",$="\\#[0-9a-fA-F]{6}",K=function(e,t){return e<t?-1:e>t?1:0},Z=function(e,t){return-1*K(e,t)},Q=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},J=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r,i=16;return 4===e.length?(t=parseInt(e[1]+e[1],i),n=parseInt(e[2]+e[2],i),r=parseInt(e[3]+e[3],i)):(t=parseInt(e[1]+e[2],i),n=parseInt(e[3]+e[4],i),r=parseInt(e[5]+e[6],i)),[t,n,r]}},ee=function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+H+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t},te=function(e){var t,n=new RegExp("^"+U+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},ne=function(e){return ie[e.toLowerCase()]},re=function(e){return(w(e)?e:null)||ne(e)||J(e)||te(e)||ee(e)},ie={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ae=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(E(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},oe=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(E(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))return t}return t};function se(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var le=se,ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function ce(e,t){return e(t={exports:{}},t.exports),t.exports}var he="object"==typeof ue&&ue&&ue.Object===Object&&ue,de="object"==typeof self&&self&&self.Object===Object&&self,pe=he||de||Function("return this")(),ge=function(){return pe.Date.now()},fe=/\s/;function ve(e){for(var t=e.length;t--&&fe.test(e.charAt(t)););return t}var ye=ve,me=/^\s+/;function be(e){return e?e.slice(0,ye(e)+1).replace(me,""):e}var xe=be,we=pe.Symbol,Ee=Object.prototype,Te=Ee.hasOwnProperty,_e=Ee.toString,De=we?we.toStringTag:void 0;function Ce(e){var t=Te.call(e,De),n=e[De];try{e[De]=void 0;var r=!0}catch(a){}var i=_e.call(e);return r&&(t?e[De]=n:delete e[De]),i}var Ne=Ce,Ae=Object.prototype.toString;function Le(e){return Ae.call(e)}var Se=Le,Oe="[object Null]",Ie="[object Undefined]",ke=we?we.toStringTag:void 0;function Me(e){return null==e?void 0===e?Ie:Oe:ke&&ke in Object(e)?Ne(e):Se(e)}var Pe=Me;function Re(e){return null!=e&&"object"==typeof e}var Be=Re,Fe="[object Symbol]";function ze(e){return"symbol"==typeof e||Be(e)&&Pe(e)==Fe}var Ge=ze,Ye=NaN,Xe=/^[-+]0x[0-9a-f]+$/i,Ve=/^0b[01]+$/i,Ue=/^0o[0-7]+$/i,je=parseInt;function He(e){if("number"==typeof e)return e;if(Ge(e))return Ye;if(le(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=le(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=xe(e);var n=Ve.test(e);return n||Ue.test(e)?je(e.slice(2),n?2:8):Xe.test(e)?Ye:+e}var qe=He,We="Expected a function",$e=Math.max,Ke=Math.min;function Ze(e,t,n){var r,i,a,o,s,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(We);function p(t){var n=r,a=i;return r=i=void 0,u=t,o=e.apply(a,n)}function g(e){return u=e,s=setTimeout(y,t),c?p(e):o}function f(e){var n=t-(e-l);return h?Ke(n,a-(e-u)):n}function v(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-u>=a}function y(){var e=ge();if(v(e))return m(e);s=setTimeout(y,f(e))}function m(e){return s=void 0,d&&r?p(e):(r=i=void 0,o)}function b(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0}function x(){return void 0===s?o:m(ge())}function w(){var e=ge(),n=v(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return g(l);if(h)return clearTimeout(s),s=setTimeout(y,t),p(l)}return void 0===s&&(s=setTimeout(y,t)),o}return t=qe(t)||0,le(n)&&(c=!!n.leading,a=(h="maxWait"in n)?$e(qe(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),w.cancel=b,w.flush=x,w}var Qe=Ze,Je=d?d.performance:null,et=Je&&Je.now?function(){return Je.now()}:function(){return Date.now()},tt=function(){if(d){if(d.requestAnimationFrame)return function(e){d.requestAnimationFrame(e)};if(d.mozRequestAnimationFrame)return function(e){d.mozRequestAnimationFrame(e)};if(d.webkitRequestAnimationFrame)return function(e){d.webkitRequestAnimationFrame(e)};if(d.msRequestAnimationFrame)return function(e){d.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(et())}),1e3/60)}}(),nt=function(e){return tt(e)},rt=et,it=9261,at=65599,ot=5381,st=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;!(t=e.next()).done;)n=n*at+t.value|0;return n},lt=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:it)*at+e|0},ut=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ot;return(t<<5)+t+e|0},ct=function(e,t){return 2097152*e+t},ht=function(e){return 2097152*e[0]+e[1]},dt=function(e,t){return[lt(e[0],t[0]),ut(e[1],t[1])]},pt=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return st({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},gt=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return st({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},ft=function(){return vt(arguments)},vt=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?gt(r):gt(r,t)}return t},yt=!0,mt=null!=console.warn,bt=null!=console.trace,xt=Number.MAX_SAFE_INTEGER||9007199254740991,wt=function(){return!0},Et=function(){return!1},Tt=function(){return 0},_t=function(){},Dt=function(e){throw new Error(e)},Ct=function(e){if(void 0===e)return yt;yt=!!e},Nt=function(e){Ct()&&(mt?console.warn(e):(console.log(e),bt&&console.trace()))},At=function(e){return Q({},e)},Lt=function(e){return null==e?e:w(e)?e.slice():E(e)?At(e):e},St=function(e){return e.slice()},Ot=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},It={},kt=function(){return It},Mt=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},Pt=function(e,t,n){for(var r=e.length-1;r>=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Rt=function(e){e.splice(0,e.length)},Bt=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},Ft=function(e,t,n){return n&&(t=Y(n,t)),e[t]},zt=function(e,t,n,r){n&&(t=Y(n,t)),e[t]=r},Gt=function(){function e(){t(this,e),this._obj={}}return i(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Yt="undefined"!=typeof Map?Map:Gt,Xt="undefined",Vt=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i<r.length;i++)this.add(r[i])}}return i(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter((function(t){return e.has(t)}))}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),Ut=("undefined"==typeof Set?"undefined":e(Set))!==Xt?Set:Vt,jt=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&S(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Ut,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];w(t.classes)?l=t.classes:b(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter();var d=t.style||t.css;d&&(Nt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d)),(void 0===n||n)&&this.restore()}else Dt("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else Dt("An element must have a core reference and parameters set")},Ht=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;E(t)&&!N(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!==arguments.length||x(n)?r:n,n=x(n)?n:function(){};for(var a,o=this._private.cy,s=t=b(t)?this.filter(t):t,l=[],u=[],c={},h={},d={},p=0,g=this.byGroup(),f=g.nodes,v=g.edges,y=0;y<s.length;y++){var m=s[y],w=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(d[w]=!0,u.push(m)),h[w]=0)}for(var T=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(d[i])return"continue";d[i]=!0,u.push(t)}var o=h[i],s=c[i],g=null!=s?s.source():null,y=null!=s?s.target():null,m=null==s?void 0:t.same(g)?y[0]:g[0],b=void 0;if(!0===(b=n(t,s,m,p++,o)))return a=t,"break";if(!1===b)return"break";for(var x=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&v.has(e)})),w=0;w<x.length;w++){var E=x[w],T=E.connectedNodes().filter((function(e){return!e.same(t)&&f.has(e)})),_=T.id();0===T.length||d[_]||(T=T[0],l.push(T),e.bfs&&(d[_]=!0,u.push(T)),c[_]=E,h[_]=h[i]+1)}};0!==l.length;){var _=T();if("continue"!==_&&"break"===_)break}for(var D=o.collection(),C=0;C<u.length;C++){var A=u[C],L=c[A.id()];null!=L&&D.push(L),D.push(A)}return{path:o.collection(D),found:o.collection(a)}}},qt={breadthFirstSearch:Ht({bfs:!0}),depthFirstSearch:Ht({dfs:!0})};qt.bfs=qt.breadthFirstSearch,qt.dfs=qt.depthFirstSearch;var Wt=ce((function(e,t){(function(){var t,n,r,i,a,o,s,l,u,c,h,d,p,g,f;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);i<a;)o(t,e[s=r((i+a)/2)])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),g(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,f(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,f(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&r(e[0],t)<0&&(t=(i=[e[0],t])[0],e[0]=i[1],f(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),l=[],a=0,o=(s=function(){u=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;a<o;a++)i=s[a],l.push(f(e,i,t));return l},p=function(e,t,r){var i;if(null==r&&(r=n),-1!==(i=e.indexOf(t)))return g(e,0,i,r),f(e,i,r)},h=function(e,t,r){var a,o,l,u,c;if(null==r&&(r=n),!(o=e.slice(0,t)).length)return o;for(i(o,r),l=0,u=(c=e.slice(t)).length;l<u;l++)a=c[l],s(o,a,r);return o.sort(r).reverse()},d=function(e,t,r){var o,s,l,h,d,p,g,f,v;if(null==r&&(r=n),10*t<=e.length){if(!(l=e.slice(0,t).sort(r)).length)return l;for(s=l[l.length-1],h=0,p=(g=e.slice(t)).length;h<p;h++)r(o=g[h],s)<0&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,f=c(t,e.length);0<=f?d<f:d>f;0<=f?++d:--d)v.push(a(e,r));return v},g=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},f=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i<a;)(s=i+1)<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],i=2*(t=i)+1;return e[t]=o,g(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=h,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),function(t,n){e.exports=n()}(0,(function(){return t}))}).call(ue)})),$t=Wt,Kt=Mt({root:null,weight:function(e){return 1},directed:!1}),Zt={dijkstra:function(e){if(!E(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Kt(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,l=b(r)?this.filter(r)[0]:r[0],u={},c={},h={},d=this.byGroup(),p=d.nodes,g=d.edges;g.unmergeBy((function(e){return e.isLoop()}));for(var f=function(e){return u[e.id()]},v=function(e,t){u[e.id()]=t,y.updateItem(e)},y=new $t((function(e,t){return f(e)-f(t)})),m=0;m<p.length;m++){var x=p[m];u[x.id()]=x.same(l)?0:1/0,y.push(x)}for(var w=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(g),i=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<i||!n)&&(i=u,n=l)}return{edge:n,dist:i}};y.size()>0;){var T=y.pop(),_=f(T),D=T.id();if(h[D]=_,_!==1/0)for(var C=T.neighborhood().intersect(p),N=0;N<C.length;N++){var A=C[N],L=A.id(),S=w(T,A),O=_+S.dist;O<f(A)&&(v(A,O),c[L]={node:T,edge:S.edge})}}return{distanceTo:function(e){var t=b(e)?p.filter(e)[0]:e[0];return h[t.id()]},pathTo:function(e){var t=b(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},Qt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},l=0;l<i;l++)a[l]=this.spawn(n[l]);for(var u=r.sort((function(t,n){return e(t)-e(n)})),c=0;c<u.length;c++){var h=u[c],d=h.source()[0],p=h.target()[0],g=s(d),f=s(p),v=a[g],y=a[f];g!==f&&(o.merge(h),v.merge(y),a.splice(f,1))}return o}},Jt=Mt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),en={aStar:function(e){var t=this.cy(),n=Jt(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var l,u,c=r.id(),h=i.id(),d={},p={},g={},f=new $t((function(e,t){return p[e.id()]-p[t.id()]})),v=new Ut,y={},m={},b=function(e,t){f.push(e),v.add(t)},x=function(){l=f.pop(),u=l.id(),v.delete(u)},w=function(e){return v.has(e)};b(r,c),d[c]=0,p[c]=a(r);for(var E=0;f.size()>0;){if(x(),E++,u===h){for(var T=[],_=i,D=h,C=m[D];T.unshift(_),null!=C&&T.unshift(C),null!=(_=y[D]);)C=m[D=_.id()];return{found:!0,distance:d[u],path:this.spawn(T),steps:E}}g[u]=!0;for(var N=l._private.edges,A=0;A<N.length;A++){var L=N[A];if(this.hasElementWithId(L.id())&&(!o||L.data("source")===u)){var S=L.source(),O=L.target(),I=S.id()!==u?S:O,k=I.id();if(this.hasElementWithId(k)&&!g[k]){var M=d[u]+s(L);w(k)?M<d[k]&&(d[k]=M,p[k]=M+a(I),y[k]=l,m[k]=L):(d[k]=M,p[k]=M+a(I),b(I,k),y[k]=l,m[k]=L)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},tn=Mt({weight:function(e){return 1},directed:!1}),nn={floydWarshall:function(e){for(var t=this.cy(),n=tn(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,h=function(e){return s.indexOf(e)},d=function(e){return s[e]},p=new Array(c),g=0;g<c;g++){var f=g%u,v=(g-f)/u;p[g]=v===f?0:1/0}for(var y=new Array(c),m=new Array(c),x=0;x<l.length;x++){var w=l[x],E=w.source()[0],T=w.target()[0];if(E!==T){var _=h(E),D=h(T),C=_*u+D,N=a(w);if(p[C]>N&&(p[C]=N,y[C]=D,m[C]=w),!i){var A=D*u+_;!i&&p[A]>N&&(p[A]=N,y[A]=_,m[A]=w)}}}for(var L=0;L<u;L++)for(var S=0;S<u;S++)for(var O=S*u+L,I=0;I<u;I++){var k=S*u+I,M=L*u+I;p[O]+p[M]<p[k]&&(p[k]=p[O]+p[M],y[k]=y[O])}var P=function(e){return(b(e)?t.filter(e):e)[0]},R=function(e){return h(P(e))},B={distance:function(e,t){var n=R(e),r=R(t);return p[n*u+r]},path:function(e,n){var r=R(e),i=R(n),a=d(r);if(r===i)return a.collection();if(null==y[r*u+i])return t.collection();var o,s=t.collection(),l=r;for(s.merge(a);r!==i;)l=r,r=y[r*u+i],o=m[l*u+r],s.merge(o),s.merge(d(r));return s}};return B}},rn=Mt({weight:function(e){return 1},directed:!1,root:null}),an={bellmanFord:function(e){var t=this,n=rn(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,h=u.nodes,d=h.length,p=new Yt,g=!1,f=[];a=l.collection(a)[0],c.unmergeBy((function(e){return e.isLoop()}));for(var v=c.length,y=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},m=function(e){return(b(e)?l.$(e):e)[0]},x=function(e){return y(m(e)).dist},w=function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=[],i=m(e);;){if(null==i)return t.spawn();var o=y(i),l=o.edge,u=o.pred;if(r.unshift(i[0]),i.same(n)&&r.length>0)break;null!=l&&r.unshift(l),i=u}return s.spawn(r)},E=0;E<d;E++){var T=h[E],_=y(T);T.same(a)?_.dist=0:_.dist=1/0,_.pred=null,_.edge=null}for(var D=!1,C=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,D=!0)},N=1;N<d;N++){D=!1;for(var A=0;A<v;A++){var L=c[A],S=L.source(),O=L.target(),I=o(L),k=y(S),M=y(O);C(S,O,L,k,M,I),i||C(O,S,L,M,k,I)}if(!D)break}if(D)for(var P=[],R=0;R<v;R++){var B=c[R],F=B.source(),z=B.target(),G=o(B),Y=y(F).dist,X=y(z).dist;if(Y+G<X||!i&&X+G<Y){if(g||(Nt("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),!1===e.findNegativeWeightCycles)break;var V=[];Y+G<X&&V.push(F),!i&&X+G<Y&&V.push(z);for(var U=V.length,j=0;j<U;j++){var H=V[j],q=[H];q.push(y(H).edge);for(var W=y(H).pred;-1===q.indexOf(W);)q.push(W),q.push(y(W).edge),W=y(W).pred;for(var $=(q=q.slice(q.indexOf(W)))[0].id(),K=0,Z=2;Z<q.length;Z+=2)q[Z].id()<$&&($=q[Z].id(),K=Z);(q=q.slice(K).concat(q.slice(0,K))).push(q[0]);var Q=q.map((function(e){return e.id()})).join(",");-1===P.indexOf(Q)&&(f.push(s.spawn(q)),P.push(Q))}}}return{distanceTo:x,pathTo:w,hasNegativeWeightCycle:g,negativeWeightCycles:f}}},on=Math.sqrt(2),sn=function(e,t,n){0===n.length&&Dt("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var p=0;p<l.length;p++){var g=l[p];g[1]===s?(l[p]=g.slice(),l[p][1]=o):g[2]===s&&(l[p]=g.slice(),l[p][2]=o)}for(var f=0;f<t.length;f++)t[f]===s&&(t[f]=o);return l},ln=function(e,t,n,r){for(;n>r;){var i=Math.floor(Math.random()*t.length);t=sn(i,e,t),n--}return t},un={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/on);if(!(i<2)){for(var l=[],u=0;u<a;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var h=1/0,d=[],p=new Array(i),g=new Array(i),f=new Array(i),v=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<i;m++)g[m]=m;var b=ln(g,l.slice(),i,s),x=b.slice();v(g,f);var w=ln(g,b,s,2),E=ln(f,x,s,2);w.length<=E.length&&w.length<h?(h=w.length,d=w,v(g,p)):E.length<=w.length&&E.length<h&&(h=E.length,d=E,v(f,p))}for(var T=this.spawn(d.map((function(e){return r[e[0]]}))),_=this.spawn(),D=this.spawn(),C=p[0],N=0;N<p.length;N++){var A=p[N],L=n[N];A===C?_.merge(L):D.merge(L)}var S=function(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!T.contains(t)&&n.merge(t)}))})),n},O=[S(_),S(D)];return{cut:T,components:O,partition1:_,partition2:D}}Dt("At least 2 nodes are required for Karger-Stein algorithm")}},cn=function(e){return{x:e.x,y:e.y}},hn=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},dn=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},pn=function(e){return{x:e[0],y:e[1]}},gn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},fn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},vn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},yn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t)):e=e.slice(t,n);for(var a=0,o=e.length-1;o>=0;o--){var s=e[o];i?isFinite(s)||(e[o]=-1/0,a++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+a]:(e[u-1+a]+e[u+a])/2},mn=function(e){return Math.PI*e/180},bn=function(e,t){return Math.atan2(t,e)-Math.PI/2},xn=Math.log2||function(e){return Math.log(e)/Math.log(2)},wn=function(e){return e>0?1:e<0?-1:0},En=function(e,t){return Math.sqrt(Tn(e,t))},Tn=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},_n=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},Dn=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Cn=function(e,t,n,r){return{x:Dn(e.x,t.x,n.x,r),y:Dn(e.y,t.y,n.y,r)}},Nn=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=En(e,t),o={x:i.x/a,y:i.y/a};return n=null==n?0:n,r=null!=r?r:n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},An=function(e,t,n){return Math.max(e,Math.min(n,t))},Ln=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Sn=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},On=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},In=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},kn=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Mn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Pn=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var s=o(a,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Rn=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Bn=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},Fn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},zn=function(e,t){return Fn(e,t.x,t.y)},Gn=function(e,t){return Fn(e,t.x1,t.y1)&&Fn(e,t.x2,t.y2)},Yn=function(e,t,n,r,i,a,o){var s,l=cr(i,a),u=i/2,c=a/2,h=r-c-o;if((s=rr(e,t,n,r,n-u+l-o,h,n+u-l+o,h,!1)).length>0)return s;var d=n+u+o;if((s=rr(e,t,n,r,d,r-c+l-o,d,r+c-l+o,!1)).length>0)return s;var p=r+c+o;if((s=rr(e,t,n,r,n-u+l-o,p,n+u-l+o,p,!1)).length>0)return s;var g,f=n-u-o;if((s=rr(e,t,n,r,f,r-c+l-o,f,r+c-l+o,!1)).length>0)return s;var v=n-u+l,y=r-c+l;if((g=tr(e,t,n,r,v,y,l+o)).length>0&&g[0]<=v&&g[1]<=y)return[g[0],g[1]];var m=n+u-l,b=r-c+l;if((g=tr(e,t,n,r,m,b,l+o)).length>0&&g[0]>=m&&g[1]<=b)return[g[0],g[1]];var x=n+u-l,w=r+c-l;if((g=tr(e,t,n,r,x,w,l+o)).length>0&&g[0]>=x&&g[1]>=w)return[g[0],g[1]];var E=n-u+l,T=r+c-l;return(g=tr(e,t,n,r,E,T,l+o)).length>0&&g[0]<=E&&g[1]>=T?[g[0],g[1]]:[]},Xn=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},Vn=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(e<u.x1||e>u.x2||t<u.y1||t>u.y2)},Un=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},jn=function(e,t,n,r,i){var a,o,s,l,u,c,h,d;return 0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,h=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,void(i[5]=-h)):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,void(i[4]=i[2]=-(d+h))):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),void(i[4]=-h+d*Math.cos((l+4*Math.PI)/3))))},Hn=function(e,t,n,r,i,a,o,s){var l=[];jn(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=1e-7,c=[],h=0;h<6;h+=2)Math.abs(l[h+1])<u&&l[h]>=0&&l[h]<=1&&c.push(l[h]);c.push(1),c.push(0);for(var d,p,g,f=-1,v=0;v<c.length;v++)d=Math.pow(1-c[v],2)*n+2*(1-c[v])*c[v]*i+c[v]*c[v]*o,p=Math.pow(1-c[v],2)*r+2*(1-c[v])*c[v]*a+c[v]*c[v]*s,g=Math.pow(d-e,2)+Math.pow(p-t,2),f>=0?g<f&&(f=g):f=g;return f},qn=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},Wn=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[2*(l+1)],o=n[2*(l+1)+1]):(a=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),r==e&&a==e);else{if(!(r>=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},$n=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),p=Math.sin(-u),g=0;g<c.length/2;g++)c[2*g]=a/2*(n[2*g]*d-n[2*g+1]*p),c[2*g+1]=o/2*(n[2*g+1]*d+n[2*g]*p),c[2*g]+=r,c[2*g+1]+=i;if(l>0){var f=Qn(c,-l);h=Zn(f)}else h=c;return Wn(e,t,h)},Kn=function(e,t,n,r,i,a,o){for(var s=new Array(n.length),l=a/2,u=o/2,c=hr(a,o),h=c*c,d=0;d<n.length/4;d++){var p=void 0,g=void 0;p=0===d?n.length-2:4*d-2,g=4*d+2;var f=r+l*n[4*d],v=i+u*n[4*d+1],y=-n[p]*n[g]-n[p+1]*n[g+1],m=c/Math.tan(Math.acos(y)/2),b=f-m*n[p],x=v-m*n[p+1],w=f+m*n[g],E=v+m*n[g+1];s[4*d]=b,s[4*d+1]=x,s[4*d+2]=w,s[4*d+3]=E;var T=n[p+1],_=-n[p];T*n[g]+_*n[g+1]<0&&(T*=-1,_*=-1);var D=b+T*c,C=x+_*c;if(Math.pow(D-e,2)+Math.pow(C-t,2)<=h)return!0}return Wn(e,t,s)},Zn=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=rr(t,n,r,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},Qn=function(e,t){for(var n,r,i,a,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var l=a-r,u=-(i-n),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=n+h*t,o[4*s+1]=r+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},Jn=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var l=Math.sqrt(o*o+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]},er=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},tr=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),p=(-c-Math.sqrt(h))/(2*u),g=Math.min(d,p),f=Math.max(d,p),v=[];if(g>=0&&g<=1&&v.push(g),f>=0&&f<=1&&v.push(f),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},nr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},rr=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,g=s-a,f=h*d-g*u,v=c*d-p*u,y=g*c-h*p;if(0!==y){var m=f/y,b=v/y,x=.001,w=0-x,E=1+x;return w<=m&&m<=E&&w<=b&&b<=E||l?[e+m*c,t+m*p]:[]}return 0===f||0===v?nr(e,n,o)===o?[o,s]:nr(e,n,i)===i?[i,a]:nr(i,o,n)===n?[n,r]:[]:[]},ir=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,g=[],f=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<f.length/2;y++)f[2*y]=n[2*y]*a+r,f[2*y+1]=n[2*y+1]*o+i;if(s>0){var m=Qn(f,-s);u=Zn(m)}else u=f}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],h=u[2*b+1],b<u.length/2-1?(d=u[2*(b+1)],p=u[2*(b+1)+1]):(d=u[0],p=u[1]),0!==(l=rr(e,t,r,i,c,h,d,p)).length&&g.push(l[0],l[1]);return g},ar=function(e,t,n,r,i,a,o,s){for(var l,u=[],c=new Array(n.length),h=a/2,d=o/2,p=hr(a,o),g=0;g<n.length/4;g++){var f=void 0,v=void 0;f=0===g?n.length-2:4*g-2,v=4*g+2;var y=r+h*n[4*g],m=i+d*n[4*g+1],b=-n[f]*n[v]-n[f+1]*n[v+1],x=p/Math.tan(Math.acos(b)/2),w=y-x*n[f],E=m-x*n[f+1],T=y+x*n[v],_=m+x*n[v+1];0===g?(c[n.length-2]=w,c[n.length-1]=E):(c[4*g-2]=w,c[4*g-1]=E),c[4*g]=T,c[4*g+1]=_;var D=n[f+1],C=-n[f];D*n[v]+C*n[v+1]<0&&(D*=-1,C*=-1),0!==(l=tr(e,t,r,i,w+D*p,E+C*p,p)).length&&u.push(l[0],l[1])}for(var N=0;N<c.length/4;N++)0!==(l=rr(e,t,r,i,c[4*N],c[4*N+1],c[4*N+2],c[4*N+3],!1)).length&&u.push(l[0],l[1]);if(u.length>2){for(var A=[u[0],u[1]],L=Math.pow(A[0]-e,2)+Math.pow(A[1]-t,2),S=1;S<u.length/2;S++){var O=Math.pow(u[2*S]-e,2)+Math.pow(u[2*S+1]-t,2);O<=L&&(A[0]=u[2*S],A[1]=u[2*S+1],L=O)}return A}return u},or=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},sr=function(e,t){var n=ur(e,t);return n=lr(n)},lr=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var d=0;d<r;d++)n=e[2*d+1]=e[2*d+1]+(-1-a);return e},ur=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i,a=new Array(2*e),o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},cr=function(e,t){return Math.min(e/4,t/4,8)},hr=function(e,t){return Math.min(e/10,t/10,8)},dr=function(){return 8},pr=function(e,t,n){return[e-2*t+n,2*(t-e),e]},gr=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},fr=Mt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),vr={pageRank:function(e){for(var t=fr(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,h=c*c,d=u.length,p=new Array(h),g=new Array(c),f=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++)p[v*c+y]=0;g[v]=0}for(var m=0;m<d;m++){var b=u[m],x=b.data("source"),w=b.data("target");if(x!==w){var E=l.indexOfId(x),T=l.indexOfId(w),_=a(b);p[T*c+E]+=_,g[E]+=_}}for(var D=1/c+f,C=0;C<c;C++)if(0===g[C])for(var N=0;N<c;N++)p[N*c+C]=D;else for(var A=0;A<c;A++){var L=A*c+C;p[L]=p[L]/g[C]+f}for(var S,O=new Array(c),I=new Array(c),k=0;k<c;k++)O[k]=1;for(var M=0;M<i;M++){for(var P=0;P<c;P++)I[P]=0;for(var R=0;R<c;R++)for(var B=0;B<c;B++){var F=R*c+B;I[R]+=p[F]*O[B]}_n(I),S=O,O=I,I=S;for(var z=0,G=0;G<c;G++){var Y=S[G]-O[G];z+=Y*Y}if(z<r)break}return{rank:function(e){return e=o.collection(e)[0],O[l.indexOf(e)]}}}},yr=Mt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),mr={degreeCentralityNormalized:function(e){e=yr(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(b(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(b(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},p=0,g=0;g<r;g++){var f=n[g];e.root=f;var v=this.degreeCentrality(e);p<v.degree&&(p=v.degree),d[f.id()]=v.degree}return{degree:function(e){return 0===p?0:(b(e)&&(e=t.filter(e)),d[e.id()]/p)}}},degreeCentrality:function(e){e=yr(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter((function(e){return e.target().same(i)&&n.has(e)})),c=l.filter((function(e){return e.source().same(i)&&n.has(e)})),h=u.length,d=c.length,p=0,g=0,f=0;f<u.length;f++)p+=a(u[f]);for(var v=0;v<c.length;v++)g+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(p,s),outdegree:Math.pow(d,1-s)*Math.pow(g,s)}}for(var y=i.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=a(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};mr.dc=mr.degreeCentrality,mr.dcn=mr.degreeCentralityNormalised=mr.degreeCentralityNormalized;var br=Mt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),xr={closenessCentralityNormalized:function(e){for(var t=br(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],p=0;p<l.length;p++)if(c!==p){var g=u.distance(d,l[p]);h+=n?1/g:g}n||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:(e=b(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=br(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=o.distanceTo(c);s+=a?1/h:h}}return a?s:1/s}};xr.cc=xr.closenessCentrality,xr.ccn=xr.closenessCentralityNormalised=xr.closenessCentralityNormalized;var wr=Mt({weight:null,directed:!1}),Er={betweennessCentrality:function(e){for(var t=wr(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},u=0,c={set:function(e,t){l[e]=t,t>u&&(u=t)},get:function(e){return l[e]}},h=0;h<o.length;h++){var d=o[h],p=d.id();s[p]=n?d.outgoers().nodes():d.openNeighborhood().nodes(),c.set(p,0)}for(var g=function(e){for(var t=o[e].id(),n=[],l={},u={},h={},d=new $t((function(e,t){return h[e]-h[t]})),p=0;p<o.length;p++){var g=o[p].id();l[g]=[],u[g]=0,h[g]=1/0}for(u[t]=1,h[t]=0,d.push(t);!d.empty();){var f=d.pop();if(n.push(f),i)for(var v=0;v<s[f].length;v++){var y=s[f][v],m=a.getElementById(f),b=void 0;b=m.edgesTo(y).length>0?m.edgesTo(y)[0]:y.edgesTo(m)[0];var x=r(b);y=y.id(),h[y]>h[f]+x&&(h[y]=h[f]+x,d.nodes.indexOf(y)<0?d.push(y):d.updateItem(y),u[y]=0,l[y]=[]),h[y]==h[f]+x&&(u[y]=u[y]+u[f],l[y].push(f))}else for(var w=0;w<s[f].length;w++){var E=s[f][w].id();h[E]==1/0&&(d.push(E),h[E]=h[f]+1),h[E]==h[f]+1&&(u[E]=u[E]+u[f],l[E].push(f))}}for(var T={},_=0;_<o.length;_++)T[o[_].id()]=0;for(;n.length>0;){for(var D=n.pop(),C=0;C<l[D].length;C++){var N=l[D][C];T[N]=T[N]+u[N]/u[D]*(1+T[D])}D!=o[e].id()&&c.set(D,c.get(D)+T[D])}},f=0;f<o.length;f++)g(f);var v={betweenness:function(e){var t=a.collection(e).id();return c.get(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=a.collection(e).id();return c.get(t)/u}};return v.betweennessNormalised=v.betweennessNormalized,v}};Er.bc=Er.betweennessCentrality;var Tr=Mt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),_r=function(e){return Tr(e)},Dr=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Cr=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},Nr=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},Ar=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},Lr=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=Ar(e,r,t);return e},Sr=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return Nr(r,t),r},Or=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},Ir=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},kr=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Mr=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&kr(e[t],e[n])&&e.splice(n,1);return e},Pr=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=_r(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<n.length;d++){var p=n[d],g=a[p.source().id()],f=a[p.target().id()],v=Dr(p,i.attributes);c[g*l+f]+=v,c[f*l+g]+=v}Cr(c,l,i.multFactor),Nr(c,l);for(var y=!0,m=0;y&&m<i.maxIterations;)y=!1,s=Lr(c,l,i.expandFactor),c=Sr(s,l,i.inflateFactor),Or(c,s,u,4)||(y=!0),m++;var b=Ir(c,l,t,r);return b=Mr(b)},Rr={markovClustering:Pr,mcl:Pr},Br=function(e){return e},Fr=function(e,t){return Math.abs(t-e)},zr=function(e,t,n){return e+Fr(t,n)},Gr=function(e,t,n){return e+Math.pow(n-t,2)},Yr=function(e){return Math.sqrt(e)},Xr=function(e,t,n){return Math.max(e,Fr(t,n))},Vr=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Br,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},Ur={euclidean:function(e,t,n){return e>=2?Vr(e,t,n,0,Gr,Yr):Vr(e,t,n,0,zr)},squaredEuclidean:function(e,t,n){return Vr(e,t,n,0,Gr)},manhattan:function(e,t,n){return Vr(e,t,n,0,zr)},max:function(e,t,n){return Vr(e,t,n,-1/0,Xr)}};function jr(e,t,n,r,i,a){var o;return o=x(e)?e:Ur[e]||Ur.euclidean,0===t&&x(e)?o(i,a):o(t,n,r,i,a)}Ur["squared-euclidean"]=Ur.squaredEuclidean,Ur.squaredeuclidean=Ur.squaredEuclidean;var Hr=Mt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),qr=function(e){return Hr(e)},Wr=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=function(e){return r[e](t)},s=n,l=t;return jr(e,r.length,a,o,s,l)},$r=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},Kr=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=Wr(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},Zr=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},Qr=function(e,t,n){return Math.abs(t-e)<=n},Jr=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},ei=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},ti=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];ei(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},ni=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=Wr("manhattan",t[i],e,n,"kMedoids");return r},ri=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=r[h][u]*i.attributes[c](t[h]),o+=r[h][u];e[u][c]=a/o}},ii=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,l,u=2/(i.m-1),c=0;c<n.length;c++)for(var h=0;h<r.length;h++){o=0;for(var d=0;d<n.length;d++)s=Wr(i.distance,r[h],n[c],i.attributes,"cmeans"),l=Wr(i.distance,r[h],n[d],i.attributes,"cmeans"),o+=Math.pow(s/l,u);e[h][c]=1/o}},ai=function(e,t,n,r){for(var i,a,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o},oi=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=qr(e);r=new Array(o.length);for(var l=0;l<o.length;l++)r[l]=new Array(s.k);n=new Array(o.length);for(var u=0;u<o.length;u++)n[u]=new Array(s.k);for(var c=0;c<o.length;c++){for(var h=0,d=0;d<s.k;d++)n[c][d]=Math.random(),h+=n[c][d];for(var p=0;p<s.k;p++)n[c][p]=n[c][p]/h}t=new Array(s.k);for(var g=0;g<s.k;g++)t[g]=new Array(s.attributes.length);i=new Array(o.length);for(var f=0;f<o.length;f++)i[f]=new Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,ri(t,o,n,i,s),ii(n,r,t,o,s),Jr(n,r,s.sensitivityThreshold)||(v=!0),y++;return{clusters:ai(o,n,s,a),degreeOfMembership:n}},si={kMeans:function(t){var n,r=this.cy(),i=this.nodes(),a=null,o=qr(t),s=new Array(o.k),l={};o.testMode?"number"==typeof o.testCentroids?(o.testCentroids,n=$r(i,o.k,o.attributes)):n="object"===e(o.testCentroids)?o.testCentroids:$r(i,o.k,o.attributes):n=$r(i,o.k,o.attributes);for(var u=!0,c=0;u&&c<o.maxIterations;){for(var h=0;h<i.length;h++)l[(a=i[h]).id()]=Kr(a,n,o.distance,o.attributes,"kMeans");u=!1;for(var d=0;d<o.k;d++){var p=Zr(d,i,l);if(0!==p.length){for(var g=o.attributes.length,f=n[d],v=new Array(g),y=new Array(g),m=0;m<g;m++){y[m]=0;for(var b=0;b<p.length;b++)a=p[b],y[m]+=o.attributes[m](a);v[m]=y[m]/p.length,Qr(v[m],f[m],o.sensitivityThreshold)||(u=!0)}n[d]=v,s[d]=r.collection(p)}}c++}return s},kMedoids:function(t){var n,r,i=this.cy(),a=this.nodes(),o=null,s=qr(t),l=new Array(s.k),u={},c=new Array(s.k);s.testMode?"number"==typeof s.testCentroids||(n="object"===e(s.testCentroids)?s.testCentroids:ti(a,s.k)):n=ti(a,s.k);for(var h=!0,d=0;h&&d<s.maxIterations;){for(var p=0;p<a.length;p++)u[(o=a[p]).id()]=Kr(o,n,s.distance,s.attributes,"kMedoids");h=!1;for(var g=0;g<n.length;g++){var f=Zr(g,a,u);if(0!==f.length){c[g]=ni(n[g],f,s.attributes);for(var v=0;v<f.length;v++)(r=ni(f[v],f,s.attributes))<c[g]&&(c[g]=r,n[g]=f[v],h=!0);l[g]=i.collection(f)}}d++}return l},fuzzyCMeans:oi,fcm:oi},li=Mt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ui={single:"min",complete:"max"},ci=function(e){var t=li(e),n=ui[t.linkage];return null!=n&&(t.linkage=n),t},hi=function(e,t,n,r,i){for(var a,o=0,s=1/0,l=i.attributes,u=function(e,t){return jr(i.distance,l.length,(function(t){return l[t](e)}),(function(e){return l[e](t)}),e,t)},c=0;c<e.length;c++){var h=e[c].key,d=n[h][r[h]];d<s&&(o=h,s=d)}if("threshold"===i.mode&&s>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,g=t[o],f=t[r[o]];p="dendrogram"===i.mode?{left:g,right:f,key:g.key}:{value:g.value.concat(f.value),key:g.key},e[g.index]=p,e.splice(f.index,1),t[g.key]=p;for(var v=0;v<e.length;v++){var y=e[v];g.key===y.key?a=1/0:"min"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]>n[f.key][y.key]&&(a=n[f.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]<n[f.key][y.key]&&(a=n[f.key][y.key])):a="mean"===i.linkage?(n[g.key][y.key]*g.size+n[f.key][y.key]*f.size)/(g.size+f.size):"dendrogram"===i.mode?u(y.value,g.value):u(y.value[0],g.value[0]),n[g.key][y.key]=n[y.key][g.key]=a}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===g.key||r[b]===f.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return g.key=f.key=g.index=f.index=null,!0},di=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},pi=function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),i=e(t.right,n),a=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:a.id()}}),n.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}return t.value?t.value.id():void 0},gi=function e(t,n,r){if(!t)return[];var i=[],a=[],o=[];return 0===n?(t.left&&di(t.left,i),t.right&&di(t.right,a),o=i.concat(a),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&di(t.left,i),t.right&&di(t.right,a),[r.collection(i),r.collection(a)]):t.value?[r.collection(t.value)]:(t.left&&(i=e(t.left,n-1,r)),t.right&&(a=e(t.right,n-1,r)),i.concat(a))},fi=function(e){for(var t=this.cy(),n=this.nodes(),r=ci(e),i=r.attributes,a=function(e,t){return jr(r.distance,i.length,(function(t){return i[t](e)}),(function(e){return i[e](t)}),e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var h={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=h,u[c]=h,s[c]=[],l[c]=0}for(var d=0;d<o.length;d++)for(var p=0;p<=d;p++){var g=void 0;g="dendrogram"===r.mode?d===p?1/0:a(o[d].value,o[p].value):d===p?1/0:a(o[d].value[0],o[p].value[0]),s[d][p]=g,s[p][d]=g,g<s[d][l[d]]&&(l[d]=p)}for(var f,v=hi(o,u,s,l,r);v;)v=hi(o,u,s,l,r);return"dendrogram"===r.mode?(f=gi(o[0],r.dendrogramDepth,t),r.addDendrogram&&pi(o[0],t)):(f=new Array(o.length),o.forEach((function(e,n){e.key=e.index=null,f[n]=t.collection(e.value)}))),f},vi={hierarchicalClustering:fi,hca:fi},yi=Mt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),mi=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Dt("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some((function(e){return e===n}))||_(n)||Dt("Preference must be one of [".concat(r.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number. Got: ").concat(n)),yi(e)},bi=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-jr(e,r.length,(function(e){return i(t,e)}),(function(e){return i(n,e)}),t,n)},xi=function(e,t){return"median"===t?yn(e):"mean"===t?vn(e):"min"===t?gn(e):"max"===t?fn(e):t},wi=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},Ei=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},Ti=function(e,t,n){for(var r=Ei(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}n[i]=a[s]}return r=Ei(e,t,n)},_i=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=mi(e),c={},h=0;h<l.length;h++)c[l[h].id()]=h;n=(t=l.length)*t,r=new Array(n);for(var d=0;d<n;d++)r[d]=-1/0;for(var p=0;p<t;p++)for(var g=0;g<t;g++)p!==g&&(r[p*t+g]=bi(u.distance,l[p],l[g],u.attributes));i=xi(r,u.preference);for(var f=0;f<t;f++)r[f*t+f]=i;a=new Array(n);for(var v=0;v<n;v++)a[v]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),x=new Array(t),w=0;w<t;w++)m[w]=0,b[w]=0,x[w]=0;for(var E,T=new Array(t*u.minIterations),_=0;_<T.length;_++)T[_]=0;for(E=0;E<u.maxIterations;E++){for(var D=0;D<t;D++){for(var C=-1/0,N=-1/0,A=-1,L=0,S=0;S<t;S++)m[S]=a[D*t+S],(L=o[D*t+S]+r[D*t+S])>=C?(N=C,C=L,A=S):L>N&&(N=L);for(var O=0;O<t;O++)a[D*t+O]=(1-u.damping)*(r[D*t+O]-C)+u.damping*m[O];a[D*t+A]=(1-u.damping)*(r[D*t+A]-N)+u.damping*m[A]}for(var I=0;I<t;I++){for(var k=0,M=0;M<t;M++)m[M]=o[M*t+I],b[M]=Math.max(0,a[M*t+I]),k+=b[M];k-=b[I],b[I]=a[I*t+I],k+=b[I];for(var P=0;P<t;P++)o[P*t+I]=(1-u.damping)*Math.min(0,k-b[P])+u.damping*m[P];o[I*t+I]=(1-u.damping)*(k-b[I])+u.damping*m[I]}for(var R=0,B=0;B<t;B++){var F=o[B*t+B]+a[B*t+B]>0?1:0;T[E%u.minIterations*t+B]=F,R+=F}if(R>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var z=0,G=0;G<t;G++){x[G]=0;for(var Y=0;Y<u.minIterations;Y++)x[G]+=T[Y*t+G];0!==x[G]&&x[G]!==u.minIterations||z++}if(z===t)break}}for(var X=wi(t,a,o),V=Ti(t,r,X),U={},j=0;j<X.length;j++)U[X[j]]=[];for(var H=0;H<l.length;H++){var q=V[c[l[H].id()]];null!=q&&U[q].push(l[H])}for(var W=new Array(X.length),$=0;$<X.length;$++)W[$]=s.collection(U[X[$]]);return W},Di={affinityPropagation:_i,ap:_i},Ci=Mt({root:void 0,directed:!1}),Ni={hierholzer:function(e){if(!E(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=Ci(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=b(o)?this.filter(o)[0].id():o[0].id());var c={},h={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else h[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):h[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=h[t][0],i!=(r=h[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},g=[],f=[];for(f=p(i);1!=f.length;)0==c[f[0]].length?(g.unshift(l.getElementById(f.shift())),g.unshift(l.getElementById(f.shift()))):f=p(f.shift()).concat(f);for(var v in g.unshift(l.getElementById(f.shift())),c)if(c[v].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},Ai=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter((function(e){return e.isLoop()}))):l.merge(i)}))})),i.push(l)},l=function l(u,c,h){u===h&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var d,p,g,f,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach((function(e){d=e.source().id(),p=e.target().id(),(g=d===c?p:d)!==h&&(f=e.id(),o[f]||(o[f]=!0,a.push({x:c,y:g,edge:e})),g in t?t[c].low=Math.min(t[c].low,t[g].id):(l(u,g,c),t[c].low=Math.min(t[c].low,t[g].low),t[c].id<=t[g].low&&(t[c].cutVertex=!0,s(c,g))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},Li=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);r.push(h),a=a.difference(h)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},Si={};[qt,Zt,Qt,en,nn,an,un,vr,mr,xr,Er,Rr,si,vi,Di,Ni,{hopcroftTarjanBiconnected:Ai,htbc:Ai,htb:Ai,hopcroftTarjanBiconnectedComponents:Ai},{tarjanStronglyConnected:Li,tsc:Li,tscc:Li,tarjanStronglyConnectedComponents:Li}].forEach((function(e){Q(Si,e)}));var Oi=0,Ii=1,ki=2,Mi=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=Oi,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Mi.prototype={fulfill:function(e){return Pi(this,Ii,"fulfillValue",e)},reject:function(e){return Pi(this,ki,"rejectReason",e)},then:function(e,t){var n=this,r=new Mi;return n.onFulfilled.push(Fi(e,r,"fulfill")),n.onRejected.push(Fi(t,r,"reject")),Ri(n),r.proxy}};var Pi=function(e,t,n,r){return e.state===Oi&&(e.state=t,e[n]=r,Ri(e)),e},Ri=function(e){e.state===Ii?Bi(e,"onFulfilled",e.fulfillValue):e.state===ki&&Bi(e,"onRejected",e.rejectReason)},Bi=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},Fi=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(a){return void t.reject(a)}zi(t,i)}}},zi=function t(n,r){if(n!==r&&n.proxy!==r){var i;if("object"===e(r)&&null!==r||"function"==typeof r)try{i=r.then}catch(o){return void n.reject(o)}if("function"!=typeof i)n.fulfill(r);else{var a=!1;try{i.call(r,(function(e){a||(a=!0,e===r?n.reject(new TypeError("circular thenable chain")):t(n,e))}),(function(e){a||(a=!0,n.reject(e))}))}catch(o){a||n.reject(o)}}}else n.reject(new TypeError("cannot resolve promise with itself"))};Mi.all=function(e){return new Mi((function(t,n){for(var r=new Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then((function(e){a(t,e)}),(function(e){n(e)})):a(t,r)}(o)}))},Mi.resolve=function(e){return new Mi((function(t,n){t(e)}))},Mi.reject=function(e){return new Mi((function(t,n){n(e)}))};var Gi="undefined"!=typeof Promise?Promise:Mi,Yi=function(e,t,n){var r=S(e),i=!r,a=this._private=Q({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&x(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},Xi=Yi.prototype;Q(Xi,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),N(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new Gi((function(e,n){t.push((function(){e()}))}))}}),Xi.complete=Xi.completed,Xi.run=Xi.play,Xi.running=Xi.playing;var Vi={animated:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];return n?n._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++)t[n]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=void 0!==n.length,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var l=a.style();if(e=Q({},e,t),0===Object.keys(e).length)return new Yi(i[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&null!=e.renderedPosition){var u=e.renderedPosition,c=a.pan(),h=a.zoom();e.position=dn(u,h,c)}if(o&&null!=e.panBy){var d=e.panBy,p=a.pan();e.pan={x:p.x+d.x,y:p.y+d.y}}var g=e.center||e.centre;if(o&&null!=g){var f=a.getCenterPan(g.eles,e.zoom);null!=f&&(e.pan=f)}if(o&&null!=e.fit){var v=e.fit,y=a.getFitViewport(v.eles||v.boundingBox,v.padding);null!=y&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&E(e.zoom)){var m=a.getZoomedViewport(e.zoom);null!=m?(m.zoomed&&(e.zoom=m.zoom),m.panned&&(e.pan=m.pan)):e.zoom=null}return new Yi(i[0],e)}},animate:function(){return function(e,t){var n=this,r=void 0!==n.length?n:[n];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=Q({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(void 0===e.queue||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=void 0!==n.length?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._private,s=o.animation.current,l=0;l<s.length;l++){var u=s[l]._private;t&&(u.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify("draw"),this}}},Ui=Array.isArray,ji=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hi=/^\w*$/;function qi(e,t){if(Ui(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ge(e))||Hi.test(e)||!ji.test(e)||null!=t&&e in Object(t)}var Wi=qi,$i="[object AsyncFunction]",Ki="[object Function]",Zi="[object GeneratorFunction]",Qi="[object Proxy]";function Ji(e){if(!le(e))return!1;var t=Pe(e);return t==Ki||t==Zi||t==$i||t==Qi}var ea,ta=Ji,na=pe["__core-js_shared__"],ra=(ea=/[^.]+$/.exec(na&&na.keys&&na.keys.IE_PROTO||""))?"Symbol(src)_1."+ea:"";function ia(e){return!!ra&&ra in e}var aa=ia,oa=Function.prototype.toString;function sa(e){if(null!=e){try{return oa.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var la=sa,ua=/[\\^$.*+?()[\]{}|]/g,ca=/^\[object .+?Constructor\]$/,ha=Function.prototype,da=Object.prototype,pa=ha.toString,ga=da.hasOwnProperty,fa=RegExp("^"+pa.call(ga).replace(ua,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function va(e){return!(!le(e)||aa(e))&&(ta(e)?fa:ca).test(la(e))}var ya=va;function ma(e,t){return null==e?void 0:e[t]}var ba=ma;function xa(e,t){var n=ba(e,t);return ya(n)?n:void 0}var wa=xa,Ea=wa(Object,"create");function Ta(){this.__data__=Ea?Ea(null):{},this.size=0}var _a=Ta;function Da(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ca=Da,Na="__lodash_hash_undefined__",Aa=Object.prototype.hasOwnProperty;function La(e){var t=this.__data__;if(Ea){var n=t[e];return n===Na?void 0:n}return Aa.call(t,e)?t[e]:void 0}var Sa=La,Oa=Object.prototype.hasOwnProperty;function Ia(e){var t=this.__data__;return Ea?void 0!==t[e]:Oa.call(t,e)}var ka=Ia,Ma="__lodash_hash_undefined__";function Pa(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ea&&void 0===t?Ma:t,this}var Ra=Pa;function Ba(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ba.prototype.clear=_a,Ba.prototype.delete=Ca,Ba.prototype.get=Sa,Ba.prototype.has=ka,Ba.prototype.set=Ra;var Fa=Ba;function za(){this.__data__=[],this.size=0}var Ga=za;function Ya(e,t){return e===t||e!=e&&t!=t}var Xa=Ya;function Va(e,t){for(var n=e.length;n--;)if(Xa(e[n][0],t))return n;return-1}var Ua=Va,ja=Array.prototype.splice;function Ha(e){var t=this.__data__,n=Ua(t,e);return!(n<0||(n==t.length-1?t.pop():ja.call(t,n,1),--this.size,0))}var qa=Ha;function Wa(e){var t=this.__data__,n=Ua(t,e);return n<0?void 0:t[n][1]}var $a=Wa;function Ka(e){return Ua(this.__data__,e)>-1}var Za=Ka;function Qa(e,t){var n=this.__data__,r=Ua(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Ja=Qa;function eo(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}eo.prototype.clear=Ga,eo.prototype.delete=qa,eo.prototype.get=$a,eo.prototype.has=Za,eo.prototype.set=Ja;var to=eo,no=wa(pe,"Map");function ro(){this.size=0,this.__data__={hash:new Fa,map:new(no||to),string:new Fa}}var io=ro;function ao(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var oo=ao;function so(e,t){var n=e.__data__;return oo(t)?n["string"==typeof t?"string":"hash"]:n.map}var lo=so;function uo(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t}var co=uo;function ho(e){return lo(this,e).get(e)}var po=ho;function go(e){return lo(this,e).has(e)}var fo=go;function vo(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var yo=vo;function mo(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}mo.prototype.clear=io,mo.prototype.delete=co,mo.prototype.get=po,mo.prototype.has=fo,mo.prototype.set=yo;var bo=mo,xo="Expected a function";function wo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(xo);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(wo.Cache||bo),n}wo.Cache=bo;var Eo=wo,To=500;function _o(e){var t=Eo(e,(function(e){return n.size===To&&n.clear(),e})),n=t.cache;return t}var Do=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Co=/\\(\\)?/g,No=_o((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Do,(function(e,n,r,i){t.push(r?i.replace(Co,"$1"):n||e)})),t}));function Ao(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Lo=Ao,So=1/0,Oo=we?we.prototype:void 0,Io=Oo?Oo.toString:void 0;function ko(e){if("string"==typeof e)return e;if(Ui(e))return Lo(e,ko)+"";if(Ge(e))return Io?Io.call(e):"";var t=e+"";return"0"==t&&1/e==-So?"-0":t}var Mo=ko;function Po(e){return null==e?"":Mo(e)}var Ro=Po;function Bo(e,t){return Ui(e)?e:Wi(e,t)?[e]:No(Ro(e))}var Fo=Bo,zo=1/0;function Go(e){if("string"==typeof e||Ge(e))return e;var t=e+"";return"0"==t&&1/e==-zo?"-0":t}var Yo=Go;function Xo(e,t){for(var n=0,r=(t=Fo(t,e)).length;null!=e&&n<r;)e=e[Yo(t[n++])];return n&&n==r?e:void 0}var Vo=Xo;function Uo(e,t,n){var r=null==e?void 0:Vo(e,t);return void 0===r?n:r}var jo=Uo,Ho=function(){try{var e=wa(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();function qo(e,t,n){"__proto__"==t&&Ho?Ho(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Wo=qo,$o=Object.prototype.hasOwnProperty;function Ko(e,t,n){var r=e[t];$o.call(e,t)&&Xa(r,n)&&(void 0!==n||t in e)||Wo(e,t,n)}var Zo=Ko,Qo=9007199254740991,Jo=/^(?:0|[1-9]\d*)$/;function es(e,t){var n=typeof e;return!!(t=null==t?Qo:t)&&("number"==n||"symbol"!=n&&Jo.test(e))&&e>-1&&e%1==0&&e<t}var ts=es;function ns(e,t,n,r){if(!le(e))return e;for(var i=-1,a=(t=Fo(t,e)).length,o=a-1,s=e;null!=s&&++i<a;){var l=Yo(t[i]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(i!=o){var c=s[l];void 0===(u=r?r(c,l,s):void 0)&&(u=le(c)?c:ts(t[i+1])?[]:{})}Zo(s,l,u),s=s[l]}return e}var rs=ns;function is(e,t,n){return null==e?e:rs(e,t,n)}var as=is;function os(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var ss=os;function ls(e){return Ui(e)?Lo(e,Yo):Ge(e)?[e]:ss(No(Ro(e)))}var us=ls,cs={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new Gi((function(e,t){var i=function(t){n.off.apply(n,o),e(t)},a=r.concat([i]),o=a.concat([]);n.on.apply(n,a)}))}}},hs={};[Vi,{data:function(e){return e=Q({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,o=void 0!==i.length,s=o?i:[i],l=o?i[0]:i;if(b(t)){var u,c=-1!==t.indexOf(".")&&us(t);if(r.allowGetting&&void 0===n)return l&&(r.beforeGet(l),u=c&&void 0===l._private[r.field][t]?jo(l._private[r.field],c):l._private[r.field][t]),u;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var h=a({},t,n);r.beforeSet(i,h);for(var d=0,p=s.length;d<p;d++){var g=s[d];r.canSet(g)&&(c&&void 0===l._private[r.field][t]?as(g._private[r.field],c,n):g._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&E(t)){var f,v,y=t,m=Object.keys(y);r.beforeSet(i,y);for(var w=0;w<m.length;w++)if(v=y[f=m[w]],!r.immutableKeys[f])for(var T=0;T<s.length;T++){var _=s[T];r.canSet(_)&&(_._private[r.field][f]=v)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&x(t)){var D=t;i.on(r.bindingEvent,D)}else if(r.allowGetting&&void 0===t){var C;return l&&(r.beforeGet(l),C=l._private[r.field]),C}return i}},removeData:function(e){return e=Q({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=void 0!==r.length?r:[r];if(b(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var l=a[s];if(!k(l)&&!n.immutableKeys[l])for(var u=0,c=i.length;u<c;u++)i[u]._private[n.field][l]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(void 0===t){for(var h=0,d=i.length;h<d;h++)for(var p=i[h]._private[n.field],g=Object.keys(p),f=0;f<g.length;f++){var v=g[f];!n.immutableKeys[v]&&(p[v]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},cs].forEach((function(e){Q(hs,e)}));var ds={animate:hs.animate(),animation:hs.animation(),animated:hs.animated(),clearQueue:hs.clearQueue(),delay:hs.delay(),delayAnimation:hs.delayAnimation(),stop:hs.stop()},ps={classes:function(e){var t=this;if(void 0===e){var n=[];return t[0]._private.classes.forEach((function(e){return n.push(e)})),n}w(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],i=new Ut(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var h=e[c];if(!l.has(h)){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){w(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],l=s._private.classes,u=!1,c=0;c<e.length;c++){var h=e[c],d=l.has(h),p=!1;t||r&&!d?(l.add(h),p=!0):(!t||r&&d)&&(l.delete(h),p=!0),!u&&p&&(i.push(s),u=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};ps.className=ps.classNames=ps.classes;var gs={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:V,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};gs.variable="(?:[\\w-.]|(?:\\\\"+gs.metaChar+"))+",gs.className="(?:[\\w-]|(?:\\\\"+gs.metaChar+"))+",gs.value=gs.string+"|"+gs.number,gs.id=gs.variable,function(){var e,t,n;for(e=gs.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],gs.comparatorOp+="|@"+t;for(e=gs.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(gs.comparatorOp+="|\\!"+t)}();var fs=function(){return{checks:[]}},vs={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},ys=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return Z(e.selector,t.selector)})),ms=function(){for(var e,t={},n=0;n<ys.length;n++)t[(e=ys[n]).selector]=e.matches;return t}(),bs=function(e,t){return ms[e](t)},xs="("+ys.map((function(e){return e.selector})).join("|")+")",ws=function(e){return e.replace(new RegExp("\\\\("+gs.metaChar+")","g"),(function(e,t){return t}))},Es=function(e,t,n){e[e.length-1]=n},Ts=[{name:"group",query:!0,regex:"("+gs.group+")",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:vs.GROUP,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:xs,populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:vs.STATE,value:r})}},{name:"id",query:!0,regex:"\\#("+gs.id+")",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:vs.ID,value:ws(r)})}},{name:"className",query:!0,regex:"\\.("+gs.className+")",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:vs.CLASS,value:ws(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+gs.variable+")\\s*\\]",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:vs.DATA_EXIST,field:ws(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+gs.variable+")\\s*("+gs.comparatorOp+")\\s*("+gs.value+")\\s*\\]",populate:function(e,t,n){var r=o(n,3),i=r[0],a=r[1],s=r[2];s=null!=new RegExp("^"+gs.string+"$").exec(s)?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:vs.DATA_COMPARE,field:ws(i),operator:a,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+gs.boolOp+")\\s*("+gs.variable+")\\s*\\]",populate:function(e,t,n){var r=o(n,2),i=r[0],a=r[1];t.checks.push({type:vs.DATA_BOOL,field:ws(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+gs.meta+")\\s*("+gs.comparatorOp+")\\s*("+gs.number+")\\s*\\]\\]",populate:function(e,t,n){var r=o(n,3),i=r[0],a=r[1],s=r[2];t.checks.push({type:vs.META_COMPARE,field:ws(i),operator:a,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:gs.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=fs()}},{name:"directedEdge",separator:!0,regex:gs.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=fs(),r=t,i=fs();return n.checks.push({type:vs.DIRECTED_EDGE,source:r,target:i}),Es(e,t,n),e.edgeCount++,i}var a=fs(),o=t,s=fs();return a.checks.push({type:vs.NODE_SOURCE,source:o,target:s}),Es(e,t,a),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:gs.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=fs(),r=t,i=fs();return n.checks.push({type:vs.UNDIRECTED_EDGE,nodes:[r,i]}),Es(e,t,n),e.edgeCount++,i}var a=fs(),o=t,s=fs();return a.checks.push({type:vs.NODE_NEIGHBOR,node:o,neighbor:s}),Es(e,t,a),s}},{name:"child",separator:!0,regex:gs.child,populate:function(e,t){if(null==e.currentSubject){var n=fs(),r=fs(),i=e[e.length-1];return n.checks.push({type:vs.CHILD,parent:i,child:r}),Es(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=fs(),o=e[e.length-1],s=fs(),l=fs(),u=fs(),c=fs();return a.checks.push({type:vs.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:vs.TRUE}],c.checks.push({type:vs.TRUE}),s.checks.push({type:vs.PARENT,parent:c,child:u}),Es(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=fs(),d=fs(),p=[{type:vs.PARENT,parent:h,child:d}];return h.checks=t.checks,t.checks=p,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:gs.descendant,populate:function(e,t){if(null==e.currentSubject){var n=fs(),r=fs(),i=e[e.length-1];return n.checks.push({type:vs.DESCENDANT,ancestor:i,descendant:r}),Es(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=fs(),o=e[e.length-1],s=fs(),l=fs(),u=fs(),c=fs();return a.checks.push({type:vs.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:vs.TRUE}],c.checks.push({type:vs.TRUE}),s.checks.push({type:vs.ANCESTOR,ancestor:c,descendant:u}),Es(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=fs(),d=fs(),p=[{type:vs.ANCESTOR,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=p,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:gs.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Nt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;r===vs.DIRECTED_EDGE?n.type=vs.NODE_TARGET:r===vs.UNDIRECTED_EDGE&&(n.type=vs.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Ts.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)}));var _s=function(e){for(var t,n,r,i=0;i<Ts.length;i++){var a=Ts[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},Ds=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Cs={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=fs();for(t.length=1,n=Ds(n);;){var i=_s(n);if(null==i.expr)return Nt("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(!1===o)return!1;if(null!=o&&(r=o),(n=i.remaining).match(/^\s*$/))break}var s=t[t.length-1];null!=t.currentSubject&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var u=t[l];if(u.compoundCount>0&&u.edgeCount>0)return Nt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Nt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Nt("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return b(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case vs.GROUP:var l=e(s);return l.substring(0,l.length-1);case vs.DATA_COMPARE:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case vs.DATA_BOOL:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case vs.DATA_EXIST:return"["+r.field+"]";case vs.META_COMPARE:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case vs.STATE:return s;case vs.ID:return"#"+s;case vs.CLASS:return"."+s;case vs.PARENT:case vs.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case vs.ANCESTOR:case vs.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case vs.COMPOUND_SPLIT:var g=i(r.left,a),f=i(r.subject,a),v=i(r.right,a);return g+(g.length>0?" ":"")+f+v;case vs.TRUE:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},Ns=function(e,t,n){var r,i,a,o=b(e),s=_(e),l=b(n),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1}return!c||null==e&&h||(r=!r),r},As=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},Ls=function(e){return void 0!==e},Ss=function(e,t){return e.data(t)},Os=function(e,t){return e[t]()},Is=[],ks=function(e,t){return e.checks.every((function(e){return Is[e.type](e,t)}))};Is[vs.GROUP]=function(e,t){var n=e.value;return"*"===n||n===t.group()},Is[vs.STATE]=function(e,t){var n=e.value;return bs(n,t)},Is[vs.ID]=function(e,t){var n=e.value;return t.id()===n},Is[vs.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},Is[vs.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Ns(Os(t,n),r,i)},Is[vs.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Ns(Ss(t,n),r,i)},Is[vs.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return As(Ss(t,n),r)},Is[vs.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,Ls(Ss(t,n))},Is[vs.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return ks(n,i)&&ks(r,a)||ks(r,i)&&ks(n,a)},Is[vs.NODE_NEIGHBOR]=function(e,t){return ks(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&ks(e.neighbor,t)}))},Is[vs.DIRECTED_EDGE]=function(e,t){return ks(e.source,t.source())&&ks(e.target,t.target())},Is[vs.NODE_SOURCE]=function(e,t){return ks(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&ks(e.target,t)}))},Is[vs.NODE_TARGET]=function(e,t){return ks(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&ks(e.source,t)}))},Is[vs.CHILD]=function(e,t){return ks(e.child,t)&&ks(e.parent,t.parent())},Is[vs.PARENT]=function(e,t){return ks(e.parent,t)&&t.children().some((function(t){return ks(e.child,t)}))},Is[vs.DESCENDANT]=function(e,t){return ks(e.descendant,t)&&t.ancestors().some((function(t){return ks(e.ancestor,t)}))},Is[vs.ANCESTOR]=function(e,t){return ks(e.ancestor,t)&&t.descendants().some((function(t){return ks(e.descendant,t)}))},Is[vs.COMPOUND_SPLIT]=function(e,t){return ks(e.subject,t)&&ks(e.left,t)&&ks(e.right,t)},Is[vs.TRUE]=function(){return!0},Is[vs.COLLECTION]=function(e,t){return e.value.has(t)},Is[vs.FILTER]=function(e,t){return(0,e.value)(t)};var Ms={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(ks(r,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===vs.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(ks(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}},Ps=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||b(e)&&e.match(/^\s*$/)||(N(e)?this.addQuery({checks:[{type:vs.COLLECTION,value:e.collection()}]}):x(e)?this.addQuery({checks:[{type:vs.FILTER,value:e}]}):b(e)?this.parse(e)||(this.invalid=!0):Dt("A selector must be created from a string; found "))},Rs=Ps.prototype;[Cs,Ms].forEach((function(e){return Q(Rs,e)})),Rs.text=function(){return this.inputText},Rs.size=function(){return this.length},Rs.eq=function(e){return this[e]},Rs.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Rs.addQuery=function(e){this[this.length++]=e},Rs.selector=Rs.toString;var Bs={allAre:function(e){var t=new Ps(e);return this.every((function(e){return t.matches(e)}))},is:function(e){var t=new Ps(e);return this.some((function(e){return t.matches(e)}))},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.id())})))},anySame:function(e){return e=this.cy().collection(e),this.some((function(t){return e.hasElementWithId(t.id())}))},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every((function(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}};Bs.allAreNeighbours=Bs.allAreNeighbors,Bs.has=Bs.contains,Bs.equal=Bs.equals=Bs.same;var Fs,zs,Gs=function(e,t){return function(n,r,i,a){var o,s=n,l=this;if(null==s?o="":N(s)&&1===s.length&&(o=s.id()),1===l.length&&o){var u=l[0]._private,c=u.traversalCache=u.traversalCache||{},h=c[t]=c[t]||[],d=gt(o),p=h[d];return p||(h[d]=e.call(l,n,r,i,a))}return e.call(l,n,r,i,a)}},Ys={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:Gs((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)}),"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function Xs(e,t,n,r){for(var i=[],a=new Ut,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Vs(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function Us(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function js(e,t,n){Us(e,t,n),Vs(e,t,n)}Ys.forEachDown=function(e){return Xs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Vs)},Ys.forEachUp=function(e){return Xs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Us)},Ys.forEachUpAndDown=function(e){return Xs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],js)},Ys.ancestors=Ys.parents,(Fs=zs={data:hs.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:hs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:hs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:hs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:hs.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:hs.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Fs.data,Fs.removeAttr=Fs.removeData;var Hs,qs,Ws=zs,$s={};function Ks(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}}}function Zs(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}Q($s,{degree:Ks((function(e,t){return t.source().same(t.target())?2:1})),indegree:Ks((function(e,t){return t.target().same(e)?1:0})),outdegree:Ks((function(e,t){return t.source().same(e)?1:0}))}),Q($s,{minDegree:Zs("degree",(function(e,t){return e<t})),maxDegree:Zs("degree",(function(e,t){return e>t})),minIndegree:Zs("indegree",(function(e,t){return e<t})),maxIndegree:Zs("indegree",(function(e,t){return e>t})),minOutdegree:Zs("outdegree",(function(e,t){return e<t})),maxOutdegree:Zs("outdegree",(function(e,t){return e>t}))}),Q($s,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var Qs=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};!i.isParent()||0===o.x&&0===o.y||i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},Js={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Qs(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(Hs=qs={position:hs.data(Js),silentPosition:hs.data(Q({},Js,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Qs(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(E(e))t?this.silentPosition(e):this.position(e);else if(x(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(E(e)?(r={x:_(e.x)?e.x:0,y:_(e.y)?e.y:0},n=t):b(e)&&_(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return E(e)?this.shift(e,!0):b(e)&&_(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=E(e)?e:void 0,s=void 0!==o||void 0!==t&&b(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=hn(l,i,a),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(dn(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=E(e)?e:void 0,a=void 0!==i||void 0!==t&&b(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!a){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d<this.length;d++){var p=this[d],g=o?p.parent():null,f=g&&g.length>0,v=f;f&&(g=g[0]);var y=v?g.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==i&&p.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}}).modelPosition=Hs.point=Hs.position,Hs.modelPositions=Hs.points=Hs.positions,Hs.renderedPoint=Hs.renderedPosition,Hs.relativePoint=Hs.relativePosition;var el,tl,nl=qs;el=tl={},tl.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},tl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},tl.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),f=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=m(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-f+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function m(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;a.compoundBoundsClean&&!e||(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var rl=function(e){return e===1/0||e===-1/0?0:e},il=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},al=function(e,t){return null==t?e:il(e,t.x1,t.y1,t.x2,t.y2)},ol=function(e,t,n){return Ft(e,t,n)},sl=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Mn(u,1),il(e,u.x1,u.y1,u.x2,u.y2)}}},ll=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=ol(a,"labelWidth",n),p=ol(a,"labelHeight",n),g=ol(a,"labelX",n),f=ol(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,T=2,_=p,D=d,C=D/2,N=_/2;if(m)o=g-C,s=g+C,l=f-N,u=f+N;else{switch(c.value){case"left":o=g-D,s=g;break;case"center":o=g-C,s=g+C;break;case"right":o=g,s=g+D}switch(h.value){case"top":l=f-_,u=f;break;case"center":l=f-N,u=f+N;break;case"bottom":l=f,u=f+_}}o+=v-Math.max(x,w)-E-T,s+=v+Math.max(x,w)+E+T,l+=y-Math.max(x,w)-E-T,u+=y+Math.max(x,w)+E+T;var A=n||"main",L=i.labelBounds,S=L[A]=L[A]||{};S.x1=o,S.y1=l,S.x2=s,S.y2=u,S.w=s-o,S.h=u-l;var O=m&&"autorotate"===b.strValue,I=null!=b.pfValue&&0!==b.pfValue;if(O||I){var k=O?ol(i.rstyle,"labelAngle",n):b.pfValue,M=Math.cos(k),P=Math.sin(k),R=(o+s)/2,B=(l+u)/2;if(!m){switch(c.value){case"left":R=s;break;case"right":R=o}switch(h.value){case"top":B=u;break;case"bottom":B=l}}var F=function(e,t){return{x:(e-=R)*M-(t-=B)*P+R,y:e*P+t*M+B}},z=F(o,l),G=F(o,u),Y=F(s,l),X=F(s,u);o=Math.min(z.x,G.x,Y.x,X.x),s=Math.max(z.x,G.x,Y.x,X.x),l=Math.min(z.y,G.y,Y.y,X.y),u=Math.max(z.y,G.y,Y.y,X.y)}var V=A+"Rot",U=L[V]=L[V]||{};U.x1=o,U.y1=l,U.x2=s,U.y2=u,U.w=s-o,U.h=u-l,il(e,o,l,s,u),il(i.labelBounds.all,o,l,s,u)}return e}},ul=function(e,t){var n,r,i,a,o,s,l=e._private.cy,u=l.styleEnabled(),c=l.headless(),h=Ln(),d=e._private,p=e.isNode(),g=e.isEdge(),f=d.rstyle,v=p&&u?e.pstyle("bounds-expansion").pfValue:[0],y=function(e){return"none"!==e.pstyle("display").value},m=!u||y(e)&&(!g||y(e.source())&&y(e.target()));if(m){var b=0;u&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(b=e.pstyle("overlay-padding").value);var x=0;u&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(x=e.pstyle("underlay-padding").value);var w=Math.max(b,x),E=0;if(u&&(E=e.pstyle("width").pfValue/2),p&&t.includeNodes){var T=e.position();o=T.x,s=T.y;var _=e.outerWidth()/2,D=e.outerHeight()/2;il(h,n=o-_,i=s-D,r=o+_,a=s+D)}else if(g&&t.includeEdges)if(u&&!c){var C=e.pstyle("curve-style").strValue;if(n=Math.min(f.srcX,f.midX,f.tgtX),r=Math.max(f.srcX,f.midX,f.tgtX),i=Math.min(f.srcY,f.midY,f.tgtY),a=Math.max(f.srcY,f.midY,f.tgtY),il(h,n-=E,i-=E,r+=E,a+=E),"haystack"===C){var N=f.haystackPts;if(N&&2===N.length){if(n=N[0].x,i=N[0].y,n>(r=N[1].x)){var A=n;n=r,r=A}if(i>(a=N[1].y)){var L=i;i=a,a=L}il(h,n-E,i-E,r+E,a+E)}}else if("bezier"===C||"unbundled-bezier"===C||"segments"===C||"taxi"===C){var S;switch(C){case"bezier":case"unbundled-bezier":S=f.bezierPts;break;case"segments":case"taxi":S=f.linePts}if(null!=S)for(var O=0;O<S.length;O++){var I=S[O];n=I.x-E,r=I.x+E,i=I.y-E,a=I.y+E,il(h,n,i,r,a)}}}else{var k=e.source().position(),M=e.target().position();if((n=k.x)>(r=M.x)){var P=n;n=r,r=P}if((i=k.y)>(a=M.y)){var R=i;i=a,a=R}il(h,n-=E,i-=E,r+=E,a+=E)}if(u&&t.includeEdges&&g&&(sl(h,e,"mid-source"),sl(h,e,"mid-target"),sl(h,e,"source"),sl(h,e,"target")),u&&"yes"===e.pstyle("ghost").value){var B=e.pstyle("ghost-offset-x").pfValue,F=e.pstyle("ghost-offset-y").pfValue;il(h,h.x1+B,h.y1+F,h.x2+B,h.y2+F)}var z=d.bodyBounds=d.bodyBounds||{};Rn(z,h),Pn(z,v),Mn(z,1),u&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,il(h,n-w,i-w,r+w,a+w));var G=d.overlayBounds=d.overlayBounds||{};Rn(G,h),Pn(G,v),Mn(G,1);var Y=d.labelBounds=d.labelBounds||{};null!=Y.all?On(Y.all):Y.all=Ln(),u&&t.includeLabels&&(t.includeMainLabels&&ll(h,e,null),g&&(t.includeSourceLabels&&ll(h,e,"source"),t.includeTargetLabels&&ll(h,e,"target")))}return h.x1=rl(h.x1),h.y1=rl(h.y1),h.x2=rl(h.x2),h.y2=rl(h.y2),h.w=rl(h.x2-h.x1),h.h=rl(h.y2-h.y1),h.w>0&&h.h>0&&m&&(Pn(h,v),Mn(h,1)),h},cl=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays)},hl=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return pt([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},dl=function(e,t){var n,r=e._private,i=e.isEdge(),a=(null==t?gl:cl(t))===gl,o=hl(e),s=r.bbCachePosKey===o,l=t.useCache&&s,u=function(e){return null==e._private.bbCache||e._private.styleDirty};if(!l||u(e)||i&&u(e.source())||u(e.target())?(s||e.recalculateRenderedStyle(l),n=ul(e,pl),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!a){var c=e.isNode();n=Ln(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?al(n,r.overlayBounds):al(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?al(n,r.labelBounds.all):(t.includeMainLabels&&al(n,r.labelBounds.mainRot),t.includeSourceLabels&&al(n,r.labelBounds.sourceRot),t.includeTargetLabels&&al(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},pl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},gl=cl(pl),fl=Mt(pl);tl.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=Ln();var n=fl(e=e||pl),r=this;if(r.cy().styleEnabled())for(var i=0;i<r.length;i++){var a=r[i],o=a._private,s=hl(a),l=o.bbCachePosKey===s,u=n.useCache&&l&&!o.styleDirty;a.recalculateRenderedStyle(u)}this.updateCompoundBounds(!e.useCache);for(var c=0;c<r.length;c++){var h=r[c];al(t,dl(h,n))}}else e=void 0===e?pl:fl(e),t=dl(this[0],e);return t.x1=rl(t.x1),t.y1=rl(t.y1),t.x2=rl(t.x2),t.y2=rl(t.y2),t.w=rl(t.x2-t.x1),t.h=rl(t.y2-t.y1),t},tl.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},tl.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter((function(e){return e.isParent()})),t=t.not(i)),E(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=Sn(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),l},el.boundingbox=el.bb=el.boundingBox,el.renderedBoundingbox=el.renderedBoundingBox;var vl,yl,ml=tl;vl=yl={};var bl=function(e){e.uppercaseName=X(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=X(e.outerName),vl[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):i.pfValue}return 1}},vl["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},vl["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},vl["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};bl({name:"width"}),bl({name:"height"}),yl.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),void 0!==t.autoPadding?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},yl.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},yl.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var xl=yl,wl=function(e,t){if(e.isEdge())return t(e)},El=function(e,t){if(e.isEdge()){var n=e.cy();return hn(t(e),n.zoom(),n.pan())}},Tl=function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map((function(e){return hn(e,i,r)}))}},_l={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Dl=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Cl=Object.keys(_l).reduce((function(e,t){var n=_l[t],r=Dl(t);return e[t]=function(){return wl(this,n.get)},n.mult?e[r]=function(){return Tl(this,n.get)}:e[r]=function(){return El(this,n.get)},e}),{}),Nl=Q({},nl,ml,xl,Cl),Al=function(e,t){this.recycle(e,t)};function Ll(){return!1}function Sl(){return!0}Al.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Ll,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Sl:Ll):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Sl;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Sl;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Sl,this.stopPropagation()},isDefaultPrevented:Ll,isPropagationStopped:Ll,isImmediatePropagationStopped:Ll};var Ol=/^([^.]+)(\.(?:[^.]+))?$/,Il=".*",kl={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Ml=Object.keys(kl),Pl={};function Rl(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Pl,t=arguments.length>1?arguments[1]:void 0,n=0;n<Ml.length;n++){var r=Ml[n];this[r]=e[r]||kl[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Bl=Rl.prototype,Fl=function(e,t,n,r,i,a,o){x(r)&&(i=r,r=null),o&&(a=null==a?o:Q({},a,o));for(var s=w(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!k(u)){var c=u.match(Ol);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,r,i,a))break}}},zl=function(e,t){return e.addEventFields(e.context,t),new Al(t.type,t)},Gl=function(e,t,n){if(I(n))t(e,n);else if(E(n))t(e,zl(e,n));else for(var r=w(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!k(a)){var o=a.match(Ol);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,zl(e,{type:s,namespace:l,target:e.context}))}}}};Bl.on=Bl.addListener=function(e,t,n,r,i){return Fl(this,(function(e,t,n,r,i,a,o){x(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})}),e,t,n,r,i),this},Bl.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Bl.removeListener=Bl.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=St(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];Fl(i,(function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1}),e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},Bl.removeAllListeners=function(){return this.removeListener("*")},Bl.emit=Bl.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,w(t)||(t=[t]),Gl(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||i.namespace===Il)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&Bt(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==i})));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o(s);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)}),e),this.emitting--,this};var Yl={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&A(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Xl=function(e){return b(e)?new Ps(e):e},Vl={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Rl(Yl,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Xl(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=Xl(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=Xl(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=Xl(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};hs.eventAliasesOn(Vl);var Ul={nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.isEdge()})).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(b(e)||N(e))return new Ps(e).filter(this);if(x(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){b(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(b(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,l=0;l<o.length;l++){var u=o[l];s.has(u)&&n.push(u)}return n},xor:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i],o=!this.has(a);o&&r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&b(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n,r=-1/0,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<r&&(r=s,n=o)}return{value:r,ele:n}}},jl=Ul;jl.u=jl["|"]=jl["+"]=jl.union=jl.or=jl.add,jl["\\"]=jl["!"]=jl["-"]=jl.difference=jl.relativeComplement=jl.subtract=jl.not,jl.n=jl["&"]=jl["."]=jl.and=jl.intersection=jl.intersect,jl["^"]=jl["(+)"]=jl["(-)"]=jl.symmetricDifference=jl.symdiff=jl.xor,jl.fnFilter=jl.filterFn=jl.stdFilter=jl.filter,jl.complement=jl.abscomp=jl.absoluteComplement;var Hl,ql={isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Wl=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?xt:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},$l={forEach:function(e,t){if(x(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!x(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Wl)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:xt-1}var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}};$l.each=$l.forEach,Hl="undefined",("undefined"==typeof Symbol?"undefined":e(Symbol))!=Hl&&e(Symbol.iterator)!=Hl&&($l[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return a({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))});var Kl=Mt({nodeDimensionsIncludeLabels:!1}),Zl={layoutDimensions:function(e){var t;if(e=Kl(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return 0!==t.w&&0!==t.h||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter((function(e){return!e.isParent()})),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=F(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=Ln(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);kn(e,i.x,i.y)}return e},h=c(),d=F((function(e,n){var r=s(e,n);if(u){var i=Math.abs(t.spacingFactor);r=l(i,h,r)}return null!=t.transform&&(r=t.transform(e,r)),r}),o);if(t.animate){for(var p=0;p<r.length;p++){var g=r[p],f=d(g,p);if(null==t.animateFilter||t.animateFilter(g,p)){var v=g.animation({position:f,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else g.position(f)}if(t.fit){var y=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else if(void 0!==t.zoom&&void 0!==t.pan){var m=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Gi.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(Q({},e,{eles:this}))}};function Ql(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function Jl(e,t){return e=gt(e),function(n){return Ql(e,t,n)}}function eu(e,t){e=gt(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return Ql(e,n,t)}}Zl.createLayout=Zl.makeLayout=Zl.layout;var tu={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach((function(e){n(e),e.connectedEdges().forEach(n)})),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=this;e=!(!e&&void 0!==e),t.hasCompoundNodes()&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var r=n;return e?r.emitAndNotify("style"):r.emit("style"),n.forEach((function(e){return e._private.styleDirty=!0})),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(E(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify("style")}else if(b(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(void 0===e)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var l=i[s];r.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i*=a[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();return e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function nu(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++)if(!t(n[r]))return!1;return!0}function ru(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||nu(i,r);var s=o.source,l=o.target;return n(s)&&(!a||nu(s,n))&&(s===l||n(l)&&(!a||nu(l,n)))}}}var iu=Jl("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())}));tu.takesUpSpace=eu("takesUpSpace",ru({ok:iu}));var au=Jl("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&iu(e)})),ou=Jl("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&iu(e)}));tu.interactive=eu("interactive",ru({ok:au,parentOk:ou,edgeOkViaNode:iu})),tu.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var su=Jl("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&iu(e)})),lu=iu;tu.visible=eu("visible",ru({ok:su,edgeOkViaNode:lu})),tu.hidden=function(){var e=this[0];if(e)return!e.visible()},tu.isBundledBezier=eu("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()})),tu.bypass=tu.css=tu.style,tu.renderedCss=tu.renderedStyle,tu.removeBypass=tu.removeCss=tu.removeStyle,tu.pstyle=tu.parsedStyle;var uu={};function cu(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&x(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&w(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function hu(e){uu[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},uu[e.on]=cu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),uu[e.off]=cu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}hu({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),hu({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),hu({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),hu({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),uu.deselect=uu.unselect,uu.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},hu({field:"active",on:"activate",off:"unactivate"}),hu({field:"pannable",on:"panify",off:"unpanify"}),uu.inactive=function(){var e=this[0];if(e)return!e._private.active};var du={},pu=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),l=0;l<s.length;l++){var u=s[l],c=u.source(),h=u.target();if(e.noIncomingEdges&&h===a&&c!==a||e.noOutgoingEdges&&c===a&&h!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},gu=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();e.outgoing&&u===a?(r.push(l),r.push(c)):e.incoming&&c===a&&(r.push(l),r.push(u))}}return this.spawn(r,!0).filter(t)}},fu=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function vu(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}function yu(e){return function(t){var n=[],r=this._private.cy,i=e||{};b(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||h){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!h)continue}n.push(l)}}return this.spawn(n,!0)}}function mu(e){return e=Q({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],p=d._private.data,g=p.target,f=p.source,v=g===u&&f===l,y=l===g&&u===f;(i.codirected&&v||!i.codirected&&(v||y))&&n.push(d)}return this.spawn(n,!0).filter(t)}}du.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},Q(du,{roots:pu({noIncomingEdges:!0}),leaves:pu({noOutgoingEdges:!0}),outgoers:Gs(gu({outgoing:!0}),"outgoers"),successors:fu({outgoing:!0}),incomers:Gs(gu({incoming:!0}),"incomers"),predecessors:fu({incoming:!0})}),Q(du,{neighborhood:Gs((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),du.neighbourhood=du.neighborhood,du.closedNeighbourhood=du.closedNeighborhood,du.openNeighbourhood=du.openNeighborhood,Q(du,{source:Gs((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Gs((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:vu({attr:"source"}),targets:vu({attr:"target"})}),Q(du,{edgesWith:Gs(yu(),"edgesWith"),edgesTo:Gs(yu({thisIsSrc:!0}),"edgesTo")}),Q(du,{connectedEdges:Gs((function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)}),"connectedEdges"),connectedNodes:Gs((function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)}),"connectedNodes"),parallelEdges:Gs(mu(),"parallelEdges"),codirectedEdges:Gs(mu({codirected:!0}),"codirectedEdges")}),Q(du,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))};do{s()}while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),du.componentsOf=du.components;var bu=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new Yt,a=!1;if(t){if(t.length>0&&E(t[0])&&!A(t[0])){a=!0;for(var o=[],s=new Ut,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var h=c.data;if(null==h.id)h.id=Ot();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var d=new jt(e,c,!1);o.push(d),s.add(h.id)}t=o}}else t=[];this.length=0;for(var p=0,g=t.length;p<g;p++){var f=t[p][0];if(null!=f){var v=f._private.data.id;n&&i.has(v)||(n&&i.set(v,{index:this.length,ele:f}),this[this.length]=f,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new Yt,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()}else Dt("A collection must have a reference to the core")},xu=jt.prototype=bu.prototype=Object.create(Array.prototype);xu.instanceString=function(){return"collection"},xu.spawn=function(e,t){return new bu(this.cy(),e,t)},xu.spawnSelf=function(){return this.spawn(this)},xu.cy=function(){return this._private.cy},xu.renderer=function(){return this._private.cy.renderer()},xu.element=function(){return this[0]},xu.collection=function(){return L(this)?this:new bu(this._private.cy,[this])},xu.unique=function(){return new bu(this._private.cy,this,!0)},xu.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},xu.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new bu(t)},xu.$id=xu.getElementById,xu.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},xu.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},xu.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},xu.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(E(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;!u||null==c&&null==i.parent||c==i.parent||(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var d={data:Lt(r.data),position:Lt(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};d.classes="";var p=0;return r.classes.forEach((function(e){return d.classes+=0==p++?e:" "+e})),d}}},xu.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},xu.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),i=new jt(e,r,!1);t.push(i)}return new bu(e,t)},xu.copy=xu.clone,xu.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u<c;u++){var h=i[u];r&&!h.removed()||(h.isNode()?s.push(h):l.push(h))}e=s.concat(l);var d=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var p=e[t],g=p._private,f=g.data;if(p.clearTraversalCache(),r||g.removed)if(void 0===f.id)f.id=Ot();else if(_(f.id))f.id=""+f.id;else{if(k(f.id)||!b(f.id)){Dt("Can not create element with invalid string ID `"+f.id+"`"),d();continue}if(a.hasElementWithId(f.id)){Dt("Can not create second element with ID `"+f.id+"`"),d();continue}}var v=f.id;if(p.isNode()){var y=g.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(p.isEdge()){for(var m=p,x=["source","target"],w=x.length,E=!1,T=0;T<w;T++){var D=x[T],C=f[D];_(C)&&(C=f[D]=""+f[D]),null==C||""===C?(Dt("Can not create edge `"+v+"` with unspecified "+D),E=!0):a.hasElementWithId(C)||(Dt("Can not create edge `"+v+"` with nonexistant "+D+" `"+C+"`"),E=!0)}if(E){d();continue}var N=a.getElementById(f.source),A=a.getElementById(f.target);N.same(A)?N._private.edges.push(m):(N._private.edges.push(m),A._private.edges.push(m)),m._private.source=N,m._private.target=A}g.map=new Yt,g.map.set(v,{ele:p,index:0}),g.removed=!1,r&&a.addToPool(p)}for(var L=0;L<s.length;L++){var S=s[L],O=S._private.data;_(O.parent)&&(O.parent=""+O.parent);var I=O.parent;if(null!=I||S._private.parent){var M=S._private.parent?a.collection().merge(S._private.parent):a.getElementById(I);if(M.empty())O.parent=void 0;else if(M[0].removed())Nt("Node added with missing parent, reference to parent removed"),O.parent=void 0,S._private.parent=null;else{for(var P=!1,R=M;!R.empty();){if(S.same(R)){P=!0,O.parent=void 0;break}R=R.parent()}P||(M[0]._private.children.push(S),S._private.parent=M[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var B=e.length===i.length?i:new bu(a,e),F=0;F<B.length;F++){var z=B[F];z.isNode()||(z.parallelEdges().clearTraversalCache(),z.source().clearTraversalCache(),z.target().clearTraversalCache())}(o.hasCompoundNodes?a.collection().merge(B).merge(B.connectedNodes()).merge(B.parent()):B).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?B.emitAndNotify("add"):r&&B.emit("add")}return i},xu.removed=function(){var e=this[0];return e&&e._private.removed},xu.inside=function(){var e=this[0];return e&&!e._private.removed},xu.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)l(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)l(t[n])}function l(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var u=0,c=n.length;u<c;u++)l(n[u]);function h(e,t){var n=e._private.edges;Pt(n,t),e.clearTraversalCache()}function d(e){e.clearTraversalCache()}var p=[];function g(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();Pt(n,t),t._private.parent=null,p.ids[r]||(p.ids[r]=!0,p.push(e))}p.ids={},n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var f=0;f<r.length;f++){var v=r[f];if(v.isEdge()){var y=v.source()[0],m=v.target()[0];h(y,v),h(m,v);for(var b=v.parallelEdges(),x=0;x<b.length;x++){var w=b[x];d(w),w.isBundledBezier()&&w.dirtyBoundingBoxCache()}}else{var E=v.parent();0!==E.length&&g(E,v)}t&&(v._private.removed=!0)}var T=a._private.elements;a._private.hasCompoundNodes=!1;for(var _=0;_<T.length;_++)if(T[_].isParent()){a._private.hasCompoundNodes=!0;break}var D=new bu(this.cy(),r);D.size()>0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var C=0;C<p.length;C++){var N=p[C];t&&N.removed()||N.updateStyle()}return D},xu.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var o=a(e.source),s=a(e.target),l=null!=o&&t.hasElementWithId(o),u=null!=s&&t.hasElementWithId(s);(l||u)&&(t.batch((function(){n.remove(r,i),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(l&&(a.source=o),u&&(a.target=s))}n.restore(r,i)})),n.emitAndNotify("move"))}else if(void 0!==e.parent){var c=a(e.parent);if(null===c||t.hasElementWithId(c)){var h=null===c?void 0:c;t.batch((function(){var e=n.remove(r,i);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=h)}e.restore(r,i)})),n.emitAndNotify("move")}}return this},[Si,ds,ps,Bs,Ys,Ws,$s,Nl,Vl,Ul,ql,$l,Zl,tu,uu,du].forEach((function(e){Q(xu,e)}));var wu={add:function(e){var t,n=this;if(N(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new bu(n,i)}}else if(w(e))t=new bu(n,e);else if(E(e)&&(w(e.nodes)||w(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,h=u.length;c<h;c++){var d=u[c],p=s[d];if(w(p))for(var g=0,f=p.length;g<f;g++){var v=Q({group:d},p[g]);l.push(v)}}t=new bu(n,l)}else t=new jt(n,e).collection();return t},remove:function(e){if(N(e));else if(b(e)){var t=e;e=this.$(t)}return e.remove()}};function Eu(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var h=0;h<4;++h)if("number"!=typeof arguments[h]||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function g(e,t){return 3*t-6*e}function f(e){return 3*e}function v(e,t,n){return((p(t,n)*e+g(t,n))*e+f(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*g(t,n)*e+f(t)}function m(t,r){for(var a=0;a<i;++a){var o=y(r,e,n);if(0===o)return r;r-=(v(r,e,n)-t)/o}return r}function b(){for(var t=0;t<l;++t)d[t]=v(t*u,e,n)}function x(t,r,i){var a,l,u=0;do{(a=v(l=r+(i-r)/2,e,n)-t)>0?i=l:r=l}while(Math.abs(a)>o&&++u<s);return l}function w(t){for(var r=0,i=1,o=l-1;i!==o&&d[i]<=t;++i)r+=u;--i;var s=r+(t-d[i])/(d[i+1]-d[i])*u,c=y(s,e,n);return c>=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function T(){E=!0,e===t&&n===r||b()}var _=function(i){return E||T(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var D="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return D},_}var Tu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,h=1e-4,d=.016;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,o=(a=null!==i)?(c=e(t,r))/i*d:d;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>h&&Math.abs(s.v)>h;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),_u=function(e,t,n,r){var i=Eu(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Du={linear:function(e,t,n){return e+(t-e)*n},ease:_u(.25,.1,.25,1),"ease-in":_u(.42,0,1,1),"ease-out":_u(0,0,.58,1),"ease-in-out":_u(.42,0,.58,1),"ease-in-sine":_u(.47,0,.745,.715),"ease-out-sine":_u(.39,.575,.565,1),"ease-in-out-sine":_u(.445,.05,.55,.95),"ease-in-quad":_u(.55,.085,.68,.53),"ease-out-quad":_u(.25,.46,.45,.94),"ease-in-out-quad":_u(.455,.03,.515,.955),"ease-in-cubic":_u(.55,.055,.675,.19),"ease-out-cubic":_u(.215,.61,.355,1),"ease-in-out-cubic":_u(.645,.045,.355,1),"ease-in-quart":_u(.895,.03,.685,.22),"ease-out-quart":_u(.165,.84,.44,1),"ease-in-out-quart":_u(.77,0,.175,1),"ease-in-quint":_u(.755,.05,.855,.06),"ease-out-quint":_u(.23,1,.32,1),"ease-in-out-quint":_u(.86,0,.07,1),"ease-in-expo":_u(.95,.05,.795,.035),"ease-out-expo":_u(.19,1,.22,1),"ease-in-out-expo":_u(1,0,0,1),"ease-in-circ":_u(.6,.04,.98,.335),"ease-out-circ":_u(.075,.82,.165,1),"ease-in-out-circ":_u(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Du.linear;var r=Tu(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":_u};function Cu(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function Nu(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Au(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=Nu(e,i),s=Nu(t,i);if(_(o)&&_(s))return Cu(a,o,s,n,r);if(w(o)&&w(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=Cu(a,c,h,n,r);l.push(d)}else l.push(h)}return l}}function Lu(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=Du.linear;else{var c,h,d;c=b(s)?u.parse("transition-timing-function",s).value:s,b(c)?(h=c,d=[]):(h=c[1],d=c.slice(2).map((function(e){return+e}))),d.length>0?("spring"===h&&d.push(o.duration),o.easingImpl=Du[h].apply(null,d)):o.easingImpl=Du[h]}var p,g=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var f=o.startPosition,v=o.position;if(v&&i&&!e.locked()){var y={};Su(f.x,v.x)&&(y.x=Au(f.x,v.x,p,g)),Su(f.y,v.y)&&(y.y=Au(f.y,v.y,p,g)),e.position(y)}var m=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(Su(m.x,x.x)&&(w.x=Au(m.x,x.x,p,g)),Su(m.y,x.y)&&(w.y=Au(m.y,x.y,p,g)),e.emit("pan"));var T=o.startZoom,_=o.zoom,D=null!=_&&r;D&&(Su(T,_)&&(a.zoom=An(a.minZoom,Au(T,_,p,g),a.maxZoom)),e.emit("zoom")),(E||D)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&i){for(var N=0;N<C.length;N++){var A=C[N],L=A.name,S=A,O=o.startStyle[L],I=Au(O,S,p,g,u.properties[O.name]);u.overrideBypass(e,L,I)}e.emit("style")}}return o.progress=p,p}function Su(e,t){return!!(null!=e&&null!=t&&(_(e)&&_(t)||e&&t))}function Ou(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function Iu(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;d.stopped?(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||Ou(t,h,e),Lu(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var ku={animate:hs.animate(),animation:hs.animation(),animated:hs.animated(),clearQueue:hs.clearQueue(),delay:hs.delay(),delayAnimation:hs.delayAnimation(),stop:hs.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Iu(n,e)}),t.beforeRenderPriorities.animations):n()}function n(){e._private.animationsRunning&&nt((function(t){Iu(t,e),n()}))}}},Mu={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&A(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Pu=function(e){return b(e)?new Ps(e):e},Ru={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Rl(Mu,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Pu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Pu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Pu(t),n),this},once:function(e,t,n){return this.emitter().one(e,Pu(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};hs.eventAliasesOn(Ru);var Bu={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Bu.jpeg=Bu.jpg;var Fu={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=b(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r(Q({},e,{cy:t,eles:i}));return a}Dt("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Dt("A `name` must be specified to make a layout");else Dt("Layout options must be specified to make a layout")}};Fu.createLayout=Fu.makeLayout=Fu.layout;var zu={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}}))}},Gu=Mt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Yu={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(null!=n){void 0!==e.wheelSensitivity&&Nt("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=Gu(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")}else Dt("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Yu.invalidateDimensions=Yu.resize;var Xu={collection:function(e,t){return b(e)?this.$(e):N(e)?e.collection():w(e)?(t||(t={}),new bu(this,e,t.unique,t.removed)):new bu(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Xu.elements=Xu.filter=Xu.$;var Vu={},Uu="t",ju="f";Vu.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},Vu.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+"-"+t,a=r[i];if(a)return a;for(var o=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===Uu,h=t[l]===Uu,d=c!==h,p=u.mappedProperties.length>0;if(d||h&&p){var g=void 0;d&&p||d?g=u.properties:p&&(g=u.mappedProperties);for(var f=0;f<g.length;f++){for(var v=g[f],y=v.name,m=!1,b=l+1;b<n.length;b++){var x=n[b];if(t[b]===Uu&&(m=null!=x.properties[v.name]))break}s[y]||m||(s[y]=!0,o.push(y))}}}return r[i]=o,o},Vu.getContextMeta=function(e){for(var t,n=this,r="",i=e._private.styleCxtKey||"",a=0;a<n.length;a++){var o=n[a];r+=o.selector&&o.selector.matches(e)?Uu:ju}return t=n.getPropertiesDiff(i,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},Vu.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a];if(t[a]===Uu)for(var s=0;s<o.properties.length;s++){var l=o.properties[s];i[l.name]=l}}return r[t]=i,i},Vu.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var l=i[s],u=t[l],c=n.pstyle(l);if(!u){if(!c)continue;u=c.bypass?{name:l,deleteBypassed:!0}:{name:l,delete:!0}}if(c!==u){if(u.mapped===o.fn&&null!=c&&null!=c.mapping&&c.mapping.value===u.value){var h=c.mapping;if((h.fnValue=u.value(n))===h.prevFnValue)continue}var d=a[l]={prev:c};r.applyParsedProperty(n,u),d.next=n.pstyle(l),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:a}},Vu.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=[it,ot]}for(var h=function(e,n){return t.styleKeys[n][0]=lt(e,t.styleKeys[n][0])},d=function(e,n){return t.styleKeys[n][1]=ut(e,t.styleKeys[n][1])},p=function(e,t){h(e,t),d(e,t)},g=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);h(r,t),d(r,t)}},f=2e9,v=function(e){return-128<e&&e<128&&Math.floor(e)!==e?f-(1024*e|0):e},y=0;y<r.length;y++){var m=r[y],b=l[m];if(null!=b){var x=this.properties[m],w=x.type,E=x.groupKey,T=void 0;null!=x.hashOverride?T=x.hashOverride(e,b):null!=b.pfValue&&(T=b.pfValue);var _=null==x.enums?b.value:null,D=null!=T,C=D||null!=_,N=b.units;w.number&&C&&!w.multiple?(p(v(D?T:_),E),D||null==N||g(N,E)):g(b.strValue,E)}}for(var A=[it,ot],L=0;L<i.length;L++){var S=i[L],O=t.styleKeys[S];A[0]=lt(O[0],A[0]),A[1]=ut(O[1],A[1])}t.styleKey=ct(A[0],A[1]);var I=t.styleKeys;t.labelDimsKey=ht(I.labelDimensions);var k=a(e,["label"],I.labelDimensions);if(t.labelKey=ht(k),t.labelStyleKey=ht(dt(I.commonLabel,k)),!s){var M=a(e,["source-label"],I.labelDimensions);t.sourceLabelKey=ht(M),t.sourceLabelStyleKey=ht(dt(I.commonLabel,M));var P=a(e,["target-label"],I.labelDimensions);t.targetLabelKey=ht(P),t.targetLabelStyleKey=ht(dt(I.commonLabel,P))}if(s){var R=t.styleKeys,B=R.nodeBody,F=R.nodeBorder,z=R.backgroundImage,G=R.compound,Y=R.pie,X=[B,F,z,G,Y].filter((function(e){return null!=e})).reduce(dt,[it,ot]);t.nodeKey=ht(X),t.hasPie=null!=Y&&Y[0]!==it&&Y[1]!==ot}return o!==t.styleKey},Vu.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},Vu.applyParsedProperty=function(e,t){var n,r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,h=e._private,d="mapping",p=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},g=function(){var t=p(u),n=p(i);r.checkTriggers(e,i.name,t,n)};if(i&&"pie"===i.name.substr(0,3)&&Nt("The pie style properties are deprecated. Create charts using background images instead."),"curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",l)),i.delete)return a[i.name]=void 0,g(),!0;if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,g(),!0):(g(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,g(),!0):(g(),!0);var f=function(){Nt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var v,y=i.field.split("."),m=h.data,b=0;b<y.length&&m;b++)m=m[y[b]];if(null==m)return f(),!1;if(!_(m))return Nt("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var x=i.fieldMax-i.fieldMin;if((v=0===x?0:(m-i.fieldMin)/x)<0?v=0:v>1&&(v=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],T=i.valueMin[1],D=i.valueMax[1],C=i.valueMin[2],N=i.valueMax[2],A=null==i.valueMin[3]?1:i.valueMin[3],L=null==i.valueMax[3]?1:i.valueMax[3],S=[Math.round(w+(E-w)*v),Math.round(T+(D-T)*v),Math.round(C+(N-C)*v),Math.round(A+(L-A)*v)];n={bypass:i.bypass,name:i.name,value:S,strValue:"rgb("+S[0]+", "+S[1]+", "+S[2]+")"}}else{if(!s.number)return!1;var O=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,O,i.bypass,d)}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var I=i.field.split("."),k=h.data,M=0;M<I.length&&k;M++)k=k[I[M]];if(null!=k&&(n=this.parse(i.name,k,i.bypass,d)),!n)return f(),!1;n.mapping=i,i=n;break;case o.fn:var P=i.value,R=null!=i.fnValue?i.fnValue:P(e);if(i.prevFnValue=R,null==R)return Nt("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(i.name,R,i.bypass,d)))return Nt("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=Lt(i),i=n;break;case void 0:break;default:return!1}return l?(i.bypassed=c?u.bypassed:u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i,g(),!0},Vu.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},Vu.update=function(){this._private.cy.mutableElements().updateStyle()},Vu.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var p=d.prev,g=null!=d.next?d.next:h,f=!1,v=void 0,y=1e-6;p&&(_(p.pfValue)&&_(g.pfValue)?(f=g.pfValue-p.pfValue,v=p.pfValue+y*f):_(p.value)&&_(g.value)?(f=g.value-p.value,v=p.value+y*f):w(p.value)&&w(g.value)&&(f=p.value[0]!==g.value[0]||p.value[1]!==g.value[1]||p.value[2]!==g.value[2],v=p.strValue),f&&(s[c]=g.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;r.transitioning=!0,new Gi((function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Vu.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Vu.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Vu.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||("curve-style"!==t||"bezier"!==n&&"bezier"!==r)&&("display"!==t||"none"!==n&&"none"!==r)||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Vu.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Hu={applyBypass:function(e,t,n,r){var i=this,a=[],o=!0;if("*"===t||"**"===t){if(void 0!==n)for(var s=0;s<i.properties.length;s++){var l=i.properties[s].name,u=this.parse(l,n,!0);u&&a.push(u)}}else if(b(t)){var c=this.parse(t,n,!0);c&&a.push(c)}else{if(!E(t))return!1;var h=t;r=n;for(var d=Object.keys(h),p=0;p<d.length;p++){var g=d[p],f=h[g];if(void 0===f&&(f=h[G(g)]),void 0!==f){var v=this.parse(g,f,!0);v&&a.push(v)}}}if(0===a.length)return!1;for(var y=!1,m=0;m<e.length;m++){for(var x=e[m],w={},T=void 0,_=0;_<a.length;_++){var D=a[_];if(r){var C=x.pstyle(D.name);T=w[D.name]={prev:C}}y=this.applyParsedProperty(x,Lt(D))||y,r&&(T.next=x.pstyle(D.name))}y&&this.updateStyleHints(x),r&&this.updateTransitions(x,w,o)}return y},overrideBypass:function(e,t,n){t=z(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var l=t[s],u=this.properties[l],c=a.pstyle(u.name);if(c&&c.bypass){var h="",d=this.parse(l,h,!0),p=o[u.name]={prev:c};this.applyParsedProperty(a,d),p.next=a.pstyle(u.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}}},qu={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy.container();if(d&&t&&d.getComputedStyle)return d.getComputedStyle(t).getPropertyValue(e)}},Wu={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){var n=this;if(e=e[0]){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);null!=o&&(r[a.name]=o,r[G(a.name)]=o)}return r}},getIndexedStyle:function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){var r=this;if(e=e[0]){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,l=o.units,u=o.strValue;if(n&&a.number&&null!=s&&_(s)){var c=e.cy().zoom(),h=function(e){return e*c},d=function(e,t){return h(e)+t},p=w(s);return(p?l.every((function(e){return null!=e})):null!=l)?p?s.map((function(e,t){return d(e,l[t])})).join(" "):d(s,l):p?s.map((function(e){return b(e)?e:""+h(e)})).join(" "):""+h(s)}if(null!=u)return u}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=E(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a],s=n[o],l=r[o]||r[z(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,i,a,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)u[0]=lt(o,u[0]),u[1]=ut(o,u[1]);else for(a=i.strValue,l=0;l<a.length;l++)o=a.charCodeAt(l),u[0]=lt(o,u[0]),u[1]=ut(o,u[1]);return u}};Wu.getPropertiesHash=Wu.getNonDefaultPropertiesHash;var $u={appendFromJson:function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var l=o[s],u=a[l];t.css(l,u)}}return t},fromJson:function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e}},Ku={appendFromString:function(e){var t,n,r,i=this,a=this,o=""+e;function s(){o=o.length>t.length?o.substr(t.length):""}function l(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");!o.match(/^\s*$/);){var u=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){Nt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=u[0];var c=u[1];if("core"!==c&&new Ps(c).invalid)Nt("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),s();else{var h=u[2],d=!1;n=h;for(var p=[];!n.match(/^\s*$/);){var g=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Nt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}r=g[0];var f=g[1],v=g[2];i.properties[f]?a.parse(f,v)?(p.push({name:f,val:v}),l()):(Nt("Skipping property: Invalid property definition in: "+r),l()):(Nt("Skipping property: Invalid property name in: "+r),l())}if(d){s();break}a.selector(c);for(var y=0;y<p.length;y++){var m=p[y];a.css(m.name,m.val)}s()}}return a},fromString:function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t}},Zu={};(function(){var e=V,t=j,n=q,r=W,i=$,a=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(a){var o=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+i;return"^"+a+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+o+")\\s*\\,\\s*("+o+")\\)$"},s=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Zu.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:a("data")},layoutData:{mapping:!0,regex:a("layoutData")},scratch:{mapping:!0,regex:a("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return b(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var l={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=k(e),r=k(t);return n&&!r||!n&&r}},u=Zu.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],h=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],d=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],p=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],g=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],f=[{name:"events",type:u.bool},{name:"text-events",type:u.bool}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.nonNegativeInt,triggersZOrder:l.any}],y=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any}],x=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],w=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},E=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],T=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle}],_=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],D=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],C=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],N=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],A=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],L=[];Zu.pieBackgroundN=16,L.push({name:"pie-size",type:u.sizeMaybePercent});for(var S=1;S<=Zu.pieBackgroundN;S++)L.push({name:"pie-"+S+"-background-color",type:u.color}),L.push({name:"pie-"+S+"-background-size",type:u.percent}),L.push({name:"pie-"+S+"-background-opacity",type:u.zeroOneNumber});var O=[],I=Zu.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill}].forEach((function(e){I.forEach((function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;O.push({name:n,type:r,triggersBounds:i})}))}),{});var M=Zu.properties=[].concat(f,x,v,y,m,N,g,p,c,h,d,E,T,_,L,D,C,O,A),P=Zu.propertyGroups={behavior:f,transition:x,visibility:v,overlay:y,underlay:m,ghost:N,commonLabel:g,labelDimensions:p,mainLabel:c,sourceLabel:h,targetLabel:d,nodeBody:E,nodeBorder:T,backgroundImage:_,pie:L,compound:D,edgeLine:C,edgeArrow:O,core:A},R=Zu.propertyGroupNames={};(Zu.propertyGroupKeys=Object.keys(P)).forEach((function(e){R[e]=P[e].map((function(e){return e.name})),P[e].forEach((function(t){return t.groupKey=e}))}));var B=Zu.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Zu.propertyNames=M.map((function(e){return e.name}));for(var F=0;F<M.length;F++){var z=M[F];M[z.name]=z}for(var G=0;G<B.length;G++){var Y=B[G],X=M[Y.pointsTo],U={name:Y.name,alias:!0,pointsTo:X};M.push(U),M[Y.name]=U}})(),Zu.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Zu.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=Q({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce((function(e,t){for(var n=1;n<=Zu.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e}),{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"}].reduce((function(e,t){return Zu.arrowPrefixes.forEach((function(n){var r=n+"-"+t.name,i=t.value;e[r]=i})),e}),{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},Zu.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Qu={parse:function(e,t,n,r){var i=this;if(x(t))return i.parseImplWarn(e,t,n,r);var a,o=ft(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),s=i.propCache=i.propCache||[];return(a=s[o])||(a=s[o]=i.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(a=Lt(a))&&(a.value=Lt(a.value)),a},parseImplWarn:function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||Nt("The style property `".concat(e,": ").concat(t,"` is invalid")),!i||"width"!==i.name&&"height"!==i.name||"label"!==t||Nt("The style value of `label` is deprecated for `"+i.name+"`"),i},parseImpl:function(e,t,n,r){var i=this;e=z(e);var a=i.properties[e],o=t,s=i.types;if(!a)return null;if(void 0===t)return null;a.alias&&(a=a.pointsTo,e=a.name);var l=b(t);l&&(t=t.trim());var u,c,h=a.type;if(!h)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(x(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};if(!l||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var d=s.data;return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(h.multiple)return!1;var p=s.mapData;if(!h.color&&!h.number)return!1;var g=this.parse(e,c[4]);if(!g||g.mapped)return!1;var f=this.parse(e,c[5]);if(!f||f.mapped)return!1;if(g.pfValue===f.pfValue||g.strValue===f.strValue)return Nt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,y=f.value;if(!(v[0]!==y[0]||v[1]!==y[1]||v[2]!==y[2]||v[3]!==y[3]&&(null!=v[3]&&1!==v[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:g.value,valueMax:f.value,bypass:n}}}if(h.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):w(t)?t:[t],h.evenMultiple&&m.length%2!=0)return null;for(var E=[],T=[],_=[],C="",N=!1,A=0;A<m.length;A++){var L=i.parse(e,m[A],n,"multiple");N=N||b(L.value),E.push(L.value),_.push(null!=L.pfValue?L.pfValue:L.value),T.push(L.units),C+=(A>0?" ":"")+L.strValue}return h.validate&&!h.validate(E,T)?null:h.singleEnum&&N?1===E.length&&b(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:_,strValue:C,bypass:n,units:T}}var S=function(){for(var r=0;r<h.enums.length;r++)if(h.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(h.number){var O,I="px";if(h.units&&(O=h.units),h.implicitUnits&&(I=h.implicitUnits),!h.unitless)if(l){var k="px|em"+(h.allowPercent?"|\\%":"");O&&(k=O);var M=t.match("^("+V+")("+k+")?$");M&&(t=M[1],O=M[2]||I)}else O&&!h.implicitUnits||(O=I);if(t=parseFloat(t),isNaN(t)&&void 0===h.enums)return null;if(isNaN(t)&&void 0!==h.enums)return t=o,S();if(h.integer&&!D(t))return null;if(void 0!==h.min&&(t<h.min||h.strictMin&&t===h.min)||void 0!==h.max&&(t>h.max||h.strictMax&&t===h.max))return null;var P={name:e,value:t,strValue:""+t+(O||""),units:O,bypass:n};return h.unitless||"px"!==O&&"em"!==O?P.pfValue=t:P.pfValue="px"!==O&&O?this.getEmSizeInPixels()*t:t,"ms"!==O&&"s"!==O||(P.pfValue="ms"===O?t:1e3*t),"deg"!==O&&"rad"!==O||(P.pfValue="rad"===O?t:mn(t)),"%"===O&&(P.pfValue=t/100),P}if(h.propList){var R=[],B=""+t;if("none"===B);else{for(var F=B.split(/\s*,\s*|\s+/),G=0;G<F.length;G++){var Y=F[G].trim();i.properties[Y]?R.push(Y):Nt("`"+Y+"` is not a valid property name")}if(0===R.length)return null}return{name:e,value:R,strValue:0===R.length?"none":R.join(" "),bypass:n}}if(h.color){var X=re(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}if(h.regex||h.regexes){if(h.enums){var U=S();if(U)return U}for(var j=h.regexes?h.regexes:[h.regex],H=0;H<j.length;H++){var q=new RegExp(j[H]).exec(t);if(q)return{name:e,value:h.singleRegexMatchValue?q[1]:q,strValue:""+t,bypass:n}}return null}return h.string?{name:e,value:""+t,strValue:""+t,bypass:n}:h.enums?S():null}},Ju=function e(t){if(!(this instanceof e))return new e(t);S(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):Dt("A style must have a core reference")},ec=Ju.prototype;ec.instanceString=function(){return"style"},ec.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach((function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1})),this},ec.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},ec.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},ec.selector=function(e){var t="core"===e?null:new Ps(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},ec.css=function(){var e=this,t=arguments;if(1===t.length)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];void 0===a&&(a=n[G(i.name)]),void 0!==a&&this.cssRule(i.name,a)}else 2===t.length&&this.cssRule(t[0],t[1]);return this},ec.style=ec.css,ec.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},ec.append=function(e){return O(e)?e.appendToStyle(this):w(e)?this.appendFromJson(e):b(e)&&this.appendFromString(e),this},Ju.fromJson=function(e,t){var n=new Ju(e);return n.fromJson(t),n},Ju.fromString=function(e,t){return new Ju(e).fromString(t)},[Vu,Hu,qu,Wu,$u,Ku,Zu,Qu].forEach((function(e){Q(ec,e)})),Ju.types=ec.types,Ju.properties=ec.properties,Ju.propertyGroups=ec.propertyGroups,Ju.propertyGroupNames=ec.propertyGroupNames,Ju.propertyGroupKeys=ec.propertyGroupKeys;var tc={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return O(e)?t.style=e.generateStyle(this):w(e)?t.style=Ju.fromJson(this,e):b(e)?t.style=Ju.fromString(this,e):t.style=Ju(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},nc="single",rc={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType=nc),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(b(a[0]))return o[e=a[0]];if(E(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,_(r)&&(o.x=r),_(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],"x"!==e&&"y"!==e||!_(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:E(e)&&(a=(i=s[0]).x,o=i.y,_(a)&&(l.x+=a),_(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!_(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(_(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n;if(b(e)){var r=e;e=this.$(r)}else if(P(e)){var i=e;(n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else N(e)||(e=this.mutableElements());if(!N(e)||!e.empty()){n=n||e.boundingBox();var a,o=this.width(),s=this.height();if(t=_(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:a=(a=(a=Math.min((o-2*t)/n.w,(s-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:a)<this._private.minZoom?this._private.minZoom:a,pan:{x:(o-a*(n.x1+n.x2))/2,y:(s-a*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return _(e)&&_(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):_(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:_(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),_(e)?n=e:E(e)&&(n=e.level,null!=e.position?t=hn(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!_(n)||n===a||null!=t&&(!_(t.x)||!_(t.y)))return null;if(null!=t){var s=i,l=a,u=n;return{zoomed:!0,panned:!0,zoom:u,pan:{x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:i}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e)return this;if(_(e.zoom)||(n=!1),E(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;_(l.x)&&(t.pan.x=l.x,o=!1),_(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(b(e)){var n=e;e=this.mutableElements().filter(n)}else N(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=d.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};rc.centre=rc.center,rc.autolockNodes=rc.autolock,rc.autoungrabifyNodes=rc.autoungrabify;var ic={data:hs.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:hs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:hs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:hs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ic.attr=ic.data,ic.removeAttr=ic.removeData;var ac=function(e){var t=this,n=(e=Q({},e)).container;n&&!C(n)&&C(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==d&&void 0!==n&&!e.headless,o=e;o.layout=Q({name:a?"grid":"null"},o.layout),o.renderer=Q({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new bu(this),listeners:[],aniEles:new bu(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:_(o.zoom)?o.zoom:1,pan:{x:E(o.pan)&&_(o.pan.x)?o.pan.x:0,y:E(o.pan)&&_(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var u=function(e,t){if(e.some(R))return Gi.all(e).then(t);t(e)};l.styleEnabled&&t.setStyle([]);var c=Q({},o,o.renderer);t.initRenderer(c);var h=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(E(e)||w(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=Q({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};u([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),h(a,(function(){t.startAnimationLoop(),l.ready=!0,x(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")}),o.done)}))},oc=ac.prototype;Q(oc,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!C(e)&&C(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(Q({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Lt(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(E(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(s.data.id){var l=""+s.data.id,u=t.getElementById(l);a[l]=!0,0!==u.length?i.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}else Nt("cy.json() cannot handle elements without an ID attribute")}t.add(r);for(var c=0;c<i.length;c++){var h=i[c],d=h.ele,p=h.json;d.json(p)}};if(w(e.elements))o(e.elements);else for(var s=["nodes","edges"],l=0;l<s.length;l++){var u=s[l],c=e.elements[u];w(c)&&o(c,u)}var h=t.collection();r.filter((function(e){return!a[e.id()]})).forEach((function(e){e.isParent()?h.merge(e):e.remove()})),h.forEach((function(e){return e.children().move({parent:null})})),h.forEach((function(e){return i(e).remove()}))}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<d.length;p++){var g=d[p];null!=e[g]&&t[g](e[g])}return t.endBatch(),this}var f={};e?f.elements=this.elements().map((function(e){return e.json()})):(f.elements={},r.forEach((function(e){var t=e.group();f.elements[t]||(f.elements[t]=[]),f.elements[t].push(e.json())}))),this._private.styleEnabled&&(f.style=t.style().json()),f.data=Lt(t.data());var v=n.options;return f.zoomingEnabled=n.zoomingEnabled,f.userZoomingEnabled=n.userZoomingEnabled,f.zoom=n.zoom,f.minZoom=n.minZoom,f.maxZoom=n.maxZoom,f.panningEnabled=n.panningEnabled,f.userPanningEnabled=n.userPanningEnabled,f.pan=Lt(n.pan),f.boxSelectionEnabled=n.boxSelectionEnabled,f.renderer=Lt(v.renderer),f.hideEdgesOnViewport=v.hideEdgesOnViewport,f.textureOnViewport=v.textureOnViewport,f.wheelSensitivity=v.wheelSensitivity,f.motionBlur=v.motionBlur,f.multiClickDebounceTime=v.multiClickDebounceTime,f}}),oc.$id=oc.getElementById,[wu,ku,Ru,Bu,Fu,zu,Yu,Xu,tc,rc,ic].forEach((function(e){Q(oc,e)}));var sc={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},lc={maximal:!1,acyclic:!1},uc=function(e){return e.scratch("breadthfirst")},cc=function(e,t){return e.scratch("breadthfirst",t)};function hc(e){this.options=Q({},sc,lc,e)}hc.prototype.run=function(){var e,t=this.options,n=t,r=t.cy,i=n.eles,a=i.nodes().filter((function(e){return!e.isParent()})),o=i,s=n.directed,l=n.acyclic||n.maximal||n.maximalAdjustments>0,u=Ln(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(N(n.roots))e=n.roots;else if(w(n.roots)){for(var c=[],h=0;h<n.roots.length;h++){var d=n.roots[h],p=r.getElementById(d);c.push(p)}e=r.collection(c)}else if(b(n.roots))e=r.$(n.roots);else if(s)e=a.roots();else{var g=i.components();e=r.collection();for(var f=function(t){var n=g[t],r=n.maxDegree(!1),i=n.filter((function(e){return e.degree(!1)===r}));e=e.add(i)},v=0;v<g.length;v++)f(v)}var y=[],m={},x=function(e,t){null==y[t]&&(y[t]=[]);var n=y[t].length;y[t].push(e),cc(e,{index:n,depth:t})},E=function(e,t){var n=uc(e),r=n.depth,i=n.index;y[r][i]=null,x(e,t)};o.bfs({roots:e,directed:n.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();x(a,i),m[o]=!0}});for(var T=[],_=0;_<a.length;_++){var D=a[_];m[D.id()]||T.push(D)}var C=function(e){for(var t=y[e],n=0;n<t.length;n++){var r=t[n];null!=r?cc(r,{depth:e,index:n}):(t.splice(n,1),n--)}},A=function(){for(var e=0;e<y.length;e++)C(e)},L=function(e,t){for(var r=uc(e),a=e.incomers().filter((function(e){return e.isNode()&&i.has(e)})),o=-1,s=e.id(),l=0;l<a.length;l++){var u=a[l],c=uc(u);o=Math.max(o,c.depth)}if(r.depth<=o){if(!n.acyclic&&t[s])return null;var h=o+1;return E(e,h),t[s]=h,!0}return!1};if(s&&l){var S=[],O={},I=function(e){return S.push(e)},k=function(){return S.shift()};for(a.forEach((function(e){return S.push(e)}));S.length>0;){var M=k(),P=L(M,O);if(P)M.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(I);else if(null===P){Nt("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}A();var R=0;if(n.avoidOverlap)for(var B=0;B<a.length;B++){var F=a[B].layoutDimensions(n),z=F.w,G=F.h;R=Math.max(R,z,G)}var Y={},X=function(e){if(Y[e.id()])return Y[e.id()];for(var t=uc(e).depth,n=e.neighborhood(),r=0,i=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&a.has(s)){var l=uc(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var h=y[c].length;c<t&&(r+=u/h,i++)}}}}return r/=i=Math.max(1,i),0===i&&(r=0),Y[e.id()]=r,r},V=function(e,t){var n=X(e)-X(t);return 0===n?K(e.id(),t.id()):n};void 0!==n.depthSort&&(V=n.depthSort);for(var U=0;U<y.length;U++)y[U].sort(V),C(U);for(var j=[],H=0;H<T.length;H++)j.push(T[H]);y.unshift(j),A();for(var q=0,W=0;W<y.length;W++)q=Math.max(y[W].length,q);var $={x:u.x1+u.w/2,y:u.x1+u.h/2},Z=y.reduce((function(e,t){return Math.max(e,t.length)}),0),Q=function(e){var t=uc(e),r=t.depth,i=t.index,a=y[r].length,o=Math.max(u.w/((n.grid?Z:a)+1),R),s=Math.max(u.h/(y.length+1),R),l=Math.min(u.w/2/y.length,u.h/2/y.length);if(l=Math.max(l,R),n.circle){var c=l*r+l-(y.length>0&&y[0].length<=3?l/2:0),h=2*Math.PI/y[r].length*i;return 0===r&&1===y[0].length&&(c=1),{x:$.x+c*Math.cos(h),y:$.y+c*Math.sin(h)}}return{x:$.x+(i+1-(a+1)/2)*o,y:(r+1)*s}};return i.nodes().layoutPositions(this,n,Q),this};var dc={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function pc(e){this.options=Q({},dc,e)}pc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=Ln(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),c=0,h=0;h<a.length;h++){var d=a[h].layoutDimensions(t),p=d.w,g=d.h;c=Math.max(c,p,g)}if(o=_(t.radius)?t.radius:a.length<=1?0:Math.min(s.h,s.w)/2-c,a.length>1&&t.avoidOverlap){c*=1.75;var f=Math.cos(u)-Math.cos(0),v=Math.sin(u)-Math.sin(0),y=Math.sqrt(c*c/(f*f+v*v));o=Math.max(y,o)}var m=function(e,n){var r=t.startAngle+n*u*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l.x+a,y:l.y+s}};return r.nodes().layoutPositions(this,t,m),this};var gc,fc={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function vc(e){this.options=Q({},fc,e)}vc.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=Ln(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c<a.length;c++){var h=a[c],d=void 0;d=t.concentric(h),l.push({value:d,node:h}),h._private.scratch.concentric=d}a.updateStyle();for(var p=0;p<a.length;p++){var g=a[p].layoutDimensions(t);u=Math.max(u,g.w,g.h)}l.sort((function(e,t){return t.value-e.value}));for(var f=t.levelWidth(a),v=[[]],y=v[0],m=0;m<l.length;m++){var b=l[m];y.length>0&&Math.abs(y[0].value-b.value)>=f&&(y=[],v.push(y)),y.push(b)}var x=u+t.minNodeSpacing;if(!t.avoidOverlap){var w=v.length>0&&v[0].length>1,E=(Math.min(o.w,o.h)/2-x)/(v.length+w?1:0);x=Math.min(x,E)}for(var T=0,_=0;_<v.length;_++){var D=v[_],C=void 0===t.sweep?2*Math.PI-2*Math.PI/D.length:t.sweep,N=D.dTheta=C/Math.max(1,D.length-1);if(D.length>1&&t.avoidOverlap){var A=Math.cos(N)-Math.cos(0),L=Math.sin(N)-Math.sin(0),S=Math.sqrt(x*x/(A*A+L*L));T=Math.max(S,T)}D.r=T,T+=x}if(t.equidistant){for(var O=0,I=0,k=0;k<v.length;k++){var M=v[k].r-I;O=Math.max(O,M)}I=0;for(var P=0;P<v.length;P++){var R=v[P];0===P&&(I=R.r),R.r=I,I+=O}}for(var B={},F=0;F<v.length;F++)for(var z=v[F],G=z.dTheta,Y=z.r,X=0;X<z.length;X++){var V=z[X],U=t.startAngle+(n?1:-1)*G*X,j={x:s.x+Y*Math.cos(U),y:s.y+Y*Math.sin(U)};B[V.node.id()]=j}return i.nodes().layoutPositions(this,t,(function(e){var t=e.id();return B[t]})),this};var yc={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function mc(e){this.options=Q({},yc,e),this.options.layout=this}mc.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),gc=!0===e.debug;var r=xc(t,n,e);gc&&bc(r),e.randomize&&Tc(r);var i=rt(),a=function(){Dc(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(Cc(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=_c(r,e,t);t.layoutPositions(n,e,i)}},l=0,u=!0;if(!0===e.animate)!function t(){for(var n=0;u&&n<e.refresh;)u=o(l),l++,n++;u?(rt()-i>=e.animationThreshold&&a(),nt(t)):(Fc(r,e),s())}();else{for(;u;)u=o(l),l++;Fc(r,e),s()}return this},mc.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},mc.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var bc,xc=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=Ln(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++)l[c[h].id()]=u;for(u=0;u<o.nodeSize;u++){var d=(y=i[u]).layoutDimensions(n);(M={}).isLocked=y.locked(),M.id=y.data("id"),M.parentId=y.data("parent"),M.cmptId=l[y.id()],M.children=[],M.positionX=y.position("x"),M.positionY=y.position("y"),M.offsetX=0,M.offsetY=0,M.height=d.w,M.width=d.h,M.maxX=M.positionX+M.width/2,M.minX=M.positionX-M.width/2,M.maxY=M.positionY+M.height/2,M.minY=M.positionY-M.height/2,M.padLeft=parseFloat(y.style("padding")),M.padRight=parseFloat(y.style("padding")),M.padTop=parseFloat(y.style("padding")),M.padBottom=parseFloat(y.style("padding")),M.nodeRepulsion=x(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,o.layoutNodes.push(M),o.idToIndex[M.id]=u}var p=[],g=0,f=-1,v=[];for(u=0;u<o.nodeSize;u++){var y,m=(y=o.layoutNodes[u]).parentId;null!=m?o.layoutNodes[o.idToIndex[m]].children.push(y.id):(p[++f]=y.id,v.push(y.id))}for(o.graphSet.push(v);g<=f;){var b=p[g++],w=o.idToIndex[b],E=o.layoutNodes[w].children;if(E.length>0)for(o.graphSet.push(E),u=0;u<E.length;u++)p[++f]=E[u]}for(u=0;u<o.graphSet.length;u++){var T=o.graphSet[u];for(h=0;h<T.length;h++){var _=o.idToIndex[T[h]];o.indexToGraph[_]=u}}for(u=0;u<o.edgeSize;u++){var D=r[u],C={};C.id=D.data("id"),C.sourceId=D.data("source"),C.targetId=D.data("target");var N=x(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,A=x(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,L=o.idToIndex[C.sourceId],S=o.idToIndex[C.targetId];if(o.indexToGraph[L]!=o.indexToGraph[S]){for(var O=wc(C.sourceId,C.targetId,o),I=o.graphSet[O],k=0,M=o.layoutNodes[L];-1===I.indexOf(M.id);)M=o.layoutNodes[o.idToIndex[M.parentId]],k++;for(M=o.layoutNodes[S];-1===I.indexOf(M.id);)M=o.layoutNodes[o.idToIndex[M.parentId]],k++;N*=k*n.nestingFactor}C.idealLength=N,C.elasticity=A,o.layoutEdges.push(C)}return o},wc=function(e,t,n){var r=Ec(e,t,0,n);return 2>r.count?0:r.graph},Ec=function e(t,n,r,i){var a=i.graphSet[r];if(-1<a.indexOf(t)&&-1<a.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var h=e(t,n,i.indexToGraph[i.idToIndex[c[0]]],i);if(0!==h.count){if(1!==h.count)return h;if(2==++o)break}}}return{count:o,graph:r}},Tc=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},_c=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)})),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},Dc=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=_c(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},Cc=function(e,t,n){Nc(e,t),Ic(e),kc(e,t),Mc(e),Pc(e)},Nc=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];Lc(o,l,e,t)}},Ac=function(e){return-e+2*e*Math.random()},Lc=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY,o=1;0===i&&0===a&&(i=Ac(o),a=Ac(o));var s=Sc(e,t,i,a);if(s>0)var l=(c=r.nodeOverlap*s)*i/(v=Math.sqrt(i*i+a*a)),u=c*a/v;else{var c,h=Oc(e,i,a),d=Oc(t,-1*i,-1*a),p=d.x-h.x,g=d.y-h.y,f=p*p+g*g,v=Math.sqrt(f);l=(c=(e.nodeRepulsion+t.nodeRepulsion)/f)*p/v,u=c*g/v}e.isLocked||(e.offsetX-=l,e.offsetY-=u),t.isLocked||(t.offsetX+=l,t.offsetY+=u)}},Sc=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Oc=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=i+a/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=i+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},Ic=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=Oc(a,l,u),h=Oc(s,-1*l,-1*u),d=h.x-c.x,p=h.y-c.y,g=Math.sqrt(d*d+p*p),f=Math.pow(r.idealLength-g,2)/r.elasticity;if(0!==g)var v=f*d/g,y=f*p/g;else v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},kc=function(e,t){if(0!==t.gravity)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(0===r)var o=e.clientHeight/2,s=e.clientWidth/2;else{var l=e.layoutNodes[e.idToIndex[i[0]]],u=e.layoutNodes[e.idToIndex[l.parentId]];o=u.positionX,s=u.positionY}for(var c=0;c<a;c++){var h=e.layoutNodes[e.idToIndex[i[c]]];if(!h.isLocked){var d=o-h.positionX,p=s-h.positionY,g=Math.sqrt(d*d+p*p);if(g>n){var f=t.gravity*d/g,v=t.gravity*p/g;h.offsetX+=f,h.offsetY+=v}}}}},Mc=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},Pc=function(e,t){for(var n=0;n<e.nodeSize;n++)0<(i=e.layoutNodes[n]).children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0);for(n=0;n<e.nodeSize;n++)if(!(0<(i=e.layoutNodes[n]).children.length||i.isLocked)){var r=Rc(i.offsetX,i.offsetY,e.temperature);i.positionX+=r.x,i.positionY+=r.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,Bc(i,e)}for(n=0;n<e.nodeSize;n++){var i;0<(i=e.layoutNodes[n]).children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},Rc=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},Bc=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a?e(i,n):void 0}},Fc=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}var s=0;for(i=0;i<r.length;i++)if(f=r[i]){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var l=0;l<f.length;l++){var u=f[l];f.x1=Math.min(f.x1,u.positionX-u.width/2),f.x2=Math.max(f.x2,u.positionX+u.width/2),f.y1=Math.min(f.y1,u.positionY-u.height/2),f.y2=Math.max(f.y2,u.positionY+u.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,s+=f.w*f.h}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var c=0,h=0,d=0,p=0,g=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++){var f;if(f=r[i]){for(l=0;l<f.length;l++)(u=f[l]).isLocked||(u.positionX+=c-f.x1,u.positionY+=h-f.y1);c+=f.w+t.componentSpacing,d+=f.w+t.componentSpacing,p=Math.max(p,f.h),d>g&&(h+=p+t.componentSpacing,c=0,d=0,p=0)}}},zc={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gc(e){this.options=Q({},zc,e)}Gc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=Ln(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},h=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},d=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=p)l=d,u=p;else if(null!=d&&null==p)l=d,u=Math.ceil(o/l);else if(null==d&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var g=c(),f=h();(g-1)*f>=o?c(g-1):(f-1)*g>=o&&h(f-1)}else for(;u*l<o;){var v=c(),y=h();(y+1)*v>=o?h(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x<i.length;x++){var w=i[x],E=w._private.position;null!=E.x&&null!=E.y||(E.x=0,E.y=0);var T=w.layoutDimensions(t),_=t.avoidOverlapPadding,D=T.w+_,C=T.h+_;m=Math.max(m,D),b=Math.max(b,C)}for(var N={},A=function(e,t){return!!N["c-"+e+"-"+t]},L=function(e,t){N["c-"+e+"-"+t]=!0},S=0,O=0,I=function(){++O>=u&&(O=0,S++)},k={},M=0;M<i.length;M++){var P=i[M],R=t.position(P);if(R&&(void 0!==R.row||void 0!==R.col)){var B={row:R.row,col:R.col};if(void 0===B.col)for(B.col=0;A(B.row,B.col);)B.col++;else if(void 0===B.row)for(B.row=0;A(B.row,B.col);)B.row++;k[P.id()]=B,L(B.row,B.col)}}var F=function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=k[e.id()];if(i)n=i.col*m+m/2+a.x1,r=i.row*b+b/2+a.y1;else{for(;A(S,O);)I();n=O*m+m/2+a.x1,r=S*b+b/2+a.y1,L(S,O),I()}return{x:n,y:r}};i.layoutPositions(this,t,F)}return this};var Yc={ready:function(){},stop:function(){}};function Xc(e){this.options=Q({},Yc,e)}Xc.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},Xc.prototype.stop=function(){return this};var Vc={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Uc(e){this.options=Q({},Vc,e)}Uc.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=x(e.positions);function r(t){if(null==e.positions)return cn(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}return t.layoutPositions(this,e,(function(e,t){var n=r(e);return!e.locked()&&null!=n&&n})),this};var jc={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Hc(e){this.options=Q({},jc,e)}Hc.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=Ln(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),i=function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,i),this};var qc=[{name:"breadthfirst",impl:hc},{name:"circle",impl:pc},{name:"concentric",impl:vc},{name:"cose",impl:mc},{name:"grid",impl:Gc},{name:"null",impl:Xc},{name:"preset",impl:Uc},{name:"random",impl:Hc}];function Wc(e){this.options=e,this.notifications=0}var $c=function(){},Kc=function(){throw new Error("A headless instance can not render images")};Wc.prototype={recalculateRenderedStyle:$c,notify:function(){this.notifications++},init:$c,isHeadless:function(){return!0},png:Kc,jpg:Kc};var Zc={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:a*n+i.x,y:o+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){b(s)&&(s=e[s]),e[r]=Q({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=a(i(this.points,n+2*s,r,o));return Wn(e,t,l)},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:Et,roughCollide:Et,draw:_t,spacing:Tt,gap:Tt}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),u=this.controlPoint,c=r(u[0],u[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return.8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.pointsTee,n+2*l,r,o));return Wn(e,t,u)||Wn(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,l){var u=o,c=Math.pow(u.x-e,2)+Math.pow(u.y-t,2)<=Math.pow((n+2*l)*this.radius,2),h=a(i(this.points,n+2*l,r,o));return Wn(e,t,h)||c},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.crossLinePts(n,s),n+2*l,r,o));return Wn(e,t,u)||Wn(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})}},Qc={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=d.getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},a={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,h=t.width/(o+c),p=o-l,g=s-u,f=t.left+i.left+a.left,v=t.top+i.top+a.top;return this.containerBB=[f,v,p,g,h]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(r?24:8)/c,p=(r?8:2)/c,g=(r?8:2)/c,f=1/0;function v(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<f))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,i=e,f=null!=t?t:f;break}}else u.push(e),i=e,f=null!=t?t:f}function y(n){var r=n.outerWidth()+2*p,i=n.outerHeight()+2*p,a=r/2,l=i/2,u=n.position();if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,u.x,u.y))return v(n,0),!0}function m(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=l/2+d,g=p*p,f=2*p,m=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var x=a.allpts,w=0;w+3<x.length;w+=2)if(Xn(e,t,x[w],x[w+1],x[w+2],x[w+3],f)&&g>(r=qn(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5<a.allpts.length;w+=4)if(Vn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],f)&&g>(r=Hn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),T=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<T.length;w++){var _=T[w],D=s.arrowShapes[n.pstyle(_.name+"-arrow-shape").value],C=n.pstyle("width").pfValue;if(D.roughCollide(e,t,E,_.angle,{x:_.x,y:_.y},C,d)&&D.collide(e,t,E,_.angle,{x:_.x,y:_.y},C,d))return v(n),!0}h&&u.length>0&&(y(m),y(b))}function b(e,t,n){return Ft(e,t,n)}function x(n,r){var i,a=n._private,o=g;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),h=b(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,f=s.x1-o-d,y=s.x2+o-d,m=s.y1-o-p,x=s.y2+o-p;if(h){var w=Math.cos(h),E=Math.sin(h),T=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},_=T(f,m),D=T(f,x),C=T(y,m),N=T(y,x),A=[_.x+d,_.y+p,C.x+d,C.y+p,N.x+d,N.y+p,D.x+d,D.y+p];if(Wn(e,t,A))return v(n),!0}else if(Fn(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r),c=Ln({x1:e=o,y1:t=l,x2:n=s,y2:r=u}),h=0;h<i.length;h++){var d=i[h];if(d.isNode()){var p=d,g=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Bn(c,g)&&!Gn(g,c)&&a.push(p)}else{var f=d,v=f._private,y=v.rscratch;if(null!=y.startX&&null!=y.startY&&!Fn(c,y.startX,y.startY))continue;if(null!=y.endX&&null!=y.endY&&!Fn(c,y.endX,y.endY))continue;if("bezier"===y.edgeType||"multibezier"===y.edgeType||"self"===y.edgeType||"compound"===y.edgeType||"segments"===y.edgeType||"haystack"===y.edgeType){for(var m=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,b=!0,x=0;x<m.length;x++)if(!zn(c,m[x])){b=!1;break}b&&a.push(f)}else"haystack"!==y.edgeType&&"straight"!==y.edgeType||a.push(f)}}return a}},Jc={calculateArrowAngles:function(e){var t,n,r,i,a,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,h="segments"===s.edgeType,d="compound"===s.edgeType,p="self"===s.edgeType;if(l?(r=s.haystackPts[0],i=s.haystackPts[1],a=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,i=s.arrowStartY,a=s.arrowEndX,o=s.arrowEndY),f=s.midX,v=s.midY,h)t=r-s.segpts[0],n=i-s.segpts[1];else if(c||d||p||u){var g=s.allpts;t=r-Dn(g[0],g[2],g[4],.1),n=i-Dn(g[1],g[3],g[5],.1)}else t=r-f,n=i-v;s.srcArrowAngle=bn(t,n);var f=s.midX,v=s.midY;if(l&&(f=(r+a)/2,v=(i+o)/2),t=a-r,n=o-i,h)if((g=s.allpts).length/2%2==0){var y=(m=g.length/2)-2;t=g[m]-g[y],n=g[m+1]-g[y+1]}else{y=(m=g.length/2-1)-2;var m,b=m+2;t=g[m]-g[y],n=g[m+1]-g[y+1]}else if(c||d||p){var x,w,E,T,g=s.allpts;if(s.ctrlpts.length/2%2==0){var _=2+(D=2+(C=g.length/2-1));x=Dn(g[C],g[D],g[_],0),w=Dn(g[C+1],g[D+1],g[_+1],0),E=Dn(g[C],g[D],g[_],1e-4),T=Dn(g[C+1],g[D+1],g[_+1],1e-4)}else{var D,C;_=2+(D=g.length/2-1),x=Dn(g[C=D-2],g[D],g[_],.4999),w=Dn(g[C+1],g[D+1],g[_+1],.4999),E=Dn(g[C],g[D],g[_],.5),T=Dn(g[C+1],g[D+1],g[_+1],.5)}t=E-x,n=T-w}if(s.midtgtArrowAngle=bn(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,h&&((g=s.allpts).length/2%2==0||(t=-(g[b=2+(m=g.length/2-1)]-g[m]),n=-(g[b+1]-g[m+1]))),s.midsrcArrowAngle=bn(t,n),h)t=a-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||d||p||u){var N=(g=s.allpts).length;t=a-Dn(g[N-6],g[N-4],g[N-2],.9),n=o-Dn(g[N-5],g[N-3],g[N-1],.9)}else t=a-f,n=o-v;s.tgtArrowAngle=bn(t,n)}};Jc.getArrowWidth=Jc.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var eh={};function th(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}eh.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),p=s.height(),g=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*g+l.x,i.source.y*d*g+l.y,i.target.x*h*g+u.x,i.target.y*p*g+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},eh.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("edge-distances").value,s=e.pstyle("segment-weights"),l=e.pstyle("segment-distances"),u=Math.min(s.pfValue.length,l.pfValue.length);n.edgeType="segments",n.segpts=[];for(var c=0;c<u;c++){var h=s.pfValue[c],d=l.pfValue[c],p=1-h,g=h,f="node-position"===o?r:i,v={x:f.x1*p+f.x2*g,y:f.y1*p+f.y2*g};n.segpts.push(v.x+a.x*d,v.y+a.y*d)}},eh.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,p=h;r&&(d=0,p=l);var g=u-Math.PI/2,f=g-c/2,v=g+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(f)*p*(d/3+1),o.y+1.4*Math.sin(f)*p*(d/3+1),o.x+1.4*Math.cos(v)*p*(d/3+1),o.y+1.4*Math.sin(v)*p*(d/3+1)]},eh.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),p=d?d.pfValue[0]:void 0,g=n,f=h;r&&(g=0,f=p);var v=50,y={x:a.x-s/2,y:a.y-l/2},m={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(y.x,m.x),y:Math.min(y.y,m.y)},x=.5,w=Math.max(x,Math.log(.01*s)),E=Math.max(x,Math.log(.01*u));i.ctrlpts=[b.x,b.y-(1+Math.pow(v,1.12)/100)*f*(g/3+1)*w,b.x-(1+Math.pow(v,1.12)/100)*f*(g/3+1)*E,b.y]},eh.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},eh.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=t.vectorNormInverse,s=t.posPts,l=t.intersectionPts,u=e.pstyle("edge-distances").value,c=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),d=e.pstyle("control-point-weights"),p=h&&d?Math.min(h.value.length,d.value.length):1,g=h?h.pfValue[0]:void 0,f=d.value[0],v=r;a.edgeType=v?"multibezier":"bezier",a.ctrlpts=[];for(var y=0;y<p;y++){var m=(.5-t.eles.length/2+n)*c*(i?-1:1),b=void 0,x=wn(m);v&&(g=h?h.pfValue[y]:c,f=d.value[y]);var w=void 0!==(b=r?g:void 0!==g?x*g:void 0)?b:m,E=1-f,T=f,_="node-position"===u?s:l,D={x:_.x1*E+_.x2*T,y:_.y1*E+_.y2*T};a.ctrlpts.push(D.x+o.x*w,D.y+o.y*w)}},eh.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",i="horizontal",a="leftward",o="rightward",s="downward",l="upward",u="auto",c=t.posPts,h=t.srcW,d=t.srcH,p=t.tgtW,g=t.tgtH,f="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,y=v,m=e.pstyle("taxi-turn"),b="%"===m.units,x=m.pfValue,w=x<0,E=e.pstyle("taxi-turn-min-distance").pfValue,T=f?(h+p)/2:0,_=f?(d+g)/2:0,D=c.x2-c.x1,C=c.y2-c.y1,N=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},A=N(D,T),L=N(C,_),S=!1;y===u?v=Math.abs(A)>Math.abs(L)?i:r:y===l||y===s?(v=r,S=!0):y!==a&&y!==o||(v=i,S=!0);var O,I=v===r,k=I?L:A,M=I?C:D,P=wn(M),R=!1;S&&(b||w)||!(y===s&&M<0||y===l&&M>0||y===a&&M>0||y===o&&M<0)||(k=(P*=-1)*Math.abs(k),R=!0);var B=function(e){return Math.abs(e)<E||Math.abs(e)>=Math.abs(k)},F=B(O=b?(x<0?1+x:x)*k:(x<0?k:0)+x*P),z=B(Math.abs(k)-Math.abs(O));if(!F&&!z||R)if(I){var G=c.y1+O+(f?d/2*P:0),Y=c.x1,X=c.x2;n.segpts=[Y,G,X,G]}else{var V=c.x1+O+(f?h/2*P:0),U=c.y1,j=c.y2;n.segpts=[V,U,V,j]}else if(I){var H=Math.abs(M)<=d/2,q=Math.abs(D)<=p/2;if(H){var W=(c.x1+c.x2)/2,$=c.y1,K=c.y2;n.segpts=[W,$,W,K]}else if(q){var Z=(c.y1+c.y2)/2,Q=c.x1,J=c.x2;n.segpts=[Q,Z,J,Z]}else n.segpts=[c.x1,c.y2]}else{var ee=Math.abs(M)<=h/2,te=Math.abs(C)<=g/2;if(ee){var ne=(c.y1+c.y2)/2,re=c.x1,ie=c.x2;n.segpts=[re,ne,ie,ne]}else if(te){var ae=(c.x1+c.x2)/2,oe=c.y1,se=c.y2;n.segpts=[ae,oe,ae,se]}else n.segpts=[c.x2,c.y1]}},eh.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!_(n.startX)||!_(n.startY),d=!_(n.arrowStartX)||!_(n.arrowStartY),p=!_(n.endX)||!_(n.endY),g=!_(n.arrowEndX)||!_(n.arrowEndY),f=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,v=En({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),y=v<f,m=En({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),b=m<f,x=!1;if(h||d||y){x=!0;var w={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(w.x*w.x+w.y*w.y),T={x:w.x/E,y:w.y/E},D=Math.max(a,o),C={x:n.ctrlpts[0]+2*T.x*D,y:n.ctrlpts[1]+2*T.y*D},N=u.intersectLine(r.x,r.y,a,o,C.x,C.y,0);y?(n.ctrlpts[0]=n.ctrlpts[0]+T.x*(f-v),n.ctrlpts[1]=n.ctrlpts[1]+T.y*(f-v)):(n.ctrlpts[0]=N[0]+T.x*f,n.ctrlpts[1]=N[1]+T.y*f)}if(p||g||b){x=!0;var A={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},L=Math.sqrt(A.x*A.x+A.y*A.y),S={x:A.x/L,y:A.y/L},O=Math.max(a,o),I={x:n.ctrlpts[0]+2*S.x*O,y:n.ctrlpts[1]+2*S.y*O},k=c.intersectLine(i.x,i.y,s,l,I.x,I.y,0);b?(n.ctrlpts[0]=n.ctrlpts[0]+S.x*(f-m),n.ctrlpts[1]=n.ctrlpts[1]+S.y*(f-m)):(n.ctrlpts[0]=k[0]+S.x*f,n.ctrlpts[1]=k[1]+S.y*f)}x&&this.findEndpoints(e)}},eh.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r,i;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=Dn(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=Dn(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType)if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var a=t.segpts.length/2,o=a-2;t.midX=(t.segpts[o]+t.segpts[a])/2,t.midY=(t.segpts[o+1]+t.segpts[a+1])/2}else{var s=t.segpts.length/2-1;t.midX=t.segpts[s],t.midY=t.segpts[s+1]}},eh.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||_(t.startX)&&_(t.startY)&&_(t.endX)&&_(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Nt("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},eh.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i={map:new Yt,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new Yt,this.map.set(e[0],n)),n.set(e[1],t)}},a=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace())if("haystack"!==c){var h="unbundled-bezier"===c||"segments"===c||"straight"===c||"straight-triangle"===c||"taxi"===c,d="unbundled-bezier"===c||"bezier"===c,p=u.source,g=u.target,f=[p.poolIndex(),g.poolIndex()].sort(),v=i.get(f);null==v&&(v={eles:[]},i.set(f,v),a.push(f)),v.eles.push(l),h&&(v.hasUnbundled=!0),d&&(v.hasBezier=!0)}else o.push(l)}for(var y=function(e){var o=a[e],s=i.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()}));Rt(s.eles),u.forEach((function(e){return s.eles.push(e)})),s.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))}var c=s.eles[0],h=c.source(),d=c.target();if(h.poolIndex()>d.poolIndex()){var p=h;h=d,d=p}var g=s.srcPos=h.position(),f=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),m=s.tgtW=d.outerWidth(),b=s.tgtH=d.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(h)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(d)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var E=0;E<s.eles.length;E++){var T=s.eles[E],D=T[0]._private.rscratch,C=T.pstyle("curve-style").value,N="unbundled-bezier"===C||"segments"===C||"taxi"===C,A=!h.same(T.source());if(!s.calculatedIntersection&&h!==d&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var L=x.intersectLine(g.x,g.y,v,y,f.x,f.y,0),S=s.srcIntn=L,O=w.intersectLine(f.x,f.y,m,b,g.x,g.y,0),I=s.tgtIntn=O,k=s.intersectionPts={x1:L[0],x2:O[0],y1:L[1],y2:O[1]},M=s.posPts={x1:g.x,x2:f.x,y1:g.y,y2:f.y},P=O[1]-L[1],R=O[0]-L[0],B=Math.sqrt(R*R+P*P),F=s.vector={x:R,y:P},z=s.vectorNorm={x:F.x/B,y:F.y/B},G={x:-z.y,y:z.x};s.nodesOverlap=!_(B)||w.checkPoint(L[0],L[1],0,m,b,f.x,f.y)||x.checkPoint(O[0],O[1],0,v,y,g.x,g.y),s.vectorNormInverse=G,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:f,tgtPos:g,srcW:m,srcH:b,tgtW:v,tgtH:y,srcIntn:I,tgtIntn:S,srcShape:w,tgtShape:x,posPts:{x1:M.x2,y1:M.y2,x2:M.x1,y2:M.y1},intersectionPts:{x1:k.x2,y1:k.y2,x2:k.x1,y2:k.y1},vector:{x:-F.x,y:-F.y},vectorNorm:{x:-z.x,y:-z.y},vectorNormInverse:{x:-G.x,y:-G.y}}}var Y=A?l:s;D.nodesOverlap=Y.nodesOverlap,D.srcIntn=Y.srcIntn,D.tgtIntn=Y.tgtIntn,r&&(h.isParent()||h.isChild()||d.isParent()||d.isChild())&&(h.parents().anySame(d)||d.parents().anySame(h)||h.same(d)&&h.isParent())?t.findCompoundLoopPoints(T,Y,E,N):h===d?t.findLoopPoints(T,Y,E,N):"segments"===C?t.findSegmentsPoints(T,Y):"taxi"===C?t.findTaxiPoints(T,Y):"straight"===C||!N&&s.eles.length%2==1&&E===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(T):t.findBezierPoints(T,Y,E,N,A),t.findEndpoints(T),t.tryToCorrectInvalidPoints(T,Y),t.checkForInvalidEdgeWarning(T),t.storeAllpts(T),t.storeEdgeProjections(T),t.calculateArrowAngles(T),t.recalculateEdgeLabelProjections(T),t.calculateLabelAngles(T)}},m=0;m<a.length;m++)y(m);this.findHaystackPoints(o)}},eh.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),th(t.segpts)},eh.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return this.recalculateRenderedStyle(e),th(t.ctrlpts)},eh.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var nh={manualEndptToPx:function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight();if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*i),"%"===t.units[1]&&(o[1]=o[1]*a),o[0]+=r.x,o[1]+=r.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(i,a),u=[r.x+Math.cos(s)*l,r.y+Math.sin(s)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,u[0],u[1],0)},findEndpoints:function(e){var t,n,r,i,a,o=this,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),h=e.pstyle("target-arrow-shape").value,d=e.pstyle("source-arrow-shape").value,p=e.pstyle("target-distance-from-node").pfValue,g=e.pstyle("source-distance-from-node").pfValue,f=e.pstyle("curve-style").value,v=e._private.rscratch,y=v.edgeType,m="self"===y||"compound"===y,b="bezier"===y||"multibezier"===y||m,x="bezier"!==y,w="straight"===y||"segments"===y,E="segments"===y,T=b||x||w,D=m||"taxi"===f,C=e.pstyle("source-endpoint"),N=D?"outside-to-node":C.value,A=e.pstyle("target-endpoint"),L=D?"outside-to-node":A.value;if(v.srcManEndpt=C,v.tgtManEndpt=A,b){var S=[v.ctrlpts[0],v.ctrlpts[1]];n=x?[v.ctrlpts[v.ctrlpts.length-2],v.ctrlpts[v.ctrlpts.length-1]]:S,r=S}else if(w){var O=E?v.segpts.slice(0,2):[c.x,c.y];n=E?v.segpts.slice(v.segpts.length-2):[u.x,u.y],r=O}if("inside-to-node"===L)t=[c.x,c.y];else if(A.units)t=this.manualEndptToPx(l,A);else if("outside-to-line"===L)t=v.tgtIntn;else if("outside-to-node"===L||"outside-to-node-or-label"===L?i=n:"outside-to-line"!==L&&"outside-to-line-or-label"!==L||(i=[u.x,u.y]),t=o.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===L||"outside-to-line-or-label"===L){var I=l._private.rscratch,k=I.labelWidth,M=I.labelHeight,P=I.labelX,R=I.labelY,B=k/2,F=M/2,z=l.pstyle("text-valign").value;"top"===z?R-=F:"bottom"===z&&(R+=F);var G=l.pstyle("text-halign").value;"left"===G?P-=B:"right"===G&&(P+=B);var Y=ir(i[0],i[1],[P-B,R-F,P+B,R-F,P+B,R+F,P-B,R+F],c.x,c.y);if(Y.length>0){var X=u,V=Tn(X,pn(t)),U=Tn(X,pn(Y)),j=V;U<V&&(t=Y,j=U),Y.length>2&&Tn(X,{x:Y[2],y:Y[3]})<j&&(t=[Y[2],Y[3]])}}var H=or(t,n,o.arrowShapes[h].spacing(e)+p),q=or(t,n,o.arrowShapes[h].gap(e)+p);if(v.endX=q[0],v.endY=q[1],v.arrowEndX=H[0],v.arrowEndY=H[1],"inside-to-node"===N)t=[u.x,u.y];else if(C.units)t=this.manualEndptToPx(s,C);else if("outside-to-line"===N)t=v.srcIntn;else if("outside-to-node"===N||"outside-to-node-or-label"===N?a=r:"outside-to-line"!==N&&"outside-to-line-or-label"!==N||(a=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===N||"outside-to-line-or-label"===N){var W=s._private.rscratch,$=W.labelWidth,K=W.labelHeight,Z=W.labelX,Q=W.labelY,J=$/2,ee=K/2,te=s.pstyle("text-valign").value;"top"===te?Q-=ee:"bottom"===te&&(Q+=ee);var ne=s.pstyle("text-halign").value;"left"===ne?Z-=J:"right"===ne&&(Z+=J);var re=ir(a[0],a[1],[Z-J,Q-ee,Z+J,Q-ee,Z+J,Q+ee,Z-J,Q+ee],u.x,u.y);if(re.length>0){var ie=c,ae=Tn(ie,pn(t)),oe=Tn(ie,pn(re)),se=ae;oe<ae&&(t=[re[0],re[1]],se=oe),re.length>2&&Tn(ie,{x:re[2],y:re[3]})<se&&(t=[re[2],re[3]])}}var le=or(t,r,o.arrowShapes[d].spacing(e)+g),ue=or(t,r,o.arrowShapes[d].gap(e)+g);v.startX=ue[0],v.startY=ue[1],v.arrowStartX=le[0],v.arrowStartY=le[1],T&&(_(v.startX)&&_(v.startY)&&_(v.endX)&&_(v.endY)?v.badLine=!1:v.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),"haystack"===t.edgeType?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),"haystack"===t.edgeType?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}}},rh={};function ih(e,t,n){for(var r=function(e,t,n,r){return Dn(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}rh.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)ih(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},rh.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var ah={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!k(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,d=i.rstyle;switch(u){case"left":n=l.x-a/2-s;break;case"right":n=l.x+a/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}h.labelX=n,h.labelY=r,d.labelX=n,d.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},oh=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},sh=function(e,t){var n=t.x-e.x,r=t.y-e.y;return oh(n,r)},lh=function(e,t,n,r){var i=An(0,r-.001,1),a=An(0,r+.001,1),o=Cn(e,t,n,i),s=Cn(e,t,n,a);return sh(o,s)};ah.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){zt(n.rscratch,e,t,r),zt(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=oh(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<r.allpts.length;a+=4){var o={x:r.allpts[a],y:r.allpts[a+1]},s={x:r.allpts[a+2],y:r.allpts[a+3]},l={x:r.allpts[a+4],y:r.allpts[a+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,n,r,i){var a=En(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<t.length;d++){var p=t[d],g=t[d-1];g&&(p.startDist=g.startDist+g.length),h(p,p.p0,u[d*c],0,i.bezierProjPcts[0]);for(var f=0;f<c-1;f++)h(p,u[d*c+f],u[d*c+f+1],i.bezierProjPcts[f],i.bezierProjPcts[f+1]);h(p,u[d*c+c-1],p.p2,i.bezierProjPcts[c-1],1)}return e.cache=t},u=function(n){var i,s="source"===n;if(a[n]){var u=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,h=l(),d=0,p=0,g=0;g<h.length;g++){for(var f=h[s?g:h.length-1-g],v=0;v<f.segments.length;v++){var y=f.segments[s?v:f.segments.length-1-v],m=g===h.length-1&&v===f.segments.length-1;if(d=p,(p+=y.length)>=u||m){c={cp:f,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-d)/x.length,E=x.t1-x.t0,T=s?x.t0+E*w:x.t1-E*w;T=An(0,T,1),t=Cn(b.p0,b.p1,b.p2,T),i=lh(b.p0,b.p1,b.p2,T);break;case"straight":case"segments":case"haystack":for(var _,D,C,N,A=0,L=r.allpts.length,S=0;S+3<L&&(s?(C={x:r.allpts[S],y:r.allpts[S+1]},N={x:r.allpts[S+2],y:r.allpts[S+3]}):(C={x:r.allpts[L-2-S],y:r.allpts[L-1-S]},N={x:r.allpts[L-4-S],y:r.allpts[L-3-S]}),D=A,!((A+=_=En(C,N))>=u));S+=2);var O=(u-D)/_;O=An(0,O,1),t=Nn(C,N,O),i=sh(C,N)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},ah.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},ah.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ft(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;zt(n.rstyle,"labelWidth",t,h),zt(n.rscratch,"labelWidth",t,h),zt(n.rstyle,"labelHeight",t,d),zt(n.rscratch,"labelHeight",t,d),zt(n.rscratch,"labelLineHeight",t,c)},ah.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(zt(n.rscratch,e,t,r),r):Ft(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="\u200b",c=i.split("\n"),h=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],g=/[\s\u200b]+/,f=d?"":" ",v=0;v<c.length;v++){var y=c[v],m=this.calculateLabelDimensions(e,y).width;if(d){var b=y.split("").join(u);y=b}if(m>h){for(var x=y.split(g),w="",E=0;E<x.length;E++){var T=x[E],_=0===w.length?T:w+f+T;this.calculateLabelDimensions(e,_).width<=h?w+=T+f:(w&&p.push(w),w=T+f)}w.match(/^[\s\u200b]+$/)||p.push(w)}else p.push(y)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,C="",N="\u2026",A=!1;if(this.calculateLabelDimensions(e,i).width<D)return i;for(var L=0;L<i.length&&!(this.calculateLabelDimensions(e,C+i[L]+N).width>D);L++)C+=i[L],L===i.length-1&&(A=!0);return A||(C+=N),C}return i},ah.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},ah.calculateLabelDimensions=function(e,t){var n=this,r=gt(t,e._private.labelDimsKey),i=n.labelDimCache||(n.labelDimCache=[]),a=i[r];if(null!=a)return a;var o=0,s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,h=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),d=this.labelCalcCanvasContext=h.getContext("2d");var p=h.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}d.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var g=0,f=0,v=t.split("\n"),y=0;y<v.length;y++){var m=v[y],b=d.measureText(m),x=Math.ceil(b.width),w=l;g=Math.max(x,g),f+=w}return g+=o,f+=o,i[r]={width:g,height:f}},ah.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=a.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:a.pfValue},ah.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var uh={},ch=28,hh=!1;uh.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if("cutrectangle"===n&&(e.width()<ch||e.height()<ch))return hh||(Nt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),hh=!0),"rectangle";if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"round-rectangle"===n||"cutrectangle"===n||"cut-rectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var dh={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",(function(e){var t=e.target;r(t)})).on("style.* background.*",(function(e){var t=e.target;r(t,!1)}));var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++)(0,a[u])(i,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=function(e){return e._private.rstyle.cleanConnected},r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=d.x,h.nodeY=d.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var g=r[p]._private,f=g.rstyle,v=g.rscratch;f.srcX=v.arrowStartX,f.srcY=v.arrowStartY,f.tgtX=v.arrowEndX,f.tgtY=v.arrowEndY,f.midX=v.midX,f.midY=v.midY,f.labelAngle=v.labelAngle,f.sourceLabelAngle=v.sourceLabelAngle,f.targetLabelAngle=v.targetLabelAngle}}}},ph={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(i=e[n])._private.rscratch;i.grabbed()&&!i.isParent()?t.push(i):r.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Wl),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},gh={};[Qc,Jc,eh,nh,rh,ah,uh,dh,ph].forEach((function(e){Q(gh,e)}));var fh={getCachedImage:function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener("load",n),a.image;var o=(a=i[e]=i[e]||{}).image=new Image;o.addEventListener("load",n),o.addEventListener("error",(function(){o.error=!0}));var s="data:";return e.substring(0,s.length).toLowerCase()===s||(t="null"===t?null:t,o.crossOrigin=t),o.src=e,o}},vh={registerBinding:function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,i)},binder:function(e){var t=this,n=e===window||e===document||e===document.body||M(e);if(null==t.supportsPassiveEvents){var r=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return r=!0,!0}});window.addEventListener("test",null,i)}catch(o){}t.supportsPassiveEvents=r}var a=function(r,i,a){var o=Array.prototype.slice.call(arguments);return n&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:a,addEventListener:a,addListener:a,bind:a}},nodeIsDraggable:function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},nodeIsGrabbable:function(e){return this.nodeIsDraggable(e)&&e.interactive()},load:function(){var e=this,t=function(e){return e.selected()},n=function(t,n,r,i){null==t&&(t=e.cy);for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},r=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},i=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable()){for(var i=0;n&&i<n.length;i++)if((t=n[i]).isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},a=function(e){e[0]._private.grabbed=!0},o=function(e){e[0]._private.grabbed=!1},s=function(e){e[0]._private.rscratch.inDragLayer=!0},l=function(e){e[0]._private.rscratch.inDragLayer=!1},u=function(e){e[0]._private.rscratch.isGrabTarget=!0},c=function(e){e[0]._private.rscratch.isGrabTarget=!1},h=function(e,t){var n=t.addToList;n.has(e)||!e.grabbable()||e.locked()||(n.merge(e),a(e))},d=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(s),n.connectedEdges().forEach(s)),t.addToList&&h(n,t)}},p=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(s),t.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(s)),n.addToList&&t.forEach((function(e){h(e,n)})),d(t,n),v(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},g=p,f=function(t){t&&(e.getCachedZSortedEles().forEach((function(e){o(e),l(e),c(e)})),e.updateCachedGrabbedEles())},v=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(s),r.forEach(s)),t.addToList&&r.forEach((function(e){h(e,t)}))}}},y=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},m="undefined"!=typeof MutationObserver,b="undefined"!=typeof ResizeObserver;m?(e.removeObserver=new MutationObserver((function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var i=0;i<r.length;i++)if(r[i]===e.container){e.destroy();break}}})),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",(function(t){e.destroy()}));var x=Qe((function(){e.cy.resize()}),100);m&&(e.styleObserver=new MutationObserver(x),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(window,"resize",x),b&&(e.resizeObserver=new ResizeObserver(x),e.resizeObserver.observe(e.container));var w=function(e,t){for(;null!=e;)t(e),e=e.parentNode},E=function(){e.invalidateContainerClientCoordsCache()};w(e.container,(function(t){e.registerBinding(t,"transitionend",E),e.registerBinding(t,"animationend",E),e.registerBinding(t,"scroll",E)})),e.registerBinding(e.container,"contextmenu",(function(e){e.preventDefault()}));var T,D,C,N=function(){return 0!==e.selection[4]},A=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;for(var h=e.container,d=t.target.parentNode,p=!1;d;){if(d===h){p=!0;break}d=d.parentNode}return!!p};e.registerBinding(e.container,"mousedown",(function(t){if(A(t)){t.preventDefault(),y(),e.hoverData.capture=!0,e.hoverData.which=t.which;var r=e.cy,i=[t.clientX,t.clientY],a=e.projectIntoViewport(i[0],i[1]),o=e.selection,s=e.findNearestElements(a[0],a[1],!0,!1),l=s[0],c=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=i;var h=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout((function(){if(!e.hoverData.tapholdCancelled){var n=e.hoverData.down;n?n.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}}):r.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}})}}),e.tapholdDuration)};if(3==t.which){e.hoverData.cxtStarted=!0;var d={originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}};l?(l.activate(),l.emit(d),e.hoverData.down=l):r.emit(d),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(l&&l.activate(),null!=l&&e.nodeIsGrabbable(l)){var f=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}},v=function(e){e.emit(f("grab"))};if(u(l),l.selected()){c=e.dragData.possibleDragElements=r.collection();var m=r.$((function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)}));p(m,{addToList:c}),l.emit(f("grabon")),m.forEach(v)}else c=e.dragData.possibleDragElements=r.collection(),g(l,{addToList:c}),l.emit(f("grabon")).emit(f("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=l,e.hoverData.downs=s,e.hoverData.downTime=(new Date).getTime(),n(l,["mousedown","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==l?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint("select",!0),e.redraw()):l.pannable()&&(o[4]=1),h()}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}}),!1),e.registerBinding(window,"mousemove",(function(t){if(e.hoverData.capture||A(t)){var a=!1,o=e.cy,s=o.zoom(),l=[t.clientX,t.clientY],u=e.projectIntoViewport(l[0],l[1]),c=e.hoverData.mdownPos,h=e.hoverData.mdownGPos,d=e.selection,g=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(g=e.findNearestElement(u[0],u[1],!0,!1));var v,y=e.hoverData.last,m=e.hoverData.down,b=[u[0]-d[2],u[1]-d[3]],x=e.dragData.possibleDragElements;if(h){var w=l[0]-h[0],E=w*w,T=l[1]-h[1],D=E+T*T;e.hoverData.isOverThresholdDrag=v=D>=e.desktopTapThreshold2}var C=r(t);v&&(e.hoverData.tapholdCancelled=!0);var N=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])};a=!0,n(g,["mousemove","vmousemove","tapdrag"],t,{x:u[0],y:u[1]});var L=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:u[0],y:u[1]}}),d[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var S={originalEvent:t,type:"cxtdrag",position:{x:u[0],y:u[1]}};m?m.emit(S):o.emit(S),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}}else if(e.hoverData.dragging){if(a=!0,o.panningEnabled()&&o.userPanningEnabled()){var O;if(e.hoverData.justStartedPan){var I=e.hoverData.mdownPos;O={x:(u[0]-I[0])*s,y:(u[1]-I[1])*s},e.hoverData.justStartedPan=!1}else O={x:b[0]*s,y:b[1]*s};o.panBy(O),o.emit("dragpan"),e.hoverData.dragged=!0}u=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=d[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&n(y,["mouseout","tapdragout"],t,{x:u[0],y:u[1]}),g&&n(g,["mouseover","tapdragover"],t,{x:u[0],y:u[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&C)m&&m.grabbed()&&(f(x),m.emit("freeon"),x.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),x.emit("dragfree"))),L();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var k=!e.dragData.didDrag;k&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(x,{inDragLayer:!0});var M={x:0,y:0};if(_(b[0])&&_(b[1])&&(M.x+=b[0],M.y+=b[1],k)){var P=e.hoverData.dragDelta;P&&_(P[0])&&_(P[1])&&(M.x+=P[0],M.y+=P[1])}e.hoverData.draggingEles=!0,x.silentShift(M).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else N();a=!0}else v&&(e.hoverData.dragging||!o.boxSelectionEnabled()||!C&&o.panningEnabled()&&o.userPanningEnabled()?!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()&&i(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,d[4]=0,e.data.bgActivePosistion=pn(c),e.redrawHint("select",!0),e.redraw()):L(),m&&m.pannable()&&m.active()&&m.unactivate());return d[2]=u[0],d[3]=u[1],a?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var d={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(d):a.emit(d),!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(p):a.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(n(c,["click","tap","vclick"],i,{x:o[0],y:o[1]}),D=!1,i.timeStamp-C<=a.multiClickDebounceTime()?(T&&clearTimeout(T),D=!0,C=null,n(c,["dblclick","dbltap","vdblclick"],i,{x:o[0],y:o[1]})):(T=setTimeout((function(){D||n(c,["oneclick","onetap","voneclick"],i,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),C=i.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(t).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();f(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}}),!1);var L,S,O,I,k,M,P,R,B,F,z,G,Y,X=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||N())t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",X,!0),e.registerBinding(window,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||X(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var V,U,j,H,q,W,$,K=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},Z=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",V=function(t){if(e.hasTouchStarted=!0,A(t)){y(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]&&(o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),i[2]=o[0],i[3]=o[1]),t.touches[2]&&(o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),i[4]=o[0],i[5]=o[1]),t.touches[1]){e.touchData.singleTouchMoved=!0,f(e.dragData.touchDragEles);var s=e.findContainerClientCoords();B=s[0],F=s[1],z=s[2],G=s[3],L=t.touches[0].clientX-B,S=t.touches[0].clientY-F,O=t.touches[1].clientX-B,I=t.touches[1].clientY-F,Y=0<=L&&L<=z&&0<=O&&O<=z&&0<=S&&S<=G&&0<=I&&I<=G;var l=r.pan(),c=r.zoom();k=K(L,S,O,I),M=Z(L,S,O,I),R=[((P=[(L+O)/2,(S+I)/2])[0]-l.x)/c,(P[1]-l.y)/c];var h=200;if(M<h*h&&!t.touches[2]){var d=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return d&&d.isNode()?(d.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=d):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var m=e.findNearestElements(i[0],i[1],!0,!0),b=m[0];if(null!=b&&(b.activate(),e.touchData.start=b,e.touchData.starts=m,e.nodeIsGrabbable(b))){var x=e.dragData.touchDragEles=r.collection(),w=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),b.selected()?(w=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),p(w,{addToList:x})):g(b,{addToList:x}),u(b);var E=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};b.emit(E("grabon")),w?w.forEach((function(e){e.emit(E("grab"))})):b.emit(E("grab"))}n(b,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==b&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var T=e.touchData.startPosition=[],_=0;_<i.length;_++)T[_]=a[_]=i[_];var D=t.touches[0];e.touchData.startGPosition=[D.clientX,D.clientY]}}},!1),e.registerBinding(window,"touchmove",U=function(t){var r=e.touchData.capture;if(r||A(t)){var a=e.selection,o=e.cy,s=e.touchData.now,l=e.touchData.earlier,u=o.zoom();if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=c[0],s[1]=c[1]}t.touches[1]&&(c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),s[2]=c[0],s[3]=c[1]),t.touches[2]&&(c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),s[4]=c[0],s[5]=c[1]);var h,d=e.touchData.startGPosition;if(r&&t.touches[0]&&d){for(var g=[],v=0;v<s.length;v++)g[v]=s[v]-l[v];var y=t.touches[0].clientX-d[0],m=y*y,b=t.touches[0].clientY-d[1];h=m+b*b>=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-B,w=t.touches[0].clientY-F,E=t.touches[1].clientX-B,T=t.touches[1].clientY-F,D=Z(x,w,E,T),C=150,N=1.5;if(D/M>=N*N||D>=C*C){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var P={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(P),e.touchData.start=null):o.emit(P)}}if(r&&e.touchData.cxt){P={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}},e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(P):o.emit(P),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var z=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&z===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=z,z&&z.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ne=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var G=0;G<ne.length;G++){var X=ne[G]._private;X.grabbed=!1,X.rscratch.inDragLayer=!1}}var V=e.touchData.start,U=(x=t.touches[0].clientX-B,w=t.touches[0].clientY-F,E=t.touches[1].clientX-B,T=t.touches[1].clientY-F,K(x,w,E,T)),j=U/k;if(Y){var H=(x-L+(E-O))/2,q=(w-S+(T-I))/2,W=o.zoom(),$=W*j,Q=o.pan(),J=R[0]*W+Q.x,ee=R[1]*W+Q.y,te={x:-$/W*(J-Q.x-H)+J,y:-$/W*(ee-Q.y-q)+ee};if(V&&V.active()){var ne=e.dragData.touchDragEles;f(ne),e.redrawHint("drag",!0),e.redrawHint("eles",!0),V.unactivate().emit("freeon"),ne.emit("free"),e.dragData.didDrag&&(V.emit("dragfreeon"),ne.emit("dragfree"))}o.viewport({zoom:$,pan:te,cancelOnFailedZoom:!0}),o.emit("pinchzoom"),k=U,L=x,S=w,O=E,I=T,e.pinching=!0}t.touches[0]&&(c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY),s[0]=c[0],s[1]=c[1]),t.touches[1]&&(c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),s[2]=c[0],s[3]=c[1]),t.touches[2]&&(c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),s[4]=c[0],s[5]=c[1])}else if(t.touches[0]&&!e.touchData.didSelect){var re=e.touchData.start,ie=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(z=e.findNearestElement(s[0],s[1],!0,!0)),r&&null!=re&&t.preventDefault(),r&&null!=re&&e.nodeIsDraggable(re))if(h){ne=e.dragData.touchDragEles;var ae=!e.dragData.didDrag;ae&&p(ne,{inDragLayer:!0}),e.dragData.didDrag=!0;var oe={x:0,y:0};_(g[0])&&_(g[1])&&(oe.x+=g[0],oe.y+=g[1],ae&&(e.redrawHint("eles",!0),(se=e.touchData.dragDelta)&&_(se[0])&&_(se[1])&&(oe.x+=se[0],oe.y+=se[1]))),e.hoverData.draggingEles=!0,ne.silentShift(oe).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==l[0]&&e.touchData.startPosition[1]==l[1]&&e.redrawHint("eles",!0),e.redraw()}else{var se;0===(se=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(se.push(g[0]),se.push(g[1])):(se[0]+=g[0],se[1]+=g[1])}if(n(re||z,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),re&&re.grabbed()||z==ie||(ie&&ie.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),z&&z.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=z,r)for(G=0;G<s.length;G++)s[G]&&e.touchData.startPosition[G]&&h&&(e.touchData.singleTouchMoved=!0);r&&(null==re||re.pannable())&&o.panningEnabled()&&o.userPanningEnabled()&&(i(re,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=pn(e.touchData.startPosition)),e.swipePanning?(o.panBy({x:g[0]*u,y:g[1]*u}),o.emit("dragpan")):h&&(e.swipePanning=!0,o.panBy({x:y*u,y:b*u}),o.emit("dragpan"),re&&(re.unactivate(),e.redrawHint("select",!0),e.touchData.start=null))),c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY),s[0]=c[0],s[1]=c[1])}for(v=0;v<s.length;v++)l[v]=s[v];r&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",j=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",H=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(r.touches[0]){var h=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(r.touches[1]&&(h=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY),u[2]=h[0],u[3]=h[1]),r.touches[2]&&(h=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY),u[4]=h[0],u[5]=h[1]),i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var d={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(d):s.emit(d)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[1]}});var g=function(e){return e.selectable()&&!e.selected()};p.emit("box").stdFilter(g).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var v=e.dragData.touchDragEles;if(null!=i){var y=i._private.grabbed;f(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),y&&(i.emit("freeon"),v.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),v.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(u[0],u[1],!0,!0);n(m,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var b=e.touchData.startPosition[0]-u[0],x=b*b,w=e.touchData.startPosition[1]-u[1],E=(x+w*w)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]}),q=!1,r.timeStamp-$<=s.multiClickDebounceTime()?(W&&clearTimeout(W),q=!0,$=null,n(i,["dbltap","vdblclick"],r,{x:u[0],y:u[1]})):(W=setTimeout((function(){q||n(i,["onetap","voneclick"],r,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),$=r.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&E<e.touchTapThreshold2&&!e.pinching&&("single"===s.selectionType()?(s.$(t).unmerge(i).unselect(["tapunselect"]),i.select(["tapselect"])):i.selected()?i.unselect(["tapunselect"]):i.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var T=0;T<u.length;T++)c[T]=u[T];e.dragData.didDrag=!1,0===r.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=null,e.touchData.startGPosition=null,e.touchData.didSelect=!1),r.touches.length<2&&(1===r.touches.length&&(e.touchData.startGPosition=[r.touches[0].clientX,r.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"==typeof TouchEvent){var Q=[],J=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},ee=function(e){return{event:e,touch:J(e)}},te=function(e){Q.push(ee(e))},ne=function(e){for(var t=0;t<Q.length;t++)if(Q[t].event.pointerId===e.pointerId)return void Q.splice(t,1)},re=function(e){var t=Q.filter((function(t){return t.event.pointerId===e.pointerId}))[0];t.event=e,t.touch=J(e)},ie=function(e){e.touches=Q.map((function(e){return e.touch}))},ae=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",(function(e){ae(e)||(e.preventDefault(),te(e),ie(e),V(e))})),e.registerBinding(e.container,"pointerup",(function(e){ae(e)||(ne(e),ie(e),H(e))})),e.registerBinding(e.container,"pointercancel",(function(e){ae(e)||(ne(e),ie(e),j(e))})),e.registerBinding(e.container,"pointermove",(function(e){ae(e)||(e.preventDefault(),re(e),ie(e),U(e))}))}}},yh={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return ir(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o){return $n(e,t,this.points,a,o,r,i,[0,-1],n)}}},generateEllipse:function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return Jn(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o){return er(e,t,r,i,a,o,n)}}},generateRoundPolygon:function(e,t){for(var n=new Array(2*t.length),r=0;r<t.length/2;r++){var i=2*r,a=void 0;a=r<t.length/2-1?2*(r+1):0,n[4*r]=t[i],n[4*r+1]=t[i+1];var o=t[a]-t[i],s=t[a+1]-t[i+1],l=Math.sqrt(o*o+s*s);n[4*r+2]=o/l,n[4*r+3]=s/l}return this.nodeShapes[e]={renderer:this,name:e,points:n,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return ar(i,a,this.points,e,t,n,r)},checkPoint:function(e,t,n,r,i,a,o){return Kn(e,t,this.points,a,o,r,i)}}},generateRoundRectangle:function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:sr(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return Yn(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=cr(r,i),l=2*s;return!!($n(e,t,this.points,a,o,r,i-l,[0,-1],n)||$n(e,t,this.points,a,o,r-l,i,[0,-1],n)||er(e,t,l,l,a-r/2+s,o-i/2+s,n)||er(e,t,l,l,a+r/2-s,o-i/2+s,n)||er(e,t,l,l,a+r/2-s,o+i/2-s,n)||er(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},generateCutRectangle:function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:dr(),points:sr(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},generateCutTrianglePts:function(e,t,n,r){var i=this.cornerLength,a=t/2,o=e/2,s=n-o,l=n+o,u=r-a,c=r+a;return{topLeft:[s,u+i,s+i,u,s+i,u+i],topRight:[l-i,u,l,u+i,l-i,u+i],bottomRight:[l,c-i,l-i,c,l-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateCutTrianglePts(n+2*o,r+2*o,e,t),l=[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]);return ir(i,a,l,e,t)},checkPoint:function(e,t,n,r,i,a,o){if($n(e,t,this.points,a,o,r,i-2*this.cornerLength,[0,-1],n))return!0;if($n(e,t,this.points,a,o,r-2*this.cornerLength,i,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,i,a,o);return Wn(e,t,s.topLeft)||Wn(e,t,s.topRight)||Wn(e,t,s.bottomRight)||Wn(e,t,s.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:sr(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=.15,l=.5,u=.85,c=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),h=function(e){var t=Cn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},s),n=Cn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},l),r=Cn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},d=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return ir(i,a,d,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,u=r+i,c=gr(e,t),h=c.heightOffset,d=c.widthOffset,p=c.ctrlPtOffsetPct*e,g={topLeft:[o,l+h,o+p,l,o+d,l],topRight:[s-d,l,s-p,l,s,l+h],bottomRight:[s,u-h,s-p,u,s-d,u],bottomLeft:[o+d,u,o+p,u,o,u-h]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,t,n,r,i,a,o){var s=gr(r,i),l=s.heightOffset,u=s.widthOffset;if($n(e,t,this.points,a,o,r,i-2*l,[0,-1],n))return!0;if($n(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,i,a,o),h=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1],l=Math.min(r,a),u=Math.max(r,a),c=Math.min(o,s),h=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=h){var d=pr(r,i,a),p=Un(d[0],d[1],d[2],e).filter((function(e){return 0<=e&&e<=1}));if(p.length>0)return p[0]}return null},d=Object.keys(c),p=0;p<d.length;p++){var g=c[d[p]],f=h(e,t,g);if(null!=f){var v=g[5],y=g[3],m=g[1],b=Dn(v,y,m,f);if(g.isTop&&b<=t)return!0;if(g.isBottom&&t<=b)return!0}}return!1}}},generateBottomRoundrectangle:function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:sr(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=t-(r/2+o),l=rr(i,a,e,t,e-(n/2+o),s,e+(n/2+o),s,!1);return l.length>0?l:Yn(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=cr(r,i),l=2*s;if($n(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if($n(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Wn(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||!!er(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!er(e,t,l,l,a-r/2+s,o+i/2-s,n)}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",sr(3,0)),this.generateRoundPolygon("round-triangle",sr(3,0)),this.generatePolygon("rectangle",sr(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",sr(5,0)),this.generateRoundPolygon("round-pentagon",sr(5,0)),this.generatePolygon("hexagon",sr(6,0)),this.generateRoundPolygon("round-hexagon",sr(6,0)),this.generatePolygon("heptagon",sr(7,0)),this.generateRoundPolygon("round-heptagon",sr(7,0)),this.generatePolygon("octagon",sr(8,0)),this.generateRoundPolygon("round-octagon",sr(8,0));var r=new Array(20),i=ur(5,0),a=ur(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=lr(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}}},mh={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||kt();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&Dt("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority}))}}},bh=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};mh.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){bh(e,!0,r);var i=rt();e.render(e.renderOptions);var a=e.lastDrawTime=rt();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else bh(e,!1,r);e.skipFrame=!1,nt(n)}};nt(n)}};var xh=function(e){this.init(e)},wh=xh.prototype;wh.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],wh.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container();if(d){var r=d.document,i=r.head,a="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=r.getElementById(a);if(n.className.indexOf(o)<0&&(n.className=(n.className||"")+" "+o),!s){var l=r.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===d.getComputedStyle(n).getPropertyValue("position")&&Nt("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=_(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},wh.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},wh.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(i){}},wh.isHeadless=function(){return!1},[Zc,gh,fh,vh,yh,mh].forEach((function(e){Q(wh,e)}));var Eh=1e3/60,Th={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Qe((function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()}),e.deqRedrawThreshold),i=function(i,a){var o=rt(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),h=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var d=rt(),p=d-o,g=d-a;if(l<Eh){var f=Eh-(i?s:0);if(g>=e.deqFastCost*f)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*Eh)break;var v=e.deq(t,h,c);if(!(v.length>0))break;for(var y=0;y<v.length;y++)u.push(v[y])}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},a=e.priority||_t;n.beforeRender(i,a(t))}}}},_h=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Et;t(this,e),this.idsByKey=new Yt,this.keyForId=new Yt,this.cachesByLvl=new Yt,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return i(e,[{key:"getIdsFor",value:function(e){null==e&&Dt("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Ut,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new Yt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Dh=25,Ch=50,Nh=-4,Ah=3,Lh=7.99,Sh=8,Oh=1024,Ih=1024,kh=1024,Mh=.2,Ph=.8,Rh=10,Bh=.15,Fh=.1,zh=.9,Gh=.9,Yh=100,Xh=1,Vh={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Uh=Mt({getKey:null,doesEleInvalidateKey:Et,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:wt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),jh=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Uh(t);Q(n,r),n.lookup=new _h(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Hh=jh.prototype;Hh.reasons=Vh,Hh.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Hh.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},Hh.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new $t((function(e,t){return t.reqs-e.reqs}))},Hh.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},Hh.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(xn(s*n))),r<Nh)r=Nh;else if(s>=Lh||r>Ah)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p,g=l.get(e,r);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;if(p=c<=Dh?Dh:c<=Ch?Ch:Math.ceil(c/Ch)*Ch,c>kh||h>Ih)return null;var f=a.getTextureQueue(p),v=f[f.length-2],y=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};v||(v=f[f.length-1]),v||(v=y()),v.width-v.usedWidth<h&&(v=y());for(var m,b=function(e){return e&&e.scaledLabelShown===d},x=i&&i===Vh.dequeue,w=i&&i===Vh.highQuality,E=i&&i===Vh.downscale,T=r+1;T<=Ah;T++){var _=l.get(e,T);if(_){m=_;break}}var D=m&&m.level===r+1?m:null,C=function(){v.context.drawImage(D.texture.canvas,D.x,0,D.width,D.height,v.usedWidth,0,h,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,h,p),b(D))C();else if(b(m)){if(!w)return a.queueElement(e,m.level-1),m;for(var N=m.level;N>r;N--)D=a.getElement(e,t,n,N,Vh.downscale);C()}else{var A;if(!x&&!w&&!E)for(var L=r-1;L>=Nh;L--){var S=l.get(e,L);if(S){A=S;break}}if(b(A))return a.queueElement(e,r),A;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return g={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+Sh),v.eleCaches.push(g),l.set(e,r,g),a.checkTextureFullness(v),g},Hh.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Hh.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var i=Nh;i<=Ah;i++){var a=n.getForCachedKey(e,i);a&&r.push(a)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],l=s.texture;l.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(l)}t.removeFromQueue(e)}},Hh.checkTextureUtility=function(e){e.invalidatedWidth>=Mh*e.width&&this.retireTexture(e)},Hh.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>Ph&&e.fullnessChecks>=Rh?Pt(t,e):e.fullnessChecks++},Hh.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;Pt(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}Rt(a),t.getRetiredTextureQueue(n).push(e)},Hh.addTexture=function(e,t){var n=this,r={};return n.getTextureQueue(e).push(r),r.eleCaches=[],r.height=e,r.width=Math.max(Oh,t),r.usedWidth=0,r.invalidatedWidth=0,r.fullnessChecks=0,r.canvas=n.renderer.makeOffscreenCanvas(r.width,r.height),r.context=r.canvas.getContext("2d"),r},Hh.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Rt(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Pt(i,o),r.push(o),o}},Hh.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},Hh.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<Xh&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,Vh.dequeue)}}return i},Hh.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];null!=a&&(1===a.eles.length?(a.reqs=xt,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},Hh.onDequeue=function(e){this.onDequeues.push(e)},Hh.offDequeue=function(e){Pt(this.onDequeues,e)},Hh.setupDequeueing=Th.setupDequeueing({deqRedrawThreshold:Yh,deqCost:Bh,deqAvgCost:Fh,deqNoDrawCost:zh,deqFastCost:Gh,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(Bn(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var qh=1,Wh=-4,$h=2,Kh=3.99,Zh=50,Qh=50,Jh=.15,ed=.1,td=.9,nd=.9,rd=1,id=250,ad=16e6,od=!0,sd=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=rt()-2*id,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Qe((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),Qh),n.beforeRender((function(e,n){n-t.lastInvalidationTime<=id?t.skipping=!0:t.skipping=!1}),n.beforeRenderPriorities.lyrTxrSkip);var i=function(e,t){return t.reqs-e.reqs};t.layersQueue=new $t(i),t.setupDequeueing()},ld=sd.prototype,ud=0,cd=Math.pow(2,53)-1;ld.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:ud=++ud%cd,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(n,n),s.translate(l,u),o},ld.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(xn(i*t)))<Wh)n=Wh;else if(i>=Kh||n>$h)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[],h=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;Wh<=r&&r<=$h&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Pt(c,o)}};if(r.levelIsComplete(n,e))return c;h();var d=function(){if(!o){o=Ln();for(var t=0;t<e.length;t++)In(o,e[t].boundingBox())}return o},p=function(e){var t=(e=e||{}).after;if(d(),o.w*u*(o.h*u)>ad)return null;var i=r.makeLayer(o,n);if(null!=t){var a=c.indexOf(t)+1;c.splice(a,0,i)}else(void 0===e.insert||e.insert)&&c.unshift(i);return i};if(r.skipping&&!a)return null;for(var g=null,f=e.length/qh,v=!a,y=0;y<e.length;y++){var m=e[y],b=m._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},w=x[n];if(w)g=w;else{if((!g||g.eles.length>=f||!Gn(g.bb,m.boundingBox()))&&!(g=p({insert:!0,after:g})))return null;s||v?r.queueLayer(g,m):r.drawEleInLayer(g,m,n,t),g.eles.push(m),x[n]=g}}return s||(v?null:c)},ld.getEleLevelForLayerLevel=function(e,t){return e},ld.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();0!==s.w&&0!==s.h&&t.visible()&&(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,od),a.setImgSmoothing(o,!0))},ld.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},ld.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},ld.updateElementsInLayers=function(e,t){for(var n=this,r=A(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],o=r?e[i]:e[i].ele,s=o._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=Wh;u<=$h;u++){var c=l[u];c&&(a&&n.getEleLevelForLayerLevel(c.level)!==a.level||t(c,o,a))}},ld.haveLayers=function(){for(var e=this,t=!1,n=Wh;n<=$h;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},ld.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=rt(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},ld.invalidateLayer=function(e){if(this.lastInvalidationTime=rt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Pt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},ld.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])}))},ld.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},ld.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},ld.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<rd&&0!==n.size();){var a=n.peek();if(a.replacement)n.pop();else if(a.replaces&&a!==a.replaces.replacement)n.pop();else if(a.invalid)n.pop();else{var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),0===r.length&&r.push(!0),0===a.elesQueue.length&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}}return r},ld.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},ld.requestRedraw=Qe((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),ld.setupDequeueing=Th.setupDequeueing({deqRedrawThreshold:Zh,deqCost:Jh,deqAvgCost:ed,deqNoDrawCost:td,deqFastCost:nd,deq:function(e,t){return e.dequeue(t)},onDeqd:_t,shouldRedraw:wt,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var hd,dd={};function pd(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function gd(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function fd(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];for(e.moveTo(s.x,s.y),i=1;i<o.length;i++)a=o[i],e.lineTo(a.x,a.y);e.closePath&&e.closePath()}function vd(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var l=a[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function yd(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}dd.arrowShapeImpl=function(e){return(hd||(hd={polygon:pd,"triangle-backcurve":gd,"triangle-tee":fd,"circle-triangle":vd,"triangle-cross":fd,circle:yd}))[e]};var md={drawElement:function(e,t,n,r,i,a){var o=this;t.isNode()?o.drawNode(e,t,n,r,i,a):o.drawEdge(e,t,n,r,i,a)},drawElementOverlay:function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},drawElementUnderlay:function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},drawCachedElementPortion:function(e,t,n,r,i,a,o,s){var l=this,u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,r,i,a);if(null!=c){var h=s(l,t);if(0===h)return;var d,p,g,f,v,y,m=o(l,t),b=u.x1,x=u.y1,w=u.w,E=u.h;if(0!==m){var T=n.getRotationPoint(t);g=T.x,f=T.y,e.translate(g,f),e.rotate(m),(v=l.getImgSmoothing(e))||l.setImgSmoothing(e,!0);var _=n.getRotationOffset(t);d=_.x,p=_.y}else d=b,p=x;1!==h&&(y=e.globalAlpha,e.globalAlpha=y*h),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,d,p,w,E),1!==h&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-g,-f),v||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},bd=function(){return 0},xd=function(e,t){return e.getTextAngle(t,null)},wd=function(e,t){return e.getTextAngle(t,"source")},Ed=function(e,t){return e.getTextAngle(t,"target")},Td=function(e,t){return t.effectiveOpacity()},_d=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};md.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,d=t.boundingBox(),p=!0===a?l.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!r||Bn(d,r))){var g=t.isEdge(),f=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,i,p,bd,Td),g&&f||o.drawCachedElementPortion(e,t,u,n,i,p,xd,_d),g&&!f&&(o.drawCachedElementPortion(e,t,c,n,i,p,wd,_d),o.drawCachedElementPortion(e,t,h,n,i,p,Ed,_d)),o.drawElementOverlay(e,t)}},md.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},md.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,n,r)}},md.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,n,r)}},md.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],l=s.bb;0!==l.w&&0!==l.h&&e.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else i.drawCachedElements(e,t,n,r)};var Dd={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,f=u*c,v=u*c,y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f;"straight-triangle"===h?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=g,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")},m=function(){i&&o.drawEdgeOverlay(e,t)},b=function(){i&&o.drawEdgeUnderlay(e,t)},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var E=t.pstyle("ghost-offset-x").pfValue,T=t.pstyle("ghost-offset-y").pfValue,_=t.pstyle("ghost-opacity").value,D=f*_;e.translate(E,T),y(D),x(D),e.translate(-E,-T)}b(),y(),x(),m(),w(),n&&e.translate(l.x1,l.y1)}}},Cd=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Dd.drawEdgeOverlay=Cd("overlay"),Dd.drawEdgeUnderlay=Cd("underlay"),Dd.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"segments":case"haystack":for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1])}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},Dd.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},Dd.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},Dd.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=this,l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){var u="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,h=t.pstyle("width").pfValue,d=t.pstyle("opacity").value;void 0===o&&(o=d);var p=e.globalCompositeOperation;1===o&&"hollow"!==c||(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,u,h,l,r,i,a),e.globalCompositeOperation=p);var g=t.pstyle(n+"-arrow-color").value;s.colorFillStyle(e,g[0],g[1],g[2],o),s.colorStrokeStyle(e,g[0],g[1],g[2],o),s.drawArrowShape(t,e,c,h,l,r,i,a)}}},Dd.drawArrowShape=function(e,t,n,r,i,a,o,s){var l,u=this,c=this.usePaths()&&"triangle-cross"!==i,h=!1,d=t,p={x:a,y:o},g=e.pstyle("arrow-scale").value,f=this.getArrowWidth(r,g),v=u.arrowShapes[i];if(c){var y=u.arrowPathCache=u.arrowPathCache||[],m=gt(i),b=y[m];null!=b?(l=t=b,h=!0):(l=t=new Path2D,y[m]=l)}h||(t.beginPath&&t.beginPath(),c?v.draw(t,1,0,{x:0,y:0},1):v.draw(t,f,s,p,r),t.closePath&&t.closePath()),t=d,c&&(t.translate(a,o),t.rotate(s),t.scale(f,f)),"filled"!==n&&"both"!==n||(c?t.fill(l):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=(v.matchEdgeWidth?r:1)/(c?f:1),t.lineJoin="miter",c?t.stroke(l):t.stroke()),c&&(t.scale(1/f,1/f),t.rotate(-s),t.translate(-a,-o))};var Nd={safeDrawImage:function(e,t,n,r,i,a,o,s,l,u){if(!(i<=0||a<=0||l<=0||u<=0))try{e.drawImage(t,n,r,i,a,o,s,l,u)}catch(c){Nt(c)}},drawInscribedImage:function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),h=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),p=n.width(),g=n.height(),f=2*n.padding(),v=p+("inner"===c(n,"background-width-relative-to","value",r)?0:f),y=g+("inner"===c(n,"background-height-relative-to","value",r)?0:f),m=n._private.rscratch,b="node"===c(n,"background-clip","value",r),x=c(n,"background-image-opacity","value",r)*i,w=c(n,"background-image-smoothing","value",r),E=t.width||t.cachedW,T=t.height||t.cachedH;null!=E&&null!=T||(document.body.appendChild(t),E=t.cachedW=t.width||t.offsetWidth,T=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var _=E,D=T;if("auto"!==c(n,"background-width","value",r)&&(_="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*v:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(D="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==_&&0!==D){if("contain"===h)_*=C=Math.min(v/_,y/D),D*=C;else if("cover"===h){var C;_*=C=Math.max(v/_,y/D),D*=C}var N=s-v/2,A=c(n,"background-position-x","units",r),L=c(n,"background-position-x","pfValue",r);N+="%"===A?(v-_)*L:L;var S=c(n,"background-offset-x","units",r),O=c(n,"background-offset-x","pfValue",r);N+="%"===S?(v-_)*O:O;var I=l-y/2,k=c(n,"background-position-y","units",r),M=c(n,"background-position-y","pfValue",r);I+="%"===k?(y-D)*M:M;var P=c(n,"background-offset-y","units",r),R=c(n,"background-offset-y","pfValue",r);I+="%"===P?(y-D)*R:R,m.pathCache&&(N-=s,I-=l,s=0,l=0);var B=e.globalAlpha;e.globalAlpha=x;var F=a.getImgSmoothing(e),z=!1;if("no"===w&&F?(a.setImgSmoothing(e,!1),z=!0):"yes"!==w||F||(a.setImgSmoothing(e,!0),z=!0),"no-repeat"===d)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y),e.clip())),a.safeDrawImage(e,t,0,0,E,T,N,I,_,D),b&&e.restore();else{var G=e.createPattern(t,d);e.fillStyle=G,a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y),e.translate(N,I),e.fill(),e.translate(-N,-I)}e.globalAlpha=B,z&&a.setImgSmoothing(e,F)}}},Ad={};function Ld(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}Ad.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(xn(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},Ad.drawElementText=function(e,t,n,r,i){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,g=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,g,a),t.isEdge()&&(o.drawText(e,t,"source",g,a),o.drawText(e,t,"target",g,a))):o.drawText(e,t,i,g,a),n&&e.translate(p.x1,p.y1)},Ad.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},Ad.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ad.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ft(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ad.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Ft(a,"labelX",n),c=Ft(a,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);var d,p=n?n+"-":"",g=Ft(a,"labelWidth",n),f=Ft(a,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=v,c+=y,0!==(d=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(d),u=0,c=0),x){case"top":break;case"center":c+=f/2;break;case"bottom":c+=f}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,T=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue;if(w>0||T>0&&E>0){var D=u-_;switch(b){case"left":D-=g;break;case"center":D-=g/2}var C=c-f-_,N=g+2*_,A=f+2*_;if(w>0){var L=e.fillStyle,S=t.pstyle("text-background-color").value;e.fillStyle="rgba("+S[0]+","+S[1]+","+S[2]+","+w*o+")",0===t.pstyle("text-background-shape").strValue.indexOf("round")?Ld(e,D,C,N,A,2):e.fillRect(D,C,N,A),e.fillStyle=L}if(T>0&&E>0){var O=e.strokeStyle,I=e.lineWidth,k=t.pstyle("text-border-color").value,M=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+k[0]+","+k[1]+","+k[2]+","+E*o+")",e.lineWidth=T,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=T/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(D,C,N,A),"double"===M){var P=T/2;e.strokeRect(D+P,C+P,N-2*P,A-2*P)}e.setLineDash&&e.setLineDash([]),e.lineWidth=I,e.strokeStyle=O}}var R=2*t.pstyle("text-outline-width").pfValue;if(R>0&&(e.lineWidth=R),"wrap"===t.pstyle("text-wrap").value){var B=Ft(a,"labelWrapCachedLines",n),F=Ft(a,"labelLineHeight",n),z=g/2,G=this.getLabelJustification(t);switch("auto"===G||("left"===b?"left"===G?u+=-g:"center"===G&&(u+=-z):"center"===b?"left"===G?u+=-z:"right"===G&&(u+=z):"right"===b&&("center"===G?u+=z:"right"===G&&(u+=g))),x){case"top":case"center":case"bottom":c-=(B.length-1)*F}for(var Y=0;Y<B.length;Y++)R>0&&e.strokeText(B[Y],u,c),e.fillText(B[Y],u,c),c+=F}else R>0&&e.strokeText(h,u,c),e.fillText(h,u,c);0!==d&&(e.rotate(-d),e.translate(-s,-l))}}};var Sd={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,h=t.position();if(_(h.x)&&_(h.y)&&(!s||t.visible())){var d,p,g=s?t.effectiveOpacity():1,f=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E<m.length;E++){var T=m[E];if(b[E]=null!=T&&"none"!==T){var D=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);w++,x[E]=l.getCachedImage(T,D,(function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")}))}}var C=t.pstyle("background-blacken").value,N=t.pstyle("border-width").pfValue,A=t.pstyle("background-opacity").value*g,L=t.pstyle("border-color").value,S=t.pstyle("border-style").value,O=t.pstyle("border-opacity").value*g;e.lineJoin="miter";var I=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:A;l.eleFillStyle(e,t,n)},k=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O;l.colorStrokeStyle(e,L[0],L[1],L[2],t)},M=t.pstyle("shape").strValue,P=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(h.x,h.y);var R=l.nodePathCache=l.nodePathCache||[],B=ft("polygon"===M?M+","+P.join(","):M,""+i,""+r),F=R[B];null!=F?(d=F,v=!0,c.pathCache=d):(d=new Path2D,R[B]=c.pathCache=d)}var z=function(){if(!v){var n=h;f&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i)}f?e.fill(d):e.fill()},G=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o<x.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);r&&"over"===s||!r&&"inside"===s?a++:b[o]&&x[o].complete&&!x[o].error&&(a++,l.drawInscribedImage(e,x[o],t,o,n))}u.backgrounding=!(a===w),i!==u.backgrounding&&t.updateStyle(!1)},Y=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(f||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i)))},X=function(){var t=(C>0?C:-C)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:g),n=C>0?0:255;0!==C&&(l.colorFillStyle(e,n,n,n,t),f?e.fill(d):e.fill())},V=function(){if(N>0){if(e.lineWidth=N,e.lineCap="butt",e.setLineDash)switch(S){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(f?e.stroke(d):e.stroke(),"double"===S){e.lineWidth=N/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(d):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},U=function(){o&&l.drawNodeOverlay(e,t,h,r,i)},j=function(){o&&l.drawNodeUnderlay(e,t,h,r,i)},H=function(){l.drawElementText(e,t,null,a)};if("yes"===t.pstyle("ghost").value){var q=t.pstyle("ghost-offset-x").pfValue,W=t.pstyle("ghost-offset-y").pfValue,$=t.pstyle("ghost-opacity").value,K=$*g;e.translate(q,W),I($*A),z(),G(K,!0),k($*O),V(),Y(0!==C||0!==N),G(K,!1),X(K),e.translate(-q,-W)}f&&e.translate(-h.x,-h.y),j(),f&&e.translate(h.x,h.y),I(),z(),G(g,!0),k(),V(),Y(0!==C||0!==N),G(g,!1),X(),f&&e.translate(-h.x,-h.y),H(),U(),n&&e.translate(p.x1,p.y1)}}},Od=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,a){var o=this;if(n.visible()){var s=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,u=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value;if(l>0){if(r=r||n.position(),null==i||null==a){var h=n.padding();i=n.width()+2*h,a=n.height()+2*h}o.colorFillStyle(t,u[0],u[1],u[2],l),o.nodeShapes[c].draw(t,r.x,r.y,i+2*s,a+2*s),t.fill()}}}};Sd.drawNodeOverlay=Od("overlay"),Sd.drawNodeUnderlay=Od("underlay"),Sd.hasPie=function(e){return(e=e[0])._private.hasPie},Sd.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var p=t.pstyle("pie-"+d+"-background-size").value,g=t.pstyle("pie-"+d+"-background-color").value,f=t.pstyle("pie-"+d+"-background-opacity").value*n,v=p/100;v+h>1&&(v=1-h);var y=1.5*Math.PI+2*Math.PI*h,m=y+2*Math.PI*v;0===p||h>=1||h+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],f),e.fill(),h+=v)}};var Id={},kd=100;Id.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Id.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Id.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),h=n.midpoint(),d=En(u,h),p=En(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,p))}else{var g=o?{x:0,y:0}:n.position(),f=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(f,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();a=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.paddedWidth()/2,w=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":a=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":a=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-right":a=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!a)return null;for(var E=l.length===s.length,T=s.length,_=0;_<T;_++)a.addColorStop(E?l[_]:_/(T-1),"rgba("+s[_][0]+","+s[_][1]+","+s[_][2]+","+i+")");return a},Id.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},Id.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},Id.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Id.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},Id.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},Id.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Id.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=i*o,c=a*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var h=n.canvasContainer;h.style.width=i+"px",h.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)(l=n.canvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";for(d=0;d<t.BUFFER_COUNT;d++)(l=n.bufferCanvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},Id.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Id.render=function(e){var t=(e=e||kt()).forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,i=e.forcedZoom,a=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,h=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,p=o.motionBlurPxRatio,g=l.hasCompoundNodes(),f=o.hoverData.draggingEles,v=!(!o.hoverData.selecting&&!o.touchData.selecting),y=d=d&&!t&&o.motionBlurEnabled&&!v;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),d&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},T={zoom:b,pan:{x:w.x,y:w.y}},_=o.prevViewport;void 0===_||T.zoom!==_.zoom||T.pan.x!==_.pan.x||T.pan.y!==_.pan.y||f&&!g||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var D=o.getCachedZSortedEles();function C(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function N(e,r){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,h=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,h=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?C(e,0,0,c,h):t||void 0!==r&&!r||e.clearRect(0,0,c,h),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var A=o.data.bufferContexts[o.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(T=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var L=u.contexts[o.NODE],S=o.textureCache.texture;T=o.textureCache.viewport,L.setTransform(1,0,0,1,0,0),d?C(L,0,0,T.width,T.height):L.clearRect(0,0,T.width,T.height);var O=m.core("outside-texture-bg-color").value,I=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(L,O[0],O[1],O[2],I),L.fillRect(0,0,T.width,T.height),b=l.zoom(),N(L,!1),L.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/s,T.height/T.zoom/s),L.drawImage(S,T.mpan.x,T.mpan.y,T.width/T.zoom/s,T.height/T.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var k=l.extent(),M=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),P=o.hideEdgesOnViewport&&M,R=[];if(R[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,R[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),R[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,R[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||R[o.NODE]){var B=d&&!R[o.NODE]&&1!==p;N(L=t||(B?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),d&&!B?"motionBlur":void 0),P?o.drawCachedNodes(L,D.nondrag,s,k):o.drawLayeredElements(L,D.nondrag,s,k),o.debug&&o.drawDebugPoints(L,D.nondrag),n||d||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||R[o.DRAG])&&(B=d&&!R[o.DRAG]&&1!==p,N(L=t||(B?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),d&&!B?"motionBlur":void 0),P?o.drawCachedNodes(L,D.drag,s,k):o.drawCachedElements(L,D.drag,s,k),o.debug&&o.drawDebugPoints(L,D.drag),n||d||(c[o.DRAG]=!1)),o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(N(L=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var F=m.core("selection-box-border-width").value/b;L.lineWidth=F,L.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",L.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),F>0&&(L.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",L.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var z=u.bgActivePosistion;L.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",L.beginPath(),L.arc(z.x,z.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),L.fill()}var G=o.lastRedrawTime;if(o.showFps&&G){G=Math.round(G);var Y=Math.round(1e3/G);L.setTransform(1,0,0,1,0,0),L.fillStyle="rgba(255, 0, 0, 0.75)",L.strokeStyle="rgba(255, 0, 0, 0.75)",L.lineWidth=1,L.fillText("1 frame = "+G+" ms = "+Y+" fps",0,20);var X=60;L.strokeRect(0,30,250,20),L.fillRect(0,30,250*Math.min(Y/X,1),20)}n||(c[o.SELECT_BOX]=!1)}if(d&&1!==p){var V=u.contexts[o.NODE],U=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],j=u.contexts[o.DRAG],H=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],q=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):C(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||R[o.NODE])&&(q(V,U,R[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||R[o.DRAG])&&(q(j,H,R[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=T,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),kd)),t||l.emit("render")};for(var Md={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2,l=hr(r,i);e.beginPath&&e.beginPath();for(var u=0;u<a.length/4;u++){var c=void 0,h=void 0;c=0===u?a.length-2:4*u-2,h=4*u+2;var d=t+o*a[4*u],p=n+s*a[4*u+1],g=-a[c]*a[h]-a[c+1]*a[h+1],f=l/Math.tan(Math.acos(g)/2),v=d-f*a[c],y=p-f*a[c+1],m=d+f*a[h],b=p+f*a[h+1];0===u?e.moveTo(v,y):e.lineTo(v,y),e.arcTo(d,p,m,b,l)}e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=cr(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+a,n-o,t+a,n,s),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.arcTo(t-a,n-o,t,n-o,s),e.lineTo(t,n-o),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=cr(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+a,n-o),e.lineTo(t+a,n),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.lineTo(t-a,n-o),e.lineTo(t,n-o),e.closePath()},drawCutRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=dr();e.beginPath&&e.beginPath(),e.moveTo(t-a+s,n-o),e.lineTo(t+a-s,n-o),e.lineTo(t+a,n-o+s),e.lineTo(t+a,n+o-s),e.lineTo(t+a-s,n+o),e.lineTo(t-a+s,n+o),e.lineTo(t-a,n+o-s),e.lineTo(t-a,n-o+s),e.closePath()},drawBarrelPath:function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,u=n-o,c=n+o,h=gr(r,i),d=h.widthOffset,p=h.heightOffset,g=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+p),e.lineTo(s,c-p),e.quadraticCurveTo(s+g,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-g,c,l,c-p),e.lineTo(l,u+p),e.quadraticCurveTo(l-g,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+g,u,s,u+p),e.closePath()}},Pd=Math.sin(0),Rd=Math.cos(0),Bd={},Fd={},zd=Math.PI/40,Gd=0*Math.PI;Gd<2*Math.PI;Gd+=zd)Bd[Gd]=Math.sin(Gd),Fd[Gd]=Math.cos(Gd);Md.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=zd)a=t-s*Bd[u]*Pd+s*Fd[u]*Rd,o=n+l*Fd[u]*Pd+l*Bd[u]*Rd,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Yd={};function Xd(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function Vd(e){var t=e.indexOf(",");return e.substr(t+1)}function Ud(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Gi((function(r,i){try{t.toBlob((function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(a){i(a)}}));case"blob":return Xd(Vd(r()),n);case"base64":return Vd(r());default:return r()}}Yd.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Yd.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=_(e.maxWidth)||_(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;_(e.maxWidth)&&(u=l*e.maxWidth/i),_(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var g=t.pan(),f={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(f.x,f.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-f.x,-f.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},Yd.png=function(e){return Ud(e,this.bufferCanvasImage(e),"image/png")},Yd.jpg=function(e){return Ud(e,this.bufferCanvasImage(e),"image/jpeg")};var jd={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},Hd=Wd,qd=Wd.prototype;function Wd(e){var t=this;t.data={canvases:new Array(qd.CANVAS_LAYERS),contexts:new Array(qd.CANVAS_LAYERS),canvasNeedsRedraw:new Array(qd.CANVAS_LAYERS),bufferCanvases:new Array(qd.BUFFER_COUNT),bufferContexts:new Array(qd.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,i.position="relative",i.zIndex="0",i.overflow="hidden";var a=e.cy.container();a.appendChild(t.data.canvasContainer),a.style[n]=r;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};B()&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s<qd.CANVAS_LAYERS;s++){var l=t.data.canvases[s]=document.createElement("canvas");t.data.contexts[s]=l.getContext("2d"),Object.keys(o).forEach((function(e){l.style[e]=o[e]})),l.style.position="absolute",l.setAttribute("data-id","layer"+s),l.style.zIndex=String(qd.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[s]=!1}for(t.data.topCanvas=t.data.canvases[0],t.data.canvases[qd.NODE].setAttribute("data-id","layer"+qd.NODE+"-node"),t.data.canvases[qd.SELECT_BOX].setAttribute("data-id","layer"+qd.SELECT_BOX+"-selectbox"),t.data.canvases[qd.DRAG].setAttribute("data-id","layer"+qd.DRAG+"-drag"),s=0;s<qd.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=document.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var u=Ln(),c=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},h=function(e){return{x:-e.w/2,y:-e.h/2}},d=function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},p=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},f=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},m=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},w=function(e){return e.boundingBox(),e[0]._private.bodyBounds},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||u},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||u},_=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||u},D=function(e,t){return t},C=function(e){return c(w(e))},N=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},L=function(e){return N("",A(e,"labelX","labelY"),e)},S=function(e){return N("source",A(e,"sourceLabelX","sourceLabelY"),e)},O=function(e){return N("target",A(e,"targetLabelX","targetLabelY"),e)},I=function(e){return h(w(e))},k=function(e){return h(T(e))},M=function(e){return h(_(e))},P=function(e){var t=E(e),n=h(E(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w;break;case"right":n.x=0}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h;break;case"bottom":n.y=0}}return n},R=t.data.eleTxrCache=new jh(t,{getKey:p,doesEleInvalidateKey:d,drawElement:y,getBoundingBox:w,getRotationPoint:C,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),F=t.data.lblTxrCache=new jh(t,{getKey:g,drawElement:m,getBoundingBox:E,getRotationPoint:L,getRotationOffset:P,isVisible:D}),z=t.data.slbTxrCache=new jh(t,{getKey:f,drawElement:b,getBoundingBox:T,getRotationPoint:S,getRotationOffset:k,isVisible:D}),G=t.data.tlbTxrCache=new jh(t,{getKey:v,drawElement:x,getBoundingBox:_,getRotationPoint:O,getRotationOffset:M,isVisible:D}),Y=t.data.lyrTxrCache=new sd(t);t.onUpdateEleCalcs((function(e,t){R.invalidateElements(t),F.invalidateElements(t),z.invalidateElements(t),G.invalidateElements(t),Y.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}}));var X=function(e){for(var t=0;t<e.length;t++)Y.enqueueElementRefinement(e[t].ele)};R.onDequeue(X),F.onDequeue(X),z.onDequeue(X),G.onDequeue(X)}qd.CANVAS_LAYERS=3,qd.SELECT_BOX=0,qd.DRAG=1,qd.NODE=2,qd.BUFFER_COUNT=3,qd.TEXTURE_BUFFER=0,qd.MOTIONBLUR_BUFFER_NODE=1,qd.MOTIONBLUR_BUFFER_DRAG=2,qd.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[qd.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[qd.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[qd.SELECT_BOX]=t}};var $d="undefined"!=typeof Path2D;qd.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},qd.usePaths=function(){return $d&&this.pathsEnabled},qd.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},qd.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},qd.makeOffscreenCanvas=function(t,n){var r;return"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":e(OffscreenCanvas))?r=new OffscreenCanvas(t,n):((r=document.createElement("canvas")).width=t,r.height=n),r},[dd,md,Dd,Nd,Ad,Sd,Id,Md,Yd,jd].forEach((function(e){Q(qd,e)}));var Kd=[{type:"layout",extensions:qc},{type:"renderer",extensions:[{name:"null",impl:Wc},{name:"base",impl:xh},{name:"canvas",impl:Hd}]}],Zd={},Qd={};function Jd(e,t,n){var r=n,i=function(n){Nt("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(ac.prototype[t])return i(t);ac.prototype[t]=n}else if("collection"===e){if(bu.prototype[t])return i(t);bu.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),E(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};Q(o,{createEmitter:function(){return this._private.emitter=new Rl(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),hs.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var p=ep("renderer","base"),g=p.prototype,f=n,v=n.prototype,y=function(){p.apply(this,arguments),f.apply(this,arguments)},m=y.prototype;for(var b in g){var x=g[b];if(null!=v[b])return i(b);m[b]=x}for(var w in v)m[w]=v[w];g.clientFunctions.forEach((function(e){m[e]=m[e]||function(){Dt("Renderer does not implement `renderer."+e+"()` on its prototype")}})),r=y}else if("__proto__"===e||"constructor"===e||"prototype"===e)return Dt(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return ae({map:Zd,keys:[e,t],value:r})}function ep(e,t){return oe({map:Zd,keys:[e,t]})}function tp(e,t,n,r,i){return ae({map:Qd,keys:[e,t,n,r],value:i})}function np(e,t,n,r){return oe({map:Qd,keys:[e,t,n,r]})}var rp=function(){return 2===arguments.length?ep.apply(null,arguments):3===arguments.length?Jd.apply(null,arguments):4===arguments.length?np.apply(null,arguments):5===arguments.length?tp.apply(null,arguments):void Dt("Invalid extension access syntax")};ac.prototype.extension=rp,Kd.forEach((function(e){e.extensions.forEach((function(t){Jd(e.type,t.name,t.impl)}))}));var ip=function e(){if(!(this instanceof e))return new e;this.length=0},ap=ip.prototype;ap.instanceString=function(){return"stylesheet"},ap.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},ap.css=function(e,t){var n=this.length-1;if(b(e))this[n].properties.push({name:e,value:t});else if(E(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var l=Ju.properties[o]||Ju.properties[G(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},ap.style=ap.css,ap.generateStyle=function(e){var t=new Ju(e);return this.appendToStyle(t)},ap.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var op="3.25.0",sp=function(e){return void 0===e&&(e={}),E(e)?new ac(e):b(e)?rp.apply(rp,arguments):void 0};return sp.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(sp),e.apply(null,t),this},sp.warnings=function(e){return Ct(e)},sp.version=op,sp.stylesheet=sp.Stylesheet=ip,sp}()},54899:function(e){var t;t=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=26)}([function(e,t,n){"use strict";function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw"Node is not incident with this edge"},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){this.vGraphObject=e}},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),l=n(4);function u(e,t,n,o){null==n&&null==o&&(o=t),r.call(this,o),null!=e.graphManager&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,this.rect=null!=n&&null!=t?new a(t.x,t.y,n.width,n.height):new a}for(var c in u.prototype=Object.create(r.prototype),r)u[c]=r[c];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(e){this.rect.width=e},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(e){this.rect.height=e},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},u.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},u.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},u.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},u.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach((function(r){if(r.target==e){if(r.source!=n)throw"Incorrect edge source!";t.push(r)}})),t},u.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach((function(r){if(r.source!=n&&r.target!=n)throw"Incorrect edge source and/or target";r.target!=e&&r.source!=e||t.push(r)})),t},u.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach((function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw"Incorrect incidency!";e.add(n.source)}})),e},u.prototype.withChildren=function(){var e=new Set;if(e.add(this),null!=this.child)for(var t=this.child.getNodes(),n=0;n<t.length;n++)t[n].withChildren().forEach((function(t){e.add(t)}));return e},u.prototype.getNoOfChildren=function(){var e=0;if(null==this.child)e=1;else for(var t=this.child.getNodes(),n=0;n<t.length;n++)e+=t[n].getNoOfChildren();return 0==e&&(e=1),e},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},u.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},u.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth>t&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-n)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=u},function(e,t,n){"use strict";function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),l=n(1),u=n(13),c=n(12),h=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in d.prototype=Object.create(r.prototype),r)d[p]=r[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){var r=e;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i)},d.prototype.remove=function(e){var t=e;if(e instanceof s){if(null==t)throw"Node is null!";if(null==t.owner||t.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=t.edges.slice(),r=n.length,i=0;i<r;i++)(a=n[i]).isInterGraph?this.graphManager.remove(a):a.source.owner.remove(a);if(-1==(o=this.nodes.indexOf(t)))throw"Node not in owner node list!";this.nodes.splice(o,1)}else if(e instanceof l){var a;if(null==(a=e))throw"Edge is null!";if(null==a.source||null==a.target)throw"Source and/or target is null!";if(null==a.source.owner||null==a.target.owner||a.source.owner!=this||a.target.owner!=this)throw"Source and/or target owner is invalid!";var o,u=a.source.edges.indexOf(a),c=a.target.edges.indexOf(a);if(!(u>-1&&c>-1))throw"Source and/or target doesn't know this edge!";if(a.source.edges.splice(u,1),a.target!=a.source&&a.target.edges.splice(c,1),-1==(o=a.source.owner.getEdges().indexOf(a)))throw"Not in owner's edge list!";a.source.owner.getEdges().splice(o,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l<s;l++){var u=o[l];r>(e=u.getTop())&&(r=e),a>(t=u.getLeft())&&(a=t)}return r==i.MAX_VALUE?null:(n=null!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;g<p;g++){var f=d[g];e&&null!=f.child&&f.updateBounds(),s>(t=f.getLeft())&&(s=t),l<(n=f.getRight())&&(l=n),c>(r=f.getTop())&&(c=r),h<(a=f.getBottom())&&(h=a)}var v=new u(s,c,l-s,h-c);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=null!=d[0].getParent().paddingLeft?d[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},d.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,c=-i.MAX_VALUE,h=e.length,d=0;d<h;d++){var p=e[d];o>(t=p.getLeft())&&(o=t),s<(n=p.getRight())&&(s=n),l>(r=p.getTop())&&(l=r),c<(a=p.getBottom())&&(c=a)}return new u(o,l,s-o,c-l)},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++)e+=t[r].calcEstimatedSize();return this.estimatedSize=0==e?a.EMPTY_COMPOUND_NODE_SIZE:e/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var e=this;if(0!=this.nodes.length){var t,n,r=new h,i=new Set,a=this.nodes[0];for(a.withChildren().forEach((function(e){r.push(e),i.add(e)}));0!==r.length;)for(var o=(t=(a=r.shift()).getEdges()).length,s=0;s<o;s++)null==(n=t[s].getOtherEndInGraph(a,this))||i.has(n)||n.withChildren().forEach((function(e){r.push(e),i.add(e)}));if(this.isConnected=!1,i.size>=this.nodes.length){var l=0;i.forEach((function(t){t.owner==e&&l++})),l==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},e.exports=d},function(e,t,n){"use strict";var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,n=e;var a=(r=t).getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(t!=this.rootGraph&&(null==t.parent||t.parent.graphManager!=this))throw"Invalid parent node!";for(var n,a=[],o=(a=a.concat(t.getEdges())).length,s=0;s<o;s++)n=a[s],t.remove(n);var l,u=[];for(o=(u=u.concat(t.getNodes())).length,s=0;s<o;s++)l=u[s],t.remove(l);t==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(t);this.graphs.splice(c,1),t.parent=null}else if(e instanceof i){if(null==(n=e))throw"Edge is null!";if(!n.isInterGraph)throw"Not an inter-graph edge!";if(null==n.source||null==n.target)throw"Source and/or target is null!";if(-1==n.source.edges.indexOf(n)||-1==n.target.edges.indexOf(n))throw"Source and/or target doesn't know this edge!";if(c=n.source.edges.indexOf(n),n.source.edges.splice(c,1),c=n.target.edges.indexOf(n),n.target.edges.splice(c,1),null==n.source.owner||null==n.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==n.source.owner.getGraphManager().edges.indexOf(n))throw"Not in owner graph manager's edge list!";c=n.source.owner.getGraphManager().edges.indexOf(n),n.source.owner.getGraphManager().edges.splice(c,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(null==this.allNodes){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(null==this.allEdges){for(var e=[],t=this.getGraphs(),n=(t.length,0);n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=e,null==e.parent&&(e.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(null==e||null==t)throw"assert failed";if(e==t)return!0;for(var n,r=e.getOwner();null!=(n=r.getParent());){if(n==t)return!0;if(null==(r=n.getOwner()))break}for(r=t.getOwner();null!=(n=r.getParent());){if(n==e)return!0;if(null==(r=n.getOwner()))break}return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++)if(t=(e=a[s]).source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t!=n){for(r=t.getOwner();null==e.lca;){for(e.targetInLca=n,i=n.getOwner();null==e.lca;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(null!=e.lca)throw"assert failed";e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;null==e.lca&&(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(null==e.lca)throw"assert failed"}else e.lca=t.getOwner()},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();for(var n=e.getOwner();null!=n;){for(var r=t.getOwner();null!=r;){if(r==n)return r;r=r.getParent().getOwner()}n=n.getParent().getOwner()}return n},a.prototype.calcInclusionTreeDepths=function(e,t){var n;null==e&&null==t&&(e=this.rootGraph,t=1);for(var r=e.getNodes(),i=r.length,a=0;a<i;a++)(n=r[a]).inclusionTreeDepth=t,null!=n.child&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=this.edges.length,n=0;n<t;n++)if(e=this.edges[n],this.isOneAncestorOfOther(e.source,e.target))return!0;return!1},e.exports=a},function(e,t,n){"use strict";var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=3*i.MAX_NODE_DISPLACEMENT_INCREMENTAL,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i},function(e,t,n){"use strict";var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw"assert failed";var i=new Array(2);this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),l=e.getY(),u=e.getRight(),c=e.getX(),h=e.getBottom(),d=e.getRight(),p=e.getWidthHalf(),g=e.getHeightHalf(),f=t.getX(),v=t.getY(),y=t.getRight(),m=t.getX(),b=t.getBottom(),x=t.getRight(),w=t.getWidthHalf(),E=t.getHeightHalf(),T=!1,_=!1;if(r===a){if(i>o)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(i<o)return n[0]=r,n[1]=h,n[2]=a,n[3]=v,!1}else if(i===o){if(r>a)return n[0]=s,n[1]=i,n[2]=y,n[3]=o,!1;if(r<a)return n[0]=u,n[1]=i,n[2]=f,n[3]=o,!1}else{var D=e.height/e.width,C=t.height/t.width,N=(o-i)/(a-r),A=void 0,L=void 0,S=void 0,O=void 0,I=void 0,k=void 0;if(-D===N?r>a?(n[0]=c,n[1]=h,T=!0):(n[0]=u,n[1]=l,T=!0):D===N&&(r>a?(n[0]=s,n[1]=l,T=!0):(n[0]=d,n[1]=h,T=!0)),-C===N?a>r?(n[2]=m,n[3]=b,_=!0):(n[2]=y,n[3]=v,_=!0):C===N&&(a>r?(n[2]=f,n[3]=v,_=!0):(n[2]=x,n[3]=b,_=!0)),T&&_)return!1;if(r>a?i>o?(A=this.getCardinalDirection(D,N,4),L=this.getCardinalDirection(C,N,2)):(A=this.getCardinalDirection(-D,N,3),L=this.getCardinalDirection(-C,N,1)):i>o?(A=this.getCardinalDirection(-D,N,1),L=this.getCardinalDirection(-C,N,3)):(A=this.getCardinalDirection(D,N,2),L=this.getCardinalDirection(C,N,4)),!T)switch(A){case 1:O=l,S=r+-g/N,n[0]=S,n[1]=O;break;case 2:S=d,O=i+p*N,n[0]=S,n[1]=O;break;case 3:O=h,S=r+g/N,n[0]=S,n[1]=O;break;case 4:S=c,O=i+-p*N,n[0]=S,n[1]=O}if(!_)switch(L){case 1:k=v,I=a+-E/N,n[2]=I,n[3]=k;break;case 2:I=x,k=o+w*N,n[2]=I,n[3]=k;break;case 3:k=b,I=a+E/N,n[2]=I,n[3]=k;break;case 4:I=m,k=o+-w*N,n[2]=I,n[3]=k}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a,o,s,l,u,c,h,d=e.x,p=e.y,g=t.x,f=t.y,v=n.x,y=n.y,m=i.x,b=i.y;return 0==(h=(a=f-p)*(l=v-m)-(o=b-y)*(s=d-g))?null:new r((s*(c=m*y-v*b)-l*(u=g*p-d*f))/h,(o*u-a*c)/h)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)):i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI,i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,l=n.x,u=n.y,c=r.x,h=r.y,d=(o-i)*(h-u)-(c-l)*(s-a);if(0===d)return!1;var p=((h-u)*(c-i)+(l-c)*(h-a))/d,g=((a-s)*(c-i)+(o-i)*(h-a))/d;return 0<p&&p<1&&0<g&&g<1},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i},function(e,t,n){"use strict";function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){"use strict";function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){return{value:e,next:null,prev:null}},a=function(e,t,n,r){return null!==e?e.next=t:r.head=t,null!==n?n.prev=t:r.tail=t,t.prev=e,t.next=n,r.length++,t},o=function(e,t){var n=e.prev,r=e.next;return null!==n?n.next=r:t.head=r,null!==r?r.prev=n:t.tail=n,e.prev=e.next=null,t.length--,e},s=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.length=0,this.head=null,this.tail=null,null!=t&&t.forEach((function(e){return n.push(e)}))}return r(e,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(e,t){return a(t.prev,i(e),t,this)}},{key:"insertAfter",value:function(e,t){return a(t,i(e),t.next,this)}},{key:"insertNodeBefore",value:function(e,t){return a(t.prev,e,t,this)}},{key:"insertNodeAfter",value:function(e,t){return a(t,e,t.next,this)}},{key:"push",value:function(e){return a(this.tail,i(e),null,this)}},{key:"unshift",value:function(e){return a(null,i(e),this.head,this)}},{key:"remove",value:function(e){return o(e,this)}},{key:"pop",value:function(){return o(this.tail,this).value}},{key:"popNode",value:function(){return o(this.tail,this)}},{key:"shift",value:function(){return o(this.head,this).value}},{key:"shiftNode",value:function(){return o(this.head,this)}},{key:"get_object_at",value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:"set_object_at",value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}();e.exports=s},function(e,t,n){"use strict";function r(e,t,n){this.x=null,this.y=null,null==e&&null==t&&null==n?(this.x=0,this.y=0):"number"==typeof e&&"number"==typeof t&&null==n?(this.x=e,this.y=t):"Point"==e.constructor.name&&null==t&&null==n&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){"Point"==e.constructor.name&&null==t&&null==n?(n=e,this.setLocation(n.x,n.y)):"number"==typeof e&&"number"==typeof t&&null==n&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){if("Point"==e.constructor.name){var t=e;return this.x==t.x&&this.y==t.y}return this==e},r.prototype.toString=function(){return(new r).constructor.name+"[x="+this.x+",y="+this.y+"]"},e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=e&&null!=t&&null!=n&&null!=r&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:(null!=e.uniqueID||(e.uniqueID=i.getString(),i.lastID++),e.uniqueID)},i.getString=function(e){return null==e&&(e=i.lastID),"Object#"+e},i.isPrimitive=function(e){var t=void 0===e?"undefined":r(e);return null==e||"object"!=t&&"function"!=t},e.exports=i},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(0),a=n(6),o=n(3),s=n(1),l=n(5),u=n(4),c=n(17),h=n(27);function d(e){h.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=e&&(this.isRemoteUse=e)}d.RANDOM_SEED=1,d.prototype=Object.create(h.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},d.prototype.newGraph=function(e){return new l(null,this.graphManager,e)},d.prototype.newNode=function(e){return new o(this.graphManager,e)},d.prototype.newEdge=function(e){return new s(null,null,e)},d.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){var e;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),e=!this.checkLayoutSuccess()&&this.layout(),"during"!==i.ANIMATE&&(e&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];var n=this.graphManager.getRoot().getNodes();for(t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},d.prototype.update=function(e){if(null==e)this.update2();else if(e instanceof o){var t=e;if(null!=t.getChild())for(var n=t.getChild().getNodes(),r=0;r<n.length;r++)update(n[r]);null!=t.vGraphObject&&t.vGraphObject.update(t)}else if(e instanceof s){var i=e;null!=i.vGraphObject&&i.vGraphObject.update(i)}else if(e instanceof l){var a=e;null!=a.vGraphObject&&a.vGraphObject.update(a)}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(e){if(null==e)this.transform(new u(0,0));else{var t=new c,n=this.graphManager.getRoot().updateLeftTop();if(null!=n){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i=0;i<r.length;i++)r[i].transform(t)}}},d.prototype.positionNodesRandomly=function(e){if(null==e)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)null==(n=(t=r[i]).getChild())||0==n.getNodes().length?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},d.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)null!=n[a].getChild()&&(i=!1);if(!i)return e;var o=new Set,s=[],l=new Map,u=[];for(u=u.concat(n);u.length>0&&t;){for(s.push(u[0]);s.length>0&&t;){var c=s[0];s.splice(0,1),o.add(c);var h=c.getEdges();for(a=0;a<h.length;a++){var d=h[a].getOtherEnd(c);if(l.get(c)!=d){if(o.has(d)){t=!1;break}s.push(d),l.set(d,c)}}}if(t){var p=[].concat(r(o));for(e.push(p),a=0;a<p.length;a++){var g=p[a],f=u.indexOf(g);f>-1&&u.splice(f,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}return o=this.newEdge(null),this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},d.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys())).concat(e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new u(o.getCenterX(),o.getCenterY()),l=n.bendpoints.get(a);l.x=s.x,l.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},d.transform=function(e,t,n,r){if(null!=n&&null!=r){var i=t;return e<=50?i-=(t-t/n)/50*(50-e):i+=(t*r-t)/50*(e-50),i}var a,o;return e<=50?(a=9*t/500,o=t/10):(a=9*t/50,o=-8*t),a*e+o},d.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;1!=t.length&&2!=t.length||(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=(c=t[o]).getNeighborsList().size;r.set(c,c.getNeighborsList().size),1==s&&n.push(c)}var l=[];for(l=l.concat(n);!i;){var u=[];for(u=u.concat(l),l=[],o=0;o<t.length;o++){var c=t[o],h=t.indexOf(c);h>=0&&t.splice(h,1),c.getNeighborsList().forEach((function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;1==t&&l.push(e),r.set(e,t)}}))}n=n.concat(l),1!=t.length&&2!=t.length||(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d},function(e,t,n){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){"use strict";var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i},function(e,t,n){"use strict";var r=n(15),i=n(7),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=i.DEFAULT_EDGE_LENGTH,this.springConstant=i.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=i.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l=this.getGraphManager().getAllEdges(),u=0;u<l.length;u++)(e=l[u]).idealLength=this.idealEdgeLength,e.isInterGraph&&(n=e.getSource(),r=e.getTarget(),o=e.getSourceInLca().getEstimatedSize(),s=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=o+s-2*a.SIMPLE_NODE_SIZE),t=e.getLca().getInclusionTreeDepth(),e.idealLength+=i.DEFAULT_EDGE_LENGTH*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(n.getInclusionTreeDepth()+r.getInclusionTreeDepth()-2*t))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n<t.length;n++)e=t[n],this.calcSpringForce(e,e.idealLength)},l.prototype.calcRepulsionForces=function(){var e,t,n,r,a,o=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e<l.length;e++)n=l[e],this.calculateRepulsionForceOfANode(n,a,o,s),a.add(n);else for(e=0;e<l.length;e++)for(n=l[e],t=e+1;t<l.length;t++)r=l[t],n.getOwner()==r.getOwner()&&this.calcRepulsionForce(n,r)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t=0;t<e.length;t++)e[t].move()},l.prototype.calcSpringForce=function(e,t){var n,r,i,a,o=e.getSource(),s=e.getTarget();if(this.uniformLeafNodeSizes&&null==o.getChild()&&null==s.getChild())e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;0!=(n=e.getLength())&&(i=(r=this.springConstant*(n-t))*(e.lengthX/n),a=r*(e.lengthY/n),o.springForceX+=i,o.springForceY+=a,s.springForceX-=i,s.springForceY-=a)},l.prototype.calcRepulsionForce=function(e,t){var n,r,a,l,u,c,h,d=e.getRect(),p=t.getRect(),g=new Array(2),f=new Array(4);if(d.intersects(p)){o.calcSeparationAmount(d,p,g,i.DEFAULT_EDGE_LENGTH/2),c=2*g[0],h=2*g[1];var v=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=v*c,e.repulsionForceY-=v*h,t.repulsionForceX+=v*c,t.repulsionForceY+=v*h}else this.uniformLeafNodeSizes&&null==e.getChild()&&null==t.getChild()?(n=p.getCenterX()-d.getCenterX(),r=p.getCenterY()-d.getCenterY()):(o.getIntersection(d,p,f),n=f[2]-f[0],r=f[3]-f[1]),Math.abs(n)<i.MIN_REPULSION_DIST&&(n=s.sign(n)*i.MIN_REPULSION_DIST),Math.abs(r)<i.MIN_REPULSION_DIST&&(r=s.sign(r)*i.MIN_REPULSION_DIST),a=n*n+r*r,l=Math.sqrt(a),c=(u=this.repulsionConstant*e.noOfChildren*t.noOfChildren/a)*n/l,h=u*r/l,e.repulsionForceX-=c,e.repulsionForceY-=h,t.repulsionForceX+=c,t.repulsionForceY+=h},l.prototype.calcGravitationalForce=function(e){var t,n,r,i,a,o,s,l;n=((t=e.getOwner()).getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,e.getOwner()==this.graphManager.getRoot()?(o>(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)(e=t[n]).noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t,n;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=new Array(t),i=0;i<t;i++)r[i]=new Array(n);for(i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=new Array;return r},l.prototype.addNodeToGrid=function(e,t,n){var r,i,a,o;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var l=a;l<=o;l++)this.grid[s][l].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),e=0;e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,r){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&n||r){var a,o=new Set;e.surrounding=new Array;for(var s=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var u=e.startY-1;u<e.finishY+2;u++)if(!(l<0||u<0||l>=s.length||u>=s[0].length))for(var c=0;c<s[l][u].length;c++)if(a=s[l][u][c],e.getOwner()==a.getOwner()&&e!=a&&!t.has(a)&&!o.has(a)){var h=Math.abs(e.getCenterX()-a.getCenterX())-(e.getWidth()/2+a.getWidth()/2),d=Math.abs(e.getCenterY()-a.getCenterY())-(e.getHeight()/2+a.getHeight()/2);h<=this.repulsionRange&&d<=this.repulsionRange&&o.add(a)}e.surrounding=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l},function(e,t,n){"use strict";var r=n(1),i=n(7);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a},function(e,t,n){"use strict";var r=n(3);function i(e,t,n,i){r.call(this,e,t,n,i),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];i.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=i},function(e,t,n){"use strict";function r(e,t){this.width=0,this.height=0,null!==e&&null!==t&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r},function(e,t,n){"use strict";var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),null!=this.map[e]},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i},function(e,t,n){"use strict";var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return 0===this.size()},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(11),a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),null===n&&void 0===n||(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof i?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:"_quicksort",value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:"_partition",value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(!(i<a))return a;this._swap(e,i,a),i++,a--}}},{key:"_get",value:function(e,t){return e instanceof i?e.get_object_at(t):e[t]}},{key:"_set",value:function(e,t,n){e instanceof i?e.set_object_at(t,n):e[t]=n}},{key:"_swap",value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:"_defaultCompareFunction",value:function(e,t){return t>e}}]),e}();e.exports=a},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=i,this.gap_penalty=a,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var o=0;o<this.iMax;o++){this.grid[o]=new Array(this.jMax);for(var s=0;s<this.jMax;s++)this.grid[o][s]=0}this.tracebackGrid=new Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=new Array(this.jMax);for(var u=0;u<this.jMax;u++)this.tracebackGrid[l][u]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=[this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty,this.grid[n-1][r]+this.gap_penalty,this.grid[n][r-1]+this.gap_penalty],a=this.arrayAllMaxIndexes(i);this.grid[n][r]=i[a[0]],this.tracebackGrid[n][r]=[a.includes(0),a.includes(1),a.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:"-"+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:"-"+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),0===t.pos[0]&&0===t.pos[1]&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:"getAllIndexes",value:function(e,t){for(var n=[],r=-1;-1!==(r=e.indexOf(t,r+1));)n.push(r);return n}},{key:"arrayAllMaxIndexes",value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}();e.exports=i},function(e,t,n){"use strict";var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(7),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(4),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(24),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(5),r.LEdge=n(1),r.LGraphManager=n(6),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(25),e.exports=r},function(e,t,n){"use strict";function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r}])},e.exports=t()},37735:(e,t,n)=>{"use strict";n.d(t,{diagram:()=>S});var r=n(90829),i=n(5949),a=n(14413),o=n.n(a),s=n(35302),l=n.n(s),u=n(75627),c=n(36304),h=n(54628),d=(n(27693),n(7608),n(31699),n(86161),n(88472),n(76576),n(77567),n(57635),n(69746),n(79580),function(){var e=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},t=[1,4],n=[1,13],r=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],l=[6,7,8],u=[1,26],c=[1,24],h=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],g=[1,33],f=[1,34],v=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace("Stop NL ");break;case 9:r.getLogger().trace("Stop EOF ");break;case 11:r.getLogger().trace("Stop NL2 ");break;case 12:r.getLogger().trace("Stop EOF2 ");break;case 15:r.getLogger().info("Node: ",a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace("Icon: ",a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace("SPACELIST");break;case 19:r.getLogger().trace("Node: ",a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace("node found ..",a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace("node found ..",a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])}}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:u,7:c,10:23,11:h},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:c,10:32,11:h},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(p,[2,14],{7:g,11:f}),e(v,[2,8]),e(v,[2,9]),e(v,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:g,11:f}),e(v,[2,11]),e(v,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(e,t){if(!t.recoverable){var n=new Error(e);throw n.hash=t,n}this.trace(e)},parse:function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",l=0,u=0,c=a.slice.call(arguments,1),h=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);h.setInput(e,d.yy),d.yy.lexer=h,d.yy.parser=this,void 0===h.yylloc&&(h.yylloc={});var g=h.yylloc;a.push(g);var f=h.options&&h.options.ranges;"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var v,y,m,b,x,w,E,T,_,D={};;){if(y=n[n.length-1],this.defaultActions[y]?m=this.defaultActions[y]:(null==v&&(_=void 0,"number"!=typeof(_=r.pop()||h.lex()||1)&&(_ instanceof Array&&(_=(r=_).pop()),_=t.symbols_[_]||_),v=_),m=o[y]&&o[y][v]),void 0===m||!m.length||!m[0]){var C="";for(x in T=[],o[y])this.terminals_[x]&&x>2&&T.push("'"+this.terminals_[x]+"'");C=h.showPosition?"Parse error on line "+(l+1)+":\n"+h.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(C,{text:h.match,token:this.terminals_[v]||v,line:h.yylineno,loc:g,expected:T})}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+y+", token: "+v);switch(m[0]){case 1:n.push(v),i.push(h.yytext),a.push(h.yylloc),n.push(m[1]),v=null,u=h.yyleng,s=h.yytext,l=h.yylineno,g=h.yylloc;break;case 2:if(w=this.productions_[m[1]][1],D.$=i[i.length-w],D._$={first_line:a[a.length-(w||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(w||1)].first_column,last_column:a[a.length-1].last_column},f&&(D._$.range=[a[a.length-(w||1)].range[0],a[a.length-1].range[1]]),void 0!==(b=this.performAction.apply(D,[s,u,l,d.yy,m[1],i,a].concat(c))))return b;w&&(n=n.slice(0,-1*w*2),i=i.slice(0,-1*w),a=a.slice(0,-1*w)),n.push(this.productions_[m[1]][0]),i.push(D.$),a.push(D._$),E=o[n[n.length-2]][n[n.length-1]],n.push(E);break;case 3:return!0}}return!0}},m={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(n,i[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[r]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:e.getLogger().trace("Found comment",t.yytext);break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:case 23:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:case 15:case 16:case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 22:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 24:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 25:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 26:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 27:case 30:case 31:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 28:case 29:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 32:case 33:return e.getLogger().trace("Long description:",t.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\-\)\{\}]+)/i,/^(?:$)/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR:{rules:[22,23],inclusive:!1},NODE:{rules:[21,24,25,26,27,28,29,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};function b(){this.yy={}}return y.lexer=m,b.prototype=y,y.Parser=b,new b}());d.parser=d;const p=d,g=e=>(0,r.n)(e,(0,r.g)());let f=[],v=0,y={};const m={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},b=(e,t)=>{y[e]=t},x=e=>{switch(e){case m.DEFAULT:return"no-border";case m.RECT:return"rect";case m.ROUNDED_RECT:return"rounded-rect";case m.CIRCLE:return"circle";case m.CLOUD:return"cloud";case m.BANG:return"bang";case m.HEXAGON:return"hexgon";default:return"no-border"}};let w;const E=e=>y[e],T=Object.freeze(Object.defineProperty({__proto__:null,addNode:(e,t,n,i)=>{r.l.info("addNode",e,t,n,i);const a=(0,r.g)(),o={id:v++,nodeId:g(t),level:e,descr:g(n),type:i,children:[],width:(0,r.g)().mindmap.maxNodeWidth};switch(o.type){case m.ROUNDED_RECT:case m.RECT:case m.HEXAGON:o.padding=2*a.mindmap.padding;break;default:o.padding=a.mindmap.padding}const s=function(e){for(let t=f.length-1;t>=0;t--)if(f[t].level<e)return f[t];return null}(e);if(s)s.children.push(o),f.push(o);else{if(0!==f.length){let e=new Error('There can be only one root. No parent could be found for ("'+o.descr+'")');throw e.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},e}f.push(o)}},clear:()=>{f=[],v=0,y={}},decorateNode:e=>{const t=f[f.length-1];e&&e.icon&&(t.icon=g(e.icon)),e&&e.class&&(t.class=g(e.class))},getElementById:E,getLogger:()=>r.l,getMindmap:()=>f.length>0?f[0]:null,getNodeById:e=>f[e],getType:(e,t)=>{switch(r.l.debug("In get type",e,t),e){case"[":return m.RECT;case"(":return")"===t?m.ROUNDED_RECT:m.CLOUD;case"((":return m.CIRCLE;case")":return m.CLOUD;case"))":return m.BANG;case"{{":return m.HEXAGON;default:return m.DEFAULT}},nodeType:m,get parseError(){return w},sanitizeText:g,setElementForId:b,setErrorHandler:e=>{w=e},type2Str:x},Symbol.toStringTag,{value:"Module"}));function _(e,t){e.each((function(){var e,n=(0,i.Ys)(this),r=n.text().split(/(\s+|<br>)/).reverse(),a=[],o=n.attr("y"),s=parseFloat(n.attr("dy")),l=n.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em");for(let i=0;i<r.length;i++)e=r[r.length-1-i],a.push(e),l.text(a.join(" ").trim()),(l.node().getComputedTextLength()>t||"<br>"===e)&&(a.pop(),l.text(a.join(" ").trim()),a="<br>"===e?[""]:[e],l=n.append("tspan").attr("x",0).attr("y",o).attr("dy","1.1em").text(e))}))}const D=function(e,t,n,r){const i=n%11,a=e.append("g");t.section=i;let o="section-"+i;i<0&&(o+=" section-root"),a.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+o);const s=a.append("g"),l=a.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(_,t.width).node().getBBox(),c=r.fontSize.replace?r.fontSize.replace("px",""):r.fontSize;if(t.height=u.height+1.1*c*.5+t.padding,t.width=u.width+2*t.padding,t.icon)if(t.type===m.CIRCLE){t.height+=50,t.width+=50;a.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const n=Math.abs(t.height-e);a.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+n/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+(25+t.width/2)+", "+(n/2+t.padding/2)+")")}else l.attr("transform","translate("+t.width/2+", "+t.padding/2+")");switch(t.type){case m.DEFAULT:!function(e,t,n){e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("d",`M0 ${t.height-5} v${10-t.height} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)}(s,t,i);break;case m.ROUNDED_RECT:!function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)}(s,t);break;case m.RECT:!function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("height",t.height).attr("width",t.width)}(s,t);break;case m.CIRCLE:s.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("r",t.width/2)}(s,t);break;case m.CLOUD:!function(e,t){const n=t.width,r=t.height,i=.15*n,a=.25*n,o=.35*n,s=.2*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${.25*n},${-1*n*.1}\n a${o},${o} 1 0,1 ${.4*n},${-1*n*.1}\n a${a},${a} 1 0,1 ${.35*n},${1*n*.2}\n\n a${i},${i} 1 0,1 ${.15*n},${1*r*.35}\n a${s},${s} 1 0,1 ${-1*n*.15},${1*r*.65}\n\n a${a},${i} 1 0,1 ${-1*n*.25},${.15*n}\n a${o},${o} 1 0,1 ${-1*n*.5},0\n a${i},${i} 1 0,1 ${-1*n*.25},${-1*n*.15}\n\n a${i},${i} 1 0,1 ${-1*n*.1},${-1*r*.35}\n a${s},${s} 1 0,1 ${.1*n},${-1*r*.65}\n\n H0 V0 Z`)}(s,t);break;case m.BANG:!function(e,t){const n=t.width,r=t.height,i=.15*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+x(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${.25*n},${-1*r*.1}\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},${1*r*.1}\n\n a${i},${i} 1 0,0 ${.15*n},${1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${1*r*.34}\n a${i},${i} 1 0,0 ${-1*n*.15},${1*r*.33}\n\n a${i},${i} 1 0,0 ${-1*n*.25},${.15*r}\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},${-1*r*.15}\n\n a${i},${i} 1 0,0 ${-1*n*.1},${-1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${-1*r*.34}\n a${i},${i} 1 0,0 ${.1*n},${-1*r*.33}\n\n H0 V0 Z`)}(s,t);break;case m.HEXAGON:!function(e,t){const n=t.height,r=n/4,i=t.width-t.padding+2*r;!function(e,t,n,r,i){e.insert("polygon",":first-child").attr("points",r.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}(e,i,n,[{x:r,y:0},{x:i-r,y:0},{x:i,y:-n/2},{x:i-r,y:-n},{x:r,y:-n},{x:0,y:-n/2}],t)}(s,t)}return b(t.id,a),t.height},C=function(e){const t=E(e.id),n=e.x||0,r=e.y||0;t.attr("transform","translate("+n+","+r+")")};function N(e,t,n,r){D(e,t,n,r),t.children&&t.children.forEach(((t,i)=>{N(e,t,n<0?i:n,r)}))}function A(e,t,n,r){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach((i=>{A(i,t,n,r+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})}))}function L(e,t){return new Promise((n=>{const a=(0,i.Ys)("body").append("div").attr("id","cy").attr("style","display:none"),s=o()({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),A(e,s,t,0),s.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}})),s.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),s.ready((e=>{r.l.info("Ready",e),n(s)}))}))}o().use(l());const S={db:T,renderer:{draw:async(e,t,n,a)=>{const o=(0,r.g)();a.db.clear(),a.parser.parse(e),r.l.debug("Renering info diagram\n"+e);const s=(0,r.g)().securityLevel;let l;"sandbox"===s&&(l=(0,i.Ys)("#i"+t));const u=("sandbox"===s?(0,i.Ys)(l.nodes()[0].contentDocument.body):(0,i.Ys)("body")).select("#"+t);u.append("g");const c=a.db.getMindmap(),h=u.append("g");h.attr("class","mindmap-edges");const d=u.append("g");d.attr("class","mindmap-nodes"),N(d,c,-1,o);const p=await L(c,o);!function(e,t){t.edges().map(((t,n)=>{const i=t.data();if(t[0]._private.bodyBounds){const a=t[0]._private.rscratch;r.l.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}}))}(h,p),function(e){e.nodes().map(((e,t)=>{const n=e.data();n.x=e.position().x,n.y=e.position().y,C(n);const i=E(n.nodeId);r.l.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",n),i.attr("transform",`translate(${e.position().x-n.width/2}, ${e.position().y-n.height/2})`),i.attr("attr",`apa-${t})`)}))}(p),(0,r.s)(void 0,u,o.mindmap.padding,o.mindmap.useMaxWidth)}},parser:p,styles:e=>`\n .edge {\n stroke-width: 3;\n }\n ${(e=>{let t="";for(let n=0;n<e.THEME_COLOR_LIMIT;n++)e["lineColor"+n]=e["lineColor"+n]||e["cScaleInv"+n],(0,u.Z)(e["lineColor"+n])?e["lineColor"+n]=(0,c.Z)(e["lineColor"+n],20):e["lineColor"+n]=(0,h.Z)(e["lineColor"+n],20);for(let n=0;n<e.THEME_COLOR_LIMIT;n++){const r=""+(17-3*n);t+=`\n .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} polygon, .section-${n-1} path {\n fill: ${e["cScale"+n]};\n }\n .section-${n-1} text {\n fill: ${e["cScaleLabel"+n]};\n }\n .node-icon-${n-1} {\n font-size: 40px;\n color: ${e["cScaleLabel"+n]};\n }\n .section-edge-${n-1}{\n stroke: ${e["cScale"+n]};\n }\n .edge-depth-${n-1}{\n stroke-width: ${r};\n }\n .section-${n-1} line {\n stroke: ${e["cScaleInv"+n]} ;\n stroke-width: 3;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: lightgray;\n }\n .disabled text {\n fill: #efefef;\n }\n `}return t})(e)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${e.git0};\n }\n .section-root text {\n fill: ${e.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n`}},75627:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(83445),i=n(31739);const a=e=>{const{r:t,g:n,b:a}=i.Z.parse(e),o=.2126*r.Z.channel.toLinear(t)+.7152*r.Z.channel.toLinear(n)+.0722*r.Z.channel.toLinear(a);return r.Z.lang.round(o)},o=e=>a(e)>=.5,s=e=>!o(e)}}]); \ No newline at end of file diff --git a/assets/js/7735.117b16ff.js.LICENSE.txt b/assets/js/7735.117b16ff.js.LICENSE.txt new file mode 100644 index 00000000000..a58daed496d --- /dev/null +++ b/assets/js/7735.117b16ff.js.LICENSE.txt @@ -0,0 +1,9 @@ +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ + +/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ + +/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ diff --git a/assets/js/79aef7ac.93777950.js b/assets/js/79aef7ac.93777950.js new file mode 100644 index 00000000000..524e466ac93 --- /dev/null +++ b/assets/js/79aef7ac.93777950.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9299],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),d=i,k=c["".concat(s,".").concat(d)]||c[d]||m[d]||a;return n?r.createElement(k,o(o({ref:t},u),{},{components:n})):r.createElement(k,o({ref:t},u))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<a;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},90355:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Soil moisture service"},o="SoilMoisture",l={unversionedId:"api/clients/soilmoisture",id:"api/clients/soilmoisture",title:"SoilMoisture",description:"DeviceScript client for Soil moisture service",source:"@site/docs/api/clients/soilmoisture.md",sourceDirName:"api/clients",slug:"/api/clients/soilmoisture",permalink:"/devicescript/api/clients/soilmoisture",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Soil moisture service"},sidebar:"tutorialSidebar"},s={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"variant",id:"const:variant",level:3}],u={toc:p},c="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(c,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"soilmoisture"},"SoilMoisture"),(0,i.kt)("p",null,"A soil moisture sensor."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoilMoisture } from "@devicescript/core"\n\nconst soilMoisture = new SoilMoisture()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"Indicates the wetness of the soil, from ",(0,i.kt)("inlineCode",{parentName:"p"},"dry")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"wet"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoilMoisture } from "@devicescript/core"\n\nconst soilMoisture = new SoilMoisture()\n// ...\nconst value = await soilMoisture.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoilMoisture } from "@devicescript/core"\n\nconst soilMoisture = new SoilMoisture()\n// ...\nsoilMoisture.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"The error on the moisture reading."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoilMoisture } from "@devicescript/core"\n\nconst soilMoisture = new SoilMoisture()\n// ...\nconst value = await soilMoisture.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoilMoisture } from "@devicescript/core"\n\nconst soilMoisture = new SoilMoisture()\n// ...\nsoilMoisture.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Describe the type of physical sensor."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoilMoisture } from "@devicescript/core"\n\nconst soilMoisture = new SoilMoisture()\n// ...\nconst value = await soilMoisture.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/79e87f40.e2746c43.js b/assets/js/79e87f40.e2746c43.js new file mode 100644 index 00000000000..e5395da962a --- /dev/null +++ b/assets/js/79e87f40.e2746c43.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1978],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>v});var i=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,i,a=function(e,t){if(null==e)return{};var r,i,a={},n=Object.keys(e);for(i=0;i<n.length;i++)r=n[i],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)r=n[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=i.createContext({}),s=function(e){var t=i.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=s(e.components);return i.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var r=e.components,a=e.mdxType,n=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,v=d["".concat(p,".").concat(m)]||d[m]||u[m]||n;return r?i.createElement(v,o(o({ref:t},l),{},{components:r})):i.createElement(v,o({ref:t},l))}));function v(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var n=r.length,o=new Array(n);o[0]=m;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var s=2;s<n;s++)o[s]=r[s];return i.createElement.apply(null,o)}return i.createElement.apply(null,r)}m.displayName="MDXCreateElement"},15468:(e,t,r)=>{r.d(t,{Z:()=>o});var i=r(98948),a=r(27378);const n={device__photo:"device__photo_XeRs"};function o(e){const{image:t,imageAlt:r,description:o,title:c,href:p}=e,s=(0,i.Z)(p);return a.createElement("a",{href:s,className:"avatar margin-vert--md"},a.createElement("img",{className:`avatar__photo-link avatar__photo avatar__photo--xl ${n.device__photo}`,alt:r||`photograph of ${c}`,src:t}),a.createElement("div",{className:"avatar__intro"},a.createElement("div",{className:"avatar__name"},c),o?a.createElement("small",{className:"avatar__subtitle"},o):null))}},7009:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>m,frontMatter:()=>o,metadata:()=>p,toc:()=>l});var i=r(25773),a=(r(27378),r(35318)),n=r(15468);const o={},c="RP2040",p={unversionedId:"devices/rp2040/index",id:"devices/rp2040/index",title:"RP2040",description:"The following devices use the firmware from https://github.com/microsoft/devicescript-pico",source:"@site/docs/devices/rp2040/index.mdx",sourceDirName:"devices/rp2040",slug:"/devices/rp2040/",permalink:"/devicescript/devices/rp2040/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Seeed Studio XIAO ESP32C3",permalink:"/devicescript/devices/esp32/seeed-xiao-esp32c3"},next:{title:"MSR RP2040 Brain 124 v0.1",permalink:"/devicescript/devices/rp2040/msr124"}},s={},l=[{value:"Usage",id:"usage",level:2}],d={toc:l},u="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,i.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"rp2040"},"RP2040"),(0,a.kt)("p",null,"The following devices use the firmware from ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript-pico"},"https://github.com/microsoft/devicescript-pico"),"\nwhich builds on top of the pico-sdk."),(0,a.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/raspberry-pi/picov00.preview.jpg",href:"/devices/rp2040/pico",title:"Raspberry Pi Pico",description:"RP2040 board from Raspberry Pi.",mdxType:"DeviceCard"}),(0,a.kt)(n.Z,{image:"https://microsoft.github.io/jacdac-docs/images/devices/raspberry-pi/picowv00.preview.jpg",href:"/devices/rp2040/pico-w",title:"Raspberry Pi Pico W",description:"RP2040 board from Raspberry Pi with a WiFi chip.",mdxType:"DeviceCard"}),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"The pico-w networking stack (cloud, etc...) is currently not well supported.\nWe are currently focusing on best support on ",(0,a.kt)("a",{parentName:"p",href:"/devices/esp32/"},"ESP32"),"."),(0,a.kt)("p",{parentName:"admonition"},"If you have expertise with the pico SDK, your contribution is welcome to fill the gaps.")),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("p",null,"You can use ",(0,a.kt)("inlineCode",{parentName:"p"},"devicescript flash rp2040")," command to flash RP2040-based boards."),(0,a.kt)("p",null,"Plug in your RP2040 board while holding ",(0,a.kt)("inlineCode",{parentName:"p"},"BOOTSEL")," button the run this command. The bootloader drive should be discovered by your operating system."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash rp2040\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-console",metastring:'title="Output"',title:'"Output"'},"$ devicescript flash rp2040\nPlease select board, available options:\n --board msr124 RP2040 124 v0.1\n --board msr59 RP2040 59 v0.1\n --board pico_w Raspberry Pi Pico W\nfatal: missing --board\n$\n")),(0,a.kt)("p",null,"Let's say your board is ",(0,a.kt)("inlineCode",{parentName:"p"},"pico_w"),", you run"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash rp2040 --board pico_w\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-console",metastring:'title="Output"',title:'"Output"'},"$ devicescript flash rp2040 --board pico_w\nusing drive /Volumes/RPI-RP2/\nfetch https://github.com/microsoft/jacdac-pico/releases/latest/download/devicescript-rp2040w-pico_w.uf2\nsaved .devicescript/cache/devicescript-rp2040w-pico_w.uf2 336896 bytes\ncp .devicescript/cache/devicescript-rp2040w-pico_w.uf2 /Volumes/RPI-RP2/\nOK\n$\n")),(0,a.kt)("p",null,"After flashing, your board has the DeviceScript runtime and you can program it using DeviceScript."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7a7b4b0d.23060478.js b/assets/js/7a7b4b0d.23060478.js new file mode 100644 index 00000000000..5a2176d4e83 --- /dev/null +++ b/assets/js/7a7b4b0d.23060478.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5129],{35318:(e,r,t)=>{t.d(r,{Zo:()=>d,kt:()=>b});var n=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},d=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},l="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),l=p(t),y=a,b=l["".concat(c,".").concat(y)]||l[y]||u[y]||o;return t?n.createElement(b,i(i({ref:r},d),{},{components:t})):n.createElement(b,i({ref:r},d))}));function b(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=y;var s={};for(var c in r)hasOwnProperty.call(r,c)&&(s[c]=r[c]);s.originalType=e,s[l]="string"==typeof e?e:a,i[1]=s;for(var p=2;p<o;p++)i[p]=t[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}y.displayName="MDXCreateElement"},55123:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=t(25773),a=(t(27378),t(35318));const o={description:"Mounts a HID keyboard server",title:"HID Keyboard"},i="HID Keyboard",s={unversionedId:"api/drivers/hidkeyboard",id:"api/drivers/hidkeyboard",title:"HID Keyboard",description:"Mounts a HID keyboard server",source:"@site/docs/api/drivers/hidkeyboard.md",sourceDirName:"api/drivers",slug:"/api/drivers/hidkeyboard",permalink:"/devicescript/api/drivers/hidkeyboard",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a HID keyboard server",title:"HID Keyboard"},sidebar:"tutorialSidebar",previous:{title:"HID Joystick",permalink:"/devicescript/api/drivers/hidjoystick"},next:{title:"HID Mouse",permalink:"/devicescript/api/drivers/hidmouse"}},c={},p=[],d={toc:p},l="wrapper";function u(e){let{components:r,...t}=e;return(0,a.kt)(l,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"hid-keyboard"},"HID Keyboard"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"startHidKeyboard")," function starts a ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/hidkeyboard"},"relay")," server on the device\nand returns a ",(0,a.kt)("a",{parentName:"p",href:"/api/clients/hidkeyboard"},"client"),"."),(0,a.kt)("p",null,"The server emulates a keyboard and can be used to send keystrokes to a computer."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { startHidKeyboard } from "@devicescript/servers"\n\nconst keyboard = startHidKeyboard({})\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,a.kt)("inlineCode",{parentName:"p"},"keyboard"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7ba726e1.fc6afc24.js b/assets/js/7ba726e1.fc6afc24.js new file mode 100644 index 00000000000..a3e2ccb6672 --- /dev/null +++ b/assets/js/7ba726e1.fc6afc24.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9106],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),c=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=c(n),d=i,k=m["".concat(p,".").concat(d)]||m[d]||u[d]||r;return n?a.createElement(k,l(l({ref:t},s),{},{components:n})):a.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[m]="string"==typeof e?e:i,l[1]=o;for(var c=2;c<r;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},28101:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>o,toc:()=>c});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Weight Scale service"},l="WeightScale",o={unversionedId:"api/clients/weightscale",id:"api/clients/weightscale",title:"WeightScale",description:"DeviceScript client for Weight Scale service",source:"@site/docs/api/clients/weightscale.md",sourceDirName:"api/clients",slug:"/api/clients/weightscale",permalink:"/devicescript/api/clients/weightscale",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Weight Scale service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Commands",id:"commands",level:2},{value:"calibrateZeroOffset",id:"calibratezerooffset",level:3},{value:"calibrateGain",id:"calibrategain",level:3},{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"zeroOffset",id:"rw:zeroOffset",level:3},{value:"gain",id:"rw:gain",level:3},{value:"maxReading",id:"const:maxReading",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"readingResolution",id:"const:readingResolution",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:c},m="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(m,(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"weightscale"},"WeightScale"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A weight measuring sensor."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"calibratezerooffset"},"calibrateZeroOffset"),(0,i.kt)("p",null,"Call this command when there is nothing on the scale. If supported, the module should save the calibration data."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"weightScale.calibrateZeroOffset(): Promise<void>\n")),(0,i.kt)("h3",{id:"calibrategain"},"calibrateGain"),(0,i.kt)("p",null,"Call this command with the weight of the thing on the scale."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"weightScale.calibrateGain(weight: number): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The reported weight."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nweightScale.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"The estimate error on the reported reading."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nweightScale.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:zeroOffset"},"zeroOffset"),(0,i.kt)("p",null,"Calibrated zero offset error on the scale, i.e. the measured weight when nothing is on the scale.\nYou do not need to subtract that from the reading, it has already been done."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.zeroOffset.read()\nawait weightScale.zeroOffset.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nweightScale.zeroOffset.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:gain"},"gain"),(0,i.kt)("p",null,"Calibrated gain on the weight scale error."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.gain.read()\nawait weightScale.gain.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nweightScale.gain.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,i.kt)("p",null,"Maximum supported weight on the scale."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.maxReading.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:minReading"},"minReading"),(0,i.kt)("p",null,"Minimum recommend weight on the scale."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.minReading.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:readingResolution"},"readingResolution"),(0,i.kt)("p",null,"Smallest, yet distinguishable change in reading."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.readingResolution.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"The type of physical scale"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WeightScale } from "@devicescript/core"\n\nconst weightScale = new WeightScale()\n// ...\nconst value = await weightScale.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7c28bcf8.4cefe90e.js b/assets/js/7c28bcf8.4cefe90e.js new file mode 100644 index 00000000000..f569a932cac --- /dev/null +++ b/assets/js/7c28bcf8.4cefe90e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1281],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),m=c(r),d=o,f=m["".concat(s,".").concat(d)]||m[d]||u[d]||i;return r?n.createElement(f,a(a({ref:t},l),{},{components:r})):n.createElement(f,a({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[m]="string"==typeof e?e:o,a[1]=p;for(var c=2;c<i;c++)a[c]=r[c];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},18134:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(25773),o=(r(27378),r(35318));const i={description:"Mounts a potentiometer",title:"Potentiometer"},a="Potentiometer",p={unversionedId:"api/drivers/potentiometer",id:"api/drivers/potentiometer",title:"Potentiometer",description:"Mounts a potentiometer",source:"@site/docs/api/drivers/potentiometer.md",sourceDirName:"api/drivers",slug:"/api/drivers/potentiometer",permalink:"/devicescript/api/drivers/potentiometer",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a potentiometer",title:"Potentiometer"},sidebar:"tutorialSidebar",previous:{title:"Motion Detector",permalink:"/devicescript/api/drivers/motion"},next:{title:"Power",permalink:"/devicescript/api/drivers/power"}},s={},c=[],l={toc:c},m="wrapper";function u(e){let{components:t,...r}=e;return(0,o.kt)(m,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"potentiometer"},"Potentiometer"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startPotentiometer")," starts a simple analog sensor server that models a potentiometer\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/potentiometer"},"client")," bound to the server."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Please refer to the ",(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("a",{parentName:"strong",href:"/developer/drivers/analog/"},"analog documentation"))," for details.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startPotentiometer } from "@devicescript/servers"\n\nconst sensor = startPotentiometer({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(v => console.data({ value: 100 * v }))\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7cbf7351.b749f3cb.js b/assets/js/7cbf7351.b749f3cb.js new file mode 100644 index 00000000000..abd89e8fe71 --- /dev/null +++ b/assets/js/7cbf7351.b749f3cb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1070],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},m=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),s=c(n),d=i,k=s["".concat(p,".").concat(d)]||s[d]||u[d]||o;return n?r.createElement(k,a(a({ref:t},m),{},{components:n})):r.createElement(k,a({ref:t},m))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[s]="string"==typeof e?e:i,a[1]=l;for(var c=2;c<o;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},36437:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Potentiometer service"},a="Potentiometer",l={unversionedId:"api/clients/potentiometer",id:"api/clients/potentiometer",title:"Potentiometer",description:"DeviceScript client for Potentiometer service",source:"@site/docs/api/clients/potentiometer.md",sourceDirName:"api/clients",slug:"/api/clients/potentiometer",permalink:"/devicescript/api/clients/potentiometer",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Potentiometer service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"variant",id:"const:variant",level:3}],m={toc:c},s="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(s,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"potentiometer"},"Potentiometer"),(0,i.kt)("p",null,"A slider or rotary potentiometer."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Potentiometer } from "@devicescript/core"\n\nconst potentiometer = new Potentiometer()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The relative position of the slider."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Potentiometer } from "@devicescript/core"\n\nconst potentiometer = new Potentiometer()\n// ...\nconst value = await potentiometer.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Potentiometer } from "@devicescript/core"\n\nconst potentiometer = new Potentiometer()\n// ...\npotentiometer.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Specifies the physical layout of the potentiometer."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Potentiometer } from "@devicescript/core"\n\nconst potentiometer = new Potentiometer()\n// ...\nconst value = await potentiometer.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7ec0e1a1.06bcf5a3.js b/assets/js/7ec0e1a1.06bcf5a3.js new file mode 100644 index 00000000000..00b7c8223ec --- /dev/null +++ b/assets/js/7ec0e1a1.06bcf5a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3251],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},l=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(t),f=i,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return t?n.createElement(m,o(o({ref:r},l),{},{components:t})):n.createElement(m,o({ref:r},l))}));function m(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=f;var c={};for(var p in r)hasOwnProperty.call(r,p)&&(c[p]=r[p]);c.originalType=e,c[u]="string"==typeof e?e:i,o[1]=c;for(var s=2;s<a;s++)o[s]=t[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"},73800:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>s});var n=t(25773),i=(t(27378),t(35318));const a={},o="Drivers",c={unversionedId:"api/drivers/index",id:"api/drivers/index",title:"Drivers",description:"Starting driver provide a programming abstraction for hardware periphericals.",source:"@site/docs/api/drivers/index.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/",permalink:"/devicescript/api/drivers/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Math",permalink:"/devicescript/api/math"},next:{title:"Accelerometer",permalink:"/devicescript/api/drivers/accelerometer"}},p={},s=[{value:"Jacdac",id:"jacdac",level:2}],l={toc:s},u="wrapper";function d(e){let{components:r,...t}=e;return(0,i.kt)(u,(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"drivers"},"Drivers"),(0,i.kt)("p",null,"Starting driver provide a programming abstraction for hardware periphericals.\nSome driver implementations are builtin (written C),\nwhile others can be contributed as DeviceScript packages."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startButton } from "@devicescript/servers"\n\nconst buttonA = startButton({\n pin: gpio(2),\n})\n')),(0,i.kt)("p",null,"You can find the list of servers in the table of contents."),(0,i.kt)("h2",{id:"jacdac"},"Jacdac"),(0,i.kt)("p",null,"DeviceScript supports Jacdac modules out of the box.\nSee ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/devices/"},"Jacdac Device Catalog"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7f4eb034.fd805cf5.js b/assets/js/7f4eb034.fd805cf5.js new file mode 100644 index 00000000000..badbbfb8d55 --- /dev/null +++ b/assets/js/7f4eb034.fd805cf5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9766],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=i.createContext({}),u=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=u(e.components);return i.createElement(p.Provider,{value:t},e.children)},c="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),c=u(n),m=r,k=c["".concat(p,".").concat(m)]||c[m]||s[m]||a;return n?i.createElement(k,l(l({ref:t},d),{},{components:n})):i.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=m;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[c]="string"==typeof e?e:r,l[1]=o;for(var u=2;u<a;u++)l[u]=n[u];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}m.displayName="MDXCreateElement"},95117:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>s,frontMatter:()=>a,metadata:()=>o,toc:()=>u});var i=n(25773),r=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Air Quality Index service"},l="AirQualityIndex",o={unversionedId:"api/clients/airqualityindex",id:"api/clients/airqualityindex",title:"AirQualityIndex",description:"DeviceScript client for Air Quality Index service",source:"@site/docs/api/clients/airqualityindex.md",sourceDirName:"api/clients",slug:"/api/clients/airqualityindex",permalink:"/devicescript/api/clients/airqualityindex",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Air Quality Index service"},sidebar:"tutorialSidebar"},p={},u=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],d={toc:u},c="wrapper";function s(e){let{components:t,...n}=e;return(0,r.kt)(c,(0,i.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"airqualityindex"},"AirQualityIndex"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"The Air Quality Index is a measure of how clean or polluted air is. From min, good quality, to high, low quality.\nThe range of AQI may vary between countries (",(0,r.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Air_quality_index"},"https://en.wikipedia.org/wiki/Air_quality_index"),")."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"Air quality index, typically refreshed every second."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n// ...\nconst value = await airQualityIndex.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n// ...\nairQualityIndex.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:readingError"},"readingError"),(0,r.kt)("p",null,"Error on the AQI measure."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n// ...\nconst value = await airQualityIndex.readingError.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n// ...\nairQualityIndex.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:minReading"},"minReading"),(0,r.kt)("p",null,"Minimum AQI reading, representing a good air quality. Typically 0."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n// ...\nconst value = await airQualityIndex.minReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,r.kt)("p",null,"Maximum AQI reading, representing a very poor air quality."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirQualityIndex } from "@devicescript/core"\n\nconst airQualityIndex = new AirQualityIndex()\n// ...\nconst value = await airQualityIndex.maxReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7f8a356d.e08744c6.js b/assets/js/7f8a356d.e08744c6.js new file mode 100644 index 00000000000..317937dbc20 --- /dev/null +++ b/assets/js/7f8a356d.e08744c6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4469],{35318:(e,t,n)=>{n.d(t,{Zo:()=>o,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},o=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),u=c(n),h=i,k=u["".concat(l,".").concat(h)]||u[h]||m[h]||r;return n?a.createElement(k,s(s({ref:t},o),{},{components:n})):a.createElement(k,s({ref:t},o))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,s=new Array(r);s[0]=h;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:i,s[1]=p;for(var c=2;c<r;c++)s[c]=n[c];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}h.displayName="MDXCreateElement"},97418:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>c});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Speech synthesis service"},s="SpeechSynthesis",p={unversionedId:"api/clients/speechsynthesis",id:"api/clients/speechsynthesis",title:"SpeechSynthesis",description:"DeviceScript client for Speech synthesis service",source:"@site/docs/api/clients/speechsynthesis.md",sourceDirName:"api/clients",slug:"/api/clients/speechsynthesis",permalink:"/devicescript/api/clients/speechsynthesis",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Speech synthesis service"},sidebar:"tutorialSidebar"},l={},c=[{value:"Commands",id:"commands",level:2},{value:"speak",id:"speak",level:3},{value:"cancel",id:"cancel",level:3},{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"lang",id:"rw:lang",level:3},{value:"volume",id:"rw:volume",level:3},{value:"pitch",id:"rw:pitch",level:3},{value:"rate",id:"rw:rate",level:3}],o={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"speechsynthesis"},"SpeechSynthesis"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A speech synthesizer"),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"speak"},"speak"),(0,i.kt)("p",null,"Adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"speechSynthesis.speak(text: string): Promise<void>\n")),(0,i.kt)("h3",{id:"cancel"},"cancel"),(0,i.kt)("p",null,"Cancels current utterance and all utterances from the utterance queue."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"speechSynthesis.cancel(): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Determines if the speech engine is in a non-paused state."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nconst value = await speechSynthesis.enabled.read()\nawait speechSynthesis.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nspeechSynthesis.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:lang"},"lang"),(0,i.kt)("p",null,"Language used for utterances as defined in ",(0,i.kt)("a",{parentName:"p",href:"https://www.ietf.org/rfc/bcp/bcp47.txt"},"https://www.ietf.org/rfc/bcp/bcp47.txt"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"s"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nconst value = await speechSynthesis.lang.read()\nawait speechSynthesis.lang.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nspeechSynthesis.lang.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:volume"},"volume"),(0,i.kt)("p",null,"Volume for utterances."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nconst value = await speechSynthesis.volume.read()\nawait speechSynthesis.volume.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nspeechSynthesis.volume.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:pitch"},"pitch"),(0,i.kt)("p",null,"Pitch for utterances"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nconst value = await speechSynthesis.pitch.read()\nawait speechSynthesis.pitch.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nspeechSynthesis.pitch.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:rate"},"rate"),(0,i.kt)("p",null,"Rate for utterances"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nconst value = await speechSynthesis.rate.read()\nawait speechSynthesis.rate.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SpeechSynthesis } from "@devicescript/core"\n\nconst speechSynthesis = new SpeechSynthesis()\n// ...\nspeechSynthesis.rate.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8442201f.75ad2023.js b/assets/js/8442201f.75ad2023.js new file mode 100644 index 00000000000..16449a175a1 --- /dev/null +++ b/assets/js/8442201f.75ad2023.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[660],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var i=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,i,a=function(e,t){if(null==e)return{};var n,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=i.createContext({}),s=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return i.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=s(n),d=a,k=m["".concat(p,".").concat(d)]||m[d]||u[d]||r;return n?i.createElement(k,o(o({ref:t},c),{},{components:n})):i.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:a,o[1]=l;for(var s=2;s<r;s++)o[s]=n[s];return i.createElement.apply(null,o)}return i.createElement.apply(null,n)}d.displayName="MDXCreateElement"},76203:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var i=n(25773),a=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Motion service"},o="Motion",l={unversionedId:"api/clients/motion",id:"api/clients/motion",title:"Motion",description:"DeviceScript client for Motion service",source:"@site/docs/api/clients/motion.md",sourceDirName:"api/clients",slug:"/api/clients/motion",permalink:"/devicescript/api/clients/motion",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Motion service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"maxDistance",id:"const:maxDistance",level:3},{value:"angle",id:"const:angle",level:3},{value:"variant",id:"const:variant",level:3},{value:"Events",id:"events",level:2},{value:"movement",id:"movement",level:3}],c={toc:s},m="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"motion"},"Motion"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A sensor, typically PIR, that detects object motion within a certain range"),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Motion } from "@devicescript/core"\n\nconst motion = new Motion()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Reports is movement is currently detected by the sensor."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motion } from "@devicescript/core"\n\nconst motion = new Motion()\n// ...\nconst value = await motion.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motion } from "@devicescript/core"\n\nconst motion = new Motion()\n// ...\nmotion.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:maxDistance"},"maxDistance"),(0,a.kt)("p",null,"Maximum distance where objects can be detected."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motion } from "@devicescript/core"\n\nconst motion = new Motion()\n// ...\nconst value = await motion.maxDistance.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:angle"},"angle"),(0,a.kt)("p",null,"Opening of the field of view"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motion } from "@devicescript/core"\n\nconst motion = new Motion()\n// ...\nconst value = await motion.angle.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"Type of physical sensor"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motion } from "@devicescript/core"\n\nconst motion = new Motion()\n// ...\nconst value = await motion.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h2",{id:"events"},"Events"),(0,a.kt)("h3",{id:"movement"},"movement"),(0,a.kt)("p",null,"A movement was detected."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"motion.movement.subscribe(() => {\n\n})\n")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/85b70f9f.70ddef32.js b/assets/js/85b70f9f.70ddef32.js new file mode 100644 index 00000000000..e72b2aa6fea --- /dev/null +++ b/assets/js/85b70f9f.70ddef32.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8534],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>v});var i=t(27378);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function o(e,r){if(null==e)return{};var t,i,n=function(e,r){if(null==e)return{};var t,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)t=a[i],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)t=a[i],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var s=i.createContext({}),c=function(e){var r=i.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):p(p({},r),e)),t},l=function(e){var r=c(e.components);return i.createElement(s.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return i.createElement(i.Fragment,{},r)}},m=i.forwardRef((function(e,r){var t=e.components,n=e.mdxType,a=e.originalType,s=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),d=c(t),m=n,v=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return t?i.createElement(v,p(p({ref:r},l),{},{components:t})):i.createElement(v,p({ref:r},l))}));function v(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var a=t.length,p=new Array(a);p[0]=m;var o={};for(var s in r)hasOwnProperty.call(r,s)&&(o[s]=r[s]);o.originalType=e,o[d]="string"==typeof e?e:n,p[1]=o;for(var c=2;c<a;c++)p[c]=t[c];return i.createElement.apply(null,p)}return i.createElement.apply(null,t)}m.displayName="MDXCreateElement"},66601:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>p,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var i=t(25773),n=(t(27378),t(35318));const a={title:"UC8151"},p="UC8151 eInk Driver",o={unversionedId:"api/drivers/uc8151",id:"api/drivers/uc8151",title:"UC8151",description:"Driver for UC8151 eInk screens.",source:"@site/docs/api/drivers/uc8151.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/uc8151",permalink:"/devicescript/api/drivers/uc8151",draft:!1,tags:[],version:"current",frontMatter:{title:"UC8151"},sidebar:"tutorialSidebar",previous:{title:"Traffic Light",permalink:"/devicescript/api/drivers/trafficlight"},next:{title:"Water Level",permalink:"/devicescript/api/drivers/waterlevel"}},s={},c=[{value:"Display",id:"display",level:2},{value:"Driver",id:"driver",level:2}],l={toc:c},d="wrapper";function u(e){let{components:r,...t}=e;return(0,n.kt)(d,(0,i.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"uc8151-eink-driver"},"UC8151 eInk Driver"),(0,n.kt)("p",null,"Driver for UC8151 eInk screens."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { UC8151Driver } from "@devicescript/drivers"\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.orientdisplay.com/wp-content/uploads/2022/09/UC8151C.pdf"},"Datasheet for UC8151"))),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://github.com/mmoskal/devicescript-pimoroni-pico-badger/raw/main/assets/badger-w.jpg",alt:"Pimoroni Badger W"})),(0,n.kt)("p",null,"The driver is used by the following packages:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/devicescript-pimoroni-pico-badger"},"devicescript-pimoroni-pico-badger"))),(0,n.kt)("h2",{id:"display"},"Display"),(0,n.kt)("p",null,"The driver implements the ",(0,n.kt)("a",{parentName:"p",href:"/developer/graphics/display"},"Display")," interface and can be used as various services.\nUsing the driver through services provides a better simulation experience."),(0,n.kt)("h2",{id:"driver"},"Driver"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/uc8151.ts"},"Source"))),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import * as ds from "@devicescript/core"\nimport { UC8151Driver } from "@devicescript/drivers"\nimport { Image, font8, scaledFont } from "@devicescript/graphics"\nimport { spi } from "@devicescript/spi"\nimport { pins } from "@dsboard/pico_w"\n\nspi.configure({\n miso: pins.GP16,\n mosi: pins.GP19,\n sck: pins.GP18,\n hz: 8_000_000,\n})\n\nconst display = new UC8151Driver(Image.alloc(296, 128, 1), {\n cs: pins.GP17,\n dc: pins.GP20,\n reset: pins.GP21,\n busy: pins.GP26,\n\n flip: false,\n spi: spi,\n})\nawait display.init()\nconst bigFont = scaledFont(font8(), 3)\ndisplay.image.print("Hello world!", 3, 10, 1, bigFont)\nawait display.show()\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/85efd854.776da408.js b/assets/js/85efd854.776da408.js new file mode 100644 index 00000000000..22d5625026a --- /dev/null +++ b/assets/js/85efd854.776da408.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8914],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,l=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),p=s(n),f=i,m=p["".concat(c,".").concat(f)]||p[f]||d[f]||l;return n?r.createElement(m,o(o({ref:t},u),{},{components:n})):r.createElement(m,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var l=n.length,o=new Array(l);o[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[p]="string"==typeof e?e:i,o[1]=a;for(var s=2;s<l;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},77483:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>l,metadata:()=>a,toc:()=>s});var r=n(25773),i=(n(27378),n(35318));const l={sidebar_position:2.1,title:"Schedule Blinky",hide_table_of_contents:!0},o="Schedule Blinky",a={unversionedId:"samples/schedule-blinky",id:"samples/schedule-blinky",title:"Schedule Blinky",description:"This sample blinks the onboard LED using the schedule",source:"@site/docs/samples/schedule-blinky.mdx",sourceDirName:"samples",slug:"/samples/schedule-blinky",permalink:"/devicescript/samples/schedule-blinky",draft:!1,tags:[],version:"current",sidebarPosition:2.1,frontMatter:{sidebar_position:2.1,title:"Schedule Blinky",hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Blinky",permalink:"/devicescript/samples/blinky"},next:{title:"Double Blinky",permalink:"/devicescript/samples/double-blinky"}},c={},s=[],u={toc:s},p="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(p,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"schedule-blinky"},"Schedule Blinky"),(0,i.kt)("p",null,"This sample blinks the onboard LED using the ",(0,i.kt)("a",{parentName:"p",href:"/api/runtime/schedule"},"schedule")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { schedule, setStatusLight } from "@devicescript/runtime"\n\n// counter increments on every invocation\nschedule(\n async ({ counter, elapsed, delta }) => {\n console.data({ counter })\n // toggle between red and off\n await setStatusLight(counter % 2 === 0 ? 0xff0000 : 0x000000)\n },\n {\n // first delay\n timeout: 100,\n // repeated delay\n interval: 1000,\n }\n)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8796e623.20763866.js b/assets/js/8796e623.20763866.js new file mode 100644 index 00000000000..02706a6d670 --- /dev/null +++ b/assets/js/8796e623.20763866.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6690],{35318:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>g});var r=t(27378);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function c(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),d=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=d(e.components);return r.createElement(l.Provider,{value:n},e.children)},u="mdxType",s={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=d(t),f=o,g=u["".concat(l,".").concat(f)]||u[f]||s[f]||i;return t?r.createElement(g,a(a({ref:n},p),{},{components:t})):r.createElement(g,a({ref:n},p))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c[u]="string"==typeof e?e:o,a[1]=c;for(var d=2;d<i;d++)a[d]=t[d];return r.createElement.apply(null,a)}return r.createElement.apply(null,t)}f.displayName="MDXCreateElement"},79e3:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>s,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var r=t(25773),o=(t(27378),t(35318));const i={title:"Board Configuration",sidebar_position:2.9},a="Board Configuration",c={unversionedId:"developer/board-configuration",id:"developer/board-configuration",title:"Board Configuration",description:"To target a specific hardware board or peripherical,",source:"@site/docs/developer/board-configuration.mdx",sourceDirName:"developer",slug:"/developer/board-configuration",permalink:"/devicescript/developer/board-configuration",draft:!1,tags:[],version:"current",sidebarPosition:2.9,frontMatter:{title:"Board Configuration",sidebar_position:2.9},sidebar:"tutorialSidebar",previous:{title:"Clients",permalink:"/devicescript/developer/clients"},next:{title:"Register",permalink:"/devicescript/developer/register"}},l={},d=[{value:"Available Boards",id:"available-boards",level:2},{value:"Configuration by Code",id:"configuration-by-code",level:2},{value:"I2C",id:"i2c",level:3},{value:"Configuration by file",id:"configuration-by-file",level:2}],p={toc:d},u="wrapper";function s(e){let{components:n,...t}=e;return(0,o.kt)(u,(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"board-configuration"},"Board Configuration"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"To target a specific hardware board or peripherical,\nyou need to configure the pins, I2C, SPI, etc...")," This is done by loading the\nboard configuration package for your specific hardware."),(0,o.kt)("p",null,"The inserted board configuration exposes a ",(0,o.kt)("inlineCode",{parentName:"p"},"pins")," object that you can use to\nconfigure drivers."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'// highlight-next-line\nimport { pins } from "@dsboard/adafruit_qt_py_c3"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"In Visual Studio Code, on the file menu, click on the ",(0,o.kt)("strong",{parentName:"p"},"wand")," icon and select the board configuration.\nIf your board is already connectd, DeviceScript will automatically detect it and\nload the correct board configuration.")),(0,o.kt)("p",null,"Once the board configuration is imported, you can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"pins")," export to reference named pins from the board"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { startLightBulb } from "@devicescript/servers"\n\nconst lightBulb = startLightBulb({\n // highlight-next-line\n pin: pins.A0_D0,\n})\n')),(0,o.kt)("h2",{id:"available-boards"},"Available Boards"),(0,o.kt)("p",null,"You can find the list of supported devices and configuration in\nthe ",(0,o.kt)("a",{parentName:"p",href:"/devices"},"devices")," catalog."),(0,o.kt)("p",null,"If your board system-on-chip (SoC) is supported (ESP32, RP2040, ...) but the pin configuration\nis not yet available, you have 2 options: create a new board configuration file\nor configure the board by code."),(0,o.kt)("h2",{id:"configuration-by-code"},"Configuration by Code"),(0,o.kt)("p",null,"Some board configuration are generic and the I2C pins are not configured by default.\nFor example, the ",(0,o.kt)("a",{parentName:"p",href:"/devices/rp2040/pico-w"},"pico-w")," board configuration does not configure\nthe I2C pins and the code below configure them by code."),(0,o.kt)("p",null,"You can configure the board by code using the ",(0,o.kt)("inlineCode",{parentName:"p"},"configureHardware")," function."),(0,o.kt)("h3",{id:"i2c"},"I2C"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/pico_w"\n// highlight-next-line\nimport { configureHardware } from "@devicescript/servers"\n\n// highlight-start\nconfigureHardware({\n i2c: {\n pinSDA: pins.GP4,\n pinSCL: pins.GP5,\n },\n})\n// highlight-end\n')),(0,o.kt)("h2",{id:"configuration-by-file"},"Configuration by file"),(0,o.kt)("p",null,"This is a more advanced scenario where you want to fork an existing board configuration\nand publish configuration for a different board."),(0,o.kt)("p",null,"Refer to the ",(0,o.kt)("a",{parentName:"p",href:"/devices/add-board"},"Add board")," documentation to learn\nhow to create a new board configuration file."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/87e2c537.6a02fb47.js b/assets/js/87e2c537.6a02fb47.js new file mode 100644 index 00000000000..fb5f97aed80 --- /dev/null +++ b/assets/js/87e2c537.6a02fb47.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3358],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),p=u(n),f=o,m=p["".concat(l,".").concat(f)]||p[f]||d[f]||a;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[p]="string"==typeof e?e:o,i[1]=c;for(var u=2;u<a;u++)i[u]=n[u];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},40855:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>u});var r=n(25773),o=(n(27378),n(35318));const a={},i="schedule",c={unversionedId:"api/runtime/schedule",id:"api/runtime/schedule",title:"schedule",description:"The schedule function combines setTimeout and setInterval to provide a single function that can be used to schedule a function to run once or repeatedly.",source:"@site/docs/api/runtime/schedule.mdx",sourceDirName:"api/runtime",slug:"/api/runtime/schedule",permalink:"/devicescript/api/runtime/schedule",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"PixelBuffer",permalink:"/devicescript/api/runtime/pixelbuffer"},next:{title:"Observables",permalink:"/devicescript/api/observables/"}},l={},u=[],s={toc:u},p="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(p,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"schedule"},(0,o.kt)("inlineCode",{parentName:"h1"},"schedule")),(0,o.kt)("p",null,"The schedule function combines ",(0,o.kt)("inlineCode",{parentName:"p"},"setTimeout")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"setInterval")," to provide a single function that can be used to schedule a function to run once or repeatedly.\nThe function also tracks the number of invocation, total elapsed time and time since last invocation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { schedule, setStatusLight } from "@devicescript/runtime"\n\n// counter increments on every invocation\nschedule(\n async ({ counter, elapsed, delta }) => {\n console.data({ counter })\n // toggle between red and off\n await setStatusLight(counter % 2 === 0 ? 0xff0000 : 0x000000)\n },\n {\n // first delay\n timeout: 100,\n // repeated delay\n interval: 1000,\n }\n)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/882902b6.dfc1e14f.js b/assets/js/882902b6.dfc1e14f.js new file mode 100644 index 00000000000..8841380e141 --- /dev/null +++ b/assets/js/882902b6.dfc1e14f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9294],{35318:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>g});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function c(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var o=n.createContext({}),l=function(e){var r=n.useContext(o),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},p=function(e){var r=l(e.components);return n.createElement(o.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),f=i,g=u["".concat(o,".").concat(f)]||u[f]||d[f]||a;return t?n.createElement(g,c(c({ref:r},p),{},{components:t})):n.createElement(g,c({ref:r},p))}));function g(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var a=t.length,c=new Array(a);c[0]=f;var s={};for(var o in r)hasOwnProperty.call(r,o)&&(s[o]=r[o]);s.originalType=e,s[u]="string"==typeof e?e:i,c[1]=s;for(var l=2;l<a;l++)c[l]=t[l];return n.createElement.apply(null,c)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"},74180:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>o,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=t(25773),i=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for I2C service"},c="I2C",s={unversionedId:"api/clients/i2c",id:"api/clients/i2c",title:"I2C",description:"DeviceScript client for I2C service",source:"@site/docs/api/clients/i2c.md",sourceDirName:"api/clients",slug:"/api/clients/i2c",permalink:"/devicescript/api/clients/i2c",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for I2C service"},sidebar:"tutorialSidebar"},o={},l=[{value:"Usage",id:"usage",level:2},{value:"Read-write register byte",id:"read-write-register-byte",level:3},{value:"Read-write register buffer",id:"read-write-register-buffer",level:3},{value:"Read-write raw buffer",id:"read-write-raw-buffer",level:3},{value:"Errors",id:"errors",level:3}],p={toc:l},u="wrapper";function d(e){let{components:r,...t}=e;return(0,i.kt)(u,(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"i2c"},"I2C"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/i2c/"},"I2C service")," is used internally by the\n",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},(0,i.kt)("inlineCode",{parentName:"a"},"@devicescript/i2c"))," package."),(0,i.kt)("h2",{id:"usage"},"Usage"),(0,i.kt)("h3",{id:"read-write-register-byte"},"Read-write register byte"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { i2c } from "@devicescript/i2c"\n\nconst address = 0x..\nconst register = 0x..\nconst value = 0x..\n\n// highlight-next-line\nawait i2c.writeReg(address, register, value)\n\n// highlight-next-line\nconst readValue = await i2c.readReg(address, register)\n')),(0,i.kt)("h3",{id:"read-write-register-buffer"},"Read-write register buffer"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { i2c } from "@devicescript/i2c"\n\nconst address = 0x..\nconst register = 0x..\nconst size = 0x..\n\n// highlight-next-line\nawait i2c.writeRegBuf(address, register, hex`...`)\n\n// highlight-next-line\nconst readBuf = await i2c.readRegBuf(address, register, size)\n')),(0,i.kt)("h3",{id:"read-write-raw-buffer"},"Read-write raw buffer"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { i2c } from "@devicescript/i2c"\n\nconst address = 0x..\nconst size = 0x..\n\n// highlight-next-line\nawait i2c.writeBuf(address, hex`...`)\n\n// highlight-next-line\nconst readBuf = await i2c.readBuf(address, size)\n')),(0,i.kt)("h3",{id:"errors"},"Errors"),(0,i.kt)("p",null,"I2C functions may throw a ",(0,i.kt)("inlineCode",{parentName:"p"},"I2CError"),"\nerror if the operation fails."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/88b58b9e.23e17756.js b/assets/js/88b58b9e.23e17756.js new file mode 100644 index 00000000000..a95641bd64c --- /dev/null +++ b/assets/js/88b58b9e.23e17756.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1368],{35318:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>d});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function a(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=n.createContext({}),p=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):l(l({},r),e)),t},c=function(e){var r=p(e.components);return n.createElement(s.Provider,{value:r},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},g=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),m=p(t),g=i,d=m["".concat(s,".").concat(g)]||m[g]||u[g]||o;return t?n.createElement(d,l(l({ref:r},c),{},{components:t})):n.createElement(d,l({ref:r},c))}));function d(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var o=t.length,l=new Array(o);l[0]=g;var a={};for(var s in r)hasOwnProperty.call(r,s)&&(a[s]=r[s]);a.originalType=e,a[m]="string"==typeof e?e:i,l[1]=a;for(var p=2;p<o;p++)l[p]=t[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,t)}g.displayName="MDXCreateElement"},21247:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>p});var n=t(25773),i=(t(27378),t(35318));const o={},l="Digital Signal processing",a={unversionedId:"api/observables/dsp",id:"api/observables/dsp",title:"Digital Signal processing",description:"ewma",source:"@site/docs/api/observables/dsp.mdx",sourceDirName:"api/observables",slug:"/api/observables/dsp",permalink:"/devicescript/api/observables/dsp",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Creation Operators",permalink:"/devicescript/api/observables/creation"},next:{title:"Filter Operators",permalink:"/devicescript/api/observables/filter"}},s={},p=[{value:"ewma",id:"ewma",level:2},{value:"rollingAverage",id:"rollingaverage",level:2},{value:"fir",id:"fir",level:2},{value:"levelDetector",id:"leveldetector",level:2}],c={toc:p},m="wrapper";function u(e){let{components:r,...t}=e;return(0,i.kt)(m,(0,n.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"digital-signal-processing"},"Digital Signal processing"),(0,i.kt)("h2",{id:"ewma"},"ewma"),(0,i.kt)("p",null,"Exponentially weighted moving average is a simple PIR filter\nwith a gain parameter.\nThe closer gain to 1 and the more closely the EWMA tracks the original time series."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { ewma } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n\nthermometer.reading\n // highlight-next-line\n .pipe(ewma(0.5))\n .subscribe(t => console.log(t))\n')),(0,i.kt)("h2",{id:"rollingaverage"},"rollingAverage"),(0,i.kt)("p",null,"A windowed rolling average filter."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { rollingAverage } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n\nthermometer.reading\n // highlight-next-line\n .pipe(rollingAverage(10))\n .subscribe(t => console.log(t))\n')),(0,i.kt)("h2",{id:"fir"},"fir"),(0,i.kt)("p",null,"A general purpose Finite Response Filter filter. Coefficients are typically computed in a seperate process."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { fir } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n\nthermometer.reading\n // highlight-next-line\n .pipe(fir([0.1, 0.2, 1]))\n .subscribe(t => console.log(t))\n')),(0,i.kt)("h2",{id:"leveldetector"},"levelDetector"),(0,i.kt)("p",null,"Measures and thresholds data into low/mid/high levels."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { levelDetector } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n\nthermometer.reading\n // highlight-next-line\n .pipe(levelDetector(20 /* low threshold */, 30 /*high threshold */))\n .subscribe(level =>\n console.log(level < 0 ? "cold" : level > 0 ? "hot" : "mild")\n )\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/88c5790d.cf68bd90.js b/assets/js/88c5790d.cf68bd90.js new file mode 100644 index 00000000000..81d3fa6db68 --- /dev/null +++ b/assets/js/88c5790d.cf68bd90.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7832],{35318:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,c=e.originalType,p=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),s=l(r),f=a,m=s["".concat(p,".").concat(f)]||s[f]||u[f]||c;return r?n.createElement(m,i(i({ref:t},d),{},{components:r})):n.createElement(m,i({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=r.length,i=new Array(c);i[0]=f;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[s]="string"==typeof e?e:a,i[1]=o;for(var l=2;l<c;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},97079:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const c={pagination_prev:null,pagination_next:null,unlisted:!0},i="ArcadeGamepad",o={unversionedId:"api/clients/arcadegamepad",id:"api/clients/arcadegamepad",title:"ArcadeGamepad",description:"The Arcade Gamepad service is deprecated and not supported in DeviceScript.",source:"@site/docs/api/clients/arcadegamepad.md",sourceDirName:"api/clients",slug:"/api/clients/arcadegamepad",permalink:"/devicescript/api/clients/arcadegamepad",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},p={},l=[],d={toc:l},s="wrapper";function u(e){let{components:t,...r}=e;return(0,a.kt)(s,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"arcadegamepad"},"ArcadeGamepad"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/arcadegamepad/"},"Arcade Gamepad service")," is deprecated and not supported in DeviceScript."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/89588721.de534c4f.js b/assets/js/89588721.de534c4f.js new file mode 100644 index 00000000000..4fe43770182 --- /dev/null +++ b/assets/js/89588721.de534c4f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7754],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>b});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,b=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(b,i(i({ref:t},p),{},{components:r})):n.createElement(b,i({ref:t},p))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:a,i[1]=c;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},76838:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var n=r(25773),a=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},i="Dashboard",c={unversionedId:"api/clients/dashboard",id:"api/clients/dashboard",title:"Dashboard",description:"The Dashboard service is used internally by the runtime",source:"@site/docs/api/clients/dashboard.md",sourceDirName:"api/clients",slug:"/api/clients/dashboard",permalink:"/devicescript/api/clients/dashboard",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},s=[],p={toc:s},u="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"dashboard"},"Dashboard"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/dashboard/"},"Dashboard service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,a.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/899b456c.7a96d720.js b/assets/js/899b456c.7a96d720.js new file mode 100644 index 00000000000..a901f4a7550 --- /dev/null +++ b/assets/js/899b456c.7a96d720.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9702],{35318:(t,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>u});var r=n(27378);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function l(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n,r,a={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var o=r.createContext({}),s=function(t){var e=r.useContext(o),n=e;return t&&(n="function"==typeof t?t(e):p(p({},e),t)),n},d=function(t){var e=s(t.components);return r.createElement(o.Provider,{value:e},t.children)},m="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},g=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,i=t.originalType,o=t.parentName,d=l(t,["components","mdxType","originalType","parentName"]),m=s(n),g=a,u=m["".concat(o,".").concat(g)]||m[g]||c[g]||i;return n?r.createElement(u,p(p({ref:e},d),{},{components:n})):r.createElement(u,p({ref:e},d))}));function u(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=n.length,p=new Array(i);p[0]=g;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[m]="string"==typeof t?t:a,p[1]=l;for(var s=2;s<i;s++)p[s]=n[s];return r.createElement.apply(null,p)}return r.createElement.apply(null,n)}g.displayName="MDXCreateElement"},4183:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(25773),a=(n(27378),n(35318));const i={description:"MSR JM Brain S2-mini 207 v4.3"},p="MSR JM Brain S2-mini 207 v4.3",l={unversionedId:"devices/esp32/msr207-v43",id:"devices/esp32/msr207-v43",title:"MSR JM Brain S2-mini 207 v4.3",description:"MSR JM Brain S2-mini 207 v4.3",source:"@site/docs/devices/esp32/msr207-v43.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/msr207-v43",permalink:"/devicescript/devices/esp32/msr207-v43",draft:!1,tags:[],version:"current",frontMatter:{description:"MSR JM Brain S2-mini 207 v4.3"},sidebar:"tutorialSidebar",previous:{title:"MSR JM Brain S2-mini 207 v4.2",permalink:"/devicescript/devices/esp32/msr207-v42"},next:{title:"MSR JacdacIoT 48 v0.2",permalink:"/devicescript/devices/esp32/msr48"}},o={},s=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:s},m="wrapper";function c(t){let{components:e,...n}=t;return(0,a.kt)(m,(0,r.Z)({},d,n,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"msr-jm-brain-s2-mini-207-v43"},"MSR JM Brain S2-mini 207 v4.3"),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Jacdac on pin 17 using Jacdac connector"),(0,a.kt)("li",{parentName:"ul"},"RGB LED on pins 8, 7, 6 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin 43 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: power (auto-start)")),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,a.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P33")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P34")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"jacdac.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,a.kt)("td",{parentName:"tr",align:"right"},"jacdac.pin, analogOut, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[0]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[0]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[1]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[1]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[2]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[2]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"log.pinTX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinCS")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinCS, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinMISO")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO37"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinMISO, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinMOSI")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinMOSI, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinSCK")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinSCK, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinEn")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinEn, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinFault")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinFault, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "MSR JM Brain S2-mini 207 v4.3".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/msr207_v43"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board msr207_v43\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-msr207_v43-0x1000.bin"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="msr207_v43.json"',title:'"msr207_v43.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "msr207_v43",\n "devName": "MSR JM Brain S2-mini 207 v4.3",\n "productId": "0x322e0e64",\n "archId": "esp32s2",\n "jacdac": {\n "$connector": "Jacdac",\n "pin": 17\n },\n "led": {\n "rgb": [\n {\n "mult": 250,\n "pin": 8\n },\n {\n "mult": 60,\n "pin": 7\n },\n {\n "mult": 150,\n "pin": 6\n }\n ]\n },\n "log": {\n "pinTX": 43\n },\n "pins": {\n "P33": 33,\n "P34": 34\n },\n "sd": {\n "pinCS": 38,\n "pinMISO": 37,\n "pinMOSI": 35,\n "pinSCK": 36\n },\n "services": [\n {\n "faultIgnoreMs": 100,\n "mode": 1,\n "name": "power",\n "pinEn": 2,\n "pinFault": 13,\n "service": "power"\n }\n ]\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/89d10a13.fadb8f7d.js b/assets/js/89d10a13.fadb8f7d.js new file mode 100644 index 00000000000..11c95a321b0 --- /dev/null +++ b/assets/js/89d10a13.fadb8f7d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6594],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),d=s(n),c=i,k=d["".concat(o,".").concat(c)]||d[c]||u[c]||r;return n?a.createElement(k,l(l({ref:t},m),{},{components:n})):a.createElement(k,l({ref:t},m))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=c;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:i,l[1]=p;for(var s=2;s<r;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},72885:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>p,toc:()=>s});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for LED service"},l="Led",p={unversionedId:"api/clients/led",id:"api/clients/led",title:"Led",description:"DeviceScript client for LED service",source:"@site/docs/api/clients/led.md",sourceDirName:"api/clients",slug:"/api/clients/led",permalink:"/devicescript/api/clients/led",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for LED service"},sidebar:"tutorialSidebar"},o={},s=[{value:"Registers",id:"registers",level:2},{value:"pixels",id:"rw:pixels",level:3},{value:"intensity",id:"rw:intensity",level:3},{value:"actualBrightness",id:"ro:actualBrightness",level:3},{value:"numPixels",id:"const:numPixels",level:3},{value:"numColumns",id:"const:numColumns",level:3},{value:"maxPower",id:"rw:maxPower",level:3},{value:"ledsPerPixel",id:"const:ledsPerPixel",level:3},{value:"waveLength",id:"const:waveLength",level:3},{value:"luminousIntensity",id:"const:luminousIntensity",level:3},{value:"variant",id:"const:variant",level:3}],m={toc:s},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"led"},"Led"),(0,i.kt)("p",null,"A controller for displays of individually controlled RGB LEDs."),(0,i.kt)("p",null,"For 64 or less LEDs, the service should support the pack the pixels in the pixels register.\nBeyond this size, the register should return an empty payload as the amount of data exceeds\nthe size of a packet. Typically services that use more than 64 LEDs\nwill run on the same MCU and will maintain the pixels buffer internally."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"Additional runtime support is provided for ",(0,i.kt)("inlineCode",{parentName:"p"},"Led"),"\nby importing the ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/runtime")," package."),(0,i.kt)("p",{parentName:"admonition"},"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"/developer/leds"},"LEDs developer documentation"),"."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport "@devicescript/runtime"\n\nconst led = new Led()\n'))),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:pixels"},"pixels"),(0,i.kt)("p",null,"A buffer of 24bit RGB color entries for each LED, in R, G, B order.\nWhen writing, if the buffer is too short, the remaining pixels are set to ",(0,i.kt)("inlineCode",{parentName:"p"},"#000000"),";\nIf the buffer is too long, the write may be ignored, or the additional pixels may be ignored.\nIf the number of pixels is greater than ",(0,i.kt)("inlineCode",{parentName:"p"},"max_pixels_length"),", the read should return an empty payload."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<Buffer>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"b"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nled.pixels.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:intensity"},"intensity"),(0,i.kt)("p",null,"Set the luminosity of the strip.\nAt ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," the power to the strip is completely shut down."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.intensity.read()\nawait led.intensity.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nled.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:actualBrightness"},"actualBrightness"),(0,i.kt)("p",null,"This is the luminosity actually applied to the strip.\nMay be lower than ",(0,i.kt)("inlineCode",{parentName:"p"},"brightness")," if power-limited by the ",(0,i.kt)("inlineCode",{parentName:"p"},"max_power")," register.\nIt will rise slowly (few seconds) back to ",(0,i.kt)("inlineCode",{parentName:"p"},"brightness")," is limits are no longer required."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.actualBrightness.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nled.actualBrightness.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:numPixels"},"numPixels"),(0,i.kt)("p",null,"Specifies the number of pixels in the strip."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.numPixels.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:numColumns"},"numColumns"),(0,i.kt)("p",null,"If the LED pixel strip is a matrix, specifies the number of columns."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.numColumns.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:maxPower"},"maxPower"),(0,i.kt)("p",null,"Limit the power drawn by the light-strip (and controller)."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.maxPower.read()\nawait led.maxPower.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nled.maxPower.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:ledsPerPixel"},"ledsPerPixel"),(0,i.kt)("p",null,"If known, specifies the number of LEDs in parallel on this device.\nThe actual number of LEDs is ",(0,i.kt)("inlineCode",{parentName:"p"},"num_pixels * leds_per_pixel"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.ledsPerPixel.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:waveLength"},"waveLength"),(0,i.kt)("p",null,"If monochrome LED, specifies the wave length of the LED.\nRegister is missing for RGB LEDs."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.waveLength.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:luminousIntensity"},"luminousIntensity"),(0,i.kt)("p",null,"The luminous intensity of all the LEDs, at full brightness, in micro candella."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.luminousIntensity.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Specifies the shape of the light strip."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n\nconst led = new Led()\n// ...\nconst value = await led.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8a8c4ba9.bc3afb47.js b/assets/js/8a8c4ba9.bc3afb47.js new file mode 100644 index 00000000000..0e959d41555 --- /dev/null +++ b/assets/js/8a8c4ba9.bc3afb47.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1728],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},p=Object.keys(e);for(r=0;r<p.length;r++)n=p[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r<p.length;r++)n=p[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var o=r.createContext({}),u=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(o.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,p=e.originalType,o=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),m=u(n),d=a,k=m["".concat(o,".").concat(d)]||m[d]||c[d]||p;return n?r.createElement(k,l(l({ref:t},s),{},{components:n})):r.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=n.length,l=new Array(p);l[0]=d;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[m]="string"==typeof e?e:a,l[1]=i;for(var u=2;u<p;u++)l[u]=n[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},30402:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>p,metadata:()=>i,toc:()=>u});var r=n(25773),a=(n(27378),n(35318));const p={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Power supply service"},l="PowerSupply",i={unversionedId:"api/clients/powersupply",id:"api/clients/powersupply",title:"PowerSupply",description:"DeviceScript client for Power supply service",source:"@site/docs/api/clients/powersupply.md",sourceDirName:"api/clients",slug:"/api/clients/powersupply",permalink:"/devicescript/api/clients/powersupply",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Power supply service"},sidebar:"tutorialSidebar"},o={},u=[{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"outputVoltage",id:"rw:outputVoltage",level:3},{value:"minValue",id:"const:minValue",level:3},{value:"maxValue",id:"const:maxValue",level:3}],s={toc:u},m="wrapper";function c(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"powersupply"},"PowerSupply"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A power supply with a fixed or variable voltage range"),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:enabled"},"enabled"),(0,a.kt)("p",null,"Turns the power supply on with ",(0,a.kt)("inlineCode",{parentName:"p"},"true"),", off with ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n// ...\nconst value = await powerSupply.enabled.read()\nawait powerSupply.enabled.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n// ...\npowerSupply.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:outputVoltage"},"outputVoltage"),(0,a.kt)("p",null,"The current output voltage of the power supply. Values provided must be in the range ",(0,a.kt)("inlineCode",{parentName:"p"},"minimum_voltage")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"maximum_voltage")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n// ...\nconst value = await powerSupply.outputVoltage.read()\nawait powerSupply.outputVoltage.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n// ...\npowerSupply.outputVoltage.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:minValue"},"minValue"),(0,a.kt)("p",null,"The minimum output voltage of the power supply. For fixed power supplies, ",(0,a.kt)("inlineCode",{parentName:"p"},"minimum_voltage")," should be equal to ",(0,a.kt)("inlineCode",{parentName:"p"},"maximum_voltage"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n// ...\nconst value = await powerSupply.minValue.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:maxValue"},"maxValue"),(0,a.kt)("p",null,"The maximum output voltage of the power supply. For fixed power supplies, ",(0,a.kt)("inlineCode",{parentName:"p"},"minimum_voltage")," should be equal to ",(0,a.kt)("inlineCode",{parentName:"p"},"maximum_voltage"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PowerSupply } from "@devicescript/core"\n\nconst powerSupply = new PowerSupply()\n// ...\nconst value = await powerSupply.maxValue.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8b9eacc1.b2148e8b.js b/assets/js/8b9eacc1.b2148e8b.js new file mode 100644 index 00000000000..0dd19dd6fd0 --- /dev/null +++ b/assets/js/8b9eacc1.b2148e8b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3850],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>v});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=i,v=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(v,o(o({ref:t},c),{},{components:r})):n.createElement(v,o({ref:t},c))}));function v(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:i,o[1]=s;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},58100:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(27378);const i={borderRadius:"0.5rem",marginTop:"1rem",marginBottom:"1rem",maxHeight:"40rem",maxWidth:"40rem"};function a(e){const{name:t,style:r=i,webm:a}=e,o=(0,n.useRef)(null);return n.createElement("video",{ref:o,style:r,poster:`/devicescript/videos/${t}.jpg`,playsInline:!0,controls:!0,preload:"metadata"},n.createElement("source",{src:`/devicescript/videos/${t}.mp4`,type:"video/mp4"}),n.createElement("p",null,"Your browser doesn't support HTML video. Here is a",n.createElement("a",{href:`/devicescript/videos/${t}.mp4`},"link to the video")," ","instead."))}},28990:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(25773),i=(r(27378),r(35318)),a=r(58100);const o={sidebar_position:19},s="Visual Studio Code Extension",l={unversionedId:"getting-started/vscode/index",id:"getting-started/vscode/index",title:"Visual Studio Code Extension",description:"The Visual Studio Code extension provides the best developer experience for DeviceScript.",source:"@site/docs/getting-started/vscode/index.mdx",sourceDirName:"getting-started/vscode",slug:"/getting-started/vscode/",permalink:"/devicescript/getting-started/vscode/",draft:!1,tags:[],version:"current",sidebarPosition:19,frontMatter:{sidebar_position:19},sidebar:"tutorialSidebar",previous:{title:"Getting Started",permalink:"/devicescript/getting-started/"},next:{title:"Simulation",permalink:"/devicescript/getting-started/vscode/simulation"}},p={},c=[{value:"Features",id:"features",level:2},{value:"(Optional) Manual installation from the GitHub releases",id:"optional-manual-installation-from-the-github-releases",level:3},{value:"Creating a new project",id:"creating-a-new-project",level:2},{value:"DeviceScript basics",id:"devicescript-basics",level:2}],d={toc:c},u="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"visual-studio-code-extension"},"Visual Studio Code Extension"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://code.visualstudio.com/"},"Visual Studio Code")," extension provides the best developer experience for DeviceScript."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"install the ",(0,i.kt)("a",{parentName:"strong",href:"https://marketplace.visualstudio.com/items?itemName=devicescript.devicescript-vscode"},"DeviceScript extension")))),(0,i.kt)("p",null,"You will also need"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("a",{parentName:"strong",href:"https://nodejs.org/en/download/"},"Node.JS 16+"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("a",{parentName:"strong",href:"https://code.visualstudio.com/"},"Visual Studio Code")))),(0,i.kt)(a.Z,{name:"blinky",mdxType:"StaticVideo"}),(0,i.kt)("h2",{id:"features"},"Features"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Build and watch using DeviceScript compiler, deploy to simulator or hardware"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/developer/board-configuration"},"Board configuration")," for hardware pins, I2S, SPI configurations"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"./vscode/debugging"},"Debugger")," with breakpoints, stack traces, exceptions, stepping"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"./vscode/simulation"},"Simulator")," for DeviceScript and sensors/actuators"),(0,i.kt)("li",{parentName:"ul"},"Connection to native DeviceScript device"),(0,i.kt)("li",{parentName:"ul"},"Device, services, register ",(0,i.kt)("a",{parentName:"li",href:"./vscode/user-interface"},"Explorer view")),(0,i.kt)("li",{parentName:"ul"},"Register and Event watch")),(0,i.kt)("h3",{id:"optional-manual-installation-from-the-github-releases"},"(Optional) Manual installation from the GitHub releases"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"find the latest release at ",(0,i.kt)("a",{parentName:"strong",href:"https://github.com/microsoft/devicescript/releases?expanded=true"},"https://github.com/microsoft/devicescript/releases"))),(0,i.kt)("li",{parentName:"ul"},"download ",(0,i.kt)("inlineCode",{parentName:"li"},"devicescript.vsix")," from ",(0,i.kt)("strong",{parentName:"li"},"Assets")),(0,i.kt)("li",{parentName:"ul"},"install the .vsix file in code")),(0,i.kt)("p",null,"Using the ",(0,i.kt)("strong",{parentName:"p"},"Install from VSIX")," command in the Extensions view command dropdown,\nor the ",(0,i.kt)("strong",{parentName:"p"},"Extensions: Install from VSIX")," command in the Command Palette, point to the .vsix file\n(see ",(0,i.kt)("a",{parentName:"p",href:"https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix"},"full instructions"),")."),(0,i.kt)("h2",{id:"creating-a-new-project"},"Creating a new project"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"install ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/"},"Node.JS 16+")),(0,i.kt)("li",{parentName:"ul"},"From the Command palette, type ",(0,i.kt)("strong",{parentName:"li"},"DeviceScript: Create New Project...")," and follow the prompts.")),(0,i.kt)("p",null,"The new project should be ready to go."),(0,i.kt)("h2",{id:"devicescript-basics"},"DeviceScript basics"),(0,i.kt)("p",null,"Navigate to the ",(0,i.kt)("a",{parentName:"p",href:"/developer"},"Developer section")," to learn the basics of the language."),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"To report an issue, open the command palette and run ",(0,i.kt)("strong",{parentName:"p"},"DeviceScript: Report Issue...","*"),".")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8fb2ffea.c4fa604e.js b/assets/js/8fb2ffea.c4fa604e.js new file mode 100644 index 00000000000..c43f369556f --- /dev/null +++ b/assets/js/8fb2ffea.c4fa604e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5341],{35318:(t,e,r)=>{r.d(e,{Zo:()=>d,kt:()=>g});var n=r(27378);function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r,n,a={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(a[r]=t[r]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}var o=n.createContext({}),l=function(t){var e=n.useContext(o),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},d=function(t){var e=l(t.components);return n.createElement(o.Provider,{value:e},t.children)},c="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var r=t.components,a=t.mdxType,i=t.originalType,o=t.parentName,d=s(t,["components","mdxType","originalType","parentName"]),c=l(r),u=a,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||i;return r?n.createElement(g,p(p({ref:e},d),{},{components:r})):n.createElement(g,p({ref:e},d))}));function g(t,e){var r=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=r.length,p=new Array(i);p[0]=u;var s={};for(var o in e)hasOwnProperty.call(e,o)&&(s[o]=e[o]);s.originalType=t,s[c]="string"==typeof t?t:a,p[1]=s;for(var l=2;l<i;l++)p[l]=r[l];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"},39255:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const i={description:"Espressif ESP32-C3-RUST-DevKit"},p="Espressif ESP32-C3-RUST-DevKit",s={unversionedId:"devices/esp32/esp32c3-rust-devkit",id:"devices/esp32/esp32c3-rust-devkit",title:"Espressif ESP32-C3-RUST-DevKit",description:"Espressif ESP32-C3-RUST-DevKit",source:"@site/docs/devices/esp32/esp32c3-rust-devkit.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32c3-rust-devkit",permalink:"/devicescript/devices/esp32/esp32c3-rust-devkit",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32-C3-RUST-DevKit"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32-C3 (bare)",permalink:"/devicescript/devices/esp32/esp32c3-bare"},next:{title:"Espressif ESP32-S2 (bare)",permalink:"/devicescript/devices/esp32/esp32s2-bare"}},o={},l=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:l},c="wrapper";function m(t){let{components:e,...r}=t;return(0,a.kt)(c,(0,n.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"espressif-esp32-c3-rust-devkit"},"Espressif ESP32-C3-RUST-DevKit"),(0,a.kt)("p",null,"A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/espressif/esp32c3rustdevkitv12a.catalog.jpg",alt:"Espressif ESP32-C3-RUST-DevKit picture"})),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"I2C on 10/8 using Header connector"),(0,a.kt)("li",{parentName:"ul"},"WS2812B RGB LED on pin 2 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin P21 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: buttonBOOT (button)")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/esp-rs/esp-rust-board"},"https://github.com/esp-rs/esp-rust-board"))),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"LED")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P0")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P1")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P20")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,a.kt)("td",{parentName:"tr",align:"right"},"bootUart, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P21")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, bootUart, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P3")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P4")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P5")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P6")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P9")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,a.kt)("td",{parentName:"tr",align:"right"},"$services.buttonBOOT","[0]",".pin, boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"i2c.pinSCL")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, boot, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"i2c.pinSDA")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,a.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.pin, analogIn, boot, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32-C3-RUST-DevKit".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32c3_rust_devkit"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32c3_rust_devkit\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_rust_devkit-0x0.bin"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32c3_rust_devkit.json"',title:'"esp32c3_rust_devkit.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32c3_rust_devkit",\n "devName": "Espressif ESP32-C3-RUST-DevKit",\n "productId": "0x33f29c59",\n "$description": "A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port.",\n "archId": "esp32c3",\n "url": "https://github.com/esp-rs/esp-rust-board",\n "$services": [\n {\n "name": "buttonBOOT",\n "pin": "P9",\n "service": "button"\n }\n ],\n "i2c": {\n "$connector": "Header",\n "pinSCL": 8,\n "pinSDA": 10\n },\n "led": {\n "pin": 2,\n "type": 1\n },\n "log": {\n "pinTX": "P21"\n },\n "pins": {\n "LED": 7,\n "P0": 0,\n "P1": 1,\n "P20": 20,\n "P21": 21,\n "P3": 3,\n "P4": 4,\n "P5": 5,\n "P6": 6,\n "P9": 9\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9127.686f7823.js b/assets/js/9127.686f7823.js new file mode 100644 index 00000000000..9350c2b0f22 --- /dev/null +++ b/assets/js/9127.686f7823.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9127],{89127:(e,s,b)=>{b.r(s)}}]); \ No newline at end of file diff --git a/assets/js/91d2d959.ec268ed1.js b/assets/js/91d2d959.ec268ed1.js new file mode 100644 index 00000000000..b094aeab619 --- /dev/null +++ b/assets/js/91d2d959.ec268ed1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9302],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>b});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),d=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=d(e.components);return n.createElement(c.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),s=d(r),m=a,b=s["".concat(c,".").concat(m)]||s[m]||u[m]||i;return r?n.createElement(b,o(o({ref:t},p),{},{components:r})):n.createElement(b,o({ref:t},p))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[s]="string"==typeof e?e:a,o[1]=l;for(var d=2;d<i;d++)o[d]=r[d];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},39534:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var n=r(25773),a=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Barcode reader service"},o="BarcodeReader",l={unversionedId:"api/clients/barcodereader",id:"api/clients/barcodereader",title:"BarcodeReader",description:"DeviceScript client for Barcode reader service",source:"@site/docs/api/clients/barcodereader.md",sourceDirName:"api/clients",slug:"/api/clients/barcodereader",permalink:"/devicescript/api/clients/barcodereader",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Barcode reader service"},sidebar:"tutorialSidebar"},c={},d=[{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"formats",id:"const:formats",level:3},{value:"Events",id:"events",level:2},{value:"detect",id:"detect",level:3}],p={toc:d},s="wrapper";function u(e){let{components:t,...r}=e;return(0,a.kt)(s,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"barcodereader"},"BarcodeReader"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A device that reads various barcodes, like QR codes. For the web, see ",(0,a.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector"},"BarcodeDetector"),"."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { BarcodeReader } from "@devicescript/core"\n\nconst barcodeReader = new BarcodeReader()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:enabled"},"enabled"),(0,a.kt)("p",null,"Turns on or off the detection of barcodes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { BarcodeReader } from "@devicescript/core"\n\nconst barcodeReader = new BarcodeReader()\n// ...\nconst value = await barcodeReader.enabled.read()\nawait barcodeReader.enabled.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { BarcodeReader } from "@devicescript/core"\n\nconst barcodeReader = new BarcodeReader()\n// ...\nbarcodeReader.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:formats"},"formats"),(0,a.kt)("p",null,"Reports the list of supported barcode formats, as documented in ",(0,a.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API"},"https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"type: ",(0,a.kt)("inlineCode",{parentName:"li"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"li"},"r: u8"),")"),(0,a.kt)("li",{parentName:"ul"},"optional: this register may not be implemented"),(0,a.kt)("li",{parentName:"ul"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h2",{id:"events"},"Events"),(0,a.kt)("h3",{id:"detect"},"detect"),(0,a.kt)("p",null,"Raised when a bar code is detected and decoded. If the reader detects multiple codes, it will issue multiple events.\nIn case of numeric barcodes, the ",(0,a.kt)("inlineCode",{parentName:"p"},"data")," field should contain the ASCII (which is the same as UTF8 in that case) representation of the number."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"barcodeReader.detect.subscribe(() => {\n\n})\n")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/921da172.6fbb109c.js b/assets/js/921da172.6fbb109c.js new file mode 100644 index 00000000000..ccf0728a242 --- /dev/null +++ b/assets/js/921da172.6fbb109c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4077],{35318:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>y});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function c(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var u=r.createContext({}),l=function(e){var n=r.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(u.Provider,{value:n},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},b=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,u=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),s=l(t),b=i,y=s["".concat(u,".").concat(b)]||s[b]||f[b]||a;return t?r.createElement(y,o(o({ref:n},p),{},{components:t})):r.createElement(y,o({ref:n},p))}));function y(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=b;var c={};for(var u in n)hasOwnProperty.call(n,u)&&(c[u]=n[u]);c.originalType=e,c[s]="string"==typeof e?e:i,o[1]=c;for(var l=2;l<a;l++)o[l]=t[l];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}b.displayName="MDXCreateElement"},77876:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>o,default:()=>f,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var r=t(25773),i=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,unlisted:!0},o="UniqueBrain",c={unversionedId:"api/clients/uniquebrain",id:"api/clients/uniquebrain",title:"UniqueBrain",description:"The Unique Brain service is used internally by the runtime",source:"@site/docs/api/clients/uniquebrain.md",sourceDirName:"api/clients",slug:"/api/clients/uniquebrain",permalink:"/devicescript/api/clients/uniquebrain",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},u={},l=[],p={toc:l},s="wrapper";function f(e){let{components:n,...t}=e;return(0,i.kt)(s,(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"uniquebrain"},"UniqueBrain"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/uniquebrain/"},"Unique Brain service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/92ed0cbf.65cbd581.js b/assets/js/92ed0cbf.65cbd581.js new file mode 100644 index 00000000000..0f2727c2092 --- /dev/null +++ b/assets/js/92ed0cbf.65cbd581.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4053],{35318:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var r=a(27378);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function s(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),c=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(a),m=n,h=d["".concat(l,".").concat(m)]||d[m]||u[m]||i;return a?r.createElement(h,o(o({ref:t},p),{},{components:a})):r.createElement(h,o({ref:t},p))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=a.length,o=new Array(i);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:n,o[1]=s;for(var c=2;c<i;c++)o[c]=a[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"},23407:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=a(25773),n=(a(27378),a(35318));const i={},o="Workshop",s={unversionedId:"samples/workshop/index",id:"samples/workshop/index",title:"Workshop",description:"Leverage your TypeScript skills to program electronics using DeviceScript.",source:"@site/docs/samples/workshop/index.mdx",sourceDirName:"samples/workshop",slug:"/samples/workshop/",permalink:"/devicescript/samples/workshop/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Thermostat + Gateway",permalink:"/devicescript/samples/thermostat-gateway"},next:{title:"DeviceScript Language",permalink:"/devicescript/language/"}},l={},c=[{value:"Time Estimate",id:"time-estimate",level:2},{value:"Overview",id:"overview",level:2},{value:"Who are You?",id:"who-are-you",level:2},{value:"Activity Outcome",id:"activity-outcome",level:2},{value:"Required Materials",id:"required-materials",level:2},{value:"Prerequisites:\xa0",id:"prerequisites",level:2},{value:"Setup",id:"setup",level:3},{value:"Getting started",id:"getting-started",level:2},{value:"Part 1: Programming with simulators",id:"part-1-programming-with-simulators",level:2},{value:"More tutorials",id:"more-tutorials",level:3},{value:"Part 2: Configuring the Hardware",id:"part-2-configuring-the-hardware",level:2},{value:"Part 4: Sensors",id:"part-4-sensors",level:2},{value:"Part 5: Funny humidity meter",id:"part-5-funny-humidity-meter",level:2},{value:"Part 6: Connect to Wifi",id:"part-6-connect-to-wifi",level:2},{value:"Microsoft Campus Device Registration",id:"microsoft-campus-device-registration",level:3},{value:"Part 7: Settings and secrets",id:"part-7-settings-and-secrets",level:2},{value:"Part 8: Fetching GitHub Build Status",id:"part-8-fetching-github-build-status",level:2}],p={toc:c},d="wrapper";function u(e){let{components:t,...i}=e;return(0,n.kt)(d,(0,r.Z)({},p,i,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"workshop"},"Workshop"),(0,n.kt)("p",null,"Leverage your TypeScript skills to program electronics using ",(0,n.kt)("a",{parentName:"p",href:"https://microsoft.github.io/devicescript/"},"DeviceScript"),"."),(0,n.kt)("h2",{id:"time-estimate"},"Time Estimate"),(0,n.kt)("p",null,"2.0 hours"),(0,n.kt)("h2",{id:"overview"},"Overview"),(0,n.kt)("p",null,"This project will introduce participants to DeviceScript, a TypeScript programming environment for small electronics, including sensing and interacting with the physical environment using a common microcontroller - ESP32-C3."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Participants will program a microcontroller to retrieve data readings from the sensor and then act upon that data."),(0,n.kt)("li",{parentName:"ul"},"Participants will use ",(0,n.kt)("inlineCode",{parentName:"li"},"fetch")," to call a Web API (GitHub build status) and update an LED based on the result.")),(0,n.kt)("h2",{id:"who-are-you"},"Who are You?"),(0,n.kt)("p",null,"The ideal participant is someone who is familiar with TypeScript (front-end or back-end). Experience with electronics is ",(0,n.kt)("strong",{parentName:"p"},"not")," required."),(0,n.kt)("h2",{id:"activity-outcome"},"Activity Outcome"),(0,n.kt)("p",null,"Participants should have a device programmed with DeviceScript that can detect moisture levels in their plant soil,\nshow some light animation on a LED display. Update the LED display based on the build status of their favorite GitHub repository."),(0,n.kt)("p",null,"Participants will have learned to:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Connect sensors to read the phyiscal environment (BME680)"),(0,n.kt)("li",{parentName:"ul"},"Control the physical environment by playing sounds on buzzer, animating LEDs"),(0,n.kt)("li",{parentName:"ul"},"Deploy DeviceScript scripts to hardware device"),(0,n.kt)("li",{parentName:"ul"},"Issue Web HTTP requests")),(0,n.kt)("h2",{id:"required-materials"},"Required Materials"),(0,n.kt)("p",null,"These items are required."),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:null},"Image"),(0,n.kt)("th",{parentName:"tr",align:null},"Item"),(0,n.kt)("th",{parentName:"tr",align:null},"Url"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("img",{parentName:"td",src:"https://microsoft.github.io/jacdac-docs/images/devices/seeed-studio/xiaoesp32c3withmsr218base218v46.catalog.jpg",alt:"Xiao ESP32C3 on custom PCB"})),(0,n.kt)("td",{parentName:"tr",align:null},"Xiao ESP32C3 + Breakout broard"),(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("a",{parentName:"td",href:"https://microsoft.github.io/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218"},"https://microsoft.github.io/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218"))),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("img",{parentName:"td",src:"https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/h/t/httpsstatics3.seeedstudio.comseeedfile2018-08bazaar896611_img_0076a.jpg",alt:"BME680 sensor"})),(0,n.kt)("td",{parentName:"tr",align:null},"BME680 sensor"),(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("a",{parentName:"td",href:"https://www.seeedstudio.com/Grove-Temperature-Humidity-Pressure-and-Gas-Sensor-for-Arduino-BME680.html?queryID=3a720270a67b60e6bdac9638b0b9e5f0&objectID=100&indexName=bazaar_retailer_products"},"https://www.seeedstudio.com/Grove-Temperature-Humidity-Pressure-and-Gas-Sensor-for-Arduino-BME680.html?queryID=3a720270a67b60e6bdac9638b0b9e5f0&objectID=100&indexName=bazaar_retailer_products"))),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("img",{parentName:"td",src:"https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/h/t/httpsstatics3.seeedstudio.comseeedfile2018-08bazaar897328_1.jpg",alt:"Buzzer grove module"})),(0,n.kt)("td",{parentName:"tr",align:null},"Buzzer"),(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("a",{parentName:"td",href:"https://www.seeedstudio.com/Grove-Buzzer.html?queryID=fd5ea919ecbc76ef7f1e4210879a99fd&objectID=1805&indexName=bazaar_retailer_products"},"https://www.seeedstudio.com/Grove-Buzzer.html?queryID=fd5ea919ecbc76ef7f1e4210879a99fd&objectID=1805&indexName=bazaar_retailer_products"))),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("img",{parentName:"td",src:"https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/h/t/httpsstatics3.seeedstudio.comimagesproduct20cmbk1.jpg",alt:"Grove cables"})),(0,n.kt)("td",{parentName:"tr",align:null},"Grove cables"),(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("a",{parentName:"td",href:"https://www.seeedstudio.com/Grove-Universal-4-Pin-Buckled-20cm-Cable-5-PCs-pack.html?queryID=f4ec2714afc36affeef7955392573644&objectID=1693&indexName=bazaar_retailer_products"},"https://www.seeedstudio.com/Grove-Universal-4-Pin-Buckled-20cm-Cable-5-PCs-pack.html?queryID=f4ec2714afc36affeef7955392573644&objectID=1693&indexName=bazaar_retailer_products"))),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("img",{parentName:"td",src:"https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/c/a/cable-1.png",alt:"USB-C cable"})),(0,n.kt)("td",{parentName:"tr",align:null},"USB-C cables"),(0,n.kt)("td",{parentName:"tr",align:null},(0,n.kt)("a",{parentName:"td",href:"https://www.seeedstudio.com/USB-3-1-Type-C-to-A-Cable-1-Meter-3-1A-p-4085.html?queryID=6bd7ee107594c139732c712ddb72eca0&objectID=4085&indexName=bazaar_retailer_products"},"https://www.seeedstudio.com/USB-3-1-Type-C-to-A-Cable-1-Meter-3-1A-p-4085.html?queryID=6bd7ee107594c139732c712ddb72eca0&objectID=4085&indexName=bazaar_retailer_products"))))),(0,n.kt)("h2",{id:"prerequisites"},"Prerequisites:\xa0"),(0,n.kt)("p",null,"This workshop does not require experience with programming or electronics. However to make the most of the time, experience with TypeScript is helpful."),(0,n.kt)("h3",{id:"setup"},"Setup"),(0,n.kt)("p",null,"DeviceScript is tested on Windows and MacOS. Results may vary in other environment, depending of the support of ",(0,n.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/serialport"},"serialport"),". The programming can be done from containers (GitHub Codespaces, docker, WSL2) but access to Serial/USB typically requires to run on the host OS."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Install ",(0,n.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/"},"Node.JS 16+")," and ",(0,n.kt)("a",{parentName:"li",href:"https://code.visualstudio.com/"},"Visual Studio Code")),(0,n.kt)("li",{parentName:"ul"},"Install ",(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=devicescript.devicescript-vscode"},"DeviceScript extension v2.10.2+")," (",(0,n.kt)("a",{parentName:"li",href:"https://microsoft.github.io/devicescript/getting-started/vscode"},"more info..."),"). If you have an older installation of the extension, make sure to take the update.")),(0,n.kt)("h2",{id:"getting-started"},"Getting started"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Open VS Code"),(0,n.kt)("li",{parentName:"ul"},"Make sure that the ",(0,n.kt)("a",{parentName:"li",href:"https://marketplace.visualstudio.com/items?itemName=devicescript.devicescript-vscode"},"DeviceScript extension")," is installed"),(0,n.kt)("li",{parentName:"ul"},"Open the command palette and run the ",(0,n.kt)("inlineCode",{parentName:"li"},"DeviceScript: Create new Project...")," command.")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"image",src:a(40167).Z,width:"435",height:"103"})),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Once the project is created, reopen the project in VSCode")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"image",src:a(82707).Z,width:"279",height:"579"})),(0,n.kt)("h2",{id:"part-1-programming-with-simulators"},"Part 1: Programming with simulators"),(0,n.kt)("p",null,"Before we start working wiith hardware, we can start programming and debugging embedded application using simulators, both for the main board and the sensors."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"edit ",(0,n.kt)("inlineCode",{parentName:"li"},"src/main.ts")," to contain:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { Buzzer } from "@devicescript/core"\n\nconst buzzer = new Buzzer()\nsetInterval(async () => {\n // update the frequency, volume and duration to your taste\n await buzzer.playNote(440, 0.5, 50)\n}, 1000)\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"click on Play button on the editor menu in the top-right corner\n",(0,n.kt)("img",{alt:"Play button",src:a(27674).Z,width:"1094",height:"542"})),(0,n.kt)("li",{parentName:"ul"},"in the simulator pane click auto-start to start the buzzer simulator\n",(0,n.kt)("img",{alt:"Auto-start button",src:a(46005).Z,width:"1408",height:"704"})),(0,n.kt)("li",{parentName:"ul"},"enable sound on the simulator"),(0,n.kt)("li",{parentName:"ul"},"enjoy the music!")),(0,n.kt)("h3",{id:"more-tutorials"},"More tutorials"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Follow the ",(0,n.kt)("a",{parentName:"li",href:"https://microsoft.github.io/devicescript/samples/blinky"},"Blinky")," to get used to the DeviceScript interface"),(0,n.kt)("li",{parentName:"ul"},"Follow the ",(0,n.kt)("a",{parentName:"li",href:"https://microsoft.github.io/devicescript/samples/thermostat"},"Thermostat")," to get used to handle sensor data")),(0,n.kt)("h2",{id:"part-2-configuring-the-hardware"},"Part 2: Configuring the Hardware"),(0,n.kt)("p",null,"Now that we have a simple program working on simulator, it is time to specialize it for the available sensor and test it out on hardware."),(0,n.kt)("p",null,"Let's start by making sure the DeviceScript firmware is updated."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Connect the BME680 sensor to the Qwic connector"),(0,n.kt)("li",{parentName:"ul"},"Connect the Buzzer to the Grove connector ",(0,n.kt)("strong",{parentName:"li"},"A0")),(0,n.kt)("li",{parentName:"ul"},"Connect Xiao board to your computer using the USB-C cable"),(0,n.kt)("li",{parentName:"ul"},"Make sure the Python extension is installed, along with a Python runtime"),(0,n.kt)("li",{parentName:"ul"},"Open the ",(0,n.kt)("strong",{parentName:"li"},"DeviceScript")," view and click on the ",(0,n.kt)("strong",{parentName:"li"},"plug")," to connect to your Xiao.")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"image",src:a(29703).Z,width:"976",height:"576"})),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Select ",(0,n.kt)("strong",{parentName:"li"},"Flash Firmware...")),(0,n.kt)("li",{parentName:"ul"},"Scroll down and select ",(0,n.kt)("strong",{parentName:"li"},"Seeed Studio XIAO ESP32C3 with MSR218 base"))),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"image",src:a(46826).Z,width:"709",height:"70"})),(0,n.kt)("p",null,"Once the flashing process is over,"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Open the ",(0,n.kt)("strong",{parentName:"li"},"DeviceScript")," view and click on the ",(0,n.kt)("strong",{parentName:"li"},"plug")," to connect to your Xiao."),(0,n.kt)("li",{parentName:"ul"},"Select ",(0,n.kt)("strong",{parentName:"li"},"Serial"))),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Alt text",src:a(82875).Z,width:"976",height:"576"})),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Your device should be appearing in the device explorer!")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Alt text",src:a(13242).Z,width:"505",height:"374"})),(0,n.kt)("h2",{id:"part-4-sensors"},"Part 4: Sensors"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Open ",(0,n.kt)("strong",{parentName:"li"},"main.ts")," and click on the ",(0,n.kt)("strong",{parentName:"li"},"magic wand")," icon in the file menu.")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Alt text",src:a(93865).Z,width:"505",height:"255"})),(0,n.kt)("p",null,"The wizard will add an import that contains the pin mapping for the Xiao and search for ",(0,n.kt)("inlineCode",{parentName:"p"},"startBME680"),". Repeat the operation for ",(0,n.kt)("inlineCode",{parentName:"p"},"startBuzzer")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/seeed_xiao_esp32c3_msr218"\nimport { startBME680 } from "@devicescript/drivers"\nimport { startBuzzer } from "@devicescript/servers"\n\nconst { temperature, humidity, pressure, airQualityIndex } = await startBME680()\nconst buzzer = startBuzzer({\n pin: pins.A0,\n})\n')),(0,n.kt)("h2",{id:"part-5-funny-humidity-meter"},"Part 5: Funny humidity meter"),(0,n.kt)("p",null,"Here is a tiny toy example that puts everything together.\nIt buzzes and turns the LEDs red if the humidity gets too high. In the simulator, drag the slider\nor blow on the BME680 sensor to test it out."),(0,n.kt)("p",null,"If you want to use simulator, disconnect the hardware and restart."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/seeed_xiao_esp32c3_msr218"\nimport { startBME680 } from "@devicescript/drivers"\nimport { startBuzzer } from "@devicescript/servers"\nimport { setStatusLight } from "@devicescript/runtime"\n\nconst { temperature, humidity, pressure, airQualityIndex } = await startBME680()\nconst buzzer = startBuzzer({\n pin: pins.A0,\n})\n\nsetInterval(async () => {\n // read humidity sensor data\n // improvements: what about filtering?\n const h = await humidity.reading.read()\n // if humidity goes above threshold (80%)\n const humidityThreshold = 80\n if (h > humidityThreshold) {\n // buzz and turn the board LED red\n await buzzer.playNote(440, 0.5, 500)\n await setStatusLight(0xff0000)\n } else {\n // otherwise turn the LED off\n await setStatusLight(0)\n }\n}, 1000)\n')),(0,n.kt)("h2",{id:"part-6-connect-to-wifi"},"Part 6: Connect to Wifi"),(0,n.kt)("p",null,"Enter the Wifi connection information through the explorer,"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"expand the wifi node in the device explorer"),(0,n.kt)("li",{parentName:"ul"},"hover on the access point and click the ",(0,n.kt)("strong",{parentName:"li"},"plug")," button"),(0,n.kt)("li",{parentName:"ul"},"enter the access point password")),(0,n.kt)("p",null,"DeviceScript should use the Access Point when detected."),(0,n.kt)("h3",{id:"microsoft-campus-device-registration"},"Microsoft Campus Device Registration"),(0,n.kt)("p",null,"You need to register the XIAO MAC address in order for it to connect to the ",(0,n.kt)("inlineCode",{parentName:"p"},"MSFTGUEST")," network."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"in the ",(0,n.kt)("strong",{parentName:"li"},"Devices")," tree, find the ",(0,n.kt)("strong",{parentName:"li"},"WiFi MAC")," field value and copy it.")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Alt text",src:a(8352).Z,width:"477",height:"325"})),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"navigate to ",(0,n.kt)("a",{parentName:"li",href:"https://aka.ms/getconnected"},"https://aka.ms/getconnected")," , click ",(0,n.kt)("strong",{parentName:"li"},"Quick Registration - Wireless"),", ",(0,n.kt)("strong",{parentName:"li"},"Guest Account (MSFTGUEST)"),", and register your device MAC address")),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Alt text",src:a(40271).Z,width:"438",height:"395"})),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"find ",(0,n.kt)("strong",{parentName:"li"},"MSFTGUEST")," in the list of APs, click the ",(0,n.kt)("strong",{parentName:"li"},"plug")," icon and press Enter to leave the password empty.")),(0,n.kt)("h2",{id:"part-7-settings-and-secrets"},"Part 7: Settings and secrets"),(0,n.kt)("p",null,"In this section, we'll add a GET call to the GitHub repository status API and use it to change the LED color."),(0,n.kt)("p",null,"First thing first, we'll add .env files to the project to store the github configuration and ",(0,n.kt)("strong",{parentName:"p"},"secret")," token."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Click on the ",(0,n.kt)("strong",{parentName:"li"},"wand")," icon on the file menu"),(0,n.kt)("li",{parentName:"ul"},"Select ",(0,n.kt)("strong",{parentName:"li"},"Add Device Settings..."))),(0,n.kt)("p",null,"Update ",(0,n.kt)("inlineCode",{parentName:"p"},".env.defaults")," with the public settings (checked in)"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-yaml"},"# .env.defaults = public settings\nGITHUB_OWNER=microsoft\nGITHUB_REPO=devicescript\nGITHUB_REF=main\n")),(0,n.kt)("p",null,"Secrets are stored in the ",(0,n.kt)("inlineCode",{parentName:"p"},"./env.local")," file. This file is not part of the source code and ",(0,n.kt)("strong",{parentName:"p"},"should not be committed to a repository"),".\nThe GitHub token needs ",(0,n.kt)("inlineCode",{parentName:"p"},"repo:status")," scope (and no more). You can create a token in the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/settings/tokens"},"GitHub settings"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-yaml"},"# .env.local = secrets, do not commit\nGITHUB_TOKEN=...\n")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { readSetting } from "@devicescript/settings"\n\n// read configuration from ./env.defaults\nconst owner = await readSetting("GITHUB_OWNER")\nconst repo = await readSetting("GITHUB_REPO")\nconst ref = await readSetting("GITHUB_REF", "main")\n// read secret from ./env.local\nconst token = await readSetting("GITHUB_TOKEN")\n\nconsole.log({ owner, repo, ref })\n')),(0,n.kt)("h2",{id:"part-8-fetching-github-build-status"},"Part 8: Fetching GitHub Build Status"),(0,n.kt)("p",null,"DeviceScript provides a ",(0,n.kt)("a",{parentName:"p",href:"https://microsoft.github.io/devicescript/developer/net"},"Fetch API")," similar to the browser ",(0,n.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API"},"fetch"),". You can use it to issue web requests."),(0,n.kt)("p",null,"This snippet makes the query to github and updates the status.\nFeel free to remix it to integrate it into your current application"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { readSetting } from "@devicescript/settings"\nimport { fetch } from "@devicescript/net"\nimport { setStatusLight, schedule } from "@devicescript/runtime"\n\n// read configuration from ./env.defaults\nconst owner = await readSetting("GITHUB_OWNER")\nconst repo = await readSetting("GITHUB_REPO")\n// read ref or default to \'main\'\nconst ref = await readSetting("GITHUB_REF", "main")\n// read secret from ./env.local\nconst token = await readSetting("GITHUB_TOKEN", "")\n\nif (!owner || !repo) throw new Error("missing configuration")\n\n// track state of last fetch\nlet state: "failure" | "pending" | "success" | "error" | "" = ""\nlet blinki = 0\n\n// update status light\nsetInterval(async () => {\n blinki++\n let c = 0x000000\n if (state === "failure")\n c = blinki % 2 === 0 ? 0x100000 : 0x000000 // blink fast red\n else if (state === "pending")\n c = (blinki >> 1) % 2 === 0 ? 0x100500 : 0x000000 // blink slow orange\n else if (state === "success") c = 0x000a00 // solid green\n else c = 0x000000 // dark if any error\n await setStatusLight(c)\n}, 500)\n\n// query github every 5s\nschedule(\n async () => {\n const res = await fetch(\n `https://api.github.com/repos/${owner}/${repo}/commits/${ref}/status`,\n {\n headers: {\n Accept: "application/vnd.github+json",\n Authorization: token ? `Bearer ${token}` : undefined,\n "X-GitHub-Api-Version": "2022-11-28",\n },\n }\n )\n if (res.status === 200) {\n const json = await res.json()\n state = json.state\n console.log({ json, state })\n } else state = "error"\n },\n { timeout: 1000, interval: 5000 }\n)\n')),(0,n.kt)("p",null,"Memory is limited! Be careful about using Web APIs that return huge payloads as you will surely run out of memory..."))}u.isMDXComponent=!0},46005:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/autostart-e89b961cc32b221668cbd3cd9a25024d.png"},82707:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-1-30ce3afd44cffb315611a2948f1def98.png"},29703:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-2-1bdce9082d3ea7914efcb76d24c26e8b.png"},46826:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-3-7a0c8f8d9db092c71b636da2a349592b.png"},82875:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-4-1bdce9082d3ea7914efcb76d24c26e8b.png"},13242:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-5-82968f5529c50cd50b7a49d41b227d50.png"},93865:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-6-f8cd21cfbb4b74d7f156e2a683177492.png"},8352:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-7-d0ba0fcacc05e161bce54def0bab7436.png"},40271:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/image-8-ea42f66d02c3a45e4d7953c7e24ad61c.png"},40167:(e,t,a)=>{a.d(t,{Z:()=>r});const r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbMAAABnCAIAAAAFVztdAAAKq2lDQ1BJQ0MgUHJvZmlsZQAASImVlwdUU+kSgP970xstIQJSQm/SWwApIbQACtJBVEISIJQQA0HFjiyuwIoiIgI2dFVAwVUpYkcU2yKggH1BFhFlXSzYUHkXOITdfee9d96cM2e+TOafmf8/979nLgAUBa5YnAIrAJAqypAE+3gwIqOiGbghgAGqQBmQgDGXly5mBQUFAERm7N/lQw+AJu1ds8lc//7/fxVFviCdBwAUhHAcP52XivBpRF/yxJIMAFD7Eb/uigzxJLciTJMgDSJ8f5ITpnlkkuOmGA2mYkKD2QjTAMCTuVxJAgBkBuJnZPISkDxkd4QtRXyhCGExwq6pqWl8hE8gbITEID7yZH5m3F/yJPwtZ5wsJ5ebIOPpvUwJ3lOYLk7hrvo/j+N/S2qKdKaGAaLkRIlvMGKVkDO7n5zmL2NR3MLAGRbyp+KnOFHqGzbDvHR29AzzuZ7+srUpCwNmOF7ozZHlyeCEzrAg3StkhiVpwbJa8RI2a4a5ktm60uQwmT9RwJHlz0oMjZjhTGH4whlOTw7xn41hy/wSabCsf4HIx2O2rrds76npf9mvkCNbm5EY6ivbO3e2f4GINZszPVLWG1/g6TUbEyaLF2d4yGqJU4Jk8YIUH5k/PTNEtjYDeSBn1wbJzjCJ6xc0w4AN0kAKohLAAAHIL08AMgQrMyY3wk4Tr5IIExIzGCzkhgkYHBHPfB7D2tLaBoDJ+zr9OLyjT91DiH5z1rdpLwAupycmJs7O+vybATiVDwCxd9ZnuBYAucsAXC/nSSWZ076pu4QBRCAPaMjbQBPoAiNgBqyBPXAG7sAL+IFAEAqiwFLAA4kgFel8BVgDNoJckA+2gZ2gDOwDB8FRcBycBI3gHLgMroFboAN0g0egDwyCV2AUfADjEAThIApEhVQhLUgfMoWsISbkCnlBAVAwFAXFQgmQCJJCa6BNUD5UBJVBB6Aq6BfoDHQZugF1Qg+gfmgYegt9gVEwGabBGrABbAEzYRbsD4fCS+AEeDmcBefAW+FSuBI+BjfAl+FbcDfcB7+Cx1AARULRUdooMxQTxUYFoqJR8SgJah0qD1WCqkTVoppRbai7qD7UCOozGoumohloM7Qz2hcdhuahl6PXoQvQZeij6AZ0K/ouuh89iv6OoWDUMaYYJwwHE4lJwKzA5GJKMIcx9ZirmG7MIOYDFoulYw2xDlhfbBQ2CbsaW4Ddg63DXsJ2YgewYzgcThVninPBBeK4uAxcLm437hjuIq4LN4j7hCfhtfDWeG98NF6Ez8aX4KvxF/Bd+CH8OEGBoE9wIgQS+IRVhELCIUIz4Q5hkDBOVCQaEl2IocQk4kZiKbGWeJX4mPiORCLpkBxJi0hC0gZSKekE6Tqpn/SZrEQ2IbPJMWQpeSv5CPkS+QH5HYVCMaC4U6IpGZStlCrKFcpTyic5qpy5HEeOL7derlyuQa5L7rU8QV5fniW/VD5LvkT+lPwd+REFgoKBAluBq7BOoVzhjEKvwpgiVdFKMVAxVbFAsVrxhuILJZySgZKXEl8pR+mg0hWlASqKqktlU3nUTdRD1KvUQRqWZkjj0JJo+bTjtHbaqLKSsq1yuPJK5XLl88p9dBTdgM6hp9AL6SfpPfQvczTmsOYI5myZUzuna85Hlbkq7ioClTyVOpVulS+qDFUv1WTV7aqNqk/U0GomaovUVqjtVbuqNjKXNtd5Lm9u3tyTcx+qw+om6sHqq9UPqt9WH9PQ1PDREGvs1riiMaJJ13TXTNIs1rygOaxF1XLVEmoVa13UeslQZrAYKYxSRitjVFtd21dbqn1Au117XMdQJ0wnW6dO54kuUZepG69brNuiO6qnpbdAb41ejd5DfYI+Uz9Rf5d+m/5HA0ODCIPNBo0GLwxVDDmGWYY1ho+NKEZuRsuNKo3uGWONmcbJxnuMO0xgEzuTRJNykzumsKm9qdB0j2nnPMw8x3mieZXzes3IZiyzTLMas35zunmAebZ5o/lrCz2LaIvtFm0W3y3tLFMsD1k+slKy8rPKtmq2emttYs2zLre+Z0Ox8bZZb9Nk88bW1FZgu9f2vh3VboHdZrsWu2/2DvYS+1r7YQc9h1iHCodeJo0ZxCxgXnfEOHo4rnc85/jZyd4pw+mk05/OZs7JztXOL+YbzhfMPzR/wEXHhetywKXPleEa67rftc9N243rVun2zF3Xne9+2H2IZcxKYh1jvfaw9JB41Ht8ZDux17IveaI8fTzzPNu9lLzCvMq8nnrreCd413iP+tj5rPa55Ivx9ffd7tvL0eDwOFWcUT8Hv7V+rf5k/xD/Mv9nASYBkoDmBfACvwU7FjxeqL9QtLAxEARyAncEPgkyDFoedHYRdlHQovJFz4OtgtcEt4VQQ5aFVId8CPUILQx9FGYUJg1rCZcPjwmvCv8Y4RlRFNEXaRG5NvJWlFqUMKopGhcdHn04emyx1+Kdiwdj7GJyY3qWGC5ZueTGUrWlKUvPL5Nfxl12KhYTGxFbHfuVG8it5I7FceIq4kZ5bN4u3iu+O7+YPyxwERQJhuJd4oviXyS4JOxIGE50SyxJHBGyhWXCN0m+SfuSPiYHJh9JnkiJSKlLxafGpp4RKYmSRa1pmmkr0zrFpuJccd9yp+U7l49K/CWH06H0JelNGTRkMLotNZL+IO3PdM0sz/y0InzFqZWKK0Urb68yWbVl1VCWd9bPq9Greatb1miv2bimfy1r7YF10Lq4dS3rddfnrB/c4LPh6EbixuSNv2ZbZhdlv98Usak5RyNnQ87ADz4/1OTK5Upyezc7b973I/pH4Y/tW2y27N7yPY+fdzPfMr8k/2sBr+DmT1Y/lf40sTV+a3uhfeHebdhtom092922Hy1SLMoqGtixYEdDMaM4r/j9zmU7b5TYluzbRdwl3dVXGlDatFtv97bdX8sSy7rLPcrrKtQrtlR83MPf07XXfW/tPo19+fu+7Bfuv3/A50BDpUFlyUHswcyDzw+FH2r7mflz1WG1w/mHvx0RHek7Gny0tcqhqqpavbqwBq6R1gwfiznWcdzzeFOtWe2BOnpd/glwQnri5S+xv/Sc9D/Zcop5qva0/umKemp9XgPUsKphtDGxsa8pqqnzjN+Zlmbn5vqz5mePnNM+V35e+XzhBeKFnAsTF7Mujl0SXxq5nHB5oGVZy6MrkVfutS5qbb/qf/X6Ne9rV9pYbRevu1w/d8PpxpmbzJuNt+xvNdy2u13/q92v9e327Q13HO40dTh2NHfO77zQ5dZ1+a7n3Wv3OPdudS/s7uwJ67nfG9Pbd59//8WDlAdvHmY+HH+04THmcd4ThSclT9WfVv5m/Ftdn33f+X7P/tvPQp49GuANvPo9/fevgznPKc9LhrSGql5Yvzg37D3c8XLxy8FX4lfjI7l/KP5R8dro9ek/3f+8PRo5OvhG8mbibcE71XdH3tu+bxkLGnv6IfXD+Me8T6qfjn5mfm77EvFlaHzFV9zX0m/G35q/+39/PJE6MSHmSrhTowAKUTg+HoC3RwCgRAFA7UDmh8XT8/SUQNPfAFME/hNPz9xTYg9ALWImxyL2JQBOIGrgjuRG7ORIFOoOYBsbmc7MvlNz+qRgkS+W/Z6T9GDHkg3gHzI9w/+l739aMJnVFvzT/guPVQgoaRVXVQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAABs6ADAAQAAAABAAAAZwAAAAB0iHtgAAAWEUlEQVR4Ae2dD2xU1Z7Hz1AoIC11oT7Y8pSO60J1WYi0Q2IE2soa14R0x0dRtGOrTwjtixKmohCwklLYZYNYV01aolkDTp9/KDr0kRDjA8of1+TNjAZEbYnLlDXw4qPUlaFd+vpn9nfuuffOnT+FmaEzc2/ne9O05557/n7Ovd/5/X7ntjXNnDmTJffw+/3J7RC9gQAIgEBsBMbHVjyK0hC+KCChCAiAgK4JjJoyQhB1vc4YHAiAQCwEbkkZI6phxMxYhoSyIAACIJBiAvErY4gChpyq0xopXy2ABAiAAAjojUCcyhiid9pTbVpvs8V4QAAEQCAaAvEoo1b7RkpT39pL0QwFZUAABEBAJwRiVkat3qlpNUGz0qbDT3UybQwDBEAABG5AYDwdN7gcfkkVPpHQfqfCIVfDqyMHBEAABPRPYPzUqVOjH6VWByktDqquJPkr3JRWv2tbFvnaHKRBAARAQJ8Exvf29kY/Mq3qqWk1Idq57bbbJk+eTKaoyWSKvmWUBAEQAAH9EIjNlQ4Zt2oGikRmZmZOTs7Q0FB/f39fXx8lQsrjFARAAAQMQSAGZdTahlpNVGXx9ttvJwt0YGDAEDPHIEEABEBgJALjRrpw03xVHEVJshYhizeFhgIgAAKGIBCPMqqaSAmRptji4OAgrEVDLDkGCQIgcFMC8SgjNSoEUbROadpyodjiTTtDARAAARAwBIFolVErheETo53o4eHh8HzkgAAIgIARCUSrjOFzI61U5ZJe0IEyhiNCDgiAgEEJxK+MYsKqOBp0/hg2CIAACIQTiFkZw6UwPCe8G+SAAAiAgIEIxKyMBpobhgoCIAAC8RGI4U3v+Drw/+28nqLfXcuaHV911AIBEACB5BNIuDL2FNXMvHg0s/Nw8ueGHkEABEAgPgIJ96bJWoQsxrc2qAUCIJAqAglXxlRNDP2CAAiAQNwEoIxxo0NFEACBMUsAyjhmlxYTAwEQiJsAlDECur179+LP7kbggiwQSBsCUMa0WWpMFARAIGoCUMaoUaEgCIBA2hCAMqbNUmOiIAACUROAMkaNCgVBAATShgCUMW2WGhMFARCImgCUMWpUKAgCIJA2BNJOGefNm9fc3Pzkk0+mzRJjoiAAAjETSDtljJkQKoAACKQfgYT/rZ0bIJ01a9a6deuOHj362WefRSxGBV588cXc3Fxx9fDhwydOnKCcn376acaMGZRPOR988MEjjzzy+OOPT5gwgYpduHChrq5OlLfb7ffff79If/31142NjWQqPvroo5RD3+kQ1cmKfP755+nfH1J+d3f37t27RRV8BwEQSFsCqVTGixcvvv/++6RKjz322Ntvv3327FntMgjBunz5cm1tLeVr/d85c+Z8/PHHQk9JFqm6OBVK2tDQQOJI1UkrKysrqa6QTmqBZPSbb76hHo8fP05puiR6UU+pLikvfgFGuxBIg0AaEkilMhJuUsPq6mohT3Sq1ceHH364r6+PYoJiVYSQkfbR6aVLl1Qz88EHH+zs7BSnJLUul6u4uJgapJbpEHUpQeI4c+ZMcar9Tr2Q+IrGKf/UqVOks9oCSIMACKQhgRQroyBOykX6SOJF/u8vv/xC/ixp3LRp03788UdKhK9KT0+PyCShzMrKys/P37dvn1qM9FSkheAKN5lyqDW1jJqgXmbPnq2tPjAwoF5FAgRAID0J6EIZCT25saRQIhoY60qIcGFILRFkFJeElx1SQD0N75T+ooR6FQkQAIE0JJBiZVTNOpIwdedELAMZhnfeeSeJWkSzUZShS9euXbvvvvtCVo5qUV2SPNVNDimgnkbTi1oYCRAAgTQhkMq3dki/nn766U8//ZT2ScIl7PPPPydHmLxssRK0f0JH+Kp8//33ZGyql8glr6mpIcXs7e0lT1mUp51rdYP7559/JndbjTl+9913OTk5VECUJKV++eWXsQMTzhk5IJBWBFJpM5J+bdy4cSTcFHykDRnaRxZBQJIzOg0vLCRVvIVDV9ViH330kVr322+/pddxRF3qlHZpqDw1q7rhpIyiFwoy0jY36WN4R8gBARBIHwImMriima3f7xfFhoeHKUGn2iMvL0/dFQlp7cKTh+5reyIkU+enFGd85plnaII6HyeGBwIgkCACqfSmEzQlNAsCIAACt0gAyniLAFEdBEBgDBKAMo7BRcWUQAAEbpFAKndgbnHoiateVVWVuMbRMgiAgP4JwGbU/xphhCAAAskmAGVMNnH0BwIgoH8CUEb9rxFGCAIgkGwCCVfGrGsX+uf8c7Knhf5AAARA4BYIJHwHZpq76aei310r+O0tDBJVQQAEQCCpBBL+OzBJnQ06AwEQAIHRIJBwb3o0Bok2QAAEQCCpBKCMScWNzkAABAxBAMpoiGXCIEEABJJKAMqYVNzoDARAwBAEoIyGWCYMEgRAIKkEoIxJxY3OQAAEDEEAymiIZcIgQQAEkkoAyphU3OgMBEDAEAQS+zswEydOnDRp0vjxie3FEKAxSBAAAQMRSKBmkSxmZWUZiAWGCgIgAAKCQAK9abIWQRkEQAAEjEgggcoIJ9qINwTGDAIgQAQSqIzgCwIgAAIGJQBlNOjCYdggAAIJJABlTCBcNA0CIGBQAmNSGW1NxzyeA3VJXxJbc3tK+k36RA3WYaruB4NhwnC1BBL41o62m5ukK5rbay3ZQYW8zsLyhqCcJJ3Ymo/ZLVOVznyu10tqWphfOU/BzwdarxebNf36JnxYktGlyUh+UqyXz9VYWuPwB9hwdAWdjSXVjlEbUt1+t/VuU6A5b1vRynpNl4ErSIHAaBLQj81IGlRYVCgfje5cq8fTvsdm0jwVUc/bUVNaWLgiHl2tO+Dhz3aRPJBGd3fUnVJBR3VJVP3a9rR72pujmJtt6AVPsCzGMpwoyvqXH7u+yXO9Mi77OtuyurkirgWKYmSaIqSG8m3R5s0vc+/fGmuf8d8PbGurx9NaF2uHmsEjaVAC+lHGIICOtSWFbd7sotVNTyXzrqxbkO9zvVPTohgljrXl1akzGIcr1w9MkbBcck7aWSi+Jp6NSayDqIad2IbNqnUcdvEmGT6XW16gmxQcxcv15Qe9fvP8V1g8n5ejOA40NfYJ6MObjsi53ukqtRcsrWC/d3BvVutxdzm5SUif52XMWbSyQREyssXsczsaS08tPmovONdYslZ4dRRmsi9SFEB1x8g8tOaLjslcLa1uEV5hdqDH0FHVtXqsilsrVWFN7bUFHW0dBWUUCiD33zmrXfImqd+KpmO193a+/i5bY5fDBGLMjGKRIsdid7vt5JCWXLR6rLnuxtJqrWPKWH7TUJ4kACSL+wL2r+lQeQZjZOv1z6MpeTOPs7+Sr93rmvhWjYm9MrjJOigPm5zu0owuPqnhSs9f8wKTyTjbOOGQg9ofWLVoSGTnWa9vssr5rC5iI4H6aurESmeuy7qmydYS2X2ua3VbzULDeFCCPmN4jumgYs5LKK44i8rFAhLeZd2vlwY+l9SONAlvt48VzKpgJsfW/Xz125i1zMw4Rj4GfgMUKVEZGThV5jfAvYH7QeOhKxVFDyHVncwq7hCr223l65ua8I5m9kgmj4BObUYJgOPiFZadK2kRl8WCDtndbvzTNCvfYKk/7WXmBa+qBkSdtSjbe4yeLG1YkB4D+6Iep+qOCf3jjyhTMg9eLqo91lxBfTaUt3mziuzucP+poqld0i/RTqPrsrJE2ZZS9i73vsMfm2xL7Wr2jqjhPD9bGrPkcTe6rvKHmWqNHJLzzyuQZMs34URAFpVO1Z9mLoviIKULyCJlZQ+sOjaUT8Jk8+eo5XliaJ59YLmNqdi0F/ObIzWiLRGU3r7i4Pksy+o91FrowT94TAflsERbt6W2nQhv/8brz18gu+4ViwtIxPIXyBbg1gVm1n3x99q1C22Tzs252ezKRcWON1vnn+ZdSBh5JKSo2yl32eiabuUhi9A2uCya/iAXcl6x2JWwhlxdvlGc5/2sYUUhOS708SO1Gb6+oU3jfCwR0LMyMm4gSEfdbyzM/a7i2Dpqjp2nJ6qONZzuYgHfij9a3tPbgh4t255ld19zNZZvl9esvpzH7yuaHjJ3OdVA5LaDrqtkKkoPUX15USFXMbc7aJe57jFLdpdTMUJJ3lYqNibzHqOk0Fu5E9X/97ZxQ0k6Gla2iTHLZTQ/Gsrp0V4bbDCSVThNsX00RcOTZOhxL/utav/SIq6kZDxKfnfmJRpS9vA80ntHxluyJ04lMy/xNobMi/1dNRN2Nk7olZqUvHUyJIcjNxImL1Il6RufFwU9pM+VQC4Z+Mvyvc7y7TIYMv99EuFtZ7z+XDL56LAtLcju8npZ7qynpNO8XNZ1envQ6mkalJJk01nN11yfqKV8rk8a5Bq8R7JM1S4d1e/wPheTealpht8PF5wrt8njavhEKvMUM1U0ierKp1DDSiihhlsaJnXsTQsDga+JbdZ0lp1v93jsmhWiD3NGd/ZDtdzooOejbr7Z525UHxpRkkwMX+cpxcRQav8dGR5m2uGxKhn0U9ZgntOwsogeEO47ezwLJB/Kljfd5G1XnhpNLarX/UPQueYk+NJ/k8zfy0VB1kpNwUhJU4+P5SkhgEgFpDzfuLNyxMCfIynAFEv/Jo9afGiaeQJ3vdv750Wjs2RdjtiI2mZoYttK5wKPdU0z+dSBS/dIhLkTGjgkwvRhl30vfQi1OGhpvGdKTjP3MgqYtLDFc8neV2QuUImnzGVucpylg8y3QPCEkY2pLi316OsIWumWUx1rLLn3iIryd25y5kvOcSBbGpdSPZCNVHoT0LMyckH0HiOt4zaGt62wvD5srejuX20nh5rV882Tjk8cN7Q5NNWDA0yaC2qSTDkvxQSX7bFt1zzy6uVEJ0xXaKeFlJHsPltGl5C/8D67TV0i0+wXezUhRXJm+R9olWVRileGxByDi4/cSGTfW67dsIJrI/nU72rtMyIc/E6PKP1F53OLChbbKAyS7z29gjW86v2XhxbbKlhBtvdIfeTVo9BweX2QVR487NjO6OMzNKRLDdAthAMENAT0603b9qy2MJeTe8c84GieL4enNIOnpOOLzqvcoSZXOsRkkMpxE2VuiEfFGJlvkp8V3FT4mRrodFy6QluiEQcQXityjm1JgTBqIl8Oz/3yjPjUUsKCconhyvah/PDSXpPwixVvWt7LfquaTc/lpeVtnNCYY3BDIzaidUiDq4gzHp8ln3oxU/bNf5AIk5caVtpxssNHwWNar67T3Agn/zor10wmmzgNKx9thuhR6zvzOGaw2U6frxHvB+oj2lsi2uGgnNEJ6FMZ+S+T8Gg6RdaliFDDGS85Qa1blSetoqlVifo7qo+en72gdb6Z4n3hlpVj7RHaIrC3viKv09ZW/jZcyxcdV7Mt5AAqq1fXul+SvbrWA5p313joinnPcBev4VOXL99K71eKGrbm/fQmn1J7pJ+0A9Mqq2lF03OWqeTXixE6LnX75a0lqktue8Q3NxvGf/inDKltEkf+1qH0pd1l1nTsyHCf56eSN60Ubh1WgDG++0wt2OXXgOSaDtMvki0mXR1YzjLcPEYR1ohc+kY/6sudXdmWIrNchmx5HxFuUl93rDugoCD4PjNtKHOw/CCx4qe+bqlruX7sP1qqj9AAaltfkaO8tuY1FBo+osSm5QYdJ/jKa17DVFa8pUZUVz796vaL8ZLgSpFQsdi0SyO/iErvHtCLjlup2ZGWL/YpoIaeCAi7RA8jotva466VR0IuT6H8zo2UU19eyOgdHY9bjTcVqjLYcKaL3g7xOldEnAUFDRltRypBRQpUcSO0ppSRp6xGLqm7ElE7KAhFEf1CeQulpaaEatQqNchVrGFM2jqI2KuU6XO1dS9TOuZdqDOiPZ9SOw93caf+4ogt8E0SlhH8zg3r7RjXxdi8sEpfrpz0Z82LOMp106GSzGnyWzu0XZMxza7V1nH7Do7X7mh/WT7pz80DqyxDSvXof5JPPZ9+X0WuQC+9M3pXhr+ZJOUECDPHqc7VlqLu0/WiKFn9zy2ymDpOqAsafZ9BJWkrmdGGuBLcDL2FRNmW6lIaV21gXPQ6kfDh5erKepELz2uQ4P7GY611u2v5WztB/eFkTBMwzZ49O5oJ+uXdPDY8PEzl6VR75OXl9fT0hLQzffr0kJw0OpXfZ1T3ptNo6vqbKn+f8Y72SHFq/Y0VI9IJAX160zqBg2GMDQJ8RxoHCMREAMoYEy4UNh4BW/ND9E6rU3bejTd+jDglBPQTZ0zJ9NHpWCbAfw8nnyZIweWaW41ijmVOmFsEAgmMM+bk5OBfwURAjiwQAAHdE0igN339+nXdTx8DBAEQAIEIBBLoTff391OH9L9VYTlGAI8sEAABHRNIoDLSrNU3e3RMAEMDARAAgVACCVRGk8lELz/29fWF9olzEAABENA3gQQqIxmMg4OD+p4+RgcCIAACEQgkcAcmQm/IAgEQAAEjEIAyGmGVMEYQAIHkEoAyJpc3egMBEDACASijEVYJYwQBEEguAShjcnmjNxAAASMQgDIaYZUwRhAAgeQSGFvKWLxl74F9W4rFH2BOLkipt6rdBw7sruJ/Vbp4szSSFIwBXSaYwJLN/3lg36YlKbvJEjw9NC8IJPB9xjgQV73WWib/73Ze23toxUvvib+4HEdjI1ch2VpXmKVc73W9UbXzpF85Nd7Ph/445dF7NMO+2v/O/MFzmozkJ4u37Fu3cMrVr9747Q4t2SUb964vOPfGsztOjtqQqna1lt0dUKner96s2nHcwIs5amDQ0K0R0I0ySs8Sc71RvkF5lJ59bd+MJYyN3kMkSD27q3X5jK/fLJefn+Itux64NYSprL1m/KtbJibyz7KaVp2+rTCH/c9HvW9tjHmiUxeu2bjkVOI/dbyHyje8x9VwyaZ969ftqjrx0l7lT9DHPGZUAAGJgE6Useq1dQv/EmIhvrehMgGLVPUP5j7Xf/yralYc3/HS8QR0k5Qmx72wWZZFrlyb6PfUqVvTqj+K/6s1GkNYk/H3OfG20/uV6y8LLWs2F59KmhF3cueRstZlv17KmGHXNF7aqDfKBHShjEs2LTOT5zWy48xtAYvyD5W72so3BGwC7qAtEp5x71eHOgN+FYESPp0g1tW24sW9Ijll7tLFppOKaRoAqu2FXOzKnZK5SrHLdXPPvXnkb9aVmaWywd531WsH5HzW1dYWaEyklmx5b/1C+q/RdGgGQGeaYfNLYkbSANhXb1bukB5sqczlthXf/OOBsl+Fu/xzWjLvkqYbbND5P/wn+pVM2dZjP/zfYTaZfG3ff/Vtq/Czf8vctWqCNBzGyOleMHiOi+m4F7om3yXn0o8hz47rH77D5rRMWvOgLLJ3PTFl1xNyPvv3zF1PhDcSqK+mvnyp7Y79Zc9sXnI8svtMYdmyfFGavGA+ax5OMf1BWV+JXo+63IR62c83dpaLf/0rE/tf0SRf/bmdhzrnLl84hf5d+YoNe6l5dbHkHCpKcUPu4h+5Y708mOAggPaukBbxvGi+Uh18cHlxFd+NTuD/ATZF+EsclG+IAAAAAElFTkSuQmCC"},27674:(e,t,a)=>{a.d(t,{Z:()=>r});const r=a.p+"assets/images/play-cd1822c16b71cd6b6678dcaf2821eda2.png"}}]); \ No newline at end of file diff --git a/assets/js/934e9f4c.82a2a8fe.js b/assets/js/934e9f4c.82a2a8fe.js new file mode 100644 index 00000000000..93a4dc29db5 --- /dev/null +++ b/assets/js/934e9f4c.82a2a8fe.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4507],{35318:(I,i,b)=>{b.d(i,{Zo:()=>g,kt:()=>n});var m=b(27378);function c(I,i,b){return i in I?Object.defineProperty(I,i,{value:b,enumerable:!0,configurable:!0,writable:!0}):I[i]=b,I}function l(I,i){var b=Object.keys(I);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(I);i&&(m=m.filter((function(i){return Object.getOwnPropertyDescriptor(I,i).enumerable}))),b.push.apply(b,m)}return b}function Z(I){for(var i=1;i<arguments.length;i++){var b=null!=arguments[i]?arguments[i]:{};i%2?l(Object(b),!0).forEach((function(i){c(I,i,b[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(b)):l(Object(b)).forEach((function(i){Object.defineProperty(I,i,Object.getOwnPropertyDescriptor(b,i))}))}return I}function e(I,i){if(null==I)return{};var b,m,c=function(I,i){if(null==I)return{};var b,m,c={},l=Object.keys(I);for(m=0;m<l.length;m++)b=l[m],i.indexOf(b)>=0||(c[b]=I[b]);return c}(I,i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(I);for(m=0;m<l.length;m++)b=l[m],i.indexOf(b)>=0||Object.prototype.propertyIsEnumerable.call(I,b)&&(c[b]=I[b])}return c}var t=m.createContext({}),a=function(I){var i=m.useContext(t),b=i;return I&&(b="function"==typeof I?I(i):Z(Z({},i),I)),b},g=function(I){var i=a(I.components);return m.createElement(t.Provider,{value:i},I.children)},s="mdxType",S={inlineCode:"code",wrapper:function(I){var i=I.children;return m.createElement(m.Fragment,{},i)}},W=m.forwardRef((function(I,i){var b=I.components,c=I.mdxType,l=I.originalType,t=I.parentName,g=e(I,["components","mdxType","originalType","parentName"]),s=a(b),W=c,n=s["".concat(t,".").concat(W)]||s[W]||S[W]||l;return b?m.createElement(n,Z(Z({ref:i},g),{},{components:b})):m.createElement(n,Z({ref:i},g))}));function n(I,i){var b=arguments,c=i&&i.mdxType;if("string"==typeof I||c){var l=b.length,Z=new Array(l);Z[0]=W;var e={};for(var t in i)hasOwnProperty.call(i,t)&&(e[t]=i[t]);e.originalType=I,e[s]="string"==typeof I?I:c,Z[1]=e;for(var a=2;a<l;a++)Z[a]=b[a];return m.createElement.apply(null,Z)}return m.createElement.apply(null,b)}W.displayName="MDXCreateElement"},50021:(I,i,b)=>{b.r(i),b.d(i,{assets:()=>t,contentTitle:()=>Z,default:()=>S,frontMatter:()=>l,metadata:()=>e,toc:()=>a});var m=b(25773),c=(b(27378),b(35318));const l={},Z="Transform operators",e={unversionedId:"api/observables/transform",id:"api/observables/transform",title:"Transform operators",description:"map",source:"@site/docs/api/observables/transform.mdx",sourceDirName:"api/observables",slug:"/api/observables/transform",permalink:"/devicescript/api/observables/transform",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Filter Operators",permalink:"/devicescript/api/observables/filter"},next:{title:"Utilities operators",permalink:"/devicescript/api/observables/utils"}},t={},a=[{value:"map",id:"map",level:2},{value:"scan",id:"scan",level:2},{value:"timestamp",id:"timestamp",level:2},{value:"switchMap",id:"switchmap",level:2}],g={toc:a},s="wrapper";function S(I){let{components:i,...l}=I;return(0,c.kt)(s,(0,m.Z)({},g,l,{components:i,mdxType:"MDXLayout"}),(0,c.kt)("h1",{id:"transform-operators"},"Transform operators"),(0,c.kt)("h2",{id:"map"},"map"),(0,c.kt)("p",null,"Applies a converter function to converts the observed value into a new value."),(0,c.kt)("img",{alt:"output.svg",src:b(5405).Z,width:"312",height:"260"}),(0,c.kt)("pre",null,(0,c.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, map } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs\n // highlight-next-line\n .pipe(map(v => v * v))\n .subscribe(v => console.log(v))\n')),(0,c.kt)("h2",{id:"scan"},"scan"),(0,c.kt)("p",null,'Applies an accumulator (or "reducer function") to each value from the source.'),(0,c.kt)("img",{alt:"output.svg",src:b(63522).Z,width:"372",height:"260"}),(0,c.kt)("pre",null,(0,c.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, scan } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs.pipe(\n // highlight-next-line\n scan((p, c) => p + c, 0)\n).subscribe(v => console.log(v))\n')),(0,c.kt)("h2",{id:"timestamp"},"timestamp"),(0,c.kt)("p",null,"Wraps value in an object with a ",(0,c.kt)("inlineCode",{parentName:"p"},"timestamp")," property and ",(0,c.kt)("inlineCode",{parentName:"p"},"lastTimestamp")," property."),(0,c.kt)("img",{alt:"output.svg",src:b(21622).Z,width:"232",height:"410"}),(0,c.kt)("pre",null,(0,c.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, timestamp } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs.pipe(\n // highlight-next-line\n timestamp()\n).subscribe(v => console.log(v))\n')),(0,c.kt)("h2",{id:"switchmap"},"switchMap"),(0,c.kt)("p",null,"Takes a source Observable and calls transform(T) for each emitted value.\nIt will immediately subscribe to any Observable coming from transform(T), b\nut in addition to this, will unsubscribe() from any prior Observables -\nso that there is only ever one Observable subscribed at any one time."),(0,c.kt)("img",{alt:"output.svg",src:b(26265).Z,width:"702",height:"260"}),(0,c.kt)("pre",null,(0,c.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, switchMap } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs.pipe(\n // highlight-next-line\n switchMap(v => from([v + 1, v + 1, v + 1]))\n).subscribe(v => console.log(v))\n')))}S.isMDXComponent=!0},63522:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzIwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjMxMCwxOS4yMjY0OTczMDgxMDM3NDIgMzIwLDI1IDMxMCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEzMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDM1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MTwvdGV4dD48L2c+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgNzApIj48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjMyMC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjE2MS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIzMjIuMzA5NDAxMDc2NzU4NSI+c2NhbigocCwgYykgPSZndDsgcCArIGMsIDApPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSIzMjAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMzEwLDE5LjIyNjQ5NzMwODEwMzc0MiAzMjAsMjUgMzEwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI1MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+NjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxNDcsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4zPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},5405:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMTIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzMTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjYwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjI1MCwxOS4yMjY0OTczMDgxMDM3NDIgMjYwLDI1IDI1MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDM1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MTwvdGV4dD48L2c+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgNzApIj48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjI2MC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjEzMS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIyNjIuMzA5NDAxMDc2NzU4NSI+bWFwKHggPSZndDsgeCAqIHgpPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSIyNjAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMjUwLDE5LjIyNjQ5NzMwODEwMzc0MiAyNjAsMjUgMjUwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTc1LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+OTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxMTcsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj40PC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},26265:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3MDIuMzA5NDAxMDc2NzU4NSAyNjAiIHdpZHRoPSI3MDIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI3MDIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIyNjAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iNDcwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjQ2MCwxOS4yMjY0OTczMDgxMDM3NDIgNDcwLDI1IDQ2MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0MDAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDExNywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjQ8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTQ3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MzwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjIwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMzUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4xPC90ZXh0PjwvZz48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA3MCkiPjxyZWN0IHg9IjEiIHk9IjExIiB3aWR0aD0iNjUwLjMwOTQwMTA3Njc1ODUiIGhlaWdodD0iNDgiIGZpbGw9IndoaXRlIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHJ4PSIwIi8+PHRleHQgeD0iMzI2LjE1NDcwMDUzODM3OTI1IiB5PSIzNSIgZmlsbD0iYmxhY2siIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjI0cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgd2lkdGg9IjY1Mi4zMDk0MDEwNzY3NTg1Ij5zd2l0Y2hNYXAodiA9Jmd0OyBmcm9tKFt2KzEsIHYrMSwgdisxXSkpPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE2MCkiPjxnPjxsaW5lIHgxPSIwIiB5MT0iMjUiIHgyPSI2NTAiIHkyPSIyNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iNjQwLDE5LjIyNjQ5NzMwODEwMzc0MiA2NTAsMjUgNjQwLDMwLjc3MzUwMjY5MTg5NjI1OCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDU4MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTcwLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+NTwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDkwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxNzAsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj41PC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0MDAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE3MCwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjU8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMxMCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMTE3LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+NDwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjIwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgxNDcsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4zPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDIwNiwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjI8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMDYsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4yPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},21622:(I,i,b)=>{b.d(i,{Z:()=>m});const m="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMzIuMzA5NDAxMDc2NzU4NSA0MTAiIHdpZHRoPSIyMzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSI0MTAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyMzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSI0MTAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIHRyYW5zbGF0ZSgzMCAwKSI+PGc+PGc+PGxpbmUgeDE9IjAiIHkxPSI2MCIgeDI9IjE1MCIgeTI9IjYwIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48cG9seWxpbmUgcG9pbnRzPSIxNDAsNTQuMjI2NDk3MzA4MTAzNzQ1IDE1MCw2MCAxNDAsNjUuNzczNTAyNjkxODk2MjUiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzAgMCkiPjxlbGxpcHNlIGN4PSI2MCIgY3k9IjYwIiByeD0iNTkiIHJ5PSI1OSIgZmlsbD0iaHNsKDMyMSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg2MCA2MCkiPmE8L3RleHQ+PC9nPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDE0MCkgdHJhbnNsYXRlKC0zMCAwKSI+PHJlY3QgeD0iMSIgeT0iMTEiIHdpZHRoPSIxODAuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSI1OCIgZmlsbD0id2hpdGUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgcng9IjAiLz48dGV4dCB4PSI5MS4xNTQ3MDA1MzgzNzkyNSIgeT0iNDAiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIxODIuMzA5NDAxMDc2NzU4NSI+dGltZXN0YW1wKCk8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMjQwKSI+PGc+PGxpbmUgeDE9IjAiIHkxPSI2MCIgeDI9IjE1MCIgeTI9IjYwIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48cG9seWxpbmUgcG9pbnRzPSIxNDAsNTQuMjI2NDk3MzA4MTAzNzQ1IDE1MCw2MCAxNDAsNjUuNzczNTAyNjkxODk2MjUiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzAgMCkiPjxlbGxpcHNlIGN4PSI2MCIgY3k9IjYwIiByeD0iNTkiIHJ5PSI1OSIgZmlsbD0iaHNsKDEwLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYwIDYwKSI+eyB2YWx1ZTogYSwgLi4uIH08L3RleHQ+PC9nPjwvZz48L2c+PC9zdmc+"}}]); \ No newline at end of file diff --git a/assets/js/935f2afb.4907daa6.js b/assets/js/935f2afb.4907daa6.js new file mode 100644 index 00000000000..f85531aab07 --- /dev/null +++ b/assets/js/935f2afb.4907daa6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[53],{1109:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"DeviceScript","href":"/devicescript/intro","docId":"intro"},{"type":"category","label":"Getting Started","collapsible":true,"collapsed":true,"items":[{"type":"category","label":"Visual Studio Code Extension","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Simulation","href":"/devicescript/getting-started/vscode/simulation","docId":"getting-started/vscode/simulation"},{"type":"link","label":"User Interface","href":"/devicescript/getting-started/vscode/user-interface","docId":"getting-started/vscode/user-interface"},{"type":"link","label":"Debugging","href":"/devicescript/getting-started/vscode/debugging","docId":"getting-started/vscode/debugging"},{"type":"link","label":"Troubleshooting","href":"/devicescript/getting-started/vscode/troubleshooting","docId":"getting-started/vscode/troubleshooting"},{"type":"link","label":"Local and Remote Workspaces","href":"/devicescript/getting-started/vscode/workspaces","docId":"getting-started/vscode/workspaces"}],"href":"/devicescript/getting-started/vscode/"},{"type":"link","label":"Command Line","href":"/devicescript/getting-started/cli","docId":"getting-started/cli"}],"href":"/devicescript/getting-started/"},{"type":"category","label":"Developer","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Console output","href":"/devicescript/developer/console","docId":"developer/console"},{"type":"link","label":"Status Light","href":"/devicescript/developer/status-light","docId":"developer/status-light"},{"type":"link","label":"Clients","href":"/devicescript/developer/clients","docId":"developer/clients"},{"type":"link","label":"Board Configuration","href":"/devicescript/developer/board-configuration","docId":"developer/board-configuration"},{"type":"link","label":"Register","href":"/devicescript/developer/register","docId":"developer/register"},{"type":"link","label":"Commands","href":"/devicescript/developer/commands","docId":"developer/commands"},{"type":"category","label":"Drivers","collapsible":true,"collapsed":true,"items":[{"type":"category","label":"Digital IO","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Wire","href":"/devicescript/developer/drivers/digital-io/wire","docId":"developer/drivers/digital-io/wire"}],"href":"/devicescript/developer/drivers/digital-io/"},{"type":"link","label":"Analog","href":"/devicescript/developer/drivers/analog","docId":"developer/drivers/analog"},{"type":"link","label":"SPI","href":"/devicescript/developer/drivers/spi","docId":"developer/drivers/spi"},{"type":"link","label":"I2C","href":"/devicescript/developer/drivers/i2c","docId":"developer/drivers/i2c"},{"type":"link","label":"Serial","href":"/devicescript/developer/drivers/serial","docId":"developer/drivers/serial"},{"type":"link","label":"Custom Services","href":"/devicescript/developer/drivers/custom-services","docId":"developer/drivers/custom-services"}],"href":"/devicescript/developer/drivers/"},{"type":"link","label":"JSON","href":"/devicescript/developer/json","docId":"developer/json"},{"type":"link","label":"Observables","href":"/devicescript/developer/observables","docId":"developer/observables"},{"type":"link","label":"Settings and Secrets","href":"/devicescript/developer/settings","docId":"developer/settings"},{"type":"link","label":"Testing","href":"/devicescript/developer/testing","docId":"developer/testing"},{"type":"category","label":"Graphics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Image","href":"/devicescript/developer/graphics/image","docId":"developer/graphics/image"},{"type":"link","label":"Display","href":"/devicescript/developer/graphics/display","docId":"developer/graphics/display"}],"href":"/devicescript/developer/graphics/"},{"type":"link","label":"JSX/TSX","href":"/devicescript/developer/jsx","docId":"developer/jsx"},{"type":"category","label":"LEDs","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Display","href":"/devicescript/developer/leds/display","docId":"developer/leds/display"},{"type":"link","label":"LED Driver","href":"/devicescript/developer/leds/driver","docId":"developer/leds/driver"}],"href":"/devicescript/developer/leds/"},{"type":"link","label":"MCU Temperature","href":"/devicescript/developer/mcu-temperature","docId":"developer/mcu-temperature"},{"type":"link","label":"Low Power","href":"/devicescript/developer/low-power","docId":"developer/low-power"},{"type":"category","label":"Network and Sockets","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Encrypted Fetch","href":"/devicescript/developer/net/encrypted-fetch","docId":"developer/net/encrypted-fetch"},{"type":"link","label":"MQTT client","href":"/devicescript/developer/net/mqtt","docId":"developer/net/mqtt"}],"href":"/devicescript/developer/net/"},{"type":"category","label":"Packages","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Custom Packages","href":"/devicescript/developer/packages/custom","docId":"developer/packages/custom"}],"href":"/devicescript/developer/packages/"},{"type":"link","label":"Bundled firmware","href":"/devicescript/developer/bundle","docId":"developer/bundle"},{"type":"link","label":"Simulation","href":"/devicescript/developer/simulation","docId":"developer/simulation"},{"type":"category","label":"IoT Platforms","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Adafruit.io","href":"/devicescript/developer/iot/adafruit-io/","docId":"developer/iot/adafruit-io/index"},{"type":"link","label":"Blues.io","href":"/devicescript/developer/iot/blues-io/","docId":"developer/iot/blues-io/index"},{"type":"link","label":"Blynk.io","href":"/devicescript/developer/iot/blynk-io/","docId":"developer/iot/blynk-io/index"},{"type":"link","label":"Matlab ThingSpeak","href":"/devicescript/developer/iot/matlab-thingspeak/","docId":"developer/iot/matlab-thingspeak/index"}],"href":"/devicescript/developer/iot/"},{"type":"link","label":"Cryptography","href":"/devicescript/developer/crypto","docId":"developer/crypto"},{"type":"category","label":"Development Gateway","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Messages","href":"/devicescript/developer/development-gateway/messages","docId":"developer/development-gateway/messages"},{"type":"link","label":"Application Telemetry","href":"/devicescript/developer/development-gateway/telemetry","docId":"developer/development-gateway/telemetry"},{"type":"link","label":"Environment","href":"/devicescript/developer/development-gateway/environment","docId":"developer/development-gateway/environment"},{"type":"link","label":"Configuration","href":"/devicescript/developer/development-gateway/configuration","docId":"developer/development-gateway/configuration"},{"type":"link","label":"Development Gateway","href":"/devicescript/developer/development-gateway/gateway","docId":"developer/development-gateway/gateway"}],"href":"/devicescript/developer/development-gateway/"},{"type":"link","label":"Errors","href":"/devicescript/developer/errors","docId":"developer/errors"}],"href":"/devicescript/developer/"},{"type":"category","label":"Samples","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Status Light Blinky","href":"/devicescript/samples/status-light-blinky","docId":"samples/status-light-blinky"},{"type":"link","label":"Blinky","href":"/devicescript/samples/blinky","docId":"samples/blinky"},{"type":"link","label":"Schedule Blinky","href":"/devicescript/samples/schedule-blinky","docId":"samples/schedule-blinky"},{"type":"link","label":"Double Blinky","href":"/devicescript/samples/double-blinky","docId":"samples/double-blinky"},{"type":"link","label":"Button LED","href":"/devicescript/samples/button-led","docId":"samples/button-led"},{"type":"link","label":"Dimmer","href":"/devicescript/samples/dimmer","docId":"samples/dimmer"},{"type":"link","label":"Weather Display","href":"/devicescript/samples/weather-display","docId":"samples/weather-display"},{"type":"link","label":"Weather Dashboard","href":"/devicescript/samples/weather-dashboard","docId":"samples/weather-dashboard"},{"type":"link","label":"Copy Paste Button","href":"/devicescript/samples/copy-paste-button","docId":"samples/copy-paste-button"},{"type":"link","label":"Thermostat","href":"/devicescript/samples/thermostat","docId":"samples/thermostat"},{"type":"link","label":"GitHub Build Status","href":"/devicescript/samples/github-build-status","docId":"samples/github-build-status"},{"type":"link","label":"Temperature + MQTT","href":"/devicescript/samples/temperature-mqtt","docId":"samples/temperature-mqtt"},{"type":"link","label":"Homebridge + Humidity Sensor","href":"/devicescript/samples/homebridge-humidity","docId":"samples/homebridge-humidity"},{"type":"link","label":"Thermostat + Gateway","href":"/devicescript/samples/thermostat-gateway","docId":"samples/thermostat-gateway"},{"type":"link","label":"Workshop","href":"/devicescript/samples/workshop/","docId":"samples/workshop/index"}],"href":"/devicescript/samples/"},{"type":"category","label":"Language Reference","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Async/await and promises","href":"/devicescript/language/async","docId":"language/async"},{"type":"link","label":"toString() method","href":"/devicescript/language/tostring","docId":"language/tostring"},{"type":"link","label":"Strings and Unicode","href":"/devicescript/language/strings","docId":"language/strings"},{"type":"link","label":"Special objects","href":"/devicescript/language/special","docId":"language/special"},{"type":"link","label":"Tree-shaking","href":"/devicescript/language/tree-shaking","docId":"language/tree-shaking"},{"type":"link","label":"Runtime implementation","href":"/devicescript/language/runtime","docId":"language/runtime"},{"type":"link","label":"Bytecode","href":"/devicescript/language/bytecode","docId":"language/bytecode"},{"type":"link","label":"Other differences with JavaScript","href":"/devicescript/language/devicescript-vs-javascript","docId":"language/devicescript-vs-javascript"},{"type":"link","label":"Hex template literal","href":"/devicescript/language/hex","docId":"language/hex"}],"href":"/devicescript/language/"},{"type":"category","label":"Devices","collapsible":true,"collapsed":true,"items":[{"type":"category","label":"ESP32","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Adafruit Feather ESP32-S2","href":"/devicescript/devices/esp32/adafruit-feather-esp32-s2","docId":"devices/esp32/adafruit-feather-esp32-s2"},{"type":"link","label":"Adafruit QT Py ESP32-C3 WiFi","href":"/devicescript/devices/esp32/adafruit-qt-py-c3","docId":"devices/esp32/adafruit-qt-py-c3"},{"type":"link","label":"Espressif ESP32 (bare)","href":"/devicescript/devices/esp32/esp32-bare","docId":"devices/esp32/esp32-bare"},{"type":"link","label":"ESP32-C3FH4-RGB","href":"/devicescript/devices/esp32/esp32-c3fh4-rgb","docId":"devices/esp32/esp32-c3fh4-rgb"},{"type":"link","label":"Espressif ESP32-DevKitC","href":"/devicescript/devices/esp32/esp32-devkit-c","docId":"devices/esp32/esp32-devkit-c"},{"type":"link","label":"Espressif ESP32-C3 (bare)","href":"/devicescript/devices/esp32/esp32c3-bare","docId":"devices/esp32/esp32c3-bare"},{"type":"link","label":"Espressif ESP32-C3-RUST-DevKit","href":"/devicescript/devices/esp32/esp32c3-rust-devkit","docId":"devices/esp32/esp32c3-rust-devkit"},{"type":"link","label":"Espressif ESP32-S2 (bare)","href":"/devicescript/devices/esp32/esp32s2-bare","docId":"devices/esp32/esp32s2-bare"},{"type":"link","label":"Espressif ESP32-S3 (bare)","href":"/devicescript/devices/esp32/esp32s3-bare","docId":"devices/esp32/esp32s3-bare"},{"type":"link","label":"Espressif ESP32-S3 DevKitM","href":"/devicescript/devices/esp32/esp32s3-devkit-m","docId":"devices/esp32/esp32s3-devkit-m"},{"type":"link","label":"Unexpected Maker FeatherS2 ESP32-S2","href":"/devicescript/devices/esp32/feather-s2","docId":"devices/esp32/feather-s2"},{"type":"link","label":"MSR JM Brain S2-mini 207 v4.2","href":"/devicescript/devices/esp32/msr207-v42","docId":"devices/esp32/msr207-v42"},{"type":"link","label":"MSR JM Brain S2-mini 207 v4.3","href":"/devicescript/devices/esp32/msr207-v43","docId":"devices/esp32/msr207-v43"},{"type":"link","label":"MSR JacdacIoT 48 v0.2","href":"/devicescript/devices/esp32/msr48","docId":"devices/esp32/msr48"},{"type":"link","label":"Seeed Studio XIAO ESP32C3 with MSR218 base","href":"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218","docId":"devices/esp32/seeed-xiao-esp32c3-msr218"},{"type":"link","label":"Seeed Studio XIAO ESP32C3","href":"/devicescript/devices/esp32/seeed-xiao-esp32c3","docId":"devices/esp32/seeed-xiao-esp32c3"}],"href":"/devicescript/devices/esp32/"},{"type":"category","label":"RP2040","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"MSR RP2040 Brain 124 v0.1","href":"/devicescript/devices/rp2040/msr124","docId":"devices/rp2040/msr124"},{"type":"link","label":"MSR Brain RP2040 59 v0.1","href":"/devicescript/devices/rp2040/msr59","docId":"devices/rp2040/msr59"},{"type":"link","label":"Raspberry Pi Pico W","href":"/devicescript/devices/rp2040/pico-w","docId":"devices/rp2040/pico-w"},{"type":"link","label":"Raspberry Pi Pico","href":"/devicescript/devices/rp2040/pico","docId":"devices/rp2040/pico"}],"href":"/devicescript/devices/rp2040/"},{"type":"category","label":"Shields","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Pico Bricks","href":"/devicescript/devices/shields/pico-bricks","docId":"devices/shields/pico-bricks"},{"type":"link","label":"Pimoroni Badger RP2040","href":"/devicescript/devices/shields/pimoroni-pico-badger","docId":"devices/shields/pimoroni-pico-badger"},{"type":"link","label":"WaveShare Pico-LCD","href":"/devicescript/devices/shields/waveshare-pico-lcd-114","docId":"devices/shields/waveshare-pico-lcd-114"},{"type":"link","label":"Xiao ESP32-C3 Expansion Board","href":"/devicescript/devices/shields/xiao-expansion-board","docId":"devices/shields/xiao-expansion-board"}],"href":"/devicescript/devices/shields/"},{"type":"link","label":"Add Board","href":"/devicescript/devices/add-board","docId":"devices/add-board"},{"type":"link","label":"Add SoC/MCU","href":"/devicescript/devices/add-soc","docId":"devices/add-soc"},{"type":"link","label":"Add Shield","href":"/devicescript/devices/add-shield","docId":"devices/add-shield"}],"href":"/devicescript/devices/"},{"type":"category","label":"API","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Command Line Interface","href":"/devicescript/api/cli","docId":"api/cli"},{"type":"category","label":"Core","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Roles","href":"/devicescript/api/core/roles","docId":"api/core/roles"},{"type":"link","label":"Registers","href":"/devicescript/api/core/registers","docId":"api/core/registers"},{"type":"link","label":"Events","href":"/devicescript/api/core/events","docId":"api/core/events"},{"type":"link","label":"Commands","href":"/devicescript/api/core/commands","docId":"api/core/commands"},{"type":"link","label":"Buffers","href":"/devicescript/api/core/buffers","docId":"api/core/buffers"}],"href":"/devicescript/api/core/"},{"type":"category","label":"Clients","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Accelerometer","href":"/devicescript/api/clients/accelerometer","docId":"api/clients/accelerometer"},{"type":"link","label":"Acidity","href":"/devicescript/api/clients/acidity","docId":"api/clients/acidity"},{"type":"link","label":"AirPressure","href":"/devicescript/api/clients/airpressure","docId":"api/clients/airpressure"},{"type":"link","label":"AirQualityIndex","href":"/devicescript/api/clients/airqualityindex","docId":"api/clients/airqualityindex"},{"type":"link","label":"ArcadeGamepad","href":"/devicescript/api/clients/arcadegamepad","docId":"api/clients/arcadegamepad"},{"type":"link","label":"ArcadeSound","href":"/devicescript/api/clients/arcadesound","docId":"api/clients/arcadesound"},{"type":"link","label":"BarcodeReader","href":"/devicescript/api/clients/barcodereader","docId":"api/clients/barcodereader"},{"type":"link","label":"BitRadio","href":"/devicescript/api/clients/bitradio","docId":"api/clients/bitradio"},{"type":"link","label":"Bootloader","href":"/devicescript/api/clients/bootloader","docId":"api/clients/bootloader"},{"type":"link","label":"BrailleDisplay","href":"/devicescript/api/clients/brailledisplay","docId":"api/clients/brailledisplay"},{"type":"link","label":"Bridge","href":"/devicescript/api/clients/bridge","docId":"api/clients/bridge"},{"type":"link","label":"Button","href":"/devicescript/api/clients/button","docId":"api/clients/button"},{"type":"link","label":"Buzzer","href":"/devicescript/api/clients/buzzer","docId":"api/clients/buzzer"},{"type":"link","label":"CapacitiveButton","href":"/devicescript/api/clients/capacitivebutton","docId":"api/clients/capacitivebutton"},{"type":"link","label":"CharacterScreen","href":"/devicescript/api/clients/characterscreen","docId":"api/clients/characterscreen"},{"type":"link","label":"CloudAdapter","href":"/devicescript/api/clients/cloudadapter","docId":"api/clients/cloudadapter"},{"type":"link","label":"CloudConfiguration","href":"/devicescript/api/clients/cloudconfiguration","docId":"api/clients/cloudconfiguration"},{"type":"link","label":"CodalMessageBus","href":"/devicescript/api/clients/codalmessagebus","docId":"api/clients/codalmessagebus"},{"type":"link","label":"Color","href":"/devicescript/api/clients/color","docId":"api/clients/color"},{"type":"link","label":"Compass","href":"/devicescript/api/clients/compass","docId":"api/clients/compass"},{"type":"link","label":"Control","href":"/devicescript/api/clients/control","docId":"api/clients/control"},{"type":"link","label":"Dashboard","href":"/devicescript/api/clients/dashboard","docId":"api/clients/dashboard"},{"type":"link","label":"DcCurrentMeasurement","href":"/devicescript/api/clients/dccurrentmeasurement","docId":"api/clients/dccurrentmeasurement"},{"type":"link","label":"DcVoltageMeasurement","href":"/devicescript/api/clients/dcvoltagemeasurement","docId":"api/clients/dcvoltagemeasurement"},{"type":"link","label":"DeviceScriptCondition","href":"/devicescript/api/clients/devicescriptcondition","docId":"api/clients/devicescriptcondition"},{"type":"link","label":"DevsDbg","href":"/devicescript/api/clients/devicescriptdebugger","docId":"api/clients/devicescriptdebugger"},{"type":"link","label":"DeviceScriptManager","href":"/devicescript/api/clients/devicescriptmanager","docId":"api/clients/devicescriptmanager"},{"type":"link","label":"Distance","href":"/devicescript/api/clients/distance","docId":"api/clients/distance"},{"type":"link","label":"Dmx","href":"/devicescript/api/clients/dmx","docId":"api/clients/dmx"},{"type":"link","label":"DotMatrix","href":"/devicescript/api/clients/dotmatrix","docId":"api/clients/dotmatrix"},{"type":"link","label":"DualMotors","href":"/devicescript/api/clients/dualmotors","docId":"api/clients/dualmotors"},{"type":"link","label":"ECO2","href":"/devicescript/api/clients/eco2","docId":"api/clients/eco2"},{"type":"link","label":"Flex","href":"/devicescript/api/clients/flex","docId":"api/clients/flex"},{"type":"link","label":"Gamepad","href":"/devicescript/api/clients/gamepad","docId":"api/clients/gamepad"},{"type":"link","label":"GPIO","href":"/devicescript/api/clients/gpio","docId":"api/clients/gpio"},{"type":"link","label":"Gyroscope","href":"/devicescript/api/clients/gyroscope","docId":"api/clients/gyroscope"},{"type":"link","label":"HeartRate","href":"/devicescript/api/clients/heartrate","docId":"api/clients/heartrate"},{"type":"link","label":"HidJoystick","href":"/devicescript/api/clients/hidjoystick","docId":"api/clients/hidjoystick"},{"type":"link","label":"HidKeyboard","href":"/devicescript/api/clients/hidkeyboard","docId":"api/clients/hidkeyboard"},{"type":"link","label":"HidMouse","href":"/devicescript/api/clients/hidmouse","docId":"api/clients/hidmouse"},{"type":"link","label":"Humidity","href":"/devicescript/api/clients/humidity","docId":"api/clients/humidity"},{"type":"link","label":"I2C","href":"/devicescript/api/clients/i2c","docId":"api/clients/i2c"},{"type":"link","label":"Illuminance","href":"/devicescript/api/clients/illuminance","docId":"api/clients/illuminance"},{"type":"link","label":"IndexedScreen","href":"/devicescript/api/clients/indexedscreen","docId":"api/clients/indexedscreen"},{"type":"link","label":"Infrastructure","href":"/devicescript/api/clients/infrastructure","docId":"api/clients/infrastructure"},{"type":"link","label":"Led","href":"/devicescript/api/clients/led","docId":"api/clients/led"},{"type":"link","label":"LedSingle","href":"/devicescript/api/clients/ledsingle","docId":"api/clients/ledsingle"},{"type":"link","label":"LedStrip","href":"/devicescript/api/clients/ledstrip","docId":"api/clients/ledstrip"},{"type":"link","label":"LightBulb","href":"/devicescript/api/clients/lightbulb","docId":"api/clients/lightbulb"},{"type":"link","label":"LightLevel","href":"/devicescript/api/clients/lightlevel","docId":"api/clients/lightlevel"},{"type":"link","label":"Logger","href":"/devicescript/api/clients/logger","docId":"api/clients/logger"},{"type":"link","label":"MagneticFieldLevel","href":"/devicescript/api/clients/magneticfieldlevel","docId":"api/clients/magneticfieldlevel"},{"type":"link","label":"Magnetometer","href":"/devicescript/api/clients/magnetomer","docId":"api/clients/magnetomer"},{"type":"link","label":"MatrixKeypad","href":"/devicescript/api/clients/matrixkeypad","docId":"api/clients/matrixkeypad"},{"type":"link","label":"Microphone","href":"/devicescript/api/clients/microphone","docId":"api/clients/microphone"},{"type":"link","label":"MidiOutput","href":"/devicescript/api/clients/midioutput","docId":"api/clients/midioutput"},{"type":"link","label":"ModelRunner","href":"/devicescript/api/clients/modelrunner","docId":"api/clients/modelrunner"},{"type":"link","label":"Motion","href":"/devicescript/api/clients/motion","docId":"api/clients/motion"},{"type":"link","label":"Motor","href":"/devicescript/api/clients/motor","docId":"api/clients/motor"},{"type":"link","label":"Multitouch","href":"/devicescript/api/clients/multitouch","docId":"api/clients/multitouch"},{"type":"link","label":"PlanarPosition","href":"/devicescript/api/clients/planarposition","docId":"api/clients/planarposition"},{"type":"link","label":"Potentiometer","href":"/devicescript/api/clients/potentiometer","docId":"api/clients/potentiometer"},{"type":"link","label":"Power","href":"/devicescript/api/clients/power","docId":"api/clients/power"},{"type":"link","label":"PowerSupply","href":"/devicescript/api/clients/powersupply","docId":"api/clients/powersupply"},{"type":"link","label":"PressureButton","href":"/devicescript/api/clients/pressurebutton","docId":"api/clients/pressurebutton"},{"type":"link","label":"ProtoTest","href":"/devicescript/api/clients/prototest","docId":"api/clients/prototest"},{"type":"link","label":"Proxy","href":"/devicescript/api/clients/proxy","docId":"api/clients/proxy"},{"type":"link","label":"PulseOximeter","href":"/devicescript/api/clients/pulseoximeter","docId":"api/clients/pulseoximeter"},{"type":"link","label":"RainGauge","href":"/devicescript/api/clients/raingauge","docId":"api/clients/raingauge"},{"type":"link","label":"RealTimeClock","href":"/devicescript/api/clients/realtimeclock","docId":"api/clients/realtimeclock"},{"type":"link","label":"ReflectedLight","href":"/devicescript/api/clients/reflectedlight","docId":"api/clients/reflectedlight"},{"type":"link","label":"Relay","href":"/devicescript/api/clients/relay","docId":"api/clients/relay"},{"type":"link","label":"Rng","href":"/devicescript/api/clients/rng","docId":"api/clients/rng"},{"type":"link","label":"RoleManager","href":"/devicescript/api/clients/rolemanager","docId":"api/clients/rolemanager"},{"type":"link","label":"Ros","href":"/devicescript/api/clients/ros","docId":"api/clients/ros"},{"type":"link","label":"RotaryEncoder","href":"/devicescript/api/clients/rotaryencoder","docId":"api/clients/rotaryencoder"},{"type":"link","label":"Rover","href":"/devicescript/api/clients/rover","docId":"api/clients/rover"},{"type":"link","label":"SatNav","href":"/devicescript/api/clients/satelittenavigationsystem","docId":"api/clients/satelittenavigationsystem"},{"type":"link","label":"SensorAggregator","href":"/devicescript/api/clients/sensoraggregator","docId":"api/clients/sensoraggregator"},{"type":"link","label":"Serial","href":"/devicescript/api/clients/serial","docId":"api/clients/serial"},{"type":"link","label":"Servo","href":"/devicescript/api/clients/servo","docId":"api/clients/servo"},{"type":"link","label":"Settings","href":"/devicescript/api/clients/settings","docId":"api/clients/settings"},{"type":"link","label":"SevenSegmentDisplay","href":"/devicescript/api/clients/sevensegmentdisplay","docId":"api/clients/sevensegmentdisplay"},{"type":"link","label":"SoilMoisture","href":"/devicescript/api/clients/soilmoisture","docId":"api/clients/soilmoisture"},{"type":"link","label":"Solenoid","href":"/devicescript/api/clients/solenoid","docId":"api/clients/solenoid"},{"type":"link","label":"SoundLevel","href":"/devicescript/api/clients/soundlevel","docId":"api/clients/soundlevel"},{"type":"link","label":"SoundPlayer","href":"/devicescript/api/clients/soundplayer","docId":"api/clients/soundplayer"},{"type":"link","label":"SoundRecorderWithPlayback","href":"/devicescript/api/clients/soundrecorderwithplayback","docId":"api/clients/soundrecorderwithplayback"},{"type":"link","label":"SoundSpectrum","href":"/devicescript/api/clients/soundspectrum","docId":"api/clients/soundspectrum"},{"type":"link","label":"SpeechSynthesis","href":"/devicescript/api/clients/speechsynthesis","docId":"api/clients/speechsynthesis"},{"type":"link","label":"Switch","href":"/devicescript/api/clients/switch","docId":"api/clients/switch"},{"type":"link","label":"Tcp","href":"/devicescript/api/clients/tcp","docId":"api/clients/tcp"},{"type":"link","label":"Temperature","href":"/devicescript/api/clients/temperature","docId":"api/clients/temperature"},{"type":"link","label":"TimeseriesAggregator","href":"/devicescript/api/clients/timeseriesaggregator","docId":"api/clients/timeseriesaggregator"},{"type":"link","label":"TrafficLight","href":"/devicescript/api/clients/trafficlight","docId":"api/clients/trafficlight"},{"type":"link","label":"Tvoc","href":"/devicescript/api/clients/tvoc","docId":"api/clients/tvoc"},{"type":"link","label":"UniqueBrain","href":"/devicescript/api/clients/uniquebrain","docId":"api/clients/uniquebrain"},{"type":"link","label":"UsbBridge","href":"/devicescript/api/clients/usbbridge","docId":"api/clients/usbbridge"},{"type":"link","label":"UvIndex","href":"/devicescript/api/clients/uvindex","docId":"api/clients/uvindex"},{"type":"link","label":"VerifiedTelemetry","href":"/devicescript/api/clients/verifiedtelemetrysensor","docId":"api/clients/verifiedtelemetrysensor"},{"type":"link","label":"VibrationMotor","href":"/devicescript/api/clients/vibrationmotor","docId":"api/clients/vibrationmotor"},{"type":"link","label":"WaterLevel","href":"/devicescript/api/clients/waterlevel","docId":"api/clients/waterlevel"},{"type":"link","label":"WeightScale","href":"/devicescript/api/clients/weightscale","docId":"api/clients/weightscale"},{"type":"link","label":"Wifi","href":"/devicescript/api/clients/wifi","docId":"api/clients/wifi"},{"type":"link","label":"WindDirection","href":"/devicescript/api/clients/winddirection","docId":"api/clients/winddirection"},{"type":"link","label":"WindSpeed","href":"/devicescript/api/clients/windspeed","docId":"api/clients/windspeed"},{"type":"link","label":"Wssk","href":"/devicescript/api/clients/wssk","docId":"api/clients/wssk"}],"href":"/devicescript/api/clients/"},{"type":"link","label":"Math","href":"/devicescript/api/math","docId":"api/math"},{"type":"category","label":"Drivers","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Accelerometer","href":"/devicescript/api/drivers/accelerometer","docId":"api/drivers/accelerometer"},{"type":"link","label":"AHT20","href":"/devicescript/api/drivers/aht20","docId":"api/drivers/aht20"},{"type":"link","label":"BME680","href":"/devicescript/api/drivers/bme680","docId":"api/drivers/bme680"},{"type":"link","label":"Button","href":"/devicescript/api/drivers/button","docId":"api/drivers/button"},{"type":"link","label":"Buzzer","href":"/devicescript/api/drivers/buzzer","docId":"api/drivers/buzzer"},{"type":"link","label":"Hall sensor","href":"/devicescript/api/drivers/hall","docId":"api/drivers/hall"},{"type":"link","label":"HID Joystick","href":"/devicescript/api/drivers/hidjoystick","docId":"api/drivers/hidjoystick"},{"type":"link","label":"HID Keyboard","href":"/devicescript/api/drivers/hidkeyboard","docId":"api/drivers/hidkeyboard"},{"type":"link","label":"HID Mouse","href":"/devicescript/api/drivers/hidmouse","docId":"api/drivers/hidmouse"},{"type":"link","label":"Light bulb","href":"/devicescript/api/drivers/lightbulb","docId":"api/drivers/lightbulb"},{"type":"link","label":"Light Level","href":"/devicescript/api/drivers/lightlevel","docId":"api/drivers/lightlevel"},{"type":"link","label":"LTR390","href":"/devicescript/api/drivers/ltr390","docId":"api/drivers/ltr390"},{"type":"link","label":"Motion Detector","href":"/devicescript/api/drivers/motion","docId":"api/drivers/motion"},{"type":"link","label":"Potentiometer","href":"/devicescript/api/drivers/potentiometer","docId":"api/drivers/potentiometer"},{"type":"link","label":"Power","href":"/devicescript/api/drivers/power","docId":"api/drivers/power"},{"type":"link","label":"Reflected Light","href":"/devicescript/api/drivers/reflectedlight","docId":"api/drivers/reflectedlight"},{"type":"link","label":"Relay","href":"/devicescript/api/drivers/relay","docId":"api/drivers/relay"},{"type":"link","label":"Rotary Encoder","href":"/devicescript/api/drivers/rotaryencoder","docId":"api/drivers/rotaryencoder"},{"type":"link","label":"Servo","href":"/devicescript/api/drivers/servo","docId":"api/drivers/servo"},{"type":"link","label":"SHT30","href":"/devicescript/api/drivers/sht30","docId":"api/drivers/sht30"},{"type":"link","label":"SHTC3","href":"/devicescript/api/drivers/shtc3","docId":"api/drivers/shtc3"},{"type":"link","label":"Soil Moisture","href":"/devicescript/api/drivers/soilmoisture","docId":"api/drivers/soilmoisture"},{"type":"link","label":"Sound Level","href":"/devicescript/api/drivers/soundlevel","docId":"api/drivers/soundlevel"},{"type":"link","label":"SSD1306","href":"/devicescript/api/drivers/ssd1306","docId":"api/drivers/ssd1306"},{"type":"link","label":"ST7735, ILI9163, ST7789","href":"/devicescript/api/drivers/st7789","docId":"api/drivers/st7789"},{"type":"link","label":"Switch","href":"/devicescript/api/drivers/switch","docId":"api/drivers/switch"},{"type":"link","label":"Traffic Light","href":"/devicescript/api/drivers/trafficlight","docId":"api/drivers/trafficlight"},{"type":"link","label":"UC8151","href":"/devicescript/api/drivers/uc8151","docId":"api/drivers/uc8151"},{"type":"link","label":"Water Level","href":"/devicescript/api/drivers/waterlevel","docId":"api/drivers/waterlevel"}],"href":"/devicescript/api/drivers/"},{"type":"category","label":"Runtime","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Palette","href":"/devicescript/api/runtime/palette","docId":"api/runtime/palette"},{"type":"link","label":"PixelBuffer","href":"/devicescript/api/runtime/pixelbuffer","docId":"api/runtime/pixelbuffer"},{"type":"link","label":"schedule","href":"/devicescript/api/runtime/schedule","docId":"api/runtime/schedule"}],"href":"/devicescript/api/runtime/"},{"type":"category","label":"Observables","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Creation Operators","href":"/devicescript/api/observables/creation","docId":"api/observables/creation"},{"type":"link","label":"Digital Signal processing","href":"/devicescript/api/observables/dsp","docId":"api/observables/dsp"},{"type":"link","label":"Filter Operators","href":"/devicescript/api/observables/filter","docId":"api/observables/filter"},{"type":"link","label":"Transform operators","href":"/devicescript/api/observables/transform","docId":"api/observables/transform"},{"type":"link","label":"Utilities operators","href":"/devicescript/api/observables/utils","docId":"api/observables/utils"}],"href":"/devicescript/api/observables/"},{"type":"link","label":"Settings","href":"/devicescript/api/settings/","docId":"api/settings/index"},{"type":"link","label":"Test","href":"/devicescript/api/test/","docId":"api/test/index"},{"type":"link","label":"WebASM VM","href":"/devicescript/api/vm","docId":"api/vm"},{"type":"link","label":"SPI","href":"/devicescript/api/spi","docId":"api/spi"}]},{"type":"link","label":"Release Notes","href":"/devicescript/changelog","docId":"changelog"},{"type":"link","label":"Contributing","href":"/devicescript/contributing","docId":"contributing"}]},"docs":{"api/cli":{"id":"api/cli","title":"Command Line Interface","description":"The DeviceScript command line (CLI) allows to compile and debug programs from your favorite IDE.","sidebar":"tutorialSidebar"},"api/clients/accelerometer":{"id":"api/clients/accelerometer","title":"Accelerometer","description":"DeviceScript client for Accelerometer service","sidebar":"tutorialSidebar"},"api/clients/acidity":{"id":"api/clients/acidity","title":"Acidity","description":"DeviceScript client for Acidity service","sidebar":"tutorialSidebar"},"api/clients/airpressure":{"id":"api/clients/airpressure","title":"AirPressure","description":"DeviceScript client for Air Pressure service","sidebar":"tutorialSidebar"},"api/clients/airqualityindex":{"id":"api/clients/airqualityindex","title":"AirQualityIndex","description":"DeviceScript client for Air Quality Index service","sidebar":"tutorialSidebar"},"api/clients/arcadegamepad":{"id":"api/clients/arcadegamepad","title":"ArcadeGamepad","description":"The Arcade Gamepad service is deprecated and not supported in DeviceScript.","sidebar":"tutorialSidebar"},"api/clients/arcadesound":{"id":"api/clients/arcadesound","title":"ArcadeSound","description":"DeviceScript client for Arcade Sound service","sidebar":"tutorialSidebar"},"api/clients/barcodereader":{"id":"api/clients/barcodereader","title":"BarcodeReader","description":"DeviceScript client for Barcode reader service","sidebar":"tutorialSidebar"},"api/clients/bitradio":{"id":"api/clients/bitradio","title":"BitRadio","description":"DeviceScript client for bit:radio service","sidebar":"tutorialSidebar"},"api/clients/bootloader":{"id":"api/clients/bootloader","title":"Bootloader","description":"The Bootloader service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/brailledisplay":{"id":"api/clients/brailledisplay","title":"BrailleDisplay","description":"DeviceScript client for Braille display service","sidebar":"tutorialSidebar"},"api/clients/bridge":{"id":"api/clients/bridge","title":"Bridge","description":"The Bridge service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/button":{"id":"api/clients/button","title":"Button","description":"DeviceScript client for Button service","sidebar":"tutorialSidebar"},"api/clients/buzzer":{"id":"api/clients/buzzer","title":"Buzzer","description":"DeviceScript client for Buzzer service","sidebar":"tutorialSidebar"},"api/clients/capacitivebutton":{"id":"api/clients/capacitivebutton","title":"CapacitiveButton","description":"DeviceScript client for Capacitive Button service","sidebar":"tutorialSidebar"},"api/clients/characterscreen":{"id":"api/clients/characterscreen","title":"CharacterScreen","description":"DeviceScript client for Character Screen service","sidebar":"tutorialSidebar"},"api/clients/cloudadapter":{"id":"api/clients/cloudadapter","title":"CloudAdapter","description":"DeviceScript client for Cloud Adapter service","sidebar":"tutorialSidebar"},"api/clients/cloudconfiguration":{"id":"api/clients/cloudconfiguration","title":"CloudConfiguration","description":"The Cloud Configuration service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/codalmessagebus":{"id":"api/clients/codalmessagebus","title":"CodalMessageBus","description":"The CODAL Message Bus service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/color":{"id":"api/clients/color","title":"Color","description":"DeviceScript client for Color service","sidebar":"tutorialSidebar"},"api/clients/compass":{"id":"api/clients/compass","title":"Compass","description":"DeviceScript client for Compass service","sidebar":"tutorialSidebar"},"api/clients/control":{"id":"api/clients/control","title":"Control","description":"The Control service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/dashboard":{"id":"api/clients/dashboard","title":"Dashboard","description":"The Dashboard service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/dccurrentmeasurement":{"id":"api/clients/dccurrentmeasurement","title":"DcCurrentMeasurement","description":"DeviceScript client for DC Current Measurement service","sidebar":"tutorialSidebar"},"api/clients/dcvoltagemeasurement":{"id":"api/clients/dcvoltagemeasurement","title":"DcVoltageMeasurement","description":"DeviceScript client for DC Voltage Measurement service","sidebar":"tutorialSidebar"},"api/clients/devicescriptcondition":{"id":"api/clients/devicescriptcondition","title":"DeviceScriptCondition","description":"The DeviceScript Condition service is deprecated and not supported in DeviceScript.","sidebar":"tutorialSidebar"},"api/clients/devicescriptdebugger":{"id":"api/clients/devicescriptdebugger","title":"DevsDbg","description":"The DeviceScript Debugger service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/devicescriptmanager":{"id":"api/clients/devicescriptmanager","title":"DeviceScriptManager","description":"The DeviceScript Manager service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/distance":{"id":"api/clients/distance","title":"Distance","description":"DeviceScript client for Distance service","sidebar":"tutorialSidebar"},"api/clients/dmx":{"id":"api/clients/dmx","title":"Dmx","description":"DeviceScript client for DMX service","sidebar":"tutorialSidebar"},"api/clients/dotmatrix":{"id":"api/clients/dotmatrix","title":"DotMatrix","description":"DeviceScript client for Dot Matrix service","sidebar":"tutorialSidebar"},"api/clients/dualmotors":{"id":"api/clients/dualmotors","title":"DualMotors","description":"DeviceScript client for Dual Motors service","sidebar":"tutorialSidebar"},"api/clients/eco2":{"id":"api/clients/eco2","title":"ECO2","description":"DeviceScript client for Equivalent CO\u2082 service","sidebar":"tutorialSidebar"},"api/clients/flex":{"id":"api/clients/flex","title":"Flex","description":"DeviceScript client for Flex service","sidebar":"tutorialSidebar"},"api/clients/gamepad":{"id":"api/clients/gamepad","title":"Gamepad","description":"DeviceScript client for Gamepad service","sidebar":"tutorialSidebar"},"api/clients/gpio":{"id":"api/clients/gpio","title":"GPIO","description":"The GPIO service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/gyroscope":{"id":"api/clients/gyroscope","title":"Gyroscope","description":"DeviceScript client for Gyroscope service","sidebar":"tutorialSidebar"},"api/clients/heartrate":{"id":"api/clients/heartrate","title":"HeartRate","description":"DeviceScript client for Heart Rate service","sidebar":"tutorialSidebar"},"api/clients/hidjoystick":{"id":"api/clients/hidjoystick","title":"HidJoystick","description":"DeviceScript client for HID Joystick service","sidebar":"tutorialSidebar"},"api/clients/hidkeyboard":{"id":"api/clients/hidkeyboard","title":"HidKeyboard","description":"DeviceScript client for HID Keyboard service","sidebar":"tutorialSidebar"},"api/clients/hidmouse":{"id":"api/clients/hidmouse","title":"HidMouse","description":"DeviceScript client for HID Mouse service","sidebar":"tutorialSidebar"},"api/clients/humidity":{"id":"api/clients/humidity","title":"Humidity","description":"DeviceScript client for Humidity service","sidebar":"tutorialSidebar"},"api/clients/i2c":{"id":"api/clients/i2c","title":"I2C","description":"DeviceScript client for I2C service","sidebar":"tutorialSidebar"},"api/clients/illuminance":{"id":"api/clients/illuminance","title":"Illuminance","description":"DeviceScript client for Illuminance service","sidebar":"tutorialSidebar"},"api/clients/index":{"id":"api/clients/index","title":"Clients","description":"{@import optional ../clients-custom/index.mdp}","sidebar":"tutorialSidebar"},"api/clients/indexedscreen":{"id":"api/clients/indexedscreen","title":"IndexedScreen","description":"DeviceScript client for Indexed screen service","sidebar":"tutorialSidebar"},"api/clients/infrastructure":{"id":"api/clients/infrastructure","title":"Infrastructure","description":"The Infrastructure service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/led":{"id":"api/clients/led","title":"Led","description":"DeviceScript client for LED service","sidebar":"tutorialSidebar"},"api/clients/ledsingle":{"id":"api/clients/ledsingle","title":"LedSingle","description":"The LED Single service is deprecated and not supported in DeviceScript.","sidebar":"tutorialSidebar"},"api/clients/ledstrip":{"id":"api/clients/ledstrip","title":"LedStrip","description":"DeviceScript client for LED Strip service","sidebar":"tutorialSidebar"},"api/clients/lightbulb":{"id":"api/clients/lightbulb","title":"LightBulb","description":"DeviceScript client for Light bulb service","sidebar":"tutorialSidebar"},"api/clients/lightlevel":{"id":"api/clients/lightlevel","title":"LightLevel","description":"DeviceScript client for Light level service","sidebar":"tutorialSidebar"},"api/clients/logger":{"id":"api/clients/logger","title":"Logger","description":"The Logger service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/magneticfieldlevel":{"id":"api/clients/magneticfieldlevel","title":"MagneticFieldLevel","description":"DeviceScript client for Magnetic field level service","sidebar":"tutorialSidebar"},"api/clients/magnetomer":{"id":"api/clients/magnetomer","title":"Magnetometer","description":"DeviceScript client for Magnetometer service","sidebar":"tutorialSidebar"},"api/clients/matrixkeypad":{"id":"api/clients/matrixkeypad","title":"MatrixKeypad","description":"DeviceScript client for Matrix Keypad service","sidebar":"tutorialSidebar"},"api/clients/microphone":{"id":"api/clients/microphone","title":"Microphone","description":"DeviceScript client for Microphone service","sidebar":"tutorialSidebar"},"api/clients/midioutput":{"id":"api/clients/midioutput","title":"MidiOutput","description":"DeviceScript client for MIDI output service","sidebar":"tutorialSidebar"},"api/clients/modelrunner":{"id":"api/clients/modelrunner","title":"ModelRunner","description":"DeviceScript client for Model Runner service","sidebar":"tutorialSidebar"},"api/clients/motion":{"id":"api/clients/motion","title":"Motion","description":"DeviceScript client for Motion service","sidebar":"tutorialSidebar"},"api/clients/motor":{"id":"api/clients/motor","title":"Motor","description":"DeviceScript client for Motor service","sidebar":"tutorialSidebar"},"api/clients/multitouch":{"id":"api/clients/multitouch","title":"Multitouch","description":"DeviceScript client for Multitouch service","sidebar":"tutorialSidebar"},"api/clients/planarposition":{"id":"api/clients/planarposition","title":"PlanarPosition","description":"DeviceScript client for Planar position service","sidebar":"tutorialSidebar"},"api/clients/potentiometer":{"id":"api/clients/potentiometer","title":"Potentiometer","description":"DeviceScript client for Potentiometer service","sidebar":"tutorialSidebar"},"api/clients/power":{"id":"api/clients/power","title":"Power","description":"DeviceScript client for Power service","sidebar":"tutorialSidebar"},"api/clients/powersupply":{"id":"api/clients/powersupply","title":"PowerSupply","description":"DeviceScript client for Power supply service","sidebar":"tutorialSidebar"},"api/clients/pressurebutton":{"id":"api/clients/pressurebutton","title":"PressureButton","description":"DeviceScript client for Pressure Button service","sidebar":"tutorialSidebar"},"api/clients/prototest":{"id":"api/clients/prototest","title":"ProtoTest","description":"The Protocol Test service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/proxy":{"id":"api/clients/proxy","title":"Proxy","description":"The Proxy service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/pulseoximeter":{"id":"api/clients/pulseoximeter","title":"PulseOximeter","description":"DeviceScript client for Pulse Oximeter service","sidebar":"tutorialSidebar"},"api/clients/raingauge":{"id":"api/clients/raingauge","title":"RainGauge","description":"DeviceScript client for Rain gauge service","sidebar":"tutorialSidebar"},"api/clients/realtimeclock":{"id":"api/clients/realtimeclock","title":"RealTimeClock","description":"DeviceScript client for Real time clock service","sidebar":"tutorialSidebar"},"api/clients/reflectedlight":{"id":"api/clients/reflectedlight","title":"ReflectedLight","description":"DeviceScript client for Reflected light service","sidebar":"tutorialSidebar"},"api/clients/relay":{"id":"api/clients/relay","title":"Relay","description":"DeviceScript client for Relay service","sidebar":"tutorialSidebar"},"api/clients/rng":{"id":"api/clients/rng","title":"Rng","description":"DeviceScript client for Random Number Generator service","sidebar":"tutorialSidebar"},"api/clients/rolemanager":{"id":"api/clients/rolemanager","title":"RoleManager","description":"The Role Manager service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/ros":{"id":"api/clients/ros","title":"Ros","description":"DeviceScript client for ROS service","sidebar":"tutorialSidebar"},"api/clients/rotaryencoder":{"id":"api/clients/rotaryencoder","title":"RotaryEncoder","description":"DeviceScript client for Rotary encoder service","sidebar":"tutorialSidebar"},"api/clients/rover":{"id":"api/clients/rover","title":"Rover","description":"DeviceScript client for Rover service","sidebar":"tutorialSidebar"},"api/clients/satelittenavigationsystem":{"id":"api/clients/satelittenavigationsystem","title":"SatNav","description":"DeviceScript client for Satellite Navigation System service","sidebar":"tutorialSidebar"},"api/clients/sensoraggregator":{"id":"api/clients/sensoraggregator","title":"SensorAggregator","description":"DeviceScript client for Sensor Aggregator service","sidebar":"tutorialSidebar"},"api/clients/serial":{"id":"api/clients/serial","title":"Serial","description":"DeviceScript client for Serial service","sidebar":"tutorialSidebar"},"api/clients/servo":{"id":"api/clients/servo","title":"Servo","description":"DeviceScript client for Servo service","sidebar":"tutorialSidebar"},"api/clients/settings":{"id":"api/clients/settings","title":"Settings","description":"DeviceScript client for Settings service","sidebar":"tutorialSidebar"},"api/clients/sevensegmentdisplay":{"id":"api/clients/sevensegmentdisplay","title":"SevenSegmentDisplay","description":"DeviceScript client for 7-segment display service","sidebar":"tutorialSidebar"},"api/clients/soilmoisture":{"id":"api/clients/soilmoisture","title":"SoilMoisture","description":"DeviceScript client for Soil moisture service","sidebar":"tutorialSidebar"},"api/clients/solenoid":{"id":"api/clients/solenoid","title":"Solenoid","description":"DeviceScript client for Solenoid service","sidebar":"tutorialSidebar"},"api/clients/soundlevel":{"id":"api/clients/soundlevel","title":"SoundLevel","description":"DeviceScript client for Sound level service","sidebar":"tutorialSidebar"},"api/clients/soundplayer":{"id":"api/clients/soundplayer","title":"SoundPlayer","description":"DeviceScript client for Sound player service","sidebar":"tutorialSidebar"},"api/clients/soundrecorderwithplayback":{"id":"api/clients/soundrecorderwithplayback","title":"SoundRecorderWithPlayback","description":"DeviceScript client for Sound Recorder with Playback service","sidebar":"tutorialSidebar"},"api/clients/soundspectrum":{"id":"api/clients/soundspectrum","title":"SoundSpectrum","description":"DeviceScript client for Sound Spectrum service","sidebar":"tutorialSidebar"},"api/clients/speechsynthesis":{"id":"api/clients/speechsynthesis","title":"SpeechSynthesis","description":"DeviceScript client for Speech synthesis service","sidebar":"tutorialSidebar"},"api/clients/switch":{"id":"api/clients/switch","title":"Switch","description":"DeviceScript client for Switch service","sidebar":"tutorialSidebar"},"api/clients/tcp":{"id":"api/clients/tcp","title":"Tcp","description":"The TCP service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/temperature":{"id":"api/clients/temperature","title":"Temperature","description":"DeviceScript client for Temperature service","sidebar":"tutorialSidebar"},"api/clients/timeseriesaggregator":{"id":"api/clients/timeseriesaggregator","title":"TimeseriesAggregator","description":"DeviceScript client for Timeseries Aggregator service","sidebar":"tutorialSidebar"},"api/clients/trafficlight":{"id":"api/clients/trafficlight","title":"TrafficLight","description":"DeviceScript client for Traffic Light service","sidebar":"tutorialSidebar"},"api/clients/tvoc":{"id":"api/clients/tvoc","title":"Tvoc","description":"DeviceScript client for Total Volatile organic compound service","sidebar":"tutorialSidebar"},"api/clients/uniquebrain":{"id":"api/clients/uniquebrain","title":"UniqueBrain","description":"The Unique Brain service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/clients/usbbridge":{"id":"api/clients/usbbridge","title":"UsbBridge","description":"DeviceScript client for USB Bridge service","sidebar":"tutorialSidebar"},"api/clients/uvindex":{"id":"api/clients/uvindex","title":"UvIndex","description":"DeviceScript client for UV index service","sidebar":"tutorialSidebar"},"api/clients/verifiedtelemetrysensor":{"id":"api/clients/verifiedtelemetrysensor","title":"VerifiedTelemetry","description":"The Verified Telemetry service is deprecated and not supported in DeviceScript.","sidebar":"tutorialSidebar"},"api/clients/vibrationmotor":{"id":"api/clients/vibrationmotor","title":"VibrationMotor","description":"DeviceScript client for Vibration motor service","sidebar":"tutorialSidebar"},"api/clients/waterlevel":{"id":"api/clients/waterlevel","title":"WaterLevel","description":"DeviceScript client for Water level service","sidebar":"tutorialSidebar"},"api/clients/weightscale":{"id":"api/clients/weightscale","title":"WeightScale","description":"DeviceScript client for Weight Scale service","sidebar":"tutorialSidebar"},"api/clients/wifi":{"id":"api/clients/wifi","title":"Wifi","description":"DeviceScript client for WIFI service","sidebar":"tutorialSidebar"},"api/clients/winddirection":{"id":"api/clients/winddirection","title":"WindDirection","description":"DeviceScript client for Wind direction service","sidebar":"tutorialSidebar"},"api/clients/windspeed":{"id":"api/clients/windspeed","title":"WindSpeed","description":"DeviceScript client for Wind speed service","sidebar":"tutorialSidebar"},"api/clients/wssk":{"id":"api/clients/wssk","title":"Wssk","description":"The WSSK service is used internally by the runtime","sidebar":"tutorialSidebar"},"api/core/buffers":{"id":"api/core/buffers","title":"Buffers","description":"Learn how to use buffers for dynamic allocation, memory conservation, and creating arrays with fixed upper limits.","sidebar":"tutorialSidebar"},"api/core/commands":{"id":"api/core/commands","title":"Commands","description":"Learn how to implement commands directly on role instances and create service-specific commands in DeviceScript.","sidebar":"tutorialSidebar"},"api/core/events":{"id":"api/core/events","title":"Events","description":"Events are generated by service servers and can be subscribed with a callback.","sidebar":"tutorialSidebar"},"api/core/index":{"id":"api/core/index","title":"Code","description":"DeviceScript provides builtin support for instantiating Jacdac service clients (role)","sidebar":"tutorialSidebar"},"api/core/registers":{"id":"api/core/registers","title":"Registers","description":"The register client classe (Register) allow to read, write and track changes of service registers.","sidebar":"tutorialSidebar"},"api/core/roles":{"id":"api/core/roles","title":"Roles","description":"Roles are defined by instantiating a service client.","sidebar":"tutorialSidebar"},"api/drivers/accelerometer":{"id":"api/drivers/accelerometer","title":"Accelerometer","description":"Mounts an accelerometer server","sidebar":"tutorialSidebar"},"api/drivers/aht20":{"id":"api/drivers/aht20","title":"AHT20","description":"Driver for AHT20 temperature/humidity sensor at I2C address 0x38.","sidebar":"tutorialSidebar"},"api/drivers/bme680":{"id":"api/drivers/bme680","title":"BME680","description":"Driver for BME680 temperature/humidity/air pressure/aqi","sidebar":"tutorialSidebar"},"api/drivers/button":{"id":"api/drivers/button","title":"Button","description":"Mounts a button server","sidebar":"tutorialSidebar"},"api/drivers/buzzer":{"id":"api/drivers/buzzer","title":"Buzzer","description":"Mounts a buzzer (sounder) server","sidebar":"tutorialSidebar"},"api/drivers/hall":{"id":"api/drivers/hall","title":"Hall sensor","description":"Mounts a Hall sensor","sidebar":"tutorialSidebar"},"api/drivers/hidjoystick":{"id":"api/drivers/hidjoystick","title":"HID Joystick","description":"Mounts a HID joystick server","sidebar":"tutorialSidebar"},"api/drivers/hidkeyboard":{"id":"api/drivers/hidkeyboard","title":"HID Keyboard","description":"Mounts a HID keyboard server","sidebar":"tutorialSidebar"},"api/drivers/hidmouse":{"id":"api/drivers/hidmouse","title":"HID Mouse","description":"Mounts a HID mouse server","sidebar":"tutorialSidebar"},"api/drivers/index":{"id":"api/drivers/index","title":"Drivers","description":"Starting driver provide a programming abstraction for hardware periphericals.","sidebar":"tutorialSidebar"},"api/drivers/lightbulb":{"id":"api/drivers/lightbulb","title":"Light bulb","description":"Mounts a light bulb server","sidebar":"tutorialSidebar"},"api/drivers/lightlevel":{"id":"api/drivers/lightlevel","title":"Light Level","description":"Mounts a light level sensor","sidebar":"tutorialSidebar"},"api/drivers/ltr390":{"id":"api/drivers/ltr390","title":"LTR390","description":"Driver for LTR390 UV Index, illuminance.","sidebar":"tutorialSidebar"},"api/drivers/motion":{"id":"api/drivers/motion","title":"Motion Detector","description":"Mounts a motion detector","sidebar":"tutorialSidebar"},"api/drivers/potentiometer":{"id":"api/drivers/potentiometer","title":"Potentiometer","description":"Mounts a potentiometer","sidebar":"tutorialSidebar"},"api/drivers/power":{"id":"api/drivers/power","title":"Power","description":"Mounts a power server","sidebar":"tutorialSidebar"},"api/drivers/reflectedlight":{"id":"api/drivers/reflectedlight","title":"Reflected Light","description":"Mounts a reflected light sensor","sidebar":"tutorialSidebar"},"api/drivers/relay":{"id":"api/drivers/relay","title":"Relay","description":"Mounts a relay server","sidebar":"tutorialSidebar"},"api/drivers/rotaryencoder":{"id":"api/drivers/rotaryencoder","title":"Rotary Encoder","description":"Mounts a rotary encoder server","sidebar":"tutorialSidebar"},"api/drivers/servo":{"id":"api/drivers/servo","title":"Servo","description":"Mounts a servo","sidebar":"tutorialSidebar"},"api/drivers/sht30":{"id":"api/drivers/sht30","title":"SHT30","description":"Driver for SHT30 temperature/humidity sensor at I2C address 0x44 or 0x45.","sidebar":"tutorialSidebar"},"api/drivers/shtc3":{"id":"api/drivers/shtc3","title":"SHTC3","description":"Driver for SHTC3 temperature/humidity sensor at I2C address 0x70.","sidebar":"tutorialSidebar"},"api/drivers/soilmoisture":{"id":"api/drivers/soilmoisture","title":"Soil Moisture","description":"Mounts a soil moisture sensor","sidebar":"tutorialSidebar"},"api/drivers/soundlevel":{"id":"api/drivers/soundlevel","title":"Sound Level","description":"Mounts a sound level sensor","sidebar":"tutorialSidebar"},"api/drivers/ssd1306":{"id":"api/drivers/ssd1306","title":"SSD1306","description":"Driver for SSD1306 OLED screen at I2C address 0x3c (or 0x3d).","sidebar":"tutorialSidebar"},"api/drivers/st7789":{"id":"api/drivers/st7789","title":"ST7735, ILI9163, ST7789","description":"Driver for ST7735, ST7789 and similar LCD screens using SPI.","sidebar":"tutorialSidebar"},"api/drivers/switch":{"id":"api/drivers/switch","title":"Switch","description":"Mounts a switch server","sidebar":"tutorialSidebar"},"api/drivers/trafficlight":{"id":"api/drivers/trafficlight","title":"Traffic Light","description":"The traffic light driver, startTrafficLight is used to control a toy traffic light, driving 3 LEDs.","sidebar":"tutorialSidebar"},"api/drivers/uc8151":{"id":"api/drivers/uc8151","title":"UC8151","description":"Driver for UC8151 eInk screens.","sidebar":"tutorialSidebar"},"api/drivers/waterlevel":{"id":"api/drivers/waterlevel","title":"Water Level","description":"Mounts a water level sensor","sidebar":"tutorialSidebar"},"api/math":{"id":"api/math","title":"Math","description":"Most typical JavaScript Math function are supported. Please file an issue if we missed one.","sidebar":"tutorialSidebar"},"api/observables/creation":{"id":"api/observables/creation","title":"Creation Operators","description":"from","sidebar":"tutorialSidebar"},"api/observables/dsp":{"id":"api/observables/dsp","title":"Digital Signal processing","description":"ewma","sidebar":"tutorialSidebar"},"api/observables/filter":{"id":"api/observables/filter","title":"Filter Operators","description":"filter","sidebar":"tutorialSidebar"},"api/observables/index":{"id":"api/observables/index","title":"Observables","description":"The @devicescript/observables builtin module provides a lightweight reactive observable framework, a limited subset of RxJS.","sidebar":"tutorialSidebar"},"api/observables/transform":{"id":"api/observables/transform","title":"Transform operators","description":"map","sidebar":"tutorialSidebar"},"api/observables/utils":{"id":"api/observables/utils","title":"Utilities operators","description":"tap","sidebar":"tutorialSidebar"},"api/runtime/index":{"id":"api/runtime/index","title":"Runtime","description":"The @devicescript/runtime builtin module","sidebar":"tutorialSidebar"},"api/runtime/palette":{"id":"api/runtime/palette","title":"Palette","description":"A fixed length color palette.","sidebar":"tutorialSidebar"},"api/runtime/pixelbuffer":{"id":"api/runtime/pixelbuffer","title":"PixelBuffer","description":"A 1D color vector to support color manipulation of LED strips. All colors are 24bit RGB colors.","sidebar":"tutorialSidebar"},"api/runtime/schedule":{"id":"api/runtime/schedule","title":"schedule","description":"The schedule function combines setTimeout and setInterval to provide a single function that can be used to schedule a function to run once or repeatedly.","sidebar":"tutorialSidebar"},"api/settings/index":{"id":"api/settings/index","title":"Settings","description":"The @devicescript/settings builtin module provides a lightweight flash storage for small setting values.","sidebar":"tutorialSidebar"},"api/spi":{"id":"api/spi","title":"SPI","description":"The SPI builtin package that exposes functions to read, write, transfer buffers over SPI.","sidebar":"tutorialSidebar"},"api/test/index":{"id":"api/test/index","title":"Test","description":"The @devicescript/test builtin package provides a lightweight unit test framework, with a subset of familiar APIs to Jest/Vitest/Mocha/Chai users (describe, test, expect).","sidebar":"tutorialSidebar"},"api/vm":{"id":"api/vm","title":"WebASM VM","description":"The @devicescript/vm package contains DeviceScript C virtual machine compiled to Web Assembly. It allows you to run bytecode in node.js and browsers.","sidebar":"tutorialSidebar"},"changelog":{"id":"changelog","title":"Release Notes","description":"{@import ../../vscode/CHANGELOG.md}","sidebar":"tutorialSidebar"},"contributing":{"id":"contributing","title":"Contributing","description":"Contributions are welcome!","sidebar":"tutorialSidebar"},"developer/board-configuration":{"id":"developer/board-configuration","title":"Board Configuration","description":"To target a specific hardware board or peripherical,","sidebar":"tutorialSidebar"},"developer/bundle":{"id":"developer/bundle","title":"Bundled firmware","description":"A firmware image can be bundled together with a DeviceScript program and settings","sidebar":"tutorialSidebar"},"developer/clients":{"id":"developer/clients","title":"Clients","description":"Learn how to use clients and roles in DeviceScript to interact with Jacdac services for sensors and actuators in a home heating system example.","sidebar":"tutorialSidebar"},"developer/commands":{"id":"developer/commands","title":"Commands","description":"Learn how to generate a mouse click with an air pressure sensor using TypeScript and the HidMouse class from the ds library. Tune the pressure threshold to detect a user blowing on the sensor and optimize debouncing with observables.","sidebar":"tutorialSidebar"},"developer/console":{"id":"developer/console","title":"Console output","description":"Learn how to use console functionality in DeviceScript to add logging to your script and how to use format strings to write registers.","sidebar":"tutorialSidebar"},"developer/crypto":{"id":"developer/crypto","title":"Cryptography","description":"The @devicescript/crypto provides functions to perform AES encryption and SHA256 digests.","sidebar":"tutorialSidebar"},"developer/development-gateway/configuration":{"id":"developer/development-gateway/configuration","title":"Configuration","description":"Learn how to configure the WiFi connection on devices and explore other configuration options related to cloud applications.","sidebar":"tutorialSidebar"},"developer/development-gateway/environment":{"id":"developer/development-gateway/environment","title":"Environment","description":"Learn how to configure and manage environment settings using Devicescript Cloud, OpenAPI, and Visual Studio Code extension.","sidebar":"tutorialSidebar"},"developer/development-gateway/gateway":{"id":"developer/development-gateway/gateway","title":"Development Gateway","description":"Learn how to set up and use the Development Gateway for DeviceScript, enabling rapid prototyping and deployment on Azure or locally.","sidebar":"tutorialSidebar"},"developer/development-gateway/index":{"id":"developer/development-gateway/index","title":"Development Gateway","description":"Learn how to use the DeviceScript cloud agnostic API to send and receive JSON messages, connect to the Development Gateway, and utilize application telemetry and message queues.","sidebar":"tutorialSidebar"},"developer/development-gateway/messages":{"id":"developer/development-gateway/messages","title":"Messages","description":"Learn how to publish and subscribe to messages using DeviceScript, Azure Event Hub, and Visual Studio Code extension.","sidebar":"tutorialSidebar"},"developer/development-gateway/telemetry":{"id":"developer/development-gateway/telemetry","title":"Application Telemetry","description":"Learn how to collect usage telemetry of your DeviceScript using trackEvent, trackMetric, and trackException methods.","sidebar":"tutorialSidebar"},"developer/drivers/analog":{"id":"developer/drivers/analog","title":"Analog","description":"Mounts an analog sensor","sidebar":"tutorialSidebar"},"developer/drivers/custom-services":{"id":"developer/drivers/custom-services","title":"Custom Services","description":"Custom service definition files can be added to the ./services/ folder as markdown file.","sidebar":"tutorialSidebar"},"developer/drivers/digital-io/index":{"id":"developer/drivers/digital-io/index","title":"Digital IO (GPIO)","description":"Digital GPIO","sidebar":"tutorialSidebar"},"developer/drivers/digital-io/wire":{"id":"developer/drivers/digital-io/wire","title":"Wire","description":"Arduino-like GPIO APIs","sidebar":"tutorialSidebar"},"developer/drivers/i2c":{"id":"developer/drivers/i2c","title":"I2C","description":"I2C builtin package that exposes","sidebar":"tutorialSidebar"},"developer/drivers/index":{"id":"developer/drivers/index","title":"Drivers","description":"In DeviceScript, any hardware component is accessed through a service client.","sidebar":"tutorialSidebar"},"developer/drivers/serial":{"id":"developer/drivers/serial","title":"Serial","description":"Serial drivers are not supported yet in DeviceScript, but can be added in the C firmware SDK.","sidebar":"tutorialSidebar"},"developer/drivers/spi":{"id":"developer/drivers/spi","title":"SPI","description":"SPI builtin package that exposes functions to read, write, transfer buffers over SPI.","sidebar":"tutorialSidebar"},"developer/errors":{"id":"developer/errors","title":"Errors","description":"Troubleshooting DeviceScript errors","sidebar":"tutorialSidebar"},"developer/graphics/display":{"id":"developer/graphics/display","title":"Display","description":"The Display","sidebar":"tutorialSidebar"},"developer/graphics/image":{"id":"developer/graphics/image","title":"Image","description":"The Image represents a space-optimized pateletted image, with either 1 or 4 bit per pixels.","sidebar":"tutorialSidebar"},"developer/graphics/index":{"id":"developer/graphics/index","title":"Graphics","description":"The @devicescript/graphics package provides an Image type and a Display type that supports","sidebar":"tutorialSidebar"},"developer/index":{"id":"developer/index","title":"Developer","description":"The DeviceScript developer experience is designed to be friendly with developers familiar with TypeScript projects.","sidebar":"tutorialSidebar"},"developer/iot/adafruit-io/index":{"id":"developer/iot/adafruit-io/index","title":"Adafruit.io","description":"In this sample, we upload temperature readings to Adafruit.io.","sidebar":"tutorialSidebar"},"developer/iot/blues-io/index":{"id":"developer/iot/blues-io/index","title":"Blues.io Notecard","description":"The Blues.io Notecard provides","sidebar":"tutorialSidebar"},"developer/iot/blynk-io/index":{"id":"developer/iot/blynk-io/index","title":"Blynk.io","description":"Blynk.io provides an IoT dashboard for devices with virtual pins.","sidebar":"tutorialSidebar"},"developer/iot/index":{"id":"developer/iot/index","title":"IoT","description":"Here are a set of guides on using DeviceScript with various IoT platforms.","sidebar":"tutorialSidebar"},"developer/iot/matlab-thingspeak/index":{"id":"developer/iot/matlab-thingspeak/index","title":"Matlab ThingSpeak","description":"Matlab ThingSpeak is an IoT platform","sidebar":"tutorialSidebar"},"developer/json":{"id":"developer/json","title":"JSON","description":"It\'s worth mentioning that JSON serialization and parsing is fully supported in DeviceScript.","sidebar":"tutorialSidebar"},"developer/jsx":{"id":"developer/jsx","title":"JSX/TSX","description":"JSX is an embeddable XML-like syntax (.tsx for TypeScript files).","sidebar":"tutorialSidebar"},"developer/leds/display":{"id":"developer/leds/display","title":"Display","description":"You can wrap an LED matrix as a Display","sidebar":"tutorialSidebar"},"developer/leds/driver":{"id":"developer/leds/driver","title":"LED Driver","description":"You can start a driver for WS2812B, APA102, or SK9822 using startLed.","sidebar":"tutorialSidebar"},"developer/leds/index":{"id":"developer/leds/index","title":"LEDs","description":"Controlling strips of programmable LEDs can be done through the Led client.","sidebar":"tutorialSidebar"},"developer/low-power":{"id":"developer/low-power","title":"Low Power","description":"Learn how to use the standby function in DeviceScript to put your ESP32 device into the lowest power sleep mode for a specified time and save on battery power.","sidebar":"tutorialSidebar"},"developer/mcu-temperature":{"id":"developer/mcu-temperature","title":"MCU Temperature","description":"Microcontrollers typically have a temperature sensor built in. This is a great way to monitor the temperature of the MCU itself.","sidebar":"tutorialSidebar"},"developer/net/encrypted-fetch":{"id":"developer/net/encrypted-fetch","title":"Encrypted Fetch","description":"The @devicescript/net package contains encryptedFetch() function which lets you","sidebar":"tutorialSidebar"},"developer/net/index":{"id":"developer/net/index","title":"Network and Sockets","description":"DeviceScript supports TCP, TLS, MQTT and HTTP/HTTPS sockets on specific devices.","sidebar":"tutorialSidebar"},"developer/net/mqtt":{"id":"developer/net/mqtt","title":"MQTT client","description":"The startMQTTClient function connects to a MQTT broker using TCP or TLS.","sidebar":"tutorialSidebar"},"developer/observables":{"id":"developer/observables","title":"Observables","description":"The @devicescript/observables builtin package provides a lightweight reactive observable framework, a limited subset of RxJS. Learn how to use observables in DeviceScript to listen for data and filter out small data changes.","sidebar":"tutorialSidebar"},"developer/packages/custom":{"id":"developer/packages/custom","title":"Custom Packages","description":"Using npm, GitHub releases, or other package manager is the recommended way to share your DeviceScript code.","sidebar":"tutorialSidebar"},"developer/packages/index":{"id":"developer/packages/index","title":"Packages","description":"Learn about the built-in packages and how to use and publish DeviceScript-compatible packages on npm.","sidebar":"tutorialSidebar"},"developer/register":{"id":"developer/register","title":"Register","description":"Learn how to read air pressure sensor data using `AirPressure` client. Subscribe to changes or read the data directly.","sidebar":"tutorialSidebar"},"developer/settings":{"id":"developer/settings","title":"Settings and Secrets","description":"Settings provides a friendly layer to read/write objects from the device flash. Keep it small, there\'s not a lot of space!","sidebar":"tutorialSidebar"},"developer/simulation":{"id":"developer/simulation","title":"Simulation","description":"Learn how to simulate DeviceScript devices using the web dashboard and Node.js project. Start by configuring your project for simulation and use Visual Studio Code to debug your DeviceScript code and the simulator in the same session.","sidebar":"tutorialSidebar"},"developer/status-light":{"id":"developer/status-light","title":"Status Light","description":"Learn how to use the status light on DeviceScript to message application states. Control the status LED until a system LED pattern is scheduled by the runtime.","sidebar":"tutorialSidebar"},"developer/testing":{"id":"developer/testing","title":"Testing","description":"DeviceScript provides a unit test framework that runs on the device. It has a syntax similar to Jest/Mocha/Chai.","sidebar":"tutorialSidebar"},"devices/add-board":{"id":"devices/add-board","title":"Add Board","description":"Learn how to create a new board configuration in DeviceScript for supported chipset architectures.","sidebar":"tutorialSidebar"},"devices/add-shield":{"id":"devices/add-shield","title":"Add Shield","description":"Shield typically rely on using an existing board definition","sidebar":"tutorialSidebar"},"devices/add-soc":{"id":"devices/add-soc","title":"Add SoC/MCU","description":"DeviceScript currently supports the following:","sidebar":"tutorialSidebar"},"devices/esp32/adafruit-feather-esp32-s2":{"id":"devices/esp32/adafruit-feather-esp32-s2","title":"Adafruit Feather ESP32-S2","description":"Adafruit Feather ESP32-S2","sidebar":"tutorialSidebar"},"devices/esp32/adafruit-qt-py-c3":{"id":"devices/esp32/adafruit-qt-py-c3","title":"Adafruit QT Py ESP32-C3 WiFi","description":"Adafruit QT Py ESP32-C3 WiFi","sidebar":"tutorialSidebar"},"devices/esp32/esp32-bare":{"id":"devices/esp32/esp32-bare","title":"Espressif ESP32 (bare)","description":"Espressif ESP32 (bare)","sidebar":"tutorialSidebar"},"devices/esp32/esp32-c3fh4-rgb":{"id":"devices/esp32/esp32-c3fh4-rgb","title":"ESP32-C3FH4-RGB","description":"ESP32-C3FH4-RGB","sidebar":"tutorialSidebar"},"devices/esp32/esp32-devkit-c":{"id":"devices/esp32/esp32-devkit-c","title":"Espressif ESP32-DevKitC","description":"Espressif ESP32-DevKitC","sidebar":"tutorialSidebar"},"devices/esp32/esp32c3-bare":{"id":"devices/esp32/esp32c3-bare","title":"Espressif ESP32-C3 (bare)","description":"Espressif ESP32-C3 (bare)","sidebar":"tutorialSidebar"},"devices/esp32/esp32c3-rust-devkit":{"id":"devices/esp32/esp32c3-rust-devkit","title":"Espressif ESP32-C3-RUST-DevKit","description":"Espressif ESP32-C3-RUST-DevKit","sidebar":"tutorialSidebar"},"devices/esp32/esp32s2-bare":{"id":"devices/esp32/esp32s2-bare","title":"Espressif ESP32-S2 (bare)","description":"Espressif ESP32-S2 (bare)","sidebar":"tutorialSidebar"},"devices/esp32/esp32s3-bare":{"id":"devices/esp32/esp32s3-bare","title":"Espressif ESP32-S3 (bare)","description":"Espressif ESP32-S3 (bare)","sidebar":"tutorialSidebar"},"devices/esp32/esp32s3-devkit-m":{"id":"devices/esp32/esp32s3-devkit-m","title":"Espressif ESP32-S3 DevKitM","description":"Espressif ESP32-S3 DevKitM","sidebar":"tutorialSidebar"},"devices/esp32/feather-s2":{"id":"devices/esp32/feather-s2","title":"Unexpected Maker FeatherS2 ESP32-S2","description":"Unexpected Maker FeatherS2 ESP32-S2","sidebar":"tutorialSidebar"},"devices/esp32/index":{"id":"devices/esp32/index","title":"ESP32","description":"The following devices use the firmware from https://github.com/microsoft/devicescript-esp32 which builds on top of ESP-IDF.","sidebar":"tutorialSidebar"},"devices/esp32/msr207-v42":{"id":"devices/esp32/msr207-v42","title":"MSR JM Brain S2-mini 207 v4.2","description":"MSR JM Brain S2-mini 207 v4.2","sidebar":"tutorialSidebar"},"devices/esp32/msr207-v43":{"id":"devices/esp32/msr207-v43","title":"MSR JM Brain S2-mini 207 v4.3","description":"MSR JM Brain S2-mini 207 v4.3","sidebar":"tutorialSidebar"},"devices/esp32/msr48":{"id":"devices/esp32/msr48","title":"MSR JacdacIoT 48 v0.2","description":"MSR JacdacIoT 48 v0.2","sidebar":"tutorialSidebar"},"devices/esp32/seeed-xiao-esp32c3":{"id":"devices/esp32/seeed-xiao-esp32c3","title":"Seeed Studio XIAO ESP32C3","description":"Seeed Studio XIAO ESP32C3","sidebar":"tutorialSidebar"},"devices/esp32/seeed-xiao-esp32c3-msr218":{"id":"devices/esp32/seeed-xiao-esp32c3-msr218","title":"Seeed Studio XIAO ESP32C3 with MSR218 base","description":"Seeed Studio XIAO ESP32C3 with MSR218 base","sidebar":"tutorialSidebar"},"devices/index":{"id":"devices/index","title":"Devices","description":"This page links to various developer boards that have a DeviceScript runtime firmware.","sidebar":"tutorialSidebar"},"devices/rp2040/index":{"id":"devices/rp2040/index","title":"RP2040","description":"The following devices use the firmware from https://github.com/microsoft/devicescript-pico","sidebar":"tutorialSidebar"},"devices/rp2040/msr124":{"id":"devices/rp2040/msr124","title":"MSR RP2040 Brain 124 v0.1","description":"MSR RP2040 Brain 124 v0.1","sidebar":"tutorialSidebar"},"devices/rp2040/msr59":{"id":"devices/rp2040/msr59","title":"MSR Brain RP2040 59 v0.1","description":"MSR Brain RP2040 59 v0.1","sidebar":"tutorialSidebar"},"devices/rp2040/pico":{"id":"devices/rp2040/pico","title":"Raspberry Pi Pico","description":"Raspberry Pi Pico","sidebar":"tutorialSidebar"},"devices/rp2040/pico-w":{"id":"devices/rp2040/pico-w","title":"Raspberry Pi Pico W","description":"Raspberry Pi Pico W","sidebar":"tutorialSidebar"},"devices/shields/index":{"id":"devices/shields/index","title":"Shields","description":"Shields typically bundle a number of sensor and connectors to accelerate the use of general purpose boards.","sidebar":"tutorialSidebar"},"devices/shields/pico-bricks":{"id":"devices/shields/pico-bricks","title":"Pico Bricks","description":"- Device: Raspberry Pi Pico W","sidebar":"tutorialSidebar"},"devices/shields/pimoroni-pico-badger":{"id":"devices/shields/pimoroni-pico-badger","title":"Pimoroni Badger RP2040","description":"- Device: Raspberry Pi Pico W","sidebar":"tutorialSidebar"},"devices/shields/waveshare-pico-lcd-114":{"id":"devices/shields/waveshare-pico-lcd-114","title":"WaveShare Pico-LCD","description":"- Device: Raspberry Pi Pico W","sidebar":"tutorialSidebar"},"devices/shields/xiao-expansion-board":{"id":"devices/shields/xiao-expansion-board","title":"Xiao ESP32-C3 Expansion Board","description":"- Device: Seeed Xiao ESP32-C3 or Adafruit QT Py C3","sidebar":"tutorialSidebar"},"getting-started/cli":{"id":"getting-started/cli","title":"Command Line","description":"Learn how to set up and use the DeviceScript command line tool for creating and managing projects, and improve your development workflow.","sidebar":"tutorialSidebar"},"getting-started/index":{"id":"getting-started/index","title":"Getting Started","description":"Learn how to get started with DeviceScript using Visual Studio Code, command line, and explore samples.","sidebar":"tutorialSidebar"},"getting-started/vscode/debugging":{"id":"getting-started/vscode/debugging","title":"Debugging","description":"DeviceScript programs can be debugged using the usual Visual Studio Code debugger interface.","sidebar":"tutorialSidebar"},"getting-started/vscode/index":{"id":"getting-started/vscode/index","title":"Visual Studio Code Extension","description":"The Visual Studio Code extension provides the best developer experience for DeviceScript.","sidebar":"tutorialSidebar"},"getting-started/vscode/simulation":{"id":"getting-started/vscode/simulation","title":"Simulation","description":"DeviceScript provides a rich support for simulating devices and peripherals.","sidebar":"tutorialSidebar"},"getting-started/vscode/troubleshooting":{"id":"getting-started/vscode/troubleshooting","title":"Troubleshooting","description":"troubleshooting}","sidebar":"tutorialSidebar"},"getting-started/vscode/user-interface":{"id":"getting-started/vscode/user-interface","title":"User Interface","description":"Device Explorer","sidebar":"tutorialSidebar"},"getting-started/vscode/workspaces":{"id":"getting-started/vscode/workspaces","title":"Local and Remote Workspaces","description":"In a local workspace, DeviceScript opens a native serial connection to communicate with hardware devices.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"DeviceScript","description":"DeviceScript is a small footprint bytecode interpreter that brings a TypeScript developer experience to low-resource microcontroller-based devices. Write reusable application/firmware on top of abstract hardware services and communicate to a cloud with JSON through a unified API. Full debugging experience in Visual Studio Code. Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages.","sidebar":"tutorialSidebar"},"language/async":{"id":"language/async","title":"Async/await and promises","description":"Learn the differences between DeviceScript and JavaScript in handling async/await and promises, and how fibers are used in DeviceScript.","sidebar":"tutorialSidebar"},"language/bytecode":{"id":"language/bytecode","title":"Bytecode","description":"{@import ../../../bytecode/bytecode.md}","sidebar":"tutorialSidebar"},"language/devicescript-vs-javascript":{"id":"language/devicescript-vs-javascript","title":"Other differences with JavaScript","description":"A comprehensive guide to the differences in semantics between DeviceScript and EcmaScript/JavaScript/TypeScript.","sidebar":"tutorialSidebar"},"language/hex":{"id":"language/hex","title":"Hex template literal","description":"Learn how to use the hex template literal in JavaScript to create a Buffer from a hex string and store it in flash memory.","sidebar":"tutorialSidebar"},"language/index":{"id":"language/index","title":"DeviceScript Language","description":"Learn about the supported and unsupported features of DeviceScript, a TypeScript subset designed for limited resources environments.","sidebar":"tutorialSidebar"},"language/runtime":{"id":"language/runtime","title":"Runtime implementation","description":"DeviceScript compiler takes TypeScript files and generates bytecode files, which are then executed by","sidebar":"tutorialSidebar"},"language/special":{"id":"language/special","title":"Special objects","description":"Learn about the special objects in runtime, their limitations, and how to work with them effectively.","sidebar":"tutorialSidebar"},"language/strings":{"id":"language/strings","title":"Strings and Unicode","description":"Understanding the differences between ECMAScript and DeviceScript in handling strings, Unicode, and UTF-16 code units.","sidebar":"tutorialSidebar"},"language/tostring":{"id":"language/tostring","title":"toString() method","description":"Learn how the toString() method works in DeviceScript and how it helps in string conversion for objects with limited stack space on embedded devices.","sidebar":"tutorialSidebar"},"language/tree-shaking":{"id":"language/tree-shaking","title":"Tree-shaking","description":"Learn about tree-shaking in Microsoft DeviceScript, how to use the ds.keep() function, and potential improvements in future releases.","sidebar":"tutorialSidebar"},"samples/blinky":{"id":"samples/blinky","title":"Blinky","description":"Learn how to create the classic LED blinking program on Raspberry Pi Pico and ESP32 using DeviceScript.","sidebar":"tutorialSidebar"},"samples/button-led":{"id":"samples/button-led","title":"Button LED","description":"This sample toggles a LED on/off by listening on the down events emitted by a button.","sidebar":"tutorialSidebar"},"samples/copy-paste-button":{"id":"samples/copy-paste-button","title":"Copy Paste Button","description":"Create a copy-paste micro-keyboard on Raspberry Pi Pico using a single button, HID keyboard server, and a status LED.","sidebar":"tutorialSidebar"},"samples/dimmer":{"id":"samples/dimmer","title":"Dimmer","description":"A potentiometer (slider or rotary) is used to control the brightness (intensity register)","sidebar":"tutorialSidebar"},"samples/double-blinky":{"id":"samples/double-blinky","title":"Double Blinky","description":"This example shows how to blink two LEDs at a different rate.","sidebar":"tutorialSidebar"},"samples/github-build-status":{"id":"samples/github-build-status","title":"GitHub Build Status","description":"In this sample, we will query the GitHub API to get the status of the latest build of a repository. The status will be used to update the status light.","sidebar":"tutorialSidebar"},"samples/homebridge-humidity":{"id":"samples/homebridge-humidity","title":"Homebridge + Humidity Sensor","description":"Learn how to integrate a humidity sensor with HomeKit using HomeBridge, MQTT server, and DeviceScript Gateway.","sidebar":"tutorialSidebar"},"samples/index":{"id":"samples/index","title":"Samples","description":"Explore various markdown samples including Blinky, Thermostat, and Copy-Paste Button","sidebar":"tutorialSidebar"},"samples/schedule-blinky":{"id":"samples/schedule-blinky","title":"Schedule Blinky","description":"This sample blinks the onboard LED using the schedule","sidebar":"tutorialSidebar"},"samples/status-light-blinky":{"id":"samples/status-light-blinky","title":"Status Light Blinky","description":"Many boards have integrated status LED that can be controlled using the setStatusLight function.","sidebar":"tutorialSidebar"},"samples/temperature-mqtt":{"id":"samples/temperature-mqtt","title":"Temperature + MQTT","description":"Temperature logging to Adafruit.io using QT Py and SHCT3","sidebar":"tutorialSidebar"},"samples/thermostat":{"id":"samples/thermostat","title":"Thermostat","description":"Learn how to create a thermostat controller using temperature sensor, relay, and observables for filtering, throttling, and level detection.","sidebar":"tutorialSidebar"},"samples/thermostat-gateway":{"id":"samples/thermostat-gateway","title":"Thermostat + Gateway","description":"Learn how to connect a thermostat device to a cloud gateway and configure the desired temperature from the cloud using DeviceScript.","sidebar":"tutorialSidebar"},"samples/weather-dashboard":{"id":"samples/weather-dashboard","title":"Weather Dashboard","description":"This sample uses a ValueDashboard to render temperature, humidity readings","sidebar":"tutorialSidebar"},"samples/weather-display":{"id":"samples/weather-display","title":"Weather Display","description":"Learn how to create a weather display using a temperature and humidity sensor and a basic character display.","sidebar":"tutorialSidebar"},"samples/workshop/index":{"id":"samples/workshop/index","title":"Workshop","description":"Leverage your TypeScript skills to program electronics using DeviceScript.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/assets/js/93ebf6e1.24a0cd97.js b/assets/js/93ebf6e1.24a0cd97.js new file mode 100644 index 00000000000..b59f3936ec1 --- /dev/null +++ b/assets/js/93ebf6e1.24a0cd97.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5109],{35318:(t,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>u});var r=n(27378);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function l(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n,r,a={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var o=r.createContext({}),s=function(t){var e=r.useContext(o),n=e;return t&&(n="function"==typeof t?t(e):p(p({},e),t)),n},d=function(t){var e=s(t.components);return r.createElement(o.Provider,{value:e},t.children)},m="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},g=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,i=t.originalType,o=t.parentName,d=l(t,["components","mdxType","originalType","parentName"]),m=s(n),g=a,u=m["".concat(o,".").concat(g)]||m[g]||c[g]||i;return n?r.createElement(u,p(p({ref:e},d),{},{components:n})):r.createElement(u,p({ref:e},d))}));function u(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=n.length,p=new Array(i);p[0]=g;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[m]="string"==typeof t?t:a,p[1]=l;for(var s=2;s<i;s++)p[s]=n[s];return r.createElement.apply(null,p)}return r.createElement.apply(null,n)}g.displayName="MDXCreateElement"},72771:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(25773),a=(n(27378),n(35318));const i={description:"MSR JM Brain S2-mini 207 v4.2"},p="MSR JM Brain S2-mini 207 v4.2",l={unversionedId:"devices/esp32/msr207-v42",id:"devices/esp32/msr207-v42",title:"MSR JM Brain S2-mini 207 v4.2",description:"MSR JM Brain S2-mini 207 v4.2",source:"@site/docs/devices/esp32/msr207-v42.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/msr207-v42",permalink:"/devicescript/devices/esp32/msr207-v42",draft:!1,tags:[],version:"current",frontMatter:{description:"MSR JM Brain S2-mini 207 v4.2"},sidebar:"tutorialSidebar",previous:{title:"Unexpected Maker FeatherS2 ESP32-S2",permalink:"/devicescript/devices/esp32/feather-s2"},next:{title:"MSR JM Brain S2-mini 207 v4.3",permalink:"/devicescript/devices/esp32/msr207-v43"}},o={},s=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:s},m="wrapper";function c(t){let{components:e,...n}=t;return(0,a.kt)(m,(0,r.Z)({},d,n,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"msr-jm-brain-s2-mini-207-v42"},"MSR JM Brain S2-mini 207 v4.2"),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Jacdac on pin 17 using Jacdac connector"),(0,a.kt)("li",{parentName:"ul"},"RGB LED on pins 8, 7, 6 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin 43 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: power (auto-start)")),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,a.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P33")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P34")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"jacdac.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,a.kt)("td",{parentName:"tr",align:"right"},"jacdac.pin, analogOut, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[0]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[0]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[1]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[1]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[2]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[2]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"log.pinTX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinCS")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinCS, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinMISO")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO37"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinMISO, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinMOSI")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinMOSI, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"sd.pinSCK")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,a.kt)("td",{parentName:"tr",align:"right"},"sd.pinSCK, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinEn")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinEn, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinFault")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinFault, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "MSR JM Brain S2-mini 207 v4.2".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/msr207_v42"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board msr207_v42\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-msr207_v42-0x1000.bin"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="msr207_v42.json"',title:'"msr207_v42.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "msr207_v42",\n "devName": "MSR JM Brain S2-mini 207 v4.2",\n "productId": "0x322e0e64",\n "archId": "esp32s2",\n "jacdac": {\n "$connector": "Jacdac",\n "pin": 17\n },\n "led": {\n "rgb": [\n {\n "mult": 250,\n "pin": 8\n },\n {\n "mult": 60,\n "pin": 7\n },\n {\n "mult": 150,\n "pin": 6\n }\n ]\n },\n "log": {\n "pinTX": 43\n },\n "pins": {\n "P33": 33,\n "P34": 34\n },\n "sd": {\n "pinCS": 38,\n "pinMISO": 37,\n "pinMOSI": 35,\n "pinSCK": 36\n },\n "services": [\n {\n "faultIgnoreMs": 100,\n "mode": 0,\n "name": "power",\n "pinEn": 2,\n "pinFault": 13,\n "service": "power"\n }\n ]\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9421b549.00d0bdf9.js b/assets/js/9421b549.00d0bdf9.js new file mode 100644 index 00000000000..c2abe6f4798 --- /dev/null +++ b/assets/js/9421b549.00d0bdf9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1343],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=a,d=u["".concat(c,".").concat(m)]||u[m]||f[m]||i;return r?n.createElement(d,o(o({ref:t},s),{},{components:r})):n.createElement(d,o({ref:t},s))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},43460:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var n=r(25773),a=(r(27378),r(35318));const i={description:"Learn how to use the hex template literal in JavaScript to create a Buffer from a hex string and store it in flash memory.",keywords:["hex template literal","JavaScript","Buffer","hex string","flash memory"]},o="Hex template literal",l={unversionedId:"language/hex",id:"language/hex",title:"Hex template literal",description:"Learn how to use the hex template literal in JavaScript to create a Buffer from a hex string and store it in flash memory.",source:"@site/docs/language/hex.mdx",sourceDirName:"language",slug:"/language/hex",permalink:"/devicescript/language/hex",draft:!1,tags:[],version:"current",frontMatter:{description:"Learn how to use the hex template literal in JavaScript to create a Buffer from a hex string and store it in flash memory.",keywords:["hex template literal","JavaScript","Buffer","hex string","flash memory"]},sidebar:"tutorialSidebar",previous:{title:"Other differences with JavaScript",permalink:"/devicescript/language/devicescript-vs-javascript"},next:{title:"Devices",permalink:"/devicescript/devices/"}},c={},p=[],s={toc:p},u="wrapper";function f(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"hex-template-literal"},"Hex template literal"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"hex")," template literal is a builtin template literal that can be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"Buffer")," from a hex string.\nThe buffer is stored in flash."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-js"},"const buf: Buffer = hex`00 ab 12 2f 00`\n")),(0,a.kt)("p",null,"Comments and whitespace are allowed in ",(0,a.kt)("inlineCode",{parentName:"p"},"hex")," literals:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const commentedData: Buffer = hex`\n01 02 03 // first three numbers\nff aa // two more bytes\n`\n")))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/96998115.4acc56a8.js b/assets/js/96998115.4acc56a8.js new file mode 100644 index 00000000000..6241a090515 --- /dev/null +++ b/assets/js/96998115.4acc56a8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2527],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,a(a({ref:t},s),{},{components:r})):n.createElement(m,a({ref:t},s))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:o,a[1]=p;for(var c=2;c<i;c++)a[c]=r[c];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},46669:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(25773),o=(r(27378),r(35318));const i={sidebar_position:11,description:"Learn how to use the standby function in DeviceScript to put your ESP32 device into the lowest power sleep mode for a specified time and save on battery power."},a="Low Power",p={unversionedId:"developer/low-power",id:"developer/low-power",title:"Low Power",description:"Learn how to use the standby function in DeviceScript to put your ESP32 device into the lowest power sleep mode for a specified time and save on battery power.",source:"@site/docs/developer/low-power.mdx",sourceDirName:"developer",slug:"/developer/low-power",permalink:"/devicescript/developer/low-power",draft:!1,tags:[],version:"current",sidebarPosition:11,frontMatter:{sidebar_position:11,description:"Learn how to use the standby function in DeviceScript to put your ESP32 device into the lowest power sleep mode for a specified time and save on battery power."},sidebar:"tutorialSidebar",previous:{title:"MCU Temperature",permalink:"/devicescript/developer/mcu-temperature"},next:{title:"Network and Sockets",permalink:"/devicescript/developer/net/"}},l={},c=[{value:"Standby",id:"standby",level:2}],s={toc:c},d="wrapper";function u(e){let{components:t,...r}=e;return(0,o.kt)(d,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"low-power"},"Low Power"),(0,o.kt)("h2",{id:"standby"},"Standby"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"standby")," function attempt to put devices into lowest power sleep mode for a specified time,\nmost likely involving a full reset on wake-up."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { standby } from "@devicescript/runtime"\n\nconsole.log("going to sleep for 1 hour...")\n// highlight_next_line\nawait standby(3600_000) // shut down for 1 hour\n')),(0,o.kt)("p",null,"Use allow to save on battery power for long running operation where the device should mostly be idle in between sensor readings."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("inlineCode",{parentName:"p"},"standby")," is available on ESP32 chip currently.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/97af9a3e.2a643e6e.js b/assets/js/97af9a3e.2a643e6e.js new file mode 100644 index 00000000000..c50e3eab252 --- /dev/null +++ b/assets/js/97af9a3e.2a643e6e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4768],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=i.createContext({}),c=function(e){var t=i.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return i.createElement(o.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},g=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,o=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),g=r,m=d["".concat(o,".").concat(g)]||d[g]||u[g]||a;return n?i.createElement(m,l(l({ref:t},p),{},{components:n})):i.createElement(m,l({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=g;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[d]="string"==typeof e?e:r,l[1]=s;for(var c=2;c<a;c++)l[c]=n[c];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}g.displayName="MDXCreateElement"},36599:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var i=n(25773),r=(n(27378),n(35318));const a={},l="Settings",s={unversionedId:"api/settings/index",id:"api/settings/index",title:"Settings",description:"The @devicescript/settings builtin module provides a lightweight flash storage for small setting values.",source:"@site/docs/api/settings/index.md",sourceDirName:"api/settings",slug:"/api/settings/",permalink:"/devicescript/api/settings/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Utilities operators",permalink:"/devicescript/api/observables/utils"},next:{title:"Test",permalink:"/devicescript/api/test/"}},o={},c=[{value:"Usage",id:"usage",level:2},{value:"<code>.env.defaults</code> and <code>.env.local</code> files",id:"envdefaults-and-envlocal-files",level:3},{value:"writeSetting",id:"writesetting",level:3},{value:"readSetting",id:"readsetting",level:3},{value:"deleteSetting",id:"deletesetting",level:3}],p={toc:c},d="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,i.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"settings"},"Settings"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@devicescript/settings")," ",(0,r.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin")," module provides a lightweight flash storage for small setting values.\nSettings values are serialized in flash and available across device reset. Firmware updates might erase the settings."),(0,r.kt)("h2",{id:"usage"},"Usage"),(0,r.kt)("p",null,"You can store settings and secrets in ",(0,r.kt)("inlineCode",{parentName:"p"},".env")," files."),(0,r.kt)("h3",{id:"envdefaults-and-envlocal-files"},(0,r.kt)("inlineCode",{parentName:"h3"},".env.defaults")," and ",(0,r.kt)("inlineCode",{parentName:"h3"},".env.local")," files"),(0,r.kt)("p",null,"Don't store secrets or settings in the code, use ",(0,r.kt)("inlineCode",{parentName:"p"},".env")," files instead."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"./.env.defaults"),": store general settings (",(0,r.kt)("strong",{parentName:"li"},"tracked by version control"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"./.env.local"),": store secrets or override for general settings (",(0,r.kt)("strong",{parentName:"li"},"untracked by version control"),")")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},".env*")," file use a similar format to node.js ",(0,r.kt)("inlineCode",{parentName:"p"},".env")," file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-env",metastring:'title="./.env.defaults"',title:'"./.env.defaults"'},"# This file is tracked by git. DO NOT store secrets in this file.\nTEMP=68\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-env",metastring:'title="./.env.local"',title:'"./.env.local"'},"# This file is **NOT** tracked by git and may contain secrets\nPASSWORD=VALUE\nTEMP=70 # override TEMP\n")),(0,r.kt)("p",null,"The secrets can only be accessed by the DeviceScript program and are not available through the Jacdac protocol."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"multiline values, and ",(0,r.kt)("inlineCode",{parentName:"li"},"#")," in quote strings are not supported."),(0,r.kt)("li",{parentName:"ul"},"key length should be less than 14 characters.")),(0,r.kt)("h3",{id:"writesetting"},"writeSetting"),(0,r.kt)("p",null,"Serializes an object into a setting at a given key. The key name should be less than 16 characters."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { writeSetting } from "@devicescript/settings"\n\n// highlight-next-line\nawait writeSetting("hello", { world: true })\n')),(0,r.kt)("h3",{id:"readsetting"},"readSetting"),(0,r.kt)("p",null,"Deserializes an object from a setting at a given key. If the key is missing or invalid format, it returns ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," or the second argument."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { readSetting } from "@devicescript/settings"\n\n// highlight-next-line\nconst world = await readSetting("hello", ":)")\n')),(0,r.kt)("h3",{id:"deletesetting"},"deleteSetting"),(0,r.kt)("p",null,"Deletes a setting at the given key. If the setting does not exist, does nothing."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { deleteSetting } from "@devicescript/settings"\n\n// highlight-next-line\nawait deleteSetting("hello")\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/98876a2d.7d9cb536.js b/assets/js/98876a2d.7d9cb536.js new file mode 100644 index 00000000000..b8002a0b33b --- /dev/null +++ b/assets/js/98876a2d.7d9cb536.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3032],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>f});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(f,o(o({ref:t},l),{},{components:n})):r.createElement(f,o({ref:t},l))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},2805:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(25773),a=(n(27378),n(35318));const i={sidebar_position:1,description:"Learn the differences between DeviceScript and JavaScript in handling async/await and promises, and how fibers are used in DeviceScript.",keywords:["DeviceScript","async/await","promises","fibers","JavaScript"]},o="Async/await and promises",s={unversionedId:"language/async",id:"language/async",title:"Async/await and promises",description:"Learn the differences between DeviceScript and JavaScript in handling async/await and promises, and how fibers are used in DeviceScript.",source:"@site/docs/language/async.mdx",sourceDirName:"language",slug:"/language/async",permalink:"/devicescript/language/async",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Learn the differences between DeviceScript and JavaScript in handling async/await and promises, and how fibers are used in DeviceScript.",keywords:["DeviceScript","async/await","promises","fibers","JavaScript"]},sidebar:"tutorialSidebar",previous:{title:"DeviceScript Language",permalink:"/devicescript/language/"},next:{title:"toString() method",permalink:"/devicescript/language/tostring"}},c={},p=[],l={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"asyncawait-and-promises"},"Async/await and promises"),(0,a.kt)("p",null,"The main difference in semantics between DeviceScript and JavaScript is that DeviceScript programs run in multiple fibers (threads).\nIn practice, this behaves like JS with ",(0,a.kt)("inlineCode",{parentName:"p"},"async"),"/",(0,a.kt)("inlineCode",{parentName:"p"},"await")," but without an ability to manipulate promises directly\n(that is fibers can only interleave at ",(0,a.kt)("inlineCode",{parentName:"p"},"await")," points and at most one fiber runs at any given time)."),(0,a.kt)("p",null,"The compiler enforces usage of ",(0,a.kt)("inlineCode",{parentName:"p"},"await")," where needed.\nThe ",(0,a.kt)("inlineCode",{parentName:"p"},"Promise<T>")," is still used just as in TypeScript, but it has no properties."),(0,a.kt)("p",null,"Technically, the interpreter implements fibers internally (they can be accessed through ",(0,a.kt)("inlineCode",{parentName:"p"},"ds.Fiber")," class),\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"await")," keyword is no-op and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Promise")," type has no runtime representation.\nYou can inspect the currently running fibers in the debugger\nand stack traces are not cut at ",(0,a.kt)("inlineCode",{parentName:"p"},"await")," points (both of which match programmers general (if not JS-specific) expectations)."),(0,a.kt)("p",null,"You can use ",(0,a.kt)("inlineCode",{parentName:"p"},"Function.start(...args: any[])")," to start an async or sync function in a new fiber.\nIt will begin executing only after the current fiber hits an ",(0,a.kt)("inlineCode",{parentName:"p"},"await")," (",(0,a.kt)("inlineCode",{parentName:"p"},".start()")," itself is not ",(0,a.kt)("inlineCode",{parentName:"p"},"async"),")."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/98f2cacc.ede0cf37.js b/assets/js/98f2cacc.ede0cf37.js new file mode 100644 index 00000000000..daa7b83d615 --- /dev/null +++ b/assets/js/98f2cacc.ede0cf37.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2561],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},s="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(r),d=i,f=s["".concat(c,".").concat(d)]||s[d]||m[d]||a;return r?n.createElement(f,o(o({ref:t},u),{},{components:r})):n.createElement(f,o({ref:t},u))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[s]="string"==typeof e?e:i,o[1]=p;for(var l=2;l<a;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},44800:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const a={},o="Runtime",p={unversionedId:"api/runtime/index",id:"api/runtime/index",title:"Runtime",description:"The @devicescript/runtime builtin module",source:"@site/docs/api/runtime/index.mdx",sourceDirName:"api/runtime",slug:"/api/runtime/",permalink:"/devicescript/api/runtime/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Water Level",permalink:"/devicescript/api/drivers/waterlevel"},next:{title:"Palette",permalink:"/devicescript/api/runtime/palette"}},c={},l=[],u={toc:l},s="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(s,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"runtime"},"Runtime"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/runtime")," ",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin")," module\nprovides additional runtime helpers."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import "@devicescript/runtime"\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/99cc6920.85890420.js b/assets/js/99cc6920.85890420.js new file mode 100644 index 00000000000..457435aca65 --- /dev/null +++ b/assets/js/99cc6920.85890420.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9328],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=c(n),u=o,m=d["".concat(p,".").concat(u)]||d[u]||y[u]||i;return n?r.createElement(m,a(a({ref:t},l),{},{components:n})):r.createElement(m,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var c=2;c<i;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},2997:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>y,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(25773),o=(n(27378),n(35318));const i={sidebar_position:100,title:"Cryptography"},a="Cryptographic Primitives",s={unversionedId:"developer/crypto",id:"developer/crypto",title:"Cryptography",description:"The @devicescript/crypto provides functions to perform AES encryption and SHA256 digests.",source:"@site/docs/developer/crypto.mdx",sourceDirName:"developer",slug:"/developer/crypto",permalink:"/devicescript/developer/crypto",draft:!1,tags:[],version:"current",sidebarPosition:100,frontMatter:{sidebar_position:100,title:"Cryptography"},sidebar:"tutorialSidebar",previous:{title:"Matlab ThingSpeak",permalink:"/devicescript/developer/iot/matlab-thingspeak/"},next:{title:"Development Gateway",permalink:"/devicescript/developer/development-gateway/"}},p={},c=[{value:"Symmetric encryption",id:"symmetric-encryption",level:2},{value:"SHA256 digest and HMAC",id:"sha256-digest-and-hmac",level:2},{value:"Key-derivation function",id:"key-derivation-function",level:2}],l={toc:c},d="wrapper";function y(e){let{components:t,...n}=e;return(0,o.kt)(d,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"cryptographic-primitives"},"Cryptographic Primitives"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"@devicescript/crypto")," provides functions to perform AES encryption and SHA256 digests."),(0,o.kt)("h2",{id:"symmetric-encryption"},"Symmetric encryption"),(0,o.kt)("p",null,"Let's start with simple encryption/decryption example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { decrypt, encrypt, randomBuffer, ivSize } from "@devicescript/crypto"\nimport { readSetting } from "@devicescript/settings"\nimport { assert } from "@devicescript/core"\n\n// this is currently the only algorithm supported\nconst algo = "aes-256-ccm"\n// get key from settings\nconst key = Buffer.from(await readSetting<string>("ENC_KEY"), "hex")\n// you should never ever reuse IV; always generate them randomly!\nconst iv = randomBuffer(ivSize(algo))\n// encrypt data\nconst encrypted = encrypt({\n algo,\n key,\n iv,\n data: Buffer.from("Hello world!"),\n tagLength: 4,\n})\n\n// decryption takes the similar arguments\nconst plain = decrypt({\n algo,\n key,\n iv,\n data: encrypted,\n tagLength: 4,\n})\n\nconsole.log(encrypted, plain)\n\nassert(plain.toString("utf-8") === "Hello world!")\n')),(0,o.kt)("h2",{id:"sha256-digest-and-hmac"},"SHA256 digest and HMAC"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"digest()")," function lets you compute cryptographically strong digests (hashes).\nThe only algorithm currently supported is ",(0,o.kt)("inlineCode",{parentName:"p"},"sha256"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { digest } from "@devicescript/crypto"\n\nconst hash = digest("sha256", Buffer.from("Hello world!"))\nconsole.log(hash.toString("hex"))\n')),(0,o.kt)("p",null,"You can pass more buffers to ",(0,o.kt)("inlineCode",{parentName:"p"},"digest()")," - they will be concatenated."),(0,o.kt)("p",null,"You can also pass a key to the SHA256 function, to compute an HMAC (authenticated digest):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { hmac } from "@devicescript/crypto"\n\nconst hash = hmac(Buffer.from("Secret!"), "sha256", Buffer.from("Hello world!"))\nconsole.log(hash.toString("hex"))\n')),(0,o.kt)("h2",{id:"key-derivation-function"},"Key-derivation function"),(0,o.kt)("p",null,"In case you want to go with passwords, instead of binary 32 byte keys,\nyou can use the RFC 5869 HKDF.\nThe string ",(0,o.kt)("inlineCode",{parentName:"p"},'"Req-1"')," describes the type of key you want to generate,\nit can be anything."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { sha256Hkdf } from "@devicescript/crypto"\n\nconst password = "SuPeRSecret!!"\nconst key = sha256Hkdf(password, "Req-1")\nconsole.log(key.toString("hex"))\n')),(0,o.kt)("p",null,"This gives the same result as the following in node.js:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import * as crypto from "node:crypto"\nconst password = "SuPeRSecret!!"\nconst key = Buffer.from(crypto.hkdfSync("sha256", password, "", "Req-1", 32))\nconsole.log(key.toString("hex"))\n')))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/99d3ca33.d97ad59a.js b/assets/js/99d3ca33.d97ad59a.js new file mode 100644 index 00000000000..9397115ab9e --- /dev/null +++ b/assets/js/99d3ca33.d97ad59a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6862],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,g=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return n?r.createElement(g,a(a({ref:t},s),{},{components:n})):r.createElement(g,a({ref:t},s))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:i,a[1]=c;for(var p=2;p<o;p++)a[p]=n[p];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},54409:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},a="LedSingle",c={unversionedId:"api/clients/ledsingle",id:"api/clients/ledsingle",title:"LedSingle",description:"The LED Single service is deprecated and not supported in DeviceScript.",source:"@site/docs/api/clients/ledsingle.md",sourceDirName:"api/clients",slug:"/api/clients/ledsingle",permalink:"/devicescript/api/clients/ledsingle",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},p=[],s={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ledsingle"},"LedSingle"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/ledsingle/"},"LED Single service")," is deprecated and not supported in DeviceScript."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9b1d3f80.4827b4af.js b/assets/js/9b1d3f80.4827b4af.js new file mode 100644 index 00000000000..3edb49cf5e8 --- /dev/null +++ b/assets/js/9b1d3f80.4827b4af.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7334],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,c=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=l(r),f=i,b=u["".concat(p,".").concat(f)]||u[f]||d[f]||c;return r?n.createElement(b,a(a({ref:t},s),{},{components:r})):n.createElement(b,a({ref:t},s))}));function b(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var c=r.length,a=new Array(c);a[0]=f;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,a[1]=o;for(var l=2;l<c;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},32505:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const c={pagination_prev:null,pagination_next:null,unlisted:!0},a="DevsDbg",o={unversionedId:"api/clients/devicescriptdebugger",id:"api/clients/devicescriptdebugger",title:"DevsDbg",description:"The DeviceScript Debugger service is used internally by the runtime",source:"@site/docs/api/clients/devicescriptdebugger.md",sourceDirName:"api/clients",slug:"/api/clients/devicescriptdebugger",permalink:"/devicescript/api/clients/devicescriptdebugger",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},p={},l=[],s={toc:l},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"devsdbg"},"DevsDbg"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/devicescriptdebugger/"},"DeviceScript Debugger service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9bc44158.47bdeca3.js b/assets/js/9bc44158.47bdeca3.js new file mode 100644 index 00000000000..3501a469f22 --- /dev/null +++ b/assets/js/9bc44158.47bdeca3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4692],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=s(r),y=a,f=d["".concat(p,".").concat(y)]||d[y]||u[y]||i;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=y;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[d]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<i;s++)l[s]=r[s];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},7140:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var n=r(25773),a=(r(27378),r(35318));const i={title:"Display"},l="LED Display",o={unversionedId:"developer/leds/display",id:"developer/leds/display",title:"Display",description:"You can wrap an LED matrix as a Display",source:"@site/docs/developer/leds/display.mdx",sourceDirName:"developer/leds",slug:"/developer/leds/display",permalink:"/devicescript/developer/leds/display",draft:!1,tags:[],version:"current",frontMatter:{title:"Display"},sidebar:"tutorialSidebar",previous:{title:"LEDs",permalink:"/devicescript/developer/leds/"},next:{title:"LED Driver",permalink:"/devicescript/developer/leds/driver"}},p={},s=[],c={toc:s},d="wrapper";function u(e){let{components:t,...r}=e;return(0,a.kt)(d,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"led-display"},"LED Display"),(0,a.kt)("p",null,"You can wrap an LED matrix as a ",(0,a.kt)("a",{parentName:"p",href:"/developer/graphics/display"},"Display"),"\nand render graphics to it as if it was just another screen."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport { startLedDisplay } from "@devicescript/runtime"\n\nconst led = new Led()\n// highlight-next-line\nconst display = await startLedDisplay(led)\n// render\ndisplay.image.print(`Hello world!`, 3, 10)\n// and show\nawait display.show()\n')),(0,a.kt)("p",null,"The palette is automatically infered from the ",(0,a.kt)("inlineCode",{parentName:"p"},"waveLength")," register; otherwise you can provide one."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},"const display = await startLedDisplay(led, palette)\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9cfe4cc6.afe857e0.js b/assets/js/9cfe4cc6.afe857e0.js new file mode 100644 index 00000000000..cb703a7ff75 --- /dev/null +++ b/assets/js/9cfe4cc6.afe857e0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6593],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var o=n.createContext({}),m=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=m(e.components);return n.createElement(o.Provider,{value:t},e.children)},c="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=m(r),d=a,k=c["".concat(o,".").concat(d)]||c[d]||s[d]||i;return r?n.createElement(k,p(p({ref:t},u),{},{components:r})):n.createElement(k,p({ref:t},u))}));function k(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,p=new Array(i);p[0]=d;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[c]="string"==typeof e?e:a,p[1]=l;for(var m=2;m<i;m++)p[m]=r[m];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},80561:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>o,contentTitle:()=>p,default:()=>s,frontMatter:()=>i,metadata:()=>l,toc:()=>m});var n=r(25773),a=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Temperature service"},p="Temperature",l={unversionedId:"api/clients/temperature",id:"api/clients/temperature",title:"Temperature",description:"DeviceScript client for Temperature service",source:"@site/docs/api/clients/temperature.md",sourceDirName:"api/clients",slug:"/api/clients/temperature",permalink:"/devicescript/api/clients/temperature",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Temperature service"},sidebar:"tutorialSidebar"},o={},m=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"variant",id:"const:variant",level:3}],u={toc:m},c="wrapper";function s(e){let{components:t,...r}=e;return(0,a.kt)(c,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"temperature"},"Temperature"),(0,a.kt)("p",null,"A thermometer measuring outside or inside environment."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The temperature."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\nconst value = await temperature.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\ntemperature.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:minReading"},"minReading"),(0,a.kt)("p",null,"Lowest temperature that can be reported."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\nconst value = await temperature.minReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,a.kt)("p",null,"Highest temperature that can be reported."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\nconst value = await temperature.maxReading.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:readingError"},"readingError"),(0,a.kt)("p",null,"The real temperature is between ",(0,a.kt)("inlineCode",{parentName:"p"},"temperature - temperature_error")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"temperature + temperature_error"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\nconst value = await temperature.readingError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\ntemperature.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"Specifies the type of thermometer."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst temperature = new Temperature()\n// ...\nconst value = await temperature.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9ea8689d.76fc9b20.js b/assets/js/9ea8689d.76fc9b20.js new file mode 100644 index 00000000000..493f2740daa --- /dev/null +++ b/assets/js/9ea8689d.76fc9b20.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6505],{35318:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var r=a(27378);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function p(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var o=r.createContext({}),c=function(e){var t=r.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=c(e.components);return r.createElement(o.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=c(a),m=n,k=u["".concat(o,".").concat(m)]||u[m]||d[m]||i;return a?r.createElement(k,l(l({ref:t},s),{},{components:a})):r.createElement(k,l({ref:t},s))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=a.length,l=new Array(i);l[0]=m;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[u]="string"==typeof e?e:n,l[1]=p;for(var c=2;c<i;c++)l[c]=a[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"},39798:(e,t,a)=>{a.d(t,{Z:()=>l});var r=a(27378),n=a(38944);const i={tabItem:"tabItem_wHwb"};function l(e){let{children:t,hidden:a,className:l}=e;return r.createElement("div",{role:"tabpanel",className:(0,n.Z)(i.tabItem,l),hidden:a},t)}},23930:(e,t,a)=>{a.d(t,{Z:()=>N});var r=a(25773),n=a(27378),i=a(38944),l=a(83457),p=a(3620),o=a(30654),c=a(70784),s=a(71819);function u(e){return function(e){return n.Children.map(e,(e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:r,default:n}}=e;return{value:t,label:a,attributes:r,default:n}}))}function d(e){const{values:t,children:a}=e;return(0,n.useMemo)((()=>{const e=t??u(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const r=(0,p.k6)(),i=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,o._X)(i),(0,n.useCallback)((e=>{if(!i)return;const t=new URLSearchParams(r.location.search);t.set(i,e),r.replace({...r.location,search:t.toString()})}),[i,r])]}function v(e){const{defaultValue:t,queryString:a=!1,groupId:r}=e,i=d(e),[l,p]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=a.find((e=>e.default))??a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:i}))),[o,c]=k({queryString:a,groupId:r}),[u,v]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,i]=(0,s.Nk)(a);return[r,(0,n.useCallback)((e=>{a&&i.set(e)}),[a,i])]}({groupId:r}),b=(()=>{const e=o??u;return m({value:e,tabValues:i})?e:null})();(0,n.useLayoutEffect)((()=>{b&&p(b)}),[b]);return{selectedValue:l,selectValue:(0,n.useCallback)((e=>{if(!m({value:e,tabValues:i}))throw new Error(`Can't select invalid tab value=${e}`);p(e),c(e),v(e)}),[c,v,i]),tabValues:i}}var b=a(76457);const g={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function h(e){let{className:t,block:a,selectedValue:p,selectValue:o,tabValues:c}=e;const s=[],{blockElementScrollPositionUntilNextRender:u}=(0,l.o5)(),d=e=>{const t=e.currentTarget,a=s.indexOf(t),r=c[a].value;r!==p&&(u(t),o(r))},m=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const a=s.indexOf(e.currentTarget)+1;t=s[a]??s[0];break}case"ArrowLeft":{const a=s.indexOf(e.currentTarget)-1;t=s[a]??s[s.length-1];break}}t?.focus()};return n.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,i.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:l}=e;return n.createElement("li",(0,r.Z)({role:"tab",tabIndex:p===t?0:-1,"aria-selected":p===t,key:t,ref:e=>s.push(e),onKeyDown:m,onClick:d},l,{className:(0,i.Z)("tabs__item",g.tabItem,l?.className,{"tabs__item--active":p===t})}),a??t)})))}function f(e){let{lazy:t,children:a,selectedValue:r}=e;const i=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=i.find((e=>e.props.value===r));return e?(0,n.cloneElement)(e,{className:"margin-top--md"}):null}return n.createElement("div",{className:"margin-top--md"},i.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==r}))))}function y(e){const t=v(e);return n.createElement("div",{className:(0,i.Z)("tabs-container",g.tabList)},n.createElement(h,(0,r.Z)({},e,t)),n.createElement(f,(0,r.Z)({},e,t)))}function N(e){const t=(0,b.Z)();return n.createElement(y,(0,r.Z)({key:String(t)},e))}},78070:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>k,frontMatter:()=>p,metadata:()=>c,toc:()=>u});var r=a(25773),n=(a(27378),a(35318)),i=a(23930),l=a(39798);const p={description:"Learn about the built-in packages and how to use and publish DeviceScript-compatible packages on npm."},o="Packages",c={unversionedId:"developer/packages/index",id:"developer/packages/index",title:"Packages",description:"Learn about the built-in packages and how to use and publish DeviceScript-compatible packages on npm.",source:"@site/docs/developer/packages/index.mdx",sourceDirName:"developer/packages",slug:"/developer/packages/",permalink:"/devicescript/developer/packages/",draft:!1,tags:[],version:"current",frontMatter:{description:"Learn about the built-in packages and how to use and publish DeviceScript-compatible packages on npm."},sidebar:"tutorialSidebar",previous:{title:"MQTT client",permalink:"/devicescript/developer/net/mqtt"},next:{title:"Custom Packages",permalink:"/devicescript/developer/packages/custom"}},s={},u=[{value:"Builtin Packages",id:"builtin-packages",level:2},{value:"NPM packages",id:"npm-packages",level:2},{value:"GitHub releases",id:"github-releases",level:2},{value:"Custom packages",id:"custom-packages",level:2}],d={toc:u},m="wrapper";function k(e){let{components:t,...a}=e;return(0,n.kt)(m,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"packages"},"Packages"),(0,n.kt)("p",null,"DeviceScript supports packages published in ",(0,n.kt)("a",{parentName:"p",href:"https://www.npmjs.com/"},"npm")," or any other package manager compatible\nwith the ",(0,n.kt)("inlineCode",{parentName:"p"},"package.json")," specification."),(0,n.kt)("p",null,"Currently, only TypeScript code can be published - in future we may add ",(0,n.kt)("a",{parentName:"p",href:"/developer/drivers/custom-services"},"services"),"."),(0,n.kt)("h2",{id:"builtin-packages"},"Builtin Packages"),(0,n.kt)("p",null,"The packages are dropped by the DeviceScript compiler whenever you run build.\nThey do not need to be ",(0,n.kt)("inlineCode",{parentName:"p"},"npm install"),"ed."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/core")," - the core package exposing the C runtime and Jacdac services"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/server")," - support for writing Jacdac servers in DeviceScript"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/test")," - ",(0,n.kt)("a",{parentName:"li",href:"/developer/testing"},"testing framework")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/observables")," - ",(0,n.kt)("a",{parentName:"li",href:"/developer/observables"},"reactive observables")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/graphics")," - ",(0,n.kt)("a",{parentName:"li",href:"/developer/graphics"},"images, etc.")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/crypto")," - AES, SHA on Buffers"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/cloud")," - ",(0,n.kt)("a",{parentName:"li",href:"/developer/development-gateway"},"development gateway")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/i2c")," - interacting with ",(0,n.kt)("a",{parentName:"li",href:"/developer/drivers/i2c"},"I2C peripherals")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/spi")," - interacting with ",(0,n.kt)("a",{parentName:"li",href:"/developer/drivers/spi"},"SPI peripherals")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/net")," - ",(0,n.kt)("a",{parentName:"li",href:"/developer/net"},"TCP and TLS sockets")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/gpio")," - working with ",(0,n.kt)("a",{parentName:"li",href:"/developer/drivers/digital-io"},"GPIO pins")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/runtime")," - runtime utilities"),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/settings")," - reading/writing ",(0,n.kt)("a",{parentName:"li",href:"/developer/settings"},"settings in flash memory")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"@devicescript/drivers")," - ",(0,n.kt)("a",{parentName:"li",href:"/developer/drivers"},"driver implementations"))),(0,n.kt)("h2",{id:"npm-packages"},"NPM packages"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("a",{parentName:"p",href:"https://www.npmjs.com/search?q=devicescript"},"Search for ",(0,n.kt)("inlineCode",{parentName:"a"},"devicescript")," on npmjs.com"),".\nBy convention, DeviceScript-compatible packages should be marked with the ",(0,n.kt)("inlineCode",{parentName:"p"},"devicescript")," keyword.")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},(0,n.kt)("a",{parentName:"p",href:"https://github.com/topics/devicescript"},"Search for the ",(0,n.kt)("inlineCode",{parentName:"a"},"devicescript")," topic on GitHub"),"\nBy convention, DeviceScript-compatible packages should be tagged with ",(0,n.kt)("inlineCode",{parentName:"p"},"devicescript"),".")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"Add the package using npm:"))),(0,n.kt)(i.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,n.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"npm install --save package-name\n"))),(0,n.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"yarn add package-name\n"))),(0,n.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm add package-name\n")))),(0,n.kt)("h2",{id:"github-releases"},"GitHub releases"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/topics/devicescript"},"Search for the ",(0,n.kt)("inlineCode",{parentName:"a"},"devicescript")," topic on GitHub"),"\nBy convention, DeviceScript-compatible packages should be tagged with ",(0,n.kt)("inlineCode",{parentName:"li"},"devicescript"),"."),(0,n.kt)("li",{parentName:"ul"},"Add the release using npm:")),(0,n.kt)(i.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,n.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"npm install --save owner/repo#release\n"))),(0,n.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"yarn add owner/repo#release\n"))),(0,n.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm add owner/repo#release\n")))),(0,n.kt)("h2",{id:"custom-packages"},"Custom packages"),(0,n.kt)("p",null,"Users can create and package their own DeviceScript packages to share their code with others."),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Follow the ",(0,n.kt)("a",{parentName:"li",href:"/developer/packages/custom"},"custom package guide"),".")))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9eb80747.d13a24d9.js b/assets/js/9eb80747.d13a24d9.js new file mode 100644 index 00000000000..8dce55a4918 --- /dev/null +++ b/assets/js/9eb80747.d13a24d9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1674],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(n),m=r,k=c["".concat(p,".").concat(m)]||c[m]||d[m]||o;return n?a.createElement(k,i(i({ref:t},u),{},{components:n})):a.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},30641:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(25773),r=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Dual Motors service"},i="DualMotors",l={unversionedId:"api/clients/dualmotors",id:"api/clients/dualmotors",title:"DualMotors",description:"DeviceScript client for Dual Motors service",source:"@site/docs/api/clients/dualmotors.md",sourceDirName:"api/clients",slug:"/api/clients/dualmotors",permalink:"/devicescript/api/clients/dualmotors",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Dual Motors service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"speed",id:"rw:speed",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"loadTorque",id:"const:loadTorque",level:3},{value:"loadRotationSpeed",id:"const:loadRotationSpeed",level:3},{value:"reversible",id:"const:reversible",level:3}],u={toc:s},c="wrapper";function d(e){let{components:t,...n}=e;return(0,r.kt)(c,(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"dualmotors"},"DualMotors"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"A synchronized pair of motors."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:speed"},"speed"),(0,r.kt)("p",null,"Relative speed of the motors. Use positive/negative values to run the motor forwards and backwards.\nA speed of ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," while ",(0,r.kt)("inlineCode",{parentName:"p"},"enabled")," acts as brake."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"i1.15 i1.15"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"track incoming values"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n// ...\ndualMotors.speed.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:enabled"},"enabled"),(0,r.kt)("p",null,"Turn the power to the motors on/off."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n// ...\nconst value = await dualMotors.enabled.read()\nawait dualMotors.enabled.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n// ...\ndualMotors.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:loadTorque"},"loadTorque"),(0,r.kt)("p",null,"Torque required to produce the rated power of an each electrical motor at load speed."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n// ...\nconst value = await dualMotors.loadTorque.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:loadRotationSpeed"},"loadRotationSpeed"),(0,r.kt)("p",null,"Revolutions per minute of the motor under full load."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n// ...\nconst value = await dualMotors.loadRotationSpeed.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:reversible"},"reversible"),(0,r.kt)("p",null,"Indicates if the motors can run backwards."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DualMotors } from "@devicescript/core"\n\nconst dualMotors = new DualMotors()\n// ...\nconst value = await dualMotors.reversible.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9f4b432b.ffaa4a1c.js b/assets/js/9f4b432b.ffaa4a1c.js new file mode 100644 index 00000000000..36c41ad42c3 --- /dev/null +++ b/assets/js/9f4b432b.ffaa4a1c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8623],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),c=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=c(n),d=r,k=m["".concat(p,".").concat(d)]||m[d]||u[d]||i;return n?a.createElement(k,l(l({ref:t},s),{},{components:n})):a.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[m]="string"==typeof e?e:r,l[1]=o;for(var c=2;c<i;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},33557:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Relay service"},l="Relay",o={unversionedId:"api/clients/relay",id:"api/clients/relay",title:"Relay",description:"DeviceScript client for Relay service",source:"@site/docs/api/clients/relay.md",sourceDirName:"api/clients",slug:"/api/clients/relay",permalink:"/devicescript/api/clients/relay",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Relay service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"variant",id:"const:variant",level:3},{value:"maxSwitchingCurrent",id:"const:maxSwitchingCurrent",level:3}],s={toc:c},m="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(m,(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"relay"},"Relay"),(0,r.kt)("p",null,"A switching relay."),(0,r.kt)("p",null,"The contacts should be labelled ",(0,r.kt)("inlineCode",{parentName:"p"},"NO")," (normally open), ",(0,r.kt)("inlineCode",{parentName:"p"},"COM")," (common), and ",(0,r.kt)("inlineCode",{parentName:"p"},"NC")," (normally closed).\nWhen relay is energized it connects ",(0,r.kt)("inlineCode",{parentName:"p"},"NO")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"COM"),".\nWhen relay is not energized it connects ",(0,r.kt)("inlineCode",{parentName:"p"},"NC")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"COM"),".\nSome relays may be missing ",(0,r.kt)("inlineCode",{parentName:"p"},"NO")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"NC")," contacts.\nWhen relay module is not powered, or is in bootloader mode, it is not energized (connects ",(0,r.kt)("inlineCode",{parentName:"p"},"NC")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"COM"),")."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Relay } from "@devicescript/core"\n\nconst relay = new Relay()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:enabled"},"enabled"),(0,r.kt)("p",null,"Indicates whether the relay circuit is currently energized or not."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Relay } from "@devicescript/core"\n\nconst relay = new Relay()\n// ...\nconst value = await relay.enabled.read()\nawait relay.enabled.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Relay } from "@devicescript/core"\n\nconst relay = new Relay()\n// ...\nrelay.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:variant"},"variant"),(0,r.kt)("p",null,"Describes the type of relay used."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Relay } from "@devicescript/core"\n\nconst relay = new Relay()\n// ...\nconst value = await relay.variant.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxSwitchingCurrent"},"maxSwitchingCurrent"),(0,r.kt)("p",null,"Maximum switching current for a resistive load."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Relay } from "@devicescript/core"\n\nconst relay = new Relay()\n// ...\nconst value = await relay.maxSwitchingCurrent.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9f50cf8a.d2ce49ce.js b/assets/js/9f50cf8a.d2ce49ce.js new file mode 100644 index 00000000000..982b07d1cc9 --- /dev/null +++ b/assets/js/9f50cf8a.d2ce49ce.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3442],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=i.createContext({}),u=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=u(e.components);return i.createElement(p.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},s=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),d=u(n),s=r,k=d["".concat(p,".").concat(s)]||d[s]||c[s]||a;return n?i.createElement(k,l(l({ref:t},m),{},{components:n})):i.createElement(k,l({ref:t},m))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=s;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[d]="string"==typeof e?e:r,l[1]=o;for(var u=2;u<a;u++)l[u]=n[u];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}s.displayName="MDXCreateElement"},24758:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>o,toc:()=>u});var i=n(25773),r=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Humidity service"},l="Humidity",o={unversionedId:"api/clients/humidity",id:"api/clients/humidity",title:"Humidity",description:"DeviceScript client for Humidity service",source:"@site/docs/api/clients/humidity.md",sourceDirName:"api/clients",slug:"/api/clients/humidity",permalink:"/devicescript/api/clients/humidity",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Humidity service"},sidebar:"tutorialSidebar"},p={},u=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],m={toc:u},d="wrapper";function c(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,i.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"humidity"},"Humidity"),(0,r.kt)("p",null,"A sensor measuring humidity of outside environment."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"The relative humidity in percentage of full water saturation."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n// ...\nconst value = await humidity.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n// ...\nhumidity.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:readingError"},"readingError"),(0,r.kt)("p",null,"The real humidity is between ",(0,r.kt)("inlineCode",{parentName:"p"},"humidity - humidity_error")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"humidity + humidity_error"),"."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n// ...\nconst value = await humidity.readingError.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n// ...\nhumidity.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:minReading"},"minReading"),(0,r.kt)("p",null,"Lowest humidity that can be reported."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n// ...\nconst value = await humidity.minReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,r.kt)("p",null,"Highest humidity that can be reported."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Humidity } from "@devicescript/core"\n\nconst humidity = new Humidity()\n// ...\nconst value = await humidity.maxReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a1da537c.3773bc5c.js b/assets/js/a1da537c.3773bc5c.js new file mode 100644 index 00000000000..455defc8a26 --- /dev/null +++ b/assets/js/a1da537c.3773bc5c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2117],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var n=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},l=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},u=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),m=s(t),u=a,f=m["".concat(p,".").concat(u)]||m[u]||d[u]||o;return t?n.createElement(f,i(i({ref:r},l),{},{components:t})):n.createElement(f,i({ref:r},l))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=u;var c={};for(var p in r)hasOwnProperty.call(r,p)&&(c[p]=r[p]);c.originalType=e,c[m]="string"==typeof e?e:a,i[1]=c;for(var s=2;s<o;s++)i[s]=t[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,t)}u.displayName="MDXCreateElement"},21048:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var n=t(25773),a=(t(27378),t(35318));const o={description:"Mounts an accelerometer server",title:"Accelerometer"},i="Accelerometer",c={unversionedId:"api/drivers/accelerometer",id:"api/drivers/accelerometer",title:"Accelerometer",description:"Mounts an accelerometer server",source:"@site/docs/api/drivers/accelerometer.md",sourceDirName:"api/drivers",slug:"/api/drivers/accelerometer",permalink:"/devicescript/api/drivers/accelerometer",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts an accelerometer server",title:"Accelerometer"},sidebar:"tutorialSidebar",previous:{title:"Drivers",permalink:"/devicescript/api/drivers/"},next:{title:"AHT20",permalink:"/devicescript/api/drivers/aht20"}},p={},s=[{value:"Coordinate transforms",id:"coordinate-transforms",level:2}],l={toc:s},m="wrapper";function d(e){let{components:r,...t}=e;return(0,a.kt)(m,(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"accelerometer"},"Accelerometer"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"startAccelerometer")," function starts a ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/accelerometer"},"accelerometer")," server on the device\nand returns a ",(0,a.kt)("a",{parentName:"p",href:"/api/clients/accelerometer"},"client"),"."),(0,a.kt)("p",null,"The accelerometer IMU chip will be auto-detected if it is supported."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { startAccelerometer } from "@devicescript/servers"\nconst acc = startAccelerometer({})\n')),(0,a.kt)("h2",{id:"coordinate-transforms"},"Coordinate transforms"),(0,a.kt)("p",null,"You can specify transform for X, Y, Z axis of the accelerometer to compensate for the physical\nplacement of the IMU chip.\nSee ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/accelerometer"},"service spec")," for\ninfo about what XYZ values should be returned, depending on device position."),(0,a.kt)("p",null,"For each output axis (",(0,a.kt)("inlineCode",{parentName:"p"},"trX"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"trY"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"trZ"),") you specify input axis ",(0,a.kt)("inlineCode",{parentName:"p"},"1"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"2"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"3"),"\nor negated input axis ",(0,a.kt)("inlineCode",{parentName:"p"},"-1"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"-2"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"-3"),".\nThe default is ",(0,a.kt)("inlineCode",{parentName:"p"},"{ trX: 1, trY: 2, trZ: 3 }"),", which is no transform.\nThe following would work for accelerometer mounted upside down and rotated,\nit transforms ",(0,a.kt)("inlineCode",{parentName:"p"},"(x1, y2, z3)")," into ",(0,a.kt)("inlineCode",{parentName:"p"},"(y2, -x1, -z3)"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { startAccelerometer } from "@devicescript/servers"\nconst acc = startAccelerometer({\n trX: 2,\n trY: -1,\n trZ: -3,\n})\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a1f85011.ccbefe74.js b/assets/js/a1f85011.ccbefe74.js new file mode 100644 index 00000000000..a848e9152df --- /dev/null +++ b/assets/js/a1f85011.ccbefe74.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2611],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=c(r),d=a,f=u["".concat(p,".").concat(d)]||u[d]||m[d]||i;return r?n.createElement(f,o(o({ref:t},l),{},{components:r})):n.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var c=2;c<i;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},97301:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(25773),a=(r(27378),r(35318));const i={},o="SHT30",s={unversionedId:"api/drivers/sht30",id:"api/drivers/sht30",title:"SHT30",description:"Driver for SHT30 temperature/humidity sensor at I2C address 0x44 or 0x45.",source:"@site/docs/api/drivers/sht30.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/sht30",permalink:"/devicescript/api/drivers/sht30",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Servo",permalink:"/devicescript/api/drivers/servo"},next:{title:"SHTC3",permalink:"/devicescript/api/drivers/shtc3"}},p={},c=[{value:"Usage",id:"usage",level:2}],l={toc:c},u="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"sht30"},"SHT30"),(0,a.kt)("p",null,"Driver for SHT30 temperature/humidity sensor at I2C address ",(0,a.kt)("inlineCode",{parentName:"p"},"0x44")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"0x45"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Services: ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/temperature/"},"temperature"),", ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/humidity/"},"humidity")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://sensirion.com/products/catalog/SHT30-DIS-B/"},"Datasheet")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/sht30.ts"},"Source"))),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { startSHT30 } from "@devicescript/drivers"\nconst { temperature, humidity } = await startSHT30()\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a2547cfc.508da155.js b/assets/js/a2547cfc.508da155.js new file mode 100644 index 00000000000..d67ad9a2547 --- /dev/null +++ b/assets/js/a2547cfc.508da155.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2277],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,y=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(y,o(o({ref:t},s),{},{components:n})):r.createElement(y,o({ref:t},s))}));function y(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:i,o[1]=l;for(var c=2;c<a;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},99156:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={title:"Blynk.io",sidebar_position:5.5},o="Blynk.io",l={unversionedId:"developer/iot/blynk-io/index",id:"developer/iot/blynk-io/index",title:"Blynk.io",description:"Blynk.io provides an IoT dashboard for devices with virtual pins.",source:"@site/docs/developer/iot/blynk-io/index.mdx",sourceDirName:"developer/iot/blynk-io",slug:"/developer/iot/blynk-io/",permalink:"/devicescript/developer/iot/blynk-io/",draft:!1,tags:[],version:"current",sidebarPosition:5.5,frontMatter:{title:"Blynk.io",sidebar_position:5.5},sidebar:"tutorialSidebar",previous:{title:"Blues.io Notecard",permalink:"/devicescript/developer/iot/blues-io/"},next:{title:"Matlab ThingSpeak",permalink:"/devicescript/developer/iot/matlab-thingspeak/"}},p={},c=[{value:"Getting started",id:"getting-started",level:2},{value:"Configuration",id:"configuration",level:2},{value:"Uploading data",id:"uploading-data",level:2}],s={toc:c},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"blynkio"},"Blynk.io"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://blynk.io"},"Blynk.io")," provides an IoT dashboard for devices with virtual pins."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/pelikhan/devicescript-blynk"},"pelikhan/devicescript-blynk"),"\npackage uses the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.blynk.io/en/blynk.cloud/https-api-overview"},"HTTPS REST API"),"\nto send data from devices."),(0,i.kt)("h2",{id:"getting-started"},"Getting started"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Create a new DeviceScript project"),(0,i.kt)("li",{parentName:"ul"},"Add the library to your DeviceScript project:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm install --save pelikhan/devicescript-blynk\n")),(0,i.kt)("h2",{id:"configuration"},"Configuration"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/developer/settings"},"Add device settings")," to your project"),(0,i.kt)("li",{parentName:"ul"},"Add the device authentication token to your settings")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# .env.local\nBLYNK_TOKEN=your-token\n")),(0,i.kt)("h2",{id:"uploading-data"},"Uploading data"),(0,i.kt)("p",null,"Use ",(0,i.kt)("inlineCode",{parentName:"p"},"updateDatastream")," to update multiple virtual pins at once."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Temperature, Humidity } from "@devicescript/core"\nimport { delay, millis } from "@devicescript/core"\n// highlight-next-line\nimport { updateDatastream } from "devicescript-blynk"\n\n// connect sensors\nconst temperature = new Temperature()\nconst humidity = new Humidity()\n\nwhile (true) {\n // read sensor values\n const t = await temperature.reading.read()\n const h = await humidity.reading.read()\n\n // highlight-start\n // send blynk.io data\n await updateDatastream({\n v1: t,\n v2: h,\n })\n // highlight-end\n\n // take a break\n await delay(10000)\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a2b93c3a.6dbaa0a3.js b/assets/js/a2b93c3a.6dbaa0a3.js new file mode 100644 index 00000000000..e6bcce8998b --- /dev/null +++ b/assets/js/a2b93c3a.6dbaa0a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4233],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=i,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,o(o({ref:t},s),{},{components:r})):n.createElement(f,o({ref:t},s))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},29642:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={},o="LTR390",l={unversionedId:"api/drivers/ltr390",id:"api/drivers/ltr390",title:"LTR390",description:"Driver for LTR390 UV Index, illuminance.",source:"@site/docs/api/drivers/ltr390.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/ltr390",permalink:"/devicescript/api/drivers/ltr390",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Light Level",permalink:"/devicescript/api/drivers/lightlevel"},next:{title:"Motion Detector",permalink:"/devicescript/api/drivers/motion"}},c={},p=[{value:"Usage",id:"usage",level:2}],s={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ltr390"},"LTR390"),(0,i.kt)("p",null,"Driver for LTR390 UV Index, illuminance."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Services: ",(0,i.kt)("a",{parentName:"li",href:"/api/clients/uvindex/"},"uvindex"),", ",(0,i.kt)("a",{parentName:"li",href:"/api/clients/illuminance/"},"illuminance")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://optoelectronics.liteon.com/upload/download/DS86-2015-0004/LTR-390UV_Final_%20DS_V1%201.pdf"},"Datasheet")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/ltr390.ts"},"Source"))),(0,i.kt)("h2",{id:"usage"},"Usage"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { startLTR390 } from "@devicescript/drivers"\nconst { uvIndex, illuminance } = await startLTR390()\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a4d48e61.357e6480.js b/assets/js/a4d48e61.357e6480.js new file mode 100644 index 00000000000..3e28c6b8920 --- /dev/null +++ b/assets/js/a4d48e61.357e6480.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4911],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),c=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=c(n),u=r,k=m["".concat(p,".").concat(u)]||m[u]||d[u]||i;return n?a.createElement(k,l(l({ref:t},s),{},{components:n})):a.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[m]="string"==typeof e?e:r,l[1]=o;for(var c=2;c<i;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},54677:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Distance service"},l="Distance",o={unversionedId:"api/clients/distance",id:"api/clients/distance",title:"Distance",description:"DeviceScript client for Distance service",source:"@site/docs/api/clients/distance.md",sourceDirName:"api/clients",slug:"/api/clients/distance",permalink:"/devicescript/api/clients/distance",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Distance service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:c},m="wrapper";function d(e){let{components:t,...n}=e;return(0,r.kt)(m,(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"distance"},"Distance"),(0,r.kt)("p",null,"A sensor that determines the distance of an object without any physical contact involved."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"Current distance from the object"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\nconst value = await distance.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\ndistance.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:readingError"},"readingError"),(0,r.kt)("p",null,"Absolute error on the reading value."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\nconst value = await distance.readingError.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\ndistance.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:minReading"},"minReading"),(0,r.kt)("p",null,"Minimum measurable distance"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\nconst value = await distance.minReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,r.kt)("p",null,"Maximum measurable distance"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\nconst value = await distance.maxReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:variant"},"variant"),(0,r.kt)("p",null,"Determines the type of sensor used."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Distance } from "@devicescript/core"\n\nconst distance = new Distance()\n// ...\nconst value = await distance.variant.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a5466529.540bd680.js b/assets/js/a5466529.540bd680.js new file mode 100644 index 00000000000..8d3e024f95c --- /dev/null +++ b/assets/js/a5466529.540bd680.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1327],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>v});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),c=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return i.createElement(l.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,v=u["".concat(l,".").concat(m)]||u[m]||p[m]||a;return n?i.createElement(v,o(o({ref:t},d),{},{components:n})):i.createElement(v,o({ref:t},d))}));function v(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,o=new Array(a);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:r,o[1]=s;for(var c=2;c<a;c++)o[c]=n[c];return i.createElement.apply(null,o)}return i.createElement.apply(null,n)}m.displayName="MDXCreateElement"},83726:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var i=n(25773),r=(n(27378),n(35318));const a={sidebar_position:21,description:"Learn how to simulate DeviceScript devices using the web dashboard and Node.js project. Start by configuring your project for simulation and use Visual Studio Code to debug your DeviceScript code and the simulator in the same session."},o="Simulation",s={unversionedId:"developer/simulation",id:"developer/simulation",title:"Simulation",description:"Learn how to simulate DeviceScript devices using the web dashboard and Node.js project. Start by configuring your project for simulation and use Visual Studio Code to debug your DeviceScript code and the simulator in the same session.",source:"@site/docs/developer/simulation.mdx",sourceDirName:"developer",slug:"/developer/simulation",permalink:"/devicescript/developer/simulation",draft:!1,tags:[],version:"current",sidebarPosition:21,frontMatter:{sidebar_position:21,description:"Learn how to simulate DeviceScript devices using the web dashboard and Node.js project. Start by configuring your project for simulation and use Visual Studio Code to debug your DeviceScript code and the simulator in the same session."},sidebar:"tutorialSidebar",previous:{title:"Bundled firmware",permalink:"/devicescript/developer/bundle"},next:{title:"IoT",permalink:"/devicescript/developer/iot/"}},l={},c=[{value:"Simulated DeviceScript Device",id:"simulated-devicescript-device",level:2},{value:"Dashboard",id:"dashboard",level:2},{value:"Node.JS simulation",id:"nodejs-simulation",level:2},{value:"Running using package scripts",id:"running-using-package-scripts",level:3},{value:"build",id:"build",level:4},{value:"watch",id:"watch",level:4},{value:"Debugging DeviceScript and Node",id:"debugging-devicescript-and-node",level:3},{value:"<code>aurascope</code> example",id:"aurascope-example",level:3}],d={toc:c},u="wrapper";function p(e){let{components:t,...a}=e;return(0,r.kt)(u,(0,i.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"simulation"},"Simulation"),(0,r.kt)("p",null,"DeviceScript supports simulation through a web dashboard and a Node.JS project running in parallel on the developer machine."),(0,r.kt)("h2",{id:"simulated-devicescript-device"},"Simulated DeviceScript Device"),(0,r.kt)("p",null,"DeviceScript will start a simulated programmable microcontroller on demand. You can also start it from the connect dialog.\nIt runs a ",(0,r.kt)("a",{parentName:"p",href:"/api/vm"},"WASM-ed build of the C runtime"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"A screenshot of starting the DeviceScript simulator",src:n(42706).Z,width:"1055",height:"314"})),(0,r.kt)("h2",{id:"dashboard"},"Dashboard"),(0,r.kt)("p",null,"The simulators dashboard is the most convenient way to start simulating services and testing out your code."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Open the DeviceScript view in Visual Studio Code"),(0,r.kt)("li",{parentName:"ul"},"Click on the ",(0,r.kt)("strong",{parentName:"li"},"dashboard")," icon in the ",(0,r.kt)("strong",{parentName:"li"},"Devices")," menu")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"A screenshot of the simulator view",src:n(96977).Z,width:"969",height:"566"})),(0,r.kt)("h2",{id:"nodejs-simulation"},"Node.JS simulation"),(0,r.kt)("p",null,"For advanced simulation scenario, you can use Node.JS and the ",(0,r.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/clients/javascript/"},"TypeScript client library")," and,\nany other Node package (like your favorite test project), to generate complex scenarios."),(0,r.kt)("p",null,"Start by configuring your project for simulation by running"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs add sim\n")),(0,r.kt)("p",null,"or in Visual Studio Code, using the ",(0,r.kt)("strong",{parentName:"p"},"DeviceScript: Add Sim...")," in the command palette."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"all ",(0,r.kt)("inlineCode",{parentName:"li"},".ts")," files, expect for the ",(0,r.kt)("inlineCode",{parentName:"li"},"./sim/")," folder, are compiled into DeviceScript bytecode"),(0,r.kt)("li",{parentName:"ul"},"all file under ",(0,r.kt)("inlineCode",{parentName:"li"},"./sim/")," are compiled as a Node.JS application")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},".devicescript/* libraries and supporting files\nsrc/main.ts DeviceScript entry point\n...\nsim/app.ts Node entry point for the simulator\nsim/...\n")),(0,r.kt)("h3",{id:"running-using-package-scripts"},"Running using package scripts"),(0,r.kt)("p",null,"The scripts in ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," are configured support both DeviceScript and sim ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"watch"),"."),(0,r.kt)("h4",{id:"build"},"build"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# build DeviceScript and node.js sim\nyarn build\n\n# build device script only\nyarn build:devicescript\n\n# build node.js sim only\nyarn build:sim\n")),(0,r.kt)("h4",{id:"watch"},"watch"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# watch DeviceScript and node.js sim\nyarn watch\n\n# watch device script only\nyarn watch:devicescript\n\n# watch node.js sim only\nyarn watch:sim\n")),(0,r.kt)("h3",{id:"debugging-devicescript-and-node"},"Debugging DeviceScript and Node"),(0,r.kt)("p",null,"Visual Studio Code supports ",(0,r.kt)("a",{parentName:"p",href:"https://code.visualstudio.com/docs/editor/debugging#_launch-configurations"},"multiple debugging sessions simultaneously")," so it is possible to debug your DeviceScript\ncode and the simulator in the same session."),(0,r.kt)("mermaid",{value:"stateDiagram-v2\n code: VS Code\n node: app.ts (node.js)\n devicescript: main.ts (devicescript)\n devtools: Developer Tools\n device: Simulator or Hardware device\n code --\x3e devicescript: DeviceScript debugger\n code --\x3e node: Node.JS debugger\n devicescript --\x3e devtools\n node --\x3e devtools: web socket connection\n devtools --\x3e device"}),(0,r.kt)("h3",{id:"aurascope-example"},(0,r.kt)("inlineCode",{parentName:"h3"},"aurascope")," example"),(0,r.kt)("p",null,"This simulator sample starts a simulated ",(0,r.kt)("inlineCode",{parentName:"p"},"psychomagnotheric energy sensor")," (custom service) using ",(0,r.kt)("inlineCode",{parentName:"p"},"jacdac-ts"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./sim/app.ts"',title:'"./sim/app.ts"'},'// Jacdac bus that will connect to the devtools server\nimport { bus } from "./runtime"\n// Jacdac helper to simulate services\nimport { addServer, AnalogSensorServer } from "jacdac-ts"\n// custom service\nimport { SRV_PSYCHOMAGNOTHERIC_ENERGY } from "../.devicescript/ts/constants"\n\n// server for the custom service\nconst server = new AnalogSensorServer(SRV_PSYCHOMAGNOTHERIC_ENERGY, {\n readingValues: [0.5],\n readingError: [0.1],\n streamingInterval: 500,\n})\n// change level randomly\nsetInterval(() => {\n // randomly change the\n const newValue = server.reading.values()[0] + (0.5 - Math.random()) / 10\n server.reading.setValues([newValue])\n console.debug(`psycho value: ${newValue}`)\n}, 100)\naddServer(bus, "aurascope", server)\n')))}p.isMDXComponent=!0},42706:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/simulator-ff4f3f7cd39d9aa7e683dfa47f6aa724.png"},96977:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/simulators-2104f8902e1a20aa2a3e224ab86e7770.png"}}]); \ No newline at end of file diff --git a/assets/js/a65110b7.7bec6c54.js b/assets/js/a65110b7.7bec6c54.js new file mode 100644 index 00000000000..c3b692eb611 --- /dev/null +++ b/assets/js/a65110b7.7bec6c54.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[444],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),m=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=m(e.components);return a.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=m(n),d=r,k=c["".concat(p,".").concat(d)]||c[d]||u[d]||i;return n?a.createElement(k,l(l({ref:t},s),{},{components:n})):a.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[c]="string"==typeof e?e:r,l[1]=o;for(var m=2;m<i;m++)l[m]=n[m];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},22211:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>m});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for DC Voltage Measurement service"},l="DcVoltageMeasurement",o={unversionedId:"api/clients/dcvoltagemeasurement",id:"api/clients/dcvoltagemeasurement",title:"DcVoltageMeasurement",description:"DeviceScript client for DC Voltage Measurement service",source:"@site/docs/api/clients/dcvoltagemeasurement.md",sourceDirName:"api/clients",slug:"/api/clients/dcvoltagemeasurement",permalink:"/devicescript/api/clients/dcvoltagemeasurement",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for DC Voltage Measurement service"},sidebar:"tutorialSidebar"},p={},m=[{value:"Registers",id:"registers",level:2},{value:"measurementType",id:"const:measurementType",level:3},{value:"measurementName",id:"const:measurementName",level:3},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],s={toc:m},c="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(c,(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"dcvoltagemeasurement"},"DcVoltageMeasurement"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"A service that reports a voltage measurement."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"const:measurementType"},"measurementType"),(0,r.kt)("p",null,"The type of measurement that is taking place. Absolute results are measured with respect to ground, whereas differential results are measured against another signal that is not ground."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\nconst value = await dcVoltageMeasurement.measurementType.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:measurementName"},"measurementName"),(0,r.kt)("p",null,"A string containing the net name that is being measured e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"POWER_DUT")," or a reference e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"DIFF_DEV1_DEV2"),". These constants can be used to identify a measurement from client code."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"s"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\nconst value = await dcVoltageMeasurement.measurementName.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"The voltage measurement."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\nconst value = await dcVoltageMeasurement.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\ndcVoltageMeasurement.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:readingError"},"readingError"),(0,r.kt)("p",null,"Absolute error on the reading value."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\nconst value = await dcVoltageMeasurement.readingError.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\ndcVoltageMeasurement.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:minReading"},"minReading"),(0,r.kt)("p",null,"Minimum measurable current"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\nconst value = await dcVoltageMeasurement.minReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,r.kt)("p",null,"Maximum measurable current"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"f64"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DcVoltageMeasurement } from "@devicescript/core"\n\nconst dcVoltageMeasurement = new DcVoltageMeasurement()\n// ...\nconst value = await dcVoltageMeasurement.maxReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a6c4ed74.d2dbc037.js b/assets/js/a6c4ed74.d2dbc037.js new file mode 100644 index 00000000000..dfe1404b8d4 --- /dev/null +++ b/assets/js/a6c4ed74.d2dbc037.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5756],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),s=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=s(e.components);return i.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,g=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(g,a(a({ref:t},c),{},{components:n})):i.createElement(g,a({ref:t},c))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:r,a[1]=p;for(var s=2;s<o;s++)a[s]=n[s];return i.createElement.apply(null,a)}return i.createElement.apply(null,n)}m.displayName="MDXCreateElement"},41289:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>p,toc:()=>s});var i=n(25773),r=(n(27378),n(35318));const o={description:"Digital GPIO",title:"Digital IO (GPIO)",sidebar_position:49},a="Digital IO (GPIO)",p={unversionedId:"developer/drivers/digital-io/index",id:"developer/drivers/digital-io/index",title:"Digital IO (GPIO)",description:"Digital GPIO",source:"@site/docs/developer/drivers/digital-io/index.mdx",sourceDirName:"developer/drivers/digital-io",slug:"/developer/drivers/digital-io/",permalink:"/devicescript/developer/drivers/digital-io/",draft:!1,tags:[],version:"current",sidebarPosition:49,frontMatter:{description:"Digital GPIO",title:"Digital IO (GPIO)",sidebar_position:49},sidebar:"tutorialSidebar",previous:{title:"Drivers",permalink:"/devicescript/developer/drivers/"},next:{title:"Wire",permalink:"/devicescript/developer/drivers/digital-io/wire"}},l={},s=[{value:"Pin mappings",id:"pin-mappings",level:2},{value:"Mode",id:"mode",level:2},{value:"Output",id:"output",level:2},{value:"Input",id:"input",level:2}],c={toc:s},d="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"digital-io-gpio"},"Digital IO (GPIO)"),(0,r.kt)("p",null,"DeviceScript provides access to digital GPIO (General Purpose Input/Output) operations\non pins that do ",(0,r.kt)("strong",{parentName:"p"},"not")," require precise real time timings."),(0,r.kt)("p",null,"It is recommend to encapsulate the GPIO access into server implementation as they are rather low level."),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"If your application needs consistent response times of under 10ms, you can either implement the driver\nnatively in C using interrupts, or better yet offload it to an ",(0,r.kt)("a",{parentName:"p",href:"/developer/drivers#jacdac-modules"},"external Jacdac module"),".")),(0,r.kt)("h2",{id:"pin-mappings"},"Pin mappings"),(0,r.kt)("p",null,"While you can use hardware GPIO numbers with the ",(0,r.kt)("inlineCode",{parentName:"p"},"ds.gpio()")," function,\nit is highly recommended that you instead import a board definition file an use pin names\nmatching silk on the hardware."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\n\n// highlight-next-line\nconst A2 = pins.A2_D2\n')),(0,r.kt)("p",null,"The doc-string for ",(0,r.kt)("inlineCode",{parentName:"p"},"pins.A2_D2")," will tell you GPIO number (",(0,r.kt)("inlineCode",{parentName:"p"},"1")," in this case).\nUsing named pins is also less error-prone since pins used for internal\nfunctions are not exposed through the ",(0,r.kt)("inlineCode",{parentName:"p"},"pins")," object and the pins that are\nexposed are annotated with type (input, output, analog, etc.) which is then\nrequired by the ",(0,r.kt)("inlineCode",{parentName:"p"},"startSomething()")," functions."),(0,r.kt)("p",null,"Pins generally share names for boards with the same pinout.\nIn particular, QT Py and XIAO share names."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"gpio()")," function does not check for pin functions or usage.\nIt will return ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," when named pin is not available or used for something else."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\n\n// highlight-next-line\nconst P0 = gpio(0)\n')),(0,r.kt)("h2",{id:"mode"},"Mode"),(0,r.kt)("p",null,"The pin can be access through the generic ",(0,r.kt)("inlineCode",{parentName:"p"},"gpio")," function or through board specific packages\nthat provide predefined pin mappings (see ",(0,r.kt)("a",{parentName:"p",href:"/devices"},"devices"),")."),(0,r.kt)("p",null,"You can configure the input/output mode through ",(0,r.kt)("inlineCode",{parentName:"p"},"setMode"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio, GPIOMode } from "@devicescript/core"\nimport "@devicescript/gpio"\n\n// p0 -> output\nconst p0 = gpio(0)\n// highlight-next-line\nawait p0.setMode(GPIOMode.Output)\n\n// P1 -> input\nconst p1 = gpio(1)\n// highlight-next-line\nawait p1.setMode(GPIOMode.Input)\n')),(0,r.kt)("h2",{id:"output"},"Output"),(0,r.kt)("p",null,"Use ",(0,r.kt)("inlineCode",{parentName:"p"},"write")," to set the output value of a pin. This example flips a pin state every second."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio, GPIOMode } from "@devicescript/core"\nimport "@devicescript/gpio"\n\nconst p0 = gpio(0)\nawait p0.setMode(GPIOMode.Output)\n\nlet loop = 0\nsetInterval(async () => {\n // highlight-next-line\n await p0.write(loop++ % 2)\n}, 1000)\n')),(0,r.kt)("h2",{id:"input"},"Input"),(0,r.kt)("p",null,"Use ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," to read the input value of a pin. This example reads the input value every second."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio, GPIOMode } from "@devicescript/core"\nimport "@devicescript/gpio"\n\nconst p1 = gpio(1)\nawait p1.setMode(GPIOMode.Input)\n\n// polling read pin\nsetInterval(async () => {\n // highlight-next-line\n const v = p1.value\n console.log({ poll: v })\n}, 1000)\n')),(0,r.kt)("p",null,"Use ",(0,r.kt)("inlineCode",{parentName:"p"},"subscribe")," to run code whenever the pin changes state."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio, GPIOMode } from "@devicescript/core"\nimport "@devicescript/gpio"\n\nconst p1 = gpio(1)\nawait p1.setMode(GPIOMode.Input)\n\n// highlight-next-line\np1.subscribe(v => console.log({ sub: v }))\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a7118a9a.a504f1c8.js b/assets/js/a7118a9a.a504f1c8.js new file mode 100644 index 00000000000..9d520117235 --- /dev/null +++ b/assets/js/a7118a9a.a504f1c8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[273],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},b=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),b=o,m=u["".concat(l,".").concat(b)]||u[b]||f[b]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=b;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}b.displayName="MDXCreateElement"},87227:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>f,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const a={},i="Utilities operators",s={unversionedId:"api/observables/utils",id:"api/observables/utils",title:"Utilities operators",description:"tap",source:"@site/docs/api/observables/utils.mdx",sourceDirName:"api/observables",slug:"/api/observables/utils",permalink:"/devicescript/api/observables/utils",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Transform operators",permalink:"/devicescript/api/observables/transform"},next:{title:"Settings",permalink:"/devicescript/api/settings/"}},l={},p=[{value:"tap",id:"tap",level:2}],c={toc:p},u="wrapper";function f(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"utilities-operators"},"Utilities operators"),(0,o.kt)("h2",{id:"tap"},"tap"),(0,o.kt)("p",null,"Allows to attach a side-effect function to a pipeline, tap passes the stream through. Typically used to add logging."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, map, tap } from "@devicescript/observables"\n\nconst obs = from([1, 2, 3])\n\nobs.pipe(\n // highlight-next-line\n tap(v => console.log(v)),\n map(v => v * v)\n).subscribe(v => console.log(v))\n')))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a7397367.2f40d288.js b/assets/js/a7397367.2f40d288.js new file mode 100644 index 00000000000..cd21fbc0e94 --- /dev/null +++ b/assets/js/a7397367.2f40d288.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6617],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=l(r),y=i,d=p["".concat(u,".").concat(y)]||p[y]||f[y]||a;return r?n.createElement(d,c(c({ref:t},s),{},{components:r})):n.createElement(d,c({ref:t},s))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,c=new Array(a);c[0]=y;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[p]="string"==typeof e?e:i,c[1]=o;for(var l=2;l<a;l++)c[l]=r[l];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},93987:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>o,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,unlisted:!0},c="Infrastructure",o={unversionedId:"api/clients/infrastructure",id:"api/clients/infrastructure",title:"Infrastructure",description:"The Infrastructure service is used internally by the runtime",source:"@site/docs/api/clients/infrastructure.md",sourceDirName:"api/clients",slug:"/api/clients/infrastructure",permalink:"/devicescript/api/clients/infrastructure",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},u={},l=[],s={toc:l},p="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(p,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"infrastructure"},"Infrastructure"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/infrastructure/"},"Infrastructure service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a75cc24e.9f39bc17.js b/assets/js/a75cc24e.9f39bc17.js new file mode 100644 index 00000000000..b26b8c2e549 --- /dev/null +++ b/assets/js/a75cc24e.9f39bc17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5071],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),d=i,f=u["".concat(s,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var c=2;c<a;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},28970:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={sidebar_position:4,description:"Learn about the special objects in runtime, their limitations, and how to work with them effectively.",keywords:["special objects","runtime","RAM optimization","prototype manipulation","JavaScript limitations"]},o="Special objects",l={unversionedId:"language/special",id:"language/special",title:"Special objects",description:"Learn about the special objects in runtime, their limitations, and how to work with them effectively.",source:"@site/docs/language/special.mdx",sourceDirName:"language",slug:"/language/special",permalink:"/devicescript/language/special",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Learn about the special objects in runtime, their limitations, and how to work with them effectively.",keywords:["special objects","runtime","RAM optimization","prototype manipulation","JavaScript limitations"]},sidebar:"tutorialSidebar",previous:{title:"Strings and Unicode",permalink:"/devicescript/language/strings"},next:{title:"Tree-shaking",permalink:"/devicescript/language/tree-shaking"}},s={},c=[],p={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"special-objects"},"Special objects"),(0,i.kt)("p",null,"To save RAM certain objects are treated specially by the runtime,\nand as a consequence you cannot attach arbitrary properties to them, manipulate their prototypes freely, etc."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"functions (built-in, top-level, nested (closures))"),(0,i.kt)("li",{parentName:"ul"},"static buffers created with the ",(0,i.kt)("inlineCode",{parentName:"li"},"hex")," template literals (eg., ",(0,i.kt)("inlineCode",{parentName:"li"},"hex `00 11 22`"),")"),(0,i.kt)("li",{parentName:"ul"},"strings and numbers (",(0,i.kt)("inlineCode",{parentName:"li"},'"".myProp === undefined')," as expected,\nbut ",(0,i.kt)("inlineCode",{parentName:"li"},'"".myProp = val')," throws instead of being ignored as in JS)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ds.Fiber")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ds.Register"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"ds.Event")," - members of ",(0,i.kt)("inlineCode",{parentName:"li"},"ds.Role"))),(0,i.kt)("p",null,"It ",(0,i.kt)("strong",{parentName:"p"},"is OK")," to add properties to arrays (",(0,i.kt)("inlineCode",{parentName:"p"},"[].myProp = 1"),"), dynamically allocated buffers,\nand of course regular objects and class instances."),(0,i.kt)("p",null,"The prototype manipulation is limited also for arrays and buffers."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/aa027bd7.ff5b7142.js b/assets/js/aa027bd7.ff5b7142.js new file mode 100644 index 00000000000..303e637080d --- /dev/null +++ b/assets/js/aa027bd7.ff5b7142.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3464],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,m=u["".concat(l,".").concat(d)]||u[d]||y[d]||i;return n?r.createElement(m,s(s({ref:t},p),{},{components:n})):r.createElement(m,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[u]="string"==typeof e?e:a,s[1]=o;for(var c=2;c<i;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},2317:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(25773),a=(n(27378),n(35318));const i={sidebar_position:0,hide_table_of_contents:!0},s="Status Light Blinky",o={unversionedId:"samples/status-light-blinky",id:"samples/status-light-blinky",title:"Status Light Blinky",description:"Many boards have integrated status LED that can be controlled using the setStatusLight function.",source:"@site/docs/samples/status-light-blinky.mdx",sourceDirName:"samples",slug:"/samples/status-light-blinky",permalink:"/devicescript/samples/status-light-blinky",draft:!1,tags:[],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0,hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Samples",permalink:"/devicescript/samples/"},next:{title:"Blinky",permalink:"/devicescript/samples/blinky"}},l={},c=[],p={toc:c},u="wrapper";function y(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"status-light-blinky"},"Status Light Blinky"),(0,a.kt)("p",null,"Many boards have integrated status LED that can be controlled using the ",(0,a.kt)("inlineCode",{parentName:"p"},"setStatusLight")," function."),(0,a.kt)("p",null,"It's important to remember that the status LED is also used by DeviceScript to\nindicate the status of the runtime, like a short red blink every half second.\nSo your color will get overriden by the system colors.\nTherefore, keep your blinks short."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { delay } from "@devicescript/core"\nimport { setStatusLight } from "@devicescript/runtime"\n\nsetInterval(async () => {\n // red\n await setStatusLight(0x100000)\n // wait 0.5s\n await delay(400)\n // blue\n await setStatusLight(0x000010)\n // wait 0.5s\n await delay(400)\n}, 1)\n')))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/aa71f709.dd89a725.js b/assets/js/aa71f709.dd89a725.js new file mode 100644 index 00000000000..589cc8e84dd --- /dev/null +++ b/assets/js/aa71f709.dd89a725.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4514],{15745:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-pages","id":"default"}')}}]); \ No newline at end of file diff --git a/assets/js/aae462db.2c34091c.js b/assets/js/aae462db.2c34091c.js new file mode 100644 index 00000000000..170b4341d6f --- /dev/null +++ b/assets/js/aae462db.2c34091c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2793],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),c=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(o.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=c(n),d=r,k=m["".concat(o,".").concat(d)]||m[d]||u[d]||i;return n?a.createElement(k,l(l({ref:t},s),{},{components:n})):a.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=d;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[m]="string"==typeof e?e:r,l[1]=p;for(var c=2;c<i;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},76479:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Equivalent CO\u2082 service"},l="ECO2",p={unversionedId:"api/clients/eco2",id:"api/clients/eco2",title:"ECO2",description:"DeviceScript client for Equivalent CO\u2082 service",source:"@site/docs/api/clients/eco2.md",sourceDirName:"api/clients",slug:"/api/clients/eco2",permalink:"/devicescript/api/clients/eco2",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Equivalent CO\u2082 service"},sidebar:"tutorialSidebar"},o={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:c},m="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(m,(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"eco2"},"ECO2"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,r.kt)("p",null,"Measures equivalent CO\u2082 levels."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"Equivalent CO\u2082 (eCO\u2082) readings."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\nconst value = await eCO2.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\neCO2.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:readingError"},"readingError"),(0,r.kt)("p",null,"Error on the reading value."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\nconst value = await eCO2.readingError.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\neCO2.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:minReading"},"minReading"),(0,r.kt)("p",null,"Minimum measurable value"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\nconst value = await eCO2.minReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,r.kt)("p",null,"Minimum measurable value"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\nconst value = await eCO2.maxReading.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:variant"},"variant"),(0,r.kt)("p",null,"Type of physical sensor and capabilities."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ECO2 } from "@devicescript/core"\n\nconst eCO2 = new ECO2()\n// ...\nconst value = await eCO2.variant.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ab830b92.26ebef5b.js b/assets/js/ab830b92.26ebef5b.js new file mode 100644 index 00000000000..33e90e88755 --- /dev/null +++ b/assets/js/ab830b92.26ebef5b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4179],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>v});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,v=u["".concat(l,".").concat(f)]||u[f]||d[f]||i;return r?n.createElement(v,a(a({ref:t},c),{},{components:r})):n.createElement(v,a({ref:t},c))}));function v(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:o,a[1]=s;for(var p=2;p<i;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},11730:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const i={sidebar_position:4},a="JSON",s={unversionedId:"developer/json",id:"developer/json",title:"JSON",description:"It's worth mentioning that JSON serialization and parsing is fully supported in DeviceScript.",source:"@site/docs/developer/json.mdx",sourceDirName:"developer",slug:"/developer/json",permalink:"/devicescript/developer/json",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"tutorialSidebar",previous:{title:"Custom Services",permalink:"/devicescript/developer/drivers/custom-services"},next:{title:"Observables",permalink:"/devicescript/developer/observables"}},l={},p=[{value:"JSON.parse",id:"jsonparse",level:2},{value:"JSON.stringify",id:"jsonstringify",level:2}],c={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"json"},"JSON"),(0,o.kt)("p",null,"It's worth mentioning that JSON serialization and parsing is fully supported in DeviceScript."),(0,o.kt)("p",null,"You can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON")," object to parse and stringify JSON objects, just like in JavaScript."),(0,o.kt)("h2",{id:"jsonparse"},"JSON.parse"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"const msg = JSON.parse('{\"hello\": \"world\"}')\n// destructure field 'hello'\nconst { hello } = msg\n")),(0,o.kt)("h2",{id:"jsonstringify"},"JSON.stringify"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'const json = JSON.stringify({ hello: "world" })\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ac1a52a9.128b2dc8.js b/assets/js/ac1a52a9.128b2dc8.js new file mode 100644 index 00000000000..706ea00b5a1 --- /dev/null +++ b/assets/js/ac1a52a9.128b2dc8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9145],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},v=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(n),v=i,g=p["".concat(s,".").concat(v)]||p[v]||u[v]||a;return n?r.createElement(g,o(o({ref:t},d),{},{components:n})):r.createElement(g,o({ref:t},d))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=v;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[p]="string"==typeof e?e:i,o[1]=l;for(var c=2;c<a;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}v.displayName="MDXCreateElement"},82443:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={sidebar_position:5},o="Troubleshooting",l={unversionedId:"getting-started/vscode/troubleshooting",id:"getting-started/vscode/troubleshooting",title:"Troubleshooting",description:"troubleshooting}",source:"@site/docs/getting-started/vscode/troubleshooting.mdx",sourceDirName:"getting-started/vscode",slug:"/getting-started/vscode/troubleshooting",permalink:"/devicescript/getting-started/vscode/troubleshooting",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Debugging",permalink:"/devicescript/getting-started/vscode/debugging"},next:{title:"Local and Remote Workspaces",permalink:"/devicescript/getting-started/vscode/workspaces"}},s={},c=[{value:"Node.JS v16+ not installed",id:"nodejs-v16-not-installed",level:2},{value:"DeviceScript CLI not installed",id:"devicescript-cli-not-installed",level:2},{value:"DeviceScript terminal won't start",id:"devicescript-terminal-wont-start",level:2},{value:"Port 8081 is used",id:"port-8081-is-used",level:2},{value:"Serial connection won't connect",id:"serial-connection-wont-connect",level:2},{value:"Can't connect after I deployed my program aka Factory Reset",id:"cant-connect-after-i-deployed-my-program-aka-factory-reset",level:2}],d={toc:c},p="wrapper";function u(e){let{components:t,...a}=e;return(0,i.kt)(p,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"troubleshooting"},"Troubleshooting"),(0,i.kt)("h2",{id:"nodejs-v16-not-installed"},"Node.JS v16+ not installed"),(0,i.kt)("p",null,"Make sure that your installed ",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/en/download"},"Node.JS")," version is v16+. Some linux distribution may\ninstall an older version of Node.JS by default."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"> node --version\nv18.16.0\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("a",{parentName:"p",href:"https://github.com/nvm-sh/nvm"},"nvm")," is a convinient way to install\nand manage multiple Node.JS versions.")),(0,i.kt)("h2",{id:"devicescript-cli-not-installed"},"DeviceScript CLI not installed"),(0,i.kt)("p",null,"The development server runs the DeviceScript command line (",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/cli"),") installed\nlocally in your project.\nMake sure ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/cli")," has been\nadded as a developer dependency to your project, and that dependencies have been installed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"yarn add -D @devicescript/cli@latest\nyarn install\n")),(0,i.kt)("h2",{id:"devicescript-terminal-wont-start"},"DeviceScript terminal won't start"),(0,i.kt)("p",null,"The DeviceScript extension spawns a Node.JS process to\nrun the debugger adapter, connect to hardware device and build sources.\nDepending on your machine configuration, you may have to specify where the Node.JS binaries\nare located."),(0,i.kt)("p",null,"Start by enable the ",(0,i.kt)("inlineCode",{parentName:"p"},"Devtools: Shell")," preference so that DeviceScript start node is a terminal rather directly.\nThis allows you to look at the potential error messages."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Open the ",(0,i.kt)("strong",{parentName:"li"},"User Settings")),(0,i.kt)("li",{parentName:"ul"},"Search for ",(0,i.kt)("strong",{parentName:"li"},"DeviceScript Devtools shell")),(0,i.kt)("li",{parentName:"ul"},"Reload Visual Studio Code")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Devtools shell settings",src:n(58550).Z,width:"634",height:"106"})),(0,i.kt)("p",null,"If the error messages indicates that the ",(0,i.kt)("inlineCode",{parentName:"p"},"node")," process cannot be resolved, you may want to specify the path\nof your node.js v16+ manually in the user settings."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Open the ",(0,i.kt)("strong",{parentName:"li"},"User Settings")),(0,i.kt)("li",{parentName:"ul"},"Search for ",(0,i.kt)("strong",{parentName:"li"},"DeviceScript node")," and update the Node.JS binary path"),(0,i.kt)("li",{parentName:"ul"},"Reload Visual Studio Code")),(0,i.kt)("h2",{id:"port-8081-is-used"},"Port 8081 is used"),(0,i.kt)("p",null,"It may happen that a previous session left the development server dangling, run this command to kill processes hanging on port ",(0,i.kt)("inlineCode",{parentName:"p"},"8081"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npx kill-port 8081\n")),(0,i.kt)("h2",{id:"serial-connection-wont-connect"},"Serial connection won't connect"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"serial connection used by another application"),(0,i.kt)("li",{parentName:"ul"},"make sure the ",(0,i.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/serialport"},"serialport")," package is installed"),(0,i.kt)("li",{parentName:"ul"},"running in remote workspace")),(0,i.kt)("h2",{id:"cant-connect-after-i-deployed-my-program-aka-factory-reset"},"Can't connect after I deployed my program aka Factory Reset"),(0,i.kt)("p",null,'First reset the device, or unplug and plug back in.\nIf this doesn\'t help, select "Clean Flash..."\nfrom the connect menu and once done select "Flash Firmware..." from the same menu.'))}u.isMDXComponent=!0},58550:(e,t,n)=>{n.d(t,{Z:()=>r});const r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnoAAABqCAIAAACkgWvpAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACLcSURBVHhe7Z0JXFTVF8dHdhhkB0WGfUdQxAUUxJRcw4UM86+ZpbaoZf7//U3TVtfMXDLTFlOxXErJtSj/obkl7iAqsgnqKIIgyCLCKPx/M/f1es7mgAxine9nPnrffXc599zz7rnnvTdDK3d3d5EAOzu7mzdvcgcEQRAEQTQFBtz/BEEQBEHoDXK3BEEQBKF3yN0SBEEQhN4hd0sQBEEQeofcLUEQBEHoHXK3BEEQBKF3yN0SBEEQhN4hd0sQBEEQeofcLUEQBEHonWb6VSkTM3MuRRAEQRD/PCi6JQiCIAi9Q+6WIAiCIPQOuVuCIAiC0DvkbgmCIAhC75C7JQiCIAi9Q+6WIAiCIPQOuVuCIAiC0DvkbgmCIAhC75C7JQiCIAi9Q+6WIAiCIPQOuVuCIAiC0DvkbgmCIAhC75C7JQiCIAi909i/CNTrv6te6mIrT1Wlfzt+3q+KTM3QXwQiCIIg/sk0LLr1HzltUn8bJMQ+EifZxQP7DlyU2UiCQlohJ3j42GH+rBhBEARBEEIMbWzk7pPH3Ny8urqaO7gf/5HzZ8WH+nce2j/gntg23OtW0vQl34nDno60qb3mNeq9F6NDQiNCDc4nny3hKggwNDLmUgRBEATxz0PX6FYSP29WvL/seMLKX/OMg0cNCTaW5uxE/s4cqchn4NRocebGD1YeqvKKnzV/pD+CXYIgCIIgeHSNbsvvBvR7ss21PZ+t3fTTtr0VVrZ5v3+XLpWJRLkFFTU5O5cu25peJIl+OlJiWHBs0/4snLgP1eg2yrvSza625p5BVQ29rkUQBEH8zdHZ1WWtXPa/qpAR04aIRaKSpNVLN6ZUKfKr0pO2JKUj3XXqqHCbqtMJi3ZX1SvOtDScnZ1nf/jB4kUfh4Z25LKaheFPx322/NNJEydyx/8koPO5sz+EzgMDArish2ZcwrGsCxlJ81s15CbK3KQLGVnH1o6TVxKmCYIgmgld3K1YEj5k7ORZY4PEInFIzGgn+Soljpm6fP3mzZvXL5820F5eKCTSz0kkk4kjxo4fHhMogVN+SHr3fmL5sqUrV3zGPvBY8+bMjhs2zNTUlCvRcOru3burgDtuLurr6mS1tdyBHoBH5xWFD/T2wXvvPhkTY2DwON85CB61eOvBE2kZcK7yT9qx76eRgyQI4nFFl+U47PlXxg4Jl4jLM5M3r1yWWFQvEg+fNaGnWJqUmCSFf5051rWVKP3r+Ss3/5Ze7RTSa9Skt8aGNdHCWF1dfenSZXzKysqsrK37Phnz9ozprq6u3OmGUFBQ8MHsOdPfnnn27Dkuq1lI/HHblKn//vqbb7hjzfSKjp43d85L48dzxw3k1q1ypquKykp7B4e4YUP/+5//tG7dmjvdQJ6OG7ZwwXzsb7jjZsbtxYSv3h0c7GB1W5qbnSv/lIpMGzkUgiCIR4+u0U/evklvvDNv5ZbkPPl7x2H+bU3yDs1M2JIw81CesZ3EA3lV0uQtq5fNfmPivrwmvJlcXFKycNEifN597/2FH38slV51cnSMGzr08Y7bNODgYG9rY2NoZMgdNxC4WqarWe+8+/XXq7FBcXd3GzI4ljvdQJycnOCqDQweUUA5KjbCTiTK2Nine9+Bg2Plnye6DXuvZT6mIAiCeDC6/MxFz5lrpnY2KpJelmampSTthccVD5+/elSbvJ2/ZPoPGOJVvHPajIQrrjGj+ob4+Xm2cZY43Tu1bNy8g4K1UfVnLqK8K/Fv9g2zwnIjlqNE795PwK0WXL++4KOFXJZI5O/vP37ci6L6+q9Wr87JybW3s3vmmeFBgYHGxsZ37tw5dvxEcnLy5EkT7eztd+3a9b/fklGlffv2414Ye6emZuvWxOFPx5mbm6/+Zk3GhQtw2AMHDOgZFWVpKb/zXVpatmbdury8vA4hIUOHDHZq0wZ+5tatWzt27jp2/DgKPzP86a5du1qYm9fV11+5fGX1mjVQlETi8mz8CHg1IyOju3fvouTJk6cmjB+H7uDt3Nzcrl27lpWVFdOnz5n09C++/AoCIJ2eframtia0Y0dDQ8MydLFjJyrKo3aJRDFKOaw8d/AgWLNKVaIiI+OfGV5aWrp8xecQVXVcN0tvvjxhAiT/bsPGU6dPowrTeUlJiYmJia2t4ldMFCTv3YsYvXv3iP59+yJuNjQwgLbPnju3ZWtiRUUFCqBxKFPiKsEpmUx2MS/vhx+2YO6cnZ0nT3yV13n/fv2io3taW1mhCjZSa9cluLu5xcUNK7hW8PnKlVW3byt6UzBl45lJncyu/u+lmCn7uSyOcQnHZoS3zt0x53zQ1MG+8oC3/OzGN5+Zw4oFPbdo8eS+3rbyJw7lV1O2zn3xo31Izk26MNy7POWj8HFr6ucI0uS/CYJoJnSJEU+tX7Ry4/70IkOv6JGT3no+pJWoKnHep0nFbQYOHdimOGnZ7IQr9SKnAYOHD+rpZV4lPboz4YuEU/pZx7Kzs8tKy8zMzFxdXRF7TRg/Pjg4OPfixYOHDpeXl0dG9sBqnpmVjUXf29ubVQnw90P53Nzc64WFLIcx/sUXBw7ob2xsdO7c+eMnTtTKauFjQkM7jhnznLW1zcmTJ0+cPImKcOfBwe1jnxrUs2dP+JjDf/yRlpYG725qaor81ydP9vT0uFFcfOjw4UuXLhsbm7DGEaQatGr1wQcfCvcKPD4+3h4eHtgcXL12Db4HztLfz+/48ROZWVk4iwh+/4EDaWfOsMIM9DV/7tyZM2Y4t23LZT0I+LzKykpoqY2Tk9px4d/LV65gIBgCqwIxDAwMz53P+OPIEYiBHIgEYS5kyncMI0eMgA/OyLhw9Nix2lpZ57Cw0aP+hY0Iaxy+Nj8/H3q4VV7u5+v7/JgxSvexI3v0GDCgv5GhIbSND/ZM2LuwUwaGBqZmZizNsTxxf0G9yKXv18d2f/3O8CAu9y8kA97qZXhuz4GMGzUiq+BR7y+OaNVKJBm/Zv07sd6G0v07du86kCtyiRg3f+04rgZBEMSjRBd3WyXNSE78JiHllshYVJR5KF3uSatSVk8fP/K5keOnr2avKBdt2JteJZJJk+Z9nrDzqJS9ttzk1NXV1Ys4Tx4R3s1F4nL69Onln63YtHnzrt0/3ZXJgoKC8i/l19TUSFxcEFrBGfj6+iLuzMrKZrUYYZ06BQYGVN+58+2GDau+/DJh/bdz5s7LzMxERGhibLx9x451CevxOXnqlKVYjNCtbZu2cOE5OTmbv/8BgdonS5YUFhY+0auXpaUlgrx58xds3LR58dKla9etY+1DgN+S95Zo+DnMisrKTz9d/t2GDR8t/Dj/0iWx2NLPz/e35GSpVIqzCDq//2HLkSMprDDj7NlzGzdvQnfPj3kOMT2Xq5V6BSytaVwY8r26OqgIioK6oLTb1bfTz5796eckiIGKEAnC5OflRYSHtzIwSPrl15WrVkFdaxMSEIz6+vgEBgaicTjOlJSUxUuWQg8YGvYfLi7tunTpzHpnODk5QQZseqBDtLBg4cfw5QcOHvz3f96EHlTuqSS+PvatNUelNVbevZ6buz3tf19PChLe1za9mBj31Iuvvfz0sz/l4lDiFwuLmDoiwupexoZnYl+aPu3Nl2M3pN4R2XbqP4XVIAiCeJTo+gRU3OeNUV1tyo5uXHYcByED44eEKV5IFokjRv170vBgsahq56If0o3DX5jWS5GvH8QWFkZGRnC6CDQ9PTwRKnXp3Jm9jjt+3IsI1ExNTBBlXisoQGjl7eUFZ+Do4FBUdANemWtCAZyBiYnplStXUlPTuCyFP2jTpg0i11H/GsnahCNBvpWVVWpaWnV1dbeuXRd+tGDM6NHwVTY2Ng729rW1tYhKIQ9rgaeqqgoycAcqXL9+nXliVIS0BgatnNs6s1NagMf9dc8eFxeX+PhnuCytQBcIVe/du2fZ2lLTuE6dOg0/Z2dnB48bEOCPnMuXL8MHsxZ4JK6utrY2FeXlZ9LTWQ7KlJaWok1vL080ju0FH45jaBggpslOcDsaQIdlt27BQy+YN/fVV152dHRQ1dt9XN790di+A8d+vOWktMZU0mvKuoTxf70il5sxV6rYS0izbpTjP/nz7tggt1Yiw8DRe7iXmSeGImI2tdL1dgBBEIQe0dXdetmIRSJZrcwkZNisVV9+MGHk2Jfi5Q8axSOeGR4VM+rDb1a9OTDat42JSCzxkf+Esp4IDArEIo5VOyszy8BQLjyiwM9WfM5/1iasx1qfnZ1jaGiEkDHA38/E1BQB6H3PBUUiExO4olYy2X3fCDI0NITkcOQIv4Rtsse3nyxeciTlaCtRq+7dI6ZOfcPdTf68FuFjTW0NV79RsCfHlVXyJ9naCQ5u379fv6tXr27ZspXL0kqAfwAcbdGNG1evXtM0LrhG+FcLc4sAf39/Pz8MR7j/aFry8vIQxSbv3XvnTk1IcPAbU6bo8gVo6dG1s0b3HbgSgWrriGen/PVwWxPlqWsQ2go+H23kzhAEQTxCdHW36T/O+njLRXHUpA9G+VcdWJaUI7J1D0d+jIdElJO0bG+hbY8JE6JspT/Pm/mN4m6zHugQEhI3dKiRsXF6ejr8BBxPXV29i8RFevVqxoUL7JObm4uYKe1MWnl5uZura1BgIKLSCyrhGkJPBKauEomnpyeXpfimUGlZGaLedu3a8Q3ig3xra+vCoqLvNmyY9e67+fmXbG1sJRIXFEY43bFDB66+ziDgZs818a/ExeXuvXs3btxgpzQBXztq5L8qKyvXf/udpnvUQqJ7Rj0Z06e+rg7B97Vr1zSNCyXT0s7IZLVBQYGQBMUyMjJYC0IgHnsMDH2yHG9vb2sr6zs1NZlZ2WWKxoPbB7NTKObk6CSTyQoLi1gOA/nQeeKP29557z04dbGFRafQUO6cKh+u2TwjlneuUml5OazK0FSru02RFteLrLyDHFJ37djNf/af5U4TBEE8QhrwJwpKziafrzUv3Lbo06QcWfATMT52Dg7+QSE+dbkbVi1PSDp/z/Da9pUb5T8wpYrqjzi62cl/9uHmbSNNP+Lo6ekRGBBgZmqKRTkqMnLAgP6RkT1MzcxOnz6NKA1xWEVFJZxQ2zZtOnXq5OzcNiys05DBg0X1okuXL5eV3QoMDHB1c8NwEFQlJf2CBrHcd+vaxdjY+NTp02lnzgQFBrVr5xzWKdTNzRVh1uDY2OuFhXDSCIjd3d3hV+Cto6N6xvTpfTEv7+m4uH79+kokEpT08vKsq687duz4tWsF/gH+CHNDQ0NdXSUDBwzw8/OTSqWQ5O7du8dPnICLQr9oysvTE976xMmTLG0hFrcPCkIvQwbHOjk6FhUWbv1xG1yRu5u7j6+PjbW1h7s7mjp79i9HUVR0A3HhwUOHWJtKsGbNzMy7dO4MXT01aBBkMDAw+H3/gV9+lf9xRBNjE7XjQmvlt2516NChTRsnM3NzeEHE8axNPz9fNzc3B3sHLy8vS0vLwqJCHx8fP18fHMI3I85GXA41JifvReHAAH8PDw807unhMXTIEAcH+7z8/K2JiajI67xbt24jRsRjpjBrgQGB2DalpaU5t3WeOvWNjiEdUlNT4aFZ13L6Tpg3auQLo4cNGvbsc2MmzogLtDaoyf1tycLkS53iXoqSmJZmfL5B/uK5SBQ67GXF8YqNX9xwHzAo2NkjIm5QeEhY9z7xL771/hj/r76HhH2eey3IrkZ6aPWO0/elCYIgmgldo1tG5vaExLNyf5qeIS0z9oruHe1lXCY9Lw9nq84mJvyo3tc+DPCX7vBC7m5isfjK5Svffbdhzdp17JkfgrO1a9ddunTZ1tYWPqZLly6tWrXiw8Rz588jtkMOEixHCFr4avVq+D8UCIO77tSpVlYLX7v/wIEft21HAm6jV3S0r59vRWUVHFJJSYmDvX3PqEj4M4R0v/665+ixY4f/+GPTps3FxcXOzs6RPXrAY5WUFHMdaCU7K/vOnTvh4d0gOXze2oQE9nUaNJiTk2NiahrSIcTQsMHfvrW2toKisHswNTXJzs5Z9cWX27ZvZ6c0jQunqm7fvpB5wcjISFZbyz+aBQcPHZZKr8KnBreXvxe8a/dPu3f/VFlVFRQY0K1rV0MjwwMHDyLUxqkjR1I2bf6+pLgYHhcTYSkWw7mu/maN0qPZsltlmE0oCh9UP3jwYNIv3N9JVvNm8m8H91+sqLGSePt6e3s5iMpz969756WZSt8JUibl/YkzN6XeqGrtHd538NDYXsHWNy7KX6QiCIJ45DT2z8s3kEZ87/ZvidovyBIEQRB/exoW3RIEQRAE0QjI3RIEQRCE3iF3SxAEQRB6h57dEgRBEITeoeiWIAiCIPQOuVuCIAiC0DvkbgmCIAhC75C7JQiCIAi9Q+6WIAiCIPQOuVuCIAiC0DvkbgmCIAhC77To7922trS0tbExNTXhjnWgpqa2tKysQt2fzSEIgiCIR0XLdbfwtY4O9pWVlbfv/8vwWjBUYGNjc6O4hDwuQRAE0XJouTeTEdeWlZXp7mvBvXv3amtrUQt1uSyCIAiCaAG0XHdramoC38kdNAQ43QbdfyYIgiAIfSO/9colFZibm1dXV3MHTYehkTGX+hM3O7krvXnbqKpGvcu3t7OtbMgNYYvICW8Osj5zMv9OfX3r1q1vlpZyJ/6O9O79xH+mvmFhYZGRcYHLahYeVb/6Y/jTcRNfeeVOTU1+fj6X1UCgk9cnT5LdlTW6BSUg0oRx465cuVJcXMxlqYPNxeDYWDMzs4ZOh7Oz84y3pvn5+Z04eZLL0plG1BVWeVTqajRvz5jeMyrq0KHD3PHjiVDtD2/zROP4u7yZ7BX/5nPhjsayu9yxrrz6yssrV3zGPsuXLYVRcieaGmFH7IPLmDvX7KBrXozFiz4ODAjgTjQXzab2vyuYsthBg/YfODDptdcTf9zG5RIE0YL5W7hbr/h3p/VrV7Bn5YpDDXjSq/A6EheXOfPmY83CJzU1jeXDGcyd/SG25OxQR1AetVCXO1bh5s2bfF9IiC0sGu1p9u37fcrUfzdinWVCIsHEwOfSpcvslC7o2K92VWhS+yMBY8GIMC7uWAfg6rBHQYjAHT8K2jq3xb9NcgvngXbb0mjc5ak7+m7/kdMIm9fE315XTcvj724toqZM7ud2O33DJ1tyuSydwKJpY22dvG9fQUEBy1mzbl2TmKAuoNN33nu/4Pr1mN69m9NYAwL8jY2Nt2/fwR2LRMtXrMi40Hx3hh+t2gmCIB4VLfeLQL7eXvyKrBnv+Pf+28/52p5Fc7Zc5LIAHFh2ruBYHVj3J4wfl52T88WXX3FZioqTJ74KJbBDqOLzVV/APaCkubl8CNXV1au/WcP8E3832FUigaiOjo5GRtxYzqSnC5sF2AYipENrwkEhtI0dNGj3zz8zf4MyHUJC2KnkvXuxCWVdLPhoIctk4kmvXs3MyhJWZGNhEt69e3fbjh3IF2aygaBr9Bg3dOj+AwfURqiI2GL69GFpVqVH94ge3bufO3e+S5fOyDl+4mR0zyjWLxN+77593SMimMauSKUQlXWhSRVq1c6jSWZ0BBlCQzvKZLLKqqo7d+6o6gQN6lKdnz4GhowBskym7dLSUjYLwrnmEaoIYJoQYqL9P44cQTusa+GQhdpg+mH5SqBrWBES6BSitm8fxHetahXCHCYkEvzAebGZZk6npvJzzRsh0rwhaZksIJSfqRQJVtfW1pbJzKsaabVTIJwjNh286fKoThMylQZVdusW2lG6PJmJQv+9oqOZnExLrIyq9pBgk85bNS+82sv/hbHPI63WKoSDFebrYkhAU3VVnTPxeB5YgMGPHWtCamoajIqpXdXmAaaSzb7aGURaSTlHUo76+/kq6UooButl908/xT71FGuNty7VuYYkwitLqTW1p4RKEF5Z/KUE2IzrqK5m4LF+Vcoi6rXpw/1k6evnrT0j4/IU6PKqVHFxcevWlnAVHTp04N+DQI979/3u6uqKEPCTJUt37tqFnCGxscdOHP985aqffk7q3Dmsc1hYxoVM5PeMisK8njhx4pPFSw4cPJiadiYkuD0cyYdz5qq+RYIL28rK6viJE8JBmZuZhYV1giQZGRfYUohOv//hh9vV1QP697ewsCgpKfH38+NfA+nfr6+Xp+e2bdstW1v6+fpmZWfn5+fDmMY8NxrrJvqFhM5tnctulaFlXDNYgyAbMsPDwyN7dIfY6elnscHCqDFGJSEhQNcuXRK3bcNIT51O9fTwOHf+vKurxM/P715d3dszZ0Ez7do58/16enq0Dwry8fb++ZdfUOXixbyoyEjo59vvNmhRhVq1M9h1riqzg4MDOoI2liz7FBePvZ2dWp04OjjoUp3V4gkKDIQqTp0+jXw2oYVFRRAbGugUGurt7a0kJGYKI8UqhhlHRzhkenBp1w6rRsL6b83MzKBG9h4KW1Z27t7NVAp5IJXqSzdYIMQWFmzqZXdlvZ/oVVdXx0RSaxXQMNIY9fadO7/86msUU2uiaLlb1y7Xr1/nX6TijZCdKq+o2Lo1UctkYUZGPjvi0OHDGClvEshHXQ8PD2b50EZ4t27Ya6KuphlkVdAdykBdvAkpOuFgahROk+qgIDkuSaXLEzMIE8WeGBWhJZwN7diRmYda7UEbrApv1fwliYTq5a/FKrSvDNoNCaitjoqqOuclZKDi9z9sgbGhABQLP6raOMbu6+MD94Zi+fmXBvTvh0FdyMyE2lVtnk2llhlEmdcmT7pVXg6NIR9GDjcJyZV0xfWtgCkZVsquC+g/OioKiw+zAaW5Fi4+rN8nY/rwk6i6LnXt2kXtlYXCDvb2bMYhpFyOetED9dlsPAY3k62eGNTPi0sL8X72zdEdLS7/tnL54QY9sf0LzPRnKz7H9KzU+uKS8G5nVlYWdiS4ttkh9kp/HElh6UaA3Trb3MDKYQf8LVZ0V3D9Ooz1/PkMHAYFBcpLi0TIKS4pUdomR4SHozDbNgImba9e0SiJAbLMlKNHIXZAgD/SKLklMREXA0YN62QFIAAuTkS9bKQQ49PPPmPCYGuM6opSauCrQCpcpVAmmmKnNKFJ7VpkBojSmDyadKJjde1gQnfs3IUECqOKLsNhYOxsXmAP5eXl2BAgjamBG+NVqrZBuGRkCqceKmWnNFkFOytEi4k+DMInxJCBNwmAeIKpGqPGGOHVEP1onwJdEE6T7oOCifJa2r9frj2Yh3btabdqJTRZhfaV4YGGpLa6Fp3z8A+AcEp69Sr2alA+O8VAX7iceZvEv4hr4SDZWSWEi5imGUQ+Vqp1CetZPgrwZbQAJaNfJgNGej4jg9kJO8vPNZOWX0kAe9rFJlHtuqTpyrK1ta26fZs1y4TURZ/Nhjy+btmEjOgf17lanDv7vkezFpFTJj7pdjstYfH3DXpiqwxM4c1pb2GesKdbvOhj/n6OEnBL/C0pYfTPT23jwNUFa0YCNoFE/PDh+LBTACsahIFVsTUCQqL8L3v2sLMM2C4uNlgbd/wn7EYf/Bl3rDB9LqUwfXzYPZa5sz/8fNUXEAAFmCdTAlfp9YLr3MH94JTwLgJLoylsI1iOJtSqXYvMwo406UTH6tpp3ISqbZ9NjZJIqreO7GxtkXlBEQIqockquNT9aDLRhwFGgnUNveNfpdvgper0qd3qHoiqGnUcFCqqmqh27amtogktVvGQK4NqdS06FyK8ZQp/yRI8Wi5nVYSiappB5MOvN/TSUFLyjRs34DvZjkQ416rS4hqH13d0dGzrXKo6EC1XFvYHWNOWL1vKHqghR0d9Ng8t392mr/56n9u0fhPGnHr72z89q/xrPyHGF39e3sBXkTWB2f1kydLJE1/FJg5pLlcBcwmYyznz5sPa2AMJ7txDw9sZEugCm0el3kFmVtaAfv0gBvZ6sFG167JaVJ/DKQFDxMWA0fXoHqGjN2paVNWuVmZsC7jUn2jSiY7VmxPhc8RGoMkqhOjVRLFCYXXDHGFpEz4h04TaKeADGt1pkkHpor1G85ASaqmuXedsl4xIfdJrr+MQDhshIzvVJKidQfgqLtViUHtlYa6xrEGZ8K/QEnO6DbVh/fE4vJl8cWPC75dtoidNjFAcKl5FblewZ/mCbQ8V2N4PLB67PGziuOM/YTctN2zchAIsp6mABcT07p2Xnw8TgdszMjJifSkBXwKPglOI51Q3mExs1RuMCD6E9200we5mYxepRQDd8ffzQ2u6bwiAUO06ygzU6kT36s2DpqlRxcrKSnjHFdPBEjpOCiugyUT51oCqeesCmn3nvfexuqm9IyqkCadA+6B0oUlMWgsPKaH26lp0jqusvLycv6+rCUT2wrHb2doaGyu/QKOKphlskpnFtcCe+3DHf6I6UxgyBo5oWO0kQjnaryy4YWxi+Gc6QIs+m5PH44tAud+v3ptvHhY/JcrCO/6/o0NEDf7ajypQ+pTXXuMOFHtG57Zts7KykMY0w1jZTQ8W9iH6xL+oomUDy4xAxxUN3b09/S2UZxtJmCAMEY3zpjDuhRdYWIZmT6emdgoNFVtYsOdSSqQcPQrJscllh6wi4j8s4kOHDGaZ/GBxCgVYJkBci2IoDAGyc3J6RUezTnFdvfH66w+8unABxw4axGRGxaDAQOb8tKhCi9o1yayKWp3oXv0h4fco3LFmMC5XiQR7bXaopHwGe9bLfx+MqZGd0mIVQjSZKLSE6fD18WHVIQZ/+1GIlslSK7AWmnAKtFx3wstTCzpqTxUd29d9ZVCLpuoP1LlQPKG1CEFIh/CXH7vu4mmaQVxl6JS9pA1gS8yqtesKp0aP+hczbGZ+7EpXQmnxAcOGDcUlhktD07qk6cqCtGzIPGr1iczly5by1ZuNln8zmVGwZelu70/i4hd4W5hc27NoeZPcRHZ3d+Pv/t/98/szSGOasZS//trkm4q3xrFFYk+AYAHsSxqsiirsyQHaVHtDxs7O7t1ZM1la2B1jwUcL354xHZ2ywytS6Zp161j6/PkMXC1qN4aANcL6RQIyJ/36K9ZQYSbrDgkQGtqRHzVGtOqLL1mzEBg+m40UhxgCa0QLCDGhkImvvoIdKA6Fo9aiCk1qVxqIUGZVVHXSoOoPA3P2MX36oCPsl9m6qRZ2swsl2dcYoO3Viu+3CEFrsLHJE19ltoHpSzl6rHNYJ3ZWi1XwYOCaTHTHzl1omVVHXcwFYhR2SoiWyeKthQkPbWvZhDXhFGgZlNLlyTLVoov2VNGxfS0S6oKW6qo6Z/kMGBUCOzYoSJibe9HR0YGdEiIcO9r5Q/FFNXZKC5pmEDJAkgnjxwkFQ0JJV0orBopdvJjHL3pqb/8ylBYfzBSCUbWn2Lqk6coSW4r56WbGDM+qqk+2y2l+Hqfv3VpETnx3pNvlzXNWPehVZKwID/zeLfGQwI4R2qp+gZIgCAKxIxy86nbhn8zj9KtStw+vevv1tx/oawmCIAiipfE4uVuCIAiCeExpue62pqbWxKQxf7bWwsICdbkDgiAIgmgBtNxnt60tLR0d7KurqysqKrgsHYCHtre3v15YVPGIfqaLIAiCIFRpue4WwOPa2tiYmjYgxkVcW1pWRr6WIAiCaFG0aHdLEARBEH8P6FUpgiAIgtA75G4JgiAIQu88spvJBEEQBPHPgaJbgiAIgtA75G4JgiAIQu+QuyUIgiAIvUPuliAIgiD0DrlbgiAIgtA75G4JgiAIQu+QuyUIgiAIvUPuliAIgiD0DrlbgiAIgtA75G4JgiAIQu+QuyUIgiAIvUPuliAIgiD0DrlbgiAIgtA75G4JgiAIQu+QuyUIgiAIvUPuliAIgiD0DrlbgiAIgtA75G4JgiAIQu+QuyUIgiAIvUPuliAIgiD0DrlbgiAIgtA75G4JgiAIQu+QuyUIgiAIvUPuliAIgiD0DrlbgiAIgtA75G4JgiAIQu+QuyUIgiAIPSMS/R8z3QCTyRQHzwAAAABJRU5ErkJggg=="}}]); \ No newline at end of file diff --git a/assets/js/ac364c7b.c522d82c.js b/assets/js/ac364c7b.c522d82c.js new file mode 100644 index 00000000000..b1b9df1c40f --- /dev/null +++ b/assets/js/ac364c7b.c522d82c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7761],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),m=s(n),u=i,k=m["".concat(o,".").concat(u)]||m[u]||d[u]||r;return n?a.createElement(k,l(l({ref:t},c),{},{components:n})):a.createElement(k,l({ref:t},c))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=u;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[m]="string"==typeof e?e:i,l[1]=p;for(var s=2;s<r;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},63079:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>s});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Matrix Keypad service"},l="MatrixKeypad",p={unversionedId:"api/clients/matrixkeypad",id:"api/clients/matrixkeypad",title:"MatrixKeypad",description:"DeviceScript client for Matrix Keypad service",source:"@site/docs/api/clients/matrixkeypad.md",sourceDirName:"api/clients",slug:"/api/clients/matrixkeypad",permalink:"/devicescript/api/clients/matrixkeypad",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Matrix Keypad service"},sidebar:"tutorialSidebar"},o={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"rows",id:"const:rows",level:3},{value:"columns",id:"const:columns",level:3},{value:"labels",id:"const:labels",level:3},{value:"variant",id:"const:variant",level:3},{value:"Events",id:"events",level:2},{value:"down",id:"down",level:3},{value:"up",id:"up",level:3},{value:"click",id:"click",level:3},{value:"longClick",id:"longclick",level:3}],c={toc:s},m="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"matrixkeypad"},"MatrixKeypad"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A matrix of buttons connected as a keypad"),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { MatrixKeypad } from "@devicescript/core"\n\nconst matrixKeypad = new MatrixKeypad()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The coordinate of the button currently pressed. Keys are zero-indexed from left to right, top to bottom:\n",(0,i.kt)("inlineCode",{parentName:"p"},"row = index / columns"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"column = index % columns"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"r: u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MatrixKeypad } from "@devicescript/core"\n\nconst matrixKeypad = new MatrixKeypad()\n// ...\nmatrixKeypad.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:rows"},"rows"),(0,i.kt)("p",null,"Number of rows in the matrix"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MatrixKeypad } from "@devicescript/core"\n\nconst matrixKeypad = new MatrixKeypad()\n// ...\nconst value = await matrixKeypad.rows.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:columns"},"columns"),(0,i.kt)("p",null,"Number of columns in the matrix"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MatrixKeypad } from "@devicescript/core"\n\nconst matrixKeypad = new MatrixKeypad()\n// ...\nconst value = await matrixKeypad.columns.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:labels"},"labels"),(0,i.kt)("p",null,"The characters printed on the keys if any, in indexing sequence."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"type: ",(0,i.kt)("inlineCode",{parentName:"li"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"li"},"r: z"),")"),(0,i.kt)("li",{parentName:"ul"},"optional: this register may not be implemented"),(0,i.kt)("li",{parentName:"ul"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"The type of physical keypad. If the variant is ",(0,i.kt)("inlineCode",{parentName:"p"},"ElastomerLEDPixel"),"\nand the next service on the device is a ",(0,i.kt)("inlineCode",{parentName:"p"},"LEDPixel")," service, it is considered\nas the service controlling the LED pixel on the keypad."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MatrixKeypad } from "@devicescript/core"\n\nconst matrixKeypad = new MatrixKeypad()\n// ...\nconst value = await matrixKeypad.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h2",{id:"events"},"Events"),(0,i.kt)("h3",{id:"down"},"down"),(0,i.kt)("p",null,"Emitted when a key, at the given index, goes from inactive (",(0,i.kt)("inlineCode",{parentName:"p"},"pressed == 0"),") to active."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"matrixKeypad.down.subscribe(() => {\n\n})\n")),(0,i.kt)("h3",{id:"up"},"up"),(0,i.kt)("p",null,"Emitted when a key, at the given index, goes from active (",(0,i.kt)("inlineCode",{parentName:"p"},"pressed == 1"),") to inactive."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"matrixKeypad.up.subscribe(() => {\n\n})\n")),(0,i.kt)("h3",{id:"click"},"click"),(0,i.kt)("p",null,"Emitted together with ",(0,i.kt)("inlineCode",{parentName:"p"},"up")," when the press time was not longer than 500ms."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"matrixKeypad.click.subscribe(() => {\n\n})\n")),(0,i.kt)("h3",{id:"longclick"},"longClick"),(0,i.kt)("p",null,"Emitted together with ",(0,i.kt)("inlineCode",{parentName:"p"},"up")," when the press time was more than 500ms."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"matrixKeypad.longClick.subscribe(() => {\n\n})\n")),(0,i.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ad7e4376.07c07dd1.js b/assets/js/ad7e4376.07c07dd1.js new file mode 100644 index 00000000000..472c549dc7f --- /dev/null +++ b/assets/js/ad7e4376.07c07dd1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5371],{35318:(e,t,n)=>{n.d(t,{Zo:()=>f,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},f=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,f=o(e,["components","mdxType","originalType","parentName"]),s=p(n),m=i,g=s["".concat(c,".").concat(m)]||s[m]||u[m]||a;return n?r.createElement(g,l(l({ref:t},f),{},{components:n})):r.createElement(g,l({ref:t},f))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=m;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[s]="string"==typeof e?e:i,l[1]=o;for(var p=2;p<a;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},12576:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Traffic Light service"},l="TrafficLight",o={unversionedId:"api/clients/trafficlight",id:"api/clients/trafficlight",title:"TrafficLight",description:"DeviceScript client for Traffic Light service",source:"@site/docs/api/clients/trafficlight.md",sourceDirName:"api/clients",slug:"/api/clients/trafficlight",permalink:"/devicescript/api/clients/trafficlight",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Traffic Light service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"red",id:"rw:red",level:3},{value:"yellow",id:"rw:yellow",level:3},{value:"green",id:"rw:green",level:3}],f={toc:p},s="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(s,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"trafficlight"},"TrafficLight"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"Controls a mini traffic with a red, orange and green LED."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:red"},"red"),(0,i.kt)("p",null,"The on/off state of the red light."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n// ...\nconst value = await trafficLight.red.read()\nawait trafficLight.red.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n// ...\ntrafficLight.red.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:yellow"},"yellow"),(0,i.kt)("p",null,"The on/off state of the yellow light."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n// ...\nconst value = await trafficLight.yellow.read()\nawait trafficLight.yellow.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n// ...\ntrafficLight.yellow.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:green"},"green"),(0,i.kt)("p",null,"The on/off state of the green light."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n// ...\nconst value = await trafficLight.green.read()\nawait trafficLight.green.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { TrafficLight } from "@devicescript/core"\n\nconst trafficLight = new TrafficLight()\n// ...\ntrafficLight.green.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/aec6ee96.b2b87a39.js b/assets/js/aec6ee96.b2b87a39.js new file mode 100644 index 00000000000..7aa815108f4 --- /dev/null +++ b/assets/js/aec6ee96.b2b87a39.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7150],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var u=r.createContext({}),p=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(u.Provider,{value:t},e.children)},s="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,u=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),s=p(n),d=i,f=s["".concat(u,".").concat(d)]||s[d]||m[d]||a;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[s]="string"==typeof e?e:i,l[1]=o;for(var p=2;p<a;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},10691:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Buzzer service"},l="Buzzer",o={unversionedId:"api/clients/buzzer",id:"api/clients/buzzer",title:"Buzzer",description:"DeviceScript client for Buzzer service",source:"@site/docs/api/clients/buzzer.md",sourceDirName:"api/clients",slug:"/api/clients/buzzer",permalink:"/devicescript/api/clients/buzzer",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Buzzer service"},sidebar:"tutorialSidebar"},u={},p=[{value:"Commands",id:"commands",level:2},{value:"playNote",id:"playnote",level:3},{value:"Registers",id:"registers",level:2},{value:"intensity",id:"rw:intensity",level:3}],c={toc:p},s="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(s,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"buzzer"},"Buzzer"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A simple buzzer."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Buzzer } from "@devicescript/core"\n\nconst buzzer = new Buzzer()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"playnote"},"playNote"),(0,i.kt)("p",null,"Play a note at the given frequency and volume."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"buzzer.playNote(frequency: number, volume: number, duration: number): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:intensity"},"intensity"),(0,i.kt)("p",null,"The volume (duty cycle) of the buzzer."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Buzzer } from "@devicescript/core"\n\nconst buzzer = new Buzzer()\n// ...\nconst value = await buzzer.intensity.read()\nawait buzzer.intensity.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Buzzer } from "@devicescript/core"\n\nconst buzzer = new Buzzer()\n// ...\nbuzzer.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/afcacdd7.08ce025c.js b/assets/js/afcacdd7.08ce025c.js new file mode 100644 index 00000000000..d540265d7b2 --- /dev/null +++ b/assets/js/afcacdd7.08ce025c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3154],{35318:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>h});var n=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function o(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=n.createContext({}),l=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=l(e.components);return n.createElement(c.Provider,{value:r},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},u=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=l(t),u=a,h=d["".concat(c,".").concat(u)]||d[u]||m[u]||i;return t?n.createElement(h,s(s({ref:r},p),{},{components:t})):n.createElement(h,s({ref:r},p))}));function h(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var i=t.length,s=new Array(i);s[0]=u;var o={};for(var c in r)hasOwnProperty.call(r,c)&&(o[c]=r[c]);o.originalType=e,o[d]="string"==typeof e?e:a,s[1]=o;for(var l=2;l<i;l++)s[l]=t[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,t)}u.displayName="MDXCreateElement"},87676:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var n=t(25773),a=(t(27378),t(35318));const i={sidebar_position:2,title:"Display"},s="Display",o={unversionedId:"developer/graphics/display",id:"developer/graphics/display",title:"Display",description:"The Display",source:"@site/docs/developer/graphics/display.mdx",sourceDirName:"developer/graphics",slug:"/developer/graphics/display",permalink:"/devicescript/developer/graphics/display",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"Display"},sidebar:"tutorialSidebar",previous:{title:"Image",permalink:"/devicescript/developer/graphics/image"},next:{title:"JSX/TSX",permalink:"/devicescript/developer/jsx"}},c={},l=[{value:"Indexed screen",id:"indexed-screen",level:2},{value:"Character screen",id:"character-screen",level:2},{value:"Dot matrix",id:"dot-matrix",level:2}],p={toc:l},d="wrapper";function m(e){let{components:r,...t}=e;return(0,a.kt)(d,(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"display"},"Display"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/blob/main/packages/graphics/src/display.ts"},"Display"),"\ninterface provides an abstraction over a small screen. The ",(0,a.kt)("inlineCode",{parentName:"p"},"Display")," interface is implemented\nfor various hardware peripherical and can be used with various services."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/api/drivers/ssd1306"},"SSD1306"),", OLED monochrome, I2C"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/api/drivers/st7789"},"ST7789, ST7735, ILI9163"),", LCD color, SPI"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/api/drivers/uc8151"},"UC8151"),", eInk monochrome, SPI")),(0,a.kt)("admonition",{title:"I8080 not supported",type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"The drivers use SPI or I2C. The parralel interface (I8080) is not supported at the moment.")),(0,a.kt)("h2",{id:"indexed-screen"},"Indexed screen"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"startIndexedScreen")," returns a local client for the screen service.\nMost importantly it wraps the native driver to enable simulation of the screen\non the simulated device (simulation does not work on hardware device as the communication channel is too slow)."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/indexedscreen.ts"},"Source"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SSD1306Driver, startIndexedScreen } from "@devicescript/drivers"\n\nconst display = await startIndexedScreen(\n // implements Display\n new SSD1306Driver({ width: 128, height: 64, devAddr: 0x3c })\n)\ndisplay.image.print(`Hello world!`, 3, 10)\nawait display.show()\n')),(0,a.kt)("h2",{id:"character-screen"},"Character screen"),(0,a.kt)("p",null,"The user sets a message on the character screen and it will be rendered on the screen.\nUsing the service is compatible with the simulator."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Service: ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/characterscreen/"},"character screen")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/characterscreen.ts"},"Source"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SSD1306Driver, startCharacterScreen } from "@devicescript/drivers"\n\nconst screen = await startCharacterScreen(\n new SSD1306Driver({ width: 128, height: 64 })\n)\nawait screen.message.write(`hello\nworld`)\n')),(0,a.kt)("h2",{id:"dot-matrix"},"Dot matrix"),(0,a.kt)("p",null,"The screen emulates a dot matrix of monochrome LEDs."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Service: ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/dotmatrix/"},"dot matrix")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/dotmatrix.ts"},"Source"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SSD1306Driver, startDotMatrix } from "@devicescript/drivers"\nimport { img } from "@devicescript/graphics"\n\nconst dots = await startDotMatrix(\n new SSD1306Driver({\n width: 128,\n height: 64,\n devAddr: 0x3c,\n }),\n {\n rows: 5,\n columns: 5,\n }\n)\nawait dots.writeImage(img`# # . # #\n# # . # #\n. # # # .\n. # # # .\n# . # . .`)\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b0272dca.99845c7a.js b/assets/js/b0272dca.99845c7a.js new file mode 100644 index 00000000000..84486969245 --- /dev/null +++ b/assets/js/b0272dca.99845c7a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6209],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>k});var i=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,i,a=function(e,t){if(null==e)return{};var n,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=i.createContext({}),o=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=o(e.components);return i.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,p=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),c=o(n),d=a,k=c["".concat(p,".").concat(d)]||c[d]||u[d]||r;return n?i.createElement(k,l(l({ref:t},m),{},{components:n})):i.createElement(k,l({ref:t},m))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,l=new Array(r);l[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[c]="string"==typeof e?e:a,l[1]=s;for(var o=2;o<r;o++)l[o]=n[o];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}d.displayName="MDXCreateElement"},92722:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>o});var i=n(25773),a=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for 7-segment display service"},l="SevenSegmentDisplay",s={unversionedId:"api/clients/sevensegmentdisplay",id:"api/clients/sevensegmentdisplay",title:"SevenSegmentDisplay",description:"DeviceScript client for 7-segment display service",source:"@site/docs/api/clients/sevensegmentdisplay.md",sourceDirName:"api/clients",slug:"/api/clients/sevensegmentdisplay",permalink:"/devicescript/api/clients/sevensegmentdisplay",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for 7-segment display service"},sidebar:"tutorialSidebar"},p={},o=[{value:"Commands",id:"commands",level:2},{value:"setNumber",id:"setnumber",level:3},{value:"Registers",id:"registers",level:2},{value:"intensity",id:"rw:intensity",level:3},{value:"doubleDots",id:"rw:doubleDots",level:3},{value:"digitCount",id:"const:digitCount",level:3},{value:"decimalPoint",id:"const:decimalPoint",level:3}],m={toc:o},c="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(c,(0,i.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"sevensegmentdisplay"},"SevenSegmentDisplay"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A 7-segment numeric display, with one or more digits."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"setnumber"},"setNumber"),(0,a.kt)("p",null,"Shows the number on the screen using the decimal dot if available."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"sevenSegmentDisplay.setNumber(value: number): Promise<void>\n")),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:intensity"},"intensity"),(0,a.kt)("p",null,"Controls the brightness of the LEDs. ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," means off."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n// ...\nconst value = await sevenSegmentDisplay.intensity.read()\nawait sevenSegmentDisplay.intensity.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n// ...\nsevenSegmentDisplay.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:doubleDots"},"doubleDots"),(0,a.kt)("p",null,"Turn on or off the column LEDs (separating minutes from hours, etc.) in of the segment.\nIf the column LEDs is not supported, the value remains false."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n// ...\nconst value = await sevenSegmentDisplay.doubleDots.read()\nawait sevenSegmentDisplay.doubleDots.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n// ...\nsevenSegmentDisplay.doubleDots.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:digitCount"},"digitCount"),(0,a.kt)("p",null,"The number of digits available on the display."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n// ...\nconst value = await sevenSegmentDisplay.digitCount.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:decimalPoint"},"decimalPoint"),(0,a.kt)("p",null,"True if decimal points are available (on all digits)."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SevenSegmentDisplay } from "@devicescript/core"\n\nconst sevenSegmentDisplay = new SevenSegmentDisplay()\n// ...\nconst value = await sevenSegmentDisplay.decimalPoint.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b18f40c0.ee3f556b.js b/assets/js/b18f40c0.ee3f556b.js new file mode 100644 index 00000000000..cf2f185545d --- /dev/null +++ b/assets/js/b18f40c0.ee3f556b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3713],{35318:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=n.createContext({}),c=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},p=function(e){var r=c(e.components);return n.createElement(l.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},v=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(t),v=i,m=d["".concat(l,".").concat(v)]||d[v]||u[v]||a;return t?n.createElement(m,o(o({ref:r},p),{},{components:t})):n.createElement(m,o({ref:r},p))}));function m(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=v;var s={};for(var l in r)hasOwnProperty.call(r,l)&&(s[l]=r[l]);s.originalType=e,s[d]="string"==typeof e?e:i,o[1]=s;for(var c=2;c<a;c++)o[c]=t[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}v.displayName="MDXCreateElement"},45549:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=t(25773),i=(t(27378),t(35318));const a={title:"SSD1306"},o="SSD1306",s={unversionedId:"api/drivers/ssd1306",id:"api/drivers/ssd1306",title:"SSD1306",description:"Driver for SSD1306 OLED screen at I2C address 0x3c (or 0x3d).",source:"@site/docs/api/drivers/ssd1306.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/ssd1306",permalink:"/devicescript/api/drivers/ssd1306",draft:!1,tags:[],version:"current",frontMatter:{title:"SSD1306"},sidebar:"tutorialSidebar",previous:{title:"Sound Level",permalink:"/devicescript/api/drivers/soundlevel"},next:{title:"ST7735, ILI9163, ST7789",permalink:"/devicescript/api/drivers/st7789"}},l={},c=[{value:"Hardware configuration",id:"hardware-configuration",level:2},{value:"Display",id:"display",level:2},{value:"Driver",id:"driver",level:2}],p={toc:c},d="wrapper";function u(e){let{components:r,...a}=e;return(0,i.kt)(d,(0,n.Z)({},p,a,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ssd1306"},"SSD1306"),(0,i.kt)("p",null,"Driver for SSD1306 OLED screen at I2C address ",(0,i.kt)("inlineCode",{parentName:"p"},"0x3c")," (or ",(0,i.kt)("inlineCode",{parentName:"p"},"0x3d"),")."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SSD1306Driver } from "@devicescript/drivers"\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://www.digikey.com/htmldatasheets/production/2047793/0/0/1/ssd1306.html"},"Datasheet"))),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Photo of a SSD1306 screen",src:t(34739).Z,width:"776",height:"688"})),(0,i.kt)("h2",{id:"hardware-configuration"},"Hardware configuration"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Configure the I2C connection through the ",(0,i.kt)("a",{parentName:"li",href:"/developer/board-configuration"},"board configuration")),(0,i.kt)("li",{parentName:"ul"},"Check that you are using the proper I2C address")),(0,i.kt)("h2",{id:"display"},"Display"),(0,i.kt)("p",null,"The driver implements the ",(0,i.kt)("a",{parentName:"p",href:"/developer/graphics/display"},"Display")," interface and can be used as various services.\nUsing the driver through services provides a better simulation experience."),(0,i.kt)("h2",{id:"driver"},"Driver"),(0,i.kt)("p",null,"You can also use the SS1306 driver directly. However, it will not be usable from a simulator."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/ssd1306.ts"},"Source"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SSD1306Driver } from "@devicescript/drivers"\n\nconst ssd = new SSD1306Driver({ width: 64, height: 48 })\nawait ssd.init()\nssd.image.print("Hello world!", 3, 10)\nawait ssd.show()\n')))}u.isMDXComponent=!0},34739:(e,r,t)=>{t.d(r,{Z:()=>n});const n=t.p+"assets/images/ssd1306-37a92c83c596d3a6493ef8358ad94ed5.png"}}]); \ No newline at end of file diff --git a/assets/js/b2987995.e1fb0571.js b/assets/js/b2987995.e1fb0571.js new file mode 100644 index 00000000000..739ee09d0d4 --- /dev/null +++ b/assets/js/b2987995.e1fb0571.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5048],{35318:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),c=p(r),m=i,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||a;return r?n.createElement(f,l(l({ref:t},d),{},{components:r})):n.createElement(f,l({ref:t},d))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,l=new Array(a);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:i,l[1]=o;for(var p=2;p<a;p++)l[p]=r[p];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},61749:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={title:"LEDs"},l="LEDs",o={unversionedId:"developer/leds/index",id:"developer/leds/index",title:"LEDs",description:"Controlling strips of programmable LEDs can be done through the Led client.",source:"@site/docs/developer/leds/index.mdx",sourceDirName:"developer/leds",slug:"/developer/leds/",permalink:"/devicescript/developer/leds/",draft:!1,tags:[],version:"current",frontMatter:{title:"LEDs"},sidebar:"tutorialSidebar",previous:{title:"JSX/TSX",permalink:"/devicescript/developer/jsx"},next:{title:"Display",permalink:"/devicescript/developer/leds/display"}},s={},p=[{value:"Driver",id:"driver",level:2},{value:"Simulation and long strips (> 64 LEDs)",id:"simulation-and-long-strips--64-leds",level:2},{value:"PixelBuffer and show",id:"pixelbuffer-and-show",level:2},{value:"showAll",id:"showall",level:3},{value:"LED Display",id:"led-display",level:2}],d={toc:p},c="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(c,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"leds"},"LEDs"),(0,i.kt)("p",null,"Controlling strips of programmable LEDs can be done through the ",(0,i.kt)("inlineCode",{parentName:"p"},"Led")," client."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"This client requires to import the ",(0,i.kt)("inlineCode",{parentName:"strong"},"@devicescript/runtime")," to get all the functionalities.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\n// highlight-next-line\nimport "@devicescript/runtime"\n\nconst led = new Led()\n')),(0,i.kt)("h2",{id:"driver"},"Driver"),(0,i.kt)("p",null,"You can start a driver for WS2812 or AP102 using ",(0,i.kt)("a",{parentName:"p",href:"./leds/driver"},"startLed"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedVariant, LedStripLightType } from "@devicescript/core"\nimport { startLed } from "@devicescript/drivers"\nimport { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { spi } from "@devicescript/spi"\n\n// highlight-start\nconst led = await startLed({\n length: 32,\n variant: LedVariant.Ring,\n hwConfig: {\n type: LedStripLightType.SK9822,\n pinClk: pins.A1_D1,\n pinData: pins.A0_D0,\n spi: spi,\n },\n})\n// highlight-end\n')),(0,i.kt)("h2",{id:"simulation-and-long-strips--64-leds"},"Simulation and long strips (> 64 LEDs)"),(0,i.kt)("p",null,"For short LED strips, 64 LEDs or less, DeviceScript provides full simulation and device twin\nfor hardware and simulated devices."),(0,i.kt)("p",null,"For strips longer than 64 LEDs, the simulator device will work but the hardware device twin will\nnot work anymore. This is a simple limitation that the data overflows the packets used in Jacdac."),(0,i.kt)("h2",{id:"pixelbuffer-and-show"},"PixelBuffer and show"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"Led")," client has a ",(0,i.kt)("a",{parentName:"p",href:"/api/runtime/pixelbuffer"},"pixel buffer"),", a 1D vector of colors,\nthat can be used to perform color operations, and a ",(0,i.kt)("inlineCode",{parentName:"p"},"show")," function to render the buffer to the hardware."),(0,i.kt)("p",null,"A typical LED program would then look like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStripLightType } from "@devicescript/core"\nimport { startLed } from "@devicescript/drivers"\nimport { fillSolid } from "@devicescript/runtime"\nimport { pins } from "@dsboard/adafruit_qt_py_c3"\n\nconst led = await startLed({\n length: 32,\n hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: pins.A0_D0 },\n})\n\n// retreive pixel buffer from led\nconst pixels = await led.buffer()\n// do operations on pixels, like setting LEDs to green\nfillSolid(pixels, 0x00ee00)\n// send colors to hardware\nawait led.show()\n')),(0,i.kt)("h3",{id:"showall"},"showAll"),(0,i.kt)("p",null,"A convenience function ",(0,i.kt)("inlineCode",{parentName:"p"},"showAll")," is provided to set the color of all LEDs."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Led } from "@devicescript/core"\nimport "@devicescript/runtime"\n\nconst led = new Led()\n// highlight-next-line\nawait led.showAll(0x00ee00)\n')),(0,i.kt)("h2",{id:"led-display"},"LED Display"),(0,i.kt)("p",null,"You can mount a LED matrix as a ",(0,i.kt)("a",{parentName:"p",href:"./leds/display"},"display"),".\nThis can be helpful for matrix-shaped LEDs."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/esp32_c3fh4_rgb"\nimport { LedStripLightType, LedVariant } from "@devicescript/core"\nimport { startLed } from "@devicescript/drivers"\nimport { startLedDisplay } from "@devicescript/runtime"\n\nconst led = await startLed({\n length: 25,\n columns: 5,\n variant: LedVariant.Matrix,\n hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: pins.LEDS },\n})\n\n// highlight-next-line\nconst display = await startLedDisplay(led)\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b342ea0c.dc1c870a.js b/assets/js/b342ea0c.dc1c870a.js new file mode 100644 index 00000000000..f3b85bab1fd --- /dev/null +++ b/assets/js/b342ea0c.dc1c870a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8601],{35318:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>m});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=r.createContext({}),u=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=u(e.components);return r.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=u(t),f=i,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||a;return t?r.createElement(m,l(l({ref:n},s),{},{components:t})):r.createElement(m,l({ref:n},s))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,l=new Array(a);l[0]=f;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[c]="string"==typeof e?e:i,l[1]=o;for(var u=2;u<a;u++)l[u]=t[u];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}f.displayName="MDXCreateElement"},1265:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>u});var r=t(25773),i=(t(27378),t(35318));const a={title:"Bytecode",sidebar_position:100},l=void 0,o={unversionedId:"language/bytecode",id:"language/bytecode",title:"Bytecode",description:"{@import ../../../bytecode/bytecode.md}",source:"@site/docs/language/bytecode.mdx",sourceDirName:"language",slug:"/language/bytecode",permalink:"/devicescript/language/bytecode",draft:!1,tags:[],version:"current",sidebarPosition:100,frontMatter:{title:"Bytecode",sidebar_position:100},sidebar:"tutorialSidebar",previous:{title:"Runtime implementation",permalink:"/devicescript/language/runtime"},next:{title:"Other differences with JavaScript",permalink:"/devicescript/language/devicescript-vs-javascript"}},p={},u=[{value:"Format Constants",id:"format-constants",level:2},{value:"Ops",id:"ops",level:2},{value:"Control flow",id:"control-flow",level:3},{value:"Variables",id:"variables",level:3},{value:"Field access",id:"field-access",level:3},{value:"Objects",id:"objects",level:3},{value:"Statics",id:"statics",level:3},{value:"Misc",id:"misc",level:3},{value:"Booleans",id:"booleans",level:3},{value:"Math operations",id:"math-operations",level:3},{value:"To be removed (soon)",id:"to-be-removed-soon",level:3},{value:"Enum: StrIdx",id:"enum-stridx",level:2},{value:"Enum: OpCall",id:"enum-opcall",level:2},{value:"Enum: BytecodeFlag",id:"enum-bytecodeflag",level:2},{value:"Enum: FunctionFlag",id:"enum-functionflag",level:2},{value:"Enum: NumFmt",id:"enum-numfmt",level:2},{value:"Enum: NumFmt_Special",id:"enum-numfmt_special",level:2},{value:"Enum: PacketSpec_Code",id:"enum-packetspec_code",level:2},{value:"Enum: ServiceSpec_Flag",id:"enum-servicespec_flag",level:2},{value:"Enum: PacketSpec_Flag",id:"enum-packetspec_flag",level:2},{value:"Enum: FieldSpec_Flag",id:"enum-fieldspec_flag",level:2},{value:"Enum: Object_Type",id:"enum-object_type",level:2},{value:"Object_Types only used in static type info",id:"object_types-only-used-in-static-type-info",level:3},{value:"Enum: BuiltIn_Object",id:"enum-builtin_object",level:2},{value:"Enum: BuiltIn_String",id:"enum-builtin_string",level:2}],s={toc:u},c="wrapper";function d(e){let{components:n,...t}=e;return(0,i.kt)(c,(0,r.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"devicescript-bytecode-spec"},"DeviceScript bytecode spec"),(0,i.kt)("p",null,"This file documents bytecode format for DeviceScript.\nA ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/blob/main/runtime/devicescript/devs_bytecode.h"},"C header file"),"\nand a ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/blob/main/compiler/src/bytecode.ts"},"TypeScript file")," are generated from it.\nAdditional structures are defined in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/blob/main/runtime/devicescript/devs_format.h"},"devs_format.h"),"."),(0,i.kt)("p",null,"A DeviceScript bytecode file contains magic and version numbers followed by a number of binary sections\ndefining functions, various literals (floats, ASCII strings, Unicode strings, buffers),\nJacdac service specifications, and runtime configuration (",(0,i.kt)("inlineCode",{parentName:"p"},"configureHardware()")," and built-in servers)."),(0,i.kt)("p",null,"Functions are sequences of opcodes defined below.\nOpcodes are divided into expressions (with return type) which do not modify state,\nand statements (no return type; ",(0,i.kt)("inlineCode",{parentName:"p"},"ret_val()")," expression is used to retrive the logical\nresult of a last statement).\nMany opcodes (both expressions and statements) can also throw an exception."),(0,i.kt)("p",null,"For a more highlevel description of runtime and bytecode, see ",(0,i.kt)("a",{parentName:"p",href:"/language/runtime"},"Runtime implementation page"),"."),(0,i.kt)("h2",{id:"format-constants"},"Format Constants"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'img_version_major = 2\nimg_version_minor = 15\nimg_version_patch = 6\nimg_version = $version\nmagic0 = 0x53766544 // "DevS"\nmagic1 = 0xf1296e0a\nnum_img_sections = 10\nfix_header_size = 32\nsection_header_size = 8\nfunction_header_size = 16\nascii_header_size = 2\nutf8_header_size = 4\nutf8_table_shift = 4\nbinary_size_align = 32\nmax_stack_depth = 16\nmax_call_depth = 100\ndirect_const_op = 0x80\ndirect_const_offset = 16\nfirst_multibyte_int = 0xf8\nfirst_non_opcode = 0x10000\nfirst_builtin_function = 50000\nmax_args_short_call = 8\nservice_spec_header_size = 16\nservice_spec_packet_size = 8\nservice_spec_field_size = 4\nrole_bits = 15\n')),(0,i.kt)("h2",{id:"ops"},"Ops"),(0,i.kt)("h3",{id:"control-flow"},"Control flow"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"call0(func) = 2 // CALL func()\ncall1(func, v0) = 3 // CALL func(v0)\ncall2(func, v0, v1) = 4 // CALL func(v0, v1)\ncall3(func, v0, v1, v2) = 5 // CALL func(v0, v1, v2)\ncall4(func, v0, v1, v2, v3) = 6 // CALL func(v0, v1, v2, v3)\ncall5(func, v0, v1, v2, v3, v4) = 7 // CALL func(v0, v1, v2, v3, v4)\ncall6(func, v0, v1, v2, v3, v4, v5) = 8 // CALL func(v0, v1, v2, v3, v4, v5)\ncall7(func, v0, v1, v2, v3, v4, v5, v6) = 9 // CALL func(v0, v1, v2, v3, v4, v5, v6)\ncall8(func, v0, v1, v2, v3, v4, v5, v6, v7) = 10 // CALL func(v0, v1, v2, v3, v4, v5, v6, v7)\n")),(0,i.kt)("p",null,"Call a function with given number of parameters."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"call_array(func, args) = 79 // CALL func(...args)\n")),(0,i.kt)("p",null,"Passes arguments to a function as an array. The array can be at most ",(0,i.kt)("inlineCode",{parentName:"p"},"max_stack_depth - 1")," elements long."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"final return(value) = 12\n\nfinal jmp(*jmpoffset) = 13 // JMP jmpoffset\n\njmp_z(*jmpoffset, x) = 14 // JMP jmpoffset IF NOT x\n")),(0,i.kt)("p",null,"Jump if condition is false."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"jmp_ret_val_z(*jmpoffset) = 78 // JMP jmpoffset IF ret_val is nullish\n")),(0,i.kt)("p",null,"Used in compilation of ",(0,i.kt)("inlineCode",{parentName:"p"},"?."),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"try(*jmpoffset) = 80 // TRY jmpoffset\n")),(0,i.kt)("p",null,"Start try-catch block - catch/finally handler is at the jmpoffset."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"final end_try(*jmpoffset) = 81\n")),(0,i.kt)("p",null,"Try block has to end with this. jmpoffset is for continuation code."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"catch() = 82\n")),(0,i.kt)("p",null,"Has to be the first opcode in the catch handler. Causes error elsewhere.\nIf value throw is JMP rethrows immediately."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"finally() = 83\n")),(0,i.kt)("p",null,"Has to be the first opcode in the finally handler.\nFinally block should be followed by storing exception value in a local\nand finish with ",(0,i.kt)("inlineCode",{parentName:"p"},"re_throw")," of the exception.\n",(0,i.kt)("inlineCode",{parentName:"p"},"retval")," set to ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," when block executed not due to an exception."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"final throw(value) = 84\n")),(0,i.kt)("p",null,"Throw an exception."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"final re_throw(value) = 85\n")),(0,i.kt)("p",null,"Throw an exception without setting the ",(0,i.kt)("inlineCode",{parentName:"p"},"__stack__")," field.\nDoes nothing if ",(0,i.kt)("inlineCode",{parentName:"p"},"value")," is ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"final throw_jmp(*jmpoffset, level) = 86\n")),(0,i.kt)("p",null,"Jump to given offset popping ",(0,i.kt)("inlineCode",{parentName:"p"},"level")," try blocks, activating the finally blocks on the way."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"debugger() = 87\n")),(0,i.kt)("p",null,"Trigger breakpoint when debugger connected. No-op otherwise."),(0,i.kt)("h3",{id:"variables"},"Variables"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"store_local(*local_idx, value) = 17 // local_idx := value\n\nstore_global(*global_idx, value) = 18 // global_idx := value\n\nstore_buffer(buffer, numfmt, offset, value) = 19\n\nload_local(*local_idx): any = 21\n\nload_global(*global_idx): any = 22\n\nstore_closure(*local_clo_idx, levels, value) = 73\n\nload_closure(*local_clo_idx, levels): any = 74\n\nmake_closure(*func_idx): function = 75 // CLOSURE(func_idx)\n\nstore_ret_val(x) = 93 // ret_val := x\n")),(0,i.kt)("h3",{id:"field-access"},"Field access"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"index(object, idx): any = 24 // object[idx]\n")),(0,i.kt)("p",null,"Read named field or sequence member (depending on type of idx)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"index_set(object, index, value) = 25 // object[index] := value\n")),(0,i.kt)("p",null,"Write named field or sequence member (depending on type of idx)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"index_delete(object, index) = 11 // delete object[index]\n")),(0,i.kt)("p",null,"Remove a named field from an object."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"builtin_field(*builtin_idx, obj): any = 26 // {swap}obj.builtin_idx\n")),(0,i.kt)("p",null,"Shorthand to ",(0,i.kt)("inlineCode",{parentName:"p"},"index(obj, static_builtin_string(builtin_idx))")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"ascii_field(*ascii_idx, obj): any = 27 // {swap}obj.ascii_idx\n")),(0,i.kt)("p",null,"Shorthand to ",(0,i.kt)("inlineCode",{parentName:"p"},"index(obj, static_ascii_string(ascii_idx))")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"utf8_field(*utf8_idx, obj): any = 28 // {swap}obj.utf8_idx\n")),(0,i.kt)("p",null,"Shorthand to ",(0,i.kt)("inlineCode",{parentName:"p"},"index(obj, static_utf8_string(utf8_idx))")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun math_field(*builtin_idx): any = 29 // Math.builtin_idx\n\nfun ds_field(*builtin_idx): any = 30 // ds.builtin_idx\n\nfun object_field(*builtin_idx): any = 16 // Object.builtin_idx\n\nfun new(func): function = 88 // new func\n\nfun bind(func, obj): function = 15 // func.bind(obj)\n")),(0,i.kt)("h3",{id:"objects"},"Objects"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"alloc_map() = 31\n\nalloc_array(initial_size) = 32\n\nalloc_buffer(size) = 33\n")),(0,i.kt)("h3",{id:"statics"},"Statics"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun static_spec_proto(*spec_idx): any = 34 // spec_idx.prototype\n\nfun static_buffer(*buffer_idx): buffer = 35\n\nfun static_builtin_string(*builtin_idx): string = 36\n\nfun static_ascii_string(*ascii_idx): string = 37\n\nfun static_utf8_string(*utf8_idx): string = 38\n\nfun static_function(*func_idx): function = 39\n\nfun static_spec(*spec_idx): any = 94\n\nfun literal(*value): number = 40\n\nfun literal_f64(*f64_idx): number = 41\n\nfun builtin_object(*builtin_object): number = 1\n")),(0,i.kt)("h3",{id:"misc"},"Misc"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"removed_42() = 42\n\nload_buffer(buffer, numfmt, offset): number = 43\n\nret_val(): any = 44\n")),(0,i.kt)("p",null,"Return value of query register, call, etc."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun typeof(object): number = 45\n")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"Object_Type")," enum."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun typeof_str(object): number = 76\n")),(0,i.kt)("p",null,"Returns JS-compatible string."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun undefined(): null = 46 // undefined\n")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," value."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun null(): null = 90 // null\n")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," value."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun is_undefined(x): bool = 47\n")),(0,i.kt)("p",null,"Check if object is exactly ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun instance_of(obj, cls): bool = 89\n")),(0,i.kt)("p",null,"Check if ",(0,i.kt)("inlineCode",{parentName:"p"},"obj")," has ",(0,i.kt)("inlineCode",{parentName:"p"},"cls.prototype")," in its prototype chain."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun is_nullish(x): bool = 72\n")),(0,i.kt)("p",null,"Check if value is precisely ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),"."),(0,i.kt)("h3",{id:"booleans"},"Booleans"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun true(): bool = 48\n\nfun false(): bool = 49\n\nfun to_bool(x): bool = 50 // !!x\n")),(0,i.kt)("h3",{id:"math-operations"},"Math operations"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun nan(): number = 51\n\nfun inf(): number = 20\n\nfun abs(x): number = 52\n\nfun bit_not(x): number = 53 // ~x\n\nfun is_nan(x): bool = 54\n\nfun neg(x): number = 55 // -x\n\nfun uplus(x): number = 23 // +x\n\nfun not(x): bool = 56 // !x\n\nfun to_int(x): number = 57\n")),(0,i.kt)("p",null,"Same as ",(0,i.kt)("inlineCode",{parentName:"p"},"x | 0"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun add(x, y): number = 58 // x + y\n")),(0,i.kt)("p",null,"Note that this also works on strings, etc."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fun sub(x, y): number = 59 // x - y\n\nfun mul(x, y): number = 60 // x * y\n\nfun div(x, y): number = 61 // x / y\n\nfun bit_and(x, y): number = 62 // x & y\n\nfun bit_or(x, y): number = 63 // x | y\n\nfun bit_xor(x, y): number = 64 // x ^ y\n\nfun shift_left(x, y): number = 65 // x << y\n\nfun shift_right(x, y): number = 66 // x >> y\n\nfun shift_right_unsigned(x, y): number = 67 // x >>> y\n\nfun eq(x, y): bool = 68 // x === y\n\nfun le(x, y): bool = 69 // x <= y\n\nfun lt(x, y): bool = 70 // x < y\n\nfun ne(x, y): bool = 71 // x !== y\n\nfun approx_eq(x, y): bool = 91 // x == y\n\nfun approx_ne(x, y): bool = 92 // x != y\n")),(0,i.kt)("h3",{id:"to-be-removed-soon"},"To be removed (soon)"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"removed_77() = 77\n")),(0,i.kt)("h2",{id:"enum-stridx"},"Enum: StrIdx"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"buffer = 0\nbuiltin = 1\nascii = 2\nutf8 = 3\n_shift = 14\n")),(0,i.kt)("h2",{id:"enum-opcall"},"Enum: OpCall"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"sync = 0\n")),(0,i.kt)("p",null,"Regular call. Unused."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"bg = 1\n")),(0,i.kt)("p",null,"Always start new fiber."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"bg_max1 = 2\n")),(0,i.kt)("p",null,"Start new fiber unless one is already running."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"bg_max1_pend1 = 3\n")),(0,i.kt)("p",null,"If fiber is already running, set a flag for it to be restarted when it finishes.\nOtherwise, start new fiber."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"bg_max1_replace = 4\n")),(0,i.kt)("p",null,"Start new fiber. If it's already running, replace it."),(0,i.kt)("h2",{id:"enum-bytecodeflag"},"Enum: BytecodeFlag"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"num_args_mask = 0xf\nis_stmt = 0x10\ntakes_number = 0x20\nis_stateless = 0x40 // fun modifier - only valid when !is_stmt\nis_final_stmt = 0x40 // final modifier - only valid when is_stmt\n")),(0,i.kt)("h2",{id:"enum-functionflag"},"Enum: FunctionFlag"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"needs_this = 0x01\nis_ctor = 0x02\nhas_rest_arg = 0x04\n")),(0,i.kt)("h2",{id:"enum-numfmt"},"Enum: NumFmt"),(0,i.kt)("p",null,"Size in bits is: ",(0,i.kt)("inlineCode",{parentName:"p"},"8 << (fmt & 0b11)"),".\nFormat is ",(0,i.kt)("inlineCode",{parentName:"p"},'["u", "i", "f", "reserved"](fmt >> 2)')),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"U8 = 0b0000\nU16 = 0b0001\nU32 = 0b0010\nU64 = 0b0011\nI8 = 0b0100\nI16 = 0b0101\nI32 = 0b0110\nI64 = 0b0111\nF8 = 0b1000 // not supported\nF16 = 0b1001 // not supported\nF32 = 0b1010\nF64 = 0b1011\nSpecial = 0b1100\n")),(0,i.kt)("h2",{id:"enum-numfmt_special"},"Enum: NumFmt_Special"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"empty = 0\nbytes = 1\nstring = 2\nstring0 = 3\nbool = 4\npipe = 5\npipe_port = 6\n")),(0,i.kt)("h2",{id:"enum-packetspec_code"},"Enum: PacketSpec_Code"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"register = 0x1000\nevent = 0x8000\ncommand = 0x0000\nreport = 0x2000\nMASK = 0xf000\n")),(0,i.kt)("h2",{id:"enum-servicespec_flag"},"Enum: ServiceSpec_Flag"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"derive_mask = 0x000f\nderive_base = 0x0000\nderive_sensor = 0x0001\nderive_last = 0x0001\n")),(0,i.kt)("h2",{id:"enum-packetspec_flag"},"Enum: PacketSpec_Flag"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"multi_field = 0x01\n")),(0,i.kt)("h2",{id:"enum-fieldspec_flag"},"Enum: FieldSpec_Flag"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"is_bytes = 0x01\nstarts_repeats = 0x02\n")),(0,i.kt)("h2",{id:"enum-object_type"},"Enum: Object_Type"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"undefined = 0\n")),(0,i.kt)("p",null,"Only the ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," value."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"number = 1\n")),(0,i.kt)("p",null,"Integers, doubles, infinity, nan."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"map = 2\n\narray = 3\n\nbuffer = 4\n\nrole = 5\n\nbool = 6\n")),(0,i.kt)("p",null,"Only ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," values."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"fiber = 7\n\nfunction = 8\n\nstring = 9\n\npacket = 10\n\nexotic = 11\n\nnull = 12\n\nimage = 13\n")),(0,i.kt)("h3",{id:"object_types-only-used-in-static-type-info"},"Object_Types only used in static type info"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"any = 14\n\nvoid = 15\n")),(0,i.kt)("h2",{id:"enum-builtin_object"},"Enum: BuiltIn_Object"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"Math = 0\nObject = 1\nObject_prototype = 2\nArray = 3\nArray_prototype = 4\nBuffer = 5\nBuffer_prototype = 6\nString = 7\nString_prototype = 8\nNumber = 9\nNumber_prototype = 10\nDsFiber = 11\nDsFiber_prototype = 12\nDsRole = 13\nDsRole_prototype = 14\nFunction = 15\nFunction_prototype = 16\nBoolean = 17\nBoolean_prototype = 18\nDsPacket = 19\nDsPacket_prototype = 20\nDeviceScript = 21\nDsPacketInfo_prototype = 22\nDsRegister_prototype = 23\nDsCommand_prototype = 24\nDsEvent_prototype = 25\nDsReport_prototype = 26\nError = 27\nError_prototype = 28\nTypeError = 29\nTypeError_prototype = 30\nRangeError = 31\nRangeError_prototype = 32\nSyntaxError = 33\nSyntaxError_prototype = 34\nJSON = 35\nDsServiceSpec = 36\nDsServiceSpec_prototype = 37\nDsPacketSpec = 38\nDsPacketSpec_prototype = 39\nImage = 40\nImage_prototype = 41\nGPIO = 42\nGPIO_prototype = 43\n")),(0,i.kt)("h2",{id:"enum-builtin_string"},"Enum: BuiltIn_String"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"_empty = 0\nMInfinity = 1 // -Infinity\nDeviceScript = 2\nE = 3\nInfinity = 4\nLN10 = 5\nLN2 = 6\nLOG10E = 7\nLOG2E = 8\nNaN = 9\nPI = 10\nSQRT1_2 = 11\nSQRT2 = 12\nabs = 13\nalloc = 14\narray = 15\nblitAt = 16\nboolean = 17\nbuffer = 18\ncbrt = 19\nceil = 20\ncharCodeAt = 21\nclamp = 22\nexp = 23\nfalse = 24\nfillAt = 25\nfloor = 26\nforEach = 27\nfunction = 28\ngetAt = 29\nidiv = 30\nimul = 31\nisBound = 32\njoin = 33\nlength = 34\nlog = 35\nlog10 = 36\nlog2 = 37\nmap = 38\nmax = 39\nmin = 40\nnext = 41\nnull = 42\nnumber = 43\nonChange = 44\nonConnected = 45\nonDisconnected = 46\npacket = 47\n_panic = 48\npop = 49\npow = 50\nprev = 51\nprototype = 52\npush = 53\nrandom = 54\nrandomInt = 55\nread = 56\nrestart = 57\nround = 58\nsetAt = 59\nsetLength = 60\nshift = 61\nsignal = 62\nslice = 63\nsplice = 64\nsqrt = 65\nstring = 66\nsubscribe = 67\ntoString = 68\ntrue = 69\nundefined = 70\nunshift = 71\nwait = 72\nwrite = 73\n\nsleep = 74\nimod = 75\nformat = 76\ninsert = 77\nstart = 78\ncloud = 79\nmain = 80\ncharAt = 81\nobject = 82\nparseInt = 83\nparseFloat = 84\nassign = 85\nkeys = 86\nvalues = 87\n__func__ = 88\nrole = 89\ndeviceIdentifier = 90\nshortId = 91\nserviceIndex = 92\nserviceCommand = 93\npayload = 94\ndecode = 95\nencode = 96\n_onPacket = 97\ncode = 98\nname = 99\nisEvent = 100\neventCode = 101\nisRegSet = 102\nisRegGet = 103\nregCode = 104\nflags = 105\nisReport = 106\nisCommand = 107\nisArray = 108\ninline = 109\nassert = 110\npushRange = 111\nsendCommand = 112\n__stack__ = 113\nError = 114\nTypeError = 115\nRangeError = 116\nstack = 117\nmessage = 118\ncause = 119\n__new__ = 120\nsetPrototypeOf = 121\ngetPrototypeOf = 122\nconstructor = 123\n__proto__ = 124\n_logRepr = 125\nprint = 126\neveryMs = 127\nsetInterval = 128\nsetTimeout = 129\nclearInterval = 130\nclearTimeout = 131\nSyntaxError = 132\nJSON = 133\nparse = 134\nstringify = 135\n_dcfgString = 136\nisSimulator = 137\n_Role = 138 // Role\nFiber = 139\nsuspend = 140\nresume = 141\nterminate = 142\nself = 143\ncurrent = 144\nid = 145\n_commandResponse = 146\nisAction = 147\nmillis = 148\nfrom = 149\nhex = 150\nutf8 = 151\nutf_8 = 152 // utf-8\nsuspended = 153\nreboot = 154\nserver = 155\nspec = 156\nServiceSpec = 157\nclassIdentifier = 158\nlookup = 159\nPacketSpec = 160\nparent = 161\nresponse = 162\nServerInterface = 163\n_onServerPacket = 164\n_serverSend = 165\nnotImplemented = 166\ndelay = 167\nfromCharCode = 168\n_allocRole = 169\nspiConfigure = 170\nspiXfer = 171\n_socketOpen = 172\n_socketClose = 173\n_socketWrite = 174\n_socketOnEvent = 175\nopen = 176\nclose = 177\nerror_ = 178 // error\ndata = 179\ntoUpperCase = 180\ntoLowerCase = 181\nindexOf = 182\nbyteLength = 183\nImage = 184\nwidth = 185\nheight = 186\nbpp = 187\nget = 188\nclone = 189\nset = 190\nfill = 191\nflipX = 192\nflipY = 193\ntransposed = 194\ndrawImage = 195\ndrawTransparentImage = 196\noverlapsWith = 197\nfillRect = 198\ndrawLine = 199\nequals = 200\nisReadOnly = 201\nfillCircle = 202\nblitRow = 203\nblit = 204\n_i2cTransaction = 205\n_twinMessage = 206\nspiSendImage = 207\ngpio = 208\nlabel = 209\nmode = 210\ncapabilities = 211\nvalue = 212\nsetMode = 213\nfillRandom = 214\nencrypt = 215\ndecrypt = 216\ndigest = 217\nledStripSend = 218\nrotate = 219\nregister = 220\nevent = 221\naction = 222\nreport = 223\ntype = 224\nbyCode = 225\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b3f35163.44fb7b76.js b/assets/js/b3f35163.44fb7b76.js new file mode 100644 index 00000000000..a71c9ea90a6 --- /dev/null +++ b/assets/js/b3f35163.44fb7b76.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5255],{35318:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>N});var r=a(27378);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function i(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,r)}return a}function p(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?i(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function l(t,e){if(null==t)return{};var a,r,n=function(t,e){if(null==t)return{};var a,r,n={},i=Object.keys(t);for(r=0;r<i.length;r++)a=i[r],e.indexOf(a)>=0||(n[a]=t[a]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)a=i[r],e.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}var o=r.createContext({}),d=function(t){var e=r.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},s=function(t){var e=d(t.components);return r.createElement(o.Provider,{value:e},t.children)},m="mdxType",g={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},k=r.forwardRef((function(t,e){var a=t.components,n=t.mdxType,i=t.originalType,o=t.parentName,s=l(t,["components","mdxType","originalType","parentName"]),m=d(a),k=n,N=m["".concat(o,".").concat(k)]||m[k]||g[k]||i;return a?r.createElement(N,p(p({ref:e},s),{},{components:a})):r.createElement(N,p({ref:e},s))}));function N(t,e){var a=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=a.length,p=new Array(i);p[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[m]="string"==typeof t?t:n,p[1]=l;for(var d=2;d<i;d++)p[d]=a[d];return r.createElement.apply(null,p)}return r.createElement.apply(null,a)}k.displayName="MDXCreateElement"},29223:(t,e,a)=>{a.r(e),a.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=a(25773),n=(a(27378),a(35318));const i={description:"Espressif ESP32-S3 DevKitM"},p="Espressif ESP32-S3 DevKitM",l={unversionedId:"devices/esp32/esp32s3-devkit-m",id:"devices/esp32/esp32s3-devkit-m",title:"Espressif ESP32-S3 DevKitM",description:"Espressif ESP32-S3 DevKitM",source:"@site/docs/devices/esp32/esp32s3-devkit-m.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32s3-devkit-m",permalink:"/devicescript/devices/esp32/esp32s3-devkit-m",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32-S3 DevKitM"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32-S3 (bare)",permalink:"/devicescript/devices/esp32/esp32s3-bare"},next:{title:"Unexpected Maker FeatherS2 ESP32-S2",permalink:"/devicescript/devices/esp32/feather-s2"}},o={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:d},m="wrapper";function g(t){let{components:e,...a}=t;return(0,n.kt)(m,(0,r.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"espressif-esp32-s3-devkitm"},"Espressif ESP32-S3 DevKitM"),(0,n.kt)("p",null,"ESP32-S3 DevKitM development board. Should also work for DevKitC."),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/espressif/esp32s3devkitmv10.catalog.jpg",alt:"Espressif ESP32-S3 DevKitM picture"})),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"WS2812B RGB LED on pin P48 (use ",(0,n.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,n.kt)("li",{parentName:"ul"},"Serial logging on pin P43 at 115200 8N1")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html"},"https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P11")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P12")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P15")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P16")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P17")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P33")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P34")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P38")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P39")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO39"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P40")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO40"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P41")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO41"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P42")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO42"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P43")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,n.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P45")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO45"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P46")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO46"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P47")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO47"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P48")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO48"),(0,n.kt)("td",{parentName:"tr",align:"right"},"led.pin, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32-S3 DevKitM".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32s3_devkit_m"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32s3_devkit_m\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s3-esp32s3_devkit_m-0x0.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32s3_devkit_m.json"',title:'"esp32s3_devkit_m.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32s3_devkit_m",\n "devName": "Espressif ESP32-S3 DevKitM",\n "productId": "0x3574d277",\n "$description": "ESP32-S3 DevKitM development board. Should also work for DevKitC.",\n "archId": "esp32s3",\n "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html",\n "led": {\n "pin": "P48",\n "type": 1\n },\n "log": {\n "pinTX": "P43"\n },\n "pins": {\n "P0": 0,\n "P1": 1,\n "P10": 10,\n "P11": 11,\n "P12": 12,\n "P13": 13,\n "P14": 14,\n "P15": 15,\n "P16": 16,\n "P17": 17,\n "P18": 18,\n "P2": 2,\n "P21": 21,\n "P3": 3,\n "P33": 33,\n "P34": 34,\n "P38": 38,\n "P39": 39,\n "P4": 4,\n "P40": 40,\n "P41": 41,\n "P42": 42,\n "P43": 43,\n "P45": 45,\n "P46": 46,\n "P47": 47,\n "P48": 48,\n "P5": 5,\n "P6": 6,\n "P7": 7,\n "P8": 8,\n "P9": 9\n }\n}\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b42ed10e.f309fe80.js b/assets/js/b42ed10e.f309fe80.js new file mode 100644 index 00000000000..7a4561d3f88 --- /dev/null +++ b/assets/js/b42ed10e.f309fe80.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2469],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var i=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var p=i.createContext({}),s=function(e){var t=i.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=s(e.components);return i.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},b=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=s(r),b=n,h=c["".concat(p,".").concat(b)]||c[b]||d[b]||a;return r?i.createElement(h,l(l({ref:t},u),{},{components:r})):i.createElement(h,l({ref:t},u))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,l=new Array(a);l[0]=b;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[c]="string"==typeof e?e:n,l[1]=o;for(var s=2;s<a;s++)l[s]=r[s];return i.createElement.apply(null,l)}return i.createElement.apply(null,r)}b.displayName="MDXCreateElement"},17335:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var i=r(25773),n=(r(27378),r(35318));const a={description:"Mounts a light bulb server",title:"Light bulb"},l="Light bulb",o={unversionedId:"api/drivers/lightbulb",id:"api/drivers/lightbulb",title:"Light bulb",description:"Mounts a light bulb server",source:"@site/docs/api/drivers/lightbulb.md",sourceDirName:"api/drivers",slug:"/api/drivers/lightbulb",permalink:"/devicescript/api/drivers/lightbulb",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a light bulb server",title:"Light bulb"},sidebar:"tutorialSidebar",previous:{title:"HID Mouse",permalink:"/devicescript/api/drivers/hidmouse"},next:{title:"Light Level",permalink:"/devicescript/api/drivers/lightlevel"}},p={},s=[{value:"Options",id:"options",level:2},{value:"pin",id:"pin",level:3},{value:"dimmable",id:"dimmable",level:3},{value:"activeLow",id:"activelow",level:3}],u={toc:s},c="wrapper";function d(e){let{components:t,...r}=e;return(0,n.kt)(c,(0,i.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"light-bulb"},"Light bulb"),(0,n.kt)("p",null,"The ",(0,n.kt)("inlineCode",{parentName:"p"},"startLightBulb")," function starts a ",(0,n.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/lightbulb"},"light bulb")," server on the device\nand returns a ",(0,n.kt)("a",{parentName:"p",href:"/api/clients/lightbulb"},"client"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startLightBulb } from "@devicescript/servers"\n\nconst bulb = startLightBulb({\n pin: gpio(20),\n dimmable: true,\n})\n')),(0,n.kt)("admonition",{type:"tip"},(0,n.kt)("p",{parentName:"admonition"},"For the onboard LED, use ",(0,n.kt)("a",{parentName:"p",href:"/developer/status-light"},"setStatusLight")," instead.")),(0,n.kt)("h2",{id:"options"},"Options"),(0,n.kt)("h3",{id:"pin"},"pin"),(0,n.kt)("p",null,"The pin hardware identifier on which to mount the light bulb."),(0,n.kt)("h3",{id:"dimmable"},"dimmable"),(0,n.kt)("p",null,"When set to ",(0,n.kt)("inlineCode",{parentName:"p"},"true")," you can set the intensity of the light (it will use a ",(0,n.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Pulse-width_modulation"},"PWM")," signal at a few kHz)."),(0,n.kt)("h3",{id:"activelow"},"activeLow"),(0,n.kt)("p",null,"Indicates that the light is on when the pin ",(0,n.kt)("inlineCode",{parentName:"p"},"0"),".\nBy default, the light is on when the pin is ",(0,n.kt)("inlineCode",{parentName:"p"},"1"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b61553de.966d4023.js b/assets/js/b61553de.966d4023.js new file mode 100644 index 00000000000..30132f15661 --- /dev/null +++ b/assets/js/b61553de.966d4023.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[107],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>g});var n=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=n.createContext({}),o=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):p(p({},r),e)),t},l=function(e){var r=o(e.components);return n.createElement(c.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=o(t),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return t?n.createElement(g,p(p({ref:r},l),{},{components:t})):n.createElement(g,p({ref:r},l))}));function g(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var i=t.length,p=new Array(i);p[0]=m;var s={};for(var c in r)hasOwnProperty.call(r,c)&&(s[c]=r[c]);s.originalType=e,s[d]="string"==typeof e?e:a,p[1]=s;for(var o=2;o<i;o++)p[o]=t[o];return n.createElement.apply(null,p)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"},84345:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>o});var n=t(25773),a=(t(27378),t(35318));const i={sidebar_position:10,title:"Graphics"},p="Graphics",s={unversionedId:"developer/graphics/index",id:"developer/graphics/index",title:"Graphics",description:"The @devicescript/graphics package provides an Image type and a Display type that supports",source:"@site/docs/developer/graphics/index.mdx",sourceDirName:"developer/graphics",slug:"/developer/graphics/",permalink:"/devicescript/developer/graphics/",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10,title:"Graphics"},sidebar:"tutorialSidebar",previous:{title:"Testing",permalink:"/devicescript/developer/testing"},next:{title:"Image",permalink:"/devicescript/developer/graphics/image"}},c={},o=[],l={toc:o},d="wrapper";function u(e){let{components:r,...i}=e;return(0,a.kt)(d,(0,n.Z)({},l,i,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"graphics"},"Graphics"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"@devicescript/graphics")," package provides an ",(0,a.kt)("inlineCode",{parentName:"p"},"Image")," type and a ",(0,a.kt)("inlineCode",{parentName:"p"},"Display")," type that supports\npaletted graphics."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Progress bar image",src:t(67218).Z,width:"582",height:"516"})),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"/developer/graphics/image"},"image")," can be used to author efficient driver for small screens\nsuch as the ",(0,a.kt)("a",{parentName:"p",href:"/api/drivers/ssd1306"},"SSD1306 OLED screen")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Image } from "@devicescript/graphics"\n\nconst img = Image.alloc(128, 64, 1)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/developer/graphics/image"},"Image"))),(0,a.kt)("p",null,"A ",(0,a.kt)("a",{parentName:"p",href:"/developer/graphics/display"},"display")," driver for a screen, such as the ",(0,a.kt)("a",{parentName:"p",href:"/api/drivers/ssd1306"},"SSD1306"),",\nexposes an image that represents the screen buffer. The driver typically\ncan be used as an indexed screen service which provides simulation support."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SSD1306Driver, startIndexedScreen } from "@devicescript/drivers"\n\nconst screen = await startIndexedScreen(\n new SSD1306Driver({ width: 128, height: 64, devAddr: 0x3c })\n)\nscreen.image.print(`Hello world!`, 3, 10)\nawait screen.show()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/developer/graphics/display"},"Display"))))}u.isMDXComponent=!0},67218:(e,r,t)=>{t.d(r,{Z:()=>n});const n=t.p+"assets/images/jsx-bb7adf23a927bba0724325c97df19da2.png"}}]); \ No newline at end of file diff --git a/assets/js/b9793319.06926893.js b/assets/js/b9793319.06926893.js new file mode 100644 index 00000000000..6c64c8b79d2 --- /dev/null +++ b/assets/js/b9793319.06926893.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9011],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),d=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=d(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),p=d(r),h=a,m=p["".concat(c,".").concat(h)]||p[h]||u[h]||i;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,s=new Array(i);s[0]=h;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[p]="string"==typeof e?e:a,s[1]=o;for(var d=2;d<i;d++)s[d]=r[d];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}h.displayName="MDXCreateElement"},84197:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var n=r(25773),a=(r(27378),r(35318));const i={sidebar_position:3.79,description:"Learn how to create a weather display using a temperature and humidity sensor and a basic character display.",keywords:["temperature sensor","humidity sensor","character screen","weather display","devicescript"],hide_table_of_contents:!0},s="Weather Display",o={unversionedId:"samples/weather-display",id:"samples/weather-display",title:"Weather Display",description:"Learn how to create a weather display using a temperature and humidity sensor and a basic character display.",source:"@site/docs/samples/weather-display.mdx",sourceDirName:"samples",slug:"/samples/weather-display",permalink:"/devicescript/samples/weather-display",draft:!1,tags:[],version:"current",sidebarPosition:3.79,frontMatter:{sidebar_position:3.79,description:"Learn how to create a weather display using a temperature and humidity sensor and a basic character display.",keywords:["temperature sensor","humidity sensor","character screen","weather display","devicescript"],hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Dimmer",permalink:"/devicescript/samples/dimmer"},next:{title:"Weather Dashboard",permalink:"/devicescript/samples/weather-dashboard"}},c={},d=[{value:"Configuring the hardware",id:"configuring-the-hardware",level:2},{value:"Logging sensor data",id:"logging-sensor-data",level:2},{value:"See also",id:"see-also",level:2}],l={toc:d},p="wrapper";function u(e){let{components:t,...i}=e;return(0,a.kt)(p,(0,n.Z)({},l,i,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"weather-display"},"Weather Display"),(0,a.kt)("p",null,"A simple weather display that gets new values every 5 seconds from a temperature and humidity sensor and displays them in a character display with a ascii symbol based on the humidity."),(0,a.kt)("h2",{id:"configuring-the-hardware"},"Configuring the hardware"),(0,a.kt)("p",null,"Make sure to configure your program for your\nhardware board so that the I2C pins are ",(0,a.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured correctly"),"."),(0,a.kt)("h2",{id:"logging-sensor-data"},"Logging sensor data"),(0,a.kt)("p",null,"Let's start by mounting a ",(0,a.kt)("inlineCode",{parentName:"p"},"sensor")," client and logging each sensor reading to the display using several functions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-tsx"},'import { startSHT30 } from "@devicescript/drivers"\nimport { SSD1306Driver, startCharacterScreen } from "@devicescript/drivers"\n\nconst screen = await startCharacterScreen(\n new SSD1306Driver({ width: 128, height: 64 })\n)\nconst { temperature, humidity } = await startSHT30()\n\nasync function displayText(text: string, weatherCondition: string) {\n const weatherIcon = getWeatherIcon(weatherCondition)\n\n await screen.message.write(`${text}\\n${weatherIcon}`)\n}\n\nasync function readSensorData() {\n // Assume weather condition is determined based on humidity level\n const weatherCondition =\n (await humidity.reading.read()) >= 70 ? "Rain" : "Sunny"\n\n // get values from sensor\n const displayValueTemperature = await temperature.reading.read()\n const displayValueHumidity = await humidity.reading.read()\n\n const temperatureString = `Temperature: ${displayValueTemperature}\xb0C`\n const humidityString = `Humidity: ${displayValueHumidity}%`\n const text = `${temperatureString}\\n${humidityString}`\n\n await displayText(text, weatherCondition)\n}\n\n// Function to get an ascii weather icon based on the weather condition\nfunction getWeatherIcon(weatherCondition: string) {\n switch (weatherCondition) {\n case "Rain":\n return `\n .-. .-. \n ( ) RAIN ( )\n(___) (___) \n \'\'\' \'\'\' \n ` // Use backticks to preserve multiline string formatting\n case "Sunny":\n return `\n \\\\ | / \n .-. \n --( )-- SUNNY\n \'-\' \n`\n default:\n return ""\n }\n}\n\n// Read sensor data every 5 seconds\nsetInterval(async () => {\n await readSensorData()\n}, 5000)\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Example Photo using Devicescript simulator",src:r(85341).Z,width:"1017",height:"1433"})),(0,a.kt)("h2",{id:"see-also"},"See also"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"./weather-dashboard"},"value dashboard")," simplifies the display of sensor data\non a character screen."))}u.isMDXComponent=!0},85341:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/simulator-example-9f6880c7516de8e05171bad268ed85f4.png"}}]); \ No newline at end of file diff --git a/assets/js/b9f2eef7.cfa23d4f.js b/assets/js/b9f2eef7.cfa23d4f.js new file mode 100644 index 00000000000..1f7a823ff65 --- /dev/null +++ b/assets/js/b9f2eef7.cfa23d4f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1506],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(r),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return r?n.createElement(f,a(a({ref:t},l),{},{components:r})):n.createElement(f,a({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=m;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:o,a[1]=c;for(var s=2;s<i;s++)a[s]=r[s];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},94361:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var n=r(25773),o=(r(27378),r(35318));const i={description:"Mounts a motion detector",title:"Motion Detector"},a="Motion detector",c={unversionedId:"api/drivers/motion",id:"api/drivers/motion",title:"Motion Detector",description:"Mounts a motion detector",source:"@site/docs/api/drivers/motion.md",sourceDirName:"api/drivers",slug:"/api/drivers/motion",permalink:"/devicescript/api/drivers/motion",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a motion detector",title:"Motion Detector"},sidebar:"tutorialSidebar",previous:{title:"LTR390",permalink:"/devicescript/api/drivers/ltr390"},next:{title:"Potentiometer",permalink:"/devicescript/api/drivers/potentiometer"}},p={},s=[],l={toc:s},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"motion-detector"},"Motion detector"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startMotion")," function starts on-board server for Motion,\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/motion"},"client")," bound to the server."),(0,o.kt)("p",null,"This is typically used with a PIR-based motion detectors, that just output the debounced motion\nreading as high-level on a given pin. Typical hardware includes: ",(0,o.kt)("inlineCode",{parentName:"p"},"AM312"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"SR602"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startMotion } from "@devicescript/servers"\n\nconst sensor = startMotion({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(moving => console.data({ moving }))\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bb0e3bff.87310da0.js b/assets/js/bb0e3bff.87310da0.js new file mode 100644 index 00000000000..fa41318190b --- /dev/null +++ b/assets/js/bb0e3bff.87310da0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3239],{35318:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>k});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function l(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=n.createContext({}),o=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},u=function(e){var r=o(e.components);return n.createElement(p.Provider,{value:r},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=o(t),d=i,k=c["".concat(p,".").concat(d)]||c[d]||m[d]||a;return t?n.createElement(k,s(s({ref:r},u),{},{components:t})):n.createElement(k,s({ref:r},u))}));function k(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var a=t.length,s=new Array(a);s[0]=d;var l={};for(var p in r)hasOwnProperty.call(r,p)&&(l[p]=r[p]);l.originalType=e,l[c]="string"==typeof e?e:i,s[1]=l;for(var o=2;o<a;o++)s[o]=t[o];return n.createElement.apply(null,s)}return n.createElement.apply(null,t)}d.displayName="MDXCreateElement"},33118:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>o});var n=t(25773),i=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Air Pressure service"},s="AirPressure",l={unversionedId:"api/clients/airpressure",id:"api/clients/airpressure",title:"AirPressure",description:"DeviceScript client for Air Pressure service",source:"@site/docs/api/clients/airpressure.md",sourceDirName:"api/clients",slug:"/api/clients/airpressure",permalink:"/devicescript/api/clients/airpressure",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Air Pressure service"},sidebar:"tutorialSidebar"},p={},o=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"minReading",id:"const:minReading",level:3},{value:"maxReading",id:"const:maxReading",level:3}],u={toc:o},c="wrapper";function m(e){let{components:r,...t}=e;return(0,i.kt)(c,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"airpressure"},"AirPressure"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A sensor measuring air pressure of outside environment."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The air pressure."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n// ...\nconst value = await airPressure.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n// ...\nairPressure.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"The real pressure is between ",(0,i.kt)("inlineCode",{parentName:"p"},"pressure - pressure_error")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"pressure + pressure_error"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n// ...\nconst value = await airPressure.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n// ...\nairPressure.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:minReading"},"minReading"),(0,i.kt)("p",null,"Lowest air pressure that can be reported."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n// ...\nconst value = await airPressure.minReading.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,i.kt)("p",null,"Highest air pressure that can be reported."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { AirPressure } from "@devicescript/core"\n\nconst airPressure = new AirPressure()\n// ...\nconst value = await airPressure.maxReading.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bcfe7f12.9dc21d2a.js b/assets/js/bcfe7f12.9dc21d2a.js new file mode 100644 index 00000000000..70ac4442916 --- /dev/null +++ b/assets/js/bcfe7f12.9dc21d2a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5250],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(r),m=a,d=u["".concat(c,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(d,i(i({ref:t},p),{},{components:r})):n.createElement(d,i({ref:t},p))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var l=2;l<o;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},55854:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>f,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const o={sidebar_position:9,description:"Learn how to use buffers for dynamic allocation, memory conservation, and creating arrays with fixed upper limits.",keywords:["buffers","markdown","dynamic allocation","memory conservation","arrays"]},i="Buffers",s={unversionedId:"api/core/buffers",id:"api/core/buffers",title:"Buffers",description:"Learn how to use buffers for dynamic allocation, memory conservation, and creating arrays with fixed upper limits.",source:"@site/docs/api/core/buffers.md",sourceDirName:"api/core",slug:"/api/core/buffers",permalink:"/devicescript/api/core/buffers",draft:!1,tags:[],version:"current",sidebarPosition:9,frontMatter:{sidebar_position:9,description:"Learn how to use buffers for dynamic allocation, memory conservation, and creating arrays with fixed upper limits.",keywords:["buffers","markdown","dynamic allocation","memory conservation","arrays"]},sidebar:"tutorialSidebar",previous:{title:"Commands",permalink:"/devicescript/api/core/commands"},next:{title:"Clients",permalink:"/devicescript/api/clients/"}},c={},l=[{value:"hex",id:"hex",level:2},{value:"packet",id:"packet",level:2}],p={toc:l},u="wrapper";function f(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"buffers"},"Buffers"),(0,a.kt)("p",null,"Buffers can be dynamically allocated, read and written.\nThis can be used to conserve memory (regular variables always take 8 bytes)\nand create arrays (with fixed upper limit)."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'const mybuf = Buffer.alloc(12) // 12 byte buffer\nmybuf.setAt(10, "u16", 123)\nmybuf.setAt(3, "u22.10", 173.282)\nconst z = mybuf.getAt(3, "u22.10")\n')),(0,a.kt)("h2",{id:"hex"},"hex"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"hex")," is a string literal template that converts data in hexadecimal form into a readonly ",(0,a.kt)("inlineCode",{parentName:"p"},"Buffer")," in flash."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"// Buffer in flash!\nconst data = hex`010203040506070809`\nconsole.log(data)\n")),(0,a.kt)("p",null,"Comments and whitespace are allowed in ",(0,a.kt)("inlineCode",{parentName:"p"},"hex")," literals:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const commentedData = hex`\n01 02 03 // first three numbers\nff aa // two more bytes\n`\n")),(0,a.kt)("h2",{id:"packet"},"packet"),(0,a.kt)("p",null,"There is a special buffer called ",(0,a.kt)("inlineCode",{parentName:"p"},"ds.packet")," which represents a buffer to be passed to next\ncommand or register write.\nIt supports ",(0,a.kt)("inlineCode",{parentName:"p"},"ds.packet.setLength()")," function (unlike regular buffers),\nand can be passed to any command or register write.\nFor example ",(0,a.kt)("inlineCode",{parentName:"p"},"lamp.intensity.write(0.7)")," is equivalent to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'const lamp = new ds.Led()\nds.packet.setLength(2)\nds.packet.setAt(0, "u0.16", 0.7)\nlamp.intensity.write(ds.packet)\n')))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bd082109.f5daf9bc.js b/assets/js/bd082109.f5daf9bc.js new file mode 100644 index 00000000000..ffba71f67fc --- /dev/null +++ b/assets/js/bd082109.f5daf9bc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3234],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=a.createContext({}),u=function(e){var t=a.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=u(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},v=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,o=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=u(r),v=n,m=d["".concat(o,".").concat(v)]||d[v]||p[v]||l;return r?a.createElement(m,s(s({ref:t},c),{},{components:r})):a.createElement(m,s({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,s=new Array(l);s[0]=v;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:n,s[1]=i;for(var u=2;u<l;u++)s[u]=r[u];return a.createElement.apply(null,s)}return a.createElement.apply(null,r)}v.displayName="MDXCreateElement"},39798:(e,t,r)=>{r.d(t,{Z:()=>s});var a=r(27378),n=r(38944);const l={tabItem:"tabItem_wHwb"};function s(e){let{children:t,hidden:r,className:s}=e;return a.createElement("div",{role:"tabpanel",className:(0,n.Z)(l.tabItem,s),hidden:r},t)}},23930:(e,t,r)=>{r.d(t,{Z:()=>w});var a=r(25773),n=r(27378),l=r(38944),s=r(83457),i=r(3620),o=r(30654),u=r(70784),c=r(71819);function d(e){return function(e){return n.Children.map(e,(e=>{if(!e||(0,n.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:r,attributes:a,default:n}}=e;return{value:t,label:r,attributes:a,default:n}}))}function p(e){const{values:t,children:r}=e;return(0,n.useMemo)((()=>{const e=t??d(r);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,r])}function v(e){let{value:t,tabValues:r}=e;return r.some((e=>e.value===t))}function m(e){let{queryString:t=!1,groupId:r}=e;const a=(0,i.k6)(),l=function(e){let{queryString:t=!1,groupId:r}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!r)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:t,groupId:r});return[(0,o._X)(l),(0,n.useCallback)((e=>{if(!l)return;const t=new URLSearchParams(a.location.search);t.set(l,e),a.replace({...a.location,search:t.toString()})}),[l,a])]}function f(e){const{defaultValue:t,queryString:r=!1,groupId:a}=e,l=p(e),[s,i]=(0,n.useState)((()=>function(e){let{defaultValue:t,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!v({value:t,tabValues:r}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=r.find((e=>e.default))??r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:l}))),[o,u]=m({queryString:r,groupId:a}),[d,f]=function(e){let{groupId:t}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,l]=(0,c.Nk)(r);return[a,(0,n.useCallback)((e=>{r&&l.set(e)}),[r,l])]}({groupId:a}),b=(()=>{const e=o??d;return v({value:e,tabValues:l})?e:null})();(0,n.useLayoutEffect)((()=>{b&&i(b)}),[b]);return{selectedValue:s,selectValue:(0,n.useCallback)((e=>{if(!v({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),f(e)}),[u,f,l]),tabValues:l}}var b=r(76457);const h={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function g(e){let{className:t,block:r,selectedValue:i,selectValue:o,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:d}=(0,s.o5)(),p=e=>{const t=e.currentTarget,r=c.indexOf(t),a=u[r].value;a!==i&&(d(t),o(a))},v=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const r=c.indexOf(e.currentTarget)+1;t=c[r]??c[0];break}case"ArrowLeft":{const r=c.indexOf(e.currentTarget)-1;t=c[r]??c[c.length-1];break}}t?.focus()};return n.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},u.map((e=>{let{value:t,label:r,attributes:s}=e;return n.createElement("li",(0,a.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>c.push(e),onKeyDown:v,onClick:p},s,{className:(0,l.Z)("tabs__item",h.tabItem,s?.className,{"tabs__item--active":i===t})}),r??t)})))}function y(e){let{lazy:t,children:r,selectedValue:a}=e;const l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===a));return e?(0,n.cloneElement)(e,{className:"margin-top--md"}):null}return n.createElement("div",{className:"margin-top--md"},l.map(((e,t)=>(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function k(e){const t=f(e);return n.createElement("div",{className:(0,l.Z)("tabs-container",h.tabList)},n.createElement(g,(0,a.Z)({},e,t)),n.createElement(y,(0,a.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return n.createElement(k,(0,a.Z)({key:String(t)},e))}},14838:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>d});var a=r(25773),n=(r(27378),r(35318)),l=r(23930),s=r(39798);const i={title:"WebASM VM",sidebar_position:100},o="Web Assembly Virtual Machine",u={unversionedId:"api/vm",id:"api/vm",title:"WebASM VM",description:"The @devicescript/vm package contains DeviceScript C virtual machine compiled to Web Assembly. It allows you to run bytecode in node.js and browsers.",source:"@site/docs/api/vm.mdx",sourceDirName:"api",slug:"/api/vm",permalink:"/devicescript/api/vm",draft:!1,tags:[],version:"current",sidebarPosition:100,frontMatter:{title:"WebASM VM",sidebar_position:100},sidebar:"tutorialSidebar",previous:{title:"Test",permalink:"/devicescript/api/test/"},next:{title:"SPI",permalink:"/devicescript/api/spi"}},c={},d=[{value:"import",id:"import",level:2},{value:"Node.js",id:"nodejs",level:3},{value:"Browser",id:"browser",level:3},{value:"devsSetDeviceId",id:"devssetdeviceid",level:2},{value:"devsStart",id:"devsstart",level:2},{value:"devsStop",id:"devsstop",level:2},{value:"devsIsRunning",id:"devsisrunning",level:2},{value:"devsInit",id:"devsinit",level:2},{value:"devsVerify",id:"devsverify",level:2},{value:"devsClearFlash",id:"devsclearflash",level:2}],p={toc:d},v="wrapper";function m(e){let{components:t,...r}=e;return(0,n.kt)(v,(0,a.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"web-assembly-virtual-machine"},"Web Assembly Virtual Machine"),(0,n.kt)("p",null,"The ",(0,n.kt)("inlineCode",{parentName:"p"},"@devicescript/vm")," package contains DeviceScript C virtual machine compiled to Web Assembly. It allows you to run bytecode in node.js and browsers."),(0,n.kt)("p",null,"This package is used in the ",(0,n.kt)("a",{parentName:"p",href:"/api/cli/"},"CLI")," and in developer tools web page."),(0,n.kt)(l.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,n.kt)(s.Z,{value:"npm",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"npm install --save @devicescript/vm\n"))),(0,n.kt)(s.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"yarn add @devicescript/vm\n"))),(0,n.kt)(s.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm add @devicescript/vm\n")))),(0,n.kt)("h2",{id:"import"},"import"),(0,n.kt)("p",null,"Loading the virtual machine is async and should typically be cached in a global variable."),(0,n.kt)("h3",{id:"nodejs"},"Node.js"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},'import type { DevsModule } from "@devicescript/vm"\n\nconst vmLoader = require("@devicescript/vm")\nconst vm: DevsModule = await vmLoader()\nvm.devsInit()\n')),(0,n.kt)("h3",{id:"browser"},"Browser"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},'import type { DevsModule } from "@devicescript/vm"\nimport vmLoader from "@devicescript/vm"\n\nconst vm: DevsModule = await vmLoader()\nvm.devsInit()\n')),(0,n.kt)("p",null,"or import ",(0,n.kt)("a",{parentName:"p",href:"https://microsoft.github.io/devicescript/dist/devicescript-vm.js"},"https://microsoft.github.io/devicescript/dist/devicescript-vm.js")," for the latest build."),(0,n.kt)("h2",{id:"devssetdeviceid"},"devsSetDeviceId"),(0,n.kt)("p",null,"Specifies the device id of the virtual machine device. This method should be called before starting the virtual machine."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},'vm.devsSetDeviceId("1989f4eee0ebe206")\n')),(0,n.kt)("h2",{id:"devsstart"},"devsStart"),(0,n.kt)("p",null,"Starts the virtual machine. Does nothing if already running."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},'const res = vm.devsStart()\nif (res) console.error("failed to start", res)\n')),(0,n.kt)("h2",{id:"devsstop"},"devsStop"),(0,n.kt)("p",null,"Stops the virtual machine. Does nothing if already stopped."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},"vm.devsStop()\n")),(0,n.kt)("h2",{id:"devsisrunning"},"devsIsRunning"),(0,n.kt)("p",null,"Indicates if the virtual machine is started."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},"const running = vm.devsIsRunning()\n")),(0,n.kt)("h2",{id:"devsinit"},"devsInit"),(0,n.kt)("p",null,"This method allocates data structures necessary for running the virtual machine.\nIt is automatically called by other metods."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},"vm.devsInit()\n")),(0,n.kt)("h2",{id:"devsverify"},"devsVerify"),(0,n.kt)("p",null,"Verifies that a buffer of bytecode is well formed. Returns non-zero error codes when failing."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},'const res = vm.devsVerify()\nif (res) console.error("failed to verify", res)\n')),(0,n.kt)("h2",{id:"devsclearflash"},"devsClearFlash"),(0,n.kt)("p",null,'Clear persistent "flash" storage.'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-js"},"vm.devsClearFlash()\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/beffa4c6.da7907b7.js b/assets/js/beffa4c6.da7907b7.js new file mode 100644 index 00000000000..e4fd95163c5 --- /dev/null +++ b/assets/js/beffa4c6.da7907b7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7156],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(r),d=a,f=u["".concat(s,".").concat(d)]||u[d]||m[d]||i;return r?n.createElement(f,o(o({ref:t},c),{},{components:r})):n.createElement(f,o({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[u]="string"==typeof e?e:a,o[1]=p;for(var l=2;l<i;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},82381:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const i={},o="BME680",p={unversionedId:"api/drivers/bme680",id:"api/drivers/bme680",title:"BME680",description:"Driver for BME680 temperature/humidity/air pressure/aqi",source:"@site/docs/api/drivers/bme680.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/bme680",permalink:"/devicescript/api/drivers/bme680",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"AHT20",permalink:"/devicescript/api/drivers/aht20"},next:{title:"Button",permalink:"/devicescript/api/drivers/button"}},s={},l=[{value:"Usage",id:"usage",level:2},{value:"Configuration",id:"configuration",level:2}],c={toc:l},u="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"bme680"},"BME680"),(0,a.kt)("p",null,"Driver for BME680 temperature/humidity/air pressure/aqi\nat I2C address ",(0,a.kt)("inlineCode",{parentName:"p"},"0x76")," (default) or ",(0,a.kt)("inlineCode",{parentName:"p"},"0x77"),"."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Services: ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/temperature/"},"temperature"),", ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/humidity/"},"humidity"),", ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/airpressure/"},"air pressure"),", ",(0,a.kt)("a",{parentName:"li",href:"/api/clients/airqualityindex/"},"air quality index")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf"},"Datasheet")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/bme680.ts"},"Source"))),(0,a.kt)("h2",{id:"usage"},"Usage"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { startBME680 } from "@devicescript/drivers"\nconst { temperature, humidity, pressure, airQualityIndex } = await startBME680()\n')),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Configure I2C throught the ",(0,a.kt)("a",{parentName:"li",href:"/developer/board-configuration"},"board configuration")),(0,a.kt)("li",{parentName:"ul"},"Check that you are using the correct I2C address")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bf5a0007.e82a49fe.js b/assets/js/bf5a0007.e82a49fe.js new file mode 100644 index 00000000000..5be4178b1d1 --- /dev/null +++ b/assets/js/bf5a0007.e82a49fe.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3105],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=o,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||i;return r?n.createElement(f,a(a({ref:t},s),{},{components:r})):n.createElement(f,a({ref:t},s))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:o,a[1]=l;for(var p=2;p<i;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},41083:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Color service"},a="Color",l={unversionedId:"api/clients/color",id:"api/clients/color",title:"Color",description:"DeviceScript client for Color service",source:"@site/docs/api/clients/color.md",sourceDirName:"api/clients",slug:"/api/clients/color",permalink:"/devicescript/api/clients/color",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Color service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3}],s={toc:p},u="wrapper";function m(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"color"},"Color"),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,o.kt)("p",null,"Senses RGB colors"),(0,o.kt)("p",null),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { Color } from "@devicescript/core"\n\nconst color = new Color()\n')),(0,o.kt)("p",null),(0,o.kt)("h2",{id:"registers"},"Registers"),(0,o.kt)("p",null),(0,o.kt)("h3",{id:"ro:reading"},"reading"),(0,o.kt)("p",null,"Detected color in the RGB color space."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"type: ",(0,o.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,o.kt)("inlineCode",{parentName:"p"},"u0.16 u0.16 u0.16"),")")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"track incoming values"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Color } from "@devicescript/core"\n\nconst color = new Color()\n// ...\ncolor.reading.subscribe(async (value) => {\n ...\n})\n')),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,o.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bff3aaa3.d5fd0c49.js b/assets/js/bff3aaa3.d5fd0c49.js new file mode 100644 index 00000000000..7e43ba3dcb6 --- /dev/null +++ b/assets/js/bff3aaa3.d5fd0c49.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1496],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var i=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,i,a=function(e,t){if(null==e)return{};var n,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=i.createContext({}),l=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=l(e.components);return i.createElement(p.Provider,{value:t},e.children)},s="mdxType",v={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),s=l(n),d=a,m=s["".concat(p,".").concat(d)]||s[d]||v[d]||r;return n?i.createElement(m,c(c({ref:t},u),{},{components:n})):i.createElement(m,c({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,c=new Array(r);c[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[s]="string"==typeof e?e:a,c[1]=o;for(var l=2;l<r;l++)c[l]=n[l];return i.createElement.apply(null,c)}return i.createElement.apply(null,n)}d.displayName="MDXCreateElement"},21650:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>v,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var i=n(25773),a=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Capacitive Button service"},c="CapacitiveButton",o={unversionedId:"api/clients/capacitivebutton",id:"api/clients/capacitivebutton",title:"CapacitiveButton",description:"DeviceScript client for Capacitive Button service",source:"@site/docs/api/clients/capacitivebutton.md",sourceDirName:"api/clients",slug:"/api/clients/capacitivebutton",permalink:"/devicescript/api/clients/capacitivebutton",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Capacitive Button service"},sidebar:"tutorialSidebar"},p={},l=[{value:"Commands",id:"commands",level:2},{value:"calibrate",id:"calibrate",level:3},{value:"Registers",id:"registers",level:2},{value:"activeThreshold",id:"rw:activeThreshold",level:3}],u={toc:l},s="wrapper";function v(e){let{components:t,...n}=e;return(0,a.kt)(s,(0,i.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"capacitivebutton"},"CapacitiveButton"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A configuration service for a capacitive push-button."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { CapacitiveButton } from "@devicescript/core"\n\nconst capacitiveButton = new CapacitiveButton()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"calibrate"},"calibrate"),(0,a.kt)("p",null,"Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button.\nThe report indicates the calibration is done."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"capacitiveButton.calibrate(): Promise<void>\n")),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:activeThreshold"},"activeThreshold"),(0,a.kt)("p",null,"Indicates the threshold for ",(0,a.kt)("inlineCode",{parentName:"p"},"up")," events."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CapacitiveButton } from "@devicescript/core"\n\nconst capacitiveButton = new CapacitiveButton()\n// ...\nconst value = await capacitiveButton.activeThreshold.read()\nawait capacitiveButton.activeThreshold.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { CapacitiveButton } from "@devicescript/core"\n\nconst capacitiveButton = new CapacitiveButton()\n// ...\ncapacitiveButton.activeThreshold.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c2d38624.78f414f5.js b/assets/js/c2d38624.78f414f5.js new file mode 100644 index 00000000000..fc52455f2c3 --- /dev/null +++ b/assets/js/c2d38624.78f414f5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3485],{35318:(t,e,a)=>{a.d(e,{Zo:()=>m,kt:()=>c});var n=a(27378);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function i(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function p(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?i(Object(a),!0).forEach((function(e){r(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function l(t,e){if(null==t)return{};var a,n,r=function(t,e){if(null==t)return{};var a,n,r={},i=Object.keys(t);for(n=0;n<i.length;n++)a=i[n],e.indexOf(a)>=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],e.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var o=n.createContext({}),d=function(t){var e=n.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},m=function(t){var e=d(t.components);return n.createElement(o.Provider,{value:e},t.children)},s="mdxType",g={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,i=t.originalType,o=t.parentName,m=l(t,["components","mdxType","originalType","parentName"]),s=d(a),k=r,c=s["".concat(o,".").concat(k)]||s[k]||g[k]||i;return a?n.createElement(c,p(p({ref:e},m),{},{components:a})):n.createElement(c,p({ref:e},m))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=a.length,p=new Array(i);p[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[s]="string"==typeof t?t:r,p[1]=l;for(var d=2;d<i;d++)p[d]=a[d];return n.createElement.apply(null,p)}return n.createElement.apply(null,a)}k.displayName="MDXCreateElement"},11135:(t,e,a)=>{a.r(e),a.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var n=a(25773),r=(a(27378),a(35318));const i={description:"Unexpected Maker FeatherS2 ESP32-S2"},p="Unexpected Maker FeatherS2 ESP32-S2",l={unversionedId:"devices/esp32/feather-s2",id:"devices/esp32/feather-s2",title:"Unexpected Maker FeatherS2 ESP32-S2",description:"Unexpected Maker FeatherS2 ESP32-S2",source:"@site/docs/devices/esp32/feather-s2.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/feather-s2",permalink:"/devicescript/devices/esp32/feather-s2",draft:!1,tags:[],version:"current",frontMatter:{description:"Unexpected Maker FeatherS2 ESP32-S2"},sidebar:"tutorialSidebar",previous:{title:"Espressif ESP32-S3 DevKitM",permalink:"/devicescript/devices/esp32/esp32s3-devkit-m"},next:{title:"MSR JM Brain S2-mini 207 v4.2",permalink:"/devicescript/devices/esp32/msr207-v42"}},o={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],m={toc:d},s="wrapper";function g(t){let{components:e,...a}=t;return(0,r.kt)(s,(0,n.Z)({},m,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"unexpected-maker-feathers2-esp32-s2"},"Unexpected Maker FeatherS2 ESP32-S2"),(0,r.kt)("p",null,"ESP32-S2 based development board in a Feather format."),(0,r.kt)("p",null,(0,r.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/unexpected-maker/feathers2esp32s2v20.catalog.jpg",alt:"Unexpected Maker FeatherS2 ESP32-S2 picture"})),(0,r.kt)("h2",{id:"features"},"Features"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"I2C on SDA/SCL using Qwiic connector"),(0,r.kt)("li",{parentName:"ul"},"LED on pin 40 (use ",(0,r.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,r.kt)("li",{parentName:"ul"},"Serial logging on pin TX_D1 at 115200 8N1"),(0,r.kt)("li",{parentName:"ul"},"Service: buttonBOOT (button)"),(0,r.kt)("li",{parentName:"ul"},"Service: ambientLight (analog:lightLevel)")),(0,r.kt)("h2",{id:"stores"},"Stores"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://unexpectedmaker.com/shop/feathers2-esp32-s2"},"https://unexpectedmaker.com/shop/feathers2-esp32-s2"))),(0,r.kt)("h2",{id:"pins"},"Pins"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,r.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P17")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P18")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P14")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P12")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P6")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P5")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P3")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P7")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P10")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P11")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P33")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P38")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"P1")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,r.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"LED0")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"LED_PWR")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SDI")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO37"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SDO")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"RX_D0")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO44"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SCK")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,r.kt)("td",{parentName:"tr",align:"right"},"io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SCL")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,r.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"SDA")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,r.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"TX_D1")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,r.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"$services.buttonBOOT","[0]",".pin")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,r.kt)("td",{parentName:"tr",align:"right"},"$services.buttonBOOT","[0]",".pin, boot, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"$services.ambientLight","[1]",".pin")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,r.kt)("td",{parentName:"tr",align:"right"},"$services.ambientLight","[1]",".pin, analogIn, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"led.pin")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO40"),(0,r.kt)("td",{parentName:"tr",align:"right"},"led.pin, debug, io")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("strong",{parentName:"td"},"led.pinCLK")),(0,r.kt)("td",{parentName:"tr",align:"left"},"GPIO45"),(0,r.kt)("td",{parentName:"tr",align:"right"},"led.pinCLK, boot, io")))),(0,r.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,r.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,r.kt)("p",null,"In ",(0,r.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,r.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Unexpected Maker FeatherS2 ESP32-S2".'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/feather_s2"\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,r.kt)("p",null,"In Visual Studio Code,\nselect ",(0,r.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,r.kt)("p",null,"Run this ",(0,r.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board feather_s2\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-feather_s2-0x1000.bin"},"Firmware"))),(0,r.kt)("h2",{id:"configuration"},"Configuration"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="feather_s2.json"',title:'"feather_s2.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "feather_s2",\n "devName": "Unexpected Maker FeatherS2 ESP32-S2",\n "productId": "0x3126f707",\n "$description": "ESP32-S2 based development board in a Feather format.",\n "archId": "esp32s2",\n "url": "https://unexpectedmaker.com/shop/feathers2-esp32-s2",\n "$pins": {\n "P1": "D9",\n "P10": "D12",\n "P11": "D13",\n "P12": "A3",\n "P14": "A2",\n "P17": "A0",\n "P18": "A1",\n "P3": "D10",\n "P33": "D5",\n "P38": "D6",\n "P5": "A5_D25",\n "P6": "A4_D24",\n "P7": "D11",\n "SDI": "MISO",\n "SDO": "MOSI"\n },\n "$services": [\n {\n "name": "buttonBOOT",\n "pin": 0,\n "service": "button"\n },\n {\n "name": "ambientLight",\n "pin": 4,\n "service": "analog:lightLevel"\n }\n ],\n "i2c": {\n "$connector": "Qwiic",\n "pinSCL": "SCL",\n "pinSDA": "SDA"\n },\n "led": {\n "pin": 40,\n "pinCLK": 45,\n "type": 2\n },\n "log": {\n "pinTX": "TX_D1"\n },\n "pins": {\n "A0": 17,\n "A1": 18,\n "A2": 14,\n "A3": 12,\n "A4_D24": 6,\n "A5_D25": 5,\n "D10": 3,\n "D11": 7,\n "D12": 10,\n "D13": 11,\n "D5": 33,\n "D6": 38,\n "D9": 1,\n "LED0": 13,\n "LED_PWR": 21,\n "MISO": 37,\n "MOSI": 35,\n "RX_D0": 44,\n "SCK": 36,\n "SCL": 9,\n "SDA": 8,\n "TX_D1": 43\n },\n "sPin": {\n "LED_PWR": 1\n }\n}\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c3437d7e.2865b71a.js b/assets/js/c3437d7e.2865b71a.js new file mode 100644 index 00000000000..ab66fcf7256 --- /dev/null +++ b/assets/js/c3437d7e.2865b71a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2749],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(r),f=i,b=u["".concat(l,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(b,o(o({ref:t},s),{},{components:r})):n.createElement(b,o({ref:t},s))}));function b(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[u]="string"==typeof e?e:i,o[1]=c;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},58694:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,unlisted:!0},o="Bridge",c={unversionedId:"api/clients/bridge",id:"api/clients/bridge",title:"Bridge",description:"The Bridge service is used internally by the runtime",source:"@site/docs/api/clients/bridge.md",sourceDirName:"api/clients",slug:"/api/clients/bridge",permalink:"/devicescript/api/clients/bridge",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},l={},p=[],s={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"bridge"},"Bridge"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/bridge/"},"Bridge service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c44a5b35.ffda2e25.js b/assets/js/c44a5b35.ffda2e25.js new file mode 100644 index 00000000000..27734ddd3e1 --- /dev/null +++ b/assets/js/c44a5b35.ffda2e25.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4985],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},v=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),d=p(r),v=i,m=d["".concat(c,".").concat(v)]||d[v]||u[v]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,s=new Array(a);s[0]=v;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[d]="string"==typeof e?e:i,s[1]=o;for(var p=2;p<a;p++)s[p]=r[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}v.displayName="MDXCreateElement"},39317:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={title:"I2C",sidebar_position:50},s="I2C",o={unversionedId:"developer/drivers/i2c",id:"developer/drivers/i2c",title:"I2C",description:"I2C builtin package that exposes",source:"@site/docs/developer/drivers/i2c.mdx",sourceDirName:"developer/drivers",slug:"/developer/drivers/i2c",permalink:"/devicescript/developer/drivers/i2c",draft:!1,tags:[],version:"current",sidebarPosition:50,frontMatter:{title:"I2C",sidebar_position:50},sidebar:"tutorialSidebar",previous:{title:"SPI",permalink:"/devicescript/developer/drivers/spi"},next:{title:"Serial",permalink:"/devicescript/developer/drivers/serial"}},c={},p=[{value:"Driver",id:"driver",level:2}],l={toc:p},d="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"i2c"},"I2C"),(0,i.kt)("p",null,"I2C ",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," that exposes\na ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/i2c/"},"I2C service")," to interact with I2C devices."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { i2c } from "@devicescript/i2c"\n\nconst address = 0x..\nconst register = 0x..\nconst value = 0x..\n\n// highlight-next-line\nawait i2c.writeReg(address, register, value)\n\n// highlight-next-line\nconst readValue = await i2c.readReg(address, register)\n')),(0,i.kt)("h2",{id:"driver"},"Driver"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"I2CDriver")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"I2CSensorDriver")," classes encapsulate storing the address and generally handles a bit of the\nlow-level I2C protocol. It is not required to use the driver, but it can be useful."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:'skip title="./aht20.ts"',skip:!0,title:'"./aht20.ts"'},'import { I2CSensorDriver } from "@devicescript/drivers"\n\nconst AHT20_ADDRESS = 0x38\nconst AHT20_BUSY = 0x80\nconst AHT20_OK = 0x08\nconst AHT20_READ_THROTTLE = 500\n\nclass AHT20Driver extends I2CSensorDriver<{\n humidity: number\n temperature: number\n}> {\n constructor() {\n super(AHT20_ADDRESS, { readCacheTime: AHT20_READ_THROTTLE })\n }\n\n // ...\n\n override async readData() {\n await this.writeBuf(hex`AC3300`)\n await this.waitBusy()\n const data = await this.readBuf(6)\n\n const h0 = (data[1] << 12) | (data[2] << 4) | (data[3] >> 4)\n const humidity = h0 * (100 / 0x100000)\n const t0 = ((data[3] & 0xf) << 16) | (data[4] << 8) | data[5]\n const temperature = t0 * (200.0 / 0x100000) - 50\n\n return { humidity, temperature }\n }\n}\n')),(0,i.kt)("p",null,"You can find implementation examples at ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/tree/main/packages/drivers/src"},"https://github.com/microsoft/devicescript/tree/main/packages/drivers/src"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c54ba89e.be9d0766.js b/assets/js/c54ba89e.be9d0766.js new file mode 100644 index 00000000000..8269f7d9eda --- /dev/null +++ b/assets/js/c54ba89e.be9d0766.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2544],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),s=c(r),d=o,m=s["".concat(p,".").concat(d)]||s[d]||f[d]||i;return r?n.createElement(m,a(a({ref:t},u),{},{components:r})):n.createElement(m,a({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[s]="string"==typeof e?e:o,a[1]=l;for(var c=2;c<i;c++)a[c]=r[c];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},16802:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(25773),o=(r(27378),r(35318));const i={title:"IoT"},a="IoT Platforms",l={unversionedId:"developer/iot/index",id:"developer/iot/index",title:"IoT",description:"Here are a set of guides on using DeviceScript with various IoT platforms.",source:"@site/docs/developer/iot/index.mdx",sourceDirName:"developer/iot",slug:"/developer/iot/",permalink:"/devicescript/developer/iot/",draft:!1,tags:[],version:"current",frontMatter:{title:"IoT"},sidebar:"tutorialSidebar",previous:{title:"Simulation",permalink:"/devicescript/developer/simulation"},next:{title:"Adafruit.io",permalink:"/devicescript/developer/iot/adafruit-io/"}},p={},c=[],u={toc:c},s="wrapper";function f(e){let{components:t,...r}=e;return(0,o.kt)(s,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"iot-platforms"},"IoT Platforms"),(0,o.kt)("p",null,"Here are a set of guides on using DeviceScript with various IoT platforms."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/developer/iot/adafruit-io/"},"Adafruit.io"),", using HTTPS"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/developer/iot/blues-io/"},"Blues.io"),", using I2C and the Notecard"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/developer/iot/blynk-io/"},"Blynk.io"),", using HTTPS"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/developer/iot/matlab-thingspeak/"},"Matlab ThingSpeak"),", using HTTPS")))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c62d7f7c.0b7ba517.js b/assets/js/c62d7f7c.0b7ba517.js new file mode 100644 index 00000000000..6ce60711195 --- /dev/null +++ b/assets/js/c62d7f7c.0b7ba517.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6457],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>v});var n=t(27378);function i(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function p(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(i[t]=e[t]);return i}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=n.createContext({}),c=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},l=function(e){var r=c(e.components);return n.createElement(s.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),u=c(t),f=i,v=u["".concat(s,".").concat(f)]||u[f]||d[f]||a;return t?n.createElement(v,o(o({ref:r},l),{},{components:t})):n.createElement(v,o({ref:r},l))}));function v(e,r){var t=arguments,i=r&&r.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=f;var p={};for(var s in r)hasOwnProperty.call(r,s)&&(p[s]=r[s]);p.originalType=e,p[u]="string"==typeof e?e:i,o[1]=p;for(var c=2;c<a;c++)o[c]=t[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"},99021:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=t(25773),i=(t(27378),t(35318));const a={title:"SPI",sidebar_position:14},o="SPI",p={unversionedId:"developer/drivers/spi",id:"developer/drivers/spi",title:"SPI",description:"SPI builtin package that exposes functions to read, write, transfer buffers over SPI.",source:"@site/docs/developer/drivers/spi.mdx",sourceDirName:"developer/drivers",slug:"/developer/drivers/spi",permalink:"/devicescript/developer/drivers/spi",draft:!1,tags:[],version:"current",sidebarPosition:14,frontMatter:{title:"SPI",sidebar_position:14},sidebar:"tutorialSidebar",previous:{title:"Analog",permalink:"/devicescript/developer/drivers/analog"},next:{title:"I2C",permalink:"/devicescript/developer/drivers/i2c"}},s={},c=[{value:"See also",id:"see-also",level:2}],l={toc:c},u="wrapper";function d(e){let{components:r,...t}=e;return(0,i.kt)(u,(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"spi"},"SPI"),(0,i.kt)("p",null,"SPI ",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," that exposes functions to read, write, transfer buffers over SPI."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { spi } from "@devicescript/spi"\n\nawait spi.configure({})\n\n// write a few bytes\nawait spi.write(hex`abcd`)\n\n// read 8 bytes\nconst resp = await spi.read(8)\n\n// write and read a buffer\nconst resp2 = await spi.transfer(hex`abcd`)\n')),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"SPI is not yet implemented on ",(0,i.kt)("a",{parentName:"p",href:"/devices/"},"RP2040"),".")),(0,i.kt)("h2",{id:"see-also"},"See also"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/api/spi/"},"API reference"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c688902b.293c3be4.js b/assets/js/c688902b.293c3be4.js new file mode 100644 index 00000000000..097410c6ef6 --- /dev/null +++ b/assets/js/c688902b.293c3be4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4712],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),u=c(r),f=i,m=u["".concat(s,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,o(o({ref:t},l),{},{components:r})):n.createElement(m,o({ref:t},l))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=f;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[u]="string"==typeof e?e:i,o[1]=p;for(var c=2;c<a;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},22708:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=r(25773),i=(r(27378),r(35318));const a={title:"SPI",sidebar_position:101},o="SPI",p={unversionedId:"api/spi",id:"api/spi",title:"SPI",description:"The SPI builtin package that exposes functions to read, write, transfer buffers over SPI.",source:"@site/docs/api/spi.mdx",sourceDirName:"api",slug:"/api/spi",permalink:"/devicescript/api/spi",draft:!1,tags:[],version:"current",sidebarPosition:101,frontMatter:{title:"SPI",sidebar_position:101},sidebar:"tutorialSidebar",previous:{title:"WebASM VM",permalink:"/devicescript/api/vm"},next:{title:"Release Notes",permalink:"/devicescript/changelog"}},s={},c=[{value:"<code>SPI.configure</code>",id:"spiconfigure",level:2},{value:"<code>SPI.read</code>",id:"spiread",level:2},{value:"<code>SPI.write</code>",id:"spiwrite",level:2},{value:"<code>SPI.transfer</code>",id:"spitransfer",level:2}],l={toc:c},u="wrapper";function d(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"spi"},"SPI"),(0,i.kt)("p",null,"The SPI ",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin package")," that exposes functions to read, write, transfer buffers over SPI.\nIn particular, it exposes an ",(0,i.kt)("inlineCode",{parentName:"p"},"SPI")," class and ",(0,i.kt)("inlineCode",{parentName:"p"},"spi")," singleton instance (currently only one SPI interface is supported)."),(0,i.kt)("h2",{id:"spiconfigure"},(0,i.kt)("inlineCode",{parentName:"h2"},"SPI.configure")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"SPI.configure")," function is used to configure the SPI bus. It takes the pin configuration, frequency and mode."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { spi } from "@devicescript/spi"\nawait spi.configure({})\n')),(0,i.kt)("h2",{id:"spiread"},(0,i.kt)("inlineCode",{parentName:"h2"},"SPI.read")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"SPI.read")," function is used to read a buffer from the SPI bus."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { spi } from "@devicescript/spi"\nconst res = await spi.read(8) // read 8 bytes\n')),(0,i.kt)("h2",{id:"spiwrite"},(0,i.kt)("inlineCode",{parentName:"h2"},"SPI.write")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"SPI.write")," function is used to write a buffer to the SPI bus."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { spi } from "@devicescript/spi"\n\nawait spi.write(hex`abcd`)\n')),(0,i.kt)("h2",{id:"spitransfer"},(0,i.kt)("inlineCode",{parentName:"h2"},"SPI.transfer")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"SPI.transfer")," function is used to write and read buffers from and to the SPI bus.\nThe read buffer has the same length as the write buffer."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { spi } from "@devicescript/spi"\n\nconst res = await spi.transfer(hex`abcd`)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c7480e04.2f81519f.js b/assets/js/c7480e04.2f81519f.js new file mode 100644 index 00000000000..9425d9d95ed --- /dev/null +++ b/assets/js/c7480e04.2f81519f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2357],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>b});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(n),y=o,b=d["".concat(c,".").concat(y)]||d[y]||u[y]||a;return n?r.createElement(b,i(i({ref:t},l),{},{components:n})):r.createElement(b,i({ref:t},l))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}y.displayName="MDXCreateElement"},50357:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=n(25773),o=(n(27378),n(35318));const a={sidebar_position:4,description:"Create a copy-paste micro-keyboard on Raspberry Pi Pico using a single button, HID keyboard server, and a status LED.",keywords:["Raspberry Pi Pico","copy-paste","micro-keyboard","HID keyboard","status LED"],hide_table_of_contents:!0},i="Copy Paste Button",s={unversionedId:"samples/copy-paste-button",id:"samples/copy-paste-button",title:"Copy Paste Button",description:"Create a copy-paste micro-keyboard on Raspberry Pi Pico using a single button, HID keyboard server, and a status LED.",source:"@site/docs/samples/copy-paste-button.mdx",sourceDirName:"samples",slug:"/samples/copy-paste-button",permalink:"/devicescript/samples/copy-paste-button",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Create a copy-paste micro-keyboard on Raspberry Pi Pico using a single button, HID keyboard server, and a status LED.",keywords:["Raspberry Pi Pico","copy-paste","micro-keyboard","HID keyboard","status LED"],hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Weather Dashboard",permalink:"/devicescript/samples/weather-dashboard"},next:{title:"Thermostat",permalink:"/devicescript/samples/thermostat"}},c={},p=[],l={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(d,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"copy-paste-button"},"Copy Paste Button"),(0,o.kt)("p",null,"In this example, we use a single button to create a ",(0,o.kt)("inlineCode",{parentName:"p"},"copy-paste")," micro-keyboard\non ",(0,o.kt)("a",{parentName:"p",href:"/devices/rp2040"},"Raspberry Pi Pico"),"."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The button is connected to the Pico's GP14 pin. When the button is pressed, the Pico will send a ",(0,o.kt)("inlineCode",{parentName:"li"},"ctrl+c")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"ctrl+v")," keystroke to the computer using a ",(0,o.kt)("a",{parentName:"li",href:"/api/drivers/hidkeyboard"},"HID keyboard")," server.\nThe ",(0,o.kt)("inlineCode",{parentName:"li"},"ctrl+c")," keystroke will copy the selected text, and the ",(0,o.kt)("inlineCode",{parentName:"li"},"ctrl+v")," keystroke will paste the copied text."),(0,o.kt)("li",{parentName:"ul"},"The status of the clipboard is indicated by a status LED connected to the Pico's GP1 pin. When the LED is on, the clipboard is full, and when the LED is off, the clipboard is empty.")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"On MacOS, we use ",(0,o.kt)("inlineCode",{parentName:"p"},"LeftGUI"),". To update for Windows, replace ",(0,o.kt)("inlineCode",{parentName:"p"},"LeftGuid")," with ",(0,o.kt)("inlineCode",{parentName:"p"},"LeftControl"),".")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/pico"\nimport {\n startButton,\n startHidKeyboard,\n startLightBulb,\n} from "@devicescript/servers"\nimport {\n HidKeyboardAction,\n HidKeyboardModifiers,\n HidKeyboardSelector,\n} from "@devicescript/core"\n\n// the keyboard button mounted on GP14\nconst button = startButton({\n pin: pins.GP14,\n})\n// a status indicator led mounted on GP1\nconst led = startLightBulb({\n pin: pins.GP1,\n})\n// the HID keyboard driver that will send keystrokes\nconst keyboard = startHidKeyboard({})\n\n// true: ctrl+c, false: ctrl+v\nlet copy = true\n// use leftgui on mac or leftcontrol on windows\nlet modifier = HidKeyboardModifiers.LeftGUI\n// uncomment for windows\n// let modifier = HidKeyboardModifiers.LeftControl\n\n// copy and paste on button click\nbutton.down.subscribe(async () => {\n // when copy is true, send ctrl+c\n const selector = copy ? HidKeyboardSelector.C : HidKeyboardSelector.V\n // when copy is true, turn on the led to represent a "full clipboard"\n const brightness = copy ? 1 : 0\n\n // a bit of logging\n console.log(copy ? "ctrl+c" : "ctrl+v")\n await keyboard.key(selector, modifier, HidKeyboardAction.Press)\n await led.intensity.write(brightness)\n // toggle for next round\n copy = !copy\n})\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c7fb68d8.90819256.js b/assets/js/c7fb68d8.90819256.js new file mode 100644 index 00000000000..a2b2d17535d --- /dev/null +++ b/assets/js/c7fb68d8.90819256.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6651],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=s(n),d=a,k=m["".concat(p,".").concat(d)]||m[d]||u[d]||o;return n?r.createElement(k,i(i({ref:t},c),{},{components:n})):r.createElement(k,i({ref:t},c))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},25548:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(25773),a=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Motor service"},i="Motor",l={unversionedId:"api/clients/motor",id:"api/clients/motor",title:"Motor",description:"DeviceScript client for Motor service",source:"@site/docs/api/clients/motor.md",sourceDirName:"api/clients",slug:"/api/clients/motor",permalink:"/devicescript/api/clients/motor",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Motor service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"speed",id:"rw:speed",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"loadTorque",id:"const:loadTorque",level:3},{value:"loadRotationSpeed",id:"const:loadRotationSpeed",level:3},{value:"reversible",id:"const:reversible",level:3}],c={toc:s},m="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"motor"},"Motor"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A DC motor."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:speed"},"speed"),(0,a.kt)("p",null,"Relative speed of the motor. Use positive/negative values to run the motor forwards and backwards.\nPositive is recommended to be clockwise rotation and negative counterclockwise. A speed of ",(0,a.kt)("inlineCode",{parentName:"p"},"0"),"\nwhile ",(0,a.kt)("inlineCode",{parentName:"p"},"enabled")," acts as brake."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i1.15"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nconst value = await motor.speed.read()\nawait motor.speed.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nmotor.speed.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:enabled"},"enabled"),(0,a.kt)("p",null,"Turn the power to the motor on/off."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nconst value = await motor.enabled.read()\nawait motor.enabled.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nmotor.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:loadTorque"},"loadTorque"),(0,a.kt)("p",null,"Torque required to produce the rated power of an electrical motor at load speed."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nconst value = await motor.loadTorque.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:loadRotationSpeed"},"loadRotationSpeed"),(0,a.kt)("p",null,"Revolutions per minute of the motor under full load."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nconst value = await motor.loadRotationSpeed.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:reversible"},"reversible"),(0,a.kt)("p",null,"Indicates if the motor can run backwards."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Motor } from "@devicescript/core"\n\nconst motor = new Motor()\n// ...\nconst value = await motor.reversible.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c818a061.99258223.js b/assets/js/c818a061.99258223.js new file mode 100644 index 00000000000..4e6e07d82cb --- /dev/null +++ b/assets/js/c818a061.99258223.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9407],{35318:(t,e,r)=>{r.d(e,{Zo:()=>s,kt:()=>u});var n=r(27378);function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r,n,a={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(a[r]=t[r]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}var l=n.createContext({}),d=function(t){var e=n.useContext(l),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},s=function(t){var e=d(t.components);return n.createElement(l.Provider,{value:e},t.children)},m="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},g=n.forwardRef((function(t,e){var r=t.components,a=t.mdxType,i=t.originalType,l=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),m=d(r),g=a,u=m["".concat(l,".").concat(g)]||m[g]||c[g]||i;return r?n.createElement(u,p(p({ref:e},s),{},{components:r})):n.createElement(u,p({ref:e},s))}));function u(t,e){var r=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=r.length,p=new Array(i);p[0]=g;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o[m]="string"==typeof t?t:a,p[1]=o;for(var d=2;d<i;d++)p[d]=r[d];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}g.displayName="MDXCreateElement"},43652:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>l,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var n=r(25773),a=(r(27378),r(35318));const i={description:"MSR Brain RP2040 59 v0.1"},p="MSR Brain RP2040 59 v0.1",o={unversionedId:"devices/rp2040/msr59",id:"devices/rp2040/msr59",title:"MSR Brain RP2040 59 v0.1",description:"MSR Brain RP2040 59 v0.1",source:"@site/docs/devices/rp2040/msr59.mdx",sourceDirName:"devices/rp2040",slug:"/devices/rp2040/msr59",permalink:"/devicescript/devices/rp2040/msr59",draft:!1,tags:[],version:"current",frontMatter:{description:"MSR Brain RP2040 59 v0.1"},sidebar:"tutorialSidebar",previous:{title:"MSR RP2040 Brain 124 v0.1",permalink:"/devicescript/devices/rp2040/msr124"},next:{title:"Raspberry Pi Pico W",permalink:"/devicescript/devices/rp2040/pico-w"}},l={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:d},m="wrapper";function c(t){let{components:e,...r}=t;return(0,a.kt)(m,(0,n.Z)({},s,r,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"msr-brain-rp2040-59-v01"},"MSR Brain RP2040 59 v0.1"),(0,a.kt)("p",null,"Prototype board"),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/microsoft-research/rp2040devicescript59v01.catalog.jpg",alt:"MSR Brain RP2040 59 v0.1 picture"})),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Jacdac on pin 9 using Jacdac connector"),(0,a.kt)("li",{parentName:"ul"},"RGB LED on pins 11, 13, 15 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin 2 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: power (auto-start)")),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,a.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P26")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO26"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P27")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO27"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P3")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P4")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P5")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P6")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"jacdac.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,a.kt)("td",{parentName:"tr",align:"right"},"jacdac.pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[0]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[0]",".pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[1]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[1]",".pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[2]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[2]",".pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"log.pinTX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinEn")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO19"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinEn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinFault")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO25"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinFault, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "MSR Brain RP2040 59 v0.1".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/msr59"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board msr59\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-msr59.uf2"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="msr59.json"',title:'"msr59.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",\n "id": "msr59",\n "devName": "MSR Brain RP2040 59 v0.1",\n "productId": "0x35a678a3",\n "$description": "Prototype board",\n "archId": "rp2040",\n "jacdac": {\n "$connector": "Jacdac",\n "pin": 9\n },\n "led": {\n "rgb": [\n {\n "mult": 250,\n "pin": 11\n },\n {\n "mult": 60,\n "pin": 13\n },\n {\n "mult": 150,\n "pin": 15\n }\n ]\n },\n "log": {\n "baud": 115200,\n "pinTX": 2\n },\n "pins": {\n "P26": 26,\n "P27": 27,\n "P3": 3,\n "P4": 4,\n "P5": 5,\n "P6": 6\n },\n "services": [\n {\n "faultIgnoreMs": 100,\n "mode": 2,\n "name": "power",\n "pinEn": 19,\n "pinFault": 25,\n "service": "power"\n }\n ]\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c955ff7d.cc871d79.js b/assets/js/c955ff7d.cc871d79.js new file mode 100644 index 00000000000..8c712109283 --- /dev/null +++ b/assets/js/c955ff7d.cc871d79.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7810],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>v});var n=t(27378);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){o(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function p(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),s=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=s(e.components);return n.createElement(c.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),u=s(t),f=o,v=u["".concat(c,".").concat(f)]||u[f]||d[f]||i;return t?n.createElement(v,a(a({ref:r},l),{},{components:t})):n.createElement(v,a({ref:r},l))}));function v(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var p={};for(var c in r)hasOwnProperty.call(r,c)&&(p[c]=r[c]);p.originalType=e,p[u]="string"==typeof e?e:o,a[1]=p;for(var s=2;s<i;s++)a[s]=t[s];return n.createElement.apply(null,a)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"},94894:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var n=t(25773),o=(t(27378),t(35318));const i={description:"Mounts a power server",title:"Power"},a="Power",p={unversionedId:"api/drivers/power",id:"api/drivers/power",title:"Power",description:"Mounts a power server",source:"@site/docs/api/drivers/power.md",sourceDirName:"api/drivers",slug:"/api/drivers/power",permalink:"/devicescript/api/drivers/power",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a power server",title:"Power"},sidebar:"tutorialSidebar",previous:{title:"Potentiometer",permalink:"/devicescript/api/drivers/potentiometer"},next:{title:"Reflected Light",permalink:"/devicescript/api/drivers/reflectedlight"}},c={},s=[],l={toc:s},u="wrapper";function d(e){let{components:r,...t}=e;return(0,o.kt)(u,(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"power"},"Power"),(0,o.kt)("p",null,"This will generally be configured in the ",(0,o.kt)("a",{parentName:"p",href:"/devices/add-board"},"board.json")," file,\nso the ",(0,o.kt)("inlineCode",{parentName:"p"},"startPower()")," function should not be used."),(0,o.kt)("p",null,"The power service is used to control a current limiter delivering power to the Jacdac bus."),(0,o.kt)("p",null,"See also ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/power"},"power service spec"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ca399add.559afcfa.js b/assets/js/ca399add.559afcfa.js new file mode 100644 index 00000000000..50b169d2911 --- /dev/null +++ b/assets/js/ca399add.559afcfa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4594],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(k,o(o({ref:t},s),{},{components:n})):r.createElement(k,o({ref:t},s))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},83740:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Rotary encoder service"},o="RotaryEncoder",l={unversionedId:"api/clients/rotaryencoder",id:"api/clients/rotaryencoder",title:"RotaryEncoder",description:"DeviceScript client for Rotary encoder service",source:"@site/docs/api/clients/rotaryencoder.md",sourceDirName:"api/clients",slug:"/api/clients/rotaryencoder",permalink:"/devicescript/api/clients/rotaryencoder",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Rotary encoder service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"clicksPerTurn",id:"const:clicksPerTurn",level:3},{value:"clicker",id:"const:clicker",level:3}],s={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(d,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"rotaryencoder"},"RotaryEncoder"),(0,a.kt)("p",null,"An incremental rotary encoder - converts angular motion of a shaft to digital signal."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { RotaryEncoder } from "@devicescript/core"\n\nconst rotaryEncoder = new RotaryEncoder()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Upon device reset starts at ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," (regardless of the shaft position).\nIncreases by ",(0,a.kt)("inlineCode",{parentName:"p"},"1"),' for a clockwise "click", by ',(0,a.kt)("inlineCode",{parentName:"p"},"-1")," for counter-clockwise."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { RotaryEncoder } from "@devicescript/core"\n\nconst rotaryEncoder = new RotaryEncoder()\n// ...\nconst value = await rotaryEncoder.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { RotaryEncoder } from "@devicescript/core"\n\nconst rotaryEncoder = new RotaryEncoder()\n// ...\nrotaryEncoder.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:clicksPerTurn"},"clicksPerTurn"),(0,a.kt)("p",null,"This specifies by how much ",(0,a.kt)("inlineCode",{parentName:"p"},"position")," changes when the crank does 360 degree turn. Typically 12 or 24."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { RotaryEncoder } from "@devicescript/core"\n\nconst rotaryEncoder = new RotaryEncoder()\n// ...\nconst value = await rotaryEncoder.clicksPerTurn.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:clicker"},"clicker"),(0,a.kt)("p",null,"The encoder is combined with a clicker. If this is the case, the clicker button service\nshould follow this service in the service list of the device."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { RotaryEncoder } from "@devicescript/core"\n\nconst rotaryEncoder = new RotaryEncoder()\n// ...\nconst value = await rotaryEncoder.clicker.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ca63cf85.0d30662c.js b/assets/js/ca63cf85.0d30662c.js new file mode 100644 index 00000000000..883a85c02c2 --- /dev/null +++ b/assets/js/ca63cf85.0d30662c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9797],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>v});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),u=a,v=d["".concat(s,".").concat(u)]||d[u]||m[u]||o;return n?r.createElement(v,i(i({ref:t},p),{},{components:n})):r.createElement(v,i({ref:t},p))}));function v(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var c=2;c<o;c++)i[c]=n[c];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},28618:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var r=n(25773),a=(n(27378),n(35318));const o={sidebar_position:10,description:"Learn how to connect a thermostat device to a cloud gateway and configure the desired temperature from the cloud using DeviceScript.",keywords:["thermostat","gateway","devicescript","cloud","temperature control"],hide_table_of_contents:!0},i="Thermostat + Gateway",l={unversionedId:"samples/thermostat-gateway",id:"samples/thermostat-gateway",title:"Thermostat + Gateway",description:"Learn how to connect a thermostat device to a cloud gateway and configure the desired temperature from the cloud using DeviceScript.",source:"@site/docs/samples/thermostat-gateway.mdx",sourceDirName:"samples",slug:"/samples/thermostat-gateway",permalink:"/devicescript/samples/thermostat-gateway",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Learn how to connect a thermostat device to a cloud gateway and configure the desired temperature from the cloud using DeviceScript.",keywords:["thermostat","gateway","devicescript","cloud","temperature control"],hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Homebridge + Humidity Sensor",permalink:"/devicescript/samples/homebridge-humidity"},next:{title:"Workshop",permalink:"/devicescript/samples/workshop/"}},s={},c=[{value:"Development Gateway",id:"development-gateway",level:2},{value:"Telemetry",id:"telemetry",level:2},{value:"Environment variables",id:"environment-variables",level:2},{value:"Environment updates",id:"environment-updates",level:2}],p={toc:c},d="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(d,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"thermostat--gateway"},"Thermostat + Gateway"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"/samples/thermostat"},"Thermostat")," sample showed how to implement a thermostat controller\nusing local data. This part 2 of the sample shows how to connect the device to a cloud gateway and configure\nthe desired temperature from the cloud."),(0,a.kt)("h2",{id:"development-gateway"},"Development Gateway"),(0,a.kt)("p",null,"Start by setting up a ",(0,a.kt)("a",{parentName:"p",href:"/developer/development-gateway/gateway"},"Development Gateway")," and connecting the ESP to it."),(0,a.kt)("h2",{id:"telemetry"},"Telemetry"),(0,a.kt)("p",null,"Just like any web or desktop app, a DeviceScript app can be instrumented with ",(0,a.kt)("a",{parentName:"p",href:"/developer/development-gateway/telemetry"},"telemetry")," to get insights into\nhow it is behaving."),(0,a.kt)("p",null,"For example, we instrument the code to notify the cloud whenever the relay is enabled or disabled."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { Temperature } from "@devicescript/core"\nimport { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"\nimport { startRelay } from "@devicescript/servers"\nimport { trackEvent } from "@devicescript/cloud"\n\nconst thermometer = new Temperature()\nconst t_ref = 68 // degree F\nconst relay = startRelay({\n pin: pins.A0_D0,\n})\n\nthermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n auditTime(5000),\n tap(t_audit => console.data({ t_audit })),\n levelDetector(t_ref - 1, t_ref + 1),\n tap(level => console.data({ level }))\n )\n .subscribe(async level => {\n const enabled = await relay.enabled.read()\n const newEnabled = level < 0 ? true : level > 0 ? false : enabled\n await relay.enabled.write(newEnabled)\n // highlight-next-line\n if (enabled !== newEnabled)\n await trackEvent("relay.change", {\n properties: { active: newEnabled ? "on" : "off" },\n })\n })\n')),(0,a.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,a.kt)("p",null,"If you connect the ESP to the ",(0,a.kt)("a",{parentName:"p",href:"/developer/development-gateway/gateway"},"Development Gateway"),",\nyou can use environment variables configured in the cloud rather constants in the code."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"environment")," function from ",(0,a.kt)("inlineCode",{parentName:"p"},"@devicescript/cloud")," downloads and caches the environment variables from the cloud."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { Temperature } from "@devicescript/core"\nimport { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"\nimport { startRelay } from "@devicescript/servers"\n// highlight-next-line\nimport { environment } from "@devicescript/cloud"\n\nconst thermometer = new Temperature()\nconst relay = startRelay({\n pin: pins.A0_D0,\n})\n// highlight-start\nconst env = await environment<{ t_ref: number }>({ t_ref: 68 })\nconst { t_ref } = await env.read()\n// highlight-end\n\nthermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n auditTime(5000),\n tap(t_audit => console.data({ t_audit })),\n levelDetector(t_ref - 1, t_ref + 1),\n tap(level => console.data({ level }))\n )\n .subscribe(async level => {\n if (level < 0) await relay.enabled.write(true)\n else if (level > 0) await relay.enabled.write(false)\n console.data({ relay: await relay.enabled.read() })\n })\n')),(0,a.kt)("h2",{id:"environment-updates"},"Environment updates"),(0,a.kt)("p",null,"The environment variables can be updated in the cloud at any time.\nWe can track the changes and update the relay accordingly."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/adafruit_qt_py_c3"\nimport { Temperature } from "@devicescript/core"\nimport {\n ewma,\n tap,\n auditTime,\n levelDetector,\n Subscription,\n} from "@devicescript/observables"\nimport { startRelay } from "@devicescript/servers"\n// highlight-next-line\nimport { environment } from "@devicescript/cloud"\n\nconst thermometer = new ds.Temperature()\nconst relay = startRelay({\n pin: pins.A0_D0,\n})\nconst env = await environment<{ t_ref: number }>({ t_ref: 68 })\nlet sub: Subscription\nconst controlTemperature = async () => {\n // cleanup previous loop\n if (sub) sub.unsubscribe()\n\n // start new control loop\n const { t_ref } = await env.read()\n sub = thermometer.reading\n .pipe(\n tap(t_raw => console.data({ t_raw })),\n ewma(0.9),\n tap(t_ewma => console.data({ t_ewma })),\n auditTime(5000),\n tap(t_audit => console.data({ t_audit })),\n levelDetector(t_ref - 1, t_ref + 1),\n tap(level => console.data({ level }))\n )\n .subscribe(async level => {\n if (level < 0) await relay.enabled.write(true)\n else if (level > 0) await relay.enabled.write(false)\n console.data({ relay: await relay.enabled.read() })\n })\n}\n\n// hightline-next-line\nenv.subscribe(controlTemperature)\nawait controlTemperature()\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cbfba0ab.a648d417.js b/assets/js/cbfba0ab.a648d417.js new file mode 100644 index 00000000000..69337ac7def --- /dev/null +++ b/assets/js/cbfba0ab.a648d417.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7684],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>v});var i=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var c=i.createContext({}),l=function(e){var t=i.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return i.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=n,v=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?i.createElement(v,o(o({ref:t},p),{},{components:r})):i.createElement(v,o({ref:t},p))}));function v(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,o=new Array(a);o[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[d]="string"==typeof e?e:n,o[1]=s;for(var l=2;l<a;l++)o[l]=r[l];return i.createElement.apply(null,o)}return i.createElement.apply(null,r)}m.displayName="MDXCreateElement"},12174:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var i=r(25773),n=(r(27378),r(35318));const a={sidebar_position:2},o="Simulation",s={unversionedId:"getting-started/vscode/simulation",id:"getting-started/vscode/simulation",title:"Simulation",description:"DeviceScript provides a rich support for simulating devices and peripherals.",source:"@site/docs/getting-started/vscode/simulation.mdx",sourceDirName:"getting-started/vscode",slug:"/getting-started/vscode/simulation",permalink:"/devicescript/getting-started/vscode/simulation",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Visual Studio Code Extension",permalink:"/devicescript/getting-started/vscode/"},next:{title:"User Interface",permalink:"/devicescript/getting-started/vscode/user-interface"}},c={},l=[{value:"DeviceScript simulator",id:"devicescript-simulator",level:2},{value:"Peripherals dashboard",id:"peripherals-dashboard",level:2},{value:"Custom servers",id:"custom-servers",level:2}],p={toc:l},d="wrapper";function u(e){let{components:t,...a}=e;return(0,n.kt)(d,(0,i.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"simulation"},"Simulation"),(0,n.kt)("p",null,"DeviceScript provides a rich support for simulating devices and peripherals.\nThe Visual Studio Code extension makes it easy to start and stop simulators."),(0,n.kt)("h2",{id:"devicescript-simulator"},"DeviceScript simulator"),(0,n.kt)("p",null,"The first simulator you use is a DeviceScript Manager device, a device capable of running the DeviceScript bytecode.\nIt runs the DeviceScript C firmware compiled into WebAssembly.\nThis WASM simulator will be launched by the debugger or by clicking on the ",(0,n.kt)("inlineCode",{parentName:"p"},"plug")," icon in the DeviceScript pane."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Connect button in DeviceScript pane",src:r(57332).Z,width:"784",height:"510"})),(0,n.kt)("p",null,"Once started the simulator will appear in the device tree and you can explore its services and status."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"simulator tree",src:r(11696).Z,width:"788",height:"804"})),(0,n.kt)("h2",{id:"peripherals-dashboard"},"Peripherals dashboard"),(0,n.kt)("p",null,"The ",(0,n.kt)("inlineCode",{parentName:"p"},"dashboard")," icon starts a peripheral dashboard view.\nIt allows to visualize any connected device and also launch simulator peripherals.\nThe simulator peripheral are typically interactive and allow to change the values using UI controls."),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Dashboard",src:r(3994).Z,width:"1380",height:"528"})),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},"The dashboard requires internet access.")),(0,n.kt)("h2",{id:"custom-servers"},"Custom servers"),(0,n.kt)("p",null,'It is also possible to create peripheral simulators in "node.js TypeScript" (running in a node.js process).\nThis technique is documented in the ',(0,n.kt)("a",{parentName:"p",href:"/developer/simulation"},"developer documentation"),"."))}u.isMDXComponent=!0},57332:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/connect-button-0bd8798d45dcd18bfee97226549aad59.png"},11696:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/simulator-tree-5c38631c760a21ce4214ecd94b51a123.png"},3994:(e,t,r)=>{r.d(t,{Z:()=>i});const i=r.p+"assets/images/start-simulator-dashboard-a83a4c119a01656342c3f934001bba98.png"}}]); \ No newline at end of file diff --git a/assets/js/ce847cce.7b35b9a7.js b/assets/js/ce847cce.7b35b9a7.js new file mode 100644 index 00000000000..33976d7c111 --- /dev/null +++ b/assets/js/ce847cce.7b35b9a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2260],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var i=t(27378);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function o(e,r){if(null==e)return{};var t,i,n=function(e,r){if(null==e)return{};var t,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)t=a[i],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)t=a[i],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var p=i.createContext({}),c=function(e){var r=i.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=c(e.components);return i.createElement(p.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return i.createElement(i.Fragment,{},r)}},m=i.forwardRef((function(e,r){var t=e.components,n=e.mdxType,a=e.originalType,p=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),d=c(t),m=n,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return t?i.createElement(f,s(s({ref:r},l),{},{components:t})):i.createElement(f,s({ref:r},l))}));function f(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var a=t.length,s=new Array(a);s[0]=m;var o={};for(var p in r)hasOwnProperty.call(r,p)&&(o[p]=r[p]);o.originalType=e,o[d]="string"==typeof e?e:n,s[1]=o;for(var c=2;c<a;c++)s[c]=t[c];return i.createElement.apply(null,s)}return i.createElement.apply(null,t)}m.displayName="MDXCreateElement"},1259:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var i=t(25773),n=(t(27378),t(35318));const a={title:"ST7735, ILI9163, ST7789"},s="ST7735, ILI9163, ST7789",o={unversionedId:"api/drivers/st7789",id:"api/drivers/st7789",title:"ST7735, ILI9163, ST7789",description:"Driver for ST7735, ST7789 and similar LCD screens using SPI.",source:"@site/docs/api/drivers/st7789.mdx",sourceDirName:"api/drivers",slug:"/api/drivers/st7789",permalink:"/devicescript/api/drivers/st7789",draft:!1,tags:[],version:"current",frontMatter:{title:"ST7735, ILI9163, ST7789"},sidebar:"tutorialSidebar",previous:{title:"SSD1306",permalink:"/devicescript/api/drivers/ssd1306"},next:{title:"Switch",permalink:"/devicescript/api/drivers/switch"}},p={},c=[{value:"Hardware configuration",id:"hardware-configuration",level:2},{value:"Display",id:"display",level:2},{value:"Driver",id:"driver",level:2}],l={toc:c},d="wrapper";function u(e){let{components:r,...t}=e;return(0,n.kt)(d,(0,i.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"st7735-ili9163-st7789"},"ST7735, ILI9163, ST7789"),(0,n.kt)("p",null,"Driver for ST7735, ST7789 and similar LCD screens using SPI.\nThe ST7735 driver also works for ILI9163C.\nILI9341 should be ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/issues/568"},"easy to add"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { ST7789Driver } from "@devicescript/drivers"\nimport { ST7735Driver } from "@devicescript/drivers"\n')),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.waveshare.com/w/upload/a/ae/ST7789_Datasheet.pdf"},"Datasheet for ST7789")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.displayfuture.com/Display/datasheet/controller/ST7735.pdf"},"Datasheet for ST7735"))),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://github.com/mmoskal/devicescript-waveshare-pico-lcd/blob/main/assets/pico-lcd-114.png?raw=true",alt:"WaveShare Pico-LCD shield"})),(0,n.kt)("admonition",{title:"I8080 not supported",type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"The drivers use the SPI interface. The parralel interface (I8080) is not supported at the moment.")),(0,n.kt)("h2",{id:"hardware-configuration"},"Hardware configuration"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Configure the SPI connection")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { spi } from "@devicescript/spi"\nimport { pins } from "@dsboard/pico_w"\n\nspi.configure({\n mosi: pins.GP11,\n sck: pins.GP10,\n hz: 8_000_000,\n})\n')),(0,n.kt)("h2",{id:"display"},"Display"),(0,n.kt)("p",null,"The driver implements the ",(0,n.kt)("a",{parentName:"p",href:"/developer/graphics/display"},"Display")," interface and can be used as various services.\nUsing the driver through services provides a better simulation experience."),(0,n.kt)("h2",{id:"driver"},"Driver"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript/blob/main/packages/drivers/src/st7735.ts"},"Source"))),(0,n.kt)("p",null,"The ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/mmoskal/devicescript-waveshare-pico-lcd/blob/main/src/picolcd114.ts"},"devicescript-waveshare-pico-lcd"),"\nuses the driver for a ",(0,n.kt)("a",{parentName:"p",href:"https://www.waveshare.com/pico-lcd-1.14.htm"},"WaveShare Pico-LCD")," shield."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import * as ds from "@devicescript/core"\nimport { spi } from "@devicescript/spi"\nimport { pins } from "@dsboard/pico_w"\nimport { ST7789Driver } from "@devicescript/drivers"\nimport { Image } from "@devicescript/graphics"\n\nspi.configure({\n mosi: pins.GP11,\n sck: pins.GP10,\n hz: 8_000_000,\n})\n\n// backlight led\npins.GP13.setMode(ds.GPIOMode.OutputHigh)\n\nconst display = new ST7789Driver(Image.alloc(240, 136, 4), {\n dc: pins.GP8,\n cs: pins.GP9,\n reset: pins.GP12,\n // frmctr1: 0x0e_14_ff,\n flip: false,\n spi: spi,\n offX: 40,\n offY: 53,\n})\nawait display.init()\ndisplay.image.print("Hello world!", 3, 10)\nawait display.show()\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cea52501.d607efe9.js b/assets/js/cea52501.d607efe9.js new file mode 100644 index 00000000000..4aa076ad23e --- /dev/null +++ b/assets/js/cea52501.d607efe9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2605],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),d=a,h=u["".concat(l,".").concat(d)]||u[d]||m[d]||i;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},6743:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(25773),a=(n(27378),n(35318));const i={sidebar_position:10,title:"JSX/TSX"},o="JSX/TSX",s={unversionedId:"developer/jsx",id:"developer/jsx",title:"JSX/TSX",description:"JSX is an embeddable XML-like syntax (.tsx for TypeScript files).",source:"@site/docs/developer/jsx.mdx",sourceDirName:"developer",slug:"/developer/jsx",permalink:"/devicescript/developer/jsx",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10,title:"JSX/TSX"},sidebar:"tutorialSidebar",previous:{title:"Display",permalink:"/devicescript/developer/graphics/display"},next:{title:"LEDs",permalink:"/devicescript/developer/leds/"}},l={},p=[{value:"Sample",id:"sample",level:2},{value:"Where are the UI frameworks?!!?!",id:"where-are-the-ui-frameworks",level:2}],c={toc:p},u="wrapper";function m(e){let{components:t,...i}=e;return(0,a.kt)(u,(0,r.Z)({},c,i,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"jsxtsx"},"JSX/TSX"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/docs/handbook/jsx.html"},"JSX")," is an embeddable XML-like syntax (.tsx for TypeScript files).\nIt is meant to be transformed into valid JavaScript,\nthough the semantics of that transformation are implementation-specific.\nJSX rose to popularity with the ",(0,a.kt)("a",{parentName:"p",href:"https://react.dev/"},"React")," framework,\nbut has since seen other implementations as well. TypeScript supports embedding, type checking, and compiling JSX directly to JavaScript."),(0,a.kt)("p",null,"DeviceScript supports TSX compilation as documented in the TypeScript documentation."),(0,a.kt)("h2",{id:"sample"},"Sample"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/tree/main/packages/sampleui"},"sampleui")," package is a sample UI framework based on a set of TSX functional components.\nIt is designed to be used with small OLED screens using the ",(0,a.kt)("a",{parentName:"p",href:"/developer/graphics"},"graphics")," package."),(0,a.kt)("p",null,"This snippet show a potential use of the JSX syntax to render a progress bar on a screen."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"A progress bar screenshot",src:n(67218).Z,width:"582",height:"516"})),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-tsx",metastring:"skip",skip:!0},"pot.reading.subscribe(async (pos: number) => {\n await renderOnImage(\n <HorizontalGauge\n y={12}\n width={image.width}\n height={12}\n value={pos}\n showPercent={true}\n />,\n image\n )\n await ssd.show()\n})\n")),(0,a.kt)("p",null,"If you are familiar with React developement, the implementation of ",(0,a.kt)("inlineCode",{parentName:"p"},"HorizontalGauge")," will feel familiar."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-tsx",metastring:"skip",skip:!0},'export function HorizontalGauge(props: {\n x?: number\n y?: number\n width: number\n height: number\n value: number\n showPercent?: boolean\n}): JSX.Element {\n const { x, y, width, height, value, showPercent } = props\n const w = Math.round((width - 4) * value)\n const fc = value > 0.5 ? 0 : 1\n return (\n <Translate x={x} y={y}>\n <Rect width={width} height={height}></Rect>\n <FillRect x={2} y={2} width={w} height={height - 4} />\n {!!showPercent && (\n <Style fillColor={fc}>\n <Text x={width / 2} y={2}>\n {Math.round(value * 100) + "%"}\n </Text>\n </Style>\n )}\n </Translate>\n )\n}\n')),(0,a.kt)("h2",{id:"where-are-the-ui-frameworks"},"Where are the UI frameworks?!!?!"),(0,a.kt)("p",null,"We do not provide a fully fledge UI framework on top of the JSX compilation support.\nThe sample is very limited (no layout, no dom, no virtual DOM, ...).\nIf you feel up to the challenge, we recommend having a try at it!"))}m.isMDXComponent=!0},67218:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/jsx-bb7adf23a927bba0724325c97df19da2.png"}}]); \ No newline at end of file diff --git a/assets/js/d1067852.a7584424.js b/assets/js/d1067852.a7584424.js new file mode 100644 index 00000000000..3cef70a44af --- /dev/null +++ b/assets/js/d1067852.a7584424.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5635],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=s(n),m=r,h=c["".concat(p,".").concat(m)]||c[m]||u[m]||i;return n?a.createElement(h,o(o({ref:t},d),{},{components:n})):a.createElement(h,o({ref:t},d))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:r,o[1]=l;for(var s=2;s<i;s++)o[s]=n[s];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},82174:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Power service"},o="Power",l={unversionedId:"api/clients/power",id:"api/clients/power",title:"Power",description:"DeviceScript client for Power service",source:"@site/docs/api/clients/power.md",sourceDirName:"api/clients",slug:"/api/clients/power",permalink:"/devicescript/api/clients/power",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Power service"},sidebar:"tutorialSidebar"},p={},s=[{value:"About",id:"about",level:2},{value:"Power negotiation protocol",id:"power-negotiation-protocol",level:2},{value:"Protocol details",id:"protocol-details",level:3},{value:"Client notes",id:"client-notes",level:3},{value:"Server implementation notes",id:"server-implementation-notes",level:3},{value:"A dedicated MCU per channel",id:"a-dedicated-mcu-per-channel",level:4},{value:"A shared MCU for multiple channels",id:"a-shared-mcu-for-multiple-channels",level:4},{value:"A brain-integrated power supply",id:"a-brain-integrated-power-supply",level:4},{value:"Rationale for the grace period",id:"rationale-for-the-grace-period",level:3},{value:"Rationale for timings",id:"rationale-for-timings",level:3},{value:"Commands",id:"commands",level:2},{value:"shutdown",id:"shutdown",level:3},{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"maxPower",id:"rw:maxPower",level:3},{value:"powerStatus",id:"ro:powerStatus",level:3},{value:"reading",id:"ro:reading",level:3},{value:"batteryVoltage",id:"ro:batteryVoltage",level:3},{value:"batteryCharge",id:"ro:batteryCharge",level:3},{value:"batteryCapacity",id:"const:batteryCapacity",level:3},{value:"keepOnPulseDuration",id:"rw:keepOnPulseDuration",level:3},{value:"keepOnPulsePeriod",id:"rw:keepOnPulsePeriod",level:3},{value:"Events",id:"events",level:2},{value:"change",id:"change",level:3}],d={toc:s},c="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(c,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"power"},"Power"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,r.kt)("p",null,"A power-provider service."),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"about"},"About"),(0,r.kt)("h2",{id:"power-negotiation-protocol"},"Power negotiation protocol"),(0,r.kt)("p",null,"The purpose of the power negotiation is to ensure that there is no more than ",(0,r.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers"},"I",(0,r.kt)("sub",null,"out_hc(max)"))," delivered to the power rail.\nThis is realized by limiting the number of enabled power provider services to one."),(0,r.kt)("p",null,"Note, that it's also possible to have low-current power providers,\nwhich are limited to ",(0,r.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers"},"I",(0,r.kt)("sub",null,"out_lc(max)"))," and do not run a power provider service.\nThese are ",(0,r.kt)("strong",{parentName:"p"},"not")," accounted for in the power negotiation protocol."),(0,r.kt)("p",null,"Power providers can have multiple ",(0,r.kt)("em",{parentName:"p"},"channels"),", typically multiple Jacdac ports on the provider.\nEach channel can be limited to ",(0,r.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers"},"I",(0,r.kt)("sub",null,"out_hc(max)"))," separately.\nIn normal operation, the data lines of each channels are connected together.\nThe ground lines are always connected together.\nMulti-channel power providers are also called ",(0,r.kt)("em",{parentName:"p"},"powered hubs"),"."),(0,r.kt)("p",null,"While channels have separate current limits, there's nothing to prevent the user\nfrom joining two or more channels outside of the provider using a passive hub.\nThis would allow more than ",(0,r.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers"},"I",(0,r.kt)("sub",null,"out_hc(max)"))," of current to be drawn, resulting in cables or components\ngetting hot and/or malfunctioning.\nThus, the power negotiation protocol seeks to detect situations where\nmultiple channels of power provider(s) are bridged together\nand shut down all but one of the channels involved."),(0,r.kt)("p",null,"The protocol is built around the power providers periodically sending specially crafted\n",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," commands in broadcast mode.\nNote that this is unusual - services typically only send reports."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," commands can be reliably identified based on their first half (more details below).\nWhen a power provider starts receiving a ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command, it needs to take\nsteps to identify which of its channels the command is coming from.\nThis is typically realized with analog switches between the data lines of channels.\nThe delivery of power over the channel which received the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command is then shut down.\nNote that in the case of a single-channel provider, any received ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command will cause a shut down."),(0,r.kt)("p",null,"A multi-channel provider needs to also identify when a ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command it sent from one channel\nis received on any of its other channels and shut down one of the channels involved."),(0,r.kt)("p",null,"It is also possible to build a ",(0,r.kt)("em",{parentName:"p"},"data bridge")," device, with two or more ports.\nIt passes through all data except for ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," commands,\nbut ",(0,r.kt)("strong",{parentName:"p"},"does not")," connect the power lines."),(0,r.kt)("h3",{id:"protocol-details"},"Protocol details"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," commands follow a very narrow format:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"they need to be the only packet in the frame (and thus we can also call them ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," frames)"),(0,r.kt)("li",{parentName:"ul"},"the second word of ",(0,r.kt)("inlineCode",{parentName:"li"},"device_id")," needs to be set to ",(0,r.kt)("inlineCode",{parentName:"li"},"0xAA_AA_AA_AA")," (alternating 0 and 1)"),(0,r.kt)("li",{parentName:"ul"},"the service index is set to ",(0,r.kt)("inlineCode",{parentName:"li"},"0x3d")),(0,r.kt)("li",{parentName:"ul"},"the CRC is therefore fixed"),(0,r.kt)("li",{parentName:"ul"},"therefore, the packet can be recognized by reading the first 8 bytes (total length is 16 bytes)")),(0,r.kt)("p",null,"The exact byte structure of ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command is:\n",(0,r.kt)("inlineCode",{parentName:"p"},"15 59 04 05 5A C9 A4 1F AA AA AA AA 00 3D 80 00")),(0,r.kt)("p",null,"There is one power service per channel.\nA multi-channel power provider can be implemented as one device with multiple services (typically with one MCU),\nor many devices with one service each (typically multiple MCUs).\nThe first option is preferred as it fixes the order of channels,\nbut the second option may be cheaper to implement."),(0,r.kt)("p",null,"After queuing a ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command, the service enters a grace period\nuntil the report has been sent on the wire.\nDuring the grace period incoming ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," commands are ignored."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Upon reset, a power service enables itself, and then only after 0-300ms (random)\nsends the first ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," command"),(0,r.kt)("li",{parentName:"ul"},"Every enabled power service emits ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," commands every 400-600ms (random; first few packets can be even sent more often)"),(0,r.kt)("li",{parentName:"ul"},"If an enabled power service sees a ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," command from somebody else,\nit disables itself (unless in grace period)"),(0,r.kt)("li",{parentName:"ul"},"If a disabled power service sees no ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," command for more than ~1200ms, it enables itself\n(this is when the previous power source is unplugged or otherwise malfunctions)"),(0,r.kt)("li",{parentName:"ul"},"If a power service has been disabled for around 10s, it enables itself.")),(0,r.kt)("p",null,"Additionally:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"While the ",(0,r.kt)("inlineCode",{parentName:"li"},"allowed")," register is set to ",(0,r.kt)("inlineCode",{parentName:"li"},"0"),", the service will not enable itself (nor send ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," commands)"),(0,r.kt)("li",{parentName:"ul"},"When a current overdraw is detected, the service stop providing power and enters ",(0,r.kt)("inlineCode",{parentName:"li"},"Overload")," state for around 2 seconds,\nwhile still sending ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," commands.")),(0,r.kt)("h3",{id:"client-notes"},"Client notes"),(0,r.kt)("p",null,"If a client hears a ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command it just means it's on a branch of the\nnetwork with a (high) power provider.\nAs clients (brains) typically do not consume much current (as opposed to, say, servos),\nthe ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," commands are typically irrelevant to them."),(0,r.kt)("p",null,"For power monitoring, the ",(0,r.kt)("inlineCode",{parentName:"p"},"power_status_changed")," event (and possibly ",(0,r.kt)("inlineCode",{parentName:"p"},"power_status")," register)\ncan be used.\nIn particular, user interfaces may alert the user to ",(0,r.kt)("inlineCode",{parentName:"p"},"Overload")," status.\nThe ",(0,r.kt)("inlineCode",{parentName:"p"},"Overprovision")," status is generally considered normal (eg. when two multi-channel power providers are linked together)."),(0,r.kt)("h3",{id:"server-implementation-notes"},"Server implementation notes"),(0,r.kt)("h4",{id:"a-dedicated-mcu-per-channel"},"A dedicated MCU per channel"),(0,r.kt)("p",null,"Every channel has:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"a cheap 8-bit MCU (e.g. PMS150C, PFS122),"),(0,r.kt)("li",{parentName:"ul"},"a current limiter with FAULT output and ENABLE input, and"),(0,r.kt)("li",{parentName:"ul"},"an analog switch.")),(0,r.kt)("p",null,"The MCU here needs at least 4 pins per channel.\nIt is connected to data line of the channel, the control input of the switch, and to the current limiter's FAULT and ENABLE pins."),(0,r.kt)("p",null,"The switch connects the data line of the channel (JD_DATA_CHx) with the internal shared data bus, common to all channels (JD_DATA_COM).\nBoth the switch and the limiter are controlled by the MCU.\nA latching circuit is not needed for the limiter because the MCU will detect an overcurrent fault and shut it down immediately. "),(0,r.kt)("p",null,"During reception, after the beginning of ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," frame is detected,\nthe switch is opened for a brief period.\nIf the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," frame is received correctly, it means it was on MCU's channel."),(0,r.kt)("p",null,"In the case of only one power delivery channel that's controlled by a dedicated MCU, the analog switch is not necessary. "),(0,r.kt)("h4",{id:"a-shared-mcu-for-multiple-channels"},"A shared MCU for multiple channels"),(0,r.kt)("p",null,"Every channel has:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"a current limiter with FAULT output and ENABLE input, "),(0,r.kt)("li",{parentName:"ul"},"an analog switch, and"),(0,r.kt)("li",{parentName:"ul"},"a wiggle-detection line connecting the MCU to data line of the channel")),(0,r.kt)("p",null,"The MCU again needs at least 4 pins per channel.\nSwitches and limiters are set up like in the configuration above.\nThe Jacdac data line of the MCU is connected to internal data bus."),(0,r.kt)("p",null,"While a Jacdac packet is being received, the MCU keeps checking if it is a\nbeginning of the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," frame.\nIf that is the case, it opens all switches and checks which one(s) of the channel\ndata lines wiggle (via the wiggle lines; this can be done with EXTI latches).\nThe one(s) that wiggle received the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," frame and need to be disabled."),(0,r.kt)("p",null,"Also, while sending the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," frames itself, it needs to be done separately\nfor each channel, with all the other switches open.\nIf during that operation we detect wiggle on other channels, then we have detected\na loop, and the respective channels needs to be disabled."),(0,r.kt)("h4",{id:"a-brain-integrated-power-supply"},"A brain-integrated power supply"),(0,r.kt)("p",null,"Here, there's only one channel of power and we don't have hard real time requirements,\nso user-programmable brain can control it.\nThere is no need for analog switch or wiggle-detection line,\nbut a current limiter with a latching circuit is needed."),(0,r.kt)("p",null,"There is nothing special to do during reception of ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," packet.\nWhen it is received, the current limiter should just be disabled."),(0,r.kt)("p",null,"Ideally, exception/hard-fault handlers on the MCU should also disable the current limiter.\nSimilarly, the limiter should be disabled while the MCU is in bootloader mode,\nor otherwise unaware of the power negotiation protocol. "),(0,r.kt)("h3",{id:"rationale-for-the-grace-period"},"Rationale for the grace period"),(0,r.kt)("p",null,"Consider the following scenario:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"device A queues ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," command for sending"),(0,r.kt)("li",{parentName:"ul"},"A receives external ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," packet from B (thus disabling A)"),(0,r.kt)("li",{parentName:"ul"},"the A ",(0,r.kt)("inlineCode",{parentName:"li"},"shutdown")," command is sent from the queue (thus eventually disabling B)")),(0,r.kt)("p",null,"To avoid that, we make sure that at the precise instant when ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command is sent,\nthe power is enabled (and thus will stay enabled until another ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," command arrives).\nThis could be achieved by inspecting the enable bit, aftering acquiring the line\nand before starting UART transmission, however that would require breaking abstraction layers.\nSo instead, we never disable the service, while the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," packet is queued.\nThis may lead to delays in disabling power services, but these should be limited due to the\nrandom nature of the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," packet spacing."),(0,r.kt)("h3",{id:"rationale-for-timings"},"Rationale for timings"),(0,r.kt)("p",null,"The initial 0-300ms delay is set to spread out the ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," periods of power services,\nto minimize collisions.\nThe ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," periods are randomized 400-600ms, instead of a fixed 500ms used for regular\nservices, for the same reason."),(0,r.kt)("p",null,"The 1200ms period is set so that droping two ",(0,r.kt)("inlineCode",{parentName:"p"},"shutdown")," packets in a row\nfrom the current provider will not cause power switch, while missing 3 will."),(0,r.kt)("p",null,"The 50-60s power switch period is arbitrary, but chosen to limit amount of switching between supplies,\nwhile keeping it short enough for user to notice any problems such switching may cause."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"shutdown"},"shutdown"),(0,r.kt)("p",null,"Sent by the power service periodically, as broadcast."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"power.shutdown(): Promise<void>\n")),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:enabled"},"enabled"),(0,r.kt)("p",null,"Can be used to completely disable the service.\nWhen allowed, the service may still not be providing power, see\n",(0,r.kt)("inlineCode",{parentName:"p"},"power_status")," for the actual current state."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.enabled.read()\nawait power.enabled.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:maxPower"},"maxPower"),(0,r.kt)("p",null,"Limit the power provided by the service. The actual maximum limit will depend on hardware.\nThis field may be read-only in some implementations - you should read it back after setting."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.maxPower.read()\nawait power.maxPower.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.maxPower.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:powerStatus"},"powerStatus"),(0,r.kt)("p",null,"Indicates whether the power provider is currently providing power (",(0,r.kt)("inlineCode",{parentName:"p"},"Powering")," state), and if not, why not.\n",(0,r.kt)("inlineCode",{parentName:"p"},"Overprovision")," means there was another power provider, and we stopped not to overprovision the bus."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.powerStatus.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.powerStatus.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:reading"},"reading"),(0,r.kt)("p",null,"Present current draw from the bus."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.reading.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.reading.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:batteryVoltage"},"batteryVoltage"),(0,r.kt)("p",null,"Voltage on input."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.batteryVoltage.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.batteryVoltage.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"ro:batteryCharge"},"batteryCharge"),(0,r.kt)("p",null,"Fraction of charge in the battery."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.batteryCharge.read()\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.batteryCharge.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:batteryCapacity"},"batteryCapacity"),(0,r.kt)("p",null,"Energy that can be delivered to the bus when battery is fully charged.\nThis excludes conversion overheads if any."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.batteryCapacity.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:keepOnPulseDuration"},"keepOnPulseDuration"),(0,r.kt)("p",null,"Many USB power packs need current to be drawn from time to time to prevent shutdown.\nThis regulates how often and for how long such current is drawn.\nTypically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.keepOnPulseDuration.read()\nawait power.keepOnPulseDuration.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.keepOnPulseDuration.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:keepOnPulsePeriod"},"keepOnPulsePeriod"),(0,r.kt)("p",null,"Many USB power packs need current to be drawn from time to time to prevent shutdown.\nThis regulates how often and for how long such current is drawn.\nTypically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\nconst value = await power.keepOnPulsePeriod.read()\nawait power.keepOnPulsePeriod.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Power } from "@devicescript/core"\n\nconst power = new Power()\n// ...\npower.keepOnPulsePeriod.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h2",{id:"events"},"Events"),(0,r.kt)("h3",{id:"change"},"change"),(0,r.kt)("p",null,"Emitted whenever ",(0,r.kt)("inlineCode",{parentName:"p"},"power_status")," changes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"power.change.subscribe(() => {\n\n})\n")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d1201f8d.2ce6c11a.js b/assets/js/d1201f8d.2ce6c11a.js new file mode 100644 index 00000000000..dbcc7f69b87 --- /dev/null +++ b/assets/js/d1201f8d.2ce6c11a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2362],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=a.createContext({}),m=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},s=function(e){var t=m(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,l=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=m(n),c=i,k=d["".concat(o,".").concat(c)]||d[c]||u[c]||l;return n?a.createElement(k,r(r({ref:t},s),{},{components:n})):a.createElement(k,r({ref:t},s))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var l=n.length,r=new Array(l);r[0]=c;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:i,r[1]=p;for(var m=2;m<l;m++)r[m]=n[m];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},85442:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var a=n(25773),i=(n(27378),n(35318));const l={pagination_prev:null,pagination_next:null,description:"DeviceScript client for LED Strip service"},r="LedStrip",p={unversionedId:"api/clients/ledstrip",id:"api/clients/ledstrip",title:"LedStrip",description:"DeviceScript client for LED Strip service",source:"@site/docs/api/clients/ledstrip.md",sourceDirName:"api/clients",slug:"/api/clients/ledstrip",permalink:"/devicescript/api/clients/ledstrip",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for LED Strip service"},sidebar:"tutorialSidebar"},o={},m=[{value:"About",id:"about",level:2},{value:"Light programs",id:"light-programs",level:2},{value:"Commands",id:"commands",level:2},{value:"run",id:"run",level:3},{value:"Registers",id:"registers",level:2},{value:"intensity",id:"rw:intensity",level:3},{value:"actualBrightness",id:"ro:actualBrightness",level:3},{value:"lightType",id:"rw:lightType",level:3},{value:"numPixels",id:"rw:numPixels",level:3},{value:"numColumns",id:"rw:numColumns",level:3},{value:"maxPower",id:"rw:maxPower",level:3},{value:"maxPixels",id:"const:maxPixels",level:3},{value:"numRepeats",id:"rw:numRepeats",level:3},{value:"variant",id:"const:variant",level:3},{value:"Syntax",id:"syntax",level:2},{value:"Commands",id:"commands-1",level:3},{value:"Examples",id:"examples",level:3}],s={toc:m},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ledstrip"},"LedStrip"),(0,i.kt)("p",null,"A controller for strips of individually controlled RGB LEDs."),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"about"},"About"),(0,i.kt)("h2",{id:"light-programs"},"Light programs"),(0,i.kt)("p",null,"With 1 mbit Jacdac, we can transmit under 2k of data per animation frame (at 20fps).\nIf transmitting raw data that would be around 500 pixels, which is not enough for many\ninstallations and it would completely clog the network."),(0,i.kt)("p",null,"Thus, light service defines a domain-specific language for describing light animations\nand efficiently transmitting them over wire. For short LED displays, less than 64 LEDs,\nyou can also use the ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/led"},"LED service"),"."),(0,i.kt)("p",null,"Light commands are not Jacdac commands.\nLight commands are efficiently encoded as sequences of bytes and typically sent as payload\nof ",(0,i.kt)("inlineCode",{parentName:"p"},"run")," command."),(0,i.kt)("p",null,"Definitions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"P")," - position in the strip"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"R")," - number of repetitions of the command"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"N")," - number of pixels affected by the command"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"C")," - single color designation"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"C+")," - sequence of color designations")),(0,i.kt)("p",null,"Update modes:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0")," - replace"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"1")," - add RGB"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"2")," - subtract RGB"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"3")," - multiply RGB (by c/128); each pixel value will change by at least 1")),(0,i.kt)("p",null,"Program commands:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD0: setall C+")," - set all pixels in current range to given color pattern"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD1: fade C+")," - set pixels in current range to colors between colors in sequence"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD2: fadehsv C+")," - similar to ",(0,i.kt)("inlineCode",{parentName:"li"},"fade()"),", but colors are specified and faded in HSV"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD3: rotfwd K")," - rotate (shift) pixels by ",(0,i.kt)("inlineCode",{parentName:"li"},"K")," positions away from the connector"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD4: rotback K")," - same, but towards the connector"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD5: show M=50")," - send buffer to strip and wait ",(0,i.kt)("inlineCode",{parentName:"li"},"M")," milliseconds"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD6: range P=0 N=length W=1 S=0")," - range from pixel ",(0,i.kt)("inlineCode",{parentName:"li"},"P"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"N")," pixels long (currently unsupported: every ",(0,i.kt)("inlineCode",{parentName:"li"},"W")," pixels skip ",(0,i.kt)("inlineCode",{parentName:"li"},"S")," pixels)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD7: mode K=0")," - set update mode"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xD8: tmpmode K=0")," - set update mode for next command only"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xCF: setone P C")," - set one pixel at ",(0,i.kt)("inlineCode",{parentName:"li"},"P")," (in current range) to given color"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"mult V")," - macro to multiply current range by given value (float)")),(0,i.kt)("p",null,"A number ",(0,i.kt)("inlineCode",{parentName:"p"},"k")," is encoded as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0 <= k < 128")," -> ",(0,i.kt)("inlineCode",{parentName:"li"},"k")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"128 <= k < 16383")," -> ",(0,i.kt)("inlineCode",{parentName:"li"},"0x80 | (k >> 8), k & 0xff")),(0,i.kt)("li",{parentName:"ul"},"bigger and negative numbers are not supported")),(0,i.kt)("p",null,"Thus, bytes ",(0,i.kt)("inlineCode",{parentName:"p"},"0xC0-0xFF")," are free to use for commands."),(0,i.kt)("p",null,"Formats:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xC1, R, G, B")," - single color parameter"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xC2, R0, G0, B0, R1, G1, B1")," - two color parameter"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xC3, R0, G0, B0, R1, G1, B1, R2, G2, B2")," - three color parameter"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xC0, N, R0, G0, B0, ..., R(N-1), G(N-1), B(N-1)")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"N")," color parameter"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"0xCF, <number>, R, G, B")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"set1")," special format")),(0,i.kt)("p",null,"Commands are encoded as command byte, followed by parameters in the order\nfrom the command definition."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"setone()")," command has irregular encoding to save space - it is byte ",(0,i.kt)("inlineCode",{parentName:"p"},"0xCF")," followed by encoded\nnumber, and followed by 3 bytes of color."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"run"},"run"),(0,i.kt)("p",null,'Run the given light "program". See service description for details.'),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"ledStrip.run(program: Buffer): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:intensity"},"intensity"),(0,i.kt)("p",null,"Set the luminosity of the strip.\nAt ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," the power to the strip is completely shut down."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.intensity.read()\nawait ledStrip.intensity.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:actualBrightness"},"actualBrightness"),(0,i.kt)("p",null,"This is the luminosity actually applied to the strip.\nMay be lower than ",(0,i.kt)("inlineCode",{parentName:"p"},"brightness")," if power-limited by the ",(0,i.kt)("inlineCode",{parentName:"p"},"max_power")," register.\nIt will rise slowly (few seconds) back to ",(0,i.kt)("inlineCode",{parentName:"p"},"brightness")," is limits are no longer required."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.actualBrightness.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.actualBrightness.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:lightType"},"lightType"),(0,i.kt)("p",null,"Specifies the type of light strip connected to controller.\nControllers which are sold with lights should default to the correct type\nand could not allow change."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.lightType.read()\nawait ledStrip.lightType.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.lightType.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:numPixels"},"numPixels"),(0,i.kt)("p",null,"Specifies the number of pixels in the strip.\nControllers which are sold with lights should default to the correct length\nand could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.numPixels.read()\nawait ledStrip.numPixels.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.numPixels.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:numColumns"},"numColumns"),(0,i.kt)("p",null,"If the LED pixel strip is a matrix, specifies the number of columns. Otherwise, a square shape is assumed. Controllers which are sold with lights should default to the correct length\nand could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.numColumns.read()\nawait ledStrip.numColumns.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.numColumns.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:maxPower"},"maxPower"),(0,i.kt)("p",null,"Limit the power drawn by the light-strip (and controller)."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.maxPower.read()\nawait ledStrip.maxPower.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.maxPower.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:maxPixels"},"maxPixels"),(0,i.kt)("p",null,"The maximum supported number of pixels.\nAll writes to ",(0,i.kt)("inlineCode",{parentName:"p"},"num_pixels")," are clamped to ",(0,i.kt)("inlineCode",{parentName:"p"},"max_pixels"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.maxPixels.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:numRepeats"},"numRepeats"),(0,i.kt)("p",null,"How many times to repeat the program passed in ",(0,i.kt)("inlineCode",{parentName:"p"},"run")," command.\nShould be set before the ",(0,i.kt)("inlineCode",{parentName:"p"},"run")," command.\nSetting to ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," means to repeat forever."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.numRepeats.read()\nawait ledStrip.numRepeats.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nledStrip.numRepeats.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Specifies the shape of the light strip."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript/core"\n\nconst ledStrip = new LedStrip()\n// ...\nconst value = await ledStrip.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h2",{id:"syntax"},"Syntax"),(0,i.kt)("p",null,"The input is split at spaces. The following tokens are supported:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"a command name (see below)"),(0,i.kt)("li",{parentName:"ul"},"a decimal number (0-16383)"),(0,i.kt)("li",{parentName:"ul"},"a color, in HTML syntax '#ff0000' for red, etc"),(0,i.kt)("li",{parentName:"ul"},"a single '#' which will take color (24-bit number) from list of arguments;\nthe list of arguments has an array or colors it will encode all elements of the array"),(0,i.kt)("li",{parentName:"ul"},"a single '%' which takes a number (0-16383) from the list of arguments")),(0,i.kt)("h3",{id:"commands-1"},"Commands"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"setall C+")," - set all pixels in current range to given color pattern")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"fade C+")," - set pixels in current range to colors between colors in sequence")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"fadehsv C+")," - similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"fade()"),", but colors are specified and faded in HSV")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"rotfwd K")," - rotate (shift) pixels by ",(0,i.kt)("inlineCode",{parentName:"p"},"K")," positions away from the connector")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"rotback K")," - same, but towards the connector")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"show M=50")," - send buffer to strip and wait ",(0,i.kt)("inlineCode",{parentName:"p"},"M")," milliseconds")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"range P=0 N=length W=1 S=0")," - range from pixel ",(0,i.kt)("inlineCode",{parentName:"p"},"P"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"N")," pixels long (currently unsupported: every ",(0,i.kt)("inlineCode",{parentName:"p"},"W")," pixels skip ",(0,i.kt)("inlineCode",{parentName:"p"},"S")," pixels)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"mode K=0")," - set update mode")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"tmpmode K=0")," - set update mode for next command only")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"setone P C")," - set one pixel at ",(0,i.kt)("inlineCode",{parentName:"p"},"P")," (in current range) to given color")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"mult V")," - macro to multiply current range by given value (float)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"C+")," means one or more colors")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"V")," is a floating point number")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"Other letters (",(0,i.kt)("inlineCode",{parentName:"p"},"K"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"M"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"N"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"P"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"W"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"S"),") represent integers, with their default values if omitted"))),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LedStrip } from "@devicescript-core"\nconst led = new LedStrip()\n\n// turn off all lights\nawait led.runEncoded("setall #000000")\n// the same\nawait led.runEncoded("setall #", 0)\n// set first pixel to red, last to blue, and interpolate the ones in between\nawait led.runEncoded("fade # #", 0xff0000, 0x0000ff)\n// the same; note the usage of an array []\nawait led.runEncoded("fade #", [0xff0000, 0x0000ff])\n// set pixels 2-7 to white\nawait led.runEncoded("range 2 5 setall #ffffff")\n// the same\nawait led.runEncoded("range % % setall #", 2, 5, 0xffffff)\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d3766067.42c0b603.js b/assets/js/d3766067.42c0b603.js new file mode 100644 index 00000000000..97f18bdaf6e --- /dev/null +++ b/assets/js/d3766067.42c0b603.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3666],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",b={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),m=a,d=u["".concat(p,".").concat(m)]||u[m]||b[m]||o;return r?n.createElement(d,i(i({ref:t},c),{},{components:r})):n.createElement(d,i({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var l=2;l<o;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},96264:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>b,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const o={},i="Observables",s={unversionedId:"api/observables/index",id:"api/observables/index",title:"Observables",description:"The @devicescript/observables builtin module provides a lightweight reactive observable framework, a limited subset of RxJS.",source:"@site/docs/api/observables/index.mdx",sourceDirName:"api/observables",slug:"/api/observables/",permalink:"/devicescript/api/observables/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"schedule",permalink:"/devicescript/api/runtime/schedule"},next:{title:"Creation Operators",permalink:"/devicescript/api/observables/creation"}},p={},l=[{value:"Setup",id:"setup",level:2},{value:"Operators",id:"operators",level:2}],c={toc:l},u="wrapper";function b(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"observables"},"Observables"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"@devicescript/observables")," ",(0,a.kt)("a",{parentName:"p",href:"/developer/packages"},"builtin")," module provides a lightweight reactive observable framework, a limited subset of ",(0,a.kt)("a",{parentName:"p",href:"https://rxjs.dev"},"RxJS"),".\nWe highly recommend reviewing the RxJS documentation for deeper discussions about observables."),(0,a.kt)("p",null,"For in-depth tutorials about observables, see ",(0,a.kt)("a",{parentName:"p",href:"https://rxjs.dev/"},"RxJS"),"."),(0,a.kt)("h2",{id:"setup"},"Setup"),(0,a.kt)("p",null,"Import ",(0,a.kt)("inlineCode",{parentName:"p"},"@devicescript/observables")," to enable the APIs."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import "@devicescript/observables"\n')),(0,a.kt)("h2",{id:"operators"},"Operators"),(0,a.kt)("p",null,"Observable operators apply transformation between observable data stream. They can be combined using the ",(0,a.kt)("inlineCode",{parentName:"p"},"pipe"),"\nmethod to create complex data processing pipeline. Many (most) operators are adapted from ",(0,a.kt)("a",{parentName:"p",href:"https://rxjs.dev/guide/operators"},"Rxjs"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\nimport { threshold, throttleTime } from "@devicescript/observables"\n\nconst thermometer = new Temperature()\n// create a stream of temperature readings\nconst temperature = thermometer.reading.pipe(\n threshold(0.1), // at least 0.1deg change\n throttleTime(10000) // at most one update per 10s\n)\ntemperature.subscribe(t => console.log(t))\n')))}b.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d5d9b552.a18ef33b.js b/assets/js/d5d9b552.a18ef33b.js new file mode 100644 index 00000000000..edacc7f9162 --- /dev/null +++ b/assets/js/d5d9b552.a18ef33b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8480],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),s=l(r),f=a,m=s["".concat(p,".").concat(f)]||s[f]||d[f]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[s]="string"==typeof e?e:a,i[1]=c;for(var l=2;l<o;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},41818:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Cloud Adapter service"},i="CloudAdapter",c={unversionedId:"api/clients/cloudadapter",id:"api/clients/cloudadapter",title:"CloudAdapter",description:"DeviceScript client for Cloud Adapter service",source:"@site/docs/api/clients/cloudadapter.md",sourceDirName:"api/clients",slug:"/api/clients/cloudadapter",permalink:"/devicescript/api/clients/cloudadapter",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Cloud Adapter service"},sidebar:"tutorialSidebar"},p={},l=[],u={toc:l},s="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(s,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"cloudadapter"},"CloudAdapter"),(0,a.kt)("p",null,"The ",(0,a.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/cloudadapter/"},"Cloud Adapter service")," is used internally by the\n",(0,a.kt)("a",{parentName:"p",href:"/developer/packages"},(0,a.kt)("inlineCode",{parentName:"a"},"@devicescript/cloud"))," package."),(0,a.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d63f844b.9f023677.js b/assets/js/d63f844b.9f023677.js new file mode 100644 index 00000000000..062f0d0af9d --- /dev/null +++ b/assets/js/d63f844b.9f023677.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6028],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>b});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,b=u["".concat(l,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(b,s(s({ref:t},c),{},{components:n})):r.createElement(b,s({ref:t},c))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[u]="string"==typeof e?e:o,s[1]=a;for(var p=2;p<i;p++)s[p]=n[p];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},63643:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=n(25773),o=(n(27378),n(35318));const i={sidebar_position:3.1,hide_table_of_contents:!0},s="Button LED",a={unversionedId:"samples/button-led",id:"samples/button-led",title:"Button LED",description:"This sample toggles a LED on/off by listening on the down events emitted by a button.",source:"@site/docs/samples/button-led.mdx",sourceDirName:"samples",slug:"/samples/button-led",permalink:"/devicescript/samples/button-led",draft:!1,tags:[],version:"current",sidebarPosition:3.1,frontMatter:{sidebar_position:3.1,hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Double Blinky",permalink:"/devicescript/samples/double-blinky"},next:{title:"Dimmer",permalink:"/devicescript/samples/dimmer"}},l={},p=[],c={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"button-led"},"Button LED"),(0,o.kt)("p",null,"This sample toggles a LED on/off by listening on the ",(0,o.kt)("inlineCode",{parentName:"p"},"down")," events emitted by a button."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/esp32c3_bare"\nimport { startLightBulb, startButton } from "@devicescript/servers"\n\nconst led = startLightBulb({\n pin: pins.P2,\n})\nconst button = startButton({\n pin: pins.P5,\n})\nconsole.log(`press button to toggle light`)\n// listen for button down events\nbutton.down.subscribe(async () => {\n // toggle light on/off\n console.log(`toggle`)\n await led.toggle()\n})\n')),(0,o.kt)("iframe",{style:{width:"100%",minHeight:"28rem",borderRadius:"0.5rem",padding:".5rem",border:"solid 1px #666"},src:"https://wokwi.com/projects/369061499438874625"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d6f63b00.07f97e81.js b/assets/js/d6f63b00.07f97e81.js new file mode 100644 index 00000000000..b4ec5b7f821 --- /dev/null +++ b/assets/js/d6f63b00.07f97e81.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5466],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||i;return r?n.createElement(d,a(a({ref:t},s),{},{components:r})):n.createElement(d,a({ref:t},s))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:o,a[1]=c;for(var l=2;l<i;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},63851:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>y,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var n=r(25773),o=(r(27378),r(35318));const i={pagination_prev:null,pagination_next:null,unlisted:!0},a="Proxy",c={unversionedId:"api/clients/proxy",id:"api/clients/proxy",title:"Proxy",description:"The Proxy service is used internally by the runtime",source:"@site/docs/api/clients/proxy.md",sourceDirName:"api/clients",slug:"/api/clients/proxy",permalink:"/devicescript/api/clients/proxy",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},p={},l=[],s={toc:l},u="wrapper";function y(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"proxy"},"Proxy"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/proxy/"},"Proxy service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,o.kt)("p",null))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d7276684.f9b7ccf9.js b/assets/js/d7276684.f9b7ccf9.js new file mode 100644 index 00000000000..f6764a7a300 --- /dev/null +++ b/assets/js/d7276684.f9b7ccf9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2467],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,o=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(n),d=i,k=u["".concat(o,".").concat(d)]||u[d]||m[d]||r;return n?a.createElement(k,l(l({ref:t},c),{},{components:n})):a.createElement(k,l({ref:t},c))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=d;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[u]="string"==typeof e?e:i,l[1]=p;for(var s=2;s<r;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},52269:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>s});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Serial service"},l="Serial",p={unversionedId:"api/clients/serial",id:"api/clients/serial",title:"Serial",description:"DeviceScript client for Serial service",source:"@site/docs/api/clients/serial.md",sourceDirName:"api/clients",slug:"/api/clients/serial",permalink:"/devicescript/api/clients/serial",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Serial service"},sidebar:"tutorialSidebar"},o={},s=[{value:"Commands",id:"commands",level:2},{value:"send",id:"send",level:3},{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"connectionName",id:"ro:connectionName",level:3},{value:"baudRate",id:"rw:baudRate",level:3},{value:"dataBits",id:"rw:dataBits",level:3},{value:"stopBits",id:"rw:stopBits",level:3},{value:"parityMode",id:"rw:parityMode",level:3},{value:"bufferSize",id:"rw:bufferSize",level:3}],c={toc:s},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"serial"},"Serial"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"An asynchronous serial communication service capable of sending and receiving buffers of data.\nSettings default to 115200 baud 8N1."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"send"},"send"),(0,i.kt)("p",null,"Send a buffer of data over the serial transport."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"serial.send(data: Buffer): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Indicates if the serial connection is active."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.enabled.read()\nawait serial.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:connectionName"},"connectionName"),(0,i.kt)("p",null,"User-friendly name of the connection."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"s"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.connectionName.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.connectionName.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:baudRate"},"baudRate"),(0,i.kt)("p",null,"A positive, non-zero value indicating the baud rate at which serial communication is be established."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.baudRate.read()\nawait serial.baudRate.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.baudRate.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:dataBits"},"dataBits"),(0,i.kt)("p",null,"The number of data bits per frame. Either 7 or 8."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.dataBits.read()\nawait serial.dataBits.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.dataBits.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:stopBits"},"stopBits"),(0,i.kt)("p",null,"The number of stop bits at the end of a frame. Either 1 or 2."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.stopBits.read()\nawait serial.stopBits.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.stopBits.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:parityMode"},"parityMode"),(0,i.kt)("p",null,"The parity mode."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.parityMode.read()\nawait serial.parityMode.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.parityMode.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:bufferSize"},"bufferSize"),(0,i.kt)("p",null,"A positive, non-zero value indicating the size of the read and write buffers that should be created."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nconst value = await serial.bufferSize.read()\nawait serial.bufferSize.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Serial } from "@devicescript/core"\n\nconst serial = new Serial()\n// ...\nserial.bufferSize.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d822119d.20594b2b.js b/assets/js/d822119d.20594b2b.js new file mode 100644 index 00000000000..2c21c4ba132 --- /dev/null +++ b/assets/js/d822119d.20594b2b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1189],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>v});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",b={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),u=l(r),d=a,v=u["".concat(s,".").concat(d)]||u[d]||b[d]||i;return r?n.createElement(v,o(o({ref:t},p),{},{components:r})):n.createElement(v,o({ref:t},p))}));function v(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[u]="string"==typeof e?e:a,o[1]=c;for(var l=2;l<i;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},25084:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>b,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var n=r(25773),a=(r(27378),r(35318));const i={sidebar_position:2},o="Events",c={unversionedId:"api/core/events",id:"api/core/events",title:"Events",description:"Events are generated by service servers and can be subscribed with a callback.",source:"@site/docs/api/core/events.md",sourceDirName:"api/core",slug:"/api/core/events",permalink:"/devicescript/api/core/events",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Registers",permalink:"/devicescript/api/core/registers"},next:{title:"Commands",permalink:"/devicescript/api/core/commands"}},s={},l=[{value:"subscribe",id:"subscribe",level:2},{value:"wait",id:"wait",level:2}],p={toc:l},u="wrapper";function b(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"events"},"Events"),(0,a.kt)("p",null,"Events are generated by service servers and can be subscribed with a callback."),(0,a.kt)("h2",{id:"subscribe"},"subscribe"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"subscribe")," method registers a callback that runs when the event is received."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'const button = new ds.Button()\n\nbutton.down.subscribe(() => {\n console.log("click!")\n})\n')),(0,a.kt)("h2",{id:"wait"},"wait"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"wait")," method blocks the thread until the event is received."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'const button = new ds.Button()\n\nawait button.down.wait()\nconsole.log("click!")\n')))}b.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d8c5d390.807ba50a.js b/assets/js/d8c5d390.807ba50a.js new file mode 100644 index 00000000000..bc4169cef69 --- /dev/null +++ b/assets/js/d8c5d390.807ba50a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[393],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>d});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},b=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),b=i,d=u["".concat(p,".").concat(b)]||u[b]||m[b]||o;return n?r.createElement(d,a(a({ref:t},s),{},{components:n})):r.createElement(d,a({ref:t},s))}));function d(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=b;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:i,a[1]=l;for(var c=2;c<o;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}b.displayName="MDXCreateElement"},12172:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Vibration motor service"},a="VibrationMotor",l={unversionedId:"api/clients/vibrationmotor",id:"api/clients/vibrationmotor",title:"VibrationMotor",description:"DeviceScript client for Vibration motor service",source:"@site/docs/api/clients/vibrationmotor.md",sourceDirName:"api/clients",slug:"/api/clients/vibrationmotor",permalink:"/devicescript/api/clients/vibrationmotor",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Vibration motor service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Commands",id:"commands",level:2},{value:"vibrate",id:"vibrate",level:3},{value:"Registers",id:"registers",level:2},{value:"maxVibrations",id:"const:maxVibrations",level:3}],s={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"vibrationmotor"},"VibrationMotor"),(0,i.kt)("p",null,"A vibration motor."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { VibrationMotor } from "@devicescript/core"\n\nconst vibrationMotor = new VibrationMotor()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"vibrate"},"vibrate"),(0,i.kt)("p",null,"Starts a sequence of vibration and pauses. To stop any existing vibration, send an empty payload."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"vibrationMotor.vibrate(duration: number, intensity: number): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"const:maxVibrations"},"maxVibrations"),(0,i.kt)("p",null,"The maximum number of vibration sequences supported in a single packet."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { VibrationMotor } from "@devicescript/core"\n\nconst vibrationMotor = new VibrationMotor()\n// ...\nconst value = await vibrationMotor.maxVibrations.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d99e20a1.9a2a9372.js b/assets/js/d99e20a1.9a2a9372.js new file mode 100644 index 00000000000..0c65e75c826 --- /dev/null +++ b/assets/js/d99e20a1.9a2a9372.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[425],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=i,f=u["".concat(p,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(f,l(l({ref:t},s),{},{components:n})):r.createElement(f,l({ref:t},s))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var c=2;c<a;c++)l[c]=n[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},17337:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Flex service"},l="Flex",o={unversionedId:"api/clients/flex",id:"api/clients/flex",title:"Flex",description:"DeviceScript client for Flex service",source:"@site/docs/api/clients/flex.md",sourceDirName:"api/clients",slug:"/api/clients/flex",permalink:"/devicescript/api/clients/flex",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Flex service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"length",id:"const:length",level:3}],s={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"flex"},"Flex"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A bending or deflection sensor."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Flex } from "@devicescript/core"\n\nconst flex = new Flex()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"A measure of the bending."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"i1.15"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Flex } from "@devicescript/core"\n\nconst flex = new Flex()\n// ...\nconst value = await flex.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Flex } from "@devicescript/core"\n\nconst flex = new Flex()\n// ...\nflex.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:length"},"length"),(0,i.kt)("p",null,"Length of the flex sensor"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Flex } from "@devicescript/core"\n\nconst flex = new Flex()\n// ...\nconst value = await flex.length.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/db7e3fd2.6f9a7b76.js b/assets/js/db7e3fd2.6f9a7b76.js new file mode 100644 index 00000000000..c222f937b10 --- /dev/null +++ b/assets/js/db7e3fd2.6f9a7b76.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6687],{35318:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>g});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=c(r),m=a,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||i;return r?n.createElement(g,o(o({ref:t},u),{},{components:r})):n.createElement(g,o({ref:t},u))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[p]="string"==typeof e?e:a,o[1]=s;for(var c=2;c<i;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},69435:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(25773),a=(r(27378),r(35318));const i={sidebar_position:1.1,description:"Learn how to use the status light on DeviceScript to message application states. Control the status LED until a system LED pattern is scheduled by the runtime."},o="Status Light",s={unversionedId:"developer/status-light",id:"developer/status-light",title:"Status Light",description:"Learn how to use the status light on DeviceScript to message application states. Control the status LED until a system LED pattern is scheduled by the runtime.",source:"@site/docs/developer/status-light.mdx",sourceDirName:"developer",slug:"/developer/status-light",permalink:"/devicescript/developer/status-light",draft:!1,tags:[],version:"current",sidebarPosition:1.1,frontMatter:{sidebar_position:1.1,description:"Learn how to use the status light on DeviceScript to message application states. Control the status LED until a system LED pattern is scheduled by the runtime."},sidebar:"tutorialSidebar",previous:{title:"Console output",permalink:"/devicescript/developer/console"},next:{title:"Clients",permalink:"/devicescript/developer/clients"}},l={},c=[{value:"Controlling the status led",id:"controlling-the-status-led",level:2},{value:"Network connectivity",id:"network-connectivity",level:2},{value:"Gateway messages",id:"gateway-messages",level:2},{value:"Errors",id:"errors",level:2}],u={toc:c},p="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(p,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"status-light"},"Status Light"),(0,a.kt)("p",null,"DeviceScript uses various blinking patterns on the status LED to message application states."),(0,a.kt)("h2",{id:"controlling-the-status-led"},"Controlling the status led"),(0,a.kt)("p",null,"You can set the status LED (until a system LED pattern is scheduled by the runtime)\nusing the ",(0,a.kt)("inlineCode",{parentName:"p"},"setStatusLight")," function."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { delay } from "@devicescript/core"\nimport { setStatusLight } from "@devicescript/runtime"\n\nsetInterval(async () => {\n await setStatusLight(0x00ff00) // green\n await delay(500)\n await setStatusLight(0x000000) // off\n}, 500)\n')),(0,a.kt)("h2",{id:"network-connectivity"},"Network connectivity"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"connecting to network: slow yellow glow"),(0,a.kt)("li",{parentName:"ul"},"connecting to gateway: fast yellow glow"),(0,a.kt)("li",{parentName:"ul"},"connected to gateway: very slow blue glow"),(0,a.kt)("li",{parentName:"ul"},"not connected to cloud: very slow red")),(0,a.kt)("h2",{id:"gateway-messages"},"Gateway messages"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"message uploaded: purple short blink"),(0,a.kt)("li",{parentName:"ul"},"message failed to upload: red short blink")),(0,a.kt)("h2",{id:"errors"},"Errors"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"jacdac line error: yellow blink"),(0,a.kt)("li",{parentName:"ul"},"packet overflow: magenta blink"),(0,a.kt)("li",{parentName:"ul"},"generic error: short red blink")),(0,a.kt)("p",null,"The blinking patterns are defined at ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/jacdac-c/blob/main/inc/jd_io.h#L77"},"https://github.com/microsoft/jacdac-c/blob/main/inc/jd_io.h#L77")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/dc277a3e.6f642fa5.js b/assets/js/dc277a3e.6f642fa5.js new file mode 100644 index 00000000000..8d3a0da05f2 --- /dev/null +++ b/assets/js/dc277a3e.6f642fa5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1707],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>g});var a=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),c=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(o.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=c(n),m=r,g=p["".concat(o,".").concat(m)]||p[m]||u[m]||i;return n?a.createElement(g,l(l({ref:t},d),{},{components:n})):a.createElement(g,l({ref:t},d))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[p]="string"==typeof e?e:r,l[1]=s;for(var c=2;c<i;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},59122:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=n(25773),r=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for USB Bridge service"},l="UsbBridge",s={unversionedId:"api/clients/usbbridge",id:"api/clients/usbbridge",title:"UsbBridge",description:"DeviceScript client for USB Bridge service",source:"@site/docs/api/clients/usbbridge.md",sourceDirName:"api/clients",slug:"/api/clients/usbbridge",permalink:"/devicescript/api/clients/usbbridge",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for USB Bridge service"},sidebar:"tutorialSidebar"},o={},c=[{value:"Commands",id:"commands",level:2},{value:"disablePackets",id:"disablepackets",level:3},{value:"enablePackets",id:"enablepackets",level:3},{value:"disableLog",id:"disablelog",level:3},{value:"enableLog",id:"enablelog",level:3}],d={toc:c},p="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(p,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"usbbridge"},"UsbBridge"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,r.kt)("p",null,"This service is normally not announced or otherwise exposed on the serial bus.\nIt is used to communicate with a USB-Jacdac bridge at the USB layer.\nThe host sends broadcast packets to this service to control the link layer.\nThe device responds with broadcast reports (no-one else does that).\nThese packets are not forwarded to the UART Jacdac line."),(0,r.kt)("p",null,"Packets are sent over USB Serial (CDC).\nThe host shall set the CDC to 1Mbaud 8N1\n(even though in some cases the USB interface is connected directly to the MCU and line settings are\nignored)."),(0,r.kt)("p",null,"The CDC line carries both Jacdac frames and serial logging output.\nJacdac frames have valid CRC and are framed by delimeter characters and possibly fragmented."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"0xFE")," is used as a framing byte.\nNote that bytes ",(0,r.kt)("inlineCode",{parentName:"p"},"0xF8"),"-",(0,r.kt)("inlineCode",{parentName:"p"},"0xFF")," are always invalid UTF-8.\n",(0,r.kt)("inlineCode",{parentName:"p"},"0xFF")," occurs relatively often in Jacdac packets, so is not used for framing."),(0,r.kt)("p",null,"The following sequences are supported:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"0xFE 0xF8")," - literal 0xFE"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"0xFE 0xF9")," - reserved; ignore"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"0xFE 0xFA")," - indicates that some serial logs were dropped at this point"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"0xFE 0xFB")," - indicates that some Jacdac frames were dropped at this point"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"0xFE 0xFC")," - Jacdac frame start"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"0xFE 0xFD")," - Jacdac frame end")),(0,r.kt)("p",null,"0xFE followed by any other byte:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"in serial, should be treated as literal 0xFE (and the byte as itself, unless it's 0xFE)"),(0,r.kt)("li",{parentName:"ul"},"in frame data, should terminate the current frame fragment,\nand ideally have all data (incl. fragment start) in the current frame fragment treated as serial")),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { UsbBridge } from "@devicescript/core"\n\nconst usbBridge = new UsbBridge()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"disablepackets"},"disablePackets"),(0,r.kt)("p",null,"Disables forwarding of Jacdac packets."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"usbBridge.disablePackets(): Promise<void>\n")),(0,r.kt)("h3",{id:"enablepackets"},"enablePackets"),(0,r.kt)("p",null,"Enables forwarding of Jacdac packets."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"usbBridge.enablePackets(): Promise<void>\n")),(0,r.kt)("h3",{id:"disablelog"},"disableLog"),(0,r.kt)("p",null,"Disables forwarding of serial log messages."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"usbBridge.disableLog(): Promise<void>\n")),(0,r.kt)("h3",{id:"enablelog"},"enableLog"),(0,r.kt)("p",null,"Enables forwarding of serial log messages."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"usbBridge.enableLog(): Promise<void>\n")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/dc34691d.40fa9f6c.js b/assets/js/dc34691d.40fa9f6c.js new file mode 100644 index 00000000000..6b634db8bbe --- /dev/null +++ b/assets/js/dc34691d.40fa9f6c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2630],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,k=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(k,o(o({ref:t},c),{},{components:n})):r.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:i,o[1]=l;for(var s=2;s<a;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},8494:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Solenoid service"},o="Solenoid",l={unversionedId:"api/clients/solenoid",id:"api/clients/solenoid",title:"Solenoid",description:"DeviceScript client for Solenoid service",source:"@site/docs/api/clients/solenoid.md",sourceDirName:"api/clients",slug:"/api/clients/solenoid",permalink:"/devicescript/api/clients/solenoid",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Solenoid service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"enabled",id:"rw:enabled",level:3},{value:"variant",id:"const:variant",level:3}],c={toc:s},d="wrapper";function u(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"solenoid"},"Solenoid"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A push-pull solenoid is a type of relay that pulls a coil when activated."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Solenoid } from "@devicescript/core"\n\nconst solenoid = new Solenoid()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Indicates whether the solenoid is energized and pulled (on) or pushed (off)."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Solenoid } from "@devicescript/core"\n\nconst solenoid = new Solenoid()\n// ...\nconst value = await solenoid.enabled.read()\nawait solenoid.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Solenoid } from "@devicescript/core"\n\nconst solenoid = new Solenoid()\n// ...\nsolenoid.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Describes the type of solenoid used."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Solenoid } from "@devicescript/core"\n\nconst solenoid = new Solenoid()\n// ...\nconst value = await solenoid.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/dc3dd087.936eb6a3.js b/assets/js/dc3dd087.936eb6a3.js new file mode 100644 index 00000000000..75144ca0331 --- /dev/null +++ b/assets/js/dc3dd087.936eb6a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2296],{35318:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),s=p(n),k=a,m=s["".concat(c,".").concat(k)]||s[k]||u[k]||i;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=k;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[s]="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}k.displayName="MDXCreateElement"},63227:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound Recorder with Playback service"},o="SoundRecorderWithPlayback",l={unversionedId:"api/clients/soundrecorderwithplayback",id:"api/clients/soundrecorderwithplayback",title:"SoundRecorderWithPlayback",description:"DeviceScript client for Sound Recorder with Playback service",source:"@site/docs/api/clients/soundrecorderwithplayback.md",sourceDirName:"api/clients",slug:"/api/clients/soundrecorderwithplayback",permalink:"/devicescript/api/clients/soundrecorderwithplayback",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound Recorder with Playback service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Commands",id:"commands",level:2},{value:"play",id:"play",level:3},{value:"record",id:"record",level:3},{value:"cancel",id:"cancel",level:3},{value:"Registers",id:"registers",level:2},{value:"status",id:"ro:status",level:3},{value:"time",id:"ro:time",level:3},{value:"intensity",id:"rw:intensity",level:3}],d={toc:p},s="wrapper";function u(e){let{components:t,...n}=e;return(0,a.kt)(s,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"soundrecorderwithplayback"},"SoundRecorderWithPlayback"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A record and replay module. You can record a few seconds of audio and play it back."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"play"},"play"),(0,a.kt)("p",null,"Replay recorded audio."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundRecorderWithPlayback.play(): Promise<void>\n")),(0,a.kt)("h3",{id:"record"},"record"),(0,a.kt)("p",null,"Record audio for N milliseconds."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundRecorderWithPlayback.record(duration: number): Promise<void>\n")),(0,a.kt)("h3",{id:"cancel"},"cancel"),(0,a.kt)("p",null,"Cancel record, the ",(0,a.kt)("inlineCode",{parentName:"p"},"time")," register will be updated by already cached data."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundRecorderWithPlayback.cancel(): Promise<void>\n")),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:status"},"status"),(0,a.kt)("p",null,"Indicate the current status"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n// ...\nconst value = await soundRecorderWithPlayback.status.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n// ...\nsoundRecorderWithPlayback.status.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:time"},"time"),(0,a.kt)("p",null,"Milliseconds of audio recorded."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n// ...\nconst value = await soundRecorderWithPlayback.time.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n// ...\nsoundRecorderWithPlayback.time.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:intensity"},"intensity"),(0,a.kt)("p",null,"Playback volume control"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n// ...\nconst value = await soundRecorderWithPlayback.intensity.read()\nawait soundRecorderWithPlayback.intensity.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundRecorderWithPlayback } from "@devicescript/core"\n\nconst soundRecorderWithPlayback = new SoundRecorderWithPlayback()\n// ...\nsoundRecorderWithPlayback.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/dc43ceaf.79ba45ed.js b/assets/js/dc43ceaf.79ba45ed.js new file mode 100644 index 00000000000..c8175bc246b --- /dev/null +++ b/assets/js/dc43ceaf.79ba45ed.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9005],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>b});var i=n(27378);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,i,l=function(e,t){if(null==e)return{};var n,i,l={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var p=i.createContext({}),u=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=u(e.components);return i.createElement(p.Provider,{value:t},e.children)},s="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},g=i.forwardRef((function(e,t){var n=e.components,l=e.mdxType,r=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),s=u(n),g=l,b=s["".concat(p,".").concat(g)]||s[g]||m[g]||r;return n?i.createElement(b,a(a({ref:t},c),{},{components:n})):i.createElement(b,a({ref:t},c))}));function b(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var r=n.length,a=new Array(r);a[0]=g;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[s]="string"==typeof e?e:l,a[1]=o;for(var u=2;u<r;u++)a[u]=n[u];return i.createElement.apply(null,a)}return i.createElement.apply(null,n)}g.displayName="MDXCreateElement"},92330:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>m,frontMatter:()=>r,metadata:()=>o,toc:()=>u});var i=n(25773),l=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Light bulb service"},a="LightBulb",o={unversionedId:"api/clients/lightbulb",id:"api/clients/lightbulb",title:"LightBulb",description:"DeviceScript client for Light bulb service",source:"@site/docs/api/clients/lightbulb.md",sourceDirName:"api/clients",slug:"/api/clients/lightbulb",permalink:"/devicescript/api/clients/lightbulb",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Light bulb service"},sidebar:"tutorialSidebar"},p={},u=[{value:"Registers",id:"registers",level:2},{value:"intensity",id:"rw:intensity",level:3},{value:"dimmable",id:"const:dimmable",level:3},{value:"on",id:"cmd:on",level:3},{value:"off",id:"cmd:off",level:3},{value:"toggle",id:"cmd:toggle",level:3}],c={toc:u},s="wrapper";function m(e){let{components:t,...n}=e;return(0,l.kt)(s,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"lightbulb"},"LightBulb"),(0,l.kt)("admonition",{type:"caution"},(0,l.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,l.kt)("p",null,"A light bulb controller."),(0,l.kt)("p",null),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightBulb } from "@devicescript/core"\n\nconst lightBulb = new LightBulb()\n')),(0,l.kt)("p",null),(0,l.kt)("h2",{id:"registers"},"Registers"),(0,l.kt)("p",null),(0,l.kt)("h3",{id:"rw:intensity"},"intensity"),(0,l.kt)("p",null,"Indicates the brightness of the light bulb. Zero means completely off and 0xffff means completely on.\nFor non-dimmable lights, the value should be clamp to 0xffff for any non-zero value."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"type: ",(0,l.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,l.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"read and write"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { LightBulb } from "@devicescript/core"\n\nconst lightBulb = new LightBulb()\n// ...\nconst value = await lightBulb.intensity.read()\nawait lightBulb.intensity.write(value)\n')),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"track incoming values")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { LightBulb } from "@devicescript/core"\n\nconst lightBulb = new LightBulb()\n// ...\nlightBulb.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},(0,l.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,l.kt)("h3",{id:"const:dimmable"},"dimmable"),(0,l.kt)("p",null,"Indicates if the light supports dimming."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"type: ",(0,l.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,l.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},"read only"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { LightBulb } from "@devicescript/core"\n\nconst lightBulb = new LightBulb()\n// ...\nconst value = await lightBulb.dimmable.read()\n')),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},(0,l.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,l.kt)("h3",{id:"cmd:on"},"on"),(0,l.kt)("p",null,"Turns on of the light bulb with an optional intensity value."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightBulb } from "@devicescript/core"\nconst lightBulb = new LightBulb()\n\n// highlight-next-line\nawait lightBulb.on(0.5)\n')),(0,l.kt)("h3",{id:"cmd:off"},"off"),(0,l.kt)("p",null,"Turns off of the light bulb, same as writing 0 to the intensity register."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightBulb } from "@devicescript/core"\nconst lightBulb = new LightBulb()\n\n// highlight-next-line\nawait lightBulb.off()\n')),(0,l.kt)("h3",{id:"cmd:toggle"},"toggle"),(0,l.kt)("p",null,"The toggle method flips the brightness state."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightBulb } from "@devicescript/core"\nconst lightBulb = new LightBulb()\n\n// highlight-next-line\nawait lightBulb.toggle()\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/dd8bbfeb.e32ddf06.js b/assets/js/dd8bbfeb.e32ddf06.js new file mode 100644 index 00000000000..1ddedaebd74 --- /dev/null +++ b/assets/js/dd8bbfeb.e32ddf06.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6158],{35318:(e,i,t)=>{t.d(i,{Zo:()=>c,kt:()=>m});var r=t(27378);function n(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function o(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i&&(r=r.filter((function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{};i%2?o(Object(t),!0).forEach((function(i){n(e,i,t[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}))}return e}function l(e,i){if(null==e)return{};var t,r,n=function(e,i){if(null==e)return{};var t,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],i.indexOf(t)>=0||(n[t]=e[t]);return n}(e,i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],i.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var p=r.createContext({}),d=function(e){var i=r.useContext(p),t=i;return e&&(t="function"==typeof e?e(i):a(a({},i),e)),t},c=function(e){var i=d(e.components);return r.createElement(p.Provider,{value:i},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var i=e.children;return r.createElement(r.Fragment,{},i)}},g=r.forwardRef((function(e,i){var t=e.components,n=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),s=d(t),g=n,m=s["".concat(p,".").concat(g)]||s[g]||u[g]||o;return t?r.createElement(m,a(a({ref:i},c),{},{components:t})):r.createElement(m,a({ref:i},c))}));function m(e,i){var t=arguments,n=i&&i.mdxType;if("string"==typeof e||n){var o=t.length,a=new Array(o);a[0]=g;var l={};for(var p in i)hasOwnProperty.call(i,p)&&(l[p]=i[p]);l.originalType=e,l[s]="string"==typeof e?e:n,a[1]=l;for(var d=2;d<o;d++)a[d]=t[d];return r.createElement.apply(null,a)}return r.createElement.apply(null,t)}g.displayName="MDXCreateElement"},20105:(e,i,t)=>{t.r(i),t.d(i,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var r=t(25773),n=(t(27378),t(35318));const o={description:"Arduino-like GPIO APIs",title:"Wire",sidebar_position:9},a="Wire",l={unversionedId:"developer/drivers/digital-io/wire",id:"developer/drivers/digital-io/wire",title:"Wire",description:"Arduino-like GPIO APIs",source:"@site/docs/developer/drivers/digital-io/wire.mdx",sourceDirName:"developer/drivers/digital-io",slug:"/developer/drivers/digital-io/wire",permalink:"/devicescript/developer/drivers/digital-io/wire",draft:!1,tags:[],version:"current",sidebarPosition:9,frontMatter:{description:"Arduino-like GPIO APIs",title:"Wire",sidebar_position:9},sidebar:"tutorialSidebar",previous:{title:"Digital IO (GPIO)",permalink:"/devicescript/developer/drivers/digital-io/"},next:{title:"Analog",permalink:"/devicescript/developer/drivers/analog"}},p={},d=[{value:"pinMode",id:"pinmode",level:2},{value:"digitalWrite",id:"digitalwrite",level:3},{value:"digitalRead",id:"digitalread",level:2},{value:"subscribeDigital",id:"subscribedigital",level:2}],c={toc:d},s="wrapper";function u(e){let{components:i,...t}=e;return(0,n.kt)(s,(0,r.Z)({},c,t,{components:i,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"wire"},"Wire"),(0,n.kt)("p",null,(0,n.kt)("inlineCode",{parentName:"p"},"digitalWrite"),", ",(0,n.kt)("inlineCode",{parentName:"p"},"digitalRead"),", ",(0,n.kt)("inlineCode",{parentName:"p"},"pinMode")," functions are provided for Arduino-like\ndigital IO."),(0,n.kt)("h2",{id:"pinmode"},"pinMode"),(0,n.kt)("p",null,"Sets the pin input/output and pull up/down mode."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { GPIOMode } from "@devicescript/core"\n// highlight-next-line\nimport { pinMode } from "@devicescript/gpio"\n\nconst pin = gpio(0)\n// highlight-next-line\npinMode(pin, GPIOMode.Output)\n')),(0,n.kt)("h3",{id:"digitalwrite"},"digitalWrite"),(0,n.kt)("p",null,"For digital output, you can use ",(0,n.kt)("inlineCode",{parentName:"p"},"digitalWrite")," function."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { HIGH, GPIOMode } from "@devicescript/core"\n// highlight-next-line\nimport { pinMode, digitalWrite } from "@devicescript/gpio"\n\nconst pin = gpio(0)\npinMode(pin, GPIOMode.Output)\n\n// highlight-start\ndigitalWrite(pin, true)\ndigitalWrite(pin, 1)\ndigitalWrite(pin, HIGH)\n// highlight-end\n')),(0,n.kt)("h2",{id:"digitalread"},"digitalRead"),(0,n.kt)("p",null,"For digital input, you can use ",(0,n.kt)("inlineCode",{parentName:"p"},"digitalRead")," function."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { GPIOMode } from "@devicescript/core"\n// highlight-next-line\nimport { pinMode, digitalRead } from "@devicescript/gpio"\n\nconst pin = gpio(0)\npinMode(pin, GPIOMode.Input)\n\n// highlight-start\nconst value = digitalRead(pin)\n// highlight-end\n')),(0,n.kt)("h2",{id:"subscribedigital"},"subscribeDigital"),(0,n.kt)("p",null,"You can also subscribe to digital input changes."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { GPIOMode } from "@devicescript/core"\n// highlight-next-line\nimport { pinMode, subscribeDigital } from "@devicescript/gpio"\n\nconst pin = gpio(0)\npinMode(pin, GPIOMode.Input)\n\n// highlight-start\nsubscribeDigital(pin, value => console.data({ value }))\n// highlight-end\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/de51976a.1902dff6.js b/assets/js/de51976a.1902dff6.js new file mode 100644 index 00000000000..0b08c56d165 --- /dev/null +++ b/assets/js/de51976a.1902dff6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3218],{35318:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>v});var n=a(27378);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},l=Object.keys(e);for(n=0;n<l.length;n++)a=l[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)a=l[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),d=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=d(a),m=r,v=u["".concat(s,".").concat(m)]||u[m]||p[m]||l;return a?n.createElement(v,i(i({ref:t},c),{},{components:a})):n.createElement(v,i({ref:t},c))}));function v(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:r,i[1]=o;for(var d=2;d<l;d++)i[d]=a[d];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},39798:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(27378),r=a(38944);const l={tabItem:"tabItem_wHwb"};function i(e){let{children:t,hidden:a,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:a},t)}},23930:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(25773),r=a(27378),l=a(38944),i=a(83457),o=a(3620),s=a(30654),d=a(70784),c=a(71819);function u(e){return function(e){return r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??u(a);return function(e){const t=(0,d.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function v(e){let{queryString:t=!1,groupId:a}=e;const n=(0,o.k6)(),l=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,s._X)(l),(0,r.useCallback)((e=>{if(!l)return;const t=new URLSearchParams(n.location.search);t.set(l,e),n.replace({...n.location,search:t.toString()})}),[l,n])]}function b(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,l=p(e),[i,o]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:l}))),[s,d]=v({queryString:a,groupId:n}),[u,b]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,l]=(0,c.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&l.set(e)}),[a,l])]}({groupId:n}),h=(()=>{const e=s??u;return m({value:e,tabValues:l})?e:null})();(0,r.useLayoutEffect)((()=>{h&&o(h)}),[h]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);o(e),d(e),b(e)}),[d,b,l]),tabValues:l}}var h=a(76457);const f={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function k(e){let{className:t,block:a,selectedValue:o,selectValue:s,tabValues:d}=e;const c=[],{blockElementScrollPositionUntilNextRender:u}=(0,i.o5)(),p=e=>{const t=e.currentTarget,a=c.indexOf(t),n=d[a].value;n!==o&&(u(t),s(n))},m=e=>{let t=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const a=c.indexOf(e.currentTarget)+1;t=c[a]??c[0];break}case"ArrowLeft":{const a=c.indexOf(e.currentTarget)-1;t=c[a]??c[c.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":a},t)},d.map((e=>{let{value:t,label:a,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:p},i,{className:(0,l.Z)("tabs__item",f.tabItem,i?.className,{"tabs__item--active":o===t})}),a??t)})))}function g(e){let{lazy:t,children:a,selectedValue:n}=e;const l=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=b(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",f.tabList)},r.createElement(k,(0,n.Z)({},e,t)),r.createElement(g,(0,n.Z)({},e,t)))}function N(e){const t=(0,h.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},67101:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>v,frontMatter:()=>o,metadata:()=>d,toc:()=>u});var n=a(25773),r=(a(27378),a(35318)),l=a(23930),i=a(39798);const o={sidebar_position:0},s="Command Line Interface",d={unversionedId:"api/cli",id:"api/cli",title:"Command Line Interface",description:"The DeviceScript command line (CLI) allows to compile and debug programs from your favorite IDE.",source:"@site/docs/api/cli.mdx",sourceDirName:"api",slug:"/api/cli",permalink:"/devicescript/api/cli",draft:!1,tags:[],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0},sidebar:"tutorialSidebar",previous:{title:"Add Shield",permalink:"/devicescript/devices/add-shield"},next:{title:"Code",permalink:"/devicescript/api/core/"}},c={},u=[{value:"Setup",id:"setup",level:2},{value:"devs init [dir]",id:"devs-init-dir",level:2},{value:"--force",id:"--force",level:3},{value:"--no-install",id:"--no-install",level:3},{value:"--board board-id",id:"--board-board-id",level:3},{value:"devs add ...",id:"devs-add-",level:2},{value:"add test",id:"add-test",level:3},{value:"add board",id:"add-board",level:3},{value:"add service",id:"add-service",level:3},{value:"add sim",id:"add-sim",level:3},{value:"add npm",id:"add-npm",level:3},{value:"devs build",id:"devs-build",level:2},{value:"custom services and boards",id:"custom-services-and-boards",level:3},{value:"--stats",id:"--stats",level:3},{value:"devs devtools",id:"devs-devtools",level:2},{value:"build watch",id:"build-watch",level:3},{value:"--internet",id:"--internet",level:4},{value:"devs flash",id:"devs-flash",level:2},{value:"devs bundle",id:"devs-bundle",level:2}],p={toc:u},m="wrapper";function v(e){let{components:t,...a}=e;return(0,r.kt)(m,(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"command-line-interface"},"Command Line Interface"),(0,r.kt)("p",null,"The DeviceScript command line (CLI) allows to compile and debug programs from your favorite IDE.\nThe CLI is also usable within containers (Docker, GitHub Codespaces, CodeSandbox, ...)."),(0,r.kt)("h2",{id:"setup"},"Setup"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"install ",(0,r.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/"},"Node.JS 16+")),(0,r.kt)("li",{parentName:"ul"},"install the CLI")),(0,r.kt)(l.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @devicescript/cli@latest --save-dev\n"))),(0,r.kt)(i.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn add @devicescript/cli@latest --dev\n"))),(0,r.kt)(i.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm add @devicescript/cli@latest --save-dev\n")))),(0,r.kt)("p",null,"The command tool is named ",(0,r.kt)("inlineCode",{parentName:"p"},"devicescript")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"devs")," for short.\nThe full list of options for each command is available through the CLI by running ",(0,r.kt)("inlineCode",{parentName:"p"},"devs help <command>"),"."),(0,r.kt)("h2",{id:"devs-init-dir"},"devs init ","[","dir","]"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," commands creates or updates the necessary files to get syntax completion\nand checking in DeviceScript project (typically from Visual Studio Code)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs init myproject\n")),(0,r.kt)("p",null,"The command will create the files under ",(0,r.kt)("inlineCode",{parentName:"p"},"myproject"),". A device script project will look as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},".devicescript/ reserved folder for devicescript generated files\npackage.json projet configuration\ndevsconfig.json configure the DeviceScript compiler with additional flags,\n also used by VSCode extension to activate.\nsrc/ directory for DeviceScript sources\nsrc/main.ts usual name for your entry point application\nsrc/tsconfig.json configure the TypeScript compiler to compile DeviceScript syntax\n...\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"Make sure to keep the ",(0,r.kt)("inlineCode",{parentName:"p"},"devsconfig.json")," file even if it is empty.\nIt is used as a marker to activate the ",(0,r.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code extension"),".")),(0,r.kt)("h3",{id:"--force"},"--force"),(0,r.kt)("p",null,"By default, ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," will not override existing ",(0,r.kt)("inlineCode",{parentName:"p"},"tsconfig.json"),". Using this flag, you can override this setting\nand force refreshing that file."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs init --force\n")),(0,r.kt)("h3",{id:"--no-install"},"--no-install"),(0,r.kt)("p",null,"Do not run ",(0,r.kt)("inlineCode",{parentName:"p"},"npm")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"yarn ")," install after dropping the files."),(0,r.kt)("h3",{id:"--board-board-id"},"--board board-id"),(0,r.kt)("p",null,"Specify the device identifier to use for the project.\nThe generate will patch ",(0,r.kt)("inlineCode",{parentName:"p"},"./src/main.ts")," and insert the board import statement."),(0,r.kt)("h2",{id:"devs-add-"},"devs add ..."),(0,r.kt)("p",null,"The generated project by ",(0,r.kt)("inlineCode",{parentName:"p"},"init")," is barebone by design. The ",(0,r.kt)("inlineCode",{parentName:"p"},"add")," command can be used to\nupdate the project with extra features. Each add command may require additional arguments."),(0,r.kt)("h3",{id:"add-test"},"add test"),(0,r.kt)("p",null,"Configures the project to add DeviceScript unit tests."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs add test\n")),(0,r.kt)("h3",{id:"add-board"},"add board"),(0,r.kt)("p",null,"Configures the project to add a custom device configuration (",(0,r.kt)("inlineCode",{parentName:"p"},"board"),")."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs add board\n")),(0,r.kt)("h3",{id:"add-service"},"add service"),(0,r.kt)("p",null,"Configures the project to add custom services."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs add service\n")),(0,r.kt)("h3",{id:"add-sim"},"add sim"),(0,r.kt)("p",null,"Configures the project to add a Node.JS subproject that runs simulated devices."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs add sim\n")),(0,r.kt)("h3",{id:"add-npm"},"add npm"),(0,r.kt)("p",null,"Prepare the project to be published to ",(0,r.kt)("a",{parentName:"p",href:"https://npmjs.com/"},"npm.js")," as a library."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs add npm\n")),(0,r.kt)("h2",{id:"devs-build"},"devs build"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," command compiles the entry point file from the current project\nusing the resolution rules in ",(0,r.kt)("inlineCode",{parentName:"p"},"tsconfig.json"),". It is the default command."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs build\n")),(0,r.kt)("h3",{id:"custom-services-and-boards"},"custom services and boards"),(0,r.kt)("p",null,"The command line will automatically compile markdown files under the ",(0,r.kt)("inlineCode",{parentName:"p"},"services")," folder (",(0,r.kt)("inlineCode",{parentName:"p"},"./services/*.md"),")\ninto TypeScript client definition in ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules/@devicescript/core/src/services.d.ts"),"."),(0,r.kt)("h3",{id:"--stats"},"--stats"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"--stats")," flag enables printing additional debugging information about code size,\nand other useful metrics."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs build --stats\n")),(0,r.kt)("h2",{id:"devs-devtools"},"devs devtools"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"devtools")," command launches the developer tool server, without trying to build a project."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs devtools\n")),(0,r.kt)("h3",{id:"build-watch"},"build watch"),(0,r.kt)("p",null,"To automatically rebuild your program based on file changes,\nadd the file name."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs devtools main.ts\n")),(0,r.kt)("p",null,"When the build is run in watch mode, it also opens a developer tool web server that allows\nto execute the compiled program in a simulator or physical devices. Follow the console\napplication instructions to open the web page."),(0,r.kt)("mermaid",{value:"stateDiagram-v2\n direction LR\n sources\n cli: CLI\\n(compiler + web server)\n browser: Dev Tools\\n(browser)\n sim: Simulator\n dev: Hardware Device\n cli --\x3e sources: watch files\n cli --\x3e browser: bytecode\n browser --\x3e sim\n browser --\x3e dev: WebSerial, WebUsb, ..."}),(0,r.kt)("h4",{id:"--internet"},"--internet"),(0,r.kt)("p",null,"To access the developer tools outside localhost, add ",(0,r.kt)("inlineCode",{parentName:"p"},"--internet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"devs devtools --internet\n")),(0,r.kt)("h2",{id:"devs-flash"},"devs flash"),(0,r.kt)("p",null,"Command to flash the DeviceScript firmware onto a physical device. There are dedicated documentation\npages to support various MCU architectures."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/"},"ESP32")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/rp2040/"},"RP2040"))),(0,r.kt)("h2",{id:"devs-bundle"},"devs bundle"),(0,r.kt)("p",null,"Bundle firmware, DeviceScript program, and settings into one image.\n",(0,r.kt)("a",{parentName:"p",href:"/developer/bundle"},"Learn more")))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/df304c58.259076bc.js b/assets/js/df304c58.259076bc.js new file mode 100644 index 00000000000..761f4c0973f --- /dev/null +++ b/assets/js/df304c58.259076bc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5073],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(r),d=i,f=u["".concat(c,".").concat(d)]||u[d]||m[d]||a;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var s=2;s<a;s++)o[s]=r[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},29652:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var n=r(25773),i=(r(27378),r(35318));const a={title:"Clients"},o="Clients",l={unversionedId:"api/clients/index",id:"api/clients/index",title:"Clients",description:"{@import optional ../clients-custom/index.mdp}",source:"@site/docs/api/clients/index.mdx",sourceDirName:"api/clients",slug:"/api/clients/",permalink:"/devicescript/api/clients/",draft:!1,tags:[],version:"current",frontMatter:{title:"Clients"},sidebar:"tutorialSidebar",previous:{title:"Buffers",permalink:"/devicescript/api/core/buffers"},next:{title:"Accelerometer",permalink:"/devicescript/api/clients/accelerometer"}},c={},s=[{value:"Declaring roles",id:"declaring-roles",level:2},{value:"Role binding state",id:"role-binding-state",level:2}],p={toc:s},u="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"clients"},"Clients"),(0,i.kt)("p",null,"In DeviceScript, hardware peripherals (and generally anything outside the VM) are modelled\nas ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/"},"Jacdac services"),"."),(0,i.kt)("p",null,"The peripherals are ",(0,i.kt)("strong",{parentName:"p"},"servers")," and the your client application creates ",(0,i.kt)("strong",{parentName:"p"},"clients")," to interact with them."),(0,i.kt)("h2",{id:"declaring-roles"},"Declaring roles"),(0,i.kt)("p",null,"Client instances, ",(0,i.kt)("strong",{parentName:"p"},"roles"),", should be allocated at the top level of your program.\nThe variable name is automatically assigned as the role name."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\n// highlight-next-line\nconst thermometer = new Temperature()\n')),(0,i.kt)("h2",{id:"role-binding-state"},"Role binding state"),(0,i.kt)("p",null,"You can test if the service is bound to a server."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Temperature } from "@devicescript/core"\n\nconst thermometer = new Temperature()\n\nsetInterval(async () => {\n // highlight-next-line\n if (await thermometer.binding().read()) {\n console.log("connected!")\n }\n}, 1000)\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e05d126a.4d8f972c.js b/assets/js/e05d126a.4d8f972c.js new file mode 100644 index 00000000000..b990dbf84f2 --- /dev/null +++ b/assets/js/e05d126a.4d8f972c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4640],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),d=i,k=u["".concat(p,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(k,o(o({ref:t},c),{},{components:n})):r.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var s=2;s<a;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},41438:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Planar position service"},o="PlanarPosition",l={unversionedId:"api/clients/planarposition",id:"api/clients/planarposition",title:"PlanarPosition",description:"DeviceScript client for Planar position service",source:"@site/docs/api/clients/planarposition.md",sourceDirName:"api/clients",slug:"/api/clients/planarposition",permalink:"/devicescript/api/clients/planarposition",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Planar position service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"variant",id:"const:variant",level:3}],c={toc:s},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"planarposition"},"PlanarPosition"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A sensor that repors 2D position, typically an optical mouse tracking sensor."),(0,i.kt)("p",null,"The sensor starts at an arbitrary origin (0,0) and reports the distance from that origin."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"streaming_interval")," is respected when the position is changing. When the position is not changing, the streaming interval may be throttled to ",(0,i.kt)("inlineCode",{parentName:"p"},"500ms"),"."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { PlanarPosition } from "@devicescript/core"\n\nconst planarPosition = new PlanarPosition()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The current position of the sensor."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"i22.10 i22.10"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PlanarPosition } from "@devicescript/core"\n\nconst planarPosition = new PlanarPosition()\n// ...\nplanarPosition.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"Specifies the type of physical sensor."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { PlanarPosition } from "@devicescript/core"\n\nconst planarPosition = new PlanarPosition()\n// ...\nconst value = await planarPosition.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e0bded7f.55e908f9.js b/assets/js/e0bded7f.55e908f9.js new file mode 100644 index 00000000000..34e92709a8f --- /dev/null +++ b/assets/js/e0bded7f.55e908f9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3297],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>g});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",v={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,l=e.originalType,s=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=p(r),d=i,g=u["".concat(s,".").concat(d)]||u[d]||v[d]||l;return r?n.createElement(g,a(a({ref:t},c),{},{components:r})):n.createElement(g,a({ref:t},c))}));function g(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var l=r.length,a=new Array(l);a[0]=d;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:i,a[1]=o;for(var p=2;p<l;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},64661:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>v,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const l={description:"Mounts a light level sensor",title:"Light Level"},a="Light Level",o={unversionedId:"api/drivers/lightlevel",id:"api/drivers/lightlevel",title:"Light Level",description:"Mounts a light level sensor",source:"@site/docs/api/drivers/lightlevel.md",sourceDirName:"api/drivers",slug:"/api/drivers/lightlevel",permalink:"/devicescript/api/drivers/lightlevel",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a light level sensor",title:"Light Level"},sidebar:"tutorialSidebar",previous:{title:"Light bulb",permalink:"/devicescript/api/drivers/lightbulb"},next:{title:"LTR390",permalink:"/devicescript/api/drivers/ltr390"}},s={},p=[],c={toc:p},u="wrapper";function v(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"light-level"},"Light Level"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startLightLevel")," starts a simple analog sensor server that models a light level sensor\nand returns a ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/lightlevel"},"client")," bound to the server."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Please refer to the ",(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("a",{parentName:"strong",href:"/developer/drivers/analog/"},"analog documentation"))," for details.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startLightLevel } from "@devicescript/servers"\n\nconst sensor = startLightLevel({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(light => console.data({ light }))\n')))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e0f9f1f4.e07c0041.js b/assets/js/e0f9f1f4.e07c0041.js new file mode 100644 index 00000000000..c901a8f5727 --- /dev/null +++ b/assets/js/e0f9f1f4.e07c0041.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9655],{35318:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),s=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=s(e.components);return o.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},f=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=s(n),f=r,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||i;return n?o.createElement(m,a(a({ref:t},p),{},{components:n})):o.createElement(m,a({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:r,a[1]=c;for(var s=2;s<i;s++)a[s]=n[s];return o.createElement.apply(null,a)}return o.createElement.apply(null,n)}f.displayName="MDXCreateElement"},65776:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var o=n(25773),r=(n(27378),n(35318));const i={sidebar_position:4,description:"Learn how to configure the WiFi connection on devices and explore other configuration options related to cloud applications.",keywords:["WiFi configuration","ESP32-C3","WiFi manager","access point","MAC address"]},a="Configuration",c={unversionedId:"developer/development-gateway/configuration",id:"developer/development-gateway/configuration",title:"Configuration",description:"Learn how to configure the WiFi connection on devices and explore other configuration options related to cloud applications.",source:"@site/docs/developer/development-gateway/configuration.mdx",sourceDirName:"developer/development-gateway",slug:"/developer/development-gateway/configuration",permalink:"/devicescript/developer/development-gateway/configuration",draft:!1,tags:[],version:"current",sidebarPosition:4,frontMatter:{sidebar_position:4,description:"Learn how to configure the WiFi connection on devices and explore other configuration options related to cloud applications.",keywords:["WiFi configuration","ESP32-C3","WiFi manager","access point","MAC address"]},sidebar:"tutorialSidebar",previous:{title:"Environment",permalink:"/devicescript/developer/development-gateway/environment"},next:{title:"Development Gateway",permalink:"/devicescript/developer/development-gateway/gateway"}},l={},s=[{value:"WiFi Access Points",id:"wifi-access-points",level:2},{value:"MAC address",id:"mac-address",level:3}],p={toc:s},d="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configuration"},"Configuration"),(0,r.kt)("p",null,"This page provides information to configure the WiFi connection\non devices and other configuration options related to cloud applications."),(0,r.kt)("h2",{id:"wifi-access-points"},"WiFi Access Points"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"/devices/esp32/"},"ESP32-C3")," firmware comes with a WiFi manager that allows you to configure the WiFi connection."),(0,r.kt)("p",null,"The Wifi manager supports multiple access point credentials."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Open the Visual Studio Code Extension view"),(0,r.kt)("li",{parentName:"ul"},"Connect to your hardware device"),(0,r.kt)("li",{parentName:"ul"},"Expand the WiFi tree node"),(0,r.kt)("li",{parentName:"ul"},"Find the access point you want to connect to and click on the ",(0,r.kt)("strong",{parentName:"li"},"pen")," introduction to enter the password")),(0,r.kt)("h3",{id:"mac-address"},"MAC address"),(0,r.kt)("p",null,"Some networking environment requires to register the device MAC address to allow the device to connect to the network.\nThe MAC address of the device is displayed in the WiFi tree node."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e1132b00.7f1ac97a.js b/assets/js/e1132b00.7f1ac97a.js new file mode 100644 index 00000000000..778acd1ae04 --- /dev/null +++ b/assets/js/e1132b00.7f1ac97a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4822],{35318:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),c=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=c(e.components);return a.createElement(p.Provider,{value:t},e.children)},s="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),s=c(n),u=i,d=s["".concat(p,".").concat(u)]||s[u]||k[u]||r;return n?a.createElement(d,l(l({ref:t},m),{},{components:n})):a.createElement(d,l({ref:t},m))}));function d(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[s]="string"==typeof e?e:i,l[1]=o;for(var c=2;c<r;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},47162:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>o,toc:()=>c});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Real time clock service"},l="RealTimeClock",o={unversionedId:"api/clients/realtimeclock",id:"api/clients/realtimeclock",title:"RealTimeClock",description:"DeviceScript client for Real time clock service",source:"@site/docs/api/clients/realtimeclock.md",sourceDirName:"api/clients",slug:"/api/clients/realtimeclock",permalink:"/devicescript/api/clients/realtimeclock",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Real time clock service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Commands",id:"commands",level:2},{value:"setTime",id:"settime",level:3},{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"drift",id:"ro:drift",level:3},{value:"precision",id:"const:precision",level:3},{value:"variant",id:"const:variant",level:3}],m={toc:c},s="wrapper";function k(e){let{components:t,...n}=e;return(0,i.kt)(s,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"realtimeclock"},"RealTimeClock"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"Real time clock to support collecting data with precise time stamps."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { RealTimeClock } from "@devicescript/core"\n\nconst realTimeClock = new RealTimeClock()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"commands"},"Commands"),(0,i.kt)("h3",{id:"settime"},"setTime"),(0,i.kt)("p",null,"Sets the current time and resets the error."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"realTimeClock.setTime(year: number, month: number, day_of_month: number, day_of_week: number, hour: number, min: number, sec: number): Promise<void>\n")),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"Current time in 24h representation."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"day_of_month")," is day of the month, starting at ",(0,i.kt)("inlineCode",{parentName:"p"},"1"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"p"},"day_of_week")," is day of the week, starting at ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," as monday. Default streaming period is 1 second.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16 u8 u8 u8 u8 u8 u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RealTimeClock } from "@devicescript/core"\n\nconst realTimeClock = new RealTimeClock()\n// ...\nrealTimeClock.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:drift"},"drift"),(0,i.kt)("p",null,"Time drift since the last call to the ",(0,i.kt)("inlineCode",{parentName:"p"},"set_time")," command."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RealTimeClock } from "@devicescript/core"\n\nconst realTimeClock = new RealTimeClock()\n// ...\nconst value = await realTimeClock.drift.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RealTimeClock } from "@devicescript/core"\n\nconst realTimeClock = new RealTimeClock()\n// ...\nrealTimeClock.drift.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:precision"},"precision"),(0,i.kt)("p",null,"Error on the clock, in parts per million of seconds."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RealTimeClock } from "@devicescript/core"\n\nconst realTimeClock = new RealTimeClock()\n// ...\nconst value = await realTimeClock.precision.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"The type of physical clock used by the sensor."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RealTimeClock } from "@devicescript/core"\n\nconst realTimeClock = new RealTimeClock()\n// ...\nconst value = await realTimeClock.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e11cc8a5.504a1032.js b/assets/js/e11cc8a5.504a1032.js new file mode 100644 index 00000000000..3022f334a5f --- /dev/null +++ b/assets/js/e11cc8a5.504a1032.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9409],{35318:(t,e,n)=>{n.d(e,{Zo:()=>c,kt:()=>u});var r=n(27378);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n,r,a={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var l=r.createContext({}),d=function(t){var e=r.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):p(p({},e),t)),n},c=function(t){var e=d(t.components);return r.createElement(l.Provider,{value:e},t.children)},s="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},g=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,i=t.originalType,l=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),s=d(n),g=a,u=s["".concat(l,".").concat(g)]||s[g]||m[g]||i;return n?r.createElement(u,p(p({ref:e},c),{},{components:n})):r.createElement(u,p({ref:e},c))}));function u(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=n.length,p=new Array(i);p[0]=g;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o[s]="string"==typeof t?t:a,p[1]=o;for(var d=2;d<i;d++)p[d]=n[d];return r.createElement.apply(null,p)}return r.createElement.apply(null,n)}g.displayName="MDXCreateElement"},2823:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=n(25773),a=(n(27378),n(35318));const i={description:"MSR JacdacIoT 48 v0.2"},p="MSR JacdacIoT 48 v0.2",o={unversionedId:"devices/esp32/msr48",id:"devices/esp32/msr48",title:"MSR JacdacIoT 48 v0.2",description:"MSR JacdacIoT 48 v0.2",source:"@site/docs/devices/esp32/msr48.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/msr48",permalink:"/devicescript/devices/esp32/msr48",draft:!1,tags:[],version:"current",frontMatter:{description:"MSR JacdacIoT 48 v0.2"},sidebar:"tutorialSidebar",previous:{title:"MSR JM Brain S2-mini 207 v4.3",permalink:"/devicescript/devices/esp32/msr207-v43"},next:{title:"Seeed Studio XIAO ESP32C3 with MSR218 base",permalink:"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218"}},l={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],c={toc:d},s="wrapper";function m(t){let{components:e,...n}=t;return(0,a.kt)(s,(0,r.Z)({},c,n,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"msr-jacdaciot-48-v02"},"MSR JacdacIoT 48 v0.2"),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/microsoft-research/jmbrainesp3248v03.catalog.jpg",alt:"MSR JacdacIoT 48 v0.2 picture"})),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Jacdac on pin 17 using Jacdac connector"),(0,a.kt)("li",{parentName:"ul"},"I2C on 9/10 using Qwiic connector"),(0,a.kt)("li",{parentName:"ul"},"RGB LED on pins 8, 7, 6 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin 43 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: power (auto-start)")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P33")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P34")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P35")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P36")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"RX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO38"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"TX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO37"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"i2c.pinSCL")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,a.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"i2c.pinSDA")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,a.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"jacdac.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO17"),(0,a.kt)("td",{parentName:"tr",align:"right"},"jacdac.pin, analogOut, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[0]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[0]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[1]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[1]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[2]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[2]",".pin, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"log.pinTX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO43"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinEn")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinEn, analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinFault")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinFault, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "MSR JacdacIoT 48 v0.2".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/msr48"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board msr48\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-msr48-0x1000.bin"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="msr48.json"',title:'"msr48.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "msr48",\n "devName": "MSR JacdacIoT 48 v0.2",\n "productId": "0x3de1398b",\n "archId": "esp32s2",\n "i2c": {\n "$connector": "Qwiic",\n "pinSCL": 10,\n "pinSDA": 9\n },\n "jacdac": {\n "$connector": "Jacdac",\n "pin": 17\n },\n "led": {\n "rgb": [\n {\n "mult": 250,\n "pin": 8\n },\n {\n "mult": 60,\n "pin": 7\n },\n {\n "mult": 150,\n "pin": 6\n }\n ]\n },\n "log": {\n "pinTX": 43\n },\n "pins": {\n "P33": 33,\n "P34": 34,\n "P35": 35,\n "P36": 36,\n "RX": 38,\n "TX": 37\n },\n "services": [\n {\n "faultIgnoreMs": 100,\n "mode": 0,\n "name": "power",\n "pinEn": 2,\n "pinFault": 13,\n "service": "power"\n }\n ]\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e233ee0e.1a410191.js b/assets/js/e233ee0e.1a410191.js new file mode 100644 index 00000000000..6101cbcb95a --- /dev/null +++ b/assets/js/e233ee0e.1a410191.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9369],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=i,m=u["".concat(c,".").concat(d)]||u[d]||f[d]||o;return r?n.createElement(m,a(a({ref:t},s),{},{components:r})):n.createElement(m,a({ref:t},s))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:i,a[1]=l;for(var p=2;p<o;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},35238:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>f,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,unlisted:!0},a="GPIO",l={unversionedId:"api/clients/gpio",id:"api/clients/gpio",title:"GPIO",description:"The GPIO service is used internally by the runtime",source:"@site/docs/api/clients/gpio.md",sourceDirName:"api/clients",slug:"/api/clients/gpio",permalink:"/devicescript/api/clients/gpio",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},c={},p=[{value:"See Also",id:"see-also",level:2}],s={toc:p},u="wrapper";function f(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"gpio"},"GPIO"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/gpio/"},"GPIO service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,i.kt)("h2",{id:"see-also"},"See Also"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/developer/drivers/digital-io/"},"Digital IO"))))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e27a30e8.ab729125.js b/assets/js/e27a30e8.ab729125.js new file mode 100644 index 00000000000..1ae8126c43d --- /dev/null +++ b/assets/js/e27a30e8.ab729125.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5552],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>d});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),u=p(n),g=i,d=u["".concat(s,".").concat(g)]||u[g]||f[g]||a;return n?r.createElement(d,c(c({ref:t},l),{},{components:n})):r.createElement(d,c({ref:t},l))}));function d(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,c=new Array(a);c[0]=g;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:i,c[1]=o;for(var p=2;p<a;p++)c[p]=n[p];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}g.displayName="MDXCreateElement"},14661:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var r=n(25773),i=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Settings service"},c="Settings",o={unversionedId:"api/clients/settings",id:"api/clients/settings",title:"Settings",description:"DeviceScript client for Settings service",source:"@site/docs/api/clients/settings.md",sourceDirName:"api/clients",slug:"/api/clients/settings",permalink:"/devicescript/api/clients/settings",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Settings service"},sidebar:"tutorialSidebar"},s={},p=[],l={toc:p},u="wrapper";function f(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"settings"},"Settings"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/settings/"},"Settings service")," is used internally by the\n",(0,i.kt)("a",{parentName:"p",href:"/developer/packages"},(0,i.kt)("inlineCode",{parentName:"a"},"@devicescript/settings"))," package."),(0,i.kt)("p",null))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e3661ab2.199d6297.js b/assets/js/e3661ab2.199d6297.js new file mode 100644 index 00000000000..7de4b7f5e2e --- /dev/null +++ b/assets/js/e3661ab2.199d6297.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5496],{35318:(I,i,e)=>{e.d(i,{Zo:()=>r,kt:()=>g});var b=e(27378);function t(I,i,e){return i in I?Object.defineProperty(I,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):I[i]=e,I}function l(I,i){var e=Object.keys(I);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(I);i&&(b=b.filter((function(i){return Object.getOwnPropertyDescriptor(I,i).enumerable}))),e.push.apply(e,b)}return e}function c(I){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?l(Object(e),!0).forEach((function(i){t(I,i,e[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(e)):l(Object(e)).forEach((function(i){Object.defineProperty(I,i,Object.getOwnPropertyDescriptor(e,i))}))}return I}function n(I,i){if(null==I)return{};var e,b,t=function(I,i){if(null==I)return{};var e,b,t={},l=Object.keys(I);for(b=0;b<l.length;b++)e=l[b],i.indexOf(e)>=0||(t[e]=I[e]);return t}(I,i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(I);for(b=0;b<l.length;b++)e=l[b],i.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(I,e)&&(t[e]=I[e])}return t}var m=b.createContext({}),a=function(I){var i=b.useContext(m),e=i;return I&&(e="function"==typeof I?I(i):c(c({},i),I)),e},r=function(I){var i=a(I.components);return b.createElement(m.Provider,{value:i},I.children)},Z="mdxType",s={inlineCode:"code",wrapper:function(I){var i=I.children;return b.createElement(b.Fragment,{},i)}},o=b.forwardRef((function(I,i){var e=I.components,t=I.mdxType,l=I.originalType,m=I.parentName,r=n(I,["components","mdxType","originalType","parentName"]),Z=a(e),o=t,g=Z["".concat(m,".").concat(o)]||Z[o]||s[o]||l;return e?b.createElement(g,c(c({ref:i},r),{},{components:e})):b.createElement(g,c({ref:i},r))}));function g(I,i){var e=arguments,t=i&&i.mdxType;if("string"==typeof I||t){var l=e.length,c=new Array(l);c[0]=o;var n={};for(var m in i)hasOwnProperty.call(i,m)&&(n[m]=i[m]);n.originalType=I,n[Z]="string"==typeof I?I:t,c[1]=n;for(var a=2;a<l;a++)c[a]=e[a];return b.createElement.apply(null,c)}return b.createElement.apply(null,e)}o.displayName="MDXCreateElement"},66797:(I,i,e)=>{e.r(i),e.d(i,{assets:()=>m,contentTitle:()=>c,default:()=>s,frontMatter:()=>l,metadata:()=>n,toc:()=>a});var b=e(25773),t=(e(27378),e(35318));const l={},c="Creation Operators",n={unversionedId:"api/observables/creation",id:"api/observables/creation",title:"Creation Operators",description:"from",source:"@site/docs/api/observables/creation.mdx",sourceDirName:"api/observables",slug:"/api/observables/creation",permalink:"/devicescript/api/observables/creation",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Observables",permalink:"/devicescript/api/observables/"},next:{title:"Digital Signal processing",permalink:"/devicescript/api/observables/dsp"}},m={},a=[{value:"from",id:"from",level:2},{value:"interval",id:"interval",level:2},{value:"timer",id:"timer",level:2},{value:"iif",id:"iif",level:2}],r={toc:a},Z="wrapper";function s(I){let{components:i,...l}=I;return(0,t.kt)(Z,(0,b.Z)({},r,l,{components:i,mdxType:"MDXLayout"}),(0,t.kt)("h1",{id:"creation-operators"},"Creation Operators"),(0,t.kt)("h2",{id:"from"},"from"),(0,t.kt)("p",null,"Converts an array into a sequence of values."),(0,t.kt)("img",{alt:"output.svg",src:e(69143).Z,width:"372",height:"190"}),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-ts"},'import { from } from "@devicescript/observables"\n\n// highlight-next-line\nconst obs = from([0, 1, 2, 3, 4])\n\nobs.subscribe(v => console.log(v))\n')),(0,t.kt)("h2",{id:"interval"},"interval"),(0,t.kt)("p",null,"Emits a value at a time interval. The value is the number of callbacks.\nThis observable runs forever."),(0,t.kt)("img",{alt:"output.svg",src:e(53686).Z,width:"402",height:"190"}),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-ts"},'import { interval } from "@devicescript/observables"\n\n// highlight-next-line\nconst obs = interval(1000)\n\nobs.subscribe(v => console.log(v))\n')),(0,t.kt)("h2",{id:"timer"},"timer"),(0,t.kt)("p",null,"Emits a single value, ",(0,t.kt)("inlineCode",{parentName:"p"},"0")," after a time interval, then completes."),(0,t.kt)("img",{alt:"output.svg",src:e(85445).Z,width:"252",height:"190"}),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-ts"},'import { timer } from "@devicescript/observables"\n\n// highlight-next-line\nconst obs = timer(1000)\n\nobs.subscribe(v => console.log(v))\n')),(0,t.kt)("h2",{id:"iif"},"iif"),(0,t.kt)("p",null,"Checks a boolean at subscription time, and chooses between one of two observable sources."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre",className:"language-ts"},'import { from, iif } from "@devicescript/observables"\n\nlet connected: boolean\n// highlight-next-line\nconst obs = iif(() => connected, from(["connected"]), from(["not connected"]))\n\nobs.subscribe(v => console.log(v))\n')))}s.isMDXComponent=!0},69143:(I,i,e)=>{e.d(i,{Z:()=>b});const b="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzIuMzA5NDAxMDc2NzU4NSAxOTAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIxOTAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIzNzIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIxOTAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjMyMC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjE2MS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIzMjIuMzA5NDAxMDc2NzU4NSI+ZnJvbShbYSxiLCBjLCBkXSk8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgOTApIj48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzIwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjMxMCwxOS4yMjY0OTczMDgxMDM3NDIgMzIwLDI1IDMxMCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNjkgMCkiPjxsaW5lIHgxPSIwIiB5MT0iMCIgeDI9IjAiIHkyPSI1MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woNzksIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj5kPC90ZXh0PjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDMyLCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+YzwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNzAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDQ0LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+YjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDMyMSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPmE8L3RleHQ+PC9nPjwvZz48L2c+PC9zdmc+"},85445:(I,i,e)=>{e.d(i,{Z:()=>b});const b="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTIuMzA5NDAxMDc2NzU4NSAxOTAiIHdpZHRoPSIyNTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIxOTAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyNTIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIxOTAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjIwMC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjEwMS4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIyMDIuMzA5NDAxMDc2NzU4NSI+dGltZXIoMTAwMCk8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgOTApIj48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMjAwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjE5MCwxOS4yMjY0OTczMDgxMDM3NDIgMjAwLDI1IDE5MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNDkgMCkiPjxsaW5lIHgxPSIwIiB5MT0iMCIgeDI9IjAiIHkyPSI1MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDcwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMjUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4wPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="},53686:(I,i,e)=>{e.d(i,{Z:()=>b});const b="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDIuMzA5NDAxMDc2NzU4NSAxOTAiIHdpZHRoPSI0MDIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIxOTAiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI0MDIuMzA5NDAxMDc2NzU4NSIgaGVpZ2h0PSIxOTAiIGZpbGw9IndoaXRlIi8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMjUpIj48Zz48cmVjdCB4PSIxIiB5PSIxMSIgd2lkdGg9IjM1MC4zMDk0MDEwNzY3NTg1IiBoZWlnaHQ9IjQ4IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiByeD0iMCIvPjx0ZXh0IHg9IjE3Ni4xNTQ3MDA1MzgzNzkyNSIgeT0iMzUiIGZpbGw9ImJsYWNrIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIyNHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIHdpZHRoPSIzNTIuMzA5NDAxMDc2NzU4NSI+aW50ZXJ2YWwoMTAwMCk8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgOTApIj48Zz48bGluZSB4MT0iMCIgeTE9IjI1IiB4Mj0iMzUwIiB5Mj0iMjUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBwb2ludHM9IjM0MCwxOS4yMjY0OTczMDgxMDM3NDIgMzUwLDI1IDM0MCwzMC43NzM1MDI2OTE4OTYyNTgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIvPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyODAgMCkiPjxlbGxpcHNlIGN4PSIyMCIgY3k9IjI1IiByeD0iMTkiIHJ5PSIxOSIgZmlsbD0iaHNsKDE0NywgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjM8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE5MCAwKSI+PGVsbGlwc2UgY3g9IjIwIiBjeT0iMjUiIHJ4PSIxOSIgcnk9IjE5IiBmaWxsPSJoc2woMjA2LCA2MCUsIDgwJSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIvPjx0ZXh0IHg9IjAiIHk9IjAiIGZpbGw9ImJsYWNrIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxOHB4IiBmb250LXdlaWdodD0ibm9ybWFsIiBmb250LXN0eWxlPSJub3JtYWwiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwIDI1KSI+MjwvdGV4dD48L2c+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgzNSwgNjAlLCA4MCUpIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiLz48dGV4dCB4PSIwIiB5PSIwIiBmaWxsPSJibGFjayIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMThweCIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZm9udC1zdHlsZT0ibm9ybWFsIiBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMCAyNSkiPjE8L3RleHQ+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDApIj48ZWxsaXBzZSBjeD0iMjAiIGN5PSIyNSIgcng9IjE5IiByeT0iMTkiIGZpbGw9ImhzbCgyMjUsIDYwJSwgODAlKSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIi8+PHRleHQgeD0iMCIgeT0iMCIgZmlsbD0iYmxhY2siIGZvbnQtZmFtaWx5PSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4cHgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiIGZvbnQtc3R5bGU9Im5vcm1hbCIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAgMjUpIj4wPC90ZXh0PjwvZz48L2c+PC9nPjwvc3ZnPg=="}}]); \ No newline at end of file diff --git a/assets/js/e5f3ce77.14e8bbcc.js b/assets/js/e5f3ce77.14e8bbcc.js new file mode 100644 index 00000000000..a602a82e590 --- /dev/null +++ b/assets/js/e5f3ce77.14e8bbcc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9917],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>v});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=p(n),d=i,v=u["".concat(s,".").concat(d)]||u[d]||m[d]||r;return n?a.createElement(v,l(l({ref:t},c),{},{components:n})):a.createElement(v,l({ref:t},c))}));function v(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=d;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var p=2;p<r;p++)l[p]=n[p];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},19553:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>o,toc:()=>p});var a=n(25773),i=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Satellite Navigation System service"},l="SatNav",o={unversionedId:"api/clients/satelittenavigationsystem",id:"api/clients/satelittenavigationsystem",title:"SatNav",description:"DeviceScript client for Satellite Navigation System service",source:"@site/docs/api/clients/satelittenavigationsystem.md",sourceDirName:"api/clients",slug:"/api/clients/satelittenavigationsystem",permalink:"/devicescript/api/clients/satelittenavigationsystem",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Satellite Navigation System service"},sidebar:"tutorialSidebar"},s={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"Events",id:"events",level:2},{value:"inactive",id:"inactive",level:3}],c={toc:p},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"satnav"},"SatNav"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A satellite-based navigation system like GPS, Gallileo, ..."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { SatNav } from "@devicescript/core"\n\nconst satNav = new SatNav()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"Reported coordinates, geometric altitude and time of position. Altitude accuracy is 0 if not available."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u64 i9.23 i9.23 u16.16 i26.6 u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SatNav } from "@devicescript/core"\n\nconst satNav = new SatNav()\n// ...\nsatNav.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"rw:enabled"},"enabled"),(0,i.kt)("p",null,"Enables or disables the GPS module"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SatNav } from "@devicescript/core"\n\nconst satNav = new SatNav()\n// ...\nconst value = await satNav.enabled.read()\nawait satNav.enabled.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SatNav } from "@devicescript/core"\n\nconst satNav = new SatNav()\n// ...\nsatNav.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h2",{id:"events"},"Events"),(0,i.kt)("h3",{id:"inactive"},"inactive"),(0,i.kt)("p",null,"The module is disabled or lost connection with satellites."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"satNav.inactive.subscribe(() => {\n\n})\n")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e6691913.9acc5f7c.js b/assets/js/e6691913.9acc5f7c.js new file mode 100644 index 00000000000..865dc9764b7 --- /dev/null +++ b/assets/js/e6691913.9acc5f7c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3233],{7085:e=>{e.exports=JSON.parse('{"name":"docusaurus-theme-search-algolia","id":"default"}')}}]); \ No newline at end of file diff --git a/assets/js/e754dbb1.64bf41b9.js b/assets/js/e754dbb1.64bf41b9.js new file mode 100644 index 00000000000..0c976bb2f89 --- /dev/null +++ b/assets/js/e754dbb1.64bf41b9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[15],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>v});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,s=e.originalType,c=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=l(r),m=i,v=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return r?n.createElement(v,a(a({ref:t},p),{},{components:r})):n.createElement(v,a({ref:t},p))}));function v(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var s=r.length,a=new Array(s);a[0]=m;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[d]="string"==typeof e?e:i,a[1]=o;for(var l=2;l<s;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},73213:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var n=r(25773),i=(r(27378),r(35318));const s={sidebar_position:200},a="Custom Services",o={unversionedId:"developer/drivers/custom-services",id:"developer/drivers/custom-services",title:"Custom Services",description:"Custom service definition files can be added to the ./services/ folder as markdown file.",source:"@site/docs/developer/drivers/custom-services.mdx",sourceDirName:"developer/drivers",slug:"/developer/drivers/custom-services",permalink:"/devicescript/developer/drivers/custom-services",draft:!1,tags:[],version:"current",sidebarPosition:200,frontMatter:{sidebar_position:200},sidebar:"tutorialSidebar",previous:{title:"Serial",permalink:"/devicescript/developer/drivers/serial"},next:{title:"JSON",permalink:"/devicescript/developer/json"}},c={},l=[{value:"Getting started",id:"getting-started",level:3},{value:"DeviceScript support",id:"devicescript-support",level:3},{value:"Node sim support",id:"node-sim-support",level:3},{value:"Dashboard support",id:"dashboard-support",level:3},{value:"Example",id:"example",level:2},{value:"Service specification",id:"service-specification",level:3},{value:"DeviceScript program",id:"devicescript-program",level:3},{value:"Node simulator",id:"node-simulator",level:3}],p={toc:l},d="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"custom-services"},"Custom Services"),(0,i.kt)("p",null,"Custom service definition files can be added to the ",(0,i.kt)("inlineCode",{parentName:"p"},"./services/")," folder as markdown file.\n",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/reference/service-specification/"},"Read about the service specification markdown"),"."),(0,i.kt)("p",null,"The service specifications are compiled by the DeviceScript compiler as part of the build."),(0,i.kt)("h3",{id:"getting-started"},"Getting started"),(0,i.kt)("p",null,"Let's define a custom service for a ",(0,i.kt)("inlineCode",{parentName:"p"},"psychomagnothericenergy")," sensor (Ghostbuster ghost detector).\nStart by configuring your project for simulation by running"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"devs add service psychomagnothericenergy\n")),(0,i.kt)("p",null,"or in Visual Studio Code, using the ",(0,i.kt)("strong",{parentName:"p"},"DeviceScript: Add Service...")," in the command palette."),(0,i.kt)("p",null,"Then update ",(0,i.kt)("inlineCode",{parentName:"p"},"./services/psychomagnothericenergy.md")," with a basic sensor definition."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-markdown",metastring:'title="./services/psychomagnothericenergy.md"',title:'"./services/psychomagnothericenergy.md"'},"# Psychomagnotheric Energy\n\n identifier: 0x1f1dc7d5\n extends: _sensor\n\nMeasures the presence of ghosts in Ghostbusters.\n...\n")),(0,i.kt)("h3",{id:"devicescript-support"},"DeviceScript support"),(0,i.kt)("p",null,"The generated DeviceClient client are automatically added to the ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/core")," module,\nin ",(0,i.kt)("inlineCode",{parentName:"p"},"./node_module/@devicescript/core/src/devicescript-spec.d.ts"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./main.ts" skip',title:'"./main.ts"',skip:!0},'// highlight-next-line\nimport { PsychomagnothericEnergy } from "@devicescript/core"\n\nconst gigameter = new PsychomagnothericEnergy()\n...\n')),(0,i.kt)("h3",{id:"node-sim-support"},"Node sim support"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"./sim/runtime.ts")," scafolding will automaticlly pick up\nthe generated files to support node.js. See ",(0,i.kt)("a",{parentName:"p",href:"/developer/simulation"},"simulation")," to configure your project for simulation."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The generated TypeScript constants are generated at ",(0,i.kt)("inlineCode",{parentName:"li"},"./.devicescript/ts/constants.ts"),"."),(0,i.kt)("li",{parentName:"ul"},"The generated JSON are at ",(0,i.kt)("inlineCode",{parentName:"li"},"./.devicescript/services.json"),".")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./sim/app.ts" skip',title:'"./sim/app.ts"',skip:!0},'// highlight-next-line\nimport { SRV_PSYCHOMAGNOTHERIC_ENERGY } from "../.devicescript/ts/constants"\n\nconst server = new AnalogSensorServer(SRV_PSYCHOMAGNOTHERIC_ENERGY, {\n ...\n})\n...\n')),(0,i.kt)("h3",{id:"dashboard-support"},"Dashboard support"),(0,i.kt)("p",null,"The DeviceScript simulators dashboard has a limited support for rendering custom services.\nFor sensors, it will be able to render sliders as long as ",(0,i.kt)("inlineCode",{parentName:"p"},"min"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"max")," values are provided for the ",(0,i.kt)("inlineCode",{parentName:"p"},"reading")," register."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"aurascope")," is some kind of ghost detector in the Ghost Busters movie. Let's create a service for it."),(0,i.kt)("h3",{id:"service-specification"},"Service specification"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-markdown",metastring:'title="./services/psychomagnothericenergy.md"',title:'"./services/psychomagnothericenergy.md"'},"# Psychomagnotheric Energy\n\n identifier: 0x1f1dc7d5\n extends: _sensor\n\nMeasures the presence of ghosts in Ghostbusters.\n\n## Registers\n\n ro energy_level: u0.16 / @ reading\n\nA measure of the presence of ghosts.\n\n ro energy_level_error: u0.16 / @ reading_error\n\nError on the measure.\n")),(0,i.kt)("h3",{id:"devicescript-program"},"DeviceScript program"),(0,i.kt)("p",null,"This DeviceScript program creates a client for the aurascope and prints the currently energly level to the console."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./main.ts" skip',title:'"./main.ts"',skip:!0},'import { PsychomagnothericEnergy } from "@devicescript/core"\n\nconst gigameter = new PsychomagnothericEnergy()\ngigameter.energyLevel.subscribe(async (energyLevel) => {\n console.log(energyLevel)\n})\n')),(0,i.kt)("h3",{id:"node-simulator"},"Node simulator"),(0,i.kt)("p",null,"The node.js simulator script mounts a aurascope simulator, with an interval that randomly changes the energy level value."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./sim/app.ts" skip',title:'"./sim/app.ts"',skip:!0},'import { addServer, AnalogSensorServer } from "jacdac-ts"\nimport { bus } from "./runtime"\nimport { SRV_PSYCHOMAGNOTHERIC_ENERGY } from "../.devicescript/ts/constants"\n\n// simulator a customer service\nconst server = new AnalogSensorServer(SRV_PSYCHOMAGNOTHERIC_ENERGY, {\n readingValues: [0.5],\n readingError: [0.1],\n streamingInterval: 500,\n})\n// randomly change the reading value\nsetInterval(() => {\n const value = server.reading.values()[0]\n const newValue = value + (0.5 - Math.random()) / 10\n server.reading.setValues([newValue])\n console.debug(`psycho value: ${newValue}`)\n}, 100)\n\n// mount server on bus to make it visible\n// to DeviceScript\naddServer(bus, "aurascope", server)\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ea5052e5.9d6ff0d0.js b/assets/js/ea5052e5.9d6ff0d0.js new file mode 100644 index 00000000000..57ebbb41905 --- /dev/null +++ b/assets/js/ea5052e5.9d6ff0d0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2105],{35318:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},l="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),l=d(n),p=i,f=l["".concat(s,".").concat(p)]||l[p]||g[p]||o;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=p;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[l]="string"==typeof e?e:i,a[1]=c;for(var d=2;d<o;d++)a[d]=n[d];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}p.displayName="MDXCreateElement"},59112:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>g,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(25773),i=(n(27378),n(35318));const o={title:"Debugging",sidebar_position:3},a="Debugging",c={unversionedId:"getting-started/vscode/debugging",id:"getting-started/vscode/debugging",title:"Debugging",description:"DeviceScript programs can be debugged using the usual Visual Studio Code debugger interface.",source:"@site/docs/getting-started/vscode/debugging.mdx",sourceDirName:"getting-started/vscode",slug:"/getting-started/vscode/debugging",permalink:"/devicescript/getting-started/vscode/debugging",draft:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{title:"Debugging",sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"User Interface",permalink:"/devicescript/getting-started/vscode/user-interface"},next:{title:"Troubleshooting",permalink:"/devicescript/getting-started/vscode/troubleshooting"}},s={},d=[{value:"Configuration",id:"configuration",level:2},{value:"<code>program</code>",id:"program",level:3},{value:"<code>stopOnEntry</code>",id:"stoponentry",level:3},{value:"<code>deviceId</code>",id:"deviceid",level:3}],u={toc:d},l="wrapper";function g(e){let{components:t,...n}=e;return(0,i.kt)(l,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"debugging"},"Debugging"),(0,i.kt)("p",null,"DeviceScript programs can be debugged using the usual Visual Studio Code debugger interface."),(0,i.kt)("p",null,"The services communication layer continues to process packets while the DeviceScript program is paused."),(0,i.kt)("h2",{id:"configuration"},"Configuration"),(0,i.kt)("p",null,"DeviceScript project come with default debugging configurations, in ",(0,i.kt)("inlineCode",{parentName:"p"},"launch.json"),", that can be extended or reconfigured."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="launch.json"',title:'"launch.json"'},'{\n "version": "0.2.0",\n "configurations": [\n ...\n // highlight-start\n {\n "name": "DeviceScript",\n "type": "devicescript",\n "request": "launch",\n "program": "${workspaceFolder}/src/main.ts",\n "deviceId": "${command:deviceScriptSimulator}",\n "stopOnEntry": false\n },\n // highlight-end\n ]\n}\n')),(0,i.kt)("h3",{id:"program"},(0,i.kt)("inlineCode",{parentName:"h3"},"program")),(0,i.kt)("p",null,"Let's you choose a different entry point file for debugging."),(0,i.kt)("h3",{id:"stoponentry"},(0,i.kt)("inlineCode",{parentName:"h3"},"stopOnEntry")),(0,i.kt)("p",null,"Notifies the debugger to break on the first user-code statement, or not."),(0,i.kt)("h3",{id:"deviceid"},(0,i.kt)("inlineCode",{parentName:"h3"},"deviceId")),(0,i.kt)("p",null,"Specifies the device that the debugger should bind to. It can be a device identifier (short or long)\nor the ",(0,i.kt)("inlineCode",{parentName:"p"},"${command:deviceScriptSimulator}")," command that launches the simulator."))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ea615551.d07f1da6.js b/assets/js/ea615551.d07f1da6.js new file mode 100644 index 00000000000..48114067ee7 --- /dev/null +++ b/assets/js/ea615551.d07f1da6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7486],{35318:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>f});var r=n(27378);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,c=e.originalType,s=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||c;return n?r.createElement(f,i(i({ref:t},l),{},{components:n})):r.createElement(f,i({ref:t},l))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var c=n.length,i=new Array(c);i[0]=m;var a={};for(var s in t)hasOwnProperty.call(t,s)&&(a[s]=t[s]);a.originalType=e,a[u]="string"==typeof e?e:o,i[1]=a;for(var p=2;p<c;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},98079:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>c,metadata:()=>a,toc:()=>p});var r=n(25773),o=(n(27378),n(35318));const c={title:"Network and Sockets",sidebar_position:14},i="Network",a={unversionedId:"developer/net/index",id:"developer/net/index",title:"Network and Sockets",description:"DeviceScript supports TCP, TLS, MQTT and HTTP/HTTPS sockets on specific devices.",source:"@site/docs/developer/net/index.mdx",sourceDirName:"developer/net",slug:"/developer/net/",permalink:"/devicescript/developer/net/",draft:!1,tags:[],version:"current",sidebarPosition:14,frontMatter:{title:"Network and Sockets",sidebar_position:14},sidebar:"tutorialSidebar",previous:{title:"Low Power",permalink:"/devicescript/developer/low-power"},next:{title:"Encrypted Fetch",permalink:"/devicescript/developer/net/encrypted-fetch"}},s={},p=[{value:"fetch",id:"fetch",level:2},{value:"encryptedFetch",id:"encryptedfetch",level:2},{value:"MQTT client",id:"mqtt-client",level:2},{value:"TCP/TLS Sockets",id:"tcptls-sockets",level:2}],l={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(u,(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"network"},"Network"),(0,o.kt)("p",null,"DeviceScript supports TCP, TLS, MQTT and HTTP/HTTPS sockets on specific ",(0,o.kt)("a",{parentName:"p",href:"/devices"},"devices"),"."),(0,o.kt)("admonition",{title:"Limitations",type:"note"},(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Only one socket can be open at a time. On most devices, a TLS will use a large part of the usable memory."),(0,o.kt)("li",{parentName:"ul"},"Sockets can be connect to server but not listen so it is not possible to implement a HTTP server currently."))),(0,o.kt)("h2",{id:"fetch"},"fetch"),(0,o.kt)("p",null,"DeviceScript provides the familiar ",(0,o.kt)("inlineCode",{parentName:"p"},"fetch")," function to issue HTTP/HTTPS requests.\n",(0,o.kt)("inlineCode",{parentName:"p"},"fetch")," is designed to match the browser ",(0,o.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API"},"Fetch API"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { fetch } from "@devicescript/net"\n\nconst res = await fetch(`https://github.com/status.json`)\nconst body = await res.json()\nconsole.log(`GitHub is ${body.status}`)\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/blob/main/packages/net/src/fetch.ts"},"fetch sources"),"\ncan help you with understanding how to use sockets.")),(0,o.kt)("h2",{id:"encryptedfetch"},"encryptedFetch"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"/developer/net/encrypted-fetch"},"encryptedFetch")," function lets you\nHTTP POST encrypted data and read encrypted responses using symmetric encryption\n(AES-256-CCM)."),(0,o.kt)("h2",{id:"mqtt-client"},"MQTT client"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"/developer/net/mqtt"},"startMQTTClient")," function connects to a MQTT broker using TCP or TLS."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { startMQTTClient } from "@devicescript/net"\n\nconst mqtt = await startMQTTClient({\n host: "broker.hivemq.com",\n proto: "tcp",\n port: 1883,\n})\nawait mqtt.publish("devs/log", "hello!")\n')),(0,o.kt)("h2",{id:"tcptls-sockets"},"TCP/TLS Sockets"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function to open a socket TCP or TLS socket."),(0,o.kt)("p",null,"This example issues is HTTPS request to the Github.com status API."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { connect } from "@devicescript/net"\n\nconst socket = await connect({ proto: "tls", host: "github.com", port: 443 })\nawait socket.send(`GET /status.json HTTP/1.1\nuser-agent: DeviceScript fetch()\naccept: */*\nhost: github.com\nconnection: close\n\n`)\nconst status = await socket.readLine()\nconsole.log(status)\nawait socket.close()\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/eacb47ff.5a4ea165.js b/assets/js/eacb47ff.5a4ea165.js new file mode 100644 index 00000000000..ef1f57db6ef --- /dev/null +++ b/assets/js/eacb47ff.5a4ea165.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4373],{35318:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>c});var n=a(27378);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?l(Object(a),!0).forEach((function(e){r(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function p(t,e){if(null==t)return{};var a,n,r=function(t,e){if(null==t)return{};var a,n,r={},l=Object.keys(t);for(n=0;n<l.length;n++)a=l[n],e.indexOf(a)>=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n<l.length;n++)a=l[n],e.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var o=n.createContext({}),d=function(t){var e=n.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=d(t.components);return n.createElement(o.Provider,{value:e},t.children)},u="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,s=p(t,["components","mdxType","originalType","parentName"]),u=d(a),k=r,c=u["".concat(o,".").concat(k)]||u[k]||m[k]||l;return a?n.createElement(c,i(i({ref:e},s),{},{components:a})):n.createElement(c,i({ref:e},s))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=k;var p={};for(var o in e)hasOwnProperty.call(e,o)&&(p[o]=e[o]);p.originalType=t,p[u]="string"==typeof t?t:r,i[1]=p;for(var d=2;d<l;d++)i[d]=a[d];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}k.displayName="MDXCreateElement"},87295:(t,e,a)=>{a.r(e),a.d(e,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var n=a(25773),r=(a(27378),a(35318));const l={sidebar_position:0},i="Devices",p={unversionedId:"devices/index",id:"devices/index",title:"Devices",description:"This page links to various developer boards that have a DeviceScript runtime firmware.",source:"@site/docs/devices/index.mdx",sourceDirName:"devices",slug:"/devices/",permalink:"/devicescript/devices/",draft:!1,tags:[],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0},sidebar:"tutorialSidebar",previous:{title:"Hex template literal",permalink:"/devicescript/language/hex"},next:{title:"ESP32",permalink:"/devicescript/devices/esp32/"}},o={},d=[{value:"Implementation status",id:"implementation-status",level:2},{value:"Board recommendations",id:"board-recommendations",level:2},{value:"Shields",id:"shields",level:2}],s={toc:d},u="wrapper";function m(t){let{components:e,...a}=t;return(0,r.kt)(u,(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"devices"},"Devices"),(0,r.kt)("p",null,"This page links to various developer boards that have a DeviceScript runtime firmware."),(0,r.kt)("p",null,"For sensors and other peripherals, see ",(0,r.kt)("a",{parentName:"p",href:"/api/drivers"},"drivers"),"."),(0,r.kt)("h2",{id:"implementation-status"},"Implementation status"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Device"),(0,r.kt)("th",{parentName:"tr",align:null},"USB"),(0,r.kt)("th",{parentName:"tr",align:null},"TCP"),(0,r.kt)("th",{parentName:"tr",align:null},"TLS"),(0,r.kt)("th",{parentName:"tr",align:null},"I2C"),(0,r.kt)("th",{parentName:"tr",align:null},"SPI"),(0,r.kt)("th",{parentName:"tr",align:null},"GPIO"),(0,r.kt)("th",{parentName:"tr",align:null},"PWM"),(0,r.kt)("th",{parentName:"tr",align:null},"WS2812B"),(0,r.kt)("th",{parentName:"tr",align:null},"Jacdac"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"WASM Sim")),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ESP32")),(0,r.kt)("td",{parentName:"tr",align:null},"\u26a0\ufe0f"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ESP32-C3")),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ESP32-S2")),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ESP32-S3")),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"RP2040")),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"RP2040-W")),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713"),(0,r.kt)("td",{parentName:"tr",align:null},"\u274c"),(0,r.kt)("td",{parentName:"tr",align:null},"\u2713")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/"},"ESP32")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/rp2040/"},"RP2040"))),(0,r.kt)("p",null,"The PWM is currently only supported through servo, light bulb, buzzer and similar drivers."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"The ESP32-C3 boards are best supported."),"\nThe regular ESP32 (without -C3 or -S2) currently have issues with the USB connection\n(as it's handled by external chip).\nThe ESP32-S2 has limited memory which makes it difficult to use TLS.\nThe ESP32-S3 is very recent and largely untested."),(0,r.kt)("p",null,"The RP2040 should generally work, but TLS is not supported on Pico-W."),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"If you have ESP-IDF or Pico SDK expertise, we are actively looking for contributors to help\nwith the C embedded runtime. You can look at the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/labels/esp32"},"ESP32 issues"),"\nor the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript/labels/rp2040"},"RP2040 issues")," for ideas.\nThere's also an incomplete ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/devicescript-stm32"},"STM32 port")," if you\nwant to contribute there. It's also possible to ",(0,r.kt)("a",{parentName:"p",href:"/devices/add-soc"},"port to a new MCU/SoC"),".")),(0,r.kt)("h2",{id:"board-recommendations"},"Board recommendations"),(0,r.kt)("p",null,"For ",(0,r.kt)("a",{parentName:"p",href:"/devices/esp32/"},"ESP32"),","),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/adafruit-qt-py-c3"},"Adafruit QT Py C3")," and ",(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/feather-s2"},"FeatherS2")," have\n",(0,r.kt)("a",{parentName:"li",href:"https://www.sparkfun.com/qwiic"},"Qwiic")," aka ",(0,r.kt)("a",{parentName:"li",href:"https://learn.adafruit.com/introducing-adafruit-stemma-qt/what-is-stemma-qt"},"STEMMA QT"),"\nconnectors that make it easy to connect I2C sensors;\nthere's also ",(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/adafruit-feather-esp32-s2"},"Adafruit Feather ESP32-S2")," in the same\ncategory but it's untested"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/seeed-xiao-esp32c3"},"Seeed Xiao ESP32C3")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/esp32/esp32c3-rust-devkit"},"ESP32-C3-RUST")," has a builtin temperature/humidity and light sensors, and RGB LED")),(0,r.kt)("p",null,"For ",(0,r.kt)("a",{parentName:"p",href:"/devices/rp2040/"},"RP2040"),","),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/devices/rp2040/pico"},"Raspberry Pi Pico"))),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Your device is not in the list? ",(0,r.kt)("a",{parentName:"p",href:"/devices/add-board"},"Add a new Device Configuration")," in your project.")),(0,r.kt)("h2",{id:"shields"},"Shields"),(0,r.kt)("p",null,"It is also possible to create npm packages for ",(0,r.kt)("a",{parentName:"p",href:"/devices/shields"},"shields or breakouts"),". Those packages\ntypically configure the pins and drivers for a better experience."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/eb1704c0.2586613e.js b/assets/js/eb1704c0.2586613e.js new file mode 100644 index 00000000000..fd8da51e9e0 --- /dev/null +++ b/assets/js/eb1704c0.2586613e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7159],{35318:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>k});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function p(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var o=r.createContext({}),d=function(e){var n=r.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):p(p({},n),e)),t},s=function(e){var n=d(e.components);return r.createElement(o.Provider,{value:n},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=d(t),m=i,k=c["".concat(o,".").concat(m)]||c[m]||u[m]||a;return t?r.createElement(k,p(p({ref:n},s),{},{components:t})):r.createElement(k,p({ref:n},s))}));function k(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,p=new Array(a);p[0]=m;var l={};for(var o in n)hasOwnProperty.call(n,o)&&(l[o]=n[o]);l.originalType=e,l[c]="string"==typeof e?e:i,p[1]=l;for(var d=2;d<a;d++)p[d]=t[d];return r.createElement.apply(null,p)}return r.createElement.apply(null,t)}m.displayName="MDXCreateElement"},81734:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>p,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>d});var r=t(25773),i=(t(27378),t(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Wind speed service"},p="WindSpeed",l={unversionedId:"api/clients/windspeed",id:"api/clients/windspeed",title:"WindSpeed",description:"DeviceScript client for Wind speed service",source:"@site/docs/api/clients/windspeed.md",sourceDirName:"api/clients",slug:"/api/clients/windspeed",permalink:"/devicescript/api/clients/windspeed",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Wind speed service"},sidebar:"tutorialSidebar"},o={},d=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"maxReading",id:"const:maxReading",level:3}],s={toc:d},c="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(c,(0,r.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"windspeed"},"WindSpeed"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,i.kt)("p",null,"A sensor that measures wind speed."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { WindSpeed } from "@devicescript/core"\n\nconst windSpeed = new WindSpeed()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The velocity of the wind."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindSpeed } from "@devicescript/core"\n\nconst windSpeed = new WindSpeed()\n// ...\nconst value = await windSpeed.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindSpeed } from "@devicescript/core"\n\nconst windSpeed = new WindSpeed()\n// ...\nwindSpeed.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"Error on the reading"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindSpeed } from "@devicescript/core"\n\nconst windSpeed = new WindSpeed()\n// ...\nconst value = await windSpeed.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindSpeed } from "@devicescript/core"\n\nconst windSpeed = new WindSpeed()\n// ...\nwindSpeed.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:maxReading"},"maxReading"),(0,i.kt)("p",null,"Maximum speed that can be measured by the sensor."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { WindSpeed } from "@devicescript/core"\n\nconst windSpeed = new WindSpeed()\n// ...\nconst value = await windSpeed.maxReading.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ebf7369b.bf93e01f.js b/assets/js/ebf7369b.bf93e01f.js new file mode 100644 index 00000000000..ce74524a74a --- /dev/null +++ b/assets/js/ebf7369b.bf93e01f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6508],{35318:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},g=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,g=l(e,["components","mdxType","originalType","parentName"]),m=p(n),u=a,k=m["".concat(s,".").concat(u)]||m[u]||c[u]||i;return n?r.createElement(k,o(o({ref:t},g),{},{components:n})):r.createElement(k,o({ref:t},g))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:a,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},98265:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sensor Aggregator service"},o="SensorAggregator",l={unversionedId:"api/clients/sensoraggregator",id:"api/clients/sensoraggregator",title:"SensorAggregator",description:"DeviceScript client for Sensor Aggregator service",source:"@site/docs/api/clients/sensoraggregator.md",sourceDirName:"api/clients",slug:"/api/clients/sensoraggregator",permalink:"/devicescript/api/clients/sensoraggregator",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sensor Aggregator service"},sidebar:"tutorialSidebar"},s={},p=[{value:"Registers",id:"registers",level:2},{value:"inputs",id:"rw:inputs",level:3},{value:"numSamples",id:"ro:numSamples",level:3},{value:"sampleSize",id:"ro:sampleSize",level:3},{value:"streamingSamples",id:"rw:streamingSamples",level:3},{value:"reading",id:"ro:reading",level:3}],g={toc:p},m="wrapper";function c(e){let{components:t,...n}=e;return(0,a.kt)(m,(0,r.Z)({},g,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"sensoraggregator"},"SensorAggregator"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"Aggregate data from multiple sensors into a single stream\n(often used as input to machine learning models on the same device, see model runner service)."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:inputs"},"inputs"),(0,a.kt)("p",null,"Set automatic input collection.\nThese settings are stored in flash."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16 u16 u32 r: b[8] u32 u8 u8 u8 i8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nsensorAggregator.inputs.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:numSamples"},"numSamples"),(0,a.kt)("p",null,"Number of input samples collected so far."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nconst value = await sensorAggregator.numSamples.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nsensorAggregator.numSamples.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:sampleSize"},"sampleSize"),(0,a.kt)("p",null,"Size of a single sample."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nconst value = await sensorAggregator.sampleSize.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nsensorAggregator.sampleSize.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:streamingSamples"},"streamingSamples"),(0,a.kt)("p",null,"When set to ",(0,a.kt)("inlineCode",{parentName:"p"},"N"),", will stream ",(0,a.kt)("inlineCode",{parentName:"p"},"N")," samples as ",(0,a.kt)("inlineCode",{parentName:"p"},"current_sample")," reading."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nconst value = await sensorAggregator.streamingSamples.read()\nawait sensorAggregator.streamingSamples.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nsensorAggregator.streamingSamples.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Last collected sample."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<Buffer>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"b"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SensorAggregator } from "@devicescript/core"\n\nconst sensorAggregator = new SensorAggregator()\n// ...\nsensorAggregator.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ed00ad56.9dc73485.js b/assets/js/ed00ad56.9dc73485.js new file mode 100644 index 00000000000..98363c45f46 --- /dev/null +++ b/assets/js/ed00ad56.9dc73485.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7760],{35318:(t,e,r)=>{r.d(e,{Zo:()=>m,kt:()=>k});var n=r(27378);function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r,n,a={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(a[r]=t[r]);return a}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}var o=n.createContext({}),d=function(t){var e=n.useContext(o),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},m=function(t){var e=d(t.components);return n.createElement(o.Provider,{value:e},t.children)},s="mdxType",g={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},c=n.forwardRef((function(t,e){var r=t.components,a=t.mdxType,i=t.originalType,o=t.parentName,m=l(t,["components","mdxType","originalType","parentName"]),s=d(r),c=a,k=s["".concat(o,".").concat(c)]||s[c]||g[c]||i;return r?n.createElement(k,p(p({ref:e},m),{},{components:r})):n.createElement(k,p({ref:e},m))}));function k(t,e){var r=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var i=r.length,p=new Array(i);p[0]=c;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[s]="string"==typeof t?t:a,p[1]=l;for(var d=2;d<i;d++)p[d]=r[d];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}c.displayName="MDXCreateElement"},38101:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var n=r(25773),a=(r(27378),r(35318));const i={description:"MSR RP2040 Brain 124 v0.1"},p="MSR RP2040 Brain 124 v0.1",l={unversionedId:"devices/rp2040/msr124",id:"devices/rp2040/msr124",title:"MSR RP2040 Brain 124 v0.1",description:"MSR RP2040 Brain 124 v0.1",source:"@site/docs/devices/rp2040/msr124.mdx",sourceDirName:"devices/rp2040",slug:"/devices/rp2040/msr124",permalink:"/devicescript/devices/rp2040/msr124",draft:!1,tags:[],version:"current",frontMatter:{description:"MSR RP2040 Brain 124 v0.1"},sidebar:"tutorialSidebar",previous:{title:"RP2040",permalink:"/devicescript/devices/rp2040/"},next:{title:"MSR Brain RP2040 59 v0.1",permalink:"/devicescript/devices/rp2040/msr59"}},o={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],m={toc:d},s="wrapper";function g(t){let{components:e,...r}=t;return(0,a.kt)(s,(0,n.Z)({},m,r,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"msr-rp2040-brain-124-v01"},"MSR RP2040 Brain 124 v0.1"),(0,a.kt)("p",null,"Prototype board"),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Jacdac on pin 9 using Jacdac connector"),(0,a.kt)("li",{parentName:"ul"},"RGB LED on pins 16, 14, 15 (use ",(0,a.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,a.kt)("li",{parentName:"ul"},"Serial logging on pin 0 at 115200 8N1"),(0,a.kt)("li",{parentName:"ul"},"Service: power (auto-start)")),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,a.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,a.kt)("h2",{id:"stores"},"Stores"),(0,a.kt)("h2",{id:"pins"},"Pins"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,a.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P1")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P10")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P2")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P24")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO24"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P25")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO25"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P26")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO26"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P27")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO27"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P28")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO28"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P29")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO29"),(0,a.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P3")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P4")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P5")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P6")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"P7")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,a.kt)("td",{parentName:"tr",align:"right"},"io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"jacdac.pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,a.kt)("td",{parentName:"tr",align:"right"},"jacdac.pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[0]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO16"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[0]",".pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[1]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[1]",".pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"led.rgb","[2]",".pin")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO15"),(0,a.kt)("td",{parentName:"tr",align:"right"},"led.rgb","[2]",".pin, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"log.pinTX")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,a.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinEn")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO22"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinEn, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinFault")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO12"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinFault, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinLedPulse")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinLedPulse, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinPulse")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinPulse, io")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("strong",{parentName:"td"},"services.power","[0]",".pinUsbDetect")),(0,a.kt)("td",{parentName:"tr",align:"left"},"GPIO11"),(0,a.kt)("td",{parentName:"tr",align:"right"},"services.power","[0]",".pinUsbDetect, io")))),(0,a.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,a.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,a.kt)("p",null,"In ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,a.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "MSR RP2040 Brain 124 v0.1".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/msr124"\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,a.kt)("p",null,"In Visual Studio Code,\nselect ",(0,a.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,a.kt)("p",null,"Run this ",(0,a.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board msr124\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-msr124.uf2"},"Firmware"))),(0,a.kt)("h2",{id:"configuration"},"Configuration"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="msr124.json"',title:'"msr124.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",\n "id": "msr124",\n "devName": "MSR RP2040 Brain 124 v0.1",\n "productId": "0x3875e80d",\n "$description": "Prototype board",\n "archId": "rp2040",\n "jacdac": {\n "$connector": "Jacdac",\n "pin": 9\n },\n "led": {\n "rgb": [\n {\n "mult": 250,\n "pin": 16\n },\n {\n "mult": 60,\n "pin": 14\n },\n {\n "mult": 150,\n "pin": 15\n }\n ]\n },\n "log": {\n "baud": 115200,\n "pinTX": 0\n },\n "pins": {\n "@HILIM": 18,\n "P1": 1,\n "P10": 10,\n "P2": 2,\n "P24": 24,\n "P25": 25,\n "P26": 26,\n "P27": 27,\n "P28": 28,\n "P29": 29,\n "P3": 3,\n "P4": 4,\n "P5": 5,\n "P6": 6,\n "P7": 7\n },\n "sPin": {\n "#": "enable high power limiter mode",\n "@HILIM": 0\n },\n "services": [\n {\n "faultIgnoreMs": 1000,\n "mode": 3,\n "name": "power",\n "pinEn": 22,\n "pinFault": 12,\n "pinLedPulse": 13,\n "pinPulse": 8,\n "pinUsbDetect": 11,\n "service": "power"\n }\n ]\n}\n')))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/edce4ca7.e412cf10.js b/assets/js/edce4ca7.e412cf10.js new file mode 100644 index 00000000000..2f85b916208 --- /dev/null +++ b/assets/js/edce4ca7.e412cf10.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1514],{35318:(t,e,r)=>{r.d(e,{Zo:()=>d,kt:()=>u});var a=r(27378);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){if(null==t)return{};var r,a,n=function(t,e){if(null==t)return{};var r,a,n={},i=Object.keys(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var l=a.createContext({}),s=function(t){var e=a.useContext(l),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},d=function(t){var e=s(t.components);return a.createElement(l.Provider,{value:e},t.children)},m="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},g=a.forwardRef((function(t,e){var r=t.components,n=t.mdxType,i=t.originalType,l=t.parentName,d=o(t,["components","mdxType","originalType","parentName"]),m=s(r),g=n,u=m["".concat(l,".").concat(g)]||m[g]||c[g]||i;return r?a.createElement(u,p(p({ref:e},d),{},{components:r})):a.createElement(u,p({ref:e},d))}));function u(t,e){var r=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=r.length,p=new Array(i);p[0]=g;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o[m]="string"==typeof t?t:n,p[1]=o;for(var s=2;s<i;s++)p[s]=r[s];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}g.displayName="MDXCreateElement"},75589:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>l,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var a=r(25773),n=(r(27378),r(35318));const i={description:"Espressif ESP32 (bare)"},p="Espressif ESP32 (bare)",o={unversionedId:"devices/esp32/esp32-bare",id:"devices/esp32/esp32-bare",title:"Espressif ESP32 (bare)",description:"Espressif ESP32 (bare)",source:"@site/docs/devices/esp32/esp32-bare.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32-bare",permalink:"/devicescript/devices/esp32/esp32-bare",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32 (bare)"},sidebar:"tutorialSidebar",previous:{title:"Adafruit QT Py ESP32-C3 WiFi",permalink:"/devicescript/devices/esp32/adafruit-qt-py-c3"},next:{title:"ESP32-C3FH4-RGB",permalink:"/devicescript/devices/esp32/esp32-c3fh4-rgb"}},l={},s=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:s},m="wrapper";function c(t){let{components:e,...r}=t;return(0,n.kt)(m,(0,a.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"espressif-esp32-bare"},"Espressif ESP32 (bare)"),(0,n.kt)("p",null,"Bare ESP32 without any default functions for pins."),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.espressif.com/en/products/socs/esp32"},"https://www.espressif.com/en/products/socs/esp32"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P19")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO19"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P22")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO22"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P23")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO23"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P25")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO25"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P26")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO26"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P27")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO27"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P32")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO32"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P33")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P34")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P35")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P36")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P39")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO39"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io, touch")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32 (bare)".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32_bare"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32_bare\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32-esp32_bare-0x1000.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32_bare.json"',title:'"esp32_bare.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32_bare",\n "devName": "Espressif ESP32 (bare)",\n "productId": "0x3ff6ffeb",\n "$description": "Bare ESP32 without any default functions for pins.",\n "archId": "esp32",\n "url": "https://www.espressif.com/en/products/socs/esp32",\n "pins": {\n "P13": 13,\n "P14": 14,\n "P18": 18,\n "P19": 19,\n "P21": 21,\n "P22": 22,\n "P23": 23,\n "P25": 25,\n "P26": 26,\n "P27": 27,\n "P32": 32,\n "P33": 33,\n "P34": 34,\n "P35": 35,\n "P36": 36,\n "P39": 39,\n "P4": 4\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/edf0ab12.aa80eb25.js b/assets/js/edf0ab12.aa80eb25.js new file mode 100644 index 00000000000..db94456d278 --- /dev/null +++ b/assets/js/edf0ab12.aa80eb25.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9578],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var a=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(n),m=i,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||s;return n?a.createElement(h,r(r({ref:t},c),{},{components:n})):a.createElement(h,r({ref:t},c))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var s=n.length,r=new Array(s);r[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[p]="string"==typeof e?e:i,r[1]=o;for(var u=2;u<s;u++)r[u]=n[u];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},92831:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>u});var a=n(25773),i=(n(27378),n(35318));const s={sidebar_position:4.1,hide_table_of_contents:!0},r="GitHub Build Status",o={unversionedId:"samples/github-build-status",id:"samples/github-build-status",title:"GitHub Build Status",description:"In this sample, we will query the GitHub API to get the status of the latest build of a repository. The status will be used to update the status light.",source:"@site/docs/samples/github-build-status.mdx",sourceDirName:"samples",slug:"/samples/github-build-status",permalink:"/devicescript/samples/github-build-status",draft:!1,tags:[],version:"current",sidebarPosition:4.1,frontMatter:{sidebar_position:4.1,hide_table_of_contents:!0},sidebar:"tutorialSidebar",previous:{title:"Thermostat",permalink:"/devicescript/samples/thermostat"},next:{title:"Temperature + MQTT",permalink:"/devicescript/samples/temperature-mqtt"}},l={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Getting the build status",id:"getting-the-build-status",level:2},{value:"Settings and secrets",id:"settings-and-secrets",level:2},{value:"Using <code>fetch</code>",id:"using-fetch",level:2},{value:"Parsing the response",id:"parsing-the-response",level:2},{value:"Updating the status light",id:"updating-the-status-light",level:2},{value:"Putting it all together",id:"putting-it-all-together",level:2}],c={toc:u},p="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(p,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"github-build-status"},"GitHub Build Status"),(0,i.kt)("p",null,"In this sample, we will query the GitHub API to get the status of the latest build of a repository. The status will be used to update the ",(0,i.kt)("a",{parentName:"p",href:"/developer/status-light"},"status light"),"."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/devices"},"Device")," with WiFi connectivity (ESP32 only currently)"),(0,i.kt)("li",{parentName:"ul"},"GitHub account and repository")),(0,i.kt)("h2",{id:"getting-the-build-status"},"Getting the build status"),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28"},"GitHub commit API")," allows to query the\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference"},"combined status of a reference"),".\nWe can use this API to get the status of a branch in the repository."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'curl -L \\\n -H "Accept: application/vnd.github+json" \\\n -H "Authorization: Bearer <TOKEN>"\\\n -H "X-GitHub-Api-Version: 2022-11-28" \\\n https://api.github.com/repos/OWNER/REPO/commits/REF/status\n')),(0,i.kt)("h2",{id:"settings-and-secrets"},"Settings and secrets"),(0,i.kt)("p",null,"To make the request to GitHub, you need a few configuration strings and one secret. Instead of storing those in source code,\nwe use the builtin ",(0,i.kt)("a",{parentName:"p",href:"/developer/settings"},"settings"),"."),(0,i.kt)("p",null,"Public configuration settings are stored in the ",(0,i.kt)("inlineCode",{parentName:"p"},"./env.defaults")," file. This file is part of the source code and can be committed to a repository."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml",metastring:'title="./env.defaults"',title:'"./env.defaults"'},"GITHUB_OWNER=microsoft\nGITHUB_REPO=devicescript\n# defaults to main\n# GITHUB_REF=master\n")),(0,i.kt)("p",null,"For private repositories, you will need a token to access the API.\nSecrets are stored in the ",(0,i.kt)("inlineCode",{parentName:"p"},"./env.local")," file. This file is not part of the source code and ",(0,i.kt)("strong",{parentName:"p"},"should not be committed to a repository"),".\nThe GitHub token needs ",(0,i.kt)("inlineCode",{parentName:"p"},"repo:status")," scope (and no more). You can create a token in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/settings/tokens"},"GitHub settings"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml",metastring:'title="./env.local"',title:'"./env.local"'},"GITHUB_TOKEN=...\n")),(0,i.kt)("p",null,"In the code, we use the ",(0,i.kt)("inlineCode",{parentName:"p"},"readSettings")," function to read the settings and secrets."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:'title="./src/index.ts"',title:'"./src/index.ts"'},'import { readSetting } from "@devicescript/settings"\n\n// read configuration from ./env.defaults\nconst owner = await readSetting("GITHUB_OWNER")\nconst repo = await readSetting("GITHUB_REPO")\n// read ref or default to \'main\'\nconst ref = await readSetting("GITHUB_REF", "main")\n// read secret from ./env.local\nconst token = await readSetting("GITHUB_TOKEN", "")\n\nconsole.log({ owner, repo, ref })\n')),(0,i.kt)("h2",{id:"using-fetch"},"Using ",(0,i.kt)("inlineCode",{parentName:"h2"},"fetch")),(0,i.kt)("p",null,"We combine the settings and secrets to create the URL to query the GitHub API. We use the ",(0,i.kt)("inlineCode",{parentName:"p"},"fetch")," function from the\n",(0,i.kt)("a",{parentName:"p",href:"/developer/net"},"@devicescript/net")," package to make the request. Fetch is similar to the ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch"},"Fetch API"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { fetch } from "@devicescript/net"\n\n...\n\nconst res = await fetch(\n `https://api.github.com/repos/${owner}/${repo}/commits/${ref}/status`,\n {\n headers: {\n Accept: "application/vnd.github+json",\n Authorization: token ? `Bearer ${token}` : undefined,\n "X-GitHub-Api-Version": "2022-11-28",\n },\n }\n)\n\nconsole.log({ res })\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"Microcontrollers are memory constrained and you should always try to minimize the amount of data you send and receive.\nThe ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/graphql"},"GraphQL API")," from GitHub would allow you to create more targetted queries with smaller result payloads.")),(0,i.kt)("h2",{id:"parsing-the-response"},"Parsing the response"),(0,i.kt)("p",null,"Handle the ",(0,i.kt)("inlineCode",{parentName:"p"},"fetch")," response you like any other response. In this case, we parse the JSON response and log the status."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'if (res.status === 200) {\n const json = await res.json()\n const state: "failure" | "pending" | "success" = json.state\n console.log({ json, state })\n}\n')),(0,i.kt)("h2",{id:"updating-the-status-light"},"Updating the status light"),(0,i.kt)("p",null,"Based on the last state, we'll create some LED animation on the status light:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"failure"),": blinking fast red (2x per second)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"pending"),": blinking slow orange (1x per second)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"success"),": solid green")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { setStatusLight } from "@devicescript/runtime"\n\nlet state: "failure" | "pending" | "success" = ...\nlet blinki = 0\n\nsetInterval(async () => {\n blinki++;\n let c = 0x000000\n if (state === "failure")\n c = blinki % 2 === 0 ? 0x100000 : 0x000000 // blink fast red\n else if (state === "pending")\n c = (blinki >> 1) % 2 === 0 ? 0x100500 : 0x000000 // blink slow orange\n else if (state === "success") c = 0x000a00 // solid green\n else c = 0x000000 // dark if any error\n await setStatusLight(c)\n}, 500)\n')),(0,i.kt)("h2",{id:"putting-it-all-together"},"Putting it all together"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { readSetting } from "@devicescript/settings"\nimport { fetch } from "@devicescript/net"\nimport { schedule, setStatusLight } from "@devicescript/runtime"\n\n// read configuration from ./env.defaults\nconst owner = await readSetting("GITHUB_OWNER")\nconst repo = await readSetting("GITHUB_REPO")\n// read ref or default to \'main\'\nconst ref = await readSetting("GITHUB_REF", "main")\n// read secret from ./env.local\nconst token = await readSetting("GITHUB_TOKEN", "")\n\nif (!owner || !repo) throw new Error("missing configuration")\n\n// track state of last fetch\nlet state: "failure" | "pending" | "success" | "error" | "" = ""\nlet blinki = 0\n\n// update status light\nsetInterval(async () => {\n blinki++\n let c = 0x000000\n if (state === "failure")\n c = blinki % 2 === 0 ? 0x100000 : 0x000000 // blink fast red\n else if (state === "pending")\n c = (blinki >> 1) % 2 === 0 ? 0x100500 : 0x000000 // blink slow orange\n else if (state === "success") c = 0x000a00 // solid green\n else c = 0x000000 // dark if any error\n await setStatusLight(c)\n}, 500)\n\nschedule(\n async () => {\n const res = await fetch(\n `https://api.github.com/repos/${owner}/${repo}/commits/${ref}/status`,\n {\n headers: {\n Accept: "application/vnd.github+json",\n Authorization: token ? `Bearer ${token}` : undefined,\n "X-GitHub-Api-Version": "2022-11-28",\n },\n }\n )\n if (res.status === 200) {\n const json = await res.json()\n state = json.state\n console.log({ json, state })\n } else state = "error"\n },\n { timeout: 1000, interval: 60000 }\n)\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ee7ced19.45253efc.js b/assets/js/ee7ced19.45253efc.js new file mode 100644 index 00000000000..6114d692236 --- /dev/null +++ b/assets/js/ee7ced19.45253efc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1571],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>d});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",v={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=i,d=u["".concat(c,".").concat(m)]||u[m]||v[m]||o;return r?n.createElement(d,a(a({ref:t},s),{},{components:r})):n.createElement(d,a({ref:t},s))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=m;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:i,a[1]=l;for(var p=2;p<o;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},19140:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>v,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Rover service"},a="Rover",l={unversionedId:"api/clients/rover",id:"api/clients/rover",title:"Rover",description:"DeviceScript client for Rover service",source:"@site/docs/api/clients/rover.md",sourceDirName:"api/clients",slug:"/api/clients/rover",permalink:"/devicescript/api/clients/rover",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Rover service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3}],s={toc:p},u="wrapper";function v(e){let{components:t,...r}=e;return(0,i.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"rover"},"Rover"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A roving robot."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Rover } from "@devicescript/core"\n\nconst rover = new Rover()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"The current position and orientation of the robot."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"i16.16 i16.16 i16.16 i16.16 i16.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"track incoming values"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Rover } from "@devicescript/core"\n\nconst rover = new Rover()\n// ...\nrover.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/eed45f36.5906f5bb.js b/assets/js/eed45f36.5906f5bb.js new file mode 100644 index 00000000000..597a8a3721b --- /dev/null +++ b/assets/js/eed45f36.5906f5bb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1993],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(r),d=o,y=m["".concat(l,".").concat(d)]||m[d]||u[d]||a;return r?n.createElement(y,i(i({ref:t},c),{},{components:r})):n.createElement(y,i({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[m]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"},58100:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(27378);const o={borderRadius:"0.5rem",marginTop:"1rem",marginBottom:"1rem",maxHeight:"40rem",maxWidth:"40rem"};function a(e){const{name:t,style:r=o,webm:a}=e,i=(0,n.useRef)(null);return n.createElement("video",{ref:i,style:r,poster:`/devicescript/videos/${t}.jpg`,playsInline:!0,controls:!0,preload:"metadata"},n.createElement("source",{src:`/devicescript/videos/${t}.mp4`,type:"video/mp4"}),n.createElement("p",null,"Your browser doesn't support HTML video. Here is a",n.createElement("a",{href:`/devicescript/videos/${t}.mp4`},"link to the video")," ","instead."))}},74742:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(25773),o=(r(27378),r(35318)),a=r(58100);const i={description:"Explore various markdown samples including Blinky, Thermostat, and Copy-Paste Button",keywords:["markdown","samples","blinky","thermostat","copy-paste button"]},s="Samples",l={unversionedId:"samples/index",id:"samples/index",title:"Samples",description:"Explore various markdown samples including Blinky, Thermostat, and Copy-Paste Button",source:"@site/docs/samples/index.mdx",sourceDirName:"samples",slug:"/samples/",permalink:"/devicescript/samples/",draft:!1,tags:[],version:"current",frontMatter:{description:"Explore various markdown samples including Blinky, Thermostat, and Copy-Paste Button",keywords:["markdown","samples","blinky","thermostat","copy-paste button"]},sidebar:"tutorialSidebar",previous:{title:"Errors",permalink:"/devicescript/developer/errors"},next:{title:"Status Light Blinky",permalink:"/devicescript/samples/status-light-blinky"}},p={},c=[],m={toc:c},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"samples"},"Samples"),(0,o.kt)("p",null,"Navigate the table of contents for the list of samples."),(0,o.kt)(a.Z,{name:"blinky",mdxType:"StaticVideo"}))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ef45af3d.5208b092.js b/assets/js/ef45af3d.5208b092.js new file mode 100644 index 00000000000..7e21dbb3d58 --- /dev/null +++ b/assets/js/ef45af3d.5208b092.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8305],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var r=n(27378);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,l=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=i,g=u["".concat(p,".").concat(d)]||u[d]||m[d]||l;return n?r.createElement(g,a(a({ref:t},s),{},{components:n})):r.createElement(g,a({ref:t},s))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var l=n.length,a=new Array(l);a[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,a[1]=o;for(var c=2;c<l;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},54825:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const l={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Light level service"},a="LightLevel",o={unversionedId:"api/clients/lightlevel",id:"api/clients/lightlevel",title:"LightLevel",description:"DeviceScript client for Light level service",source:"@site/docs/api/clients/lightlevel.md",sourceDirName:"api/clients",slug:"/api/clients/lightlevel",permalink:"/devicescript/api/clients/lightlevel",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Light level service"},sidebar:"tutorialSidebar"},p={},c=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingError",id:"ro:readingError",level:3},{value:"variant",id:"const:variant",level:3}],s={toc:c},u="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"lightlevel"},"LightLevel"),(0,i.kt)("p",null,"A sensor that measures luminosity level."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightLevel } from "@devicescript/core"\n\nconst lightLevel = new LightLevel()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"ro:reading"},"reading"),(0,i.kt)("p",null,"Detect light level"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightLevel } from "@devicescript/core"\n\nconst lightLevel = new LightLevel()\n// ...\nconst value = await lightLevel.reading.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightLevel } from "@devicescript/core"\n\nconst lightLevel = new LightLevel()\n// ...\nlightLevel.reading.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"ro:readingError"},"readingError"),(0,i.kt)("p",null,"Absolute estimated error of the reading value"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightLevel } from "@devicescript/core"\n\nconst lightLevel = new LightLevel()\n// ...\nconst value = await lightLevel.readingError.read()\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightLevel } from "@devicescript/core"\n\nconst lightLevel = new LightLevel()\n// ...\nlightLevel.readingError.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("h3",{id:"const:variant"},"variant"),(0,i.kt)("p",null,"The type of physical sensor."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read only"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { LightLevel } from "@devicescript/core"\n\nconst lightLevel = new LightLevel()\n// ...\nconst value = await lightLevel.variant.read()\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ef6ce06d.0d37f2f2.js b/assets/js/ef6ce06d.0d37f2f2.js new file mode 100644 index 00000000000..08f60783007 --- /dev/null +++ b/assets/js/ef6ce06d.0d37f2f2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4278],{35318:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var i=t(27378);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,i,n=function(e,r){if(null==e)return{};var t,i,n={},o=Object.keys(e);for(i=0;i<o.length;i++)t=o[i],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)t=o[i],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var p=i.createContext({}),s=function(e){var r=i.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=s(e.components);return i.createElement(p.Provider,{value:r},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var r=e.children;return i.createElement(i.Fragment,{},r)}},u=i.forwardRef((function(e,r){var t=e.components,n=e.mdxType,o=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(t),u=n,f=d["".concat(p,".").concat(u)]||d[u]||m[u]||o;return t?i.createElement(f,a(a({ref:r},l),{},{components:t})):i.createElement(f,a({ref:r},l))}));function f(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var o=t.length,a=new Array(o);a[0]=u;var c={};for(var p in r)hasOwnProperty.call(r,p)&&(c[p]=r[p]);c.originalType=e,c[d]="string"==typeof e?e:n,a[1]=c;for(var s=2;s<o;s++)a[s]=t[s];return i.createElement.apply(null,a)}return i.createElement.apply(null,t)}u.displayName="MDXCreateElement"},52097:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>a,default:()=>m,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var i=t(25773),n=(t(27378),t(35318));const o={title:"Pimoroni Badger RP2040"},a="Pimoroni Badger RP2040",c={unversionedId:"devices/shields/pimoroni-pico-badger",id:"devices/shields/pimoroni-pico-badger",title:"Pimoroni Badger RP2040",description:"- Device: Raspberry Pi Pico W",source:"@site/docs/devices/shields/pimoroni-pico-badger.mdx",sourceDirName:"devices/shields",slug:"/devices/shields/pimoroni-pico-badger",permalink:"/devicescript/devices/shields/pimoroni-pico-badger",draft:!1,tags:[],version:"current",frontMatter:{title:"Pimoroni Badger RP2040"},sidebar:"tutorialSidebar",previous:{title:"Pico Bricks",permalink:"/devicescript/devices/shields/pico-bricks"},next:{title:"WaveShare Pico-LCD",permalink:"/devicescript/devices/shields/waveshare-pico-lcd-114"}},p={},s=[{value:"DeviceScript import",id:"devicescript-import",level:2}],l={toc:s},d="wrapper";function m(e){let{components:r,...o}=e;return(0,n.kt)(d,(0,i.Z)({},l,o,{components:r,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"pimoroni-badger-rp2040"},"Pimoroni Badger RP2040"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"Device: ",(0,n.kt)("a",{parentName:"li",href:"/devices/rp2040/pico-w"},"Raspberry Pi Pico W")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://shop.pimoroni.com/products/badger-2040-w"},"Home"))),(0,n.kt)("p",null,(0,n.kt)("img",{alt:"Pimoroni Badger RP2040 image",src:t(12604).Z,width:"1038",height:"607"})),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must import ",(0,n.kt)("inlineCode",{parentName:"p"},"PimoroniBadger2040W")," to access the shield services."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "PimoroniBadger2040W".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { font8, scaledFont } from "@devicescript/graphics"\nimport { PimoroniBadger2040W } from "@devicescript/drivers"\n\nconst board = new PimoroniBadger2040W()\nconst disp = await board.startDisplay()\nconst f = scaledFont(font8(), 3)\ndisp.image.print("Hello world!", 10, 10, 1, f)\nawait disp.show()\n')))}m.isMDXComponent=!0},12604:(e,r,t)=>{t.d(r,{Z:()=>i});const i=t.p+"assets/images/pimoroni-pico-badger-bc230e17191d6b4a8df0b57ae03d77c9.jpg"}}]); \ No newline at end of file diff --git a/assets/js/f1347c03.52c9d49c.js b/assets/js/f1347c03.52c9d49c.js new file mode 100644 index 00000000000..a03a36150f3 --- /dev/null +++ b/assets/js/f1347c03.52c9d49c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8926],{35318:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>f});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},l="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},h=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),l=p(t),h=i,f=l["".concat(c,".").concat(h)]||l[h]||u[h]||o;return t?r.createElement(f,a(a({ref:n},d),{},{components:t})):r.createElement(f,a({ref:n},d))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,a=new Array(o);a[0]=h;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s[l]="string"==typeof e?e:i,a[1]=s;for(var p=2;p<o;p++)a[p]=t[p];return r.createElement.apply(null,a)}return r.createElement.apply(null,t)}h.displayName="MDXCreateElement"},29051:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=t(25773),i=(t(27378),t(35318));const o={title:"Encrypted Fetch",sidebar_position:14.5},a="Encrypted Fetch",s={unversionedId:"developer/net/encrypted-fetch",id:"developer/net/encrypted-fetch",title:"Encrypted Fetch",description:"The @devicescript/net package contains encryptedFetch() function which lets you",source:"@site/docs/developer/net/encrypted-fetch.mdx",sourceDirName:"developer/net",slug:"/developer/net/encrypted-fetch",permalink:"/devicescript/developer/net/encrypted-fetch",draft:!1,tags:[],version:"current",sidebarPosition:14.5,frontMatter:{title:"Encrypted Fetch",sidebar_position:14.5},sidebar:"tutorialSidebar",previous:{title:"Network and Sockets",permalink:"/devicescript/developer/net/"},next:{title:"MQTT client",permalink:"/devicescript/developer/net/mqtt"}},c={},p=[{value:"Technical description",id:"technical-description",level:2},{value:"Security",id:"security",level:2}],d={toc:p},l="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(l,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"encrypted-fetch"},"Encrypted Fetch"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"@devicescript/net")," package contains ",(0,i.kt)("inlineCode",{parentName:"p"},"encryptedFetch()")," function which lets you\nHTTP POST encrypted data and read encrypted responses.\nThe encryption uses ",(0,i.kt)("inlineCode",{parentName:"p"},"aes-256-ccm"),"."),(0,i.kt)("p",null,"Let's see how this works!"),(0,i.kt)("p",null,"First, set up a ",(0,i.kt)("inlineCode",{parentName:"p"},"main.ts")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { assert } from "@devicescript/core"\nimport { URL, encryptedFetch } from "@devicescript/net"\nimport { readSetting } from "@devicescript/settings"\n\nasync function sendReq(data: any) {\n const url = new URL(await readSetting<string>("ENC_HTTP_URL"))\n const password = url.hash.split("pass=")[1]\n assert(\n password !== "SecretPassword",\n "Please change password in production!"\n )\n url.hash = ""\n return await encryptedFetch({\n data,\n password,\n url,\n })\n}\nconsole.log(\n await sendReq({\n hello: "world",\n })\n)\n')),(0,i.kt)("p",null,"Second, create a settings file with secrets."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-env",metastring:'title="./.env.local"',title:'"./.env.local"'},'# Local settings and secrets\n# This file should **NOT** tracked by git\n# Make sure to put the value below in "..."; otherwise the # gets treated as comment\nENC_HTTP_URL="http://localhost:8080/api/devs-enc-fetch/mydevice#pass=SecretPassword"\n')),(0,i.kt)("p",null,"In production, you may want to use ",(0,i.kt)("inlineCode",{parentName:"p"},"deviceIdentifier('self')")," as the user name,\nprovided you handle that server-side."),(0,i.kt)("p",null,"On the server side, you can run the code below.\nFeel free to adopt to other languages or frameworks."),(0,i.kt)("admonition",{type:"warning"},(0,i.kt)("p",{parentName:"admonition"},"Two devices should never share a key.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import express from "express"\nimport bodyParser from "body-parser"\nimport * as crypto from "node:crypto"\nimport { config } from "dotenv"\n\nfunction getPasswordForDevice(deviceId: string): string | undefined {\n // TODO look up device in database here!\n\n config({ path: "./.env.local" })\n const url = new URL(process.env["ENC_HTTP_URL"] + "")\n if (url.pathname.replace(/.*\\//, "") == deviceId) {\n const pass = url.hash.split("pass=")[1]\n if (pass !== "SecretPassword") return pass\n }\n\n return undefined\n}\n\nconst TAG_BYTES = 8\nconst IV_BYTES = 13\nconst KEY_BYTES = 32\n\nfunction aesCcmEncrypt(key: Buffer, iv: Buffer, plaintext: Buffer) {\n if (key.length != KEY_BYTES || iv.length != IV_BYTES)\n throw new Error("Invalid key/iv")\n\n const cipher = crypto.createCipheriv("aes-256-ccm", key, iv, {\n authTagLength: TAG_BYTES,\n })\n const b0 = cipher.update(plaintext)\n const b1 = cipher.final()\n const tag = cipher.getAuthTag()\n return Buffer.concat([b0, b1, tag])\n}\n\nfunction aesCcmDecrypt(key: Buffer, iv: Buffer, msg: Buffer) {\n if (\n key.length != KEY_BYTES ||\n iv.length != IV_BYTES ||\n !Buffer.isBuffer(msg)\n )\n throw new Error("invalid key, iv or msg")\n\n if (msg.length < TAG_BYTES) return null\n\n const decipher = crypto.createDecipheriv("aes-256-ccm", key, iv, {\n authTagLength: TAG_BYTES,\n })\n\n decipher.setAuthTag(msg.slice(msg.length - TAG_BYTES))\n\n const b0 = decipher.update(msg.slice(0, msg.length - TAG_BYTES))\n try {\n decipher.final()\n return b0\n } catch {\n return null\n }\n}\n\nconst app = express()\napp.post(\n "/api/devs-enc-fetch/:deviceId",\n bodyParser.raw({ type: "application/x-devs-enc-fetch" }),\n (req, res) => {\n const { deviceId } = req.params\n const pass = getPasswordForDevice(deviceId)\n if (!pass) {\n console.log(`No device ${deviceId}`)\n res.sendStatus(404)\n return\n }\n\n console.log(`Device connected ${deviceId}`)\n\n const iv = Buffer.alloc(13) // zero IV\n const salt = req.headers["x-devs-enc-fetch-salt"] + ""\n const key = Buffer.from(crypto.hkdfSync("sha256", pass, salt, "", 32))\n\n const body = aesCcmDecrypt(key, iv, req.body as Buffer)\n if (!body) {\n console.log(`Can\'t decrypt`)\n res.sendStatus(400)\n return\n }\n const obj = JSON.parse(body.toString("utf-8"))\n console.log("Request body:", obj)\n\n const rid = obj.$rid\n\n const respKeyInfo = crypto.randomBytes(15).toString("base64")\n res.header("x-devs-enc-fetch-info", respKeyInfo)\n const respKey = Buffer.from(\n crypto.hkdfSync("sha256", pass, salt, respKeyInfo, 32)\n )\n\n // TODO check for duplicate rid!\n\n const resp = {\n $rid: rid,\n response: "Got it!",\n }\n\n const rbody = aesCcmEncrypt(\n respKey,\n iv,\n Buffer.from(JSON.stringify(resp), "utf8")\n )\n res.end(rbody)\n }\n)\n\napp.listen(8080)\n')),(0,i.kt)("h2",{id:"technical-description"},"Technical description"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"encryptedFetch()")," function performs as HTTP request which uses ",(0,i.kt)("inlineCode",{parentName:"p"},"content-type")," of ",(0,i.kt)("inlineCode",{parentName:"p"},"application/x-devs-enc-fetch"),"\nand two special headers.\nThe ",(0,i.kt)("inlineCode",{parentName:"p"},"x-devs-enc-fetch-algo")," header contains information about the request encryption algorithm\nand can be safely ignored.\nThe ",(0,i.kt)("inlineCode",{parentName:"p"},"x-devs-enc-fetch-salt")," contain a string salt value for HMAC key derivation function (HKDF) from RFC 5869."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"encryptedFetch()")," function also requires a password, which should be long-ish\nrandom string (with about 256-bits of entropy).\nThe key for AES encryption is derived using HKDF based on the password and previously\ngenerated salt; the ",(0,i.kt)("inlineCode",{parentName:"p"},"info")," parameter is set to ",(0,i.kt)("inlineCode",{parentName:"p"},'""'),".\nThis key is used for both encryption and authentication of the request."),(0,i.kt)("p",null,"The body of the request is a JSON object.\nBefore sending it out, ",(0,i.kt)("inlineCode",{parentName:"p"},"encryptedFetch()")," extends it with a random request identifier (stored in ",(0,i.kt)("inlineCode",{parentName:"p"},"$rid")," property).\nThe JSON object is converted to a buffer and\nencrypted using AES-256-CCM and an 8-byte authentication tag is appended.\nThe initialization vector (IV) is all-zero."),(0,i.kt)("p",null,"This is send to the server, which decrypts the request accordingly."),(0,i.kt)("admonition",{type:"warning"},(0,i.kt)("p",{parentName:"admonition"},"If applicable, the server should check if a request with a given ",(0,i.kt)("inlineCode",{parentName:"p"},"$rid")," was already handled,\nand if so, reject it.\nOtherwise, someone can replay a client request.")),(0,i.kt)("p",null,"If the server responds with with ",(0,i.kt)("inlineCode",{parentName:"p"},"2xx")," code, the response is assumed to be\na JSON object encrypted using a key derived using HKDF from the password,\nthe previously generated salt, and ",(0,i.kt)("inlineCode",{parentName:"p"},"info")," parameter set to the value\nof ",(0,i.kt)("inlineCode",{parentName:"p"},"x-devs-enc-fetch-info")," in the response.\nIV is all zero.\nThe response also has the 8-byte authentication tag."),(0,i.kt)("p",null,"If the response is not ",(0,i.kt)("inlineCode",{parentName:"p"},"2xx")," or if it cannot be authenticated an exception is thrown.\nOtherwise, the JSON object of the response is returned."),(0,i.kt)("h2",{id:"security"},"Security"),(0,i.kt)("p",null,"From the device standpoint, if the salt is unique, the device can be sure\nonly someone with the password can read the request or generate a response.\nResponse cannot be replayed, since the key for it incorporates the salt."),(0,i.kt)("p",null,"From the server standpoint, a man-in-the-middle attacker can intercept\na device request and either delay it or send it again at later time.\nThus, server should check for uniqueness of the ",(0,i.kt)("inlineCode",{parentName:"p"},"$rid")," if this can be a problem.\nThe attacker will not be able to deduce anything about the contents of the response\neven if the server doesn't ignore a duplicate request, since the ",(0,i.kt)("inlineCode",{parentName:"p"},"info")," parameter\nsend from server is incorporated in the response key and it is random."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f209bce9.f1fceef8.js b/assets/js/f209bce9.f1fceef8.js new file mode 100644 index 00000000000..50e27e8d776 --- /dev/null +++ b/assets/js/f209bce9.f1fceef8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2002],{35318:(t,e,r)=>{r.d(e,{Zo:()=>d,kt:()=>g});var a=r(27378);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e){if(null==t)return{};var r,a,n=function(t,e){if(null==t)return{};var r,a,n={},i=Object.keys(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var o=a.createContext({}),l=function(t){var e=a.useContext(o),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},d=function(t){var e=l(t.components);return a.createElement(o.Provider,{value:e},t.children)},m="mdxType",c={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var r=t.components,n=t.mdxType,i=t.originalType,o=t.parentName,d=s(t,["components","mdxType","originalType","parentName"]),m=l(r),k=n,g=m["".concat(o,".").concat(k)]||m[k]||c[k]||i;return r?a.createElement(g,p(p({ref:e},d),{},{components:r})):a.createElement(g,p({ref:e},d))}));function g(t,e){var r=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=r.length,p=new Array(i);p[0]=k;var s={};for(var o in e)hasOwnProperty.call(e,o)&&(s[o]=e[o]);s.originalType=t,s[m]="string"==typeof t?t:n,p[1]=s;for(var l=2;l<i;l++)p[l]=r[l];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}k.displayName="MDXCreateElement"},43660:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>o,contentTitle:()=>p,default:()=>c,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=r(25773),n=(r(27378),r(35318));const i={description:"Espressif ESP32-DevKitC"},p="Espressif ESP32-DevKitC",s={unversionedId:"devices/esp32/esp32-devkit-c",id:"devices/esp32/esp32-devkit-c",title:"Espressif ESP32-DevKitC",description:"Espressif ESP32-DevKitC",source:"@site/docs/devices/esp32/esp32-devkit-c.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/esp32-devkit-c",permalink:"/devicescript/devices/esp32/esp32-devkit-c",draft:!1,tags:[],version:"current",frontMatter:{description:"Espressif ESP32-DevKitC"},sidebar:"tutorialSidebar",previous:{title:"ESP32-C3FH4-RGB",permalink:"/devicescript/devices/esp32/esp32-c3fh4-rgb"},next:{title:"Espressif ESP32-C3 (bare)",permalink:"/devicescript/devices/esp32/esp32c3-bare"}},o={},l=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],d={toc:l},m="wrapper";function c(t){let{components:e,...r}=t;return(0,n.kt)(m,(0,a.Z)({},d,r,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"espressif-esp32-devkitc"},"Espressif ESP32-DevKitC"),(0,n.kt)("p",null,"There are currently issues with serial chip on these, best avoid. ESP32-DevKitC development board. This will also work with DOIT DevkitV1, NodeMCU ESP32, ... (search for 'esp32 devkit'). Some of these boards do not have the LED."),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/espressif/esp32devkitcdevicescriptv40.catalog.jpg",alt:"Espressif ESP32-DevKitC picture"})),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"LED on pin 2 (use ",(0,n.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,n.kt)("li",{parentName:"ul"},"Service: buttonIO0 (button)")),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"I2C pins are not ",(0,n.kt)("a",{parentName:"p",href:"/developer/board-configuration"},"configured"),".")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html"},"https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.espressif.com/en/products/devkits/esp32-devkitc"},"https://www.espressif.com/en/products/devkits/esp32-devkitc"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P13")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO13"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P14")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO14"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P18")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO18"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P19")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO19"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P21")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P22")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO22"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P23")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO23"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P25")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO25"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P26")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO26"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogOut, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P27")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO27"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P32")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO32"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P33")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO33"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P34")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO34"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P35")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO35"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"P4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"VN")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO39"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"VP")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO36"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, input")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"$services.buttonIO0","[0]",".pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"$services.buttonIO0","[0]",".pin, boot, io, touch")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"led.pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"led.pin, boot, io, touch")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Espressif ESP32-DevKitC".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/esp32_devkit_c"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board esp32_devkit_c\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32-esp32_devkit_c-0x1000.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="esp32_devkit_c.json"',title:'"esp32_devkit_c.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "esp32_devkit_c",\n "devName": "Espressif ESP32-DevKitC",\n "productId": "0x3c507a05",\n "$description": "There are currently issues with serial chip on these, best avoid. ESP32-DevKitC development board. This will also work with DOIT DevkitV1, NodeMCU ESP32, ... (search for \'esp32 devkit\'). Some of these boards do not have the LED.",\n "archId": "esp32",\n "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html",\n "$services": [\n {\n "name": "buttonIO0",\n "pin": 0,\n "service": "button"\n }\n ],\n "led": {\n "pin": 2\n },\n "pins": {\n "P13": 13,\n "P14": 14,\n "P18": 18,\n "P19": 19,\n "P21": 21,\n "P22": 22,\n "P23": 23,\n "P25": 25,\n "P26": 26,\n "P27": 27,\n "P32": 32,\n "P33": 33,\n "P34": 34,\n "P35": 35,\n "P4": 4,\n "VN": 39,\n "VP": 36\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f2f2094c.29ecbd42.js b/assets/js/f2f2094c.29ecbd42.js new file mode 100644 index 00000000000..7328ea925d0 --- /dev/null +++ b/assets/js/f2f2094c.29ecbd42.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5280],{35318:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>f});var r=t(27378);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function p(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=l(t),d=i,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||o;return t?r.createElement(f,a(a({ref:n},s),{},{components:t})):r.createElement(f,a({ref:n},s))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,a=new Array(o);a[0]=d;var p={};for(var c in n)hasOwnProperty.call(n,c)&&(p[c]=n[c]);p.originalType=e,p[m]="string"==typeof e?e:i,a[1]=p;for(var l=2;l<o;l++)a[l]=t[l];return r.createElement.apply(null,a)}return r.createElement.apply(null,t)}d.displayName="MDXCreateElement"},93840:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>p,toc:()=>l});var r=t(25773),i=(t(27378),t(35318));const o={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Microphone service"},a="Microphone",p={unversionedId:"api/clients/microphone",id:"api/clients/microphone",title:"Microphone",description:"DeviceScript client for Microphone service",source:"@site/docs/api/clients/microphone.md",sourceDirName:"api/clients",slug:"/api/clients/microphone",permalink:"/devicescript/api/clients/microphone",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Microphone service"},sidebar:"tutorialSidebar"},c={},l=[{value:"Registers",id:"registers",level:2},{value:"samplingPeriod",id:"rw:samplingPeriod",level:3}],s={toc:l},m="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(m,(0,r.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"microphone"},"Microphone"),(0,i.kt)("admonition",{type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,i.kt)("p",null,"A single-channel microphone."),(0,i.kt)("p",null),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { Microphone } from "@devicescript/core"\n\nconst microphone = new Microphone()\n')),(0,i.kt)("p",null),(0,i.kt)("h2",{id:"registers"},"Registers"),(0,i.kt)("p",null),(0,i.kt)("h3",{id:"rw:samplingPeriod"},"samplingPeriod"),(0,i.kt)("p",null,"Get or set microphone sampling period.\nSampling rate is ",(0,i.kt)("inlineCode",{parentName:"p"},"1_000_000 / sampling_period Hz"),"."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"type: ",(0,i.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,i.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"read and write"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Microphone } from "@devicescript/core"\n\nconst microphone = new Microphone()\n// ...\nconst value = await microphone.samplingPeriod.read()\nawait microphone.samplingPeriod.write(value)\n')),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"track incoming values")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { Microphone } from "@devicescript/core"\n\nconst microphone = new Microphone()\n// ...\nmicrophone.samplingPeriod.subscribe(async (value) => {\n ...\n})\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,i.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f2fc7a53.bc80516a.js b/assets/js/f2fc7a53.bc80516a.js new file mode 100644 index 00000000000..2fa2505185d --- /dev/null +++ b/assets/js/f2fc7a53.bc80516a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9053],{35318:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(27378);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?l(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)t=l[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},v=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=s(t),v=a,m=d["".concat(p,".").concat(v)]||d[v]||c[v]||l;return t?r.createElement(m,i(i({ref:n},u),{},{components:t})):r.createElement(m,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=t.length,i=new Array(l);i[0]=v;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[d]="string"==typeof e?e:a,i[1]=o;for(var s=2;s<l;s++)i[s]=t[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,t)}v.displayName="MDXCreateElement"},83035:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var r=t(25773),a=(t(27378),t(35318));const l={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound level service"},i="SoundLevel",o={unversionedId:"api/clients/soundlevel",id:"api/clients/soundlevel",title:"SoundLevel",description:"DeviceScript client for Sound level service",source:"@site/docs/api/clients/soundlevel.md",sourceDirName:"api/clients",slug:"/api/clients/soundlevel",permalink:"/devicescript/api/clients/soundlevel",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound level service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"activeThreshold",id:"rw:activeThreshold",level:3},{value:"inactiveThreshold",id:"rw:inactiveThreshold",level:3},{value:"Events",id:"events",level:2},{value:"loud",id:"loud",level:3},{value:"quiet",id:"quiet",level:3}],u={toc:s},d="wrapper";function c(e){let{components:n,...t}=e;return(0,a.kt)(d,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"soundlevel"},"SoundLevel"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"A sound level detector sensor, gives a relative indication of the sound level."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The sound level detected by the microphone"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nconst value = await soundLevel.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nsoundLevel.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:enabled"},"enabled"),(0,a.kt)("p",null,"Turn on or off the microphone."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nconst value = await soundLevel.enabled.read()\nawait soundLevel.enabled.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nsoundLevel.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:activeThreshold"},"activeThreshold"),(0,a.kt)("p",null,"Set level at which the ",(0,a.kt)("inlineCode",{parentName:"p"},"loud")," event is generated."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nconst value = await soundLevel.activeThreshold.read()\nawait soundLevel.activeThreshold.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nsoundLevel.activeThreshold.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:inactiveThreshold"},"inactiveThreshold"),(0,a.kt)("p",null,"Set level at which the ",(0,a.kt)("inlineCode",{parentName:"p"},"quiet")," event is generated."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nconst value = await soundLevel.inactiveThreshold.read()\nawait soundLevel.inactiveThreshold.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundLevel } from "@devicescript/core"\n\nconst soundLevel = new SoundLevel()\n// ...\nsoundLevel.inactiveThreshold.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h2",{id:"events"},"Events"),(0,a.kt)("h3",{id:"loud"},"loud"),(0,a.kt)("p",null,"Generated when a loud sound is detected."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundLevel.loud.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"quiet"},"quiet"),(0,a.kt)("p",null,"Generated low level of sound is detected."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"soundLevel.quiet.subscribe(() => {\n\n})\n")),(0,a.kt)("p",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f3e8b01b.21494478.js b/assets/js/f3e8b01b.21494478.js new file mode 100644 index 00000000000..19d7f613f7d --- /dev/null +++ b/assets/js/f3e8b01b.21494478.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9296],{35318:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},l="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),l=p(r),f=i,m=l["".concat(c,".").concat(f)]||l[f]||u[f]||a;return r?n.createElement(m,o(o({ref:t},d),{},{components:r})):n.createElement(m,o({ref:t},d))}));function m(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[l]="string"==typeof e?e:i,o[1]=s;for(var p=2;p<a;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},38898:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const a={title:"Xiao ESP32-C3 Expansion Board"},o="Seeed Xiao ESP32-C3 Expansion board",s={unversionedId:"devices/shields/xiao-expansion-board",id:"devices/shields/xiao-expansion-board",title:"Xiao ESP32-C3 Expansion Board",description:"- Device: Seeed Xiao ESP32-C3 or Adafruit QT Py C3",source:"@site/docs/devices/shields/xiao-expansion-board.mdx",sourceDirName:"devices/shields",slug:"/devices/shields/xiao-expansion-board",permalink:"/devicescript/devices/shields/xiao-expansion-board",draft:!1,tags:[],version:"current",frontMatter:{title:"Xiao ESP32-C3 Expansion Board"},sidebar:"tutorialSidebar",previous:{title:"WaveShare Pico-LCD",permalink:"/devicescript/devices/shields/waveshare-pico-lcd-114"},next:{title:"Add Board",permalink:"/devicescript/devices/add-board"}},c={},p=[{value:"DeviceScript import",id:"devicescript-import",level:2}],d={toc:p},l="wrapper";function u(e){let{components:t,...a}=e;return(0,i.kt)(l,(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"seeed-xiao-esp32-c3-expansion-board"},"Seeed Xiao ESP32-C3 Expansion board"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Device: ",(0,i.kt)("a",{parentName:"li",href:"/devices/esp32/seeed-xiao-esp32c3"},"Seeed Xiao ESP32-C3")," or ",(0,i.kt)("a",{parentName:"li",href:"/devices/esp32/adafruit-qt-py-c3"},"Adafruit QT Py C3")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/"},"Home"))),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Photograph of shield",src:r(67080).Z,width:"1167",height:"875"})),(0,i.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,i.kt)("p",null,"You must import ",(0,i.kt)("inlineCode",{parentName:"p"},"XiaoExpansionBoard")," to access the shield services."),(0,i.kt)("p",null,"In ",(0,i.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,i.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Seeed Xiao ESP32-C3 Expansion board".'),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { XiaoExpansionBoard } from "@devicescript/drivers"\nconst shield = new XiaoExpansionBoard()\n\nconst display = await shield.startDisplay()\nconst buzzer = await shield.startBuzzer()\nconst button = await shield.startButton()\n')))}u.isMDXComponent=!0},67080:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/xiao-expansion-board-bbb3d8fc7f164a7cd68228e074554200.jpg"}}]); \ No newline at end of file diff --git a/assets/js/f468c751.668407ca.js b/assets/js/f468c751.668407ca.js new file mode 100644 index 00000000000..e1617361293 --- /dev/null +++ b/assets/js/f468c751.668407ca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[677],{35318:(t,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>v});var r=n(27378);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function p(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var s=r.createContext({}),c=function(t){var e=r.useContext(s),n=e;return t&&(n="function"==typeof t?t(e):a(a({},e),t)),n},u=function(t){var e=c(t.components);return r.createElement(s.Provider,{value:e},t.children)},l="mdxType",d={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},m=r.forwardRef((function(t,e){var n=t.components,i=t.mdxType,o=t.originalType,s=t.parentName,u=p(t,["components","mdxType","originalType","parentName"]),l=c(n),m=i,v=l["".concat(s,".").concat(m)]||l[m]||d[m]||o;return n?r.createElement(v,a(a({ref:e},u),{},{components:n})):r.createElement(v,a({ref:e},u))}));function v(t,e){var n=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var o=n.length,a=new Array(o);a[0]=m;var p={};for(var s in e)hasOwnProperty.call(e,s)&&(p[s]=e[s]);p.originalType=t,p[l]="string"==typeof t?t:i,a[1]=p;for(var c=2;c<o;c++)a[c]=n[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},67719:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=n(25773),i=(n(27378),n(35318));const o={description:"Mounts a button server",title:"Button"},a="Button",p={unversionedId:"api/drivers/button",id:"api/drivers/button",title:"Button",description:"Mounts a button server",source:"@site/docs/api/drivers/button.md",sourceDirName:"api/drivers",slug:"/api/drivers/button",permalink:"/devicescript/api/drivers/button",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a button server",title:"Button"},sidebar:"tutorialSidebar",previous:{title:"BME680",permalink:"/devicescript/api/drivers/bme680"},next:{title:"Buzzer",permalink:"/devicescript/api/drivers/buzzer"}},s={},c=[{value:"Options",id:"options",level:2},{value:"pin",id:"pin",level:3},{value:"pinBacklight",id:"pinbacklight",level:3},{value:"activeHigh",id:"activehigh",level:3}],u={toc:c},l="wrapper";function d(t){let{components:e,...n}=t;return(0,i.kt)(l,(0,r.Z)({},u,n,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"button"},"Button"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startButton")," function starts a ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/button"},"button")," server on the device\nand returns a ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/button"},"client"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startButton } from "@devicescript/servers"\n\nconst buttonA = startButton({\n pin: gpio(2),\n})\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"buttonA"),"."),(0,i.kt)("h2",{id:"options"},"Options"),(0,i.kt)("h3",{id:"pin"},"pin"),(0,i.kt)("p",null,"The pin hardware identifier on which to mount the button."),(0,i.kt)("h3",{id:"pinbacklight"},"pinBacklight"),(0,i.kt)("p",null,"This pin is set high when the button is pressed. Useful for buttons with a builtin LED."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"no-run no-output","no-run":!0,"no-output":!0},'import { gpio } from "@devicescript/core"\nimport { startButton } from "@devicescript/servers"\n\nconst buttonA = startButton({\n pin: gpio(2),\n // highlight-next-line\n pinBacklight: gpio(4),\n})\n')),(0,i.kt)("h3",{id:"activehigh"},"activeHigh"),(0,i.kt)("p",null,"Button is normally active-low and pulled high.\nThis makes it active-high and pulled low."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts",metastring:"no-run no-output","no-run":!0,"no-output":!0},'import { gpio } from "@devicescript/core"\nimport { startButton } from "@devicescript/servers"\n\nconst buttonA = startButton({\n pin: gpio(2),\n // highlight-next-line\n activeHigh: true,\n})\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f4a210bc.a23d1e69.js b/assets/js/f4a210bc.a23d1e69.js new file mode 100644 index 00000000000..3c5fd04f442 --- /dev/null +++ b/assets/js/f4a210bc.a23d1e69.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1297],{35318:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>v});var i=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,i,a=function(e,t){if(null==e)return{};var n,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=i.createContext({}),p=function(e){var t=i.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(c.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},u=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,v=d["".concat(c,".").concat(u)]||d[u]||m[u]||r;return n?i.createElement(v,l(l({ref:t},s),{},{components:n})):i.createElement(v,l({ref:t},s))}));function v(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,l=new Array(r);l[0]=u;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o[d]="string"==typeof e?e:a,l[1]=o;for(var p=2;p<r;p++)l[p]=n[p];return i.createElement.apply(null,l)}return i.createElement.apply(null,n)}u.displayName="MDXCreateElement"},69903:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>o,toc:()=>p});var i=n(25773),a=(n(27378),n(35318));const r={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Magnetic field level service"},l="MagneticFieldLevel",o={unversionedId:"api/clients/magneticfieldlevel",id:"api/clients/magneticfieldlevel",title:"MagneticFieldLevel",description:"DeviceScript client for Magnetic field level service",source:"@site/docs/api/clients/magneticfieldlevel.md",sourceDirName:"api/clients",slug:"/api/clients/magneticfieldlevel",permalink:"/devicescript/api/clients/magneticfieldlevel",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Magnetic field level service"},sidebar:"tutorialSidebar"},c={},p=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"detected",id:"ro:detected",level:3},{value:"variant",id:"const:variant",level:3},{value:"Events",id:"events",level:2},{value:"active",id:"active",level:3},{value:"inactive",id:"inactive",level:3}],s={toc:p},d="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(d,(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"magneticfieldlevel"},"MagneticFieldLevel"),(0,a.kt)("p",null,"A sensor that measures strength and polarity of magnetic field."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { MagneticFieldLevel } from "@devicescript/core"\n\nconst magneticFieldLevel = new MagneticFieldLevel()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Indicates the strength of magnetic field between -1 and 1.\nWhen no magnet is present the value should be around 0.\nFor analog sensors,\nwhen the north pole of the magnet is on top of the module\nand closer than south pole, then the value should be positive.\nFor digital sensors,\nthe value should either ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"1"),", regardless of polarity."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i1.15"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { MagneticFieldLevel } from "@devicescript/core"\n\nconst magneticFieldLevel = new MagneticFieldLevel()\n// ...\nconst value = await magneticFieldLevel.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { MagneticFieldLevel } from "@devicescript/core"\n\nconst magneticFieldLevel = new MagneticFieldLevel()\n// ...\nmagneticFieldLevel.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:detected"},"detected"),(0,a.kt)("p",null,"Determines if the magnetic field is present.\nIf the event ",(0,a.kt)("inlineCode",{parentName:"p"},"active")," is observed, ",(0,a.kt)("inlineCode",{parentName:"p"},"detected")," is true; if ",(0,a.kt)("inlineCode",{parentName:"p"},"inactive")," is observed, ",(0,a.kt)("inlineCode",{parentName:"p"},"detected")," is false."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MagneticFieldLevel } from "@devicescript/core"\n\nconst magneticFieldLevel = new MagneticFieldLevel()\n// ...\nconst value = await magneticFieldLevel.detected.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { MagneticFieldLevel } from "@devicescript/core"\n\nconst magneticFieldLevel = new MagneticFieldLevel()\n// ...\nmagneticFieldLevel.detected.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:variant"},"variant"),(0,a.kt)("p",null,"Determines which magnetic poles the sensor can detected,\nand whether or not it can measure their strength or just presence."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { MagneticFieldLevel } from "@devicescript/core"\n\nconst magneticFieldLevel = new MagneticFieldLevel()\n// ...\nconst value = await magneticFieldLevel.variant.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h2",{id:"events"},"Events"),(0,a.kt)("h3",{id:"active"},"active"),(0,a.kt)("p",null,"Emitted when strong-enough magnetic field is detected."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"magneticFieldLevel.active.subscribe(() => {\n\n})\n")),(0,a.kt)("h3",{id:"inactive"},"inactive"),(0,a.kt)("p",null,"Emitted when strong-enough magnetic field is no longer detected."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"magneticFieldLevel.inactive.subscribe(() => {\n\n})\n")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f59b56a8.73a00cf9.js b/assets/js/f59b56a8.73a00cf9.js new file mode 100644 index 00000000000..025a546a7e9 --- /dev/null +++ b/assets/js/f59b56a8.73a00cf9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7993],{35318:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>k});var n=a(27378);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=u(a),d=r,k=c["".concat(s,".").concat(d)]||c[d]||m[d]||o;return a?n.createElement(k,l(l({ref:t},p),{},{components:a})):n.createElement(k,l({ref:t},p))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var u=2;u<o;u++)l[u]=a[u];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},39798:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(27378),r=a(38944);const o={tabItem:"tabItem_wHwb"};function l(e){let{children:t,hidden:a,className:l}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,l),hidden:a},t)}},23930:(e,t,a)=>{a.d(t,{Z:()=>w});var n=a(25773),r=a(27378),o=a(38944),l=a(83457),i=a(3620),s=a(30654),u=a(70784),p=a(71819);function c(e){return function(e){return r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function m(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??c(a);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,a])}function d(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,i.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,s._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=m(e),[l,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!d({value:t,tabValues:a}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[s,u]=k({queryString:a,groupId:n}),[c,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,p.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),b=(()=>{const e=s??c;return d({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{b&&i(b)}),[b]);return{selectedValue:l,selectValue:(0,r.useCallback)((e=>{if(!d({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),h(e)}),[u,h,o]),tabValues:o}}var b=a(76457);const v={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function g(e){let{className:t,block:a,selectedValue:i,selectValue:s,tabValues:u}=e;const p=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),m=e=>{const t=e.currentTarget,a=p.indexOf(t),n=u[a].value;n!==i&&(c(t),s(n))},d=e=>{let t=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":{const a=p.indexOf(e.currentTarget)+1;t=p[a]??p[0];break}case"ArrowLeft":{const a=p.indexOf(e.currentTarget)-1;t=p[a]??p[p.length-1];break}}t?.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((e=>{let{value:t,label:a,attributes:l}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>p.push(e),onKeyDown:d,onClick:m},l,{className:(0,o.Z)("tabs__item",v.tabItem,l?.className,{"tabs__item--active":i===t})}),a??t)})))}function y(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function f(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",v.tabList)},r.createElement(g,(0,n.Z)({},e,t)),r.createElement(y,(0,n.Z)({},e,t)))}function w(e){const t=(0,b.Z)();return r.createElement(f,(0,n.Z)({key:String(t)},e))}},68677:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var n=a(25773),r=(a(27378),a(35318)),o=a(23930),l=a(39798);const i={sidebar_position:10,description:"Learn how to set up and use the Development Gateway for DeviceScript, enabling rapid prototyping and deployment on Azure or locally.",keywords:["DeviceScript","Development Gateway","Azure","local deployment","MQTT"]},s="Development Gateway",u={unversionedId:"developer/development-gateway/gateway",id:"developer/development-gateway/gateway",title:"Development Gateway",description:"Learn how to set up and use the Development Gateway for DeviceScript, enabling rapid prototyping and deployment on Azure or locally.",source:"@site/docs/developer/development-gateway/gateway.mdx",sourceDirName:"developer/development-gateway",slug:"/developer/development-gateway/gateway",permalink:"/devicescript/developer/development-gateway/gateway",draft:!1,tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10,description:"Learn how to set up and use the Development Gateway for DeviceScript, enabling rapid prototyping and deployment on Azure or locally.",keywords:["DeviceScript","Development Gateway","Azure","local deployment","MQTT"]},sidebar:"tutorialSidebar",previous:{title:"Configuration",permalink:"/devicescript/developer/development-gateway/configuration"},next:{title:"Errors",permalink:"/devicescript/developer/errors"}},p={},c=[{value:"Features",id:"features",level:2},{value:"Prerequisites",id:"prerequisites",level:2},{value:"Local developement",id:"local-developement",level:2},{value:"Codesandbox.io",id:"codesandboxio",level:2},{value:"MQTT",id:"mqtt",level:2},{value:"Azure deployment (optional)",id:"azure-deployment-optional",level:2},{value:"Provisioning",id:"provisioning",level:3},{value:"Deployment",id:"deployment",level:3},{value:"Cleanup",id:"cleanup",level:3},{value:"Dashboards",id:"dashboards",level:3},{value:"Visual Studio Code extension",id:"visual-studio-code-extension",level:3}],m={toc:c},d="wrapper";function k(e){let{components:t,...i}=e;return(0,r.kt)(d,(0,n.Z)({},m,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"development-gateway"},"Development Gateway"),(0,r.kt)("p",null,"DeviceScript defines a cloud layer\nto abstract the communication between the device and a cloud provider."),(0,r.kt)("p",null,"In order to facilite rapid prototyping,\nit is possible to run a Development Gateway ",(0,r.kt)("strong",{parentName:"p"},"locally"),"\nor deploy it to Azure on top of Azure services."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Full sources at ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-gateway"},"https://github.com/microsoft/devicescript-gateway"))),(0,r.kt)("h2",{id:"features"},"Features"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Local or Azure deployement"),(0,r.kt)("li",{parentName:"ul"},"Device provisioning, management: register, unregister, list, ..."),(0,r.kt)("li",{parentName:"ul"},"Script management: create, update (versioned)"),(0,r.kt)("li",{parentName:"ul"},"Script deployment: assign a script to a device and the gateway will deploy it"),(0,r.kt)("li",{parentName:"ul"},"Analytics through Azure Monitor"),(0,r.kt)("li",{parentName:"ul"},"JSON messages from and to devices"),(0,r.kt)("li",{parentName:"ul"},"Per-device environment variables"),(0,r.kt)("li",{parentName:"ul"},"Swagger API front end for non-embedded clients"),(0,r.kt)("li",{parentName:"ul"},"Visual Studio Code extension")),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"The Development Gateway is a sample and not meant for production deployment.")),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Follow these steps to get started with using the gateway."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"install ",(0,r.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/"},"Node.JS 16+"),"\nand the ",(0,r.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/dotnet/azure/install-azure-cli"},"Azure CLI"),"."),(0,r.kt)("li",{parentName:"ul"},"fork ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-gateway/"},"https://github.com/microsoft/devicescript-gateway/"))),(0,r.kt)("p",null,"The full sources of the Gateway is available in that repository."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"install the dependencies and pull the submodules")),(0,r.kt)(o.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm run setup\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn setup\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run setup\n")))),(0,r.kt)("h2",{id:"local-developement"},"Local developement"),(0,r.kt)("p",null,"The Development Gateway can be run locally without any cloud resources. This is great for tinkering."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.fastify.io/"},"Node.JS + Fastify")," is a popular web server framework")),(0,r.kt)("mermaid",{value:"stateDiagram-v2\n web: Fastify server\n web: (localhost)\n dev: Device\n wssk: Web Socket\n openapi: Open API\n vscode: VS Code\n storage: Device Table, Script Blobs\n storage: Emulated Azure Storage (Azurite)\n queue: Message Queue\n queue: Emulated Azure Storage (Azurite)\n mqtt: MQTT server\n\n dev --\x3e wssk\n wssk --\x3e web\n openapi --\x3e web\n web --\x3e storage\n web --\x3e queue\n web --\x3e mqtt\n mqtt --\x3e web\n vscode --\x3e openapi\n"}),(0,r.kt)("p",null,"To get started,"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"launch Azurite, a local Azure storage emulator. Keep this terminal open.")),(0,r.kt)(o.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm run azurite\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn azurite\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run azurite\n")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"launch the local development server")),(0,r.kt)(o.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm run dev\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn dev\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run dev\n")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"open the swagger page, ",(0,r.kt)("inlineCode",{parentName:"li"},"http://localhost:7071/swagger/")," and make sure it loads"),(0,r.kt)("li",{parentName:"ul"},"in Visual Studio Code, use the configuration string printed in the console.")),(0,r.kt)("p",null,"Make sure to use the connection string for ",(0,r.kt)("strong",{parentName:"p"},"local network")," to connect to a device on the same local network.\nOtherwise, you can also work on the simulator device using the local host connection string."),(0,r.kt)("p",null,"Device messages are pushed into the ",(0,r.kt)("inlineCode",{parentName:"p"},"messages")," ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction"},"Azure Storage Queue")," as a base-64 encoded JSON string.\nYou can use any client library to access those messages."),(0,r.kt)("h2",{id:"codesandboxio"},"Codesandbox.io"),(0,r.kt)("p",null,"Running the local web server from ",(0,r.kt)("a",{parentName:"p",href:"https://codesandbox.io/"},"CodeSandbox.io"),"\nallows you to run the Development Gateway in the cloud, which simplifies many connectivity issues with local networks."),(0,r.kt)("p",null,"The Development Gateway can be run in a browser using ",(0,r.kt)("a",{parentName:"p",href:"https://codesandbox.io/"},"codesandbox.io"),"."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"open ",(0,r.kt)("a",{parentName:"li",href:"https://codesandbox.io/"},"https://codesandbox.io/")),(0,r.kt)("li",{parentName:"ul"},"click on ",(0,r.kt)("strong",{parentName:"li"},"Import repository")),(0,r.kt)("li",{parentName:"ul"},"enter ",(0,r.kt)("inlineCode",{parentName:"li"},"microsoft/devicescript-gateway")," or your forked repository.")),(0,r.kt)("h2",{id:"mqtt"},"MQTT"),(0,r.kt)("p",null,"The gateway can also be used as an MQTT server or a bridge to an existing MQTT server."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"publishMessage"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"subscribeMessage"),' from "@devicescript/cloud" will automatically be bridge to the MQTT server under the topic ',(0,r.kt)("inlineCode",{parentName:"li"},"devs/{deviceId}/(from|to)/{topic}"),"."),(0,r.kt)("li",{parentName:"ul"},"You can override the ",(0,r.kt)("inlineCode",{parentName:"li"},"devs/.../(from|to)/...")," routing scheme by starting your topic with ",(0,r.kt)("inlineCode",{parentName:"li"},"/"),". For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"/mytopic")," will be routed to ",(0,r.kt)("inlineCode",{parentName:"li"},"mytopic"),".")),(0,r.kt)("p",null,"There are ",(0,r.kt)("a",{parentName:"p",href:"https://mqtt.org/software/"},"many options")," to run your own MQTT broker/server. Once you have a server,\nyou can configure the gateway using the ",(0,r.kt)("inlineCode",{parentName:"p"},"DEVS_MQTT_URL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"DEVS_MQTT_USER")," environment variables or secrets."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'DEVS_MQTT_URL="mqtts://host:post"\nDEVS_MQTT_USER="username:password"\n')),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"You can use the ",(0,r.kt)("a",{parentName:"p",href:"https://marketplace.visualstudio.com/items?itemName=rpdswtk.vsmqtt"},"VSMqtt")," in Visual Studio Code to connect to the MQTT server\nand publish, subscribe to topics.")),(0,r.kt)("h2",{id:"azure-deployment-optional"},"Azure deployment (optional)"),(0,r.kt)("p",null,"The Development Gateway can be deployed to Azure on top of Azure services:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/azure/app-service/"},"App Service"),", runs a Node.JS web service with a swagger frontend"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/azure/key-vault/"},"Key Vault"),", to store secrets needed by the Web Application"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/azure/storage/"},"Storage"),", blobs and tables to manage devices, scripts and telemetry"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview"},"App Insights"),", to collect telemetry about the health of devices"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/azure/event-hubs/"},"Event Hub")," to forward JSON messages from the device")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"NOTE:"),(0,r.kt)("ul",{parentName:"blockquote"},(0,r.kt)("li",{parentName:"ul"},"Some Azure resources will incur costs to your Azure subscription."))),(0,r.kt)("mermaid",{value:"stateDiagram-v2\n web: Fastify server\n dev: Device\n ai: Telemetry\n ai: Azure Application Insights\n kv: Service connection strings\n kv: Azure Key Vault\n wssk: Web Socket\n openapi: Open API\n web: Azure App Service\n vscode: VS Code\n storage: Device Table, Script Blobs\n storage: Azure Storage\n messages: Message Queue\n messages: Azure Event Hub\n\n dev --\x3e wssk\n web --\x3e ai\n web --\x3e kv\n wssk --\x3e web\n openapi --\x3e web\n web --\x3e storage\n web --\x3e messages\n vscode --\x3e openapi\n"}),(0,r.kt)("p",null,"The Development Gateway requires an Azure account and optionally a GitHub account."),(0,r.kt)("h3",{id:"provisioning"},"Provisioning"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"NOTE:"),(0,r.kt)("ul",{parentName:"blockquote"},(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"npm run provision")," script will create Azure resources that will incur costs to your Azure subscription. You can clean up those resources manually via the Azure portal or with the ",(0,r.kt)("inlineCode",{parentName:"li"},"npm run unprovision")," command."),(0,r.kt)("li",{parentName:"ul"},"You can call ",(0,r.kt)("inlineCode",{parentName:"li"},"npm run provision")," as many times as you like, it will delete the previous resources and create new ones."))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"open a terminal with the Azure CLI logged in and the default subscription configured")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"az login\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"You will need to generate a ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/settings/personal-access-tokens/new"},"Github personal access token"),"\nfor the forked repository, with ",(0,r.kt)("inlineCode",{parentName:"p"},"actions"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"secrets")," scope as ",(0,r.kt)("inlineCode",{parentName:"p"},"read+write"),".")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"launch the provisioning script"))),(0,r.kt)(o.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm run provision\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn provision\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run provision\n")))),(0,r.kt)("p",null,"After the script is done executing,\nit will take a couple minutes for the Github Actions to build the site and start it."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"open the swagger page, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://WEBAPPNAME.azurewebsites.net/swagger/")," and make sure it loads")),(0,r.kt)("p",null,"You will be able to continue the configuration of the gateway through the ",(0,r.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"VS Code extension"),",\n",(0,r.kt)("inlineCode",{parentName:"p"},"DeviceScript")," view, ",(0,r.kt)("inlineCode",{parentName:"p"},"Development Gateway")," section."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Empty view",src:a(85427).Z,width:"714",height:"496"})),(0,r.kt)("h3",{id:"deployment"},"Deployment"),(0,r.kt)("p",null,"The repository can be configured to deploy the site on every build on the ",(0,r.kt)("inlineCode",{parentName:"p"},"main")," brain,\nusing the ",(0,r.kt)("inlineCode",{parentName:"p"},"build.yml")," ",(0,r.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions"},"GitHub Actions"),"."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"to enable, uncomment ",(0,r.kt)("inlineCode",{parentName:"li"},'# AZURE_WEBAPP_PUBLISH: "true"')," in ",(0,r.kt)("inlineCode",{parentName:"li"},".github/workflows/build.yml"))),(0,r.kt)("p",null,"The project ",(0,r.kt)("inlineCode",{parentName:"p"},"README.md")," file contains details for local development."),(0,r.kt)("h3",{id:"cleanup"},"Cleanup"),(0,r.kt)("p",null,"Use the Azure CLI to delete the resource group and all its associated resources."),(0,r.kt)(o.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,r.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm run unprovision\n"))),(0,r.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"yarn unprovision\n"))),(0,r.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run unprovision\n")))),(0,r.kt)("h3",{id:"dashboards"},"Dashboards"),(0,r.kt)("p",null,"Out of the box, the gateway will push telemetry metrics in an Application Insights instance and in an Event Hub."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"You can use the built-in dashboarding capabilities of Application Insights to visualize metrics and explore logs."),(0,r.kt)("li",{parentName:"ul"},"You can build a dashboard of metrics in an ",(0,r.kt)("a",{parentName:"li",href:"https://azure.microsoft.com/en-us/products/managed-grafana/"},"Azure Hosted Grafana")," instance.")),(0,r.kt)("h3",{id:"visual-studio-code-extension"},"Visual Studio Code extension"),(0,r.kt)("p",null,"Once the gateway is up and running, you can use the Visual Studio Code extension\nto manage devices, scripts and work with the gateway."))}k.isMDXComponent=!0},85427:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/empty-view-0f03949a953ec9208558ab31992e000c.png"}}]); \ No newline at end of file diff --git a/assets/js/f6e1255d.926581d7.js b/assets/js/f6e1255d.926581d7.js new file mode 100644 index 00000000000..c62ba6c250c --- /dev/null +++ b/assets/js/f6e1255d.926581d7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3870],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var r=n(27378);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},s="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),s=u(n),d=a,k=s["".concat(l,".").concat(d)]||s[d]||m[d]||i;return n?r.createElement(k,o(o({ref:t},c),{},{components:n})):r.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[s]="string"==typeof e?e:a,o[1]=p;for(var u=2;u<i;u++)o[u]=n[u];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},55214:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var r=n(25773),a=(n(27378),n(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound Spectrum service"},o="SoundSpectrum",p={unversionedId:"api/clients/soundspectrum",id:"api/clients/soundspectrum",title:"SoundSpectrum",description:"DeviceScript client for Sound Spectrum service",source:"@site/docs/api/clients/soundspectrum.md",sourceDirName:"api/clients",slug:"/api/clients/soundspectrum",permalink:"/devicescript/api/clients/soundspectrum",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Sound Spectrum service"},sidebar:"tutorialSidebar"},l={},u=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"enabled",id:"rw:enabled",level:3},{value:"fftPow2Size",id:"rw:fftPow2Size",level:3},{value:"minDecibels",id:"rw:minDecibels",level:3},{value:"maxDecibels",id:"rw:maxDecibels",level:3},{value:"smoothingTimeConstant",id:"rw:smoothingTimeConstant",level:3}],c={toc:u},s="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(s,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"soundspectrum"},"SoundSpectrum"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"A microphone that analyzes the sound specturm"),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"The computed frequency data."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<Buffer>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"b"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nsoundSpectrum.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:enabled"},"enabled"),(0,a.kt)("p",null,"Turns on/off the micropohone."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nconst value = await soundSpectrum.enabled.read()\nawait soundSpectrum.enabled.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nsoundSpectrum.enabled.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:fftPow2Size"},"fftPow2Size"),(0,a.kt)("p",null,"The power of 2 used as the size of the FFT to be used to determine the frequency domain."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nconst value = await soundSpectrum.fftPow2Size.read()\nawait soundSpectrum.fftPow2Size.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nsoundSpectrum.fftPow2Size.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:minDecibels"},"minDecibels"),(0,a.kt)("p",null,"The minimum power value in the scaling range for the FFT analysis data"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nconst value = await soundSpectrum.minDecibels.read()\nawait soundSpectrum.minDecibels.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nsoundSpectrum.minDecibels.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:maxDecibels"},"maxDecibels"),(0,a.kt)("p",null,"The maximum power value in the scaling range for the FFT analysis data"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"i16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nconst value = await soundSpectrum.maxDecibels.read()\nawait soundSpectrum.maxDecibels.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nsoundSpectrum.maxDecibels.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"rw:smoothingTimeConstant"},"smoothingTimeConstant"),(0,a.kt)("p",null,"The averaging constant with the last analysis frame.\nIf ",(0,a.kt)("inlineCode",{parentName:"p"},"0")," is set, there is no averaging done, whereas a value of ",(0,a.kt)("inlineCode",{parentName:"p"},"1"),' means "overlap the previous and current buffer quite a lot while computing the value".'),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nconst value = await soundSpectrum.smoothingTimeConstant.read()\nawait soundSpectrum.smoothingTimeConstant.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { SoundSpectrum } from "@devicescript/core"\n\nconst soundSpectrum = new SoundSpectrum()\n// ...\nsoundSpectrum.smoothingTimeConstant.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f70d59fe.6c87764b.js b/assets/js/f70d59fe.6c87764b.js new file mode 100644 index 00000000000..ac596bbd19b --- /dev/null +++ b/assets/js/f70d59fe.6c87764b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1589],{35318:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var i=n(27378);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=i.createContext({}),s=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return i.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),m=s(n),d=r,k=m["".concat(p,".").concat(d)]||m[d]||u[d]||a;return n?i.createElement(k,o(o({ref:t},c),{},{components:n})):i.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:r,o[1]=l;for(var s=2;s<a;s++)o[s]=n[s];return i.createElement.apply(null,o)}return i.createElement.apply(null,n)}d.displayName="MDXCreateElement"},31686:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var i=n(25773),r=(n(27378),n(35318));const a={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Dot Matrix service"},o="DotMatrix",l={unversionedId:"api/clients/dotmatrix",id:"api/clients/dotmatrix",title:"DotMatrix",description:"DeviceScript client for Dot Matrix service",source:"@site/docs/api/clients/dotmatrix.md",sourceDirName:"api/clients",slug:"/api/clients/dotmatrix",permalink:"/devicescript/api/clients/dotmatrix",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Dot Matrix service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Registers",id:"registers",level:2},{value:"dots",id:"rw:dots",level:3},{value:"intensity",id:"rw:intensity",level:3},{value:"rows",id:"const:rows",level:3},{value:"columns",id:"const:columns",level:3},{value:"variant",id:"const:variant",level:3}],c={toc:s},m="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(m,(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"dotmatrix"},"DotMatrix"),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,r.kt)("p",null,"A rectangular dot matrix display, made of monochrome LEDs or Braille pins."),(0,r.kt)("p",null),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n')),(0,r.kt)("p",null),(0,r.kt)("h2",{id:"registers"},"Registers"),(0,r.kt)("p",null),(0,r.kt)("h3",{id:"rw:dots"},"dots"),(0,r.kt)("p",null,"The state of the screen where dot on/off state is\nstored as a bit, column by column. The column should be byte aligned."),(0,r.kt)("p",null,"For example, if the display has no more than 8 rows in each column, then each byte contains bits corresponding\nto a single column. Least-significant bit is on top.\nIf display has 10 rows, then each column is represented by two bytes.\nThe top-most 8 rows sit in the first byte (with the least significant bit being on top),\nand the remainign 2 row sit in the second byte."),(0,r.kt)("p",null,"The following C expression can be used to check if a given ",(0,r.kt)("inlineCode",{parentName:"p"},"column, row")," coordinate is set:\n",(0,r.kt)("inlineCode",{parentName:"p"},"dots[column * column_size + (row >> 3)] & (1 << (row & 7))"),", where\n",(0,r.kt)("inlineCode",{parentName:"p"},"column_size")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"(number_of_rows + 7) >> 3")," (note that if number of rows is 8 or less then ",(0,r.kt)("inlineCode",{parentName:"p"},"column_size")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"1"),"),\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"dots")," is of ",(0,r.kt)("inlineCode",{parentName:"p"},"uint8_t*")," type."),(0,r.kt)("p",null,"The size of this register is ",(0,r.kt)("inlineCode",{parentName:"p"},"number_of_columns * column_size")," bytes."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<Buffer>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"b"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"track incoming values"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n// ...\ndotMatrix.dots.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"rw:intensity"},"intensity"),(0,r.kt)("p",null,"Reads the general brightness of the display, brightness for LEDs. ",(0,r.kt)("inlineCode",{parentName:"p"},"0")," when the screen is off."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u0.8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read and write"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n// ...\nconst value = await dotMatrix.intensity.read()\nawait dotMatrix.intensity.write(value)\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"track incoming values")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n// ...\ndotMatrix.intensity.subscribe(async (value) => {\n ...\n})\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:rows"},"rows"),(0,r.kt)("p",null,"Number of rows on the screen"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n// ...\nconst value = await dotMatrix.rows.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:columns"},"columns"),(0,r.kt)("p",null,"Number of columns on the screen"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n// ...\nconst value = await dotMatrix.columns.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("h3",{id:"const:variant"},"variant"),(0,r.kt)("p",null,"Describes the type of matrix used."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"type: ",(0,r.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,r.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"read only"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { DotMatrix } from "@devicescript/core"\n\nconst dotMatrix = new DotMatrix()\n// ...\nconst value = await dotMatrix.variant.read()\n')),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},(0,r.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,r.kt)("p",null))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f7e5a795.b0a868ea.js b/assets/js/f7e5a795.b0a868ea.js new file mode 100644 index 00000000000..03146ba8d25 --- /dev/null +++ b/assets/js/f7e5a795.b0a868ea.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7786],{35318:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(27378);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(r),y=i,f=d["".concat(c,".").concat(y)]||d[y]||u[y]||o;return r?n.createElement(f,a(a({ref:t},l),{},{components:r})):n.createElement(f,a({ref:t},l))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,a=new Array(o);a[0]=y;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[d]="string"==typeof e?e:i,a[1]=s;for(var p=2;p<o;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},1366:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=r(25773),i=(r(27378),r(35318));const o={description:"Mounts a HID joystick server",title:"HID Joystick"},a="HID Joystick",s={unversionedId:"api/drivers/hidjoystick",id:"api/drivers/hidjoystick",title:"HID Joystick",description:"Mounts a HID joystick server",source:"@site/docs/api/drivers/hidjoystick.md",sourceDirName:"api/drivers",slug:"/api/drivers/hidjoystick",permalink:"/devicescript/api/drivers/hidjoystick",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a HID joystick server",title:"HID Joystick"},sidebar:"tutorialSidebar",previous:{title:"Hall sensor",permalink:"/devicescript/api/drivers/hall"},next:{title:"HID Keyboard",permalink:"/devicescript/api/drivers/hidkeyboard"}},c={},p=[],l={toc:p},d="wrapper";function u(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"hid-joystick"},"HID Joystick"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"startHidJoystick")," function starts a ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/hidjoystick"},"relay")," server on the device\nand returns a ",(0,i.kt)("a",{parentName:"p",href:"/api/clients/hidjoystick"},"client"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { startHidJoystick } from "@devicescript/servers"\n\nconst joystick = startHidJoystick({})\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/_base/"},"service instance name")," is automatically set to the variable name. In this example, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"joystick"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f8409a7e.cfd39d37.js b/assets/js/f8409a7e.cfd39d37.js new file mode 100644 index 00000000000..05916d72a5a --- /dev/null +++ b/assets/js/f8409a7e.cfd39d37.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3206],{35318:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>g});var i=t(27378);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e,r){if(null==e)return{};var t,i,a=function(e,r){if(null==e)return{};var t,i,a={},n=Object.keys(e);for(i=0;i<n.length;i++)t=n[i],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)t=n[i],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=i.createContext({}),p=function(e){var r=i.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},s=function(e){var r=p(e.components);return i.createElement(l.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return i.createElement(i.Fragment,{},r)}},m=i.forwardRef((function(e,r){var t=e.components,a=e.mdxType,n=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||n;return t?i.createElement(g,o(o({ref:r},s),{},{components:t})):i.createElement(g,o({ref:r},s))}));function g(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var n=t.length,o=new Array(n);o[0]=m;var c={};for(var l in r)hasOwnProperty.call(r,l)&&(c[l]=r[l]);c.originalType=e,c[u]="string"==typeof e?e:a,o[1]=c;for(var p=2;p<n;p++)o[p]=t[p];return i.createElement.apply(null,o)}return i.createElement.apply(null,t)}m.displayName="MDXCreateElement"},92661:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>n,metadata:()=>c,toc:()=>p});var i=t(25773),a=(t(27378),t(35318));const n={sidebar_position:1,description:"DeviceScript is a small footprint bytecode interpreter that brings a TypeScript developer experience to low-resource microcontroller-based devices. Write reusable application/firmware on top of abstract hardware services and communicate to a cloud with JSON through a unified API. Full debugging experience in Visual Studio Code. Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages.",keywords:["DeviceScript","TypeScript","microcontroller","firmware","hardware"]},o="DeviceScript",c={unversionedId:"intro",id:"intro",title:"DeviceScript",description:"DeviceScript is a small footprint bytecode interpreter that brings a TypeScript developer experience to low-resource microcontroller-based devices. Write reusable application/firmware on top of abstract hardware services and communicate to a cloud with JSON through a unified API. Full debugging experience in Visual Studio Code. Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages.",source:"@site/docs/intro.mdx",sourceDirName:".",slug:"/intro",permalink:"/devicescript/intro",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"DeviceScript is a small footprint bytecode interpreter that brings a TypeScript developer experience to low-resource microcontroller-based devices. Write reusable application/firmware on top of abstract hardware services and communicate to a cloud with JSON through a unified API. Full debugging experience in Visual Studio Code. Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages.",keywords:["DeviceScript","TypeScript","microcontroller","firmware","hardware"]},sidebar:"tutorialSidebar",next:{title:"Getting Started",permalink:"/devicescript/getting-started/"}},l={},p=[{value:"TypeScript",id:"typescript",level:4},{value:"Portable Virtual Machine",id:"portable-virtual-machine",level:4},{value:"Hardware as Services",id:"hardware-as-services",level:4},{value:"Small",id:"small",level:4},{value:"Simulation & Tracing",id:"simulation--tracing",level:4},{value:"Debugging",id:"debugging",level:4},{value:"Package Ecosystem",id:"package-ecosystem",level:4}],s={toc:p},u="wrapper";function d(e){let{components:r,...n}=e;return(0,a.kt)(u,(0,i.Z)({},s,n,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"devicescript"},"DeviceScript"),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"DeviceScript brings a TypeScript developer experience to low-resource microcontroller-based devices."),"\nDeviceScript is compiled to a custom VM bytecode, which can run in very constrained\nenvironments."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"A screenshot of the Visual Studio Code integration",src:t(48517).Z,width:"1536",height:"960"})),(0,a.kt)("h4",{id:"typescript"},"TypeScript"),(0,a.kt)("p",null,"The familiar syntax and tooling, all at your fingertips. Read the ",(0,a.kt)("a",{parentName:"p",href:"/language"},"language reference"),"."),(0,a.kt)("h4",{id:"portable-virtual-machine"},"Portable Virtual Machine"),(0,a.kt)("p",null,"Small footprint DeviceScript bytecode interpreter. See ",(0,a.kt)("a",{parentName:"p",href:"/devices"},"supported devices"),"."),(0,a.kt)("h4",{id:"hardware-as-services"},"Hardware as Services"),(0,a.kt)("p",null,"Write reusable application/firmware on top of abstract hardware services. See ",(0,a.kt)("a",{parentName:"p",href:"/developer/clients"},"clients"),"."),(0,a.kt)("h4",{id:"small"},"Small"),(0,a.kt)("p",null,"Designed for low power, low flash, low memory embedded projects."),(0,a.kt)("h4",{id:"simulation--tracing"},"Simulation & Tracing"),(0,a.kt)("p",null,"Develop and test your firmware using simulated or real sensors. See ",(0,a.kt)("a",{parentName:"p",href:"/developer/simulation/"},"simulation")),(0,a.kt)("h4",{id:"debugging"},"Debugging"),(0,a.kt)("p",null,"Full debugging experience in Visual Studio Code, for hardware or simulated devices. Read about the ",(0,a.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Extension"),"."),(0,a.kt)("h4",{id:"package-ecosystem"},"Package Ecosystem"),(0,a.kt)("p",null,"Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages. Read about ",(0,a.kt)("a",{parentName:"p",href:"/developer/packages"},"Packages"),"."))}d.isMDXComponent=!0},48517:(e,r,t)=>{t.d(r,{Z:()=>i});const i=t.p+"assets/images/hero-6841bcefb7272a3b78c2650090ff2181.png"}}]); \ No newline at end of file diff --git a/assets/js/f8f225ac.2267a4e1.js b/assets/js/f8f225ac.2267a4e1.js new file mode 100644 index 00000000000..f6ff5d3a996 --- /dev/null +++ b/assets/js/f8f225ac.2267a4e1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5886],{35318:(t,e,r)=>{r.d(e,{Zo:()=>s,kt:()=>f});var a=r(27378);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e){if(null==t)return{};var r,a,n=function(t,e){if(null==t)return{};var r,a,n={},i=Object.keys(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)r=i[a],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var l=a.createContext({}),d=function(t){var e=a.useContext(l),r=e;return t&&(r="function"==typeof t?t(e):p(p({},e),t)),r},s=function(t){var e=d(t.components);return a.createElement(l.Provider,{value:e},t.children)},c="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var r=t.components,n=t.mdxType,i=t.originalType,l=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),c=d(r),u=n,f=c["".concat(l,".").concat(u)]||c[u]||m[u]||i;return r?a.createElement(f,p(p({ref:e},s),{},{components:r})):a.createElement(f,p({ref:e},s))}));function f(t,e){var r=arguments,n=e&&e.mdxType;if("string"==typeof t||n){var i=r.length,p=new Array(i);p[0]=u;var o={};for(var l in e)hasOwnProperty.call(e,l)&&(o[l]=e[l]);o.originalType=t,o[c]="string"==typeof t?t:n,p[1]=o;for(var d=2;d<i;d++)p[d]=r[d];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}u.displayName="MDXCreateElement"},56985:(t,e,r)=>{r.r(e),r.d(e,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var a=r(25773),n=(r(27378),r(35318));const i={description:"Adafruit QT Py ESP32-C3 WiFi"},p="Adafruit QT Py ESP32-C3 WiFi",o={unversionedId:"devices/esp32/adafruit-qt-py-c3",id:"devices/esp32/adafruit-qt-py-c3",title:"Adafruit QT Py ESP32-C3 WiFi",description:"Adafruit QT Py ESP32-C3 WiFi",source:"@site/docs/devices/esp32/adafruit-qt-py-c3.mdx",sourceDirName:"devices/esp32",slug:"/devices/esp32/adafruit-qt-py-c3",permalink:"/devicescript/devices/esp32/adafruit-qt-py-c3",draft:!1,tags:[],version:"current",frontMatter:{description:"Adafruit QT Py ESP32-C3 WiFi"},sidebar:"tutorialSidebar",previous:{title:"Adafruit Feather ESP32-S2",permalink:"/devicescript/devices/esp32/adafruit-feather-esp32-s2"},next:{title:"Espressif ESP32 (bare)",permalink:"/devicescript/devices/esp32/esp32-bare"}},l={},d=[{value:"Features",id:"features",level:2},{value:"Stores",id:"stores",level:2},{value:"Pins",id:"pins",level:2},{value:"DeviceScript import",id:"devicescript-import",level:2},{value:"Firmware update",id:"firmware-update",level:2},{value:"Configuration",id:"configuration",level:2}],s={toc:d},c="wrapper";function m(t){let{components:e,...r}=t;return(0,n.kt)(c,(0,a.Z)({},s,r,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"adafruit-qt-py-esp32-c3-wifi"},"Adafruit QT Py ESP32-C3 WiFi"),(0,n.kt)("p",null,"A tiny ESP32-C3 board."),(0,n.kt)("p",null,(0,n.kt)("img",{parentName:"p",src:"https://microsoft.github.io/jacdac-docs/images/devices/adafruit/qtpyesp32c3wifidevboardv10.catalog.jpg",alt:"Adafruit QT Py ESP32-C3 WiFi picture"})),(0,n.kt)("h2",{id:"features"},"Features"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"I2C on SDA_D4/SCL_D5 using Qwiic connector"),(0,n.kt)("li",{parentName:"ul"},"WS2812B RGB LED on pin 2 (use ",(0,n.kt)("a",{parentName:"li",href:"/developer/status-light"},"setStatusLight")," to control)"),(0,n.kt)("li",{parentName:"ul"},"Serial logging on pin TX_D6 at 115200 8N1"),(0,n.kt)("li",{parentName:"ul"},"Service: buttonBOOT (button)")),(0,n.kt)("h2",{id:"stores"},"Stores"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://www.adafruit.com/product/5405"},"https://www.adafruit.com/product/5405"))),(0,n.kt)("h2",{id:"pins"},"Pins"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:"left"},"pin name"),(0,n.kt)("th",{parentName:"tr",align:"left"},"hardware id"),(0,n.kt)("th",{parentName:"tr",align:"right"},"features"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A0_D0")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO4"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A1_D1")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO3"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A2_D2")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO1"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"A3_D3")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO0"),(0,n.kt)("td",{parentName:"tr",align:"right"},"analogIn, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"MISO_D9")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO8"),(0,n.kt)("td",{parentName:"tr",align:"right"},"boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"MOSI_D10")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO7"),(0,n.kt)("td",{parentName:"tr",align:"right"},"debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"RX_D7")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO20"),(0,n.kt)("td",{parentName:"tr",align:"right"},"bootUart, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"SCK_D8")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO10"),(0,n.kt)("td",{parentName:"tr",align:"right"},"io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"SCL_D5")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO6"),(0,n.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSCL, debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"SDA_D4")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO5"),(0,n.kt)("td",{parentName:"tr",align:"right"},"i2c.pinSDA, debug, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"TX_D6")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO21"),(0,n.kt)("td",{parentName:"tr",align:"right"},"log.pinTX, bootUart, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"$services.buttonBOOT","[0]",".pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO9"),(0,n.kt)("td",{parentName:"tr",align:"right"},"$services.buttonBOOT","[0]",".pin, boot, io")),(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:"left"},(0,n.kt)("strong",{parentName:"td"},"led.pin")),(0,n.kt)("td",{parentName:"tr",align:"left"},"GPIO2"),(0,n.kt)("td",{parentName:"tr",align:"right"},"led.pin, analogIn, boot, io")))),(0,n.kt)("h2",{id:"devicescript-import"},"DeviceScript import"),(0,n.kt)("p",null,"You must add this import statement to load\nthe pinout configuration for this device."),(0,n.kt)("p",null,"In ",(0,n.kt)("a",{parentName:"p",href:"/getting-started/vscode"},"Visual Studio Code"),",\nclick the ",(0,n.kt)("strong",{parentName:"p"},"wand"),' icon on the file menu and\nselect "Adafruit QT Py ESP32-C3 WiFi".'),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins, board } from "@dsboard/adafruit_qt_py_c3"\n')),(0,n.kt)("p",null),(0,n.kt)("h2",{id:"firmware-update"},"Firmware update"),(0,n.kt)("p",null,"In Visual Studio Code,\nselect ",(0,n.kt)("strong",{parentName:"p"},"DeviceScript: Flash Firmware...")," from the command palette."),(0,n.kt)("p",null,"Run this ",(0,n.kt)("a",{parentName:"p",href:"/api/cli"},"command line")," command and follow the instructions."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"devicescript flash --board adafruit_qt_py_c3\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("a",{parentName:"li",href:"https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-adafruit_qt_py_c3-0x0.bin"},"Firmware"))),(0,n.kt)("h2",{id:"configuration"},"Configuration"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="adafruit_qt_py_c3.json"',title:'"adafruit_qt_py_c3.json"'},'{\n "$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",\n "id": "adafruit_qt_py_c3",\n "devName": "Adafruit QT Py ESP32-C3 WiFi",\n "productId": "0x3693d40b",\n "$description": "A tiny ESP32-C3 board.",\n "archId": "esp32c3",\n "url": "https://www.adafruit.com/product/5405",\n "$services": [\n {\n "name": "buttonBOOT",\n "pin": 9,\n "service": "button"\n }\n ],\n "i2c": {\n "$connector": "Qwiic",\n "pinSCL": "SCL_D5",\n "pinSDA": "SDA_D4"\n },\n "led": {\n "pin": 2,\n "type": 1\n },\n "log": {\n "pinTX": "TX_D6"\n },\n "pins": {\n "A0_D0": 4,\n "A1_D1": 3,\n "A2_D2": 1,\n "A3_D3": 0,\n "MISO_D9": 8,\n "MOSI_D10": 7,\n "RX_D7": 20,\n "SCK_D8": 10,\n "SCL_D5": 6,\n "SDA_D4": 5,\n "TX_D6": 21\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f995dfad.63625bcb.js b/assets/js/f995dfad.63625bcb.js new file mode 100644 index 00000000000..a0b17a9e086 --- /dev/null +++ b/assets/js/f995dfad.63625bcb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1421],{35318:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var i=r(27378);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=i.createContext({}),f=function(e){var t=i.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=f(e.components);return i.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),s=f(r),d=n,g=s["".concat(l,".").concat(d)]||s[d]||u[d]||a;return r?i.createElement(g,o(o({ref:t},p),{},{components:r})):i.createElement(g,o({ref:t},p))}));function g(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,o=new Array(a);o[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[s]="string"==typeof e?e:n,o[1]=c;for(var f=2;f<a;f++)o[f]=r[f];return i.createElement.apply(null,o)}return i.createElement.apply(null,r)}d.displayName="MDXCreateElement"},99207:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>f});var i=r(25773),n=(r(27378),r(35318));const a={},o="Traffic Light",c={unversionedId:"api/drivers/trafficlight",id:"api/drivers/trafficlight",title:"Traffic Light",description:"The traffic light driver, startTrafficLight is used to control a toy traffic light, driving 3 LEDs.",source:"@site/docs/api/drivers/trafficlight.md",sourceDirName:"api/drivers",slug:"/api/drivers/trafficlight",permalink:"/devicescript/api/drivers/trafficlight",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Switch",permalink:"/devicescript/api/drivers/switch"},next:{title:"UC8151",permalink:"/devicescript/api/drivers/uc8151"}},l={},f=[],p={toc:f},s="wrapper";function u(e){let{components:t,...r}=e;return(0,n.kt)(s,(0,i.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"traffic-light"},"Traffic Light"),(0,n.kt)("p",null,"The traffic light driver, ",(0,n.kt)("inlineCode",{parentName:"p"},"startTrafficLight")," is used to control a toy traffic light, driving 3 LEDs."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},'import { pins } from "@dsboard/pico_w"\nimport { startTrafficLight } from "@devicescript/drivers"\n\nconst light = await startTrafficLight({\n red: pins.GP10,\n yellow: pins.GP11,\n green: pins.GP12,\n})\n\nawait light.green.write(true)\nawait light.yellow.write(false)\nawait light.red.write(false)\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fab9523c.fe411c2f.js b/assets/js/fab9523c.fe411c2f.js new file mode 100644 index 00000000000..e99176a92ea --- /dev/null +++ b/assets/js/fab9523c.fe411c2f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2345],{35318:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>f});var n=t(27378);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){o(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function a(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),c=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=c(e.components);return n.createElement(l.Provider,{value:r},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),u=c(t),d=o,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||i;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=d;var a={};for(var l in r)hasOwnProperty.call(r,l)&&(a[l]=r[l]);a.originalType=e,a[u]="string"==typeof e?e:o,s[1]=a;for(var c=2;c<i;c++)s[c]=t[c];return n.createElement.apply(null,s)}return n.createElement.apply(null,t)}d.displayName="MDXCreateElement"},20786:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>a,toc:()=>c});var n=t(25773),o=(t(27378),t(35318));const i={description:"Mounts a soil moisture sensor",title:"Soil Moisture"},s="Soil Moisture",a={unversionedId:"api/drivers/soilmoisture",id:"api/drivers/soilmoisture",title:"Soil Moisture",description:"Mounts a soil moisture sensor",source:"@site/docs/api/drivers/soilmoisture.md",sourceDirName:"api/drivers",slug:"/api/drivers/soilmoisture",permalink:"/devicescript/api/drivers/soilmoisture",draft:!1,tags:[],version:"current",frontMatter:{description:"Mounts a soil moisture sensor",title:"Soil Moisture"},sidebar:"tutorialSidebar",previous:{title:"SHTC3",permalink:"/devicescript/api/drivers/shtc3"},next:{title:"Sound Level",permalink:"/devicescript/api/drivers/soundlevel"}},l={},c=[],p={toc:c},u="wrapper";function m(e){let{components:r,...t}=e;return(0,o.kt)(u,(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"soil-moisture"},"Soil Moisture"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"startSoilMoisture")," starts a simple analog sensor server that models a soil moisture sensor\nand returns a ",(0,o.kt)("a",{parentName:"p",href:"/api/clients/soilmoisture"},"client")," bound to the server."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Please refer to the ",(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("a",{parentName:"strong",href:"/developer/drivers/analog/"},"analog documentation"))," for details.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'import { gpio } from "@devicescript/core"\nimport { startSoilMoisture } from "@devicescript/servers"\n\nconst sensor = startSoilMoisture({\n pin: ds.gpio(3),\n})\nsensor.reading.subscribe(moisture => console.data({ moisture }))\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fb10faaf.184113a6.js b/assets/js/fb10faaf.184113a6.js new file mode 100644 index 00000000000..fde80518089 --- /dev/null +++ b/assets/js/fb10faaf.184113a6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7355],{35318:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(27378);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var o=n.createContext({}),u=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(o.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,o=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(r),m=a,f=p["".concat(o,".").concat(m)]||p[m]||d[m]||s;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,l=new Array(s);l[0]=m;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[p]="string"==typeof e?e:a,l[1]=i;for(var u=2;u<s;u++)l[u]=r[u];return n.createElement.apply(null,l)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},39798:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(27378),a=r(38944);const s={tabItem:"tabItem_wHwb"};function l(e){let{children:t,hidden:r,className:l}=e;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(s.tabItem,l),hidden:r},t)}},23930:(e,t,r)=>{r.d(t,{Z:()=>w});var n=r(25773),a=r(27378),s=r(38944),l=r(83457),i=r(3620),o=r(30654),u=r(70784),c=r(71819);function p(e){return function(e){return a.Children.map(e,(e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}(e).map((e=>{let{props:{value:t,label:r,attributes:n,default:a}}=e;return{value:t,label:r,attributes:n,default:a}}))}function d(e){const{values:t,children:r}=e;return(0,a.useMemo)((()=>{const e=t??p(r);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,r])}function m(e){let{value:t,tabValues:r}=e;return r.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:r}=e;const n=(0,i.k6)(),s=function(e){let{queryString:t=!1,groupId:r}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!r)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:t,groupId:r});return[(0,o._X)(s),(0,a.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(n.location.search);t.set(s,e),n.replace({...n.location,search:t.toString()})}),[s,n])]}function b(e){const{defaultValue:t,queryString:r=!1,groupId:n}=e,s=d(e),[l,i]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!m({value:t,tabValues:r}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=r.find((e=>e.default))??r[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:s}))),[o,u]=f({queryString:r,groupId:n}),[p,b]=function(e){let{groupId:t}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,s]=(0,c.Nk)(r);return[n,(0,a.useCallback)((e=>{r&&s.set(e)}),[r,s])]}({groupId:n}),v=(()=>{const e=o??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{v&&i(v)}),[v]);return{selectedValue:l,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),b(e)}),[u,b,s]),tabValues:s}}var v=r(76457);const h={tabList:"tabList_J5MA",tabItem:"tabItem_l0OV"};function g(e){let{className:t,block:r,selectedValue:i,selectValue:o,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,l.o5)(),d=e=>{const t=e.currentTarget,r=c.indexOf(t),n=u[r].value;n!==i&&(p(t),o(n))},m=e=>{let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const r=c.indexOf(e.currentTarget)+1;t=c[r]??c[0];break}case"ArrowLeft":{const r=c.indexOf(e.currentTarget)-1;t=c[r]??c[c.length-1];break}}t?.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":r},t)},u.map((e=>{let{value:t,label:r,attributes:l}=e;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},l,{className:(0,s.Z)("tabs__item",h.tabItem,l?.className,{"tabs__item--active":i===t})}),r??t)})))}function y(e){let{lazy:t,children:r,selectedValue:n}=e;const s=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===n));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function k(e){const t=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",h.tabList)},a.createElement(g,(0,n.Z)({},e,t)),a.createElement(y,(0,n.Z)({},e,t)))}function w(e){const t=(0,v.Z)();return a.createElement(k,(0,n.Z)({key:String(t)},e))}},19609:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>f,frontMatter:()=>i,metadata:()=>u,toc:()=>p});var n=r(25773),a=(r(27378),r(35318)),s=r(23930),l=r(39798);const i={sidebar_position:9.5,description:"DeviceScript provides a unit test framework that runs on the device. It has a syntax similar to Jest/Mocha/Chai."},o="Testing",u={unversionedId:"developer/testing",id:"developer/testing",title:"Testing",description:"DeviceScript provides a unit test framework that runs on the device. It has a syntax similar to Jest/Mocha/Chai.",source:"@site/docs/developer/testing.mdx",sourceDirName:"developer",slug:"/developer/testing",permalink:"/devicescript/developer/testing",draft:!1,tags:[],version:"current",sidebarPosition:9.5,frontMatter:{sidebar_position:9.5,description:"DeviceScript provides a unit test framework that runs on the device. It has a syntax similar to Jest/Mocha/Chai."},sidebar:"tutorialSidebar",previous:{title:"Settings and Secrets",permalink:"/devicescript/developer/settings"},next:{title:"Graphics",permalink:"/devicescript/developer/graphics/"}},c={},p=[{value:"Setup",id:"setup",level:2},{value:"Defining tests",id:"defining-tests",level:2},{value:"Running tests",id:"running-tests",level:2},{value:"See also",id:"see-also",level:2}],d={toc:p},m="wrapper";function f(e){let{components:t,...r}=e;return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"testing"},"Testing"),(0,a.kt)("p",null,"DeviceScript provides a unit test framework that runs on the device. It has a syntax similar to Jest/Mocha/Chai."),(0,a.kt)("h2",{id:"setup"},"Setup"),(0,a.kt)("p",null,"Configure your project for testing using this command"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"devs add test\n")),(0,a.kt)("h2",{id:"defining-tests"},"Defining tests"),(0,a.kt)("p",null,"The test framework provides the popular BDD test contructs: ",(0,a.kt)("inlineCode",{parentName:"p"},"describe"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"test"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"expect"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { describe, test, expect } from "@devicescript/test"\n\ndescribe("this is a test suite", () => {\n test("this is a test", () => {\n expect(1).toBe(1)\n })\n})\n')),(0,a.kt)("h2",{id:"running-tests"},"Running tests"),(0,a.kt)("p",null,"From a terminal, run the ",(0,a.kt)("inlineCode",{parentName:"p"},"test")," DeviceScript"),(0,a.kt)(s.Z,{groupId:"npm2yarn",mdxType:"Tabs"},(0,a.kt)(l.Z,{value:"npm",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"npm run test\n"))),(0,a.kt)(l.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"yarn run test\n"))),(0,a.kt)(l.Z,{value:"pnpm",label:"pnpm",mdxType:"TabItem"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"pnpm run test\n")))),(0,a.kt)("h2",{id:"see-also"},"See also"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/api/test/"},"API reference"))))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fca5e363.12e701e8.js b/assets/js/fca5e363.12e701e8.js new file mode 100644 index 00000000000..6ecb2554b35 --- /dev/null +++ b/assets/js/fca5e363.12e701e8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4839],{35318:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>d});var r=t(27378);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),u=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=u(e.components);return r.createElement(p.Provider,{value:n},e.children)},s="mdxType",g={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),s=u(t),m=a,d=s["".concat(p,".").concat(m)]||s[m]||g[m]||i;return t?r.createElement(d,o(o({ref:n},c),{},{components:t})):r.createElement(d,o({ref:n},c))}));function d(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=m;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l[s]="string"==typeof e?e:a,o[1]=l;for(var u=2;u<i;u++)o[u]=t[u];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}m.displayName="MDXCreateElement"},41395:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var r=t(25773),a=(t(27378),t(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Rain gauge service"},o="RainGauge",l={unversionedId:"api/clients/raingauge",id:"api/clients/raingauge",title:"RainGauge",description:"DeviceScript client for Rain gauge service",source:"@site/docs/api/clients/raingauge.md",sourceDirName:"api/clients",slug:"/api/clients/raingauge",permalink:"/devicescript/api/clients/raingauge",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Rain gauge service"},sidebar:"tutorialSidebar"},p={},u=[{value:"Registers",id:"registers",level:2},{value:"reading",id:"ro:reading",level:3},{value:"readingResolution",id:"const:readingResolution",level:3}],c={toc:u},s="wrapper";function g(e){let{components:n,...t}=e;return(0,a.kt)(s,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"raingauge"},"RainGauge"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is rc and may change in the future.")),(0,a.kt)("p",null,"Measures the amount of liquid precipitation over an area in a predefined period of time."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { RainGauge } from "@devicescript/core"\n\nconst rainGauge = new RainGauge()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Total precipitation recorded so far."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RainGauge } from "@devicescript/core"\n\nconst rainGauge = new RainGauge()\n// ...\nconst value = await rainGauge.reading.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RainGauge } from "@devicescript/core"\n\nconst rainGauge = new RainGauge()\n// ...\nrainGauge.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:readingResolution"},"readingResolution"),(0,a.kt)("p",null,"Typically the amount of rain needed for tipping the bucket."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16.16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { RainGauge } from "@devicescript/core"\n\nconst rainGauge = new RainGauge()\n// ...\nconst value = await rainGauge.readingResolution.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fcb40366.3ef00050.js b/assets/js/fcb40366.3ef00050.js new file mode 100644 index 00000000000..44dffb02699 --- /dev/null +++ b/assets/js/fcb40366.3ef00050.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3098],{35318:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(27378);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(r),f=o,b=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(b,i(i({ref:t},s),{},{components:r})):n.createElement(b,i({ref:t},s))}));function b(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"},34260:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var n=r(25773),o=(r(27378),r(35318));const a={pagination_prev:null,pagination_next:null,unlisted:!0},i="Bootloader",l={unversionedId:"api/clients/bootloader",id:"api/clients/bootloader",title:"Bootloader",description:"The Bootloader service is used internally by the runtime",source:"@site/docs/api/clients/bootloader.md",sourceDirName:"api/clients",slug:"/api/clients/bootloader",permalink:"/devicescript/api/clients/bootloader",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,unlisted:!0},sidebar:"tutorialSidebar"},c={},p=[],s={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"bootloader"},"Bootloader"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://microsoft.github.io/jacdac-docs/services/bootloader/"},"Bootloader service")," is used internally by the runtime\nand is not directly programmable in DeviceScript."),(0,o.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ffea0820.b8cc4263.js b/assets/js/ffea0820.b8cc4263.js new file mode 100644 index 00000000000..71e36879f9a --- /dev/null +++ b/assets/js/ffea0820.b8cc4263.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1501],{35318:(e,n,t)=>{t.d(n,{Zo:()=>m,kt:()=>k});var r=t(27378);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){a(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function o(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},m=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=s(t),c=a,k=u["".concat(p,".").concat(c)]||u[c]||d[c]||i;return t?r.createElement(k,l(l({ref:n},m),{},{components:t})):r.createElement(k,l({ref:n},m))}));function k(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,l=new Array(i);l[0]=c;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o[u]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<i;s++)l[s]=t[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},15304:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var r=t(25773),a=(t(27378),t(35318));const i={pagination_prev:null,pagination_next:null,description:"DeviceScript client for Model Runner service"},l="ModelRunner",o={unversionedId:"api/clients/modelrunner",id:"api/clients/modelrunner",title:"ModelRunner",description:"DeviceScript client for Model Runner service",source:"@site/docs/api/clients/modelrunner.md",sourceDirName:"api/clients",slug:"/api/clients/modelrunner",permalink:"/devicescript/api/clients/modelrunner",draft:!1,tags:[],version:"current",frontMatter:{pagination_prev:null,pagination_next:null,description:"DeviceScript client for Model Runner service"},sidebar:"tutorialSidebar"},p={},s=[{value:"Commands",id:"commands",level:2},{value:"setModel",id:"setmodel",level:3},{value:"Registers",id:"registers",level:2},{value:"autoInvokeEvery",id:"rw:autoInvokeEvery",level:3},{value:"reading",id:"ro:reading",level:3},{value:"inputShape",id:"ro:inputShape",level:3},{value:"outputShape",id:"ro:outputShape",level:3},{value:"lastRunTime",id:"ro:lastRunTime",level:3},{value:"allocatedArenaSize",id:"ro:allocatedArenaSize",level:3},{value:"modelSize",id:"ro:modelSize",level:3},{value:"lastError",id:"ro:lastError",level:3},{value:"format",id:"const:format",level:3},{value:"formatVersion",id:"const:formatVersion",level:3},{value:"parallel",id:"const:parallel",level:3}],m={toc:s},u="wrapper";function d(e){let{components:n,...t}=e;return(0,a.kt)(u,(0,r.Z)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"modelrunner"},"ModelRunner"),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"This service is experimental and may change in the future.")),(0,a.kt)("p",null,"Runs machine learning models."),(0,a.kt)("p",null,"Only models with a single input tensor and a single output tensor are supported at the moment.\nInput is provided by Sensor Aggregator service on the same device.\nMultiple instances of this service may be present, if more than one model format is supported by a device."),(0,a.kt)("p",null),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n')),(0,a.kt)("p",null),(0,a.kt)("h2",{id:"commands"},"Commands"),(0,a.kt)("h3",{id:"setmodel"},"setModel"),(0,a.kt)("p",null,"Open pipe for streaming in the model. The size of the model has to be declared upfront.\nThe model is streamed over regular pipe data packets.\nThe format supported by this instance of the service is specified in ",(0,a.kt)("inlineCode",{parentName:"p"},"format")," register.\nWhen the pipe is closed, the model is written all into flash, and the device running the service may reset."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip no-run",skip:!0,"no-run":!0},"modelRunner.setModel(model_size: number): Promise<void>\n")),(0,a.kt)("h2",{id:"registers"},"Registers"),(0,a.kt)("p",null),(0,a.kt)("h3",{id:"rw:autoInvokeEvery"},"autoInvokeEvery"),(0,a.kt)("p",null,"When register contains ",(0,a.kt)("inlineCode",{parentName:"p"},"N > 0"),", run the model automatically every time new ",(0,a.kt)("inlineCode",{parentName:"p"},"N")," samples are collected.\nModel may be run less often if it takes longer to run than ",(0,a.kt)("inlineCode",{parentName:"p"},"N * sampling_interval"),".\nThe ",(0,a.kt)("inlineCode",{parentName:"p"},"outputs")," register will stream its value after each run.\nThis register is not stored in flash."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read and write"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.autoInvokeEvery.read()\nawait modelRunner.autoInvokeEvery.write(value)\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.autoInvokeEvery.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:reading"},"reading"),(0,a.kt)("p",null,"Results of last model invocation as ",(0,a.kt)("inlineCode",{parentName:"p"},"float32")," array."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"r: f32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.reading.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:inputShape"},"inputShape"),(0,a.kt)("p",null,"The shape of the input tensor."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"r: u16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.inputShape.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:outputShape"},"outputShape"),(0,a.kt)("p",null,"The shape of the output tensor."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<any[]>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"r: u16"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"track incoming values"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.outputShape.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:lastRunTime"},"lastRunTime"),(0,a.kt)("p",null,"The time consumed in last model execution."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.lastRunTime.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.lastRunTime.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:allocatedArenaSize"},"allocatedArenaSize"),(0,a.kt)("p",null,"Number of RAM bytes allocated for model execution."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.allocatedArenaSize.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.allocatedArenaSize.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:modelSize"},"modelSize"),(0,a.kt)("p",null,"The size of the model in bytes."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.modelSize.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.modelSize.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"ro:lastError"},"lastError"),(0,a.kt)("p",null,"Textual description of last error when running or loading model (if any)."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<string>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"s"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.lastError.read()\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"track incoming values")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nmodelRunner.lastError.subscribe(async (value) => {\n ...\n})\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:format"},"format"),(0,a.kt)("p",null,"The type of ML models supported by this service.\n",(0,a.kt)("inlineCode",{parentName:"p"},"TFLite")," is flatbuffer ",(0,a.kt)("inlineCode",{parentName:"p"},".tflite")," file.\n",(0,a.kt)("inlineCode",{parentName:"p"},"ML4F")," is compiled machine code model for Cortex-M4F.\nThe format is typically present as first or second little endian word of model file."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.format.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:formatVersion"},"formatVersion"),(0,a.kt)("p",null,"A version number for the format."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<number>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u32"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.formatVersion.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("h3",{id:"const:parallel"},"parallel"),(0,a.kt)("p",null,"If present and true this service can run models independently of other\ninstances of this service on the device."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"type: ",(0,a.kt)("inlineCode",{parentName:"p"},"Register<boolean>")," (packing format ",(0,a.kt)("inlineCode",{parentName:"p"},"u8"),")")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"optional: this register may not be implemented")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"constant: the register value will not change (until the next reset)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"read only"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts",metastring:"skip",skip:!0},'import { ModelRunner } from "@devicescript/core"\n\nconst modelRunner = new ModelRunner()\n// ...\nconst value = await modelRunner.parallel.read()\n')),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},(0,a.kt)("inlineCode",{parentName:"p"},"write")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"read")," will block until a server is bound to the client.")),(0,a.kt)("p",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/main.758ada1f.js b/assets/js/main.758ada1f.js new file mode 100644 index 00000000000..8fb34568b30 --- /dev/null +++ b/assets/js/main.758ada1f.js @@ -0,0 +1,2 @@ +/*! For license information please see main.758ada1f.js.LICENSE.txt */ +(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[179],{56573:(e,t,n)=>{"use strict";n.d(t,{W:()=>i});var r=n(27378);function i(){return r.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20"},r.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}},23427:(e,t,n)=>{"use strict";n.d(t,{_:()=>i,t:()=>a});var r=n(27378);const i=r.createContext(!1);function a(e){let{children:t}=e;const[n,a]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{a(!0)}),[]),r.createElement(i.Provider,{value:n},t)}},93375:(e,t,n)=>{"use strict";var r=n(27378),i=n(31542),a=n(4289),o=n(92883),s=n(161);const c=[n(70142),n(23815),n(54374),n(26222),n(19043),n(71720)];var l=n(76623),u=n(3620),d=n(95473);function p(e){let{children:t}=e;return r.createElement(r.Fragment,null,t)}var f=n(25773),v=n(7092),m=n(50353),h=n(98948),b=n(20624),g=n(1123),y=n(43714),w=n(70174),S=n(13149),x=n(60505);function k(){const{i18n:{defaultLocale:e,localeConfigs:t}}=(0,m.Z)(),n=(0,y.l)();return r.createElement(v.Z,null,Object.entries(t).map((e=>{let[t,{htmlLang:i}]=e;return r.createElement("link",{key:t,rel:"alternate",href:n.createUrl({locale:t,fullyQualified:!0}),hrefLang:i})})),r.createElement("link",{rel:"alternate",href:n.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function E(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,m.Z)(),i=function(){const{siteConfig:{url:e}}=(0,m.Z)(),{pathname:t}=(0,u.TH)();return e+(0,h.Z)(t)}(),a=t?`${n}${t}`:i;return r.createElement(v.Z,null,r.createElement("meta",{property:"og:url",content:a}),r.createElement("link",{rel:"canonical",href:a}))}function _(){const{i18n:{currentLocale:e}}=(0,m.Z)(),{metadata:t,image:n}=(0,b.L)();return r.createElement(r.Fragment,null,r.createElement(v.Z,null,r.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),r.createElement("body",{className:w.h})),n&&r.createElement(g.d,{image:n}),r.createElement(E,null),r.createElement(k,null),r.createElement(x.Z,{tag:S.HX,locale:e}),r.createElement(v.Z,null,t.map(((e,t)=>r.createElement("meta",(0,f.Z)({key:t},e))))))}const C=new Map;function T(e){if(C.has(e.pathname))return{...e,pathname:C.get(e.pathname)};if((0,d.f)(l.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return C.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return C.set(e.pathname,t),{...e,pathname:t}}var I=n(23427),A=n(83340);function N(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const i=c.map((t=>{const r=t.default?.[e]??t[e];return r?.(...n)}));return()=>i.forEach((e=>e?.()))}const P=function(e){let{children:t,location:n,previousLocation:i}=e;return(0,r.useLayoutEffect)((()=>{i!==n&&(!function(e){let{location:t,previousLocation:n}=e;if(!n)return;const r=t.pathname===n.pathname,i=t.hash===n.hash,a=t.search===n.search;if(r&&i&&!a)return;const{hash:o}=t;if(o){const e=decodeURIComponent(o.substring(1)),t=document.getElementById(e);t?.scrollIntoView()}else window.scrollTo(0,0)}({location:n,previousLocation:i}),N("onRouteDidUpdate",{previousLocation:i,location:n}))}),[i,n]),t};function L(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.f)(l.Z,e))).flat();return Promise.all(t.map((e=>e.route.component.preload?.())))}class R extends r.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=s.Z.canUseDOM?N("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=N("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),L(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return r.createElement(P,{previousLocation:this.previousLocation,location:t},r.createElement(u.AW,{location:t,render:()=>e}))}}const O=R,M="__docusaurus-base-url-issue-banner-container",D="__docusaurus-base-url-issue-banner",F="__docusaurus-base-url-issue-banner-suggestion-container",B="__DOCUSAURUS_INSERT_BASEURL_BANNER";function U(e){return`\nwindow['${B}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${B}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${M}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n<div id="${D}" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseUrl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">${e}</span> ${"/"===e?" (default value)":""}</p>\n <p>We suggest trying baseUrl = <span id="${F}" style="font-weight: bold; color: green;"></span></p>\n</div>\n`}(e)).replace(/</g,"\\<")};\n bannerContainer.innerHTML = bannerHtml;\n var suggestionContainer = document.getElementById('${F}');\n var actualHomePagePath = window.location.pathname;\n var suggestedBaseUrl = actualHomePagePath.substr(-1) === '/'\n ? actualHomePagePath\n : actualHomePagePath + '/';\n suggestionContainer.innerHTML = suggestedBaseUrl;\n}\n`}function z(){const{siteConfig:{baseUrl:e}}=(0,m.Z)();return(0,r.useLayoutEffect)((()=>{window[B]=!1}),[]),r.createElement(r.Fragment,null,!s.Z.canUseDOM&&r.createElement(v.Z,null,r.createElement("script",null,U(e))),r.createElement("div",{id:M}))}function j(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,m.Z)(),{pathname:n}=(0,u.TH)();return t&&n===e?r.createElement(z,null):null}function $(){const{siteConfig:{favicon:e,title:t,noIndex:n},i18n:{currentLocale:i,localeConfigs:a}}=(0,m.Z)(),o=(0,h.Z)(e),{htmlLang:s,direction:c}=a[i];return r.createElement(v.Z,null,r.createElement("html",{lang:s,dir:c}),r.createElement("title",null,t),r.createElement("meta",{property:"og:title",content:t}),r.createElement("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),n&&r.createElement("meta",{name:"robots",content:"noindex, nofollow"}),e&&r.createElement("link",{rel:"icon",href:o}))}var H=n(46293);function q(){const e=(0,d.H)(l.Z),t=(0,u.TH)();return r.createElement(H.Z,null,r.createElement(A.M,null,r.createElement(I.t,null,r.createElement(p,null,r.createElement($,null),r.createElement(_,null),r.createElement(j,null),r.createElement(O,{location:T(t)},e)))))}var V=n(16887);const Z=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{if("undefined"==typeof document)return void n();const r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",e),r.onload=()=>t(),r.onerror=()=>n();const i=document.getElementsByTagName("head")[0]??document.getElementsByName("script")[0]?.parentNode;i?.appendChild(r)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var W=n(13361);const G=new Set,K=new Set,X=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,Y={prefetch(e){if(!(e=>!X()&&!K.has(e)&&!G.has(e))(e))return!1;G.add(e);const t=(0,d.f)(l.Z,e).flatMap((e=>{return t=e.route.path,Object.entries(V).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,W.Z)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?Z(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!X()&&!K.has(e))(e)&&(K.add(e),L(e))},Q=Object.freeze(Y);if(s.Z.canUseDOM){window.docusaurus=Q;const e=i.hydrate;L(window.location.pathname).then((()=>{e(r.createElement(o.B6,null,r.createElement(a.VK,null,r.createElement(q,null))),document.getElementById("__docusaurus"))}))}},83340:(e,t,n)=>{"use strict";n.d(t,{_:()=>u,M:()=>d});var r=n(27378),i=n(36809);const a=JSON.parse('{"docusaurus-plugin-content-docs":{"default":{"path":"/devicescript/","versions":[{"name":"current","label":"Next","isLast":true,"path":"/devicescript/","mainDocId":"intro","docs":[{"id":"api/cli","path":"/devicescript/api/cli","sidebar":"tutorialSidebar"},{"id":"api/clients/accelerometer","path":"/devicescript/api/clients/accelerometer","sidebar":"tutorialSidebar"},{"id":"api/clients/acidity","path":"/devicescript/api/clients/acidity","sidebar":"tutorialSidebar"},{"id":"api/clients/airpressure","path":"/devicescript/api/clients/airpressure","sidebar":"tutorialSidebar"},{"id":"api/clients/airqualityindex","path":"/devicescript/api/clients/airqualityindex","sidebar":"tutorialSidebar"},{"id":"api/clients/arcadegamepad","path":"/devicescript/api/clients/arcadegamepad","sidebar":"tutorialSidebar"},{"id":"api/clients/arcadesound","path":"/devicescript/api/clients/arcadesound","sidebar":"tutorialSidebar"},{"id":"api/clients/barcodereader","path":"/devicescript/api/clients/barcodereader","sidebar":"tutorialSidebar"},{"id":"api/clients/bitradio","path":"/devicescript/api/clients/bitradio","sidebar":"tutorialSidebar"},{"id":"api/clients/bootloader","path":"/devicescript/api/clients/bootloader","sidebar":"tutorialSidebar"},{"id":"api/clients/brailledisplay","path":"/devicescript/api/clients/brailledisplay","sidebar":"tutorialSidebar"},{"id":"api/clients/bridge","path":"/devicescript/api/clients/bridge","sidebar":"tutorialSidebar"},{"id":"api/clients/button","path":"/devicescript/api/clients/button","sidebar":"tutorialSidebar"},{"id":"api/clients/buzzer","path":"/devicescript/api/clients/buzzer","sidebar":"tutorialSidebar"},{"id":"api/clients/capacitivebutton","path":"/devicescript/api/clients/capacitivebutton","sidebar":"tutorialSidebar"},{"id":"api/clients/characterscreen","path":"/devicescript/api/clients/characterscreen","sidebar":"tutorialSidebar"},{"id":"api/clients/cloudadapter","path":"/devicescript/api/clients/cloudadapter","sidebar":"tutorialSidebar"},{"id":"api/clients/cloudconfiguration","path":"/devicescript/api/clients/cloudconfiguration","sidebar":"tutorialSidebar"},{"id":"api/clients/codalmessagebus","path":"/devicescript/api/clients/codalmessagebus","sidebar":"tutorialSidebar"},{"id":"api/clients/color","path":"/devicescript/api/clients/color","sidebar":"tutorialSidebar"},{"id":"api/clients/compass","path":"/devicescript/api/clients/compass","sidebar":"tutorialSidebar"},{"id":"api/clients/control","path":"/devicescript/api/clients/control","sidebar":"tutorialSidebar"},{"id":"api/clients/dashboard","path":"/devicescript/api/clients/dashboard","sidebar":"tutorialSidebar"},{"id":"api/clients/dccurrentmeasurement","path":"/devicescript/api/clients/dccurrentmeasurement","sidebar":"tutorialSidebar"},{"id":"api/clients/dcvoltagemeasurement","path":"/devicescript/api/clients/dcvoltagemeasurement","sidebar":"tutorialSidebar"},{"id":"api/clients/devicescriptcondition","path":"/devicescript/api/clients/devicescriptcondition","sidebar":"tutorialSidebar"},{"id":"api/clients/devicescriptdebugger","path":"/devicescript/api/clients/devicescriptdebugger","sidebar":"tutorialSidebar"},{"id":"api/clients/devicescriptmanager","path":"/devicescript/api/clients/devicescriptmanager","sidebar":"tutorialSidebar"},{"id":"api/clients/distance","path":"/devicescript/api/clients/distance","sidebar":"tutorialSidebar"},{"id":"api/clients/dmx","path":"/devicescript/api/clients/dmx","sidebar":"tutorialSidebar"},{"id":"api/clients/dotmatrix","path":"/devicescript/api/clients/dotmatrix","sidebar":"tutorialSidebar"},{"id":"api/clients/dualmotors","path":"/devicescript/api/clients/dualmotors","sidebar":"tutorialSidebar"},{"id":"api/clients/eco2","path":"/devicescript/api/clients/eco2","sidebar":"tutorialSidebar"},{"id":"api/clients/flex","path":"/devicescript/api/clients/flex","sidebar":"tutorialSidebar"},{"id":"api/clients/gamepad","path":"/devicescript/api/clients/gamepad","sidebar":"tutorialSidebar"},{"id":"api/clients/gpio","path":"/devicescript/api/clients/gpio","sidebar":"tutorialSidebar"},{"id":"api/clients/gyroscope","path":"/devicescript/api/clients/gyroscope","sidebar":"tutorialSidebar"},{"id":"api/clients/heartrate","path":"/devicescript/api/clients/heartrate","sidebar":"tutorialSidebar"},{"id":"api/clients/hidjoystick","path":"/devicescript/api/clients/hidjoystick","sidebar":"tutorialSidebar"},{"id":"api/clients/hidkeyboard","path":"/devicescript/api/clients/hidkeyboard","sidebar":"tutorialSidebar"},{"id":"api/clients/hidmouse","path":"/devicescript/api/clients/hidmouse","sidebar":"tutorialSidebar"},{"id":"api/clients/humidity","path":"/devicescript/api/clients/humidity","sidebar":"tutorialSidebar"},{"id":"api/clients/i2c","path":"/devicescript/api/clients/i2c","sidebar":"tutorialSidebar"},{"id":"api/clients/illuminance","path":"/devicescript/api/clients/illuminance","sidebar":"tutorialSidebar"},{"id":"api/clients/index","path":"/devicescript/api/clients/","sidebar":"tutorialSidebar"},{"id":"api/clients/indexedscreen","path":"/devicescript/api/clients/indexedscreen","sidebar":"tutorialSidebar"},{"id":"api/clients/infrastructure","path":"/devicescript/api/clients/infrastructure","sidebar":"tutorialSidebar"},{"id":"api/clients/led","path":"/devicescript/api/clients/led","sidebar":"tutorialSidebar"},{"id":"api/clients/ledsingle","path":"/devicescript/api/clients/ledsingle","sidebar":"tutorialSidebar"},{"id":"api/clients/ledstrip","path":"/devicescript/api/clients/ledstrip","sidebar":"tutorialSidebar"},{"id":"api/clients/lightbulb","path":"/devicescript/api/clients/lightbulb","sidebar":"tutorialSidebar"},{"id":"api/clients/lightlevel","path":"/devicescript/api/clients/lightlevel","sidebar":"tutorialSidebar"},{"id":"api/clients/logger","path":"/devicescript/api/clients/logger","sidebar":"tutorialSidebar"},{"id":"api/clients/magneticfieldlevel","path":"/devicescript/api/clients/magneticfieldlevel","sidebar":"tutorialSidebar"},{"id":"api/clients/magnetomer","path":"/devicescript/api/clients/magnetomer","sidebar":"tutorialSidebar"},{"id":"api/clients/matrixkeypad","path":"/devicescript/api/clients/matrixkeypad","sidebar":"tutorialSidebar"},{"id":"api/clients/microphone","path":"/devicescript/api/clients/microphone","sidebar":"tutorialSidebar"},{"id":"api/clients/midioutput","path":"/devicescript/api/clients/midioutput","sidebar":"tutorialSidebar"},{"id":"api/clients/modelrunner","path":"/devicescript/api/clients/modelrunner","sidebar":"tutorialSidebar"},{"id":"api/clients/motion","path":"/devicescript/api/clients/motion","sidebar":"tutorialSidebar"},{"id":"api/clients/motor","path":"/devicescript/api/clients/motor","sidebar":"tutorialSidebar"},{"id":"api/clients/multitouch","path":"/devicescript/api/clients/multitouch","sidebar":"tutorialSidebar"},{"id":"api/clients/planarposition","path":"/devicescript/api/clients/planarposition","sidebar":"tutorialSidebar"},{"id":"api/clients/potentiometer","path":"/devicescript/api/clients/potentiometer","sidebar":"tutorialSidebar"},{"id":"api/clients/power","path":"/devicescript/api/clients/power","sidebar":"tutorialSidebar"},{"id":"api/clients/powersupply","path":"/devicescript/api/clients/powersupply","sidebar":"tutorialSidebar"},{"id":"api/clients/pressurebutton","path":"/devicescript/api/clients/pressurebutton","sidebar":"tutorialSidebar"},{"id":"api/clients/prototest","path":"/devicescript/api/clients/prototest","sidebar":"tutorialSidebar"},{"id":"api/clients/proxy","path":"/devicescript/api/clients/proxy","sidebar":"tutorialSidebar"},{"id":"api/clients/pulseoximeter","path":"/devicescript/api/clients/pulseoximeter","sidebar":"tutorialSidebar"},{"id":"api/clients/raingauge","path":"/devicescript/api/clients/raingauge","sidebar":"tutorialSidebar"},{"id":"api/clients/realtimeclock","path":"/devicescript/api/clients/realtimeclock","sidebar":"tutorialSidebar"},{"id":"api/clients/reflectedlight","path":"/devicescript/api/clients/reflectedlight","sidebar":"tutorialSidebar"},{"id":"api/clients/relay","path":"/devicescript/api/clients/relay","sidebar":"tutorialSidebar"},{"id":"api/clients/rng","path":"/devicescript/api/clients/rng","sidebar":"tutorialSidebar"},{"id":"api/clients/rolemanager","path":"/devicescript/api/clients/rolemanager","sidebar":"tutorialSidebar"},{"id":"api/clients/ros","path":"/devicescript/api/clients/ros","sidebar":"tutorialSidebar"},{"id":"api/clients/rotaryencoder","path":"/devicescript/api/clients/rotaryencoder","sidebar":"tutorialSidebar"},{"id":"api/clients/rover","path":"/devicescript/api/clients/rover","sidebar":"tutorialSidebar"},{"id":"api/clients/satelittenavigationsystem","path":"/devicescript/api/clients/satelittenavigationsystem","sidebar":"tutorialSidebar"},{"id":"api/clients/sensoraggregator","path":"/devicescript/api/clients/sensoraggregator","sidebar":"tutorialSidebar"},{"id":"api/clients/serial","path":"/devicescript/api/clients/serial","sidebar":"tutorialSidebar"},{"id":"api/clients/servo","path":"/devicescript/api/clients/servo","sidebar":"tutorialSidebar"},{"id":"api/clients/settings","path":"/devicescript/api/clients/settings","sidebar":"tutorialSidebar"},{"id":"api/clients/sevensegmentdisplay","path":"/devicescript/api/clients/sevensegmentdisplay","sidebar":"tutorialSidebar"},{"id":"api/clients/soilmoisture","path":"/devicescript/api/clients/soilmoisture","sidebar":"tutorialSidebar"},{"id":"api/clients/solenoid","path":"/devicescript/api/clients/solenoid","sidebar":"tutorialSidebar"},{"id":"api/clients/soundlevel","path":"/devicescript/api/clients/soundlevel","sidebar":"tutorialSidebar"},{"id":"api/clients/soundplayer","path":"/devicescript/api/clients/soundplayer","sidebar":"tutorialSidebar"},{"id":"api/clients/soundrecorderwithplayback","path":"/devicescript/api/clients/soundrecorderwithplayback","sidebar":"tutorialSidebar"},{"id":"api/clients/soundspectrum","path":"/devicescript/api/clients/soundspectrum","sidebar":"tutorialSidebar"},{"id":"api/clients/speechsynthesis","path":"/devicescript/api/clients/speechsynthesis","sidebar":"tutorialSidebar"},{"id":"api/clients/switch","path":"/devicescript/api/clients/switch","sidebar":"tutorialSidebar"},{"id":"api/clients/tcp","path":"/devicescript/api/clients/tcp","sidebar":"tutorialSidebar"},{"id":"api/clients/temperature","path":"/devicescript/api/clients/temperature","sidebar":"tutorialSidebar"},{"id":"api/clients/timeseriesaggregator","path":"/devicescript/api/clients/timeseriesaggregator","sidebar":"tutorialSidebar"},{"id":"api/clients/trafficlight","path":"/devicescript/api/clients/trafficlight","sidebar":"tutorialSidebar"},{"id":"api/clients/tvoc","path":"/devicescript/api/clients/tvoc","sidebar":"tutorialSidebar"},{"id":"api/clients/uniquebrain","path":"/devicescript/api/clients/uniquebrain","sidebar":"tutorialSidebar"},{"id":"api/clients/usbbridge","path":"/devicescript/api/clients/usbbridge","sidebar":"tutorialSidebar"},{"id":"api/clients/uvindex","path":"/devicescript/api/clients/uvindex","sidebar":"tutorialSidebar"},{"id":"api/clients/verifiedtelemetrysensor","path":"/devicescript/api/clients/verifiedtelemetrysensor","sidebar":"tutorialSidebar"},{"id":"api/clients/vibrationmotor","path":"/devicescript/api/clients/vibrationmotor","sidebar":"tutorialSidebar"},{"id":"api/clients/waterlevel","path":"/devicescript/api/clients/waterlevel","sidebar":"tutorialSidebar"},{"id":"api/clients/weightscale","path":"/devicescript/api/clients/weightscale","sidebar":"tutorialSidebar"},{"id":"api/clients/wifi","path":"/devicescript/api/clients/wifi","sidebar":"tutorialSidebar"},{"id":"api/clients/winddirection","path":"/devicescript/api/clients/winddirection","sidebar":"tutorialSidebar"},{"id":"api/clients/windspeed","path":"/devicescript/api/clients/windspeed","sidebar":"tutorialSidebar"},{"id":"api/clients/wssk","path":"/devicescript/api/clients/wssk","sidebar":"tutorialSidebar"},{"id":"api/core/buffers","path":"/devicescript/api/core/buffers","sidebar":"tutorialSidebar"},{"id":"api/core/commands","path":"/devicescript/api/core/commands","sidebar":"tutorialSidebar"},{"id":"api/core/events","path":"/devicescript/api/core/events","sidebar":"tutorialSidebar"},{"id":"api/core/index","path":"/devicescript/api/core/","sidebar":"tutorialSidebar"},{"id":"api/core/registers","path":"/devicescript/api/core/registers","sidebar":"tutorialSidebar"},{"id":"api/core/roles","path":"/devicescript/api/core/roles","sidebar":"tutorialSidebar"},{"id":"api/drivers/accelerometer","path":"/devicescript/api/drivers/accelerometer","sidebar":"tutorialSidebar"},{"id":"api/drivers/aht20","path":"/devicescript/api/drivers/aht20","sidebar":"tutorialSidebar"},{"id":"api/drivers/bme680","path":"/devicescript/api/drivers/bme680","sidebar":"tutorialSidebar"},{"id":"api/drivers/button","path":"/devicescript/api/drivers/button","sidebar":"tutorialSidebar"},{"id":"api/drivers/buzzer","path":"/devicescript/api/drivers/buzzer","sidebar":"tutorialSidebar"},{"id":"api/drivers/hall","path":"/devicescript/api/drivers/hall","sidebar":"tutorialSidebar"},{"id":"api/drivers/hidjoystick","path":"/devicescript/api/drivers/hidjoystick","sidebar":"tutorialSidebar"},{"id":"api/drivers/hidkeyboard","path":"/devicescript/api/drivers/hidkeyboard","sidebar":"tutorialSidebar"},{"id":"api/drivers/hidmouse","path":"/devicescript/api/drivers/hidmouse","sidebar":"tutorialSidebar"},{"id":"api/drivers/index","path":"/devicescript/api/drivers/","sidebar":"tutorialSidebar"},{"id":"api/drivers/lightbulb","path":"/devicescript/api/drivers/lightbulb","sidebar":"tutorialSidebar"},{"id":"api/drivers/lightlevel","path":"/devicescript/api/drivers/lightlevel","sidebar":"tutorialSidebar"},{"id":"api/drivers/ltr390","path":"/devicescript/api/drivers/ltr390","sidebar":"tutorialSidebar"},{"id":"api/drivers/motion","path":"/devicescript/api/drivers/motion","sidebar":"tutorialSidebar"},{"id":"api/drivers/potentiometer","path":"/devicescript/api/drivers/potentiometer","sidebar":"tutorialSidebar"},{"id":"api/drivers/power","path":"/devicescript/api/drivers/power","sidebar":"tutorialSidebar"},{"id":"api/drivers/reflectedlight","path":"/devicescript/api/drivers/reflectedlight","sidebar":"tutorialSidebar"},{"id":"api/drivers/relay","path":"/devicescript/api/drivers/relay","sidebar":"tutorialSidebar"},{"id":"api/drivers/rotaryencoder","path":"/devicescript/api/drivers/rotaryencoder","sidebar":"tutorialSidebar"},{"id":"api/drivers/servo","path":"/devicescript/api/drivers/servo","sidebar":"tutorialSidebar"},{"id":"api/drivers/sht30","path":"/devicescript/api/drivers/sht30","sidebar":"tutorialSidebar"},{"id":"api/drivers/shtc3","path":"/devicescript/api/drivers/shtc3","sidebar":"tutorialSidebar"},{"id":"api/drivers/soilmoisture","path":"/devicescript/api/drivers/soilmoisture","sidebar":"tutorialSidebar"},{"id":"api/drivers/soundlevel","path":"/devicescript/api/drivers/soundlevel","sidebar":"tutorialSidebar"},{"id":"api/drivers/ssd1306","path":"/devicescript/api/drivers/ssd1306","sidebar":"tutorialSidebar"},{"id":"api/drivers/st7789","path":"/devicescript/api/drivers/st7789","sidebar":"tutorialSidebar"},{"id":"api/drivers/switch","path":"/devicescript/api/drivers/switch","sidebar":"tutorialSidebar"},{"id":"api/drivers/trafficlight","path":"/devicescript/api/drivers/trafficlight","sidebar":"tutorialSidebar"},{"id":"api/drivers/uc8151","path":"/devicescript/api/drivers/uc8151","sidebar":"tutorialSidebar"},{"id":"api/drivers/waterlevel","path":"/devicescript/api/drivers/waterlevel","sidebar":"tutorialSidebar"},{"id":"api/math","path":"/devicescript/api/math","sidebar":"tutorialSidebar"},{"id":"api/observables/creation","path":"/devicescript/api/observables/creation","sidebar":"tutorialSidebar"},{"id":"api/observables/dsp","path":"/devicescript/api/observables/dsp","sidebar":"tutorialSidebar"},{"id":"api/observables/filter","path":"/devicescript/api/observables/filter","sidebar":"tutorialSidebar"},{"id":"api/observables/index","path":"/devicescript/api/observables/","sidebar":"tutorialSidebar"},{"id":"api/observables/transform","path":"/devicescript/api/observables/transform","sidebar":"tutorialSidebar"},{"id":"api/observables/utils","path":"/devicescript/api/observables/utils","sidebar":"tutorialSidebar"},{"id":"api/runtime/index","path":"/devicescript/api/runtime/","sidebar":"tutorialSidebar"},{"id":"api/runtime/palette","path":"/devicescript/api/runtime/palette","sidebar":"tutorialSidebar"},{"id":"api/runtime/pixelbuffer","path":"/devicescript/api/runtime/pixelbuffer","sidebar":"tutorialSidebar"},{"id":"api/runtime/schedule","path":"/devicescript/api/runtime/schedule","sidebar":"tutorialSidebar"},{"id":"api/settings/index","path":"/devicescript/api/settings/","sidebar":"tutorialSidebar"},{"id":"api/spi","path":"/devicescript/api/spi","sidebar":"tutorialSidebar"},{"id":"api/test/index","path":"/devicescript/api/test/","sidebar":"tutorialSidebar"},{"id":"api/vm","path":"/devicescript/api/vm","sidebar":"tutorialSidebar"},{"id":"changelog","path":"/devicescript/changelog","sidebar":"tutorialSidebar"},{"id":"contributing","path":"/devicescript/contributing","sidebar":"tutorialSidebar"},{"id":"developer/board-configuration","path":"/devicescript/developer/board-configuration","sidebar":"tutorialSidebar"},{"id":"developer/bundle","path":"/devicescript/developer/bundle","sidebar":"tutorialSidebar"},{"id":"developer/clients","path":"/devicescript/developer/clients","sidebar":"tutorialSidebar"},{"id":"developer/commands","path":"/devicescript/developer/commands","sidebar":"tutorialSidebar"},{"id":"developer/console","path":"/devicescript/developer/console","sidebar":"tutorialSidebar"},{"id":"developer/crypto","path":"/devicescript/developer/crypto","sidebar":"tutorialSidebar"},{"id":"developer/development-gateway/configuration","path":"/devicescript/developer/development-gateway/configuration","sidebar":"tutorialSidebar"},{"id":"developer/development-gateway/environment","path":"/devicescript/developer/development-gateway/environment","sidebar":"tutorialSidebar"},{"id":"developer/development-gateway/gateway","path":"/devicescript/developer/development-gateway/gateway","sidebar":"tutorialSidebar"},{"id":"developer/development-gateway/index","path":"/devicescript/developer/development-gateway/","sidebar":"tutorialSidebar"},{"id":"developer/development-gateway/messages","path":"/devicescript/developer/development-gateway/messages","sidebar":"tutorialSidebar"},{"id":"developer/development-gateway/telemetry","path":"/devicescript/developer/development-gateway/telemetry","sidebar":"tutorialSidebar"},{"id":"developer/drivers/analog","path":"/devicescript/developer/drivers/analog","sidebar":"tutorialSidebar"},{"id":"developer/drivers/custom-services","path":"/devicescript/developer/drivers/custom-services","sidebar":"tutorialSidebar"},{"id":"developer/drivers/digital-io/index","path":"/devicescript/developer/drivers/digital-io/","sidebar":"tutorialSidebar"},{"id":"developer/drivers/digital-io/wire","path":"/devicescript/developer/drivers/digital-io/wire","sidebar":"tutorialSidebar"},{"id":"developer/drivers/i2c","path":"/devicescript/developer/drivers/i2c","sidebar":"tutorialSidebar"},{"id":"developer/drivers/index","path":"/devicescript/developer/drivers/","sidebar":"tutorialSidebar"},{"id":"developer/drivers/serial","path":"/devicescript/developer/drivers/serial","sidebar":"tutorialSidebar"},{"id":"developer/drivers/spi","path":"/devicescript/developer/drivers/spi","sidebar":"tutorialSidebar"},{"id":"developer/errors","path":"/devicescript/developer/errors","sidebar":"tutorialSidebar"},{"id":"developer/graphics/display","path":"/devicescript/developer/graphics/display","sidebar":"tutorialSidebar"},{"id":"developer/graphics/image","path":"/devicescript/developer/graphics/image","sidebar":"tutorialSidebar"},{"id":"developer/graphics/index","path":"/devicescript/developer/graphics/","sidebar":"tutorialSidebar"},{"id":"developer/index","path":"/devicescript/developer/","sidebar":"tutorialSidebar"},{"id":"developer/iot/adafruit-io/index","path":"/devicescript/developer/iot/adafruit-io/","sidebar":"tutorialSidebar"},{"id":"developer/iot/blues-io/index","path":"/devicescript/developer/iot/blues-io/","sidebar":"tutorialSidebar"},{"id":"developer/iot/blynk-io/index","path":"/devicescript/developer/iot/blynk-io/","sidebar":"tutorialSidebar"},{"id":"developer/iot/index","path":"/devicescript/developer/iot/","sidebar":"tutorialSidebar"},{"id":"developer/iot/matlab-thingspeak/index","path":"/devicescript/developer/iot/matlab-thingspeak/","sidebar":"tutorialSidebar"},{"id":"developer/json","path":"/devicescript/developer/json","sidebar":"tutorialSidebar"},{"id":"developer/jsx","path":"/devicescript/developer/jsx","sidebar":"tutorialSidebar"},{"id":"developer/leds/display","path":"/devicescript/developer/leds/display","sidebar":"tutorialSidebar"},{"id":"developer/leds/driver","path":"/devicescript/developer/leds/driver","sidebar":"tutorialSidebar"},{"id":"developer/leds/index","path":"/devicescript/developer/leds/","sidebar":"tutorialSidebar"},{"id":"developer/low-power","path":"/devicescript/developer/low-power","sidebar":"tutorialSidebar"},{"id":"developer/mcu-temperature","path":"/devicescript/developer/mcu-temperature","sidebar":"tutorialSidebar"},{"id":"developer/net/encrypted-fetch","path":"/devicescript/developer/net/encrypted-fetch","sidebar":"tutorialSidebar"},{"id":"developer/net/index","path":"/devicescript/developer/net/","sidebar":"tutorialSidebar"},{"id":"developer/net/mqtt","path":"/devicescript/developer/net/mqtt","sidebar":"tutorialSidebar"},{"id":"developer/observables","path":"/devicescript/developer/observables","sidebar":"tutorialSidebar"},{"id":"developer/packages/custom","path":"/devicescript/developer/packages/custom","sidebar":"tutorialSidebar"},{"id":"developer/packages/index","path":"/devicescript/developer/packages/","sidebar":"tutorialSidebar"},{"id":"developer/register","path":"/devicescript/developer/register","sidebar":"tutorialSidebar"},{"id":"developer/settings","path":"/devicescript/developer/settings","sidebar":"tutorialSidebar"},{"id":"developer/simulation","path":"/devicescript/developer/simulation","sidebar":"tutorialSidebar"},{"id":"developer/status-light","path":"/devicescript/developer/status-light","sidebar":"tutorialSidebar"},{"id":"developer/testing","path":"/devicescript/developer/testing","sidebar":"tutorialSidebar"},{"id":"devices/add-board","path":"/devicescript/devices/add-board","sidebar":"tutorialSidebar"},{"id":"devices/add-shield","path":"/devicescript/devices/add-shield","sidebar":"tutorialSidebar"},{"id":"devices/add-soc","path":"/devicescript/devices/add-soc","sidebar":"tutorialSidebar"},{"id":"devices/esp32/adafruit-feather-esp32-s2","path":"/devicescript/devices/esp32/adafruit-feather-esp32-s2","sidebar":"tutorialSidebar"},{"id":"devices/esp32/adafruit-qt-py-c3","path":"/devicescript/devices/esp32/adafruit-qt-py-c3","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32-bare","path":"/devicescript/devices/esp32/esp32-bare","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32-c3fh4-rgb","path":"/devicescript/devices/esp32/esp32-c3fh4-rgb","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32-devkit-c","path":"/devicescript/devices/esp32/esp32-devkit-c","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32c3-bare","path":"/devicescript/devices/esp32/esp32c3-bare","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32c3-rust-devkit","path":"/devicescript/devices/esp32/esp32c3-rust-devkit","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32s2-bare","path":"/devicescript/devices/esp32/esp32s2-bare","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32s3-bare","path":"/devicescript/devices/esp32/esp32s3-bare","sidebar":"tutorialSidebar"},{"id":"devices/esp32/esp32s3-devkit-m","path":"/devicescript/devices/esp32/esp32s3-devkit-m","sidebar":"tutorialSidebar"},{"id":"devices/esp32/feather-s2","path":"/devicescript/devices/esp32/feather-s2","sidebar":"tutorialSidebar"},{"id":"devices/esp32/index","path":"/devicescript/devices/esp32/","sidebar":"tutorialSidebar"},{"id":"devices/esp32/msr207-v42","path":"/devicescript/devices/esp32/msr207-v42","sidebar":"tutorialSidebar"},{"id":"devices/esp32/msr207-v43","path":"/devicescript/devices/esp32/msr207-v43","sidebar":"tutorialSidebar"},{"id":"devices/esp32/msr48","path":"/devicescript/devices/esp32/msr48","sidebar":"tutorialSidebar"},{"id":"devices/esp32/seeed-xiao-esp32c3","path":"/devicescript/devices/esp32/seeed-xiao-esp32c3","sidebar":"tutorialSidebar"},{"id":"devices/esp32/seeed-xiao-esp32c3-msr218","path":"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218","sidebar":"tutorialSidebar"},{"id":"devices/index","path":"/devicescript/devices/","sidebar":"tutorialSidebar"},{"id":"devices/rp2040/index","path":"/devicescript/devices/rp2040/","sidebar":"tutorialSidebar"},{"id":"devices/rp2040/msr124","path":"/devicescript/devices/rp2040/msr124","sidebar":"tutorialSidebar"},{"id":"devices/rp2040/msr59","path":"/devicescript/devices/rp2040/msr59","sidebar":"tutorialSidebar"},{"id":"devices/rp2040/pico","path":"/devicescript/devices/rp2040/pico","sidebar":"tutorialSidebar"},{"id":"devices/rp2040/pico-w","path":"/devicescript/devices/rp2040/pico-w","sidebar":"tutorialSidebar"},{"id":"devices/shields/index","path":"/devicescript/devices/shields/","sidebar":"tutorialSidebar"},{"id":"devices/shields/pico-bricks","path":"/devicescript/devices/shields/pico-bricks","sidebar":"tutorialSidebar"},{"id":"devices/shields/pimoroni-pico-badger","path":"/devicescript/devices/shields/pimoroni-pico-badger","sidebar":"tutorialSidebar"},{"id":"devices/shields/waveshare-pico-lcd-114","path":"/devicescript/devices/shields/waveshare-pico-lcd-114","sidebar":"tutorialSidebar"},{"id":"devices/shields/xiao-expansion-board","path":"/devicescript/devices/shields/xiao-expansion-board","sidebar":"tutorialSidebar"},{"id":"getting-started/cli","path":"/devicescript/getting-started/cli","sidebar":"tutorialSidebar"},{"id":"getting-started/index","path":"/devicescript/getting-started/","sidebar":"tutorialSidebar"},{"id":"getting-started/vscode/debugging","path":"/devicescript/getting-started/vscode/debugging","sidebar":"tutorialSidebar"},{"id":"getting-started/vscode/index","path":"/devicescript/getting-started/vscode/","sidebar":"tutorialSidebar"},{"id":"getting-started/vscode/simulation","path":"/devicescript/getting-started/vscode/simulation","sidebar":"tutorialSidebar"},{"id":"getting-started/vscode/troubleshooting","path":"/devicescript/getting-started/vscode/troubleshooting","sidebar":"tutorialSidebar"},{"id":"getting-started/vscode/user-interface","path":"/devicescript/getting-started/vscode/user-interface","sidebar":"tutorialSidebar"},{"id":"getting-started/vscode/workspaces","path":"/devicescript/getting-started/vscode/workspaces","sidebar":"tutorialSidebar"},{"id":"intro","path":"/devicescript/intro","sidebar":"tutorialSidebar"},{"id":"language/async","path":"/devicescript/language/async","sidebar":"tutorialSidebar"},{"id":"language/bytecode","path":"/devicescript/language/bytecode","sidebar":"tutorialSidebar"},{"id":"language/devicescript-vs-javascript","path":"/devicescript/language/devicescript-vs-javascript","sidebar":"tutorialSidebar"},{"id":"language/hex","path":"/devicescript/language/hex","sidebar":"tutorialSidebar"},{"id":"language/index","path":"/devicescript/language/","sidebar":"tutorialSidebar"},{"id":"language/runtime","path":"/devicescript/language/runtime","sidebar":"tutorialSidebar"},{"id":"language/special","path":"/devicescript/language/special","sidebar":"tutorialSidebar"},{"id":"language/strings","path":"/devicescript/language/strings","sidebar":"tutorialSidebar"},{"id":"language/tostring","path":"/devicescript/language/tostring","sidebar":"tutorialSidebar"},{"id":"language/tree-shaking","path":"/devicescript/language/tree-shaking","sidebar":"tutorialSidebar"},{"id":"samples/blinky","path":"/devicescript/samples/blinky","sidebar":"tutorialSidebar"},{"id":"samples/button-led","path":"/devicescript/samples/button-led","sidebar":"tutorialSidebar"},{"id":"samples/copy-paste-button","path":"/devicescript/samples/copy-paste-button","sidebar":"tutorialSidebar"},{"id":"samples/dimmer","path":"/devicescript/samples/dimmer","sidebar":"tutorialSidebar"},{"id":"samples/double-blinky","path":"/devicescript/samples/double-blinky","sidebar":"tutorialSidebar"},{"id":"samples/github-build-status","path":"/devicescript/samples/github-build-status","sidebar":"tutorialSidebar"},{"id":"samples/homebridge-humidity","path":"/devicescript/samples/homebridge-humidity","sidebar":"tutorialSidebar"},{"id":"samples/index","path":"/devicescript/samples/","sidebar":"tutorialSidebar"},{"id":"samples/schedule-blinky","path":"/devicescript/samples/schedule-blinky","sidebar":"tutorialSidebar"},{"id":"samples/status-light-blinky","path":"/devicescript/samples/status-light-blinky","sidebar":"tutorialSidebar"},{"id":"samples/temperature-mqtt","path":"/devicescript/samples/temperature-mqtt","sidebar":"tutorialSidebar"},{"id":"samples/thermostat","path":"/devicescript/samples/thermostat","sidebar":"tutorialSidebar"},{"id":"samples/thermostat-gateway","path":"/devicescript/samples/thermostat-gateway","sidebar":"tutorialSidebar"},{"id":"samples/weather-dashboard","path":"/devicescript/samples/weather-dashboard","sidebar":"tutorialSidebar"},{"id":"samples/weather-display","path":"/devicescript/samples/weather-display","sidebar":"tutorialSidebar"},{"id":"samples/workshop/index","path":"/devicescript/samples/workshop/","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/devicescript/intro","label":"intro"}}}}],"breadcrumbs":true}}}'),o=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var s=n(57529);const c=JSON.parse('{"docusaurusVersion":"2.4.1","siteVersion":"2.15.6","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.4.1"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.4.1"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.4.1"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.4.1"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"2.4.1"},"@rise4fun/docusaurus-plugin-application-insights":{"type":"local"},"docusaurus-theme-mermaid":{"type":"package","name":"@docusaurus/theme-mermaid","version":"2.4.1"},"@rise4fun/docusaurus-theme-codesandbox-button":{"type":"package","name":"@rise4fun/docusaurus-theme-codesandbox-button","version":"2.1.3"}}}'),l={siteConfig:i.default,siteMetadata:c,globalData:a,i18n:o,codeTranslations:s},u=r.createContext(l);function d(e){let{children:t}=e;return r.createElement(u.Provider,{value:l},t)}},46293:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(27378),i=n(161),a=n(7092),o=n(51721),s=n(20432);function c(e){let{error:t,tryAgain:n}=e;return r.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",minHeight:"100vh",width:"100%",maxWidth:"80ch",fontSize:"20px",margin:"0 auto",padding:"1rem"}},r.createElement("h1",{style:{fontSize:"3rem"}},"This page crashed"),r.createElement("button",{type:"button",onClick:n,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"}},"Try again"),r.createElement(l,{error:t}))}function l(e){let{error:t}=e;const n=(0,o.getErrorCausalChain)(t).map((e=>e.message)).join("\n\nCause:\n");return r.createElement("p",{style:{whiteSpace:"pre-wrap"}},n)}function u(e){let{error:t,tryAgain:n}=e;return r.createElement(p,{fallback:()=>r.createElement(c,{error:t,tryAgain:n})},r.createElement(a.Z,null,r.createElement("title",null,"Page Error")),r.createElement(s.Z,null,r.createElement(c,{error:t,tryAgain:n})))}const d=e=>r.createElement(u,e);class p extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){i.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??d)(e)}return e??null}}},161:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,i={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},7092:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(27378),i=n(92883);function a(e){return r.createElement(i.ql,e)}},81884:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(25773),i=n(27378),a=n(4289),o=n(51721),s=n(50353),c=n(45626),l=n(161);const u=i.createContext({collectLink:()=>{}});var d=n(98948);function p(e,t){let{isNavLink:n,to:p,href:f,activeClassName:v,isActive:m,"data-noBrokenLinkCheck":h,autoAddBaseUrl:b=!0,...g}=e;const{siteConfig:{trailingSlash:y,baseUrl:w}}=(0,s.Z)(),{withBaseUrl:S}=(0,d.C)(),x=(0,i.useContext)(u),k=(0,i.useRef)(null);(0,i.useImperativeHandle)(t,(()=>k.current));const E=p||f;const _=(0,c.Z)(E),C=E?.replace("pathname://","");let T=void 0!==C?(I=C,b&&(e=>e.startsWith("/"))(I)?S(I):I):void 0;var I;T&&_&&(T=(0,o.applyTrailingSlash)(T,{trailingSlash:y,baseUrl:w}));const A=(0,i.useRef)(!1),N=n?a.OL:a.rU,P=l.Z.canUseIntersectionObserver,L=(0,i.useRef)(),R=()=>{A.current||null==T||(window.docusaurus.preload(T),A.current=!0)};(0,i.useEffect)((()=>(!P&&_&&null!=T&&window.docusaurus.prefetch(T),()=>{P&&L.current&&L.current.disconnect()})),[L,T,P,_]);const O=T?.startsWith("#")??!1,M=!T||!_||O;return M||h||x.collectLink(T),M?i.createElement("a",(0,r.Z)({ref:k,href:T},E&&!_&&{target:"_blank",rel:"noopener noreferrer"},g)):i.createElement(N,(0,r.Z)({},g,{onMouseEnter:R,onTouchStart:R,innerRef:e=>{k.current=e,P&&e&&_&&(L.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(L.current.unobserve(e),L.current.disconnect(),null!=T&&window.docusaurus.prefetch(T))}))})),L.current.observe(e))},to:T},n&&{isActive:m,activeClassName:v}))}const f=i.forwardRef(p)},99213:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c,I:()=>s});var r=n(27378);function i(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=t?.[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var a=n(57529);function o(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return a[t??n]??n??t}function s(e,t){let{message:n,id:r}=e;return i(o({message:n,id:r}),t)}function c(e){let{children:t,id:n,values:a}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal <Translate> children",t),new Error("The Docusaurus <Translate> component only accept simple string values");const s=o({message:t,id:n});return r.createElement(r.Fragment,null,i(s,a))}},45688:(e,t,n)=>{"use strict";n.d(t,{m:()=>r});const r="default"},45626:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!r(e)}n.d(t,{Z:()=>i,b:()=>r})},98948:(e,t,n)=>{"use strict";n.d(t,{C:()=>o,Z:()=>s});var r=n(27378),i=n(50353),a=n(45626);function o(){const{siteConfig:{baseUrl:e,url:t}}=(0,i.Z)(),n=(0,r.useCallback)(((n,r)=>function(e,t,n,r){let{forcePrependBaseUrl:i=!1,absolute:o=!1}=void 0===r?{}:r;if(!n||n.startsWith("#")||(0,a.b)(n))return n;if(i)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const s=n.startsWith(t)?n:t+n.replace(/^\//,"");return o?e+s:s}(t,e,n,r)),[t,e]);return{withBaseUrl:n}}function s(e,t){void 0===t&&(t={});const{withBaseUrl:n}=o();return n(e,t)}},50353:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(27378),i=n(83340);function a(){return(0,r.useContext)(i._)}},76457:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(27378),i=n(23427);function a(){return(0,r.useContext)(i._)}},13361:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});const r=e=>"object"==typeof e&&!!e&&Object.keys(e).length>0;function i(e){const t={};return function e(n,i){Object.entries(n).forEach((n=>{let[a,o]=n;const s=i?`${i}.${a}`:a;r(o)?e(o,s):t[s]=o}))}(e),t}},66881:(e,t,n)=>{"use strict";n.d(t,{_:()=>i,z:()=>a});var r=n(27378);const i=r.createContext(null);function a(e){let{children:t,value:n}=e;const a=r.useContext(i),o=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...n?.data};return{plugin:t.plugin,data:r}}({parent:a,value:n})),[a,n]);return r.createElement(i.Provider,{value:o},t)}},62935:(e,t,n)=>{"use strict";n.d(t,{Iw:()=>b,gA:()=>f,WS:()=>v,_r:()=>d,Jo:()=>g,zh:()=>p,yW:()=>h,gB:()=>m});var r=n(3620),i=n(50353),a=n(45688);function o(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,i.Z)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const s=e=>e.versions.find((e=>e.isLast));function c(e,t){const n=s(e);return[...e.versions.filter((e=>e!==n)),n].find((e=>!!(0,r.LX)(t,{path:e.path,exact:!1,strict:!1})))}function l(e,t){const n=c(e,t),i=n?.docs.find((e=>!!(0,r.LX)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:i,alternateDocVersions:i?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(i.id):{}}}const u={},d=()=>o("docusaurus-plugin-content-docs")??u,p=e=>function(e,t,n){void 0===t&&(t=a.m),void 0===n&&(n={});const r=o(e),i=r?.[t];if(!i&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return i}("docusaurus-plugin-content-docs",e,{failfast:!0});function f(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.TH)();return function(e,t,n){void 0===n&&(n={});const i=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.LX)(t,{path:n.path,exact:!1,strict:!1})})),a=i?{pluginId:i[0],pluginData:i[1]}:void 0;if(!a&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return a}(t,n,e)}function v(e){void 0===e&&(e={});const t=f(e),{pathname:n}=(0,r.TH)();if(!t)return;return{activePlugin:t,activeVersion:c(t.pluginData,n)}}function m(e){return p(e).versions}function h(e){const t=p(e);return s(t)}function b(e){const t=p(e),{pathname:n}=(0,r.TH)();return l(t,n)}function g(e){const t=p(e),{pathname:n}=(0,r.TH)();return function(e,t){const n=s(e);return{latestDocSuggestion:l(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},54374:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a});var r=n(8504),i=n.n(r);i().configure({showSpinner:!1});const a={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{i().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){i().done()}}},23815:(e,t,n)=>{"use strict";n.r(t);var r=n(52349),i=n(36809);!function(e){const{themeConfig:{prism:t}}=i.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{n(46324)(`./prism-${e}`)})),delete globalThis.Prism}(r.Z)},6125:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(27378);const i={iconExternalLink:"iconExternalLink_nPrP"};function a(e){let{width:t=13.5,height:n=13.5}=e;return r.createElement("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:i.iconExternalLink},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},20432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Nt});var r=n(27378),i=n(38944),a=n(46293),o=n(1123),s=n(25773),c=n(3620),l=n(99213),u=n(24993);const d="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function f(){const e=(0,r.useRef)(null),{action:t}=(0,c.k6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&p(t)}),[]);return(0,u.S)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:n}}const v=(0,l.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function m(e){const t=e.children??v,{containerRef:n,onClick:i}=f();return r.createElement("div",{ref:n,role:"region","aria-label":v},r.createElement("a",(0,s.Z)({},e,{href:`#${d}`,onClick:i}),t))}var h=n(75484),b=n(70174);const g={skipToContent:"skipToContent_oPtH"};function y(){return r.createElement(m,{className:g.skipToContent})}var w=n(20624),S=n(10);function x(e){let{width:t=21,height:n=21,color:i="currentColor",strokeWidth:a=1.2,className:o,...c}=e;return r.createElement("svg",(0,s.Z)({viewBox:"0 0 15 15",width:t,height:n},c),r.createElement("g",{stroke:i,strokeWidth:a},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const k={closeButton:"closeButton_J5rP"};function E(e){return r.createElement("button",(0,s.Z)({type:"button","aria-label":(0,l.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,i.Z)("clean-btn close",k.closeButton,e.className)}),r.createElement(x,{width:14,height:14,strokeWidth:3.1}))}const _={content:"content_bSb_"};function C(e){const{announcementBar:t}=(0,w.L)(),{content:n}=t;return r.createElement("div",(0,s.Z)({},e,{className:(0,i.Z)(_.content,e.className),dangerouslySetInnerHTML:{__html:n}}))}const T={announcementBar:"announcementBar_zJRd",announcementBarPlaceholder:"announcementBarPlaceholder_NpUd",announcementBarClose:"announcementBarClose_Jjdj",announcementBarContent:"announcementBarContent_t7IR"};function I(){const{announcementBar:e}=(0,w.L)(),{isActive:t,close:n}=(0,S.nT)();if(!t)return null;const{backgroundColor:i,textColor:a,isCloseable:o}=e;return r.createElement("div",{className:T.announcementBar,style:{backgroundColor:i,color:a},role:"banner"},o&&r.createElement("div",{className:T.announcementBarPlaceholder}),r.createElement(C,{className:T.announcementBarContent}),o&&r.createElement(E,{onClick:n,className:T.announcementBarClose}))}var A=n(85536),N=n(83457);var P=n(41763),L=n(63471);const R=r.createContext(null);function O(e){let{children:t}=e;const n=function(){const e=(0,A.e)(),t=(0,L.HY)(),[n,i]=(0,r.useState)(!1),a=null!==t.component,o=(0,P.D9)(a);return(0,r.useEffect)((()=>{a&&!o&&i(!0)}),[a,o]),(0,r.useEffect)((()=>{a?e.shown||i(!0):i(!1)}),[e.shown,a]),(0,r.useMemo)((()=>[n,i]),[n])}();return r.createElement(R.Provider,{value:n},t)}function M(e){if(e.component){const t=e.component;return r.createElement(t,e.props)}}function D(){const e=(0,r.useContext)(R);if(!e)throw new P.i6("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,i=(0,r.useCallback)((()=>n(!1)),[n]),a=(0,L.HY)();return(0,r.useMemo)((()=>({shown:t,hide:i,content:M(a)})),[i,a,t])}function F(e){let{header:t,primaryMenu:n,secondaryMenu:a}=e;const{shown:o}=D();return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,i.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":o})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},a)))}var B=n(55421),U=n(76457);function z(e){return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function j(e){return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}const $={toggle:"toggle_ki11",toggleButton:"toggleButton_MMFG",darkToggleIcon:"darkToggleIcon_U96C",lightToggleIcon:"lightToggleIcon_lgto",toggleButtonDisabled:"toggleButtonDisabled_Uw7m"};function H(e){let{className:t,buttonClassName:n,value:a,onChange:o}=e;const s=(0,U.Z)(),c=(0,l.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===a?(0,l.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,l.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,i.Z)($.toggle,t)},r.createElement("button",{className:(0,i.Z)("clean-btn",$.toggleButton,!s&&$.toggleButtonDisabled,n),type:"button",onClick:()=>o("dark"===a?"light":"dark"),disabled:!s,title:c,"aria-label":c,"aria-live":"polite"},r.createElement(z,{className:(0,i.Z)($.toggleIcon,$.lightToggleIcon)}),r.createElement(j,{className:(0,i.Z)($.toggleIcon,$.darkToggleIcon)})))}const q=r.memo(H),V={darkNavbarColorModeToggle:"darkNavbarColorModeToggle_m8pZ"};function Z(e){let{className:t}=e;const n=(0,w.L)().navbar.style,i=(0,w.L)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,B.I)();return i?null:r.createElement(q,{className:t,buttonClassName:"dark"===n?V.darkNavbarColorModeToggle:void 0,value:a,onChange:o})}var W=n(10898);function G(){return r.createElement(W.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function K(){const e=(0,A.e)();return r.createElement("button",{type:"button","aria-label":(0,l.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},r.createElement(x,{color:"var(--ifm-color-emphasis-600)"}))}function X(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(G,null),r.createElement(Z,{className:"margin-right--md"}),r.createElement(K,null))}var Y=n(81884),Q=n(98948),J=n(45626),ee=n(61503),te=n(6125);function ne(e){let{activeBasePath:t,activeBaseRegex:n,to:i,href:a,label:o,html:c,isDropdownLink:l,prependBaseUrlToHref:u,...d}=e;const p=(0,Q.Z)(i),f=(0,Q.Z)(t),v=(0,Q.Z)(a,{forcePrependBaseUrl:!0}),m=o&&a&&!(0,J.Z)(a),h=c?{dangerouslySetInnerHTML:{__html:c}}:{children:r.createElement(r.Fragment,null,o,m&&r.createElement(te.Z,l&&{width:12,height:12}))};return a?r.createElement(Y.Z,(0,s.Z)({href:u?v:a},d,h)):r.createElement(Y.Z,(0,s.Z)({to:p,isNavLink:!0},(t||n)&&{isActive:(e,t)=>n?(0,ee.F)(n,t.pathname):t.pathname.startsWith(f)},d,h))}function re(e){let{className:t,isDropdownItem:n=!1,...a}=e;const o=r.createElement(ne,(0,s.Z)({className:(0,i.Z)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n},a));return n?r.createElement("li",null,o):o}function ie(e){let{className:t,isDropdownItem:n,...a}=e;return r.createElement("li",{className:"menu__list-item"},r.createElement(ne,(0,s.Z)({className:(0,i.Z)("menu__link",t)},a)))}function ae(e){let{mobile:t=!1,position:n,...i}=e;const a=t?ie:re;return r.createElement(a,(0,s.Z)({},i,{activeClassName:i.activeClassName??(t?"menu__link--active":"navbar__link--active")}))}var oe=n(80376),se=n(8862),ce=n(50353);function le(e,t){return e.some((e=>function(e,t){return!!(0,se.Mg)(e.to,t)||!!(0,ee.F)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function ue(e){let{items:t,position:n,className:a,onClick:o,...c}=e;const l=(0,r.useRef)(null),[u,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{l.current&&!l.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[l]),r.createElement("div",{ref:l,className:(0,i.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":u})},r.createElement(ne,(0,s.Z)({"aria-haspopup":"true","aria-expanded":u,role:"button",href:c.to?void 0:"#",className:(0,i.Z)("navbar__link",a)},c,{onClick:c.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!u))}}),c.children??c.label),r.createElement("ul",{className:"dropdown__menu"},t.map(((e,t)=>r.createElement(He,(0,s.Z)({isDropdownItem:!0,activeClassName:"dropdown__link--active"},e,{key:t}))))))}function de(e){let{items:t,className:n,position:a,onClick:o,...l}=e;const u=function(){const{siteConfig:{baseUrl:e}}=(0,ce.Z)(),{pathname:t}=(0,c.TH)();return t.replace(e,"/")}(),d=le(t,u),{collapsed:p,toggleCollapsed:f,setCollapsed:v}=(0,oe.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&v(!d)}),[u,d,v]),r.createElement("li",{className:(0,i.Z)("menu__list-item",{"menu__list-item--collapsed":p})},r.createElement(ne,(0,s.Z)({role:"button",className:(0,i.Z)("menu__link menu__link--sublist menu__link--sublist-caret",n)},l,{onClick:e=>{e.preventDefault(),f()}}),l.children??l.label),r.createElement(oe.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:p},t.map(((e,t)=>r.createElement(He,(0,s.Z)({mobile:!0,isDropdownItem:!0,onClick:o,activeClassName:"menu__link--active"},e,{key:t}))))))}function pe(e){let{mobile:t=!1,...n}=e;const i=t?de:ue;return r.createElement(i,n)}var fe=n(43714);function ve(e){let{width:t=20,height:n=20,...i}=e;return r.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0},i),r.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}const me="iconLanguage_kvP7";function he(){return r.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},r.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}var be=n(56573),ge=["translations"];function ye(){return ye=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(this,arguments)}function we(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(c){s=!0,i=c}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Se(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xe(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ke="Ctrl";var Ee=r.forwardRef((function(e,t){var n=e.translations,i=void 0===n?{}:n,a=xe(e,ge),o=i.buttonText,s=void 0===o?"Search":o,c=i.buttonAriaLabel,l=void 0===c?"Search":c,u=we((0,r.useState)(null),2),d=u[0],p=u[1];return(0,r.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?p("\u2318"):p(ke))}),[]),r.createElement("button",ye({type:"button",className:"DocSearch DocSearch-Button","aria-label":l},a,{ref:t}),r.createElement("span",{className:"DocSearch-Button-Container"},r.createElement(be.W,null),r.createElement("span",{className:"DocSearch-Button-Placeholder"},s)),r.createElement("span",{className:"DocSearch-Button-Keys"},null!==d&&r.createElement(r.Fragment,null,r.createElement("kbd",{className:"DocSearch-Button-Key"},d===ke?r.createElement(he,null):d),r.createElement("kbd",{className:"DocSearch-Button-Key"},"K"))))})),_e=n(7092),Ce=n(53584),Te=n(42473),Ie=n(13149);var Ae=n(31542);const Ne={button:{buttonText:(0,l.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,l.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,l.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,l.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,l.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,l.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,l.I)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,l.I)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,l.I)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,l.I)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,l.I)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,l.I)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,l.I)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,l.I)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,l.I)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,l.I)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,l.I)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,l.I)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,l.I)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Pe=null;function Le(e){let{hit:t,children:n}=e;return r.createElement(Y.Z,{to:t.url},n)}function Re(e){let{state:t,onClose:n}=e;const i=(0,Ce.M)();return r.createElement(Y.Z,{to:i(t.query),onClick:n},r.createElement(l.Z,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits}},"See all {count} results"))}function Oe(e){let{contextualSearch:t,externalUrlRegex:i,...a}=e;const{siteMetadata:o}=(0,ce.Z)(),l=(0,Te.l)(),u=function(){const{locale:e,tags:t}=(0,Ie._q)();return[`language:${e}`,t.map((e=>`docusaurus_tag:${e}`))]}(),d=a.searchParameters?.facetFilters??[],p=t?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(u,d):d,f={...a.searchParameters,facetFilters:p},v=(0,c.k6)(),m=(0,r.useRef)(null),h=(0,r.useRef)(null),[b,g]=(0,r.useState)(!1),[y,w]=(0,r.useState)(void 0),S=(0,r.useCallback)((()=>Pe?Promise.resolve():Promise.all([n.e(3041).then(n.bind(n,93041)),Promise.all([n.e(532),n.e(9127)]).then(n.bind(n,89127)),Promise.all([n.e(532),n.e(4670)]).then(n.bind(n,34670))]).then((e=>{let[{DocSearchModal:t}]=e;Pe=t}))),[]),x=(0,r.useCallback)((()=>{S().then((()=>{m.current=document.createElement("div"),document.body.insertBefore(m.current,document.body.firstChild),g(!0)}))}),[S,g]),k=(0,r.useCallback)((()=>{g(!1),m.current?.remove()}),[g]),E=(0,r.useCallback)((e=>{S().then((()=>{g(!0),w(e.key)}))}),[S,g,w]),_=(0,r.useRef)({navigate(e){let{itemUrl:t}=e;(0,ee.F)(i,t)?window.location.href=t:v.push(t)}}).current,C=(0,r.useRef)((e=>a.transformItems?a.transformItems(e):e.map((e=>({...e,url:l(e.url)}))))).current,T=(0,r.useMemo)((()=>e=>r.createElement(Re,(0,s.Z)({},e,{onClose:k}))),[k]),I=(0,r.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",o.docusaurusVersion),e)),[o.docusaurusVersion]);return function(e){var t=e.isOpen,n=e.onOpen,i=e.onClose,a=e.onInput,o=e.searchButtonRef;r.useEffect((function(){function e(e){var r;(27===e.keyCode&&t||"k"===(null===(r=e.key)||void 0===r?void 0:r.toLowerCase())&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?i():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),o&&o.current===document.activeElement&&a&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&a(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,i,a,o])}({isOpen:b,onOpen:x,onClose:k,onInput:E,searchButtonRef:h}),r.createElement(r.Fragment,null,r.createElement(_e.Z,null,r.createElement("link",{rel:"preconnect",href:`https://${a.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})),r.createElement(Ee,{onTouchStart:S,onFocus:S,onMouseOver:S,onClick:x,ref:h,translations:Ne.button}),b&&Pe&&m.current&&(0,Ae.createPortal)(r.createElement(Pe,(0,s.Z)({onClose:k,initialScrollY:window.scrollY,initialQuery:y,navigator:_,transformItems:C,hitComponent:Le,transformSearchClient:I},a.searchPagePath&&{resultsFooterComponent:T},a,{searchParameters:f,placeholder:Ne.placeholder,translations:Ne.modal})),m.current))}function Me(){const{siteConfig:e}=(0,ce.Z)();return r.createElement(Oe,e.themeConfig.algolia)}const De={searchBox:"searchBox_WqAV"};function Fe(e){let{children:t,className:n}=e;return r.createElement("div",{className:(0,i.Z)(n,De.searchBox)},t)}var Be=n(62935),Ue=n(45161);var ze=n(24453);const je=e=>e.docs.find((t=>t.id===e.mainDocId));const $e={default:ae,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:i,...a}=e;const{i18n:{currentLocale:o,locales:u,localeConfigs:d}}=(0,ce.Z)(),p=(0,fe.l)(),{search:f,hash:v}=(0,c.TH)(),m=[...n,...u.map((e=>{const n=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${f}${v}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===o?t?"menu__link--active":"dropdown__link--active":""}})),...i],h=t?(0,l.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[o].label;return r.createElement(pe,(0,s.Z)({},a,{mobile:t,label:r.createElement(r.Fragment,null,r.createElement(ve,{className:me}),h),items:m}))},search:function(e){let{mobile:t,className:n}=e;return t?null:r.createElement(Fe,{className:n},r.createElement(Me,null))},dropdown:pe,html:function(e){let{value:t,className:n,mobile:a=!1,isDropdownItem:o=!1}=e;const s=o?"li":"div";return r.createElement(s,{className:(0,i.Z)({navbar__item:!a&&!o,"menu__list-item":a},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:i,...a}=e;const{activeDoc:o}=(0,Be.Iw)(i),c=(0,Ue.vY)(t,i);return null===c?null:r.createElement(ae,(0,s.Z)({exact:!0},a,{isActive:()=>o?.path===c.path||!!o?.sidebar&&o.sidebar===c.sidebar,label:n??c.id,to:c.path}))},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:i,...a}=e;const{activeDoc:o}=(0,Be.Iw)(i),c=(0,Ue.oz)(t,i).link;if(!c)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return r.createElement(ae,(0,s.Z)({exact:!0},a,{isActive:()=>o?.sidebar===t,label:n??c.label,to:c.path}))},docsVersion:function(e){let{label:t,to:n,docsPluginId:i,...a}=e;const o=(0,Ue.lO)(i)[0],c=t??o.label,l=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(o).path;return r.createElement(ae,(0,s.Z)({},a,{label:c,to:l}))},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:i,dropdownItemsBefore:a,dropdownItemsAfter:o,...u}=e;const{search:d,hash:p}=(0,c.TH)(),f=(0,Be.Iw)(n),v=(0,Be.gB)(n),{savePreferredVersionName:m}=(0,ze.J)(n),h=[...a,...v.map((e=>{const t=f.alternateDocVersions[e.name]??je(e);return{label:e.label,to:`${t.path}${d}${p}`,isActive:()=>e===f.activeVersion,onClick:()=>m(e.name)}})),...o],b=(0,Ue.lO)(n)[0],g=t&&h.length>1?(0,l.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):b.label,y=t&&h.length>1?void 0:je(b).path;return h.length<=1?r.createElement(ae,(0,s.Z)({},u,{mobile:t,label:g,to:y,isActive:i?()=>!1:void 0})):r.createElement(pe,(0,s.Z)({},u,{mobile:t,label:g,to:y,items:h,isActive:i?()=>!1:void 0}))}};function He(e){let{type:t,...n}=e;const i=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),a=$e[i];if(!a)throw new Error(`No NavbarItem component found for type "${t}".`);return r.createElement(a,n)}function qe(){const e=(0,A.e)(),t=(0,w.L)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map(((t,n)=>r.createElement(He,(0,s.Z)({mobile:!0},t,{onClick:()=>e.toggle(),key:n})))))}function Ve(e){return r.createElement("button",(0,s.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(l.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function Ze(){const e=0===(0,w.L)().navbar.items.length,t=D();return r.createElement(r.Fragment,null,!e&&r.createElement(Ve,{onClick:()=>t.hide()}),t.content)}function We(){const e=(0,A.e)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?r.createElement(F,{header:r.createElement(X,null),primaryMenu:r.createElement(qe,null),secondaryMenu:r.createElement(Ze,null)}):null}const Ge={navbarHideable:"navbarHideable_hhpl",navbarHidden:"navbarHidden_nmcs"};function Ke(e){return r.createElement("div",(0,s.Z)({role:"presentation"},e,{className:(0,i.Z)("navbar-sidebar__backdrop",e.className)}))}function Xe(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:a}}=(0,w.L)(),o=(0,A.e)(),{navbarRef:s,isNavbarVisible:c}=function(e){const[t,n]=(0,r.useState)(e),i=(0,r.useRef)(!1),a=(0,r.useRef)(0),o=(0,r.useCallback)((e=>{null!==e&&(a.current=e.getBoundingClientRect().height)}),[]);return(0,N.RF)(((t,r)=>{let{scrollY:o}=t;if(!e)return;if(o<a.current)return void n(!0);if(i.current)return void(i.current=!1);const s=r?.scrollY,c=document.documentElement.scrollHeight-a.current,l=window.innerHeight;s&&o>=s?n(!1):o+l<c&&n(!0)})),(0,u.S)((t=>{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return i.current=!0,void n(!1);n(!0)})),{navbarRef:o,isNavbarVisible:t}}(n);return r.createElement("nav",{ref:s,"aria-label":(0,l.I)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,i.Z)("navbar","navbar--fixed-top",n&&[Ge.navbarHideable,!c&&Ge.navbarHidden],{"navbar--dark":"dark"===a,"navbar--primary":"primary"===a,"navbar-sidebar--show":o.shown})},t,r.createElement(Ke,{onClick:o.toggle}),r.createElement(We,null))}var Ye=n(51721);const Qe={errorBoundaryError:"errorBoundaryError_WE6Q"};function Je(e){return r.createElement("button",(0,s.Z)({type:"button"},e),r.createElement(l.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again rendering when the React error boundary captures an error"},"Try again"))}function et(e){let{error:t}=e;const n=(0,Ye.getErrorCausalChain)(t).map((e=>e.message)).join("\n\nCause:\n");return r.createElement("p",{className:Qe.errorBoundaryError},n)}class tt extends r.Component{componentDidCatch(e,t){throw this.props.onError(e,t)}render(){return this.props.children}}const nt="right";function rt(e){let{width:t=30,height:n=30,className:i,...a}=e;return r.createElement("svg",(0,s.Z)({className:i,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true"},a),r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function it(){const{toggle:e,shown:t}=(0,A.e)();return r.createElement("button",{onClick:e,"aria-label":(0,l.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button"},r.createElement(rt,null))}const at={colorModeToggle:"colorModeToggle_Hewu"};function ot(e){let{items:t}=e;return r.createElement(r.Fragment,null,t.map(((e,t)=>r.createElement(tt,{key:t,onError:t=>new Error(`A theme navbar item failed to render.\nPlease double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:\n${JSON.stringify(e,null,2)}`,{cause:t})},r.createElement(He,e)))))}function st(e){let{left:t,right:n}=e;return r.createElement("div",{className:"navbar__inner"},r.createElement("div",{className:"navbar__items"},t),r.createElement("div",{className:"navbar__items navbar__items--right"},n))}function ct(){const e=(0,A.e)(),t=(0,w.L)().navbar.items,[n,i]=function(e){function t(e){return"left"===(e.position??nt)}return[e.filter(t),e.filter((e=>!t(e)))]}(t),a=t.find((e=>"search"===e.type));return r.createElement(st,{left:r.createElement(r.Fragment,null,!e.disabled&&r.createElement(it,null),r.createElement(G,null),r.createElement(ot,{items:n})),right:r.createElement(r.Fragment,null,r.createElement(ot,{items:i}),r.createElement(Z,{className:at.colorModeToggle}),!a&&r.createElement(Fe,null,r.createElement(Me,null)))})}function lt(){return r.createElement(Xe,null,r.createElement(ct,null))}function ut(e){let{item:t}=e;const{to:n,href:i,label:a,prependBaseUrlToHref:o,...c}=t,l=(0,Q.Z)(n),u=(0,Q.Z)(i,{forcePrependBaseUrl:!0});return r.createElement(Y.Z,(0,s.Z)({className:"footer__link-item"},i?{href:o?u:i}:{to:l},c),a,i&&!(0,J.Z)(i)&&r.createElement(te.Z,null))}function dt(e){let{item:t}=e;return t.html?r.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement("li",{key:t.href??t.to,className:"footer__item"},r.createElement(ut,{item:t}))}function pt(e){let{column:t}=e;return r.createElement("div",{className:"col footer__col"},r.createElement("div",{className:"footer__title"},t.title),r.createElement("ul",{className:"footer__items clean-list"},t.items.map(((e,t)=>r.createElement(dt,{key:t,item:e})))))}function ft(e){let{columns:t}=e;return r.createElement("div",{className:"row footer__links"},t.map(((e,t)=>r.createElement(pt,{key:t,column:e}))))}function vt(){return r.createElement("span",{className:"footer__link-separator"},"\xb7")}function mt(e){let{item:t}=e;return t.html?r.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement(ut,{item:t})}function ht(e){let{links:t}=e;return r.createElement("div",{className:"footer__links text--center"},r.createElement("div",{className:"footer__links"},t.map(((e,n)=>r.createElement(r.Fragment,{key:n},r.createElement(mt,{item:e}),t.length!==n+1&&r.createElement(vt,null))))))}function bt(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?r.createElement(ft,{columns:t}):r.createElement(ht,{links:t})}var gt=n(14034);const yt={footerLogoLink:"footerLogoLink_tutC"};function wt(e){let{logo:t}=e;const{withBaseUrl:n}=(0,Q.C)(),a={light:n(t.src),dark:n(t.srcDark??t.src)};return r.createElement(gt.Z,{className:(0,i.Z)("footer__logo",t.className),alt:t.alt,sources:a,width:t.width,height:t.height,style:t.style})}function St(e){let{logo:t}=e;return t.href?r.createElement(Y.Z,{href:t.href,className:yt.footerLogoLink,target:t.target},r.createElement(wt,{logo:t})):r.createElement(wt,{logo:t})}function xt(e){let{copyright:t}=e;return r.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function kt(e){let{style:t,links:n,logo:a,copyright:o}=e;return r.createElement("footer",{className:(0,i.Z)("footer",{"footer--dark":"dark"===t})},r.createElement("div",{className:"container container-fluid"},n,(a||o)&&r.createElement("div",{className:"footer__bottom text--center"},a&&r.createElement("div",{className:"margin-bottom--sm"},a),o)))}function Et(){const{footer:e}=(0,w.L)();if(!e)return null;const{copyright:t,links:n,logo:i,style:a}=e;return r.createElement(kt,{style:a,links:n&&n.length>0&&r.createElement(bt,{links:n}),logo:i&&r.createElement(St,{logo:i}),copyright:t&&r.createElement(xt,{copyright:t})})}const _t=r.memo(Et),Ct=(0,P.Qc)([B.S,S.pl,N.OC,ze.L5,o.VC,function(e){let{children:t}=e;return r.createElement(L.n2,null,r.createElement(A.M,null,r.createElement(O,null,t)))}]);function Tt(e){let{children:t}=e;return r.createElement(Ct,null,t)}function It(e){let{error:t,tryAgain:n}=e;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(l.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("div",{className:"margin-vert--lg"},r.createElement(Je,{onClick:n,className:"button button--primary shadow--lw"})),r.createElement("hr",null),r.createElement("div",{className:"margin-vert--md"},r.createElement(et,{error:t})))))}const At={mainWrapper:"mainWrapper_MB5r"};function Nt(e){const{children:t,noFooter:n,wrapperClassName:s,title:c,description:l}=e;return(0,b.t)(),r.createElement(Tt,null,r.createElement(o.d,{title:c,description:l}),r.createElement(y,null),r.createElement(I,null),r.createElement(lt,null),r.createElement("div",{id:d,className:(0,i.Z)(h.k.wrapper.main,At.mainWrapper,s)},r.createElement(a.Z,{fallback:e=>r.createElement(It,e)},t)),!n&&r.createElement(_t,null))}},10898:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(25773),i=n(27378),a=n(81884),o=n(98948),s=n(50353),c=n(20624),l=n(14034);function u(e){let{logo:t,alt:n,imageClassName:r}=e;const a={light:(0,o.Z)(t.src),dark:(0,o.Z)(t.srcDark||t.src)},s=i.createElement(l.Z,{className:t.className,sources:a,height:t.height,width:t.width,alt:n,style:t.style});return r?i.createElement("div",{className:r},s):s}function d(e){const{siteConfig:{title:t}}=(0,s.Z)(),{navbar:{title:n,logo:l}}=(0,c.L)(),{imageClassName:d,titleClassName:p,...f}=e,v=(0,o.Z)(l?.href||"/"),m=n?"":t,h=l?.alt??m;return i.createElement(a.Z,(0,r.Z)({to:v},f,l?.target&&{target:l.target}),l&&i.createElement(u,{logo:l,alt:h,imageClassName:d}),null!=n&&i.createElement("b",{className:p},n))}},60505:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(27378),i=n(7092);function a(e){let{locale:t,version:n,tag:a}=e;const o=t;return r.createElement(i.Z,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),a&&r.createElement("meta",{name:"docusaurus_tag",content:a}),o&&r.createElement("meta",{name:"docsearch:language",content:o}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),a&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:a}))}},14034:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25773),i=n(27378),a=n(38944),o=n(76457),s=n(55421);const c={themedImage:"themedImage_BQGR","themedImage--light":"themedImage--light_HAxW","themedImage--dark":"themedImage--dark_bGx0"};function l(e){const t=(0,o.Z)(),{colorMode:n}=(0,s.I)(),{sources:l,className:u,alt:d,...p}=e,f=t?"dark"===n?["dark"]:["light"]:["light","dark"];return i.createElement(i.Fragment,null,f.map((e=>i.createElement("img",(0,r.Z)({key:e,src:l[e],alt:d,className:(0,a.Z)(c.themedImage,c[`themedImage--${e}`],u)},p)))))}},80376:(e,t,n)=>{"use strict";n.d(t,{u:()=>c,z:()=>h});var r=n(25773),i=n(27378),a=n(161),o=n(56903);const s="ease-in-out";function c(e){let{initialState:t}=e;const[n,r]=(0,i.useState)(t??!1),a=(0,i.useCallback)((()=>{r((e=>!e))}),[]);return{collapsed:n,setCollapsed:r,toggleCollapsed:a}}const l={display:"none",overflow:"hidden",height:"0px"},u={display:"block",overflow:"visible",height:"auto"};function d(e,t){const n=t?l:u;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function p(e){let{collapsibleRef:t,collapsed:n,animation:r}=e;const a=(0,i.useRef)(!1);(0,i.useEffect)((()=>{const e=t.current;function i(){const t=e.scrollHeight,n=r?.duration??function(e){if((0,o.n)())return 1;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${r?.easing??s}`,height:`${t}px`}}function c(){const t=i();e.style.transition=t.transition,e.style.height=t.height}if(!a.current)return d(e,n),void(a.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(c(),requestAnimationFrame((()=>{e.style.height=l.height,e.style.overflow=l.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{c()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,r])}function f(e){if(!a.Z.canUseDOM)return e?l:u}function v(e){let{as:t="div",collapsed:n,children:r,animation:a,onCollapseTransitionEnd:o,className:s,disableSSRStyle:c}=e;const l=(0,i.useRef)(null);return p({collapsibleRef:l,collapsed:n,animation:a}),i.createElement(t,{ref:l,style:c?void 0:f(n),onTransitionEnd:e=>{"height"===e.propertyName&&(d(l.current,n),o?.(n))},className:s},r)}function m(e){let{collapsed:t,...n}=e;const[a,o]=(0,i.useState)(!t),[s,c]=(0,i.useState)(t);return(0,i.useLayoutEffect)((()=>{t||o(!0)}),[t]),(0,i.useLayoutEffect)((()=>{a&&c(t)}),[a,t]),a?i.createElement(v,(0,r.Z)({},n,{collapsed:s})):null}function h(e){let{lazy:t,...n}=e;const r=t?m:v;return i.createElement(r,n)}},10:(e,t,n)=>{"use strict";n.d(t,{nT:()=>v,pl:()=>f});var r=n(27378),i=n(76457),a=n(71819),o=n(41763),s=n(20624);const c=(0,a.WA)("docusaurus.announcement.dismiss"),l=(0,a.WA)("docusaurus.announcement.id"),u=()=>"true"===c.get(),d=e=>c.set(String(e)),p=r.createContext(null);function f(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,s.L)(),t=(0,i.Z)(),[n,a]=(0,r.useState)((()=>!!t&&u()));(0,r.useEffect)((()=>{a(u())}),[]);const o=(0,r.useCallback)((()=>{d(!0),a(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=l.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;l.set(t),r&&d(!1),!r&&u()||a(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:o})),[e,n,o])}();return r.createElement(p.Provider,{value:n},t)}function v(){const e=(0,r.useContext)(p);if(!e)throw new o.i6("AnnouncementBarProvider");return e}},55421:(e,t,n)=>{"use strict";n.d(t,{I:()=>h,S:()=>m});var r=n(27378),i=n(161),a=n(41763),o=n(71819),s=n(20624);const c=r.createContext(void 0),l="theme",u=(0,o.WA)(l),d={light:"light",dark:"dark"},p=e=>e===d.dark?d.dark:d.light,f=e=>i.Z.canUseDOM?p(document.documentElement.getAttribute("data-theme")):p(e),v=e=>{u.set(p(e))};function m(e){let{children:t}=e;const n=function(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,s.L)(),[i,a]=(0,r.useState)(f(e));(0,r.useEffect)((()=>{t&&u.del()}),[t]);const o=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:i=!0}=r;t?(a(t),i&&v(t)):(a(n?window.matchMedia("(prefers-color-scheme: dark)").matches?d.dark:d.light:e),u.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",p(i))}),[i]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==l)return;const t=u.get();null!==t&&o(p(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,o]);const c=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||c.current?c.current=window.matchMedia("print").matches:o(null)};return e.addListener(r),()=>e.removeListener(r)}),[o,t,n]),(0,r.useMemo)((()=>({colorMode:i,setColorMode:o,get isDarkTheme(){return i===d.dark},setLightTheme(){o(d.light)},setDarkTheme(){o(d.dark)}})),[i,o])}();return r.createElement(c.Provider,{value:n},t)}function h(){const e=(0,r.useContext)(c);if(null==e)throw new a.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},24453:(e,t,n)=>{"use strict";n.d(t,{J:()=>g,L5:()=>h,Oh:()=>y});var r=n(27378),i=n(62935),a=n(45688),o=n(20624),s=n(45161),c=n(41763),l=n(71819);const u=e=>`docs-preferred-version-${e}`,d={save:(e,t,n)=>{(0,l.WA)(u(e),{persistence:t}).set(n)},read:(e,t)=>(0,l.WA)(u(e),{persistence:t}).get(),clear:(e,t)=>{(0,l.WA)(u(e),{persistence:t}).del()}},p=e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}])));const f=r.createContext(null);function v(){const e=(0,i._r)(),t=(0,o.L)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[a,s]=(0,r.useState)((()=>p(n)));(0,r.useEffect)((()=>{s(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function i(e){const t=d.read(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(d.clear(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,i(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[a,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d.save(e,t,n),s((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function m(e){let{children:t}=e;const n=v();return r.createElement(f.Provider,{value:n},t)}function h(e){let{children:t}=e;return s.cE?r.createElement(m,null,t):r.createElement(r.Fragment,null,t)}function b(){const e=(0,r.useContext)(f);if(!e)throw new c.i6("DocsPreferredVersionContextProvider");return e}function g(e){void 0===e&&(e=a.m);const t=(0,i.zh)(e),[n,o]=b(),{preferredVersionName:s}=n[e];return{preferredVersion:t.versions.find((e=>e.name===s))??null,savePreferredVersionName:(0,r.useCallback)((t=>{o.savePreferredVersion(e,t)}),[o,e])}}function y(){const e=(0,i._r)(),[t]=b();function n(n){const r=e[n],{preferredVersionName:i}=t[n];return r.versions.find((e=>e.name===i))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},52095:(e,t,n)=>{"use strict";n.d(t,{V:()=>c,b:()=>s});var r=n(27378),i=n(41763);const a=Symbol("EmptyContext"),o=r.createContext(a);function s(e){let{children:t,name:n,items:i}=e;const a=(0,r.useMemo)((()=>n&&i?{name:n,items:i}:null),[n,i]);return r.createElement(o.Provider,{value:a},t)}function c(){const e=(0,r.useContext)(o);if(e===a)throw new i.i6("DocsSidebarProvider");return e}},85536:(e,t,n)=>{"use strict";n.d(t,{M:()=>d,e:()=>p});var r=n(27378),i=n(63471),a=n(58357),o=n(30654),s=n(20624),c=n(41763);const l=r.createContext(void 0);function u(){const e=function(){const e=(0,i.HY)(),{items:t}=(0,s.L)().navbar;return 0===t.length&&!e.component}(),t=(0,a.i)(),n=!e&&"mobile"===t,[c,l]=(0,r.useState)(!1);(0,o.Rb)((()=>{if(c)return l(!1),!1}));const u=(0,r.useCallback)((()=>{l((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&l(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:c})),[e,n,u,c])}function d(e){let{children:t}=e;const n=u();return r.createElement(l.Provider,{value:n},t)}function p(){const e=r.useContext(l);if(void 0===e)throw new c.i6("NavbarMobileSidebarProvider");return e}},63471:(e,t,n)=>{"use strict";n.d(t,{HY:()=>s,Zo:()=>c,n2:()=>o});var r=n(27378),i=n(41763);const a=r.createContext(null);function o(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return r.createElement(a.Provider,{value:n},t)}function s(){const e=(0,r.useContext)(a);if(!e)throw new i.i6("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:t,props:n}=e;const o=(0,r.useContext)(a);if(!o)throw new i.i6("NavbarSecondaryMenuContentProvider");const[,s]=o,c=(0,i.Ql)(n);return(0,r.useEffect)((()=>{s({component:t,props:c})}),[s,t,c]),(0,r.useEffect)((()=>()=>s({component:null,props:null})),[s]),null}},70174:(e,t,n)=>{"use strict";n.d(t,{h:()=>i,t:()=>a});var r=n(27378);const i="navigation-with-keyboard";function a(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(i),"mousedown"===e.type&&document.body.classList.remove(i)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(i),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},53584:(e,t,n)=>{"use strict";n.d(t,{K:()=>s,M:()=>c});var r=n(27378),i=n(50353),a=n(30654);const o="q";function s(){return(0,a.Nc)(o)}function c(){const{siteConfig:{baseUrl:e,themeConfig:t}}=(0,i.Z)(),{algolia:{searchPagePath:n}}=t;return(0,r.useCallback)((t=>`${e}${n}?${o}=${encodeURIComponent(t)}`),[e,n])}},58357:(e,t,n)=>{"use strict";n.d(t,{i:()=>l});var r=n(27378),i=n(161);const a={desktop:"desktop",mobile:"mobile",ssr:"ssr"},o=996;function s(){return i.Z.canUseDOM?window.innerWidth>o?a.desktop:a.mobile:a.ssr}const c=!1;function l(){const[e,t]=(0,r.useState)((()=>c?"ssr":s()));return(0,r.useEffect)((()=>{function e(){t(s())}const n=c?window.setTimeout(e,1e3):void 0;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(n)}}),[]),e}},75484:(e,t,n)=>{"use strict";n.d(t,{k:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},56903:(e,t,n)=>{"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{n:()=>r})},45161:(e,t,n)=>{"use strict";n.d(t,{Wl:()=>p,_F:()=>m,cE:()=>d,hI:()=>S,lO:()=>g,oz:()=>y,s1:()=>b,vY:()=>w});var r=n(27378),i=n(3620),a=n(95473),o=n(62935),s=n(24453),c=n(52095),l=n(70784),u=n(8862);const d=!!o._r;function p(e){if(e.href)return e.href;for(const t of e.items){if("link"===t.type)return t.href;if("category"===t.type){const e=p(t);if(e)return e}}}const f=(e,t)=>void 0!==e&&(0,u.Mg)(e,t),v=(e,t)=>e.some((e=>m(e,t)));function m(e,t){return"link"===e.type?f(e.href,t):"category"===e.type&&(f(e.href,t)||v(e.items,t))}function h(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const i=[];return function e(t){for(const a of t)if("category"===a.type&&((0,u.Mg)(a.href,n)||e(a.items))||"link"===a.type&&(0,u.Mg)(a.href,n)){return r&&"category"!==a.type||i.unshift(a),!0}return!1}(t),i}function b(){const e=(0,c.V)(),{pathname:t}=(0,i.TH)(),n=(0,o.gA)()?.pluginData.breadcrumbs;return!1!==n&&e?h({sidebarItems:e.items,pathname:t}):null}function g(e){const{activeVersion:t}=(0,o.Iw)(e),{preferredVersion:n}=(0,s.J)(e),i=(0,o.yW)(e);return(0,r.useMemo)((()=>(0,l.j)([t,n,i].filter(Boolean))),[t,n,i])}function y(e,t){const n=g(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable sidebar ids are:\n- ${t.map((e=>e[0])).join("\n- ")}`);return r[1]}),[e,n])}function w(e,t){const n=g(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`Couldn't find any doc with id "${e}" in version${n.length>1?"s":""} "${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${(0,l.j)(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function S(e){let{route:t,versionMetadata:n}=e;const r=(0,i.TH)(),o=t.routes,s=o.find((e=>(0,i.LX)(r.pathname,e)));if(!s)return null;const c=s.sidebar,l=c?n.docsSidebars[c]:void 0;return{docElement:(0,a.H)(o),sidebarName:c,sidebarItems:l}}},99162:(e,t,n)=>{"use strict";n.d(t,{p:()=>i});var r=n(50353);function i(e){const{siteConfig:t}=(0,r.Z)(),{title:n,titleDelimiter:i}=t;return e?.trim().length?`${e.trim()} ${i} ${n}`:n}},30654:(e,t,n)=>{"use strict";n.d(t,{Nc:()=>l,Rb:()=>s,_X:()=>c});var r=n(27378),i=n(3620),a=n(70644),o=n(41763);function s(e){!function(e){const t=(0,i.k6)(),n=(0,o.zX)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}function c(e){return function(e){const t=(0,i.k6)();return(0,a.useSyncExternalStore)(t.listen,(()=>e(t)),(()=>e(t)))}((t=>null===e?null:new URLSearchParams(t.location.search).get(e)))}function l(e){const t=c(e)??"",n=function(){const e=(0,i.k6)();return(0,r.useCallback)(((t,n,r)=>{const i=new URLSearchParams(e.location.search);n?i.set(t,n):i.delete(t),(r?.push?e.push:e.replace)({search:i.toString()})}),[e])}();return[t,(0,r.useCallback)(((t,r)=>{n(e,t,r)}),[n,e])]}},70784:(e,t,n)=>{"use strict";function r(e,t){return void 0===t&&(t=(e,t)=>e===t),e.filter(((n,r)=>e.findIndex((e=>t(e,n)))!==r))}function i(e){return Array.from(new Set(e))}n.d(t,{j:()=>i,l:()=>r})},1123:(e,t,n)=>{"use strict";n.d(t,{FG:()=>p,d:()=>u,VC:()=>f});var r=n(27378),i=n(38944),a=n(7092),o=n(66881);function s(){const e=r.useContext(o._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var c=n(98948),l=n(99162);function u(e){let{title:t,description:n,keywords:i,image:o,children:s}=e;const u=(0,l.p)(t),{withBaseUrl:d}=(0,c.C)(),p=o?d(o,{absolute:!0}):void 0;return r.createElement(a.Z,null,t&&r.createElement("title",null,u),t&&r.createElement("meta",{property:"og:title",content:u}),n&&r.createElement("meta",{name:"description",content:n}),n&&r.createElement("meta",{property:"og:description",content:n}),i&&r.createElement("meta",{name:"keywords",content:Array.isArray(i)?i.join(","):i}),p&&r.createElement("meta",{property:"og:image",content:p}),p&&r.createElement("meta",{name:"twitter:image",content:p}),s)}const d=r.createContext(void 0);function p(e){let{className:t,children:n}=e;const o=r.useContext(d),s=(0,i.Z)(o,t);return r.createElement(d.Provider,{value:s},r.createElement(a.Z,null,r.createElement("html",{className:s})),n)}function f(e){let{children:t}=e;const n=s(),a=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const o=`plugin-id-${n.plugin.id}`;return r.createElement(p,{className:(0,i.Z)(a,o)},t)}},41763:(e,t,n)=>{"use strict";n.d(t,{D9:()=>o,Qc:()=>l,Ql:()=>c,i6:()=>s,zX:()=>a});var r=n(27378);const i=n(161).Z.canUseDOM?r.useLayoutEffect:r.useEffect;function a(e){const t=(0,r.useRef)(e);return i((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function o(e){const t=(0,r.useRef)();return i((()=>{t.current=e})),t.current}class s extends Error{constructor(e,t){super(),this.name="ReactContextError",this.message=`Hook ${this.stack?.split("\n")[1]?.match(/at (?:\w+\.)?(?<name>\w+)/)?.groups.name??""} is called outside the <${e}>. ${t??""}`}}function c(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function l(e){return t=>{let{children:n}=t;return r.createElement(r.Fragment,null,e.reduceRight(((e,t)=>r.createElement(t,null,e)),n))}}},61503:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{F:()=>r})},8862:(e,t,n)=>{"use strict";n.d(t,{Mg:()=>o,Ns:()=>s});var r=n(27378),i=n(76623),a=n(50353);function o(e,t){const n=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return n(e)===n(t)}function s(){const{baseUrl:e}=(0,a.Z)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function i(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(i).flatMap((e=>e.routes??[])))}(n)}({routes:i.Z,baseUrl:e})),[e])}},83457:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>f,OC:()=>c,RF:()=>d,o5:()=>p});var r=n(27378),i=n(161),a=n(76457),o=n(41763);const s=r.createContext(void 0);function c(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return r.createElement(s.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(s);if(null==e)throw new o.i6("ScrollControllerProvider");return e}const u=()=>i.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function d(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=l(),i=(0,r.useRef)(u()),a=(0,o.zX)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=u();a(e,i.current),i.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[a,n,...t])}function p(){const e=l(),t=function(){const e=(0,r.useRef)({elem:null,top:0}),t=(0,r.useCallback)((t=>{e.current={elem:t,top:t.getBoundingClientRect().top}}),[]),n=(0,r.useCallback)((()=>{const{current:{elem:t,top:n}}=e;if(!t)return{restored:!1};const r=t.getBoundingClientRect().top-n;return r&&window.scrollBy({left:0,top:r}),e.current={elem:null,top:0},{restored:0!==r}}),[]);return(0,r.useMemo)((()=>({save:t,restore:n})),[n,t])}(),n=(0,r.useRef)(void 0),i=(0,r.useCallback)((r=>{t.save(r),e.disableScrollEvents(),n.current=()=>{const{restored:r}=t.restore();if(n.current=void 0,r){const t=()=>{e.enableScrollEvents(),window.removeEventListener("scroll",t)};window.addEventListener("scroll",t)}else e.enableScrollEvents()}}),[e,t]);return(0,r.useLayoutEffect)((()=>{queueMicrotask((()=>n.current?.()))})),{blockElementScrollPositionUntilNextRender:i}}function f(){const e=(0,r.useRef)(null),t=(0,a.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const i=document.documentElement.scrollTop;(n&&i>e||!n&&i<e)&&(t=requestAnimationFrame(r),window.scrollTo(0,Math.floor(.85*(i-e))+e))}(),()=>t&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>e.current?.()}}},13149:(e,t,n)=>{"use strict";n.d(t,{HX:()=>o,_q:()=>c,os:()=>s});var r=n(62935),i=n(50353),a=n(24453);const o="default";function s(e,t){return`docs-${e}-${t}`}function c(){const{i18n:e}=(0,i.Z)(),t=(0,r._r)(),n=(0,r.WS)(),c=(0,a.Oh)();const l=[o,...Object.keys(t).map((function(e){const r=n?.activePlugin.pluginId===e?n.activeVersion:void 0,i=c[e],a=t[e].versions.find((e=>e.isLast));return s(e,(r??i??a).name)}))];return{locale:e.currentLocale,tags:l}}},71819:(e,t,n)=>{"use strict";n.d(t,{Nk:()=>d,WA:()=>u});var r=n(27378),i=n(70644);const a="localStorage";function o(e){let{key:t,oldValue:n,newValue:r,storage:i}=e;if(n===r)return;const a=document.createEvent("StorageEvent");a.initStorageEvent("storage",!1,!1,t,n,r,window.location.href,i),window.dispatchEvent(a)}function s(e){if(void 0===e&&(e=a),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,c||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),c=!0),null}var t}let c=!1;const l={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function u(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t,listen:t}}(e);const n=s(t?.persistence);return null===n?l:{get:()=>{try{return n.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{const r=n.getItem(e);n.setItem(e,t),o({key:e,oldValue:r,newValue:t,storage:n})}catch(r){console.error(`Docusaurus storage error, can't set ${e}=${t}`,r)}},del:()=>{try{const t=n.getItem(e);n.removeItem(e),o({key:e,oldValue:t,newValue:null,storage:n})}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}},listen:t=>{try{const r=r=>{r.storageArea===n&&r.key===e&&t(r)};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)}catch(r){return console.error(`Docusaurus storage error, can't listen for changes of key=${e}`,r),()=>{}}}}}function d(e,t){const n=(0,r.useRef)((()=>null===e?l:u(e,t))).current(),a=(0,r.useCallback)((e=>"undefined"==typeof window?()=>{}:n.listen(e)),[n]);return[(0,i.useSyncExternalStore)(a,(()=>"undefined"==typeof window?null:n.get()),(()=>null)),n]}},43714:(e,t,n)=>{"use strict";n.d(t,{l:()=>a});var r=n(50353),i=n(3620);function a(){const{siteConfig:{baseUrl:e,url:t},i18n:{defaultLocale:n,currentLocale:a}}=(0,r.Z)(),{pathname:o}=(0,i.TH)(),s=a===n?e:e.replace(`/${a}/`,"/"),c=o.replace(e,"");return{createUrl:function(e){let{locale:r,fullyQualified:i}=e;return`${i?t:""}${function(e){return e===n?`${s}`:`${s}${e}/`}(r)}${c}`}}}},24993:(e,t,n)=>{"use strict";n.d(t,{S:()=>o});var r=n(27378),i=n(3620),a=n(41763);function o(e){const t=(0,i.TH)(),n=(0,a.D9)(t),o=(0,a.zX)(e);(0,r.useEffect)((()=>{n&&t!==n&&o({location:t,previousLocation:n})}),[o,t,n])}},20624:(e,t,n)=>{"use strict";n.d(t,{L:()=>i});var r=n(50353);function i(){return(0,r.Z)().siteConfig.themeConfig}},80632:(e,t,n)=>{"use strict";n.d(t,{L:()=>i});var r=n(50353);function i(){const{siteConfig:{themeConfig:e}}=(0,r.Z)();return e}},42473:(e,t,n)=>{"use strict";n.d(t,{l:()=>s});var r=n(27378),i=n(61503),a=n(98948),o=n(80632);function s(){const{withBaseUrl:e}=(0,a.C)(),{algolia:{externalUrlRegex:t,replaceSearchResultPathname:n}}=(0,o.L)();return(0,r.useCallback)((r=>{const a=new URL(r);if((0,i.F)(t,a.href))return r;const o=`${a.pathname+a.hash}`;return e(function(e,t){return t?e.replaceAll(new RegExp(t.from,"g"),t.to):e}(o,n))}),[e,t,n])}},42520:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[i]=e.split(/[#?]/),a="/"===i||i===r?i:(o=i,n?function(e){return e.endsWith("/")?e:`${e}/`}(o):function(e){return e.endsWith("/")?e.slice(0,-1):e}(o));var o;return e.replace(i,a)}},86102:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=void 0,t.getErrorCausalChain=function e(t){return t.cause?[t,...e(t.cause)]:[t]}},51721:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="__blog-post-container";var i=n(42520);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(i).default}});var a=n(86102);Object.defineProperty(t,"getErrorCausalChain",{enumerable:!0,get:function(){return a.getErrorCausalChain}})},71720:(e,t,n)=>{"use strict";var r;n.r(t),n.d(t,{default:()=>mv});var i="undefined",a="constructor",o="prototype",s="function",c="_dynInstFuncs",l="_isDynProxy",u="_dynClass",d="_dynInstChk",p=d,f="_dfOpts",v="_unknown_",m="__proto__",h="_dyn"+m,b="__dynProto$Gbl",g="_dynInstProto",y="useBaseInst",w="setInstFuncs",S=Object,x=S.getPrototypeOf,k=S.getOwnPropertyNames;var E,_=(typeof globalThis!==i&&(E=globalThis),E||typeof self===i||(E=self),E||typeof window===i||(E=window),E||typeof n.g===i||(E=n.g),E||{}),C=_[b]||(_[b]={o:(r={},r[w]=!0,r[y]=!0,r),n:1e3});function T(e,t){return e&&S[o].hasOwnProperty.call(e,t)}function I(e){return e&&(e===S[o]||e===Array[o])}function A(e){return I(e)||e===Function[o]}function N(e){var t;if(e){if(x)return x(e);var n=e[m]||e[o]||(e[a]?e[a][o]:null);t=e[h]||n,T(e,h)||(delete e[g],t=e[h]=e[g]||e[h],e[g]=n)}return t}function P(e,t){var n=[];if(k)n=k(e);else for(var r in e)"string"==typeof r&&T(e,r)&&n.push(r);if(n&&n.length>0)for(var i=0;i<n.length;i++)t(n[i])}function L(e,t,n){return t!==a&&typeof e[t]===s&&(n||T(e,t))}function R(e){throw new TypeError("DynamicProto: "+e)}function O(e,t){for(var n=e.length-1;n>=0;n--)if(e[n]===t)return!0;return!1}function M(e,t,n,r,i){function a(e,t){var n=function(){var r=function(e,t,n,r){var i=null;if(e&&T(n,u)){var a=e[c]||{};if((i=(a[n[u]]||{})[t])||R("Missing ["+t+"] "+s),!i[d]&&!1!==a[p]){for(var o=!T(e,t),l=N(e),f=[];o&&l&&!A(l)&&!O(f,l);){var v=l[t];if(v){o=v===r;break}f.push(l),l=N(l)}try{o&&(e[t]=i),i[d]=1}catch(m){a[p]=!1}}}return i}(this,t,e,n)||function(e,t,n){var r=t[e];return r===n&&(r=N(t)[e]),typeof r!==s&&R("["+e+"] is not a "+s),r}(t,e,n);return r.apply(this,arguments)};return n[l]=1,n}if(!I(e)){var o=n[c]=n[c]||{},f=o[t]=o[t]||{};!1!==o[p]&&(o[p]=!!i),P(n,(function(t){L(n,t,!1)&&n[t]!==r[t]&&(f[t]=n[t],delete n[t],(!T(e,t)||e[t]&&!e[t][l])&&(e[t]=a(e,t)))}))}}function D(e,t){return T(e,o)?e.name||t||v:((e||{})[a]||{}).name||t||v}function F(e,t,n,r){T(e,o)||R("theClass is an invalid class definition.");var i=e[o];(function(e,t){if(x){for(var n=[],r=N(t);r&&!A(r)&&!O(n,r);){if(r===e)return!0;n.push(r),r=N(r)}return!1}return!0})(i,t)||R("["+D(e)+"] not in hierarchy of ["+D(t)+"]");var a=null;T(i,u)?a=i[u]:(a="_dynCls$"+D(e,"_")+"$"+C.n,C.n++,i[u]=a);var s=F[f],d=!!s[y];d&&r&&void 0!==r[y]&&(d=!!r[y]);var v=function(e){var t={};return P(e,(function(n){!t[n]&&L(e,n,!1)&&(t[n]=e[n])})),t}(t),m=function(e,t,n,r){function i(e,t,n){var i=t[n];if(i[l]&&r){var a=e[c]||{};!1!==a[p]&&(i=(a[t[u]]||{})[n]||i)}return function(){return i.apply(e,arguments)}}var a={};P(n,(function(e){a[e]=i(t,n,e)}));for(var o=N(e),s=[];o&&!A(o)&&!O(s,o);)P(o,(function(e){!a[e]&&L(o,e,!x)&&(a[e]=i(t,o,e))})),s.push(o),o=N(o);return a}(i,t,v,d);n(t,m);var h=!!x&&!!s[w];h&&r&&(h=!!r[w]),M(i,a,t,v,!1!==h)}F[f]=C.o;var B="function",U="object",z="undefined",j="prototype",$="hasOwnProperty",H=Object,q=H[j],V=H.assign,Z=H.create,W=H.defineProperty,G=q[$],K=null;function X(e){void 0===e&&(e=!0);var t=!1===e?null:K;return t||(typeof globalThis!==z&&(t=globalThis),t||typeof self===z||(t=self),t||typeof window===z||(t=window),t||typeof n.g===z||(t=n.g),K=t),t}function Y(e){throw new TypeError(e)}function Q(e){if(Z)return Z(e);if(null==e)return{};var t=typeof e;function n(){}return t!==U&&t!==B&&Y("Object prototype may only be an Object:"+e),n[j]=e,new n}(X()||{}).Symbol,(X()||{}).Reflect;var J=V||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])q[$].call(t,i)&&(e[i]=t[i]);return e},ee=function(e,t){return ee=H.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t[$](n)&&(e[n]=t[n])},ee(e,t)};function te(e,t){function n(){this.constructor=e}typeof t!==B&&null!==t&&Y("Class extends value "+String(t)+" is not a constructor or null"),ee(e,t),e[j]=null===t?Q(t):(n[j]=t[j],new n)}function ne(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}var re="initialize",ie="name",ae="getNotifyMgr",oe="identifier",se="push",ce="isInitialized",le="config",ue="instrumentationKey",de="logger",pe="length",fe="time",ve="processNext",me="getProcessTelContext",he="addNotificationListener",be="removeNotificationListener",ge="stopPollingInternalLogs",ye="onComplete",we="getPlugin",Se="flush",xe="_extensions",ke="splice",Ee="teardown",_e="messageId",Ce="message",Te="isAsync",Ie="_doTeardown",Ae="update",Ne="getNext",Pe="diagLog",Le="setNextPlugin",Re="createNew",Oe="cookieCfg",Me="indexOf",De="substring",Fe="userAgent",Be="split",Ue="setEnabled",ze="substr",je="nodeType",$e="apply",He="replace",qe="enableDebugExceptions",Ve="logInternalMessage",Ze="toLowerCase",We="call",Ge="type",Ke="handler",Xe="listeners",Ye="isChildEvt",Qe="getCtx",Je="setCtx",et="complete",tt="traceId",nt="spanId",rt="traceFlags",it="version",at="",ot="channels",st="core",ct="createPerfMgr",lt="disabled",ut="extensionConfig",dt="processTelemetry",pt="priority",ft="eventsSent",vt="eventsDiscarded",mt="eventsSendRequest",ht="perfEvent",bt="errorToConsole",gt="warnToConsole",yt="getPerfMgr",wt="toISOString",St="endsWith",xt="startsWith",kt="indexOf",Et="reduce",_t="trim",Ct="toString",Tt="__proto__",It="constructor",At=W,Nt=H.freeze,Pt=(H.seal,H.keys),Lt=String[j],Rt=Lt[_t],Ot=Lt[St],Mt=(Lt[xt],Date[j][wt]),Dt=Array.isArray,Ft=q[Ct],Bt=G[Ct],Ut=Bt[We](H),zt=/-([a-z])/g,jt=/([^\w\d_$])/g,$t=/^(\d+[\w\d_$])/,Ht=Object.getPrototypeOf;function qt(e){if(e){if(Ht)return Ht(e);var t=e[Tt]||e[j]||e[It];if(t)return t}return null}function Vt(e){return void 0===e||typeof e===z}function Zt(e){return null===e||Vt(e)}function Wt(e){return!Zt(e)}function Gt(e,t){return!(!e||!G[We](e,t))}function Kt(e){return!(!e||typeof e!==U)}function Xt(e){return!(!e||typeof e!==B)}function Yt(e){var t=e;return t&&rn(t)&&(t=(t=(t=t[He](zt,(function(e,t){return t.toUpperCase()})))[He](jt,"_"))[He]($t,(function(e,t){return"_"+t}))),t}function Qt(e,t){if(e)for(var n in e)G[We](e,n)&&t[We](e,n,e[n])}function Jt(e,t){var n=!1;return e&&t&&!(n=e===t)&&(n=Ot?e[St](t):function(e,t){var n=!1,r=t?t[pe]:0,i=e?e[pe]:0;if(r&&i&&i>=r&&!(n=e===t)){for(var a=i-1,o=r-1;o>=0;o--){if(e[a]!=t[o])return!1;a--}n=!0}return n}(e,t)),n}function en(e,t){return!(!e||!t)&&-1!==e[Me](t)}var tn=Dt||function(e){return!(!e||"[object Array]"!==Ft[We](e))};function nn(e){return!(!e||"[object Error]"!==Ft[We](e))}function rn(e){return"string"==typeof e}function an(e){return"number"==typeof e}function on(e){return"boolean"==typeof e}function sn(e){var t=!1;if(e&&"object"==typeof e){var n=Ht?Ht(e):qt(e);n?(n[It]&&G[We](n,It)&&(n=n[It]),t=typeof n===B&&Bt[We](n)===Ut):t=!0}return t}function cn(e){if(e)return Mt?e[wt]():function(e){if(e&&e.getUTCFullYear){var t=function(e){var t=String(e);return 1===t[pe]&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}(e)}function ln(e,t,n){var r=e[pe];try{for(var i=0;i<r&&(!(i in e)||-1!==t[We](n||e,e[i],i,e));i++);}catch(a){}}function un(e,t,n){if(e){if(e[kt])return e[kt](t,n);var r=e[pe],i=n||0;try{for(var a=Math.max(i>=0?i:r-Math.abs(i),0);a<r;a++)if(a in e&&e[a]===t)return a}catch(o){}}return-1}function dn(e,t,n){var r;if(e){if(e.map)return e.map(t,n);var i=e[pe],a=n||e;r=new Array(i);try{for(var o=0;o<i;o++)o in e&&(r[o]=t[We](a,e[o],e))}catch(s){}}return r}function pn(e,t,n){var r;if(e){if(e[Et])return e[Et](t,n);var i=e[pe],a=0;if(arguments[pe]>=3)r=arguments[2];else{for(;a<i&&!(a in e);)a++;r=e[a++]}for(;a<i;)a in e&&(r=t(r,e[a],a,e)),a++}return r}function fn(e){return e&&(e=Rt&&e[_t]?e[_t]():e[He]?e[He](/^\s+|(?=\s)\s+$/g,at):e),e}var vn=!{toString:null}.propertyIsEnumerable("toString"),mn=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];function hn(e){var t=typeof e;if(t===B||t===U&&null!==e||Y("objKeys called on non-object"),!vn&&Pt)return Pt(e);var n=[];for(var r in e)e&&G[We](e,r)&&n[se](r);if(vn)for(var i=mn[pe],a=0;a<i;a++)e&&G[We](e,mn[a])&&n[se](mn[a]);return n}function bn(e,t,n,r){if(At)try{var i={enumerable:!0,configurable:!0};return n&&(i.get=n),r&&(i.set=r),At(e,t,i),!0}catch(a){}return!1}function gn(e){return e}function yn(e){return Nt&&Qt(e,(function(e,t){(tn(t)||Kt(t))&&Nt(t)})),wn(e)}var wn=Nt||gn;function Sn(){var e=Date;return e.now?e.now():(new e).getTime()}function xn(e){return nn(e)?e[ie]:at}function kn(e,t,n,r,i){var a=n;return e&&((a=e[t])===n||i&&!i(a)||r&&!r(n)||(a=n,e[t]=a)),a}function En(e,t,n){var r;return e?!(r=e[t])&&Zt(r)&&(r=Vt(n)?{}:n,e[t]=r):r=Vt(n)?{}:n,r}function _n(e,t){return Zt(e)?t:e}function Cn(e){return!!e}function Tn(e){throw new Error(e)}function In(e,t){var n=null,r=null;return Xt(e)?n=e:r=e,function(){var e=arguments;if(n&&(r=n()),r)return r[t][$e](r,e)}}function An(e,t,n,r,i){e&&t&&n&&(!1!==i||Vt(e[t]))&&(e[t]=In(n,r))}function Nn(e,t,n,r){return e&&t&&Kt(e)&&tn(n)&&ln(n,(function(n){rn(n)&&An(e,n,t,n,r)})),e}function Pn(e){return e&&V&&(e=H(V({},e))),e}function Ln(e,t,n,r,i,a){var o=arguments,s=o[0]||{},c=o[pe],l=!1,u=1;for(c>0&&on(s)&&(l=s,s=o[u]||{},u++),Kt(s)||(s={});u<c;u++){var d=o[u],p=tn(d),f=Kt(d);for(var v in d){if(p&&v in d||f&&G[We](d,v)){var m=d[v],h=void 0;if(l&&m&&((h=tn(m))||sn(m))){var b=s[v];h?tn(b)||(b=[]):sn(b)||(b={}),m=Ln(l,b,m)}void 0!==m&&(s[v]=m)}}}return s}var Rn="split",On="length",Mn="toLowerCase",Dn="ingestionendpoint",Fn="toString",Bn="removeItem",Un="name",zn="message",jn="stringify",$n="pathname",Hn="correlationHeaderExcludePatterns",qn="indexOf",Vn="extensionConfig",Zn="exceptions",Wn="parsedStack",Gn="properties",Kn="measurements",Xn="sizeInBytes",Yn="typeName",Qn="severityLevel",Jn="problemGroup",er="isManual",tr="CreateFromInterface",nr="assembly",rr="hasFullStack",ir="level",ar="method",or="fileName",sr="line",cr="duration",lr="receivedResponse",ur="substring",dr="";function pr(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString()[Mn]()}function fr(e){(isNaN(e)||e<0)&&(e=0),e=Math.round(e);var t=dr+e%1e3,n=dr+Math.floor(e/1e3)%60,r=dr+Math.floor(e/6e4)%60,i=dr+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t[On]?"00"+t:2===t[On]?"0"+t:t,n=n[On]<2?"0"+n:n,r=r[On]<2?"0"+r:r,i=i[On]<2?"0"+i:i,(a>0?a+".":dr)+i+":"+r+":"+n+"."+t}function vr(e,t,n,r,i){return!i&&rn(e)&&("Script error."===e||"Script error"===e)}var mr="window",hr="document",br="documentMode",gr="navigator",yr="location",wr="console",Sr="performance",xr="JSON",kr="crypto",Er="msCrypto",_r="msie",Cr="trident/",Tr="XMLHttpRequest",Ir=null,Ar=null,Nr=!1,Pr=null,Lr=null;function Rr(e,t){var n=!1;if(e){try{if(!(n=t in e)){var r=e[j];r&&(n=t in r)}}catch(i){}if(!n)try{n=!Vt((new e)[t])}catch(i){}}return n}function Or(e){var t=X();return t&&t[e]?t[e]:e===mr&&Mr()?window:null}function Mr(){return Boolean(typeof window===U&&window)}function Dr(){return Mr()?window:Or(mr)}function Fr(){return Boolean(typeof document===U&&document)}function Br(){return Fr()?document:Or(hr)}function Ur(){return Boolean(typeof navigator===U&&navigator)}function zr(){return Ur()?navigator:Or(gr)}function jr(){return Boolean(typeof history===U&&history)}function $r(e){if(e&&Nr){var t=Or("__mockLocation");if(t)return t}return typeof location===U&&location?location:Or(yr)}function Hr(){return Or(Sr)}function qr(){return Boolean(typeof JSON===U&&JSON||null!==Or(xr))}function Vr(){return qr()?JSON||Or(xr):null}function Zr(){var e=zr();if(e&&(e[Fe]!==Ar||null===Ir)){var t=((Ar=e[Fe])||at)[Ze]();Ir=en(t,_r)||en(t,Cr)}return Ir}function Wr(e){if(void 0===e&&(e=null),!e){var t=zr()||{};e=t?(t[Fe]||at)[Ze]():at}var n=(e||at)[Ze]();if(en(n,_r)){var r=Br()||{};return Math.max(parseInt(n[Be](_r)[1]),r[br]||0)}if(en(n,Cr)){var i=parseInt(n[Be](Cr)[1]);if(i)return i+4}return null}function Gr(e){var t=Object[j].toString[We](e),n=at;return"[object Error]"===t?n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e[ie]+"'":qr()&&(n=Vr().stringify(e)),t+n}function Kr(){return null===Lr&&(Lr=Ur()&&Boolean(zr().sendBeacon)),Lr}function Xr(e){var t=!1;try{t=!!Or("fetch");var n=Or("Request");t&&e&&n&&(t=Rr(n,"keepalive"))}catch(r){}return t}function Yr(){return null===Pr&&(Pr=typeof XDomainRequest!==z)&&Qr()&&(Pr=Pr&&!Rr(Or(Tr),"withCredentials")),Pr}function Qr(){var e=!1;try{e=!!Or(Tr)}catch(t){}return e}var Jr,ei=["eventsSent","eventsDiscarded","eventsSendRequest","perfEvent"],ti=null;function ni(e,t){return function(){var n=arguments,r=ri(t);if(r){var i=r.listener;i&&i[e]&&i[e][$e](i,n)}}}function ri(e){var t,n=ti;return n||!0===e.disableDbgExt||(n=ti||((t=Or("Microsoft"))&&(ti=t.ApplicationInsights),ti)),n?n.ChromeDbgExt:null}function ii(e){if(!Jr){Jr={};for(var t=0;t<ei[pe];t++)Jr[ei[t]]=ni(ei[t],e)}return Jr}function ai(e){return e?'"'+e[He](/\"/g,at)+'"':at}function oi(e,t){var n=typeof console!==z?console:Or(wr);if(n){var r="log";n[e]&&(r=e),Xt(n[r])&&n[r](t)}}var si=function(){function e(e,t,n,r){void 0===n&&(n=!1);var i=this;i[_e]=e,i[Ce]=(n?"AI: ":"AI (Internal): ")+e;var a=at;qr()&&(a=Vr().stringify(r));var o=(t?" message:"+ai(t):at)+(r?" props:"+ai(a):at);i[Ce]+=o}return e.dataType="MessageData",e}();function ci(e,t){return(e||{})[de]||new li(t)}var li=function(){function e(t){this.identifier="DiagnosticLogger",this.queue=[];var n,r,i,a,o=0,s={};F(e,this,(function(e){function c(t,n){if(!(o>=i)){var a=!0,c="AITR_"+n[_e];if(s[c]?a=!1:s[c]=!0,a&&(t<=r&&(e.queue[se](n),o++,l(1===t?"error":"warn",n)),o===i)){var u="Internal events throttle limit per PageView reached for this app.",d=new si(23,u,!1);e.queue[se](d),1===t?e[bt](u):e[gt](u)}}}function l(e,n){var r=ri(t||{});r&&r[Pe]&&r[Pe](e,n)}!function(e){n=_n(e.loggingLevelConsole,0),r=_n(e.loggingLevelTelemetry,1),i=_n(e.maxMessageLimit,25),a=_n(e.enableDebug,_n(e[qe],!1))}(t||{}),e.consoleLoggingLevel=function(){return n},e.telemetryLoggingLevel=function(){return r},e.maxInternalMessageLimit=function(){return i},e[qe]=function(){return a},e.throwInternal=function(t,r,i,o,u){void 0===u&&(u=!1);var d=new si(r,i,u,o);if(a)throw Gr(d);var p=1===t?bt:gt;if(Vt(d[Ce]))l("throw"+(1===t?"Critical":"Warning"),d);else{if(u){var f=+d[_e];!s[f]&&n>=t&&(e[p](d[Ce]),s[f]=!0)}else n>=t&&e[p](d[Ce]);c(t,d)}},e[gt]=function(e){oi("warn",e),l("warning",e)},e[bt]=function(e){oi("error",e),l("error",e)},e.resetInternalMessageCount=function(){o=0,s={}},e[Ve]=c}))}return e.__ieDyn=1,e}();function ui(e){return e||new li}function di(e,t,n,r,i,a){void 0===a&&(a=!1),ui(e).throwInternal(t,n,r,i,a)}function pi(e,t){ui(e)[gt](t)}function fi(e){var t={};return Qt(e,(function(e,n){t[e]=n,t[n]=e})),yn(t)}var vi=fi({LocalStorage:0,SessionStorage:1}),mi=(fi({AI:0,AI_AND_W3C:1,W3C:2}),void 0),hi=void 0;function bi(){return Si()?gi(vi.LocalStorage):null}function gi(e){try{if(Zt(X()))return null;var t=(new Date)[Fn](),n=Or(e===vi.LocalStorage?"localStorage":"sessionStorage");n.setItem(t,t);var r=n.getItem(t)!==t;if(n[Bn](t),!r)return n}catch(i){}return null}function yi(){return _i()?gi(vi.SessionStorage):null}function wi(){mi=!1,hi=!1}function Si(e){return(e||void 0===mi)&&(mi=!!gi(vi.LocalStorage)),mi}function xi(e,t){var n=bi();if(null!==n)try{return n.getItem(t)}catch(r){mi=!1,di(e,2,1,"Browser failed read of local storage. "+xn(r),{exception:Gr(r)})}return null}function ki(e,t,n){var r=bi();if(null!==r)try{return r.setItem(t,n),!0}catch(i){mi=!1,di(e,2,3,"Browser failed write to local storage. "+xn(i),{exception:Gr(i)})}return!1}function Ei(e,t){var n=bi();if(null!==n)try{return n[Bn](t),!0}catch(r){mi=!1,di(e,2,5,"Browser failed removal of local storage item. "+xn(r),{exception:Gr(r)})}return!1}function _i(e){return(e||void 0===hi)&&(hi=!!gi(vi.SessionStorage)),hi}function Ci(e,t){var n=yi();if(null!==n)try{return n.getItem(t)}catch(r){hi=!1,di(e,2,2,"Browser failed read of session storage. "+xn(r),{exception:Gr(r)})}return null}function Ti(e,t,n){var r=yi();if(null!==r)try{return r.setItem(t,n),!0}catch(i){hi=!1,di(e,2,4,"Browser failed write to session storage. "+xn(i),{exception:Gr(i)})}return!1}function Ii(e,t){var n=yi();if(null!==n)try{return n[Bn](t),!0}catch(r){hi=!1,di(e,2,6,"Browser failed removal of session storage item. "+xn(r),{exception:Gr(r)})}return!1}var Ai,Ni="AppInsightsPropertiesPlugin",Pi="AppInsightsChannelPlugin",Li="ApplicationInsightsAnalytics",Ri="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",Oi="sampleRate",Mi="ProcessLegacy",Di="http.method",Fi="https://dc.services.visualstudio.com",Bi="/v2/track",Ui="not_specified",zi="iKey";function ji(e,t,n){var r=t[On],i=$i(e,t);if(i[On]!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i[ur](0,147)+Yi(a);i=o}return i}function $i(e,t){var n;return t&&(t=fn(t[Fn]()))[On]>150&&(n=t[ur](0,150),di(e,2,57,"name is too long. It has been truncated to 150 characters.",{name:t},!0)),n||t}function Hi(e,t,n){var r;return void 0===n&&(n=1024),t&&(n=n||1024,(t=fn(t)).toString()[On]>n&&(r=t[Fn]()[ur](0,n),di(e,2,61,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t}function qi(e,t){return Xi(e,t,2048,66)}function Vi(e,t){var n;return t&&t[On]>32768&&(n=t[ur](0,32768),di(e,2,56,"message is too long, it has been truncated to 32768 characters.",{message:t},!0)),n||t}function Zi(e,t){var n;if(t){var r=""+t;r[On]>32768&&(n=r[ur](0,32768),di(e,2,52,"exception is too long, it has been truncated to 32768 characters.",{exception:t},!0))}return n||t}function Wi(e,t){if(t){var n={};Qt(t,(function(t,r){if(Kt(r)&&qr())try{r=Vr()[jn](r)}catch(i){di(e,2,49,"custom property is not valid",{exception:i},!0)}r=Hi(e,r,8192),t=ji(e,t,n),n[t]=r})),t=n}return t}function Gi(e,t){if(t){var n={};Qt(t,(function(t,r){t=ji(e,t,n),n[t]=r})),t=n}return t}function Ki(e,t){return t?Xi(e,t,128,69)[Fn]():t}function Xi(e,t,n,r){var i;return t&&(t=fn(t))[On]>n&&(i=t[ur](0,n),di(e,2,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t}function Yi(e){var t="00"+e;return t.substr(t[On]-3)}(Ai={MAX_NAME_LENGTH:150,MAX_ID_LENGTH:128,MAX_PROPERTY_LENGTH:8192,MAX_STRING_LENGTH:1024,MAX_URL_LENGTH:2048,MAX_MESSAGE_LENGTH:32768,MAX_EXCEPTION_LENGTH:32768}).sanitizeKeyAndAddUniqueness=ji,Ai.sanitizeKey=$i,Ai.sanitizeString=Hi,Ai.sanitizeUrl=qi,Ai.sanitizeMessage=Vi,Ai.sanitizeException=Zi,Ai.sanitizeProperties=Wi,Ai.sanitizeMeasurements=Gi,Ai.sanitizeId=Ki,Ai.sanitizeInput=Xi,Ai.padNumber=Yi,Ai.trim=fn;function Qi(e,t,n,r,i,a){var o;n=Hi(r,n)||Ui,(Zt(e)||Zt(t)||Zt(n))&&Tn("Input doesn't contain all required fields");var s="";e[zi]&&(s=e[zi],delete e[zi]);var c=((o={})[Un]=n,o.time=cn(new Date),o.iKey=s,o.ext=a||{},o.tags=[],o.data={},o.baseType=t,o.baseData=e,o);return Zt(i)||Qt(i,(function(e,t){c.data[e]=t})),c}!function(){function e(){}e.create=Qi}();var Ji=function(){function e(e,t,n,r){this.aiDataContract={ver:1,name:1,properties:0,measurements:0};var i=this;i.ver=2,i[Un]=Hi(e,t)||Ui,i[Gn]=Wi(e,n),i[Kn]=Gi(e,r)}return e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(),ea=function(){function e(e,t,n,r,i){this.aiDataContract={ver:1,message:1,severityLevel:0,properties:0};var a=this;a.ver=2,t=t||Ui,a[zn]=Vi(e,t),a[Gn]=Wi(e,r),a[Kn]=Gi(e,i),n&&(a[Qn]=n)}return e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(),ta=function(){this.aiDataContract={name:1,kind:0,value:1,count:0,min:0,max:0,stdDev:0},this.kind=0},na=function(){function e(e,t,n,r,i,a,o,s,c){this.aiDataContract={ver:1,metrics:1,properties:0};var l=this;l.ver=2;var u=new ta;u.count=r>0?r:void 0,u.max=isNaN(a)||null===a?void 0:a,u.min=isNaN(i)||null===i?void 0:i,u[Un]=Hi(e,t)||Ui,u.value=n,u.stdDev=isNaN(o)||null===o?void 0:o,l.metrics=[u],l[Gn]=Wi(e,s),l[Kn]=Gi(e,c)}return e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(),ra=function(){function e(e,t,n,r,i,a,o){this.aiDataContract={ver:1,name:0,url:0,duration:0,properties:0,measurements:0,id:0};var s=this;s.ver=2,s.id=Ki(e,o),s.url=qi(e,n),s[Un]=Hi(e,t)||Ui,isNaN(r)||(s[cr]=fr(r)),s[Gn]=Wi(e,i),s[Kn]=Gi(e,a)}return e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(),ia=function(){function e(e,t,n,r,i,a,o){this.aiDataContract={ver:1,name:0,url:0,duration:0,perfTotal:0,networkConnect:0,sentRequest:0,receivedResponse:0,domProcessing:0,properties:0,measurements:0};var s=this;s.ver=2,s.url=qi(e,n),s[Un]=Hi(e,t)||Ui,s[Gn]=Wi(e,i),s[Kn]=Gi(e,a),o&&(s.domProcessing=o.domProcessing,s[cr]=o[cr],s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s[lr]=o[lr],s.sentRequest=o.sentRequest)}return e.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",e.dataType="PageviewPerformanceData",e}(),aa="error",oa="stack",sa="stackDetails",ca="errorSrc",la="message",ua="description";function da(e,t){var n=e;return n&&!rn(n)&&(JSON&&JSON[jn]?(n=JSON[jn](e),!t||n&&"{}"!==n||(n=Xt(e[Fn])?e[Fn]():""+e)):n=e+" - (Missing JSON.stringify)"),n||""}function pa(e,t){var n=e;return e&&(n&&!rn(n)&&(n=e[la]||e[ua]||n),n&&!rn(n)&&(n=da(n,!0)),e.filename&&(n=n+" @"+(e.filename||"")+":"+(e.lineno||"?")+":"+(e.colno||"?"))),t&&"String"!==t&&"Object"!==t&&"Error"!==t&&-1===(n||"")[qn](t)&&(n=t+": "+n),n||""}function fa(e){return e&&e.src&&rn(e.src)&&e.obj&&tn(e.obj)}function va(e){var t=e||"";rn(t)||(t=rn(t[oa])?t[oa]:""+t);var n=t[Rn]("\n");return{src:t,obj:n}}function ma(e){var t=null;if(e)try{if(e[oa])t=va(e[oa]);else if(e[aa]&&e[aa][oa])t=va(e[aa][oa]);else if(e.exception&&e.exception[oa])t=va(e.exception[oa]);else if(fa(e))t=e;else if(fa(e[sa]))t=e[sa];else if(window&&window.opera&&e[la])t=function(e){for(var t=[],n=e[Rn]("\n"),r=0;r<n[On];r++){var i=n[r];n[r+1]&&(i+="@"+n[r+1],r++),t.push(i)}return{src:e,obj:t}}(e[zn]);else if(e.reason&&e.reason[oa])t=va(e.reason[oa]);else if(rn(e))t=va(e);else{var n=e[la]||e[ua]||"";rn(e[ca])&&(n&&(n+="\n"),n+=" from "+e[ca]),n&&(t=va(n))}}catch(r){t=va(r)}return t||{src:"",obj:null}}function ha(e){var t="";if(e&&!(t=e.typeName||e[Un]||""))try{var n=/function (.{1,200})\(/.exec(e.constructor[Fn]());t=n&&n[On]>1?n[1]:""}catch(r){}return t}function ba(e){if(e)try{if(!rn(e)){var t=ha(e),n=da(e,!1);return n&&"{}"!==n||(e[aa]&&(t=ha(e=e[aa])),n=da(e,!0)),0!==n[qn](t)&&"String"!==t?t+":"+n:n}}catch(r){}return""+(e||"")}var ga=function(){function e(e,t,n,r,i,a){this.aiDataContract={ver:1,exceptions:1,severityLevel:0,properties:0,measurements:0};var o=this;o.ver=2,!function(e){try{if(Kt(e))return"ver"in e&&"exceptions"in e&&"properties"in e}catch(t){}return!1}(t)?(n||(n={}),o[Zn]=[new ya(e,t,n)],o[Gn]=Wi(e,n),o[Kn]=Gi(e,r),i&&(o[Qn]=i),a&&(o.id=a)):(o[Zn]=t[Zn]||[],o[Gn]=t[Gn],o[Kn]=t[Kn],t[Qn]&&(o[Qn]=t[Qn]),t.id&&(o.id=t.id),t[Jn]&&(o[Jn]=t[Jn]),Zt(t[er])||(o[er]=t[er]))}return e.CreateAutoException=function(e,t,n,r,i,a,o,s){var c,l=ha(i||a||e);return(c={})[zn]=pa(e,l),c.url=t,c.lineNumber=n,c.columnNumber=r,c.error=ba(i||a||e),c.evt=ba(a||e),c[Yn]=l,c.stackDetails=ma(o||i||a),c.errorSrc=s,c},e.CreateFromInterface=function(t,n,r,i){var a=n[Zn]&&dn(n[Zn],(function(e){return ya[tr](t,e)}));return new e(t,J(J({},n),{exceptions:a}),r,i)},e.prototype.toInterface=function(){var e,t=this,n=t.exceptions,r=t.properties,i=t.measurements,a=t.severityLevel,o=t.problemGroup,s=t.id,c=t.isManual,l=n instanceof Array&&dn(n,(function(e){return e.toInterface()}))||void 0;return(e={ver:"4.0"})[Zn]=l,e.severityLevel=a,e.properties=r,e.measurements=i,e.problemGroup=o,e.id=s,e.isManual=c,e},e.CreateSimpleException=function(e,t,n,r,i,a){var o;return{exceptions:[(o={},o[rr]=!0,o.message=e,o.stack=i,o.typeName=t,o)]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e.formatError=ba,e}(),ya=function(){function e(e,t,n){this.aiDataContract={id:0,outerId:0,typeName:1,message:1,hasFullStack:0,stack:0,parsedStack:2};var r=this;if(function(e){try{if(Kt(e))return"hasFullStack"in e&&"typeName"in e}catch(t){}return!1}(t))r[Yn]=t[Yn],r[zn]=t[zn],r[oa]=t[oa],r[Wn]=t[Wn]||[],r[rr]=t[rr];else{var i=t,a=i&&i.evt;nn(i)||(i=i[aa]||a||i),r[Yn]=Hi(e,ha(i))||Ui,r[zn]=Vi(e,pa(t||i,r[Yn]))||Ui;var o=t[sa]||ma(t);r[Wn]=function(e){var t,n=e.obj;if(n&&n[On]>0){t=[];var r=0,i=0;if(ln(n,(function(e){var n=e[Fn]();if(wa.regex.test(n)){var a=new wa(n,r++);i+=a[Xn],t.push(a)}})),i>32768)for(var a=0,o=t[On]-1,s=0,c=a,l=o;a<o;){if((s+=t[a][Xn]+t[o][Xn])>32768){var u=l-c+1;t.splice(c,u);break}c=a,l=o,a++,o--}}return t}(o),tn(r[Wn])&&dn(r[Wn],(function(t){return t[nr]=Hi(e,t[nr])})),r[oa]=Zi(e,function(e){var t="";return e&&(e.obj?ln(e.obj,(function(e){t+=e+"\n"})):t=e.src||""),t}(o)),r.hasFullStack=tn(r.parsedStack)&&r.parsedStack[On]>0,n&&(n[Yn]=n[Yn]||r[Yn])}}return e.prototype.toInterface=function(){var e,t=this,n=t[Wn]instanceof Array&&dn(t[Wn],(function(e){return e.toInterface()}));return(e={id:t.id,outerId:t.outerId,typeName:t[Yn],message:t[zn],hasFullStack:t[rr],stack:t[oa]})[Wn]=n||void 0,e},e.CreateFromInterface=function(t,n){var r=n[Wn]instanceof Array&&dn(n[Wn],(function(e){return wa[tr](e)}))||n[Wn];return new e(t,J(J({},n),{parsedStack:r}))},e}(),wa=function(){function e(t,n){this.aiDataContract={level:1,method:1,assembly:0,fileName:0,line:0};var r=this;if(r[Xn]=0,"string"==typeof t){var i=t;r[ir]=n,r[ar]="<no_method>",r[nr]=fn(i),r[or]="",r[sr]=0;var a=i.match(e.regex);a&&a[On]>=5&&(r[ar]=fn(a[2])||r[ar],r[or]=fn(a[4]),r[sr]=parseInt(a[5])||0)}else r[ir]=t[ir],r[ar]=t[ar],r[nr]=t[nr],r[or]=t[or],r[sr]=t[sr],r[Xn]=0;r.sizeInBytes+=r.method[On],r.sizeInBytes+=r.fileName[On],r.sizeInBytes+=r.assembly[On],r[Xn]+=e.baseSize,r.sizeInBytes+=r.level.toString()[On],r.sizeInBytes+=r.line.toString()[On]}return e.CreateFromInterface=function(t){return new e(t,null)},e.prototype.toInterface=function(){var e=this;return{level:e[ir],method:e[ar],assembly:e[nr],fileName:e[or],line:e[sr]}},e.regex=/^([\s]+at)?[\s]{0,50}([^\@\()]+?)[\s]{0,50}(\@|\()([^\(\n]+):([0-9]+):([0-9]+)(\)?)$/,e.baseSize=58,e}(),Sa="toGMTString",xa="toUTCString",ka="cookie",Ea="expires",_a="enabled",Ca="isCookieUseDisabled",Ta="disableCookiesUsage",Ia="_ckMgr",Aa=null,Na=null,Pa=null,La=Br(),Ra={},Oa={};function Ma(e,t){var n=Ua[Ia]||Oa[Ia];return n||(n=Ua[Ia]=Ua(e,t),Oa[Ia]=n),n}function Da(e){return!e||e.isEnabled()}function Fa(e,t){return!!(t&&e&&tn(e.ignoreCookies))&&-1!==e.ignoreCookies[Me](t)}function Ba(e,t){var n;if(e)n=e.getCookieMgr();else if(t){var r=t[Oe];n=r[Ia]?r[Ia]:Ua(t)}return n||(n=Ma(t,(e||{})[de])),n}function Ua(e,t){var n,r=function(e){var t=e[Oe]=e[Oe]||{};if(kn(t,"domain",e.cookieDomain,Wt,Zt),kn(t,"path",e.cookiePath||"/",null,Zt),Zt(t[_a])){var n=void 0;Vt(e[Ca])||(n=!e[Ca]),Vt(e[Ta])||(n=!e[Ta]),t[_a]=n}return t}(e||Oa),i=r.path||"/",a=r.domain,o=!1!==r[_a],s=((n={isEnabled:function(){var e=o&&za(t),n=Oa[Ia];return e&&n&&s!==n&&(e=Da(n)),e}})[Ue]=function(e){o=!1!==e},n.set=function(e,t,n,o,c){var l=!1;if(Da(s)&&!function(e,t){return!!(t&&e&&tn(e.blockedCookies)&&-1!==e.blockedCookies[Me](t))||Fa(e,t)}(r,e)){var u={},d=fn(t||at),p=d[Me](";");if(-1!==p&&(d=fn(t[De](0,p)),u=ja(t[De](p+1))),kn(u,"domain",o||a,Cn,Vt),!Zt(n)){var f=Zr();if(Vt(u[Ea])){var v=Sn()+1e3*n;if(v>0){var m=new Date;m.setTime(v),kn(u,Ea,$a(m,f?Sa:xa)||$a(m,f?Sa:xa)||at,Cn)}}f||kn(u,"max-age",at+n,null,Vt)}var h=$r();h&&"https:"===h.protocol&&(kn(u,"secure",null,null,Vt),null===Na&&(Na=!Za((zr()||{})[Fe])),Na&&kn(u,"SameSite","None",null,Vt)),kn(u,"path",c||i,null,Vt),(r.setCookie||Va)(e,Ha(d,u)),l=!0}return l},n.get=function(e){var t=at;return Da(s)&&!Fa(r,e)&&(t=(r.getCookie||qa)(e)),t},n.del=function(e,t){var n=!1;return Da(s)&&(n=s.purge(e,t)),n},n.purge=function(e,n){var i,a=!1;if(za(t)){var o=((i={}).path=n||"/",i[Ea]="Thu, 01 Jan 1970 00:00:01 GMT",i);Zr()||(o["max-age"]="0"),(r.delCookie||Va)(e,Ha(at,o)),a=!0}return a},n);return s[Ia]=s,s}function za(e){if(null===Aa){Aa=!1;try{Aa=void 0!==(La||{})[ka]}catch(t){di(e,2,68,"Cannot access document.cookie - "+xn(t),{exception:Gr(t)})}}return Aa}function ja(e){var t={};e&&e[pe]&&ln(fn(e)[Be](";"),(function(e){if(e=fn(e||at)){var n=e[Me]("=");-1===n?t[e]=null:t[fn(e[De](0,n))]=fn(e[De](n+1))}}));return t}function $a(e,t){return Xt(e[t])?e[t]():null}function Ha(e,t){var n=e||at;return Qt(t,(function(e,t){n+="; "+e+(Zt(t)?at:"="+t)})),n}function qa(e){var t=at;if(La){var n=La[ka]||at;Pa!==n&&(Ra=ja(n),Pa=n),t=fn(Ra[e]||at)}return t}function Va(e,t){La&&(La[ka]=e+"="+t)}function Za(e){return!!rn(e)&&(!(!en(e,"CPU iPhone OS 12")&&!en(e,"iPad; CPU OS 12"))||(!!(en(e,"Macintosh; Intel Mac OS X 10_14")&&en(e,"Version/")&&en(e,"Safari"))||(!(!en(e,"Macintosh; Intel Mac OS X 10_14")||!Jt(e,"AppleWebKit/605.1.15 (KHTML, like Gecko)"))||(!(!en(e,"Chrome/5")&&!en(e,"Chrome/6"))||(!(!en(e,"UnrealEngine")||en(e,"Chrome"))||!(!en(e,"UCBrowser/12")&&!en(e,"UCBrowser/11")))))))}var Wa=4294967296,Ga=4294967295,Ka=!1,Xa=123456789,Ya=987654321;function Qa(e){e<0&&(e>>>=0),Xa=123456789+e&Ga,Ya=987654321-e&Ga,Ka=!0}function Ja(){try{var e=2147483647&Sn();Qa((Math.random()*Wa^e)+e)}catch(t){}}function eo(e){var t=0,n=Or(kr)||Or(Er);return n&&n.getRandomValues&&(t=n.getRandomValues(new Uint32Array(1))[0]&Ga),0===t&&Zr()&&(Ka||Ja(),t=to()&Ga),0===t&&(t=Math.floor(Wa*Math.random()|0)),e||(t>>>=0),t}function to(e){var t=((Ya=36969*(65535&Ya)+(Ya>>16)&Ga)<<16)+(65535&(Xa=18e3*(65535&Xa)+(Xa>>16)&Ga))>>>0&Ga|0;return e||(t>>>=0),t}function no(e){void 0===e&&(e=22);for(var t=eo()>>>0,n=0,r=at;r[pe]<e;)n++,r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(63&t),t>>>=6,5===n&&(t=(eo()<<2&4294967295|3&t)>>>0,n=0);return r}var ro=W,io="2.8.14",ao="."+no(6),oo=0;function so(e){return 1===e[je]||9===e[je]||!+e[je]}function co(e,t){var n=t[e.id];if(!n){n={};try{so(t)&&(function(e,t,n){if(ro)try{return ro(e,t,{value:n,enumerable:!1,configurable:!0}),!0}catch(r){}return!1}(t,e.id,n)||(t[e.id]=n))}catch(r){}}return n}function lo(e,t){return void 0===t&&(t=!1),Yt(e+oo+++(t?"."+io:at)+ao)}function uo(e){var t={id:lo("_aiData-"+(e||at)+"."+io),accept:function(e){return so(e)},get:function(e,n,r,i){var a=e[t.id];return a?a[Yt(n)]:(i&&((a=co(t,e))[Yt(n)]=r),r)},kill:function(e,t){if(e&&e[t])try{delete e[t]}catch(n){}}};return t}var po="on",fo="attachEvent",vo="addEventListener",mo="detachEvent",ho="removeEventListener",bo="events",go="visibilitychange",yo="pagehide",wo="unload",So="beforeunload",xo=lo("aiEvtPageHide"),ko=(lo("aiEvtPageShow"),/\.[\.]+/g),Eo=/[\.]+$/,_o=1,Co=uo("events"),To=/^([^.]*)(?:\.(.+)|)/;function Io(e){return e&&e[He]?e[He](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g,at):e}function Ao(e,t){var n;if(t){var r=at;tn(t)?(r=at,ln(t,(function(e){(e=Io(e))&&("."!==e[0]&&(e="."+e),r+=e)}))):r=Io(t),r&&("."!==r[0]&&(r="."+r),e=(e||at)+r)}var i=To.exec(e||at)||[];return(n={})[Ge]=i[1],n.ns=(i[2]||at).replace(ko,".").replace(Eo,at)[Be](".").sort().join("."),n}function No(e,t,n){void 0===n&&(n=!0);var r=Co.get(e,bo,{},n),i=r[t];return i||(i=r[t]=[]),i}function Po(e,t,n,r){e&&t&&t[Ge]&&(e[ho]?e[ho](t[Ge],n,r):e[mo]&&e[mo](po+t[Ge],n))}function Lo(e,t,n,r){for(var i=t[pe];i--;){var a=t[i];a&&(n.ns&&n.ns!==a.evtName.ns||r&&!r(a)||(Po(e,a.evtName,a[Ke],a.capture),t[ke](i,1)))}}function Ro(e,t){return t?Ao("xx",tn(t)?[e].concat(t):[e,t]).ns[Be]("."):e}function Oo(e,t,n,r,i){var a;void 0===i&&(i=!1);var o=!1;if(e)try{var s=Ao(t,r);if(o=function(e,t,n,r){var i=!1;return e&&t&&t[Ge]&&n&&(e[vo]?(e[vo](t[Ge],n,r),i=!0):e[fo]&&(e[fo](po+t[Ge],n),i=!0)),i}(e,s,n,i),o&&Co.accept(e)){var c=((a={guid:_o++,evtName:s})[Ke]=n,a.capture=i,a);No(e,s.type)[se](c)}}catch(l){}return o}function Mo(e,t,n,r,i){if(void 0===i&&(i=!1),e)try{var a=Ao(t,r),o=!1;!function(e,t,n){if(t[Ge])Lo(e,No(e,t[Ge]),t,n);else{var r=Co.get(e,bo,{});Qt(r,(function(r,i){Lo(e,i,t,n)})),0===hn(r)[pe]&&Co.kill(e,bo)}}(e,a,(function(e){return!((!a.ns||n)&&e[Ke]!==n)&&(o=!0,!0)})),o||Po(e,a,n,i)}catch(s){}}function Do(e,t,n){var r=!1,i=Dr();i&&(r=Oo(i,e,t,n),r=Oo(i.body,e,t,n)||r);var a=Br();return a&&(r=Oo(a,e,t,n)||r),r}function Fo(e,t,n,r){var i=!1;return t&&e&&e[pe]>0&&ln(e,(function(e){e&&(n&&-1!==un(n,e)||(i=Do(e,t,r)||i))})),i}function Bo(e,t,n){e&&tn(e)&&ln(e,(function(e){e&&function(e,t,n){var r=Dr();r&&(Mo(r,e,t,n),Mo(r.body,e,t,n));var i=Br();i&&Mo(i,e,t,n)}(e,t,n)}))}function Uo(e,t,n){return function(e,t,n,r){var i=!1;return t&&e&&tn(e)&&!(i=Fo(e,t,n,r))&&n&&n[pe]>0&&(i=Fo(e,t,null,r)),i}([So,wo,yo],e,t,n)}function zo(e,t,n){var r=Ro(xo,n),i=Fo([yo],e,t,r);return t&&-1!==un(t,go)||(i=Fo([go],(function(t){var n=Br();e&&n&&"hidden"===n.visibilityState&&e(t)}),t,r)||i),!i&&t&&(i=zo(e,null,n)),i}function jo(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n=at,r=0;r<4;r++)n+=t[15&(e=eo())]+t[e>>4&15]+t[e>>8&15]+t[e>>12&15]+t[e>>16&15]+t[e>>20&15]+t[e>>24&15]+t[e>>28&15];var i=t[8+(3&eo())|0];return n[ze](0,8)+n[ze](9,4)+"4"+n[ze](13,3)+i+n[ze](16,3)+n[ze](19,12)}var $o="00",Ho="ff",qo="00000000000000000000000000000000",Vo="0000000000000000";function Zo(e,t,n){return!(!e||e[pe]!==t||e===n)&&!!e.match(/^[\da-f]*$/)}function Wo(e,t,n){return Zo(e,t)?e:n}function Go(e){(isNaN(e)||e<0||e>255)&&(e=1);for(var t=e.toString(16);t[pe]<2;)t="0"+t;return t}function Ko(e,t,n,r){var i;return(i={})[it]=Zo(r,2,Ho)?r:$o,i[tt]=Xo(e)?e:jo(),i.spanId=Yo(t)?t:jo()[ze](0,16),i.traceFlags=n>=0&&n<=255?n:1,i}function Xo(e){return Zo(e,32,qo)}function Yo(e){return Zo(e,16,Vo)}function Qo(e){if(e){var t=Go(e[rt]);Zo(t,2)||(t="01");var n=e[it]||$o;return"00"!==n&&"ff"!==n&&(n=$o),"".concat(n,"-").concat(Wo(e.traceId,32,qo),"-").concat(Wo(e.spanId,16,Vo),"-").concat(t)}return""}function Jo(e){var t=null;if(Xt(Event))t=new Event(e);else{var n=Br();n&&n.createEvent&&(t=n.createEvent("Event")).initEvent(e,!0,!0)}return t}var es,ts=(es={},Qt({requestContextHeader:[0,"Request-Context"],requestContextTargetKey:[1,"appId"],requestContextAppIdFormat:[2,"appId=cid-v1:"],requestIdHeader:[3,"Request-Id"],traceParentHeader:[4,"traceparent"],traceStateHeader:[5,"tracestate"],sdkContextHeader:[6,"Sdk-Context"],sdkContextHeaderAppIdRequest:[7,"appId"],requestContextHeaderLowerCase:[8,"request-context"]},(function(e,t){es[e]=t[1],es[t[0]]=t[1]})),yn(es)),ns=Br()||{},rs=0,is=[null,null,null,null,null];function as(e){var t=rs,n=is,r=n[t];return ns.createElement?n[t]||(r=n[t]=ns.createElement("a")):r={host:cs(e,!0)},r.href=e,++t>=n[On]&&(t=0),rs=t,r}function os(e){var t,n=as(e);return n&&(t=n.href),t}function ss(e,t){return e?e.toUpperCase()+" "+t:t}function cs(e,t){var n=ls(e,t)||"";if(n){var r=n.match(/(www\d{0,5}\.)?([^\/:]{1,256})(:\d{1,20})?/i);if(null!=r&&r[On]>3&&rn(r[2])&&r[2][On]>0)return r[2]+(r[3]||"")}return n}function ls(e,t){var n=null;if(e){var r=e.match(/(\w{1,150}):\/\/([^\/:]{1,256})(:\d{1,20})?/i);if(null!=r&&r[On]>2&&rn(r[2])&&r[2][On]>0&&(n=r[2]||"",t&&r[On]>2)){var i=(r[1]||"")[Mn](),a=r[3]||"";("http"===i&&":80"===a||"https"===i&&":443"===a)&&(a=""),n+=a}}return n}var us=[Fi+Bi,"https://breeze.aimon.applicationinsights.io"+Bi,"https://dc-int.services.visualstudio.com"+Bi];function ds(e){return-1!==un(us,e[Mn]())}var ps={correlationIdPrefix:"cid-v1:",canIncludeCorrelationHeader:function(e,t,n){if(!t||e&&e.disableCorrelationHeaders)return!1;if(e&&e[Hn])for(var r=0;r<e.correlationHeaderExcludePatterns[On];r++)if(e[Hn][r].test(t))return!1;var i=as(t).host[Mn]();if(!i||-1===i[qn](":443")&&-1===i[qn](":80")||(i=(ls(t,!0)||"")[Mn]()),(!e||!e.enableCorsCorrelation)&&i&&i!==n)return!1;var a,o=e&&e.correlationHeaderDomains;if(o&&(ln(o,(function(e){var t=new RegExp(e.toLowerCase().replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*"));a=a||t.test(i)})),!a))return!1;var s=e&&e.correlationHeaderExcludedDomains;if(!s||0===s[On])return!0;for(r=0;r<s[On];r++){if(new RegExp(s[r].toLowerCase().replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")).test(i))return!1}return i&&i[On]>0},getCorrelationContext:function(e){if(e){var t=ps.getCorrelationContextValue(e,ts[1]);if(t&&t!==ps.correlationIdPrefix)return t}},getCorrelationContextValue:function(e,t){if(e)for(var n=e[Rn](","),r=0;r<n[On];++r){var i=n[r][Rn]("=");if(2===i[On]&&i[0]===t)return i[1]}}};function fs(){var e=Hr();if(e&&e.now&&e.timing){var t=e.now()+e.timing.navigationStart;if(t>0)return t}return Sn()}function vs(e,t){var n=null;return 0===e||0===t||Zt(e)||Zt(t)||(n=t-e),n}function ms(e,t){var n=e||{};return{getName:function(){return n[Un]},setName:function(e){t&&t.setName(e),n[Un]=e},getTraceId:function(){return n.traceID},setTraceId:function(e){t&&t.setTraceId(e),Xo(e)&&(n.traceID=e)},getSpanId:function(){return n.parentID},setSpanId:function(e){t&&t.setSpanId(e),Yo(e)&&(n.parentID=e)},getTraceFlags:function(){return n.traceFlags},setTraceFlags:function(e){t&&t.setTraceFlags(e),n.traceFlags=e}}}var hs=function(){function e(e,t,n,r,i,a,o,s,c,l,u,d){void 0===c&&(c="Ajax"),this.aiDataContract={id:1,ver:1,name:0,resultCode:0,duration:0,success:0,data:0,target:0,type:0,properties:0,measurements:0,kind:0,value:0,count:0,min:0,max:0,stdDev:0,dependencyKind:0,dependencySource:0,commandName:0,dependencyTypeName:0};var p=this;p.ver=2,p.id=t,p[cr]=fr(i),p.success=a,p.resultCode=o+"",p.type=Hi(e,c);var f=function(e,t,n,r){var i,a=r,o=r;if(t&&t[On]>0){var s=as(t);if(i=s.host,!a)if(null!=s[$n]){var c=0===s.pathname[On]?"/":s[$n];"/"!==c.charAt(0)&&(c="/"+c),o=s[$n],a=Hi(e,n?n+" "+c:c)}else a=Hi(e,t)}else i=r,a=r;return{target:i,name:a,data:o}}(e,n,s,r);p.data=qi(e,r)||f.data,p.target=Hi(e,f.target),l&&(p.target="".concat(p.target," | ").concat(l)),p[Un]=Hi(e,f[Un]),p[Gn]=Wi(e,u),p[Kn]=Gi(e,d)}return e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(),bs="ctx",gs="ParentContextKey",ys="ChildrenContextKey",ws=null,Ss=function(){function e(t,n,r){var i,a=this,o=!1;(a.start=Sn(),a[ie]=t,a[Te]=r,a[Ye]=function(){return!1},Xt(n))&&(o=bn(a,"payload",(function(){return!i&&Xt(n)&&(i=n(),n=null),i})));a[Qe]=function(t){return t?t===e[gs]||t===e[ys]?a[t]:(a[bs]||{})[t]:null},a[Je]=function(t,n){if(t)if(t===e[gs])a[t]||(a[Ye]=function(){return!0}),a[t]=n;else if(t===e[ys])a[t]=n;else{(a[bs]=a[bs]||{})[t]=n}},a[et]=function(){var t=0,r=a[Qe](e[ys]);if(tn(r))for(var i=0;i<r[pe];i++){var s=r[i];s&&(t+=s[fe])}a[fe]=Sn()-a.start,a.exTime=a[fe]-t,a[et]=function(){},!o&&Xt(n)&&(a.payload=n())}}return e.ParentContextKey="parent",e.ChildrenContextKey="childEvts",e}(),xs=function(){function e(t){this.ctx={},F(e,this,(function(e){e.create=function(e,t,n){return new Ss(e,t,n)},e.fire=function(e){e&&(e[et](),t&&Xt(t[ht])&&t[ht](e))},e[Je]=function(t,n){t&&((e[bs]=e[bs]||{})[t]=n)},e[Qe]=function(t){return(e[bs]||{})[t]}}))}return e.__ieDyn=1,e}(),ks="CoreUtils.doPerf";function Es(e,t,n,r,i){if(e){var a=e;if(a[yt]&&(a=a[yt]()),a){var o=void 0,s=a[Qe](ks);try{if(o=a.create(t(),r,i)){if(s&&o[Je]&&(o[Je](Ss[gs],s),s[Qe]&&s[Je])){var c=s[Qe](Ss[ys]);c||(c=[],s[Je](Ss[ys],c)),c[se](o)}return a[Je](ks,o),n(o)}}catch(l){o&&o[Je]&&o[Je]("exception",l)}finally{o&&a.fire(o),a[Je](ks,s)}}}return n()}var _s=uo("plugin");function Cs(e){return _s.get(e,"state",{},!0)}function Ts(e,t){for(var n,r=[],i=null,a=e[Ne]();a;){var o=a[we]();if(o){i&&Xt(i[Le])&&Xt(o[dt])&&i[Le](o);(Xt(o[ce])?o[ce]():(n=Cs(o))[ce])||r[se](o),i=o,a=a[Ne]()}}ln(r,(function(r){var i=e[st]();r[re](e.getCfg(),i,t,e[Ne]()),n=Cs(r),r[st]||n[st]||(n[st]=i),n[ce]=!0,delete n[Ee]}))}function Is(e){return e.sort((function(e,t){var n=0;if(t){var r=Xt(t[dt]);Xt(e[dt])?n=r?e[pt]-t[pt]:1:r&&(n=-1)}else n=e?1:-1;return n}))}var As="TelemetryPluginChain",Ns="_hasRun",Ps="_getTelCtx",Ls=0;function Rs(e,t,n,r){var i=null,a=[];null!==r&&(i=r?function(e,t,n){for(;e;){if(e[we]()===n)return e;e=e[Ne]()}return Fs([n],t[le]||{},t)}(e,n,r):e);var o={_next:function(){var e=i;if(i=e?e[Ne]():null,!e){var t=a;t&&t[pe]>0&&(ln(t,(function(e){try{e.func[We](e.self,e.args)}catch(t){di(n[de],2,73,"Unexpected Exception during onComplete - "+Gr(t))}})),a=[])}return e},ctx:{core:function(){return n},diagLog:function(){return ci(n,t)},getCfg:function(){return t},getExtCfg:s,getConfig:function(e,n,r){void 0===r&&(r=!1);var i,a=s(e,null);a&&!Zt(a[n])?i=a[n]:t&&!Zt(t[n])&&(i=t[n]);return Zt(i)?r:i},hasNext:function(){return!!i},getNext:function(){return i},setNext:function(e){i=e},iterate:function(e){var t;for(;t=o._next();){var n=t[we]();n&&e(n)}},onComplete:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];e&&a[se]({func:e,self:Vt(t)?o.ctx:t,args:n})}}};function s(e,n,r){var i;if(void 0===n&&(n={}),void 0===r&&(r=0),t){var a=t[ut];a&&e&&(i=a[e])}if(i){if(Kt(n)&&0!==r){var o=Ln(!0,n,i);t&&2===r&&Qt(n,(function(e){if(Zt(o[e])){var n=t[e];Zt(n)||(o[e]=n)}})),i=o}}else i=n;return i}return o}function Os(e,t,n,r){var i=Rs(e,t,n,r),a=i.ctx;return a[ve]=function(e){var t=i._next();return t&&t[dt](e,a),!t},a[Re]=function(e,r){return void 0===e&&(e=null),tn(e)&&(e=Fs(e,t,n,r)),Os(e||a[Ne](),t,n,r)},a}function Ms(e,t,n){var r=t[le]||{},i=Rs(e,r,t,n),a=i.ctx;return a[ve]=function(e){var t=i._next();return t&&t.unload(a,e),!t},a[Re]=function(e,n){return void 0===e&&(e=null),tn(e)&&(e=Fs(e,r,t,n)),Ms(e||a[Ne](),t,n)},a}function Ds(e,t,n){var r=t[le]||{},i=Rs(e,r,t,n).ctx;return i[ve]=function(e){return i.iterate((function(t){Xt(t[Ae])&&t[Ae](i,e)}))},i[Re]=function(e,n){return void 0===e&&(e=null),tn(e)&&(e=Fs(e,r,t,n)),Ds(e||i[Ne](),t,n)},i}function Fs(e,t,n,r){var i=null,a=!r;if(tn(e)&&e[pe]>0){var o=null;ln(e,(function(e){if(a||r!==e||(a=!0),a&&e&&Xt(e[dt])){var s=function(e,t,n){var r,i=null,a=Xt(e[dt]),o=Xt(e[Le]);r=e?e[oe]+"-"+e[pt]+"-"+Ls++:"Unknown-0-"+Ls++;var s={getPlugin:function(){return e},getNext:function(){return i},processTelemetry:u,unload:d,update:p,_id:r,_setNext:function(e){i=e}};function c(){var r;return e&&Xt(e[Ps])&&(r=e[Ps]()),r||(r=Os(s,t,n)),r}function l(t,n,a,o,s){var c=!1,l=e?e[oe]:As,u=t[Ns];return u||(u=t[Ns]={}),t.setNext(i),e&&Es(t[st](),(function(){return l+":"+a}),(function(){u[r]=!0;try{var e=i?i._id:at;e&&(u[e]=!1),c=n(t)}catch(s){var o=!i||u[i._id];o&&(c=!0),i&&o||di(t[Pe](),1,73,"Plugin ["+l+"] failed during "+a+" - "+Gr(s)+", run flags: "+Gr(u))}}),o,s),c}function u(t,n){function r(n){if(!e||!a)return!1;var r=Cs(e);return!r[Ee]&&!r[lt]&&(o&&e[Le](i),e[dt](t,n),!0)}l(n=n||c(),r,"processTelemetry",(function(){return{item:t}}),!t.sync)||n[ve](t)}function d(t,n){function r(){var r=!1;if(e){var i=Cs(e),a=e[st]||i[st];!e||a&&a!==t.core()||i[Ee]||(i[st]=null,i[Ee]=!0,i[ce]=!1,e[Ee]&&!0===e[Ee](t,n)&&(r=!0))}return r}l(t,r,"unload",(function(){}),n[Te])||t[ve](n)}function p(t,n){function r(){var r=!1;if(e){var i=Cs(e),a=e[st]||i[st];!e||a&&a!==t.core()||i[Ee]||e[Ae]&&!0===e[Ae](t,n)&&(r=!0)}return r}l(t,r,"update",(function(){}),!1)||t[ve](n)}return wn(s)}(e,t,n);i||(i=s),o&&o._setNext(s),o=s}}))}return r&&!i?Fs([r],t,n):i}var Bs="_aiHooks",Us=["req","rsp","hkErr","fnErr"];function zs(e,t){if(e)for(var n=0;n<e[pe]&&!t(e[n],n);n++);}function js(e,t,n,r,i){i>=0&&i<=2&&zs(e,(function(e,a){var o=e.cbks,s=o[Us[i]];if(s){t.ctx=function(){return r[a]=r[a]||{}};try{s[$e](t.inst,n)}catch(u){var c=t.err;try{var l=o[Us[2]];l&&(t.err=u,l[$e](t.inst,n))}catch(d){}finally{t.err=c}}}}))}function $s(e,t,n,r){var i=null;return e&&(Gt(e,t)?i=e:n&&(i=$s(qt(e),t,r,!1))),i}function Hs(e,t,n,r){var i=n&&n[Bs];if(!i){var a=function(e){return function(){var t,n=arguments,r=e.h,i=((t={})[ie]=e.n,t.inst=this,t.ctx=null,t.set=function(e,t){(n=s([],n))[e]=t,o=s([i],n)},t),a=[],o=s([i],n);function s(e,t){return zs(t,(function(t){e[se](t)})),e}i.evt=Or("event"),js(r,i,o,a,0);var c=e.f;if(c)try{i.rslt=c[$e](this,n)}catch(l){throw i.err=l,js(r,i,o,a,3),l}return js(r,i,o,a,1),i.rslt}}(i={i:0,n:t,f:n,h:[]});a[Bs]=i,e[t]=a}var o={id:i.i,cbks:r,rm:function(){var e=this.id;zs(i.h,(function(t,n){if(t.id===e)return i.h[ke](n,1),1}))}};return i.i++,i.h[se](o),o}function qs(e,t,n,r,i){if(void 0===r&&(r=!0),e&&t&&n){var a=$s(e,t,r,i);if(a){var o=a[t];if(typeof o===B)return Hs(a,t,o,n)}}return null}function Vs(e,t,n,r,i){if(e&&t&&n){var a=$s(e,t,r,i)||e;if(a)return Hs(a,t,a[t],n)}return null}function Zs(){var e=[];return{add:function(t){t&&e[se](t)},run:function(t,n){ln(e,(function(e){try{e(t,n)}catch(r){di(t[Pe](),2,73,"Unexpected error calling unload handler - "+Gr(r))}})),e=[]}}}var Ws="getPlugin",Gs=function(){function e(){var t,n,r,i,a,o=this;function s(e){void 0===e&&(e=null);var t=e;if(!t){var i=n||Os(null,{},o[st]);t=r&&r[Ws]?i[Re](null,r[Ws]):i[Re](null,r)}return t}function c(e,t,i){e&&kn(e,ut,[],null,Zt),!i&&t&&(i=t[me]()[Ne]());var a=r;r&&r[Ws]&&(a=r[Ws]()),o[st]=t,n=Os(i,e,t,a)}function l(){t=!1,o[st]=null,n=null,r=null,a=[],i=Zs()}l(),F(e,o,(function(e){e[re]=function(e,n,r,i){c(e,n,i),t=!0},e[Ee]=function(t,n){var o,s=e[st];if(s&&(!t||s===t[st]())){var c,u=!1,d=t||Ms(null,s,r&&r[Ws]?r[Ws]():r),p=n||((o={reason:0})[Te]=!1,o);return e[Ie]&&!0===e[Ie](d,p,f)?c=!0:f(),c}function f(){if(!u){u=!0,i.run(d,n);var e=a;a=[],ln(e,(function(e){e.rm()})),!0===c&&d[ve](p),l()}}},e[Ae]=function(t,n){var i=e[st];if(i&&(!t||i===t[st]())){var a,o=!1,s=t||Ds(null,i,r&&r[Ws]?r[Ws]():r),l=n||{reason:0};return e._doUpdate&&!0===e._doUpdate(s,l,u)?a=!0:u(),a}function u(){o||(o=!0,c(s.getCfg(),s.core(),s[Ne]()))}},e._addHook=function(e){e&&(tn(e)?a=a.concat(e):a[se](e))},An(e,"_addUnloadCb",(function(){return i}),"add")})),o[Pe]=function(e){return s(e)[Pe]()},o[ce]=function(){return t},o.setInitialized=function(e){t=e},o[Le]=function(e){r=e},o[ve]=function(e,t){t?t[ve](e):r&&Xt(r[dt])&&r[dt](e,null)},o._getTelCtx=s}return e.__ieDyn=1,e}(),Ks="toString",Xs="disableExceptionTracking",Ys="autoTrackPageVisitTime",Qs="overridePageViewDuration",Js="enableUnhandledPromiseRejectionTracking",ec="samplingPercentage",tc="isStorageUseDisabled",nc="isBrowserLinkTrackingEnabled",rc="enableAutoRouteTracking",ic="namePrefix",ac="disableFlushOnBeforeUnload",oc="core",sc="dataType",cc="envelopeType",lc="diagLog",uc="track",dc="trackPageView",pc="trackPreviousPageVisit",fc="sendPageViewInternal",vc="sendPageViewPerformanceInternal",mc="populatePageViewPerformanceEvent",hc="href",bc="sendExceptionInternal",gc="exception",yc="error",wc="_onerror",Sc="errorSrc",xc="lineNumber",kc="columnNumber",Ec="message",_c="CreateAutoException",Cc="addTelemetryInitializer",Tc="duration",Ic="length",Ac="isPerformanceTimingSupported",Nc="getPerformanceTiming",Pc="navigationStart",Lc="shouldCollectDuration",Rc="isPerformanceTimingDataReady",Oc="responseStart",Mc="loadEventEnd",Dc="responseEnd",Fc="connectEnd",Bc="pageVisitStartTime",Uc=null;var zc=function(){function e(t,n,r,i){F(e,this,(function(e){var a,o=null,s=[],c=!1;function l(e){r&&r.flush(e)}function u(){o||(o=setTimeout((function(){o=null;var e=s.slice(0),t=!1;s=[],ln(e,(function(e){e()?t=!0:s.push(e)})),s[Ic]>0&&u(),t&&l(!0)}),100))}function d(e){s.push(e),u()}r&&(a=r.logger),e[dc]=function(e,r){var o=e.name;if(Zt(o)||"string"!=typeof o){var s=Br();o=e.name=s&&s.title||""}var u=e.uri;if(Zt(u)||"string"!=typeof u){var p=$r();u=e.uri=p&&p[hc]||""}if(!i[Ac]())return t[fc](e,r),l(!0),void(function(){if(null==Uc)try{Uc=!!(self&&self instanceof WorkerGlobalScope)}catch(e){Uc=!1}return Uc}()||di(a,2,25,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info."));var f,v,m=!1,h=i[Nc]()[Pc];h>0&&(f=vs(h,+new Date),i[Lc](f)||(f=void 0)),Zt(r)||Zt(r[Tc])||(v=r[Tc]),!n&&isNaN(v)||(isNaN(v)&&(r||(r={}),r[Tc]=f),t[fc](e,r),l(!0),m=!0);r||(r={}),d((function(){var n=!1;try{if(i[Rc]()){n=!0;var s={name:o,uri:u};i[mc](s),s.isValid||m?(m||(r[Tc]=s.durationMs,t[fc](e,r)),c||(t[vc](s,r),c=!0)):(r[Tc]=f,t[fc](e,r))}else h>0&&vs(h,+new Date)>6e4&&(n=!0,m||(r[Tc]=6e4,t[fc](e,r)))}catch(l){di(a,1,38,"trackPageView failed on page load calculation: "+xn(l),{exception:Gr(l)})}return n}))},e.teardown=function(e,t){if(o){clearTimeout(o),o=null;var n=s.slice(0);s=[],ln(n,(function(e){e()&&!0}))}}}))}return e.__ieDyn=1,e}(),jc=["googlebot","adsbot-google","apis-google","mediapartners-google"];function $c(){var e=Hr();return e&&!!e.timing}function Hc(){var e=Hr(),t=e?e.timing:0;return t&&t.domainLookupStart>0&&t[Pc]>0&&t[Oc]>0&&t.requestStart>0&&t[Mc]>0&&t[Dc]>0&&t[Fc]>0&&t.domLoading>0}function qc(){return $c()?Hr().timing:null}function Vc(){return(e=Hr())&&e.getEntriesByType&&e.getEntriesByType("navigation")[Ic]>0?Hr().getEntriesByType("navigation")[0]:null;var e}function Zc(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(zr()||{}).userAgent,r=!1;if(n)for(var i=0;i<jc[Ic];i++)r=r||-1!==n.toLowerCase().indexOf(jc[i]);if(r)return!1;for(i=0;i<e[Ic];i++)if(e[i]<0||e[i]>=36e5)return!1;return!0}var Wc=function(){function e(t){var n=ci(t);F(e,this,(function(e){e[mc]=function(t){t.isValid=!1;var r=Vc(),i=qc(),a=0,o=0,s=0,c=0,l=0;(r||i)&&(r?(a=r[Tc],o=0===r.startTime?r[Fc]:vs(r.startTime,r[Fc]),s=vs(r.requestStart,r[Oc]),c=vs(r[Oc],r[Dc]),l=vs(r.responseEnd,r[Mc])):(a=vs(i[Pc],i[Mc]),o=vs(i[Pc],i[Fc]),s=vs(i.requestStart,i[Oc]),c=vs(i[Oc],i[Dc]),l=vs(i.responseEnd,i[Mc])),0===a?di(n,2,10,"error calculating page view performance.",{total:a,network:o,request:s,response:c,dom:l}):e[Lc](a,o,s,c,l)?a<Math.floor(o)+Math.floor(s)+Math.floor(c)+Math.floor(l)?di(n,2,8,"client performance math error.",{total:a,network:o,request:s,response:c,dom:l}):(t.durationMs=a,t.perfTotal=t[Tc]=fr(a),t.networkConnect=fr(o),t.sentRequest=fr(s),t.receivedResponse=fr(c),t.domProcessing=fr(l),t.isValid=!0):di(n,2,45,"Invalid page load duration value. Browser perf data won't be sent.",{total:a,network:o,request:s,response:c,dom:l}))},e[Nc]=qc,e[Ac]=$c,e[Rc]=Hc,e[Lc]=Zc}))}return e.__ieDyn=1,e}(),Gc=function(){function e(t,n){var r="prevPageVisitData";F(e,this,(function(e){e[pc]=function(e,i){try{var a=function(e,n){var i=null;try{i=function(){var e=null;try{if(_i()){var n=Sn(),i=Ci(t,r);i&&qr()&&((e=Vr().parse(i)).pageVisitTime=n-e[Bc],Ii(t,r))}}catch(a){pi(t,"Stop page visit timer failed: "+Gr(a)),e=null}return e}(),function(e,n){try{if(_i()){null!=Ci(t,r)&&Tn("Cannot call startPageVisit consecutively without first calling stopPageVisit");var i=new Kc(e,n),a=Vr().stringify(i);Ti(t,r,a)}}catch(o){pi(t,"Call to start failed: "+Gr(o))}}(e,n)}catch(a){pi(t,"Call to restart failed: "+Gr(a)),i=null}return i}(e,i);a&&n(a.pageName,a.pageUrl,a.pageVisitTime)}catch(o){pi(t,"Auto track page visit time failed, metric will not be collected: "+Gr(o))}},bn(e,"_logger",(function(){return t})),bn(e,"pageVisitTimeTrackingHandler",(function(){return n}))}))}return e.__ieDyn=1,e}(),Kc=function(e,t){this[Bc]=Sn(),this.pageName=e,this.pageUrl=t},Xc=function(e,t){var n=this,r={};n.start=function(t){void 0!==r[t]&&di(e,2,62,"start was called more than once for this event without calling stop.",{name:t,key:t},!0),r[t]=+new Date},n.stop=function(t,i,a,o){var s=r[t];if(isNaN(s))di(e,2,63,"stop was called without a corresponding start.",{name:t,key:t},!0);else{var c=vs(s,+new Date);n.action(t,i,c,a,o)}delete r[t],r[t]=void 0}};function Yc(e,t){e&&e.dispatchEvent&&t&&e.dispatchEvent(t)}var Qc=6e4;function Jc(e,t){return(e=e||t)<Qc&&(e=Qc),e}function el(e){return e||(e={}),e.sessionRenewalMs=Jc(e.sessionRenewalMs,18e5),e.sessionExpirationMs=Jc(e.sessionExpirationMs,864e5),e[Xs]=pr(e[Xs]),e[Ys]=pr(e[Ys]),e[Qs]=pr(e[Qs]),e[Js]=pr(e[Js]),(isNaN(e[ec])||e[ec]<=0||e[ec]>=100)&&(e[ec]=100),e[tc]=pr(e[tc]),e[nc]=pr(e[nc]),e[rc]=pr(e[rc]),e[ic]=e[ic]||"",e.enableDebug=pr(e.enableDebug),e[ac]=pr(e[ac]),e.disableFlushOnUnload=pr(e.disableFlushOnUnload,e[ac]),e}function tl(e){Vt(e[tc])||(e[tc]?wi():(mi=Si(!0),hi=_i(!0)))}var nl=function(e){function t(){var n,r,i,a,o,s,c,l,u,d,p,f,v,m,h=e.call(this)||this;h.identifier=Li,h.priority=180,h.autoRoutePVDelay=500;var b,g,y;return F(t,h,(function(e,t){var h=t._addHook;function w(t,n,r,i,a){e[lc]().throwInternal(t,n,r,i,a)}function S(){n=null,r=null,i=null,a=null,o=null,s=null,c=!1,l=!1,u=!1,d=!1,p=!1,f=!1,v=!1,m=!1,0;var e=$r(!0);b=e&&e[hc]||"",g=null,y=null}S(),e.getCookieMgr=function(){return Ba(e[oc])},e.processTelemetry=function(t,n){e.processNext(t,n)},e.trackEvent=function(t,n){try{var r=Qi(t,Ji[sc],Ji[cc],e[lc](),n);e[oc][uc](r)}catch(i){w(2,39,"trackTrace failed, trace will not be collected: "+xn(i),{exception:Gr(i)})}},e.startTrackEvent=function(e){try{n.start(e)}catch(t){w(1,29,"startTrackEvent failed, event will not be collected: "+xn(t),{exception:Gr(t)})}},e.stopTrackEvent=function(e,t,r){try{n.stop(e,void 0,t,r)}catch(i){w(1,30,"stopTrackEvent failed, event will not be collected: "+xn(i),{exception:Gr(i)})}},e.trackTrace=function(t,n){try{var r=Qi(t,ea[sc],ea[cc],e[lc](),n);e[oc][uc](r)}catch(i){w(2,39,"trackTrace failed, trace will not be collected: "+xn(i),{exception:Gr(i)})}},e.trackMetric=function(t,n){try{var r=Qi(t,na[sc],na[cc],e[lc](),n);e[oc][uc](r)}catch(i){w(1,36,"trackMetric failed, metric will not be collected: "+xn(i),{exception:Gr(i)})}},e[dc]=function(t,n){try{var r=t||{};i[dc](r,J(J(J({},r.properties),r.measurements),n)),e.config[Ys]&&o[pc](r.name,r.uri)}catch(a){w(1,37,"trackPageView failed, page view will not be collected: "+xn(a),{exception:Gr(a)})}},e[fc]=function(t,n,r){var i=Br();i&&(t.refUri=void 0===t.refUri?i.referrer:t.refUri);var a=Qi(t,ra[sc],ra[cc],e[lc](),n,r);e[oc][uc](a),0},e[vc]=function(t,n,r){var i=Qi(t,ia[sc],ia[cc],e[lc](),n,r);e[oc][uc](i)},e.trackPageViewPerformance=function(t,n){var r=t||{};try{a[mc](r),e[vc](r,n)}catch(i){w(1,37,"trackPageViewPerformance failed, page view will not be collected: "+xn(i),{exception:Gr(i)})}},e.startTrackPage=function(e){try{if("string"!=typeof e){var t=Br();e=t&&t.title||""}r.start(e)}catch(n){w(1,31,"startTrackPage failed, page view may not be collected: "+xn(n),{exception:Gr(n)})}},e.stopTrackPage=function(t,n,i,a){try{if("string"!=typeof t){var s=Br();t=s&&s.title||""}if("string"!=typeof n){var c=$r();n=c&&c[hc]||""}r.stop(t,n,i,a),e.config[Ys]&&o[pc](t,n)}catch(l){w(1,32,"stopTrackPage failed, page view will not be collected: "+xn(l),{exception:Gr(l)})}},e[bc]=function(t,n,r){var i=t&&(t[gc]||t[yc])||nn(t)&&t||{name:t&&typeof t,message:t||Ui};t=t||{};var a=Qi(new ga(e[lc](),i,t.properties||n,t.measurements,t.severityLevel,t.id).toInterface(),ga[sc],ga[cc],e[lc](),n,r);e[oc][uc](a)},e.trackException=function(t,n){t&&!t[gc]&&t[yc]&&(t[gc]=t[yc]);try{e[bc](t,n)}catch(r){w(1,35,"trackException failed, exception will not be collected: "+xn(r),{exception:Gr(r)})}},e[wc]=function(t){var n=t&&t[yc],r=t&&t.evt;try{if(!r){var i=Dr();i&&(r=i.event)}var a=t&&t.url||(Br()||{}).URL,o=t[Sc]||"window.onerror@"+a+":"+(t[xc]||0)+":"+(t[kc]||0),s={errorSrc:o,url:a,lineNumber:t[xc]||0,columnNumber:t[kc]||0,message:t[Ec]};vr(t.message,t.url,t.lineNumber,t.columnNumber,t[yc])?function(t,n){var r=Qi(t,ga[sc],ga[cc],e[lc](),n);e[oc][uc](r)}(ga[_c]("Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",a,t[xc]||0,t[kc]||0,n,r,null,o),s):(t[Sc]||(t[Sc]=o),e.trackException({exception:t,severityLevel:3},s))}catch(l){var c=n?n.name+", "+n[Ec]:"null";w(1,11,"_onError threw exception while logging error, error will not be collected: "+xn(l),{exception:Gr(l),errorString:c})}},e[Cc]=function(t){if(e[oc])return e[oc][Cc](t);s||(s=[]),s.push(t)},e.initialize=function(w,S,x,k){if(!e.isInitialized()){Zt(S)&&Tn("Error initializing"),t.initialize(w,S,x,k);try{y=Ro(lo(e.identifier),S.evtNamespace&&S.evtNamespace()),s&&(ln(s,(function(e){S[Cc](e)})),s=null);var E=function(t){var n=Os(null,t,e[oc]),r=e.identifier,i=el(t),a=e.config=n.getExtCfg(r);void 0!==i&&Qt(i,(function(e,t){a[e]=n.getConfig(r,e,t),void 0===a[e]&&(a=t)}));return a}(w);tl(E),a=new Wc(e[oc]),i=new zc(e,E[Qs],e[oc],a),o=new Gc(e[lc](),(function(t,n,r){return function(t,n,r){var i={PageName:t,PageUrl:n};e.trackMetric({name:"PageVisitTime",average:r,max:r,min:r,sampleCount:1},i)}(t,n,r)})),function(t,n){c=t[nc]||n[nc],function(){if(!l&&c){var t=["/browserLinkSignalR/","/__browserLink/"],n=function(e){if(c&&e.baseType===hs[sc]){var n=e.baseData;if(n)for(var r=0;r<t[Ic];r++)if(n.target&&n.target.indexOf(t[r])>=0)return!1}return!0};e[Cc](n),l=!0}}()}(E,w),(n=new Xc(e[lc](),"trackEvent")).action=function(t,n,r,i,a){i||(i={}),a||(a={}),i.duration=r[Ks](),e.trackEvent({name:t,properties:i,measurements:a})},(r=new Xc(e[lc](),"trackPageView")).action=function(t,n,r,i,a){Zt(i)&&(i={}),i.duration=r[Ks]();var o={name:t,uri:n,properties:i,measurements:a};e[fc](o,i)},Mr()&&(function(t){var n=Dr(),r=$r(!0);p=t[Xs],p||f||t.autoExceptionInstrumented||(h(Vs(n,"onerror",{ns:y,rsp:function(t,n,r,i,a,o){p||!0===t.rslt||e[wc](ga[_c](n,r,i,a,o,t.evt))}},!1)),f=!0);!function(t,n,r){v=!0===t[Js],v&&!m&&(h(Vs(n,"onunhandledrejection",{ns:y,rsp:function(t,n){v&&!0!==t.rslt&&e[wc](ga[_c](function(e){if(e&&e.reason){var t=e.reason;return!rn(t)&&Xt(t[Ks])?t[Ks]():Gr(t)}return e||""}(n),r?r[hc]:"",0,0,n,t.evt))}},!1)),m=!0,t.autoUnhandledPromiseInstrumented=m)}(t,n,r)}(E),function(t){var n=Dr(),r=$r(!0);if(u=!0===t[rc],n&&u&&jr()){var i=jr()?history:Or("history");Xt(i.pushState)&&Xt(i.replaceState)&&typeof Event!==z&&function(t,n,r,i){var a=t[ic]||"";function o(){u&&Yc(n,Jo(a+"locationchange"))}function s(){if(g?(b=g,g=i&&i[hc]||""):g=i&&i[hc]||"",u){var t=function(){var t=null;e[oc]&&e[oc].getTraceCtx&&(t=e[oc].getTraceCtx(!1));if(!t){var n=e[oc].getPlugin(Ni);if(n){var r=n.plugin.context;r&&(t=ms(r.telemetryTrace))}}return t}();if(t){t.setTraceId(jo());var n="_unknown_";i&&i.pathname&&(n=i.pathname+(i.hash||"")),t.setName(Hi(e[lc](),n))}setTimeout(function(t){e[dc]({refUri:t,properties:{duration:0}})}.bind(e,b),e.autoRoutePVDelay)}}d||(h(Vs(r,"pushState",{ns:y,rsp:function(){u&&(Yc(n,Jo(a+"pushState")),Yc(n,Jo(a+"locationchange")))}},!0)),h(Vs(r,"replaceState",{ns:y,rsp:function(){u&&(Yc(n,Jo(a+"replaceState")),Yc(n,Jo(a+"locationchange")))}},!0)),Oo(n,a+"popstate",o,y),Oo(n,a+"locationchange",s,y),d=!0)}(t,n,i,r)}}(E))}catch(_){throw e.setInitialized(!1),_}}},e._doTeardown=function(e,t){i&&i.teardown(e,t),Mo(window,null,null,y),S()},bn(e,"_pageViewManager",(function(){return i})),bn(e,"_pageViewPerformanceManager",(function(){return a})),bn(e,"_pageVisitTimeManager",(function(){return o})),bn(e,"_evtNamespace",(function(){return"."+y}))})),h}return te(t,e),t.Version="2.8.14",t.getDefaultConfig=el,t}(Gs);function rl(e){var t="ai."+e+".";return function(e){return t+e}}var il,al=rl("application"),ol=rl("device"),sl=rl("location"),cl=rl("operation"),ll=rl("session"),ul=rl("user"),dl=rl("cloud"),pl=rl("internal"),fl=function(e){function t(){return e.call(this)||this}return te(t,e),t}((il={applicationVersion:al("ver"),applicationBuild:al("build"),applicationTypeId:al("typeId"),applicationId:al("applicationId"),applicationLayer:al("layer"),deviceId:ol("id"),deviceIp:ol("ip"),deviceLanguage:ol("language"),deviceLocale:ol("locale"),deviceModel:ol("model"),deviceFriendlyName:ol("friendlyName"),deviceNetwork:ol("network"),deviceNetworkName:ol("networkName"),deviceOEMName:ol("oemName"),deviceOS:ol("os"),deviceOSVersion:ol("osVersion"),deviceRoleInstance:ol("roleInstance"),deviceRoleName:ol("roleName"),deviceScreenResolution:ol("screenResolution"),deviceType:ol("type"),deviceMachineName:ol("machineName"),deviceVMName:ol("vmName"),deviceBrowser:ol("browser"),deviceBrowserVersion:ol("browserVersion"),locationIp:sl("ip"),locationCountry:sl("country"),locationProvince:sl("province"),locationCity:sl("city"),operationId:cl("id"),operationName:cl("name"),operationParentId:cl("parentId"),operationRootId:cl("rootId"),operationSyntheticSource:cl("syntheticSource"),operationCorrelationVector:cl("correlationVector"),sessionId:ll("id"),sessionIsFirst:ll("isFirst"),sessionIsNew:ll("isNew"),userAccountAcquisitionDate:ul("accountAcquisitionDate"),userAccountId:ul("accountId"),userAgent:ul("userAgent"),userId:ul("id"),userStoreRegion:ul("storeRegion"),userAuthUserId:ul("authUserId"),userAnonymousUserAcquisitionDate:ul("anonUserAcquisitionDate"),userAuthenticatedUserAcquisitionDate:ul("authUserAcquisitionDate"),cloudName:dl("name"),cloudRole:dl("role"),cloudRoleVer:dl("roleVer"),cloudRoleInstance:dl("roleInstance"),cloudEnvironment:dl("environment"),cloudLocation:dl("location"),cloudDeploymentUnit:dl("deploymentUnit"),internalNodeName:pl("nodeName"),internalSdkVersion:pl("sdkVersion"),internalAgentVersion:pl("agentVersion"),internalSnippet:pl("snippet"),internalSdkSrc:pl("sdkSrc")},function(){var e=this;il&&Qt(il,(function(t,n){e[t]=n}))})),vl={UserExt:"user",DeviceExt:"device",TraceExt:"trace",WebExt:"web",AppExt:"app",OSExt:"os",SessionExt:"ses",SDKExt:"sdk"},ml=new fl,hl=function(e,t,n){var r=this,i=this;i.ver=1,i.sampleRate=100,i.tags={},i[Un]=Hi(e,n)||Ui,i.data=t,i.time=cn(new Date),i.aiDataContract={time:1,iKey:1,name:1,sampleRate:function(){return 100===r.sampleRate?4:1},tags:1,data:1}},bl=function(e,t){this.aiDataContract={baseType:1,baseData:1},this.baseType=e,this.baseData=t},gl="duration",yl="tags",wl="deviceType",Sl="data",xl="name",kl="traceID",El="length",_l="stringify",Cl="measurements",Tl="dataType",Il="envelopeType",Al="toString",Nl="onLine",Pl="isOnline",Ll="enqueue",Rl="count",Ol="push",Ml="emitLineDelimitedJson",Dl="clear",Fl="batchPayloads",Bl="markAsSent",Ul="clearSent",zl="bufferOverride",jl="BUFFER_KEY",$l="SENT_BUFFER_KEY",Hl="MAX_BUFFER_SIZE",ql="namePrefix",Vl="maxBatchSizeInBytes",Zl="triggerSend",Wl="diagLog",Gl="onunloadDisableBeacon",Kl="isBeaconApiDisabled",Xl="_sender",Yl="_senderConfig",Ql="enableSessionStorageBuffer",Jl="_buffer",eu="samplingPercentage",tu="instrumentationKey",nu="endpointUrl",ru="customHeaders",iu="disableXhr",au="onunloadDisableFetch",ou="disableTelemetry",su="baseType",cu="sampleRate",lu="convertUndefined",uu="_onError",du="_onPartialSuccess",pu="_onSuccess",fu="itemsAccepted",vu="isRetryDisabled",mu="setRequestHeader",hu="maxBatchInterval",bu="eventsSendRequest",gu="disableInstrumentationKeyValidation",yu="getSamplingScore",wu="baseType",Su="baseData",xu="properties",ku="true";function Eu(e,t,n){return kn(e,t,n,Cn)}function _u(e,t,n){Zt(e)||Qt(e,(function(e,r){an(r)?n[e]=r:rn(r)?t[e]=r:qr()&&(t[e]=Vr()[_l](r))}))}function Cu(e,t){Zt(e)||Qt(e,(function(n,r){e[n]=r||t}))}function Tu(e,t,n,r){var i=new hl(e,r,t);Eu(i,"sampleRate",n[Oi]),(n[Su]||{}).startTime&&(i.time=cn(n[Su].startTime)),i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i[xl]=i[xl].replace("{0}",a),function(e,t,n){var r=n[yl]=n[yl]||{},i=t.ext=t.ext||{},a=t[yl]=t[yl]||[],o=i.user;o&&(Eu(r,ml.userAuthUserId,o.authId),Eu(r,ml.userId,o.id||o.localId));var s=i.app;s&&Eu(r,ml.sessionId,s.sesId);var c=i.device;c&&(Eu(r,ml.deviceId,c.id||c.localId),Eu(r,ml[wl],c.deviceClass),Eu(r,ml.deviceIp,c.ip),Eu(r,ml.deviceModel,c.model),Eu(r,ml[wl],c[wl]));var l=t.ext.web;if(l){Eu(r,ml.deviceLanguage,l.browserLang),Eu(r,ml.deviceBrowserVersion,l.browserVer),Eu(r,ml.deviceBrowser,l.browser);var u=n[Sl]=n[Sl]||{},d=u[Su]=u[Su]||{},p=d[xu]=d[xu]||{};Eu(p,"domain",l.domain),Eu(p,"isManual",l.isManual?ku:null),Eu(p,"screenRes",l.screenRes),Eu(p,"userConsent",l.userConsent?ku:null)}var f=i.os;f&&Eu(r,ml.deviceOS,f[xl]);var v=i.trace;v&&(Eu(r,ml.operationParentId,v.parentID),Eu(r,ml.operationName,Hi(e,v[xl])),Eu(r,ml.operationId,v[kl]));for(var m={},h=a[El]-1;h>=0;h--)Qt(a[h],(function(e,t){m[e]=t})),a.splice(h,1);Qt(a,(function(e,t){m[e]=t}));var b=J(J({},r),m);b[ml.internalSdkVersion]||(b[ml.internalSdkVersion]=Hi(e,"javascript:".concat(Au.Version),64)),n[yl]=Pn(b)}(e,n,i),n[yl]=n[yl]||[],Pn(i)}function Iu(e,t){Zt(t[Su])&&di(e,1,46,"telemetryItem.baseData cannot be null.")}var Au={Version:"2.8.14"};function Nu(e,t,n){Iu(e,t);var r={},i={};t[wu]!==Ji[Tl]&&(r.baseTypeSource=t[wu]),t[wu]===Ji[Tl]?(r=t[Su][xu]||{},i=t[Su][Cl]||{}):t[Su]&&_u(t[Su],r,i),_u(t[Sl],r,i),Zt(n)||Cu(r,n);var a=t[Su][xl],o=new Ji(e,a,r,i),s=new bl(Ji[Tl],o);return Tu(e,Ji[Il],t,s)}function Pu(e,t){Mo(e,null,null,t)}var Lu,Ru=function(){function e(t,n){var r=[],i=!1;this._get=function(){return r},this._set=function(e){return r=e},F(e,this,(function(e){e[Ll]=function(a){e[Rl]()>=n.eventsLimitInMem()?i||(di(t,2,105,"Maximum in-memory buffer size reached: "+e[Rl](),!0),i=!0):r[Ol](a)},e[Rl]=function(){return r[El]},e.size=function(){for(var e=r[El],t=0;t<r[El];t++)e+=r[t][El];return n[Ml]()||(e+=2),e},e[Dl]=function(){r=[],i=!1},e.getItems=function(){return r.slice(0)},e[Fl]=function(e){return e&&e[El]>0?n[Ml]()?e.join("\n"):"["+e.join(",")+"]":null}}))}return e.__ieDyn=1,e}(),Ou=function(e){function t(n,r){var i=e.call(this,n,r)||this;return F(t,i,(function(e,t){e[Bl]=function(e){t[Dl]()},e[Ul]=function(e){}})),i}return te(t,e),t.__ieDyn=1,t}(Ru),Mu=function(e){function t(n,r){var i=e.call(this,n,r)||this,a=!1,o=r[zl]()||{getItem:Ci,setItem:Ti},s=o.getItem,c=o.setItem;return F(t,i,(function(e,i){var o=p(t[jl]),l=p(t[$l]),u=e._set(o.concat(l));function d(e,t){var n=[];return ln(t,(function(t){Xt(t)||-1!==un(e,t)||n[Ol](t)})),n}function p(e){var t=e;try{t=r[ql]&&r[ql]()?r[ql]()+"_"+t:t;var i=s(n,t);if(i){var a=Vr().parse(i);if(rn(a)&&(a=Vr().parse(a)),a&&tn(a))return a}}catch(o){di(n,1,42," storage key: "+t+", "+xn(o),{exception:Gr(o)})}return[]}function f(e,t){var i=e;try{i=r[ql]&&r[ql]()?r[ql]()+"_"+i:i;var a=JSON[_l](t);c(n,i,a)}catch(o){c(n,i,JSON[_l]([])),di(n,2,41," storage key: "+i+", "+xn(o)+". Buffer cleared",{exception:Gr(o)})}}u[El]>t[Hl]&&(u[El]=t[Hl]),f(t[$l],[]),f(t[jl],u),e[Ll]=function(r){e[Rl]()>=t[Hl]?a||(di(n,2,67,"Maximum buffer size reached: "+e[Rl](),!0),a=!0):(i[Ll](r),f(t[jl],e._get()))},e[Dl]=function(){i[Dl](),f(t[jl],e._get()),f(t[$l],[]),a=!1},e[Bl]=function(r){f(t[jl],e._set(d(r,e._get())));var i=p(t[$l]);i instanceof Array&&r instanceof Array&&((i=i.concat(r))[El]>t[Hl]&&(di(n,1,67,"Sent buffer reached its maximum size: "+i[El],!0),i[El]=t[Hl]),f(t[$l],i))},e[Ul]=function(e){var n=p(t[$l]);n=d(e,n),f(t[$l],n)}})),i}return te(t,e),t.BUFFER_KEY="AI_buffer",t.SENT_BUFFER_KEY="AI_sentBuffer",t.MAX_BUFFER_SIZE=2e3,t}(Ru),Du=function(){function e(t){F(e,this,(function(e){function n(e,a){var o="__aiCircularRefCheck",s={};if(!e)return di(t,1,48,"cannot serialize object because it is null or undefined",{name:a},!0),s;if(e[o])return di(t,2,50,"Circular reference detected while serializing object",{name:a},!0),s;if(!e.aiDataContract){if("measurements"===a)s=i(e,"number",a);else if("properties"===a)s=i(e,"string",a);else if("tags"===a)s=i(e,"string",a);else if(tn(e))s=r(e,a);else{di(t,2,49,"Attempting to serialize an object which does not implement ISerializable",{name:a},!0);try{Vr()[_l](e),s=e}catch(c){di(t,1,48,c&&Xt(c[Al])?c[Al]():"Error serializing object",null,!0)}}return s}return e[o]=!0,Qt(e.aiDataContract,(function(i,o){var c=Xt(o)?1&o():1&o,l=Xt(o)?4&o():4&o,u=2&o,d=void 0!==e[i],p=Kt(e[i])&&null!==e[i];if(!c||d||u){if(!l){var f=void 0;void 0!==(f=p?u?r(e[i],i):n(e[i],i):e[i])&&(s[i]=f)}}else di(t,1,24,"Missing required field specification. The field is required but not present on source",{field:i,name:a})})),delete e[o],s}function r(e,r){var i;if(e)if(tn(e)){i=[];for(var a=0;a<e[El];a++){var o=n(e[a],r+"["+a+"]");i[Ol](o)}}else di(t,1,54,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:r},!0);return i}function i(e,n,r){var i;return e&&(i={},Qt(e,(function(e,a){if("string"===n)void 0===a?i[e]="undefined":null===a?i[e]="null":a[Al]?i[e]=a[Al]():i[e]="invalid field: toString() is not defined.";else if("number"===n)if(void 0===a)i[e]="undefined";else if(null===a)i[e]="null";else{var o=parseFloat(a);isNaN(o)?i[e]="NaN":i[e]=o}else i[e]="invalid field: "+r+" is of unknown type.",di(t,1,i[e],null,!0)}))),i}e.serialize=function(e){var r=n(e,"root");try{return Vr()[_l](r)}catch(i){di(t,1,48,i&&Xt(i[Al])?i[Al]():"Error serializing object",null,!0)}}}))}return e.__ieDyn=1,e}(),Fu=function(){function e(){}return e.prototype.getHashCodeScore=function(t){return 100*(this.getHashCode(t)/e.INT_MAX_VALUE)},e.prototype.getHashCode=function(e){if(""===e)return 0;for(;e[El]<8;)e=e.concat(e);for(var t=5381,n=0;n<e[El];++n)t=(t<<5)+t+e.charCodeAt(n),t&=t;return Math.abs(t)},e.INT_MAX_VALUE=2147483647,e}(),Bu=function(){var e=new Fu,t=new fl;this[yu]=function(n){return n[yl]&&n[yl][t.userId]?e.getHashCodeScore(n[yl][t.userId]):n.ext&&n.ext.user&&n.ext.user.id?e.getHashCodeScore(n.ext.user.id):n[yl]&&n[yl][t.operationId]?e.getHashCodeScore(n[yl][t.operationId]):n.ext&&n.ext.telemetryTrace&&n.ext.telemetryTrace[kl]?e.getHashCodeScore(n.ext.telemetryTrace[kl]):100*Math.random()}},Uu=function(){function e(e,t){this.INT_MAX_VALUE=2147483647;var n=t||ci(null);(e>100||e<0)&&(n.throwInternal(2,58,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),e=100),this[cu]=e,this.samplingScoreGenerator=new Bu}return e.prototype.isSampledIn=function(e){var t=this[cu];return null==t||t>=100||(e.baseType===na[Tl]||this.samplingScoreGenerator[yu](e)<t)},e}();function zu(e){try{return e.responseText}catch(t){}return null}function ju(){var e,t;return(e={endpointUrl:function(){return Fi+Bi}})[Ml]=function(){return!1},e[hu]=function(){return 15e3},e[Vl]=function(){return 102400},e[ou]=function(){return!1},e[Ql]=function(){return!0},e[zl]=function(){return!1},e[vu]=function(){return!1},e[Kl]=function(){return!0},e[iu]=function(){return!1},e[au]=function(){return!1},e[Gl]=function(){return!1},e[tu]=function(){return t},e[ql]=function(){return t},e[eu]=function(){return 100},e[ru]=function(){},e[lu]=function(){return t},e.eventsLimitInMem=function(){return 1e4},e}var $u=((Lu={})[Ji.dataType]=Nu,Lu[ea.dataType]=function(e,t,n){Iu(e,t);var r=t[Su].message,i=t[Su].severityLevel,a=t[Su][xu]||{},o=t[Su][Cl]||{};_u(t[Sl],a,o),Zt(n)||Cu(a,n);var s=new ea(e,r,i,a,o),c=new bl(ea[Tl],s);return Tu(e,ea[Il],t,c)},Lu[ra.dataType]=function(e,t,n){var r;Iu(e,t);var i=t[Su];Zt(i)||Zt(i[xu])||Zt(i[xu][gl])?Zt(t[Sl])||Zt(t[Sl][gl])||(r=t[Sl][gl],delete t[Sl][gl]):(r=i[xu][gl],delete i[xu][gl]);var a,o=t[Su];((t.ext||{}).trace||{})[kl]&&(a=t.ext.trace[kl]);var s=o.id||a,c=o[xl],l=o.uri,u=o[xu]||{},d=o[Cl]||{};Zt(o.refUri)||(u.refUri=o.refUri),Zt(o.pageType)||(u.pageType=o.pageType),Zt(o.isLoggedIn)||(u.isLoggedIn=o.isLoggedIn[Al]()),Zt(o[xu])||Qt(o[xu],(function(e,t){u[e]=t})),_u(t[Sl],u,d),Zt(n)||Cu(u,n);var p=new ra(e,c,l,r,u,d,s),f=new bl(ra[Tl],p);return Tu(e,ra[Il],t,f)},Lu[ia.dataType]=function(e,t,n){Iu(e,t);var r=t[Su],i=r[xl],a=r.uri||r.url,o=r[xu]||{},s=r[Cl]||{};_u(t[Sl],o,s),Zt(n)||Cu(o,n);var c=new ia(e,i,a,void 0,o,s,r),l=new bl(ia[Tl],c);return Tu(e,ia[Il],t,l)},Lu[ga.dataType]=function(e,t,n){Iu(e,t);var r=t[Su][Cl]||{},i=t[Su][xu]||{};_u(t[Sl],i,r),Zt(n)||Cu(i,n);var a=t[Su],o=ga.CreateFromInterface(e,a,i,r),s=new bl(ga[Tl],o);return Tu(e,ga[Il],t,s)},Lu[na.dataType]=function(e,t,n){Iu(e,t);var r=t[Su],i=r[xu]||{},a=r[Cl]||{};_u(t[Sl],i,a),Zt(n)||Cu(i,n);var o=new na(e,r[xl],r.average,r.sampleCount,r.min,r.max,r.stdDev,i,a),s=new bl(na[Tl],o);return Tu(e,na[Il],t,s)},Lu[hs.dataType]=function(e,t,n){Iu(e,t);var r=t[Su][Cl]||{},i=t[Su][xu]||{};_u(t[Sl],i,r),Zt(n)||Cu(i,n);var a=t[Su];if(Zt(a))return pi(e,"Invalid input for dependency data"),null;var o=a[xu]&&a[xu][Di]?a[xu][Di]:"GET",s=new hs(e,a.id,a.target,a[xl],a[gl],a.success,a.responseCode,o,a.type,a.correlationContext,i,r),c=new bl(hs[Tl],s);return Tu(e,hs[Il],t,c)},Lu),Hu=function(e){function t(){var n,r,i,a,o,s,c,l=e.call(this)||this;l.priority=1001,l.identifier=Pi,l._senderConfig=ju();var u,d,p,f,v=0;return F(t,l,(function(e,m){function h(t,r,i,a,o,s){var c=null;if(e._appId||(c=_(s))&&c.appId&&(e._appId=c.appId),(t<200||t>=300)&&0!==t){if((301===t||307===t||308===t)&&!b(i))return void e[uu](r,o);!e[Yl][vu]()&&A(t)?(C(r),di(e[Wl](),2,40,". Response code "+t+". Will retry to send "+r[El]+" items.")):e[uu](r,o)}else if(p&&!p[Pl]()){if(!e[Yl][vu]()){C(r,10),di(e[Wl](),2,40,". Offline - Response Code: ".concat(t,". Offline status: ").concat(!p.isOnline(),". Will retry to send ").concat(r.length," items."))}}else b(i),206===t?(c||(c=_(s)),c&&!e[Yl][vu]()?e[du](r,c):e[uu](r,o)):(n=0,e[pu](r,a))}function b(t){return!(s>=10)&&(!Zt(t)&&""!==t&&t!==e[Yl][nu]()&&(e[Yl][nu]=function(){return t},++s,!0))}function g(e,t){d?d(e,!1):w(e,t)}function y(t){var n=zr(),r=e[Jl],i=e[Yl][nu](),a=e._buffer[Fl](t),o=new Blob([a],{type:"text/plain;charset=UTF-8"}),s=n.sendBeacon(i,o);return s&&(r[Bl](t),e._onSuccess(t,t[El])),s}function w(t,n){if(tn(t)&&t[El]>0&&!y(t)){for(var r=[],i=0;i<t[El];i++){var a=t[i];y([a])||r[Ol](a)}r[El]>0&&(u&&u(r,!0),di(e[Wl](),2,40,". Failed to send telemetry with Beacon API, retried with normal sender."))}}function S(t,n){var r=new XMLHttpRequest,i=e[Yl][nu]();try{r[Ri]=!0}catch(o){}r.open("POST",i,n),r[mu]("Content-type","application/json"),ds(i)&&r[mu](ts[6],ts[7]),ln(hn(c),(function(e){r[mu](e,c[e])})),r.onreadystatechange=function(){return e._xhrReadyStateChange(r,t,t[El])},r.onerror=function(n){return e[uu](t,N(r),n)};var a=e._buffer[Fl](t);r.send(a),e._buffer[Bl](t)}function x(t,n){if(tn(t)){for(var r=t[El],i=0;i<t[El];i++)r+=t[i][El];v+r<=65e3?E(t,!1):Kr()?w(t):(u&&u(t,!0),di(e[Wl](),2,40,". Failed to send telemetry with Beacon API, retried with xhrSender."))}}function k(e,t){E(e,!0)}function E(t,n){var r,i=e[Yl][nu](),a=e._buffer[Fl](t),o=new Blob([a],{type:"application/json"}),s=new Headers,l=a[El],u=!1,d=!1;ds(i)&&s.append(ts[6],ts[7]),ln(hn(c),(function(e){s.append(e,c[e])}));var p=((r={method:"POST",headers:s,body:o})[Ri]=!0,r);n||(p.keepalive=!0,u=!0,v+=l);var f=new Request(i,p);try{f[Ri]=!0}catch(m){}e._buffer[Bl](t);try{fetch(f).then((function(r){n||(v-=l,l=0),d||(d=!0,r.ok?r.text().then((function(e){h(r.status,t,r.url,t[El],r.statusText,e)})):e[uu](t,r.statusText))})).catch((function(r){n||(v-=l,l=0),d||(d=!0,e[uu](t,r.message))}))}catch(m){d||e[uu](t,Gr(m))}u&&!d&&(d=!0,e._onSuccess(t,t[El]))}function _(t){try{if(t&&""!==t){var n=Vr().parse(t);if(n&&n.itemsReceived&&n.itemsReceived>=n[fu]&&n.itemsReceived-n.itemsAccepted===n.errors[El])return n}}catch(r){di(e[Wl](),1,43,"Cannot parse the response. "+xn(r),{response:t})}return null}function C(t,i){if(void 0===i&&(i=1),t&&0!==t[El]){var a=e[Jl];a[Ul](t),n++;for(var o=0,s=t;o<s.length;o++){var c=s[o];a[Ll](c)}!function(e){var t,i=10;if(n<=1)t=i;else{var a=(Math.pow(2,n)-1)/2,o=Math.floor(Math.random()*a*i)+1;o*=e,t=Math.max(Math.min(o,3600),i)}var s=Sn()+1e3*t;r=s}(i),T()}}function T(){if(!a&&!i){var t=r?Math.max(0,r-Sn()):0,n=Math.max(e[Yl][hu](),t);a=setTimeout((function(){a=null,e[Zl](!0,null,1)}),n)}}function I(){clearTimeout(a),a=null,r=null}function A(e){return 401===e||403===e||408===e||429===e||500===e||502===e||503===e||504===e}function N(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+zu(e)||0:t}function P(t,n){var r=e[Jl],i=Dr(),a=new XDomainRequest;a.onload=function(){return e._xdrOnLoad(a,t)},a.onerror=function(n){return e[uu](t,L(a),n)};var o=i&&i.location&&i.location.protocol||"";if(0!==e[Yl][nu]().lastIndexOf(o,0))return di(e[Wl](),2,40,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void r[Dl]();var s=e[Yl][nu]().replace(/^(https?:)/,"");a.open("POST",s);var c=r[Fl](t);a.send(c),r[Bl](t)}function L(e,t){return e?"XDomainRequest,Response:"+zu(e)||0:t}function R(){e[Xl]=null,e[Jl]=null,e._appId=null,e._sample=null,c={},p=null,n=0,r=null,null,i=!1,a=null,o=null,s=0,v=0,u=null,d=null,f=null}R(),e.pause=function(){I(),i=!0},e.resume=function(){i&&(i=!1,r=null,e._buffer.size()>e._senderConfig[Vl]()&&e[Zl](!0,null,10),T())},e.flush=function(t,n,r){if(void 0===t&&(t=!0),!i){I();try{e[Zl](t,null,r||1)}catch(a){di(e[Wl](),1,22,"flush failed, telemetry will not be collected: "+xn(a),{exception:Gr(a)})}}},e.onunloadFlush=function(){if(!i)if(!1!==e._senderConfig[Gl]()&&!1!==e[Yl][Kl]()||!Kr())e.flush();else try{e[Zl](!0,g,2)}catch(t){di(e[Wl](),1,20,"failed to flush with beacon sender on page unload, telemetry will not be collected: "+xn(t),{exception:Gr(t)})}},e.addHeader=function(e,t){c[e]=t},e.initialize=function(t,i,a,c){e.isInitialized()&&di(e[Wl](),1,28,"Sender is already initialized"),m.initialize(t,i,a,c);var v=e._getTelCtx(),h=e.identifier;o=new Du(i.logger),n=0,r=null,0,e[Xl]=null,s=0;var b=e[Wl]();f=Ro(lo("Sender"),i.evtNamespace&&i.evtNamespace()),p=function(e){var t,n=Br(),r=zr(),i=!1,a=!0,o=Ro(lo("OfflineListener"),e);try{if(c(Dr())&&(i=!0),n){var s=n.body||n;s.ononline&&c(s)&&(i=!0)}i&&r&&!Zt(r[Nl])&&(a=r[Nl])}catch(d){i=!1}function c(e){var t=!1;return e&&(t=Oo(e,"online",l,o))&&Oo(e,"offline",u,o),t}function l(){a=!0}function u(){a=!1}return(t={})[Pl]=function(){var e=!0;return i?e=a:r&&!Zt(r[Nl])&&(e=r[Nl]),e},t.isListening=function(){return i},t.unload=function(){var e=Dr();if(e&&i){if(Pu(e,o),n){var t=n.body||n;Vt(t.ononline)||Pu(t,o)}i=!1}},t}(f),Qt(ju(),(function(t,n){e[Yl][t]=function(){var e=v.getConfig(h,t,n());return e||"endpointUrl"!==t||(e=n()),e}}));var g=e[Yl][Ql]()&&!(!e._senderConfig[zl]()&&!_i());e[Jl]=g?new Mu(b,e[Yl]):new Ou(b,e[Yl]),e._sample=new Uu(e[Yl][eu](),b),function(e){var t=!Zt(e[gu])&&e[gu];if(t)return!0;return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$").test(e[tu])}(t)||di(b,1,100,"Invalid Instrumentation key "+t[tu]),!ds(e._senderConfig.endpointUrl())&&e._senderConfig.customHeaders()&&e._senderConfig.customHeaders()[El]>0&&ln(e[Yl][ru](),(function(e){l.addHeader(e.header,e.value)}));var y=e[Yl],E=null;!y[iu]()&&Yr()?E=P:!y[iu]()&&Qr()&&(E=S),!E&&Xr()&&(E=k),u=E||S,!y[Kl]()&&Kr()&&(E=w),e[Xl]=E||S,d=!y[au]()&&Xr(!0)?x:Kr()?w:!y[iu]()&&Yr()?P:!y[iu]()&&Qr()?S:u},e.processTelemetry=function(n,r){var i,a=(r=e._getTelCtx(r))[Wl]();try{if(e[Yl][ou]())return;if(!n)return void di(a,1,7,"Cannot send empty telemetry");if(n.baseData&&!n[su])return void di(a,1,70,"Cannot send telemetry without baseData and baseType");if(n[su]||(n[su]="EventData"),!e[Xl])return void di(a,1,28,"Sender was not initialized");if(i=n,!e._sample.isSampledIn(i))return void di(a,2,33,"Telemetry item was sampled out and not sent",{SampleRate:e._sample[cu]});n[Oi]=e._sample[cu];var s=e[Yl][lu]()||void 0,c=n.iKey||e[Yl][tu](),l=t.constructEnvelope(n,c,a,s);if(!l)return void di(a,1,47,"Unable to create an AppInsights envelope");var u=!1;if(n[yl]&&n[yl][Mi]&&(ln(n[yl][Mi],(function(e){try{e&&!1===e(l)&&(u=!0,pi(a,"Telemetry processor check returns false"))}catch(t){di(a,1,64,"One of telemetry initializers failed, telemetry item will not be sent: "+xn(t),{exception:Gr(t)},!0)}})),delete n[yl][Mi]),u)return;var d=o.serialize(l),f=e[Jl];f.size()+d[El]>e[Yl][Vl]()&&(p&&!p[Pl]()||e[Zl](!0,null,10)),f[Ll](d),T()}catch(v){di(a,2,12,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+xn(v),{exception:Gr(v)})}e.processNext(n,r)},e._xhrReadyStateChange=function(e,t,n){4===e.readyState&&h(e.status,t,e.responseURL,n,N(e),zu(e)||e.response)},e[Zl]=function(t,n,r){if(void 0===t&&(t=!0),!i)try{var a=e[Jl];if(e[Yl][ou]())a[Dl]();else{if(a[Rl]()>0){var o=a.getItems();!function(t,n){var r=function(){var t="getNotifyMgr";if(e.core[t])return e.core[t]();return e.core._notificationManager}();if(r&&r[bu])try{r[bu](t,n)}catch(i){di(e[Wl](),1,74,"send request notification failed: "+xn(i),{exception:Gr(i)})}}(r||0,t),n?n.call(e,o,t):e[Xl](o,t)}+new Date}I()}catch(c){var s=Wr();(!s||s>9)&&di(e[Wl](),1,40,"Telemetry transmission failed, some telemetry will be lost: "+xn(c),{exception:Gr(c)})}},e._doTeardown=function(t,n){e.onunloadFlush(),p.unload(),R()},e[uu]=function(t,n,r){di(e[Wl](),2,26,"Failed to send telemetry.",{message:n}),e._buffer&&e._buffer[Ul](t)},e[du]=function(t,n){for(var r=[],i=[],a=0,o=n.errors.reverse();a<o.length;a++){var s=o[a],c=t.splice(s.index,1)[0];A(s.statusCode)?i[Ol](c):r[Ol](c)}t[El]>0&&e[pu](t,n[fu]),r[El]>0&&e[uu](r,N(null,["partial success",n[fu],"of",n.itemsReceived].join(" "))),i[El]>0&&(C(i),di(e[Wl](),2,40,"Partial success. Delivered: "+t[El]+", Failed: "+r[El]+". Will retry to send "+i[El]+" our of "+n.itemsReceived+" items"))},e[pu]=function(t,n){e._buffer&&e._buffer[Ul](t)},e._xdrOnLoad=function(t,r){var i=zu(t);if(!t||i+""!="200"&&""!==i){var a=_(i);a&&a.itemsReceived&&a.itemsReceived>a[fu]&&!e[Yl][vu]()?e[du](r,a):e[uu](r,L(t))}else n=0,e[pu](r,0)}})),l}return te(t,e),t.constructEnvelope=function(e,t,n,r){var i;return i=t===e.iKey||Zt(t)?e:J(J({},e),{iKey:t}),($u[i.baseType]||Nu)(n,i,r)},t}(Gs);function qu(e){if(!e)return{};var t=pn(e[Rn](";"),(function(e,t){var n=t[Rn]("=");if(2===n[On]){var r=n[0][Mn](),i=n[1];e[r]=i}return e}),{});if(hn(t)[On]>0){if(t.endpointsuffix){var n=t.location?t.location+".":"";t[Dn]=t[Dn]||"https://"+n+"dc."+t.endpointsuffix}t[Dn]=t[Dn]||Fi}return t}fi({Verbose:0,Information:1,Warning:2,Error:3,Critical:4}),function(){function e(){}e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e[Vn]&&e[Vn][n]&&!Zt(e[Vn][n][t])?e[Vn][n][t]:e[t],Zt(i)?r:i}}();var Vu=500,Zu="Channel has invalid priority - ";function Wu(e,t,n){t&&tn(t)&&t[pe]>0&&(ln(t=t.sort((function(e,t){return e[pt]-t[pt]})),(function(e){e[pt]<Vu&&Tn(Zu+e[oe])})),e[se]({queue:wn(t),chain:Fs(t,n[le],n)}))}var Gu=function(e){function t(){var n,r,i=e.call(this)||this;function a(){n=0,r=[]}return i.identifier="TelemetryInitializerPlugin",i.priority=199,a(),F(t,i,(function(e,t){e.addTelemetryInitializer=function(e){var t={id:n++,fn:e};return r[se](t),{remove:function(){ln(r,(function(e,n){if(e.id===t.id)return r[ke](n,1),-1}))}}},e[dt]=function(t,n){for(var i=!1,a=r[pe],o=0;o<a;++o){var s=r[o];if(s)try{if(!1===s.fn[$e](null,[t])){i=!0;break}}catch(c){di(n[Pe](),1,64,"One of telemetry initializers failed, telemetry item will not be sent: "+xn(c),{exception:Gr(c)},!0)}}i||e[ve](t,n)},e[Ie]=function(){a()}})),i}return te(t,e),t.__ieDyn=1,t}(Gs),Ku="Plugins must provide initialize method",Xu="_notificationManager",Yu="SDK is still unloading...",Qu={loggingLevelConsole:1};function Ju(e,t){return new xs(t)}function ed(e,t){var n=!1;return ln(t,(function(t){if(t===e)return n=!0,-1})),n}var td=function(){function e(){var t,n,r,i,a,o,s,c,l,u,d,p,f,v,m,h,b,g,y,w,S=0,x=!1;F(e,this,(function(e){function k(n){if(!S&&!x&&(n||e[de]&&e[de].queue[pe]>0)){var r=_n(t.diagnosticLogInterval);r&&r>0||(r=1e4),S=setInterval((function(){clearInterval(S),S=0,N()}),r)}return S}function E(){n=!1,t=Ln(!0,{},Qu),e[le]=t,e[de]=new li(t),e[xe]=[],m=new Gu,r=[],i=null,a=null,o=null,s=null,c=null,u=null,l=[],d=null,p=null,f=null,v=!1,h=null,b=lo("AIBaseCore",!0),g=Zs(),w=null}function _(){var n=Os(I(),t,e);return n[ye](k),n}function C(n){var r=function(e,t,n){var r,i=[],a={};return ln(n,(function(n){(Zt(n)||Zt(n[re]))&&Tn(Ku);var r=n[pt],o=n[oe];n&&r&&(Zt(a[r])?a[r]=o:pi(e,"Two extensions have same priority #"+r+" - "+a[r]+", "+o)),(!r||r<t)&&i[se](n)})),(r={all:n})[st]=i,r}(e[de],Vu,l);u=r[st],c=null;var i=r.all;if(f=wn(function(e,t,n){var r=[];if(e&&ln(e,(function(e){return Wu(r,e,n)})),t){var i=[];ln(t,(function(e){e[pt]>Vu&&i[se](e)})),Wu(r,i,n)}return r}(p,i,e)),d){var a=un(i,d);-1!==a&&i[ke](a,1),-1!==(a=un(u,d))&&u[ke](a,1),d._setQueue(f)}else d=function(e,t){function n(){return Os(null,t[le],t,null)}function r(e,t,n,r){var i=e?e[pe]+1:1;function a(){0==--i&&(r&&r(),r=null)}i>0&&ln(e,(function(e){if(e&&e.queue[pe]>0){var r=e.chain,o=t[Re](r);o[ye](a),n(o)}else i--})),a()}var i=!1,a={identifier:"ChannelControllerPlugin",priority:Vu,initialize:function(t,n,r,a){i=!0,ln(e,(function(e){e&&e.queue[pe]>0&&Ts(Os(e.chain,t,n),r)}))},isInitialized:function(){return i},processTelemetry:function(t,i){r(e,i||n(),(function(e){e[ve](t)}),(function(){i[ve](t)}))},update:function(t,n){var i=n||{reason:0};return r(e,t,(function(e){e[ve](i)}),(function(){t[ve](i)})),!0},pause:function(){r(e,n(),(function(e){e.iterate((function(e){e.pause&&e.pause()}))}),null)},resume:function(){r(e,n(),(function(e){e.iterate((function(e){e.resume&&e.resume()}))}),null)},teardown:function(t,n){var a=n||{reason:0,isAsync:!1};return r(e,t,(function(e){e[ve](a)}),(function(){t[ve](a),i=!1})),!0},getChannel:function(t){var n=null;return e&&e[pe]>0&&ln(e,(function(e){if(e&&e.queue[pe]>0&&(ln(e.queue,(function(e){if(e[oe]===t)return n=e,-1})),n))return-1})),n},flush:function(t,i,a,o){var s=1,c=!1,l=null;function u(){s--,c&&0===s&&(l&&(clearTimeout(l),l=null),i&&i(c),i=null)}return o=o||5e3,r(e,n(),(function(e){e.iterate((function(e){if(e[Se]){s++;var n=!1;e[Se](t,(function(){n=!0,u()}),a)||n||(t&&null==l?l=setTimeout((function(){l=null,u()}),o):u())}}))}),(function(){c=!0,u()})),!0},_setQueue:function(t){e=t}};return a}(f,e);i[se](d),u[se](d),e[xe]=Is(i),d[re](t,e,i),Ts(_(),i),e[xe]=wn(Is(u||[])).slice(),n&&function(t){var n=Ds(I(),e);n[ye](k),e._updateHook&&!0===e._updateHook(n,t)||n[ve](t)}(n)}function T(t){var n,r=null,i=null;return ln(e[xe],(function(e){if(e[oe]===t&&e!==d&&e!==m)return i=e,-1})),!i&&d&&(i=d.getChannel(t)),i&&((n={plugin:i})[Ue]=function(e){Cs(i)[lt]=!e},n.isEnabled=function(){var e=Cs(i);return!e[Ee]&&!e[lt]},n.remove=function(e,t){var n;void 0===e&&(e=!0);var r=[i],a=((n={reason:1})[Te]=e,n);A(r,a,(function(e){e&&C({reason:32,removed:r}),t&&t(e)}))},r=n),r}function I(){if(!c){var n=(u||[]).slice();-1===un(n,m)&&n[se](m),c=Fs(Is(n),t,e)}return c}function A(n,r,i){if(n&&n[pe]>0){var a=Ms(Fs(n,t,e),e);a[ye]((function(){var e=!1,t=[];ln(l,(function(r,i){ed(r,n)?e=!0:t[se](r)})),l=t;var r=[];p&&(ln(p,(function(t,i){var a=[];ln(t,(function(t){ed(t,n)?e=!0:a[se](t)})),r[se](a)})),p=r),i&&i(e),k()})),a[ve](r)}else i(!1)}function N(){if(e[de]&&e[de].queue){var n=e[de].queue.slice(0);e[de].queue[pe]=0,ln(n,(function(n){var r,i=((r={})[ie]=h||"InternalMessageId: "+n[_e],r.iKey=_n(t[ue]),r.time=cn(new Date),r.baseType=si.dataType,r.baseData={message:n[Ce]},r);e.track(i)}))}}function P(e,t,n,r){return d?d[Se](e,t,n||6,r):(t&&t(!1),!0)}function L(t){var n=e[de];n?(di(n,2,73,t),k()):Tn(t)}E(),e[ce]=function(){return n},e[re]=function(r,a,s,c){v&&Tn(Yu),e[ce]()&&Tn("Core should not be initialized more than once"),t=r||{},e[le]=t,Zt(r[ue])&&Tn("Please provide instrumentation key"),i=c,e[Xu]=c,function(){var e=_n(t.disableDbgExt);!0===e&&y&&(i[be](y),y=null);i&&!y&&!0!==e&&(y=ii(t),i[he](y))}(),function(){var e=_n(t.enablePerfMgr);!e&&o&&(o=null);e&&En(t,ct,Ju)}(),En(t,ut,{}).NotificationManager=i,s&&(e[de]=s);var u=En(t,"extensions",[]);(l=[])[se].apply(l,ne(ne([],a),u)),p=En(t,ot,[]),C(null),f&&0!==f[pe]||Tn("No "+ot+" available"),n=!0,e.releaseQueue()},e.getTransmissionControls=function(){var e=[];return f&&ln(f,(function(t){e[se](t.queue)})),wn(e)},e.track=function(n){n.iKey=n.iKey||t[ue],n[fe]=n[fe]||cn(new Date),n.ver=n.ver||"4.0",!v&&e[ce]()?_()[ve](n):r[se](n)},e[me]=_,e[ae]=function(){return i||(i=function(){var e;return Q(((e={})[he]=function(e){},e[be]=function(e){},e[ft]=function(e){},e[vt]=function(e,t){},e[mt]=function(e,t){},e))}(),e[Xu]=i),i},e[he]=function(e){i&&i[he](e)},e[be]=function(e){i&&i[be](e)},e.getCookieMgr=function(){return s||(s=Ua(t,e[de])),s},e.setCookieMgr=function(e){s=e},e[yt]=function(){if(!a&&!o&&_n(t.enablePerfMgr)){var n=_n(t[ct]);Xt(n)&&(o=n(e,e[ae]()))}return a||o||ws},e.setPerfMgr=function(e){a=e},e.eventCnt=function(){return r[pe]},e.releaseQueue=function(){if(n&&r[pe]>0){var e=r;r=[],ln(e,(function(e){_()[ve](e)}))}},e.pollInternalLogs=function(e){return h=e||null,x=!1,S&&(clearInterval(S),S=null),k(!0)},e[ge]=function(){x=!0,S&&(clearInterval(S),S=0,N())},Nn(e,(function(){return m}),["addTelemetryInitializer"]),e.unload=function(t,r,i){var a;void 0===t&&(t=!0),n||Tn("SDK is not initialized"),v&&Tn(Yu);var o=((a={reason:50})[Te]=t,a.flushComplete=!1,a),s=Ms(I(),e);function c(t){o.flushComplete=t,v=!0,g.run(s,o),e[ge](),s[ve](o)}s[ye]((function(){E(),r&&r(o)}),e),N(),P(t,c,6,i)||c(!1)},e[we]=T,e.addPlugin=function(e,t,n,r){if(!e)return r&&r(!1),void L(Ku);var i=T(e[oe]);if(i&&!t)return r&&r(!1),void L("Plugin ["+e[oe]+"] is already loaded!");var a={reason:16};function o(t){l[se](e),a.added=[e],C(a),r&&r(!0)}if(i){var s=[i.plugin];A(s,{reason:2,isAsync:!!n},(function(e){e?(a.removed=s,a.reason|=32,o()):r&&r(!1)}))}else o()},e.evtNamespace=function(){return b},e[Se]=P,e.getTraceCtx=function(e){var t,n;return w||(n={},w={getName:function(){return n[ie]},setName:function(e){t&&t.setName(e),n[ie]=e},getTraceId:function(){return n[tt]},setTraceId:function(e){t&&t.setTraceId(e),Xo(e)&&(n[tt]=e)},getSpanId:function(){return n[nt]},setSpanId:function(e){t&&t.setSpanId(e),Yo(e)&&(n[nt]=e)},getTraceFlags:function(){return n[rt]},setTraceFlags:function(e){t&&t.setTraceFlags(e),n[rt]=e}}),w},e.setTraceCtx=function(e){w=e||null},An(e,"addUnloadCb",(function(){return g}),"add")}))}return e.__ieDyn=1,e}();function nd(e,t,n,r){ln(e,(function(e){if(e&&e[t])if(n)setTimeout((function(){return r(e)}),0);else try{r(e)}catch(i){}}))}var rd=function(){function e(t){this.listeners=[];var n=!!(t||{}).perfEvtsSendAll;F(e,this,(function(e){e[he]=function(t){e.listeners[se](t)},e[be]=function(t){for(var n=un(e[Xe],t);n>-1;)e.listeners[ke](n,1),n=un(e[Xe],t)},e[ft]=function(t){nd(e[Xe],ft,!0,(function(e){e[ft](t)}))},e[vt]=function(t,n){nd(e[Xe],vt,!0,(function(e){e[vt](t,n)}))},e[mt]=function(t,n){nd(e[Xe],mt,n,(function(e){e[mt](t,n)}))},e[ht]=function(t){t&&(!n&&t[Ye]()||nd(e[Xe],ht,!1,(function(e){t[Te]?setTimeout((function(){return e[ht](t)}),0):e[ht](t)})))}}))}return e.__ieDyn=1,e}(),id=function(e){function t(){var n=e.call(this)||this;return F(t,n,(function(e,t){function n(t){var n=e[ae]();n&&n[vt]([t],2)}e[re]=function(e,n,r,i){t[re](e,n,r||new li(e),i||new rd(e))},e.track=function(r){Es(e[yt](),(function(){return"AppInsightsCore:track"}),(function(){null===r&&(n(r),Tn("Invalid telemetry item")),function(e){Zt(e[ie])&&(n(e),Tn("telemetry name required"))}(r),t.track(r)}),(function(){return{item:r}}),!r.sync)}})),n}return te(t,e),t.__ieDyn=1,t}(td),ad="duration",od="properties",sd="requestUrl",cd="inst",ld="length",ud="traceID",dd="spanID",pd="traceFlags",fd="context",vd="aborted",md="traceId",hd="spanId",bd="core",gd="includeCorrelationHeaders",yd="canIncludeCorrelationHeader",wd="getAbsoluteUrl",Sd="headers",xd="requestHeaders",kd="appId",Ed="setRequestHeader",_d="trackDependencyDataInternal",Cd="distributedTracingMode",Td="startTime",Id="toLowerCase",Ad="enableRequestHeaderTracking",Nd="enableAjaxErrorStatusText",Pd="enableAjaxPerfTracking",Ld="maxAjaxCallsPerView",Rd="enableResponseHeaderTracking",Od="excludeRequestFromAutoTrackingPatterns",Md="addRequestContext",Dd="disableAjaxTracking",Fd="disableFetchTracking",Bd="status",Ud="statusText",zd="headerMap",jd="openDone",$d="sendDone",Hd="requestSentTime",qd="abortDone",Vd="getTraceId",Zd="getTraceFlags",Wd="method",Gd="errorStatusText",Kd="stateChangeAttached",Xd="responseFinishedTime",Yd="CreateTrackItem",Qd="response",Jd="getAllResponseHeaders",ep="getPartAProps",tp="getCorrelationContext",np="perfMark",rp="name",ip="perfTiming",ap="ajaxTotalDuration",op="eventTraceCtx";function sp(e,t,n){var r=0,i=e[t],a=e[n];return i&&a&&(r=vs(i,a)),r}function cp(e,t,n,r,i){var a=0,o=sp(n,r,i);return o&&(a=lp(e,t,fr(o))),a}function lp(e,t,n){var r="ajaxPerf",i=0;e&&t&&n&&((e[r]=e[r]||{})[t]=n,i=1);return i}var up=function(){var e=this;e[jd]=!1,e.setRequestHeaderDone=!1,e[$d]=!1,e[qd]=!1,e[Kd]=!1},dp=function(){function e(t,n,r,i){var a,o=this,s=r;o[np]=null,o.completed=!1,o.requestHeadersSize=null,o[xd]=null,o.responseReceivingDuration=null,o.callbackDuration=null,o[ap]=null,o[vd]=0,o.pageUrl=null,o[sd]=null,o.requestSize=0,o[Wd]=null,o[Bd]=null,o[Hd]=null,o.responseStartedTime=null,o[Xd]=null,o.callbackFinishedTime=null,o.endTime=null,o.xhrMonitoringState=new up,o.clientFailure=0,o[ud]=t,o[dd]=n,o[pd]=null==i?void 0:i.getTraceFlags(),o[op]=i?((a={})[md]=i[Vd](),a[hd]=i.getSpanId(),a[pd]=i[Zd](),a):null,F(e,o,(function(e){e.getAbsoluteUrl=function(){return e[sd]?os(e[sd]):null},e.getPathName=function(){return e[sd]?qi(s,ss(e[Wd],e[sd])):null},e[Yd]=function(t,n,r){var i;if(e.ajaxTotalDuration=Math.round(1e3*vs(e.requestSentTime,e.responseFinishedTime))/1e3,e[ap]<0)return null;var a=((i={id:"|"+e[ud]+"."+e[dd],target:e[wd]()})[rp]=e.getPathName(),i.type=t,i[Td]=null,i.duration=e[ap],i.success=+e[Bd]>=200&&+e[Bd]<400,i.responseCode=+e[Bd],i[od]={HttpMethod:e[Wd]},i),o=a[od];if(e[vd]&&(o[vd]=!0),e[Hd]&&(a[Td]=new Date,a[Td].setTime(e[Hd])),function(e,t){var n=e[ip],r=t[od]||{},i=0,a="name",o="Start",s="End",c="domainLookup",l="connect",u="redirect",d="request",p="response",f="startTime",v=c+o,m=c+s,h=l+o,b=l+s,g=d+o,y=d+s,w=p+o,S=p+s,x=u+o,k=u=s,E="transferSize",_="encodedBodySize",C="decodedBodySize",T="serverTiming";if(n){i|=cp(r,u,n,x,k),i|=cp(r,c,n,v,m),i|=cp(r,l,n,h,b),i|=cp(r,d,n,g,y),i|=cp(r,p,n,w,S),i|=cp(r,"networkConnect",n,f,b),i|=cp(r,"sentRequest",n,g,S);var I=n[ad];I||(I=sp(n,f,S)||0),i|=lp(r,ad,I),i|=lp(r,"perfTotal",I);var A=n[T];if(A){var N={};ln(A,(function(e,t){var n=Yt(e[a]||""+t),r=N[n]||{};Qt(e,(function(e,t){(e!==a&&rn(t)||an(t))&&(r[e]&&(t=r[e]+";"+t),!t&&rn(t)||(r[e]=t))})),N[n]=r})),i|=lp(r,T,N)}i|=lp(r,E,n[E]),i|=lp(r,_,n[_]),i|=lp(r,C,n[C])}else e[np]&&(i|=lp(r,"missing",e.perfAttempts));i&&(t[od]=r)}(e,a),n&&hn(e.requestHeaders)[ld]>0&&(o[xd]=e[xd]),r){var s=r();if(s){var c=s.correlationContext;if(c&&(a.correlationContext=c),s[zd]&&hn(s.headerMap)[ld]>0&&(o.responseHeaders=s[zd]),e[Gd])if(e[Bd]>=400){var l=s.type;""!==l&&"text"!==l||(o.responseText=s.responseText?s[Ud]+" - "+s.responseText:s[Ud]),"json"===l&&(o.responseText=s.response?s[Ud]+" - "+JSON.stringify(s[Qd]):s[Ud])}else 0===e[Bd]&&(o.responseText=s[Ud]||"")}}return a},e[ep]=function(){var t,n=null,r=e[op];if(r&&(r[md]||r[hd])){var i=(n={})[vl.TraceExt]=((t={})[ud]=r[md],t.parentID=r[hd],t);Zt(r[pd])||(i[pd]=r[pd])}return n}}))}return e.__ieDyn=1,e}(),pp="ai.ajxmn.",fp="diagLog",vp="ajaxData",mp="fetch",hp="Failed to monitor XMLHttpRequest",bp=", monitoring data for this ajax call ",gp=bp+"may be incorrect.",yp=bp+"won't be sent.",wp="Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",Sp="Failed to add custom defined request context as configured call back may missing a null check.",xp="Failed to calculate the duration of the ",kp=0;var Ep=null;function _p(e){var t="";try{e&&e[vp]&&e[vp][sd]&&(t+="(url: '"+e[vp][sd]+"')")}catch(n){}return t}function Cp(e,t,n,r,i){di(e[fp](),1,t,n,r,i)}function Tp(e,t,n,r,i){di(e[fp](),2,t,n,r,i)}function Ip(e,t,n){return function(r){Cp(e,t,n,{ajaxDiagnosticsMessage:_p(r[cd]),exception:Gr(r.err)})}}function Ap(e,t){return e&&t?e.indexOf(t):-1}function Np(e,t,n){var r={id:t,fn:n};return e.push(r),{remove:function(){ln(e,(function(t,n){if(t.id===r.id)return e.splice(n,1),-1}))}}}function Pp(e,t,n,r){var i=!0;return ln(t,(function(t,a){try{!1===t.fn.call(null,n)&&(i=!1)}catch(o){di(e&&e.logger,1,64,"Dependency "+r+" [#"+a+"] failed: "+xn(o),{exception:Gr(o)},!0)}})),i}var Lp="*.blob.core.",Rp=yn([Lp+"windows.net",Lp+"chinacloudapi.cn",Lp+"cloudapi.de",Lp+"usgovcloudapi.net"]),Op=[/https:\/\/[^\/]*(\.pipe\.aria|aria\.pipe|events\.data|collector\.azure)\.[^\/]+\/(OneCollector\/1|Collector\/3)\.0/i];function Mp(){return{maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!1,excludeRequestFromAutoTrackingPatterns:void 0,disableCorrelationHeaders:!1,distributedTracingMode:1,correlationHeaderExcludedDomains:Rp,correlationHeaderDomains:void 0,correlationHeaderExcludePatterns:void 0,appId:void 0,enableCorsCorrelation:!1,enableRequestHeaderTracking:!1,enableResponseHeaderTracking:!1,enableAjaxErrorStatusText:!1,enableAjaxPerfTracking:!1,maxAjaxPerfLookupAttempts:3,ajaxPerfLookupDelay:25,ignoreHeaders:["Authorization","X-API-Key","WWW-Authenticate"],addRequestContext:void 0,addIntEndpoints:!0}}function Dp(){var e=Mp();return Qt(e,(function(t){e[t]=void 0})),e}var Fp=function(e){function t(){var n,r,i,a,o,s,c,l,u,d,p,f,v,m,h,b,g,y,w,S,x,k,E,_=e.call(this)||this;return _.identifier=t.identifier,_.priority=120,F(t,_,(function(e,_){var C=_._addHook;function T(){var e=$r();n=!1,r=!1,i=e&&e.host&&e.host[Id](),a=t.getEmptyConfig(),o=!1,s=!1,c=0,l=null,u=!1,d=!1,p=null,f=!1,v=0,m=!1,h={},b=!1,g=!1,y=null,w=null,S=null,x=0,k=[],E=[]}function I(e){var t=!0;return(e||a.ignoreHeaders)&&ln(a.ignoreHeaders,(function(n){if(n[Id]()===e[Id]())return t=!1,-1})),t}function A(e,t,n){C(function(e,t,n){return e?qs(e[j],t,n,!1):null}(e,t,n))}function N(e,t,n){var r=!1,i=((rn(t)?t:(t||{}).url||"")||"")[Id]();if(ln(y,(function(e){var t=e;rn(e)&&(t=new RegExp(e)),r||(r=t.test(i))})),r)return r;var a=Ap(i,"?"),o=Ap(i,"#");return(-1===a||-1!==o&&o<a)&&(a=o),-1!==a&&(i=i.substring(0,a)),Zt(e)?Zt(t)||(r="object"==typeof t&&!0===t[Ri]||!!n&&!0===n[Ri]):r=!0===e[Ri]||!0===i[Ri],!r&&i&&ds(i)&&(r=!0),r?h[i]||(h[i]=1):h[i]&&(r=!0),r}function P(e,t){var n=!0,i=r;return Zt(e)||(n=!0===t||!Zt(e[vp])),i&&n}function L(){var t=null;return e[bd]&&e[bd].getTraceCtx&&(t=e[bd].getTraceCtx(!1)),!t&&l&&l.telemetryTrace&&(t=ms(l.telemetryTrace)),t}function R(e){try{var t=e.responseType;if(""===t||"text"===t)return e.responseText}catch(n){}return null}function O(t){try{var n=t[Jd]();if(null!==n)if(-1!==Ap(n[Id](),ts[8])){var r=t.getResponseHeader(ts[0]);return ps[tp](r)}}catch(i){Tp(e,18,wp,{ajaxDiagnosticsMessage:_p(t),exception:Gr(i)})}}function M(e,t){if(t[sd]&&p&&f){var n=Hr();if(n&&Xt(n.mark)){kp++;var r=p+e+"#"+kp;n.mark(r);var i=n.getEntriesByName(r);i&&1===i[ld]&&(t[np]=i[0])}}}function D(e,t,n,r){var i=t[np],o=Hr(),s=a.maxAjaxPerfLookupAttempts,c=a.ajaxPerfLookupDelay,l=t[sd],u=0;!function a(){try{if(o&&i){u++;for(var d=null,p=o.getEntries(),f=p[ld]-1;f>=0;f--){var v=p[f];if(v){if("resource"===v.entryType)v.initiatorType!==e||-1===Ap(v[rp],l)&&-1===Ap(l,v[rp])||(d=v);else if("mark"===v.entryType&&v[rp]===i[rp]){t[ip]=d;break}if(v[Td]<i[Td]-1e3)break}}}!i||t[ip]||u>=s||!1===t.async?(i&&Xt(o.clearMarks)&&o.clearMarks(i[rp]),t.perfAttempts=u,n()):setTimeout(a,c)}catch(m){r(m)}}()}function F(t){var n="";try{Zt(t)||(n+="(url: '".concat("string"==typeof t?t:t.url,"')"))}catch(r){Cp(e,15,"Failed to grab failed fetch diagnostics message",{exception:Gr(r)})}return n}function B(t,n,r,i,a,s,c){function l(t,n,i){var a=i||{};a.fetchDiagnosticsMessage=F(r),n&&(a.exception=Gr(n)),Tp(e,t,xp+"fetch call"+yp,a)}a&&(a[Xd]=fs(),a[Bd]=n,D(mp,a,(function(){var t,c=a[Yd]("Fetch",o,s);try{w&&(t=w({status:n,request:r,response:i}))}catch(d){Tp(e,104,Sp)}if(c){void 0!==t&&(c[od]=J(J({},c.properties),t));var u=a[ep]();z(E,e[bd],a,c,null,u)}else l(14,null,{requestSentTime:a[Hd],responseFinishedTime:a[Xd]})}),(function(e){l(18,e,null)})))}function U(t){if(t&&t[Sd])try{var n=t[Sd].get(ts[0]);return ps[tp](n)}catch(r){Tp(e,18,wp,{fetchDiagnosticsMessage:F(t),exception:Gr(r)})}}function z(t,n,r,i,a,o){var s=!0;t[ld]>0&&(s=Pp(n,t,{item:i,properties:a,sysProperties:o,context:r?r[fd]:null,aborted:!!r&&!!r[vd]},"initializer"));s&&e[_d](i,a,o)}T(),e.initialize=function(i,c,h,x){var k;e.isInitialized()||(_.initialize(i,c,h,x),S=Ro(lo("ajax"),c&&c.evtNamespace&&c.evtNamespace()),function(n){var r=Os(null,n,e[bd]);a=Dp(),Qt(Mp(),(function(e,n){a[e]=r.getConfig(t.identifier,e,n)}));var i=a[Cd];if(o=a[Ad],s=a[Nd],f=a[Pd],v=a[Ld],m=a[Rd],y=[].concat(a[Od]||[],!1!==a.addIntEndpoints?Op:[]),w=a[Md],d=0===i||1===i,u=1===i||2===i,f){var c=n.instrumentationKey||"unkwn";p=c[ld]>5?pp+c.substring(c[ld]-5)+".":pp+c+"."}b=!!a[Dd],g=!!a[Fd]}(i),!function(e){var t=!1;if(Qr()){var n=XMLHttpRequest[j];t=!(Zt(n)||Zt(n.open)||Zt(n.send)||Zt(n.abort))}var r=Wr();if(r&&r<9&&(t=!1),t)try{(new XMLHttpRequest)[vp]={};var i=XMLHttpRequest[j].open;XMLHttpRequest[j].open=i}catch(a){t=!1,Cp(e,15,"Failed to enable XMLHttpRequest monitoring, extension is not supported",{exception:Gr(a)})}return t}(e)||b||r||(A(XMLHttpRequest,"open",{ns:S,req:function(t,n,r,i){if(!b){var a=t[cd],c=a[vp];!N(a,r)&&P(a,!0)&&(c&&c.xhrMonitoringState[jd]||function(t,n,r,i){var a,o=L(),c=o&&o[Vd]()||jo(),l=jo().substr(0,16),u=new dp(c,l,e[fp](),null===(a=e.core)||void 0===a?void 0:a.getTraceCtx());u[pd]=o&&o[Zd](),u[Wd]=n,u[sd]=r,u.xhrMonitoringState[jd]=!0,u[xd]={},u.async=i,u[Gd]=s,t[vp]=u}(a,n,r,i),function(t){t[vp].xhrMonitoringState[Kd]=Oo(t,"readystatechange",(function(){try{t&&4===t.readyState&&P(t)&&function(t){var n=t[vp];function r(n,r){var i=r||{};i.ajaxDiagnosticsMessage=_p(t),n&&(i.exception=Gr(n)),Tp(e,14,xp+"ajax call"+yp,i)}n[Xd]=fs(),n[Bd]=t[Bd],D("xmlhttprequest",n,(function(){try{var i=n[Yd]("Ajax",o,(function(){var e={statusText:t[Ud],headerMap:null,correlationContext:O(t),type:t.responseType,responseText:R(t),response:t[Qd]};if(m){var n=t[Jd]();if(n){var r=fn(n).split(/[\r\n]+/),i={};ln(r,(function(e){var t=e.split(": "),n=t.shift(),r=t.join(": ");I(n)&&(i[n]=r)})),e[zd]=i}}return e})),a=void 0;try{w&&(a=w({status:t[Bd],xhr:t}))}catch(c){Tp(e,104,Sp)}if(i){void 0!==a&&(i[od]=J(J({},i.properties),a));var s=n[ep]();z(E,e[bd],n,i,null,s)}else r(null,{requestSentTime:n[Hd],responseFinishedTime:n[Xd]})}finally{try{t[vp]=null}catch(c){}}}),(function(e){r(e,null)}))}(t)}catch(r){var n=Gr(r);n&&-1!==Ap(n[Id](),"c00c023f")||Cp(e,16,hp+" 'readystatechange' event handler"+gp,{ajaxDiagnosticsMessage:_p(t),exception:n})}}),S)}(a))}},hkErr:Ip(e,15,hp+".open"+gp)}),A(XMLHttpRequest,"send",{ns:S,req:function(t,n){if(!b){var r=t[cd],i=r[vp];P(r)&&!i.xhrMonitoringState[$d]&&(M("xhr",i),i[Hd]=fs(),e[gd](i,void 0,void 0,r),i.xhrMonitoringState[$d]=!0)}},hkErr:Ip(e,17,hp+gp)}),A(XMLHttpRequest,"abort",{ns:S,req:function(e){if(!b){var t=e[cd],n=t[vp];P(t)&&!n.xhrMonitoringState[qd]&&(n[vd]=1,n.xhrMonitoringState[qd]=!0)}},hkErr:Ip(e,13,hp+".abort"+gp)}),A(XMLHttpRequest,"setRequestHeader",{ns:S,req:function(e,t,n){if(!b&&o){var r=e[cd];P(r)&&I(t)&&(r[vp][xd][t]=n)}},hkErr:Ip(e,71,hp+".setRequestHeader"+gp)}),r=!0),function(){var t=(i=X(),!i||Zt(i.Request)||Zt(i.Request[j])||Zt(i[mp])?null:i[mp]);var i;if(!t)return;var a=X(),c=t.polyfill;g||n?c&&C(qs(a,mp,{ns:S,req:function(e,t,n){N(null,t,n)}})):(C(qs(a,mp,{ns:S,req:function(t,i,a){var l;if(!g&&n&&!N(null,i,a)&&(!c||!r)){var u=t.ctx();l=function(t,n){var r,i=L(),a=i&&i[Vd]()||jo(),c=jo().substr(0,16),l=new dp(a,c,e[fp](),null===(r=e.core)||void 0===r?void 0:r.getTraceCtx());l[pd]=i&&i[Zd](),l[Hd]=fs(),l[Gd]=s,t instanceof Request?l[sd]=t?t.url:"":l[sd]=t;var u="GET";n&&n[Wd]?u=n[Wd]:t&&t instanceof Request&&(u=t[Wd]);l[Wd]=u;var d={};if(o){new Headers((n?n[Sd]:0)||t instanceof Request&&t[Sd]||{}).forEach((function(e,t){I(t)&&(d[t]=e)}))}return l[xd]=d,M(mp,l),l}(i,a);var d=e[gd](l,i,a);d!==a&&t.set(1,d),u.data=l}},rsp:function(e,t){if(!g){var n=e.ctx().data;n&&(e.rslt=e.rslt.then((function(r){return B(e,(r||{})[Bd],t,r,n,(function(){var e={statusText:(r||{})[Ud],headerMap:null,correlationContext:U(r)};if(m&&r){var t={};r.headers.forEach((function(e,n){I(n)&&(t[n]=e)})),e[zd]=t}return e})),r})).catch((function(r){throw B(e,0,t,null,n,null,{error:r.message||Gr(r)}),r})))}},hkErr:Ip(e,15,"Failed to monitor Window.fetch"+gp)},!0,function(){if(null==Ep)try{Ep=!!(self&&self instanceof WorkerGlobalScope)}catch(e){Ep=!1}return Ep}())),n=!0);c&&(a[mp].polyfill=c)}(),(k=e[bd].getPlugin(Ni))&&(l=k.plugin[fd]))},e._doTeardown=function(){T()},e.trackDependencyData=function(t,n){z(E,e[bd],null,t,n)},e[gd]=function(t,n,r,s){var c=e._currentWindowHost||i;if(function(e,t,n,r,i,a){if(e[ld]>0){var o={core:t,xhr:r,input:i,init:a,traceId:n[ud],spanId:n[dd],traceFlags:n[pd],context:n[fd]||{},aborted:!!n[vd]};Pp(t,e,o,"listener"),n[ud]=o[md],n[dd]=o[hd],n[pd]=o[pd],n[fd]=o[fd]}}(k,e[bd],t,s,n,r),n){if(ps[yd](a,t[wd](),c)){r||(r={});var p=new Headers(r[Sd]||n instanceof Request&&n[Sd]||{});if(d){var f="|"+t[ud]+"."+t[dd];p.set(ts[3],f),o&&(t[xd][ts[3]]=f)}if((m=a[kd]||l&&l[kd]())&&(p.set(ts[0],ts[2]+m),o&&(t[xd][ts[0]]=ts[2]+m)),u){Zt(h=t[pd])&&(h=1);var v=Qo(Ko(t[ud],t[dd],h));p.set(ts[4],v),o&&(t[xd][ts[4]]=v)}r[Sd]=p}return r}if(s){if(ps[yd](a,t[wd](),c)){if(d){f="|"+t[ud]+"."+t[dd];s[Ed](ts[3],f),o&&(t[xd][ts[3]]=f)}var m;if((m=a[kd]||l&&l[kd]())&&(s[Ed](ts[0],ts[2]+m),o&&(t[xd][ts[0]]=ts[2]+m)),u){var h;Zt(h=t[pd])&&(h=1);v=Qo(Ko(t[ud],t[dd],h));s[Ed](ts[4],v),o&&(t[xd][ts[4]]=v)}}return s}},e[_d]=function(t,n,r){if(-1===v||c<v){2!==a[Cd]&&1!==a[Cd]||"string"!=typeof t.id||"."===t.id[t.id[ld]-1]||(t.id+="."),Zt(t[Td])&&(t[Td]=new Date);var i=Qi(t,hs.dataType,hs.envelopeType,e[fp](),n,r);e[bd].track(i)}else c===v&&Cp(e,55,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++c},e.addDependencyListener=function(e){return Np(k,x++,e)},e.addDependencyInitializer=function(e){return Np(E,x++,e)}})),_}return te(t,e),t.prototype.processTelemetry=function(e,t){this.processNext(e,t)},t.prototype.addDependencyInitializer=function(e){return null},t.identifier="AjaxDependencyPlugin",t.getDefaultConfig=Mp,t.getEmptyConfig=Dp,t}(Gs),Bp=function(){},Up=function(){this.id="browser",this.deviceClass="Browser"},zp="sessionManager",jp="update",$p="isUserCookieSet",Hp="isNewUser",qp="getTraceCtx",Vp="telemetryTrace",Zp="applySessionContext",Wp="applyApplicationContext",Gp="applyDeviceContext",Kp="applyOperationContext",Xp="applyUserContext",Yp="applyOperatingSystemContxt",Qp="applyLocationContext",Jp="applyInternalContext",ef="accountId",tf="sdkExtension",nf="getSessionId",rf="namePrefix",af="sessionCookiePostfix",of="userCookiePostfix",sf="idLength",cf="getNewId",lf="length",uf="automaticSession",df="authenticatedId",pf="sessionExpirationMs",ff="sessionRenewalMs",vf="config",mf="acquisitionDate",hf="renewalDate",bf="cookieDomain",gf="join",yf="cookieSeparator",wf="authUserCookieName",Sf=function(e){this.sdkVersion=(e[tf]&&e[tf]()?e[tf]()+"_":"")+"javascript:2.8.14"},xf=function(){},kf=function(){},Ef=function(){function e(t,n){var r,i,a=ci(n),o=Ba(n);F(e,this,(function(n){t||(t={}),Xt(t[pf])||(t[pf]=function(){return e.acquisitionSpan}),Xt(t[ff])||(t[ff]=function(){return e.renewalSpan}),n[vf]=t;var s=n.config[af]&&n[vf][af]()?n.config[af]():n.config[rf]&&n[vf][rf]()?n[vf][rf]():"";function c(e,t){var n=!1,r=", session will be reset",i=t.split("|");if(i[lf]>=2)try{var o=+i[1]||0,s=+i[2]||0;isNaN(o)||o<=0?di(a,2,27,"AI session acquisition date is 0"+r):isNaN(s)||s<=0?di(a,2,27,"AI session renewal date is 0"+r):i[0]&&(e.id=i[0],e[mf]=o,e[hf]=s,n=!0)}catch(c){di(a,1,9,"Error parsing ai_session value ["+(t||"")+"]"+r+" - "+xn(c),{exception:Gr(c)})}return n}function l(e,t){var a=e[mf];e[hf]=t;var s=n[vf],c=s[ff](),l=a+s[pf]()-t,u=[e.id,a,t],d=0;d=l<c?l/1e3:c/1e3;var p=s[bf]?s[bf]():null;o.set(r(),u.join("|"),s[pf]()>0?d:null,p),i=t}r=function(){return"ai_session"+s},n[uf]=new kf,n[jp]=function(){var t=Sn(),s=!1,u=n[uf];u.id||(s=!function(e,t){var n=!1,i=o.get(r());if(i&&Xt(i.split))n=c(e,i);else{var s=xi(a,r());s&&(n=c(e,s))}return n||!!e.id}(u));var d=n.config[pf]();if(!s&&d>0){var p=n.config[ff](),f=t-u[mf],v=t-u[hf];s=(s=(s=f<0||v<0)||f>d)||v>p}s?function(e){var t=n[vf]||{},r=(t[cf]?t[cf]():null)||no;n.automaticSession.id=r(t[sf]?t[sf]():22),n[uf][mf]=e,l(n[uf],e),Si()||di(a,2,0,"Browser does not support local storage. Session durations will be inaccurate.")}(t):(!i||t-i>e.cookieUpdateInterval)&&l(u,t)},n.backup=function(){var e,t,i,o=n[uf];e=o.id,t=o[mf],i=o[hf],ki(a,r(),[e,t,i][gf]("|"))}}))}return e.acquisitionSpan=864e5,e.renewalSpan=18e5,e.cookieUpdateInterval=6e4,e}(),_f=function(e,t,n,r){var i=this;i.traceID=e||jo(),i.parentID=t;var a=$r();!n&&a&&a.pathname&&(n=a.pathname),i.name=Hi(r,n)};function Cf(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))}var Tf=function(){function e(t,n){this.isNewUser=!1,this.isUserCookieSet=!1;var r,i=ci(n),a=Ba(n);F(e,this,(function(n){n[vf]=t;var o=n.config[of]&&n[vf][of]()?n[vf][of]():"";r=function(){return e.userCookieName+o};var s=a.get(r());if(s){n[Hp]=!1;var c=s.split(e[yf]);c[lf]>0&&(n.id=c[0],n[$p]=!!n.id)}function l(){var e=t||{};return((e[cf]?e[cf]():null)||no)(e[sf]?t[sf]():22)}function u(e){var t=cn(new Date);return n.accountAcquisitionDate=t,n[Hp]=!0,[e,t]}function d(e){n[$p]=a.set(r(),e,31536e3)}if(!n.id){n.id=l(),d(u(n.id)[gf](e[yf]));var p=t[rf]&&t[rf]()?t[rf]()+"ai_session":"ai_session";Ei(i,p)}n[ef]=t[ef]?t[ef]():void 0;var f=a.get(e[wf]);if(f){var v=(f=decodeURI(f)).split(e[yf]);v[0]&&(n[df]=v[0]),v[lf]>1&&v[1]&&(n[ef]=v[1])}n.setAuthenticatedUserContext=function(t,r,o){if(void 0===o&&(o=!1),!Cf(t)||r&&!Cf(r))di(i,2,60,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{n[df]=t;var s=n[df];r&&(n[ef]=r,s=[n[df],n.accountId][gf](e[yf])),o&&a.set(e[wf],encodeURI(s))}},n.clearAuthenticatedUserContext=function(){n[df]=null,n[ef]=null,a.del(e[wf])},n[jp]=function(t){n.id===t&&n[$p]||d(u(t||l())[gf](e[yf]))}}))}return e.cookieSeparator="|",e.userCookieName="ai_user",e.authUserCookieName="ai_authUser",e}(),If="ext",Af="tags";function Nf(e,t){e&&e[t]&&0===hn(e[t])[lf]&&delete e[t]}var Pf=function(){function e(t,n,r){var i=this,a=t.logger;this.appId=function(){return null},this[nf]=function(){return null},F(e,this,(function(e){if(e.application=new Bp,e.internal=new Sf(n),Mr()){e[zp]=new Ef(n,t),e.device=new Up,e.location=new xf,e.user=new Tf(n,t);var o,s=void 0,c=void 0;r&&(s=r.getTraceId(),c=r.getSpanId(),o=r.getName()),e[Vp]=new _f(s,c,o,a),e.session=new kf}e[nf]=function(){var t=e.session,n=null;if(t&&rn(t.id))n=t.id;else{var r=(e[zp]||{})[uf];n=r&&rn(r.id)?r.id:null}return n},e[Zp]=function(t,n){kn(En(t.ext,vl.AppExt),"sesId",e[nf](),rn)},e[Yp]=function(t,n){kn(t.ext,vl.OSExt,e.os)},e[Wp]=function(t,n){var r=e.application;if(r){var i=En(t,Af);kn(i,ml.applicationVersion,r.ver,rn),kn(i,ml.applicationBuild,r.build,rn)}},e[Gp]=function(t,n){var r=e.device;if(r){var i=En(En(t,If),vl.DeviceExt);kn(i,"localId",r.id,rn),kn(i,"ip",r.ip,rn),kn(i,"model",r.model,rn),kn(i,"deviceClass",r.deviceClass,rn)}},e[Jp]=function(t,n){var r=e.internal;if(r){var i=En(t,Af);kn(i,ml.internalAgentVersion,r.agentVersion,rn),kn(i,ml.internalSdkVersion,Hi(a,r.sdkVersion,64),rn),t.baseType!==si.dataType&&t.baseType!==ra.dataType||(kn(i,ml.internalSnippet,r.snippetVer,rn),kn(i,ml.internalSdkSrc,r.sdkSrc,rn))}},e[Qp]=function(e,t){var n=i.location;n&&kn(En(e,Af,[]),ml.locationIp,n.ip,rn)},e[Kp]=function(t,n){var r=e[Vp];if(r){var i=En(En(t,If),vl.TraceExt,{traceID:void 0,parentID:void 0});kn(i,"traceID",r.traceID,rn,Zt),kn(i,"name",r.name,rn,Zt),kn(i,"parentID",r.parentID,rn,Zt)}},e.applyWebContext=function(e,t){var n=i.web;n&&kn(En(e,If),vl.WebExt,n)},e[Xp]=function(t,n){var r=e.user;if(r){kn(En(t,Af,[]),ml.userAccountId,r[ef],rn);var i=En(En(t,If),vl.UserExt);kn(i,"id",r.id,rn),kn(i,"authId",r[df],rn)}},e.cleanUp=function(e,t){var n=e.ext;n&&(Nf(n,vl.DeviceExt),Nf(n,vl.UserExt),Nf(n,vl.WebExt),Nf(n,vl.OSExt),Nf(n,vl.AppExt),Nf(n,vl.TraceExt))}}))}return e.__ieDyn=1,e}(),Lf=function(e){function t(){var n,r,i,a=e.call(this)||this;return a.priority=110,a.identifier=Ni,F(t,a,(function(e,a){function o(){n=null,r=null,i=null}o(),e.initialize=function(o,s,c,l){a.initialize(o,s,c,l),function(a){var o=e.identifier,s=e.core,c=Os(null,a,s),l=t.getDefaultConfig();n=n||{},Qt(l,(function(e,t){n[e]=function(){return c.getConfig(o,e,t())}})),i=s[qp](!1),e.context=new Pf(s,n,i),r=ms(e.context[Vp],i),s.setTraceCtx(r),e.context.appId=function(){var e=s.getPlugin(Pi);return e?e.plugin._appId:null},e._extConfig=n}(o)},e.processTelemetry=function(t,n){if(Zt(t));else{n=e._getTelCtx(n),t.name===ra.envelopeType&&n.diagLog().resetInternalMessageCount();var r=e.context||{};r.session&&"string"!=typeof e.context.session.id&&r[zp]&&r[zp][jp]();var i=r.user;if(i&&!i[$p]&&i[jp](r.user.id),function(t,n){En(t,"tags",[]),En(t,"ext",{});var r=e.context;r[Zp](t,n),r[Wp](t,n),r[Gp](t,n),r[Kp](t,n),r[Xp](t,n),r[Yp](t,n),r.applyWebContext(t,n),r[Qp](t,n),r[Jp](t,n),r.cleanUp(t,n)}(t,n),i&&i[Hp]){i[Hp]=!1;var a=new si(72,(zr()||{}).userAgent||"");!function(e,t,n){ui(e)[Ve](t,n)}(n.diagLog(),1,a)}e.processNext(t,n)}},e._doTeardown=function(e,t){var n=(e||{}).core();n&&n[qp]&&(n[qp](!1)===r&&n.setTraceCtx(i));o()}})),a}return te(t,e),t.getDefaultConfig=function(){var e,t,n=null;return(e={instrumentationKey:function(){return t}})[ef]=function(){return n},e.sessionRenewalMs=function(){return 18e5},e.samplingPercentage=function(){return 100},e.sessionExpirationMs=function(){return 864e5},e[bf]=function(){return n},e[tf]=function(){return n},e.isBrowserLinkTrackingEnabled=function(){return!1},e.appId=function(){return n},e[nf]=function(){return n},e[rf]=function(){return t},e[af]=function(){return t},e[of]=function(){return t},e[sf]=function(){return 22},e[cf]=function(){return n},e},t}(Gs);const Rf=Lf;var Of,Mf="AuthenticatedUserContext",Df="track",Ff="snippet",Bf="flush",Uf="addTelemetryInitializer",zf="pollInternalLogs",jf="getPlugin",$f="evtNamespace",Hf=Df+"Event",qf=Df+"Trace",Vf=Df+"Metric",Zf=Df+"PageView",Wf=Df+"Exception",Gf=Df+"DependencyData",Kf="set"+Mf,Xf="clear"+Mf,Yf="endpointUrl",Qf="diagnosticLogInterval",Jf="config",ev="context",tv="push",nv="version",rv="queue",iv="connectionString",av="instrumentationKey",ov="appInsights",sv="disableIkeyDeprecationMessage",cv="getTransmissionControls",lv="onunloadFlush",uv="addHousekeepingBeforeUnload",dv="indexOf",pv=[Ff,"dependencies","properties","_snippetVersion","appInsightsNew","getSKUDefaults"],fv=function(){function e(t){var n,r,i,a,o,s,c,l=this;F(e,this,(function(e){o=lo("AISKU"),s=null,n=null,r=null,i=null,a=null,a=""+(t.sv||t[nv]||""),t[rv]=t[rv]||[],t[nv]=t[nv]||2;var u=t[Jf]||{};if(u[iv]){var d=qu(u[iv]),p=d.ingestionendpoint;u[Yf]=p?p+Bi:u[Yf],u[av]=d.instrumentationkey||u[av]}e[ov]=new nl,r=new Rf,n=new Fp,i=new Hu,c=new id,e.core=c;var f=!!Zt(u[sv])||u[sv];u[iv]||f||di(c.logger,1,106,"Instrumentation key support will end soon, see aka.ms/IkeyMigrate"),e[Ff]=t,e[Jf]=u,e.config[Qf]=e.config[Qf]&&e[Jf][Qf]>0?e[Jf][Qf]:1e4,e[Bf]=function(e){void 0===e&&(e=!0),Es(c,(function(){return"AISKU.flush"}),(function(){ln(c[cv](),(function(t){ln(t,(function(t){t[Bf](e)}))}))}),null,e)},e[lv]=function(e){void 0===e&&(e=!0),ln(c[cv](),(function(t){ln(t,(function(t){t[lv]?t[lv]():t[Bf](e)}))}))},e.loadAppInsights=function(t,o,s){return void 0===t&&(t=!1),t&&e[Jf].extensions&&e[Jf].extensions.length>0&&Tn("Extensions not allowed in legacy mode"),Es(e.core,(function(){return"AISKU.loadAppInsights"}),(function(){var l=[];l[tv](i),l[tv](r),l[tv](n),l[tv](e[ov]),c.initialize(e[Jf],l,o,s),e[ev]=r[ev],Of&&e[ev]&&(e[ev].internal.sdkSrc=Of),function(n){if(n){var r="";Zt(a)||(r+=a),t&&(r+=".lg"),e[ev]&&e[ev].internal&&(e[ev].internal.snippetVer=r||"-"),Qt(e,(function(e,t){rn(e)&&!Xt(t)&&e&&"_"!==e[0]&&-1===un(pv,e)&&(n[e]=t)}))}}(e[Ff]),e.emptyQueue(),e[zf](),e[uv](e)})),e},e.updateSnippetDefinitions=function(t){!function(e,t,n){if(e&&t&&Kt(e)&&Kt(t)){var r=function(r){if(rn(r)){var i=t[r];Xt(i)?n&&!n(r,!0,t,e)||(e[r]=In(t,r)):n&&!n(r,!1,t,e)||(Gt(e,r)&&delete e[r],bn(e,r,(function(){return t[r]}),(function(e){t[r]=e}))||(e[r]=i))}};for(var i in t)r(i)}}(t,e,(function(e){return e&&-1===un(pv,e)}))},e.emptyQueue=function(){try{if(tn(e.snippet[rv])){for(var t=e.snippet[rv].length,n=0;n<t;n++){(0,e.snippet[rv][n])()}e.snippet[rv]=void 0,delete e.snippet[rv]}}catch(r){r&&Xt(r.toString)&&r.toString()}},e[uv]=function(e){if(Mr()||Fr()){var t=function(){if(e[lv](!1),Xt(l.core[jf])){var t=l.core[jf](Ni);if(t){var n=t.plugin;n&&n[ev]&&n[ev]._sessionManager&&n[ev]._sessionManager.backup()}}},n=!1,r=e.appInsights[Jf].disablePageUnloadEvents;s||(s=Ro(o,c[$f]&&c[$f]())),e.appInsights.config.disableFlushOnBeforeUnload||(Uo(t,r,s)&&(n=!0),zo(t,r,s)&&(n=!0),n||(i=zr())&&i.product&&"ReactNative"===i.product||di(e[ov].core.logger,1,19,"Could not add handler for beforeunload and pagehide")),n||e.appInsights.config.disableFlushOnUnload||zo(t,r,s)}var i},e.getSender=function(){return i},e.unload=function(t,n,r){e[lv](t),s&&(Bo([So,wo,yo],null,s),function(e,t){var n=Ro(xo,t);Bo([yo],e,n),Bo([go],null,n)}(null,s)),c.unload&&c.unload(t,n,r)},Nn(e,e[ov],["getCookieMgr",Hf,Zf,"trackPageViewPerformance",Wf,"_onerror",qf,Vf,"startTrackPage","stopTrackPage","startTrackEvent","stopTrackEvent"]),Nn(e,(function(){return n}),[Gf,"addDependencyListener","addDependencyInitializer"]),Nn(e,c,[Uf,zf,"stopPollingInternalLogs",jf,"addPlugin",$f,"addUnloadCb","getTraceCtx"]),Nn(e,(function(){var e=r[ev];return e?e.user:null}),[Kf,Xf])}))}return e.prototype.addDependencyInitializer=function(e){return null},e}();let vv;if(function(){var e=null,t=["://js.monitor.azure.com/","://az416426.vo.msecnd.net/"];try{var n=(document||{}).currentScript;n&&(e=n.src)}catch(o){}if(e)try{var r=e.toLowerCase();if(r)for(var i="",a=0;a<t.length;a++)if(-1!==r[dv](t[a])){i="cdn"+(a+1),-1===r[dv]("/scripts/")&&(-1!==r[dv]("/next/")?i+="-next":-1!==r[dv]("/beta/")&&(i+="-beta")),Of=i+"";break}}catch(o){}}(),"undefined"!=typeof window){const e=window.appInsightsConfig;e&&(vv=new fv({config:e}),vv.loadAppInsights(),vv.trackPageView())}const mv={onRouteDidUpdate(e){let{location:t,previousLocation:n}=e;!n||t.pathname===n.pathname&&t.search===n.search&&t.hash===n.hash||vv?.trackPageView({name:t.pathname+t.search})}}},76623:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(27378),i=n(25773),a=n(51237),o=n.n(a),s=n(16887);const c={"008bb2ac":[()=>n.e(8065).then(n.bind(n,82319)),"@site/docs/developer/net/mqtt.mdx",82319],"010eedb1":[()=>n.e(3775).then(n.bind(n,32243)),"@site/docs/api/core/registers.md",32243],"019132d2":[()=>n.e(1169).then(n.t.bind(n,83769,19)),"/home/runner/work/devicescript/devicescript/website/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",83769],"01d62032":[()=>n.e(229).then(n.bind(n,21939)),"@site/docs/developer/drivers/index.mdx",21939],"02d6ef5b":[()=>n.e(7622).then(n.bind(n,27986)),"@site/docs/api/clients/verifiedtelemetrysensor.md",27986],"03013c26":[()=>n.e(8766).then(n.bind(n,35995)),"@site/docs/language/strings.mdx",35995],"032aa2b9":[()=>n.e(952).then(n.bind(n,80769)),"@site/docs/devices/esp32/adafruit-feather-esp32-s2.mdx",80769],"03ded4e1":[()=>n.e(3).then(n.bind(n,10903)),"@site/docs/api/drivers/reflectedlight.md",10903],"0444f081":[()=>n.e(2429).then(n.bind(n,52030)),"@site/docs/devices/add-shield.mdx",52030],"066d851d":[()=>n.e(5140).then(n.bind(n,36956)),"@site/docs/api/test/index.md",36956],"08972f5c":[()=>n.e(9931).then(n.bind(n,53143)),"@site/docs/getting-started/vscode/user-interface.mdx",53143],"09bafa26":[()=>n.e(7339).then(n.bind(n,83195)),"@site/docs/developer/settings.mdx",83195],"0cc1c4e6":[()=>n.e(1716).then(n.bind(n,16061)),"@site/docs/api/clients/winddirection.md",16061],"0f0c2e9e":[()=>n.e(5032).then(n.bind(n,34160)),"@site/docs/api/clients/dmx.md",34160],"0f58a8af":[()=>n.e(3663).then(n.bind(n,89045)),"@site/docs/api/drivers/buzzer.md",89045],"0fe4a880":[()=>n.e(831).then(n.bind(n,71113)),"@site/docs/api/clients/arcadesound.md",71113],11653462:[()=>n.e(4599).then(n.bind(n,38126)),"@site/docs/api/clients/codalmessagebus.md",38126],"13738eeb":[()=>n.e(3538).then(n.bind(n,78662)),"@site/docs/api/core/commands.md",78662],"14b6b4b0":[()=>n.e(8145).then(n.bind(n,21577)),"@site/docs/api/drivers/shtc3.mdx",21577],15372202:[()=>n.e(6164).then(n.bind(n,49792)),"@site/docs/developer/iot/matlab-thingspeak/index.mdx",49792],"15d99295":[()=>n.e(8338).then(n.bind(n,15011)),"@site/docs/getting-started/index.mdx",15011],17139236:[()=>n.e(6537).then(n.bind(n,57730)),"@site/docs/api/clients/rng.md",57730],"174cc3bf":[()=>n.e(4690).then(n.bind(n,82180)),"@site/docs/developer/development-gateway/telemetry.mdx",82180],17896441:[()=>Promise.all([n.e(532),n.e(7918)]).then(n.bind(n,60731)),"@theme/DocItem",60731],"1a1df4a0":[()=>n.e(3357).then(n.bind(n,32759)),"@site/docs/api/clients/devicescriptcondition.md",32759],"1a4e3797":[()=>Promise.all([n.e(532),n.e(7920)]).then(n.bind(n,41174)),"@theme/SearchPage",41174],"1b1eee5e":[()=>n.e(6060).then(n.bind(n,39388)),"@site/docs/developer/console.mdx",39388],"1b288cf4":[()=>n.e(9459).then(n.bind(n,47501)),"@site/docs/api/drivers/waterlevel.md",47501],"1be78505":[()=>Promise.all([n.e(532),n.e(9514)]).then(n.bind(n,65553)),"@theme/DocPage",65553],"1c420d1d":[()=>n.e(7336).then(n.bind(n,45845)),"@site/docs/api/clients/tcp.md",45845],"1d820ac6":[()=>n.e(4008).then(n.bind(n,36181)),"@site/docs/api/clients/pressurebutton.md",36181],"1df93b7f":[()=>Promise.all([n.e(532),n.e(3237)]).then(n.bind(n,33513)),"@site/src/pages/index.tsx",33513],"1ebf7e3d":[()=>n.e(490).then(n.bind(n,54190)),"@site/docs/devices/esp32/esp32s2-bare.mdx",54190],"1f829b5e":[()=>n.e(5272).then(n.bind(n,39614)),"@site/docs/samples/temperature-mqtt.mdx",39614],"204e02b7":[()=>n.e(162).then(n.bind(n,7472)),"@site/docs/developer/drivers/serial.mdx",7472],"2188eaab":[()=>n.e(2643).then(n.bind(n,9345)),"@site/docs/developer/observables.mdx",9345],"22021e31":[()=>n.e(6143).then(n.bind(n,47673)),"@site/docs/devices/esp32/esp32c3-bare.mdx",47673],"22820bcb":[()=>n.e(6644).then(n.bind(n,30121)),"@site/docs/api/drivers/switch.md",30121],"236f6b2e":[()=>n.e(6140).then(n.bind(n,1561)),"@site/docs/api/clients/reflectedlight.md",1561],"23719d77":[()=>n.e(2214).then(n.bind(n,55573)),"@site/docs/api/clients/multitouch.md",55573],"255d1f03":[()=>n.e(2579).then(n.bind(n,35229)),"@site/docs/api/math.mdx",35229],"25856b02":[()=>n.e(2412).then(n.bind(n,28843)),"@site/docs/api/runtime/palette.mdx",28843],"26effb06":[()=>n.e(3598).then(n.bind(n,70339)),"@site/docs/api/clients/ros.md",70339],"2785e21a":[()=>n.e(6474).then(n.bind(n,51403)),"@site/docs/api/clients/pulseoximeter.md",51403],27971726:[()=>n.e(6468).then(n.bind(n,33359)),"@site/docs/api/drivers/hall.md",33359],"27ec97a3":[()=>n.e(4213).then(n.bind(n,66840)),"@site/docs/devices/shields/waveshare-pico-lcd-114.mdx",66840],"298366da":[()=>n.e(114).then(n.bind(n,9545)),"@site/docs/api/observables/filter.mdx",9545],"2ae8a91e":[()=>n.e(2899).then(n.bind(n,1094)),"@site/docs/devices/esp32/seeed-xiao-esp32c3-msr218.mdx",1094],"2b38635b":[()=>n.e(3931).then(n.bind(n,48876)),"@site/docs/developer/development-gateway/messages.mdx",48876],"2bfae4de":[()=>n.e(6300).then(n.bind(n,39983)),"@site/docs/getting-started/vscode/workspaces.mdx",39983],"2c32c100":[()=>n.e(4577).then(n.bind(n,21015)),"@site/docs/api/core/index.md",21015],"30943bfd":[()=>n.e(4997).then(n.bind(n,2403)),"@site/docs/devices/esp32/esp32-c3fh4-rgb.mdx",2403],"3287d67a":[()=>n.e(9657).then(n.bind(n,68392)),"@site/docs/developer/index.mdx",68392],"3352a21f":[()=>n.e(4050).then(n.bind(n,31694)),"@site/docs/api/drivers/relay.md",31694],"338b64d9":[()=>n.e(4995).then(n.bind(n,55049)),"@site/docs/samples/double-blinky.mdx",55049],"34179c72":[()=>n.e(8802).then(n.bind(n,37646)),"@site/docs/api/clients/hidkeyboard.md",37646],"34b3ce2d":[()=>n.e(9900).then(n.bind(n,55297)),"@site/docs/api/clients/devicescriptmanager.md",55297],"351c4745":[()=>n.e(8053).then(n.bind(n,35980)),"@site/docs/api/clients/timeseriesaggregator.md",35980],"357f20a9":[()=>n.e(5370).then(n.bind(n,72393)),"@site/docs/language/tree-shaking.mdx",72393],"3583f1cc":[()=>n.e(9178).then(n.bind(n,63603)),"@site/docs/api/clients/accelerometer.md",63603],36363056:[()=>n.e(8716).then(n.bind(n,59047)),"@site/docs/api/clients/dccurrentmeasurement.md",59047],"3731312d":[()=>Promise.all([n.e(532),n.e(1429)]).then(n.bind(n,21310)),"@site/docs/developer/errors.mdx",21310],"3851185d":[()=>n.e(770).then(n.bind(n,42015)),"@site/docs/language/index.mdx",42015],"38e4c03d":[()=>n.e(2481).then(n.bind(n,69686)),"@site/docs/samples/thermostat.mdx",69686],"39409b5b":[()=>n.e(118).then(n.bind(n,96865)),"@site/docs/api/clients/gamepad.md",96865],"3bc219ec":[()=>n.e(5832).then(n.bind(n,55645)),"@site/docs/api/clients/gyroscope.md",55645],"3c8d9a18":[()=>n.e(6618).then(n.bind(n,30561)),"@site/docs/api/core/roles.md",30561],"3dd53374":[()=>n.e(320).then(n.bind(n,26763)),"@site/docs/devices/add-soc.mdx",26763],"3de927d0":[()=>n.e(1431).then(n.bind(n,25193)),"@site/docs/api/clients/switch.md",25193],"3e4ca316":[()=>n.e(2671).then(n.bind(n,60979)),"@site/docs/language/runtime.mdx",60979],"3f4a2944":[()=>n.e(7573).then(n.bind(n,91997)),"@site/docs/api/clients/compass.md",91997],"4009ac77":[()=>n.e(5709).then(n.bind(n,36721)),"@site/docs/developer/iot/blues-io/index.mdx",36721],"41c96264":[()=>n.e(8885).then(n.bind(n,76663)),"@site/docs/developer/development-gateway/index.mdx",76663],"4258b118":[()=>n.e(2139).then(n.bind(n,15081)),"@site/docs/api/drivers/hidmouse.md",15081],"42ad4eab":[()=>n.e(7228).then(n.bind(n,18644)),"@site/docs/devices/shields/pico-bricks.mdx",18644],"437cc37c":[()=>n.e(7609).then(n.bind(n,37440)),"@site/docs/api/clients/button.md",37440],"43d8caec":[()=>n.e(9020).then(n.bind(n,79198)),"@site/docs/api/clients/soundplayer.md",79198],"44d3e5f5":[()=>n.e(1409).then(n.bind(n,86802)),"@site/docs/api/clients/hidjoystick.md",86802],"4612ab74":[()=>n.e(7641).then(n.bind(n,88778)),"@site/docs/api/clients/wssk.md",88778],"49a92887":[()=>n.e(5875).then(n.bind(n,2002)),"@site/docs/devices/add-board.mdx",2002],"4a3643e7":[()=>n.e(6127).then(n.bind(n,47205)),"@site/docs/developer/graphics/image.mdx",47205],"4aae093d":[()=>n.e(1180).then(n.bind(n,53771)),"@site/docs/api/clients/cloudconfiguration.md",53771],"4c0cf505":[()=>n.e(845).then(n.bind(n,2239)),"@site/docs/developer/drivers/analog.mdx",2239],"4c197666":[()=>n.e(9234).then(n.bind(n,45155)),"@site/docs/developer/leds/driver.mdx",45155],"4cf0c468":[()=>n.e(1500).then(n.bind(n,65374)),"@site/docs/developer/iot/adafruit-io/index.mdx",65374],"4cf2e415":[()=>n.e(4625).then(n.bind(n,45018)),"@site/docs/language/devicescript-vs-javascript.mdx",45018],"4d478ee4":[()=>n.e(5542).then(n.bind(n,25239)),"@site/docs/api/clients/servo.md",25239],"4d64fe70":[()=>n.e(5091).then(n.bind(n,45493)),"@site/docs/api/drivers/rotaryencoder.md",45493],"5015016c":[()=>n.e(7497).then(n.bind(n,9455)),"@site/docs/api/clients/rolemanager.md",9455],"5046913c":[()=>n.e(9531).then(n.bind(n,57213)),"@site/docs/api/clients/indexedscreen.md",57213],"51e07670":[()=>n.e(9859).then(n.bind(n,75527)),"@site/docs/api/drivers/aht20.mdx",75527],"546bdb9a":[()=>n.e(4480).then(n.bind(n,3884)),"@site/docs/developer/clients.mdx",3884],"54d266d7":[()=>n.e(7704).then(n.bind(n,23904)),"@site/docs/samples/dimmer.mdx",23904],55133214:[()=>n.e(960).then(n.bind(n,13668)),"@site/docs/api/clients/bitradio.md",13668],"55d44c10":[()=>n.e(5998).then(n.bind(n,46254)),"@site/docs/developer/development-gateway/environment.mdx",46254],"56f2b0c6":[()=>n.e(5363).then(n.bind(n,7344)),"@site/docs/api/clients/prototest.md",7344],"57b44454":[()=>n.e(4450).then(n.bind(n,85208)),"@site/docs/api/clients/hidmouse.md",85208],"57c4248f":[()=>n.e(7425).then(n.bind(n,99563)),"@site/docs/api/clients/logger.md",99563],"5943acca":[()=>n.e(2652).then(n.bind(n,19636)),"@site/docs/api/clients/heartrate.md",19636],"5b9becab":[()=>n.e(1382).then(n.bind(n,61776)),"@site/docs/samples/homebridge-humidity.mdx",61776],"5ce11ed9":[()=>n.e(5336).then(n.bind(n,84642)),"@site/docs/api/clients/magnetomer.md",84642],"5dd58d1c":[()=>n.e(7238).then(n.bind(n,44130)),"@site/docs/api/clients/acidity.md",44130],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,36809)),"@generated/docusaurus.config",36809],"5eb65f11":[()=>Promise.all([n.e(532),n.e(4700)]).then(n.bind(n,96035)),"@site/docs/developer/packages/custom.mdx",96035],"5f7ad2e3":[()=>n.e(9962).then(n.bind(n,47403)),"@site/docs/developer/register.mdx",47403],"5fb0aa51":[()=>n.e(3709).then(n.bind(n,90565)),"@site/docs/devices/rp2040/pico-w.mdx",90565],"612d74b3":[()=>n.e(8272).then(n.bind(n,96927)),"@site/docs/api/clients/waterlevel.md",96927],"61556d62":[()=>n.e(8244).then(n.bind(n,4096)),"@site/docs/api/clients/control.md",4096],"61debf69":[()=>n.e(2135).then(n.bind(n,66300)),"@site/docs/getting-started/cli.mdx",66300],"63a77b62":[()=>n.e(5851).then(n.bind(n,17935)),"@site/docs/devices/esp32/esp32s3-bare.mdx",17935],"6407abb7":[()=>n.e(6512).then(n.bind(n,30914)),"@site/docs/api/drivers/servo.md",30914],"6496ecc8":[()=>n.e(7086).then(n.bind(n,84525)),"@site/docs/api/drivers/soundlevel.md",84525],"6711afe8":[()=>n.e(6291).then(n.bind(n,55950)),"@site/docs/samples/weather-dashboard.mdx",55950],"67482af5":[()=>n.e(1030).then(n.bind(n,46070)),"@site/docs/api/clients/midioutput.md",46070],"67ed5e14":[()=>n.e(5820).then(n.bind(n,70445)),"@site/docs/devices/esp32/seeed-xiao-esp32c3.mdx",70445],68830679:[()=>n.e(1495).then(n.bind(n,90705)),"@site/docs/developer/commands.mdx",90705],"6a0d6083":[()=>n.e(8634).then(n.bind(n,85972)),"@site/docs/api/runtime/pixelbuffer.mdx",85972],"6a350437":[()=>n.e(49).then(n.bind(n,85829)),"@site/docs/language/tostring.mdx",85829],"6b7af4fc":[()=>Promise.all([n.e(532),n.e(8785)]).then(n.bind(n,31745)),"@site/docs/devices/esp32/index.mdx",31745],"6b92a77b":[()=>n.e(8796).then(n.bind(n,24604)),"@site/docs/developer/bundle.mdx",24604],"6c9194df":[()=>Promise.all([n.e(532),n.e(2948)]).then(n.bind(n,33298)),"@site/docs/devices/shields/index.mdx",33298],"6cc4cf7a":[()=>n.e(6141).then(n.bind(n,33908)),"@site/docs/devices/rp2040/pico.mdx",33908],"6d697ca4":[()=>n.e(1806).then(n.bind(n,79258)),"@site/docs/developer/mcu-temperature.mdx",79258],"6dde451c":[()=>n.e(39).then(n.bind(n,49959)),"@site/docs/api/clients/tvoc.md",49959],"6ea5afa0":[()=>n.e(3482).then(n.bind(n,99499)),"@site/docs/api/clients/wifi.md",99499],"6f141d43":[()=>n.e(4886).then(n.bind(n,71070)),"@site/docs/api/clients/brailledisplay.md",71070],"700d2df6":[()=>n.e(8893).then(n.bind(n,23413)),"@site/docs/samples/blinky.mdx",23413],"7017c395":[()=>n.e(7262).then(n.bind(n,30981)),"@site/docs/api/clients/characterscreen.md",30981],"706ab872":[()=>n.e(648).then(n.bind(n,16366)),"@site/docs/api/clients/uvindex.md",16366],"72451d75":[()=>n.e(7394).then(n.bind(n,67919)),"@site/docs/api/clients/illuminance.md",67919],"72a427b3":[()=>n.e(5360).then(n.bind(n,82177)),"@site/docs/contributing.mdx",82177],"735d0569":[()=>n.e(7445).then(n.bind(n,34007)),"@site/docs/changelog.mdx",34007],"79aef7ac":[()=>n.e(9299).then(n.bind(n,90355)),"@site/docs/api/clients/soilmoisture.md",90355],"79e87f40":[()=>Promise.all([n.e(532),n.e(1978)]).then(n.bind(n,7009)),"@site/docs/devices/rp2040/index.mdx",7009],"7a7b4b0d":[()=>n.e(5129).then(n.bind(n,55123)),"@site/docs/api/drivers/hidkeyboard.md",55123],"7ba726e1":[()=>n.e(9106).then(n.bind(n,28101)),"@site/docs/api/clients/weightscale.md",28101],"7c28bcf8":[()=>n.e(1281).then(n.bind(n,18134)),"@site/docs/api/drivers/potentiometer.md",18134],"7cbf7351":[()=>n.e(1070).then(n.bind(n,36437)),"@site/docs/api/clients/potentiometer.md",36437],"7ec0e1a1":[()=>n.e(3251).then(n.bind(n,73800)),"@site/docs/api/drivers/index.mdx",73800],"7f4eb034":[()=>n.e(9766).then(n.bind(n,95117)),"@site/docs/api/clients/airqualityindex.md",95117],"7f8a356d":[()=>n.e(4469).then(n.bind(n,97418)),"@site/docs/api/clients/speechsynthesis.md",97418],"8442201f":[()=>n.e(660).then(n.bind(n,76203)),"@site/docs/api/clients/motion.md",76203],"85b70f9f":[()=>n.e(8534).then(n.bind(n,66601)),"@site/docs/api/drivers/uc8151.mdx",66601],"85efd854":[()=>n.e(8914).then(n.bind(n,77483)),"@site/docs/samples/schedule-blinky.mdx",77483],"8796e623":[()=>n.e(6690).then(n.bind(n,79e3)),"@site/docs/developer/board-configuration.mdx",79e3],"87e2c537":[()=>n.e(3358).then(n.bind(n,40855)),"@site/docs/api/runtime/schedule.mdx",40855],"882902b6":[()=>n.e(9294).then(n.bind(n,74180)),"@site/docs/api/clients/i2c.md",74180],"88b58b9e":[()=>n.e(1368).then(n.bind(n,21247)),"@site/docs/api/observables/dsp.mdx",21247],"88c5790d":[()=>n.e(7832).then(n.bind(n,97079)),"@site/docs/api/clients/arcadegamepad.md",97079],89588721:[()=>n.e(7754).then(n.bind(n,76838)),"@site/docs/api/clients/dashboard.md",76838],"899b456c":[()=>n.e(9702).then(n.bind(n,4183)),"@site/docs/devices/esp32/msr207-v43.mdx",4183],"89d10a13":[()=>n.e(6594).then(n.bind(n,72885)),"@site/docs/api/clients/led.md",72885],"8a8c4ba9":[()=>n.e(1728).then(n.bind(n,30402)),"@site/docs/api/clients/powersupply.md",30402],"8b9eacc1":[()=>n.e(3850).then(n.bind(n,28990)),"@site/docs/getting-started/vscode/index.mdx",28990],"8fb2ffea":[()=>n.e(5341).then(n.bind(n,39255)),"@site/docs/devices/esp32/esp32c3-rust-devkit.mdx",39255],"91d2d959":[()=>n.e(9302).then(n.bind(n,39534)),"@site/docs/api/clients/barcodereader.md",39534],"921da172":[()=>n.e(4077).then(n.bind(n,77876)),"@site/docs/api/clients/uniquebrain.md",77876],"92ed0cbf":[()=>n.e(4053).then(n.bind(n,23407)),"@site/docs/samples/workshop/index.mdx",23407],"934e9f4c":[()=>n.e(4507).then(n.bind(n,50021)),"@site/docs/api/observables/transform.mdx",50021],"935f2afb":[()=>n.e(53).then(n.t.bind(n,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],"93ebf6e1":[()=>n.e(5109).then(n.bind(n,72771)),"@site/docs/devices/esp32/msr207-v42.mdx",72771],"9421b549":[()=>n.e(1343).then(n.bind(n,43460)),"@site/docs/language/hex.mdx",43460],96998115:[()=>n.e(2527).then(n.bind(n,46669)),"@site/docs/developer/low-power.mdx",46669],"97af9a3e":[()=>n.e(4768).then(n.bind(n,36599)),"@site/docs/api/settings/index.md",36599],"98876a2d":[()=>n.e(3032).then(n.bind(n,2805)),"@site/docs/language/async.mdx",2805],"98f2cacc":[()=>n.e(2561).then(n.bind(n,44800)),"@site/docs/api/runtime/index.mdx",44800],"99cc6920":[()=>n.e(9328).then(n.bind(n,2997)),"@site/docs/developer/crypto.mdx",2997],"99d3ca33":[()=>n.e(6862).then(n.bind(n,54409)),"@site/docs/api/clients/ledsingle.md",54409],"9b1d3f80":[()=>n.e(7334).then(n.bind(n,32505)),"@site/docs/api/clients/devicescriptdebugger.md",32505],"9bc44158":[()=>n.e(4692).then(n.bind(n,7140)),"@site/docs/developer/leds/display.mdx",7140],"9cfe4cc6":[()=>n.e(6593).then(n.bind(n,80561)),"@site/docs/api/clients/temperature.md",80561],"9ea8689d":[()=>Promise.all([n.e(532),n.e(6505)]).then(n.bind(n,78070)),"@site/docs/developer/packages/index.mdx",78070],"9eb80747":[()=>n.e(1674).then(n.bind(n,30641)),"@site/docs/api/clients/dualmotors.md",30641],"9f4b432b":[()=>n.e(8623).then(n.bind(n,33557)),"@site/docs/api/clients/relay.md",33557],"9f50cf8a":[()=>n.e(3442).then(n.bind(n,24758)),"@site/docs/api/clients/humidity.md",24758],a1da537c:[()=>n.e(2117).then(n.bind(n,21048)),"@site/docs/api/drivers/accelerometer.md",21048],a1f85011:[()=>n.e(2611).then(n.bind(n,97301)),"@site/docs/api/drivers/sht30.mdx",97301],a2547cfc:[()=>n.e(2277).then(n.bind(n,99156)),"@site/docs/developer/iot/blynk-io/index.mdx",99156],a2b93c3a:[()=>n.e(4233).then(n.bind(n,29642)),"@site/docs/api/drivers/ltr390.mdx",29642],a4d48e61:[()=>n.e(4911).then(n.bind(n,54677)),"@site/docs/api/clients/distance.md",54677],a5466529:[()=>n.e(1327).then(n.bind(n,83726)),"@site/docs/developer/simulation.mdx",83726],a65110b7:[()=>n.e(444).then(n.bind(n,22211)),"@site/docs/api/clients/dcvoltagemeasurement.md",22211],a6c4ed74:[()=>n.e(5756).then(n.bind(n,41289)),"@site/docs/developer/drivers/digital-io/index.mdx",41289],a7118a9a:[()=>n.e(273).then(n.bind(n,87227)),"@site/docs/api/observables/utils.mdx",87227],a7397367:[()=>n.e(6617).then(n.bind(n,93987)),"@site/docs/api/clients/infrastructure.md",93987],a75cc24e:[()=>n.e(5071).then(n.bind(n,28970)),"@site/docs/language/special.mdx",28970],aa027bd7:[()=>n.e(3464).then(n.bind(n,2317)),"@site/docs/samples/status-light-blinky.mdx",2317],aa71f709:[()=>n.e(4514).then(n.t.bind(n,15745,19)),"/home/runner/work/devicescript/devicescript/website/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",15745],aae462db:[()=>n.e(2793).then(n.bind(n,76479)),"@site/docs/api/clients/eco2.md",76479],ab830b92:[()=>n.e(4179).then(n.bind(n,11730)),"@site/docs/developer/json.mdx",11730],ac1a52a9:[()=>n.e(9145).then(n.bind(n,82443)),"@site/docs/getting-started/vscode/troubleshooting.mdx",82443],ac364c7b:[()=>n.e(7761).then(n.bind(n,63079)),"@site/docs/api/clients/matrixkeypad.md",63079],ad7e4376:[()=>n.e(5371).then(n.bind(n,12576)),"@site/docs/api/clients/trafficlight.md",12576],aec6ee96:[()=>n.e(7150).then(n.bind(n,10691)),"@site/docs/api/clients/buzzer.md",10691],afcacdd7:[()=>n.e(3154).then(n.bind(n,87676)),"@site/docs/developer/graphics/display.mdx",87676],b0272dca:[()=>n.e(6209).then(n.bind(n,92722)),"@site/docs/api/clients/sevensegmentdisplay.md",92722],b18f40c0:[()=>n.e(3713).then(n.bind(n,45549)),"@site/docs/api/drivers/ssd1306.mdx",45549],b2987995:[()=>n.e(5048).then(n.bind(n,61749)),"@site/docs/developer/leds/index.mdx",61749],b342ea0c:[()=>n.e(8601).then(n.bind(n,1265)),"@site/docs/language/bytecode.mdx",1265],b3f35163:[()=>n.e(5255).then(n.bind(n,29223)),"@site/docs/devices/esp32/esp32s3-devkit-m.mdx",29223],b42ed10e:[()=>n.e(2469).then(n.bind(n,17335)),"@site/docs/api/drivers/lightbulb.md",17335],b61553de:[()=>n.e(107).then(n.bind(n,84345)),"@site/docs/developer/graphics/index.mdx",84345],b9793319:[()=>n.e(9011).then(n.bind(n,84197)),"@site/docs/samples/weather-display.mdx",84197],b9f2eef7:[()=>n.e(1506).then(n.bind(n,94361)),"@site/docs/api/drivers/motion.md",94361],bb0e3bff:[()=>n.e(3239).then(n.bind(n,33118)),"@site/docs/api/clients/airpressure.md",33118],bcfe7f12:[()=>n.e(5250).then(n.bind(n,55854)),"@site/docs/api/core/buffers.md",55854],bd082109:[()=>Promise.all([n.e(532),n.e(3234)]).then(n.bind(n,14838)),"@site/docs/api/vm.mdx",14838],beffa4c6:[()=>n.e(7156).then(n.bind(n,82381)),"@site/docs/api/drivers/bme680.mdx",82381],bf5a0007:[()=>n.e(3105).then(n.bind(n,41083)),"@site/docs/api/clients/color.md",41083],bff3aaa3:[()=>n.e(1496).then(n.bind(n,21650)),"@site/docs/api/clients/capacitivebutton.md",21650],c2d38624:[()=>n.e(3485).then(n.bind(n,11135)),"@site/docs/devices/esp32/feather-s2.mdx",11135],c3437d7e:[()=>n.e(2749).then(n.bind(n,58694)),"@site/docs/api/clients/bridge.md",58694],c44a5b35:[()=>n.e(4985).then(n.bind(n,39317)),"@site/docs/developer/drivers/i2c.mdx",39317],c54ba89e:[()=>n.e(2544).then(n.bind(n,16802)),"@site/docs/developer/iot/index.mdx",16802],c62d7f7c:[()=>n.e(6457).then(n.bind(n,99021)),"@site/docs/developer/drivers/spi.mdx",99021],c688902b:[()=>n.e(4712).then(n.bind(n,22708)),"@site/docs/api/spi.mdx",22708],c7480e04:[()=>n.e(2357).then(n.bind(n,50357)),"@site/docs/samples/copy-paste-button.mdx",50357],c7fb68d8:[()=>n.e(6651).then(n.bind(n,25548)),"@site/docs/api/clients/motor.md",25548],c818a061:[()=>n.e(9407).then(n.bind(n,43652)),"@site/docs/devices/rp2040/msr59.mdx",43652],c955ff7d:[()=>n.e(7810).then(n.bind(n,94894)),"@site/docs/api/drivers/power.md",94894],ca399add:[()=>n.e(4594).then(n.bind(n,83740)),"@site/docs/api/clients/rotaryencoder.md",83740],ca63cf85:[()=>n.e(9797).then(n.bind(n,28618)),"@site/docs/samples/thermostat-gateway.mdx",28618],cbfba0ab:[()=>n.e(7684).then(n.bind(n,12174)),"@site/docs/getting-started/vscode/simulation.mdx",12174],ce847cce:[()=>n.e(2260).then(n.bind(n,1259)),"@site/docs/api/drivers/st7789.mdx",1259],cea52501:[()=>n.e(2605).then(n.bind(n,6743)),"@site/docs/developer/jsx.mdx",6743],d1067852:[()=>n.e(5635).then(n.bind(n,82174)),"@site/docs/api/clients/power.md",82174],d1201f8d:[()=>n.e(2362).then(n.bind(n,85442)),"@site/docs/api/clients/ledstrip.md",85442],d3766067:[()=>n.e(3666).then(n.bind(n,96264)),"@site/docs/api/observables/index.mdx",96264],d5d9b552:[()=>n.e(8480).then(n.bind(n,41818)),"@site/docs/api/clients/cloudadapter.md",41818],d63f844b:[()=>n.e(6028).then(n.bind(n,63643)),"@site/docs/samples/button-led.mdx",63643],d6f63b00:[()=>n.e(5466).then(n.bind(n,63851)),"@site/docs/api/clients/proxy.md",63851],d7276684:[()=>n.e(2467).then(n.bind(n,52269)),"@site/docs/api/clients/serial.md",52269],d822119d:[()=>n.e(1189).then(n.bind(n,25084)),"@site/docs/api/core/events.md",25084],d8c5d390:[()=>n.e(393).then(n.bind(n,12172)),"@site/docs/api/clients/vibrationmotor.md",12172],d99e20a1:[()=>n.e(425).then(n.bind(n,17337)),"@site/docs/api/clients/flex.md",17337],db7e3fd2:[()=>n.e(6687).then(n.bind(n,69435)),"@site/docs/developer/status-light.mdx",69435],dc277a3e:[()=>n.e(1707).then(n.bind(n,59122)),"@site/docs/api/clients/usbbridge.md",59122],dc34691d:[()=>n.e(2630).then(n.bind(n,8494)),"@site/docs/api/clients/solenoid.md",8494],dc3dd087:[()=>n.e(2296).then(n.bind(n,63227)),"@site/docs/api/clients/soundrecorderwithplayback.md",63227],dc43ceaf:[()=>n.e(9005).then(n.bind(n,92330)),"@site/docs/api/clients/lightbulb.md",92330],dd8bbfeb:[()=>n.e(6158).then(n.bind(n,20105)),"@site/docs/developer/drivers/digital-io/wire.mdx",20105],de51976a:[()=>Promise.all([n.e(532),n.e(3218)]).then(n.bind(n,67101)),"@site/docs/api/cli.mdx",67101],df304c58:[()=>n.e(5073).then(n.bind(n,29652)),"@site/docs/api/clients/index.mdx",29652],e05d126a:[()=>n.e(4640).then(n.bind(n,41438)),"@site/docs/api/clients/planarposition.md",41438],e0bded7f:[()=>n.e(3297).then(n.bind(n,64661)),"@site/docs/api/drivers/lightlevel.md",64661],e0f9f1f4:[()=>n.e(9655).then(n.bind(n,65776)),"@site/docs/developer/development-gateway/configuration.mdx",65776],e1132b00:[()=>n.e(4822).then(n.bind(n,47162)),"@site/docs/api/clients/realtimeclock.md",47162],e11cc8a5:[()=>n.e(9409).then(n.bind(n,2823)),"@site/docs/devices/esp32/msr48.mdx",2823],e233ee0e:[()=>n.e(9369).then(n.bind(n,35238)),"@site/docs/api/clients/gpio.md",35238],e27a30e8:[()=>n.e(5552).then(n.bind(n,14661)),"@site/docs/api/clients/settings.md",14661],e3661ab2:[()=>n.e(5496).then(n.bind(n,66797)),"@site/docs/api/observables/creation.mdx",66797],e5f3ce77:[()=>n.e(9917).then(n.bind(n,19553)),"@site/docs/api/clients/satelittenavigationsystem.md",19553],e6691913:[()=>n.e(3233).then(n.t.bind(n,7085,19)),"/home/runner/work/devicescript/devicescript/website/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json",7085],e754dbb1:[()=>n.e(15).then(n.bind(n,73213)),"@site/docs/developer/drivers/custom-services.mdx",73213],ea5052e5:[()=>n.e(2105).then(n.bind(n,59112)),"@site/docs/getting-started/vscode/debugging.mdx",59112],ea615551:[()=>n.e(7486).then(n.bind(n,98079)),"@site/docs/developer/net/index.mdx",98079],eacb47ff:[()=>n.e(4373).then(n.bind(n,87295)),"@site/docs/devices/index.mdx",87295],eb1704c0:[()=>n.e(7159).then(n.bind(n,81734)),"@site/docs/api/clients/windspeed.md",81734],ebf7369b:[()=>n.e(6508).then(n.bind(n,98265)),"@site/docs/api/clients/sensoraggregator.md",98265],ed00ad56:[()=>n.e(7760).then(n.bind(n,38101)),"@site/docs/devices/rp2040/msr124.mdx",38101],edce4ca7:[()=>n.e(1514).then(n.bind(n,75589)),"@site/docs/devices/esp32/esp32-bare.mdx",75589],edf0ab12:[()=>n.e(9578).then(n.bind(n,92831)),"@site/docs/samples/github-build-status.mdx",92831],ee7ced19:[()=>n.e(1571).then(n.bind(n,19140)),"@site/docs/api/clients/rover.md",19140],eed45f36:[()=>n.e(1993).then(n.bind(n,74742)),"@site/docs/samples/index.mdx",74742],ef45af3d:[()=>n.e(8305).then(n.bind(n,54825)),"@site/docs/api/clients/lightlevel.md",54825],ef6ce06d:[()=>n.e(4278).then(n.bind(n,52097)),"@site/docs/devices/shields/pimoroni-pico-badger.mdx",52097],f1347c03:[()=>n.e(8926).then(n.bind(n,29051)),"@site/docs/developer/net/encrypted-fetch.mdx",29051],f209bce9:[()=>n.e(2002).then(n.bind(n,43660)),"@site/docs/devices/esp32/esp32-devkit-c.mdx",43660],f2f2094c:[()=>n.e(5280).then(n.bind(n,93840)),"@site/docs/api/clients/microphone.md",93840],f2fc7a53:[()=>n.e(9053).then(n.bind(n,83035)),"@site/docs/api/clients/soundlevel.md",83035],f3e8b01b:[()=>n.e(9296).then(n.bind(n,38898)),"@site/docs/devices/shields/xiao-expansion-board.mdx",38898],f468c751:[()=>n.e(677).then(n.bind(n,67719)),"@site/docs/api/drivers/button.md",67719],f4a210bc:[()=>n.e(1297).then(n.bind(n,69903)),"@site/docs/api/clients/magneticfieldlevel.md",69903],f59b56a8:[()=>Promise.all([n.e(532),n.e(7993)]).then(n.bind(n,68677)),"@site/docs/developer/development-gateway/gateway.mdx",68677],f6e1255d:[()=>n.e(3870).then(n.bind(n,55214)),"@site/docs/api/clients/soundspectrum.md",55214],f70d59fe:[()=>n.e(1589).then(n.bind(n,31686)),"@site/docs/api/clients/dotmatrix.md",31686],f7e5a795:[()=>n.e(7786).then(n.bind(n,1366)),"@site/docs/api/drivers/hidjoystick.md",1366],f8409a7e:[()=>n.e(3206).then(n.bind(n,92661)),"@site/docs/intro.mdx",92661],f8f225ac:[()=>n.e(5886).then(n.bind(n,56985)),"@site/docs/devices/esp32/adafruit-qt-py-c3.mdx",56985],f995dfad:[()=>n.e(1421).then(n.bind(n,99207)),"@site/docs/api/drivers/trafficlight.md",99207],fab9523c:[()=>n.e(2345).then(n.bind(n,20786)),"@site/docs/api/drivers/soilmoisture.md",20786],fb10faaf:[()=>Promise.all([n.e(532),n.e(7355)]).then(n.bind(n,19609)),"@site/docs/developer/testing.mdx",19609],fca5e363:[()=>n.e(4839).then(n.bind(n,41395)),"@site/docs/api/clients/raingauge.md",41395],fcb40366:[()=>n.e(3098).then(n.bind(n,34260)),"@site/docs/api/clients/bootloader.md",34260],ffea0820:[()=>n.e(1501).then(n.bind(n,15304)),"@site/docs/api/clients/modelrunner.md",15304]};function l(e){let{error:t,retry:n,pastDelay:i}=e;return t?r.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},r.createElement("p",null,String(t)),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},"Retry"))):i?r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},r.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},r.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"8"},r.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var u=n(13361),d=n(66881);function p(e,t){if("*"===e)return o()({loading:l,loader:()=>n.e(3893).then(n.bind(n,53893)),modules:["@theme/NotFound"],webpack:()=>[53893],render(e,t){const n=e.default;return r.createElement(d.z,{value:{plugin:{name:"native",id:"default"}}},r.createElement(n,t))}});const a=s[`${e}-${t}`],p={},f=[],v=[],m=(0,u.Z)(a);return Object.entries(m).forEach((e=>{let[t,n]=e;const r=c[n];r&&(p[t]=r[0],f.push(r[1]),v.push(r[2]))})),o().Map({loading:l,loader:p,modules:f,webpack:()=>v,render(t,n){const o=JSON.parse(JSON.stringify(a));Object.entries(t).forEach((t=>{let[n,r]=t;const i=r.default;if(!i)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof i&&"function"!=typeof i||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{i[e]=r[e]}));let a=o;const s=n.split(".");s.slice(0,-1).forEach((e=>{a=a[e]})),a[s[s.length-1]]=i}));const s=o.__comp;delete o.__comp;const c=o.__context;return delete o.__context,r.createElement(d.z,{value:c},r.createElement(s,(0,i.Z)({},o,n)))}})}const f=[{path:"/devicescript/search",component:p("/devicescript/search","d9d"),exact:!0},{path:"/devicescript/",component:p("/devicescript/","f88"),exact:!0},{path:"/devicescript/",component:p("/devicescript/","fbd"),routes:[{path:"/devicescript/api/cli",component:p("/devicescript/api/cli","5ed"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients",component:p("/devicescript/api/clients","fe1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/accelerometer",component:p("/devicescript/api/clients/accelerometer","cf6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/acidity",component:p("/devicescript/api/clients/acidity","e0a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/airpressure",component:p("/devicescript/api/clients/airpressure","5a0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/airqualityindex",component:p("/devicescript/api/clients/airqualityindex","b98"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/arcadegamepad",component:p("/devicescript/api/clients/arcadegamepad","64b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/arcadesound",component:p("/devicescript/api/clients/arcadesound","61e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/barcodereader",component:p("/devicescript/api/clients/barcodereader","d12"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/bitradio",component:p("/devicescript/api/clients/bitradio","0f5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/bootloader",component:p("/devicescript/api/clients/bootloader","464"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/brailledisplay",component:p("/devicescript/api/clients/brailledisplay","240"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/bridge",component:p("/devicescript/api/clients/bridge","9c3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/button",component:p("/devicescript/api/clients/button","35b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/buzzer",component:p("/devicescript/api/clients/buzzer","427"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/capacitivebutton",component:p("/devicescript/api/clients/capacitivebutton","d31"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/characterscreen",component:p("/devicescript/api/clients/characterscreen","8ac"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/cloudadapter",component:p("/devicescript/api/clients/cloudadapter","d41"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/cloudconfiguration",component:p("/devicescript/api/clients/cloudconfiguration","8e6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/codalmessagebus",component:p("/devicescript/api/clients/codalmessagebus","6dd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/color",component:p("/devicescript/api/clients/color","58a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/compass",component:p("/devicescript/api/clients/compass","17a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/control",component:p("/devicescript/api/clients/control","b6d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/dashboard",component:p("/devicescript/api/clients/dashboard","a80"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/dccurrentmeasurement",component:p("/devicescript/api/clients/dccurrentmeasurement","fee"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/dcvoltagemeasurement",component:p("/devicescript/api/clients/dcvoltagemeasurement","559"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/devicescriptcondition",component:p("/devicescript/api/clients/devicescriptcondition","8b5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/devicescriptdebugger",component:p("/devicescript/api/clients/devicescriptdebugger","4e2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/devicescriptmanager",component:p("/devicescript/api/clients/devicescriptmanager","2a3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/distance",component:p("/devicescript/api/clients/distance","a5b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/dmx",component:p("/devicescript/api/clients/dmx","8fb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/dotmatrix",component:p("/devicescript/api/clients/dotmatrix","2f4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/dualmotors",component:p("/devicescript/api/clients/dualmotors","235"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/eco2",component:p("/devicescript/api/clients/eco2","e99"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/flex",component:p("/devicescript/api/clients/flex","2b6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/gamepad",component:p("/devicescript/api/clients/gamepad","eb5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/gpio",component:p("/devicescript/api/clients/gpio","078"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/gyroscope",component:p("/devicescript/api/clients/gyroscope","db1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/heartrate",component:p("/devicescript/api/clients/heartrate","fd2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/hidjoystick",component:p("/devicescript/api/clients/hidjoystick","440"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/hidkeyboard",component:p("/devicescript/api/clients/hidkeyboard","a21"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/hidmouse",component:p("/devicescript/api/clients/hidmouse","61e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/humidity",component:p("/devicescript/api/clients/humidity","ee1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/i2c",component:p("/devicescript/api/clients/i2c","165"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/illuminance",component:p("/devicescript/api/clients/illuminance","ec5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/indexedscreen",component:p("/devicescript/api/clients/indexedscreen","edc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/infrastructure",component:p("/devicescript/api/clients/infrastructure","c50"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/led",component:p("/devicescript/api/clients/led","fbc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/ledsingle",component:p("/devicescript/api/clients/ledsingle","dab"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/ledstrip",component:p("/devicescript/api/clients/ledstrip","c23"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/lightbulb",component:p("/devicescript/api/clients/lightbulb","106"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/lightlevel",component:p("/devicescript/api/clients/lightlevel","c2f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/logger",component:p("/devicescript/api/clients/logger","43b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/magneticfieldlevel",component:p("/devicescript/api/clients/magneticfieldlevel","390"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/magnetomer",component:p("/devicescript/api/clients/magnetomer","037"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/matrixkeypad",component:p("/devicescript/api/clients/matrixkeypad","604"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/microphone",component:p("/devicescript/api/clients/microphone","071"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/midioutput",component:p("/devicescript/api/clients/midioutput","c79"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/modelrunner",component:p("/devicescript/api/clients/modelrunner","2f1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/motion",component:p("/devicescript/api/clients/motion","86c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/motor",component:p("/devicescript/api/clients/motor","17d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/multitouch",component:p("/devicescript/api/clients/multitouch","bde"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/planarposition",component:p("/devicescript/api/clients/planarposition","0e6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/potentiometer",component:p("/devicescript/api/clients/potentiometer","216"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/power",component:p("/devicescript/api/clients/power","d0c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/powersupply",component:p("/devicescript/api/clients/powersupply","16b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/pressurebutton",component:p("/devicescript/api/clients/pressurebutton","bea"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/prototest",component:p("/devicescript/api/clients/prototest","040"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/proxy",component:p("/devicescript/api/clients/proxy","81d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/pulseoximeter",component:p("/devicescript/api/clients/pulseoximeter","0f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/raingauge",component:p("/devicescript/api/clients/raingauge","851"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/realtimeclock",component:p("/devicescript/api/clients/realtimeclock","159"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/reflectedlight",component:p("/devicescript/api/clients/reflectedlight","74a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/relay",component:p("/devicescript/api/clients/relay","b56"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/rng",component:p("/devicescript/api/clients/rng","96b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/rolemanager",component:p("/devicescript/api/clients/rolemanager","4e9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/ros",component:p("/devicescript/api/clients/ros","dec"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/rotaryencoder",component:p("/devicescript/api/clients/rotaryencoder","1b3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/rover",component:p("/devicescript/api/clients/rover","d5b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/satelittenavigationsystem",component:p("/devicescript/api/clients/satelittenavigationsystem","5f6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/sensoraggregator",component:p("/devicescript/api/clients/sensoraggregator","78b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/serial",component:p("/devicescript/api/clients/serial","7e2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/servo",component:p("/devicescript/api/clients/servo","958"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/settings",component:p("/devicescript/api/clients/settings","660"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/sevensegmentdisplay",component:p("/devicescript/api/clients/sevensegmentdisplay","869"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/soilmoisture",component:p("/devicescript/api/clients/soilmoisture","09a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/solenoid",component:p("/devicescript/api/clients/solenoid","775"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/soundlevel",component:p("/devicescript/api/clients/soundlevel","d7a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/soundplayer",component:p("/devicescript/api/clients/soundplayer","2b5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/soundrecorderwithplayback",component:p("/devicescript/api/clients/soundrecorderwithplayback","966"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/soundspectrum",component:p("/devicescript/api/clients/soundspectrum","30e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/speechsynthesis",component:p("/devicescript/api/clients/speechsynthesis","58f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/switch",component:p("/devicescript/api/clients/switch","a14"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/tcp",component:p("/devicescript/api/clients/tcp","b64"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/temperature",component:p("/devicescript/api/clients/temperature","782"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/timeseriesaggregator",component:p("/devicescript/api/clients/timeseriesaggregator","18f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/trafficlight",component:p("/devicescript/api/clients/trafficlight","ca6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/tvoc",component:p("/devicescript/api/clients/tvoc","1c7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/uniquebrain",component:p("/devicescript/api/clients/uniquebrain","be0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/usbbridge",component:p("/devicescript/api/clients/usbbridge","522"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/uvindex",component:p("/devicescript/api/clients/uvindex","435"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/verifiedtelemetrysensor",component:p("/devicescript/api/clients/verifiedtelemetrysensor","2cf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/vibrationmotor",component:p("/devicescript/api/clients/vibrationmotor","485"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/waterlevel",component:p("/devicescript/api/clients/waterlevel","7d5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/weightscale",component:p("/devicescript/api/clients/weightscale","216"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/wifi",component:p("/devicescript/api/clients/wifi","11d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/winddirection",component:p("/devicescript/api/clients/winddirection","3a3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/windspeed",component:p("/devicescript/api/clients/windspeed","190"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/clients/wssk",component:p("/devicescript/api/clients/wssk","866"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/core",component:p("/devicescript/api/core","f63"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/core/buffers",component:p("/devicescript/api/core/buffers","3f8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/core/commands",component:p("/devicescript/api/core/commands","1ac"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/core/events",component:p("/devicescript/api/core/events","936"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/core/registers",component:p("/devicescript/api/core/registers","893"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/core/roles",component:p("/devicescript/api/core/roles","fad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers",component:p("/devicescript/api/drivers","8f6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/accelerometer",component:p("/devicescript/api/drivers/accelerometer","678"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/aht20",component:p("/devicescript/api/drivers/aht20","02f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/bme680",component:p("/devicescript/api/drivers/bme680","068"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/button",component:p("/devicescript/api/drivers/button","93a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/buzzer",component:p("/devicescript/api/drivers/buzzer","71a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/hall",component:p("/devicescript/api/drivers/hall","83b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/hidjoystick",component:p("/devicescript/api/drivers/hidjoystick","1d5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/hidkeyboard",component:p("/devicescript/api/drivers/hidkeyboard","d4b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/hidmouse",component:p("/devicescript/api/drivers/hidmouse","8fe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/lightbulb",component:p("/devicescript/api/drivers/lightbulb","e5a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/lightlevel",component:p("/devicescript/api/drivers/lightlevel","a2b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/ltr390",component:p("/devicescript/api/drivers/ltr390","ddd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/motion",component:p("/devicescript/api/drivers/motion","f3d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/potentiometer",component:p("/devicescript/api/drivers/potentiometer","df4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/power",component:p("/devicescript/api/drivers/power","8f2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/reflectedlight",component:p("/devicescript/api/drivers/reflectedlight","a9a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/relay",component:p("/devicescript/api/drivers/relay","a85"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/rotaryencoder",component:p("/devicescript/api/drivers/rotaryencoder","e8c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/servo",component:p("/devicescript/api/drivers/servo","a02"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/sht30",component:p("/devicescript/api/drivers/sht30","3b0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/shtc3",component:p("/devicescript/api/drivers/shtc3","d19"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/soilmoisture",component:p("/devicescript/api/drivers/soilmoisture","249"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/soundlevel",component:p("/devicescript/api/drivers/soundlevel","3b4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/ssd1306",component:p("/devicescript/api/drivers/ssd1306","85b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/st7789",component:p("/devicescript/api/drivers/st7789","02d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/switch",component:p("/devicescript/api/drivers/switch","ea3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/trafficlight",component:p("/devicescript/api/drivers/trafficlight","86c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/uc8151",component:p("/devicescript/api/drivers/uc8151","e8c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/drivers/waterlevel",component:p("/devicescript/api/drivers/waterlevel","60b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/math",component:p("/devicescript/api/math","261"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/observables",component:p("/devicescript/api/observables","b9a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/observables/creation",component:p("/devicescript/api/observables/creation","db2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/observables/dsp",component:p("/devicescript/api/observables/dsp","1f1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/observables/filter",component:p("/devicescript/api/observables/filter","004"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/observables/transform",component:p("/devicescript/api/observables/transform","de8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/observables/utils",component:p("/devicescript/api/observables/utils","489"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/runtime",component:p("/devicescript/api/runtime","1b1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/runtime/palette",component:p("/devicescript/api/runtime/palette","009"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/runtime/pixelbuffer",component:p("/devicescript/api/runtime/pixelbuffer","3bc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/runtime/schedule",component:p("/devicescript/api/runtime/schedule","3ec"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/settings",component:p("/devicescript/api/settings","35f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/spi",component:p("/devicescript/api/spi","531"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/test",component:p("/devicescript/api/test","06b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/api/vm",component:p("/devicescript/api/vm","d49"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/changelog",component:p("/devicescript/changelog","3ac"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/contributing",component:p("/devicescript/contributing","64c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer",component:p("/devicescript/developer","570"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/board-configuration",component:p("/devicescript/developer/board-configuration","b36"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/bundle",component:p("/devicescript/developer/bundle","073"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/clients",component:p("/devicescript/developer/clients","475"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/commands",component:p("/devicescript/developer/commands","474"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/console",component:p("/devicescript/developer/console","889"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/crypto",component:p("/devicescript/developer/crypto","779"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/development-gateway",component:p("/devicescript/developer/development-gateway","7e8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/development-gateway/configuration",component:p("/devicescript/developer/development-gateway/configuration","65b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/development-gateway/environment",component:p("/devicescript/developer/development-gateway/environment","c42"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/development-gateway/gateway",component:p("/devicescript/developer/development-gateway/gateway","955"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/development-gateway/messages",component:p("/devicescript/developer/development-gateway/messages","354"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/development-gateway/telemetry",component:p("/devicescript/developer/development-gateway/telemetry","b0e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers",component:p("/devicescript/developer/drivers","9fb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/analog",component:p("/devicescript/developer/drivers/analog","60a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/custom-services",component:p("/devicescript/developer/drivers/custom-services","fd1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/digital-io",component:p("/devicescript/developer/drivers/digital-io","639"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/digital-io/wire",component:p("/devicescript/developer/drivers/digital-io/wire","d24"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/i2c",component:p("/devicescript/developer/drivers/i2c","996"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/serial",component:p("/devicescript/developer/drivers/serial","afc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/drivers/spi",component:p("/devicescript/developer/drivers/spi","d45"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/errors",component:p("/devicescript/developer/errors","c23"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/graphics",component:p("/devicescript/developer/graphics","043"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/graphics/display",component:p("/devicescript/developer/graphics/display","1eb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/graphics/image",component:p("/devicescript/developer/graphics/image","a13"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/iot",component:p("/devicescript/developer/iot","db1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/iot/adafruit-io",component:p("/devicescript/developer/iot/adafruit-io","d23"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/iot/blues-io",component:p("/devicescript/developer/iot/blues-io","dc8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/iot/blynk-io",component:p("/devicescript/developer/iot/blynk-io","825"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/iot/matlab-thingspeak",component:p("/devicescript/developer/iot/matlab-thingspeak","16d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/json",component:p("/devicescript/developer/json","7b0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/jsx",component:p("/devicescript/developer/jsx","01f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/leds",component:p("/devicescript/developer/leds","8cd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/leds/display",component:p("/devicescript/developer/leds/display","6d1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/leds/driver",component:p("/devicescript/developer/leds/driver","e68"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/low-power",component:p("/devicescript/developer/low-power","c61"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/mcu-temperature",component:p("/devicescript/developer/mcu-temperature","978"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/net",component:p("/devicescript/developer/net","0a4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/net/encrypted-fetch",component:p("/devicescript/developer/net/encrypted-fetch","7cc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/net/mqtt",component:p("/devicescript/developer/net/mqtt","203"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/observables",component:p("/devicescript/developer/observables","975"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/packages",component:p("/devicescript/developer/packages","cda"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/packages/custom",component:p("/devicescript/developer/packages/custom","890"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/register",component:p("/devicescript/developer/register","966"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/settings",component:p("/devicescript/developer/settings","a60"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/simulation",component:p("/devicescript/developer/simulation","d7f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/status-light",component:p("/devicescript/developer/status-light","51a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/developer/testing",component:p("/devicescript/developer/testing","e87"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices",component:p("/devicescript/devices","956"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/add-board",component:p("/devicescript/devices/add-board","db4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/add-shield",component:p("/devicescript/devices/add-shield","c05"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/add-soc",component:p("/devicescript/devices/add-soc","61e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32",component:p("/devicescript/devices/esp32","290"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/adafruit-feather-esp32-s2",component:p("/devicescript/devices/esp32/adafruit-feather-esp32-s2","0ba"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/adafruit-qt-py-c3",component:p("/devicescript/devices/esp32/adafruit-qt-py-c3","496"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32-bare",component:p("/devicescript/devices/esp32/esp32-bare","533"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32-c3fh4-rgb",component:p("/devicescript/devices/esp32/esp32-c3fh4-rgb","351"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32-devkit-c",component:p("/devicescript/devices/esp32/esp32-devkit-c","4a2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32c3-bare",component:p("/devicescript/devices/esp32/esp32c3-bare","4dd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32c3-rust-devkit",component:p("/devicescript/devices/esp32/esp32c3-rust-devkit","fb3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32s2-bare",component:p("/devicescript/devices/esp32/esp32s2-bare","ed3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32s3-bare",component:p("/devicescript/devices/esp32/esp32s3-bare","f1c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/esp32s3-devkit-m",component:p("/devicescript/devices/esp32/esp32s3-devkit-m","01f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/feather-s2",component:p("/devicescript/devices/esp32/feather-s2","843"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/msr207-v42",component:p("/devicescript/devices/esp32/msr207-v42","31f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/msr207-v43",component:p("/devicescript/devices/esp32/msr207-v43","0d3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/msr48",component:p("/devicescript/devices/esp32/msr48","1a2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/seeed-xiao-esp32c3",component:p("/devicescript/devices/esp32/seeed-xiao-esp32c3","f60"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218",component:p("/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218","23d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/rp2040",component:p("/devicescript/devices/rp2040","ce1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/rp2040/msr124",component:p("/devicescript/devices/rp2040/msr124","cfb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/rp2040/msr59",component:p("/devicescript/devices/rp2040/msr59","497"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/rp2040/pico",component:p("/devicescript/devices/rp2040/pico","531"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/rp2040/pico-w",component:p("/devicescript/devices/rp2040/pico-w","1ec"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/shields",component:p("/devicescript/devices/shields","691"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/shields/pico-bricks",component:p("/devicescript/devices/shields/pico-bricks","37f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/shields/pimoroni-pico-badger",component:p("/devicescript/devices/shields/pimoroni-pico-badger","f5c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/shields/waveshare-pico-lcd-114",component:p("/devicescript/devices/shields/waveshare-pico-lcd-114","8e5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/devices/shields/xiao-expansion-board",component:p("/devicescript/devices/shields/xiao-expansion-board","82b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started",component:p("/devicescript/getting-started","1a1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/cli",component:p("/devicescript/getting-started/cli","bd0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/vscode",component:p("/devicescript/getting-started/vscode","9a6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/vscode/debugging",component:p("/devicescript/getting-started/vscode/debugging","110"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/vscode/simulation",component:p("/devicescript/getting-started/vscode/simulation","12b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/vscode/troubleshooting",component:p("/devicescript/getting-started/vscode/troubleshooting","ce6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/vscode/user-interface",component:p("/devicescript/getting-started/vscode/user-interface","2e9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/getting-started/vscode/workspaces",component:p("/devicescript/getting-started/vscode/workspaces","662"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/intro",component:p("/devicescript/intro","fee"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language",component:p("/devicescript/language","375"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/async",component:p("/devicescript/language/async","d1f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/bytecode",component:p("/devicescript/language/bytecode","b37"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/devicescript-vs-javascript",component:p("/devicescript/language/devicescript-vs-javascript","861"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/hex",component:p("/devicescript/language/hex","48f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/runtime",component:p("/devicescript/language/runtime","377"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/special",component:p("/devicescript/language/special","16f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/strings",component:p("/devicescript/language/strings","f46"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/tostring",component:p("/devicescript/language/tostring","064"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/language/tree-shaking",component:p("/devicescript/language/tree-shaking","7c1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples",component:p("/devicescript/samples","f18"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/blinky",component:p("/devicescript/samples/blinky","f36"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/button-led",component:p("/devicescript/samples/button-led","f42"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/copy-paste-button",component:p("/devicescript/samples/copy-paste-button","59f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/dimmer",component:p("/devicescript/samples/dimmer","4e3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/double-blinky",component:p("/devicescript/samples/double-blinky","36d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/github-build-status",component:p("/devicescript/samples/github-build-status","4c5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/homebridge-humidity",component:p("/devicescript/samples/homebridge-humidity","7a3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/schedule-blinky",component:p("/devicescript/samples/schedule-blinky","fc3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/status-light-blinky",component:p("/devicescript/samples/status-light-blinky","3f1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/temperature-mqtt",component:p("/devicescript/samples/temperature-mqtt","0a2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/thermostat",component:p("/devicescript/samples/thermostat","229"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/thermostat-gateway",component:p("/devicescript/samples/thermostat-gateway","480"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/weather-dashboard",component:p("/devicescript/samples/weather-dashboard","235"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/weather-display",component:p("/devicescript/samples/weather-display","f9e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/devicescript/samples/workshop",component:p("/devicescript/samples/workshop","7f1"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"*",component:p("*")}]},38944:(e,t,n)=>{"use strict";function r(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}n.d(t,{Z:()=>i});const i=function(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(i&&(i+=" "),i+=t);return i}},15036:(e,t,n)=>{"use strict";n.d(t,{lX:()=>w,q_:()=>C,ob:()=>f,PP:()=>I,Ep:()=>p});var r=n(25773);function i(e){return"/"===e.charAt(0)}function a(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}const o=function(e,t){void 0===t&&(t="");var n,r=e&&e.split("/")||[],o=t&&t.split("/")||[],s=e&&i(e),c=t&&i(t),l=s||c;if(e&&i(e)?o=r:r.length&&(o.pop(),o=o.concat(r)),!o.length)return"/";if(o.length){var u=o[o.length-1];n="."===u||".."===u||""===u}else n=!1;for(var d=0,p=o.length;p>=0;p--){var f=o[p];"."===f?a(o,p):".."===f?(a(o,p),d++):d&&(a(o,p),d--)}if(!l)for(;d--;d)o.unshift("..");!l||""===o[0]||o[0]&&i(o[0])||o.unshift("");var v=o.join("/");return n&&"/"!==v.substr(-1)&&(v+="/"),v};var s=n(92215);function c(e){return"/"===e.charAt(0)?e:"/"+e}function l(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,n=e.search,r=e.hash,i=t||"/";return n&&"?"!==n&&(i+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(i+="#"===r.charAt(0)?r:"#"+r),i}function f(e,t,n,i){var a;"string"==typeof e?(a=function(e){var t=e||"/",n="",r="",i=t.indexOf("#");-1!==i&&(r=t.substr(i),t=t.substr(0,i));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),a.state=t):(void 0===(a=(0,r.Z)({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(s){throw s instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):s}return n&&(a.key=n),i?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=o(a.pathname,i.pathname)):a.pathname=i.pathname:a.pathname||(a.pathname="/"),a}function v(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,i){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,i):i(!0):i(!1!==a)}else i(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach((function(e){return e.apply(void 0,n)}))}}}var m=!("undefined"==typeof window||!window.document||!window.document.createElement);function h(e,t){t(window.confirm(e))}var b="popstate",g="hashchange";function y(){try{return window.history.state||{}}catch(e){return{}}}function w(e){void 0===e&&(e={}),m||(0,s.Z)(!1);var t,n=window.history,i=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,a=!(-1===window.navigator.userAgent.indexOf("Trident")),o=e,l=o.forceRefresh,w=void 0!==l&&l,S=o.getUserConfirmation,x=void 0===S?h:S,k=o.keyLength,E=void 0===k?6:k,_=e.basename?d(c(e.basename)):"";function C(e){var t=e||{},n=t.key,r=t.state,i=window.location,a=i.pathname+i.search+i.hash;return _&&(a=u(a,_)),f(a,r,n)}function T(){return Math.random().toString(36).substr(2,E)}var I=v();function A(e){(0,r.Z)(j,e),j.length=n.length,I.notifyListeners(j.location,j.action)}function N(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||R(C(e.state))}function P(){R(C(y()))}var L=!1;function R(e){if(L)L=!1,A();else{I.confirmTransitionTo(e,"POP",x,(function(t){t?A({action:"POP",location:e}):function(e){var t=j.location,n=M.indexOf(t.key);-1===n&&(n=0);var r=M.indexOf(e.key);-1===r&&(r=0);var i=n-r;i&&(L=!0,F(i))}(e)}))}}var O=C(y()),M=[O.key];function D(e){return _+p(e)}function F(e){n.go(e)}var B=0;function U(e){1===(B+=e)&&1===e?(window.addEventListener(b,N),a&&window.addEventListener(g,P)):0===B&&(window.removeEventListener(b,N),a&&window.removeEventListener(g,P))}var z=!1;var j={length:n.length,action:"POP",location:O,createHref:D,push:function(e,t){var r="PUSH",a=f(e,t,T(),j.location);I.confirmTransitionTo(a,r,x,(function(e){if(e){var t=D(a),o=a.key,s=a.state;if(i)if(n.pushState({key:o,state:s},null,t),w)window.location.href=t;else{var c=M.indexOf(j.location.key),l=M.slice(0,c+1);l.push(a.key),M=l,A({action:r,location:a})}else window.location.href=t}}))},replace:function(e,t){var r="REPLACE",a=f(e,t,T(),j.location);I.confirmTransitionTo(a,r,x,(function(e){if(e){var t=D(a),o=a.key,s=a.state;if(i)if(n.replaceState({key:o,state:s},null,t),w)window.location.replace(t);else{var c=M.indexOf(j.location.key);-1!==c&&(M[c]=a.key),A({action:r,location:a})}else window.location.replace(t)}}))},go:F,goBack:function(){F(-1)},goForward:function(){F(1)},block:function(e){void 0===e&&(e=!1);var t=I.setPrompt(e);return z||(U(1),z=!0),function(){return z&&(z=!1,U(-1)),t()}},listen:function(e){var t=I.appendListener(e);return U(1),function(){U(-1),t()}}};return j}var S="hashchange",x={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+l(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:l,decodePath:c},slash:{encodePath:c,decodePath:c}};function k(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function E(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function _(e){window.location.replace(k(window.location.href)+"#"+e)}function C(e){void 0===e&&(e={}),m||(0,s.Z)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),i=n.getUserConfirmation,a=void 0===i?h:i,o=n.hashType,l=void 0===o?"slash":o,b=e.basename?d(c(e.basename)):"",g=x[l],y=g.encodePath,w=g.decodePath;function C(){var e=w(E());return b&&(e=u(e,b)),f(e)}var T=v();function I(e){(0,r.Z)(z,e),z.length=t.length,T.notifyListeners(z.location,z.action)}var A=!1,N=null;function P(){var e,t,n=E(),r=y(n);if(n!==r)_(r);else{var i=C(),o=z.location;if(!A&&(t=i,(e=o).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(N===p(i))return;N=null,function(e){if(A)A=!1,I();else{var t="POP";T.confirmTransitionTo(e,t,a,(function(n){n?I({action:t,location:e}):function(e){var t=z.location,n=M.lastIndexOf(p(t));-1===n&&(n=0);var r=M.lastIndexOf(p(e));-1===r&&(r=0);var i=n-r;i&&(A=!0,D(i))}(e)}))}}(i)}}var L=E(),R=y(L);L!==R&&_(R);var O=C(),M=[p(O)];function D(e){t.go(e)}var F=0;function B(e){1===(F+=e)&&1===e?window.addEventListener(S,P):0===F&&window.removeEventListener(S,P)}var U=!1;var z={length:t.length,action:"POP",location:O,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=k(window.location.href)),n+"#"+y(b+p(e))},push:function(e,t){var n="PUSH",r=f(e,void 0,void 0,z.location);T.confirmTransitionTo(r,n,a,(function(e){if(e){var t=p(r),i=y(b+t);if(E()!==i){N=t,function(e){window.location.hash=e}(i);var a=M.lastIndexOf(p(z.location)),o=M.slice(0,a+1);o.push(t),M=o,I({action:n,location:r})}else I()}}))},replace:function(e,t){var n="REPLACE",r=f(e,void 0,void 0,z.location);T.confirmTransitionTo(r,n,a,(function(e){if(e){var t=p(r),i=y(b+t);E()!==i&&(N=t,_(i));var a=M.indexOf(p(z.location));-1!==a&&(M[a]=t),I({action:n,location:r})}}))},go:D,goBack:function(){D(-1)},goForward:function(){D(1)},block:function(e){void 0===e&&(e=!1);var t=T.setPrompt(e);return U||(B(1),U=!0),function(){return U&&(U=!1,B(-1)),t()}},listen:function(e){var t=T.appendListener(e);return B(1),function(){B(-1),t()}}};return z}function T(e,t,n){return Math.min(Math.max(e,t),n)}function I(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,i=t.initialEntries,a=void 0===i?["/"]:i,o=t.initialIndex,s=void 0===o?0:o,c=t.keyLength,l=void 0===c?6:c,u=v();function d(e){(0,r.Z)(w,e),w.length=w.entries.length,u.notifyListeners(w.location,w.action)}function m(){return Math.random().toString(36).substr(2,l)}var h=T(s,0,a.length-1),b=a.map((function(e){return f(e,void 0,"string"==typeof e?m():e.key||m())})),g=p;function y(e){var t=T(w.index+e,0,w.entries.length-1),r=w.entries[t];u.confirmTransitionTo(r,"POP",n,(function(e){e?d({action:"POP",location:r,index:t}):d()}))}var w={length:b.length,action:"POP",location:b[h],index:h,entries:b,createHref:g,push:function(e,t){var r="PUSH",i=f(e,t,m(),w.location);u.confirmTransitionTo(i,r,n,(function(e){if(e){var t=w.index+1,n=w.entries.slice(0);n.length>t?n.splice(t,n.length-t,i):n.push(i),d({action:r,location:i,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",i=f(e,t,m(),w.location);u.confirmTransitionTo(i,r,n,(function(e){e&&(w.entries[w.index]=i,d({action:r,location:i}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t<w.entries.length},block:function(e){return void 0===e&&(e=!1),u.setPrompt(e)},listen:function(e){return u.appendListener(e)}};return w}},55839:(e,t,n)=>{"use strict";var r=n(19185),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function c(e){return r.isMemo(e)?o:s[e.$$typeof]||i}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=o;var l=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,v=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(v){var i=f(n);i&&i!==v&&e(t,i,r)}var o=u(n);d&&(o=o.concat(d(n)));for(var s=c(t),m=c(n),h=0;h<o.length;++h){var b=o[h];if(!(a[b]||r&&r[b]||m&&m[b]||s&&s[b])){var g=p(n,b);try{l(t,b,g)}catch(y){}}}}return t}},3996:e=>{"use strict";e.exports=function(e,t,n,r,i,a,o,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,i,a,o,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},55182:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},19043:(e,t,n)=>{"use strict";n.r(t)},70142:(e,t,n)=>{"use strict";n.r(t)},26222:(e,t,n)=>{"use strict";n.r(t)},8504:function(e,t,n){var r,i;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function i(e,t,n){return e<t?t:e>n?n:e}function a(e){return 100*(-1+e)}function o(e,t,n){var i;return(i="translate3d"===r.positionUsing?{transform:"translate3d("+a(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+a(e)+"%,0)"}:{"margin-left":a(e)+"%"}).transition="all "+t+"ms "+n,i}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=i(e,r.minimum,1),n.status=1===e?null:e;var a=n.render(!t),l=a.querySelector(r.barSelector),u=r.speed,d=r.easing;return a.offsetWidth,s((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),c(l,o(e,u,d)),1===e?(c(a,{transition:"none",opacity:1}),a.offsetWidth,setTimeout((function(){c(a,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*i(Math.random()*t,.1,.95)),t=i(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var i,o=t.querySelector(r.barSelector),s=e?"-100":a(n.status||0),l=document.querySelector(r.parent);return c(o,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),r.showSpinner||(i=t.querySelector(r.spinnerSelector))&&f(i),l!=document.body&&u(l,"nprogress-custom-parent"),l.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var s=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),c=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,i=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);i--;)if((r=e[i]+a)in n)return r;return t}function i(e){return e=n(e),t[e]||(t[e]=r(e))}function a(e,t,n){t=i(t),e.style[t]=n}return function(e,t){var n,r,i=arguments;if(2==i.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&a(e,n,r);else a(e,i[1],i[2])}}();function l(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;l(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);l(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(i="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=i)},62525:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,i){for(var a,o,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var l in a=Object(arguments[c]))n.call(a,l)&&(s[l]=a[l]);if(t){o=t(a);for(var u=0;u<o.length;u++)r.call(a,o[u])&&(s[o[u]]=a[o[u]])}}return s}},52349:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,n){var i,a;switch(n=n||{},r.util.type(t)){case"Object":if(a=r.util.objId(t),n[a])return n[a];for(var o in i={},n[a]=i,t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case"Array":return a=r.util.objId(t),n[a]?n[a]:(i=[],n[a]=i,t.forEach((function(t,r){i[r]=e(t,n)})),i);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+n)},isActive:function(e,t,n){for(var r="no-"+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){var a=(i=i||r.languages)[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=i[e];return i[e]=o,r.languages.DFS(r.languages,(function(t,n){n===l&&t!=e&&(this[t]=o)})),o},DFS:function e(t,n,i,a){a=a||{};var o=r.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],i||s);var c=t[s],l=r.util.type(c);"Object"!==l||a[o(c)]?"Array"!==l||a[o(c)]||(a[o(c)]=!0,e(c,n,s,a)):(a[o(c)]=!0,e(c,n,null,a))}}},plugins:{},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",a),a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run("after-tokenize",a),i.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new s;return c(i,i.head,e),o(e,i,t,i.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(i)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,a=0;i=n[a++];)i(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function a(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function o(e,t,n,s,u,d){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var f=n[p];f=Array.isArray(f)?f:[f];for(var v=0;v<f.length;++v){if(d&&d.cause==p+","+v)return;var m=f[v],h=m.inside,b=!!m.lookbehind,g=!!m.greedy,y=m.alias;if(g&&!m.pattern.global){var w=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,w+"g")}for(var S=m.pattern||m,x=s.next,k=u;x!==t.tail&&!(d&&k>=d.reach);k+=x.value.length,x=x.next){var E=x.value;if(t.length>e.length)return;if(!(E instanceof i)){var _,C=1;if(g){if(!(_=a(S,k,e,b))||_.index>=e.length)break;var T=_.index,I=_.index+_[0].length,A=k;for(A+=x.value.length;T>=A;)A+=(x=x.next).value.length;if(k=A-=x.value.length,x.value instanceof i)continue;for(var N=x;N!==t.tail&&(A<I||"string"==typeof N.value);N=N.next)C++,A+=N.value.length;C--,E=e.slice(k,A),_.index-=k}else if(!(_=a(S,0,E,b)))continue;T=_.index;var P=_[0],L=E.slice(0,T),R=E.slice(T+P.length),O=k+E.length;d&&O>d.reach&&(d.reach=O);var M=x.prev;if(L&&(M=c(t,M,L),k+=L.length),l(t,M,C),x=c(t,M,new i(p,h?r.tokenize(P,h):P,y,P)),R&&c(t,x,R),C>1){var D={cause:p+","+v,reach:O};o(e,t,n,x.prev,k,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function l(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}return i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach((function(t){i+=e(t,n)})),i}var a={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run("wrap",a);var s="";for(var c in a.attributes)s+=" "+c+'="'+(a.attributes[c]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+s+">"+a.content+"</"+a.tag+">"},r}(),i=r;r.default=r,i.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},i.languages.markup.tag.inside["attr-value"].inside.entity=i.languages.markup.entity,i.languages.markup.doctype.inside["internal-subset"].inside=i.languages.markup,i.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(i.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:i.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:i.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},i.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(i.languages.markup.tag,"addAttribute",{value:function(e,t){i.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:i.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,i.languages.xml=i.languages.extend("markup",{}),i.languages.ssml=i.languages.xml,i.languages.atom=i.languages.xml,i.languages.rss=i.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.shell=e.languages.bash}(i),i.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},i.languages.c=i.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),i.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),i.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},i.languages.c.string],char:i.languages.c.char,comment:i.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:i.languages.c}}}}),i.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete i.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(i),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(i),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(i),i.languages.javascript=i.languages.extend("clike",{"class-name":[i.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),i.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,i.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:i.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:i.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:i.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:i.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:i.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),i.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),i.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),i.languages.markup&&(i.languages.markup.tag.addInlined("script","javascript"),i.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),i.languages.js=i.languages.javascript,function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(i),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<value>>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,(function(){return r})).replace(/<<key>>/g,(function(){return"(?:"+i+"|"+a+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(i),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+a+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+a+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var i=t[n];if("code"===i.type){var a=i.content[1],o=i.content[3];if(a&&o&&"code-language"===a.type&&"code-block"===o.type&&"string"==typeof a.content){var s=a.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),c="language-"+(s=(/[a-z][\w-]*/i.exec(s)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,c]:o.alias.push(c):o.alias=[c]}}else e(i.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],l=/language-(.+)/.exec(a);if(l){n=l[1];break}}var u,d=e.languages[n];if(d)t.content=e.highlight((u=t.content,u.replace(o,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),c(n);var r=s[t];return r||e}))),d,n);else if(n&&"none"!==n&&e.plugins.autoloader){var p="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=p,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(p);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var o=RegExp(e.languages.markup.tag.pattern.source,"gi"),s={amp:"&",lt:"<",gt:">",quot:'"'},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(i),i.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:i.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},i.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n<t.length;){var r=t[n++];if("keyword"===r.type&&"mutation"===r.content){var i=[];if(d(["definition-mutation","punctuation"])&&"("===u(1).content){n+=2;var a=p(/^\($/,/^\)$/);if(-1===a)continue;for(;n<a;n++){var o=u(0);"variable"===o.type&&(f(o,"variable-input"),i.push(o.content))}n=a+1}if(d(["punctuation","property-query"])&&"{"===u(0).content&&(n++,f(u(0),"property-mutation"),i.length>0)){var s=p(/^\{$/,/^\}$/);if(-1===s)continue;for(var c=n;c<s;c++){var l=t[c];"variable"===l.type&&i.indexOf(l.content)>=0&&f(l,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return!1}return!0}function p(e,r){for(var i=1,a=n;a<t.length;a++){var o=t[a],s=o.content;if("punctuation"===o.type&&"string"==typeof s)if(e.test(s))i++;else if(r.test(s)&&0===--i)return a}return-1}function f(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}})),i.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,i=r.inside["interpolation-punctuation"],a=r.pattern.source;function o(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function s(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function c(t,n,r){var i={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",i),i.tokens=e.tokenize(i.code,i.grammar),e.hooks.run("after-tokenize",i),i.tokens}function l(t){var n={};n["interpolation-punctuation"]=i;var a=e.tokenize(t,n);if(3===a.length){var o=[1,1];o.push.apply(o,c(a[1],e.languages.javascript,"javascript")),a.splice.apply(a,o)}return new e.Token("interpolation",a,r.alias,t)}function u(t,n,r){var i=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),o=0,u={},d=c(i.map((function(e){if("string"==typeof e)return e;for(var n,i=e.content;-1!==t.indexOf(n=s(o++,r)););return u[n]=i,n})).join(""),n,r),p=Object.keys(u);return o=0,function e(t){for(var n=0;n<t.length;n++){if(o>=p.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var i=p[o],a="string"==typeof r?r:r.content,s=a.indexOf(i);if(-1!==s){++o;var c=a.substring(0,s),d=l(u[i]),f=a.substring(s+i.length),v=[];if(c&&v.push(c),v.push(d),f){var m=[f];e(m),v.push.apply(v,m)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(v)),n+=v.length-1):r.content=v}}else{var h=r.content;Array.isArray(h)?e(h):e([h])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[o("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),o("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),o("svg",/\bsvg/.source),o("markdown",/\b(?:markdown|md)/.source),o("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),o("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(p).join(""):p(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,i=n.length;r<i;r++){var a=n[r];if("string"!=typeof a){var o=a.content;if(Array.isArray(o))if("template-string"===a.type){var s=o[1];if(3===o.length&&"string"!=typeof s&&"embedded-code"===s.type){var c=p(s),l=s.alias,d=Array.isArray(l)?l[0]:l,f=e.languages[d];if(!f)continue;o[1]=u(c,f,d)}}else t(o);else"string"!=typeof o&&t([o])}}}(t.tokens)}))}(i),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(i),function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var i=n[r],a=e.languages.javascript[i];"RegExp"===e.util.type(a)&&(a=e.languages.javascript[i]={pattern:a});var o=a.inside||{};a.inside=o,o["maybe-class-name"]=/^[A-Z][\s\S]*/}}(i),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,i=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function a(e,t){return e=e.replace(/<S>/g,(function(){return n})).replace(/<BRACES>/g,(function(){return r})).replace(/<SPREAD>/g,(function(){return i})),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(o).join(""):""},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if("string"!=typeof i&&("tag"===i.type&&i.content[0]&&"tag"===i.content[0].type?"</"===i.content[0].content[0].content?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():"/>"===i.content[i.content.length-1].content||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===i.type&&"{"===i.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===i.type&&"}"===i.content?n[n.length-1].openedBraces--:a=!0),(a||"string"==typeof i)&&n.length>0&&0===n[n.length-1].openedBraces){var c=o(i);r<t.length-1&&("string"==typeof t[r+1]||"plain-text"===t[r+1].type)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",c,null,c)}i.content&&"string"!=typeof i.content&&s(i.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||s(e.tokens)}))}(i),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(i),i.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},i.languages.go=i.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),i.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete i.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,i,a){if(n.language===r){var o=n.tokenStack=[];n.code=n.code.replace(i,(function(e){if("function"==typeof a&&!a(e))return e;for(var i,s=o.length;-1!==n.code.indexOf(i=t(r,s));)++s;return o[s]=e,i})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var i=0,a=Object.keys(n.tokenStack);!function o(s){for(var c=0;c<s.length&&!(i>=a.length);c++){var l=s[c];if("string"==typeof l||l.content&&"string"==typeof l.content){var u=a[i],d=n.tokenStack[u],p="string"==typeof l?l:l.content,f=t(r,u),v=p.indexOf(f);if(v>-1){++i;var m=p.substring(0,v),h=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=p.substring(v+f.length),g=[];m&&g.push.apply(g,o([m])),g.push(h),b&&g.push.apply(g,o([b])),"string"==typeof l?s.splice.apply(s,[c,1].concat(g)):l.content=g}}else l.content&&o(l.content)}return s}(n.tokens)}}}})}(i),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(i),i.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},i.languages.webmanifest=i.languages.json,i.languages.less=i.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),i.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),i.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},i.languages.objectivec=i.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete i.languages.objectivec["class-name"],i.languages.objc=i.languages.objectivec,i.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},i.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},i.languages.python["string-interpolation"].inside.interpolation.inside.rest=i.languages.python,i.languages.py=i.languages.python,i.languages.reason=i.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),i.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete i.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(i),i.languages.scss=i.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),i.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),i.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),i.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),i.languages.scss.atrule.inside.rest=i.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(i),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(i),i.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const a=i},66953:()=>{!function(e){function t(e){return RegExp(/(\()/.source+"(?:"+e+")"+/(?=[\s\)])/.source)}function n(e){return RegExp(/([\s([])/.source+"(?:"+e+")"+/(?=[\s)])/.source)}var r=/(?!\d)[-+*/~!@$%^=<>{}\w]+/.source,i="&"+r,a="(\\()",o="(?=\\s)",s=/(?:[^()]|\((?:[^()]|\((?:[^()]|\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))*\))*\))*/.source,c={heading:{pattern:/;;;.*/,alias:["comment","title"]},comment:/;.*/,string:{pattern:/"(?:[^"\\]|\\.)*"/,greedy:!0,inside:{argument:/[-A-Z]+(?=[.,\s])/,symbol:RegExp("`"+r+"'")}},"quoted-symbol":{pattern:RegExp("#?'"+r),alias:["variable","symbol"]},"lisp-property":{pattern:RegExp(":"+r),alias:"property"},splice:{pattern:RegExp(",@?"+r),alias:["symbol","variable"]},keyword:[{pattern:RegExp(a+"(?:and|(?:cl-)?letf|cl-loop|cond|cons|error|if|(?:lexical-)?let\\*?|message|not|null|or|provide|require|setq|unless|use-package|when|while)"+o),lookbehind:!0},{pattern:RegExp(a+"(?:append|by|collect|concat|do|finally|for|in|return)"+o),lookbehind:!0}],declare:{pattern:t(/declare/.source),lookbehind:!0,alias:"keyword"},interactive:{pattern:t(/interactive/.source),lookbehind:!0,alias:"keyword"},boolean:{pattern:n(/nil|t/.source),lookbehind:!0},number:{pattern:n(/[-+]?\d+(?:\.\d*)?/.source),lookbehind:!0},defvar:{pattern:RegExp(a+"def(?:const|custom|group|var)\\s+"+r),lookbehind:!0,inside:{keyword:/^def[a-z]+/,variable:RegExp(r)}},defun:{pattern:RegExp(a+/(?:cl-)?(?:defmacro|defun\*?)\s+/.source+r+/\s+\(/.source+s+/\)/.source),lookbehind:!0,greedy:!0,inside:{keyword:/^(?:cl-)?def\S+/,arguments:null,function:{pattern:RegExp("(^\\s)"+r),lookbehind:!0},punctuation:/[()]/}},lambda:{pattern:RegExp(a+"lambda\\s+\\(\\s*(?:&?"+r+"(?:\\s+&?"+r+")*\\s*)?\\)"),lookbehind:!0,greedy:!0,inside:{keyword:/^lambda/,arguments:null,punctuation:/[()]/}},car:{pattern:RegExp(a+r),lookbehind:!0},punctuation:[/(?:['`,]?\(|[)\[\]])/,{pattern:/(\s)\.(?=\s)/,lookbehind:!0}]},l={"lisp-marker":RegExp(i),varform:{pattern:RegExp(/\(/.source+r+/\s+(?=\S)/.source+s+/\)/.source),inside:c},argument:{pattern:RegExp(/(^|[\s(])/.source+r),lookbehind:!0,alias:"variable"},rest:c},u="\\S+(?:\\s+\\S+)*",d={pattern:RegExp(a+s+"(?=\\))"),lookbehind:!0,inside:{"rest-vars":{pattern:RegExp("&(?:body|rest)\\s+"+u),inside:l},"other-marker-vars":{pattern:RegExp("&(?:aux|optional)\\s+"+u),inside:l},keys:{pattern:RegExp("&key\\s+"+u+"(?:\\s+&allow-other-keys)?"),inside:l},argument:{pattern:RegExp(r),alias:"variable"},punctuation:/[()]/}};c.lambda.inside.arguments=d,c.defun.inside.arguments=e.util.clone(d),c.defun.inside.arguments.inside.sublist=d,e.languages.lisp=c,e.languages.elisp=c,e.languages.emacs=c,e.languages["emacs-lisp"]=c}(Prism)},46324:(e,t,n)=>{var r={"./prism-lisp":66953};function i(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}i.keys=function(){return Object.keys(r)},i.resolve=a,e.exports=i,i.id=46324},58772:(e,t,n)=>{"use strict";var r=n(90331);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},23615:(e,t,n)=>{e.exports=n(58772)()},90331:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},43577:(e,t,n)=>{"use strict";var r=n(27378),i=n(62525),a=n(91102);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(o(227));var s=new Set,c={};function l(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(c[e]=t,e=0;e<t.length;e++)s.add(t[e])}var d=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f=Object.prototype.hasOwnProperty,v={},m={};function h(e,t,n,r,i,a,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){b[e]=new h(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];b[t]=new h(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){b[e]=new h(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){b[e]=new h(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){b[e]=new h(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){b[e]=new h(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){b[e]=new h(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){b[e]=new h(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){b[e]=new h(e,5,!1,e.toLowerCase(),null,!1,!1)}));var g=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}function w(e,t,n,r){var i=b.hasOwnProperty(t)?b[t]:null;(null!==i?0===i.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!f.call(m,e)||!f.call(v,e)&&(p.test(e)?m[e]=!0:(v[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(g,y);b[t]=new h(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(g,y);b[t]=new h(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(g,y);b[t]=new h(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){b[e]=new h(e,1,!1,e.toLowerCase(),null,!1,!1)})),b.xlinkHref=new h("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){b[e]=new h(e,1,!1,e.toLowerCase(),null,!0,!0)}));var S=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=60103,k=60106,E=60107,_=60108,C=60114,T=60109,I=60110,A=60112,N=60113,P=60120,L=60115,R=60116,O=60121,M=60128,D=60129,F=60130,B=60131;if("function"==typeof Symbol&&Symbol.for){var U=Symbol.for;x=U("react.element"),k=U("react.portal"),E=U("react.fragment"),_=U("react.strict_mode"),C=U("react.profiler"),T=U("react.provider"),I=U("react.context"),A=U("react.forward_ref"),N=U("react.suspense"),P=U("react.suspense_list"),L=U("react.memo"),R=U("react.lazy"),O=U("react.block"),U("react.scope"),M=U("react.opaque.id"),D=U("react.debug_trace_mode"),F=U("react.offscreen"),B=U("react.legacy_hidden")}var z,j="function"==typeof Symbol&&Symbol.iterator;function $(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=j&&e[j]||e["@@iterator"])?e:null}function H(e){if(void 0===z)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||""}return"\n"+z+e}var q=!1;function V(e,t){if(!e||q)return"";q=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"==typeof c.stack){for(var i=c.stack.split("\n"),a=r.stack.split("\n"),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(1!==o||1!==s)do{if(o--,0>--s||i[o]!==a[s])return"\n"+i[o].replace(" at new "," at ")}while(1<=o&&0<=s);break}}}finally{q=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?H(e):""}function Z(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=V(e.type,!1);case 11:return e=V(e.type.render,!1);case 22:return e=V(e.type._render,!1);case 1:return e=V(e.type,!0);default:return""}}function W(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case E:return"Fragment";case k:return"Portal";case C:return"Profiler";case _:return"StrictMode";case N:return"Suspense";case P:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case I:return(e.displayName||"Context")+".Consumer";case T:return(e._context.displayName||"Context")+".Provider";case A:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case L:return W(e.type);case O:return W(e._render);case R:t=e._payload,e=e._init;try{return W(e(t))}catch(n){}}return null}function G(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function K(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function X(e){e._valueTracker||(e._valueTracker=function(e){var t=K(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Y(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=K(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Q(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function J(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=G(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&w(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=G(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ie(e,t.type,n):t.hasOwnProperty("defaultValue")&&ie(e,t.type,G(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ie(e,t,n){"number"===t&&Q(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function ae(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function oe(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+G(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function se(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return i({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ce(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(o(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(o(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:G(n)}}function le(e,t){var n=G(t.value),r=G(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ue(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var de={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function pe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?pe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ve,me,he=(me=function(e,t){if(e.namespaceURI!==de.svg||"innerHTML"in e)e.innerHTML=t;else{for((ve=ve||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ve.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return me(e,t)}))}:me);function be(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ge={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","ms","Moz","O"];function we(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ge.hasOwnProperty(e)&&ge[e]?(""+t).trim():t+"px"}function Se(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=we(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(ge).forEach((function(e){ye.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ge[t]=ge[e]}))}));var xe=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ke(e,t){if(t){if(xe[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(o(62))}}function Ee(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function _e(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,Te=null,Ie=null;function Ae(e){if(e=ni(e)){if("function"!=typeof Ce)throw Error(o(280));var t=e.stateNode;t&&(t=ii(t),Ce(e.stateNode,e.type,t))}}function Ne(e){Te?Ie?Ie.push(e):Ie=[e]:Te=e}function Pe(){if(Te){var e=Te,t=Ie;if(Ie=Te=null,Ae(e),t)for(e=0;e<t.length;e++)Ae(t[e])}}function Le(e,t){return e(t)}function Re(e,t,n,r,i){return e(t,n,r,i)}function Oe(){}var Me=Le,De=!1,Fe=!1;function Be(){null===Te&&null===Ie||(Oe(),Pe())}function Ue(e,t){var n=e.stateNode;if(null===n)return null;var r=ii(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(o(231,t,typeof n));return n}var ze=!1;if(d)try{var je={};Object.defineProperty(je,"passive",{get:function(){ze=!0}}),window.addEventListener("test",je,je),window.removeEventListener("test",je,je)}catch(me){ze=!1}function $e(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(u){this.onError(u)}}var He=!1,qe=null,Ve=!1,Ze=null,We={onError:function(e){He=!0,qe=e}};function Ge(e,t,n,r,i,a,o,s,c){He=!1,qe=null,$e.apply(We,arguments)}function Ke(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Xe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ye(e){if(Ke(e)!==e)throw Error(o(188))}function Qe(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ke(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var a=i.alternate;if(null===a){if(null!==(r=i.return)){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return Ye(i),e;if(a===r)return Ye(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Je(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var et,tt,nt,rt,it=!1,at=[],ot=null,st=null,ct=null,lt=new Map,ut=new Map,dt=[],pt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ft(e,t,n,r,i){return{blockedOn:e,domEventName:t,eventSystemFlags:16|n,nativeEvent:i,targetContainers:[r]}}function vt(e,t){switch(e){case"focusin":case"focusout":ot=null;break;case"dragenter":case"dragleave":st=null;break;case"mouseover":case"mouseout":ct=null;break;case"pointerover":case"pointerout":lt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ut.delete(t.pointerId)}}function mt(e,t,n,r,i,a){return null===e||e.nativeEvent!==a?(e=ft(t,n,r,i,a),null!==t&&(null!==(t=ni(t))&&tt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function ht(e){var t=ti(e.target);if(null!==t){var n=Ke(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Xe(n)))return e.blockedOn=t,void rt(e.lanePriority,(function(){a.unstable_runWithPriority(e.priority,(function(){nt(n)}))}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function bt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=ni(n))&&tt(t),e.blockedOn=n,!1;t.shift()}return!0}function gt(e,t,n){bt(e)&&n.delete(t)}function yt(){for(it=!1;0<at.length;){var e=at[0];if(null!==e.blockedOn){null!==(e=ni(e.blockedOn))&&et(e);break}for(var t=e.targetContainers;0<t.length;){var n=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n){e.blockedOn=n;break}t.shift()}null===e.blockedOn&&at.shift()}null!==ot&&bt(ot)&&(ot=null),null!==st&&bt(st)&&(st=null),null!==ct&&bt(ct)&&(ct=null),lt.forEach(gt),ut.forEach(gt)}function wt(e,t){e.blockedOn===t&&(e.blockedOn=null,it||(it=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,yt)))}function St(e){function t(t){return wt(t,e)}if(0<at.length){wt(at[0],e);for(var n=1;n<at.length;n++){var r=at[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==ot&&wt(ot,e),null!==st&&wt(st,e),null!==ct&&wt(ct,e),lt.forEach(t),ut.forEach(t),n=0;n<dt.length;n++)(r=dt[n]).blockedOn===e&&(r.blockedOn=null);for(;0<dt.length&&null===(n=dt[0]).blockedOn;)ht(n),null===n.blockedOn&&dt.shift()}function xt(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var kt={animationend:xt("Animation","AnimationEnd"),animationiteration:xt("Animation","AnimationIteration"),animationstart:xt("Animation","AnimationStart"),transitionend:xt("Transition","TransitionEnd")},Et={},_t={};function Ct(e){if(Et[e])return Et[e];if(!kt[e])return e;var t,n=kt[e];for(t in n)if(n.hasOwnProperty(t)&&t in _t)return Et[e]=n[t];return e}d&&(_t=document.createElement("div").style,"AnimationEvent"in window||(delete kt.animationend.animation,delete kt.animationiteration.animation,delete kt.animationstart.animation),"TransitionEvent"in window||delete kt.transitionend.transition);var Tt=Ct("animationend"),It=Ct("animationiteration"),At=Ct("animationstart"),Nt=Ct("transitionend"),Pt=new Map,Lt=new Map,Rt=["abort","abort",Tt,"animationEnd",It,"animationIteration",At,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Nt,"transitionEnd","waiting","waiting"];function Ot(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];i="on"+(i[0].toUpperCase()+i.slice(1)),Lt.set(r,t),Pt.set(r,i),l(i,[r])}}(0,a.unstable_now)();var Mt=8;function Dt(e){if(0!=(1&e))return Mt=15,1;if(0!=(2&e))return Mt=14,2;if(0!=(4&e))return Mt=13,4;var t=24&e;return 0!==t?(Mt=12,t):0!=(32&e)?(Mt=11,32):0!==(t=192&e)?(Mt=10,t):0!=(256&e)?(Mt=9,256):0!==(t=3584&e)?(Mt=8,t):0!=(4096&e)?(Mt=7,4096):0!==(t=4186112&e)?(Mt=6,t):0!==(t=62914560&e)?(Mt=5,t):67108864&e?(Mt=4,67108864):0!=(134217728&e)?(Mt=3,134217728):0!==(t=805306368&e)?(Mt=2,t):0!=(1073741824&e)?(Mt=1,1073741824):(Mt=8,e)}function Ft(e,t){var n=e.pendingLanes;if(0===n)return Mt=0;var r=0,i=0,a=e.expiredLanes,o=e.suspendedLanes,s=e.pingedLanes;if(0!==a)r=a,i=Mt=15;else if(0!==(a=134217727&n)){var c=a&~o;0!==c?(r=Dt(c),i=Mt):0!==(s&=a)&&(r=Dt(s),i=Mt)}else 0!==(a=n&~o)?(r=Dt(a),i=Mt):0!==s&&(r=Dt(s),i=Mt);if(0===r)return 0;if(r=n&((0>(r=31-Ht(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0==(t&o)){if(Dt(t),i<=Mt)return t;Mt=i}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-Ht(t)),r|=e[n],t&=~i;return r}function Bt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Ut(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=zt(24&~t))?Ut(10,t):e;case 10:return 0===(e=zt(192&~t))?Ut(8,t):e;case 8:return 0===(e=zt(3584&~t))&&(0===(e=zt(4186112&~t))&&(e=512)),e;case 2:return 0===(t=zt(805306368&~t))&&(t=268435456),t}throw Error(o(358,e))}function zt(e){return e&-e}function jt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $t(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-Ht(t)]=n}var Ht=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(qt(e)/Vt|0)|0},qt=Math.log,Vt=Math.LN2;var Zt=a.unstable_UserBlockingPriority,Wt=a.unstable_runWithPriority,Gt=!0;function Kt(e,t,n,r){De||Oe();var i=Yt,a=De;De=!0;try{Re(i,e,t,n,r)}finally{(De=a)||Be()}}function Xt(e,t,n,r){Wt(Zt,Yt.bind(null,e,t,n,r))}function Yt(e,t,n,r){var i;if(Gt)if((i=0==(4&t))&&0<at.length&&-1<pt.indexOf(e))e=ft(null,e,t,n,r),at.push(e);else{var a=Qt(e,t,n,r);if(null===a)i&&vt(e,r);else{if(i){if(-1<pt.indexOf(e))return e=ft(a,e,t,n,r),void at.push(e);if(function(e,t,n,r,i){switch(t){case"focusin":return ot=mt(ot,e,t,n,r,i),!0;case"dragenter":return st=mt(st,e,t,n,r,i),!0;case"mouseover":return ct=mt(ct,e,t,n,r,i),!0;case"pointerover":var a=i.pointerId;return lt.set(a,mt(lt.get(a)||null,e,t,n,r,i)),!0;case"gotpointercapture":return a=i.pointerId,ut.set(a,mt(ut.get(a)||null,e,t,n,r,i)),!0}return!1}(a,e,t,n,r))return;vt(e,r)}Or(e,t,r,null,n)}}}function Qt(e,t,n,r){var i=_e(r);if(null!==(i=ti(i))){var a=Ke(i);if(null===a)i=null;else{var o=a.tag;if(13===o){if(null!==(i=Xe(a)))return i;i=null}else if(3===o){if(a.stateNode.hydrate)return 3===a.tag?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return Or(e,t,r,i,n),null}var Jt=null,en=null,tn=null;function nn(){if(tn)return tn;var e,t,n=en,r=n.length,i="value"in Jt?Jt.value:Jt.textContent,a=i.length;for(e=0;e<r&&n[e]===i[e];e++);var o=r-e;for(t=1;t<=o&&n[r-t]===i[a-t];t++);return tn=i.slice(e,1<t?1-t:void 0)}function rn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function an(){return!0}function on(){return!1}function sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?an:on,this.isPropagationStopped=on,this}return i(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=an)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=an)},persist:function(){},isPersistent:an}),t}var cn,ln,un,dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pn=sn(dn),fn=i({},dn,{view:0,detail:0}),vn=sn(fn),mn=i({},fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==un&&(un&&"mousemove"===e.type?(cn=e.screenX-un.screenX,ln=e.screenY-un.screenY):ln=cn=0,un=e),cn)},movementY:function(e){return"movementY"in e?e.movementY:ln}}),hn=sn(mn),bn=sn(i({},mn,{dataTransfer:0})),gn=sn(i({},fn,{relatedTarget:0})),yn=sn(i({},dn,{animationName:0,elapsedTime:0,pseudoElement:0})),wn=i({},dn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Sn=sn(wn),xn=sn(i({},dn,{data:0})),kn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},En={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},_n={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=_n[e])&&!!t[e]}function Tn(){return Cn}var In=i({},fn,{key:function(e){if(e.key){var t=kn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=rn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?En[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(e){return"keypress"===e.type?rn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?rn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),An=sn(In),Nn=sn(i({},mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=sn(i({},fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn})),Ln=sn(i({},dn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=i({},mn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),On=sn(Rn),Mn=[9,13,27,32],Dn=d&&"CompositionEvent"in window,Fn=null;d&&"documentMode"in document&&(Fn=document.documentMode);var Bn=d&&"TextEvent"in window&&!Fn,Un=d&&(!Dn||Fn&&8<Fn&&11>=Fn),zn=String.fromCharCode(32),jn=!1;function $n(e,t){switch(e){case"keyup":return-1!==Mn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var qn=!1;var Vn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Vn[e.type]:"textarea"===t}function Wn(e,t,n,r){Ne(r),0<(t=Dr(t,"onChange")).length&&(n=new pn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Gn=null,Kn=null;function Xn(e){Ir(e,0)}function Yn(e){if(Y(ri(e)))return e}function Qn(e,t){if("change"===e)return t}var Jn=!1;if(d){var er;if(d){var tr="oninput"in document;if(!tr){var nr=document.createElement("div");nr.setAttribute("oninput","return;"),tr="function"==typeof nr.oninput}er=tr}else er=!1;Jn=er&&(!document.documentMode||9<document.documentMode)}function rr(){Gn&&(Gn.detachEvent("onpropertychange",ir),Kn=Gn=null)}function ir(e){if("value"===e.propertyName&&Yn(Kn)){var t=[];if(Wn(t,Kn,e,_e(e)),e=Xn,De)e(t);else{De=!0;try{Le(e,t)}finally{De=!1,Be()}}}}function ar(e,t,n){"focusin"===e?(rr(),Kn=n,(Gn=t).attachEvent("onpropertychange",ir)):"focusout"===e&&rr()}function or(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Yn(Kn)}function sr(e,t){if("click"===e)return Yn(t)}function cr(e,t){if("input"===e||"change"===e)return Yn(t)}var lr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},ur=Object.prototype.hasOwnProperty;function dr(e,t){if(lr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!ur.call(t,n[r])||!lr(e[n[r]],t[n[r]]))return!1;return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fr(e,t){var n,r=pr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=pr(r)}}function vr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?vr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function mr(){for(var e=window,t=Q();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Q((e=t.contentWindow).document)}return t}function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var br=d&&"documentMode"in document&&11>=document.documentMode,gr=null,yr=null,wr=null,Sr=!1;function xr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;Sr||null==gr||gr!==Q(r)||("selectionStart"in(r=gr)&&hr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},wr&&dr(wr,r)||(wr=r,0<(r=Dr(yr,"onSelect")).length&&(t=new pn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=gr)))}Ot("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Ot("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Ot(Rt,2);for(var kr="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Er=0;Er<kr.length;Er++)Lt.set(kr[Er],0);u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _r="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cr=new Set("cancel close invalid load scroll toggle".split(" ").concat(_r));function Tr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,i,a,s,c,l){if(Ge.apply(this,arguments),He){if(!He)throw Error(o(198));var u=qe;He=!1,qe=null,Ve||(Ve=!0,Ze=u)}}(r,t,void 0,e),e.currentTarget=null}function Ir(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break e;Tr(i,s,l),a=c}else for(o=0;o<r.length;o++){if(c=(s=r[o]).instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break e;Tr(i,s,l),a=c}}}if(Ve)throw e=Ze,Ve=!1,Ze=null,e}function Ar(e,t){var n=ai(t),r=e+"__bubble";n.has(r)||(Rr(t,e,2,!1),n.add(r))}var Nr="_reactListening"+Math.random().toString(36).slice(2);function Pr(e){e[Nr]||(e[Nr]=!0,s.forEach((function(t){Cr.has(t)||Lr(t,!1,e,null),Lr(t,!0,e,null)})))}function Lr(e,t,n,r){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=n;if("selectionchange"===e&&9!==n.nodeType&&(a=n.ownerDocument),null!==r&&!t&&Cr.has(e)){if("scroll"!==e)return;i|=2,a=r}var o=ai(a),s=e+"__"+(t?"capture":"bubble");o.has(s)||(t&&(i|=4),Rr(a,e,i,t),o.add(s))}function Rr(e,t,n,r){var i=Lt.get(t);switch(void 0===i?2:i){case 0:i=Kt;break;case 1:i=Xt;break;default:i=Yt}n=i.bind(null,t,n,e),i=void 0,!ze||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Or(e,t,n,r,i){var a=r;if(0==(1&t)&&0==(2&t)&&null!==r)e:for(;;){if(null===r)return;var o=r.tag;if(3===o||4===o){var s=r.stateNode.containerInfo;if(s===i||8===s.nodeType&&s.parentNode===i)break;if(4===o)for(o=r.return;null!==o;){var c=o.tag;if((3===c||4===c)&&((c=o.stateNode.containerInfo)===i||8===c.nodeType&&c.parentNode===i))return;o=o.return}for(;null!==s;){if(null===(o=ti(s)))return;if(5===(c=o.tag)||6===c){r=a=o;continue e}s=s.parentNode}}r=r.return}!function(e,t,n){if(Fe)return e(t,n);Fe=!0;try{return Me(e,t,n)}finally{Fe=!1,Be()}}((function(){var r=a,i=_e(n),o=[];e:{var s=Pt.get(e);if(void 0!==s){var c=pn,l=e;switch(e){case"keypress":if(0===rn(n))break e;case"keydown":case"keyup":c=An;break;case"focusin":l="focus",c=gn;break;case"focusout":l="blur",c=gn;break;case"beforeblur":case"afterblur":c=gn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=hn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=bn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Pn;break;case Tt:case It:case At:c=yn;break;case Nt:c=Ln;break;case"scroll":c=vn;break;case"wheel":c=On;break;case"copy":case"cut":case"paste":c=Sn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Nn}var u=0!=(4&t),d=!u&&"scroll"===e,p=u?null!==s?s+"Capture":null:s;u=[];for(var f,v=r;null!==v;){var m=(f=v).stateNode;if(5===f.tag&&null!==m&&(f=m,null!==p&&(null!=(m=Ue(v,p))&&u.push(Mr(v,m,f)))),d)break;v=v.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(0==(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||0!=(16&t)||!(l=n.relatedTarget||n.fromElement)||!ti(l)&&!l[Jr])&&(c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=r,null!==(l=(l=n.relatedTarget||n.toElement)?ti(l):null)&&(l!==(d=Ke(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=r),c!==l)){if(u=hn,m="onMouseLeave",p="onMouseEnter",v="mouse","pointerout"!==e&&"pointerover"!==e||(u=Nn,m="onPointerLeave",p="onPointerEnter",v="pointer"),d=null==c?s:ri(c),f=null==l?s:ri(l),(s=new u(m,v+"leave",c,n,i)).target=d,s.relatedTarget=f,m=null,ti(i)===r&&((u=new u(p,v+"enter",l,n,i)).target=f,u.relatedTarget=d,m=u),d=m,c&&l)e:{for(p=l,v=0,f=u=c;f;f=Fr(f))v++;for(f=0,m=p;m;m=Fr(m))f++;for(;0<v-f;)u=Fr(u),v--;for(;0<f-v;)p=Fr(p),f--;for(;v--;){if(u===p||null!==p&&u===p.alternate)break e;u=Fr(u),p=Fr(p)}u=null}else u=null;null!==c&&Br(o,s,c,u,!1),null!==l&&null!==d&&Br(o,d,l,u,!0)}if("select"===(c=(s=r?ri(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var h=Qn;else if(Zn(s))if(Jn)h=cr;else{h=or;var b=ar}else(c=s.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(h=sr);switch(h&&(h=h(e,r))?Wn(o,h,n,i):(b&&b(e,s,r),"focusout"===e&&(b=s._wrapperState)&&b.controlled&&"number"===s.type&&ie(s,"number",s.value)),b=r?ri(r):window,e){case"focusin":(Zn(b)||"true"===b.contentEditable)&&(gr=b,yr=r,wr=null);break;case"focusout":wr=yr=gr=null;break;case"mousedown":Sr=!0;break;case"contextmenu":case"mouseup":case"dragend":Sr=!1,xr(o,n,i);break;case"selectionchange":if(br)break;case"keydown":case"keyup":xr(o,n,i)}var g;if(Dn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else qn?$n(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Un&&"ko"!==n.locale&&(qn||"onCompositionStart"!==y?"onCompositionEnd"===y&&qn&&(g=nn()):(en="value"in(Jt=i)?Jt.value:Jt.textContent,qn=!0)),0<(b=Dr(r,y)).length&&(y=new xn(y,e,null,n,i),o.push({event:y,listeners:b}),g?y.data=g:null!==(g=Hn(n))&&(y.data=g))),(g=Bn?function(e,t){switch(e){case"compositionend":return Hn(t);case"keypress":return 32!==t.which?null:(jn=!0,zn);case"textInput":return(e=t.data)===zn&&jn?null:e;default:return null}}(e,n):function(e,t){if(qn)return"compositionend"===e||!Dn&&$n(e,t)?(e=nn(),tn=en=Jt=null,qn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Un&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Dr(r,"onBeforeInput")).length&&(i=new xn("onBeforeInput","beforeinput",null,n,i),o.push({event:i,listeners:r}),i.data=g))}Ir(o,t)}))}function Mr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Dr(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,a=i.stateNode;5===i.tag&&null!==a&&(i=a,null!=(a=Ue(e,n))&&r.unshift(Mr(e,a,i)),null!=(a=Ue(e,t))&&r.push(Mr(e,a,i))),e=e.return}return r}function Fr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Br(e,t,n,r,i){for(var a=t._reactName,o=[];null!==n&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(null!==c&&c===r)break;5===s.tag&&null!==l&&(s=l,i?null!=(c=Ue(n,a))&&o.unshift(Mr(n,c,s)):i||null!=(c=Ue(n,a))&&o.push(Mr(n,c,s))),n=n.return}0!==o.length&&e.push({event:t,listeners:o})}function Ur(){}var zr=null,jr=null;function $r(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Hr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var qr="function"==typeof setTimeout?setTimeout:void 0,Vr="function"==typeof clearTimeout?clearTimeout:void 0;function Zr(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function Wr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Gr(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Kr=0;var Xr=Math.random().toString(36).slice(2),Yr="__reactFiber$"+Xr,Qr="__reactProps$"+Xr,Jr="__reactContainer$"+Xr,ei="__reactEvents$"+Xr;function ti(e){var t=e[Yr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Jr]||n[Yr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Gr(e);null!==e;){if(n=e[Yr])return n;e=Gr(e)}return t}n=(e=n).parentNode}return null}function ni(e){return!(e=e[Yr]||e[Jr])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function ri(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function ii(e){return e[Qr]||null}function ai(e){var t=e[ei];return void 0===t&&(t=e[ei]=new Set),t}var oi=[],si=-1;function ci(e){return{current:e}}function li(e){0>si||(e.current=oi[si],oi[si]=null,si--)}function ui(e,t){si++,oi[si]=e.current,e.current=t}var di={},pi=ci(di),fi=ci(!1),vi=di;function mi(e,t){var n=e.type.contextTypes;if(!n)return di;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,a={};for(i in n)a[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function hi(e){return null!=(e=e.childContextTypes)}function bi(){li(fi),li(pi)}function gi(e,t,n){if(pi.current!==di)throw Error(o(168));ui(pi,t),ui(fi,n)}function yi(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in e))throw Error(o(108,W(t)||"Unknown",a));return i({},n,r)}function wi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||di,vi=pi.current,ui(pi,e),ui(fi,fi.current),!0}function Si(e,t,n){var r=e.stateNode;if(!r)throw Error(o(169));n?(e=yi(e,t,vi),r.__reactInternalMemoizedMergedChildContext=e,li(fi),li(pi),ui(pi,e)):li(fi),ui(fi,n)}var xi=null,ki=null,Ei=a.unstable_runWithPriority,_i=a.unstable_scheduleCallback,Ci=a.unstable_cancelCallback,Ti=a.unstable_shouldYield,Ii=a.unstable_requestPaint,Ai=a.unstable_now,Ni=a.unstable_getCurrentPriorityLevel,Pi=a.unstable_ImmediatePriority,Li=a.unstable_UserBlockingPriority,Ri=a.unstable_NormalPriority,Oi=a.unstable_LowPriority,Mi=a.unstable_IdlePriority,Di={},Fi=void 0!==Ii?Ii:function(){},Bi=null,Ui=null,zi=!1,ji=Ai(),$i=1e4>ji?Ai:function(){return Ai()-ji};function Hi(){switch(Ni()){case Pi:return 99;case Li:return 98;case Ri:return 97;case Oi:return 96;case Mi:return 95;default:throw Error(o(332))}}function qi(e){switch(e){case 99:return Pi;case 98:return Li;case 97:return Ri;case 96:return Oi;case 95:return Mi;default:throw Error(o(332))}}function Vi(e,t){return e=qi(e),Ei(e,t)}function Zi(e,t,n){return e=qi(e),_i(e,t,n)}function Wi(){if(null!==Ui){var e=Ui;Ui=null,Ci(e)}Gi()}function Gi(){if(!zi&&null!==Bi){zi=!0;var e=0;try{var t=Bi;Vi(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),Bi=null}catch(n){throw null!==Bi&&(Bi=Bi.slice(e+1)),_i(Pi,Wi),n}finally{zi=!1}}}var Ki=S.ReactCurrentBatchConfig;function Xi(e,t){if(e&&e.defaultProps){for(var n in t=i({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var Yi=ci(null),Qi=null,Ji=null,ea=null;function ta(){ea=Ji=Qi=null}function na(e){var t=Yi.current;li(Yi),e.type._context._currentValue=t}function ra(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function ia(e,t){Qi=e,ea=Ji=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Do=!0),e.firstContext=null)}function aa(e,t){if(ea!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(ea=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Ji){if(null===Qi)throw Error(o(308));Ji=t,Qi.dependencies={lanes:0,firstContext:t,responders:null}}else Ji=Ji.next=t;return e._currentValue}var oa=!1;function sa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function ca(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function la(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ua(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function da(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?i=a=o:a=a.next=o,n=n.next}while(null!==n);null===a?i=a=t:a=a.next=t}else i=a=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pa(e,t,n,r){var a=e.updateQueue;oa=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,c=a.shared.pending;if(null!==c){a.shared.pending=null;var l=c,u=l.next;l.next=null,null===s?o=u:s.next=u,s=l;var d=e.alternate;if(null!==d){var p=(d=d.updateQueue).lastBaseUpdate;p!==s&&(null===p?d.firstBaseUpdate=u:p.next=u,d.lastBaseUpdate=l)}}if(null!==o){for(p=a.baseState,s=0,d=u=l=null;;){c=o.lane;var f=o.eventTime;if((r&c)===c){null!==d&&(d=d.next={eventTime:f,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var v=e,m=o;switch(c=t,f=n,m.tag){case 1:if("function"==typeof(v=m.payload)){p=v.call(f,p,c);break e}p=v;break e;case 3:v.flags=-4097&v.flags|64;case 0:if(null==(c="function"==typeof(v=m.payload)?v.call(f,p,c):v))break e;p=i({},p,c);break e;case 2:oa=!0}}null!==o.callback&&(e.flags|=32,null===(c=a.effects)?a.effects=[o]:c.push(o))}else f={eventTime:f,lane:c,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===d?(u=d=f,l=p):d=d.next=f,s|=c;if(null===(o=o.next)){if(null===(c=a.shared.pending))break;o=c.next,c.next=null,a.lastBaseUpdate=c,a.shared.pending=null}}null===d&&(l=p),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=d,js|=s,e.lanes=s,e.memoizedState=p}}function fa(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!=typeof i)throw Error(o(191,i));i.call(r)}}}var va=(new r.Component).refs;function ma(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:i({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var ha={isMounted:function(e){return!!(e=e._reactInternals)&&Ke(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pc(),i=fc(e),a=la(r,i);a.payload=t,null!=n&&(a.callback=n),ua(e,a),vc(e,i,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pc(),i=fc(e),a=la(r,i);a.tag=1,a.payload=t,null!=n&&(a.callback=n),ua(e,a),vc(e,i,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pc(),r=fc(e),i=la(n,r);i.tag=2,null!=t&&(i.callback=t),ua(e,i),vc(e,r,n)}};function ba(e,t,n,r,i,a,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,o):!t.prototype||!t.prototype.isPureReactComponent||(!dr(n,r)||!dr(i,a))}function ga(e,t,n){var r=!1,i=di,a=t.contextType;return"object"==typeof a&&null!==a?a=aa(a):(i=hi(t)?vi:pi.current,a=(r=null!=(r=t.contextTypes))?mi(e,i):di),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ha,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function ya(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ha.enqueueReplaceState(t,t.state,null)}function wa(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=va,sa(e);var a=t.contextType;"object"==typeof a&&null!==a?i.context=aa(a):(a=hi(t)?vi:pi.current,i.context=mi(e,a)),pa(e,n,i,r),i.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(ma(e,t,a,n),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&ha.enqueueReplaceState(i,i.state,null),pa(e,n,i,r),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4)}var Sa=Array.isArray;function xa(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,e));var i=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=r.refs;t===va&&(t=r.refs={}),null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!=typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function ka(e,t){if("textarea"!==e.type)throw Error(o(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function Ea(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=Zc(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function s(t){return e&&null===t.alternate&&(t.flags=2),t}function c(e,t,n,r){return null===t||6!==t.tag?((t=Xc(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function l(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=xa(e,t,n),r.return=e,r):((r=Wc(n.type,n.key,n.props,null,e.mode,r)).ref=xa(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Yc(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function d(e,t,n,r,a){return null===t||7!==t.tag?((t=Gc(n,e.mode,r,a)).return=e,t):((t=i(t,n)).return=e,t)}function p(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=Xc(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case x:return(n=Wc(t.type,t.key,t.props,null,e.mode,n)).ref=xa(e,null,t),n.return=e,n;case k:return(t=Yc(t,e.mode,n)).return=e,t}if(Sa(t)||$(t))return(t=Gc(t,e.mode,n,null)).return=e,t;ka(e,t)}return null}function f(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==i?null:c(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case x:return n.key===i?n.type===E?d(e,t,n.props.children,r,i):l(e,t,n,r):null;case k:return n.key===i?u(e,t,n,r):null}if(Sa(n)||$(n))return null!==i?null:d(e,t,n,r,null);ka(e,n)}return null}function v(e,t,n,r,i){if("string"==typeof r||"number"==typeof r)return c(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case x:return e=e.get(null===r.key?n:r.key)||null,r.type===E?d(t,e,r.props.children,i,r.key):l(t,e,r,i);case k:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if(Sa(r)||$(r))return d(t,e=e.get(n)||null,r,i,null);ka(t,r)}return null}function m(i,o,s,c){for(var l=null,u=null,d=o,m=o=0,h=null;null!==d&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var b=f(i,d,s[m],c);if(null===b){null===d&&(d=h);break}e&&d&&null===b.alternate&&t(i,d),o=a(b,o,m),null===u?l=b:u.sibling=b,u=b,d=h}if(m===s.length)return n(i,d),l;if(null===d){for(;m<s.length;m++)null!==(d=p(i,s[m],c))&&(o=a(d,o,m),null===u?l=d:u.sibling=d,u=d);return l}for(d=r(i,d);m<s.length;m++)null!==(h=v(d,i,m,s[m],c))&&(e&&null!==h.alternate&&d.delete(null===h.key?m:h.key),o=a(h,o,m),null===u?l=h:u.sibling=h,u=h);return e&&d.forEach((function(e){return t(i,e)})),l}function h(i,s,c,l){var u=$(c);if("function"!=typeof u)throw Error(o(150));if(null==(c=u.call(c)))throw Error(o(151));for(var d=u=null,m=s,h=s=0,b=null,g=c.next();null!==m&&!g.done;h++,g=c.next()){m.index>h?(b=m,m=null):b=m.sibling;var y=f(i,m,g.value,l);if(null===y){null===m&&(m=b);break}e&&m&&null===y.alternate&&t(i,m),s=a(y,s,h),null===d?u=y:d.sibling=y,d=y,m=b}if(g.done)return n(i,m),u;if(null===m){for(;!g.done;h++,g=c.next())null!==(g=p(i,g.value,l))&&(s=a(g,s,h),null===d?u=g:d.sibling=g,d=g);return u}for(m=r(i,m);!g.done;h++,g=c.next())null!==(g=v(m,i,h,g.value,l))&&(e&&null!==g.alternate&&m.delete(null===g.key?h:g.key),s=a(g,s,h),null===d?u=g:d.sibling=g,d=g);return e&&m.forEach((function(e){return t(i,e)})),u}return function(e,r,a,c){var l="object"==typeof a&&null!==a&&a.type===E&&null===a.key;l&&(a=a.props.children);var u="object"==typeof a&&null!==a;if(u)switch(a.$$typeof){case x:e:{for(u=a.key,l=r;null!==l;){if(l.key===u){if(7===l.tag){if(a.type===E){n(e,l.sibling),(r=i(l,a.props.children)).return=e,e=r;break e}}else if(l.elementType===a.type){n(e,l.sibling),(r=i(l,a.props)).ref=xa(e,l,a),r.return=e,e=r;break e}n(e,l);break}t(e,l),l=l.sibling}a.type===E?((r=Gc(a.props.children,e.mode,c,a.key)).return=e,e=r):((c=Wc(a.type,a.key,a.props,null,e.mode,c)).ref=xa(e,r,a),c.return=e,e=c)}return s(e);case k:e:{for(l=a.key;null!==r;){if(r.key===l){if(4===r.tag&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),(r=i(r,a.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Yc(a,e.mode,c)).return=e,e=r}return s(e)}if("string"==typeof a||"number"==typeof a)return a=""+a,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,a)).return=e,e=r):(n(e,r),(r=Xc(a,e.mode,c)).return=e,e=r),s(e);if(Sa(a))return m(e,r,a,c);if($(a))return h(e,r,a,c);if(u&&ka(e,a),void 0===a&&!l)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(o(152,W(e.type)||"Component"))}return n(e,r)}}var _a=Ea(!0),Ca=Ea(!1),Ta={},Ia=ci(Ta),Aa=ci(Ta),Na=ci(Ta);function Pa(e){if(e===Ta)throw Error(o(174));return e}function La(e,t){switch(ui(Na,t),ui(Aa,e),ui(Ia,Ta),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fe(null,"");break;default:t=fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}li(Ia),ui(Ia,t)}function Ra(){li(Ia),li(Aa),li(Na)}function Oa(e){Pa(Na.current);var t=Pa(Ia.current),n=fe(t,e.type);t!==n&&(ui(Aa,e),ui(Ia,n))}function Ma(e){Aa.current===e&&(li(Ia),li(Aa))}var Da=ci(0);function Fa(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ba=null,Ua=null,za=!1;function ja(e,t){var n=qc(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function $a(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Ha(e){if(za){var t=Ua;if(t){var n=t;if(!$a(e,t)){if(!(t=Wr(n.nextSibling))||!$a(e,t))return e.flags=-1025&e.flags|2,za=!1,void(Ba=e);ja(Ba,n)}Ba=e,Ua=Wr(t.firstChild)}else e.flags=-1025&e.flags|2,za=!1,Ba=e}}function qa(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Ba=e}function Va(e){if(e!==Ba)return!1;if(!za)return qa(e),za=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Hr(t,e.memoizedProps))for(t=Ua;t;)ja(e,t),t=Wr(t.nextSibling);if(qa(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Ua=Wr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Ua=null}}else Ua=Ba?Wr(e.stateNode.nextSibling):null;return!0}function Za(){Ua=Ba=null,za=!1}var Wa=[];function Ga(){for(var e=0;e<Wa.length;e++)Wa[e]._workInProgressVersionPrimary=null;Wa.length=0}var Ka=S.ReactCurrentDispatcher,Xa=S.ReactCurrentBatchConfig,Ya=0,Qa=null,Ja=null,eo=null,to=!1,no=!1;function ro(){throw Error(o(321))}function io(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lr(e[n],t[n]))return!1;return!0}function ao(e,t,n,r,i,a){if(Ya=a,Qa=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ka.current=null===e||null===e.memoizedState?Lo:Ro,e=n(r,i),no){a=0;do{if(no=!1,!(25>a))throw Error(o(301));a+=1,eo=Ja=null,t.updateQueue=null,Ka.current=Oo,e=n(r,i)}while(no)}if(Ka.current=Po,t=null!==Ja&&null!==Ja.next,Ya=0,eo=Ja=Qa=null,to=!1,t)throw Error(o(300));return e}function oo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===eo?Qa.memoizedState=eo=e:eo=eo.next=e,eo}function so(){if(null===Ja){var e=Qa.alternate;e=null!==e?e.memoizedState:null}else e=Ja.next;var t=null===eo?Qa.memoizedState:eo.next;if(null!==t)eo=t,Ja=e;else{if(null===e)throw Error(o(310));e={memoizedState:(Ja=e).memoizedState,baseState:Ja.baseState,baseQueue:Ja.baseQueue,queue:Ja.queue,next:null},null===eo?Qa.memoizedState=eo=e:eo=eo.next=e}return eo}function co(e,t){return"function"==typeof t?t(e):t}function lo(e){var t=so(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=Ja,i=r.baseQueue,a=n.pending;if(null!==a){if(null!==i){var s=i.next;i.next=a.next,a.next=s}r.baseQueue=i=a,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var c=s=a=null,l=i;do{var u=l.lane;if((Ya&u)===u)null!==c&&(c=c.next={lane:0,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),r=l.eagerReducer===e?l.eagerState:e(r,l.action);else{var d={lane:u,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};null===c?(s=c=d,a=r):c=c.next=d,Qa.lanes|=u,js|=u}l=l.next}while(null!==l&&l!==i);null===c?a=r:c.next=s,lr(r,t.memoizedState)||(Do=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function uo(e){var t=so(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(null!==i){n.pending=null;var s=i=i.next;do{a=e(a,s.action),s=s.next}while(s!==i);lr(a,t.memoizedState)||(Do=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function po(e,t,n){var r=t._getVersion;r=r(t._source);var i=t._workInProgressVersionPrimary;if(null!==i?e=i===r:(e=e.mutableReadLanes,(e=(Ya&e)===e)&&(t._workInProgressVersionPrimary=r,Wa.push(t))),e)return n(t._source);throw Wa.push(t),Error(o(350))}function fo(e,t,n,r){var i=Rs;if(null===i)throw Error(o(349));var a=t._getVersion,s=a(t._source),c=Ka.current,l=c.useState((function(){return po(i,t,n)})),u=l[1],d=l[0];l=eo;var p=e.memoizedState,f=p.refs,v=f.getSnapshot,m=p.source;p=p.subscribe;var h=Qa;return e.memoizedState={refs:f,source:t,subscribe:r},c.useEffect((function(){f.getSnapshot=n,f.setSnapshot=u;var e=a(t._source);if(!lr(s,e)){e=n(t._source),lr(d,e)||(u(e),e=fc(h),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var r=i.entanglements,o=e;0<o;){var c=31-Ht(o),l=1<<c;r[c]|=e,o&=~l}}}),[n,t,r]),c.useEffect((function(){return r(t._source,(function(){var e=f.getSnapshot,n=f.setSnapshot;try{n(e(t._source));var r=fc(h);i.mutableReadLanes|=r&i.pendingLanes}catch(a){n((function(){throw a}))}}))}),[t,r]),lr(v,n)&&lr(m,t)&&lr(p,r)||((e={pending:null,dispatch:null,lastRenderedReducer:co,lastRenderedState:d}).dispatch=u=No.bind(null,Qa,e),l.queue=e,l.baseQueue=null,d=po(i,t,n),l.memoizedState=l.baseState=d),d}function vo(e,t,n){return fo(so(),e,t,n)}function mo(e){var t=oo();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:co,lastRenderedState:e}).dispatch=No.bind(null,Qa,e),[t.memoizedState,e]}function ho(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Qa.updateQueue)?(t={lastEffect:null},Qa.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function bo(e){return e={current:e},oo().memoizedState=e}function go(){return so().memoizedState}function yo(e,t,n,r){var i=oo();Qa.flags|=e,i.memoizedState=ho(1|t,n,void 0,void 0===r?null:r)}function wo(e,t,n,r){var i=so();r=void 0===r?null:r;var a=void 0;if(null!==Ja){var o=Ja.memoizedState;if(a=o.destroy,null!==r&&io(r,o.deps))return void ho(t,n,a,r)}Qa.flags|=e,i.memoizedState=ho(1|t,n,a,r)}function So(e,t){return yo(516,4,e,t)}function xo(e,t){return wo(516,4,e,t)}function ko(e,t){return wo(4,2,e,t)}function Eo(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function _o(e,t,n){return n=null!=n?n.concat([e]):null,wo(4,2,Eo.bind(null,t,e),n)}function Co(){}function To(e,t){var n=so();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&io(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Io(e,t){var n=so();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&io(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ao(e,t){var n=Hi();Vi(98>n?98:n,(function(){e(!0)})),Vi(97<n?97:n,(function(){var n=Xa.transition;Xa.transition=1;try{e(!1),t()}finally{Xa.transition=n}}))}function No(e,t,n){var r=pc(),i=fc(e),a={lane:i,action:n,eagerReducer:null,eagerState:null,next:null},o=t.pending;if(null===o?a.next=a:(a.next=o.next,o.next=a),t.pending=a,o=e.alternate,e===Qa||null!==o&&o===Qa)no=to=!0;else{if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,c=o(s,n);if(a.eagerReducer=o,a.eagerState=c,lr(c,s))return}catch(l){}vc(e,i,r)}}var Po={readContext:aa,useCallback:ro,useContext:ro,useEffect:ro,useImperativeHandle:ro,useLayoutEffect:ro,useMemo:ro,useReducer:ro,useRef:ro,useState:ro,useDebugValue:ro,useDeferredValue:ro,useTransition:ro,useMutableSource:ro,useOpaqueIdentifier:ro,unstable_isNewReconciler:!1},Lo={readContext:aa,useCallback:function(e,t){return oo().memoizedState=[e,void 0===t?null:t],e},useContext:aa,useEffect:So,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,yo(4,2,Eo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yo(4,2,e,t)},useMemo:function(e,t){var n=oo();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=oo();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=No.bind(null,Qa,e),[r.memoizedState,e]},useRef:bo,useState:mo,useDebugValue:Co,useDeferredValue:function(e){var t=mo(e),n=t[0],r=t[1];return So((function(){var t=Xa.transition;Xa.transition=1;try{r(e)}finally{Xa.transition=t}}),[e]),n},useTransition:function(){var e=mo(!1),t=e[0];return bo(e=Ao.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=oo();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},fo(r,e,t,n)},useOpaqueIdentifier:function(){if(za){var e=!1,t=function(e){return{$$typeof:M,toString:e,valueOf:e}}((function(){throw e||(e=!0,n("r:"+(Kr++).toString(36))),Error(o(355))})),n=mo(t)[1];return 0==(2&Qa.mode)&&(Qa.flags|=516,ho(5,(function(){n("r:"+(Kr++).toString(36))}),void 0,null)),t}return mo(t="r:"+(Kr++).toString(36)),t},unstable_isNewReconciler:!1},Ro={readContext:aa,useCallback:To,useContext:aa,useEffect:xo,useImperativeHandle:_o,useLayoutEffect:ko,useMemo:Io,useReducer:lo,useRef:go,useState:function(){return lo(co)},useDebugValue:Co,useDeferredValue:function(e){var t=lo(co),n=t[0],r=t[1];return xo((function(){var t=Xa.transition;Xa.transition=1;try{r(e)}finally{Xa.transition=t}}),[e]),n},useTransition:function(){var e=lo(co)[0];return[go().current,e]},useMutableSource:vo,useOpaqueIdentifier:function(){return lo(co)[0]},unstable_isNewReconciler:!1},Oo={readContext:aa,useCallback:To,useContext:aa,useEffect:xo,useImperativeHandle:_o,useLayoutEffect:ko,useMemo:Io,useReducer:uo,useRef:go,useState:function(){return uo(co)},useDebugValue:Co,useDeferredValue:function(e){var t=uo(co),n=t[0],r=t[1];return xo((function(){var t=Xa.transition;Xa.transition=1;try{r(e)}finally{Xa.transition=t}}),[e]),n},useTransition:function(){var e=uo(co)[0];return[go().current,e]},useMutableSource:vo,useOpaqueIdentifier:function(){return uo(co)[0]},unstable_isNewReconciler:!1},Mo=S.ReactCurrentOwner,Do=!1;function Fo(e,t,n,r){t.child=null===e?Ca(t,null,n,r):_a(t,e.child,n,r)}function Bo(e,t,n,r,i){n=n.render;var a=t.ref;return ia(t,i),r=ao(e,t,n,r,a,i),null===e||Do?(t.flags|=1,Fo(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,as(e,t,i))}function Uo(e,t,n,r,i,a){if(null===e){var o=n.type;return"function"!=typeof o||Vc(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Wc(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,zo(e,t,o,r,i,a))}return o=e.child,0==(i&a)&&(i=o.memoizedProps,(n=null!==(n=n.compare)?n:dr)(i,r)&&e.ref===t.ref)?as(e,t,a):(t.flags|=1,(e=Zc(o,r)).ref=t.ref,e.return=t,t.child=e)}function zo(e,t,n,r,i,a){if(null!==e&&dr(e.memoizedProps,r)&&e.ref===t.ref){if(Do=!1,0==(a&i))return t.lanes=e.lanes,as(e,t,a);0!=(16384&e.flags)&&(Do=!0)}return Ho(e,t,n,r,a)}function jo(e,t,n){var r=t.pendingProps,i=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},xc(t,n);else{if(0==(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},xc(t,e),null;t.memoizedState={baseLanes:0},xc(t,null!==a?a.baseLanes:n)}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,xc(t,r);return Fo(e,t,i,n),t.child}function $o(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function Ho(e,t,n,r,i){var a=hi(n)?vi:pi.current;return a=mi(t,a),ia(t,i),n=ao(e,t,n,r,a,i),null===e||Do?(t.flags|=1,Fo(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,as(e,t,i))}function qo(e,t,n,r,i){if(hi(n)){var a=!0;wi(t)}else a=!1;if(ia(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),ga(t,n,r),wa(t,n,r,i),r=!0;else if(null===e){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;"object"==typeof l&&null!==l?l=aa(l):l=mi(t,l=hi(n)?vi:pi.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof o.getSnapshotBeforeUpdate;d||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s!==r||c!==l)&&ya(t,o,r,l),oa=!1;var p=t.memoizedState;o.state=p,pa(t,r,o,i),c=t.memoizedState,s!==r||p!==c||fi.current||oa?("function"==typeof u&&(ma(t,n,u,r),c=t.memoizedState),(s=oa||ba(t,n,s,r,p,c,l))?(d||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4)):("function"==typeof o.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):("function"==typeof o.componentDidMount&&(t.flags|=4),r=!1)}else{o=t.stateNode,ca(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Xi(t.type,s),o.props=l,d=t.pendingProps,p=o.context,"object"==typeof(c=n.contextType)&&null!==c?c=aa(c):c=mi(t,c=hi(n)?vi:pi.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s!==d||p!==c)&&ya(t,o,r,c),oa=!1,p=t.memoizedState,o.state=p,pa(t,r,o,i);var v=t.memoizedState;s!==d||p!==v||fi.current||oa?("function"==typeof f&&(ma(t,n,f,r),v=t.memoizedState),(l=oa||ba(t,n,l,r,p,v,c))?(u||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,v,c),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,v,c)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof o.componentDidUpdate||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=256),t.memoizedProps=r,t.memoizedState=v),o.props=r,o.state=v,o.context=c,r=l):("function"!=typeof o.componentDidUpdate||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=256),r=!1)}return Vo(e,t,n,r,a,i)}function Vo(e,t,n,r,i,a){$o(e,t);var o=0!=(64&t.flags);if(!r&&!o)return i&&Si(t,n,!1),as(e,t,a);r=t.stateNode,Mo.current=t;var s=o&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&o?(t.child=_a(t,e.child,null,a),t.child=_a(t,null,s,a)):Fo(e,t,s,a),t.memoizedState=r.state,i&&Si(t,n,!0),t.child}function Zo(e){var t=e.stateNode;t.pendingContext?gi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&gi(0,t.context,!1),La(e,t.containerInfo)}var Wo,Go,Ko,Xo,Yo={dehydrated:null,retryLane:0};function Qo(e,t,n){var r,i=t.pendingProps,a=Da.current,o=!1;return(r=0!=(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!=(2&a)),r?(o=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===i.fallback||!0===i.unstable_avoidThisFallback||(a|=1),ui(Da,1&a),null===e?(void 0!==i.fallback&&Ha(t),e=i.children,a=i.fallback,o?(e=Jo(t,e,a,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Yo,e):"number"==typeof i.unstable_expectedLoadTime?(e=Jo(t,e,a,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Yo,t.lanes=33554432,e):((n=Kc({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,o?(i=ts(e,t,i.children,i.fallback,n),o=t.child,a=e.child.memoizedState,o.memoizedState=null===a?{baseLanes:n}:{baseLanes:a.baseLanes|n},o.childLanes=e.childLanes&~n,t.memoizedState=Yo,i):(n=es(e,t,i.children,n),t.memoizedState=null,n))}function Jo(e,t,n,r){var i=e.mode,a=e.child;return t={mode:"hidden",children:t},0==(2&i)&&null!==a?(a.childLanes=0,a.pendingProps=t):a=Kc(t,i,0,null),n=Gc(n,i,r,null),a.return=e,n.return=e,a.sibling=n,e.child=a,n}function es(e,t,n,r){var i=e.child;return e=i.sibling,n=Zc(i,{mode:"visible",children:n}),0==(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}function ts(e,t,n,r,i){var a=t.mode,o=e.child;e=o.sibling;var s={mode:"hidden",children:n};return 0==(2&a)&&t.child!==o?((n=t.child).childLanes=0,n.pendingProps=s,null!==(o=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=o,o.nextEffect=null):t.firstEffect=t.lastEffect=null):n=Zc(o,s),null!==e?r=Zc(e,r):(r=Gc(r,a,i,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function ns(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),ra(e.return,t)}function rs(e,t,n,r,i,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,lastEffect:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.lastEffect=a)}function is(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Fo(e,t,r.children,n),0!=(2&(r=Da.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ns(e,n);else if(19===e.tag)ns(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ui(Da,r),0==(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Fa(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rs(t,!1,i,n,a,t.lastEffect);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Fa(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rs(t,!0,n,null,a,t.lastEffect);break;case"together":rs(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function as(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),js|=t.lanes,0!=(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=Zc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Zc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function os(e,t){if(!za)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ss(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return hi(t.type)&&bi(),null;case 3:return Ra(),li(fi),li(pi),Ga(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Va(t)?t.flags|=4:r.hydrate||(t.flags|=256)),Go(t),null;case 5:Ma(t);var a=Pa(Na.current);if(n=t.type,null!==e&&null!=t.stateNode)Ko(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(o(166));return null}if(e=Pa(Ia.current),Va(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Yr]=t,r[Qr]=s,n){case"dialog":Ar("cancel",r),Ar("close",r);break;case"iframe":case"object":case"embed":Ar("load",r);break;case"video":case"audio":for(e=0;e<_r.length;e++)Ar(_r[e],r);break;case"source":Ar("error",r);break;case"img":case"image":case"link":Ar("error",r),Ar("load",r);break;case"details":Ar("toggle",r);break;case"input":ee(r,s),Ar("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Ar("invalid",r);break;case"textarea":ce(r,s),Ar("invalid",r)}for(var l in ke(n,s),e=null,s)s.hasOwnProperty(l)&&(a=s[l],"children"===l?"string"==typeof a?r.textContent!==a&&(e=["children",a]):"number"==typeof a&&r.textContent!==""+a&&(e=["children",""+a]):c.hasOwnProperty(l)&&null!=a&&"onScroll"===l&&Ar("scroll",r));switch(n){case"input":X(r),re(r,s,!0);break;case"textarea":X(r),ue(r);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(r.onclick=Ur)}r=e,t.updateQueue=r,null!==r&&(t.flags|=4)}else{switch(l=9===a.nodeType?a:a.ownerDocument,e===de.html&&(e=pe(n)),e===de.html?"script"===n?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),"select"===n&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[Yr]=t,e[Qr]=r,Wo(e,t,!1,!1),t.stateNode=e,l=Ee(n,r),n){case"dialog":Ar("cancel",e),Ar("close",e),a=r;break;case"iframe":case"object":case"embed":Ar("load",e),a=r;break;case"video":case"audio":for(a=0;a<_r.length;a++)Ar(_r[a],e);a=r;break;case"source":Ar("error",e),a=r;break;case"img":case"image":case"link":Ar("error",e),Ar("load",e),a=r;break;case"details":Ar("toggle",e),a=r;break;case"input":ee(e,r),a=J(e,r),Ar("invalid",e);break;case"option":a=ae(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=i({},r,{value:void 0}),Ar("invalid",e);break;case"textarea":ce(e,r),a=se(e,r),Ar("invalid",e);break;default:a=r}ke(n,a);var u=a;for(s in u)if(u.hasOwnProperty(s)){var d=u[s];"style"===s?Se(e,d):"dangerouslySetInnerHTML"===s?null!=(d=d?d.__html:void 0)&&he(e,d):"children"===s?"string"==typeof d?("textarea"!==n||""!==d)&&be(e,d):"number"==typeof d&&be(e,""+d):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(c.hasOwnProperty(s)?null!=d&&"onScroll"===s&&Ar("scroll",e):null!=d&&w(e,s,d,l))}switch(n){case"input":X(e),re(e,r,!1);break;case"textarea":X(e),ue(e);break;case"option":null!=r.value&&e.setAttribute("value",""+G(r.value));break;case"select":e.multiple=!!r.multiple,null!=(s=r.value)?oe(e,!!r.multiple,s,!1):null!=r.defaultValue&&oe(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Ur)}$r(n,r)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)Xo(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(o(166));n=Pa(Na.current),Pa(Ia.current),Va(t)?(r=t.stateNode,n=t.memoizedProps,r[Yr]=t,r.nodeValue!==n&&(t.flags|=4)):((r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Yr]=t,t.stateNode=r)}return null;case 13:return li(Da),r=t.memoizedState,0!=(64&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?void 0!==t.memoizedProps.fallback&&Va(t):n=null!==e.memoizedState,r&&!n&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Da.current)?0===Bs&&(Bs=3):(0!==Bs&&3!==Bs||(Bs=4),null===Rs||0==(134217727&js)&&0==(134217727&$s)||gc(Rs,Ms))),(r||n)&&(t.flags|=4),null);case 4:return Ra(),Go(t),null===e&&Pr(t.stateNode.containerInfo),null;case 10:return na(t),null;case 19:if(li(Da),null===(r=t.memoizedState))return null;if(s=0!=(64&t.flags),null===(l=r.rendering))if(s)os(r,!1);else{if(0!==Bs||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(l=Fa(e))){for(t.flags|=64,os(r,!1),null!==(s=l.updateQueue)&&(t.updateQueue=s,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=n,n=t.child;null!==n;)e=r,(s=n).flags&=2,s.nextEffect=null,s.firstEffect=null,s.lastEffect=null,null===(l=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,e=l.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ui(Da,1&Da.current|2),t.child}e=e.sibling}null!==r.tail&&$i()>Zs&&(t.flags|=64,s=!0,os(r,!1),t.lanes=33554432)}else{if(!s)if(null!==(e=Fa(l))){if(t.flags|=64,s=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),os(r,!0),null===r.tail&&"hidden"===r.tailMode&&!l.alternate&&!za)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*$i()-r.renderingStartTime>Zs&&1073741824!==n&&(t.flags|=64,s=!0,os(r,!1),t.lanes=33554432);r.isBackwards?(l.sibling=t.child,t.child=l):(null!==(n=r.last)?n.sibling=l:t.child=l,r.last=l)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=$i(),n.sibling=null,t=Da.current,ui(Da,s?1&t|2:1&t),n):null;case 23:case 24:return kc(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(o(156,t.tag))}function cs(e){switch(e.tag){case 1:hi(e.type)&&bi();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Ra(),li(fi),li(pi),Ga(),0!=(64&(t=e.flags)))throw Error(o(285));return e.flags=-4097&t|64,e;case 5:return Ma(e),null;case 13:return li(Da),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return li(Da),null;case 4:return Ra(),null;case 10:return na(e),null;case 23:case 24:return kc(),null;default:return null}}function ls(e,t){try{var n="",r=t;do{n+=Z(r),r=r.return}while(r);var i=n}catch(a){i="\nError generating stack: "+a.message+"\n"+a.stack}return{value:e,source:t,stack:i}}function us(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}Wo=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Go=function(){},Ko=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Pa(Ia.current);var o,s=null;switch(n){case"input":a=J(e,a),r=J(e,r),s=[];break;case"option":a=ae(e,a),r=ae(e,r),s=[];break;case"select":a=i({},a,{value:void 0}),r=i({},r,{value:void 0}),s=[];break;case"textarea":a=se(e,a),r=se(e,r),s=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=Ur)}for(d in ke(n,r),n=null,a)if(!r.hasOwnProperty(d)&&a.hasOwnProperty(d)&&null!=a[d])if("style"===d){var l=a[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==d&&"children"!==d&&"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&"autoFocus"!==d&&(c.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in r){var u=r[d];if(l=null!=a?a[d]:void 0,r.hasOwnProperty(d)&&u!==l&&(null!=u||null!=l))if("style"===d)if(l){for(o in l)!l.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in u)u.hasOwnProperty(o)&&l[o]!==u[o]&&(n||(n={}),n[o]=u[o])}else n||(s||(s=[]),s.push(d,n)),n=u;else"dangerouslySetInnerHTML"===d?(u=u?u.__html:void 0,l=l?l.__html:void 0,null!=u&&l!==u&&(s=s||[]).push(d,u)):"children"===d?"string"!=typeof u&&"number"!=typeof u||(s=s||[]).push(d,""+u):"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&(c.hasOwnProperty(d)?(null!=u&&"onScroll"===d&&Ar("scroll",e),s||l===u||(s=[])):"object"==typeof u&&null!==u&&u.$$typeof===M?u.toString():(s=s||[]).push(d,u))}n&&(s=s||[]).push("style",n);var d=s;(t.updateQueue=d)&&(t.flags|=4)}},Xo=function(e,t,n,r){n!==r&&(t.flags|=4)};var ds="function"==typeof WeakMap?WeakMap:Map;function ps(e,t,n){(n=la(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Xs||(Xs=!0,Ys=r),us(0,t)},n}function fs(e,t,n){(n=la(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return us(0,t),r(i)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===Qs?Qs=new Set([this]):Qs.add(this),us(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var vs="function"==typeof WeakSet?WeakSet:Set;function ms(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(n){zc(e,n)}else t.current=null}function hs(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Xi(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Zr(t.stateNode.containerInfo))}throw Error(o(163))}function bs(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;r=i.next,0!=(4&(i=i.tag))&&0!=(1&i)&&(Fc(n,e),Dc(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Xi(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&fa(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}fa(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&$r(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&St(n)))))}throw Error(o(163))}function gs(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"==typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var i=n.memoizedProps.style;i=null!=i&&i.hasOwnProperty("display")?i.display:null,r.style.display=we("display",i)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function ys(e,t){if(ki&&"function"==typeof ki.onCommitFiberUnmount)try{ki.onCommitFiberUnmount(xi,t)}catch(a){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,i=r.destroy;if(r=r.tag,void 0!==i)if(0!=(4&r))Fc(t,n);else{r=t;try{i()}catch(a){zc(r,a)}}n=n.next}while(n!==e)}break;case 1:if(ms(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(a){zc(t,a)}break;case 5:ms(t);break;case 4:_s(e,t)}}function ws(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Ss(e){return 5===e.tag||3===e.tag||4===e.tag}function xs(e){e:{for(var t=e.return;null!==t;){if(Ss(t))break e;t=t.return}throw Error(o(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(o(161))}16&n.flags&&(be(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Ss(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?ks(e,n,t):Es(e,n,t)}function ks(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Ur));else if(4!==r&&null!==(e=e.child))for(ks(e,t,n),e=e.sibling;null!==e;)ks(e,t,n),e=e.sibling}function Es(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(Es(e,t,n),e=e.sibling;null!==e;)Es(e,t,n),e=e.sibling}function _s(e,t){for(var n,r,i=t,a=!1;;){if(!a){a=i.return;e:for(;;){if(null===a)throw Error(o(160));switch(n=a.stateNode,a.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}a=a.return}a=!0}if(5===i.tag||6===i.tag){e:for(var s=e,c=i,l=c;;)if(ys(s,l),null!==l.child&&4!==l.tag)l.child.return=l,l=l.child;else{if(l===c)break e;for(;null===l.sibling;){if(null===l.return||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}r?(s=n,c=i.stateNode,8===s.nodeType?s.parentNode.removeChild(c):s.removeChild(c)):n.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){n=i.stateNode.containerInfo,r=!0,i.child.return=i,i=i.child;continue}}else if(ys(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(a=!1)}i.sibling.return=i.return,i=i.sibling}}function Cs(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3==(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var i=null!==e?e.memoizedProps:r;e=t.type;var a=t.updateQueue;if(t.updateQueue=null,null!==a){for(n[Qr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),Ee(e,i),t=Ee(e,r),i=0;i<a.length;i+=2){var s=a[i],c=a[i+1];"style"===s?Se(n,c):"dangerouslySetInnerHTML"===s?he(n,c):"children"===s?be(n,c):w(n,s,c,t)}switch(e){case"input":ne(n,r);break;case"textarea":le(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(a=r.value)?oe(n,!!r.multiple,a,!1):e!==!!r.multiple&&(null!=r.defaultValue?oe(n,!!r.multiple,r.defaultValue,!0):oe(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(o(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((n=t.stateNode).hydrate&&(n.hydrate=!1,St(n.containerInfo)));case 13:return null!==t.memoizedState&&(Vs=$i(),gs(t.child,!0)),void Ts(t);case 19:return void Ts(t);case 23:case 24:return void gs(t,null!==t.memoizedState)}throw Error(o(163))}function Ts(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new vs),t.forEach((function(t){var r=$c.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Is(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var As=Math.ceil,Ns=S.ReactCurrentDispatcher,Ps=S.ReactCurrentOwner,Ls=0,Rs=null,Os=null,Ms=0,Ds=0,Fs=ci(0),Bs=0,Us=null,zs=0,js=0,$s=0,Hs=0,qs=null,Vs=0,Zs=1/0;function Ws(){Zs=$i()+500}var Gs,Ks=null,Xs=!1,Ys=null,Qs=null,Js=!1,ec=null,tc=90,nc=[],rc=[],ic=null,ac=0,oc=null,sc=-1,cc=0,lc=0,uc=null,dc=!1;function pc(){return 0!=(48&Ls)?$i():-1!==sc?sc:sc=$i()}function fc(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Hi()?1:2;if(0===cc&&(cc=zs),0!==Ki.transition){0!==lc&&(lc=null!==qs?qs.pendingLanes:0),e=cc;var t=4186112&~lc;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Hi(),0!=(4&Ls)&&98===e?e=Ut(12,cc):e=Ut(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),cc),e}function vc(e,t,n){if(50<ac)throw ac=0,oc=null,Error(o(185));if(null===(e=mc(e,t)))return null;$t(e,t,n),e===Rs&&($s|=t,4===Bs&&gc(e,Ms));var r=Hi();1===t?0!=(8&Ls)&&0==(48&Ls)?yc(e):(hc(e,n),0===Ls&&(Ws(),Wi())):(0==(4&Ls)||98!==r&&99!==r||(null===ic?ic=new Set([e]):ic.add(e)),hc(e,n)),qs=e}function mc(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function hc(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,i=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes;0<s;){var c=31-Ht(s),l=1<<c,u=a[c];if(-1===u){if(0==(l&r)||0!=(l&i)){u=t,Dt(l);var d=Mt;a[c]=10<=d?u+250:6<=d?u+5e3:-1}}else u<=t&&(e.expiredLanes|=l);s&=~l}if(r=Ft(e,e===Rs?Ms:0),t=Mt,0===r)null!==n&&(n!==Di&&Ci(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Di&&Ci(n)}15===t?(n=yc.bind(null,e),null===Bi?(Bi=[n],Ui=_i(Pi,Gi)):Bi.push(n),n=Di):14===t?n=Zi(99,yc.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(o(358,e))}}(t),n=Zi(n,bc.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function bc(e){if(sc=-1,lc=cc=0,0!=(48&Ls))throw Error(o(327));var t=e.callbackNode;if(Mc()&&e.callbackNode!==t)return null;var n=Ft(e,e===Rs?Ms:0);if(0===n)return null;var r=n,i=Ls;Ls|=16;var a=Cc();for(Rs===e&&Ms===r||(Ws(),Ec(e,r));;)try{Ac();break}catch(c){_c(e,c)}if(ta(),Ns.current=a,Ls=i,null!==Os?r=0:(Rs=null,Ms=0,r=Bs),0!=(zs&$s))Ec(e,0);else if(0!==r){if(2===r&&(Ls|=64,e.hydrate&&(e.hydrate=!1,Zr(e.containerInfo)),0!==(n=Bt(e))&&(r=Tc(e,n))),1===r)throw t=Us,Ec(e,0),gc(e,n),hc(e,$i()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(o(345));case 2:case 5:Lc(e);break;case 3:if(gc(e,n),(62914560&n)===n&&10<(r=Vs+500-$i())){if(0!==Ft(e,0))break;if(((i=e.suspendedLanes)&n)!==n){pc(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=qr(Lc.bind(null,e),r);break}Lc(e);break;case 4:if(gc(e,n),(4186112&n)===n)break;for(r=e.eventTimes,i=-1;0<n;){var s=31-Ht(n);a=1<<s,(s=r[s])>i&&(i=s),n&=~a}if(n=i,10<(n=(120>(n=$i()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*As(n/1960))-n)){e.timeoutHandle=qr(Lc.bind(null,e),n);break}Lc(e);break;default:throw Error(o(329))}}return hc(e,$i()),e.callbackNode===t?bc.bind(null,e):null}function gc(e,t){for(t&=~Hs,t&=~$s,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ht(t),r=1<<n;e[n]=-1,t&=~r}}function yc(e){if(0!=(48&Ls))throw Error(o(327));if(Mc(),e===Rs&&0!=(e.expiredLanes&Ms)){var t=Ms,n=Tc(e,t);0!=(zs&$s)&&(n=Tc(e,t=Ft(e,t)))}else n=Tc(e,t=Ft(e,0));if(0!==e.tag&&2===n&&(Ls|=64,e.hydrate&&(e.hydrate=!1,Zr(e.containerInfo)),0!==(t=Bt(e))&&(n=Tc(e,t))),1===n)throw n=Us,Ec(e,0),gc(e,t),hc(e,$i()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Lc(e),hc(e,$i()),null}function wc(e,t){var n=Ls;Ls|=1;try{return e(t)}finally{0===(Ls=n)&&(Ws(),Wi())}}function Sc(e,t){var n=Ls;Ls&=-2,Ls|=8;try{return e(t)}finally{0===(Ls=n)&&(Ws(),Wi())}}function xc(e,t){ui(Fs,Ds),Ds|=t,zs|=t}function kc(){Ds=Fs.current,li(Fs)}function Ec(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Vr(n)),null!==Os)for(n=Os.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&bi();break;case 3:Ra(),li(fi),li(pi),Ga();break;case 5:Ma(r);break;case 4:Ra();break;case 13:case 19:li(Da);break;case 10:na(r);break;case 23:case 24:kc()}n=n.return}Rs=e,Os=Zc(e.current,null),Ms=Ds=zs=t,Bs=0,Us=null,Hs=$s=js=0}function _c(e,t){for(;;){var n=Os;try{if(ta(),Ka.current=Po,to){for(var r=Qa.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}to=!1}if(Ya=0,eo=Ja=Qa=null,no=!1,Ps.current=null,null===n||null===n.return){Bs=1,Us=t,Os=null;break}e:{var a=e,o=n.return,s=n,c=t;if(t=Ms,s.flags|=2048,s.firstEffect=s.lastEffect=null,null!==c&&"object"==typeof c&&"function"==typeof c.then){var l=c;if(0==(2&s.mode)){var u=s.alternate;u?(s.updateQueue=u.updateQueue,s.memoizedState=u.memoizedState,s.lanes=u.lanes):(s.updateQueue=null,s.memoizedState=null)}var d=0!=(1&Da.current),p=o;do{var f;if(f=13===p.tag){var v=p.memoizedState;if(null!==v)f=null!==v.dehydrated;else{var m=p.memoizedProps;f=void 0!==m.fallback&&(!0!==m.unstable_avoidThisFallback||!d)}}if(f){var h=p.updateQueue;if(null===h){var b=new Set;b.add(l),p.updateQueue=b}else h.add(l);if(0==(2&p.mode)){if(p.flags|=64,s.flags|=16384,s.flags&=-2981,1===s.tag)if(null===s.alternate)s.tag=17;else{var g=la(-1,1);g.tag=2,ua(s,g)}s.lanes|=1;break e}c=void 0,s=t;var y=a.pingCache;if(null===y?(y=a.pingCache=new ds,c=new Set,y.set(l,c)):void 0===(c=y.get(l))&&(c=new Set,y.set(l,c)),!c.has(s)){c.add(s);var w=jc.bind(null,a,l,s);l.then(w,w)}p.flags|=4096,p.lanes=t;break e}p=p.return}while(null!==p);c=Error((W(s.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Bs&&(Bs=2),c=ls(c,s),p=o;do{switch(p.tag){case 3:a=c,p.flags|=4096,t&=-t,p.lanes|=t,da(p,ps(0,a,t));break e;case 1:a=c;var S=p.type,x=p.stateNode;if(0==(64&p.flags)&&("function"==typeof S.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===Qs||!Qs.has(x)))){p.flags|=4096,t&=-t,p.lanes|=t,da(p,fs(p,a,t));break e}}p=p.return}while(null!==p)}Pc(n)}catch(k){t=k,Os===n&&null!==n&&(Os=n=n.return);continue}break}}function Cc(){var e=Ns.current;return Ns.current=Po,null===e?Po:e}function Tc(e,t){var n=Ls;Ls|=16;var r=Cc();for(Rs===e&&Ms===t||Ec(e,t);;)try{Ic();break}catch(i){_c(e,i)}if(ta(),Ls=n,Ns.current=r,null!==Os)throw Error(o(261));return Rs=null,Ms=0,Bs}function Ic(){for(;null!==Os;)Nc(Os)}function Ac(){for(;null!==Os&&!Ti();)Nc(Os)}function Nc(e){var t=Gs(e.alternate,e,Ds);e.memoizedProps=e.pendingProps,null===t?Pc(e):Os=t,Ps.current=null}function Pc(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(n=ss(n,t,Ds)))return void(Os=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!=(1073741824&Ds)||0==(4&n.mode)){for(var r=0,i=n.child;null!==i;)r|=i.lanes|i.childLanes,i=i.sibling;n.childLanes=r}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=cs(t)))return n.flags&=2047,void(Os=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Os=t);Os=t=e}while(null!==t);0===Bs&&(Bs=5)}function Lc(e){var t=Hi();return Vi(99,Rc.bind(null,e,t)),null}function Rc(e,t){do{Mc()}while(null!==ec);if(0!=(48&Ls))throw Error(o(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(o(177));e.callbackNode=null;var r=n.lanes|n.childLanes,i=r,a=e.pendingLanes&~i;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=i,e.mutableReadLanes&=i,e.entangledLanes&=i,i=e.entanglements;for(var s=e.eventTimes,c=e.expirationTimes;0<a;){var l=31-Ht(a),u=1<<l;i[l]=0,s[l]=-1,c[l]=-1,a&=~u}if(null!==ic&&0==(24&r)&&ic.has(e)&&ic.delete(e),e===Rs&&(Os=Rs=null,Ms=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){if(i=Ls,Ls|=32,Ps.current=null,zr=Gt,hr(s=mr())){if("selectionStart"in s)c={start:s.selectionStart,end:s.selectionEnd};else e:if(c=(c=s.ownerDocument)&&c.defaultView||window,(u=c.getSelection&&c.getSelection())&&0!==u.rangeCount){c=u.anchorNode,a=u.anchorOffset,l=u.focusNode,u=u.focusOffset;try{c.nodeType,l.nodeType}catch(C){c=null;break e}var d=0,p=-1,f=-1,v=0,m=0,h=s,b=null;t:for(;;){for(var g;h!==c||0!==a&&3!==h.nodeType||(p=d+a),h!==l||0!==u&&3!==h.nodeType||(f=d+u),3===h.nodeType&&(d+=h.nodeValue.length),null!==(g=h.firstChild);)b=h,h=g;for(;;){if(h===s)break t;if(b===c&&++v===a&&(p=d),b===l&&++m===u&&(f=d),null!==(g=h.nextSibling))break;b=(h=b).parentNode}h=g}c=-1===p||-1===f?null:{start:p,end:f}}else c=null;c=c||{start:0,end:0}}else c=null;jr={focusedElem:s,selectionRange:c},Gt=!1,uc=null,dc=!1,Ks=r;do{try{Oc()}catch(C){if(null===Ks)throw Error(o(330));zc(Ks,C),Ks=Ks.nextEffect}}while(null!==Ks);uc=null,Ks=r;do{try{for(s=e;null!==Ks;){var y=Ks.flags;if(16&y&&be(Ks.stateNode,""),128&y){var w=Ks.alternate;if(null!==w){var S=w.ref;null!==S&&("function"==typeof S?S(null):S.current=null)}}switch(1038&y){case 2:xs(Ks),Ks.flags&=-3;break;case 6:xs(Ks),Ks.flags&=-3,Cs(Ks.alternate,Ks);break;case 1024:Ks.flags&=-1025;break;case 1028:Ks.flags&=-1025,Cs(Ks.alternate,Ks);break;case 4:Cs(Ks.alternate,Ks);break;case 8:_s(s,c=Ks);var x=c.alternate;ws(c),null!==x&&ws(x)}Ks=Ks.nextEffect}}catch(C){if(null===Ks)throw Error(o(330));zc(Ks,C),Ks=Ks.nextEffect}}while(null!==Ks);if(S=jr,w=mr(),y=S.focusedElem,s=S.selectionRange,w!==y&&y&&y.ownerDocument&&vr(y.ownerDocument.documentElement,y)){null!==s&&hr(y)&&(w=s.start,void 0===(S=s.end)&&(S=w),"selectionStart"in y?(y.selectionStart=w,y.selectionEnd=Math.min(S,y.value.length)):(S=(w=y.ownerDocument||document)&&w.defaultView||window).getSelection&&(S=S.getSelection(),c=y.textContent.length,x=Math.min(s.start,c),s=void 0===s.end?x:Math.min(s.end,c),!S.extend&&x>s&&(c=s,s=x,x=c),c=fr(y,x),a=fr(y,s),c&&a&&(1!==S.rangeCount||S.anchorNode!==c.node||S.anchorOffset!==c.offset||S.focusNode!==a.node||S.focusOffset!==a.offset)&&((w=w.createRange()).setStart(c.node,c.offset),S.removeAllRanges(),x>s?(S.addRange(w),S.extend(a.node,a.offset)):(w.setEnd(a.node,a.offset),S.addRange(w))))),w=[];for(S=y;S=S.parentNode;)1===S.nodeType&&w.push({element:S,left:S.scrollLeft,top:S.scrollTop});for("function"==typeof y.focus&&y.focus(),y=0;y<w.length;y++)(S=w[y]).element.scrollLeft=S.left,S.element.scrollTop=S.top}Gt=!!zr,jr=zr=null,e.current=n,Ks=r;do{try{for(y=e;null!==Ks;){var k=Ks.flags;if(36&k&&bs(y,Ks.alternate,Ks),128&k){w=void 0;var E=Ks.ref;if(null!==E){var _=Ks.stateNode;Ks.tag,w=_,"function"==typeof E?E(w):E.current=w}}Ks=Ks.nextEffect}}catch(C){if(null===Ks)throw Error(o(330));zc(Ks,C),Ks=Ks.nextEffect}}while(null!==Ks);Ks=null,Fi(),Ls=i}else e.current=n;if(Js)Js=!1,ec=e,tc=t;else for(Ks=r;null!==Ks;)t=Ks.nextEffect,Ks.nextEffect=null,8&Ks.flags&&((k=Ks).sibling=null,k.stateNode=null),Ks=t;if(0===(r=e.pendingLanes)&&(Qs=null),1===r?e===oc?ac++:(ac=0,oc=e):ac=0,n=n.stateNode,ki&&"function"==typeof ki.onCommitFiberRoot)try{ki.onCommitFiberRoot(xi,n,void 0,64==(64&n.current.flags))}catch(C){}if(hc(e,$i()),Xs)throw Xs=!1,e=Ys,Ys=null,e;return 0!=(8&Ls)||Wi(),null}function Oc(){for(;null!==Ks;){var e=Ks.alternate;dc||null===uc||(0!=(8&Ks.flags)?Je(Ks,uc)&&(dc=!0):13===Ks.tag&&Is(e,Ks)&&Je(Ks,uc)&&(dc=!0));var t=Ks.flags;0!=(256&t)&&hs(e,Ks),0==(512&t)||Js||(Js=!0,Zi(97,(function(){return Mc(),null}))),Ks=Ks.nextEffect}}function Mc(){if(90!==tc){var e=97<tc?97:tc;return tc=90,Vi(e,Bc)}return!1}function Dc(e,t){nc.push(t,e),Js||(Js=!0,Zi(97,(function(){return Mc(),null})))}function Fc(e,t){rc.push(t,e),Js||(Js=!0,Zi(97,(function(){return Mc(),null})))}function Bc(){if(null===ec)return!1;var e=ec;if(ec=null,0!=(48&Ls))throw Error(o(331));var t=Ls;Ls|=32;var n=rc;rc=[];for(var r=0;r<n.length;r+=2){var i=n[r],a=n[r+1],s=i.destroy;if(i.destroy=void 0,"function"==typeof s)try{s()}catch(l){if(null===a)throw Error(o(330));zc(a,l)}}for(n=nc,nc=[],r=0;r<n.length;r+=2){i=n[r],a=n[r+1];try{var c=i.create;i.destroy=c()}catch(l){if(null===a)throw Error(o(330));zc(a,l)}}for(c=e.current.firstEffect;null!==c;)e=c.nextEffect,c.nextEffect=null,8&c.flags&&(c.sibling=null,c.stateNode=null),c=e;return Ls=t,Wi(),!0}function Uc(e,t,n){ua(e,t=ps(0,t=ls(n,t),1)),t=pc(),null!==(e=mc(e,1))&&($t(e,1,t),hc(e,t))}function zc(e,t){if(3===e.tag)Uc(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){Uc(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Qs||!Qs.has(r))){var i=fs(n,e=ls(t,e),1);if(ua(n,i),i=pc(),null!==(n=mc(n,1)))$t(n,1,i),hc(n,i);else if("function"==typeof r.componentDidCatch&&(null===Qs||!Qs.has(r)))try{r.componentDidCatch(t,e)}catch(a){}break}}n=n.return}}function jc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=pc(),e.pingedLanes|=e.suspendedLanes&n,Rs===e&&(Ms&n)===n&&(4===Bs||3===Bs&&(62914560&Ms)===Ms&&500>$i()-Vs?Ec(e,0):Hs|=n),hc(e,t)}function $c(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Hi()?1:2:(0===cc&&(cc=zs),0===(t=zt(62914560&~cc))&&(t=4194304))),n=pc(),null!==(e=mc(e,t))&&($t(e,t,n),hc(e,n))}function Hc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function qc(e,t,n,r){return new Hc(e,t,n,r)}function Vc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Zc(e,t){var n=e.alternate;return null===n?((n=qc(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Wc(e,t,n,r,i,a){var s=2;if(r=e,"function"==typeof e)Vc(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case E:return Gc(n.children,i,a,t);case D:s=8,i|=16;break;case _:s=8,i|=1;break;case C:return(e=qc(12,n,t,8|i)).elementType=C,e.type=C,e.lanes=a,e;case N:return(e=qc(13,n,t,i)).type=N,e.elementType=N,e.lanes=a,e;case P:return(e=qc(19,n,t,i)).elementType=P,e.lanes=a,e;case F:return Kc(n,i,a,t);case B:return(e=qc(24,n,t,i)).elementType=B,e.lanes=a,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case T:s=10;break e;case I:s=9;break e;case A:s=11;break e;case L:s=14;break e;case R:s=16,r=null;break e;case O:s=22;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=qc(s,n,t,i)).elementType=e,t.type=r,t.lanes=a,t}function Gc(e,t,n,r){return(e=qc(7,e,r,t)).lanes=n,e}function Kc(e,t,n,r){return(e=qc(23,e,r,t)).elementType=F,e.lanes=n,e}function Xc(e,t,n){return(e=qc(6,e,null,t)).lanes=n,e}function Yc(e,t,n){return(t=qc(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qc(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=jt(0),this.expirationTimes=jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jt(0),this.mutableSourceEagerHydrationData=null}function Jc(e,t,n,r){var i=t.current,a=pc(),s=fc(i);e:if(n){t:{if(Ke(n=n._reactInternals)!==n||1!==n.tag)throw Error(o(170));var c=n;do{switch(c.tag){case 3:c=c.stateNode.context;break t;case 1:if(hi(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break t}}c=c.return}while(null!==c);throw Error(o(171))}if(1===n.tag){var l=n.type;if(hi(l)){n=yi(n,l,c);break e}}n=c}else n=di;return null===t.context?t.context=n:t.pendingContext=n,(t=la(a,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),ua(i,t),vc(i,s,a),s}function el(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function tl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function nl(e,t){tl(e,t),(e=e.alternate)&&tl(e,t)}function rl(e,t,n){var r=null!=n&&null!=n.hydrationOptions&&n.hydrationOptions.mutableSources||null;if(n=new Qc(e,t,null!=n&&!0===n.hydrate),t=qc(3,null,null,2===t?7:1===t?3:0),n.current=t,t.stateNode=n,sa(t),e[Jr]=n.current,Pr(8===e.nodeType?e.parentNode:e),r)for(e=0;e<r.length;e++){var i=(t=r[e])._getVersion;i=i(t._source),null==n.mutableSourceEagerHydrationData?n.mutableSourceEagerHydrationData=[t,i]:n.mutableSourceEagerHydrationData.push(t,i)}this._internalRoot=n}function il(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function al(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a._internalRoot;if("function"==typeof i){var s=i;i=function(){var e=el(o);s.call(e)}}Jc(t,o,e,i)}else{if(a=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new rl(e,0,t?{hydrate:!0}:void 0)}(n,r),o=a._internalRoot,"function"==typeof i){var c=i;i=function(){var e=el(o);c.call(e)}}Sc((function(){Jc(t,o,e,i)}))}return el(o)}function ol(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!il(t))throw Error(o(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:k,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}Gs=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||fi.current)Do=!0;else{if(0==(n&r)){switch(Do=!1,t.tag){case 3:Zo(t),Za();break;case 5:Oa(t);break;case 1:hi(t.type)&&wi(t);break;case 4:La(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value;var i=t.type._context;ui(Yi,i._currentValue),i._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!=(n&t.child.childLanes)?Qo(e,t,n):(ui(Da,1&Da.current),null!==(t=as(e,t,n))?t.sibling:null);ui(Da,1&Da.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(64&e.flags)){if(r)return is(e,t,n);t.flags|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),ui(Da,Da.current),r)break;return null;case 23:case 24:return t.lanes=0,jo(e,t,n)}return as(e,t,n)}Do=0!=(16384&e.flags)}else Do=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=mi(t,pi.current),ia(t,n),i=ao(null,t,r,e,i,n),t.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,hi(r)){var a=!0;wi(t)}else a=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,sa(t);var s=r.getDerivedStateFromProps;"function"==typeof s&&ma(t,r,s,e),i.updater=ha,t.stateNode=i,i._reactInternals=t,wa(t,r,e,n),t=Vo(null,t,r,!0,a,n)}else t.tag=0,Fo(null,t,i,n),t=t.child;return t;case 16:i=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=(a=i._init)(i._payload),t.type=i,a=t.tag=function(e){if("function"==typeof e)return Vc(e)?1:0;if(null!=e){if((e=e.$$typeof)===A)return 11;if(e===L)return 14}return 2}(i),e=Xi(i,e),a){case 0:t=Ho(null,t,i,e,n);break e;case 1:t=qo(null,t,i,e,n);break e;case 11:t=Bo(null,t,i,e,n);break e;case 14:t=Uo(null,t,i,Xi(i.type,e),r,n);break e}throw Error(o(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,Ho(e,t,r,i=t.elementType===r?i:Xi(r,i),n);case 1:return r=t.type,i=t.pendingProps,qo(e,t,r,i=t.elementType===r?i:Xi(r,i),n);case 3:if(Zo(t),r=t.updateQueue,null===e||null===r)throw Error(o(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,ca(e,t),pa(t,r,null,n),(r=t.memoizedState.element)===i)Za(),t=as(e,t,n);else{if((a=(i=t.stateNode).hydrate)&&(Ua=Wr(t.stateNode.containerInfo.firstChild),Ba=t,a=za=!0),a){if(null!=(e=i.mutableSourceEagerHydrationData))for(i=0;i<e.length;i+=2)(a=e[i])._workInProgressVersionPrimary=e[i+1],Wa.push(a);for(n=Ca(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Fo(e,t,r,n),Za();t=t.child}return t;case 5:return Oa(t),null===e&&Ha(t),r=t.type,i=t.pendingProps,a=null!==e?e.memoizedProps:null,s=i.children,Hr(r,i)?s=null:null!==a&&Hr(r,a)&&(t.flags|=16),$o(e,t),Fo(e,t,s,n),t.child;case 6:return null===e&&Ha(t),null;case 13:return Qo(e,t,n);case 4:return La(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=_a(t,null,r,n):Fo(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Bo(e,t,r,i=t.elementType===r?i:Xi(r,i),n);case 7:return Fo(e,t,t.pendingProps,n),t.child;case 8:case 12:return Fo(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value;var c=t.type._context;if(ui(Yi,c._currentValue),c._currentValue=a,null!==s)if(c=s.value,0===(a=lr(c,a)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(c,a):1073741823))){if(s.children===i.children&&!fi.current){t=as(e,t,n);break e}}else for(null!==(c=t.child)&&(c.return=t);null!==c;){var l=c.dependencies;if(null!==l){s=c.child;for(var u=l.firstContext;null!==u;){if(u.context===r&&0!=(u.observedBits&a)){1===c.tag&&((u=la(-1,n&-n)).tag=2,ua(c,u)),c.lanes|=n,null!==(u=c.alternate)&&(u.lanes|=n),ra(c.return,n),l.lanes|=n;break}u=u.next}}else s=10===c.tag&&c.type===t.type?null:c.child;if(null!==s)s.return=c;else for(s=c;null!==s;){if(s===t){s=null;break}if(null!==(c=s.sibling)){c.return=s.return,s=c;break}s=s.return}c=s}Fo(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(a=t.pendingProps).children,ia(t,n),r=r(i=aa(i,a.unstable_observedBits)),t.flags|=1,Fo(e,t,r,n),t.child;case 14:return a=Xi(i=t.type,t.pendingProps),Uo(e,t,i,a=Xi(i.type,a),r,n);case 15:return zo(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Xi(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,hi(r)?(e=!0,wi(t)):e=!1,ia(t,n),ga(t,r,i),wa(t,r,i,n),Vo(null,t,r,!0,e,n);case 19:return is(e,t,n);case 23:case 24:return jo(e,t,n)}throw Error(o(156,t.tag))},rl.prototype.render=function(e){Jc(e,this._internalRoot,null,null)},rl.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Jc(null,e,null,(function(){t[Jr]=null}))},et=function(e){13===e.tag&&(vc(e,4,pc()),nl(e,4))},tt=function(e){13===e.tag&&(vc(e,67108864,pc()),nl(e,67108864))},nt=function(e){if(13===e.tag){var t=pc(),n=fc(e);vc(e,n,t),nl(e,n)}},rt=function(e,t){return t()},Ce=function(e,t,n){switch(t){case"input":if(ne(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=ii(r);if(!i)throw Error(o(90));Y(r),ne(r,i)}}}break;case"textarea":le(e,n);break;case"select":null!=(t=n.value)&&oe(e,!!n.multiple,t,!1)}},Le=wc,Re=function(e,t,n,r,i){var a=Ls;Ls|=4;try{return Vi(98,e.bind(null,t,n,r,i))}finally{0===(Ls=a)&&(Ws(),Wi())}},Oe=function(){0==(49&Ls)&&(function(){if(null!==ic){var e=ic;ic=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,hc(e,$i())}))}Wi()}(),Mc())},Me=function(e,t){var n=Ls;Ls|=2;try{return e(t)}finally{0===(Ls=n)&&(Ws(),Wi())}};var sl={Events:[ni,ri,ii,Ne,Pe,Mc,{current:!1}]},cl={findFiberByHostInstance:ti,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},ll={bundleType:cl.bundleType,version:cl.version,rendererPackageName:cl.rendererPackageName,rendererConfig:cl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Qe(e))?null:e.stateNode},findFiberByHostInstance:cl.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ul.isDisabled&&ul.supportsFiber)try{xi=ul.inject(ll),ki=ul}catch(me){}}t.createPortal=ol,t.hydrate=function(e,t,n){if(!il(t))throw Error(o(200));return al(null,e,t,!0,n)}},31542:(e,t,n)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(43577)},54335:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(e,o){if(e===o)return!0;if(e&&o&&"object"==typeof e&&"object"==typeof o){if(e.constructor!==o.constructor)return!1;var s,c,l,u;if(Array.isArray(e)){if((s=e.length)!=o.length)return!1;for(c=s;0!=c--;)if(!a(e[c],o[c]))return!1;return!0}if(n&&e instanceof Map&&o instanceof Map){if(e.size!==o.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!o.has(c.value[0]))return!1;for(u=e.entries();!(c=u.next()).done;)if(!a(c.value[1],o.get(c.value[0])))return!1;return!0}if(r&&e instanceof Set&&o instanceof Set){if(e.size!==o.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!o.has(c.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(o)){if((s=e.length)!=o.length)return!1;for(c=s;0!=c--;)if(e[c]!==o[c])return!1;return!0}if(e.constructor===RegExp)return e.source===o.source&&e.flags===o.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof o.valueOf)return e.valueOf()===o.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof o.toString)return e.toString()===o.toString();if((s=(l=Object.keys(e)).length)!==Object.keys(o).length)return!1;for(c=s;0!=c--;)if(!Object.prototype.hasOwnProperty.call(o,l[c]))return!1;if(t&&e instanceof Element)return!1;for(c=s;0!=c--;)if(("_owner"!==l[c]&&"__v"!==l[c]&&"__o"!==l[c]||!e.$$typeof)&&!a(e[l[c]],o[l[c]]))return!1;return!0}return e!=e&&o!=o}e.exports=function(e,t){try{return a(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},92883:(e,t,n)=>{"use strict";n.d(t,{B6:()=>V,ql:()=>J});var r=n(27378),i=n(23615),a=n.n(i),o=n(54335),s=n.n(o),c=n(3996),l=n.n(c),u=n(74445),d=n.n(u);function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t)}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function m(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var h={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},b={rel:["amphtml","canonical","alternate"]},g={type:["application/ld+json"]},y={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},w=Object.keys(h).map((function(e){return h[e]})),S={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},x=Object.keys(S).reduce((function(e,t){return e[S[t]]=t,e}),{}),k=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},E=function(e){var t=k(e,h.TITLE),n=k(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,(function(){return t}));var r=k(e,"defaultTitle");return t||r||void 0},_=function(e){return k(e,"onChangeClientState")||function(){}},C=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return p({},e,t)}),{})},T=function(e,t){return t.filter((function(e){return void 0!==e[h.BASE]})).map((function(e){return e[h.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),i=0;i<r.length;i+=1){var a=r[i].toLowerCase();if(-1!==e.indexOf(a)&&n[a])return t.concat(n)}return t}),[])},I=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var i={};n.filter((function(e){for(var n,a=Object.keys(e),o=0;o<a.length;o+=1){var s=a[o],c=s.toLowerCase();-1===t.indexOf(c)||"rel"===n&&"canonical"===e[n].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(n=c),-1===t.indexOf(s)||"innerHTML"!==s&&"cssText"!==s&&"itemprop"!==s||(n=s)}if(!n||!e[n])return!1;var l=e[n].toLowerCase();return r[n]||(r[n]={}),i[n]||(i[n]={}),!r[n][l]&&(i[n][l]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var a=Object.keys(i),o=0;o<a.length;o+=1){var s=a[o],c=p({},r[s],i[s]);r[s]=c}return e}),[]).reverse()},A=function(e,t){if(Array.isArray(e)&&e.length)for(var n=0;n<e.length;n+=1)if(e[n][t])return!0;return!1},N=function(e){return Array.isArray(e)?e.join(""):e},P=function(e,t){return Array.isArray(e)?e.reduce((function(e,n){return function(e,t){for(var n=Object.keys(e),r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1}(n,t)?e.priority.push(n):e.default.push(n),e}),{priority:[],default:[]}):{default:e}},L=function(e,t){var n;return p({},e,((n={})[t]=void 0,n))},R=[h.NOSCRIPT,h.SCRIPT,h.STYLE],O=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},M=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},D=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,n){return t[S[n]||n]=e[n],t}),t)},F=function(e,t){return t.map((function(t,n){var i,a=((i={key:n})["data-rh"]=!0,i);return Object.keys(t).forEach((function(e){var n=S[e]||e;"innerHTML"===n||"cssText"===n?a.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:a[n]=t[e]})),r.createElement(e,a)}))},B=function(e,t,n){switch(e){case h.TITLE:return{toComponent:function(){return n=t.titleAttributes,(i={key:e=t.title})["data-rh"]=!0,a=D(n,i),[r.createElement(h.TITLE,a,e)];var e,n,i,a},toString:function(){return function(e,t,n,r){var i=M(n),a=N(t);return i?"<"+e+' data-rh="true" '+i+">"+O(a,r)+"</"+e+">":"<"+e+' data-rh="true">'+O(a,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return D(t)},toString:function(){return M(t)}};default:return{toComponent:function(){return F(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var i=Object.keys(r).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var i=void 0===r[t]?t:t+'="'+O(r[t],n)+'"';return e?e+" "+i:i}),""),a=r.innerHTML||r.cssText||"",o=-1===R.indexOf(e);return t+"<"+e+' data-rh="true" '+i+(o?"/>":">"+a+"</"+e+">")}),"")}(e,t,n)}}}},U=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,i=e.htmlAttributes,a=e.noscriptTags,o=e.styleTags,s=e.title,c=void 0===s?"":s,l=e.titleAttributes,u=e.linkTags,d=e.metaTags,p=e.scriptTags,f={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var v=function(e){var t=e.linkTags,n=e.scriptTags,r=e.encode,i=P(e.metaTags,y),a=P(t,b),o=P(n,g);return{priorityMethods:{toComponent:function(){return[].concat(F(h.META,i.priority),F(h.LINK,a.priority),F(h.SCRIPT,o.priority))},toString:function(){return B(h.META,i.priority,r)+" "+B(h.LINK,a.priority,r)+" "+B(h.SCRIPT,o.priority,r)}},metaTags:i.default,linkTags:a.default,scriptTags:o.default}}(e);f=v.priorityMethods,u=v.linkTags,d=v.metaTags,p=v.scriptTags}return{priority:f,base:B(h.BASE,t,r),bodyAttributes:B("bodyAttributes",n,r),htmlAttributes:B("htmlAttributes",i,r),link:B(h.LINK,u,r),meta:B(h.META,d,r),noscript:B(h.NOSCRIPT,a,r),script:B(h.SCRIPT,p,r),style:B(h.STYLE,o,r),title:B(h.TITLE,{title:c,titleAttributes:l},r)}},z=[],j=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?z:n.instances},add:function(e){(n.canUseDOM?z:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?z:n.instances).indexOf(e);(n.canUseDOM?z:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=U({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},$=r.createContext({}),H=a().shape({setHelmet:a().func,helmetInstances:a().shape({get:a().func,add:a().func,remove:a().func})}),q="undefined"!=typeof document,V=function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new j(r.props.context,t.canUseDOM),r}return f(t,e),t.prototype.render=function(){return r.createElement($.Provider,{value:this.helmetData.value},this.props.children)},t}(r.Component);V.canUseDOM=q,V.propTypes={context:a().shape({helmet:a().shape()}),children:a().node.isRequired},V.defaultProps={context:{}},V.displayName="HelmetProvider";var Z=function(e,t){var n,r=document.head||document.querySelector(h.HEAD),i=r.querySelectorAll(e+"[data-rh]"),a=[].slice.call(i),o=[];return t&&t.length&&t.forEach((function(t){var r=document.createElement(e);for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&("innerHTML"===i?r.innerHTML=t.innerHTML:"cssText"===i?r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText)):r.setAttribute(i,void 0===t[i]?"":t[i]));r.setAttribute("data-rh","true"),a.some((function(e,t){return n=t,r.isEqualNode(e)}))?a.splice(n,1):o.push(r)})),a.forEach((function(e){return e.parentNode.removeChild(e)})),o.forEach((function(e){return r.appendChild(e)})),{oldTags:a,newTags:o}},W=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),i=r?r.split(","):[],a=[].concat(i),o=Object.keys(t),s=0;s<o.length;s+=1){var c=o[s],l=t[c]||"";n.getAttribute(c)!==l&&n.setAttribute(c,l),-1===i.indexOf(c)&&i.push(c);var u=a.indexOf(c);-1!==u&&a.splice(u,1)}for(var d=a.length-1;d>=0;d-=1)n.removeAttribute(a[d]);i.length===a.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==o.join(",")&&n.setAttribute("data-rh",o.join(","))}},G=function(e,t){var n=e.baseTag,r=e.htmlAttributes,i=e.linkTags,a=e.metaTags,o=e.noscriptTags,s=e.onChangeClientState,c=e.scriptTags,l=e.styleTags,u=e.title,d=e.titleAttributes;W(h.BODY,e.bodyAttributes),W(h.HTML,r),function(e,t){void 0!==e&&document.title!==e&&(document.title=N(e)),W(h.TITLE,t)}(u,d);var p={baseTag:Z(h.BASE,n),linkTags:Z(h.LINK,i),metaTags:Z(h.META,a),noscriptTags:Z(h.NOSCRIPT,o),scriptTags:Z(h.SCRIPT,c),styleTags:Z(h.STYLE,l)},f={},v={};Object.keys(p).forEach((function(e){var t=p[e],n=t.newTags,r=t.oldTags;n.length&&(f[e]=n),r.length&&(v[e]=p[e].oldTags)})),t&&t(),s(e,f,v)},K=null,X=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).rendered=!1,t}f(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!d()(e,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var e,t,n=this.props.context,r=n.setHelmet,i=null,a=(e=n.helmetInstances.get().map((function(e){var t=p({},e.props);return delete t.context,t})),{baseTag:T(["href"],e),bodyAttributes:C("bodyAttributes",e),defer:k(e,"defer"),encode:k(e,"encodeSpecialCharacters"),htmlAttributes:C("htmlAttributes",e),linkTags:I(h.LINK,["rel","href"],e),metaTags:I(h.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:I(h.NOSCRIPT,["innerHTML"],e),onChangeClientState:_(e),scriptTags:I(h.SCRIPT,["src","innerHTML"],e),styleTags:I(h.STYLE,["cssText"],e),title:E(e),titleAttributes:C("titleAttributes",e),prioritizeSeoTags:A(e,"prioritizeSeoTags")});V.canUseDOM?(t=a,K&&cancelAnimationFrame(K),t.defer?K=requestAnimationFrame((function(){G(t,(function(){K=null}))})):(G(t),K=null)):U&&(i=U(a)),r(i)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t}(r.Component);X.propTypes={context:H.isRequired},X.displayName="HelmetDispatcher";var Y=["children"],Q=["children"],J=function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!s()(L(this.props,"helmetData"),L(e,"helmetData"))},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case h.SCRIPT:case h.NOSCRIPT:return{innerHTML:t};case h.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren;return p({},r,((t={})[n.type]=[].concat(r[n.type]||[],[p({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,r=e.child,i=e.newProps,a=e.newChildProps,o=e.nestedChildren;switch(r.type){case h.TITLE:return p({},i,((t={})[r.type]=o,t.titleAttributes=p({},a),t));case h.BODY:return p({},i,{bodyAttributes:p({},a)});case h.HTML:return p({},i,{htmlAttributes:p({},a)});default:return p({},i,((n={})[r.type]=p({},a),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=p({},t);return Object.keys(e).forEach((function(t){var r;n=p({},n,((r={})[t]=e[t],r))})),n},n.warnOnInvalidChildren=function(e,t){return l()(w.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+w.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),l()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,i={};return r.Children.forEach(e,(function(e){if(e&&e.props){var r=e.props,a=r.children,o=m(r,Y),s=Object.keys(o).reduce((function(e,t){return e[x[t]||t]=o[t],e}),{}),c=e.type;switch("symbol"==typeof c?c=c.toString():n.warnOnInvalidChildren(e,a),c){case h.FRAGMENT:t=n.mapChildrenToProps(a,t);break;case h.LINK:case h.META:case h.NOSCRIPT:case h.SCRIPT:case h.STYLE:i=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:i,newChildProps:s,nestedChildren:a});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:s,nestedChildren:a})}}})),this.mapArrayTypeChildrenToProps(i,t)},n.render=function(){var e=this.props,t=e.children,n=m(e,Q),i=p({},n),a=n.helmetData;return t&&(i=this.mapChildrenToProps(t,i)),!a||a instanceof j||(a=new j(a.context,a.instances)),a?r.createElement(X,p({},i,{context:a.value,helmetData:void 0})):r.createElement($.Consumer,null,(function(e){return r.createElement(X,p({},i,{context:e}))}))},t}(r.Component);J.propTypes={base:a().object,bodyAttributes:a().object,children:a().oneOfType([a().arrayOf(a().node),a().node]),defaultTitle:a().string,defer:a().bool,encodeSpecialCharacters:a().bool,htmlAttributes:a().object,link:a().arrayOf(a().object),meta:a().arrayOf(a().object),noscript:a().arrayOf(a().object),onChangeClientState:a().func,script:a().arrayOf(a().object),style:a().arrayOf(a().object),title:a().string,titleAttributes:a().object,titleTemplate:a().string,prioritizeSeoTags:a().bool,helmetData:a().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},58702:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,o=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,v=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case d:case a:case s:case o:case f:return e;default:switch(e=e&&e.$$typeof){case l:case p:case h:case m:case c:return e;default:return t}}case i:return t}}}function x(e){return S(e)===d}t.AsyncMode=u,t.ConcurrentMode=d,t.ContextConsumer=l,t.ContextProvider=c,t.Element=r,t.ForwardRef=p,t.Fragment=a,t.Lazy=h,t.Memo=m,t.Portal=i,t.Profiler=s,t.StrictMode=o,t.Suspense=f,t.isAsyncMode=function(e){return x(e)||S(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return S(e)===l},t.isContextProvider=function(e){return S(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return S(e)===p},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===h},t.isMemo=function(e){return S(e)===m},t.isPortal=function(e){return S(e)===i},t.isProfiler=function(e){return S(e)===s},t.isStrictMode=function(e){return S(e)===o},t.isSuspense=function(e){return S(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===s||e===o||e===f||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===c||e.$$typeof===l||e.$$typeof===p||e.$$typeof===g||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b)},t.typeOf=S},19185:(e,t,n)=>{"use strict";e.exports=n(58702)},51237:(e,t,n)=>{"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}var s=n(27378),c=n(23615),l=[],u=[];function d(e){var t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then((function(e){return n.loading=!1,n.loaded=e,e})).catch((function(e){throw n.loading=!1,n.error=e,e})),n}function p(e){var t={loading:!1,loaded:{},error:null},n=[];try{Object.keys(e).forEach((function(r){var i=d(e[r]);i.loading?t.loading=!0:(t.loaded[r]=i.loaded,t.error=i.error),n.push(i.promise),i.promise.then((function(e){t.loaded[r]=e})).catch((function(e){t.error=e}))}))}catch(r){t.error=r}return t.promise=Promise.all(n).then((function(e){return t.loading=!1,e})).catch((function(e){throw t.loading=!1,e})),t}function f(e,t){return s.createElement((n=e)&&n.__esModule?n.default:n,t);var n}function v(e,t){var d,p;if(!t.loading)throw new Error("react-loadable requires a `loading` component");var v=o({loader:null,loading:null,delay:200,timeout:null,render:f,webpack:null,modules:null},t),m=null;function h(){return m||(m=e(v.loader)),m.promise}return l.push(h),"function"==typeof v.webpack&&u.push((function(){if((0,v.webpack)().every((function(e){return void 0!==e&&void 0!==n.m[e]})))return h()})),p=d=function(t){function n(n){var r;return a(i(i(r=t.call(this,n)||this)),"retry",(function(){r.setState({error:null,loading:!0,timedOut:!1}),m=e(v.loader),r._loadModule()})),h(),r.state={error:m.error,pastDelay:!1,timedOut:!1,loading:m.loading,loaded:m.loaded},r}r(n,t),n.preload=function(){return h()};var o=n.prototype;return o.UNSAFE_componentWillMount=function(){this._loadModule()},o.componentDidMount=function(){this._mounted=!0},o._loadModule=function(){var e=this;if(this.context.loadable&&Array.isArray(v.modules)&&v.modules.forEach((function(t){e.context.loadable.report(t)})),m.loading){var t=function(t){e._mounted&&e.setState(t)};"number"==typeof v.delay&&(0===v.delay?this.setState({pastDelay:!0}):this._delay=setTimeout((function(){t({pastDelay:!0})}),v.delay)),"number"==typeof v.timeout&&(this._timeout=setTimeout((function(){t({timedOut:!0})}),v.timeout));var n=function(){t({error:m.error,loaded:m.loaded,loading:m.loading}),e._clearTimeouts()};m.promise.then((function(){return n(),null})).catch((function(e){return n(),null}))}},o.componentWillUnmount=function(){this._mounted=!1,this._clearTimeouts()},o._clearTimeouts=function(){clearTimeout(this._delay),clearTimeout(this._timeout)},o.render=function(){return this.state.loading||this.state.error?s.createElement(v.loading,{isLoading:this.state.loading,pastDelay:this.state.pastDelay,timedOut:this.state.timedOut,error:this.state.error,retry:this.retry}):this.state.loaded?v.render(this.state.loaded,this.props):null},n}(s.Component),a(d,"contextTypes",{loadable:c.shape({report:c.func.isRequired})}),p}function m(e){return v(d,e)}m.Map=function(e){if("function"!=typeof e.render)throw new Error("LoadableMap requires a `render(loaded, props)` function");return v(p,e)};var h=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.getChildContext=function(){return{loadable:{report:this.props.report}}},n.render=function(){return s.Children.only(this.props.children)},t}(s.Component);function b(e){for(var t=[];e.length;){var n=e.pop();t.push(n())}return Promise.all(t).then((function(){if(e.length)return b(e)}))}a(h,"propTypes",{report:c.func.isRequired}),a(h,"childContextTypes",{loadable:c.shape({report:c.func.isRequired}).isRequired}),m.Capture=h,m.preloadAll=function(){return new Promise((function(e,t){b(l).then(e,t)}))},m.preloadReady=function(){return new Promise((function(e,t){b(u).then(e,e)}))},e.exports=m},95473:(e,t,n)=>{"use strict";n.d(t,{H:()=>s,f:()=>o});var r=n(3620),i=n(25773),a=n(27378);function o(e,t,n){return void 0===n&&(n=[]),e.some((function(e){var i=e.path?(0,r.LX)(t,e):n.length?n[n.length-1].match:r.F0.computeRootMatch(t);return i&&(n.push({route:e,match:i}),e.routes&&o(e.routes,t,n)),i})),n}function s(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e?a.createElement(r.rs,n,e.map((function(e,n){return a.createElement(r.AW,{key:e.key||n,path:e.path,exact:e.exact,strict:e.strict,render:function(n){return e.render?e.render((0,i.Z)({},n,{},t,{route:e})):a.createElement(e.component,(0,i.Z)({},n,t,{route:e}))}})}))):null}},4289:(e,t,n)=>{"use strict";n.d(t,{OL:()=>y,VK:()=>u,rU:()=>h});var r=n(3620),i=n(40351),a=n(27378),o=n(15036),s=n(25773),c=n(30808),l=n(92215),u=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).history=(0,o.lX)(t.props),t}return(0,i.Z)(t,e),t.prototype.render=function(){return a.createElement(r.F0,{history:this.history,children:this.props.children})},t}(a.Component);a.Component;var d=function(e,t){return"function"==typeof e?e(t):e},p=function(e,t){return"string"==typeof e?(0,o.ob)(e,null,null,t):e},f=function(e){return e},v=a.forwardRef;void 0===v&&(v=f);var m=v((function(e,t){var n=e.innerRef,r=e.navigate,i=e.onClick,o=(0,c.Z)(e,["innerRef","navigate","onClick"]),l=o.target,u=(0,s.Z)({},o,{onClick:function(e){try{i&&i(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||l&&"_self"!==l||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return u.ref=f!==v&&t||n,a.createElement("a",u)}));var h=v((function(e,t){var n=e.component,i=void 0===n?m:n,u=e.replace,h=e.to,b=e.innerRef,g=(0,c.Z)(e,["component","replace","to","innerRef"]);return a.createElement(r.s6.Consumer,null,(function(e){e||(0,l.Z)(!1);var n=e.history,r=p(d(h,e.location),e.location),c=r?n.createHref(r):"",m=(0,s.Z)({},g,{href:c,navigate:function(){var t=d(h,e.location),r=(0,o.Ep)(e.location)===(0,o.Ep)(p(t));(u||r?n.replace:n.push)(t)}});return f!==v?m.ref=t||b:m.innerRef=b,a.createElement(i,m)}))})),b=function(e){return e},g=a.forwardRef;void 0===g&&(g=b);var y=g((function(e,t){var n=e["aria-current"],i=void 0===n?"page":n,o=e.activeClassName,u=void 0===o?"active":o,f=e.activeStyle,v=e.className,m=e.exact,y=e.isActive,w=e.location,S=e.sensitive,x=e.strict,k=e.style,E=e.to,_=e.innerRef,C=(0,c.Z)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return a.createElement(r.s6.Consumer,null,(function(e){e||(0,l.Z)(!1);var n=w||e.location,o=p(d(E,n),n),c=o.pathname,T=c&&c.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),I=T?(0,r.LX)(n.pathname,{path:T,exact:m,sensitive:S,strict:x}):null,A=!!(y?y(I,n):I),N="function"==typeof v?v(A):v,P="function"==typeof k?k(A):k;A&&(N=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return e})).join(" ")}(N,u),P=(0,s.Z)({},P,f));var L=(0,s.Z)({"aria-current":A&&i||null,className:N,style:P,to:o},C);return b!==g?L.ref=t||_:L.innerRef=_,a.createElement(h,L)}))}))},3620:(e,t,n)=>{"use strict";n.d(t,{AW:()=>E,F0:()=>y,LX:()=>k,TH:()=>R,k6:()=>L,rs:()=>N,s6:()=>g});var r=n(40351),i=n(27378),a=n(23615),o=n.n(a),s=n(15036),c=n(92215),l=n(25773),u=n(54039),d=n.n(u),p=(n(19185),n(30808)),f=(n(55839),1073741823),v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{};var m=i.createContext||function(e,t){var n,a,s="__create-react-context-"+function(){var e="__global_unique_id__";return v[e]=(v[e]||0)+1}()+"__",c=function(e){function n(){for(var t,n,r,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return(t=e.call.apply(e,[this].concat(a))||this).emitter=(n=t.props.value,r=[],{on:function(e){r.push(e)},off:function(e){r=r.filter((function(t){return t!==e}))},get:function(){return n},set:function(e,t){n=e,r.forEach((function(e){return e(n,t)}))}}),t}(0,r.Z)(n,e);var i=n.prototype;return i.getChildContext=function(){var e;return(e={})[s]=this.emitter,e},i.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n,r=this.props.value,i=e.value;((a=r)===(o=i)?0!==a||1/a==1/o:a!=a&&o!=o)?n=0:(n="function"==typeof t?t(r,i):f,0!==(n|=0)&&this.emitter.set(e.value,n))}var a,o},i.render=function(){return this.props.children},n}(i.Component);c.childContextTypes=((n={})[s]=o().object.isRequired,n);var l=function(t){function n(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).observedBits=void 0,e.state={value:e.getValue()},e.onUpdate=function(t,n){0!=((0|e.observedBits)&n)&&e.setState({value:e.getValue()})},e}(0,r.Z)(n,t);var i=n.prototype;return i.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?f:t},i.componentDidMount=function(){this.context[s]&&this.context[s].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?f:e},i.componentWillUnmount=function(){this.context[s]&&this.context[s].off(this.onUpdate)},i.getValue=function(){return this.context[s]?this.context[s].get():e},i.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(i.Component);return l.contextTypes=((a={})[s]=o().object,a),{Provider:c,Consumer:l}},h=function(e){var t=m();return t.displayName=e,t},b=h("Router-History"),g=h("Router"),y=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._pendingLocation=e}))),n}(0,r.Z)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){var e=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen((function(t){e._isMounted&&e.setState({location:t})}))),this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},n.render=function(){return i.createElement(g.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},i.createElement(b.Provider,{children:this.props.children||null,value:this.props.history}))},t}(i.Component);i.Component;i.Component;var w={},S=1e4,x=0;function k(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,i=n.exact,a=void 0!==i&&i,o=n.strict,s=void 0!==o&&o,c=n.sensitive,l=void 0!==c&&c;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=w[n]||(w[n]={});if(r[e])return r[e];var i=[],a={regexp:d()(e,i,t),keys:i};return x<S&&(r[e]=a,x++),a}(n,{end:a,strict:s,sensitive:l}),i=r.regexp,o=r.keys,c=i.exec(e);if(!c)return null;var u=c[0],p=c.slice(1),f=e===u;return a&&!f?null:{path:n,url:"/"===n&&""===u?"/":u,isExact:f,params:o.reduce((function(e,t,n){return e[t.name]=p[n],e}),{})}}),null)}var E=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t.prototype.render=function(){var e=this;return i.createElement(g.Consumer,null,(function(t){t||(0,c.Z)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?k(n.pathname,e.props):t.match,a=(0,l.Z)({},t,{location:n,match:r}),o=e.props,s=o.children,u=o.component,d=o.render;return Array.isArray(s)&&function(e){return 0===i.Children.count(e)}(s)&&(s=null),i.createElement(g.Provider,{value:a},a.match?s?"function"==typeof s?s(a):s:u?i.createElement(u,a):d?d(a):null:"function"==typeof s?s(a):null)}))},t}(i.Component);function _(e){return"/"===e.charAt(0)?e:"/"+e}function C(e,t){if(!e)return t;var n=_(e);return 0!==t.pathname.indexOf(n)?t:(0,l.Z)({},t,{pathname:t.pathname.substr(n.length)})}function T(e){return"string"==typeof e?e:(0,s.Ep)(e)}function I(e){return function(){(0,c.Z)(!1)}}function A(){}i.Component;var N=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t.prototype.render=function(){var e=this;return i.createElement(g.Consumer,null,(function(t){t||(0,c.Z)(!1);var n,r,a=e.props.location||t.location;return i.Children.forEach(e.props.children,(function(e){if(null==r&&i.isValidElement(e)){n=e;var o=e.props.path||e.props.from;r=o?k(a.pathname,(0,l.Z)({},e.props,{path:o})):t.match}})),r?i.cloneElement(n,{location:a,computedMatch:r}):null}))},t}(i.Component);var P=i.useContext;function L(){return P(b)}function R(){return P(g).location}},54039:(e,t,n)=>{var r=n(55182);e.exports=f,e.exports.parse=a,e.exports.compile=function(e,t){return s(a(e,t),t)},e.exports.tokensToFunction=s,e.exports.tokensToRegExp=p;var i=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function a(e,t){for(var n,r=[],a=0,o=0,s="",u=t&&t.delimiter||"/";null!=(n=i.exec(e));){var d=n[0],p=n[1],f=n.index;if(s+=e.slice(o,f),o=f+d.length,p)s+=p[1];else{var v=e[o],m=n[2],h=n[3],b=n[4],g=n[5],y=n[6],w=n[7];s&&(r.push(s),s="");var S=null!=m&&null!=v&&v!==m,x="+"===y||"*"===y,k="?"===y||"*"===y,E=n[2]||u,_=b||g;r.push({name:h||a++,prefix:m||"",delimiter:E,optional:k,repeat:x,partial:S,asterisk:!!w,pattern:_?l(_):w?".*":"[^"+c(E)+"]+?"})}}return o<e.length&&(s+=e.substr(o)),s&&r.push(s),r}function o(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function s(e,t){for(var n=new Array(e.length),i=0;i<e.length;i++)"object"==typeof e[i]&&(n[i]=new RegExp("^(?:"+e[i].pattern+")$",d(t)));return function(t,i){for(var a="",s=t||{},c=(i||{}).pretty?o:encodeURIComponent,l=0;l<e.length;l++){var u=e[l];if("string"!=typeof u){var d,p=s[u.name];if(null==p){if(u.optional){u.partial&&(a+=u.prefix);continue}throw new TypeError('Expected "'+u.name+'" to be defined')}if(r(p)){if(!u.repeat)throw new TypeError('Expected "'+u.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(u.optional)continue;throw new TypeError('Expected "'+u.name+'" to not be empty')}for(var f=0;f<p.length;f++){if(d=c(p[f]),!n[l].test(d))throw new TypeError('Expected all "'+u.name+'" to match "'+u.pattern+'", but received `'+JSON.stringify(d)+"`");a+=(0===f?u.prefix:u.delimiter)+d}}else{if(d=u.asterisk?encodeURI(p).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):c(p),!n[l].test(d))throw new TypeError('Expected "'+u.name+'" to match "'+u.pattern+'", but received "'+d+'"');a+=u.prefix+d}}else a+=u}return a}}function c(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function l(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function u(e,t){return e.keys=t,e}function d(e){return e&&e.sensitive?"":"i"}function p(e,t,n){r(t)||(n=t||n,t=[]);for(var i=(n=n||{}).strict,a=!1!==n.end,o="",s=0;s<e.length;s++){var l=e[s];if("string"==typeof l)o+=c(l);else{var p=c(l.prefix),f="(?:"+l.pattern+")";t.push(l),l.repeat&&(f+="(?:"+p+f+")*"),o+=f=l.optional?l.partial?p+"("+f+")?":"(?:"+p+"("+f+"))?":p+"("+f+")"}}var v=c(n.delimiter||"/"),m=o.slice(-v.length)===v;return i||(o=(m?o.slice(0,-v.length):o)+"(?:"+v+"(?=$))?"),o+=a?"$":i&&m?"":"(?="+v+"|$)",u(new RegExp("^"+o,d(n)),t)}function f(e,t,n){return r(t)||(n=t||n,t=[]),n=n||{},e instanceof RegExp?function(e,t){var n=e.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return u(e,t)}(e,t):r(e)?function(e,t,n){for(var r=[],i=0;i<e.length;i++)r.push(f(e[i],t,n).source);return u(new RegExp("(?:"+r.join("|")+")",d(n)),t)}(e,t,n):function(e,t,n){return p(a(e,n),t,n)}(e,t,n)}},41535:(e,t,n)=>{"use strict";var r=n(62525),i=60103,a=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var o=60109,s=60110,c=60112;t.Suspense=60113;var l=60115,u=60116;if("function"==typeof Symbol&&Symbol.for){var d=Symbol.for;i=d("react.element"),a=d("react.portal"),t.Fragment=d("react.fragment"),t.StrictMode=d("react.strict_mode"),t.Profiler=d("react.profiler"),o=d("react.provider"),s=d("react.context"),c=d("react.forward_ref"),t.Suspense=d("react.suspense"),l=d("react.memo"),u=d("react.lazy")}var p="function"==typeof Symbol&&Symbol.iterator;function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m={};function h(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||v}function b(){}function g(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||v}h.prototype.isReactComponent={},h.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(f(85));this.updater.enqueueSetState(this,e,t,"setState")},h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=h.prototype;var y=g.prototype=new b;y.constructor=g,r(y,h.prototype),y.isPureReactComponent=!0;var w={current:null},S=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,n){var r,a={},o=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)S.call(t,r)&&!x.hasOwnProperty(r)&&(a[r]=t[r]);var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(r in c=e.defaultProps)void 0===a[r]&&(a[r]=c[r]);return{$$typeof:i,type:e,key:o,ref:s,props:a,_owner:w.current}}function E(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var _=/\/+/g;function C(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function T(e,t,n,r,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case i:case a:c=!0}}if(c)return o=o(c=e),e=""===r?"."+C(c,0):r,Array.isArray(o)?(n="",null!=e&&(n=e.replace(_,"$&/")+"/"),T(o,t,n,"",(function(e){return e}))):null!=o&&(E(o)&&(o=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(_,"$&/")+"/")+e)),t.push(o)),1;if(c=0,r=""===r?".":r+":",Array.isArray(e))for(var l=0;l<e.length;l++){var u=r+C(s=e[l],l);c+=T(s,t,n,u,o)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),l=0;!(s=e.next()).done;)c+=T(s=s.value,t,n,u=r+C(s,l++),o);else if("object"===s)throw t=""+e,Error(f(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return c}function I(e,t,n){if(null==e)return e;var r=[],i=0;return T(e,r,"","",(function(e){return t.call(n,e,i++)})),r}function A(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var N={current:null};function P(){var e=N.current;if(null===e)throw Error(f(321));return e}var L={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:w,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:I,forEach:function(e,t,n){I(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return I(e,(function(){t++})),t},toArray:function(e){return I(e,(function(e){return e}))||[]},only:function(e){if(!E(e))throw Error(f(143));return e}},t.Component=h,t.PureComponent=g,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,t.cloneElement=function(e,t,n){if(null==e)throw Error(f(267,e));var a=r({},e.props),o=e.key,s=e.ref,c=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,c=w.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)S.call(t,u)&&!x.hasOwnProperty(u)&&(a[u]=void 0===t[u]&&void 0!==l?l[u]:t[u])}var u=arguments.length-2;if(1===u)a.children=n;else if(1<u){l=Array(u);for(var d=0;d<u;d++)l[d]=arguments[d+2];a.children=l}return{$$typeof:i,type:e.type,key:o,ref:s,props:a,_owner:c}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:s,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=E,t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:A}},t.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return P().useCallback(e,t)},t.useContext=function(e,t){return P().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return P().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return P().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return P().useLayoutEffect(e,t)},t.useMemo=function(e,t){return P().useMemo(e,t)},t.useReducer=function(e,t,n){return P().useReducer(e,t,n)},t.useRef=function(e){return P().useRef(e)},t.useState=function(e){return P().useState(e)},t.version="17.0.2"},27378:(e,t,n)=>{"use strict";e.exports=n(41535)},73323:(e,t)=>{"use strict";var n,r,i,a;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,c=s.now();t.unstable_now=function(){return s.now()-c}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,u=null,d=function(){if(null!==l)try{var e=t.unstable_now();l(!0,e),l=null}catch(n){throw setTimeout(d,0),n}};n=function(e){null!==l?setTimeout(n,0,e):(l=e,setTimeout(d,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},a=t.unstable_forceFrameRate=function(){}}else{var p=window.setTimeout,f=window.clearTimeout;if("undefined"!=typeof console){var v=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,h=null,b=-1,g=5,y=0;t.unstable_shouldYield=function(){return t.unstable_now()>=y},a=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):g=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,S=w.port2;w.port1.onmessage=function(){if(null!==h){var e=t.unstable_now();y=e+g;try{h(!0,e)?S.postMessage(null):(m=!1,h=null)}catch(n){throw S.postMessage(null),n}}else m=!1},n=function(e){h=e,m||(m=!0,S.postMessage(null))},r=function(e,n){b=p((function(){e(t.unstable_now())}),n)},i=function(){f(b),b=-1}}function x(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<_(i,t)))break e;e[r]=t,e[n]=i,n=r}}function k(e){return void 0===(e=e[0])?null:e}function E(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var a=2*(r+1)-1,o=e[a],s=a+1,c=e[s];if(void 0!==o&&0>_(o,n))void 0!==c&&0>_(c,o)?(e[r]=c,e[s]=n,r=s):(e[r]=o,e[a]=n,r=a);else{if(!(void 0!==c&&0>_(c,n)))break e;e[r]=c,e[s]=n,r=s}}}return t}return null}function _(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],T=[],I=1,A=null,N=3,P=!1,L=!1,R=!1;function O(e){for(var t=k(T);null!==t;){if(null===t.callback)E(T);else{if(!(t.startTime<=e))break;E(T),t.sortIndex=t.expirationTime,x(C,t)}t=k(T)}}function M(e){if(R=!1,O(e),!L)if(null!==k(C))L=!0,n(D);else{var t=k(T);null!==t&&r(M,t.startTime-e)}}function D(e,n){L=!1,R&&(R=!1,i()),P=!0;var a=N;try{for(O(n),A=k(C);null!==A&&(!(A.expirationTime>n)||e&&!t.unstable_shouldYield());){var o=A.callback;if("function"==typeof o){A.callback=null,N=A.priorityLevel;var s=o(A.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?A.callback=s:A===k(C)&&E(C),O(n)}else E(C);A=k(C)}if(null!==A)var c=!0;else{var l=k(T);null!==l&&r(M,l.startTime-n),c=!1}return c}finally{A=null,N=a,P=!1}}var F=a;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){L||P||(L=!0,n(D))},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_getFirstCallbackNode=function(){return k(C)},t.unstable_next=function(e){switch(N){case 1:case 2:case 3:var t=3;break;default:t=N}var n=N;N=t;try{return e()}finally{N=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=F,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=N;N=e;try{return t()}finally{N=n}},t.unstable_scheduleCallback=function(e,a,o){var s=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?s+o:s:o=s,e){case 1:var c=-1;break;case 2:c=250;break;case 5:c=1073741823;break;case 4:c=1e4;break;default:c=5e3}return e={id:I++,callback:a,priorityLevel:e,startTime:o,expirationTime:c=o+c,sortIndex:-1},o>s?(e.sortIndex=o,x(T,e),null===k(C)&&e===k(T)&&(R?i():R=!0,r(M,o-s))):(e.sortIndex=c,x(C,e),L||P||(L=!0,n(D))),e},t.unstable_wrapCallback=function(e){var t=N;return function(){var n=N;N=t;try{return e.apply(this,arguments)}finally{N=n}}}},91102:(e,t,n)=>{"use strict";e.exports=n(73323)},74445:e=>{e.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;c<a.length;c++){var l=a[c];if(!s(l))return!1;var u=e[l],d=t[l];if(!1===(i=n?n.call(r,u,d,l):void 0)||void 0===i&&u!==d)return!1}return!0}},94047:(e,t,n)=>{"use strict";var r=n(27378);var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,o=r.useEffect,s=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(r){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return s((function(){i.value=n,i.getSnapshot=t,l(i)&&u({inst:i})}),[e,n,t]),o((function(){return l(i)&&u({inst:i}),e((function(){l(i)&&u({inst:i})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},70644:(e,t,n)=>{"use strict";e.exports=n(94047)},25773:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.d(t,{Z:()=>r})},40351:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}n.d(t,{Z:()=>i})},30808:(e,t,n)=>{"use strict";function r(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}n.d(t,{Z:()=>r})},92215:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=!0,i="Invariant failed";function a(e,t){if(!e){if(r)throw new Error(i);var n="function"==typeof t?t():t,a=n?"".concat(i,": ").concat(n):i;throw new Error(a)}}},36809:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={title:"DeviceScript",tagline:"TypeScript for Tiny IoT Devices",url:"https://microsoft.github.io",baseUrl:"/devicescript/",onBrokenLinks:"throw",favicon:"img/favicon.svg",trailingSlash:!1,organizationName:"microsoft",projectName:"devicescript",deploymentBranch:"gh-pages",presets:[["classic",{docs:{routeBasePath:"/",sidebarPath:"/home/runner/work/devicescript/devicescript/website/sidebars.js",remarkPlugins:[[null,{sync:!0}],null],beforeDefaultRemarkPlugins:[null,[null,{langs:[{lang:"rx",nodeBin:"swirly",npmPackage:"swirly",extension:"txt",inputLang:null,outputLang:null,outputFiles:[{name:"output.svg"}],args:["input.txt","output.svg"],version:"0.21.0"}]}],null],rehypePlugins:[[null,{strict:!0}]]},blog:!1,theme:{customCss:["/home/runner/work/devicescript/devicescript/website/src/css/custom.css","/home/runner/work/devicescript/devicescript/node_modules/@rise4fun/docusaurus-plugin-rise4fun/lib/rise4fun.css"]}}]],themeConfig:{announcementBar:{id:"support_us",content:'Experimental Project from Microsoft Research - Join the <a href="https://github.com/microsoft/devicescript/discussions">discussions</a> to provide feedback.',backgroundColor:"#fafbfc",textColor:"#091E42",isCloseable:!0},colorMode:{disableSwitch:!1,defaultMode:"light",respectPrefersColorScheme:!1},navbar:{title:"DeviceScript",logo:{alt:"DeviceScript language",src:"img/logo.svg",srcDark:"img/logo_dark.svg"},items:[{type:"doc",docId:"getting-started/index",position:"left",label:"Download"},{type:"doc",docId:"intro",position:"left",label:"Docs"},{type:"doc",docId:"devices/index",position:"left",label:"Devices"},{type:"doc",docId:"api/cli",position:"left",label:"API"},{href:"https://github.com/microsoft/devicescript",position:"right",className:"header-github-link","aria-label":"GitHub repository"}],hideOnScroll:!0},footer:{style:"dark",links:[{title:"Docs",items:[{label:"Introduction",to:"/intro"},{label:"Developer",to:"/developer"},{label:"Language Reference",to:"/language"},{label:"API",to:"/api/cli"}]},{title:"Community",items:[{label:"GitHub",href:"https://github.com/microsoft/devicescript/"},{label:"Discussions",href:"https://github.com/microsoft/devicescript/discussions"}]},{title:"Legal",items:[{label:"Privacy & Cookies",href:"https://go.microsoft.com/fwlink/?LinkId=521839"},{label:"Terms of Use",href:"https://www.microsoft.com/en-us/legal/intellectualproperty/copyright"},{label:"Trademarks",href:"https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general"}]}],copyright:"Copyright \xa9 2023 Microsoft Corporation."},prism:{theme:{plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}},{types:["title"],style:{color:"#0550AE",fontWeight:"bold"}},{types:["parameter"],style:{color:"#953800"}},{types:["boolean","rule","color","number","constant","property"],style:{color:"#005CC5"}},{types:["atrule","tag"],style:{color:"#22863A"}},{types:["script"],style:{color:"#24292E"}},{types:["operator","unit","rule"],style:{color:"#D73A49"}},{types:["font-matter","string","attr-value"],style:{color:"#C6105F"}},{types:["class-name"],style:{color:"#116329"}},{types:["attr-name"],style:{color:"#0550AE"}},{types:["keyword"],style:{color:"#CF222E"}},{types:["function"],style:{color:"#8250DF"}},{types:["selector"],style:{color:"#6F42C1"}},{types:["variable"],style:{color:"#E36209"}},{types:["comment"],style:{color:"#6B6B6B"}}]},darkTheme:{plain:{color:"#D4D4D4",backgroundColor:"#212121"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}},{types:["title"],style:{color:"#569CD6",fontWeight:"bold"}},{types:["property","parameter"],style:{color:"#9CDCFE"}},{types:["script"],style:{color:"#D4D4D4"}},{types:["boolean","arrow","atrule","tag"],style:{color:"#569CD6"}},{types:["number","color","unit"],style:{color:"#B5CEA8"}},{types:["font-matter"],style:{color:"#CE9178"}},{types:["keyword","rule"],style:{color:"#C586C0"}},{types:["regex"],style:{color:"#D16969"}},{types:["maybe-class-name"],style:{color:"#4EC9B0"}},{types:["constant"],style:{color:"#4FC1FF"}}]},additionalLanguages:["lisp"],magicComments:[{className:"theme-code-block-highlighted-line",line:"highlight-next-line",block:{start:"highlight-start",end:"highlight-end"}}]},docs:{sidebar:{hideable:!0,autoCollapseCategories:!0},versionPersistence:"localStorage"},url:"https://microsoft.github.io",baseUrl:"/undefined",i18n:{defaultLocale:"en",locales:["en"]},algolia:{contextualSearch:!0,searchParameters:{},searchPagePath:"search",appId:"AL1OJNE8M9",apiKey:"0d31b2119e202cd71b47e914cc567fab",indexName:"devicescript"},codeSandbox:{defaultTemplate:"devicescript",templates:{devicescript:{files:{"devsconfig.json":{content:{}},"package.json":{content:{version:"0.0.0",private:!0,dependencies:{},devDependencies:{"@devicescript/cli":"*"},scripts:{setup:"devicescript build",postinstall:"devicescript build","build:devicescript":"devicescript build",build:"yarn build:devicescript","watch:devicescript":"devicescript devtools",watch:"yarn watch:devicescript","test:devicescript":"devicescript run src/main.ts --test --test-self-exit",test:"yarn test:devicescript",start:"yarn watch"}}},"sandbox.config.json":{content:{template:"node",view:"terminal",container:{node:"18"},startScript:"setup"}}}}}},metadata:[],tableOfContents:{minHeadingLevel:2,maxHeadingLevel:3},mermaid:{theme:{dark:"dark",light:"default"},options:{}}},stylesheets:[{href:"https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css",type:"text/css",integrity:"sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM",crossorigin:"anonymous"}],markdown:{mermaid:!0},themes:["@docusaurus/theme-mermaid",["@rise4fun/docusaurus-theme-codesandbox-button",{defaultTemplate:"devicescript",templates:{devicescript:{files:{"devsconfig.json":{content:{}},"package.json":{content:{version:"0.0.0",private:!0,dependencies:{},devDependencies:{"@devicescript/cli":"*"},scripts:{setup:"devicescript build",postinstall:"devicescript build","build:devicescript":"devicescript build",build:"yarn build:devicescript","watch:devicescript":"devicescript devtools",watch:"yarn watch:devicescript","test:devicescript":"devicescript run src/main.ts --test --test-self-exit",test:"yarn test:devicescript",start:"yarn watch"}}},"sandbox.config.json":{content:{template:"node",view:"terminal",container:{node:"18"},startScript:"setup"}}}}}}]],plugins:[[null,{disableCookiesUsage:!0,instrumentationKey:"06283122-cd76-493c-9641-fbceeeefd9c6"}]],staticDirectories:["static",".docusaurus/docusaurus-remark-plugin-compile-code/assets"],baseUrlIssueBanner:!0,i18n:{defaultLocale:"en",path:"i18n",locales:["en"],localeConfigs:{}},onBrokenMarkdownLinks:"warn",onDuplicateRoutes:"warn",customFields:{},scripts:[],headTags:[],clientModules:[],titleDelimiter:"|",noIndex:!1}},57529:e=>{"use strict";e.exports={}},16887:e=>{"use strict";e.exports=JSON.parse('{"/devicescript/search-d9d":{"__comp":"1a4e3797","__context":{"plugin":"e6691913"}},"/devicescript/-f88":{"__comp":"1df93b7f","__context":{"plugin":"aa71f709"},"config":"5e9f5e1a"},"/devicescript/-fbd":{"__comp":"1be78505","__context":{"plugin":"019132d2"},"versionMetadata":"935f2afb"},"/devicescript/api/cli-5ed":{"__comp":"17896441","content":"de51976a"},"/devicescript/api/clients-fe1":{"__comp":"17896441","content":"df304c58"},"/devicescript/api/clients/accelerometer-cf6":{"__comp":"17896441","content":"3583f1cc"},"/devicescript/api/clients/acidity-e0a":{"__comp":"17896441","content":"5dd58d1c"},"/devicescript/api/clients/airpressure-5a0":{"__comp":"17896441","content":"bb0e3bff"},"/devicescript/api/clients/airqualityindex-b98":{"__comp":"17896441","content":"7f4eb034"},"/devicescript/api/clients/arcadegamepad-64b":{"__comp":"17896441","content":"88c5790d"},"/devicescript/api/clients/arcadesound-61e":{"__comp":"17896441","content":"0fe4a880"},"/devicescript/api/clients/barcodereader-d12":{"__comp":"17896441","content":"91d2d959"},"/devicescript/api/clients/bitradio-0f5":{"__comp":"17896441","content":"55133214"},"/devicescript/api/clients/bootloader-464":{"__comp":"17896441","content":"fcb40366"},"/devicescript/api/clients/brailledisplay-240":{"__comp":"17896441","content":"6f141d43"},"/devicescript/api/clients/bridge-9c3":{"__comp":"17896441","content":"c3437d7e"},"/devicescript/api/clients/button-35b":{"__comp":"17896441","content":"437cc37c"},"/devicescript/api/clients/buzzer-427":{"__comp":"17896441","content":"aec6ee96"},"/devicescript/api/clients/capacitivebutton-d31":{"__comp":"17896441","content":"bff3aaa3"},"/devicescript/api/clients/characterscreen-8ac":{"__comp":"17896441","content":"7017c395"},"/devicescript/api/clients/cloudadapter-d41":{"__comp":"17896441","content":"d5d9b552"},"/devicescript/api/clients/cloudconfiguration-8e6":{"__comp":"17896441","content":"4aae093d"},"/devicescript/api/clients/codalmessagebus-6dd":{"__comp":"17896441","content":"11653462"},"/devicescript/api/clients/color-58a":{"__comp":"17896441","content":"bf5a0007"},"/devicescript/api/clients/compass-17a":{"__comp":"17896441","content":"3f4a2944"},"/devicescript/api/clients/control-b6d":{"__comp":"17896441","content":"61556d62"},"/devicescript/api/clients/dashboard-a80":{"__comp":"17896441","content":"89588721"},"/devicescript/api/clients/dccurrentmeasurement-fee":{"__comp":"17896441","content":"36363056"},"/devicescript/api/clients/dcvoltagemeasurement-559":{"__comp":"17896441","content":"a65110b7"},"/devicescript/api/clients/devicescriptcondition-8b5":{"__comp":"17896441","content":"1a1df4a0"},"/devicescript/api/clients/devicescriptdebugger-4e2":{"__comp":"17896441","content":"9b1d3f80"},"/devicescript/api/clients/devicescriptmanager-2a3":{"__comp":"17896441","content":"34b3ce2d"},"/devicescript/api/clients/distance-a5b":{"__comp":"17896441","content":"a4d48e61"},"/devicescript/api/clients/dmx-8fb":{"__comp":"17896441","content":"0f0c2e9e"},"/devicescript/api/clients/dotmatrix-2f4":{"__comp":"17896441","content":"f70d59fe"},"/devicescript/api/clients/dualmotors-235":{"__comp":"17896441","content":"9eb80747"},"/devicescript/api/clients/eco2-e99":{"__comp":"17896441","content":"aae462db"},"/devicescript/api/clients/flex-2b6":{"__comp":"17896441","content":"d99e20a1"},"/devicescript/api/clients/gamepad-eb5":{"__comp":"17896441","content":"39409b5b"},"/devicescript/api/clients/gpio-078":{"__comp":"17896441","content":"e233ee0e"},"/devicescript/api/clients/gyroscope-db1":{"__comp":"17896441","content":"3bc219ec"},"/devicescript/api/clients/heartrate-fd2":{"__comp":"17896441","content":"5943acca"},"/devicescript/api/clients/hidjoystick-440":{"__comp":"17896441","content":"44d3e5f5"},"/devicescript/api/clients/hidkeyboard-a21":{"__comp":"17896441","content":"34179c72"},"/devicescript/api/clients/hidmouse-61e":{"__comp":"17896441","content":"57b44454"},"/devicescript/api/clients/humidity-ee1":{"__comp":"17896441","content":"9f50cf8a"},"/devicescript/api/clients/i2c-165":{"__comp":"17896441","content":"882902b6"},"/devicescript/api/clients/illuminance-ec5":{"__comp":"17896441","content":"72451d75"},"/devicescript/api/clients/indexedscreen-edc":{"__comp":"17896441","content":"5046913c"},"/devicescript/api/clients/infrastructure-c50":{"__comp":"17896441","content":"a7397367"},"/devicescript/api/clients/led-fbc":{"__comp":"17896441","content":"89d10a13"},"/devicescript/api/clients/ledsingle-dab":{"__comp":"17896441","content":"99d3ca33"},"/devicescript/api/clients/ledstrip-c23":{"__comp":"17896441","content":"d1201f8d"},"/devicescript/api/clients/lightbulb-106":{"__comp":"17896441","content":"dc43ceaf"},"/devicescript/api/clients/lightlevel-c2f":{"__comp":"17896441","content":"ef45af3d"},"/devicescript/api/clients/logger-43b":{"__comp":"17896441","content":"57c4248f"},"/devicescript/api/clients/magneticfieldlevel-390":{"__comp":"17896441","content":"f4a210bc"},"/devicescript/api/clients/magnetomer-037":{"__comp":"17896441","content":"5ce11ed9"},"/devicescript/api/clients/matrixkeypad-604":{"__comp":"17896441","content":"ac364c7b"},"/devicescript/api/clients/microphone-071":{"__comp":"17896441","content":"f2f2094c"},"/devicescript/api/clients/midioutput-c79":{"__comp":"17896441","content":"67482af5"},"/devicescript/api/clients/modelrunner-2f1":{"__comp":"17896441","content":"ffea0820"},"/devicescript/api/clients/motion-86c":{"__comp":"17896441","content":"8442201f"},"/devicescript/api/clients/motor-17d":{"__comp":"17896441","content":"c7fb68d8"},"/devicescript/api/clients/multitouch-bde":{"__comp":"17896441","content":"23719d77"},"/devicescript/api/clients/planarposition-0e6":{"__comp":"17896441","content":"e05d126a"},"/devicescript/api/clients/potentiometer-216":{"__comp":"17896441","content":"7cbf7351"},"/devicescript/api/clients/power-d0c":{"__comp":"17896441","content":"d1067852"},"/devicescript/api/clients/powersupply-16b":{"__comp":"17896441","content":"8a8c4ba9"},"/devicescript/api/clients/pressurebutton-bea":{"__comp":"17896441","content":"1d820ac6"},"/devicescript/api/clients/prototest-040":{"__comp":"17896441","content":"56f2b0c6"},"/devicescript/api/clients/proxy-81d":{"__comp":"17896441","content":"d6f63b00"},"/devicescript/api/clients/pulseoximeter-0f8":{"__comp":"17896441","content":"2785e21a"},"/devicescript/api/clients/raingauge-851":{"__comp":"17896441","content":"fca5e363"},"/devicescript/api/clients/realtimeclock-159":{"__comp":"17896441","content":"e1132b00"},"/devicescript/api/clients/reflectedlight-74a":{"__comp":"17896441","content":"236f6b2e"},"/devicescript/api/clients/relay-b56":{"__comp":"17896441","content":"9f4b432b"},"/devicescript/api/clients/rng-96b":{"__comp":"17896441","content":"17139236"},"/devicescript/api/clients/rolemanager-4e9":{"__comp":"17896441","content":"5015016c"},"/devicescript/api/clients/ros-dec":{"__comp":"17896441","content":"26effb06"},"/devicescript/api/clients/rotaryencoder-1b3":{"__comp":"17896441","content":"ca399add"},"/devicescript/api/clients/rover-d5b":{"__comp":"17896441","content":"ee7ced19"},"/devicescript/api/clients/satelittenavigationsystem-5f6":{"__comp":"17896441","content":"e5f3ce77"},"/devicescript/api/clients/sensoraggregator-78b":{"__comp":"17896441","content":"ebf7369b"},"/devicescript/api/clients/serial-7e2":{"__comp":"17896441","content":"d7276684"},"/devicescript/api/clients/servo-958":{"__comp":"17896441","content":"4d478ee4"},"/devicescript/api/clients/settings-660":{"__comp":"17896441","content":"e27a30e8"},"/devicescript/api/clients/sevensegmentdisplay-869":{"__comp":"17896441","content":"b0272dca"},"/devicescript/api/clients/soilmoisture-09a":{"__comp":"17896441","content":"79aef7ac"},"/devicescript/api/clients/solenoid-775":{"__comp":"17896441","content":"dc34691d"},"/devicescript/api/clients/soundlevel-d7a":{"__comp":"17896441","content":"f2fc7a53"},"/devicescript/api/clients/soundplayer-2b5":{"__comp":"17896441","content":"43d8caec"},"/devicescript/api/clients/soundrecorderwithplayback-966":{"__comp":"17896441","content":"dc3dd087"},"/devicescript/api/clients/soundspectrum-30e":{"__comp":"17896441","content":"f6e1255d"},"/devicescript/api/clients/speechsynthesis-58f":{"__comp":"17896441","content":"7f8a356d"},"/devicescript/api/clients/switch-a14":{"__comp":"17896441","content":"3de927d0"},"/devicescript/api/clients/tcp-b64":{"__comp":"17896441","content":"1c420d1d"},"/devicescript/api/clients/temperature-782":{"__comp":"17896441","content":"9cfe4cc6"},"/devicescript/api/clients/timeseriesaggregator-18f":{"__comp":"17896441","content":"351c4745"},"/devicescript/api/clients/trafficlight-ca6":{"__comp":"17896441","content":"ad7e4376"},"/devicescript/api/clients/tvoc-1c7":{"__comp":"17896441","content":"6dde451c"},"/devicescript/api/clients/uniquebrain-be0":{"__comp":"17896441","content":"921da172"},"/devicescript/api/clients/usbbridge-522":{"__comp":"17896441","content":"dc277a3e"},"/devicescript/api/clients/uvindex-435":{"__comp":"17896441","content":"706ab872"},"/devicescript/api/clients/verifiedtelemetrysensor-2cf":{"__comp":"17896441","content":"02d6ef5b"},"/devicescript/api/clients/vibrationmotor-485":{"__comp":"17896441","content":"d8c5d390"},"/devicescript/api/clients/waterlevel-7d5":{"__comp":"17896441","content":"612d74b3"},"/devicescript/api/clients/weightscale-216":{"__comp":"17896441","content":"7ba726e1"},"/devicescript/api/clients/wifi-11d":{"__comp":"17896441","content":"6ea5afa0"},"/devicescript/api/clients/winddirection-3a3":{"__comp":"17896441","content":"0cc1c4e6"},"/devicescript/api/clients/windspeed-190":{"__comp":"17896441","content":"eb1704c0"},"/devicescript/api/clients/wssk-866":{"__comp":"17896441","content":"4612ab74"},"/devicescript/api/core-f63":{"__comp":"17896441","content":"2c32c100"},"/devicescript/api/core/buffers-3f8":{"__comp":"17896441","content":"bcfe7f12"},"/devicescript/api/core/commands-1ac":{"__comp":"17896441","content":"13738eeb"},"/devicescript/api/core/events-936":{"__comp":"17896441","content":"d822119d"},"/devicescript/api/core/registers-893":{"__comp":"17896441","content":"010eedb1"},"/devicescript/api/core/roles-fad":{"__comp":"17896441","content":"3c8d9a18"},"/devicescript/api/drivers-8f6":{"__comp":"17896441","content":"7ec0e1a1"},"/devicescript/api/drivers/accelerometer-678":{"__comp":"17896441","content":"a1da537c"},"/devicescript/api/drivers/aht20-02f":{"__comp":"17896441","content":"51e07670"},"/devicescript/api/drivers/bme680-068":{"__comp":"17896441","content":"beffa4c6"},"/devicescript/api/drivers/button-93a":{"__comp":"17896441","content":"f468c751"},"/devicescript/api/drivers/buzzer-71a":{"__comp":"17896441","content":"0f58a8af"},"/devicescript/api/drivers/hall-83b":{"__comp":"17896441","content":"27971726"},"/devicescript/api/drivers/hidjoystick-1d5":{"__comp":"17896441","content":"f7e5a795"},"/devicescript/api/drivers/hidkeyboard-d4b":{"__comp":"17896441","content":"7a7b4b0d"},"/devicescript/api/drivers/hidmouse-8fe":{"__comp":"17896441","content":"4258b118"},"/devicescript/api/drivers/lightbulb-e5a":{"__comp":"17896441","content":"b42ed10e"},"/devicescript/api/drivers/lightlevel-a2b":{"__comp":"17896441","content":"e0bded7f"},"/devicescript/api/drivers/ltr390-ddd":{"__comp":"17896441","content":"a2b93c3a"},"/devicescript/api/drivers/motion-f3d":{"__comp":"17896441","content":"b9f2eef7"},"/devicescript/api/drivers/potentiometer-df4":{"__comp":"17896441","content":"7c28bcf8"},"/devicescript/api/drivers/power-8f2":{"__comp":"17896441","content":"c955ff7d"},"/devicescript/api/drivers/reflectedlight-a9a":{"__comp":"17896441","content":"03ded4e1"},"/devicescript/api/drivers/relay-a85":{"__comp":"17896441","content":"3352a21f"},"/devicescript/api/drivers/rotaryencoder-e8c":{"__comp":"17896441","content":"4d64fe70"},"/devicescript/api/drivers/servo-a02":{"__comp":"17896441","content":"6407abb7"},"/devicescript/api/drivers/sht30-3b0":{"__comp":"17896441","content":"a1f85011"},"/devicescript/api/drivers/shtc3-d19":{"__comp":"17896441","content":"14b6b4b0"},"/devicescript/api/drivers/soilmoisture-249":{"__comp":"17896441","content":"fab9523c"},"/devicescript/api/drivers/soundlevel-3b4":{"__comp":"17896441","content":"6496ecc8"},"/devicescript/api/drivers/ssd1306-85b":{"__comp":"17896441","content":"b18f40c0"},"/devicescript/api/drivers/st7789-02d":{"__comp":"17896441","content":"ce847cce"},"/devicescript/api/drivers/switch-ea3":{"__comp":"17896441","content":"22820bcb"},"/devicescript/api/drivers/trafficlight-86c":{"__comp":"17896441","content":"f995dfad"},"/devicescript/api/drivers/uc8151-e8c":{"__comp":"17896441","content":"85b70f9f"},"/devicescript/api/drivers/waterlevel-60b":{"__comp":"17896441","content":"1b288cf4"},"/devicescript/api/math-261":{"__comp":"17896441","content":"255d1f03"},"/devicescript/api/observables-b9a":{"__comp":"17896441","content":"d3766067"},"/devicescript/api/observables/creation-db2":{"__comp":"17896441","content":"e3661ab2"},"/devicescript/api/observables/dsp-1f1":{"__comp":"17896441","content":"88b58b9e"},"/devicescript/api/observables/filter-004":{"__comp":"17896441","content":"298366da"},"/devicescript/api/observables/transform-de8":{"__comp":"17896441","content":"934e9f4c"},"/devicescript/api/observables/utils-489":{"__comp":"17896441","content":"a7118a9a"},"/devicescript/api/runtime-1b1":{"__comp":"17896441","content":"98f2cacc"},"/devicescript/api/runtime/palette-009":{"__comp":"17896441","content":"25856b02"},"/devicescript/api/runtime/pixelbuffer-3bc":{"__comp":"17896441","content":"6a0d6083"},"/devicescript/api/runtime/schedule-3ec":{"__comp":"17896441","content":"87e2c537"},"/devicescript/api/settings-35f":{"__comp":"17896441","content":"97af9a3e"},"/devicescript/api/spi-531":{"__comp":"17896441","content":"c688902b"},"/devicescript/api/test-06b":{"__comp":"17896441","content":"066d851d"},"/devicescript/api/vm-d49":{"__comp":"17896441","content":"bd082109"},"/devicescript/changelog-3ac":{"__comp":"17896441","content":"735d0569"},"/devicescript/contributing-64c":{"__comp":"17896441","content":"72a427b3"},"/devicescript/developer-570":{"__comp":"17896441","content":"3287d67a"},"/devicescript/developer/board-configuration-b36":{"__comp":"17896441","content":"8796e623"},"/devicescript/developer/bundle-073":{"__comp":"17896441","content":"6b92a77b"},"/devicescript/developer/clients-475":{"__comp":"17896441","content":"546bdb9a"},"/devicescript/developer/commands-474":{"__comp":"17896441","content":"68830679"},"/devicescript/developer/console-889":{"__comp":"17896441","content":"1b1eee5e"},"/devicescript/developer/crypto-779":{"__comp":"17896441","content":"99cc6920"},"/devicescript/developer/development-gateway-7e8":{"__comp":"17896441","content":"41c96264"},"/devicescript/developer/development-gateway/configuration-65b":{"__comp":"17896441","content":"e0f9f1f4"},"/devicescript/developer/development-gateway/environment-c42":{"__comp":"17896441","content":"55d44c10"},"/devicescript/developer/development-gateway/gateway-955":{"__comp":"17896441","content":"f59b56a8"},"/devicescript/developer/development-gateway/messages-354":{"__comp":"17896441","content":"2b38635b"},"/devicescript/developer/development-gateway/telemetry-b0e":{"__comp":"17896441","content":"174cc3bf"},"/devicescript/developer/drivers-9fb":{"__comp":"17896441","content":"01d62032"},"/devicescript/developer/drivers/analog-60a":{"__comp":"17896441","content":"4c0cf505"},"/devicescript/developer/drivers/custom-services-fd1":{"__comp":"17896441","content":"e754dbb1"},"/devicescript/developer/drivers/digital-io-639":{"__comp":"17896441","content":"a6c4ed74"},"/devicescript/developer/drivers/digital-io/wire-d24":{"__comp":"17896441","content":"dd8bbfeb"},"/devicescript/developer/drivers/i2c-996":{"__comp":"17896441","content":"c44a5b35"},"/devicescript/developer/drivers/serial-afc":{"__comp":"17896441","content":"204e02b7"},"/devicescript/developer/drivers/spi-d45":{"__comp":"17896441","content":"c62d7f7c"},"/devicescript/developer/errors-c23":{"__comp":"17896441","content":"3731312d"},"/devicescript/developer/graphics-043":{"__comp":"17896441","content":"b61553de"},"/devicescript/developer/graphics/display-1eb":{"__comp":"17896441","content":"afcacdd7"},"/devicescript/developer/graphics/image-a13":{"__comp":"17896441","content":"4a3643e7"},"/devicescript/developer/iot-db1":{"__comp":"17896441","content":"c54ba89e"},"/devicescript/developer/iot/adafruit-io-d23":{"__comp":"17896441","content":"4cf0c468"},"/devicescript/developer/iot/blues-io-dc8":{"__comp":"17896441","content":"4009ac77"},"/devicescript/developer/iot/blynk-io-825":{"__comp":"17896441","content":"a2547cfc"},"/devicescript/developer/iot/matlab-thingspeak-16d":{"__comp":"17896441","content":"15372202"},"/devicescript/developer/json-7b0":{"__comp":"17896441","content":"ab830b92"},"/devicescript/developer/jsx-01f":{"__comp":"17896441","content":"cea52501"},"/devicescript/developer/leds-8cd":{"__comp":"17896441","content":"b2987995"},"/devicescript/developer/leds/display-6d1":{"__comp":"17896441","content":"9bc44158"},"/devicescript/developer/leds/driver-e68":{"__comp":"17896441","content":"4c197666"},"/devicescript/developer/low-power-c61":{"__comp":"17896441","content":"96998115"},"/devicescript/developer/mcu-temperature-978":{"__comp":"17896441","content":"6d697ca4"},"/devicescript/developer/net-0a4":{"__comp":"17896441","content":"ea615551"},"/devicescript/developer/net/encrypted-fetch-7cc":{"__comp":"17896441","content":"f1347c03"},"/devicescript/developer/net/mqtt-203":{"__comp":"17896441","content":"008bb2ac"},"/devicescript/developer/observables-975":{"__comp":"17896441","content":"2188eaab"},"/devicescript/developer/packages-cda":{"__comp":"17896441","content":"9ea8689d"},"/devicescript/developer/packages/custom-890":{"__comp":"17896441","content":"5eb65f11"},"/devicescript/developer/register-966":{"__comp":"17896441","content":"5f7ad2e3"},"/devicescript/developer/settings-a60":{"__comp":"17896441","content":"09bafa26"},"/devicescript/developer/simulation-d7f":{"__comp":"17896441","content":"a5466529"},"/devicescript/developer/status-light-51a":{"__comp":"17896441","content":"db7e3fd2"},"/devicescript/developer/testing-e87":{"__comp":"17896441","content":"fb10faaf"},"/devicescript/devices-956":{"__comp":"17896441","content":"eacb47ff"},"/devicescript/devices/add-board-db4":{"__comp":"17896441","content":"49a92887"},"/devicescript/devices/add-shield-c05":{"__comp":"17896441","content":"0444f081"},"/devicescript/devices/add-soc-61e":{"__comp":"17896441","content":"3dd53374"},"/devicescript/devices/esp32-290":{"__comp":"17896441","content":"6b7af4fc"},"/devicescript/devices/esp32/adafruit-feather-esp32-s2-0ba":{"__comp":"17896441","content":"032aa2b9"},"/devicescript/devices/esp32/adafruit-qt-py-c3-496":{"__comp":"17896441","content":"f8f225ac"},"/devicescript/devices/esp32/esp32-bare-533":{"__comp":"17896441","content":"edce4ca7"},"/devicescript/devices/esp32/esp32-c3fh4-rgb-351":{"__comp":"17896441","content":"30943bfd"},"/devicescript/devices/esp32/esp32-devkit-c-4a2":{"__comp":"17896441","content":"f209bce9"},"/devicescript/devices/esp32/esp32c3-bare-4dd":{"__comp":"17896441","content":"22021e31"},"/devicescript/devices/esp32/esp32c3-rust-devkit-fb3":{"__comp":"17896441","content":"8fb2ffea"},"/devicescript/devices/esp32/esp32s2-bare-ed3":{"__comp":"17896441","content":"1ebf7e3d"},"/devicescript/devices/esp32/esp32s3-bare-f1c":{"__comp":"17896441","content":"63a77b62"},"/devicescript/devices/esp32/esp32s3-devkit-m-01f":{"__comp":"17896441","content":"b3f35163"},"/devicescript/devices/esp32/feather-s2-843":{"__comp":"17896441","content":"c2d38624"},"/devicescript/devices/esp32/msr207-v42-31f":{"__comp":"17896441","content":"93ebf6e1"},"/devicescript/devices/esp32/msr207-v43-0d3":{"__comp":"17896441","content":"899b456c"},"/devicescript/devices/esp32/msr48-1a2":{"__comp":"17896441","content":"e11cc8a5"},"/devicescript/devices/esp32/seeed-xiao-esp32c3-f60":{"__comp":"17896441","content":"67ed5e14"},"/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218-23d":{"__comp":"17896441","content":"2ae8a91e"},"/devicescript/devices/rp2040-ce1":{"__comp":"17896441","content":"79e87f40"},"/devicescript/devices/rp2040/msr124-cfb":{"__comp":"17896441","content":"ed00ad56"},"/devicescript/devices/rp2040/msr59-497":{"__comp":"17896441","content":"c818a061"},"/devicescript/devices/rp2040/pico-531":{"__comp":"17896441","content":"6cc4cf7a"},"/devicescript/devices/rp2040/pico-w-1ec":{"__comp":"17896441","content":"5fb0aa51"},"/devicescript/devices/shields-691":{"__comp":"17896441","content":"6c9194df"},"/devicescript/devices/shields/pico-bricks-37f":{"__comp":"17896441","content":"42ad4eab"},"/devicescript/devices/shields/pimoroni-pico-badger-f5c":{"__comp":"17896441","content":"ef6ce06d"},"/devicescript/devices/shields/waveshare-pico-lcd-114-8e5":{"__comp":"17896441","content":"27ec97a3"},"/devicescript/devices/shields/xiao-expansion-board-82b":{"__comp":"17896441","content":"f3e8b01b"},"/devicescript/getting-started-1a1":{"__comp":"17896441","content":"15d99295"},"/devicescript/getting-started/cli-bd0":{"__comp":"17896441","content":"61debf69"},"/devicescript/getting-started/vscode-9a6":{"__comp":"17896441","content":"8b9eacc1"},"/devicescript/getting-started/vscode/debugging-110":{"__comp":"17896441","content":"ea5052e5"},"/devicescript/getting-started/vscode/simulation-12b":{"__comp":"17896441","content":"cbfba0ab"},"/devicescript/getting-started/vscode/troubleshooting-ce6":{"__comp":"17896441","content":"ac1a52a9"},"/devicescript/getting-started/vscode/user-interface-2e9":{"__comp":"17896441","content":"08972f5c"},"/devicescript/getting-started/vscode/workspaces-662":{"__comp":"17896441","content":"2bfae4de"},"/devicescript/intro-fee":{"__comp":"17896441","content":"f8409a7e"},"/devicescript/language-375":{"__comp":"17896441","content":"3851185d"},"/devicescript/language/async-d1f":{"__comp":"17896441","content":"98876a2d"},"/devicescript/language/bytecode-b37":{"__comp":"17896441","content":"b342ea0c"},"/devicescript/language/devicescript-vs-javascript-861":{"__comp":"17896441","content":"4cf2e415"},"/devicescript/language/hex-48f":{"__comp":"17896441","content":"9421b549"},"/devicescript/language/runtime-377":{"__comp":"17896441","content":"3e4ca316"},"/devicescript/language/special-16f":{"__comp":"17896441","content":"a75cc24e"},"/devicescript/language/strings-f46":{"__comp":"17896441","content":"03013c26"},"/devicescript/language/tostring-064":{"__comp":"17896441","content":"6a350437"},"/devicescript/language/tree-shaking-7c1":{"__comp":"17896441","content":"357f20a9"},"/devicescript/samples-f18":{"__comp":"17896441","content":"eed45f36"},"/devicescript/samples/blinky-f36":{"__comp":"17896441","content":"700d2df6"},"/devicescript/samples/button-led-f42":{"__comp":"17896441","content":"d63f844b"},"/devicescript/samples/copy-paste-button-59f":{"__comp":"17896441","content":"c7480e04"},"/devicescript/samples/dimmer-4e3":{"__comp":"17896441","content":"54d266d7"},"/devicescript/samples/double-blinky-36d":{"__comp":"17896441","content":"338b64d9"},"/devicescript/samples/github-build-status-4c5":{"__comp":"17896441","content":"edf0ab12"},"/devicescript/samples/homebridge-humidity-7a3":{"__comp":"17896441","content":"5b9becab"},"/devicescript/samples/schedule-blinky-fc3":{"__comp":"17896441","content":"85efd854"},"/devicescript/samples/status-light-blinky-3f1":{"__comp":"17896441","content":"aa027bd7"},"/devicescript/samples/temperature-mqtt-0a2":{"__comp":"17896441","content":"1f829b5e"},"/devicescript/samples/thermostat-229":{"__comp":"17896441","content":"38e4c03d"},"/devicescript/samples/thermostat-gateway-480":{"__comp":"17896441","content":"ca63cf85"},"/devicescript/samples/weather-dashboard-235":{"__comp":"17896441","content":"6711afe8"},"/devicescript/samples/weather-display-f9e":{"__comp":"17896441","content":"b9793319"},"/devicescript/samples/workshop-7f1":{"__comp":"17896441","content":"92ed0cbf"}}')}},e=>{e.O(0,[532],(()=>{return t=93375,e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/assets/js/main.758ada1f.js.LICENSE.txt b/assets/js/main.758ada1f.js.LICENSE.txt new file mode 100644 index 00000000000..a565327fe5d --- /dev/null +++ b/assets/js/main.758ada1f.js.LICENSE.txt @@ -0,0 +1,68 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress + * @license MIT */ + +/*! + * Microsoft Dynamic Proto Utility, 1.1.9 + * Copyright (c) Microsoft and contributors. All rights reserved. + */ + +/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT <https://opensource.org/licenses/MIT> + * @author Lea Verou <https://lea.verou.me> + * @namespace + * @public + */ + +/** @license React v0.20.2 + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** @license React v17.0.2 + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** @license React v17.0.2 + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ diff --git a/assets/js/runtime~main.9a432182.js b/assets/js/runtime~main.9a432182.js new file mode 100644 index 00000000000..19bed183f46 --- /dev/null +++ b/assets/js/runtime~main.9a432182.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,a,c,d,f,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={exports:{}};return b[e].call(c.exports,c,c.exports,r),c.exports}r.m=b,e=[],r.O=(a,c,d,f)=>{if(!c){var b=1/0;for(i=0;i<e.length;i++){c=e[i][0],d=e[i][1],f=e[i][2];for(var t=!0,o=0;o<c.length;o++)(!1&f||b>=f)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,f<b&&(b=f));if(t){e.splice(i--,1);var n=d();void 0!==n&&(a=n)}}return a}f=f||0;for(var i=e.length;i>0&&e[i-1][2]>f;i--)e[i]=e[i-1];e[i]=[c,d,f]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var f=Object.create(null);r.r(f);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&d&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(f,b),f},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({3:"03ded4e1",15:"e754dbb1",39:"6dde451c",49:"6a350437",53:"935f2afb",107:"b61553de",114:"298366da",118:"39409b5b",162:"204e02b7",229:"01d62032",273:"a7118a9a",320:"3dd53374",393:"d8c5d390",425:"d99e20a1",444:"a65110b7",490:"1ebf7e3d",648:"706ab872",660:"8442201f",677:"f468c751",770:"3851185d",831:"0fe4a880",845:"4c0cf505",952:"032aa2b9",960:"55133214",1030:"67482af5",1070:"7cbf7351",1169:"019132d2",1180:"4aae093d",1189:"d822119d",1281:"7c28bcf8",1297:"f4a210bc",1327:"a5466529",1343:"9421b549",1368:"88b58b9e",1382:"5b9becab",1409:"44d3e5f5",1421:"f995dfad",1429:"3731312d",1431:"3de927d0",1495:"68830679",1496:"bff3aaa3",1500:"4cf0c468",1501:"ffea0820",1506:"b9f2eef7",1514:"edce4ca7",1571:"ee7ced19",1589:"f70d59fe",1674:"9eb80747",1707:"dc277a3e",1716:"0cc1c4e6",1728:"8a8c4ba9",1806:"6d697ca4",1978:"79e87f40",1993:"eed45f36",2002:"f209bce9",2105:"ea5052e5",2117:"a1da537c",2135:"61debf69",2139:"4258b118",2214:"23719d77",2260:"ce847cce",2277:"a2547cfc",2296:"dc3dd087",2345:"fab9523c",2357:"c7480e04",2362:"d1201f8d",2412:"25856b02",2429:"0444f081",2467:"d7276684",2469:"b42ed10e",2481:"38e4c03d",2527:"96998115",2544:"c54ba89e",2561:"98f2cacc",2579:"255d1f03",2605:"cea52501",2611:"a1f85011",2630:"dc34691d",2643:"2188eaab",2652:"5943acca",2671:"3e4ca316",2749:"c3437d7e",2793:"aae462db",2899:"2ae8a91e",2948:"6c9194df",3032:"98876a2d",3098:"fcb40366",3105:"bf5a0007",3154:"afcacdd7",3206:"f8409a7e",3218:"de51976a",3233:"e6691913",3234:"bd082109",3237:"1df93b7f",3239:"bb0e3bff",3251:"7ec0e1a1",3297:"e0bded7f",3357:"1a1df4a0",3358:"87e2c537",3442:"9f50cf8a",3464:"aa027bd7",3482:"6ea5afa0",3485:"c2d38624",3538:"13738eeb",3598:"26effb06",3663:"0f58a8af",3666:"d3766067",3709:"5fb0aa51",3713:"b18f40c0",3775:"010eedb1",3850:"8b9eacc1",3870:"f6e1255d",3931:"2b38635b",4008:"1d820ac6",4050:"3352a21f",4053:"92ed0cbf",4077:"921da172",4179:"ab830b92",4213:"27ec97a3",4233:"a2b93c3a",4278:"ef6ce06d",4373:"eacb47ff",4450:"57b44454",4469:"7f8a356d",4480:"546bdb9a",4507:"934e9f4c",4514:"aa71f709",4577:"2c32c100",4594:"ca399add",4599:"11653462",4625:"4cf2e415",4640:"e05d126a",4690:"174cc3bf",4692:"9bc44158",4700:"5eb65f11",4712:"c688902b",4768:"97af9a3e",4822:"e1132b00",4839:"fca5e363",4886:"6f141d43",4911:"a4d48e61",4985:"c44a5b35",4995:"338b64d9",4997:"30943bfd",5032:"0f0c2e9e",5048:"b2987995",5071:"a75cc24e",5073:"df304c58",5091:"4d64fe70",5109:"93ebf6e1",5129:"7a7b4b0d",5140:"066d851d",5250:"bcfe7f12",5255:"b3f35163",5272:"1f829b5e",5280:"f2f2094c",5336:"5ce11ed9",5341:"8fb2ffea",5360:"72a427b3",5363:"56f2b0c6",5370:"357f20a9",5371:"ad7e4376",5466:"d6f63b00",5496:"e3661ab2",5542:"4d478ee4",5552:"e27a30e8",5635:"d1067852",5709:"4009ac77",5756:"a6c4ed74",5820:"67ed5e14",5832:"3bc219ec",5851:"63a77b62",5875:"49a92887",5886:"f8f225ac",5998:"55d44c10",6028:"d63f844b",6060:"1b1eee5e",6127:"4a3643e7",6140:"236f6b2e",6141:"6cc4cf7a",6143:"22021e31",6158:"dd8bbfeb",6164:"15372202",6209:"b0272dca",6291:"6711afe8",6300:"2bfae4de",6457:"c62d7f7c",6468:"27971726",6474:"2785e21a",6505:"9ea8689d",6508:"ebf7369b",6512:"6407abb7",6537:"17139236",6593:"9cfe4cc6",6594:"89d10a13",6617:"a7397367",6618:"3c8d9a18",6644:"22820bcb",6651:"c7fb68d8",6687:"db7e3fd2",6690:"8796e623",6862:"99d3ca33",7086:"6496ecc8",7150:"aec6ee96",7156:"beffa4c6",7159:"eb1704c0",7228:"42ad4eab",7238:"5dd58d1c",7262:"7017c395",7334:"9b1d3f80",7336:"1c420d1d",7339:"09bafa26",7355:"fb10faaf",7394:"72451d75",7425:"57c4248f",7445:"735d0569",7486:"ea615551",7497:"5015016c",7573:"3f4a2944",7609:"437cc37c",7622:"02d6ef5b",7641:"4612ab74",7684:"cbfba0ab",7704:"54d266d7",7754:"89588721",7760:"ed00ad56",7761:"ac364c7b",7786:"f7e5a795",7810:"c955ff7d",7832:"88c5790d",7918:"17896441",7920:"1a4e3797",7993:"f59b56a8",8053:"351c4745",8065:"008bb2ac",8145:"14b6b4b0",8244:"61556d62",8272:"612d74b3",8305:"ef45af3d",8338:"15d99295",8480:"d5d9b552",8534:"85b70f9f",8601:"b342ea0c",8623:"9f4b432b",8634:"6a0d6083",8716:"36363056",8766:"03013c26",8785:"6b7af4fc",8796:"6b92a77b",8802:"34179c72",8885:"41c96264",8893:"700d2df6",8914:"85efd854",8926:"f1347c03",9005:"dc43ceaf",9011:"b9793319",9020:"43d8caec",9053:"f2fc7a53",9106:"7ba726e1",9145:"ac1a52a9",9178:"3583f1cc",9234:"4c197666",9294:"882902b6",9296:"f3e8b01b",9299:"79aef7ac",9302:"91d2d959",9328:"99cc6920",9369:"e233ee0e",9407:"c818a061",9409:"e11cc8a5",9459:"1b288cf4",9514:"1be78505",9531:"5046913c",9578:"edf0ab12",9655:"e0f9f1f4",9657:"3287d67a",9702:"899b456c",9766:"7f4eb034",9797:"ca63cf85",9859:"51e07670",9900:"34b3ce2d",9917:"e5f3ce77",9931:"08972f5c",9962:"5f7ad2e3"}[e]||e)+"."+{3:"0e30b5ea",15:"64bf41b9",39:"9355257b",49:"7eac9e08",53:"4907daa6",107:"966d4023",114:"f448d030",118:"5f865e03",162:"a5060607",229:"1b7c13fe",273:"a504f1c8",320:"77eae4ac",393:"807ba50a",425:"9a2a9372",444:"7bec6c54",490:"c116904a",648:"1f7f93b5",660:"75ad2023",677:"668407ca",770:"a84ed23a",831:"3c67273c",845:"d4194e93",952:"1c4d5c50",960:"1717a4d5",1030:"ad84dde0",1070:"b749f3cb",1169:"53db818a",1180:"ff5f4488",1189:"20594b2b",1281:"4cefe90e",1297:"a23d1e69",1327:"540bd680",1343:"00d0bdf9",1368:"23e17756",1382:"6c2a2c25",1409:"8a750fb2",1421:"63625bcb",1429:"228ed73b",1431:"26022825",1495:"2fd9c54a",1496:"d5fd0c49",1500:"b549dce9",1501:"b8cc4263",1506:"cfa23d4f",1514:"e412cf10",1571:"45253efc",1589:"6c87764b",1674:"d13a24d9",1707:"6f642fa5",1716:"9f1925d1",1728:"bc3afb47",1806:"5d95df8b",1978:"e2746c43",1993:"5906f5bb",2002:"f1fceef8",2105:"9d6ff0d0",2117:"3773bc5c",2135:"226cf674",2139:"7bb45cb2",2214:"5c86c1bf",2260:"7b35b9a7",2277:"508da155",2296:"936eb6a3",2345:"fe411c2f",2357:"2f81519f",2362:"2ce6c11a",2412:"d64845d7",2429:"8c3ad9bb",2467:"f9b7ccf9",2469:"f309fe80",2481:"625454aa",2527:"4acc56a8",2544:"be9d0766",2561:"ede0cf37",2579:"8a723e44",2605:"d607efe9",2611:"ccbefe74",2630:"40fa9f6c",2643:"d157c268",2652:"0bf90ce0",2671:"87dad0b3",2749:"2865b71a",2793:"2c34091c",2899:"05536828",2948:"57a5bc1a",3032:"7d9cb536",3041:"3d8294e0",3098:"3ef00050",3105:"e82a49fe",3154:"08ce025c",3206:"cfd39d37",3218:"1902dff6",3233:"9acc5f7c",3234:"f5daf9bc",3237:"b42e492d",3239:"87310da0",3251:"06bcf5a3",3297:"55e908f9",3357:"507e07d4",3358:"6a02fb47",3442:"d2ce49ce",3464:"ff5b7142",3482:"2f0199ec",3485:"78f414f5",3538:"542b869f",3598:"ad431031",3663:"079e458b",3666:"42c0b603",3709:"fedc3ad4",3713:"ee3f556b",3775:"16e7eb3c",3850:"b2148e8b",3870:"926581d7",3893:"81ef05c9",3931:"4a9dbb34",4008:"dcd93d58",4050:"4b1ee331",4053:"65cbd581",4077:"6fbb109c",4178:"2b265306",4179:"26ebef5b",4213:"11e09067",4233:"6dbaa0a3",4278:"0d37f2f2",4373:"5a4ea165",4450:"2e757ec0",4469:"e08744c6",4480:"109ac07e",4507:"82a2a8fe",4514:"dd89a725",4577:"c4f28f56",4594:"559afcfa",4599:"56d6540e",4625:"61af5777",4640:"4d8f972c",4670:"275fd1d9",4690:"cd8d0986",4692:"47bdeca3",4700:"9b5c2303",4712:"293c3be4",4768:"2a643e6e",4822:"7f1ac97a",4839:"12e701e8",4886:"5fcabf8d",4911:"357e6480",4985:"ffda2e25",4995:"8a72abe6",4997:"4a4d1e70",5032:"47f7355a",5048:"e1fb0571",5071:"9f39bc17",5073:"259076bc",5091:"55ffdd1e",5109:"24a0cd97",5129:"23060478",5140:"05d25fd2",5250:"9dc21d2a",5255:"44fb7b76",5272:"2fdd0e4b",5280:"29ecbd42",5336:"bc202e97",5341:"c4fa604e",5360:"c3d3d89d",5363:"ca2a10b1",5370:"1927d9f2",5371:"07c07dd1",5466:"07f97e81",5496:"199d6297",5542:"ed2fdb35",5552:"ab729125",5635:"a7584424",5709:"1b52d52c",5756:"d2dbc037",5820:"6790e347",5832:"d0590810",5851:"7992a01d",5875:"8f3bf6ab",5886:"2267a4e1",5998:"f12aa602",6028:"9f023677",6060:"189c0a28",6127:"4b474de6",6140:"cfe9bb7e",6141:"950d3b52",6143:"7dc463f3",6158:"e32ddf06",6164:"e97f7461",6209:"99845c7a",6291:"232e3e5e",6300:"43f5f295",6457:"0b7ba517",6468:"4ae51102",6474:"dad615c3",6505:"76fc9b20",6508:"bf93e01f",6512:"b6fb693e",6537:"c59e42e1",6593:"afe857e0",6594:"fadb8f7d",6617:"2f40d288",6618:"158c036d",6644:"1f65b4f3",6651:"90819256",6687:"6f9a7b76",6690:"20763866",6862:"d97ad59a",7086:"327c78ba",7150:"b2b87a39",7156:"da7907b7",7159:"2586613e",7171:"7ab7832b",7228:"5a9c16ce",7238:"a1b06d6e",7262:"d785f5d1",7334:"4827b4af",7336:"ba8ab86f",7339:"bb6b699a",7355:"184113a6",7394:"45e40fb2",7425:"60304d87",7445:"40c9c906",7486:"d07f1da6",7497:"0761b550",7573:"40a74b03",7609:"fc0944e7",7622:"b419d04d",7641:"279acea7",7684:"a648d417",7704:"bfd982ff",7735:"117b16ff",7754:"de534c4f",7760:"9dc73485",7761:"c522d82c",7786:"b0a868ea",7810:"cc871d79",7832:"cf68bd90",7918:"229a9328",7920:"faee987e",7993:"73a00cf9",8053:"20e3a2b0",8065:"09d9d62f",8145:"5c2455e8",8244:"9eea0422",8272:"3f0e0d42",8305:"5208b092",8338:"4c89fccd",8480:"a18ef33b",8534:"70ddef32",8601:"dc1c870a",8623:"ffaa4a1c",8634:"6bd16d8c",8716:"bbabcb33",8766:"6a995f54",8785:"172dec19",8796:"a0205e6c",8802:"41e9780c",8885:"2d96b2a7",8893:"599de86f",8914:"776da408",8926:"52c9d49c",9005:"79ba45ed",9011:"06926893",9020:"91f72ecc",9053:"bc80516a",9106:"fc6afc24",9127:"686f7823",9145:"128b2dc8",9178:"06f598bf",9234:"c0b6c1f1",9294:"dfc1e14f",9296:"21494478",9299:"93777950",9302:"ec268ed1",9328:"85890420",9369:"1a410191",9407:"99258223",9409:"504a1032",9459:"af496d69",9514:"6dc27e27",9531:"d5497ef3",9578:"aa80eb25",9655:"e07c0041",9657:"a219c785",9702:"7a96d720",9766:"fd805cf5",9797:"0d30662c",9859:"6254db6a",9900:"d3f4fb14",9917:"14e8bbcc",9931:"00e50ba0",9962:"ad9915d5"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},f="website:",r.l=(e,a,c,b)=>{if(d[e])d[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var u=n[i];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==f+c){t=u;break}}t||(o=!0,(t=document.createElement("script")).charset="utf-8",t.timeout=120,r.nc&&t.setAttribute("nonce",r.nc),t.setAttribute("data-webpack",f+c),t.src=e),d[e]=[a];var l=(a,c)=>{t.onerror=t.onload=null,clearTimeout(s);var f=d[e];if(delete d[e],t.parentNode&&t.parentNode.removeChild(t),f&&f.forEach((e=>e(c))),a)return a(c)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/devicescript/",r.gca=function(e){return e={11653462:"4599",15372202:"6164",17139236:"6537",17896441:"7918",27971726:"6468",36363056:"8716",55133214:"960",68830679:"1495",89588721:"7754",96998115:"2527","03ded4e1":"3",e754dbb1:"15","6dde451c":"39","6a350437":"49","935f2afb":"53",b61553de:"107","298366da":"114","39409b5b":"118","204e02b7":"162","01d62032":"229",a7118a9a:"273","3dd53374":"320",d8c5d390:"393",d99e20a1:"425",a65110b7:"444","1ebf7e3d":"490","706ab872":"648","8442201f":"660",f468c751:"677","3851185d":"770","0fe4a880":"831","4c0cf505":"845","032aa2b9":"952","67482af5":"1030","7cbf7351":"1070","019132d2":"1169","4aae093d":"1180",d822119d:"1189","7c28bcf8":"1281",f4a210bc:"1297",a5466529:"1327","9421b549":"1343","88b58b9e":"1368","5b9becab":"1382","44d3e5f5":"1409",f995dfad:"1421","3731312d":"1429","3de927d0":"1431",bff3aaa3:"1496","4cf0c468":"1500",ffea0820:"1501",b9f2eef7:"1506",edce4ca7:"1514",ee7ced19:"1571",f70d59fe:"1589","9eb80747":"1674",dc277a3e:"1707","0cc1c4e6":"1716","8a8c4ba9":"1728","6d697ca4":"1806","79e87f40":"1978",eed45f36:"1993",f209bce9:"2002",ea5052e5:"2105",a1da537c:"2117","61debf69":"2135","4258b118":"2139","23719d77":"2214",ce847cce:"2260",a2547cfc:"2277",dc3dd087:"2296",fab9523c:"2345",c7480e04:"2357",d1201f8d:"2362","25856b02":"2412","0444f081":"2429",d7276684:"2467",b42ed10e:"2469","38e4c03d":"2481",c54ba89e:"2544","98f2cacc":"2561","255d1f03":"2579",cea52501:"2605",a1f85011:"2611",dc34691d:"2630","2188eaab":"2643","5943acca":"2652","3e4ca316":"2671",c3437d7e:"2749",aae462db:"2793","2ae8a91e":"2899","6c9194df":"2948","98876a2d":"3032",fcb40366:"3098",bf5a0007:"3105",afcacdd7:"3154",f8409a7e:"3206",de51976a:"3218",e6691913:"3233",bd082109:"3234","1df93b7f":"3237",bb0e3bff:"3239","7ec0e1a1":"3251",e0bded7f:"3297","1a1df4a0":"3357","87e2c537":"3358","9f50cf8a":"3442",aa027bd7:"3464","6ea5afa0":"3482",c2d38624:"3485","13738eeb":"3538","26effb06":"3598","0f58a8af":"3663",d3766067:"3666","5fb0aa51":"3709",b18f40c0:"3713","010eedb1":"3775","8b9eacc1":"3850",f6e1255d:"3870","2b38635b":"3931","1d820ac6":"4008","3352a21f":"4050","92ed0cbf":"4053","921da172":"4077",ab830b92:"4179","27ec97a3":"4213",a2b93c3a:"4233",ef6ce06d:"4278",eacb47ff:"4373","57b44454":"4450","7f8a356d":"4469","546bdb9a":"4480","934e9f4c":"4507",aa71f709:"4514","2c32c100":"4577",ca399add:"4594","4cf2e415":"4625",e05d126a:"4640","174cc3bf":"4690","9bc44158":"4692","5eb65f11":"4700",c688902b:"4712","97af9a3e":"4768",e1132b00:"4822",fca5e363:"4839","6f141d43":"4886",a4d48e61:"4911",c44a5b35:"4985","338b64d9":"4995","30943bfd":"4997","0f0c2e9e":"5032",b2987995:"5048",a75cc24e:"5071",df304c58:"5073","4d64fe70":"5091","93ebf6e1":"5109","7a7b4b0d":"5129","066d851d":"5140",bcfe7f12:"5250",b3f35163:"5255","1f829b5e":"5272",f2f2094c:"5280","5ce11ed9":"5336","8fb2ffea":"5341","72a427b3":"5360","56f2b0c6":"5363","357f20a9":"5370",ad7e4376:"5371",d6f63b00:"5466",e3661ab2:"5496","4d478ee4":"5542",e27a30e8:"5552",d1067852:"5635","4009ac77":"5709",a6c4ed74:"5756","67ed5e14":"5820","3bc219ec":"5832","63a77b62":"5851","49a92887":"5875",f8f225ac:"5886","55d44c10":"5998",d63f844b:"6028","1b1eee5e":"6060","4a3643e7":"6127","236f6b2e":"6140","6cc4cf7a":"6141","22021e31":"6143",dd8bbfeb:"6158",b0272dca:"6209","6711afe8":"6291","2bfae4de":"6300",c62d7f7c:"6457","2785e21a":"6474","9ea8689d":"6505",ebf7369b:"6508","6407abb7":"6512","9cfe4cc6":"6593","89d10a13":"6594",a7397367:"6617","3c8d9a18":"6618","22820bcb":"6644",c7fb68d8:"6651",db7e3fd2:"6687","8796e623":"6690","99d3ca33":"6862","6496ecc8":"7086",aec6ee96:"7150",beffa4c6:"7156",eb1704c0:"7159","42ad4eab":"7228","5dd58d1c":"7238","7017c395":"7262","9b1d3f80":"7334","1c420d1d":"7336","09bafa26":"7339",fb10faaf:"7355","72451d75":"7394","57c4248f":"7425","735d0569":"7445",ea615551:"7486","5015016c":"7497","3f4a2944":"7573","437cc37c":"7609","02d6ef5b":"7622","4612ab74":"7641",cbfba0ab:"7684","54d266d7":"7704",ed00ad56:"7760",ac364c7b:"7761",f7e5a795:"7786",c955ff7d:"7810","88c5790d":"7832","1a4e3797":"7920",f59b56a8:"7993","351c4745":"8053","008bb2ac":"8065","14b6b4b0":"8145","61556d62":"8244","612d74b3":"8272",ef45af3d:"8305","15d99295":"8338",d5d9b552:"8480","85b70f9f":"8534",b342ea0c:"8601","9f4b432b":"8623","6a0d6083":"8634","03013c26":"8766","6b7af4fc":"8785","6b92a77b":"8796","34179c72":"8802","41c96264":"8885","700d2df6":"8893","85efd854":"8914",f1347c03:"8926",dc43ceaf:"9005",b9793319:"9011","43d8caec":"9020",f2fc7a53:"9053","7ba726e1":"9106",ac1a52a9:"9145","3583f1cc":"9178","4c197666":"9234","882902b6":"9294",f3e8b01b:"9296","79aef7ac":"9299","91d2d959":"9302","99cc6920":"9328",e233ee0e:"9369",c818a061:"9407",e11cc8a5:"9409","1b288cf4":"9459","1be78505":"9514","5046913c":"9531",edf0ab12:"9578",e0f9f1f4:"9655","3287d67a":"9657","899b456c":"9702","7f4eb034":"9766",ca63cf85:"9797","51e07670":"9859","34b3ce2d":"9900",e5f3ce77:"9917","08972f5c":"9931","5f7ad2e3":"9962"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,c)=>{var d=r.o(e,a)?e[a]:void 0;if(0!==d)if(d)c.push(d[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var f=new Promise(((c,f)=>d=e[a]=[c,f]));c.push(d[2]=f);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(d=e[a])&&(e[a]=void 0),d)){var f=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+f+": "+b+")",t.name="ChunkLoadError",t.type=f,t.request=b,d[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var d,f,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(o)var i=o(r)}for(a&&a(c);n<b.length;n++)f=b[n],r.o(e,f)&&e[f]&&e[f][0](),e[f]=0;return r.O(i)},c=self.webpackChunkwebsite=self.webpackChunkwebsite||[];c.forEach(a.bind(null,0)),c.push=a.bind(null,c.push.bind(c))})()})(); \ No newline at end of file diff --git a/changelog.html b/changelog.html new file mode 100644 index 00000000000..3a49fbc339b --- /dev/null +++ b/changelog.html @@ -0,0 +1,20 @@ +<!doctype html> +<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-changelog"> +<head> +<meta charset="UTF-8"> +<meta name="generator" content="Docusaurus v2.4.1"> +<title data-rh="true">Release Notes | DeviceScript + + + + + + + + +
+

Release Notes

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

v2.15.5

15 September 2023

v2.15.4

12 September 2023

v2.15.3

11 September 2023

v2.15.2

11 September 2023

  • Number.isInteger implementation #608
  • pixelBuffer -> PixelBuffer.alloc #609
  • generate back link to device page in dsboard jsdocs 8b97b87
  • added devkicc + ssd1306 sample 64ecea6
  • rename event worker to avoid confusion with UART fc94f8a

v2.15.1

14 August 2023

v2.15.0

14 August 2023

  • Array sort #603
  • allow sending events from DS; fixes #373 #373
  • update add-board docs 7d4ae14

v2.14.16

11 August 2023

  • set prototype in JSON.parse; fixes #578 #578
  • fix #536: tree-shaking of devsNative protos #536
  • Add Buffer.rotate; see #596 d4d6bd1
  • document led hw support a7262f0
  • no led show on simulator 960c0d7

v2.14.15

11 August 2023

v2.14.14

5 August 2023

  • Document/implement LED operations #595
  • better connect dialog for remote scenario ba05db1
  • hide gateway by default 09ab30b
  • add info link to nvm c816704

v2.14.13

28 July 2023

v2.14.12

27 July 2023

  • Remote connect #589
  • typo in contributing file name f2656da

v2.14.11

27 July 2023

v2.14.10

26 July 2023

  • better handling of running init on an existing project f368b0f
  • detect yarn.lock/package.lock when initiaizing existing project a91f438
  • rename "add settings..." to "add device settings..." 5ae4072

v2.14.9

24 July 2023

  • support for LED driver + simulation #580
  • deprecated Math.clamp in favor of constrain 0e2ee13
  • fix gpiorelay sample 621c779
  • ask for npm/yarn when creating new project b0e34d6

v2.14.8

21 July 2023

  • use server id in twin message #576
  • updated jacdac-ts a87665f

v2.14.7

21 July 2023

  • traffic light server #574
  • gamepad client apis #573
  • more error handling on missing @devicescript/cli d6cf355
  • ensure that @devicescript/cli is locally installed a3b15cd
  • traffic light sample 2544de0

v2.14.6

21 July 2023

  • better error messages on missing node 941084f
  • updated pico_w samples 8368737
  • support for large frames over tcp 3cebccb

v2.14.5

20 July 2023

v2.14.4

20 July 2023

  • add UC8151 docs; fixes #543 #543
  • document other ST* drivers; fixes #552 #552
  • add devs init --yarn; fixes for devs add npm dd75d94
  • updated shield info 3fdb86d
  • more info on shields de363e8

v2.14.3

20 July 2023

  • Server to drivers, Display documentation #566
  • Indexed screen support #564
  • sample TSX UI #547
  • add st7709 05e8886
  • updated ssd1306 8140a77
  • reference help when inserting board configs 8cd1019

v2.14.2

16 July 2023

  • add command to upgrade tools #562
  • project init (create new project) with board #561

v2.14.1

16 July 2023

  • more docs on i2c issues #560
  • added encodeURIComponent function interface and tests #558
  • Implement es Set class #496 #556
  • Implement es Map class #497 #538
  • led strip encoder #557
  • Sample weather display #525 #555
  • Added findLastIndex #550
  • button led / potentiometer led samples #541
  • array findLast #549
  • added array fill #548
  • value dashboard rendering #540
  • Organize servers docs into drivers #546
  • reduce deps of cli (200M->38M) #531
  • support for typedoc ready projects #545
  • Support for JSX/TSX #542
  • added add-board docs 8644ddd
  • add docs on adding new SoCs 169f37b
  • updated admonitions 250328d

v2.14.0

5 July 2023

  • fix duplicate role tree node warning #539
  • add schemas for board defs 2ebe4e7
  • re-work pin names f094f29
  • add support for UC8151 e-ink display d4bdc0b

v2.13.10

1 July 2023

  • add support for ST7789 screen f9292ef
  • add support for ?? operator b03d062
  • allow comments in hex literals ef179c2

v2.13.9

1 July 2023

  • Fix typos in website API docs #522
  • Fixing spelling in getting started #521
  • added Array.at array package #520
  • added schedule blinky sample b142b1c
  • added doubleblinky sample 6a14ed9
  • less aggressive about showing the simulator pane fcffd49

v2.13.8

30 June 2023

v2.13.7

29 June 2023

v2.13.6

26 June 2023

  • Node v16 minimal support (v18 not required) #510
  • support for switchMap in observables #508
  • add thingspeak 4cf9b54
  • missing awaits 64668d0
  • add node.js diag 8bdd1c6

v2.13.5

25 June 2023

v2.13.3

23 June 2023

  • jd-c with startMotor(); fixes #461 #461
  • add additional array ctor, see #501 9b1c212
  • add Object and Array ctors; see #501 731c85d

v2.13.2

23 June 2023

  • more contrivuting to docs f191669
  • reorg contributions page 63ade1d
  • don't use GPIO0 as TX by default on pico e74b6c1

v2.13.1

23 June 2023

  • allow arbitrary config in configureHardware(); fixes #473 #473
  • add memory docs; fixes #397 #397
  • remove _ from role names; fixes #389 #389
  • add docs on services vs $services; fixes #459 #459
  • add docs for devs bundle; fixes #495 #495
  • add devkitM S3 b6782cb
  • use HKDF in encryptedFetch() 4ca8550
  • picture for devkitM 5ba81f0

v2.13.0

22 June 2023

v2.12.3

20 June 2023

  • allow hex encoding in Buffer.from(); 2.12.3 5c2a4d8

v2.12.2

20 June 2023

  • Node version detect #493
  • add readme linking to proper docs; fixes #476 #476
  • add @devicescript/crypto 4e07577
  • allow for arbitrary tag size in AES CCM ee8a688

v2.12.1

20 June 2023

v2.12.0

20 June 2023

  • native GPIO, SPI image send, and ST7735 screens support #490
  • fix port parsing #491
  • Misc word/grammar fixes to index.mdx #483
  • Dotmatrix over image implementation #480
  • ImageRenderingContext #478
  • math.map helper class #477
  • doc reorg ce12d80
  • docs update 5ad5a93
  • introduce common Display interface e6a6115

v2.11.6

10 June 2023

  • String.split support #463
  • character screen server #462
  • blynk HTTP support #475
  • added socket example, use same api as node #470
  • more runtime docs 55e8f99
  • use singleton for spi to match i2c fcae930
  • add devcontainer to project template 6bb6e9c

v2.11.5

9 June 2023

  • refactoring iot docs #469
  • remove professional from docs #467
  • fix #466 I2C bug; 2.11.5 #466
  • Fix SPI mention 919ce81

v2.11.4

9 June 2023

  • fix typo; thank you Benjamin_Dobell a59e8aa
  • handle syntactic difference of npm cb4533e

v2.11.3

9 June 2023

v2.11.2

9 June 2023

v2.11.1

8 June 2023

v2.11.0

8 June 2023

v2.10.10

8 June 2023

  • Minor Style fixes no section 5. #453
  • updated docs on custom packages 83f1bad
  • stabler serial connection 0d33b15
  • add github action file for npm package bec68be

v2.10.9

7 June 2023

  • disable auto-start when connected with vscode #451
  • updated error generation 611ab5c
  • keep GC heap around a7f9948
  • add special ds._panic(0xab04711) for low-level panic a53ea32

v2.10.8

7 June 2023

v2.10.7

7 June 2023

  • stop simulator when physical device connects 5911164

v2.10.6

7 June 2023

v2.10.5

6 June 2023

  • throttle outgoing packets (50/s) 6a3a631
  • tweak GC trigger heuristic f9ba2cf
  • simplify gc trigger logic 00b0b21

v2.10.4

6 June 2023

v2.10.3

6 June 2023

  • use python extension to resolve python path 0e85940
  • adding schedule function 98ed647
  • collect version number when reporting issue 354b272

v2.10.2

6 June 2023

  • add 'devs flash --clean ...' c94fb79
  • updated github build sample b4b9f00
  • unicode trim(); info on ASCII toLowerCase() f337581

v2.10.1

5 June 2023

  • auto install esptool on flash #437
  • sample using fetch #435
  • add option to add settings, tests in wand #436
  • tcp/tls sockets for wasm 73b688e
  • add observable timestamp operator 0f4bf61
  • more aggressive GC; 2.10.1 fbefb8d

v2.10.0

5 June 2023

  • 2.10.0: add net.Socket, net.fetch and more String/Buffer methods #433
  • Fix trivial typo in CLI docs #431
  • ROS #430
  • fix docs codegen for builtin packages 22c688d
  • fix new gcc warning: int foo() -> int foo(void) 615e1eb
  • remove it support in tests a8bb583

v2.9.16

1 June 2023

v2.9.15

1 June 2023

v2.9.14

1 June 2023

  • support for .env file #426
  • tsdoc attributes normalization #424
  • docs: fix broken HomeBridge hyperlink #422
  • Update index.mdx #417
  • Typo fix in CONTRIBUTING.md #416
  • Fix documentation typos #415
  • allow @ds-when-used attributes; fixes #332 #332
  • updated docs about status light ecb7c7b
  • Update issue templates 05fc469
  • Update issue templates 509ce4f

v2.9.13

25 May 2023

v2.9.12

18 May 2023

  • more led runtime d49250b
  • allow address setting on BME680; defl to 0x76 (Seeed) 6f5594a
  • updated gateway docs 2168e56

v2.9.11

17 May 2023

  • cleanup client commands 99bd7d8
  • support F shortcut in all videos f923ab9
  • support F key for full screen b23be3e

v2.9.10

15 May 2023

  • fix crash in role mgr; bump jd-c 3bb6e63
  • docs: statics supported 3ef6df2

v2.9.9

15 May 2023

v2.9.8

10 May 2023

v2.9.7

10 May 2023

v2.9.6

9 May 2023

v2.9.5

8 May 2023

  • adding some led options #383
  • generate server-info.json for DS drivers; fixes #381 #381
  • updated samples 76dcdda
  • search npm 5b0c360
  • handle deploying to a device that is managed by a gateway 6021672

v2.9.4

5 May 2023

v2.9.3

4 May 2023

v2.9.2

3 May 2023

v2.9.1

29 April 2023

  • refactor magic helpers #378
  • hardwareConfig -> configureHardware ? #375
  • fix name resolution of entry when uploading scripts to gateway fdb6f65
  • expose self-control service (eg for standby()) abae36b
  • add codesandbox info e16053e

v2.9.0

28 April 2023

  • support for static class members; fixes #337; 2.9.0 #337
  • filter out more commits from changelog cf5883f
  • store list of services in device meta 7ca544c

v2.8.3

28 April 2023

v2.8.2

28 April 2023

v2.8.1

27 April 2023

  • indicate what user program is run; also more debug logging 4d7617b
  • update jd-c/ts 7ccd32a
  • use correct APIs for frame reception when hosted 65b0c53

v2.8.0

27 April 2023

v2.7.11

27 April 2023

  • subscribeMessages -> subscribeMessage abf685d
  • better logic to generate device name 2c63788
  • optionaly try to publish to vscode marketplace 9aafc37

v2.7.10

27 April 2023

v2.7.9

26 April 2023

v2.7.7

26 April 2023

v2.7.4

26 April 2023

v2.7.3

26 April 2023

v2.7.2

26 April 2023

  • Environment support in vscode #371
  • restart program on sha-matching deploy; fixes #372 #372
  • add motion service; fixes #364 #364
  • use common names for common registers 714d920
  • don't compile .ts in docs 9479a86
  • accessbiilty fixes 7c4ea1b

v2.7.1

24 April 2023

  • i2c scan off by default; fixes #352 #352
  • add .toString() warning; fixes #345 #345
  • fix ctor arg refs; fixes #357 #357
  • Revert "only one copy of boards.json please" 7fd5b3e
  • only one copy of boards.json please a345712
  • update boards.json (fixing doc-gen) e8bdd0c

v2.7.0

21 April 2023

v2.6.2

19 April 2023

v2.6.1

19 April 2023

  • upgrade to docusaurus 2.4.0 #348
  • split clientcmds further 85580ea
  • more docs updates 561f4ec
  • add RotaryEncoder.asPotentiometer() 5075297

v2.6.0

18 April 2023

  • first draft of drivers package #346
  • add buffer decoding tests; fixes #40 #40
  • move code from clientcmds.ts to array.ts and i2c package f2eac1a
  • add ds.actionReport() for action responses 4c8cbad
  • add Role.report and utility functions around it d782aa8

v2.5.0

14 April 2023

v2.4.4

11 April 2023

v2.4.3

11 April 2023

  • implement assignment chaining; fixes #339 #339
  • add compiler-everything test; fix sources; fixes #268 #268
  • throttle setInterval() with async; fixes #289 #289
  • re-generate board files (new repo names) de6a906
  • add adafruit feather s2 4b9c909
  • limit call stack depth 7319b6f

v2.4.2

11 April 2023

v2.4.1

10 April 2023

v2.4.0

10 April 2023

  • allow Jacdac servers implemented in TS #335
  • updated samples 0a3244e
  • updated gateway docs c2b57b9
  • add sensor server; 2.4.0 7989afe

v2.3.4

4 April 2023

  • show watches in debug mode, cleanout context on unload 3e5a42b
  • handle "run" to open simulators view e56c704
  • add console data image 5d3cba1

v2.3.3

4 April 2023

v2.3.2

4 April 2023

v2.3.1

4 April 2023

v2.3.0

1 April 2023

v2.2.29

1 April 2023

v2.2.28

31 March 2023

v2.2.27

31 March 2023

  • attempt at fixing publshing a2db8e2

v2.2.26

31 March 2023

v2.2.24

31 March 2023

  • fix: package of depdencies in vscode extension 4a38ede
  • fix bump.js 916c820

v2.2.22

31 March 2023

  • fix: build vsix after patching resources 53ba99e
  • updated output channel name 0fd9cd3

v2.2.21

31 March 2023

  • fix: start devs when opening an entry point and not running 538ddf4
  • sort boards and hide protos in non-developer mode 3402616
  • Update README.md ba16684

v2.2.20

30 March 2023

v2.2.19

29 March 2023

  • sync subscribe in observables #298
  • gateway connection message 685aaa2

v2.2.18

29 March 2023

v2.2.16

29 March 2023

  • better handling of initial connection 5f2e2e3
  • clear token with api root 9f11372
  • duplicate copy button 89f52e6

v2.2.15

29 March 2023

v2.2.14

29 March 2023

  • introduce hash in dcfg; restart when it changes 63937b7
  • rename progName/Version fields to @name/@version 8f37511
  • debug fixes; 2.2.14 11eeea6

v2.2.13

28 March 2023

  • fix: add json5 #186
  • corrrectly display data 832aae0
  • save file to 'data', normalize time to seconds 0482692
  • ds.reboot()->ds.restart(); ds.reboot() now reboots e43fd0a

v2.2.12

28 March 2023

v2.2.11

28 March 2023

v2.2.10

27 March 2023

  • cheesy homepage 6da6dfa
  • fix: don't ask for workspace folder if only one 7d327ce

v2.2.8

27 March 2023

v2.2.6

27 March 2023

v2.2.5

27 March 2023

  • don't use activetexteditor #279
  • use observable streams instead #272
  • Configure hw #270
  • I2c package #267
  • I2c documentation #263
  • implement object inspection; fixes #275 #275
  • add startServer() wizard; fixes #258 #258
  • fix #277 (dbg crash) #277
  • add buzzer and dimmable light bulb 4e37c9a
  • catchError support 83d63a1
  • fix: start sim auto on debug if no debice connected 116ead5

v2.2.4

24 March 2023

v2.2.3

24 March 2023

v2.2.2

24 March 2023

v2.2.1

23 March 2023

v2.2.0

23 March 2023

  • Settings #251
  • don't run git commands if no .git folder 830bceb
  • use fiber suspend in setTimeout(); v2.2.0 ba3b780
  • implement debug pause button 4fbe25d

v2.1.0

23 March 2023

  • add Buffer.from(); also hex toString(); v2.1.0 1203283
  • simplify bump 0db3c27

v2.0.9

23 March 2023

  • add native clear-settings; fixes #240 #240
  • feat: pir, rolling average b12290c
  • fix: added emwa be56296
  • set version in npms, publish extension e6a398d

v2.0.8

22 March 2023

v2.0.7

22 March 2023

v2.0.6

22 March 2023

  • improve esptool detection 113a590
  • fix 'devs flash esp32 --board xyz' f8d05c0
  • generate meta files with sizes 4c9fa0b

v2.0.5

22 March 2023

v2.0.4

21 March 2023

  • add Module.clearFlash(); fixes #240 #240
  • re-generate boards.json; bump jd-c 807735a
  • fix no wifi build c632efc
  • add hid sample 2ace987

v2.0.3

21 March 2023

  • fix: beforeeach, aftereach in tests 8a49c33
  • try to fix npm 402 f1c9551
  • don't build C if tools not installed 8dbeeae

v2.0.2

21 March 2023

v2.0.1

21 March 2023

  • synchronized bump script #238
  • fix: replace * with ^version in packaged files #236
  • fix: ability to open socket streaming device logging #230
  • fix: update trackException #226
  • fix: cleaning out role.connected #195
  • feat: cloud api package #193
  • add marble rendering #190
  • cloud simplification #187
  • cleanup container experience #172
  • pass over doc #145
  • fix: use vscode built-in file system watcher #159
  • start building on load extension #157
  • fix: start build on start, update specs #155
  • feat: node.js simulation support #154
  • feat: add board command #152
  • flash device as palette command #146
  • feat: Custom service compilation #143
  • Catalog #144
  • feat: support --install flag in init #142
  • feat: no-colors mode #140
  • cloud tree items #135
  • fix: tree unsubscription #131
  • fix: nag user to start dashboard on debugger start + missing roles #123
  • trying to fix #120
  • fix: stop vm worker on debug session close #118
  • more aggressive about killing worker #114
  • fix: telemetry + windows #104
  • fix: better support for empty workspace, remote #102
  • Docusaurus2.3 #91
  • fix: update cli info about build --watch #90
  • support for cloud management of devices #88
  • contribute icons to vscode #87
  • actively check version numbers + debugger start fix #76
  • Device pick and remember #62
  • devtools cli refactor #61
  • Device Tree in VS Code #60
  • more tooling support through rise4fun #57
  • patch: document vm apis #52
  • patch: support for runtime_version #51
  • add runtime version reg #44
  • Api comments #50
  • patch: rename registernumber #49
  • patch: concurrent execution of compiles #42
  • Markdown docs: generate markdown files for DS services #38
  • test breaking build #37
  • patch: rename generate compiler files #30
  • fix: codesandbox support #29
  • patch: specify to embed built files in package #24
  • feat: support for init command #23
  • better control of simulator in docs #22
  • patch: add devtools options #21
  • patch: build --watch #20
  • add semantic release build files #19
  • Const samples #17
  • Removing monaco editor #14
  • show jacdac dasboard as split pane #13
  • cleaning up cli #12
  • export compile function #11
  • build compiler into web site #10
  • pre-compile samples in docs #5
  • support for mermaid for docs #3
  • creating docs web site #2
  • support ignored &&; fixes #184 #184
  • isConnected -> isBound; fixes #196 #196
  • better start server docs; fixes #215 #215
  • sleepMs->sleep; fixes #214 #214
  • fix pointer checks; fixes #203 #203
  • add ds.isSimulator(); fixes #119 #119
  • support for program name/version; fixes #170 #170
  • fix #199 (super call) #199
  • disallow 'var'; fixes #4 #4
  • remove _onstart; fixes #183 #183
  • fix 'extends Error'; fixes #176 #176
  • don't mask exception from compilation process #171
  • add --quiet option, fix #166 #166
  • cut down devs init, add devs add sim/service; fixes #165 #165
  • always use fancy logging; fixes #103 #103
  • rename devices, fix #77 #77
  • try to fix cli deps; fixes #70 #70
  • better error object (fixes #15) #15
  • remove junk; fixes #16 #16
  • moving projects around 2e25a9c
  • more docs updates 2b61362
  • refactor and hide pipe for now dd04b26
+ + + + \ No newline at end of file diff --git a/contributing.html b/contributing.html new file mode 100644 index 00000000000..a511bbed221 --- /dev/null +++ b/contributing.html @@ -0,0 +1,38 @@ + + + + + +Contributing | DeviceScript + + + + + + + + +
+

Contributing

Contributions are welcome!

Contributionut

Add Core JavaScript APIs

The DeviceScript core js library is not complete; but it is possible to fill the gaps +as needed. The requests are tracked by the core js issue label.

You will need a local development setup for these tasks.

If you want to add a new function:

  • find the corresponding function definition in one of the lib/es....d.ts file.
  • copy the definition in the corresponding interface in packages/core/src/corelib.d.ts
  • implement the function in the implementation file of the type (see packages/core/src/array.ts for example). +If you are adding a new file, make sure to import it in packages/core/src/index.ts.
  • add test cases in the corresponding test file under devs/run-tests
  • build and test
  • create a pull request and go!

If you want to add a new Type, we currently have a limitation with the core package and you will need to add it to the runtime package:s

  • implement the class in the implementation file of the type (see packages/runtime/src/map.ts for example). +If you are adding a new file, make sure to import it in packages/runtime/src/map.ts.
  • add test cases in the corresponding test file under packages/runtime/src/main.ts
  • build and test
  • create a pull request and go!

Samples

Documentation samples are located under website/docs/samples. +Each .mdx file contains a single self-contained sample.

It is typically easiest to develop a sample in a dedicate .ts file +to leverage the editor's features, and then copy it to the .mdx file.

To run the docs locally, run yarn docs. This will launch the docusaurus development server +and refresh the documentation page on each edit.

If your sample requires multiple files, such as images,

  • create a folder with the same name as the .mdx file
  • move your .mdx file and rename it to index.mdx
  • add a _category_.json file with the front matter
{
"label": "Samples",
"position": 3
}

Documenting/patching console output

To add new substitions from console output message to pretty text + URL, do the following.

The website/docs/developer/errors.mdx gets parsed by builderrors.mjs. +The hash of the H2 titles is the console log look up key (replacing - with spaces) and the H2 text will replace that key + URL.

loopback rx ovf --> Loopback buffer overflow (....#loopback-rx-ovf)

Adding Builtin Packages

Adding a new package is more advanced scenario and most likely we should have a discussion prior to start this work. You are welcome to publish packages under your account in npm.

A good question to start with: Do we need a new builtin package or should it be a new npm package?

Generally, search for @devicescript/gpio within the workspace. The main places that need updating is:

  • this file, website/docs/developer/packages.mdx
  • list in plugin/src/plugin.ts
  • list in devs/run-test/allcompile.ts

After adding a new packages, run yarn at the top-level to update workspace links, +followed by the usual yarn build.

Local development

The development requirement will vary (widely) depending +on which part of DeviceScript you want to work on.

Using Visual Studio Code is strongly recommended.

Repository structure

This repository contains:

  • jacdac-c submodule, including sources for Jacdac client libraries and DeviceScript VM
  • compiler/ - sources for DeviceScript compiler
  • runtime/devicescript-vm/ - glue files to build DeviceScript VM as WASM module using emscripten; vm/dist/ contain pre-built files
  • packages - builtin packages and sample project (packages/sampleprj)
  • runtime/posix/ - implementation of Jacdac SDK HAL for grown-up POSIX-like operating systems (as opposed to embedded platforms)
  • vscode - Visual Studio Code extension
  • website - docusaurus documentation side

Compiler, runtime and command line

You can use the devcontainer to build. The instructions are tested for a Unix terminal.

If you want to build locally you need to install node.js. After cloning, the repo run

yarn setup

To run a watch build and the docs, run

nvm use 18
yarn dev
  • start jacdac devtools (the npm version) and let it run
  • open this folder in VSCode; use "Reopen in Container" if needed
  • start Terminal in VSCode
  • run yarn install
  • run yarn build
  • run yarn devs run devs/samples/something.ts - this will execute given DeviceScript program using the WASM binary

If you want to develop the runtime (as opposed to compiler or website), you will also need +GNU Make, C compiler, and emscripten. +Once you have it all:

  • run make native to compile using native C compiler
  • run yarn devs crun devs/samples/something.ts - this will execute given DeviceScript program using the POSIX/native binary
  • run ./runtime/built/jdcli 8082 - this will run the POSIX/native DeviceScript server, which can be accessed from the devtools dashboard
  • run make em to compile using emscripten

Visual Studio Extension

Open the Debug view in VSCode and run the VSCode Extension configuration. This will launch a new VSCode instance with the extension loaded. A build is automatically triggered before launch VSCode.

Building packages

Similar to working on the Visual Studio Code extension, lunch the VSCode Extension debugger configuration. This will launch a new VSCode instance with the extension loaded. +It should also open the packages folder which will allow you to work on the built-in packages.

Documentation

Run yarn docs and edit any markdown file in the website/docs folder. The changes should be automatically picked up and rendered by docusaurus.

Release process

Run yarn bump (or make bump). Alternatively, edit img_version_patch in bytecode/bytecode.md and push.

The cloud build will rebuild and check-in the VM, update version numbers in all package.json files, and publish them.

If you bump minor, you need to also bump the firmware repos:

make bump

This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. +For more information see the Code of Conduct FAQ or +contact opencode@microsoft.com with any additional questions or comments.

+ + + + \ No newline at end of file diff --git a/developer.html b/developer.html new file mode 100644 index 00000000000..74bd8983e39 --- /dev/null +++ b/developer.html @@ -0,0 +1,23 @@ + + + + + +Developer | DeviceScript + + + + + + + + +
+

Developer

The DeviceScript developer experience is designed to be friendly with developers familiar with TypeScript projects. +DeviceScript uses the TypeScript syntax and the developer tooling does not require any special hardware

Visual Studio Code extension

Visual Studio and the DeviceScript Extension provide the best developer experience, with building, deploying, debugging, +tracing, device monitoring and other developer productivity features.

Command Line

The command line is IDE agnostic and will let you script your own developer experience.

tip

If you are developing the C firmware for DeviceScript, +you will need a more traditional embedded development setup.

+ + + + \ No newline at end of file diff --git a/developer/board-configuration.html b/developer/board-configuration.html new file mode 100644 index 00000000000..8ebbcff2dcc --- /dev/null +++ b/developer/board-configuration.html @@ -0,0 +1,32 @@ + + + + + +Board Configuration | DeviceScript + + + + + + + + +
+

Board Configuration

To target a specific hardware board or peripherical, +you need to configure the pins, I2C, SPI, etc... This is done by loading the +board configuration package for your specific hardware.

The inserted board configuration exposes a pins object that you can use to +configure drivers.

import { pins } from "@dsboard/adafruit_qt_py_c3"
tip

In Visual Studio Code, on the file menu, click on the wand icon and select the board configuration. +If your board is already connectd, DeviceScript will automatically detect it and +load the correct board configuration.

Once the board configuration is imported, you can use the pins export to reference named pins from the board

import { pins } from "@dsboard/adafruit_qt_py_c3"
import { startLightBulb } from "@devicescript/servers"

const lightBulb = startLightBulb({
pin: pins.A0_D0,
})

Available Boards

You can find the list of supported devices and configuration in +the devices catalog.

If your board system-on-chip (SoC) is supported (ESP32, RP2040, ...) but the pin configuration +is not yet available, you have 2 options: create a new board configuration file +or configure the board by code.

Configuration by Code

Some board configuration are generic and the I2C pins are not configured by default. +For example, the pico-w board configuration does not configure +the I2C pins and the code below configure them by code.

You can configure the board by code using the configureHardware function.

I2C

import { pins } from "@dsboard/pico_w"
import { configureHardware } from "@devicescript/servers"

configureHardware({
i2c: {
pinSDA: pins.GP4,
pinSCL: pins.GP5,
},
})

Configuration by file

This is a more advanced scenario where you want to fork an existing board configuration +and publish configuration for a different board.

Refer to the Add board documentation to learn +how to create a new board configuration file.

+ + + + \ No newline at end of file diff --git a/developer/bundle.html b/developer/bundle.html new file mode 100644 index 00000000000..ac32d65daa5 --- /dev/null +++ b/developer/bundle.html @@ -0,0 +1,27 @@ + + + + + +Bundled firmware | DeviceScript + + + + + + + + +
+

Bundled Firmware

A firmware image can be bundled together with a DeviceScript program and settings +into a single image that can be flashed at once +using the platform native tools.Ï

Let's assume you're developing for seeed_xiao_esp32c3 board. +Inside your project folder run using the CLI:

devs bundle --board seeed_xiao_esp32c3 src/main.ts

This will bundle the program from src/main.ts as well as any settings +in .env and .env.local files.

You should get something similar to the following:

...
deploy to ZX81
--> done, 4kb
fetch https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin
saved .devicescript/cache/devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin 1277952 bytes
writing 1875968 bytes to .devicescript/bin/bundle-devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin

The file .devicescript/bin/bundle-devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin can be now flashed +to the device. +You can do it using esptool or in case of Pico by just copying the .UF2 file. +Or use devs flash --file command:

devs flash --board seeed_xiao_esp32c3 --file .devicescript/bin/bundle-devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin
+ + + + \ No newline at end of file diff --git a/developer/clients.html b/developer/clients.html new file mode 100644 index 00000000000..d3b2fd4d72a --- /dev/null +++ b/developer/clients.html @@ -0,0 +1,26 @@ + + + + + +Clients | DeviceScript + + + + + + + + +
+

Clients

In DeviceScript, all access to sensors, actuators or other hardware components +are abstracted through services. +Sensors act as servers and your scripts connects clients to interact with them. +Servers are implemented by drivers, which may provide one or more services.

To interact with servers, you start clients, known as roles, for each service you need.

Let's illustrate these concept with a controller for a home heating system. +The heating system has a relay to turn on/off the furnace, a temperature sensor and +rotary encoder to change the desired temperature. +Therefore, we declare 3 roles.

import { Temperature, Relay } from "@devicescript/core"

const thermometer = new Temperature()
const thermometer2 = new Temperature()
const relay = new Relay()

Onboard servers

You can also start servers for onboard sensors and actuators. For example, the startBME680 function maps a BME680 sensor to 4 roles: temperature, humidity, pressure and air quality index.

import { startBME680 } from "@devicescript/drivers"

// mount services on a BME680
const { temperature, humidity, pressure, airQualityIndex } = await startBME680()
+ + + + \ No newline at end of file diff --git a/developer/commands.html b/developer/commands.html new file mode 100644 index 00000000000..8c5c10cb963 --- /dev/null +++ b/developer/commands.html @@ -0,0 +1,24 @@ + + + + + +Commands | DeviceScript + + + + + + + + +
+

Commands

Let's assume that 1400 hPa is a threshold high enough +to detect a user blowing on the sensor; then we +can add code to generate a mouse click.

1400 is rater arbitrary and this is the kind of constants +that you will want to tune using the actual hardware sensors, +not just a simulator.

if (pressure > 1400) {
await mouse.setButton(ds.HidMouseButton.Left, ds.HidMouseButtonEvent.Click)
}

The full sample looks like this.

console.log("starting...")
const sensor = new ds.AirPressure()
const mouse = new ds.HidMouse()
// listen for pressure changes
sensor.reading.subscribe(async pressure => {
console.log(pressure)
// user blows in straw
if (pressure > 1400) {
// click!
console.log(`click!`)
await mouse.setButton(
ds.HidMouseButton.Left,
ds.HidMouseButtonEvent.Click
)
// debouncing
await ds.sleep(50)
}
})

To get better debouncing, see observables.

+ + + + \ No newline at end of file diff --git a/developer/console.html b/developer/console.html new file mode 100644 index 00000000000..49303df0cfc --- /dev/null +++ b/developer/console.html @@ -0,0 +1,27 @@ + + + + + +Console output | DeviceScript + + + + + + + + +
+

Console output

DeviceScript supports basic console functionality which allows you to add logging to your script.

console.debug("debug")
console.log("log")
console.warn("warn")
console.error("error")

The console output will be visible in the DeviceScript terminal window.

Console data

console.data is a special purpose function to log sensor data. A timestamp (ds.millis()) is automatically added by the runtime.

const temp = 20
const humi = 60

console.data({ temp, humi })

In Visual Studio Code, you will find the data in the DeviceScript - Data +output pane or you can download it from the view menu.

console data icon

The following Visual Studio Code extensions are recommended for a best experience:

Format strings

The console.log() takes zero or more arguments of any type. +Template literals and string concatenation are also supported. +Compiler internally constructs a format string (see below).

let x = 0
let y = 4
console.log("Hello world")
console.log("X is", x, "and Y is", y)
console.log("X=", x, "Y=", y)
console.log(`X=${x} Y=${y}`)
console.log("X=" + x + " Y=" + y)

The compiler is smart about adding spaces (the second and third examples will print X is 7 and Y is 12 +and X=7 Y=12 respectively).

Concatenation and template literals can be also used to write registers.

const screen = new ds.CharacterScreen()
let x = 7
screen.message.write("X = " + x)
screen.message.write(`X is ${x}`)

You can also use the ds.format() function directly, either with console.log() or +when setting string registers. +Arguments are {0}, {1}, ..., {9}, {A}, {B}, ..., {F}. +A second digit can be supplied to specify precision (though this doesn't work so well yet):

const screen = new ds.CharacterScreen()
let x = 7,
y = 12

console.log(ds.format("X is {0} and Y is {1}", x, y))
console.log(ds.format("X = {04}", x))
screen.message.write(ds.format("X is {0}", x))
+ + + + \ No newline at end of file diff --git a/developer/crypto.html b/developer/crypto.html new file mode 100644 index 00000000000..8e7c3e7ff33 --- /dev/null +++ b/developer/crypto.html @@ -0,0 +1,24 @@ + + + + + +Cryptography | DeviceScript + + + + + + + + +
+

Cryptographic Primitives

The @devicescript/crypto provides functions to perform AES encryption and SHA256 digests.

Symmetric encryption

Let's start with simple encryption/decryption example:

import { decrypt, encrypt, randomBuffer, ivSize } from "@devicescript/crypto"
import { readSetting } from "@devicescript/settings"
import { assert } from "@devicescript/core"

// this is currently the only algorithm supported
const algo = "aes-256-ccm"
// get key from settings
const key = Buffer.from(await readSetting<string>("ENC_KEY"), "hex")
// you should never ever reuse IV; always generate them randomly!
const iv = randomBuffer(ivSize(algo))
// encrypt data
const encrypted = encrypt({
algo,
key,
iv,
data: Buffer.from("Hello world!"),
tagLength: 4,
})

// decryption takes the similar arguments
const plain = decrypt({
algo,
key,
iv,
data: encrypted,
tagLength: 4,
})

console.log(encrypted, plain)

assert(plain.toString("utf-8") === "Hello world!")

SHA256 digest and HMAC

The digest() function lets you compute cryptographically strong digests (hashes). +The only algorithm currently supported is sha256.

import { digest } from "@devicescript/crypto"

const hash = digest("sha256", Buffer.from("Hello world!"))
console.log(hash.toString("hex"))

You can pass more buffers to digest() - they will be concatenated.

You can also pass a key to the SHA256 function, to compute an HMAC (authenticated digest):

import { hmac } from "@devicescript/crypto"

const hash = hmac(Buffer.from("Secret!"), "sha256", Buffer.from("Hello world!"))
console.log(hash.toString("hex"))

Key-derivation function

In case you want to go with passwords, instead of binary 32 byte keys, +you can use the RFC 5869 HKDF. +The string "Req-1" describes the type of key you want to generate, +it can be anything.

import { sha256Hkdf } from "@devicescript/crypto"

const password = "SuPeRSecret!!"
const key = sha256Hkdf(password, "Req-1")
console.log(key.toString("hex"))

This gives the same result as the following in node.js:

import * as crypto from "node:crypto"
const password = "SuPeRSecret!!"
const key = Buffer.from(crypto.hkdfSync("sha256", password, "", "Req-1", 32))
console.log(key.toString("hex"))
+ + + + \ No newline at end of file diff --git a/developer/development-gateway.html b/developer/development-gateway.html new file mode 100644 index 00000000000..5d8ccfca314 --- /dev/null +++ b/developer/development-gateway.html @@ -0,0 +1,23 @@ + + + + + +Development Gateway | DeviceScript + + + + + + + + +
+

Development Gateway

The @devicescript/cloud builtin package provides a cloud agnostic device to cloud API +that allows to send and receive small JSON messages to an online gateway. +The gateway can route the messages into any further cloud service.

As a proof of concept, DeviceScript can be connected to the Development Gateway.

tip

This API is only supported on ESP32 devices currently.

Usage

Development Gateway

This package relies on a prototype Development Gateway that needs to be deployed prior to using it.

View in Visual Studio Code

The view is hidden by default and needs to be show once. Click on View, Open View... and selet +Development Gateway under DeviceScript.

+ + + + \ No newline at end of file diff --git a/developer/development-gateway/configuration.html b/developer/development-gateway/configuration.html new file mode 100644 index 00000000000..936e023ad38 --- /dev/null +++ b/developer/development-gateway/configuration.html @@ -0,0 +1,22 @@ + + + + + +Configuration | DeviceScript + + + + + + + + +
+

Configuration

This page provides information to configure the WiFi connection +on devices and other configuration options related to cloud applications.

WiFi Access Points

The ESP32-C3 firmware comes with a WiFi manager that allows you to configure the WiFi connection.

The Wifi manager supports multiple access point credentials.

  • Open the Visual Studio Code Extension view
  • Connect to your hardware device
  • Expand the WiFi tree node
  • Find the access point you want to connect to and click on the pen introduction to enter the password

MAC address

Some networking environment requires to register the device MAC address to allow the device to connect to the network. +The MAC address of the device is displayed in the WiFi tree node.

+ + + + \ No newline at end of file diff --git a/developer/development-gateway/environment.html b/developer/development-gateway/environment.html new file mode 100644 index 00000000000..d97950c0942 --- /dev/null +++ b/developer/development-gateway/environment.html @@ -0,0 +1,21 @@ + + + + + +Environment | DeviceScript + + + + + + + + +
+

Environment

An configuration object pushed from the cloud as an observable. The environment can be configured +through the gateway OpenAPI or the Visual Studio Code extension.

The environment is cached locally in the settings to handle offline scenarios.

import { environment } from "@devicescript/cloud"

const env = await environment<{ target: number }>()

value

Reads the current value of the environment.

import { environment } from "@devicescript/cloud"
const env = await environment<{ target: number }>()

const { target } = await env.read()

subscribe

Subscribes to updates to the environment values.

import { environment } from "@devicescript/cloud"
const env = await environment<{ target: number }>()

env.subscribe(async ({ target }) => {
console.log(target)
})
+ + + + \ No newline at end of file diff --git a/developer/development-gateway/gateway.html b/developer/development-gateway/gateway.html new file mode 100644 index 00000000000..b69adc4d675 --- /dev/null +++ b/developer/development-gateway/gateway.html @@ -0,0 +1,34 @@ + + + + + +Development Gateway | DeviceScript + + + + + + + + +
+

Development Gateway

DeviceScript defines a cloud layer +to abstract the communication between the device and a cloud provider.

In order to facilite rapid prototyping, +it is possible to run a Development Gateway locally +or deploy it to Azure on top of Azure services.

Features

  • Local or Azure deployement
  • Device provisioning, management: register, unregister, list, ...
  • Script management: create, update (versioned)
  • Script deployment: assign a script to a device and the gateway will deploy it
  • Analytics through Azure Monitor
  • JSON messages from and to devices
  • Per-device environment variables
  • Swagger API front end for non-embedded clients
  • Visual Studio Code extension
caution

The Development Gateway is a sample and not meant for production deployment.

Prerequisites

Follow these steps to get started with using the gateway.

The full sources of the Gateway is available in that repository.

  • install the dependencies and pull the submodules
npm run setup

Local developement

The Development Gateway can be run locally without any cloud resources. This is great for tinkering.

To get started,

  • launch Azurite, a local Azure storage emulator. Keep this terminal open.
npm run azurite
  • launch the local development server
npm run dev
  • open the swagger page, http://localhost:7071/swagger/ and make sure it loads
  • in Visual Studio Code, use the configuration string printed in the console.

Make sure to use the connection string for local network to connect to a device on the same local network. +Otherwise, you can also work on the simulator device using the local host connection string.

Device messages are pushed into the messages Azure Storage Queue as a base-64 encoded JSON string. +You can use any client library to access those messages.

Codesandbox.io

Running the local web server from CodeSandbox.io +allows you to run the Development Gateway in the cloud, which simplifies many connectivity issues with local networks.

The Development Gateway can be run in a browser using codesandbox.io.

  • open https://codesandbox.io/
  • click on Import repository
  • enter microsoft/devicescript-gateway or your forked repository.

MQTT

The gateway can also be used as an MQTT server or a bridge to an existing MQTT server.

  • publishMessage, subscribeMessage from "@devicescript/cloud" will automatically be bridge to the MQTT server under the topic devs/{deviceId}/(from|to)/{topic}.
  • You can override the devs/.../(from|to)/... routing scheme by starting your topic with /. For example, /mytopic will be routed to mytopic.

There are many options to run your own MQTT broker/server. Once you have a server, +you can configure the gateway using the DEVS_MQTT_URL and DEVS_MQTT_USER environment variables or secrets.

DEVS_MQTT_URL="mqtts://host:post"
DEVS_MQTT_USER="username:password"
tip

You can use the VSMqtt in Visual Studio Code to connect to the MQTT server +and publish, subscribe to topics.

Azure deployment (optional)

The Development Gateway can be deployed to Azure on top of Azure services:

  • App Service, runs a Node.JS web service with a swagger frontend
  • Key Vault, to store secrets needed by the Web Application
  • Storage, blobs and tables to manage devices, scripts and telemetry
  • App Insights, to collect telemetry about the health of devices
  • Event Hub to forward JSON messages from the device

NOTE:

  • Some Azure resources will incur costs to your Azure subscription.

The Development Gateway requires an Azure account and optionally a GitHub account.

Provisioning

NOTE:

  • The npm run provision script will create Azure resources that will incur costs to your Azure subscription. You can clean up those resources manually via the Azure portal or with the npm run unprovision command.
  • You can call npm run provision as many times as you like, it will delete the previous resources and create new ones.
  • open a terminal with the Azure CLI logged in and the default subscription configured
az login
  • You will need to generate a Github personal access token +for the forked repository, with actions, secrets scope as read+write.

  • launch the provisioning script

npm run provision

After the script is done executing, +it will take a couple minutes for the Github Actions to build the site and start it.

  • open the swagger page, https://WEBAPPNAME.azurewebsites.net/swagger/ and make sure it loads

You will be able to continue the configuration of the gateway through the VS Code extension, +DeviceScript view, Development Gateway section.

Empty view

Deployment

The repository can be configured to deploy the site on every build on the main brain, +using the build.yml GitHub Actions.

  • to enable, uncomment # AZURE_WEBAPP_PUBLISH: "true" in .github/workflows/build.yml

The project README.md file contains details for local development.

Cleanup

Use the Azure CLI to delete the resource group and all its associated resources.

npm run unprovision

Dashboards

Out of the box, the gateway will push telemetry metrics in an Application Insights instance and in an Event Hub.

  • You can use the built-in dashboarding capabilities of Application Insights to visualize metrics and explore logs.
  • You can build a dashboard of metrics in an Azure Hosted Grafana instance.

Visual Studio Code extension

Once the gateway is up and running, you can use the Visual Studio Code extension +to manage devices, scripts and work with the gateway.

+ + + + \ No newline at end of file diff --git a/developer/development-gateway/messages.html b/developer/development-gateway/messages.html new file mode 100644 index 00000000000..4fc282c29f7 --- /dev/null +++ b/developer/development-gateway/messages.html @@ -0,0 +1,25 @@ + + + + + +Messages | DeviceScript + + + + + + + + +
+

Messages

Publish Message

Publish a topic, payload pair to the gateway.

DeviceScript will stringify and upload your object as a JSON payload. The gateway add this messages +into an Azure Event Hub, additonal sinks can be configured online.

import { publishMessage } from "@devicescript/cloud"

await publishMessage("greetings", { msg: "hello" })

In the device gateway, this topic will be expanded to devs/{deviceid}/from/{topic}. +If you want to override this behavior, use /{topic} and the leading will be removed +the MQTT topic to be {topic}.

tip

Keep those field names very short as the payload needs to be small (< 236 bytes).

In the Visual Studio Code extension, you can upload a JSON +message from the device context menu.

Subscribe Message

Subscribes to able to receive messages from the gateway.

import { subscribeMessage } from "@devicescript/cloud"

subscribeMessage("greetings", async msg => {
console.log(msg)
})

Visual Studio Code extension

In the DeviceScript Gateway extension, you can connect to the device and +see the messages in the output window.

+ + + + \ No newline at end of file diff --git a/developer/development-gateway/telemetry.html b/developer/development-gateway/telemetry.html new file mode 100644 index 00000000000..f43d44d84c2 --- /dev/null +++ b/developer/development-gateway/telemetry.html @@ -0,0 +1,24 @@ + + + + + +Application Telemetry | DeviceScript + + + + + + + + +
+

Application Telemetry

You can collect usage telemetry of your DeviceScript using trackEvent or trackMetric

When connected to the gateway, the device is modelled as a user and the connection as a session. +The data is injected directly +in Application Insights +and can be analyzed through the Azure portal.

Exceptions

The trackException method uploads an exception to Application Insights. The stacktrace information is expanded in the gateway.

import { trackException } from "@devicescript/cloud"

try {
throw new Error("noes!")
} catch (e) {
await trackException(e as Error)
}

Events

The trackEvent method creates custom events in application insights. The event may be buffered or sampled +to reduce the network load.

import { trackEvent } from "@devicescript/cloud"

await trackEvent("started")

Metrics

The metric aggregates a numberical value and upload the aggregate when requested.

import { Temperature } from "@devicescript/core"
import { createMetric } from "@devicescript/cloud"

const thermo = new Temperature()
const temp = createMetric("temp")
thermo.reading.subscribe(async t => temp.add(t))
setInterval(async () => {
await temp.upload()
}, 30000)
+ + + + \ No newline at end of file diff --git a/developer/drivers.html b/developer/drivers.html new file mode 100644 index 00000000000..7d283dab270 --- /dev/null +++ b/developer/drivers.html @@ -0,0 +1,32 @@ + + + + + +Drivers | DeviceScript + + + + + + + + +
+

Drivers

In DeviceScript, any hardware component is accessed through a service client. +A driver implement one or more service servers for a given hardware peripherical.

The drivers builtin package exposes drivers for a number of periphericals.

Analog (builtin)

DeviceScript provides helper functions to mount a variety of servers out of the box +in the @devicescript/servers module.

For example, the startButton function allows your script +to mount a button server +over a pin and returns the client for it.

import { gpio } from "@devicescript/core"
import { startButton } from "@devicescript/servers"

const buttonA = startButton({
pin: gpio(2),
})
buttonA.up.subscribe(() => {
console.log("up!")
})

Once you've added this code to your script, you can interact with pin 2 +(hardware specific identifier) through the buttonA client. The variable name is +automatically used as the role and instance name.

Digital IO

Drivers can be implemented using digital IO +and are either built-in from C or authored in DeviceScript directly.

import { gpio, GPIOMode } from "@devicescript/core"
import "@devicescript/gpio"

const p0 = gpio(0)
await p0.setMode(GPIOMode.Output)
await p0.write(true)

I2C

Drivers can be implemented using I2C +and are either built-in from C or authored in DeviceScript directly.

import { i2c } from "@devicescript/i2c"

...
await i2c.writeReg(address, register, value)

SPI

Drivers can be implemented using SPI +and are either built-in from C or authored in DeviceScript directly.

import { spi } from "@devicescript/spi"

...
await spi.write(hex`abcd`)

What about missing drivers?

So the driver you need isn't here? There are a few options:

Jacdac modules

If you connect a Jacdac module, it will automatically run as a service server and +you will be able to bind a role to that module.

For example, the KittenBot KeyCap button will surface as a button server when connected.

A KittenBot KeyCap button

Serial, PWM

Serial, PWM are not supported yet at the DeviceScript level, +however specific PWM uses (such as servos, buzzers, light bulbs, motors) +are supported through @devicescript/servers.

+ + + + \ No newline at end of file diff --git a/developer/drivers/analog.html b/developer/drivers/analog.html new file mode 100644 index 00000000000..ada39a1475b --- /dev/null +++ b/developer/drivers/analog.html @@ -0,0 +1,38 @@ + + + + + +Analog | DeviceScript + + + + + + + + +
+

Analog

There is a number of functions that start a simple analog sensor server. +We'll use startPotentiometer() as an example, but you can use any of the following, +as they all use the same configuration.

In the simplest case, you just pass the pin to startPotentiometer(). +The voltage on the pin (typically between 0V (GND) and 3.3V (VCC)) will be translated to a number between 0 and 1.

import { gpio } from "@devicescript/core"
import { startPotentiometer } from "@devicescript/servers"

const slider = startPotentiometer({
pin: ds.gpio(3),
})
slider.reading.subscribe(v => console.data({ value: 100 * v }))

Scaling

There are two settings, offset and scale that let you modify the value read from the sensor. +The actual reported reading is (offset + (raw_reading * scale) / 1024) / 0xffff +clamped to 0 ... 1 range. +The range of raw_reading is 0 ... 0xffff. +The defaults are { offset: 0, scale: 1024 } so the raw_reading is just reported back.

For example, if you find you can never quite reach the 0 and 1 values, you can try the following:

import { gpio } from "@devicescript/core"
import { startPotentiometer } from "@devicescript/servers"

const slider = startPotentiometer({
pin: ds.gpio(3),
offset: 0x1000,
scale: 900,
})

Limiting power consumption

A potentiometer typically has 3 terminals, let's call them L, M, R. +You connect L to GND, R to VCC and M (middle) to the sensing pin. +The M terminal will then get a voltage proportional to the position of the knob.

However, the current (0.3mA with typical 10kOhm potentiometer) will always flow from L to R, +regardless if you measure it or not. +To improve power consumption, you may connect say R to a GPIO and configure the service like this:

import { gpio } from "@devicescript/core"
import { startPotentiometer } from "@devicescript/servers"

const slider = startPotentiometer({
pin: ds.gpio(3),
pinHigh: ds.gpio(7),
})

This tells the driver to set GPIO7 (pinHigh) to 1 (3.3V) before taking the measurement +from GPIO3 (pin). +After taking the measurement, pinHigh will be left floating, so no current will flow through the potentiometer.

You can also set pinLow (which is set to 0 before taking measurement) or both pinHigh and pinLow, +but typically one is enough.

Timings

The samplingItv settings defaults to 9 milliseconds and specifies how often to sample the sensor.

The streamingItv setting defaults to 100 milliseconds and specifies how often to stream values +on the Jacdac bus. +The client can override this through streaming_interval Jacdac register.

Additionally, you can set samplingDelay to a number of milliseconds to wait after setting pinHigh/pinLow +before taking the measurement +(default is 0, so effectively a few microseconds (not milliseconds)).

+ + + + \ No newline at end of file diff --git a/developer/drivers/custom-services.html b/developer/drivers/custom-services.html new file mode 100644 index 00000000000..1f59056ba55 --- /dev/null +++ b/developer/drivers/custom-services.html @@ -0,0 +1,25 @@ + + + + + +Custom Services | DeviceScript + + + + + + + + +
+

Custom Services

Custom service definition files can be added to the ./services/ folder as markdown file. +Read about the service specification markdown.

The service specifications are compiled by the DeviceScript compiler as part of the build.

Getting started

Let's define a custom service for a psychomagnothericenergy sensor (Ghostbuster ghost detector). +Start by configuring your project for simulation by running

devs add service psychomagnothericenergy

or in Visual Studio Code, using the DeviceScript: Add Service... in the command palette.

Then update ./services/psychomagnothericenergy.md with a basic sensor definition.

./services/psychomagnothericenergy.md
# Psychomagnotheric Energy

identifier: 0x1f1dc7d5
extends: _sensor

Measures the presence of ghosts in Ghostbusters.
...

DeviceScript support

The generated DeviceClient client are automatically added to the @devicescript/core module, +in ./node_module/@devicescript/core/src/devicescript-spec.d.ts.

./main.ts
import { PsychomagnothericEnergy } from "@devicescript/core"

const gigameter = new PsychomagnothericEnergy()
...

Node sim support

The ./sim/runtime.ts scafolding will automaticlly pick up +the generated files to support node.js. See simulation to configure your project for simulation.

  • The generated TypeScript constants are generated at ./.devicescript/ts/constants.ts.
  • The generated JSON are at ./.devicescript/services.json.
./sim/app.ts
import { SRV_PSYCHOMAGNOTHERIC_ENERGY } from "../.devicescript/ts/constants"

const server = new AnalogSensorServer(SRV_PSYCHOMAGNOTHERIC_ENERGY, {
...
})
...

Dashboard support

The DeviceScript simulators dashboard has a limited support for rendering custom services. +For sensors, it will be able to render sliders as long as min, max values are provided for the reading register.

Example

The aurascope is some kind of ghost detector in the Ghost Busters movie. Let's create a service for it.

Service specification

./services/psychomagnothericenergy.md
# Psychomagnotheric Energy

identifier: 0x1f1dc7d5
extends: _sensor

Measures the presence of ghosts in Ghostbusters.

## Registers

ro energy_level: u0.16 / @ reading

A measure of the presence of ghosts.

ro energy_level_error: u0.16 / @ reading_error

Error on the measure.

DeviceScript program

This DeviceScript program creates a client for the aurascope and prints the currently energly level to the console.

./main.ts
import { PsychomagnothericEnergy } from "@devicescript/core"

const gigameter = new PsychomagnothericEnergy()
gigameter.energyLevel.subscribe(async (energyLevel) => {
console.log(energyLevel)
})

Node simulator

The node.js simulator script mounts a aurascope simulator, with an interval that randomly changes the energy level value.

./sim/app.ts
import { addServer, AnalogSensorServer } from "jacdac-ts"
import { bus } from "./runtime"
import { SRV_PSYCHOMAGNOTHERIC_ENERGY } from "../.devicescript/ts/constants"

// simulator a customer service
const server = new AnalogSensorServer(SRV_PSYCHOMAGNOTHERIC_ENERGY, {
readingValues: [0.5],
readingError: [0.1],
streamingInterval: 500,
})
// randomly change the reading value
setInterval(() => {
const value = server.reading.values()[0]
const newValue = value + (0.5 - Math.random()) / 10
server.reading.setValues([newValue])
console.debug(`psycho value: ${newValue}`)
}, 100)

// mount server on bus to make it visible
// to DeviceScript
addServer(bus, "aurascope", server)
+ + + + \ No newline at end of file diff --git a/developer/drivers/digital-io.html b/developer/drivers/digital-io.html new file mode 100644 index 00000000000..5ddd5b862a0 --- /dev/null +++ b/developer/drivers/digital-io.html @@ -0,0 +1,31 @@ + + + + + +Digital IO (GPIO) | DeviceScript + + + + + + + + +
+

Digital IO (GPIO)

DeviceScript provides access to digital GPIO (General Purpose Input/Output) operations +on pins that do not require precise real time timings.

It is recommend to encapsulate the GPIO access into server implementation as they are rather low level.

caution

If your application needs consistent response times of under 10ms, you can either implement the driver +natively in C using interrupts, or better yet offload it to an external Jacdac module.

Pin mappings

While you can use hardware GPIO numbers with the ds.gpio() function, +it is highly recommended that you instead import a board definition file an use pin names +matching silk on the hardware.

import { pins } from "@dsboard/adafruit_qt_py_c3"

const A2 = pins.A2_D2

The doc-string for pins.A2_D2 will tell you GPIO number (1 in this case). +Using named pins is also less error-prone since pins used for internal +functions are not exposed through the pins object and the pins that are +exposed are annotated with type (input, output, analog, etc.) which is then +required by the startSomething() functions.

Pins generally share names for boards with the same pinout. +In particular, QT Py and XIAO share names.

The gpio() function does not check for pin functions or usage. +It will return undefined when named pin is not available or used for something else.

import { gpio } from "@devicescript/core"

const P0 = gpio(0)

Mode

The pin can be access through the generic gpio function or through board specific packages +that provide predefined pin mappings (see devices).

You can configure the input/output mode through setMode.

import { gpio, GPIOMode } from "@devicescript/core"
import "@devicescript/gpio"

// p0 -> output
const p0 = gpio(0)
await p0.setMode(GPIOMode.Output)

// P1 -> input
const p1 = gpio(1)
await p1.setMode(GPIOMode.Input)

Output

Use write to set the output value of a pin. This example flips a pin state every second.

import { gpio, GPIOMode } from "@devicescript/core"
import "@devicescript/gpio"

const p0 = gpio(0)
await p0.setMode(GPIOMode.Output)

let loop = 0
setInterval(async () => {
await p0.write(loop++ % 2)
}, 1000)

Input

Use value to read the input value of a pin. This example reads the input value every second.

import { gpio, GPIOMode } from "@devicescript/core"
import "@devicescript/gpio"

const p1 = gpio(1)
await p1.setMode(GPIOMode.Input)

// polling read pin
setInterval(async () => {
const v = p1.value
console.log({ poll: v })
}, 1000)

Use subscribe to run code whenever the pin changes state.

import { gpio, GPIOMode } from "@devicescript/core"
import "@devicescript/gpio"

const p1 = gpio(1)
await p1.setMode(GPIOMode.Input)

p1.subscribe(v => console.log({ sub: v }))
+ + + + \ No newline at end of file diff --git a/developer/drivers/digital-io/wire.html b/developer/drivers/digital-io/wire.html new file mode 100644 index 00000000000..b4b4317f658 --- /dev/null +++ b/developer/drivers/digital-io/wire.html @@ -0,0 +1,21 @@ + + + + + +Wire | DeviceScript + + + + + + + + +
+

Wire

digitalWrite, digitalRead, pinMode functions are provided for Arduino-like +digital IO.

pinMode

Sets the pin input/output and pull up/down mode.

import { gpio } from "@devicescript/core"
import { GPIOMode } from "@devicescript/core"
import { pinMode } from "@devicescript/gpio"

const pin = gpio(0)
pinMode(pin, GPIOMode.Output)

digitalWrite

For digital output, you can use digitalWrite function.

import { gpio } from "@devicescript/core"
import { HIGH, GPIOMode } from "@devicescript/core"
import { pinMode, digitalWrite } from "@devicescript/gpio"

const pin = gpio(0)
pinMode(pin, GPIOMode.Output)

digitalWrite(pin, true)
digitalWrite(pin, 1)
digitalWrite(pin, HIGH)

digitalRead

For digital input, you can use digitalRead function.

import { gpio } from "@devicescript/core"
import { GPIOMode } from "@devicescript/core"
import { pinMode, digitalRead } from "@devicescript/gpio"

const pin = gpio(0)
pinMode(pin, GPIOMode.Input)

const value = digitalRead(pin)

subscribeDigital

You can also subscribe to digital input changes.

import { gpio } from "@devicescript/core"
import { GPIOMode } from "@devicescript/core"
import { pinMode, subscribeDigital } from "@devicescript/gpio"

const pin = gpio(0)
pinMode(pin, GPIOMode.Input)

subscribeDigital(pin, value => console.data({ value }))
+ + + + \ No newline at end of file diff --git a/developer/drivers/i2c.html b/developer/drivers/i2c.html new file mode 100644 index 00000000000..612987475cc --- /dev/null +++ b/developer/drivers/i2c.html @@ -0,0 +1,22 @@ + + + + + +I2C | DeviceScript + + + + + + + + +
+

I2C

I2C builtin package that exposes +a I2C service to interact with I2C devices.

import { i2c } from "@devicescript/i2c"

const address = 0x..
const register = 0x..
const value = 0x..

await i2c.writeReg(address, register, value)

const readValue = await i2c.readReg(address, register)

Driver

The I2CDriver and I2CSensorDriver classes encapsulate storing the address and generally handles a bit of the +low-level I2C protocol. It is not required to use the driver, but it can be useful.

./aht20.ts
import { I2CSensorDriver } from "@devicescript/drivers"

const AHT20_ADDRESS = 0x38
const AHT20_BUSY = 0x80
const AHT20_OK = 0x08
const AHT20_READ_THROTTLE = 500

class AHT20Driver extends I2CSensorDriver<{
humidity: number
temperature: number
}> {
constructor() {
super(AHT20_ADDRESS, { readCacheTime: AHT20_READ_THROTTLE })
}

// ...

override async readData() {
await this.writeBuf(hex`AC3300`)
await this.waitBusy()
const data = await this.readBuf(6)

const h0 = (data[1] << 12) | (data[2] << 4) | (data[3] >> 4)
const humidity = h0 * (100 / 0x100000)
const t0 = ((data[3] & 0xf) << 16) | (data[4] << 8) | data[5]
const temperature = t0 * (200.0 / 0x100000) - 50

return { humidity, temperature }
}
}

You can find implementation examples at https://github.com/microsoft/devicescript/tree/main/packages/drivers/src.

+ + + + \ No newline at end of file diff --git a/developer/drivers/serial.html b/developer/drivers/serial.html new file mode 100644 index 00000000000..3e888f59e46 --- /dev/null +++ b/developer/drivers/serial.html @@ -0,0 +1,20 @@ + + + + + +Serial | DeviceScript + + + + + + + + + + + + + \ No newline at end of file diff --git a/developer/drivers/spi.html b/developer/drivers/spi.html new file mode 100644 index 00000000000..f7a6b849ebe --- /dev/null +++ b/developer/drivers/spi.html @@ -0,0 +1,20 @@ + + + + + +SPI | DeviceScript + + + + + + + + +
+

SPI

SPI builtin package that exposes functions to read, write, transfer buffers over SPI.

import { spi } from "@devicescript/spi"

await spi.configure({})

// write a few bytes
await spi.write(hex`abcd`)

// read 8 bytes
const resp = await spi.read(8)

// write and read a buffer
const resp2 = await spi.transfer(hex`abcd`)
caution

SPI is not yet implemented on RP2040.

See also

+ + + + \ No newline at end of file diff --git a/developer/errors.html b/developer/errors.html new file mode 100644 index 00000000000..a6df85e131e --- /dev/null +++ b/developer/errors.html @@ -0,0 +1,27 @@ + + + + + +Errors | DeviceScript + + + + + + + + +
+

Errors

loopback rx ovf

The program is issuing requests to service client faster than the system can handle.

can't connect, no HF2 nor JDUSB

On ESP32-C3, we do not support external serial chips. This is the list of known supported ESP32 boards.

esptool cannot connect

If the esptool complains about not being able to connect, try plugging your board in +while holding IO0/BOOT button.

I2C device not found or malfunctioning

There is a number of reasons why this error message will appear. A few common ones +are due to invalid configurations, aside from hardware issues with the sensor.

  • Check that the I2C pins have been configured. Read about board configuration.
  • The I2C address is incorrect. Check the datasheet for the correct address.
  • The I2C address is correct, but the sensor is not responding. Check the wiring and the sensor datasheet.

Unable to locate Node.JS v16+.

The Visual Studio Code extension was unable to determine the version of Node.JS. +This may mean that Node.JS is not installed or not in the path, +the local installation of modules is broken.

You can try to run npm update in the folder and try again.

npm update

Install @devicescript/cli package

The Visual Studio Code extension tries to locate the +CLI script, ./node_modules/.bins/devicescript, that gets installed by the package manager.

If this file is not present, it typically means that the CLI is not installed in the project +and needs to be added as devDependency.

  • click Install to install @devicescript/cli
  • try running npm update or yarn update to fix the installation

missing "devicescript" section

Importing a npm package designed for node.js or the browser is not yet supported. The reason is that it would most likely not work +as the DeviceScript runtime environment is radically different from the browser or even node.js.

Instead you should try to import packages specifically built for devicescript.

+ + + + \ No newline at end of file diff --git a/developer/graphics.html b/developer/graphics.html new file mode 100644 index 00000000000..e1b906dc6fd --- /dev/null +++ b/developer/graphics.html @@ -0,0 +1,24 @@ + + + + + +Graphics | DeviceScript + + + + + + + + +
+

Graphics

The @devicescript/graphics package provides an Image type and a Display type that supports +paletted graphics.

Progress bar image

The image can be used to author efficient driver for small screens +such as the SSD1306 OLED screen

import { Image } from "@devicescript/graphics"

const img = Image.alloc(128, 64, 1)

A display driver for a screen, such as the SSD1306, +exposes an image that represents the screen buffer. The driver typically +can be used as an indexed screen service which provides simulation support.

import { SSD1306Driver, startIndexedScreen } from "@devicescript/drivers"

const screen = await startIndexedScreen(
new SSD1306Driver({ width: 128, height: 64, devAddr: 0x3c })
)
screen.image.print(`Hello world!`, 3, 10)
await screen.show()
+ + + + \ No newline at end of file diff --git a/developer/graphics/display.html b/developer/graphics/display.html new file mode 100644 index 00000000000..6dfaf71f206 --- /dev/null +++ b/developer/graphics/display.html @@ -0,0 +1,25 @@ + + + + + +Display | DeviceScript + + + + + + + + +
+

Display

The Display +interface provides an abstraction over a small screen. The Display interface is implemented +for various hardware peripherical and can be used with various services.

I8080 not supported

The drivers use SPI or I2C. The parralel interface (I8080) is not supported at the moment.

Indexed screen

The startIndexedScreen returns a local client for the screen service. +Most importantly it wraps the native driver to enable simulation of the screen +on the simulated device (simulation does not work on hardware device as the communication channel is too slow).

import { SSD1306Driver, startIndexedScreen } from "@devicescript/drivers"

const display = await startIndexedScreen(
// implements Display
new SSD1306Driver({ width: 128, height: 64, devAddr: 0x3c })
)
display.image.print(`Hello world!`, 3, 10)
await display.show()

Character screen

The user sets a message on the character screen and it will be rendered on the screen. +Using the service is compatible with the simulator.

import { SSD1306Driver, startCharacterScreen } from "@devicescript/drivers"

const screen = await startCharacterScreen(
new SSD1306Driver({ width: 128, height: 64 })
)
await screen.message.write(`hello
world`)

Dot matrix

The screen emulates a dot matrix of monochrome LEDs.

import { SSD1306Driver, startDotMatrix } from "@devicescript/drivers"
import { img } from "@devicescript/graphics"

const dots = await startDotMatrix(
new SSD1306Driver({
width: 128,
height: 64,
devAddr: 0x3c,
}),
{
rows: 5,
columns: 5,
}
)
await dots.writeImage(img`# # . # #
# # . # #
. # # # .
. # # # .
# . # . .`)
+ + + + \ No newline at end of file diff --git a/developer/graphics/image.html b/developer/graphics/image.html new file mode 100644 index 00000000000..6629b437bd6 --- /dev/null +++ b/developer/graphics/image.html @@ -0,0 +1,22 @@ + + + + + +Image | DeviceScript + + + + + + + + +
+

Image

The Image represents a space-optimized pateletted image, with either 1 or 4 bit per pixels.

img

img is a template literal that allows defining images in form of ASCII Art. +The compiler will automatically generate an image, stored efficiently in flash memory. +This image is initially readonly; if you modify it, the runtime will internally allocate a buffer in RAM for it.

The image format is the grid of pixels with either . or the palette color index (# treated as 1).

import { img } from "@devicescript/graphics"

const i = img`
. . . 4 . . . . . .
. 2 2 2 2 2 . . . .
. 2 7 7 . 2 . . . .
. 2 7 7 . 2 . . . .
. 2 . . . 2 . . . .
. 2 2 2 2 2 . . . .
. . . . . . . . . .`
tip

You can use the MakeCode Arcade sprite editor to create images and copy them back to DeviceScript!

Rendering context

You can create a rendering context for an image; that provides a HTML canvas-like API (smaller subset).

import { Image } from "@devicescript/graphics"

const img = Image.alloc(128, 64, 1)
const ctx = img.allocContext()

ctx.fillText(":)", 0, 0)
+ + + + \ No newline at end of file diff --git a/developer/iot.html b/developer/iot.html new file mode 100644 index 00000000000..3d80e76766e --- /dev/null +++ b/developer/iot.html @@ -0,0 +1,20 @@ + + + + + +IoT | DeviceScript + + + + + + + + + + + + + \ No newline at end of file diff --git a/developer/iot/adafruit-io.html b/developer/iot/adafruit-io.html new file mode 100644 index 00000000000..c89d6eb737d --- /dev/null +++ b/developer/iot/adafruit-io.html @@ -0,0 +1,27 @@ + + + + + +Adafruit.io | DeviceScript + + + + + + + + +
+

Adafruit.io

In this sample, we upload temperature readings to Adafruit.io. +It is free for up to 30 data points per minute. This is a great way to get started with IoT.

Screenshot of temperature chart

tip

In this sample, we use the REST APIs to access the Adafruit cloud. +You can also use the MQTT APIs +with the MQTT client.

We'll assume you have Visual Studio Code installed and the DeviceScript extension installed.

To get started create a new project by using DeviceScript: Create New Project....

Hardware setup

We'll use the Qt Py and a SHTC3 from Adafruit for this sample.

Make sure to connect the SHTC3 to the QT Py using the Qwiic connector.

Firmware setup

The Qt Py firmware might need to be updated to the latest version.

  • connect the QT Py to your computer
  • Click on the plug icon in the DeviceScript explorer and select Flash firmware...
  • select Adafruit QT Py ESP32-C3 WiFi

Once the flashing is done (you may need to install esptool), re-connect to the device. If all goes well, it will appear in the device explorer.

Adafruit.io Configuration

Navigate to Adafruit.io and create an account. +Then create a new feed and name it temperature.

Make note of your user name and the access key. We'll need those shortly.

Settings configuration

Before writing the logic of the application, we want to configure the script +for the current hardware. We will need settings to store WiFi configuration, the Adafruit.io secret key, +the pin mapping for the Qt Py and the SHTC3 driver.

  • click on the wand icon in the file editor menu
  • select the Adafruit QT Py ESP32-C3 WiFi
  • select Sensirion SHTC3
  • click on the wand again
  • select Add Device Settings...

Edit .env.local and add your Adafruit.io secret key.

⚠️ .env.local should not be committed to source control.

# env.defaults
# public settings, commit to source control
WIFI_SSID=your-wifi-ssid
# env.local
# secrets, don't commit to source control
IO_KEY=your-secret-key
WIFI_PWD=your-wifi-password

Code

This annotated code sample schedules a task that reads a temperature sensor +and uploads the value to Adafruit.io every minute.

We use the REST API and the fetch method to send the data.

// hardware configuration and drivers
import { pins, board } from "@dsboard/adafruit_qt_py_c3"
import { startSHTC3 } from "@devicescript/drivers"
// extra APIs
import { readSetting } from "@devicescript/settings"
import { schedule } from "@devicescript/runtime"
import { fetch } from "@devicescript/net"

// mounting a temperature server for the SHTC3 sensor
const { temperature, humidity } = await startSHTC3()

// feed configuration
const user = "user"
const feed = "temperature"
// this secret is stored in the .env.local and uploaded to the device settings
const key = await readSetting("IO_KEY")

// Adafruit IO API https://io.adafruit.com/api/docs/#create-data
const url = `https://io.adafruit.com/api/v2/${user}/feeds/${feed}/data`
const headers = { "X-AIO-Key": key, "Content-Type": "application/json" }

console.log({ url })

// run after 1 second and then every minute
schedule(
async () => {
// read data from temperature sensor
const value = await temperature.reading.read()
// craft Adafruit.io payload
const body = { value }
// send request
const { status } = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
})
// print HTTP status
console.log({ value, status })
},
{ timeout: 1000, interval: 60000 }
)

More on Adafruit.IO

If you don't want to remember the REST API syntax, you can use some packages that wrap the Adafruit.io API.

import { pins, board } from "@dsboard/adafruit_qt_py_c3"
import { startSHTC3 } from "@devicescript/drivers"
import { schedule } from "@devicescript/runtime"
import { createData } from "devicescript-adafruit-io"

const { temperature, humidity } = await startSHTC3()

schedule(
async () => {
const value = await temperature.reading.read()
await createData(value)
},
{ timeout: 1000, interval: 60000 }
)
+ + + + \ No newline at end of file diff --git a/developer/iot/blues-io.html b/developer/iot/blues-io.html new file mode 100644 index 00000000000..dd2991579f2 --- /dev/null +++ b/developer/iot/blues-io.html @@ -0,0 +1,22 @@ + + + + + +Blues.io Notecard | DeviceScript + + + + + + + + +
+

Blues.io Notecard

The Blues.io Notecard provides +a simple way to add cellular connectivity to your IoT project.

The pelikhan/devicescript-note package uses I2C to communicate with the Notecard.

Getting started

  • Create a new DeviceScript project
  • Add the library to your DeviceScript project:
npm install --save pelikhan/devicescript-note

Configuration

  • Add device settings to your project
  • Add the notehub product UID into your settings. +By default, DeviceScript will use the deviceid as a serial number; but you can override this setting.
# .env.defaults
NOTE_PUID=your-product-uid
NOTE_SN=your-serial-number
  • Connect the notecard to your I2C pins and power it up.
import { Temperature } from "@devicescript/core"
import { delay, millis } from "@devicescript/core"
import { init, request, NoteAddRequest } from "devicescript-note"

// configure product UID and serial number
await init()

// connect sensors
const temperature = new Temperature()

while (true) {
// read sensor values
const t = await temperature.reading.read()

// send node.add request
await request(<NoteAddRequest>{
req: "note.add",
body: { t },
})

// take a break
await delay(10000)
}
+ + + + \ No newline at end of file diff --git a/developer/iot/blynk-io.html b/developer/iot/blynk-io.html new file mode 100644 index 00000000000..5361194f18a --- /dev/null +++ b/developer/iot/blynk-io.html @@ -0,0 +1,22 @@ + + + + + +Blynk.io | DeviceScript + + + + + + + + +
+

Blynk.io

Blynk.io provides an IoT dashboard for devices with virtual pins.

The pelikhan/devicescript-blynk +package uses the HTTPS REST API +to send data from devices.

Getting started

  • Create a new DeviceScript project
  • Add the library to your DeviceScript project:
npm install --save pelikhan/devicescript-blynk

Configuration

# .env.local
BLYNK_TOKEN=your-token

Uploading data

Use updateDatastream to update multiple virtual pins at once.

import { Temperature, Humidity } from "@devicescript/core"
import { delay, millis } from "@devicescript/core"
import { updateDatastream } from "devicescript-blynk"

// connect sensors
const temperature = new Temperature()
const humidity = new Humidity()

while (true) {
// read sensor values
const t = await temperature.reading.read()
const h = await humidity.reading.read()

// send blynk.io data
await updateDatastream({
v1: t,
v2: h,
})

// take a break
await delay(10000)
}
+ + + + \ No newline at end of file diff --git a/developer/iot/matlab-thingspeak.html b/developer/iot/matlab-thingspeak.html new file mode 100644 index 00000000000..f6b2e06098d --- /dev/null +++ b/developer/iot/matlab-thingspeak.html @@ -0,0 +1,22 @@ + + + + + +Matlab ThingSpeak | DeviceScript + + + + + + + + +
+

Matlab ThingSpeak

Matlab ThingSpeak is an IoT platform +that allows you to collect and store sensor data in the cloud and develop IoT applications +in Matlab.

writeData

ThingSpeak provides a HTTPS REST API to write data to a channel.

You can use settings to store your ThingSpeak API key and fetch to send data to ThingSpeak.

.env.local
TS_KEY=api_key
./src/main.ts
import { fetch, Response } from "@devicescript/net"
import { readSetting } from "@devicescript/settings"

/**
* Write data to ThingSpeak channel
* @param fields
* @param options
* @see {@link https://www.mathworks.com/help/thingspeak/writedata.html write data}
* @see {@link https://www.mathworks.com/help/thingspeak/error-codes.html error codes}
*/
export async function writeData(
// field values
fields?: Record<string, number>,
options?: {
// Latitude in degrees, specified as a value between -90 and 90.
lat?: number
// Longitude in degrees, specified as a value between -180 and 180.
long?: number
// Elevation in meters
elevation?: number
// Status update message.
status?: string
}
) {
const url = "https://api.thingspeak.com/update.json"
// the secret key should be in .env.local
const key = await readSetting("TS_KEY")

// construct payload
const payload: any = {}
// field values
Object.keys(fields).forEach(k => {
const v = fields[k]
if (v !== undefined && v !== null) payload[`field${k}`] = v
})
// additional options
if (options) Object.assign(payload, options)

// send request and return http response
let resp: Response
try {
resp = await fetch(url, {
method: "POST",
headers: {
THINGSPEAKAPIKEY: key,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
})
return resp.status
} finally {
await resp?.close()
}
}
+ + + + \ No newline at end of file diff --git a/developer/json.html b/developer/json.html new file mode 100644 index 00000000000..fbb56aa6540 --- /dev/null +++ b/developer/json.html @@ -0,0 +1,20 @@ + + + + + +JSON | DeviceScript + + + + + + + + +
+

JSON

It's worth mentioning that JSON serialization and parsing is fully supported in DeviceScript.

You can use the JSON object to parse and stringify JSON objects, just like in JavaScript.

JSON.parse

const msg = JSON.parse('{"hello": "world"}')
// destructure field 'hello'
const { hello } = msg

JSON.stringify

const json = JSON.stringify({ hello: "world" })
+ + + + \ No newline at end of file diff --git a/developer/jsx.html b/developer/jsx.html new file mode 100644 index 00000000000..3f46299b7b6 --- /dev/null +++ b/developer/jsx.html @@ -0,0 +1,27 @@ + + + + + +JSX/TSX | DeviceScript + + + + + + + + +
+

JSX/TSX

JSX is an embeddable XML-like syntax (.tsx for TypeScript files). +It is meant to be transformed into valid JavaScript, +though the semantics of that transformation are implementation-specific. +JSX rose to popularity with the React framework, +but has since seen other implementations as well. TypeScript supports embedding, type checking, and compiling JSX directly to JavaScript.

DeviceScript supports TSX compilation as documented in the TypeScript documentation.

Sample

The sampleui package is a sample UI framework based on a set of TSX functional components. +It is designed to be used with small OLED screens using the graphics package.

This snippet show a potential use of the JSX syntax to render a progress bar on a screen.

A progress bar screenshot

pot.reading.subscribe(async (pos: number) => {
await renderOnImage(
<HorizontalGauge
y={12}
width={image.width}
height={12}
value={pos}
showPercent={true}
/>,
image
)
await ssd.show()
})

If you are familiar with React developement, the implementation of HorizontalGauge will feel familiar.

export function HorizontalGauge(props: {
x?: number
y?: number
width: number
height: number
value: number
showPercent?: boolean
}): JSX.Element {
const { x, y, width, height, value, showPercent } = props
const w = Math.round((width - 4) * value)
const fc = value > 0.5 ? 0 : 1
return (
<Translate x={x} y={y}>
<Rect width={width} height={height}></Rect>
<FillRect x={2} y={2} width={w} height={height - 4} />
{!!showPercent && (
<Style fillColor={fc}>
<Text x={width / 2} y={2}>
{Math.round(value * 100) + "%"}
</Text>
</Style>
)}
</Translate>
)
}

Where are the UI frameworks?!!?!

We do not provide a fully fledge UI framework on top of the JSX compilation support. +The sample is very limited (no layout, no dom, no virtual DOM, ...). +If you feel up to the challenge, we recommend having a try at it!

+ + + + \ No newline at end of file diff --git a/developer/leds.html b/developer/leds.html new file mode 100644 index 00000000000..8d0ad5853e8 --- /dev/null +++ b/developer/leds.html @@ -0,0 +1,24 @@ + + + + + +LEDs | DeviceScript + + + + + + + + +
+

LEDs

Controlling strips of programmable LEDs can be done through the Led client.

This client requires to import the @devicescript/runtime to get all the functionalities.

import { Led } from "@devicescript/core"
import "@devicescript/runtime"

const led = new Led()

Driver

You can start a driver for WS2812 or AP102 using startLed.

import { LedVariant, LedStripLightType } from "@devicescript/core"
import { startLed } from "@devicescript/drivers"
import { pins } from "@dsboard/adafruit_qt_py_c3"
import { spi } from "@devicescript/spi"

const led = await startLed({
length: 32,
variant: LedVariant.Ring,
hwConfig: {
type: LedStripLightType.SK9822,
pinClk: pins.A1_D1,
pinData: pins.A0_D0,
spi: spi,
},
})

Simulation and long strips (> 64 LEDs)

For short LED strips, 64 LEDs or less, DeviceScript provides full simulation and device twin +for hardware and simulated devices.

For strips longer than 64 LEDs, the simulator device will work but the hardware device twin will +not work anymore. This is a simple limitation that the data overflows the packets used in Jacdac.

PixelBuffer and show

The Led client has a pixel buffer, a 1D vector of colors, +that can be used to perform color operations, and a show function to render the buffer to the hardware.

A typical LED program would then look like this:

import { LedStripLightType } from "@devicescript/core"
import { startLed } from "@devicescript/drivers"
import { fillSolid } from "@devicescript/runtime"
import { pins } from "@dsboard/adafruit_qt_py_c3"

const led = await startLed({
length: 32,
hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: pins.A0_D0 },
})

// retreive pixel buffer from led
const pixels = await led.buffer()
// do operations on pixels, like setting LEDs to green
fillSolid(pixels, 0x00ee00)
// send colors to hardware
await led.show()

showAll

A convenience function showAll is provided to set the color of all LEDs.

import { Led } from "@devicescript/core"
import "@devicescript/runtime"

const led = new Led()
await led.showAll(0x00ee00)

LED Display

You can mount a LED matrix as a display. +This can be helpful for matrix-shaped LEDs.

import { pins } from "@dsboard/esp32_c3fh4_rgb"
import { LedStripLightType, LedVariant } from "@devicescript/core"
import { startLed } from "@devicescript/drivers"
import { startLedDisplay } from "@devicescript/runtime"

const led = await startLed({
length: 25,
columns: 5,
variant: LedVariant.Matrix,
hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: pins.LEDS },
})

const display = await startLedDisplay(led)
+ + + + \ No newline at end of file diff --git a/developer/leds/display.html b/developer/leds/display.html new file mode 100644 index 00000000000..fbe2966cbf3 --- /dev/null +++ b/developer/leds/display.html @@ -0,0 +1,21 @@ + + + + + +Display | DeviceScript + + + + + + + + +
+

LED Display

You can wrap an LED matrix as a Display +and render graphics to it as if it was just another screen.

import { Led } from "@devicescript/core"
import { startLedDisplay } from "@devicescript/runtime"

const led = new Led()
const display = await startLedDisplay(led)
// render
display.image.print(`Hello world!`, 3, 10)
// and show
await display.show()

The palette is automatically infered from the waveLength register; otherwise you can provide one.

const display = await startLedDisplay(led, palette)
+ + + + \ No newline at end of file diff --git a/developer/leds/driver.html b/developer/leds/driver.html new file mode 100644 index 00000000000..17e799052cb --- /dev/null +++ b/developer/leds/driver.html @@ -0,0 +1,25 @@ + + + + + +LED Driver | DeviceScript + + + + + + + + +
+

LED Driver

You can start a driver for WS2812B, APA102, or SK9822 using startLed.

import { LedVariant, LedStripLightType } from "@devicescript/core"
import { startLed } from "@devicescript/drivers"
import { pins } from "@dsboard/adafruit_qt_py_c3"

const led = await startLed({
length: 32,
variant: LedVariant.Ring,
hwConfig: { type: LedStripLightType.WS2812B_GRB, pin: pins.A0_D0 },
})

Gamma correction

The Led supports Gamma correction, +but it is disabled by default. Gamma correction is applied before rendering the colors +to account for how our eyes sense the light created by LEDs.

const led = await startLed({
gamma: 2.8,
})

Topology

You can specify the topology of the LED strip by using the variant register. The default is a flexible strip +but other popular options like ring are also available.

import { LedVariant } from "@devicescript/core"

const led = await startLed({
variant: LedVariant.Ring,
})

For LED matrix with row major, you should also specify the number of columns.

import { LedVariant } from "@devicescript/core"

const led = await startLed({
length: 64 // 8x8
variant: LedVariant.Matrix,
columns: 8
})

To work on the LEDs as it if was an image, use the startLedDisplay helper.

Maximum power consumption

A large number of LED consuming maximum power can lead to an impressive surge of +power consumption. The LED driver allows to specify a maximum power (in watts) +and a LED power consumption model. Given those information

const led = await startLed({
maxPower: 5, // watts
})
+ + + + \ No newline at end of file diff --git a/developer/low-power.html b/developer/low-power.html new file mode 100644 index 00000000000..be1c0544567 --- /dev/null +++ b/developer/low-power.html @@ -0,0 +1,21 @@ + + + + + +Low Power | DeviceScript + + + + + + + + +
+

Low Power

Standby

The standby function attempt to put devices into lowest power sleep mode for a specified time, +most likely involving a full reset on wake-up.

import { standby } from "@devicescript/runtime"

console.log("going to sleep for 1 hour...")
// highlight_next_line
await standby(3600_000) // shut down for 1 hour

Use allow to save on battery power for long running operation where the device should mostly be idle in between sensor readings.

note

standby is available on ESP32 chip currently.

+ + + + \ No newline at end of file diff --git a/developer/mcu-temperature.html b/developer/mcu-temperature.html new file mode 100644 index 00000000000..d388e134443 --- /dev/null +++ b/developer/mcu-temperature.html @@ -0,0 +1,21 @@ + + + + + +MCU Temperature | DeviceScript + + + + + + + + +
+

MCU Temperature

Microcontrollers typically have a temperature sensor built in. This is a great way to monitor the temperature of the MCU itself. +The temperature sensor is not very accurate, but it is good enough to detect if the MCU is overheating.

The mcuTemperature function returns the temperature in degrees Celsius.

import { mcuTemperature } from "@devicescript/runtime"

setInterval(async () => {
const temp = await mcuTemperature()
console.log({ temp })
}, 1000)

The simulator temperature is alwasy 21 degrees Celsius.

+ + + + \ No newline at end of file diff --git a/developer/net.html b/developer/net.html new file mode 100644 index 00000000000..5653d22e217 --- /dev/null +++ b/developer/net.html @@ -0,0 +1,24 @@ + + + + + +Network and Sockets | DeviceScript + + + + + + + + +
+

Network

DeviceScript supports TCP, TLS, MQTT and HTTP/HTTPS sockets on specific devices.

Limitations
  • Only one socket can be open at a time. On most devices, a TLS will use a large part of the usable memory.
  • Sockets can be connect to server but not listen so it is not possible to implement a HTTP server currently.

fetch

DeviceScript provides the familiar fetch function to issue HTTP/HTTPS requests. +fetch is designed to match the browser Fetch API.

import { fetch } from "@devicescript/net"

const res = await fetch(`https://github.com/status.json`)
const body = await res.json()
console.log(`GitHub is ${body.status}`)
tip

The fetch sources +can help you with understanding how to use sockets.

encryptedFetch

The encryptedFetch function lets you +HTTP POST encrypted data and read encrypted responses using symmetric encryption +(AES-256-CCM).

MQTT client

The startMQTTClient function connects to a MQTT broker using TCP or TLS.

import { startMQTTClient } from "@devicescript/net"

const mqtt = await startMQTTClient({
host: "broker.hivemq.com",
proto: "tcp",
port: 1883,
})
await mqtt.publish("devs/log", "hello!")

TCP/TLS Sockets

The connect function to open a socket TCP or TLS socket.

This example issues is HTTPS request to the Github.com status API.

import { connect } from "@devicescript/net"

const socket = await connect({ proto: "tls", host: "github.com", port: 443 })
await socket.send(`GET /status.json HTTP/1.1
user-agent: DeviceScript fetch()
accept: */*
host: github.com
connection: close

`)
const status = await socket.readLine()
console.log(status)
await socket.close()
+ + + + \ No newline at end of file diff --git a/developer/net/encrypted-fetch.html b/developer/net/encrypted-fetch.html new file mode 100644 index 00000000000..df8ed29ca1a --- /dev/null +++ b/developer/net/encrypted-fetch.html @@ -0,0 +1,51 @@ + + + + + +Encrypted Fetch | DeviceScript + + + + + + + + +
+

Encrypted Fetch

The @devicescript/net package contains encryptedFetch() function which lets you +HTTP POST encrypted data and read encrypted responses. +The encryption uses aes-256-ccm.

Let's see how this works!

First, set up a main.ts file:

import { assert } from "@devicescript/core"
import { URL, encryptedFetch } from "@devicescript/net"
import { readSetting } from "@devicescript/settings"

async function sendReq(data: any) {
const url = new URL(await readSetting<string>("ENC_HTTP_URL"))
const password = url.hash.split("pass=")[1]
assert(
password !== "SecretPassword",
"Please change password in production!"
)
url.hash = ""
return await encryptedFetch({
data,
password,
url,
})
}
console.log(
await sendReq({
hello: "world",
})
)

Second, create a settings file with secrets.

./.env.local
# Local settings and secrets
# This file should **NOT** tracked by git
# Make sure to put the value below in "..."; otherwise the # gets treated as comment
ENC_HTTP_URL="http://localhost:8080/api/devs-enc-fetch/mydevice#pass=SecretPassword"

In production, you may want to use deviceIdentifier('self') as the user name, +provided you handle that server-side.

On the server side, you can run the code below. +Feel free to adopt to other languages or frameworks.

danger

Two devices should never share a key.

import express from "express"
import bodyParser from "body-parser"
import * as crypto from "node:crypto"
import { config } from "dotenv"

function getPasswordForDevice(deviceId: string): string | undefined {
// TODO look up device in database here!

config({ path: "./.env.local" })
const url = new URL(process.env["ENC_HTTP_URL"] + "")
if (url.pathname.replace(/.*\//, "") == deviceId) {
const pass = url.hash.split("pass=")[1]
if (pass !== "SecretPassword") return pass
}

return undefined
}

const TAG_BYTES = 8
const IV_BYTES = 13
const KEY_BYTES = 32

function aesCcmEncrypt(key: Buffer, iv: Buffer, plaintext: Buffer) {
if (key.length != KEY_BYTES || iv.length != IV_BYTES)
throw new Error("Invalid key/iv")

const cipher = crypto.createCipheriv("aes-256-ccm", key, iv, {
authTagLength: TAG_BYTES,
})
const b0 = cipher.update(plaintext)
const b1 = cipher.final()
const tag = cipher.getAuthTag()
return Buffer.concat([b0, b1, tag])
}

function aesCcmDecrypt(key: Buffer, iv: Buffer, msg: Buffer) {
if (
key.length != KEY_BYTES ||
iv.length != IV_BYTES ||
!Buffer.isBuffer(msg)
)
throw new Error("invalid key, iv or msg")

if (msg.length < TAG_BYTES) return null

const decipher = crypto.createDecipheriv("aes-256-ccm", key, iv, {
authTagLength: TAG_BYTES,
})

decipher.setAuthTag(msg.slice(msg.length - TAG_BYTES))

const b0 = decipher.update(msg.slice(0, msg.length - TAG_BYTES))
try {
decipher.final()
return b0
} catch {
return null
}
}

const app = express()
app.post(
"/api/devs-enc-fetch/:deviceId",
bodyParser.raw({ type: "application/x-devs-enc-fetch" }),
(req, res) => {
const { deviceId } = req.params
const pass = getPasswordForDevice(deviceId)
if (!pass) {
console.log(`No device ${deviceId}`)
res.sendStatus(404)
return
}

console.log(`Device connected ${deviceId}`)

const iv = Buffer.alloc(13) // zero IV
const salt = req.headers["x-devs-enc-fetch-salt"] + ""
const key = Buffer.from(crypto.hkdfSync("sha256", pass, salt, "", 32))

const body = aesCcmDecrypt(key, iv, req.body as Buffer)
if (!body) {
console.log(`Can't decrypt`)
res.sendStatus(400)
return
}
const obj = JSON.parse(body.toString("utf-8"))
console.log("Request body:", obj)

const rid = obj.$rid

const respKeyInfo = crypto.randomBytes(15).toString("base64")
res.header("x-devs-enc-fetch-info", respKeyInfo)
const respKey = Buffer.from(
crypto.hkdfSync("sha256", pass, salt, respKeyInfo, 32)
)

// TODO check for duplicate rid!

const resp = {
$rid: rid,
response: "Got it!",
}

const rbody = aesCcmEncrypt(
respKey,
iv,
Buffer.from(JSON.stringify(resp), "utf8")
)
res.end(rbody)
}
)

app.listen(8080)

Technical description

The encryptedFetch() function performs as HTTP request which uses content-type of application/x-devs-enc-fetch +and two special headers. +The x-devs-enc-fetch-algo header contains information about the request encryption algorithm +and can be safely ignored. +The x-devs-enc-fetch-salt contain a string salt value for HMAC key derivation function (HKDF) from RFC 5869.

The encryptedFetch() function also requires a password, which should be long-ish +random string (with about 256-bits of entropy). +The key for AES encryption is derived using HKDF based on the password and previously +generated salt; the info parameter is set to "". +This key is used for both encryption and authentication of the request.

The body of the request is a JSON object. +Before sending it out, encryptedFetch() extends it with a random request identifier (stored in $rid property). +The JSON object is converted to a buffer and +encrypted using AES-256-CCM and an 8-byte authentication tag is appended. +The initialization vector (IV) is all-zero.

This is send to the server, which decrypts the request accordingly.

danger

If applicable, the server should check if a request with a given $rid was already handled, +and if so, reject it. +Otherwise, someone can replay a client request.

If the server responds with with 2xx code, the response is assumed to be +a JSON object encrypted using a key derived using HKDF from the password, +the previously generated salt, and info parameter set to the value +of x-devs-enc-fetch-info in the response. +IV is all zero. +The response also has the 8-byte authentication tag.

If the response is not 2xx or if it cannot be authenticated an exception is thrown. +Otherwise, the JSON object of the response is returned.

Security

From the device standpoint, if the salt is unique, the device can be sure +only someone with the password can read the request or generate a response. +Response cannot be replayed, since the key for it incorporates the salt.

From the server standpoint, a man-in-the-middle attacker can intercept +a device request and either delay it or send it again at later time. +Thus, server should check for uniqueness of the $rid if this can be a problem. +The attacker will not be able to deduce anything about the contents of the response +even if the server doesn't ignore a duplicate request, since the info parameter +send from server is incorporated in the response key and it is random.

+ + + + \ No newline at end of file diff --git a/developer/net/mqtt.html b/developer/net/mqtt.html new file mode 100644 index 00000000000..f17013db1c4 --- /dev/null +++ b/developer/net/mqtt.html @@ -0,0 +1,24 @@ + + + + + +MQTT client | DeviceScript + + + + + + + + +
+

MQTT client

The startMQTTClient function connects to a MQTT broker using TCP or TLS.

import { startMQTTClient } from "@devicescript/net"

const mqtt = await startMQTTClient({
host: "broker.hivemq.com",
proto: "tcp",
port: 1883,
})
tip

You can use HiveMQ public broker for testing +with public data.

publish

The publish function sends a message on a topic.

import { startMQTTClient } from "@devicescript/net"

const mqtt = await startMQTTClient({
host: "broker.hivemq.com",
proto: "tcp",
port: 1883,
})
await mqtt.publish("devs/log", "hello")

deviceIdentifier

You can use deviceIdentifier to uniquely identify the device +in the topic

import { deviceIdentifier } from "@devicescript/core"
import { startMQTTClient } from "@devicescript/net"

const mqtt = await startMQTTClient({
host: "broker.hivemq.com",
proto: "tcp",
port: 1883,
})
const id = deviceIdentifier("self")
await mqtt.publish(`devs/log/${id}`, "hello")

subscribe

The subscribe function creates a subscription for a topic route. +The function takes a an optional handler an returns an observable.

import { startMQTTClient } from "@devicescript/net"
const mqtt = await startMQTTClient({
host: "broker.hivemq.com",
proto: "tcp",
port: 1883,
})

await mqtt.subscribe(`devs/log/#`, msg => {
console.log(msg.content.toString("utf-8"))
})

stop

The MQTT client will automatically retry to connect once it detects that connectivity is lost. +To close the current socket and stop the reconnect task, use stop.

Acknowledgements

The MQTT client is based on micro-mqtt.

+ + + + \ No newline at end of file diff --git a/developer/observables.html b/developer/observables.html new file mode 100644 index 00000000000..d4061cd18b2 --- /dev/null +++ b/developer/observables.html @@ -0,0 +1,26 @@ + + + + + +Observables | DeviceScript + + + + + + + + +
+

Observables

The @devicescript/observables builtin package provides a lightweight reactive observable framework, a limited subset of RxJS. +We highly recommend reviewing the RxJS documentation for deeper discussions about observables.

Motivation

Imagine a temperature sensor, it routinely senses the temperature and updates the temperature register. +The temperature register is an observable of sensor reading.

If you write code in DeviceScript to listen for this data, it will look like this:

import { Temperature } from "@devicescript/clients"

const thermometer = new Temperature()
const { temperature } = thermometer
temperature.subscribe(temp => console.log(temp))

In particular, the handler passed to subscribe will be called whenever a new temperature reading is received (even if it did not change). +The program would print something like this:

20
21
21
20

A better way to visualize streams of data and how observable handle them is to use a marble diagram. +The input stream (on top) arrives unchanged to the subscribe handler and is printed to the console.

output.svg

As you can see, there are 2 data readings with the same temperature and we would like to filter them out. Using the threshold operator, +which filters out small data changes, we get

import { Temperature } from "@devicescript/clients"
import { threshold } from "@devicescript/observables"

const thermometer = new Temperature()
const { temperature } = thermometer
temperature
.pipe(threshold(1))
.subscribe(temp => console.log(temp))
output.svg

Operators can be chained and combined to create complex data processing pipelines. Custom operators can also be defining by combining existing ones +or writing them from bare code.

See also

+ + + + \ No newline at end of file diff --git a/developer/packages.html b/developer/packages.html new file mode 100644 index 00000000000..c5d9900372d --- /dev/null +++ b/developer/packages.html @@ -0,0 +1,25 @@ + + + + + +Packages | DeviceScript + + + + + + + + +
+

Packages

DeviceScript supports packages published in npm or any other package manager compatible +with the package.json specification.

Currently, only TypeScript code can be published - in future we may add services.

Builtin Packages

The packages are dropped by the DeviceScript compiler whenever you run build. +They do not need to be npm installed.

NPM packages

npm install --save package-name

GitHub releases

npm install --save owner/repo#release

Custom packages

Users can create and package their own DeviceScript packages to share their code with others.

+ + + + \ No newline at end of file diff --git a/developer/packages/custom.html b/developer/packages/custom.html new file mode 100644 index 00000000000..dfb6502fd48 --- /dev/null +++ b/developer/packages/custom.html @@ -0,0 +1,29 @@ + + + + + +Custom Packages | DeviceScript + + + + + + + + +
+

Publishing a DeviceScript package

Using npm, GitHub releases, or other package manager is the recommended way to share your DeviceScript code. +The process is very similar to publishing packages for node.js/web on npm.

Here are some examples of custom packages:

TL;DR: Creating a new package

  • install command line tools: npm install -g @devicescript/cli
  • install yarn if you don't have it: npm install -g yarn
  • create folder for your package: mkdir devicescript-my-package (best if it starts with devicescript-)
  • in that folder run devs init --yarn and then devs add npm
  • run VS Code: code .
  • go to "Source Control" side panel, select "Publish to GitHub"

Now you can start building your library.

To publish to npm use yarn publish - it will ask you for version, tag the repo, and publish. +Don't forget to git push --tags.

Getting started

To create a DeviceScript library from your project, run this command +or use DeviceScript: Add npm... from the command palette in Visual Studio Code.

yarn devs add npm

This will:

  • remove the "private" field from package.json
  • add "devicescript": { "library": true } (this is required)
  • set "main": "src/index.ts" (src/index.ts is created if missing)
  • set "files" field
  • add "license"
  • add "keywords": ["devicescript"] - keep this so npm search works better!
  • add "author" and "repository" if they can be inferred

All of these can be of course edited in package.json afterwards.

Naming convention

In particular it's recommended to name your package devicescript-something.

Publishing

After this step, you can publish your package using your favorite npm publishing pipeline.

tip

A DeviceScript does not require any special build assets. +You can create a GitHub release and use as a dependency in your projects.

npm install --save user/repo@version

TypeDoc

The package templates also adds a script build:docs to generate an API documentation +site using TypeDoc. +The devicescript-pico-bricks is an example of this web site.

npm run build:docs

You can configure GitHub pages to use the generated site under ./docs.

Development notes

Note that regular DeviceScript applications typically use src/main.ts (or src/mainSomething.ts) +as the application entry point. +This is typically, not the right choice for library entry point.

You can keep your src/main.ts file as an example or test for the library, +but best to stick to "main": "src/index.ts" in package.json.

+ + + + \ No newline at end of file diff --git a/developer/register.html b/developer/register.html new file mode 100644 index 00000000000..c69b2695f11 --- /dev/null +++ b/developer/register.html @@ -0,0 +1,22 @@ + + + + + +Register | DeviceScript + + + + + + + + +
+

Register

The sensor client exposes pressure register object. +We can read the register value to retreive the air pressure +sensor last reading. The reading is in hPa and should be around 1000.

subscribe

const sensor = new ds.AirPressure()
sensor.reading.subscribe(async pressure => {
console.data({ pressure })
})

To apply filtering or thresholding on the changes, see observables.

unsubscribe

The subscribe method returns an unsubscribe callback.

const sensor = new ds.AirPressure()
const unsubscribe = sensor.reading.subscribe(async pressure =>
console.data({ pressure })
)

// cleanup
unsubscribe()

read

You can also read the sensor data using the read function.

const sensor = new ds.AirPressure()

const pressure = await sensor.reading.read()
+ + + + \ No newline at end of file diff --git a/developer/settings.html b/developer/settings.html new file mode 100644 index 00000000000..2284f7716e7 --- /dev/null +++ b/developer/settings.html @@ -0,0 +1,23 @@ + + + + + +Settings and Secrets | DeviceScript + + + + + + + + +
+

Settings

Settings builtin package provides a friendly layer to read/write objects from the device flash. Keep it small, there's not a lot of space!

tip

In Visual Studio Code, open the command palette and run DeviceScript: Add Device Settings....

.env files

Don't store secrets or settings in the code, use .env files instead.

  • ./.env.defaults: store general settings (tracked by version control)
  • ./.env.local: store secrets or override for general settings (untracked by version control)

The .env* file use a similar format to node.js .env file. The content will be transfered in the device flash +when deploying the DeviceScript bytecode.

caution

The setting keys should be shorter than 14 characters!

./.env.defaults
# Default settings
# This file is tracked by git.
# DO NOT store secrets in this file.
temperature=68
./.env.local
# Local settings and secrets
# This file is/should **NOT** tracked by git
temperature=70 # override
PASSWORD=secret
tip

In Visual Studio Code, open the command palette and run DeviceScript: Add Device Settings.... +From the CLI, run devs add settings.

Special Settings

Some settings entries are treaty specially and routed to other services:

  • WIFI_SSID: set the WiFi SSID to connect to
  • WIFI_PWD: set the WiFi password (skip or leave empty to connect to open WiFi)

Using settings

Once your .env files are ready, you can use readSetting and writeSetting to read/write settings.

import { Temperature, Button } from "@devicescript/core"
import { readSetting, writeSetting } from "@devicescript/settings"

const temperature = new Temperature()
const button = new Button()
let threshold = await readSetting<number>("temperature")

// show alert when temperature is above threshold
temperature.reading.subscribe(t => {
if (t > threshold) {
// too hot!
console.log("hot!")
}
})

// increase threshold when button is pressed
button.down.subscribe(async () => {
threshold++
await writeSetting("temperature", threshold)
})

Clearing

You can use the command DeviceScript: Clear Device Setings... to clear the settings +of the currently connected device.

See also

+ + + + \ No newline at end of file diff --git a/developer/simulation.html b/developer/simulation.html new file mode 100644 index 00000000000..65cd7929046 --- /dev/null +++ b/developer/simulation.html @@ -0,0 +1,23 @@ + + + + + +Simulation | DeviceScript + + + + + + + + +
+

Simulation

DeviceScript supports simulation through a web dashboard and a Node.JS project running in parallel on the developer machine.

Simulated DeviceScript Device

DeviceScript will start a simulated programmable microcontroller on demand. You can also start it from the connect dialog. +It runs a WASM-ed build of the C runtime.

A screenshot of starting the DeviceScript simulator

Dashboard

The simulators dashboard is the most convenient way to start simulating services and testing out your code.

  • Open the DeviceScript view in Visual Studio Code
  • Click on the dashboard icon in the Devices menu

A screenshot of the simulator view

Node.JS simulation

For advanced simulation scenario, you can use Node.JS and the TypeScript client library and, +any other Node package (like your favorite test project), to generate complex scenarios.

Start by configuring your project for simulation by running

devs add sim

or in Visual Studio Code, using the DeviceScript: Add Sim... in the command palette.

  • all .ts files, expect for the ./sim/ folder, are compiled into DeviceScript bytecode
  • all file under ./sim/ are compiled as a Node.JS application
.devicescript/*  libraries and supporting files
src/main.ts DeviceScript entry point
...
sim/app.ts Node entry point for the simulator
sim/...

Running using package scripts

The scripts in package.json are configured support both DeviceScript and sim build and watch.

build

# build DeviceScript and node.js sim
yarn build

# build device script only
yarn build:devicescript

# build node.js sim only
yarn build:sim

watch

# watch DeviceScript and node.js sim
yarn watch

# watch device script only
yarn watch:devicescript

# watch node.js sim only
yarn watch:sim

Debugging DeviceScript and Node

Visual Studio Code supports multiple debugging sessions simultaneously so it is possible to debug your DeviceScript +code and the simulator in the same session.

aurascope example

This simulator sample starts a simulated psychomagnotheric energy sensor (custom service) using jacdac-ts.

./sim/app.ts
// Jacdac bus that will connect to the devtools server
import { bus } from "./runtime"
// Jacdac helper to simulate services
import { addServer, AnalogSensorServer } from "jacdac-ts"
// custom service
import { SRV_PSYCHOMAGNOTHERIC_ENERGY } from "../.devicescript/ts/constants"

// server for the custom service
const server = new AnalogSensorServer(SRV_PSYCHOMAGNOTHERIC_ENERGY, {
readingValues: [0.5],
readingError: [0.1],
streamingInterval: 500,
})
// change level randomly
setInterval(() => {
// randomly change the
const newValue = server.reading.values()[0] + (0.5 - Math.random()) / 10
server.reading.setValues([newValue])
console.debug(`psycho value: ${newValue}`)
}, 100)
addServer(bus, "aurascope", server)
+ + + + \ No newline at end of file diff --git a/developer/status-light.html b/developer/status-light.html new file mode 100644 index 00000000000..d80ead54594 --- /dev/null +++ b/developer/status-light.html @@ -0,0 +1,21 @@ + + + + + +Status Light | DeviceScript + + + + + + + + +
+

Status Light

DeviceScript uses various blinking patterns on the status LED to message application states.

Controlling the status led

You can set the status LED (until a system LED pattern is scheduled by the runtime) +using the setStatusLight function.

import { delay } from "@devicescript/core"
import { setStatusLight } from "@devicescript/runtime"

setInterval(async () => {
await setStatusLight(0x00ff00) // green
await delay(500)
await setStatusLight(0x000000) // off
}, 500)

Network connectivity

  • connecting to network: slow yellow glow
  • connecting to gateway: fast yellow glow
  • connected to gateway: very slow blue glow
  • not connected to cloud: very slow red

Gateway messages

  • message uploaded: purple short blink
  • message failed to upload: red short blink

Errors

  • jacdac line error: yellow blink
  • packet overflow: magenta blink
  • generic error: short red blink

The blinking patterns are defined at https://github.com/microsoft/jacdac-c/blob/main/inc/jd_io.h#L77

+ + + + \ No newline at end of file diff --git a/developer/testing.html b/developer/testing.html new file mode 100644 index 00000000000..61123fcb514 --- /dev/null +++ b/developer/testing.html @@ -0,0 +1,20 @@ + + + + + +Testing | DeviceScript + + + + + + + + +
+

Testing

DeviceScript provides a unit test framework that runs on the device. It has a syntax similar to Jest/Mocha/Chai.

Setup

Configure your project for testing using this command

devs add test

Defining tests

The test framework provides the popular BDD test contructs: describe, test, expect.

import { describe, test, expect } from "@devicescript/test"

describe("this is a test suite", () => {
test("this is a test", () => {
expect(1).toBe(1)
})
})

Running tests

From a terminal, run the test DeviceScript

npm run test

See also

+ + + + \ No newline at end of file diff --git a/devices.html b/devices.html new file mode 100644 index 00000000000..65d267d5543 --- /dev/null +++ b/devices.html @@ -0,0 +1,33 @@ + + + + + +Devices | DeviceScript + + + + + + + + +
+

Devices

This page links to various developer boards that have a DeviceScript runtime firmware.

For sensors and other peripherals, see drivers.

Implementation status

DeviceUSBTCPTLSI2CSPIGPIOPWMWS2812BJacdac
WASM SimN/A
ESP32⚠️
ESP32-C3
ESP32-S2
ESP32-S3
RP2040
RP2040-W

The PWM is currently only supported through servo, light bulb, buzzer and similar drivers.

The ESP32-C3 boards are best supported. +The regular ESP32 (without -C3 or -S2) currently have issues with the USB connection +(as it's handled by external chip). +The ESP32-S2 has limited memory which makes it difficult to use TLS. +The ESP32-S3 is very recent and largely untested.

The RP2040 should generally work, but TLS is not supported on Pico-W.

note

If you have ESP-IDF or Pico SDK expertise, we are actively looking for contributors to help +with the C embedded runtime. You can look at the ESP32 issues +or the RP2040 issues for ideas. +There's also an incomplete STM32 port if you +want to contribute there. It's also possible to port to a new MCU/SoC.

Board recommendations

For ESP32,

For RP2040,

tip

Your device is not in the list? Add a new Device Configuration in your project.

Shields

It is also possible to create npm packages for shields or breakouts. Those packages +typically configure the pins and drivers for a better experience.

+ + + + \ No newline at end of file diff --git a/devices/add-board.html b/devices/add-board.html new file mode 100644 index 00000000000..95e2f379999 --- /dev/null +++ b/devices/add-board.html @@ -0,0 +1,38 @@ + + + + + +Add Board | DeviceScript + + + + + + + + +
+

Add Board

In DeviceScript, we commonly refere a Device Configuration as a board. +You can see examples of configuration in each device page (like this one)

If your device is already using a supported system-on-a-chip (SoC) or MCU (ESP32, RP2040, ...), +you can create a new board configuration in your project to support it in DeviceScript. +You do not need to build a new firmware.

If you want to add a new system-on-a-chip (SoC), follow the add Soc guide.

tip

If you just need to reconfigure a couple pins, you can also use +the configureHardware function and skip the creation of a new board.

How to create a new board configuration

Create the new board.json file

You will need three pieces of information to start a new board: (1) the existing configuration +you will fork, (2) a name and (3) an identifier.

In Visual Studio Code, +select DeviceScript: Add Board... from the command palette.

Using the Command Line, use the add board command and follow the instructions.

devs add board

After this process, you wil have a new JSON under /boards/. The command line and +Visual Studio Code will automatically integrate any configuration files in the /boards folder.

Editing the generated Device configuration (.json) file

The new configuration file is a schematized JSON file. +In Visual Studio Code, you will get tooltip, completion, syntax errors and auto-completion.

note

The product identifier is used to identify devices in the Jacdac device catalog +which is leveraged by the simulator dashboard.

  • configure the status light LED. DeviceScript supports monochrome LEDs, RGB LEDs, +WS2812B, APA102, SK9822 and more (refer to the schema information).
    "led": {
"pin": 7,
"isMono": true
},
  • configure the system logging pin
    "log": {
"baud": 115200,
"pinTX": 0
},
  • configure I2C pins, add $connector only if there is a standardized connector
    "i2c": {
"pinSCL": 5,
"pinSDA": 4,
},
  • Update the pin map
    "pins": {
"P1": 1,
"P11": 11,
"P13": 13,
"P14": 14,
...
}
  • Update the board description
  • If available, provide a URL where the board can be purchased

Build the project to test the board definition.

npm run build

Services

Note that there is two ways of defining services in the .board.json file. +The ones listed under "$services": [ ... ] will generate startFoo() functions, +which need to be called for the service to be started. +The ones under "services": [ ... ] are always started; this is typically only +used for power service.

    "$services": [
{
"service": "buzzer",
"pin": 20,
"name": "buzzer"
},
...
]

Flash the new configuration

The command line and Visual Studio will automatically integrate +any configuration file in the boards/ folder. +The first time you deploy a program with a new hardware configuration, it will reset the device.

Contributing

If you have successfully crafted a configuration for your Device and you would like to share it with other users, +you can open a GitHub Issue at https://github.com/microsoft/devicescript and attach the .JSON file. The file will +be reviewed and integrate into the built-in list.

+ + + + \ No newline at end of file diff --git a/devices/add-shield.html b/devices/add-shield.html new file mode 100644 index 00000000000..8425fe54653 --- /dev/null +++ b/devices/add-shield.html @@ -0,0 +1,22 @@ + + + + + +Add Shield | DeviceScript + + + + + + + + +
+

Add Shield

Shield typically rely on using an existing board definition +and with extra configuration using configureHardware +and the logic to start drivers.

  • create a class Shield (rename to your shield name) and add the @devsPart, @devsWhenUsed attribute in the jsdoc.
/**
* A shield driver
* @devsPart My Shield name
* @devsWhenUsed
*/
export class Shield {}
  • call configureHardware in the constructor to setup additional hardware configuration like I2C.
export class Shield {
constructor() {
configureHardware({
...
})
}
}
  • add instance methods to start each driver
export class Shield {
startButton() {
return startButton({
pin: pins.GP10,
activeHigh: true,
})
}
}

Add to this repository

  • fork the microsoft/devicescript repository
  • add driver in packages/drivers (see others), export from packages/drivers/index.ts
  • add documentation page under website/docs/devices/shields, see others
  • add entry in website/docs/devices/index.tsx

How-to publish on npm

  • start a new DeviceScript project

  • run the DeviceScript: add npm... command to prepare it for publishing

  • add the board package for your target device

  • update the README with examples and documentation

  • publish a release of your package

  • send us a pull request so we list your shield package!

+ + + + \ No newline at end of file diff --git a/devices/add-soc.html b/devices/add-soc.html new file mode 100644 index 00000000000..b391f067921 --- /dev/null +++ b/devices/add-soc.html @@ -0,0 +1,34 @@ + + + + + +Add SoC/MCU | DeviceScript + + + + + + + + +
+

Adding a System-on-a-Chip or Microcontroller

DeviceScript currently supports the following:

  • ESP32, including the "classic", S2, S3, and C3 variants
  • RP2040, including Raspberry Pi Pico and Pico W
  • WASM and POSIX for simulation

Following are work-in-progress:

  • STM32, specifically STM32L475VG

If you're working on a port, let us know (via +GitHub issue or +discussion) so we can list is here.

Generally, DeviceScript has a concept of an "architecture" which corresponds 1:1 to an executable binary, +which is a specific SoC/MCU or a family thereof +(we use SoC (System-on-a-Chip) and MCU (Microcontroller Unit) interchangably in this document).

For example, for ESP32 there are esp32, esp32c3, esp32s2, and esp32s3 architectures. +For RP2040, we have two architectures: rp2040 (generic) and rp2040w (with support for WiFi chip from Pico W). +For STM32, it may be possible in future to have say a single stm32l4 architecture that then dynamically adds enables support +for peripherals that are present and auto-detects the size of RAM and FLASH, +but right now we just have a specific stm32l475vg.

DeviceScript further defines "boards" which take a binary architecture image and binary-edit it to include +configuration data about pin names and on-board peripherals.

Note, that there isn't any shared code for say "ARM" or "RISC-V" architecture, as all the VM code is platform-agnostic C anyways, +which sits in the main DeviceScript repo.

Creating new SoC

It's best to start by forking an existing port, we suggest the rp2040 one, and implement functions one by one. +Start by looking at jd_user_config.h file and disable things.

Note that the STM32 port borrows heavily from Jacdac firmware for STM32G0-based modules, +so parts of the source are not necessary for DeviceScript. +If you want to use STM32 as a base, it's likely better to use rp2040 or esp32 as the skeleton, +and copy code from the STM32 as needed.

As for SoC requirements:

  • make sure your SoC has enough memory
  • it's highly recommended to use SoCs with built-in USB peripheral; we do have some support for using external USB-UART chips (as in ESP32 classic port) but it's rather buggy
+ + + + \ No newline at end of file diff --git a/devices/esp32.html b/devices/esp32.html new file mode 100644 index 00000000000..099132e6eb6 --- /dev/null +++ b/devices/esp32.html @@ -0,0 +1,20 @@ + + + + + +ESP32 | DeviceScript + + + + + + + + +
+

ESP32

The following devices use the firmware from https://github.com/microsoft/devicescript-esp32 which builds on top of ESP-IDF.

photograph of Seeed Studio XIAO ESP32C3
Seeed Studio XIAO ESP32C3
A tiny ESP32-C3 board.
photograph of Adafruit QT Py ESP32-C3 WiFi
Adafruit QT Py ESP32-C3 WiFi
A tiny ESP32-C3 board.

and more...

photograph of Adafruit QT Py ESP32-C3 WiFi
Adafruit QT Py ESP32-C3 WiFi
A tiny ESP32-C3 board.
photograph of ESP32-C3FH4-RGB
ESP32-C3FH4-RGB
A tiny ESP32-C3 board with 5x5 LED array.
photograph of Espressif ESP32-DevKitC
Espressif ESP32-DevKitC
There are currently issues with serial chip on these, best avoid.
photograph of Espressif ESP32-C3-RUST-DevKit
Espressif ESP32-C3-RUST-DevKit
A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port.
photograph of Espressif ESP32-S3 DevKitM
Espressif ESP32-S3 DevKitM
ESP32-S3 DevKitM development board.
photograph of Unexpected Maker FeatherS2 ESP32-S2
Unexpected Maker FeatherS2 ESP32-S2
ESP32-S2 based development board in a Feather format.
photograph of Seeed Studio XIAO ESP32C3
Seeed Studio XIAO ESP32C3
A tiny ESP32-C3 board.
photograph of Seeed Studio XIAO ESP32C3 with MSR218 base
Seeed Studio XIAO ESP32C3 with MSR218 base
A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors.
tip

Your device is not in the list? Add a new Device Configuration in your project.

Requirements

You will need to install esptool.py first - you can do that using pip.

pip install esptool

Usage

Connect your ESP32 board and run devicescript flash esp32 to flash DeviceScript runtime on it.

devicescript flash esp32
Output
$ devicescript flash esp32
using serial port /dev/cu.usbmodem01 at 1500000
esptool: /usr/local/bin/esptool.py
Identify arch
esptool.py v4.5
Serial port /dev/cu.usbmodem01
Connecting...
Detecting chip type... Unsupported detection protocol, switching and trying again...
Detecting chip type... ESP32-S2
Chip is ESP32-S2 (revision v0.0)
Features: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V1
Crystal is 40MHz
MAC: 7c:df:a1:03:99:f4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 1500000
Changed.
Warning: ESP32-S2 has no Chip ID. Reading MAC instead.
MAC: 7c:df:a1:03:99:f4
Staying in bootloader.
Please select board, available options:
--board msr207_v42 JM Brain S2-mini 207 v4.2
--board msr207_v43 JM Brain S2-mini 207 v4.3
--board msr48 JacdacIoT 48 v0.2
$

Listing boards

You can also get a full list of ESP32 boards without attempting any auto-detect.

devicescript flash esp32 --board list
Output
$ devicescript flash esp32 --board list
Please select board, available options:
--board msr207_v42 JM Brain S2-mini 207 v4.2
--board msr207_v43 JM Brain S2-mini 207 v4.3
--board msr48 JacdacIoT 48 v0.2
--board adafruit_qt_py_c3 Adafruit QT Py ESP32-C3 WiFi Dev Board
--board esp32_devkit_c Espressif ESP32-DevKitC

Targeting a specific board

Let's say your board is adafruit_qt_py_c3. To target this board, use the --board [boardid] flag.

devicescript flash esp32 --board adafruit_qt_py_c3
Output
$ devicescript flash esp32 --board adafruit_qt_py_c3
using serial port /dev/cu.usbmodem14211401 at 1500000
esptool: /usr/local/bin/esptool.py
fetch https://github.com/microsoft/jacdac-esp32/releases/latest/download/devicescript-esp32c3-adafruit_qt_py_c3-0x0.bin
saved .devicescript/cache/devicescript-esp32c3-adafruit_qt_py_c3-0x0.bin 982208 bytes
esptool.py v4.5
Serial port /dev/cu.usbmodem14211401
Connecting....
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (revision v0.3)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:b4:72:ea:17:88
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 1500000
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x000effff...
Compressed 982208 bytes to 532293...
Writing at 0x00000000... (3 %)
Writing at 0x00011e9e... (6 %)
[...snip...]
Writing at 0x000e576f... (96 %)
Writing at 0x000ec5d7... (100 %)
Wrote 982208 bytes (532293 compressed) at 0x00000000 in 7.5 seconds (effective 1042.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
$

After flashing, your board has the DeviceScript runtime and you can program it using DeviceScript.

tip

Check out the errors page if you run into any issues.

Custom write_flash argument

Use the $flashToolArguments field in the board definition to specify additional arguments to esptool write_flash, such as --flash_mode.

+ + + + \ No newline at end of file diff --git a/devices/esp32/adafruit-feather-esp32-s2.html b/devices/esp32/adafruit-feather-esp32-s2.html new file mode 100644 index 00000000000..6189942789d --- /dev/null +++ b/devices/esp32/adafruit-feather-esp32-s2.html @@ -0,0 +1,24 @@ + + + + + +Adafruit Feather ESP32-S2 | DeviceScript + + + + + + + + +
+

Adafruit Feather ESP32-S2

A S2 Feather from Adafruit. (untested)

Features

  • I2C on SDA/SCL using Qwiic connector
  • WS2812B RGB LED on pin 33 (use setStatusLight to control)
  • Serial logging on pin 43 at 115200 8N1

Stores

Pins

pin namehardware idfeatures
A0GPIO18analogOut, io
A1GPIO17analogOut, io
A2GPIO16io
A3GPIO15io
A4_D24GPIO14io
A5_D25GPIO8analogIn, io
D10GPIO10analogIn, io
D11GPIO11io
D12GPIO12io
D13GPIO13io
D5GPIO5analogIn, io
D6GPIO6analogIn, io
D9GPIO9analogIn, io
LED_PWRGPIO21io
MISOGPIO37io
MOSIGPIO35io
PWRGPIO7analogIn, io
RX_D0GPIO38io
SCKGPIO36io
SCLGPIO4i2c.pinSCL, analogIn, io
SDAGPIO3i2c.pinSDA, analogIn, io
TX_D1GPIO39debug, io
led.pinGPIO33led.pin, io
log.pinTXGPIO43log.pinTX, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Adafruit Feather ESP32-S2".

import { pins, board } from "@dsboard/adafruit_feather_esp32_s2"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board adafruit_feather_esp32_s2

Configuration

adafruit_feather_esp32_s2.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "adafruit_feather_esp32_s2",
"devName": "Adafruit Feather ESP32-S2",
"productId": "0x3c2ed99e",
"$description": "A S2 Feather from Adafruit. (untested)",
"archId": "esp32s2",
"url": "https://www.adafruit.com/product/5000",
"i2c": {
"$connector": "Qwiic",
"pinSCL": "SCL",
"pinSDA": "SDA"
},
"led": {
"pin": 33,
"type": 1
},
"log": {
"pinTX": 43
},
"pins": {
"A0": 18,
"A1": 17,
"A2": 16,
"A3": 15,
"A4_D24": 14,
"A5_D25": 8,
"D10": 10,
"D11": 11,
"D12": 12,
"D13": 13,
"D5": 5,
"D6": 6,
"D9": 9,
"LED_PWR": 21,
"MISO": 37,
"MOSI": 35,
"PWR": 7,
"RX_D0": 38,
"SCK": 36,
"SCL": 4,
"SDA": 3,
"TX_D1": 39
},
"sPin": {
"LED_PWR": 1,
"PWR": 1
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/adafruit-qt-py-c3.html b/devices/esp32/adafruit-qt-py-c3.html new file mode 100644 index 00000000000..b663892173c --- /dev/null +++ b/devices/esp32/adafruit-qt-py-c3.html @@ -0,0 +1,24 @@ + + + + + +Adafruit QT Py ESP32-C3 WiFi | DeviceScript + + + + + + + + +
+

Adafruit QT Py ESP32-C3 WiFi

A tiny ESP32-C3 board.

Adafruit QT Py ESP32-C3 WiFi picture

Features

  • I2C on SDA_D4/SCL_D5 using Qwiic connector
  • WS2812B RGB LED on pin 2 (use setStatusLight to control)
  • Serial logging on pin TX_D6 at 115200 8N1
  • Service: buttonBOOT (button)

Stores

Pins

pin namehardware idfeatures
A0_D0GPIO4analogIn, debug, io
A1_D1GPIO3analogIn, io
A2_D2GPIO1analogIn, io
A3_D3GPIO0analogIn, io
MISO_D9GPIO8boot, io
MOSI_D10GPIO7debug, io
RX_D7GPIO20bootUart, io
SCK_D8GPIO10io
SCL_D5GPIO6i2c.pinSCL, debug, io
SDA_D4GPIO5i2c.pinSDA, debug, io
TX_D6GPIO21log.pinTX, bootUart, io
$services.buttonBOOT[0].pinGPIO9$services.buttonBOOT[0].pin, boot, io
led.pinGPIO2led.pin, analogIn, boot, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Adafruit QT Py ESP32-C3 WiFi".

import { pins, board } from "@dsboard/adafruit_qt_py_c3"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board adafruit_qt_py_c3

Configuration

adafruit_qt_py_c3.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "adafruit_qt_py_c3",
"devName": "Adafruit QT Py ESP32-C3 WiFi",
"productId": "0x3693d40b",
"$description": "A tiny ESP32-C3 board.",
"archId": "esp32c3",
"url": "https://www.adafruit.com/product/5405",
"$services": [
{
"name": "buttonBOOT",
"pin": 9,
"service": "button"
}
],
"i2c": {
"$connector": "Qwiic",
"pinSCL": "SCL_D5",
"pinSDA": "SDA_D4"
},
"led": {
"pin": 2,
"type": 1
},
"log": {
"pinTX": "TX_D6"
},
"pins": {
"A0_D0": 4,
"A1_D1": 3,
"A2_D2": 1,
"A3_D3": 0,
"MISO_D9": 8,
"MOSI_D10": 7,
"RX_D7": 20,
"SCK_D8": 10,
"SCL_D5": 6,
"SDA_D4": 5,
"TX_D6": 21
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32-bare.html b/devices/esp32/esp32-bare.html new file mode 100644 index 00000000000..22b56432d82 --- /dev/null +++ b/devices/esp32/esp32-bare.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32 (bare) | DeviceScript + + + + + + + + +
+

Espressif ESP32 (bare)

Bare ESP32 without any default functions for pins.

Features

caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P13GPIO13debug, io, touch
P14GPIO14debug, io, touch
P18GPIO18io
P19GPIO19io
P21GPIO21io
P22GPIO22io
P23GPIO23io
P25GPIO25analogOut, io
P26GPIO26analogOut, io
P27GPIO27io, touch
P32GPIO32analogIn, io, touch
P33GPIO33analogIn, io, touch
P34GPIO34analogIn, input
P35GPIO35analogIn, input
P36GPIO36analogIn, input
P39GPIO39analogIn, input
P4GPIO4io, touch

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32 (bare)".

import { pins, board } from "@dsboard/esp32_bare"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32_bare

Configuration

esp32_bare.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32_bare",
"devName": "Espressif ESP32 (bare)",
"productId": "0x3ff6ffeb",
"$description": "Bare ESP32 without any default functions for pins.",
"archId": "esp32",
"url": "https://www.espressif.com/en/products/socs/esp32",
"pins": {
"P13": 13,
"P14": 14,
"P18": 18,
"P19": 19,
"P21": 21,
"P22": 22,
"P23": 23,
"P25": 25,
"P26": 26,
"P27": 27,
"P32": 32,
"P33": 33,
"P34": 34,
"P35": 35,
"P36": 36,
"P39": 39,
"P4": 4
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32-c3fh4-rgb.html b/devices/esp32/esp32-c3fh4-rgb.html new file mode 100644 index 00000000000..da8b6eadbdd --- /dev/null +++ b/devices/esp32/esp32-c3fh4-rgb.html @@ -0,0 +1,24 @@ + + + + + +ESP32-C3FH4-RGB | DeviceScript + + + + + + + + +
+

ESP32-C3FH4-RGB

A tiny ESP32-C3 board with 5x5 LED array.

ESP32-C3FH4-RGB picture

Features

  • I2C on 0/1 using Qwiic connector
  • LED on pin 10 (use setStatusLight to control)
  • Serial logging on pin 21 at 115200 8N1
  • Service: buttonBOOT (button)

Stores

Pins

pin namehardware idfeatures
LEDSGPIO8boot, io
P2GPIO2analogIn, boot, io
P20GPIO20bootUart, io
P3GPIO3analogIn, io
P4GPIO4analogIn, debug, io
P5GPIO5debug, io
P6GPIO6debug, io
P7GPIO7debug, io
$services.buttonBOOT[0].pinGPIO9$services.buttonBOOT[0].pin, boot, io
i2c.pinSCLGPIO1i2c.pinSCL, analogIn, io
i2c.pinSDAGPIO0i2c.pinSDA, analogIn, io
led.pinGPIO10led.pin, io
log.pinTXGPIO21log.pinTX, bootUart, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "ESP32-C3FH4-RGB".

import { pins, board } from "@dsboard/esp32_c3fh4_rgb"

Driver

The LEDs can be controlled as a LED strip or a display.

import { Esp32C3FH4RGB } from "@devicescript/drivers"
import { startLedDisplay } from "@devicescript/runtime"

const board = new Esp32C3FH4RGB()
const led = await board.startLed()
await led.intensity.write(0.05)
const display = await startLedDisplay(led)

const n = display.palette.length
let k = 0
for (let y = 0; y < 5; ++y)
for (let x = 0; x < 5; ++x)
await display.image.set(x, y, k++ % n)
await display.show()

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32_c3fh4_rgb

Configuration

esp32_c3fh4_rgb.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32_c3fh4_rgb",
"devName": "ESP32-C3FH4-RGB",
"productId": "0x3a90885c",
"$description": "A tiny ESP32-C3 board with 5x5 LED array.",
"archId": "esp32c3",
"url": "https://github.com/01Space/ESP32-C3FH4-RGB",
"$services": [
{
"name": "buttonBOOT",
"pin": 9,
"service": "button"
}
],
"i2c": {
"$connector": "Qwiic",
"pinSCL": 1,
"pinSDA": 0
},
"led": {
"isMono": true,
"pin": 10
},
"log": {
"pinTX": 21
},
"pins": {
"LEDS": 8,
"P2": 2,
"P20": 20,
"P3": 3,
"P4": 4,
"P5": 5,
"P6": 6,
"P7": 7
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32-devkit-c.html b/devices/esp32/esp32-devkit-c.html new file mode 100644 index 00000000000..907418f0961 --- /dev/null +++ b/devices/esp32/esp32-devkit-c.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32-DevKitC | DeviceScript + + + + + + + + +
+

Espressif ESP32-DevKitC

There are currently issues with serial chip on these, best avoid. ESP32-DevKitC development board. This will also work with DOIT DevkitV1, NodeMCU ESP32, ... (search for 'esp32 devkit'). Some of these boards do not have the LED.

Espressif ESP32-DevKitC picture

Features

  • LED on pin 2 (use setStatusLight to control)
  • Service: buttonIO0 (button)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P13GPIO13debug, io, touch
P14GPIO14debug, io, touch
P18GPIO18io
P19GPIO19io
P21GPIO21io
P22GPIO22io
P23GPIO23io
P25GPIO25analogOut, io
P26GPIO26analogOut, io
P27GPIO27io, touch
P32GPIO32analogIn, io, touch
P33GPIO33analogIn, io, touch
P34GPIO34analogIn, input
P35GPIO35analogIn, input
P4GPIO4io, touch
VNGPIO39analogIn, input
VPGPIO36analogIn, input
$services.buttonIO0[0].pinGPIO0$services.buttonIO0[0].pin, boot, io, touch
led.pinGPIO2led.pin, boot, io, touch

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32-DevKitC".

import { pins, board } from "@dsboard/esp32_devkit_c"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32_devkit_c

Configuration

esp32_devkit_c.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32_devkit_c",
"devName": "Espressif ESP32-DevKitC",
"productId": "0x3c507a05",
"$description": "There are currently issues with serial chip on these, best avoid. ESP32-DevKitC development board. This will also work with DOIT DevkitV1, NodeMCU ESP32, ... (search for 'esp32 devkit'). Some of these boards do not have the LED.",
"archId": "esp32",
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html",
"$services": [
{
"name": "buttonIO0",
"pin": 0,
"service": "button"
}
],
"led": {
"pin": 2
},
"pins": {
"P13": 13,
"P14": 14,
"P18": 18,
"P19": 19,
"P21": 21,
"P22": 22,
"P23": 23,
"P25": 25,
"P26": 26,
"P27": 27,
"P32": 32,
"P33": 33,
"P34": 34,
"P35": 35,
"P4": 4,
"VN": 39,
"VP": 36
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32c3-bare.html b/devices/esp32/esp32c3-bare.html new file mode 100644 index 00000000000..54625d00972 --- /dev/null +++ b/devices/esp32/esp32c3-bare.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32-C3 (bare) | DeviceScript + + + + + + + + +
+

Espressif ESP32-C3 (bare)

A bare ESP32-C3 board without any pin functions.

Features

  • Serial logging on pin P21 at 115200 8N1
  • Service: buttonBOOT (button)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P0GPIO0analogIn, io
P1GPIO1analogIn, io
P10GPIO10io
P2GPIO2analogIn, boot, io
P20GPIO20bootUart, io
P21GPIO21log.pinTX, bootUart, io
P3GPIO3analogIn, io
P4GPIO4analogIn, debug, io
P5GPIO5debug, io
P6GPIO6debug, io
P7GPIO7debug, io
P8GPIO8boot, io
P9GPIO9$services.buttonBOOT[0].pin, boot, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32-C3 (bare)".

import { pins, board } from "@dsboard/esp32c3_bare"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32c3_bare

Configuration

esp32c3_bare.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32c3_bare",
"devName": "Espressif ESP32-C3 (bare)",
"productId": "0x3a1d89be",
"$description": "A bare ESP32-C3 board without any pin functions.",
"archId": "esp32c3",
"url": "https://www.espressif.com/en/products/socs/esp32-c3",
"$services": [
{
"name": "buttonBOOT",
"pin": "P9",
"service": "button"
}
],
"log": {
"pinTX": "P21"
},
"pins": {
"P0": 0,
"P1": 1,
"P10": 10,
"P2": 2,
"P20": 20,
"P21": 21,
"P3": 3,
"P4": 4,
"P5": 5,
"P6": 6,
"P7": 7,
"P8": 8,
"P9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32c3-rust-devkit.html b/devices/esp32/esp32c3-rust-devkit.html new file mode 100644 index 00000000000..ef3392f250c --- /dev/null +++ b/devices/esp32/esp32c3-rust-devkit.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32-C3-RUST-DevKit | DeviceScript + + + + + + + + +
+

Espressif ESP32-C3-RUST-DevKit

A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port.

Espressif ESP32-C3-RUST-DevKit picture

Features

  • I2C on 10/8 using Header connector
  • WS2812B RGB LED on pin 2 (use setStatusLight to control)
  • Serial logging on pin P21 at 115200 8N1
  • Service: buttonBOOT (button)

Stores

Pins

pin namehardware idfeatures
LEDGPIO7debug, io
P0GPIO0analogIn, io
P1GPIO1analogIn, io
P20GPIO20bootUart, io
P21GPIO21log.pinTX, bootUart, io
P3GPIO3analogIn, io
P4GPIO4analogIn, debug, io
P5GPIO5debug, io
P6GPIO6debug, io
P9GPIO9$services.buttonBOOT[0].pin, boot, io
i2c.pinSCLGPIO8i2c.pinSCL, boot, io
i2c.pinSDAGPIO10i2c.pinSDA, io
led.pinGPIO2led.pin, analogIn, boot, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32-C3-RUST-DevKit".

import { pins, board } from "@dsboard/esp32c3_rust_devkit"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32c3_rust_devkit

Configuration

esp32c3_rust_devkit.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32c3_rust_devkit",
"devName": "Espressif ESP32-C3-RUST-DevKit",
"productId": "0x33f29c59",
"$description": "A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port.",
"archId": "esp32c3",
"url": "https://github.com/esp-rs/esp-rust-board",
"$services": [
{
"name": "buttonBOOT",
"pin": "P9",
"service": "button"
}
],
"i2c": {
"$connector": "Header",
"pinSCL": 8,
"pinSDA": 10
},
"led": {
"pin": 2,
"type": 1
},
"log": {
"pinTX": "P21"
},
"pins": {
"LED": 7,
"P0": 0,
"P1": 1,
"P20": 20,
"P21": 21,
"P3": 3,
"P4": 4,
"P5": 5,
"P6": 6,
"P9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32s2-bare.html b/devices/esp32/esp32s2-bare.html new file mode 100644 index 00000000000..7c887cb77db --- /dev/null +++ b/devices/esp32/esp32s2-bare.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32-S2 (bare) | DeviceScript + + + + + + + + +
+

Espressif ESP32-S2 (bare)

A bare ESP32-S2 board without any pin functions.

Features

  • Serial logging on pin P43 at 115200 8N1
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P0GPIO0boot, io
P1GPIO1analogIn, io
P10GPIO10analogIn, io
P11GPIO11io
P12GPIO12io
P13GPIO13io
P14GPIO14io
P15GPIO15io
P16GPIO16io
P17GPIO17analogOut, io
P18GPIO18analogOut, io
P2GPIO2analogIn, io
P21GPIO21io
P3GPIO3analogIn, io
P33GPIO33io
P34GPIO34io
P35GPIO35io
P36GPIO36io
P37GPIO37io
P38GPIO38io
P39GPIO39debug, io
P4GPIO4analogIn, io
P40GPIO40debug, io
P41GPIO41debug, io
P42GPIO42debug, io
P43GPIO43log.pinTX, io
P44GPIO44io
P45GPIO45boot, io
P46GPIO46boot, input
P5GPIO5analogIn, io
P6GPIO6analogIn, io
P7GPIO7analogIn, io
P8GPIO8analogIn, io
P9GPIO9analogIn, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32-S2 (bare)".

import { pins, board } from "@dsboard/esp32s2_bare"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32s2_bare

Configuration

esp32s2_bare.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32s2_bare",
"devName": "Espressif ESP32-S2 (bare)",
"productId": "0x3f140dcc",
"$description": "A bare ESP32-S2 board without any pin functions.",
"archId": "esp32s2",
"url": "https://www.espressif.com/en/products/socs/esp32-s2",
"log": {
"pinTX": "P43"
},
"pins": {
"P0": 0,
"P1": 1,
"P10": 10,
"P11": 11,
"P12": 12,
"P13": 13,
"P14": 14,
"P15": 15,
"P16": 16,
"P17": 17,
"P18": 18,
"P2": 2,
"P21": 21,
"P3": 3,
"P33": 33,
"P34": 34,
"P35": 35,
"P36": 36,
"P37": 37,
"P38": 38,
"P39": 39,
"P4": 4,
"P40": 40,
"P41": 41,
"P42": 42,
"P43": 43,
"P44": 44,
"P45": 45,
"P46": 46,
"P5": 5,
"P6": 6,
"P7": 7,
"P8": 8,
"P9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32s3-bare.html b/devices/esp32/esp32s3-bare.html new file mode 100644 index 00000000000..fedcdb20b48 --- /dev/null +++ b/devices/esp32/esp32s3-bare.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32-S3 (bare) | DeviceScript + + + + + + + + +
+

Espressif ESP32-S3 (bare)

A bare ESP32-S3 board without any pin functions.

Features

  • Serial logging on pin P43 at 115200 8N1
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P0GPIO0boot, io
P1GPIO1analogIn, io
P10GPIO10analogIn, io
P11GPIO11io
P12GPIO12io
P13GPIO13io
P14GPIO14io
P15GPIO15io
P16GPIO16io
P17GPIO17analogOut, io
P18GPIO18analogOut, io
P2GPIO2analogIn, io
P21GPIO21io
P3GPIO3analogIn, io
P33GPIO33io
P34GPIO34io
P38GPIO38io
P39GPIO39debug, io
P4GPIO4analogIn, io
P40GPIO40debug, io
P41GPIO41debug, io
P42GPIO42debug, io
P43GPIO43log.pinTX, io
P44GPIO44io
P45GPIO45boot, io
P46GPIO46boot, io
P47GPIO47io
P48GPIO48io
P5GPIO5analogIn, io
P6GPIO6analogIn, io
P7GPIO7analogIn, io
P8GPIO8analogIn, io
P9GPIO9analogIn, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32-S3 (bare)".

import { pins, board } from "@dsboard/esp32s3_bare"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32s3_bare

Configuration

esp32s3_bare.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32s3_bare",
"devName": "Espressif ESP32-S3 (bare)",
"productId": "0x3e121501",
"$description": "A bare ESP32-S3 board without any pin functions.",
"archId": "esp32s3",
"url": "https://www.espressif.com/en/products/socs/esp32-s3",
"log": {
"pinTX": "P43"
},
"pins": {
"#P35": 35,
"#P36": 36,
"#P37": 37,
"P0": 0,
"P1": 1,
"P10": 10,
"P11": 11,
"P12": 12,
"P13": 13,
"P14": 14,
"P15": 15,
"P16": 16,
"P17": 17,
"P18": 18,
"P2": 2,
"P21": 21,
"P3": 3,
"P33": 33,
"P34": 34,
"P38": 38,
"P39": 39,
"P4": 4,
"P40": 40,
"P41": 41,
"P42": 42,
"P43": 43,
"P44": 44,
"P45": 45,
"P46": 46,
"P47": 47,
"P48": 48,
"P5": 5,
"P6": 6,
"P7": 7,
"P8": 8,
"P9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/esp32s3-devkit-m.html b/devices/esp32/esp32s3-devkit-m.html new file mode 100644 index 00000000000..98115bfb539 --- /dev/null +++ b/devices/esp32/esp32s3-devkit-m.html @@ -0,0 +1,24 @@ + + + + + +Espressif ESP32-S3 DevKitM | DeviceScript + + + + + + + + +
+

Espressif ESP32-S3 DevKitM

ESP32-S3 DevKitM development board. Should also work for DevKitC.

Espressif ESP32-S3 DevKitM picture

Features

  • WS2812B RGB LED on pin P48 (use setStatusLight to control)
  • Serial logging on pin P43 at 115200 8N1
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P0GPIO0boot, io
P1GPIO1analogIn, io
P10GPIO10analogIn, io
P11GPIO11io
P12GPIO12io
P13GPIO13io
P14GPIO14io
P15GPIO15io
P16GPIO16io
P17GPIO17analogOut, io
P18GPIO18analogOut, io
P2GPIO2analogIn, io
P21GPIO21io
P3GPIO3analogIn, io
P33GPIO33io
P34GPIO34io
P38GPIO38io
P39GPIO39debug, io
P4GPIO4analogIn, io
P40GPIO40debug, io
P41GPIO41debug, io
P42GPIO42debug, io
P43GPIO43log.pinTX, io
P45GPIO45boot, io
P46GPIO46boot, io
P47GPIO47io
P48GPIO48led.pin, io
P5GPIO5analogIn, io
P6GPIO6analogIn, io
P7GPIO7analogIn, io
P8GPIO8analogIn, io
P9GPIO9analogIn, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Espressif ESP32-S3 DevKitM".

import { pins, board } from "@dsboard/esp32s3_devkit_m"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board esp32s3_devkit_m

Configuration

esp32s3_devkit_m.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "esp32s3_devkit_m",
"devName": "Espressif ESP32-S3 DevKitM",
"productId": "0x3574d277",
"$description": "ESP32-S3 DevKitM development board. Should also work for DevKitC.",
"archId": "esp32s3",
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html",
"led": {
"pin": "P48",
"type": 1
},
"log": {
"pinTX": "P43"
},
"pins": {
"P0": 0,
"P1": 1,
"P10": 10,
"P11": 11,
"P12": 12,
"P13": 13,
"P14": 14,
"P15": 15,
"P16": 16,
"P17": 17,
"P18": 18,
"P2": 2,
"P21": 21,
"P3": 3,
"P33": 33,
"P34": 34,
"P38": 38,
"P39": 39,
"P4": 4,
"P40": 40,
"P41": 41,
"P42": 42,
"P43": 43,
"P45": 45,
"P46": 46,
"P47": 47,
"P48": 48,
"P5": 5,
"P6": 6,
"P7": 7,
"P8": 8,
"P9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/feather-s2.html b/devices/esp32/feather-s2.html new file mode 100644 index 00000000000..4a732384ddb --- /dev/null +++ b/devices/esp32/feather-s2.html @@ -0,0 +1,24 @@ + + + + + +Unexpected Maker FeatherS2 ESP32-S2 | DeviceScript + + + + + + + + +
+

Unexpected Maker FeatherS2 ESP32-S2

ESP32-S2 based development board in a Feather format.

Unexpected Maker FeatherS2 ESP32-S2 picture

Features

  • I2C on SDA/SCL using Qwiic connector
  • LED on pin 40 (use setStatusLight to control)
  • Serial logging on pin TX_D1 at 115200 8N1
  • Service: buttonBOOT (button)
  • Service: ambientLight (analog:lightLevel)

Stores

Pins

pin namehardware idfeatures
P17GPIO17analogOut, io
P18GPIO18analogOut, io
P14GPIO14io
P12GPIO12io
P6GPIO6analogIn, io
P5GPIO5analogIn, io
P3GPIO3analogIn, io
P7GPIO7analogIn, io
P10GPIO10analogIn, io
P11GPIO11io
P33GPIO33io
P38GPIO38io
P1GPIO1analogIn, io
LED0GPIO13io
LED_PWRGPIO21io
SDIGPIO37io
SDOGPIO35io
RX_D0GPIO44io
SCKGPIO36io
SCLGPIO9i2c.pinSCL, analogIn, io
SDAGPIO8i2c.pinSDA, analogIn, io
TX_D1GPIO43log.pinTX, io
$services.buttonBOOT[0].pinGPIO0$services.buttonBOOT[0].pin, boot, io
$services.ambientLight[1].pinGPIO4$services.ambientLight[1].pin, analogIn, io
led.pinGPIO40led.pin, debug, io
led.pinCLKGPIO45led.pinCLK, boot, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Unexpected Maker FeatherS2 ESP32-S2".

import { pins, board } from "@dsboard/feather_s2"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board feather_s2

Configuration

feather_s2.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "feather_s2",
"devName": "Unexpected Maker FeatherS2 ESP32-S2",
"productId": "0x3126f707",
"$description": "ESP32-S2 based development board in a Feather format.",
"archId": "esp32s2",
"url": "https://unexpectedmaker.com/shop/feathers2-esp32-s2",
"$pins": {
"P1": "D9",
"P10": "D12",
"P11": "D13",
"P12": "A3",
"P14": "A2",
"P17": "A0",
"P18": "A1",
"P3": "D10",
"P33": "D5",
"P38": "D6",
"P5": "A5_D25",
"P6": "A4_D24",
"P7": "D11",
"SDI": "MISO",
"SDO": "MOSI"
},
"$services": [
{
"name": "buttonBOOT",
"pin": 0,
"service": "button"
},
{
"name": "ambientLight",
"pin": 4,
"service": "analog:lightLevel"
}
],
"i2c": {
"$connector": "Qwiic",
"pinSCL": "SCL",
"pinSDA": "SDA"
},
"led": {
"pin": 40,
"pinCLK": 45,
"type": 2
},
"log": {
"pinTX": "TX_D1"
},
"pins": {
"A0": 17,
"A1": 18,
"A2": 14,
"A3": 12,
"A4_D24": 6,
"A5_D25": 5,
"D10": 3,
"D11": 7,
"D12": 10,
"D13": 11,
"D5": 33,
"D6": 38,
"D9": 1,
"LED0": 13,
"LED_PWR": 21,
"MISO": 37,
"MOSI": 35,
"RX_D0": 44,
"SCK": 36,
"SCL": 9,
"SDA": 8,
"TX_D1": 43
},
"sPin": {
"LED_PWR": 1
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/msr207-v42.html b/devices/esp32/msr207-v42.html new file mode 100644 index 00000000000..2329761ffeb --- /dev/null +++ b/devices/esp32/msr207-v42.html @@ -0,0 +1,24 @@ + + + + + +MSR JM Brain S2-mini 207 v4.2 | DeviceScript + + + + + + + + +
+

MSR JM Brain S2-mini 207 v4.2

Features

  • Jacdac on pin 17 using Jacdac connector
  • RGB LED on pins 8, 7, 6 (use setStatusLight to control)
  • Serial logging on pin 43 at 115200 8N1
  • Service: power (auto-start)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P33GPIO33io
P34GPIO34io
jacdac.pinGPIO17jacdac.pin, analogOut, io
led.rgb[0].pinGPIO8led.rgb[0].pin, analogIn, io
led.rgb[1].pinGPIO7led.rgb[1].pin, analogIn, io
led.rgb[2].pinGPIO6led.rgb[2].pin, analogIn, io
log.pinTXGPIO43log.pinTX, io
sd.pinCSGPIO38sd.pinCS, io
sd.pinMISOGPIO37sd.pinMISO, io
sd.pinMOSIGPIO35sd.pinMOSI, io
sd.pinSCKGPIO36sd.pinSCK, io
services.power[0].pinEnGPIO2services.power[0].pinEn, analogIn, io
services.power[0].pinFaultGPIO13services.power[0].pinFault, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "MSR JM Brain S2-mini 207 v4.2".

import { pins, board } from "@dsboard/msr207_v42"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board msr207_v42

Configuration

msr207_v42.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "msr207_v42",
"devName": "MSR JM Brain S2-mini 207 v4.2",
"productId": "0x322e0e64",
"archId": "esp32s2",
"jacdac": {
"$connector": "Jacdac",
"pin": 17
},
"led": {
"rgb": [
{
"mult": 250,
"pin": 8
},
{
"mult": 60,
"pin": 7
},
{
"mult": 150,
"pin": 6
}
]
},
"log": {
"pinTX": 43
},
"pins": {
"P33": 33,
"P34": 34
},
"sd": {
"pinCS": 38,
"pinMISO": 37,
"pinMOSI": 35,
"pinSCK": 36
},
"services": [
{
"faultIgnoreMs": 100,
"mode": 0,
"name": "power",
"pinEn": 2,
"pinFault": 13,
"service": "power"
}
]
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/msr207-v43.html b/devices/esp32/msr207-v43.html new file mode 100644 index 00000000000..df56ac5f2ca --- /dev/null +++ b/devices/esp32/msr207-v43.html @@ -0,0 +1,24 @@ + + + + + +MSR JM Brain S2-mini 207 v4.3 | DeviceScript + + + + + + + + +
+

MSR JM Brain S2-mini 207 v4.3

Features

  • Jacdac on pin 17 using Jacdac connector
  • RGB LED on pins 8, 7, 6 (use setStatusLight to control)
  • Serial logging on pin 43 at 115200 8N1
  • Service: power (auto-start)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P33GPIO33io
P34GPIO34io
jacdac.pinGPIO17jacdac.pin, analogOut, io
led.rgb[0].pinGPIO8led.rgb[0].pin, analogIn, io
led.rgb[1].pinGPIO7led.rgb[1].pin, analogIn, io
led.rgb[2].pinGPIO6led.rgb[2].pin, analogIn, io
log.pinTXGPIO43log.pinTX, io
sd.pinCSGPIO38sd.pinCS, io
sd.pinMISOGPIO37sd.pinMISO, io
sd.pinMOSIGPIO35sd.pinMOSI, io
sd.pinSCKGPIO36sd.pinSCK, io
services.power[0].pinEnGPIO2services.power[0].pinEn, analogIn, io
services.power[0].pinFaultGPIO13services.power[0].pinFault, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "MSR JM Brain S2-mini 207 v4.3".

import { pins, board } from "@dsboard/msr207_v43"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board msr207_v43

Configuration

msr207_v43.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "msr207_v43",
"devName": "MSR JM Brain S2-mini 207 v4.3",
"productId": "0x322e0e64",
"archId": "esp32s2",
"jacdac": {
"$connector": "Jacdac",
"pin": 17
},
"led": {
"rgb": [
{
"mult": 250,
"pin": 8
},
{
"mult": 60,
"pin": 7
},
{
"mult": 150,
"pin": 6
}
]
},
"log": {
"pinTX": 43
},
"pins": {
"P33": 33,
"P34": 34
},
"sd": {
"pinCS": 38,
"pinMISO": 37,
"pinMOSI": 35,
"pinSCK": 36
},
"services": [
{
"faultIgnoreMs": 100,
"mode": 1,
"name": "power",
"pinEn": 2,
"pinFault": 13,
"service": "power"
}
]
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/msr48.html b/devices/esp32/msr48.html new file mode 100644 index 00000000000..3dd9a648e7a --- /dev/null +++ b/devices/esp32/msr48.html @@ -0,0 +1,24 @@ + + + + + +MSR JacdacIoT 48 v0.2 | DeviceScript + + + + + + + + +
+

MSR JacdacIoT 48 v0.2

MSR JacdacIoT 48 v0.2 picture

Features

  • Jacdac on pin 17 using Jacdac connector
  • I2C on 9/10 using Qwiic connector
  • RGB LED on pins 8, 7, 6 (use setStatusLight to control)
  • Serial logging on pin 43 at 115200 8N1
  • Service: power (auto-start)

Stores

Pins

pin namehardware idfeatures
P33GPIO33io
P34GPIO34io
P35GPIO35io
P36GPIO36io
RXGPIO38io
TXGPIO37io
i2c.pinSCLGPIO10i2c.pinSCL, analogIn, io
i2c.pinSDAGPIO9i2c.pinSDA, analogIn, io
jacdac.pinGPIO17jacdac.pin, analogOut, io
led.rgb[0].pinGPIO8led.rgb[0].pin, analogIn, io
led.rgb[1].pinGPIO7led.rgb[1].pin, analogIn, io
led.rgb[2].pinGPIO6led.rgb[2].pin, analogIn, io
log.pinTXGPIO43log.pinTX, io
services.power[0].pinEnGPIO2services.power[0].pinEn, analogIn, io
services.power[0].pinFaultGPIO13services.power[0].pinFault, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "MSR JacdacIoT 48 v0.2".

import { pins, board } from "@dsboard/msr48"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board msr48

Configuration

msr48.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "msr48",
"devName": "MSR JacdacIoT 48 v0.2",
"productId": "0x3de1398b",
"archId": "esp32s2",
"i2c": {
"$connector": "Qwiic",
"pinSCL": 10,
"pinSDA": 9
},
"jacdac": {
"$connector": "Jacdac",
"pin": 17
},
"led": {
"rgb": [
{
"mult": 250,
"pin": 8
},
{
"mult": 60,
"pin": 7
},
{
"mult": 150,
"pin": 6
}
]
},
"log": {
"pinTX": 43
},
"pins": {
"P33": 33,
"P34": 34,
"P35": 35,
"P36": 36,
"RX": 38,
"TX": 37
},
"services": [
{
"faultIgnoreMs": 100,
"mode": 0,
"name": "power",
"pinEn": 2,
"pinFault": 13,
"service": "power"
}
]
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/seeed-xiao-esp32c3-msr218.html b/devices/esp32/seeed-xiao-esp32c3-msr218.html new file mode 100644 index 00000000000..1eb443e6683 --- /dev/null +++ b/devices/esp32/seeed-xiao-esp32c3-msr218.html @@ -0,0 +1,24 @@ + + + + + +Seeed Studio XIAO ESP32C3 with MSR218 base | DeviceScript + + + + + + + + +
+

Seeed Studio XIAO ESP32C3 with MSR218 base

A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors.

Seeed Studio XIAO ESP32C3 with MSR218 base picture

Features

  • Jacdac on pin JD using Jacdac connector
  • I2C on SDA/SCL using Qwiic connector
  • WS2812B RGB LED on pin LED (use setStatusLight to control)
  • Serial logging on pin TX at 115200 8N1

Stores

Pins

pin namehardware idfeatures
A0GPIO2analogIn, boot, io
A1GPIO3analogIn, io
A2GPIO4analogIn, debug, io
D9GPIO9boot, io
JDGPIO5jacdac.pin, debug, io
LEDGPIO10led.pin, io
LED_PWRGPIO8boot, io
RXGPIO20bootUart, io
SCLGPIO7i2c.pinSCL, debug, io
SDAGPIO6i2c.pinSDA, debug, io
TXGPIO21log.pinTX, bootUart, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Seeed Studio XIAO ESP32C3 with MSR218 base".

import { pins, board } from "@dsboard/seeed_xiao_esp32c3_msr218"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board seeed_xiao_esp32c3_msr218

Configuration

seeed_xiao_esp32c3_msr218.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "seeed_xiao_esp32c3_msr218",
"devName": "Seeed Studio XIAO ESP32C3 with MSR218 base",
"productId": "0x36b64827",
"$description": "A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors.",
"archId": "esp32c3",
"url": "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html",
"$services": [],
"i2c": {
"$connector": "Qwiic",
"pinSCL": "SCL",
"pinSDA": "SDA"
},
"jacdac": {
"$connector": "Jacdac",
"pin": "JD"
},
"led": {
"pin": "LED",
"type": 1
},
"log": {
"pinTX": "TX"
},
"pins": {
"A0": 2,
"A1": 3,
"A2": 4,
"D9": 9,
"JD": 5,
"LED": 10,
"LED_PWR": 8,
"RX": 20,
"SCL": 7,
"SDA": 6,
"TX": 21
},
"sPin": {
"LED_PWR": 1
}
}
+ + + + \ No newline at end of file diff --git a/devices/esp32/seeed-xiao-esp32c3.html b/devices/esp32/seeed-xiao-esp32c3.html new file mode 100644 index 00000000000..ab32898de34 --- /dev/null +++ b/devices/esp32/seeed-xiao-esp32c3.html @@ -0,0 +1,24 @@ + + + + + +Seeed Studio XIAO ESP32C3 | DeviceScript + + + + + + + + +
+

Seeed Studio XIAO ESP32C3

A tiny ESP32-C3 board.

Seeed Studio XIAO ESP32C3 picture

Features

  • Serial logging on pin TX_D6 at 115200 8N1
  • Service: buttonBOOT (button)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
A0_D0GPIO2analogIn, boot, io
A1_D1GPIO3analogIn, io
A2_D2GPIO4analogIn, debug, io
A3_D3GPIO5debug, io
MISO_D9GPIO9$services.buttonBOOT[0].pin, boot, io
MOSI_D10GPIO10io
RX_D7GPIO20bootUart, io
SCK_D8GPIO8boot, io
SCL_D5GPIO7debug, io
SDA_D4GPIO6debug, io
TX_D6GPIO21log.pinTX, bootUart, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Seeed Studio XIAO ESP32C3".

import { pins, board } from "@dsboard/seeed_xiao_esp32c3"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board seeed_xiao_esp32c3

Configuration

seeed_xiao_esp32c3.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json",
"id": "seeed_xiao_esp32c3",
"devName": "Seeed Studio XIAO ESP32C3",
"productId": "0x3eff6b51",
"$description": "A tiny ESP32-C3 board.",
"archId": "esp32c3",
"url": "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html",
"$services": [
{
"name": "buttonBOOT",
"pin": "MISO_D9",
"service": "button"
}
],
"log": {
"pinTX": "TX_D6"
},
"pins": {
"A0_D0": 2,
"A1_D1": 3,
"A2_D2": 4,
"A3_D3": 5,
"MISO_D9": 9,
"MOSI_D10": 10,
"RX_D7": 20,
"SCK_D8": 8,
"SCL_D5": 7,
"SDA_D4": 6,
"TX_D6": 21
}
}
+ + + + \ No newline at end of file diff --git a/devices/rp2040.html b/devices/rp2040.html new file mode 100644 index 00000000000..14185753954 --- /dev/null +++ b/devices/rp2040.html @@ -0,0 +1,22 @@ + + + + + +RP2040 | DeviceScript + + + + + + + + +
+

RP2040

The following devices use the firmware from https://github.com/microsoft/devicescript-pico +which builds on top of the pico-sdk.

photograph of Raspberry Pi Pico
Raspberry Pi Pico
RP2040 board from Raspberry Pi.
photograph of Raspberry Pi Pico W
Raspberry Pi Pico W
RP2040 board from Raspberry Pi with a WiFi chip.
note

The pico-w networking stack (cloud, etc...) is currently not well supported. +We are currently focusing on best support on ESP32.

If you have expertise with the pico SDK, your contribution is welcome to fill the gaps.

Usage

You can use devicescript flash rp2040 command to flash RP2040-based boards.

Plug in your RP2040 board while holding BOOTSEL button the run this command. The bootloader drive should be discovered by your operating system.

devicescript flash rp2040
Output
$ devicescript flash rp2040
Please select board, available options:
--board msr124 RP2040 124 v0.1
--board msr59 RP2040 59 v0.1
--board pico_w Raspberry Pi Pico W
fatal: missing --board
$

Let's say your board is pico_w, you run

devicescript flash rp2040 --board pico_w
Output
$ devicescript flash rp2040 --board pico_w
using drive /Volumes/RPI-RP2/
fetch https://github.com/microsoft/jacdac-pico/releases/latest/download/devicescript-rp2040w-pico_w.uf2
saved .devicescript/cache/devicescript-rp2040w-pico_w.uf2 336896 bytes
cp .devicescript/cache/devicescript-rp2040w-pico_w.uf2 /Volumes/RPI-RP2/
OK
$

After flashing, your board has the DeviceScript runtime and you can program it using DeviceScript.

+ + + + \ No newline at end of file diff --git a/devices/rp2040/msr124.html b/devices/rp2040/msr124.html new file mode 100644 index 00000000000..85b3f715e8b --- /dev/null +++ b/devices/rp2040/msr124.html @@ -0,0 +1,24 @@ + + + + + +MSR RP2040 Brain 124 v0.1 | DeviceScript + + + + + + + + +
+

MSR RP2040 Brain 124 v0.1

Prototype board

Features

  • Jacdac on pin 9 using Jacdac connector
  • RGB LED on pins 16, 14, 15 (use setStatusLight to control)
  • Serial logging on pin 0 at 115200 8N1
  • Service: power (auto-start)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P1GPIO1io
P10GPIO10io
P2GPIO2io
P24GPIO24io
P25GPIO25io
P26GPIO26analogIn, io
P27GPIO27analogIn, io
P28GPIO28analogIn, io
P29GPIO29analogIn, io
P3GPIO3io
P4GPIO4io
P5GPIO5io
P6GPIO6io
P7GPIO7io
jacdac.pinGPIO9jacdac.pin, io
led.rgb[0].pinGPIO16led.rgb[0].pin, io
led.rgb[1].pinGPIO14led.rgb[1].pin, io
led.rgb[2].pinGPIO15led.rgb[2].pin, io
log.pinTXGPIO0log.pinTX, io
services.power[0].pinEnGPIO22services.power[0].pinEn, io
services.power[0].pinFaultGPIO12services.power[0].pinFault, io
services.power[0].pinLedPulseGPIO13services.power[0].pinLedPulse, io
services.power[0].pinPulseGPIO8services.power[0].pinPulse, io
services.power[0].pinUsbDetectGPIO11services.power[0].pinUsbDetect, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "MSR RP2040 Brain 124 v0.1".

import { pins, board } from "@dsboard/msr124"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board msr124

Configuration

msr124.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",
"id": "msr124",
"devName": "MSR RP2040 Brain 124 v0.1",
"productId": "0x3875e80d",
"$description": "Prototype board",
"archId": "rp2040",
"jacdac": {
"$connector": "Jacdac",
"pin": 9
},
"led": {
"rgb": [
{
"mult": 250,
"pin": 16
},
{
"mult": 60,
"pin": 14
},
{
"mult": 150,
"pin": 15
}
]
},
"log": {
"baud": 115200,
"pinTX": 0
},
"pins": {
"@HILIM": 18,
"P1": 1,
"P10": 10,
"P2": 2,
"P24": 24,
"P25": 25,
"P26": 26,
"P27": 27,
"P28": 28,
"P29": 29,
"P3": 3,
"P4": 4,
"P5": 5,
"P6": 6,
"P7": 7
},
"sPin": {
"#": "enable high power limiter mode",
"@HILIM": 0
},
"services": [
{
"faultIgnoreMs": 1000,
"mode": 3,
"name": "power",
"pinEn": 22,
"pinFault": 12,
"pinLedPulse": 13,
"pinPulse": 8,
"pinUsbDetect": 11,
"service": "power"
}
]
}
+ + + + \ No newline at end of file diff --git a/devices/rp2040/msr59.html b/devices/rp2040/msr59.html new file mode 100644 index 00000000000..4d069b03a87 --- /dev/null +++ b/devices/rp2040/msr59.html @@ -0,0 +1,24 @@ + + + + + +MSR Brain RP2040 59 v0.1 | DeviceScript + + + + + + + + +
+

MSR Brain RP2040 59 v0.1

Prototype board

MSR Brain RP2040 59 v0.1 picture

Features

  • Jacdac on pin 9 using Jacdac connector
  • RGB LED on pins 11, 13, 15 (use setStatusLight to control)
  • Serial logging on pin 2 at 115200 8N1
  • Service: power (auto-start)
caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
P26GPIO26analogIn, io
P27GPIO27analogIn, io
P3GPIO3io
P4GPIO4io
P5GPIO5io
P6GPIO6io
jacdac.pinGPIO9jacdac.pin, io
led.rgb[0].pinGPIO11led.rgb[0].pin, io
led.rgb[1].pinGPIO13led.rgb[1].pin, io
led.rgb[2].pinGPIO15led.rgb[2].pin, io
log.pinTXGPIO2log.pinTX, io
services.power[0].pinEnGPIO19services.power[0].pinEn, io
services.power[0].pinFaultGPIO25services.power[0].pinFault, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "MSR Brain RP2040 59 v0.1".

import { pins, board } from "@dsboard/msr59"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board msr59

Configuration

msr59.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",
"id": "msr59",
"devName": "MSR Brain RP2040 59 v0.1",
"productId": "0x35a678a3",
"$description": "Prototype board",
"archId": "rp2040",
"jacdac": {
"$connector": "Jacdac",
"pin": 9
},
"led": {
"rgb": [
{
"mult": 250,
"pin": 11
},
{
"mult": 60,
"pin": 13
},
{
"mult": 150,
"pin": 15
}
]
},
"log": {
"baud": 115200,
"pinTX": 2
},
"pins": {
"P26": 26,
"P27": 27,
"P3": 3,
"P4": 4,
"P5": 5,
"P6": 6
},
"services": [
{
"faultIgnoreMs": 100,
"mode": 2,
"name": "power",
"pinEn": 19,
"pinFault": 25,
"service": "power"
}
]
}
+ + + + \ No newline at end of file diff --git a/devices/rp2040/pico-w.html b/devices/rp2040/pico-w.html new file mode 100644 index 00000000000..886cf5b3afb --- /dev/null +++ b/devices/rp2040/pico-w.html @@ -0,0 +1,24 @@ + + + + + +Raspberry Pi Pico W | DeviceScript + + + + + + + + +
+

Raspberry Pi Pico W

RP2040 board from Raspberry Pi with a WiFi chip.

Raspberry Pi Pico W picture

Features

caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
GP0GPIO0io
GP1GPIO1io
GP10GPIO10io
GP11GPIO11io
GP12GPIO12io
GP13GPIO13io
GP14GPIO14io
GP15GPIO15io
GP16GPIO16io
GP17GPIO17io
GP18GPIO18io
GP19GPIO19io
GP2GPIO2io
GP20GPIO20io
GP21GPIO21io
GP22GPIO22io
GP26GPIO26analogIn, io
GP27GPIO27analogIn, io
GP28GPIO28analogIn, io
GP3GPIO3io
GP4GPIO4io
GP5GPIO5io
GP6GPIO6io
GP7GPIO7io
GP8GPIO8io
GP9GPIO9io
led.pinGPIO25led.pin, wifi

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Raspberry Pi Pico W".

import { pins, board } from "@dsboard/pico_w"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board pico_w

Configuration

pico_w.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",
"id": "pico_w",
"devName": "Raspberry Pi Pico W",
"productId": "0x3a513204",
"$description": "RP2040 board from Raspberry Pi with a WiFi chip.",
"archId": "rp2040w",
"url": "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html",
"led": {
"#": "type=100 - special handling for Pico LED",
"pin": 25,
"type": 100
},
"pins": {
"GP0": 0,
"GP1": 1,
"GP10": 10,
"GP11": 11,
"GP12": 12,
"GP13": 13,
"GP14": 14,
"GP15": 15,
"GP16": 16,
"GP17": 17,
"GP18": 18,
"GP19": 19,
"GP2": 2,
"GP20": 20,
"GP21": 21,
"GP22": 22,
"GP26": 26,
"GP27": 27,
"GP28": 28,
"GP3": 3,
"GP4": 4,
"GP5": 5,
"GP6": 6,
"GP7": 7,
"GP8": 8,
"GP9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/rp2040/pico.html b/devices/rp2040/pico.html new file mode 100644 index 00000000000..7a20065fd78 --- /dev/null +++ b/devices/rp2040/pico.html @@ -0,0 +1,24 @@ + + + + + +Raspberry Pi Pico | DeviceScript + + + + + + + + +
+

Raspberry Pi Pico

RP2040 board from Raspberry Pi.

Raspberry Pi Pico picture

Features

caution

I2C pins are not configured.

Stores

Pins

pin namehardware idfeatures
GP0GPIO0io
GP1GPIO1io
GP10GPIO10io
GP11GPIO11io
GP12GPIO12io
GP13GPIO13io
GP14GPIO14io
GP15GPIO15io
GP16GPIO16io
GP17GPIO17io
GP18GPIO18io
GP19GPIO19io
GP2GPIO2io
GP20GPIO20io
GP21GPIO21io
GP22GPIO22io
GP26GPIO26analogIn, io
GP27GPIO27analogIn, io
GP28GPIO28analogIn, io
GP3GPIO3io
GP4GPIO4io
GP5GPIO5io
GP6GPIO6io
GP7GPIO7io
GP8GPIO8io
GP9GPIO9io
led.pinGPIO25led.pin, io

DeviceScript import

You must add this import statement to load +the pinout configuration for this device.

In Visual Studio Code, +click the wand icon on the file menu and +select "Raspberry Pi Pico".

import { pins, board } from "@dsboard/pico"

Firmware update

In Visual Studio Code, +select DeviceScript: Flash Firmware... from the command palette.

Run this command line command and follow the instructions.

devicescript flash --board pico

Configuration

pico.json
{
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json",
"id": "pico",
"devName": "Raspberry Pi Pico",
"productId": "0x3f6e1f0c",
"$description": "RP2040 board from Raspberry Pi.",
"archId": "rp2040",
"url": "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html",
"led": {
"#": "type=100 - special handling for Pico LED",
"pin": 25,
"type": 100
},
"pins": {
"GP0": 0,
"GP1": 1,
"GP10": 10,
"GP11": 11,
"GP12": 12,
"GP13": 13,
"GP14": 14,
"GP15": 15,
"GP16": 16,
"GP17": 17,
"GP18": 18,
"GP19": 19,
"GP2": 2,
"GP20": 20,
"GP21": 21,
"GP22": 22,
"GP26": 26,
"GP27": 27,
"GP28": 28,
"GP3": 3,
"GP4": 4,
"GP5": 5,
"GP6": 6,
"GP7": 7,
"GP8": 8,
"GP9": 9
}
}
+ + + + \ No newline at end of file diff --git a/devices/shields.html b/devices/shields.html new file mode 100644 index 00000000000..b920f2deff5 --- /dev/null +++ b/devices/shields.html @@ -0,0 +1,21 @@ + + + + + +Shields | DeviceScript + + + + + + + + + + + + + \ No newline at end of file diff --git a/devices/shields/pico-bricks.html b/devices/shields/pico-bricks.html new file mode 100644 index 00000000000..bf53edf5745 --- /dev/null +++ b/devices/shields/pico-bricks.html @@ -0,0 +1,22 @@ + + + + + +Pico Bricks | DeviceScript + + + + + + + + +
+

Pico Bricks

PicoBricks image

DeviceScript import

You must import PicoBricks to access the shield services.

In Visual Studio Code, +click the wand icon on the file menu and +select "PicoBricks".

import { PicoBricks } from "@devicescript/drivers"
const shield = new PicoBricks()

const motor1 = shield.startMotor1()
+ + + + \ No newline at end of file diff --git a/devices/shields/pimoroni-pico-badger.html b/devices/shields/pimoroni-pico-badger.html new file mode 100644 index 00000000000..57091a42c0b --- /dev/null +++ b/devices/shields/pimoroni-pico-badger.html @@ -0,0 +1,22 @@ + + + + + +Pimoroni Badger RP2040 | DeviceScript + + + + + + + + +
+

Pimoroni Badger RP2040

Pimoroni Badger RP2040 image

DeviceScript import

You must import PimoroniBadger2040W to access the shield services.

In Visual Studio Code, +click the wand icon on the file menu and +select "PimoroniBadger2040W".

import { font8, scaledFont } from "@devicescript/graphics"
import { PimoroniBadger2040W } from "@devicescript/drivers"

const board = new PimoroniBadger2040W()
const disp = await board.startDisplay()
const f = scaledFont(font8(), 3)
disp.image.print("Hello world!", 10, 10, 1, f)
await disp.show()
+ + + + \ No newline at end of file diff --git a/devices/shields/waveshare-pico-lcd-114.html b/devices/shields/waveshare-pico-lcd-114.html new file mode 100644 index 00000000000..9635328409f --- /dev/null +++ b/devices/shields/waveshare-pico-lcd-114.html @@ -0,0 +1,22 @@ + + + + + +WaveShare Pico-LCD | DeviceScript + + + + + + + + +
+

WaveShare Pico-LCD

WaveShare Image

DeviceScript import

You must import WaveSharePicoLCD114 to access the shield services.

In Visual Studio Code, +click the wand icon on the file menu and +select "WaveShare Pico LCD 114".

import { WaveSharePicoLCD114 } from "@devicescript/drivers"
const shield = new WaveSharePicoLCD114()

const gamepad = await shield.startGamepad()
const display = await shield.startDisplay()
+ + + + \ No newline at end of file diff --git a/devices/shields/xiao-expansion-board.html b/devices/shields/xiao-expansion-board.html new file mode 100644 index 00000000000..3c86816b04e --- /dev/null +++ b/devices/shields/xiao-expansion-board.html @@ -0,0 +1,22 @@ + + + + + +Xiao ESP32-C3 Expansion Board | DeviceScript + + + + + + + + +
+

Seeed Xiao ESP32-C3 Expansion board

Photograph of shield

DeviceScript import

You must import XiaoExpansionBoard to access the shield services.

In Visual Studio Code, +click the wand icon on the file menu and +select "Seeed Xiao ESP32-C3 Expansion board".

import { XiaoExpansionBoard } from "@devicescript/drivers"
const shield = new XiaoExpansionBoard()

const display = await shield.startDisplay()
const buzzer = await shield.startBuzzer()
const button = await shield.startButton()
+ + + + \ No newline at end of file diff --git a/dist/devicescript-compiler.js b/dist/devicescript-compiler.js new file mode 100644 index 00000000000..ba7ae7461c7 --- /dev/null +++ b/dist/devicescript-compiler.js @@ -0,0 +1,211166 @@ +(() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { + get: (a, b) => (typeof require !== "undefined" ? require : a)[b] + }) : x)(function(x) { + if (typeof require !== "undefined") + return require.apply(this, arguments); + throw new Error('Dynamic require of "' + x + '" is not supported'); + }); + var __commonJS = (cb, mod) => function __require2() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + + // (disabled):fs + var require_fs = __commonJS({ + "(disabled):fs"() { + } + }); + + // (disabled):path + var require_path = __commonJS({ + "(disabled):path"() { + } + }); + + // (disabled):os + var require_os = __commonJS({ + "(disabled):os"() { + } + }); + + // (disabled):node_modules/buffer/index.js + var require_buffer = __commonJS({ + "(disabled):node_modules/buffer/index.js"() { + } + }); + + // (disabled):node_modules/source-map-support/source-map-support.js + var require_source_map_support = __commonJS({ + "(disabled):node_modules/source-map-support/source-map-support.js"() { + } + }); + + // (disabled):inspector + var require_inspector = __commonJS({ + "(disabled):inspector"() { + } + }); + + // node_modules/typescript/lib/typescript.js + var require_typescript = __commonJS({ + "node_modules/typescript/lib/typescript.js"(exports, module) { + "use strict"; + var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + var __assign = exports && exports.__assign || function() { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + var __makeTemplateObject = exports && exports.__makeTemplateObject || function(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; + } + return cooked; + }; + var __generator = exports && exports.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) + throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) + throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) + try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) + return t; + if (y = 0, t) + op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) + _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __rest = exports && exports.__rest || function(s, e) { + var t = {}; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + var __extends = exports && exports.__extends || function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) + if (Object.prototype.hasOwnProperty.call(b2, p)) + d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var ts5; + (function(ts6) { + ts6.versionMajorMinor = "4.9"; + ts6.version = "".concat(ts6.versionMajorMinor, ".5"); + var Comparison; + (function(Comparison2) { + Comparison2[Comparison2["LessThan"] = -1] = "LessThan"; + Comparison2[Comparison2["EqualTo"] = 0] = "EqualTo"; + Comparison2[Comparison2["GreaterThan"] = 1] = "GreaterThan"; + })(Comparison = ts6.Comparison || (ts6.Comparison = {})); + var NativeCollections; + (function(NativeCollections2) { + var globals = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : void 0; + function tryGetNativeMap() { + var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : void 0; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; + } + NativeCollections2.tryGetNativeMap = tryGetNativeMap; + function tryGetNativeSet() { + var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : void 0; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; + } + NativeCollections2.tryGetNativeSet = tryGetNativeSet; + })(NativeCollections || (NativeCollections = {})); + ts6.Map = NativeCollections.tryGetNativeMap(); + ts6.Set = NativeCollections.tryGetNativeSet(); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getIterator(iterable) { + if (iterable) { + if (isArray(iterable)) + return arrayIterator(iterable); + if (iterable instanceof ts6.Map) + return iterable.entries(); + if (iterable instanceof ts6.Set) + return iterable.values(); + throw new Error("Iteration not supported."); + } + } + ts6.getIterator = getIterator; + ts6.emptyArray = []; + ts6.emptyMap = new ts6.Map(); + ts6.emptySet = new ts6.Set(); + function length(array) { + return array ? array.length : 0; + } + ts6.length = length; + function forEach(array, callback) { + if (array) { + for (var i = 0; i < array.length; i++) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + return void 0; + } + ts6.forEach = forEach; + function forEachRight(array, callback) { + if (array) { + for (var i = array.length - 1; i >= 0; i--) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + return void 0; + } + ts6.forEachRight = forEachRight; + function firstDefined(array, callback) { + if (array === void 0) { + return void 0; + } + for (var i = 0; i < array.length; i++) { + var result = callback(array[i], i); + if (result !== void 0) { + return result; + } + } + return void 0; + } + ts6.firstDefined = firstDefined; + function firstDefinedIterator(iter, callback) { + while (true) { + var iterResult = iter.next(); + if (iterResult.done) { + return void 0; + } + var result = callback(iterResult.value); + if (result !== void 0) { + return result; + } + } + } + ts6.firstDefinedIterator = firstDefinedIterator; + function reduceLeftIterator(iterator, f, initial) { + var result = initial; + if (iterator) { + for (var step = iterator.next(), pos = 0; !step.done; step = iterator.next(), pos++) { + result = f(result, step.value, pos); + } + } + return result; + } + ts6.reduceLeftIterator = reduceLeftIterator; + function zipWith(arrayA, arrayB, callback) { + var result = []; + ts6.Debug.assertEqual(arrayA.length, arrayB.length); + for (var i = 0; i < arrayA.length; i++) { + result.push(callback(arrayA[i], arrayB[i], i)); + } + return result; + } + ts6.zipWith = zipWith; + function zipToIterator(arrayA, arrayB) { + ts6.Debug.assertEqual(arrayA.length, arrayB.length); + var i = 0; + return { + next: function() { + if (i === arrayA.length) { + return { value: void 0, done: true }; + } + i++; + return { value: [arrayA[i - 1], arrayB[i - 1]], done: false }; + } + }; + } + ts6.zipToIterator = zipToIterator; + function zipToMap(keys, values) { + ts6.Debug.assert(keys.length === values.length); + var map2 = new ts6.Map(); + for (var i = 0; i < keys.length; ++i) { + map2.set(keys[i], values[i]); + } + return map2; + } + ts6.zipToMap = zipToMap; + function intersperse(input, element) { + if (input.length <= 1) { + return input; + } + var result = []; + for (var i = 0, n = input.length; i < n; i++) { + if (i) + result.push(element); + result.push(input[i]); + } + return result; + } + ts6.intersperse = intersperse; + function every(array, callback) { + if (array) { + for (var i = 0; i < array.length; i++) { + if (!callback(array[i], i)) { + return false; + } + } + } + return true; + } + ts6.every = every; + function find(array, predicate, startIndex) { + if (array === void 0) + return void 0; + for (var i = startIndex !== null && startIndex !== void 0 ? startIndex : 0; i < array.length; i++) { + var value = array[i]; + if (predicate(value, i)) { + return value; + } + } + return void 0; + } + ts6.find = find; + function findLast(array, predicate, startIndex) { + if (array === void 0) + return void 0; + for (var i = startIndex !== null && startIndex !== void 0 ? startIndex : array.length - 1; i >= 0; i--) { + var value = array[i]; + if (predicate(value, i)) { + return value; + } + } + return void 0; + } + ts6.findLast = findLast; + function findIndex(array, predicate, startIndex) { + if (array === void 0) + return -1; + for (var i = startIndex !== null && startIndex !== void 0 ? startIndex : 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts6.findIndex = findIndex; + function findLastIndex(array, predicate, startIndex) { + if (array === void 0) + return -1; + for (var i = startIndex !== null && startIndex !== void 0 ? startIndex : array.length - 1; i >= 0; i--) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts6.findLastIndex = findLastIndex; + function findMap(array, callback) { + for (var i = 0; i < array.length; i++) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + return ts6.Debug.fail(); + } + ts6.findMap = findMap; + function contains(array, value, equalityComparer) { + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } + if (array) { + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { + var v = array_1[_i]; + if (equalityComparer(v, value)) { + return true; + } + } + } + return false; + } + ts6.contains = contains; + function arraysEqual(a, b, equalityComparer) { + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } + return a.length === b.length && a.every(function(x, i) { + return equalityComparer(x, b[i]); + }); + } + ts6.arraysEqual = arraysEqual; + function indexOfAnyCharCode(text, charCodes, start) { + for (var i = start || 0; i < text.length; i++) { + if (contains(charCodes, text.charCodeAt(i))) { + return i; + } + } + return -1; + } + ts6.indexOfAnyCharCode = indexOfAnyCharCode; + function countWhere(array, predicate) { + var count = 0; + if (array) { + for (var i = 0; i < array.length; i++) { + var v = array[i]; + if (predicate(v, i)) { + count++; + } + } + } + return count; + } + ts6.countWhere = countWhere; + function filter(array, f) { + if (array) { + var len = array.length; + var i = 0; + while (i < len && f(array[i])) + i++; + if (i < len) { + var result = array.slice(0, i); + i++; + while (i < len) { + var item = array[i]; + if (f(item)) { + result.push(item); + } + i++; + } + return result; + } + } + return array; + } + ts6.filter = filter; + function filterMutate(array, f) { + var outIndex = 0; + for (var i = 0; i < array.length; i++) { + if (f(array[i], i, array)) { + array[outIndex] = array[i]; + outIndex++; + } + } + array.length = outIndex; + } + ts6.filterMutate = filterMutate; + function clear(array) { + array.length = 0; + } + ts6.clear = clear; + function map(array, f) { + var result; + if (array) { + result = []; + for (var i = 0; i < array.length; i++) { + result.push(f(array[i], i)); + } + } + return result; + } + ts6.map = map; + function mapIterator(iter, mapFn) { + return { + next: function() { + var iterRes = iter.next(); + return iterRes.done ? iterRes : { value: mapFn(iterRes.value), done: false }; + } + }; + } + ts6.mapIterator = mapIterator; + function sameMap(array, f) { + if (array) { + for (var i = 0; i < array.length; i++) { + var item = array[i]; + var mapped = f(item, i); + if (item !== mapped) { + var result = array.slice(0, i); + result.push(mapped); + for (i++; i < array.length; i++) { + result.push(f(array[i], i)); + } + return result; + } + } + } + return array; + } + ts6.sameMap = sameMap; + function flatten(array) { + var result = []; + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var v = array_2[_i]; + if (v) { + if (isArray(v)) { + addRange(result, v); + } else { + result.push(v); + } + } + } + return result; + } + ts6.flatten = flatten; + function flatMap(array, mapfn) { + var result; + if (array) { + for (var i = 0; i < array.length; i++) { + var v = mapfn(array[i], i); + if (v) { + if (isArray(v)) { + result = addRange(result, v); + } else { + result = append(result, v); + } + } + } + } + return result || ts6.emptyArray; + } + ts6.flatMap = flatMap; + function flatMapToMutable(array, mapfn) { + var result = []; + if (array) { + for (var i = 0; i < array.length; i++) { + var v = mapfn(array[i], i); + if (v) { + if (isArray(v)) { + addRange(result, v); + } else { + result.push(v); + } + } + } + } + return result; + } + ts6.flatMapToMutable = flatMapToMutable; + function flatMapIterator(iter, mapfn) { + var first2 = iter.next(); + if (first2.done) { + return ts6.emptyIterator; + } + var currentIter = getIterator2(first2.value); + return { + next: function() { + while (true) { + var currentRes = currentIter.next(); + if (!currentRes.done) { + return currentRes; + } + var iterRes = iter.next(); + if (iterRes.done) { + return iterRes; + } + currentIter = getIterator2(iterRes.value); + } + } + }; + function getIterator2(x) { + var res = mapfn(x); + return res === void 0 ? ts6.emptyIterator : isArray(res) ? arrayIterator(res) : res; + } + } + ts6.flatMapIterator = flatMapIterator; + function sameFlatMap(array, mapfn) { + var result; + if (array) { + for (var i = 0; i < array.length; i++) { + var item = array[i]; + var mapped = mapfn(item, i); + if (result || item !== mapped || isArray(mapped)) { + if (!result) { + result = array.slice(0, i); + } + if (isArray(mapped)) { + addRange(result, mapped); + } else { + result.push(mapped); + } + } + } + } + return result || array; + } + ts6.sameFlatMap = sameFlatMap; + function mapAllOrFail(array, mapFn) { + var result = []; + for (var i = 0; i < array.length; i++) { + var mapped = mapFn(array[i], i); + if (mapped === void 0) { + return void 0; + } + result.push(mapped); + } + return result; + } + ts6.mapAllOrFail = mapAllOrFail; + function mapDefined(array, mapFn) { + var result = []; + if (array) { + for (var i = 0; i < array.length; i++) { + var mapped = mapFn(array[i], i); + if (mapped !== void 0) { + result.push(mapped); + } + } + } + return result; + } + ts6.mapDefined = mapDefined; + function mapDefinedIterator(iter, mapFn) { + return { + next: function() { + while (true) { + var res = iter.next(); + if (res.done) { + return res; + } + var value = mapFn(res.value); + if (value !== void 0) { + return { value, done: false }; + } + } + } + }; + } + ts6.mapDefinedIterator = mapDefinedIterator; + function mapDefinedEntries(map2, f) { + if (!map2) { + return void 0; + } + var result = new ts6.Map(); + map2.forEach(function(value, key) { + var entry = f(key, value); + if (entry !== void 0) { + var newKey = entry[0], newValue = entry[1]; + if (newKey !== void 0 && newValue !== void 0) { + result.set(newKey, newValue); + } + } + }); + return result; + } + ts6.mapDefinedEntries = mapDefinedEntries; + function mapDefinedValues(set, f) { + if (set) { + var result_1 = new ts6.Set(); + set.forEach(function(value) { + var newValue = f(value); + if (newValue !== void 0) { + result_1.add(newValue); + } + }); + return result_1; + } + } + ts6.mapDefinedValues = mapDefinedValues; + function getOrUpdate(map2, key, callback) { + if (map2.has(key)) { + return map2.get(key); + } + var value = callback(); + map2.set(key, value); + return value; + } + ts6.getOrUpdate = getOrUpdate; + function tryAddToSet(set, value) { + if (!set.has(value)) { + set.add(value); + return true; + } + return false; + } + ts6.tryAddToSet = tryAddToSet; + ts6.emptyIterator = { next: function() { + return { value: void 0, done: true }; + } }; + function singleIterator(value) { + var done = false; + return { + next: function() { + var wasDone = done; + done = true; + return wasDone ? { value: void 0, done: true } : { value, done: false }; + } + }; + } + ts6.singleIterator = singleIterator; + function spanMap(array, keyfn, mapfn) { + var result; + if (array) { + result = []; + var len = array.length; + var previousKey = void 0; + var key = void 0; + var start = 0; + var pos = 0; + while (start < len) { + while (pos < len) { + var value = array[pos]; + key = keyfn(value, pos); + if (pos === 0) { + previousKey = key; + } else if (key !== previousKey) { + break; + } + pos++; + } + if (start < pos) { + var v = mapfn(array.slice(start, pos), previousKey, start, pos); + if (v) { + result.push(v); + } + start = pos; + } + previousKey = key; + pos++; + } + } + return result; + } + ts6.spanMap = spanMap; + function mapEntries(map2, f) { + if (!map2) { + return void 0; + } + var result = new ts6.Map(); + map2.forEach(function(value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); + return result; + } + ts6.mapEntries = mapEntries; + function some(array, predicate) { + if (array) { + if (predicate) { + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var v = array_3[_i]; + if (predicate(v)) { + return true; + } + } + } else { + return array.length > 0; + } + } + return false; + } + ts6.some = some; + function getRangesWhere(arr, pred, cb) { + var start; + for (var i = 0; i < arr.length; i++) { + if (pred(arr[i])) { + start = start === void 0 ? i : start; + } else { + if (start !== void 0) { + cb(start, i); + start = void 0; + } + } + } + if (start !== void 0) + cb(start, arr.length); + } + ts6.getRangesWhere = getRangesWhere; + function concatenate(array1, array2) { + if (!some(array2)) + return array1; + if (!some(array1)) + return array2; + return __spreadArray(__spreadArray([], array1, true), array2, true); + } + ts6.concatenate = concatenate; + function selectIndex(_, i) { + return i; + } + function indicesOf(array) { + return array.map(selectIndex); + } + ts6.indicesOf = indicesOf; + function deduplicateRelational(array, equalityComparer, comparer) { + var indices = indicesOf(array); + stableSortIndices(array, indices, comparer); + var last2 = array[indices[0]]; + var deduplicated = [indices[0]]; + for (var i = 1; i < indices.length; i++) { + var index = indices[i]; + var item = array[index]; + if (!equalityComparer(last2, item)) { + deduplicated.push(index); + last2 = item; + } + } + deduplicated.sort(); + return deduplicated.map(function(i2) { + return array[i2]; + }); + } + function deduplicateEquality(array, equalityComparer) { + var result = []; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var item = array_4[_i]; + pushIfUnique(result, item, equalityComparer); + } + return result; + } + function deduplicate(array, equalityComparer, comparer) { + return array.length === 0 ? [] : array.length === 1 ? array.slice() : comparer ? deduplicateRelational(array, equalityComparer, comparer) : deduplicateEquality(array, equalityComparer); + } + ts6.deduplicate = deduplicate; + function deduplicateSorted(array, comparer) { + if (array.length === 0) + return ts6.emptyArray; + var last2 = array[0]; + var deduplicated = [last2]; + for (var i = 1; i < array.length; i++) { + var next = array[i]; + switch (comparer(next, last2)) { + case true: + case 0: + continue; + case -1: + return ts6.Debug.fail("Array is unsorted."); + } + deduplicated.push(last2 = next); + } + return deduplicated; + } + function createSortedArray() { + return []; + } + ts6.createSortedArray = createSortedArray; + function insertSorted(array, insert, compare, allowDuplicates) { + if (array.length === 0) { + array.push(insert); + return true; + } + var insertIndex = binarySearch(array, insert, identity, compare); + if (insertIndex < 0) { + array.splice(~insertIndex, 0, insert); + return true; + } + if (allowDuplicates) { + array.splice(insertIndex, 0, insert); + return true; + } + return false; + } + ts6.insertSorted = insertSorted; + function sortAndDeduplicate(array, comparer, equalityComparer) { + return deduplicateSorted(sort(array, comparer), equalityComparer || comparer || compareStringsCaseSensitive); + } + ts6.sortAndDeduplicate = sortAndDeduplicate; + function arrayIsSorted(array, comparer) { + if (array.length < 2) + return true; + var prevElement = array[0]; + for (var _i = 0, _a = array.slice(1); _i < _a.length; _i++) { + var element = _a[_i]; + if (comparer(prevElement, element) === 1) { + return false; + } + prevElement = element; + } + return true; + } + ts6.arrayIsSorted = arrayIsSorted; + function arrayIsEqualTo(array1, array2, equalityComparer) { + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } + if (!array1 || !array2) { + return array1 === array2; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + if (!equalityComparer(array1[i], array2[i], i)) { + return false; + } + } + return true; + } + ts6.arrayIsEqualTo = arrayIsEqualTo; + function compact(array) { + var result; + if (array) { + for (var i = 0; i < array.length; i++) { + var v = array[i]; + if (result || !v) { + if (!result) { + result = array.slice(0, i); + } + if (v) { + result.push(v); + } + } + } + } + return result || array; + } + ts6.compact = compact; + function relativeComplement(arrayA, arrayB, comparer) { + if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0) + return arrayB; + var result = []; + loopB: + for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) { + if (offsetB > 0) { + ts6.Debug.assertGreaterThanOrEqual( + comparer(arrayB[offsetB], arrayB[offsetB - 1]), + 0 + /* Comparison.EqualTo */ + ); + } + loopA: + for (var startA = offsetA; offsetA < arrayA.length; offsetA++) { + if (offsetA > startA) { + ts6.Debug.assertGreaterThanOrEqual( + comparer(arrayA[offsetA], arrayA[offsetA - 1]), + 0 + /* Comparison.EqualTo */ + ); + } + switch (comparer(arrayB[offsetB], arrayA[offsetA])) { + case -1: + result.push(arrayB[offsetB]); + continue loopB; + case 0: + continue loopB; + case 1: + continue loopA; + } + } + } + return result; + } + ts6.relativeComplement = relativeComplement; + function sum(array, prop) { + var result = 0; + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var v = array_5[_i]; + result += v[prop]; + } + return result; + } + ts6.sum = sum; + function append(to, value) { + if (value === void 0) + return to; + if (to === void 0) + return [value]; + to.push(value); + return to; + } + ts6.append = append; + function combine(xs, ys) { + if (xs === void 0) + return ys; + if (ys === void 0) + return xs; + if (isArray(xs)) + return isArray(ys) ? concatenate(xs, ys) : append(xs, ys); + if (isArray(ys)) + return append(ys, xs); + return [xs, ys]; + } + ts6.combine = combine; + function toOffset(array, offset) { + return offset < 0 ? array.length + offset : offset; + } + function addRange(to, from, start, end) { + if (from === void 0 || from.length === 0) + return to; + if (to === void 0) + return from.slice(start, end); + start = start === void 0 ? 0 : toOffset(from, start); + end = end === void 0 ? from.length : toOffset(from, end); + for (var i = start; i < end && i < from.length; i++) { + if (from[i] !== void 0) { + to.push(from[i]); + } + } + return to; + } + ts6.addRange = addRange; + function pushIfUnique(array, toAdd, equalityComparer) { + if (contains(array, toAdd, equalityComparer)) { + return false; + } else { + array.push(toAdd); + return true; + } + } + ts6.pushIfUnique = pushIfUnique; + function appendIfUnique(array, toAdd, equalityComparer) { + if (array) { + pushIfUnique(array, toAdd, equalityComparer); + return array; + } else { + return [toAdd]; + } + } + ts6.appendIfUnique = appendIfUnique; + function stableSortIndices(array, indices, comparer) { + indices.sort(function(x, y) { + return comparer(array[x], array[y]) || compareValues(x, y); + }); + } + function sort(array, comparer) { + return array.length === 0 ? array : array.slice().sort(comparer); + } + ts6.sort = sort; + function arrayIterator(array) { + var i = 0; + return { next: function() { + if (i === array.length) { + return { value: void 0, done: true }; + } else { + i++; + return { value: array[i - 1], done: false }; + } + } }; + } + ts6.arrayIterator = arrayIterator; + function arrayReverseIterator(array) { + var i = array.length; + return { + next: function() { + if (i === 0) { + return { value: void 0, done: true }; + } else { + i--; + return { value: array[i], done: false }; + } + } + }; + } + ts6.arrayReverseIterator = arrayReverseIterator; + function stableSort(array, comparer) { + var indices = indicesOf(array); + stableSortIndices(array, indices, comparer); + return indices.map(function(i) { + return array[i]; + }); + } + ts6.stableSort = stableSort; + function rangeEquals(array1, array2, pos, end) { + while (pos < end) { + if (array1[pos] !== array2[pos]) { + return false; + } + pos++; + } + return true; + } + ts6.rangeEquals = rangeEquals; + function elementAt(array, offset) { + if (array) { + offset = toOffset(array, offset); + if (offset < array.length) { + return array[offset]; + } + } + return void 0; + } + ts6.elementAt = elementAt; + function firstOrUndefined(array) { + return array === void 0 || array.length === 0 ? void 0 : array[0]; + } + ts6.firstOrUndefined = firstOrUndefined; + function first(array) { + ts6.Debug.assert(array.length !== 0); + return array[0]; + } + ts6.first = first; + function lastOrUndefined(array) { + return array === void 0 || array.length === 0 ? void 0 : array[array.length - 1]; + } + ts6.lastOrUndefined = lastOrUndefined; + function last(array) { + ts6.Debug.assert(array.length !== 0); + return array[array.length - 1]; + } + ts6.last = last; + function singleOrUndefined(array) { + return array && array.length === 1 ? array[0] : void 0; + } + ts6.singleOrUndefined = singleOrUndefined; + function single(array) { + return ts6.Debug.checkDefined(singleOrUndefined(array)); + } + ts6.single = single; + function singleOrMany(array) { + return array && array.length === 1 ? array[0] : array; + } + ts6.singleOrMany = singleOrMany; + function replaceElement(array, index, value) { + var result = array.slice(0); + result[index] = value; + return result; + } + ts6.replaceElement = replaceElement; + function binarySearch(array, value, keySelector, keyComparer, offset) { + return binarySearchKey(array, keySelector(value), keySelector, keyComparer, offset); + } + ts6.binarySearch = binarySearch; + function binarySearchKey(array, key, keySelector, keyComparer, offset) { + if (!some(array)) { + return -1; + } + var low = offset || 0; + var high = array.length - 1; + while (low <= high) { + var middle = low + (high - low >> 1); + var midKey = keySelector(array[middle], middle); + switch (keyComparer(midKey, key)) { + case -1: + low = middle + 1; + break; + case 0: + return middle; + case 1: + high = middle - 1; + break; + } + } + return ~low; + } + ts6.binarySearchKey = binarySearchKey; + function reduceLeft(array, f, initial, start, count) { + if (array && array.length > 0) { + var size = array.length; + if (size > 0) { + var pos = start === void 0 || start < 0 ? 0 : start; + var end = count === void 0 || pos + count > size - 1 ? size - 1 : pos + count; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } else { + result = initial; + } + while (pos <= end) { + result = f(result, array[pos], pos); + pos++; + } + return result; + } + } + return initial; + } + ts6.reduceLeft = reduceLeft; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasProperty(map2, key) { + return hasOwnProperty.call(map2, key); + } + ts6.hasProperty = hasProperty; + function getProperty(map2, key) { + return hasOwnProperty.call(map2, key) ? map2[key] : void 0; + } + ts6.getProperty = getProperty; + function getOwnKeys(map2) { + var keys = []; + for (var key in map2) { + if (hasOwnProperty.call(map2, key)) { + keys.push(key); + } + } + return keys; + } + ts6.getOwnKeys = getOwnKeys; + function getAllKeys(obj) { + var result = []; + do { + var names = Object.getOwnPropertyNames(obj); + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name = names_1[_i]; + pushIfUnique(result, name); + } + } while (obj = Object.getPrototypeOf(obj)); + return result; + } + ts6.getAllKeys = getAllKeys; + function getOwnValues(collection) { + var values = []; + for (var key in collection) { + if (hasOwnProperty.call(collection, key)) { + values.push(collection[key]); + } + } + return values; + } + ts6.getOwnValues = getOwnValues; + var _entries = Object.entries || function(obj) { + var keys = getOwnKeys(obj); + var result = Array(keys.length); + for (var i = 0; i < keys.length; i++) { + result[i] = [keys[i], obj[keys[i]]]; + } + return result; + }; + function getEntries(obj) { + return obj ? _entries(obj) : []; + } + ts6.getEntries = getEntries; + function arrayOf(count, f) { + var result = new Array(count); + for (var i = 0; i < count; i++) { + result[i] = f(i); + } + return result; + } + ts6.arrayOf = arrayOf; + function arrayFrom(iterator, map2) { + var result = []; + for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) { + result.push(map2 ? map2(iterResult.value) : iterResult.value); + } + return result; + } + ts6.arrayFrom = arrayFrom; + function assign(t) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { + var arg = args_1[_a]; + if (arg === void 0) + continue; + for (var p in arg) { + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } + } + } + return t; + } + ts6.assign = assign; + function equalOwnProperties(left, right, equalityComparer) { + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } + if (left === right) + return true; + if (!left || !right) + return false; + for (var key in left) { + if (hasOwnProperty.call(left, key)) { + if (!hasOwnProperty.call(right, key)) + return false; + if (!equalityComparer(left[key], right[key])) + return false; + } + } + for (var key in right) { + if (hasOwnProperty.call(right, key)) { + if (!hasOwnProperty.call(left, key)) + return false; + } + } + return true; + } + ts6.equalOwnProperties = equalOwnProperties; + function arrayToMap(array, makeKey, makeValue) { + if (makeValue === void 0) { + makeValue = identity; + } + var result = new ts6.Map(); + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var value = array_6[_i]; + var key = makeKey(value); + if (key !== void 0) + result.set(key, makeValue(value)); + } + return result; + } + ts6.arrayToMap = arrayToMap; + function arrayToNumericMap(array, makeKey, makeValue) { + if (makeValue === void 0) { + makeValue = identity; + } + var result = []; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var value = array_7[_i]; + result[makeKey(value)] = makeValue(value); + } + return result; + } + ts6.arrayToNumericMap = arrayToNumericMap; + function arrayToMultiMap(values, makeKey, makeValue) { + if (makeValue === void 0) { + makeValue = identity; + } + var result = createMultiMap(); + for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { + var value = values_1[_i]; + result.add(makeKey(value), makeValue(value)); + } + return result; + } + ts6.arrayToMultiMap = arrayToMultiMap; + function group(values, getGroupId, resultSelector) { + if (resultSelector === void 0) { + resultSelector = identity; + } + return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector); + } + ts6.group = group; + function clone(object) { + var result = {}; + for (var id in object) { + if (hasOwnProperty.call(object, id)) { + result[id] = object[id]; + } + } + return result; + } + ts6.clone = clone; + function extend(first2, second) { + var result = {}; + for (var id in second) { + if (hasOwnProperty.call(second, id)) { + result[id] = second[id]; + } + } + for (var id in first2) { + if (hasOwnProperty.call(first2, id)) { + result[id] = first2[id]; + } + } + return result; + } + ts6.extend = extend; + function copyProperties(first2, second) { + for (var id in second) { + if (hasOwnProperty.call(second, id)) { + first2[id] = second[id]; + } + } + } + ts6.copyProperties = copyProperties; + function maybeBind(obj, fn) { + return fn ? fn.bind(obj) : void 0; + } + ts6.maybeBind = maybeBind; + function createMultiMap() { + var map2 = new ts6.Map(); + map2.add = multiMapAdd; + map2.remove = multiMapRemove; + return map2; + } + ts6.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); + if (values) { + values.push(value); + } else { + this.set(key, values = [value]); + } + return values; + } + function multiMapRemove(key, value) { + var values = this.get(key); + if (values) { + unorderedRemoveItem(values, value); + if (!values.length) { + this.delete(key); + } + } + } + function createUnderscoreEscapedMultiMap() { + return createMultiMap(); + } + ts6.createUnderscoreEscapedMultiMap = createUnderscoreEscapedMultiMap; + function createQueue(items) { + var elements = (items === null || items === void 0 ? void 0 : items.slice()) || []; + var headIndex = 0; + function isEmpty() { + return headIndex === elements.length; + } + function enqueue() { + var items2 = []; + for (var _i = 0; _i < arguments.length; _i++) { + items2[_i] = arguments[_i]; + } + elements.push.apply(elements, items2); + } + function dequeue() { + if (isEmpty()) { + throw new Error("Queue is empty"); + } + var result = elements[headIndex]; + elements[headIndex] = void 0; + headIndex++; + if (headIndex > 100 && headIndex > elements.length >> 1) { + var newLength = elements.length - headIndex; + elements.copyWithin( + /*target*/ + 0, + /*start*/ + headIndex + ); + elements.length = newLength; + headIndex = 0; + } + return result; + } + return { + enqueue, + dequeue, + isEmpty + }; + } + ts6.createQueue = createQueue; + function createSet(getHashCode, equals) { + var multiMap = new ts6.Map(); + var size = 0; + function getElementIterator() { + var valueIt = multiMap.values(); + var arrayIt; + return { + next: function() { + while (true) { + if (arrayIt) { + var n = arrayIt.next(); + if (!n.done) { + return { value: n.value }; + } + arrayIt = void 0; + } else { + var n = valueIt.next(); + if (n.done) { + return { value: void 0, done: true }; + } + if (!isArray(n.value)) { + return { value: n.value }; + } + arrayIt = arrayIterator(n.value); + } + } + } + }; + } + var set = { + has: function(element) { + var hash2 = getHashCode(element); + if (!multiMap.has(hash2)) + return false; + var candidates = multiMap.get(hash2); + if (!isArray(candidates)) + return equals(candidates, element); + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; + if (equals(candidate, element)) { + return true; + } + } + return false; + }, + add: function(element) { + var hash2 = getHashCode(element); + if (multiMap.has(hash2)) { + var values = multiMap.get(hash2); + if (isArray(values)) { + if (!contains(values, element, equals)) { + values.push(element); + size++; + } + } else { + var value = values; + if (!equals(value, element)) { + multiMap.set(hash2, [value, element]); + size++; + } + } + } else { + multiMap.set(hash2, element); + size++; + } + return this; + }, + delete: function(element) { + var hash2 = getHashCode(element); + if (!multiMap.has(hash2)) + return false; + var candidates = multiMap.get(hash2); + if (isArray(candidates)) { + for (var i = 0; i < candidates.length; i++) { + if (equals(candidates[i], element)) { + if (candidates.length === 1) { + multiMap.delete(hash2); + } else if (candidates.length === 2) { + multiMap.set(hash2, candidates[1 - i]); + } else { + unorderedRemoveItemAt(candidates, i); + } + size--; + return true; + } + } + } else { + var candidate = candidates; + if (equals(candidate, element)) { + multiMap.delete(hash2); + size--; + return true; + } + } + return false; + }, + clear: function() { + multiMap.clear(); + size = 0; + }, + get size() { + return size; + }, + forEach: function(action) { + for (var _i = 0, _a = arrayFrom(multiMap.values()); _i < _a.length; _i++) { + var elements = _a[_i]; + if (isArray(elements)) { + for (var _b = 0, elements_1 = elements; _b < elements_1.length; _b++) { + var element = elements_1[_b]; + action(element, element); + } + } else { + var element = elements; + action(element, element); + } + } + }, + keys: function() { + return getElementIterator(); + }, + values: function() { + return getElementIterator(); + }, + entries: function() { + var it = getElementIterator(); + return { + next: function() { + var n = it.next(); + return n.done ? n : { value: [n.value, n.value] }; + } + }; + } + }; + return set; + } + ts6.createSet = createSet; + function isArray(value) { + return Array.isArray ? Array.isArray(value) : value instanceof Array; + } + ts6.isArray = isArray; + function toArray2(value) { + return isArray(value) ? value : [value]; + } + ts6.toArray = toArray2; + function isString(text) { + return typeof text === "string"; + } + ts6.isString = isString; + function isNumber2(x) { + return typeof x === "number"; + } + ts6.isNumber = isNumber2; + function tryCast(value, test) { + return value !== void 0 && test(value) ? value : void 0; + } + ts6.tryCast = tryCast; + function cast(value, test) { + if (value !== void 0 && test(value)) + return value; + return ts6.Debug.fail("Invalid cast. The supplied value ".concat(value, " did not pass the test '").concat(ts6.Debug.getFunctionName(test), "'.")); + } + ts6.cast = cast; + function noop(_) { + } + ts6.noop = noop; + ts6.noopPush = { + push: noop, + length: 0 + }; + function returnFalse() { + return false; + } + ts6.returnFalse = returnFalse; + function returnTrue() { + return true; + } + ts6.returnTrue = returnTrue; + function returnUndefined() { + return void 0; + } + ts6.returnUndefined = returnUndefined; + function identity(x) { + return x; + } + ts6.identity = identity; + function toLowerCase(x) { + return x.toLowerCase(); + } + ts6.toLowerCase = toLowerCase; + var fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g; + function toFileNameLowerCase(x) { + return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x; + } + ts6.toFileNameLowerCase = toFileNameLowerCase; + function notImplemented() { + throw new Error("Not implemented"); + } + ts6.notImplemented = notImplemented; + function memoize(callback) { + var value; + return function() { + if (callback) { + value = callback(); + callback = void 0; + } + return value; + }; + } + ts6.memoize = memoize; + function memoizeOne(callback) { + var map2 = new ts6.Map(); + return function(arg) { + var key = "".concat(typeof arg, ":").concat(arg); + var value = map2.get(key); + if (value === void 0 && !map2.has(key)) { + value = callback(arg); + map2.set(key, value); + } + return value; + }; + } + ts6.memoizeOne = memoizeOne; + function compose(a, b, c, d, e) { + if (!!e) { + var args_2 = []; + for (var i = 0; i < arguments.length; i++) { + args_2[i] = arguments[i]; + } + return function(t) { + return reduceLeft(args_2, function(u, f) { + return f(u); + }, t); + }; + } else if (d) { + return function(t) { + return d(c(b(a(t)))); + }; + } else if (c) { + return function(t) { + return c(b(a(t))); + }; + } else if (b) { + return function(t) { + return b(a(t)); + }; + } else if (a) { + return function(t) { + return a(t); + }; + } else { + return function(t) { + return t; + }; + } + } + ts6.compose = compose; + var AssertionLevel; + (function(AssertionLevel2) { + AssertionLevel2[AssertionLevel2["None"] = 0] = "None"; + AssertionLevel2[AssertionLevel2["Normal"] = 1] = "Normal"; + AssertionLevel2[AssertionLevel2["Aggressive"] = 2] = "Aggressive"; + AssertionLevel2[AssertionLevel2["VeryAggressive"] = 3] = "VeryAggressive"; + })(AssertionLevel = ts6.AssertionLevel || (ts6.AssertionLevel = {})); + function equateValues(a, b) { + return a === b; + } + ts6.equateValues = equateValues; + function equateStringsCaseInsensitive(a, b) { + return a === b || a !== void 0 && b !== void 0 && a.toUpperCase() === b.toUpperCase(); + } + ts6.equateStringsCaseInsensitive = equateStringsCaseInsensitive; + function equateStringsCaseSensitive(a, b) { + return equateValues(a, b); + } + ts6.equateStringsCaseSensitive = equateStringsCaseSensitive; + function compareComparableValues(a, b) { + return a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : a < b ? -1 : 1; + } + function compareValues(a, b) { + return compareComparableValues(a, b); + } + ts6.compareValues = compareValues; + function compareTextSpans(a, b) { + return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); + } + ts6.compareTextSpans = compareTextSpans; + function min(items, compare) { + return reduceLeft(items, function(x, y) { + return compare(x, y) === -1 ? x : y; + }); + } + ts6.min = min; + function compareStringsCaseInsensitive(a, b) { + if (a === b) + return 0; + if (a === void 0) + return -1; + if (b === void 0) + return 1; + a = a.toUpperCase(); + b = b.toUpperCase(); + return a < b ? -1 : a > b ? 1 : 0; + } + ts6.compareStringsCaseInsensitive = compareStringsCaseInsensitive; + function compareStringsCaseSensitive(a, b) { + return compareComparableValues(a, b); + } + ts6.compareStringsCaseSensitive = compareStringsCaseSensitive; + function getStringComparer(ignoreCase) { + return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive; + } + ts6.getStringComparer = getStringComparer; + var createUIStringComparer = function() { + var defaultComparer; + var enUSComparer; + var stringComparerFactory = getStringComparerFactory(); + return createStringComparer; + function compareWithCallback(a, b, comparer) { + if (a === b) + return 0; + if (a === void 0) + return -1; + if (b === void 0) + return 1; + var value = comparer(a, b); + return value < 0 ? -1 : value > 0 ? 1 : 0; + } + function createIntlCollatorStringComparer(locale) { + var comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare; + return function(a, b) { + return compareWithCallback(a, b, comparer); + }; + } + function createLocaleCompareStringComparer(locale) { + if (locale !== void 0) + return createFallbackStringComparer(); + return function(a, b) { + return compareWithCallback(a, b, compareStrings); + }; + function compareStrings(a, b) { + return a.localeCompare(b); + } + } + function createFallbackStringComparer() { + return function(a, b) { + return compareWithCallback(a, b, compareDictionaryOrder); + }; + function compareDictionaryOrder(a, b) { + return compareStrings(a.toUpperCase(), b.toUpperCase()) || compareStrings(a, b); + } + function compareStrings(a, b) { + return a < b ? -1 : a > b ? 1 : 0; + } + } + function getStringComparerFactory() { + if (typeof Intl === "object" && typeof Intl.Collator === "function") { + return createIntlCollatorStringComparer; + } + if (typeof String.prototype.localeCompare === "function" && typeof String.prototype.toLocaleUpperCase === "function" && "a".localeCompare("B") < 0) { + return createLocaleCompareStringComparer; + } + return createFallbackStringComparer; + } + function createStringComparer(locale) { + if (locale === void 0) { + return defaultComparer || (defaultComparer = stringComparerFactory(locale)); + } else if (locale === "en-US") { + return enUSComparer || (enUSComparer = stringComparerFactory(locale)); + } else { + return stringComparerFactory(locale); + } + } + }(); + var uiComparerCaseSensitive; + var uiLocale; + function getUILocale() { + return uiLocale; + } + ts6.getUILocale = getUILocale; + function setUILocale(value) { + if (uiLocale !== value) { + uiLocale = value; + uiComparerCaseSensitive = void 0; + } + } + ts6.setUILocale = setUILocale; + function compareStringsCaseSensitiveUI(a, b) { + var comparer = uiComparerCaseSensitive || (uiComparerCaseSensitive = createUIStringComparer(uiLocale)); + return comparer(a, b); + } + ts6.compareStringsCaseSensitiveUI = compareStringsCaseSensitiveUI; + function compareProperties(a, b, key, comparer) { + return a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : comparer(a[key], b[key]); + } + ts6.compareProperties = compareProperties; + function compareBooleans(a, b) { + return compareValues(a ? 1 : 0, b ? 1 : 0); + } + ts6.compareBooleans = compareBooleans; + function getSpellingSuggestion(name, candidates, getName) { + var maximumLengthDifference = Math.max(2, Math.floor(name.length * 0.34)); + var bestDistance = Math.floor(name.length * 0.4) + 1; + var bestCandidate; + for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { + var candidate = candidates_2[_i]; + var candidateName = getName(candidate); + if (candidateName !== void 0 && Math.abs(candidateName.length - name.length) <= maximumLengthDifference) { + if (candidateName === name) { + continue; + } + if (candidateName.length < 3 && candidateName.toLowerCase() !== name.toLowerCase()) { + continue; + } + var distance = levenshteinWithMax(name, candidateName, bestDistance - 0.1); + if (distance === void 0) { + continue; + } + ts6.Debug.assert(distance < bestDistance); + bestDistance = distance; + bestCandidate = candidate; + } + } + return bestCandidate; + } + ts6.getSpellingSuggestion = getSpellingSuggestion; + function levenshteinWithMax(s1, s2, max) { + var previous = new Array(s2.length + 1); + var current = new Array(s2.length + 1); + var big = max + 0.01; + for (var i = 0; i <= s2.length; i++) { + previous[i] = i; + } + for (var i = 1; i <= s1.length; i++) { + var c1 = s1.charCodeAt(i - 1); + var minJ = Math.ceil(i > max ? i - max : 1); + var maxJ = Math.floor(s2.length > max + i ? max + i : s2.length); + current[0] = i; + var colMin = i; + for (var j = 1; j < minJ; j++) { + current[j] = big; + } + for (var j = minJ; j <= maxJ; j++) { + var substitutionDistance = s1[i - 1].toLowerCase() === s2[j - 1].toLowerCase() ? previous[j - 1] + 0.1 : previous[j - 1] + 2; + var dist = c1 === s2.charCodeAt(j - 1) ? previous[j - 1] : Math.min( + /*delete*/ + previous[j] + 1, + /*insert*/ + current[j - 1] + 1, + /*substitute*/ + substitutionDistance + ); + current[j] = dist; + colMin = Math.min(colMin, dist); + } + for (var j = maxJ + 1; j <= s2.length; j++) { + current[j] = big; + } + if (colMin > max) { + return void 0; + } + var temp = previous; + previous = current; + current = temp; + } + var res = previous[s2.length]; + return res > max ? void 0 : res; + } + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos; + } + ts6.endsWith = endsWith; + function removeSuffix(str, suffix) { + return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str; + } + ts6.removeSuffix = removeSuffix; + function tryRemoveSuffix(str, suffix) { + return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : void 0; + } + ts6.tryRemoveSuffix = tryRemoveSuffix; + function stringContains(str, substring) { + return str.indexOf(substring) !== -1; + } + ts6.stringContains = stringContains; + function removeMinAndVersionNumbers(fileName) { + var end = fileName.length; + for (var pos = end - 1; pos > 0; pos--) { + var ch = fileName.charCodeAt(pos); + if (ch >= 48 && ch <= 57) { + do { + --pos; + ch = fileName.charCodeAt(pos); + } while (pos > 0 && ch >= 48 && ch <= 57); + } else if (pos > 4 && (ch === 110 || ch === 78)) { + --pos; + ch = fileName.charCodeAt(pos); + if (ch !== 105 && ch !== 73) { + break; + } + --pos; + ch = fileName.charCodeAt(pos); + if (ch !== 109 && ch !== 77) { + break; + } + --pos; + ch = fileName.charCodeAt(pos); + } else { + break; + } + if (ch !== 45 && ch !== 46) { + break; + } + end = pos; + } + return end === fileName.length ? fileName : fileName.slice(0, end); + } + ts6.removeMinAndVersionNumbers = removeMinAndVersionNumbers; + function orderedRemoveItem(array, item) { + for (var i = 0; i < array.length; i++) { + if (array[i] === item) { + orderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + ts6.orderedRemoveItem = orderedRemoveItem; + function orderedRemoveItemAt(array, index) { + for (var i = index; i < array.length - 1; i++) { + array[i] = array[i + 1]; + } + array.pop(); + } + ts6.orderedRemoveItemAt = orderedRemoveItemAt; + function unorderedRemoveItemAt(array, index) { + array[index] = array[array.length - 1]; + array.pop(); + } + ts6.unorderedRemoveItemAt = unorderedRemoveItemAt; + function unorderedRemoveItem(array, item) { + return unorderedRemoveFirstItemWhere(array, function(element) { + return element === item; + }); + } + ts6.unorderedRemoveItem = unorderedRemoveItem; + function unorderedRemoveFirstItemWhere(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i])) { + unorderedRemoveItemAt(array, i); + return true; + } + } + return false; + } + function createGetCanonicalFileName(useCaseSensitiveFileNames) { + return useCaseSensitiveFileNames ? identity : toFileNameLowerCase; + } + ts6.createGetCanonicalFileName = createGetCanonicalFileName; + function patternText(_a) { + var prefix2 = _a.prefix, suffix = _a.suffix; + return "".concat(prefix2, "*").concat(suffix); + } + ts6.patternText = patternText; + function matchedText(pattern, candidate) { + ts6.Debug.assert(isPatternMatch(pattern, candidate)); + return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length); + } + ts6.matchedText = matchedText; + function findBestPatternMatch(values, getPattern, candidate) { + var matchedValue; + var longestMatchPrefixLength = -1; + for (var _i = 0, values_2 = values; _i < values_2.length; _i++) { + var v = values_2[_i]; + var pattern = getPattern(v); + if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = pattern.prefix.length; + matchedValue = v; + } + } + return matchedValue; + } + ts6.findBestPatternMatch = findBestPatternMatch; + function startsWith(str, prefix2) { + return str.lastIndexOf(prefix2, 0) === 0; + } + ts6.startsWith = startsWith; + function removePrefix(str, prefix2) { + return startsWith(str, prefix2) ? str.substr(prefix2.length) : str; + } + ts6.removePrefix = removePrefix; + function tryRemovePrefix(str, prefix2, getCanonicalFileName) { + if (getCanonicalFileName === void 0) { + getCanonicalFileName = identity; + } + return startsWith(getCanonicalFileName(str), getCanonicalFileName(prefix2)) ? str.substring(prefix2.length) : void 0; + } + ts6.tryRemovePrefix = tryRemovePrefix; + function isPatternMatch(_a, candidate) { + var prefix2 = _a.prefix, suffix = _a.suffix; + return candidate.length >= prefix2.length + suffix.length && startsWith(candidate, prefix2) && endsWith(candidate, suffix); + } + ts6.isPatternMatch = isPatternMatch; + function and(f, g) { + return function(arg) { + return f(arg) && g(arg); + }; + } + ts6.and = and; + function or() { + var fs = []; + for (var _i = 0; _i < arguments.length; _i++) { + fs[_i] = arguments[_i]; + } + return function() { + var args = []; + for (var _i2 = 0; _i2 < arguments.length; _i2++) { + args[_i2] = arguments[_i2]; + } + var lastResult; + for (var _a = 0, fs_1 = fs; _a < fs_1.length; _a++) { + var f = fs_1[_a]; + lastResult = f.apply(void 0, args); + if (lastResult) { + return lastResult; + } + } + return lastResult; + }; + } + ts6.or = or; + function not(fn) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return !fn.apply(void 0, args); + }; + } + ts6.not = not; + function assertType(_) { + } + ts6.assertType = assertType; + function singleElementArray(t) { + return t === void 0 ? void 0 : [t]; + } + ts6.singleElementArray = singleElementArray; + function enumerateInsertsAndDeletes(newItems, oldItems, comparer, inserted, deleted, unchanged) { + unchanged = unchanged || noop; + var newIndex = 0; + var oldIndex = 0; + var newLen = newItems.length; + var oldLen = oldItems.length; + var hasChanges = false; + while (newIndex < newLen && oldIndex < oldLen) { + var newItem = newItems[newIndex]; + var oldItem = oldItems[oldIndex]; + var compareResult = comparer(newItem, oldItem); + if (compareResult === -1) { + inserted(newItem); + newIndex++; + hasChanges = true; + } else if (compareResult === 1) { + deleted(oldItem); + oldIndex++; + hasChanges = true; + } else { + unchanged(oldItem, newItem); + newIndex++; + oldIndex++; + } + } + while (newIndex < newLen) { + inserted(newItems[newIndex++]); + hasChanges = true; + } + while (oldIndex < oldLen) { + deleted(oldItems[oldIndex++]); + hasChanges = true; + } + return hasChanges; + } + ts6.enumerateInsertsAndDeletes = enumerateInsertsAndDeletes; + function fill(length2, cb) { + var result = Array(length2); + for (var i = 0; i < length2; i++) { + result[i] = cb(i); + } + return result; + } + ts6.fill = fill; + function cartesianProduct(arrays) { + var result = []; + cartesianProductWorker( + arrays, + result, + /*outer*/ + void 0, + 0 + ); + return result; + } + ts6.cartesianProduct = cartesianProduct; + function cartesianProductWorker(arrays, result, outer, index) { + for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) { + var element = _a[_i]; + var inner = void 0; + if (outer) { + inner = outer.slice(); + inner.push(element); + } else { + inner = [element]; + } + if (index === arrays.length - 1) { + result.push(inner); + } else { + cartesianProductWorker(arrays, result, inner, index + 1); + } + } + } + function padLeft(s, length2, padString) { + if (padString === void 0) { + padString = " "; + } + return length2 <= s.length ? s : padString.repeat(length2 - s.length) + s; + } + ts6.padLeft = padLeft; + function padRight(s, length2, padString) { + if (padString === void 0) { + padString = " "; + } + return length2 <= s.length ? s : s + padString.repeat(length2 - s.length); + } + ts6.padRight = padRight; + function takeWhile(array, predicate) { + var len = array.length; + var index = 0; + while (index < len && predicate(array[index])) { + index++; + } + return array.slice(0, index); + } + ts6.takeWhile = takeWhile; + ts6.trimString = !!String.prototype.trim ? function(s) { + return s.trim(); + } : function(s) { + return ts6.trimStringEnd(ts6.trimStringStart(s)); + }; + ts6.trimStringEnd = !!String.prototype.trimEnd ? function(s) { + return s.trimEnd(); + } : trimEndImpl; + ts6.trimStringStart = !!String.prototype.trimStart ? function(s) { + return s.trimStart(); + } : function(s) { + return s.replace(/^\s+/g, ""); + }; + function trimEndImpl(s) { + var end = s.length - 1; + while (end >= 0) { + if (!ts6.isWhiteSpaceLike(s.charCodeAt(end))) + break; + end--; + } + return s.slice(0, end + 1); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var LogLevel; + (function(LogLevel2) { + LogLevel2[LogLevel2["Off"] = 0] = "Off"; + LogLevel2[LogLevel2["Error"] = 1] = "Error"; + LogLevel2[LogLevel2["Warning"] = 2] = "Warning"; + LogLevel2[LogLevel2["Info"] = 3] = "Info"; + LogLevel2[LogLevel2["Verbose"] = 4] = "Verbose"; + })(LogLevel = ts6.LogLevel || (ts6.LogLevel = {})); + var Debug; + (function(Debug2) { + var typeScriptVersion; + var currentAssertionLevel = 0; + Debug2.currentLogLevel = LogLevel.Warning; + Debug2.isDebugging = false; + Debug2.enableDeprecationWarnings = true; + function getTypeScriptVersion() { + return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : typeScriptVersion = new ts6.Version(ts6.version); + } + Debug2.getTypeScriptVersion = getTypeScriptVersion; + function shouldLog(level) { + return Debug2.currentLogLevel <= level; + } + Debug2.shouldLog = shouldLog; + function logMessage(level, s) { + if (Debug2.loggingHost && shouldLog(level)) { + Debug2.loggingHost.log(level, s); + } + } + function log(s) { + logMessage(LogLevel.Info, s); + } + Debug2.log = log; + (function(log_1) { + function error(s) { + logMessage(LogLevel.Error, s); + } + log_1.error = error; + function warn2(s) { + logMessage(LogLevel.Warning, s); + } + log_1.warn = warn2; + function log2(s) { + logMessage(LogLevel.Info, s); + } + log_1.log = log2; + function trace2(s) { + logMessage(LogLevel.Verbose, s); + } + log_1.trace = trace2; + })(log = Debug2.log || (Debug2.log = {})); + var assertionCache = {}; + function getAssertionLevel() { + return currentAssertionLevel; + } + Debug2.getAssertionLevel = getAssertionLevel; + function setAssertionLevel(level) { + var prevAssertionLevel = currentAssertionLevel; + currentAssertionLevel = level; + if (level > prevAssertionLevel) { + for (var _i = 0, _a = ts6.getOwnKeys(assertionCache); _i < _a.length; _i++) { + var key = _a[_i]; + var cachedFunc = assertionCache[key]; + if (cachedFunc !== void 0 && Debug2[key] !== cachedFunc.assertion && level >= cachedFunc.level) { + Debug2[key] = cachedFunc; + assertionCache[key] = void 0; + } + } + } + } + Debug2.setAssertionLevel = setAssertionLevel; + function shouldAssert(level) { + return currentAssertionLevel >= level; + } + Debug2.shouldAssert = shouldAssert; + function shouldAssertFunction(level, name) { + if (!shouldAssert(level)) { + assertionCache[name] = { level, assertion: Debug2[name] }; + Debug2[name] = ts6.noop; + return false; + } + return true; + } + function fail(message, stackCrawlMark) { + debugger; + var e = new Error(message ? "Debug Failure. ".concat(message) : "Debug Failure."); + if (Error.captureStackTrace) { + Error.captureStackTrace(e, stackCrawlMark || fail); + } + throw e; + } + Debug2.fail = fail; + function failBadSyntaxKind(node, message, stackCrawlMark) { + return fail("".concat(message || "Unexpected node.", "\r\nNode ").concat(formatSyntaxKind(node.kind), " was unexpected."), stackCrawlMark || failBadSyntaxKind); + } + Debug2.failBadSyntaxKind = failBadSyntaxKind; + function assert3(expression, message, verboseDebugInfo, stackCrawlMark) { + if (!expression) { + message = message ? "False expression: ".concat(message) : "False expression."; + if (verboseDebugInfo) { + message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo()); + } + fail(message, stackCrawlMark || assert3); + } + } + Debug2.assert = assert3; + function assertEqual(a, b, msg, msg2, stackCrawlMark) { + if (a !== b) { + var message = msg ? msg2 ? "".concat(msg, " ").concat(msg2) : msg : ""; + fail("Expected ".concat(a, " === ").concat(b, ". ").concat(message), stackCrawlMark || assertEqual); + } + } + Debug2.assertEqual = assertEqual; + function assertLessThan(a, b, msg, stackCrawlMark) { + if (a >= b) { + fail("Expected ".concat(a, " < ").concat(b, ". ").concat(msg || ""), stackCrawlMark || assertLessThan); + } + } + Debug2.assertLessThan = assertLessThan; + function assertLessThanOrEqual(a, b, stackCrawlMark) { + if (a > b) { + fail("Expected ".concat(a, " <= ").concat(b), stackCrawlMark || assertLessThanOrEqual); + } + } + Debug2.assertLessThanOrEqual = assertLessThanOrEqual; + function assertGreaterThanOrEqual(a, b, stackCrawlMark) { + if (a < b) { + fail("Expected ".concat(a, " >= ").concat(b), stackCrawlMark || assertGreaterThanOrEqual); + } + } + Debug2.assertGreaterThanOrEqual = assertGreaterThanOrEqual; + function assertIsDefined(value, message, stackCrawlMark) { + if (value === void 0 || value === null) { + fail(message, stackCrawlMark || assertIsDefined); + } + } + Debug2.assertIsDefined = assertIsDefined; + function checkDefined(value, message, stackCrawlMark) { + assertIsDefined(value, message, stackCrawlMark || checkDefined); + return value; + } + Debug2.checkDefined = checkDefined; + function assertEachIsDefined(value, message, stackCrawlMark) { + for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { + var v = value_1[_i]; + assertIsDefined(v, message, stackCrawlMark || assertEachIsDefined); + } + } + Debug2.assertEachIsDefined = assertEachIsDefined; + function checkEachDefined(value, message, stackCrawlMark) { + assertEachIsDefined(value, message, stackCrawlMark || checkEachDefined); + return value; + } + Debug2.checkEachDefined = checkEachDefined; + function assertNever(member, message, stackCrawlMark) { + if (message === void 0) { + message = "Illegal value:"; + } + var detail = typeof member === "object" && ts6.hasProperty(member, "kind") && ts6.hasProperty(member, "pos") ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member); + return fail("".concat(message, " ").concat(detail), stackCrawlMark || assertNever); + } + Debug2.assertNever = assertNever; + function assertEachNode(nodes, test, message, stackCrawlMark) { + if (shouldAssertFunction(1, "assertEachNode")) { + assert3(test === void 0 || ts6.every(nodes, test), message || "Unexpected node.", function() { + return "Node array did not pass test '".concat(getFunctionName(test), "'."); + }, stackCrawlMark || assertEachNode); + } + } + Debug2.assertEachNode = assertEachNode; + function assertNode(node, test, message, stackCrawlMark) { + if (shouldAssertFunction(1, "assertNode")) { + assert3(node !== void 0 && (test === void 0 || test(node)), message || "Unexpected node.", function() { + return "Node ".concat(formatSyntaxKind(node === null || node === void 0 ? void 0 : node.kind), " did not pass test '").concat(getFunctionName(test), "'."); + }, stackCrawlMark || assertNode); + } + } + Debug2.assertNode = assertNode; + function assertNotNode(node, test, message, stackCrawlMark) { + if (shouldAssertFunction(1, "assertNotNode")) { + assert3(node === void 0 || test === void 0 || !test(node), message || "Unexpected node.", function() { + return "Node ".concat(formatSyntaxKind(node.kind), " should not have passed test '").concat(getFunctionName(test), "'."); + }, stackCrawlMark || assertNotNode); + } + } + Debug2.assertNotNode = assertNotNode; + function assertOptionalNode(node, test, message, stackCrawlMark) { + if (shouldAssertFunction(1, "assertOptionalNode")) { + assert3(test === void 0 || node === void 0 || test(node), message || "Unexpected node.", function() { + return "Node ".concat(formatSyntaxKind(node === null || node === void 0 ? void 0 : node.kind), " did not pass test '").concat(getFunctionName(test), "'."); + }, stackCrawlMark || assertOptionalNode); + } + } + Debug2.assertOptionalNode = assertOptionalNode; + function assertOptionalToken(node, kind, message, stackCrawlMark) { + if (shouldAssertFunction(1, "assertOptionalToken")) { + assert3(kind === void 0 || node === void 0 || node.kind === kind, message || "Unexpected node.", function() { + return "Node ".concat(formatSyntaxKind(node === null || node === void 0 ? void 0 : node.kind), " was not a '").concat(formatSyntaxKind(kind), "' token."); + }, stackCrawlMark || assertOptionalToken); + } + } + Debug2.assertOptionalToken = assertOptionalToken; + function assertMissingNode(node, message, stackCrawlMark) { + if (shouldAssertFunction(1, "assertMissingNode")) { + assert3(node === void 0, message || "Unexpected node.", function() { + return "Node ".concat(formatSyntaxKind(node.kind), " was unexpected'."); + }, stackCrawlMark || assertMissingNode); + } + } + Debug2.assertMissingNode = assertMissingNode; + function type(_value) { + } + Debug2.type = type; + function getFunctionName(func) { + if (typeof func !== "function") { + return ""; + } else if (ts6.hasProperty(func, "name")) { + return func.name; + } else { + var text = Function.prototype.toString.call(func); + var match = /^function\s+([\w\$]+)\s*\(/.exec(text); + return match ? match[1] : ""; + } + } + Debug2.getFunctionName = getFunctionName; + function formatSymbol(symbol) { + return "{ name: ".concat(ts6.unescapeLeadingUnderscores(symbol.escapedName), "; flags: ").concat(formatSymbolFlags(symbol.flags), "; declarations: ").concat(ts6.map(symbol.declarations, function(node) { + return formatSyntaxKind(node.kind); + }), " }"); + } + Debug2.formatSymbol = formatSymbol; + function formatEnum(value, enumObject, isFlags) { + if (value === void 0) { + value = 0; + } + var members = getEnumMembers(enumObject); + if (value === 0) { + return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; + } + if (isFlags) { + var result = []; + var remainingFlags = value; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var _a = members_1[_i], enumValue = _a[0], enumName2 = _a[1]; + if (enumValue > value) { + break; + } + if (enumValue !== 0 && enumValue & value) { + result.push(enumName2); + remainingFlags &= ~enumValue; + } + } + if (remainingFlags === 0) { + return result.join("|"); + } + } else { + for (var _b = 0, members_2 = members; _b < members_2.length; _b++) { + var _c = members_2[_b], enumValue = _c[0], enumName2 = _c[1]; + if (enumValue === value) { + return enumName2; + } + } + } + return value.toString(); + } + Debug2.formatEnum = formatEnum; + var enumMemberCache = new ts6.Map(); + function getEnumMembers(enumObject) { + var existing = enumMemberCache.get(enumObject); + if (existing) { + return existing; + } + var result = []; + for (var name in enumObject) { + var value = enumObject[name]; + if (typeof value === "number") { + result.push([value, name]); + } + } + var sorted = ts6.stableSort(result, function(x, y) { + return ts6.compareValues(x[0], y[0]); + }); + enumMemberCache.set(enumObject, sorted); + return sorted; + } + function formatSyntaxKind(kind) { + return formatEnum( + kind, + ts6.SyntaxKind, + /*isFlags*/ + false + ); + } + Debug2.formatSyntaxKind = formatSyntaxKind; + function formatSnippetKind(kind) { + return formatEnum( + kind, + ts6.SnippetKind, + /*isFlags*/ + false + ); + } + Debug2.formatSnippetKind = formatSnippetKind; + function formatNodeFlags(flags) { + return formatEnum( + flags, + ts6.NodeFlags, + /*isFlags*/ + true + ); + } + Debug2.formatNodeFlags = formatNodeFlags; + function formatModifierFlags(flags) { + return formatEnum( + flags, + ts6.ModifierFlags, + /*isFlags*/ + true + ); + } + Debug2.formatModifierFlags = formatModifierFlags; + function formatTransformFlags(flags) { + return formatEnum( + flags, + ts6.TransformFlags, + /*isFlags*/ + true + ); + } + Debug2.formatTransformFlags = formatTransformFlags; + function formatEmitFlags(flags) { + return formatEnum( + flags, + ts6.EmitFlags, + /*isFlags*/ + true + ); + } + Debug2.formatEmitFlags = formatEmitFlags; + function formatSymbolFlags(flags) { + return formatEnum( + flags, + ts6.SymbolFlags, + /*isFlags*/ + true + ); + } + Debug2.formatSymbolFlags = formatSymbolFlags; + function formatTypeFlags(flags) { + return formatEnum( + flags, + ts6.TypeFlags, + /*isFlags*/ + true + ); + } + Debug2.formatTypeFlags = formatTypeFlags; + function formatSignatureFlags(flags) { + return formatEnum( + flags, + ts6.SignatureFlags, + /*isFlags*/ + true + ); + } + Debug2.formatSignatureFlags = formatSignatureFlags; + function formatObjectFlags(flags) { + return formatEnum( + flags, + ts6.ObjectFlags, + /*isFlags*/ + true + ); + } + Debug2.formatObjectFlags = formatObjectFlags; + function formatFlowFlags(flags) { + return formatEnum( + flags, + ts6.FlowFlags, + /*isFlags*/ + true + ); + } + Debug2.formatFlowFlags = formatFlowFlags; + function formatRelationComparisonResult(result) { + return formatEnum( + result, + ts6.RelationComparisonResult, + /*isFlags*/ + true + ); + } + Debug2.formatRelationComparisonResult = formatRelationComparisonResult; + function formatCheckMode(mode) { + return formatEnum( + mode, + ts6.CheckMode, + /*isFlags*/ + true + ); + } + Debug2.formatCheckMode = formatCheckMode; + function formatSignatureCheckMode(mode) { + return formatEnum( + mode, + ts6.SignatureCheckMode, + /*isFlags*/ + true + ); + } + Debug2.formatSignatureCheckMode = formatSignatureCheckMode; + function formatTypeFacts(facts) { + return formatEnum( + facts, + ts6.TypeFacts, + /*isFlags*/ + true + ); + } + Debug2.formatTypeFacts = formatTypeFacts; + var isDebugInfoEnabled = false; + var extendedDebugModule; + function extendedDebug() { + enableDebugInfo(); + if (!extendedDebugModule) { + throw new Error("Debugging helpers could not be loaded."); + } + return extendedDebugModule; + } + function printControlFlowGraph(flowNode) { + return console.log(formatControlFlowGraph(flowNode)); + } + Debug2.printControlFlowGraph = printControlFlowGraph; + function formatControlFlowGraph(flowNode) { + return extendedDebug().formatControlFlowGraph(flowNode); + } + Debug2.formatControlFlowGraph = formatControlFlowGraph; + var flowNodeProto; + function attachFlowNodeDebugInfoWorker(flowNode) { + if (!("__debugFlowFlags" in flowNode)) { + Object.defineProperties(flowNode, { + // for use with vscode-js-debug's new customDescriptionGenerator in launch.json + __tsDebuggerDisplay: { + value: function() { + var flowHeader = this.flags & 2 ? "FlowStart" : this.flags & 4 ? "FlowBranchLabel" : this.flags & 8 ? "FlowLoopLabel" : this.flags & 16 ? "FlowAssignment" : this.flags & 32 ? "FlowTrueCondition" : this.flags & 64 ? "FlowFalseCondition" : this.flags & 128 ? "FlowSwitchClause" : this.flags & 256 ? "FlowArrayMutation" : this.flags & 512 ? "FlowCall" : this.flags & 1024 ? "FlowReduceLabel" : this.flags & 1 ? "FlowUnreachable" : "UnknownFlow"; + var remainingFlags = this.flags & ~(2048 - 1); + return "".concat(flowHeader).concat(remainingFlags ? " (".concat(formatFlowFlags(remainingFlags), ")") : ""); + } + }, + __debugFlowFlags: { get: function() { + return formatEnum( + this.flags, + ts6.FlowFlags, + /*isFlags*/ + true + ); + } }, + __debugToString: { value: function() { + return formatControlFlowGraph(this); + } } + }); + } + } + function attachFlowNodeDebugInfo(flowNode) { + if (isDebugInfoEnabled) { + if (typeof Object.setPrototypeOf === "function") { + if (!flowNodeProto) { + flowNodeProto = Object.create(Object.prototype); + attachFlowNodeDebugInfoWorker(flowNodeProto); + } + Object.setPrototypeOf(flowNode, flowNodeProto); + } else { + attachFlowNodeDebugInfoWorker(flowNode); + } + } + } + Debug2.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; + var nodeArrayProto; + function attachNodeArrayDebugInfoWorker(array) { + if (!("__tsDebuggerDisplay" in array)) { + Object.defineProperties(array, { + __tsDebuggerDisplay: { + value: function(defaultValue) { + defaultValue = String(defaultValue).replace(/(?:,[\s\w\d_]+:[^,]+)+\]$/, "]"); + return "NodeArray ".concat(defaultValue); + } + } + }); + } + } + function attachNodeArrayDebugInfo(array) { + if (isDebugInfoEnabled) { + if (typeof Object.setPrototypeOf === "function") { + if (!nodeArrayProto) { + nodeArrayProto = Object.create(Array.prototype); + attachNodeArrayDebugInfoWorker(nodeArrayProto); + } + Object.setPrototypeOf(array, nodeArrayProto); + } else { + attachNodeArrayDebugInfoWorker(array); + } + } + } + Debug2.attachNodeArrayDebugInfo = attachNodeArrayDebugInfo; + function enableDebugInfo() { + if (isDebugInfoEnabled) + return; + var weakTypeTextMap; + var weakNodeTextMap; + function getWeakTypeTextMap() { + if (weakTypeTextMap === void 0) { + if (typeof WeakMap === "function") + weakTypeTextMap = /* @__PURE__ */ new WeakMap(); + } + return weakTypeTextMap; + } + function getWeakNodeTextMap() { + if (weakNodeTextMap === void 0) { + if (typeof WeakMap === "function") + weakNodeTextMap = /* @__PURE__ */ new WeakMap(); + } + return weakNodeTextMap; + } + Object.defineProperties(ts6.objectAllocator.getSymbolConstructor().prototype, { + // for use with vscode-js-debug's new customDescriptionGenerator in launch.json + __tsDebuggerDisplay: { + value: function() { + var symbolHeader = this.flags & 33554432 ? "TransientSymbol" : "Symbol"; + var remainingSymbolFlags = this.flags & ~33554432; + return "".concat(symbolHeader, " '").concat(ts6.symbolName(this), "'").concat(remainingSymbolFlags ? " (".concat(formatSymbolFlags(remainingSymbolFlags), ")") : ""); + } + }, + __debugFlags: { get: function() { + return formatSymbolFlags(this.flags); + } } + }); + Object.defineProperties(ts6.objectAllocator.getTypeConstructor().prototype, { + // for use with vscode-js-debug's new customDescriptionGenerator in launch.json + __tsDebuggerDisplay: { + value: function() { + var typeHeader = this.flags & 98304 ? "NullableType" : this.flags & 384 ? "LiteralType ".concat(JSON.stringify(this.value)) : this.flags & 2048 ? "LiteralType ".concat(this.value.negative ? "-" : "").concat(this.value.base10Value, "n") : this.flags & 8192 ? "UniqueESSymbolType" : this.flags & 32 ? "EnumType" : this.flags & 67359327 ? "IntrinsicType ".concat(this.intrinsicName) : this.flags & 1048576 ? "UnionType" : this.flags & 2097152 ? "IntersectionType" : this.flags & 4194304 ? "IndexType" : this.flags & 8388608 ? "IndexedAccessType" : this.flags & 16777216 ? "ConditionalType" : this.flags & 33554432 ? "SubstitutionType" : this.flags & 262144 ? "TypeParameter" : this.flags & 524288 ? this.objectFlags & 3 ? "InterfaceType" : this.objectFlags & 4 ? "TypeReference" : this.objectFlags & 8 ? "TupleType" : this.objectFlags & 16 ? "AnonymousType" : this.objectFlags & 32 ? "MappedType" : this.objectFlags & 1024 ? "ReverseMappedType" : this.objectFlags & 256 ? "EvolvingArrayType" : "ObjectType" : "Type"; + var remainingObjectFlags = this.flags & 524288 ? this.objectFlags & ~1343 : 0; + return "".concat(typeHeader).concat(this.symbol ? " '".concat(ts6.symbolName(this.symbol), "'") : "").concat(remainingObjectFlags ? " (".concat(formatObjectFlags(remainingObjectFlags), ")") : ""); + } + }, + __debugFlags: { get: function() { + return formatTypeFlags(this.flags); + } }, + __debugObjectFlags: { get: function() { + return this.flags & 524288 ? formatObjectFlags(this.objectFlags) : ""; + } }, + __debugTypeToString: { + value: function() { + var map = getWeakTypeTextMap(); + var text = map === null || map === void 0 ? void 0 : map.get(this); + if (text === void 0) { + text = this.checker.typeToString(this); + map === null || map === void 0 ? void 0 : map.set(this, text); + } + return text; + } + } + }); + Object.defineProperties(ts6.objectAllocator.getSignatureConstructor().prototype, { + __debugFlags: { get: function() { + return formatSignatureFlags(this.flags); + } }, + __debugSignatureToString: { value: function() { + var _a; + return (_a = this.checker) === null || _a === void 0 ? void 0 : _a.signatureToString(this); + } } + }); + var nodeConstructors = [ + ts6.objectAllocator.getNodeConstructor(), + ts6.objectAllocator.getIdentifierConstructor(), + ts6.objectAllocator.getTokenConstructor(), + ts6.objectAllocator.getSourceFileConstructor() + ]; + for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { + var ctor = nodeConstructors_1[_i]; + if (!ts6.hasProperty(ctor.prototype, "__debugKind")) { + Object.defineProperties(ctor.prototype, { + // for use with vscode-js-debug's new customDescriptionGenerator in launch.json + __tsDebuggerDisplay: { + value: function() { + var nodeHeader = ts6.isGeneratedIdentifier(this) ? "GeneratedIdentifier" : ts6.isIdentifier(this) ? "Identifier '".concat(ts6.idText(this), "'") : ts6.isPrivateIdentifier(this) ? "PrivateIdentifier '".concat(ts6.idText(this), "'") : ts6.isStringLiteral(this) ? "StringLiteral ".concat(JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")) : ts6.isNumericLiteral(this) ? "NumericLiteral ".concat(this.text) : ts6.isBigIntLiteral(this) ? "BigIntLiteral ".concat(this.text, "n") : ts6.isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : ts6.isParameter(this) ? "ParameterDeclaration" : ts6.isConstructorDeclaration(this) ? "ConstructorDeclaration" : ts6.isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : ts6.isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : ts6.isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : ts6.isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : ts6.isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : ts6.isTypePredicateNode(this) ? "TypePredicateNode" : ts6.isTypeReferenceNode(this) ? "TypeReferenceNode" : ts6.isFunctionTypeNode(this) ? "FunctionTypeNode" : ts6.isConstructorTypeNode(this) ? "ConstructorTypeNode" : ts6.isTypeQueryNode(this) ? "TypeQueryNode" : ts6.isTypeLiteralNode(this) ? "TypeLiteralNode" : ts6.isArrayTypeNode(this) ? "ArrayTypeNode" : ts6.isTupleTypeNode(this) ? "TupleTypeNode" : ts6.isOptionalTypeNode(this) ? "OptionalTypeNode" : ts6.isRestTypeNode(this) ? "RestTypeNode" : ts6.isUnionTypeNode(this) ? "UnionTypeNode" : ts6.isIntersectionTypeNode(this) ? "IntersectionTypeNode" : ts6.isConditionalTypeNode(this) ? "ConditionalTypeNode" : ts6.isInferTypeNode(this) ? "InferTypeNode" : ts6.isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : ts6.isThisTypeNode(this) ? "ThisTypeNode" : ts6.isTypeOperatorNode(this) ? "TypeOperatorNode" : ts6.isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : ts6.isMappedTypeNode(this) ? "MappedTypeNode" : ts6.isLiteralTypeNode(this) ? "LiteralTypeNode" : ts6.isNamedTupleMember(this) ? "NamedTupleMember" : ts6.isImportTypeNode(this) ? "ImportTypeNode" : formatSyntaxKind(this.kind); + return "".concat(nodeHeader).concat(this.flags ? " (".concat(formatNodeFlags(this.flags), ")") : ""); + } + }, + __debugKind: { get: function() { + return formatSyntaxKind(this.kind); + } }, + __debugNodeFlags: { get: function() { + return formatNodeFlags(this.flags); + } }, + __debugModifierFlags: { get: function() { + return formatModifierFlags(ts6.getEffectiveModifierFlagsNoCache(this)); + } }, + __debugTransformFlags: { get: function() { + return formatTransformFlags(this.transformFlags); + } }, + __debugIsParseTreeNode: { get: function() { + return ts6.isParseTreeNode(this); + } }, + __debugEmitFlags: { get: function() { + return formatEmitFlags(ts6.getEmitFlags(this)); + } }, + __debugGetText: { + value: function(includeTrivia) { + if (ts6.nodeIsSynthesized(this)) + return ""; + var map = getWeakNodeTextMap(); + var text = map === null || map === void 0 ? void 0 : map.get(this); + if (text === void 0) { + var parseNode = ts6.getParseTreeNode(this); + var sourceFile = parseNode && ts6.getSourceFileOfNode(parseNode); + text = sourceFile ? ts6.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + map === null || map === void 0 ? void 0 : map.set(this, text); + } + return text; + } + } + }); + } + } + try { + if (ts6.sys && ts6.sys.require) { + var basePath = ts6.getDirectoryPath(ts6.resolvePath(ts6.sys.getExecutingFilePath())); + var result = ts6.sys.require(basePath, "./compiler-debug"); + if (!result.error) { + result.module.init(ts6); + extendedDebugModule = result.module; + } + } + } catch (_a) { + } + isDebugInfoEnabled = true; + } + Debug2.enableDebugInfo = enableDebugInfo; + function formatDeprecationMessage(name, error, errorAfter, since, message) { + var deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: "; + deprecationMessage += "'".concat(name, "' "); + deprecationMessage += since ? "has been deprecated since v".concat(since) : "is deprecated"; + deprecationMessage += error ? " and can no longer be used." : errorAfter ? " and will no longer be usable after v".concat(errorAfter, ".") : "."; + deprecationMessage += message ? " ".concat(ts6.formatStringFromArgs(message, [name], 0)) : ""; + return deprecationMessage; + } + function createErrorDeprecation(name, errorAfter, since, message) { + var deprecationMessage = formatDeprecationMessage( + name, + /*error*/ + true, + errorAfter, + since, + message + ); + return function() { + throw new TypeError(deprecationMessage); + }; + } + function createWarningDeprecation(name, errorAfter, since, message) { + var hasWrittenDeprecation = false; + return function() { + if (Debug2.enableDeprecationWarnings && !hasWrittenDeprecation) { + log.warn(formatDeprecationMessage( + name, + /*error*/ + false, + errorAfter, + since, + message + )); + hasWrittenDeprecation = true; + } + }; + } + function createDeprecation(name, options) { + var _a, _b; + if (options === void 0) { + options = {}; + } + var version = typeof options.typeScriptVersion === "string" ? new ts6.Version(options.typeScriptVersion) : (_a = options.typeScriptVersion) !== null && _a !== void 0 ? _a : getTypeScriptVersion(); + var errorAfter = typeof options.errorAfter === "string" ? new ts6.Version(options.errorAfter) : options.errorAfter; + var warnAfter = typeof options.warnAfter === "string" ? new ts6.Version(options.warnAfter) : options.warnAfter; + var since = typeof options.since === "string" ? new ts6.Version(options.since) : (_b = options.since) !== null && _b !== void 0 ? _b : warnAfter; + var error = options.error || errorAfter && version.compareTo(errorAfter) <= 0; + var warn2 = !warnAfter || version.compareTo(warnAfter) >= 0; + return error ? createErrorDeprecation(name, errorAfter, since, options.message) : warn2 ? createWarningDeprecation(name, errorAfter, since, options.message) : ts6.noop; + } + Debug2.createDeprecation = createDeprecation; + function wrapFunction(deprecation, func) { + return function() { + deprecation(); + return func.apply(this, arguments); + }; + } + function deprecate(func, options) { + var _a; + var deprecation = createDeprecation((_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : getFunctionName(func), options); + return wrapFunction(deprecation, func); + } + Debug2.deprecate = deprecate; + function formatVariance(varianceFlags) { + var variance = varianceFlags & 7; + var result = variance === 0 ? "in out" : variance === 3 ? "[bivariant]" : variance === 2 ? "in" : variance === 1 ? "out" : variance === 4 ? "[independent]" : ""; + if (varianceFlags & 8) { + result += " (unmeasurable)"; + } else if (varianceFlags & 16) { + result += " (unreliable)"; + } + return result; + } + Debug2.formatVariance = formatVariance; + var DebugTypeMapper = ( + /** @class */ + function() { + function DebugTypeMapper2() { + } + DebugTypeMapper2.prototype.__debugToString = function() { + var _a; + type(this); + switch (this.kind) { + case 3: + return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)"; + case 0: + return "".concat(this.source.__debugTypeToString(), " -> ").concat(this.target.__debugTypeToString()); + case 1: + return ts6.zipWith(this.sources, this.targets || ts6.map(this.sources, function() { + return "any"; + }), function(s, t) { + return "".concat(s.__debugTypeToString(), " -> ").concat(typeof t === "string" ? t : t.__debugTypeToString()); + }).join(", "); + case 2: + return ts6.zipWith(this.sources, this.targets, function(s, t) { + return "".concat(s.__debugTypeToString(), " -> ").concat(t().__debugTypeToString()); + }).join(", "); + case 5: + case 4: + return "m1: ".concat(this.mapper1.__debugToString().split("\n").join("\n "), "\nm2: ").concat(this.mapper2.__debugToString().split("\n").join("\n ")); + default: + return assertNever(this); + } + }; + return DebugTypeMapper2; + }() + ); + Debug2.DebugTypeMapper = DebugTypeMapper; + function attachDebugPrototypeIfDebug(mapper) { + if (Debug2.isDebugging) { + return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype); + } + return mapper; + } + Debug2.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug; + })(Debug = ts6.Debug || (ts6.Debug = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i; + var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; + var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; + var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; + var Version = ( + /** @class */ + function() { + function Version2(major, minor, patch, prerelease, build) { + if (minor === void 0) { + minor = 0; + } + if (patch === void 0) { + patch = 0; + } + if (prerelease === void 0) { + prerelease = ""; + } + if (build === void 0) { + build = ""; + } + if (typeof major === "string") { + var result = ts6.Debug.checkDefined(tryParseComponents(major), "Invalid version"); + major = result.major, minor = result.minor, patch = result.patch, prerelease = result.prerelease, build = result.build; + } + ts6.Debug.assert(major >= 0, "Invalid argument: major"); + ts6.Debug.assert(minor >= 0, "Invalid argument: minor"); + ts6.Debug.assert(patch >= 0, "Invalid argument: patch"); + var prereleaseArray = prerelease ? ts6.isArray(prerelease) ? prerelease : prerelease.split(".") : ts6.emptyArray; + var buildArray = build ? ts6.isArray(build) ? build : build.split(".") : ts6.emptyArray; + ts6.Debug.assert(ts6.every(prereleaseArray, function(s) { + return prereleasePartRegExp.test(s); + }), "Invalid argument: prerelease"); + ts6.Debug.assert(ts6.every(buildArray, function(s) { + return buildPartRegExp.test(s); + }), "Invalid argument: build"); + this.major = major; + this.minor = minor; + this.patch = patch; + this.prerelease = prereleaseArray; + this.build = buildArray; + } + Version2.tryParse = function(text) { + var result = tryParseComponents(text); + if (!result) + return void 0; + var major = result.major, minor = result.minor, patch = result.patch, prerelease = result.prerelease, build = result.build; + return new Version2(major, minor, patch, prerelease, build); + }; + Version2.prototype.compareTo = function(other) { + if (this === other) + return 0; + if (other === void 0) + return 1; + return ts6.compareValues(this.major, other.major) || ts6.compareValues(this.minor, other.minor) || ts6.compareValues(this.patch, other.patch) || comparePrereleaseIdentifiers(this.prerelease, other.prerelease); + }; + Version2.prototype.increment = function(field) { + switch (field) { + case "major": + return new Version2(this.major + 1, 0, 0); + case "minor": + return new Version2(this.major, this.minor + 1, 0); + case "patch": + return new Version2(this.major, this.minor, this.patch + 1); + default: + return ts6.Debug.assertNever(field); + } + }; + Version2.prototype.with = function(fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version2(major, minor, patch, prerelease, build); + }; + Version2.prototype.toString = function() { + var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); + if (ts6.some(this.prerelease)) + result += "-".concat(this.prerelease.join(".")); + if (ts6.some(this.build)) + result += "+".concat(this.build.join(".")); + return result; + }; + Version2.zero = new Version2(0, 0, 0, ["0"]); + return Version2; + }() + ); + ts6.Version = Version; + function tryParseComponents(text) { + var match = versionRegExp.exec(text); + if (!match) + return void 0; + var major = match[1], _a = match[2], minor = _a === void 0 ? "0" : _a, _b = match[3], patch = _b === void 0 ? "0" : _b, _c = match[4], prerelease = _c === void 0 ? "" : _c, _d = match[5], build = _d === void 0 ? "" : _d; + if (prerelease && !prereleaseRegExp.test(prerelease)) + return void 0; + if (build && !buildRegExp.test(build)) + return void 0; + return { + major: parseInt(major, 10), + minor: parseInt(minor, 10), + patch: parseInt(patch, 10), + prerelease, + build + }; + } + function comparePrereleaseIdentifiers(left, right) { + if (left === right) + return 0; + if (left.length === 0) + return right.length === 0 ? 0 : 1; + if (right.length === 0) + return -1; + var length = Math.min(left.length, right.length); + for (var i = 0; i < length; i++) { + var leftIdentifier = left[i]; + var rightIdentifier = right[i]; + if (leftIdentifier === rightIdentifier) + continue; + var leftIsNumeric = numericIdentifierRegExp.test(leftIdentifier); + var rightIsNumeric = numericIdentifierRegExp.test(rightIdentifier); + if (leftIsNumeric || rightIsNumeric) { + if (leftIsNumeric !== rightIsNumeric) + return leftIsNumeric ? -1 : 1; + var result = ts6.compareValues(+leftIdentifier, +rightIdentifier); + if (result) + return result; + } else { + var result = ts6.compareStringsCaseSensitive(leftIdentifier, rightIdentifier); + if (result) + return result; + } + } + return ts6.compareValues(left.length, right.length); + } + var VersionRange = ( + /** @class */ + function() { + function VersionRange2(spec) { + this._alternatives = spec ? ts6.Debug.checkDefined(parseRange(spec), "Invalid range spec.") : ts6.emptyArray; + } + VersionRange2.tryParse = function(text) { + var sets = parseRange(text); + if (sets) { + var range2 = new VersionRange2(""); + range2._alternatives = sets; + return range2; + } + return void 0; + }; + VersionRange2.prototype.test = function(version) { + if (typeof version === "string") + version = new Version(version); + return testDisjunction(version, this._alternatives); + }; + VersionRange2.prototype.toString = function() { + return formatDisjunction(this._alternatives); + }; + return VersionRange2; + }() + ); + ts6.VersionRange = VersionRange; + var logicalOrRegExp = /\|\|/g; + var whitespaceRegExp = /\s+/g; + var partialRegExp = /^([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i; + var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i; + var rangeRegExp = /^(~|\^|<|<=|>|>=|=)?\s*([a-z0-9-+.*]+)$/i; + function parseRange(text) { + var alternatives = []; + for (var _i = 0, _a = ts6.trimString(text).split(logicalOrRegExp); _i < _a.length; _i++) { + var range2 = _a[_i]; + if (!range2) + continue; + var comparators = []; + range2 = ts6.trimString(range2); + var match = hyphenRegExp.exec(range2); + if (match) { + if (!parseHyphen(match[1], match[2], comparators)) + return void 0; + } else { + for (var _b = 0, _c = range2.split(whitespaceRegExp); _b < _c.length; _b++) { + var simple = _c[_b]; + var match_1 = rangeRegExp.exec(ts6.trimString(simple)); + if (!match_1 || !parseComparator(match_1[1], match_1[2], comparators)) + return void 0; + } + } + alternatives.push(comparators); + } + return alternatives; + } + function parsePartial(text) { + var match = partialRegExp.exec(text); + if (!match) + return void 0; + var major = match[1], _a = match[2], minor = _a === void 0 ? "*" : _a, _b = match[3], patch = _b === void 0 ? "*" : _b, prerelease = match[4], build = match[5]; + var version = new Version(isWildcard(major) ? 0 : parseInt(major, 10), isWildcard(major) || isWildcard(minor) ? 0 : parseInt(minor, 10), isWildcard(major) || isWildcard(minor) || isWildcard(patch) ? 0 : parseInt(patch, 10), prerelease, build); + return { version, major, minor, patch }; + } + function parseHyphen(left, right, comparators) { + var leftResult = parsePartial(left); + if (!leftResult) + return false; + var rightResult = parsePartial(right); + if (!rightResult) + return false; + if (!isWildcard(leftResult.major)) { + comparators.push(createComparator(">=", leftResult.version)); + } + if (!isWildcard(rightResult.major)) { + comparators.push(isWildcard(rightResult.minor) ? createComparator("<", rightResult.version.increment("major")) : isWildcard(rightResult.patch) ? createComparator("<", rightResult.version.increment("minor")) : createComparator("<=", rightResult.version)); + } + return true; + } + function parseComparator(operator, text, comparators) { + var result = parsePartial(text); + if (!result) + return false; + var version = result.version, major = result.major, minor = result.minor, patch = result.patch; + if (!isWildcard(major)) { + switch (operator) { + case "~": + comparators.push(createComparator(">=", version)); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + break; + case "^": + comparators.push(createComparator(">=", version)); + comparators.push(createComparator("<", version.increment(version.major > 0 || isWildcard(minor) ? "major" : version.minor > 0 || isWildcard(patch) ? "minor" : "patch"))); + break; + case "<": + case ">=": + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : createComparator(operator, version)); + break; + case "<=": + case ">": + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); + break; + case "=": + case void 0: + if (isWildcard(minor) || isWildcard(patch)) { + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); + } else { + comparators.push(createComparator("=", version)); + } + break; + default: + return false; + } + } else if (operator === "<" || operator === ">") { + comparators.push(createComparator("<", Version.zero)); + } + return true; + } + function isWildcard(part) { + return part === "*" || part === "x" || part === "X"; + } + function createComparator(operator, operand) { + return { operator, operand }; + } + function testDisjunction(version, alternatives) { + if (alternatives.length === 0) + return true; + for (var _i = 0, alternatives_1 = alternatives; _i < alternatives_1.length; _i++) { + var alternative = alternatives_1[_i]; + if (testAlternative(version, alternative)) + return true; + } + return false; + } + function testAlternative(version, comparators) { + for (var _i = 0, comparators_1 = comparators; _i < comparators_1.length; _i++) { + var comparator = comparators_1[_i]; + if (!testComparator(version, comparator.operator, comparator.operand)) + return false; + } + return true; + } + function testComparator(version, operator, operand) { + var cmp = version.compareTo(operand); + switch (operator) { + case "<": + return cmp < 0; + case "<=": + return cmp <= 0; + case ">": + return cmp > 0; + case ">=": + return cmp >= 0; + case "=": + return cmp === 0; + default: + return ts6.Debug.assertNever(operator); + } + } + function formatDisjunction(alternatives) { + return ts6.map(alternatives, formatAlternative).join(" || ") || "*"; + } + function formatAlternative(comparators) { + return ts6.map(comparators, formatComparator).join(" "); + } + function formatComparator(comparator) { + return "".concat(comparator.operator).concat(comparator.operand); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function hasRequiredAPI(performance2, PerformanceObserver2) { + return typeof performance2 === "object" && typeof performance2.timeOrigin === "number" && typeof performance2.mark === "function" && typeof performance2.measure === "function" && typeof performance2.now === "function" && typeof performance2.clearMarks === "function" && typeof performance2.clearMeasures === "function" && typeof PerformanceObserver2 === "function"; + } + function tryGetWebPerformanceHooks() { + if (typeof performance === "object" && typeof PerformanceObserver === "function" && hasRequiredAPI(performance, PerformanceObserver)) { + return { + // For now we always write native performance events when running in the browser. We may + // make this conditional in the future if we find that native web performance hooks + // in the browser also slow down compilation. + shouldWriteNativeEvents: true, + performance, + PerformanceObserver + }; + } + } + function tryGetNodePerformanceHooks() { + if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && typeof __require === "function") { + try { + var performance_1; + var _a = __require("perf_hooks"), nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver; + if (hasRequiredAPI(nodePerformance_1, PerformanceObserver_1)) { + performance_1 = nodePerformance_1; + var version_1 = new ts6.Version(process.versions.node); + var range2 = new ts6.VersionRange("<12.16.3 || 13 <13.13"); + if (range2.test(version_1)) { + performance_1 = { + get timeOrigin() { + return nodePerformance_1.timeOrigin; + }, + now: function() { + return nodePerformance_1.now(); + }, + mark: function(name) { + return nodePerformance_1.mark(name); + }, + measure: function(name, start, end) { + if (start === void 0) { + start = "nodeStart"; + } + if (end === void 0) { + end = "__performance.measure-fix__"; + nodePerformance_1.mark(end); + } + nodePerformance_1.measure(name, start, end); + if (end === "__performance.measure-fix__") { + nodePerformance_1.clearMarks("__performance.measure-fix__"); + } + }, + clearMarks: function(name) { + return nodePerformance_1.clearMarks(name); + }, + clearMeasures: function(name) { + return nodePerformance_1.clearMeasures(name); + } + }; + } + return { + // By default, only write native events when generating a cpu profile or using the v8 profiler. + shouldWriteNativeEvents: false, + performance: performance_1, + PerformanceObserver: PerformanceObserver_1 + }; + } + } catch (_b) { + } + } + } + var nativePerformanceHooks = tryGetWebPerformanceHooks() || tryGetNodePerformanceHooks(); + var nativePerformance = nativePerformanceHooks === null || nativePerformanceHooks === void 0 ? void 0 : nativePerformanceHooks.performance; + function tryGetNativePerformanceHooks() { + return nativePerformanceHooks; + } + ts6.tryGetNativePerformanceHooks = tryGetNativePerformanceHooks; + ts6.timestamp = nativePerformance ? function() { + return nativePerformance.now(); + } : Date.now ? Date.now : function() { + return +/* @__PURE__ */ new Date(); + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var performance2; + (function(performance3) { + var perfHooks; + var performanceImpl; + function createTimerIf(condition, measureName, startMarkName, endMarkName) { + return condition ? createTimer(measureName, startMarkName, endMarkName) : performance3.nullTimer; + } + performance3.createTimerIf = createTimerIf; + function createTimer(measureName, startMarkName, endMarkName) { + var enterCount = 0; + return { + enter, + exit + }; + function enter() { + if (++enterCount === 1) { + mark(startMarkName); + } + } + function exit() { + if (--enterCount === 0) { + mark(endMarkName); + measure(measureName, startMarkName, endMarkName); + } else if (enterCount < 0) { + ts6.Debug.fail("enter/exit count does not match."); + } + } + } + performance3.createTimer = createTimer; + performance3.nullTimer = { enter: ts6.noop, exit: ts6.noop }; + var enabled = false; + var timeorigin = ts6.timestamp(); + var marks = new ts6.Map(); + var counts = new ts6.Map(); + var durations = new ts6.Map(); + function mark(markName) { + var _a; + if (enabled) { + var count = (_a = counts.get(markName)) !== null && _a !== void 0 ? _a : 0; + counts.set(markName, count + 1); + marks.set(markName, ts6.timestamp()); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName); + } + } + performance3.mark = mark; + function measure(measureName, startMarkName, endMarkName) { + var _a, _b; + if (enabled) { + var end = (_a = endMarkName !== void 0 ? marks.get(endMarkName) : void 0) !== null && _a !== void 0 ? _a : ts6.timestamp(); + var start = (_b = startMarkName !== void 0 ? marks.get(startMarkName) : void 0) !== null && _b !== void 0 ? _b : timeorigin; + var previousDuration = durations.get(measureName) || 0; + durations.set(measureName, previousDuration + (end - start)); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName); + } + } + performance3.measure = measure; + function getCount(markName) { + return counts.get(markName) || 0; + } + performance3.getCount = getCount; + function getDuration(measureName) { + return durations.get(measureName) || 0; + } + performance3.getDuration = getDuration; + function forEachMeasure(cb) { + durations.forEach(function(duration, measureName) { + return cb(measureName, duration); + }); + } + performance3.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function(_time, markName) { + return cb(markName); + }); + } + performance3.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== void 0) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance3.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== void 0) { + counts.delete(name); + marks.delete(name); + } else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance3.clearMarks = clearMarks; + function isEnabled() { + return enabled; + } + performance3.isEnabled = isEnabled; + function enable(system) { + var _a; + if (system === void 0) { + system = ts6.sys; + } + if (!enabled) { + enabled = true; + perfHooks || (perfHooks = ts6.tryGetNativePerformanceHooks()); + if (perfHooks) { + timeorigin = perfHooks.performance.timeOrigin; + if (perfHooks.shouldWriteNativeEvents || ((_a = system === null || system === void 0 ? void 0 : system.cpuProfilingEnabled) === null || _a === void 0 ? void 0 : _a.call(system)) || (system === null || system === void 0 ? void 0 : system.debugMode)) { + performanceImpl = perfHooks.performance; + } + } + } + return true; + } + performance3.enable = enable; + function disable() { + if (enabled) { + marks.clear(); + counts.clear(); + durations.clear(); + performanceImpl = void 0; + enabled = false; + } + } + performance3.disable = disable; + })(performance2 = ts6.performance || (ts6.performance = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var _a; + var nullLogger = { + logEvent: ts6.noop, + logErrEvent: ts6.noop, + logPerfEvent: ts6.noop, + logInfoEvent: ts6.noop, + logStartCommand: ts6.noop, + logStopCommand: ts6.noop, + logStartUpdateProgram: ts6.noop, + logStopUpdateProgram: ts6.noop, + logStartUpdateGraph: ts6.noop, + logStopUpdateGraph: ts6.noop, + logStartResolveModule: ts6.noop, + logStopResolveModule: ts6.noop, + logStartParseSourceFile: ts6.noop, + logStopParseSourceFile: ts6.noop, + logStartReadFile: ts6.noop, + logStopReadFile: ts6.noop, + logStartBindFile: ts6.noop, + logStopBindFile: ts6.noop, + logStartScheduledOperation: ts6.noop, + logStopScheduledOperation: ts6.noop + }; + var etwModule; + try { + var etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) !== null && _a !== void 0 ? _a : "./node_modules/@microsoft/typescript-etw"; + etwModule = __require(etwModulePath); + } catch (e) { + etwModule = void 0; + } + ts6.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var tracingEnabled; + (function(tracingEnabled2) { + var fs; + var traceCount = 0; + var traceFd = 0; + var mode; + var typeCatalog = []; + var legendPath; + var legend = []; + function startTracing(tracingMode, traceDir, configFilePath) { + ts6.Debug.assert(!ts6.tracing, "Tracing already started"); + if (fs === void 0) { + try { + fs = require_fs(); + } catch (e) { + throw new Error("tracing requires having fs\n(original error: ".concat(e.message || e, ")")); + } + } + mode = tracingMode; + typeCatalog.length = 0; + if (legendPath === void 0) { + legendPath = ts6.combinePaths(traceDir, "legend.json"); + } + if (!fs.existsSync(traceDir)) { + fs.mkdirSync(traceDir, { recursive: true }); + } + var countPart = mode === "build" ? ".".concat(process.pid, "-").concat(++traceCount) : mode === "server" ? ".".concat(process.pid) : ""; + var tracePath = ts6.combinePaths(traceDir, "trace".concat(countPart, ".json")); + var typesPath = ts6.combinePaths(traceDir, "types".concat(countPart, ".json")); + legend.push({ + configFilePath, + tracePath, + typesPath + }); + traceFd = fs.openSync(tracePath, "w"); + ts6.tracing = tracingEnabled2; + var meta = { cat: "__metadata", ph: "M", ts: 1e3 * ts6.timestamp(), pid: 1, tid: 1 }; + fs.writeSync(traceFd, "[\n" + [__assign({ name: "process_name", args: { name: "tsc" } }, meta), __assign({ name: "thread_name", args: { name: "Main" } }, meta), __assign(__assign({ name: "TracingStartedInBrowser" }, meta), { cat: "disabled-by-default-devtools.timeline" })].map(function(v) { + return JSON.stringify(v); + }).join(",\n")); + } + tracingEnabled2.startTracing = startTracing; + function stopTracing() { + ts6.Debug.assert(ts6.tracing, "Tracing is not in progress"); + ts6.Debug.assert(!!typeCatalog.length === (mode !== "server")); + fs.writeSync(traceFd, "\n]\n"); + fs.closeSync(traceFd); + ts6.tracing = void 0; + if (typeCatalog.length) { + dumpTypes(typeCatalog); + } else { + legend[legend.length - 1].typesPath = void 0; + } + } + tracingEnabled2.stopTracing = stopTracing; + function recordType(type) { + if (mode !== "server") { + typeCatalog.push(type); + } + } + tracingEnabled2.recordType = recordType; + var Phase; + (function(Phase2) { + Phase2["Parse"] = "parse"; + Phase2["Program"] = "program"; + Phase2["Bind"] = "bind"; + Phase2["Check"] = "check"; + Phase2["CheckTypes"] = "checkTypes"; + Phase2["Emit"] = "emit"; + Phase2["Session"] = "session"; + })(Phase = tracingEnabled2.Phase || (tracingEnabled2.Phase = {})); + function instant(phase, name, args) { + writeEvent("I", phase, name, args, '"s":"g"'); + } + tracingEnabled2.instant = instant; + var eventStack = []; + function push(phase, name, args, separateBeginAndEnd) { + if (separateBeginAndEnd === void 0) { + separateBeginAndEnd = false; + } + if (separateBeginAndEnd) { + writeEvent("B", phase, name, args); + } + eventStack.push({ phase, name, args, time: 1e3 * ts6.timestamp(), separateBeginAndEnd }); + } + tracingEnabled2.push = push; + function pop(results) { + ts6.Debug.assert(eventStack.length > 0); + writeStackEvent(eventStack.length - 1, 1e3 * ts6.timestamp(), results); + eventStack.length--; + } + tracingEnabled2.pop = pop; + function popAll() { + var endTime = 1e3 * ts6.timestamp(); + for (var i = eventStack.length - 1; i >= 0; i--) { + writeStackEvent(i, endTime); + } + eventStack.length = 0; + } + tracingEnabled2.popAll = popAll; + var sampleInterval = 1e3 * 10; + function writeStackEvent(index, endTime, results) { + var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd; + if (separateBeginAndEnd) { + ts6.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`"); + writeEvent( + "E", + phase, + name, + args, + /*extras*/ + void 0, + endTime + ); + } else if (sampleInterval - time % sampleInterval <= endTime - time) { + writeEvent("X", phase, name, __assign(__assign({}, args), { results }), '"dur":'.concat(endTime - time), time); + } + } + function writeEvent(eventType, phase, name, args, extras, time) { + if (time === void 0) { + time = 1e3 * ts6.timestamp(); + } + if (mode === "server" && phase === "checkTypes") + return; + ts6.performance.mark("beginTracing"); + fs.writeSync(traceFd, ',\n{"pid":1,"tid":1,"ph":"'.concat(eventType, '","cat":"').concat(phase, '","ts":').concat(time, ',"name":"').concat(name, '"')); + if (extras) + fs.writeSync(traceFd, ",".concat(extras)); + if (args) + fs.writeSync(traceFd, ',"args":'.concat(JSON.stringify(args))); + fs.writeSync(traceFd, "}"); + ts6.performance.mark("endTracing"); + ts6.performance.measure("Tracing", "beginTracing", "endTracing"); + } + function getLocation(node) { + var file = ts6.getSourceFileOfNode(node); + return !file ? void 0 : { + path: file.path, + start: indexFromOne(ts6.getLineAndCharacterOfPosition(file, node.pos)), + end: indexFromOne(ts6.getLineAndCharacterOfPosition(file, node.end)) + }; + function indexFromOne(lc) { + return { + line: lc.line + 1, + character: lc.character + 1 + }; + } + } + function dumpTypes(types) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; + ts6.performance.mark("beginDumpTypes"); + var typesPath = legend[legend.length - 1].typesPath; + var typesFd = fs.openSync(typesPath, "w"); + var recursionIdentityMap = new ts6.Map(); + fs.writeSync(typesFd, "["); + var numTypes = types.length; + for (var i = 0; i < numTypes; i++) { + var type = types[i]; + var objectFlags = type.objectFlags; + var symbol = (_a = type.aliasSymbol) !== null && _a !== void 0 ? _a : type.symbol; + var display = void 0; + if (objectFlags & 16 | type.flags & 2944) { + try { + display = (_b = type.checker) === null || _b === void 0 ? void 0 : _b.typeToString(type); + } catch (_y) { + display = void 0; + } + } + var indexedAccessProperties = {}; + if (type.flags & 8388608) { + var indexedAccessType = type; + indexedAccessProperties = { + indexedAccessObjectType: (_c = indexedAccessType.objectType) === null || _c === void 0 ? void 0 : _c.id, + indexedAccessIndexType: (_d = indexedAccessType.indexType) === null || _d === void 0 ? void 0 : _d.id + }; + } + var referenceProperties = {}; + if (objectFlags & 4) { + var referenceType = type; + referenceProperties = { + instantiatedType: (_e = referenceType.target) === null || _e === void 0 ? void 0 : _e.id, + typeArguments: (_f = referenceType.resolvedTypeArguments) === null || _f === void 0 ? void 0 : _f.map(function(t) { + return t.id; + }), + referenceLocation: getLocation(referenceType.node) + }; + } + var conditionalProperties = {}; + if (type.flags & 16777216) { + var conditionalType = type; + conditionalProperties = { + conditionalCheckType: (_g = conditionalType.checkType) === null || _g === void 0 ? void 0 : _g.id, + conditionalExtendsType: (_h = conditionalType.extendsType) === null || _h === void 0 ? void 0 : _h.id, + conditionalTrueType: (_k = (_j = conditionalType.resolvedTrueType) === null || _j === void 0 ? void 0 : _j.id) !== null && _k !== void 0 ? _k : -1, + conditionalFalseType: (_m = (_l = conditionalType.resolvedFalseType) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : -1 + }; + } + var substitutionProperties = {}; + if (type.flags & 33554432) { + var substitutionType = type; + substitutionProperties = { + substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id + }; + } + var reverseMappedProperties = {}; + if (objectFlags & 1024) { + var reverseMappedType = type; + reverseMappedProperties = { + reverseMappedSourceType: (_q = reverseMappedType.source) === null || _q === void 0 ? void 0 : _q.id, + reverseMappedMappedType: (_r = reverseMappedType.mappedType) === null || _r === void 0 ? void 0 : _r.id, + reverseMappedConstraintType: (_s = reverseMappedType.constraintType) === null || _s === void 0 ? void 0 : _s.id + }; + } + var evolvingArrayProperties = {}; + if (objectFlags & 256) { + var evolvingArrayType = type; + evolvingArrayProperties = { + evolvingArrayElementType: evolvingArrayType.elementType.id, + evolvingArrayFinalType: (_t = evolvingArrayType.finalArrayType) === null || _t === void 0 ? void 0 : _t.id + }; + } + var recursionToken = void 0; + var recursionIdentity = type.checker.getRecursionIdentity(type); + if (recursionIdentity) { + recursionToken = recursionIdentityMap.get(recursionIdentity); + if (!recursionToken) { + recursionToken = recursionIdentityMap.size; + recursionIdentityMap.set(recursionIdentity, recursionToken); + } + } + var descriptor = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: type.id, intrinsicName: type.intrinsicName, symbolName: (symbol === null || symbol === void 0 ? void 0 : symbol.escapedName) && ts6.unescapeLeadingUnderscores(symbol.escapedName), recursionId: recursionToken, isTuple: objectFlags & 8 ? true : void 0, unionTypes: type.flags & 1048576 ? (_u = type.types) === null || _u === void 0 ? void 0 : _u.map(function(t) { + return t.id; + }) : void 0, intersectionTypes: type.flags & 2097152 ? type.types.map(function(t) { + return t.id; + }) : void 0, aliasTypeArguments: (_v = type.aliasTypeArguments) === null || _v === void 0 ? void 0 : _v.map(function(t) { + return t.id; + }), keyofType: type.flags & 4194304 ? (_w = type.type) === null || _w === void 0 ? void 0 : _w.id : void 0 }, indexedAccessProperties), referenceProperties), conditionalProperties), substitutionProperties), reverseMappedProperties), evolvingArrayProperties), { destructuringPattern: getLocation(type.pattern), firstDeclaration: getLocation((_x = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _x === void 0 ? void 0 : _x[0]), flags: ts6.Debug.formatTypeFlags(type.flags).split("|"), display }); + fs.writeSync(typesFd, JSON.stringify(descriptor)); + if (i < numTypes - 1) { + fs.writeSync(typesFd, ",\n"); + } + } + fs.writeSync(typesFd, "]\n"); + fs.closeSync(typesFd); + ts6.performance.mark("endDumpTypes"); + ts6.performance.measure("Dump types", "beginDumpTypes", "endDumpTypes"); + } + function dumpLegend() { + if (!legendPath) { + return; + } + fs.writeFileSync(legendPath, JSON.stringify(legend)); + } + tracingEnabled2.dumpLegend = dumpLegend; + })(tracingEnabled || (tracingEnabled = {})); + ts6.startTracing = tracingEnabled.startTracing; + ts6.dumpTracingLegend = tracingEnabled.dumpLegend; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var SyntaxKind; + (function(SyntaxKind2) { + SyntaxKind2[SyntaxKind2["Unknown"] = 0] = "Unknown"; + SyntaxKind2[SyntaxKind2["EndOfFileToken"] = 1] = "EndOfFileToken"; + SyntaxKind2[SyntaxKind2["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind2[SyntaxKind2["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind2[SyntaxKind2["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind2[SyntaxKind2["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind2[SyntaxKind2["ShebangTrivia"] = 6] = "ShebangTrivia"; + SyntaxKind2[SyntaxKind2["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia"; + SyntaxKind2[SyntaxKind2["NumericLiteral"] = 8] = "NumericLiteral"; + SyntaxKind2[SyntaxKind2["BigIntLiteral"] = 9] = "BigIntLiteral"; + SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral"; + SyntaxKind2[SyntaxKind2["JsxText"] = 11] = "JsxText"; + SyntaxKind2[SyntaxKind2["JsxTextAllWhiteSpaces"] = 12] = "JsxTextAllWhiteSpaces"; + SyntaxKind2[SyntaxKind2["RegularExpressionLiteral"] = 13] = "RegularExpressionLiteral"; + SyntaxKind2[SyntaxKind2["NoSubstitutionTemplateLiteral"] = 14] = "NoSubstitutionTemplateLiteral"; + SyntaxKind2[SyntaxKind2["TemplateHead"] = 15] = "TemplateHead"; + SyntaxKind2[SyntaxKind2["TemplateMiddle"] = 16] = "TemplateMiddle"; + SyntaxKind2[SyntaxKind2["TemplateTail"] = 17] = "TemplateTail"; + SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 18] = "OpenBraceToken"; + SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 19] = "CloseBraceToken"; + SyntaxKind2[SyntaxKind2["OpenParenToken"] = 20] = "OpenParenToken"; + SyntaxKind2[SyntaxKind2["CloseParenToken"] = 21] = "CloseParenToken"; + SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 22] = "OpenBracketToken"; + SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 23] = "CloseBracketToken"; + SyntaxKind2[SyntaxKind2["DotToken"] = 24] = "DotToken"; + SyntaxKind2[SyntaxKind2["DotDotDotToken"] = 25] = "DotDotDotToken"; + SyntaxKind2[SyntaxKind2["SemicolonToken"] = 26] = "SemicolonToken"; + SyntaxKind2[SyntaxKind2["CommaToken"] = 27] = "CommaToken"; + SyntaxKind2[SyntaxKind2["QuestionDotToken"] = 28] = "QuestionDotToken"; + SyntaxKind2[SyntaxKind2["LessThanToken"] = 29] = "LessThanToken"; + SyntaxKind2[SyntaxKind2["LessThanSlashToken"] = 30] = "LessThanSlashToken"; + SyntaxKind2[SyntaxKind2["GreaterThanToken"] = 31] = "GreaterThanToken"; + SyntaxKind2[SyntaxKind2["LessThanEqualsToken"] = 32] = "LessThanEqualsToken"; + SyntaxKind2[SyntaxKind2["GreaterThanEqualsToken"] = 33] = "GreaterThanEqualsToken"; + SyntaxKind2[SyntaxKind2["EqualsEqualsToken"] = 34] = "EqualsEqualsToken"; + SyntaxKind2[SyntaxKind2["ExclamationEqualsToken"] = 35] = "ExclamationEqualsToken"; + SyntaxKind2[SyntaxKind2["EqualsEqualsEqualsToken"] = 36] = "EqualsEqualsEqualsToken"; + SyntaxKind2[SyntaxKind2["ExclamationEqualsEqualsToken"] = 37] = "ExclamationEqualsEqualsToken"; + SyntaxKind2[SyntaxKind2["EqualsGreaterThanToken"] = 38] = "EqualsGreaterThanToken"; + SyntaxKind2[SyntaxKind2["PlusToken"] = 39] = "PlusToken"; + SyntaxKind2[SyntaxKind2["MinusToken"] = 40] = "MinusToken"; + SyntaxKind2[SyntaxKind2["AsteriskToken"] = 41] = "AsteriskToken"; + SyntaxKind2[SyntaxKind2["AsteriskAsteriskToken"] = 42] = "AsteriskAsteriskToken"; + SyntaxKind2[SyntaxKind2["SlashToken"] = 43] = "SlashToken"; + SyntaxKind2[SyntaxKind2["PercentToken"] = 44] = "PercentToken"; + SyntaxKind2[SyntaxKind2["PlusPlusToken"] = 45] = "PlusPlusToken"; + SyntaxKind2[SyntaxKind2["MinusMinusToken"] = 46] = "MinusMinusToken"; + SyntaxKind2[SyntaxKind2["LessThanLessThanToken"] = 47] = "LessThanLessThanToken"; + SyntaxKind2[SyntaxKind2["GreaterThanGreaterThanToken"] = 48] = "GreaterThanGreaterThanToken"; + SyntaxKind2[SyntaxKind2["GreaterThanGreaterThanGreaterThanToken"] = 49] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind2[SyntaxKind2["AmpersandToken"] = 50] = "AmpersandToken"; + SyntaxKind2[SyntaxKind2["BarToken"] = 51] = "BarToken"; + SyntaxKind2[SyntaxKind2["CaretToken"] = 52] = "CaretToken"; + SyntaxKind2[SyntaxKind2["ExclamationToken"] = 53] = "ExclamationToken"; + SyntaxKind2[SyntaxKind2["TildeToken"] = 54] = "TildeToken"; + SyntaxKind2[SyntaxKind2["AmpersandAmpersandToken"] = 55] = "AmpersandAmpersandToken"; + SyntaxKind2[SyntaxKind2["BarBarToken"] = 56] = "BarBarToken"; + SyntaxKind2[SyntaxKind2["QuestionToken"] = 57] = "QuestionToken"; + SyntaxKind2[SyntaxKind2["ColonToken"] = 58] = "ColonToken"; + SyntaxKind2[SyntaxKind2["AtToken"] = 59] = "AtToken"; + SyntaxKind2[SyntaxKind2["QuestionQuestionToken"] = 60] = "QuestionQuestionToken"; + SyntaxKind2[SyntaxKind2["BacktickToken"] = 61] = "BacktickToken"; + SyntaxKind2[SyntaxKind2["HashToken"] = 62] = "HashToken"; + SyntaxKind2[SyntaxKind2["EqualsToken"] = 63] = "EqualsToken"; + SyntaxKind2[SyntaxKind2["PlusEqualsToken"] = 64] = "PlusEqualsToken"; + SyntaxKind2[SyntaxKind2["MinusEqualsToken"] = 65] = "MinusEqualsToken"; + SyntaxKind2[SyntaxKind2["AsteriskEqualsToken"] = 66] = "AsteriskEqualsToken"; + SyntaxKind2[SyntaxKind2["AsteriskAsteriskEqualsToken"] = 67] = "AsteriskAsteriskEqualsToken"; + SyntaxKind2[SyntaxKind2["SlashEqualsToken"] = 68] = "SlashEqualsToken"; + SyntaxKind2[SyntaxKind2["PercentEqualsToken"] = 69] = "PercentEqualsToken"; + SyntaxKind2[SyntaxKind2["LessThanLessThanEqualsToken"] = 70] = "LessThanLessThanEqualsToken"; + SyntaxKind2[SyntaxKind2["GreaterThanGreaterThanEqualsToken"] = 71] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind2[SyntaxKind2["GreaterThanGreaterThanGreaterThanEqualsToken"] = 72] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind2[SyntaxKind2["AmpersandEqualsToken"] = 73] = "AmpersandEqualsToken"; + SyntaxKind2[SyntaxKind2["BarEqualsToken"] = 74] = "BarEqualsToken"; + SyntaxKind2[SyntaxKind2["BarBarEqualsToken"] = 75] = "BarBarEqualsToken"; + SyntaxKind2[SyntaxKind2["AmpersandAmpersandEqualsToken"] = 76] = "AmpersandAmpersandEqualsToken"; + SyntaxKind2[SyntaxKind2["QuestionQuestionEqualsToken"] = 77] = "QuestionQuestionEqualsToken"; + SyntaxKind2[SyntaxKind2["CaretEqualsToken"] = 78] = "CaretEqualsToken"; + SyntaxKind2[SyntaxKind2["Identifier"] = 79] = "Identifier"; + SyntaxKind2[SyntaxKind2["PrivateIdentifier"] = 80] = "PrivateIdentifier"; + SyntaxKind2[SyntaxKind2["BreakKeyword"] = 81] = "BreakKeyword"; + SyntaxKind2[SyntaxKind2["CaseKeyword"] = 82] = "CaseKeyword"; + SyntaxKind2[SyntaxKind2["CatchKeyword"] = 83] = "CatchKeyword"; + SyntaxKind2[SyntaxKind2["ClassKeyword"] = 84] = "ClassKeyword"; + SyntaxKind2[SyntaxKind2["ConstKeyword"] = 85] = "ConstKeyword"; + SyntaxKind2[SyntaxKind2["ContinueKeyword"] = 86] = "ContinueKeyword"; + SyntaxKind2[SyntaxKind2["DebuggerKeyword"] = 87] = "DebuggerKeyword"; + SyntaxKind2[SyntaxKind2["DefaultKeyword"] = 88] = "DefaultKeyword"; + SyntaxKind2[SyntaxKind2["DeleteKeyword"] = 89] = "DeleteKeyword"; + SyntaxKind2[SyntaxKind2["DoKeyword"] = 90] = "DoKeyword"; + SyntaxKind2[SyntaxKind2["ElseKeyword"] = 91] = "ElseKeyword"; + SyntaxKind2[SyntaxKind2["EnumKeyword"] = 92] = "EnumKeyword"; + SyntaxKind2[SyntaxKind2["ExportKeyword"] = 93] = "ExportKeyword"; + SyntaxKind2[SyntaxKind2["ExtendsKeyword"] = 94] = "ExtendsKeyword"; + SyntaxKind2[SyntaxKind2["FalseKeyword"] = 95] = "FalseKeyword"; + SyntaxKind2[SyntaxKind2["FinallyKeyword"] = 96] = "FinallyKeyword"; + SyntaxKind2[SyntaxKind2["ForKeyword"] = 97] = "ForKeyword"; + SyntaxKind2[SyntaxKind2["FunctionKeyword"] = 98] = "FunctionKeyword"; + SyntaxKind2[SyntaxKind2["IfKeyword"] = 99] = "IfKeyword"; + SyntaxKind2[SyntaxKind2["ImportKeyword"] = 100] = "ImportKeyword"; + SyntaxKind2[SyntaxKind2["InKeyword"] = 101] = "InKeyword"; + SyntaxKind2[SyntaxKind2["InstanceOfKeyword"] = 102] = "InstanceOfKeyword"; + SyntaxKind2[SyntaxKind2["NewKeyword"] = 103] = "NewKeyword"; + SyntaxKind2[SyntaxKind2["NullKeyword"] = 104] = "NullKeyword"; + SyntaxKind2[SyntaxKind2["ReturnKeyword"] = 105] = "ReturnKeyword"; + SyntaxKind2[SyntaxKind2["SuperKeyword"] = 106] = "SuperKeyword"; + SyntaxKind2[SyntaxKind2["SwitchKeyword"] = 107] = "SwitchKeyword"; + SyntaxKind2[SyntaxKind2["ThisKeyword"] = 108] = "ThisKeyword"; + SyntaxKind2[SyntaxKind2["ThrowKeyword"] = 109] = "ThrowKeyword"; + SyntaxKind2[SyntaxKind2["TrueKeyword"] = 110] = "TrueKeyword"; + SyntaxKind2[SyntaxKind2["TryKeyword"] = 111] = "TryKeyword"; + SyntaxKind2[SyntaxKind2["TypeOfKeyword"] = 112] = "TypeOfKeyword"; + SyntaxKind2[SyntaxKind2["VarKeyword"] = 113] = "VarKeyword"; + SyntaxKind2[SyntaxKind2["VoidKeyword"] = 114] = "VoidKeyword"; + SyntaxKind2[SyntaxKind2["WhileKeyword"] = 115] = "WhileKeyword"; + SyntaxKind2[SyntaxKind2["WithKeyword"] = 116] = "WithKeyword"; + SyntaxKind2[SyntaxKind2["ImplementsKeyword"] = 117] = "ImplementsKeyword"; + SyntaxKind2[SyntaxKind2["InterfaceKeyword"] = 118] = "InterfaceKeyword"; + SyntaxKind2[SyntaxKind2["LetKeyword"] = 119] = "LetKeyword"; + SyntaxKind2[SyntaxKind2["PackageKeyword"] = 120] = "PackageKeyword"; + SyntaxKind2[SyntaxKind2["PrivateKeyword"] = 121] = "PrivateKeyword"; + SyntaxKind2[SyntaxKind2["ProtectedKeyword"] = 122] = "ProtectedKeyword"; + SyntaxKind2[SyntaxKind2["PublicKeyword"] = 123] = "PublicKeyword"; + SyntaxKind2[SyntaxKind2["StaticKeyword"] = 124] = "StaticKeyword"; + SyntaxKind2[SyntaxKind2["YieldKeyword"] = 125] = "YieldKeyword"; + SyntaxKind2[SyntaxKind2["AbstractKeyword"] = 126] = "AbstractKeyword"; + SyntaxKind2[SyntaxKind2["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind2[SyntaxKind2["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind2[SyntaxKind2["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind2[SyntaxKind2["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind2[SyntaxKind2["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind2[SyntaxKind2["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind2[SyntaxKind2["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind2[SyntaxKind2["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind2[SyntaxKind2["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind2[SyntaxKind2["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind2[SyntaxKind2["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind2[SyntaxKind2["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind2[SyntaxKind2["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind2[SyntaxKind2["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind2[SyntaxKind2["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind2[SyntaxKind2["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind2[SyntaxKind2["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind2[SyntaxKind2["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind2[SyntaxKind2["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind2[SyntaxKind2["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind2[SyntaxKind2["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind2[SyntaxKind2["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind2[SyntaxKind2["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind2[SyntaxKind2["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind2[SyntaxKind2["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind2[SyntaxKind2["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind2[SyntaxKind2["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind2[SyntaxKind2["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind2[SyntaxKind2["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind2[SyntaxKind2["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind2[SyntaxKind2["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind2[SyntaxKind2["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind2[SyntaxKind2["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind2[SyntaxKind2["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind2[SyntaxKind2["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind2[SyntaxKind2["OfKeyword"] = 162] = "OfKeyword"; + SyntaxKind2[SyntaxKind2["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind2[SyntaxKind2["ComputedPropertyName"] = 164] = "ComputedPropertyName"; + SyntaxKind2[SyntaxKind2["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind2[SyntaxKind2["Parameter"] = 166] = "Parameter"; + SyntaxKind2[SyntaxKind2["Decorator"] = 167] = "Decorator"; + SyntaxKind2[SyntaxKind2["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind2[SyntaxKind2["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind2[SyntaxKind2["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind2[SyntaxKind2["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind2[SyntaxKind2["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind2[SyntaxKind2["Constructor"] = 173] = "Constructor"; + SyntaxKind2[SyntaxKind2["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind2[SyntaxKind2["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind2[SyntaxKind2["CallSignature"] = 176] = "CallSignature"; + SyntaxKind2[SyntaxKind2["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind2[SyntaxKind2["IndexSignature"] = 178] = "IndexSignature"; + SyntaxKind2[SyntaxKind2["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind2[SyntaxKind2["TypeReference"] = 180] = "TypeReference"; + SyntaxKind2[SyntaxKind2["FunctionType"] = 181] = "FunctionType"; + SyntaxKind2[SyntaxKind2["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind2[SyntaxKind2["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind2[SyntaxKind2["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind2[SyntaxKind2["ArrayType"] = 185] = "ArrayType"; + SyntaxKind2[SyntaxKind2["TupleType"] = 186] = "TupleType"; + SyntaxKind2[SyntaxKind2["OptionalType"] = 187] = "OptionalType"; + SyntaxKind2[SyntaxKind2["RestType"] = 188] = "RestType"; + SyntaxKind2[SyntaxKind2["UnionType"] = 189] = "UnionType"; + SyntaxKind2[SyntaxKind2["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind2[SyntaxKind2["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind2[SyntaxKind2["InferType"] = 192] = "InferType"; + SyntaxKind2[SyntaxKind2["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind2[SyntaxKind2["ThisType"] = 194] = "ThisType"; + SyntaxKind2[SyntaxKind2["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind2[SyntaxKind2["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind2[SyntaxKind2["MappedType"] = 197] = "MappedType"; + SyntaxKind2[SyntaxKind2["LiteralType"] = 198] = "LiteralType"; + SyntaxKind2[SyntaxKind2["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind2[SyntaxKind2["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind2[SyntaxKind2["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind2[SyntaxKind2["ImportType"] = 202] = "ImportType"; + SyntaxKind2[SyntaxKind2["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind2[SyntaxKind2["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind2[SyntaxKind2["BindingElement"] = 205] = "BindingElement"; + SyntaxKind2[SyntaxKind2["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind2[SyntaxKind2["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind2[SyntaxKind2["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind2[SyntaxKind2["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind2[SyntaxKind2["CallExpression"] = 210] = "CallExpression"; + SyntaxKind2[SyntaxKind2["NewExpression"] = 211] = "NewExpression"; + SyntaxKind2[SyntaxKind2["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind2[SyntaxKind2["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind2[SyntaxKind2["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind2[SyntaxKind2["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind2[SyntaxKind2["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind2[SyntaxKind2["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind2[SyntaxKind2["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind2[SyntaxKind2["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind2[SyntaxKind2["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind2[SyntaxKind2["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind2[SyntaxKind2["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind2[SyntaxKind2["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind2[SyntaxKind2["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind2[SyntaxKind2["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind2[SyntaxKind2["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind2[SyntaxKind2["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind2[SyntaxKind2["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind2[SyntaxKind2["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind2[SyntaxKind2["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind2[SyntaxKind2["AsExpression"] = 231] = "AsExpression"; + SyntaxKind2[SyntaxKind2["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind2[SyntaxKind2["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind2[SyntaxKind2["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind2[SyntaxKind2["SatisfiesExpression"] = 235] = "SatisfiesExpression"; + SyntaxKind2[SyntaxKind2["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind2[SyntaxKind2["SemicolonClassElement"] = 237] = "SemicolonClassElement"; + SyntaxKind2[SyntaxKind2["Block"] = 238] = "Block"; + SyntaxKind2[SyntaxKind2["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind2[SyntaxKind2["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind2[SyntaxKind2["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind2[SyntaxKind2["IfStatement"] = 242] = "IfStatement"; + SyntaxKind2[SyntaxKind2["DoStatement"] = 243] = "DoStatement"; + SyntaxKind2[SyntaxKind2["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind2[SyntaxKind2["ForStatement"] = 245] = "ForStatement"; + SyntaxKind2[SyntaxKind2["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind2[SyntaxKind2["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind2[SyntaxKind2["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind2[SyntaxKind2["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind2[SyntaxKind2["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind2[SyntaxKind2["WithStatement"] = 251] = "WithStatement"; + SyntaxKind2[SyntaxKind2["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind2[SyntaxKind2["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind2[SyntaxKind2["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind2[SyntaxKind2["TryStatement"] = 255] = "TryStatement"; + SyntaxKind2[SyntaxKind2["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind2[SyntaxKind2["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind2[SyntaxKind2["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind2[SyntaxKind2["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind2[SyntaxKind2["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind2[SyntaxKind2["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind2[SyntaxKind2["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind2[SyntaxKind2["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind2[SyntaxKind2["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind2[SyntaxKind2["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind2[SyntaxKind2["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind2[SyntaxKind2["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind2[SyntaxKind2["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind2[SyntaxKind2["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind2[SyntaxKind2["ImportClause"] = 270] = "ImportClause"; + SyntaxKind2[SyntaxKind2["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind2[SyntaxKind2["NamedImports"] = 272] = "NamedImports"; + SyntaxKind2[SyntaxKind2["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind2[SyntaxKind2["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind2[SyntaxKind2["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind2[SyntaxKind2["NamedExports"] = 276] = "NamedExports"; + SyntaxKind2[SyntaxKind2["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind2[SyntaxKind2["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind2[SyntaxKind2["MissingDeclaration"] = 279] = "MissingDeclaration"; + SyntaxKind2[SyntaxKind2["ExternalModuleReference"] = 280] = "ExternalModuleReference"; + SyntaxKind2[SyntaxKind2["JsxElement"] = 281] = "JsxElement"; + SyntaxKind2[SyntaxKind2["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind2[SyntaxKind2["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind2[SyntaxKind2["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind2[SyntaxKind2["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind2[SyntaxKind2["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind2[SyntaxKind2["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind2[SyntaxKind2["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind2[SyntaxKind2["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind2[SyntaxKind2["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind2[SyntaxKind2["JsxExpression"] = 291] = "JsxExpression"; + SyntaxKind2[SyntaxKind2["CaseClause"] = 292] = "CaseClause"; + SyntaxKind2[SyntaxKind2["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind2[SyntaxKind2["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind2[SyntaxKind2["CatchClause"] = 295] = "CatchClause"; + SyntaxKind2[SyntaxKind2["AssertClause"] = 296] = "AssertClause"; + SyntaxKind2[SyntaxKind2["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind2[SyntaxKind2["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; + SyntaxKind2[SyntaxKind2["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind2[SyntaxKind2["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind2[SyntaxKind2["SpreadAssignment"] = 301] = "SpreadAssignment"; + SyntaxKind2[SyntaxKind2["EnumMember"] = 302] = "EnumMember"; + SyntaxKind2[SyntaxKind2["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind2[SyntaxKind2["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind2[SyntaxKind2["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind2[SyntaxKind2["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind2[SyntaxKind2["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; + SyntaxKind2[SyntaxKind2["SourceFile"] = 308] = "SourceFile"; + SyntaxKind2[SyntaxKind2["Bundle"] = 309] = "Bundle"; + SyntaxKind2[SyntaxKind2["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind2[SyntaxKind2["InputFiles"] = 311] = "InputFiles"; + SyntaxKind2[SyntaxKind2["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind2[SyntaxKind2["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind2[SyntaxKind2["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind2[SyntaxKind2["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind2[SyntaxKind2["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind2[SyntaxKind2["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind2[SyntaxKind2["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind2[SyntaxKind2["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind2[SyntaxKind2["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind2[SyntaxKind2["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind2[SyntaxKind2["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind2[SyntaxKind2["JSDoc"] = 323] = "JSDoc"; + SyntaxKind2[SyntaxKind2["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind2[SyntaxKind2["JSDocText"] = 324] = "JSDocText"; + SyntaxKind2[SyntaxKind2["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind2[SyntaxKind2["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind2[SyntaxKind2["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind2[SyntaxKind2["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind2[SyntaxKind2["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind2[SyntaxKind2["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind2[SyntaxKind2["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind2[SyntaxKind2["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind2[SyntaxKind2["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind2[SyntaxKind2["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind2[SyntaxKind2["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind2[SyntaxKind2["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind2[SyntaxKind2["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind2[SyntaxKind2["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind2[SyntaxKind2["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind2[SyntaxKind2["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind2[SyntaxKind2["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind2[SyntaxKind2["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind2[SyntaxKind2["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind2[SyntaxKind2["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind2[SyntaxKind2["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind2[SyntaxKind2["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind2[SyntaxKind2["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind2[SyntaxKind2["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind2[SyntaxKind2["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind2[SyntaxKind2["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; + SyntaxKind2[SyntaxKind2["SyntaxList"] = 351] = "SyntaxList"; + SyntaxKind2[SyntaxKind2["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind2[SyntaxKind2["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind2[SyntaxKind2["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind2[SyntaxKind2["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind2[SyntaxKind2["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind2[SyntaxKind2["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; + SyntaxKind2[SyntaxKind2["Count"] = 358] = "Count"; + SyntaxKind2[SyntaxKind2["FirstAssignment"] = 63] = "FirstAssignment"; + SyntaxKind2[SyntaxKind2["LastAssignment"] = 78] = "LastAssignment"; + SyntaxKind2[SyntaxKind2["FirstCompoundAssignment"] = 64] = "FirstCompoundAssignment"; + SyntaxKind2[SyntaxKind2["LastCompoundAssignment"] = 78] = "LastCompoundAssignment"; + SyntaxKind2[SyntaxKind2["FirstReservedWord"] = 81] = "FirstReservedWord"; + SyntaxKind2[SyntaxKind2["LastReservedWord"] = 116] = "LastReservedWord"; + SyntaxKind2[SyntaxKind2["FirstKeyword"] = 81] = "FirstKeyword"; + SyntaxKind2[SyntaxKind2["LastKeyword"] = 162] = "LastKeyword"; + SyntaxKind2[SyntaxKind2["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; + SyntaxKind2[SyntaxKind2["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; + SyntaxKind2[SyntaxKind2["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind2[SyntaxKind2["LastTypeNode"] = 202] = "LastTypeNode"; + SyntaxKind2[SyntaxKind2["FirstPunctuation"] = 18] = "FirstPunctuation"; + SyntaxKind2[SyntaxKind2["LastPunctuation"] = 78] = "LastPunctuation"; + SyntaxKind2[SyntaxKind2["FirstToken"] = 0] = "FirstToken"; + SyntaxKind2[SyntaxKind2["LastToken"] = 162] = "LastToken"; + SyntaxKind2[SyntaxKind2["FirstTriviaToken"] = 2] = "FirstTriviaToken"; + SyntaxKind2[SyntaxKind2["LastTriviaToken"] = 7] = "LastTriviaToken"; + SyntaxKind2[SyntaxKind2["FirstLiteralToken"] = 8] = "FirstLiteralToken"; + SyntaxKind2[SyntaxKind2["LastLiteralToken"] = 14] = "LastLiteralToken"; + SyntaxKind2[SyntaxKind2["FirstTemplateToken"] = 14] = "FirstTemplateToken"; + SyntaxKind2[SyntaxKind2["LastTemplateToken"] = 17] = "LastTemplateToken"; + SyntaxKind2[SyntaxKind2["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; + SyntaxKind2[SyntaxKind2["LastBinaryOperator"] = 78] = "LastBinaryOperator"; + SyntaxKind2[SyntaxKind2["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind2[SyntaxKind2["LastStatement"] = 256] = "LastStatement"; + SyntaxKind2[SyntaxKind2["FirstNode"] = 163] = "FirstNode"; + SyntaxKind2[SyntaxKind2["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind2[SyntaxKind2["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind2[SyntaxKind2["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind2[SyntaxKind2["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; + SyntaxKind2[SyntaxKind2["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; + SyntaxKind2[SyntaxKind2["LastContextualKeyword"] = 162] = "LastContextualKeyword"; + })(SyntaxKind = ts6.SyntaxKind || (ts6.SyntaxKind = {})); + var NodeFlags2; + (function(NodeFlags3) { + NodeFlags3[NodeFlags3["None"] = 0] = "None"; + NodeFlags3[NodeFlags3["Let"] = 1] = "Let"; + NodeFlags3[NodeFlags3["Const"] = 2] = "Const"; + NodeFlags3[NodeFlags3["NestedNamespace"] = 4] = "NestedNamespace"; + NodeFlags3[NodeFlags3["Synthesized"] = 8] = "Synthesized"; + NodeFlags3[NodeFlags3["Namespace"] = 16] = "Namespace"; + NodeFlags3[NodeFlags3["OptionalChain"] = 32] = "OptionalChain"; + NodeFlags3[NodeFlags3["ExportContext"] = 64] = "ExportContext"; + NodeFlags3[NodeFlags3["ContainsThis"] = 128] = "ContainsThis"; + NodeFlags3[NodeFlags3["HasImplicitReturn"] = 256] = "HasImplicitReturn"; + NodeFlags3[NodeFlags3["HasExplicitReturn"] = 512] = "HasExplicitReturn"; + NodeFlags3[NodeFlags3["GlobalAugmentation"] = 1024] = "GlobalAugmentation"; + NodeFlags3[NodeFlags3["HasAsyncFunctions"] = 2048] = "HasAsyncFunctions"; + NodeFlags3[NodeFlags3["DisallowInContext"] = 4096] = "DisallowInContext"; + NodeFlags3[NodeFlags3["YieldContext"] = 8192] = "YieldContext"; + NodeFlags3[NodeFlags3["DecoratorContext"] = 16384] = "DecoratorContext"; + NodeFlags3[NodeFlags3["AwaitContext"] = 32768] = "AwaitContext"; + NodeFlags3[NodeFlags3["DisallowConditionalTypesContext"] = 65536] = "DisallowConditionalTypesContext"; + NodeFlags3[NodeFlags3["ThisNodeHasError"] = 131072] = "ThisNodeHasError"; + NodeFlags3[NodeFlags3["JavaScriptFile"] = 262144] = "JavaScriptFile"; + NodeFlags3[NodeFlags3["ThisNodeOrAnySubNodesHasError"] = 524288] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags3[NodeFlags3["HasAggregatedChildData"] = 1048576] = "HasAggregatedChildData"; + NodeFlags3[NodeFlags3["PossiblyContainsDynamicImport"] = 2097152] = "PossiblyContainsDynamicImport"; + NodeFlags3[NodeFlags3["PossiblyContainsImportMeta"] = 4194304] = "PossiblyContainsImportMeta"; + NodeFlags3[NodeFlags3["JSDoc"] = 8388608] = "JSDoc"; + NodeFlags3[NodeFlags3["Ambient"] = 16777216] = "Ambient"; + NodeFlags3[NodeFlags3["InWithStatement"] = 33554432] = "InWithStatement"; + NodeFlags3[NodeFlags3["JsonFile"] = 67108864] = "JsonFile"; + NodeFlags3[NodeFlags3["TypeCached"] = 134217728] = "TypeCached"; + NodeFlags3[NodeFlags3["Deprecated"] = 268435456] = "Deprecated"; + NodeFlags3[NodeFlags3["BlockScoped"] = 3] = "BlockScoped"; + NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags"; + NodeFlags3[NodeFlags3["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags"; + NodeFlags3[NodeFlags3["ContextFlags"] = 50720768] = "ContextFlags"; + NodeFlags3[NodeFlags3["TypeExcludesFlags"] = 40960] = "TypeExcludesFlags"; + NodeFlags3[NodeFlags3["PermanentlySetIncrementalFlags"] = 6291456] = "PermanentlySetIncrementalFlags"; + })(NodeFlags2 = ts6.NodeFlags || (ts6.NodeFlags = {})); + var ModifierFlags; + (function(ModifierFlags2) { + ModifierFlags2[ModifierFlags2["None"] = 0] = "None"; + ModifierFlags2[ModifierFlags2["Export"] = 1] = "Export"; + ModifierFlags2[ModifierFlags2["Ambient"] = 2] = "Ambient"; + ModifierFlags2[ModifierFlags2["Public"] = 4] = "Public"; + ModifierFlags2[ModifierFlags2["Private"] = 8] = "Private"; + ModifierFlags2[ModifierFlags2["Protected"] = 16] = "Protected"; + ModifierFlags2[ModifierFlags2["Static"] = 32] = "Static"; + ModifierFlags2[ModifierFlags2["Readonly"] = 64] = "Readonly"; + ModifierFlags2[ModifierFlags2["Accessor"] = 128] = "Accessor"; + ModifierFlags2[ModifierFlags2["Abstract"] = 256] = "Abstract"; + ModifierFlags2[ModifierFlags2["Async"] = 512] = "Async"; + ModifierFlags2[ModifierFlags2["Default"] = 1024] = "Default"; + ModifierFlags2[ModifierFlags2["Const"] = 2048] = "Const"; + ModifierFlags2[ModifierFlags2["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; + ModifierFlags2[ModifierFlags2["Deprecated"] = 8192] = "Deprecated"; + ModifierFlags2[ModifierFlags2["Override"] = 16384] = "Override"; + ModifierFlags2[ModifierFlags2["In"] = 32768] = "In"; + ModifierFlags2[ModifierFlags2["Out"] = 65536] = "Out"; + ModifierFlags2[ModifierFlags2["Decorator"] = 131072] = "Decorator"; + ModifierFlags2[ModifierFlags2["HasComputedFlags"] = 536870912] = "HasComputedFlags"; + ModifierFlags2[ModifierFlags2["AccessibilityModifier"] = 28] = "AccessibilityModifier"; + ModifierFlags2[ModifierFlags2["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; + ModifierFlags2[ModifierFlags2["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; + ModifierFlags2[ModifierFlags2["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags2[ModifierFlags2["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags2[ModifierFlags2["All"] = 258047] = "All"; + ModifierFlags2[ModifierFlags2["Modifier"] = 126975] = "Modifier"; + })(ModifierFlags = ts6.ModifierFlags || (ts6.ModifierFlags = {})); + var JsxFlags; + (function(JsxFlags2) { + JsxFlags2[JsxFlags2["None"] = 0] = "None"; + JsxFlags2[JsxFlags2["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement"; + JsxFlags2[JsxFlags2["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement"; + JsxFlags2[JsxFlags2["IntrinsicElement"] = 3] = "IntrinsicElement"; + })(JsxFlags = ts6.JsxFlags || (ts6.JsxFlags = {})); + var RelationComparisonResult; + (function(RelationComparisonResult2) { + RelationComparisonResult2[RelationComparisonResult2["Succeeded"] = 1] = "Succeeded"; + RelationComparisonResult2[RelationComparisonResult2["Failed"] = 2] = "Failed"; + RelationComparisonResult2[RelationComparisonResult2["Reported"] = 4] = "Reported"; + RelationComparisonResult2[RelationComparisonResult2["ReportsUnmeasurable"] = 8] = "ReportsUnmeasurable"; + RelationComparisonResult2[RelationComparisonResult2["ReportsUnreliable"] = 16] = "ReportsUnreliable"; + RelationComparisonResult2[RelationComparisonResult2["ReportsMask"] = 24] = "ReportsMask"; + })(RelationComparisonResult = ts6.RelationComparisonResult || (ts6.RelationComparisonResult = {})); + var GeneratedIdentifierFlags; + (function(GeneratedIdentifierFlags2) { + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Loop"] = 2] = "Loop"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Unique"] = 3] = "Unique"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Node"] = 4] = "Node"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["KindMask"] = 7] = "KindMask"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["ReservedInNestedScopes"] = 8] = "ReservedInNestedScopes"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Optimistic"] = 16] = "Optimistic"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["FileLevel"] = 32] = "FileLevel"; + GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["AllowNameSubstitution"] = 64] = "AllowNameSubstitution"; + })(GeneratedIdentifierFlags = ts6.GeneratedIdentifierFlags || (ts6.GeneratedIdentifierFlags = {})); + var TokenFlags; + (function(TokenFlags2) { + TokenFlags2[TokenFlags2["None"] = 0] = "None"; + TokenFlags2[TokenFlags2["PrecedingLineBreak"] = 1] = "PrecedingLineBreak"; + TokenFlags2[TokenFlags2["PrecedingJSDocComment"] = 2] = "PrecedingJSDocComment"; + TokenFlags2[TokenFlags2["Unterminated"] = 4] = "Unterminated"; + TokenFlags2[TokenFlags2["ExtendedUnicodeEscape"] = 8] = "ExtendedUnicodeEscape"; + TokenFlags2[TokenFlags2["Scientific"] = 16] = "Scientific"; + TokenFlags2[TokenFlags2["Octal"] = 32] = "Octal"; + TokenFlags2[TokenFlags2["HexSpecifier"] = 64] = "HexSpecifier"; + TokenFlags2[TokenFlags2["BinarySpecifier"] = 128] = "BinarySpecifier"; + TokenFlags2[TokenFlags2["OctalSpecifier"] = 256] = "OctalSpecifier"; + TokenFlags2[TokenFlags2["ContainsSeparator"] = 512] = "ContainsSeparator"; + TokenFlags2[TokenFlags2["UnicodeEscape"] = 1024] = "UnicodeEscape"; + TokenFlags2[TokenFlags2["ContainsInvalidEscape"] = 2048] = "ContainsInvalidEscape"; + TokenFlags2[TokenFlags2["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier"; + TokenFlags2[TokenFlags2["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags"; + TokenFlags2[TokenFlags2["TemplateLiteralLikeFlags"] = 2048] = "TemplateLiteralLikeFlags"; + })(TokenFlags = ts6.TokenFlags || (ts6.TokenFlags = {})); + var FlowFlags; + (function(FlowFlags2) { + FlowFlags2[FlowFlags2["Unreachable"] = 1] = "Unreachable"; + FlowFlags2[FlowFlags2["Start"] = 2] = "Start"; + FlowFlags2[FlowFlags2["BranchLabel"] = 4] = "BranchLabel"; + FlowFlags2[FlowFlags2["LoopLabel"] = 8] = "LoopLabel"; + FlowFlags2[FlowFlags2["Assignment"] = 16] = "Assignment"; + FlowFlags2[FlowFlags2["TrueCondition"] = 32] = "TrueCondition"; + FlowFlags2[FlowFlags2["FalseCondition"] = 64] = "FalseCondition"; + FlowFlags2[FlowFlags2["SwitchClause"] = 128] = "SwitchClause"; + FlowFlags2[FlowFlags2["ArrayMutation"] = 256] = "ArrayMutation"; + FlowFlags2[FlowFlags2["Call"] = 512] = "Call"; + FlowFlags2[FlowFlags2["ReduceLabel"] = 1024] = "ReduceLabel"; + FlowFlags2[FlowFlags2["Referenced"] = 2048] = "Referenced"; + FlowFlags2[FlowFlags2["Shared"] = 4096] = "Shared"; + FlowFlags2[FlowFlags2["Label"] = 12] = "Label"; + FlowFlags2[FlowFlags2["Condition"] = 96] = "Condition"; + })(FlowFlags = ts6.FlowFlags || (ts6.FlowFlags = {})); + var CommentDirectiveType; + (function(CommentDirectiveType2) { + CommentDirectiveType2[CommentDirectiveType2["ExpectError"] = 0] = "ExpectError"; + CommentDirectiveType2[CommentDirectiveType2["Ignore"] = 1] = "Ignore"; + })(CommentDirectiveType = ts6.CommentDirectiveType || (ts6.CommentDirectiveType = {})); + var OperationCanceledException = ( + /** @class */ + function() { + function OperationCanceledException2() { + } + return OperationCanceledException2; + }() + ); + ts6.OperationCanceledException = OperationCanceledException; + var FileIncludeKind; + (function(FileIncludeKind2) { + FileIncludeKind2[FileIncludeKind2["RootFile"] = 0] = "RootFile"; + FileIncludeKind2[FileIncludeKind2["SourceFromProjectReference"] = 1] = "SourceFromProjectReference"; + FileIncludeKind2[FileIncludeKind2["OutputFromProjectReference"] = 2] = "OutputFromProjectReference"; + FileIncludeKind2[FileIncludeKind2["Import"] = 3] = "Import"; + FileIncludeKind2[FileIncludeKind2["ReferenceFile"] = 4] = "ReferenceFile"; + FileIncludeKind2[FileIncludeKind2["TypeReferenceDirective"] = 5] = "TypeReferenceDirective"; + FileIncludeKind2[FileIncludeKind2["LibFile"] = 6] = "LibFile"; + FileIncludeKind2[FileIncludeKind2["LibReferenceDirective"] = 7] = "LibReferenceDirective"; + FileIncludeKind2[FileIncludeKind2["AutomaticTypeDirectiveFile"] = 8] = "AutomaticTypeDirectiveFile"; + })(FileIncludeKind = ts6.FileIncludeKind || (ts6.FileIncludeKind = {})); + var FilePreprocessingDiagnosticsKind; + (function(FilePreprocessingDiagnosticsKind2) { + FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic"; + FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic"; + })(FilePreprocessingDiagnosticsKind = ts6.FilePreprocessingDiagnosticsKind || (ts6.FilePreprocessingDiagnosticsKind = {})); + var StructureIsReused; + (function(StructureIsReused2) { + StructureIsReused2[StructureIsReused2["Not"] = 0] = "Not"; + StructureIsReused2[StructureIsReused2["SafeModules"] = 1] = "SafeModules"; + StructureIsReused2[StructureIsReused2["Completely"] = 2] = "Completely"; + })(StructureIsReused = ts6.StructureIsReused || (ts6.StructureIsReused = {})); + var ExitStatus; + (function(ExitStatus2) { + ExitStatus2[ExitStatus2["Success"] = 0] = "Success"; + ExitStatus2[ExitStatus2["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; + ExitStatus2[ExitStatus2["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; + ExitStatus2[ExitStatus2["InvalidProject_OutputsSkipped"] = 3] = "InvalidProject_OutputsSkipped"; + ExitStatus2[ExitStatus2["ProjectReferenceCycle_OutputsSkipped"] = 4] = "ProjectReferenceCycle_OutputsSkipped"; + ExitStatus2[ExitStatus2["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped"; + })(ExitStatus = ts6.ExitStatus || (ts6.ExitStatus = {})); + var MemberOverrideStatus; + (function(MemberOverrideStatus2) { + MemberOverrideStatus2[MemberOverrideStatus2["Ok"] = 0] = "Ok"; + MemberOverrideStatus2[MemberOverrideStatus2["NeedsOverride"] = 1] = "NeedsOverride"; + MemberOverrideStatus2[MemberOverrideStatus2["HasInvalidOverride"] = 2] = "HasInvalidOverride"; + })(MemberOverrideStatus = ts6.MemberOverrideStatus || (ts6.MemberOverrideStatus = {})); + var UnionReduction; + (function(UnionReduction2) { + UnionReduction2[UnionReduction2["None"] = 0] = "None"; + UnionReduction2[UnionReduction2["Literal"] = 1] = "Literal"; + UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype"; + })(UnionReduction = ts6.UnionReduction || (ts6.UnionReduction = {})); + var ContextFlags; + (function(ContextFlags2) { + ContextFlags2[ContextFlags2["None"] = 0] = "None"; + ContextFlags2[ContextFlags2["Signature"] = 1] = "Signature"; + ContextFlags2[ContextFlags2["NoConstraints"] = 2] = "NoConstraints"; + ContextFlags2[ContextFlags2["Completions"] = 4] = "Completions"; + ContextFlags2[ContextFlags2["SkipBindingPatterns"] = 8] = "SkipBindingPatterns"; + })(ContextFlags = ts6.ContextFlags || (ts6.ContextFlags = {})); + var NodeBuilderFlags; + (function(NodeBuilderFlags2) { + NodeBuilderFlags2[NodeBuilderFlags2["None"] = 0] = "None"; + NodeBuilderFlags2[NodeBuilderFlags2["NoTruncation"] = 1] = "NoTruncation"; + NodeBuilderFlags2[NodeBuilderFlags2["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType"; + NodeBuilderFlags2[NodeBuilderFlags2["GenerateNamesForShadowedTypeParams"] = 4] = "GenerateNamesForShadowedTypeParams"; + NodeBuilderFlags2[NodeBuilderFlags2["UseStructuralFallback"] = 8] = "UseStructuralFallback"; + NodeBuilderFlags2[NodeBuilderFlags2["ForbidIndexedAccessSymbolReferences"] = 16] = "ForbidIndexedAccessSymbolReferences"; + NodeBuilderFlags2[NodeBuilderFlags2["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + NodeBuilderFlags2[NodeBuilderFlags2["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType"; + NodeBuilderFlags2[NodeBuilderFlags2["UseOnlyExternalAliasing"] = 128] = "UseOnlyExternalAliasing"; + NodeBuilderFlags2[NodeBuilderFlags2["SuppressAnyReturnType"] = 256] = "SuppressAnyReturnType"; + NodeBuilderFlags2[NodeBuilderFlags2["WriteTypeParametersInQualifiedName"] = 512] = "WriteTypeParametersInQualifiedName"; + NodeBuilderFlags2[NodeBuilderFlags2["MultilineObjectLiterals"] = 1024] = "MultilineObjectLiterals"; + NodeBuilderFlags2[NodeBuilderFlags2["WriteClassExpressionAsTypeLiteral"] = 2048] = "WriteClassExpressionAsTypeLiteral"; + NodeBuilderFlags2[NodeBuilderFlags2["UseTypeOfFunction"] = 4096] = "UseTypeOfFunction"; + NodeBuilderFlags2[NodeBuilderFlags2["OmitParameterModifiers"] = 8192] = "OmitParameterModifiers"; + NodeBuilderFlags2[NodeBuilderFlags2["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope"; + NodeBuilderFlags2[NodeBuilderFlags2["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType"; + NodeBuilderFlags2[NodeBuilderFlags2["NoTypeReduction"] = 536870912] = "NoTypeReduction"; + NodeBuilderFlags2[NodeBuilderFlags2["OmitThisParameter"] = 33554432] = "OmitThisParameter"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowQualifedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowAnonymousIdentifier"] = 131072] = "AllowAnonymousIdentifier"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyUnionOrIntersection"] = 262144] = "AllowEmptyUnionOrIntersection"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + NodeBuilderFlags2[NodeBuilderFlags2["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; + NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; + NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; + NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors"; + NodeBuilderFlags2[NodeBuilderFlags2["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral"; + NodeBuilderFlags2[NodeBuilderFlags2["InTypeAlias"] = 8388608] = "InTypeAlias"; + NodeBuilderFlags2[NodeBuilderFlags2["InInitialEntityName"] = 16777216] = "InInitialEntityName"; + })(NodeBuilderFlags = ts6.NodeBuilderFlags || (ts6.NodeBuilderFlags = {})); + var TypeFormatFlags; + (function(TypeFormatFlags2) { + TypeFormatFlags2[TypeFormatFlags2["None"] = 0] = "None"; + TypeFormatFlags2[TypeFormatFlags2["NoTruncation"] = 1] = "NoTruncation"; + TypeFormatFlags2[TypeFormatFlags2["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType"; + TypeFormatFlags2[TypeFormatFlags2["UseStructuralFallback"] = 8] = "UseStructuralFallback"; + TypeFormatFlags2[TypeFormatFlags2["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + TypeFormatFlags2[TypeFormatFlags2["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType"; + TypeFormatFlags2[TypeFormatFlags2["SuppressAnyReturnType"] = 256] = "SuppressAnyReturnType"; + TypeFormatFlags2[TypeFormatFlags2["MultilineObjectLiterals"] = 1024] = "MultilineObjectLiterals"; + TypeFormatFlags2[TypeFormatFlags2["WriteClassExpressionAsTypeLiteral"] = 2048] = "WriteClassExpressionAsTypeLiteral"; + TypeFormatFlags2[TypeFormatFlags2["UseTypeOfFunction"] = 4096] = "UseTypeOfFunction"; + TypeFormatFlags2[TypeFormatFlags2["OmitParameterModifiers"] = 8192] = "OmitParameterModifiers"; + TypeFormatFlags2[TypeFormatFlags2["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope"; + TypeFormatFlags2[TypeFormatFlags2["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType"; + TypeFormatFlags2[TypeFormatFlags2["NoTypeReduction"] = 536870912] = "NoTypeReduction"; + TypeFormatFlags2[TypeFormatFlags2["OmitThisParameter"] = 33554432] = "OmitThisParameter"; + TypeFormatFlags2[TypeFormatFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; + TypeFormatFlags2[TypeFormatFlags2["AddUndefined"] = 131072] = "AddUndefined"; + TypeFormatFlags2[TypeFormatFlags2["WriteArrowStyleSignature"] = 262144] = "WriteArrowStyleSignature"; + TypeFormatFlags2[TypeFormatFlags2["InArrayType"] = 524288] = "InArrayType"; + TypeFormatFlags2[TypeFormatFlags2["InElementType"] = 2097152] = "InElementType"; + TypeFormatFlags2[TypeFormatFlags2["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument"; + TypeFormatFlags2[TypeFormatFlags2["InTypeAlias"] = 8388608] = "InTypeAlias"; + TypeFormatFlags2[TypeFormatFlags2["WriteOwnNameForAnyLike"] = 0] = "WriteOwnNameForAnyLike"; + TypeFormatFlags2[TypeFormatFlags2["NodeBuilderFlagsMask"] = 848330091] = "NodeBuilderFlagsMask"; + })(TypeFormatFlags = ts6.TypeFormatFlags || (ts6.TypeFormatFlags = {})); + var SymbolFormatFlags; + (function(SymbolFormatFlags2) { + SymbolFormatFlags2[SymbolFormatFlags2["None"] = 0] = "None"; + SymbolFormatFlags2[SymbolFormatFlags2["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments"; + SymbolFormatFlags2[SymbolFormatFlags2["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; + SymbolFormatFlags2[SymbolFormatFlags2["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; + SymbolFormatFlags2[SymbolFormatFlags2["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + SymbolFormatFlags2[SymbolFormatFlags2["WriteComputedProps"] = 16] = "WriteComputedProps"; + SymbolFormatFlags2[SymbolFormatFlags2["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; + })(SymbolFormatFlags = ts6.SymbolFormatFlags || (ts6.SymbolFormatFlags = {})); + var SymbolAccessibility; + (function(SymbolAccessibility2) { + SymbolAccessibility2[SymbolAccessibility2["Accessible"] = 0] = "Accessible"; + SymbolAccessibility2[SymbolAccessibility2["NotAccessible"] = 1] = "NotAccessible"; + SymbolAccessibility2[SymbolAccessibility2["CannotBeNamed"] = 2] = "CannotBeNamed"; + })(SymbolAccessibility = ts6.SymbolAccessibility || (ts6.SymbolAccessibility = {})); + var SyntheticSymbolKind; + (function(SyntheticSymbolKind2) { + SyntheticSymbolKind2[SyntheticSymbolKind2["UnionOrIntersection"] = 0] = "UnionOrIntersection"; + SyntheticSymbolKind2[SyntheticSymbolKind2["Spread"] = 1] = "Spread"; + })(SyntheticSymbolKind = ts6.SyntheticSymbolKind || (ts6.SyntheticSymbolKind = {})); + var TypePredicateKind; + (function(TypePredicateKind2) { + TypePredicateKind2[TypePredicateKind2["This"] = 0] = "This"; + TypePredicateKind2[TypePredicateKind2["Identifier"] = 1] = "Identifier"; + TypePredicateKind2[TypePredicateKind2["AssertsThis"] = 2] = "AssertsThis"; + TypePredicateKind2[TypePredicateKind2["AssertsIdentifier"] = 3] = "AssertsIdentifier"; + })(TypePredicateKind = ts6.TypePredicateKind || (ts6.TypePredicateKind = {})); + var TypeReferenceSerializationKind; + (function(TypeReferenceSerializationKind2) { + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["Unknown"] = 0] = "Unknown"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["VoidNullableOrNeverType"] = 2] = "VoidNullableOrNeverType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["NumberLikeType"] = 3] = "NumberLikeType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["BigIntLikeType"] = 4] = "BigIntLikeType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["StringLikeType"] = 5] = "StringLikeType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["BooleanType"] = 6] = "BooleanType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["ArrayLikeType"] = 7] = "ArrayLikeType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["ESSymbolType"] = 8] = "ESSymbolType"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["Promise"] = 9] = "Promise"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["TypeWithCallSignature"] = 10] = "TypeWithCallSignature"; + TypeReferenceSerializationKind2[TypeReferenceSerializationKind2["ObjectType"] = 11] = "ObjectType"; + })(TypeReferenceSerializationKind = ts6.TypeReferenceSerializationKind || (ts6.TypeReferenceSerializationKind = {})); + var SymbolFlags3; + (function(SymbolFlags4) { + SymbolFlags4[SymbolFlags4["None"] = 0] = "None"; + SymbolFlags4[SymbolFlags4["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; + SymbolFlags4[SymbolFlags4["BlockScopedVariable"] = 2] = "BlockScopedVariable"; + SymbolFlags4[SymbolFlags4["Property"] = 4] = "Property"; + SymbolFlags4[SymbolFlags4["EnumMember"] = 8] = "EnumMember"; + SymbolFlags4[SymbolFlags4["Function"] = 16] = "Function"; + SymbolFlags4[SymbolFlags4["Class"] = 32] = "Class"; + SymbolFlags4[SymbolFlags4["Interface"] = 64] = "Interface"; + SymbolFlags4[SymbolFlags4["ConstEnum"] = 128] = "ConstEnum"; + SymbolFlags4[SymbolFlags4["RegularEnum"] = 256] = "RegularEnum"; + SymbolFlags4[SymbolFlags4["ValueModule"] = 512] = "ValueModule"; + SymbolFlags4[SymbolFlags4["NamespaceModule"] = 1024] = "NamespaceModule"; + SymbolFlags4[SymbolFlags4["TypeLiteral"] = 2048] = "TypeLiteral"; + SymbolFlags4[SymbolFlags4["ObjectLiteral"] = 4096] = "ObjectLiteral"; + SymbolFlags4[SymbolFlags4["Method"] = 8192] = "Method"; + SymbolFlags4[SymbolFlags4["Constructor"] = 16384] = "Constructor"; + SymbolFlags4[SymbolFlags4["GetAccessor"] = 32768] = "GetAccessor"; + SymbolFlags4[SymbolFlags4["SetAccessor"] = 65536] = "SetAccessor"; + SymbolFlags4[SymbolFlags4["Signature"] = 131072] = "Signature"; + SymbolFlags4[SymbolFlags4["TypeParameter"] = 262144] = "TypeParameter"; + SymbolFlags4[SymbolFlags4["TypeAlias"] = 524288] = "TypeAlias"; + SymbolFlags4[SymbolFlags4["ExportValue"] = 1048576] = "ExportValue"; + SymbolFlags4[SymbolFlags4["Alias"] = 2097152] = "Alias"; + SymbolFlags4[SymbolFlags4["Prototype"] = 4194304] = "Prototype"; + SymbolFlags4[SymbolFlags4["ExportStar"] = 8388608] = "ExportStar"; + SymbolFlags4[SymbolFlags4["Optional"] = 16777216] = "Optional"; + SymbolFlags4[SymbolFlags4["Transient"] = 33554432] = "Transient"; + SymbolFlags4[SymbolFlags4["Assignment"] = 67108864] = "Assignment"; + SymbolFlags4[SymbolFlags4["ModuleExports"] = 134217728] = "ModuleExports"; + SymbolFlags4[SymbolFlags4["All"] = 67108863] = "All"; + SymbolFlags4[SymbolFlags4["Enum"] = 384] = "Enum"; + SymbolFlags4[SymbolFlags4["Variable"] = 3] = "Variable"; + SymbolFlags4[SymbolFlags4["Value"] = 111551] = "Value"; + SymbolFlags4[SymbolFlags4["Type"] = 788968] = "Type"; + SymbolFlags4[SymbolFlags4["Namespace"] = 1920] = "Namespace"; + SymbolFlags4[SymbolFlags4["Module"] = 1536] = "Module"; + SymbolFlags4[SymbolFlags4["Accessor"] = 98304] = "Accessor"; + SymbolFlags4[SymbolFlags4["FunctionScopedVariableExcludes"] = 111550] = "FunctionScopedVariableExcludes"; + SymbolFlags4[SymbolFlags4["BlockScopedVariableExcludes"] = 111551] = "BlockScopedVariableExcludes"; + SymbolFlags4[SymbolFlags4["ParameterExcludes"] = 111551] = "ParameterExcludes"; + SymbolFlags4[SymbolFlags4["PropertyExcludes"] = 0] = "PropertyExcludes"; + SymbolFlags4[SymbolFlags4["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes"; + SymbolFlags4[SymbolFlags4["FunctionExcludes"] = 110991] = "FunctionExcludes"; + SymbolFlags4[SymbolFlags4["ClassExcludes"] = 899503] = "ClassExcludes"; + SymbolFlags4[SymbolFlags4["InterfaceExcludes"] = 788872] = "InterfaceExcludes"; + SymbolFlags4[SymbolFlags4["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes"; + SymbolFlags4[SymbolFlags4["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes"; + SymbolFlags4[SymbolFlags4["ValueModuleExcludes"] = 110735] = "ValueModuleExcludes"; + SymbolFlags4[SymbolFlags4["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; + SymbolFlags4[SymbolFlags4["MethodExcludes"] = 103359] = "MethodExcludes"; + SymbolFlags4[SymbolFlags4["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; + SymbolFlags4[SymbolFlags4["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags4[SymbolFlags4["AccessorExcludes"] = 13247] = "AccessorExcludes"; + SymbolFlags4[SymbolFlags4["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; + SymbolFlags4[SymbolFlags4["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; + SymbolFlags4[SymbolFlags4["AliasExcludes"] = 2097152] = "AliasExcludes"; + SymbolFlags4[SymbolFlags4["ModuleMember"] = 2623475] = "ModuleMember"; + SymbolFlags4[SymbolFlags4["ExportHasLocal"] = 944] = "ExportHasLocal"; + SymbolFlags4[SymbolFlags4["BlockScoped"] = 418] = "BlockScoped"; + SymbolFlags4[SymbolFlags4["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; + SymbolFlags4[SymbolFlags4["ClassMember"] = 106500] = "ClassMember"; + SymbolFlags4[SymbolFlags4["ExportSupportsDefaultModifier"] = 112] = "ExportSupportsDefaultModifier"; + SymbolFlags4[SymbolFlags4["ExportDoesNotSupportDefaultModifier"] = -113] = "ExportDoesNotSupportDefaultModifier"; + SymbolFlags4[SymbolFlags4["Classifiable"] = 2885600] = "Classifiable"; + SymbolFlags4[SymbolFlags4["LateBindingContainer"] = 6256] = "LateBindingContainer"; + })(SymbolFlags3 = ts6.SymbolFlags || (ts6.SymbolFlags = {})); + var EnumKind; + (function(EnumKind2) { + EnumKind2[EnumKind2["Numeric"] = 0] = "Numeric"; + EnumKind2[EnumKind2["Literal"] = 1] = "Literal"; + })(EnumKind = ts6.EnumKind || (ts6.EnumKind = {})); + var CheckFlags; + (function(CheckFlags2) { + CheckFlags2[CheckFlags2["Instantiated"] = 1] = "Instantiated"; + CheckFlags2[CheckFlags2["SyntheticProperty"] = 2] = "SyntheticProperty"; + CheckFlags2[CheckFlags2["SyntheticMethod"] = 4] = "SyntheticMethod"; + CheckFlags2[CheckFlags2["Readonly"] = 8] = "Readonly"; + CheckFlags2[CheckFlags2["ReadPartial"] = 16] = "ReadPartial"; + CheckFlags2[CheckFlags2["WritePartial"] = 32] = "WritePartial"; + CheckFlags2[CheckFlags2["HasNonUniformType"] = 64] = "HasNonUniformType"; + CheckFlags2[CheckFlags2["HasLiteralType"] = 128] = "HasLiteralType"; + CheckFlags2[CheckFlags2["ContainsPublic"] = 256] = "ContainsPublic"; + CheckFlags2[CheckFlags2["ContainsProtected"] = 512] = "ContainsProtected"; + CheckFlags2[CheckFlags2["ContainsPrivate"] = 1024] = "ContainsPrivate"; + CheckFlags2[CheckFlags2["ContainsStatic"] = 2048] = "ContainsStatic"; + CheckFlags2[CheckFlags2["Late"] = 4096] = "Late"; + CheckFlags2[CheckFlags2["ReverseMapped"] = 8192] = "ReverseMapped"; + CheckFlags2[CheckFlags2["OptionalParameter"] = 16384] = "OptionalParameter"; + CheckFlags2[CheckFlags2["RestParameter"] = 32768] = "RestParameter"; + CheckFlags2[CheckFlags2["DeferredType"] = 65536] = "DeferredType"; + CheckFlags2[CheckFlags2["HasNeverType"] = 131072] = "HasNeverType"; + CheckFlags2[CheckFlags2["Mapped"] = 262144] = "Mapped"; + CheckFlags2[CheckFlags2["StripOptional"] = 524288] = "StripOptional"; + CheckFlags2[CheckFlags2["Unresolved"] = 1048576] = "Unresolved"; + CheckFlags2[CheckFlags2["Synthetic"] = 6] = "Synthetic"; + CheckFlags2[CheckFlags2["Discriminant"] = 192] = "Discriminant"; + CheckFlags2[CheckFlags2["Partial"] = 48] = "Partial"; + })(CheckFlags = ts6.CheckFlags || (ts6.CheckFlags = {})); + var InternalSymbolName; + (function(InternalSymbolName2) { + InternalSymbolName2["Call"] = "__call"; + InternalSymbolName2["Constructor"] = "__constructor"; + InternalSymbolName2["New"] = "__new"; + InternalSymbolName2["Index"] = "__index"; + InternalSymbolName2["ExportStar"] = "__export"; + InternalSymbolName2["Global"] = "__global"; + InternalSymbolName2["Missing"] = "__missing"; + InternalSymbolName2["Type"] = "__type"; + InternalSymbolName2["Object"] = "__object"; + InternalSymbolName2["JSXAttributes"] = "__jsxAttributes"; + InternalSymbolName2["Class"] = "__class"; + InternalSymbolName2["Function"] = "__function"; + InternalSymbolName2["Computed"] = "__computed"; + InternalSymbolName2["Resolving"] = "__resolving__"; + InternalSymbolName2["ExportEquals"] = "export="; + InternalSymbolName2["Default"] = "default"; + InternalSymbolName2["This"] = "this"; + })(InternalSymbolName = ts6.InternalSymbolName || (ts6.InternalSymbolName = {})); + var NodeCheckFlags; + (function(NodeCheckFlags2) { + NodeCheckFlags2[NodeCheckFlags2["TypeChecked"] = 1] = "TypeChecked"; + NodeCheckFlags2[NodeCheckFlags2["LexicalThis"] = 2] = "LexicalThis"; + NodeCheckFlags2[NodeCheckFlags2["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags2[NodeCheckFlags2["CaptureNewTarget"] = 8] = "CaptureNewTarget"; + NodeCheckFlags2[NodeCheckFlags2["SuperInstance"] = 256] = "SuperInstance"; + NodeCheckFlags2[NodeCheckFlags2["SuperStatic"] = 512] = "SuperStatic"; + NodeCheckFlags2[NodeCheckFlags2["ContextChecked"] = 1024] = "ContextChecked"; + NodeCheckFlags2[NodeCheckFlags2["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags2[NodeCheckFlags2["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; + NodeCheckFlags2[NodeCheckFlags2["CaptureArguments"] = 8192] = "CaptureArguments"; + NodeCheckFlags2[NodeCheckFlags2["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; + NodeCheckFlags2[NodeCheckFlags2["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; + NodeCheckFlags2[NodeCheckFlags2["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding"; + NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 131072] = "ContainsCapturedBlockScopeBinding"; + NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 262144] = "CapturedBlockScopedBinding"; + NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 524288] = "BlockScopedBindingInLoop"; + NodeCheckFlags2[NodeCheckFlags2["ClassWithBodyScopedClassBinding"] = 1048576] = "ClassWithBodyScopedClassBinding"; + NodeCheckFlags2[NodeCheckFlags2["BodyScopedClassBinding"] = 2097152] = "BodyScopedClassBinding"; + NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 4194304] = "NeedsLoopOutParameter"; + NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 8388608] = "AssignmentsMarked"; + NodeCheckFlags2[NodeCheckFlags2["ClassWithConstructorReference"] = 16777216] = "ClassWithConstructorReference"; + NodeCheckFlags2[NodeCheckFlags2["ConstructorReferenceInClass"] = 33554432] = "ConstructorReferenceInClass"; + NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 67108864] = "ContainsClassWithPrivateIdentifiers"; + NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 134217728] = "ContainsSuperPropertyInStaticInitializer"; + NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 268435456] = "InCheckIdentifier"; + })(NodeCheckFlags = ts6.NodeCheckFlags || (ts6.NodeCheckFlags = {})); + var TypeFlags2; + (function(TypeFlags3) { + TypeFlags3[TypeFlags3["Any"] = 1] = "Any"; + TypeFlags3[TypeFlags3["Unknown"] = 2] = "Unknown"; + TypeFlags3[TypeFlags3["String"] = 4] = "String"; + TypeFlags3[TypeFlags3["Number"] = 8] = "Number"; + TypeFlags3[TypeFlags3["Boolean"] = 16] = "Boolean"; + TypeFlags3[TypeFlags3["Enum"] = 32] = "Enum"; + TypeFlags3[TypeFlags3["BigInt"] = 64] = "BigInt"; + TypeFlags3[TypeFlags3["StringLiteral"] = 128] = "StringLiteral"; + TypeFlags3[TypeFlags3["NumberLiteral"] = 256] = "NumberLiteral"; + TypeFlags3[TypeFlags3["BooleanLiteral"] = 512] = "BooleanLiteral"; + TypeFlags3[TypeFlags3["EnumLiteral"] = 1024] = "EnumLiteral"; + TypeFlags3[TypeFlags3["BigIntLiteral"] = 2048] = "BigIntLiteral"; + TypeFlags3[TypeFlags3["ESSymbol"] = 4096] = "ESSymbol"; + TypeFlags3[TypeFlags3["UniqueESSymbol"] = 8192] = "UniqueESSymbol"; + TypeFlags3[TypeFlags3["Void"] = 16384] = "Void"; + TypeFlags3[TypeFlags3["Undefined"] = 32768] = "Undefined"; + TypeFlags3[TypeFlags3["Null"] = 65536] = "Null"; + TypeFlags3[TypeFlags3["Never"] = 131072] = "Never"; + TypeFlags3[TypeFlags3["TypeParameter"] = 262144] = "TypeParameter"; + TypeFlags3[TypeFlags3["Object"] = 524288] = "Object"; + TypeFlags3[TypeFlags3["Union"] = 1048576] = "Union"; + TypeFlags3[TypeFlags3["Intersection"] = 2097152] = "Intersection"; + TypeFlags3[TypeFlags3["Index"] = 4194304] = "Index"; + TypeFlags3[TypeFlags3["IndexedAccess"] = 8388608] = "IndexedAccess"; + TypeFlags3[TypeFlags3["Conditional"] = 16777216] = "Conditional"; + TypeFlags3[TypeFlags3["Substitution"] = 33554432] = "Substitution"; + TypeFlags3[TypeFlags3["NonPrimitive"] = 67108864] = "NonPrimitive"; + TypeFlags3[TypeFlags3["TemplateLiteral"] = 134217728] = "TemplateLiteral"; + TypeFlags3[TypeFlags3["StringMapping"] = 268435456] = "StringMapping"; + TypeFlags3[TypeFlags3["AnyOrUnknown"] = 3] = "AnyOrUnknown"; + TypeFlags3[TypeFlags3["Nullable"] = 98304] = "Nullable"; + TypeFlags3[TypeFlags3["Literal"] = 2944] = "Literal"; + TypeFlags3[TypeFlags3["Unit"] = 109440] = "Unit"; + TypeFlags3[TypeFlags3["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral"; + TypeFlags3[TypeFlags3["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique"; + TypeFlags3[TypeFlags3["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy"; + TypeFlags3[TypeFlags3["PossiblyFalsy"] = 117724] = "PossiblyFalsy"; + TypeFlags3[TypeFlags3["Intrinsic"] = 67359327] = "Intrinsic"; + TypeFlags3[TypeFlags3["Primitive"] = 131068] = "Primitive"; + TypeFlags3[TypeFlags3["StringLike"] = 402653316] = "StringLike"; + TypeFlags3[TypeFlags3["NumberLike"] = 296] = "NumberLike"; + TypeFlags3[TypeFlags3["BigIntLike"] = 2112] = "BigIntLike"; + TypeFlags3[TypeFlags3["BooleanLike"] = 528] = "BooleanLike"; + TypeFlags3[TypeFlags3["EnumLike"] = 1056] = "EnumLike"; + TypeFlags3[TypeFlags3["ESSymbolLike"] = 12288] = "ESSymbolLike"; + TypeFlags3[TypeFlags3["VoidLike"] = 49152] = "VoidLike"; + TypeFlags3[TypeFlags3["DefinitelyNonNullable"] = 470302716] = "DefinitelyNonNullable"; + TypeFlags3[TypeFlags3["DisjointDomains"] = 469892092] = "DisjointDomains"; + TypeFlags3[TypeFlags3["UnionOrIntersection"] = 3145728] = "UnionOrIntersection"; + TypeFlags3[TypeFlags3["StructuredType"] = 3670016] = "StructuredType"; + TypeFlags3[TypeFlags3["TypeVariable"] = 8650752] = "TypeVariable"; + TypeFlags3[TypeFlags3["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive"; + TypeFlags3[TypeFlags3["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive"; + TypeFlags3[TypeFlags3["Instantiable"] = 465829888] = "Instantiable"; + TypeFlags3[TypeFlags3["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable"; + TypeFlags3[TypeFlags3["ObjectFlagsType"] = 3899393] = "ObjectFlagsType"; + TypeFlags3[TypeFlags3["Simplifiable"] = 25165824] = "Simplifiable"; + TypeFlags3[TypeFlags3["Singleton"] = 67358815] = "Singleton"; + TypeFlags3[TypeFlags3["Narrowable"] = 536624127] = "Narrowable"; + TypeFlags3[TypeFlags3["IncludesMask"] = 205258751] = "IncludesMask"; + TypeFlags3[TypeFlags3["IncludesMissingType"] = 262144] = "IncludesMissingType"; + TypeFlags3[TypeFlags3["IncludesNonWideningType"] = 4194304] = "IncludesNonWideningType"; + TypeFlags3[TypeFlags3["IncludesWildcard"] = 8388608] = "IncludesWildcard"; + TypeFlags3[TypeFlags3["IncludesEmptyObject"] = 16777216] = "IncludesEmptyObject"; + TypeFlags3[TypeFlags3["IncludesInstantiable"] = 33554432] = "IncludesInstantiable"; + TypeFlags3[TypeFlags3["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion"; + })(TypeFlags2 = ts6.TypeFlags || (ts6.TypeFlags = {})); + var ObjectFlags2; + (function(ObjectFlags3) { + ObjectFlags3[ObjectFlags3["Class"] = 1] = "Class"; + ObjectFlags3[ObjectFlags3["Interface"] = 2] = "Interface"; + ObjectFlags3[ObjectFlags3["Reference"] = 4] = "Reference"; + ObjectFlags3[ObjectFlags3["Tuple"] = 8] = "Tuple"; + ObjectFlags3[ObjectFlags3["Anonymous"] = 16] = "Anonymous"; + ObjectFlags3[ObjectFlags3["Mapped"] = 32] = "Mapped"; + ObjectFlags3[ObjectFlags3["Instantiated"] = 64] = "Instantiated"; + ObjectFlags3[ObjectFlags3["ObjectLiteral"] = 128] = "ObjectLiteral"; + ObjectFlags3[ObjectFlags3["EvolvingArray"] = 256] = "EvolvingArray"; + ObjectFlags3[ObjectFlags3["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties"; + ObjectFlags3[ObjectFlags3["ReverseMapped"] = 1024] = "ReverseMapped"; + ObjectFlags3[ObjectFlags3["JsxAttributes"] = 2048] = "JsxAttributes"; + ObjectFlags3[ObjectFlags3["JSLiteral"] = 4096] = "JSLiteral"; + ObjectFlags3[ObjectFlags3["FreshLiteral"] = 8192] = "FreshLiteral"; + ObjectFlags3[ObjectFlags3["ArrayLiteral"] = 16384] = "ArrayLiteral"; + ObjectFlags3[ObjectFlags3["PrimitiveUnion"] = 32768] = "PrimitiveUnion"; + ObjectFlags3[ObjectFlags3["ContainsWideningType"] = 65536] = "ContainsWideningType"; + ObjectFlags3[ObjectFlags3["ContainsObjectOrArrayLiteral"] = 131072] = "ContainsObjectOrArrayLiteral"; + ObjectFlags3[ObjectFlags3["NonInferrableType"] = 262144] = "NonInferrableType"; + ObjectFlags3[ObjectFlags3["CouldContainTypeVariablesComputed"] = 524288] = "CouldContainTypeVariablesComputed"; + ObjectFlags3[ObjectFlags3["CouldContainTypeVariables"] = 1048576] = "CouldContainTypeVariables"; + ObjectFlags3[ObjectFlags3["ClassOrInterface"] = 3] = "ClassOrInterface"; + ObjectFlags3[ObjectFlags3["RequiresWidening"] = 196608] = "RequiresWidening"; + ObjectFlags3[ObjectFlags3["PropagatingFlags"] = 458752] = "PropagatingFlags"; + ObjectFlags3[ObjectFlags3["ObjectTypeKindMask"] = 1343] = "ObjectTypeKindMask"; + ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread"; + ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType"; + ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType"; + ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone"; + ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated"; + ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists"; + ObjectFlags3[ObjectFlags3["IsGenericTypeComputed"] = 2097152] = "IsGenericTypeComputed"; + ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType"; + ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType"; + ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType"; + ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections"; + ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed"; + ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion"; + ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed"; + ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection"; + })(ObjectFlags2 = ts6.ObjectFlags || (ts6.ObjectFlags = {})); + var VarianceFlags; + (function(VarianceFlags2) { + VarianceFlags2[VarianceFlags2["Invariant"] = 0] = "Invariant"; + VarianceFlags2[VarianceFlags2["Covariant"] = 1] = "Covariant"; + VarianceFlags2[VarianceFlags2["Contravariant"] = 2] = "Contravariant"; + VarianceFlags2[VarianceFlags2["Bivariant"] = 3] = "Bivariant"; + VarianceFlags2[VarianceFlags2["Independent"] = 4] = "Independent"; + VarianceFlags2[VarianceFlags2["VarianceMask"] = 7] = "VarianceMask"; + VarianceFlags2[VarianceFlags2["Unmeasurable"] = 8] = "Unmeasurable"; + VarianceFlags2[VarianceFlags2["Unreliable"] = 16] = "Unreliable"; + VarianceFlags2[VarianceFlags2["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback"; + })(VarianceFlags = ts6.VarianceFlags || (ts6.VarianceFlags = {})); + var ElementFlags; + (function(ElementFlags2) { + ElementFlags2[ElementFlags2["Required"] = 1] = "Required"; + ElementFlags2[ElementFlags2["Optional"] = 2] = "Optional"; + ElementFlags2[ElementFlags2["Rest"] = 4] = "Rest"; + ElementFlags2[ElementFlags2["Variadic"] = 8] = "Variadic"; + ElementFlags2[ElementFlags2["Fixed"] = 3] = "Fixed"; + ElementFlags2[ElementFlags2["Variable"] = 12] = "Variable"; + ElementFlags2[ElementFlags2["NonRequired"] = 14] = "NonRequired"; + ElementFlags2[ElementFlags2["NonRest"] = 11] = "NonRest"; + })(ElementFlags = ts6.ElementFlags || (ts6.ElementFlags = {})); + var AccessFlags; + (function(AccessFlags2) { + AccessFlags2[AccessFlags2["None"] = 0] = "None"; + AccessFlags2[AccessFlags2["IncludeUndefined"] = 1] = "IncludeUndefined"; + AccessFlags2[AccessFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures"; + AccessFlags2[AccessFlags2["Writing"] = 4] = "Writing"; + AccessFlags2[AccessFlags2["CacheSymbol"] = 8] = "CacheSymbol"; + AccessFlags2[AccessFlags2["NoTupleBoundsCheck"] = 16] = "NoTupleBoundsCheck"; + AccessFlags2[AccessFlags2["ExpressionPosition"] = 32] = "ExpressionPosition"; + AccessFlags2[AccessFlags2["ReportDeprecated"] = 64] = "ReportDeprecated"; + AccessFlags2[AccessFlags2["SuppressNoImplicitAnyError"] = 128] = "SuppressNoImplicitAnyError"; + AccessFlags2[AccessFlags2["Contextual"] = 256] = "Contextual"; + AccessFlags2[AccessFlags2["Persistent"] = 1] = "Persistent"; + })(AccessFlags = ts6.AccessFlags || (ts6.AccessFlags = {})); + var JsxReferenceKind; + (function(JsxReferenceKind2) { + JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component"; + JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function"; + JsxReferenceKind2[JsxReferenceKind2["Mixed"] = 2] = "Mixed"; + })(JsxReferenceKind = ts6.JsxReferenceKind || (ts6.JsxReferenceKind = {})); + var SignatureKind; + (function(SignatureKind2) { + SignatureKind2[SignatureKind2["Call"] = 0] = "Call"; + SignatureKind2[SignatureKind2["Construct"] = 1] = "Construct"; + })(SignatureKind = ts6.SignatureKind || (ts6.SignatureKind = {})); + var SignatureFlags; + (function(SignatureFlags2) { + SignatureFlags2[SignatureFlags2["None"] = 0] = "None"; + SignatureFlags2[SignatureFlags2["HasRestParameter"] = 1] = "HasRestParameter"; + SignatureFlags2[SignatureFlags2["HasLiteralTypes"] = 2] = "HasLiteralTypes"; + SignatureFlags2[SignatureFlags2["Abstract"] = 4] = "Abstract"; + SignatureFlags2[SignatureFlags2["IsInnerCallChain"] = 8] = "IsInnerCallChain"; + SignatureFlags2[SignatureFlags2["IsOuterCallChain"] = 16] = "IsOuterCallChain"; + SignatureFlags2[SignatureFlags2["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile"; + SignatureFlags2[SignatureFlags2["PropagatingFlags"] = 39] = "PropagatingFlags"; + SignatureFlags2[SignatureFlags2["CallChainFlags"] = 24] = "CallChainFlags"; + })(SignatureFlags = ts6.SignatureFlags || (ts6.SignatureFlags = {})); + var IndexKind; + (function(IndexKind2) { + IndexKind2[IndexKind2["String"] = 0] = "String"; + IndexKind2[IndexKind2["Number"] = 1] = "Number"; + })(IndexKind = ts6.IndexKind || (ts6.IndexKind = {})); + var TypeMapKind; + (function(TypeMapKind2) { + TypeMapKind2[TypeMapKind2["Simple"] = 0] = "Simple"; + TypeMapKind2[TypeMapKind2["Array"] = 1] = "Array"; + TypeMapKind2[TypeMapKind2["Deferred"] = 2] = "Deferred"; + TypeMapKind2[TypeMapKind2["Function"] = 3] = "Function"; + TypeMapKind2[TypeMapKind2["Composite"] = 4] = "Composite"; + TypeMapKind2[TypeMapKind2["Merged"] = 5] = "Merged"; + })(TypeMapKind = ts6.TypeMapKind || (ts6.TypeMapKind = {})); + var InferencePriority; + (function(InferencePriority2) { + InferencePriority2[InferencePriority2["NakedTypeVariable"] = 1] = "NakedTypeVariable"; + InferencePriority2[InferencePriority2["SpeculativeTuple"] = 2] = "SpeculativeTuple"; + InferencePriority2[InferencePriority2["SubstituteSource"] = 4] = "SubstituteSource"; + InferencePriority2[InferencePriority2["HomomorphicMappedType"] = 8] = "HomomorphicMappedType"; + InferencePriority2[InferencePriority2["PartialHomomorphicMappedType"] = 16] = "PartialHomomorphicMappedType"; + InferencePriority2[InferencePriority2["MappedTypeConstraint"] = 32] = "MappedTypeConstraint"; + InferencePriority2[InferencePriority2["ContravariantConditional"] = 64] = "ContravariantConditional"; + InferencePriority2[InferencePriority2["ReturnType"] = 128] = "ReturnType"; + InferencePriority2[InferencePriority2["LiteralKeyof"] = 256] = "LiteralKeyof"; + InferencePriority2[InferencePriority2["NoConstraints"] = 512] = "NoConstraints"; + InferencePriority2[InferencePriority2["AlwaysStrict"] = 1024] = "AlwaysStrict"; + InferencePriority2[InferencePriority2["MaxValue"] = 2048] = "MaxValue"; + InferencePriority2[InferencePriority2["PriorityImpliesCombination"] = 416] = "PriorityImpliesCombination"; + InferencePriority2[InferencePriority2["Circularity"] = -1] = "Circularity"; + })(InferencePriority = ts6.InferencePriority || (ts6.InferencePriority = {})); + var InferenceFlags; + (function(InferenceFlags2) { + InferenceFlags2[InferenceFlags2["None"] = 0] = "None"; + InferenceFlags2[InferenceFlags2["NoDefault"] = 1] = "NoDefault"; + InferenceFlags2[InferenceFlags2["AnyDefault"] = 2] = "AnyDefault"; + InferenceFlags2[InferenceFlags2["SkippedGenericFunction"] = 4] = "SkippedGenericFunction"; + })(InferenceFlags = ts6.InferenceFlags || (ts6.InferenceFlags = {})); + var Ternary; + (function(Ternary2) { + Ternary2[Ternary2["False"] = 0] = "False"; + Ternary2[Ternary2["Unknown"] = 1] = "Unknown"; + Ternary2[Ternary2["Maybe"] = 3] = "Maybe"; + Ternary2[Ternary2["True"] = -1] = "True"; + })(Ternary = ts6.Ternary || (ts6.Ternary = {})); + var AssignmentDeclarationKind; + (function(AssignmentDeclarationKind2) { + AssignmentDeclarationKind2[AssignmentDeclarationKind2["None"] = 0] = "None"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["ExportsProperty"] = 1] = "ExportsProperty"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["ModuleExports"] = 2] = "ModuleExports"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["PrototypeProperty"] = 3] = "PrototypeProperty"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["ThisProperty"] = 4] = "ThisProperty"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["Property"] = 5] = "Property"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["Prototype"] = 6] = "Prototype"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["ObjectDefinePropertyValue"] = 7] = "ObjectDefinePropertyValue"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["ObjectDefinePropertyExports"] = 8] = "ObjectDefinePropertyExports"; + AssignmentDeclarationKind2[AssignmentDeclarationKind2["ObjectDefinePrototypeProperty"] = 9] = "ObjectDefinePrototypeProperty"; + })(AssignmentDeclarationKind = ts6.AssignmentDeclarationKind || (ts6.AssignmentDeclarationKind = {})); + var DiagnosticCategory3; + (function(DiagnosticCategory4) { + DiagnosticCategory4[DiagnosticCategory4["Warning"] = 0] = "Warning"; + DiagnosticCategory4[DiagnosticCategory4["Error"] = 1] = "Error"; + DiagnosticCategory4[DiagnosticCategory4["Suggestion"] = 2] = "Suggestion"; + DiagnosticCategory4[DiagnosticCategory4["Message"] = 3] = "Message"; + })(DiagnosticCategory3 = ts6.DiagnosticCategory || (ts6.DiagnosticCategory = {})); + function diagnosticCategoryName(d, lowerCase) { + if (lowerCase === void 0) { + lowerCase = true; + } + var name = DiagnosticCategory3[d.category]; + return lowerCase ? name.toLowerCase() : name; + } + ts6.diagnosticCategoryName = diagnosticCategoryName; + var ModuleResolutionKind2; + (function(ModuleResolutionKind3) { + ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic"; + ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs"; + ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16"; + ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext"; + })(ModuleResolutionKind2 = ts6.ModuleResolutionKind || (ts6.ModuleResolutionKind = {})); + var ModuleDetectionKind; + (function(ModuleDetectionKind2) { + ModuleDetectionKind2[ModuleDetectionKind2["Legacy"] = 1] = "Legacy"; + ModuleDetectionKind2[ModuleDetectionKind2["Auto"] = 2] = "Auto"; + ModuleDetectionKind2[ModuleDetectionKind2["Force"] = 3] = "Force"; + })(ModuleDetectionKind = ts6.ModuleDetectionKind || (ts6.ModuleDetectionKind = {})); + var WatchFileKind; + (function(WatchFileKind2) { + WatchFileKind2[WatchFileKind2["FixedPollingInterval"] = 0] = "FixedPollingInterval"; + WatchFileKind2[WatchFileKind2["PriorityPollingInterval"] = 1] = "PriorityPollingInterval"; + WatchFileKind2[WatchFileKind2["DynamicPriorityPolling"] = 2] = "DynamicPriorityPolling"; + WatchFileKind2[WatchFileKind2["FixedChunkSizePolling"] = 3] = "FixedChunkSizePolling"; + WatchFileKind2[WatchFileKind2["UseFsEvents"] = 4] = "UseFsEvents"; + WatchFileKind2[WatchFileKind2["UseFsEventsOnParentDirectory"] = 5] = "UseFsEventsOnParentDirectory"; + })(WatchFileKind = ts6.WatchFileKind || (ts6.WatchFileKind = {})); + var WatchDirectoryKind; + (function(WatchDirectoryKind2) { + WatchDirectoryKind2[WatchDirectoryKind2["UseFsEvents"] = 0] = "UseFsEvents"; + WatchDirectoryKind2[WatchDirectoryKind2["FixedPollingInterval"] = 1] = "FixedPollingInterval"; + WatchDirectoryKind2[WatchDirectoryKind2["DynamicPriorityPolling"] = 2] = "DynamicPriorityPolling"; + WatchDirectoryKind2[WatchDirectoryKind2["FixedChunkSizePolling"] = 3] = "FixedChunkSizePolling"; + })(WatchDirectoryKind = ts6.WatchDirectoryKind || (ts6.WatchDirectoryKind = {})); + var PollingWatchKind; + (function(PollingWatchKind2) { + PollingWatchKind2[PollingWatchKind2["FixedInterval"] = 0] = "FixedInterval"; + PollingWatchKind2[PollingWatchKind2["PriorityInterval"] = 1] = "PriorityInterval"; + PollingWatchKind2[PollingWatchKind2["DynamicPriority"] = 2] = "DynamicPriority"; + PollingWatchKind2[PollingWatchKind2["FixedChunkSize"] = 3] = "FixedChunkSize"; + })(PollingWatchKind = ts6.PollingWatchKind || (ts6.PollingWatchKind = {})); + var ModuleKind2; + (function(ModuleKind3) { + ModuleKind3[ModuleKind3["None"] = 0] = "None"; + ModuleKind3[ModuleKind3["CommonJS"] = 1] = "CommonJS"; + ModuleKind3[ModuleKind3["AMD"] = 2] = "AMD"; + ModuleKind3[ModuleKind3["UMD"] = 3] = "UMD"; + ModuleKind3[ModuleKind3["System"] = 4] = "System"; + ModuleKind3[ModuleKind3["ES2015"] = 5] = "ES2015"; + ModuleKind3[ModuleKind3["ES2020"] = 6] = "ES2020"; + ModuleKind3[ModuleKind3["ES2022"] = 7] = "ES2022"; + ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext"; + ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16"; + ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext"; + })(ModuleKind2 = ts6.ModuleKind || (ts6.ModuleKind = {})); + var JsxEmit2; + (function(JsxEmit3) { + JsxEmit3[JsxEmit3["None"] = 0] = "None"; + JsxEmit3[JsxEmit3["Preserve"] = 1] = "Preserve"; + JsxEmit3[JsxEmit3["React"] = 2] = "React"; + JsxEmit3[JsxEmit3["ReactNative"] = 3] = "ReactNative"; + JsxEmit3[JsxEmit3["ReactJSX"] = 4] = "ReactJSX"; + JsxEmit3[JsxEmit3["ReactJSXDev"] = 5] = "ReactJSXDev"; + })(JsxEmit2 = ts6.JsxEmit || (ts6.JsxEmit = {})); + var ImportsNotUsedAsValues; + (function(ImportsNotUsedAsValues2) { + ImportsNotUsedAsValues2[ImportsNotUsedAsValues2["Remove"] = 0] = "Remove"; + ImportsNotUsedAsValues2[ImportsNotUsedAsValues2["Preserve"] = 1] = "Preserve"; + ImportsNotUsedAsValues2[ImportsNotUsedAsValues2["Error"] = 2] = "Error"; + })(ImportsNotUsedAsValues = ts6.ImportsNotUsedAsValues || (ts6.ImportsNotUsedAsValues = {})); + var NewLineKind2; + (function(NewLineKind3) { + NewLineKind3[NewLineKind3["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed"; + NewLineKind3[NewLineKind3["LineFeed"] = 1] = "LineFeed"; + })(NewLineKind2 = ts6.NewLineKind || (ts6.NewLineKind = {})); + var ScriptKind; + (function(ScriptKind2) { + ScriptKind2[ScriptKind2["Unknown"] = 0] = "Unknown"; + ScriptKind2[ScriptKind2["JS"] = 1] = "JS"; + ScriptKind2[ScriptKind2["JSX"] = 2] = "JSX"; + ScriptKind2[ScriptKind2["TS"] = 3] = "TS"; + ScriptKind2[ScriptKind2["TSX"] = 4] = "TSX"; + ScriptKind2[ScriptKind2["External"] = 5] = "External"; + ScriptKind2[ScriptKind2["JSON"] = 6] = "JSON"; + ScriptKind2[ScriptKind2["Deferred"] = 7] = "Deferred"; + })(ScriptKind = ts6.ScriptKind || (ts6.ScriptKind = {})); + var ScriptTarget2; + (function(ScriptTarget3) { + ScriptTarget3[ScriptTarget3["ES3"] = 0] = "ES3"; + ScriptTarget3[ScriptTarget3["ES5"] = 1] = "ES5"; + ScriptTarget3[ScriptTarget3["ES2015"] = 2] = "ES2015"; + ScriptTarget3[ScriptTarget3["ES2016"] = 3] = "ES2016"; + ScriptTarget3[ScriptTarget3["ES2017"] = 4] = "ES2017"; + ScriptTarget3[ScriptTarget3["ES2018"] = 5] = "ES2018"; + ScriptTarget3[ScriptTarget3["ES2019"] = 6] = "ES2019"; + ScriptTarget3[ScriptTarget3["ES2020"] = 7] = "ES2020"; + ScriptTarget3[ScriptTarget3["ES2021"] = 8] = "ES2021"; + ScriptTarget3[ScriptTarget3["ES2022"] = 9] = "ES2022"; + ScriptTarget3[ScriptTarget3["ESNext"] = 99] = "ESNext"; + ScriptTarget3[ScriptTarget3["JSON"] = 100] = "JSON"; + ScriptTarget3[ScriptTarget3["Latest"] = 99] = "Latest"; + })(ScriptTarget2 = ts6.ScriptTarget || (ts6.ScriptTarget = {})); + var LanguageVariant; + (function(LanguageVariant2) { + LanguageVariant2[LanguageVariant2["Standard"] = 0] = "Standard"; + LanguageVariant2[LanguageVariant2["JSX"] = 1] = "JSX"; + })(LanguageVariant = ts6.LanguageVariant || (ts6.LanguageVariant = {})); + var WatchDirectoryFlags; + (function(WatchDirectoryFlags2) { + WatchDirectoryFlags2[WatchDirectoryFlags2["None"] = 0] = "None"; + WatchDirectoryFlags2[WatchDirectoryFlags2["Recursive"] = 1] = "Recursive"; + })(WatchDirectoryFlags = ts6.WatchDirectoryFlags || (ts6.WatchDirectoryFlags = {})); + var CharacterCodes; + (function(CharacterCodes2) { + CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter"; + CharacterCodes2[CharacterCodes2["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; + CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed"; + CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn"; + CharacterCodes2[CharacterCodes2["lineSeparator"] = 8232] = "lineSeparator"; + CharacterCodes2[CharacterCodes2["paragraphSeparator"] = 8233] = "paragraphSeparator"; + CharacterCodes2[CharacterCodes2["nextLine"] = 133] = "nextLine"; + CharacterCodes2[CharacterCodes2["space"] = 32] = "space"; + CharacterCodes2[CharacterCodes2["nonBreakingSpace"] = 160] = "nonBreakingSpace"; + CharacterCodes2[CharacterCodes2["enQuad"] = 8192] = "enQuad"; + CharacterCodes2[CharacterCodes2["emQuad"] = 8193] = "emQuad"; + CharacterCodes2[CharacterCodes2["enSpace"] = 8194] = "enSpace"; + CharacterCodes2[CharacterCodes2["emSpace"] = 8195] = "emSpace"; + CharacterCodes2[CharacterCodes2["threePerEmSpace"] = 8196] = "threePerEmSpace"; + CharacterCodes2[CharacterCodes2["fourPerEmSpace"] = 8197] = "fourPerEmSpace"; + CharacterCodes2[CharacterCodes2["sixPerEmSpace"] = 8198] = "sixPerEmSpace"; + CharacterCodes2[CharacterCodes2["figureSpace"] = 8199] = "figureSpace"; + CharacterCodes2[CharacterCodes2["punctuationSpace"] = 8200] = "punctuationSpace"; + CharacterCodes2[CharacterCodes2["thinSpace"] = 8201] = "thinSpace"; + CharacterCodes2[CharacterCodes2["hairSpace"] = 8202] = "hairSpace"; + CharacterCodes2[CharacterCodes2["zeroWidthSpace"] = 8203] = "zeroWidthSpace"; + CharacterCodes2[CharacterCodes2["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace"; + CharacterCodes2[CharacterCodes2["ideographicSpace"] = 12288] = "ideographicSpace"; + CharacterCodes2[CharacterCodes2["mathematicalSpace"] = 8287] = "mathematicalSpace"; + CharacterCodes2[CharacterCodes2["ogham"] = 5760] = "ogham"; + CharacterCodes2[CharacterCodes2["_"] = 95] = "_"; + CharacterCodes2[CharacterCodes2["$"] = 36] = "$"; + CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0"; + CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1"; + CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2"; + CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3"; + CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4"; + CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5"; + CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6"; + CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7"; + CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8"; + CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9"; + CharacterCodes2[CharacterCodes2["a"] = 97] = "a"; + CharacterCodes2[CharacterCodes2["b"] = 98] = "b"; + CharacterCodes2[CharacterCodes2["c"] = 99] = "c"; + CharacterCodes2[CharacterCodes2["d"] = 100] = "d"; + CharacterCodes2[CharacterCodes2["e"] = 101] = "e"; + CharacterCodes2[CharacterCodes2["f"] = 102] = "f"; + CharacterCodes2[CharacterCodes2["g"] = 103] = "g"; + CharacterCodes2[CharacterCodes2["h"] = 104] = "h"; + CharacterCodes2[CharacterCodes2["i"] = 105] = "i"; + CharacterCodes2[CharacterCodes2["j"] = 106] = "j"; + CharacterCodes2[CharacterCodes2["k"] = 107] = "k"; + CharacterCodes2[CharacterCodes2["l"] = 108] = "l"; + CharacterCodes2[CharacterCodes2["m"] = 109] = "m"; + CharacterCodes2[CharacterCodes2["n"] = 110] = "n"; + CharacterCodes2[CharacterCodes2["o"] = 111] = "o"; + CharacterCodes2[CharacterCodes2["p"] = 112] = "p"; + CharacterCodes2[CharacterCodes2["q"] = 113] = "q"; + CharacterCodes2[CharacterCodes2["r"] = 114] = "r"; + CharacterCodes2[CharacterCodes2["s"] = 115] = "s"; + CharacterCodes2[CharacterCodes2["t"] = 116] = "t"; + CharacterCodes2[CharacterCodes2["u"] = 117] = "u"; + CharacterCodes2[CharacterCodes2["v"] = 118] = "v"; + CharacterCodes2[CharacterCodes2["w"] = 119] = "w"; + CharacterCodes2[CharacterCodes2["x"] = 120] = "x"; + CharacterCodes2[CharacterCodes2["y"] = 121] = "y"; + CharacterCodes2[CharacterCodes2["z"] = 122] = "z"; + CharacterCodes2[CharacterCodes2["A"] = 65] = "A"; + CharacterCodes2[CharacterCodes2["B"] = 66] = "B"; + CharacterCodes2[CharacterCodes2["C"] = 67] = "C"; + CharacterCodes2[CharacterCodes2["D"] = 68] = "D"; + CharacterCodes2[CharacterCodes2["E"] = 69] = "E"; + CharacterCodes2[CharacterCodes2["F"] = 70] = "F"; + CharacterCodes2[CharacterCodes2["G"] = 71] = "G"; + CharacterCodes2[CharacterCodes2["H"] = 72] = "H"; + CharacterCodes2[CharacterCodes2["I"] = 73] = "I"; + CharacterCodes2[CharacterCodes2["J"] = 74] = "J"; + CharacterCodes2[CharacterCodes2["K"] = 75] = "K"; + CharacterCodes2[CharacterCodes2["L"] = 76] = "L"; + CharacterCodes2[CharacterCodes2["M"] = 77] = "M"; + CharacterCodes2[CharacterCodes2["N"] = 78] = "N"; + CharacterCodes2[CharacterCodes2["O"] = 79] = "O"; + CharacterCodes2[CharacterCodes2["P"] = 80] = "P"; + CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q"; + CharacterCodes2[CharacterCodes2["R"] = 82] = "R"; + CharacterCodes2[CharacterCodes2["S"] = 83] = "S"; + CharacterCodes2[CharacterCodes2["T"] = 84] = "T"; + CharacterCodes2[CharacterCodes2["U"] = 85] = "U"; + CharacterCodes2[CharacterCodes2["V"] = 86] = "V"; + CharacterCodes2[CharacterCodes2["W"] = 87] = "W"; + CharacterCodes2[CharacterCodes2["X"] = 88] = "X"; + CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y"; + CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z"; + CharacterCodes2[CharacterCodes2["ampersand"] = 38] = "ampersand"; + CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk"; + CharacterCodes2[CharacterCodes2["at"] = 64] = "at"; + CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash"; + CharacterCodes2[CharacterCodes2["backtick"] = 96] = "backtick"; + CharacterCodes2[CharacterCodes2["bar"] = 124] = "bar"; + CharacterCodes2[CharacterCodes2["caret"] = 94] = "caret"; + CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace"; + CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket"; + CharacterCodes2[CharacterCodes2["closeParen"] = 41] = "closeParen"; + CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon"; + CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma"; + CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot"; + CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote"; + CharacterCodes2[CharacterCodes2["equals"] = 61] = "equals"; + CharacterCodes2[CharacterCodes2["exclamation"] = 33] = "exclamation"; + CharacterCodes2[CharacterCodes2["greaterThan"] = 62] = "greaterThan"; + CharacterCodes2[CharacterCodes2["hash"] = 35] = "hash"; + CharacterCodes2[CharacterCodes2["lessThan"] = 60] = "lessThan"; + CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus"; + CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace"; + CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket"; + CharacterCodes2[CharacterCodes2["openParen"] = 40] = "openParen"; + CharacterCodes2[CharacterCodes2["percent"] = 37] = "percent"; + CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus"; + CharacterCodes2[CharacterCodes2["question"] = 63] = "question"; + CharacterCodes2[CharacterCodes2["semicolon"] = 59] = "semicolon"; + CharacterCodes2[CharacterCodes2["singleQuote"] = 39] = "singleQuote"; + CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash"; + CharacterCodes2[CharacterCodes2["tilde"] = 126] = "tilde"; + CharacterCodes2[CharacterCodes2["backspace"] = 8] = "backspace"; + CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed"; + CharacterCodes2[CharacterCodes2["byteOrderMark"] = 65279] = "byteOrderMark"; + CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab"; + CharacterCodes2[CharacterCodes2["verticalTab"] = 11] = "verticalTab"; + })(CharacterCodes = ts6.CharacterCodes || (ts6.CharacterCodes = {})); + var Extension; + (function(Extension2) { + Extension2["Ts"] = ".ts"; + Extension2["Tsx"] = ".tsx"; + Extension2["Dts"] = ".d.ts"; + Extension2["Js"] = ".js"; + Extension2["Jsx"] = ".jsx"; + Extension2["Json"] = ".json"; + Extension2["TsBuildInfo"] = ".tsbuildinfo"; + Extension2["Mjs"] = ".mjs"; + Extension2["Mts"] = ".mts"; + Extension2["Dmts"] = ".d.mts"; + Extension2["Cjs"] = ".cjs"; + Extension2["Cts"] = ".cts"; + Extension2["Dcts"] = ".d.cts"; + })(Extension = ts6.Extension || (ts6.Extension = {})); + var TransformFlags; + (function(TransformFlags2) { + TransformFlags2[TransformFlags2["None"] = 0] = "None"; + TransformFlags2[TransformFlags2["ContainsTypeScript"] = 1] = "ContainsTypeScript"; + TransformFlags2[TransformFlags2["ContainsJsx"] = 2] = "ContainsJsx"; + TransformFlags2[TransformFlags2["ContainsESNext"] = 4] = "ContainsESNext"; + TransformFlags2[TransformFlags2["ContainsES2022"] = 8] = "ContainsES2022"; + TransformFlags2[TransformFlags2["ContainsES2021"] = 16] = "ContainsES2021"; + TransformFlags2[TransformFlags2["ContainsES2020"] = 32] = "ContainsES2020"; + TransformFlags2[TransformFlags2["ContainsES2019"] = 64] = "ContainsES2019"; + TransformFlags2[TransformFlags2["ContainsES2018"] = 128] = "ContainsES2018"; + TransformFlags2[TransformFlags2["ContainsES2017"] = 256] = "ContainsES2017"; + TransformFlags2[TransformFlags2["ContainsES2016"] = 512] = "ContainsES2016"; + TransformFlags2[TransformFlags2["ContainsES2015"] = 1024] = "ContainsES2015"; + TransformFlags2[TransformFlags2["ContainsGenerator"] = 2048] = "ContainsGenerator"; + TransformFlags2[TransformFlags2["ContainsDestructuringAssignment"] = 4096] = "ContainsDestructuringAssignment"; + TransformFlags2[TransformFlags2["ContainsTypeScriptClassSyntax"] = 8192] = "ContainsTypeScriptClassSyntax"; + TransformFlags2[TransformFlags2["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis"; + TransformFlags2[TransformFlags2["ContainsRestOrSpread"] = 32768] = "ContainsRestOrSpread"; + TransformFlags2[TransformFlags2["ContainsObjectRestOrSpread"] = 65536] = "ContainsObjectRestOrSpread"; + TransformFlags2[TransformFlags2["ContainsComputedPropertyName"] = 131072] = "ContainsComputedPropertyName"; + TransformFlags2[TransformFlags2["ContainsBlockScopedBinding"] = 262144] = "ContainsBlockScopedBinding"; + TransformFlags2[TransformFlags2["ContainsBindingPattern"] = 524288] = "ContainsBindingPattern"; + TransformFlags2[TransformFlags2["ContainsYield"] = 1048576] = "ContainsYield"; + TransformFlags2[TransformFlags2["ContainsAwait"] = 2097152] = "ContainsAwait"; + TransformFlags2[TransformFlags2["ContainsHoistedDeclarationOrCompletion"] = 4194304] = "ContainsHoistedDeclarationOrCompletion"; + TransformFlags2[TransformFlags2["ContainsDynamicImport"] = 8388608] = "ContainsDynamicImport"; + TransformFlags2[TransformFlags2["ContainsClassFields"] = 16777216] = "ContainsClassFields"; + TransformFlags2[TransformFlags2["ContainsDecorators"] = 33554432] = "ContainsDecorators"; + TransformFlags2[TransformFlags2["ContainsPossibleTopLevelAwait"] = 67108864] = "ContainsPossibleTopLevelAwait"; + TransformFlags2[TransformFlags2["ContainsLexicalSuper"] = 134217728] = "ContainsLexicalSuper"; + TransformFlags2[TransformFlags2["ContainsUpdateExpressionForIdentifier"] = 268435456] = "ContainsUpdateExpressionForIdentifier"; + TransformFlags2[TransformFlags2["ContainsPrivateIdentifierInExpression"] = 536870912] = "ContainsPrivateIdentifierInExpression"; + TransformFlags2[TransformFlags2["HasComputedFlags"] = -2147483648] = "HasComputedFlags"; + TransformFlags2[TransformFlags2["AssertTypeScript"] = 1] = "AssertTypeScript"; + TransformFlags2[TransformFlags2["AssertJsx"] = 2] = "AssertJsx"; + TransformFlags2[TransformFlags2["AssertESNext"] = 4] = "AssertESNext"; + TransformFlags2[TransformFlags2["AssertES2022"] = 8] = "AssertES2022"; + TransformFlags2[TransformFlags2["AssertES2021"] = 16] = "AssertES2021"; + TransformFlags2[TransformFlags2["AssertES2020"] = 32] = "AssertES2020"; + TransformFlags2[TransformFlags2["AssertES2019"] = 64] = "AssertES2019"; + TransformFlags2[TransformFlags2["AssertES2018"] = 128] = "AssertES2018"; + TransformFlags2[TransformFlags2["AssertES2017"] = 256] = "AssertES2017"; + TransformFlags2[TransformFlags2["AssertES2016"] = 512] = "AssertES2016"; + TransformFlags2[TransformFlags2["AssertES2015"] = 1024] = "AssertES2015"; + TransformFlags2[TransformFlags2["AssertGenerator"] = 2048] = "AssertGenerator"; + TransformFlags2[TransformFlags2["AssertDestructuringAssignment"] = 4096] = "AssertDestructuringAssignment"; + TransformFlags2[TransformFlags2["OuterExpressionExcludes"] = -2147483648] = "OuterExpressionExcludes"; + TransformFlags2[TransformFlags2["PropertyAccessExcludes"] = -2147483648] = "PropertyAccessExcludes"; + TransformFlags2[TransformFlags2["NodeExcludes"] = -2147483648] = "NodeExcludes"; + TransformFlags2[TransformFlags2["ArrowFunctionExcludes"] = -2072174592] = "ArrowFunctionExcludes"; + TransformFlags2[TransformFlags2["FunctionExcludes"] = -1937940480] = "FunctionExcludes"; + TransformFlags2[TransformFlags2["ConstructorExcludes"] = -1937948672] = "ConstructorExcludes"; + TransformFlags2[TransformFlags2["MethodOrAccessorExcludes"] = -2005057536] = "MethodOrAccessorExcludes"; + TransformFlags2[TransformFlags2["PropertyExcludes"] = -2013249536] = "PropertyExcludes"; + TransformFlags2[TransformFlags2["ClassExcludes"] = -2147344384] = "ClassExcludes"; + TransformFlags2[TransformFlags2["ModuleExcludes"] = -1941676032] = "ModuleExcludes"; + TransformFlags2[TransformFlags2["TypeExcludes"] = -2] = "TypeExcludes"; + TransformFlags2[TransformFlags2["ObjectLiteralExcludes"] = -2147278848] = "ObjectLiteralExcludes"; + TransformFlags2[TransformFlags2["ArrayLiteralOrCallOrNewExcludes"] = -2147450880] = "ArrayLiteralOrCallOrNewExcludes"; + TransformFlags2[TransformFlags2["VariableDeclarationListExcludes"] = -2146893824] = "VariableDeclarationListExcludes"; + TransformFlags2[TransformFlags2["ParameterExcludes"] = -2147483648] = "ParameterExcludes"; + TransformFlags2[TransformFlags2["CatchClauseExcludes"] = -2147418112] = "CatchClauseExcludes"; + TransformFlags2[TransformFlags2["BindingPatternExcludes"] = -2147450880] = "BindingPatternExcludes"; + TransformFlags2[TransformFlags2["ContainsLexicalThisOrSuper"] = 134234112] = "ContainsLexicalThisOrSuper"; + TransformFlags2[TransformFlags2["PropertyNamePropagatingFlags"] = 134234112] = "PropertyNamePropagatingFlags"; + })(TransformFlags = ts6.TransformFlags || (ts6.TransformFlags = {})); + var SnippetKind; + (function(SnippetKind2) { + SnippetKind2[SnippetKind2["TabStop"] = 0] = "TabStop"; + SnippetKind2[SnippetKind2["Placeholder"] = 1] = "Placeholder"; + SnippetKind2[SnippetKind2["Choice"] = 2] = "Choice"; + SnippetKind2[SnippetKind2["Variable"] = 3] = "Variable"; + })(SnippetKind = ts6.SnippetKind || (ts6.SnippetKind = {})); + var EmitFlags; + (function(EmitFlags2) { + EmitFlags2[EmitFlags2["None"] = 0] = "None"; + EmitFlags2[EmitFlags2["SingleLine"] = 1] = "SingleLine"; + EmitFlags2[EmitFlags2["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode"; + EmitFlags2[EmitFlags2["NoSubstitution"] = 4] = "NoSubstitution"; + EmitFlags2[EmitFlags2["CapturesThis"] = 8] = "CapturesThis"; + EmitFlags2[EmitFlags2["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap"; + EmitFlags2[EmitFlags2["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap"; + EmitFlags2[EmitFlags2["NoSourceMap"] = 48] = "NoSourceMap"; + EmitFlags2[EmitFlags2["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps"; + EmitFlags2[EmitFlags2["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps"; + EmitFlags2[EmitFlags2["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps"; + EmitFlags2[EmitFlags2["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps"; + EmitFlags2[EmitFlags2["NoLeadingComments"] = 512] = "NoLeadingComments"; + EmitFlags2[EmitFlags2["NoTrailingComments"] = 1024] = "NoTrailingComments"; + EmitFlags2[EmitFlags2["NoComments"] = 1536] = "NoComments"; + EmitFlags2[EmitFlags2["NoNestedComments"] = 2048] = "NoNestedComments"; + EmitFlags2[EmitFlags2["HelperName"] = 4096] = "HelperName"; + EmitFlags2[EmitFlags2["ExportName"] = 8192] = "ExportName"; + EmitFlags2[EmitFlags2["LocalName"] = 16384] = "LocalName"; + EmitFlags2[EmitFlags2["InternalName"] = 32768] = "InternalName"; + EmitFlags2[EmitFlags2["Indented"] = 65536] = "Indented"; + EmitFlags2[EmitFlags2["NoIndentation"] = 131072] = "NoIndentation"; + EmitFlags2[EmitFlags2["AsyncFunctionBody"] = 262144] = "AsyncFunctionBody"; + EmitFlags2[EmitFlags2["ReuseTempVariableScope"] = 524288] = "ReuseTempVariableScope"; + EmitFlags2[EmitFlags2["CustomPrologue"] = 1048576] = "CustomPrologue"; + EmitFlags2[EmitFlags2["NoHoisting"] = 2097152] = "NoHoisting"; + EmitFlags2[EmitFlags2["HasEndOfDeclarationMarker"] = 4194304] = "HasEndOfDeclarationMarker"; + EmitFlags2[EmitFlags2["Iterator"] = 8388608] = "Iterator"; + EmitFlags2[EmitFlags2["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping"; + EmitFlags2[EmitFlags2["TypeScriptClassWrapper"] = 33554432] = "TypeScriptClassWrapper"; + EmitFlags2[EmitFlags2["NeverApplyImportHelper"] = 67108864] = "NeverApplyImportHelper"; + EmitFlags2[EmitFlags2["IgnoreSourceNewlines"] = 134217728] = "IgnoreSourceNewlines"; + EmitFlags2[EmitFlags2["Immutable"] = 268435456] = "Immutable"; + EmitFlags2[EmitFlags2["IndirectCall"] = 536870912] = "IndirectCall"; + })(EmitFlags = ts6.EmitFlags || (ts6.EmitFlags = {})); + var ExternalEmitHelpers; + (function(ExternalEmitHelpers2) { + ExternalEmitHelpers2[ExternalEmitHelpers2["Extends"] = 1] = "Extends"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Assign"] = 2] = "Assign"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Rest"] = 4] = "Rest"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Param"] = 32] = "Param"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Generator"] = 128] = "Generator"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Values"] = 256] = "Values"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Read"] = 512] = "Read"; + ExternalEmitHelpers2[ExternalEmitHelpers2["SpreadArray"] = 1024] = "SpreadArray"; + ExternalEmitHelpers2[ExternalEmitHelpers2["Await"] = 2048] = "Await"; + ExternalEmitHelpers2[ExternalEmitHelpers2["AsyncGenerator"] = 4096] = "AsyncGenerator"; + ExternalEmitHelpers2[ExternalEmitHelpers2["AsyncDelegator"] = 8192] = "AsyncDelegator"; + ExternalEmitHelpers2[ExternalEmitHelpers2["AsyncValues"] = 16384] = "AsyncValues"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ExportStar"] = 32768] = "ExportStar"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ImportStar"] = 65536] = "ImportStar"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ImportDefault"] = 131072] = "ImportDefault"; + ExternalEmitHelpers2[ExternalEmitHelpers2["MakeTemplateObject"] = 262144] = "MakeTemplateObject"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ClassPrivateFieldGet"] = 524288] = "ClassPrivateFieldGet"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ClassPrivateFieldSet"] = 1048576] = "ClassPrivateFieldSet"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ClassPrivateFieldIn"] = 2097152] = "ClassPrivateFieldIn"; + ExternalEmitHelpers2[ExternalEmitHelpers2["CreateBinding"] = 4194304] = "CreateBinding"; + ExternalEmitHelpers2[ExternalEmitHelpers2["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers2[ExternalEmitHelpers2["LastEmitHelper"] = 4194304] = "LastEmitHelper"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ForOfIncludes"] = 256] = "ForOfIncludes"; + ExternalEmitHelpers2[ExternalEmitHelpers2["ForAwaitOfIncludes"] = 16384] = "ForAwaitOfIncludes"; + ExternalEmitHelpers2[ExternalEmitHelpers2["AsyncGeneratorIncludes"] = 6144] = "AsyncGeneratorIncludes"; + ExternalEmitHelpers2[ExternalEmitHelpers2["AsyncDelegatorIncludes"] = 26624] = "AsyncDelegatorIncludes"; + ExternalEmitHelpers2[ExternalEmitHelpers2["SpreadIncludes"] = 1536] = "SpreadIncludes"; + })(ExternalEmitHelpers = ts6.ExternalEmitHelpers || (ts6.ExternalEmitHelpers = {})); + var EmitHint; + (function(EmitHint2) { + EmitHint2[EmitHint2["SourceFile"] = 0] = "SourceFile"; + EmitHint2[EmitHint2["Expression"] = 1] = "Expression"; + EmitHint2[EmitHint2["IdentifierName"] = 2] = "IdentifierName"; + EmitHint2[EmitHint2["MappedTypeParameter"] = 3] = "MappedTypeParameter"; + EmitHint2[EmitHint2["Unspecified"] = 4] = "Unspecified"; + EmitHint2[EmitHint2["EmbeddedStatement"] = 5] = "EmbeddedStatement"; + EmitHint2[EmitHint2["JsxAttributeValue"] = 6] = "JsxAttributeValue"; + })(EmitHint = ts6.EmitHint || (ts6.EmitHint = {})); + var OuterExpressionKinds; + (function(OuterExpressionKinds2) { + OuterExpressionKinds2[OuterExpressionKinds2["Parentheses"] = 1] = "Parentheses"; + OuterExpressionKinds2[OuterExpressionKinds2["TypeAssertions"] = 2] = "TypeAssertions"; + OuterExpressionKinds2[OuterExpressionKinds2["NonNullAssertions"] = 4] = "NonNullAssertions"; + OuterExpressionKinds2[OuterExpressionKinds2["PartiallyEmittedExpressions"] = 8] = "PartiallyEmittedExpressions"; + OuterExpressionKinds2[OuterExpressionKinds2["Assertions"] = 6] = "Assertions"; + OuterExpressionKinds2[OuterExpressionKinds2["All"] = 15] = "All"; + OuterExpressionKinds2[OuterExpressionKinds2["ExcludeJSDocTypeAssertion"] = 16] = "ExcludeJSDocTypeAssertion"; + })(OuterExpressionKinds = ts6.OuterExpressionKinds || (ts6.OuterExpressionKinds = {})); + var LexicalEnvironmentFlags; + (function(LexicalEnvironmentFlags2) { + LexicalEnvironmentFlags2[LexicalEnvironmentFlags2["None"] = 0] = "None"; + LexicalEnvironmentFlags2[LexicalEnvironmentFlags2["InParameters"] = 1] = "InParameters"; + LexicalEnvironmentFlags2[LexicalEnvironmentFlags2["VariablesHoistedInParameters"] = 2] = "VariablesHoistedInParameters"; + })(LexicalEnvironmentFlags = ts6.LexicalEnvironmentFlags || (ts6.LexicalEnvironmentFlags = {})); + var BundleFileSectionKind; + (function(BundleFileSectionKind2) { + BundleFileSectionKind2["Prologue"] = "prologue"; + BundleFileSectionKind2["EmitHelpers"] = "emitHelpers"; + BundleFileSectionKind2["NoDefaultLib"] = "no-default-lib"; + BundleFileSectionKind2["Reference"] = "reference"; + BundleFileSectionKind2["Type"] = "type"; + BundleFileSectionKind2["TypeResolutionModeRequire"] = "type-require"; + BundleFileSectionKind2["TypeResolutionModeImport"] = "type-import"; + BundleFileSectionKind2["Lib"] = "lib"; + BundleFileSectionKind2["Prepend"] = "prepend"; + BundleFileSectionKind2["Text"] = "text"; + BundleFileSectionKind2["Internal"] = "internal"; + })(BundleFileSectionKind = ts6.BundleFileSectionKind || (ts6.BundleFileSectionKind = {})); + var ListFormat; + (function(ListFormat2) { + ListFormat2[ListFormat2["None"] = 0] = "None"; + ListFormat2[ListFormat2["SingleLine"] = 0] = "SingleLine"; + ListFormat2[ListFormat2["MultiLine"] = 1] = "MultiLine"; + ListFormat2[ListFormat2["PreserveLines"] = 2] = "PreserveLines"; + ListFormat2[ListFormat2["LinesMask"] = 3] = "LinesMask"; + ListFormat2[ListFormat2["NotDelimited"] = 0] = "NotDelimited"; + ListFormat2[ListFormat2["BarDelimited"] = 4] = "BarDelimited"; + ListFormat2[ListFormat2["AmpersandDelimited"] = 8] = "AmpersandDelimited"; + ListFormat2[ListFormat2["CommaDelimited"] = 16] = "CommaDelimited"; + ListFormat2[ListFormat2["AsteriskDelimited"] = 32] = "AsteriskDelimited"; + ListFormat2[ListFormat2["DelimitersMask"] = 60] = "DelimitersMask"; + ListFormat2[ListFormat2["AllowTrailingComma"] = 64] = "AllowTrailingComma"; + ListFormat2[ListFormat2["Indented"] = 128] = "Indented"; + ListFormat2[ListFormat2["SpaceBetweenBraces"] = 256] = "SpaceBetweenBraces"; + ListFormat2[ListFormat2["SpaceBetweenSiblings"] = 512] = "SpaceBetweenSiblings"; + ListFormat2[ListFormat2["Braces"] = 1024] = "Braces"; + ListFormat2[ListFormat2["Parenthesis"] = 2048] = "Parenthesis"; + ListFormat2[ListFormat2["AngleBrackets"] = 4096] = "AngleBrackets"; + ListFormat2[ListFormat2["SquareBrackets"] = 8192] = "SquareBrackets"; + ListFormat2[ListFormat2["BracketsMask"] = 15360] = "BracketsMask"; + ListFormat2[ListFormat2["OptionalIfUndefined"] = 16384] = "OptionalIfUndefined"; + ListFormat2[ListFormat2["OptionalIfEmpty"] = 32768] = "OptionalIfEmpty"; + ListFormat2[ListFormat2["Optional"] = 49152] = "Optional"; + ListFormat2[ListFormat2["PreferNewLine"] = 65536] = "PreferNewLine"; + ListFormat2[ListFormat2["NoTrailingNewLine"] = 131072] = "NoTrailingNewLine"; + ListFormat2[ListFormat2["NoInterveningComments"] = 262144] = "NoInterveningComments"; + ListFormat2[ListFormat2["NoSpaceIfEmpty"] = 524288] = "NoSpaceIfEmpty"; + ListFormat2[ListFormat2["SingleElement"] = 1048576] = "SingleElement"; + ListFormat2[ListFormat2["SpaceAfterList"] = 2097152] = "SpaceAfterList"; + ListFormat2[ListFormat2["Modifiers"] = 2359808] = "Modifiers"; + ListFormat2[ListFormat2["HeritageClauses"] = 512] = "HeritageClauses"; + ListFormat2[ListFormat2["SingleLineTypeLiteralMembers"] = 768] = "SingleLineTypeLiteralMembers"; + ListFormat2[ListFormat2["MultiLineTypeLiteralMembers"] = 32897] = "MultiLineTypeLiteralMembers"; + ListFormat2[ListFormat2["SingleLineTupleTypeElements"] = 528] = "SingleLineTupleTypeElements"; + ListFormat2[ListFormat2["MultiLineTupleTypeElements"] = 657] = "MultiLineTupleTypeElements"; + ListFormat2[ListFormat2["UnionTypeConstituents"] = 516] = "UnionTypeConstituents"; + ListFormat2[ListFormat2["IntersectionTypeConstituents"] = 520] = "IntersectionTypeConstituents"; + ListFormat2[ListFormat2["ObjectBindingPatternElements"] = 525136] = "ObjectBindingPatternElements"; + ListFormat2[ListFormat2["ArrayBindingPatternElements"] = 524880] = "ArrayBindingPatternElements"; + ListFormat2[ListFormat2["ObjectLiteralExpressionProperties"] = 526226] = "ObjectLiteralExpressionProperties"; + ListFormat2[ListFormat2["ImportClauseEntries"] = 526226] = "ImportClauseEntries"; + ListFormat2[ListFormat2["ArrayLiteralExpressionElements"] = 8914] = "ArrayLiteralExpressionElements"; + ListFormat2[ListFormat2["CommaListElements"] = 528] = "CommaListElements"; + ListFormat2[ListFormat2["CallExpressionArguments"] = 2576] = "CallExpressionArguments"; + ListFormat2[ListFormat2["NewExpressionArguments"] = 18960] = "NewExpressionArguments"; + ListFormat2[ListFormat2["TemplateExpressionSpans"] = 262144] = "TemplateExpressionSpans"; + ListFormat2[ListFormat2["SingleLineBlockStatements"] = 768] = "SingleLineBlockStatements"; + ListFormat2[ListFormat2["MultiLineBlockStatements"] = 129] = "MultiLineBlockStatements"; + ListFormat2[ListFormat2["VariableDeclarationList"] = 528] = "VariableDeclarationList"; + ListFormat2[ListFormat2["SingleLineFunctionBodyStatements"] = 768] = "SingleLineFunctionBodyStatements"; + ListFormat2[ListFormat2["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements"; + ListFormat2[ListFormat2["ClassHeritageClauses"] = 0] = "ClassHeritageClauses"; + ListFormat2[ListFormat2["ClassMembers"] = 129] = "ClassMembers"; + ListFormat2[ListFormat2["InterfaceMembers"] = 129] = "InterfaceMembers"; + ListFormat2[ListFormat2["EnumMembers"] = 145] = "EnumMembers"; + ListFormat2[ListFormat2["CaseBlockClauses"] = 129] = "CaseBlockClauses"; + ListFormat2[ListFormat2["NamedImportsOrExportsElements"] = 525136] = "NamedImportsOrExportsElements"; + ListFormat2[ListFormat2["JsxElementOrFragmentChildren"] = 262144] = "JsxElementOrFragmentChildren"; + ListFormat2[ListFormat2["JsxElementAttributes"] = 262656] = "JsxElementAttributes"; + ListFormat2[ListFormat2["CaseOrDefaultClauseStatements"] = 163969] = "CaseOrDefaultClauseStatements"; + ListFormat2[ListFormat2["HeritageClauseTypes"] = 528] = "HeritageClauseTypes"; + ListFormat2[ListFormat2["SourceFileStatements"] = 131073] = "SourceFileStatements"; + ListFormat2[ListFormat2["Decorators"] = 2146305] = "Decorators"; + ListFormat2[ListFormat2["TypeArguments"] = 53776] = "TypeArguments"; + ListFormat2[ListFormat2["TypeParameters"] = 53776] = "TypeParameters"; + ListFormat2[ListFormat2["Parameters"] = 2576] = "Parameters"; + ListFormat2[ListFormat2["IndexSignatureParameters"] = 8848] = "IndexSignatureParameters"; + ListFormat2[ListFormat2["JSDocComment"] = 33] = "JSDocComment"; + })(ListFormat = ts6.ListFormat || (ts6.ListFormat = {})); + var PragmaKindFlags; + (function(PragmaKindFlags2) { + PragmaKindFlags2[PragmaKindFlags2["None"] = 0] = "None"; + PragmaKindFlags2[PragmaKindFlags2["TripleSlashXML"] = 1] = "TripleSlashXML"; + PragmaKindFlags2[PragmaKindFlags2["SingleLine"] = 2] = "SingleLine"; + PragmaKindFlags2[PragmaKindFlags2["MultiLine"] = 4] = "MultiLine"; + PragmaKindFlags2[PragmaKindFlags2["All"] = 7] = "All"; + PragmaKindFlags2[PragmaKindFlags2["Default"] = 7] = "Default"; + })(PragmaKindFlags = ts6.PragmaKindFlags || (ts6.PragmaKindFlags = {})); + ts6.commentPragmas = { + "reference": { + args: [ + { name: "types", optional: true, captureSpan: true }, + { name: "lib", optional: true, captureSpan: true }, + { name: "path", optional: true, captureSpan: true }, + { name: "no-default-lib", optional: true }, + { name: "resolution-mode", optional: true } + ], + kind: 1 + /* PragmaKindFlags.TripleSlashXML */ + }, + "amd-dependency": { + args: [{ name: "path" }, { name: "name", optional: true }], + kind: 1 + /* PragmaKindFlags.TripleSlashXML */ + }, + "amd-module": { + args: [{ name: "name" }], + kind: 1 + /* PragmaKindFlags.TripleSlashXML */ + }, + "ts-check": { + kind: 2 + /* PragmaKindFlags.SingleLine */ + }, + "ts-nocheck": { + kind: 2 + /* PragmaKindFlags.SingleLine */ + }, + "jsx": { + args: [{ name: "factory" }], + kind: 4 + /* PragmaKindFlags.MultiLine */ + }, + "jsxfrag": { + args: [{ name: "factory" }], + kind: 4 + /* PragmaKindFlags.MultiLine */ + }, + "jsximportsource": { + args: [{ name: "factory" }], + kind: 4 + /* PragmaKindFlags.MultiLine */ + }, + "jsxruntime": { + args: [{ name: "factory" }], + kind: 4 + /* PragmaKindFlags.MultiLine */ + } + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function generateDjb2Hash(data) { + var acc = 5381; + for (var i = 0; i < data.length; i++) { + acc = (acc << 5) + acc + data.charCodeAt(i); + } + return acc.toString(); + } + ts6.generateDjb2Hash = generateDjb2Hash; + function setStackTraceLimit() { + if (Error.stackTraceLimit < 100) { + Error.stackTraceLimit = 100; + } + } + ts6.setStackTraceLimit = setStackTraceLimit; + var FileWatcherEventKind; + (function(FileWatcherEventKind2) { + FileWatcherEventKind2[FileWatcherEventKind2["Created"] = 0] = "Created"; + FileWatcherEventKind2[FileWatcherEventKind2["Changed"] = 1] = "Changed"; + FileWatcherEventKind2[FileWatcherEventKind2["Deleted"] = 2] = "Deleted"; + })(FileWatcherEventKind = ts6.FileWatcherEventKind || (ts6.FileWatcherEventKind = {})); + var PollingInterval; + (function(PollingInterval2) { + PollingInterval2[PollingInterval2["High"] = 2e3] = "High"; + PollingInterval2[PollingInterval2["Medium"] = 500] = "Medium"; + PollingInterval2[PollingInterval2["Low"] = 250] = "Low"; + })(PollingInterval = ts6.PollingInterval || (ts6.PollingInterval = {})); + ts6.missingFileModifiedTime = /* @__PURE__ */ new Date(0); + function getModifiedTime(host, fileName) { + return host.getModifiedTime(fileName) || ts6.missingFileModifiedTime; + } + ts6.getModifiedTime = getModifiedTime; + function createPollingIntervalBasedLevels(levels) { + var _a; + return _a = {}, _a[PollingInterval.Low] = levels.Low, _a[PollingInterval.Medium] = levels.Medium, _a[PollingInterval.High] = levels.High, _a; + } + var defaultChunkLevels = { Low: 32, Medium: 64, High: 256 }; + var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); + ts6.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); + function setCustomPollingValues(system) { + if (!system.getEnvironmentVariable) { + return; + } + var pollingIntervalChanged = setCustomLevels("TSC_WATCH_POLLINGINTERVAL", PollingInterval); + pollingChunkSize = getCustomPollingBasedLevels("TSC_WATCH_POLLINGCHUNKSIZE", defaultChunkLevels) || pollingChunkSize; + ts6.unchangedPollThresholds = getCustomPollingBasedLevels("TSC_WATCH_UNCHANGEDPOLLTHRESHOLDS", defaultChunkLevels) || ts6.unchangedPollThresholds; + function getLevel(envVar, level) { + return system.getEnvironmentVariable("".concat(envVar, "_").concat(level.toUpperCase())); + } + function getCustomLevels(baseVariable) { + var customLevels; + setCustomLevel("Low"); + setCustomLevel("Medium"); + setCustomLevel("High"); + return customLevels; + function setCustomLevel(level) { + var customLevel = getLevel(baseVariable, level); + if (customLevel) { + (customLevels || (customLevels = {}))[level] = Number(customLevel); + } + } + } + function setCustomLevels(baseVariable, levels) { + var customLevels = getCustomLevels(baseVariable); + if (customLevels) { + setLevel("Low"); + setLevel("Medium"); + setLevel("High"); + return true; + } + return false; + function setLevel(level) { + levels[level] = customLevels[level] || levels[level]; + } + } + function getCustomPollingBasedLevels(baseVariable, defaultLevels) { + var customLevels = getCustomLevels(baseVariable); + return (pollingIntervalChanged || customLevels) && createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); + } + } + function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { + var definedValueCopyToIndex = pollIndex; + for (var canVisit = queue.length; chunkSize && canVisit; nextPollIndex(), canVisit--) { + var watchedFile = queue[pollIndex]; + if (!watchedFile) { + continue; + } else if (watchedFile.isClosed) { + queue[pollIndex] = void 0; + continue; + } + chunkSize--; + var fileChanged = onWatchedFileStat(watchedFile, getModifiedTime(host, watchedFile.fileName)); + if (watchedFile.isClosed) { + queue[pollIndex] = void 0; + continue; + } + callbackOnWatchFileStat === null || callbackOnWatchFileStat === void 0 ? void 0 : callbackOnWatchFileStat(watchedFile, pollIndex, fileChanged); + if (queue[pollIndex]) { + if (definedValueCopyToIndex < pollIndex) { + queue[definedValueCopyToIndex] = watchedFile; + queue[pollIndex] = void 0; + } + definedValueCopyToIndex++; + } + } + return pollIndex; + function nextPollIndex() { + pollIndex++; + if (pollIndex === queue.length) { + if (definedValueCopyToIndex < pollIndex) { + queue.length = definedValueCopyToIndex; + } + pollIndex = 0; + definedValueCopyToIndex = 0; + } + } + } + function createDynamicPriorityPollingWatchFile(host) { + var watchedFiles = []; + var changedFilesInLastPoll = []; + var lowPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Low); + var mediumPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Medium); + var highPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.High); + return watchFile; + function watchFile(fileName, callback, defaultPollingInterval) { + var file = { + fileName, + callback, + unchangedPolls: 0, + mtime: getModifiedTime(host, fileName) + }; + watchedFiles.push(file); + addToPollingIntervalQueue(file, defaultPollingInterval); + return { + close: function() { + file.isClosed = true; + ts6.unorderedRemoveItem(watchedFiles, file); + } + }; + } + function createPollingIntervalQueue(pollingInterval) { + var queue = []; + queue.pollingInterval = pollingInterval; + queue.pollIndex = 0; + queue.pollScheduled = false; + return queue; + } + function pollPollingIntervalQueue(queue) { + queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]); + if (queue.length) { + scheduleNextPoll(queue.pollingInterval); + } else { + ts6.Debug.assert(queue.pollIndex === 0); + queue.pollScheduled = false; + } + } + function pollLowPollingIntervalQueue(queue) { + pollQueue( + changedFilesInLastPoll, + PollingInterval.Low, + /*pollIndex*/ + 0, + changedFilesInLastPoll.length + ); + pollPollingIntervalQueue(queue); + if (!queue.pollScheduled && changedFilesInLastPoll.length) { + scheduleNextPoll(PollingInterval.Low); + } + } + function pollQueue(queue, pollingInterval, pollIndex, chunkSize) { + return pollWatchedFileQueue(host, queue, pollIndex, chunkSize, onWatchFileStat); + function onWatchFileStat(watchedFile, pollIndex2, fileChanged) { + if (fileChanged) { + watchedFile.unchangedPolls = 0; + if (queue !== changedFilesInLastPoll) { + queue[pollIndex2] = void 0; + addChangedFileToLowPollingIntervalQueue(watchedFile); + } + } else if (watchedFile.unchangedPolls !== ts6.unchangedPollThresholds[pollingInterval]) { + watchedFile.unchangedPolls++; + } else if (queue === changedFilesInLastPoll) { + watchedFile.unchangedPolls = 1; + queue[pollIndex2] = void 0; + addToPollingIntervalQueue(watchedFile, PollingInterval.Low); + } else if (pollingInterval !== PollingInterval.High) { + watchedFile.unchangedPolls++; + queue[pollIndex2] = void 0; + addToPollingIntervalQueue(watchedFile, pollingInterval === PollingInterval.Low ? PollingInterval.Medium : PollingInterval.High); + } + } + } + function pollingIntervalQueue(pollingInterval) { + switch (pollingInterval) { + case PollingInterval.Low: + return lowPollingIntervalQueue; + case PollingInterval.Medium: + return mediumPollingIntervalQueue; + case PollingInterval.High: + return highPollingIntervalQueue; + } + } + function addToPollingIntervalQueue(file, pollingInterval) { + pollingIntervalQueue(pollingInterval).push(file); + scheduleNextPollIfNotAlreadyScheduled(pollingInterval); + } + function addChangedFileToLowPollingIntervalQueue(file) { + changedFilesInLastPoll.push(file); + scheduleNextPollIfNotAlreadyScheduled(PollingInterval.Low); + } + function scheduleNextPollIfNotAlreadyScheduled(pollingInterval) { + if (!pollingIntervalQueue(pollingInterval).pollScheduled) { + scheduleNextPoll(pollingInterval); + } + } + function scheduleNextPoll(pollingInterval) { + pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); + } + } + function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { + var fileWatcherCallbacks = ts6.createMultiMap(); + var dirWatchers = new ts6.Map(); + var toCanonicalName = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + return nonPollingWatchFile; + function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) { + var filePath = toCanonicalName(fileName); + fileWatcherCallbacks.add(filePath, callback); + var dirPath = ts6.getDirectoryPath(filePath) || "."; + var watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(ts6.getDirectoryPath(fileName) || ".", dirPath, fallbackOptions); + watcher.referenceCount++; + return { + close: function() { + if (watcher.referenceCount === 1) { + watcher.close(); + dirWatchers.delete(dirPath); + } else { + watcher.referenceCount--; + } + fileWatcherCallbacks.remove(filePath, callback); + } + }; + } + function createDirectoryWatcher(dirName, dirPath, fallbackOptions) { + var watcher = fsWatch( + dirName, + 1, + function(_eventName, relativeFileName, modifiedTime) { + if (!ts6.isString(relativeFileName)) + return; + var fileName = ts6.getNormalizedAbsolutePath(relativeFileName, dirName); + var callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName)); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime); + } + } + }, + /*recursive*/ + false, + PollingInterval.Medium, + fallbackOptions + ); + watcher.referenceCount = 0; + dirWatchers.set(dirPath, watcher); + return watcher; + } + } + function createFixedChunkSizePollingWatchFile(host) { + var watchedFiles = []; + var pollIndex = 0; + var pollScheduled; + return watchFile; + function watchFile(fileName, callback) { + var file = { + fileName, + callback, + mtime: getModifiedTime(host, fileName) + }; + watchedFiles.push(file); + scheduleNextPoll(); + return { + close: function() { + file.isClosed = true; + ts6.unorderedRemoveItem(watchedFiles, file); + } + }; + } + function pollQueue() { + pollScheduled = void 0; + pollIndex = pollWatchedFileQueue(host, watchedFiles, pollIndex, pollingChunkSize[PollingInterval.Low]); + scheduleNextPoll(); + } + function scheduleNextPoll() { + if (!watchedFiles.length || pollScheduled) + return; + pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); + } + } + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { + var toCanonicalFileName = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } else { + cache.set(path, { + watcher: createWatcher( + // Cant infer types correctly so lets satisfy checker + function(param1, param2, param3) { + var _a; + return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function(cb) { + return cb(param1, param2, param3); + }); + } + ), + callbacks: [callback] + }); + } + return { + close: function() { + var watcher = cache.get(path); + if (!watcher) + return; + if (!ts6.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts6.closeFileWatcherOf(watcher); + } + }; + } + function onWatchedFileStat(watchedFile, modifiedTime) { + var oldTime = watchedFile.mtime.getTime(); + var newTime = modifiedTime.getTime(); + if (oldTime !== newTime) { + watchedFile.mtime = modifiedTime; + watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime); + return true; + } + return false; + } + function getFileWatcherEventKind(oldTime, newTime) { + return oldTime === 0 ? FileWatcherEventKind.Created : newTime === 0 ? FileWatcherEventKind.Deleted : FileWatcherEventKind.Changed; + } + ts6.getFileWatcherEventKind = getFileWatcherEventKind; + ts6.ignoredPaths = ["/node_modules/.", "/.git", "/.#"]; + var curSysLog = ts6.noop; + function sysLog(s) { + return curSysLog(s); + } + ts6.sysLog = sysLog; + function setSysLog(logger) { + curSysLog = logger; + } + ts6.setSysLog = setSysLog; + function createDirectoryWatcherSupportingRecursive(_a) { + var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout2 = _a.setTimeout, clearTimeout2 = _a.clearTimeout; + var cache = new ts6.Map(); + var callbackCache = ts6.createMultiMap(); + var cacheToUpdateChildWatches = new ts6.Map(); + var timerToUpdateChildWatches; + var filePathComparer = ts6.getStringComparer(!useCaseSensitiveFileNames); + var toCanonicalFilePath = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + return function(dirName, callback, recursive, options) { + return recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options); + }; + function createDirectoryWatcher(dirName, options, callback) { + var dirPath = toCanonicalFilePath(dirName); + var directoryWatcher = cache.get(dirPath); + if (directoryWatcher) { + directoryWatcher.refCount++; + } else { + directoryWatcher = { + watcher: watchDirectory( + dirName, + function(fileName) { + if (isIgnoredPath(fileName, options)) + return; + if (options === null || options === void 0 ? void 0 : options.synchronousWatchDirectory) { + invokeCallbacks(dirPath, fileName); + updateChildWatches(dirName, dirPath, options); + } else { + nonSyncUpdateChildWatches(dirName, dirPath, fileName, options); + } + }, + /*recursive*/ + false, + options + ), + refCount: 1, + childWatches: ts6.emptyArray + }; + cache.set(dirPath, directoryWatcher); + updateChildWatches(dirName, dirPath, options); + } + var callbackToAdd = callback && { dirName, callback }; + if (callbackToAdd) { + callbackCache.add(dirPath, callbackToAdd); + } + return { + dirName, + close: function() { + var directoryWatcher2 = ts6.Debug.checkDefined(cache.get(dirPath)); + if (callbackToAdd) + callbackCache.remove(dirPath, callbackToAdd); + directoryWatcher2.refCount--; + if (directoryWatcher2.refCount) + return; + cache.delete(dirPath); + ts6.closeFileWatcherOf(directoryWatcher2); + directoryWatcher2.childWatches.forEach(ts6.closeFileWatcher); + } + }; + } + function invokeCallbacks(dirPath, fileNameOrInvokeMap, fileNames) { + var fileName; + var invokeMap; + if (ts6.isString(fileNameOrInvokeMap)) { + fileName = fileNameOrInvokeMap; + } else { + invokeMap = fileNameOrInvokeMap; + } + callbackCache.forEach(function(callbacks, rootDirName) { + var _a2; + if (invokeMap && invokeMap.get(rootDirName) === true) + return; + if (rootDirName === dirPath || ts6.startsWith(dirPath, rootDirName) && dirPath[rootDirName.length] === ts6.directorySeparator) { + if (invokeMap) { + if (fileNames) { + var existing = invokeMap.get(rootDirName); + if (existing) { + (_a2 = existing).push.apply(_a2, fileNames); + } else { + invokeMap.set(rootDirName, fileNames.slice()); + } + } else { + invokeMap.set(rootDirName, true); + } + } else { + callbacks.forEach(function(_a3) { + var callback = _a3.callback; + return callback(fileName); + }); + } + } + }); + } + function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) { + var parentWatcher = cache.get(dirPath); + if (parentWatcher && fileSystemEntryExists( + dirName, + 1 + /* FileSystemEntryKind.Directory */ + )) { + scheduleUpdateChildWatches(dirName, dirPath, fileName, options); + return; + } + invokeCallbacks(dirPath, fileName); + removeChildWatches(parentWatcher); + } + function scheduleUpdateChildWatches(dirName, dirPath, fileName, options) { + var existing = cacheToUpdateChildWatches.get(dirPath); + if (existing) { + existing.fileNames.push(fileName); + } else { + cacheToUpdateChildWatches.set(dirPath, { dirName, options, fileNames: [fileName] }); + } + if (timerToUpdateChildWatches) { + clearTimeout2(timerToUpdateChildWatches); + timerToUpdateChildWatches = void 0; + } + timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3); + } + function onTimerToUpdateChildWatches() { + timerToUpdateChildWatches = void 0; + sysLog("sysLog:: onTimerToUpdateChildWatches:: ".concat(cacheToUpdateChildWatches.size)); + var start = ts6.timestamp(); + var invokeMap = new ts6.Map(); + while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) { + var result = cacheToUpdateChildWatches.entries().next(); + ts6.Debug.assert(!result.done); + var _a2 = result.value, dirPath = _a2[0], _b = _a2[1], dirName = _b.dirName, options = _b.options, fileNames = _b.fileNames; + cacheToUpdateChildWatches.delete(dirPath); + var hasChanges = updateChildWatches(dirName, dirPath, options); + invokeCallbacks(dirPath, invokeMap, hasChanges ? void 0 : fileNames); + } + sysLog("sysLog:: invokingWatchers:: Elapsed:: ".concat(ts6.timestamp() - start, "ms:: ").concat(cacheToUpdateChildWatches.size)); + callbackCache.forEach(function(callbacks, rootDirName) { + var existing = invokeMap.get(rootDirName); + if (existing) { + callbacks.forEach(function(_a3) { + var callback = _a3.callback, dirName2 = _a3.dirName; + if (ts6.isArray(existing)) { + existing.forEach(callback); + } else { + callback(dirName2); + } + }); + } + }); + var elapsed = ts6.timestamp() - start; + sysLog("sysLog:: Elapsed:: ".concat(elapsed, "ms:: onTimerToUpdateChildWatches:: ").concat(cacheToUpdateChildWatches.size, " ").concat(timerToUpdateChildWatches)); + } + function removeChildWatches(parentWatcher) { + if (!parentWatcher) + return; + var existingChildWatches = parentWatcher.childWatches; + parentWatcher.childWatches = ts6.emptyArray; + for (var _i = 0, existingChildWatches_1 = existingChildWatches; _i < existingChildWatches_1.length; _i++) { + var childWatcher = existingChildWatches_1[_i]; + childWatcher.close(); + removeChildWatches(cache.get(toCanonicalFilePath(childWatcher.dirName))); + } + } + function updateChildWatches(parentDir, parentDirPath, options) { + var parentWatcher = cache.get(parentDirPath); + if (!parentWatcher) + return false; + var newChildWatches; + var hasChanges = ts6.enumerateInsertsAndDeletes(fileSystemEntryExists( + parentDir, + 1 + /* FileSystemEntryKind.Directory */ + ) ? ts6.mapDefined(getAccessibleSortedChildDirectories(parentDir), function(child) { + var childFullName = ts6.getNormalizedAbsolutePath(child, parentDir); + return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, ts6.normalizePath(realpath(childFullName))) === 0 ? childFullName : void 0; + }) : ts6.emptyArray, parentWatcher.childWatches, function(child, childWatcher) { + return filePathComparer(child, childWatcher.dirName); + }, createAndAddChildDirectoryWatcher, ts6.closeFileWatcher, addChildDirectoryWatcher); + parentWatcher.childWatches = newChildWatches || ts6.emptyArray; + return hasChanges; + function createAndAddChildDirectoryWatcher(childName) { + var result = createDirectoryWatcher(childName, options); + addChildDirectoryWatcher(result); + } + function addChildDirectoryWatcher(childWatcher) { + (newChildWatches || (newChildWatches = [])).push(childWatcher); + } + } + function isIgnoredPath(path, options) { + return ts6.some(ts6.ignoredPaths, function(searchPath) { + return isInPath(path, searchPath); + }) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames, getCurrentDirectory); + } + function isInPath(path, searchPath) { + if (ts6.stringContains(path, searchPath)) + return true; + if (useCaseSensitiveFileNames) + return false; + return ts6.stringContains(toCanonicalFilePath(path), searchPath); + } + } + var FileSystemEntryKind; + (function(FileSystemEntryKind2) { + FileSystemEntryKind2[FileSystemEntryKind2["File"] = 0] = "File"; + FileSystemEntryKind2[FileSystemEntryKind2["Directory"] = 1] = "Directory"; + })(FileSystemEntryKind = ts6.FileSystemEntryKind || (ts6.FileSystemEntryKind = {})); + function createFileWatcherCallback(callback) { + return function(_fileName, eventKind, modifiedTime) { + return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); + }; + } + function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime2) { + return function(eventName, _relativeFileName, modifiedTime) { + if (eventName === "rename") { + modifiedTime || (modifiedTime = getModifiedTime2(fileName) || ts6.missingFileModifiedTime); + callback(fileName, modifiedTime !== ts6.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime); + } else { + callback(fileName, FileWatcherEventKind.Changed, modifiedTime); + } + }; + } + function isIgnoredByWatchOptions(pathToCheck, options, useCaseSensitiveFileNames, getCurrentDirectory) { + return ((options === null || options === void 0 ? void 0 : options.excludeDirectories) || (options === null || options === void 0 ? void 0 : options.excludeFiles)) && (ts6.matchesExclude(pathToCheck, options === null || options === void 0 ? void 0 : options.excludeFiles, useCaseSensitiveFileNames, getCurrentDirectory()) || ts6.matchesExclude(pathToCheck, options === null || options === void 0 ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames, getCurrentDirectory())); + } + function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory) { + return function(eventName, relativeFileName) { + if (eventName === "rename") { + var fileName = !relativeFileName ? directoryName : ts6.normalizePath(ts6.combinePaths(directoryName, relativeFileName)); + if (!relativeFileName || !isIgnoredByWatchOptions(fileName, options, useCaseSensitiveFileNames, getCurrentDirectory)) { + callback(fileName); + } + } + }; + } + function createSystemWatchFunctions(_a) { + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime2 = _a.getModifiedTime, setTimeout2 = _a.setTimeout, clearTimeout2 = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog2 = _a.sysLog; + var pollingWatches = new ts6.Map(); + var fsWatches = new ts6.Map(); + var fsWatchesRecursive = new ts6.Map(); + var dynamicPollingWatchFile; + var fixedChunkSizePollingWatchFile; + var nonPollingWatchFile; + var hostRecursiveDirectoryWatcher; + var hitSystemWatcherLimit = false; + return { + watchFile, + watchDirectory + }; + function watchFile(fileName, callback, pollingInterval, options) { + options = updateOptionsForWatchFile(options, useNonPollingWatchers); + var watchFileKind = ts6.Debug.checkDefined(options.watchFile); + switch (watchFileKind) { + case ts6.WatchFileKind.FixedPollingInterval: + return pollingWatchFile( + fileName, + callback, + PollingInterval.Low, + /*options*/ + void 0 + ); + case ts6.WatchFileKind.PriorityPollingInterval: + return pollingWatchFile( + fileName, + callback, + pollingInterval, + /*options*/ + void 0 + ); + case ts6.WatchFileKind.DynamicPriorityPolling: + return ensureDynamicPollingWatchFile()( + fileName, + callback, + pollingInterval, + /*options*/ + void 0 + ); + case ts6.WatchFileKind.FixedChunkSizePolling: + return ensureFixedChunkSizePollingWatchFile()( + fileName, + callback, + /* pollingInterval */ + void 0, + /*options*/ + void 0 + ); + case ts6.WatchFileKind.UseFsEvents: + return fsWatch( + fileName, + 0, + createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime2), + /*recursive*/ + false, + pollingInterval, + ts6.getFallbackOptions(options) + ); + case ts6.WatchFileKind.UseFsEventsOnParentDirectory: + if (!nonPollingWatchFile) { + nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames); + } + return nonPollingWatchFile(fileName, callback, pollingInterval, ts6.getFallbackOptions(options)); + default: + ts6.Debug.assertNever(watchFileKind); + } + } + function ensureDynamicPollingWatchFile() { + return dynamicPollingWatchFile || (dynamicPollingWatchFile = createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime2, setTimeout: setTimeout2 })); + } + function ensureFixedChunkSizePollingWatchFile() { + return fixedChunkSizePollingWatchFile || (fixedChunkSizePollingWatchFile = createFixedChunkSizePollingWatchFile({ getModifiedTime: getModifiedTime2, setTimeout: setTimeout2 })); + } + function updateOptionsForWatchFile(options, useNonPollingWatchers2) { + if (options && options.watchFile !== void 0) + return options; + switch (tscWatchFile) { + case "PriorityPollingInterval": + return { watchFile: ts6.WatchFileKind.PriorityPollingInterval }; + case "DynamicPriorityPolling": + return { watchFile: ts6.WatchFileKind.DynamicPriorityPolling }; + case "UseFsEvents": + return generateWatchFileOptions(ts6.WatchFileKind.UseFsEvents, ts6.PollingWatchKind.PriorityInterval, options); + case "UseFsEventsWithFallbackDynamicPolling": + return generateWatchFileOptions(ts6.WatchFileKind.UseFsEvents, ts6.PollingWatchKind.DynamicPriority, options); + case "UseFsEventsOnParentDirectory": + useNonPollingWatchers2 = true; + default: + return useNonPollingWatchers2 ? ( + // Use notifications from FS to watch with falling back to fs.watchFile + generateWatchFileOptions(ts6.WatchFileKind.UseFsEventsOnParentDirectory, ts6.PollingWatchKind.PriorityInterval, options) + ) : ( + // Default to using fs events + { watchFile: ts6.WatchFileKind.UseFsEvents } + ); + } + } + function generateWatchFileOptions(watchFile2, fallbackPolling, options) { + var defaultFallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling; + return { + watchFile: watchFile2, + fallbackPolling: defaultFallbackPolling === void 0 ? fallbackPolling : defaultFallbackPolling + }; + } + function watchDirectory(directoryName, callback, recursive, options) { + if (fsSupportsRecursiveFsWatch) { + return fsWatch(directoryName, 1, createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory), recursive, PollingInterval.Medium, ts6.getFallbackOptions(options)); + } + if (!hostRecursiveDirectoryWatcher) { + hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({ + useCaseSensitiveFileNames, + getCurrentDirectory, + fileSystemEntryExists, + getAccessibleSortedChildDirectories, + watchDirectory: nonRecursiveWatchDirectory, + realpath, + setTimeout: setTimeout2, + clearTimeout: clearTimeout2 + }); + } + return hostRecursiveDirectoryWatcher(directoryName, callback, recursive, options); + } + function nonRecursiveWatchDirectory(directoryName, callback, recursive, options) { + ts6.Debug.assert(!recursive); + var watchDirectoryOptions = updateOptionsForWatchDirectory(options); + var watchDirectoryKind = ts6.Debug.checkDefined(watchDirectoryOptions.watchDirectory); + switch (watchDirectoryKind) { + case ts6.WatchDirectoryKind.FixedPollingInterval: + return pollingWatchFile( + directoryName, + function() { + return callback(directoryName); + }, + PollingInterval.Medium, + /*options*/ + void 0 + ); + case ts6.WatchDirectoryKind.DynamicPriorityPolling: + return ensureDynamicPollingWatchFile()( + directoryName, + function() { + return callback(directoryName); + }, + PollingInterval.Medium, + /*options*/ + void 0 + ); + case ts6.WatchDirectoryKind.FixedChunkSizePolling: + return ensureFixedChunkSizePollingWatchFile()( + directoryName, + function() { + return callback(directoryName); + }, + /* pollingInterval */ + void 0, + /*options*/ + void 0 + ); + case ts6.WatchDirectoryKind.UseFsEvents: + return fsWatch(directoryName, 1, createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory), recursive, PollingInterval.Medium, ts6.getFallbackOptions(watchDirectoryOptions)); + default: + ts6.Debug.assertNever(watchDirectoryKind); + } + } + function updateOptionsForWatchDirectory(options) { + if (options && options.watchDirectory !== void 0) + return options; + switch (tscWatchDirectory) { + case "RecursiveDirectoryUsingFsWatchFile": + return { watchDirectory: ts6.WatchDirectoryKind.FixedPollingInterval }; + case "RecursiveDirectoryUsingDynamicPriorityPolling": + return { watchDirectory: ts6.WatchDirectoryKind.DynamicPriorityPolling }; + default: + var defaultFallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling; + return { + watchDirectory: ts6.WatchDirectoryKind.UseFsEvents, + fallbackPolling: defaultFallbackPolling !== void 0 ? defaultFallbackPolling : void 0 + }; + } + } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function(cb) { + return pollingWatchFileWorker(fileName, cb, pollingInterval, options); + }); + } + function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function(cb) { + return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); + }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + var lastDirectoryPartWithDirectorySeparator; + var lastDirectoryPart; + if (inodeWatching) { + lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts6.directorySeparator)); + lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts6.directorySeparator.length); + } + var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry() : watchPresentFileSystemEntry(); + return { + close: function() { + if (watcher) { + watcher.close(); + watcher = void 0; + } + } + }; + function updateWatcher(createWatcher) { + if (watcher) { + sysLog2("sysLog:: ".concat(fileOrDirectory, ":: Changing watcher to ").concat(createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing", "FileSystemEntryWatcher")); + watcher.close(); + watcher = createWatcher(); + } + } + function watchPresentFileSystemEntry() { + if (hitSystemWatcherLimit) { + sysLog2("sysLog:: ".concat(fileOrDirectory, ":: Defaulting to watchFile")); + return watchPresentFileSystemEntryWithFsWatchFile(); + } + try { + var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ? callbackChangingToMissingFileSystemEntry : callback); + presentWatcher.on("error", function() { + callback("rename", ""); + updateWatcher(watchMissingFileSystemEntry); + }); + return presentWatcher; + } catch (e) { + hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC"); + sysLog2("sysLog:: ".concat(fileOrDirectory, ":: Changing to watchFile")); + return watchPresentFileSystemEntryWithFsWatchFile(); + } + } + function callbackChangingToMissingFileSystemEntry(event, relativeName) { + var originalRelativeName; + if (relativeName && ts6.endsWith(relativeName, "~")) { + originalRelativeName = relativeName; + relativeName = relativeName.slice(0, relativeName.length - 1); + } + if (event === "rename" && (!relativeName || relativeName === lastDirectoryPart || ts6.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) { + var modifiedTime = getModifiedTime2(fileOrDirectory) || ts6.missingFileModifiedTime; + if (originalRelativeName) + callback(event, originalRelativeName, modifiedTime); + callback(event, relativeName, modifiedTime); + if (inodeWatching) { + updateWatcher(modifiedTime === ts6.missingFileModifiedTime ? watchMissingFileSystemEntry : watchPresentFileSystemEntry); + } else if (modifiedTime === ts6.missingFileModifiedTime) { + updateWatcher(watchMissingFileSystemEntry); + } + } else { + if (originalRelativeName) + callback(event, originalRelativeName); + callback(event, relativeName); + } + } + function watchPresentFileSystemEntryWithFsWatchFile() { + return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions); + } + function watchMissingFileSystemEntry() { + return watchFile(fileOrDirectory, function(_fileName, eventKind, modifiedTime) { + if (eventKind === FileWatcherEventKind.Created) { + modifiedTime || (modifiedTime = getModifiedTime2(fileOrDirectory) || ts6.missingFileModifiedTime); + if (modifiedTime !== ts6.missingFileModifiedTime) { + callback("rename", "", modifiedTime); + updateWatcher(watchPresentFileSystemEntry); + } + } + }, fallbackPollingInterval, fallbackOptions); + } + } + } + ts6.createSystemWatchFunctions = createSystemWatchFunctions; + function patchWriteFileEnsuringDirectory(sys) { + var originalWriteFile = sys.writeFile; + sys.writeFile = function(path, data, writeBom) { + return ts6.writeFileEnsuringDirectories(path, data, !!writeBom, function(path2, data2, writeByteOrderMark) { + return originalWriteFile.call(sys, path2, data2, writeByteOrderMark); + }, function(path2) { + return sys.createDirectory(path2); + }, function(path2) { + return sys.directoryExists(path2); + }); + }; + } + ts6.patchWriteFileEnsuringDirectory = patchWriteFileEnsuringDirectory; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return void 0; + } + var version = process.version; + if (!version) { + return void 0; + } + var dot = version.indexOf("."); + if (dot === -1) { + return void 0; + } + return parseInt(version.substring(1, dot)); + } + ts6.getNodeMajorVersion = getNodeMajorVersion; + ts6.sys = function() { + var byteOrderMarkIndicator = "\uFEFF"; + function getNodeSystem() { + var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; + var _fs = require_fs(); + var _path = require_path(); + var _os = require_os(); + var _crypto; + try { + _crypto = __require("crypto"); + } catch (_a) { + _crypto = void 0; + } + var activeSession; + var profilePath = "./profile.cpuprofile"; + var Buffer2 = require_buffer().Buffer; + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; + var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; + var platform = _os.platform(); + var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; + var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); + var getCurrentDirectory = ts6.memoize(function() { + return process.cwd(); + }); + var _b = createSystemWatchFunctions({ + pollingWatchFileWorker: fsWatchFileWorker, + getModifiedTime: getModifiedTime2, + setTimeout, + clearTimeout, + fsWatchWorker, + useCaseSensitiveFileNames, + getCurrentDirectory, + fileSystemEntryExists, + // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows + // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643) + fsSupportsRecursiveFsWatch, + getAccessibleSortedChildDirectories: function(path) { + return getAccessibleFileSystemEntries(path).directories; + }, + realpath, + tscWatchFile: process.env.TSC_WATCHFILE, + useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, + tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, + inodeWatching: isLinuxOrMacOs, + sysLog + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; + var nodeSystem = { + args: process.argv.slice(2), + newLine: _os.EOL, + useCaseSensitiveFileNames, + write: function(s) { + process.stdout.write(s); + }, + getWidthOfTerminal: function() { + return process.stdout.columns; + }, + writeOutputIsTTY: function() { + return process.stdout.isTTY; + }, + readFile, + writeFile, + watchFile, + watchDirectory, + resolvePath: function(path) { + return _path.resolve(path); + }, + fileExists, + directoryExists, + createDirectory: function(directoryName) { + if (!nodeSystem.directoryExists(directoryName)) { + try { + _fs.mkdirSync(directoryName); + } catch (e) { + if (e.code !== "EEXIST") { + throw e; + } + } + } + }, + getExecutingFilePath: function() { + return __filename; + }, + getCurrentDirectory, + getDirectories, + getEnvironmentVariable: function(name) { + return process.env[name] || ""; + }, + readDirectory, + getModifiedTime: getModifiedTime2, + setModifiedTime, + deleteFile, + createHash: _crypto ? createSHA256Hash : generateDjb2Hash, + createSHA256Hash: _crypto ? createSHA256Hash : void 0, + getMemoryUsage: function() { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + }, + getFileSize: function(path) { + try { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { + return stat.size; + } + } catch (_a) { + } + return 0; + }, + exit: function(exitCode) { + disableCPUProfiler(function() { + return process.exit(exitCode); + }); + }, + enableCPUProfiler, + disableCPUProfiler, + cpuProfilingEnabled: function() { + return !!activeSession || ts6.contains(process.execArgv, "--cpu-prof") || ts6.contains(process.execArgv, "--prof"); + }, + realpath, + debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || ts6.some(process.execArgv, function(arg) { + return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); + }), + tryEnableSourceMapsForHost: function() { + try { + require_source_map_support().install(); + } catch (_a) { + } + }, + setTimeout, + clearTimeout, + clearScreen: function() { + process.stdout.write("\x1Bc"); + }, + setBlocking: function() { + if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) { + process.stdout._handle.setBlocking(true); + } + }, + bufferFrom, + base64decode: function(input) { + return bufferFrom(input, "base64").toString("utf8"); + }, + base64encode: function(input) { + return bufferFrom(input).toString("base64"); + }, + require: function(baseDir, moduleName) { + try { + var modulePath = ts6.resolveJSModule(moduleName, baseDir, nodeSystem); + return { module: __require(modulePath), modulePath, error: void 0 }; + } catch (error) { + return { module: void 0, modulePath: void 0, error }; + } + } + }; + return nodeSystem; + function statSync(path) { + return _fs.statSync(path, { throwIfNoEntry: false }); + } + function enableCPUProfiler(path, cb) { + if (activeSession) { + cb(); + return false; + } + var inspector = require_inspector(); + if (!inspector || !inspector.Session) { + cb(); + return false; + } + var session = new inspector.Session(); + session.connect(); + session.post("Profiler.enable", function() { + session.post("Profiler.start", function() { + activeSession = session; + profilePath = path; + cb(); + }); + }); + return true; + } + function cleanupPaths(profile) { + var externalFileCounter = 0; + var remappedPaths = new ts6.Map(); + var normalizedDir = ts6.normalizeSlashes(__dirname); + var fileUrlRoot = "file://".concat(ts6.getRootLength(normalizedDir) === 1 ? "" : "/").concat(normalizedDir); + for (var _i = 0, _a = profile.nodes; _i < _a.length; _i++) { + var node = _a[_i]; + if (node.callFrame.url) { + var url = ts6.normalizeSlashes(node.callFrame.url); + if (ts6.containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) { + node.callFrame.url = ts6.getRelativePathToDirectoryOrUrl( + fileUrlRoot, + url, + fileUrlRoot, + ts6.createGetCanonicalFileName(useCaseSensitiveFileNames), + /*isAbsolutePathAnUrl*/ + true + ); + } else if (!nativePattern.test(url)) { + node.callFrame.url = (remappedPaths.has(url) ? remappedPaths : remappedPaths.set(url, "external".concat(externalFileCounter, ".js"))).get(url); + externalFileCounter++; + } + } + } + return profile; + } + function disableCPUProfiler(cb) { + if (activeSession && activeSession !== "stopping") { + var s_1 = activeSession; + activeSession.post("Profiler.stop", function(err, _a) { + var _b2; + var profile = _a.profile; + if (!err) { + try { + if ((_b2 = statSync(profilePath)) === null || _b2 === void 0 ? void 0 : _b2.isDirectory()) { + profilePath = _path.join(profilePath, "".concat((/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-"), "+P").concat(process.pid, ".cpuprofile")); + } + } catch (_c) { + } + try { + _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); + } catch (_d) { + } + _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); + } + activeSession = void 0; + s_1.disconnect(); + cb(); + }); + activeSession = "stopping"; + return true; + } else { + cb(); + return false; + } + } + function bufferFrom(input, encoding) { + return Buffer2.from && Buffer2.from !== Int8Array.from ? Buffer2.from(input, encoding) : new Buffer2(input, encoding); + } + function isFileSystemCaseSensitive() { + if (platform === "win32" || platform === "win64") { + return false; + } + return !fileExists(swapCase(__filename)); + } + function swapCase(s) { + return s.replace(/\w/g, function(ch) { + var up = ch.toUpperCase(); + return ch === up ? ch.toLowerCase() : up; + }); + } + function fsWatchFileWorker(fileName, callback, pollingInterval) { + _fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged); + var eventKind; + return { + close: function() { + return _fs.unwatchFile(fileName, fileChanged); + } + }; + function fileChanged(curr, prev) { + var isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted; + if (+curr.mtime === 0) { + if (isPreviouslyDeleted) { + return; + } + eventKind = FileWatcherEventKind.Deleted; + } else if (isPreviouslyDeleted) { + eventKind = FileWatcherEventKind.Created; + } else if (+curr.mtime === +prev.mtime) { + return; + } else { + eventKind = FileWatcherEventKind.Changed; + } + callback(fileName, eventKind, curr.mtime); + } + } + function fsWatchWorker(fileOrDirectory, recursive, callback) { + return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback); + } + function readFileWorker(fileName, _encoding) { + var buffer; + try { + buffer = _fs.readFileSync(fileName); + } catch (e) { + return void 0; + } + var len = buffer.length; + if (len >= 2 && buffer[0] === 254 && buffer[1] === 255) { + len &= ~1; + for (var i = 0; i < len; i += 2) { + var temp = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = temp; + } + return buffer.toString("utf16le", 2); + } + if (len >= 2 && buffer[0] === 255 && buffer[1] === 254) { + return buffer.toString("utf16le", 2); + } + if (len >= 3 && buffer[0] === 239 && buffer[1] === 187 && buffer[2] === 191) { + return buffer.toString("utf8", 3); + } + return buffer.toString("utf8"); + } + function readFile(fileName, _encoding) { + ts6.perfLogger.logStartReadFile(fileName); + var file = readFileWorker(fileName, _encoding); + ts6.perfLogger.logStopReadFile(); + return file; + } + function writeFile(fileName, data, writeByteOrderMark) { + ts6.perfLogger.logEvent("WriteFile: " + fileName); + if (writeByteOrderMark) { + data = byteOrderMarkIndicator + data; + } + var fd; + try { + fd = _fs.openSync(fileName, "w"); + _fs.writeSync( + fd, + data, + /*position*/ + void 0, + "utf8" + ); + } finally { + if (fd !== void 0) { + _fs.closeSync(fd); + } + } + } + function getAccessibleFileSystemEntries(path) { + ts6.perfLogger.logEvent("ReadDir: " + (path || ".")); + try { + var entries = _fs.readdirSync(path || ".", { withFileTypes: true }); + var files = []; + var directories = []; + for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { + var dirent = entries_1[_i]; + var entry = typeof dirent === "string" ? dirent : dirent.name; + if (entry === "." || entry === "..") { + continue; + } + var stat = void 0; + if (typeof dirent === "string" || dirent.isSymbolicLink()) { + var name = ts6.combinePaths(path, entry); + try { + stat = statSync(name); + if (!stat) { + continue; + } + } catch (e) { + continue; + } + } else { + stat = dirent; + } + if (stat.isFile()) { + files.push(entry); + } else if (stat.isDirectory()) { + directories.push(entry); + } + } + files.sort(); + directories.sort(); + return { files, directories }; + } catch (e) { + return ts6.emptyFileSystemEntries; + } + } + function readDirectory(path, extensions, excludes, includes, depth) { + return ts6.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath); + } + function fileSystemEntryExists(path, entryKind) { + var originalStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + try { + var stat = statSync(path); + if (!stat) { + return false; + } + switch (entryKind) { + case 0: + return stat.isFile(); + case 1: + return stat.isDirectory(); + default: + return false; + } + } catch (e) { + return false; + } finally { + Error.stackTraceLimit = originalStackTraceLimit; + } + } + function fileExists(path) { + return fileSystemEntryExists( + path, + 0 + /* FileSystemEntryKind.File */ + ); + } + function directoryExists(path) { + return fileSystemEntryExists( + path, + 1 + /* FileSystemEntryKind.Directory */ + ); + } + function getDirectories(path) { + return getAccessibleFileSystemEntries(path).directories.slice(); + } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } + function realpath(path) { + try { + return fsRealpath(path); + } catch (_a) { + return path; + } + } + function getModifiedTime2(path) { + var _a; + var originalStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + try { + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; + } catch (e) { + return void 0; + } finally { + Error.stackTraceLimit = originalStackTraceLimit; + } + } + function setModifiedTime(path, time) { + try { + _fs.utimesSync(path, time, time); + } catch (e) { + return; + } + } + function deleteFile(path) { + try { + return _fs.unlinkSync(path); + } catch (e) { + return; + } + } + function createSHA256Hash(data) { + var hash2 = _crypto.createHash("sha256"); + hash2.update(data); + return hash2.digest("hex"); + } + } + var sys; + if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof __require !== "undefined") { + sys = getNodeSystem(); + } + if (sys) { + patchWriteFileEnsuringDirectory(sys); + } + return sys; + }(); + function setSys(s) { + ts6.sys = s; + } + ts6.setSys = setSys; + if (ts6.sys && ts6.sys.getEnvironmentVariable) { + setCustomPollingValues(ts6.sys); + ts6.Debug.setAssertionLevel( + /^development$/i.test(ts6.sys.getEnvironmentVariable("NODE_ENV")) ? 1 : 0 + /* AssertionLevel.None */ + ); + } + if (ts6.sys && ts6.sys.debugMode) { + ts6.Debug.isDebugging = true; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.directorySeparator = "/"; + ts6.altDirectorySeparator = "\\"; + var urlSchemeSeparator = "://"; + var backslashRegExp = /\\/g; + function isAnyDirectorySeparator(charCode) { + return charCode === 47 || charCode === 92; + } + ts6.isAnyDirectorySeparator = isAnyDirectorySeparator; + function isUrl(path) { + return getEncodedRootLength(path) < 0; + } + ts6.isUrl = isUrl; + function isRootedDiskPath(path) { + return getEncodedRootLength(path) > 0; + } + ts6.isRootedDiskPath = isRootedDiskPath; + function isDiskPathRoot(path) { + var rootLength = getEncodedRootLength(path); + return rootLength > 0 && rootLength === path.length; + } + ts6.isDiskPathRoot = isDiskPathRoot; + function pathIsAbsolute(path) { + return getEncodedRootLength(path) !== 0; + } + ts6.pathIsAbsolute = pathIsAbsolute; + function pathIsRelative(path) { + return /^\.\.?($|[\\/])/.test(path); + } + ts6.pathIsRelative = pathIsRelative; + function pathIsBareSpecifier(path) { + return !pathIsAbsolute(path) && !pathIsRelative(path); + } + ts6.pathIsBareSpecifier = pathIsBareSpecifier; + function hasExtension(fileName) { + return ts6.stringContains(getBaseFileName(fileName), "."); + } + ts6.hasExtension = hasExtension; + function fileExtensionIs(path, extension) { + return path.length > extension.length && ts6.endsWith(path, extension); + } + ts6.fileExtensionIs = fileExtensionIs; + function fileExtensionIsOneOf(path, extensions) { + for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) { + var extension = extensions_1[_i]; + if (fileExtensionIs(path, extension)) { + return true; + } + } + return false; + } + ts6.fileExtensionIsOneOf = fileExtensionIsOneOf; + function hasTrailingDirectorySeparator(path) { + return path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1)); + } + ts6.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator; + function isVolumeCharacter(charCode) { + return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90; + } + function getFileUrlVolumeSeparatorEnd(url, start) { + var ch0 = url.charCodeAt(start); + if (ch0 === 58) + return start + 1; + if (ch0 === 37 && url.charCodeAt(start + 1) === 51) { + var ch2 = url.charCodeAt(start + 2); + if (ch2 === 97 || ch2 === 65) + return start + 3; + } + return -1; + } + function getEncodedRootLength(path) { + if (!path) + return 0; + var ch0 = path.charCodeAt(0); + if (ch0 === 47 || ch0 === 92) { + if (path.charCodeAt(1) !== ch0) + return 1; + var p1 = path.indexOf(ch0 === 47 ? ts6.directorySeparator : ts6.altDirectorySeparator, 2); + if (p1 < 0) + return path.length; + return p1 + 1; + } + if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58) { + var ch2 = path.charCodeAt(2); + if (ch2 === 47 || ch2 === 92) + return 3; + if (path.length === 2) + return 2; + } + var schemeEnd = path.indexOf(urlSchemeSeparator); + if (schemeEnd !== -1) { + var authorityStart = schemeEnd + urlSchemeSeparator.length; + var authorityEnd = path.indexOf(ts6.directorySeparator, authorityStart); + if (authorityEnd !== -1) { + var scheme = path.slice(0, schemeEnd); + var authority = path.slice(authorityStart, authorityEnd); + if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) { + var volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2); + if (volumeSeparatorEnd !== -1) { + if (path.charCodeAt(volumeSeparatorEnd) === 47) { + return ~(volumeSeparatorEnd + 1); + } + if (volumeSeparatorEnd === path.length) { + return ~volumeSeparatorEnd; + } + } + } + return ~(authorityEnd + 1); + } + return ~path.length; + } + return 0; + } + function getRootLength(path) { + var rootLength = getEncodedRootLength(path); + return rootLength < 0 ? ~rootLength : rootLength; + } + ts6.getRootLength = getRootLength; + function getDirectoryPath(path) { + path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength === path.length) + return path; + path = removeTrailingDirectorySeparator(path); + return path.slice(0, Math.max(rootLength, path.lastIndexOf(ts6.directorySeparator))); + } + ts6.getDirectoryPath = getDirectoryPath; + function getBaseFileName(path, extensions, ignoreCase) { + path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength === path.length) + return ""; + path = removeTrailingDirectorySeparator(path); + var name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(ts6.directorySeparator) + 1)); + var extension = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(name, extensions, ignoreCase) : void 0; + return extension ? name.slice(0, name.length - extension.length) : name; + } + ts6.getBaseFileName = getBaseFileName; + function tryGetExtensionFromPath(path, extension, stringEqualityComparer) { + if (!ts6.startsWith(extension, ".")) + extension = "." + extension; + if (path.length >= extension.length && path.charCodeAt(path.length - extension.length) === 46) { + var pathExtension = path.slice(path.length - extension.length); + if (stringEqualityComparer(pathExtension, extension)) { + return pathExtension; + } + } + } + function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) { + if (typeof extensions === "string") { + return tryGetExtensionFromPath(path, extensions, stringEqualityComparer) || ""; + } + for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) { + var extension = extensions_2[_i]; + var result = tryGetExtensionFromPath(path, extension, stringEqualityComparer); + if (result) + return result; + } + return ""; + } + function getAnyExtensionFromPath(path, extensions, ignoreCase) { + if (extensions) { + return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(path), extensions, ignoreCase ? ts6.equateStringsCaseInsensitive : ts6.equateStringsCaseSensitive); + } + var baseFileName = getBaseFileName(path); + var extensionIndex = baseFileName.lastIndexOf("."); + if (extensionIndex >= 0) { + return baseFileName.substring(extensionIndex); + } + return ""; + } + ts6.getAnyExtensionFromPath = getAnyExtensionFromPath; + function pathComponents(path, rootLength) { + var root = path.substring(0, rootLength); + var rest = path.substring(rootLength).split(ts6.directorySeparator); + if (rest.length && !ts6.lastOrUndefined(rest)) + rest.pop(); + return __spreadArray([root], rest, true); + } + function getPathComponents(path, currentDirectory) { + if (currentDirectory === void 0) { + currentDirectory = ""; + } + path = combinePaths(currentDirectory, path); + return pathComponents(path, getRootLength(path)); + } + ts6.getPathComponents = getPathComponents; + function getPathFromPathComponents(pathComponents2) { + if (pathComponents2.length === 0) + return ""; + var root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]); + return root + pathComponents2.slice(1).join(ts6.directorySeparator); + } + ts6.getPathFromPathComponents = getPathFromPathComponents; + function normalizeSlashes(path) { + return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, ts6.directorySeparator) : path; + } + ts6.normalizeSlashes = normalizeSlashes; + function reducePathComponents(components) { + if (!ts6.some(components)) + return []; + var reduced = [components[0]]; + for (var i = 1; i < components.length; i++) { + var component = components[i]; + if (!component) + continue; + if (component === ".") + continue; + if (component === "..") { + if (reduced.length > 1) { + if (reduced[reduced.length - 1] !== "..") { + reduced.pop(); + continue; + } + } else if (reduced[0]) + continue; + } + reduced.push(component); + } + return reduced; + } + ts6.reducePathComponents = reducePathComponents; + function combinePaths(path) { + var paths = []; + for (var _i = 1; _i < arguments.length; _i++) { + paths[_i - 1] = arguments[_i]; + } + if (path) + path = normalizeSlashes(path); + for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) { + var relativePath = paths_1[_a]; + if (!relativePath) + continue; + relativePath = normalizeSlashes(relativePath); + if (!path || getRootLength(relativePath) !== 0) { + path = relativePath; + } else { + path = ensureTrailingDirectorySeparator(path) + relativePath; + } + } + return path; + } + ts6.combinePaths = combinePaths; + function resolvePath(path) { + var paths = []; + for (var _i = 1; _i < arguments.length; _i++) { + paths[_i - 1] = arguments[_i]; + } + return normalizePath(ts6.some(paths) ? combinePaths.apply(void 0, __spreadArray([path], paths, false)) : normalizeSlashes(path)); + } + ts6.resolvePath = resolvePath; + function getNormalizedPathComponents(path, currentDirectory) { + return reducePathComponents(getPathComponents(path, currentDirectory)); + } + ts6.getNormalizedPathComponents = getNormalizedPathComponents; + function getNormalizedAbsolutePath(fileName, currentDirectory) { + return getPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); + } + ts6.getNormalizedAbsolutePath = getNormalizedAbsolutePath; + function normalizePath(path) { + path = normalizeSlashes(path); + if (!relativePathSegmentRegExp.test(path)) { + return path; + } + var simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, ""); + if (simplified !== path) { + path = simplified; + if (!relativePathSegmentRegExp.test(path)) { + return path; + } + } + var normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path))); + return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized; + } + ts6.normalizePath = normalizePath; + function getPathWithoutRoot(pathComponents2) { + if (pathComponents2.length === 0) + return ""; + return pathComponents2.slice(1).join(ts6.directorySeparator); + } + function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) { + return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory)); + } + ts6.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot; + function toPath(fileName, basePath, getCanonicalFileName) { + var nonCanonicalizedPath = isRootedDiskPath(fileName) ? normalizePath(fileName) : getNormalizedAbsolutePath(fileName, basePath); + return getCanonicalFileName(nonCanonicalizedPath); + } + ts6.toPath = toPath; + function removeTrailingDirectorySeparator(path) { + if (hasTrailingDirectorySeparator(path)) { + return path.substr(0, path.length - 1); + } + return path; + } + ts6.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator; + function ensureTrailingDirectorySeparator(path) { + if (!hasTrailingDirectorySeparator(path)) { + return path + ts6.directorySeparator; + } + return path; + } + ts6.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator; + function ensurePathIsNonModuleName(path) { + return !pathIsAbsolute(path) && !pathIsRelative(path) ? "./" + path : path; + } + ts6.ensurePathIsNonModuleName = ensurePathIsNonModuleName; + function changeAnyExtension(path, ext, extensions, ignoreCase) { + var pathext = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path); + return pathext ? path.slice(0, path.length - pathext.length) + (ts6.startsWith(ext, ".") ? ext : "." + ext) : path; + } + ts6.changeAnyExtension = changeAnyExtension; + var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/; + function comparePathsWorker(a, b, componentComparer) { + if (a === b) + return 0; + if (a === void 0) + return -1; + if (b === void 0) + return 1; + var aRoot = a.substring(0, getRootLength(a)); + var bRoot = b.substring(0, getRootLength(b)); + var result = ts6.compareStringsCaseInsensitive(aRoot, bRoot); + if (result !== 0) { + return result; + } + var aRest = a.substring(aRoot.length); + var bRest = b.substring(bRoot.length); + if (!relativePathSegmentRegExp.test(aRest) && !relativePathSegmentRegExp.test(bRest)) { + return componentComparer(aRest, bRest); + } + var aComponents = reducePathComponents(getPathComponents(a)); + var bComponents = reducePathComponents(getPathComponents(b)); + var sharedLength = Math.min(aComponents.length, bComponents.length); + for (var i = 1; i < sharedLength; i++) { + var result_2 = componentComparer(aComponents[i], bComponents[i]); + if (result_2 !== 0) { + return result_2; + } + } + return ts6.compareValues(aComponents.length, bComponents.length); + } + function comparePathsCaseSensitive(a, b) { + return comparePathsWorker(a, b, ts6.compareStringsCaseSensitive); + } + ts6.comparePathsCaseSensitive = comparePathsCaseSensitive; + function comparePathsCaseInsensitive(a, b) { + return comparePathsWorker(a, b, ts6.compareStringsCaseInsensitive); + } + ts6.comparePathsCaseInsensitive = comparePathsCaseInsensitive; + function comparePaths(a, b, currentDirectory, ignoreCase) { + if (typeof currentDirectory === "string") { + a = combinePaths(currentDirectory, a); + b = combinePaths(currentDirectory, b); + } else if (typeof currentDirectory === "boolean") { + ignoreCase = currentDirectory; + } + return comparePathsWorker(a, b, ts6.getStringComparer(ignoreCase)); + } + ts6.comparePaths = comparePaths; + function containsPath(parent, child, currentDirectory, ignoreCase) { + if (typeof currentDirectory === "string") { + parent = combinePaths(currentDirectory, parent); + child = combinePaths(currentDirectory, child); + } else if (typeof currentDirectory === "boolean") { + ignoreCase = currentDirectory; + } + if (parent === void 0 || child === void 0) + return false; + if (parent === child) + return true; + var parentComponents = reducePathComponents(getPathComponents(parent)); + var childComponents = reducePathComponents(getPathComponents(child)); + if (childComponents.length < parentComponents.length) { + return false; + } + var componentEqualityComparer = ignoreCase ? ts6.equateStringsCaseInsensitive : ts6.equateStringsCaseSensitive; + for (var i = 0; i < parentComponents.length; i++) { + var equalityComparer = i === 0 ? ts6.equateStringsCaseInsensitive : componentEqualityComparer; + if (!equalityComparer(parentComponents[i], childComponents[i])) { + return false; + } + } + return true; + } + ts6.containsPath = containsPath; + function startsWithDirectory(fileName, directoryName, getCanonicalFileName) { + var canonicalFileName = getCanonicalFileName(fileName); + var canonicalDirectoryName = getCanonicalFileName(directoryName); + return ts6.startsWith(canonicalFileName, canonicalDirectoryName + "/") || ts6.startsWith(canonicalFileName, canonicalDirectoryName + "\\"); + } + ts6.startsWithDirectory = startsWithDirectory; + function getPathComponentsRelativeTo(from, to, stringEqualityComparer, getCanonicalFileName) { + var fromComponents = reducePathComponents(getPathComponents(from)); + var toComponents = reducePathComponents(getPathComponents(to)); + var start; + for (start = 0; start < fromComponents.length && start < toComponents.length; start++) { + var fromComponent = getCanonicalFileName(fromComponents[start]); + var toComponent = getCanonicalFileName(toComponents[start]); + var comparer = start === 0 ? ts6.equateStringsCaseInsensitive : stringEqualityComparer; + if (!comparer(fromComponent, toComponent)) + break; + } + if (start === 0) { + return toComponents; + } + var components = toComponents.slice(start); + var relative = []; + for (; start < fromComponents.length; start++) { + relative.push(".."); + } + return __spreadArray(__spreadArray([""], relative, true), components, true); + } + ts6.getPathComponentsRelativeTo = getPathComponentsRelativeTo; + function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) { + ts6.Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative"); + var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts6.identity; + var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false; + var pathComponents2 = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts6.equateStringsCaseInsensitive : ts6.equateStringsCaseSensitive, getCanonicalFileName); + return getPathFromPathComponents(pathComponents2); + } + ts6.getRelativePathFromDirectory = getRelativePathFromDirectory; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !isRootedDiskPath(absoluteOrRelativePath) ? absoluteOrRelativePath : getRelativePathToDirectoryOrUrl( + basePath, + absoluteOrRelativePath, + basePath, + getCanonicalFileName, + /*isAbsolutePathAnUrl*/ + false + ); + } + ts6.convertToRelativePath = convertToRelativePath; + function getRelativePathFromFile(from, to, getCanonicalFileName) { + return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from), to, getCanonicalFileName)); + } + ts6.getRelativePathFromFile = getRelativePathFromFile; + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { + var pathComponents2 = getPathComponentsRelativeTo(resolvePath(currentDirectory, directoryPathOrUrl), resolvePath(currentDirectory, relativeOrAbsolutePath), ts6.equateStringsCaseSensitive, getCanonicalFileName); + var firstComponent = pathComponents2[0]; + if (isAbsolutePathAnUrl && isRootedDiskPath(firstComponent)) { + var prefix2 = firstComponent.charAt(0) === ts6.directorySeparator ? "file://" : "file:///"; + pathComponents2[0] = prefix2 + firstComponent; + } + return getPathFromPathComponents(pathComponents2); + } + ts6.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; + function forEachAncestorDirectory(directory, callback) { + while (true) { + var result = callback(directory); + if (result !== void 0) { + return result; + } + var parentPath = getDirectoryPath(directory); + if (parentPath === directory) { + return void 0; + } + directory = parentPath; + } + } + ts6.forEachAncestorDirectory = forEachAncestorDirectory; + function isNodeModulesDirectory(dirPath) { + return ts6.endsWith(dirPath, "/node_modules"); + } + ts6.isNodeModulesDirectory = isNodeModulesDirectory; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function diag(code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid, reportsDeprecated) { + return { code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid, reportsDeprecated }; + } + ts6.Diagnostics = { + Unterminated_string_literal: diag(1002, ts6.DiagnosticCategory.Error, "Unterminated_string_literal_1002", "Unterminated string literal."), + Identifier_expected: diag(1003, ts6.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), + _0_expected: diag(1005, ts6.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), + A_file_cannot_have_a_reference_to_itself: diag(1006, ts6.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), + The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts6.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + Trailing_comma_not_allowed: diag(1009, ts6.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), + Asterisk_Slash_expected: diag(1010, ts6.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), + An_element_access_expression_should_take_an_argument: diag(1011, ts6.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), + Unexpected_token: diag(1012, ts6.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts6.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."), + A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts6.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), + Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts6.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), + A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts6.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), + An_index_signature_cannot_have_a_rest_parameter: diag(1017, ts6.DiagnosticCategory.Error, "An_index_signature_cannot_have_a_rest_parameter_1017", "An index signature cannot have a rest parameter."), + An_index_signature_parameter_cannot_have_an_accessibility_modifier: diag(1018, ts6.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", "An index signature parameter cannot have an accessibility modifier."), + An_index_signature_parameter_cannot_have_a_question_mark: diag(1019, ts6.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_a_question_mark_1019", "An index signature parameter cannot have a question mark."), + An_index_signature_parameter_cannot_have_an_initializer: diag(1020, ts6.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_initializer_1020", "An index signature parameter cannot have an initializer."), + An_index_signature_must_have_a_type_annotation: diag(1021, ts6.DiagnosticCategory.Error, "An_index_signature_must_have_a_type_annotation_1021", "An index signature must have a type annotation."), + An_index_signature_parameter_must_have_a_type_annotation: diag(1022, ts6.DiagnosticCategory.Error, "An_index_signature_parameter_must_have_a_type_annotation_1022", "An index signature parameter must have a type annotation."), + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: diag(1024, ts6.DiagnosticCategory.Error, "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", "'readonly' modifier can only appear on a property declaration or index signature."), + An_index_signature_cannot_have_a_trailing_comma: diag(1025, ts6.DiagnosticCategory.Error, "An_index_signature_cannot_have_a_trailing_comma_1025", "An index signature cannot have a trailing comma."), + Accessibility_modifier_already_seen: diag(1028, ts6.DiagnosticCategory.Error, "Accessibility_modifier_already_seen_1028", "Accessibility modifier already seen."), + _0_modifier_must_precede_1_modifier: diag(1029, ts6.DiagnosticCategory.Error, "_0_modifier_must_precede_1_modifier_1029", "'{0}' modifier must precede '{1}' modifier."), + _0_modifier_already_seen: diag(1030, ts6.DiagnosticCategory.Error, "_0_modifier_already_seen_1030", "'{0}' modifier already seen."), + _0_modifier_cannot_appear_on_class_elements_of_this_kind: diag(1031, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_class_elements_of_this_kind_1031", "'{0}' modifier cannot appear on class elements of this kind."), + super_must_be_followed_by_an_argument_list_or_member_access: diag(1034, ts6.DiagnosticCategory.Error, "super_must_be_followed_by_an_argument_list_or_member_access_1034", "'super' must be followed by an argument list or member access."), + Only_ambient_modules_can_use_quoted_names: diag(1035, ts6.DiagnosticCategory.Error, "Only_ambient_modules_can_use_quoted_names_1035", "Only ambient modules can use quoted names."), + Statements_are_not_allowed_in_ambient_contexts: diag(1036, ts6.DiagnosticCategory.Error, "Statements_are_not_allowed_in_ambient_contexts_1036", "Statements are not allowed in ambient contexts."), + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: diag(1038, ts6.DiagnosticCategory.Error, "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", "A 'declare' modifier cannot be used in an already ambient context."), + Initializers_are_not_allowed_in_ambient_contexts: diag(1039, ts6.DiagnosticCategory.Error, "Initializers_are_not_allowed_in_ambient_contexts_1039", "Initializers are not allowed in ambient contexts."), + _0_modifier_cannot_be_used_in_an_ambient_context: diag(1040, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_in_an_ambient_context_1040", "'{0}' modifier cannot be used in an ambient context."), + _0_modifier_cannot_be_used_here: diag(1042, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_here_1042", "'{0}' modifier cannot be used here."), + _0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."), + Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts6.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."), + A_rest_parameter_cannot_be_optional: diag(1047, ts6.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."), + A_rest_parameter_cannot_have_an_initializer: diag(1048, ts6.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."), + A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts6.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."), + A_set_accessor_cannot_have_an_optional_parameter: diag(1051, ts6.DiagnosticCategory.Error, "A_set_accessor_cannot_have_an_optional_parameter_1051", "A 'set' accessor cannot have an optional parameter."), + A_set_accessor_parameter_cannot_have_an_initializer: diag(1052, ts6.DiagnosticCategory.Error, "A_set_accessor_parameter_cannot_have_an_initializer_1052", "A 'set' accessor parameter cannot have an initializer."), + A_set_accessor_cannot_have_rest_parameter: diag(1053, ts6.DiagnosticCategory.Error, "A_set_accessor_cannot_have_rest_parameter_1053", "A 'set' accessor cannot have rest parameter."), + A_get_accessor_cannot_have_parameters: diag(1054, ts6.DiagnosticCategory.Error, "A_get_accessor_cannot_have_parameters_1054", "A 'get' accessor cannot have parameters."), + Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: diag(1055, ts6.DiagnosticCategory.Error, "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value."), + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: diag(1056, ts6.DiagnosticCategory.Error, "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", "Accessors are only available when targeting ECMAScript 5 and higher."), + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1058, ts6.DiagnosticCategory.Error, "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", "The return type of an async function must either be a valid promise or must not contain a callable 'then' member."), + A_promise_must_have_a_then_method: diag(1059, ts6.DiagnosticCategory.Error, "A_promise_must_have_a_then_method_1059", "A promise must have a 'then' method."), + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: diag(1060, ts6.DiagnosticCategory.Error, "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", "The first parameter of the 'then' method of a promise must be a callback."), + Enum_member_must_have_initializer: diag(1061, ts6.DiagnosticCategory.Error, "Enum_member_must_have_initializer_1061", "Enum member must have initializer."), + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, ts6.DiagnosticCategory.Error, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."), + An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, ts6.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."), + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, ts6.DiagnosticCategory.Error, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{0}>'?"), + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, ts6.DiagnosticCategory.Error, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."), + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, ts6.DiagnosticCategory.Error, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."), + Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, ts6.DiagnosticCategory.Error, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."), + _0_modifier_cannot_appear_on_a_type_member: diag(1070, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_member_1070", "'{0}' modifier cannot appear on a type member."), + _0_modifier_cannot_appear_on_an_index_signature: diag(1071, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."), + A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts6.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."), + Invalid_reference_directive_syntax: diag(1084, ts6.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."), + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts6.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."), + _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."), + _0_modifier_cannot_appear_on_a_parameter: diag(1090, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."), + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts6.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."), + Type_parameters_cannot_appear_on_a_constructor_declaration: diag(1092, ts6.DiagnosticCategory.Error, "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", "Type parameters cannot appear on a constructor declaration."), + Type_annotation_cannot_appear_on_a_constructor_declaration: diag(1093, ts6.DiagnosticCategory.Error, "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", "Type annotation cannot appear on a constructor declaration."), + An_accessor_cannot_have_type_parameters: diag(1094, ts6.DiagnosticCategory.Error, "An_accessor_cannot_have_type_parameters_1094", "An accessor cannot have type parameters."), + A_set_accessor_cannot_have_a_return_type_annotation: diag(1095, ts6.DiagnosticCategory.Error, "A_set_accessor_cannot_have_a_return_type_annotation_1095", "A 'set' accessor cannot have a return type annotation."), + An_index_signature_must_have_exactly_one_parameter: diag(1096, ts6.DiagnosticCategory.Error, "An_index_signature_must_have_exactly_one_parameter_1096", "An index signature must have exactly one parameter."), + _0_list_cannot_be_empty: diag(1097, ts6.DiagnosticCategory.Error, "_0_list_cannot_be_empty_1097", "'{0}' list cannot be empty."), + Type_parameter_list_cannot_be_empty: diag(1098, ts6.DiagnosticCategory.Error, "Type_parameter_list_cannot_be_empty_1098", "Type parameter list cannot be empty."), + Type_argument_list_cannot_be_empty: diag(1099, ts6.DiagnosticCategory.Error, "Type_argument_list_cannot_be_empty_1099", "Type argument list cannot be empty."), + Invalid_use_of_0_in_strict_mode: diag(1100, ts6.DiagnosticCategory.Error, "Invalid_use_of_0_in_strict_mode_1100", "Invalid use of '{0}' in strict mode."), + with_statements_are_not_allowed_in_strict_mode: diag(1101, ts6.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_strict_mode_1101", "'with' statements are not allowed in strict mode."), + delete_cannot_be_called_on_an_identifier_in_strict_mode: diag(1102, ts6.DiagnosticCategory.Error, "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", "'delete' cannot be called on an identifier in strict mode."), + for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1103, ts6.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1103", "'for await' loops are only allowed within async functions and at the top levels of modules."), + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: diag(1104, ts6.DiagnosticCategory.Error, "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", "A 'continue' statement can only be used within an enclosing iteration statement."), + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: diag(1105, ts6.DiagnosticCategory.Error, "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", "A 'break' statement can only be used within an enclosing iteration or switch statement."), + The_left_hand_side_of_a_for_of_statement_may_not_be_async: diag(1106, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_may_not_be_async_1106", "The left-hand side of a 'for...of' statement may not be 'async'."), + Jump_target_cannot_cross_function_boundary: diag(1107, ts6.DiagnosticCategory.Error, "Jump_target_cannot_cross_function_boundary_1107", "Jump target cannot cross function boundary."), + A_return_statement_can_only_be_used_within_a_function_body: diag(1108, ts6.DiagnosticCategory.Error, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."), + Expression_expected: diag(1109, ts6.DiagnosticCategory.Error, "Expression_expected_1109", "Expression expected."), + Type_expected: diag(1110, ts6.DiagnosticCategory.Error, "Type_expected_1110", "Type expected."), + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, ts6.DiagnosticCategory.Error, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."), + Duplicate_label_0: diag(1114, ts6.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."), + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, ts6.DiagnosticCategory.Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."), + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: diag(1116, ts6.DiagnosticCategory.Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."), + An_object_literal_cannot_have_multiple_properties_with_the_same_name: diag(1117, ts6.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_1117", "An object literal cannot have multiple properties with the same name."), + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, ts6.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."), + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, ts6.DiagnosticCategory.Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."), + An_export_assignment_cannot_have_modifiers: diag(1120, ts6.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."), + Octal_literals_are_not_allowed_in_strict_mode: diag(1121, ts6.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."), + Variable_declaration_list_cannot_be_empty: diag(1123, ts6.DiagnosticCategory.Error, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."), + Digit_expected: diag(1124, ts6.DiagnosticCategory.Error, "Digit_expected_1124", "Digit expected."), + Hexadecimal_digit_expected: diag(1125, ts6.DiagnosticCategory.Error, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."), + Unexpected_end_of_text: diag(1126, ts6.DiagnosticCategory.Error, "Unexpected_end_of_text_1126", "Unexpected end of text."), + Invalid_character: diag(1127, ts6.DiagnosticCategory.Error, "Invalid_character_1127", "Invalid character."), + Declaration_or_statement_expected: diag(1128, ts6.DiagnosticCategory.Error, "Declaration_or_statement_expected_1128", "Declaration or statement expected."), + Statement_expected: diag(1129, ts6.DiagnosticCategory.Error, "Statement_expected_1129", "Statement expected."), + case_or_default_expected: diag(1130, ts6.DiagnosticCategory.Error, "case_or_default_expected_1130", "'case' or 'default' expected."), + Property_or_signature_expected: diag(1131, ts6.DiagnosticCategory.Error, "Property_or_signature_expected_1131", "Property or signature expected."), + Enum_member_expected: diag(1132, ts6.DiagnosticCategory.Error, "Enum_member_expected_1132", "Enum member expected."), + Variable_declaration_expected: diag(1134, ts6.DiagnosticCategory.Error, "Variable_declaration_expected_1134", "Variable declaration expected."), + Argument_expression_expected: diag(1135, ts6.DiagnosticCategory.Error, "Argument_expression_expected_1135", "Argument expression expected."), + Property_assignment_expected: diag(1136, ts6.DiagnosticCategory.Error, "Property_assignment_expected_1136", "Property assignment expected."), + Expression_or_comma_expected: diag(1137, ts6.DiagnosticCategory.Error, "Expression_or_comma_expected_1137", "Expression or comma expected."), + Parameter_declaration_expected: diag(1138, ts6.DiagnosticCategory.Error, "Parameter_declaration_expected_1138", "Parameter declaration expected."), + Type_parameter_declaration_expected: diag(1139, ts6.DiagnosticCategory.Error, "Type_parameter_declaration_expected_1139", "Type parameter declaration expected."), + Type_argument_expected: diag(1140, ts6.DiagnosticCategory.Error, "Type_argument_expected_1140", "Type argument expected."), + String_literal_expected: diag(1141, ts6.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."), + Line_break_not_permitted_here: diag(1142, ts6.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."), + or_expected: diag(1144, ts6.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."), + or_JSX_element_expected: diag(1145, ts6.DiagnosticCategory.Error, "or_JSX_element_expected_1145", "'{' or JSX element expected."), + Declaration_expected: diag(1146, ts6.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."), + Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts6.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."), + Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts6.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."), + File_name_0_differs_from_already_included_file_name_1_only_in_casing: diag(1149, ts6.DiagnosticCategory.Error, "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", "File name '{0}' differs from already included file name '{1}' only in casing."), + const_declarations_must_be_initialized: diag(1155, ts6.DiagnosticCategory.Error, "const_declarations_must_be_initialized_1155", "'const' declarations must be initialized."), + const_declarations_can_only_be_declared_inside_a_block: diag(1156, ts6.DiagnosticCategory.Error, "const_declarations_can_only_be_declared_inside_a_block_1156", "'const' declarations can only be declared inside a block."), + let_declarations_can_only_be_declared_inside_a_block: diag(1157, ts6.DiagnosticCategory.Error, "let_declarations_can_only_be_declared_inside_a_block_1157", "'let' declarations can only be declared inside a block."), + Unterminated_template_literal: diag(1160, ts6.DiagnosticCategory.Error, "Unterminated_template_literal_1160", "Unterminated template literal."), + Unterminated_regular_expression_literal: diag(1161, ts6.DiagnosticCategory.Error, "Unterminated_regular_expression_literal_1161", "Unterminated regular expression literal."), + An_object_member_cannot_be_declared_optional: diag(1162, ts6.DiagnosticCategory.Error, "An_object_member_cannot_be_declared_optional_1162", "An object member cannot be declared optional."), + A_yield_expression_is_only_allowed_in_a_generator_body: diag(1163, ts6.DiagnosticCategory.Error, "A_yield_expression_is_only_allowed_in_a_generator_body_1163", "A 'yield' expression is only allowed in a generator body."), + Computed_property_names_are_not_allowed_in_enums: diag(1164, ts6.DiagnosticCategory.Error, "Computed_property_names_are_not_allowed_in_enums_1164", "Computed property names are not allowed in enums."), + A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1165, ts6.DiagnosticCategory.Error, "A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165", "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type."), + A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type: diag(1166, ts6.DiagnosticCategory.Error, "A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_1166", "A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type."), + A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1168, ts6.DiagnosticCategory.Error, "A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_ty_1168", "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type."), + A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1169, ts6.DiagnosticCategory.Error, "A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169", "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type."), + A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1170, ts6.DiagnosticCategory.Error, "A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type__1170", "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."), + A_comma_expression_is_not_allowed_in_a_computed_property_name: diag(1171, ts6.DiagnosticCategory.Error, "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", "A comma expression is not allowed in a computed property name."), + extends_clause_already_seen: diag(1172, ts6.DiagnosticCategory.Error, "extends_clause_already_seen_1172", "'extends' clause already seen."), + extends_clause_must_precede_implements_clause: diag(1173, ts6.DiagnosticCategory.Error, "extends_clause_must_precede_implements_clause_1173", "'extends' clause must precede 'implements' clause."), + Classes_can_only_extend_a_single_class: diag(1174, ts6.DiagnosticCategory.Error, "Classes_can_only_extend_a_single_class_1174", "Classes can only extend a single class."), + implements_clause_already_seen: diag(1175, ts6.DiagnosticCategory.Error, "implements_clause_already_seen_1175", "'implements' clause already seen."), + Interface_declaration_cannot_have_implements_clause: diag(1176, ts6.DiagnosticCategory.Error, "Interface_declaration_cannot_have_implements_clause_1176", "Interface declaration cannot have 'implements' clause."), + Binary_digit_expected: diag(1177, ts6.DiagnosticCategory.Error, "Binary_digit_expected_1177", "Binary digit expected."), + Octal_digit_expected: diag(1178, ts6.DiagnosticCategory.Error, "Octal_digit_expected_1178", "Octal digit expected."), + Unexpected_token_expected: diag(1179, ts6.DiagnosticCategory.Error, "Unexpected_token_expected_1179", "Unexpected token. '{' expected."), + Property_destructuring_pattern_expected: diag(1180, ts6.DiagnosticCategory.Error, "Property_destructuring_pattern_expected_1180", "Property destructuring pattern expected."), + Array_element_destructuring_pattern_expected: diag(1181, ts6.DiagnosticCategory.Error, "Array_element_destructuring_pattern_expected_1181", "Array element destructuring pattern expected."), + A_destructuring_declaration_must_have_an_initializer: diag(1182, ts6.DiagnosticCategory.Error, "A_destructuring_declaration_must_have_an_initializer_1182", "A destructuring declaration must have an initializer."), + An_implementation_cannot_be_declared_in_ambient_contexts: diag(1183, ts6.DiagnosticCategory.Error, "An_implementation_cannot_be_declared_in_ambient_contexts_1183", "An implementation cannot be declared in ambient contexts."), + Modifiers_cannot_appear_here: diag(1184, ts6.DiagnosticCategory.Error, "Modifiers_cannot_appear_here_1184", "Modifiers cannot appear here."), + Merge_conflict_marker_encountered: diag(1185, ts6.DiagnosticCategory.Error, "Merge_conflict_marker_encountered_1185", "Merge conflict marker encountered."), + A_rest_element_cannot_have_an_initializer: diag(1186, ts6.DiagnosticCategory.Error, "A_rest_element_cannot_have_an_initializer_1186", "A rest element cannot have an initializer."), + A_parameter_property_may_not_be_declared_using_a_binding_pattern: diag(1187, ts6.DiagnosticCategory.Error, "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187", "A parameter property may not be declared using a binding pattern."), + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: diag(1188, ts6.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", "Only a single variable declaration is allowed in a 'for...of' statement."), + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: diag(1189, ts6.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", "The variable declaration of a 'for...in' statement cannot have an initializer."), + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: diag(1190, ts6.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", "The variable declaration of a 'for...of' statement cannot have an initializer."), + An_import_declaration_cannot_have_modifiers: diag(1191, ts6.DiagnosticCategory.Error, "An_import_declaration_cannot_have_modifiers_1191", "An import declaration cannot have modifiers."), + Module_0_has_no_default_export: diag(1192, ts6.DiagnosticCategory.Error, "Module_0_has_no_default_export_1192", "Module '{0}' has no default export."), + An_export_declaration_cannot_have_modifiers: diag(1193, ts6.DiagnosticCategory.Error, "An_export_declaration_cannot_have_modifiers_1193", "An export declaration cannot have modifiers."), + Export_declarations_are_not_permitted_in_a_namespace: diag(1194, ts6.DiagnosticCategory.Error, "Export_declarations_are_not_permitted_in_a_namespace_1194", "Export declarations are not permitted in a namespace."), + export_Asterisk_does_not_re_export_a_default: diag(1195, ts6.DiagnosticCategory.Error, "export_Asterisk_does_not_re_export_a_default_1195", "'export *' does not re-export a default."), + Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified: diag(1196, ts6.DiagnosticCategory.Error, "Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196", "Catch clause variable type annotation must be 'any' or 'unknown' if specified."), + Catch_clause_variable_cannot_have_an_initializer: diag(1197, ts6.DiagnosticCategory.Error, "Catch_clause_variable_cannot_have_an_initializer_1197", "Catch clause variable cannot have an initializer."), + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: diag(1198, ts6.DiagnosticCategory.Error, "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."), + Unterminated_Unicode_escape_sequence: diag(1199, ts6.DiagnosticCategory.Error, "Unterminated_Unicode_escape_sequence_1199", "Unterminated Unicode escape sequence."), + Line_terminator_not_permitted_before_arrow: diag(1200, ts6.DiagnosticCategory.Error, "Line_terminator_not_permitted_before_arrow_1200", "Line terminator not permitted before arrow."), + Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(1202, ts6.DiagnosticCategory.Error, "Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202", `Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`), + Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead: diag(1203, ts6.DiagnosticCategory.Error, "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203", "Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead."), + Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type: diag(1205, ts6.DiagnosticCategory.Error, "Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type_1205", "Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'."), + Decorators_are_not_valid_here: diag(1206, ts6.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."), + Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts6.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."), + _0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module: diag(1208, ts6.DiagnosticCategory.Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."), + Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0: diag(1209, ts6.DiagnosticCategory.Error, "Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0_1209", "Invalid optional chain from new expression. Did you mean to call '{0}()'?"), + Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode: diag(1210, ts6.DiagnosticCategory.Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."), + A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts6.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."), + Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts6.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."), + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: diag(1213, ts6.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."), + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: diag(1214, ts6.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."), + Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts6.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."), + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts6.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."), + Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts6.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."), + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts6.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."), + Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts6.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."), + An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts6.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."), + _0_tag_already_specified: diag(1223, ts6.DiagnosticCategory.Error, "_0_tag_already_specified_1223", "'{0}' tag already specified."), + Signature_0_must_be_a_type_predicate: diag(1224, ts6.DiagnosticCategory.Error, "Signature_0_must_be_a_type_predicate_1224", "Signature '{0}' must be a type predicate."), + Cannot_find_parameter_0: diag(1225, ts6.DiagnosticCategory.Error, "Cannot_find_parameter_0_1225", "Cannot find parameter '{0}'."), + Type_predicate_0_is_not_assignable_to_1: diag(1226, ts6.DiagnosticCategory.Error, "Type_predicate_0_is_not_assignable_to_1_1226", "Type predicate '{0}' is not assignable to '{1}'."), + Parameter_0_is_not_in_the_same_position_as_parameter_1: diag(1227, ts6.DiagnosticCategory.Error, "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", "Parameter '{0}' is not in the same position as parameter '{1}'."), + A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: diag(1228, ts6.DiagnosticCategory.Error, "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", "A type predicate is only allowed in return type position for functions and methods."), + A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts6.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."), + A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts6.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."), + An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1231, ts6.DiagnosticCategory.Error, "An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231", "An export assignment must be at the top level of a file or module declaration."), + An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1232, ts6.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1232", "An import declaration can only be used at the top level of a namespace or module."), + An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1233, ts6.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1233", "An export declaration can only be used at the top level of a namespace or module."), + An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts6.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."), + A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module: diag(1235, ts6.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235", "A namespace declaration is only allowed at the top level of a namespace or module."), + The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts6.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."), + The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts6.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."), + Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts6.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."), + Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: diag(1239, ts6.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", "Unable to resolve signature of parameter decorator when called as an expression."), + Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: diag(1240, ts6.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", "Unable to resolve signature of property decorator when called as an expression."), + Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: diag(1241, ts6.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", "Unable to resolve signature of method decorator when called as an expression."), + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: diag(1242, ts6.DiagnosticCategory.Error, "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", "'abstract' modifier can only appear on a class, method, or property declaration."), + _0_modifier_cannot_be_used_with_1_modifier: diag(1243, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_1_modifier_1243", "'{0}' modifier cannot be used with '{1}' modifier."), + Abstract_methods_can_only_appear_within_an_abstract_class: diag(1244, ts6.DiagnosticCategory.Error, "Abstract_methods_can_only_appear_within_an_abstract_class_1244", "Abstract methods can only appear within an abstract class."), + Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: diag(1245, ts6.DiagnosticCategory.Error, "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", "Method '{0}' cannot have an implementation because it is marked abstract."), + An_interface_property_cannot_have_an_initializer: diag(1246, ts6.DiagnosticCategory.Error, "An_interface_property_cannot_have_an_initializer_1246", "An interface property cannot have an initializer."), + A_type_literal_property_cannot_have_an_initializer: diag(1247, ts6.DiagnosticCategory.Error, "A_type_literal_property_cannot_have_an_initializer_1247", "A type literal property cannot have an initializer."), + A_class_member_cannot_have_the_0_keyword: diag(1248, ts6.DiagnosticCategory.Error, "A_class_member_cannot_have_the_0_keyword_1248", "A class member cannot have the '{0}' keyword."), + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: diag(1249, ts6.DiagnosticCategory.Error, "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", "A decorator can only decorate a method implementation, not an overload."), + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, ts6.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."), + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, ts6.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."), + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, ts6.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."), + A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference: diag(1254, ts6.DiagnosticCategory.Error, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254", "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."), + A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts6.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."), + A_required_element_cannot_follow_an_optional_element: diag(1257, ts6.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."), + A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1258, ts6.DiagnosticCategory.Error, "A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration_1258", "A default export must be at the top level of a file or module declaration."), + Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts6.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"), + Keywords_cannot_contain_escape_characters: diag(1260, ts6.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."), + Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, ts6.DiagnosticCategory.Error, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."), + Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, ts6.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."), + Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, ts6.DiagnosticCategory.Error, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."), + Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, ts6.DiagnosticCategory.Error, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."), + A_rest_element_cannot_follow_another_rest_element: diag(1265, ts6.DiagnosticCategory.Error, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."), + An_optional_element_cannot_follow_a_rest_element: diag(1266, ts6.DiagnosticCategory.Error, "An_optional_element_cannot_follow_a_rest_element_1266", "An optional element cannot follow a rest element."), + Property_0_cannot_have_an_initializer_because_it_is_marked_abstract: diag(1267, ts6.DiagnosticCategory.Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."), + An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type: diag(1268, ts6.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."), + Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts6.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."), + Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts6.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."), + Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts6.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."), + A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts6.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), + _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), + _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts6.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts6.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts6.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), + with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts6.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), + await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts6.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), + The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts6.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), + Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts6.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."), + The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts6.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."), + Global_module_exports_may_only_appear_in_module_files: diag(1314, ts6.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."), + Global_module_exports_may_only_appear_in_declaration_files: diag(1315, ts6.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_declaration_files_1315", "Global module exports may only appear in declaration files."), + Global_module_exports_may_only_appear_at_top_level: diag(1316, ts6.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_at_top_level_1316", "Global module exports may only appear at top level."), + A_parameter_property_cannot_be_declared_using_a_rest_parameter: diag(1317, ts6.DiagnosticCategory.Error, "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", "A parameter property cannot be declared using a rest parameter."), + An_abstract_accessor_cannot_have_an_implementation: diag(1318, ts6.DiagnosticCategory.Error, "An_abstract_accessor_cannot_have_an_implementation_1318", "An abstract accessor cannot have an implementation."), + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: diag(1319, ts6.DiagnosticCategory.Error, "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", "A default export can only be used in an ECMAScript-style module."), + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts6.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."), + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts6.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."), + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts6.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."), + Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, ts6.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."), + Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, ts6.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."), + Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts6.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."), + This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts6.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."), + String_literal_with_double_quotes_expected: diag(1327, ts6.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."), + Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts6.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."), + _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: diag(1329, ts6.DiagnosticCategory.Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"), + A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly: diag(1330, ts6.DiagnosticCategory.Error, "A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330", "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'."), + A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly: diag(1331, ts6.DiagnosticCategory.Error, "A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331", "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'."), + A_variable_whose_type_is_a_unique_symbol_type_must_be_const: diag(1332, ts6.DiagnosticCategory.Error, "A_variable_whose_type_is_a_unique_symbol_type_must_be_const_1332", "A variable whose type is a 'unique symbol' type must be 'const'."), + unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name: diag(1333, ts6.DiagnosticCategory.Error, "unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name_1333", "'unique symbol' types may not be used on a variable declaration with a binding name."), + unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement: diag(1334, ts6.DiagnosticCategory.Error, "unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement_1334", "'unique symbol' types are only allowed on variables in a variable statement."), + unique_symbol_types_are_not_allowed_here: diag(1335, ts6.DiagnosticCategory.Error, "unique_symbol_types_are_not_allowed_here_1335", "'unique symbol' types are not allowed here."), + An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts6.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337", "An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead."), + infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts6.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."), + Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts6.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."), + Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts6.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"), + Class_constructor_may_not_be_an_accessor: diag(1341, ts6.DiagnosticCategory.Error, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."), + Type_arguments_cannot_be_used_here: diag(1342, ts6.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."), + The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts6.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."), + A_label_is_not_allowed_here: diag(1344, ts6.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."), + An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts6.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."), + This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts6.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."), + use_strict_directive_cannot_be_used_with_non_simple_parameter_list: diag(1347, ts6.DiagnosticCategory.Error, "use_strict_directive_cannot_be_used_with_non_simple_parameter_list_1347", "'use strict' directive cannot be used with non-simple parameter list."), + Non_simple_parameter_declared_here: diag(1348, ts6.DiagnosticCategory.Error, "Non_simple_parameter_declared_here_1348", "Non-simple parameter declared here."), + use_strict_directive_used_here: diag(1349, ts6.DiagnosticCategory.Error, "use_strict_directive_used_here_1349", "'use strict' directive used here."), + Print_the_final_configuration_instead_of_building: diag(1350, ts6.DiagnosticCategory.Message, "Print_the_final_configuration_instead_of_building_1350", "Print the final configuration instead of building."), + An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal: diag(1351, ts6.DiagnosticCategory.Error, "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351", "An identifier or keyword cannot immediately follow a numeric literal."), + A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts6.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."), + A_bigint_literal_must_be_an_integer: diag(1353, ts6.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."), + readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts6.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."), + A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts6.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."), + Did_you_mean_to_mark_this_function_as_async: diag(1356, ts6.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"), + An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts6.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), + Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts6.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), + Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts6.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts6.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), + _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts6.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), + _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts6.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), + A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts6.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), + Convert_to_type_only_export: diag(1364, ts6.DiagnosticCategory.Message, "Convert_to_type_only_export_1364", "Convert to type-only export"), + Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts6.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), + Split_into_two_separate_import_declarations: diag(1366, ts6.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), + Split_all_invalid_type_only_imports: diag(1367, ts6.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts6.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), + Did_you_mean_0: diag(1369, ts6.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), + This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts6.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), + Convert_to_type_only_import: diag(1373, ts6.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), + Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, ts6.DiagnosticCategory.Message, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"), + await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts6.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."), + _0_was_imported_here: diag(1376, ts6.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."), + _0_was_exported_here: diag(1377, ts6.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."), + Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts6.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."), + An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts6.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."), + An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts6.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."), + Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts6.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"), + Unexpected_token_Did_you_mean_or_gt: diag(1382, ts6.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"), + Only_named_exports_may_use_export_type: diag(1383, ts6.DiagnosticCategory.Error, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."), + Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, ts6.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."), + Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, ts6.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."), + Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts6.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."), + Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts6.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."), + _0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts6.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."), + _0_is_not_allowed_as_a_parameter_name: diag(1390, ts6.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_parameter_name_1390", "'{0}' is not allowed as a parameter name."), + An_import_alias_cannot_use_import_type: diag(1392, ts6.DiagnosticCategory.Error, "An_import_alias_cannot_use_import_type_1392", "An import alias cannot use 'import type'"), + Imported_via_0_from_file_1: diag(1393, ts6.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"), + Imported_via_0_from_file_1_with_packageId_2: diag(1394, ts6.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_1394", "Imported via {0} from file '{1}' with packageId '{2}'"), + Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions: diag(1395, ts6.DiagnosticCategory.Message, "Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions_1395", "Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions"), + Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions: diag(1396, ts6.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions_1396", "Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions"), + Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions: diag(1397, ts6.DiagnosticCategory.Message, "Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions_1397", "Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions"), + Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions: diag(1398, ts6.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions_1398", "Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions"), + File_is_included_via_import_here: diag(1399, ts6.DiagnosticCategory.Message, "File_is_included_via_import_here_1399", "File is included via import here."), + Referenced_via_0_from_file_1: diag(1400, ts6.DiagnosticCategory.Message, "Referenced_via_0_from_file_1_1400", "Referenced via '{0}' from file '{1}'"), + File_is_included_via_reference_here: diag(1401, ts6.DiagnosticCategory.Message, "File_is_included_via_reference_here_1401", "File is included via reference here."), + Type_library_referenced_via_0_from_file_1: diag(1402, ts6.DiagnosticCategory.Message, "Type_library_referenced_via_0_from_file_1_1402", "Type library referenced via '{0}' from file '{1}'"), + Type_library_referenced_via_0_from_file_1_with_packageId_2: diag(1403, ts6.DiagnosticCategory.Message, "Type_library_referenced_via_0_from_file_1_with_packageId_2_1403", "Type library referenced via '{0}' from file '{1}' with packageId '{2}'"), + File_is_included_via_type_library_reference_here: diag(1404, ts6.DiagnosticCategory.Message, "File_is_included_via_type_library_reference_here_1404", "File is included via type library reference here."), + Library_referenced_via_0_from_file_1: diag(1405, ts6.DiagnosticCategory.Message, "Library_referenced_via_0_from_file_1_1405", "Library referenced via '{0}' from file '{1}'"), + File_is_included_via_library_reference_here: diag(1406, ts6.DiagnosticCategory.Message, "File_is_included_via_library_reference_here_1406", "File is included via library reference here."), + Matched_by_include_pattern_0_in_1: diag(1407, ts6.DiagnosticCategory.Message, "Matched_by_include_pattern_0_in_1_1407", "Matched by include pattern '{0}' in '{1}'"), + File_is_matched_by_include_pattern_specified_here: diag(1408, ts6.DiagnosticCategory.Message, "File_is_matched_by_include_pattern_specified_here_1408", "File is matched by include pattern specified here."), + Part_of_files_list_in_tsconfig_json: diag(1409, ts6.DiagnosticCategory.Message, "Part_of_files_list_in_tsconfig_json_1409", "Part of 'files' list in tsconfig.json"), + File_is_matched_by_files_list_specified_here: diag(1410, ts6.DiagnosticCategory.Message, "File_is_matched_by_files_list_specified_here_1410", "File is matched by 'files' list specified here."), + Output_from_referenced_project_0_included_because_1_specified: diag(1411, ts6.DiagnosticCategory.Message, "Output_from_referenced_project_0_included_because_1_specified_1411", "Output from referenced project '{0}' included because '{1}' specified"), + Output_from_referenced_project_0_included_because_module_is_specified_as_none: diag(1412, ts6.DiagnosticCategory.Message, "Output_from_referenced_project_0_included_because_module_is_specified_as_none_1412", "Output from referenced project '{0}' included because '--module' is specified as 'none'"), + File_is_output_from_referenced_project_specified_here: diag(1413, ts6.DiagnosticCategory.Message, "File_is_output_from_referenced_project_specified_here_1413", "File is output from referenced project specified here."), + Source_from_referenced_project_0_included_because_1_specified: diag(1414, ts6.DiagnosticCategory.Message, "Source_from_referenced_project_0_included_because_1_specified_1414", "Source from referenced project '{0}' included because '{1}' specified"), + Source_from_referenced_project_0_included_because_module_is_specified_as_none: diag(1415, ts6.DiagnosticCategory.Message, "Source_from_referenced_project_0_included_because_module_is_specified_as_none_1415", "Source from referenced project '{0}' included because '--module' is specified as 'none'"), + File_is_source_from_referenced_project_specified_here: diag(1416, ts6.DiagnosticCategory.Message, "File_is_source_from_referenced_project_specified_here_1416", "File is source from referenced project specified here."), + Entry_point_of_type_library_0_specified_in_compilerOptions: diag(1417, ts6.DiagnosticCategory.Message, "Entry_point_of_type_library_0_specified_in_compilerOptions_1417", "Entry point of type library '{0}' specified in compilerOptions"), + Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1: diag(1418, ts6.DiagnosticCategory.Message, "Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1_1418", "Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'"), + File_is_entry_point_of_type_library_specified_here: diag(1419, ts6.DiagnosticCategory.Message, "File_is_entry_point_of_type_library_specified_here_1419", "File is entry point of type library specified here."), + Entry_point_for_implicit_type_library_0: diag(1420, ts6.DiagnosticCategory.Message, "Entry_point_for_implicit_type_library_0_1420", "Entry point for implicit type library '{0}'"), + Entry_point_for_implicit_type_library_0_with_packageId_1: diag(1421, ts6.DiagnosticCategory.Message, "Entry_point_for_implicit_type_library_0_with_packageId_1_1421", "Entry point for implicit type library '{0}' with packageId '{1}'"), + Library_0_specified_in_compilerOptions: diag(1422, ts6.DiagnosticCategory.Message, "Library_0_specified_in_compilerOptions_1422", "Library '{0}' specified in compilerOptions"), + File_is_library_specified_here: diag(1423, ts6.DiagnosticCategory.Message, "File_is_library_specified_here_1423", "File is library specified here."), + Default_library: diag(1424, ts6.DiagnosticCategory.Message, "Default_library_1424", "Default library"), + Default_library_for_target_0: diag(1425, ts6.DiagnosticCategory.Message, "Default_library_for_target_0_1425", "Default library for target '{0}'"), + File_is_default_library_for_target_specified_here: diag(1426, ts6.DiagnosticCategory.Message, "File_is_default_library_for_target_specified_here_1426", "File is default library for target specified here."), + Root_file_specified_for_compilation: diag(1427, ts6.DiagnosticCategory.Message, "Root_file_specified_for_compilation_1427", "Root file specified for compilation"), + File_is_output_of_project_reference_source_0: diag(1428, ts6.DiagnosticCategory.Message, "File_is_output_of_project_reference_source_0_1428", "File is output of project reference source '{0}'"), + File_redirects_to_file_0: diag(1429, ts6.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"), + The_file_is_in_the_program_because_Colon: diag(1430, ts6.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"), + for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts6.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."), + Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts6.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."), + Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts6.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."), + Unexpected_keyword_or_identifier: diag(1434, ts6.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."), + Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts6.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"), + Decorators_must_precede_the_name_and_all_keywords_of_property_declarations: diag(1436, ts6.DiagnosticCategory.Error, "Decorators_must_precede_the_name_and_all_keywords_of_property_declarations_1436", "Decorators must precede the name and all keywords of property declarations."), + Namespace_must_be_given_a_name: diag(1437, ts6.DiagnosticCategory.Error, "Namespace_must_be_given_a_name_1437", "Namespace must be given a name."), + Interface_must_be_given_a_name: diag(1438, ts6.DiagnosticCategory.Error, "Interface_must_be_given_a_name_1438", "Interface must be given a name."), + Type_alias_must_be_given_a_name: diag(1439, ts6.DiagnosticCategory.Error, "Type_alias_must_be_given_a_name_1439", "Type alias must be given a name."), + Variable_declaration_not_allowed_at_this_location: diag(1440, ts6.DiagnosticCategory.Error, "Variable_declaration_not_allowed_at_this_location_1440", "Variable declaration not allowed at this location."), + Cannot_start_a_function_call_in_a_type_annotation: diag(1441, ts6.DiagnosticCategory.Error, "Cannot_start_a_function_call_in_a_type_annotation_1441", "Cannot start a function call in a type annotation."), + Expected_for_property_initializer: diag(1442, ts6.DiagnosticCategory.Error, "Expected_for_property_initializer_1442", "Expected '=' for property initializer."), + Module_declaration_names_may_only_use_or_quoted_strings: diag(1443, ts6.DiagnosticCategory.Error, "Module_declaration_names_may_only_use_or_quoted_strings_1443", `Module declaration names may only use ' or " quoted strings.`), + _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1444, ts6.DiagnosticCategory.Error, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedMod_1444", "'{0}' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."), + _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1446, ts6.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."), + _0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled: diag(1448, ts6.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."), + Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts6.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."), + Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts6.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"), + Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts6.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"), + resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts6.DiagnosticCategory.Error, "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."), + resolution_mode_should_be_either_require_or_import: diag(1453, ts6.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."), + resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts6.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."), + resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts6.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."), + Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1456, ts6.DiagnosticCategory.Error, "Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456", "Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."), + Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk: diag(1457, ts6.DiagnosticCategory.Message, "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457", "Matched by default include pattern '**/*'"), + File_is_ECMAScript_module_because_0_has_field_type_with_value_module: diag(1458, ts6.DiagnosticCategory.Message, "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458", `File is ECMAScript module because '{0}' has field "type" with value "module"`), + File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, ts6.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", `File is CommonJS module because '{0}' has field "type" whose value is not "module"`), + File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts6.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", `File is CommonJS module because '{0}' does not have field "type"`), + File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts6.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"), + The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts6.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."), + Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts6.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."), + catch_or_finally_expected: diag(1472, ts6.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."), + An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts6.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."), + An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts6.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."), + Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts6.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."), + auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts6.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", '"auto": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules.'), + An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts6.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."), + Identifier_or_string_literal_expected: diag(1478, ts6.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."), + The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts6.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", `The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("{0}")' call instead.`), + To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts6.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", 'To convert this file to an ECMAScript module, change its file extension to \'{0}\' or create a local package.json file with `{ "type": "module" }`.'), + To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts6.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", `To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field \`"type": "module"\` to '{1}'.`), + To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts6.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", 'To convert this file to an ECMAScript module, add the field `"type": "module"` to \'{0}\'.'), + To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts6.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'), + The_types_of_0_are_incompatible_between_these_types: diag(2200, ts6.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."), + The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts6.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."), + Call_signature_return_types_0_and_1_are_incompatible: diag( + 2202, + ts6.DiagnosticCategory.Error, + "Call_signature_return_types_0_and_1_are_incompatible_2202", + "Call signature return types '{0}' and '{1}' are incompatible.", + /*reportsUnnecessary*/ + void 0, + /*elidedInCompatabilityPyramid*/ + true + ), + Construct_signature_return_types_0_and_1_are_incompatible: diag( + 2203, + ts6.DiagnosticCategory.Error, + "Construct_signature_return_types_0_and_1_are_incompatible_2203", + "Construct signature return types '{0}' and '{1}' are incompatible.", + /*reportsUnnecessary*/ + void 0, + /*elidedInCompatabilityPyramid*/ + true + ), + Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag( + 2204, + ts6.DiagnosticCategory.Error, + "Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2204", + "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.", + /*reportsUnnecessary*/ + void 0, + /*elidedInCompatabilityPyramid*/ + true + ), + Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag( + 2205, + ts6.DiagnosticCategory.Error, + "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", + "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", + /*reportsUnnecessary*/ + void 0, + /*elidedInCompatabilityPyramid*/ + true + ), + The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts6.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."), + The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts6.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."), + This_type_parameter_might_need_an_extends_0_constraint: diag(2208, ts6.DiagnosticCategory.Error, "This_type_parameter_might_need_an_extends_0_constraint_2208", "This type parameter might need an `extends {0}` constraint."), + The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts6.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."), + The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts6.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."), + Add_extends_constraint: diag(2211, ts6.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."), + Add_extends_constraint_to_all_type_parameters: diag(2212, ts6.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"), + Duplicate_identifier_0: diag(2300, ts6.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts6.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + Static_members_cannot_reference_class_type_parameters: diag(2302, ts6.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), + Circular_definition_of_import_alias_0: diag(2303, ts6.DiagnosticCategory.Error, "Circular_definition_of_import_alias_0_2303", "Circular definition of import alias '{0}'."), + Cannot_find_name_0: diag(2304, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_2304", "Cannot find name '{0}'."), + Module_0_has_no_exported_member_1: diag(2305, ts6.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_2305", "Module '{0}' has no exported member '{1}'."), + File_0_is_not_a_module: diag(2306, ts6.DiagnosticCategory.Error, "File_0_is_not_a_module_2306", "File '{0}' is not a module."), + Cannot_find_module_0_or_its_corresponding_type_declarations: diag(2307, ts6.DiagnosticCategory.Error, "Cannot_find_module_0_or_its_corresponding_type_declarations_2307", "Cannot find module '{0}' or its corresponding type declarations."), + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: diag(2308, ts6.DiagnosticCategory.Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."), + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: diag(2309, ts6.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."), + Type_0_recursively_references_itself_as_a_base_type: diag(2310, ts6.DiagnosticCategory.Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."), + Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function: diag(2311, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function_2311", "Cannot find name '{0}'. Did you mean to write this in an async function?"), + An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2312, ts6.DiagnosticCategory.Error, "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312", "An interface can only extend an object type or intersection of object types with statically known members."), + Type_parameter_0_has_a_circular_constraint: diag(2313, ts6.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."), + Generic_type_0_requires_1_type_argument_s: diag(2314, ts6.DiagnosticCategory.Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."), + Type_0_is_not_generic: diag(2315, ts6.DiagnosticCategory.Error, "Type_0_is_not_generic_2315", "Type '{0}' is not generic."), + Global_type_0_must_be_a_class_or_interface_type: diag(2316, ts6.DiagnosticCategory.Error, "Global_type_0_must_be_a_class_or_interface_type_2316", "Global type '{0}' must be a class or interface type."), + Global_type_0_must_have_1_type_parameter_s: diag(2317, ts6.DiagnosticCategory.Error, "Global_type_0_must_have_1_type_parameter_s_2317", "Global type '{0}' must have {1} type parameter(s)."), + Cannot_find_global_type_0: diag(2318, ts6.DiagnosticCategory.Error, "Cannot_find_global_type_0_2318", "Cannot find global type '{0}'."), + Named_property_0_of_types_1_and_2_are_not_identical: diag(2319, ts6.DiagnosticCategory.Error, "Named_property_0_of_types_1_and_2_are_not_identical_2319", "Named property '{0}' of types '{1}' and '{2}' are not identical."), + Interface_0_cannot_simultaneously_extend_types_1_and_2: diag(2320, ts6.DiagnosticCategory.Error, "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."), + Excessive_stack_depth_comparing_types_0_and_1: diag(2321, ts6.DiagnosticCategory.Error, "Excessive_stack_depth_comparing_types_0_and_1_2321", "Excessive stack depth comparing types '{0}' and '{1}'."), + Type_0_is_not_assignable_to_type_1: diag(2322, ts6.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_2322", "Type '{0}' is not assignable to type '{1}'."), + Cannot_redeclare_exported_variable_0: diag(2323, ts6.DiagnosticCategory.Error, "Cannot_redeclare_exported_variable_0_2323", "Cannot redeclare exported variable '{0}'."), + Property_0_is_missing_in_type_1: diag(2324, ts6.DiagnosticCategory.Error, "Property_0_is_missing_in_type_1_2324", "Property '{0}' is missing in type '{1}'."), + Property_0_is_private_in_type_1_but_not_in_type_2: diag(2325, ts6.DiagnosticCategory.Error, "Property_0_is_private_in_type_1_but_not_in_type_2_2325", "Property '{0}' is private in type '{1}' but not in type '{2}'."), + Types_of_property_0_are_incompatible: diag(2326, ts6.DiagnosticCategory.Error, "Types_of_property_0_are_incompatible_2326", "Types of property '{0}' are incompatible."), + Property_0_is_optional_in_type_1_but_required_in_type_2: diag(2327, ts6.DiagnosticCategory.Error, "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", "Property '{0}' is optional in type '{1}' but required in type '{2}'."), + Types_of_parameters_0_and_1_are_incompatible: diag(2328, ts6.DiagnosticCategory.Error, "Types_of_parameters_0_and_1_are_incompatible_2328", "Types of parameters '{0}' and '{1}' are incompatible."), + Index_signature_for_type_0_is_missing_in_type_1: diag(2329, ts6.DiagnosticCategory.Error, "Index_signature_for_type_0_is_missing_in_type_1_2329", "Index signature for type '{0}' is missing in type '{1}'."), + _0_and_1_index_signatures_are_incompatible: diag(2330, ts6.DiagnosticCategory.Error, "_0_and_1_index_signatures_are_incompatible_2330", "'{0}' and '{1}' index signatures are incompatible."), + this_cannot_be_referenced_in_a_module_or_namespace_body: diag(2331, ts6.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", "'this' cannot be referenced in a module or namespace body."), + this_cannot_be_referenced_in_current_location: diag(2332, ts6.DiagnosticCategory.Error, "this_cannot_be_referenced_in_current_location_2332", "'this' cannot be referenced in current location."), + this_cannot_be_referenced_in_constructor_arguments: diag(2333, ts6.DiagnosticCategory.Error, "this_cannot_be_referenced_in_constructor_arguments_2333", "'this' cannot be referenced in constructor arguments."), + this_cannot_be_referenced_in_a_static_property_initializer: diag(2334, ts6.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_static_property_initializer_2334", "'this' cannot be referenced in a static property initializer."), + super_can_only_be_referenced_in_a_derived_class: diag(2335, ts6.DiagnosticCategory.Error, "super_can_only_be_referenced_in_a_derived_class_2335", "'super' can only be referenced in a derived class."), + super_cannot_be_referenced_in_constructor_arguments: diag(2336, ts6.DiagnosticCategory.Error, "super_cannot_be_referenced_in_constructor_arguments_2336", "'super' cannot be referenced in constructor arguments."), + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: diag(2337, ts6.DiagnosticCategory.Error, "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", "Super calls are not permitted outside constructors or in nested functions inside constructors."), + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: diag(2338, ts6.DiagnosticCategory.Error, "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."), + Property_0_does_not_exist_on_type_1: diag(2339, ts6.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_2339", "Property '{0}' does not exist on type '{1}'."), + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: diag(2340, ts6.DiagnosticCategory.Error, "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", "Only public and protected methods of the base class are accessible via the 'super' keyword."), + Property_0_is_private_and_only_accessible_within_class_1: diag(2341, ts6.DiagnosticCategory.Error, "Property_0_is_private_and_only_accessible_within_class_1_2341", "Property '{0}' is private and only accessible within class '{1}'."), + This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0: diag(2343, ts6.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."), + Type_0_does_not_satisfy_the_constraint_1: diag(2344, ts6.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."), + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, ts6.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."), + Call_target_does_not_contain_any_signatures: diag(2346, ts6.DiagnosticCategory.Error, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."), + Untyped_function_calls_may_not_accept_type_arguments: diag(2347, ts6.DiagnosticCategory.Error, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."), + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, ts6.DiagnosticCategory.Error, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"), + This_expression_is_not_callable: diag(2349, ts6.DiagnosticCategory.Error, "This_expression_is_not_callable_2349", "This expression is not callable."), + Only_a_void_function_can_be_called_with_the_new_keyword: diag(2350, ts6.DiagnosticCategory.Error, "Only_a_void_function_can_be_called_with_the_new_keyword_2350", "Only a void function can be called with the 'new' keyword."), + This_expression_is_not_constructable: diag(2351, ts6.DiagnosticCategory.Error, "This_expression_is_not_constructable_2351", "This expression is not constructable."), + Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first: diag(2352, ts6.DiagnosticCategory.Error, "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352", "Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first."), + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: diag(2353, ts6.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."), + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: diag(2354, ts6.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", "This syntax requires an imported helper but module '{0}' cannot be found."), + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: diag(2355, ts6.DiagnosticCategory.Error, "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'void' nor 'any' must return a value."), + An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2356, ts6.DiagnosticCategory.Error, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."), + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts6.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts6.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts6.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), + The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), + Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts6.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts6.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts6.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), + Type_parameter_name_cannot_be_0: diag(2368, ts6.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), + A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts6.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), + A_rest_parameter_must_be_of_an_array_type: diag(2370, ts6.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: diag(2371, ts6.DiagnosticCategory.Error, "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", "A parameter initializer is only allowed in a function or constructor implementation."), + Parameter_0_cannot_reference_itself: diag(2372, ts6.DiagnosticCategory.Error, "Parameter_0_cannot_reference_itself_2372", "Parameter '{0}' cannot reference itself."), + Parameter_0_cannot_reference_identifier_1_declared_after_it: diag(2373, ts6.DiagnosticCategory.Error, "Parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Parameter '{0}' cannot reference identifier '{1}' declared after it."), + Duplicate_index_signature_for_type_0: diag(2374, ts6.DiagnosticCategory.Error, "Duplicate_index_signature_for_type_0_2374", "Duplicate index signature for type '{0}'."), + Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2375, ts6.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."), + A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2376, ts6.DiagnosticCategory.Error, "A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_2376", "A 'super' call must be the first statement in the constructor to refer to 'super' or 'this' when a derived class contains initialized properties, parameter properties, or private identifiers."), + Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, ts6.DiagnosticCategory.Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."), + A_get_accessor_must_return_a_value: diag(2378, ts6.DiagnosticCategory.Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."), + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, ts6.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."), + The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, ts6.DiagnosticCategory.Error, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"), + Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, ts6.DiagnosticCategory.Error, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."), + Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, ts6.DiagnosticCategory.Error, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."), + Overload_signatures_must_all_be_public_private_or_protected: diag(2385, ts6.DiagnosticCategory.Error, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."), + Overload_signatures_must_all_be_optional_or_required: diag(2386, ts6.DiagnosticCategory.Error, "Overload_signatures_must_all_be_optional_or_required_2386", "Overload signatures must all be optional or required."), + Function_overload_must_be_static: diag(2387, ts6.DiagnosticCategory.Error, "Function_overload_must_be_static_2387", "Function overload must be static."), + Function_overload_must_not_be_static: diag(2388, ts6.DiagnosticCategory.Error, "Function_overload_must_not_be_static_2388", "Function overload must not be static."), + Function_implementation_name_must_be_0: diag(2389, ts6.DiagnosticCategory.Error, "Function_implementation_name_must_be_0_2389", "Function implementation name must be '{0}'."), + Constructor_implementation_is_missing: diag(2390, ts6.DiagnosticCategory.Error, "Constructor_implementation_is_missing_2390", "Constructor implementation is missing."), + Function_implementation_is_missing_or_not_immediately_following_the_declaration: diag(2391, ts6.DiagnosticCategory.Error, "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", "Function implementation is missing or not immediately following the declaration."), + Multiple_constructor_implementations_are_not_allowed: diag(2392, ts6.DiagnosticCategory.Error, "Multiple_constructor_implementations_are_not_allowed_2392", "Multiple constructor implementations are not allowed."), + Duplicate_function_implementation: diag(2393, ts6.DiagnosticCategory.Error, "Duplicate_function_implementation_2393", "Duplicate function implementation."), + This_overload_signature_is_not_compatible_with_its_implementation_signature: diag(2394, ts6.DiagnosticCategory.Error, "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394", "This overload signature is not compatible with its implementation signature."), + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: diag(2395, ts6.DiagnosticCategory.Error, "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", "Individual declarations in merged declaration '{0}' must be all exported or all local."), + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: diag(2396, ts6.DiagnosticCategory.Error, "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."), + Declaration_name_conflicts_with_built_in_global_identifier_0: diag(2397, ts6.DiagnosticCategory.Error, "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", "Declaration name conflicts with built-in global identifier '{0}'."), + constructor_cannot_be_used_as_a_parameter_property_name: diag(2398, ts6.DiagnosticCategory.Error, "constructor_cannot_be_used_as_a_parameter_property_name_2398", "'constructor' cannot be used as a parameter property name."), + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: diag(2399, ts6.DiagnosticCategory.Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."), + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: diag(2400, ts6.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."), + A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2401, ts6.DiagnosticCategory.Error, "A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_in_2401", "A 'super' call must be a root-level statement within a constructor of a derived class that contains initialized properties, parameter properties, or private identifiers."), + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: diag(2402, ts6.DiagnosticCategory.Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."), + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: diag(2403, ts6.DiagnosticCategory.Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."), + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), + The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts6.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."), + Setters_cannot_return_a_value: diag(2408, ts6.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts6.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), + The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts6.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), + Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target: diag(2412, ts6.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target."), + Property_0_of_type_1_is_not_assignable_to_2_index_type_3: diag(2411, ts6.DiagnosticCategory.Error, "Property_0_of_type_1_is_not_assignable_to_2_index_type_3_2411", "Property '{0}' of type '{1}' is not assignable to '{2}' index type '{3}'."), + _0_index_type_1_is_not_assignable_to_2_index_type_3: diag(2413, ts6.DiagnosticCategory.Error, "_0_index_type_1_is_not_assignable_to_2_index_type_3_2413", "'{0}' index type '{1}' is not assignable to '{2}' index type '{3}'."), + Class_name_cannot_be_0: diag(2414, ts6.DiagnosticCategory.Error, "Class_name_cannot_be_0_2414", "Class name cannot be '{0}'."), + Class_0_incorrectly_extends_base_class_1: diag(2415, ts6.DiagnosticCategory.Error, "Class_0_incorrectly_extends_base_class_1_2415", "Class '{0}' incorrectly extends base class '{1}'."), + Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2: diag(2416, ts6.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2_2416", "Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'."), + Class_static_side_0_incorrectly_extends_base_class_static_side_1: diag(2417, ts6.DiagnosticCategory.Error, "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", "Class static side '{0}' incorrectly extends base class static side '{1}'."), + Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1: diag(2418, ts6.DiagnosticCategory.Error, "Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418", "Type of computed property's value is '{0}', which is not assignable to type '{1}'."), + Types_of_construct_signatures_are_incompatible: diag(2419, ts6.DiagnosticCategory.Error, "Types_of_construct_signatures_are_incompatible_2419", "Types of construct signatures are incompatible."), + Class_0_incorrectly_implements_interface_1: diag(2420, ts6.DiagnosticCategory.Error, "Class_0_incorrectly_implements_interface_1_2420", "Class '{0}' incorrectly implements interface '{1}'."), + A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2422, ts6.DiagnosticCategory.Error, "A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_memb_2422", "A class can only implement an object type or intersection of object types with statically known members."), + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: diag(2423, ts6.DiagnosticCategory.Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."), + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2425, ts6.DiagnosticCategory.Error, "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."), + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2426, ts6.DiagnosticCategory.Error, "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."), + Interface_name_cannot_be_0: diag(2427, ts6.DiagnosticCategory.Error, "Interface_name_cannot_be_0_2427", "Interface name cannot be '{0}'."), + All_declarations_of_0_must_have_identical_type_parameters: diag(2428, ts6.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_type_parameters_2428", "All declarations of '{0}' must have identical type parameters."), + Interface_0_incorrectly_extends_interface_1: diag(2430, ts6.DiagnosticCategory.Error, "Interface_0_incorrectly_extends_interface_1_2430", "Interface '{0}' incorrectly extends interface '{1}'."), + Enum_name_cannot_be_0: diag(2431, ts6.DiagnosticCategory.Error, "Enum_name_cannot_be_0_2431", "Enum name cannot be '{0}'."), + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: diag(2432, ts6.DiagnosticCategory.Error, "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."), + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: diag(2433, ts6.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", "A namespace declaration cannot be in a different file from a class or function with which it is merged."), + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: diag(2434, ts6.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", "A namespace declaration cannot be located prior to a class or function with which it is merged."), + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: diag(2435, ts6.DiagnosticCategory.Error, "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", "Ambient modules cannot be nested in other modules or namespaces."), + Ambient_module_declaration_cannot_specify_relative_module_name: diag(2436, ts6.DiagnosticCategory.Error, "Ambient_module_declaration_cannot_specify_relative_module_name_2436", "Ambient module declaration cannot specify relative module name."), + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: diag(2437, ts6.DiagnosticCategory.Error, "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", "Module '{0}' is hidden by a local declaration with the same name."), + Import_name_cannot_be_0: diag(2438, ts6.DiagnosticCategory.Error, "Import_name_cannot_be_0_2438", "Import name cannot be '{0}'."), + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: diag(2439, ts6.DiagnosticCategory.Error, "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", "Import or export declaration in an ambient module declaration cannot reference module through relative module name."), + Import_declaration_conflicts_with_local_declaration_of_0: diag(2440, ts6.DiagnosticCategory.Error, "Import_declaration_conflicts_with_local_declaration_of_0_2440", "Import declaration conflicts with local declaration of '{0}'."), + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: diag(2441, ts6.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."), + Types_have_separate_declarations_of_a_private_property_0: diag(2442, ts6.DiagnosticCategory.Error, "Types_have_separate_declarations_of_a_private_property_0_2442", "Types have separate declarations of a private property '{0}'."), + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: diag(2443, ts6.DiagnosticCategory.Error, "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."), + Property_0_is_protected_in_type_1_but_public_in_type_2: diag(2444, ts6.DiagnosticCategory.Error, "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", "Property '{0}' is protected in type '{1}' but public in type '{2}'."), + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: diag(2445, ts6.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", "Property '{0}' is protected and only accessible within class '{1}' and its subclasses."), + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2: diag(2446, ts6.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_cl_2446", "Property '{0}' is protected and only accessible through an instance of class '{1}'. This is an instance of class '{2}'."), + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: diag(2447, ts6.DiagnosticCategory.Error, "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."), + Block_scoped_variable_0_used_before_its_declaration: diag(2448, ts6.DiagnosticCategory.Error, "Block_scoped_variable_0_used_before_its_declaration_2448", "Block-scoped variable '{0}' used before its declaration."), + Class_0_used_before_its_declaration: diag(2449, ts6.DiagnosticCategory.Error, "Class_0_used_before_its_declaration_2449", "Class '{0}' used before its declaration."), + Enum_0_used_before_its_declaration: diag(2450, ts6.DiagnosticCategory.Error, "Enum_0_used_before_its_declaration_2450", "Enum '{0}' used before its declaration."), + Cannot_redeclare_block_scoped_variable_0: diag(2451, ts6.DiagnosticCategory.Error, "Cannot_redeclare_block_scoped_variable_0_2451", "Cannot redeclare block-scoped variable '{0}'."), + An_enum_member_cannot_have_a_numeric_name: diag(2452, ts6.DiagnosticCategory.Error, "An_enum_member_cannot_have_a_numeric_name_2452", "An enum member cannot have a numeric name."), + Variable_0_is_used_before_being_assigned: diag(2454, ts6.DiagnosticCategory.Error, "Variable_0_is_used_before_being_assigned_2454", "Variable '{0}' is used before being assigned."), + Type_alias_0_circularly_references_itself: diag(2456, ts6.DiagnosticCategory.Error, "Type_alias_0_circularly_references_itself_2456", "Type alias '{0}' circularly references itself."), + Type_alias_name_cannot_be_0: diag(2457, ts6.DiagnosticCategory.Error, "Type_alias_name_cannot_be_0_2457", "Type alias name cannot be '{0}'."), + An_AMD_module_cannot_have_multiple_name_assignments: diag(2458, ts6.DiagnosticCategory.Error, "An_AMD_module_cannot_have_multiple_name_assignments_2458", "An AMD module cannot have multiple name assignments."), + Module_0_declares_1_locally_but_it_is_not_exported: diag(2459, ts6.DiagnosticCategory.Error, "Module_0_declares_1_locally_but_it_is_not_exported_2459", "Module '{0}' declares '{1}' locally, but it is not exported."), + Module_0_declares_1_locally_but_it_is_exported_as_2: diag(2460, ts6.DiagnosticCategory.Error, "Module_0_declares_1_locally_but_it_is_exported_as_2_2460", "Module '{0}' declares '{1}' locally, but it is exported as '{2}'."), + Type_0_is_not_an_array_type: diag(2461, ts6.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_2461", "Type '{0}' is not an array type."), + A_rest_element_must_be_last_in_a_destructuring_pattern: diag(2462, ts6.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", "A rest element must be last in a destructuring pattern."), + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: diag(2463, ts6.DiagnosticCategory.Error, "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", "A binding pattern parameter cannot be optional in an implementation signature."), + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: diag(2464, ts6.DiagnosticCategory.Error, "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", "A computed property name must be of type 'string', 'number', 'symbol', or 'any'."), + this_cannot_be_referenced_in_a_computed_property_name: diag(2465, ts6.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_computed_property_name_2465", "'this' cannot be referenced in a computed property name."), + super_cannot_be_referenced_in_a_computed_property_name: diag(2466, ts6.DiagnosticCategory.Error, "super_cannot_be_referenced_in_a_computed_property_name_2466", "'super' cannot be referenced in a computed property name."), + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: diag(2467, ts6.DiagnosticCategory.Error, "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", "A computed property name cannot reference a type parameter from its containing type."), + Cannot_find_global_value_0: diag(2468, ts6.DiagnosticCategory.Error, "Cannot_find_global_value_0_2468", "Cannot find global value '{0}'."), + The_0_operator_cannot_be_applied_to_type_symbol: diag(2469, ts6.DiagnosticCategory.Error, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."), + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: diag(2472, ts6.DiagnosticCategory.Error, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."), + Enum_declarations_must_all_be_const_or_non_const: diag(2473, ts6.DiagnosticCategory.Error, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."), + const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values: diag(2474, ts6.DiagnosticCategory.Error, "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474", "const enum member initializers can only contain literal values and other computed enum values."), + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query: diag(2475, ts6.DiagnosticCategory.Error, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."), + A_const_enum_member_can_only_be_accessed_using_a_string_literal: diag(2476, ts6.DiagnosticCategory.Error, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."), + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: diag(2477, ts6.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."), + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: diag(2478, ts6.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", "'const' enum member initializer was evaluated to disallowed value 'NaN'."), + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: diag(2480, ts6.DiagnosticCategory.Error, "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", "'let' is not allowed to be used as a name in 'let' or 'const' declarations."), + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: diag(2481, ts6.DiagnosticCategory.Error, "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."), + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), + Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts6.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), + The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), + Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts6.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."), + An_iterator_must_have_a_next_method: diag(2489, ts6.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), + The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property: diag(2490, ts6.DiagnosticCategory.Error, "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the '{0}()' method of an iterator must have a 'value' property."), + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), + Cannot_redeclare_identifier_0_in_catch_clause: diag(2492, ts6.DiagnosticCategory.Error, "Cannot_redeclare_identifier_0_in_catch_clause_2492", "Cannot redeclare identifier '{0}' in catch clause."), + Tuple_type_0_of_length_1_has_no_element_at_index_2: diag(2493, ts6.DiagnosticCategory.Error, "Tuple_type_0_of_length_1_has_no_element_at_index_2_2493", "Tuple type '{0}' of length '{1}' has no element at index '{2}'."), + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: diag(2494, ts6.DiagnosticCategory.Error, "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."), + Type_0_is_not_an_array_type_or_a_string_type: diag(2495, ts6.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_2495", "Type '{0}' is not an array type or a string type."), + The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: diag(2496, ts6.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."), + This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export: diag(2497, ts6.DiagnosticCategory.Error, "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497", "This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export."), + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: diag(2498, ts6.DiagnosticCategory.Error, "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", "Module '{0}' uses 'export =' and cannot be used with 'export *'."), + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2499, ts6.DiagnosticCategory.Error, "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", "An interface can only extend an identifier/qualified-name with optional type arguments."), + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2500, ts6.DiagnosticCategory.Error, "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", "A class can only implement an identifier/qualified-name with optional type arguments."), + A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts6.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts6.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), + Cannot_find_namespace_0: diag(2503, ts6.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), + Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts6.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + A_generator_cannot_have_a_void_type_annotation: diag(2505, ts6.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), + _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts6.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), + Type_0_is_not_a_constructor_function_type: diag(2507, ts6.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), + No_base_constructor_has_the_specified_number_of_type_arguments: diag(2508, ts6.DiagnosticCategory.Error, "No_base_constructor_has_the_specified_number_of_type_arguments_2508", "No base constructor has the specified number of type arguments."), + Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2509, ts6.DiagnosticCategory.Error, "Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509", "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members."), + Base_constructors_must_all_have_the_same_return_type: diag(2510, ts6.DiagnosticCategory.Error, "Base_constructors_must_all_have_the_same_return_type_2510", "Base constructors must all have the same return type."), + Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts6.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."), + Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts6.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."), + Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts6.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."), + A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, ts6.DiagnosticCategory.Error, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."), + Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts6.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."), + All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts6.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."), + Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts6.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."), + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, ts6.DiagnosticCategory.Error, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."), + An_async_iterator_must_have_a_next_method: diag(2519, ts6.DiagnosticCategory.Error, "An_async_iterator_must_have_a_next_method_2519", "An async iterator must have a 'next()' method."), + Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: diag(2520, ts6.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."), + The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: diag(2522, ts6.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."), + yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, ts6.DiagnosticCategory.Error, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."), + await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, ts6.DiagnosticCategory.Error, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."), + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, ts6.DiagnosticCategory.Error, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."), + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, ts6.DiagnosticCategory.Error, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."), + The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: diag(2527, ts6.DiagnosticCategory.Error, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."), + A_module_cannot_have_multiple_default_exports: diag(2528, ts6.DiagnosticCategory.Error, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."), + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: diag(2529, ts6.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."), + Property_0_is_incompatible_with_index_signature: diag(2530, ts6.DiagnosticCategory.Error, "Property_0_is_incompatible_with_index_signature_2530", "Property '{0}' is incompatible with index signature."), + Object_is_possibly_null: diag(2531, ts6.DiagnosticCategory.Error, "Object_is_possibly_null_2531", "Object is possibly 'null'."), + Object_is_possibly_undefined: diag(2532, ts6.DiagnosticCategory.Error, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."), + Object_is_possibly_null_or_undefined: diag(2533, ts6.DiagnosticCategory.Error, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."), + A_function_returning_never_cannot_have_a_reachable_end_point: diag(2534, ts6.DiagnosticCategory.Error, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."), + Enum_type_0_has_members_with_initializers_that_are_not_literals: diag(2535, ts6.DiagnosticCategory.Error, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."), + Type_0_cannot_be_used_to_index_type_1: diag(2536, ts6.DiagnosticCategory.Error, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."), + Type_0_has_no_matching_index_signature_for_type_1: diag(2537, ts6.DiagnosticCategory.Error, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."), + Type_0_cannot_be_used_as_an_index_type: diag(2538, ts6.DiagnosticCategory.Error, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."), + Cannot_assign_to_0_because_it_is_not_a_variable: diag(2539, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_not_a_variable_2539", "Cannot assign to '{0}' because it is not a variable."), + Cannot_assign_to_0_because_it_is_a_read_only_property: diag(2540, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_read_only_property_2540", "Cannot assign to '{0}' because it is a read-only property."), + Index_signature_in_type_0_only_permits_reading: diag(2542, ts6.DiagnosticCategory.Error, "Index_signature_in_type_0_only_permits_reading_2542", "Index signature in type '{0}' only permits reading."), + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: diag(2543, ts6.DiagnosticCategory.Error, "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."), + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: diag(2544, ts6.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."), + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: diag(2545, ts6.DiagnosticCategory.Error, "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", "A mixin class must have a constructor with a single rest parameter of type 'any[]'."), + The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: diag(2547, ts6.DiagnosticCategory.Error, "The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_pro_2547", "The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property."), + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2548, ts6.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2549, ts6.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."), + Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later: diag(2550, ts6.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_c_2550", "Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{2}' or later."), + Property_0_does_not_exist_on_type_1_Did_you_mean_2: diag(2551, ts6.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551", "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"), + Cannot_find_name_0_Did_you_mean_1: diag(2552, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_1_2552", "Cannot find name '{0}'. Did you mean '{1}'?"), + Computed_values_are_not_permitted_in_an_enum_with_string_valued_members: diag(2553, ts6.DiagnosticCategory.Error, "Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553", "Computed values are not permitted in an enum with string valued members."), + Expected_0_arguments_but_got_1: diag(2554, ts6.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_2554", "Expected {0} arguments, but got {1}."), + Expected_at_least_0_arguments_but_got_1: diag(2555, ts6.DiagnosticCategory.Error, "Expected_at_least_0_arguments_but_got_1_2555", "Expected at least {0} arguments, but got {1}."), + A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter: diag(2556, ts6.DiagnosticCategory.Error, "A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter_2556", "A spread argument must either have a tuple type or be passed to a rest parameter."), + Expected_0_type_arguments_but_got_1: diag(2558, ts6.DiagnosticCategory.Error, "Expected_0_type_arguments_but_got_1_2558", "Expected {0} type arguments, but got {1}."), + Type_0_has_no_properties_in_common_with_type_1: diag(2559, ts6.DiagnosticCategory.Error, "Type_0_has_no_properties_in_common_with_type_1_2559", "Type '{0}' has no properties in common with type '{1}'."), + Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it: diag(2560, ts6.DiagnosticCategory.Error, "Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560", "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"), + Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2: diag(2561, ts6.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561", "Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?"), + Base_class_expressions_cannot_reference_class_type_parameters: diag(2562, ts6.DiagnosticCategory.Error, "Base_class_expressions_cannot_reference_class_type_parameters_2562", "Base class expressions cannot reference class type parameters."), + The_containing_function_or_module_body_is_too_large_for_control_flow_analysis: diag(2563, ts6.DiagnosticCategory.Error, "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563", "The containing function or module body is too large for control flow analysis."), + Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: diag(2564, ts6.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor_2564", "Property '{0}' has no initializer and is not definitely assigned in the constructor."), + Property_0_is_used_before_being_assigned: diag(2565, ts6.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."), + A_rest_element_cannot_have_a_property_name: diag(2566, ts6.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."), + Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts6.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."), + Property_0_may_not_exist_on_type_1_Did_you_mean_2: diag(2568, ts6.DiagnosticCategory.Error, "Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568", "Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"), + Could_not_find_name_0_Did_you_mean_1: diag(2570, ts6.DiagnosticCategory.Error, "Could_not_find_name_0_Did_you_mean_1_2570", "Could not find name '{0}'. Did you mean '{1}'?"), + Object_is_of_type_unknown: diag(2571, ts6.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."), + A_rest_element_type_must_be_an_array_type: diag(2574, ts6.DiagnosticCategory.Error, "A_rest_element_type_must_be_an_array_type_2574", "A rest element type must be an array type."), + No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments: diag(2575, ts6.DiagnosticCategory.Error, "No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments_2575", "No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments."), + Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead: diag(2576, ts6.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead_2576", "Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?"), + Return_type_annotation_circularly_references_itself: diag(2577, ts6.DiagnosticCategory.Error, "Return_type_annotation_circularly_references_itself_2577", "Return type annotation circularly references itself."), + Unused_ts_expect_error_directive: diag(2578, ts6.DiagnosticCategory.Error, "Unused_ts_expect_error_directive_2578", "Unused '@ts-expect-error' directive."), + Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode: diag(2580, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."), + Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery: diag(2581, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`."), + Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha: diag(2582, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2582", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`."), + Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later: diag(2583, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2583", "Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{1}' or later."), + Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'."), + _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts6.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later."), + Cannot_assign_to_0_because_it_is_a_constant: diag(2588, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_constant_2588", "Cannot assign to '{0}' because it is a constant."), + Type_instantiation_is_excessively_deep_and_possibly_infinite: diag(2589, ts6.DiagnosticCategory.Error, "Type_instantiation_is_excessively_deep_and_possibly_infinite_2589", "Type instantiation is excessively deep and possibly infinite."), + Expression_produces_a_union_type_that_is_too_complex_to_represent: diag(2590, ts6.DiagnosticCategory.Error, "Expression_produces_a_union_type_that_is_too_complex_to_represent_2590", "Expression produces a union type that is too complex to represent."), + Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."), + Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."), + Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."), + This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts6.DiagnosticCategory.Error, "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594", "This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag."), + _0_can_only_be_imported_by_using_a_default_import: diag(2595, ts6.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."), + _0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2596, ts6.DiagnosticCategory.Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."), + _0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import: diag(2597, ts6.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."), + _0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2598, ts6.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using__2598", "'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import."), + JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts6.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), + Property_0_in_type_1_is_not_assignable_to_type_2: diag(2603, ts6.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_type_2_2603", "Property '{0}' in type '{1}' is not assignable to type '{2}'."), + JSX_element_type_0_does_not_have_any_construct_or_call_signatures: diag(2604, ts6.DiagnosticCategory.Error, "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", "JSX element type '{0}' does not have any construct or call signatures."), + Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: diag(2606, ts6.DiagnosticCategory.Error, "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", "Property '{0}' of JSX spread attribute is not assignable to target property."), + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: diag(2607, ts6.DiagnosticCategory.Error, "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", "JSX element class does not support attributes because it does not have a '{0}' property."), + The_global_type_JSX_0_may_not_have_more_than_one_property: diag(2608, ts6.DiagnosticCategory.Error, "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", "The global type 'JSX.{0}' may not have more than one property."), + JSX_spread_child_must_be_an_array_type: diag(2609, ts6.DiagnosticCategory.Error, "JSX_spread_child_must_be_an_array_type_2609", "JSX spread child must be an array type."), + _0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property: diag(2610, ts6.DiagnosticCategory.Error, "_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610", "'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property."), + _0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor: diag(2611, ts6.DiagnosticCategory.Error, "_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor_2611", "'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor."), + Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration: diag(2612, ts6.DiagnosticCategory.Error, "Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_2612", "Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration."), + Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead: diag(2613, ts6.DiagnosticCategory.Error, "Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead_2613", "Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?"), + Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead: diag(2614, ts6.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614", "Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?"), + Type_of_property_0_circularly_references_itself_in_mapped_type_1: diag(2615, ts6.DiagnosticCategory.Error, "Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615", "Type of property '{0}' circularly references itself in mapped type '{1}'."), + _0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import: diag(2616, ts6.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import_2616", "'{0}' can only be imported by using 'import {1} = require({2})' or a default import."), + _0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2617, ts6.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_us_2617", "'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import."), + Source_has_0_element_s_but_target_requires_1: diag(2618, ts6.DiagnosticCategory.Error, "Source_has_0_element_s_but_target_requires_1_2618", "Source has {0} element(s) but target requires {1}."), + Source_has_0_element_s_but_target_allows_only_1: diag(2619, ts6.DiagnosticCategory.Error, "Source_has_0_element_s_but_target_allows_only_1_2619", "Source has {0} element(s) but target allows only {1}."), + Target_requires_0_element_s_but_source_may_have_fewer: diag(2620, ts6.DiagnosticCategory.Error, "Target_requires_0_element_s_but_source_may_have_fewer_2620", "Target requires {0} element(s) but source may have fewer."), + Target_allows_only_0_element_s_but_source_may_have_more: diag(2621, ts6.DiagnosticCategory.Error, "Target_allows_only_0_element_s_but_source_may_have_more_2621", "Target allows only {0} element(s) but source may have more."), + Source_provides_no_match_for_required_element_at_position_0_in_target: diag(2623, ts6.DiagnosticCategory.Error, "Source_provides_no_match_for_required_element_at_position_0_in_target_2623", "Source provides no match for required element at position {0} in target."), + Source_provides_no_match_for_variadic_element_at_position_0_in_target: diag(2624, ts6.DiagnosticCategory.Error, "Source_provides_no_match_for_variadic_element_at_position_0_in_target_2624", "Source provides no match for variadic element at position {0} in target."), + Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target: diag(2625, ts6.DiagnosticCategory.Error, "Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target_2625", "Variadic element at position {0} in source does not match element at position {1} in target."), + Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target: diag(2626, ts6.DiagnosticCategory.Error, "Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target_2626", "Type at position {0} in source is not compatible with type at position {1} in target."), + Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target: diag(2627, ts6.DiagnosticCategory.Error, "Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target_2627", "Type at positions {0} through {1} in source is not compatible with type at position {2} in target."), + Cannot_assign_to_0_because_it_is_an_enum: diag(2628, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_enum_2628", "Cannot assign to '{0}' because it is an enum."), + Cannot_assign_to_0_because_it_is_a_class: diag(2629, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_class_2629", "Cannot assign to '{0}' because it is a class."), + Cannot_assign_to_0_because_it_is_a_function: diag(2630, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_function_2630", "Cannot assign to '{0}' because it is a function."), + Cannot_assign_to_0_because_it_is_a_namespace: diag(2631, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_namespace_2631", "Cannot assign to '{0}' because it is a namespace."), + Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts6.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."), + JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts6.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"), + _0_index_signatures_are_incompatible: diag(2634, ts6.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."), + Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts6.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), + Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts6.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), + Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts6.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts6.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts6.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), + A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts6.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts6.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, ts6.DiagnosticCategory.Error, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."), + JSX_expressions_must_have_one_parent_element: diag(2657, ts6.DiagnosticCategory.Error, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."), + Type_0_provides_no_match_for_the_signature_1: diag(2658, ts6.DiagnosticCategory.Error, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."), + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, ts6.DiagnosticCategory.Error, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."), + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: diag(2660, ts6.DiagnosticCategory.Error, "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", "'super' can only be referenced in members of derived classes or object literal expressions."), + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: diag(2661, ts6.DiagnosticCategory.Error, "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", "Cannot export '{0}'. Only local declarations can be exported from a module."), + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: diag(2662, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"), + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: diag(2663, ts6.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"), + Invalid_module_name_in_augmentation_module_0_cannot_be_found: diag(2664, ts6.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", "Invalid module name in augmentation, module '{0}' cannot be found."), + Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: diag(2665, ts6.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."), + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: diag(2666, ts6.DiagnosticCategory.Error, "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", "Exports and export assignments are not permitted in module augmentations."), + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: diag(2667, ts6.DiagnosticCategory.Error, "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."), + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: diag(2668, ts6.DiagnosticCategory.Error, "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."), + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: diag(2669, ts6.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."), + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: diag(2670, ts6.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."), + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: diag(2671, ts6.DiagnosticCategory.Error, "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", "Cannot augment module '{0}' because it resolves to a non-module entity."), + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: diag(2672, ts6.DiagnosticCategory.Error, "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", "Cannot assign a '{0}' constructor type to a '{1}' constructor type."), + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: diag(2673, ts6.DiagnosticCategory.Error, "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", "Constructor of class '{0}' is private and only accessible within the class declaration."), + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: diag(2674, ts6.DiagnosticCategory.Error, "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", "Constructor of class '{0}' is protected and only accessible within the class declaration."), + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: diag(2675, ts6.DiagnosticCategory.Error, "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", "Cannot extend a class '{0}'. Class constructor is marked as private."), + Accessors_must_both_be_abstract_or_non_abstract: diag(2676, ts6.DiagnosticCategory.Error, "Accessors_must_both_be_abstract_or_non_abstract_2676", "Accessors must both be abstract or non-abstract."), + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: diag(2677, ts6.DiagnosticCategory.Error, "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", "A type predicate's type must be assignable to its parameter's type."), + Type_0_is_not_comparable_to_type_1: diag(2678, ts6.DiagnosticCategory.Error, "Type_0_is_not_comparable_to_type_1_2678", "Type '{0}' is not comparable to type '{1}'."), + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: diag(2679, ts6.DiagnosticCategory.Error, "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."), + A_0_parameter_must_be_the_first_parameter: diag(2680, ts6.DiagnosticCategory.Error, "A_0_parameter_must_be_the_first_parameter_2680", "A '{0}' parameter must be the first parameter."), + A_constructor_cannot_have_a_this_parameter: diag(2681, ts6.DiagnosticCategory.Error, "A_constructor_cannot_have_a_this_parameter_2681", "A constructor cannot have a 'this' parameter."), + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: diag(2683, ts6.DiagnosticCategory.Error, "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", "'this' implicitly has type 'any' because it does not have a type annotation."), + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: diag(2684, ts6.DiagnosticCategory.Error, "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."), + The_this_types_of_each_signature_are_incompatible: diag(2685, ts6.DiagnosticCategory.Error, "The_this_types_of_each_signature_are_incompatible_2685", "The 'this' types of each signature are incompatible."), + _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: diag(2686, ts6.DiagnosticCategory.Error, "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."), + All_declarations_of_0_must_have_identical_modifiers: diag(2687, ts6.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_modifiers_2687", "All declarations of '{0}' must have identical modifiers."), + Cannot_find_type_definition_file_for_0: diag(2688, ts6.DiagnosticCategory.Error, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."), + Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, ts6.DiagnosticCategory.Error, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"), + _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, ts6.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"), + An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, ts6.DiagnosticCategory.Error, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."), + _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts6.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."), + _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts6.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."), + Namespace_0_has_no_exported_member_1: diag(2694, ts6.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."), + Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag( + 2695, + ts6.DiagnosticCategory.Error, + "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", + "Left side of comma operator is unused and has no side effects.", + /*reportsUnnecessary*/ + true + ), + The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts6.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"), + An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts6.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."), + Spread_types_may_only_be_created_from_object_types: diag(2698, ts6.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."), + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: diag(2699, ts6.DiagnosticCategory.Error, "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."), + Rest_types_may_only_be_created_from_object_types: diag(2700, ts6.DiagnosticCategory.Error, "Rest_types_may_only_be_created_from_object_types_2700", "Rest types may only be created from object types."), + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: diag(2701, ts6.DiagnosticCategory.Error, "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", "The target of an object rest assignment must be a variable or a property access."), + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: diag(2702, ts6.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", "'{0}' only refers to a type, but is being used as a namespace here."), + The_operand_of_a_delete_operator_must_be_a_property_reference: diag(2703, ts6.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", "The operand of a 'delete' operator must be a property reference."), + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: diag(2704, ts6.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", "The operand of a 'delete' operator cannot be a read-only property."), + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2705, ts6.DiagnosticCategory.Error, "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."), + Required_type_parameters_may_not_follow_optional_type_parameters: diag(2706, ts6.DiagnosticCategory.Error, "Required_type_parameters_may_not_follow_optional_type_parameters_2706", "Required type parameters may not follow optional type parameters."), + Generic_type_0_requires_between_1_and_2_type_arguments: diag(2707, ts6.DiagnosticCategory.Error, "Generic_type_0_requires_between_1_and_2_type_arguments_2707", "Generic type '{0}' requires between {1} and {2} type arguments."), + Cannot_use_namespace_0_as_a_value: diag(2708, ts6.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_value_2708", "Cannot use namespace '{0}' as a value."), + Cannot_use_namespace_0_as_a_type: diag(2709, ts6.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_type_2709", "Cannot use namespace '{0}' as a type."), + _0_are_specified_twice_The_attribute_named_0_will_be_overwritten: diag(2710, ts6.DiagnosticCategory.Error, "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710", "'{0}' are specified twice. The attribute named '{0}' will be overwritten."), + A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2711, ts6.DiagnosticCategory.Error, "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711", "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."), + A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2712, ts6.DiagnosticCategory.Error, "A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712", "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."), + Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1: diag(2713, ts6.DiagnosticCategory.Error, "Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713", `Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}["{1}"]'?`), + The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context: diag(2714, ts6.DiagnosticCategory.Error, "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714", "The expression of an export assignment must be an identifier or qualified name in an ambient context."), + Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor: diag(2715, ts6.DiagnosticCategory.Error, "Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor_2715", "Abstract property '{0}' in class '{1}' cannot be accessed in the constructor."), + Type_parameter_0_has_a_circular_default: diag(2716, ts6.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_default_2716", "Type parameter '{0}' has a circular default."), + Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2: diag(2717, ts6.DiagnosticCategory.Error, "Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717", "Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'."), + Duplicate_property_0: diag(2718, ts6.DiagnosticCategory.Error, "Duplicate_property_0_2718", "Duplicate property '{0}'."), + Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: diag(2719, ts6.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719", "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."), + Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass: diag(2720, ts6.DiagnosticCategory.Error, "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720", "Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?"), + Cannot_invoke_an_object_which_is_possibly_null: diag(2721, ts6.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_null_2721", "Cannot invoke an object which is possibly 'null'."), + Cannot_invoke_an_object_which_is_possibly_undefined: diag(2722, ts6.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_undefined_2722", "Cannot invoke an object which is possibly 'undefined'."), + Cannot_invoke_an_object_which_is_possibly_null_or_undefined: diag(2723, ts6.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723", "Cannot invoke an object which is possibly 'null' or 'undefined'."), + _0_has_no_exported_member_named_1_Did_you_mean_2: diag(2724, ts6.DiagnosticCategory.Error, "_0_has_no_exported_member_named_1_Did_you_mean_2_2724", "'{0}' has no exported member named '{1}'. Did you mean '{2}'?"), + Class_name_cannot_be_Object_when_targeting_ES5_with_module_0: diag(2725, ts6.DiagnosticCategory.Error, "Class_name_cannot_be_Object_when_targeting_ES5_with_module_0_2725", "Class name cannot be 'Object' when targeting ES5 with module {0}."), + Cannot_find_lib_definition_for_0: diag(2726, ts6.DiagnosticCategory.Error, "Cannot_find_lib_definition_for_0_2726", "Cannot find lib definition for '{0}'."), + Cannot_find_lib_definition_for_0_Did_you_mean_1: diag(2727, ts6.DiagnosticCategory.Error, "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727", "Cannot find lib definition for '{0}'. Did you mean '{1}'?"), + _0_is_declared_here: diag(2728, ts6.DiagnosticCategory.Message, "_0_is_declared_here_2728", "'{0}' is declared here."), + Property_0_is_used_before_its_initialization: diag(2729, ts6.DiagnosticCategory.Error, "Property_0_is_used_before_its_initialization_2729", "Property '{0}' is used before its initialization."), + An_arrow_function_cannot_have_a_this_parameter: diag(2730, ts6.DiagnosticCategory.Error, "An_arrow_function_cannot_have_a_this_parameter_2730", "An arrow function cannot have a 'this' parameter."), + Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String: diag(2731, ts6.DiagnosticCategory.Error, "Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_i_2731", "Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'."), + Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension: diag(2732, ts6.DiagnosticCategory.Error, "Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension_2732", "Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension."), + Property_0_was_also_declared_here: diag(2733, ts6.DiagnosticCategory.Error, "Property_0_was_also_declared_here_2733", "Property '{0}' was also declared here."), + Are_you_missing_a_semicolon: diag(2734, ts6.DiagnosticCategory.Error, "Are_you_missing_a_semicolon_2734", "Are you missing a semicolon?"), + Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1: diag(2735, ts6.DiagnosticCategory.Error, "Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1_2735", "Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?"), + Operator_0_cannot_be_applied_to_type_1: diag(2736, ts6.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_type_1_2736", "Operator '{0}' cannot be applied to type '{1}'."), + BigInt_literals_are_not_available_when_targeting_lower_than_ES2020: diag(2737, ts6.DiagnosticCategory.Error, "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737", "BigInt literals are not available when targeting lower than ES2020."), + An_outer_value_of_this_is_shadowed_by_this_container: diag(2738, ts6.DiagnosticCategory.Message, "An_outer_value_of_this_is_shadowed_by_this_container_2738", "An outer value of 'this' is shadowed by this container."), + Type_0_is_missing_the_following_properties_from_type_1_Colon_2: diag(2739, ts6.DiagnosticCategory.Error, "Type_0_is_missing_the_following_properties_from_type_1_Colon_2_2739", "Type '{0}' is missing the following properties from type '{1}': {2}"), + Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more: diag(2740, ts6.DiagnosticCategory.Error, "Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more_2740", "Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more."), + Property_0_is_missing_in_type_1_but_required_in_type_2: diag(2741, ts6.DiagnosticCategory.Error, "Property_0_is_missing_in_type_1_but_required_in_type_2_2741", "Property '{0}' is missing in type '{1}' but required in type '{2}'."), + The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary: diag(2742, ts6.DiagnosticCategory.Error, "The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_a_2742", "The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary."), + No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments: diag(2743, ts6.DiagnosticCategory.Error, "No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments_2743", "No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments."), + Type_parameter_defaults_can_only_reference_previously_declared_type_parameters: diag(2744, ts6.DiagnosticCategory.Error, "Type_parameter_defaults_can_only_reference_previously_declared_type_parameters_2744", "Type parameter defaults can only reference previously declared type parameters."), + This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided: diag(2745, ts6.DiagnosticCategory.Error, "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745", "This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided."), + This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided: diag(2746, ts6.DiagnosticCategory.Error, "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746", "This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided."), + _0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2: diag(2747, ts6.DiagnosticCategory.Error, "_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_t_2747", "'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'."), + Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided: diag(2748, ts6.DiagnosticCategory.Error, "Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided_2748", "Cannot access ambient const enums when the '--isolatedModules' flag is provided."), + _0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0: diag(2749, ts6.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0_2749", "'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?"), + The_implementation_signature_is_declared_here: diag(2750, ts6.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."), + Circularity_originates_in_type_at_this_location: diag(2751, ts6.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."), + The_first_export_default_is_here: diag(2752, ts6.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."), + Another_export_default_is_here: diag(2753, ts6.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."), + super_may_not_use_type_arguments: diag(2754, ts6.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."), + No_constituent_of_type_0_is_callable: diag(2755, ts6.DiagnosticCategory.Error, "No_constituent_of_type_0_is_callable_2755", "No constituent of type '{0}' is callable."), + Not_all_constituents_of_type_0_are_callable: diag(2756, ts6.DiagnosticCategory.Error, "Not_all_constituents_of_type_0_are_callable_2756", "Not all constituents of type '{0}' are callable."), + Type_0_has_no_call_signatures: diag(2757, ts6.DiagnosticCategory.Error, "Type_0_has_no_call_signatures_2757", "Type '{0}' has no call signatures."), + Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other: diag(2758, ts6.DiagnosticCategory.Error, "Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_2758", "Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other."), + No_constituent_of_type_0_is_constructable: diag(2759, ts6.DiagnosticCategory.Error, "No_constituent_of_type_0_is_constructable_2759", "No constituent of type '{0}' is constructable."), + Not_all_constituents_of_type_0_are_constructable: diag(2760, ts6.DiagnosticCategory.Error, "Not_all_constituents_of_type_0_are_constructable_2760", "Not all constituents of type '{0}' are constructable."), + Type_0_has_no_construct_signatures: diag(2761, ts6.DiagnosticCategory.Error, "Type_0_has_no_construct_signatures_2761", "Type '{0}' has no construct signatures."), + Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other: diag(2762, ts6.DiagnosticCategory.Error, "Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_2762", "Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other."), + Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0: diag(2763, ts6.DiagnosticCategory.Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_s_2763", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'."), + Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0: diag(2764, ts6.DiagnosticCategory.Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_al_2764", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'."), + Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0: diag(2765, ts6.DiagnosticCategory.Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring__2765", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'."), + Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0: diag(2766, ts6.DiagnosticCategory.Error, "Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766", "Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'."), + The_0_property_of_an_iterator_must_be_a_method: diag(2767, ts6.DiagnosticCategory.Error, "The_0_property_of_an_iterator_must_be_a_method_2767", "The '{0}' property of an iterator must be a method."), + The_0_property_of_an_async_iterator_must_be_a_method: diag(2768, ts6.DiagnosticCategory.Error, "The_0_property_of_an_async_iterator_must_be_a_method_2768", "The '{0}' property of an async iterator must be a method."), + No_overload_matches_this_call: diag(2769, ts6.DiagnosticCategory.Error, "No_overload_matches_this_call_2769", "No overload matches this call."), + The_last_overload_gave_the_following_error: diag(2770, ts6.DiagnosticCategory.Error, "The_last_overload_gave_the_following_error_2770", "The last overload gave the following error."), + The_last_overload_is_declared_here: diag(2771, ts6.DiagnosticCategory.Error, "The_last_overload_is_declared_here_2771", "The last overload is declared here."), + Overload_0_of_1_2_gave_the_following_error: diag(2772, ts6.DiagnosticCategory.Error, "Overload_0_of_1_2_gave_the_following_error_2772", "Overload {0} of {1}, '{2}', gave the following error."), + Did_you_forget_to_use_await: diag(2773, ts6.DiagnosticCategory.Error, "Did_you_forget_to_use_await_2773", "Did you forget to use 'await'?"), + This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead: diag(2774, ts6.DiagnosticCategory.Error, "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774", "This condition will always return true since this function is always defined. Did you mean to call it instead?"), + Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation: diag(2775, ts6.DiagnosticCategory.Error, "Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation_2775", "Assertions require every name in the call target to be declared with an explicit type annotation."), + Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name: diag(2776, ts6.DiagnosticCategory.Error, "Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name_2776", "Assertions require the call target to be an identifier or qualified name."), + The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access: diag(2777, ts6.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777", "The operand of an increment or decrement operator may not be an optional property access."), + The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access: diag(2778, ts6.DiagnosticCategory.Error, "The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access_2778", "The target of an object rest assignment may not be an optional property access."), + The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access: diag(2779, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779", "The left-hand side of an assignment expression may not be an optional property access."), + The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access: diag(2780, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access_2780", "The left-hand side of a 'for...in' statement may not be an optional property access."), + The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access: diag(2781, ts6.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access_2781", "The left-hand side of a 'for...of' statement may not be an optional property access."), + _0_needs_an_explicit_type_annotation: diag(2782, ts6.DiagnosticCategory.Message, "_0_needs_an_explicit_type_annotation_2782", "'{0}' needs an explicit type annotation."), + _0_is_specified_more_than_once_so_this_usage_will_be_overwritten: diag(2783, ts6.DiagnosticCategory.Error, "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783", "'{0}' is specified more than once, so this usage will be overwritten."), + get_and_set_accessors_cannot_declare_this_parameters: diag(2784, ts6.DiagnosticCategory.Error, "get_and_set_accessors_cannot_declare_this_parameters_2784", "'get' and 'set' accessors cannot declare 'this' parameters."), + This_spread_always_overwrites_this_property: diag(2785, ts6.DiagnosticCategory.Error, "This_spread_always_overwrites_this_property_2785", "This spread always overwrites this property."), + _0_cannot_be_used_as_a_JSX_component: diag(2786, ts6.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_JSX_component_2786", "'{0}' cannot be used as a JSX component."), + Its_return_type_0_is_not_a_valid_JSX_element: diag(2787, ts6.DiagnosticCategory.Error, "Its_return_type_0_is_not_a_valid_JSX_element_2787", "Its return type '{0}' is not a valid JSX element."), + Its_instance_type_0_is_not_a_valid_JSX_element: diag(2788, ts6.DiagnosticCategory.Error, "Its_instance_type_0_is_not_a_valid_JSX_element_2788", "Its instance type '{0}' is not a valid JSX element."), + Its_element_type_0_is_not_a_valid_JSX_element: diag(2789, ts6.DiagnosticCategory.Error, "Its_element_type_0_is_not_a_valid_JSX_element_2789", "Its element type '{0}' is not a valid JSX element."), + The_operand_of_a_delete_operator_must_be_optional: diag(2790, ts6.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_must_be_optional_2790", "The operand of a 'delete' operator must be optional."), + Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later: diag(2791, ts6.DiagnosticCategory.Error, "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791", "Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later."), + Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option: diag(2792, ts6.DiagnosticCategory.Error, "Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_th_2792", "Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?"), + The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible: diag(2793, ts6.DiagnosticCategory.Error, "The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_2793", "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible."), + Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise: diag(2794, ts6.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise_2794", "Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?"), + The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types: diag(2795, ts6.DiagnosticCategory.Error, "The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types_2795", "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types."), + It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked: diag(2796, ts6.DiagnosticCategory.Error, "It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tag_2796", "It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked."), + A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract: diag(2797, ts6.DiagnosticCategory.Error, "A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_2797", "A mixin class that extends from a type variable containing an abstract construct signature must also be declared 'abstract'."), + The_declaration_was_marked_as_deprecated_here: diag(2798, ts6.DiagnosticCategory.Error, "The_declaration_was_marked_as_deprecated_here_2798", "The declaration was marked as deprecated here."), + Type_produces_a_tuple_type_that_is_too_large_to_represent: diag(2799, ts6.DiagnosticCategory.Error, "Type_produces_a_tuple_type_that_is_too_large_to_represent_2799", "Type produces a tuple type that is too large to represent."), + Expression_produces_a_tuple_type_that_is_too_large_to_represent: diag(2800, ts6.DiagnosticCategory.Error, "Expression_produces_a_tuple_type_that_is_too_large_to_represent_2800", "Expression produces a tuple type that is too large to represent."), + This_condition_will_always_return_true_since_this_0_is_always_defined: diag(2801, ts6.DiagnosticCategory.Error, "This_condition_will_always_return_true_since_this_0_is_always_defined_2801", "This condition will always return true since this '{0}' is always defined."), + Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher: diag(2802, ts6.DiagnosticCategory.Error, "Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es201_2802", "Type '{0}' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher."), + Cannot_assign_to_private_method_0_Private_methods_are_not_writable: diag(2803, ts6.DiagnosticCategory.Error, "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803", "Cannot assign to private method '{0}'. Private methods are not writable."), + Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name: diag(2804, ts6.DiagnosticCategory.Error, "Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name_2804", "Duplicate identifier '{0}'. Static and instance elements cannot share the same private name."), + Private_accessor_was_defined_without_a_getter: diag(2806, ts6.DiagnosticCategory.Error, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."), + This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts6.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."), + A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts6.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"), + Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, ts6.DiagnosticCategory.Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."), + Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, ts6.DiagnosticCategory.Error, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."), + Initializer_for_property_0: diag(2811, ts6.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"), + Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts6.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."), + Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts6.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."), + Function_with_bodies_can_only_merge_with_classes_that_are_ambient: diag(2814, ts6.DiagnosticCategory.Error, "Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814", "Function with bodies can only merge with classes that are ambient."), + arguments_cannot_be_referenced_in_property_initializers: diag(2815, ts6.DiagnosticCategory.Error, "arguments_cannot_be_referenced_in_property_initializers_2815", "'arguments' cannot be referenced in property initializers."), + Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class: diag(2816, ts6.DiagnosticCategory.Error, "Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816", "Cannot use 'this' in a static property initializer of a decorated class."), + Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block: diag(2817, ts6.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."), + Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, ts6.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."), + Namespace_name_cannot_be_0: diag(2819, ts6.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."), + Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts6.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"), + Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts6.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."), + Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts6.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."), + Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts6.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"), + Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts6.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."), + Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, ts6.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"), + Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts6.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."), + Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts6.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."), + All_declarations_of_0_must_have_identical_constraints: diag(2838, ts6.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."), + This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts6.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."), + An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts6.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"), + The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts6.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."), + _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts6.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), + We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts6.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), + Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts6.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts6.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), + Import_declaration_0_is_using_private_name_1: diag(4e3, ts6.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4006, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."), + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4008, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."), + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4010, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."), + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4012, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", "Type parameter '{0}' of public method from exported class has or is using private name '{1}'."), + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4014, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", "Type parameter '{0}' of method from exported interface has or is using private name '{1}'."), + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4016, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", "Type parameter '{0}' of exported function has or is using private name '{1}'."), + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4019, ts6.DiagnosticCategory.Error, "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", "Implements clause of exported class '{0}' has or is using private name '{1}'."), + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4020, ts6.DiagnosticCategory.Error, "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", "'extends' clause of exported class '{0}' has or is using private name '{1}'."), + extends_clause_of_exported_class_has_or_is_using_private_name_0: diag(4021, ts6.DiagnosticCategory.Error, "extends_clause_of_exported_class_has_or_is_using_private_name_0_4021", "'extends' clause of exported class has or is using private name '{0}'."), + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: diag(4022, ts6.DiagnosticCategory.Error, "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", "'extends' clause of exported interface '{0}' has or is using private name '{1}'."), + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4023, ts6.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."), + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: diag(4024, ts6.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", "Exported variable '{0}' has or is using name '{1}' from private module '{2}'."), + Exported_variable_0_has_or_is_using_private_name_1: diag(4025, ts6.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_private_name_1_4025", "Exported variable '{0}' has or is using private name '{1}'."), + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4026, ts6.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4027, ts6.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."), + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4028, ts6.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", "Public static property '{0}' of exported class has or is using private name '{1}'."), + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4029, ts6.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4030, ts6.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."), + Public_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4031, ts6.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", "Public property '{0}' of exported class has or is using private name '{1}'."), + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4032, ts6.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."), + Property_0_of_exported_interface_has_or_is_using_private_name_1: diag(4033, ts6.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", "Property '{0}' of exported interface has or is using private name '{1}'."), + Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4034, ts6.DiagnosticCategory.Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034", "Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1: diag(4035, ts6.DiagnosticCategory.Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035", "Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'."), + Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4036, ts6.DiagnosticCategory.Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036", "Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1: diag(4037, ts6.DiagnosticCategory.Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037", "Parameter type of public setter '{0}' from exported class has or is using private name '{1}'."), + Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4038, ts6.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4039, ts6.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), + Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1: diag(4040, ts6.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040", "Return type of public static getter '{0}' from exported class has or is using private name '{1}'."), + Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4041, ts6.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041", "Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4042, ts6.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042", "Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."), + Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1: diag(4043, ts6.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043", "Return type of public getter '{0}' from exported class has or is using private name '{1}'."), + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4044, ts6.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4045, ts6.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", "Return type of constructor signature from exported interface has or is using private name '{0}'."), + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4046, ts6.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4047, ts6.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", "Return type of call signature from exported interface has or is using private name '{0}'."), + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4048, ts6.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4049, ts6.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", "Return type of index signature from exported interface has or is using private name '{0}'."), + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4050, ts6.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4051, ts6.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."), + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: diag(4052, ts6.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", "Return type of public static method from exported class has or is using private name '{0}'."), + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4053, ts6.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4054, ts6.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", "Return type of public method from exported class has or is using name '{0}' from private module '{1}'."), + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: diag(4055, ts6.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", "Return type of public method from exported class has or is using private name '{0}'."), + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4056, ts6.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", "Return type of method from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: diag(4057, ts6.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", "Return type of method from exported interface has or is using private name '{0}'."), + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4058, ts6.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: diag(4059, ts6.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", "Return type of exported function has or is using name '{0}' from private module '{1}'."), + Return_type_of_exported_function_has_or_is_using_private_name_0: diag(4060, ts6.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", "Return type of exported function has or is using private name '{0}'."), + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4061, ts6.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4062, ts6.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: diag(4063, ts6.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", "Parameter '{0}' of constructor from exported class has or is using private name '{1}'."), + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4064, ts6.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4065, ts6.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."), + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4066, ts6.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4067, ts6.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."), + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4068, ts6.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4069, ts6.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4070, ts6.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", "Parameter '{0}' of public static method from exported class has or is using private name '{1}'."), + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4071, ts6.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4072, ts6.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4073, ts6.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", "Parameter '{0}' of public method from exported class has or is using private name '{1}'."), + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4074, ts6.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4075, ts6.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", "Parameter '{0}' of method from exported interface has or is using private name '{1}'."), + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4076, ts6.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: diag(4077, ts6.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4078, ts6.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", "Parameter '{0}' of exported function has or is using private name '{1}'."), + Exported_type_alias_0_has_or_is_using_private_name_1: diag(4081, ts6.DiagnosticCategory.Error, "Exported_type_alias_0_has_or_is_using_private_name_1_4081", "Exported type alias '{0}' has or is using private name '{1}'."), + Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, ts6.DiagnosticCategory.Error, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."), + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."), + Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, ts6.DiagnosticCategory.Error, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."), + Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, ts6.DiagnosticCategory.Error, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."), + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, ts6.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, ts6.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."), + Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, ts6.DiagnosticCategory.Error, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."), + Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, ts6.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), + Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, ts6.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."), + Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, ts6.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."), + Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4098, ts6.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098", "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), + Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4099, ts6.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099", "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'."), + Public_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4100, ts6.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100", "Public method '{0}' of exported class has or is using private name '{1}'."), + Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts6.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."), + Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts6.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."), + Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts6.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."), + The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts6.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."), + Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter: diag(4105, ts6.DiagnosticCategory.Error, "Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter_4105", "Private or protected member '{0}' cannot be accessed on a type parameter."), + Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts6.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."), + Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts6.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts6.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."), + Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts6.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."), + Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts6.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."), + Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0: diag(4111, ts6.DiagnosticCategory.Error, "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111", "Property '{0}' comes from an index signature, so it must be accessed with ['{0}']."), + This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class: diag(4112, ts6.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another__4112", "This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class."), + This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0: diag(4113, ts6.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_4113", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'."), + This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0: diag(4114, ts6.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114", "This member must have an 'override' modifier because it overrides a member in the base class '{0}'."), + This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0: diag(4115, ts6.DiagnosticCategory.Error, "This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0_4115", "This parameter property must have an 'override' modifier because it overrides a member in base class '{0}'."), + This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0: diag(4116, ts6.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."), + This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4117, ts6.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"), + The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized: diag(4118, ts6.DiagnosticCategory.Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."), + This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4119, ts6.DiagnosticCategory.Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."), + This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4120, ts6.DiagnosticCategory.Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."), + This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts6.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."), + This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts6.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."), + This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts6.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"), + Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts6.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."), + resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts6.DiagnosticCategory.Error, "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."), + The_current_host_does_not_support_the_0_option: diag(5001, ts6.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."), + Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts6.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."), + File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts6.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."), + Cannot_read_file_0_Colon_1: diag(5012, ts6.DiagnosticCategory.Error, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."), + Failed_to_parse_file_0_Colon_1: diag(5014, ts6.DiagnosticCategory.Error, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."), + Unknown_compiler_option_0: diag(5023, ts6.DiagnosticCategory.Error, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."), + Compiler_option_0_requires_a_value_of_type_1: diag(5024, ts6.DiagnosticCategory.Error, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."), + Unknown_compiler_option_0_Did_you_mean_1: diag(5025, ts6.DiagnosticCategory.Error, "Unknown_compiler_option_0_Did_you_mean_1_5025", "Unknown compiler option '{0}'. Did you mean '{1}'?"), + Could_not_write_file_0_Colon_1: diag(5033, ts6.DiagnosticCategory.Error, "Could_not_write_file_0_Colon_1_5033", "Could not write file '{0}': {1}."), + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: diag(5042, ts6.DiagnosticCategory.Error, "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", "Option 'project' cannot be mixed with source files on a command line."), + Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: diag(5047, ts6.DiagnosticCategory.Error, "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."), + Option_0_cannot_be_specified_when_option_target_is_ES3: diag(5048, ts6.DiagnosticCategory.Error, "Option_0_cannot_be_specified_when_option_target_is_ES3_5048", "Option '{0}' cannot be specified when option 'target' is 'ES3'."), + Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: diag(5051, ts6.DiagnosticCategory.Error, "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."), + Option_0_cannot_be_specified_without_specifying_option_1: diag(5052, ts6.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_5052", "Option '{0}' cannot be specified without specifying option '{1}'."), + Option_0_cannot_be_specified_with_option_1: diag(5053, ts6.DiagnosticCategory.Error, "Option_0_cannot_be_specified_with_option_1_5053", "Option '{0}' cannot be specified with option '{1}'."), + A_tsconfig_json_file_is_already_defined_at_Colon_0: diag(5054, ts6.DiagnosticCategory.Error, "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", "A 'tsconfig.json' file is already defined at: '{0}'."), + Cannot_write_file_0_because_it_would_overwrite_input_file: diag(5055, ts6.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", "Cannot write file '{0}' because it would overwrite input file."), + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: diag(5056, ts6.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", "Cannot write file '{0}' because it would be overwritten by multiple input files."), + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: diag(5057, ts6.DiagnosticCategory.Error, "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", "Cannot find a tsconfig.json file at the specified directory: '{0}'."), + The_specified_path_does_not_exist_Colon_0: diag(5058, ts6.DiagnosticCategory.Error, "The_specified_path_does_not_exist_Colon_0_5058", "The specified path does not exist: '{0}'."), + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: diag(5059, ts6.DiagnosticCategory.Error, "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."), + Pattern_0_can_have_at_most_one_Asterisk_character: diag(5061, ts6.DiagnosticCategory.Error, "Pattern_0_can_have_at_most_one_Asterisk_character_5061", "Pattern '{0}' can have at most one '*' character."), + Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character: diag(5062, ts6.DiagnosticCategory.Error, "Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character_5062", "Substitution '{0}' in pattern '{1}' can have at most one '*' character."), + Substitutions_for_pattern_0_should_be_an_array: diag(5063, ts6.DiagnosticCategory.Error, "Substitutions_for_pattern_0_should_be_an_array_5063", "Substitutions for pattern '{0}' should be an array."), + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: diag(5064, ts6.DiagnosticCategory.Error, "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."), + File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5065, ts6.DiagnosticCategory.Error, "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."), + Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: diag(5066, ts6.DiagnosticCategory.Error, "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", "Substitutions for pattern '{0}' shouldn't be an empty array."), + Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(5067, ts6.DiagnosticCategory.Error, "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."), + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(5068, ts6.DiagnosticCategory.Error, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."), + Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, ts6.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."), + Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy: diag(5070, ts6.DiagnosticCategory.Error, "Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070", "Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy."), + Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts6.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."), + Unknown_build_option_0: diag(5072, ts6.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."), + Build_option_0_requires_a_value_of_type_1: diag(5073, ts6.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."), + Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts6.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."), + _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts6.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."), + _0_and_1_operations_cannot_be_mixed_without_parentheses: diag(5076, ts6.DiagnosticCategory.Error, "_0_and_1_operations_cannot_be_mixed_without_parentheses_5076", "'{0}' and '{1}' operations cannot be mixed without parentheses."), + Unknown_build_option_0_Did_you_mean_1: diag(5077, ts6.DiagnosticCategory.Error, "Unknown_build_option_0_Did_you_mean_1_5077", "Unknown build option '{0}'. Did you mean '{1}'?"), + Unknown_watch_option_0: diag(5078, ts6.DiagnosticCategory.Error, "Unknown_watch_option_0_5078", "Unknown watch option '{0}'."), + Unknown_watch_option_0_Did_you_mean_1: diag(5079, ts6.DiagnosticCategory.Error, "Unknown_watch_option_0_Did_you_mean_1_5079", "Unknown watch option '{0}'. Did you mean '{1}'?"), + Watch_option_0_requires_a_value_of_type_1: diag(5080, ts6.DiagnosticCategory.Error, "Watch_option_0_requires_a_value_of_type_1_5080", "Watch option '{0}' requires a value of type {1}."), + Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0: diag(5081, ts6.DiagnosticCategory.Error, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."), + _0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1: diag(5082, ts6.DiagnosticCategory.Error, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."), + Cannot_read_file_0: diag(5083, ts6.DiagnosticCategory.Error, "Cannot_read_file_0_5083", "Cannot read file '{0}'."), + Tuple_members_must_all_have_names_or_all_not_have_names: diag(5084, ts6.DiagnosticCategory.Error, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."), + A_tuple_member_cannot_be_both_optional_and_rest: diag(5085, ts6.DiagnosticCategory.Error, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."), + A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type: diag(5086, ts6.DiagnosticCategory.Error, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."), + A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type: diag(5087, ts6.DiagnosticCategory.Error, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."), + The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary: diag(5088, ts6.DiagnosticCategory.Error, "The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088", "The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary."), + Option_0_cannot_be_specified_when_option_jsx_is_1: diag(5089, ts6.DiagnosticCategory.Error, "Option_0_cannot_be_specified_when_option_jsx_is_1_5089", "Option '{0}' cannot be specified when option 'jsx' is '{1}'."), + Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash: diag(5090, ts6.DiagnosticCategory.Error, "Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash_5090", "Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?"), + Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled: diag(5091, ts6.DiagnosticCategory.Error, "Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled_5091", "Option 'preserveConstEnums' cannot be disabled when 'isolatedModules' is enabled."), + The_root_value_of_a_0_file_must_be_an_object: diag(5092, ts6.DiagnosticCategory.Error, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."), + Compiler_option_0_may_only_be_used_with_build: diag(5093, ts6.DiagnosticCategory.Error, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."), + Compiler_option_0_may_not_be_used_with_build: diag(5094, ts6.DiagnosticCategory.Error, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."), + Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, ts6.DiagnosticCategory.Error, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."), + Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, ts6.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), + Concatenate_and_emit_output_to_single_file: diag(6001, ts6.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), + Generates_corresponding_d_ts_file: diag(6002, ts6.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: diag(6004, ts6.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", "Specify the location where debugger should locate TypeScript files instead of source locations."), + Watch_input_files: diag(6005, ts6.DiagnosticCategory.Message, "Watch_input_files_6005", "Watch input files."), + Redirect_output_structure_to_the_directory: diag(6006, ts6.DiagnosticCategory.Message, "Redirect_output_structure_to_the_directory_6006", "Redirect output structure to the directory."), + Do_not_erase_const_enum_declarations_in_generated_code: diag(6007, ts6.DiagnosticCategory.Message, "Do_not_erase_const_enum_declarations_in_generated_code_6007", "Do not erase const enum declarations in generated code."), + Do_not_emit_outputs_if_any_errors_were_reported: diag(6008, ts6.DiagnosticCategory.Message, "Do_not_emit_outputs_if_any_errors_were_reported_6008", "Do not emit outputs if any errors were reported."), + Do_not_emit_comments_to_output: diag(6009, ts6.DiagnosticCategory.Message, "Do_not_emit_comments_to_output_6009", "Do not emit comments to output."), + Do_not_emit_outputs: diag(6010, ts6.DiagnosticCategory.Message, "Do_not_emit_outputs_6010", "Do not emit outputs."), + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: diag(6011, ts6.DiagnosticCategory.Message, "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", "Allow default imports from modules with no default export. This does not affect code emit, just typechecking."), + Skip_type_checking_of_declaration_files: diag(6012, ts6.DiagnosticCategory.Message, "Skip_type_checking_of_declaration_files_6012", "Skip type checking of declaration files."), + Do_not_resolve_the_real_path_of_symlinks: diag(6013, ts6.DiagnosticCategory.Message, "Do_not_resolve_the_real_path_of_symlinks_6013", "Do not resolve the real path of symlinks."), + Only_emit_d_ts_declaration_files: diag(6014, ts6.DiagnosticCategory.Message, "Only_emit_d_ts_declaration_files_6014", "Only emit '.d.ts' declaration files."), + Specify_ECMAScript_target_version: diag(6015, ts6.DiagnosticCategory.Message, "Specify_ECMAScript_target_version_6015", "Specify ECMAScript target version."), + Specify_module_code_generation: diag(6016, ts6.DiagnosticCategory.Message, "Specify_module_code_generation_6016", "Specify module code generation."), + Print_this_message: diag(6017, ts6.DiagnosticCategory.Message, "Print_this_message_6017", "Print this message."), + Print_the_compiler_s_version: diag(6019, ts6.DiagnosticCategory.Message, "Print_the_compiler_s_version_6019", "Print the compiler's version."), + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: diag(6020, ts6.DiagnosticCategory.Message, "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."), + Syntax_Colon_0: diag(6023, ts6.DiagnosticCategory.Message, "Syntax_Colon_0_6023", "Syntax: {0}"), + options: diag(6024, ts6.DiagnosticCategory.Message, "options_6024", "options"), + file: diag(6025, ts6.DiagnosticCategory.Message, "file_6025", "file"), + Examples_Colon_0: diag(6026, ts6.DiagnosticCategory.Message, "Examples_Colon_0_6026", "Examples: {0}"), + Options_Colon: diag(6027, ts6.DiagnosticCategory.Message, "Options_Colon_6027", "Options:"), + Version_0: diag(6029, ts6.DiagnosticCategory.Message, "Version_0_6029", "Version {0}"), + Insert_command_line_options_and_files_from_a_file: diag(6030, ts6.DiagnosticCategory.Message, "Insert_command_line_options_and_files_from_a_file_6030", "Insert command line options and files from a file."), + Starting_compilation_in_watch_mode: diag(6031, ts6.DiagnosticCategory.Message, "Starting_compilation_in_watch_mode_6031", "Starting compilation in watch mode..."), + File_change_detected_Starting_incremental_compilation: diag(6032, ts6.DiagnosticCategory.Message, "File_change_detected_Starting_incremental_compilation_6032", "File change detected. Starting incremental compilation..."), + KIND: diag(6034, ts6.DiagnosticCategory.Message, "KIND_6034", "KIND"), + FILE: diag(6035, ts6.DiagnosticCategory.Message, "FILE_6035", "FILE"), + VERSION: diag(6036, ts6.DiagnosticCategory.Message, "VERSION_6036", "VERSION"), + LOCATION: diag(6037, ts6.DiagnosticCategory.Message, "LOCATION_6037", "LOCATION"), + DIRECTORY: diag(6038, ts6.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"), + STRATEGY: diag(6039, ts6.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"), + FILE_OR_DIRECTORY: diag(6040, ts6.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"), + Errors_Files: diag(6041, ts6.DiagnosticCategory.Message, "Errors_Files_6041", "Errors Files"), + Generates_corresponding_map_file: diag(6043, ts6.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."), + Compiler_option_0_expects_an_argument: diag(6044, ts6.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."), + Unterminated_quoted_string_in_response_file_0: diag(6045, ts6.DiagnosticCategory.Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."), + Argument_for_0_option_must_be_Colon_1: diag(6046, ts6.DiagnosticCategory.Error, "Argument_for_0_option_must_be_Colon_1_6046", "Argument for '{0}' option must be: {1}."), + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: diag(6048, ts6.DiagnosticCategory.Error, "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", "Locale must be of the form or -. For example '{0}' or '{1}'."), + Unable_to_open_file_0: diag(6050, ts6.DiagnosticCategory.Error, "Unable_to_open_file_0_6050", "Unable to open file '{0}'."), + Corrupted_locale_file_0: diag(6051, ts6.DiagnosticCategory.Error, "Corrupted_locale_file_0_6051", "Corrupted locale file {0}."), + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: diag(6052, ts6.DiagnosticCategory.Message, "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", "Raise error on expressions and declarations with an implied 'any' type."), + File_0_not_found: diag(6053, ts6.DiagnosticCategory.Error, "File_0_not_found_6053", "File '{0}' not found."), + File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1: diag(6054, ts6.DiagnosticCategory.Error, "File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1_6054", "File '{0}' has an unsupported extension. The only supported extensions are {1}."), + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: diag(6055, ts6.DiagnosticCategory.Message, "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", "Suppress noImplicitAny errors for indexing objects lacking index signatures."), + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: diag(6056, ts6.DiagnosticCategory.Message, "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", "Do not emit declarations for code that has an '@internal' annotation."), + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: diag(6058, ts6.DiagnosticCategory.Message, "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", "Specify the root directory of input files. Use to control the output directory structure with --outDir."), + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: diag(6059, ts6.DiagnosticCategory.Error, "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."), + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: diag(6060, ts6.DiagnosticCategory.Message, "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."), + NEWLINE: diag(6061, ts6.DiagnosticCategory.Message, "NEWLINE_6061", "NEWLINE"), + Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line: diag(6064, ts6.DiagnosticCategory.Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line_6064", "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line."), + Enables_experimental_support_for_ES7_decorators: diag(6065, ts6.DiagnosticCategory.Message, "Enables_experimental_support_for_ES7_decorators_6065", "Enables experimental support for ES7 decorators."), + Enables_experimental_support_for_emitting_type_metadata_for_decorators: diag(6066, ts6.DiagnosticCategory.Message, "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", "Enables experimental support for emitting type metadata for decorators."), + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: diag(6069, ts6.DiagnosticCategory.Message, "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."), + Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: diag(6070, ts6.DiagnosticCategory.Message, "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", "Initializes a TypeScript project and creates a tsconfig.json file."), + Successfully_created_a_tsconfig_json_file: diag(6071, ts6.DiagnosticCategory.Message, "Successfully_created_a_tsconfig_json_file_6071", "Successfully created a tsconfig.json file."), + Suppress_excess_property_checks_for_object_literals: diag(6072, ts6.DiagnosticCategory.Message, "Suppress_excess_property_checks_for_object_literals_6072", "Suppress excess property checks for object literals."), + Stylize_errors_and_messages_using_color_and_context_experimental: diag(6073, ts6.DiagnosticCategory.Message, "Stylize_errors_and_messages_using_color_and_context_experimental_6073", "Stylize errors and messages using color and context (experimental)."), + Do_not_report_errors_on_unused_labels: diag(6074, ts6.DiagnosticCategory.Message, "Do_not_report_errors_on_unused_labels_6074", "Do not report errors on unused labels."), + Report_error_when_not_all_code_paths_in_function_return_a_value: diag(6075, ts6.DiagnosticCategory.Message, "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", "Report error when not all code paths in function return a value."), + Report_errors_for_fallthrough_cases_in_switch_statement: diag(6076, ts6.DiagnosticCategory.Message, "Report_errors_for_fallthrough_cases_in_switch_statement_6076", "Report errors for fallthrough cases in switch statement."), + Do_not_report_errors_on_unreachable_code: diag(6077, ts6.DiagnosticCategory.Message, "Do_not_report_errors_on_unreachable_code_6077", "Do not report errors on unreachable code."), + Disallow_inconsistently_cased_references_to_the_same_file: diag(6078, ts6.DiagnosticCategory.Message, "Disallow_inconsistently_cased_references_to_the_same_file_6078", "Disallow inconsistently-cased references to the same file."), + Specify_library_files_to_be_included_in_the_compilation: diag(6079, ts6.DiagnosticCategory.Message, "Specify_library_files_to_be_included_in_the_compilation_6079", "Specify library files to be included in the compilation."), + Specify_JSX_code_generation: diag(6080, ts6.DiagnosticCategory.Message, "Specify_JSX_code_generation_6080", "Specify JSX code generation."), + File_0_has_an_unsupported_extension_so_skipping_it: diag(6081, ts6.DiagnosticCategory.Message, "File_0_has_an_unsupported_extension_so_skipping_it_6081", "File '{0}' has an unsupported extension, so skipping it."), + Only_amd_and_system_modules_are_supported_alongside_0: diag(6082, ts6.DiagnosticCategory.Error, "Only_amd_and_system_modules_are_supported_alongside_0_6082", "Only 'amd' and 'system' modules are supported alongside --{0}."), + Base_directory_to_resolve_non_absolute_module_names: diag(6083, ts6.DiagnosticCategory.Message, "Base_directory_to_resolve_non_absolute_module_names_6083", "Base directory to resolve non-absolute module names."), + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: diag(6084, ts6.DiagnosticCategory.Message, "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"), + Enable_tracing_of_the_name_resolution_process: diag(6085, ts6.DiagnosticCategory.Message, "Enable_tracing_of_the_name_resolution_process_6085", "Enable tracing of the name resolution process."), + Resolving_module_0_from_1: diag(6086, ts6.DiagnosticCategory.Message, "Resolving_module_0_from_1_6086", "======== Resolving module '{0}' from '{1}'. ========"), + Explicitly_specified_module_resolution_kind_Colon_0: diag(6087, ts6.DiagnosticCategory.Message, "Explicitly_specified_module_resolution_kind_Colon_0_6087", "Explicitly specified module resolution kind: '{0}'."), + Module_resolution_kind_is_not_specified_using_0: diag(6088, ts6.DiagnosticCategory.Message, "Module_resolution_kind_is_not_specified_using_0_6088", "Module resolution kind is not specified, using '{0}'."), + Module_name_0_was_successfully_resolved_to_1: diag(6089, ts6.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_6089", "======== Module name '{0}' was successfully resolved to '{1}'. ========"), + Module_name_0_was_not_resolved: diag(6090, ts6.DiagnosticCategory.Message, "Module_name_0_was_not_resolved_6090", "======== Module name '{0}' was not resolved. ========"), + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: diag(6091, ts6.DiagnosticCategory.Message, "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", "'paths' option is specified, looking for a pattern to match module name '{0}'."), + Module_name_0_matched_pattern_1: diag(6092, ts6.DiagnosticCategory.Message, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."), + Trying_substitution_0_candidate_module_location_Colon_1: diag(6093, ts6.DiagnosticCategory.Message, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."), + Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, ts6.DiagnosticCategory.Message, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."), + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: diag(6095, ts6.DiagnosticCategory.Message, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", "Loading module as file / folder, candidate module location '{0}', target file type '{1}'."), + File_0_does_not_exist: diag(6096, ts6.DiagnosticCategory.Message, "File_0_does_not_exist_6096", "File '{0}' does not exist."), + File_0_exist_use_it_as_a_name_resolution_result: diag(6097, ts6.DiagnosticCategory.Message, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."), + Loading_module_0_from_node_modules_folder_target_file_type_1: diag(6098, ts6.DiagnosticCategory.Message, "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", "Loading module '{0}' from 'node_modules' folder, target file type '{1}'."), + Found_package_json_at_0: diag(6099, ts6.DiagnosticCategory.Message, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."), + package_json_does_not_have_a_0_field: diag(6100, ts6.DiagnosticCategory.Message, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."), + package_json_has_0_field_1_that_references_2: diag(6101, ts6.DiagnosticCategory.Message, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."), + Allow_javascript_files_to_be_compiled: diag(6102, ts6.DiagnosticCategory.Message, "Allow_javascript_files_to_be_compiled_6102", "Allow javascript files to be compiled."), + Checking_if_0_is_the_longest_matching_prefix_for_1_2: diag(6104, ts6.DiagnosticCategory.Message, "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."), + Expected_type_of_0_field_in_package_json_to_be_1_got_2: diag(6105, ts6.DiagnosticCategory.Message, "Expected_type_of_0_field_in_package_json_to_be_1_got_2_6105", "Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'."), + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: diag(6106, ts6.DiagnosticCategory.Message, "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."), + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: diag(6107, ts6.DiagnosticCategory.Message, "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", "'rootDirs' option is set, using it to resolve relative module name '{0}'."), + Longest_matching_prefix_for_0_is_1: diag(6108, ts6.DiagnosticCategory.Message, "Longest_matching_prefix_for_0_is_1_6108", "Longest matching prefix for '{0}' is '{1}'."), + Loading_0_from_the_root_dir_1_candidate_location_2: diag(6109, ts6.DiagnosticCategory.Message, "Loading_0_from_the_root_dir_1_candidate_location_2_6109", "Loading '{0}' from the root dir '{1}', candidate location '{2}'."), + Trying_other_entries_in_rootDirs: diag(6110, ts6.DiagnosticCategory.Message, "Trying_other_entries_in_rootDirs_6110", "Trying other entries in 'rootDirs'."), + Module_resolution_using_rootDirs_has_failed: diag(6111, ts6.DiagnosticCategory.Message, "Module_resolution_using_rootDirs_has_failed_6111", "Module resolution using 'rootDirs' has failed."), + Do_not_emit_use_strict_directives_in_module_output: diag(6112, ts6.DiagnosticCategory.Message, "Do_not_emit_use_strict_directives_in_module_output_6112", "Do not emit 'use strict' directives in module output."), + Enable_strict_null_checks: diag(6113, ts6.DiagnosticCategory.Message, "Enable_strict_null_checks_6113", "Enable strict null checks."), + Unknown_option_excludes_Did_you_mean_exclude: diag(6114, ts6.DiagnosticCategory.Error, "Unknown_option_excludes_Did_you_mean_exclude_6114", "Unknown option 'excludes'. Did you mean 'exclude'?"), + Raise_error_on_this_expressions_with_an_implied_any_type: diag(6115, ts6.DiagnosticCategory.Message, "Raise_error_on_this_expressions_with_an_implied_any_type_6115", "Raise error on 'this' expressions with an implied 'any' type."), + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: diag(6116, ts6.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"), + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: diag(6119, ts6.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"), + Type_reference_directive_0_was_not_resolved: diag(6120, ts6.DiagnosticCategory.Message, "Type_reference_directive_0_was_not_resolved_6120", "======== Type reference directive '{0}' was not resolved. ========"), + Resolving_with_primary_search_path_0: diag(6121, ts6.DiagnosticCategory.Message, "Resolving_with_primary_search_path_0_6121", "Resolving with primary search path '{0}'."), + Root_directory_cannot_be_determined_skipping_primary_search_paths: diag(6122, ts6.DiagnosticCategory.Message, "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", "Root directory cannot be determined, skipping primary search paths."), + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: diag(6123, ts6.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"), + Type_declaration_files_to_be_included_in_compilation: diag(6124, ts6.DiagnosticCategory.Message, "Type_declaration_files_to_be_included_in_compilation_6124", "Type declaration files to be included in compilation."), + Looking_up_in_node_modules_folder_initial_location_0: diag(6125, ts6.DiagnosticCategory.Message, "Looking_up_in_node_modules_folder_initial_location_0_6125", "Looking up in 'node_modules' folder, initial location '{0}'."), + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: diag(6126, ts6.DiagnosticCategory.Message, "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."), + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: diag(6127, ts6.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"), + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: diag(6128, ts6.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"), + Resolving_real_path_for_0_result_1: diag(6130, ts6.DiagnosticCategory.Message, "Resolving_real_path_for_0_result_1_6130", "Resolving real path for '{0}', result '{1}'."), + Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: diag(6131, ts6.DiagnosticCategory.Error, "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."), + File_name_0_has_a_1_extension_stripping_it: diag(6132, ts6.DiagnosticCategory.Message, "File_name_0_has_a_1_extension_stripping_it_6132", "File name '{0}' has a '{1}' extension - stripping it."), + _0_is_declared_but_its_value_is_never_read: diag( + 6133, + ts6.DiagnosticCategory.Error, + "_0_is_declared_but_its_value_is_never_read_6133", + "'{0}' is declared but its value is never read.", + /*reportsUnnecessary*/ + true + ), + Report_errors_on_unused_locals: diag(6134, ts6.DiagnosticCategory.Message, "Report_errors_on_unused_locals_6134", "Report errors on unused locals."), + Report_errors_on_unused_parameters: diag(6135, ts6.DiagnosticCategory.Message, "Report_errors_on_unused_parameters_6135", "Report errors on unused parameters."), + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: diag(6136, ts6.DiagnosticCategory.Message, "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", "The maximum dependency depth to search under node_modules and load JavaScript files."), + Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: diag(6137, ts6.DiagnosticCategory.Error, "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."), + Property_0_is_declared_but_its_value_is_never_read: diag( + 6138, + ts6.DiagnosticCategory.Error, + "Property_0_is_declared_but_its_value_is_never_read_6138", + "Property '{0}' is declared but its value is never read.", + /*reportsUnnecessary*/ + true + ), + Import_emit_helpers_from_tslib: diag(6139, ts6.DiagnosticCategory.Message, "Import_emit_helpers_from_tslib_6139", "Import emit helpers from 'tslib'."), + Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: diag(6140, ts6.DiagnosticCategory.Error, "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."), + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, ts6.DiagnosticCategory.Message, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", 'Parse in strict mode and emit "use strict" for each source file.'), + Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, ts6.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."), + Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, ts6.DiagnosticCategory.Message, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."), + Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, ts6.DiagnosticCategory.Message, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."), + Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, ts6.DiagnosticCategory.Message, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."), + Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, ts6.DiagnosticCategory.Message, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."), + Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, ts6.DiagnosticCategory.Message, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."), + Show_diagnostic_information: diag(6149, ts6.DiagnosticCategory.Message, "Show_diagnostic_information_6149", "Show diagnostic information."), + Show_verbose_diagnostic_information: diag(6150, ts6.DiagnosticCategory.Message, "Show_verbose_diagnostic_information_6150", "Show verbose diagnostic information."), + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: diag(6151, ts6.DiagnosticCategory.Message, "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", "Emit a single file with source maps instead of having a separate file."), + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: diag(6152, ts6.DiagnosticCategory.Message, "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."), + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: diag(6153, ts6.DiagnosticCategory.Message, "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", "Transpile each file as a separate module (similar to 'ts.transpileModule')."), + Print_names_of_generated_files_part_of_the_compilation: diag(6154, ts6.DiagnosticCategory.Message, "Print_names_of_generated_files_part_of_the_compilation_6154", "Print names of generated files part of the compilation."), + Print_names_of_files_part_of_the_compilation: diag(6155, ts6.DiagnosticCategory.Message, "Print_names_of_files_part_of_the_compilation_6155", "Print names of files part of the compilation."), + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: diag(6156, ts6.DiagnosticCategory.Message, "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", "The locale used when displaying messages to the user (e.g. 'en-us')"), + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: diag(6157, ts6.DiagnosticCategory.Message, "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", "Do not generate custom helper functions like '__extends' in compiled output."), + Do_not_include_the_default_library_file_lib_d_ts: diag(6158, ts6.DiagnosticCategory.Message, "Do_not_include_the_default_library_file_lib_d_ts_6158", "Do not include the default library file (lib.d.ts)."), + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: diag(6159, ts6.DiagnosticCategory.Message, "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", "Do not add triple-slash references or imported modules to the list of compiled files."), + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: diag(6160, ts6.DiagnosticCategory.Message, "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."), + List_of_folders_to_include_type_definitions_from: diag(6161, ts6.DiagnosticCategory.Message, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."), + Disable_size_limitations_on_JavaScript_projects: diag(6162, ts6.DiagnosticCategory.Message, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."), + The_character_set_of_the_input_files: diag(6163, ts6.DiagnosticCategory.Message, "The_character_set_of_the_input_files_6163", "The character set of the input files."), + Do_not_truncate_error_messages: diag(6165, ts6.DiagnosticCategory.Message, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."), + Output_directory_for_generated_declaration_files: diag(6166, ts6.DiagnosticCategory.Message, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."), + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, ts6.DiagnosticCategory.Message, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."), + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: diag(6168, ts6.DiagnosticCategory.Message, "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", "List of root folders whose combined content represents the structure of the project at runtime."), + Show_all_compiler_options: diag(6169, ts6.DiagnosticCategory.Message, "Show_all_compiler_options_6169", "Show all compiler options."), + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: diag(6170, ts6.DiagnosticCategory.Message, "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"), + Command_line_Options: diag(6171, ts6.DiagnosticCategory.Message, "Command_line_Options_6171", "Command-line Options"), + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: diag(6179, ts6.DiagnosticCategory.Message, "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."), + Enable_all_strict_type_checking_options: diag(6180, ts6.DiagnosticCategory.Message, "Enable_all_strict_type_checking_options_6180", "Enable all strict type-checking options."), + Scoped_package_detected_looking_in_0: diag(6182, ts6.DiagnosticCategory.Message, "Scoped_package_detected_looking_in_0_6182", "Scoped package detected, looking in '{0}'"), + Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2: diag(6183, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_6183", "Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."), + Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3: diag(6184, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package__6184", "Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."), + Enable_strict_checking_of_function_types: diag(6186, ts6.DiagnosticCategory.Message, "Enable_strict_checking_of_function_types_6186", "Enable strict checking of function types."), + Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts6.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."), + Numeric_separators_are_not_allowed_here: diag(6188, ts6.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."), + Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts6.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."), + Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts6.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."), + All_imports_in_import_declaration_are_unused: diag( + 6192, + ts6.DiagnosticCategory.Error, + "All_imports_in_import_declaration_are_unused_6192", + "All imports in import declaration are unused.", + /*reportsUnnecessary*/ + true + ), + Found_1_error_Watching_for_file_changes: diag(6193, ts6.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."), + Found_0_errors_Watching_for_file_changes: diag(6194, ts6.DiagnosticCategory.Message, "Found_0_errors_Watching_for_file_changes_6194", "Found {0} errors. Watching for file changes."), + Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols: diag(6195, ts6.DiagnosticCategory.Message, "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195", "Resolve 'keyof' to string valued property names only (no numbers or symbols)."), + _0_is_declared_but_never_used: diag( + 6196, + ts6.DiagnosticCategory.Error, + "_0_is_declared_but_never_used_6196", + "'{0}' is declared but never used.", + /*reportsUnnecessary*/ + true + ), + Include_modules_imported_with_json_extension: diag(6197, ts6.DiagnosticCategory.Message, "Include_modules_imported_with_json_extension_6197", "Include modules imported with '.json' extension"), + All_destructured_elements_are_unused: diag( + 6198, + ts6.DiagnosticCategory.Error, + "All_destructured_elements_are_unused_6198", + "All destructured elements are unused.", + /*reportsUnnecessary*/ + true + ), + All_variables_are_unused: diag( + 6199, + ts6.DiagnosticCategory.Error, + "All_variables_are_unused_6199", + "All variables are unused.", + /*reportsUnnecessary*/ + true + ), + Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0: diag(6200, ts6.DiagnosticCategory.Error, "Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0_6200", "Definitions of the following identifiers conflict with those in another file: {0}"), + Conflicts_are_in_this_file: diag(6201, ts6.DiagnosticCategory.Message, "Conflicts_are_in_this_file_6201", "Conflicts are in this file."), + Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts6.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"), + _0_was_also_declared_here: diag(6203, ts6.DiagnosticCategory.Message, "_0_was_also_declared_here_6203", "'{0}' was also declared here."), + and_here: diag(6204, ts6.DiagnosticCategory.Message, "and_here_6204", "and here."), + All_type_parameters_are_unused: diag(6205, ts6.DiagnosticCategory.Error, "All_type_parameters_are_unused_6205", "All type parameters are unused."), + package_json_has_a_typesVersions_field_with_version_specific_path_mappings: diag(6206, ts6.DiagnosticCategory.Message, "package_json_has_a_typesVersions_field_with_version_specific_path_mappings_6206", "'package.json' has a 'typesVersions' field with version-specific path mappings."), + package_json_does_not_have_a_typesVersions_entry_that_matches_version_0: diag(6207, ts6.DiagnosticCategory.Message, "package_json_does_not_have_a_typesVersions_entry_that_matches_version_0_6207", "'package.json' does not have a 'typesVersions' entry that matches version '{0}'."), + package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2: diag(6208, ts6.DiagnosticCategory.Message, "package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_ma_6208", "'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'."), + package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range: diag(6209, ts6.DiagnosticCategory.Message, "package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range_6209", "'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range."), + An_argument_for_0_was_not_provided: diag(6210, ts6.DiagnosticCategory.Message, "An_argument_for_0_was_not_provided_6210", "An argument for '{0}' was not provided."), + An_argument_matching_this_binding_pattern_was_not_provided: diag(6211, ts6.DiagnosticCategory.Message, "An_argument_matching_this_binding_pattern_was_not_provided_6211", "An argument matching this binding pattern was not provided."), + Did_you_mean_to_call_this_expression: diag(6212, ts6.DiagnosticCategory.Message, "Did_you_mean_to_call_this_expression_6212", "Did you mean to call this expression?"), + Did_you_mean_to_use_new_with_this_expression: diag(6213, ts6.DiagnosticCategory.Message, "Did_you_mean_to_use_new_with_this_expression_6213", "Did you mean to use 'new' with this expression?"), + Enable_strict_bind_call_and_apply_methods_on_functions: diag(6214, ts6.DiagnosticCategory.Message, "Enable_strict_bind_call_and_apply_methods_on_functions_6214", "Enable strict 'bind', 'call', and 'apply' methods on functions."), + Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts6.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."), + Found_1_error: diag(6216, ts6.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."), + Found_0_errors: diag(6217, ts6.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."), + Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts6.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"), + Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts6.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"), + package_json_had_a_falsy_0_field: diag(6220, ts6.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."), + Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects: diag(6221, ts6.DiagnosticCategory.Message, "Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects_6221", "Disable use of source files instead of declaration files from referenced projects."), + Emit_class_fields_with_Define_instead_of_Set: diag(6222, ts6.DiagnosticCategory.Message, "Emit_class_fields_with_Define_instead_of_Set_6222", "Emit class fields with Define instead of Set."), + Generates_a_CPU_profile: diag(6223, ts6.DiagnosticCategory.Message, "Generates_a_CPU_profile_6223", "Generates a CPU profile."), + Disable_solution_searching_for_this_project: diag(6224, ts6.DiagnosticCategory.Message, "Disable_solution_searching_for_this_project_6224", "Disable solution searching for this project."), + Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling_UseFsEvents_UseFsEventsOnParentDirectory: diag(6225, ts6.DiagnosticCategory.Message, "Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_Dynami_6225", "Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'."), + Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively_Colon_UseFsEvents_default_FixedPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling: diag(6226, ts6.DiagnosticCategory.Message, "Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively__6226", "Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling'."), + Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_FixedInterval_default_PriorityInterval_DynamicPriority_FixedChunkSize: diag(6227, ts6.DiagnosticCategory.Message, "Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_6227", "Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority', 'FixedChunkSize'."), + Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3: diag(6229, ts6.DiagnosticCategory.Error, "Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3_6229", "Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'."), + Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line: diag(6230, ts6.DiagnosticCategory.Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line_6230", "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line."), + Could_not_resolve_the_path_0_with_the_extensions_Colon_1: diag(6231, ts6.DiagnosticCategory.Error, "Could_not_resolve_the_path_0_with_the_extensions_Colon_1_6231", "Could not resolve the path '{0}' with the extensions: {1}."), + Declaration_augments_declaration_in_another_file_This_cannot_be_serialized: diag(6232, ts6.DiagnosticCategory.Error, "Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232", "Declaration augments declaration in another file. This cannot be serialized."), + This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file: diag(6233, ts6.DiagnosticCategory.Error, "This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233", "This is the declaration being augmented. Consider moving the augmenting declaration into the same file."), + This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without: diag(6234, ts6.DiagnosticCategory.Error, "This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without_6234", "This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?"), + Disable_loading_referenced_projects: diag(6235, ts6.DiagnosticCategory.Message, "Disable_loading_referenced_projects_6235", "Disable loading referenced projects."), + Arguments_for_the_rest_parameter_0_were_not_provided: diag(6236, ts6.DiagnosticCategory.Error, "Arguments_for_the_rest_parameter_0_were_not_provided_6236", "Arguments for the rest parameter '{0}' were not provided."), + Generates_an_event_trace_and_a_list_of_types: diag(6237, ts6.DiagnosticCategory.Message, "Generates_an_event_trace_and_a_list_of_types_6237", "Generates an event trace and a list of types."), + Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react: diag(6238, ts6.DiagnosticCategory.Error, "Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react_6238", "Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react"), + File_0_exists_according_to_earlier_cached_lookups: diag(6239, ts6.DiagnosticCategory.Message, "File_0_exists_according_to_earlier_cached_lookups_6239", "File '{0}' exists according to earlier cached lookups."), + File_0_does_not_exist_according_to_earlier_cached_lookups: diag(6240, ts6.DiagnosticCategory.Message, "File_0_does_not_exist_according_to_earlier_cached_lookups_6240", "File '{0}' does not exist according to earlier cached lookups."), + Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1: diag(6241, ts6.DiagnosticCategory.Message, "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241", "Resolution for type reference directive '{0}' was found in cache from location '{1}'."), + Resolving_type_reference_directive_0_containing_file_1: diag(6242, ts6.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_6242", "======== Resolving type reference directive '{0}', containing file '{1}'. ========"), + Interpret_optional_property_types_as_written_rather_than_adding_undefined: diag(6243, ts6.DiagnosticCategory.Message, "Interpret_optional_property_types_as_written_rather_than_adding_undefined_6243", "Interpret optional property types as written, rather than adding 'undefined'."), + Modules: diag(6244, ts6.DiagnosticCategory.Message, "Modules_6244", "Modules"), + File_Management: diag(6245, ts6.DiagnosticCategory.Message, "File_Management_6245", "File Management"), + Emit: diag(6246, ts6.DiagnosticCategory.Message, "Emit_6246", "Emit"), + JavaScript_Support: diag(6247, ts6.DiagnosticCategory.Message, "JavaScript_Support_6247", "JavaScript Support"), + Type_Checking: diag(6248, ts6.DiagnosticCategory.Message, "Type_Checking_6248", "Type Checking"), + Editor_Support: diag(6249, ts6.DiagnosticCategory.Message, "Editor_Support_6249", "Editor Support"), + Watch_and_Build_Modes: diag(6250, ts6.DiagnosticCategory.Message, "Watch_and_Build_Modes_6250", "Watch and Build Modes"), + Compiler_Diagnostics: diag(6251, ts6.DiagnosticCategory.Message, "Compiler_Diagnostics_6251", "Compiler Diagnostics"), + Interop_Constraints: diag(6252, ts6.DiagnosticCategory.Message, "Interop_Constraints_6252", "Interop Constraints"), + Backwards_Compatibility: diag(6253, ts6.DiagnosticCategory.Message, "Backwards_Compatibility_6253", "Backwards Compatibility"), + Language_and_Environment: diag(6254, ts6.DiagnosticCategory.Message, "Language_and_Environment_6254", "Language and Environment"), + Projects: diag(6255, ts6.DiagnosticCategory.Message, "Projects_6255", "Projects"), + Output_Formatting: diag(6256, ts6.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"), + Completeness: diag(6257, ts6.DiagnosticCategory.Message, "Completeness_6257", "Completeness"), + _0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts6.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"), + Found_1_error_in_1: diag(6259, ts6.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"), + Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, ts6.DiagnosticCategory.Message, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"), + Found_0_errors_in_1_files: diag(6261, ts6.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."), + Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts6.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."), + Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts6.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."), + Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts6.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."), + package_json_scope_0_has_no_imports_defined: diag(6273, ts6.DiagnosticCategory.Message, "package_json_scope_0_has_no_imports_defined_6273", "package.json scope '{0}' has no imports defined."), + package_json_scope_0_explicitly_maps_specifier_1_to_null: diag(6274, ts6.DiagnosticCategory.Message, "package_json_scope_0_explicitly_maps_specifier_1_to_null_6274", "package.json scope '{0}' explicitly maps specifier '{1}' to null."), + package_json_scope_0_has_invalid_type_for_target_of_specifier_1: diag(6275, ts6.DiagnosticCategory.Message, "package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275", "package.json scope '{0}' has invalid type for target of specifier '{1}'"), + Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6276, ts6.DiagnosticCategory.Message, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."), + Enable_project_compilation: diag(6302, ts6.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"), + Composite_projects_may_not_disable_declaration_emit: diag(6304, ts6.DiagnosticCategory.Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."), + Output_file_0_has_not_been_built_from_source_file_1: diag(6305, ts6.DiagnosticCategory.Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."), + Referenced_project_0_must_have_setting_composite_Colon_true: diag(6306, ts6.DiagnosticCategory.Error, "Referenced_project_0_must_have_setting_composite_Colon_true_6306", `Referenced project '{0}' must have setting "composite": true.`), + File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern: diag(6307, ts6.DiagnosticCategory.Error, "File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_includ_6307", "File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern."), + Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts6.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"), + Output_file_0_from_project_1_does_not_exist: diag(6309, ts6.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"), + Referenced_project_0_may_not_disable_emit: diag(6310, ts6.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."), + Project_0_is_out_of_date_because_output_1_is_older_than_input_2: diag(6350, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_1_is_older_than_input_2_6350", "Project '{0}' is out of date because output '{1}' is older than input '{2}'"), + Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2: diag(6351, ts6.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than output '{2}'"), + Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"), + Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"), + Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts6.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"), + Projects_in_this_build_Colon_0: diag(6355, ts6.DiagnosticCategory.Message, "Projects_in_this_build_Colon_0_6355", "Projects in this build: {0}"), + A_non_dry_build_would_delete_the_following_files_Colon_0: diag(6356, ts6.DiagnosticCategory.Message, "A_non_dry_build_would_delete_the_following_files_Colon_0_6356", "A non-dry build would delete the following files: {0}"), + A_non_dry_build_would_build_project_0: diag(6357, ts6.DiagnosticCategory.Message, "A_non_dry_build_would_build_project_0_6357", "A non-dry build would build project '{0}'"), + Building_project_0: diag(6358, ts6.DiagnosticCategory.Message, "Building_project_0_6358", "Building project '{0}'..."), + Updating_output_timestamps_of_project_0: diag(6359, ts6.DiagnosticCategory.Message, "Updating_output_timestamps_of_project_0_6359", "Updating output timestamps of project '{0}'..."), + Project_0_is_up_to_date: diag(6361, ts6.DiagnosticCategory.Message, "Project_0_is_up_to_date_6361", "Project '{0}' is up to date"), + Skipping_build_of_project_0_because_its_dependency_1_has_errors: diag(6362, ts6.DiagnosticCategory.Message, "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362", "Skipping build of project '{0}' because its dependency '{1}' has errors"), + Project_0_can_t_be_built_because_its_dependency_1_has_errors: diag(6363, ts6.DiagnosticCategory.Message, "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363", "Project '{0}' can't be built because its dependency '{1}' has errors"), + Build_one_or_more_projects_and_their_dependencies_if_out_of_date: diag(6364, ts6.DiagnosticCategory.Message, "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364", "Build one or more projects and their dependencies, if out of date"), + Delete_the_outputs_of_all_projects: diag(6365, ts6.DiagnosticCategory.Message, "Delete_the_outputs_of_all_projects_6365", "Delete the outputs of all projects."), + Show_what_would_be_built_or_deleted_if_specified_with_clean: diag(6367, ts6.DiagnosticCategory.Message, "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367", "Show what would be built (or deleted, if specified with '--clean')"), + Option_build_must_be_the_first_command_line_argument: diag(6369, ts6.DiagnosticCategory.Error, "Option_build_must_be_the_first_command_line_argument_6369", "Option '--build' must be the first command line argument."), + Options_0_and_1_cannot_be_combined: diag(6370, ts6.DiagnosticCategory.Error, "Options_0_and_1_cannot_be_combined_6370", "Options '{0}' and '{1}' cannot be combined."), + Updating_unchanged_output_timestamps_of_project_0: diag(6371, ts6.DiagnosticCategory.Message, "Updating_unchanged_output_timestamps_of_project_0_6371", "Updating unchanged output timestamps of project '{0}'..."), + Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed: diag(6372, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372", "Project '{0}' is out of date because output of its dependency '{1}' has changed"), + Updating_output_of_project_0: diag(6373, ts6.DiagnosticCategory.Message, "Updating_output_of_project_0_6373", "Updating output of project '{0}'..."), + A_non_dry_build_would_update_timestamps_for_output_of_project_0: diag(6374, ts6.DiagnosticCategory.Message, "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374", "A non-dry build would update timestamps for output of project '{0}'"), + A_non_dry_build_would_update_output_of_project_0: diag(6375, ts6.DiagnosticCategory.Message, "A_non_dry_build_would_update_output_of_project_0_6375", "A non-dry build would update output of project '{0}'"), + Cannot_update_output_of_project_0_because_there_was_error_reading_file_1: diag(6376, ts6.DiagnosticCategory.Message, "Cannot_update_output_of_project_0_because_there_was_error_reading_file_1_6376", "Cannot update output of project '{0}' because there was error reading file '{1}'"), + Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1: diag(6377, ts6.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1_6377", "Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'"), + Composite_projects_may_not_disable_incremental_compilation: diag(6379, ts6.DiagnosticCategory.Error, "Composite_projects_may_not_disable_incremental_compilation_6379", "Composite projects may not disable incremental compilation."), + Specify_file_to_store_incremental_compilation_information: diag(6380, ts6.DiagnosticCategory.Message, "Specify_file_to_store_incremental_compilation_information_6380", "Specify file to store incremental compilation information"), + Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2: diag(6381, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381", "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"), + Skipping_build_of_project_0_because_its_dependency_1_was_not_built: diag(6382, ts6.DiagnosticCategory.Message, "Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382", "Skipping build of project '{0}' because its dependency '{1}' was not built"), + Project_0_can_t_be_built_because_its_dependency_1_was_not_built: diag(6383, ts6.DiagnosticCategory.Message, "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383", "Project '{0}' can't be built because its dependency '{1}' was not built"), + Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6384, ts6.DiagnosticCategory.Message, "Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384", "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."), + _0_is_deprecated: diag( + 6385, + ts6.DiagnosticCategory.Suggestion, + "_0_is_deprecated_6385", + "'{0}' is deprecated.", + /*reportsUnnecessary*/ + void 0, + /*elidedInCompatabilityPyramid*/ + void 0, + /*reportsDeprecated*/ + true + ), + Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found: diag(6386, ts6.DiagnosticCategory.Message, "Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_nativ_6386", "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."), + The_signature_0_of_1_is_deprecated: diag( + 6387, + ts6.DiagnosticCategory.Suggestion, + "The_signature_0_of_1_is_deprecated_6387", + "The signature '{0}' of '{1}' is deprecated.", + /*reportsUnnecessary*/ + void 0, + /*elidedInCompatabilityPyramid*/ + void 0, + /*reportsDeprecated*/ + true + ), + Project_0_is_being_forcibly_rebuilt: diag(6388, ts6.DiagnosticCategory.Message, "Project_0_is_being_forcibly_rebuilt_6388", "Project '{0}' is being forcibly rebuilt"), + Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved: diag(6389, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved_6389", "Reusing resolution of module '{0}' from '{1}' of old program, it was not resolved."), + Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2: diag(6390, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6390", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."), + Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3: diag(6391, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6391", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."), + Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved: diag(6392, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved_6392", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was not resolved."), + Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6393, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6393", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."), + Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6394, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6394", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."), + Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6395, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved_6395", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), + Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."), + Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."), + Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts6.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), + Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), + Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts6.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts6.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts6.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts6.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts6.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts6.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), + The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts6.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), + The_expected_type_comes_from_this_index_signature: diag(6501, ts6.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), + The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts6.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), + Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing: diag(6503, ts6.DiagnosticCategory.Message, "Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing_6503", "Print names of files that are part of the compilation and then stop processing."), + File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option: diag(6504, ts6.DiagnosticCategory.Error, "File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option_6504", "File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?"), + Print_names_of_files_and_the_reason_they_are_part_of_the_compilation: diag(6505, ts6.DiagnosticCategory.Message, "Print_names_of_files_and_the_reason_they_are_part_of_the_compilation_6505", "Print names of files and the reason they are part of the compilation."), + Consider_adding_a_declare_modifier_to_this_class: diag(6506, ts6.DiagnosticCategory.Message, "Consider_adding_a_declare_modifier_to_this_class_6506", "Consider adding a 'declare' modifier to this class."), + Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files: diag(6600, ts6.DiagnosticCategory.Message, "Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600", "Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files."), + Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export: diag(6601, ts6.DiagnosticCategory.Message, "Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export_6601", "Allow 'import x from y' when a module doesn't have a default export."), + Allow_accessing_UMD_globals_from_modules: diag(6602, ts6.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_6602", "Allow accessing UMD globals from modules."), + Disable_error_reporting_for_unreachable_code: diag(6603, ts6.DiagnosticCategory.Message, "Disable_error_reporting_for_unreachable_code_6603", "Disable error reporting for unreachable code."), + Disable_error_reporting_for_unused_labels: diag(6604, ts6.DiagnosticCategory.Message, "Disable_error_reporting_for_unused_labels_6604", "Disable error reporting for unused labels."), + Ensure_use_strict_is_always_emitted: diag(6605, ts6.DiagnosticCategory.Message, "Ensure_use_strict_is_always_emitted_6605", "Ensure 'use strict' is always emitted."), + Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6606, ts6.DiagnosticCategory.Message, "Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_wi_6606", "Have recompiles in projects that use 'incremental' and 'watch' mode assume that changes within a file will only affect files directly depending on it."), + Specify_the_base_directory_to_resolve_non_relative_module_names: diag(6607, ts6.DiagnosticCategory.Message, "Specify_the_base_directory_to_resolve_non_relative_module_names_6607", "Specify the base directory to resolve non-relative module names."), + No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files: diag(6608, ts6.DiagnosticCategory.Message, "No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files_6608", "No longer supported. In early versions, manually set the text encoding for reading files."), + Enable_error_reporting_in_type_checked_JavaScript_files: diag(6609, ts6.DiagnosticCategory.Message, "Enable_error_reporting_in_type_checked_JavaScript_files_6609", "Enable error reporting in type-checked JavaScript files."), + Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references: diag(6611, ts6.DiagnosticCategory.Message, "Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references_6611", "Enable constraints that allow a TypeScript project to be used with project references."), + Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project: diag(6612, ts6.DiagnosticCategory.Message, "Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project_6612", "Generate .d.ts files from TypeScript and JavaScript files in your project."), + Specify_the_output_directory_for_generated_declaration_files: diag(6613, ts6.DiagnosticCategory.Message, "Specify_the_output_directory_for_generated_declaration_files_6613", "Specify the output directory for generated declaration files."), + Create_sourcemaps_for_d_ts_files: diag(6614, ts6.DiagnosticCategory.Message, "Create_sourcemaps_for_d_ts_files_6614", "Create sourcemaps for d.ts files."), + Output_compiler_performance_information_after_building: diag(6615, ts6.DiagnosticCategory.Message, "Output_compiler_performance_information_after_building_6615", "Output compiler performance information after building."), + Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project: diag(6616, ts6.DiagnosticCategory.Message, "Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project_6616", "Disables inference for type acquisition by looking at filenames in a project."), + Reduce_the_number_of_projects_loaded_automatically_by_TypeScript: diag(6617, ts6.DiagnosticCategory.Message, "Reduce_the_number_of_projects_loaded_automatically_by_TypeScript_6617", "Reduce the number of projects loaded automatically by TypeScript."), + Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server: diag(6618, ts6.DiagnosticCategory.Message, "Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server_6618", "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server."), + Opt_a_project_out_of_multi_project_reference_checking_when_editing: diag(6619, ts6.DiagnosticCategory.Message, "Opt_a_project_out_of_multi_project_reference_checking_when_editing_6619", "Opt a project out of multi-project reference checking when editing."), + Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects: diag(6620, ts6.DiagnosticCategory.Message, "Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects_6620", "Disable preferring source files instead of declaration files when referencing composite projects."), + Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration: diag(6621, ts6.DiagnosticCategory.Message, "Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration_6621", "Emit more compliant, but verbose and less performant JavaScript for iteration."), + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: diag(6622, ts6.DiagnosticCategory.Message, "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6622", "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."), + Only_output_d_ts_files_and_not_JavaScript_files: diag(6623, ts6.DiagnosticCategory.Message, "Only_output_d_ts_files_and_not_JavaScript_files_6623", "Only output d.ts files and not JavaScript files."), + Emit_design_type_metadata_for_decorated_declarations_in_source_files: diag(6624, ts6.DiagnosticCategory.Message, "Emit_design_type_metadata_for_decorated_declarations_in_source_files_6624", "Emit design-type metadata for decorated declarations in source files."), + Disable_the_type_acquisition_for_JavaScript_projects: diag(6625, ts6.DiagnosticCategory.Message, "Disable_the_type_acquisition_for_JavaScript_projects_6625", "Disable the type acquisition for JavaScript projects"), + Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility: diag(6626, ts6.DiagnosticCategory.Message, "Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheti_6626", "Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility."), + Filters_results_from_the_include_option: diag(6627, ts6.DiagnosticCategory.Message, "Filters_results_from_the_include_option_6627", "Filters results from the `include` option."), + Remove_a_list_of_directories_from_the_watch_process: diag(6628, ts6.DiagnosticCategory.Message, "Remove_a_list_of_directories_from_the_watch_process_6628", "Remove a list of directories from the watch process."), + Remove_a_list_of_files_from_the_watch_mode_s_processing: diag(6629, ts6.DiagnosticCategory.Message, "Remove_a_list_of_files_from_the_watch_mode_s_processing_6629", "Remove a list of files from the watch mode's processing."), + Enable_experimental_support_for_TC39_stage_2_draft_decorators: diag(6630, ts6.DiagnosticCategory.Message, "Enable_experimental_support_for_TC39_stage_2_draft_decorators_6630", "Enable experimental support for TC39 stage 2 draft decorators."), + Print_files_read_during_the_compilation_including_why_it_was_included: diag(6631, ts6.DiagnosticCategory.Message, "Print_files_read_during_the_compilation_including_why_it_was_included_6631", "Print files read during the compilation including why it was included."), + Output_more_detailed_compiler_performance_information_after_building: diag(6632, ts6.DiagnosticCategory.Message, "Output_more_detailed_compiler_performance_information_after_building_6632", "Output more detailed compiler performance information after building."), + Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_are_inherited: diag(6633, ts6.DiagnosticCategory.Message, "Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_a_6633", "Specify one or more path or node module references to base configuration files from which settings are inherited."), + Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers: diag(6634, ts6.DiagnosticCategory.Message, "Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers_6634", "Specify what approach the watcher should use if the system runs out of native file watchers."), + Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include: diag(6635, ts6.DiagnosticCategory.Message, "Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include_6635", "Include a list of files. This does not support glob patterns, as opposed to `include`."), + Build_all_projects_including_those_that_appear_to_be_up_to_date: diag(6636, ts6.DiagnosticCategory.Message, "Build_all_projects_including_those_that_appear_to_be_up_to_date_6636", "Build all projects, including those that appear to be up to date."), + Ensure_that_casing_is_correct_in_imports: diag(6637, ts6.DiagnosticCategory.Message, "Ensure_that_casing_is_correct_in_imports_6637", "Ensure that casing is correct in imports."), + Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging: diag(6638, ts6.DiagnosticCategory.Message, "Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging_6638", "Emit a v8 CPU profile of the compiler run for debugging."), + Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file: diag(6639, ts6.DiagnosticCategory.Message, "Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file_6639", "Allow importing helper functions from tslib once per project, instead of including them per-file."), + Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation: diag(6641, ts6.DiagnosticCategory.Message, "Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation_6641", "Specify a list of glob patterns that match files to be included in compilation."), + Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects: diag(6642, ts6.DiagnosticCategory.Message, "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642", "Save .tsbuildinfo files to allow for incremental compilation of projects."), + Include_sourcemap_files_inside_the_emitted_JavaScript: diag(6643, ts6.DiagnosticCategory.Message, "Include_sourcemap_files_inside_the_emitted_JavaScript_6643", "Include sourcemap files inside the emitted JavaScript."), + Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript: diag(6644, ts6.DiagnosticCategory.Message, "Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript_6644", "Include source code in the sourcemaps inside the emitted JavaScript."), + Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports: diag(6645, ts6.DiagnosticCategory.Message, "Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports_6645", "Ensure that each file can be safely transpiled without relying on other imports."), + Specify_what_JSX_code_is_generated: diag(6646, ts6.DiagnosticCategory.Message, "Specify_what_JSX_code_is_generated_6646", "Specify what JSX code is generated."), + Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h: diag(6647, ts6.DiagnosticCategory.Message, "Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h_6647", "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'."), + Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment: diag(6648, ts6.DiagnosticCategory.Message, "Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragme_6648", "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'."), + Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk: diag(6649, ts6.DiagnosticCategory.Message, "Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Ast_6649", "Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'."), + Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option: diag(6650, ts6.DiagnosticCategory.Message, "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650", "Make keyof only return strings instead of string, numbers or symbols. Legacy option."), + Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment: diag(6651, ts6.DiagnosticCategory.Message, "Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment_6651", "Specify a set of bundled library declaration files that describe the target runtime environment."), + Print_the_names_of_emitted_files_after_a_compilation: diag(6652, ts6.DiagnosticCategory.Message, "Print_the_names_of_emitted_files_after_a_compilation_6652", "Print the names of emitted files after a compilation."), + Print_all_of_the_files_read_during_the_compilation: diag(6653, ts6.DiagnosticCategory.Message, "Print_all_of_the_files_read_during_the_compilation_6653", "Print all of the files read during the compilation."), + Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit: diag(6654, ts6.DiagnosticCategory.Message, "Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit_6654", "Set the language of the messaging from TypeScript. This does not affect emit."), + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: diag(6655, ts6.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6655", "Specify the location where debugger should locate map files instead of generated locations."), + Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs: diag(6656, ts6.DiagnosticCategory.Message, "Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicabl_6656", "Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'."), + Specify_what_module_code_is_generated: diag(6657, ts6.DiagnosticCategory.Message, "Specify_what_module_code_is_generated_6657", "Specify what module code is generated."), + Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier: diag(6658, ts6.DiagnosticCategory.Message, "Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier_6658", "Specify how TypeScript looks up a file from a given module specifier."), + Set_the_newline_character_for_emitting_files: diag(6659, ts6.DiagnosticCategory.Message, "Set_the_newline_character_for_emitting_files_6659", "Set the newline character for emitting files."), + Disable_emitting_files_from_a_compilation: diag(6660, ts6.DiagnosticCategory.Message, "Disable_emitting_files_from_a_compilation_6660", "Disable emitting files from a compilation."), + Disable_generating_custom_helper_functions_like_extends_in_compiled_output: diag(6661, ts6.DiagnosticCategory.Message, "Disable_generating_custom_helper_functions_like_extends_in_compiled_output_6661", "Disable generating custom helper functions like '__extends' in compiled output."), + Disable_emitting_files_if_any_type_checking_errors_are_reported: diag(6662, ts6.DiagnosticCategory.Message, "Disable_emitting_files_if_any_type_checking_errors_are_reported_6662", "Disable emitting files if any type checking errors are reported."), + Disable_truncating_types_in_error_messages: diag(6663, ts6.DiagnosticCategory.Message, "Disable_truncating_types_in_error_messages_6663", "Disable truncating types in error messages."), + Enable_error_reporting_for_fallthrough_cases_in_switch_statements: diag(6664, ts6.DiagnosticCategory.Message, "Enable_error_reporting_for_fallthrough_cases_in_switch_statements_6664", "Enable error reporting for fallthrough cases in switch statements."), + Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type: diag(6665, ts6.DiagnosticCategory.Message, "Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type_6665", "Enable error reporting for expressions and declarations with an implied 'any' type."), + Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier: diag(6666, ts6.DiagnosticCategory.Message, "Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier_6666", "Ensure overriding members in derived classes are marked with an override modifier."), + Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function: diag(6667, ts6.DiagnosticCategory.Message, "Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function_6667", "Enable error reporting for codepaths that do not explicitly return in a function."), + Enable_error_reporting_when_this_is_given_the_type_any: diag(6668, ts6.DiagnosticCategory.Message, "Enable_error_reporting_when_this_is_given_the_type_any_6668", "Enable error reporting when 'this' is given the type 'any'."), + Disable_adding_use_strict_directives_in_emitted_JavaScript_files: diag(6669, ts6.DiagnosticCategory.Message, "Disable_adding_use_strict_directives_in_emitted_JavaScript_files_6669", "Disable adding 'use strict' directives in emitted JavaScript files."), + Disable_including_any_library_files_including_the_default_lib_d_ts: diag(6670, ts6.DiagnosticCategory.Message, "Disable_including_any_library_files_including_the_default_lib_d_ts_6670", "Disable including any library files, including the default lib.d.ts."), + Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type: diag(6671, ts6.DiagnosticCategory.Message, "Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type_6671", "Enforces using indexed accessors for keys declared using an indexed type."), + Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project: diag(6672, ts6.DiagnosticCategory.Message, "Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add__6672", "Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project."), + Disable_strict_checking_of_generic_signatures_in_function_types: diag(6673, ts6.DiagnosticCategory.Message, "Disable_strict_checking_of_generic_signatures_in_function_types_6673", "Disable strict checking of generic signatures in function types."), + Add_undefined_to_a_type_when_accessed_using_an_index: diag(6674, ts6.DiagnosticCategory.Message, "Add_undefined_to_a_type_when_accessed_using_an_index_6674", "Add 'undefined' to a type when accessed using an index."), + Enable_error_reporting_when_local_variables_aren_t_read: diag(6675, ts6.DiagnosticCategory.Message, "Enable_error_reporting_when_local_variables_aren_t_read_6675", "Enable error reporting when local variables aren't read."), + Raise_an_error_when_a_function_parameter_isn_t_read: diag(6676, ts6.DiagnosticCategory.Message, "Raise_an_error_when_a_function_parameter_isn_t_read_6676", "Raise an error when a function parameter isn't read."), + Deprecated_setting_Use_outFile_instead: diag(6677, ts6.DiagnosticCategory.Message, "Deprecated_setting_Use_outFile_instead_6677", "Deprecated setting. Use 'outFile' instead."), + Specify_an_output_folder_for_all_emitted_files: diag(6678, ts6.DiagnosticCategory.Message, "Specify_an_output_folder_for_all_emitted_files_6678", "Specify an output folder for all emitted files."), + Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output: diag(6679, ts6.DiagnosticCategory.Message, "Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designa_6679", "Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output."), + Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations: diag(6680, ts6.DiagnosticCategory.Message, "Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations_6680", "Specify a set of entries that re-map imports to additional lookup locations."), + Specify_a_list_of_language_service_plugins_to_include: diag(6681, ts6.DiagnosticCategory.Message, "Specify_a_list_of_language_service_plugins_to_include_6681", "Specify a list of language service plugins to include."), + Disable_erasing_const_enum_declarations_in_generated_code: diag(6682, ts6.DiagnosticCategory.Message, "Disable_erasing_const_enum_declarations_in_generated_code_6682", "Disable erasing 'const enum' declarations in generated code."), + Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node: diag(6683, ts6.DiagnosticCategory.Message, "Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node_6683", "Disable resolving symlinks to their realpath. This correlates to the same flag in node."), + Disable_wiping_the_console_in_watch_mode: diag(6684, ts6.DiagnosticCategory.Message, "Disable_wiping_the_console_in_watch_mode_6684", "Disable wiping the console in watch mode."), + Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read: diag(6685, ts6.DiagnosticCategory.Message, "Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read_6685", "Enable color and formatting in TypeScript's output to make compiler errors easier to read."), + Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit: diag(6686, ts6.DiagnosticCategory.Message, "Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit_6686", "Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit."), + Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references: diag(6687, ts6.DiagnosticCategory.Message, "Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references_6687", "Specify an array of objects that specify paths for projects. Used in project references."), + Disable_emitting_comments: diag(6688, ts6.DiagnosticCategory.Message, "Disable_emitting_comments_6688", "Disable emitting comments."), + Enable_importing_json_files: diag(6689, ts6.DiagnosticCategory.Message, "Enable_importing_json_files_6689", "Enable importing .json files."), + Specify_the_root_folder_within_your_source_files: diag(6690, ts6.DiagnosticCategory.Message, "Specify_the_root_folder_within_your_source_files_6690", "Specify the root folder within your source files."), + Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules: diag(6691, ts6.DiagnosticCategory.Message, "Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules_6691", "Allow multiple folders to be treated as one when resolving modules."), + Skip_type_checking_d_ts_files_that_are_included_with_TypeScript: diag(6692, ts6.DiagnosticCategory.Message, "Skip_type_checking_d_ts_files_that_are_included_with_TypeScript_6692", "Skip type checking .d.ts files that are included with TypeScript."), + Skip_type_checking_all_d_ts_files: diag(6693, ts6.DiagnosticCategory.Message, "Skip_type_checking_all_d_ts_files_6693", "Skip type checking all .d.ts files."), + Create_source_map_files_for_emitted_JavaScript_files: diag(6694, ts6.DiagnosticCategory.Message, "Create_source_map_files_for_emitted_JavaScript_files_6694", "Create source map files for emitted JavaScript files."), + Specify_the_root_path_for_debuggers_to_find_the_reference_source_code: diag(6695, ts6.DiagnosticCategory.Message, "Specify_the_root_path_for_debuggers_to_find_the_reference_source_code_6695", "Specify the root path for debuggers to find the reference source code."), + Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function: diag(6697, ts6.DiagnosticCategory.Message, "Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function_6697", "Check that the arguments for 'bind', 'call', and 'apply' methods match the original function."), + When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible: diag(6698, ts6.DiagnosticCategory.Message, "When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible_6698", "When assigning functions, check to ensure parameters and the return values are subtype-compatible."), + When_type_checking_take_into_account_null_and_undefined: diag(6699, ts6.DiagnosticCategory.Message, "When_type_checking_take_into_account_null_and_undefined_6699", "When type checking, take into account 'null' and 'undefined'."), + Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor: diag(6700, ts6.DiagnosticCategory.Message, "Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700", "Check for class properties that are declared but not set in the constructor."), + Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments: diag(6701, ts6.DiagnosticCategory.Message, "Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments_6701", "Disable emitting declarations that have '@internal' in their JSDoc comments."), + Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals: diag(6702, ts6.DiagnosticCategory.Message, "Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals_6702", "Disable reporting of excess property errors during the creation of object literals."), + Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures: diag(6703, ts6.DiagnosticCategory.Message, "Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703", "Suppress 'noImplicitAny' errors when indexing objects that lack index signatures."), + Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively: diag(6704, ts6.DiagnosticCategory.Message, "Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_supp_6704", "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively."), + Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations: diag(6705, ts6.DiagnosticCategory.Message, "Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declaratio_6705", "Set the JavaScript language version for emitted JavaScript and include compatible library declarations."), + Log_paths_used_during_the_moduleResolution_process: diag(6706, ts6.DiagnosticCategory.Message, "Log_paths_used_during_the_moduleResolution_process_6706", "Log paths used during the 'moduleResolution' process."), + Specify_the_path_to_tsbuildinfo_incremental_compilation_file: diag(6707, ts6.DiagnosticCategory.Message, "Specify_the_path_to_tsbuildinfo_incremental_compilation_file_6707", "Specify the path to .tsbuildinfo incremental compilation file."), + Specify_options_for_automatic_acquisition_of_declaration_files: diag(6709, ts6.DiagnosticCategory.Message, "Specify_options_for_automatic_acquisition_of_declaration_files_6709", "Specify options for automatic acquisition of declaration files."), + Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types: diag(6710, ts6.DiagnosticCategory.Message, "Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types_6710", "Specify multiple folders that act like './node_modules/@types'."), + Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file: diag(6711, ts6.DiagnosticCategory.Message, "Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file_6711", "Specify type package names to be included without being referenced in a source file."), + Emit_ECMAScript_standard_compliant_class_fields: diag(6712, ts6.DiagnosticCategory.Message, "Emit_ECMAScript_standard_compliant_class_fields_6712", "Emit ECMAScript-standard-compliant class fields."), + Enable_verbose_logging: diag(6713, ts6.DiagnosticCategory.Message, "Enable_verbose_logging_6713", "Enable verbose logging."), + Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality: diag(6714, ts6.DiagnosticCategory.Message, "Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality_6714", "Specify how directories are watched on systems that lack recursive file-watching functionality."), + Specify_how_the_TypeScript_watch_mode_works: diag(6715, ts6.DiagnosticCategory.Message, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."), + Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, ts6.DiagnosticCategory.Message, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."), + Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, ts6.DiagnosticCategory.Message, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."), + Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, ts6.DiagnosticCategory.Message, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."), + one_of_Colon: diag(6900, ts6.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"), + one_or_more_Colon: diag(6901, ts6.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"), + type_Colon: diag(6902, ts6.DiagnosticCategory.Message, "type_Colon_6902", "type:"), + default_Colon: diag(6903, ts6.DiagnosticCategory.Message, "default_Colon_6903", "default:"), + module_system_or_esModuleInterop: diag(6904, ts6.DiagnosticCategory.Message, "module_system_or_esModuleInterop_6904", 'module === "system" or esModuleInterop'), + false_unless_strict_is_set: diag(6905, ts6.DiagnosticCategory.Message, "false_unless_strict_is_set_6905", "`false`, unless `strict` is set"), + false_unless_composite_is_set: diag(6906, ts6.DiagnosticCategory.Message, "false_unless_composite_is_set_6906", "`false`, unless `composite` is set"), + node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified: diag(6907, ts6.DiagnosticCategory.Message, "node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified_6907", '`["node_modules", "bower_components", "jspm_packages"]`, plus the value of `outDir` if one is specified.'), + if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk: diag(6908, ts6.DiagnosticCategory.Message, "if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908", '`[]` if `files` is specified, otherwise `["**/*"]`'), + true_if_composite_false_otherwise: diag(6909, ts6.DiagnosticCategory.Message, "true_if_composite_false_otherwise_6909", "`true` if `composite`, `false` otherwise"), + module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node: diag(69010, ts6.DiagnosticCategory.Message, "module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node_69010", "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`"), + Computed_from_the_list_of_input_files: diag(6911, ts6.DiagnosticCategory.Message, "Computed_from_the_list_of_input_files_6911", "Computed from the list of input files"), + Platform_specific: diag(6912, ts6.DiagnosticCategory.Message, "Platform_specific_6912", "Platform specific"), + You_can_learn_about_all_of_the_compiler_options_at_0: diag(6913, ts6.DiagnosticCategory.Message, "You_can_learn_about_all_of_the_compiler_options_at_0_6913", "You can learn about all of the compiler options at {0}"), + Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon: diag(6914, ts6.DiagnosticCategory.Message, "Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_conf_6914", "Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:"), + Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0: diag(6915, ts6.DiagnosticCategory.Message, "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915", "Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}"), + COMMON_COMMANDS: diag(6916, ts6.DiagnosticCategory.Message, "COMMON_COMMANDS_6916", "COMMON COMMANDS"), + ALL_COMPILER_OPTIONS: diag(6917, ts6.DiagnosticCategory.Message, "ALL_COMPILER_OPTIONS_6917", "ALL COMPILER OPTIONS"), + WATCH_OPTIONS: diag(6918, ts6.DiagnosticCategory.Message, "WATCH_OPTIONS_6918", "WATCH OPTIONS"), + BUILD_OPTIONS: diag(6919, ts6.DiagnosticCategory.Message, "BUILD_OPTIONS_6919", "BUILD OPTIONS"), + COMMON_COMPILER_OPTIONS: diag(6920, ts6.DiagnosticCategory.Message, "COMMON_COMPILER_OPTIONS_6920", "COMMON COMPILER OPTIONS"), + COMMAND_LINE_FLAGS: diag(6921, ts6.DiagnosticCategory.Message, "COMMAND_LINE_FLAGS_6921", "COMMAND LINE FLAGS"), + tsc_Colon_The_TypeScript_Compiler: diag(6922, ts6.DiagnosticCategory.Message, "tsc_Colon_The_TypeScript_Compiler_6922", "tsc: The TypeScript Compiler"), + Compiles_the_current_project_tsconfig_json_in_the_working_directory: diag(6923, ts6.DiagnosticCategory.Message, "Compiles_the_current_project_tsconfig_json_in_the_working_directory_6923", "Compiles the current project (tsconfig.json in the working directory.)"), + Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options: diag(6924, ts6.DiagnosticCategory.Message, "Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options_6924", "Ignoring tsconfig.json, compiles the specified files with default compiler options."), + Build_a_composite_project_in_the_working_directory: diag(6925, ts6.DiagnosticCategory.Message, "Build_a_composite_project_in_the_working_directory_6925", "Build a composite project in the working directory."), + Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory: diag(6926, ts6.DiagnosticCategory.Message, "Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory_6926", "Creates a tsconfig.json with the recommended settings in the working directory."), + Compiles_the_TypeScript_project_located_at_the_specified_path: diag(6927, ts6.DiagnosticCategory.Message, "Compiles_the_TypeScript_project_located_at_the_specified_path_6927", "Compiles the TypeScript project located at the specified path."), + An_expanded_version_of_this_information_showing_all_possible_compiler_options: diag(6928, ts6.DiagnosticCategory.Message, "An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928", "An expanded version of this information, showing all possible compiler options"), + Compiles_the_current_project_with_additional_settings: diag(6929, ts6.DiagnosticCategory.Message, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."), + true_for_ES2022_and_above_including_ESNext: diag(6930, ts6.DiagnosticCategory.Message, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."), + List_of_file_name_suffixes_to_search_when_resolving_a_module: diag(6931, ts6.DiagnosticCategory.Error, "List_of_file_name_suffixes_to_search_when_resolving_a_module_6931", "List of file name suffixes to search when resolving a module."), + Variable_0_implicitly_has_an_1_type: diag(7005, ts6.DiagnosticCategory.Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."), + Parameter_0_implicitly_has_an_1_type: diag(7006, ts6.DiagnosticCategory.Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."), + Member_0_implicitly_has_an_1_type: diag(7008, ts6.DiagnosticCategory.Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."), + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, ts6.DiagnosticCategory.Error, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."), + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, ts6.DiagnosticCategory.Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."), + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, ts6.DiagnosticCategory.Error, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."), + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, ts6.DiagnosticCategory.Error, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."), + Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, ts6.DiagnosticCategory.Error, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."), + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, ts6.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."), + Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: diag(7016, ts6.DiagnosticCategory.Error, "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."), + Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: diag(7017, ts6.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", "Element implicitly has an 'any' type because type '{0}' has no index signature."), + Object_literal_s_property_0_implicitly_has_an_1_type: diag(7018, ts6.DiagnosticCategory.Error, "Object_literal_s_property_0_implicitly_has_an_1_type_7018", "Object literal's property '{0}' implicitly has an '{1}' type."), + Rest_parameter_0_implicitly_has_an_any_type: diag(7019, ts6.DiagnosticCategory.Error, "Rest_parameter_0_implicitly_has_an_any_type_7019", "Rest parameter '{0}' implicitly has an 'any[]' type."), + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7020, ts6.DiagnosticCategory.Error, "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", "Call signature, which lacks return-type annotation, implicitly has an 'any' return type."), + _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: diag(7022, ts6.DiagnosticCategory.Error, "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."), + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: diag(7023, ts6.DiagnosticCategory.Error, "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."), + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: diag(7024, ts6.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."), + Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation: diag(7025, ts6.DiagnosticCategory.Error, "Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_retu_7025", "Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation."), + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts6.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."), + Unreachable_code_detected: diag( + 7027, + ts6.DiagnosticCategory.Error, + "Unreachable_code_detected_7027", + "Unreachable code detected.", + /*reportsUnnecessary*/ + true + ), + Unused_label: diag( + 7028, + ts6.DiagnosticCategory.Error, + "Unused_label_7028", + "Unused label.", + /*reportsUnnecessary*/ + true + ), + Fallthrough_case_in_switch: diag(7029, ts6.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."), + Not_all_code_paths_return_a_value: diag(7030, ts6.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."), + Binding_element_0_implicitly_has_an_1_type: diag(7031, ts6.DiagnosticCategory.Error, "Binding_element_0_implicitly_has_an_1_type_7031", "Binding element '{0}' implicitly has an '{1}' type."), + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: diag(7032, ts6.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."), + Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: diag(7033, ts6.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."), + Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: diag(7034, ts6.DiagnosticCategory.Error, "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."), + Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts6.DiagnosticCategory.Error, "Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare__7035", "Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"), + Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts6.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."), + Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: diag(7037, ts6.DiagnosticCategory.Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."), + Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead: diag(7038, ts6.DiagnosticCategory.Message, "Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038", "Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead."), + Mapped_object_type_implicitly_has_an_any_template_type: diag(7039, ts6.DiagnosticCategory.Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."), + If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1: diag(7040, ts6.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_S_7040", "If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}'"), + The_containing_arrow_function_captures_the_global_value_of_this: diag(7041, ts6.DiagnosticCategory.Error, "The_containing_arrow_function_captures_the_global_value_of_this_7041", "The containing arrow function captures the global value of 'this'."), + Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used: diag(7042, ts6.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used_7042", "Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used."), + Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage: diag(7043, ts6.DiagnosticCategory.Suggestion, "Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7043", "Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."), + Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage: diag(7044, ts6.DiagnosticCategory.Suggestion, "Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7044", "Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."), + Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage: diag(7045, ts6.DiagnosticCategory.Suggestion, "Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7045", "Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."), + Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage: diag(7046, ts6.DiagnosticCategory.Suggestion, "Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage_7046", "Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage."), + Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage: diag(7047, ts6.DiagnosticCategory.Suggestion, "Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage_7047", "Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage."), + Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage: diag(7048, ts6.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage_7048", "Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage."), + Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts6.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."), + _0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts6.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."), + Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts6.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"), + Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts6.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?"), + Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts6.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."), + No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts6.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."), + _0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type: diag(7055, ts6.DiagnosticCategory.Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055", "'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type."), + The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed: diag(7056, ts6.DiagnosticCategory.Error, "The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056", "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."), + yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation: diag(7057, ts6.DiagnosticCategory.Error, "yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057", "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."), + If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1: diag(7058, ts6.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058", "If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"), + This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts6.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."), + This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts6.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."), + A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts6.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."), + You_cannot_rename_this_element: diag(8e3, ts6.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."), + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts6.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."), + import_can_only_be_used_in_TypeScript_files: diag(8002, ts6.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."), + export_can_only_be_used_in_TypeScript_files: diag(8003, ts6.DiagnosticCategory.Error, "export_can_only_be_used_in_TypeScript_files_8003", "'export =' can only be used in TypeScript files."), + Type_parameter_declarations_can_only_be_used_in_TypeScript_files: diag(8004, ts6.DiagnosticCategory.Error, "Type_parameter_declarations_can_only_be_used_in_TypeScript_files_8004", "Type parameter declarations can only be used in TypeScript files."), + implements_clauses_can_only_be_used_in_TypeScript_files: diag(8005, ts6.DiagnosticCategory.Error, "implements_clauses_can_only_be_used_in_TypeScript_files_8005", "'implements' clauses can only be used in TypeScript files."), + _0_declarations_can_only_be_used_in_TypeScript_files: diag(8006, ts6.DiagnosticCategory.Error, "_0_declarations_can_only_be_used_in_TypeScript_files_8006", "'{0}' declarations can only be used in TypeScript files."), + Type_aliases_can_only_be_used_in_TypeScript_files: diag(8008, ts6.DiagnosticCategory.Error, "Type_aliases_can_only_be_used_in_TypeScript_files_8008", "Type aliases can only be used in TypeScript files."), + The_0_modifier_can_only_be_used_in_TypeScript_files: diag(8009, ts6.DiagnosticCategory.Error, "The_0_modifier_can_only_be_used_in_TypeScript_files_8009", "The '{0}' modifier can only be used in TypeScript files."), + Type_annotations_can_only_be_used_in_TypeScript_files: diag(8010, ts6.DiagnosticCategory.Error, "Type_annotations_can_only_be_used_in_TypeScript_files_8010", "Type annotations can only be used in TypeScript files."), + Type_arguments_can_only_be_used_in_TypeScript_files: diag(8011, ts6.DiagnosticCategory.Error, "Type_arguments_can_only_be_used_in_TypeScript_files_8011", "Type arguments can only be used in TypeScript files."), + Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, ts6.DiagnosticCategory.Error, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."), + Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, ts6.DiagnosticCategory.Error, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."), + Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, ts6.DiagnosticCategory.Error, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."), + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, ts6.DiagnosticCategory.Error, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."), + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, ts6.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."), + Report_errors_in_js_files: diag(8019, ts6.DiagnosticCategory.Message, "Report_errors_in_js_files_8019", "Report errors in .js files."), + JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, ts6.DiagnosticCategory.Error, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."), + JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, ts6.DiagnosticCategory.Error, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."), + JSDoc_0_is_not_attached_to_a_class: diag(8022, ts6.DiagnosticCategory.Error, "JSDoc_0_is_not_attached_to_a_class_8022", "JSDoc '@{0}' is not attached to a class."), + JSDoc_0_1_does_not_match_the_extends_2_clause: diag(8023, ts6.DiagnosticCategory.Error, "JSDoc_0_1_does_not_match_the_extends_2_clause_8023", "JSDoc '@{0} {1}' does not match the 'extends {2}' clause."), + JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name: diag(8024, ts6.DiagnosticCategory.Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name."), + Class_declarations_cannot_have_more_than_one_augments_or_extends_tag: diag(8025, ts6.DiagnosticCategory.Error, "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025", "Class declarations cannot have more than one '@augments' or '@extends' tag."), + Expected_0_type_arguments_provide_these_with_an_extends_tag: diag(8026, ts6.DiagnosticCategory.Error, "Expected_0_type_arguments_provide_these_with_an_extends_tag_8026", "Expected {0} type arguments; provide these with an '@extends' tag."), + Expected_0_1_type_arguments_provide_these_with_an_extends_tag: diag(8027, ts6.DiagnosticCategory.Error, "Expected_0_1_type_arguments_provide_these_with_an_extends_tag_8027", "Expected {0}-{1} type arguments; provide these with an '@extends' tag."), + JSDoc_may_only_appear_in_the_last_parameter_of_a_signature: diag(8028, ts6.DiagnosticCategory.Error, "JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028", "JSDoc '...' may only appear in the last parameter of a signature."), + JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type: diag(8029, ts6.DiagnosticCategory.Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type."), + The_type_of_a_function_declaration_must_match_the_function_s_signature: diag(8030, ts6.DiagnosticCategory.Error, "The_type_of_a_function_declaration_must_match_the_function_s_signature_8030", "The type of a function declaration must match the function's signature."), + You_cannot_rename_a_module_via_a_global_import: diag(8031, ts6.DiagnosticCategory.Error, "You_cannot_rename_a_module_via_a_global_import_8031", "You cannot rename a module via a global import."), + Qualified_name_0_is_not_allowed_without_a_leading_param_object_1: diag(8032, ts6.DiagnosticCategory.Error, "Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032", "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."), + A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags: diag(8033, ts6.DiagnosticCategory.Error, "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033", "A JSDoc '@typedef' comment may not contain multiple '@type' tags."), + The_tag_was_first_specified_here: diag(8034, ts6.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), + You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts6.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), + You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts6.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts6.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), + Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts6.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), + Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts6.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), + JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, ts6.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), + JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, ts6.DiagnosticCategory.Error, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."), + Expected_corresponding_JSX_closing_tag_for_0: diag(17002, ts6.DiagnosticCategory.Error, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."), + Cannot_use_JSX_unless_the_jsx_flag_is_provided: diag(17004, ts6.DiagnosticCategory.Error, "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", "Cannot use JSX unless the '--jsx' flag is provided."), + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: diag(17005, ts6.DiagnosticCategory.Error, "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", "A constructor cannot contain a 'super' call when its class extends 'null'."), + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17006, ts6.DiagnosticCategory.Error, "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."), + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17007, ts6.DiagnosticCategory.Error, "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."), + JSX_element_0_has_no_corresponding_closing_tag: diag(17008, ts6.DiagnosticCategory.Error, "JSX_element_0_has_no_corresponding_closing_tag_17008", "JSX element '{0}' has no corresponding closing tag."), + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: diag(17009, ts6.DiagnosticCategory.Error, "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", "'super' must be called before accessing 'this' in the constructor of a derived class."), + Unknown_type_acquisition_option_0: diag(17010, ts6.DiagnosticCategory.Error, "Unknown_type_acquisition_option_0_17010", "Unknown type acquisition option '{0}'."), + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts6.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts6.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts6.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts6.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts6.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, ts6.DiagnosticCategory.Error, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."), + An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, ts6.DiagnosticCategory.Error, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."), + Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, ts6.DiagnosticCategory.Error, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"), + Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, ts6.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), + The_files_list_in_config_file_0_is_empty: diag(18002, ts6.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), + No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, ts6.DiagnosticCategory.Error, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."), + File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module: diag(80001, ts6.DiagnosticCategory.Suggestion, "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001", "File is a CommonJS module; it may be converted to an ES module."), + This_constructor_function_may_be_converted_to_a_class_declaration: diag(80002, ts6.DiagnosticCategory.Suggestion, "This_constructor_function_may_be_converted_to_a_class_declaration_80002", "This constructor function may be converted to a class declaration."), + Import_may_be_converted_to_a_default_import: diag(80003, ts6.DiagnosticCategory.Suggestion, "Import_may_be_converted_to_a_default_import_80003", "Import may be converted to a default import."), + JSDoc_types_may_be_moved_to_TypeScript_types: diag(80004, ts6.DiagnosticCategory.Suggestion, "JSDoc_types_may_be_moved_to_TypeScript_types_80004", "JSDoc types may be moved to TypeScript types."), + require_call_may_be_converted_to_an_import: diag(80005, ts6.DiagnosticCategory.Suggestion, "require_call_may_be_converted_to_an_import_80005", "'require' call may be converted to an import."), + This_may_be_converted_to_an_async_function: diag(80006, ts6.DiagnosticCategory.Suggestion, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."), + await_has_no_effect_on_the_type_of_this_expression: diag(80007, ts6.DiagnosticCategory.Suggestion, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."), + Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, ts6.DiagnosticCategory.Suggestion, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."), + Add_missing_super_call: diag(90001, ts6.DiagnosticCategory.Message, "Add_missing_super_call_90001", "Add missing 'super()' call"), + Make_super_call_the_first_statement_in_the_constructor: diag(90002, ts6.DiagnosticCategory.Message, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"), + Change_extends_to_implements: diag(90003, ts6.DiagnosticCategory.Message, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"), + Remove_unused_declaration_for_Colon_0: diag(90004, ts6.DiagnosticCategory.Message, "Remove_unused_declaration_for_Colon_0_90004", "Remove unused declaration for: '{0}'"), + Remove_import_from_0: diag(90005, ts6.DiagnosticCategory.Message, "Remove_import_from_0_90005", "Remove import from '{0}'"), + Implement_interface_0: diag(90006, ts6.DiagnosticCategory.Message, "Implement_interface_0_90006", "Implement interface '{0}'"), + Implement_inherited_abstract_class: diag(90007, ts6.DiagnosticCategory.Message, "Implement_inherited_abstract_class_90007", "Implement inherited abstract class"), + Add_0_to_unresolved_variable: diag(90008, ts6.DiagnosticCategory.Message, "Add_0_to_unresolved_variable_90008", "Add '{0}.' to unresolved variable"), + Remove_variable_statement: diag(90010, ts6.DiagnosticCategory.Message, "Remove_variable_statement_90010", "Remove variable statement"), + Remove_template_tag: diag(90011, ts6.DiagnosticCategory.Message, "Remove_template_tag_90011", "Remove template tag"), + Remove_type_parameters: diag(90012, ts6.DiagnosticCategory.Message, "Remove_type_parameters_90012", "Remove type parameters"), + Import_0_from_1: diag(90013, ts6.DiagnosticCategory.Message, "Import_0_from_1_90013", `Import '{0}' from "{1}"`), + Change_0_to_1: diag(90014, ts6.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"), + Declare_property_0: diag(90016, ts6.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'"), + Add_index_signature_for_property_0: diag(90017, ts6.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"), + Disable_checking_for_this_file: diag(90018, ts6.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"), + Ignore_this_error_message: diag(90019, ts6.DiagnosticCategory.Message, "Ignore_this_error_message_90019", "Ignore this error message"), + Initialize_property_0_in_the_constructor: diag(90020, ts6.DiagnosticCategory.Message, "Initialize_property_0_in_the_constructor_90020", "Initialize property '{0}' in the constructor"), + Initialize_static_property_0: diag(90021, ts6.DiagnosticCategory.Message, "Initialize_static_property_0_90021", "Initialize static property '{0}'"), + Change_spelling_to_0: diag(90022, ts6.DiagnosticCategory.Message, "Change_spelling_to_0_90022", "Change spelling to '{0}'"), + Declare_method_0: diag(90023, ts6.DiagnosticCategory.Message, "Declare_method_0_90023", "Declare method '{0}'"), + Declare_static_method_0: diag(90024, ts6.DiagnosticCategory.Message, "Declare_static_method_0_90024", "Declare static method '{0}'"), + Prefix_0_with_an_underscore: diag(90025, ts6.DiagnosticCategory.Message, "Prefix_0_with_an_underscore_90025", "Prefix '{0}' with an underscore"), + Rewrite_as_the_indexed_access_type_0: diag(90026, ts6.DiagnosticCategory.Message, "Rewrite_as_the_indexed_access_type_0_90026", "Rewrite as the indexed access type '{0}'"), + Declare_static_property_0: diag(90027, ts6.DiagnosticCategory.Message, "Declare_static_property_0_90027", "Declare static property '{0}'"), + Call_decorator_expression: diag(90028, ts6.DiagnosticCategory.Message, "Call_decorator_expression_90028", "Call decorator expression"), + Add_async_modifier_to_containing_function: diag(90029, ts6.DiagnosticCategory.Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"), + Replace_infer_0_with_unknown: diag(90030, ts6.DiagnosticCategory.Message, "Replace_infer_0_with_unknown_90030", "Replace 'infer {0}' with 'unknown'"), + Replace_all_unused_infer_with_unknown: diag(90031, ts6.DiagnosticCategory.Message, "Replace_all_unused_infer_with_unknown_90031", "Replace all unused 'infer' with 'unknown'"), + Add_parameter_name: diag(90034, ts6.DiagnosticCategory.Message, "Add_parameter_name_90034", "Add parameter name"), + Declare_private_property_0: diag(90035, ts6.DiagnosticCategory.Message, "Declare_private_property_0_90035", "Declare private property '{0}'"), + Replace_0_with_Promise_1: diag(90036, ts6.DiagnosticCategory.Message, "Replace_0_with_Promise_1_90036", "Replace '{0}' with 'Promise<{1}>'"), + Fix_all_incorrect_return_type_of_an_async_functions: diag(90037, ts6.DiagnosticCategory.Message, "Fix_all_incorrect_return_type_of_an_async_functions_90037", "Fix all incorrect return type of an async functions"), + Declare_private_method_0: diag(90038, ts6.DiagnosticCategory.Message, "Declare_private_method_0_90038", "Declare private method '{0}'"), + Remove_unused_destructuring_declaration: diag(90039, ts6.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"), + Remove_unused_declarations_for_Colon_0: diag(90041, ts6.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"), + Declare_a_private_field_named_0: diag(90053, ts6.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."), + Includes_imports_of_types_referenced_by_0: diag(90054, ts6.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"), + Remove_type_from_import_declaration_from_0: diag(90055, ts6.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", `Remove 'type' from import declaration from "{0}"`), + Remove_type_from_import_of_0_from_1: diag(90056, ts6.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", `Remove 'type' from import of '{0}' from "{1}"`), + Add_import_from_0: diag(90057, ts6.DiagnosticCategory.Message, "Add_import_from_0_90057", 'Add import from "{0}"'), + Update_import_from_0: diag(90058, ts6.DiagnosticCategory.Message, "Update_import_from_0_90058", 'Update import from "{0}"'), + Export_0_from_module_1: diag(90059, ts6.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts6.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), + Convert_function_to_an_ES2015_class: diag(95001, ts6.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), + Convert_0_to_1_in_0: diag(95003, ts6.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), + Extract_to_0_in_1: diag(95004, ts6.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), + Extract_function: diag(95005, ts6.DiagnosticCategory.Message, "Extract_function_95005", "Extract function"), + Extract_constant: diag(95006, ts6.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"), + Extract_to_0_in_enclosing_scope: diag(95007, ts6.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"), + Extract_to_0_in_1_scope: diag(95008, ts6.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"), + Annotate_with_type_from_JSDoc: diag(95009, ts6.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"), + Infer_type_of_0_from_usage: diag(95011, ts6.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage"), + Infer_parameter_types_from_usage: diag(95012, ts6.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage"), + Convert_to_default_import: diag(95013, ts6.DiagnosticCategory.Message, "Convert_to_default_import_95013", "Convert to default import"), + Install_0: diag(95014, ts6.DiagnosticCategory.Message, "Install_0_95014", "Install '{0}'"), + Replace_import_with_0: diag(95015, ts6.DiagnosticCategory.Message, "Replace_import_with_0_95015", "Replace import with '{0}'."), + Use_synthetic_default_member: diag(95016, ts6.DiagnosticCategory.Message, "Use_synthetic_default_member_95016", "Use synthetic 'default' member."), + Convert_to_ES_module: diag(95017, ts6.DiagnosticCategory.Message, "Convert_to_ES_module_95017", "Convert to ES module"), + Add_undefined_type_to_property_0: diag(95018, ts6.DiagnosticCategory.Message, "Add_undefined_type_to_property_0_95018", "Add 'undefined' type to property '{0}'"), + Add_initializer_to_property_0: diag(95019, ts6.DiagnosticCategory.Message, "Add_initializer_to_property_0_95019", "Add initializer to property '{0}'"), + Add_definite_assignment_assertion_to_property_0: diag(95020, ts6.DiagnosticCategory.Message, "Add_definite_assignment_assertion_to_property_0_95020", "Add definite assignment assertion to property '{0}'"), + Convert_all_type_literals_to_mapped_type: diag(95021, ts6.DiagnosticCategory.Message, "Convert_all_type_literals_to_mapped_type_95021", "Convert all type literals to mapped type"), + Add_all_missing_members: diag(95022, ts6.DiagnosticCategory.Message, "Add_all_missing_members_95022", "Add all missing members"), + Infer_all_types_from_usage: diag(95023, ts6.DiagnosticCategory.Message, "Infer_all_types_from_usage_95023", "Infer all types from usage"), + Delete_all_unused_declarations: diag(95024, ts6.DiagnosticCategory.Message, "Delete_all_unused_declarations_95024", "Delete all unused declarations"), + Prefix_all_unused_declarations_with_where_possible: diag(95025, ts6.DiagnosticCategory.Message, "Prefix_all_unused_declarations_with_where_possible_95025", "Prefix all unused declarations with '_' where possible"), + Fix_all_detected_spelling_errors: diag(95026, ts6.DiagnosticCategory.Message, "Fix_all_detected_spelling_errors_95026", "Fix all detected spelling errors"), + Add_initializers_to_all_uninitialized_properties: diag(95027, ts6.DiagnosticCategory.Message, "Add_initializers_to_all_uninitialized_properties_95027", "Add initializers to all uninitialized properties"), + Add_definite_assignment_assertions_to_all_uninitialized_properties: diag(95028, ts6.DiagnosticCategory.Message, "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028", "Add definite assignment assertions to all uninitialized properties"), + Add_undefined_type_to_all_uninitialized_properties: diag(95029, ts6.DiagnosticCategory.Message, "Add_undefined_type_to_all_uninitialized_properties_95029", "Add undefined type to all uninitialized properties"), + Change_all_jsdoc_style_types_to_TypeScript: diag(95030, ts6.DiagnosticCategory.Message, "Change_all_jsdoc_style_types_to_TypeScript_95030", "Change all jsdoc-style types to TypeScript"), + Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types: diag(95031, ts6.DiagnosticCategory.Message, "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031", "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)"), + Implement_all_unimplemented_interfaces: diag(95032, ts6.DiagnosticCategory.Message, "Implement_all_unimplemented_interfaces_95032", "Implement all unimplemented interfaces"), + Install_all_missing_types_packages: diag(95033, ts6.DiagnosticCategory.Message, "Install_all_missing_types_packages_95033", "Install all missing types packages"), + Rewrite_all_as_indexed_access_types: diag(95034, ts6.DiagnosticCategory.Message, "Rewrite_all_as_indexed_access_types_95034", "Rewrite all as indexed access types"), + Convert_all_to_default_imports: diag(95035, ts6.DiagnosticCategory.Message, "Convert_all_to_default_imports_95035", "Convert all to default imports"), + Make_all_super_calls_the_first_statement_in_their_constructor: diag(95036, ts6.DiagnosticCategory.Message, "Make_all_super_calls_the_first_statement_in_their_constructor_95036", "Make all 'super()' calls the first statement in their constructor"), + Add_qualifier_to_all_unresolved_variables_matching_a_member_name: diag(95037, ts6.DiagnosticCategory.Message, "Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037", "Add qualifier to all unresolved variables matching a member name"), + Change_all_extended_interfaces_to_implements: diag(95038, ts6.DiagnosticCategory.Message, "Change_all_extended_interfaces_to_implements_95038", "Change all extended interfaces to 'implements'"), + Add_all_missing_super_calls: diag(95039, ts6.DiagnosticCategory.Message, "Add_all_missing_super_calls_95039", "Add all missing super calls"), + Implement_all_inherited_abstract_classes: diag(95040, ts6.DiagnosticCategory.Message, "Implement_all_inherited_abstract_classes_95040", "Implement all inherited abstract classes"), + Add_all_missing_async_modifiers: diag(95041, ts6.DiagnosticCategory.Message, "Add_all_missing_async_modifiers_95041", "Add all missing 'async' modifiers"), + Add_ts_ignore_to_all_error_messages: diag(95042, ts6.DiagnosticCategory.Message, "Add_ts_ignore_to_all_error_messages_95042", "Add '@ts-ignore' to all error messages"), + Annotate_everything_with_types_from_JSDoc: diag(95043, ts6.DiagnosticCategory.Message, "Annotate_everything_with_types_from_JSDoc_95043", "Annotate everything with types from JSDoc"), + Add_to_all_uncalled_decorators: diag(95044, ts6.DiagnosticCategory.Message, "Add_to_all_uncalled_decorators_95044", "Add '()' to all uncalled decorators"), + Convert_all_constructor_functions_to_classes: diag(95045, ts6.DiagnosticCategory.Message, "Convert_all_constructor_functions_to_classes_95045", "Convert all constructor functions to classes"), + Generate_get_and_set_accessors: diag(95046, ts6.DiagnosticCategory.Message, "Generate_get_and_set_accessors_95046", "Generate 'get' and 'set' accessors"), + Convert_require_to_import: diag(95047, ts6.DiagnosticCategory.Message, "Convert_require_to_import_95047", "Convert 'require' to 'import'"), + Convert_all_require_to_import: diag(95048, ts6.DiagnosticCategory.Message, "Convert_all_require_to_import_95048", "Convert all 'require' to 'import'"), + Move_to_a_new_file: diag(95049, ts6.DiagnosticCategory.Message, "Move_to_a_new_file_95049", "Move to a new file"), + Remove_unreachable_code: diag(95050, ts6.DiagnosticCategory.Message, "Remove_unreachable_code_95050", "Remove unreachable code"), + Remove_all_unreachable_code: diag(95051, ts6.DiagnosticCategory.Message, "Remove_all_unreachable_code_95051", "Remove all unreachable code"), + Add_missing_typeof: diag(95052, ts6.DiagnosticCategory.Message, "Add_missing_typeof_95052", "Add missing 'typeof'"), + Remove_unused_label: diag(95053, ts6.DiagnosticCategory.Message, "Remove_unused_label_95053", "Remove unused label"), + Remove_all_unused_labels: diag(95054, ts6.DiagnosticCategory.Message, "Remove_all_unused_labels_95054", "Remove all unused labels"), + Convert_0_to_mapped_object_type: diag(95055, ts6.DiagnosticCategory.Message, "Convert_0_to_mapped_object_type_95055", "Convert '{0}' to mapped object type"), + Convert_namespace_import_to_named_imports: diag(95056, ts6.DiagnosticCategory.Message, "Convert_namespace_import_to_named_imports_95056", "Convert namespace import to named imports"), + Convert_named_imports_to_namespace_import: diag(95057, ts6.DiagnosticCategory.Message, "Convert_named_imports_to_namespace_import_95057", "Convert named imports to namespace import"), + Add_or_remove_braces_in_an_arrow_function: diag(95058, ts6.DiagnosticCategory.Message, "Add_or_remove_braces_in_an_arrow_function_95058", "Add or remove braces in an arrow function"), + Add_braces_to_arrow_function: diag(95059, ts6.DiagnosticCategory.Message, "Add_braces_to_arrow_function_95059", "Add braces to arrow function"), + Remove_braces_from_arrow_function: diag(95060, ts6.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_95060", "Remove braces from arrow function"), + Convert_default_export_to_named_export: diag(95061, ts6.DiagnosticCategory.Message, "Convert_default_export_to_named_export_95061", "Convert default export to named export"), + Convert_named_export_to_default_export: diag(95062, ts6.DiagnosticCategory.Message, "Convert_named_export_to_default_export_95062", "Convert named export to default export"), + Add_missing_enum_member_0: diag(95063, ts6.DiagnosticCategory.Message, "Add_missing_enum_member_0_95063", "Add missing enum member '{0}'"), + Add_all_missing_imports: diag(95064, ts6.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"), + Convert_to_async_function: diag(95065, ts6.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"), + Convert_all_to_async_functions: diag(95066, ts6.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"), + Add_missing_call_parentheses: diag(95067, ts6.DiagnosticCategory.Message, "Add_missing_call_parentheses_95067", "Add missing call parentheses"), + Add_all_missing_call_parentheses: diag(95068, ts6.DiagnosticCategory.Message, "Add_all_missing_call_parentheses_95068", "Add all missing call parentheses"), + Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts6.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"), + Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts6.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"), + Add_missing_new_operator_to_call: diag(95071, ts6.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"), + Add_missing_new_operator_to_all_calls: diag(95072, ts6.DiagnosticCategory.Message, "Add_missing_new_operator_to_all_calls_95072", "Add missing 'new' operator to all calls"), + Add_names_to_all_parameters_without_names: diag(95073, ts6.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"), + Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts6.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"), + Convert_parameters_to_destructured_object: diag(95075, ts6.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"), + Extract_type: diag(95077, ts6.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"), + Extract_to_type_alias: diag(95078, ts6.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"), + Extract_to_typedef: diag(95079, ts6.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"), + Infer_this_type_of_0_from_usage: diag(95080, ts6.DiagnosticCategory.Message, "Infer_this_type_of_0_from_usage_95080", "Infer 'this' type of '{0}' from usage"), + Add_const_to_unresolved_variable: diag(95081, ts6.DiagnosticCategory.Message, "Add_const_to_unresolved_variable_95081", "Add 'const' to unresolved variable"), + Add_const_to_all_unresolved_variables: diag(95082, ts6.DiagnosticCategory.Message, "Add_const_to_all_unresolved_variables_95082", "Add 'const' to all unresolved variables"), + Add_await: diag(95083, ts6.DiagnosticCategory.Message, "Add_await_95083", "Add 'await'"), + Add_await_to_initializer_for_0: diag(95084, ts6.DiagnosticCategory.Message, "Add_await_to_initializer_for_0_95084", "Add 'await' to initializer for '{0}'"), + Fix_all_expressions_possibly_missing_await: diag(95085, ts6.DiagnosticCategory.Message, "Fix_all_expressions_possibly_missing_await_95085", "Fix all expressions possibly missing 'await'"), + Remove_unnecessary_await: diag(95086, ts6.DiagnosticCategory.Message, "Remove_unnecessary_await_95086", "Remove unnecessary 'await'"), + Remove_all_unnecessary_uses_of_await: diag(95087, ts6.DiagnosticCategory.Message, "Remove_all_unnecessary_uses_of_await_95087", "Remove all unnecessary uses of 'await'"), + Enable_the_jsx_flag_in_your_configuration_file: diag(95088, ts6.DiagnosticCategory.Message, "Enable_the_jsx_flag_in_your_configuration_file_95088", "Enable the '--jsx' flag in your configuration file"), + Add_await_to_initializers: diag(95089, ts6.DiagnosticCategory.Message, "Add_await_to_initializers_95089", "Add 'await' to initializers"), + Extract_to_interface: diag(95090, ts6.DiagnosticCategory.Message, "Extract_to_interface_95090", "Extract to interface"), + Convert_to_a_bigint_numeric_literal: diag(95091, ts6.DiagnosticCategory.Message, "Convert_to_a_bigint_numeric_literal_95091", "Convert to a bigint numeric literal"), + Convert_all_to_bigint_numeric_literals: diag(95092, ts6.DiagnosticCategory.Message, "Convert_all_to_bigint_numeric_literals_95092", "Convert all to bigint numeric literals"), + Convert_const_to_let: diag(95093, ts6.DiagnosticCategory.Message, "Convert_const_to_let_95093", "Convert 'const' to 'let'"), + Prefix_with_declare: diag(95094, ts6.DiagnosticCategory.Message, "Prefix_with_declare_95094", "Prefix with 'declare'"), + Prefix_all_incorrect_property_declarations_with_declare: diag(95095, ts6.DiagnosticCategory.Message, "Prefix_all_incorrect_property_declarations_with_declare_95095", "Prefix all incorrect property declarations with 'declare'"), + Convert_to_template_string: diag(95096, ts6.DiagnosticCategory.Message, "Convert_to_template_string_95096", "Convert to template string"), + Add_export_to_make_this_file_into_a_module: diag(95097, ts6.DiagnosticCategory.Message, "Add_export_to_make_this_file_into_a_module_95097", "Add 'export {}' to make this file into a module"), + Set_the_target_option_in_your_configuration_file_to_0: diag(95098, ts6.DiagnosticCategory.Message, "Set_the_target_option_in_your_configuration_file_to_0_95098", "Set the 'target' option in your configuration file to '{0}'"), + Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts6.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), + Convert_invalid_character_to_its_html_entity_code: diag(95100, ts6.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), + Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts6.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts6.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), + Convert_function_expression_0_to_arrow_function: diag(95105, ts6.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), + Convert_function_declaration_0_to_arrow_function: diag(95106, ts6.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), + Fix_all_implicit_this_errors: diag(95107, ts6.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), + Wrap_invalid_character_in_an_expression_container: diag(95108, ts6.DiagnosticCategory.Message, "Wrap_invalid_character_in_an_expression_container_95108", "Wrap invalid character in an expression container"), + Wrap_all_invalid_characters_in_an_expression_container: diag(95109, ts6.DiagnosticCategory.Message, "Wrap_all_invalid_characters_in_an_expression_container_95109", "Wrap all invalid characters in an expression container"), + Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file: diag(95110, ts6.DiagnosticCategory.Message, "Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file_95110", "Visit https://aka.ms/tsconfig to read more about this file"), + Add_a_return_statement: diag(95111, ts6.DiagnosticCategory.Message, "Add_a_return_statement_95111", "Add a return statement"), + Remove_braces_from_arrow_function_body: diag(95112, ts6.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"), + Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal: diag(95113, ts6.DiagnosticCategory.Message, "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113", "Wrap the following body with parentheses which should be an object literal"), + Add_all_missing_return_statement: diag(95114, ts6.DiagnosticCategory.Message, "Add_all_missing_return_statement_95114", "Add all missing return statement"), + Remove_braces_from_all_arrow_function_bodies_with_relevant_issues: diag(95115, ts6.DiagnosticCategory.Message, "Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115", "Remove braces from all arrow function bodies with relevant issues"), + Wrap_all_object_literal_with_parentheses: diag(95116, ts6.DiagnosticCategory.Message, "Wrap_all_object_literal_with_parentheses_95116", "Wrap all object literal with parentheses"), + Move_labeled_tuple_element_modifiers_to_labels: diag(95117, ts6.DiagnosticCategory.Message, "Move_labeled_tuple_element_modifiers_to_labels_95117", "Move labeled tuple element modifiers to labels"), + Convert_overload_list_to_single_signature: diag(95118, ts6.DiagnosticCategory.Message, "Convert_overload_list_to_single_signature_95118", "Convert overload list to single signature"), + Generate_get_and_set_accessors_for_all_overriding_properties: diag(95119, ts6.DiagnosticCategory.Message, "Generate_get_and_set_accessors_for_all_overriding_properties_95119", "Generate 'get' and 'set' accessors for all overriding properties"), + Wrap_in_JSX_fragment: diag(95120, ts6.DiagnosticCategory.Message, "Wrap_in_JSX_fragment_95120", "Wrap in JSX fragment"), + Wrap_all_unparented_JSX_in_JSX_fragment: diag(95121, ts6.DiagnosticCategory.Message, "Wrap_all_unparented_JSX_in_JSX_fragment_95121", "Wrap all unparented JSX in JSX fragment"), + Convert_arrow_function_or_function_expression: diag(95122, ts6.DiagnosticCategory.Message, "Convert_arrow_function_or_function_expression_95122", "Convert arrow function or function expression"), + Convert_to_anonymous_function: diag(95123, ts6.DiagnosticCategory.Message, "Convert_to_anonymous_function_95123", "Convert to anonymous function"), + Convert_to_named_function: diag(95124, ts6.DiagnosticCategory.Message, "Convert_to_named_function_95124", "Convert to named function"), + Convert_to_arrow_function: diag(95125, ts6.DiagnosticCategory.Message, "Convert_to_arrow_function_95125", "Convert to arrow function"), + Remove_parentheses: diag(95126, ts6.DiagnosticCategory.Message, "Remove_parentheses_95126", "Remove parentheses"), + Could_not_find_a_containing_arrow_function: diag(95127, ts6.DiagnosticCategory.Message, "Could_not_find_a_containing_arrow_function_95127", "Could not find a containing arrow function"), + Containing_function_is_not_an_arrow_function: diag(95128, ts6.DiagnosticCategory.Message, "Containing_function_is_not_an_arrow_function_95128", "Containing function is not an arrow function"), + Could_not_find_export_statement: diag(95129, ts6.DiagnosticCategory.Message, "Could_not_find_export_statement_95129", "Could not find export statement"), + This_file_already_has_a_default_export: diag(95130, ts6.DiagnosticCategory.Message, "This_file_already_has_a_default_export_95130", "This file already has a default export"), + Could_not_find_import_clause: diag(95131, ts6.DiagnosticCategory.Message, "Could_not_find_import_clause_95131", "Could not find import clause"), + Could_not_find_namespace_import_or_named_imports: diag(95132, ts6.DiagnosticCategory.Message, "Could_not_find_namespace_import_or_named_imports_95132", "Could not find namespace import or named imports"), + Selection_is_not_a_valid_type_node: diag(95133, ts6.DiagnosticCategory.Message, "Selection_is_not_a_valid_type_node_95133", "Selection is not a valid type node"), + No_type_could_be_extracted_from_this_type_node: diag(95134, ts6.DiagnosticCategory.Message, "No_type_could_be_extracted_from_this_type_node_95134", "No type could be extracted from this type node"), + Could_not_find_property_for_which_to_generate_accessor: diag(95135, ts6.DiagnosticCategory.Message, "Could_not_find_property_for_which_to_generate_accessor_95135", "Could not find property for which to generate accessor"), + Name_is_not_valid: diag(95136, ts6.DiagnosticCategory.Message, "Name_is_not_valid_95136", "Name is not valid"), + Can_only_convert_property_with_modifier: diag(95137, ts6.DiagnosticCategory.Message, "Can_only_convert_property_with_modifier_95137", "Can only convert property with modifier"), + Switch_each_misused_0_to_1: diag(95138, ts6.DiagnosticCategory.Message, "Switch_each_misused_0_to_1_95138", "Switch each misused '{0}' to '{1}'"), + Convert_to_optional_chain_expression: diag(95139, ts6.DiagnosticCategory.Message, "Convert_to_optional_chain_expression_95139", "Convert to optional chain expression"), + Could_not_find_convertible_access_expression: diag(95140, ts6.DiagnosticCategory.Message, "Could_not_find_convertible_access_expression_95140", "Could not find convertible access expression"), + Could_not_find_matching_access_expressions: diag(95141, ts6.DiagnosticCategory.Message, "Could_not_find_matching_access_expressions_95141", "Could not find matching access expressions"), + Can_only_convert_logical_AND_access_chains: diag(95142, ts6.DiagnosticCategory.Message, "Can_only_convert_logical_AND_access_chains_95142", "Can only convert logical AND access chains"), + Add_void_to_Promise_resolved_without_a_value: diag(95143, ts6.DiagnosticCategory.Message, "Add_void_to_Promise_resolved_without_a_value_95143", "Add 'void' to Promise resolved without a value"), + Add_void_to_all_Promises_resolved_without_a_value: diag(95144, ts6.DiagnosticCategory.Message, "Add_void_to_all_Promises_resolved_without_a_value_95144", "Add 'void' to all Promises resolved without a value"), + Use_element_access_for_0: diag(95145, ts6.DiagnosticCategory.Message, "Use_element_access_for_0_95145", "Use element access for '{0}'"), + Use_element_access_for_all_undeclared_properties: diag(95146, ts6.DiagnosticCategory.Message, "Use_element_access_for_all_undeclared_properties_95146", "Use element access for all undeclared properties."), + Delete_all_unused_imports: diag(95147, ts6.DiagnosticCategory.Message, "Delete_all_unused_imports_95147", "Delete all unused imports"), + Infer_function_return_type: diag(95148, ts6.DiagnosticCategory.Message, "Infer_function_return_type_95148", "Infer function return type"), + Return_type_must_be_inferred_from_a_function: diag(95149, ts6.DiagnosticCategory.Message, "Return_type_must_be_inferred_from_a_function_95149", "Return type must be inferred from a function"), + Could_not_determine_function_return_type: diag(95150, ts6.DiagnosticCategory.Message, "Could_not_determine_function_return_type_95150", "Could not determine function return type"), + Could_not_convert_to_arrow_function: diag(95151, ts6.DiagnosticCategory.Message, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"), + Could_not_convert_to_named_function: diag(95152, ts6.DiagnosticCategory.Message, "Could_not_convert_to_named_function_95152", "Could not convert to named function"), + Could_not_convert_to_anonymous_function: diag(95153, ts6.DiagnosticCategory.Message, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"), + Can_only_convert_string_concatenation: diag(95154, ts6.DiagnosticCategory.Message, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"), + Selection_is_not_a_valid_statement_or_statements: diag(95155, ts6.DiagnosticCategory.Message, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"), + Add_missing_function_declaration_0: diag(95156, ts6.DiagnosticCategory.Message, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"), + Add_all_missing_function_declarations: diag(95157, ts6.DiagnosticCategory.Message, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"), + Method_not_implemented: diag(95158, ts6.DiagnosticCategory.Message, "Method_not_implemented_95158", "Method not implemented."), + Function_not_implemented: diag(95159, ts6.DiagnosticCategory.Message, "Function_not_implemented_95159", "Function not implemented."), + Add_override_modifier: diag(95160, ts6.DiagnosticCategory.Message, "Add_override_modifier_95160", "Add 'override' modifier"), + Remove_override_modifier: diag(95161, ts6.DiagnosticCategory.Message, "Remove_override_modifier_95161", "Remove 'override' modifier"), + Add_all_missing_override_modifiers: diag(95162, ts6.DiagnosticCategory.Message, "Add_all_missing_override_modifiers_95162", "Add all missing 'override' modifiers"), + Remove_all_unnecessary_override_modifiers: diag(95163, ts6.DiagnosticCategory.Message, "Remove_all_unnecessary_override_modifiers_95163", "Remove all unnecessary 'override' modifiers"), + Can_only_convert_named_export: diag(95164, ts6.DiagnosticCategory.Message, "Can_only_convert_named_export_95164", "Can only convert named export"), + Add_missing_properties: diag(95165, ts6.DiagnosticCategory.Message, "Add_missing_properties_95165", "Add missing properties"), + Add_all_missing_properties: diag(95166, ts6.DiagnosticCategory.Message, "Add_all_missing_properties_95166", "Add all missing properties"), + Add_missing_attributes: diag(95167, ts6.DiagnosticCategory.Message, "Add_missing_attributes_95167", "Add missing attributes"), + Add_all_missing_attributes: diag(95168, ts6.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"), + Add_undefined_to_optional_property_type: diag(95169, ts6.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"), + Convert_named_imports_to_default_import: diag(95170, ts6.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"), + Delete_unused_param_tag_0: diag(95171, ts6.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), + Delete_all_unused_param_tags: diag(95172, ts6.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), + Rename_param_tag_name_0_to_1: diag(95173, ts6.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts6.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts6.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), + No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts6.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), + Classes_may_not_have_a_field_named_constructor: diag(18006, ts6.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), + JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts6.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), + Private_identifiers_cannot_be_used_as_parameters: diag(18009, ts6.DiagnosticCategory.Error, "Private_identifiers_cannot_be_used_as_parameters_18009", "Private identifiers cannot be used as parameters."), + An_accessibility_modifier_cannot_be_used_with_a_private_identifier: diag(18010, ts6.DiagnosticCategory.Error, "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010", "An accessibility modifier cannot be used with a private identifier."), + The_operand_of_a_delete_operator_cannot_be_a_private_identifier: diag(18011, ts6.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_cannot_be_a_private_identifier_18011", "The operand of a 'delete' operator cannot be a private identifier."), + constructor_is_a_reserved_word: diag(18012, ts6.DiagnosticCategory.Error, "constructor_is_a_reserved_word_18012", "'#constructor' is a reserved word."), + Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier: diag(18013, ts6.DiagnosticCategory.Error, "Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier_18013", "Property '{0}' is not accessible outside class '{1}' because it has a private identifier."), + The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling: diag(18014, ts6.DiagnosticCategory.Error, "The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_priv_18014", "The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling."), + Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2: diag(18015, ts6.DiagnosticCategory.Error, "Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2_18015", "Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'."), + Private_identifiers_are_not_allowed_outside_class_bodies: diag(18016, ts6.DiagnosticCategory.Error, "Private_identifiers_are_not_allowed_outside_class_bodies_18016", "Private identifiers are not allowed outside class bodies."), + The_shadowing_declaration_of_0_is_defined_here: diag(18017, ts6.DiagnosticCategory.Error, "The_shadowing_declaration_of_0_is_defined_here_18017", "The shadowing declaration of '{0}' is defined here"), + The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here: diag(18018, ts6.DiagnosticCategory.Error, "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018", "The declaration of '{0}' that you probably intended to use is defined here"), + _0_modifier_cannot_be_used_with_a_private_identifier: diag(18019, ts6.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_a_private_identifier_18019", "'{0}' modifier cannot be used with a private identifier."), + An_enum_member_cannot_be_named_with_a_private_identifier: diag(18024, ts6.DiagnosticCategory.Error, "An_enum_member_cannot_be_named_with_a_private_identifier_18024", "An enum member cannot be named with a private identifier."), + can_only_be_used_at_the_start_of_a_file: diag(18026, ts6.DiagnosticCategory.Error, "can_only_be_used_at_the_start_of_a_file_18026", "'#!' can only be used at the start of a file."), + Compiler_reserves_name_0_when_emitting_private_identifier_downlevel: diag(18027, ts6.DiagnosticCategory.Error, "Compiler_reserves_name_0_when_emitting_private_identifier_downlevel_18027", "Compiler reserves name '{0}' when emitting private identifier downlevel."), + Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18028, ts6.DiagnosticCategory.Error, "Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher_18028", "Private identifiers are only available when targeting ECMAScript 2015 and higher."), + Private_identifiers_are_not_allowed_in_variable_declarations: diag(18029, ts6.DiagnosticCategory.Error, "Private_identifiers_are_not_allowed_in_variable_declarations_18029", "Private identifiers are not allowed in variable declarations."), + An_optional_chain_cannot_contain_private_identifiers: diag(18030, ts6.DiagnosticCategory.Error, "An_optional_chain_cannot_contain_private_identifiers_18030", "An optional chain cannot contain private identifiers."), + The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents: diag(18031, ts6.DiagnosticCategory.Error, "The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031", "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."), + The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some: diag(18032, ts6.DiagnosticCategory.Error, "The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032", "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."), + Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead: diag(18033, ts6.DiagnosticCategory.Error, "Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033", "Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead."), + Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment: diag(18034, ts6.DiagnosticCategory.Message, "Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034", "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."), + Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(18035, ts6.DiagnosticCategory.Error, "Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035", "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."), + Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator: diag(18036, ts6.DiagnosticCategory.Error, "Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036", "Class decorators can't be used with static private identifier. Consider removing the experimental decorator."), + Await_expression_cannot_be_used_inside_a_class_static_block: diag(18037, ts6.DiagnosticCategory.Error, "Await_expression_cannot_be_used_inside_a_class_static_block_18037", "Await expression cannot be used inside a class static block."), + For_await_loops_cannot_be_used_inside_a_class_static_block: diag(18038, ts6.DiagnosticCategory.Error, "For_await_loops_cannot_be_used_inside_a_class_static_block_18038", "'For await' loops cannot be used inside a class static block."), + Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block: diag(18039, ts6.DiagnosticCategory.Error, "Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039", "Invalid use of '{0}'. It cannot be used inside a class static block."), + A_return_statement_cannot_be_used_inside_a_class_static_block: diag(18041, ts6.DiagnosticCategory.Error, "A_return_statement_cannot_be_used_inside_a_class_static_block_18041", "A 'return' statement cannot be used inside a class static block."), + _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts6.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), + Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts6.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), + _0_is_automatically_exported_here: diag(18044, ts6.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts6.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts6.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts6.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts6.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts6.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts6.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here.") + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var _a; + function tokenIsIdentifierOrKeyword(token) { + return token >= 79; + } + ts6.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 31 || tokenIsIdentifierOrKeyword(token); + } + ts6.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; + ts6.textToKeywordObj = (_a = { + abstract: 126, + accessor: 127, + any: 131, + as: 128, + asserts: 129, + assert: 130, + bigint: 160, + boolean: 134, + break: 81, + case: 82, + catch: 83, + class: 84, + continue: 86, + const: 85 + /* SyntaxKind.ConstKeyword */ + }, _a["constructor"] = 135, _a.debugger = 87, _a.declare = 136, _a.default = 88, _a.delete = 89, _a.do = 90, _a.else = 91, _a.enum = 92, _a.export = 93, _a.extends = 94, _a.false = 95, _a.finally = 96, _a.for = 97, _a.from = 158, _a.function = 98, _a.get = 137, _a.if = 99, _a.implements = 117, _a.import = 100, _a.in = 101, _a.infer = 138, _a.instanceof = 102, _a.interface = 118, _a.intrinsic = 139, _a.is = 140, _a.keyof = 141, _a.let = 119, _a.module = 142, _a.namespace = 143, _a.never = 144, _a.new = 103, _a.null = 104, _a.number = 148, _a.object = 149, _a.package = 120, _a.private = 121, _a.protected = 122, _a.public = 123, _a.override = 161, _a.out = 145, _a.readonly = 146, _a.require = 147, _a.global = 159, _a.return = 105, _a.satisfies = 150, _a.set = 151, _a.static = 124, _a.string = 152, _a.super = 106, _a.switch = 107, _a.symbol = 153, _a.this = 108, _a.throw = 109, _a.true = 110, _a.try = 111, _a.type = 154, _a.typeof = 112, _a.undefined = 155, _a.unique = 156, _a.unknown = 157, _a.var = 113, _a.void = 114, _a.while = 115, _a.with = 116, _a.yield = 125, _a.async = 132, _a.await = 133, _a.of = 162, _a); + var textToKeyword = new ts6.Map(ts6.getEntries(ts6.textToKeywordObj)); + var textToToken = new ts6.Map(ts6.getEntries(__assign(__assign({}, ts6.textToKeywordObj), { + "{": 18, + "}": 19, + "(": 20, + ")": 21, + "[": 22, + "]": 23, + ".": 24, + "...": 25, + ";": 26, + ",": 27, + "<": 29, + ">": 31, + "<=": 32, + ">=": 33, + "==": 34, + "!=": 35, + "===": 36, + "!==": 37, + "=>": 38, + "+": 39, + "-": 40, + "**": 42, + "*": 41, + "/": 43, + "%": 44, + "++": 45, + "--": 46, + "<<": 47, + ">": 48, + ">>>": 49, + "&": 50, + "|": 51, + "^": 52, + "!": 53, + "~": 54, + "&&": 55, + "||": 56, + "?": 57, + "??": 60, + "?.": 28, + ":": 58, + "=": 63, + "+=": 64, + "-=": 65, + "*=": 66, + "**=": 67, + "/=": 68, + "%=": 69, + "<<=": 70, + ">>=": 71, + ">>>=": 72, + "&=": 73, + "|=": 74, + "^=": 78, + "||=": 75, + "&&=": 76, + "??=": 77, + "@": 59, + "#": 62, + "`": 61 + /* SyntaxKind.BacktickToken */ + }))); + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; + var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101]; + var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999]; + var commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)/; + var commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion >= 2 ? lookupInUnicodeMap(code, unicodeESNextIdentifierStart) : languageVersion === 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + } + ts6.isUnicodeIdentifierStart = isUnicodeIdentifierStart; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion >= 2 ? lookupInUnicodeMap(code, unicodeESNextIdentifierPart) : languageVersion === 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + source.forEach(function(value, name) { + result[value] = name; + }); + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts6.tokenToString = tokenToString; + function stringToToken(s) { + return textToToken.get(s); + } + ts6.stringToToken = stringToToken; + function computeLineStarts(text) { + var result = []; + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts6.computeLineStarts = computeLineStarts; + function getPositionOfLineAndCharacter(sourceFile, line, character, allowEdits) { + return sourceFile.getPositionOfLineAndCharacter ? sourceFile.getPositionOfLineAndCharacter(line, character, allowEdits) : computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character, sourceFile.text, allowEdits); + } + ts6.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character, debugText, allowEdits) { + if (line < 0 || line >= lineStarts.length) { + if (allowEdits) { + line = line < 0 ? 0 : line >= lineStarts.length ? lineStarts.length - 1 : line; + } else { + ts6.Debug.fail("Bad line number. Line: ".concat(line, ", lineStarts.length: ").concat(lineStarts.length, " , line map is correct? ").concat(debugText !== void 0 ? ts6.arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown")); + } + } + var res = lineStarts[line] + character; + if (allowEdits) { + return res > lineStarts[line + 1] ? lineStarts[line + 1] : typeof debugText === "string" && res > debugText.length ? debugText.length : res; + } + if (line < lineStarts.length - 1) { + ts6.Debug.assert(res < lineStarts[line + 1]); + } else if (debugText !== void 0) { + ts6.Debug.assert(res <= debugText.length); + } + return res; + } + ts6.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; + function getLineStarts(sourceFile) { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); + } + ts6.getLineStarts = getLineStarts; + function computeLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = computeLineOfPosition(lineStarts, position); + return { + line: lineNumber, + character: position - lineStarts[lineNumber] + }; + } + ts6.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; + function computeLineOfPosition(lineStarts, position, lowerBound) { + var lineNumber = ts6.binarySearch(lineStarts, position, ts6.identity, ts6.compareValues, lowerBound); + if (lineNumber < 0) { + lineNumber = ~lineNumber - 1; + ts6.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); + } + return lineNumber; + } + ts6.computeLineOfPosition = computeLineOfPosition; + function getLinesBetweenPositions(sourceFile, pos1, pos2) { + if (pos1 === pos2) + return 0; + var lineStarts = getLineStarts(sourceFile); + var lower = Math.min(pos1, pos2); + var isNegative = lower === pos2; + var upper = isNegative ? pos1 : pos2; + var lowerLine = computeLineOfPosition(lineStarts, lower); + var upperLine = computeLineOfPosition(lineStarts, upper, lowerLine); + return isNegative ? lowerLine - upperLine : upperLine - lowerLine; + } + ts6.getLinesBetweenPositions = getLinesBetweenPositions; + function getLineAndCharacterOfPosition2(sourceFile, position) { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + } + ts6.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition2; + function isWhiteSpaceLike(ch) { + return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); + } + ts6.isWhiteSpaceLike = isWhiteSpaceLike; + function isWhiteSpaceSingleLine(ch) { + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 133 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + } + ts6.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine; + function isLineBreak(ch) { + return ch === 10 || ch === 13 || ch === 8232 || ch === 8233; + } + ts6.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isHexDigit(ch) { + return isDigit(ch) || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102; + } + function isCodePoint(code) { + return code <= 1114111; + } + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; + } + ts6.isOctalDigit = isOctalDigit; + function couldStartTrivia(text, pos) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + case 10: + case 9: + case 11: + case 12: + case 32: + case 47: + case 60: + case 124: + case 61: + case 62: + return true; + case 35: + return pos === 0; + default: + return ch > 127; + } + } + ts6.couldStartTrivia = couldStartTrivia; + function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) { + if (ts6.positionIsSynthesized(pos)) { + return pos; + } + var canConsumeStar = false; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (stopAfterLineBreak) { + return pos; + } + canConsumeStar = !!inJSDoc; + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + if (stopAtComments) { + break; + } + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + canConsumeStar = false; + continue; + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + canConsumeStar = false; + continue; + } + break; + case 60: + case 124: + case 61: + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + canConsumeStar = false; + continue; + } + break; + case 35: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + canConsumeStar = false; + continue; + } + break; + case 42: + if (canConsumeStar) { + pos++; + canConsumeStar = false; + continue; + } + break; + default: + if (ch > 127 && isWhiteSpaceLike(ch)) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts6.skipTrivia = skipTrivia; + var mergeConflictMarkerLength = "<<<<<<<".length; + function isConflictMarkerTrivia(text, pos) { + ts6.Debug.assert(pos >= 0); + if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { + var ch = text.charCodeAt(pos); + if (pos + mergeConflictMarkerLength < text.length) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { + if (text.charCodeAt(pos + i) !== ch) { + return false; + } + } + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + } + } + return false; + } + function scanConflictMarkerTrivia(text, pos, error) { + if (error) { + error(ts6.Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength); + } + var ch = text.charCodeAt(pos); + var len = text.length; + if (ch === 60 || ch === 62) { + while (pos < len && !isLineBreak(text.charCodeAt(pos))) { + pos++; + } + } else { + ts6.Debug.assert( + ch === 124 || ch === 61 + /* CharacterCodes.equals */ + ); + while (pos < len) { + var currentChar = text.charCodeAt(pos); + if ((currentChar === 61 || currentChar === 62) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) { + break; + } + pos++; + } + } + return pos; + } + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + ts6.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); + } + ts6.isShebangTrivia = isShebangTrivia; + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; + } + ts6.scanShebangTrivia = scanShebangTrivia; + function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { + var pendingPos; + var pendingEnd; + var pendingKind; + var pendingHasTrailingNewLine; + var hasPendingCommentRange = false; + var collecting = trailing; + var accumulator = initial; + if (pos === 0) { + collecting = true; + var shebang = getShebang(text); + if (shebang) { + pos = shebang.length; + } + } + scan: + while (pos >= 0 && pos < text.length) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (trailing) { + break scan; + } + collecting = true; + if (hasPendingCommentRange) { + pendingHasTrailingNewLine = true; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 || nextChar === 42) { + var kind = nextChar === 47 ? 2 : 3; + var startPos = pos; + pos += 2; + if (nextChar === 47) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + if (!reduce && accumulator) { + return accumulator; + } + } + pendingPos = startPos; + pendingEnd = pos; + pendingKind = kind; + pendingHasTrailingNewLine = hasTrailingNewLine; + hasPendingCommentRange = true; + } + continue; + } + break scan; + default: + if (ch > 127 && isWhiteSpaceLike(ch)) { + if (hasPendingCommentRange && isLineBreak(ch)) { + pendingHasTrailingNewLine = true; + } + pos++; + continue; + } + break scan; + } + } + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + } + return accumulator; + } + function forEachLeadingCommentRange(text, pos, cb, state) { + return iterateCommentRanges( + /*reduce*/ + false, + text, + pos, + /*trailing*/ + false, + cb, + state + ); + } + ts6.forEachLeadingCommentRange = forEachLeadingCommentRange; + function forEachTrailingCommentRange(text, pos, cb, state) { + return iterateCommentRanges( + /*reduce*/ + false, + text, + pos, + /*trailing*/ + true, + cb, + state + ); + } + ts6.forEachTrailingCommentRange = forEachTrailingCommentRange; + function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges( + /*reduce*/ + true, + text, + pos, + /*trailing*/ + false, + cb, + state, + initial + ); + } + ts6.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange; + function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges( + /*reduce*/ + true, + text, + pos, + /*trailing*/ + true, + cb, + state, + initial + ); + } + ts6.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange; + function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { + if (!comments) { + comments = []; + } + comments.push({ kind, pos, end, hasTrailingNewLine }); + return comments; + } + function getLeadingCommentRanges(text, pos) { + return reduceEachLeadingCommentRange( + text, + pos, + appendCommentRange, + /*state*/ + void 0, + /*initial*/ + void 0 + ); + } + ts6.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return reduceEachTrailingCommentRange( + text, + pos, + appendCommentRange, + /*state*/ + void 0, + /*initial*/ + void 0 + ); + } + ts6.getTrailingCommentRanges = getTrailingCommentRanges; + function getShebang(text) { + var match = shebangTriviaRegex.exec(text); + if (match) { + return match[0]; + } + } + ts6.getShebang = getShebang; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + } + ts6.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion, identifierVariant) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || // "-" and ":" are valid in JSX Identifiers + (identifierVariant === 1 ? ch === 45 || ch === 58 : false) || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + } + ts6.isIdentifierPart = isIdentifierPart; + function isIdentifierText(name, languageVersion, identifierVariant) { + var ch = codePointAt(name, 0); + if (!isIdentifierStart(ch, languageVersion)) { + return false; + } + for (var i = charSize(ch); i < name.length; i += charSize(ch)) { + if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion, identifierVariant)) { + return false; + } + } + return true; + } + ts6.isIdentifierText = isIdentifierText; + function createScanner(languageVersion, skipTrivia2, languageVariant, textInitial, onError, start, length) { + if (languageVariant === void 0) { + languageVariant = 0; + } + var text = textInitial; + var pos; + var end; + var startPos; + var tokenPos; + var token; + var tokenValue; + var tokenFlags; + var commentDirectives; + var inJSDocType = 0; + setText(text, start, length); + var scanner = { + getStartPos: function() { + return startPos; + }, + getTextPos: function() { + return pos; + }, + getToken: function() { + return token; + }, + getTokenPos: function() { + return tokenPos; + }, + getTokenText: function() { + return text.substring(tokenPos, pos); + }, + getTokenValue: function() { + return tokenValue; + }, + hasUnicodeEscape: function() { + return (tokenFlags & 1024) !== 0; + }, + hasExtendedUnicodeEscape: function() { + return (tokenFlags & 8) !== 0; + }, + hasPrecedingLineBreak: function() { + return (tokenFlags & 1) !== 0; + }, + hasPrecedingJSDocComment: function() { + return (tokenFlags & 2) !== 0; + }, + isIdentifier: function() { + return token === 79 || token > 116; + }, + isReservedWord: function() { + return token >= 81 && token <= 116; + }, + isUnterminated: function() { + return (tokenFlags & 4) !== 0; + }, + getCommentDirectives: function() { + return commentDirectives; + }, + getNumericLiteralFlags: function() { + return tokenFlags & 1008; + }, + getTokenFlags: function() { + return tokenFlags; + }, + reScanGreaterToken, + reScanAsteriskEqualsToken, + reScanSlashToken, + reScanTemplateToken, + reScanTemplateHeadOrNoSubstitutionTemplate, + scanJsxIdentifier, + scanJsxAttributeValue, + reScanJsxAttributeValue, + reScanJsxToken, + reScanLessThanToken, + reScanHashToken, + reScanQuestionToken, + reScanInvalidIdentifier, + scanJsxToken, + scanJsDocToken, + scan, + getText, + clearCommentDirectives, + setText, + setScriptTarget, + setLanguageVariant, + setOnError, + setTextPos, + setInJSDocType, + tryScan, + lookAhead, + scanRange + }; + if (ts6.Debug.isDebugging) { + Object.defineProperty(scanner, "__debugShowCurrentPositionInText", { + get: function() { + var text2 = scanner.getText(); + return text2.slice(0, scanner.getStartPos()) + "\u2551" + text2.slice(scanner.getStartPos()); + } + }); + } + return scanner; + function error(message, errPos, length2) { + if (errPos === void 0) { + errPos = pos; + } + if (onError) { + var oldPos = pos; + pos = errPos; + onError(message, length2 || 0); + pos = oldPos; + } + } + function scanNumberFragment() { + var start2 = pos; + var allowSeparator = false; + var isPreviousTokenSeparator = false; + var result = ""; + while (true) { + var ch = text.charCodeAt(pos); + if (ch === 95) { + tokenFlags |= 512; + if (allowSeparator) { + allowSeparator = false; + isPreviousTokenSeparator = true; + result += text.substring(start2, pos); + } else if (isPreviousTokenSeparator) { + error(ts6.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { + error(ts6.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } + pos++; + start2 = pos; + continue; + } + if (isDigit(ch)) { + allowSeparator = true; + isPreviousTokenSeparator = false; + pos++; + continue; + } + break; + } + if (text.charCodeAt(pos - 1) === 95) { + error(ts6.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); + } + return result + text.substring(start2, pos); + } + function scanNumber() { + var start2 = pos; + var mainFragment = scanNumberFragment(); + var decimalFragment; + var scientificFragment; + if (text.charCodeAt(pos) === 46) { + pos++; + decimalFragment = scanNumberFragment(); + } + var end2 = pos; + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { + pos++; + tokenFlags |= 16; + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) + pos++; + var preNumericPart = pos; + var finalFragment = scanNumberFragment(); + if (!finalFragment) { + error(ts6.Diagnostics.Digit_expected); + } else { + scientificFragment = text.substring(end2, preNumericPart) + finalFragment; + end2 = pos; + } + } + var result; + if (tokenFlags & 512) { + result = mainFragment; + if (decimalFragment) { + result += "." + decimalFragment; + } + if (scientificFragment) { + result += scientificFragment; + } + } else { + result = text.substring(start2, end2); + } + if (decimalFragment !== void 0 || tokenFlags & 16) { + checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16)); + return { + type: 8, + value: "" + +result + // if value is not an integer, it can be safely coerced to a number + }; + } else { + tokenValue = result; + var type = checkBigIntSuffix(); + checkForIdentifierStartAfterNumericLiteral(start2); + return { type, value: tokenValue }; + } + } + function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) { + if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) { + return; + } + var identifierStart = pos; + var length2 = scanIdentifierParts().length; + if (length2 === 1 && text[identifierStart] === "n") { + if (isScientific) { + error(ts6.Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1); + } else { + error(ts6.Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1); + } + } else { + error(ts6.Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length2); + pos = identifierStart; + } + } + function scanOctalDigits() { + var start2 = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +text.substring(start2, pos); + } + function scanExactNumberOfHexDigits(count, canHaveSeparators) { + var valueString = scanHexDigits( + /*minCount*/ + count, + /*scanAsManyAsPossible*/ + false, + canHaveSeparators + ); + return valueString ? parseInt(valueString, 16) : -1; + } + function scanMinimumNumberOfHexDigits(count, canHaveSeparators) { + return scanHexDigits( + /*minCount*/ + count, + /*scanAsManyAsPossible*/ + true, + canHaveSeparators + ); + } + function scanHexDigits(minCount, scanAsManyAsPossible, canHaveSeparators) { + var valueChars = []; + var allowSeparator = false; + var isPreviousTokenSeparator = false; + while (valueChars.length < minCount || scanAsManyAsPossible) { + var ch = text.charCodeAt(pos); + if (canHaveSeparators && ch === 95) { + tokenFlags |= 512; + if (allowSeparator) { + allowSeparator = false; + isPreviousTokenSeparator = true; + } else if (isPreviousTokenSeparator) { + error(ts6.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { + error(ts6.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } + pos++; + continue; + } + allowSeparator = canHaveSeparators; + if (ch >= 65 && ch <= 70) { + ch += 97 - 65; + } else if (!(ch >= 48 && ch <= 57 || ch >= 97 && ch <= 102)) { + break; + } + valueChars.push(ch); + pos++; + isPreviousTokenSeparator = false; + } + if (valueChars.length < minCount) { + valueChars = []; + } + if (text.charCodeAt(pos - 1) === 95) { + error(ts6.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); + } + return String.fromCharCode.apply(String, valueChars); + } + function scanString(jsxAttributeString) { + if (jsxAttributeString === void 0) { + jsxAttributeString = false; + } + var quote = text.charCodeAt(pos); + pos++; + var result = ""; + var start2 = pos; + while (true) { + if (pos >= end) { + result += text.substring(start2, pos); + tokenFlags |= 4; + error(ts6.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start2, pos); + pos++; + break; + } + if (ch === 92 && !jsxAttributeString) { + result += text.substring(start2, pos); + result += scanEscapeSequence(); + start2 = pos; + continue; + } + if (isLineBreak(ch) && !jsxAttributeString) { + result += text.substring(start2, pos); + tokenFlags |= 4; + error(ts6.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue(isTaggedTemplate) { + var startedWithBacktick = text.charCodeAt(pos) === 96; + pos++; + var start2 = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= end) { + contents += text.substring(start2, pos); + tokenFlags |= 4; + error(ts6.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 14 : 17; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96) { + contents += text.substring(start2, pos); + pos++; + resultingToken = startedWithBacktick ? 14 : 17; + break; + } + if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { + contents += text.substring(start2, pos); + pos += 2; + resultingToken = startedWithBacktick ? 15 : 16; + break; + } + if (currChar === 92) { + contents += text.substring(start2, pos); + contents += scanEscapeSequence(isTaggedTemplate); + start2 = pos; + continue; + } + if (currChar === 13) { + contents += text.substring(start2, pos); + pos++; + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + contents += "\n"; + start2 = pos; + continue; + } + pos++; + } + ts6.Debug.assert(resultingToken !== void 0); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence(isTaggedTemplate) { + var start2 = pos; + pos++; + if (pos >= end) { + error(ts6.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 48: + if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) { + pos++; + tokenFlags |= 2048; + return text.substring(start2, pos); + } + return "\0"; + case 98: + return "\b"; + case 116: + return " "; + case 110: + return "\n"; + case 118: + return "\v"; + case 102: + return "\f"; + case 114: + return "\r"; + case 39: + return "'"; + case 34: + return '"'; + case 117: + if (isTaggedTemplate) { + for (var escapePos = pos; escapePos < pos + 4; escapePos++) { + if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123) { + pos = escapePos; + tokenFlags |= 2048; + return text.substring(start2, pos); + } + } + } + if (pos < end && text.charCodeAt(pos) === 123) { + pos++; + if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) { + tokenFlags |= 2048; + return text.substring(start2, pos); + } + if (isTaggedTemplate) { + var savePos = pos; + var escapedValueString = scanMinimumNumberOfHexDigits( + 1, + /*canHaveSeparators*/ + false + ); + var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; + if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125) { + tokenFlags |= 2048; + return text.substring(start2, pos); + } else { + pos = savePos; + } + } + tokenFlags |= 8; + return scanExtendedUnicodeEscape(); + } + tokenFlags |= 1024; + return scanHexadecimalEscape( + /*numDigits*/ + 4 + ); + case 120: + if (isTaggedTemplate) { + if (!isHexDigit(text.charCodeAt(pos))) { + tokenFlags |= 2048; + return text.substring(start2, pos); + } else if (!isHexDigit(text.charCodeAt(pos + 1))) { + pos++; + tokenFlags |= 2048; + return text.substring(start2, pos); + } + } + return scanHexadecimalEscape( + /*numDigits*/ + 2 + ); + case 13: + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + case 8232: + case 8233: + return ""; + default: + return String.fromCharCode(ch); + } + } + function scanHexadecimalEscape(numDigits) { + var escapedValue = scanExactNumberOfHexDigits( + numDigits, + /*canHaveSeparators*/ + false + ); + if (escapedValue >= 0) { + return String.fromCharCode(escapedValue); + } else { + error(ts6.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + } + function scanExtendedUnicodeEscape() { + var escapedValueString = scanMinimumNumberOfHexDigits( + 1, + /*canHaveSeparators*/ + false + ); + var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; + var isInvalidExtendedEscape = false; + if (escapedValue < 0) { + error(ts6.Diagnostics.Hexadecimal_digit_expected); + isInvalidExtendedEscape = true; + } else if (escapedValue > 1114111) { + error(ts6.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + isInvalidExtendedEscape = true; + } + if (pos >= end) { + error(ts6.Diagnostics.Unexpected_end_of_text); + isInvalidExtendedEscape = true; + } else if (text.charCodeAt(pos) === 125) { + pos++; + } else { + error(ts6.Diagnostics.Unterminated_Unicode_escape_sequence); + isInvalidExtendedEscape = true; + } + if (isInvalidExtendedEscape) { + return ""; + } + return utf16EncodeAsString(escapedValue); + } + function peekUnicodeEscape() { + if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) { + var start_1 = pos; + pos += 2; + var value = scanExactNumberOfHexDigits( + 4, + /*canHaveSeparators*/ + false + ); + pos = start_1; + return value; + } + return -1; + } + function peekExtendedUnicodeEscape() { + if (codePointAt(text, pos + 1) === 117 && codePointAt(text, pos + 2) === 123) { + var start_2 = pos; + pos += 3; + var escapedValueString = scanMinimumNumberOfHexDigits( + 1, + /*canHaveSeparators*/ + false + ); + var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; + pos = start_2; + return escapedValue; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start2 = pos; + while (pos < end) { + var ch = codePointAt(text, pos); + if (isIdentifierPart(ch, languageVersion)) { + pos += charSize(ch); + } else if (ch === 92) { + ch = peekExtendedUnicodeEscape(); + if (ch >= 0 && isIdentifierPart(ch, languageVersion)) { + pos += 3; + tokenFlags |= 8; + result += scanExtendedUnicodeEscape(); + start2 = pos; + continue; + } + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { + break; + } + tokenFlags |= 1024; + result += text.substring(start2, pos); + result += utf16EncodeAsString(ch); + pos += 6; + start2 = pos; + } else { + break; + } + } + result += text.substring(start2, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 12) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 && ch <= 122) { + var keyword = textToKeyword.get(tokenValue); + if (keyword !== void 0) { + return token = keyword; + } + } + } + return token = 79; + } + function scanBinaryOrOctalDigits(base) { + var value = ""; + var separatorAllowed = false; + var isPreviousTokenSeparator = false; + while (true) { + var ch = text.charCodeAt(pos); + if (ch === 95) { + tokenFlags |= 512; + if (separatorAllowed) { + separatorAllowed = false; + isPreviousTokenSeparator = true; + } else if (isPreviousTokenSeparator) { + error(ts6.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { + error(ts6.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } + pos++; + continue; + } + separatorAllowed = true; + if (!isDigit(ch) || ch - 48 >= base) { + break; + } + value += text[pos]; + pos++; + isPreviousTokenSeparator = false; + } + if (text.charCodeAt(pos - 1) === 95) { + error(ts6.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); + } + return value; + } + function checkBigIntSuffix() { + if (text.charCodeAt(pos) === 110) { + tokenValue += "n"; + if (tokenFlags & 384) { + tokenValue = ts6.parsePseudoBigInt(tokenValue) + "n"; + } + pos++; + return 9; + } else { + var numericValue = tokenFlags & 128 ? parseInt(tokenValue.slice(2), 2) : tokenFlags & 256 ? parseInt(tokenValue.slice(2), 8) : +tokenValue; + tokenValue = "" + numericValue; + return 8; + } + } + function scan() { + var _a2; + startPos = pos; + tokenFlags = 0; + var asteriskSeen = false; + while (true) { + tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var ch = codePointAt(text, pos); + if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia2) { + continue; + } else { + return token = 6; + } + } + switch (ch) { + case 10: + case 13: + tokenFlags |= 1; + if (skipTrivia2) { + pos++; + continue; + } else { + if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) { + pos += 2; + } else { + pos++; + } + return token = 4; + } + case 9: + case 11: + case 12: + case 32: + case 160: + case 5760: + case 8192: + case 8193: + case 8194: + case 8195: + case 8196: + case 8197: + case 8198: + case 8199: + case 8200: + case 8201: + case 8202: + case 8203: + case 8239: + case 8287: + case 12288: + case 65279: + if (skipTrivia2) { + pos++; + continue; + } else { + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + } + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 37; + } + return pos += 2, token = 35; + } + pos++; + return token = 53; + case 34: + case 39: + tokenValue = scanString(); + return token = 10; + case 96: + return token = scanTemplateAndSetTokenValue( + /* isTaggedTemplate */ + false + ); + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 69; + } + pos++; + return token = 44; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 76; + } + return pos += 2, token = 55; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 73; + } + pos++; + return token = 50; + case 40: + pos++; + return token = 20; + case 41: + pos++; + return token = 21; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 66; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 67; + } + return pos += 2, token = 42; + } + pos++; + if (inJSDocType && !asteriskSeen && tokenFlags & 1) { + asteriskSeen = true; + continue; + } + return token = 41; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 45; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 64; + } + pos++; + return token = 39; + case 44: + pos++; + return token = 27; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 46; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 65; + } + pos++; + return token = 40; + case 46: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = scanNumber().value; + return token = 8; + } + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 25; + } + pos++; + return token = 24; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < end) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(tokenPos, pos), commentDirectiveRegExSingleLine, tokenPos); + if (skipTrivia2) { + continue; + } else { + return token = 2; + } + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) !== 47) { + tokenFlags |= 2; + } + var commentClosed = false; + var lastLineStart = tokenPos; + while (pos < end) { + var ch_1 = text.charCodeAt(pos); + if (ch_1 === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + commentClosed = true; + break; + } + pos++; + if (isLineBreak(ch_1)) { + lastLineStart = pos; + tokenFlags |= 1; + } + } + commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart); + if (!commentClosed) { + error(ts6.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia2) { + continue; + } else { + if (!commentClosed) { + tokenFlags |= 4; + } + return token = 3; + } + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 68; + } + pos++; + return token = 43; + case 48: + if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { + pos += 2; + tokenValue = scanMinimumNumberOfHexDigits( + 1, + /*canHaveSeparators*/ + true + ); + if (!tokenValue) { + error(ts6.Diagnostics.Hexadecimal_digit_expected); + tokenValue = "0"; + } + tokenValue = "0x" + tokenValue; + tokenFlags |= 64; + return token = checkBigIntSuffix(); + } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { + pos += 2; + tokenValue = scanBinaryOrOctalDigits( + /* base */ + 2 + ); + if (!tokenValue) { + error(ts6.Diagnostics.Binary_digit_expected); + tokenValue = "0"; + } + tokenValue = "0b" + tokenValue; + tokenFlags |= 128; + return token = checkBigIntSuffix(); + } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { + pos += 2; + tokenValue = scanBinaryOrOctalDigits( + /* base */ + 8 + ); + if (!tokenValue) { + error(ts6.Diagnostics.Octal_digit_expected); + tokenValue = "0"; + } + tokenValue = "0o" + tokenValue; + tokenFlags |= 256; + return token = checkBigIntSuffix(); + } + if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + tokenFlags |= 32; + return token = 8; + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + _a2 = scanNumber(), token = _a2.type, tokenValue = _a2.value; + return token; + case 58: + pos++; + return token = 58; + case 59: + pos++; + return token = 26; + case 60: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia2) { + continue; + } else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 70; + } + return pos += 2, token = 47; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 32; + } + if (languageVariant === 1 && text.charCodeAt(pos + 1) === 47 && text.charCodeAt(pos + 2) !== 42) { + return pos += 2, token = 30; + } + pos++; + return token = 29; + case 61: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia2) { + continue; + } else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 36; + } + return pos += 2, token = 34; + } + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 38; + } + pos++; + return token = 63; + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia2) { + continue; + } else { + return token = 7; + } + } + pos++; + return token = 31; + case 63: + if (text.charCodeAt(pos + 1) === 46 && !isDigit(text.charCodeAt(pos + 2))) { + return pos += 2, token = 28; + } + if (text.charCodeAt(pos + 1) === 63) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 77; + } + return pos += 2, token = 60; + } + pos++; + return token = 57; + case 91: + pos++; + return token = 22; + case 93: + pos++; + return token = 23; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 78; + } + pos++; + return token = 52; + case 123: + pos++; + return token = 18; + case 124: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia2) { + continue; + } else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 124) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 75; + } + return pos += 2, token = 56; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 74; + } + pos++; + return token = 51; + case 125: + pos++; + return token = 19; + case 126: + pos++; + return token = 54; + case 64: + pos++; + return token = 59; + case 92: + var extendedCookedChar = peekExtendedUnicodeEscape(); + if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) { + pos += 3; + tokenFlags |= 8; + tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = getIdentifierToken(); + } + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { + pos += 6; + tokenFlags |= 1024; + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts6.Diagnostics.Invalid_character); + pos++; + return token = 0; + case 35: + if (pos !== 0 && text[pos + 1] === "!") { + error(ts6.Diagnostics.can_only_be_used_at_the_start_of_a_file); + pos++; + return token = 0; + } + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92) { + pos++; + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + scanIdentifier(charAfterHash, languageVersion); + } else { + tokenValue = "#"; + error(ts6.Diagnostics.Invalid_character, pos++, charSize(ch)); + } + return token = 80; + default: + var identifierKind = scanIdentifier(ch, languageVersion); + if (identifierKind) { + return token = identifierKind; + } else if (isWhiteSpaceSingleLine(ch)) { + pos += charSize(ch); + continue; + } else if (isLineBreak(ch)) { + tokenFlags |= 1; + pos += charSize(ch); + continue; + } + var size = charSize(ch); + error(ts6.Diagnostics.Invalid_character, pos, size); + pos += size; + return token = 0; + } + } + } + function reScanInvalidIdentifier() { + ts6.Debug.assert(token === 0, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'."); + pos = tokenPos = startPos; + tokenFlags = 0; + var ch = codePointAt(text, pos); + var identifierKind = scanIdentifier( + ch, + 99 + /* ScriptTarget.ESNext */ + ); + if (identifierKind) { + return token = identifierKind; + } + pos += charSize(ch); + return token; + } + function scanIdentifier(startCharacter, languageVersion2) { + var ch = startCharacter; + if (isIdentifierStart(ch, languageVersion2)) { + pos += charSize(ch); + while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion2)) + pos += charSize(ch); + tokenValue = text.substring(tokenPos, pos); + if (ch === 92) { + tokenValue += scanIdentifierParts(); + } + return getIdentifierToken(); + } + } + function reScanGreaterToken() { + if (token === 31) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 72; + } + return pos += 2, token = 49; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 71; + } + pos++; + return token = 48; + } + if (text.charCodeAt(pos) === 61) { + pos++; + return token = 33; + } + } + return token; + } + function reScanAsteriskEqualsToken() { + ts6.Debug.assert(token === 66, "'reScanAsteriskEqualsToken' should only be called on a '*='"); + pos = tokenPos + 1; + return token = 63; + } + function reScanSlashToken() { + if (token === 43 || token === 68) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= end) { + tokenFlags |= 4; + error(ts6.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenFlags |= 4; + error(ts6.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } else if (ch === 47 && !inCharacterClass) { + p++; + break; + } else if (ch === 91) { + inCharacterClass = true; + } else if (ch === 92) { + inEscape = true; + } else if (ch === 93) { + inCharacterClass = false; + } + p++; + } + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 13; + } + return token; + } + function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) { + var type = getDirectiveFromComment(ts6.trimStringStart(text2), commentDirectiveRegEx); + if (type === void 0) { + return commentDirectives2; + } + return ts6.append(commentDirectives2, { + range: { pos: lineStart, end: pos }, + type + }); + } + function getDirectiveFromComment(text2, commentDirectiveRegEx) { + var match = commentDirectiveRegEx.exec(text2); + if (!match) { + return void 0; + } + switch (match[1]) { + case "ts-expect-error": + return 0; + case "ts-ignore": + return 1; + } + return void 0; + } + function reScanTemplateToken(isTaggedTemplate) { + ts6.Debug.assert(token === 19, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(isTaggedTemplate); + } + function reScanTemplateHeadOrNoSubstitutionTemplate() { + pos = tokenPos; + return token = scanTemplateAndSetTokenValue( + /* isTaggedTemplate */ + true + ); + } + function reScanJsxToken(allowMultilineJsxText) { + if (allowMultilineJsxText === void 0) { + allowMultilineJsxText = true; + } + pos = tokenPos = startPos; + return token = scanJsxToken(allowMultilineJsxText); + } + function reScanLessThanToken() { + if (token === 47) { + pos = tokenPos + 1; + return token = 29; + } + return token; + } + function reScanHashToken() { + if (token === 80) { + pos = tokenPos + 1; + return token = 62; + } + return token; + } + function reScanQuestionToken() { + ts6.Debug.assert(token === 60, "'reScanQuestionToken' should only be called on a '??'"); + pos = tokenPos + 1; + return token = 57; + } + function scanJsxToken(allowMultilineJsxText) { + if (allowMultilineJsxText === void 0) { + allowMultilineJsxText = true; + } + startPos = tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var char = text.charCodeAt(pos); + if (char === 60) { + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + return token = 30; + } + pos++; + return token = 29; + } + if (char === 123) { + pos++; + return token = 18; + } + var firstNonWhitespace = 0; + while (pos < end) { + char = text.charCodeAt(pos); + if (char === 123) { + break; + } + if (char === 60) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7; + } + break; + } + if (char === 62) { + error(ts6.Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1); + } + if (char === 125) { + error(ts6.Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1); + } + if (isLineBreak(char) && firstNonWhitespace === 0) { + firstNonWhitespace = -1; + } else if (!allowMultilineJsxText && isLineBreak(char) && firstNonWhitespace > 0) { + break; + } else if (!isWhiteSpaceLike(char)) { + firstNonWhitespace = pos; + } + pos++; + } + tokenValue = text.substring(startPos, pos); + return firstNonWhitespace === -1 ? 12 : 11; + } + function scanJsxIdentifier() { + if (tokenIsIdentifierOrKeyword(token)) { + var namespaceSeparator = false; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (ch === 45) { + tokenValue += "-"; + pos++; + continue; + } else if (ch === 58 && !namespaceSeparator) { + tokenValue += ":"; + pos++; + namespaceSeparator = true; + token = 79; + continue; + } + var oldPos = pos; + tokenValue += scanIdentifierParts(); + if (pos === oldPos) { + break; + } + } + if (tokenValue.slice(-1) === ":") { + tokenValue = tokenValue.slice(0, -1); + pos--; + } + return getIdentifierToken(); + } + return token; + } + function scanJsxAttributeValue() { + startPos = pos; + switch (text.charCodeAt(pos)) { + case 34: + case 39: + tokenValue = scanString( + /*jsxAttributeString*/ + true + ); + return token = 10; + default: + return scan(); + } + } + function reScanJsxAttributeValue() { + pos = tokenPos = startPos; + return scanJsxAttributeValue(); + } + function scanJsDocToken() { + startPos = tokenPos = pos; + tokenFlags = 0; + if (pos >= end) { + return token = 1; + } + var ch = codePointAt(text, pos); + pos += charSize(ch); + switch (ch) { + case 9: + case 11: + case 12: + case 32: + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + case 64: + return token = 59; + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + tokenFlags |= 1; + return token = 4; + case 42: + return token = 41; + case 123: + return token = 18; + case 125: + return token = 19; + case 91: + return token = 22; + case 93: + return token = 23; + case 60: + return token = 29; + case 62: + return token = 31; + case 61: + return token = 63; + case 44: + return token = 27; + case 46: + return token = 24; + case 96: + return token = 61; + case 35: + return token = 62; + case 92: + pos--; + var extendedCookedChar = peekExtendedUnicodeEscape(); + if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) { + pos += 3; + tokenFlags |= 8; + tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = getIdentifierToken(); + } + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { + pos += 6; + tokenFlags |= 1024; + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + pos++; + return token = 0; + } + if (isIdentifierStart(ch, languageVersion)) { + var char = ch; + while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === 45) + pos += charSize(char); + tokenValue = text.substring(tokenPos, pos); + if (char === 92) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } else { + return token = 0; + } + } + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var saveTokenFlags = tokenFlags; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + tokenFlags = saveTokenFlags; + } + return result; + } + function scanRange(start2, length2, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var saveTokenFlags = tokenFlags; + var saveErrorExpectations = commentDirectives; + setText(text, start2, length2); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + tokenFlags = saveTokenFlags; + commentDirectives = saveErrorExpectations; + return result; + } + function lookAhead(callback) { + return speculationHelper( + callback, + /*isLookahead*/ + true + ); + } + function tryScan(callback) { + return speculationHelper( + callback, + /*isLookahead*/ + false + ); + } + function getText() { + return text; + } + function clearCommentDirectives() { + commentDirectives = void 0; + } + function setText(newText, start2, length2) { + text = newText || ""; + end = length2 === void 0 ? text.length : start2 + length2; + setTextPos(start2 || 0); + } + function setOnError(errorCallback) { + onError = errorCallback; + } + function setScriptTarget(scriptTarget) { + languageVersion = scriptTarget; + } + function setLanguageVariant(variant) { + languageVariant = variant; + } + function setTextPos(textPos) { + ts6.Debug.assert(textPos >= 0); + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0; + tokenValue = void 0; + tokenFlags = 0; + } + function setInJSDocType(inType) { + inJSDocType += inType ? 1 : -1; + } + } + ts6.createScanner = createScanner; + var codePointAt = String.prototype.codePointAt ? function(s, i) { + return s.codePointAt(i); + } : function codePointAt2(str, i) { + var size = str.length; + if (i < 0 || i >= size) { + return void 0; + } + var first = str.charCodeAt(i); + if (first >= 55296 && first <= 56319 && size > i + 1) { + var second = str.charCodeAt(i + 1); + if (second >= 56320 && second <= 57343) { + return (first - 55296) * 1024 + second - 56320 + 65536; + } + } + return first; + }; + function charSize(ch) { + if (ch >= 65536) { + return 2; + } + return 1; + } + function utf16EncodeAsStringFallback(codePoint) { + ts6.Debug.assert(0 <= codePoint && codePoint <= 1114111); + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 55296; + var codeUnit2 = (codePoint - 65536) % 1024 + 56320; + return String.fromCharCode(codeUnit1, codeUnit2); + } + var utf16EncodeAsStringWorker = String.fromCodePoint ? function(codePoint) { + return String.fromCodePoint(codePoint); + } : utf16EncodeAsStringFallback; + function utf16EncodeAsString(codePoint) { + return utf16EncodeAsStringWorker(codePoint); + } + ts6.utf16EncodeAsString = utf16EncodeAsString; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function isExternalModuleNameRelative(moduleName) { + return ts6.pathIsRelative(moduleName) || ts6.isRootedDiskPath(moduleName); + } + ts6.isExternalModuleNameRelative = isExternalModuleNameRelative; + function sortAndDeduplicateDiagnostics(diagnostics) { + return ts6.sortAndDeduplicate(diagnostics, ts6.compareDiagnostics); + } + ts6.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics; + function getDefaultLibFileName(options) { + switch (ts6.getEmitScriptTarget(options)) { + case 99: + return "lib.esnext.full.d.ts"; + case 9: + return "lib.es2022.full.d.ts"; + case 8: + return "lib.es2021.full.d.ts"; + case 7: + return "lib.es2020.full.d.ts"; + case 6: + return "lib.es2019.full.d.ts"; + case 5: + return "lib.es2018.full.d.ts"; + case 4: + return "lib.es2017.full.d.ts"; + case 3: + return "lib.es2016.full.d.ts"; + case 2: + return "lib.es6.d.ts"; + default: + return "lib.d.ts"; + } + } + ts6.getDefaultLibFileName = getDefaultLibFileName; + function textSpanEnd(span) { + return span.start + span.length; + } + ts6.textSpanEnd = textSpanEnd; + function textSpanIsEmpty(span) { + return span.length === 0; + } + ts6.textSpanIsEmpty = textSpanIsEmpty; + function textSpanContainsPosition(span, position) { + return position >= span.start && position < textSpanEnd(span); + } + ts6.textSpanContainsPosition = textSpanContainsPosition; + function textRangeContainsPositionInclusive(span, position) { + return position >= span.pos && position <= span.end; + } + ts6.textRangeContainsPositionInclusive = textRangeContainsPositionInclusive; + function textSpanContainsTextSpan(span, other) { + return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); + } + ts6.textSpanContainsTextSpan = textSpanContainsTextSpan; + function textSpanOverlapsWith(span, other) { + return textSpanOverlap(span, other) !== void 0; + } + ts6.textSpanOverlapsWith = textSpanOverlapsWith; + function textSpanOverlap(span1, span2) { + var overlap = textSpanIntersection(span1, span2); + return overlap && overlap.length === 0 ? void 0 : overlap; + } + ts6.textSpanOverlap = textSpanOverlap; + function textSpanIntersectsWithTextSpan(span, other) { + return decodedTextSpanIntersectsWith(span.start, span.length, other.start, other.length); + } + ts6.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan; + function textSpanIntersectsWith(span, start, length) { + return decodedTextSpanIntersectsWith(span.start, span.length, start, length); + } + ts6.textSpanIntersectsWith = textSpanIntersectsWith; + function decodedTextSpanIntersectsWith(start1, length1, start2, length2) { + var end1 = start1 + length1; + var end2 = start2 + length2; + return start2 <= end1 && end2 >= start1; + } + ts6.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith; + function textSpanIntersectsWithPosition(span, position) { + return position <= textSpanEnd(span) && position >= span.start; + } + ts6.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition; + function textSpanIntersection(span1, span2) { + var start = Math.max(span1.start, span2.start); + var end = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + return start <= end ? createTextSpanFromBounds(start, end) : void 0; + } + ts6.textSpanIntersection = textSpanIntersection; + function createTextSpan(start, length) { + if (start < 0) { + throw new Error("start < 0"); + } + if (length < 0) { + throw new Error("length < 0"); + } + return { start, length }; + } + ts6.createTextSpan = createTextSpan; + function createTextSpanFromBounds(start, end) { + return createTextSpan(start, end - start); + } + ts6.createTextSpanFromBounds = createTextSpanFromBounds; + function textChangeRangeNewSpan(range2) { + return createTextSpan(range2.span.start, range2.newLength); + } + ts6.textChangeRangeNewSpan = textChangeRangeNewSpan; + function textChangeRangeIsUnchanged(range2) { + return textSpanIsEmpty(range2.span) && range2.newLength === 0; + } + ts6.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged; + function createTextChangeRange(span, newLength) { + if (newLength < 0) { + throw new Error("newLength < 0"); + } + return { span, newLength }; + } + ts6.createTextChangeRange = createTextChangeRange; + ts6.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); + function collapseTextChangeRangesAcrossMultipleVersions(changes) { + if (changes.length === 0) { + return ts6.unchangedTextChangeRange; + } + if (changes.length === 1) { + return changes[0]; + } + var change0 = changes[0]; + var oldStartN = change0.span.start; + var oldEndN = textSpanEnd(change0.span); + var newEndN = oldStartN + change0.newLength; + for (var i = 1; i < changes.length; i++) { + var nextChange = changes[i]; + var oldStart1 = oldStartN; + var oldEnd1 = oldEndN; + var newEnd1 = newEndN; + var oldStart2 = nextChange.span.start; + var oldEnd2 = textSpanEnd(nextChange.span); + var newEnd2 = oldStart2 + nextChange.newLength; + oldStartN = Math.min(oldStart1, oldStart2); + oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); + newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + } + return createTextChangeRange( + createTextSpanFromBounds(oldStartN, oldEndN), + /*newLength*/ + newEndN - oldStartN + ); + } + ts6.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; + function getTypeParameterOwner(d) { + if (d && d.kind === 165) { + for (var current = d; current; current = current.parent) { + if (isFunctionLike(current) || isClassLike2(current) || current.kind === 261) { + return current; + } + } + } + } + ts6.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration2(node, parent) { + return ts6.hasSyntacticModifier( + node, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + ) && parent.kind === 173; + } + ts6.isParameterPropertyDeclaration = isParameterPropertyDeclaration2; + function isEmptyBindingPattern(node) { + if (isBindingPattern(node)) { + return ts6.every(node.elements, isEmptyBindingElement); + } + return false; + } + ts6.isEmptyBindingPattern = isEmptyBindingPattern; + function isEmptyBindingElement(node) { + if (ts6.isOmittedExpression(node)) { + return true; + } + return isEmptyBindingPattern(node.name); + } + ts6.isEmptyBindingElement = isEmptyBindingElement; + function walkUpBindingElementsAndPatterns(binding) { + var node = binding.parent; + while (ts6.isBindingElement(node.parent)) { + node = node.parent.parent; + } + return node.parent; + } + ts6.walkUpBindingElementsAndPatterns = walkUpBindingElementsAndPatterns; + function getCombinedFlags(node, getFlags) { + if (ts6.isBindingElement(node)) { + node = walkUpBindingElementsAndPatterns(node); + } + var flags = getFlags(node); + if (node.kind === 257) { + node = node.parent; + } + if (node && node.kind === 258) { + flags |= getFlags(node); + node = node.parent; + } + if (node && node.kind === 240) { + flags |= getFlags(node); + } + return flags; + } + function getCombinedModifierFlags(node) { + return getCombinedFlags(node, ts6.getEffectiveModifierFlags); + } + ts6.getCombinedModifierFlags = getCombinedModifierFlags; + function getCombinedNodeFlagsAlwaysIncludeJSDoc(node) { + return getCombinedFlags(node, ts6.getEffectiveModifierFlagsAlwaysIncludeJSDoc); + } + ts6.getCombinedNodeFlagsAlwaysIncludeJSDoc = getCombinedNodeFlagsAlwaysIncludeJSDoc; + function getCombinedNodeFlags2(node) { + return getCombinedFlags(node, function(n) { + return n.flags; + }); + } + ts6.getCombinedNodeFlags = getCombinedNodeFlags2; + ts6.supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"]; + function validateLocaleAndSetLanguage(locale, sys, errors2) { + var lowerCaseLocale = locale.toLowerCase(); + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(lowerCaseLocale); + if (!matchResult) { + if (errors2) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + if (ts6.contains(ts6.supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors2)) { + trySetLanguageAndTerritory( + language, + /*territory*/ + void 0, + errors2 + ); + } + ts6.setUILocale(locale); + function trySetLanguageAndTerritory(language2, territory2, errors3) { + var compilerFilePath = ts6.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts6.getDirectoryPath(compilerFilePath); + var filePath = ts6.combinePaths(containingDirectoryPath, language2); + if (territory2) { + filePath = filePath + "-" + territory2; + } + filePath = sys.resolvePath(ts6.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; + } + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } catch (e) { + if (errors3) { + errors3.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts6.setLocalizedDiagnosticMessages(JSON.parse(fileContents)); + } catch (_a) { + if (errors3) { + errors3.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; + } + } + ts6.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== void 0) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : void 0; + } + ts6.getOriginalNode = getOriginalNode; + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return void 0; + } else if (result) { + return node; + } + node = node.parent; + } + return void 0; + } + ts6.findAncestor = findAncestor; + function isParseTreeNode(node) { + return (node.flags & 8) === 0; + } + ts6.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (node === void 0 || isParseTreeNode(node)) { + return node; + } + node = node.original; + while (node) { + if (isParseTreeNode(node)) { + return !nodeTest || nodeTest(node) ? node : void 0; + } + node = node.original; + } + } + ts6.getParseTreeNode = getParseTreeNode; + function escapeLeadingUnderscores(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; + } + ts6.escapeLeadingUnderscores = escapeLeadingUnderscores; + function unescapeLeadingUnderscores(identifier) { + var id = identifier; + return id.length >= 3 && id.charCodeAt(0) === 95 && id.charCodeAt(1) === 95 && id.charCodeAt(2) === 95 ? id.substr(1) : id; + } + ts6.unescapeLeadingUnderscores = unescapeLeadingUnderscores; + function idText(identifierOrPrivateName) { + return unescapeLeadingUnderscores(identifierOrPrivateName.escapedText); + } + ts6.idText = idText; + function symbolName(symbol) { + if (symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) { + return idText(symbol.valueDeclaration.name); + } + return unescapeLeadingUnderscores(symbol.escapedName); + } + ts6.symbolName = symbolName; + function nameForNamelessJSDocTypedef(declaration) { + var hostNode = declaration.parent.parent; + if (!hostNode) { + return void 0; + } + if (isDeclaration(hostNode)) { + return getDeclarationIdentifier(hostNode); + } + switch (hostNode.kind) { + case 240: + if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { + return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); + } + break; + case 241: + var expr = hostNode.expression; + if (expr.kind === 223 && expr.operatorToken.kind === 63) { + expr = expr.left; + } + switch (expr.kind) { + case 208: + return expr.name; + case 209: + var arg = expr.argumentExpression; + if (ts6.isIdentifier(arg)) { + return arg; + } + } + break; + case 214: { + return getDeclarationIdentifier(hostNode.expression); + } + case 253: { + if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { + return getDeclarationIdentifier(hostNode.statement); + } + break; + } + } + } + function getDeclarationIdentifier(node) { + var name = getNameOfDeclaration(node); + return name && ts6.isIdentifier(name) ? name : void 0; + } + function nodeHasName(statement, name) { + if (isNamedDeclaration(statement) && ts6.isIdentifier(statement.name) && idText(statement.name) === idText(name)) { + return true; + } + if (ts6.isVariableStatement(statement) && ts6.some(statement.declarationList.declarations, function(d) { + return nodeHasName(d, name); + })) { + return true; + } + return false; + } + ts6.nodeHasName = nodeHasName; + function getNameOfJSDocTypedef(declaration) { + return declaration.name || nameForNamelessJSDocTypedef(declaration); + } + ts6.getNameOfJSDocTypedef = getNameOfJSDocTypedef; + function isNamedDeclaration(node) { + return !!node.name; + } + ts6.isNamedDeclaration = isNamedDeclaration; + function getNonAssignedNameOfDeclaration(declaration) { + switch (declaration.kind) { + case 79: + return declaration; + case 350: + case 343: { + var name = declaration.name; + if (name.kind === 163) { + return name.right; + } + break; + } + case 210: + case 223: { + var expr_1 = declaration; + switch (ts6.getAssignmentDeclarationKind(expr_1)) { + case 1: + case 4: + case 5: + case 3: + return ts6.getElementOrPropertyAccessArgumentExpressionOrName(expr_1.left); + case 7: + case 8: + case 9: + return expr_1.arguments[1]; + default: + return void 0; + } + } + case 348: + return getNameOfJSDocTypedef(declaration); + case 342: + return nameForNamelessJSDocTypedef(declaration); + case 274: { + var expression = declaration.expression; + return ts6.isIdentifier(expression) ? expression : void 0; + } + case 209: + var expr = declaration; + if (ts6.isBindableStaticElementAccessExpression(expr)) { + return expr.argumentExpression; + } + } + return declaration.name; + } + ts6.getNonAssignedNameOfDeclaration = getNonAssignedNameOfDeclaration; + function getNameOfDeclaration(declaration) { + if (declaration === void 0) + return void 0; + return getNonAssignedNameOfDeclaration(declaration) || (ts6.isFunctionExpression(declaration) || ts6.isArrowFunction(declaration) || ts6.isClassExpression(declaration) ? getAssignedName(declaration) : void 0); + } + ts6.getNameOfDeclaration = getNameOfDeclaration; + function getAssignedName(node) { + if (!node.parent) { + return void 0; + } else if (ts6.isPropertyAssignment(node.parent) || ts6.isBindingElement(node.parent)) { + return node.parent.name; + } else if (ts6.isBinaryExpression(node.parent) && node === node.parent.right) { + if (ts6.isIdentifier(node.parent.left)) { + return node.parent.left; + } else if (ts6.isAccessExpression(node.parent.left)) { + return ts6.getElementOrPropertyAccessArgumentExpressionOrName(node.parent.left); + } + } else if (ts6.isVariableDeclaration(node.parent) && ts6.isIdentifier(node.parent.name)) { + return node.parent.name; + } + } + ts6.getAssignedName = getAssignedName; + function getDecorators(node) { + if (ts6.hasDecorators(node)) { + return ts6.filter(node.modifiers, ts6.isDecorator); + } + } + ts6.getDecorators = getDecorators; + function getModifiers(node) { + if (ts6.hasSyntacticModifier( + node, + 126975 + /* ModifierFlags.Modifier */ + )) { + return ts6.filter(node.modifiers, isModifier); + } + } + ts6.getModifiers = getModifiers; + function getJSDocParameterTagsWorker(param, noCache) { + if (param.name) { + if (ts6.isIdentifier(param.name)) { + var name_1 = param.name.escapedText; + return getJSDocTagsWorker(param.parent, noCache).filter(function(tag) { + return ts6.isJSDocParameterTag(tag) && ts6.isIdentifier(tag.name) && tag.name.escapedText === name_1; + }); + } else { + var i = param.parent.parameters.indexOf(param); + ts6.Debug.assert(i > -1, "Parameters should always be in their parents' parameter list"); + var paramTags = getJSDocTagsWorker(param.parent, noCache).filter(ts6.isJSDocParameterTag); + if (i < paramTags.length) { + return [paramTags[i]]; + } + } + } + return ts6.emptyArray; + } + function getJSDocParameterTags(param) { + return getJSDocParameterTagsWorker( + param, + /*noCache*/ + false + ); + } + ts6.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocParameterTagsNoCache(param) { + return getJSDocParameterTagsWorker( + param, + /*noCache*/ + true + ); + } + ts6.getJSDocParameterTagsNoCache = getJSDocParameterTagsNoCache; + function getJSDocTypeParameterTagsWorker(param, noCache) { + var name = param.name.escapedText; + return getJSDocTagsWorker(param.parent, noCache).filter(function(tag) { + return ts6.isJSDocTemplateTag(tag) && tag.typeParameters.some(function(tp) { + return tp.name.escapedText === name; + }); + }); + } + function getJSDocTypeParameterTags(param) { + return getJSDocTypeParameterTagsWorker( + param, + /*noCache*/ + false + ); + } + ts6.getJSDocTypeParameterTags = getJSDocTypeParameterTags; + function getJSDocTypeParameterTagsNoCache(param) { + return getJSDocTypeParameterTagsWorker( + param, + /*noCache*/ + true + ); + } + ts6.getJSDocTypeParameterTagsNoCache = getJSDocTypeParameterTagsNoCache; + function hasJSDocParameterTags(node) { + return !!getFirstJSDocTag(node, ts6.isJSDocParameterTag); + } + ts6.hasJSDocParameterTags = hasJSDocParameterTags; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocAugmentsTag); + } + ts6.getJSDocAugmentsTag = getJSDocAugmentsTag; + function getJSDocImplementsTags(node) { + return getAllJSDocTags(node, ts6.isJSDocImplementsTag); + } + ts6.getJSDocImplementsTags = getJSDocImplementsTags; + function getJSDocClassTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocClassTag); + } + ts6.getJSDocClassTag = getJSDocClassTag; + function getJSDocPublicTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocPublicTag); + } + ts6.getJSDocPublicTag = getJSDocPublicTag; + function getJSDocPublicTagNoCache(node) { + return getFirstJSDocTag( + node, + ts6.isJSDocPublicTag, + /*noCache*/ + true + ); + } + ts6.getJSDocPublicTagNoCache = getJSDocPublicTagNoCache; + function getJSDocPrivateTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocPrivateTag); + } + ts6.getJSDocPrivateTag = getJSDocPrivateTag; + function getJSDocPrivateTagNoCache(node) { + return getFirstJSDocTag( + node, + ts6.isJSDocPrivateTag, + /*noCache*/ + true + ); + } + ts6.getJSDocPrivateTagNoCache = getJSDocPrivateTagNoCache; + function getJSDocProtectedTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocProtectedTag); + } + ts6.getJSDocProtectedTag = getJSDocProtectedTag; + function getJSDocProtectedTagNoCache(node) { + return getFirstJSDocTag( + node, + ts6.isJSDocProtectedTag, + /*noCache*/ + true + ); + } + ts6.getJSDocProtectedTagNoCache = getJSDocProtectedTagNoCache; + function getJSDocReadonlyTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocReadonlyTag); + } + ts6.getJSDocReadonlyTag = getJSDocReadonlyTag; + function getJSDocReadonlyTagNoCache(node) { + return getFirstJSDocTag( + node, + ts6.isJSDocReadonlyTag, + /*noCache*/ + true + ); + } + ts6.getJSDocReadonlyTagNoCache = getJSDocReadonlyTagNoCache; + function getJSDocOverrideTagNoCache(node) { + return getFirstJSDocTag( + node, + ts6.isJSDocOverrideTag, + /*noCache*/ + true + ); + } + ts6.getJSDocOverrideTagNoCache = getJSDocOverrideTagNoCache; + function getJSDocDeprecatedTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocDeprecatedTag); + } + ts6.getJSDocDeprecatedTag = getJSDocDeprecatedTag; + function getJSDocDeprecatedTagNoCache(node) { + return getFirstJSDocTag( + node, + ts6.isJSDocDeprecatedTag, + /*noCache*/ + true + ); + } + ts6.getJSDocDeprecatedTagNoCache = getJSDocDeprecatedTagNoCache; + function getJSDocEnumTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocEnumTag); + } + ts6.getJSDocEnumTag = getJSDocEnumTag; + function getJSDocThisTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocThisTag); + } + ts6.getJSDocThisTag = getJSDocThisTag; + function getJSDocReturnTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocReturnTag); + } + ts6.getJSDocReturnTag = getJSDocReturnTag; + function getJSDocTemplateTag(node) { + return getFirstJSDocTag(node, ts6.isJSDocTemplateTag); + } + ts6.getJSDocTemplateTag = getJSDocTemplateTag; + function getJSDocTypeTag(node) { + var tag = getFirstJSDocTag(node, ts6.isJSDocTypeTag); + if (tag && tag.typeExpression && tag.typeExpression.type) { + return tag; + } + return void 0; + } + ts6.getJSDocTypeTag = getJSDocTypeTag; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, ts6.isJSDocTypeTag); + if (!tag && ts6.isParameter(node)) { + tag = ts6.find(getJSDocParameterTags(node), function(tag2) { + return !!tag2.typeExpression; + }); + } + return tag && tag.typeExpression && tag.typeExpression.type; + } + ts6.getJSDocType = getJSDocType; + function getJSDocReturnType(node) { + var returnTag = getJSDocReturnTag(node); + if (returnTag && returnTag.typeExpression) { + return returnTag.typeExpression.type; + } + var typeTag = getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression) { + var type = typeTag.typeExpression.type; + if (ts6.isTypeLiteralNode(type)) { + var sig = ts6.find(type.members, ts6.isCallSignatureDeclaration); + return sig && sig.type; + } + if (ts6.isFunctionTypeNode(type) || ts6.isJSDocFunctionType(type)) { + return type.type; + } + } + } + ts6.getJSDocReturnType = getJSDocReturnType; + function getJSDocTagsWorker(node, noCache) { + var tags = node.jsDocCache; + if (tags === void 0 || noCache) { + var comments = ts6.getJSDocCommentsAndTags(node, noCache); + ts6.Debug.assert(comments.length < 2 || comments[0] !== comments[1]); + tags = ts6.flatMap(comments, function(j) { + return ts6.isJSDoc(j) ? j.tags : j; + }); + if (!noCache) { + node.jsDocCache = tags; + } + } + return tags; + } + function getJSDocTags(node) { + return getJSDocTagsWorker( + node, + /*noCache*/ + false + ); + } + ts6.getJSDocTags = getJSDocTags; + function getJSDocTagsNoCache(node) { + return getJSDocTagsWorker( + node, + /*noCache*/ + true + ); + } + ts6.getJSDocTagsNoCache = getJSDocTagsNoCache; + function getFirstJSDocTag(node, predicate, noCache) { + return ts6.find(getJSDocTagsWorker(node, noCache), predicate); + } + function getAllJSDocTags(node, predicate) { + return getJSDocTags(node).filter(predicate); + } + ts6.getAllJSDocTags = getAllJSDocTags; + function getAllJSDocTagsOfKind(node, kind) { + return getJSDocTags(node).filter(function(doc) { + return doc.kind === kind; + }); + } + ts6.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind; + function getTextOfJSDocComment(comment) { + return typeof comment === "string" ? comment : comment === null || comment === void 0 ? void 0 : comment.map(function(c) { + return c.kind === 324 ? c.text : formatJSDocLink(c); + }).join(""); + } + ts6.getTextOfJSDocComment = getTextOfJSDocComment; + function formatJSDocLink(link) { + var kind = link.kind === 327 ? "link" : link.kind === 328 ? "linkcode" : "linkplain"; + var name = link.name ? ts6.entityNameToString(link.name) : ""; + var space = link.name && link.text.startsWith("://") ? "" : " "; + return "{@".concat(kind, " ").concat(name).concat(space).concat(link.text, "}"); + } + function getEffectiveTypeParameterDeclarations(node) { + if (ts6.isJSDocSignature(node)) { + return ts6.emptyArray; + } + if (ts6.isJSDocTypeAlias(node)) { + ts6.Debug.assert( + node.parent.kind === 323 + /* SyntaxKind.JSDoc */ + ); + return ts6.flatMap(node.parent.tags, function(tag) { + return ts6.isJSDocTemplateTag(tag) ? tag.typeParameters : void 0; + }); + } + if (node.typeParameters) { + return node.typeParameters; + } + if (ts6.canHaveIllegalTypeParameters(node) && node.typeParameters) { + return node.typeParameters; + } + if (ts6.isInJSFile(node)) { + var decls = ts6.getJSDocTypeParameterDeclarations(node); + if (decls.length) { + return decls; + } + var typeTag = getJSDocType(node); + if (typeTag && ts6.isFunctionTypeNode(typeTag) && typeTag.typeParameters) { + return typeTag.typeParameters; + } + } + return ts6.emptyArray; + } + ts6.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations; + function getEffectiveConstraintOfTypeParameter(node) { + return node.constraint ? node.constraint : ts6.isJSDocTemplateTag(node.parent) && node === node.parent.typeParameters[0] ? node.parent.constraint : void 0; + } + ts6.getEffectiveConstraintOfTypeParameter = getEffectiveConstraintOfTypeParameter; + function isMemberName(node) { + return node.kind === 79 || node.kind === 80; + } + ts6.isMemberName = isMemberName; + function isGetOrSetAccessorDeclaration(node) { + return node.kind === 175 || node.kind === 174; + } + ts6.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; + function isPropertyAccessChain(node) { + return ts6.isPropertyAccessExpression(node) && !!(node.flags & 32); + } + ts6.isPropertyAccessChain = isPropertyAccessChain; + function isElementAccessChain(node) { + return ts6.isElementAccessExpression(node) && !!(node.flags & 32); + } + ts6.isElementAccessChain = isElementAccessChain; + function isCallChain(node) { + return ts6.isCallExpression(node) && !!(node.flags & 32); + } + ts6.isCallChain = isCallChain; + function isOptionalChain2(node) { + var kind = node.kind; + return !!(node.flags & 32) && (kind === 208 || kind === 209 || kind === 210 || kind === 232); + } + ts6.isOptionalChain = isOptionalChain2; + function isOptionalChainRoot(node) { + return isOptionalChain2(node) && !ts6.isNonNullExpression(node) && !!node.questionDotToken; + } + ts6.isOptionalChainRoot = isOptionalChainRoot; + function isExpressionOfOptionalChainRoot(node) { + return isOptionalChainRoot(node.parent) && node.parent.expression === node; + } + ts6.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot; + function isOutermostOptionalChain(node) { + return !isOptionalChain2(node.parent) || isOptionalChainRoot(node.parent) || node !== node.parent.expression; + } + ts6.isOutermostOptionalChain = isOutermostOptionalChain; + function isNullishCoalesce(node) { + return node.kind === 223 && node.operatorToken.kind === 60; + } + ts6.isNullishCoalesce = isNullishCoalesce; + function isConstTypeReference(node) { + return ts6.isTypeReferenceNode(node) && ts6.isIdentifier(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; + } + ts6.isConstTypeReference = isConstTypeReference; + function skipPartiallyEmittedExpressions(node) { + return ts6.skipOuterExpressions( + node, + 8 + /* OuterExpressionKinds.PartiallyEmittedExpressions */ + ); + } + ts6.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; + function isNonNullChain(node) { + return ts6.isNonNullExpression(node) && !!(node.flags & 32); + } + ts6.isNonNullChain = isNonNullChain; + function isBreakOrContinueStatement(node) { + return node.kind === 249 || node.kind === 248; + } + ts6.isBreakOrContinueStatement = isBreakOrContinueStatement; + function isNamedExportBindings(node) { + return node.kind === 277 || node.kind === 276; + } + ts6.isNamedExportBindings = isNamedExportBindings; + function isUnparsedTextLike(node) { + switch (node.kind) { + case 305: + case 306: + return true; + default: + return false; + } + } + ts6.isUnparsedTextLike = isUnparsedTextLike; + function isUnparsedNode(node) { + return isUnparsedTextLike(node) || node.kind === 303 || node.kind === 307; + } + ts6.isUnparsedNode = isUnparsedNode; + function isJSDocPropertyLikeTag(node) { + return node.kind === 350 || node.kind === 343; + } + ts6.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; + function isNode(node) { + return isNodeKind(node.kind); + } + ts6.isNode = isNode; + function isNodeKind(kind) { + return kind >= 163; + } + ts6.isNodeKind = isNodeKind; + function isTokenKind(kind) { + return kind >= 0 && kind <= 162; + } + ts6.isTokenKind = isTokenKind; + function isToken(n) { + return isTokenKind(n.kind); + } + ts6.isToken = isToken; + function isNodeArray(array) { + return ts6.hasProperty(array, "pos") && ts6.hasProperty(array, "end"); + } + ts6.isNodeArray = isNodeArray; + function isLiteralKind(kind) { + return 8 <= kind && kind <= 14; + } + ts6.isLiteralKind = isLiteralKind; + function isLiteralExpression(node) { + return isLiteralKind(node.kind); + } + ts6.isLiteralExpression = isLiteralExpression; + function isLiteralExpressionOfObject(node) { + switch (node.kind) { + case 207: + case 206: + case 13: + case 215: + case 228: + return true; + } + return false; + } + ts6.isLiteralExpressionOfObject = isLiteralExpressionOfObject; + function isTemplateLiteralKind(kind) { + return 14 <= kind && kind <= 17; + } + ts6.isTemplateLiteralKind = isTemplateLiteralKind; + function isTemplateLiteralToken(node) { + return isTemplateLiteralKind(node.kind); + } + ts6.isTemplateLiteralToken = isTemplateLiteralToken; + function isTemplateMiddleOrTemplateTail(node) { + var kind = node.kind; + return kind === 16 || kind === 17; + } + ts6.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail; + function isImportOrExportSpecifier(node) { + return ts6.isImportSpecifier(node) || ts6.isExportSpecifier(node); + } + ts6.isImportOrExportSpecifier = isImportOrExportSpecifier; + function isTypeOnlyImportOrExportDeclaration(node) { + switch (node.kind) { + case 273: + case 278: + return node.isTypeOnly || node.parent.parent.isTypeOnly; + case 271: + return node.parent.isTypeOnly; + case 270: + case 268: + return node.isTypeOnly; + default: + return false; + } + } + ts6.isTypeOnlyImportOrExportDeclaration = isTypeOnlyImportOrExportDeclaration; + function isAssertionKey(node) { + return ts6.isStringLiteral(node) || ts6.isIdentifier(node); + } + ts6.isAssertionKey = isAssertionKey; + function isStringTextContainingNode(node) { + return node.kind === 10 || isTemplateLiteralKind(node.kind); + } + ts6.isStringTextContainingNode = isStringTextContainingNode; + function isGeneratedIdentifier(node) { + return ts6.isIdentifier(node) && (node.autoGenerateFlags & 7) > 0; + } + ts6.isGeneratedIdentifier = isGeneratedIdentifier; + function isGeneratedPrivateIdentifier(node) { + return ts6.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7) > 0; + } + ts6.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; + function isPrivateIdentifierClassElementDeclaration(node) { + return (ts6.isPropertyDeclaration(node) || isMethodOrAccessor(node)) && ts6.isPrivateIdentifier(node.name); + } + ts6.isPrivateIdentifierClassElementDeclaration = isPrivateIdentifierClassElementDeclaration; + function isPrivateIdentifierPropertyAccessExpression(node) { + return ts6.isPropertyAccessExpression(node) && ts6.isPrivateIdentifier(node.name); + } + ts6.isPrivateIdentifierPropertyAccessExpression = isPrivateIdentifierPropertyAccessExpression; + function isModifierKind(token) { + switch (token) { + case 126: + case 127: + case 132: + case 85: + case 136: + case 88: + case 93: + case 101: + case 123: + case 121: + case 122: + case 146: + case 124: + case 145: + case 161: + return true; + } + return false; + } + ts6.isModifierKind = isModifierKind; + function isParameterPropertyModifier(kind) { + return !!(ts6.modifierToFlag(kind) & 16476); + } + ts6.isParameterPropertyModifier = isParameterPropertyModifier; + function isClassMemberModifier(idToken) { + return isParameterPropertyModifier(idToken) || idToken === 124 || idToken === 161 || idToken === 127; + } + ts6.isClassMemberModifier = isClassMemberModifier; + function isModifier(node) { + return isModifierKind(node.kind); + } + ts6.isModifier = isModifier; + function isEntityName(node) { + var kind = node.kind; + return kind === 163 || kind === 79; + } + ts6.isEntityName = isEntityName; + function isPropertyName(node) { + var kind = node.kind; + return kind === 79 || kind === 80 || kind === 10 || kind === 8 || kind === 164; + } + ts6.isPropertyName = isPropertyName; + function isBindingName(node) { + var kind = node.kind; + return kind === 79 || kind === 203 || kind === 204; + } + ts6.isBindingName = isBindingName; + function isFunctionLike(node) { + return !!node && isFunctionLikeKind(node.kind); + } + ts6.isFunctionLike = isFunctionLike; + function isFunctionLikeOrClassStaticBlockDeclaration(node) { + return !!node && (isFunctionLikeKind(node.kind) || ts6.isClassStaticBlockDeclaration(node)); + } + ts6.isFunctionLikeOrClassStaticBlockDeclaration = isFunctionLikeOrClassStaticBlockDeclaration; + function isFunctionLikeDeclaration(node) { + return node && isFunctionLikeDeclarationKind(node.kind); + } + ts6.isFunctionLikeDeclaration = isFunctionLikeDeclaration; + function isBooleanLiteral(node) { + return node.kind === 110 || node.kind === 95; + } + ts6.isBooleanLiteral = isBooleanLiteral; + function isFunctionLikeDeclarationKind(kind) { + switch (kind) { + case 259: + case 171: + case 173: + case 174: + case 175: + case 215: + case 216: + return true; + default: + return false; + } + } + function isFunctionLikeKind(kind) { + switch (kind) { + case 170: + case 176: + case 326: + case 177: + case 178: + case 181: + case 320: + case 182: + return true; + default: + return isFunctionLikeDeclarationKind(kind); + } + } + ts6.isFunctionLikeKind = isFunctionLikeKind; + function isFunctionOrModuleBlock(node) { + return ts6.isSourceFile(node) || ts6.isModuleBlock(node) || ts6.isBlock(node) && isFunctionLike(node.parent); + } + ts6.isFunctionOrModuleBlock = isFunctionOrModuleBlock; + function isClassElement(node) { + var kind = node.kind; + return kind === 173 || kind === 169 || kind === 171 || kind === 174 || kind === 175 || kind === 178 || kind === 172 || kind === 237; + } + ts6.isClassElement = isClassElement; + function isClassLike2(node) { + return node && (node.kind === 260 || node.kind === 228); + } + ts6.isClassLike = isClassLike2; + function isAccessor(node) { + return node && (node.kind === 174 || node.kind === 175); + } + ts6.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts6.isPropertyDeclaration(node) && ts6.hasAccessorModifier(node); + } + ts6.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; + function isMethodOrAccessor(node) { + switch (node.kind) { + case 171: + case 174: + case 175: + return true; + default: + return false; + } + } + ts6.isMethodOrAccessor = isMethodOrAccessor; + function isNamedClassElement(node) { + switch (node.kind) { + case 171: + case 174: + case 175: + case 169: + return true; + default: + return false; + } + } + ts6.isNamedClassElement = isNamedClassElement; + function isModifierLike(node) { + return isModifier(node) || ts6.isDecorator(node); + } + ts6.isModifierLike = isModifierLike; + function isTypeElement(node) { + var kind = node.kind; + return kind === 177 || kind === 176 || kind === 168 || kind === 170 || kind === 178 || kind === 174 || kind === 175; + } + ts6.isTypeElement = isTypeElement; + function isClassOrTypeElement(node) { + return isTypeElement(node) || isClassElement(node); + } + ts6.isClassOrTypeElement = isClassOrTypeElement; + function isObjectLiteralElementLike(node) { + var kind = node.kind; + return kind === 299 || kind === 300 || kind === 301 || kind === 171 || kind === 174 || kind === 175; + } + ts6.isObjectLiteralElementLike = isObjectLiteralElementLike; + function isTypeNode(node) { + return ts6.isTypeNodeKind(node.kind); + } + ts6.isTypeNode = isTypeNode; + function isFunctionOrConstructorTypeNode(node) { + switch (node.kind) { + case 181: + case 182: + return true; + } + return false; + } + ts6.isFunctionOrConstructorTypeNode = isFunctionOrConstructorTypeNode; + function isBindingPattern(node) { + if (node) { + var kind = node.kind; + return kind === 204 || kind === 203; + } + return false; + } + ts6.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { + var kind = node.kind; + return kind === 206 || kind === 207; + } + ts6.isAssignmentPattern = isAssignmentPattern; + function isArrayBindingElement(node) { + var kind = node.kind; + return kind === 205 || kind === 229; + } + ts6.isArrayBindingElement = isArrayBindingElement; + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 257: + case 166: + case 205: + return true; + } + return false; + } + ts6.isDeclarationBindingElement = isDeclarationBindingElement; + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) || isArrayBindingOrAssignmentPattern(node); + } + ts6.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 203: + case 207: + return true; + } + return false; + } + ts6.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + function isObjectBindingOrAssignmentElement(node) { + switch (node.kind) { + case 205: + case 299: + case 300: + case 301: + return true; + } + return false; + } + ts6.isObjectBindingOrAssignmentElement = isObjectBindingOrAssignmentElement; + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 204: + case 206: + return true; + } + return false; + } + ts6.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { + var kind = node.kind; + return kind === 208 || kind === 163 || kind === 202; + } + ts6.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; + function isPropertyAccessOrQualifiedName(node) { + var kind = node.kind; + return kind === 208 || kind === 163; + } + ts6.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; + function isCallLikeExpression(node) { + switch (node.kind) { + case 283: + case 282: + case 210: + case 211: + case 212: + case 167: + return true; + default: + return false; + } + } + ts6.isCallLikeExpression = isCallLikeExpression; + function isCallOrNewExpression(node) { + return node.kind === 210 || node.kind === 211; + } + ts6.isCallOrNewExpression = isCallOrNewExpression; + function isTemplateLiteral(node) { + var kind = node.kind; + return kind === 225 || kind === 14; + } + ts6.isTemplateLiteral = isTemplateLiteral; + function isLeftHandSideExpression(node) { + return isLeftHandSideExpressionKind(skipPartiallyEmittedExpressions(node).kind); + } + ts6.isLeftHandSideExpression = isLeftHandSideExpression; + function isLeftHandSideExpressionKind(kind) { + switch (kind) { + case 208: + case 209: + case 211: + case 210: + case 281: + case 282: + case 285: + case 212: + case 206: + case 214: + case 207: + case 228: + case 215: + case 79: + case 80: + case 13: + case 8: + case 9: + case 10: + case 14: + case 225: + case 95: + case 104: + case 108: + case 110: + case 106: + case 232: + case 230: + case 233: + case 100: + return true; + default: + return false; + } + } + function isUnaryExpression(node) { + return isUnaryExpressionKind(skipPartiallyEmittedExpressions(node).kind); + } + ts6.isUnaryExpression = isUnaryExpression; + function isUnaryExpressionKind(kind) { + switch (kind) { + case 221: + case 222: + case 217: + case 218: + case 219: + case 220: + case 213: + return true; + default: + return isLeftHandSideExpressionKind(kind); + } + } + function isUnaryExpressionWithWrite(expr) { + switch (expr.kind) { + case 222: + return true; + case 221: + return expr.operator === 45 || expr.operator === 46; + default: + return false; + } + } + ts6.isUnaryExpressionWithWrite = isUnaryExpressionWithWrite; + function isExpression(node) { + return isExpressionKind(skipPartiallyEmittedExpressions(node).kind); + } + ts6.isExpression = isExpression; + function isExpressionKind(kind) { + switch (kind) { + case 224: + case 226: + case 216: + case 223: + case 227: + case 231: + case 229: + case 354: + case 353: + case 235: + return true; + default: + return isUnaryExpressionKind(kind); + } + } + function isAssertionExpression(node) { + var kind = node.kind; + return kind === 213 || kind === 231; + } + ts6.isAssertionExpression = isAssertionExpression; + function isNotEmittedOrPartiallyEmittedNode(node) { + return ts6.isNotEmittedStatement(node) || ts6.isPartiallyEmittedExpression(node); + } + ts6.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; + function isIterationStatement(node, lookInLabeledStatements) { + switch (node.kind) { + case 245: + case 246: + case 247: + case 243: + case 244: + return true; + case 253: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); + } + return false; + } + ts6.isIterationStatement = isIterationStatement; + function isScopeMarker(node) { + return ts6.isExportAssignment(node) || ts6.isExportDeclaration(node); + } + ts6.isScopeMarker = isScopeMarker; + function hasScopeMarker(statements) { + return ts6.some(statements, isScopeMarker); + } + ts6.hasScopeMarker = hasScopeMarker; + function needsScopeMarker(result) { + return !ts6.isAnyImportOrReExport(result) && !ts6.isExportAssignment(result) && !ts6.hasSyntacticModifier( + result, + 1 + /* ModifierFlags.Export */ + ) && !ts6.isAmbientModule(result); + } + ts6.needsScopeMarker = needsScopeMarker; + function isExternalModuleIndicator(result) { + return ts6.isAnyImportOrReExport(result) || ts6.isExportAssignment(result) || ts6.hasSyntacticModifier( + result, + 1 + /* ModifierFlags.Export */ + ); + } + ts6.isExternalModuleIndicator = isExternalModuleIndicator; + function isForInOrOfStatement(node) { + return node.kind === 246 || node.kind === 247; + } + ts6.isForInOrOfStatement = isForInOrOfStatement; + function isConciseBody(node) { + return ts6.isBlock(node) || isExpression(node); + } + ts6.isConciseBody = isConciseBody; + function isFunctionBody(node) { + return ts6.isBlock(node); + } + ts6.isFunctionBody = isFunctionBody; + function isForInitializer(node) { + return ts6.isVariableDeclarationList(node) || isExpression(node); + } + ts6.isForInitializer = isForInitializer; + function isModuleBody(node) { + var kind = node.kind; + return kind === 265 || kind === 264 || kind === 79; + } + ts6.isModuleBody = isModuleBody; + function isNamespaceBody(node) { + var kind = node.kind; + return kind === 265 || kind === 264; + } + ts6.isNamespaceBody = isNamespaceBody; + function isJSDocNamespaceBody(node) { + var kind = node.kind; + return kind === 79 || kind === 264; + } + ts6.isJSDocNamespaceBody = isJSDocNamespaceBody; + function isNamedImportBindings(node) { + var kind = node.kind; + return kind === 272 || kind === 271; + } + ts6.isNamedImportBindings = isNamedImportBindings; + function isModuleOrEnumDeclaration(node) { + return node.kind === 264 || node.kind === 263; + } + ts6.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; + function isDeclarationKind(kind) { + return kind === 216 || kind === 205 || kind === 260 || kind === 228 || kind === 172 || kind === 173 || kind === 263 || kind === 302 || kind === 278 || kind === 259 || kind === 215 || kind === 174 || kind === 270 || kind === 268 || kind === 273 || kind === 261 || kind === 288 || kind === 171 || kind === 170 || kind === 264 || kind === 267 || kind === 271 || kind === 277 || kind === 166 || kind === 299 || kind === 169 || kind === 168 || kind === 175 || kind === 300 || kind === 262 || kind === 165 || kind === 257 || kind === 348 || kind === 341 || kind === 350; + } + function isDeclarationStatementKind(kind) { + return kind === 259 || kind === 279 || kind === 260 || kind === 261 || kind === 262 || kind === 263 || kind === 264 || kind === 269 || kind === 268 || kind === 275 || kind === 274 || kind === 267; + } + function isStatementKindButNotDeclarationKind(kind) { + return kind === 249 || kind === 248 || kind === 256 || kind === 243 || kind === 241 || kind === 239 || kind === 246 || kind === 247 || kind === 245 || kind === 242 || kind === 253 || kind === 250 || kind === 252 || kind === 254 || kind === 255 || kind === 240 || kind === 244 || kind === 251 || kind === 352 || kind === 356 || kind === 355; + } + function isDeclaration(node) { + if (node.kind === 165) { + return node.parent && node.parent.kind !== 347 || ts6.isInJSFile(node); + } + return isDeclarationKind(node.kind); + } + ts6.isDeclaration = isDeclaration; + function isDeclarationStatement(node) { + return isDeclarationStatementKind(node.kind); + } + ts6.isDeclarationStatement = isDeclarationStatement; + function isStatementButNotDeclaration(node) { + return isStatementKindButNotDeclarationKind(node.kind); + } + ts6.isStatementButNotDeclaration = isStatementButNotDeclaration; + function isStatement(node) { + var kind = node.kind; + return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node); + } + ts6.isStatement = isStatement; + function isBlockStatement(node) { + if (node.kind !== 238) + return false; + if (node.parent !== void 0) { + if (node.parent.kind === 255 || node.parent.kind === 295) { + return false; + } + } + return !ts6.isFunctionBlock(node); + } + function isStatementOrBlock(node) { + var kind = node.kind; + return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || kind === 238; + } + ts6.isStatementOrBlock = isStatementOrBlock; + function isModuleReference(node) { + var kind = node.kind; + return kind === 280 || kind === 163 || kind === 79; + } + ts6.isModuleReference = isModuleReference; + function isJsxTagNameExpression(node) { + var kind = node.kind; + return kind === 108 || kind === 79 || kind === 208; + } + ts6.isJsxTagNameExpression = isJsxTagNameExpression; + function isJsxChild(node) { + var kind = node.kind; + return kind === 281 || kind === 291 || kind === 282 || kind === 11 || kind === 285; + } + ts6.isJsxChild = isJsxChild; + function isJsxAttributeLike(node) { + var kind = node.kind; + return kind === 288 || kind === 290; + } + ts6.isJsxAttributeLike = isJsxAttributeLike; + function isStringLiteralOrJsxExpression(node) { + var kind = node.kind; + return kind === 10 || kind === 291; + } + ts6.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + function isJsxOpeningLikeElement(node) { + var kind = node.kind; + return kind === 283 || kind === 282; + } + ts6.isJsxOpeningLikeElement = isJsxOpeningLikeElement; + function isCaseOrDefaultClause(node) { + var kind = node.kind; + return kind === 292 || kind === 293; + } + ts6.isCaseOrDefaultClause = isCaseOrDefaultClause; + function isJSDocNode(node) { + return node.kind >= 312 && node.kind <= 350; + } + ts6.isJSDocNode = isJSDocNode; + function isJSDocCommentContainingNode(node) { + return node.kind === 323 || node.kind === 322 || node.kind === 324 || isJSDocLinkLike(node) || isJSDocTag(node) || ts6.isJSDocTypeLiteral(node) || ts6.isJSDocSignature(node); + } + ts6.isJSDocCommentContainingNode = isJSDocCommentContainingNode; + function isJSDocTag(node) { + return node.kind >= 330 && node.kind <= 350; + } + ts6.isJSDocTag = isJSDocTag; + function isSetAccessor(node) { + return node.kind === 175; + } + ts6.isSetAccessor = isSetAccessor; + function isGetAccessor(node) { + return node.kind === 174; + } + ts6.isGetAccessor = isGetAccessor; + function hasJSDocNodes(node) { + var jsDoc = node.jsDoc; + return !!jsDoc && jsDoc.length > 0; + } + ts6.hasJSDocNodes = hasJSDocNodes; + function hasType(node) { + return !!node.type; + } + ts6.hasType = hasType; + function hasInitializer(node) { + return !!node.initializer; + } + ts6.hasInitializer = hasInitializer; + function hasOnlyExpressionInitializer(node) { + switch (node.kind) { + case 257: + case 166: + case 205: + case 169: + case 299: + case 302: + return true; + default: + return false; + } + } + ts6.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; + function isObjectLiteralElement(node) { + return node.kind === 288 || node.kind === 290 || isObjectLiteralElementLike(node); + } + ts6.isObjectLiteralElement = isObjectLiteralElement; + function isTypeReferenceType(node) { + return node.kind === 180 || node.kind === 230; + } + ts6.isTypeReferenceType = isTypeReferenceType; + var MAX_SMI_X86 = 1073741823; + function guessIndentation(lines) { + var indentation = MAX_SMI_X86; + for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) { + var line = lines_1[_i]; + if (!line.length) { + continue; + } + var i = 0; + for (; i < line.length && i < indentation; i++) { + if (!ts6.isWhiteSpaceLike(line.charCodeAt(i))) { + break; + } + } + if (i < indentation) { + indentation = i; + } + if (indentation === 0) { + return 0; + } + } + return indentation === MAX_SMI_X86 ? void 0 : indentation; + } + ts6.guessIndentation = guessIndentation; + function isStringLiteralLike(node) { + return node.kind === 10 || node.kind === 14; + } + ts6.isStringLiteralLike = isStringLiteralLike; + function isJSDocLinkLike(node) { + return node.kind === 327 || node.kind === 328 || node.kind === 329; + } + ts6.isJSDocLinkLike = isJSDocLinkLike; + function hasRestParameter(s) { + var last = ts6.lastOrUndefined(s.parameters); + return !!last && isRestParameter(last); + } + ts6.hasRestParameter = hasRestParameter; + function isRestParameter(node) { + var type = ts6.isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type; + return node.dotDotDotToken !== void 0 || !!type && type.kind === 321; + } + ts6.isRestParameter = isRestParameter; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.resolvingEmptyArray = []; + ts6.externalHelpersModuleNameText = "tslib"; + ts6.defaultMaximumTruncationLength = 160; + ts6.noTruncationMaximumTruncationLength = 1e6; + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; + if (declaration.kind === kind) { + return declaration; + } + } + } + return void 0; + } + ts6.getDeclarationOfKind = getDeclarationOfKind; + function getDeclarationsOfKind(symbol, kind) { + return ts6.filter(symbol.declarations || ts6.emptyArray, function(d) { + return d.kind === kind; + }); + } + ts6.getDeclarationsOfKind = getDeclarationsOfKind; + function createSymbolTable(symbols) { + var result = new ts6.Map(); + if (symbols) { + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; + result.set(symbol.escapedName, symbol); + } + } + return result; + } + ts6.createSymbolTable = createSymbolTable; + function isTransientSymbol(symbol) { + return (symbol.flags & 33554432) !== 0; + } + ts6.isTransientSymbol = isTransientSymbol; + var stringWriter = createSingleLineStringWriter(); + function createSingleLineStringWriter() { + var str = ""; + var writeText = function(text) { + return str += text; + }; + return { + getText: function() { + return str; + }, + write: writeText, + rawWrite: writeText, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeLiteral: writeText, + writeParameter: writeText, + writeProperty: writeText, + writeSymbol: function(s, _) { + return writeText(s); + }, + writeTrailingSemicolon: writeText, + writeComment: writeText, + getTextPos: function() { + return str.length; + }, + getLine: function() { + return 0; + }, + getColumn: function() { + return 0; + }, + getIndent: function() { + return 0; + }, + isAtStartOfLine: function() { + return false; + }, + hasTrailingComment: function() { + return false; + }, + hasTrailingWhitespace: function() { + return !!str.length && ts6.isWhiteSpaceLike(str.charCodeAt(str.length - 1)); + }, + // Completely ignore indentation for string writers. And map newlines to + // a single space. + writeLine: function() { + return str += " "; + }, + increaseIndent: ts6.noop, + decreaseIndent: ts6.noop, + clear: function() { + return str = ""; + }, + trackSymbol: function() { + return false; + }, + reportInaccessibleThisError: ts6.noop, + reportInaccessibleUniqueSymbolError: ts6.noop, + reportPrivateInBaseOfClassExpression: ts6.noop + }; + } + function changesAffectModuleResolution(oldOptions, newOptions) { + return oldOptions.configFilePath !== newOptions.configFilePath || optionsHaveModuleResolutionChanges(oldOptions, newOptions); + } + ts6.changesAffectModuleResolution = changesAffectModuleResolution; + function optionsHaveModuleResolutionChanges(oldOptions, newOptions) { + return optionsHaveChanges(oldOptions, newOptions, ts6.moduleResolutionOptionDeclarations); + } + ts6.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges; + function changesAffectingProgramStructure(oldOptions, newOptions) { + return optionsHaveChanges(oldOptions, newOptions, ts6.optionsAffectingProgramStructure); + } + ts6.changesAffectingProgramStructure = changesAffectingProgramStructure; + function optionsHaveChanges(oldOptions, newOptions, optionDeclarations) { + return oldOptions !== newOptions && optionDeclarations.some(function(o) { + return !isJsonEqual(getCompilerOptionValue(oldOptions, o), getCompilerOptionValue(newOptions, o)); + }); + } + ts6.optionsHaveChanges = optionsHaveChanges; + function forEachAncestor(node, callback) { + while (true) { + var res = callback(node); + if (res === "quit") + return void 0; + if (res !== void 0) + return res; + if (ts6.isSourceFile(node)) + return void 0; + node = node.parent; + } + } + ts6.forEachAncestor = forEachAncestor; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) { + var _a = iterResult.value, key = _a[0], value = _a[1]; + var result = callback(value, key); + if (result) { + return result; + } + } + return void 0; + } + ts6.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) { + var result = callback(iterResult.value); + if (result) { + return result; + } + } + return void 0; + } + ts6.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function(value, key) { + target.set(key, value); + }); + } + ts6.copyEntries = copyEntries; + function usingSingleLineStringWriter(action) { + var oldString = stringWriter.getText(); + try { + action(stringWriter); + return stringWriter.getText(); + } finally { + stringWriter.clear(); + stringWriter.writeKeyword(oldString); + } + } + ts6.usingSingleLineStringWriter = usingSingleLineStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts6.getFullWidth = getFullWidth; + function getResolvedModule(sourceFile, moduleNameText, mode) { + return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode); + } + ts6.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = ts6.createModeAwareCache(); + } + sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule); + } + ts6.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = ts6.createModeAwareCache(); + } + sourceFile.resolvedTypeReferenceDirectiveNames.set( + typeReferenceDirectiveName, + /*mode*/ + void 0, + resolvedTypeReferenceDirective + ); + } + ts6.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function projectReferenceIsEqualTo(oldRef, newRef) { + return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular; + } + ts6.projectReferenceIsEqualTo = projectReferenceIsEqualTo; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && oldResolution.extension === newResolution.extension && oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.originalPath === newResolution.originalPath && packageIdIsEqual(oldResolution.packageId, newResolution.packageId); + } + ts6.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function packageIdIsEqual(a, b) { + return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version; + } + function packageIdToPackageName(_a) { + var name = _a.name, subModuleName = _a.subModuleName; + return subModuleName ? "".concat(name, "/").concat(subModuleName) : name; + } + ts6.packageIdToPackageName = packageIdToPackageName; + function packageIdToString(packageId) { + return "".concat(packageIdToPackageName(packageId), "@").concat(packageId.version); + } + ts6.packageIdToString = packageIdToString; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary && oldResolution.originalPath === newResolution.originalPath; + } + ts6.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) { + ts6.Debug.assert(names.length === newResolutions.length); + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var entry = names[i]; + var name = !ts6.isString(entry) ? entry.fileName.toLowerCase() : entry; + var mode = !ts6.isString(entry) ? ts6.getModeForFileReference(entry, oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.impliedNodeFormat) : oldSourceFile && ts6.getModeForResolutionAtIndex(oldSourceFile, i); + var oldResolution = oldResolutions && oldResolutions.get(name, mode); + var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts6.hasChangesInResolutions = hasChangesInResolutions; + function containsParseError(node) { + aggregateChildData(node); + return (node.flags & 524288) !== 0; + } + ts6.containsParseError = containsParseError; + function aggregateChildData(node) { + if (!(node.flags & 1048576)) { + var thisNodeOrAnySubNodesHasError = (node.flags & 131072) !== 0 || ts6.forEachChild(node, containsParseError); + if (thisNodeOrAnySubNodesHasError) { + node.flags |= 524288; + } + node.flags |= 1048576; + } + } + function getSourceFileOfNode(node) { + while (node && node.kind !== 308) { + node = node.parent; + } + return node; + } + ts6.getSourceFileOfNode = getSourceFileOfNode; + function getSourceFileOfModule(module2) { + return getSourceFileOfNode(module2.valueDeclaration || getNonAugmentationDeclaration(module2)); + } + ts6.getSourceFileOfModule = getSourceFileOfModule; + function isPlainJsFile(file, checkJs) { + return !!file && (file.scriptKind === 1 || file.scriptKind === 2) && !file.checkJsDirective && checkJs === void 0; + } + ts6.isPlainJsFile = isPlainJsFile; + function isStatementWithLocals(node) { + switch (node.kind) { + case 238: + case 266: + case 245: + case 246: + case 247: + return true; + } + return false; + } + ts6.isStatementWithLocals = isStatementWithLocals; + function getStartPositionOfLine(line, sourceFile) { + ts6.Debug.assert(line >= 0); + return ts6.getLineStarts(sourceFile)[line]; + } + ts6.getStartPositionOfLine = getStartPositionOfLine; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = ts6.getLineAndCharacterOfPosition(file, node.pos); + return "".concat(file.fileName, "(").concat(loc.line + 1, ",").concat(loc.character + 1, ")"); + } + ts6.nodePosToString = nodePosToString; + function getEndLinePosition(line, sourceFile) { + ts6.Debug.assert(line >= 0); + var lineStarts = ts6.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts6.Debug.assert(ts6.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts6.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts6.getEndLinePosition = getEndLinePosition; + function isFileLevelUniqueName(sourceFile, name, hasGlobalName) { + return !(hasGlobalName && hasGlobalName(name)) && !sourceFile.identifiers.has(name); + } + ts6.isFileLevelUniqueName = isFileLevelUniqueName; + function nodeIsMissing(node) { + if (node === void 0) { + return true; + } + return node.pos === node.end && node.pos >= 0 && node.kind !== 1; + } + ts6.nodeIsMissing = nodeIsMissing; + function nodeIsPresent(node) { + return !nodeIsMissing(node); + } + ts6.nodeIsPresent = nodeIsPresent; + function insertStatementsAfterPrologue(to, from, isPrologueDirective2) { + if (from === void 0 || from.length === 0) + return to; + var statementIndex = 0; + for (; statementIndex < to.length; ++statementIndex) { + if (!isPrologueDirective2(to[statementIndex])) { + break; + } + } + to.splice.apply(to, __spreadArray([statementIndex, 0], from, false)); + return to; + } + function insertStatementAfterPrologue(to, statement, isPrologueDirective2) { + if (statement === void 0) + return to; + var statementIndex = 0; + for (; statementIndex < to.length; ++statementIndex) { + if (!isPrologueDirective2(to[statementIndex])) { + break; + } + } + to.splice(statementIndex, 0, statement); + return to; + } + function isAnyPrologueDirective(node) { + return isPrologueDirective(node) || !!(getEmitFlags(node) & 1048576); + } + function insertStatementsAfterStandardPrologue(to, from) { + return insertStatementsAfterPrologue(to, from, isPrologueDirective); + } + ts6.insertStatementsAfterStandardPrologue = insertStatementsAfterStandardPrologue; + function insertStatementsAfterCustomPrologue(to, from) { + return insertStatementsAfterPrologue(to, from, isAnyPrologueDirective); + } + ts6.insertStatementsAfterCustomPrologue = insertStatementsAfterCustomPrologue; + function insertStatementAfterStandardPrologue(to, statement) { + return insertStatementAfterPrologue(to, statement, isPrologueDirective); + } + ts6.insertStatementAfterStandardPrologue = insertStatementAfterStandardPrologue; + function insertStatementAfterCustomPrologue(to, statement) { + return insertStatementAfterPrologue(to, statement, isAnyPrologueDirective); + } + ts6.insertStatementAfterCustomPrologue = insertStatementAfterCustomPrologue; + function isRecognizedTripleSlashComment(text, commentPos, commentEnd) { + if (text.charCodeAt(commentPos + 1) === 47 && commentPos + 2 < commentEnd && text.charCodeAt(commentPos + 2) === 47) { + var textSubStr = text.substring(commentPos, commentEnd); + return ts6.fullTripleSlashReferencePathRegEx.test(textSubStr) || ts6.fullTripleSlashAMDReferencePathRegEx.test(textSubStr) || fullTripleSlashReferenceTypeReferenceDirectiveRegEx.test(textSubStr) || defaultLibReferenceRegEx.test(textSubStr) ? true : false; + } + return false; + } + ts6.isRecognizedTripleSlashComment = isRecognizedTripleSlashComment; + function isPinnedComment(text, start) { + return text.charCodeAt(start + 1) === 42 && text.charCodeAt(start + 2) === 33; + } + ts6.isPinnedComment = isPinnedComment; + function createCommentDirectivesMap(sourceFile, commentDirectives) { + var directivesByLine = new ts6.Map(commentDirectives.map(function(commentDirective) { + return [ + "".concat(ts6.getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line), + commentDirective + ]; + })); + var usedLines = new ts6.Map(); + return { getUnusedExpectations, markUsed }; + function getUnusedExpectations() { + return ts6.arrayFrom(directivesByLine.entries()).filter(function(_a) { + var line = _a[0], directive = _a[1]; + return directive.type === 0 && !usedLines.get(line); + }).map(function(_a) { + var _ = _a[0], directive = _a[1]; + return directive; + }); + } + function markUsed(line) { + if (!directivesByLine.has("".concat(line))) { + return false; + } + usedLines.set("".concat(line), true); + return true; + } + } + ts6.createCommentDirectivesMap = createCommentDirectivesMap; + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { + if (nodeIsMissing(node)) { + return node.pos; + } + if (ts6.isJSDocNode(node) || node.kind === 11) { + return ts6.skipTrivia( + (sourceFile || getSourceFileOfNode(node)).text, + node.pos, + /*stopAfterLineBreak*/ + false, + /*stopAtComments*/ + true + ); + } + if (includeJsDoc && ts6.hasJSDocNodes(node)) { + return getTokenPosOfNode(node.jsDoc[0], sourceFile); + } + if (node.kind === 351 && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); + } + return ts6.skipTrivia( + (sourceFile || getSourceFileOfNode(node)).text, + node.pos, + /*stopAfterLineBreak*/ + false, + /*stopAtComments*/ + false, + isInJSDoc(node) + ); + } + ts6.getTokenPosOfNode = getTokenPosOfNode; + function getNonDecoratorTokenPosOfNode(node, sourceFile) { + var lastDecorator = !nodeIsMissing(node) && ts6.canHaveModifiers(node) ? ts6.findLast(node.modifiers, ts6.isDecorator) : void 0; + if (!lastDecorator) { + return getTokenPosOfNode(node, sourceFile); + } + return ts6.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastDecorator.end); + } + ts6.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { + if (includeTrivia === void 0) { + includeTrivia = false; + } + return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia); + } + ts6.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function isJSDocTypeExpressionOrChild(node) { + return !!ts6.findAncestor(node, ts6.isJSDocTypeExpression); + } + function isExportNamespaceAsDefaultDeclaration(node) { + return !!(ts6.isExportDeclaration(node) && node.exportClause && ts6.isNamespaceExport(node.exportClause) && node.exportClause.name.escapedText === "default"); + } + ts6.isExportNamespaceAsDefaultDeclaration = isExportNamespaceAsDefaultDeclaration; + function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) { + if (includeTrivia === void 0) { + includeTrivia = false; + } + if (nodeIsMissing(node)) { + return ""; + } + var text = sourceText.substring(includeTrivia ? node.pos : ts6.skipTrivia(sourceText, node.pos), node.end); + if (isJSDocTypeExpressionOrChild(node)) { + text = text.split(/\r\n|\n|\r/).map(function(line) { + return ts6.trimStringStart(line.replace(/^\s*\*/, "")); + }).join("\n"); + } + return text; + } + ts6.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node, includeTrivia) { + if (includeTrivia === void 0) { + includeTrivia = false; + } + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); + } + ts6.getTextOfNode = getTextOfNode; + function getPos(range2) { + return range2.pos; + } + function indexOfNode(nodeArray, node) { + return ts6.binarySearch(nodeArray, node, getPos, ts6.compareValues); + } + ts6.indexOfNode = indexOfNode; + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags || 0; + } + ts6.getEmitFlags = getEmitFlags; + function getScriptTargetFeatures() { + return { + es2015: { + Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"], + RegExp: ["flags", "sticky", "unicode"], + Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"], + ArrayConstructor: ["from", "of"], + ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"], + NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"], + Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"], + Map: ["entries", "keys", "values"], + Set: ["entries", "keys", "values"], + Promise: ts6.emptyArray, + PromiseConstructor: ["all", "race", "reject", "resolve"], + Symbol: ["for", "keyFor"], + WeakMap: ["entries", "keys", "values"], + WeakSet: ["entries", "keys", "values"], + Iterator: ts6.emptyArray, + AsyncIterator: ts6.emptyArray, + String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"], + StringConstructor: ["fromCodePoint", "raw"] + }, + es2016: { + Array: ["includes"] + }, + es2017: { + Atomics: ts6.emptyArray, + SharedArrayBuffer: ts6.emptyArray, + String: ["padStart", "padEnd"], + ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"], + DateTimeFormat: ["formatToParts"] + }, + es2018: { + Promise: ["finally"], + RegExpMatchArray: ["groups"], + RegExpExecArray: ["groups"], + RegExp: ["dotAll"], + Intl: ["PluralRules"], + AsyncIterable: ts6.emptyArray, + AsyncIterableIterator: ts6.emptyArray, + AsyncGenerator: ts6.emptyArray, + AsyncGeneratorFunction: ts6.emptyArray, + NumberFormat: ["formatToParts"] + }, + es2019: { + Array: ["flat", "flatMap"], + ObjectConstructor: ["fromEntries"], + String: ["trimStart", "trimEnd", "trimLeft", "trimRight"], + Symbol: ["description"] + }, + es2020: { + BigInt: ts6.emptyArray, + BigInt64Array: ts6.emptyArray, + BigUint64Array: ts6.emptyArray, + PromiseConstructor: ["allSettled"], + SymbolConstructor: ["matchAll"], + String: ["matchAll"], + DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"], + RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"] + }, + es2021: { + PromiseConstructor: ["any"], + String: ["replaceAll"] + }, + es2022: { + Array: ["at"], + String: ["at"], + Int8Array: ["at"], + Uint8Array: ["at"], + Uint8ClampedArray: ["at"], + Int16Array: ["at"], + Uint16Array: ["at"], + Int32Array: ["at"], + Uint32Array: ["at"], + Float32Array: ["at"], + Float64Array: ["at"], + BigInt64Array: ["at"], + BigUint64Array: ["at"], + ObjectConstructor: ["hasOwn"], + Error: ["cause"] + } + }; + } + ts6.getScriptTargetFeatures = getScriptTargetFeatures; + var GetLiteralTextFlags; + (function(GetLiteralTextFlags2) { + GetLiteralTextFlags2[GetLiteralTextFlags2["None"] = 0] = "None"; + GetLiteralTextFlags2[GetLiteralTextFlags2["NeverAsciiEscape"] = 1] = "NeverAsciiEscape"; + GetLiteralTextFlags2[GetLiteralTextFlags2["JsxAttributeEscape"] = 2] = "JsxAttributeEscape"; + GetLiteralTextFlags2[GetLiteralTextFlags2["TerminateUnterminatedLiterals"] = 4] = "TerminateUnterminatedLiterals"; + GetLiteralTextFlags2[GetLiteralTextFlags2["AllowNumericSeparator"] = 8] = "AllowNumericSeparator"; + })(GetLiteralTextFlags = ts6.GetLiteralTextFlags || (ts6.GetLiteralTextFlags = {})); + function getLiteralText(node, sourceFile, flags) { + var _a; + if (sourceFile && canUseOriginalText(node, flags)) { + return getSourceTextOfNodeFromSourceFile(sourceFile, node); + } + switch (node.kind) { + case 10: { + var escapeText = flags & 2 ? escapeJsxAttributeString : flags & 1 || getEmitFlags(node) & 16777216 ? escapeString : escapeNonAsciiString; + if (node.singleQuote) { + return "'" + escapeText( + node.text, + 39 + /* CharacterCodes.singleQuote */ + ) + "'"; + } else { + return '"' + escapeText( + node.text, + 34 + /* CharacterCodes.doubleQuote */ + ) + '"'; + } + } + case 14: + case 15: + case 16: + case 17: { + var escapeText = flags & 1 || getEmitFlags(node) & 16777216 ? escapeString : escapeNonAsciiString; + var rawText = (_a = node.rawText) !== null && _a !== void 0 ? _a : escapeTemplateSubstitution(escapeText( + node.text, + 96 + /* CharacterCodes.backtick */ + )); + switch (node.kind) { + case 14: + return "`" + rawText + "`"; + case 15: + return "`" + rawText + "${"; + case 16: + return "}" + rawText + "${"; + case 17: + return "}" + rawText + "`"; + } + break; + } + case 8: + case 9: + return node.text; + case 13: + if (flags & 4 && node.isUnterminated) { + return node.text + (node.text.charCodeAt(node.text.length - 1) === 92 ? " /" : "/"); + } + return node.text; + } + return ts6.Debug.fail("Literal kind '".concat(node.kind, "' not accounted for.")); + } + ts6.getLiteralText = getLiteralText; + function canUseOriginalText(node, flags) { + if (nodeIsSynthesized(node) || !node.parent || flags & 4 && node.isUnterminated) { + return false; + } + if (ts6.isNumericLiteral(node) && node.numericLiteralFlags & 512) { + return !!(flags & 8); + } + return !ts6.isBigIntLiteral(node); + } + function getTextOfConstantValue(value) { + return ts6.isString(value) ? '"' + escapeNonAsciiString(value) + '"' : "" + value; + } + ts6.getTextOfConstantValue = getTextOfConstantValue; + function makeIdentifierFromModuleName(moduleName) { + return ts6.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); + } + ts6.makeIdentifierFromModuleName = makeIdentifierFromModuleName; + function isBlockOrCatchScoped(declaration) { + return (ts6.getCombinedNodeFlags(declaration) & 3) !== 0 || isCatchClauseVariableDeclarationOrBindingElement(declaration); + } + ts6.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isCatchClauseVariableDeclarationOrBindingElement(declaration) { + var node = getRootDeclaration(declaration); + return node.kind === 257 && node.parent.kind === 295; + } + ts6.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; + function isAmbientModule(node) { + return ts6.isModuleDeclaration(node) && (node.name.kind === 10 || isGlobalScopeAugmentation(node)); + } + ts6.isAmbientModule = isAmbientModule; + function isModuleWithStringLiteralName(node) { + return ts6.isModuleDeclaration(node) && node.name.kind === 10; + } + ts6.isModuleWithStringLiteralName = isModuleWithStringLiteralName; + function isNonGlobalAmbientModule(node) { + return ts6.isModuleDeclaration(node) && ts6.isStringLiteral(node.name); + } + ts6.isNonGlobalAmbientModule = isNonGlobalAmbientModule; + function isEffectiveModuleDeclaration(node) { + return ts6.isModuleDeclaration(node) || ts6.isIdentifier(node); + } + ts6.isEffectiveModuleDeclaration = isEffectiveModuleDeclaration; + function isShorthandAmbientModuleSymbol(moduleSymbol) { + return isShorthandAmbientModule(moduleSymbol.valueDeclaration); + } + ts6.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; + function isShorthandAmbientModule(node) { + return !!node && node.kind === 264 && !node.body; + } + function isBlockScopedContainerTopLevel(node) { + return node.kind === 308 || node.kind === 264 || ts6.isFunctionLikeOrClassStaticBlockDeclaration(node); + } + ts6.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module2) { + return !!(module2.flags & 1024); + } + ts6.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(node) { + return isAmbientModule(node) && isModuleAugmentationExternal(node); + } + ts6.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isModuleAugmentationExternal(node) { + switch (node.parent.kind) { + case 308: + return ts6.isExternalModule(node.parent); + case 265: + return isAmbientModule(node.parent.parent) && ts6.isSourceFile(node.parent.parent.parent) && !ts6.isExternalModule(node.parent.parent.parent); + } + return false; + } + ts6.isModuleAugmentationExternal = isModuleAugmentationExternal; + function getNonAugmentationDeclaration(symbol) { + var _a; + return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function(d) { + return !isExternalModuleAugmentation(d) && !(ts6.isModuleDeclaration(d) && isGlobalScopeAugmentation(d)); + }); + } + ts6.getNonAugmentationDeclaration = getNonAugmentationDeclaration; + function isCommonJSContainingModuleKind(kind) { + return kind === ts6.ModuleKind.CommonJS || kind === ts6.ModuleKind.Node16 || kind === ts6.ModuleKind.NodeNext; + } + function isEffectiveExternalModule(node, compilerOptions) { + return ts6.isExternalModule(node) || compilerOptions.isolatedModules || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator; + } + ts6.isEffectiveExternalModule = isEffectiveExternalModule; + function isEffectiveStrictModeSourceFile(node, compilerOptions) { + switch (node.scriptKind) { + case 1: + case 3: + case 2: + case 4: + break; + default: + return false; + } + if (node.isDeclarationFile) { + return false; + } + if (getStrictOptionValue(compilerOptions, "alwaysStrict")) { + return true; + } + if (ts6.startsWithUseStrict(node.statements)) { + return true; + } + if (ts6.isExternalModule(node) || compilerOptions.isolatedModules) { + if (getEmitModuleKind(compilerOptions) >= ts6.ModuleKind.ES2015) { + return true; + } + return !compilerOptions.noImplicitUseStrict; + } + return false; + } + ts6.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216) || hasSyntacticModifier( + node, + 2 + /* ModifierFlags.Ambient */ + ); + } + ts6.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; + function isBlockScope(node, parentNode) { + switch (node.kind) { + case 308: + case 266: + case 295: + case 264: + case 245: + case 246: + case 247: + case 173: + case 171: + case 174: + case 175: + case 259: + case 215: + case 216: + case 169: + case 172: + return true; + case 238: + return !ts6.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); + } + return false; + } + ts6.isBlockScope = isBlockScope; + function isDeclarationWithTypeParameters(node) { + switch (node.kind) { + case 341: + case 348: + case 326: + return true; + default: + ts6.assertType(node); + return isDeclarationWithTypeParameterChildren(node); + } + } + ts6.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; + function isDeclarationWithTypeParameterChildren(node) { + switch (node.kind) { + case 176: + case 177: + case 170: + case 178: + case 181: + case 182: + case 320: + case 260: + case 228: + case 261: + case 262: + case 347: + case 259: + case 171: + case 173: + case 174: + case 175: + case 215: + case 216: + return true; + default: + ts6.assertType(node); + return false; + } + } + ts6.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; + function isAnyImportSyntax(node) { + switch (node.kind) { + case 269: + case 268: + return true; + default: + return false; + } + } + ts6.isAnyImportSyntax = isAnyImportSyntax; + function isAnyImportOrBareOrAccessedRequire(node) { + return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node); + } + ts6.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; + function isLateVisibilityPaintedStatement(node) { + switch (node.kind) { + case 269: + case 268: + case 240: + case 260: + case 259: + case 264: + case 262: + case 261: + case 263: + return true; + default: + return false; + } + } + ts6.isLateVisibilityPaintedStatement = isLateVisibilityPaintedStatement; + function hasPossibleExternalModuleReference(node) { + return isAnyImportOrReExport(node) || ts6.isModuleDeclaration(node) || ts6.isImportTypeNode(node) || isImportCall(node); + } + ts6.hasPossibleExternalModuleReference = hasPossibleExternalModuleReference; + function isAnyImportOrReExport(node) { + return isAnyImportSyntax(node) || ts6.isExportDeclaration(node); + } + ts6.isAnyImportOrReExport = isAnyImportOrReExport; + function getEnclosingBlockScopeContainer(node) { + return ts6.findAncestor(node.parent, function(current) { + return isBlockScope(current, current.parent); + }); + } + ts6.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; + function forEachEnclosingBlockScopeContainer(node, cb) { + var container = getEnclosingBlockScopeContainer(node); + while (container) { + cb(container); + container = getEnclosingBlockScopeContainer(container); + } + } + ts6.forEachEnclosingBlockScopeContainer = forEachEnclosingBlockScopeContainer; + function declarationNameToString(name) { + return !name || getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts6.declarationNameToString = declarationNameToString; + function getNameFromIndexInfo(info) { + return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : void 0; + } + ts6.getNameFromIndexInfo = getNameFromIndexInfo; + function isComputedNonLiteralName(name) { + return name.kind === 164 && !isStringOrNumericLiteralLike(name.expression); + } + ts6.isComputedNonLiteralName = isComputedNonLiteralName; + function tryGetTextOfPropertyName(name) { + switch (name.kind) { + case 79: + case 80: + return name.autoGenerateFlags ? void 0 : name.escapedText; + case 10: + case 8: + case 14: + return ts6.escapeLeadingUnderscores(name.text); + case 164: + if (isStringOrNumericLiteralLike(name.expression)) + return ts6.escapeLeadingUnderscores(name.expression.text); + return void 0; + default: + return ts6.Debug.assertNever(name); + } + } + ts6.tryGetTextOfPropertyName = tryGetTextOfPropertyName; + function getTextOfPropertyName(name) { + return ts6.Debug.checkDefined(tryGetTextOfPropertyName(name)); + } + ts6.getTextOfPropertyName = getTextOfPropertyName; + function entityNameToString(name) { + switch (name.kind) { + case 108: + return "this"; + case 80: + case 79: + return getFullWidth(name) === 0 ? ts6.idText(name) : getTextOfNode(name); + case 163: + return entityNameToString(name.left) + "." + entityNameToString(name.right); + case 208: + if (ts6.isIdentifier(name.name) || ts6.isPrivateIdentifier(name.name)) { + return entityNameToString(name.expression) + "." + entityNameToString(name.name); + } else { + return ts6.Debug.assertNever(name.name); + } + case 314: + return entityNameToString(name.left) + entityNameToString(name.right); + default: + return ts6.Debug.assertNever(name); + } + } + ts6.entityNameToString = entityNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) { + var sourceFile = getSourceFileOfNode(node); + return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3); + } + ts6.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) { + var start = ts6.skipTrivia(sourceFile.text, nodes.pos); + return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3); + } + ts6.createDiagnosticForNodeArray = createDiagnosticForNodeArray; + function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) { + var span = getErrorSpanForNode(sourceFile, node); + return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3); + } + ts6.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile; + function createDiagnosticForNodeFromMessageChain(node, messageChain, relatedInformation) { + var sourceFile = getSourceFileOfNode(node); + var span = getErrorSpanForNode(sourceFile, node); + return createFileDiagnosticFromMessageChain(sourceFile, span.start, span.length, messageChain, relatedInformation); + } + ts6.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function assertDiagnosticLocation(file, start, length) { + ts6.Debug.assertGreaterThanOrEqual(start, 0); + ts6.Debug.assertGreaterThanOrEqual(length, 0); + if (file) { + ts6.Debug.assertLessThanOrEqual(start, file.text.length); + ts6.Debug.assertLessThanOrEqual(start + length, file.text.length); + } + } + function createFileDiagnosticFromMessageChain(file, start, length, messageChain, relatedInformation) { + assertDiagnosticLocation(file, start, length); + return { + file, + start, + length, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText, + relatedInformation + }; + } + ts6.createFileDiagnosticFromMessageChain = createFileDiagnosticFromMessageChain; + function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) { + return { + file: sourceFile, + start: 0, + length: 0, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText, + relatedInformation + }; + } + ts6.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain; + function createDiagnosticMessageChainFromDiagnostic(diagnostic) { + return typeof diagnostic.messageText === "string" ? { + code: diagnostic.code, + category: diagnostic.category, + messageText: diagnostic.messageText, + next: diagnostic.next + } : diagnostic.messageText; + } + ts6.createDiagnosticMessageChainFromDiagnostic = createDiagnosticMessageChainFromDiagnostic; + function createDiagnosticForRange(sourceFile, range2, message) { + return { + file: sourceFile, + start: range2.pos, + length: range2.end - range2.pos, + code: message.code, + category: message.category, + messageText: message.message + }; + } + ts6.createDiagnosticForRange = createDiagnosticForRange; + function getSpanOfTokenAtPosition(sourceFile, pos) { + var scanner = ts6.createScanner( + sourceFile.languageVersion, + /*skipTrivia*/ + true, + sourceFile.languageVariant, + sourceFile.text, + /*onError:*/ + void 0, + pos + ); + scanner.scan(); + var start = scanner.getTokenPos(); + return ts6.createTextSpanFromBounds(start, scanner.getTextPos()); + } + ts6.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts6.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 238) { + var startLine = ts6.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts6.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts6.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts6.createTextSpanFromBounds(pos, node.end); + } + function getErrorSpanForNode(sourceFile, node) { + var errorNode = node; + switch (node.kind) { + case 308: + var pos_1 = ts6.skipTrivia( + sourceFile.text, + 0, + /*stopAfterLineBreak*/ + false + ); + if (pos_1 === sourceFile.text.length) { + return ts6.createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos_1); + case 257: + case 205: + case 260: + case 228: + case 261: + case 264: + case 263: + case 302: + case 259: + case 215: + case 171: + case 174: + case 175: + case 262: + case 169: + case 168: + case 271: + errorNode = node.name; + break; + case 216: + return getErrorSpanForArrowFunction(sourceFile, node); + case 292: + case 293: + var start = ts6.skipTrivia(sourceFile.text, node.pos); + var end = node.statements.length > 0 ? node.statements[0].pos : node.end; + return ts6.createTextSpanFromBounds(start, end); + } + if (errorNode === void 0) { + return getSpanOfTokenAtPosition(sourceFile, node.pos); + } + ts6.Debug.assert(!ts6.isJSDoc(errorNode)); + var isMissing = nodeIsMissing(errorNode); + var pos = isMissing || ts6.isJsxText(node) ? errorNode.pos : ts6.skipTrivia(sourceFile.text, errorNode.pos); + if (isMissing) { + ts6.Debug.assert(pos === errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"); + ts6.Debug.assert(pos === errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"); + } else { + ts6.Debug.assert(pos >= errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"); + ts6.Debug.assert(pos <= errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809"); + } + return ts6.createTextSpanFromBounds(pos, errorNode.end); + } + ts6.getErrorSpanForNode = getErrorSpanForNode; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== void 0; + } + ts6.isExternalOrCommonJsModule = isExternalOrCommonJsModule; + function isJsonSourceFile(file) { + return file.scriptKind === 6; + } + ts6.isJsonSourceFile = isJsonSourceFile; + function isEnumConst(node) { + return !!(ts6.getCombinedModifierFlags(node) & 2048); + } + ts6.isEnumConst = isEnumConst; + function isDeclarationReadonly(declaration) { + return !!(ts6.getCombinedModifierFlags(declaration) & 64 && !ts6.isParameterPropertyDeclaration(declaration, declaration.parent)); + } + ts6.isDeclarationReadonly = isDeclarationReadonly; + function isVarConst(node) { + return !!(ts6.getCombinedNodeFlags(node) & 2); + } + ts6.isVarConst = isVarConst; + function isLet(node) { + return !!(ts6.getCombinedNodeFlags(node) & 1); + } + ts6.isLet = isLet; + function isSuperCall(n) { + return n.kind === 210 && n.expression.kind === 106; + } + ts6.isSuperCall = isSuperCall; + function isImportCall(n) { + return n.kind === 210 && n.expression.kind === 100; + } + ts6.isImportCall = isImportCall; + function isImportMeta(n) { + return ts6.isMetaProperty(n) && n.keywordToken === 100 && n.name.escapedText === "meta"; + } + ts6.isImportMeta = isImportMeta; + function isLiteralImportTypeNode(n) { + return ts6.isImportTypeNode(n) && ts6.isLiteralTypeNode(n.argument) && ts6.isStringLiteral(n.argument.literal); + } + ts6.isLiteralImportTypeNode = isLiteralImportTypeNode; + function isPrologueDirective(node) { + return node.kind === 241 && node.expression.kind === 10; + } + ts6.isPrologueDirective = isPrologueDirective; + function isCustomPrologue(node) { + return !!(getEmitFlags(node) & 1048576); + } + ts6.isCustomPrologue = isCustomPrologue; + function isHoistedFunction(node) { + return isCustomPrologue(node) && ts6.isFunctionDeclaration(node); + } + ts6.isHoistedFunction = isHoistedFunction; + function isHoistedVariable(node) { + return ts6.isIdentifier(node.name) && !node.initializer; + } + function isHoistedVariableStatement(node) { + return isCustomPrologue(node) && ts6.isVariableStatement(node) && ts6.every(node.declarationList.declarations, isHoistedVariable); + } + ts6.isHoistedVariableStatement = isHoistedVariableStatement; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + return node.kind !== 11 ? ts6.getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0; + } + ts6.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getJSDocCommentRanges(node, text) { + var commentRanges = node.kind === 166 || node.kind === 165 || node.kind === 215 || node.kind === 216 || node.kind === 214 || node.kind === 257 || node.kind === 278 ? ts6.concatenate(ts6.getTrailingCommentRanges(text, node.pos), ts6.getLeadingCommentRanges(text, node.pos)) : ts6.getLeadingCommentRanges(text, node.pos); + return ts6.filter(commentRanges, function(comment) { + return text.charCodeAt(comment.pos + 1) === 42 && text.charCodeAt(comment.pos + 2) === 42 && text.charCodeAt(comment.pos + 3) !== 47; + }); + } + ts6.getJSDocCommentRanges = getJSDocCommentRanges; + ts6.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; + ts6.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; + var defaultLibReferenceRegEx = /^(\/\/\/\s*/; + function isPartOfTypeNode(node) { + if (179 <= node.kind && node.kind <= 202) { + return true; + } + switch (node.kind) { + case 131: + case 157: + case 148: + case 160: + case 152: + case 134: + case 153: + case 149: + case 155: + case 144: + return true; + case 114: + return node.parent.kind !== 219; + case 230: + return ts6.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); + case 165: + return node.parent.kind === 197 || node.parent.kind === 192; + case 79: + if (node.parent.kind === 163 && node.parent.right === node) { + node = node.parent; + } else if (node.parent.kind === 208 && node.parent.name === node) { + node = node.parent; + } + ts6.Debug.assert(node.kind === 79 || node.kind === 163 || node.kind === 208, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 163: + case 208: + case 108: { + var parent = node.parent; + if (parent.kind === 183) { + return false; + } + if (parent.kind === 202) { + return !parent.isTypeOf; + } + if (179 <= parent.kind && parent.kind <= 202) { + return true; + } + switch (parent.kind) { + case 230: + return ts6.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + case 165: + return node === parent.constraint; + case 347: + return node === parent.constraint; + case 169: + case 168: + case 166: + case 257: + return node === parent.type; + case 259: + case 215: + case 216: + case 173: + case 171: + case 170: + case 174: + case 175: + return node === parent.type; + case 176: + case 177: + case 178: + return node === parent.type; + case 213: + return node === parent.type; + case 210: + case 211: + return ts6.contains(parent.typeArguments, node); + case 212: + return false; + } + } + } + return false; + } + ts6.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts6.isChildOfNodeWithKind = isChildOfNodeWithKind; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 250: + return visitor(node); + case 266: + case 238: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 251: + case 252: + case 292: + case 293: + case 253: + case 255: + case 295: + return ts6.forEachChild(node, traverse); + } + } + } + ts6.forEachReturnStatement = forEachReturnStatement; + function forEachYieldExpression(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 226: + visitor(node); + var operand = node.expression; + if (operand) { + traverse(operand); + } + return; + case 263: + case 261: + case 264: + case 262: + return; + default: + if (ts6.isFunctionLike(node)) { + if (node.name && node.name.kind === 164) { + traverse(node.name.expression); + return; + } + } else if (!isPartOfTypeNode(node)) { + ts6.forEachChild(node, traverse); + } + } + } + } + ts6.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 185) { + return node.elementType; + } else if (node && node.kind === 180) { + return ts6.singleOrUndefined(node.typeArguments); + } else { + return void 0; + } + } + ts6.getRestParameterElementType = getRestParameterElementType; + function getMembersOfDeclaration(node) { + switch (node.kind) { + case 261: + case 260: + case 228: + case 184: + return node.members; + case 207: + return node.properties; + } + } + ts6.getMembersOfDeclaration = getMembersOfDeclaration; + function isVariableLike(node) { + if (node) { + switch (node.kind) { + case 205: + case 302: + case 166: + case 299: + case 169: + case 168: + case 300: + case 257: + return true; + } + } + return false; + } + ts6.isVariableLike = isVariableLike; + function isVariableLikeOrAccessor(node) { + return isVariableLike(node) || ts6.isAccessor(node); + } + ts6.isVariableLikeOrAccessor = isVariableLikeOrAccessor; + function isVariableDeclarationInVariableStatement(node) { + return node.parent.kind === 258 && node.parent.parent.kind === 240; + } + ts6.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; + function isCommonJsExportedExpression(node) { + if (!isInJSFile(node)) + return false; + return ts6.isObjectLiteralExpression(node.parent) && ts6.isBinaryExpression(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2 || isCommonJsExportPropertyAssignment(node.parent); + } + ts6.isCommonJsExportedExpression = isCommonJsExportedExpression; + function isCommonJsExportPropertyAssignment(node) { + if (!isInJSFile(node)) + return false; + return ts6.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 1; + } + ts6.isCommonJsExportPropertyAssignment = isCommonJsExportPropertyAssignment; + function isValidESSymbolDeclaration(node) { + return (ts6.isVariableDeclaration(node) ? isVarConst(node) && ts6.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) : ts6.isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) : ts6.isPropertySignature(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node); + } + ts6.isValidESSymbolDeclaration = isValidESSymbolDeclaration; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 171: + case 170: + case 173: + case 174: + case 175: + case 259: + case 215: + return true; + } + return false; + } + ts6.introducesArgumentsExoticObject = introducesArgumentsExoticObject; + function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 253) { + return node.statement; + } + node = node.statement; + } + } + ts6.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; + function isFunctionBlock(node) { + return node && node.kind === 238 && ts6.isFunctionLike(node.parent); + } + ts6.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node && node.kind === 171 && node.parent.kind === 207; + } + ts6.isObjectLiteralMethod = isObjectLiteralMethod; + function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { + return (node.kind === 171 || node.kind === 174 || node.kind === 175) && (node.parent.kind === 207 || node.parent.kind === 228); + } + ts6.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1; + } + ts6.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0; + } + ts6.isThisTypePredicate = isThisTypePredicate; + function getPropertyAssignment(objectLiteral, key, key2) { + return objectLiteral.properties.filter(function(property) { + if (property.kind === 299) { + var propName = tryGetTextOfPropertyName(property.name); + return key === propName || !!key2 && key2 === propName; + } + return false; + }); + } + ts6.getPropertyAssignment = getPropertyAssignment; + function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) { + return ts6.firstDefined(getPropertyAssignment(objectLiteral, propKey), function(property) { + return ts6.isArrayLiteralExpression(property.initializer) ? ts6.find(property.initializer.elements, function(element) { + return ts6.isStringLiteral(element) && element.text === elementValue; + }) : void 0; + }); + } + ts6.getPropertyArrayElementValue = getPropertyArrayElementValue; + function getTsConfigObjectLiteralExpression(tsConfigSourceFile) { + if (tsConfigSourceFile && tsConfigSourceFile.statements.length) { + var expression = tsConfigSourceFile.statements[0].expression; + return ts6.tryCast(expression, ts6.isObjectLiteralExpression); + } + } + ts6.getTsConfigObjectLiteralExpression = getTsConfigObjectLiteralExpression; + function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) { + return ts6.firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), function(property) { + return ts6.isArrayLiteralExpression(property.initializer) ? ts6.find(property.initializer.elements, function(element) { + return ts6.isStringLiteral(element) && element.text === elementValue; + }) : void 0; + }); + } + ts6.getTsConfigPropArrayElementValue = getTsConfigPropArrayElementValue; + function getTsConfigPropArray(tsConfigSourceFile, propKey) { + var jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile); + return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : ts6.emptyArray; + } + ts6.getTsConfigPropArray = getTsConfigPropArray; + function getContainingFunction(node) { + return ts6.findAncestor(node.parent, ts6.isFunctionLike); + } + ts6.getContainingFunction = getContainingFunction; + function getContainingFunctionDeclaration(node) { + return ts6.findAncestor(node.parent, ts6.isFunctionLikeDeclaration); + } + ts6.getContainingFunctionDeclaration = getContainingFunctionDeclaration; + function getContainingClass(node) { + return ts6.findAncestor(node.parent, ts6.isClassLike); + } + ts6.getContainingClass = getContainingClass; + function getContainingClassStaticBlock(node) { + return ts6.findAncestor(node.parent, function(n) { + if (ts6.isClassLike(n) || ts6.isFunctionLike(n)) { + return "quit"; + } + return ts6.isClassStaticBlockDeclaration(n); + }); + } + ts6.getContainingClassStaticBlock = getContainingClassStaticBlock; + function getContainingFunctionOrClassStaticBlock(node) { + return ts6.findAncestor(node.parent, ts6.isFunctionLikeOrClassStaticBlockDeclaration); + } + ts6.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; + function getThisContainer(node, includeArrowFunctions) { + ts6.Debug.assert( + node.kind !== 308 + /* SyntaxKind.SourceFile */ + ); + while (true) { + node = node.parent; + if (!node) { + return ts6.Debug.fail(); + } + switch (node.kind) { + case 164: + if (ts6.isClassLike(node.parent.parent)) { + return node; + } + node = node.parent; + break; + case 167: + if (node.parent.kind === 166 && ts6.isClassElement(node.parent.parent)) { + node = node.parent.parent; + } else if (ts6.isClassElement(node.parent)) { + node = node.parent; + } + break; + case 216: + if (!includeArrowFunctions) { + continue; + } + case 259: + case 215: + case 264: + case 172: + case 169: + case 168: + case 171: + case 170: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 263: + case 308: + return node; + } + } + } + ts6.getThisContainer = getThisContainer; + function isThisContainerOrFunctionBlock(node) { + switch (node.kind) { + case 216: + case 259: + case 215: + case 169: + return true; + case 238: + switch (node.parent.kind) { + case 173: + case 171: + case 174: + case 175: + return true; + default: + return false; + } + default: + return false; + } + } + ts6.isThisContainerOrFunctionBlock = isThisContainerOrFunctionBlock; + function isInTopLevelContext(node) { + if (ts6.isIdentifier(node) && (ts6.isClassDeclaration(node.parent) || ts6.isFunctionDeclaration(node.parent)) && node.parent.name === node) { + node = node.parent; + } + var container = getThisContainer( + node, + /*includeArrowFunctions*/ + true + ); + return ts6.isSourceFile(container); + } + ts6.isInTopLevelContext = isInTopLevelContext; + function getNewTargetContainer(node) { + var container = getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + if (container) { + switch (container.kind) { + case 173: + case 259: + case 215: + return container; + } + } + return void 0; + } + ts6.getNewTargetContainer = getNewTargetContainer; + function getSuperContainer(node, stopOnFunctions) { + while (true) { + node = node.parent; + if (!node) { + return node; + } + switch (node.kind) { + case 164: + node = node.parent; + break; + case 259: + case 215: + case 216: + if (!stopOnFunctions) { + continue; + } + case 169: + case 168: + case 171: + case 170: + case 173: + case 174: + case 175: + case 172: + return node; + case 167: + if (node.parent.kind === 166 && ts6.isClassElement(node.parent.parent)) { + node = node.parent.parent; + } else if (ts6.isClassElement(node.parent)) { + node = node.parent; + } + break; + } + } + } + ts6.getSuperContainer = getSuperContainer; + function getImmediatelyInvokedFunctionExpression(func) { + if (func.kind === 215 || func.kind === 216) { + var prev = func; + var parent = func.parent; + while (parent.kind === 214) { + prev = parent; + parent = parent.parent; + } + if (parent.kind === 210 && parent.expression === prev) { + return parent; + } + } + } + ts6.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; + function isSuperOrSuperProperty(node) { + return node.kind === 106 || isSuperProperty(node); + } + ts6.isSuperOrSuperProperty = isSuperOrSuperProperty; + function isSuperProperty(node) { + var kind = node.kind; + return (kind === 208 || kind === 209) && node.expression.kind === 106; + } + ts6.isSuperProperty = isSuperProperty; + function isThisProperty(node) { + var kind = node.kind; + return (kind === 208 || kind === 209) && node.expression.kind === 108; + } + ts6.isThisProperty = isThisProperty; + function isThisInitializedDeclaration(node) { + var _a; + return !!node && ts6.isVariableDeclaration(node) && ((_a = node.initializer) === null || _a === void 0 ? void 0 : _a.kind) === 108; + } + ts6.isThisInitializedDeclaration = isThisInitializedDeclaration; + function isThisInitializedObjectBindingExpression(node) { + return !!node && (ts6.isShorthandPropertyAssignment(node) || ts6.isPropertyAssignment(node)) && ts6.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 63 && node.parent.parent.right.kind === 108; + } + ts6.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; + function getEntityNameFromTypeNode(node) { + switch (node.kind) { + case 180: + return node.typeName; + case 230: + return isEntityNameExpression(node.expression) ? node.expression : void 0; + case 79: + case 163: + return node; + } + return void 0; + } + ts6.getEntityNameFromTypeNode = getEntityNameFromTypeNode; + function getInvokedExpression(node) { + switch (node.kind) { + case 212: + return node.tag; + case 283: + case 282: + return node.tagName; + default: + return node.expression; + } + } + ts6.getInvokedExpression = getInvokedExpression; + function nodeCanBeDecorated(node, parent, grandparent) { + if (ts6.isNamedDeclaration(node) && ts6.isPrivateIdentifier(node.name)) { + return false; + } + switch (node.kind) { + case 260: + return true; + case 169: + return parent.kind === 260; + case 174: + case 175: + case 171: + return node.body !== void 0 && parent.kind === 260; + case 166: + return parent.body !== void 0 && (parent.kind === 173 || parent.kind === 171 || parent.kind === 175) && grandparent.kind === 260; + } + return false; + } + ts6.nodeCanBeDecorated = nodeCanBeDecorated; + function nodeIsDecorated(node, parent, grandparent) { + return hasDecorators(node) && nodeCanBeDecorated(node, parent, grandparent); + } + ts6.nodeIsDecorated = nodeIsDecorated; + function nodeOrChildIsDecorated(node, parent, grandparent) { + return nodeIsDecorated(node, parent, grandparent) || childIsDecorated(node, parent); + } + ts6.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function childIsDecorated(node, parent) { + switch (node.kind) { + case 260: + return ts6.some(node.members, function(m) { + return nodeOrChildIsDecorated(m, node, parent); + }); + case 171: + case 175: + case 173: + return ts6.some(node.parameters, function(p) { + return nodeIsDecorated(p, node, parent); + }); + default: + return false; + } + } + ts6.childIsDecorated = childIsDecorated; + function classOrConstructorParameterIsDecorated(node) { + if (nodeIsDecorated(node)) + return true; + var constructor = getFirstConstructorWithBody(node); + return !!constructor && childIsDecorated(constructor, node); + } + ts6.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 283 || parent.kind === 282 || parent.kind === 284) { + return parent.tagName === node; + } + return false; + } + ts6.isJSXTagName = isJSXTagName; + function isExpressionNode(node) { + switch (node.kind) { + case 106: + case 104: + case 110: + case 95: + case 13: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 231: + case 213: + case 235: + case 232: + case 214: + case 215: + case 228: + case 216: + case 219: + case 217: + case 218: + case 221: + case 222: + case 223: + case 224: + case 227: + case 225: + case 229: + case 281: + case 282: + case 285: + case 226: + case 220: + case 233: + return true; + case 230: + return !ts6.isHeritageClause(node.parent); + case 163: + while (node.parent.kind === 163) { + node = node.parent; + } + return node.parent.kind === 183 || ts6.isJSDocLinkLike(node.parent) || ts6.isJSDocNameReference(node.parent) || ts6.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314: + while (ts6.isJSDocMemberName(node.parent)) { + node = node.parent; + } + return node.parent.kind === 183 || ts6.isJSDocLinkLike(node.parent) || ts6.isJSDocNameReference(node.parent) || ts6.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 80: + return ts6.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101; + case 79: + if (node.parent.kind === 183 || ts6.isJSDocLinkLike(node.parent) || ts6.isJSDocNameReference(node.parent) || ts6.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + return true; + } + case 8: + case 9: + case 10: + case 14: + case 108: + return isInExpressionContext(node); + default: + return false; + } + } + ts6.isExpressionNode = isExpressionNode; + function isInExpressionContext(node) { + var parent = node.parent; + switch (parent.kind) { + case 257: + case 166: + case 169: + case 168: + case 302: + case 299: + case 205: + return parent.initializer === node; + case 241: + case 242: + case 243: + case 244: + case 250: + case 251: + case 252: + case 292: + case 254: + return parent.expression === node; + case 245: + var forStatement = parent; + return forStatement.initializer === node && forStatement.initializer.kind !== 258 || forStatement.condition === node || forStatement.incrementor === node; + case 246: + case 247: + var forInStatement = parent; + return forInStatement.initializer === node && forInStatement.initializer.kind !== 258 || forInStatement.expression === node; + case 213: + case 231: + return node === parent.expression; + case 236: + return node === parent.expression; + case 164: + return node === parent.expression; + case 167: + case 291: + case 290: + case 301: + return true; + case 230: + return parent.expression === node && !isPartOfTypeNode(parent); + case 300: + return parent.objectAssignmentInitializer === node; + case 235: + return node === parent.expression; + default: + return isExpressionNode(parent); + } + } + ts6.isInExpressionContext = isInExpressionContext; + function isPartOfTypeQuery(node) { + while (node.kind === 163 || node.kind === 79) { + node = node.parent; + } + return node.kind === 183; + } + ts6.isPartOfTypeQuery = isPartOfTypeQuery; + function isNamespaceReexportDeclaration(node) { + return ts6.isNamespaceExport(node) && !!node.parent.moduleSpecifier; + } + ts6.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; + function isExternalModuleImportEqualsDeclaration(node) { + return node.kind === 268 && node.moduleReference.kind === 280; + } + ts6.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; + function getExternalModuleImportEqualsDeclarationExpression(node) { + ts6.Debug.assert(isExternalModuleImportEqualsDeclaration(node)); + return node.moduleReference.expression; + } + ts6.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; + function getExternalModuleRequireArgument(node) { + return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0]; + } + ts6.getExternalModuleRequireArgument = getExternalModuleRequireArgument; + function isInternalModuleImportEqualsDeclaration(node) { + return node.kind === 268 && node.moduleReference.kind !== 280; + } + ts6.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJS(file) { + return isInJSFile(file); + } + ts6.isSourceFileJS = isSourceFileJS; + function isSourceFileNotJS(file) { + return !isInJSFile(file); + } + ts6.isSourceFileNotJS = isSourceFileNotJS; + function isInJSFile(node) { + return !!node && !!(node.flags & 262144); + } + ts6.isInJSFile = isInJSFile; + function isInJsonFile(node) { + return !!node && !!(node.flags & 67108864); + } + ts6.isInJsonFile = isInJsonFile; + function isSourceFileNotJson(file) { + return !isJsonSourceFile(file); + } + ts6.isSourceFileNotJson = isSourceFileNotJson; + function isInJSDoc(node) { + return !!node && !!(node.flags & 8388608); + } + ts6.isInJSDoc = isInJSDoc; + function isJSDocIndexSignature(node) { + return ts6.isTypeReferenceNode(node) && ts6.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && (node.typeArguments[0].kind === 152 || node.typeArguments[0].kind === 148); + } + ts6.isJSDocIndexSignature = isJSDocIndexSignature; + function isRequireCall(callExpression, requireStringLiteralLikeArgument) { + if (callExpression.kind !== 210) { + return false; + } + var _a = callExpression, expression = _a.expression, args = _a.arguments; + if (expression.kind !== 79 || expression.escapedText !== "require") { + return false; + } + if (args.length !== 1) { + return false; + } + var arg = args[0]; + return !requireStringLiteralLikeArgument || ts6.isStringLiteralLike(arg); + } + ts6.isRequireCall = isRequireCall; + function isVariableDeclarationInitializedToRequire(node) { + return isVariableDeclarationInitializedWithRequireHelper( + node, + /*allowAccessedRequire*/ + false + ); + } + ts6.isVariableDeclarationInitializedToRequire = isVariableDeclarationInitializedToRequire; + function isVariableDeclarationInitializedToBareOrAccessedRequire(node) { + return isVariableDeclarationInitializedWithRequireHelper( + node, + /*allowAccessedRequire*/ + true + ); + } + ts6.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire; + function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) { + return ts6.isVariableDeclaration(node) && !!node.initializer && isRequireCall( + allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, + /*requireStringLiteralLikeArgument*/ + true + ); + } + function isRequireVariableStatement(node) { + return ts6.isVariableStatement(node) && node.declarationList.declarations.length > 0 && ts6.every(node.declarationList.declarations, function(decl) { + return isVariableDeclarationInitializedToRequire(decl); + }); + } + ts6.isRequireVariableStatement = isRequireVariableStatement; + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 || charCode === 34; + } + ts6.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + function isStringDoubleQuoted(str, sourceFile) { + return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === 34; + } + ts6.isStringDoubleQuoted = isStringDoubleQuoted; + function isAssignmentDeclaration(decl) { + return ts6.isBinaryExpression(decl) || isAccessExpression(decl) || ts6.isIdentifier(decl) || ts6.isCallExpression(decl); + } + ts6.isAssignmentDeclaration = isAssignmentDeclaration; + function getEffectiveInitializer(node) { + if (isInJSFile(node) && node.initializer && ts6.isBinaryExpression(node.initializer) && (node.initializer.operatorToken.kind === 56 || node.initializer.operatorToken.kind === 60) && node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) { + return node.initializer.right; + } + return node.initializer; + } + ts6.getEffectiveInitializer = getEffectiveInitializer; + function getDeclaredExpandoInitializer(node) { + var init = getEffectiveInitializer(node); + return init && getExpandoInitializer(init, isPrototypeAccess(node.name)); + } + ts6.getDeclaredExpandoInitializer = getDeclaredExpandoInitializer; + function hasExpandoValueProperty(node, isPrototypeAssignment) { + return ts6.forEach(node.properties, function(p) { + return ts6.isPropertyAssignment(p) && ts6.isIdentifier(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment); + }); + } + function getAssignedExpandoInitializer(node) { + if (node && node.parent && ts6.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 63) { + var isPrototypeAssignment = isPrototypeAccess(node.parent.left); + return getExpandoInitializer(node.parent.right, isPrototypeAssignment) || getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment); + } + if (node && ts6.isCallExpression(node) && isBindableObjectDefinePropertyCall(node)) { + var result = hasExpandoValueProperty(node.arguments[2], node.arguments[1].text === "prototype"); + if (result) { + return result; + } + } + } + ts6.getAssignedExpandoInitializer = getAssignedExpandoInitializer; + function getExpandoInitializer(initializer, isPrototypeAssignment) { + if (ts6.isCallExpression(initializer)) { + var e = skipParentheses(initializer.expression); + return e.kind === 215 || e.kind === 216 ? initializer : void 0; + } + if (initializer.kind === 215 || initializer.kind === 228 || initializer.kind === 216) { + return initializer; + } + if (ts6.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { + return initializer; + } + } + ts6.getExpandoInitializer = getExpandoInitializer; + function getDefaultedExpandoInitializer(name, initializer, isPrototypeAssignment) { + var e = ts6.isBinaryExpression(initializer) && (initializer.operatorToken.kind === 56 || initializer.operatorToken.kind === 60) && getExpandoInitializer(initializer.right, isPrototypeAssignment); + if (e && isSameEntityName(name, initializer.left)) { + return e; + } + } + function isDefaultedExpandoInitializer(node) { + var name = ts6.isVariableDeclaration(node.parent) ? node.parent.name : ts6.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 63 ? node.parent.left : void 0; + return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left); + } + ts6.isDefaultedExpandoInitializer = isDefaultedExpandoInitializer; + function getNameOfExpando(node) { + if (ts6.isBinaryExpression(node.parent)) { + var parent = (node.parent.operatorToken.kind === 56 || node.parent.operatorToken.kind === 60) && ts6.isBinaryExpression(node.parent.parent) ? node.parent.parent : node.parent; + if (parent.operatorToken.kind === 63 && ts6.isIdentifier(parent.left)) { + return parent.left; + } + } else if (ts6.isVariableDeclaration(node.parent)) { + return node.parent.name; + } + } + ts6.getNameOfExpando = getNameOfExpando; + function isSameEntityName(name, initializer) { + if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) { + return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer); + } + if (ts6.isMemberName(name) && isLiteralLikeAccess(initializer) && (initializer.expression.kind === 108 || ts6.isIdentifier(initializer.expression) && (initializer.expression.escapedText === "window" || initializer.expression.escapedText === "self" || initializer.expression.escapedText === "global"))) { + return isSameEntityName(name, getNameOrArgument(initializer)); + } + if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) { + return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer) && isSameEntityName(name.expression, initializer.expression); + } + return false; + } + ts6.isSameEntityName = isSameEntityName; + function getRightMostAssignedExpression(node) { + while (isAssignmentExpression( + node, + /*excludeCompoundAssignments*/ + true + )) { + node = node.right; + } + return node; + } + ts6.getRightMostAssignedExpression = getRightMostAssignedExpression; + function isExportsIdentifier(node) { + return ts6.isIdentifier(node) && node.escapedText === "exports"; + } + ts6.isExportsIdentifier = isExportsIdentifier; + function isModuleIdentifier(node) { + return ts6.isIdentifier(node) && node.escapedText === "module"; + } + ts6.isModuleIdentifier = isModuleIdentifier; + function isModuleExportsAccessExpression(node) { + return (ts6.isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node)) && isModuleIdentifier(node.expression) && getElementOrPropertyAccessName(node) === "exports"; + } + ts6.isModuleExportsAccessExpression = isModuleExportsAccessExpression; + function getAssignmentDeclarationKind(expr) { + var special = getAssignmentDeclarationKindWorker(expr); + return special === 5 || isInJSFile(expr) ? special : 0; + } + ts6.getAssignmentDeclarationKind = getAssignmentDeclarationKind; + function isBindableObjectDefinePropertyCall(expr) { + return ts6.length(expr.arguments) === 3 && ts6.isPropertyAccessExpression(expr.expression) && ts6.isIdentifier(expr.expression.expression) && ts6.idText(expr.expression.expression) === "Object" && ts6.idText(expr.expression.name) === "defineProperty" && isStringOrNumericLiteralLike(expr.arguments[1]) && isBindableStaticNameExpression( + expr.arguments[0], + /*excludeThisKeyword*/ + true + ); + } + ts6.isBindableObjectDefinePropertyCall = isBindableObjectDefinePropertyCall; + function isLiteralLikeAccess(node) { + return ts6.isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node); + } + ts6.isLiteralLikeAccess = isLiteralLikeAccess; + function isLiteralLikeElementAccess(node) { + return ts6.isElementAccessExpression(node) && isStringOrNumericLiteralLike(node.argumentExpression); + } + ts6.isLiteralLikeElementAccess = isLiteralLikeElementAccess; + function isBindableStaticAccessExpression(node, excludeThisKeyword) { + return ts6.isPropertyAccessExpression(node) && (!excludeThisKeyword && node.expression.kind === 108 || ts6.isIdentifier(node.name) && isBindableStaticNameExpression( + node.expression, + /*excludeThisKeyword*/ + true + )) || isBindableStaticElementAccessExpression(node, excludeThisKeyword); + } + ts6.isBindableStaticAccessExpression = isBindableStaticAccessExpression; + function isBindableStaticElementAccessExpression(node, excludeThisKeyword) { + return isLiteralLikeElementAccess(node) && (!excludeThisKeyword && node.expression.kind === 108 || isEntityNameExpression(node.expression) || isBindableStaticAccessExpression( + node.expression, + /*excludeThisKeyword*/ + true + )); + } + ts6.isBindableStaticElementAccessExpression = isBindableStaticElementAccessExpression; + function isBindableStaticNameExpression(node, excludeThisKeyword) { + return isEntityNameExpression(node) || isBindableStaticAccessExpression(node, excludeThisKeyword); + } + ts6.isBindableStaticNameExpression = isBindableStaticNameExpression; + function getNameOrArgument(expr) { + if (ts6.isPropertyAccessExpression(expr)) { + return expr.name; + } + return expr.argumentExpression; + } + ts6.getNameOrArgument = getNameOrArgument; + function getAssignmentDeclarationKindWorker(expr) { + if (ts6.isCallExpression(expr)) { + if (!isBindableObjectDefinePropertyCall(expr)) { + return 0; + } + var entityName = expr.arguments[0]; + if (isExportsIdentifier(entityName) || isModuleExportsAccessExpression(entityName)) { + return 8; + } + if (isBindableStaticAccessExpression(entityName) && getElementOrPropertyAccessName(entityName) === "prototype") { + return 9; + } + return 7; + } + if (expr.operatorToken.kind !== 63 || !isAccessExpression(expr.left) || isVoidZero(getRightMostAssignedExpression(expr))) { + return 0; + } + if (isBindableStaticNameExpression( + expr.left.expression, + /*excludeThisKeyword*/ + true + ) && getElementOrPropertyAccessName(expr.left) === "prototype" && ts6.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) { + return 6; + } + return getAssignmentDeclarationPropertyAccessKind(expr.left); + } + function isVoidZero(node) { + return ts6.isVoidExpression(node) && ts6.isNumericLiteral(node.expression) && node.expression.text === "0"; + } + function getElementOrPropertyAccessArgumentExpressionOrName(node) { + if (ts6.isPropertyAccessExpression(node)) { + return node.name; + } + var arg = skipParentheses(node.argumentExpression); + if (ts6.isNumericLiteral(arg) || ts6.isStringLiteralLike(arg)) { + return arg; + } + return node; + } + ts6.getElementOrPropertyAccessArgumentExpressionOrName = getElementOrPropertyAccessArgumentExpressionOrName; + function getElementOrPropertyAccessName(node) { + var name = getElementOrPropertyAccessArgumentExpressionOrName(node); + if (name) { + if (ts6.isIdentifier(name)) { + return name.escapedText; + } + if (ts6.isStringLiteralLike(name) || ts6.isNumericLiteral(name)) { + return ts6.escapeLeadingUnderscores(name.text); + } + } + return void 0; + } + ts6.getElementOrPropertyAccessName = getElementOrPropertyAccessName; + function getAssignmentDeclarationPropertyAccessKind(lhs) { + if (lhs.expression.kind === 108) { + return 4; + } else if (isModuleExportsAccessExpression(lhs)) { + return 2; + } else if (isBindableStaticNameExpression( + lhs.expression, + /*excludeThisKeyword*/ + true + )) { + if (isPrototypeAccess(lhs.expression)) { + return 3; + } + var nextToLast = lhs; + while (!ts6.isIdentifier(nextToLast.expression)) { + nextToLast = nextToLast.expression; + } + var id = nextToLast.expression; + if ((id.escapedText === "exports" || id.escapedText === "module" && getElementOrPropertyAccessName(nextToLast) === "exports") && // ExportsProperty does not support binding with computed names + isBindableStaticAccessExpression(lhs)) { + return 1; + } + if (isBindableStaticNameExpression( + lhs, + /*excludeThisKeyword*/ + true + ) || ts6.isElementAccessExpression(lhs) && isDynamicName(lhs)) { + return 5; + } + } + return 0; + } + ts6.getAssignmentDeclarationPropertyAccessKind = getAssignmentDeclarationPropertyAccessKind; + function getInitializerOfBinaryExpression(expr) { + while (ts6.isBinaryExpression(expr.right)) { + expr = expr.right; + } + return expr.right; + } + ts6.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression; + function isPrototypePropertyAssignment(node) { + return ts6.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 3; + } + ts6.isPrototypePropertyAssignment = isPrototypePropertyAssignment; + function isSpecialPropertyDeclaration(expr) { + return isInJSFile(expr) && expr.parent && expr.parent.kind === 241 && (!ts6.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts6.getJSDocTypeTag(expr.parent); + } + ts6.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; + function setValueDeclaration(symbol, node) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || !(node.flags & 16777216 && !(valueDeclaration.flags & 16777216)) && (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) || valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration)) { + symbol.valueDeclaration = node; + } + } + ts6.setValueDeclaration = setValueDeclaration; + function isFunctionSymbol(symbol) { + if (!symbol || !symbol.valueDeclaration) { + return false; + } + var decl = symbol.valueDeclaration; + return decl.kind === 259 || ts6.isVariableDeclaration(decl) && decl.initializer && ts6.isFunctionLike(decl.initializer); + } + ts6.isFunctionSymbol = isFunctionSymbol; + function tryGetModuleSpecifierFromDeclaration(node) { + var _a, _b; + switch (node.kind) { + case 257: + return (_a = ts6.findAncestor(node.initializer, function(node2) { + return isRequireCall( + node2, + /*requireStringLiteralLikeArgument*/ + true + ); + })) === null || _a === void 0 ? void 0 : _a.arguments[0]; + case 269: + return ts6.tryCast(node.moduleSpecifier, ts6.isStringLiteralLike); + case 268: + return ts6.tryCast((_b = ts6.tryCast(node.moduleReference, ts6.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts6.isStringLiteralLike); + default: + ts6.Debug.assertNever(node); + } + } + ts6.tryGetModuleSpecifierFromDeclaration = tryGetModuleSpecifierFromDeclaration; + function importFromModuleSpecifier(node) { + return tryGetImportFromModuleSpecifier(node) || ts6.Debug.failBadSyntaxKind(node.parent); + } + ts6.importFromModuleSpecifier = importFromModuleSpecifier; + function tryGetImportFromModuleSpecifier(node) { + switch (node.parent.kind) { + case 269: + case 275: + return node.parent; + case 280: + return node.parent.parent; + case 210: + return isImportCall(node.parent) || isRequireCall( + node.parent, + /*checkArg*/ + false + ) ? node.parent : void 0; + case 198: + ts6.Debug.assert(ts6.isStringLiteral(node)); + return ts6.tryCast(node.parent.parent, ts6.isImportTypeNode); + default: + return void 0; + } + } + ts6.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; + function getExternalModuleName(node) { + switch (node.kind) { + case 269: + case 275: + return node.moduleSpecifier; + case 268: + return node.moduleReference.kind === 280 ? node.moduleReference.expression : void 0; + case 202: + return isLiteralImportTypeNode(node) ? node.argument.literal : void 0; + case 210: + return node.arguments[0]; + case 264: + return node.name.kind === 10 ? node.name : void 0; + default: + return ts6.Debug.assertNever(node); + } + } + ts6.getExternalModuleName = getExternalModuleName; + function getNamespaceDeclarationNode(node) { + switch (node.kind) { + case 269: + return node.importClause && ts6.tryCast(node.importClause.namedBindings, ts6.isNamespaceImport); + case 268: + return node; + case 275: + return node.exportClause && ts6.tryCast(node.exportClause, ts6.isNamespaceExport); + default: + return ts6.Debug.assertNever(node); + } + } + ts6.getNamespaceDeclarationNode = getNamespaceDeclarationNode; + function isDefaultImport(node) { + return node.kind === 269 && !!node.importClause && !!node.importClause.name; + } + ts6.isDefaultImport = isDefaultImport; + function forEachImportClauseDeclaration(node, action) { + if (node.name) { + var result = action(node); + if (result) + return result; + } + if (node.namedBindings) { + var result = ts6.isNamespaceImport(node.namedBindings) ? action(node.namedBindings) : ts6.forEach(node.namedBindings.elements, action); + if (result) + return result; + } + } + ts6.forEachImportClauseDeclaration = forEachImportClauseDeclaration; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 166: + case 171: + case 170: + case 300: + case 299: + case 169: + case 168: + return node.questionToken !== void 0; + } + } + return false; + } + ts6.hasQuestionToken = hasQuestionToken; + function isJSDocConstructSignature(node) { + var param = ts6.isJSDocFunctionType(node) ? ts6.firstOrUndefined(node.parameters) : void 0; + var name = ts6.tryCast(param && param.name, ts6.isIdentifier); + return !!name && name.escapedText === "new"; + } + ts6.isJSDocConstructSignature = isJSDocConstructSignature; + function isJSDocTypeAlias(node) { + return node.kind === 348 || node.kind === 341 || node.kind === 342; + } + ts6.isJSDocTypeAlias = isJSDocTypeAlias; + function isTypeAlias(node) { + return isJSDocTypeAlias(node) || ts6.isTypeAliasDeclaration(node); + } + ts6.isTypeAlias = isTypeAlias; + function getSourceOfAssignment(node) { + return ts6.isExpressionStatement(node) && ts6.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 63 ? getRightMostAssignedExpression(node.expression) : void 0; + } + function getSourceOfDefaultedAssignment(node) { + return ts6.isExpressionStatement(node) && ts6.isBinaryExpression(node.expression) && getAssignmentDeclarationKind(node.expression) !== 0 && ts6.isBinaryExpression(node.expression.right) && (node.expression.right.operatorToken.kind === 56 || node.expression.right.operatorToken.kind === 60) ? node.expression.right.right : void 0; + } + function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { + switch (node.kind) { + case 240: + var v = getSingleVariableOfVariableStatement(node); + return v && v.initializer; + case 169: + return node.initializer; + case 299: + return node.initializer; + } + } + ts6.getSingleInitializerOfVariableStatementOrPropertyDeclaration = getSingleInitializerOfVariableStatementOrPropertyDeclaration; + function getSingleVariableOfVariableStatement(node) { + return ts6.isVariableStatement(node) ? ts6.firstOrUndefined(node.declarationList.declarations) : void 0; + } + ts6.getSingleVariableOfVariableStatement = getSingleVariableOfVariableStatement; + function getNestedModuleDeclaration(node) { + return ts6.isModuleDeclaration(node) && node.body && node.body.kind === 264 ? node.body : void 0; + } + function getJSDocCommentsAndTags(hostNode, noCache) { + var result; + if (isVariableLike(hostNode) && ts6.hasInitializer(hostNode) && ts6.hasJSDocNodes(hostNode.initializer)) { + result = ts6.addRange(result, filterOwnedJSDocTags(hostNode, ts6.last(hostNode.initializer.jsDoc))); + } + var node = hostNode; + while (node && node.parent) { + if (ts6.hasJSDocNodes(node)) { + result = ts6.addRange(result, filterOwnedJSDocTags(hostNode, ts6.last(node.jsDoc))); + } + if (node.kind === 166) { + result = ts6.addRange(result, (noCache ? ts6.getJSDocParameterTagsNoCache : ts6.getJSDocParameterTags)(node)); + break; + } + if (node.kind === 165) { + result = ts6.addRange(result, (noCache ? ts6.getJSDocTypeParameterTagsNoCache : ts6.getJSDocTypeParameterTags)(node)); + break; + } + node = getNextJSDocCommentLocation(node); + } + return result || ts6.emptyArray; + } + ts6.getJSDocCommentsAndTags = getJSDocCommentsAndTags; + function filterOwnedJSDocTags(hostNode, jsDoc) { + if (ts6.isJSDoc(jsDoc)) { + var ownedTags = ts6.filter(jsDoc.tags, function(tag) { + return ownsJSDocTag(hostNode, tag); + }); + return jsDoc.tags === ownedTags ? [jsDoc] : ownedTags; + } + return ownsJSDocTag(hostNode, jsDoc) ? [jsDoc] : void 0; + } + function ownsJSDocTag(hostNode, tag) { + return !ts6.isJSDocTypeTag(tag) || !tag.parent || !ts6.isJSDoc(tag.parent) || !ts6.isParenthesizedExpression(tag.parent.parent) || tag.parent.parent === hostNode; + } + function getNextJSDocCommentLocation(node) { + var parent = node.parent; + if (parent.kind === 299 || parent.kind === 274 || parent.kind === 169 || parent.kind === 241 && node.kind === 208 || parent.kind === 250 || getNestedModuleDeclaration(parent) || ts6.isBinaryExpression(node) && node.operatorToken.kind === 63) { + return parent; + } else if (parent.parent && (getSingleVariableOfVariableStatement(parent.parent) === node || ts6.isBinaryExpression(parent) && parent.operatorToken.kind === 63)) { + return parent.parent; + } else if (parent.parent && parent.parent.parent && (getSingleVariableOfVariableStatement(parent.parent.parent) || getSingleInitializerOfVariableStatementOrPropertyDeclaration(parent.parent.parent) === node || getSourceOfDefaultedAssignment(parent.parent.parent))) { + return parent.parent.parent; + } + } + ts6.getNextJSDocCommentLocation = getNextJSDocCommentLocation; + function getParameterSymbolFromJSDoc(node) { + if (node.symbol) { + return node.symbol; + } + if (!ts6.isIdentifier(node.name)) { + return void 0; + } + var name = node.name.escapedText; + var decl = getHostSignatureFromJSDoc(node); + if (!decl) { + return void 0; + } + var parameter = ts6.find(decl.parameters, function(p) { + return p.name.kind === 79 && p.name.escapedText === name; + }); + return parameter && parameter.symbol; + } + ts6.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; + function getEffectiveContainerForJSDocTemplateTag(node) { + if (ts6.isJSDoc(node.parent) && node.parent.tags) { + var typeAlias = ts6.find(node.parent.tags, isJSDocTypeAlias); + if (typeAlias) { + return typeAlias; + } + } + return getHostSignatureFromJSDoc(node); + } + ts6.getEffectiveContainerForJSDocTemplateTag = getEffectiveContainerForJSDocTemplateTag; + function getHostSignatureFromJSDoc(node) { + var host = getEffectiveJSDocHost(node); + if (host) { + return ts6.isPropertySignature(host) && host.type && ts6.isFunctionLike(host.type) ? host.type : ts6.isFunctionLike(host) ? host : void 0; + } + return void 0; + } + ts6.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc; + function getEffectiveJSDocHost(node) { + var host = getJSDocHost(node); + if (host) { + return getSourceOfDefaultedAssignment(host) || getSourceOfAssignment(host) || getSingleInitializerOfVariableStatementOrPropertyDeclaration(host) || getSingleVariableOfVariableStatement(host) || getNestedModuleDeclaration(host) || host; + } + } + ts6.getEffectiveJSDocHost = getEffectiveJSDocHost; + function getJSDocHost(node) { + var jsDoc = getJSDocRoot(node); + if (!jsDoc) { + return void 0; + } + var host = jsDoc.parent; + if (host && host.jsDoc && jsDoc === ts6.lastOrUndefined(host.jsDoc)) { + return host; + } + } + ts6.getJSDocHost = getJSDocHost; + function getJSDocRoot(node) { + return ts6.findAncestor(node.parent, ts6.isJSDoc); + } + ts6.getJSDocRoot = getJSDocRoot; + function getTypeParameterFromJsDoc(node) { + var name = node.name.escapedText; + var typeParameters = node.parent.parent.parent.typeParameters; + return typeParameters && ts6.find(typeParameters, function(p) { + return p.name.escapedText === name; + }); + } + ts6.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc; + function hasTypeArguments(node) { + return !!node.typeArguments; + } + ts6.hasTypeArguments = hasTypeArguments; + var AssignmentKind; + (function(AssignmentKind2) { + AssignmentKind2[AssignmentKind2["None"] = 0] = "None"; + AssignmentKind2[AssignmentKind2["Definite"] = 1] = "Definite"; + AssignmentKind2[AssignmentKind2["Compound"] = 2] = "Compound"; + })(AssignmentKind = ts6.AssignmentKind || (ts6.AssignmentKind = {})); + function getAssignmentTargetKind(node) { + var parent = node.parent; + while (true) { + switch (parent.kind) { + case 223: + var binaryOperator = parent.operatorToken.kind; + return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 : 2 : 0; + case 221: + case 222: + var unaryOperator = parent.operator; + return unaryOperator === 45 || unaryOperator === 46 ? 2 : 0; + case 246: + case 247: + return parent.initializer === node ? 1 : 0; + case 214: + case 206: + case 227: + case 232: + node = parent; + break; + case 301: + node = parent.parent; + break; + case 300: + if (parent.name !== node) { + return 0; + } + node = parent.parent; + break; + case 299: + if (parent.name === node) { + return 0; + } + node = parent.parent; + break; + default: + return 0; + } + parent = node.parent; + } + } + ts6.getAssignmentTargetKind = getAssignmentTargetKind; + function isAssignmentTarget(node) { + return getAssignmentTargetKind(node) !== 0; + } + ts6.isAssignmentTarget = isAssignmentTarget; + function isNodeWithPossibleHoistedDeclaration(node) { + switch (node.kind) { + case 238: + case 240: + case 251: + case 242: + case 252: + case 266: + case 292: + case 293: + case 253: + case 245: + case 246: + case 247: + case 243: + case 244: + case 255: + case 295: + return true; + } + return false; + } + ts6.isNodeWithPossibleHoistedDeclaration = isNodeWithPossibleHoistedDeclaration; + function isValueSignatureDeclaration(node) { + return ts6.isFunctionExpression(node) || ts6.isArrowFunction(node) || ts6.isMethodOrAccessor(node) || ts6.isFunctionDeclaration(node) || ts6.isConstructorDeclaration(node); + } + ts6.isValueSignatureDeclaration = isValueSignatureDeclaration; + function walkUp(node, kind) { + while (node && node.kind === kind) { + node = node.parent; + } + return node; + } + function walkUpParenthesizedTypes(node) { + return walkUp( + node, + 193 + /* SyntaxKind.ParenthesizedType */ + ); + } + ts6.walkUpParenthesizedTypes = walkUpParenthesizedTypes; + function walkUpParenthesizedExpressions(node) { + return walkUp( + node, + 214 + /* SyntaxKind.ParenthesizedExpression */ + ); + } + ts6.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; + function walkUpParenthesizedTypesAndGetParentAndChild(node) { + var child; + while (node && node.kind === 193) { + child = node; + node = node.parent; + } + return [child, node]; + } + ts6.walkUpParenthesizedTypesAndGetParentAndChild = walkUpParenthesizedTypesAndGetParentAndChild; + function skipTypeParentheses(node) { + while (ts6.isParenthesizedTypeNode(node)) + node = node.type; + return node; + } + ts6.skipTypeParentheses = skipTypeParentheses; + function skipParentheses(node, excludeJSDocTypeAssertions) { + var flags = excludeJSDocTypeAssertions ? 1 | 16 : 1; + return ts6.skipOuterExpressions(node, flags); + } + ts6.skipParentheses = skipParentheses; + function isDeleteTarget(node) { + if (node.kind !== 208 && node.kind !== 209) { + return false; + } + node = walkUpParenthesizedExpressions(node.parent); + return node && node.kind === 217; + } + ts6.isDeleteTarget = isDeleteTarget; + function isNodeDescendantOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts6.isNodeDescendantOf = isNodeDescendantOf; + function isDeclarationName(name) { + return !ts6.isSourceFile(name) && !ts6.isBindingPattern(name) && ts6.isDeclaration(name.parent) && name.parent.name === name; + } + ts6.isDeclarationName = isDeclarationName; + function getDeclarationFromName(name) { + var parent = name.parent; + switch (name.kind) { + case 10: + case 14: + case 8: + if (ts6.isComputedPropertyName(parent)) + return parent.parent; + case 79: + if (ts6.isDeclaration(parent)) { + return parent.name === name ? parent : void 0; + } else if (ts6.isQualifiedName(parent)) { + var tag = parent.parent; + return ts6.isJSDocParameterTag(tag) && tag.name === parent ? tag : void 0; + } else { + var binExp = parent.parent; + return ts6.isBinaryExpression(binExp) && getAssignmentDeclarationKind(binExp) !== 0 && (binExp.left.symbol || binExp.symbol) && ts6.getNameOfDeclaration(binExp) === name ? binExp : void 0; + } + case 80: + return ts6.isDeclaration(parent) && parent.name === name ? parent : void 0; + default: + return void 0; + } + } + ts6.getDeclarationFromName = getDeclarationFromName; + function isLiteralComputedPropertyDeclarationName(node) { + return isStringOrNumericLiteralLike(node) && node.parent.kind === 164 && ts6.isDeclaration(node.parent.parent); + } + ts6.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; + function isIdentifierName(node) { + var parent = node.parent; + switch (parent.kind) { + case 169: + case 168: + case 171: + case 170: + case 174: + case 175: + case 302: + case 299: + case 208: + return parent.name === node; + case 163: + return parent.right === node; + case 205: + case 273: + return parent.propertyName === node; + case 278: + case 288: + case 282: + case 283: + case 284: + return true; + } + return false; + } + ts6.isIdentifierName = isIdentifierName; + function isAliasSymbolDeclaration(node) { + if (node.kind === 268 || node.kind === 267 || node.kind === 270 && !!node.name || node.kind === 271 || node.kind === 277 || node.kind === 273 || node.kind === 278 || node.kind === 274 && exportAssignmentIsAlias(node)) { + return true; + } + return isInJSFile(node) && (ts6.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) || ts6.isPropertyAccessExpression(node) && ts6.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableExpression(node.parent.right)); + } + ts6.isAliasSymbolDeclaration = isAliasSymbolDeclaration; + function getAliasDeclarationFromName(node) { + switch (node.parent.kind) { + case 270: + case 273: + case 271: + case 278: + case 274: + case 268: + case 277: + return node.parent; + case 163: + do { + node = node.parent; + } while (node.parent.kind === 163); + return getAliasDeclarationFromName(node); + } + } + ts6.getAliasDeclarationFromName = getAliasDeclarationFromName; + function isAliasableExpression(e) { + return isEntityNameExpression(e) || ts6.isClassExpression(e); + } + ts6.isAliasableExpression = isAliasableExpression; + function exportAssignmentIsAlias(node) { + var e = getExportAssignmentExpression(node); + return isAliasableExpression(e); + } + ts6.exportAssignmentIsAlias = exportAssignmentIsAlias; + function getExportAssignmentExpression(node) { + return ts6.isExportAssignment(node) ? node.expression : node.right; + } + ts6.getExportAssignmentExpression = getExportAssignmentExpression; + function getPropertyAssignmentAliasLikeExpression(node) { + return node.kind === 300 ? node.name : node.kind === 299 ? node.initializer : node.parent.right; + } + ts6.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; + function getEffectiveBaseTypeNode(node) { + var baseType = getClassExtendsHeritageElement(node); + if (baseType && isInJSFile(node)) { + var tag = ts6.getJSDocAugmentsTag(node); + if (tag) { + return tag.class; + } + } + return baseType; + } + ts6.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode; + function getClassExtendsHeritageElement(node) { + var heritageClause = getHeritageClause( + node.heritageClauses, + 94 + /* SyntaxKind.ExtendsKeyword */ + ); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : void 0; + } + ts6.getClassExtendsHeritageElement = getClassExtendsHeritageElement; + function getEffectiveImplementsTypeNodes(node) { + if (isInJSFile(node)) { + return ts6.getJSDocImplementsTags(node).map(function(n) { + return n.class; + }); + } else { + var heritageClause = getHeritageClause( + node.heritageClauses, + 117 + /* SyntaxKind.ImplementsKeyword */ + ); + return heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.types; + } + } + ts6.getEffectiveImplementsTypeNodes = getEffectiveImplementsTypeNodes; + function getAllSuperTypeNodes(node) { + return ts6.isInterfaceDeclaration(node) ? getInterfaceBaseTypeNodes(node) || ts6.emptyArray : ts6.isClassLike(node) ? ts6.concatenate(ts6.singleElementArray(getEffectiveBaseTypeNode(node)), getEffectiveImplementsTypeNodes(node)) || ts6.emptyArray : ts6.emptyArray; + } + ts6.getAllSuperTypeNodes = getAllSuperTypeNodes; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause( + node.heritageClauses, + 94 + /* SyntaxKind.ExtendsKeyword */ + ); + return heritageClause ? heritageClause.types : void 0; + } + ts6.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; + if (clause.token === kind) { + return clause; + } + } + } + return void 0; + } + ts6.getHeritageClause = getHeritageClause; + function getAncestor(node, kind) { + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + return void 0; + } + ts6.getAncestor = getAncestor; + function isKeyword(token) { + return 81 <= token && token <= 162; + } + ts6.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 126 <= token && token <= 162; + } + ts6.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts6.isNonContextualKeyword = isNonContextualKeyword; + function isFutureReservedKeyword(token) { + return 117 <= token && token <= 125; + } + ts6.isFutureReservedKeyword = isFutureReservedKeyword; + function isStringANonContextualKeyword(name) { + var token = ts6.stringToToken(name); + return token !== void 0 && isNonContextualKeyword(token); + } + ts6.isStringANonContextualKeyword = isStringANonContextualKeyword; + function isStringAKeyword(name) { + var token = ts6.stringToToken(name); + return token !== void 0 && isKeyword(token); + } + ts6.isStringAKeyword = isStringAKeyword; + function isIdentifierANonContextualKeyword(_a) { + var originalKeywordKind = _a.originalKeywordKind; + return !!originalKeywordKind && !isContextualKeyword(originalKeywordKind); + } + ts6.isIdentifierANonContextualKeyword = isIdentifierANonContextualKeyword; + function isTrivia(token) { + return 2 <= token && token <= 7; + } + ts6.isTrivia = isTrivia; + var FunctionFlags; + (function(FunctionFlags2) { + FunctionFlags2[FunctionFlags2["Normal"] = 0] = "Normal"; + FunctionFlags2[FunctionFlags2["Generator"] = 1] = "Generator"; + FunctionFlags2[FunctionFlags2["Async"] = 2] = "Async"; + FunctionFlags2[FunctionFlags2["Invalid"] = 4] = "Invalid"; + FunctionFlags2[FunctionFlags2["AsyncGenerator"] = 3] = "AsyncGenerator"; + })(FunctionFlags = ts6.FunctionFlags || (ts6.FunctionFlags = {})); + function getFunctionFlags(node) { + if (!node) { + return 4; + } + var flags = 0; + switch (node.kind) { + case 259: + case 215: + case 171: + if (node.asteriskToken) { + flags |= 1; + } + case 216: + if (hasSyntacticModifier( + node, + 512 + /* ModifierFlags.Async */ + )) { + flags |= 2; + } + break; + } + if (!node.body) { + flags |= 4; + } + return flags; + } + ts6.getFunctionFlags = getFunctionFlags; + function isAsyncFunction(node) { + switch (node.kind) { + case 259: + case 215: + case 216: + case 171: + return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier( + node, + 512 + /* ModifierFlags.Async */ + ); + } + return false; + } + ts6.isAsyncFunction = isAsyncFunction; + function isStringOrNumericLiteralLike(node) { + return ts6.isStringLiteralLike(node) || ts6.isNumericLiteral(node); + } + ts6.isStringOrNumericLiteralLike = isStringOrNumericLiteralLike; + function isSignedNumericLiteral(node) { + return ts6.isPrefixUnaryExpression(node) && (node.operator === 39 || node.operator === 40) && ts6.isNumericLiteral(node.operand); + } + ts6.isSignedNumericLiteral = isSignedNumericLiteral; + function hasDynamicName(declaration) { + var name = ts6.getNameOfDeclaration(declaration); + return !!name && isDynamicName(name); + } + ts6.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + if (!(name.kind === 164 || name.kind === 209)) { + return false; + } + var expr = ts6.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; + return !isStringOrNumericLiteralLike(expr) && !isSignedNumericLiteral(expr); + } + ts6.isDynamicName = isDynamicName; + function getPropertyNameForPropertyNameNode(name) { + switch (name.kind) { + case 79: + case 80: + return name.escapedText; + case 10: + case 8: + return ts6.escapeLeadingUnderscores(name.text); + case 164: + var nameExpression = name.expression; + if (isStringOrNumericLiteralLike(nameExpression)) { + return ts6.escapeLeadingUnderscores(nameExpression.text); + } else if (isSignedNumericLiteral(nameExpression)) { + if (nameExpression.operator === 40) { + return ts6.tokenToString(nameExpression.operator) + nameExpression.operand.text; + } + return nameExpression.operand.text; + } + return void 0; + default: + return ts6.Debug.assertNever(name); + } + } + ts6.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function isPropertyNameLiteral(node) { + switch (node.kind) { + case 79: + case 10: + case 14: + case 8: + return true; + default: + return false; + } + } + ts6.isPropertyNameLiteral = isPropertyNameLiteral; + function getTextOfIdentifierOrLiteral(node) { + return ts6.isMemberName(node) ? ts6.idText(node) : node.text; + } + ts6.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral; + function getEscapedTextOfIdentifierOrLiteral(node) { + return ts6.isMemberName(node) ? node.escapedText : ts6.escapeLeadingUnderscores(node.text); + } + ts6.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral; + function getPropertyNameForUniqueESSymbol(symbol) { + return "__@".concat(ts6.getSymbolId(symbol), "@").concat(symbol.escapedName); + } + ts6.getPropertyNameForUniqueESSymbol = getPropertyNameForUniqueESSymbol; + function getSymbolNameForPrivateIdentifier(containingClassSymbol, description) { + return "__#".concat(ts6.getSymbolId(containingClassSymbol), "@").concat(description); + } + ts6.getSymbolNameForPrivateIdentifier = getSymbolNameForPrivateIdentifier; + function isKnownSymbol(symbol) { + return ts6.startsWith(symbol.escapedName, "__@"); + } + ts6.isKnownSymbol = isKnownSymbol; + function isPrivateIdentifierSymbol(symbol) { + return ts6.startsWith(symbol.escapedName, "__#"); + } + ts6.isPrivateIdentifierSymbol = isPrivateIdentifierSymbol; + function isESSymbolIdentifier(node) { + return node.kind === 79 && node.escapedText === "Symbol"; + } + ts6.isESSymbolIdentifier = isESSymbolIdentifier; + function isPushOrUnshiftIdentifier(node) { + return node.escapedText === "push" || node.escapedText === "unshift"; + } + ts6.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 166; + } + ts6.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 205) { + node = node.parent.parent; + } + return node; + } + ts6.getRootDeclaration = getRootDeclaration; + function nodeStartsNewLexicalEnvironment(node) { + var kind = node.kind; + return kind === 173 || kind === 215 || kind === 259 || kind === 216 || kind === 171 || kind === 174 || kind === 175 || kind === 264 || kind === 308; + } + ts6.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function nodeIsSynthesized(range2) { + return positionIsSynthesized(range2.pos) || positionIsSynthesized(range2.end); + } + ts6.nodeIsSynthesized = nodeIsSynthesized; + function getOriginalSourceFile(sourceFile) { + return ts6.getParseTreeNode(sourceFile, ts6.isSourceFile) || sourceFile; + } + ts6.getOriginalSourceFile = getOriginalSourceFile; + var Associativity; + (function(Associativity2) { + Associativity2[Associativity2["Left"] = 0] = "Left"; + Associativity2[Associativity2["Right"] = 1] = "Right"; + })(Associativity = ts6.Associativity || (ts6.Associativity = {})); + function getExpressionAssociativity(expression) { + var operator = getOperator(expression); + var hasArguments = expression.kind === 211 && expression.arguments !== void 0; + return getOperatorAssociativity(expression.kind, operator, hasArguments); + } + ts6.getExpressionAssociativity = getExpressionAssociativity; + function getOperatorAssociativity(kind, operator, hasArguments) { + switch (kind) { + case 211: + return hasArguments ? 0 : 1; + case 221: + case 218: + case 219: + case 217: + case 220: + case 224: + case 226: + return 1; + case 223: + switch (operator) { + case 42: + case 63: + case 64: + case 65: + case 67: + case 66: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 78: + case 74: + case 75: + case 76: + case 77: + return 1; + } + } + return 0; + } + ts6.getOperatorAssociativity = getOperatorAssociativity; + function getExpressionPrecedence(expression) { + var operator = getOperator(expression); + var hasArguments = expression.kind === 211 && expression.arguments !== void 0; + return getOperatorPrecedence(expression.kind, operator, hasArguments); + } + ts6.getExpressionPrecedence = getExpressionPrecedence; + function getOperator(expression) { + if (expression.kind === 223) { + return expression.operatorToken.kind; + } else if (expression.kind === 221 || expression.kind === 222) { + return expression.operator; + } else { + return expression.kind; + } + } + ts6.getOperator = getOperator; + var OperatorPrecedence; + (function(OperatorPrecedence2) { + OperatorPrecedence2[OperatorPrecedence2["Comma"] = 0] = "Comma"; + OperatorPrecedence2[OperatorPrecedence2["Spread"] = 1] = "Spread"; + OperatorPrecedence2[OperatorPrecedence2["Yield"] = 2] = "Yield"; + OperatorPrecedence2[OperatorPrecedence2["Assignment"] = 3] = "Assignment"; + OperatorPrecedence2[OperatorPrecedence2["Conditional"] = 4] = "Conditional"; + OperatorPrecedence2[OperatorPrecedence2["Coalesce"] = 4] = "Coalesce"; + OperatorPrecedence2[OperatorPrecedence2["LogicalOR"] = 5] = "LogicalOR"; + OperatorPrecedence2[OperatorPrecedence2["LogicalAND"] = 6] = "LogicalAND"; + OperatorPrecedence2[OperatorPrecedence2["BitwiseOR"] = 7] = "BitwiseOR"; + OperatorPrecedence2[OperatorPrecedence2["BitwiseXOR"] = 8] = "BitwiseXOR"; + OperatorPrecedence2[OperatorPrecedence2["BitwiseAND"] = 9] = "BitwiseAND"; + OperatorPrecedence2[OperatorPrecedence2["Equality"] = 10] = "Equality"; + OperatorPrecedence2[OperatorPrecedence2["Relational"] = 11] = "Relational"; + OperatorPrecedence2[OperatorPrecedence2["Shift"] = 12] = "Shift"; + OperatorPrecedence2[OperatorPrecedence2["Additive"] = 13] = "Additive"; + OperatorPrecedence2[OperatorPrecedence2["Multiplicative"] = 14] = "Multiplicative"; + OperatorPrecedence2[OperatorPrecedence2["Exponentiation"] = 15] = "Exponentiation"; + OperatorPrecedence2[OperatorPrecedence2["Unary"] = 16] = "Unary"; + OperatorPrecedence2[OperatorPrecedence2["Update"] = 17] = "Update"; + OperatorPrecedence2[OperatorPrecedence2["LeftHandSide"] = 18] = "LeftHandSide"; + OperatorPrecedence2[OperatorPrecedence2["Member"] = 19] = "Member"; + OperatorPrecedence2[OperatorPrecedence2["Primary"] = 20] = "Primary"; + OperatorPrecedence2[OperatorPrecedence2["Highest"] = 20] = "Highest"; + OperatorPrecedence2[OperatorPrecedence2["Lowest"] = 0] = "Lowest"; + OperatorPrecedence2[OperatorPrecedence2["Invalid"] = -1] = "Invalid"; + })(OperatorPrecedence = ts6.OperatorPrecedence || (ts6.OperatorPrecedence = {})); + function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { + switch (nodeKind) { + case 354: + return 0; + case 227: + return 1; + case 226: + return 2; + case 224: + return 4; + case 223: + switch (operatorKind) { + case 27: + return 0; + case 63: + case 64: + case 65: + case 67: + case 66: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 78: + case 74: + case 75: + case 76: + case 77: + return 3; + default: + return getBinaryOperatorPrecedence(operatorKind); + } + case 213: + case 232: + case 221: + case 218: + case 219: + case 217: + case 220: + return 16; + case 222: + return 17; + case 210: + return 18; + case 211: + return hasArguments ? 19 : 18; + case 212: + case 208: + case 209: + case 233: + return 19; + case 231: + case 235: + return 11; + case 108: + case 106: + case 79: + case 80: + case 104: + case 110: + case 95: + case 8: + case 9: + case 10: + case 206: + case 207: + case 215: + case 216: + case 228: + case 13: + case 14: + case 225: + case 214: + case 229: + case 281: + case 282: + case 285: + return 20; + default: + return -1; + } + } + ts6.getOperatorPrecedence = getOperatorPrecedence; + function getBinaryOperatorPrecedence(kind) { + switch (kind) { + case 60: + return 4; + case 56: + return 5; + case 55: + return 6; + case 51: + return 7; + case 52: + return 8; + case 50: + return 9; + case 34: + case 35: + case 36: + case 37: + return 10; + case 29: + case 31: + case 32: + case 33: + case 102: + case 101: + case 128: + case 150: + return 11; + case 47: + case 48: + case 49: + return 12; + case 39: + case 40: + return 13; + case 41: + case 43: + case 44: + return 14; + case 42: + return 15; + } + return -1; + } + ts6.getBinaryOperatorPrecedence = getBinaryOperatorPrecedence; + function getSemanticJsxChildren(children) { + return ts6.filter(children, function(i) { + switch (i.kind) { + case 291: + return !!i.expression; + case 11: + return !i.containsOnlyTriviaWhiteSpaces; + default: + return true; + } + }); + } + ts6.getSemanticJsxChildren = getSemanticJsxChildren; + function createDiagnosticCollection() { + var nonFileDiagnostics = []; + var filesWithDiagnostics = []; + var fileDiagnostics = new ts6.Map(); + var hasReadNonFileDiagnostics = false; + return { + add, + lookup, + getGlobalDiagnostics, + getDiagnostics + }; + function lookup(diagnostic) { + var diagnostics; + if (diagnostic.file) { + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); + } else { + diagnostics = nonFileDiagnostics; + } + if (!diagnostics) { + return void 0; + } + var result = ts6.binarySearch(diagnostics, diagnostic, ts6.identity, compareDiagnosticsSkipRelatedInformation); + if (result >= 0) { + return diagnostics[result]; + } + return void 0; + } + function add(diagnostic) { + var diagnostics; + if (diagnostic.file) { + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); + if (!diagnostics) { + diagnostics = []; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); + ts6.insertSorted(filesWithDiagnostics, diagnostic.file.fileName, ts6.compareStringsCaseSensitive); + } + } else { + if (hasReadNonFileDiagnostics) { + hasReadNonFileDiagnostics = false; + nonFileDiagnostics = nonFileDiagnostics.slice(); + } + diagnostics = nonFileDiagnostics; + } + ts6.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); + } + function getGlobalDiagnostics() { + hasReadNonFileDiagnostics = true; + return nonFileDiagnostics; + } + function getDiagnostics(fileName) { + if (fileName) { + return fileDiagnostics.get(fileName) || []; + } + var fileDiags = ts6.flatMapToMutable(filesWithDiagnostics, function(f) { + return fileDiagnostics.get(f); + }); + if (!nonFileDiagnostics.length) { + return fileDiags; + } + fileDiags.unshift.apply(fileDiags, nonFileDiagnostics); + return fileDiags; + } + } + ts6.createDiagnosticCollection = createDiagnosticCollection; + var templateSubstitutionRegExp = /\$\{/g; + function escapeTemplateSubstitution(str) { + return str.replace(templateSubstitutionRegExp, "\\${"); + } + function hasInvalidEscape(template) { + return template && !!(ts6.isNoSubstitutionTemplateLiteral(template) ? template.templateFlags : template.head.templateFlags || ts6.some(template.templateSpans, function(span) { + return !!span.literal.templateFlags; + })); + } + ts6.hasInvalidEscape = hasInvalidEscape; + var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var backtickQuoteEscapedCharsRegExp = /\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g; + var escapedCharsMap = new ts6.Map(ts6.getEntries({ + " ": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + '"': '\\"', + "'": "\\'", + "`": "\\`", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\x85": "\\u0085", + "\r\n": "\\r\\n" + // special case for CRLFs in backticks + })); + function encodeUtf16EscapeSequence(charCode) { + var hexCharCode = charCode.toString(16).toUpperCase(); + var paddedHexCode = ("0000" + hexCharCode).slice(-4); + return "\\u" + paddedHexCode; + } + function getReplacement(c, offset, input) { + if (c.charCodeAt(0) === 0) { + var lookAhead = input.charCodeAt(offset + c.length); + if (lookAhead >= 48 && lookAhead <= 57) { + return "\\x00"; + } + return "\\0"; + } + return escapedCharsMap.get(c) || encodeUtf16EscapeSequence(c.charCodeAt(0)); + } + function escapeString(s, quoteChar) { + var escapedCharsRegExp = quoteChar === 96 ? backtickQuoteEscapedCharsRegExp : quoteChar === 39 ? singleQuoteEscapedCharsRegExp : doubleQuoteEscapedCharsRegExp; + return s.replace(escapedCharsRegExp, getReplacement); + } + ts6.escapeString = escapeString; + var nonAsciiCharacters = /[^\u0000-\u007F]/g; + function escapeNonAsciiString(s, quoteChar) { + s = escapeString(s, quoteChar); + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function(c) { + return encodeUtf16EscapeSequence(c.charCodeAt(0)); + }) : s; + } + ts6.escapeNonAsciiString = escapeNonAsciiString; + var jsxDoubleQuoteEscapedCharsRegExp = /[\"\u0000-\u001f\u2028\u2029\u0085]/g; + var jsxSingleQuoteEscapedCharsRegExp = /[\'\u0000-\u001f\u2028\u2029\u0085]/g; + var jsxEscapedCharsMap = new ts6.Map(ts6.getEntries({ + '"': """, + "'": "'" + })); + function encodeJsxCharacterEntity(charCode) { + var hexCharCode = charCode.toString(16).toUpperCase(); + return "&#x" + hexCharCode + ";"; + } + function getJsxAttributeStringReplacement(c) { + if (c.charCodeAt(0) === 0) { + return "�"; + } + return jsxEscapedCharsMap.get(c) || encodeJsxCharacterEntity(c.charCodeAt(0)); + } + function escapeJsxAttributeString(s, quoteChar) { + var escapedCharsRegExp = quoteChar === 39 ? jsxSingleQuoteEscapedCharsRegExp : jsxDoubleQuoteEscapedCharsRegExp; + return s.replace(escapedCharsRegExp, getJsxAttributeStringReplacement); + } + ts6.escapeJsxAttributeString = escapeJsxAttributeString; + function stripQuotes(name) { + var length = name.length; + if (length >= 2 && name.charCodeAt(0) === name.charCodeAt(length - 1) && isQuoteOrBacktick(name.charCodeAt(0))) { + return name.substring(1, length - 1); + } + return name; + } + ts6.stripQuotes = stripQuotes; + function isQuoteOrBacktick(charCode) { + return charCode === 39 || charCode === 34 || charCode === 96; + } + function isIntrinsicJsxName(name) { + var ch = name.charCodeAt(0); + return ch >= 97 && ch <= 122 || ts6.stringContains(name, "-") || ts6.stringContains(name, ":"); + } + ts6.isIntrinsicJsxName = isIntrinsicJsxName; + var indentStrings = ["", " "]; + function getIndentString(level) { + var singleLevel = indentStrings[1]; + for (var current = indentStrings.length; current <= level; current++) { + indentStrings.push(indentStrings[current - 1] + singleLevel); + } + return indentStrings[level]; + } + ts6.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; + } + ts6.getIndentSize = getIndentSize; + function isNightly() { + return ts6.stringContains(ts6.version, "-dev") || ts6.stringContains(ts6.version, "-insiders"); + } + ts6.isNightly = isNightly; + function createTextWriter(newLine) { + var output; + var indent; + var lineStart; + var lineCount; + var linePos; + var hasTrailingComment = false; + function updateLineCountAndPosFor(s) { + var lineStartsOfS = ts6.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + ts6.last(lineStartsOfS); + lineStart = linePos - output.length === 0; + } else { + lineStart = false; + } + } + function writeText(s) { + if (s && s.length) { + if (lineStart) { + s = getIndentString(indent) + s; + lineStart = false; + } + output += s; + updateLineCountAndPosFor(s); + } + } + function write(s) { + if (s) + hasTrailingComment = false; + writeText(s); + } + function writeComment(s) { + if (s) + hasTrailingComment = true; + writeText(s); + } + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; + hasTrailingComment = false; + } + function rawWrite(s) { + if (s !== void 0) { + output += s; + updateLineCountAndPosFor(s); + hasTrailingComment = false; + } + } + function writeLiteral(s) { + if (s && s.length) { + write(s); + } + } + function writeLine(force) { + if (!lineStart || force) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; + hasTrailingComment = false; + } + } + function getTextPosWithWriteLine() { + return lineStart ? output.length : output.length + newLine.length; + } + reset(); + return { + write, + rawWrite, + writeLiteral, + writeLine, + increaseIndent: function() { + indent++; + }, + decreaseIndent: function() { + indent--; + }, + getIndent: function() { + return indent; + }, + getTextPos: function() { + return output.length; + }, + getLine: function() { + return lineCount; + }, + getColumn: function() { + return lineStart ? indent * getIndentSize() : output.length - linePos; + }, + getText: function() { + return output; + }, + isAtStartOfLine: function() { + return lineStart; + }, + hasTrailingComment: function() { + return hasTrailingComment; + }, + hasTrailingWhitespace: function() { + return !!output.length && ts6.isWhiteSpaceLike(output.charCodeAt(output.length - 1)); + }, + clear: reset, + reportInaccessibleThisError: ts6.noop, + reportPrivateInBaseOfClassExpression: ts6.noop, + reportInaccessibleUniqueSymbolError: ts6.noop, + trackSymbol: function() { + return false; + }, + writeKeyword: write, + writeOperator: write, + writeParameter: write, + writeProperty: write, + writePunctuation: write, + writeSpace: write, + writeStringLiteral: write, + writeSymbol: function(s, _) { + return write(s); + }, + writeTrailingSemicolon: write, + writeComment, + getTextPosWithWriteLine + }; + } + ts6.createTextWriter = createTextWriter; + function getTrailingSemicolonDeferringWriter(writer) { + var pendingTrailingSemicolon = false; + function commitPendingTrailingSemicolon() { + if (pendingTrailingSemicolon) { + writer.writeTrailingSemicolon(";"); + pendingTrailingSemicolon = false; + } + } + return __assign(__assign({}, writer), { writeTrailingSemicolon: function() { + pendingTrailingSemicolon = true; + }, writeLiteral: function(s) { + commitPendingTrailingSemicolon(); + writer.writeLiteral(s); + }, writeStringLiteral: function(s) { + commitPendingTrailingSemicolon(); + writer.writeStringLiteral(s); + }, writeSymbol: function(s, sym) { + commitPendingTrailingSemicolon(); + writer.writeSymbol(s, sym); + }, writePunctuation: function(s) { + commitPendingTrailingSemicolon(); + writer.writePunctuation(s); + }, writeKeyword: function(s) { + commitPendingTrailingSemicolon(); + writer.writeKeyword(s); + }, writeOperator: function(s) { + commitPendingTrailingSemicolon(); + writer.writeOperator(s); + }, writeParameter: function(s) { + commitPendingTrailingSemicolon(); + writer.writeParameter(s); + }, writeSpace: function(s) { + commitPendingTrailingSemicolon(); + writer.writeSpace(s); + }, writeProperty: function(s) { + commitPendingTrailingSemicolon(); + writer.writeProperty(s); + }, writeComment: function(s) { + commitPendingTrailingSemicolon(); + writer.writeComment(s); + }, writeLine: function() { + commitPendingTrailingSemicolon(); + writer.writeLine(); + }, increaseIndent: function() { + commitPendingTrailingSemicolon(); + writer.increaseIndent(); + }, decreaseIndent: function() { + commitPendingTrailingSemicolon(); + writer.decreaseIndent(); + } }); + } + ts6.getTrailingSemicolonDeferringWriter = getTrailingSemicolonDeferringWriter; + function hostUsesCaseSensitiveFileNames(host) { + return host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false; + } + ts6.hostUsesCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames; + function hostGetCanonicalFileName(host) { + return ts6.createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host)); + } + ts6.hostGetCanonicalFileName = hostGetCanonicalFileName; + function getResolvedExternalModuleName(host, file, referenceFile) { + return file.moduleName || getExternalModuleNameFromPath(host, file.fileName, referenceFile && referenceFile.fileName); + } + ts6.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getCanonicalAbsolutePath(host, path) { + return host.getCanonicalFileName(ts6.getNormalizedAbsolutePath(path, host.getCurrentDirectory())); + } + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || file.isDeclarationFile) { + return void 0; + } + var specifier = getExternalModuleName(declaration); + if (specifier && ts6.isStringLiteralLike(specifier) && !ts6.pathIsRelative(specifier.text) && getCanonicalAbsolutePath(host, file.path).indexOf(getCanonicalAbsolutePath(host, ts6.ensureTrailingDirectorySeparator(host.getCommonSourceDirectory()))) === -1) { + return void 0; + } + return getResolvedExternalModuleName(host, file); + } + ts6.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; + function getExternalModuleNameFromPath(host, fileName, referencePath) { + var getCanonicalFileName = function(f) { + return host.getCanonicalFileName(f); + }; + var dir = ts6.toPath(referencePath ? ts6.getDirectoryPath(referencePath) : host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts6.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts6.getRelativePathToDirectoryOrUrl( + dir, + filePath, + dir, + getCanonicalFileName, + /*isAbsolutePathAnUrl*/ + false + ); + var extensionless = removeFileExtension(relativePath); + return referencePath ? ts6.ensurePathIsNonModuleName(extensionless) : extensionless; + } + ts6.getExternalModuleNameFromPath = getExternalModuleNameFromPath; + function getOwnEmitOutputFilePath(fileName, host, extension) { + var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; + if (compilerOptions.outDir) { + emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(fileName, host, compilerOptions.outDir)); + } else { + emitOutputFilePathWithoutExtension = removeFileExtension(fileName); + } + return emitOutputFilePathWithoutExtension + extension; + } + ts6.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(fileName, host) { + return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), function(f) { + return host.getCanonicalFileName(f); + }); + } + ts6.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) { + var outputDir = options.declarationDir || options.outDir; + var path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName; + var declarationExtension = getDeclarationEmitExtensionForPath(path); + return removeFileExtension(path) + declarationExtension; + } + ts6.getDeclarationEmitOutputFilePathWorker = getDeclarationEmitOutputFilePathWorker; + function getDeclarationEmitExtensionForPath(path) { + return ts6.fileExtensionIsOneOf(path, [ + ".mjs", + ".mts" + /* Extension.Mts */ + ]) ? ".d.mts" : ts6.fileExtensionIsOneOf(path, [ + ".cjs", + ".cts" + /* Extension.Cts */ + ]) ? ".d.cts" : ts6.fileExtensionIsOneOf(path, [ + ".json" + /* Extension.Json */ + ]) ? ".json.d.ts" : ( + // Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well + ".d.ts" + ); + } + ts6.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath; + function getPossibleOriginalInputExtensionForExtension(path) { + return ts6.fileExtensionIsOneOf(path, [ + ".d.mts", + ".mjs", + ".mts" + /* Extension.Mts */ + ]) ? [ + ".mts", + ".mjs" + /* Extension.Mjs */ + ] : ts6.fileExtensionIsOneOf(path, [ + ".d.cts", + ".cjs", + ".cts" + /* Extension.Cts */ + ]) ? [ + ".cts", + ".cjs" + /* Extension.Cjs */ + ] : ts6.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [ + ".json" + /* Extension.Json */ + ] : [ + ".tsx", + ".ts", + ".jsx", + ".js" + /* Extension.Js */ + ]; + } + ts6.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension; + function outFile(options) { + return options.outFile || options.out; + } + ts6.outFile = outFile; + function getPathsBasePath(options, host) { + var _a, _b; + if (!options.paths) + return void 0; + return (_a = options.baseUrl) !== null && _a !== void 0 ? _a : ts6.Debug.checkDefined(options.pathsBasePath || ((_b = host.getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(host)), "Encountered 'paths' without a 'baseUrl', config file, or host 'getCurrentDirectory'."); + } + ts6.getPathsBasePath = getPathsBasePath; + function getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit) { + var options = host.getCompilerOptions(); + if (outFile(options)) { + var moduleKind = getEmitModuleKind(options); + var moduleEmitEnabled_1 = options.emitDeclarationOnly || moduleKind === ts6.ModuleKind.AMD || moduleKind === ts6.ModuleKind.System; + return ts6.filter(host.getSourceFiles(), function(sourceFile) { + return (moduleEmitEnabled_1 || !ts6.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit); + }); + } else { + var sourceFiles = targetSourceFile === void 0 ? host.getSourceFiles() : [targetSourceFile]; + return ts6.filter(sourceFiles, function(sourceFile) { + return sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit); + }); + } + } + ts6.getSourceFilesToEmit = getSourceFilesToEmit; + function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) { + var options = host.getCompilerOptions(); + return !(options.noEmitForJsFiles && isSourceFileJS(sourceFile)) && !sourceFile.isDeclarationFile && !host.isSourceFileFromExternalLibrary(sourceFile) && (forceDtsEmit || !(isJsonSourceFile(sourceFile) && host.getResolvedProjectReferenceToRedirect(sourceFile.fileName)) && !host.isSourceOfProjectReferenceRedirect(sourceFile.fileName)); + } + ts6.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function getSourceFilePathInNewDir(fileName, host, newDirPath) { + return getSourceFilePathInNewDirWorker(fileName, newDirPath, host.getCurrentDirectory(), host.getCommonSourceDirectory(), function(f) { + return host.getCanonicalFileName(f); + }); + } + ts6.getSourceFilePathInNewDir = getSourceFilePathInNewDir; + function getSourceFilePathInNewDirWorker(fileName, newDirPath, currentDirectory, commonSourceDirectory, getCanonicalFileName) { + var sourceFilePath = ts6.getNormalizedAbsolutePath(fileName, currentDirectory); + var isSourceFileInCommonSourceDirectory = getCanonicalFileName(sourceFilePath).indexOf(getCanonicalFileName(commonSourceDirectory)) === 0; + sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath; + return ts6.combinePaths(newDirPath, sourceFilePath); + } + ts6.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker; + function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) { + host.writeFile(fileName, text, writeByteOrderMark, function(hostErrorMessage) { + diagnostics.add(createCompilerDiagnostic(ts6.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles, data); + } + ts6.writeFile = writeFile; + function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) { + if (directoryPath.length > ts6.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts6.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory, createDirectory, directoryExists); + createDirectory(directoryPath); + } + } + function writeFileEnsuringDirectories(path, data, writeByteOrderMark, writeFile2, createDirectory, directoryExists) { + try { + writeFile2(path, data, writeByteOrderMark); + } catch (_a) { + ensureDirectoriesExist(ts6.getDirectoryPath(ts6.normalizePath(path)), createDirectory, directoryExists); + writeFile2(path, data, writeByteOrderMark); + } + } + ts6.writeFileEnsuringDirectories = writeFileEnsuringDirectories; + function getLineOfLocalPosition(sourceFile, pos) { + var lineStarts = ts6.getLineStarts(sourceFile); + return ts6.computeLineOfPosition(lineStarts, pos); + } + ts6.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts6.computeLineOfPosition(lineMap, pos); + } + ts6.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; + function getFirstConstructorWithBody(node) { + return ts6.find(node.members, function(member) { + return ts6.isConstructorDeclaration(member) && nodeIsPresent(member.body); + }); + } + ts6.getFirstConstructorWithBody = getFirstConstructorWithBody; + function getSetAccessorValueParameter(accessor) { + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]); + return accessor.parameters[hasThis ? 1 : 0]; + } + } + ts6.getSetAccessorValueParameter = getSetAccessorValueParameter; + function getSetAccessorTypeAnnotationNode(accessor) { + var parameter = getSetAccessorValueParameter(accessor); + return parameter && parameter.type; + } + ts6.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; + function getThisParameter(signature) { + if (signature.parameters.length && !ts6.isJSDocSignature(signature)) { + var thisParameter = signature.parameters[0]; + if (parameterIsThisKeyword(thisParameter)) { + return thisParameter; + } + } + } + ts6.getThisParameter = getThisParameter; + function parameterIsThisKeyword(parameter) { + return isThisIdentifier(parameter.name); + } + ts6.parameterIsThisKeyword = parameterIsThisKeyword; + function isThisIdentifier(node) { + return !!node && node.kind === 79 && identifierIsThisKeyword(node); + } + ts6.isThisIdentifier = isThisIdentifier; + function isThisInTypeQuery(node) { + if (!isThisIdentifier(node)) { + return false; + } + while (ts6.isQualifiedName(node.parent) && node.parent.left === node) { + node = node.parent; + } + return node.parent.kind === 183; + } + ts6.isThisInTypeQuery = isThisInTypeQuery; + function identifierIsThisKeyword(id) { + return id.originalKeywordKind === 108; + } + ts6.identifierIsThisKeyword = identifierIsThisKeyword; + function getAllAccessorDeclarations(declarations, accessor) { + var firstAccessor; + var secondAccessor; + var getAccessor; + var setAccessor; + if (hasDynamicName(accessor)) { + firstAccessor = accessor; + if (accessor.kind === 174) { + getAccessor = accessor; + } else if (accessor.kind === 175) { + setAccessor = accessor; + } else { + ts6.Debug.fail("Accessor has wrong kind"); + } + } else { + ts6.forEach(declarations, function(member) { + if (ts6.isAccessor(member) && isStatic(member) === isStatic(accessor)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } else if (!secondAccessor) { + secondAccessor = member; + } + if (member.kind === 174 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 175 && !setAccessor) { + setAccessor = member; + } + } + } + }); + } + return { + firstAccessor, + secondAccessor, + getAccessor, + setAccessor + }; + } + ts6.getAllAccessorDeclarations = getAllAccessorDeclarations; + function getEffectiveTypeAnnotationNode(node) { + if (!isInJSFile(node) && ts6.isFunctionDeclaration(node)) + return void 0; + var type = node.type; + if (type || !isInJSFile(node)) + return type; + return ts6.isJSDocPropertyLikeTag(node) ? node.typeExpression && node.typeExpression.type : ts6.getJSDocType(node); + } + ts6.getEffectiveTypeAnnotationNode = getEffectiveTypeAnnotationNode; + function getTypeAnnotationNode(node) { + return node.type; + } + ts6.getTypeAnnotationNode = getTypeAnnotationNode; + function getEffectiveReturnTypeNode(node) { + return ts6.isJSDocSignature(node) ? node.type && node.type.typeExpression && node.type.typeExpression.type : node.type || (isInJSFile(node) ? ts6.getJSDocReturnType(node) : void 0); + } + ts6.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode; + function getJSDocTypeParameterDeclarations(node) { + return ts6.flatMap(ts6.getJSDocTags(node), function(tag) { + return isNonTypeAliasTemplate(tag) ? tag.typeParameters : void 0; + }); + } + ts6.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; + function isNonTypeAliasTemplate(tag) { + return ts6.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 && tag.parent.tags.some(isJSDocTypeAlias)); + } + function getEffectiveSetAccessorTypeAnnotationNode(node) { + var parameter = getSetAccessorValueParameter(node); + return parameter && getEffectiveTypeAnnotationNode(parameter); + } + ts6.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode; + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { + emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments); + } + ts6.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; + function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) { + if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos && getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { + writer.writeLine(); + } + } + ts6.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition; + function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) { + if (pos !== commentPos && getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) { + writer.writeLine(); + } + } + ts6.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition; + function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) { + if (comments && comments.length > 0) { + if (leadingSeparator) { + writer.writeSpace(" "); + } + var emitInterveningSeparator = false; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + if (emitInterveningSeparator) { + writer.writeSpace(" "); + emitInterveningSeparator = false; + } + writeComment(text, lineMap, writer, comment.pos, comment.end, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } else { + emitInterveningSeparator = true; + } + } + if (emitInterveningSeparator && trailingSeparator) { + writer.writeSpace(" "); + } + } + } + ts6.emitComments = emitComments; + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + if (node.pos === 0) { + leadingComments = ts6.filter(ts6.getLeadingCommentRanges(text, node.pos), isPinnedCommentLocal); + } + } else { + leadingComments = ts6.getLeadingCommentRanges(text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment = void 0; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); + if (commentLine >= lastCommentLine + 2) { + break; + } + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts6.last(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts6.skipTrivia(text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments( + text, + lineMap, + writer, + detachedComments, + /*leadingSeparator*/ + false, + /*trailingSeparator*/ + true, + newLine, + writeComment + ); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts6.last(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedCommentLocal(comment2) { + return isPinnedComment(text, comment2.pos); + } + } + ts6.emitDetachedComments = emitDetachedComments; + function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) { + if (text.charCodeAt(commentPos + 1) === 42) { + var firstCommentLineAndCharacter = ts6.computeLineAndCharacterOfPosition(lineMap, commentPos); + var lineCount = lineMap.length; + var firstCommentLineIndent = void 0; + for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) { + var nextLineStart = currentLine + 1 === lineCount ? text.length + 1 : lineMap[currentLine + 1]; + if (pos !== commentPos) { + if (firstCommentLineIndent === void 0) { + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; + } + } else { + writer.rawWrite(""); + } + } + writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart); + pos = nextLineStart; + } + } else { + writer.writeComment(text.substring(commentPos, commentEnd)); + } + } + ts6.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) { + var end = Math.min(commentEnd, nextLineStart - 1); + var currentLineText = ts6.trimString(text.substring(pos, end)); + if (currentLineText) { + writer.writeComment(currentLineText); + if (end !== commentEnd) { + writer.writeLine(); + } + } else { + writer.rawWrite(newLine); + } + } + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts6.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9) { + currentLineIndent += getIndentSize() - currentLineIndent % getIndentSize(); + } else { + currentLineIndent++; + } + } + return currentLineIndent; + } + function hasEffectiveModifiers(node) { + return getEffectiveModifierFlags(node) !== 0; + } + ts6.hasEffectiveModifiers = hasEffectiveModifiers; + function hasSyntacticModifiers(node) { + return getSyntacticModifierFlags(node) !== 0; + } + ts6.hasSyntacticModifiers = hasSyntacticModifiers; + function hasEffectiveModifier(node, flags) { + return !!getSelectedEffectiveModifierFlags(node, flags); + } + ts6.hasEffectiveModifier = hasEffectiveModifier; + function hasSyntacticModifier(node, flags) { + return !!getSelectedSyntacticModifierFlags(node, flags); + } + ts6.hasSyntacticModifier = hasSyntacticModifier; + function isStatic(node) { + return ts6.isClassElement(node) && hasStaticModifier(node) || ts6.isClassStaticBlockDeclaration(node); + } + ts6.isStatic = isStatic; + function hasStaticModifier(node) { + return hasSyntacticModifier( + node, + 32 + /* ModifierFlags.Static */ + ); + } + ts6.hasStaticModifier = hasStaticModifier; + function hasOverrideModifier(node) { + return hasEffectiveModifier( + node, + 16384 + /* ModifierFlags.Override */ + ); + } + ts6.hasOverrideModifier = hasOverrideModifier; + function hasAbstractModifier(node) { + return hasSyntacticModifier( + node, + 256 + /* ModifierFlags.Abstract */ + ); + } + ts6.hasAbstractModifier = hasAbstractModifier; + function hasAmbientModifier(node) { + return hasSyntacticModifier( + node, + 2 + /* ModifierFlags.Ambient */ + ); + } + ts6.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier( + node, + 128 + /* ModifierFlags.Accessor */ + ); + } + ts6.hasAccessorModifier = hasAccessorModifier; + function hasEffectiveReadonlyModifier(node) { + return hasEffectiveModifier( + node, + 64 + /* ModifierFlags.Readonly */ + ); + } + ts6.hasEffectiveReadonlyModifier = hasEffectiveReadonlyModifier; + function hasDecorators(node) { + return hasSyntacticModifier( + node, + 131072 + /* ModifierFlags.Decorator */ + ); + } + ts6.hasDecorators = hasDecorators; + function getSelectedEffectiveModifierFlags(node, flags) { + return getEffectiveModifierFlags(node) & flags; + } + ts6.getSelectedEffectiveModifierFlags = getSelectedEffectiveModifierFlags; + function getSelectedSyntacticModifierFlags(node, flags) { + return getSyntacticModifierFlags(node) & flags; + } + ts6.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; + function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { + if (node.kind >= 0 && node.kind <= 162) { + return 0; + } + if (!(node.modifierFlagsCache & 536870912)) { + node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | 536870912; + } + if (includeJSDoc && !(node.modifierFlagsCache & 4096) && (alwaysIncludeJSDoc || isInJSFile(node)) && node.parent) { + node.modifierFlagsCache |= getJSDocModifierFlagsNoCache(node) | 4096; + } + return node.modifierFlagsCache & ~(536870912 | 4096); + } + function getEffectiveModifierFlags(node) { + return getModifierFlagsWorker( + node, + /*includeJSDoc*/ + true + ); + } + ts6.getEffectiveModifierFlags = getEffectiveModifierFlags; + function getEffectiveModifierFlagsAlwaysIncludeJSDoc(node) { + return getModifierFlagsWorker( + node, + /*includeJSDOc*/ + true, + /*alwaysIncludeJSDOc*/ + true + ); + } + ts6.getEffectiveModifierFlagsAlwaysIncludeJSDoc = getEffectiveModifierFlagsAlwaysIncludeJSDoc; + function getSyntacticModifierFlags(node) { + return getModifierFlagsWorker( + node, + /*includeJSDoc*/ + false + ); + } + ts6.getSyntacticModifierFlags = getSyntacticModifierFlags; + function getJSDocModifierFlagsNoCache(node) { + var flags = 0; + if (!!node.parent && !ts6.isParameter(node)) { + if (isInJSFile(node)) { + if (ts6.getJSDocPublicTagNoCache(node)) + flags |= 4; + if (ts6.getJSDocPrivateTagNoCache(node)) + flags |= 8; + if (ts6.getJSDocProtectedTagNoCache(node)) + flags |= 16; + if (ts6.getJSDocReadonlyTagNoCache(node)) + flags |= 64; + if (ts6.getJSDocOverrideTagNoCache(node)) + flags |= 16384; + } + if (ts6.getJSDocDeprecatedTagNoCache(node)) + flags |= 8192; + } + return flags; + } + function getEffectiveModifierFlagsNoCache(node) { + return getSyntacticModifierFlagsNoCache(node) | getJSDocModifierFlagsNoCache(node); + } + ts6.getEffectiveModifierFlagsNoCache = getEffectiveModifierFlagsNoCache; + function getSyntacticModifierFlagsNoCache(node) { + var flags = ts6.canHaveModifiers(node) ? modifiersToFlags(node.modifiers) : 0; + if (node.flags & 4 || node.kind === 79 && node.isInJSDocNamespace) { + flags |= 1; + } + return flags; + } + ts6.getSyntacticModifierFlagsNoCache = getSyntacticModifierFlagsNoCache; + function modifiersToFlags(modifiers) { + var flags = 0; + if (modifiers) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + flags |= modifierToFlag(modifier.kind); + } + } + return flags; + } + ts6.modifiersToFlags = modifiersToFlags; + function modifierToFlag(token) { + switch (token) { + case 124: + return 32; + case 123: + return 4; + case 122: + return 16; + case 121: + return 8; + case 126: + return 256; + case 127: + return 128; + case 93: + return 1; + case 136: + return 2; + case 85: + return 2048; + case 88: + return 1024; + case 132: + return 512; + case 146: + return 64; + case 161: + return 16384; + case 101: + return 32768; + case 145: + return 65536; + case 167: + return 131072; + } + return 0; + } + ts6.modifierToFlag = modifierToFlag; + function isLogicalOperator(token) { + return token === 56 || token === 55 || token === 53; + } + ts6.isLogicalOperator = isLogicalOperator; + function isLogicalOrCoalescingAssignmentOperator(token) { + return token === 75 || token === 76 || token === 77; + } + ts6.isLogicalOrCoalescingAssignmentOperator = isLogicalOrCoalescingAssignmentOperator; + function isLogicalOrCoalescingAssignmentExpression(expr) { + return isLogicalOrCoalescingAssignmentOperator(expr.operatorToken.kind); + } + ts6.isLogicalOrCoalescingAssignmentExpression = isLogicalOrCoalescingAssignmentExpression; + function isAssignmentOperator(token) { + return token >= 63 && token <= 78; + } + ts6.isAssignmentOperator = isAssignmentOperator; + function tryGetClassExtendingExpressionWithTypeArguments(node) { + var cls = tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node); + return cls && !cls.isImplements ? cls.class : void 0; + } + ts6.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; + function tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node) { + return ts6.isExpressionWithTypeArguments(node) && ts6.isHeritageClause(node.parent) && ts6.isClassLike(node.parent.parent) ? { + class: node.parent.parent, + isImplements: node.parent.token === 117 + /* SyntaxKind.ImplementsKeyword */ + } : void 0; + } + ts6.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments; + function isAssignmentExpression(node, excludeCompoundAssignment) { + return ts6.isBinaryExpression(node) && (excludeCompoundAssignment ? node.operatorToken.kind === 63 : isAssignmentOperator(node.operatorToken.kind)) && ts6.isLeftHandSideExpression(node.left); + } + ts6.isAssignmentExpression = isAssignmentExpression; + function isLeftHandSideOfAssignment(node) { + return isAssignmentExpression(node.parent) && node.parent.left === node; + } + ts6.isLeftHandSideOfAssignment = isLeftHandSideOfAssignment; + function isDestructuringAssignment(node) { + if (isAssignmentExpression( + node, + /*excludeCompoundAssignment*/ + true + )) { + var kind = node.left.kind; + return kind === 207 || kind === 206; + } + return false; + } + ts6.isDestructuringAssignment = isDestructuringAssignment; + function isExpressionWithTypeArgumentsInClassExtendsClause(node) { + return tryGetClassExtendingExpressionWithTypeArguments(node) !== void 0; + } + ts6.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isEntityNameExpression(node) { + return node.kind === 79 || isPropertyAccessEntityNameExpression(node); + } + ts6.isEntityNameExpression = isEntityNameExpression; + function getFirstIdentifier(node) { + switch (node.kind) { + case 79: + return node; + case 163: + do { + node = node.left; + } while (node.kind !== 79); + return node; + case 208: + do { + node = node.expression; + } while (node.kind !== 79); + return node; + } + } + ts6.getFirstIdentifier = getFirstIdentifier; + function isDottedName(node) { + return node.kind === 79 || node.kind === 108 || node.kind === 106 || node.kind === 233 || node.kind === 208 && isDottedName(node.expression) || node.kind === 214 && isDottedName(node.expression); + } + ts6.isDottedName = isDottedName; + function isPropertyAccessEntityNameExpression(node) { + return ts6.isPropertyAccessExpression(node) && ts6.isIdentifier(node.name) && isEntityNameExpression(node.expression); + } + ts6.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression; + function tryGetPropertyAccessOrIdentifierToString(expr) { + if (ts6.isPropertyAccessExpression(expr)) { + var baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression); + if (baseStr !== void 0) { + return baseStr + "." + entityNameToString(expr.name); + } + } else if (ts6.isElementAccessExpression(expr)) { + var baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression); + if (baseStr !== void 0 && ts6.isPropertyName(expr.argumentExpression)) { + return baseStr + "." + getPropertyNameForPropertyNameNode(expr.argumentExpression); + } + } else if (ts6.isIdentifier(expr)) { + return ts6.unescapeLeadingUnderscores(expr.escapedText); + } + return void 0; + } + ts6.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString; + function isPrototypeAccess(node) { + return isBindableStaticAccessExpression(node) && getElementOrPropertyAccessName(node) === "prototype"; + } + ts6.isPrototypeAccess = isPrototypeAccess; + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return node.parent.kind === 163 && node.parent.right === node || node.parent.kind === 208 && node.parent.name === node; + } + ts6.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isRightSideOfAccessExpression(node) { + return ts6.isPropertyAccessExpression(node.parent) && node.parent.name === node || ts6.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node; + } + ts6.isRightSideOfAccessExpression = isRightSideOfAccessExpression; + function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) { + return ts6.isQualifiedName(node.parent) && node.parent.right === node || ts6.isPropertyAccessExpression(node.parent) && node.parent.name === node || ts6.isJSDocMemberName(node.parent) && node.parent.right === node; + } + ts6.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; + function isEmptyObjectLiteral(expression) { + return expression.kind === 207 && expression.properties.length === 0; + } + ts6.isEmptyObjectLiteral = isEmptyObjectLiteral; + function isEmptyArrayLiteral(expression) { + return expression.kind === 206 && expression.elements.length === 0; + } + ts6.isEmptyArrayLiteral = isEmptyArrayLiteral; + function getLocalSymbolForExportDefault(symbol) { + if (!isExportDefaultSymbol(symbol) || !symbol.declarations) + return void 0; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.localSymbol) + return decl.localSymbol; + } + return void 0; + } + ts6.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && ts6.length(symbol.declarations) > 0 && hasSyntacticModifier( + symbol.declarations[0], + 1024 + /* ModifierFlags.Default */ + ); + } + function tryExtractTSExtension(fileName) { + return ts6.find(supportedTSExtensionsForExtractExtension, function(extension) { + return ts6.fileExtensionIs(fileName, extension); + }); + } + ts6.tryExtractTSExtension = tryExtractTSExtension; + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + if (charCode < 128) { + output.push(charCode); + } else if (charCode < 2048) { + output.push(charCode >> 6 | 192); + output.push(charCode & 63 | 128); + } else if (charCode < 65536) { + output.push(charCode >> 12 | 224); + output.push(charCode >> 6 & 63 | 128); + output.push(charCode & 63 | 128); + } else if (charCode < 131072) { + output.push(charCode >> 18 | 240); + output.push(charCode >> 12 & 63 | 128); + output.push(charCode >> 6 & 63 | 128); + output.push(charCode & 63 | 128); + } else { + ts6.Debug.assert(false, "Unexpected code point"); + } + } + return output; + } + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + byte1 = charCodes[i] >> 2; + byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; + byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; + byte4 = charCodes[i + 2] & 63; + if (i + 1 >= length) { + byte3 = byte4 = 64; + } else if (i + 2 >= length) { + byte4 = 64; + } + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; + } + return result; + } + ts6.convertToBase64 = convertToBase64; + function getStringFromExpandedCharCodes(codes) { + var output = ""; + var i = 0; + var length = codes.length; + while (i < length) { + var charCode = codes[i]; + if (charCode < 128) { + output += String.fromCharCode(charCode); + i++; + } else if ((charCode & 192) === 192) { + var value = charCode & 63; + i++; + var nextCode = codes[i]; + while ((nextCode & 192) === 128) { + value = value << 6 | nextCode & 63; + i++; + nextCode = codes[i]; + } + output += String.fromCharCode(value); + } else { + output += String.fromCharCode(charCode); + i++; + } + } + return output; + } + function base64encode(host, input) { + if (host && host.base64encode) { + return host.base64encode(input); + } + return convertToBase64(input); + } + ts6.base64encode = base64encode; + function base64decode(host, input) { + if (host && host.base64decode) { + return host.base64decode(input); + } + var length = input.length; + var expandedCharCodes = []; + var i = 0; + while (i < length) { + if (input.charCodeAt(i) === base64Digits.charCodeAt(64)) { + break; + } + var ch1 = base64Digits.indexOf(input[i]); + var ch2 = base64Digits.indexOf(input[i + 1]); + var ch3 = base64Digits.indexOf(input[i + 2]); + var ch4 = base64Digits.indexOf(input[i + 3]); + var code1 = (ch1 & 63) << 2 | ch2 >> 4 & 3; + var code2 = (ch2 & 15) << 4 | ch3 >> 2 & 15; + var code3 = (ch3 & 3) << 6 | ch4 & 63; + if (code2 === 0 && ch3 !== 0) { + expandedCharCodes.push(code1); + } else if (code3 === 0 && ch4 !== 0) { + expandedCharCodes.push(code1, code2); + } else { + expandedCharCodes.push(code1, code2, code3); + } + i += 4; + } + return getStringFromExpandedCharCodes(expandedCharCodes); + } + ts6.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts6.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return void 0; + var result = ts6.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : void 0; + } + ts6.readJsonOrUndefined = readJsonOrUndefined; + function readJson(path, host) { + return readJsonOrUndefined(path, host) || {}; + } + ts6.readJson = readJson; + function directoryProbablyExists(directoryName, host) { + return !host.directoryExists || host.directoryExists(directoryName); + } + ts6.directoryProbablyExists = directoryProbablyExists; + var carriageReturnLineFeed = "\r\n"; + var lineFeed = "\n"; + function getNewLineCharacter(options, getNewLine) { + switch (options.newLine) { + case 0: + return carriageReturnLineFeed; + case 1: + return lineFeed; + } + return getNewLine ? getNewLine() : ts6.sys ? ts6.sys.newLine : carriageReturnLineFeed; + } + ts6.getNewLineCharacter = getNewLineCharacter; + function createRange(pos, end) { + if (end === void 0) { + end = pos; + } + ts6.Debug.assert(end >= pos || end === -1); + return { pos, end }; + } + ts6.createRange = createRange; + function moveRangeEnd(range2, end) { + return createRange(range2.pos, end); + } + ts6.moveRangeEnd = moveRangeEnd; + function moveRangePos(range2, pos) { + return createRange(pos, range2.end); + } + ts6.moveRangePos = moveRangePos; + function moveRangePastDecorators(node) { + var lastDecorator = ts6.canHaveModifiers(node) ? ts6.findLast(node.modifiers, ts6.isDecorator) : void 0; + return lastDecorator && !positionIsSynthesized(lastDecorator.end) ? moveRangePos(node, lastDecorator.end) : node; + } + ts6.moveRangePastDecorators = moveRangePastDecorators; + function moveRangePastModifiers(node) { + var lastModifier = ts6.canHaveModifiers(node) ? ts6.lastOrUndefined(node.modifiers) : void 0; + return lastModifier && !positionIsSynthesized(lastModifier.end) ? moveRangePos(node, lastModifier.end) : moveRangePastDecorators(node); + } + ts6.moveRangePastModifiers = moveRangePastModifiers; + function isCollapsedRange(range2) { + return range2.pos === range2.end; + } + ts6.isCollapsedRange = isCollapsedRange; + function createTokenRange(pos, token) { + return createRange(pos, pos + ts6.tokenToString(token).length); + } + ts6.createTokenRange = createTokenRange; + function rangeIsOnSingleLine(range2, sourceFile) { + return rangeStartIsOnSameLineAsRangeEnd(range2, range2, sourceFile); + } + ts6.rangeIsOnSingleLine = rangeIsOnSingleLine; + function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) { + return positionsAreOnSameLine(getStartPositionOfRange( + range1, + sourceFile, + /*includeComments*/ + false + ), getStartPositionOfRange( + range2, + sourceFile, + /*includeComments*/ + false + ), sourceFile); + } + ts6.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine; + function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) { + return positionsAreOnSameLine(range1.end, range2.end, sourceFile); + } + ts6.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine; + function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) { + return positionsAreOnSameLine(getStartPositionOfRange( + range1, + sourceFile, + /*includeComments*/ + false + ), range2.end, sourceFile); + } + ts6.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd; + function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) { + return positionsAreOnSameLine(range1.end, getStartPositionOfRange( + range2, + sourceFile, + /*includeComments*/ + false + ), sourceFile); + } + ts6.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart; + function getLinesBetweenRangeEndAndRangeStart(range1, range2, sourceFile, includeSecondRangeComments) { + var range2Start = getStartPositionOfRange(range2, sourceFile, includeSecondRangeComments); + return ts6.getLinesBetweenPositions(sourceFile, range1.end, range2Start); + } + ts6.getLinesBetweenRangeEndAndRangeStart = getLinesBetweenRangeEndAndRangeStart; + function getLinesBetweenRangeEndPositions(range1, range2, sourceFile) { + return ts6.getLinesBetweenPositions(sourceFile, range1.end, range2.end); + } + ts6.getLinesBetweenRangeEndPositions = getLinesBetweenRangeEndPositions; + function isNodeArrayMultiLine(list, sourceFile) { + return !positionsAreOnSameLine(list.pos, list.end, sourceFile); + } + ts6.isNodeArrayMultiLine = isNodeArrayMultiLine; + function positionsAreOnSameLine(pos1, pos2, sourceFile) { + return ts6.getLinesBetweenPositions(sourceFile, pos1, pos2) === 0; + } + ts6.positionsAreOnSameLine = positionsAreOnSameLine; + function getStartPositionOfRange(range2, sourceFile, includeComments) { + return positionIsSynthesized(range2.pos) ? -1 : ts6.skipTrivia( + sourceFile.text, + range2.pos, + /*stopAfterLineBreak*/ + false, + includeComments + ); + } + ts6.getStartPositionOfRange = getStartPositionOfRange; + function getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) { + var startPos = ts6.skipTrivia( + sourceFile.text, + pos, + /*stopAfterLineBreak*/ + false, + includeComments + ); + var prevPos = getPreviousNonWhitespacePosition(startPos, stopPos, sourceFile); + return ts6.getLinesBetweenPositions(sourceFile, prevPos !== null && prevPos !== void 0 ? prevPos : stopPos, startPos); + } + ts6.getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter = getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter; + function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) { + var nextPos = ts6.skipTrivia( + sourceFile.text, + pos, + /*stopAfterLineBreak*/ + false, + includeComments + ); + return ts6.getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos)); + } + ts6.getLinesBetweenPositionAndNextNonWhitespaceCharacter = getLinesBetweenPositionAndNextNonWhitespaceCharacter; + function getPreviousNonWhitespacePosition(pos, stopPos, sourceFile) { + if (stopPos === void 0) { + stopPos = 0; + } + while (pos-- > stopPos) { + if (!ts6.isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + function isDeclarationNameOfEnumOrNamespace(node) { + var parseNode = ts6.getParseTreeNode(node); + if (parseNode) { + switch (parseNode.parent.kind) { + case 263: + case 264: + return parseNode === parseNode.parent.name; + } + } + return false; + } + ts6.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace; + function getInitializedVariables(node) { + return ts6.filter(node.declarations, isInitializedVariable); + } + ts6.getInitializedVariables = getInitializedVariables; + function isInitializedVariable(node) { + return node.initializer !== void 0; + } + function isWatchSet(options) { + return options.watch && ts6.hasProperty(options, "watch"); + } + ts6.isWatchSet = isWatchSet; + function closeFileWatcher(watcher) { + watcher.close(); + } + ts6.closeFileWatcher = closeFileWatcher; + function getCheckFlags(symbol) { + return symbol.flags & 33554432 ? symbol.checkFlags : 0; + } + ts6.getCheckFlags = getCheckFlags; + function getDeclarationModifierFlagsFromSymbol(s, isWrite) { + if (isWrite === void 0) { + isWrite = false; + } + if (s.valueDeclaration) { + var declaration = isWrite && s.declarations && ts6.find(s.declarations, ts6.isSetAccessorDeclaration) || s.flags & 32768 && ts6.find(s.declarations, ts6.isGetAccessorDeclaration) || s.valueDeclaration; + var flags = ts6.getCombinedModifierFlags(declaration); + return s.parent && s.parent.flags & 32 ? flags : flags & ~28; + } + if (getCheckFlags(s) & 6) { + var checkFlags = s.checkFlags; + var accessModifier = checkFlags & 1024 ? 8 : checkFlags & 256 ? 4 : 16; + var staticModifier = checkFlags & 2048 ? 32 : 0; + return accessModifier | staticModifier; + } + if (s.flags & 4194304) { + return 4 | 32; + } + return 0; + } + ts6.getDeclarationModifierFlagsFromSymbol = getDeclarationModifierFlagsFromSymbol; + function skipAlias(symbol, checker) { + return symbol.flags & 2097152 ? checker.getAliasedSymbol(symbol) : symbol; + } + ts6.skipAlias = skipAlias; + function getCombinedLocalAndExportSymbolFlags(symbol) { + return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags; + } + ts6.getCombinedLocalAndExportSymbolFlags = getCombinedLocalAndExportSymbolFlags; + function isWriteOnlyAccess(node) { + return accessKind(node) === 1; + } + ts6.isWriteOnlyAccess = isWriteOnlyAccess; + function isWriteAccess(node) { + return accessKind(node) !== 0; + } + ts6.isWriteAccess = isWriteAccess; + var AccessKind; + (function(AccessKind2) { + AccessKind2[AccessKind2["Read"] = 0] = "Read"; + AccessKind2[AccessKind2["Write"] = 1] = "Write"; + AccessKind2[AccessKind2["ReadWrite"] = 2] = "ReadWrite"; + })(AccessKind || (AccessKind = {})); + function accessKind(node) { + var parent = node.parent; + if (!parent) + return 0; + switch (parent.kind) { + case 214: + return accessKind(parent); + case 222: + case 221: + var operator = parent.operator; + return operator === 45 || operator === 46 ? writeOrReadWrite() : 0; + case 223: + var _a = parent, left = _a.left, operatorToken = _a.operatorToken; + return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 ? 1 : writeOrReadWrite() : 0; + case 208: + return parent.name !== node ? 0 : accessKind(parent); + case 299: { + var parentAccess = accessKind(parent.parent); + return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; + } + case 300: + return node === parent.objectAssignmentInitializer ? 0 : accessKind(parent.parent); + case 206: + return accessKind(parent); + default: + return 0; + } + function writeOrReadWrite() { + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 ? 1 : 2; + } + } + function reverseAccessKind(a) { + switch (a) { + case 0: + return 1; + case 1: + return 0; + case 2: + return 2; + default: + return ts6.Debug.assertNever(a); + } + } + function compareDataObjects(dst, src) { + if (!dst || !src || Object.keys(dst).length !== Object.keys(src).length) { + return false; + } + for (var e in dst) { + if (typeof dst[e] === "object") { + if (!compareDataObjects(dst[e], src[e])) { + return false; + } + } else if (typeof dst[e] !== "function") { + if (dst[e] !== src[e]) { + return false; + } + } + } + return true; + } + ts6.compareDataObjects = compareDataObjects; + function clearMap(map, onDeleteValue) { + map.forEach(onDeleteValue); + map.clear(); + } + ts6.clearMap = clearMap; + function mutateMapSkippingNewValues(map, newMap, options) { + var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue; + map.forEach(function(existingValue, key) { + var valueInNewMap = newMap.get(key); + if (valueInNewMap === void 0) { + map.delete(key); + onDeleteValue(existingValue, key); + } else if (onExistingValue) { + onExistingValue(existingValue, valueInNewMap, key); + } + }); + } + ts6.mutateMapSkippingNewValues = mutateMapSkippingNewValues; + function mutateMap(map, newMap, options) { + mutateMapSkippingNewValues(map, newMap, options); + var createNewValue = options.createNewValue; + newMap.forEach(function(valueInNewMap, key) { + if (!map.has(key)) { + map.set(key, createNewValue(key, valueInNewMap)); + } + }); + } + ts6.mutateMap = mutateMap; + function isAbstractConstructorSymbol(symbol) { + if (symbol.flags & 32) { + var declaration = getClassLikeDeclarationOfSymbol(symbol); + return !!declaration && hasSyntacticModifier( + declaration, + 256 + /* ModifierFlags.Abstract */ + ); + } + return false; + } + ts6.isAbstractConstructorSymbol = isAbstractConstructorSymbol; + function getClassLikeDeclarationOfSymbol(symbol) { + var _a; + return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isClassLike); + } + ts6.getClassLikeDeclarationOfSymbol = getClassLikeDeclarationOfSymbol; + function getObjectFlags(type) { + return type.flags & 3899393 ? type.objectFlags : 0; + } + ts6.getObjectFlags = getObjectFlags; + function typeHasCallOrConstructSignatures(type, checker) { + return checker.getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ).length !== 0 || checker.getSignaturesOfType( + type, + 1 + /* SignatureKind.Construct */ + ).length !== 0; + } + ts6.typeHasCallOrConstructSignatures = typeHasCallOrConstructSignatures; + function forSomeAncestorDirectory(directory, callback) { + return !!ts6.forEachAncestorDirectory(directory, function(d) { + return callback(d) ? true : void 0; + }); + } + ts6.forSomeAncestorDirectory = forSomeAncestorDirectory; + function isUMDExportSymbol(symbol) { + return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && ts6.isNamespaceExportDeclaration(symbol.declarations[0]); + } + ts6.isUMDExportSymbol = isUMDExportSymbol; + function showModuleSpecifier(_a) { + var moduleSpecifier = _a.moduleSpecifier; + return ts6.isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : getTextOfNode(moduleSpecifier); + } + ts6.showModuleSpecifier = showModuleSpecifier; + function getLastChild(node) { + var lastChild; + ts6.forEachChild(node, function(child) { + if (nodeIsPresent(child)) + lastChild = child; + }, function(children) { + for (var i = children.length - 1; i >= 0; i--) { + if (nodeIsPresent(children[i])) { + lastChild = children[i]; + break; + } + } + }); + return lastChild; + } + ts6.getLastChild = getLastChild; + function addToSeen(seen, key, value) { + if (value === void 0) { + value = true; + } + if (seen.has(key)) { + return false; + } + seen.set(key, value); + return true; + } + ts6.addToSeen = addToSeen; + function isObjectTypeDeclaration(node) { + return ts6.isClassLike(node) || ts6.isInterfaceDeclaration(node) || ts6.isTypeLiteralNode(node); + } + ts6.isObjectTypeDeclaration = isObjectTypeDeclaration; + function isTypeNodeKind(kind) { + return kind >= 179 && kind <= 202 || kind === 131 || kind === 157 || kind === 148 || kind === 160 || kind === 149 || kind === 134 || kind === 152 || kind === 153 || kind === 114 || kind === 155 || kind === 144 || kind === 230 || kind === 315 || kind === 316 || kind === 317 || kind === 318 || kind === 319 || kind === 320 || kind === 321; + } + ts6.isTypeNodeKind = isTypeNodeKind; + function isAccessExpression(node) { + return node.kind === 208 || node.kind === 209; + } + ts6.isAccessExpression = isAccessExpression; + function getNameOfAccessExpression(node) { + if (node.kind === 208) { + return node.name; + } + ts6.Debug.assert( + node.kind === 209 + /* SyntaxKind.ElementAccessExpression */ + ); + return node.argumentExpression; + } + ts6.getNameOfAccessExpression = getNameOfAccessExpression; + function isBundleFileTextLike(section) { + switch (section.kind) { + case "text": + case "internal": + return true; + default: + return false; + } + } + ts6.isBundleFileTextLike = isBundleFileTextLike; + function isNamedImportsOrExports(node) { + return node.kind === 272 || node.kind === 276; + } + ts6.isNamedImportsOrExports = isNamedImportsOrExports; + function getLeftmostAccessExpression(expr) { + while (isAccessExpression(expr)) { + expr = expr.expression; + } + return expr; + } + ts6.getLeftmostAccessExpression = getLeftmostAccessExpression; + function forEachNameInAccessChainWalkingLeft(name, action) { + if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) { + return walkAccessExpression(name.parent); + } + function walkAccessExpression(access) { + if (access.kind === 208) { + var res = action(access.name); + if (res !== void 0) { + return res; + } + } else if (access.kind === 209) { + if (ts6.isIdentifier(access.argumentExpression) || ts6.isStringLiteralLike(access.argumentExpression)) { + var res = action(access.argumentExpression); + if (res !== void 0) { + return res; + } + } else { + return void 0; + } + } + if (isAccessExpression(access.expression)) { + return walkAccessExpression(access.expression); + } + if (ts6.isIdentifier(access.expression)) { + return action(access.expression); + } + return void 0; + } + } + ts6.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft; + function getLeftmostExpression(node, stopAtCallExpressions) { + while (true) { + switch (node.kind) { + case 222: + node = node.operand; + continue; + case 223: + node = node.left; + continue; + case 224: + node = node.condition; + continue; + case 212: + node = node.tag; + continue; + case 210: + if (stopAtCallExpressions) { + return node; + } + case 231: + case 209: + case 208: + case 232: + case 353: + case 235: + node = node.expression; + continue; + } + return node; + } + } + ts6.getLeftmostExpression = getLeftmostExpression; + function Symbol2(flags, name) { + this.flags = flags; + this.escapedName = name; + this.declarations = void 0; + this.valueDeclaration = void 0; + this.id = void 0; + this.mergeId = void 0; + this.parent = void 0; + } + function Type(checker, flags) { + this.flags = flags; + if (ts6.Debug.isDebugging || ts6.tracing) { + this.checker = checker; + } + } + function Signature(checker, flags) { + this.flags = flags; + if (ts6.Debug.isDebugging) { + this.checker = checker; + } + } + function Node(kind, pos, end) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = 0; + this.modifierFlagsCache = 0; + this.transformFlags = 0; + this.parent = void 0; + this.original = void 0; + } + function Token(kind, pos, end) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = 0; + this.transformFlags = 0; + this.parent = void 0; + } + function Identifier(kind, pos, end) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = 0; + this.transformFlags = 0; + this.parent = void 0; + this.original = void 0; + this.flowNode = void 0; + } + function SourceMapSource(fileName, text, skipTrivia) { + this.fileName = fileName; + this.text = text; + this.skipTrivia = skipTrivia || function(pos) { + return pos; + }; + } + ts6.objectAllocator = { + getNodeConstructor: function() { + return Node; + }, + getTokenConstructor: function() { + return Token; + }, + getIdentifierConstructor: function() { + return Identifier; + }, + getPrivateIdentifierConstructor: function() { + return Node; + }, + getSourceFileConstructor: function() { + return Node; + }, + getSymbolConstructor: function() { + return Symbol2; + }, + getTypeConstructor: function() { + return Type; + }, + getSignatureConstructor: function() { + return Signature; + }, + getSourceMapSourceConstructor: function() { + return SourceMapSource; + } + }; + function setObjectAllocator(alloc) { + Object.assign(ts6.objectAllocator, alloc); + } + ts6.setObjectAllocator = setObjectAllocator; + function formatStringFromArgs(text, args, baseIndex) { + if (baseIndex === void 0) { + baseIndex = 0; + } + return text.replace(/{(\d+)}/g, function(_match, index) { + return "" + ts6.Debug.checkDefined(args[+index + baseIndex]); + }); + } + ts6.formatStringFromArgs = formatStringFromArgs; + var localizedDiagnosticMessages; + function setLocalizedDiagnosticMessages(messages) { + localizedDiagnosticMessages = messages; + } + ts6.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages; + function maybeSetLocalizedDiagnosticMessages(getMessages) { + if (!localizedDiagnosticMessages && getMessages) { + localizedDiagnosticMessages = getMessages(); + } + } + ts6.maybeSetLocalizedDiagnosticMessages = maybeSetLocalizedDiagnosticMessages; + function getLocaleSpecificMessage(message) { + return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message; + } + ts6.getLocaleSpecificMessage = getLocaleSpecificMessage; + function createDetachedDiagnostic(fileName, start, length, message) { + assertDiagnosticLocation( + /*file*/ + void 0, + start, + length + ); + var text = getLocaleSpecificMessage(message); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file: void 0, + start, + length, + messageText: text, + category: message.category, + code: message.code, + reportsUnnecessary: message.reportsUnnecessary, + fileName + }; + } + ts6.createDetachedDiagnostic = createDetachedDiagnostic; + function isDiagnosticWithDetachedLocation(diagnostic) { + return diagnostic.file === void 0 && diagnostic.start !== void 0 && diagnostic.length !== void 0 && typeof diagnostic.fileName === "string"; + } + function attachFileToDiagnostic(diagnostic, file) { + var fileName = file.fileName || ""; + var length = file.text.length; + ts6.Debug.assertEqual(diagnostic.fileName, fileName); + ts6.Debug.assertLessThanOrEqual(diagnostic.start, length); + ts6.Debug.assertLessThanOrEqual(diagnostic.start + diagnostic.length, length); + var diagnosticWithLocation = { + file, + start: diagnostic.start, + length: diagnostic.length, + messageText: diagnostic.messageText, + category: diagnostic.category, + code: diagnostic.code, + reportsUnnecessary: diagnostic.reportsUnnecessary + }; + if (diagnostic.relatedInformation) { + diagnosticWithLocation.relatedInformation = []; + for (var _i = 0, _a = diagnostic.relatedInformation; _i < _a.length; _i++) { + var related = _a[_i]; + if (isDiagnosticWithDetachedLocation(related) && related.fileName === fileName) { + ts6.Debug.assertLessThanOrEqual(related.start, length); + ts6.Debug.assertLessThanOrEqual(related.start + related.length, length); + diagnosticWithLocation.relatedInformation.push(attachFileToDiagnostic(related, file)); + } else { + diagnosticWithLocation.relatedInformation.push(related); + } + } + } + return diagnosticWithLocation; + } + function attachFileToDiagnostics(diagnostics, file) { + var diagnosticsWithLocation = []; + for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { + var diagnostic = diagnostics_1[_i]; + diagnosticsWithLocation.push(attachFileToDiagnostic(diagnostic, file)); + } + return diagnosticsWithLocation; + } + ts6.attachFileToDiagnostics = attachFileToDiagnostics; + function createFileDiagnostic(file, start, length, message) { + assertDiagnosticLocation(file, start, length); + var text = getLocaleSpecificMessage(message); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file, + start, + length, + messageText: text, + category: message.category, + code: message.code, + reportsUnnecessary: message.reportsUnnecessary, + reportsDeprecated: message.reportsDeprecated + }; + } + ts6.createFileDiagnostic = createFileDiagnostic; + function formatMessage(_dummy, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return text; + } + ts6.formatMessage = formatMessage; + function createCompilerDiagnostic(message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 1) { + text = formatStringFromArgs(text, arguments, 1); + } + return { + file: void 0, + start: void 0, + length: void 0, + messageText: text, + category: message.category, + code: message.code, + reportsUnnecessary: message.reportsUnnecessary, + reportsDeprecated: message.reportsDeprecated + }; + } + ts6.createCompilerDiagnostic = createCompilerDiagnostic; + function createCompilerDiagnosticFromMessageChain(chain, relatedInformation) { + return { + file: void 0, + start: void 0, + length: void 0, + code: chain.code, + category: chain.category, + messageText: chain.next ? chain : chain.messageText, + relatedInformation + }; + } + ts6.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain; + function chainDiagnosticMessages(details, message) { + var text = getLocaleSpecificMessage(message); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return { + messageText: text, + category: message.category, + code: message.code, + next: details === void 0 || Array.isArray(details) ? details : [details] + }; + } + ts6.chainDiagnosticMessages = chainDiagnosticMessages; + function concatenateDiagnosticMessageChains(headChain, tailChain) { + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next[0]; + } + lastChain.next = [tailChain]; + } + ts6.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; + function getDiagnosticFilePath(diagnostic) { + return diagnostic.file ? diagnostic.file.path : void 0; + } + function compareDiagnostics(d1, d2) { + return compareDiagnosticsSkipRelatedInformation(d1, d2) || compareRelatedInformation(d1, d2) || 0; + } + ts6.compareDiagnostics = compareDiagnostics; + function compareDiagnosticsSkipRelatedInformation(d1, d2) { + return ts6.compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) || ts6.compareValues(d1.start, d2.start) || ts6.compareValues(d1.length, d2.length) || ts6.compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + } + ts6.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; + function compareRelatedInformation(d1, d2) { + if (!d1.relatedInformation && !d2.relatedInformation) { + return 0; + } + if (d1.relatedInformation && d2.relatedInformation) { + return ts6.compareValues(d1.relatedInformation.length, d2.relatedInformation.length) || ts6.forEach(d1.relatedInformation, function(d1i, index) { + var d2i = d2.relatedInformation[index]; + return compareDiagnostics(d1i, d2i); + }) || 0; + } + return d1.relatedInformation ? -1 : 1; + } + function compareMessageText(t1, t2) { + if (typeof t1 === "string" && typeof t2 === "string") { + return ts6.compareStringsCaseSensitive(t1, t2); + } else if (typeof t1 === "string") { + return -1; + } else if (typeof t2 === "string") { + return 1; + } + var res = ts6.compareStringsCaseSensitive(t1.messageText, t2.messageText); + if (res) { + return res; + } + if (!t1.next && !t2.next) { + return 0; + } + if (!t1.next) { + return -1; + } + if (!t2.next) { + return 1; + } + var len = Math.min(t1.next.length, t2.next.length); + for (var i = 0; i < len; i++) { + res = compareMessageText(t1.next[i], t2.next[i]); + if (res) { + return res; + } + } + if (t1.next.length < t2.next.length) { + return -1; + } else if (t1.next.length > t2.next.length) { + return 1; + } + return 0; + } + function getLanguageVariant(scriptKind) { + return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 || scriptKind === 6 ? 1 : 0; + } + ts6.getLanguageVariant = getLanguageVariant; + function walkTreeForJSXTags(node) { + if (!(node.transformFlags & 2)) + return void 0; + return ts6.isJsxOpeningLikeElement(node) || ts6.isJsxFragment(node) ? node : ts6.forEachChild(node, walkTreeForJSXTags); + } + function isFileModuleFromUsingJSXTag(file) { + return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0; + } + function isFileForcedToBeModuleByFormat(file) { + return (file.impliedNodeFormat === ts6.ModuleKind.ESNext || ts6.fileExtensionIsOneOf(file.fileName, [ + ".cjs", + ".cts", + ".mjs", + ".mts" + /* Extension.Mts */ + ])) && !file.isDeclarationFile ? true : void 0; + } + function getSetExternalModuleIndicator(options) { + switch (getEmitModuleDetectionKind(options)) { + case ts6.ModuleDetectionKind.Force: + return function(file) { + file.externalModuleIndicator = ts6.isFileProbablyExternalModule(file) || !file.isDeclarationFile || void 0; + }; + case ts6.ModuleDetectionKind.Legacy: + return function(file) { + file.externalModuleIndicator = ts6.isFileProbablyExternalModule(file); + }; + case ts6.ModuleDetectionKind.Auto: + var checks = [ts6.isFileProbablyExternalModule]; + if (options.jsx === 4 || options.jsx === 5) { + checks.push(isFileModuleFromUsingJSXTag); + } + checks.push(isFileForcedToBeModuleByFormat); + var combined_1 = ts6.or.apply(void 0, checks); + var callback = function(file) { + return void (file.externalModuleIndicator = combined_1(file)); + }; + return callback; + } + } + ts6.getSetExternalModuleIndicator = getSetExternalModuleIndicator; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || compilerOptions.module === ts6.ModuleKind.Node16 && 9 || compilerOptions.module === ts6.ModuleKind.NodeNext && 99 || 0; + } + ts6.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? compilerOptions.module : getEmitScriptTarget(compilerOptions) >= 2 ? ts6.ModuleKind.ES2015 : ts6.ModuleKind.CommonJS; + } + ts6.getEmitModuleKind = getEmitModuleKind; + function getEmitModuleResolutionKind(compilerOptions) { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === void 0) { + switch (getEmitModuleKind(compilerOptions)) { + case ts6.ModuleKind.CommonJS: + moduleResolution = ts6.ModuleResolutionKind.NodeJs; + break; + case ts6.ModuleKind.Node16: + moduleResolution = ts6.ModuleResolutionKind.Node16; + break; + case ts6.ModuleKind.NodeNext: + moduleResolution = ts6.ModuleResolutionKind.NodeNext; + break; + default: + moduleResolution = ts6.ModuleResolutionKind.Classic; + break; + } + } + return moduleResolution; + } + ts6.getEmitModuleResolutionKind = getEmitModuleResolutionKind; + function getEmitModuleDetectionKind(options) { + return options.moduleDetection || (getEmitModuleKind(options) === ts6.ModuleKind.Node16 || getEmitModuleKind(options) === ts6.ModuleKind.NodeNext ? ts6.ModuleDetectionKind.Force : ts6.ModuleDetectionKind.Auto); + } + ts6.getEmitModuleDetectionKind = getEmitModuleDetectionKind; + function hasJsonModuleEmitEnabled(options) { + switch (getEmitModuleKind(options)) { + case ts6.ModuleKind.CommonJS: + case ts6.ModuleKind.AMD: + case ts6.ModuleKind.ES2015: + case ts6.ModuleKind.ES2020: + case ts6.ModuleKind.ES2022: + case ts6.ModuleKind.ESNext: + case ts6.ModuleKind.Node16: + case ts6.ModuleKind.NodeNext: + return true; + default: + return false; + } + } + ts6.hasJsonModuleEmitEnabled = hasJsonModuleEmitEnabled; + function unreachableCodeIsError(options) { + return options.allowUnreachableCode === false; + } + ts6.unreachableCodeIsError = unreachableCodeIsError; + function unusedLabelIsError(options) { + return options.allowUnusedLabels === false; + } + ts6.unusedLabelIsError = unusedLabelIsError; + function getAreDeclarationMapsEnabled(options) { + return !!(getEmitDeclarations(options) && options.declarationMap); + } + ts6.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled; + function getESModuleInterop(compilerOptions) { + if (compilerOptions.esModuleInterop !== void 0) { + return compilerOptions.esModuleInterop; + } + switch (getEmitModuleKind(compilerOptions)) { + case ts6.ModuleKind.Node16: + case ts6.ModuleKind.NodeNext: + return true; + } + return void 0; + } + ts6.getESModuleInterop = getESModuleInterop; + function getAllowSyntheticDefaultImports(compilerOptions) { + var moduleKind = getEmitModuleKind(compilerOptions); + return compilerOptions.allowSyntheticDefaultImports !== void 0 ? compilerOptions.allowSyntheticDefaultImports : getESModuleInterop(compilerOptions) || moduleKind === ts6.ModuleKind.System; + } + ts6.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports; + function getEmitDeclarations(compilerOptions) { + return !!(compilerOptions.declaration || compilerOptions.composite); + } + ts6.getEmitDeclarations = getEmitDeclarations; + function shouldPreserveConstEnums(compilerOptions) { + return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + ts6.shouldPreserveConstEnums = shouldPreserveConstEnums; + function isIncrementalCompilation(options) { + return !!(options.incremental || options.composite); + } + ts6.isIncrementalCompilation = isIncrementalCompilation; + function getStrictOptionValue(compilerOptions, flag) { + return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag]; + } + ts6.getStrictOptionValue = getStrictOptionValue; + function getAllowJSCompilerOption(compilerOptions) { + return compilerOptions.allowJs === void 0 ? !!compilerOptions.checkJs : compilerOptions.allowJs; + } + ts6.getAllowJSCompilerOption = getAllowJSCompilerOption; + function getUseDefineForClassFields(compilerOptions) { + return compilerOptions.useDefineForClassFields === void 0 ? getEmitScriptTarget(compilerOptions) >= 9 : compilerOptions.useDefineForClassFields; + } + ts6.getUseDefineForClassFields = getUseDefineForClassFields; + function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) { + return optionsHaveChanges(oldOptions, newOptions, ts6.semanticDiagnosticsOptionDeclarations); + } + ts6.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics; + function compilerOptionsAffectEmit(newOptions, oldOptions) { + return optionsHaveChanges(oldOptions, newOptions, ts6.affectsEmitOptionDeclarations); + } + ts6.compilerOptionsAffectEmit = compilerOptionsAffectEmit; + function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) { + return optionsHaveChanges(oldOptions, newOptions, ts6.affectsDeclarationPathOptionDeclarations); + } + ts6.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath; + function getCompilerOptionValue(options, option) { + return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name]; + } + ts6.getCompilerOptionValue = getCompilerOptionValue; + function getJSXTransformEnabled(options) { + var jsx = options.jsx; + return jsx === 2 || jsx === 4 || jsx === 5; + } + ts6.getJSXTransformEnabled = getJSXTransformEnabled; + function getJSXImplicitImportBase(compilerOptions, file) { + var jsxImportSourcePragmas = file === null || file === void 0 ? void 0 : file.pragmas.get("jsximportsource"); + var jsxImportSourcePragma = ts6.isArray(jsxImportSourcePragmas) ? jsxImportSourcePragmas[jsxImportSourcePragmas.length - 1] : jsxImportSourcePragmas; + return compilerOptions.jsx === 4 || compilerOptions.jsx === 5 || compilerOptions.jsxImportSource || jsxImportSourcePragma ? (jsxImportSourcePragma === null || jsxImportSourcePragma === void 0 ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0; + } + ts6.getJSXImplicitImportBase = getJSXImplicitImportBase; + function getJSXRuntimeImport(base, options) { + return base ? "".concat(base, "/").concat(options.jsx === 5 ? "jsx-dev-runtime" : "jsx-runtime") : void 0; + } + ts6.getJSXRuntimeImport = getJSXRuntimeImport; + function hasZeroOrOneAsteriskCharacter(str) { + var seenAsterisk = false; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42) { + if (!seenAsterisk) { + seenAsterisk = true; + } else { + return false; + } + } + } + return true; + } + ts6.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter; + function createSymlinkCache(cwd, getCanonicalFileName) { + var symlinkedDirectories; + var symlinkedDirectoriesByRealpath; + var symlinkedFiles; + var hasProcessedResolutions = false; + return { + getSymlinkedFiles: function() { + return symlinkedFiles; + }, + getSymlinkedDirectories: function() { + return symlinkedDirectories; + }, + getSymlinkedDirectoriesByRealpath: function() { + return symlinkedDirectoriesByRealpath; + }, + setSymlinkedFile: function(path, real) { + return (symlinkedFiles || (symlinkedFiles = new ts6.Map())).set(path, real); + }, + setSymlinkedDirectory: function(symlink, real) { + var symlinkPath = ts6.toPath(symlink, cwd, getCanonicalFileName); + if (!containsIgnoredPath(symlinkPath)) { + symlinkPath = ts6.ensureTrailingDirectorySeparator(symlinkPath); + if (real !== false && !(symlinkedDirectories === null || symlinkedDirectories === void 0 ? void 0 : symlinkedDirectories.has(symlinkPath))) { + (symlinkedDirectoriesByRealpath || (symlinkedDirectoriesByRealpath = ts6.createMultiMap())).add(ts6.ensureTrailingDirectorySeparator(real.realPath), symlink); + } + (symlinkedDirectories || (symlinkedDirectories = new ts6.Map())).set(symlinkPath, real); + } + }, + setSymlinksFromResolutions: function(files, typeReferenceDirectives) { + var _this = this; + var _a; + ts6.Debug.assert(!hasProcessedResolutions); + hasProcessedResolutions = true; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var file = files_1[_i]; + (_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function(resolution) { + return processResolution(_this, resolution); + }); + } + typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function(resolution) { + return processResolution(_this, resolution); + }); + }, + hasProcessedResolutions: function() { + return hasProcessedResolutions; + } + }; + function processResolution(cache, resolution) { + if (!resolution || !resolution.originalPath || !resolution.resolvedFileName) + return; + var resolvedFileName = resolution.resolvedFileName, originalPath = resolution.originalPath; + cache.setSymlinkedFile(ts6.toPath(originalPath, cwd, getCanonicalFileName), resolvedFileName); + var _a = guessDirectorySymlink(resolvedFileName, originalPath, cwd, getCanonicalFileName) || ts6.emptyArray, commonResolved = _a[0], commonOriginal = _a[1]; + if (commonResolved && commonOriginal) { + cache.setSymlinkedDirectory(commonOriginal, { real: commonResolved, realPath: ts6.toPath(commonResolved, cwd, getCanonicalFileName) }); + } + } + } + ts6.createSymlinkCache = createSymlinkCache; + function guessDirectorySymlink(a, b, cwd, getCanonicalFileName) { + var aParts = ts6.getPathComponents(ts6.getNormalizedAbsolutePath(a, cwd)); + var bParts = ts6.getPathComponents(ts6.getNormalizedAbsolutePath(b, cwd)); + var isDirectory = false; + while (aParts.length >= 2 && bParts.length >= 2 && !isNodeModulesOrScopedPackageDirectory(aParts[aParts.length - 2], getCanonicalFileName) && !isNodeModulesOrScopedPackageDirectory(bParts[bParts.length - 2], getCanonicalFileName) && getCanonicalFileName(aParts[aParts.length - 1]) === getCanonicalFileName(bParts[bParts.length - 1])) { + aParts.pop(); + bParts.pop(); + isDirectory = true; + } + return isDirectory ? [ts6.getPathFromPathComponents(aParts), ts6.getPathFromPathComponents(bParts)] : void 0; + } + function isNodeModulesOrScopedPackageDirectory(s, getCanonicalFileName) { + return s !== void 0 && (getCanonicalFileName(s) === "node_modules" || ts6.startsWith(s, "@")); + } + function stripLeadingDirectorySeparator(s) { + return ts6.isAnyDirectorySeparator(s.charCodeAt(0)) ? s.slice(1) : void 0; + } + function tryRemoveDirectoryPrefix(path, dirPath, getCanonicalFileName) { + var withoutPrefix = ts6.tryRemovePrefix(path, dirPath, getCanonicalFileName); + return withoutPrefix === void 0 ? void 0 : stripLeadingDirectorySeparator(withoutPrefix); + } + ts6.tryRemoveDirectoryPrefix = tryRemoveDirectoryPrefix; + var reservedCharacterPattern = /[^\w\s\/]/g; + function regExpEscape(text) { + return text.replace(reservedCharacterPattern, escapeRegExpCharacter); + } + ts6.regExpEscape = regExpEscape; + function escapeRegExpCharacter(match) { + return "\\" + match; + } + var wildcardCharCodes = [ + 42, + 63 + /* CharacterCodes.question */ + ]; + ts6.commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"]; + var implicitExcludePathRegexPattern = "(?!(".concat(ts6.commonPackageFolders.join("|"), ")(/|$))"); + var filesMatcher = { + /** + * Matches any single directory segment unless it is the last segment and a .min.js file + * Breakdown: + * [^./] # matches everything up to the first . character (excluding directory separators) + * (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension + */ + singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*", + /** + * Regex for the ** wildcard. Matches any number of subdirectories. When used for including + * files or directories, does not match subdirectories that start with a . character + */ + doubleAsteriskRegexFragment: "(/".concat(implicitExcludePathRegexPattern, "[^/.][^/]*)*?"), + replaceWildcardCharacter: function(match) { + return replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment); + } + }; + var directoriesMatcher = { + singleAsteriskRegexFragment: "[^/]*", + /** + * Regex for the ** wildcard. Matches any number of subdirectories. When used for including + * files or directories, does not match subdirectories that start with a . character + */ + doubleAsteriskRegexFragment: "(/".concat(implicitExcludePathRegexPattern, "[^/.][^/]*)*?"), + replaceWildcardCharacter: function(match) { + return replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment); + } + }; + var excludeMatcher = { + singleAsteriskRegexFragment: "[^/]*", + doubleAsteriskRegexFragment: "(/.+?)?", + replaceWildcardCharacter: function(match) { + return replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment); + } + }; + var wildcardMatchers = { + files: filesMatcher, + directories: directoriesMatcher, + exclude: excludeMatcher + }; + function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return void 0; + } + var pattern = patterns.map(function(pattern2) { + return "(".concat(pattern2, ")"); + }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(".concat(pattern, ")").concat(terminator); + } + ts6.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { + if (specs === void 0 || specs.length === 0) { + return void 0; + } + return ts6.flatMap(specs, function(spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]); + }); + } + ts6.getRegularExpressionsForWildcards = getRegularExpressionsForWildcards; + function isImplicitGlob(lastPathComponent) { + return !/[.*?]/.test(lastPathComponent); + } + ts6.isImplicitGlob = isImplicitGlob; + function getPatternFromSpec(spec, basePath, usage) { + var pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]); + return pattern && "^(".concat(pattern, ")").concat(usage === "exclude" ? "($|/)" : "$"); + } + ts6.getPatternFromSpec = getPatternFromSpec; + function getSubPatternFromSpec(spec, basePath, usage, _a) { + var singleAsteriskRegexFragment = _a.singleAsteriskRegexFragment, doubleAsteriskRegexFragment = _a.doubleAsteriskRegexFragment, replaceWildcardCharacter2 = _a.replaceWildcardCharacter; + var subpattern = ""; + var hasWrittenComponent = false; + var components = ts6.getNormalizedPathComponents(spec, basePath); + var lastComponent = ts6.last(components); + if (usage !== "exclude" && lastComponent === "**") { + return void 0; + } + components[0] = ts6.removeTrailingDirectorySeparator(components[0]); + if (isImplicitGlob(lastComponent)) { + components.push("**", "*"); + } + var optionalCount = 0; + for (var _i = 0, components_1 = components; _i < components_1.length; _i++) { + var component = components_1[_i]; + if (component === "**") { + subpattern += doubleAsteriskRegexFragment; + } else { + if (usage === "directories") { + subpattern += "("; + optionalCount++; + } + if (hasWrittenComponent) { + subpattern += ts6.directorySeparator; + } + if (usage !== "exclude") { + var componentPattern = ""; + if (component.charCodeAt(0) === 42) { + componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?"; + component = component.substr(1); + } else if (component.charCodeAt(0) === 63) { + componentPattern += "[^./]"; + component = component.substr(1); + } + componentPattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter2); + if (componentPattern !== component) { + subpattern += implicitExcludePathRegexPattern; + } + subpattern += componentPattern; + } else { + subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter2); + } + } + hasWrittenComponent = true; + } + while (optionalCount > 0) { + subpattern += ")?"; + optionalCount--; + } + return subpattern; + } + function replaceWildcardCharacter(match, singleAsteriskRegexFragment) { + return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; + } + function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) { + path = ts6.normalizePath(path); + currentDirectory = ts6.normalizePath(currentDirectory); + var absolutePath = ts6.combinePaths(currentDirectory, path); + return { + includeFilePatterns: ts6.map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function(pattern) { + return "^".concat(pattern, "$"); + }), + includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), + includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), + excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), + basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames) + }; + } + ts6.getFileMatcherPatterns = getFileMatcherPatterns; + function getRegexFromPattern(pattern, useCaseSensitiveFileNames) { + return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i"); + } + ts6.getRegexFromPattern = getRegexFromPattern; + function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) { + path = ts6.normalizePath(path); + currentDirectory = ts6.normalizePath(currentDirectory); + var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function(pattern) { + return getRegexFromPattern(pattern, useCaseSensitiveFileNames); + }); + var includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames); + var excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames); + var results = includeFileRegexes ? includeFileRegexes.map(function() { + return []; + }) : [[]]; + var visited = new ts6.Map(); + var toCanonical = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { + var basePath = _a[_i]; + visitDirectory(basePath, ts6.combinePaths(currentDirectory, basePath), depth); + } + return ts6.flatten(results); + function visitDirectory(path2, absolutePath, depth2) { + var canonicalPath = toCanonical(realpath(absolutePath)); + if (visited.has(canonicalPath)) + return; + visited.set(canonicalPath, true); + var _a2 = getFileSystemEntries(path2), files = _a2.files, directories = _a2.directories; + var _loop_1 = function(current2) { + var name2 = ts6.combinePaths(path2, current2); + var absoluteName2 = ts6.combinePaths(absolutePath, current2); + if (extensions && !ts6.fileExtensionIsOneOf(name2, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName2)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name2); + } else { + var includeIndex = ts6.findIndex(includeFileRegexes, function(re) { + return re.test(absoluteName2); + }); + if (includeIndex !== -1) { + results[includeIndex].push(name2); + } + } + }; + for (var _i2 = 0, _b = ts6.sort(files, ts6.compareStringsCaseSensitive); _i2 < _b.length; _i2++) { + var current = _b[_i2]; + _loop_1(current); + } + if (depth2 !== void 0) { + depth2--; + if (depth2 === 0) { + return; + } + } + for (var _c = 0, _d = ts6.sort(directories, ts6.compareStringsCaseSensitive); _c < _d.length; _c++) { + var current = _d[_c]; + var name = ts6.combinePaths(path2, current); + var absoluteName = ts6.combinePaths(absolutePath, current); + if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { + visitDirectory(name, absoluteName, depth2); + } + } + } + } + ts6.matchFiles = matchFiles; + function getBasePaths(path, includes, useCaseSensitiveFileNames) { + var basePaths = [path]; + if (includes) { + var includeBasePaths = []; + for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) { + var include = includes_1[_i]; + var absolute = ts6.isRootedDiskPath(include) ? include : ts6.normalizePath(ts6.combinePaths(path, include)); + includeBasePaths.push(getIncludeBasePath(absolute)); + } + includeBasePaths.sort(ts6.getStringComparer(!useCaseSensitiveFileNames)); + var _loop_2 = function(includeBasePath2) { + if (ts6.every(basePaths, function(basePath) { + return !ts6.containsPath(basePath, includeBasePath2, path, !useCaseSensitiveFileNames); + })) { + basePaths.push(includeBasePath2); + } + }; + for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { + var includeBasePath = includeBasePaths_1[_a]; + _loop_2(includeBasePath); + } + } + return basePaths; + } + function getIncludeBasePath(absolute) { + var wildcardOffset = ts6.indexOfAnyCharCode(absolute, wildcardCharCodes); + if (wildcardOffset < 0) { + return !ts6.hasExtension(absolute) ? absolute : ts6.removeTrailingDirectorySeparator(ts6.getDirectoryPath(absolute)); + } + return absolute.substring(0, absolute.lastIndexOf(ts6.directorySeparator, wildcardOffset)); + } + function ensureScriptKind(fileName, scriptKind) { + return scriptKind || getScriptKindFromFileName(fileName) || 3; + } + ts6.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + case ".cjs": + case ".mjs": + return 1; + case ".jsx": + return 2; + case ".ts": + case ".cts": + case ".mts": + return 3; + case ".tsx": + return 4; + case ".json": + return 6; + default: + return 0; + } + } + ts6.getScriptKindFromFileName = getScriptKindFromFileName; + ts6.supportedTSExtensions = [[ + ".ts", + ".tsx", + ".d.ts" + /* Extension.Dts */ + ], [ + ".cts", + ".d.cts" + /* Extension.Dcts */ + ], [ + ".mts", + ".d.mts" + /* Extension.Dmts */ + ]]; + ts6.supportedTSExtensionsFlat = ts6.flatten(ts6.supportedTSExtensions); + var supportedTSExtensionsWithJson = __spreadArray(__spreadArray([], ts6.supportedTSExtensions, true), [[ + ".json" + /* Extension.Json */ + ]], false); + var supportedTSExtensionsForExtractExtension = [ + ".d.ts", + ".d.cts", + ".d.mts", + ".cts", + ".mts", + ".ts", + ".tsx", + ".cts", + ".mts" + /* Extension.Mts */ + ]; + ts6.supportedJSExtensions = [[ + ".js", + ".jsx" + /* Extension.Jsx */ + ], [ + ".mjs" + /* Extension.Mjs */ + ], [ + ".cjs" + /* Extension.Cjs */ + ]]; + ts6.supportedJSExtensionsFlat = ts6.flatten(ts6.supportedJSExtensions); + var allSupportedExtensions = [[ + ".ts", + ".tsx", + ".d.ts", + ".js", + ".jsx" + /* Extension.Jsx */ + ], [ + ".cts", + ".d.cts", + ".cjs" + /* Extension.Cjs */ + ], [ + ".mts", + ".d.mts", + ".mjs" + /* Extension.Mjs */ + ]]; + var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[ + ".json" + /* Extension.Json */ + ]], false); + ts6.supportedDeclarationExtensions = [ + ".d.ts", + ".d.cts", + ".d.mts" + /* Extension.Dmts */ + ]; + function getSupportedExtensions(options, extraFileExtensions) { + var needJsExtensions = options && getAllowJSCompilerOption(options); + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needJsExtensions ? allSupportedExtensions : ts6.supportedTSExtensions; + } + var builtins = needJsExtensions ? allSupportedExtensions : ts6.supportedTSExtensions; + var flatBuiltins = ts6.flatten(builtins); + var extensions = __spreadArray(__spreadArray([], builtins, true), ts6.mapDefined(extraFileExtensions, function(x) { + return x.scriptKind === 7 || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension) === -1 ? [x.extension] : void 0; + }), true); + return extensions; + } + ts6.getSupportedExtensions = getSupportedExtensions; + function getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions) { + if (!options || !options.resolveJsonModule) + return supportedExtensions; + if (supportedExtensions === allSupportedExtensions) + return allSupportedExtensionsWithJson; + if (supportedExtensions === ts6.supportedTSExtensions) + return supportedTSExtensionsWithJson; + return __spreadArray(__spreadArray([], supportedExtensions, true), [[ + ".json" + /* Extension.Json */ + ]], false); + } + ts6.getSupportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule; + function isJSLike(scriptKind) { + return scriptKind === 1 || scriptKind === 2; + } + function hasJSFileExtension(fileName) { + return ts6.some(ts6.supportedJSExtensionsFlat, function(extension) { + return ts6.fileExtensionIs(fileName, extension); + }); + } + ts6.hasJSFileExtension = hasJSFileExtension; + function hasTSFileExtension(fileName) { + return ts6.some(ts6.supportedTSExtensionsFlat, function(extension) { + return ts6.fileExtensionIs(fileName, extension); + }); + } + ts6.hasTSFileExtension = hasTSFileExtension; + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { + if (!fileName) + return false; + var supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions); + for (var _i = 0, _a = ts6.flatten(getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)); _i < _a.length; _i++) { + var extension = _a[_i]; + if (ts6.fileExtensionIs(fileName, extension)) { + return true; + } + } + return false; + } + ts6.isSupportedSourceFileName = isSupportedSourceFileName; + function numberOfDirectorySeparators(str) { + var match = str.match(/\//g); + return match ? match.length : 0; + } + function compareNumberOfDirectorySeparators(path1, path2) { + return ts6.compareValues(numberOfDirectorySeparators(path1), numberOfDirectorySeparators(path2)); + } + ts6.compareNumberOfDirectorySeparators = compareNumberOfDirectorySeparators; + var extensionsToRemove = [ + ".d.ts", + ".d.mts", + ".d.cts", + ".mjs", + ".mts", + ".cjs", + ".cts", + ".ts", + ".js", + ".tsx", + ".jsx", + ".json" + /* Extension.Json */ + ]; + function removeFileExtension(path) { + for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) { + var ext = extensionsToRemove_1[_i]; + var extensionless = tryRemoveExtension(path, ext); + if (extensionless !== void 0) { + return extensionless; + } + } + return path; + } + ts6.removeFileExtension = removeFileExtension; + function tryRemoveExtension(path, extension) { + return ts6.fileExtensionIs(path, extension) ? removeExtension(path, extension) : void 0; + } + ts6.tryRemoveExtension = tryRemoveExtension; + function removeExtension(path, extension) { + return path.substring(0, path.length - extension.length); + } + ts6.removeExtension = removeExtension; + function changeExtension(path, newExtension) { + return ts6.changeAnyExtension( + path, + newExtension, + extensionsToRemove, + /*ignoreCase*/ + false + ); + } + ts6.changeExtension = changeExtension; + function tryParsePattern(pattern) { + var indexOfStar = pattern.indexOf("*"); + if (indexOfStar === -1) { + return pattern; + } + return pattern.indexOf("*", indexOfStar + 1) !== -1 ? void 0 : { + prefix: pattern.substr(0, indexOfStar), + suffix: pattern.substr(indexOfStar + 1) + }; + } + ts6.tryParsePattern = tryParsePattern; + function tryParsePatterns(paths) { + return ts6.mapDefined(ts6.getOwnKeys(paths), function(path) { + return tryParsePattern(path); + }); + } + ts6.tryParsePatterns = tryParsePatterns; + function positionIsSynthesized(pos) { + return !(pos >= 0); + } + ts6.positionIsSynthesized = positionIsSynthesized; + function extensionIsTS(ext) { + return ext === ".ts" || ext === ".tsx" || ext === ".d.ts" || ext === ".cts" || ext === ".mts" || ext === ".d.mts" || ext === ".d.cts"; + } + ts6.extensionIsTS = extensionIsTS; + function resolutionExtensionIsTSOrJson(ext) { + return extensionIsTS(ext) || ext === ".json"; + } + ts6.resolutionExtensionIsTSOrJson = resolutionExtensionIsTSOrJson; + function extensionFromPath(path) { + var ext = tryGetExtensionFromPath(path); + return ext !== void 0 ? ext : ts6.Debug.fail("File ".concat(path, " has unknown extension.")); + } + ts6.extensionFromPath = extensionFromPath; + function isAnySupportedFileExtension(path) { + return tryGetExtensionFromPath(path) !== void 0; + } + ts6.isAnySupportedFileExtension = isAnySupportedFileExtension; + function tryGetExtensionFromPath(path) { + return ts6.find(extensionsToRemove, function(e) { + return ts6.fileExtensionIs(path, e); + }); + } + ts6.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts6.isCheckJsEnabledForFile = isCheckJsEnabledForFile; + ts6.emptyFileSystemEntries = { + files: ts6.emptyArray, + directories: ts6.emptyArray + }; + function matchPatternOrExact(patternOrStrings, candidate) { + var patterns = []; + for (var _i = 0, patternOrStrings_1 = patternOrStrings; _i < patternOrStrings_1.length; _i++) { + var patternOrString = patternOrStrings_1[_i]; + if (patternOrString === candidate) { + return candidate; + } + if (!ts6.isString(patternOrString)) { + patterns.push(patternOrString); + } + } + return ts6.findBestPatternMatch(patterns, function(_) { + return _; + }, candidate); + } + ts6.matchPatternOrExact = matchPatternOrExact; + function sliceAfter(arr, value) { + var index = arr.indexOf(value); + ts6.Debug.assert(index !== -1); + return arr.slice(index); + } + ts6.sliceAfter = sliceAfter; + function addRelatedInfo(diagnostic) { + var _a; + var relatedInformation = []; + for (var _i = 1; _i < arguments.length; _i++) { + relatedInformation[_i - 1] = arguments[_i]; + } + if (!relatedInformation.length) { + return diagnostic; + } + if (!diagnostic.relatedInformation) { + diagnostic.relatedInformation = []; + } + ts6.Debug.assert(diagnostic.relatedInformation !== ts6.emptyArray, "Diagnostic had empty array singleton for related info, but is still being constructed!"); + (_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation); + return diagnostic; + } + ts6.addRelatedInfo = addRelatedInfo; + function minAndMax(arr, getValue) { + ts6.Debug.assert(arr.length !== 0); + var min = getValue(arr[0]); + var max = min; + for (var i = 1; i < arr.length; i++) { + var value = getValue(arr[i]); + if (value < min) { + min = value; + } else if (value > max) { + max = value; + } + } + return { min, max }; + } + ts6.minAndMax = minAndMax; + function rangeOfNode(node) { + return { pos: getTokenPosOfNode(node), end: node.end }; + } + ts6.rangeOfNode = rangeOfNode; + function rangeOfTypeParameters(sourceFile, typeParameters) { + var pos = typeParameters.pos - 1; + var end = ts6.skipTrivia(sourceFile.text, typeParameters.end) + 1; + return { pos, end }; + } + ts6.rangeOfTypeParameters = rangeOfTypeParameters; + function skipTypeChecking(sourceFile, options, host) { + return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName); + } + ts6.skipTypeChecking = skipTypeChecking; + function isJsonEqual(a, b) { + return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && ts6.equalOwnProperties(a, b, isJsonEqual); + } + ts6.isJsonEqual = isJsonEqual; + function parsePseudoBigInt(stringValue) { + var log2Base; + switch (stringValue.charCodeAt(1)) { + case 98: + case 66: + log2Base = 1; + break; + case 111: + case 79: + log2Base = 3; + break; + case 120: + case 88: + log2Base = 4; + break; + default: + var nIndex = stringValue.length - 1; + var nonZeroStart = 0; + while (stringValue.charCodeAt(nonZeroStart) === 48) { + nonZeroStart++; + } + return stringValue.slice(nonZeroStart, nIndex) || "0"; + } + var startIndex = 2, endIndex = stringValue.length - 1; + var bitsNeeded = (endIndex - startIndex) * log2Base; + var segments = new Uint16Array((bitsNeeded >>> 4) + (bitsNeeded & 15 ? 1 : 0)); + for (var i = endIndex - 1, bitOffset = 0; i >= startIndex; i--, bitOffset += log2Base) { + var segment = bitOffset >>> 4; + var digitChar = stringValue.charCodeAt(i); + var digit = digitChar <= 57 ? digitChar - 48 : 10 + digitChar - (digitChar <= 70 ? 65 : 97); + var shiftedDigit = digit << (bitOffset & 15); + segments[segment] |= shiftedDigit; + var residual = shiftedDigit >>> 16; + if (residual) + segments[segment + 1] |= residual; + } + var base10Value = ""; + var firstNonzeroSegment = segments.length - 1; + var segmentsRemaining = true; + while (segmentsRemaining) { + var mod10 = 0; + segmentsRemaining = false; + for (var segment = firstNonzeroSegment; segment >= 0; segment--) { + var newSegment = mod10 << 16 | segments[segment]; + var segmentValue = newSegment / 10 | 0; + segments[segment] = segmentValue; + mod10 = newSegment - segmentValue * 10; + if (segmentValue && !segmentsRemaining) { + firstNonzeroSegment = segment; + segmentsRemaining = true; + } + } + base10Value = mod10 + base10Value; + } + return base10Value; + } + ts6.parsePseudoBigInt = parsePseudoBigInt; + function pseudoBigIntToString(_a) { + var negative = _a.negative, base10Value = _a.base10Value; + return (negative && base10Value !== "0" ? "-" : "") + base10Value; + } + ts6.pseudoBigIntToString = pseudoBigIntToString; + function isValidTypeOnlyAliasUseSite(useSite) { + return !!(useSite.flags & 16777216) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)); + } + ts6.isValidTypeOnlyAliasUseSite = isValidTypeOnlyAliasUseSite; + function isShorthandPropertyNameUseSite(useSite) { + return ts6.isIdentifier(useSite) && ts6.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; + } + function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { + while (node.kind === 79 || node.kind === 208) { + node = node.parent; + } + if (node.kind !== 164) { + return false; + } + if (hasSyntacticModifier( + node.parent, + 256 + /* ModifierFlags.Abstract */ + )) { + return true; + } + var containerKind = node.parent.parent.kind; + return containerKind === 261 || containerKind === 184; + } + function isIdentifierInNonEmittingHeritageClause(node) { + if (node.kind !== 79) + return false; + var heritageClause = ts6.findAncestor(node.parent, function(parent) { + switch (parent.kind) { + case 294: + return true; + case 208: + case 230: + return false; + default: + return "quit"; + } + }); + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261; + } + function isIdentifierTypeReference(node) { + return ts6.isTypeReferenceNode(node) && ts6.isIdentifier(node.typeName); + } + ts6.isIdentifierTypeReference = isIdentifierTypeReference; + function arrayIsHomogeneous(array, comparer) { + if (comparer === void 0) { + comparer = ts6.equateValues; + } + if (array.length < 2) + return true; + var first = array[0]; + for (var i = 1, length_1 = array.length; i < length_1; i++) { + var target = array[i]; + if (!comparer(first, target)) + return false; + } + return true; + } + ts6.arrayIsHomogeneous = arrayIsHomogeneous; + function setTextRangePos(range2, pos) { + range2.pos = pos; + return range2; + } + ts6.setTextRangePos = setTextRangePos; + function setTextRangeEnd(range2, end) { + range2.end = end; + return range2; + } + ts6.setTextRangeEnd = setTextRangeEnd; + function setTextRangePosEnd(range2, pos, end) { + return setTextRangeEnd(setTextRangePos(range2, pos), end); + } + ts6.setTextRangePosEnd = setTextRangePosEnd; + function setTextRangePosWidth(range2, pos, width) { + return setTextRangePosEnd(range2, pos, pos + width); + } + ts6.setTextRangePosWidth = setTextRangePosWidth; + function setNodeFlags(node, newFlags) { + if (node) { + node.flags = newFlags; + } + return node; + } + ts6.setNodeFlags = setNodeFlags; + function setParent(child, parent) { + if (child && parent) { + child.parent = parent; + } + return child; + } + ts6.setParent = setParent; + function setEachParent(children, parent) { + if (children) { + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + setParent(child, parent); + } + } + return children; + } + ts6.setEachParent = setEachParent; + function setParentRecursive(rootNode, incremental) { + if (!rootNode) + return rootNode; + ts6.forEachChildRecursively(rootNode, ts6.isJSDocNode(rootNode) ? bindParentToChildIgnoringJSDoc : bindParentToChild); + return rootNode; + function bindParentToChildIgnoringJSDoc(child, parent) { + if (incremental && child.parent === parent) { + return "skip"; + } + setParent(child, parent); + } + function bindJSDoc(child) { + if (ts6.hasJSDocNodes(child)) { + for (var _i = 0, _a = child.jsDoc; _i < _a.length; _i++) { + var doc = _a[_i]; + bindParentToChildIgnoringJSDoc(doc, child); + ts6.forEachChildRecursively(doc, bindParentToChildIgnoringJSDoc); + } + } + } + function bindParentToChild(child, parent) { + return bindParentToChildIgnoringJSDoc(child, parent) || bindJSDoc(child); + } + } + ts6.setParentRecursive = setParentRecursive; + function isPackedElement(node) { + return !ts6.isOmittedExpression(node); + } + function isPackedArrayLiteral(node) { + return ts6.isArrayLiteralExpression(node) && ts6.every(node.elements, isPackedElement); + } + ts6.isPackedArrayLiteral = isPackedArrayLiteral; + function expressionResultIsUnused(node) { + ts6.Debug.assertIsDefined(node.parent); + while (true) { + var parent = node.parent; + if (ts6.isParenthesizedExpression(parent)) { + node = parent; + continue; + } + if (ts6.isExpressionStatement(parent) || ts6.isVoidExpression(parent) || ts6.isForStatement(parent) && (parent.initializer === node || parent.incrementor === node)) { + return true; + } + if (ts6.isCommaListExpression(parent)) { + if (node !== ts6.last(parent.elements)) + return true; + node = parent; + continue; + } + if (ts6.isBinaryExpression(parent) && parent.operatorToken.kind === 27) { + if (node === parent.left) + return true; + node = parent; + continue; + } + return false; + } + } + ts6.expressionResultIsUnused = expressionResultIsUnused; + function containsIgnoredPath(path) { + return ts6.some(ts6.ignoredPaths, function(p) { + return ts6.stringContains(path, p); + }); + } + ts6.containsIgnoredPath = containsIgnoredPath; + function getContainingNodeArray(node) { + if (!node.parent) + return void 0; + switch (node.kind) { + case 165: + var parent_1 = node.parent; + return parent_1.kind === 192 ? void 0 : parent_1.typeParameters; + case 166: + return node.parent.parameters; + case 201: + return node.parent.templateSpans; + case 236: + return node.parent.templateSpans; + case 167: { + var parent_2 = node.parent; + return ts6.canHaveDecorators(parent_2) ? parent_2.modifiers : ts6.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : void 0; + } + case 294: + return node.parent.heritageClauses; + } + var parent = node.parent; + if (ts6.isJSDocTag(node)) { + return ts6.isJSDocTypeLiteral(node.parent) ? void 0 : node.parent.tags; + } + switch (parent.kind) { + case 184: + case 261: + return ts6.isTypeElement(node) ? parent.members : void 0; + case 189: + case 190: + return parent.types; + case 186: + case 206: + case 354: + case 272: + case 276: + return parent.elements; + case 207: + case 289: + return parent.properties; + case 210: + case 211: + return ts6.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? void 0 : parent.arguments; + case 281: + case 285: + return ts6.isJsxChild(node) ? parent.children : void 0; + case 283: + case 282: + return ts6.isTypeNode(node) ? parent.typeArguments : void 0; + case 238: + case 292: + case 293: + case 265: + return parent.statements; + case 266: + return parent.clauses; + case 260: + case 228: + return ts6.isClassElement(node) ? parent.members : void 0; + case 263: + return ts6.isEnumMember(node) ? parent.members : void 0; + case 308: + return parent.statements; + } + } + ts6.getContainingNodeArray = getContainingNodeArray; + function hasContextSensitiveParameters(node) { + if (!node.typeParameters) { + if (ts6.some(node.parameters, function(p) { + return !getEffectiveTypeAnnotationNode(p); + })) { + return true; + } + if (node.kind !== 216) { + var parameter = ts6.firstOrUndefined(node.parameters); + if (!(parameter && parameterIsThisKeyword(parameter))) { + return true; + } + } + } + return false; + } + ts6.hasContextSensitiveParameters = hasContextSensitiveParameters; + function isInfinityOrNaNString(name) { + return name === "Infinity" || name === "-Infinity" || name === "NaN"; + } + ts6.isInfinityOrNaNString = isInfinityOrNaNString; + function isCatchClauseVariableDeclaration(node) { + return node.kind === 257 && node.parent.kind === 295; + } + ts6.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; + function isParameterOrCatchClauseVariable(symbol) { + var declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration); + return !!declaration && (ts6.isParameter(declaration) || isCatchClauseVariableDeclaration(declaration)); + } + ts6.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; + function isFunctionExpressionOrArrowFunction(node) { + return node.kind === 215 || node.kind === 216; + } + ts6.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; + function escapeSnippetText(text) { + return text.replace(/\$/gm, function() { + return "\\$"; + }); + } + ts6.escapeSnippetText = escapeSnippetText; + function isNumericLiteralName(name) { + return (+name).toString() === name; + } + ts6.isNumericLiteralName = isNumericLiteralName; + function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed) { + return ts6.isIdentifierText(name, target) ? ts6.factory.createIdentifier(name) : !stringNamed && isNumericLiteralName(name) && +name >= 0 ? ts6.factory.createNumericLiteral(+name) : ts6.factory.createStringLiteral(name, !!singleQuote); + } + ts6.createPropertyNameNodeForIdentifierOrLiteral = createPropertyNameNodeForIdentifierOrLiteral; + function isThisTypeParameter(type) { + return !!(type.flags & 262144 && type.isThisType); + } + ts6.isThisTypeParameter = isThisTypeParameter; + function getNodeModulePathParts(fullPath) { + var topLevelNodeModulesIndex = 0; + var topLevelPackageNameIndex = 0; + var packageRootIndex = 0; + var fileNameIndex = 0; + var States; + (function(States2) { + States2[States2["BeforeNodeModules"] = 0] = "BeforeNodeModules"; + States2[States2["NodeModules"] = 1] = "NodeModules"; + States2[States2["Scope"] = 2] = "Scope"; + States2[States2["PackageContent"] = 3] = "PackageContent"; + })(States || (States = {})); + var partStart = 0; + var partEnd = 0; + var state = 0; + while (partEnd >= 0) { + partStart = partEnd; + partEnd = fullPath.indexOf("/", partStart + 1); + switch (state) { + case 0: + if (fullPath.indexOf(ts6.nodeModulesPathPart, partStart) === partStart) { + topLevelNodeModulesIndex = partStart; + topLevelPackageNameIndex = partEnd; + state = 1; + } + break; + case 1: + case 2: + if (state === 1 && fullPath.charAt(partStart + 1) === "@") { + state = 2; + } else { + packageRootIndex = partEnd; + state = 3; + } + break; + case 3: + if (fullPath.indexOf(ts6.nodeModulesPathPart, partStart) === partStart) { + state = 1; + } else { + state = 3; + } + break; + } + } + fileNameIndex = partStart; + return state > 1 ? { topLevelNodeModulesIndex, topLevelPackageNameIndex, packageRootIndex, fileNameIndex } : void 0; + } + ts6.getNodeModulePathParts = getNodeModulePathParts; + function getParameterTypeNode(parameter) { + var _a; + return parameter.kind === 343 ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + } + ts6.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165: + case 260: + case 261: + case 262: + case 263: + case 348: + case 341: + case 342: + return true; + case 270: + return node.isTypeOnly; + case 273: + case 278: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts6.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts6.isEnumDeclaration(node) || ts6.isVariableStatement(node) || ts6.isFunctionDeclaration(node) || ts6.isClassDeclaration(node) || ts6.isInterfaceDeclaration(node) || isTypeDeclaration(node) || ts6.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node); + } + ts6.canHaveExportModifier = canHaveExportModifier; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createBaseNodeFactory() { + var NodeConstructor; + var TokenConstructor; + var IdentifierConstructor; + var PrivateIdentifierConstructor; + var SourceFileConstructor; + return { + createBaseSourceFileNode, + createBaseIdentifierNode, + createBasePrivateIdentifierNode, + createBaseTokenNode, + createBaseNode + }; + function createBaseSourceFileNode(kind) { + return new (SourceFileConstructor || (SourceFileConstructor = ts6.objectAllocator.getSourceFileConstructor()))( + kind, + /*pos*/ + -1, + /*end*/ + -1 + ); + } + function createBaseIdentifierNode(kind) { + return new (IdentifierConstructor || (IdentifierConstructor = ts6.objectAllocator.getIdentifierConstructor()))( + kind, + /*pos*/ + -1, + /*end*/ + -1 + ); + } + function createBasePrivateIdentifierNode(kind) { + return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = ts6.objectAllocator.getPrivateIdentifierConstructor()))( + kind, + /*pos*/ + -1, + /*end*/ + -1 + ); + } + function createBaseTokenNode(kind) { + return new (TokenConstructor || (TokenConstructor = ts6.objectAllocator.getTokenConstructor()))( + kind, + /*pos*/ + -1, + /*end*/ + -1 + ); + } + function createBaseNode(kind) { + return new (NodeConstructor || (NodeConstructor = ts6.objectAllocator.getNodeConstructor()))( + kind, + /*pos*/ + -1, + /*end*/ + -1 + ); + } + } + ts6.createBaseNodeFactory = createBaseNodeFactory; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createParenthesizerRules(factory) { + var binaryLeftOperandParenthesizerCache; + var binaryRightOperandParenthesizerCache; + return { + getParenthesizeLeftSideOfBinaryForOperator, + getParenthesizeRightSideOfBinaryForOperator, + parenthesizeLeftSideOfBinary, + parenthesizeRightSideOfBinary, + parenthesizeExpressionOfComputedPropertyName, + parenthesizeConditionOfConditionalExpression, + parenthesizeBranchOfConditionalExpression, + parenthesizeExpressionOfExportDefault, + parenthesizeExpressionOfNew, + parenthesizeLeftSideOfAccess, + parenthesizeOperandOfPostfixUnary, + parenthesizeOperandOfPrefixUnary, + parenthesizeExpressionsOfCommaDelimitedList, + parenthesizeExpressionForDisallowedComma, + parenthesizeExpressionOfExpressionStatement, + parenthesizeConciseBodyOfArrowFunction, + parenthesizeCheckTypeOfConditionalType, + parenthesizeExtendsTypeOfConditionalType, + parenthesizeConstituentTypesOfUnionType, + parenthesizeConstituentTypeOfUnionType, + parenthesizeConstituentTypesOfIntersectionType, + parenthesizeConstituentTypeOfIntersectionType, + parenthesizeOperandOfTypeOperator, + parenthesizeOperandOfReadonlyTypeOperator, + parenthesizeNonArrayTypeOfPostfixType, + parenthesizeElementTypesOfTupleType, + parenthesizeElementTypeOfTupleType, + parenthesizeTypeOfOptionalType, + parenthesizeTypeArguments, + parenthesizeLeadingTypeArgument + }; + function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) { + binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts6.Map()); + var parenthesizerRule = binaryLeftOperandParenthesizerCache.get(operatorKind); + if (!parenthesizerRule) { + parenthesizerRule = function(node) { + return parenthesizeLeftSideOfBinary(operatorKind, node); + }; + binaryLeftOperandParenthesizerCache.set(operatorKind, parenthesizerRule); + } + return parenthesizerRule; + } + function getParenthesizeRightSideOfBinaryForOperator(operatorKind) { + binaryRightOperandParenthesizerCache || (binaryRightOperandParenthesizerCache = new ts6.Map()); + var parenthesizerRule = binaryRightOperandParenthesizerCache.get(operatorKind); + if (!parenthesizerRule) { + parenthesizerRule = function(node) { + return parenthesizeRightSideOfBinary( + operatorKind, + /*leftSide*/ + void 0, + node + ); + }; + binaryRightOperandParenthesizerCache.set(operatorKind, parenthesizerRule); + } + return parenthesizerRule; + } + function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + var binaryOperatorPrecedence = ts6.getOperatorPrecedence(223, binaryOperator); + var binaryOperatorAssociativity = ts6.getOperatorAssociativity(223, binaryOperator); + var emittedOperand = ts6.skipPartiallyEmittedExpressions(operand); + if (!isLeftSideOfBinary && operand.kind === 216 && binaryOperatorPrecedence > 3) { + return true; + } + var operandPrecedence = ts6.getExpressionPrecedence(emittedOperand); + switch (ts6.compareValues(operandPrecedence, binaryOperatorPrecedence)) { + case -1: + if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 && operand.kind === 226) { + return false; + } + return true; + case 1: + return false; + case 0: + if (isLeftSideOfBinary) { + return binaryOperatorAssociativity === 1; + } else { + if (ts6.isBinaryExpression(emittedOperand) && emittedOperand.operatorToken.kind === binaryOperator) { + if (operatorHasAssociativeProperty(binaryOperator)) { + return false; + } + if (binaryOperator === 39) { + var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0; + if (ts6.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) { + return false; + } + } + } + var operandAssociativity = ts6.getExpressionAssociativity(emittedOperand); + return operandAssociativity === 0; + } + } + } + function operatorHasAssociativeProperty(binaryOperator) { + return binaryOperator === 41 || binaryOperator === 51 || binaryOperator === 50 || binaryOperator === 52 || binaryOperator === 27; + } + function getLiteralKindOfBinaryPlusOperand(node) { + node = ts6.skipPartiallyEmittedExpressions(node); + if (ts6.isLiteralKind(node.kind)) { + return node.kind; + } + if (node.kind === 223 && node.operatorToken.kind === 39) { + if (node.cachedLiteralKind !== void 0) { + return node.cachedLiteralKind; + } + var leftKind = getLiteralKindOfBinaryPlusOperand(node.left); + var literalKind = ts6.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(node.right) ? leftKind : 0; + node.cachedLiteralKind = literalKind; + return literalKind; + } + return 0; + } + function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + var skipped = ts6.skipPartiallyEmittedExpressions(operand); + if (skipped.kind === 214) { + return operand; + } + return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) ? factory.createParenthesizedExpression(operand) : operand; + } + function parenthesizeLeftSideOfBinary(binaryOperator, leftSide) { + return parenthesizeBinaryOperand( + binaryOperator, + leftSide, + /*isLeftSideOfBinary*/ + true + ); + } + function parenthesizeRightSideOfBinary(binaryOperator, leftSide, rightSide) { + return parenthesizeBinaryOperand( + binaryOperator, + rightSide, + /*isLeftSideOfBinary*/ + false, + leftSide + ); + } + function parenthesizeExpressionOfComputedPropertyName(expression) { + return ts6.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; + } + function parenthesizeConditionOfConditionalExpression(condition) { + var conditionalPrecedence = ts6.getOperatorPrecedence( + 224, + 57 + /* SyntaxKind.QuestionToken */ + ); + var emittedCondition = ts6.skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts6.getExpressionPrecedence(emittedCondition); + if (ts6.compareValues(conditionPrecedence, conditionalPrecedence) !== 1) { + return factory.createParenthesizedExpression(condition); + } + return condition; + } + function parenthesizeBranchOfConditionalExpression(branch) { + var emittedExpression = ts6.skipPartiallyEmittedExpressions(branch); + return ts6.isCommaSequence(emittedExpression) ? factory.createParenthesizedExpression(branch) : branch; + } + function parenthesizeExpressionOfExportDefault(expression) { + var check = ts6.skipPartiallyEmittedExpressions(expression); + var needsParens = ts6.isCommaSequence(check); + if (!needsParens) { + switch (ts6.getLeftmostExpression( + check, + /*stopAtCallExpression*/ + false + ).kind) { + case 228: + case 215: + needsParens = true; + } + } + return needsParens ? factory.createParenthesizedExpression(expression) : expression; + } + function parenthesizeExpressionOfNew(expression) { + var leftmostExpr = ts6.getLeftmostExpression( + expression, + /*stopAtCallExpressions*/ + true + ); + switch (leftmostExpr.kind) { + case 210: + return factory.createParenthesizedExpression(expression); + case 211: + return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; + } + return parenthesizeLeftSideOfAccess(expression); + } + function parenthesizeLeftSideOfAccess(expression, optionalChain) { + var emittedExpression = ts6.skipPartiallyEmittedExpressions(expression); + if (ts6.isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 211 || emittedExpression.arguments) && (optionalChain || !ts6.isOptionalChain(emittedExpression))) { + return expression; + } + return ts6.setTextRange(factory.createParenthesizedExpression(expression), expression); + } + function parenthesizeOperandOfPostfixUnary(operand) { + return ts6.isLeftHandSideExpression(operand) ? operand : ts6.setTextRange(factory.createParenthesizedExpression(operand), operand); + } + function parenthesizeOperandOfPrefixUnary(operand) { + return ts6.isUnaryExpression(operand) ? operand : ts6.setTextRange(factory.createParenthesizedExpression(operand), operand); + } + function parenthesizeExpressionsOfCommaDelimitedList(elements) { + var result = ts6.sameMap(elements, parenthesizeExpressionForDisallowedComma); + return ts6.setTextRange(factory.createNodeArray(result, elements.hasTrailingComma), elements); + } + function parenthesizeExpressionForDisallowedComma(expression) { + var emittedExpression = ts6.skipPartiallyEmittedExpressions(expression); + var expressionPrecedence = ts6.getExpressionPrecedence(emittedExpression); + var commaPrecedence = ts6.getOperatorPrecedence( + 223, + 27 + /* SyntaxKind.CommaToken */ + ); + return expressionPrecedence > commaPrecedence ? expression : ts6.setTextRange(factory.createParenthesizedExpression(expression), expression); + } + function parenthesizeExpressionOfExpressionStatement(expression) { + var emittedExpression = ts6.skipPartiallyEmittedExpressions(expression); + if (ts6.isCallExpression(emittedExpression)) { + var callee = emittedExpression.expression; + var kind = ts6.skipPartiallyEmittedExpressions(callee).kind; + if (kind === 215 || kind === 216) { + var updated = factory.updateCallExpression(emittedExpression, ts6.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); + return factory.restoreOuterExpressions( + expression, + updated, + 8 + /* OuterExpressionKinds.PartiallyEmittedExpressions */ + ); + } + } + var leftmostExpressionKind = ts6.getLeftmostExpression( + emittedExpression, + /*stopAtCallExpressions*/ + false + ).kind; + if (leftmostExpressionKind === 207 || leftmostExpressionKind === 215) { + return ts6.setTextRange(factory.createParenthesizedExpression(expression), expression); + } + return expression; + } + function parenthesizeConciseBodyOfArrowFunction(body) { + if (!ts6.isBlock(body) && (ts6.isCommaSequence(body) || ts6.getLeftmostExpression( + body, + /*stopAtCallExpressions*/ + false + ).kind === 207)) { + return ts6.setTextRange(factory.createParenthesizedExpression(body), body); + } + return body; + } + function parenthesizeCheckTypeOfConditionalType(checkType) { + switch (checkType.kind) { + case 181: + case 182: + case 191: + return factory.createParenthesizedType(checkType); + } + return checkType; + } + function parenthesizeExtendsTypeOfConditionalType(extendsType) { + switch (extendsType.kind) { + case 191: + return factory.createParenthesizedType(extendsType); + } + return extendsType; + } + function parenthesizeConstituentTypeOfUnionType(type) { + switch (type.kind) { + case 189: + case 190: + return factory.createParenthesizedType(type); + } + return parenthesizeCheckTypeOfConditionalType(type); + } + function parenthesizeConstituentTypesOfUnionType(members) { + return factory.createNodeArray(ts6.sameMap(members, parenthesizeConstituentTypeOfUnionType)); + } + function parenthesizeConstituentTypeOfIntersectionType(type) { + switch (type.kind) { + case 189: + case 190: + return factory.createParenthesizedType(type); + } + return parenthesizeConstituentTypeOfUnionType(type); + } + function parenthesizeConstituentTypesOfIntersectionType(members) { + return factory.createNodeArray(ts6.sameMap(members, parenthesizeConstituentTypeOfIntersectionType)); + } + function parenthesizeOperandOfTypeOperator(type) { + switch (type.kind) { + case 190: + return factory.createParenthesizedType(type); + } + return parenthesizeConstituentTypeOfIntersectionType(type); + } + function parenthesizeOperandOfReadonlyTypeOperator(type) { + switch (type.kind) { + case 195: + return factory.createParenthesizedType(type); + } + return parenthesizeOperandOfTypeOperator(type); + } + function parenthesizeNonArrayTypeOfPostfixType(type) { + switch (type.kind) { + case 192: + case 195: + case 183: + return factory.createParenthesizedType(type); + } + return parenthesizeOperandOfTypeOperator(type); + } + function parenthesizeElementTypesOfTupleType(types) { + return factory.createNodeArray(ts6.sameMap(types, parenthesizeElementTypeOfTupleType)); + } + function parenthesizeElementTypeOfTupleType(type) { + if (hasJSDocPostfixQuestion(type)) + return factory.createParenthesizedType(type); + return type; + } + function hasJSDocPostfixQuestion(type) { + if (ts6.isJSDocNullableType(type)) + return type.postfix; + if (ts6.isNamedTupleMember(type)) + return hasJSDocPostfixQuestion(type.type); + if (ts6.isFunctionTypeNode(type) || ts6.isConstructorTypeNode(type) || ts6.isTypeOperatorNode(type)) + return hasJSDocPostfixQuestion(type.type); + if (ts6.isConditionalTypeNode(type)) + return hasJSDocPostfixQuestion(type.falseType); + if (ts6.isUnionTypeNode(type)) + return hasJSDocPostfixQuestion(ts6.last(type.types)); + if (ts6.isIntersectionTypeNode(type)) + return hasJSDocPostfixQuestion(ts6.last(type.types)); + if (ts6.isInferTypeNode(type)) + return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint); + return false; + } + function parenthesizeTypeOfOptionalType(type) { + if (hasJSDocPostfixQuestion(type)) + return factory.createParenthesizedType(type); + return parenthesizeNonArrayTypeOfPostfixType(type); + } + function parenthesizeLeadingTypeArgument(node) { + return ts6.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node; + } + function parenthesizeOrdinalTypeArgument(node, i) { + return i === 0 ? parenthesizeLeadingTypeArgument(node) : node; + } + function parenthesizeTypeArguments(typeArguments) { + if (ts6.some(typeArguments)) { + return factory.createNodeArray(ts6.sameMap(typeArguments, parenthesizeOrdinalTypeArgument)); + } + } + } + ts6.createParenthesizerRules = createParenthesizerRules; + ts6.nullParenthesizerRules = { + getParenthesizeLeftSideOfBinaryForOperator: function(_) { + return ts6.identity; + }, + getParenthesizeRightSideOfBinaryForOperator: function(_) { + return ts6.identity; + }, + parenthesizeLeftSideOfBinary: function(_binaryOperator, leftSide) { + return leftSide; + }, + parenthesizeRightSideOfBinary: function(_binaryOperator, _leftSide, rightSide) { + return rightSide; + }, + parenthesizeExpressionOfComputedPropertyName: ts6.identity, + parenthesizeConditionOfConditionalExpression: ts6.identity, + parenthesizeBranchOfConditionalExpression: ts6.identity, + parenthesizeExpressionOfExportDefault: ts6.identity, + parenthesizeExpressionOfNew: function(expression) { + return ts6.cast(expression, ts6.isLeftHandSideExpression); + }, + parenthesizeLeftSideOfAccess: function(expression) { + return ts6.cast(expression, ts6.isLeftHandSideExpression); + }, + parenthesizeOperandOfPostfixUnary: function(operand) { + return ts6.cast(operand, ts6.isLeftHandSideExpression); + }, + parenthesizeOperandOfPrefixUnary: function(operand) { + return ts6.cast(operand, ts6.isUnaryExpression); + }, + parenthesizeExpressionsOfCommaDelimitedList: function(nodes) { + return ts6.cast(nodes, ts6.isNodeArray); + }, + parenthesizeExpressionForDisallowedComma: ts6.identity, + parenthesizeExpressionOfExpressionStatement: ts6.identity, + parenthesizeConciseBodyOfArrowFunction: ts6.identity, + parenthesizeCheckTypeOfConditionalType: ts6.identity, + parenthesizeExtendsTypeOfConditionalType: ts6.identity, + parenthesizeConstituentTypesOfUnionType: function(nodes) { + return ts6.cast(nodes, ts6.isNodeArray); + }, + parenthesizeConstituentTypeOfUnionType: ts6.identity, + parenthesizeConstituentTypesOfIntersectionType: function(nodes) { + return ts6.cast(nodes, ts6.isNodeArray); + }, + parenthesizeConstituentTypeOfIntersectionType: ts6.identity, + parenthesizeOperandOfTypeOperator: ts6.identity, + parenthesizeOperandOfReadonlyTypeOperator: ts6.identity, + parenthesizeNonArrayTypeOfPostfixType: ts6.identity, + parenthesizeElementTypesOfTupleType: function(nodes) { + return ts6.cast(nodes, ts6.isNodeArray); + }, + parenthesizeElementTypeOfTupleType: ts6.identity, + parenthesizeTypeOfOptionalType: ts6.identity, + parenthesizeTypeArguments: function(nodes) { + return nodes && ts6.cast(nodes, ts6.isNodeArray); + }, + parenthesizeLeadingTypeArgument: ts6.identity + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createNodeConverters(factory) { + return { + convertToFunctionBlock, + convertToFunctionExpression, + convertToArrayAssignmentElement, + convertToObjectAssignmentElement, + convertToAssignmentPattern, + convertToObjectAssignmentPattern, + convertToArrayAssignmentPattern, + convertToAssignmentElementTarget + }; + function convertToFunctionBlock(node, multiLine) { + if (ts6.isBlock(node)) + return node; + var returnStatement = factory.createReturnStatement(node); + ts6.setTextRange(returnStatement, node); + var body = factory.createBlock([returnStatement], multiLine); + ts6.setTextRange(body, node); + return body; + } + function convertToFunctionExpression(node) { + if (!node.body) + return ts6.Debug.fail("Cannot convert a FunctionDeclaration without a body"); + var updated = factory.createFunctionExpression(node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body); + ts6.setOriginalNode(updated, node); + ts6.setTextRange(updated, node); + if (ts6.getStartsOnNewLine(node)) { + ts6.setStartsOnNewLine( + updated, + /*newLine*/ + true + ); + } + return updated; + } + function convertToArrayAssignmentElement(element) { + if (ts6.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts6.Debug.assertNode(element.name, ts6.isIdentifier); + return ts6.setOriginalNode(ts6.setTextRange(factory.createSpreadElement(element.name), element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer ? ts6.setOriginalNode(ts6.setTextRange(factory.createAssignment(expression, element.initializer), element), element) : expression; + } + return ts6.cast(element, ts6.isExpression); + } + function convertToObjectAssignmentElement(element) { + if (ts6.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts6.Debug.assertNode(element.name, ts6.isIdentifier); + return ts6.setOriginalNode(ts6.setTextRange(factory.createSpreadAssignment(element.name), element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return ts6.setOriginalNode(ts6.setTextRange(factory.createPropertyAssignment(element.propertyName, element.initializer ? factory.createAssignment(expression, element.initializer) : expression), element), element); + } + ts6.Debug.assertNode(element.name, ts6.isIdentifier); + return ts6.setOriginalNode(ts6.setTextRange(factory.createShorthandPropertyAssignment(element.name, element.initializer), element), element); + } + return ts6.cast(element, ts6.isObjectLiteralElementLike); + } + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 204: + case 206: + return convertToArrayAssignmentPattern(node); + case 203: + case 207: + return convertToObjectAssignmentPattern(node); + } + } + function convertToObjectAssignmentPattern(node) { + if (ts6.isObjectBindingPattern(node)) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createObjectLiteralExpression(ts6.map(node.elements, convertToObjectAssignmentElement)), node), node); + } + return ts6.cast(node, ts6.isObjectLiteralExpression); + } + function convertToArrayAssignmentPattern(node) { + if (ts6.isArrayBindingPattern(node)) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createArrayLiteralExpression(ts6.map(node.elements, convertToArrayAssignmentElement)), node), node); + } + return ts6.cast(node, ts6.isArrayLiteralExpression); + } + function convertToAssignmentElementTarget(node) { + if (ts6.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + return ts6.cast(node, ts6.isExpression); + } + } + ts6.createNodeConverters = createNodeConverters; + ts6.nullNodeConverters = { + convertToFunctionBlock: ts6.notImplemented, + convertToFunctionExpression: ts6.notImplemented, + convertToArrayAssignmentElement: ts6.notImplemented, + convertToObjectAssignmentElement: ts6.notImplemented, + convertToAssignmentPattern: ts6.notImplemented, + convertToObjectAssignmentPattern: ts6.notImplemented, + convertToArrayAssignmentPattern: ts6.notImplemented, + convertToAssignmentElementTarget: ts6.notImplemented + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var nextAutoGenerateId = 0; + var NodeFactoryFlags; + (function(NodeFactoryFlags2) { + NodeFactoryFlags2[NodeFactoryFlags2["None"] = 0] = "None"; + NodeFactoryFlags2[NodeFactoryFlags2["NoParenthesizerRules"] = 1] = "NoParenthesizerRules"; + NodeFactoryFlags2[NodeFactoryFlags2["NoNodeConverters"] = 2] = "NoNodeConverters"; + NodeFactoryFlags2[NodeFactoryFlags2["NoIndentationOnFreshPropertyAccess"] = 4] = "NoIndentationOnFreshPropertyAccess"; + NodeFactoryFlags2[NodeFactoryFlags2["NoOriginalNode"] = 8] = "NoOriginalNode"; + })(NodeFactoryFlags = ts6.NodeFactoryFlags || (ts6.NodeFactoryFlags = {})); + function createNodeFactory(flags, baseFactory2) { + var update = flags & 8 ? updateWithoutOriginal : updateWithOriginal; + var parenthesizerRules = ts6.memoize(function() { + return flags & 1 ? ts6.nullParenthesizerRules : ts6.createParenthesizerRules(factory); + }); + var converters = ts6.memoize(function() { + return flags & 2 ? ts6.nullNodeConverters : ts6.createNodeConverters(factory); + }); + var getBinaryCreateFunction = ts6.memoizeOne(function(operator) { + return function(left, right) { + return createBinaryExpression(left, operator, right); + }; + }); + var getPrefixUnaryCreateFunction = ts6.memoizeOne(function(operator) { + return function(operand) { + return createPrefixUnaryExpression(operator, operand); + }; + }); + var getPostfixUnaryCreateFunction = ts6.memoizeOne(function(operator) { + return function(operand) { + return createPostfixUnaryExpression(operand, operator); + }; + }); + var getJSDocPrimaryTypeCreateFunction = ts6.memoizeOne(function(kind) { + return function() { + return createJSDocPrimaryTypeWorker(kind); + }; + }); + var getJSDocUnaryTypeCreateFunction = ts6.memoizeOne(function(kind) { + return function(type) { + return createJSDocUnaryTypeWorker(kind, type); + }; + }); + var getJSDocUnaryTypeUpdateFunction = ts6.memoizeOne(function(kind) { + return function(node, type) { + return updateJSDocUnaryTypeWorker(kind, node, type); + }; + }); + var getJSDocPrePostfixUnaryTypeCreateFunction = ts6.memoizeOne(function(kind) { + return function(type, postfix) { + return createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix); + }; + }); + var getJSDocPrePostfixUnaryTypeUpdateFunction = ts6.memoizeOne(function(kind) { + return function(node, type) { + return updateJSDocPrePostfixUnaryTypeWorker(kind, node, type); + }; + }); + var getJSDocSimpleTagCreateFunction = ts6.memoizeOne(function(kind) { + return function(tagName, comment) { + return createJSDocSimpleTagWorker(kind, tagName, comment); + }; + }); + var getJSDocSimpleTagUpdateFunction = ts6.memoizeOne(function(kind) { + return function(node, tagName, comment) { + return updateJSDocSimpleTagWorker(kind, node, tagName, comment); + }; + }); + var getJSDocTypeLikeTagCreateFunction = ts6.memoizeOne(function(kind) { + return function(tagName, typeExpression, comment) { + return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); + }; + }); + var getJSDocTypeLikeTagUpdateFunction = ts6.memoizeOne(function(kind) { + return function(node, tagName, typeExpression, comment) { + return updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment); + }; + }); + var factory = { + get parenthesizer() { + return parenthesizerRules(); + }, + get converters() { + return converters(); + }, + baseFactory: baseFactory2, + flags, + createNodeArray, + createNumericLiteral, + createBigIntLiteral, + createStringLiteral, + createStringLiteralFromNode, + createRegularExpressionLiteral, + createLiteralLikeNode, + createIdentifier, + updateIdentifier, + createTempVariable, + createLoopVariable, + createUniqueName, + getGeneratedNameForNode, + createPrivateIdentifier, + createUniquePrivateName, + getGeneratedPrivateNameForNode, + createToken, + createSuper, + createThis, + createNull, + createTrue, + createFalse, + createModifier, + createModifiersFromModifierFlags, + createQualifiedName, + updateQualifiedName, + createComputedPropertyName, + updateComputedPropertyName, + createTypeParameterDeclaration, + updateTypeParameterDeclaration, + createParameterDeclaration, + updateParameterDeclaration, + createDecorator, + updateDecorator, + createPropertySignature, + updatePropertySignature, + createPropertyDeclaration, + updatePropertyDeclaration, + createMethodSignature, + updateMethodSignature, + createMethodDeclaration, + updateMethodDeclaration, + createConstructorDeclaration, + updateConstructorDeclaration, + createGetAccessorDeclaration, + updateGetAccessorDeclaration, + createSetAccessorDeclaration, + updateSetAccessorDeclaration, + createCallSignature, + updateCallSignature, + createConstructSignature, + updateConstructSignature, + createIndexSignature, + updateIndexSignature, + createClassStaticBlockDeclaration, + updateClassStaticBlockDeclaration, + createTemplateLiteralTypeSpan, + updateTemplateLiteralTypeSpan, + createKeywordTypeNode, + createTypePredicateNode, + updateTypePredicateNode, + createTypeReferenceNode, + updateTypeReferenceNode, + createFunctionTypeNode, + updateFunctionTypeNode, + createConstructorTypeNode, + updateConstructorTypeNode, + createTypeQueryNode, + updateTypeQueryNode, + createTypeLiteralNode, + updateTypeLiteralNode, + createArrayTypeNode, + updateArrayTypeNode, + createTupleTypeNode, + updateTupleTypeNode, + createNamedTupleMember, + updateNamedTupleMember, + createOptionalTypeNode, + updateOptionalTypeNode, + createRestTypeNode, + updateRestTypeNode, + createUnionTypeNode, + updateUnionTypeNode, + createIntersectionTypeNode, + updateIntersectionTypeNode, + createConditionalTypeNode, + updateConditionalTypeNode, + createInferTypeNode, + updateInferTypeNode, + createImportTypeNode, + updateImportTypeNode, + createParenthesizedType, + updateParenthesizedType, + createThisTypeNode, + createTypeOperatorNode, + updateTypeOperatorNode, + createIndexedAccessTypeNode, + updateIndexedAccessTypeNode, + createMappedTypeNode, + updateMappedTypeNode, + createLiteralTypeNode, + updateLiteralTypeNode, + createTemplateLiteralType, + updateTemplateLiteralType, + createObjectBindingPattern, + updateObjectBindingPattern, + createArrayBindingPattern, + updateArrayBindingPattern, + createBindingElement, + updateBindingElement, + createArrayLiteralExpression, + updateArrayLiteralExpression, + createObjectLiteralExpression, + updateObjectLiteralExpression, + createPropertyAccessExpression: flags & 4 ? function(expression, name) { + return ts6.setEmitFlags( + createPropertyAccessExpression(expression, name), + 131072 + /* EmitFlags.NoIndentation */ + ); + } : createPropertyAccessExpression, + updatePropertyAccessExpression, + createPropertyAccessChain: flags & 4 ? function(expression, questionDotToken, name) { + return ts6.setEmitFlags( + createPropertyAccessChain(expression, questionDotToken, name), + 131072 + /* EmitFlags.NoIndentation */ + ); + } : createPropertyAccessChain, + updatePropertyAccessChain, + createElementAccessExpression, + updateElementAccessExpression, + createElementAccessChain, + updateElementAccessChain, + createCallExpression, + updateCallExpression, + createCallChain, + updateCallChain, + createNewExpression, + updateNewExpression, + createTaggedTemplateExpression, + updateTaggedTemplateExpression, + createTypeAssertion, + updateTypeAssertion, + createParenthesizedExpression, + updateParenthesizedExpression, + createFunctionExpression, + updateFunctionExpression, + createArrowFunction, + updateArrowFunction, + createDeleteExpression, + updateDeleteExpression, + createTypeOfExpression, + updateTypeOfExpression, + createVoidExpression, + updateVoidExpression, + createAwaitExpression, + updateAwaitExpression, + createPrefixUnaryExpression, + updatePrefixUnaryExpression, + createPostfixUnaryExpression, + updatePostfixUnaryExpression, + createBinaryExpression, + updateBinaryExpression, + createConditionalExpression, + updateConditionalExpression, + createTemplateExpression, + updateTemplateExpression, + createTemplateHead, + createTemplateMiddle, + createTemplateTail, + createNoSubstitutionTemplateLiteral, + createTemplateLiteralLikeNode, + createYieldExpression, + updateYieldExpression, + createSpreadElement, + updateSpreadElement, + createClassExpression, + updateClassExpression, + createOmittedExpression, + createExpressionWithTypeArguments, + updateExpressionWithTypeArguments, + createAsExpression, + updateAsExpression, + createNonNullExpression, + updateNonNullExpression, + createSatisfiesExpression, + updateSatisfiesExpression, + createNonNullChain, + updateNonNullChain, + createMetaProperty, + updateMetaProperty, + createTemplateSpan, + updateTemplateSpan, + createSemicolonClassElement, + createBlock, + updateBlock, + createVariableStatement, + updateVariableStatement, + createEmptyStatement, + createExpressionStatement, + updateExpressionStatement, + createIfStatement, + updateIfStatement, + createDoStatement, + updateDoStatement, + createWhileStatement, + updateWhileStatement, + createForStatement, + updateForStatement, + createForInStatement, + updateForInStatement, + createForOfStatement, + updateForOfStatement, + createContinueStatement, + updateContinueStatement, + createBreakStatement, + updateBreakStatement, + createReturnStatement, + updateReturnStatement, + createWithStatement, + updateWithStatement, + createSwitchStatement, + updateSwitchStatement, + createLabeledStatement, + updateLabeledStatement, + createThrowStatement, + updateThrowStatement, + createTryStatement, + updateTryStatement, + createDebuggerStatement, + createVariableDeclaration, + updateVariableDeclaration, + createVariableDeclarationList, + updateVariableDeclarationList, + createFunctionDeclaration, + updateFunctionDeclaration, + createClassDeclaration, + updateClassDeclaration, + createInterfaceDeclaration, + updateInterfaceDeclaration, + createTypeAliasDeclaration, + updateTypeAliasDeclaration, + createEnumDeclaration, + updateEnumDeclaration, + createModuleDeclaration, + updateModuleDeclaration, + createModuleBlock, + updateModuleBlock, + createCaseBlock, + updateCaseBlock, + createNamespaceExportDeclaration, + updateNamespaceExportDeclaration, + createImportEqualsDeclaration, + updateImportEqualsDeclaration, + createImportDeclaration, + updateImportDeclaration, + createImportClause, + updateImportClause, + createAssertClause, + updateAssertClause, + createAssertEntry, + updateAssertEntry, + createImportTypeAssertionContainer, + updateImportTypeAssertionContainer, + createNamespaceImport, + updateNamespaceImport, + createNamespaceExport, + updateNamespaceExport, + createNamedImports, + updateNamedImports, + createImportSpecifier, + updateImportSpecifier, + createExportAssignment, + updateExportAssignment, + createExportDeclaration, + updateExportDeclaration, + createNamedExports, + updateNamedExports, + createExportSpecifier, + updateExportSpecifier, + createMissingDeclaration, + createExternalModuleReference, + updateExternalModuleReference, + // lazily load factory members for JSDoc types with similar structure + get createJSDocAllType() { + return getJSDocPrimaryTypeCreateFunction( + 315 + /* SyntaxKind.JSDocAllType */ + ); + }, + get createJSDocUnknownType() { + return getJSDocPrimaryTypeCreateFunction( + 316 + /* SyntaxKind.JSDocUnknownType */ + ); + }, + get createJSDocNonNullableType() { + return getJSDocPrePostfixUnaryTypeCreateFunction( + 318 + /* SyntaxKind.JSDocNonNullableType */ + ); + }, + get updateJSDocNonNullableType() { + return getJSDocPrePostfixUnaryTypeUpdateFunction( + 318 + /* SyntaxKind.JSDocNonNullableType */ + ); + }, + get createJSDocNullableType() { + return getJSDocPrePostfixUnaryTypeCreateFunction( + 317 + /* SyntaxKind.JSDocNullableType */ + ); + }, + get updateJSDocNullableType() { + return getJSDocPrePostfixUnaryTypeUpdateFunction( + 317 + /* SyntaxKind.JSDocNullableType */ + ); + }, + get createJSDocOptionalType() { + return getJSDocUnaryTypeCreateFunction( + 319 + /* SyntaxKind.JSDocOptionalType */ + ); + }, + get updateJSDocOptionalType() { + return getJSDocUnaryTypeUpdateFunction( + 319 + /* SyntaxKind.JSDocOptionalType */ + ); + }, + get createJSDocVariadicType() { + return getJSDocUnaryTypeCreateFunction( + 321 + /* SyntaxKind.JSDocVariadicType */ + ); + }, + get updateJSDocVariadicType() { + return getJSDocUnaryTypeUpdateFunction( + 321 + /* SyntaxKind.JSDocVariadicType */ + ); + }, + get createJSDocNamepathType() { + return getJSDocUnaryTypeCreateFunction( + 322 + /* SyntaxKind.JSDocNamepathType */ + ); + }, + get updateJSDocNamepathType() { + return getJSDocUnaryTypeUpdateFunction( + 322 + /* SyntaxKind.JSDocNamepathType */ + ); + }, + createJSDocFunctionType, + updateJSDocFunctionType, + createJSDocTypeLiteral, + updateJSDocTypeLiteral, + createJSDocTypeExpression, + updateJSDocTypeExpression, + createJSDocSignature, + updateJSDocSignature, + createJSDocTemplateTag, + updateJSDocTemplateTag, + createJSDocTypedefTag, + updateJSDocTypedefTag, + createJSDocParameterTag, + updateJSDocParameterTag, + createJSDocPropertyTag, + updateJSDocPropertyTag, + createJSDocCallbackTag, + updateJSDocCallbackTag, + createJSDocAugmentsTag, + updateJSDocAugmentsTag, + createJSDocImplementsTag, + updateJSDocImplementsTag, + createJSDocSeeTag, + updateJSDocSeeTag, + createJSDocNameReference, + updateJSDocNameReference, + createJSDocMemberName, + updateJSDocMemberName, + createJSDocLink, + updateJSDocLink, + createJSDocLinkCode, + updateJSDocLinkCode, + createJSDocLinkPlain, + updateJSDocLinkPlain, + // lazily load factory members for JSDoc tags with similar structure + get createJSDocTypeTag() { + return getJSDocTypeLikeTagCreateFunction( + 346 + /* SyntaxKind.JSDocTypeTag */ + ); + }, + get updateJSDocTypeTag() { + return getJSDocTypeLikeTagUpdateFunction( + 346 + /* SyntaxKind.JSDocTypeTag */ + ); + }, + get createJSDocReturnTag() { + return getJSDocTypeLikeTagCreateFunction( + 344 + /* SyntaxKind.JSDocReturnTag */ + ); + }, + get updateJSDocReturnTag() { + return getJSDocTypeLikeTagUpdateFunction( + 344 + /* SyntaxKind.JSDocReturnTag */ + ); + }, + get createJSDocThisTag() { + return getJSDocTypeLikeTagCreateFunction( + 345 + /* SyntaxKind.JSDocThisTag */ + ); + }, + get updateJSDocThisTag() { + return getJSDocTypeLikeTagUpdateFunction( + 345 + /* SyntaxKind.JSDocThisTag */ + ); + }, + get createJSDocEnumTag() { + return getJSDocTypeLikeTagCreateFunction( + 342 + /* SyntaxKind.JSDocEnumTag */ + ); + }, + get updateJSDocEnumTag() { + return getJSDocTypeLikeTagUpdateFunction( + 342 + /* SyntaxKind.JSDocEnumTag */ + ); + }, + get createJSDocAuthorTag() { + return getJSDocSimpleTagCreateFunction( + 333 + /* SyntaxKind.JSDocAuthorTag */ + ); + }, + get updateJSDocAuthorTag() { + return getJSDocSimpleTagUpdateFunction( + 333 + /* SyntaxKind.JSDocAuthorTag */ + ); + }, + get createJSDocClassTag() { + return getJSDocSimpleTagCreateFunction( + 335 + /* SyntaxKind.JSDocClassTag */ + ); + }, + get updateJSDocClassTag() { + return getJSDocSimpleTagUpdateFunction( + 335 + /* SyntaxKind.JSDocClassTag */ + ); + }, + get createJSDocPublicTag() { + return getJSDocSimpleTagCreateFunction( + 336 + /* SyntaxKind.JSDocPublicTag */ + ); + }, + get updateJSDocPublicTag() { + return getJSDocSimpleTagUpdateFunction( + 336 + /* SyntaxKind.JSDocPublicTag */ + ); + }, + get createJSDocPrivateTag() { + return getJSDocSimpleTagCreateFunction( + 337 + /* SyntaxKind.JSDocPrivateTag */ + ); + }, + get updateJSDocPrivateTag() { + return getJSDocSimpleTagUpdateFunction( + 337 + /* SyntaxKind.JSDocPrivateTag */ + ); + }, + get createJSDocProtectedTag() { + return getJSDocSimpleTagCreateFunction( + 338 + /* SyntaxKind.JSDocProtectedTag */ + ); + }, + get updateJSDocProtectedTag() { + return getJSDocSimpleTagUpdateFunction( + 338 + /* SyntaxKind.JSDocProtectedTag */ + ); + }, + get createJSDocReadonlyTag() { + return getJSDocSimpleTagCreateFunction( + 339 + /* SyntaxKind.JSDocReadonlyTag */ + ); + }, + get updateJSDocReadonlyTag() { + return getJSDocSimpleTagUpdateFunction( + 339 + /* SyntaxKind.JSDocReadonlyTag */ + ); + }, + get createJSDocOverrideTag() { + return getJSDocSimpleTagCreateFunction( + 340 + /* SyntaxKind.JSDocOverrideTag */ + ); + }, + get updateJSDocOverrideTag() { + return getJSDocSimpleTagUpdateFunction( + 340 + /* SyntaxKind.JSDocOverrideTag */ + ); + }, + get createJSDocDeprecatedTag() { + return getJSDocSimpleTagCreateFunction( + 334 + /* SyntaxKind.JSDocDeprecatedTag */ + ); + }, + get updateJSDocDeprecatedTag() { + return getJSDocSimpleTagUpdateFunction( + 334 + /* SyntaxKind.JSDocDeprecatedTag */ + ); + }, + createJSDocUnknownTag, + updateJSDocUnknownTag, + createJSDocText, + updateJSDocText, + createJSDocComment, + updateJSDocComment, + createJsxElement, + updateJsxElement, + createJsxSelfClosingElement, + updateJsxSelfClosingElement, + createJsxOpeningElement, + updateJsxOpeningElement, + createJsxClosingElement, + updateJsxClosingElement, + createJsxFragment, + createJsxText, + updateJsxText, + createJsxOpeningFragment, + createJsxJsxClosingFragment, + updateJsxFragment, + createJsxAttribute, + updateJsxAttribute, + createJsxAttributes, + updateJsxAttributes, + createJsxSpreadAttribute, + updateJsxSpreadAttribute, + createJsxExpression, + updateJsxExpression, + createCaseClause, + updateCaseClause, + createDefaultClause, + updateDefaultClause, + createHeritageClause, + updateHeritageClause, + createCatchClause, + updateCatchClause, + createPropertyAssignment, + updatePropertyAssignment, + createShorthandPropertyAssignment, + updateShorthandPropertyAssignment, + createSpreadAssignment, + updateSpreadAssignment, + createEnumMember, + updateEnumMember, + createSourceFile: createSourceFile2, + updateSourceFile, + createBundle, + updateBundle, + createUnparsedSource, + createUnparsedPrologue, + createUnparsedPrepend, + createUnparsedTextLike, + createUnparsedSyntheticReference, + createInputFiles: createInputFiles2, + createSyntheticExpression, + createSyntaxList, + createNotEmittedStatement, + createPartiallyEmittedExpression, + updatePartiallyEmittedExpression, + createCommaListExpression, + updateCommaListExpression, + createEndOfDeclarationMarker, + createMergeDeclarationMarker, + createSyntheticReferenceExpression, + updateSyntheticReferenceExpression, + cloneNode, + // Lazily load factory methods for common operator factories and utilities + get createComma() { + return getBinaryCreateFunction( + 27 + /* SyntaxKind.CommaToken */ + ); + }, + get createAssignment() { + return getBinaryCreateFunction( + 63 + /* SyntaxKind.EqualsToken */ + ); + }, + get createLogicalOr() { + return getBinaryCreateFunction( + 56 + /* SyntaxKind.BarBarToken */ + ); + }, + get createLogicalAnd() { + return getBinaryCreateFunction( + 55 + /* SyntaxKind.AmpersandAmpersandToken */ + ); + }, + get createBitwiseOr() { + return getBinaryCreateFunction( + 51 + /* SyntaxKind.BarToken */ + ); + }, + get createBitwiseXor() { + return getBinaryCreateFunction( + 52 + /* SyntaxKind.CaretToken */ + ); + }, + get createBitwiseAnd() { + return getBinaryCreateFunction( + 50 + /* SyntaxKind.AmpersandToken */ + ); + }, + get createStrictEquality() { + return getBinaryCreateFunction( + 36 + /* SyntaxKind.EqualsEqualsEqualsToken */ + ); + }, + get createStrictInequality() { + return getBinaryCreateFunction( + 37 + /* SyntaxKind.ExclamationEqualsEqualsToken */ + ); + }, + get createEquality() { + return getBinaryCreateFunction( + 34 + /* SyntaxKind.EqualsEqualsToken */ + ); + }, + get createInequality() { + return getBinaryCreateFunction( + 35 + /* SyntaxKind.ExclamationEqualsToken */ + ); + }, + get createLessThan() { + return getBinaryCreateFunction( + 29 + /* SyntaxKind.LessThanToken */ + ); + }, + get createLessThanEquals() { + return getBinaryCreateFunction( + 32 + /* SyntaxKind.LessThanEqualsToken */ + ); + }, + get createGreaterThan() { + return getBinaryCreateFunction( + 31 + /* SyntaxKind.GreaterThanToken */ + ); + }, + get createGreaterThanEquals() { + return getBinaryCreateFunction( + 33 + /* SyntaxKind.GreaterThanEqualsToken */ + ); + }, + get createLeftShift() { + return getBinaryCreateFunction( + 47 + /* SyntaxKind.LessThanLessThanToken */ + ); + }, + get createRightShift() { + return getBinaryCreateFunction( + 48 + /* SyntaxKind.GreaterThanGreaterThanToken */ + ); + }, + get createUnsignedRightShift() { + return getBinaryCreateFunction( + 49 + /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */ + ); + }, + get createAdd() { + return getBinaryCreateFunction( + 39 + /* SyntaxKind.PlusToken */ + ); + }, + get createSubtract() { + return getBinaryCreateFunction( + 40 + /* SyntaxKind.MinusToken */ + ); + }, + get createMultiply() { + return getBinaryCreateFunction( + 41 + /* SyntaxKind.AsteriskToken */ + ); + }, + get createDivide() { + return getBinaryCreateFunction( + 43 + /* SyntaxKind.SlashToken */ + ); + }, + get createModulo() { + return getBinaryCreateFunction( + 44 + /* SyntaxKind.PercentToken */ + ); + }, + get createExponent() { + return getBinaryCreateFunction( + 42 + /* SyntaxKind.AsteriskAsteriskToken */ + ); + }, + get createPrefixPlus() { + return getPrefixUnaryCreateFunction( + 39 + /* SyntaxKind.PlusToken */ + ); + }, + get createPrefixMinus() { + return getPrefixUnaryCreateFunction( + 40 + /* SyntaxKind.MinusToken */ + ); + }, + get createPrefixIncrement() { + return getPrefixUnaryCreateFunction( + 45 + /* SyntaxKind.PlusPlusToken */ + ); + }, + get createPrefixDecrement() { + return getPrefixUnaryCreateFunction( + 46 + /* SyntaxKind.MinusMinusToken */ + ); + }, + get createBitwiseNot() { + return getPrefixUnaryCreateFunction( + 54 + /* SyntaxKind.TildeToken */ + ); + }, + get createLogicalNot() { + return getPrefixUnaryCreateFunction( + 53 + /* SyntaxKind.ExclamationToken */ + ); + }, + get createPostfixIncrement() { + return getPostfixUnaryCreateFunction( + 45 + /* SyntaxKind.PlusPlusToken */ + ); + }, + get createPostfixDecrement() { + return getPostfixUnaryCreateFunction( + 46 + /* SyntaxKind.MinusMinusToken */ + ); + }, + // Compound nodes + createImmediatelyInvokedFunctionExpression, + createImmediatelyInvokedArrowFunction, + createVoidZero, + createExportDefault, + createExternalModuleExport, + createTypeCheck, + createMethodCall, + createGlobalMethodCall, + createFunctionBindCall, + createFunctionCallCall, + createFunctionApplyCall, + createArraySliceCall, + createArrayConcatCall, + createObjectDefinePropertyCall, + createReflectGetCall, + createReflectSetCall, + createPropertyDescriptor, + createCallBinding, + createAssignmentTargetWrapper, + // Utilities + inlineExpressions, + getInternalName, + getLocalName, + getExportName, + getDeclarationName, + getNamespaceMemberName, + getExternalModuleOrNamespaceExportName, + restoreOuterExpressions, + restoreEnclosingLabel, + createUseStrictPrologue, + copyPrologue, + copyStandardPrologue, + copyCustomPrologue, + ensureUseStrict, + liftToBlock, + mergeLexicalEnvironment, + updateModifiers + }; + return factory; + function createNodeArray(elements, hasTrailingComma) { + if (elements === void 0 || elements === ts6.emptyArray) { + elements = []; + } else if (ts6.isNodeArray(elements)) { + if (hasTrailingComma === void 0 || elements.hasTrailingComma === hasTrailingComma) { + if (elements.transformFlags === void 0) { + aggregateChildrenFlags(elements); + } + ts6.Debug.attachNodeArrayDebugInfo(elements); + return elements; + } + var array_8 = elements.slice(); + array_8.pos = elements.pos; + array_8.end = elements.end; + array_8.hasTrailingComma = hasTrailingComma; + array_8.transformFlags = elements.transformFlags; + ts6.Debug.attachNodeArrayDebugInfo(array_8); + return array_8; + } + var length = elements.length; + var array = length >= 1 && length <= 4 ? elements.slice() : elements; + ts6.setTextRangePosEnd(array, -1, -1); + array.hasTrailingComma = !!hasTrailingComma; + aggregateChildrenFlags(array); + ts6.Debug.attachNodeArrayDebugInfo(array); + return array; + } + function createBaseNode(kind) { + return baseFactory2.createBaseNode(kind); + } + function createBaseDeclaration(kind) { + var node = createBaseNode(kind); + node.symbol = void 0; + node.localSymbol = void 0; + node.locals = void 0; + node.nextContainer = void 0; + return node; + } + function createBaseNamedDeclaration(kind, modifiers, name) { + var node = createBaseDeclaration(kind); + name = asName(name); + node.name = name; + if (ts6.canHaveModifiers(node)) { + node.modifiers = asNodeArray(modifiers); + node.transformFlags |= propagateChildrenFlags(node.modifiers); + } + if (name) { + switch (node.kind) { + case 171: + case 174: + case 175: + case 169: + case 299: + if (ts6.isIdentifier(name)) { + node.transformFlags |= propagateIdentifierNameFlags(name); + break; + } + default: + node.transformFlags |= propagateChildFlags(name); + break; + } + } + return node; + } + function createBaseGenericNamedDeclaration(kind, modifiers, name, typeParameters) { + var node = createBaseNamedDeclaration(kind, modifiers, name); + node.typeParameters = asNodeArray(typeParameters); + node.transformFlags |= propagateChildrenFlags(node.typeParameters); + if (typeParameters) + node.transformFlags |= 1; + return node; + } + function createBaseSignatureDeclaration(kind, modifiers, name, typeParameters, parameters, type) { + var node = createBaseGenericNamedDeclaration(kind, modifiers, name, typeParameters); + node.parameters = createNodeArray(parameters); + node.type = type; + node.transformFlags |= propagateChildrenFlags(node.parameters) | propagateChildFlags(node.type); + if (type) + node.transformFlags |= 1; + node.typeArguments = void 0; + return node; + } + function finishUpdateBaseSignatureDeclaration(updated, original) { + if (updated !== original) { + updated.typeArguments = original.typeArguments; + } + return update(updated, original); + } + function createBaseFunctionLikeDeclaration(kind, modifiers, name, typeParameters, parameters, type, body) { + var node = createBaseSignatureDeclaration(kind, modifiers, name, typeParameters, parameters, type); + node.body = body; + node.transformFlags |= propagateChildFlags(node.body) & ~67108864; + if (!body) + node.transformFlags |= 1; + return node; + } + function createBaseInterfaceOrClassLikeDeclaration(kind, modifiers, name, typeParameters, heritageClauses) { + var node = createBaseGenericNamedDeclaration(kind, modifiers, name, typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); + node.transformFlags |= propagateChildrenFlags(node.heritageClauses); + return node; + } + function createBaseClassLikeDeclaration(kind, modifiers, name, typeParameters, heritageClauses, members) { + var node = createBaseInterfaceOrClassLikeDeclaration(kind, modifiers, name, typeParameters, heritageClauses); + node.members = createNodeArray(members); + node.transformFlags |= propagateChildrenFlags(node.members); + return node; + } + function createBaseBindingLikeDeclaration(kind, modifiers, name, initializer) { + var node = createBaseNamedDeclaration(kind, modifiers, name); + node.initializer = initializer; + node.transformFlags |= propagateChildFlags(node.initializer); + return node; + } + function createBaseVariableLikeDeclaration(kind, modifiers, name, type, initializer) { + var node = createBaseBindingLikeDeclaration(kind, modifiers, name, initializer); + node.type = type; + node.transformFlags |= propagateChildFlags(type); + if (type) + node.transformFlags |= 1; + return node; + } + function createBaseLiteral(kind, text) { + var node = createBaseToken(kind); + node.text = text; + return node; + } + function createNumericLiteral(value, numericLiteralFlags) { + if (numericLiteralFlags === void 0) { + numericLiteralFlags = 0; + } + var node = createBaseLiteral(8, typeof value === "number" ? value + "" : value); + node.numericLiteralFlags = numericLiteralFlags; + if (numericLiteralFlags & 384) + node.transformFlags |= 1024; + return node; + } + function createBigIntLiteral(value) { + var node = createBaseLiteral(9, typeof value === "string" ? value : ts6.pseudoBigIntToString(value) + "n"); + node.transformFlags |= 4; + return node; + } + function createBaseStringLiteral(text, isSingleQuote) { + var node = createBaseLiteral(10, text); + node.singleQuote = isSingleQuote; + return node; + } + function createStringLiteral(text, isSingleQuote, hasExtendedUnicodeEscape) { + var node = createBaseStringLiteral(text, isSingleQuote); + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + if (hasExtendedUnicodeEscape) + node.transformFlags |= 1024; + return node; + } + function createStringLiteralFromNode(sourceNode) { + var node = createBaseStringLiteral( + ts6.getTextOfIdentifierOrLiteral(sourceNode), + /*isSingleQuote*/ + void 0 + ); + node.textSourceNode = sourceNode; + return node; + } + function createRegularExpressionLiteral(text) { + var node = createBaseLiteral(13, text); + return node; + } + function createLiteralLikeNode(kind, text) { + switch (kind) { + case 8: + return createNumericLiteral( + text, + /*numericLiteralFlags*/ + 0 + ); + case 9: + return createBigIntLiteral(text); + case 10: + return createStringLiteral( + text, + /*isSingleQuote*/ + void 0 + ); + case 11: + return createJsxText( + text, + /*containsOnlyTriviaWhiteSpaces*/ + false + ); + case 12: + return createJsxText( + text, + /*containsOnlyTriviaWhiteSpaces*/ + true + ); + case 13: + return createRegularExpressionLiteral(text); + case 14: + return createTemplateLiteralLikeNode( + kind, + text, + /*rawText*/ + void 0, + /*templateFlags*/ + 0 + ); + } + } + function createBaseIdentifier(text, originalKeywordKind) { + if (originalKeywordKind === void 0 && text) { + originalKeywordKind = ts6.stringToToken(text); + } + if (originalKeywordKind === 79) { + originalKeywordKind = void 0; + } + var node = baseFactory2.createBaseIdentifierNode( + 79 + /* SyntaxKind.Identifier */ + ); + node.originalKeywordKind = originalKeywordKind; + node.escapedText = ts6.escapeLeadingUnderscores(text); + return node; + } + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix2, suffix) { + var node = createBaseIdentifier( + text, + /*originalKeywordKind*/ + void 0 + ); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix2; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; + return node; + } + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { + var node = createBaseIdentifier(text, originalKeywordKind); + if (typeArguments) { + node.typeArguments = createNodeArray(typeArguments); + } + if (node.originalKeywordKind === 133) { + node.transformFlags |= 67108864; + } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024; + } + return node; + } + function updateIdentifier(node, typeArguments) { + return node.typeArguments !== typeArguments ? update(createIdentifier(ts6.idText(node), typeArguments), node) : node; + } + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix2, suffix) { + var flags2 = 1; + if (reservedInNestedScopes) + flags2 |= 8; + var name = createBaseGeneratedIdentifier("", flags2, prefix2, suffix); + if (recordTempVariable) { + recordTempVariable(name); + } + return name; + } + function createLoopVariable(reservedInNestedScopes) { + var flags2 = 2; + if (reservedInNestedScopes) + flags2 |= 8; + return createBaseGeneratedIdentifier( + "", + flags2, + /*prefix*/ + void 0, + /*suffix*/ + void 0 + ); + } + function createUniqueName(text, flags2, prefix2, suffix) { + if (flags2 === void 0) { + flags2 = 0; + } + ts6.Debug.assert(!(flags2 & 7), "Argument out of range: flags"); + ts6.Debug.assert((flags2 & (16 | 32)) !== 32, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); + return createBaseGeneratedIdentifier(text, 3 | flags2, prefix2, suffix); + } + function getGeneratedNameForNode(node, flags2, prefix2, suffix) { + if (flags2 === void 0) { + flags2 = 0; + } + ts6.Debug.assert(!(flags2 & 7), "Argument out of range: flags"); + var text = !node ? "" : ts6.isMemberName(node) ? ts6.formatGeneratedName( + /*privateName*/ + false, + prefix2, + node, + suffix, + ts6.idText + ) : "generated@".concat(ts6.getNodeId(node)); + if (prefix2 || suffix) + flags2 |= 16; + var name = createBaseGeneratedIdentifier(text, 4 | flags2, prefix2, suffix); + name.original = node; + return name; + } + function createBasePrivateIdentifier(text) { + var node = baseFactory2.createBasePrivateIdentifierNode( + 80 + /* SyntaxKind.PrivateIdentifier */ + ); + node.escapedText = ts6.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216; + return node; + } + function createPrivateIdentifier(text) { + if (!ts6.startsWith(text, "#")) + ts6.Debug.fail("First character of private identifier must be #: " + text); + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix2, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix2; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; + return node; + } + function createUniquePrivateName(text, prefix2, suffix) { + if (text && !ts6.startsWith(text, "#")) + ts6.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 | (text ? 3 : 1); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix2, suffix); + } + function getGeneratedPrivateNameForNode(node, prefix2, suffix) { + var text = ts6.isMemberName(node) ? ts6.formatGeneratedName( + /*privateName*/ + true, + prefix2, + node, + suffix, + ts6.idText + ) : "#generated@".concat(ts6.getNodeId(node)); + var flags2 = prefix2 || suffix ? 16 : 0; + var name = createBaseGeneratedPrivateIdentifier(text, 4 | flags2, prefix2, suffix); + name.original = node; + return name; + } + function createBaseToken(kind) { + return baseFactory2.createBaseTokenNode(kind); + } + function createToken(token) { + ts6.Debug.assert(token >= 0 && token <= 162, "Invalid token"); + ts6.Debug.assert(token <= 14 || token >= 17, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); + ts6.Debug.assert(token <= 8 || token >= 14, "Invalid token. Use 'createLiteralLikeNode' to create literals."); + ts6.Debug.assert(token !== 79, "Invalid token. Use 'createIdentifier' to create identifiers"); + var node = createBaseToken(token); + var transformFlags = 0; + switch (token) { + case 132: + transformFlags = 256 | 128; + break; + case 123: + case 121: + case 122: + case 146: + case 126: + case 136: + case 85: + case 131: + case 148: + case 160: + case 144: + case 149: + case 101: + case 145: + case 161: + case 152: + case 134: + case 153: + case 114: + case 157: + case 155: + transformFlags = 1; + break; + case 106: + transformFlags = 1024 | 134217728; + break; + case 124: + transformFlags = 1024; + break; + case 127: + transformFlags = 16777216; + break; + case 108: + transformFlags = 16384; + break; + } + if (transformFlags) { + node.transformFlags |= transformFlags; + } + return node; + } + function createSuper() { + return createToken( + 106 + /* SyntaxKind.SuperKeyword */ + ); + } + function createThis() { + return createToken( + 108 + /* SyntaxKind.ThisKeyword */ + ); + } + function createNull() { + return createToken( + 104 + /* SyntaxKind.NullKeyword */ + ); + } + function createTrue() { + return createToken( + 110 + /* SyntaxKind.TrueKeyword */ + ); + } + function createFalse() { + return createToken( + 95 + /* SyntaxKind.FalseKeyword */ + ); + } + function createModifier(kind) { + return createToken(kind); + } + function createModifiersFromModifierFlags(flags2) { + var result = []; + if (flags2 & 1) + result.push(createModifier( + 93 + /* SyntaxKind.ExportKeyword */ + )); + if (flags2 & 2) + result.push(createModifier( + 136 + /* SyntaxKind.DeclareKeyword */ + )); + if (flags2 & 1024) + result.push(createModifier( + 88 + /* SyntaxKind.DefaultKeyword */ + )); + if (flags2 & 2048) + result.push(createModifier( + 85 + /* SyntaxKind.ConstKeyword */ + )); + if (flags2 & 4) + result.push(createModifier( + 123 + /* SyntaxKind.PublicKeyword */ + )); + if (flags2 & 8) + result.push(createModifier( + 121 + /* SyntaxKind.PrivateKeyword */ + )); + if (flags2 & 16) + result.push(createModifier( + 122 + /* SyntaxKind.ProtectedKeyword */ + )); + if (flags2 & 256) + result.push(createModifier( + 126 + /* SyntaxKind.AbstractKeyword */ + )); + if (flags2 & 32) + result.push(createModifier( + 124 + /* SyntaxKind.StaticKeyword */ + )); + if (flags2 & 16384) + result.push(createModifier( + 161 + /* SyntaxKind.OverrideKeyword */ + )); + if (flags2 & 64) + result.push(createModifier( + 146 + /* SyntaxKind.ReadonlyKeyword */ + )); + if (flags2 & 128) + result.push(createModifier( + 127 + /* SyntaxKind.AccessorKeyword */ + )); + if (flags2 & 512) + result.push(createModifier( + 132 + /* SyntaxKind.AsyncKeyword */ + )); + if (flags2 & 32768) + result.push(createModifier( + 101 + /* SyntaxKind.InKeyword */ + )); + if (flags2 & 65536) + result.push(createModifier( + 145 + /* SyntaxKind.OutKeyword */ + )); + return result.length ? result : void 0; + } + function createQualifiedName(left, right) { + var node = createBaseNode( + 163 + /* SyntaxKind.QualifiedName */ + ); + node.left = left; + node.right = asName(right); + node.transformFlags |= propagateChildFlags(node.left) | propagateIdentifierNameFlags(node.right); + return node; + } + function updateQualifiedName(node, left, right) { + return node.left !== left || node.right !== right ? update(createQualifiedName(left, right), node) : node; + } + function createComputedPropertyName(expression) { + var node = createBaseNode( + 164 + /* SyntaxKind.ComputedPropertyName */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); + node.transformFlags |= propagateChildFlags(node.expression) | 1024 | 131072; + return node; + } + function updateComputedPropertyName(node, expression) { + return node.expression !== expression ? update(createComputedPropertyName(expression), node) : node; + } + function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { + var node = createBaseNamedDeclaration(165, modifiers, name); + node.constraint = constraint; + node.default = defaultType; + node.transformFlags = 1; + return node; + } + function updateTypeParameterDeclaration(node, modifiers, name, constraint, defaultType) { + return node.modifiers !== modifiers || node.name !== name || node.constraint !== constraint || node.default !== defaultType ? update(createTypeParameterDeclaration(modifiers, name, constraint, defaultType), node) : node; + } + function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createBaseVariableLikeDeclaration(166, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + node.dotDotDotToken = dotDotDotToken; + node.questionToken = questionToken; + if (ts6.isThisIdentifier(node.name)) { + node.transformFlags = 1; + } else { + node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | propagateChildFlags(node.questionToken); + if (questionToken) + node.transformFlags |= 1; + if (ts6.modifiersToFlags(node.modifiers) & 16476) + node.transformFlags |= 8192; + if (initializer || dotDotDotToken) + node.transformFlags |= 1024; + } + return node; + } + function updateParameterDeclaration(node, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type || node.initializer !== initializer ? update(createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer), node) : node; + } + function createDecorator(expression) { + var node = createBaseNode( + 167 + /* SyntaxKind.Decorator */ + ); + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + node.transformFlags |= propagateChildFlags(node.expression) | 1 | 8192 | 33554432; + return node; + } + function updateDecorator(node, expression) { + return node.expression !== expression ? update(createDecorator(expression), node) : node; + } + function createPropertySignature(modifiers, name, questionToken, type) { + var node = createBaseNamedDeclaration(168, modifiers, name); + node.type = type; + node.questionToken = questionToken; + node.transformFlags = 1; + node.initializer = void 0; + return node; + } + function updatePropertySignature(node, modifiers, name, questionToken, type) { + return node.modifiers !== modifiers || node.name !== name || node.questionToken !== questionToken || node.type !== type ? finishUpdatePropertySignature(createPropertySignature(modifiers, name, questionToken, type), node) : node; + } + function finishUpdatePropertySignature(updated, original) { + if (updated !== original) { + updated.initializer = original.initializer; + } + return update(updated, original); + } + function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { + var node = createBaseVariableLikeDeclaration(169, modifiers, name, type, initializer); + node.questionToken = questionOrExclamationToken && ts6.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0; + node.exclamationToken = questionOrExclamationToken && ts6.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0; + node.transformFlags |= propagateChildFlags(node.questionToken) | propagateChildFlags(node.exclamationToken) | 16777216; + if (ts6.isComputedPropertyName(node.name) || ts6.hasStaticModifier(node) && node.initializer) { + node.transformFlags |= 8192; + } + if (questionOrExclamationToken || ts6.modifiersToFlags(node.modifiers) & 2) { + node.transformFlags |= 1; + } + return node; + } + function updatePropertyDeclaration(node, modifiers, name, questionOrExclamationToken, type, initializer) { + return node.modifiers !== modifiers || node.name !== name || node.questionToken !== (questionOrExclamationToken !== void 0 && ts6.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0) || node.exclamationToken !== (questionOrExclamationToken !== void 0 && ts6.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0) || node.type !== type || node.initializer !== initializer ? update(createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer), node) : node; + } + function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { + var node = createBaseSignatureDeclaration(170, modifiers, name, typeParameters, parameters, type); + node.questionToken = questionToken; + node.transformFlags = 1; + return node; + } + function updateMethodSignature(node, modifiers, name, questionToken, typeParameters, parameters, type) { + return node.modifiers !== modifiers || node.name !== name || node.questionToken !== questionToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type), node) : node; + } + function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createBaseFunctionLikeDeclaration(171, modifiers, name, typeParameters, parameters, type, body); + node.asteriskToken = asteriskToken; + node.questionToken = questionToken; + node.transformFlags |= propagateChildFlags(node.asteriskToken) | propagateChildFlags(node.questionToken) | 1024; + if (questionToken) { + node.transformFlags |= 1; + } + if (ts6.modifiersToFlags(node.modifiers) & 512) { + if (asteriskToken) { + node.transformFlags |= 128; + } else { + node.transformFlags |= 256; + } + } else if (asteriskToken) { + node.transformFlags |= 2048; + } + node.exclamationToken = void 0; + return node; + } + function updateMethodDeclaration(node, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.name !== name || node.questionToken !== questionToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? finishUpdateMethodDeclaration(createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) : node; + } + function finishUpdateMethodDeclaration(updated, original) { + if (updated !== original) { + updated.exclamationToken = original.exclamationToken; + } + return update(updated, original); + } + function createClassStaticBlockDeclaration(body) { + var node = createBaseGenericNamedDeclaration( + 172, + /*modifiers*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0 + ); + node.body = body; + node.transformFlags = propagateChildFlags(body) | 16777216; + node.illegalDecorators = void 0; + node.modifiers = void 0; + return node; + } + function updateClassStaticBlockDeclaration(node, body) { + return node.body !== body ? finishUpdateClassStaticBlockDeclaration(createClassStaticBlockDeclaration(body), node) : node; + } + function finishUpdateClassStaticBlockDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + updated.modifiers = original.modifiers; + } + return update(updated, original); + } + function createConstructorDeclaration(modifiers, parameters, body) { + var node = createBaseFunctionLikeDeclaration( + 173, + modifiers, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ); + node.transformFlags |= 1024; + node.illegalDecorators = void 0; + node.typeParameters = void 0; + node.type = void 0; + return node; + } + function updateConstructorDeclaration(node, modifiers, parameters, body) { + return node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body ? finishUpdateConstructorDeclaration(createConstructorDeclaration(modifiers, parameters, body), node) : node; + } + function finishUpdateConstructorDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + updated.typeParameters = original.typeParameters; + updated.type = original.type; + } + return finishUpdateBaseSignatureDeclaration(updated, original); + } + function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { + var node = createBaseFunctionLikeDeclaration( + 174, + modifiers, + name, + /*typeParameters*/ + void 0, + parameters, + type, + body + ); + node.typeParameters = void 0; + return node; + } + function updateGetAccessorDeclaration(node, modifiers, name, parameters, type, body) { + return node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body ? finishUpdateGetAccessorDeclaration(createGetAccessorDeclaration(modifiers, name, parameters, type, body), node) : node; + } + function finishUpdateGetAccessorDeclaration(updated, original) { + if (updated !== original) { + updated.typeParameters = original.typeParameters; + } + return finishUpdateBaseSignatureDeclaration(updated, original); + } + function createSetAccessorDeclaration(modifiers, name, parameters, body) { + var node = createBaseFunctionLikeDeclaration( + 175, + modifiers, + name, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ); + node.typeParameters = void 0; + node.type = void 0; + return node; + } + function updateSetAccessorDeclaration(node, modifiers, name, parameters, body) { + return node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body ? finishUpdateSetAccessorDeclaration(createSetAccessorDeclaration(modifiers, name, parameters, body), node) : node; + } + function finishUpdateSetAccessorDeclaration(updated, original) { + if (updated !== original) { + updated.typeParameters = original.typeParameters; + updated.type = original.type; + } + return finishUpdateBaseSignatureDeclaration(updated, original); + } + function createCallSignature(typeParameters, parameters, type) { + var node = createBaseSignatureDeclaration( + 176, + /*modifiers*/ + void 0, + /*name*/ + void 0, + typeParameters, + parameters, + type + ); + node.transformFlags = 1; + return node; + } + function updateCallSignature(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createCallSignature(typeParameters, parameters, type), node) : node; + } + function createConstructSignature(typeParameters, parameters, type) { + var node = createBaseSignatureDeclaration( + 177, + /*modifiers*/ + void 0, + /*name*/ + void 0, + typeParameters, + parameters, + type + ); + node.transformFlags = 1; + return node; + } + function updateConstructSignature(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createConstructSignature(typeParameters, parameters, type), node) : node; + } + function createIndexSignature(modifiers, parameters, type) { + var node = createBaseSignatureDeclaration( + 178, + modifiers, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + parameters, + type + ); + node.transformFlags = 1; + return node; + } + function updateIndexSignature(node, modifiers, parameters, type) { + return node.parameters !== parameters || node.type !== type || node.modifiers !== modifiers ? finishUpdateBaseSignatureDeclaration(createIndexSignature(modifiers, parameters, type), node) : node; + } + function createTemplateLiteralTypeSpan(type, literal2) { + var node = createBaseNode( + 201 + /* SyntaxKind.TemplateLiteralTypeSpan */ + ); + node.type = type; + node.literal = literal2; + node.transformFlags = 1; + return node; + } + function updateTemplateLiteralTypeSpan(node, type, literal2) { + return node.type !== type || node.literal !== literal2 ? update(createTemplateLiteralTypeSpan(type, literal2), node) : node; + } + function createKeywordTypeNode(kind) { + return createToken(kind); + } + function createTypePredicateNode(assertsModifier, parameterName, type) { + var node = createBaseNode( + 179 + /* SyntaxKind.TypePredicate */ + ); + node.assertsModifier = assertsModifier; + node.parameterName = asName(parameterName); + node.type = type; + node.transformFlags = 1; + return node; + } + function updateTypePredicateNode(node, assertsModifier, parameterName, type) { + return node.assertsModifier !== assertsModifier || node.parameterName !== parameterName || node.type !== type ? update(createTypePredicateNode(assertsModifier, parameterName, type), node) : node; + } + function createTypeReferenceNode(typeName, typeArguments) { + var node = createBaseNode( + 180 + /* SyntaxKind.TypeReference */ + ); + node.typeName = asName(typeName); + node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); + node.transformFlags = 1; + return node; + } + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName || node.typeArguments !== typeArguments ? update(createTypeReferenceNode(typeName, typeArguments), node) : node; + } + function createFunctionTypeNode(typeParameters, parameters, type) { + var node = createBaseSignatureDeclaration( + 181, + /*modifiers*/ + void 0, + /*name*/ + void 0, + typeParameters, + parameters, + type + ); + node.transformFlags = 1; + node.modifiers = void 0; + return node; + } + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateFunctionTypeNode(createFunctionTypeNode(typeParameters, parameters, type), node) : node; + } + function finishUpdateFunctionTypeNode(updated, original) { + if (updated !== original) { + updated.modifiers = original.modifiers; + } + return finishUpdateBaseSignatureDeclaration(updated, original); + } + function createConstructorTypeNode() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return args.length === 4 ? createConstructorTypeNode1.apply(void 0, args) : args.length === 3 ? createConstructorTypeNode2.apply(void 0, args) : ts6.Debug.fail("Incorrect number of arguments specified."); + } + function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { + var node = createBaseSignatureDeclaration( + 182, + modifiers, + /*name*/ + void 0, + typeParameters, + parameters, + type + ); + node.transformFlags = 1; + return node; + } + function createConstructorTypeNode2(typeParameters, parameters, type) { + return createConstructorTypeNode1( + /*modifiers*/ + void 0, + typeParameters, + parameters, + type + ); + } + function updateConstructorTypeNode() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return args.length === 5 ? updateConstructorTypeNode1.apply(void 0, args) : args.length === 4 ? updateConstructorTypeNode2.apply(void 0, args) : ts6.Debug.fail("Incorrect number of arguments specified."); + } + function updateConstructorTypeNode1(node, modifiers, typeParameters, parameters, type) { + return node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createConstructorTypeNode(modifiers, typeParameters, parameters, type), node) : node; + } + function updateConstructorTypeNode2(node, typeParameters, parameters, type) { + return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type); + } + function createTypeQueryNode(exprName, typeArguments) { + var node = createBaseNode( + 183 + /* SyntaxKind.TypeQuery */ + ); + node.exprName = exprName; + node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); + node.transformFlags = 1; + return node; + } + function updateTypeQueryNode(node, exprName, typeArguments) { + return node.exprName !== exprName || node.typeArguments !== typeArguments ? update(createTypeQueryNode(exprName, typeArguments), node) : node; + } + function createTypeLiteralNode(members) { + var node = createBaseNode( + 184 + /* SyntaxKind.TypeLiteral */ + ); + node.members = createNodeArray(members); + node.transformFlags = 1; + return node; + } + function updateTypeLiteralNode(node, members) { + return node.members !== members ? update(createTypeLiteralNode(members), node) : node; + } + function createArrayTypeNode(elementType) { + var node = createBaseNode( + 185 + /* SyntaxKind.ArrayType */ + ); + node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); + node.transformFlags = 1; + return node; + } + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType ? update(createArrayTypeNode(elementType), node) : node; + } + function createTupleTypeNode(elements) { + var node = createBaseNode( + 186 + /* SyntaxKind.TupleType */ + ); + node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); + node.transformFlags = 1; + return node; + } + function updateTupleTypeNode(node, elements) { + return node.elements !== elements ? update(createTupleTypeNode(elements), node) : node; + } + function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { + var node = createBaseNode( + 199 + /* SyntaxKind.NamedTupleMember */ + ); + node.dotDotDotToken = dotDotDotToken; + node.name = name; + node.questionToken = questionToken; + node.type = type; + node.transformFlags = 1; + return node; + } + function updateNamedTupleMember(node, dotDotDotToken, name, questionToken, type) { + return node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type ? update(createNamedTupleMember(dotDotDotToken, name, questionToken, type), node) : node; + } + function createOptionalTypeNode(type) { + var node = createBaseNode( + 187 + /* SyntaxKind.OptionalType */ + ); + node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); + node.transformFlags = 1; + return node; + } + function updateOptionalTypeNode(node, type) { + return node.type !== type ? update(createOptionalTypeNode(type), node) : node; + } + function createRestTypeNode(type) { + var node = createBaseNode( + 188 + /* SyntaxKind.RestType */ + ); + node.type = type; + node.transformFlags = 1; + return node; + } + function updateRestTypeNode(node, type) { + return node.type !== type ? update(createRestTypeNode(type), node) : node; + } + function createUnionOrIntersectionTypeNode(kind, types, parenthesize) { + var node = createBaseNode(kind); + node.types = factory.createNodeArray(parenthesize(types)); + node.transformFlags = 1; + return node; + } + function updateUnionOrIntersectionTypeNode(node, types, parenthesize) { + return node.types !== types ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node) : node; + } + function createUnionTypeNode(types) { + return createUnionOrIntersectionTypeNode(189, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + } + function updateUnionTypeNode(node, types) { + return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + } + function createIntersectionTypeNode(types) { + return createUnionOrIntersectionTypeNode(190, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + } + function updateIntersectionTypeNode(node, types) { + return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + } + function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { + var node = createBaseNode( + 191 + /* SyntaxKind.ConditionalType */ + ); + node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); + node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); + node.trueType = trueType; + node.falseType = falseType; + node.transformFlags = 1; + return node; + } + function updateConditionalTypeNode(node, checkType, extendsType, trueType, falseType) { + return node.checkType !== checkType || node.extendsType !== extendsType || node.trueType !== trueType || node.falseType !== falseType ? update(createConditionalTypeNode(checkType, extendsType, trueType, falseType), node) : node; + } + function createInferTypeNode(typeParameter) { + var node = createBaseNode( + 192 + /* SyntaxKind.InferType */ + ); + node.typeParameter = typeParameter; + node.transformFlags = 1; + return node; + } + function updateInferTypeNode(node, typeParameter) { + return node.typeParameter !== typeParameter ? update(createInferTypeNode(typeParameter), node) : node; + } + function createTemplateLiteralType(head, templateSpans) { + var node = createBaseNode( + 200 + /* SyntaxKind.TemplateLiteralType */ + ); + node.head = head; + node.templateSpans = createNodeArray(templateSpans); + node.transformFlags = 1; + return node; + } + function updateTemplateLiteralType(node, head, templateSpans) { + return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateLiteralType(head, templateSpans), node) : node; + } + function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { + if (isTypeOf === void 0) { + isTypeOf = false; + } + var node = createBaseNode( + 202 + /* SyntaxKind.ImportType */ + ); + node.argument = argument; + node.assertions = assertions; + node.qualifier = qualifier; + node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); + node.isTypeOf = isTypeOf; + node.transformFlags = 1; + return node; + } + function updateImportTypeNode(node, argument, assertions, qualifier, typeArguments, isTypeOf) { + if (isTypeOf === void 0) { + isTypeOf = node.isTypeOf; + } + return node.argument !== argument || node.assertions !== assertions || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf ? update(createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf), node) : node; + } + function createParenthesizedType(type) { + var node = createBaseNode( + 193 + /* SyntaxKind.ParenthesizedType */ + ); + node.type = type; + node.transformFlags = 1; + return node; + } + function updateParenthesizedType(node, type) { + return node.type !== type ? update(createParenthesizedType(type), node) : node; + } + function createThisTypeNode() { + var node = createBaseNode( + 194 + /* SyntaxKind.ThisType */ + ); + node.transformFlags = 1; + return node; + } + function createTypeOperatorNode(operator, type) { + var node = createBaseNode( + 195 + /* SyntaxKind.TypeOperator */ + ); + node.operator = operator; + node.type = operator === 146 ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); + node.transformFlags = 1; + return node; + } + function updateTypeOperatorNode(node, type) { + return node.type !== type ? update(createTypeOperatorNode(node.operator, type), node) : node; + } + function createIndexedAccessTypeNode(objectType, indexType) { + var node = createBaseNode( + 196 + /* SyntaxKind.IndexedAccessType */ + ); + node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); + node.indexType = indexType; + node.transformFlags = 1; + return node; + } + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType || node.indexType !== indexType ? update(createIndexedAccessTypeNode(objectType, indexType), node) : node; + } + function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { + var node = createBaseNode( + 197 + /* SyntaxKind.MappedType */ + ); + node.readonlyToken = readonlyToken; + node.typeParameter = typeParameter; + node.nameType = nameType; + node.questionToken = questionToken; + node.type = type; + node.members = members && createNodeArray(members); + node.transformFlags = 1; + return node; + } + function updateMappedTypeNode(node, readonlyToken, typeParameter, nameType, questionToken, type, members) { + return node.readonlyToken !== readonlyToken || node.typeParameter !== typeParameter || node.nameType !== nameType || node.questionToken !== questionToken || node.type !== type || node.members !== members ? update(createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), node) : node; + } + function createLiteralTypeNode(literal2) { + var node = createBaseNode( + 198 + /* SyntaxKind.LiteralType */ + ); + node.literal = literal2; + node.transformFlags = 1; + return node; + } + function updateLiteralTypeNode(node, literal2) { + return node.literal !== literal2 ? update(createLiteralTypeNode(literal2), node) : node; + } + function createObjectBindingPattern(elements) { + var node = createBaseNode( + 203 + /* SyntaxKind.ObjectBindingPattern */ + ); + node.elements = createNodeArray(elements); + node.transformFlags |= propagateChildrenFlags(node.elements) | 1024 | 524288; + if (node.transformFlags & 32768) { + node.transformFlags |= 128 | 65536; + } + return node; + } + function updateObjectBindingPattern(node, elements) { + return node.elements !== elements ? update(createObjectBindingPattern(elements), node) : node; + } + function createArrayBindingPattern(elements) { + var node = createBaseNode( + 204 + /* SyntaxKind.ArrayBindingPattern */ + ); + node.elements = createNodeArray(elements); + node.transformFlags |= propagateChildrenFlags(node.elements) | 1024 | 524288; + return node; + } + function updateArrayBindingPattern(node, elements) { + return node.elements !== elements ? update(createArrayBindingPattern(elements), node) : node; + } + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createBaseBindingLikeDeclaration( + 205, + /*modifiers*/ + void 0, + name, + initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer) + ); + node.propertyName = asName(propertyName); + node.dotDotDotToken = dotDotDotToken; + node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | 1024; + if (node.propertyName) { + node.transformFlags |= ts6.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : propagateChildFlags(node.propertyName); + } + if (dotDotDotToken) + node.transformFlags |= 32768; + return node; + } + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + return node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer ? update(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) : node; + } + function createBaseExpression(kind) { + var node = createBaseNode(kind); + return node; + } + function createArrayLiteralExpression(elements, multiLine) { + var node = createBaseExpression( + 206 + /* SyntaxKind.ArrayLiteralExpression */ + ); + var lastElement = elements && ts6.lastOrUndefined(elements); + var elementsArray = createNodeArray(elements, lastElement && ts6.isOmittedExpression(lastElement) ? true : void 0); + node.elements = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(elementsArray); + node.multiLine = multiLine; + node.transformFlags |= propagateChildrenFlags(node.elements); + return node; + } + function updateArrayLiteralExpression(node, elements) { + return node.elements !== elements ? update(createArrayLiteralExpression(elements, node.multiLine), node) : node; + } + function createObjectLiteralExpression(properties, multiLine) { + var node = createBaseExpression( + 207 + /* SyntaxKind.ObjectLiteralExpression */ + ); + node.properties = createNodeArray(properties); + node.multiLine = multiLine; + node.transformFlags |= propagateChildrenFlags(node.properties); + return node; + } + function updateObjectLiteralExpression(node, properties) { + return node.properties !== properties ? update(createObjectLiteralExpression(properties, node.multiLine), node) : node; + } + function createPropertyAccessExpression(expression, name) { + var node = createBaseExpression( + 208 + /* SyntaxKind.PropertyAccessExpression */ + ); + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + node.name = asName(name); + node.transformFlags = propagateChildFlags(node.expression) | (ts6.isIdentifier(node.name) ? propagateIdentifierNameFlags(node.name) : propagateChildFlags(node.name) | 536870912); + if (ts6.isSuperKeyword(expression)) { + node.transformFlags |= 256 | 128; + } + return node; + } + function updatePropertyAccessExpression(node, expression, name) { + if (ts6.isPropertyAccessChain(node)) { + return updatePropertyAccessChain(node, expression, node.questionDotToken, ts6.cast(name, ts6.isIdentifier)); + } + return node.expression !== expression || node.name !== name ? update(createPropertyAccessExpression(expression, name), node) : node; + } + function createPropertyAccessChain(expression, questionDotToken, name) { + var node = createBaseExpression( + 208 + /* SyntaxKind.PropertyAccessExpression */ + ); + node.flags |= 32; + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + true + ); + node.questionDotToken = questionDotToken; + node.name = asName(name); + node.transformFlags |= 32 | propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | (ts6.isIdentifier(node.name) ? propagateIdentifierNameFlags(node.name) : propagateChildFlags(node.name) | 536870912); + return node; + } + function updatePropertyAccessChain(node, expression, questionDotToken, name) { + ts6.Debug.assert(!!(node.flags & 32), "Cannot update a PropertyAccessExpression using updatePropertyAccessChain. Use updatePropertyAccess instead."); + return node.expression !== expression || node.questionDotToken !== questionDotToken || node.name !== name ? update(createPropertyAccessChain(expression, questionDotToken, name), node) : node; + } + function createElementAccessExpression(expression, index) { + var node = createBaseExpression( + 209 + /* SyntaxKind.ElementAccessExpression */ + ); + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + node.argumentExpression = asExpression(index); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.argumentExpression); + if (ts6.isSuperKeyword(expression)) { + node.transformFlags |= 256 | 128; + } + return node; + } + function updateElementAccessExpression(node, expression, argumentExpression) { + if (ts6.isElementAccessChain(node)) { + return updateElementAccessChain(node, expression, node.questionDotToken, argumentExpression); + } + return node.expression !== expression || node.argumentExpression !== argumentExpression ? update(createElementAccessExpression(expression, argumentExpression), node) : node; + } + function createElementAccessChain(expression, questionDotToken, index) { + var node = createBaseExpression( + 209 + /* SyntaxKind.ElementAccessExpression */ + ); + node.flags |= 32; + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + true + ); + node.questionDotToken = questionDotToken; + node.argumentExpression = asExpression(index); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildFlags(node.argumentExpression) | 32; + return node; + } + function updateElementAccessChain(node, expression, questionDotToken, argumentExpression) { + ts6.Debug.assert(!!(node.flags & 32), "Cannot update a ElementAccessExpression using updateElementAccessChain. Use updateElementAccess instead."); + return node.expression !== expression || node.questionDotToken !== questionDotToken || node.argumentExpression !== argumentExpression ? update(createElementAccessChain(expression, questionDotToken, argumentExpression), node) : node; + } + function createCallExpression(expression, typeArguments, argumentsArray) { + var node = createBaseExpression( + 210 + /* SyntaxKind.CallExpression */ + ); + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | propagateChildrenFlags(node.arguments); + if (node.typeArguments) { + node.transformFlags |= 1; + } + if (ts6.isImportKeyword(node.expression)) { + node.transformFlags |= 8388608; + } else if (ts6.isSuperProperty(node.expression)) { + node.transformFlags |= 16384; + } + return node; + } + function updateCallExpression(node, expression, typeArguments, argumentsArray) { + if (ts6.isCallChain(node)) { + return updateCallChain(node, expression, node.questionDotToken, typeArguments, argumentsArray); + } + return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createCallExpression(expression, typeArguments, argumentsArray), node) : node; + } + function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { + var node = createBaseExpression( + 210 + /* SyntaxKind.CallExpression */ + ); + node.flags |= 32; + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + true + ); + node.questionDotToken = questionDotToken; + node.typeArguments = asNodeArray(typeArguments); + node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | propagateChildrenFlags(node.arguments) | 32; + if (node.typeArguments) { + node.transformFlags |= 1; + } + if (ts6.isSuperProperty(node.expression)) { + node.transformFlags |= 16384; + } + return node; + } + function updateCallChain(node, expression, questionDotToken, typeArguments, argumentsArray) { + ts6.Debug.assert(!!(node.flags & 32), "Cannot update a CallExpression using updateCallChain. Use updateCall instead."); + return node.expression !== expression || node.questionDotToken !== questionDotToken || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createCallChain(expression, questionDotToken, typeArguments, argumentsArray), node) : node; + } + function createNewExpression(expression, typeArguments, argumentsArray) { + var node = createBaseExpression( + 211 + /* SyntaxKind.NewExpression */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : void 0; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | propagateChildrenFlags(node.arguments) | 32; + if (node.typeArguments) { + node.transformFlags |= 1; + } + return node; + } + function updateNewExpression(node, expression, typeArguments, argumentsArray) { + return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createNewExpression(expression, typeArguments, argumentsArray), node) : node; + } + function createTaggedTemplateExpression(tag, typeArguments, template) { + var node = createBaseExpression( + 212 + /* SyntaxKind.TaggedTemplateExpression */ + ); + node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess( + tag, + /*optionalChain*/ + false + ); + node.typeArguments = asNodeArray(typeArguments); + node.template = template; + node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | propagateChildFlags(node.template) | 1024; + if (node.typeArguments) { + node.transformFlags |= 1; + } + if (ts6.hasInvalidEscape(node.template)) { + node.transformFlags |= 128; + } + return node; + } + function updateTaggedTemplateExpression(node, tag, typeArguments, template) { + return node.tag !== tag || node.typeArguments !== typeArguments || node.template !== template ? update(createTaggedTemplateExpression(tag, typeArguments, template), node) : node; + } + function createTypeAssertion(type, expression) { + var node = createBaseExpression( + 213 + /* SyntaxKind.TypeAssertionExpression */ + ); + node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); + node.type = type; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1; + return node; + } + function updateTypeAssertion(node, type, expression) { + return node.type !== type || node.expression !== expression ? update(createTypeAssertion(type, expression), node) : node; + } + function createParenthesizedExpression(expression) { + var node = createBaseExpression( + 214 + /* SyntaxKind.ParenthesizedExpression */ + ); + node.expression = expression; + node.transformFlags = propagateChildFlags(node.expression); + return node; + } + function updateParenthesizedExpression(node, expression) { + return node.expression !== expression ? update(createParenthesizedExpression(expression), node) : node; + } + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createBaseFunctionLikeDeclaration(215, modifiers, name, typeParameters, parameters, type, body); + node.asteriskToken = asteriskToken; + node.transformFlags |= propagateChildFlags(node.asteriskToken); + if (node.typeParameters) { + node.transformFlags |= 1; + } + if (ts6.modifiersToFlags(node.modifiers) & 512) { + if (node.asteriskToken) { + node.transformFlags |= 128; + } else { + node.transformFlags |= 256; + } + } else if (node.asteriskToken) { + node.transformFlags |= 2048; + } + return node; + } + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name || node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? finishUpdateBaseSignatureDeclaration(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; + } + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createBaseFunctionLikeDeclaration( + 216, + modifiers, + /*name*/ + void 0, + typeParameters, + parameters, + type, + parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body) + ); + node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ); + node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024; + if (ts6.modifiersToFlags(node.modifiers) & 512) { + node.transformFlags |= 256 | 16384; + } + return node; + } + function updateArrowFunction(node, modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + return node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.equalsGreaterThanToken !== equalsGreaterThanToken || node.body !== body ? finishUpdateBaseSignatureDeclaration(createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body), node) : node; + } + function createDeleteExpression(expression) { + var node = createBaseExpression( + 217 + /* SyntaxKind.DeleteExpression */ + ); + node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); + node.transformFlags |= propagateChildFlags(node.expression); + return node; + } + function updateDeleteExpression(node, expression) { + return node.expression !== expression ? update(createDeleteExpression(expression), node) : node; + } + function createTypeOfExpression(expression) { + var node = createBaseExpression( + 218 + /* SyntaxKind.TypeOfExpression */ + ); + node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); + node.transformFlags |= propagateChildFlags(node.expression); + return node; + } + function updateTypeOfExpression(node, expression) { + return node.expression !== expression ? update(createTypeOfExpression(expression), node) : node; + } + function createVoidExpression(expression) { + var node = createBaseExpression( + 219 + /* SyntaxKind.VoidExpression */ + ); + node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); + node.transformFlags |= propagateChildFlags(node.expression); + return node; + } + function updateVoidExpression(node, expression) { + return node.expression !== expression ? update(createVoidExpression(expression), node) : node; + } + function createAwaitExpression(expression) { + var node = createBaseExpression( + 220 + /* SyntaxKind.AwaitExpression */ + ); + node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); + node.transformFlags |= propagateChildFlags(node.expression) | 256 | 128 | 2097152; + return node; + } + function updateAwaitExpression(node, expression) { + return node.expression !== expression ? update(createAwaitExpression(expression), node) : node; + } + function createPrefixUnaryExpression(operator, operand) { + var node = createBaseExpression( + 221 + /* SyntaxKind.PrefixUnaryExpression */ + ); + node.operator = operator; + node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); + node.transformFlags |= propagateChildFlags(node.operand); + if ((operator === 45 || operator === 46) && ts6.isIdentifier(node.operand) && !ts6.isGeneratedIdentifier(node.operand) && !ts6.isLocalName(node.operand)) { + node.transformFlags |= 268435456; + } + return node; + } + function updatePrefixUnaryExpression(node, operand) { + return node.operand !== operand ? update(createPrefixUnaryExpression(node.operator, operand), node) : node; + } + function createPostfixUnaryExpression(operand, operator) { + var node = createBaseExpression( + 222 + /* SyntaxKind.PostfixUnaryExpression */ + ); + node.operator = operator; + node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); + node.transformFlags |= propagateChildFlags(node.operand); + if (ts6.isIdentifier(node.operand) && !ts6.isGeneratedIdentifier(node.operand) && !ts6.isLocalName(node.operand)) { + node.transformFlags |= 268435456; + } + return node; + } + function updatePostfixUnaryExpression(node, operand) { + return node.operand !== operand ? update(createPostfixUnaryExpression(operand, node.operator), node) : node; + } + function createBinaryExpression(left, operator, right) { + var node = createBaseExpression( + 223 + /* SyntaxKind.BinaryExpression */ + ); + var operatorToken = asToken(operator); + var operatorKind = operatorToken.kind; + node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); + node.operatorToken = operatorToken; + node.right = parenthesizerRules().parenthesizeRightSideOfBinary(operatorKind, node.left, right); + node.transformFlags |= propagateChildFlags(node.left) | propagateChildFlags(node.operatorToken) | propagateChildFlags(node.right); + if (operatorKind === 60) { + node.transformFlags |= 32; + } else if (operatorKind === 63) { + if (ts6.isObjectLiteralExpression(node.left)) { + node.transformFlags |= 1024 | 128 | 4096 | propagateAssignmentPatternFlags(node.left); + } else if (ts6.isArrayLiteralExpression(node.left)) { + node.transformFlags |= 1024 | 4096 | propagateAssignmentPatternFlags(node.left); + } + } else if (operatorKind === 42 || operatorKind === 67) { + node.transformFlags |= 512; + } else if (ts6.isLogicalOrCoalescingAssignmentOperator(operatorKind)) { + node.transformFlags |= 16; + } + if (operatorKind === 101 && ts6.isPrivateIdentifier(node.left)) { + node.transformFlags |= 536870912; + } + return node; + } + function propagateAssignmentPatternFlags(node) { + if (node.transformFlags & 65536) + return 65536; + if (node.transformFlags & 128) { + for (var _i = 0, _a = ts6.getElementsOfBindingOrAssignmentPattern(node); _i < _a.length; _i++) { + var element = _a[_i]; + var target = ts6.getTargetOfBindingOrAssignmentElement(element); + if (target && ts6.isAssignmentPattern(target)) { + if (target.transformFlags & 65536) { + return 65536; + } + if (target.transformFlags & 128) { + var flags_1 = propagateAssignmentPatternFlags(target); + if (flags_1) + return flags_1; + } + } + } + } + return 0; + } + function updateBinaryExpression(node, left, operator, right) { + return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node; + } + function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { + var node = createBaseExpression( + 224 + /* SyntaxKind.ConditionalExpression */ + ); + node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); + node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken( + 57 + /* SyntaxKind.QuestionToken */ + ); + node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); + node.colonToken = colonToken !== null && colonToken !== void 0 ? colonToken : createToken( + 58 + /* SyntaxKind.ColonToken */ + ); + node.whenFalse = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenFalse); + node.transformFlags |= propagateChildFlags(node.condition) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.whenTrue) | propagateChildFlags(node.colonToken) | propagateChildFlags(node.whenFalse); + return node; + } + function updateConditionalExpression(node, condition, questionToken, whenTrue, colonToken, whenFalse) { + return node.condition !== condition || node.questionToken !== questionToken || node.whenTrue !== whenTrue || node.colonToken !== colonToken || node.whenFalse !== whenFalse ? update(createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse), node) : node; + } + function createTemplateExpression(head, templateSpans) { + var node = createBaseExpression( + 225 + /* SyntaxKind.TemplateExpression */ + ); + node.head = head; + node.templateSpans = createNodeArray(templateSpans); + node.transformFlags |= propagateChildFlags(node.head) | propagateChildrenFlags(node.templateSpans) | 1024; + return node; + } + function updateTemplateExpression(node, head, templateSpans) { + return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateExpression(head, templateSpans), node) : node; + } + function createTemplateLiteralLikeNodeChecked(kind, text, rawText, templateFlags) { + if (templateFlags === void 0) { + templateFlags = 0; + } + ts6.Debug.assert(!(templateFlags & ~2048), "Unsupported template flags."); + var cooked = void 0; + if (rawText !== void 0 && rawText !== text) { + cooked = getCookedText(kind, rawText); + if (typeof cooked === "object") { + return ts6.Debug.fail("Invalid raw text"); + } + } + if (text === void 0) { + if (cooked === void 0) { + return ts6.Debug.fail("Arguments 'text' and 'rawText' may not both be undefined."); + } + text = cooked; + } else if (cooked !== void 0) { + ts6.Debug.assert(text === cooked, "Expected argument 'text' to be the normalized (i.e. 'cooked') version of argument 'rawText'."); + } + return createTemplateLiteralLikeNode(kind, text, rawText, templateFlags); + } + function createTemplateLiteralLikeNode(kind, text, rawText, templateFlags) { + var node = createBaseToken(kind); + node.text = text; + node.rawText = rawText; + node.templateFlags = templateFlags & 2048; + node.transformFlags |= 1024; + if (node.templateFlags) { + node.transformFlags |= 128; + } + return node; + } + function createTemplateHead(text, rawText, templateFlags) { + return createTemplateLiteralLikeNodeChecked(15, text, rawText, templateFlags); + } + function createTemplateMiddle(text, rawText, templateFlags) { + return createTemplateLiteralLikeNodeChecked(16, text, rawText, templateFlags); + } + function createTemplateTail(text, rawText, templateFlags) { + return createTemplateLiteralLikeNodeChecked(17, text, rawText, templateFlags); + } + function createNoSubstitutionTemplateLiteral(text, rawText, templateFlags) { + return createTemplateLiteralLikeNodeChecked(14, text, rawText, templateFlags); + } + function createYieldExpression(asteriskToken, expression) { + ts6.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); + var node = createBaseExpression( + 226 + /* SyntaxKind.YieldExpression */ + ); + node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); + node.asteriskToken = asteriskToken; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.asteriskToken) | 1024 | 128 | 1048576; + return node; + } + function updateYieldExpression(node, asteriskToken, expression) { + return node.expression !== expression || node.asteriskToken !== asteriskToken ? update(createYieldExpression(asteriskToken, expression), node) : node; + } + function createSpreadElement(expression) { + var node = createBaseExpression( + 227 + /* SyntaxKind.SpreadElement */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); + node.transformFlags |= propagateChildFlags(node.expression) | 1024 | 32768; + return node; + } + function updateSpreadElement(node, expression) { + return node.expression !== expression ? update(createSpreadElement(expression), node) : node; + } + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createBaseClassLikeDeclaration(228, modifiers, name, typeParameters, heritageClauses, members); + node.transformFlags |= 1024; + return node; + } + function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { + return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) : node; + } + function createOmittedExpression() { + return createBaseExpression( + 229 + /* SyntaxKind.OmittedExpression */ + ); + } + function createExpressionWithTypeArguments(expression, typeArguments) { + var node = createBaseNode( + 230 + /* SyntaxKind.ExpressionWithTypeArguments */ + ); + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | 1024; + return node; + } + function updateExpressionWithTypeArguments(node, expression, typeArguments) { + return node.expression !== expression || node.typeArguments !== typeArguments ? update(createExpressionWithTypeArguments(expression, typeArguments), node) : node; + } + function createAsExpression(expression, type) { + var node = createBaseExpression( + 231 + /* SyntaxKind.AsExpression */ + ); + node.expression = expression; + node.type = type; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1; + return node; + } + function updateAsExpression(node, expression, type) { + return node.expression !== expression || node.type !== type ? update(createAsExpression(expression, type), node) : node; + } + function createNonNullExpression(expression) { + var node = createBaseExpression( + 232 + /* SyntaxKind.NonNullExpression */ + ); + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + node.transformFlags |= propagateChildFlags(node.expression) | 1; + return node; + } + function updateNonNullExpression(node, expression) { + if (ts6.isNonNullChain(node)) { + return updateNonNullChain(node, expression); + } + return node.expression !== expression ? update(createNonNullExpression(expression), node) : node; + } + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression( + 235 + /* SyntaxKind.SatisfiesExpression */ + ); + node.expression = expression; + node.type = type; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1; + return node; + } + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression || node.type !== type ? update(createSatisfiesExpression(expression, type), node) : node; + } + function createNonNullChain(expression) { + var node = createBaseExpression( + 232 + /* SyntaxKind.NonNullExpression */ + ); + node.flags |= 32; + node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + true + ); + node.transformFlags |= propagateChildFlags(node.expression) | 1; + return node; + } + function updateNonNullChain(node, expression) { + ts6.Debug.assert(!!(node.flags & 32), "Cannot update a NonNullExpression using updateNonNullChain. Use updateNonNullExpression instead."); + return node.expression !== expression ? update(createNonNullChain(expression), node) : node; + } + function createMetaProperty(keywordToken, name) { + var node = createBaseExpression( + 233 + /* SyntaxKind.MetaProperty */ + ); + node.keywordToken = keywordToken; + node.name = name; + node.transformFlags |= propagateChildFlags(node.name); + switch (keywordToken) { + case 103: + node.transformFlags |= 1024; + break; + case 100: + node.transformFlags |= 4; + break; + default: + return ts6.Debug.assertNever(keywordToken); + } + return node; + } + function updateMetaProperty(node, name) { + return node.name !== name ? update(createMetaProperty(node.keywordToken, name), node) : node; + } + function createTemplateSpan(expression, literal2) { + var node = createBaseNode( + 236 + /* SyntaxKind.TemplateSpan */ + ); + node.expression = expression; + node.literal = literal2; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.literal) | 1024; + return node; + } + function updateTemplateSpan(node, expression, literal2) { + return node.expression !== expression || node.literal !== literal2 ? update(createTemplateSpan(expression, literal2), node) : node; + } + function createSemicolonClassElement() { + var node = createBaseNode( + 237 + /* SyntaxKind.SemicolonClassElement */ + ); + node.transformFlags |= 1024; + return node; + } + function createBlock(statements, multiLine) { + var node = createBaseNode( + 238 + /* SyntaxKind.Block */ + ); + node.statements = createNodeArray(statements); + node.multiLine = multiLine; + node.transformFlags |= propagateChildrenFlags(node.statements); + return node; + } + function updateBlock(node, statements) { + return node.statements !== statements ? update(createBlock(statements, node.multiLine), node) : node; + } + function createVariableStatement(modifiers, declarationList) { + var node = createBaseDeclaration( + 240 + /* SyntaxKind.VariableStatement */ + ); + node.modifiers = asNodeArray(modifiers); + node.declarationList = ts6.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; + node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.declarationList); + if (ts6.modifiersToFlags(node.modifiers) & 2) { + node.transformFlags = 1; + } + return node; + } + function updateVariableStatement(node, modifiers, declarationList) { + return node.modifiers !== modifiers || node.declarationList !== declarationList ? update(createVariableStatement(modifiers, declarationList), node) : node; + } + function createEmptyStatement() { + return createBaseNode( + 239 + /* SyntaxKind.EmptyStatement */ + ); + } + function createExpressionStatement(expression) { + var node = createBaseNode( + 241 + /* SyntaxKind.ExpressionStatement */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); + node.transformFlags |= propagateChildFlags(node.expression); + return node; + } + function updateExpressionStatement(node, expression) { + return node.expression !== expression ? update(createExpressionStatement(expression), node) : node; + } + function createIfStatement(expression, thenStatement, elseStatement) { + var node = createBaseNode( + 242 + /* SyntaxKind.IfStatement */ + ); + node.expression = expression; + node.thenStatement = asEmbeddedStatement(thenStatement); + node.elseStatement = asEmbeddedStatement(elseStatement); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thenStatement) | propagateChildFlags(node.elseStatement); + return node; + } + function updateIfStatement(node, expression, thenStatement, elseStatement) { + return node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement ? update(createIfStatement(expression, thenStatement, elseStatement), node) : node; + } + function createDoStatement(statement, expression) { + var node = createBaseNode( + 243 + /* SyntaxKind.DoStatement */ + ); + node.statement = asEmbeddedStatement(statement); + node.expression = expression; + node.transformFlags |= propagateChildFlags(node.statement) | propagateChildFlags(node.expression); + return node; + } + function updateDoStatement(node, statement, expression) { + return node.statement !== statement || node.expression !== expression ? update(createDoStatement(statement, expression), node) : node; + } + function createWhileStatement(expression, statement) { + var node = createBaseNode( + 244 + /* SyntaxKind.WhileStatement */ + ); + node.expression = expression; + node.statement = asEmbeddedStatement(statement); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.statement); + return node; + } + function updateWhileStatement(node, expression, statement) { + return node.expression !== expression || node.statement !== statement ? update(createWhileStatement(expression, statement), node) : node; + } + function createForStatement(initializer, condition, incrementor, statement) { + var node = createBaseNode( + 245 + /* SyntaxKind.ForStatement */ + ); + node.initializer = initializer; + node.condition = condition; + node.incrementor = incrementor; + node.statement = asEmbeddedStatement(statement); + node.transformFlags |= propagateChildFlags(node.initializer) | propagateChildFlags(node.condition) | propagateChildFlags(node.incrementor) | propagateChildFlags(node.statement); + return node; + } + function updateForStatement(node, initializer, condition, incrementor, statement) { + return node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement ? update(createForStatement(initializer, condition, incrementor, statement), node) : node; + } + function createForInStatement(initializer, expression, statement) { + var node = createBaseNode( + 246 + /* SyntaxKind.ForInStatement */ + ); + node.initializer = initializer; + node.expression = expression; + node.statement = asEmbeddedStatement(statement); + node.transformFlags |= propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | propagateChildFlags(node.statement); + return node; + } + function updateForInStatement(node, initializer, expression, statement) { + return node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? update(createForInStatement(initializer, expression, statement), node) : node; + } + function createForOfStatement(awaitModifier, initializer, expression, statement) { + var node = createBaseNode( + 247 + /* SyntaxKind.ForOfStatement */ + ); + node.awaitModifier = awaitModifier; + node.initializer = initializer; + node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); + node.statement = asEmbeddedStatement(statement); + node.transformFlags |= propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | propagateChildFlags(node.statement) | 1024; + if (awaitModifier) + node.transformFlags |= 128; + return node; + } + function updateForOfStatement(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier || node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? update(createForOfStatement(awaitModifier, initializer, expression, statement), node) : node; + } + function createContinueStatement(label) { + var node = createBaseNode( + 248 + /* SyntaxKind.ContinueStatement */ + ); + node.label = asName(label); + node.transformFlags |= propagateChildFlags(node.label) | 4194304; + return node; + } + function updateContinueStatement(node, label) { + return node.label !== label ? update(createContinueStatement(label), node) : node; + } + function createBreakStatement(label) { + var node = createBaseNode( + 249 + /* SyntaxKind.BreakStatement */ + ); + node.label = asName(label); + node.transformFlags |= propagateChildFlags(node.label) | 4194304; + return node; + } + function updateBreakStatement(node, label) { + return node.label !== label ? update(createBreakStatement(label), node) : node; + } + function createReturnStatement(expression) { + var node = createBaseNode( + 250 + /* SyntaxKind.ReturnStatement */ + ); + node.expression = expression; + node.transformFlags |= propagateChildFlags(node.expression) | 128 | 4194304; + return node; + } + function updateReturnStatement(node, expression) { + return node.expression !== expression ? update(createReturnStatement(expression), node) : node; + } + function createWithStatement(expression, statement) { + var node = createBaseNode( + 251 + /* SyntaxKind.WithStatement */ + ); + node.expression = expression; + node.statement = asEmbeddedStatement(statement); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.statement); + return node; + } + function updateWithStatement(node, expression, statement) { + return node.expression !== expression || node.statement !== statement ? update(createWithStatement(expression, statement), node) : node; + } + function createSwitchStatement(expression, caseBlock) { + var node = createBaseNode( + 252 + /* SyntaxKind.SwitchStatement */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); + node.caseBlock = caseBlock; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.caseBlock); + return node; + } + function updateSwitchStatement(node, expression, caseBlock) { + return node.expression !== expression || node.caseBlock !== caseBlock ? update(createSwitchStatement(expression, caseBlock), node) : node; + } + function createLabeledStatement(label, statement) { + var node = createBaseNode( + 253 + /* SyntaxKind.LabeledStatement */ + ); + node.label = asName(label); + node.statement = asEmbeddedStatement(statement); + node.transformFlags |= propagateChildFlags(node.label) | propagateChildFlags(node.statement); + return node; + } + function updateLabeledStatement(node, label, statement) { + return node.label !== label || node.statement !== statement ? update(createLabeledStatement(label, statement), node) : node; + } + function createThrowStatement(expression) { + var node = createBaseNode( + 254 + /* SyntaxKind.ThrowStatement */ + ); + node.expression = expression; + node.transformFlags |= propagateChildFlags(node.expression); + return node; + } + function updateThrowStatement(node, expression) { + return node.expression !== expression ? update(createThrowStatement(expression), node) : node; + } + function createTryStatement(tryBlock, catchClause, finallyBlock) { + var node = createBaseNode( + 255 + /* SyntaxKind.TryStatement */ + ); + node.tryBlock = tryBlock; + node.catchClause = catchClause; + node.finallyBlock = finallyBlock; + node.transformFlags |= propagateChildFlags(node.tryBlock) | propagateChildFlags(node.catchClause) | propagateChildFlags(node.finallyBlock); + return node; + } + function updateTryStatement(node, tryBlock, catchClause, finallyBlock) { + return node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock ? update(createTryStatement(tryBlock, catchClause, finallyBlock), node) : node; + } + function createDebuggerStatement() { + return createBaseNode( + 256 + /* SyntaxKind.DebuggerStatement */ + ); + } + function createVariableDeclaration(name, exclamationToken, type, initializer) { + var node = createBaseVariableLikeDeclaration( + 257, + /*modifiers*/ + void 0, + name, + type, + initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer) + ); + node.exclamationToken = exclamationToken; + node.transformFlags |= propagateChildFlags(node.exclamationToken); + if (exclamationToken) { + node.transformFlags |= 1; + } + return node; + } + function updateVariableDeclaration(node, name, exclamationToken, type, initializer) { + return node.name !== name || node.type !== type || node.exclamationToken !== exclamationToken || node.initializer !== initializer ? update(createVariableDeclaration(name, exclamationToken, type, initializer), node) : node; + } + function createVariableDeclarationList(declarations, flags2) { + if (flags2 === void 0) { + flags2 = 0; + } + var node = createBaseNode( + 258 + /* SyntaxKind.VariableDeclarationList */ + ); + node.flags |= flags2 & 3; + node.declarations = createNodeArray(declarations); + node.transformFlags |= propagateChildrenFlags(node.declarations) | 4194304; + if (flags2 & 3) { + node.transformFlags |= 1024 | 262144; + } + return node; + } + function updateVariableDeclarationList(node, declarations) { + return node.declarations !== declarations ? update(createVariableDeclarationList(declarations, node.flags), node) : node; + } + function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createBaseFunctionLikeDeclaration(259, modifiers, name, typeParameters, parameters, type, body); + node.asteriskToken = asteriskToken; + if (!node.body || ts6.modifiersToFlags(node.modifiers) & 2) { + node.transformFlags = 1; + } else { + node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304; + if (ts6.modifiersToFlags(node.modifiers) & 512) { + if (node.asteriskToken) { + node.transformFlags |= 128; + } else { + node.transformFlags |= 256; + } + } else if (node.asteriskToken) { + node.transformFlags |= 2048; + } + } + node.illegalDecorators = void 0; + return node; + } + function updateFunctionDeclaration(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? finishUpdateFunctionDeclaration(createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; + } + function finishUpdateFunctionDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return finishUpdateBaseSignatureDeclaration(updated, original); + } + function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { + var node = createBaseClassLikeDeclaration(260, modifiers, name, typeParameters, heritageClauses, members); + if (ts6.modifiersToFlags(node.modifiers) & 2) { + node.transformFlags = 1; + } else { + node.transformFlags |= 1024; + if (node.transformFlags & 8192) { + node.transformFlags |= 1; + } + } + return node; + } + function updateClassDeclaration(node, modifiers, name, typeParameters, heritageClauses, members) { + return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; + } + function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { + var node = createBaseInterfaceOrClassLikeDeclaration(261, modifiers, name, typeParameters, heritageClauses); + node.members = createNodeArray(members); + node.transformFlags = 1; + node.illegalDecorators = void 0; + return node; + } + function updateInterfaceDeclaration(node, modifiers, name, typeParameters, heritageClauses, members) { + return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? finishUpdateInterfaceDeclaration(createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; + } + function finishUpdateInterfaceDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { + var node = createBaseGenericNamedDeclaration(262, modifiers, name, typeParameters); + node.type = type; + node.transformFlags = 1; + node.illegalDecorators = void 0; + return node; + } + function updateTypeAliasDeclaration(node, modifiers, name, typeParameters, type) { + return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.type !== type ? finishUpdateTypeAliasDeclaration(createTypeAliasDeclaration(modifiers, name, typeParameters, type), node) : node; + } + function finishUpdateTypeAliasDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createEnumDeclaration(modifiers, name, members) { + var node = createBaseNamedDeclaration(263, modifiers, name); + node.members = createNodeArray(members); + node.transformFlags |= propagateChildrenFlags(node.members) | 1; + node.transformFlags &= ~67108864; + node.illegalDecorators = void 0; + return node; + } + function updateEnumDeclaration(node, modifiers, name, members) { + return node.modifiers !== modifiers || node.name !== name || node.members !== members ? finishUpdateEnumDeclaration(createEnumDeclaration(modifiers, name, members), node) : node; + } + function finishUpdateEnumDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createModuleDeclaration(modifiers, name, body, flags2) { + if (flags2 === void 0) { + flags2 = 0; + } + var node = createBaseDeclaration( + 264 + /* SyntaxKind.ModuleDeclaration */ + ); + node.modifiers = asNodeArray(modifiers); + node.flags |= flags2 & (16 | 4 | 1024); + node.name = name; + node.body = body; + if (ts6.modifiersToFlags(node.modifiers) & 2) { + node.transformFlags = 1; + } else { + node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.name) | propagateChildFlags(node.body) | 1; + } + node.transformFlags &= ~67108864; + node.illegalDecorators = void 0; + return node; + } + function updateModuleDeclaration(node, modifiers, name, body) { + return node.modifiers !== modifiers || node.name !== name || node.body !== body ? finishUpdateModuleDeclaration(createModuleDeclaration(modifiers, name, body, node.flags), node) : node; + } + function finishUpdateModuleDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createModuleBlock(statements) { + var node = createBaseNode( + 265 + /* SyntaxKind.ModuleBlock */ + ); + node.statements = createNodeArray(statements); + node.transformFlags |= propagateChildrenFlags(node.statements); + return node; + } + function updateModuleBlock(node, statements) { + return node.statements !== statements ? update(createModuleBlock(statements), node) : node; + } + function createCaseBlock(clauses) { + var node = createBaseNode( + 266 + /* SyntaxKind.CaseBlock */ + ); + node.clauses = createNodeArray(clauses); + node.transformFlags |= propagateChildrenFlags(node.clauses); + return node; + } + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses ? update(createCaseBlock(clauses), node) : node; + } + function createNamespaceExportDeclaration(name) { + var node = createBaseNamedDeclaration( + 267, + /*modifiers*/ + void 0, + name + ); + node.transformFlags = 1; + node.illegalDecorators = void 0; + node.modifiers = void 0; + return node; + } + function updateNamespaceExportDeclaration(node, name) { + return node.name !== name ? finishUpdateNamespaceExportDeclaration(createNamespaceExportDeclaration(name), node) : node; + } + function finishUpdateNamespaceExportDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + updated.modifiers = original.modifiers; + } + return update(updated, original); + } + function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { + var node = createBaseNamedDeclaration(268, modifiers, name); + node.isTypeOnly = isTypeOnly; + node.moduleReference = moduleReference; + node.transformFlags |= propagateChildFlags(node.moduleReference); + if (!ts6.isExternalModuleReference(node.moduleReference)) + node.transformFlags |= 1; + node.transformFlags &= ~67108864; + node.illegalDecorators = void 0; + return node; + } + function updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference) { + return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference ? finishUpdateImportEqualsDeclaration(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node; + } + function finishUpdateImportEqualsDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { + var node = createBaseDeclaration( + 269 + /* SyntaxKind.ImportDeclaration */ + ); + node.modifiers = asNodeArray(modifiers); + node.importClause = importClause; + node.moduleSpecifier = moduleSpecifier; + node.assertClause = assertClause; + node.transformFlags |= propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier); + node.transformFlags &= ~67108864; + node.illegalDecorators = void 0; + return node; + } + function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, assertClause) { + return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause ? finishUpdateImportDeclaration(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause), node) : node; + } + function finishUpdateImportDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createImportClause(isTypeOnly, name, namedBindings) { + var node = createBaseNode( + 270 + /* SyntaxKind.ImportClause */ + ); + node.isTypeOnly = isTypeOnly; + node.name = name; + node.namedBindings = namedBindings; + node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.namedBindings); + if (isTypeOnly) { + node.transformFlags |= 1; + } + node.transformFlags &= ~67108864; + return node; + } + function updateImportClause(node, isTypeOnly, name, namedBindings) { + return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause(isTypeOnly, name, namedBindings), node) : node; + } + function createAssertClause(elements, multiLine) { + var node = createBaseNode( + 296 + /* SyntaxKind.AssertClause */ + ); + node.elements = createNodeArray(elements); + node.multiLine = multiLine; + node.transformFlags |= 4; + return node; + } + function updateAssertClause(node, elements, multiLine) { + return node.elements !== elements || node.multiLine !== multiLine ? update(createAssertClause(elements, multiLine), node) : node; + } + function createAssertEntry(name, value) { + var node = createBaseNode( + 297 + /* SyntaxKind.AssertEntry */ + ); + node.name = name; + node.value = value; + node.transformFlags |= 4; + return node; + } + function updateAssertEntry(node, name, value) { + return node.name !== name || node.value !== value ? update(createAssertEntry(name, value), node) : node; + } + function createImportTypeAssertionContainer(clause, multiLine) { + var node = createBaseNode( + 298 + /* SyntaxKind.ImportTypeAssertionContainer */ + ); + node.assertClause = clause; + node.multiLine = multiLine; + return node; + } + function updateImportTypeAssertionContainer(node, clause, multiLine) { + return node.assertClause !== clause || node.multiLine !== multiLine ? update(createImportTypeAssertionContainer(clause, multiLine), node) : node; + } + function createNamespaceImport(name) { + var node = createBaseNode( + 271 + /* SyntaxKind.NamespaceImport */ + ); + node.name = name; + node.transformFlags |= propagateChildFlags(node.name); + node.transformFlags &= ~67108864; + return node; + } + function updateNamespaceImport(node, name) { + return node.name !== name ? update(createNamespaceImport(name), node) : node; + } + function createNamespaceExport(name) { + var node = createBaseNode( + 277 + /* SyntaxKind.NamespaceExport */ + ); + node.name = name; + node.transformFlags |= propagateChildFlags(node.name) | 4; + node.transformFlags &= ~67108864; + return node; + } + function updateNamespaceExport(node, name) { + return node.name !== name ? update(createNamespaceExport(name), node) : node; + } + function createNamedImports(elements) { + var node = createBaseNode( + 272 + /* SyntaxKind.NamedImports */ + ); + node.elements = createNodeArray(elements); + node.transformFlags |= propagateChildrenFlags(node.elements); + node.transformFlags &= ~67108864; + return node; + } + function updateNamedImports(node, elements) { + return node.elements !== elements ? update(createNamedImports(elements), node) : node; + } + function createImportSpecifier(isTypeOnly, propertyName, name) { + var node = createBaseNode( + 273 + /* SyntaxKind.ImportSpecifier */ + ); + node.isTypeOnly = isTypeOnly; + node.propertyName = propertyName; + node.name = name; + node.transformFlags |= propagateChildFlags(node.propertyName) | propagateChildFlags(node.name); + node.transformFlags &= ~67108864; + return node; + } + function updateImportSpecifier(node, isTypeOnly, propertyName, name) { + return node.isTypeOnly !== isTypeOnly || node.propertyName !== propertyName || node.name !== name ? update(createImportSpecifier(isTypeOnly, propertyName, name), node) : node; + } + function createExportAssignment(modifiers, isExportEquals, expression) { + var node = createBaseDeclaration( + 274 + /* SyntaxKind.ExportAssignment */ + ); + node.modifiers = asNodeArray(modifiers); + node.isExportEquals = isExportEquals; + node.expression = isExportEquals ? parenthesizerRules().parenthesizeRightSideOfBinary( + 63, + /*leftSide*/ + void 0, + expression + ) : parenthesizerRules().parenthesizeExpressionOfExportDefault(expression); + node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); + node.transformFlags &= ~67108864; + node.illegalDecorators = void 0; + return node; + } + function updateExportAssignment(node, modifiers, expression) { + return node.modifiers !== modifiers || node.expression !== expression ? finishUpdateExportAssignment(createExportAssignment(modifiers, node.isExportEquals, expression), node) : node; + } + function finishUpdateExportAssignment(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { + var node = createBaseDeclaration( + 275 + /* SyntaxKind.ExportDeclaration */ + ); + node.modifiers = asNodeArray(modifiers); + node.isTypeOnly = isTypeOnly; + node.exportClause = exportClause; + node.moduleSpecifier = moduleSpecifier; + node.assertClause = assertClause; + node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier); + node.transformFlags &= ~67108864; + node.illegalDecorators = void 0; + return node; + } + function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { + return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause ? finishUpdateExportDeclaration(createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause), node) : node; + } + function finishUpdateExportDeclaration(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + } + return update(updated, original); + } + function createNamedExports(elements) { + var node = createBaseNode( + 276 + /* SyntaxKind.NamedExports */ + ); + node.elements = createNodeArray(elements); + node.transformFlags |= propagateChildrenFlags(node.elements); + node.transformFlags &= ~67108864; + return node; + } + function updateNamedExports(node, elements) { + return node.elements !== elements ? update(createNamedExports(elements), node) : node; + } + function createExportSpecifier(isTypeOnly, propertyName, name) { + var node = createBaseNode( + 278 + /* SyntaxKind.ExportSpecifier */ + ); + node.isTypeOnly = isTypeOnly; + node.propertyName = asName(propertyName); + node.name = asName(name); + node.transformFlags |= propagateChildFlags(node.propertyName) | propagateChildFlags(node.name); + node.transformFlags &= ~67108864; + return node; + } + function updateExportSpecifier(node, isTypeOnly, propertyName, name) { + return node.isTypeOnly !== isTypeOnly || node.propertyName !== propertyName || node.name !== name ? update(createExportSpecifier(isTypeOnly, propertyName, name), node) : node; + } + function createMissingDeclaration() { + var node = createBaseDeclaration( + 279 + /* SyntaxKind.MissingDeclaration */ + ); + return node; + } + function createExternalModuleReference(expression) { + var node = createBaseNode( + 280 + /* SyntaxKind.ExternalModuleReference */ + ); + node.expression = expression; + node.transformFlags |= propagateChildFlags(node.expression); + node.transformFlags &= ~67108864; + return node; + } + function updateExternalModuleReference(node, expression) { + return node.expression !== expression ? update(createExternalModuleReference(expression), node) : node; + } + function createJSDocPrimaryTypeWorker(kind) { + return createBaseNode(kind); + } + function createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix) { + if (postfix === void 0) { + postfix = false; + } + var node = createJSDocUnaryTypeWorker(kind, postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type); + node.postfix = postfix; + return node; + } + function createJSDocUnaryTypeWorker(kind, type) { + var node = createBaseNode(kind); + node.type = type; + return node; + } + function updateJSDocPrePostfixUnaryTypeWorker(kind, node, type) { + return node.type !== type ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node) : node; + } + function updateJSDocUnaryTypeWorker(kind, node, type) { + return node.type !== type ? update(createJSDocUnaryTypeWorker(kind, type), node) : node; + } + function createJSDocFunctionType(parameters, type) { + var node = createBaseSignatureDeclaration( + 320, + /*modifiers*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + parameters, + type + ); + return node; + } + function updateJSDocFunctionType(node, parameters, type) { + return node.parameters !== parameters || node.type !== type ? update(createJSDocFunctionType(parameters, type), node) : node; + } + function createJSDocTypeLiteral(propertyTags, isArrayType) { + if (isArrayType === void 0) { + isArrayType = false; + } + var node = createBaseNode( + 325 + /* SyntaxKind.JSDocTypeLiteral */ + ); + node.jsDocPropertyTags = asNodeArray(propertyTags); + node.isArrayType = isArrayType; + return node; + } + function updateJSDocTypeLiteral(node, propertyTags, isArrayType) { + return node.jsDocPropertyTags !== propertyTags || node.isArrayType !== isArrayType ? update(createJSDocTypeLiteral(propertyTags, isArrayType), node) : node; + } + function createJSDocTypeExpression(type) { + var node = createBaseNode( + 312 + /* SyntaxKind.JSDocTypeExpression */ + ); + node.type = type; + return node; + } + function updateJSDocTypeExpression(node, type) { + return node.type !== type ? update(createJSDocTypeExpression(type), node) : node; + } + function createJSDocSignature(typeParameters, parameters, type) { + var node = createBaseNode( + 326 + /* SyntaxKind.JSDocSignature */ + ); + node.typeParameters = asNodeArray(typeParameters); + node.parameters = createNodeArray(parameters); + node.type = type; + return node; + } + function updateJSDocSignature(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? update(createJSDocSignature(typeParameters, parameters, type), node) : node; + } + function getDefaultTagName(node) { + var defaultTagName = getDefaultTagNameForKind(node.kind); + return node.tagName.escapedText === ts6.escapeLeadingUnderscores(defaultTagName) ? node.tagName : createIdentifier(defaultTagName); + } + function createBaseJSDocTag(kind, tagName, comment) { + var node = createBaseNode(kind); + node.tagName = tagName; + node.comment = comment; + return node; + } + function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { + var node = createBaseJSDocTag(347, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + node.constraint = constraint; + node.typeParameters = createNodeArray(typeParameters); + return node; + } + function updateJSDocTemplateTag(node, tagName, constraint, typeParameters, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters || node.comment !== comment ? update(createJSDocTemplateTag(tagName, constraint, typeParameters, comment), node) : node; + } + function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { + var node = createBaseJSDocTag(348, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + node.typeExpression = typeExpression; + node.fullName = fullName; + node.name = ts6.getJSDocTypeAliasName(fullName); + return node; + } + function updateJSDocTypedefTag(node, tagName, typeExpression, fullName, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName || node.comment !== comment ? update(createJSDocTypedefTag(tagName, typeExpression, fullName, comment), node) : node; + } + function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { + var node = createBaseJSDocTag(343, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + node.typeExpression = typeExpression; + node.name = name; + node.isNameFirst = !!isNameFirst; + node.isBracketed = isBracketed; + return node; + } + function updateJSDocParameterTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed || node.typeExpression !== typeExpression || node.isNameFirst !== isNameFirst || node.comment !== comment ? update(createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node) : node; + } + function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { + var node = createBaseJSDocTag(350, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + node.typeExpression = typeExpression; + node.name = name; + node.isNameFirst = !!isNameFirst; + node.isBracketed = isBracketed; + return node; + } + function updateJSDocPropertyTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed || node.typeExpression !== typeExpression || node.isNameFirst !== isNameFirst || node.comment !== comment ? update(createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node) : node; + } + function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { + var node = createBaseJSDocTag(341, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + node.typeExpression = typeExpression; + node.fullName = fullName; + node.name = ts6.getJSDocTypeAliasName(fullName); + return node; + } + function updateJSDocCallbackTag(node, tagName, typeExpression, fullName, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName || node.comment !== comment ? update(createJSDocCallbackTag(tagName, typeExpression, fullName, comment), node) : node; + } + function createJSDocAugmentsTag(tagName, className, comment) { + var node = createBaseJSDocTag(331, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + node.class = className; + return node; + } + function updateJSDocAugmentsTag(node, tagName, className, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.class !== className || node.comment !== comment ? update(createJSDocAugmentsTag(tagName, className, comment), node) : node; + } + function createJSDocImplementsTag(tagName, className, comment) { + var node = createBaseJSDocTag(332, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + node.class = className; + return node; + } + function createJSDocSeeTag(tagName, name, comment) { + var node = createBaseJSDocTag(349, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + node.name = name; + return node; + } + function updateJSDocSeeTag(node, tagName, name, comment) { + return node.tagName !== tagName || node.name !== name || node.comment !== comment ? update(createJSDocSeeTag(tagName, name, comment), node) : node; + } + function createJSDocNameReference(name) { + var node = createBaseNode( + 313 + /* SyntaxKind.JSDocNameReference */ + ); + node.name = name; + return node; + } + function updateJSDocNameReference(node, name) { + return node.name !== name ? update(createJSDocNameReference(name), node) : node; + } + function createJSDocMemberName(left, right) { + var node = createBaseNode( + 314 + /* SyntaxKind.JSDocMemberName */ + ); + node.left = left; + node.right = right; + node.transformFlags |= propagateChildFlags(node.left) | propagateChildFlags(node.right); + return node; + } + function updateJSDocMemberName(node, left, right) { + return node.left !== left || node.right !== right ? update(createJSDocMemberName(left, right), node) : node; + } + function createJSDocLink(name, text) { + var node = createBaseNode( + 327 + /* SyntaxKind.JSDocLink */ + ); + node.name = name; + node.text = text; + return node; + } + function updateJSDocLink(node, name, text) { + return node.name !== name ? update(createJSDocLink(name, text), node) : node; + } + function createJSDocLinkCode(name, text) { + var node = createBaseNode( + 328 + /* SyntaxKind.JSDocLinkCode */ + ); + node.name = name; + node.text = text; + return node; + } + function updateJSDocLinkCode(node, name, text) { + return node.name !== name ? update(createJSDocLinkCode(name, text), node) : node; + } + function createJSDocLinkPlain(name, text) { + var node = createBaseNode( + 329 + /* SyntaxKind.JSDocLinkPlain */ + ); + node.name = name; + node.text = text; + return node; + } + function updateJSDocLinkPlain(node, name, text) { + return node.name !== name ? update(createJSDocLinkPlain(name, text), node) : node; + } + function updateJSDocImplementsTag(node, tagName, className, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.class !== className || node.comment !== comment ? update(createJSDocImplementsTag(tagName, className, comment), node) : node; + } + function createJSDocSimpleTagWorker(kind, tagName, comment) { + var node = createBaseJSDocTag(kind, tagName !== null && tagName !== void 0 ? tagName : createIdentifier(getDefaultTagNameForKind(kind)), comment); + return node; + } + function updateJSDocSimpleTagWorker(kind, node, tagName, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : node; + } + function createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment) { + var node = createBaseJSDocTag(kind, tagName !== null && tagName !== void 0 ? tagName : createIdentifier(getDefaultTagNameForKind(kind)), comment); + node.typeExpression = typeExpression; + return node; + } + function updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment) { + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } + return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment), node) : node; + } + function createJSDocUnknownTag(tagName, comment) { + var node = createBaseJSDocTag(330, tagName, comment); + return node; + } + function updateJSDocUnknownTag(node, tagName, comment) { + return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) : node; + } + function createJSDocText(text) { + var node = createBaseNode( + 324 + /* SyntaxKind.JSDocText */ + ); + node.text = text; + return node; + } + function updateJSDocText(node, text) { + return node.text !== text ? update(createJSDocText(text), node) : node; + } + function createJSDocComment(comment, tags) { + var node = createBaseNode( + 323 + /* SyntaxKind.JSDoc */ + ); + node.comment = comment; + node.tags = asNodeArray(tags); + return node; + } + function updateJSDocComment(node, comment, tags) { + return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) : node; + } + function createJsxElement(openingElement, children, closingElement) { + var node = createBaseNode( + 281 + /* SyntaxKind.JsxElement */ + ); + node.openingElement = openingElement; + node.children = createNodeArray(children); + node.closingElement = closingElement; + node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | propagateChildFlags(node.closingElement) | 2; + return node; + } + function updateJsxElement(node, openingElement, children, closingElement) { + return node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement ? update(createJsxElement(openingElement, children, closingElement), node) : node; + } + function createJsxSelfClosingElement(tagName, typeArguments, attributes) { + var node = createBaseNode( + 282 + /* SyntaxKind.JsxSelfClosingElement */ + ); + node.tagName = tagName; + node.typeArguments = asNodeArray(typeArguments); + node.attributes = attributes; + node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | propagateChildFlags(node.attributes) | 2; + if (node.typeArguments) { + node.transformFlags |= 1; + } + return node; + } + function updateJsxSelfClosingElement(node, tagName, typeArguments, attributes) { + return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? update(createJsxSelfClosingElement(tagName, typeArguments, attributes), node) : node; + } + function createJsxOpeningElement(tagName, typeArguments, attributes) { + var node = createBaseNode( + 283 + /* SyntaxKind.JsxOpeningElement */ + ); + node.tagName = tagName; + node.typeArguments = asNodeArray(typeArguments); + node.attributes = attributes; + node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | propagateChildFlags(node.attributes) | 2; + if (typeArguments) { + node.transformFlags |= 1; + } + return node; + } + function updateJsxOpeningElement(node, tagName, typeArguments, attributes) { + return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? update(createJsxOpeningElement(tagName, typeArguments, attributes), node) : node; + } + function createJsxClosingElement(tagName) { + var node = createBaseNode( + 284 + /* SyntaxKind.JsxClosingElement */ + ); + node.tagName = tagName; + node.transformFlags |= propagateChildFlags(node.tagName) | 2; + return node; + } + function updateJsxClosingElement(node, tagName) { + return node.tagName !== tagName ? update(createJsxClosingElement(tagName), node) : node; + } + function createJsxFragment(openingFragment, children, closingFragment) { + var node = createBaseNode( + 285 + /* SyntaxKind.JsxFragment */ + ); + node.openingFragment = openingFragment; + node.children = createNodeArray(children); + node.closingFragment = closingFragment; + node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | propagateChildFlags(node.closingFragment) | 2; + return node; + } + function updateJsxFragment(node, openingFragment, children, closingFragment) { + return node.openingFragment !== openingFragment || node.children !== children || node.closingFragment !== closingFragment ? update(createJsxFragment(openingFragment, children, closingFragment), node) : node; + } + function createJsxText(text, containsOnlyTriviaWhiteSpaces) { + var node = createBaseNode( + 11 + /* SyntaxKind.JsxText */ + ); + node.text = text; + node.containsOnlyTriviaWhiteSpaces = !!containsOnlyTriviaWhiteSpaces; + node.transformFlags |= 2; + return node; + } + function updateJsxText(node, text, containsOnlyTriviaWhiteSpaces) { + return node.text !== text || node.containsOnlyTriviaWhiteSpaces !== containsOnlyTriviaWhiteSpaces ? update(createJsxText(text, containsOnlyTriviaWhiteSpaces), node) : node; + } + function createJsxOpeningFragment() { + var node = createBaseNode( + 286 + /* SyntaxKind.JsxOpeningFragment */ + ); + node.transformFlags |= 2; + return node; + } + function createJsxJsxClosingFragment() { + var node = createBaseNode( + 287 + /* SyntaxKind.JsxClosingFragment */ + ); + node.transformFlags |= 2; + return node; + } + function createJsxAttribute(name, initializer) { + var node = createBaseNode( + 288 + /* SyntaxKind.JsxAttribute */ + ); + node.name = name; + node.initializer = initializer; + node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer) | 2; + return node; + } + function updateJsxAttribute(node, name, initializer) { + return node.name !== name || node.initializer !== initializer ? update(createJsxAttribute(name, initializer), node) : node; + } + function createJsxAttributes(properties) { + var node = createBaseNode( + 289 + /* SyntaxKind.JsxAttributes */ + ); + node.properties = createNodeArray(properties); + node.transformFlags |= propagateChildrenFlags(node.properties) | 2; + return node; + } + function updateJsxAttributes(node, properties) { + return node.properties !== properties ? update(createJsxAttributes(properties), node) : node; + } + function createJsxSpreadAttribute(expression) { + var node = createBaseNode( + 290 + /* SyntaxKind.JsxSpreadAttribute */ + ); + node.expression = expression; + node.transformFlags |= propagateChildFlags(node.expression) | 2; + return node; + } + function updateJsxSpreadAttribute(node, expression) { + return node.expression !== expression ? update(createJsxSpreadAttribute(expression), node) : node; + } + function createJsxExpression(dotDotDotToken, expression) { + var node = createBaseNode( + 291 + /* SyntaxKind.JsxExpression */ + ); + node.dotDotDotToken = dotDotDotToken; + node.expression = expression; + node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | propagateChildFlags(node.expression) | 2; + return node; + } + function updateJsxExpression(node, expression) { + return node.expression !== expression ? update(createJsxExpression(node.dotDotDotToken, expression), node) : node; + } + function createCaseClause(expression, statements) { + var node = createBaseNode( + 292 + /* SyntaxKind.CaseClause */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); + node.statements = createNodeArray(statements); + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.statements); + return node; + } + function updateCaseClause(node, expression, statements) { + return node.expression !== expression || node.statements !== statements ? update(createCaseClause(expression, statements), node) : node; + } + function createDefaultClause(statements) { + var node = createBaseNode( + 293 + /* SyntaxKind.DefaultClause */ + ); + node.statements = createNodeArray(statements); + node.transformFlags = propagateChildrenFlags(node.statements); + return node; + } + function updateDefaultClause(node, statements) { + return node.statements !== statements ? update(createDefaultClause(statements), node) : node; + } + function createHeritageClause(token, types) { + var node = createBaseNode( + 294 + /* SyntaxKind.HeritageClause */ + ); + node.token = token; + node.types = createNodeArray(types); + node.transformFlags |= propagateChildrenFlags(node.types); + switch (token) { + case 94: + node.transformFlags |= 1024; + break; + case 117: + node.transformFlags |= 1; + break; + default: + return ts6.Debug.assertNever(token); + } + return node; + } + function updateHeritageClause(node, types) { + return node.types !== types ? update(createHeritageClause(node.token, types), node) : node; + } + function createCatchClause(variableDeclaration, block) { + var node = createBaseNode( + 295 + /* SyntaxKind.CatchClause */ + ); + if (typeof variableDeclaration === "string" || variableDeclaration && !ts6.isVariableDeclaration(variableDeclaration)) { + variableDeclaration = createVariableDeclaration( + variableDeclaration, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ); + } + node.variableDeclaration = variableDeclaration; + node.block = block; + node.transformFlags |= propagateChildFlags(node.variableDeclaration) | propagateChildFlags(node.block); + if (!variableDeclaration) + node.transformFlags |= 64; + return node; + } + function updateCatchClause(node, variableDeclaration, block) { + return node.variableDeclaration !== variableDeclaration || node.block !== block ? update(createCatchClause(variableDeclaration, block), node) : node; + } + function createPropertyAssignment(name, initializer) { + var node = createBaseNamedDeclaration( + 299, + /*modifiers*/ + void 0, + name + ); + node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); + node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer); + node.illegalDecorators = void 0; + node.modifiers = void 0; + node.questionToken = void 0; + node.exclamationToken = void 0; + return node; + } + function updatePropertyAssignment(node, name, initializer) { + return node.name !== name || node.initializer !== initializer ? finishUpdatePropertyAssignment(createPropertyAssignment(name, initializer), node) : node; + } + function finishUpdatePropertyAssignment(updated, original) { + if (updated !== original) { + updated.illegalDecorators = original.illegalDecorators; + updated.modifiers = original.modifiers; + updated.questionToken = original.questionToken; + updated.exclamationToken = original.exclamationToken; + } + return update(updated, original); + } + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createBaseNamedDeclaration( + 300, + /*modifiers*/ + void 0, + name + ); + node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); + node.transformFlags |= propagateChildFlags(node.objectAssignmentInitializer) | 1024; + node.equalsToken = void 0; + node.illegalDecorators = void 0; + node.modifiers = void 0; + node.questionToken = void 0; + node.exclamationToken = void 0; + return node; + } + function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { + return node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer ? finishUpdateShorthandPropertyAssignment(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node) : node; + } + function finishUpdateShorthandPropertyAssignment(updated, original) { + if (updated !== original) { + updated.equalsToken = original.equalsToken; + updated.illegalDecorators = original.illegalDecorators; + updated.modifiers = original.modifiers; + updated.questionToken = original.questionToken; + updated.exclamationToken = original.exclamationToken; + } + return update(updated, original); + } + function createSpreadAssignment(expression) { + var node = createBaseNode( + 301 + /* SyntaxKind.SpreadAssignment */ + ); + node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); + node.transformFlags |= propagateChildFlags(node.expression) | 128 | 65536; + return node; + } + function updateSpreadAssignment(node, expression) { + return node.expression !== expression ? update(createSpreadAssignment(expression), node) : node; + } + function createEnumMember(name, initializer) { + var node = createBaseNode( + 302 + /* SyntaxKind.EnumMember */ + ); + node.name = asName(name); + node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); + node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer) | 1; + return node; + } + function updateEnumMember(node, name, initializer) { + return node.name !== name || node.initializer !== initializer ? update(createEnumMember(name, initializer), node) : node; + } + function createSourceFile2(statements, endOfFileToken, flags2) { + var node = baseFactory2.createBaseSourceFileNode( + 308 + /* SyntaxKind.SourceFile */ + ); + node.statements = createNodeArray(statements); + node.endOfFileToken = endOfFileToken; + node.flags |= flags2; + node.fileName = ""; + node.text = ""; + node.languageVersion = 0; + node.languageVariant = 0; + node.scriptKind = 0; + node.isDeclarationFile = false; + node.hasNoDefaultLib = false; + node.transformFlags |= propagateChildrenFlags(node.statements) | propagateChildFlags(node.endOfFileToken); + return node; + } + function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { + var node = source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory2.createBaseSourceFileNode( + 308 + /* SyntaxKind.SourceFile */ + ); + for (var p in source) { + if (p === "emitNode" || ts6.hasProperty(node, p) || !ts6.hasProperty(source, p)) + continue; + node[p] = source[p]; + } + node.flags |= source.flags; + node.statements = createNodeArray(statements); + node.endOfFileToken = source.endOfFileToken; + node.isDeclarationFile = isDeclarationFile; + node.referencedFiles = referencedFiles; + node.typeReferenceDirectives = typeReferences; + node.hasNoDefaultLib = hasNoDefaultLib; + node.libReferenceDirectives = libReferences; + node.transformFlags = propagateChildrenFlags(node.statements) | propagateChildFlags(node.endOfFileToken); + node.impliedNodeFormat = source.impliedNodeFormat; + return node; + } + function updateSourceFile(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives) { + if (isDeclarationFile === void 0) { + isDeclarationFile = node.isDeclarationFile; + } + if (referencedFiles === void 0) { + referencedFiles = node.referencedFiles; + } + if (typeReferenceDirectives === void 0) { + typeReferenceDirectives = node.typeReferenceDirectives; + } + if (hasNoDefaultLib === void 0) { + hasNoDefaultLib = node.hasNoDefaultLib; + } + if (libReferenceDirectives === void 0) { + libReferenceDirectives = node.libReferenceDirectives; + } + return node.statements !== statements || node.isDeclarationFile !== isDeclarationFile || node.referencedFiles !== referencedFiles || node.typeReferenceDirectives !== typeReferenceDirectives || node.hasNoDefaultLib !== hasNoDefaultLib || node.libReferenceDirectives !== libReferenceDirectives ? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives), node) : node; + } + function createBundle(sourceFiles, prepends) { + if (prepends === void 0) { + prepends = ts6.emptyArray; + } + var node = createBaseNode( + 309 + /* SyntaxKind.Bundle */ + ); + node.prepends = prepends; + node.sourceFiles = sourceFiles; + return node; + } + function updateBundle(node, sourceFiles, prepends) { + if (prepends === void 0) { + prepends = ts6.emptyArray; + } + return node.sourceFiles !== sourceFiles || node.prepends !== prepends ? update(createBundle(sourceFiles, prepends), node) : node; + } + function createUnparsedSource(prologues, syntheticReferences, texts) { + var node = createBaseNode( + 310 + /* SyntaxKind.UnparsedSource */ + ); + node.prologues = prologues; + node.syntheticReferences = syntheticReferences; + node.texts = texts; + node.fileName = ""; + node.text = ""; + node.referencedFiles = ts6.emptyArray; + node.libReferenceDirectives = ts6.emptyArray; + node.getLineAndCharacterOfPosition = function(pos) { + return ts6.getLineAndCharacterOfPosition(node, pos); + }; + return node; + } + function createBaseUnparsedNode(kind, data) { + var node = createBaseNode(kind); + node.data = data; + return node; + } + function createUnparsedPrologue(data) { + return createBaseUnparsedNode(303, data); + } + function createUnparsedPrepend(data, texts) { + var node = createBaseUnparsedNode(304, data); + node.texts = texts; + return node; + } + function createUnparsedTextLike(data, internal) { + return createBaseUnparsedNode(internal ? 306 : 305, data); + } + function createUnparsedSyntheticReference(section) { + var node = createBaseNode( + 307 + /* SyntaxKind.UnparsedSyntheticReference */ + ); + node.data = section.data; + node.section = section; + return node; + } + function createInputFiles2() { + var node = createBaseNode( + 311 + /* SyntaxKind.InputFiles */ + ); + node.javascriptText = ""; + node.declarationText = ""; + return node; + } + function createSyntheticExpression(type, isSpread, tupleNameSource) { + if (isSpread === void 0) { + isSpread = false; + } + var node = createBaseNode( + 234 + /* SyntaxKind.SyntheticExpression */ + ); + node.type = type; + node.isSpread = isSpread; + node.tupleNameSource = tupleNameSource; + return node; + } + function createSyntaxList(children) { + var node = createBaseNode( + 351 + /* SyntaxKind.SyntaxList */ + ); + node._children = children; + return node; + } + function createNotEmittedStatement(original) { + var node = createBaseNode( + 352 + /* SyntaxKind.NotEmittedStatement */ + ); + node.original = original; + ts6.setTextRange(node, original); + return node; + } + function createPartiallyEmittedExpression(expression, original) { + var node = createBaseNode( + 353 + /* SyntaxKind.PartiallyEmittedExpression */ + ); + node.expression = expression; + node.original = original; + node.transformFlags |= propagateChildFlags(node.expression) | 1; + ts6.setTextRange(node, original); + return node; + } + function updatePartiallyEmittedExpression(node, expression) { + return node.expression !== expression ? update(createPartiallyEmittedExpression(expression, node.original), node) : node; + } + function flattenCommaElements(node) { + if (ts6.nodeIsSynthesized(node) && !ts6.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { + if (ts6.isCommaListExpression(node)) { + return node.elements; + } + if (ts6.isBinaryExpression(node) && ts6.isCommaToken(node.operatorToken)) { + return [node.left, node.right]; + } + } + return node; + } + function createCommaListExpression(elements) { + var node = createBaseNode( + 354 + /* SyntaxKind.CommaListExpression */ + ); + node.elements = createNodeArray(ts6.sameFlatMap(elements, flattenCommaElements)); + node.transformFlags |= propagateChildrenFlags(node.elements); + return node; + } + function updateCommaListExpression(node, elements) { + return node.elements !== elements ? update(createCommaListExpression(elements), node) : node; + } + function createEndOfDeclarationMarker(original) { + var node = createBaseNode( + 356 + /* SyntaxKind.EndOfDeclarationMarker */ + ); + node.emitNode = {}; + node.original = original; + return node; + } + function createMergeDeclarationMarker(original) { + var node = createBaseNode( + 355 + /* SyntaxKind.MergeDeclarationMarker */ + ); + node.emitNode = {}; + node.original = original; + return node; + } + function createSyntheticReferenceExpression(expression, thisArg) { + var node = createBaseNode( + 357 + /* SyntaxKind.SyntheticReferenceExpression */ + ); + node.expression = expression; + node.thisArg = thisArg; + node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg); + return node; + } + function updateSyntheticReferenceExpression(node, expression, thisArg) { + return node.expression !== expression || node.thisArg !== thisArg ? update(createSyntheticReferenceExpression(expression, thisArg), node) : node; + } + function cloneNode(node) { + if (node === void 0) { + return node; + } + var clone = ts6.isSourceFile(node) ? baseFactory2.createBaseSourceFileNode( + 308 + /* SyntaxKind.SourceFile */ + ) : ts6.isIdentifier(node) ? baseFactory2.createBaseIdentifierNode( + 79 + /* SyntaxKind.Identifier */ + ) : ts6.isPrivateIdentifier(node) ? baseFactory2.createBasePrivateIdentifierNode( + 80 + /* SyntaxKind.PrivateIdentifier */ + ) : !ts6.isNodeKind(node.kind) ? baseFactory2.createBaseTokenNode(node.kind) : baseFactory2.createBaseNode(node.kind); + clone.flags |= node.flags & ~8; + clone.transformFlags = node.transformFlags; + setOriginalNode(clone, node); + for (var key in node) { + if (ts6.hasProperty(clone, key) || !ts6.hasProperty(node, key)) { + continue; + } + clone[key] = node[key]; + } + return clone; + } + function createImmediatelyInvokedFunctionExpression(statements, param, paramValue) { + return createCallExpression( + createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + param ? [param] : [], + /*type*/ + void 0, + createBlock( + statements, + /*multiLine*/ + true + ) + ), + /*typeArguments*/ + void 0, + /*argumentsArray*/ + paramValue ? [paramValue] : [] + ); + } + function createImmediatelyInvokedArrowFunction(statements, param, paramValue) { + return createCallExpression( + createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + param ? [param] : [], + /*type*/ + void 0, + /*equalsGreaterThanToken*/ + void 0, + createBlock( + statements, + /*multiLine*/ + true + ) + ), + /*typeArguments*/ + void 0, + /*argumentsArray*/ + paramValue ? [paramValue] : [] + ); + } + function createVoidZero() { + return createVoidExpression(createNumericLiteral("0")); + } + function createExportDefault(expression) { + return createExportAssignment( + /*modifiers*/ + void 0, + /*isExportEquals*/ + false, + expression + ); + } + function createExternalModuleExport(exportName) { + return createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + createNamedExports([ + createExportSpecifier( + /*isTypeOnly*/ + false, + /*propertyName*/ + void 0, + exportName + ) + ]) + ); + } + function createTypeCheck(value, tag) { + return tag === "undefined" ? factory.createStrictEquality(value, createVoidZero()) : factory.createStrictEquality(createTypeOfExpression(value), createStringLiteral(tag)); + } + function createMethodCall(object, methodName, argumentsList) { + if (ts6.isCallChain(object)) { + return createCallChain( + createPropertyAccessChain( + object, + /*questionDotToken*/ + void 0, + methodName + ), + /*questionDotToken*/ + void 0, + /*typeArguments*/ + void 0, + argumentsList + ); + } + return createCallExpression( + createPropertyAccessExpression(object, methodName), + /*typeArguments*/ + void 0, + argumentsList + ); + } + function createFunctionBindCall(target, thisArg, argumentsList) { + return createMethodCall(target, "bind", __spreadArray([thisArg], argumentsList, true)); + } + function createFunctionCallCall(target, thisArg, argumentsList) { + return createMethodCall(target, "call", __spreadArray([thisArg], argumentsList, true)); + } + function createFunctionApplyCall(target, thisArg, argumentsExpression) { + return createMethodCall(target, "apply", [thisArg, argumentsExpression]); + } + function createGlobalMethodCall(globalObjectName, methodName, argumentsList) { + return createMethodCall(createIdentifier(globalObjectName), methodName, argumentsList); + } + function createArraySliceCall(array, start) { + return createMethodCall(array, "slice", start === void 0 ? [] : [asExpression(start)]); + } + function createArrayConcatCall(array, argumentsList) { + return createMethodCall(array, "concat", argumentsList); + } + function createObjectDefinePropertyCall(target, propertyName, attributes) { + return createGlobalMethodCall("Object", "defineProperty", [target, asExpression(propertyName), attributes]); + } + function createReflectGetCall(target, propertyKey, receiver) { + return createGlobalMethodCall("Reflect", "get", receiver ? [target, propertyKey, receiver] : [target, propertyKey]); + } + function createReflectSetCall(target, propertyKey, value, receiver) { + return createGlobalMethodCall("Reflect", "set", receiver ? [target, propertyKey, value, receiver] : [target, propertyKey, value]); + } + function tryAddPropertyAssignment(properties, propertyName, expression) { + if (expression) { + properties.push(createPropertyAssignment(propertyName, expression)); + return true; + } + return false; + } + function createPropertyDescriptor(attributes, singleLine) { + var properties = []; + tryAddPropertyAssignment(properties, "enumerable", asExpression(attributes.enumerable)); + tryAddPropertyAssignment(properties, "configurable", asExpression(attributes.configurable)); + var isData = tryAddPropertyAssignment(properties, "writable", asExpression(attributes.writable)); + isData = tryAddPropertyAssignment(properties, "value", attributes.value) || isData; + var isAccessor = tryAddPropertyAssignment(properties, "get", attributes.get); + isAccessor = tryAddPropertyAssignment(properties, "set", attributes.set) || isAccessor; + ts6.Debug.assert(!(isData && isAccessor), "A PropertyDescriptor may not be both an accessor descriptor and a data descriptor."); + return createObjectLiteralExpression(properties, !singleLine); + } + function updateOuterExpression(outerExpression, expression) { + switch (outerExpression.kind) { + case 214: + return updateParenthesizedExpression(outerExpression, expression); + case 213: + return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231: + return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235: + return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232: + return updateNonNullExpression(outerExpression, expression); + case 353: + return updatePartiallyEmittedExpression(outerExpression, expression); + } + } + function isIgnorableParen(node) { + return ts6.isParenthesizedExpression(node) && ts6.nodeIsSynthesized(node) && ts6.nodeIsSynthesized(ts6.getSourceMapRange(node)) && ts6.nodeIsSynthesized(ts6.getCommentRange(node)) && !ts6.some(ts6.getSyntheticLeadingComments(node)) && !ts6.some(ts6.getSyntheticTrailingComments(node)); + } + function restoreOuterExpressions(outerExpression, innerExpression, kinds) { + if (kinds === void 0) { + kinds = 15; + } + if (outerExpression && ts6.isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) { + return updateOuterExpression(outerExpression, restoreOuterExpressions(outerExpression.expression, innerExpression)); + } + return innerExpression; + } + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = updateLabeledStatement(outermostLabeledStatement, outermostLabeledStatement.label, ts6.isLabeledStatement(outermostLabeledStatement.statement) ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { + var target = ts6.skipParentheses(node); + switch (target.kind) { + case 79: + return cacheIdentifiers; + case 108: + case 8: + case 9: + case 10: + return false; + case 206: + var elements = target.elements; + if (elements.length === 0) { + return false; + } + return true; + case 207: + return target.properties.length > 0; + default: + return true; + } + } + function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { + if (cacheIdentifiers === void 0) { + cacheIdentifiers = false; + } + var callee = ts6.skipOuterExpressions( + expression, + 15 + /* OuterExpressionKinds.All */ + ); + var thisArg; + var target; + if (ts6.isSuperProperty(callee)) { + thisArg = createThis(); + target = callee; + } else if (ts6.isSuperKeyword(callee)) { + thisArg = createThis(); + target = languageVersion !== void 0 && languageVersion < 2 ? ts6.setTextRange(createIdentifier("_super"), callee) : callee; + } else if (ts6.getEmitFlags(callee) & 4096) { + thisArg = createVoidZero(); + target = parenthesizerRules().parenthesizeLeftSideOfAccess( + callee, + /*optionalChain*/ + false + ); + } else if (ts6.isPropertyAccessExpression(callee)) { + if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { + thisArg = createTempVariable(recordTempVariable); + target = createPropertyAccessExpression(ts6.setTextRange(factory.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts6.setTextRange(target, callee); + } else { + thisArg = callee.expression; + target = callee; + } + } else if (ts6.isElementAccessExpression(callee)) { + if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { + thisArg = createTempVariable(recordTempVariable); + target = createElementAccessExpression(ts6.setTextRange(factory.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts6.setTextRange(target, callee); + } else { + thisArg = callee.expression; + target = callee; + } + } else { + thisArg = createVoidZero(); + target = parenthesizerRules().parenthesizeLeftSideOfAccess( + expression, + /*optionalChain*/ + false + ); + } + return { target, thisArg }; + } + function createAssignmentTargetWrapper(paramName, expression) { + return createPropertyAccessExpression( + // Explicit parens required because of v8 regression (https://bugs.chromium.org/p/v8/issues/detail?id=9560) + createParenthesizedExpression(createObjectLiteralExpression([ + createSetAccessorDeclaration( + /*modifiers*/ + void 0, + "value", + [createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + paramName, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + )], + createBlock([ + createExpressionStatement(expression) + ]) + ) + ])), + "value" + ); + } + function inlineExpressions(expressions) { + return expressions.length > 10 ? createCommaListExpression(expressions) : ts6.reduceLeft(expressions, factory.createComma); + } + function getName(node, allowComments, allowSourceMaps, emitFlags) { + if (emitFlags === void 0) { + emitFlags = 0; + } + var nodeName = ts6.getNameOfDeclaration(node); + if (nodeName && ts6.isIdentifier(nodeName) && !ts6.isGeneratedIdentifier(nodeName)) { + var name = ts6.setParent(ts6.setTextRange(cloneNode(nodeName), nodeName), nodeName.parent); + emitFlags |= ts6.getEmitFlags(nodeName); + if (!allowSourceMaps) + emitFlags |= 48; + if (!allowComments) + emitFlags |= 1536; + if (emitFlags) + ts6.setEmitFlags(name, emitFlags); + return name; + } + return getGeneratedNameForNode(node); + } + function getInternalName(node, allowComments, allowSourceMaps) { + return getName( + node, + allowComments, + allowSourceMaps, + 16384 | 32768 + /* EmitFlags.InternalName */ + ); + } + function getLocalName(node, allowComments, allowSourceMaps) { + return getName( + node, + allowComments, + allowSourceMaps, + 16384 + /* EmitFlags.LocalName */ + ); + } + function getExportName(node, allowComments, allowSourceMaps) { + return getName( + node, + allowComments, + allowSourceMaps, + 8192 + /* EmitFlags.ExportName */ + ); + } + function getDeclarationName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps); + } + function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { + var qualifiedName = createPropertyAccessExpression(ns, ts6.nodeIsSynthesized(name) ? name : cloneNode(name)); + ts6.setTextRange(qualifiedName, name); + var emitFlags = 0; + if (!allowSourceMaps) + emitFlags |= 48; + if (!allowComments) + emitFlags |= 1536; + if (emitFlags) + ts6.setEmitFlags(qualifiedName, emitFlags); + return qualifiedName; + } + function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { + if (ns && ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps); + } + return getExportName(node, allowComments, allowSourceMaps); + } + function copyPrologue(source, target, ensureUseStrict2, visitor) { + var offset = copyStandardPrologue(source, target, 0, ensureUseStrict2); + return copyCustomPrologue(source, target, offset, visitor); + } + function isUseStrictPrologue(node) { + return ts6.isStringLiteral(node.expression) && node.expression.text === "use strict"; + } + function createUseStrictPrologue() { + return ts6.startOnNewLine(createExpressionStatement(createStringLiteral("use strict"))); + } + function copyStandardPrologue(source, target, statementOffset, ensureUseStrict2) { + if (statementOffset === void 0) { + statementOffset = 0; + } + ts6.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); + var foundUseStrict = false; + var numStatements = source.length; + while (statementOffset < numStatements) { + var statement = source[statementOffset]; + if (ts6.isPrologueDirective(statement)) { + if (isUseStrictPrologue(statement)) { + foundUseStrict = true; + } + target.push(statement); + } else { + break; + } + statementOffset++; + } + if (ensureUseStrict2 && !foundUseStrict) { + target.push(createUseStrictPrologue()); + } + return statementOffset; + } + function copyCustomPrologue(source, target, statementOffset, visitor, filter) { + if (filter === void 0) { + filter = ts6.returnTrue; + } + var numStatements = source.length; + while (statementOffset !== void 0 && statementOffset < numStatements) { + var statement = source[statementOffset]; + if (ts6.getEmitFlags(statement) & 1048576 && filter(statement)) { + ts6.append(target, visitor ? ts6.visitNode(statement, visitor, ts6.isStatement) : statement); + } else { + break; + } + statementOffset++; + } + return statementOffset; + } + function ensureUseStrict(statements) { + var foundUseStrict = ts6.findUseStrictPrologue(statements); + if (!foundUseStrict) { + return ts6.setTextRange(createNodeArray(__spreadArray([createUseStrictPrologue()], statements, true)), statements); + } + return statements; + } + function liftToBlock(nodes) { + ts6.Debug.assert(ts6.every(nodes, ts6.isStatementOrBlock), "Cannot lift nodes to a Block."); + return ts6.singleOrUndefined(nodes) || createBlock(nodes); + } + function findSpanEnd(array, test, start) { + var i = start; + while (i < array.length && test(array[i])) { + i++; + } + return i; + } + function mergeLexicalEnvironment(statements, declarations) { + if (!ts6.some(declarations)) { + return statements; + } + var leftStandardPrologueEnd = findSpanEnd(statements, ts6.isPrologueDirective, 0); + var leftHoistedFunctionsEnd = findSpanEnd(statements, ts6.isHoistedFunction, leftStandardPrologueEnd); + var leftHoistedVariablesEnd = findSpanEnd(statements, ts6.isHoistedVariableStatement, leftHoistedFunctionsEnd); + var rightStandardPrologueEnd = findSpanEnd(declarations, ts6.isPrologueDirective, 0); + var rightHoistedFunctionsEnd = findSpanEnd(declarations, ts6.isHoistedFunction, rightStandardPrologueEnd); + var rightHoistedVariablesEnd = findSpanEnd(declarations, ts6.isHoistedVariableStatement, rightHoistedFunctionsEnd); + var rightCustomPrologueEnd = findSpanEnd(declarations, ts6.isCustomPrologue, rightHoistedVariablesEnd); + ts6.Debug.assert(rightCustomPrologueEnd === declarations.length, "Expected declarations to be valid standard or custom prologues"); + var left = ts6.isNodeArray(statements) ? statements.slice() : statements; + if (rightCustomPrologueEnd > rightHoistedVariablesEnd) { + left.splice.apply(left, __spreadArray([leftHoistedVariablesEnd, 0], declarations.slice(rightHoistedVariablesEnd, rightCustomPrologueEnd), false)); + } + if (rightHoistedVariablesEnd > rightHoistedFunctionsEnd) { + left.splice.apply(left, __spreadArray([leftHoistedFunctionsEnd, 0], declarations.slice(rightHoistedFunctionsEnd, rightHoistedVariablesEnd), false)); + } + if (rightHoistedFunctionsEnd > rightStandardPrologueEnd) { + left.splice.apply(left, __spreadArray([leftStandardPrologueEnd, 0], declarations.slice(rightStandardPrologueEnd, rightHoistedFunctionsEnd), false)); + } + if (rightStandardPrologueEnd > 0) { + if (leftStandardPrologueEnd === 0) { + left.splice.apply(left, __spreadArray([0, 0], declarations.slice(0, rightStandardPrologueEnd), false)); + } else { + var leftPrologues = new ts6.Map(); + for (var i = 0; i < leftStandardPrologueEnd; i++) { + var leftPrologue = statements[i]; + leftPrologues.set(leftPrologue.expression.text, true); + } + for (var i = rightStandardPrologueEnd - 1; i >= 0; i--) { + var rightPrologue = declarations[i]; + if (!leftPrologues.has(rightPrologue.expression.text)) { + left.unshift(rightPrologue); + } + } + } + } + if (ts6.isNodeArray(statements)) { + return ts6.setTextRange(createNodeArray(left, statements.hasTrailingComma), statements); + } + return statements; + } + function updateModifiers(node, modifiers) { + var _a; + var modifierArray; + if (typeof modifiers === "number") { + modifierArray = createModifiersFromModifierFlags(modifiers); + } else { + modifierArray = modifiers; + } + return ts6.isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : ts6.isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : ts6.isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : ts6.isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : ts6.isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, (_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, node.type, node.initializer) : ts6.isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : ts6.isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : ts6.isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : ts6.isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : ts6.isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : ts6.isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : ts6.isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : ts6.isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : ts6.isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : ts6.isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : ts6.isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : ts6.isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : ts6.isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : ts6.isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : ts6.isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : ts6.isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : ts6.isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : ts6.isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : ts6.isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : ts6.isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : ts6.Debug.assertNever(node); + } + function asNodeArray(array) { + return array ? createNodeArray(array) : void 0; + } + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" ? createStringLiteral(value) : typeof value === "number" ? createNumericLiteral(value) : typeof value === "boolean" ? value ? createTrue() : createFalse() : value; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + function asEmbeddedStatement(statement) { + return statement && ts6.isNotEmittedStatement(statement) ? ts6.setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement; + } + } + ts6.createNodeFactory = createNodeFactory; + function updateWithoutOriginal(updated, original) { + if (updated !== original) { + ts6.setTextRange(updated, original); + } + return updated; + } + function updateWithOriginal(updated, original) { + if (updated !== original) { + setOriginalNode(updated, original); + ts6.setTextRange(updated, original); + } + return updated; + } + function getDefaultTagNameForKind(kind) { + switch (kind) { + case 346: + return "type"; + case 344: + return "returns"; + case 345: + return "this"; + case 342: + return "enum"; + case 333: + return "author"; + case 335: + return "class"; + case 336: + return "public"; + case 337: + return "private"; + case 338: + return "protected"; + case 339: + return "readonly"; + case 340: + return "override"; + case 347: + return "template"; + case 348: + return "typedef"; + case 343: + return "param"; + case 350: + return "prop"; + case 341: + return "callback"; + case 331: + return "augments"; + case 332: + return "implements"; + default: + return ts6.Debug.fail("Unsupported kind: ".concat(ts6.Debug.formatSyntaxKind(kind))); + } + } + var rawTextScanner; + var invalidValueSentinel = {}; + function getCookedText(kind, rawText) { + if (!rawTextScanner) { + rawTextScanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false, + 0 + /* LanguageVariant.Standard */ + ); + } + switch (kind) { + case 14: + rawTextScanner.setText("`" + rawText + "`"); + break; + case 15: + rawTextScanner.setText("`" + rawText + "${"); + break; + case 16: + rawTextScanner.setText("}" + rawText + "${"); + break; + case 17: + rawTextScanner.setText("}" + rawText + "`"); + break; + } + var token = rawTextScanner.scan(); + if (token === 19) { + token = rawTextScanner.reScanTemplateToken( + /*isTaggedTemplate*/ + false + ); + } + if (rawTextScanner.isUnterminated()) { + rawTextScanner.setText(void 0); + return invalidValueSentinel; + } + var tokenValue; + switch (token) { + case 14: + case 15: + case 16: + case 17: + tokenValue = rawTextScanner.getTokenValue(); + break; + } + if (tokenValue === void 0 || rawTextScanner.scan() !== 1) { + rawTextScanner.setText(void 0); + return invalidValueSentinel; + } + rawTextScanner.setText(void 0); + return tokenValue; + } + function propagateIdentifierNameFlags(node) { + return propagateChildFlags(node) & ~67108864; + } + function propagatePropertyNameFlagsOfChild(node, transformFlags) { + return transformFlags | node.transformFlags & 134234112; + } + function propagateChildFlags(child) { + if (!child) + return 0; + var childFlags = child.transformFlags & ~getTransformFlagsSubtreeExclusions(child.kind); + return ts6.isNamedDeclaration(child) && ts6.isPropertyName(child.name) ? propagatePropertyNameFlagsOfChild(child.name, childFlags) : childFlags; + } + function propagateChildrenFlags(children) { + return children ? children.transformFlags : 0; + } + function aggregateChildrenFlags(children) { + var subtreeFlags = 0; + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + subtreeFlags |= propagateChildFlags(child); + } + children.transformFlags = subtreeFlags; + } + function getTransformFlagsSubtreeExclusions(kind) { + if (kind >= 179 && kind <= 202) { + return -2; + } + switch (kind) { + case 210: + case 211: + case 206: + return -2147450880; + case 264: + return -1941676032; + case 166: + return -2147483648; + case 216: + return -2072174592; + case 215: + case 259: + return -1937940480; + case 258: + return -2146893824; + case 260: + case 228: + return -2147344384; + case 173: + return -1937948672; + case 169: + return -2013249536; + case 171: + case 174: + case 175: + return -2005057536; + case 131: + case 148: + case 160: + case 144: + case 152: + case 149: + case 134: + case 153: + case 114: + case 165: + case 168: + case 170: + case 176: + case 177: + case 178: + case 261: + case 262: + return -2; + case 207: + return -2147278848; + case 295: + return -2147418112; + case 203: + case 204: + return -2147450880; + case 213: + case 235: + case 231: + case 353: + case 214: + case 106: + return -2147483648; + case 208: + case 209: + return -2147483648; + default: + return -2147483648; + } + } + ts6.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; + var baseFactory = ts6.createBaseNodeFactory(); + function makeSynthetic(node) { + node.flags |= 8; + return node; + } + var syntheticFactory = { + createBaseSourceFileNode: function(kind) { + return makeSynthetic(baseFactory.createBaseSourceFileNode(kind)); + }, + createBaseIdentifierNode: function(kind) { + return makeSynthetic(baseFactory.createBaseIdentifierNode(kind)); + }, + createBasePrivateIdentifierNode: function(kind) { + return makeSynthetic(baseFactory.createBasePrivateIdentifierNode(kind)); + }, + createBaseTokenNode: function(kind) { + return makeSynthetic(baseFactory.createBaseTokenNode(kind)); + }, + createBaseNode: function(kind) { + return makeSynthetic(baseFactory.createBaseNode(kind)); + } + }; + ts6.factory = createNodeFactory(4, syntheticFactory); + function createUnparsedSourceFile(textOrInputFiles, mapPathOrType, mapTextOrStripInternal) { + var stripInternal; + var bundleFileInfo; + var fileName; + var text; + var length; + var sourceMapPath; + var sourceMapText; + var getText; + var getSourceMapText; + var oldFileOfCurrentEmit; + if (!ts6.isString(textOrInputFiles)) { + ts6.Debug.assert(mapPathOrType === "js" || mapPathOrType === "dts"); + fileName = (mapPathOrType === "js" ? textOrInputFiles.javascriptPath : textOrInputFiles.declarationPath) || ""; + sourceMapPath = mapPathOrType === "js" ? textOrInputFiles.javascriptMapPath : textOrInputFiles.declarationMapPath; + getText = function() { + return mapPathOrType === "js" ? textOrInputFiles.javascriptText : textOrInputFiles.declarationText; + }; + getSourceMapText = function() { + return mapPathOrType === "js" ? textOrInputFiles.javascriptMapText : textOrInputFiles.declarationMapText; + }; + length = function() { + return getText().length; + }; + if (textOrInputFiles.buildInfo && textOrInputFiles.buildInfo.bundle) { + ts6.Debug.assert(mapTextOrStripInternal === void 0 || typeof mapTextOrStripInternal === "boolean"); + stripInternal = mapTextOrStripInternal; + bundleFileInfo = mapPathOrType === "js" ? textOrInputFiles.buildInfo.bundle.js : textOrInputFiles.buildInfo.bundle.dts; + oldFileOfCurrentEmit = textOrInputFiles.oldFileOfCurrentEmit; + } + } else { + fileName = ""; + text = textOrInputFiles; + length = textOrInputFiles.length; + sourceMapPath = mapPathOrType; + sourceMapText = mapTextOrStripInternal; + } + var node = oldFileOfCurrentEmit ? parseOldFileOfCurrentEmit(ts6.Debug.checkDefined(bundleFileInfo)) : parseUnparsedSourceFile(bundleFileInfo, stripInternal, length); + node.fileName = fileName; + node.sourceMapPath = sourceMapPath; + node.oldFileOfCurrentEmit = oldFileOfCurrentEmit; + if (getText && getSourceMapText) { + Object.defineProperty(node, "text", { get: getText }); + Object.defineProperty(node, "sourceMapText", { get: getSourceMapText }); + } else { + ts6.Debug.assert(!oldFileOfCurrentEmit); + node.text = text !== null && text !== void 0 ? text : ""; + node.sourceMapText = sourceMapText; + } + return node; + } + ts6.createUnparsedSourceFile = createUnparsedSourceFile; + function parseUnparsedSourceFile(bundleFileInfo, stripInternal, length) { + var prologues; + var helpers; + var referencedFiles; + var typeReferenceDirectives; + var libReferenceDirectives; + var prependChildren; + var texts; + var hasNoDefaultLib; + for (var _i = 0, _a = bundleFileInfo ? bundleFileInfo.sections : ts6.emptyArray; _i < _a.length; _i++) { + var section = _a[_i]; + switch (section.kind) { + case "prologue": + prologues = ts6.append(prologues, ts6.setTextRange(ts6.factory.createUnparsedPrologue(section.data), section)); + break; + case "emitHelpers": + helpers = ts6.append(helpers, ts6.getAllUnscopedEmitHelpers().get(section.data)); + break; + case "no-default-lib": + hasNoDefaultLib = true; + break; + case "reference": + referencedFiles = ts6.append(referencedFiles, { pos: -1, end: -1, fileName: section.data }); + break; + case "type": + typeReferenceDirectives = ts6.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data }); + break; + case "type-import": + typeReferenceDirectives = ts6.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data, resolutionMode: ts6.ModuleKind.ESNext }); + break; + case "type-require": + typeReferenceDirectives = ts6.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data, resolutionMode: ts6.ModuleKind.CommonJS }); + break; + case "lib": + libReferenceDirectives = ts6.append(libReferenceDirectives, { pos: -1, end: -1, fileName: section.data }); + break; + case "prepend": + var prependTexts = void 0; + for (var _b = 0, _c = section.texts; _b < _c.length; _b++) { + var text = _c[_b]; + if (!stripInternal || text.kind !== "internal") { + prependTexts = ts6.append(prependTexts, ts6.setTextRange(ts6.factory.createUnparsedTextLike( + text.data, + text.kind === "internal" + /* BundleFileSectionKind.Internal */ + ), text)); + } + } + prependChildren = ts6.addRange(prependChildren, prependTexts); + texts = ts6.append(texts, ts6.factory.createUnparsedPrepend(section.data, prependTexts !== null && prependTexts !== void 0 ? prependTexts : ts6.emptyArray)); + break; + case "internal": + if (stripInternal) { + if (!texts) + texts = []; + break; + } + case "text": + texts = ts6.append(texts, ts6.setTextRange(ts6.factory.createUnparsedTextLike( + section.data, + section.kind === "internal" + /* BundleFileSectionKind.Internal */ + ), section)); + break; + default: + ts6.Debug.assertNever(section); + } + } + if (!texts) { + var textNode = ts6.factory.createUnparsedTextLike( + /*data*/ + void 0, + /*internal*/ + false + ); + ts6.setTextRangePosWidth(textNode, 0, typeof length === "function" ? length() : length); + texts = [textNode]; + } + var node = ts6.parseNodeFactory.createUnparsedSource( + prologues !== null && prologues !== void 0 ? prologues : ts6.emptyArray, + /*syntheticReferences*/ + void 0, + texts + ); + ts6.setEachParent(prologues, node); + ts6.setEachParent(texts, node); + ts6.setEachParent(prependChildren, node); + node.hasNoDefaultLib = hasNoDefaultLib; + node.helpers = helpers; + node.referencedFiles = referencedFiles || ts6.emptyArray; + node.typeReferenceDirectives = typeReferenceDirectives; + node.libReferenceDirectives = libReferenceDirectives || ts6.emptyArray; + return node; + } + function parseOldFileOfCurrentEmit(bundleFileInfo) { + var texts; + var syntheticReferences; + for (var _i = 0, _a = bundleFileInfo.sections; _i < _a.length; _i++) { + var section = _a[_i]; + switch (section.kind) { + case "internal": + case "text": + texts = ts6.append(texts, ts6.setTextRange(ts6.factory.createUnparsedTextLike( + section.data, + section.kind === "internal" + /* BundleFileSectionKind.Internal */ + ), section)); + break; + case "no-default-lib": + case "reference": + case "type": + case "type-import": + case "type-require": + case "lib": + syntheticReferences = ts6.append(syntheticReferences, ts6.setTextRange(ts6.factory.createUnparsedSyntheticReference(section), section)); + break; + case "prologue": + case "emitHelpers": + case "prepend": + break; + default: + ts6.Debug.assertNever(section); + } + } + var node = ts6.factory.createUnparsedSource(ts6.emptyArray, syntheticReferences, texts !== null && texts !== void 0 ? texts : ts6.emptyArray); + ts6.setEachParent(syntheticReferences, node); + ts6.setEachParent(texts, node); + node.helpers = ts6.map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, function(name) { + return ts6.getAllUnscopedEmitHelpers().get(name); + }); + return node; + } + function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) { + var node = ts6.parseNodeFactory.createInputFiles(); + if (!ts6.isString(javascriptTextOrReadFileText)) { + var cache_1 = new ts6.Map(); + var textGetter_1 = function(path) { + if (path === void 0) + return void 0; + var value = cache_1.get(path); + if (value === void 0) { + value = javascriptTextOrReadFileText(path); + cache_1.set(path, value !== void 0 ? value : false); + } + return value !== false ? value : void 0; + }; + var definedTextGetter_1 = function(path) { + var result = textGetter_1(path); + return result !== void 0 ? result : "/* Input file ".concat(path, " was missing */\r\n"); + }; + var buildInfo_1; + var getAndCacheBuildInfo_1 = function(getText) { + var _a; + if (buildInfo_1 === void 0) { + var result = getText(); + buildInfo_1 = result !== void 0 ? (_a = ts6.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; + } + return buildInfo_1 || void 0; + }; + node.javascriptPath = declarationTextOrJavascriptPath; + node.javascriptMapPath = javascriptMapPath; + node.declarationPath = ts6.Debug.checkDefined(javascriptMapTextOrDeclarationPath); + node.declarationMapPath = declarationMapPath; + node.buildInfoPath = declarationMapTextOrBuildInfoPath; + Object.defineProperties(node, { + javascriptText: { get: function() { + return definedTextGetter_1(declarationTextOrJavascriptPath); + } }, + javascriptMapText: { get: function() { + return textGetter_1(javascriptMapPath); + } }, + declarationText: { get: function() { + return definedTextGetter_1(ts6.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); + } }, + declarationMapText: { get: function() { + return textGetter_1(declarationMapPath); + } }, + buildInfo: { get: function() { + return getAndCacheBuildInfo_1(function() { + return textGetter_1(declarationMapTextOrBuildInfoPath); + }); + } } + }); + } else { + node.javascriptText = javascriptTextOrReadFileText; + node.javascriptMapPath = javascriptMapPath; + node.javascriptMapText = javascriptMapTextOrDeclarationPath; + node.declarationText = declarationTextOrJavascriptPath; + node.declarationMapPath = declarationMapPath; + node.declarationMapText = declarationMapTextOrBuildInfoPath; + node.javascriptPath = javascriptPath; + node.declarationPath = declarationPath; + node.buildInfoPath = buildInfoPath; + node.buildInfo = buildInfo; + node.oldFileOfCurrentEmit = oldFileOfCurrentEmit; + } + return node; + } + ts6.createInputFiles = createInputFiles; + var SourceMapSource; + function createSourceMapSource(fileName, text, skipTrivia) { + return new (SourceMapSource || (SourceMapSource = ts6.objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia); + } + ts6.createSourceMapSource = createSourceMapSource; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts6.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts6.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts6.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags & ~268435456; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== void 0) + destEmitNode.constantValue = constantValue; + if (helpers) { + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + destEmitNode.helpers = ts6.appendIfUnique(destEmitNode.helpers, helper); + } + } + if (startsOnNewLine !== void 0) + destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== void 0) + destEmitNode.snippetElement = snippetElement; + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getOrCreateEmitNode(node) { + var _a; + if (!node.emitNode) { + if (ts6.isParseTreeNode(node)) { + if (node.kind === 308) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = (_a = ts6.getSourceFileOfNode(ts6.getParseTreeNode(ts6.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts6.Debug.fail("Could not determine parsed source file."); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } else { + ts6.Debug.assert(!(node.emitNode.flags & 268435456), "Invalid attempt to mutate an immutable node."); + } + return node.emitNode; + } + ts6.getOrCreateEmitNode = getOrCreateEmitNode; + function disposeEmitNodes(sourceFile) { + var _a, _b; + var annotatedNodes = (_b = (_a = ts6.getSourceFileOfNode(ts6.getParseTreeNode(sourceFile))) === null || _a === void 0 ? void 0 : _a.emitNode) === null || _b === void 0 ? void 0 : _b.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = void 0; + } + } + } + ts6.disposeEmitNodes = disposeEmitNodes; + function removeAllComments(node) { + var emitNode = getOrCreateEmitNode(node); + emitNode.flags |= 1536; + emitNode.leadingComments = void 0; + emitNode.trailingComments = void 0; + return node; + } + ts6.removeAllComments = removeAllComments; + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts6.setEmitFlags = setEmitFlags; + function addEmitFlags(node, emitFlags) { + var emitNode = getOrCreateEmitNode(node); + emitNode.flags = emitNode.flags | emitFlags; + return node; + } + ts6.addEmitFlags = addEmitFlags; + function getSourceMapRange(node) { + var _a, _b; + return (_b = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.sourceMapRange) !== null && _b !== void 0 ? _b : node; + } + ts6.getSourceMapRange = getSourceMapRange; + function setSourceMapRange(node, range2) { + getOrCreateEmitNode(node).sourceMapRange = range2; + return node; + } + ts6.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var _a, _b; + return (_b = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.tokenSourceMapRanges) === null || _b === void 0 ? void 0 : _b[token]; + } + ts6.getTokenSourceMapRange = getTokenSourceMapRange; + function setTokenSourceMapRange(node, token, range2) { + var _a; + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = (_a = emitNode.tokenSourceMapRanges) !== null && _a !== void 0 ? _a : emitNode.tokenSourceMapRanges = []; + tokenSourceMapRanges[token] = range2; + return node; + } + ts6.setTokenSourceMapRange = setTokenSourceMapRange; + function getStartsOnNewLine(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.startsOnNewLine; + } + ts6.getStartsOnNewLine = getStartsOnNewLine; + function setStartsOnNewLine(node, newLine) { + getOrCreateEmitNode(node).startsOnNewLine = newLine; + return node; + } + ts6.setStartsOnNewLine = setStartsOnNewLine; + function getCommentRange(node) { + var _a, _b; + return (_b = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.commentRange) !== null && _b !== void 0 ? _b : node; + } + ts6.getCommentRange = getCommentRange; + function setCommentRange(node, range2) { + getOrCreateEmitNode(node).commentRange = range2; + return node; + } + ts6.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.leadingComments; + } + ts6.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts6.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts6.append(getSyntheticLeadingComments(node), { kind, pos: -1, end: -1, hasTrailingNewLine, text })); + } + ts6.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.trailingComments; + } + ts6.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts6.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts6.append(getSyntheticTrailingComments(node), { kind, pos: -1, end: -1, hasTrailingNewLine, text })); + } + ts6.addSyntheticTrailingComment = addSyntheticTrailingComment; + function moveSyntheticComments(node, original) { + setSyntheticLeadingComments(node, getSyntheticLeadingComments(original)); + setSyntheticTrailingComments(node, getSyntheticTrailingComments(original)); + var emit = getOrCreateEmitNode(original); + emit.leadingComments = void 0; + emit.trailingComments = void 0; + return node; + } + ts6.moveSyntheticComments = moveSyntheticComments; + function getConstantValue(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.constantValue; + } + ts6.getConstantValue = getConstantValue; + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts6.setConstantValue = setConstantValue; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts6.append(emitNode.helpers, helper); + return node; + } + ts6.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts6.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + emitNode.helpers = ts6.appendIfUnique(emitNode.helpers, helper); + } + } + return node; + } + ts6.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var _a; + var helpers = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.helpers; + if (helpers) { + return ts6.orderedRemoveItem(helpers, helper); + } + return false; + } + ts6.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.helpers; + } + ts6.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts6.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + targetEmitNode.helpers = ts6.appendIfUnique(targetEmitNode.helpers, helper); + } else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts6.moveEmitHelpers = moveEmitHelpers; + function getSnippetElement(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement; + } + ts6.getSnippetElement = getSnippetElement; + function setSnippetElement(node, snippet) { + var emitNode = getOrCreateEmitNode(node); + emitNode.snippetElement = snippet; + return node; + } + ts6.setSnippetElement = setSnippetElement; + function ignoreSourceNewlines(node) { + getOrCreateEmitNode(node).flags |= 134217728; + return node; + } + ts6.ignoreSourceNewlines = ignoreSourceNewlines; + function setTypeNode(node, type) { + var emitNode = getOrCreateEmitNode(node); + emitNode.typeNode = type; + return node; + } + ts6.setTypeNode = setTypeNode; + function getTypeNode(node) { + var _a; + return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.typeNode; + } + ts6.getTypeNode = getTypeNode; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createEmitHelperFactory(context) { + var factory = context.factory; + var immutableTrue = ts6.memoize(function() { + return ts6.setEmitFlags( + factory.createTrue(), + 268435456 + /* EmitFlags.Immutable */ + ); + }); + var immutableFalse = ts6.memoize(function() { + return ts6.setEmitFlags( + factory.createFalse(), + 268435456 + /* EmitFlags.Immutable */ + ); + }); + return { + getUnscopedHelperName, + // TypeScript Helpers + createDecorateHelper, + createMetadataHelper, + createParamHelper, + // ES2018 Helpers + createAssignHelper, + createAwaitHelper, + createAsyncGeneratorHelper, + createAsyncDelegatorHelper, + createAsyncValuesHelper, + // ES2018 Destructuring Helpers + createRestHelper, + // ES2017 Helpers + createAwaiterHelper, + // ES2015 Helpers + createExtendsHelper, + createTemplateObjectHelper, + createSpreadArrayHelper, + // ES2015 Destructuring Helpers + createValuesHelper, + createReadHelper, + // ES2015 Generator Helpers + createGeneratorHelper, + // ES Module Helpers + createCreateBindingHelper, + createImportStarHelper, + createImportStarCallbackHelper, + createImportDefaultHelper, + createExportStarHelper, + // Class Fields Helpers + createClassPrivateFieldGetHelper, + createClassPrivateFieldSetHelper, + createClassPrivateFieldInHelper + }; + function getUnscopedHelperName(name) { + return ts6.setEmitFlags( + factory.createIdentifier(name), + 4096 | 2 + /* EmitFlags.AdviseOnEmitNode */ + ); + } + function createDecorateHelper(decoratorExpressions, target, memberName, descriptor) { + context.requestEmitHelper(ts6.decorateHelper); + var argumentsArray = []; + argumentsArray.push(factory.createArrayLiteralExpression( + decoratorExpressions, + /*multiLine*/ + true + )); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + return factory.createCallExpression( + getUnscopedHelperName("__decorate"), + /*typeArguments*/ + void 0, + argumentsArray + ); + } + function createMetadataHelper(metadataKey, metadataValue) { + context.requestEmitHelper(ts6.metadataHelper); + return factory.createCallExpression( + getUnscopedHelperName("__metadata"), + /*typeArguments*/ + void 0, + [ + factory.createStringLiteral(metadataKey), + metadataValue + ] + ); + } + function createParamHelper(expression, parameterOffset, location) { + context.requestEmitHelper(ts6.paramHelper); + return ts6.setTextRange(factory.createCallExpression( + getUnscopedHelperName("__param"), + /*typeArguments*/ + void 0, + [ + factory.createNumericLiteral(parameterOffset + ""), + expression + ] + ), location); + } + function createAssignHelper(attributesSegments) { + if (ts6.getEmitScriptTarget(context.getCompilerOptions()) >= 2) { + return factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"), + /*typeArguments*/ + void 0, + attributesSegments + ); + } + context.requestEmitHelper(ts6.assignHelper); + return factory.createCallExpression( + getUnscopedHelperName("__assign"), + /*typeArguments*/ + void 0, + attributesSegments + ); + } + function createAwaitHelper(expression) { + context.requestEmitHelper(ts6.awaitHelper); + return factory.createCallExpression( + getUnscopedHelperName("__await"), + /*typeArguments*/ + void 0, + [expression] + ); + } + function createAsyncGeneratorHelper(generatorFunc, hasLexicalThis) { + context.requestEmitHelper(ts6.awaitHelper); + context.requestEmitHelper(ts6.asyncGeneratorHelper); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288; + return factory.createCallExpression( + getUnscopedHelperName("__asyncGenerator"), + /*typeArguments*/ + void 0, + [ + hasLexicalThis ? factory.createThis() : factory.createVoidZero(), + factory.createIdentifier("arguments"), + generatorFunc + ] + ); + } + function createAsyncDelegatorHelper(expression) { + context.requestEmitHelper(ts6.awaitHelper); + context.requestEmitHelper(ts6.asyncDelegator); + return factory.createCallExpression( + getUnscopedHelperName("__asyncDelegator"), + /*typeArguments*/ + void 0, + [expression] + ); + } + function createAsyncValuesHelper(expression) { + context.requestEmitHelper(ts6.asyncValues); + return factory.createCallExpression( + getUnscopedHelperName("__asyncValues"), + /*typeArguments*/ + void 0, + [expression] + ); + } + function createRestHelper(value, elements, computedTempVariables, location) { + context.requestEmitHelper(ts6.restHelper); + var propertyNames = []; + var computedTempVariableOffset = 0; + for (var i = 0; i < elements.length - 1; i++) { + var propertyName = ts6.getPropertyNameOfBindingOrAssignmentElement(elements[i]); + if (propertyName) { + if (ts6.isComputedPropertyName(propertyName)) { + ts6.Debug.assertIsDefined(computedTempVariables, "Encountered computed property name but 'computedTempVariables' argument was not provided."); + var temp = computedTempVariables[computedTempVariableOffset]; + computedTempVariableOffset++; + propertyNames.push(factory.createConditionalExpression( + factory.createTypeCheck(temp, "symbol"), + /*questionToken*/ + void 0, + temp, + /*colonToken*/ + void 0, + factory.createAdd(temp, factory.createStringLiteral("")) + )); + } else { + propertyNames.push(factory.createStringLiteralFromNode(propertyName)); + } + } + } + return factory.createCallExpression( + getUnscopedHelperName("__rest"), + /*typeArguments*/ + void 0, + [ + value, + ts6.setTextRange(factory.createArrayLiteralExpression(propertyNames), location) + ] + ); + } + function createAwaiterHelper(hasLexicalThis, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(ts6.awaiterHelper); + var generatorFunc = factory.createFunctionExpression( + /*modifiers*/ + void 0, + factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ), + /*name*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + body + ); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288; + return factory.createCallExpression( + getUnscopedHelperName("__awaiter"), + /*typeArguments*/ + void 0, + [ + hasLexicalThis ? factory.createThis() : factory.createVoidZero(), + hasLexicalArguments ? factory.createIdentifier("arguments") : factory.createVoidZero(), + promiseConstructor ? ts6.createExpressionFromEntityName(factory, promiseConstructor) : factory.createVoidZero(), + generatorFunc + ] + ); + } + function createExtendsHelper(name) { + context.requestEmitHelper(ts6.extendsHelper); + return factory.createCallExpression( + getUnscopedHelperName("__extends"), + /*typeArguments*/ + void 0, + [name, factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + )] + ); + } + function createTemplateObjectHelper(cooked, raw) { + context.requestEmitHelper(ts6.templateObjectHelper); + return factory.createCallExpression( + getUnscopedHelperName("__makeTemplateObject"), + /*typeArguments*/ + void 0, + [cooked, raw] + ); + } + function createSpreadArrayHelper(to, from, packFrom) { + context.requestEmitHelper(ts6.spreadArrayHelper); + return factory.createCallExpression( + getUnscopedHelperName("__spreadArray"), + /*typeArguments*/ + void 0, + [to, from, packFrom ? immutableTrue() : immutableFalse()] + ); + } + function createValuesHelper(expression) { + context.requestEmitHelper(ts6.valuesHelper); + return factory.createCallExpression( + getUnscopedHelperName("__values"), + /*typeArguments*/ + void 0, + [expression] + ); + } + function createReadHelper(iteratorRecord, count) { + context.requestEmitHelper(ts6.readHelper); + return factory.createCallExpression( + getUnscopedHelperName("__read"), + /*typeArguments*/ + void 0, + count !== void 0 ? [iteratorRecord, factory.createNumericLiteral(count + "")] : [iteratorRecord] + ); + } + function createGeneratorHelper(body) { + context.requestEmitHelper(ts6.generatorHelper); + return factory.createCallExpression( + getUnscopedHelperName("__generator"), + /*typeArguments*/ + void 0, + [factory.createThis(), body] + ); + } + function createCreateBindingHelper(module2, inputName, outputName) { + context.requestEmitHelper(ts6.createBindingHelper); + return factory.createCallExpression( + getUnscopedHelperName("__createBinding"), + /*typeArguments*/ + void 0, + __spreadArray([factory.createIdentifier("exports"), module2, inputName], outputName ? [outputName] : [], true) + ); + } + function createImportStarHelper(expression) { + context.requestEmitHelper(ts6.importStarHelper); + return factory.createCallExpression( + getUnscopedHelperName("__importStar"), + /*typeArguments*/ + void 0, + [expression] + ); + } + function createImportStarCallbackHelper() { + context.requestEmitHelper(ts6.importStarHelper); + return getUnscopedHelperName("__importStar"); + } + function createImportDefaultHelper(expression) { + context.requestEmitHelper(ts6.importDefaultHelper); + return factory.createCallExpression( + getUnscopedHelperName("__importDefault"), + /*typeArguments*/ + void 0, + [expression] + ); + } + function createExportStarHelper(moduleExpression, exportsExpression) { + if (exportsExpression === void 0) { + exportsExpression = factory.createIdentifier("exports"); + } + context.requestEmitHelper(ts6.exportStarHelper); + context.requestEmitHelper(ts6.createBindingHelper); + return factory.createCallExpression( + getUnscopedHelperName("__exportStar"), + /*typeArguments*/ + void 0, + [moduleExpression, exportsExpression] + ); + } + function createClassPrivateFieldGetHelper(receiver, state, kind, f) { + context.requestEmitHelper(ts6.classPrivateFieldGetHelper); + var args; + if (!f) { + args = [receiver, state, factory.createStringLiteral(kind)]; + } else { + args = [receiver, state, factory.createStringLiteral(kind), f]; + } + return factory.createCallExpression( + getUnscopedHelperName("__classPrivateFieldGet"), + /*typeArguments*/ + void 0, + args + ); + } + function createClassPrivateFieldSetHelper(receiver, state, value, kind, f) { + context.requestEmitHelper(ts6.classPrivateFieldSetHelper); + var args; + if (!f) { + args = [receiver, state, value, factory.createStringLiteral(kind)]; + } else { + args = [receiver, state, value, factory.createStringLiteral(kind), f]; + } + return factory.createCallExpression( + getUnscopedHelperName("__classPrivateFieldSet"), + /*typeArguments*/ + void 0, + args + ); + } + function createClassPrivateFieldInHelper(state, receiver) { + context.requestEmitHelper(ts6.classPrivateFieldInHelper); + return factory.createCallExpression( + getUnscopedHelperName("__classPrivateFieldIn"), + /* typeArguments*/ + void 0, + [state, receiver] + ); + } + } + ts6.createEmitHelperFactory = createEmitHelperFactory; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === void 0) + return 1; + if (y.priority === void 0) + return -1; + return ts6.compareValues(x.priority, y.priority); + } + ts6.compareEmitHelpers = compareEmitHelpers; + function helperString(input) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return function(uniqueName) { + var result = ""; + for (var i = 0; i < args.length; i++) { + result += input[i]; + result += uniqueName(args[i]); + } + result += input[input.length - 1]; + return result; + }; + } + ts6.helperString = helperString; + ts6.decorateHelper = { + name: "typescript:decorate", + importName: "__decorate", + scoped: false, + priority: 2, + text: '\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };' + }; + ts6.metadataHelper = { + name: "typescript:metadata", + importName: "__metadata", + scoped: false, + priority: 3, + text: '\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);\n };' + }; + ts6.paramHelper = { + name: "typescript:param", + importName: "__param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; + ts6.assignHelper = { + name: "typescript:assign", + importName: "__assign", + scoped: false, + priority: 1, + text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };" + }; + ts6.awaitHelper = { + name: "typescript:await", + importName: "__await", + scoped: false, + text: "\n var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }" + }; + ts6.asyncGeneratorHelper = { + name: "typescript:asyncGenerator", + importName: "__asyncGenerator", + scoped: false, + dependencies: [ts6.awaitHelper], + text: '\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume("next", value); }\n function reject(value) { resume("throw", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n };' + }; + ts6.asyncDelegator = { + name: "typescript:asyncDelegator", + importName: "__asyncDelegator", + scoped: false, + dependencies: [ts6.awaitHelper], + text: '\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }\n };' + }; + ts6.asyncValues = { + name: "typescript:asyncValues", + importName: "__asyncValues", + scoped: false, + text: '\n var __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n };' + }; + ts6.restHelper = { + name: "typescript:rest", + importName: "__rest", + scoped: false, + text: '\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };' + }; + ts6.awaiterHelper = { + name: "typescript:awaiter", + importName: "__awaiter", + scoped: false, + priority: 5, + text: '\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };' + }; + ts6.extendsHelper = { + name: "typescript:extends", + importName: "__extends", + scoped: false, + priority: 0, + text: '\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n return function (d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();' + }; + ts6.templateObjectHelper = { + name: "typescript:makeTemplateObject", + importName: "__makeTemplateObject", + scoped: false, + priority: 0, + text: '\n var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n };' + }; + ts6.readHelper = { + name: "typescript:read", + importName: "__read", + scoped: false, + text: '\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };' + }; + ts6.spreadArrayHelper = { + name: "typescript:spreadArray", + importName: "__spreadArray", + scoped: false, + text: "\n var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n };" + }; + ts6.valuesHelper = { + name: "typescript:values", + importName: "__values", + scoped: false, + text: '\n var __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n };' + }; + ts6.generatorHelper = { + name: "typescript:generator", + importName: "__generator", + scoped: false, + priority: 6, + text: '\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };' + }; + ts6.createBindingHelper = { + name: "typescript:commonjscreatebinding", + importName: "__createBinding", + scoped: false, + priority: 1, + text: '\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n }) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n }));' + }; + ts6.setModuleDefaultHelper = { + name: "typescript:commonjscreatevalue", + importName: "__setModuleDefault", + scoped: false, + priority: 1, + text: '\n var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, "default", { enumerable: true, value: v });\n }) : function(o, v) {\n o["default"] = v;\n });' + }; + ts6.importStarHelper = { + name: "typescript:commonjsimportstar", + importName: "__importStar", + scoped: false, + dependencies: [ts6.createBindingHelper, ts6.setModuleDefaultHelper], + priority: 2, + text: '\n var __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n };' + }; + ts6.importDefaultHelper = { + name: "typescript:commonjsimportdefault", + importName: "__importDefault", + scoped: false, + text: '\n var __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { "default": mod };\n };' + }; + ts6.exportStarHelper = { + name: "typescript:export-star", + importName: "__exportStar", + scoped: false, + dependencies: [ts6.createBindingHelper], + priority: 2, + text: '\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n };' + }; + ts6.classPrivateFieldGetHelper = { + name: "typescript:classPrivateFieldGet", + importName: "__classPrivateFieldGet", + scoped: false, + text: '\n var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");\n return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);\n };' + }; + ts6.classPrivateFieldSetHelper = { + name: "typescript:classPrivateFieldSet", + importName: "__classPrivateFieldSet", + scoped: false, + text: '\n var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === "m") throw new TypeError("Private method is not writable");\n if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");\n if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");\n return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n };' + }; + ts6.classPrivateFieldInHelper = { + name: "typescript:classPrivateFieldIn", + importName: "__classPrivateFieldIn", + scoped: false, + text: ` + var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + };` + }; + var allUnscopedEmitHelpers; + function getAllUnscopedEmitHelpers() { + return allUnscopedEmitHelpers || (allUnscopedEmitHelpers = ts6.arrayToMap([ + ts6.decorateHelper, + ts6.metadataHelper, + ts6.paramHelper, + ts6.assignHelper, + ts6.awaitHelper, + ts6.asyncGeneratorHelper, + ts6.asyncDelegator, + ts6.asyncValues, + ts6.restHelper, + ts6.awaiterHelper, + ts6.extendsHelper, + ts6.templateObjectHelper, + ts6.spreadArrayHelper, + ts6.valuesHelper, + ts6.readHelper, + ts6.generatorHelper, + ts6.importStarHelper, + ts6.importDefaultHelper, + ts6.exportStarHelper, + ts6.classPrivateFieldGetHelper, + ts6.classPrivateFieldSetHelper, + ts6.classPrivateFieldInHelper, + ts6.createBindingHelper, + ts6.setModuleDefaultHelper + ], function(helper) { + return helper.name; + })); + } + ts6.getAllUnscopedEmitHelpers = getAllUnscopedEmitHelpers; + ts6.asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: helperString(__makeTemplateObject(["\n const ", " = name => super[name];"], ["\n const ", " = name => super[name];"]), "_superIndex") + }; + ts6.advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: helperString(__makeTemplateObject(["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"], ["\n const ", " = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"]), "_superIndex") + }; + function isCallToHelper(firstSegment, helperName) { + return ts6.isCallExpression(firstSegment) && ts6.isIdentifier(firstSegment.expression) && (ts6.getEmitFlags(firstSegment.expression) & 4096) !== 0 && firstSegment.expression.escapedText === helperName; + } + ts6.isCallToHelper = isCallToHelper; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function isNumericLiteral3(node) { + return node.kind === 8; + } + ts6.isNumericLiteral = isNumericLiteral3; + function isBigIntLiteral(node) { + return node.kind === 9; + } + ts6.isBigIntLiteral = isBigIntLiteral; + function isStringLiteral3(node) { + return node.kind === 10; + } + ts6.isStringLiteral = isStringLiteral3; + function isJsxText(node) { + return node.kind === 11; + } + ts6.isJsxText = isJsxText; + function isRegularExpressionLiteral(node) { + return node.kind === 13; + } + ts6.isRegularExpressionLiteral = isRegularExpressionLiteral; + function isNoSubstitutionTemplateLiteral2(node) { + return node.kind === 14; + } + ts6.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral2; + function isTemplateHead(node) { + return node.kind === 15; + } + ts6.isTemplateHead = isTemplateHead; + function isTemplateMiddle(node) { + return node.kind === 16; + } + ts6.isTemplateMiddle = isTemplateMiddle; + function isTemplateTail(node) { + return node.kind === 17; + } + ts6.isTemplateTail = isTemplateTail; + function isDotDotDotToken(node) { + return node.kind === 25; + } + ts6.isDotDotDotToken = isDotDotDotToken; + function isCommaToken(node) { + return node.kind === 27; + } + ts6.isCommaToken = isCommaToken; + function isPlusToken(node) { + return node.kind === 39; + } + ts6.isPlusToken = isPlusToken; + function isMinusToken(node) { + return node.kind === 40; + } + ts6.isMinusToken = isMinusToken; + function isAsteriskToken(node) { + return node.kind === 41; + } + ts6.isAsteriskToken = isAsteriskToken; + function isExclamationToken(node) { + return node.kind === 53; + } + ts6.isExclamationToken = isExclamationToken; + function isQuestionToken(node) { + return node.kind === 57; + } + ts6.isQuestionToken = isQuestionToken; + function isColonToken(node) { + return node.kind === 58; + } + ts6.isColonToken = isColonToken; + function isQuestionDotToken(node) { + return node.kind === 28; + } + ts6.isQuestionDotToken = isQuestionDotToken; + function isEqualsGreaterThanToken(node) { + return node.kind === 38; + } + ts6.isEqualsGreaterThanToken = isEqualsGreaterThanToken; + function isIdentifier3(node) { + return node.kind === 79; + } + ts6.isIdentifier = isIdentifier3; + function isPrivateIdentifier(node) { + return node.kind === 80; + } + ts6.isPrivateIdentifier = isPrivateIdentifier; + function isExportModifier(node) { + return node.kind === 93; + } + ts6.isExportModifier = isExportModifier; + function isAsyncModifier(node) { + return node.kind === 132; + } + ts6.isAsyncModifier = isAsyncModifier; + function isAssertsKeyword(node) { + return node.kind === 129; + } + ts6.isAssertsKeyword = isAssertsKeyword; + function isAwaitKeyword(node) { + return node.kind === 133; + } + ts6.isAwaitKeyword = isAwaitKeyword; + function isReadonlyKeyword(node) { + return node.kind === 146; + } + ts6.isReadonlyKeyword = isReadonlyKeyword; + function isStaticModifier(node) { + return node.kind === 124; + } + ts6.isStaticModifier = isStaticModifier; + function isAbstractModifier(node) { + return node.kind === 126; + } + ts6.isAbstractModifier = isAbstractModifier; + function isOverrideModifier(node) { + return node.kind === 161; + } + ts6.isOverrideModifier = isOverrideModifier; + function isAccessorModifier(node) { + return node.kind === 127; + } + ts6.isAccessorModifier = isAccessorModifier; + function isSuperKeyword(node) { + return node.kind === 106; + } + ts6.isSuperKeyword = isSuperKeyword; + function isImportKeyword(node) { + return node.kind === 100; + } + ts6.isImportKeyword = isImportKeyword; + function isQualifiedName(node) { + return node.kind === 163; + } + ts6.isQualifiedName = isQualifiedName; + function isComputedPropertyName2(node) { + return node.kind === 164; + } + ts6.isComputedPropertyName = isComputedPropertyName2; + function isTypeParameterDeclaration(node) { + return node.kind === 165; + } + ts6.isTypeParameterDeclaration = isTypeParameterDeclaration; + function isParameter2(node) { + return node.kind === 166; + } + ts6.isParameter = isParameter2; + function isDecorator(node) { + return node.kind === 167; + } + ts6.isDecorator = isDecorator; + function isPropertySignature(node) { + return node.kind === 168; + } + ts6.isPropertySignature = isPropertySignature; + function isPropertyDeclaration2(node) { + return node.kind === 169; + } + ts6.isPropertyDeclaration = isPropertyDeclaration2; + function isMethodSignature(node) { + return node.kind === 170; + } + ts6.isMethodSignature = isMethodSignature; + function isMethodDeclaration2(node) { + return node.kind === 171; + } + ts6.isMethodDeclaration = isMethodDeclaration2; + function isClassStaticBlockDeclaration(node) { + return node.kind === 172; + } + ts6.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; + function isConstructorDeclaration2(node) { + return node.kind === 173; + } + ts6.isConstructorDeclaration = isConstructorDeclaration2; + function isGetAccessorDeclaration(node) { + return node.kind === 174; + } + ts6.isGetAccessorDeclaration = isGetAccessorDeclaration; + function isSetAccessorDeclaration(node) { + return node.kind === 175; + } + ts6.isSetAccessorDeclaration = isSetAccessorDeclaration; + function isCallSignatureDeclaration(node) { + return node.kind === 176; + } + ts6.isCallSignatureDeclaration = isCallSignatureDeclaration; + function isConstructSignatureDeclaration(node) { + return node.kind === 177; + } + ts6.isConstructSignatureDeclaration = isConstructSignatureDeclaration; + function isIndexSignatureDeclaration(node) { + return node.kind === 178; + } + ts6.isIndexSignatureDeclaration = isIndexSignatureDeclaration; + function isTypePredicateNode(node) { + return node.kind === 179; + } + ts6.isTypePredicateNode = isTypePredicateNode; + function isTypeReferenceNode(node) { + return node.kind === 180; + } + ts6.isTypeReferenceNode = isTypeReferenceNode; + function isFunctionTypeNode(node) { + return node.kind === 181; + } + ts6.isFunctionTypeNode = isFunctionTypeNode; + function isConstructorTypeNode(node) { + return node.kind === 182; + } + ts6.isConstructorTypeNode = isConstructorTypeNode; + function isTypeQueryNode(node) { + return node.kind === 183; + } + ts6.isTypeQueryNode = isTypeQueryNode; + function isTypeLiteralNode(node) { + return node.kind === 184; + } + ts6.isTypeLiteralNode = isTypeLiteralNode; + function isArrayTypeNode(node) { + return node.kind === 185; + } + ts6.isArrayTypeNode = isArrayTypeNode; + function isTupleTypeNode(node) { + return node.kind === 186; + } + ts6.isTupleTypeNode = isTupleTypeNode; + function isNamedTupleMember(node) { + return node.kind === 199; + } + ts6.isNamedTupleMember = isNamedTupleMember; + function isOptionalTypeNode(node) { + return node.kind === 187; + } + ts6.isOptionalTypeNode = isOptionalTypeNode; + function isRestTypeNode(node) { + return node.kind === 188; + } + ts6.isRestTypeNode = isRestTypeNode; + function isUnionTypeNode(node) { + return node.kind === 189; + } + ts6.isUnionTypeNode = isUnionTypeNode; + function isIntersectionTypeNode(node) { + return node.kind === 190; + } + ts6.isIntersectionTypeNode = isIntersectionTypeNode; + function isConditionalTypeNode(node) { + return node.kind === 191; + } + ts6.isConditionalTypeNode = isConditionalTypeNode; + function isInferTypeNode(node) { + return node.kind === 192; + } + ts6.isInferTypeNode = isInferTypeNode; + function isParenthesizedTypeNode(node) { + return node.kind === 193; + } + ts6.isParenthesizedTypeNode = isParenthesizedTypeNode; + function isThisTypeNode(node) { + return node.kind === 194; + } + ts6.isThisTypeNode = isThisTypeNode; + function isTypeOperatorNode(node) { + return node.kind === 195; + } + ts6.isTypeOperatorNode = isTypeOperatorNode; + function isIndexedAccessTypeNode(node) { + return node.kind === 196; + } + ts6.isIndexedAccessTypeNode = isIndexedAccessTypeNode; + function isMappedTypeNode(node) { + return node.kind === 197; + } + ts6.isMappedTypeNode = isMappedTypeNode; + function isLiteralTypeNode(node) { + return node.kind === 198; + } + ts6.isLiteralTypeNode = isLiteralTypeNode; + function isImportTypeNode(node) { + return node.kind === 202; + } + ts6.isImportTypeNode = isImportTypeNode; + function isTemplateLiteralTypeSpan(node) { + return node.kind === 201; + } + ts6.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; + function isTemplateLiteralTypeNode(node) { + return node.kind === 200; + } + ts6.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; + function isObjectBindingPattern2(node) { + return node.kind === 203; + } + ts6.isObjectBindingPattern = isObjectBindingPattern2; + function isArrayBindingPattern2(node) { + return node.kind === 204; + } + ts6.isArrayBindingPattern = isArrayBindingPattern2; + function isBindingElement(node) { + return node.kind === 205; + } + ts6.isBindingElement = isBindingElement; + function isArrayLiteralExpression2(node) { + return node.kind === 206; + } + ts6.isArrayLiteralExpression = isArrayLiteralExpression2; + function isObjectLiteralExpression2(node) { + return node.kind === 207; + } + ts6.isObjectLiteralExpression = isObjectLiteralExpression2; + function isPropertyAccessExpression2(node) { + return node.kind === 208; + } + ts6.isPropertyAccessExpression = isPropertyAccessExpression2; + function isElementAccessExpression2(node) { + return node.kind === 209; + } + ts6.isElementAccessExpression = isElementAccessExpression2; + function isCallExpression2(node) { + return node.kind === 210; + } + ts6.isCallExpression = isCallExpression2; + function isNewExpression(node) { + return node.kind === 211; + } + ts6.isNewExpression = isNewExpression; + function isTaggedTemplateExpression2(node) { + return node.kind === 212; + } + ts6.isTaggedTemplateExpression = isTaggedTemplateExpression2; + function isTypeAssertionExpression2(node) { + return node.kind === 213; + } + ts6.isTypeAssertionExpression = isTypeAssertionExpression2; + function isParenthesizedExpression2(node) { + return node.kind === 214; + } + ts6.isParenthesizedExpression = isParenthesizedExpression2; + function isFunctionExpression2(node) { + return node.kind === 215; + } + ts6.isFunctionExpression = isFunctionExpression2; + function isArrowFunction2(node) { + return node.kind === 216; + } + ts6.isArrowFunction = isArrowFunction2; + function isDeleteExpression(node) { + return node.kind === 217; + } + ts6.isDeleteExpression = isDeleteExpression; + function isTypeOfExpression(node) { + return node.kind === 218; + } + ts6.isTypeOfExpression = isTypeOfExpression; + function isVoidExpression(node) { + return node.kind === 219; + } + ts6.isVoidExpression = isVoidExpression; + function isAwaitExpression2(node) { + return node.kind === 220; + } + ts6.isAwaitExpression = isAwaitExpression2; + function isPrefixUnaryExpression3(node) { + return node.kind === 221; + } + ts6.isPrefixUnaryExpression = isPrefixUnaryExpression3; + function isPostfixUnaryExpression(node) { + return node.kind === 222; + } + ts6.isPostfixUnaryExpression = isPostfixUnaryExpression; + function isBinaryExpression3(node) { + return node.kind === 223; + } + ts6.isBinaryExpression = isBinaryExpression3; + function isConditionalExpression(node) { + return node.kind === 224; + } + ts6.isConditionalExpression = isConditionalExpression; + function isTemplateExpression2(node) { + return node.kind === 225; + } + ts6.isTemplateExpression = isTemplateExpression2; + function isYieldExpression(node) { + return node.kind === 226; + } + ts6.isYieldExpression = isYieldExpression; + function isSpreadElement2(node) { + return node.kind === 227; + } + ts6.isSpreadElement = isSpreadElement2; + function isClassExpression(node) { + return node.kind === 228; + } + ts6.isClassExpression = isClassExpression; + function isOmittedExpression2(node) { + return node.kind === 229; + } + ts6.isOmittedExpression = isOmittedExpression2; + function isExpressionWithTypeArguments(node) { + return node.kind === 230; + } + ts6.isExpressionWithTypeArguments = isExpressionWithTypeArguments; + function isAsExpression3(node) { + return node.kind === 231; + } + ts6.isAsExpression = isAsExpression3; + function isSatisfiesExpression(node) { + return node.kind === 235; + } + ts6.isSatisfiesExpression = isSatisfiesExpression; + function isNonNullExpression(node) { + return node.kind === 232; + } + ts6.isNonNullExpression = isNonNullExpression; + function isMetaProperty(node) { + return node.kind === 233; + } + ts6.isMetaProperty = isMetaProperty; + function isSyntheticExpression(node) { + return node.kind === 234; + } + ts6.isSyntheticExpression = isSyntheticExpression; + function isPartiallyEmittedExpression(node) { + return node.kind === 353; + } + ts6.isPartiallyEmittedExpression = isPartiallyEmittedExpression; + function isCommaListExpression(node) { + return node.kind === 354; + } + ts6.isCommaListExpression = isCommaListExpression; + function isTemplateSpan(node) { + return node.kind === 236; + } + ts6.isTemplateSpan = isTemplateSpan; + function isSemicolonClassElement(node) { + return node.kind === 237; + } + ts6.isSemicolonClassElement = isSemicolonClassElement; + function isBlock2(node) { + return node.kind === 238; + } + ts6.isBlock = isBlock2; + function isVariableStatement2(node) { + return node.kind === 240; + } + ts6.isVariableStatement = isVariableStatement2; + function isEmptyStatement(node) { + return node.kind === 239; + } + ts6.isEmptyStatement = isEmptyStatement; + function isExpressionStatement2(node) { + return node.kind === 241; + } + ts6.isExpressionStatement = isExpressionStatement2; + function isIfStatement(node) { + return node.kind === 242; + } + ts6.isIfStatement = isIfStatement; + function isDoStatement(node) { + return node.kind === 243; + } + ts6.isDoStatement = isDoStatement; + function isWhileStatement(node) { + return node.kind === 244; + } + ts6.isWhileStatement = isWhileStatement; + function isForStatement2(node) { + return node.kind === 245; + } + ts6.isForStatement = isForStatement2; + function isForInStatement(node) { + return node.kind === 246; + } + ts6.isForInStatement = isForInStatement; + function isForOfStatement(node) { + return node.kind === 247; + } + ts6.isForOfStatement = isForOfStatement; + function isContinueStatement(node) { + return node.kind === 248; + } + ts6.isContinueStatement = isContinueStatement; + function isBreakStatement(node) { + return node.kind === 249; + } + ts6.isBreakStatement = isBreakStatement; + function isReturnStatement(node) { + return node.kind === 250; + } + ts6.isReturnStatement = isReturnStatement; + function isWithStatement(node) { + return node.kind === 251; + } + ts6.isWithStatement = isWithStatement; + function isSwitchStatement(node) { + return node.kind === 252; + } + ts6.isSwitchStatement = isSwitchStatement; + function isLabeledStatement2(node) { + return node.kind === 253; + } + ts6.isLabeledStatement = isLabeledStatement2; + function isThrowStatement(node) { + return node.kind === 254; + } + ts6.isThrowStatement = isThrowStatement; + function isTryStatement(node) { + return node.kind === 255; + } + ts6.isTryStatement = isTryStatement; + function isDebuggerStatement(node) { + return node.kind === 256; + } + ts6.isDebuggerStatement = isDebuggerStatement; + function isVariableDeclaration2(node) { + return node.kind === 257; + } + ts6.isVariableDeclaration = isVariableDeclaration2; + function isVariableDeclarationList2(node) { + return node.kind === 258; + } + ts6.isVariableDeclarationList = isVariableDeclarationList2; + function isFunctionDeclaration3(node) { + return node.kind === 259; + } + ts6.isFunctionDeclaration = isFunctionDeclaration3; + function isClassDeclaration3(node) { + return node.kind === 260; + } + ts6.isClassDeclaration = isClassDeclaration3; + function isInterfaceDeclaration2(node) { + return node.kind === 261; + } + ts6.isInterfaceDeclaration = isInterfaceDeclaration2; + function isTypeAliasDeclaration(node) { + return node.kind === 262; + } + ts6.isTypeAliasDeclaration = isTypeAliasDeclaration; + function isEnumDeclaration(node) { + return node.kind === 263; + } + ts6.isEnumDeclaration = isEnumDeclaration; + function isModuleDeclaration2(node) { + return node.kind === 264; + } + ts6.isModuleDeclaration = isModuleDeclaration2; + function isModuleBlock3(node) { + return node.kind === 265; + } + ts6.isModuleBlock = isModuleBlock3; + function isCaseBlock(node) { + return node.kind === 266; + } + ts6.isCaseBlock = isCaseBlock; + function isNamespaceExportDeclaration(node) { + return node.kind === 267; + } + ts6.isNamespaceExportDeclaration = isNamespaceExportDeclaration; + function isImportEqualsDeclaration(node) { + return node.kind === 268; + } + ts6.isImportEqualsDeclaration = isImportEqualsDeclaration; + function isImportDeclaration(node) { + return node.kind === 269; + } + ts6.isImportDeclaration = isImportDeclaration; + function isImportClause(node) { + return node.kind === 270; + } + ts6.isImportClause = isImportClause; + function isImportTypeAssertionContainer(node) { + return node.kind === 298; + } + ts6.isImportTypeAssertionContainer = isImportTypeAssertionContainer; + function isAssertClause(node) { + return node.kind === 296; + } + ts6.isAssertClause = isAssertClause; + function isAssertEntry(node) { + return node.kind === 297; + } + ts6.isAssertEntry = isAssertEntry; + function isNamespaceImport(node) { + return node.kind === 271; + } + ts6.isNamespaceImport = isNamespaceImport; + function isNamespaceExport(node) { + return node.kind === 277; + } + ts6.isNamespaceExport = isNamespaceExport; + function isNamedImports(node) { + return node.kind === 272; + } + ts6.isNamedImports = isNamedImports; + function isImportSpecifier(node) { + return node.kind === 273; + } + ts6.isImportSpecifier = isImportSpecifier; + function isExportAssignment(node) { + return node.kind === 274; + } + ts6.isExportAssignment = isExportAssignment; + function isExportDeclaration(node) { + return node.kind === 275; + } + ts6.isExportDeclaration = isExportDeclaration; + function isNamedExports(node) { + return node.kind === 276; + } + ts6.isNamedExports = isNamedExports; + function isExportSpecifier(node) { + return node.kind === 278; + } + ts6.isExportSpecifier = isExportSpecifier; + function isMissingDeclaration(node) { + return node.kind === 279; + } + ts6.isMissingDeclaration = isMissingDeclaration; + function isNotEmittedStatement(node) { + return node.kind === 352; + } + ts6.isNotEmittedStatement = isNotEmittedStatement; + function isSyntheticReference(node) { + return node.kind === 357; + } + ts6.isSyntheticReference = isSyntheticReference; + function isMergeDeclarationMarker(node) { + return node.kind === 355; + } + ts6.isMergeDeclarationMarker = isMergeDeclarationMarker; + function isEndOfDeclarationMarker(node) { + return node.kind === 356; + } + ts6.isEndOfDeclarationMarker = isEndOfDeclarationMarker; + function isExternalModuleReference(node) { + return node.kind === 280; + } + ts6.isExternalModuleReference = isExternalModuleReference; + function isJsxElement(node) { + return node.kind === 281; + } + ts6.isJsxElement = isJsxElement; + function isJsxSelfClosingElement(node) { + return node.kind === 282; + } + ts6.isJsxSelfClosingElement = isJsxSelfClosingElement; + function isJsxOpeningElement(node) { + return node.kind === 283; + } + ts6.isJsxOpeningElement = isJsxOpeningElement; + function isJsxClosingElement(node) { + return node.kind === 284; + } + ts6.isJsxClosingElement = isJsxClosingElement; + function isJsxFragment(node) { + return node.kind === 285; + } + ts6.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 286; + } + ts6.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 287; + } + ts6.isJsxClosingFragment = isJsxClosingFragment; + function isJsxAttribute(node) { + return node.kind === 288; + } + ts6.isJsxAttribute = isJsxAttribute; + function isJsxAttributes(node) { + return node.kind === 289; + } + ts6.isJsxAttributes = isJsxAttributes; + function isJsxSpreadAttribute2(node) { + return node.kind === 290; + } + ts6.isJsxSpreadAttribute = isJsxSpreadAttribute2; + function isJsxExpression2(node) { + return node.kind === 291; + } + ts6.isJsxExpression = isJsxExpression2; + function isCaseClause(node) { + return node.kind === 292; + } + ts6.isCaseClause = isCaseClause; + function isDefaultClause2(node) { + return node.kind === 293; + } + ts6.isDefaultClause = isDefaultClause2; + function isHeritageClause(node) { + return node.kind === 294; + } + ts6.isHeritageClause = isHeritageClause; + function isCatchClause(node) { + return node.kind === 295; + } + ts6.isCatchClause = isCatchClause; + function isPropertyAssignment2(node) { + return node.kind === 299; + } + ts6.isPropertyAssignment = isPropertyAssignment2; + function isShorthandPropertyAssignment2(node) { + return node.kind === 300; + } + ts6.isShorthandPropertyAssignment = isShorthandPropertyAssignment2; + function isSpreadAssignment2(node) { + return node.kind === 301; + } + ts6.isSpreadAssignment = isSpreadAssignment2; + function isEnumMember2(node) { + return node.kind === 302; + } + ts6.isEnumMember = isEnumMember2; + function isUnparsedPrepend(node) { + return node.kind === 304; + } + ts6.isUnparsedPrepend = isUnparsedPrepend; + function isSourceFile2(node) { + return node.kind === 308; + } + ts6.isSourceFile = isSourceFile2; + function isBundle(node) { + return node.kind === 309; + } + ts6.isBundle = isBundle; + function isUnparsedSource(node) { + return node.kind === 310; + } + ts6.isUnparsedSource = isUnparsedSource; + function isJSDocTypeExpression(node) { + return node.kind === 312; + } + ts6.isJSDocTypeExpression = isJSDocTypeExpression; + function isJSDocNameReference(node) { + return node.kind === 313; + } + ts6.isJSDocNameReference = isJSDocNameReference; + function isJSDocMemberName(node) { + return node.kind === 314; + } + ts6.isJSDocMemberName = isJSDocMemberName; + function isJSDocLink(node) { + return node.kind === 327; + } + ts6.isJSDocLink = isJSDocLink; + function isJSDocLinkCode(node) { + return node.kind === 328; + } + ts6.isJSDocLinkCode = isJSDocLinkCode; + function isJSDocLinkPlain(node) { + return node.kind === 329; + } + ts6.isJSDocLinkPlain = isJSDocLinkPlain; + function isJSDocAllType(node) { + return node.kind === 315; + } + ts6.isJSDocAllType = isJSDocAllType; + function isJSDocUnknownType(node) { + return node.kind === 316; + } + ts6.isJSDocUnknownType = isJSDocUnknownType; + function isJSDocNullableType(node) { + return node.kind === 317; + } + ts6.isJSDocNullableType = isJSDocNullableType; + function isJSDocNonNullableType(node) { + return node.kind === 318; + } + ts6.isJSDocNonNullableType = isJSDocNonNullableType; + function isJSDocOptionalType(node) { + return node.kind === 319; + } + ts6.isJSDocOptionalType = isJSDocOptionalType; + function isJSDocFunctionType(node) { + return node.kind === 320; + } + ts6.isJSDocFunctionType = isJSDocFunctionType; + function isJSDocVariadicType(node) { + return node.kind === 321; + } + ts6.isJSDocVariadicType = isJSDocVariadicType; + function isJSDocNamepathType(node) { + return node.kind === 322; + } + ts6.isJSDocNamepathType = isJSDocNamepathType; + function isJSDoc(node) { + return node.kind === 323; + } + ts6.isJSDoc = isJSDoc; + function isJSDocTypeLiteral(node) { + return node.kind === 325; + } + ts6.isJSDocTypeLiteral = isJSDocTypeLiteral; + function isJSDocSignature(node) { + return node.kind === 326; + } + ts6.isJSDocSignature = isJSDocSignature; + function isJSDocAugmentsTag(node) { + return node.kind === 331; + } + ts6.isJSDocAugmentsTag = isJSDocAugmentsTag; + function isJSDocAuthorTag(node) { + return node.kind === 333; + } + ts6.isJSDocAuthorTag = isJSDocAuthorTag; + function isJSDocClassTag(node) { + return node.kind === 335; + } + ts6.isJSDocClassTag = isJSDocClassTag; + function isJSDocCallbackTag(node) { + return node.kind === 341; + } + ts6.isJSDocCallbackTag = isJSDocCallbackTag; + function isJSDocPublicTag(node) { + return node.kind === 336; + } + ts6.isJSDocPublicTag = isJSDocPublicTag; + function isJSDocPrivateTag(node) { + return node.kind === 337; + } + ts6.isJSDocPrivateTag = isJSDocPrivateTag; + function isJSDocProtectedTag(node) { + return node.kind === 338; + } + ts6.isJSDocProtectedTag = isJSDocProtectedTag; + function isJSDocReadonlyTag(node) { + return node.kind === 339; + } + ts6.isJSDocReadonlyTag = isJSDocReadonlyTag; + function isJSDocOverrideTag(node) { + return node.kind === 340; + } + ts6.isJSDocOverrideTag = isJSDocOverrideTag; + function isJSDocDeprecatedTag(node) { + return node.kind === 334; + } + ts6.isJSDocDeprecatedTag = isJSDocDeprecatedTag; + function isJSDocSeeTag(node) { + return node.kind === 349; + } + ts6.isJSDocSeeTag = isJSDocSeeTag; + function isJSDocEnumTag(node) { + return node.kind === 342; + } + ts6.isJSDocEnumTag = isJSDocEnumTag; + function isJSDocParameterTag(node) { + return node.kind === 343; + } + ts6.isJSDocParameterTag = isJSDocParameterTag; + function isJSDocReturnTag(node) { + return node.kind === 344; + } + ts6.isJSDocReturnTag = isJSDocReturnTag; + function isJSDocThisTag(node) { + return node.kind === 345; + } + ts6.isJSDocThisTag = isJSDocThisTag; + function isJSDocTypeTag(node) { + return node.kind === 346; + } + ts6.isJSDocTypeTag = isJSDocTypeTag; + function isJSDocTemplateTag(node) { + return node.kind === 347; + } + ts6.isJSDocTemplateTag = isJSDocTemplateTag; + function isJSDocTypedefTag(node) { + return node.kind === 348; + } + ts6.isJSDocTypedefTag = isJSDocTypedefTag; + function isJSDocUnknownTag(node) { + return node.kind === 330; + } + ts6.isJSDocUnknownTag = isJSDocUnknownTag; + function isJSDocPropertyTag(node) { + return node.kind === 350; + } + ts6.isJSDocPropertyTag = isJSDocPropertyTag; + function isJSDocImplementsTag(node) { + return node.kind === 332; + } + ts6.isJSDocImplementsTag = isJSDocImplementsTag; + function isSyntaxList(n) { + return n.kind === 351; + } + ts6.isSyntaxList = isSyntaxList; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createEmptyExports(factory) { + return factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + factory.createNamedExports([]), + /*moduleSpecifier*/ + void 0 + ); + } + ts6.createEmptyExports = createEmptyExports; + function createMemberAccessForPropertyName(factory, target, memberName, location) { + if (ts6.isComputedPropertyName(memberName)) { + return ts6.setTextRange(factory.createElementAccessExpression(target, memberName.expression), location); + } else { + var expression = ts6.setTextRange(ts6.isMemberName(memberName) ? factory.createPropertyAccessExpression(target, memberName) : factory.createElementAccessExpression(target, memberName), memberName); + ts6.getOrCreateEmitNode(expression).flags |= 64; + return expression; + } + } + ts6.createMemberAccessForPropertyName = createMemberAccessForPropertyName; + function createReactNamespace(reactNamespace, parent) { + var react = ts6.parseNodeFactory.createIdentifier(reactNamespace || "React"); + ts6.setParent(react, ts6.getParseTreeNode(parent)); + return react; + } + function createJsxFactoryExpressionFromEntityName(factory, jsxFactory, parent) { + if (ts6.isQualifiedName(jsxFactory)) { + var left = createJsxFactoryExpressionFromEntityName(factory, jsxFactory.left, parent); + var right = factory.createIdentifier(ts6.idText(jsxFactory.right)); + right.escapedText = jsxFactory.right.escapedText; + return factory.createPropertyAccessExpression(left, right); + } else { + return createReactNamespace(ts6.idText(jsxFactory), parent); + } + } + function createJsxFactoryExpression(factory, jsxFactoryEntity, reactNamespace, parent) { + return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(factory, jsxFactoryEntity, parent) : factory.createPropertyAccessExpression(createReactNamespace(reactNamespace, parent), "createElement"); + } + ts6.createJsxFactoryExpression = createJsxFactoryExpression; + function createJsxFragmentFactoryExpression(factory, jsxFragmentFactoryEntity, reactNamespace, parent) { + return jsxFragmentFactoryEntity ? createJsxFactoryExpressionFromEntityName(factory, jsxFragmentFactoryEntity, parent) : factory.createPropertyAccessExpression(createReactNamespace(reactNamespace, parent), "Fragment"); + } + function createExpressionForJsxElement(factory, callee, tagName, props, children, location) { + var argumentsList = [tagName]; + if (props) { + argumentsList.push(props); + } + if (children && children.length > 0) { + if (!props) { + argumentsList.push(factory.createNull()); + } + if (children.length > 1) { + for (var _i = 0, children_3 = children; _i < children_3.length; _i++) { + var child = children_3[_i]; + startOnNewLine(child); + argumentsList.push(child); + } + } else { + argumentsList.push(children[0]); + } + } + return ts6.setTextRange(factory.createCallExpression( + callee, + /*typeArguments*/ + void 0, + argumentsList + ), location); + } + ts6.createExpressionForJsxElement = createExpressionForJsxElement; + function createExpressionForJsxFragment(factory, jsxFactoryEntity, jsxFragmentFactoryEntity, reactNamespace, children, parentElement, location) { + var tagName = createJsxFragmentFactoryExpression(factory, jsxFragmentFactoryEntity, reactNamespace, parentElement); + var argumentsList = [tagName, factory.createNull()]; + if (children && children.length > 0) { + if (children.length > 1) { + for (var _i = 0, children_4 = children; _i < children_4.length; _i++) { + var child = children_4[_i]; + startOnNewLine(child); + argumentsList.push(child); + } + } else { + argumentsList.push(children[0]); + } + } + return ts6.setTextRange(factory.createCallExpression( + createJsxFactoryExpression(factory, jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ + void 0, + argumentsList + ), location); + } + ts6.createExpressionForJsxFragment = createExpressionForJsxFragment; + function createForOfBindingStatement(factory, node, boundValue) { + if (ts6.isVariableDeclarationList(node)) { + var firstDeclaration = ts6.first(node.declarations); + var updatedDeclaration = factory.updateVariableDeclaration( + firstDeclaration, + firstDeclaration.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + boundValue + ); + return ts6.setTextRange( + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.updateVariableDeclarationList(node, [updatedDeclaration]) + ), + /*location*/ + node + ); + } else { + var updatedExpression = ts6.setTextRange( + factory.createAssignment(node, boundValue), + /*location*/ + node + ); + return ts6.setTextRange( + factory.createExpressionStatement(updatedExpression), + /*location*/ + node + ); + } + } + ts6.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(factory, dest, source) { + if (ts6.isBlock(dest)) { + return factory.updateBlock(dest, ts6.setTextRange(factory.createNodeArray(__spreadArray([source], dest.statements, true)), dest.statements)); + } else { + return factory.createBlock( + factory.createNodeArray([dest, source]), + /*multiLine*/ + true + ); + } + } + ts6.insertLeadingStatement = insertLeadingStatement; + function createExpressionFromEntityName(factory, node) { + if (ts6.isQualifiedName(node)) { + var left = createExpressionFromEntityName(factory, node.left); + var right = ts6.setParent(ts6.setTextRange(factory.cloneNode(node.right), node.right), node.right.parent); + return ts6.setTextRange(factory.createPropertyAccessExpression(left, right), node); + } else { + return ts6.setParent(ts6.setTextRange(factory.cloneNode(node), node), node.parent); + } + } + ts6.createExpressionFromEntityName = createExpressionFromEntityName; + function createExpressionForPropertyName(factory, memberName) { + if (ts6.isIdentifier(memberName)) { + return factory.createStringLiteralFromNode(memberName); + } else if (ts6.isComputedPropertyName(memberName)) { + return ts6.setParent(ts6.setTextRange(factory.cloneNode(memberName.expression), memberName.expression), memberName.expression.parent); + } else { + return ts6.setParent(ts6.setTextRange(factory.cloneNode(memberName), memberName), memberName.parent); + } + } + ts6.createExpressionForPropertyName = createExpressionForPropertyName; + function createExpressionForAccessorDeclaration(factory, properties, property, receiver, multiLine) { + var _a = ts6.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (property === firstAccessor) { + return ts6.setTextRange(factory.createObjectDefinePropertyCall(receiver, createExpressionForPropertyName(factory, property.name), factory.createPropertyDescriptor({ + enumerable: factory.createFalse(), + configurable: true, + get: getAccessor && ts6.setTextRange(ts6.setOriginalNode(factory.createFunctionExpression( + ts6.getModifiers(getAccessor), + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + getAccessor.parameters, + /*type*/ + void 0, + getAccessor.body + // TODO: GH#18217 + ), getAccessor), getAccessor), + set: setAccessor && ts6.setTextRange(ts6.setOriginalNode(factory.createFunctionExpression( + ts6.getModifiers(setAccessor), + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + setAccessor.parameters, + /*type*/ + void 0, + setAccessor.body + // TODO: GH#18217 + ), setAccessor), setAccessor) + }, !multiLine)), firstAccessor); + } + return void 0; + } + function createExpressionForPropertyAssignment(factory, property, receiver) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createAssignment(createMemberAccessForPropertyName( + factory, + receiver, + property.name, + /*location*/ + property.name + ), property.initializer), property), property); + } + function createExpressionForShorthandPropertyAssignment(factory, property, receiver) { + return ts6.setOriginalNode( + ts6.setTextRange( + factory.createAssignment(createMemberAccessForPropertyName( + factory, + receiver, + property.name, + /*location*/ + property.name + ), factory.cloneNode(property.name)), + /*location*/ + property + ), + /*original*/ + property + ); + } + function createExpressionForMethodDeclaration(factory, method, receiver) { + return ts6.setOriginalNode( + ts6.setTextRange( + factory.createAssignment(createMemberAccessForPropertyName( + factory, + receiver, + method.name, + /*location*/ + method.name + ), ts6.setOriginalNode( + ts6.setTextRange( + factory.createFunctionExpression( + ts6.getModifiers(method), + method.asteriskToken, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + method.parameters, + /*type*/ + void 0, + method.body + // TODO: GH#18217 + ), + /*location*/ + method + ), + /*original*/ + method + )), + /*location*/ + method + ), + /*original*/ + method + ); + } + function createExpressionForObjectLiteralElementLike(factory, node, property, receiver) { + if (property.name && ts6.isPrivateIdentifier(property.name)) { + ts6.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); + } + switch (property.kind) { + case 174: + case 175: + return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); + case 299: + return createExpressionForPropertyAssignment(factory, property, receiver); + case 300: + return createExpressionForShorthandPropertyAssignment(factory, property, receiver); + case 171: + return createExpressionForMethodDeclaration(factory, property, receiver); + } + } + ts6.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike; + function expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, recordTempVariable, resultVariable) { + var operator = node.operator; + ts6.Debug.assert(operator === 45 || operator === 46, "Expected 'node' to be a pre- or post-increment or pre- or post-decrement expression"); + var temp = factory.createTempVariable(recordTempVariable); + expression = factory.createAssignment(temp, expression); + ts6.setTextRange(expression, node.operand); + var operation = ts6.isPrefixUnaryExpression(node) ? factory.createPrefixUnaryExpression(operator, temp) : factory.createPostfixUnaryExpression(temp, operator); + ts6.setTextRange(operation, node); + if (resultVariable) { + operation = factory.createAssignment(resultVariable, operation); + ts6.setTextRange(operation, node); + } + expression = factory.createComma(expression, operation); + ts6.setTextRange(expression, node); + if (ts6.isPostfixUnaryExpression(node)) { + expression = factory.createComma(expression, temp); + ts6.setTextRange(expression, node); + } + return expression; + } + ts6.expandPreOrPostfixIncrementOrDecrementExpression = expandPreOrPostfixIncrementOrDecrementExpression; + function isInternalName(node) { + return (ts6.getEmitFlags(node) & 32768) !== 0; + } + ts6.isInternalName = isInternalName; + function isLocalName(node) { + return (ts6.getEmitFlags(node) & 16384) !== 0; + } + ts6.isLocalName = isLocalName; + function isExportName(node) { + return (ts6.getEmitFlags(node) & 8192) !== 0; + } + ts6.isExportName = isExportName; + function isUseStrictPrologue(node) { + return ts6.isStringLiteral(node.expression) && node.expression.text === "use strict"; + } + function findUseStrictPrologue(statements) { + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; + if (ts6.isPrologueDirective(statement)) { + if (isUseStrictPrologue(statement)) { + return statement; + } + } else { + break; + } + } + return void 0; + } + ts6.findUseStrictPrologue = findUseStrictPrologue; + function startsWithUseStrict(statements) { + var firstStatement = ts6.firstOrUndefined(statements); + return firstStatement !== void 0 && ts6.isPrologueDirective(firstStatement) && isUseStrictPrologue(firstStatement); + } + ts6.startsWithUseStrict = startsWithUseStrict; + function isCommaSequence(node) { + return node.kind === 223 && node.operatorToken.kind === 27 || node.kind === 354; + } + ts6.isCommaSequence = isCommaSequence; + function isJSDocTypeAssertion(node) { + return ts6.isParenthesizedExpression(node) && ts6.isInJSFile(node) && !!ts6.getJSDocTypeTag(node); + } + ts6.isJSDocTypeAssertion = isJSDocTypeAssertion; + function getJSDocTypeAssertionType(node) { + var type = ts6.getJSDocType(node); + ts6.Debug.assertIsDefined(type); + return type; + } + ts6.getJSDocTypeAssertionType = getJSDocTypeAssertionType; + function isOuterExpression(node, kinds) { + if (kinds === void 0) { + kinds = 15; + } + switch (node.kind) { + case 214: + if (kinds & 16 && isJSDocTypeAssertion(node)) { + return false; + } + return (kinds & 1) !== 0; + case 213: + case 231: + case 235: + return (kinds & 2) !== 0; + case 232: + return (kinds & 4) !== 0; + case 353: + return (kinds & 8) !== 0; + } + return false; + } + ts6.isOuterExpression = isOuterExpression; + function skipOuterExpressions(node, kinds) { + if (kinds === void 0) { + kinds = 15; + } + while (isOuterExpression(node, kinds)) { + node = node.expression; + } + return node; + } + ts6.skipOuterExpressions = skipOuterExpressions; + function skipAssertions(node) { + return skipOuterExpressions( + node, + 6 + /* OuterExpressionKinds.Assertions */ + ); + } + ts6.skipAssertions = skipAssertions; + function startOnNewLine(node) { + return ts6.setStartsOnNewLine( + node, + /*newLine*/ + true + ); + } + ts6.startOnNewLine = startOnNewLine; + function getExternalHelpersModuleName(node) { + var parseNode = ts6.getOriginalNode(node, ts6.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts6.getExternalHelpersModuleName = getExternalHelpersModuleName; + function hasRecordedExternalHelpers(sourceFile) { + var parseNode = ts6.getOriginalNode(sourceFile, ts6.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers); + } + ts6.hasRecordedExternalHelpers = hasRecordedExternalHelpers; + function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) { + if (compilerOptions.importHelpers && ts6.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var namedBindings = void 0; + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + if (moduleKind >= ts6.ModuleKind.ES2015 && moduleKind <= ts6.ModuleKind.ESNext || sourceFile.impliedNodeFormat === ts6.ModuleKind.ESNext) { + var helpers = ts6.getEmitHelpers(sourceFile); + if (helpers) { + var helperNames = []; + for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) { + var helper = helpers_3[_i]; + if (!helper.scoped) { + var importName = helper.importName; + if (importName) { + ts6.pushIfUnique(helperNames, importName); + } + } + } + if (ts6.some(helperNames)) { + helperNames.sort(ts6.compareStringsCaseSensitive); + namedBindings = nodeFactory.createNamedImports(ts6.map(helperNames, function(name) { + return ts6.isFileLevelUniqueName(sourceFile, name) ? nodeFactory.createImportSpecifier( + /*isTypeOnly*/ + false, + /*propertyName*/ + void 0, + nodeFactory.createIdentifier(name) + ) : nodeFactory.createImportSpecifier( + /*isTypeOnly*/ + false, + nodeFactory.createIdentifier(name), + helperFactory.getUnscopedHelperName(name) + ); + })); + var parseNode = ts6.getOriginalNode(sourceFile, ts6.isSourceFile); + var emitNode = ts6.getOrCreateEmitNode(parseNode); + emitNode.externalHelpers = true; + } + } + } else { + var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(nodeFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault); + if (externalHelpersModuleName) { + namedBindings = nodeFactory.createNamespaceImport(externalHelpersModuleName); + } + } + if (namedBindings) { + var externalHelpersImportDeclaration = nodeFactory.createImportDeclaration( + /*modifiers*/ + void 0, + nodeFactory.createImportClause( + /*isTypeOnly*/ + false, + /*name*/ + void 0, + namedBindings + ), + nodeFactory.createStringLiteral(ts6.externalHelpersModuleNameText), + /*assertClause*/ + void 0 + ); + ts6.addEmitFlags( + externalHelpersImportDeclaration, + 67108864 + /* EmitFlags.NeverApplyImportHelper */ + ); + return externalHelpersImportDeclaration; + } + } + } + ts6.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded; + function getOrCreateExternalHelpersModuleNameIfNeeded(factory, node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) { + if (compilerOptions.importHelpers && ts6.isEffectiveExternalModule(node, compilerOptions)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + var create = (hasExportStarsToExportValues || ts6.getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== ts6.ModuleKind.System && (moduleKind < ts6.ModuleKind.ES2015 || node.impliedNodeFormat === ts6.ModuleKind.CommonJS); + if (!create) { + var helpers = ts6.getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_4 = helpers; _i < helpers_4.length; _i++) { + var helper = helpers_4[_i]; + if (!helper.scoped) { + create = true; + break; + } + } + } + } + if (create) { + var parseNode = ts6.getOriginalNode(node, ts6.isSourceFile); + var emitNode = ts6.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory.createUniqueName(ts6.externalHelpersModuleNameText)); + } + } + } + ts6.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + function getLocalNameForExternalImport(factory, node, sourceFile) { + var namespaceDeclaration = ts6.getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !ts6.isDefaultImport(node) && !ts6.isExportNamespaceAsDefaultDeclaration(node)) { + var name = namespaceDeclaration.name; + return ts6.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts6.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts6.idText(name)); + } + if (node.kind === 269 && node.importClause) { + return factory.getGeneratedNameForNode(node); + } + if (node.kind === 275 && node.moduleSpecifier) { + return factory.getGeneratedNameForNode(node); + } + return void 0; + } + ts6.getLocalNameForExternalImport = getLocalNameForExternalImport; + function getExternalModuleNameLiteral(factory, importNode, sourceFile, host, resolver, compilerOptions) { + var moduleName = ts6.getExternalModuleName(importNode); + if (moduleName && ts6.isStringLiteral(moduleName)) { + return tryGetModuleNameFromDeclaration(importNode, host, factory, resolver, compilerOptions) || tryRenameExternalModule(factory, moduleName, sourceFile) || factory.cloneNode(moduleName); + } + return void 0; + } + ts6.getExternalModuleNameLiteral = getExternalModuleNameLiteral; + function tryRenameExternalModule(factory, moduleName, sourceFile) { + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename ? factory.createStringLiteral(rename) : void 0; + } + function tryGetModuleNameFromFile(factory, file, host, options) { + if (!file) { + return void 0; + } + if (file.moduleName) { + return factory.createStringLiteral(file.moduleName); + } + if (!file.isDeclarationFile && ts6.outFile(options)) { + return factory.createStringLiteral(ts6.getExternalModuleNameFromPath(host, file.fileName)); + } + return void 0; + } + ts6.tryGetModuleNameFromFile = tryGetModuleNameFromFile; + function tryGetModuleNameFromDeclaration(declaration, host, factory, resolver, compilerOptions) { + return tryGetModuleNameFromFile(factory, resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); + } + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts6.isDeclarationBindingElement(bindingElement)) { + return bindingElement.initializer; + } + if (ts6.isPropertyAssignment(bindingElement)) { + var initializer = bindingElement.initializer; + return ts6.isAssignmentExpression( + initializer, + /*excludeCompoundAssignment*/ + true + ) ? initializer.right : void 0; + } + if (ts6.isShorthandPropertyAssignment(bindingElement)) { + return bindingElement.objectAssignmentInitializer; + } + if (ts6.isAssignmentExpression( + bindingElement, + /*excludeCompoundAssignment*/ + true + )) { + return bindingElement.right; + } + if (ts6.isSpreadElement(bindingElement)) { + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts6.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts6.isDeclarationBindingElement(bindingElement)) { + return bindingElement.name; + } + if (ts6.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 299: + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 300: + return bindingElement.name; + case 301: + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return void 0; + } + if (ts6.isAssignmentExpression( + bindingElement, + /*excludeCompoundAssignment*/ + true + )) { + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts6.isSpreadElement(bindingElement)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return bindingElement; + } + ts6.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 166: + case 205: + return bindingElement.dotDotDotToken; + case 227: + case 301: + return bindingElement; + } + return void 0; + } + ts6.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + var propertyName = tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement); + ts6.Debug.assert(!!propertyName || ts6.isSpreadAssignment(bindingElement), "Invalid property name for binding element."); + return propertyName; + } + ts6.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 205: + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + if (ts6.isPrivateIdentifier(propertyName)) { + return ts6.Debug.failBadSyntaxKind(propertyName); + } + return ts6.isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName; + } + break; + case 299: + if (bindingElement.name) { + var propertyName = bindingElement.name; + if (ts6.isPrivateIdentifier(propertyName)) { + return ts6.Debug.failBadSyntaxKind(propertyName); + } + return ts6.isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName; + } + break; + case 301: + if (bindingElement.name && ts6.isPrivateIdentifier(bindingElement.name)) { + return ts6.Debug.failBadSyntaxKind(bindingElement.name); + } + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts6.isPropertyName(target)) { + return target; + } + } + ts6.tryGetPropertyNameOfBindingOrAssignmentElement = tryGetPropertyNameOfBindingOrAssignmentElement; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 10 || kind === 8; + } + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 203: + case 204: + case 206: + return name.elements; + case 207: + return name.properties; + } + } + ts6.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function getJSDocTypeAliasName(fullName) { + if (fullName) { + var rightNode = fullName; + while (true) { + if (ts6.isIdentifier(rightNode) || !rightNode.body) { + return ts6.isIdentifier(rightNode) ? rightNode : rightNode.name; + } + rightNode = rightNode.body; + } + } + } + ts6.getJSDocTypeAliasName = getJSDocTypeAliasName; + function canHaveIllegalType(node) { + var kind = node.kind; + return kind === 173 || kind === 175; + } + ts6.canHaveIllegalType = canHaveIllegalType; + function canHaveIllegalTypeParameters(node) { + var kind = node.kind; + return kind === 173 || kind === 174 || kind === 175; + } + ts6.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; + function canHaveIllegalDecorators(node) { + var kind = node.kind; + return kind === 299 || kind === 300 || kind === 259 || kind === 173 || kind === 178 || kind === 172 || kind === 279 || kind === 240 || kind === 261 || kind === 262 || kind === 263 || kind === 264 || kind === 268 || kind === 269 || kind === 267 || kind === 275 || kind === 274; + } + ts6.canHaveIllegalDecorators = canHaveIllegalDecorators; + function canHaveIllegalModifiers(node) { + var kind = node.kind; + return kind === 172 || kind === 299 || kind === 300 || kind === 181 || kind === 279 || kind === 267; + } + ts6.canHaveIllegalModifiers = canHaveIllegalModifiers; + ts6.isTypeNodeOrTypeParameterDeclaration = ts6.or(ts6.isTypeNode, ts6.isTypeParameterDeclaration); + ts6.isQuestionOrExclamationToken = ts6.or(ts6.isQuestionToken, ts6.isExclamationToken); + ts6.isIdentifierOrThisTypeNode = ts6.or(ts6.isIdentifier, ts6.isThisTypeNode); + ts6.isReadonlyKeywordOrPlusOrMinusToken = ts6.or(ts6.isReadonlyKeyword, ts6.isPlusToken, ts6.isMinusToken); + ts6.isQuestionOrPlusOrMinusToken = ts6.or(ts6.isQuestionToken, ts6.isPlusToken, ts6.isMinusToken); + ts6.isModuleName = ts6.or(ts6.isIdentifier, ts6.isStringLiteral); + function isLiteralTypeLikeExpression(node) { + var kind = node.kind; + return kind === 104 || kind === 110 || kind === 95 || ts6.isLiteralExpression(node) || ts6.isPrefixUnaryExpression(node); + } + ts6.isLiteralTypeLikeExpression = isLiteralTypeLikeExpression; + function isExponentiationOperator(kind) { + return kind === 42; + } + function isMultiplicativeOperator(kind) { + return kind === 41 || kind === 43 || kind === 44; + } + function isMultiplicativeOperatorOrHigher(kind) { + return isExponentiationOperator(kind) || isMultiplicativeOperator(kind); + } + function isAdditiveOperator(kind) { + return kind === 39 || kind === 40; + } + function isAdditiveOperatorOrHigher(kind) { + return isAdditiveOperator(kind) || isMultiplicativeOperatorOrHigher(kind); + } + function isShiftOperator(kind) { + return kind === 47 || kind === 48 || kind === 49; + } + function isShiftOperatorOrHigher(kind) { + return isShiftOperator(kind) || isAdditiveOperatorOrHigher(kind); + } + function isRelationalOperator(kind) { + return kind === 29 || kind === 32 || kind === 31 || kind === 33 || kind === 102 || kind === 101; + } + function isRelationalOperatorOrHigher(kind) { + return isRelationalOperator(kind) || isShiftOperatorOrHigher(kind); + } + function isEqualityOperator(kind) { + return kind === 34 || kind === 36 || kind === 35 || kind === 37; + } + function isEqualityOperatorOrHigher(kind) { + return isEqualityOperator(kind) || isRelationalOperatorOrHigher(kind); + } + function isBitwiseOperator(kind) { + return kind === 50 || kind === 51 || kind === 52; + } + function isBitwiseOperatorOrHigher(kind) { + return isBitwiseOperator(kind) || isEqualityOperatorOrHigher(kind); + } + function isLogicalOperator(kind) { + return kind === 55 || kind === 56; + } + function isLogicalOperatorOrHigher(kind) { + return isLogicalOperator(kind) || isBitwiseOperatorOrHigher(kind); + } + function isAssignmentOperatorOrHigher(kind) { + return kind === 60 || isLogicalOperatorOrHigher(kind) || ts6.isAssignmentOperator(kind); + } + function isBinaryOperator(kind) { + return isAssignmentOperatorOrHigher(kind) || kind === 27; + } + function isBinaryOperatorToken(node) { + return isBinaryOperator(node.kind); + } + ts6.isBinaryOperatorToken = isBinaryOperatorToken; + var BinaryExpressionState; + (function(BinaryExpressionState2) { + function enter(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, outerState) { + var prevUserState = stackIndex > 0 ? userStateStack[stackIndex - 1] : void 0; + ts6.Debug.assertEqual(stateStack[stackIndex], enter); + userStateStack[stackIndex] = machine.onEnter(nodeStack[stackIndex], prevUserState, outerState); + stateStack[stackIndex] = nextState(machine, enter); + return stackIndex; + } + BinaryExpressionState2.enter = enter; + function left(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, _outerState) { + ts6.Debug.assertEqual(stateStack[stackIndex], left); + ts6.Debug.assertIsDefined(machine.onLeft); + stateStack[stackIndex] = nextState(machine, left); + var nextNode = machine.onLeft(nodeStack[stackIndex].left, userStateStack[stackIndex], nodeStack[stackIndex]); + if (nextNode) { + checkCircularity(stackIndex, nodeStack, nextNode); + return pushStack(stackIndex, stateStack, nodeStack, userStateStack, nextNode); + } + return stackIndex; + } + BinaryExpressionState2.left = left; + function operator(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, _outerState) { + ts6.Debug.assertEqual(stateStack[stackIndex], operator); + ts6.Debug.assertIsDefined(machine.onOperator); + stateStack[stackIndex] = nextState(machine, operator); + machine.onOperator(nodeStack[stackIndex].operatorToken, userStateStack[stackIndex], nodeStack[stackIndex]); + return stackIndex; + } + BinaryExpressionState2.operator = operator; + function right(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, _outerState) { + ts6.Debug.assertEqual(stateStack[stackIndex], right); + ts6.Debug.assertIsDefined(machine.onRight); + stateStack[stackIndex] = nextState(machine, right); + var nextNode = machine.onRight(nodeStack[stackIndex].right, userStateStack[stackIndex], nodeStack[stackIndex]); + if (nextNode) { + checkCircularity(stackIndex, nodeStack, nextNode); + return pushStack(stackIndex, stateStack, nodeStack, userStateStack, nextNode); + } + return stackIndex; + } + BinaryExpressionState2.right = right; + function exit(machine, stackIndex, stateStack, nodeStack, userStateStack, resultHolder, _outerState) { + ts6.Debug.assertEqual(stateStack[stackIndex], exit); + stateStack[stackIndex] = nextState(machine, exit); + var result = machine.onExit(nodeStack[stackIndex], userStateStack[stackIndex]); + if (stackIndex > 0) { + stackIndex--; + if (machine.foldState) { + var side = stateStack[stackIndex] === exit ? "right" : "left"; + userStateStack[stackIndex] = machine.foldState(userStateStack[stackIndex], result, side); + } + } else { + resultHolder.value = result; + } + return stackIndex; + } + BinaryExpressionState2.exit = exit; + function done(_machine, stackIndex, stateStack, _nodeStack, _userStateStack, _resultHolder, _outerState) { + ts6.Debug.assertEqual(stateStack[stackIndex], done); + return stackIndex; + } + BinaryExpressionState2.done = done; + function nextState(machine, currentState) { + switch (currentState) { + case enter: + if (machine.onLeft) + return left; + case left: + if (machine.onOperator) + return operator; + case operator: + if (machine.onRight) + return right; + case right: + return exit; + case exit: + return done; + case done: + return done; + default: + ts6.Debug.fail("Invalid state"); + } + } + BinaryExpressionState2.nextState = nextState; + function pushStack(stackIndex, stateStack, nodeStack, userStateStack, node) { + stackIndex++; + stateStack[stackIndex] = enter; + nodeStack[stackIndex] = node; + userStateStack[stackIndex] = void 0; + return stackIndex; + } + function checkCircularity(stackIndex, nodeStack, node) { + if (ts6.Debug.shouldAssert( + 2 + /* AssertionLevel.Aggressive */ + )) { + while (stackIndex >= 0) { + ts6.Debug.assert(nodeStack[stackIndex] !== node, "Circular traversal detected."); + stackIndex--; + } + } + } + })(BinaryExpressionState || (BinaryExpressionState = {})); + var BinaryExpressionStateMachine = ( + /** @class */ + function() { + function BinaryExpressionStateMachine2(onEnter, onLeft, onOperator, onRight, onExit, foldState) { + this.onEnter = onEnter; + this.onLeft = onLeft; + this.onOperator = onOperator; + this.onRight = onRight; + this.onExit = onExit; + this.foldState = foldState; + } + return BinaryExpressionStateMachine2; + }() + ); + function createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState) { + var machine = new BinaryExpressionStateMachine(onEnter, onLeft, onOperator, onRight, onExit, foldState); + return trampoline; + function trampoline(node, outerState) { + var resultHolder = { value: void 0 }; + var stateStack = [BinaryExpressionState.enter]; + var nodeStack = [node]; + var userStateStack = [void 0]; + var stackIndex = 0; + while (stateStack[stackIndex] !== BinaryExpressionState.done) { + stackIndex = stateStack[stackIndex](machine, stackIndex, stateStack, nodeStack, userStateStack, resultHolder, outerState); + } + ts6.Debug.assertEqual(stackIndex, 0); + return resultHolder.value; + } + } + ts6.createBinaryExpressionTrampoline = createBinaryExpressionTrampoline; + function elideNodes(factory, nodes) { + if (nodes === void 0) + return void 0; + if (nodes.length === 0) + return nodes; + return ts6.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); + } + ts6.elideNodes = elideNodes; + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + if (ts6.isMemberName(node) && !!(node.autoGenerateFlags & 4) && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + return node; + } + return name; + } + ts6.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName( + /*privateName*/ + false, + part.prefix, + part.node, + part.suffix, + generateName + ) : typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 ? part.slice(1) : part : ""; + } + ts6.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : formatIdentifierWorker(name, ts6.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts6.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : ts6.isGeneratedIdentifier(node) ? generateName(node) : ts6.isPrivateIdentifier(node) ? node.escapedText.slice(1) : ts6.idText(node); + } + function formatGeneratedName(privateName, prefix2, baseName, suffix, generateName) { + prefix2 = formatGeneratedNamePart(prefix2, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix2).concat(baseName).concat(suffix); + } + ts6.formatGeneratedName = formatGeneratedName; + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration( + node, + modifiers, + factory.getGeneratedPrivateNameForNode( + node.name, + /*prefix*/ + void 0, + "_accessor_storage" + ), + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + initializer + ); + } + ts6.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration( + modifiers, + name, + [], + /*type*/ + void 0, + factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode( + node.name, + /*prefix*/ + void 0, + "_accessor_storage" + ))) + ]) + ); + } + ts6.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotdotDotToken*/ + void 0, + "value" + )], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode( + node.name, + /*prefix*/ + void 0, + "_accessor_storage" + )), factory.createIdentifier("value"))) + ])); + } + ts6.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function setTextRange(range2, location) { + return location ? ts6.setTextRangePosEnd(range2, location.pos, location.end) : range2; + } + ts6.setTextRange = setTextRange; + function canHaveModifiers(node) { + var kind = node.kind; + return kind === 165 || kind === 166 || kind === 168 || kind === 169 || kind === 170 || kind === 171 || kind === 173 || kind === 174 || kind === 175 || kind === 178 || kind === 182 || kind === 215 || kind === 216 || kind === 228 || kind === 240 || kind === 259 || kind === 260 || kind === 261 || kind === 262 || kind === 263 || kind === 264 || kind === 268 || kind === 269 || kind === 274 || kind === 275; + } + ts6.canHaveModifiers = canHaveModifiers; + function canHaveDecorators(node) { + var kind = node.kind; + return kind === 166 || kind === 169 || kind === 171 || kind === 174 || kind === 175 || kind === 228 || kind === 260; + } + ts6.canHaveDecorators = canHaveDecorators; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var _a; + var SignatureFlags; + (function(SignatureFlags2) { + SignatureFlags2[SignatureFlags2["None"] = 0] = "None"; + SignatureFlags2[SignatureFlags2["Yield"] = 1] = "Yield"; + SignatureFlags2[SignatureFlags2["Await"] = 2] = "Await"; + SignatureFlags2[SignatureFlags2["Type"] = 4] = "Type"; + SignatureFlags2[SignatureFlags2["IgnoreMissingOpenBrace"] = 16] = "IgnoreMissingOpenBrace"; + SignatureFlags2[SignatureFlags2["JSDoc"] = 32] = "JSDoc"; + })(SignatureFlags || (SignatureFlags = {})); + var SpeculationKind; + (function(SpeculationKind2) { + SpeculationKind2[SpeculationKind2["TryParse"] = 0] = "TryParse"; + SpeculationKind2[SpeculationKind2["Lookahead"] = 1] = "Lookahead"; + SpeculationKind2[SpeculationKind2["Reparse"] = 2] = "Reparse"; + })(SpeculationKind || (SpeculationKind = {})); + var NodeConstructor; + var TokenConstructor; + var IdentifierConstructor; + var PrivateIdentifierConstructor; + var SourceFileConstructor; + ts6.parseBaseNodeFactory = { + createBaseSourceFileNode: function(kind) { + return new (SourceFileConstructor || (SourceFileConstructor = ts6.objectAllocator.getSourceFileConstructor()))(kind, -1, -1); + }, + createBaseIdentifierNode: function(kind) { + return new (IdentifierConstructor || (IdentifierConstructor = ts6.objectAllocator.getIdentifierConstructor()))(kind, -1, -1); + }, + createBasePrivateIdentifierNode: function(kind) { + return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = ts6.objectAllocator.getPrivateIdentifierConstructor()))(kind, -1, -1); + }, + createBaseTokenNode: function(kind) { + return new (TokenConstructor || (TokenConstructor = ts6.objectAllocator.getTokenConstructor()))(kind, -1, -1); + }, + createBaseNode: function(kind) { + return new (NodeConstructor || (NodeConstructor = ts6.objectAllocator.getNodeConstructor()))(kind, -1, -1); + } + }; + ts6.parseNodeFactory = ts6.createNodeFactory(1, ts6.parseBaseNodeFactory); + function visitNode(cbNode, node) { + return node && cbNode(node); + } + function visitNodes(cbNode, cbNodes, nodes) { + if (nodes) { + if (cbNodes) { + return cbNodes(nodes); + } + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; + var result = cbNode(node); + if (result) { + return result; + } + } + } + } + function isJSDocLikeText(text, start) { + return text.charCodeAt(start + 1) === 42 && text.charCodeAt(start + 2) === 42 && text.charCodeAt(start + 3) !== 47; + } + ts6.isJSDocLikeText = isJSDocLikeText; + function isFileProbablyExternalModule(sourceFile) { + return ts6.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) || getImportMetaIfNecessary(sourceFile); + } + ts6.isFileProbablyExternalModule = isFileProbablyExternalModule; + function isAnExternalModuleIndicatorNode(node) { + return ts6.canHaveModifiers(node) && hasModifierOfKind( + node, + 93 + /* SyntaxKind.ExportKeyword */ + ) || ts6.isImportEqualsDeclaration(node) && ts6.isExternalModuleReference(node.moduleReference) || ts6.isImportDeclaration(node) || ts6.isExportAssignment(node) || ts6.isExportDeclaration(node) ? node : void 0; + } + function getImportMetaIfNecessary(sourceFile) { + return sourceFile.flags & 4194304 ? walkTreeForImportMeta(sourceFile) : void 0; + } + function walkTreeForImportMeta(node) { + return isImportMeta(node) ? node : forEachChild(node, walkTreeForImportMeta); + } + function hasModifierOfKind(node, kind) { + return ts6.some(node.modifiers, function(m) { + return m.kind === kind; + }); + } + function isImportMeta(node) { + return ts6.isMetaProperty(node) && node.keywordToken === 100 && node.name.escapedText === "meta"; + } + var forEachChildTable = (_a = {}, _a[ + 163 + /* SyntaxKind.QualifiedName */ + ] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + }, _a[ + 165 + /* SyntaxKind.TypeParameter */ + ] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); + }, _a[ + 300 + /* SyntaxKind.ShorthandPropertyAssignment */ + ] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); + }, _a[ + 301 + /* SyntaxKind.SpreadAssignment */ + ] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 166 + /* SyntaxKind.Parameter */ + ] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + }, _a[ + 169 + /* SyntaxKind.PropertyDeclaration */ + ] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + }, _a[ + 168 + /* SyntaxKind.PropertySignature */ + ] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + }, _a[ + 299 + /* SyntaxKind.PropertyAssignment */ + ] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.initializer); + }, _a[ + 257 + /* SyntaxKind.VariableDeclaration */ + ] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + }, _a[ + 205 + /* SyntaxKind.BindingElement */ + ] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + }, _a[ + 178 + /* SyntaxKind.IndexSignature */ + ] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); + }, _a[ + 182 + /* SyntaxKind.ConstructorType */ + ] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); + }, _a[ + 181 + /* SyntaxKind.FunctionType */ + ] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); + }, _a[ + 176 + /* SyntaxKind.CallSignature */ + ] = forEachChildInCallOrConstructSignature, _a[ + 177 + /* SyntaxKind.ConstructSignature */ + ] = forEachChildInCallOrConstructSignature, _a[ + 171 + /* SyntaxKind.MethodDeclaration */ + ] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + }, _a[ + 170 + /* SyntaxKind.MethodSignature */ + ] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); + }, _a[ + 173 + /* SyntaxKind.Constructor */ + ] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + }, _a[ + 174 + /* SyntaxKind.GetAccessor */ + ] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + }, _a[ + 175 + /* SyntaxKind.SetAccessor */ + ] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + }, _a[ + 259 + /* SyntaxKind.FunctionDeclaration */ + ] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + }, _a[ + 215 + /* SyntaxKind.FunctionExpression */ + ] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + }, _a[ + 216 + /* SyntaxKind.ArrowFunction */ + ] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); + }, _a[ + 172 + /* SyntaxKind.ClassStaticBlockDeclaration */ + ] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); + }, _a[ + 180 + /* SyntaxKind.TypeReference */ + ] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || visitNodes(cbNode, cbNodes, node.typeArguments); + }, _a[ + 179 + /* SyntaxKind.TypePredicate */ + ] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); + }, _a[ + 183 + /* SyntaxKind.TypeQuery */ + ] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || visitNodes(cbNode, cbNodes, node.typeArguments); + }, _a[ + 184 + /* SyntaxKind.TypeLiteral */ + ] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, _a[ + 185 + /* SyntaxKind.ArrayType */ + ] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, _a[ + 186 + /* SyntaxKind.TupleType */ + ] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, _a[ + 189 + /* SyntaxKind.UnionType */ + ] = forEachChildInUnionOrIntersectionType, _a[ + 190 + /* SyntaxKind.IntersectionType */ + ] = forEachChildInUnionOrIntersectionType, _a[ + 191 + /* SyntaxKind.ConditionalType */ + ] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || visitNode(cbNode, node.extendsType) || visitNode(cbNode, node.trueType) || visitNode(cbNode, node.falseType); + }, _a[ + 192 + /* SyntaxKind.InferType */ + ] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, _a[ + 202 + /* SyntaxKind.ImportType */ + ] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || visitNode(cbNode, node.assertions) || visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); + }, _a[ + 298 + /* SyntaxKind.ImportTypeAssertionContainer */ + ] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, _a[ + 193 + /* SyntaxKind.ParenthesizedType */ + ] = forEachChildInParenthesizedTypeOrTypeOperator, _a[ + 195 + /* SyntaxKind.TypeOperator */ + ] = forEachChildInParenthesizedTypeOrTypeOperator, _a[ + 196 + /* SyntaxKind.IndexedAccessType */ + ] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); + }, _a[ + 197 + /* SyntaxKind.MappedType */ + ] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.nameType) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNodes(cbNode, cbNodes, node.members); + }, _a[ + 198 + /* SyntaxKind.LiteralType */ + ] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, _a[ + 199 + /* SyntaxKind.NamedTupleMember */ + ] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); + }, _a[ + 203 + /* SyntaxKind.ObjectBindingPattern */ + ] = forEachChildInObjectOrArrayBindingPattern, _a[ + 204 + /* SyntaxKind.ArrayBindingPattern */ + ] = forEachChildInObjectOrArrayBindingPattern, _a[ + 206 + /* SyntaxKind.ArrayLiteralExpression */ + ] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, _a[ + 207 + /* SyntaxKind.ObjectLiteralExpression */ + ] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, _a[ + 208 + /* SyntaxKind.PropertyAccessExpression */ + ] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.questionDotToken) || visitNode(cbNode, node.name); + }, _a[ + 209 + /* SyntaxKind.ElementAccessExpression */ + ] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.questionDotToken) || visitNode(cbNode, node.argumentExpression); + }, _a[ + 210 + /* SyntaxKind.CallExpression */ + ] = forEachChildInCallOrNewExpression, _a[ + 211 + /* SyntaxKind.NewExpression */ + ] = forEachChildInCallOrNewExpression, _a[ + 212 + /* SyntaxKind.TaggedTemplateExpression */ + ] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.questionDotToken) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.template); + }, _a[ + 213 + /* SyntaxKind.TypeAssertionExpression */ + ] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + }, _a[ + 214 + /* SyntaxKind.ParenthesizedExpression */ + ] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 217 + /* SyntaxKind.DeleteExpression */ + ] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 218 + /* SyntaxKind.TypeOfExpression */ + ] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 219 + /* SyntaxKind.VoidExpression */ + ] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 221 + /* SyntaxKind.PrefixUnaryExpression */ + ] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, _a[ + 226 + /* SyntaxKind.YieldExpression */ + ] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + }, _a[ + 220 + /* SyntaxKind.AwaitExpression */ + ] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 222 + /* SyntaxKind.PostfixUnaryExpression */ + ] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, _a[ + 223 + /* SyntaxKind.BinaryExpression */ + ] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); + }, _a[ + 231 + /* SyntaxKind.AsExpression */ + ] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, _a[ + 232 + /* SyntaxKind.NonNullExpression */ + ] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 235 + /* SyntaxKind.SatisfiesExpression */ + ] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, _a[ + 233 + /* SyntaxKind.MetaProperty */ + ] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, _a[ + 224 + /* SyntaxKind.ConditionalExpression */ + ] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); + }, _a[ + 227 + /* SyntaxKind.SpreadElement */ + ] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 238 + /* SyntaxKind.Block */ + ] = forEachChildInBlock, _a[ + 265 + /* SyntaxKind.ModuleBlock */ + ] = forEachChildInBlock, _a[ + 308 + /* SyntaxKind.SourceFile */ + ] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + }, _a[ + 240 + /* SyntaxKind.VariableStatement */ + ] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + }, _a[ + 258 + /* SyntaxKind.VariableDeclarationList */ + ] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, _a[ + 241 + /* SyntaxKind.ExpressionStatement */ + ] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 242 + /* SyntaxKind.IfStatement */ + ] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + }, _a[ + 243 + /* SyntaxKind.DoStatement */ + ] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + }, _a[ + 244 + /* SyntaxKind.WhileStatement */ + ] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + }, _a[ + 245 + /* SyntaxKind.ForStatement */ + ] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); + }, _a[ + 246 + /* SyntaxKind.ForInStatement */ + ] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + }, _a[ + 247 + /* SyntaxKind.ForOfStatement */ + ] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + }, _a[ + 248 + /* SyntaxKind.ContinueStatement */ + ] = forEachChildInContinueOrBreakStatement, _a[ + 249 + /* SyntaxKind.BreakStatement */ + ] = forEachChildInContinueOrBreakStatement, _a[ + 250 + /* SyntaxKind.ReturnStatement */ + ] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 251 + /* SyntaxKind.WithStatement */ + ] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + }, _a[ + 252 + /* SyntaxKind.SwitchStatement */ + ] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + }, _a[ + 266 + /* SyntaxKind.CaseBlock */ + ] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, _a[ + 292 + /* SyntaxKind.CaseClause */ + ] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); + }, _a[ + 293 + /* SyntaxKind.DefaultClause */ + ] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, _a[ + 253 + /* SyntaxKind.LabeledStatement */ + ] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + }, _a[ + 254 + /* SyntaxKind.ThrowStatement */ + ] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 255 + /* SyntaxKind.TryStatement */ + ] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + }, _a[ + 295 + /* SyntaxKind.CatchClause */ + ] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); + }, _a[ + 167 + /* SyntaxKind.Decorator */ + ] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 260 + /* SyntaxKind.ClassDeclaration */ + ] = forEachChildInClassDeclarationOrExpression, _a[ + 228 + /* SyntaxKind.ClassExpression */ + ] = forEachChildInClassDeclarationOrExpression, _a[ + 261 + /* SyntaxKind.InterfaceDeclaration */ + ] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); + }, _a[ + 262 + /* SyntaxKind.TypeAliasDeclaration */ + ] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); + }, _a[ + 263 + /* SyntaxKind.EnumDeclaration */ + ] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); + }, _a[ + 302 + /* SyntaxKind.EnumMember */ + ] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + }, _a[ + 264 + /* SyntaxKind.ModuleDeclaration */ + ] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); + }, _a[ + 268 + /* SyntaxKind.ImportEqualsDeclaration */ + ] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); + }, _a[ + 269 + /* SyntaxKind.ImportDeclaration */ + ] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); + }, _a[ + 270 + /* SyntaxKind.ImportClause */ + ] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); + }, _a[ + 296 + /* SyntaxKind.AssertClause */ + ] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, _a[ + 297 + /* SyntaxKind.AssertEntry */ + ] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); + }, _a[ + 267 + /* SyntaxKind.NamespaceExportDeclaration */ + ] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); + }, _a[ + 271 + /* SyntaxKind.NamespaceImport */ + ] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, _a[ + 277 + /* SyntaxKind.NamespaceExport */ + ] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, _a[ + 272 + /* SyntaxKind.NamedImports */ + ] = forEachChildInNamedImportsOrExports, _a[ + 276 + /* SyntaxKind.NamedExports */ + ] = forEachChildInNamedImportsOrExports, _a[ + 275 + /* SyntaxKind.ExportDeclaration */ + ] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); + }, _a[ + 273 + /* SyntaxKind.ImportSpecifier */ + ] = forEachChildInImportOrExportSpecifier, _a[ + 278 + /* SyntaxKind.ExportSpecifier */ + ] = forEachChildInImportOrExportSpecifier, _a[ + 274 + /* SyntaxKind.ExportAssignment */ + ] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); + }, _a[ + 225 + /* SyntaxKind.TemplateExpression */ + ] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); + }, _a[ + 236 + /* SyntaxKind.TemplateSpan */ + ] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + }, _a[ + 200 + /* SyntaxKind.TemplateLiteralType */ + ] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); + }, _a[ + 201 + /* SyntaxKind.TemplateLiteralTypeSpan */ + ] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || visitNode(cbNode, node.literal); + }, _a[ + 164 + /* SyntaxKind.ComputedPropertyName */ + ] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 294 + /* SyntaxKind.HeritageClause */ + ] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, _a[ + 230 + /* SyntaxKind.ExpressionWithTypeArguments */ + ] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); + }, _a[ + 280 + /* SyntaxKind.ExternalModuleReference */ + ] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 279 + /* SyntaxKind.MissingDeclaration */ + ] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); + }, _a[ + 354 + /* SyntaxKind.CommaListExpression */ + ] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, _a[ + 281 + /* SyntaxKind.JsxElement */ + ] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + }, _a[ + 285 + /* SyntaxKind.JsxFragment */ + ] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); + }, _a[ + 282 + /* SyntaxKind.JsxSelfClosingElement */ + ] = forEachChildInJsxOpeningOrSelfClosingElement, _a[ + 283 + /* SyntaxKind.JsxOpeningElement */ + ] = forEachChildInJsxOpeningOrSelfClosingElement, _a[ + 289 + /* SyntaxKind.JsxAttributes */ + ] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, _a[ + 288 + /* SyntaxKind.JsxAttribute */ + ] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + }, _a[ + 290 + /* SyntaxKind.JsxSpreadAttribute */ + ] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, _a[ + 291 + /* SyntaxKind.JsxExpression */ + ] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); + }, _a[ + 284 + /* SyntaxKind.JsxClosingElement */ + ] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, _a[ + 187 + /* SyntaxKind.OptionalType */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 188 + /* SyntaxKind.RestType */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 312 + /* SyntaxKind.JSDocTypeExpression */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 318 + /* SyntaxKind.JSDocNonNullableType */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 317 + /* SyntaxKind.JSDocNullableType */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 319 + /* SyntaxKind.JSDocOptionalType */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 321 + /* SyntaxKind.JSDocVariadicType */ + ] = forEachChildInOptionalRestOrJSDocParameterModifier, _a[ + 320 + /* SyntaxKind.JSDocFunctionType */ + ] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); + }, _a[ + 323 + /* SyntaxKind.JSDoc */ + ] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) || visitNodes(cbNode, cbNodes, node.tags); + }, _a[ + 349 + /* SyntaxKind.JSDocSeeTag */ + ] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.name) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + }, _a[ + 313 + /* SyntaxKind.JSDocNameReference */ + ] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, _a[ + 314 + /* SyntaxKind.JSDocMemberName */ + ] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + }, _a[ + 343 + /* SyntaxKind.JSDocParameterTag */ + ] = forEachChildInJSDocParameterOrPropertyTag, _a[ + 350 + /* SyntaxKind.JSDocPropertyTag */ + ] = forEachChildInJSDocParameterOrPropertyTag, _a[ + 333 + /* SyntaxKind.JSDocAuthorTag */ + ] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + }, _a[ + 332 + /* SyntaxKind.JSDocImplementsTag */ + ] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.class) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + }, _a[ + 331 + /* SyntaxKind.JSDocAugmentsTag */ + ] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.class) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + }, _a[ + 347 + /* SyntaxKind.JSDocTemplateTag */ + ] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.constraint) || visitNodes(cbNode, cbNodes, node.typeParameters) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + }, _a[ + 348 + /* SyntaxKind.JSDocTypedefTag */ + ] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || (node.typeExpression && node.typeExpression.kind === 312 ? visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) : visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment))); + }, _a[ + 341 + /* SyntaxKind.JSDocCallbackTag */ + ] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + }, _a[ + 344 + /* SyntaxKind.JSDocReturnTag */ + ] = forEachChildInJSDocReturnTag, _a[ + 346 + /* SyntaxKind.JSDocTypeTag */ + ] = forEachChildInJSDocReturnTag, _a[ + 345 + /* SyntaxKind.JSDocThisTag */ + ] = forEachChildInJSDocReturnTag, _a[ + 342 + /* SyntaxKind.JSDocEnumTag */ + ] = forEachChildInJSDocReturnTag, _a[ + 326 + /* SyntaxKind.JSDocSignature */ + ] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts6.forEach(node.typeParameters, cbNode) || ts6.forEach(node.parameters, cbNode) || visitNode(cbNode, node.type); + }, _a[ + 327 + /* SyntaxKind.JSDocLink */ + ] = forEachChildInJSDocLinkCodeOrPlain, _a[ + 328 + /* SyntaxKind.JSDocLinkCode */ + ] = forEachChildInJSDocLinkCodeOrPlain, _a[ + 329 + /* SyntaxKind.JSDocLinkPlain */ + ] = forEachChildInJSDocLinkCodeOrPlain, _a[ + 325 + /* SyntaxKind.JSDocTypeLiteral */ + ] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts6.forEach(node.jsDocPropertyTags, cbNode); + }, _a[ + 330 + /* SyntaxKind.JSDocTag */ + ] = forEachChildInJSDocTag, _a[ + 335 + /* SyntaxKind.JSDocClassTag */ + ] = forEachChildInJSDocTag, _a[ + 336 + /* SyntaxKind.JSDocPublicTag */ + ] = forEachChildInJSDocTag, _a[ + 337 + /* SyntaxKind.JSDocPrivateTag */ + ] = forEachChildInJSDocTag, _a[ + 338 + /* SyntaxKind.JSDocProtectedTag */ + ] = forEachChildInJSDocTag, _a[ + 339 + /* SyntaxKind.JSDocReadonlyTag */ + ] = forEachChildInJSDocTag, _a[ + 334 + /* SyntaxKind.JSDocDeprecatedTag */ + ] = forEachChildInJSDocTag, _a[ + 340 + /* SyntaxKind.JSDocOverrideTag */ + ] = forEachChildInJSDocTag, _a[ + 353 + /* SyntaxKind.PartiallyEmittedExpression */ + ] = forEachChildInPartiallyEmittedExpression, _a); + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || (node.isNameFirst ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } + function forEachChild(node, cbNode, cbNodes) { + if (node === void 0 || node.kind <= 162) { + return; + } + var fn = forEachChildTable[node.kind]; + return fn === void 0 ? void 0 : fn(node, cbNode, cbNodes); + } + ts6.forEachChild = forEachChild; + function forEachChildRecursively(rootNode, cbNode, cbNodes) { + var queue = gatherPossibleChildren(rootNode); + var parents = []; + while (parents.length < queue.length) { + parents.push(rootNode); + } + while (queue.length !== 0) { + var current = queue.pop(); + var parent = parents.pop(); + if (ts6.isArray(current)) { + if (cbNodes) { + var res = cbNodes(current, parent); + if (res) { + if (res === "skip") + continue; + return res; + } + } + for (var i = current.length - 1; i >= 0; --i) { + queue.push(current[i]); + parents.push(parent); + } + } else { + var res = cbNode(current, parent); + if (res) { + if (res === "skip") + continue; + return res; + } + if (current.kind >= 163) { + for (var _i = 0, _a2 = gatherPossibleChildren(current); _i < _a2.length; _i++) { + var child = _a2[_i]; + queue.push(child); + parents.push(current); + } + } + } + } + } + ts6.forEachChildRecursively = forEachChildRecursively; + function gatherPossibleChildren(node) { + var children = []; + forEachChild(node, addWorkItem, addWorkItem); + return children; + function addWorkItem(n) { + children.unshift(n); + } + } + function setExternalModuleIndicator(sourceFile) { + sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile); + } + function createSourceFile2(fileName, sourceText, languageVersionOrOptions, setParentNodes, scriptKind) { + if (setParentNodes === void 0) { + setParentNodes = false; + } + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push( + "parse", + "createSourceFile", + { path: fileName }, + /*separateBeginAndEnd*/ + true + ); + ts6.performance.mark("beforeParse"); + var result; + ts6.perfLogger.logStartParseSourceFile(fileName); + var _a2 = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions }, languageVersion = _a2.languageVersion, overrideSetExternalModuleIndicator = _a2.setExternalModuleIndicator, format = _a2.impliedNodeFormat; + if (languageVersion === 100) { + result = Parser.parseSourceFile( + fileName, + sourceText, + languageVersion, + /*syntaxCursor*/ + void 0, + setParentNodes, + 6, + ts6.noop + ); + } else { + var setIndicator = format === void 0 ? overrideSetExternalModuleIndicator : function(file) { + file.impliedNodeFormat = format; + return (overrideSetExternalModuleIndicator || setExternalModuleIndicator)(file); + }; + result = Parser.parseSourceFile( + fileName, + sourceText, + languageVersion, + /*syntaxCursor*/ + void 0, + setParentNodes, + scriptKind, + setIndicator + ); + } + ts6.perfLogger.logStopParseSourceFile(); + ts6.performance.mark("afterParse"); + ts6.performance.measure("Parse", "beforeParse", "afterParse"); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return result; + } + ts6.createSourceFile = createSourceFile2; + function parseIsolatedEntityName(text, languageVersion) { + return Parser.parseIsolatedEntityName(text, languageVersion); + } + ts6.parseIsolatedEntityName = parseIsolatedEntityName; + function parseJsonText(fileName, sourceText) { + return Parser.parseJsonText(fileName, sourceText); + } + ts6.parseJsonText = parseJsonText; + function isExternalModule(file) { + return file.externalModuleIndicator !== void 0; + } + ts6.isExternalModule = isExternalModule; + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + if (aggressiveChecks === void 0) { + aggressiveChecks = false; + } + var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + newSourceFile.flags |= sourceFile.flags & 6291456; + return newSourceFile; + } + ts6.updateSourceFile = updateSourceFile; + function parseIsolatedJSDocComment(content, start, length) { + var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length); + if (result && result.jsDoc) { + Parser.fixupParentReferences(result.jsDoc); + } + return result; + } + ts6.parseIsolatedJSDocComment = parseIsolatedJSDocComment; + function parseJSDocTypeExpressionForTests(content, start, length) { + return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length); + } + ts6.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; + var Parser; + (function(Parser2) { + var scanner = ts6.createScanner( + 99, + /*skipTrivia*/ + true + ); + var disallowInAndDecoratorContext = 4096 | 16384; + var NodeConstructor2; + var TokenConstructor2; + var IdentifierConstructor2; + var PrivateIdentifierConstructor2; + var SourceFileConstructor2; + function countNode(node) { + nodeCount++; + return node; + } + var baseNodeFactory = { + createBaseSourceFileNode: function(kind) { + return countNode(new SourceFileConstructor2( + kind, + /*pos*/ + 0, + /*end*/ + 0 + )); + }, + createBaseIdentifierNode: function(kind) { + return countNode(new IdentifierConstructor2( + kind, + /*pos*/ + 0, + /*end*/ + 0 + )); + }, + createBasePrivateIdentifierNode: function(kind) { + return countNode(new PrivateIdentifierConstructor2( + kind, + /*pos*/ + 0, + /*end*/ + 0 + )); + }, + createBaseTokenNode: function(kind) { + return countNode(new TokenConstructor2( + kind, + /*pos*/ + 0, + /*end*/ + 0 + )); + }, + createBaseNode: function(kind) { + return countNode(new NodeConstructor2( + kind, + /*pos*/ + 0, + /*end*/ + 0 + )); + } + }; + var factory = ts6.createNodeFactory(1 | 2 | 8, baseNodeFactory); + var fileName; + var sourceFlags; + var sourceText; + var languageVersion; + var scriptKind; + var languageVariant; + var parseDiagnostics; + var jsDocDiagnostics; + var syntaxCursor; + var currentToken; + var nodeCount; + var identifiers; + var privateIdentifiers; + var identifierCount; + var parsingContext; + var notParenthesizedArrow; + var contextFlags; + var topLevel = true; + var parseErrorBeforeNextFinishedNode = false; + function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride) { + var _a2; + if (setParentNodes === void 0) { + setParentNodes = false; + } + scriptKind2 = ts6.ensureScriptKind(fileName2, scriptKind2); + if (scriptKind2 === 6) { + var result_3 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes); + ts6.convertToObjectWorker( + result_3, + (_a2 = result_3.statements[0]) === null || _a2 === void 0 ? void 0 : _a2.expression, + result_3.parseDiagnostics, + /*returnValue*/ + false, + /*knownRootOptions*/ + void 0, + /*jsonConversionNotifier*/ + void 0 + ); + result_3.referencedFiles = ts6.emptyArray; + result_3.typeReferenceDirectives = ts6.emptyArray; + result_3.libReferenceDirectives = ts6.emptyArray; + result_3.amdDependencies = ts6.emptyArray; + result_3.hasNoDefaultLib = false; + result_3.pragmas = ts6.emptyMap; + return result_3; + } + initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, scriptKind2); + var result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator); + clearState(); + return result; + } + Parser2.parseSourceFile = parseSourceFile; + function parseIsolatedEntityName2(content, languageVersion2) { + initializeState( + "", + content, + languageVersion2, + /*syntaxCursor*/ + void 0, + 1 + /* ScriptKind.JS */ + ); + nextToken(); + var entityName = parseEntityName( + /*allowReservedWords*/ + true + ); + var isInvalid = token() === 1 && !parseDiagnostics.length; + clearState(); + return isInvalid ? entityName : void 0; + } + Parser2.parseIsolatedEntityName = parseIsolatedEntityName2; + function parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes) { + if (languageVersion2 === void 0) { + languageVersion2 = 2; + } + if (setParentNodes === void 0) { + setParentNodes = false; + } + initializeState( + fileName2, + sourceText2, + languageVersion2, + syntaxCursor2, + 6 + /* ScriptKind.JSON */ + ); + sourceFlags = contextFlags; + nextToken(); + var pos = getNodePos(); + var statements, endOfFileToken; + if (token() === 1) { + statements = createNodeArray([], pos, pos); + endOfFileToken = parseTokenNode(); + } else { + var expressions = void 0; + while (token() !== 1) { + var expression_1 = void 0; + switch (token()) { + case 22: + expression_1 = parseArrayLiteralExpression(); + break; + case 110: + case 95: + case 104: + expression_1 = parseTokenNode(); + break; + case 40: + if (lookAhead(function() { + return nextToken() === 8 && nextToken() !== 58; + })) { + expression_1 = parsePrefixUnaryExpression(); + } else { + expression_1 = parseObjectLiteralExpression(); + } + break; + case 8: + case 10: + if (lookAhead(function() { + return nextToken() !== 58; + })) { + expression_1 = parseLiteralNode(); + break; + } + default: + expression_1 = parseObjectLiteralExpression(); + break; + } + if (expressions && ts6.isArray(expressions)) { + expressions.push(expression_1); + } else if (expressions) { + expressions = [expressions, expression_1]; + } else { + expressions = expression_1; + if (token() !== 1) { + parseErrorAtCurrentToken(ts6.Diagnostics.Unexpected_token); + } + } + } + var expression = ts6.isArray(expressions) ? finishNode(factory.createArrayLiteralExpression(expressions), pos) : ts6.Debug.checkDefined(expressions); + var statement = factory.createExpressionStatement(expression); + finishNode(statement, pos); + statements = createNodeArray([statement], pos); + endOfFileToken = parseExpectedToken(1, ts6.Diagnostics.Unexpected_token); + } + var sourceFile = createSourceFile3( + fileName2, + 2, + 6, + /*isDeclaration*/ + false, + statements, + endOfFileToken, + sourceFlags, + ts6.noop + ); + if (setParentNodes) { + fixupParentReferences(sourceFile); + } + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; + sourceFile.parseDiagnostics = ts6.attachFileToDiagnostics(parseDiagnostics, sourceFile); + if (jsDocDiagnostics) { + sourceFile.jsDocDiagnostics = ts6.attachFileToDiagnostics(jsDocDiagnostics, sourceFile); + } + var result = sourceFile; + clearState(); + return result; + } + Parser2.parseJsonText = parseJsonText2; + function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind) { + NodeConstructor2 = ts6.objectAllocator.getNodeConstructor(); + TokenConstructor2 = ts6.objectAllocator.getTokenConstructor(); + IdentifierConstructor2 = ts6.objectAllocator.getIdentifierConstructor(); + PrivateIdentifierConstructor2 = ts6.objectAllocator.getPrivateIdentifierConstructor(); + SourceFileConstructor2 = ts6.objectAllocator.getSourceFileConstructor(); + fileName = ts6.normalizePath(_fileName); + sourceText = _sourceText; + languageVersion = _languageVersion; + syntaxCursor = _syntaxCursor; + scriptKind = _scriptKind; + languageVariant = ts6.getLanguageVariant(_scriptKind); + parseDiagnostics = []; + parsingContext = 0; + identifiers = new ts6.Map(); + privateIdentifiers = new ts6.Map(); + identifierCount = 0; + nodeCount = 0; + sourceFlags = 0; + topLevel = true; + switch (scriptKind) { + case 1: + case 2: + contextFlags = 262144; + break; + case 6: + contextFlags = 262144 | 67108864; + break; + default: + contextFlags = 0; + break; + } + parseErrorBeforeNextFinishedNode = false; + scanner.setText(sourceText); + scanner.setOnError(scanError); + scanner.setScriptTarget(languageVersion); + scanner.setLanguageVariant(languageVariant); + } + function clearState() { + scanner.clearCommentDirectives(); + scanner.setText(""); + scanner.setOnError(void 0); + sourceText = void 0; + languageVersion = void 0; + syntaxCursor = void 0; + scriptKind = void 0; + languageVariant = void 0; + sourceFlags = 0; + parseDiagnostics = void 0; + jsDocDiagnostics = void 0; + parsingContext = 0; + identifiers = void 0; + notParenthesizedArrow = void 0; + topLevel = true; + } + function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2) { + var isDeclarationFile = isDeclarationFileName(fileName); + if (isDeclarationFile) { + contextFlags |= 16777216; + } + sourceFlags = contextFlags; + nextToken(); + var statements = parseList(0, parseStatement); + ts6.Debug.assert( + token() === 1 + /* SyntaxKind.EndOfFileToken */ + ); + var endOfFileToken = addJSDocComment(parseTokenNode()); + var sourceFile = createSourceFile3(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2); + processCommentPragmas(sourceFile, sourceText); + processPragmasIntoFields(sourceFile, reportPragmaDiagnostic); + sourceFile.commentDirectives = scanner.getCommentDirectives(); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; + sourceFile.parseDiagnostics = ts6.attachFileToDiagnostics(parseDiagnostics, sourceFile); + if (jsDocDiagnostics) { + sourceFile.jsDocDiagnostics = ts6.attachFileToDiagnostics(jsDocDiagnostics, sourceFile); + } + if (setParentNodes) { + fixupParentReferences(sourceFile); + } + return sourceFile; + function reportPragmaDiagnostic(pos, end, diagnostic) { + parseDiagnostics.push(ts6.createDetachedDiagnostic(fileName, pos, end, diagnostic)); + } + } + function withJSDoc(node, hasJSDoc) { + return hasJSDoc ? addJSDocComment(node) : node; + } + var hasDeprecatedTag = false; + function addJSDocComment(node) { + ts6.Debug.assert(!node.jsDoc); + var jsDoc = ts6.mapDefined(ts6.getJSDocCommentRanges(node, sourceText), function(comment) { + return JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + }); + if (jsDoc.length) + node.jsDoc = jsDoc; + if (hasDeprecatedTag) { + hasDeprecatedTag = false; + node.flags |= 268435456; + } + return node; + } + function reparseTopLevelAwait(sourceFile) { + var savedSyntaxCursor = syntaxCursor; + var baseSyntaxCursor = IncrementalParser.createSyntaxCursor(sourceFile); + syntaxCursor = { currentNode: currentNode2 }; + var statements = []; + var savedParseDiagnostics = parseDiagnostics; + parseDiagnostics = []; + var pos = 0; + var start = findNextStatementWithAwait(sourceFile.statements, 0); + var _loop_3 = function() { + var prevStatement = sourceFile.statements[pos]; + var nextStatement = sourceFile.statements[start]; + ts6.addRange(statements, sourceFile.statements, pos, start); + pos = findNextStatementWithoutAwait(sourceFile.statements, start); + var diagnosticStart2 = ts6.findIndex(savedParseDiagnostics, function(diagnostic) { + return diagnostic.start >= prevStatement.pos; + }); + var diagnosticEnd = diagnosticStart2 >= 0 ? ts6.findIndex(savedParseDiagnostics, function(diagnostic) { + return diagnostic.start >= nextStatement.pos; + }, diagnosticStart2) : -1; + if (diagnosticStart2 >= 0) { + ts6.addRange(parseDiagnostics, savedParseDiagnostics, diagnosticStart2, diagnosticEnd >= 0 ? diagnosticEnd : void 0); + } + speculationHelper( + function() { + var savedContextFlags = contextFlags; + contextFlags |= 32768; + scanner.setTextPos(nextStatement.pos); + nextToken(); + while (token() !== 1) { + var startPos = scanner.getStartPos(); + var statement = parseListElement(0, parseStatement); + statements.push(statement); + if (startPos === scanner.getStartPos()) { + nextToken(); + } + if (pos >= 0) { + var nonAwaitStatement = sourceFile.statements[pos]; + if (statement.end === nonAwaitStatement.pos) { + break; + } + if (statement.end > nonAwaitStatement.pos) { + pos = findNextStatementWithoutAwait(sourceFile.statements, pos + 1); + } + } + } + contextFlags = savedContextFlags; + }, + 2 + /* SpeculationKind.Reparse */ + ); + start = pos >= 0 ? findNextStatementWithAwait(sourceFile.statements, pos) : -1; + }; + while (start !== -1) { + _loop_3(); + } + if (pos >= 0) { + var prevStatement_1 = sourceFile.statements[pos]; + ts6.addRange(statements, sourceFile.statements, pos); + var diagnosticStart = ts6.findIndex(savedParseDiagnostics, function(diagnostic) { + return diagnostic.start >= prevStatement_1.pos; + }); + if (diagnosticStart >= 0) { + ts6.addRange(parseDiagnostics, savedParseDiagnostics, diagnosticStart); + } + } + syntaxCursor = savedSyntaxCursor; + return factory.updateSourceFile(sourceFile, ts6.setTextRange(factory.createNodeArray(statements), sourceFile.statements)); + function containsPossibleTopLevelAwait(node) { + return !(node.flags & 32768) && !!(node.transformFlags & 67108864); + } + function findNextStatementWithAwait(statements2, start2) { + for (var i = start2; i < statements2.length; i++) { + if (containsPossibleTopLevelAwait(statements2[i])) { + return i; + } + } + return -1; + } + function findNextStatementWithoutAwait(statements2, start2) { + for (var i = start2; i < statements2.length; i++) { + if (!containsPossibleTopLevelAwait(statements2[i])) { + return i; + } + } + return -1; + } + function currentNode2(position) { + var node = baseSyntaxCursor.currentNode(position); + if (topLevel && node && containsPossibleTopLevelAwait(node)) { + node.intersectsChange = true; + } + return node; + } + } + function fixupParentReferences(rootNode) { + ts6.setParentRecursive( + rootNode, + /*incremental*/ + true + ); + } + Parser2.fixupParentReferences = fixupParentReferences; + function createSourceFile3(fileName2, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, flags, setExternalModuleIndicator2) { + var sourceFile = factory.createSourceFile(statements, endOfFileToken, flags); + ts6.setTextRangePosWidth(sourceFile, 0, sourceText.length); + setFields(sourceFile); + if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 67108864) { + sourceFile = reparseTopLevelAwait(sourceFile); + setFields(sourceFile); + } + return sourceFile; + function setFields(sourceFile2) { + sourceFile2.text = sourceText; + sourceFile2.bindDiagnostics = []; + sourceFile2.bindSuggestionDiagnostics = void 0; + sourceFile2.languageVersion = languageVersion2; + sourceFile2.fileName = fileName2; + sourceFile2.languageVariant = ts6.getLanguageVariant(scriptKind2); + sourceFile2.isDeclarationFile = isDeclarationFile; + sourceFile2.scriptKind = scriptKind2; + setExternalModuleIndicator2(sourceFile2); + sourceFile2.setExternalModuleIndicator = setExternalModuleIndicator2; + } + } + function setContextFlag(val, flag) { + if (val) { + contextFlags |= flag; + } else { + contextFlags &= ~flag; + } + } + function setDisallowInContext(val) { + setContextFlag( + val, + 4096 + /* NodeFlags.DisallowInContext */ + ); + } + function setYieldContext(val) { + setContextFlag( + val, + 8192 + /* NodeFlags.YieldContext */ + ); + } + function setDecoratorContext(val) { + setContextFlag( + val, + 16384 + /* NodeFlags.DecoratorContext */ + ); + } + function setAwaitContext(val) { + setContextFlag( + val, + 32768 + /* NodeFlags.AwaitContext */ + ); + } + function doOutsideOfContext(context, func) { + var contextFlagsToClear = context & contextFlags; + if (contextFlagsToClear) { + setContextFlag( + /*val*/ + false, + contextFlagsToClear + ); + var result = func(); + setContextFlag( + /*val*/ + true, + contextFlagsToClear + ); + return result; + } + return func(); + } + function doInsideOfContext(context, func) { + var contextFlagsToSet = context & ~contextFlags; + if (contextFlagsToSet) { + setContextFlag( + /*val*/ + true, + contextFlagsToSet + ); + var result = func(); + setContextFlag( + /*val*/ + false, + contextFlagsToSet + ); + return result; + } + return func(); + } + function allowInAnd(func) { + return doOutsideOfContext(4096, func); + } + function disallowInAnd(func) { + return doInsideOfContext(4096, func); + } + function allowConditionalTypesAnd(func) { + return doOutsideOfContext(65536, func); + } + function disallowConditionalTypesAnd(func) { + return doInsideOfContext(65536, func); + } + function doInYieldContext(func) { + return doInsideOfContext(8192, func); + } + function doInDecoratorContext(func) { + return doInsideOfContext(16384, func); + } + function doInAwaitContext(func) { + return doInsideOfContext(32768, func); + } + function doOutsideOfAwaitContext(func) { + return doOutsideOfContext(32768, func); + } + function doInYieldAndAwaitContext(func) { + return doInsideOfContext(8192 | 32768, func); + } + function doOutsideOfYieldAndAwaitContext(func) { + return doOutsideOfContext(8192 | 32768, func); + } + function inContext(flags) { + return (contextFlags & flags) !== 0; + } + function inYieldContext() { + return inContext( + 8192 + /* NodeFlags.YieldContext */ + ); + } + function inDisallowInContext() { + return inContext( + 4096 + /* NodeFlags.DisallowInContext */ + ); + } + function inDisallowConditionalTypesContext() { + return inContext( + 65536 + /* NodeFlags.DisallowConditionalTypesContext */ + ); + } + function inDecoratorContext() { + return inContext( + 16384 + /* NodeFlags.DecoratorContext */ + ); + } + function inAwaitContext() { + return inContext( + 32768 + /* NodeFlags.AwaitContext */ + ); + } + function parseErrorAtCurrentToken(message, arg0) { + return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + } + function parseErrorAtPosition(start, length, message, arg0) { + var lastError = ts6.lastOrUndefined(parseDiagnostics); + var result; + if (!lastError || start !== lastError.start) { + result = ts6.createDetachedDiagnostic(fileName, start, length, message, arg0); + parseDiagnostics.push(result); + } + parseErrorBeforeNextFinishedNode = true; + return result; + } + function parseErrorAt(start, end, message, arg0) { + return parseErrorAtPosition(start, end - start, message, arg0); + } + function parseErrorAtRange(range2, message, arg0) { + parseErrorAt(range2.pos, range2.end, message, arg0); + } + function scanError(message, length) { + parseErrorAtPosition(scanner.getTextPos(), length, message); + } + function getNodePos() { + return scanner.getStartPos(); + } + function hasPrecedingJSDocComment() { + return scanner.hasPrecedingJSDocComment(); + } + function token() { + return currentToken; + } + function nextTokenWithoutCheck() { + return currentToken = scanner.scan(); + } + function nextTokenAnd(func) { + nextToken(); + return func(); + } + function nextToken() { + if (ts6.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) { + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts6.Diagnostics.Keywords_cannot_contain_escape_characters); + } + return nextTokenWithoutCheck(); + } + function nextTokenJSDoc() { + return currentToken = scanner.scanJsDocToken(); + } + function reScanGreaterToken() { + return currentToken = scanner.reScanGreaterToken(); + } + function reScanSlashToken() { + return currentToken = scanner.reScanSlashToken(); + } + function reScanTemplateToken(isTaggedTemplate) { + return currentToken = scanner.reScanTemplateToken(isTaggedTemplate); + } + function reScanTemplateHeadOrNoSubstitutionTemplate() { + return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate(); + } + function reScanLessThanToken() { + return currentToken = scanner.reScanLessThanToken(); + } + function reScanHashToken() { + return currentToken = scanner.reScanHashToken(); + } + function scanJsxIdentifier() { + return currentToken = scanner.scanJsxIdentifier(); + } + function scanJsxText() { + return currentToken = scanner.scanJsxToken(); + } + function scanJsxAttributeValue() { + return currentToken = scanner.scanJsxAttributeValue(); + } + function speculationHelper(callback, speculationKind) { + var saveToken = currentToken; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var saveContextFlags = contextFlags; + var result = speculationKind !== 0 ? scanner.lookAhead(callback) : scanner.tryScan(callback); + ts6.Debug.assert(saveContextFlags === contextFlags); + if (!result || speculationKind !== 0) { + currentToken = saveToken; + if (speculationKind !== 2) { + parseDiagnostics.length = saveParseDiagnosticsLength; + } + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + } + return result; + } + function lookAhead(callback) { + return speculationHelper( + callback, + 1 + /* SpeculationKind.Lookahead */ + ); + } + function tryParse(callback) { + return speculationHelper( + callback, + 0 + /* SpeculationKind.TryParse */ + ); + } + function isBindingIdentifier() { + if (token() === 79) { + return true; + } + return token() > 116; + } + function isIdentifier3() { + if (token() === 79) { + return true; + } + if (token() === 125 && inYieldContext()) { + return false; + } + if (token() === 133 && inAwaitContext()) { + return false; + } + return token() > 116; + } + function parseExpected(kind, diagnosticMessage, shouldAdvance) { + if (shouldAdvance === void 0) { + shouldAdvance = true; + } + if (token() === kind) { + if (shouldAdvance) { + nextToken(); + } + return true; + } + if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage); + } else { + parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString(kind)); + } + return false; + } + var viableKeywordSuggestions = Object.keys(ts6.textToKeywordObj).filter(function(keyword) { + return keyword.length > 2; + }); + function parseErrorForMissingSemicolonAfter(node) { + var _a2; + if (ts6.isTaggedTemplateExpression(node)) { + parseErrorAt(ts6.skipTrivia(sourceText, node.template.pos), node.template.end, ts6.Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings); + return; + } + var expressionText = ts6.isIdentifier(node) ? ts6.idText(node) : void 0; + if (!expressionText || !ts6.isIdentifierText(expressionText, languageVersion)) { + parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString( + 26 + /* SyntaxKind.SemicolonToken */ + )); + return; + } + var pos = ts6.skipTrivia(sourceText, node.pos); + switch (expressionText) { + case "const": + case "let": + case "var": + parseErrorAt(pos, node.end, ts6.Diagnostics.Variable_declaration_not_allowed_at_this_location); + return; + case "declare": + return; + case "interface": + parseErrorForInvalidName( + ts6.Diagnostics.Interface_name_cannot_be_0, + ts6.Diagnostics.Interface_must_be_given_a_name, + 18 + /* SyntaxKind.OpenBraceToken */ + ); + return; + case "is": + parseErrorAt(pos, scanner.getTextPos(), ts6.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + case "module": + case "namespace": + parseErrorForInvalidName( + ts6.Diagnostics.Namespace_name_cannot_be_0, + ts6.Diagnostics.Namespace_must_be_given_a_name, + 18 + /* SyntaxKind.OpenBraceToken */ + ); + return; + case "type": + parseErrorForInvalidName( + ts6.Diagnostics.Type_alias_name_cannot_be_0, + ts6.Diagnostics.Type_alias_must_be_given_a_name, + 63 + /* SyntaxKind.EqualsToken */ + ); + return; + } + var suggestion = (_a2 = ts6.getSpellingSuggestion(expressionText, viableKeywordSuggestions, function(n) { + return n; + })) !== null && _a2 !== void 0 ? _a2 : getSpaceSuggestion(expressionText); + if (suggestion) { + parseErrorAt(pos, node.end, ts6.Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion); + return; + } + if (token() === 0) { + return; + } + parseErrorAt(pos, node.end, ts6.Diagnostics.Unexpected_keyword_or_identifier); + } + function parseErrorForInvalidName(nameDiagnostic, blankDiagnostic, tokenIfBlankName) { + if (token() === tokenIfBlankName) { + parseErrorAtCurrentToken(blankDiagnostic); + } else { + parseErrorAtCurrentToken(nameDiagnostic, scanner.getTokenValue()); + } + } + function getSpaceSuggestion(expressionText) { + for (var _i = 0, viableKeywordSuggestions_1 = viableKeywordSuggestions; _i < viableKeywordSuggestions_1.length; _i++) { + var keyword = viableKeywordSuggestions_1[_i]; + if (expressionText.length > keyword.length + 2 && ts6.startsWith(expressionText, keyword)) { + return "".concat(keyword, " ").concat(expressionText.slice(keyword.length)); + } + } + return void 0; + } + function parseSemicolonAfterPropertyName(name, type, initializer) { + if (token() === 59 && !scanner.hasPrecedingLineBreak()) { + parseErrorAtCurrentToken(ts6.Diagnostics.Decorators_must_precede_the_name_and_all_keywords_of_property_declarations); + return; + } + if (token() === 20) { + parseErrorAtCurrentToken(ts6.Diagnostics.Cannot_start_a_function_call_in_a_type_annotation); + nextToken(); + return; + } + if (type && !canParseSemicolon()) { + if (initializer) { + parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString( + 26 + /* SyntaxKind.SemicolonToken */ + )); + } else { + parseErrorAtCurrentToken(ts6.Diagnostics.Expected_for_property_initializer); + } + return; + } + if (tryParseSemicolon()) { + return; + } + if (initializer) { + parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString( + 26 + /* SyntaxKind.SemicolonToken */ + )); + return; + } + parseErrorForMissingSemicolonAfter(name); + } + function parseExpectedJSDoc(kind) { + if (token() === kind) { + nextTokenJSDoc(); + return true; + } + parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString(kind)); + return false; + } + function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) { + if (token() === closeKind) { + nextToken(); + return; + } + var lastError = parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString(closeKind)); + if (!openParsed) { + return; + } + if (lastError) { + ts6.addRelatedInfo(lastError, ts6.createDetachedDiagnostic(fileName, openPosition, 1, ts6.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts6.tokenToString(openKind), ts6.tokenToString(closeKind))); + } + } + function parseOptional(t) { + if (token() === t) { + nextToken(); + return true; + } + return false; + } + function parseOptionalToken(t) { + if (token() === t) { + return parseTokenNode(); + } + return void 0; + } + function parseOptionalTokenJSDoc(t) { + if (token() === t) { + return parseTokenNodeJSDoc(); + } + return void 0; + } + function parseExpectedToken(t, diagnosticMessage, arg0) { + return parseOptionalToken(t) || createMissingNode( + t, + /*reportAtCurrentPosition*/ + false, + diagnosticMessage || ts6.Diagnostics._0_expected, + arg0 || ts6.tokenToString(t) + ); + } + function parseExpectedTokenJSDoc(t) { + return parseOptionalTokenJSDoc(t) || createMissingNode( + t, + /*reportAtCurrentPosition*/ + false, + ts6.Diagnostics._0_expected, + ts6.tokenToString(t) + ); + } + function parseTokenNode() { + var pos = getNodePos(); + var kind = token(); + nextToken(); + return finishNode(factory.createToken(kind), pos); + } + function parseTokenNodeJSDoc() { + var pos = getNodePos(); + var kind = token(); + nextTokenJSDoc(); + return finishNode(factory.createToken(kind), pos); + } + function canParseSemicolon() { + if (token() === 26) { + return true; + } + return token() === 19 || token() === 1 || scanner.hasPrecedingLineBreak(); + } + function tryParseSemicolon() { + if (!canParseSemicolon()) { + return false; + } + if (token() === 26) { + nextToken(); + } + return true; + } + function parseSemicolon() { + return tryParseSemicolon() || parseExpected( + 26 + /* SyntaxKind.SemicolonToken */ + ); + } + function createNodeArray(elements, pos, end, hasTrailingComma) { + var array = factory.createNodeArray(elements, hasTrailingComma); + ts6.setTextRangePosEnd(array, pos, end !== null && end !== void 0 ? end : scanner.getStartPos()); + return array; + } + function finishNode(node, pos, end) { + ts6.setTextRangePosEnd(node, pos, end !== null && end !== void 0 ? end : scanner.getStartPos()); + if (contextFlags) { + node.flags |= contextFlags; + } + if (parseErrorBeforeNextFinishedNode) { + parseErrorBeforeNextFinishedNode = false; + node.flags |= 131072; + } + return node; + } + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + if (reportAtCurrentPosition) { + parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); + } else if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage, arg0); + } + var pos = getNodePos(); + var result = kind === 79 ? factory.createIdentifier( + "", + /*typeArguments*/ + void 0, + /*originalKeywordKind*/ + void 0 + ) : ts6.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode( + kind, + "", + "", + /*templateFlags*/ + void 0 + ) : kind === 8 ? factory.createNumericLiteral( + "", + /*numericLiteralFlags*/ + void 0 + ) : kind === 10 ? factory.createStringLiteral( + "", + /*isSingleQuote*/ + void 0 + ) : kind === 279 ? factory.createMissingDeclaration() : factory.createToken(kind); + return finishNode(result, pos); + } + function internIdentifier(text) { + var identifier = identifiers.get(text); + if (identifier === void 0) { + identifiers.set(text, identifier = text); + } + return identifier; + } + function createIdentifier(isIdentifier4, diagnosticMessage, privateIdentifierDiagnosticMessage) { + if (isIdentifier4) { + identifierCount++; + var pos = getNodePos(); + var originalKeywordKind = token(); + var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); + nextTokenWithoutCheck(); + return finishNode(factory.createIdentifier( + text, + /*typeArguments*/ + void 0, + originalKeywordKind, + hasExtendedUnicodeEscape + ), pos); + } + if (token() === 80) { + parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + return createIdentifier( + /*isIdentifier*/ + true + ); + } + if (token() === 0 && scanner.tryScan(function() { + return scanner.reScanInvalidIdentifier() === 79; + })) { + return createIdentifier( + /*isIdentifier*/ + true + ); + } + identifierCount++; + var reportAtCurrentPosition = token() === 1; + var isReservedWord = scanner.isReservedWord(); + var msgArg = scanner.getTokenText(); + var defaultMessage = isReservedWord ? ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here : ts6.Diagnostics.Identifier_expected; + return createMissingNode(79, reportAtCurrentPosition, diagnosticMessage || defaultMessage, msgArg); + } + function parseBindingIdentifier(privateIdentifierDiagnosticMessage) { + return createIdentifier( + isBindingIdentifier(), + /*diagnosticMessage*/ + void 0, + privateIdentifierDiagnosticMessage + ); + } + function parseIdentifier(diagnosticMessage, privateIdentifierDiagnosticMessage) { + return createIdentifier(isIdentifier3(), diagnosticMessage, privateIdentifierDiagnosticMessage); + } + function parseIdentifierName(diagnosticMessage) { + return createIdentifier(ts6.tokenIsIdentifierOrKeyword(token()), diagnosticMessage); + } + function isLiteralPropertyName() { + return ts6.tokenIsIdentifierOrKeyword(token()) || token() === 10 || token() === 8; + } + function isAssertionKey() { + return ts6.tokenIsIdentifierOrKeyword(token()) || token() === 10; + } + function parsePropertyNameWorker(allowComputedPropertyNames) { + if (token() === 10 || token() === 8) { + var node = parseLiteralNode(); + node.text = internIdentifier(node.text); + return node; + } + if (allowComputedPropertyNames && token() === 22) { + return parseComputedPropertyName(); + } + if (token() === 80) { + return parsePrivateIdentifier(); + } + return parseIdentifierName(); + } + function parsePropertyName() { + return parsePropertyNameWorker( + /*allowComputedPropertyNames*/ + true + ); + } + function parseComputedPropertyName() { + var pos = getNodePos(); + parseExpected( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + return finishNode(factory.createComputedPropertyName(expression), pos); + } + function internPrivateIdentifier(text) { + var privateIdentifier = privateIdentifiers.get(text); + if (privateIdentifier === void 0) { + privateIdentifiers.set(text, privateIdentifier = text); + } + return privateIdentifier; + } + function parsePrivateIdentifier() { + var pos = getNodePos(); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); + nextToken(); + return finishNode(node, pos); + } + function parseContextualModifier(t) { + return token() === t && tryParse(nextTokenCanFollowModifier); + } + function nextTokenIsOnSameLineAndCanFollowModifier() { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + return canFollowModifier(); + } + function nextTokenCanFollowModifier() { + switch (token()) { + case 85: + return nextToken() === 92; + case 93: + nextToken(); + if (token() === 88) { + return lookAhead(nextTokenCanFollowDefaultKeyword); + } + if (token() === 154) { + return lookAhead(nextTokenCanFollowExportModifier); + } + return canFollowExportModifier(); + case 88: + return nextTokenCanFollowDefaultKeyword(); + case 127: + case 124: + case 137: + case 151: + nextToken(); + return canFollowModifier(); + default: + return nextTokenIsOnSameLineAndCanFollowModifier(); + } + } + function canFollowExportModifier() { + return token() !== 41 && token() !== 128 && token() !== 18 && canFollowModifier(); + } + function nextTokenCanFollowExportModifier() { + nextToken(); + return canFollowExportModifier(); + } + function parseAnyContextualModifier() { + return ts6.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier); + } + function canFollowModifier() { + return token() === 22 || token() === 18 || token() === 41 || token() === 25 || isLiteralPropertyName(); + } + function nextTokenCanFollowDefaultKeyword() { + nextToken(); + return token() === 84 || token() === 98 || token() === 118 || token() === 126 && lookAhead(nextTokenIsClassKeywordOnSameLine) || token() === 132 && lookAhead(nextTokenIsFunctionKeywordOnSameLine); + } + function isListElement(parsingContext2, inErrorRecovery) { + var node = currentNode(parsingContext2); + if (node) { + return true; + } + switch (parsingContext2) { + case 0: + case 1: + case 3: + return !(token() === 26 && inErrorRecovery) && isStartOfStatement(); + case 2: + return token() === 82 || token() === 88; + case 4: + return lookAhead(isTypeMemberStart); + case 5: + return lookAhead(isClassMemberStart) || token() === 26 && !inErrorRecovery; + case 6: + return token() === 22 || isLiteralPropertyName(); + case 12: + switch (token()) { + case 22: + case 41: + case 25: + case 24: + return true; + default: + return isLiteralPropertyName(); + } + case 18: + return isLiteralPropertyName(); + case 9: + return token() === 22 || token() === 25 || isLiteralPropertyName(); + case 24: + return isAssertionKey(); + case 7: + if (token() === 18) { + return lookAhead(isValidHeritageClauseObjectLiteral); + } + if (!inErrorRecovery) { + return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword(); + } else { + return isIdentifier3() && !isHeritageClauseExtendsOrImplementsKeyword(); + } + case 8: + return isBindingIdentifierOrPrivateIdentifierOrPattern(); + case 10: + return token() === 27 || token() === 25 || isBindingIdentifierOrPrivateIdentifierOrPattern(); + case 19: + return token() === 101 || isIdentifier3(); + case 15: + switch (token()) { + case 27: + case 24: + return true; + } + case 11: + return token() === 25 || isStartOfExpression(); + case 16: + return isStartOfParameter( + /*isJSDocParameter*/ + false + ); + case 17: + return isStartOfParameter( + /*isJSDocParameter*/ + true + ); + case 20: + case 21: + return token() === 27 || isStartOfType(); + case 22: + return isHeritageClause(); + case 23: + return ts6.tokenIsIdentifierOrKeyword(token()); + case 13: + return ts6.tokenIsIdentifierOrKeyword(token()) || token() === 18; + case 14: + return true; + } + return ts6.Debug.fail("Non-exhaustive case in 'isListElement'."); + } + function isValidHeritageClauseObjectLiteral() { + ts6.Debug.assert( + token() === 18 + /* SyntaxKind.OpenBraceToken */ + ); + if (nextToken() === 19) { + var next = nextToken(); + return next === 27 || next === 18 || next === 94 || next === 117; + } + return true; + } + function nextTokenIsIdentifier() { + nextToken(); + return isIdentifier3(); + } + function nextTokenIsIdentifierOrKeyword() { + nextToken(); + return ts6.tokenIsIdentifierOrKeyword(token()); + } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts6.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } + function isHeritageClauseExtendsOrImplementsKeyword() { + if (token() === 117 || token() === 94) { + return lookAhead(nextTokenIsStartOfExpression); + } + return false; + } + function nextTokenIsStartOfExpression() { + nextToken(); + return isStartOfExpression(); + } + function nextTokenIsStartOfType() { + nextToken(); + return isStartOfType(); + } + function isListTerminator(kind) { + if (token() === 1) { + return true; + } + switch (kind) { + case 1: + case 2: + case 4: + case 5: + case 6: + case 12: + case 9: + case 23: + case 24: + return token() === 19; + case 3: + return token() === 19 || token() === 82 || token() === 88; + case 7: + return token() === 18 || token() === 94 || token() === 117; + case 8: + return isVariableDeclaratorListTerminator(); + case 19: + return token() === 31 || token() === 20 || token() === 18 || token() === 94 || token() === 117; + case 11: + return token() === 21 || token() === 26; + case 15: + case 21: + case 10: + return token() === 23; + case 17: + case 16: + case 18: + return token() === 21 || token() === 23; + case 20: + return token() !== 27; + case 22: + return token() === 18 || token() === 19; + case 13: + return token() === 31 || token() === 43; + case 14: + return token() === 29 && lookAhead(nextTokenIsSlash); + default: + return false; + } + } + function isVariableDeclaratorListTerminator() { + if (canParseSemicolon()) { + return true; + } + if (isInOrOfKeyword(token())) { + return true; + } + if (token() === 38) { + return true; + } + return false; + } + function isInSomeParsingContext() { + for (var kind = 0; kind < 25; kind++) { + if (parsingContext & 1 << kind) { + if (isListElement( + kind, + /*inErrorRecovery*/ + true + ) || isListTerminator(kind)) { + return true; + } + } + } + return false; + } + function parseList(kind, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var list = []; + var listPos = getNodePos(); + while (!isListTerminator(kind)) { + if (isListElement( + kind, + /*inErrorRecovery*/ + false + )) { + list.push(parseListElement(kind, parseElement)); + continue; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + parsingContext = saveParsingContext; + return createNodeArray(list, listPos); + } + function parseListElement(parsingContext2, parseElement) { + var node = currentNode(parsingContext2); + if (node) { + return consumeNode(node); + } + return parseElement(); + } + function currentNode(parsingContext2, pos) { + if (!syntaxCursor || !isReusableParsingContext(parsingContext2) || parseErrorBeforeNextFinishedNode) { + return void 0; + } + var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos()); + if (ts6.nodeIsMissing(node) || node.intersectsChange || ts6.containsParseError(node)) { + return void 0; + } + var nodeContextFlags = node.flags & 50720768; + if (nodeContextFlags !== contextFlags) { + return void 0; + } + if (!canReuseNode(node, parsingContext2)) { + return void 0; + } + if (node.jsDocCache) { + node.jsDocCache = void 0; + } + return node; + } + function consumeNode(node) { + scanner.setTextPos(node.end); + nextToken(); + return node; + } + function isReusableParsingContext(parsingContext2) { + switch (parsingContext2) { + case 5: + case 2: + case 0: + case 1: + case 3: + case 6: + case 4: + case 8: + case 17: + case 16: + return true; + } + return false; + } + function canReuseNode(node, parsingContext2) { + switch (parsingContext2) { + case 5: + return isReusableClassMember(node); + case 2: + return isReusableSwitchClause(node); + case 0: + case 1: + case 3: + return isReusableStatement(node); + case 6: + return isReusableEnumMember(node); + case 4: + return isReusableTypeMember(node); + case 8: + return isReusableVariableDeclaration(node); + case 17: + case 16: + return isReusableParameter(node); + } + return false; + } + function isReusableClassMember(node) { + if (node) { + switch (node.kind) { + case 173: + case 178: + case 174: + case 175: + case 169: + case 237: + return true; + case 171: + var methodDeclaration = node; + var nameIsConstructor = methodDeclaration.name.kind === 79 && methodDeclaration.name.originalKeywordKind === 135; + return !nameIsConstructor; + } + } + return false; + } + function isReusableSwitchClause(node) { + if (node) { + switch (node.kind) { + case 292: + case 293: + return true; + } + } + return false; + } + function isReusableStatement(node) { + if (node) { + switch (node.kind) { + case 259: + case 240: + case 238: + case 242: + case 241: + case 254: + case 250: + case 252: + case 249: + case 248: + case 246: + case 247: + case 245: + case 244: + case 251: + case 239: + case 255: + case 253: + case 243: + case 256: + case 269: + case 268: + case 275: + case 274: + case 264: + case 260: + case 261: + case 263: + case 262: + return true; + } + } + return false; + } + function isReusableEnumMember(node) { + return node.kind === 302; + } + function isReusableTypeMember(node) { + if (node) { + switch (node.kind) { + case 177: + case 170: + case 178: + case 168: + case 176: + return true; + } + } + return false; + } + function isReusableVariableDeclaration(node) { + if (node.kind !== 257) { + return false; + } + var variableDeclarator = node; + return variableDeclarator.initializer === void 0; + } + function isReusableParameter(node) { + if (node.kind !== 166) { + return false; + } + var parameter = node; + return parameter.initializer === void 0; + } + function abortParsingListOrMoveToNextToken(kind) { + parsingContextErrors(kind); + if (isInSomeParsingContext()) { + return true; + } + nextToken(); + return false; + } + function parsingContextErrors(context) { + switch (context) { + case 0: + return token() === 88 ? parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString( + 93 + /* SyntaxKind.ExportKeyword */ + )) : parseErrorAtCurrentToken(ts6.Diagnostics.Declaration_or_statement_expected); + case 1: + return parseErrorAtCurrentToken(ts6.Diagnostics.Declaration_or_statement_expected); + case 2: + return parseErrorAtCurrentToken(ts6.Diagnostics.case_or_default_expected); + case 3: + return parseErrorAtCurrentToken(ts6.Diagnostics.Statement_expected); + case 18: + case 4: + return parseErrorAtCurrentToken(ts6.Diagnostics.Property_or_signature_expected); + case 5: + return parseErrorAtCurrentToken(ts6.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected); + case 6: + return parseErrorAtCurrentToken(ts6.Diagnostics.Enum_member_expected); + case 7: + return parseErrorAtCurrentToken(ts6.Diagnostics.Expression_expected); + case 8: + return ts6.isKeyword(token()) ? parseErrorAtCurrentToken(ts6.Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, ts6.tokenToString(token())) : parseErrorAtCurrentToken(ts6.Diagnostics.Variable_declaration_expected); + case 9: + return parseErrorAtCurrentToken(ts6.Diagnostics.Property_destructuring_pattern_expected); + case 10: + return parseErrorAtCurrentToken(ts6.Diagnostics.Array_element_destructuring_pattern_expected); + case 11: + return parseErrorAtCurrentToken(ts6.Diagnostics.Argument_expression_expected); + case 12: + return parseErrorAtCurrentToken(ts6.Diagnostics.Property_assignment_expected); + case 15: + return parseErrorAtCurrentToken(ts6.Diagnostics.Expression_or_comma_expected); + case 17: + return parseErrorAtCurrentToken(ts6.Diagnostics.Parameter_declaration_expected); + case 16: + return ts6.isKeyword(token()) ? parseErrorAtCurrentToken(ts6.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts6.tokenToString(token())) : parseErrorAtCurrentToken(ts6.Diagnostics.Parameter_declaration_expected); + case 19: + return parseErrorAtCurrentToken(ts6.Diagnostics.Type_parameter_declaration_expected); + case 20: + return parseErrorAtCurrentToken(ts6.Diagnostics.Type_argument_expected); + case 21: + return parseErrorAtCurrentToken(ts6.Diagnostics.Type_expected); + case 22: + return parseErrorAtCurrentToken(ts6.Diagnostics.Unexpected_token_expected); + case 23: + return parseErrorAtCurrentToken(ts6.Diagnostics.Identifier_expected); + case 13: + return parseErrorAtCurrentToken(ts6.Diagnostics.Identifier_expected); + case 14: + return parseErrorAtCurrentToken(ts6.Diagnostics.Identifier_expected); + case 24: + return parseErrorAtCurrentToken(ts6.Diagnostics.Identifier_or_string_literal_expected); + case 25: + return ts6.Debug.fail("ParsingContext.Count used as a context"); + default: + ts6.Debug.assertNever(context); + } + } + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var list = []; + var listPos = getNodePos(); + var commaStart = -1; + while (true) { + if (isListElement( + kind, + /*inErrorRecovery*/ + false + )) { + var startPos = scanner.getStartPos(); + var result = parseListElement(kind, parseElement); + if (!result) { + parsingContext = saveParsingContext; + return void 0; + } + list.push(result); + commaStart = scanner.getTokenPos(); + if (parseOptional( + 27 + /* SyntaxKind.CommaToken */ + )) { + continue; + } + commaStart = -1; + if (isListTerminator(kind)) { + break; + } + parseExpected(27, getExpectedCommaDiagnostic(kind)); + if (considerSemicolonAsDelimiter && token() === 26 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + } + if (startPos === scanner.getStartPos()) { + nextToken(); + } + continue; + } + if (isListTerminator(kind)) { + break; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + parsingContext = saveParsingContext; + return createNodeArray( + list, + listPos, + /*end*/ + void 0, + commaStart >= 0 + ); + } + function getExpectedCommaDiagnostic(kind) { + return kind === 6 ? ts6.Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0; + } + function createMissingList() { + var list = createNodeArray([], getNodePos()); + list.isMissingList = true; + return list; + } + function isMissingList(arr) { + return !!arr.isMissingList; + } + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { + var result = parseDelimitedList(kind, parseElement); + parseExpected(close); + return result; + } + return createMissingList(); + } + function parseEntityName(allowReservedWords, diagnosticMessage) { + var pos = getNodePos(); + var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage); + var dotPos = getNodePos(); + while (parseOptional( + 24 + /* SyntaxKind.DotToken */ + )) { + if (token() === 29) { + entity.jsdocDotPos = dotPos; + break; + } + dotPos = getNodePos(); + entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot( + allowReservedWords, + /* allowPrivateIdentifiers */ + false + )), pos); + } + return entity; + } + function createQualifiedName(entity, name) { + return finishNode(factory.createQualifiedName(entity, name), entity.pos); + } + function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) { + if (scanner.hasPrecedingLineBreak() && ts6.tokenIsIdentifierOrKeyword(token())) { + var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + if (matchesPattern) { + return createMissingNode( + 79, + /*reportAtCurrentPosition*/ + true, + ts6.Diagnostics.Identifier_expected + ); + } + } + if (token() === 80) { + var node = parsePrivateIdentifier(); + return allowPrivateIdentifiers ? node : createMissingNode( + 79, + /*reportAtCurrentPosition*/ + true, + ts6.Diagnostics.Identifier_expected + ); + } + return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); + } + function parseTemplateSpans(isTaggedTemplate) { + var pos = getNodePos(); + var list = []; + var node; + do { + node = parseTemplateSpan(isTaggedTemplate); + list.push(node); + } while (node.literal.kind === 16); + return createNodeArray(list, pos); + } + function parseTemplateExpression(isTaggedTemplate) { + var pos = getNodePos(); + return finishNode(factory.createTemplateExpression(parseTemplateHead(isTaggedTemplate), parseTemplateSpans(isTaggedTemplate)), pos); + } + function parseTemplateType() { + var pos = getNodePos(); + return finishNode(factory.createTemplateLiteralType(parseTemplateHead( + /*isTaggedTemplate*/ + false + ), parseTemplateTypeSpans()), pos); + } + function parseTemplateTypeSpans() { + var pos = getNodePos(); + var list = []; + var node; + do { + node = parseTemplateTypeSpan(); + list.push(node); + } while (node.literal.kind === 16); + return createNodeArray(list, pos); + } + function parseTemplateTypeSpan() { + var pos = getNodePos(); + return finishNode(factory.createTemplateLiteralTypeSpan(parseType(), parseLiteralOfTemplateSpan( + /*isTaggedTemplate*/ + false + )), pos); + } + function parseLiteralOfTemplateSpan(isTaggedTemplate) { + if (token() === 19) { + reScanTemplateToken(isTaggedTemplate); + return parseTemplateMiddleOrTemplateTail(); + } else { + return parseExpectedToken(17, ts6.Diagnostics._0_expected, ts6.tokenToString( + 19 + /* SyntaxKind.CloseBraceToken */ + )); + } + } + function parseTemplateSpan(isTaggedTemplate) { + var pos = getNodePos(); + return finishNode(factory.createTemplateSpan(allowInAnd(parseExpression), parseLiteralOfTemplateSpan(isTaggedTemplate)), pos); + } + function parseLiteralNode() { + return parseLiteralLikeNode(token()); + } + function parseTemplateHead(isTaggedTemplate) { + if (isTaggedTemplate) { + reScanTemplateHeadOrNoSubstitutionTemplate(); + } + var fragment = parseLiteralLikeNode(token()); + ts6.Debug.assert(fragment.kind === 15, "Template head has wrong token kind"); + return fragment; + } + function parseTemplateMiddleOrTemplateTail() { + var fragment = parseLiteralLikeNode(token()); + ts6.Debug.assert(fragment.kind === 16 || fragment.kind === 17, "Template fragment has wrong token kind"); + return fragment; + } + function getTemplateLiteralRawText(kind) { + var isLast = kind === 14 || kind === 17; + var tokenText = scanner.getTokenText(); + return tokenText.substring(1, tokenText.length - (scanner.isUnterminated() ? 0 : isLast ? 1 : 2)); + } + function parseLiteralLikeNode(kind) { + var pos = getNodePos(); + var node = ts6.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode( + kind, + scanner.getTokenValue(), + getTemplateLiteralRawText(kind), + scanner.getTokenFlags() & 2048 + /* TokenFlags.TemplateLiteralLikeFlags */ + ) : ( + // Octal literals are not allowed in strict mode or ES5 + // Note that theoretically the following condition would hold true literals like 009, + // which is not octal. But because of how the scanner separates the tokens, we would + // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. + // We also do not need to check for negatives because any prefix operator would be part of a + // parent unary expression. + kind === 8 ? factory.createNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) : kind === 10 ? factory.createStringLiteral( + scanner.getTokenValue(), + /*isSingleQuote*/ + void 0, + scanner.hasExtendedUnicodeEscape() + ) : ts6.isLiteralKind(kind) ? factory.createLiteralLikeNode(kind, scanner.getTokenValue()) : ts6.Debug.fail() + ); + if (scanner.hasExtendedUnicodeEscape()) { + node.hasExtendedUnicodeEscape = true; + } + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + nextToken(); + return finishNode(node, pos); + } + function parseEntityNameOfTypeReference() { + return parseEntityName( + /*allowReservedWords*/ + true, + ts6.Diagnostics.Type_expected + ); + } + function parseTypeArgumentsOfTypeReference() { + if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29) { + return parseBracketedList( + 20, + parseType, + 29, + 31 + /* SyntaxKind.GreaterThanToken */ + ); + } + } + function parseTypeReference() { + var pos = getNodePos(); + return finishNode(factory.createTypeReferenceNode(parseEntityNameOfTypeReference(), parseTypeArgumentsOfTypeReference()), pos); + } + function typeHasArrowFunctionBlockingParseError(node) { + switch (node.kind) { + case 180: + return ts6.nodeIsMissing(node.typeName); + case 181: + case 182: { + var _a2 = node, parameters = _a2.parameters, type = _a2.type; + return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); + } + case 193: + return typeHasArrowFunctionBlockingParseError(node.type); + default: + return false; + } + } + function parseThisTypePredicate(lhs) { + nextToken(); + return finishNode(factory.createTypePredicateNode( + /*assertsModifier*/ + void 0, + lhs, + parseType() + ), lhs.pos); + } + function parseThisTypeNode() { + var pos = getNodePos(); + nextToken(); + return finishNode(factory.createThisTypeNode(), pos); + } + function parseJSDocAllType() { + var pos = getNodePos(); + nextToken(); + return finishNode(factory.createJSDocAllType(), pos); + } + function parseJSDocNonNullableType() { + var pos = getNodePos(); + nextToken(); + return finishNode(factory.createJSDocNonNullableType( + parseNonArrayType(), + /*postfix*/ + false + ), pos); + } + function parseJSDocUnknownOrNullableType() { + var pos = getNodePos(); + nextToken(); + if (token() === 27 || token() === 19 || token() === 21 || token() === 31 || token() === 63 || token() === 51) { + return finishNode(factory.createJSDocUnknownType(), pos); + } else { + return finishNode(factory.createJSDocNullableType( + parseType(), + /*postfix*/ + false + ), pos); + } + } + function parseJSDocFunctionType() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + if (lookAhead(nextTokenIsOpenParen)) { + nextToken(); + var parameters = parseParameters( + 4 | 32 + /* SignatureFlags.JSDoc */ + ); + var type = parseReturnType( + 58, + /*isType*/ + false + ); + return withJSDoc(finishNode(factory.createJSDocFunctionType(parameters, type), pos), hasJSDoc); + } + return finishNode(factory.createTypeReferenceNode( + parseIdentifierName(), + /*typeArguments*/ + void 0 + ), pos); + } + function parseJSDocParameter() { + var pos = getNodePos(); + var name; + if (token() === 108 || token() === 103) { + name = parseIdentifierName(); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + } + return finishNode(factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + // TODO(rbuckton): JSDoc parameters don't have names (except `this`/`new`), should we manufacture an empty identifier? + name, + /*questionToken*/ + void 0, + parseJSDocType(), + /*initializer*/ + void 0 + ), pos); + } + function parseJSDocType() { + scanner.setInJSDocType(true); + var pos = getNodePos(); + if (parseOptional( + 142 + /* SyntaxKind.ModuleKeyword */ + )) { + var moduleTag = factory.createJSDocNamepathType( + /*type*/ + void 0 + ); + terminate: + while (true) { + switch (token()) { + case 19: + case 1: + case 27: + case 5: + break terminate; + default: + nextTokenJSDoc(); + } + } + scanner.setInJSDocType(false); + return finishNode(moduleTag, pos); + } + var hasDotDotDot = parseOptional( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + var type = parseTypeOrTypePredicate(); + scanner.setInJSDocType(false); + if (hasDotDotDot) { + type = finishNode(factory.createJSDocVariadicType(type), pos); + } + if (token() === 63) { + nextToken(); + return finishNode(factory.createJSDocOptionalType(type), pos); + } + return type; + } + function parseTypeQuery() { + var pos = getNodePos(); + parseExpected( + 112 + /* SyntaxKind.TypeOfKeyword */ + ); + var entityName = parseEntityName( + /*allowReservedWords*/ + true + ); + var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : void 0; + return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos); + } + function parseTypeParameter() { + var pos = getNodePos(); + var modifiers = parseModifiers(); + var name = parseIdentifier(); + var constraint; + var expression; + if (parseOptional( + 94 + /* SyntaxKind.ExtendsKeyword */ + )) { + if (isStartOfType() || !isStartOfExpression()) { + constraint = parseType(); + } else { + expression = parseUnaryExpressionOrHigher(); + } + } + var defaultType = parseOptional( + 63 + /* SyntaxKind.EqualsToken */ + ) ? parseType() : void 0; + var node = factory.createTypeParameterDeclaration(modifiers, name, constraint, defaultType); + node.expression = expression; + return finishNode(node, pos); + } + function parseTypeParameters() { + if (token() === 29) { + return parseBracketedList( + 19, + parseTypeParameter, + 29, + 31 + /* SyntaxKind.GreaterThanToken */ + ); + } + } + function isStartOfParameter(isJSDocParameter) { + return token() === 25 || isBindingIdentifierOrPrivateIdentifierOrPattern() || ts6.isModifierKind(token()) || token() === 59 || isStartOfType( + /*inStartOfParameter*/ + !isJSDocParameter + ); + } + function parseNameOfParameter(modifiers) { + var name = parseIdentifierOrPattern(ts6.Diagnostics.Private_identifiers_cannot_be_used_as_parameters); + if (ts6.getFullWidth(name) === 0 && !ts6.some(modifiers) && ts6.isModifierKind(token())) { + nextToken(); + } + return name; + } + function isParameterNameStart() { + return isBindingIdentifier() || token() === 22 || token() === 18; + } + function parseParameter(inOuterAwaitContext) { + return parseParameterWorker(inOuterAwaitContext); + } + function parseParameterForSpeculation(inOuterAwaitContext) { + return parseParameterWorker( + inOuterAwaitContext, + /*allowAmbiguity*/ + false + ); + } + function parseParameterWorker(inOuterAwaitContext, allowAmbiguity) { + if (allowAmbiguity === void 0) { + allowAmbiguity = true; + } + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators); + if (token() === 108) { + var node_1 = factory.createParameterDeclaration( + decorators, + /*dotDotDotToken*/ + void 0, + createIdentifier( + /*isIdentifier*/ + true + ), + /*questionToken*/ + void 0, + parseTypeAnnotation(), + /*initializer*/ + void 0 + ); + if (decorators) { + parseErrorAtRange(decorators[0], ts6.Diagnostics.Decorators_may_not_be_applied_to_this_parameters); + } + return withJSDoc(finishNode(node_1, pos), hasJSDoc); + } + var savedTopLevel = topLevel; + topLevel = false; + var modifiers = combineDecoratorsAndModifiers(decorators, parseModifiers()); + var dotDotDotToken = parseOptionalToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + if (!allowAmbiguity && !isParameterNameStart()) { + return void 0; + } + var node = withJSDoc(finishNode(factory.createParameterDeclaration(modifiers, dotDotDotToken, parseNameOfParameter(modifiers), parseOptionalToken( + 57 + /* SyntaxKind.QuestionToken */ + ), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc); + topLevel = savedTopLevel; + return node; + } + function parseReturnType(returnToken, isType) { + if (shouldParseReturnType(returnToken, isType)) { + return allowConditionalTypesAnd(parseTypeOrTypePredicate); + } + } + function shouldParseReturnType(returnToken, isType) { + if (returnToken === 38) { + parseExpected(returnToken); + return true; + } else if (parseOptional( + 58 + /* SyntaxKind.ColonToken */ + )) { + return true; + } else if (isType && token() === 38) { + parseErrorAtCurrentToken(ts6.Diagnostics._0_expected, ts6.tokenToString( + 58 + /* SyntaxKind.ColonToken */ + )); + nextToken(); + return true; + } + return false; + } + function parseParametersWorker(flags, allowAmbiguity) { + var savedYieldContext = inYieldContext(); + var savedAwaitContext = inAwaitContext(); + setYieldContext(!!(flags & 1)); + setAwaitContext(!!(flags & 2)); + var parameters = flags & 32 ? parseDelimitedList(17, parseJSDocParameter) : parseDelimitedList(16, function() { + return allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext); + }); + setYieldContext(savedYieldContext); + setAwaitContext(savedAwaitContext); + return parameters; + } + function parseParameters(flags) { + if (!parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + )) { + return createMissingList(); + } + var parameters = parseParametersWorker( + flags, + /*allowAmbiguity*/ + true + ); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + return parameters; + } + function parseTypeMemberSemicolon() { + if (parseOptional( + 27 + /* SyntaxKind.CommaToken */ + )) { + return; + } + parseSemicolon(); + } + function parseSignatureMember(kind) { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + if (kind === 177) { + parseExpected( + 103 + /* SyntaxKind.NewKeyword */ + ); + } + var typeParameters = parseTypeParameters(); + var parameters = parseParameters( + 4 + /* SignatureFlags.Type */ + ); + var type = parseReturnType( + 58, + /*isType*/ + true + ); + parseTypeMemberSemicolon(); + var node = kind === 176 ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function isIndexSignature() { + return token() === 22 && lookAhead(isUnambiguouslyIndexSignature); + } + function isUnambiguouslyIndexSignature() { + nextToken(); + if (token() === 25 || token() === 23) { + return true; + } + if (ts6.isModifierKind(token())) { + nextToken(); + if (isIdentifier3()) { + return true; + } + } else if (!isIdentifier3()) { + return false; + } else { + nextToken(); + } + if (token() === 58 || token() === 27) { + return true; + } + if (token() !== 57) { + return false; + } + nextToken(); + return token() === 58 || token() === 27 || token() === 23; + } + function parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers) { + var parameters = parseBracketedList( + 16, + function() { + return parseParameter( + /*inOuterAwaitContext*/ + false + ); + }, + 22, + 23 + /* SyntaxKind.CloseBracketToken */ + ); + var type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + var node = factory.createIndexSignature(modifiers, parameters, type); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { + var name = parsePropertyName(); + var questionToken = parseOptionalToken( + 57 + /* SyntaxKind.QuestionToken */ + ); + var node; + if (token() === 20 || token() === 29) { + var typeParameters = parseTypeParameters(); + var parameters = parseParameters( + 4 + /* SignatureFlags.Type */ + ); + var type = parseReturnType( + 58, + /*isType*/ + true + ); + node = factory.createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type); + } else { + var type = parseTypeAnnotation(); + node = factory.createPropertySignature(modifiers, name, questionToken, type); + if (token() === 63) + node.initializer = parseInitializer(); + } + parseTypeMemberSemicolon(); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function isTypeMemberStart() { + if (token() === 20 || token() === 29 || token() === 137 || token() === 151) { + return true; + } + var idToken = false; + while (ts6.isModifierKind(token())) { + idToken = true; + nextToken(); + } + if (token() === 22) { + return true; + } + if (isLiteralPropertyName()) { + idToken = true; + nextToken(); + } + if (idToken) { + return token() === 20 || token() === 29 || token() === 57 || token() === 58 || token() === 27 || canParseSemicolon(); + } + return false; + } + function parseTypeMember() { + if (token() === 20 || token() === 29) { + return parseSignatureMember( + 176 + /* SyntaxKind.CallSignature */ + ); + } + if (token() === 103 && lookAhead(nextTokenIsOpenParenOrLessThan)) { + return parseSignatureMember( + 177 + /* SyntaxKind.ConstructSignature */ + ); + } + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var modifiers = parseModifiers(); + if (parseContextualModifier( + 137 + /* SyntaxKind.GetKeyword */ + )) { + return parseAccessorDeclaration( + pos, + hasJSDoc, + /*decorators*/ + void 0, + modifiers, + 174, + 4 + /* SignatureFlags.Type */ + ); + } + if (parseContextualModifier( + 151 + /* SyntaxKind.SetKeyword */ + )) { + return parseAccessorDeclaration( + pos, + hasJSDoc, + /*decorators*/ + void 0, + modifiers, + 175, + 4 + /* SignatureFlags.Type */ + ); + } + if (isIndexSignature()) { + return parseIndexSignatureDeclaration( + pos, + hasJSDoc, + /*decorators*/ + void 0, + modifiers + ); + } + return parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers); + } + function nextTokenIsOpenParenOrLessThan() { + nextToken(); + return token() === 20 || token() === 29; + } + function nextTokenIsDot() { + return nextToken() === 24; + } + function nextTokenIsOpenParenOrLessThanOrDot() { + switch (nextToken()) { + case 20: + case 29: + case 24: + return true; + } + return false; + } + function parseTypeLiteral() { + var pos = getNodePos(); + return finishNode(factory.createTypeLiteralNode(parseObjectTypeMembers()), pos); + } + function parseObjectTypeMembers() { + var members; + if (parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + )) { + members = parseList(4, parseTypeMember); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } else { + members = createMissingList(); + } + return members; + } + function isStartOfMappedType() { + nextToken(); + if (token() === 39 || token() === 40) { + return nextToken() === 146; + } + if (token() === 146) { + nextToken(); + } + return token() === 22 && nextTokenIsIdentifier() && nextToken() === 101; + } + function parseMappedTypeParameter() { + var pos = getNodePos(); + var name = parseIdentifierName(); + parseExpected( + 101 + /* SyntaxKind.InKeyword */ + ); + var type = parseType(); + return finishNode(factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + name, + type, + /*defaultType*/ + void 0 + ), pos); + } + function parseMappedType() { + var pos = getNodePos(); + parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var readonlyToken; + if (token() === 146 || token() === 39 || token() === 40) { + readonlyToken = parseTokenNode(); + if (readonlyToken.kind !== 146) { + parseExpected( + 146 + /* SyntaxKind.ReadonlyKeyword */ + ); + } + } + parseExpected( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + var typeParameter = parseMappedTypeParameter(); + var nameType = parseOptional( + 128 + /* SyntaxKind.AsKeyword */ + ) ? parseType() : void 0; + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + var questionToken; + if (token() === 57 || token() === 39 || token() === 40) { + questionToken = parseTokenNode(); + if (questionToken.kind !== 57) { + parseExpected( + 57 + /* SyntaxKind.QuestionToken */ + ); + } + } + var type = parseTypeAnnotation(); + parseSemicolon(); + var members = parseList(4, parseTypeMember); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + return finishNode(factory.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos); + } + function parseTupleElementType() { + var pos = getNodePos(); + if (parseOptional( + 25 + /* SyntaxKind.DotDotDotToken */ + )) { + return finishNode(factory.createRestTypeNode(parseType()), pos); + } + var type = parseType(); + if (ts6.isJSDocNullableType(type) && type.pos === type.type.pos) { + var node = factory.createOptionalTypeNode(type.type); + ts6.setTextRange(node, type); + node.flags = type.flags; + return node; + } + return type; + } + function isNextTokenColonOrQuestionColon() { + return nextToken() === 58 || token() === 57 && nextToken() === 58; + } + function isTupleElementName() { + if (token() === 25) { + return ts6.tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon(); + } + return ts6.tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon(); + } + function parseTupleElementNameOrTupleElementType() { + if (lookAhead(isTupleElementName)) { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var dotDotDotToken = parseOptionalToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + var name = parseIdentifierName(); + var questionToken = parseOptionalToken( + 57 + /* SyntaxKind.QuestionToken */ + ); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var type = parseTupleElementType(); + var node = factory.createNamedTupleMember(dotDotDotToken, name, questionToken, type); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + return parseTupleElementType(); + } + function parseTupleType() { + var pos = getNodePos(); + return finishNode(factory.createTupleTypeNode(parseBracketedList( + 21, + parseTupleElementNameOrTupleElementType, + 22, + 23 + /* SyntaxKind.CloseBracketToken */ + )), pos); + } + function parseParenthesizedType() { + var pos = getNodePos(); + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var type = parseType(); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + return finishNode(factory.createParenthesizedType(type), pos); + } + function parseModifiersForConstructorType() { + var modifiers; + if (token() === 126) { + var pos = getNodePos(); + nextToken(); + var modifier = finishNode(factory.createToken( + 126 + /* SyntaxKind.AbstractKeyword */ + ), pos); + modifiers = createNodeArray([modifier], pos); + } + return modifiers; + } + function parseFunctionOrConstructorType() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var modifiers = parseModifiersForConstructorType(); + var isConstructorType = parseOptional( + 103 + /* SyntaxKind.NewKeyword */ + ); + var typeParameters = parseTypeParameters(); + var parameters = parseParameters( + 4 + /* SignatureFlags.Type */ + ); + var type = parseReturnType( + 38, + /*isType*/ + false + ); + var node = isConstructorType ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory.createFunctionTypeNode(typeParameters, parameters, type); + if (!isConstructorType) + node.modifiers = modifiers; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseKeywordAndNoDot() { + var node = parseTokenNode(); + return token() === 24 ? void 0 : node; + } + function parseLiteralTypeNode(negative) { + var pos = getNodePos(); + if (negative) { + nextToken(); + } + var expression = token() === 110 || token() === 95 || token() === 104 ? parseTokenNode() : parseLiteralLikeNode(token()); + if (negative) { + expression = finishNode(factory.createPrefixUnaryExpression(40, expression), pos); + } + return finishNode(factory.createLiteralTypeNode(expression), pos); + } + function isStartOfTypeOfImportType() { + nextToken(); + return token() === 100; + } + function parseImportTypeAssertions() { + var pos = getNodePos(); + var openBracePosition = scanner.getTokenPos(); + parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var multiLine = scanner.hasPrecedingLineBreak(); + parseExpected( + 130 + /* SyntaxKind.AssertKeyword */ + ); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var clause = parseAssertClause( + /*skipAssertKeyword*/ + true + ); + if (!parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + )) { + var lastError = ts6.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts6.Diagnostics._0_expected.code) { + ts6.addRelatedInfo(lastError, ts6.createDetachedDiagnostic(fileName, openBracePosition, 1, ts6.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")); + } + } + return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos); + } + function parseImportType() { + sourceFlags |= 2097152; + var pos = getNodePos(); + var isTypeOf = parseOptional( + 112 + /* SyntaxKind.TypeOfKeyword */ + ); + parseExpected( + 100 + /* SyntaxKind.ImportKeyword */ + ); + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var type = parseType(); + var assertions; + if (parseOptional( + 27 + /* SyntaxKind.CommaToken */ + )) { + assertions = parseImportTypeAssertions(); + } + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + var qualifier = parseOptional( + 24 + /* SyntaxKind.DotToken */ + ) ? parseEntityNameOfTypeReference() : void 0; + var typeArguments = parseTypeArgumentsOfTypeReference(); + return finishNode(factory.createImportTypeNode(type, assertions, qualifier, typeArguments, isTypeOf), pos); + } + function nextTokenIsNumericOrBigIntLiteral() { + nextToken(); + return token() === 8 || token() === 9; + } + function parseNonArrayType() { + switch (token()) { + case 131: + case 157: + case 152: + case 148: + case 160: + case 153: + case 134: + case 155: + case 144: + case 149: + return tryParse(parseKeywordAndNoDot) || parseTypeReference(); + case 66: + scanner.reScanAsteriskEqualsToken(); + case 41: + return parseJSDocAllType(); + case 60: + scanner.reScanQuestionToken(); + case 57: + return parseJSDocUnknownOrNullableType(); + case 98: + return parseJSDocFunctionType(); + case 53: + return parseJSDocNonNullableType(); + case 14: + case 10: + case 8: + case 9: + case 110: + case 95: + case 104: + return parseLiteralTypeNode(); + case 40: + return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode( + /*negative*/ + true + ) : parseTypeReference(); + case 114: + return parseTokenNode(); + case 108: { + var thisKeyword = parseThisTypeNode(); + if (token() === 140 && !scanner.hasPrecedingLineBreak()) { + return parseThisTypePredicate(thisKeyword); + } else { + return thisKeyword; + } + } + case 112: + return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); + case 18: + return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); + case 22: + return parseTupleType(); + case 20: + return parseParenthesizedType(); + case 100: + return parseImportType(); + case 129: + return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); + case 15: + return parseTemplateType(); + default: + return parseTypeReference(); + } + } + function isStartOfType(inStartOfParameter) { + switch (token()) { + case 131: + case 157: + case 152: + case 148: + case 160: + case 134: + case 146: + case 153: + case 156: + case 114: + case 155: + case 104: + case 108: + case 112: + case 144: + case 18: + case 22: + case 29: + case 51: + case 50: + case 103: + case 10: + case 8: + case 9: + case 110: + case 95: + case 149: + case 41: + case 57: + case 53: + case 25: + case 138: + case 100: + case 129: + case 14: + case 15: + return true; + case 98: + return !inStartOfParameter; + case 40: + return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral); + case 20: + return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); + default: + return isIdentifier3(); + } + } + function isStartOfParenthesizedOrFunctionType() { + nextToken(); + return token() === 21 || isStartOfParameter( + /*isJSDocParameter*/ + false + ) || isStartOfType(); + } + function parsePostfixTypeOrHigher() { + var pos = getNodePos(); + var type = parseNonArrayType(); + while (!scanner.hasPrecedingLineBreak()) { + switch (token()) { + case 53: + nextToken(); + type = finishNode(factory.createJSDocNonNullableType( + type, + /*postfix*/ + true + ), pos); + break; + case 57: + if (lookAhead(nextTokenIsStartOfType)) { + return type; + } + nextToken(); + type = finishNode(factory.createJSDocNullableType( + type, + /*postfix*/ + true + ), pos); + break; + case 22: + parseExpected( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + if (isStartOfType()) { + var indexType = parseType(); + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + type = finishNode(factory.createIndexedAccessTypeNode(type, indexType), pos); + } else { + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + type = finishNode(factory.createArrayTypeNode(type), pos); + } + break; + default: + return type; + } + } + return type; + } + function parseTypeOperator(operator) { + var pos = getNodePos(); + parseExpected(operator); + return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos); + } + function tryParseConstraintOfInferType() { + if (parseOptional( + 94 + /* SyntaxKind.ExtendsKeyword */ + )) { + var constraint = disallowConditionalTypesAnd(parseType); + if (inDisallowConditionalTypesContext() || token() !== 57) { + return constraint; + } + } + } + function parseTypeParameterOfInferType() { + var pos = getNodePos(); + var name = parseIdentifier(); + var constraint = tryParse(tryParseConstraintOfInferType); + var node = factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + name, + constraint + ); + return finishNode(node, pos); + } + function parseInferType() { + var pos = getNodePos(); + parseExpected( + 138 + /* SyntaxKind.InferKeyword */ + ); + return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); + } + function parseTypeOperatorOrHigher() { + var operator = token(); + switch (operator) { + case 141: + case 156: + case 146: + return parseTypeOperator(operator); + case 138: + return parseInferType(); + } + return allowConditionalTypesAnd(parsePostfixTypeOrHigher); + } + function parseFunctionOrConstructorTypeToError(isInUnionType) { + if (isStartOfFunctionTypeOrConstructorType()) { + var type = parseFunctionOrConstructorType(); + var diagnostic = void 0; + if (ts6.isFunctionTypeNode(type)) { + diagnostic = isInUnionType ? ts6.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_a_union_type : ts6.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type; + } else { + diagnostic = isInUnionType ? ts6.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type : ts6.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type; + } + parseErrorAtRange(type, diagnostic); + return type; + } + return void 0; + } + function parseUnionOrIntersectionType(operator, parseConstituentType, createTypeNode) { + var pos = getNodePos(); + var isUnionType = operator === 51; + var hasLeadingOperator = parseOptional(operator); + var type = hasLeadingOperator && parseFunctionOrConstructorTypeToError(isUnionType) || parseConstituentType(); + if (token() === operator || hasLeadingOperator) { + var types = [type]; + while (parseOptional(operator)) { + types.push(parseFunctionOrConstructorTypeToError(isUnionType) || parseConstituentType()); + } + type = finishNode(createTypeNode(createNodeArray(types, pos)), pos); + } + return type; + } + function parseIntersectionTypeOrHigher() { + return parseUnionOrIntersectionType(50, parseTypeOperatorOrHigher, factory.createIntersectionTypeNode); + } + function parseUnionTypeOrHigher() { + return parseUnionOrIntersectionType(51, parseIntersectionTypeOrHigher, factory.createUnionTypeNode); + } + function nextTokenIsNewKeyword() { + nextToken(); + return token() === 103; + } + function isStartOfFunctionTypeOrConstructorType() { + if (token() === 29) { + return true; + } + if (token() === 20 && lookAhead(isUnambiguouslyStartOfFunctionType)) { + return true; + } + return token() === 103 || token() === 126 && lookAhead(nextTokenIsNewKeyword); + } + function skipParameterStart() { + if (ts6.isModifierKind(token())) { + parseModifiers(); + } + if (isIdentifier3() || token() === 108) { + nextToken(); + return true; + } + if (token() === 22 || token() === 18) { + var previousErrorCount = parseDiagnostics.length; + parseIdentifierOrPattern(); + return previousErrorCount === parseDiagnostics.length; + } + return false; + } + function isUnambiguouslyStartOfFunctionType() { + nextToken(); + if (token() === 21 || token() === 25) { + return true; + } + if (skipParameterStart()) { + if (token() === 58 || token() === 27 || token() === 57 || token() === 63) { + return true; + } + if (token() === 21) { + nextToken(); + if (token() === 38) { + return true; + } + } + } + return false; + } + function parseTypeOrTypePredicate() { + var pos = getNodePos(); + var typePredicateVariable = isIdentifier3() && tryParse(parseTypePredicatePrefix); + var type = parseType(); + if (typePredicateVariable) { + return finishNode(factory.createTypePredicateNode( + /*assertsModifier*/ + void 0, + typePredicateVariable, + type + ), pos); + } else { + return type; + } + } + function parseTypePredicatePrefix() { + var id = parseIdentifier(); + if (token() === 140 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + return id; + } + } + function parseAssertsTypePredicate() { + var pos = getNodePos(); + var assertsModifier = parseExpectedToken( + 129 + /* SyntaxKind.AssertsKeyword */ + ); + var parameterName = token() === 108 ? parseThisTypeNode() : parseIdentifier(); + var type = parseOptional( + 140 + /* SyntaxKind.IsKeyword */ + ) ? parseType() : void 0; + return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); + } + function parseType() { + if (contextFlags & 40960) { + return doOutsideOfContext(40960, parseType); + } + if (isStartOfFunctionTypeOrConstructorType()) { + return parseFunctionOrConstructorType(); + } + var pos = getNodePos(); + var type = parseUnionTypeOrHigher(); + if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional( + 94 + /* SyntaxKind.ExtendsKeyword */ + )) { + var extendsType = disallowConditionalTypesAnd(parseType); + parseExpected( + 57 + /* SyntaxKind.QuestionToken */ + ); + var trueType = allowConditionalTypesAnd(parseType); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var falseType = allowConditionalTypesAnd(parseType); + return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos); + } + return type; + } + function parseTypeAnnotation() { + return parseOptional( + 58 + /* SyntaxKind.ColonToken */ + ) ? parseType() : void 0; + } + function isStartOfLeftHandSideExpression() { + switch (token()) { + case 108: + case 106: + case 104: + case 110: + case 95: + case 8: + case 9: + case 10: + case 14: + case 15: + case 20: + case 22: + case 18: + case 98: + case 84: + case 103: + case 43: + case 68: + case 79: + return true; + case 100: + return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); + default: + return isIdentifier3(); + } + } + function isStartOfExpression() { + if (isStartOfLeftHandSideExpression()) { + return true; + } + switch (token()) { + case 39: + case 40: + case 54: + case 53: + case 89: + case 112: + case 114: + case 45: + case 46: + case 29: + case 133: + case 125: + case 80: + return true; + default: + if (isBinaryOperator()) { + return true; + } + return isIdentifier3(); + } + } + function isStartOfExpressionStatement() { + return token() !== 18 && token() !== 98 && token() !== 84 && token() !== 59 && isStartOfExpression(); + } + function parseExpression() { + var saveDecoratorContext = inDecoratorContext(); + if (saveDecoratorContext) { + setDecoratorContext( + /*val*/ + false + ); + } + var pos = getNodePos(); + var expr = parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + var operatorToken; + while (operatorToken = parseOptionalToken( + 27 + /* SyntaxKind.CommaToken */ + )) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ), pos); + } + if (saveDecoratorContext) { + setDecoratorContext( + /*val*/ + true + ); + } + return expr; + } + function parseInitializer() { + return parseOptional( + 63 + /* SyntaxKind.EqualsToken */ + ) ? parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ) : void 0; + } + function parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction) { + if (isYieldExpression()) { + return parseYieldExpression(); + } + var arrowExpression = tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction); + if (arrowExpression) { + return arrowExpression; + } + var pos = getNodePos(); + var expr = parseBinaryExpressionOrHigher( + 0 + /* OperatorPrecedence.Lowest */ + ); + if (expr.kind === 79 && token() === 38) { + return parseSimpleArrowFunctionExpression( + pos, + expr, + allowReturnTypeInArrowFunction, + /*asyncModifier*/ + void 0 + ); + } + if (ts6.isLeftHandSideExpression(expr) && ts6.isAssignmentOperator(reScanGreaterToken())) { + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos); + } + return parseConditionalExpressionRest(expr, pos, allowReturnTypeInArrowFunction); + } + function isYieldExpression() { + if (token() === 125) { + if (inYieldContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine); + } + return false; + } + function nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier3(); + } + function parseYieldExpression() { + var pos = getNodePos(); + nextToken(); + if (!scanner.hasPrecedingLineBreak() && (token() === 41 || isStartOfExpression())) { + return finishNode(factory.createYieldExpression(parseOptionalToken( + 41 + /* SyntaxKind.AsteriskToken */ + ), parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + )), pos); + } else { + return finishNode(factory.createYieldExpression( + /*asteriskToken*/ + void 0, + /*expression*/ + void 0 + ), pos); + } + } + function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) { + ts6.Debug.assert(token() === 38, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var parameter = factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + identifier, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ); + finishNode(parameter, identifier.pos); + var parameters = createNodeArray([parameter], parameter.pos, parameter.end); + var equalsGreaterThanToken = parseExpectedToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ); + var body = parseArrowFunctionExpressionBody( + /*isAsync*/ + !!asyncModifier, + allowReturnTypeInArrowFunction + ); + var node = factory.createArrowFunction( + asyncModifier, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + equalsGreaterThanToken, + body + ); + return addJSDocComment(finishNode(node, pos)); + } + function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) { + var triState = isParenthesizedArrowFunctionExpression(); + if (triState === 0) { + return void 0; + } + return triState === 1 ? parseParenthesizedArrowFunctionExpression( + /*allowAmbiguity*/ + true, + /*allowReturnTypeInArrowFunction*/ + true + ) : tryParse(function() { + return parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction); + }); + } + function isParenthesizedArrowFunctionExpression() { + if (token() === 20 || token() === 29 || token() === 132) { + return lookAhead(isParenthesizedArrowFunctionExpressionWorker); + } + if (token() === 38) { + return 1; + } + return 0; + } + function isParenthesizedArrowFunctionExpressionWorker() { + if (token() === 132) { + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return 0; + } + if (token() !== 20 && token() !== 29) { + return 0; + } + } + var first = token(); + var second = nextToken(); + if (first === 20) { + if (second === 21) { + var third = nextToken(); + switch (third) { + case 38: + case 58: + case 18: + return 1; + default: + return 0; + } + } + if (second === 22 || second === 18) { + return 2; + } + if (second === 25) { + return 1; + } + if (ts6.isModifierKind(second) && second !== 132 && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128) { + return 0; + } + return 1; + } + if (!isIdentifier3() && second !== 108) { + return 0; + } + switch (nextToken()) { + case 58: + return 1; + case 57: + nextToken(); + if (token() === 58 || token() === 27 || token() === 63 || token() === 21) { + return 1; + } + return 0; + case 27: + case 63: + case 21: + return 2; + } + return 0; + } else { + ts6.Debug.assert( + first === 29 + /* SyntaxKind.LessThanToken */ + ); + if (!isIdentifier3()) { + return 0; + } + if (languageVariant === 1) { + var isArrowFunctionInJsx = lookAhead(function() { + var third2 = nextToken(); + if (third2 === 94) { + var fourth = nextToken(); + switch (fourth) { + case 63: + case 31: + return false; + default: + return true; + } + } else if (third2 === 27 || third2 === 63) { + return true; + } + return false; + }); + if (isArrowFunctionInJsx) { + return 1; + } + return 0; + } + return 2; + } + } + function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) { + var tokenPos = scanner.getTokenPos(); + if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) { + return void 0; + } + var result = parseParenthesizedArrowFunctionExpression( + /*allowAmbiguity*/ + false, + allowReturnTypeInArrowFunction + ); + if (!result) { + (notParenthesizedArrow || (notParenthesizedArrow = new ts6.Set())).add(tokenPos); + } + return result; + } + function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { + if (token() === 132) { + if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) { + var pos = getNodePos(); + var asyncModifier = parseModifiersForArrowFunction(); + var expr = parseBinaryExpressionOrHigher( + 0 + /* OperatorPrecedence.Lowest */ + ); + return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier); + } + } + return void 0; + } + function isUnParenthesizedAsyncArrowFunctionWorker() { + if (token() === 132) { + nextToken(); + if (scanner.hasPrecedingLineBreak() || token() === 38) { + return 0; + } + var expr = parseBinaryExpressionOrHigher( + 0 + /* OperatorPrecedence.Lowest */ + ); + if (!scanner.hasPrecedingLineBreak() && expr.kind === 79 && token() === 38) { + return 1; + } + } + return 0; + } + function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var modifiers = parseModifiersForArrowFunction(); + var isAsync = ts6.some(modifiers, ts6.isAsyncModifier) ? 2 : 0; + var typeParameters = parseTypeParameters(); + var parameters; + if (!parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + )) { + if (!allowAmbiguity) { + return void 0; + } + parameters = createMissingList(); + } else { + if (!allowAmbiguity) { + var maybeParameters = parseParametersWorker(isAsync, allowAmbiguity); + if (!maybeParameters) { + return void 0; + } + parameters = maybeParameters; + } else { + parameters = parseParametersWorker(isAsync, allowAmbiguity); + } + if (!parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ) && !allowAmbiguity) { + return void 0; + } + } + var hasReturnColon = token() === 58; + var type = parseReturnType( + 58, + /*isType*/ + false + ); + if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) { + return void 0; + } + var unwrappedType = type; + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193) { + unwrappedType = unwrappedType.type; + } + var hasJSDocFunctionType = unwrappedType && ts6.isJSDocFunctionType(unwrappedType); + if (!allowAmbiguity && token() !== 38 && (hasJSDocFunctionType || token() !== 18)) { + return void 0; + } + var lastToken = token(); + var equalsGreaterThanToken = parseExpectedToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ); + var body = lastToken === 38 || lastToken === 18 ? parseArrowFunctionExpressionBody(ts6.some(modifiers, ts6.isAsyncModifier), allowReturnTypeInArrowFunction) : parseIdentifier(); + if (!allowReturnTypeInArrowFunction && hasReturnColon) { + if (token() !== 58) { + return void 0; + } + } + var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseArrowFunctionExpressionBody(isAsync, allowReturnTypeInArrowFunction) { + if (token() === 18) { + return parseFunctionBlock( + isAsync ? 2 : 0 + /* SignatureFlags.None */ + ); + } + if (token() !== 26 && token() !== 98 && token() !== 84 && isStartOfStatement() && !isStartOfExpressionStatement()) { + return parseFunctionBlock(16 | (isAsync ? 2 : 0)); + } + var savedTopLevel = topLevel; + topLevel = false; + var node = isAsync ? doInAwaitContext(function() { + return parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction); + }) : doOutsideOfAwaitContext(function() { + return parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction); + }); + topLevel = savedTopLevel; + return node; + } + function parseConditionalExpressionRest(leftOperand, pos, allowReturnTypeInArrowFunction) { + var questionToken = parseOptionalToken( + 57 + /* SyntaxKind.QuestionToken */ + ); + if (!questionToken) { + return leftOperand; + } + var colonToken; + return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function() { + return parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + false + ); + }), colonToken = parseExpectedToken( + 58 + /* SyntaxKind.ColonToken */ + ), ts6.nodeIsPresent(colonToken) ? parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction) : createMissingNode( + 79, + /*reportAtCurrentPosition*/ + false, + ts6.Diagnostics._0_expected, + ts6.tokenToString( + 58 + /* SyntaxKind.ColonToken */ + ) + )), pos); + } + function parseBinaryExpressionOrHigher(precedence) { + var pos = getNodePos(); + var leftOperand = parseUnaryExpressionOrHigher(); + return parseBinaryExpressionRest(precedence, leftOperand, pos); + } + function isInOrOfKeyword(t) { + return t === 101 || t === 162; + } + function parseBinaryExpressionRest(precedence, leftOperand, pos) { + while (true) { + reScanGreaterToken(); + var newPrecedence = ts6.getBinaryOperatorPrecedence(token()); + var consumeCurrentOperator = token() === 42 ? newPrecedence >= precedence : newPrecedence > precedence; + if (!consumeCurrentOperator) { + break; + } + if (token() === 101 && inDisallowInContext()) { + break; + } + if (token() === 128 || token() === 150) { + if (scanner.hasPrecedingLineBreak()) { + break; + } else { + var keywordKind = token(); + nextToken(); + leftOperand = keywordKind === 150 ? makeSatisfiesExpression(leftOperand, parseType()) : makeAsExpression(leftOperand, parseType()); + } + } else { + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence), pos); + } + } + return leftOperand; + } + function isBinaryOperator() { + if (inDisallowInContext() && token() === 101) { + return false; + } + return ts6.getBinaryOperatorPrecedence(token()) > 0; + } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } + function makeBinaryExpression(left, operatorToken, right, pos) { + return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); + } + function makeAsExpression(left, right) { + return finishNode(factory.createAsExpression(left, right), left.pos); + } + function parsePrefixUnaryExpression() { + var pos = getNodePos(); + return finishNode(factory.createPrefixUnaryExpression(token(), nextTokenAnd(parseSimpleUnaryExpression)), pos); + } + function parseDeleteExpression() { + var pos = getNodePos(); + return finishNode(factory.createDeleteExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); + } + function parseTypeOfExpression() { + var pos = getNodePos(); + return finishNode(factory.createTypeOfExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); + } + function parseVoidExpression() { + var pos = getNodePos(); + return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); + } + function isAwaitExpression2() { + if (token() === 133) { + if (inAwaitContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine); + } + return false; + } + function parseAwaitExpression() { + var pos = getNodePos(); + return finishNode(factory.createAwaitExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); + } + function parseUnaryExpressionOrHigher() { + if (isUpdateExpression()) { + var pos = getNodePos(); + var updateExpression = parseUpdateExpression(); + return token() === 42 ? parseBinaryExpressionRest(ts6.getBinaryOperatorPrecedence(token()), updateExpression, pos) : updateExpression; + } + var unaryOperator = token(); + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token() === 42) { + var pos = ts6.skipTrivia(sourceText, simpleUnaryExpression.pos); + var end = simpleUnaryExpression.end; + if (simpleUnaryExpression.kind === 213) { + parseErrorAt(pos, end, ts6.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); + } else { + parseErrorAt(pos, end, ts6.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts6.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + function parseSimpleUnaryExpression() { + switch (token()) { + case 39: + case 40: + case 54: + case 53: + return parsePrefixUnaryExpression(); + case 89: + return parseDeleteExpression(); + case 112: + return parseTypeOfExpression(); + case 114: + return parseVoidExpression(); + case 29: + return parseTypeAssertion(); + case 133: + if (isAwaitExpression2()) { + return parseAwaitExpression(); + } + default: + return parseUpdateExpression(); + } + } + function isUpdateExpression() { + switch (token()) { + case 39: + case 40: + case 54: + case 53: + case 89: + case 112: + case 114: + case 133: + return false; + case 29: + if (languageVariant !== 1) { + return false; + } + default: + return true; + } + } + function parseUpdateExpression() { + if (token() === 45 || token() === 46) { + var pos = getNodePos(); + return finishNode(factory.createPrefixUnaryExpression(token(), nextTokenAnd(parseLeftHandSideExpressionOrHigher)), pos); + } else if (languageVariant === 1 && token() === 29 && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { + return parseJsxElementOrSelfClosingElementOrFragment( + /*inExpressionContext*/ + true + ); + } + var expression = parseLeftHandSideExpressionOrHigher(); + ts6.Debug.assert(ts6.isLeftHandSideExpression(expression)); + if ((token() === 45 || token() === 46) && !scanner.hasPrecedingLineBreak()) { + var operator = token(); + nextToken(); + return finishNode(factory.createPostfixUnaryExpression(expression, operator), expression.pos); + } + return expression; + } + function parseLeftHandSideExpressionOrHigher() { + var pos = getNodePos(); + var expression; + if (token() === 100) { + if (lookAhead(nextTokenIsOpenParenOrLessThan)) { + sourceFlags |= 2097152; + expression = parseTokenNode(); + } else if (lookAhead(nextTokenIsDot)) { + nextToken(); + nextToken(); + expression = finishNode(factory.createMetaProperty(100, parseIdentifierName()), pos); + sourceFlags |= 4194304; + } else { + expression = parseMemberExpressionOrHigher(); + } + } else { + expression = token() === 106 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + } + return parseCallExpressionRest(pos, expression); + } + function parseMemberExpressionOrHigher() { + var pos = getNodePos(); + var expression = parsePrimaryExpression(); + return parseMemberExpressionRest( + pos, + expression, + /*allowOptionalChain*/ + true + ); + } + function parseSuperExpression() { + var pos = getNodePos(); + var expression = parseTokenNode(); + if (token() === 29) { + var startPos = getNodePos(); + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (typeArguments !== void 0) { + parseErrorAt(startPos, getNodePos(), ts6.Diagnostics.super_may_not_use_type_arguments); + if (!isTemplateStartOfTaggedTemplate()) { + expression = factory.createExpressionWithTypeArguments(expression, typeArguments); + } + } + } + if (token() === 20 || token() === 24 || token() === 22) { + return expression; + } + parseExpectedToken(24, ts6.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + return finishNode(factory.createPropertyAccessExpression(expression, parseRightSideOfDot( + /*allowIdentifierNames*/ + true, + /*allowPrivateIdentifiers*/ + true + )), pos); + } + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) { + var pos = getNodePos(); + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); + var result; + if (opening.kind === 283) { + var children = parseJsxChildren(opening); + var closingElement = void 0; + var lastChild = children[children.length - 1]; + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { + var end = lastChild.children.end; + var newLast = finishNode(factory.createJsxElement(lastChild.openingElement, lastChild.children, finishNode(factory.createJsxClosingElement(finishNode(factory.createIdentifier(""), end, end)), end, end)), lastChild.openingElement.pos, end); + children = createNodeArray(__spreadArray(__spreadArray([], children.slice(0, children.length - 1), true), [newLast], false), children.pos, end); + closingElement = lastChild.closingElement; + } else { + closingElement = parseJsxClosingElement(opening, inExpressionContext); + if (!tagNamesAreEquivalent(opening.tagName, closingElement.tagName)) { + if (openingTag && ts6.isJsxOpeningElement(openingTag) && tagNamesAreEquivalent(closingElement.tagName, openingTag.tagName)) { + parseErrorAtRange(opening.tagName, ts6.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts6.getTextOfNodeFromSourceText(sourceText, opening.tagName)); + } else { + parseErrorAtRange(closingElement.tagName, ts6.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts6.getTextOfNodeFromSourceText(sourceText, opening.tagName)); + } + } + } + result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); + } else if (opening.kind === 286) { + result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); + } else { + ts6.Debug.assert( + opening.kind === 282 + /* SyntaxKind.JsxSelfClosingElement */ + ); + result = opening; + } + if (inExpressionContext && token() === 29) { + var topBadPos_1 = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition; + var invalidElement = tryParse(function() { + return parseJsxElementOrSelfClosingElementOrFragment( + /*inExpressionContext*/ + true, + topBadPos_1 + ); + }); + if (invalidElement) { + var operatorToken = createMissingNode( + 27, + /*reportAtCurrentPosition*/ + false + ); + ts6.setTextRangePosWidth(operatorToken, invalidElement.pos, 0); + parseErrorAt(ts6.skipTrivia(sourceText, topBadPos_1), invalidElement.end, ts6.Diagnostics.JSX_expressions_must_have_one_parent_element); + return finishNode(factory.createBinaryExpression(result, operatorToken, invalidElement), pos); + } + } + return result; + } + function parseJsxText() { + var pos = getNodePos(); + var node = factory.createJsxText( + scanner.getTokenValue(), + currentToken === 12 + /* SyntaxKind.JsxTextAllWhiteSpaces */ + ); + currentToken = scanner.scanJsxToken(); + return finishNode(node, pos); + } + function parseJsxChild(openingTag, token2) { + switch (token2) { + case 1: + if (ts6.isJsxOpeningFragment(openingTag)) { + parseErrorAtRange(openingTag, ts6.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } else { + var tag = openingTag.tagName; + var start = ts6.skipTrivia(sourceText, tag.pos); + parseErrorAt(start, tag.end, ts6.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts6.getTextOfNodeFromSourceText(sourceText, openingTag.tagName)); + } + return void 0; + case 30: + case 7: + return void 0; + case 11: + case 12: + return parseJsxText(); + case 18: + return parseJsxExpression( + /*inExpressionContext*/ + false + ); + case 29: + return parseJsxElementOrSelfClosingElementOrFragment( + /*inExpressionContext*/ + false, + /*topInvalidNodePosition*/ + void 0, + openingTag + ); + default: + return ts6.Debug.assertNever(token2); + } + } + function parseJsxChildren(openingTag) { + var list = []; + var listPos = getNodePos(); + var saveParsingContext = parsingContext; + parsingContext |= 1 << 14; + while (true) { + var child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken()); + if (!child) + break; + list.push(child); + if (ts6.isJsxOpeningElement(openingTag) && (child === null || child === void 0 ? void 0 : child.kind) === 281 && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { + break; + } + } + parsingContext = saveParsingContext; + return createNodeArray(list, listPos); + } + function parseJsxAttributes() { + var pos = getNodePos(); + return finishNode(factory.createJsxAttributes(parseList(13, parseJsxAttribute)), pos); + } + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { + var pos = getNodePos(); + parseExpected( + 29 + /* SyntaxKind.LessThanToken */ + ); + if (token() === 31) { + scanJsxText(); + return finishNode(factory.createJsxOpeningFragment(), pos); + } + var tagName = parseJsxElementName(); + var typeArguments = (contextFlags & 262144) === 0 ? tryParseTypeArguments() : void 0; + var attributes = parseJsxAttributes(); + var node; + if (token() === 31) { + scanJsxText(); + node = factory.createJsxOpeningElement(tagName, typeArguments, attributes); + } else { + parseExpected( + 43 + /* SyntaxKind.SlashToken */ + ); + if (parseExpected( + 31, + /*diagnostic*/ + void 0, + /*shouldAdvance*/ + false + )) { + if (inExpressionContext) { + nextToken(); + } else { + scanJsxText(); + } + } + node = factory.createJsxSelfClosingElement(tagName, typeArguments, attributes); + } + return finishNode(node, pos); + } + function parseJsxElementName() { + var pos = getNodePos(); + scanJsxIdentifier(); + var expression = token() === 108 ? parseTokenNode() : parseIdentifierName(); + while (parseOptional( + 24 + /* SyntaxKind.DotToken */ + )) { + expression = finishNode(factory.createPropertyAccessExpression(expression, parseRightSideOfDot( + /*allowIdentifierNames*/ + true, + /*allowPrivateIdentifiers*/ + false + )), pos); + } + return expression; + } + function parseJsxExpression(inExpressionContext) { + var pos = getNodePos(); + if (!parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + )) { + return void 0; + } + var dotDotDotToken; + var expression; + if (token() !== 19) { + dotDotDotToken = parseOptionalToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + expression = parseExpression(); + } + if (inExpressionContext) { + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } else { + if (parseExpected( + 19, + /*message*/ + void 0, + /*shouldAdvance*/ + false + )) { + scanJsxText(); + } + } + return finishNode(factory.createJsxExpression(dotDotDotToken, expression), pos); + } + function parseJsxAttribute() { + if (token() === 18) { + return parseJsxSpreadAttribute(); + } + scanJsxIdentifier(); + var pos = getNodePos(); + return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos); + } + function parseJsxAttributeValue() { + if (token() === 63) { + if (scanJsxAttributeValue() === 10) { + return parseLiteralNode(); + } + if (token() === 18) { + return parseJsxExpression( + /*inExpressionContext*/ + true + ); + } + if (token() === 29) { + return parseJsxElementOrSelfClosingElementOrFragment( + /*inExpressionContext*/ + true + ); + } + parseErrorAtCurrentToken(ts6.Diagnostics.or_JSX_element_expected); + } + return void 0; + } + function parseJsxSpreadAttribute() { + var pos = getNodePos(); + parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + parseExpected( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + var expression = parseExpression(); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + return finishNode(factory.createJsxSpreadAttribute(expression), pos); + } + function parseJsxClosingElement(open, inExpressionContext) { + var pos = getNodePos(); + parseExpected( + 30 + /* SyntaxKind.LessThanSlashToken */ + ); + var tagName = parseJsxElementName(); + if (parseExpected( + 31, + /*diagnostic*/ + void 0, + /*shouldAdvance*/ + false + )) { + if (inExpressionContext || !tagNamesAreEquivalent(open.tagName, tagName)) { + nextToken(); + } else { + scanJsxText(); + } + } + return finishNode(factory.createJsxClosingElement(tagName), pos); + } + function parseJsxClosingFragment(inExpressionContext) { + var pos = getNodePos(); + parseExpected( + 30 + /* SyntaxKind.LessThanSlashToken */ + ); + if (ts6.tokenIsIdentifierOrKeyword(token())) { + parseErrorAtRange(parseJsxElementName(), ts6.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (parseExpected( + 31, + /*diagnostic*/ + void 0, + /*shouldAdvance*/ + false + )) { + if (inExpressionContext) { + nextToken(); + } else { + scanJsxText(); + } + } + return finishNode(factory.createJsxJsxClosingFragment(), pos); + } + function parseTypeAssertion() { + var pos = getNodePos(); + parseExpected( + 29 + /* SyntaxKind.LessThanToken */ + ); + var type = parseType(); + parseExpected( + 31 + /* SyntaxKind.GreaterThanToken */ + ); + var expression = parseSimpleUnaryExpression(); + return finishNode(factory.createTypeAssertion(type, expression), pos); + } + function nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate() { + nextToken(); + return ts6.tokenIsIdentifierOrKeyword(token()) || token() === 22 || isTemplateStartOfTaggedTemplate(); + } + function isStartOfOptionalPropertyOrElementAccessChain() { + return token() === 28 && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate); + } + function tryReparseOptionalChain(node) { + if (node.flags & 32) { + return true; + } + if (ts6.isNonNullExpression(node)) { + var expr = node.expression; + while (ts6.isNonNullExpression(expr) && !(expr.flags & 32)) { + expr = expr.expression; + } + if (expr.flags & 32) { + while (ts6.isNonNullExpression(node)) { + node.flags |= 32; + node = node.expression; + } + return true; + } + } + return false; + } + function parsePropertyAccessExpressionRest(pos, expression, questionDotToken) { + var name = parseRightSideOfDot( + /*allowIdentifierNames*/ + true, + /*allowPrivateIdentifiers*/ + true + ); + var isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression); + var propertyAccess = isOptionalChain2 ? factory.createPropertyAccessChain(expression, questionDotToken, name) : factory.createPropertyAccessExpression(expression, name); + if (isOptionalChain2 && ts6.isPrivateIdentifier(propertyAccess.name)) { + parseErrorAtRange(propertyAccess.name, ts6.Diagnostics.An_optional_chain_cannot_contain_private_identifiers); + } + if (ts6.isExpressionWithTypeArguments(expression) && expression.typeArguments) { + var pos_2 = expression.typeArguments.pos - 1; + var end = ts6.skipTrivia(sourceText, expression.typeArguments.end) + 1; + parseErrorAt(pos_2, end, ts6.Diagnostics.An_instantiation_expression_cannot_be_followed_by_a_property_access); + } + return finishNode(propertyAccess, pos); + } + function parseElementAccessExpressionRest(pos, expression, questionDotToken) { + var argumentExpression; + if (token() === 23) { + argumentExpression = createMissingNode( + 79, + /*reportAtCurrentPosition*/ + true, + ts6.Diagnostics.An_element_access_expression_should_take_an_argument + ); + } else { + var argument = allowInAnd(parseExpression); + if (ts6.isStringOrNumericLiteralLike(argument)) { + argument.text = internIdentifier(argument.text); + } + argumentExpression = argument; + } + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + var indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factory.createElementAccessChain(expression, questionDotToken, argumentExpression) : factory.createElementAccessExpression(expression, argumentExpression); + return finishNode(indexedAccess, pos); + } + function parseMemberExpressionRest(pos, expression, allowOptionalChain) { + while (true) { + var questionDotToken = void 0; + var isPropertyAccess = false; + if (allowOptionalChain && isStartOfOptionalPropertyOrElementAccessChain()) { + questionDotToken = parseExpectedToken( + 28 + /* SyntaxKind.QuestionDotToken */ + ); + isPropertyAccess = ts6.tokenIsIdentifierOrKeyword(token()); + } else { + isPropertyAccess = parseOptional( + 24 + /* SyntaxKind.DotToken */ + ); + } + if (isPropertyAccess) { + expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken); + continue; + } + if ((questionDotToken || !inDecoratorContext()) && parseOptional( + 22 + /* SyntaxKind.OpenBracketToken */ + )) { + expression = parseElementAccessExpressionRest(pos, expression, questionDotToken); + continue; + } + if (isTemplateStartOfTaggedTemplate()) { + expression = !questionDotToken && expression.kind === 230 ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest( + pos, + expression, + questionDotToken, + /*typeArguments*/ + void 0 + ); + continue; + } + if (!questionDotToken) { + if (token() === 53 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + expression = finishNode(factory.createNonNullExpression(expression), pos); + continue; + } + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (typeArguments) { + expression = finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos); + continue; + } + } + return expression; + } + } + function isTemplateStartOfTaggedTemplate() { + return token() === 14 || token() === 15; + } + function parseTaggedTemplateRest(pos, tag, questionDotToken, typeArguments) { + var tagExpression = factory.createTaggedTemplateExpression(tag, typeArguments, token() === 14 ? (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) : parseTemplateExpression( + /*isTaggedTemplate*/ + true + )); + if (questionDotToken || tag.flags & 32) { + tagExpression.flags |= 32; + } + tagExpression.questionDotToken = questionDotToken; + return finishNode(tagExpression, pos); + } + function parseCallExpressionRest(pos, expression) { + while (true) { + expression = parseMemberExpressionRest( + pos, + expression, + /*allowOptionalChain*/ + true + ); + var typeArguments = void 0; + var questionDotToken = parseOptionalToken( + 28 + /* SyntaxKind.QuestionDotToken */ + ); + if (questionDotToken) { + typeArguments = tryParse(parseTypeArgumentsInExpression); + if (isTemplateStartOfTaggedTemplate()) { + expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments); + continue; + } + } + if (typeArguments || token() === 20) { + if (!questionDotToken && expression.kind === 230) { + typeArguments = expression.typeArguments; + expression = expression.expression; + } + var argumentList = parseArgumentList(); + var callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) : factory.createCallExpression(expression, typeArguments, argumentList); + expression = finishNode(callExpr, pos); + continue; + } + if (questionDotToken) { + var name = createMissingNode( + 79, + /*reportAtCurrentPosition*/ + false, + ts6.Diagnostics.Identifier_expected + ); + expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos); + } + break; + } + return expression; + } + function parseArgumentList() { + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var result = parseDelimitedList(11, parseArgumentExpression); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + return result; + } + function parseTypeArgumentsInExpression() { + if ((contextFlags & 262144) !== 0) { + return void 0; + } + if (reScanLessThanToken() !== 29) { + return void 0; + } + nextToken(); + var typeArguments = parseDelimitedList(20, parseType); + if (reScanGreaterToken() !== 31) { + return void 0; + } + nextToken(); + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : void 0; + } + function canFollowTypeArgumentsInExpression() { + switch (token()) { + case 20: + case 14: + case 15: + return true; + case 29: + case 31: + case 39: + case 40: + return false; + } + return scanner.hasPrecedingLineBreak() || isBinaryOperator() || !isStartOfExpression(); + } + function parsePrimaryExpression() { + switch (token()) { + case 8: + case 9: + case 10: + case 14: + return parseLiteralNode(); + case 108: + case 106: + case 104: + case 110: + case 95: + return parseTokenNode(); + case 20: + return parseParenthesizedExpression(); + case 22: + return parseArrayLiteralExpression(); + case 18: + return parseObjectLiteralExpression(); + case 132: + if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { + break; + } + return parseFunctionExpression(); + case 84: + return parseClassExpression(); + case 98: + return parseFunctionExpression(); + case 103: + return parseNewExpressionOrNewDotTarget(); + case 43: + case 68: + if (reScanSlashToken() === 13) { + return parseLiteralNode(); + } + break; + case 15: + return parseTemplateExpression( + /* isTaggedTemplate */ + false + ); + case 80: + return parsePrivateIdentifier(); + } + return parseIdentifier(ts6.Diagnostics.Expression_expected); + } + function parseParenthesizedExpression() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + return withJSDoc(finishNode(factory.createParenthesizedExpression(expression), pos), hasJSDoc); + } + function parseSpreadElement() { + var pos = getNodePos(); + parseExpected( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + var expression = parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + return finishNode(factory.createSpreadElement(expression), pos); + } + function parseArgumentOrArrayLiteralElement() { + return token() === 25 ? parseSpreadElement() : token() === 27 ? finishNode(factory.createOmittedExpression(), getNodePos()) : parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + } + function parseArgumentExpression() { + return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); + } + function parseArrayLiteralExpression() { + var pos = getNodePos(); + var openBracketPosition = scanner.getTokenPos(); + var openBracketParsed = parseExpected( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + var multiLine = scanner.hasPrecedingLineBreak(); + var elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); + parseExpectedMatchingBrackets(22, 23, openBracketParsed, openBracketPosition); + return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); + } + function parseObjectLiteralElement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + if (parseOptionalToken( + 25 + /* SyntaxKind.DotDotDotToken */ + )) { + var expression = parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc); + } + var decorators = parseDecorators(); + var modifiers = parseModifiers(); + if (parseContextualModifier( + 137 + /* SyntaxKind.GetKeyword */ + )) { + return parseAccessorDeclaration( + pos, + hasJSDoc, + decorators, + modifiers, + 174, + 0 + /* SignatureFlags.None */ + ); + } + if (parseContextualModifier( + 151 + /* SyntaxKind.SetKeyword */ + )) { + return parseAccessorDeclaration( + pos, + hasJSDoc, + decorators, + modifiers, + 175, + 0 + /* SignatureFlags.None */ + ); + } + var asteriskToken = parseOptionalToken( + 41 + /* SyntaxKind.AsteriskToken */ + ); + var tokenIsIdentifier = isIdentifier3(); + var name = parsePropertyName(); + var questionToken = parseOptionalToken( + 57 + /* SyntaxKind.QuestionToken */ + ); + var exclamationToken = parseOptionalToken( + 53 + /* SyntaxKind.ExclamationToken */ + ); + if (asteriskToken || token() === 20 || token() === 29) { + return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, exclamationToken); + } + var node; + var isShorthandPropertyAssignment2 = tokenIsIdentifier && token() !== 58; + if (isShorthandPropertyAssignment2) { + var equalsToken = parseOptionalToken( + 63 + /* SyntaxKind.EqualsToken */ + ); + var objectAssignmentInitializer = equalsToken ? allowInAnd(function() { + return parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + }) : void 0; + node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer); + node.equalsToken = equalsToken; + } else { + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var initializer = allowInAnd(function() { + return parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + }); + node = factory.createPropertyAssignment(name, initializer); + } + node.illegalDecorators = decorators; + node.modifiers = modifiers; + node.questionToken = questionToken; + node.exclamationToken = exclamationToken; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseObjectLiteralExpression() { + var pos = getNodePos(); + var openBracePosition = scanner.getTokenPos(); + var openBraceParsed = parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var multiLine = scanner.hasPrecedingLineBreak(); + var properties = parseDelimitedList( + 12, + parseObjectLiteralElement, + /*considerSemicolonAsDelimiter*/ + true + ); + parseExpectedMatchingBrackets(18, 19, openBraceParsed, openBracePosition); + return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); + } + function parseFunctionExpression() { + var savedDecoratorContext = inDecoratorContext(); + setDecoratorContext( + /*val*/ + false + ); + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var modifiers = parseModifiers(); + parseExpected( + 98 + /* SyntaxKind.FunctionKeyword */ + ); + var asteriskToken = parseOptionalToken( + 41 + /* SyntaxKind.AsteriskToken */ + ); + var isGenerator = asteriskToken ? 1 : 0; + var isAsync = ts6.some(modifiers, ts6.isAsyncModifier) ? 2 : 0; + var name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalBindingIdentifier) : isGenerator ? doInYieldContext(parseOptionalBindingIdentifier) : isAsync ? doInAwaitContext(parseOptionalBindingIdentifier) : parseOptionalBindingIdentifier(); + var typeParameters = parseTypeParameters(); + var parameters = parseParameters(isGenerator | isAsync); + var type = parseReturnType( + 58, + /*isType*/ + false + ); + var body = parseFunctionBlock(isGenerator | isAsync); + setDecoratorContext(savedDecoratorContext); + var node = factory.createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseOptionalBindingIdentifier() { + return isBindingIdentifier() ? parseBindingIdentifier() : void 0; + } + function parseNewExpressionOrNewDotTarget() { + var pos = getNodePos(); + parseExpected( + 103 + /* SyntaxKind.NewKeyword */ + ); + if (parseOptional( + 24 + /* SyntaxKind.DotToken */ + )) { + var name = parseIdentifierName(); + return finishNode(factory.createMetaProperty(103, name), pos); + } + var expressionPos = getNodePos(); + var expression = parseMemberExpressionRest( + expressionPos, + parsePrimaryExpression(), + /*allowOptionalChain*/ + false + ); + var typeArguments; + if (expression.kind === 230) { + typeArguments = expression.typeArguments; + expression = expression.expression; + } + if (token() === 28) { + parseErrorAtCurrentToken(ts6.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts6.getTextOfNodeFromSourceText(sourceText, expression)); + } + var argumentList = token() === 20 ? parseArgumentList() : void 0; + return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos); + } + function parseBlock2(ignoreMissingOpenBrace, diagnosticMessage) { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var openBracePosition = scanner.getTokenPos(); + var openBraceParsed = parseExpected(18, diagnosticMessage); + if (openBraceParsed || ignoreMissingOpenBrace) { + var multiLine = scanner.hasPrecedingLineBreak(); + var statements = parseList(1, parseStatement); + parseExpectedMatchingBrackets(18, 19, openBraceParsed, openBracePosition); + var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); + if (token() === 63) { + parseErrorAtCurrentToken(ts6.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); + nextToken(); + } + return result; + } else { + var statements = createMissingList(); + return withJSDoc(finishNode(factory.createBlock( + statements, + /*multiLine*/ + void 0 + ), pos), hasJSDoc); + } + } + function parseFunctionBlock(flags, diagnosticMessage) { + var savedYieldContext = inYieldContext(); + setYieldContext(!!(flags & 1)); + var savedAwaitContext = inAwaitContext(); + setAwaitContext(!!(flags & 2)); + var savedTopLevel = topLevel; + topLevel = false; + var saveDecoratorContext = inDecoratorContext(); + if (saveDecoratorContext) { + setDecoratorContext( + /*val*/ + false + ); + } + var block = parseBlock2(!!(flags & 16), diagnosticMessage); + if (saveDecoratorContext) { + setDecoratorContext( + /*val*/ + true + ); + } + topLevel = savedTopLevel; + setYieldContext(savedYieldContext); + setAwaitContext(savedAwaitContext); + return block; + } + function parseEmptyStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 26 + /* SyntaxKind.SemicolonToken */ + ); + return withJSDoc(finishNode(factory.createEmptyStatement(), pos), hasJSDoc); + } + function parseIfStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 99 + /* SyntaxKind.IfKeyword */ + ); + var openParenPosition = scanner.getTokenPos(); + var openParenParsed = parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition); + var thenStatement = parseStatement(); + var elseStatement = parseOptional( + 91 + /* SyntaxKind.ElseKeyword */ + ) ? parseStatement() : void 0; + return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); + } + function parseDoStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 90 + /* SyntaxKind.DoKeyword */ + ); + var statement = parseStatement(); + parseExpected( + 115 + /* SyntaxKind.WhileKeyword */ + ); + var openParenPosition = scanner.getTokenPos(); + var openParenParsed = parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition); + parseOptional( + 26 + /* SyntaxKind.SemicolonToken */ + ); + return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc); + } + function parseWhileStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 115 + /* SyntaxKind.WhileKeyword */ + ); + var openParenPosition = scanner.getTokenPos(); + var openParenParsed = parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition); + var statement = parseStatement(); + return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); + } + function parseForOrForInOrForOfStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 97 + /* SyntaxKind.ForKeyword */ + ); + var awaitToken = parseOptionalToken( + 133 + /* SyntaxKind.AwaitKeyword */ + ); + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var initializer; + if (token() !== 26) { + if (token() === 113 || token() === 119 || token() === 85) { + initializer = parseVariableDeclarationList( + /*inForStatementInitializer*/ + true + ); + } else { + initializer = disallowInAnd(parseExpression); + } + } + var node; + if (awaitToken ? parseExpected( + 162 + /* SyntaxKind.OfKeyword */ + ) : parseOptional( + 162 + /* SyntaxKind.OfKeyword */ + )) { + var expression = allowInAnd(function() { + return parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + }); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); + } else if (parseOptional( + 101 + /* SyntaxKind.InKeyword */ + )) { + var expression = allowInAnd(parseExpression); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + node = factory.createForInStatement(initializer, expression, parseStatement()); + } else { + parseExpected( + 26 + /* SyntaxKind.SemicolonToken */ + ); + var condition = token() !== 26 && token() !== 21 ? allowInAnd(parseExpression) : void 0; + parseExpected( + 26 + /* SyntaxKind.SemicolonToken */ + ); + var incrementor = token() !== 21 ? allowInAnd(parseExpression) : void 0; + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + node = factory.createForStatement(initializer, condition, incrementor, parseStatement()); + } + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseBreakOrContinueStatement(kind) { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + kind === 249 ? 81 : 86 + /* SyntaxKind.ContinueKeyword */ + ); + var label = canParseSemicolon() ? void 0 : parseIdentifier(); + parseSemicolon(); + var node = kind === 249 ? factory.createBreakStatement(label) : factory.createContinueStatement(label); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseReturnStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 105 + /* SyntaxKind.ReturnKeyword */ + ); + var expression = canParseSemicolon() ? void 0 : allowInAnd(parseExpression); + parseSemicolon(); + return withJSDoc(finishNode(factory.createReturnStatement(expression), pos), hasJSDoc); + } + function parseWithStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 116 + /* SyntaxKind.WithKeyword */ + ); + var openParenPosition = scanner.getTokenPos(); + var openParenParsed = parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition); + var statement = doInsideOfContext(33554432, parseStatement); + return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); + } + function parseCaseClause() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 82 + /* SyntaxKind.CaseKeyword */ + ); + var expression = allowInAnd(parseExpression); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var statements = parseList(3, parseStatement); + return withJSDoc(finishNode(factory.createCaseClause(expression, statements), pos), hasJSDoc); + } + function parseDefaultClause() { + var pos = getNodePos(); + parseExpected( + 88 + /* SyntaxKind.DefaultKeyword */ + ); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var statements = parseList(3, parseStatement); + return finishNode(factory.createDefaultClause(statements), pos); + } + function parseCaseOrDefaultClause() { + return token() === 82 ? parseCaseClause() : parseDefaultClause(); + } + function parseCaseBlock() { + var pos = getNodePos(); + parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var clauses = parseList(2, parseCaseOrDefaultClause); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + return finishNode(factory.createCaseBlock(clauses), pos); + } + function parseSwitchStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 107 + /* SyntaxKind.SwitchKeyword */ + ); + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = allowInAnd(parseExpression); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + var caseBlock = parseCaseBlock(); + return withJSDoc(finishNode(factory.createSwitchStatement(expression, caseBlock), pos), hasJSDoc); + } + function parseThrowStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 109 + /* SyntaxKind.ThrowKeyword */ + ); + var expression = scanner.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression); + if (expression === void 0) { + identifierCount++; + expression = finishNode(factory.createIdentifier(""), getNodePos()); + } + if (!tryParseSemicolon()) { + parseErrorForMissingSemicolonAfter(expression); + } + return withJSDoc(finishNode(factory.createThrowStatement(expression), pos), hasJSDoc); + } + function parseTryStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 111 + /* SyntaxKind.TryKeyword */ + ); + var tryBlock = parseBlock2( + /*ignoreMissingOpenBrace*/ + false + ); + var catchClause = token() === 83 ? parseCatchClause() : void 0; + var finallyBlock; + if (!catchClause || token() === 96) { + parseExpected(96, ts6.Diagnostics.catch_or_finally_expected); + finallyBlock = parseBlock2( + /*ignoreMissingOpenBrace*/ + false + ); + } + return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc); + } + function parseCatchClause() { + var pos = getNodePos(); + parseExpected( + 83 + /* SyntaxKind.CatchKeyword */ + ); + var variableDeclaration; + if (parseOptional( + 20 + /* SyntaxKind.OpenParenToken */ + )) { + variableDeclaration = parseVariableDeclaration(); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + } else { + variableDeclaration = void 0; + } + var block = parseBlock2( + /*ignoreMissingOpenBrace*/ + false + ); + return finishNode(factory.createCatchClause(variableDeclaration, block), pos); + } + function parseDebuggerStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + parseExpected( + 87 + /* SyntaxKind.DebuggerKeyword */ + ); + parseSemicolon(); + return withJSDoc(finishNode(factory.createDebuggerStatement(), pos), hasJSDoc); + } + function parseExpressionOrLabeledStatement() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var node; + var hasParen = token() === 20; + var expression = allowInAnd(parseExpression); + if (ts6.isIdentifier(expression) && parseOptional( + 58 + /* SyntaxKind.ColonToken */ + )) { + node = factory.createLabeledStatement(expression, parseStatement()); + } else { + if (!tryParseSemicolon()) { + parseErrorForMissingSemicolonAfter(expression); + } + node = factory.createExpressionStatement(expression); + if (hasParen) { + hasJSDoc = false; + } + } + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function nextTokenIsIdentifierOrKeywordOnSameLine() { + nextToken(); + return ts6.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); + } + function nextTokenIsClassKeywordOnSameLine() { + nextToken(); + return token() === 84 && !scanner.hasPrecedingLineBreak(); + } + function nextTokenIsFunctionKeywordOnSameLine() { + nextToken(); + return token() === 98 && !scanner.hasPrecedingLineBreak(); + } + function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() { + nextToken(); + return (ts6.tokenIsIdentifierOrKeyword(token()) || token() === 8 || token() === 9 || token() === 10) && !scanner.hasPrecedingLineBreak(); + } + function isDeclaration() { + while (true) { + switch (token()) { + case 113: + case 119: + case 85: + case 98: + case 84: + case 92: + return true; + case 118: + case 154: + return nextTokenIsIdentifierOnSameLine(); + case 142: + case 143: + return nextTokenIsIdentifierOrStringLiteralOnSameLine(); + case 126: + case 127: + case 132: + case 136: + case 121: + case 122: + case 123: + case 146: + nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } + continue; + case 159: + nextToken(); + return token() === 18 || token() === 79 || token() === 93; + case 100: + nextToken(); + return token() === 10 || token() === 41 || token() === 18 || ts6.tokenIsIdentifierOrKeyword(token()); + case 93: + var currentToken_1 = nextToken(); + if (currentToken_1 === 154) { + currentToken_1 = lookAhead(nextToken); + } + if (currentToken_1 === 63 || currentToken_1 === 41 || currentToken_1 === 18 || currentToken_1 === 88 || currentToken_1 === 128) { + return true; + } + continue; + case 124: + nextToken(); + continue; + default: + return false; + } + } + } + function isStartOfDeclaration() { + return lookAhead(isDeclaration); + } + function isStartOfStatement() { + switch (token()) { + case 59: + case 26: + case 18: + case 113: + case 119: + case 98: + case 84: + case 92: + case 99: + case 90: + case 115: + case 97: + case 86: + case 81: + case 105: + case 116: + case 107: + case 109: + case 111: + case 87: + case 83: + case 96: + return true; + case 100: + return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); + case 85: + case 93: + return isStartOfDeclaration(); + case 132: + case 136: + case 118: + case 142: + case 143: + case 154: + case 159: + return true; + case 127: + case 123: + case 121: + case 122: + case 124: + case 146: + return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + default: + return isStartOfExpression(); + } + } + function nextTokenIsBindingIdentifierOrStartOfDestructuring() { + nextToken(); + return isBindingIdentifier() || token() === 18 || token() === 22; + } + function isLetDeclaration() { + return lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuring); + } + function parseStatement() { + switch (token()) { + case 26: + return parseEmptyStatement(); + case 18: + return parseBlock2( + /*ignoreMissingOpenBrace*/ + false + ); + case 113: + return parseVariableStatement( + getNodePos(), + hasPrecedingJSDocComment(), + /*decorators*/ + void 0, + /*modifiers*/ + void 0 + ); + case 119: + if (isLetDeclaration()) { + return parseVariableStatement( + getNodePos(), + hasPrecedingJSDocComment(), + /*decorators*/ + void 0, + /*modifiers*/ + void 0 + ); + } + break; + case 98: + return parseFunctionDeclaration( + getNodePos(), + hasPrecedingJSDocComment(), + /*decorators*/ + void 0, + /*modifiers*/ + void 0 + ); + case 84: + return parseClassDeclaration( + getNodePos(), + hasPrecedingJSDocComment(), + /*decorators*/ + void 0, + /*modifiers*/ + void 0 + ); + case 99: + return parseIfStatement(); + case 90: + return parseDoStatement(); + case 115: + return parseWhileStatement(); + case 97: + return parseForOrForInOrForOfStatement(); + case 86: + return parseBreakOrContinueStatement( + 248 + /* SyntaxKind.ContinueStatement */ + ); + case 81: + return parseBreakOrContinueStatement( + 249 + /* SyntaxKind.BreakStatement */ + ); + case 105: + return parseReturnStatement(); + case 116: + return parseWithStatement(); + case 107: + return parseSwitchStatement(); + case 109: + return parseThrowStatement(); + case 111: + case 83: + case 96: + return parseTryStatement(); + case 87: + return parseDebuggerStatement(); + case 59: + return parseDeclaration(); + case 132: + case 118: + case 154: + case 142: + case 143: + case 136: + case 85: + case 92: + case 93: + case 100: + case 121: + case 122: + case 123: + case 126: + case 127: + case 124: + case 146: + case 159: + if (isStartOfDeclaration()) { + return parseDeclaration(); + } + break; + } + return parseExpressionOrLabeledStatement(); + } + function isDeclareModifier(modifier) { + return modifier.kind === 136; + } + function parseDeclaration() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var decorators = parseDecorators(); + var modifiers = parseModifiers(); + var isAmbient = ts6.some(modifiers, isDeclareModifier); + if (isAmbient) { + var node = tryReuseAmbientDeclaration(pos); + if (node) { + return node; + } + for (var _i = 0, _a2 = modifiers; _i < _a2.length; _i++) { + var m = _a2[_i]; + m.flags |= 16777216; + } + return doInsideOfContext(16777216, function() { + return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); + }); + } else { + return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); + } + } + function tryReuseAmbientDeclaration(pos) { + return doInsideOfContext(16777216, function() { + var node = currentNode(parsingContext, pos); + if (node) { + return consumeNode(node); + } + }); + } + function parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers) { + switch (token()) { + case 113: + case 119: + case 85: + return parseVariableStatement(pos, hasJSDoc, decorators, modifiers); + case 98: + return parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers); + case 84: + return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); + case 118: + return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); + case 154: + return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); + case 92: + return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); + case 159: + case 142: + case 143: + return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); + case 100: + return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); + case 93: + nextToken(); + switch (token()) { + case 88: + case 63: + return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); + case 128: + return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); + default: + return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); + } + default: + if (decorators || modifiers) { + var missing = createMissingNode( + 279, + /*reportAtCurrentPosition*/ + true, + ts6.Diagnostics.Declaration_expected + ); + ts6.setTextRangePos(missing, pos); + missing.illegalDecorators = decorators; + missing.modifiers = modifiers; + return missing; + } + return void 0; + } + } + function nextTokenIsIdentifierOrStringLiteralOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier3() || token() === 10); + } + function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) { + if (token() !== 18) { + if (flags & 4) { + parseTypeMemberSemicolon(); + return; + } + if (canParseSemicolon()) { + parseSemicolon(); + return; + } + } + return parseFunctionBlock(flags, diagnosticMessage); + } + function parseArrayBindingElement() { + var pos = getNodePos(); + if (token() === 27) { + return finishNode(factory.createOmittedExpression(), pos); + } + var dotDotDotToken = parseOptionalToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + var name = parseIdentifierOrPattern(); + var initializer = parseInitializer(); + return finishNode(factory.createBindingElement( + dotDotDotToken, + /*propertyName*/ + void 0, + name, + initializer + ), pos); + } + function parseObjectBindingElement() { + var pos = getNodePos(); + var dotDotDotToken = parseOptionalToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ); + var tokenIsIdentifier = isBindingIdentifier(); + var propertyName = parsePropertyName(); + var name; + if (tokenIsIdentifier && token() !== 58) { + name = propertyName; + propertyName = void 0; + } else { + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + name = parseIdentifierOrPattern(); + } + var initializer = parseInitializer(); + return finishNode(factory.createBindingElement(dotDotDotToken, propertyName, name, initializer), pos); + } + function parseObjectBindingPattern() { + var pos = getNodePos(); + parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var elements = parseDelimitedList(9, parseObjectBindingElement); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + return finishNode(factory.createObjectBindingPattern(elements), pos); + } + function parseArrayBindingPattern() { + var pos = getNodePos(); + parseExpected( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + var elements = parseDelimitedList(10, parseArrayBindingElement); + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + return finishNode(factory.createArrayBindingPattern(elements), pos); + } + function isBindingIdentifierOrPrivateIdentifierOrPattern() { + return token() === 18 || token() === 22 || token() === 80 || isBindingIdentifier(); + } + function parseIdentifierOrPattern(privateIdentifierDiagnosticMessage) { + if (token() === 22) { + return parseArrayBindingPattern(); + } + if (token() === 18) { + return parseObjectBindingPattern(); + } + return parseBindingIdentifier(privateIdentifierDiagnosticMessage); + } + function parseVariableDeclarationAllowExclamation() { + return parseVariableDeclaration( + /*allowExclamation*/ + true + ); + } + function parseVariableDeclaration(allowExclamation) { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var name = parseIdentifierOrPattern(ts6.Diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations); + var exclamationToken; + if (allowExclamation && name.kind === 79 && token() === 53 && !scanner.hasPrecedingLineBreak()) { + exclamationToken = parseTokenNode(); + } + var type = parseTypeAnnotation(); + var initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer(); + var node = factory.createVariableDeclaration(name, exclamationToken, type, initializer); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseVariableDeclarationList(inForStatementInitializer) { + var pos = getNodePos(); + var flags = 0; + switch (token()) { + case 113: + break; + case 119: + flags |= 1; + break; + case 85: + flags |= 2; + break; + default: + ts6.Debug.fail(); + } + nextToken(); + var declarations; + if (token() === 162 && lookAhead(canFollowContextualOfKeyword)) { + declarations = createMissingList(); + } else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + declarations = parseDelimitedList(8, inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation); + setDisallowInContext(savedDisallowIn); + } + return finishNode(factory.createVariableDeclarationList(declarations, flags), pos); + } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 21; + } + function parseVariableStatement(pos, hasJSDoc, decorators, modifiers) { + var declarationList = parseVariableDeclarationList( + /*inForStatementInitializer*/ + false + ); + parseSemicolon(); + var node = factory.createVariableStatement(modifiers, declarationList); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { + var savedAwaitContext = inAwaitContext(); + var modifierFlags = ts6.modifiersToFlags(modifiers); + parseExpected( + 98 + /* SyntaxKind.FunctionKeyword */ + ); + var asteriskToken = parseOptionalToken( + 41 + /* SyntaxKind.AsteriskToken */ + ); + var name = modifierFlags & 1024 ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var isGenerator = asteriskToken ? 1 : 0; + var isAsync = modifierFlags & 512 ? 2 : 0; + var typeParameters = parseTypeParameters(); + if (modifierFlags & 1) + setAwaitContext( + /*value*/ + true + ); + var parameters = parseParameters(isGenerator | isAsync); + var type = parseReturnType( + 58, + /*isType*/ + false + ); + var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts6.Diagnostics.or_expected); + setAwaitContext(savedAwaitContext); + var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseConstructorName() { + if (token() === 135) { + return parseExpected( + 135 + /* SyntaxKind.ConstructorKeyword */ + ); + } + if (token() === 10 && lookAhead(nextToken) === 20) { + return tryParse(function() { + var literalNode = parseLiteralNode(); + return literalNode.text === "constructor" ? literalNode : void 0; + }); + } + } + function tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers) { + return tryParse(function() { + if (parseConstructorName()) { + var typeParameters = parseTypeParameters(); + var parameters = parseParameters( + 0 + /* SignatureFlags.None */ + ); + var type = parseReturnType( + 58, + /*isType*/ + false + ); + var body = parseFunctionBlockOrSemicolon(0, ts6.Diagnostics.or_expected); + var node = factory.createConstructorDeclaration(modifiers, parameters, body); + node.illegalDecorators = decorators; + node.typeParameters = typeParameters; + node.type = type; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + }); + } + function parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, exclamationToken, diagnosticMessage) { + var isGenerator = asteriskToken ? 1 : 0; + var isAsync = ts6.some(modifiers, ts6.isAsyncModifier) ? 2 : 0; + var typeParameters = parseTypeParameters(); + var parameters = parseParameters(isGenerator | isAsync); + var type = parseReturnType( + 58, + /*isType*/ + false + ); + var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage); + var node = factory.createMethodDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), asteriskToken, name, questionToken, typeParameters, parameters, type, body); + node.exclamationToken = exclamationToken; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken) { + var exclamationToken = !questionToken && !scanner.hasPrecedingLineBreak() ? parseOptionalToken( + 53 + /* SyntaxKind.ExclamationToken */ + ) : void 0; + var type = parseTypeAnnotation(); + var initializer = doOutsideOfContext(8192 | 32768 | 4096, parseInitializer); + parseSemicolonAfterPropertyName(name, type, initializer); + var node = factory.createPropertyDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, questionToken || exclamationToken, type, initializer); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers) { + var asteriskToken = parseOptionalToken( + 41 + /* SyntaxKind.AsteriskToken */ + ); + var name = parsePropertyName(); + var questionToken = parseOptionalToken( + 57 + /* SyntaxKind.QuestionToken */ + ); + if (asteriskToken || token() === 20 || token() === 29) { + return parseMethodDeclaration( + pos, + hasJSDoc, + decorators, + modifiers, + asteriskToken, + name, + questionToken, + /*exclamationToken*/ + void 0, + ts6.Diagnostics.or_expected + ); + } + return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken); + } + function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) { + var name = parsePropertyName(); + var typeParameters = parseTypeParameters(); + var parameters = parseParameters( + 0 + /* SignatureFlags.None */ + ); + var type = parseReturnType( + 58, + /*isType*/ + false + ); + var body = parseFunctionBlockOrSemicolon(flags); + var node = kind === 174 ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); + node.typeParameters = typeParameters; + if (ts6.isSetAccessorDeclaration(node)) + node.type = type; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function isClassMemberStart() { + var idToken; + if (token() === 59) { + return true; + } + while (ts6.isModifierKind(token())) { + idToken = token(); + if (ts6.isClassMemberModifier(idToken)) { + return true; + } + nextToken(); + } + if (token() === 41) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token(); + nextToken(); + } + if (token() === 22) { + return true; + } + if (idToken !== void 0) { + if (!ts6.isKeyword(idToken) || idToken === 151 || idToken === 137) { + return true; + } + switch (token()) { + case 20: + case 29: + case 53: + case 58: + case 63: + case 57: + return true; + default: + return canParseSemicolon(); + } + } + return false; + } + function parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers) { + parseExpectedToken( + 124 + /* SyntaxKind.StaticKeyword */ + ); + var body = parseClassStaticBlockBody(); + var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); + node.illegalDecorators = decorators; + node.modifiers = modifiers; + return node; + } + function parseClassStaticBlockBody() { + var savedYieldContext = inYieldContext(); + var savedAwaitContext = inAwaitContext(); + setYieldContext(false); + setAwaitContext(true); + var body = parseBlock2( + /*ignoreMissingOpenBrace*/ + false + ); + setYieldContext(savedYieldContext); + setAwaitContext(savedAwaitContext); + return body; + } + function parseDecoratorExpression() { + if (inAwaitContext() && token() === 133) { + var pos = getNodePos(); + var awaitExpression = parseIdentifier(ts6.Diagnostics.Expression_expected); + nextToken(); + var memberExpression = parseMemberExpressionRest( + pos, + awaitExpression, + /*allowOptionalChain*/ + true + ); + return parseCallExpressionRest(pos, memberExpression); + } + return parseLeftHandSideExpressionOrHigher(); + } + function tryParseDecorator() { + var pos = getNodePos(); + if (!parseOptional( + 59 + /* SyntaxKind.AtToken */ + )) { + return void 0; + } + var expression = doInDecoratorContext(parseDecoratorExpression); + return finishNode(factory.createDecorator(expression), pos); + } + function parseDecorators() { + var pos = getNodePos(); + var list, decorator; + while (decorator = tryParseDecorator()) { + list = ts6.append(list, decorator); + } + return list && createNodeArray(list, pos); + } + function tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) { + var pos = getNodePos(); + var kind = token(); + if (token() === 85 && permitInvalidConstAsModifier) { + if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { + return void 0; + } + } else if (stopOnStartOfClassStaticBlock && token() === 124 && lookAhead(nextTokenIsOpenBrace)) { + return void 0; + } else if (hasSeenStaticModifier && token() === 124) { + return void 0; + } else { + if (!parseAnyContextualModifier()) { + return void 0; + } + } + return finishNode(factory.createToken(kind), pos); + } + function combineDecoratorsAndModifiers(decorators, modifiers) { + if (!decorators) + return modifiers; + if (!modifiers) + return decorators; + var decoratorsAndModifiers = factory.createNodeArray(ts6.concatenate(decorators, modifiers)); + ts6.setTextRangePosEnd(decoratorsAndModifiers, decorators.pos, modifiers.end); + return decoratorsAndModifiers; + } + function parseModifiers(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock) { + var pos = getNodePos(); + var list, modifier, hasSeenStatic = false; + while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) { + if (modifier.kind === 124) + hasSeenStatic = true; + list = ts6.append(list, modifier); + } + return list && createNodeArray(list, pos); + } + function parseModifiersForArrowFunction() { + var modifiers; + if (token() === 132) { + var pos = getNodePos(); + nextToken(); + var modifier = finishNode(factory.createToken( + 132 + /* SyntaxKind.AsyncKeyword */ + ), pos); + modifiers = createNodeArray([modifier], pos); + } + return modifiers; + } + function parseClassElement() { + var pos = getNodePos(); + if (token() === 26) { + nextToken(); + return finishNode(factory.createSemicolonClassElement(), pos); + } + var hasJSDoc = hasPrecedingJSDocComment(); + var decorators = parseDecorators(); + var modifiers = parseModifiers( + /*permitInvalidConstAsModifier*/ + true, + /*stopOnStartOfClassStaticBlock*/ + true + ); + if (token() === 124 && lookAhead(nextTokenIsOpenBrace)) { + return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); + } + if (parseContextualModifier( + 137 + /* SyntaxKind.GetKeyword */ + )) { + return parseAccessorDeclaration( + pos, + hasJSDoc, + decorators, + modifiers, + 174, + 0 + /* SignatureFlags.None */ + ); + } + if (parseContextualModifier( + 151 + /* SyntaxKind.SetKeyword */ + )) { + return parseAccessorDeclaration( + pos, + hasJSDoc, + decorators, + modifiers, + 175, + 0 + /* SignatureFlags.None */ + ); + } + if (token() === 135 || token() === 10) { + var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); + if (constructorDeclaration) { + return constructorDeclaration; + } + } + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers); + } + if (ts6.tokenIsIdentifierOrKeyword(token()) || token() === 10 || token() === 8 || token() === 41 || token() === 22) { + var isAmbient = ts6.some(modifiers, isDeclareModifier); + if (isAmbient) { + for (var _i = 0, _a2 = modifiers; _i < _a2.length; _i++) { + var m = _a2[_i]; + m.flags |= 16777216; + } + return doInsideOfContext(16777216, function() { + return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); + }); + } else { + return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); + } + } + if (decorators || modifiers) { + var name = createMissingNode( + 79, + /*reportAtCurrentPosition*/ + true, + ts6.Diagnostics.Declaration_expected + ); + return parsePropertyDeclaration( + pos, + hasJSDoc, + decorators, + modifiers, + name, + /*questionToken*/ + void 0 + ); + } + return ts6.Debug.fail("Should not have attempted to parse class member declaration."); + } + function parseClassExpression() { + return parseClassDeclarationOrExpression( + getNodePos(), + hasPrecedingJSDocComment(), + /*decorators*/ + void 0, + /*modifiers*/ + void 0, + 228 + /* SyntaxKind.ClassExpression */ + ); + } + function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { + return parseClassDeclarationOrExpression( + pos, + hasJSDoc, + decorators, + modifiers, + 260 + /* SyntaxKind.ClassDeclaration */ + ); + } + function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { + var savedAwaitContext = inAwaitContext(); + parseExpected( + 84 + /* SyntaxKind.ClassKeyword */ + ); + var name = parseNameOfClassDeclarationOrExpression(); + var typeParameters = parseTypeParameters(); + if (ts6.some(modifiers, ts6.isExportModifier)) + setAwaitContext( + /*value*/ + true + ); + var heritageClauses = parseHeritageClauses(); + var members; + if (parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + )) { + members = parseClassMembers(); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } else { + members = createMissingList(); + } + setAwaitContext(savedAwaitContext); + var node = kind === 260 ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseNameOfClassDeclarationOrExpression() { + return isBindingIdentifier() && !isImplementsClause() ? createIdentifier(isBindingIdentifier()) : void 0; + } + function isImplementsClause() { + return token() === 117 && lookAhead(nextTokenIsIdentifierOrKeyword); + } + function parseHeritageClauses() { + if (isHeritageClause()) { + return parseList(22, parseHeritageClause); + } + return void 0; + } + function parseHeritageClause() { + var pos = getNodePos(); + var tok = token(); + ts6.Debug.assert( + tok === 94 || tok === 117 + /* SyntaxKind.ImplementsKeyword */ + ); + nextToken(); + var types = parseDelimitedList(7, parseExpressionWithTypeArguments); + return finishNode(factory.createHeritageClause(tok, types), pos); + } + function parseExpressionWithTypeArguments() { + var pos = getNodePos(); + var expression = parseLeftHandSideExpressionOrHigher(); + if (expression.kind === 230) { + return expression; + } + var typeArguments = tryParseTypeArguments(); + return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos); + } + function tryParseTypeArguments() { + return token() === 29 ? parseBracketedList( + 20, + parseType, + 29, + 31 + /* SyntaxKind.GreaterThanToken */ + ) : void 0; + } + function isHeritageClause() { + return token() === 94 || token() === 117; + } + function parseClassMembers() { + return parseList(5, parseClassElement); + } + function parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers) { + parseExpected( + 118 + /* SyntaxKind.InterfaceKeyword */ + ); + var name = parseIdentifier(); + var typeParameters = parseTypeParameters(); + var heritageClauses = parseHeritageClauses(); + var members = parseObjectTypeMembers(); + var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { + parseExpected( + 154 + /* SyntaxKind.TypeKeyword */ + ); + var name = parseIdentifier(); + var typeParameters = parseTypeParameters(); + parseExpected( + 63 + /* SyntaxKind.EqualsToken */ + ); + var type = token() === 139 && tryParse(parseKeywordAndNoDot) || parseType(); + parseSemicolon(); + var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseEnumMember() { + var pos = getNodePos(); + var hasJSDoc = hasPrecedingJSDocComment(); + var name = parsePropertyName(); + var initializer = allowInAnd(parseInitializer); + return withJSDoc(finishNode(factory.createEnumMember(name, initializer), pos), hasJSDoc); + } + function parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers) { + parseExpected( + 92 + /* SyntaxKind.EnumKeyword */ + ); + var name = parseIdentifier(); + var members; + if (parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + )) { + members = doOutsideOfYieldAndAwaitContext(function() { + return parseDelimitedList(6, parseEnumMember); + }); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } else { + members = createMissingList(); + } + var node = factory.createEnumDeclaration(modifiers, name, members); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseModuleBlock() { + var pos = getNodePos(); + var statements; + if (parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + )) { + statements = parseList(1, parseStatement); + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } else { + statements = createMissingList(); + } + return finishNode(factory.createModuleBlock(statements), pos); + } + function parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags) { + var namespaceFlag = flags & 16; + var name = parseIdentifier(); + var body = parseOptional( + 24 + /* SyntaxKind.DotToken */ + ) ? parseModuleOrNamespaceDeclaration( + getNodePos(), + /*hasJSDoc*/ + false, + /*decorators*/ + void 0, + /*modifiers*/ + void 0, + 4 | namespaceFlag + ) : parseModuleBlock(); + var node = factory.createModuleDeclaration(modifiers, name, body, flags); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { + var flags = 0; + var name; + if (token() === 159) { + name = parseIdentifier(); + flags |= 1024; + } else { + name = parseLiteralNode(); + name.text = internIdentifier(name.text); + } + var body; + if (token() === 18) { + body = parseModuleBlock(); + } else { + parseSemicolon(); + } + var node = factory.createModuleDeclaration(modifiers, name, body, flags); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { + var flags = 0; + if (token() === 159) { + return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); + } else if (parseOptional( + 143 + /* SyntaxKind.NamespaceKeyword */ + )) { + flags |= 16; + } else { + parseExpected( + 142 + /* SyntaxKind.ModuleKeyword */ + ); + if (token() === 10) { + return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); + } + } + return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); + } + function isExternalModuleReference() { + return token() === 147 && lookAhead(nextTokenIsOpenParen); + } + function nextTokenIsOpenParen() { + return nextToken() === 20; + } + function nextTokenIsOpenBrace() { + return nextToken() === 18; + } + function nextTokenIsSlash() { + return nextToken() === 43; + } + function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { + parseExpected( + 128 + /* SyntaxKind.AsKeyword */ + ); + parseExpected( + 143 + /* SyntaxKind.NamespaceKeyword */ + ); + var name = parseIdentifier(); + parseSemicolon(); + var node = factory.createNamespaceExportDeclaration(name); + node.illegalDecorators = decorators; + node.modifiers = modifiers; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers) { + parseExpected( + 100 + /* SyntaxKind.ImportKeyword */ + ); + var afterImportPos = scanner.getStartPos(); + var identifier; + if (isIdentifier3()) { + identifier = parseIdentifier(); + } + var isTypeOnly = false; + if (token() !== 158 && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier3() || tokenAfterImportDefinitelyProducesImportDeclaration())) { + isTypeOnly = true; + identifier = isIdentifier3() ? parseIdentifier() : void 0; + } + if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) { + return parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly); + } + var importClause; + if (identifier || // import id + token() === 41 || // import * + token() === 18) { + importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); + parseExpected( + 158 + /* SyntaxKind.FromKeyword */ + ); + } + var moduleSpecifier = parseModuleSpecifier(); + var assertClause; + if (token() === 130 && !scanner.hasPrecedingLineBreak()) { + assertClause = parseAssertClause(); + } + parseSemicolon(); + var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseAssertEntry() { + var pos = getNodePos(); + var name = ts6.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode( + 10 + /* SyntaxKind.StringLiteral */ + ); + parseExpected( + 58 + /* SyntaxKind.ColonToken */ + ); + var value = parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + return finishNode(factory.createAssertEntry(name, value), pos); + } + function parseAssertClause(skipAssertKeyword) { + var pos = getNodePos(); + if (!skipAssertKeyword) { + parseExpected( + 130 + /* SyntaxKind.AssertKeyword */ + ); + } + var openBracePosition = scanner.getTokenPos(); + if (parseExpected( + 18 + /* SyntaxKind.OpenBraceToken */ + )) { + var multiLine = scanner.hasPrecedingLineBreak(); + var elements = parseDelimitedList( + 24, + parseAssertEntry, + /*considerSemicolonAsDelimiter*/ + true + ); + if (!parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + )) { + var lastError = ts6.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts6.Diagnostics._0_expected.code) { + ts6.addRelatedInfo(lastError, ts6.createDetachedDiagnostic(fileName, openBracePosition, 1, ts6.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")); + } + } + return finishNode(factory.createAssertClause(elements, multiLine), pos); + } else { + var elements = createNodeArray( + [], + getNodePos(), + /*end*/ + void 0, + /*hasTrailingComma*/ + false + ); + return finishNode(factory.createAssertClause( + elements, + /*multiLine*/ + false + ), pos); + } + } + function tokenAfterImportDefinitelyProducesImportDeclaration() { + return token() === 41 || token() === 18; + } + function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { + return token() === 27 || token() === 158; + } + function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { + parseExpected( + 63 + /* SyntaxKind.EqualsToken */ + ); + var moduleReference = parseModuleReference(); + parseSemicolon(); + var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); + node.illegalDecorators = decorators; + var finished = withJSDoc(finishNode(node, pos), hasJSDoc); + return finished; + } + function parseImportClause(identifier, pos, isTypeOnly) { + var namedBindings; + if (!identifier || parseOptional( + 27 + /* SyntaxKind.CommaToken */ + )) { + namedBindings = token() === 41 ? parseNamespaceImport() : parseNamedImportsOrExports( + 272 + /* SyntaxKind.NamedImports */ + ); + } + return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); + } + function parseModuleReference() { + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName( + /*allowReservedWords*/ + false + ); + } + function parseExternalModuleReference() { + var pos = getNodePos(); + parseExpected( + 147 + /* SyntaxKind.RequireKeyword */ + ); + parseExpected( + 20 + /* SyntaxKind.OpenParenToken */ + ); + var expression = parseModuleSpecifier(); + parseExpected( + 21 + /* SyntaxKind.CloseParenToken */ + ); + return finishNode(factory.createExternalModuleReference(expression), pos); + } + function parseModuleSpecifier() { + if (token() === 10) { + var result = parseLiteralNode(); + result.text = internIdentifier(result.text); + return result; + } else { + return parseExpression(); + } + } + function parseNamespaceImport() { + var pos = getNodePos(); + parseExpected( + 41 + /* SyntaxKind.AsteriskToken */ + ); + parseExpected( + 128 + /* SyntaxKind.AsKeyword */ + ); + var name = parseIdentifier(); + return finishNode(factory.createNamespaceImport(name), pos); + } + function parseNamedImportsOrExports(kind) { + var pos = getNodePos(); + var node = kind === 272 ? factory.createNamedImports(parseBracketedList( + 23, + parseImportSpecifier, + 18, + 19 + /* SyntaxKind.CloseBraceToken */ + )) : factory.createNamedExports(parseBracketedList( + 23, + parseExportSpecifier, + 18, + 19 + /* SyntaxKind.CloseBraceToken */ + )); + return finishNode(node, pos); + } + function parseExportSpecifier() { + var hasJSDoc = hasPrecedingJSDocComment(); + return withJSDoc(parseImportOrExportSpecifier( + 278 + /* SyntaxKind.ExportSpecifier */ + ), hasJSDoc); + } + function parseImportSpecifier() { + return parseImportOrExportSpecifier( + 273 + /* SyntaxKind.ImportSpecifier */ + ); + } + function parseImportOrExportSpecifier(kind) { + var pos = getNodePos(); + var checkIdentifierIsKeyword = ts6.isKeyword(token()) && !isIdentifier3(); + var checkIdentifierStart = scanner.getTokenPos(); + var checkIdentifierEnd = scanner.getTextPos(); + var isTypeOnly = false; + var propertyName; + var canParseAsKeyword = true; + var name = parseIdentifierName(); + if (name.escapedText === "type") { + if (token() === 128) { + var firstAs = parseIdentifierName(); + if (token() === 128) { + var secondAs = parseIdentifierName(); + if (ts6.tokenIsIdentifierOrKeyword(token())) { + isTypeOnly = true; + propertyName = firstAs; + name = parseNameWithKeywordCheck(); + canParseAsKeyword = false; + } else { + propertyName = name; + name = secondAs; + canParseAsKeyword = false; + } + } else if (ts6.tokenIsIdentifierOrKeyword(token())) { + propertyName = name; + canParseAsKeyword = false; + name = parseNameWithKeywordCheck(); + } else { + isTypeOnly = true; + name = firstAs; + } + } else if (ts6.tokenIsIdentifierOrKeyword(token())) { + isTypeOnly = true; + name = parseNameWithKeywordCheck(); + } + } + if (canParseAsKeyword && token() === 128) { + propertyName = name; + parseExpected( + 128 + /* SyntaxKind.AsKeyword */ + ); + name = parseNameWithKeywordCheck(); + } + if (kind === 273 && checkIdentifierIsKeyword) { + parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts6.Diagnostics.Identifier_expected); + } + var node = kind === 273 ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); + return finishNode(node, pos); + function parseNameWithKeywordCheck() { + checkIdentifierIsKeyword = ts6.isKeyword(token()) && !isIdentifier3(); + checkIdentifierStart = scanner.getTokenPos(); + checkIdentifierEnd = scanner.getTextPos(); + return parseIdentifierName(); + } + } + function parseNamespaceExport(pos) { + return finishNode(factory.createNamespaceExport(parseIdentifierName()), pos); + } + function parseExportDeclaration(pos, hasJSDoc, decorators, modifiers) { + var savedAwaitContext = inAwaitContext(); + setAwaitContext( + /*value*/ + true + ); + var exportClause; + var moduleSpecifier; + var assertClause; + var isTypeOnly = parseOptional( + 154 + /* SyntaxKind.TypeKeyword */ + ); + var namespaceExportPos = getNodePos(); + if (parseOptional( + 41 + /* SyntaxKind.AsteriskToken */ + )) { + if (parseOptional( + 128 + /* SyntaxKind.AsKeyword */ + )) { + exportClause = parseNamespaceExport(namespaceExportPos); + } + parseExpected( + 158 + /* SyntaxKind.FromKeyword */ + ); + moduleSpecifier = parseModuleSpecifier(); + } else { + exportClause = parseNamedImportsOrExports( + 276 + /* SyntaxKind.NamedExports */ + ); + if (token() === 158 || token() === 10 && !scanner.hasPrecedingLineBreak()) { + parseExpected( + 158 + /* SyntaxKind.FromKeyword */ + ); + moduleSpecifier = parseModuleSpecifier(); + } + } + if (moduleSpecifier && token() === 130 && !scanner.hasPrecedingLineBreak()) { + assertClause = parseAssertClause(); + } + parseSemicolon(); + setAwaitContext(savedAwaitContext); + var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { + var savedAwaitContext = inAwaitContext(); + setAwaitContext( + /*value*/ + true + ); + var isExportEquals; + if (parseOptional( + 63 + /* SyntaxKind.EqualsToken */ + )) { + isExportEquals = true; + } else { + parseExpected( + 88 + /* SyntaxKind.DefaultKeyword */ + ); + } + var expression = parseAssignmentExpressionOrHigher( + /*allowReturnTypeInArrowFunction*/ + true + ); + parseSemicolon(); + setAwaitContext(savedAwaitContext); + var node = factory.createExportAssignment(modifiers, isExportEquals, expression); + node.illegalDecorators = decorators; + return withJSDoc(finishNode(node, pos), hasJSDoc); + } + var ParsingContext; + (function(ParsingContext2) { + ParsingContext2[ParsingContext2["SourceElements"] = 0] = "SourceElements"; + ParsingContext2[ParsingContext2["BlockStatements"] = 1] = "BlockStatements"; + ParsingContext2[ParsingContext2["SwitchClauses"] = 2] = "SwitchClauses"; + ParsingContext2[ParsingContext2["SwitchClauseStatements"] = 3] = "SwitchClauseStatements"; + ParsingContext2[ParsingContext2["TypeMembers"] = 4] = "TypeMembers"; + ParsingContext2[ParsingContext2["ClassMembers"] = 5] = "ClassMembers"; + ParsingContext2[ParsingContext2["EnumMembers"] = 6] = "EnumMembers"; + ParsingContext2[ParsingContext2["HeritageClauseElement"] = 7] = "HeritageClauseElement"; + ParsingContext2[ParsingContext2["VariableDeclarations"] = 8] = "VariableDeclarations"; + ParsingContext2[ParsingContext2["ObjectBindingElements"] = 9] = "ObjectBindingElements"; + ParsingContext2[ParsingContext2["ArrayBindingElements"] = 10] = "ArrayBindingElements"; + ParsingContext2[ParsingContext2["ArgumentExpressions"] = 11] = "ArgumentExpressions"; + ParsingContext2[ParsingContext2["ObjectLiteralMembers"] = 12] = "ObjectLiteralMembers"; + ParsingContext2[ParsingContext2["JsxAttributes"] = 13] = "JsxAttributes"; + ParsingContext2[ParsingContext2["JsxChildren"] = 14] = "JsxChildren"; + ParsingContext2[ParsingContext2["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers"; + ParsingContext2[ParsingContext2["Parameters"] = 16] = "Parameters"; + ParsingContext2[ParsingContext2["JSDocParameters"] = 17] = "JSDocParameters"; + ParsingContext2[ParsingContext2["RestProperties"] = 18] = "RestProperties"; + ParsingContext2[ParsingContext2["TypeParameters"] = 19] = "TypeParameters"; + ParsingContext2[ParsingContext2["TypeArguments"] = 20] = "TypeArguments"; + ParsingContext2[ParsingContext2["TupleElementTypes"] = 21] = "TupleElementTypes"; + ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses"; + ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers"; + ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries"; + ParsingContext2[ParsingContext2["Count"] = 25] = "Count"; + })(ParsingContext || (ParsingContext = {})); + var Tristate; + (function(Tristate2) { + Tristate2[Tristate2["False"] = 0] = "False"; + Tristate2[Tristate2["True"] = 1] = "True"; + Tristate2[Tristate2["Unknown"] = 2] = "Unknown"; + })(Tristate || (Tristate = {})); + var JSDocParser; + (function(JSDocParser2) { + function parseJSDocTypeExpressionForTests2(content, start, length) { + initializeState( + "file.js", + content, + 99, + /*_syntaxCursor:*/ + void 0, + 1 + /* ScriptKind.JS */ + ); + scanner.setText(content, start, length); + currentToken = scanner.scan(); + var jsDocTypeExpression = parseJSDocTypeExpression(); + var sourceFile = createSourceFile3( + "file.js", + 99, + 1, + /*isDeclarationFile*/ + false, + [], + factory.createToken( + 1 + /* SyntaxKind.EndOfFileToken */ + ), + 0, + ts6.noop + ); + var diagnostics = ts6.attachFileToDiagnostics(parseDiagnostics, sourceFile); + if (jsDocDiagnostics) { + sourceFile.jsDocDiagnostics = ts6.attachFileToDiagnostics(jsDocDiagnostics, sourceFile); + } + clearState(); + return jsDocTypeExpression ? { jsDocTypeExpression, diagnostics } : void 0; + } + JSDocParser2.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests2; + function parseJSDocTypeExpression(mayOmitBraces) { + var pos = getNodePos(); + var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var type = doInsideOfContext(8388608, parseJSDocType); + if (!mayOmitBraces || hasBrace) { + parseExpectedJSDoc( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } + var result = factory.createJSDocTypeExpression(type); + fixupParentReferences(result); + return finishNode(result, pos); + } + JSDocParser2.parseJSDocTypeExpression = parseJSDocTypeExpression; + function parseJSDocNameReference() { + var pos = getNodePos(); + var hasBrace = parseOptional( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var p2 = getNodePos(); + var entityName = parseEntityName( + /* allowReservedWords*/ + false + ); + while (token() === 80) { + reScanHashToken(); + nextTokenJSDoc(); + entityName = finishNode(factory.createJSDocMemberName(entityName, parseIdentifier()), p2); + } + if (hasBrace) { + parseExpectedJSDoc( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } + var result = factory.createJSDocNameReference(entityName); + fixupParentReferences(result); + return finishNode(result, pos); + } + JSDocParser2.parseJSDocNameReference = parseJSDocNameReference; + function parseIsolatedJSDocComment2(content, start, length) { + initializeState( + "", + content, + 99, + /*_syntaxCursor:*/ + void 0, + 1 + /* ScriptKind.JS */ + ); + var jsDoc = doInsideOfContext(8388608, function() { + return parseJSDocCommentWorker(start, length); + }); + var sourceFile = { languageVariant: 0, text: content }; + var diagnostics = ts6.attachFileToDiagnostics(parseDiagnostics, sourceFile); + clearState(); + return jsDoc ? { jsDoc, diagnostics } : void 0; + } + JSDocParser2.parseIsolatedJSDocComment = parseIsolatedJSDocComment2; + function parseJSDocComment(parent, start, length) { + var saveToken = currentToken; + var saveParseDiagnosticsLength = parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var comment = doInsideOfContext(8388608, function() { + return parseJSDocCommentWorker(start, length); + }); + ts6.setParent(comment, parent); + if (contextFlags & 262144) { + if (!jsDocDiagnostics) { + jsDocDiagnostics = []; + } + jsDocDiagnostics.push.apply(jsDocDiagnostics, parseDiagnostics); + } + currentToken = saveToken; + parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + return comment; + } + JSDocParser2.parseJSDocComment = parseJSDocComment; + var JSDocState; + (function(JSDocState2) { + JSDocState2[JSDocState2["BeginningOfLine"] = 0] = "BeginningOfLine"; + JSDocState2[JSDocState2["SawAsterisk"] = 1] = "SawAsterisk"; + JSDocState2[JSDocState2["SavingComments"] = 2] = "SavingComments"; + JSDocState2[JSDocState2["SavingBackticks"] = 3] = "SavingBackticks"; + })(JSDocState || (JSDocState = {})); + var PropertyLikeParse; + (function(PropertyLikeParse2) { + PropertyLikeParse2[PropertyLikeParse2["Property"] = 1] = "Property"; + PropertyLikeParse2[PropertyLikeParse2["Parameter"] = 2] = "Parameter"; + PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter"; + })(PropertyLikeParse || (PropertyLikeParse = {})); + function parseJSDocCommentWorker(start, length) { + if (start === void 0) { + start = 0; + } + var content = sourceText; + var end = length === void 0 ? content.length : start + length; + length = end - start; + ts6.Debug.assert(start >= 0); + ts6.Debug.assert(start <= end); + ts6.Debug.assert(end <= content.length); + if (!isJSDocLikeText(content, start)) { + return void 0; + } + var tags; + var tagsPos; + var tagsEnd; + var linkEnd; + var commentsPos; + var comments = []; + var parts = []; + return scanner.scanRange(start + 3, length - 5, function() { + var state = 1; + var margin; + var indent = start - (content.lastIndexOf("\n", start) + 1) + 4; + function pushComment(text) { + if (!margin) { + margin = indent; + } + comments.push(text); + indent += text.length; + } + nextTokenJSDoc(); + while (parseOptionalJsdoc( + 5 + /* SyntaxKind.WhitespaceTrivia */ + )) + ; + if (parseOptionalJsdoc( + 4 + /* SyntaxKind.NewLineTrivia */ + )) { + state = 0; + indent = 0; + } + loop: + while (true) { + switch (token()) { + case 59: + if (state === 0 || state === 1) { + removeTrailingWhitespace(comments); + if (!commentsPos) + commentsPos = getNodePos(); + addTag(parseTag(indent)); + state = 0; + margin = void 0; + } else { + pushComment(scanner.getTokenText()); + } + break; + case 4: + comments.push(scanner.getTokenText()); + state = 0; + indent = 0; + break; + case 41: + var asterisk = scanner.getTokenText(); + if (state === 1 || state === 2) { + state = 2; + pushComment(asterisk); + } else { + state = 1; + indent += asterisk.length; + } + break; + case 5: + var whitespace = scanner.getTokenText(); + if (state === 2) { + comments.push(whitespace); + } else if (margin !== void 0 && indent + whitespace.length > margin) { + comments.push(whitespace.slice(margin - indent)); + } + indent += whitespace.length; + break; + case 1: + break loop; + case 18: + state = 2; + var commentEnd = scanner.getStartPos(); + var linkStart = scanner.getTextPos() - 1; + var link = parseJSDocLink(linkStart); + if (link) { + if (!linkEnd) { + removeLeadingNewlines(comments); + } + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd !== null && linkEnd !== void 0 ? linkEnd : start, commentEnd)); + parts.push(link); + comments = []; + linkEnd = scanner.getTextPos(); + break; + } + default: + state = 2; + pushComment(scanner.getTokenText()); + break; + } + nextTokenJSDoc(); + } + removeTrailingWhitespace(comments); + if (parts.length && comments.length) { + parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd !== null && linkEnd !== void 0 ? linkEnd : start, commentsPos)); + } + if (parts.length && tags) + ts6.Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set"); + var tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); + return finishNode(factory.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : comments.length ? comments.join("") : void 0, tagsArray), start, end); + }); + function removeLeadingNewlines(comments2) { + while (comments2.length && (comments2[0] === "\n" || comments2[0] === "\r")) { + comments2.shift(); + } + } + function removeTrailingWhitespace(comments2) { + while (comments2.length && comments2[comments2.length - 1].trim() === "") { + comments2.pop(); + } + } + function isNextNonwhitespaceTokenEndOfFile() { + while (true) { + nextTokenJSDoc(); + if (token() === 1) { + return true; + } + if (!(token() === 5 || token() === 4)) { + return false; + } + } + } + function skipWhitespace() { + if (token() === 5 || token() === 4) { + if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) { + return; + } + } + while (token() === 5 || token() === 4) { + nextTokenJSDoc(); + } + } + function skipWhitespaceOrAsterisk() { + if (token() === 5 || token() === 4) { + if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) { + return ""; + } + } + var precedingLineBreak = scanner.hasPrecedingLineBreak(); + var seenLineBreak = false; + var indentText = ""; + while (precedingLineBreak && token() === 41 || token() === 5 || token() === 4) { + indentText += scanner.getTokenText(); + if (token() === 4) { + precedingLineBreak = true; + seenLineBreak = true; + indentText = ""; + } else if (token() === 41) { + precedingLineBreak = false; + } + nextTokenJSDoc(); + } + return seenLineBreak ? indentText : ""; + } + function parseTag(margin) { + ts6.Debug.assert( + token() === 59 + /* SyntaxKind.AtToken */ + ); + var start2 = scanner.getTokenPos(); + nextTokenJSDoc(); + var tagName = parseJSDocIdentifierName( + /*message*/ + void 0 + ); + var indentText = skipWhitespaceOrAsterisk(); + var tag; + switch (tagName.escapedText) { + case "author": + tag = parseAuthorTag(start2, tagName, margin, indentText); + break; + case "implements": + tag = parseImplementsTag(start2, tagName, margin, indentText); + break; + case "augments": + case "extends": + tag = parseAugmentsTag(start2, tagName, margin, indentText); + break; + case "class": + case "constructor": + tag = parseSimpleTag(start2, factory.createJSDocClassTag, tagName, margin, indentText); + break; + case "public": + tag = parseSimpleTag(start2, factory.createJSDocPublicTag, tagName, margin, indentText); + break; + case "private": + tag = parseSimpleTag(start2, factory.createJSDocPrivateTag, tagName, margin, indentText); + break; + case "protected": + tag = parseSimpleTag(start2, factory.createJSDocProtectedTag, tagName, margin, indentText); + break; + case "readonly": + tag = parseSimpleTag(start2, factory.createJSDocReadonlyTag, tagName, margin, indentText); + break; + case "override": + tag = parseSimpleTag(start2, factory.createJSDocOverrideTag, tagName, margin, indentText); + break; + case "deprecated": + hasDeprecatedTag = true; + tag = parseSimpleTag(start2, factory.createJSDocDeprecatedTag, tagName, margin, indentText); + break; + case "this": + tag = parseThisTag(start2, tagName, margin, indentText); + break; + case "enum": + tag = parseEnumTag(start2, tagName, margin, indentText); + break; + case "arg": + case "argument": + case "param": + return parseParameterOrPropertyTag(start2, tagName, 2, margin); + case "return": + case "returns": + tag = parseReturnTag(start2, tagName, margin, indentText); + break; + case "template": + tag = parseTemplateTag(start2, tagName, margin, indentText); + break; + case "type": + tag = parseTypeTag(start2, tagName, margin, indentText); + break; + case "typedef": + tag = parseTypedefTag(start2, tagName, margin, indentText); + break; + case "callback": + tag = parseCallbackTag(start2, tagName, margin, indentText); + break; + case "see": + tag = parseSeeTag(start2, tagName, margin, indentText); + break; + default: + tag = parseUnknownTag(start2, tagName, margin, indentText); + break; + } + return tag; + } + function parseTrailingTagComments(pos, end2, margin, indentText) { + if (!indentText) { + margin += end2 - pos; + } + return parseTagComments(margin, indentText.slice(margin)); + } + function parseTagComments(indent, initialMargin) { + var commentsPos2 = getNodePos(); + var comments2 = []; + var parts2 = []; + var linkEnd2; + var state = 0; + var previousWhitespace = true; + var margin; + function pushComment(text) { + if (!margin) { + margin = indent; + } + comments2.push(text); + indent += text.length; + } + if (initialMargin !== void 0) { + if (initialMargin !== "") { + pushComment(initialMargin); + } + state = 1; + } + var tok = token(); + loop: + while (true) { + switch (tok) { + case 4: + state = 0; + comments2.push(scanner.getTokenText()); + indent = 0; + break; + case 59: + if (state === 3 || state === 2 && (!previousWhitespace || lookAhead(isNextJSDocTokenWhitespace))) { + comments2.push(scanner.getTokenText()); + break; + } + scanner.setTextPos(scanner.getTextPos() - 1); + case 1: + break loop; + case 5: + if (state === 2 || state === 3) { + pushComment(scanner.getTokenText()); + } else { + var whitespace = scanner.getTokenText(); + if (margin !== void 0 && indent + whitespace.length > margin) { + comments2.push(whitespace.slice(margin - indent)); + } + indent += whitespace.length; + } + break; + case 18: + state = 2; + var commentEnd = scanner.getStartPos(); + var linkStart = scanner.getTextPos() - 1; + var link = parseJSDocLink(linkStart); + if (link) { + parts2.push(finishNode(factory.createJSDocText(comments2.join("")), linkEnd2 !== null && linkEnd2 !== void 0 ? linkEnd2 : commentsPos2, commentEnd)); + parts2.push(link); + comments2 = []; + linkEnd2 = scanner.getTextPos(); + } else { + pushComment(scanner.getTokenText()); + } + break; + case 61: + if (state === 3) { + state = 2; + } else { + state = 3; + } + pushComment(scanner.getTokenText()); + break; + case 41: + if (state === 0) { + state = 1; + indent += 1; + break; + } + default: + if (state !== 3) { + state = 2; + } + pushComment(scanner.getTokenText()); + break; + } + previousWhitespace = token() === 5; + tok = nextTokenJSDoc(); + } + removeLeadingNewlines(comments2); + removeTrailingWhitespace(comments2); + if (parts2.length) { + if (comments2.length) { + parts2.push(finishNode(factory.createJSDocText(comments2.join("")), linkEnd2 !== null && linkEnd2 !== void 0 ? linkEnd2 : commentsPos2)); + } + return createNodeArray(parts2, commentsPos2, scanner.getTextPos()); + } else if (comments2.length) { + return comments2.join(""); + } + } + function isNextJSDocTokenWhitespace() { + var next = nextTokenJSDoc(); + return next === 5 || next === 4; + } + function parseJSDocLink(start2) { + var linkType = tryParse(parseJSDocLinkPrefix); + if (!linkType) { + return void 0; + } + nextTokenJSDoc(); + skipWhitespace(); + var p2 = getNodePos(); + var name = ts6.tokenIsIdentifierOrKeyword(token()) ? parseEntityName( + /*allowReservedWords*/ + true + ) : void 0; + if (name) { + while (token() === 80) { + reScanHashToken(); + nextTokenJSDoc(); + name = finishNode(factory.createJSDocMemberName(name, parseIdentifier()), p2); + } + } + var text = []; + while (token() !== 19 && token() !== 4 && token() !== 1) { + text.push(scanner.getTokenText()); + nextTokenJSDoc(); + } + var create = linkType === "link" ? factory.createJSDocLink : linkType === "linkcode" ? factory.createJSDocLinkCode : factory.createJSDocLinkPlain; + return finishNode(create(name, text.join("")), start2, scanner.getTextPos()); + } + function parseJSDocLinkPrefix() { + skipWhitespaceOrAsterisk(); + if (token() === 18 && nextTokenJSDoc() === 59 && ts6.tokenIsIdentifierOrKeyword(nextTokenJSDoc())) { + var kind = scanner.getTokenValue(); + if (isJSDocLinkTag(kind)) + return kind; + } + } + function isJSDocLinkTag(kind) { + return kind === "link" || kind === "linkcode" || kind === "linkplain"; + } + function parseUnknownTag(start2, tagName, indent, indentText) { + return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start2, getNodePos(), indent, indentText)), start2); + } + function addTag(tag) { + if (!tag) { + return; + } + if (!tags) { + tags = [tag]; + tagsPos = tag.pos; + } else { + tags.push(tag); + } + tagsEnd = tag.end; + } + function tryParseTypeExpression() { + skipWhitespaceOrAsterisk(); + return token() === 18 ? parseJSDocTypeExpression() : void 0; + } + function parseBracketNameInPropertyAndParamTag() { + var isBracketed = parseOptionalJsdoc( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + if (isBracketed) { + skipWhitespace(); + } + var isBackquoted = parseOptionalJsdoc( + 61 + /* SyntaxKind.BacktickToken */ + ); + var name = parseJSDocEntityName(); + if (isBackquoted) { + parseExpectedTokenJSDoc( + 61 + /* SyntaxKind.BacktickToken */ + ); + } + if (isBracketed) { + skipWhitespace(); + if (parseOptionalToken( + 63 + /* SyntaxKind.EqualsToken */ + )) { + parseExpression(); + } + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + } + return { name, isBracketed }; + } + function isObjectOrObjectArrayTypeReference(node) { + switch (node.kind) { + case 149: + return true; + case 185: + return isObjectOrObjectArrayTypeReference(node.elementType); + default: + return ts6.isTypeReferenceNode(node) && ts6.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; + } + } + function parseParameterOrPropertyTag(start2, tagName, target, indent) { + var typeExpression = tryParseTypeExpression(); + var isNameFirst = !typeExpression; + skipWhitespaceOrAsterisk(); + var _a2 = parseBracketNameInPropertyAndParamTag(), name = _a2.name, isBracketed = _a2.isBracketed; + var indentText = skipWhitespaceOrAsterisk(); + if (isNameFirst && !lookAhead(parseJSDocLinkPrefix)) { + typeExpression = tryParseTypeExpression(); + } + var comment = parseTrailingTagComments(start2, getNodePos(), indent, indentText); + var nestedTypeLiteral = target !== 4 && parseNestedTypeLiteral(typeExpression, name, target, indent); + if (nestedTypeLiteral) { + typeExpression = nestedTypeLiteral; + isNameFirst = true; + } + var result = target === 1 ? factory.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment); + return finishNode(result, start2); + } + function parseNestedTypeLiteral(typeExpression, name, target, indent) { + if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { + var pos = getNodePos(); + var child = void 0; + var children = void 0; + while (child = tryParse(function() { + return parseChildParameterOrPropertyTag(target, indent, name); + })) { + if (child.kind === 343 || child.kind === 350) { + children = ts6.append(children, child); + } + } + if (children) { + var literal2 = finishNode(factory.createJSDocTypeLiteral( + children, + typeExpression.type.kind === 185 + /* SyntaxKind.ArrayType */ + ), pos); + return finishNode(factory.createJSDocTypeExpression(literal2), pos); + } + } + } + function parseReturnTag(start2, tagName, indent, indentText) { + if (ts6.some(tags, ts6.isJSDocReturnTag)) { + parseErrorAt(tagName.pos, scanner.getTokenPos(), ts6.Diagnostics._0_tag_already_specified, tagName.escapedText); + } + var typeExpression = tryParseTypeExpression(); + return finishNode(factory.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent, indentText)), start2); + } + function parseTypeTag(start2, tagName, indent, indentText) { + if (ts6.some(tags, ts6.isJSDocTypeTag)) { + parseErrorAt(tagName.pos, scanner.getTokenPos(), ts6.Diagnostics._0_tag_already_specified, tagName.escapedText); + } + var typeExpression = parseJSDocTypeExpression( + /*mayOmitBraces*/ + true + ); + var comments2 = indent !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), indent, indentText) : void 0; + return finishNode(factory.createJSDocTypeTag(tagName, typeExpression, comments2), start2); + } + function parseSeeTag(start2, tagName, indent, indentText) { + var isMarkdownOrJSDocLink = token() === 22 || lookAhead(function() { + return nextTokenJSDoc() === 59 && ts6.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && isJSDocLinkTag(scanner.getTokenValue()); + }); + var nameExpression = isMarkdownOrJSDocLink ? void 0 : parseJSDocNameReference(); + var comments2 = indent !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), indent, indentText) : void 0; + return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments2), start2); + } + function parseAuthorTag(start2, tagName, indent, indentText) { + var commentStart = getNodePos(); + var textOnly = parseAuthorNameAndEmail(); + var commentEnd = scanner.getStartPos(); + var comments2 = parseTrailingTagComments(start2, commentEnd, indent, indentText); + if (!comments2) { + commentEnd = scanner.getStartPos(); + } + var allParts = typeof comments2 !== "string" ? createNodeArray(ts6.concatenate([finishNode(textOnly, commentStart, commentEnd)], comments2), commentStart) : textOnly.text + comments2; + return finishNode(factory.createJSDocAuthorTag(tagName, allParts), start2); + } + function parseAuthorNameAndEmail() { + var comments2 = []; + var inEmail = false; + var token2 = scanner.getToken(); + while (token2 !== 1 && token2 !== 4) { + if (token2 === 29) { + inEmail = true; + } else if (token2 === 59 && !inEmail) { + break; + } else if (token2 === 31 && inEmail) { + comments2.push(scanner.getTokenText()); + scanner.setTextPos(scanner.getTokenPos() + 1); + break; + } + comments2.push(scanner.getTokenText()); + token2 = nextTokenJSDoc(); + } + return factory.createJSDocText(comments2.join("")); + } + function parseImplementsTag(start2, tagName, margin, indentText) { + var className = parseExpressionWithTypeArgumentsForAugments(); + return finishNode(factory.createJSDocImplementsTag(tagName, className, parseTrailingTagComments(start2, getNodePos(), margin, indentText)), start2); + } + function parseAugmentsTag(start2, tagName, margin, indentText) { + var className = parseExpressionWithTypeArgumentsForAugments(); + return finishNode(factory.createJSDocAugmentsTag(tagName, className, parseTrailingTagComments(start2, getNodePos(), margin, indentText)), start2); + } + function parseExpressionWithTypeArgumentsForAugments() { + var usedBrace = parseOptional( + 18 + /* SyntaxKind.OpenBraceToken */ + ); + var pos = getNodePos(); + var expression = parsePropertyAccessEntityNameExpression(); + var typeArguments = tryParseTypeArguments(); + var node = factory.createExpressionWithTypeArguments(expression, typeArguments); + var res = finishNode(node, pos); + if (usedBrace) { + parseExpected( + 19 + /* SyntaxKind.CloseBraceToken */ + ); + } + return res; + } + function parsePropertyAccessEntityNameExpression() { + var pos = getNodePos(); + var node = parseJSDocIdentifierName(); + while (parseOptional( + 24 + /* SyntaxKind.DotToken */ + )) { + var name = parseJSDocIdentifierName(); + node = finishNode(factory.createPropertyAccessExpression(node, name), pos); + } + return node; + } + function parseSimpleTag(start2, createTag, tagName, margin, indentText) { + return finishNode(createTag(tagName, parseTrailingTagComments(start2, getNodePos(), margin, indentText)), start2); + } + function parseThisTag(start2, tagName, margin, indentText) { + var typeExpression = parseJSDocTypeExpression( + /*mayOmitBraces*/ + true + ); + skipWhitespace(); + return finishNode(factory.createJSDocThisTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), margin, indentText)), start2); + } + function parseEnumTag(start2, tagName, margin, indentText) { + var typeExpression = parseJSDocTypeExpression( + /*mayOmitBraces*/ + true + ); + skipWhitespace(); + return finishNode(factory.createJSDocEnumTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), margin, indentText)), start2); + } + function parseTypedefTag(start2, tagName, indent, indentText) { + var _a2; + var typeExpression = tryParseTypeExpression(); + skipWhitespaceOrAsterisk(); + var fullName = parseJSDocTypeNameWithNamespace(); + skipWhitespace(); + var comment = parseTagComments(indent); + var end2; + if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) { + var child = void 0; + var childTypeTag = void 0; + var jsDocPropertyTags = void 0; + var hasChildren = false; + while (child = tryParse(function() { + return parseChildPropertyTag(indent); + })) { + hasChildren = true; + if (child.kind === 346) { + if (childTypeTag) { + var lastError = parseErrorAtCurrentToken(ts6.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + if (lastError) { + ts6.addRelatedInfo(lastError, ts6.createDetachedDiagnostic(fileName, 0, 0, ts6.Diagnostics.The_tag_was_first_specified_here)); + } + break; + } else { + childTypeTag = child; + } + } else { + jsDocPropertyTags = ts6.append(jsDocPropertyTags, child); + } + } + if (hasChildren) { + var isArrayType = typeExpression && typeExpression.type.kind === 185; + var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); + typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : finishNode(jsdocTypeLiteral, start2); + end2 = typeExpression.end; + } + } + end2 = end2 || comment !== void 0 ? getNodePos() : ((_a2 = fullName !== null && fullName !== void 0 ? fullName : typeExpression) !== null && _a2 !== void 0 ? _a2 : tagName).end; + if (!comment) { + comment = parseTrailingTagComments(start2, end2, indent, indentText); + } + var typedefTag = factory.createJSDocTypedefTag(tagName, typeExpression, fullName, comment); + return finishNode(typedefTag, start2, end2); + } + function parseJSDocTypeNameWithNamespace(nested) { + var pos = scanner.getTokenPos(); + if (!ts6.tokenIsIdentifierOrKeyword(token())) { + return void 0; + } + var typeNameOrNamespaceName = parseJSDocIdentifierName(); + if (parseOptional( + 24 + /* SyntaxKind.DotToken */ + )) { + var body = parseJSDocTypeNameWithNamespace( + /*nested*/ + true + ); + var jsDocNamespaceNode = factory.createModuleDeclaration( + /*modifiers*/ + void 0, + typeNameOrNamespaceName, + body, + nested ? 4 : void 0 + ); + return finishNode(jsDocNamespaceNode, pos); + } + if (nested) { + typeNameOrNamespaceName.isInJSDocNamespace = true; + } + return typeNameOrNamespaceName; + } + function parseCallbackTagParameters(indent) { + var pos = getNodePos(); + var child; + var parameters; + while (child = tryParse(function() { + return parseChildParameterOrPropertyTag(4, indent); + })) { + parameters = ts6.append(parameters, child); + } + return createNodeArray(parameters || [], pos); + } + function parseCallbackTag(start2, tagName, indent, indentText) { + var fullName = parseJSDocTypeNameWithNamespace(); + skipWhitespace(); + var comment = parseTagComments(indent); + var parameters = parseCallbackTagParameters(indent); + var returnTag = tryParse(function() { + if (parseOptionalJsdoc( + 59 + /* SyntaxKind.AtToken */ + )) { + var tag = parseTag(indent); + if (tag && tag.kind === 344) { + return tag; + } + } + }); + var typeExpression = finishNode(factory.createJSDocSignature( + /*typeParameters*/ + void 0, + parameters, + returnTag + ), start2); + if (!comment) { + comment = parseTrailingTagComments(start2, getNodePos(), indent, indentText); + } + var end2 = comment !== void 0 ? getNodePos() : typeExpression.end; + return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start2, end2); + } + function escapedTextsEqual(a, b) { + while (!ts6.isIdentifier(a) || !ts6.isIdentifier(b)) { + if (!ts6.isIdentifier(a) && !ts6.isIdentifier(b) && a.right.escapedText === b.right.escapedText) { + a = a.left; + b = b.left; + } else { + return false; + } + } + return a.escapedText === b.escapedText; + } + function parseChildPropertyTag(indent) { + return parseChildParameterOrPropertyTag(1, indent); + } + function parseChildParameterOrPropertyTag(target, indent, name) { + var canParseTag = true; + var seenAsterisk = false; + while (true) { + switch (nextTokenJSDoc()) { + case 59: + if (canParseTag) { + var child = tryParseChildTag(target, indent); + if (child && (child.kind === 343 || child.kind === 350) && target !== 4 && name && (ts6.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { + return false; + } + return child; + } + seenAsterisk = false; + break; + case 4: + canParseTag = true; + seenAsterisk = false; + break; + case 41: + if (seenAsterisk) { + canParseTag = false; + } + seenAsterisk = true; + break; + case 79: + canParseTag = false; + break; + case 1: + return false; + } + } + } + function tryParseChildTag(target, indent) { + ts6.Debug.assert( + token() === 59 + /* SyntaxKind.AtToken */ + ); + var start2 = scanner.getStartPos(); + nextTokenJSDoc(); + var tagName = parseJSDocIdentifierName(); + skipWhitespace(); + var t; + switch (tagName.escapedText) { + case "type": + return target === 1 && parseTypeTag(start2, tagName); + case "prop": + case "property": + t = 1; + break; + case "arg": + case "argument": + case "param": + t = 2 | 4; + break; + default: + return false; + } + if (!(target & t)) { + return false; + } + return parseParameterOrPropertyTag(start2, tagName, target, indent); + } + function parseTemplateTagTypeParameter() { + var typeParameterPos = getNodePos(); + var isBracketed = parseOptionalJsdoc( + 22 + /* SyntaxKind.OpenBracketToken */ + ); + if (isBracketed) { + skipWhitespace(); + } + var name = parseJSDocIdentifierName(ts6.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces); + var defaultType; + if (isBracketed) { + skipWhitespace(); + parseExpected( + 63 + /* SyntaxKind.EqualsToken */ + ); + defaultType = doInsideOfContext(8388608, parseJSDocType); + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + } + if (ts6.nodeIsMissing(name)) { + return void 0; + } + return finishNode(factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + name, + /*constraint*/ + void 0, + defaultType + ), typeParameterPos); + } + function parseTemplateTagTypeParameters() { + var pos = getNodePos(); + var typeParameters = []; + do { + skipWhitespace(); + var node = parseTemplateTagTypeParameter(); + if (node !== void 0) { + typeParameters.push(node); + } + skipWhitespaceOrAsterisk(); + } while (parseOptionalJsdoc( + 27 + /* SyntaxKind.CommaToken */ + )); + return createNodeArray(typeParameters, pos); + } + function parseTemplateTag(start2, tagName, indent, indentText) { + var constraint = token() === 18 ? parseJSDocTypeExpression() : void 0; + var typeParameters = parseTemplateTagTypeParameters(); + return finishNode(factory.createJSDocTemplateTag(tagName, constraint, typeParameters, parseTrailingTagComments(start2, getNodePos(), indent, indentText)), start2); + } + function parseOptionalJsdoc(t) { + if (token() === t) { + nextTokenJSDoc(); + return true; + } + return false; + } + function parseJSDocEntityName() { + var entity = parseJSDocIdentifierName(); + if (parseOptional( + 22 + /* SyntaxKind.OpenBracketToken */ + )) { + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + } + while (parseOptional( + 24 + /* SyntaxKind.DotToken */ + )) { + var name = parseJSDocIdentifierName(); + if (parseOptional( + 22 + /* SyntaxKind.OpenBracketToken */ + )) { + parseExpected( + 23 + /* SyntaxKind.CloseBracketToken */ + ); + } + entity = createQualifiedName(entity, name); + } + return entity; + } + function parseJSDocIdentifierName(message) { + if (!ts6.tokenIsIdentifierOrKeyword(token())) { + return createMissingNode( + 79, + /*reportAtCurrentPosition*/ + !message, + message || ts6.Diagnostics.Identifier_expected + ); + } + identifierCount++; + var pos = scanner.getTokenPos(); + var end2 = scanner.getTextPos(); + var originalKeywordKind = token(); + var text = internIdentifier(scanner.getTokenValue()); + var result = finishNode(factory.createIdentifier( + text, + /*typeArguments*/ + void 0, + originalKeywordKind + ), pos, end2); + nextTokenJSDoc(); + return result; + } + } + })(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {})); + })(Parser || (Parser = {})); + var IncrementalParser; + (function(IncrementalParser2) { + function updateSourceFile2(sourceFile, newText, textChangeRange, aggressiveChecks) { + aggressiveChecks = aggressiveChecks || ts6.Debug.shouldAssert( + 2 + /* AssertionLevel.Aggressive */ + ); + checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); + if (ts6.textChangeRangeIsUnchanged(textChangeRange)) { + return sourceFile; + } + if (sourceFile.statements.length === 0) { + return Parser.parseSourceFile( + sourceFile.fileName, + newText, + sourceFile.languageVersion, + /*syntaxCursor*/ + void 0, + /*setParentNodes*/ + true, + sourceFile.scriptKind, + sourceFile.setExternalModuleIndicator + ); + } + var incrementalSourceFile = sourceFile; + ts6.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); + incrementalSourceFile.hasBeenIncrementallyParsed = true; + Parser.fixupParentReferences(incrementalSourceFile); + var oldText = sourceFile.text; + var syntaxCursor = createSyntaxCursor(sourceFile); + var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); + ts6.Debug.assert(changeRange.span.start <= textChangeRange.span.start); + ts6.Debug.assert(ts6.textSpanEnd(changeRange.span) === ts6.textSpanEnd(textChangeRange.span)); + ts6.Debug.assert(ts6.textSpanEnd(ts6.textChangeRangeNewSpan(changeRange)) === ts6.textSpanEnd(ts6.textChangeRangeNewSpan(textChangeRange))); + var delta = ts6.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; + updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts6.textSpanEnd(changeRange.span), ts6.textSpanEnd(ts6.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); + var result = Parser.parseSourceFile( + sourceFile.fileName, + newText, + sourceFile.languageVersion, + syntaxCursor, + /*setParentNodes*/ + true, + sourceFile.scriptKind, + sourceFile.setExternalModuleIndicator + ); + result.commentDirectives = getNewCommentDirectives(sourceFile.commentDirectives, result.commentDirectives, changeRange.span.start, ts6.textSpanEnd(changeRange.span), delta, oldText, newText, aggressiveChecks); + result.impliedNodeFormat = sourceFile.impliedNodeFormat; + return result; + } + IncrementalParser2.updateSourceFile = updateSourceFile2; + function getNewCommentDirectives(oldDirectives, newDirectives, changeStart, changeRangeOldEnd, delta, oldText, newText, aggressiveChecks) { + if (!oldDirectives) + return newDirectives; + var commentDirectives; + var addedNewlyScannedDirectives = false; + for (var _i = 0, oldDirectives_1 = oldDirectives; _i < oldDirectives_1.length; _i++) { + var directive = oldDirectives_1[_i]; + var range2 = directive.range, type = directive.type; + if (range2.end < changeStart) { + commentDirectives = ts6.append(commentDirectives, directive); + } else if (range2.pos > changeRangeOldEnd) { + addNewlyScannedDirectives(); + var updatedDirective = { + range: { pos: range2.pos + delta, end: range2.end + delta }, + type + }; + commentDirectives = ts6.append(commentDirectives, updatedDirective); + if (aggressiveChecks) { + ts6.Debug.assert(oldText.substring(range2.pos, range2.end) === newText.substring(updatedDirective.range.pos, updatedDirective.range.end)); + } + } + } + addNewlyScannedDirectives(); + return commentDirectives; + function addNewlyScannedDirectives() { + if (addedNewlyScannedDirectives) + return; + addedNewlyScannedDirectives = true; + if (!commentDirectives) { + commentDirectives = newDirectives; + } else if (newDirectives) { + commentDirectives.push.apply(commentDirectives, newDirectives); + } + } + } + function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { + if (isArray) { + visitArray(element); + } else { + visitNode2(element); + } + return; + function visitNode2(node) { + var text = ""; + if (aggressiveChecks && shouldCheckNode(node)) { + text = oldText.substring(node.pos, node.end); + } + if (node._children) { + node._children = void 0; + } + ts6.setTextRangePosEnd(node, node.pos + delta, node.end + delta); + if (aggressiveChecks && shouldCheckNode(node)) { + ts6.Debug.assert(text === newText.substring(node.pos, node.end)); + } + forEachChild(node, visitNode2, visitArray); + if (ts6.hasJSDocNodes(node)) { + for (var _i = 0, _a2 = node.jsDoc; _i < _a2.length; _i++) { + var jsDocComment = _a2[_i]; + visitNode2(jsDocComment); + } + } + checkNodePositions(node, aggressiveChecks); + } + function visitArray(array) { + array._children = void 0; + ts6.setTextRangePosEnd(array, array.pos + delta, array.end + delta); + for (var _i = 0, array_9 = array; _i < array_9.length; _i++) { + var node = array_9[_i]; + visitNode2(node); + } + } + } + function shouldCheckNode(node) { + switch (node.kind) { + case 10: + case 8: + case 79: + return true; + } + return false; + } + function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { + ts6.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); + ts6.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + ts6.Debug.assert(element.pos <= element.end); + var pos = Math.min(element.pos, changeRangeNewEnd); + var end = element.end >= changeRangeOldEnd ? ( + // Element ends after the change range. Always adjust the end pos. + element.end + delta + ) : ( + // Element ends in the change range. The element will keep its position if + // possible. Or Move backward to the new-end if it's in the 'Y' range. + Math.min(element.end, changeRangeNewEnd) + ); + ts6.Debug.assert(pos <= end); + if (element.parent) { + ts6.Debug.assertGreaterThanOrEqual(pos, element.parent.pos); + ts6.Debug.assertLessThanOrEqual(end, element.parent.end); + } + ts6.setTextRangePosEnd(element, pos, end); + } + function checkNodePositions(node, aggressiveChecks) { + if (aggressiveChecks) { + var pos_3 = node.pos; + var visitNode_1 = function(child) { + ts6.Debug.assert(child.pos >= pos_3); + pos_3 = child.end; + }; + if (ts6.hasJSDocNodes(node)) { + for (var _i = 0, _a2 = node.jsDoc; _i < _a2.length; _i++) { + var jsDocComment = _a2[_i]; + visitNode_1(jsDocComment); + } + } + forEachChild(node, visitNode_1); + ts6.Debug.assert(pos_3 <= node.end); + } + } + function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { + visitNode2(sourceFile); + return; + function visitNode2(child) { + ts6.Debug.assert(child.pos <= child.end); + if (child.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange( + child, + /*isArray*/ + false, + delta, + oldText, + newText, + aggressiveChecks + ); + return; + } + var fullEnd = child.end; + if (fullEnd >= changeStart) { + child.intersectsChange = true; + child._children = void 0; + adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + forEachChild(child, visitNode2, visitArray); + if (ts6.hasJSDocNodes(child)) { + for (var _i = 0, _a2 = child.jsDoc; _i < _a2.length; _i++) { + var jsDocComment = _a2[_i]; + visitNode2(jsDocComment); + } + } + checkNodePositions(child, aggressiveChecks); + return; + } + ts6.Debug.assert(fullEnd < changeStart); + } + function visitArray(array) { + ts6.Debug.assert(array.pos <= array.end); + if (array.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange( + array, + /*isArray*/ + true, + delta, + oldText, + newText, + aggressiveChecks + ); + return; + } + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + array._children = void 0; + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var _i = 0, array_10 = array; _i < array_10.length; _i++) { + var node = array_10[_i]; + visitNode2(node); + } + return; + } + ts6.Debug.assert(fullEnd < changeStart); + } + } + function extendToAffectedRange(sourceFile, changeRange) { + var maxLookahead = 1; + var start = changeRange.span.start; + for (var i = 0; start > 0 && i <= maxLookahead; i++) { + var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + ts6.Debug.assert(nearestNode.pos <= start); + var position = nearestNode.pos; + start = Math.max(0, position - 1); + } + var finalSpan = ts6.createTextSpanFromBounds(start, ts6.textSpanEnd(changeRange.span)); + var finalLength = changeRange.newLength + (changeRange.span.start - start); + return ts6.createTextChangeRange(finalSpan, finalLength); + } + function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) { + var bestResult = sourceFile; + var lastNodeEntirelyBeforePosition; + forEachChild(sourceFile, visit); + if (lastNodeEntirelyBeforePosition) { + var lastChildOfLastEntireNodeBeforePosition = getLastDescendant(lastNodeEntirelyBeforePosition); + if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { + bestResult = lastChildOfLastEntireNodeBeforePosition; + } + } + return bestResult; + function getLastDescendant(node) { + while (true) { + var lastChild = ts6.getLastChild(node); + if (lastChild) { + node = lastChild; + } else { + return node; + } + } + } + function visit(child) { + if (ts6.nodeIsMissing(child)) { + return; + } + if (child.pos <= position) { + if (child.pos >= bestResult.pos) { + bestResult = child; + } + if (position < child.end) { + forEachChild(child, visit); + return true; + } else { + ts6.Debug.assert(child.end <= position); + lastNodeEntirelyBeforePosition = child; + } + } else { + ts6.Debug.assert(child.pos > position); + return true; + } + } + } + function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { + var oldText = sourceFile.text; + if (textChangeRange) { + ts6.Debug.assert(oldText.length - textChangeRange.span.length + textChangeRange.newLength === newText.length); + if (aggressiveChecks || ts6.Debug.shouldAssert( + 3 + /* AssertionLevel.VeryAggressive */ + )) { + var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + var newTextPrefix = newText.substr(0, textChangeRange.span.start); + ts6.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.substring(ts6.textSpanEnd(textChangeRange.span), oldText.length); + var newTextSuffix = newText.substring(ts6.textSpanEnd(ts6.textChangeRangeNewSpan(textChangeRange)), newText.length); + ts6.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + } + function createSyntaxCursor(sourceFile) { + var currentArray = sourceFile.statements; + var currentArrayIndex = 0; + ts6.Debug.assert(currentArrayIndex < currentArray.length); + var current = currentArray[currentArrayIndex]; + var lastQueriedPosition = -1; + return { + currentNode: function(position) { + if (position !== lastQueriedPosition) { + if (current && current.end === position && currentArrayIndex < currentArray.length - 1) { + currentArrayIndex++; + current = currentArray[currentArrayIndex]; + } + if (!current || current.pos !== position) { + findHighestListElementThatStartsAtPosition(position); + } + } + lastQueriedPosition = position; + ts6.Debug.assert(!current || current.pos === position); + return current; + } + }; + function findHighestListElementThatStartsAtPosition(position) { + currentArray = void 0; + currentArrayIndex = -1; + current = void 0; + forEachChild(sourceFile, visitNode2, visitArray); + return; + function visitNode2(node) { + if (position >= node.pos && position < node.end) { + forEachChild(node, visitNode2, visitArray); + return true; + } + return false; + } + function visitArray(array) { + if (position >= array.pos && position < array.end) { + for (var i = 0; i < array.length; i++) { + var child = array[i]; + if (child) { + if (child.pos === position) { + currentArray = array; + currentArrayIndex = i; + current = child; + return true; + } else { + if (child.pos < position && position < child.end) { + forEachChild(child, visitNode2, visitArray); + return true; + } + } + } + } + } + return false; + } + } + } + IncrementalParser2.createSyntaxCursor = createSyntaxCursor; + var InvalidPosition; + (function(InvalidPosition2) { + InvalidPosition2[InvalidPosition2["Value"] = -1] = "Value"; + })(InvalidPosition || (InvalidPosition = {})); + })(IncrementalParser || (IncrementalParser = {})); + function isDeclarationFileName(fileName) { + return ts6.fileExtensionIsOneOf(fileName, ts6.supportedDeclarationExtensions); + } + ts6.isDeclarationFileName = isDeclarationFileName; + function parseResolutionMode(mode, pos, end, reportDiagnostic) { + if (!mode) { + return void 0; + } + if (mode === "import") { + return ts6.ModuleKind.ESNext; + } + if (mode === "require") { + return ts6.ModuleKind.CommonJS; + } + reportDiagnostic(pos, end - pos, ts6.Diagnostics.resolution_mode_should_be_either_require_or_import); + return void 0; + } + function processCommentPragmas(context, sourceText) { + var pragmas = []; + for (var _i = 0, _a2 = ts6.getLeadingCommentRanges(sourceText, 0) || ts6.emptyArray; _i < _a2.length; _i++) { + var range2 = _a2[_i]; + var comment = sourceText.substring(range2.pos, range2.end); + extractPragmas(pragmas, range2, comment); + } + context.pragmas = new ts6.Map(); + for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) { + var pragma = pragmas_1[_b]; + if (context.pragmas.has(pragma.name)) { + var currentValue = context.pragmas.get(pragma.name); + if (currentValue instanceof Array) { + currentValue.push(pragma.args); + } else { + context.pragmas.set(pragma.name, [currentValue, pragma.args]); + } + continue; + } + context.pragmas.set(pragma.name, pragma.args); + } + } + ts6.processCommentPragmas = processCommentPragmas; + function processPragmasIntoFields(context, reportDiagnostic) { + context.checkJsDirective = void 0; + context.referencedFiles = []; + context.typeReferenceDirectives = []; + context.libReferenceDirectives = []; + context.amdDependencies = []; + context.hasNoDefaultLib = false; + context.pragmas.forEach(function(entryOrList, key) { + switch (key) { + case "reference": { + var referencedFiles_1 = context.referencedFiles; + var typeReferenceDirectives_1 = context.typeReferenceDirectives; + var libReferenceDirectives_1 = context.libReferenceDirectives; + ts6.forEach(ts6.toArray(entryOrList), function(arg) { + var _a2 = arg.arguments, types = _a2.types, lib = _a2.lib, path = _a2.path, res = _a2["resolution-mode"]; + if (arg.arguments["no-default-lib"]) { + context.hasNoDefaultLib = true; + } else if (types) { + var parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic); + typeReferenceDirectives_1.push(__assign({ pos: types.pos, end: types.end, fileName: types.value }, parsed ? { resolutionMode: parsed } : {})); + } else if (lib) { + libReferenceDirectives_1.push({ pos: lib.pos, end: lib.end, fileName: lib.value }); + } else if (path) { + referencedFiles_1.push({ pos: path.pos, end: path.end, fileName: path.value }); + } else { + reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, ts6.Diagnostics.Invalid_reference_directive_syntax); + } + }); + break; + } + case "amd-dependency": { + context.amdDependencies = ts6.map(ts6.toArray(entryOrList), function(x) { + return { name: x.arguments.name, path: x.arguments.path }; + }); + break; + } + case "amd-module": { + if (entryOrList instanceof Array) { + for (var _i = 0, entryOrList_1 = entryOrList; _i < entryOrList_1.length; _i++) { + var entry = entryOrList_1[_i]; + if (context.moduleName) { + reportDiagnostic(entry.range.pos, entry.range.end - entry.range.pos, ts6.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments); + } + context.moduleName = entry.arguments.name; + } + } else { + context.moduleName = entryOrList.arguments.name; + } + break; + } + case "ts-nocheck": + case "ts-check": { + ts6.forEach(ts6.toArray(entryOrList), function(entry2) { + if (!context.checkJsDirective || entry2.range.pos > context.checkJsDirective.pos) { + context.checkJsDirective = { + enabled: key === "ts-check", + end: entry2.range.end, + pos: entry2.range.pos + }; + } + }); + break; + } + case "jsx": + case "jsxfrag": + case "jsximportsource": + case "jsxruntime": + return; + default: + ts6.Debug.fail("Unhandled pragma kind"); + } + }); + } + ts6.processPragmasIntoFields = processPragmasIntoFields; + var namedArgRegExCache = new ts6.Map(); + function getNamedArgRegEx(name) { + if (namedArgRegExCache.has(name)) { + return namedArgRegExCache.get(name); + } + var result = new RegExp("(\\s".concat(name, `\\s*=\\s*)(?:(?:'([^']*)')|(?:"([^"]*)"))`), "im"); + namedArgRegExCache.set(name, result); + return result; + } + var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im; + var singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im; + function extractPragmas(pragmas, range2, text) { + var tripleSlash = range2.kind === 2 && tripleSlashXMLCommentStartRegEx.exec(text); + if (tripleSlash) { + var name = tripleSlash[1].toLowerCase(); + var pragma = ts6.commentPragmas[name]; + if (!pragma || !(pragma.kind & 1)) { + return; + } + if (pragma.args) { + var argument = {}; + for (var _i = 0, _a2 = pragma.args; _i < _a2.length; _i++) { + var arg = _a2[_i]; + var matcher = getNamedArgRegEx(arg.name); + var matchResult = matcher.exec(text); + if (!matchResult && !arg.optional) { + return; + } else if (matchResult) { + var value = matchResult[2] || matchResult[3]; + if (arg.captureSpan) { + var startPos = range2.pos + matchResult.index + matchResult[1].length + 1; + argument[arg.name] = { + value, + pos: startPos, + end: startPos + value.length + }; + } else { + argument[arg.name] = value; + } + } + } + pragmas.push({ name, args: { arguments: argument, range: range2 } }); + } else { + pragmas.push({ name, args: { arguments: {}, range: range2 } }); + } + return; + } + var singleLine = range2.kind === 2 && singleLinePragmaRegEx.exec(text); + if (singleLine) { + return addPragmaForMatch(pragmas, range2, 2, singleLine); + } + if (range2.kind === 3) { + var multiLinePragmaRegEx = /@(\S+)(\s+.*)?$/gim; + var multiLineMatch = void 0; + while (multiLineMatch = multiLinePragmaRegEx.exec(text)) { + addPragmaForMatch(pragmas, range2, 4, multiLineMatch); + } + } + } + function addPragmaForMatch(pragmas, range2, kind, match) { + if (!match) + return; + var name = match[1].toLowerCase(); + var pragma = ts6.commentPragmas[name]; + if (!pragma || !(pragma.kind & kind)) { + return; + } + var args = match[2]; + var argument = getNamedPragmaArguments(pragma, args); + if (argument === "fail") + return; + pragmas.push({ name, args: { arguments: argument, range: range2 } }); + return; + } + function getNamedPragmaArguments(pragma, text) { + if (!text) + return {}; + if (!pragma.args) + return {}; + var args = ts6.trimString(text).split(/\s+/); + var argMap = {}; + for (var i = 0; i < pragma.args.length; i++) { + var argument = pragma.args[i]; + if (!args[i] && !argument.optional) { + return "fail"; + } + if (argument.captureSpan) { + return ts6.Debug.fail("Capture spans not yet implemented for non-xml pragmas"); + } + argMap[argument.name] = args[i]; + } + return argMap; + } + function tagNamesAreEquivalent(lhs, rhs) { + if (lhs.kind !== rhs.kind) { + return false; + } + if (lhs.kind === 79) { + return lhs.escapedText === rhs.escapedText; + } + if (lhs.kind === 108) { + return true; + } + return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); + } + ts6.tagNamesAreEquivalent = tagNamesAreEquivalent; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.compileOnSaveCommandLineOption = { + name: "compileOnSave", + type: "boolean", + defaultValueDescription: false + }; + var jsxOptionMap = new ts6.Map(ts6.getEntries({ + "preserve": 1, + "react-native": 3, + "react": 2, + "react-jsx": 4, + "react-jsxdev": 5 + })); + ts6.inverseJsxOptionMap = new ts6.Map(ts6.arrayFrom(ts6.mapIterator(jsxOptionMap.entries(), function(_a) { + var key = _a[0], value = _a[1]; + return ["" + value, key]; + }))); + var libEntries = [ + // JavaScript only + ["es5", "lib.es5.d.ts"], + ["es6", "lib.es2015.d.ts"], + ["es2015", "lib.es2015.d.ts"], + ["es7", "lib.es2016.d.ts"], + ["es2016", "lib.es2016.d.ts"], + ["es2017", "lib.es2017.d.ts"], + ["es2018", "lib.es2018.d.ts"], + ["es2019", "lib.es2019.d.ts"], + ["es2020", "lib.es2020.d.ts"], + ["es2021", "lib.es2021.d.ts"], + ["es2022", "lib.es2022.d.ts"], + ["esnext", "lib.esnext.d.ts"], + // Host only + ["dom", "lib.dom.d.ts"], + ["dom.iterable", "lib.dom.iterable.d.ts"], + ["webworker", "lib.webworker.d.ts"], + ["webworker.importscripts", "lib.webworker.importscripts.d.ts"], + ["webworker.iterable", "lib.webworker.iterable.d.ts"], + ["scripthost", "lib.scripthost.d.ts"], + // ES2015 Or ESNext By-feature options + ["es2015.core", "lib.es2015.core.d.ts"], + ["es2015.collection", "lib.es2015.collection.d.ts"], + ["es2015.generator", "lib.es2015.generator.d.ts"], + ["es2015.iterable", "lib.es2015.iterable.d.ts"], + ["es2015.promise", "lib.es2015.promise.d.ts"], + ["es2015.proxy", "lib.es2015.proxy.d.ts"], + ["es2015.reflect", "lib.es2015.reflect.d.ts"], + ["es2015.symbol", "lib.es2015.symbol.d.ts"], + ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"], + ["es2016.array.include", "lib.es2016.array.include.d.ts"], + ["es2017.object", "lib.es2017.object.d.ts"], + ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"], + ["es2017.string", "lib.es2017.string.d.ts"], + ["es2017.intl", "lib.es2017.intl.d.ts"], + ["es2017.typedarrays", "lib.es2017.typedarrays.d.ts"], + ["es2018.asyncgenerator", "lib.es2018.asyncgenerator.d.ts"], + ["es2018.asynciterable", "lib.es2018.asynciterable.d.ts"], + ["es2018.intl", "lib.es2018.intl.d.ts"], + ["es2018.promise", "lib.es2018.promise.d.ts"], + ["es2018.regexp", "lib.es2018.regexp.d.ts"], + ["es2019.array", "lib.es2019.array.d.ts"], + ["es2019.object", "lib.es2019.object.d.ts"], + ["es2019.string", "lib.es2019.string.d.ts"], + ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], + ["es2020.bigint", "lib.es2020.bigint.d.ts"], + ["es2020.date", "lib.es2020.date.d.ts"], + ["es2020.promise", "lib.es2020.promise.d.ts"], + ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"], + ["es2020.string", "lib.es2020.string.d.ts"], + ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"], + ["es2020.intl", "lib.es2020.intl.d.ts"], + ["es2020.number", "lib.es2020.number.d.ts"], + ["es2021.promise", "lib.es2021.promise.d.ts"], + ["es2021.string", "lib.es2021.string.d.ts"], + ["es2021.weakref", "lib.es2021.weakref.d.ts"], + ["es2021.intl", "lib.es2021.intl.d.ts"], + ["es2022.array", "lib.es2022.array.d.ts"], + ["es2022.error", "lib.es2022.error.d.ts"], + ["es2022.intl", "lib.es2022.intl.d.ts"], + ["es2022.object", "lib.es2022.object.d.ts"], + ["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"], + ["es2022.string", "lib.es2022.string.d.ts"], + ["esnext.array", "lib.es2022.array.d.ts"], + ["esnext.symbol", "lib.es2019.symbol.d.ts"], + ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], + ["esnext.intl", "lib.esnext.intl.d.ts"], + ["esnext.bigint", "lib.es2020.bigint.d.ts"], + ["esnext.string", "lib.es2022.string.d.ts"], + ["esnext.promise", "lib.es2021.promise.d.ts"], + ["esnext.weakref", "lib.es2021.weakref.d.ts"] + ]; + ts6.libs = libEntries.map(function(entry) { + return entry[0]; + }); + ts6.libMap = new ts6.Map(libEntries); + ts6.optionsForWatch = [ + { + name: "watchFile", + type: new ts6.Map(ts6.getEntries({ + fixedpollinginterval: ts6.WatchFileKind.FixedPollingInterval, + prioritypollinginterval: ts6.WatchFileKind.PriorityPollingInterval, + dynamicprioritypolling: ts6.WatchFileKind.DynamicPriorityPolling, + fixedchunksizepolling: ts6.WatchFileKind.FixedChunkSizePolling, + usefsevents: ts6.WatchFileKind.UseFsEvents, + usefseventsonparentdirectory: ts6.WatchFileKind.UseFsEventsOnParentDirectory + })), + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Specify_how_the_TypeScript_watch_mode_works, + defaultValueDescription: ts6.WatchFileKind.UseFsEvents + }, + { + name: "watchDirectory", + type: new ts6.Map(ts6.getEntries({ + usefsevents: ts6.WatchDirectoryKind.UseFsEvents, + fixedpollinginterval: ts6.WatchDirectoryKind.FixedPollingInterval, + dynamicprioritypolling: ts6.WatchDirectoryKind.DynamicPriorityPolling, + fixedchunksizepolling: ts6.WatchDirectoryKind.FixedChunkSizePolling + })), + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality, + defaultValueDescription: ts6.WatchDirectoryKind.UseFsEvents + }, + { + name: "fallbackPolling", + type: new ts6.Map(ts6.getEntries({ + fixedinterval: ts6.PollingWatchKind.FixedInterval, + priorityinterval: ts6.PollingWatchKind.PriorityInterval, + dynamicpriority: ts6.PollingWatchKind.DynamicPriority, + fixedchunksize: ts6.PollingWatchKind.FixedChunkSize + })), + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers, + defaultValueDescription: ts6.PollingWatchKind.PriorityInterval + }, + { + name: "synchronousWatchDirectory", + type: "boolean", + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively, + defaultValueDescription: false + }, + { + name: "excludeDirectories", + type: "list", + element: { + name: "excludeDirectory", + type: "string", + isFilePath: true, + extraValidation: specToDiagnostic + }, + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Remove_a_list_of_directories_from_the_watch_process + }, + { + name: "excludeFiles", + type: "list", + element: { + name: "excludeFile", + type: "string", + isFilePath: true, + extraValidation: specToDiagnostic + }, + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing + } + ]; + ts6.commonOptionsWithBuild = [ + { + name: "help", + shortName: "h", + type: "boolean", + showInSimplifiedHelpView: true, + isCommandLineOnly: true, + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Print_this_message, + defaultValueDescription: false + }, + { + name: "help", + shortName: "?", + type: "boolean", + isCommandLineOnly: true, + category: ts6.Diagnostics.Command_line_Options, + defaultValueDescription: false + }, + { + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + isCommandLineOnly: true, + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Watch_input_files, + defaultValueDescription: false + }, + { + name: "preserveWatchOutput", + type: "boolean", + showInSimplifiedHelpView: false, + category: ts6.Diagnostics.Output_Formatting, + description: ts6.Diagnostics.Disable_wiping_the_console_in_watch_mode, + defaultValueDescription: false + }, + { + name: "listFiles", + type: "boolean", + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Print_all_of_the_files_read_during_the_compilation, + defaultValueDescription: false + }, + { + name: "explainFiles", + type: "boolean", + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included, + defaultValueDescription: false + }, + { + name: "listEmittedFiles", + type: "boolean", + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Print_the_names_of_emitted_files_after_a_compilation, + defaultValueDescription: false + }, + { + name: "pretty", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Output_Formatting, + description: ts6.Diagnostics.Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read, + defaultValueDescription: true + }, + { + name: "traceResolution", + type: "boolean", + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Log_paths_used_during_the_moduleResolution_process, + defaultValueDescription: false + }, + { + name: "diagnostics", + type: "boolean", + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Output_compiler_performance_information_after_building, + defaultValueDescription: false + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Output_more_detailed_compiler_performance_information_after_building, + defaultValueDescription: false + }, + { + name: "generateCpuProfile", + type: "string", + isFilePath: true, + paramType: ts6.Diagnostics.FILE_OR_DIRECTORY, + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging, + defaultValueDescription: "profile.cpuprofile" + }, + { + name: "generateTrace", + type: "string", + isFilePath: true, + isCommandLineOnly: true, + paramType: ts6.Diagnostics.DIRECTORY, + category: ts6.Diagnostics.Compiler_Diagnostics, + description: ts6.Diagnostics.Generates_an_event_trace_and_a_list_of_types + }, + { + name: "incremental", + shortName: "i", + type: "boolean", + category: ts6.Diagnostics.Projects, + description: ts6.Diagnostics.Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects, + transpileOptionValue: void 0, + defaultValueDescription: ts6.Diagnostics.false_unless_composite_is_set + }, + { + name: "assumeChangesOnlyAffectDirectDependencies", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Watch_and_Build_Modes, + description: ts6.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it, + defaultValueDescription: false + }, + { + name: "locale", + type: "string", + category: ts6.Diagnostics.Command_line_Options, + isCommandLineOnly: true, + description: ts6.Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit, + defaultValueDescription: ts6.Diagnostics.Platform_specific + } + ]; + ts6.targetOptionDeclaration = { + name: "target", + shortName: "t", + type: new ts6.Map(ts6.getEntries({ + es3: 0, + es5: 1, + es6: 2, + es2015: 2, + es2016: 3, + es2017: 4, + es2018: 5, + es2019: 6, + es2020: 7, + es2021: 8, + es2022: 9, + esnext: 99 + })), + affectsSourceFile: true, + affectsModuleResolution: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + paramType: ts6.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations, + defaultValueDescription: 0 + }; + ts6.moduleOptionDeclaration = { + name: "module", + shortName: "m", + type: new ts6.Map(ts6.getEntries({ + none: ts6.ModuleKind.None, + commonjs: ts6.ModuleKind.CommonJS, + amd: ts6.ModuleKind.AMD, + system: ts6.ModuleKind.System, + umd: ts6.ModuleKind.UMD, + es6: ts6.ModuleKind.ES2015, + es2015: ts6.ModuleKind.ES2015, + es2020: ts6.ModuleKind.ES2020, + es2022: ts6.ModuleKind.ES2022, + esnext: ts6.ModuleKind.ESNext, + node16: ts6.ModuleKind.Node16, + nodenext: ts6.ModuleKind.NodeNext + })), + affectsModuleResolution: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + paramType: ts6.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_what_module_code_is_generated, + defaultValueDescription: void 0 + }; + var commandOptionsWithoutBuild = [ + // CommandLine only options + { + name: "all", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Show_all_compiler_options, + defaultValueDescription: false + }, + { + name: "version", + shortName: "v", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Print_the_compiler_s_version, + defaultValueDescription: false + }, + { + name: "init", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, + defaultValueDescription: false + }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Command_line_Options, + paramType: ts6.Diagnostics.FILE_OR_DIRECTORY, + description: ts6.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json + }, + { + name: "build", + type: "boolean", + shortName: "b", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date, + defaultValueDescription: false + }, + { + name: "showConfig", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Command_line_Options, + isCommandLineOnly: true, + description: ts6.Diagnostics.Print_the_final_configuration_instead_of_building, + defaultValueDescription: false + }, + { + name: "listFilesOnly", + type: "boolean", + category: ts6.Diagnostics.Command_line_Options, + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + isCommandLineOnly: true, + description: ts6.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing, + defaultValueDescription: false + }, + // Basic + ts6.targetOptionDeclaration, + ts6.moduleOptionDeclaration, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: ts6.libMap, + defaultValueDescription: void 0 + }, + affectsProgramStructure: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment, + transpileOptionValue: void 0 + }, + { + name: "allowJs", + type: "boolean", + affectsModuleResolution: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.JavaScript_Support, + description: ts6.Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files, + defaultValueDescription: false + }, + { + name: "checkJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.JavaScript_Support, + description: ts6.Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files, + defaultValueDescription: false + }, + { + name: "jsx", + type: jsxOptionMap, + affectsSourceFile: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsModuleResolution: true, + paramType: ts6.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Specify_what_JSX_code_is_generated, + defaultValueDescription: void 0 + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + transpileOptionValue: void 0, + description: ts6.Diagnostics.Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project, + defaultValueDescription: ts6.Diagnostics.false_unless_composite_is_set + }, + { + name: "declarationMap", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + transpileOptionValue: void 0, + defaultValueDescription: false, + description: ts6.Diagnostics.Create_sourcemaps_for_d_ts_files + }, + { + name: "emitDeclarationOnly", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files, + transpileOptionValue: void 0, + defaultValueDescription: false + }, + { + name: "sourceMap", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + defaultValueDescription: false, + description: ts6.Diagnostics.Create_source_map_files_for_emitted_JavaScript_files + }, + { + name: "outFile", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsDeclarationPath: true, + affectsBundleEmitBuildInfo: true, + isFilePath: true, + paramType: ts6.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output, + transpileOptionValue: void 0 + }, + { + name: "outDir", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsDeclarationPath: true, + isFilePath: true, + paramType: ts6.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Specify_an_output_folder_for_all_emitted_files + }, + { + name: "rootDir", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsDeclarationPath: true, + isFilePath: true, + paramType: ts6.Diagnostics.LOCATION, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_the_root_folder_within_your_source_files, + defaultValueDescription: ts6.Diagnostics.Computed_from_the_list_of_input_files + }, + { + name: "composite", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsBundleEmitBuildInfo: true, + isTSConfigOnly: true, + category: ts6.Diagnostics.Projects, + transpileOptionValue: void 0, + defaultValueDescription: false, + description: ts6.Diagnostics.Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references + }, + { + name: "tsBuildInfoFile", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsBundleEmitBuildInfo: true, + isFilePath: true, + paramType: ts6.Diagnostics.FILE, + category: ts6.Diagnostics.Projects, + transpileOptionValue: void 0, + defaultValueDescription: ".tsbuildinfo", + description: ts6.Diagnostics.Specify_the_path_to_tsbuildinfo_incremental_compilation_file + }, + { + name: "removeComments", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + defaultValueDescription: false, + description: ts6.Diagnostics.Disable_emitting_comments + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Disable_emitting_files_from_a_compilation, + transpileOptionValue: void 0, + defaultValueDescription: false + }, + { + name: "importHelpers", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file, + defaultValueDescription: false + }, + { + name: "importsNotUsedAsValues", + type: new ts6.Map(ts6.getEntries({ + remove: 0, + preserve: 1, + error: 2 + })), + affectsEmit: true, + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types, + defaultValueDescription: 0 + }, + { + name: "downlevelIteration", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration, + defaultValueDescription: false + }, + { + name: "isolatedModules", + type: "boolean", + category: ts6.Diagnostics.Interop_Constraints, + description: ts6.Diagnostics.Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports, + transpileOptionValue: true, + defaultValueDescription: false + }, + // Strict Type Checks + { + name: "strict", + type: "boolean", + // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here + // The value of each strictFlag depends on own strictFlag value or this and never accessed directly. + // But we need to store `strict` in builf info, even though it won't be examined directly, so that the + // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enable_all_strict_type_checking_options, + defaultValueDescription: false + }, + { + name: "noImplicitAny", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + { + name: "strictNullChecks", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.When_type_checking_take_into_account_null_and_undefined, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + { + name: "strictFunctionTypes", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + { + name: "strictBindCallApply", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + { + name: "strictPropertyInitialization", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + { + name: "noImplicitThis", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + { + name: "useUnknownInCatchVariables", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any, + defaultValueDescription: false + }, + { + name: "alwaysStrict", + type: "boolean", + affectsSourceFile: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + strictFlag: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Ensure_use_strict_is_always_emitted, + defaultValueDescription: ts6.Diagnostics.false_unless_strict_is_set + }, + // Additional Checks + { + name: "noUnusedLocals", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read, + defaultValueDescription: false + }, + { + name: "noUnusedParameters", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read, + defaultValueDescription: false + }, + { + name: "exactOptionalPropertyTypes", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined, + defaultValueDescription: false + }, + { + name: "noImplicitReturns", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function, + defaultValueDescription: false + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + affectsBindDiagnostics: true, + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements, + defaultValueDescription: false + }, + { + name: "noUncheckedIndexedAccess", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index, + defaultValueDescription: false + }, + { + name: "noImplicitOverride", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier, + defaultValueDescription: false + }, + { + name: "noPropertyAccessFromIndexSignature", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: false, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type, + defaultValueDescription: false + }, + // Module Resolution + { + name: "moduleResolution", + type: new ts6.Map(ts6.getEntries({ + node: ts6.ModuleResolutionKind.NodeJs, + classic: ts6.ModuleResolutionKind.Classic, + node16: ts6.ModuleResolutionKind.Node16, + nodenext: ts6.ModuleResolutionKind.NodeNext + })), + affectsModuleResolution: true, + paramType: ts6.Diagnostics.STRATEGY, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier, + defaultValueDescription: ts6.Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node + }, + { + name: "baseUrl", + type: "string", + affectsModuleResolution: true, + isFilePath: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_the_base_directory_to_resolve_non_relative_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + affectsModuleResolution: true, + isTSConfigOnly: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations, + transpileOptionValue: void 0 + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + affectsModuleResolution: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules, + transpileOptionValue: void 0, + defaultValueDescription: ts6.Diagnostics.Computed_from_the_list_of_input_files + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + affectsModuleResolution: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + affectsProgramStructure: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file, + transpileOptionValue: void 0 + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Interop_Constraints, + description: ts6.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export, + defaultValueDescription: ts6.Diagnostics.module_system_or_esModuleInterop + }, + { + name: "esModuleInterop", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + showInSimplifiedHelpView: true, + category: ts6.Diagnostics.Interop_Constraints, + description: ts6.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility, + defaultValueDescription: false + }, + { + name: "preserveSymlinks", + type: "boolean", + category: ts6.Diagnostics.Interop_Constraints, + description: ts6.Diagnostics.Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node, + defaultValueDescription: false + }, + { + name: "allowUmdGlobalAccess", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Allow_accessing_UMD_globals_from_modules, + defaultValueDescription: false + }, + { + name: "moduleSuffixes", + type: "list", + element: { + name: "suffix", + type: "string" + }, + listPreserveFalsyValues: true, + affectsModuleResolution: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.List_of_file_name_suffixes_to_search_when_resolving_a_module + }, + // Source Maps + { + name: "sourceRoot", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + paramType: ts6.Diagnostics.LOCATION, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code + }, + { + name: "mapRoot", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + paramType: ts6.Diagnostics.LOCATION, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations + }, + { + name: "inlineSourceMap", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript, + defaultValueDescription: false + }, + { + name: "inlineSources", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript, + defaultValueDescription: false + }, + // Experimental + { + name: "experimentalDecorators", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators, + defaultValueDescription: false + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files, + defaultValueDescription: false + }, + // Advanced + { + name: "jsxFactory", + type: "string", + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h, + defaultValueDescription: "`React.createElement`" + }, + { + name: "jsxFragmentFactory", + type: "string", + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment, + defaultValueDescription: "React.Fragment" + }, + { + name: "jsxImportSource", + type: "string", + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsModuleResolution: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk, + defaultValueDescription: "react" + }, + { + name: "resolveJsonModule", + type: "boolean", + affectsModuleResolution: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Enable_importing_json_files, + defaultValueDescription: false + }, + { + name: "out", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsDeclarationPath: true, + affectsBundleEmitBuildInfo: true, + isFilePath: false, + // for correct behaviour, please use outFile + category: ts6.Diagnostics.Backwards_Compatibility, + paramType: ts6.Diagnostics.FILE, + transpileOptionValue: void 0, + description: ts6.Diagnostics.Deprecated_setting_Use_outFile_instead + }, + { + name: "reactNamespace", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit, + defaultValueDescription: "`React`" + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + // We need to store these to determine whether `lib` files need to be rechecked + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Completeness, + description: ts6.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript, + defaultValueDescription: false + }, + { + name: "charset", + type: "string", + category: ts6.Diagnostics.Backwards_Compatibility, + description: ts6.Diagnostics.No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files, + defaultValueDescription: "utf8" + }, + { + name: "emitBOM", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files, + defaultValueDescription: false + }, + { + name: "newLine", + type: new ts6.Map(ts6.getEntries({ + crlf: 0, + lf: 1 + /* NewLineKind.LineFeed */ + })), + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + paramType: ts6.Diagnostics.NEWLINE, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Set_the_newline_character_for_emitting_files, + defaultValueDescription: ts6.Diagnostics.Platform_specific + }, + { + name: "noErrorTruncation", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Output_Formatting, + description: ts6.Diagnostics.Disable_truncating_types_in_error_messages, + defaultValueDescription: false + }, + { + name: "noLib", + type: "boolean", + category: ts6.Diagnostics.Language_and_Environment, + affectsProgramStructure: true, + description: ts6.Diagnostics.Disable_including_any_library_files_including_the_default_lib_d_ts, + // We are not returning a sourceFile for lib file when asked by the program, + // so pass --noLib to avoid reporting a file not found error. + transpileOptionValue: true, + defaultValueDescription: false + }, + { + name: "noResolve", + type: "boolean", + affectsModuleResolution: true, + category: ts6.Diagnostics.Modules, + description: ts6.Diagnostics.Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project, + // We are not doing a full typecheck, we are not resolving the whole context, + // so pass --noResolve to avoid reporting missing file errors. + transpileOptionValue: true, + defaultValueDescription: false + }, + { + name: "stripInternal", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments, + defaultValueDescription: false + }, + { + name: "disableSizeLimit", + type: "boolean", + affectsProgramStructure: true, + category: ts6.Diagnostics.Editor_Support, + description: ts6.Diagnostics.Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server, + defaultValueDescription: false + }, + { + name: "disableSourceOfProjectReferenceRedirect", + type: "boolean", + isTSConfigOnly: true, + category: ts6.Diagnostics.Projects, + description: ts6.Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects, + defaultValueDescription: false + }, + { + name: "disableSolutionSearching", + type: "boolean", + isTSConfigOnly: true, + category: ts6.Diagnostics.Projects, + description: ts6.Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing, + defaultValueDescription: false + }, + { + name: "disableReferencedProjectLoad", + type: "boolean", + isTSConfigOnly: true, + category: ts6.Diagnostics.Projects, + description: ts6.Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript, + defaultValueDescription: false + }, + { + name: "noImplicitUseStrict", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Backwards_Compatibility, + description: ts6.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files, + defaultValueDescription: false + }, + { + name: "noEmitHelpers", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output, + defaultValueDescription: false + }, + { + name: "noEmitOnError", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + transpileOptionValue: void 0, + description: ts6.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported, + defaultValueDescription: false + }, + { + name: "preserveConstEnums", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code, + defaultValueDescription: false + }, + { + name: "declarationDir", + type: "string", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + affectsDeclarationPath: true, + isFilePath: true, + paramType: ts6.Diagnostics.DIRECTORY, + category: ts6.Diagnostics.Emit, + transpileOptionValue: void 0, + description: ts6.Diagnostics.Specify_the_output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + // We need to store these to determine whether `lib` files need to be rechecked + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Completeness, + description: ts6.Diagnostics.Skip_type_checking_all_d_ts_files, + defaultValueDescription: false + }, + { + name: "allowUnusedLabels", + type: "boolean", + affectsBindDiagnostics: true, + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Disable_error_reporting_for_unused_labels, + defaultValueDescription: void 0 + }, + { + name: "allowUnreachableCode", + type: "boolean", + affectsBindDiagnostics: true, + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Type_Checking, + description: ts6.Diagnostics.Disable_error_reporting_for_unreachable_code, + defaultValueDescription: void 0 + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Backwards_Compatibility, + description: ts6.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals, + defaultValueDescription: false + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Backwards_Compatibility, + description: ts6.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures, + defaultValueDescription: false + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + affectsModuleResolution: true, + category: ts6.Diagnostics.Interop_Constraints, + description: ts6.Diagnostics.Ensure_that_casing_is_correct_in_imports, + defaultValueDescription: false + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + affectsModuleResolution: true, + category: ts6.Diagnostics.JavaScript_Support, + description: ts6.Diagnostics.Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs, + defaultValueDescription: 0 + }, + { + name: "noStrictGenericChecks", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Backwards_Compatibility, + description: ts6.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types, + defaultValueDescription: false + }, + { + name: "useDefineForClassFields", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Language_and_Environment, + description: ts6.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields, + defaultValueDescription: ts6.Diagnostics.true_for_ES2022_and_above_including_ESNext + }, + { + name: "preserveValueImports", + type: "boolean", + affectsEmit: true, + affectsMultiFileEmitBuildInfo: true, + category: ts6.Diagnostics.Emit, + description: ts6.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed, + defaultValueDescription: false + }, + { + name: "keyofStringsOnly", + type: "boolean", + category: ts6.Diagnostics.Backwards_Compatibility, + description: ts6.Diagnostics.Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option, + defaultValueDescription: false + }, + { + // A list of plugins to load in the language service + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts6.Diagnostics.Specify_a_list_of_language_service_plugins_to_include, + category: ts6.Diagnostics.Editor_Support + }, + { + name: "moduleDetection", + type: new ts6.Map(ts6.getEntries({ + auto: ts6.ModuleDetectionKind.Auto, + legacy: ts6.ModuleDetectionKind.Legacy, + force: ts6.ModuleDetectionKind.Force + })), + affectsModuleResolution: true, + description: ts6.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files, + category: ts6.Diagnostics.Language_and_Environment, + defaultValueDescription: ts6.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules + }, + { + name: "ignoreDeprecations", + type: "string", + defaultValueDescription: void 0 + } + ]; + ts6.optionDeclarations = __spreadArray(__spreadArray([], ts6.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true); + ts6.semanticDiagnosticsOptionDeclarations = ts6.optionDeclarations.filter(function(option) { + return !!option.affectsSemanticDiagnostics; + }); + ts6.affectsEmitOptionDeclarations = ts6.optionDeclarations.filter(function(option) { + return !!option.affectsEmit; + }); + ts6.affectsDeclarationPathOptionDeclarations = ts6.optionDeclarations.filter(function(option) { + return !!option.affectsDeclarationPath; + }); + ts6.moduleResolutionOptionDeclarations = ts6.optionDeclarations.filter(function(option) { + return !!option.affectsModuleResolution; + }); + ts6.sourceFileAffectingCompilerOptions = ts6.optionDeclarations.filter(function(option) { + return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics; + }); + ts6.optionsAffectingProgramStructure = ts6.optionDeclarations.filter(function(option) { + return !!option.affectsProgramStructure; + }); + ts6.transpileOptionValueCompilerOptions = ts6.optionDeclarations.filter(function(option) { + return ts6.hasProperty(option, "transpileOptionValue"); + }); + ts6.optionsForBuild = [ + { + name: "verbose", + shortName: "v", + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Enable_verbose_logging, + type: "boolean", + defaultValueDescription: false + }, + { + name: "dry", + shortName: "d", + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Show_what_would_be_built_or_deleted_if_specified_with_clean, + type: "boolean", + defaultValueDescription: false + }, + { + name: "force", + shortName: "f", + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Build_all_projects_including_those_that_appear_to_be_up_to_date, + type: "boolean", + defaultValueDescription: false + }, + { + name: "clean", + category: ts6.Diagnostics.Command_line_Options, + description: ts6.Diagnostics.Delete_the_outputs_of_all_projects, + type: "boolean", + defaultValueDescription: false + } + ]; + ts6.buildOpts = __spreadArray(__spreadArray([], ts6.commonOptionsWithBuild, true), ts6.optionsForBuild, true); + ts6.typeAcquisitionDeclarations = [ + { + /* @deprecated typingOptions.enableAutoDiscovery + * Use typeAcquisition.enable instead. + */ + name: "enableAutoDiscovery", + type: "boolean", + defaultValueDescription: false + }, + { + name: "enable", + type: "boolean", + defaultValueDescription: false + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } + }, + { + name: "disableFilenameBasedTypeAcquisition", + type: "boolean", + defaultValueDescription: false + } + ]; + function createOptionNameMap(optionDeclarations) { + var optionsNameMap = new ts6.Map(); + var shortOptionNames = new ts6.Map(); + ts6.forEach(optionDeclarations, function(option) { + optionsNameMap.set(option.name.toLowerCase(), option); + if (option.shortName) { + shortOptionNames.set(option.shortName, option.name); + } + }); + return { optionsNameMap, shortOptionNames }; + } + ts6.createOptionNameMap = createOptionNameMap; + var optionsNameMapCache; + function getOptionsNameMap() { + return optionsNameMapCache || (optionsNameMapCache = createOptionNameMap(ts6.optionDeclarations)); + } + ts6.getOptionsNameMap = getOptionsNameMap; + var compilerOptionsAlternateMode = { + diagnostic: ts6.Diagnostics.Compiler_option_0_may_only_be_used_with_build, + getOptionsNameMap: getBuildOptionsNameMap + }; + ts6.defaultInitCompilerOptions = { + module: ts6.ModuleKind.CommonJS, + target: 3, + strict: true, + esModuleInterop: true, + forceConsistentCasingInFileNames: true, + skipLibCheck: true + }; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== void 0 && typeAcquisition.enable === void 0) { + return { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + } + return typeAcquisition; + } + ts6.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; + function createCompilerDiagnosticForInvalidCustomType(opt) { + return createDiagnosticForInvalidCustomType(opt, ts6.createCompilerDiagnostic); + } + ts6.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function createDiagnosticForInvalidCustomType(opt, createDiagnostic) { + var namesOfType = ts6.arrayFrom(opt.type.keys()).map(function(key) { + return "'".concat(key, "'"); + }).join(", "); + return createDiagnostic(ts6.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--".concat(opt.name), namesOfType); + } + function parseCustomTypeOption(opt, value, errors2) { + return convertJsonOptionOfCustomType(opt, ts6.trimString(value || ""), errors2); + } + ts6.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors2) { + if (value === void 0) { + value = ""; + } + value = ts6.trimString(value); + if (ts6.startsWith(value, "-")) { + return void 0; + } + if (value === "") { + return []; + } + var values = value.split(","); + switch (opt.element.type) { + case "number": + return ts6.mapDefined(values, function(v) { + return validateJsonOptionValue(opt.element, parseInt(v), errors2); + }); + case "string": + return ts6.mapDefined(values, function(v) { + return validateJsonOptionValue(opt.element, v || "", errors2); + }); + default: + return ts6.mapDefined(values, function(v) { + return parseCustomTypeOption(opt.element, v, errors2); + }); + } + } + ts6.parseListTypeOption = parseListTypeOption; + function getOptionName(option) { + return option.name; + } + function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) { + var _a; + if ((_a = diagnostics.alternateMode) === null || _a === void 0 ? void 0 : _a.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) { + return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption); + } + var possibleOption = ts6.getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName); + return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption); + } + function parseCommandLineWorker(diagnostics, commandLine, readFile) { + var options = {}; + var watchOptions; + var fileNames = []; + var errors2 = []; + parseStrings(commandLine); + return { + options, + watchOptions, + fileNames, + errors: errors2 + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i]; + i++; + if (s.charCodeAt(0) === 64) { + parseResponseFile(s.slice(1)); + } else if (s.charCodeAt(0) === 45) { + var inputOptionName = s.slice(s.charCodeAt(1) === 45 ? 2 : 1); + var opt = getOptionDeclarationFromName( + diagnostics.getOptionsNameMap, + inputOptionName, + /*allowShort*/ + true + ); + if (opt) { + i = parseOptionValue(args, i, diagnostics, opt, options, errors2); + } else { + var watchOpt = getOptionDeclarationFromName( + watchOptionsDidYouMeanDiagnostics.getOptionsNameMap, + inputOptionName, + /*allowShort*/ + true + ); + if (watchOpt) { + i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors2); + } else { + errors2.push(createUnknownOptionError(inputOptionName, diagnostics, ts6.createCompilerDiagnostic, s)); + } + } + } else { + fileNames.push(s); + } + } + } + function parseResponseFile(fileName) { + var text = tryReadFile(fileName, readFile || function(fileName2) { + return ts6.sys.readFile(fileName2); + }); + if (!ts6.isString(text)) { + errors2.push(text); + return; + } + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; + } else { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); + } + } else { + while (text.charCodeAt(pos) > 32) + pos++; + args.push(text.substring(start, pos)); + } + } + parseStrings(args); + } + } + ts6.parseCommandLineWorker = parseCommandLineWorker; + function parseOptionValue(args, i, diagnostics, opt, options, errors2) { + if (opt.isTSConfigOnly) { + var optValue = args[i]; + if (optValue === "null") { + options[opt.name] = void 0; + i++; + } else if (opt.type === "boolean") { + if (optValue === "false") { + options[opt.name] = validateJsonOptionValue( + opt, + /*value*/ + false, + errors2 + ); + i++; + } else { + if (optValue === "true") + i++; + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line, opt.name)); + } + } else { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line, opt.name)); + if (optValue && !ts6.startsWith(optValue, "-")) + i++; + } + } else { + if (!args[i] && opt.type !== "boolean") { + errors2.push(ts6.createCompilerDiagnostic(diagnostics.optionTypeMismatchDiagnostic, opt.name, getCompilerOptionValueTypeString(opt))); + } + if (args[i] !== "null") { + switch (opt.type) { + case "number": + options[opt.name] = validateJsonOptionValue(opt, parseInt(args[i]), errors2); + i++; + break; + case "boolean": + var optValue = args[i]; + options[opt.name] = validateJsonOptionValue(opt, optValue !== "false", errors2); + if (optValue === "false" || optValue === "true") { + i++; + } + break; + case "string": + options[opt.name] = validateJsonOptionValue(opt, args[i] || "", errors2); + i++; + break; + case "list": + var result = parseListTypeOption(opt, args[i], errors2); + options[opt.name] = result || []; + if (result) { + i++; + } + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors2); + i++; + break; + } + } else { + options[opt.name] = void 0; + i++; + } + } + return i; + } + ts6.compilerOptionsDidYouMeanDiagnostics = { + alternateMode: compilerOptionsAlternateMode, + getOptionsNameMap, + optionDeclarations: ts6.optionDeclarations, + unknownOptionDiagnostic: ts6.Diagnostics.Unknown_compiler_option_0, + unknownDidYouMeanDiagnostic: ts6.Diagnostics.Unknown_compiler_option_0_Did_you_mean_1, + optionTypeMismatchDiagnostic: ts6.Diagnostics.Compiler_option_0_expects_an_argument + }; + function parseCommandLine(commandLine, readFile) { + return parseCommandLineWorker(ts6.compilerOptionsDidYouMeanDiagnostics, commandLine, readFile); + } + ts6.parseCommandLine = parseCommandLine; + function getOptionFromName(optionName, allowShort) { + return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort); + } + ts6.getOptionFromName = getOptionFromName; + function getOptionDeclarationFromName(getOptionNameMap, optionName, allowShort) { + if (allowShort === void 0) { + allowShort = false; + } + optionName = optionName.toLowerCase(); + var _a = getOptionNameMap(), optionsNameMap = _a.optionsNameMap, shortOptionNames = _a.shortOptionNames; + if (allowShort) { + var short = shortOptionNames.get(optionName); + if (short !== void 0) { + optionName = short; + } + } + return optionsNameMap.get(optionName); + } + var buildOptionsNameMapCache; + function getBuildOptionsNameMap() { + return buildOptionsNameMapCache || (buildOptionsNameMapCache = createOptionNameMap(ts6.buildOpts)); + } + var buildOptionsAlternateMode = { + diagnostic: ts6.Diagnostics.Compiler_option_0_may_not_be_used_with_build, + getOptionsNameMap + }; + var buildOptionsDidYouMeanDiagnostics = { + alternateMode: buildOptionsAlternateMode, + getOptionsNameMap: getBuildOptionsNameMap, + optionDeclarations: ts6.buildOpts, + unknownOptionDiagnostic: ts6.Diagnostics.Unknown_build_option_0, + unknownDidYouMeanDiagnostic: ts6.Diagnostics.Unknown_build_option_0_Did_you_mean_1, + optionTypeMismatchDiagnostic: ts6.Diagnostics.Build_option_0_requires_a_value_of_type_1 + }; + function parseBuildCommand(args) { + var _a = parseCommandLineWorker(buildOptionsDidYouMeanDiagnostics, args), options = _a.options, watchOptions = _a.watchOptions, projects = _a.fileNames, errors2 = _a.errors; + var buildOptions = options; + if (projects.length === 0) { + projects.push("."); + } + if (buildOptions.clean && buildOptions.force) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Options_0_and_1_cannot_be_combined, "clean", "force")); + } + if (buildOptions.clean && buildOptions.verbose) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Options_0_and_1_cannot_be_combined, "clean", "verbose")); + } + if (buildOptions.clean && buildOptions.watch) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Options_0_and_1_cannot_be_combined, "clean", "watch")); + } + if (buildOptions.watch && buildOptions.dry) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Options_0_and_1_cannot_be_combined, "watch", "dry")); + } + return { buildOptions, watchOptions, projects, errors: errors2 }; + } + ts6.parseBuildCommand = parseBuildCommand; + function getDiagnosticText(_message) { + var _args = []; + for (var _i = 1; _i < arguments.length; _i++) { + _args[_i - 1] = arguments[_i]; + } + var diagnostic = ts6.createCompilerDiagnostic.apply(void 0, arguments); + return diagnostic.messageText; + } + ts6.getDiagnosticText = getDiagnosticText; + function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend, extraFileExtensions) { + var configFileText = tryReadFile(configFileName, function(fileName) { + return host.readFile(fileName); + }); + if (!ts6.isString(configFileText)) { + host.onUnRecoverableConfigFileDiagnostic(configFileText); + return void 0; + } + var result = ts6.parseJsonText(configFileName, configFileText); + var cwd = host.getCurrentDirectory(); + result.path = ts6.toPath(configFileName, cwd, ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); + result.resolvedPath = result.path; + result.originalFileName = result.fileName; + return parseJsonSourceFileConfigFileContent( + result, + host, + ts6.getNormalizedAbsolutePath(ts6.getDirectoryPath(configFileName), cwd), + optionsToExtend, + ts6.getNormalizedAbsolutePath(configFileName, cwd), + /*resolutionStack*/ + void 0, + extraFileExtensions, + extendedConfigCache, + watchOptionsToExtend + ); + } + ts6.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile; + function readConfigFile(fileName, readFile) { + var textOrDiagnostic = tryReadFile(fileName, readFile); + return ts6.isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic }; + } + ts6.readConfigFile = readConfigFile; + function parseConfigFileTextToJson(fileName, jsonText) { + var jsonSourceFile = ts6.parseJsonText(fileName, jsonText); + return { + config: convertConfigFileToObject( + jsonSourceFile, + jsonSourceFile.parseDiagnostics, + /*reportOptionsErrors*/ + false, + /*optionsIterator*/ + void 0 + ), + error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0 + }; + } + ts6.parseConfigFileTextToJson = parseConfigFileTextToJson; + function readJsonConfigFile(fileName, readFile) { + var textOrDiagnostic = tryReadFile(fileName, readFile); + return ts6.isString(textOrDiagnostic) ? ts6.parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] }; + } + ts6.readJsonConfigFile = readJsonConfigFile; + function tryReadFile(fileName, readFile) { + var text; + try { + text = readFile(fileName); + } catch (e) { + return ts6.createCompilerDiagnostic(ts6.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message); + } + return text === void 0 ? ts6.createCompilerDiagnostic(ts6.Diagnostics.Cannot_read_file_0, fileName) : text; + } + ts6.tryReadFile = tryReadFile; + function commandLineOptionsToMap(options) { + return ts6.arrayToMap(options, getOptionName); + } + var typeAcquisitionDidYouMeanDiagnostics = { + optionDeclarations: ts6.typeAcquisitionDeclarations, + unknownOptionDiagnostic: ts6.Diagnostics.Unknown_type_acquisition_option_0, + unknownDidYouMeanDiagnostic: ts6.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1 + }; + var watchOptionsNameMapCache; + function getWatchOptionsNameMap() { + return watchOptionsNameMapCache || (watchOptionsNameMapCache = createOptionNameMap(ts6.optionsForWatch)); + } + var watchOptionsDidYouMeanDiagnostics = { + getOptionsNameMap: getWatchOptionsNameMap, + optionDeclarations: ts6.optionsForWatch, + unknownOptionDiagnostic: ts6.Diagnostics.Unknown_watch_option_0, + unknownDidYouMeanDiagnostic: ts6.Diagnostics.Unknown_watch_option_0_Did_you_mean_1, + optionTypeMismatchDiagnostic: ts6.Diagnostics.Watch_option_0_requires_a_value_of_type_1 + }; + var commandLineCompilerOptionsMapCache; + function getCommandLineCompilerOptionsMap() { + return commandLineCompilerOptionsMapCache || (commandLineCompilerOptionsMapCache = commandLineOptionsToMap(ts6.optionDeclarations)); + } + var commandLineWatchOptionsMapCache; + function getCommandLineWatchOptionsMap() { + return commandLineWatchOptionsMapCache || (commandLineWatchOptionsMapCache = commandLineOptionsToMap(ts6.optionsForWatch)); + } + var commandLineTypeAcquisitionMapCache; + function getCommandLineTypeAcquisitionMap() { + return commandLineTypeAcquisitionMapCache || (commandLineTypeAcquisitionMapCache = commandLineOptionsToMap(ts6.typeAcquisitionDeclarations)); + } + var _tsconfigRootOptions; + function getTsconfigRootOptionsMap() { + if (_tsconfigRootOptions === void 0) { + _tsconfigRootOptions = { + name: void 0, + type: "object", + elementOptions: commandLineOptionsToMap([ + { + name: "compilerOptions", + type: "object", + elementOptions: getCommandLineCompilerOptionsMap(), + extraKeyDiagnostics: ts6.compilerOptionsDidYouMeanDiagnostics + }, + { + name: "watchOptions", + type: "object", + elementOptions: getCommandLineWatchOptionsMap(), + extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics + }, + { + name: "typingOptions", + type: "object", + elementOptions: getCommandLineTypeAcquisitionMap(), + extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics + }, + { + name: "typeAcquisition", + type: "object", + elementOptions: getCommandLineTypeAcquisitionMap(), + extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics + }, + { + name: "extends", + type: "string", + category: ts6.Diagnostics.File_Management + }, + { + name: "references", + type: "list", + element: { + name: "references", + type: "object" + }, + category: ts6.Diagnostics.Projects + }, + { + name: "files", + type: "list", + element: { + name: "files", + type: "string" + }, + category: ts6.Diagnostics.File_Management + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + }, + category: ts6.Diagnostics.File_Management, + defaultValueDescription: ts6.Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + }, + category: ts6.Diagnostics.File_Management, + defaultValueDescription: ts6.Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified + }, + ts6.compileOnSaveCommandLineOption + ]) + }; + } + return _tsconfigRootOptions; + } + function convertConfigFileToObject(sourceFile, errors2, reportOptionsErrors, optionsIterator) { + var _a; + var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; + var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0; + if (rootExpression && rootExpression.kind !== 207) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts6.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts6.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); + if (ts6.isArrayLiteralExpression(rootExpression)) { + var firstObject = ts6.find(rootExpression.elements, ts6.isObjectLiteralExpression); + if (firstObject) { + return convertToObjectWorker( + sourceFile, + firstObject, + errors2, + /*returnValue*/ + true, + knownRootOptions, + optionsIterator + ); + } + } + return {}; + } + return convertToObjectWorker( + sourceFile, + rootExpression, + errors2, + /*returnValue*/ + true, + knownRootOptions, + optionsIterator + ); + } + function convertToObject(sourceFile, errors2) { + var _a; + return convertToObjectWorker( + sourceFile, + (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression, + errors2, + /*returnValue*/ + true, + /*knownRootOptions*/ + void 0, + /*jsonConversionNotifier*/ + void 0 + ); + } + ts6.convertToObject = convertToObject; + function convertToObjectWorker(sourceFile, rootExpression, errors2, returnValue, knownRootOptions, jsonConversionNotifier) { + if (!rootExpression) { + return returnValue ? {} : void 0; + } + return convertPropertyValueToJson(rootExpression, knownRootOptions); + function isRootOptionMap(knownOptions) { + return knownRootOptions && knownRootOptions.elementOptions === knownOptions; + } + function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { + var result = returnValue ? {} : void 0; + var _loop_4 = function(element2) { + if (element2.kind !== 299) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, element2, ts6.Diagnostics.Property_assignment_expected)); + return "continue"; + } + if (element2.questionToken) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, element2.questionToken, ts6.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); + } + if (!isDoubleQuotedString(element2.name)) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, element2.name, ts6.Diagnostics.String_literal_with_double_quotes_expected)); + } + var textOfKey = ts6.isComputedNonLiteralName(element2.name) ? void 0 : ts6.getTextOfPropertyName(element2.name); + var keyText = textOfKey && ts6.unescapeLeadingUnderscores(textOfKey); + var option = keyText && knownOptions ? knownOptions.get(keyText) : void 0; + if (keyText && extraKeyDiagnostics && !option) { + if (knownOptions) { + errors2.push(createUnknownOptionError(keyText, extraKeyDiagnostics, function(message, arg0, arg1) { + return ts6.createDiagnosticForNodeInSourceFile(sourceFile, element2.name, message, arg0, arg1); + })); + } else { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, element2.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText)); + } + } + var value = convertPropertyValueToJson(element2.initializer, option); + if (typeof keyText !== "undefined") { + if (returnValue) { + result[keyText] = value; + } + if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root + (parentOption || isRootOptionMap(knownOptions))) { + var isValidOptionValue = isCompilerOptionsValue(option, value); + if (parentOption) { + if (isValidOptionValue) { + jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value); + } + } else if (isRootOptionMap(knownOptions)) { + if (isValidOptionValue) { + jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element2.name, value, element2.initializer); + } else if (!option) { + jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element2.name, value, element2.initializer); + } + } + } + } + }; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var element = _a[_i]; + _loop_4(element); + } + return result; + } + function convertArrayLiteralExpressionToJson(elements, elementOption) { + if (!returnValue) { + elements.forEach(function(element) { + return convertPropertyValueToJson(element, elementOption); + }); + return void 0; + } + return ts6.filter(elements.map(function(element) { + return convertPropertyValueToJson(element, elementOption); + }), function(v) { + return v !== void 0; + }); + } + function convertPropertyValueToJson(valueExpression, option) { + var invalidReported; + switch (valueExpression.kind) { + case 110: + reportInvalidOptionValue(option && option.type !== "boolean"); + return validateValue( + /*value*/ + true + ); + case 95: + reportInvalidOptionValue(option && option.type !== "boolean"); + return validateValue( + /*value*/ + false + ); + case 104: + reportInvalidOptionValue(option && option.name === "extends"); + return validateValue( + /*value*/ + null + ); + case 10: + if (!isDoubleQuotedString(valueExpression)) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts6.Diagnostics.String_literal_with_double_quotes_expected)); + } + reportInvalidOptionValue(option && (ts6.isString(option.type) && option.type !== "string")); + var text = valueExpression.text; + if (option && !ts6.isString(option.type)) { + var customOption = option; + if (!customOption.type.has(text.toLowerCase())) { + errors2.push(createDiagnosticForInvalidCustomType(customOption, function(message, arg0, arg1) { + return ts6.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1); + })); + invalidReported = true; + } + } + return validateValue(text); + case 8: + reportInvalidOptionValue(option && option.type !== "number"); + return validateValue(Number(valueExpression.text)); + case 221: + if (valueExpression.operator !== 40 || valueExpression.operand.kind !== 8) { + break; + } + reportInvalidOptionValue(option && option.type !== "number"); + return validateValue(-Number(valueExpression.operand.text)); + case 207: + reportInvalidOptionValue(option && option.type !== "object"); + var objectLiteralExpression = valueExpression; + if (option) { + var _a = option, elementOptions = _a.elementOptions, extraKeyDiagnostics = _a.extraKeyDiagnostics, optionName = _a.name; + return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, elementOptions, extraKeyDiagnostics, optionName)); + } else { + return validateValue(convertObjectLiteralExpressionToJson( + objectLiteralExpression, + /* knownOptions*/ + void 0, + /*extraKeyDiagnosticMessage */ + void 0, + /*parentOption*/ + void 0 + )); + } + case 206: + reportInvalidOptionValue(option && option.type !== "list"); + return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); + } + if (option) { + reportInvalidOptionValue( + /*isError*/ + true + ); + } else { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts6.Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal)); + } + return void 0; + function validateValue(value) { + var _a2; + if (!invalidReported) { + var diagnostic = (_a2 = option === null || option === void 0 ? void 0 : option.extraValidation) === null || _a2 === void 0 ? void 0 : _a2.call(option, value); + if (diagnostic) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile.apply(void 0, __spreadArray([sourceFile, valueExpression], diagnostic, false))); + return void 0; + } + } + return value; + } + function reportInvalidOptionValue(isError) { + if (isError) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts6.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option))); + invalidReported = true; + } + } + } + function isDoubleQuotedString(node) { + return ts6.isStringLiteral(node) && ts6.isStringDoubleQuoted(node, sourceFile); + } + } + ts6.convertToObjectWorker = convertToObjectWorker; + function getCompilerOptionValueTypeString(option) { + return option.type === "list" ? "Array" : ts6.isString(option.type) ? option.type : "string"; + } + function isCompilerOptionsValue(option, value) { + if (option) { + if (isNullOrUndefined(value)) + return true; + if (option.type === "list") { + return ts6.isArray(value); + } + var expectedType = ts6.isString(option.type) ? option.type : "string"; + return typeof value === expectedType; + } + return false; + } + function convertToTSConfig(configParseResult, configFileName, host) { + var _a, _b, _c; + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + var files = ts6.map(ts6.filter(configParseResult.fileNames, !((_b = (_a = configParseResult.options.configFile) === null || _a === void 0 ? void 0 : _a.configFileSpecs) === null || _b === void 0 ? void 0 : _b.validatedIncludeSpecs) ? ts6.returnTrue : matchesSpecs(configFileName, configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs, configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs, host)), function(f) { + return ts6.getRelativePathFromFile(ts6.getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), ts6.getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName); + }); + var optionMap = serializeCompilerOptions(configParseResult.options, { configFilePath: ts6.getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames }); + var watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions); + var config = __assign(__assign({ compilerOptions: __assign(__assign({}, optionMapToObject(optionMap)), { showConfig: void 0, configFile: void 0, configFilePath: void 0, help: void 0, init: void 0, listFiles: void 0, listEmittedFiles: void 0, project: void 0, build: void 0, version: void 0 }), watchOptions: watchOptionMap && optionMapToObject(watchOptionMap), references: ts6.map(configParseResult.projectReferences, function(r) { + return __assign(__assign({}, r), { path: r.originalPath ? r.originalPath : "", originalPath: void 0 }); + }), files: ts6.length(files) ? files : void 0 }, ((_c = configParseResult.options.configFile) === null || _c === void 0 ? void 0 : _c.configFileSpecs) ? { + include: filterSameAsDefaultInclude(configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs), + exclude: configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs + } : {}), { compileOnSave: !!configParseResult.compileOnSave ? true : void 0 }); + return config; + } + ts6.convertToTSConfig = convertToTSConfig; + function optionMapToObject(optionMap) { + return __assign({}, ts6.arrayFrom(optionMap.entries()).reduce(function(prev, cur) { + var _a; + return __assign(__assign({}, prev), (_a = {}, _a[cur[0]] = cur[1], _a)); + }, {})); + } + function filterSameAsDefaultInclude(specs) { + if (!ts6.length(specs)) + return void 0; + if (ts6.length(specs) !== 1) + return specs; + if (specs[0] === ts6.defaultIncludeSpec) + return void 0; + return specs; + } + function matchesSpecs(path, includeSpecs, excludeSpecs, host) { + if (!includeSpecs) + return ts6.returnTrue; + var patterns = ts6.getFileMatcherPatterns(path, excludeSpecs, includeSpecs, host.useCaseSensitiveFileNames, host.getCurrentDirectory()); + var excludeRe = patterns.excludePattern && ts6.getRegexFromPattern(patterns.excludePattern, host.useCaseSensitiveFileNames); + var includeRe = patterns.includeFilePattern && ts6.getRegexFromPattern(patterns.includeFilePattern, host.useCaseSensitiveFileNames); + if (includeRe) { + if (excludeRe) { + return function(path2) { + return !(includeRe.test(path2) && !excludeRe.test(path2)); + }; + } + return function(path2) { + return !includeRe.test(path2); + }; + } + if (excludeRe) { + return function(path2) { + return excludeRe.test(path2); + }; + } + return ts6.returnTrue; + } + function getCustomTypeMapOfCommandLineOption(optionDefinition) { + if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean" || optionDefinition.type === "object") { + return void 0; + } else if (optionDefinition.type === "list") { + return getCustomTypeMapOfCommandLineOption(optionDefinition.element); + } else { + return optionDefinition.type; + } + } + function getNameOfCompilerOptionValue(value, customTypeMap) { + return ts6.forEachEntry(customTypeMap, function(mapValue, key) { + if (mapValue === value) { + return key; + } + }); + } + ts6.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue; + function serializeCompilerOptions(options, pathOptions) { + return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions); + } + function serializeWatchOptions(options) { + return serializeOptionBaseObject(options, getWatchOptionsNameMap()); + } + function serializeOptionBaseObject(options, _a, pathOptions) { + var optionsNameMap = _a.optionsNameMap; + var result = new ts6.Map(); + var getCanonicalFileName = pathOptions && ts6.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames); + var _loop_5 = function(name2) { + if (ts6.hasProperty(options, name2)) { + if (optionsNameMap.has(name2) && (optionsNameMap.get(name2).category === ts6.Diagnostics.Command_line_Options || optionsNameMap.get(name2).category === ts6.Diagnostics.Output_Formatting)) { + return "continue"; + } + var value = options[name2]; + var optionDefinition = optionsNameMap.get(name2.toLowerCase()); + if (optionDefinition) { + var customTypeMap_1 = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap_1) { + if (pathOptions && optionDefinition.isFilePath) { + result.set(name2, ts6.getRelativePathFromFile(pathOptions.configFilePath, ts6.getNormalizedAbsolutePath(value, ts6.getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName)); + } else { + result.set(name2, value); + } + } else { + if (optionDefinition.type === "list") { + result.set(name2, value.map(function(element) { + return getNameOfCompilerOptionValue(element, customTypeMap_1); + })); + } else { + result.set(name2, getNameOfCompilerOptionValue(value, customTypeMap_1)); + } + } + } + } + }; + for (var name in options) { + _loop_5(name); + } + return result; + } + function getCompilerOptionsDiffValue(options, newLine) { + var compilerOptionsMap = getSerializedCompilerOption(options); + return getOverwrittenDefaultOptions(); + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function getOverwrittenDefaultOptions() { + var result = []; + var tab = makePadding(2); + commandOptionsWithoutBuild.forEach(function(cmd) { + if (!compilerOptionsMap.has(cmd.name)) { + return; + } + var newValue = compilerOptionsMap.get(cmd.name); + var defaultValue = getDefaultValueForOption(cmd); + if (newValue !== defaultValue) { + result.push("".concat(tab).concat(cmd.name, ": ").concat(newValue)); + } else if (ts6.hasProperty(ts6.defaultInitCompilerOptions, cmd.name)) { + result.push("".concat(tab).concat(cmd.name, ": ").concat(defaultValue)); + } + }); + return result.join(newLine) + newLine; + } + } + ts6.getCompilerOptionsDiffValue = getCompilerOptionsDiffValue; + function getSerializedCompilerOption(options) { + var compilerOptions = ts6.extend(options, ts6.defaultInitCompilerOptions); + return serializeCompilerOptions(compilerOptions); + } + function generateTSConfig(options, fileNames, newLine) { + var compilerOptionsMap = getSerializedCompilerOption(options); + return writeConfigurations(); + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function isAllowedOptionForOutput(_a) { + var category = _a.category, name = _a.name, isCommandLineOnly = _a.isCommandLineOnly; + var categoriesToSkip = [ts6.Diagnostics.Command_line_Options, ts6.Diagnostics.Editor_Support, ts6.Diagnostics.Compiler_Diagnostics, ts6.Diagnostics.Backwards_Compatibility, ts6.Diagnostics.Watch_and_Build_Modes, ts6.Diagnostics.Output_Formatting]; + return !isCommandLineOnly && category !== void 0 && (!categoriesToSkip.includes(category) || compilerOptionsMap.has(name)); + } + function writeConfigurations() { + var categorizedOptions = new ts6.Map(); + categorizedOptions.set(ts6.Diagnostics.Projects, []); + categorizedOptions.set(ts6.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts6.Diagnostics.Modules, []); + categorizedOptions.set(ts6.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts6.Diagnostics.Emit, []); + categorizedOptions.set(ts6.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts6.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts6.Diagnostics.Completeness, []); + for (var _i = 0, optionDeclarations_1 = ts6.optionDeclarations; _i < optionDeclarations_1.length; _i++) { + var option = optionDeclarations_1[_i]; + if (isAllowedOptionForOutput(option)) { + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); + } + } + var marginLength = 0; + var seenKnownKeys = 0; + var entries = []; + categorizedOptions.forEach(function(options2, category) { + if (entries.length !== 0) { + entries.push({ value: "" }); + } + entries.push({ value: "/* ".concat(ts6.getLocaleSpecificMessage(category), " */") }); + for (var _i2 = 0, options_1 = options2; _i2 < options_1.length; _i2++) { + var option2 = options_1[_i2]; + var optionName = void 0; + if (compilerOptionsMap.has(option2.name)) { + optionName = '"'.concat(option2.name, '": ').concat(JSON.stringify(compilerOptionsMap.get(option2.name))).concat((seenKnownKeys += 1) === compilerOptionsMap.size ? "" : ","); + } else { + optionName = '// "'.concat(option2.name, '": ').concat(JSON.stringify(getDefaultValueForOption(option2)), ","); + } + entries.push({ + value: optionName, + description: "/* ".concat(option2.description && ts6.getLocaleSpecificMessage(option2.description) || option2.name, " */") + }); + marginLength = Math.max(optionName.length, marginLength); + } + }); + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push("".concat(tab, '"compilerOptions": {')); + result.push("".concat(tab).concat(tab, "/* ").concat(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file), " */")); + result.push(""); + for (var _a = 0, entries_2 = entries; _a < entries_2.length; _a++) { + var entry = entries_2[_a]; + var value = entry.value, _b = entry.description, description = _b === void 0 ? "" : _b; + result.push(value && "".concat(tab).concat(tab).concat(value).concat(description && makePadding(marginLength - value.length + 2) + description)); + } + if (fileNames.length) { + result.push("".concat(tab, "},")); + result.push("".concat(tab, '"files": [')); + for (var i = 0; i < fileNames.length; i++) { + result.push("".concat(tab).concat(tab).concat(JSON.stringify(fileNames[i])).concat(i === fileNames.length - 1 ? "" : ",")); + } + result.push("".concat(tab, "]")); + } else { + result.push("".concat(tab, "}")); + } + result.push("}"); + return result.join(newLine) + newLine; + } + } + ts6.generateTSConfig = generateTSConfig; + function convertToOptionsWithAbsolutePaths(options, toAbsolutePath) { + var result = {}; + var optionsNameMap = getOptionsNameMap().optionsNameMap; + for (var name in options) { + if (ts6.hasProperty(options, name)) { + result[name] = convertToOptionValueWithAbsolutePaths(optionsNameMap.get(name.toLowerCase()), options[name], toAbsolutePath); + } + } + if (result.configFilePath) { + result.configFilePath = toAbsolutePath(result.configFilePath); + } + return result; + } + ts6.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths; + function convertToOptionValueWithAbsolutePaths(option, value, toAbsolutePath) { + if (option && !isNullOrUndefined(value)) { + if (option.type === "list") { + var values = value; + if (option.element.isFilePath && values.length) { + return values.map(toAbsolutePath); + } + } else if (option.isFilePath) { + return toAbsolutePath(value); + } + } + return value; + } + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) { + return parseJsonConfigFileContentWorker( + json, + /*sourceFile*/ + void 0, + host, + basePath, + existingOptions, + existingWatchOptions, + configFileName, + resolutionStack, + extraFileExtensions, + extendedConfigCache + ); + } + ts6.parseJsonConfigFileContent = parseJsonConfigFileContent; + function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("parse", "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName }); + var result = parseJsonConfigFileContentWorker( + /*json*/ + void 0, + sourceFile, + host, + basePath, + existingOptions, + existingWatchOptions, + configFileName, + resolutionStack, + extraFileExtensions, + extendedConfigCache + ); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return result; + } + ts6.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent; + function setConfigFileInOptions(options, configFile) { + if (configFile) { + Object.defineProperty(options, "configFile", { enumerable: false, writable: false, value: configFile }); + } + } + ts6.setConfigFileInOptions = setConfigFileInOptions; + function isNullOrUndefined(x) { + return x === void 0 || x === null; + } + function directoryOfCombinedPath(fileName, basePath) { + return ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(fileName, basePath)); + } + ts6.defaultIncludeSpec = "**/*"; + function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) { + if (existingOptions === void 0) { + existingOptions = {}; + } + if (resolutionStack === void 0) { + resolutionStack = []; + } + if (extraFileExtensions === void 0) { + extraFileExtensions = []; + } + ts6.Debug.assert(json === void 0 && sourceFile !== void 0 || json !== void 0 && sourceFile === void 0); + var errors2 = []; + var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors2, extendedConfigCache); + var raw = parsedConfig.raw; + var options = ts6.extend(existingOptions, parsedConfig.options || {}); + var watchOptions = existingWatchOptions && parsedConfig.watchOptions ? ts6.extend(existingWatchOptions, parsedConfig.watchOptions) : parsedConfig.watchOptions || existingWatchOptions; + options.configFilePath = configFileName && ts6.normalizeSlashes(configFileName); + var configFileSpecs = getConfigFileSpecs(); + if (sourceFile) + sourceFile.configFileSpecs = configFileSpecs; + setConfigFileInOptions(options, sourceFile); + var basePathForFileNames = ts6.normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath); + return { + options, + watchOptions, + fileNames: getFileNames(basePathForFileNames), + projectReferences: getProjectReferences(basePathForFileNames), + typeAcquisition: parsedConfig.typeAcquisition || getDefaultTypeAcquisition(), + raw, + errors: errors2, + // Wildcard directories (provided as part of a wildcard path) are stored in a + // file map that marks whether it was a regular wildcard match (with a `*` or `?` token), + // or a recursive directory. This information is used by filesystem watchers to monitor for + // new entries in these paths. + wildcardDirectories: getWildcardDirectories(configFileSpecs, basePathForFileNames, host.useCaseSensitiveFileNames), + compileOnSave: !!raw.compileOnSave + }; + function getConfigFileSpecs() { + var referencesOfRaw = getPropFromRaw("references", function(element) { + return typeof element === "object"; + }, "object"); + var filesSpecs = toPropValue(getSpecsFromRaw("files")); + if (filesSpecs) { + var hasZeroOrNoReferences = referencesOfRaw === "no-prop" || ts6.isArray(referencesOfRaw) && referencesOfRaw.length === 0; + var hasExtends = ts6.hasProperty(raw, "extends"); + if (filesSpecs.length === 0 && hasZeroOrNoReferences && !hasExtends) { + if (sourceFile) { + var fileName = configFileName || "tsconfig.json"; + var diagnosticMessage = ts6.Diagnostics.The_files_list_in_config_file_0_is_empty; + var nodeValue = ts6.firstDefined(ts6.getTsConfigPropArray(sourceFile, "files"), function(property) { + return property.initializer; + }); + var error = nodeValue ? ts6.createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName) : ts6.createCompilerDiagnostic(diagnosticMessage, fileName); + errors2.push(error); + } else { + createCompilerDiagnosticOnlyIfJson(ts6.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json"); + } + } + } + var includeSpecs = toPropValue(getSpecsFromRaw("include")); + var excludeOfRaw = getSpecsFromRaw("exclude"); + var isDefaultIncludeSpec = false; + var excludeSpecs = toPropValue(excludeOfRaw); + if (excludeOfRaw === "no-prop" && raw.compilerOptions) { + var outDir = raw.compilerOptions.outDir; + var declarationDir = raw.compilerOptions.declarationDir; + if (outDir || declarationDir) { + excludeSpecs = [outDir, declarationDir].filter(function(d) { + return !!d; + }); + } + } + if (filesSpecs === void 0 && includeSpecs === void 0) { + includeSpecs = [ts6.defaultIncludeSpec]; + isDefaultIncludeSpec = true; + } + var validatedIncludeSpecs, validatedExcludeSpecs; + if (includeSpecs) { + validatedIncludeSpecs = validateSpecs( + includeSpecs, + errors2, + /*disallowTrailingRecursion*/ + true, + sourceFile, + "include" + ); + } + if (excludeSpecs) { + validatedExcludeSpecs = validateSpecs( + excludeSpecs, + errors2, + /*disallowTrailingRecursion*/ + false, + sourceFile, + "exclude" + ); + } + return { + filesSpecs, + includeSpecs, + excludeSpecs, + validatedFilesSpec: ts6.filter(filesSpecs, ts6.isString), + validatedIncludeSpecs, + validatedExcludeSpecs, + pathPatterns: void 0, + isDefaultIncludeSpec + }; + } + function getFileNames(basePath2) { + var fileNames = getFileNamesFromConfigSpecs(configFileSpecs, basePath2, options, host, extraFileExtensions); + if (shouldReportNoInputFiles(fileNames, canJsonReportNoInputFiles(raw), resolutionStack)) { + errors2.push(getErrorForNoInputFiles(configFileSpecs, configFileName)); + } + return fileNames; + } + function getProjectReferences(basePath2) { + var projectReferences; + var referencesOfRaw = getPropFromRaw("references", function(element) { + return typeof element === "object"; + }, "object"); + if (ts6.isArray(referencesOfRaw)) { + for (var _i = 0, referencesOfRaw_1 = referencesOfRaw; _i < referencesOfRaw_1.length; _i++) { + var ref = referencesOfRaw_1[_i]; + if (typeof ref.path !== "string") { + createCompilerDiagnosticOnlyIfJson(ts6.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string"); + } else { + (projectReferences || (projectReferences = [])).push({ + path: ts6.getNormalizedAbsolutePath(ref.path, basePath2), + originalPath: ref.path, + prepend: ref.prepend, + circular: ref.circular + }); + } + } + } + return projectReferences; + } + function toPropValue(specResult) { + return ts6.isArray(specResult) ? specResult : void 0; + } + function getSpecsFromRaw(prop) { + return getPropFromRaw(prop, ts6.isString, "string"); + } + function getPropFromRaw(prop, validateElement, elementTypeName) { + if (ts6.hasProperty(raw, prop) && !isNullOrUndefined(raw[prop])) { + if (ts6.isArray(raw[prop])) { + var result = raw[prop]; + if (!sourceFile && !ts6.every(result, validateElement)) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, elementTypeName)); + } + return result; + } else { + createCompilerDiagnosticOnlyIfJson(ts6.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, "Array"); + return "not-array"; + } + } + return "no-prop"; + } + function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) { + if (!sourceFile) { + errors2.push(ts6.createCompilerDiagnostic(message, arg0, arg1)); + } + } + } + function isErrorNoInputFiles(error) { + return error.code === ts6.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code; + } + function getErrorForNoInputFiles(_a, configFileName) { + var includeSpecs = _a.includeSpecs, excludeSpecs = _a.excludeSpecs; + return ts6.createCompilerDiagnostic(ts6.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])); + } + function shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles, resolutionStack) { + return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0); + } + function canJsonReportNoInputFiles(raw) { + return !ts6.hasProperty(raw, "files") && !ts6.hasProperty(raw, "references"); + } + ts6.canJsonReportNoInputFiles = canJsonReportNoInputFiles; + function updateErrorForNoInputFiles(fileNames, configFileName, configFileSpecs, configParseDiagnostics, canJsonReportNoInutFiles) { + var existingErrors = configParseDiagnostics.length; + if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) { + configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName)); + } else { + ts6.filterMutate(configParseDiagnostics, function(error) { + return !isErrorNoInputFiles(error); + }); + } + return existingErrors !== configParseDiagnostics.length; + } + ts6.updateErrorForNoInputFiles = updateErrorForNoInputFiles; + function isSuccessfulParsedTsconfig(value) { + return !!value.options; + } + function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors2, extendedConfigCache) { + var _a; + basePath = ts6.normalizeSlashes(basePath); + var resolvedPath = ts6.getNormalizedAbsolutePath(configFileName || "", basePath); + if (resolutionStack.indexOf(resolvedPath) >= 0) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, __spreadArray(__spreadArray([], resolutionStack, true), [resolvedPath], false).join(" -> "))); + return { raw: json || convertToObject(sourceFile, errors2) }; + } + var ownConfig = json ? parseOwnConfigOfJson(json, host, basePath, configFileName, errors2) : parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors2); + if ((_a = ownConfig.options) === null || _a === void 0 ? void 0 : _a.paths) { + ownConfig.options.pathsBasePath = basePath; + } + if (ownConfig.extendedConfigPath) { + resolutionStack = resolutionStack.concat([resolvedPath]); + var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, resolutionStack, errors2, extendedConfigCache); + if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) { + var baseRaw_1 = extendedConfig.raw; + var raw_1 = ownConfig.raw; + var relativeDifference_1; + var setPropertyInRawIfNotUndefined = function(propertyName) { + if (!raw_1[propertyName] && baseRaw_1[propertyName]) { + raw_1[propertyName] = ts6.map(baseRaw_1[propertyName], function(path) { + return ts6.isRootedDiskPath(path) ? path : ts6.combinePaths(relativeDifference_1 || (relativeDifference_1 = ts6.convertToRelativePath(ts6.getDirectoryPath(ownConfig.extendedConfigPath), basePath, ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames))), path); + }); + } + }; + setPropertyInRawIfNotUndefined("include"); + setPropertyInRawIfNotUndefined("exclude"); + setPropertyInRawIfNotUndefined("files"); + if (raw_1.compileOnSave === void 0) { + raw_1.compileOnSave = baseRaw_1.compileOnSave; + } + ownConfig.options = ts6.assign({}, extendedConfig.options, ownConfig.options); + ownConfig.watchOptions = ownConfig.watchOptions && extendedConfig.watchOptions ? ts6.assign({}, extendedConfig.watchOptions, ownConfig.watchOptions) : ownConfig.watchOptions || extendedConfig.watchOptions; + } + } + return ownConfig; + } + function parseOwnConfigOfJson(json, host, basePath, configFileName, errors2) { + if (ts6.hasProperty(json, "excludes")) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } + var options = convertCompilerOptionsFromJsonWorker(json.compilerOptions, basePath, errors2, configFileName); + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition || json.typingOptions, basePath, errors2, configFileName); + var watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors2); + json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors2); + var extendedConfigPath; + if (json.extends) { + if (!ts6.isString(json.extends)) { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); + } else { + var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; + extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors2, ts6.createCompilerDiagnostic); + } + } + return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath }; + } + function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors2) { + var options = getDefaultCompilerOptions(configFileName); + var typeAcquisition, typingOptionstypeAcquisition; + var watchOptions; + var extendedConfigPath; + var rootCompilerOptions; + var optionsIterator = { + onSetValidOptionKeyValueInParent: function(parentOption, option, value) { + var currentOption; + switch (parentOption) { + case "compilerOptions": + currentOption = options; + break; + case "watchOptions": + currentOption = watchOptions || (watchOptions = {}); + break; + case "typeAcquisition": + currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName)); + break; + case "typingOptions": + currentOption = typingOptionstypeAcquisition || (typingOptionstypeAcquisition = getDefaultTypeAcquisition(configFileName)); + break; + default: + ts6.Debug.fail("Unknown option"); + } + currentOption[option.name] = normalizeOptionValue(option, basePath, value); + }, + onSetValidOptionKeyValueInRoot: function(key, _keyNode, value, valueNode) { + switch (key) { + case "extends": + var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; + extendedConfigPath = getExtendsConfigPath(value, host, newBase, errors2, function(message, arg0) { + return ts6.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0); + }); + return; + } + }, + onSetUnknownOptionKeyValueInRoot: function(key, keyNode, _value, _valueNode) { + if (key === "excludes") { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, keyNode, ts6.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } + if (ts6.find(commandOptionsWithoutBuild, function(opt) { + return opt.name === key; + })) { + rootCompilerOptions = ts6.append(rootCompilerOptions, keyNode); + } + } + }; + var json = convertConfigFileToObject( + sourceFile, + errors2, + /*reportOptionsErrors*/ + true, + optionsIterator + ); + if (!typeAcquisition) { + if (typingOptionstypeAcquisition) { + typeAcquisition = typingOptionstypeAcquisition.enableAutoDiscovery !== void 0 ? { + enable: typingOptionstypeAcquisition.enableAutoDiscovery, + include: typingOptionstypeAcquisition.include, + exclude: typingOptionstypeAcquisition.exclude + } : typingOptionstypeAcquisition; + } else { + typeAcquisition = getDefaultTypeAcquisition(configFileName); + } + } + if (rootCompilerOptions && json && json.compilerOptions === void 0) { + errors2.push(ts6.createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], ts6.Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, ts6.getTextOfPropertyName(rootCompilerOptions[0]))); + } + return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath }; + } + function getExtendsConfigPath(extendedConfig, host, basePath, errors2, createDiagnostic) { + extendedConfig = ts6.normalizeSlashes(extendedConfig); + if (ts6.isRootedDiskPath(extendedConfig) || ts6.startsWith(extendedConfig, "./") || ts6.startsWith(extendedConfig, "../")) { + var extendedConfigPath = ts6.getNormalizedAbsolutePath(extendedConfig, basePath); + if (!host.fileExists(extendedConfigPath) && !ts6.endsWith( + extendedConfigPath, + ".json" + /* Extension.Json */ + )) { + extendedConfigPath = "".concat(extendedConfigPath, ".json"); + if (!host.fileExists(extendedConfigPath)) { + errors2.push(createDiagnostic(ts6.Diagnostics.File_0_not_found, extendedConfig)); + return void 0; + } + } + return extendedConfigPath; + } + var resolved = ts6.nodeModuleNameResolver( + extendedConfig, + ts6.combinePaths(basePath, "tsconfig.json"), + { moduleResolution: ts6.ModuleResolutionKind.NodeJs }, + host, + /*cache*/ + void 0, + /*projectRefs*/ + void 0, + /*lookupConfig*/ + true + ); + if (resolved.resolvedModule) { + return resolved.resolvedModule.resolvedFileName; + } + errors2.push(createDiagnostic(ts6.Diagnostics.File_0_not_found, extendedConfig)); + return void 0; + } + function getExtendedConfig(sourceFile, extendedConfigPath, host, resolutionStack, errors2, extendedConfigCache) { + var _a; + var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts6.toFileNameLowerCase(extendedConfigPath); + var value; + var extendedResult; + var extendedConfig; + if (extendedConfigCache && (value = extendedConfigCache.get(path))) { + extendedResult = value.extendedResult, extendedConfig = value.extendedConfig; + } else { + extendedResult = readJsonConfigFile(extendedConfigPath, function(path2) { + return host.readFile(path2); + }); + if (!extendedResult.parseDiagnostics.length) { + extendedConfig = parseConfig( + /*json*/ + void 0, + extendedResult, + host, + ts6.getDirectoryPath(extendedConfigPath), + ts6.getBaseFileName(extendedConfigPath), + resolutionStack, + errors2, + extendedConfigCache + ); + } + if (extendedConfigCache) { + extendedConfigCache.set(path, { extendedResult, extendedConfig }); + } + } + if (sourceFile) { + sourceFile.extendedSourceFiles = [extendedResult.fileName]; + if (extendedResult.extendedSourceFiles) { + (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles); + } + } + if (extendedResult.parseDiagnostics.length) { + errors2.push.apply(errors2, extendedResult.parseDiagnostics); + return void 0; + } + return extendedConfig; + } + function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors2) { + if (!ts6.hasProperty(jsonOption, ts6.compileOnSaveCommandLineOption.name)) { + return false; + } + var result = convertJsonOption(ts6.compileOnSaveCommandLineOption, jsonOption.compileOnSave, basePath, errors2); + return typeof result === "boolean" && result; + } + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors2 = []; + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors2, configFileName); + return { options, errors: errors2 }; + } + ts6.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { + var errors2 = []; + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors2, configFileName); + return { options, errors: errors2 }; + } + ts6.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; + function getDefaultCompilerOptions(configFileName) { + var options = configFileName && ts6.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true, noEmit: true } : {}; + return options; + } + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors2, configFileName) { + var options = getDefaultCompilerOptions(configFileName); + convertOptionsFromJson(getCommandLineCompilerOptionsMap(), jsonOptions, basePath, options, ts6.compilerOptionsDidYouMeanDiagnostics, errors2); + if (configFileName) { + options.configFilePath = ts6.normalizeSlashes(configFileName); + } + return options; + } + function getDefaultTypeAcquisition(configFileName) { + return { enable: !!configFileName && ts6.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + } + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors2, configFileName) { + var options = getDefaultTypeAcquisition(configFileName); + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(getCommandLineTypeAcquisitionMap(), typeAcquisition, basePath, options, typeAcquisitionDidYouMeanDiagnostics, errors2); + return options; + } + function convertWatchOptionsFromJsonWorker(jsonOptions, basePath, errors2) { + return convertOptionsFromJson( + getCommandLineWatchOptionsMap(), + jsonOptions, + basePath, + /*defaultOptions*/ + void 0, + watchOptionsDidYouMeanDiagnostics, + errors2 + ); + } + function convertOptionsFromJson(optionsNameMap, jsonOptions, basePath, defaultOptions, diagnostics, errors2) { + if (!jsonOptions) { + return; + } + for (var id in jsonOptions) { + var opt = optionsNameMap.get(id); + if (opt) { + (defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors2); + } else { + errors2.push(createUnknownOptionError(id, diagnostics, ts6.createCompilerDiagnostic)); + } + } + return defaultOptions; + } + function convertJsonOption(opt, value, basePath, errors2) { + if (isCompilerOptionsValue(opt, value)) { + var optType = opt.type; + if (optType === "list" && ts6.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors2); + } else if (!ts6.isString(optType)) { + return convertJsonOptionOfCustomType(opt, value, errors2); + } + var validatedValue = validateJsonOptionValue(opt, value, errors2); + return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue); + } else { + errors2.push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt))); + } + } + ts6.convertJsonOption = convertJsonOption; + function normalizeOptionValue(option, basePath, value) { + if (isNullOrUndefined(value)) + return void 0; + if (option.type === "list") { + var listOption_1 = option; + if (listOption_1.element.isFilePath || !ts6.isString(listOption_1.element.type)) { + return ts6.filter(ts6.map(value, function(v) { + return normalizeOptionValue(listOption_1.element, basePath, v); + }), function(v) { + return listOption_1.listPreserveFalsyValues ? true : !!v; + }); + } + return value; + } else if (!ts6.isString(option.type)) { + return option.type.get(ts6.isString(value) ? value.toLowerCase() : value); + } + return normalizeNonListOptionValue(option, basePath, value); + } + function normalizeNonListOptionValue(option, basePath, value) { + if (option.isFilePath) { + value = ts6.getNormalizedAbsolutePath(value, basePath); + if (value === "") { + value = "."; + } + } + return value; + } + function validateJsonOptionValue(opt, value, errors2) { + var _a; + if (isNullOrUndefined(value)) + return void 0; + var d = (_a = opt.extraValidation) === null || _a === void 0 ? void 0 : _a.call(opt, value); + if (!d) + return value; + errors2.push(ts6.createCompilerDiagnostic.apply(void 0, d)); + return void 0; + } + function convertJsonOptionOfCustomType(opt, value, errors2) { + if (isNullOrUndefined(value)) + return void 0; + var key = value.toLowerCase(); + var val = opt.type.get(key); + if (val !== void 0) { + return validateJsonOptionValue(opt, val, errors2); + } else { + errors2.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors2) { + return ts6.filter(ts6.map(values, function(v) { + return convertJsonOption(option.element, v, basePath, errors2); + }), function(v) { + return option.listPreserveFalsyValues ? true : !!v; + }); + } + var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/; + var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; + function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions) { + if (extraFileExtensions === void 0) { + extraFileExtensions = ts6.emptyArray; + } + basePath = ts6.normalizePath(basePath); + var keyMapper = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + var literalFileMap = new ts6.Map(); + var wildcardFileMap = new ts6.Map(); + var wildCardJsonFileMap = new ts6.Map(); + var validatedFilesSpec = configFileSpecs.validatedFilesSpec, validatedIncludeSpecs = configFileSpecs.validatedIncludeSpecs, validatedExcludeSpecs = configFileSpecs.validatedExcludeSpecs; + var supportedExtensions = ts6.getSupportedExtensions(options, extraFileExtensions); + var supportedExtensionsWithJsonIfResolveJsonModule = ts6.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions); + if (validatedFilesSpec) { + for (var _i = 0, validatedFilesSpec_1 = validatedFilesSpec; _i < validatedFilesSpec_1.length; _i++) { + var fileName = validatedFilesSpec_1[_i]; + var file = ts6.getNormalizedAbsolutePath(fileName, basePath); + literalFileMap.set(keyMapper(file), file); + } + } + var jsonOnlyIncludeRegexes; + if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) { + var _loop_6 = function(file2) { + if (ts6.fileExtensionIs( + file2, + ".json" + /* Extension.Json */ + )) { + if (!jsonOnlyIncludeRegexes) { + var includes = validatedIncludeSpecs.filter(function(s) { + return ts6.endsWith( + s, + ".json" + /* Extension.Json */ + ); + }); + var includeFilePatterns = ts6.map(ts6.getRegularExpressionsForWildcards(includes, basePath, "files"), function(pattern) { + return "^".concat(pattern, "$"); + }); + jsonOnlyIncludeRegexes = includeFilePatterns ? includeFilePatterns.map(function(pattern) { + return ts6.getRegexFromPattern(pattern, host.useCaseSensitiveFileNames); + }) : ts6.emptyArray; + } + var includeIndex = ts6.findIndex(jsonOnlyIncludeRegexes, function(re) { + return re.test(file2); + }); + if (includeIndex !== -1) { + var key_1 = keyMapper(file2); + if (!literalFileMap.has(key_1) && !wildCardJsonFileMap.has(key_1)) { + wildCardJsonFileMap.set(key_1, file2); + } + } + return "continue"; + } + if (hasFileWithHigherPriorityExtension(file2, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) { + return "continue"; + } + removeWildcardFilesWithLowerPriorityExtension(file2, wildcardFileMap, supportedExtensions, keyMapper); + var key = keyMapper(file2); + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file2); + } + }; + for (var _a = 0, _b = host.readDirectory( + basePath, + ts6.flatten(supportedExtensionsWithJsonIfResolveJsonModule), + validatedExcludeSpecs, + validatedIncludeSpecs, + /*depth*/ + void 0 + ); _a < _b.length; _a++) { + var file = _b[_a]; + _loop_6(file); + } + } + var literalFiles = ts6.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts6.arrayFrom(wildcardFileMap.values()); + return literalFiles.concat(wildcardFiles, ts6.arrayFrom(wildCardJsonFileMap.values())); + } + ts6.getFileNamesFromConfigSpecs = getFileNamesFromConfigSpecs; + function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames, currentDirectory) { + var validatedFilesSpec = spec.validatedFilesSpec, validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs; + if (!ts6.length(validatedIncludeSpecs) || !ts6.length(validatedExcludeSpecs)) + return false; + basePath = ts6.normalizePath(basePath); + var keyMapper = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + if (validatedFilesSpec) { + for (var _i = 0, validatedFilesSpec_2 = validatedFilesSpec; _i < validatedFilesSpec_2.length; _i++) { + var fileName = validatedFilesSpec_2[_i]; + if (keyMapper(ts6.getNormalizedAbsolutePath(fileName, basePath)) === pathToCheck) + return false; + } + } + return matchesExcludeWorker(pathToCheck, validatedExcludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath); + } + ts6.isExcludedFile = isExcludedFile; + function invalidDotDotAfterRecursiveWildcard(s) { + var wildcardIndex = ts6.startsWith(s, "**/") ? 0 : s.indexOf("/**/"); + if (wildcardIndex === -1) { + return false; + } + var lastDotIndex = ts6.endsWith(s, "/..") ? s.length : s.lastIndexOf("/../"); + return lastDotIndex > wildcardIndex; + } + function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory) { + return matchesExcludeWorker(pathToCheck, ts6.filter(excludeSpecs, function(spec) { + return !invalidDotDotAfterRecursiveWildcard(spec); + }), useCaseSensitiveFileNames, currentDirectory); + } + ts6.matchesExclude = matchesExclude; + function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath) { + var excludePattern = ts6.getRegularExpressionForWildcard(excludeSpecs, ts6.combinePaths(ts6.normalizePath(currentDirectory), basePath), "exclude"); + var excludeRegex = excludePattern && ts6.getRegexFromPattern(excludePattern, useCaseSensitiveFileNames); + if (!excludeRegex) + return false; + if (excludeRegex.test(pathToCheck)) + return true; + return !ts6.hasExtension(pathToCheck) && excludeRegex.test(ts6.ensureTrailingDirectorySeparator(pathToCheck)); + } + function validateSpecs(specs, errors2, disallowTrailingRecursion, jsonSourceFile, specKey) { + return specs.filter(function(spec) { + if (!ts6.isString(spec)) + return false; + var diag = specToDiagnostic(spec, disallowTrailingRecursion); + if (diag !== void 0) { + errors2.push(createDiagnostic.apply(void 0, diag)); + } + return diag === void 0; + }); + function createDiagnostic(message, spec) { + var element = ts6.getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec); + return element ? ts6.createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) : ts6.createCompilerDiagnostic(message, spec); + } + } + function specToDiagnostic(spec, disallowTrailingRecursion) { + if (disallowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { + return [ts6.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec]; + } else if (invalidDotDotAfterRecursiveWildcard(spec)) { + return [ts6.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec]; + } + } + function getWildcardDirectories(_a, path, useCaseSensitiveFileNames) { + var include = _a.validatedIncludeSpecs, exclude = _a.validatedExcludeSpecs; + var rawExcludeRegex = ts6.getRegularExpressionForWildcard(exclude, path, "exclude"); + var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); + var wildcardDirectories = {}; + if (include !== void 0) { + var recursiveKeys = []; + for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { + var file = include_1[_i]; + var spec = ts6.normalizePath(ts6.combinePaths(path, file)); + if (excludeRegex && excludeRegex.test(spec)) { + continue; + } + var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); + if (match) { + var key = match.key, flags = match.flags; + var existingFlags = wildcardDirectories[key]; + if (existingFlags === void 0 || existingFlags < flags) { + wildcardDirectories[key] = flags; + if (flags === 1) { + recursiveKeys.push(key); + } + } + } + } + for (var key in wildcardDirectories) { + if (ts6.hasProperty(wildcardDirectories, key)) { + for (var _b = 0, recursiveKeys_1 = recursiveKeys; _b < recursiveKeys_1.length; _b++) { + var recursiveKey = recursiveKeys_1[_b]; + if (key !== recursiveKey && ts6.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } + } + } + } + } + return wildcardDirectories; + } + function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { + var match = wildcardDirectoryPattern.exec(spec); + if (match) { + var questionWildcardIndex = spec.indexOf("?"); + var starWildcardIndex = spec.indexOf("*"); + var lastDirectorySeperatorIndex = spec.lastIndexOf(ts6.directorySeparator); + return { + key: useCaseSensitiveFileNames ? match[0] : ts6.toFileNameLowerCase(match[0]), + flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 : 0 + /* WatchDirectoryFlags.None */ + }; + } + if (ts6.isImplicitGlob(spec.substring(spec.lastIndexOf(ts6.directorySeparator) + 1))) { + return { + key: ts6.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts6.toFileNameLowerCase(spec)), + flags: 1 + /* WatchDirectoryFlags.Recursive */ + }; + } + return void 0; + } + function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { + var extensionGroup = ts6.forEach(extensions, function(group) { + return ts6.fileExtensionIsOneOf(file, group) ? group : void 0; + }); + if (!extensionGroup) { + return false; + } + for (var _i = 0, extensionGroup_1 = extensionGroup; _i < extensionGroup_1.length; _i++) { + var ext = extensionGroup_1[_i]; + if (ts6.fileExtensionIs(file, ext)) { + return false; + } + var higherPriorityPath = keyMapper(ts6.changeExtension(file, ext)); + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { + if (ext === ".d.ts" && (ts6.fileExtensionIs( + file, + ".js" + /* Extension.Js */ + ) || ts6.fileExtensionIs( + file, + ".jsx" + /* Extension.Jsx */ + ))) { + continue; + } + return true; + } + } + return false; + } + function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { + var extensionGroup = ts6.forEach(extensions, function(group) { + return ts6.fileExtensionIsOneOf(file, group) ? group : void 0; + }); + if (!extensionGroup) { + return; + } + for (var i = extensionGroup.length - 1; i >= 0; i--) { + var ext = extensionGroup[i]; + if (ts6.fileExtensionIs(file, ext)) { + return; + } + var lowerPriorityPath = keyMapper(ts6.changeExtension(file, ext)); + wildcardFiles.delete(lowerPriorityPath); + } + } + function convertCompilerOptionsForTelemetry(opts) { + var out = {}; + for (var key in opts) { + if (ts6.hasProperty(opts, key)) { + var type = getOptionFromName(key); + if (type !== void 0) { + out[key] = getOptionValueWithEmptyStrings(opts[key], type); + } + } + } + return out; + } + ts6.convertCompilerOptionsForTelemetry = convertCompilerOptionsForTelemetry; + function getOptionValueWithEmptyStrings(value, option) { + switch (option.type) { + case "object": + return ""; + case "string": + return ""; + case "number": + return typeof value === "number" ? value : ""; + case "boolean": + return typeof value === "boolean" ? value : ""; + case "list": + var elementType_1 = option.element; + return ts6.isArray(value) ? value.map(function(v) { + return getOptionValueWithEmptyStrings(v, elementType_1); + }) : ""; + default: + return ts6.forEachEntry(option.type, function(optionEnumValue, optionStringValue) { + if (optionEnumValue === value) { + return optionStringValue; + } + }); + } + } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + var defaultValue = option.defaultValueDescription; + return option.isFilePath ? "./".concat(defaultValue && typeof defaultValue === "string" ? defaultValue : "") : ""; + case "list": + return []; + case "object": + return {}; + default: + var iterResult = option.type.keys().next(); + if (!iterResult.done) + return iterResult.value; + return ts6.Debug.fail("Expected 'option.type' to have entries."); + } + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function trace2(host) { + host.trace(ts6.formatMessage.apply(void 0, arguments)); + } + ts6.trace = trace2; + function isTraceEnabled(compilerOptions, host) { + return !!compilerOptions.traceResolution && host.trace !== void 0; + } + ts6.isTraceEnabled = isTraceEnabled; + function withPackageId(packageInfo, r) { + var packageId; + if (r && packageInfo) { + var packageJsonContent = packageInfo.contents.packageJsonContent; + if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { + packageId = { + name: packageJsonContent.name, + subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts6.directorySeparator.length), + version: packageJsonContent.version + }; + } + } + return r && { path: r.path, extension: r.ext, packageId }; + } + function noPackageId(r) { + return withPackageId( + /*packageInfo*/ + void 0, + r + ); + } + function removeIgnoredPackageId(r) { + if (r) { + ts6.Debug.assert(r.packageId === void 0); + return { path: r.path, ext: r.extension }; + } + } + var Extensions; + (function(Extensions2) { + Extensions2[Extensions2["TypeScript"] = 0] = "TypeScript"; + Extensions2[Extensions2["JavaScript"] = 1] = "JavaScript"; + Extensions2[Extensions2["Json"] = 2] = "Json"; + Extensions2[Extensions2["TSConfig"] = 3] = "TSConfig"; + Extensions2[Extensions2["DtsOnly"] = 4] = "DtsOnly"; + Extensions2[Extensions2["TsOnly"] = 5] = "TsOnly"; + })(Extensions || (Extensions = {})); + function resolvedTypeScriptOnly(resolved) { + if (!resolved) { + return void 0; + } + ts6.Debug.assert(ts6.extensionIsTS(resolved.extension)); + return { fileName: resolved.path, packageId: resolved.packageId }; + } + function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) { + var _a, _b; + if (resultFromCache) { + (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations); + (_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations); + return resultFromCache; + } + return { + resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? void 0 : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport, packageId: resolved.packageId }, + failedLookupLocations, + affectingLocations, + resolutionDiagnostics: diagnostics + }; + } + function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) { + if (!ts6.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_does_not_have_a_0_field, fieldName); + } + return; + } + var value = jsonContent[fieldName]; + if (typeof value !== typeOfTag || value === null) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2, fieldName, typeOfTag, value === null ? "null" : typeof value); + } + return; + } + return value; + } + function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) { + var fileName = readPackageJsonField(jsonContent, fieldName, "string", state); + if (fileName === void 0) { + return; + } + if (!fileName) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_had_a_falsy_0_field, fieldName); + } + return; + } + var path = ts6.normalizePath(ts6.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); + } + return path; + } + function readPackageJsonTypesFields(jsonContent, baseDirectory, state) { + return readPackageJsonPathField(jsonContent, "typings", baseDirectory, state) || readPackageJsonPathField(jsonContent, "types", baseDirectory, state); + } + function readPackageJsonTSConfigField(jsonContent, baseDirectory, state) { + return readPackageJsonPathField(jsonContent, "tsconfig", baseDirectory, state); + } + function readPackageJsonMainField(jsonContent, baseDirectory, state) { + return readPackageJsonPathField(jsonContent, "main", baseDirectory, state); + } + function readPackageJsonTypesVersionsField(jsonContent, state) { + var typesVersions = readPackageJsonField(jsonContent, "typesVersions", "object", state); + if (typesVersions === void 0) + return; + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_has_a_typesVersions_field_with_version_specific_path_mappings); + } + return typesVersions; + } + function readPackageJsonTypesVersionPaths(jsonContent, state) { + var typesVersions = readPackageJsonTypesVersionsField(jsonContent, state); + if (typesVersions === void 0) + return; + if (state.traceEnabled) { + for (var key in typesVersions) { + if (ts6.hasProperty(typesVersions, key) && !ts6.VersionRange.tryParse(key)) { + trace2(state.host, ts6.Diagnostics.package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range, key); + } + } + } + var result = getPackageJsonTypesVersionsPaths(typesVersions); + if (!result) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_does_not_have_a_typesVersions_entry_that_matches_version_0, ts6.versionMajorMinor); + } + return; + } + var bestVersionKey = result.version, bestVersionPaths = result.paths; + if (typeof bestVersionPaths !== "object") { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2, "typesVersions['".concat(bestVersionKey, "']"), "object", typeof bestVersionPaths); + } + return; + } + return result; + } + var typeScriptVersion; + function getPackageJsonTypesVersionsPaths(typesVersions) { + if (!typeScriptVersion) + typeScriptVersion = new ts6.Version(ts6.version); + for (var key in typesVersions) { + if (!ts6.hasProperty(typesVersions, key)) + continue; + var keyRange = ts6.VersionRange.tryParse(key); + if (keyRange === void 0) { + continue; + } + if (keyRange.test(typeScriptVersion)) { + return { version: key, paths: typesVersions[key] }; + } + } + } + ts6.getPackageJsonTypesVersionsPaths = getPackageJsonTypesVersionsPaths; + function getEffectiveTypeRoots(options, host) { + if (options.typeRoots) { + return options.typeRoots; + } + var currentDirectory; + if (options.configFilePath) { + currentDirectory = ts6.getDirectoryPath(options.configFilePath); + } else if (host.getCurrentDirectory) { + currentDirectory = host.getCurrentDirectory(); + } + if (currentDirectory !== void 0) { + return getDefaultTypeRoots(currentDirectory, host); + } + } + ts6.getEffectiveTypeRoots = getEffectiveTypeRoots; + function getDefaultTypeRoots(currentDirectory, host) { + if (!host.directoryExists) { + return [ts6.combinePaths(currentDirectory, nodeModulesAtTypes)]; + } + var typeRoots; + ts6.forEachAncestorDirectory(ts6.normalizePath(currentDirectory), function(directory) { + var atTypes = ts6.combinePaths(directory, nodeModulesAtTypes); + if (host.directoryExists(atTypes)) { + (typeRoots || (typeRoots = [])).push(atTypes); + } + return void 0; + }); + return typeRoots; + } + var nodeModulesAtTypes = ts6.combinePaths("node_modules", "@types"); + function arePathsEqual(path1, path2, host) { + var useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames; + return ts6.comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0; + } + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) { + ts6.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself."); + var traceEnabled = isTraceEnabled(options, host); + if (redirectedReference) { + options = redirectedReference.commandLine.options; + } + var containingDirectory = containingFile ? ts6.getDirectoryPath(containingFile) : void 0; + var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : void 0; + var result = perFolderCache && perFolderCache.get( + typeReferenceDirectiveName, + /*mode*/ + resolutionMode + ); + if (result) { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile); + if (redirectedReference) + trace2(host, ts6.Diagnostics.Using_compiler_options_of_project_reference_redirect_0, redirectedReference.sourceFile.fileName); + trace2(host, ts6.Diagnostics.Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1, typeReferenceDirectiveName, containingDirectory); + traceResult(result); + } + return result; + } + var typeRoots = getEffectiveTypeRoots(options, host); + if (traceEnabled) { + if (containingFile === void 0) { + if (typeRoots === void 0) { + trace2(host, ts6.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } else { + trace2(host, ts6.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); + } + } else { + if (typeRoots === void 0) { + trace2(host, ts6.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } else { + trace2(host, ts6.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); + } + } + if (redirectedReference) { + trace2(host, ts6.Diagnostics.Using_compiler_options_of_project_reference_redirect_0, redirectedReference.sourceFile.fileName); + } + } + var failedLookupLocations = []; + var affectingLocations = []; + var features = getDefaultNodeResolutionFeatures(options); + if (resolutionMode === ts6.ModuleKind.ESNext && (ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.NodeNext)) { + features |= NodeResolutionFeatures.EsmMode; + } + var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : []; + var diagnostics = []; + var moduleResolutionState = { + compilerOptions: options, + host, + traceEnabled, + failedLookupLocations, + affectingLocations, + packageJsonInfoCache: cache, + features, + conditions, + requestContainingDirectory: containingDirectory, + reportDiagnostic: function(diag) { + return void diagnostics.push(diag); + } + }; + var resolved = primaryLookup(); + var primary = true; + if (!resolved) { + resolved = secondaryLookup(); + primary = false; + } + var resolvedTypeReferenceDirective; + if (resolved) { + var fileName = resolved.fileName, packageId = resolved.packageId; + var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); + resolvedTypeReferenceDirective = { + primary, + // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? void 0 : fileName, + packageId, + isExternalLibraryImport: pathContainsNodeModules(fileName) + }; + } + result = { resolvedTypeReferenceDirective, failedLookupLocations, affectingLocations, resolutionDiagnostics: diagnostics }; + perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set( + typeReferenceDirectiveName, + /*mode*/ + resolutionMode, + result + ); + if (traceEnabled) + traceResult(result); + return result; + function traceResult(result2) { + var _a; + if (!((_a = result2.resolvedTypeReferenceDirective) === null || _a === void 0 ? void 0 : _a.resolvedFileName)) { + trace2(host, ts6.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } else if (result2.resolvedTypeReferenceDirective.packageId) { + trace2(host, ts6.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result2.resolvedTypeReferenceDirective.resolvedFileName, ts6.packageIdToString(result2.resolvedTypeReferenceDirective.packageId), result2.resolvedTypeReferenceDirective.primary); + } else { + trace2(host, ts6.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result2.resolvedTypeReferenceDirective.resolvedFileName, result2.resolvedTypeReferenceDirective.primary); + } + } + function primaryLookup() { + if (typeRoots && typeRoots.length) { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); + } + return ts6.firstDefined(typeRoots, function(typeRoot) { + var candidate = ts6.combinePaths(typeRoot, typeReferenceDirectiveName); + var candidateDirectory = ts6.getDirectoryPath(candidate); + var directoryExists = ts6.directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace2(host, ts6.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, !directoryExists, moduleResolutionState)); + }); + } else { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + } + function secondaryLookup() { + var initialLocationForSecondaryLookup = containingFile && ts6.getDirectoryPath(containingFile); + if (initialLocationForSecondaryLookup !== void 0) { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + var result_4; + if (!ts6.isExternalModuleNameRelative(typeReferenceDirectiveName)) { + var searchResult = loadModuleFromNearestNodeModulesDirectory( + Extensions.DtsOnly, + typeReferenceDirectiveName, + initialLocationForSecondaryLookup, + moduleResolutionState, + /*cache*/ + void 0, + /*redirectedReference*/ + void 0 + ); + result_4 = searchResult && searchResult.value; + } else { + var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path; + result_4 = nodeLoadModuleByRelativeName( + Extensions.DtsOnly, + candidate, + /*onlyRecordFailures*/ + false, + moduleResolutionState, + /*considerPackageJson*/ + true + ); + } + return resolvedTypeScriptOnly(result_4); + } else { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + } + } + ts6.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function getDefaultNodeResolutionFeatures(options) { + return ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default : ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault : NodeResolutionFeatures.None; + } + function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) { + var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options); + return ts6.forEachAncestorDirectory(containingDirectory, function(ancestorDirectory) { + if (ts6.getBaseFileName(ancestorDirectory) !== "node_modules") { + var nodeModulesFolder = ts6.combinePaths(ancestorDirectory, "node_modules"); + var candidate = ts6.combinePaths(nodeModulesFolder, packageName); + return getPackageJsonInfo( + candidate, + /*onlyRecordFailures*/ + false, + moduleResolutionState + ); + } + }); + } + ts6.resolvePackageNameToPackageJson = resolvePackageNameToPackageJson; + function getAutomaticTypeDirectiveNames(options, host) { + if (options.types) { + return options.types; + } + var result = []; + if (host.directoryExists && host.getDirectories) { + var typeRoots = getEffectiveTypeRoots(options, host); + if (typeRoots) { + for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { + var root = typeRoots_1[_i]; + if (host.directoryExists(root)) { + for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { + var typeDirectivePath = _b[_a]; + var normalized = ts6.normalizePath(typeDirectivePath); + var packageJsonPath = ts6.combinePaths(root, normalized, "package.json"); + var isNotNeededPackage = host.fileExists(packageJsonPath) && ts6.readJson(packageJsonPath, host).typings === null; + if (!isNotNeededPackage) { + var baseFileName = ts6.getBaseFileName(normalized); + if (baseFileName.charCodeAt(0) !== 46) { + result.push(baseFileName); + } + } + } + } + } + } + } + return result; + } + ts6.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; + function createCacheWithRedirects(options) { + var ownMap = new ts6.Map(); + var redirectsMap = new ts6.Map(); + return { + getOwnMap, + redirectsMap, + getOrCreateMapOfCacheRedirects, + clear, + setOwnOptions, + setOwnMap + }; + function getOwnMap() { + return ownMap; + } + function setOwnOptions(newOptions) { + options = newOptions; + } + function setOwnMap(newOwnMap) { + ownMap = newOwnMap; + } + function getOrCreateMapOfCacheRedirects(redirectedReference) { + if (!redirectedReference) { + return ownMap; + } + var path = redirectedReference.sourceFile.path; + var redirects = redirectsMap.get(path); + if (!redirects) { + redirects = !options || ts6.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? new ts6.Map() : ownMap; + redirectsMap.set(path, redirects); + } + return redirects; + } + function clear() { + ownMap.clear(); + redirectsMap.clear(); + } + } + ts6.createCacheWithRedirects = createCacheWithRedirects; + function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) { + var cache; + return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear, entries, getInternalMap }; + function getPackageJsonInfo2(packageJsonPath) { + return cache === null || cache === void 0 ? void 0 : cache.get(ts6.toPath(packageJsonPath, currentDirectory, getCanonicalFileName)); + } + function setPackageJsonInfo(packageJsonPath, info) { + (cache || (cache = new ts6.Map())).set(ts6.toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info); + } + function clear() { + cache = void 0; + } + function entries() { + var iter = cache === null || cache === void 0 ? void 0 : cache.entries(); + return iter ? ts6.arrayFrom(iter) : []; + } + function getInternalMap() { + return cache; + } + } + function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) { + var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference); + var result = cache.get(key); + if (!result) { + result = create(); + cache.set(key, result); + } + return result; + } + function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) { + if (!options.configFile) + return; + if (directoryToModuleNameMap.redirectsMap.size === 0) { + ts6.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0); + ts6.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0); + ts6.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0); + directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap()); + moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap()); + } else { + ts6.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0); + var ref = { + sourceFile: options.configFile, + commandLine: { options } + }; + directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref)); + moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref)); + } + directoryToModuleNameMap.setOwnOptions(options); + moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options); + } + function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) { + return { + getOrCreateCacheForDirectory, + clear, + update + }; + function clear() { + directoryToModuleNameMap.clear(); + } + function update(options) { + updateRedirectsMap(options, directoryToModuleNameMap); + } + function getOrCreateCacheForDirectory(directoryName, redirectedReference) { + var path = ts6.toPath(directoryName, currentDirectory, getCanonicalFileName); + return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function() { + return createModeAwareCache(); + }); + } + } + function createModeAwareCache() { + var underlying = new ts6.Map(); + var memoizedReverseKeys = new ts6.Map(); + var cache = { + get: function(specifier, mode) { + return underlying.get(getUnderlyingCacheKey(specifier, mode)); + }, + set: function(specifier, mode, value) { + underlying.set(getUnderlyingCacheKey(specifier, mode), value); + return cache; + }, + delete: function(specifier, mode) { + underlying.delete(getUnderlyingCacheKey(specifier, mode)); + return cache; + }, + has: function(specifier, mode) { + return underlying.has(getUnderlyingCacheKey(specifier, mode)); + }, + forEach: function(cb) { + return underlying.forEach(function(elem, key) { + var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1]; + return cb(elem, specifier, mode); + }); + }, + size: function() { + return underlying.size; + } + }; + return cache; + function getUnderlyingCacheKey(specifier, mode) { + var result = mode === void 0 ? specifier : "".concat(mode, "|").concat(specifier); + memoizedReverseKeys.set(result, [specifier, mode]); + return result; + } + } + ts6.createModeAwareCache = createModeAwareCache; + function zipToModeAwareCache(file, keys, values) { + ts6.Debug.assert(keys.length === values.length); + var map = createModeAwareCache(); + for (var i = 0; i < keys.length; ++i) { + var entry = keys[i]; + var name = !ts6.isString(entry) ? entry.fileName.toLowerCase() : entry; + var mode = !ts6.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts6.getModeForResolutionAtIndex(file, i); + map.set(name, mode, values[i]); + } + return map; + } + ts6.zipToModeAwareCache = zipToModeAwareCache; + function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) { + var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options))); + moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options)); + var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName); + return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName, clear, update, getPackageJsonInfoCache: function() { + return packageJsonInfoCache; + }, clearAllExceptPackageJsonInfoCache }); + function clear() { + clearAllExceptPackageJsonInfoCache(); + packageJsonInfoCache.clear(); + } + function clearAllExceptPackageJsonInfoCache() { + perDirectoryResolutionCache.clear(); + moduleNameToDirectoryMap.clear(); + } + function update(options2) { + updateRedirectsMap(options2, directoryToModuleNameMap, moduleNameToDirectoryMap); + } + function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) { + ts6.Debug.assert(!ts6.isExternalModuleNameRelative(nonRelativeModuleName)); + return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === void 0 ? nonRelativeModuleName : "".concat(mode, "|").concat(nonRelativeModuleName), createPerModuleNameCache); + } + function createPerModuleNameCache() { + var directoryPathMap = new ts6.Map(); + return { get, set }; + function get(directory) { + return directoryPathMap.get(ts6.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts6.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.has(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName); + var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName); + var current = path; + while (current !== commonPrefix) { + var parent = ts6.getDirectoryPath(current); + if (parent === current || directoryPathMap.has(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + } + } + function getCommonPrefix(directory, resolution) { + var resolutionDirectory = ts6.toPath(ts6.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + var limit = Math.min(directory.length, resolutionDirectory.length); + while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts6.directorySeparator)) { + return directory; + } + var rootLength = ts6.getRootLength(directory); + if (i < rootLength) { + return void 0; + } + var sep = directory.lastIndexOf(ts6.directorySeparator, i - 1); + if (sep === -1) { + return void 0; + } + return directory.substr(0, Math.max(sep, rootLength)); + } + } + } + ts6.createModuleResolutionCache = createModuleResolutionCache; + function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) { + var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options))); + packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName)); + return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear, clearAllExceptPackageJsonInfoCache }); + function clear() { + clearAllExceptPackageJsonInfoCache(); + packageJsonInfoCache.clear(); + } + function clearAllExceptPackageJsonInfoCache() { + perDirectoryResolutionCache.clear(); + } + } + ts6.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache; + function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) { + var containingDirectory = ts6.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + if (!perFolderCache) + return void 0; + return perFolderCache.get(moduleName, mode); + } + ts6.resolveModuleNameFromCache = resolveModuleNameFromCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (redirectedReference) { + compilerOptions = redirectedReference.commandLine.options; + } + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + if (redirectedReference) { + trace2(host, ts6.Diagnostics.Using_compiler_options_of_project_reference_redirect_0, redirectedReference.sourceFile.fileName); + } + } + var containingDirectory = ts6.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference); + var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode); + if (result) { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory); + } + } else { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === void 0) { + switch (ts6.getEmitModuleKind(compilerOptions)) { + case ts6.ModuleKind.CommonJS: + moduleResolution = ts6.ModuleResolutionKind.NodeJs; + break; + case ts6.ModuleKind.Node16: + moduleResolution = ts6.ModuleResolutionKind.Node16; + break; + case ts6.ModuleKind.NodeNext: + moduleResolution = ts6.ModuleResolutionKind.NodeNext; + break; + default: + moduleResolution = ts6.ModuleResolutionKind.Classic; + break; + } + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts6.ModuleResolutionKind[moduleResolution]); + } + } else { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts6.ModuleResolutionKind[moduleResolution]); + } + } + ts6.perfLogger.logStartResolveModule( + moduleName + /* , containingFile, ModuleResolutionKind[moduleResolution]*/ + ); + switch (moduleResolution) { + case ts6.ModuleResolutionKind.Node16: + result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); + break; + case ts6.ModuleResolutionKind.NodeNext: + result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); + break; + case ts6.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); + break; + case ts6.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); + break; + default: + return ts6.Debug.fail("Unexpected moduleResolution: ".concat(moduleResolution)); + } + if (result && result.resolvedModule) + ts6.perfLogger.logInfoEvent('Module "'.concat(moduleName, '" resolved to "').concat(result.resolvedModule.resolvedFileName, '"')); + ts6.perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null"); + if (perFolderCache) { + perFolderCache.set(moduleName, resolutionMode, result); + if (!ts6.isExternalModuleNameRelative(moduleName)) { + cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result); + } + } + } + if (traceEnabled) { + if (result.resolvedModule) { + if (result.resolvedModule.packageId) { + trace2(host, ts6.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts6.packageIdToString(result.resolvedModule.packageId)); + } else { + trace2(host, ts6.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + } else { + trace2(host, ts6.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts6.resolveModuleName = resolveModuleName; + function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state) { + var resolved = tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state); + if (resolved) + return resolved.value; + if (!ts6.isExternalModuleNameRelative(moduleName)) { + return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state); + } else { + return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, state); + } + } + function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) { + var _a; + var _b = state.compilerOptions, baseUrl = _b.baseUrl, paths = _b.paths, configFile = _b.configFile; + if (paths && !ts6.pathIsRelative(moduleName)) { + if (state.traceEnabled) { + if (baseUrl) { + trace2(state.host, ts6.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, baseUrl, moduleName); + } + trace2(state.host, ts6.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + var baseDirectory = ts6.getPathsBasePath(state.compilerOptions, state.host); + var pathPatterns = (configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = ts6.tryParsePatterns(paths)) : void 0; + return tryLoadModuleUsingPaths( + extensions, + moduleName, + baseDirectory, + paths, + pathPatterns, + loader, + /*onlyRecordFailures*/ + false, + state + ); + } + } + function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, state) { + if (!state.compilerOptions.rootDirs) { + return void 0; + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts6.normalizePath(ts6.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + var normalizedRoot = ts6.normalizePath(rootDir); + if (!ts6.endsWith(normalizedRoot, ts6.directorySeparator)) { + normalizedRoot += ts6.directorySeparator; + } + var isLongestMatchingPrefix = ts6.startsWith(candidate, normalizedRoot) && (matchedNormalizedPrefix === void 0 || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(extensions, candidate, !ts6.directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Trying_other_entries_in_rootDirs); + } + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + continue; + } + var candidate_1 = ts6.combinePaths(ts6.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts6.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(extensions, candidate_1, !ts6.directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return void 0; + } + function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state) { + var baseUrl = state.compilerOptions.baseUrl; + if (!baseUrl) { + return void 0; + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, baseUrl, moduleName); + } + var candidate = ts6.normalizePath(ts6.combinePaths(baseUrl, moduleName)); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, baseUrl, candidate); + } + return loader(extensions, candidate, !ts6.directoryProbablyExists(ts6.getDirectoryPath(candidate), state.host), state); + } + function resolveJSModule(moduleName, initialDir, host) { + var _a = tryResolveJSModuleWorker(moduleName, initialDir, host), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; + if (!resolvedModule) { + throw new Error("Could not resolve JS module '".concat(moduleName, "' starting at '").concat(initialDir, "'. Looked in: ").concat(failedLookupLocations.join(", "))); + } + return resolvedModule.resolvedFileName; + } + ts6.resolveJSModule = resolveJSModule; + var NodeResolutionFeatures; + (function(NodeResolutionFeatures2) { + NodeResolutionFeatures2[NodeResolutionFeatures2["None"] = 0] = "None"; + NodeResolutionFeatures2[NodeResolutionFeatures2["Imports"] = 2] = "Imports"; + NodeResolutionFeatures2[NodeResolutionFeatures2["SelfName"] = 4] = "SelfName"; + NodeResolutionFeatures2[NodeResolutionFeatures2["Exports"] = 8] = "Exports"; + NodeResolutionFeatures2[NodeResolutionFeatures2["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers"; + NodeResolutionFeatures2[NodeResolutionFeatures2["AllFeatures"] = 30] = "AllFeatures"; + NodeResolutionFeatures2[NodeResolutionFeatures2["Node16Default"] = 30] = "Node16Default"; + NodeResolutionFeatures2[NodeResolutionFeatures2["NodeNextDefault"] = 30] = "NodeNextDefault"; + NodeResolutionFeatures2[NodeResolutionFeatures2["EsmMode"] = 32] = "EsmMode"; + })(NodeResolutionFeatures || (NodeResolutionFeatures = {})); + function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { + return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); + } + function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { + return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); + } + var jsOnlyExtensions = [Extensions.JavaScript]; + var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript]; + var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false); + var tsconfigExtensions = [Extensions.TSConfig]; + function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { + var containingDirectory = ts6.getDirectoryPath(containingFile); + var esmMode = resolutionMode === ts6.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0; + var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions; + if (compilerOptions.resolveJsonModule) { + extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false); + } + return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference); + } + function tryResolveJSModuleWorker(moduleName, initialDir, host) { + return nodeModuleNameResolverWorker( + NodeResolutionFeatures.None, + moduleName, + initialDir, + { moduleResolution: ts6.ModuleResolutionKind.NodeJs, allowJs: true }, + host, + /*cache*/ + void 0, + jsOnlyExtensions, + /*redirectedReferences*/ + void 0 + ); + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) { + var extensions; + if (lookupConfig) { + extensions = tsconfigExtensions; + } else if (compilerOptions.noDtsResolution) { + extensions = [Extensions.TsOnly]; + if (compilerOptions.allowJs) + extensions.push(Extensions.JavaScript); + if (compilerOptions.resolveJsonModule) + extensions.push(Extensions.Json); + } else { + extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions; + } + return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts6.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference); + } + ts6.nodeModuleNameResolver = nodeModuleNameResolver; + function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) { + var _a, _b; + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var affectingLocations = []; + var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]; + if (compilerOptions.noDtsResolution) { + conditions.pop(); + } + var diagnostics = []; + var state = { + compilerOptions, + host, + traceEnabled, + failedLookupLocations, + affectingLocations, + packageJsonInfoCache: cache, + features, + conditions, + requestContainingDirectory: containingDirectory, + reportDiagnostic: function(diag) { + return void diagnostics.push(diag); + } + }; + if (traceEnabled && ts6.getEmitModuleResolutionKind(compilerOptions) >= ts6.ModuleResolutionKind.Node16 && ts6.getEmitModuleResolutionKind(compilerOptions) <= ts6.ModuleResolutionKind.NodeNext) { + trace2(host, ts6.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function(c) { + return "'".concat(c, "'"); + }).join(", ")); + } + var result = ts6.forEach(extensions, function(ext) { + return tryResolve(ext); + }); + return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); + function tryResolve(extensions2) { + var loader = function(extensions3, candidate2, onlyRecordFailures, state2) { + return nodeLoadModuleByRelativeName( + extensions3, + candidate2, + onlyRecordFailures, + state2, + /*considerPackageJson*/ + true + ); + }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions2, moduleName, containingDirectory, loader, state); + if (resolved) { + return toSearchResult({ resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) }); + } + if (!ts6.isExternalModuleNameRelative(moduleName)) { + var resolved_1; + if (features & NodeResolutionFeatures.Imports && ts6.startsWith(moduleName, "#")) { + resolved_1 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state, cache, redirectedReference); + } + if (!resolved_1 && features & NodeResolutionFeatures.SelfName) { + resolved_1 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state, cache, redirectedReference); + } + if (!resolved_1) { + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions2]); + } + resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state, cache, redirectedReference); + } + if (!resolved_1) + return void 0; + var resolvedValue = resolved_1.value; + if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { + var path = realPath(resolvedValue.path, host, traceEnabled); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? void 0 : resolvedValue.path; + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath }); + } + return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; + } else { + var _a2 = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a2.path, parts = _a2.parts; + var resolved_2 = nodeLoadModuleByRelativeName( + extensions2, + candidate, + /*onlyRecordFailures*/ + false, + state, + /*considerPackageJson*/ + true + ); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts6.contains(parts, "node_modules") }); + } + } + } + function normalizePathForCJSResolution(containingDirectory, moduleName) { + var combined = ts6.combinePaths(containingDirectory, moduleName); + var parts = ts6.getPathComponents(combined); + var lastPart = ts6.lastOrUndefined(parts); + var path = lastPart === "." || lastPart === ".." ? ts6.ensureTrailingDirectorySeparator(ts6.normalizePath(combined)) : ts6.normalizePath(combined); + return { path, parts }; + } + function realPath(path, host, traceEnabled) { + if (!host.realpath) { + return path; + } + var real = ts6.normalizePath(host.realpath(path)); + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Resolving_real_path_for_0_result_1, path, real); + } + ts6.Debug.assert(host.fileExists(real), "".concat(path, " linked to nonexistent file ").concat(real)); + return real; + } + function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts6.hasTrailingDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts6.getDirectoryPath(candidate); + if (!ts6.directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state); + if (resolvedFromFile) { + var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile.path) : void 0; + var packageInfo = packageDirectory ? getPackageJsonInfo( + packageDirectory, + /*onlyRecordFailures*/ + false, + state + ) : void 0; + return withPackageId(packageInfo, resolvedFromFile); + } + } + if (!onlyRecordFailures) { + var candidateExists = ts6.directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + if (!(state.features & NodeResolutionFeatures.EsmMode)) { + return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson); + } + return void 0; + } + ts6.nodeModulesPathPart = "/node_modules/"; + function pathContainsNodeModules(path) { + return ts6.stringContains(path, ts6.nodeModulesPathPart); + } + ts6.pathContainsNodeModules = pathContainsNodeModules; + function parseNodeModuleFromPath(resolved) { + var path = ts6.normalizePath(resolved); + var idx = path.lastIndexOf(ts6.nodeModulesPathPart); + if (idx === -1) { + return void 0; + } + var indexAfterNodeModules = idx + ts6.nodeModulesPathPart.length; + var indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules); + if (path.charCodeAt(indexAfterNodeModules) === 64) { + indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName); + } + return path.slice(0, indexAfterPackageName); + } + ts6.parseNodeModuleFromPath = parseNodeModuleFromPath; + function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) { + var nextSeparatorIndex = path.indexOf(ts6.directorySeparator, prevSeparatorIndex + 1); + return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex; + } + function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) { + return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state)); + } + function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) { + if (extensions === Extensions.Json || extensions === Extensions.TSConfig) { + var extensionLess = ts6.tryRemoveExtension( + candidate, + ".json" + /* Extension.Json */ + ); + var extension = extensionLess ? candidate.substring(extensionLess.length) : ""; + return extensionLess === void 0 && extensions === Extensions.Json ? void 0 : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state); + } + if (!(state.features & NodeResolutionFeatures.EsmMode)) { + var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state); + if (resolvedByAddingExtension) { + return resolvedByAddingExtension; + } + } + return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state); + } + function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) { + if (ts6.hasJSFileExtension(candidate) || ts6.fileExtensionIs( + candidate, + ".json" + /* Extension.Json */ + ) && state.compilerOptions.resolveJsonModule) { + var extensionless = ts6.removeFileExtension(candidate); + var extension = candidate.substring(extensionless.length); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); + } + return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state); + } + } + function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) { + if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts6.fileExtensionIsOneOf(candidate, ts6.supportedTSExtensionsFlat)) { + var result = tryFile(candidate, onlyRecordFailures, state); + return result !== void 0 ? { path: candidate, ext: ts6.tryExtractTSExtension(candidate) } : void 0; + } + return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state); + } + function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts6.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !ts6.directoryProbablyExists(directory, state.host); + } + } + switch (extensions) { + case Extensions.DtsOnly: + switch (originalExtension) { + case ".mjs": + case ".mts": + case ".d.mts": + return tryExtension( + ".d.mts" + /* Extension.Dmts */ + ); + case ".cjs": + case ".cts": + case ".d.cts": + return tryExtension( + ".d.cts" + /* Extension.Dcts */ + ); + case ".json": + candidate += ".json"; + return tryExtension( + ".d.ts" + /* Extension.Dts */ + ); + default: + return tryExtension( + ".d.ts" + /* Extension.Dts */ + ); + } + case Extensions.TypeScript: + case Extensions.TsOnly: + var useDts = extensions === Extensions.TypeScript; + switch (originalExtension) { + case ".mjs": + case ".mts": + case ".d.mts": + return tryExtension( + ".mts" + /* Extension.Mts */ + ) || (useDts ? tryExtension( + ".d.mts" + /* Extension.Dmts */ + ) : void 0); + case ".cjs": + case ".cts": + case ".d.cts": + return tryExtension( + ".cts" + /* Extension.Cts */ + ) || (useDts ? tryExtension( + ".d.cts" + /* Extension.Dcts */ + ) : void 0); + case ".json": + candidate += ".json"; + return useDts ? tryExtension( + ".d.ts" + /* Extension.Dts */ + ) : void 0; + default: + return tryExtension( + ".ts" + /* Extension.Ts */ + ) || tryExtension( + ".tsx" + /* Extension.Tsx */ + ) || (useDts ? tryExtension( + ".d.ts" + /* Extension.Dts */ + ) : void 0); + } + case Extensions.JavaScript: + switch (originalExtension) { + case ".mjs": + case ".mts": + case ".d.mts": + return tryExtension( + ".mjs" + /* Extension.Mjs */ + ); + case ".cjs": + case ".cts": + case ".d.cts": + return tryExtension( + ".cjs" + /* Extension.Cjs */ + ); + case ".json": + return tryExtension( + ".json" + /* Extension.Json */ + ); + default: + return tryExtension( + ".js" + /* Extension.Js */ + ) || tryExtension( + ".jsx" + /* Extension.Jsx */ + ); + } + case Extensions.TSConfig: + case Extensions.Json: + return tryExtension( + ".json" + /* Extension.Json */ + ); + } + function tryExtension(ext) { + var path = tryFile(candidate + ext, onlyRecordFailures, state); + return path === void 0 ? void 0 : { path, ext }; + } + } + function tryFile(fileName, onlyRecordFailures, state) { + var _a, _b; + if (!((_a = state.compilerOptions.moduleSuffixes) === null || _a === void 0 ? void 0 : _a.length)) { + return tryFileLookup(fileName, onlyRecordFailures, state); + } + var ext = (_b = ts6.tryGetExtensionFromPath(fileName)) !== null && _b !== void 0 ? _b : ""; + var fileNameNoExtension = ext ? ts6.removeExtension(fileName, ext) : fileName; + return ts6.forEach(state.compilerOptions.moduleSuffixes, function(suffix) { + return tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state); + }); + } + function tryFileLookup(fileName, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; + } else { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.File_0_does_not_exist, fileName); + } + } + } + state.failedLookupLocations.push(fileName); + return void 0; + } + function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { + considerPackageJson = true; + } + var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; + return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); + } + function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== void 0) { + return packageJsonInfo.contents.resolvedEntrypoints; + } + var entrypoints; + var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; + var features = getDefaultNodeResolutionFeatures(options); + var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options); + requireState.conditions = ["node", "require", "types"]; + requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; + var requireResolution = loadNodeModuleFromDirectoryWorker( + extensions, + packageJsonInfo.packageDirectory, + /*onlyRecordFailures*/ + false, + requireState, + packageJsonInfo.contents.packageJsonContent, + packageJsonInfo.contents.versionPaths + ); + entrypoints = ts6.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { + for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { + var conditions = _a[_i]; + var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions }); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); + if (exportResolutions) { + for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { + var resolution = exportResolutions_1[_b]; + entrypoints = ts6.appendIfUnique(entrypoints, resolution.path); + } + } + } + } + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; + } + ts6.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; + function loadEntrypointsFromExportMap(scope, exports2, state, extensions) { + var entrypoints; + if (ts6.isArray(exports2)) { + for (var _i = 0, exports_1 = exports2; _i < exports_1.length; _i++) { + var target = exports_1[_i]; + loadEntrypointsFromTargetExports(target); + } + } else if (typeof exports2 === "object" && exports2 !== null && allKeysStartWithDot(exports2)) { + for (var key in exports2) { + loadEntrypointsFromTargetExports(exports2[key]); + } + } else { + loadEntrypointsFromTargetExports(exports2); + } + return entrypoints; + function loadEntrypointsFromTargetExports(target2) { + var _a, _b; + if (typeof target2 === "string" && ts6.startsWith(target2, "./") && target2.indexOf("*") === -1) { + var partsAfterFirst = ts6.getPathComponents(target2).slice(2); + if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) { + return false; + } + var resolvedTarget = ts6.combinePaths(scope.packageDirectory, target2); + var finalPath = ts6.getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); + var result = loadJSOrExactTSFileName( + extensions, + finalPath, + /*recordOnlyFailures*/ + false, + state + ); + if (result) { + entrypoints = ts6.appendIfUnique(entrypoints, result, function(a, b) { + return a.path === b.path; + }); + return true; + } + } else if (Array.isArray(target2)) { + for (var _i2 = 0, target_1 = target2; _i2 < target_1.length; _i2++) { + var t = target_1[_i2]; + var success = loadEntrypointsFromTargetExports(t); + if (success) { + return true; + } + } + } else if (typeof target2 === "object" && target2 !== null) { + return ts6.forEach(ts6.getOwnKeys(target2), function(key2) { + if (key2 === "default" || ts6.contains(state.conditions, key2) || isApplicableVersionedTypesKey(state.conditions, key2)) { + loadEntrypointsFromTargetExports(target2[key2]); + return true; + } + }); + } + } + } + function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) { + return { + host, + compilerOptions: options, + traceEnabled: isTraceEnabled(options, host), + failedLookupLocations: ts6.noopPush, + affectingLocations: ts6.noopPush, + packageJsonInfoCache, + features: NodeResolutionFeatures.None, + conditions: ts6.emptyArray, + requestContainingDirectory: void 0, + reportDiagnostic: ts6.noop + }; + } + ts6.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState; + function getPackageScopeForPath(fileName, state) { + var parts = ts6.getPathComponents(fileName); + parts.pop(); + while (parts.length > 0) { + var pkg = getPackageJsonInfo( + ts6.getPathFromPathComponents(parts), + /*onlyRecordFailures*/ + false, + state + ); + if (pkg) { + return pkg; + } + parts.pop(); + } + return void 0; + } + ts6.getPackageScopeForPath = getPackageScopeForPath; + function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) { + var _a, _b, _c; + var host = state.host, traceEnabled = state.traceEnabled; + var packageJsonPath = ts6.combinePaths(packageDirectory, "package.json"); + if (onlyRecordFailures) { + state.failedLookupLocations.push(packageJsonPath); + return void 0; + } + var existing = (_a = state.packageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(packageJsonPath); + if (existing !== void 0) { + if (typeof existing !== "boolean") { + if (traceEnabled) + trace2(host, ts6.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); + state.affectingLocations.push(packageJsonPath); + return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents }; + } else { + if (existing && traceEnabled) + trace2(host, ts6.Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath); + state.failedLookupLocations.push(packageJsonPath); + return void 0; + } + } + var directoryExists = ts6.directoryProbablyExists(packageDirectory, host); + if (directoryExists && host.fileExists(packageJsonPath)) { + var packageJsonContent = ts6.readJson(packageJsonPath, host); + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); + var result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } }; + (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); + state.affectingLocations.push(packageJsonPath); + return result; + } else { + if (directoryExists && traceEnabled) { + trace2(host, ts6.Diagnostics.File_0_does_not_exist, packageJsonPath); + } + (_c = state.packageJsonInfoCache) === null || _c === void 0 ? void 0 : _c.setPackageJsonInfo(packageJsonPath, directoryExists); + state.failedLookupLocations.push(packageJsonPath); + } + } + ts6.getPackageJsonInfo = getPackageJsonInfo; + function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) { + var packageFile; + if (jsonContent) { + switch (extensions) { + case Extensions.JavaScript: + case Extensions.Json: + case Extensions.TsOnly: + packageFile = readPackageJsonMainField(jsonContent, candidate, state); + break; + case Extensions.TypeScript: + packageFile = readPackageJsonTypesFields(jsonContent, candidate, state) || readPackageJsonMainField(jsonContent, candidate, state); + break; + case Extensions.DtsOnly: + packageFile = readPackageJsonTypesFields(jsonContent, candidate, state); + break; + case Extensions.TSConfig: + packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state); + break; + default: + return ts6.Debug.assertNever(extensions); + } + } + var loader = function(extensions2, candidate2, onlyRecordFailures2, state2) { + var fromFile = tryFile(candidate2, onlyRecordFailures2, state2); + if (fromFile) { + var resolved = resolvedIfExtensionMatches(extensions2, fromFile); + if (resolved) { + return noPackageId(resolved); + } + if (state2.traceEnabled) { + trace2(state2.host, ts6.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); + } + } + var nextExtensions = extensions2 === Extensions.DtsOnly ? Extensions.TypeScript : extensions2; + var features = state2.features; + if ((jsonContent === null || jsonContent === void 0 ? void 0 : jsonContent.type) !== "module") { + state2.features &= ~NodeResolutionFeatures.EsmMode; + } + var result2 = nodeLoadModuleByRelativeName( + nextExtensions, + candidate2, + onlyRecordFailures2, + state2, + /*considerPackageJson*/ + false + ); + state2.features = features; + return result2; + }; + var onlyRecordFailuresForPackageFile = packageFile ? !ts6.directoryProbablyExists(ts6.getDirectoryPath(packageFile), state.host) : void 0; + var onlyRecordFailuresForIndex = onlyRecordFailures || !ts6.directoryProbablyExists(candidate, state.host); + var indexPath = ts6.combinePaths(candidate, extensions === Extensions.TSConfig ? "tsconfig" : "index"); + if (versionPaths && (!packageFile || ts6.containsPath(candidate, packageFile))) { + var moduleName = ts6.getRelativePathFromDirectory( + candidate, + packageFile || indexPath, + /*ignoreCase*/ + false + ); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts6.version, moduleName); + } + var result = tryLoadModuleUsingPaths( + extensions, + moduleName, + candidate, + versionPaths.paths, + /*pathPatterns*/ + void 0, + loader, + onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, + state + ); + if (result) { + return removeIgnoredPackageId(result.value); + } + } + var packageFileResult = packageFile && removeIgnoredPackageId(loader(extensions, packageFile, onlyRecordFailuresForPackageFile, state)); + if (packageFileResult) + return packageFileResult; + if (!(state.features & NodeResolutionFeatures.EsmMode)) { + return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state); + } + } + function resolvedIfExtensionMatches(extensions, path) { + var ext = ts6.tryGetExtensionFromPath(path); + return ext !== void 0 && extensionIsOk(extensions, ext) ? { path, ext } : void 0; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ".js" || extension === ".jsx" || extension === ".mjs" || extension === ".cjs"; + case Extensions.TSConfig: + case Extensions.Json: + return extension === ".json"; + case Extensions.TypeScript: + return extension === ".ts" || extension === ".tsx" || extension === ".mts" || extension === ".cts" || extension === ".d.ts" || extension === ".d.mts" || extension === ".d.cts"; + case Extensions.TsOnly: + return extension === ".ts" || extension === ".tsx" || extension === ".mts" || extension === ".cts"; + case Extensions.DtsOnly: + return extension === ".d.ts" || extension === ".d.mts" || extension === ".d.cts"; + } + } + function parsePackageName(moduleName) { + var idx = moduleName.indexOf(ts6.directorySeparator); + if (moduleName[0] === "@") { + idx = moduleName.indexOf(ts6.directorySeparator, idx + 1); + } + return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) }; + } + ts6.parsePackageName = parsePackageName; + function allKeysStartWithDot(obj) { + return ts6.every(ts6.getOwnKeys(obj), function(k) { + return ts6.startsWith(k, "."); + }); + } + ts6.allKeysStartWithDot = allKeysStartWithDot; + function noKeyStartsWithDot(obj) { + return !ts6.some(ts6.getOwnKeys(obj), function(k) { + return ts6.startsWith(k, "."); + }); + } + function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { + var _a, _b; + var directoryPath = ts6.getNormalizedAbsolutePath(ts6.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); + var scope = getPackageScopeForPath(directoryPath, state); + if (!scope || !scope.contents.packageJsonContent.exports) { + return void 0; + } + if (typeof scope.contents.packageJsonContent.name !== "string") { + return void 0; + } + var parts = ts6.getPathComponents(moduleName); + var nameParts = ts6.getPathComponents(scope.contents.packageJsonContent.name); + if (!ts6.every(nameParts, function(p, i) { + return parts[i] === p; + })) { + return void 0; + } + var trailingParts = parts.slice(nameParts.length); + return loadModuleFromExports(scope, extensions, !ts6.length(trailingParts) ? "." : ".".concat(ts6.directorySeparator).concat(trailingParts.join(ts6.directorySeparator)), state, cache, redirectedReference); + } + function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { + if (!scope.contents.packageJsonContent.exports) { + return void 0; + } + if (subpath === ".") { + var mainExport = void 0; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports)) { + mainExport = scope.contents.packageJsonContent.exports; + } else if (ts6.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; + } + if (mainExport) { + var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport( + extensions, + state, + cache, + redirectedReference, + subpath, + scope, + /*isImports*/ + false + ); + return loadModuleFromTargetImportOrExport( + mainExport, + "", + /*pattern*/ + false, + "." + ); + } + } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + var result = loadModuleFromImportsOrExports( + extensions, + state, + cache, + redirectedReference, + subpath, + scope.contents.packageJsonContent.exports, + scope, + /*isImports*/ + false + ); + if (result) { + return result; + } + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) { + var _a, _b; + if (moduleName === "#" || ts6.startsWith(moduleName, "#/")) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + var directoryPath = ts6.getNormalizedAbsolutePath(ts6.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); + var scope = getPackageScopeForPath(directoryPath, state); + if (!scope) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + if (!scope.contents.packageJsonContent.imports) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + var result = loadModuleFromImportsOrExports( + extensions, + state, + cache, + redirectedReference, + moduleName, + scope.contents.packageJsonContent.imports, + scope, + /*isImports*/ + true + ); + if (result) { + return result; + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1, moduleName, scope.packageDirectory); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + function comparePatternKeys(a, b) { + var aPatternIndex = a.indexOf("*"); + var bPatternIndex = b.indexOf("*"); + var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1; + var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1; + if (baseLenA > baseLenB) + return -1; + if (baseLenB > baseLenA) + return 1; + if (aPatternIndex === -1) + return 1; + if (bPatternIndex === -1) + return -1; + if (a.length > b.length) + return -1; + if (b.length > a.length) + return 1; + return 0; + } + ts6.comparePatternKeys = comparePatternKeys; + function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) { + var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); + if (!ts6.endsWith(moduleName, ts6.directorySeparator) && moduleName.indexOf("*") === -1 && ts6.hasProperty(lookupTable, moduleName)) { + var target = lookupTable[moduleName]; + return loadModuleFromTargetImportOrExport( + target, + /*subpath*/ + "", + /*pattern*/ + false, + moduleName + ); + } + var expandingKeys = ts6.sort(ts6.filter(ts6.getOwnKeys(lookupTable), function(k) { + return k.indexOf("*") !== -1 || ts6.endsWith(k, "/"); + }), comparePatternKeys); + for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { + var potentialTarget = expandingKeys_1[_i]; + if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) { + var target = lookupTable[potentialTarget]; + var starPos = potentialTarget.indexOf("*"); + var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); + return loadModuleFromTargetImportOrExport( + target, + subpath, + /*pattern*/ + true, + potentialTarget + ); + } else if (ts6.endsWith(potentialTarget, "*") && ts6.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { + var target = lookupTable[potentialTarget]; + var subpath = moduleName.substring(potentialTarget.length - 1); + return loadModuleFromTargetImportOrExport( + target, + subpath, + /*pattern*/ + true, + potentialTarget + ); + } else if (ts6.startsWith(moduleName, potentialTarget)) { + var target = lookupTable[potentialTarget]; + var subpath = moduleName.substring(potentialTarget.length); + return loadModuleFromTargetImportOrExport( + target, + subpath, + /*pattern*/ + false, + potentialTarget + ); + } + } + function matchesPatternWithTrailer(target2, name) { + if (ts6.endsWith(target2, "*")) + return false; + var starPos2 = target2.indexOf("*"); + if (starPos2 === -1) + return false; + return ts6.startsWith(name, target2.substring(0, starPos2)) && ts6.endsWith(name, target2.substring(starPos2 + 1)); + } + } + function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { + return loadModuleFromTargetImportOrExport; + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { + if (typeof target === "string") { + if (!pattern && subpath.length > 0 && !ts6.endsWith(target, "/")) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + if (!ts6.startsWith(target, "./")) { + if (isImports && !ts6.startsWith(target, "../") && !ts6.startsWith(target, "/") && !ts6.isRootedDiskPath(target)) { + var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts6.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts6.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); + var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); + return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : void 0); + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + var parts = ts6.pathIsRelative(target) ? ts6.getPathComponents(target).slice(1) : ts6.getPathComponents(target); + var partsAfterFirst = parts.slice(1); + if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + var resolvedTarget = ts6.combinePaths(scope.packageDirectory, target); + var subpathParts = ts6.getPathComponents(subpath); + if (subpathParts.indexOf("..") >= 0 || subpathParts.indexOf(".") >= 0 || subpathParts.indexOf("node_modules") >= 0) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } + var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); + var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts6.combinePaths(scope.packageDirectory, "package.json"), isImports); + if (inputLink) + return inputLink; + return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName( + extensions, + finalPath, + /*onlyRecordFailures*/ + false, + state + ))); + } else if (typeof target === "object" && target !== null) { + if (!Array.isArray(target)) { + for (var _i = 0, _a = ts6.getOwnKeys(target); _i < _a.length; _i++) { + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts6.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); + if (result) { + return result; + } + } else { + traceIfEnabled(state, ts6.Diagnostics.Saw_non_matching_condition_0, condition); + } + } + return void 0; + } else { + if (!ts6.length(target)) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { + var elem = target_2[_b]; + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); + if (result) { + return result; + } + } + } + } else if (target === null) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + } + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); + } + return toSearchResult( + /*value*/ + void 0 + ); + function toAbsolutePath(path) { + var _a2, _b2; + if (path === void 0) + return path; + return ts6.getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) === null || _b2 === void 0 ? void 0 : _b2.call(_a2)); + } + function combineDirectoryPath(root, dir) { + return ts6.ensureTrailingDirectorySeparator(ts6.combinePaths(root, dir)); + } + function useCaseSensitiveFileNames() { + return !state.host.useCaseSensitiveFileNames ? true : typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames : state.host.useCaseSensitiveFileNames(); + } + function tryLoadInputFileForPath(finalPath2, entry, packagePath, isImports2) { + var _a2, _b2, _c, _d; + if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json) && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath2.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? ts6.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) { + var getCanonicalFileName = ts6.hostGetCanonicalFileName({ useCaseSensitiveFileNames }); + var commonSourceDirGuesses = []; + if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) { + var commonDir = toAbsolutePath(ts6.getCommonSourceDirectory(state.compilerOptions, function() { + return []; + }, ((_b2 = (_a2 = state.host).getCurrentDirectory) === null || _b2 === void 0 ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName)); + commonSourceDirGuesses.push(commonDir); + } else if (state.requestContainingDirectory) { + var requestingFile_1 = toAbsolutePath(ts6.combinePaths(state.requestContainingDirectory, "index.ts")); + var commonDir = toAbsolutePath(ts6.getCommonSourceDirectory(state.compilerOptions, function() { + return [requestingFile_1, toAbsolutePath(packagePath)]; + }, ((_d = (_c = state.host).getCurrentDirectory) === null || _d === void 0 ? void 0 : _d.call(_c)) || "", getCanonicalFileName)); + commonSourceDirGuesses.push(commonDir); + var fragment = ts6.ensureTrailingDirectorySeparator(commonDir); + while (fragment && fragment.length > 1) { + var parts2 = ts6.getPathComponents(fragment); + parts2.pop(); + var commonDir_1 = ts6.getPathFromPathComponents(parts2); + commonSourceDirGuesses.unshift(commonDir_1); + fragment = ts6.ensureTrailingDirectorySeparator(commonDir_1); + } + } + if (commonSourceDirGuesses.length > 1) { + state.reportDiagnostic(ts6.createCompilerDiagnostic( + isImports2 ? ts6.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate : ts6.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, + entry === "" ? "." : entry, + // replace empty string with `.` - the reverse of the operation done when entries are built - so main entrypoint errors don't look weird + packagePath + )); + } + for (var _i2 = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i2 < commonSourceDirGuesses_1.length; _i2++) { + var commonSourceDirGuess = commonSourceDirGuesses_1[_i2]; + var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess); + for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) { + var candidateDir = candidateDirectories_1[_e]; + if (ts6.containsPath(candidateDir, finalPath2, !useCaseSensitiveFileNames())) { + var pathFragment = finalPath2.slice(candidateDir.length + 1); + var possibleInputBase = ts6.combinePaths(commonSourceDirGuess, pathFragment); + var jsAndDtsExtensions = [ + ".mjs", + ".cjs", + ".js", + ".json", + ".d.mts", + ".d.cts", + ".d.ts" + /* Extension.Dts */ + ]; + for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) { + var ext = jsAndDtsExtensions_1[_f]; + if (ts6.fileExtensionIs(possibleInputBase, ext)) { + var inputExts = ts6.getPossibleOriginalInputExtensionForExtension(possibleInputBase); + for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) { + var possibleExt = inputExts_1[_g]; + var possibleInputWithInputExtension = ts6.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames()); + if (extensions === Extensions.TypeScript && ts6.hasJSFileExtension(possibleInputWithInputExtension) || extensions === Extensions.JavaScript && ts6.hasTSFileExtension(possibleInputWithInputExtension)) { + continue; + } + if (state.host.fileExists(possibleInputWithInputExtension)) { + return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName( + extensions, + possibleInputWithInputExtension, + /*onlyRecordFailures*/ + false, + state + ))); + } + } + } + } + } + } + } + } + return void 0; + function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess2) { + var _a3, _b3; + var currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) === null || _b3 === void 0 ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess2; + var candidateDirectories2 = []; + if (state.compilerOptions.declarationDir) { + candidateDirectories2.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir))); + } + if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) { + candidateDirectories2.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir))); + } + return candidateDirectories2; + } + } + } + } + function isApplicableVersionedTypesKey(conditions, key) { + if (conditions.indexOf("types") === -1) + return false; + if (!ts6.startsWith(key, "types@")) + return false; + var range2 = ts6.VersionRange.tryParse(key.substring("types@".length)); + if (!range2) + return false; + return range2.test(ts6.version); + } + ts6.isApplicableVersionedTypesKey = isApplicableVersionedTypesKey; + function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) { + return loadModuleFromNearestNodeModulesDirectoryWorker( + extensions, + moduleName, + directory, + state, + /*typesScopeOnly*/ + false, + cache, + redirectedReference + ); + } + function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directory, state) { + return loadModuleFromNearestNodeModulesDirectoryWorker( + Extensions.DtsOnly, + moduleName, + directory, + state, + /*typesScopeOnly*/ + true, + /*cache*/ + void 0, + /*redirectedReference*/ + void 0 + ); + } + function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? void 0 : state.features & NodeResolutionFeatures.EsmMode ? ts6.ModuleKind.ESNext : ts6.ModuleKind.CommonJS, redirectedReference); + return ts6.forEachAncestorDirectory(ts6.normalizeSlashes(directory), function(ancestorDirectory) { + if (ts6.getBaseFileName(ancestorDirectory) !== "node_modules") { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference)); + } + }); + } + function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) { + var nodeModulesFolder = ts6.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = ts6.directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesScopeOnly ? void 0 : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference); + if (packageResult) { + return packageResult; + } + if (extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) { + var nodeModulesAtTypes_1 = ts6.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !ts6.directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state, cache, redirectedReference); + } + } + function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; + var candidate = ts6.normalizePath(ts6.combinePaths(nodeModulesDirectory, moduleName)); + var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); + if (!(state.features & NodeResolutionFeatures.Exports)) { + if (packageInfo) { + var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state); + if (fromFile) { + return noPackageId(fromFile); + } + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); + return withPackageId(packageInfo, fromDirectory); + } + } + var loader = function(extensions2, candidate2, onlyRecordFailures, state2) { + var pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(extensions2, candidate2, onlyRecordFailures, state2, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); + if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & NodeResolutionFeatures.EsmMode) { + pathAndExtension = loadModuleFromFile(extensions2, ts6.combinePaths(candidate2, "index.js"), onlyRecordFailures, state2); + } + return withPackageId(packageInfo, pathAndExtension); + }; + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts6.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); + } + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts6.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts6.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts6.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths( + extensions, + rest, + packageDirectory, + packageInfo.contents.versionPaths.paths, + /*pathPatterns*/ + void 0, + loader, + !packageDirectoryExists, + state + ); + if (fromPaths) { + return fromPaths.value; + } + } + return loader(extensions, candidate, !nodeModulesDirectoryExists, state); + } + function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) { + pathPatterns || (pathPatterns = ts6.tryParsePatterns(paths)); + var matchedPattern = ts6.matchPatternOrExact(pathPatterns, moduleName); + if (matchedPattern) { + var matchedStar_1 = ts6.isString(matchedPattern) ? void 0 : ts6.matchedText(matchedPattern, moduleName); + var matchedPatternText = ts6.isString(matchedPattern) ? matchedPattern : ts6.patternText(matchedPattern); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); + } + var resolved = ts6.forEach(paths[matchedPatternText], function(subst) { + var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst; + var candidate = ts6.normalizePath(ts6.combinePaths(baseDirectory, path)); + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var extension = ts6.tryGetExtensionFromPath(subst); + if (extension !== void 0) { + var path_1 = tryFile(candidate, onlyRecordFailures, state); + if (path_1 !== void 0) { + return noPackageId({ path: path_1, ext: extension }); + } + } + return loader(extensions, candidate, onlyRecordFailures || !ts6.directoryProbablyExists(ts6.getDirectoryPath(candidate), state.host), state); + }); + return { value: resolved }; + } + } + var mangledScopedPackageSeparator = "__"; + function mangleScopedPackageNameWithTrace(packageName, state) { + var mangled = mangleScopedPackageName(packageName); + if (state.traceEnabled && mangled !== packageName) { + trace2(state.host, ts6.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } + function getTypesPackageName(packageName) { + return "@types/".concat(mangleScopedPackageName(packageName)); + } + ts6.getTypesPackageName = getTypesPackageName; + function mangleScopedPackageName(packageName) { + if (ts6.startsWith(packageName, "@")) { + var replaceSlash = packageName.replace(ts6.directorySeparator, mangledScopedPackageSeparator); + if (replaceSlash !== packageName) { + return replaceSlash.slice(1); + } + } + return packageName; + } + ts6.mangleScopedPackageName = mangleScopedPackageName; + function getPackageNameFromTypesPackageName(mangledName) { + var withoutAtTypePrefix = ts6.removePrefix(mangledName, "@types/"); + if (withoutAtTypePrefix !== mangledName) { + return unmangleScopedPackageName(withoutAtTypePrefix); + } + return mangledName; + } + ts6.getPackageNameFromTypesPackageName = getPackageNameFromTypesPackageName; + function unmangleScopedPackageName(typesPackageName) { + return ts6.stringContains(typesPackageName, mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, ts6.directorySeparator) : typesPackageName; + } + ts6.unmangleScopedPackageName = unmangleScopedPackageName; + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (state.traceEnabled) { + trace2(state.host, ts6.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory); + } + state.resultFromCache = result; + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, originalPath: result.resolvedModule.originalPath || true, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var affectingLocations = []; + var containingDirectory = ts6.getDirectoryPath(containingFile); + var diagnostics = []; + var state = { + compilerOptions, + host, + traceEnabled, + failedLookupLocations, + affectingLocations, + packageJsonInfoCache: cache, + features: NodeResolutionFeatures.None, + conditions: [], + requestContainingDirectory: containingDirectory, + reportDiagnostic: function(diag) { + return void diagnostics.push(diag); + } + }; + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations( + resolved && resolved.value, + /*isExternalLibraryImport*/ + false, + failedLookupLocations, + affectingLocations, + diagnostics, + state.resultFromCache + ); + function tryResolve(extensions) { + var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state); + if (resolvedUsingSettings) { + return { value: resolvedUsingSettings }; + } + if (!ts6.isExternalModuleNameRelative(moduleName)) { + var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName( + moduleName, + /*mode*/ + void 0, + redirectedReference + ); + var resolved_3 = ts6.forEachAncestorDirectory(containingDirectory, function(directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state); + if (resolutionFromCache) { + return resolutionFromCache; + } + var searchName = ts6.normalizePath(ts6.combinePaths(directory, moduleName)); + return toSearchResult(loadModuleFromFileNoPackageId( + extensions, + searchName, + /*onlyRecordFailures*/ + false, + state + )); + }); + if (resolved_3) { + return resolved_3; + } + if (extensions === Extensions.TypeScript) { + return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state); + } + } else { + var candidate = ts6.normalizePath(ts6.combinePaths(containingDirectory, moduleName)); + return toSearchResult(loadModuleFromFileNoPackageId( + extensions, + candidate, + /*onlyRecordFailures*/ + false, + state + )); + } + } + } + ts6.classicNameResolver = classicNameResolver; + function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace2(host, ts6.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); + } + var failedLookupLocations = []; + var affectingLocations = []; + var diagnostics = []; + var state = { + compilerOptions, + host, + traceEnabled, + failedLookupLocations, + affectingLocations, + packageJsonInfoCache, + features: NodeResolutionFeatures.None, + conditions: [], + requestContainingDirectory: void 0, + reportDiagnostic: function(diag) { + return void diagnostics.push(diag); + } + }; + var resolved = loadModuleFromImmediateNodeModulesDirectory( + Extensions.DtsOnly, + moduleName, + globalCache, + state, + /*typesScopeOnly*/ + false, + /*cache*/ + void 0, + /*redirectedReference*/ + void 0 + ); + return createResolvedModuleWithFailedLookupLocations( + resolved, + /*isExternalLibraryImport*/ + true, + failedLookupLocations, + affectingLocations, + diagnostics, + state.resultFromCache + ); + } + ts6.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== void 0 ? { value } : void 0; + } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace2.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ModuleInstanceState; + (function(ModuleInstanceState2) { + ModuleInstanceState2[ModuleInstanceState2["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState2[ModuleInstanceState2["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState2[ModuleInstanceState2["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ModuleInstanceState = ts6.ModuleInstanceState || (ts6.ModuleInstanceState = {})); + function getModuleInstanceState(node, visited) { + if (node.body && !node.body.parent) { + ts6.setParent(node.body, node); + ts6.setParentRecursive( + node.body, + /*incremental*/ + false + ); + } + return node.body ? getModuleInstanceStateCached(node.body, visited) : 1; + } + ts6.getModuleInstanceState = getModuleInstanceState; + function getModuleInstanceStateCached(node, visited) { + if (visited === void 0) { + visited = new ts6.Map(); + } + var nodeId = ts6.getNodeId(node); + if (visited.has(nodeId)) { + return visited.get(nodeId) || 0; + } + visited.set(nodeId, void 0); + var result = getModuleInstanceStateWorker(node, visited); + visited.set(nodeId, result); + return result; + } + function getModuleInstanceStateWorker(node, visited) { + switch (node.kind) { + case 261: + case 262: + return 0; + case 263: + if (ts6.isEnumConst(node)) { + return 2; + } + break; + case 269: + case 268: + if (!ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + return 0; + } + break; + case 275: + var exportDeclaration = node; + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276) { + var state = 0; + for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { + var specifier = _a[_i]; + var specifierState = getModuleInstanceStateForAliasTarget(specifier, visited); + if (specifierState > state) { + state = specifierState; + } + if (state === 1) { + return state; + } + } + return state; + } + break; + case 265: { + var state_1 = 0; + ts6.forEachChild(node, function(n) { + var childState = getModuleInstanceStateCached(n, visited); + switch (childState) { + case 0: + return; + case 2: + state_1 = 2; + return; + case 1: + state_1 = 1; + return true; + default: + ts6.Debug.assertNever(childState); + } + }); + return state_1; + } + case 264: + return getModuleInstanceState(node, visited); + case 79: + if (node.isInJSDocNamespace) { + return 0; + } + } + return 1; + } + function getModuleInstanceStateForAliasTarget(specifier, visited) { + var name = specifier.propertyName || specifier.name; + var p = specifier.parent; + while (p) { + if (ts6.isBlock(p) || ts6.isModuleBlock(p) || ts6.isSourceFile(p)) { + var statements = p.statements; + var found = void 0; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; + if (ts6.nodeHasName(statement, name)) { + if (!statement.parent) { + ts6.setParent(statement, p); + ts6.setParentRecursive( + statement, + /*incremental*/ + false + ); + } + var state = getModuleInstanceStateCached(statement, visited); + if (found === void 0 || state > found) { + found = state; + } + if (found === 1) { + return found; + } + } + } + if (found !== void 0) { + return found; + } + } + p = p.parent; + } + return 1; + } + var ContainerFlags; + (function(ContainerFlags2) { + ContainerFlags2[ContainerFlags2["None"] = 0] = "None"; + ContainerFlags2[ContainerFlags2["IsContainer"] = 1] = "IsContainer"; + ContainerFlags2[ContainerFlags2["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; + ContainerFlags2[ContainerFlags2["IsControlFlowContainer"] = 4] = "IsControlFlowContainer"; + ContainerFlags2[ContainerFlags2["IsFunctionLike"] = 8] = "IsFunctionLike"; + ContainerFlags2[ContainerFlags2["IsFunctionExpression"] = 16] = "IsFunctionExpression"; + ContainerFlags2[ContainerFlags2["HasLocals"] = 32] = "HasLocals"; + ContainerFlags2[ContainerFlags2["IsInterface"] = 64] = "IsInterface"; + ContainerFlags2[ContainerFlags2["IsObjectLiteralOrClassExpressionMethodOrAccessor"] = 128] = "IsObjectLiteralOrClassExpressionMethodOrAccessor"; + })(ContainerFlags || (ContainerFlags = {})); + function initFlowNode(node) { + ts6.Debug.attachFlowNodeDebugInfo(node); + return node; + } + var binder = createBinder(); + function bindSourceFile(file, options) { + ts6.performance.mark("beforeBind"); + ts6.perfLogger.logStartBindFile("" + file.fileName); + binder(file, options); + ts6.perfLogger.logStopBindFile(); + ts6.performance.mark("afterBind"); + ts6.performance.measure("Bind", "beforeBind", "afterBind"); + } + ts6.bindSourceFile = bindSourceFile; + function createBinder() { + var file; + var options; + var languageVersion; + var parent; + var container; + var thisParentContainer; + var blockScopeContainer; + var lastContainer; + var delayedTypeAliases; + var seenThisKeyword; + var currentFlow; + var currentBreakTarget; + var currentContinueTarget; + var currentReturnTarget; + var currentTrueTarget; + var currentFalseTarget; + var currentExceptionTarget; + var preSwitchCaseFlow; + var activeLabelList; + var hasExplicitReturn; + var emitFlags; + var inStrictMode; + var inAssignmentPattern = false; + var symbolCount = 0; + var Symbol2; + var classifiableNames; + var unreachableFlow = { + flags: 1 + /* FlowFlags.Unreachable */ + }; + var reportedUnreachableFlow = { + flags: 1 + /* FlowFlags.Unreachable */ + }; + var bindBinaryExpressionFlow = createBindBinaryExpressionFlow(); + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + return ts6.createDiagnosticForNodeInSourceFile(ts6.getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2); + } + function bindSourceFile2(f, opts) { + file = f; + options = opts; + languageVersion = ts6.getEmitScriptTarget(options); + inStrictMode = bindInStrictMode(file, opts); + classifiableNames = new ts6.Set(); + symbolCount = 0; + Symbol2 = ts6.objectAllocator.getSymbolConstructor(); + ts6.Debug.attachFlowNodeDebugInfo(unreachableFlow); + ts6.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow); + if (!file.locals) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push( + "bind", + "bindSourceFile", + { path: file.path }, + /*separateBeginAndEnd*/ + true + ); + bind(file); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + file.symbolCount = symbolCount; + file.classifiableNames = classifiableNames; + delayedBindJSDocTypedefTag(); + } + file = void 0; + options = void 0; + languageVersion = void 0; + parent = void 0; + container = void 0; + thisParentContainer = void 0; + blockScopeContainer = void 0; + lastContainer = void 0; + delayedTypeAliases = void 0; + seenThisKeyword = false; + currentFlow = void 0; + currentBreakTarget = void 0; + currentContinueTarget = void 0; + currentReturnTarget = void 0; + currentTrueTarget = void 0; + currentFalseTarget = void 0; + currentExceptionTarget = void 0; + activeLabelList = void 0; + hasExplicitReturn = false; + inAssignmentPattern = false; + emitFlags = 0; + } + return bindSourceFile2; + function bindInStrictMode(file2, opts) { + if (ts6.getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) { + return true; + } else { + return !!file2.externalModuleIndicator; + } + } + function createSymbol(flags, name) { + symbolCount++; + return new Symbol2(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolFlags) { + symbol.flags |= symbolFlags; + node.symbol = symbol; + symbol.declarations = ts6.appendIfUnique(symbol.declarations, node); + if (symbolFlags & (32 | 384 | 1536 | 3) && !symbol.exports) { + symbol.exports = ts6.createSymbolTable(); + } + if (symbolFlags & (32 | 64 | 2048 | 4096) && !symbol.members) { + symbol.members = ts6.createSymbolTable(); + } + if (symbol.constEnumOnlyModule && symbol.flags & (16 | 32 | 256)) { + symbol.constEnumOnlyModule = false; + } + if (symbolFlags & 111551) { + ts6.setValueDeclaration(symbol, node); + } + } + function getDeclarationName(node) { + if (node.kind === 274) { + return node.isExportEquals ? "export=" : "default"; + } + var name = ts6.getNameOfDeclaration(node); + if (name) { + if (ts6.isAmbientModule(node)) { + var moduleName = ts6.getTextOfIdentifierOrLiteral(name); + return ts6.isGlobalScopeAugmentation(node) ? "__global" : '"'.concat(moduleName, '"'); + } + if (name.kind === 164) { + var nameExpression = name.expression; + if (ts6.isStringOrNumericLiteralLike(nameExpression)) { + return ts6.escapeLeadingUnderscores(nameExpression.text); + } + if (ts6.isSignedNumericLiteral(nameExpression)) { + return ts6.tokenToString(nameExpression.operator) + nameExpression.operand.text; + } else { + ts6.Debug.fail("Only computed properties with literal names have declaration names"); + } + } + if (ts6.isPrivateIdentifier(name)) { + var containingClass = ts6.getContainingClass(node); + if (!containingClass) { + return void 0; + } + var containingClassSymbol = containingClass.symbol; + return ts6.getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText); + } + return ts6.isPropertyNameLiteral(name) ? ts6.getEscapedTextOfIdentifierOrLiteral(name) : void 0; + } + switch (node.kind) { + case 173: + return "__constructor"; + case 181: + case 176: + case 326: + return "__call"; + case 182: + case 177: + return "__new"; + case 178: + return "__index"; + case 275: + return "__export"; + case 308: + return "export="; + case 223: + if (ts6.getAssignmentDeclarationKind(node) === 2) { + return "export="; + } + ts6.Debug.fail("Unknown binary declaration kind"); + break; + case 320: + return ts6.isJSDocConstructSignature(node) ? "__new" : "__call"; + case 166: + ts6.Debug.assert(node.parent.kind === 320, "Impossible parameter parent kind", function() { + return "parent is: ".concat(ts6.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); + }); + var functionType = node.parent; + var index = functionType.parameters.indexOf(node); + return "arg" + index; + } + } + function getDisplayName(node) { + return ts6.isNamedDeclaration(node) ? ts6.declarationNameToString(node.name) : ts6.unescapeLeadingUnderscores(ts6.Debug.checkDefined(getDeclarationName(node))); + } + function declareSymbol(symbolTable, parent2, node, includes, excludes, isReplaceableByMethod, isComputedName) { + ts6.Debug.assert(isComputedName || !ts6.hasDynamicName(node)); + var isDefaultExport = ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + ) || ts6.isExportSpecifier(node) && node.name.escapedText === "default"; + var name = isComputedName ? "__computed" : isDefaultExport && parent2 ? "default" : getDeclarationName(node); + var symbol; + if (name === void 0) { + symbol = createSymbol( + 0, + "__missing" + /* InternalSymbolName.Missing */ + ); + } else { + symbol = symbolTable.get(name); + if (includes & 2885600) { + classifiableNames.add(name); + } + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + if (isReplaceableByMethod) + symbol.isReplaceableByMethod = true; + } else if (isReplaceableByMethod && !symbol.isReplaceableByMethod) { + return symbol; + } else if (symbol.flags & excludes) { + if (symbol.isReplaceableByMethod) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } else if (!(includes & 3 && symbol.flags & 67108864)) { + if (ts6.isNamedDeclaration(node)) { + ts6.setParent(node.name, node); + } + var message_1 = symbol.flags & 2 ? ts6.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts6.Diagnostics.Duplicate_identifier_0; + var messageNeedsName_1 = true; + if (symbol.flags & 384 || includes & 384) { + message_1 = ts6.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations; + messageNeedsName_1 = false; + } + var multipleDefaultExports_1 = false; + if (ts6.length(symbol.declarations)) { + if (isDefaultExport) { + message_1 = ts6.Diagnostics.A_module_cannot_have_multiple_default_exports; + messageNeedsName_1 = false; + multipleDefaultExports_1 = true; + } else { + if (symbol.declarations && symbol.declarations.length && (node.kind === 274 && !node.isExportEquals)) { + message_1 = ts6.Diagnostics.A_module_cannot_have_multiple_default_exports; + messageNeedsName_1 = false; + multipleDefaultExports_1 = true; + } + } + } + var relatedInformation_1 = []; + if (ts6.isTypeAliasDeclaration(node) && ts6.nodeIsMissing(node.type) && ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ) && symbol.flags & (2097152 | 788968 | 1920)) { + relatedInformation_1.push(createDiagnosticForNode(node, ts6.Diagnostics.Did_you_mean_0, "export type { ".concat(ts6.unescapeLeadingUnderscores(node.name.escapedText), " }"))); + } + var declarationName_1 = ts6.getNameOfDeclaration(node) || node; + ts6.forEach(symbol.declarations, function(declaration, index) { + var decl = ts6.getNameOfDeclaration(declaration) || declaration; + var diag2 = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : void 0); + file.bindDiagnostics.push(multipleDefaultExports_1 ? ts6.addRelatedInfo(diag2, createDiagnosticForNode(declarationName_1, index === 0 ? ts6.Diagnostics.Another_export_default_is_here : ts6.Diagnostics.and_here)) : diag2); + if (multipleDefaultExports_1) { + relatedInformation_1.push(createDiagnosticForNode(decl, ts6.Diagnostics.The_first_export_default_is_here)); + } + }); + var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : void 0); + file.bindDiagnostics.push(ts6.addRelatedInfo.apply(void 0, __spreadArray([diag], relatedInformation_1, false))); + symbol = createSymbol(0, name); + } + } + } + addDeclarationToSymbol(symbol, node, includes); + if (symbol.parent) { + ts6.Debug.assert(symbol.parent === parent2, "Existing symbol parent should match new one"); + } else { + symbol.parent = parent2; + } + return symbol; + } + function declareModuleMember(node, symbolFlags, symbolExcludes) { + var hasExportModifier = !!(ts6.getCombinedModifierFlags(node) & 1) || jsdocTreatAsExported(node); + if (symbolFlags & 2097152) { + if (node.kind === 278 || node.kind === 268 && hasExportModifier) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + } else { + return declareSymbol( + container.locals, + /*parent*/ + void 0, + node, + symbolFlags, + symbolExcludes + ); + } + } else { + if (ts6.isJSDocTypeAlias(node)) + ts6.Debug.assert(ts6.isInJSFile(node)); + if (!ts6.isAmbientModule(node) && (hasExportModifier || container.flags & 64)) { + if (!container.locals || ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + ) && !getDeclarationName(node)) { + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + } + var exportKind = symbolFlags & 111551 ? 1048576 : 0; + var local = declareSymbol( + container.locals, + /*parent*/ + void 0, + node, + exportKind, + symbolExcludes + ); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + node.localSymbol = local; + return local; + } else { + return declareSymbol( + container.locals, + /*parent*/ + void 0, + node, + symbolFlags, + symbolExcludes + ); + } + } + } + function jsdocTreatAsExported(node) { + if (node.parent && ts6.isModuleDeclaration(node)) { + node = node.parent; + } + if (!ts6.isJSDocTypeAlias(node)) + return false; + if (!ts6.isJSDocEnumTag(node) && !!node.fullName) + return true; + var declName = ts6.getNameOfDeclaration(node); + if (!declName) + return false; + if (ts6.isPropertyAccessEntityNameExpression(declName.parent) && isTopLevelNamespaceAssignment(declName.parent)) + return true; + if (ts6.isDeclaration(declName.parent) && ts6.getCombinedModifierFlags(declName.parent) & 1) + return true; + return false; + } + function bindContainer(node, containerFlags) { + var saveContainer = container; + var saveThisParentContainer = thisParentContainer; + var savedBlockScopeContainer = blockScopeContainer; + if (containerFlags & 1) { + if (node.kind !== 216) { + thisParentContainer = container; + } + container = blockScopeContainer = node; + if (containerFlags & 32) { + container.locals = ts6.createSymbolTable(); + } + addToContainerChain(container); + } else if (containerFlags & 2) { + blockScopeContainer = node; + blockScopeContainer.locals = void 0; + } + if (containerFlags & 4) { + var saveCurrentFlow = currentFlow; + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + var saveReturnTarget = currentReturnTarget; + var saveExceptionTarget = currentExceptionTarget; + var saveActiveLabelList = activeLabelList; + var saveHasExplicitReturn = hasExplicitReturn; + var isImmediatelyInvoked = containerFlags & 16 && !ts6.hasSyntacticModifier( + node, + 512 + /* ModifierFlags.Async */ + ) && !node.asteriskToken && !!ts6.getImmediatelyInvokedFunctionExpression(node) || node.kind === 172; + if (!isImmediatelyInvoked) { + currentFlow = initFlowNode({ + flags: 2 + /* FlowFlags.Start */ + }); + if (containerFlags & (16 | 128)) { + currentFlow.node = node; + } + } + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 || ts6.isInJSFile(node) && (node.kind === 259 || node.kind === 215) ? createBranchLabel() : void 0; + currentExceptionTarget = void 0; + currentBreakTarget = void 0; + currentContinueTarget = void 0; + activeLabelList = void 0; + hasExplicitReturn = false; + bindChildren(node); + node.flags &= ~2816; + if (!(currentFlow.flags & 1) && containerFlags & 8 && ts6.nodeIsPresent(node.body)) { + node.flags |= 256; + if (hasExplicitReturn) + node.flags |= 512; + node.endFlowNode = currentFlow; + } + if (node.kind === 308) { + node.flags |= emitFlags; + node.endFlowNode = currentFlow; + } + if (currentReturnTarget) { + addAntecedent(currentReturnTarget, currentFlow); + currentFlow = finishFlowLabel(currentReturnTarget); + if (node.kind === 173 || node.kind === 172 || ts6.isInJSFile(node) && (node.kind === 259 || node.kind === 215)) { + node.returnFlowNode = currentFlow; + } + } + if (!isImmediatelyInvoked) { + currentFlow = saveCurrentFlow; + } + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + currentReturnTarget = saveReturnTarget; + currentExceptionTarget = saveExceptionTarget; + activeLabelList = saveActiveLabelList; + hasExplicitReturn = saveHasExplicitReturn; + } else if (containerFlags & 64) { + seenThisKeyword = false; + bindChildren(node); + node.flags = seenThisKeyword ? node.flags | 128 : node.flags & ~128; + } else { + bindChildren(node); + } + container = saveContainer; + thisParentContainer = saveThisParentContainer; + blockScopeContainer = savedBlockScopeContainer; + } + function bindEachFunctionsFirst(nodes) { + bindEach(nodes, function(n) { + return n.kind === 259 ? bind(n) : void 0; + }); + bindEach(nodes, function(n) { + return n.kind !== 259 ? bind(n) : void 0; + }); + } + function bindEach(nodes, bindFunction) { + if (bindFunction === void 0) { + bindFunction = bind; + } + if (nodes === void 0) { + return; + } + ts6.forEach(nodes, bindFunction); + } + function bindEachChild(node) { + ts6.forEachChild(node, bind, bindEach); + } + function bindChildren(node) { + var saveInAssignmentPattern = inAssignmentPattern; + inAssignmentPattern = false; + if (checkUnreachable(node)) { + bindEachChild(node); + bindJSDoc(node); + inAssignmentPattern = saveInAssignmentPattern; + return; + } + if (node.kind >= 240 && node.kind <= 256 && !options.allowUnreachableCode) { + node.flowNode = currentFlow; + } + switch (node.kind) { + case 244: + bindWhileStatement(node); + break; + case 243: + bindDoStatement(node); + break; + case 245: + bindForStatement(node); + break; + case 246: + case 247: + bindForInOrForOfStatement(node); + break; + case 242: + bindIfStatement(node); + break; + case 250: + case 254: + bindReturnOrThrow(node); + break; + case 249: + case 248: + bindBreakOrContinueStatement(node); + break; + case 255: + bindTryStatement(node); + break; + case 252: + bindSwitchStatement(node); + break; + case 266: + bindCaseBlock(node); + break; + case 292: + bindCaseClause(node); + break; + case 241: + bindExpressionStatement(node); + break; + case 253: + bindLabeledStatement(node); + break; + case 221: + bindPrefixUnaryExpressionFlow(node); + break; + case 222: + bindPostfixUnaryExpressionFlow(node); + break; + case 223: + if (ts6.isDestructuringAssignment(node)) { + inAssignmentPattern = saveInAssignmentPattern; + bindDestructuringAssignmentFlow(node); + return; + } + bindBinaryExpressionFlow(node); + break; + case 217: + bindDeleteExpressionFlow(node); + break; + case 224: + bindConditionalExpressionFlow(node); + break; + case 257: + bindVariableDeclarationFlow(node); + break; + case 208: + case 209: + bindAccessExpressionFlow(node); + break; + case 210: + bindCallExpressionFlow(node); + break; + case 232: + bindNonNullExpressionFlow(node); + break; + case 348: + case 341: + case 342: + bindJSDocTypeAlias(node); + break; + case 308: { + bindEachFunctionsFirst(node.statements); + bind(node.endOfFileToken); + break; + } + case 238: + case 265: + bindEachFunctionsFirst(node.statements); + break; + case 205: + bindBindingElementFlow(node); + break; + case 166: + bindParameterFlow(node); + break; + case 207: + case 206: + case 299: + case 227: + inAssignmentPattern = saveInAssignmentPattern; + default: + bindEachChild(node); + break; + } + bindJSDoc(node); + inAssignmentPattern = saveInAssignmentPattern; + } + function isNarrowingExpression(expr) { + switch (expr.kind) { + case 79: + case 80: + case 108: + case 208: + case 209: + return containsNarrowableReference(expr); + case 210: + return hasNarrowableArgument(expr); + case 214: + case 232: + return isNarrowingExpression(expr.expression); + case 223: + return isNarrowingBinaryExpression(expr); + case 221: + return expr.operator === 53 && isNarrowingExpression(expr.operand); + case 218: + return isNarrowingExpression(expr.expression); + } + return false; + } + function isNarrowableReference(expr) { + return ts6.isDottedName(expr) || (ts6.isPropertyAccessExpression(expr) || ts6.isNonNullExpression(expr) || ts6.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) || ts6.isBinaryExpression(expr) && expr.operatorToken.kind === 27 && isNarrowableReference(expr.right) || ts6.isElementAccessExpression(expr) && (ts6.isStringOrNumericLiteralLike(expr.argumentExpression) || ts6.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression) || ts6.isAssignmentExpression(expr) && isNarrowableReference(expr.left); + } + function containsNarrowableReference(expr) { + return isNarrowableReference(expr) || ts6.isOptionalChain(expr) && containsNarrowableReference(expr.expression); + } + function hasNarrowableArgument(expr) { + if (expr.arguments) { + for (var _i = 0, _a = expr.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (containsNarrowableReference(argument)) { + return true; + } + } + } + if (expr.expression.kind === 208 && containsNarrowableReference(expr.expression.expression)) { + return true; + } + return false; + } + function isNarrowingTypeofOperands(expr1, expr2) { + return ts6.isTypeOfExpression(expr1) && isNarrowableOperand(expr1.expression) && ts6.isStringLiteralLike(expr2); + } + function isNarrowingBinaryExpression(expr) { + switch (expr.operatorToken.kind) { + case 63: + case 75: + case 76: + case 77: + return containsNarrowableReference(expr.left); + case 34: + case 35: + case 36: + case 37: + return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right); + case 102: + return isNarrowableOperand(expr.left); + case 101: + return isNarrowingExpression(expr.right); + case 27: + return isNarrowingExpression(expr.right); + } + return false; + } + function isNarrowableOperand(expr) { + switch (expr.kind) { + case 214: + return isNarrowableOperand(expr.expression); + case 223: + switch (expr.operatorToken.kind) { + case 63: + return isNarrowableOperand(expr.left); + case 27: + return isNarrowableOperand(expr.right); + } + } + return containsNarrowableReference(expr); + } + function createBranchLabel() { + return initFlowNode({ flags: 4, antecedents: void 0 }); + } + function createLoopLabel() { + return initFlowNode({ flags: 8, antecedents: void 0 }); + } + function createReduceLabel(target, antecedents, antecedent) { + return initFlowNode({ flags: 1024, target, antecedents, antecedent }); + } + function setFlowNodeReferenced(flow) { + flow.flags |= flow.flags & 2048 ? 4096 : 2048; + } + function addAntecedent(label, antecedent) { + if (!(antecedent.flags & 1) && !ts6.contains(label.antecedents, antecedent)) { + (label.antecedents || (label.antecedents = [])).push(antecedent); + setFlowNodeReferenced(antecedent); + } + } + function createFlowCondition(flags, antecedent, expression) { + if (antecedent.flags & 1) { + return antecedent; + } + if (!expression) { + return flags & 32 ? antecedent : unreachableFlow; + } + if ((expression.kind === 110 && flags & 64 || expression.kind === 95 && flags & 32) && !ts6.isExpressionOfOptionalChainRoot(expression) && !ts6.isNullishCoalesce(expression.parent)) { + return unreachableFlow; + } + if (!isNarrowingExpression(expression)) { + return antecedent; + } + setFlowNodeReferenced(antecedent); + return initFlowNode({ flags, antecedent, node: expression }); + } + function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) { + setFlowNodeReferenced(antecedent); + return initFlowNode({ flags: 128, antecedent, switchStatement, clauseStart, clauseEnd }); + } + function createFlowMutation(flags, antecedent, node) { + setFlowNodeReferenced(antecedent); + var result = initFlowNode({ flags, antecedent, node }); + if (currentExceptionTarget) { + addAntecedent(currentExceptionTarget, result); + } + return result; + } + function createFlowCall(antecedent, node) { + setFlowNodeReferenced(antecedent); + return initFlowNode({ flags: 512, antecedent, node }); + } + function finishFlowLabel(flow) { + var antecedents = flow.antecedents; + if (!antecedents) { + return unreachableFlow; + } + if (antecedents.length === 1) { + return antecedents[0]; + } + return flow; + } + function isStatementCondition(node) { + var parent2 = node.parent; + switch (parent2.kind) { + case 242: + case 244: + case 243: + return parent2.expression === node; + case 245: + case 224: + return parent2.condition === node; + } + return false; + } + function isLogicalExpression(node) { + while (true) { + if (node.kind === 214) { + node = node.expression; + } else if (node.kind === 221 && node.operator === 53) { + node = node.operand; + } else { + return node.kind === 223 && (node.operatorToken.kind === 55 || node.operatorToken.kind === 56 || node.operatorToken.kind === 60); + } + } + } + function isLogicalAssignmentExpression(node) { + node = ts6.skipParentheses(node); + return ts6.isBinaryExpression(node) && ts6.isLogicalOrCoalescingAssignmentOperator(node.operatorToken.kind); + } + function isTopLevelLogicalExpression(node) { + while (ts6.isParenthesizedExpression(node.parent) || ts6.isPrefixUnaryExpression(node.parent) && node.parent.operator === 53) { + node = node.parent; + } + return !isStatementCondition(node) && !isLogicalExpression(node.parent) && !(ts6.isOptionalChain(node.parent) && node.parent.expression === node); + } + function doWithConditionalBranches(action, value, trueTarget, falseTarget) { + var savedTrueTarget = currentTrueTarget; + var savedFalseTarget = currentFalseTarget; + currentTrueTarget = trueTarget; + currentFalseTarget = falseTarget; + action(value); + currentTrueTarget = savedTrueTarget; + currentFalseTarget = savedFalseTarget; + } + function bindCondition(node, trueTarget, falseTarget) { + doWithConditionalBranches(bind, node, trueTarget, falseTarget); + if (!node || !isLogicalAssignmentExpression(node) && !isLogicalExpression(node) && !(ts6.isOptionalChain(node) && ts6.isOutermostOptionalChain(node))) { + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } + } + function bindIterativeStatement(node, breakTarget, continueTarget) { + var saveBreakTarget = currentBreakTarget; + var saveContinueTarget = currentContinueTarget; + currentBreakTarget = breakTarget; + currentContinueTarget = continueTarget; + bind(node); + currentBreakTarget = saveBreakTarget; + currentContinueTarget = saveContinueTarget; + } + function setContinueTarget(node, target) { + var label = activeLabelList; + while (label && node.parent.kind === 253) { + label.continueTarget = target; + label = label.next; + node = node.parent; + } + return target; + } + function bindWhileStatement(node) { + var preWhileLabel = setContinueTarget(node, createLoopLabel()); + var preBodyLabel = createBranchLabel(); + var postWhileLabel = createBranchLabel(); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = preWhileLabel; + bindCondition(node.expression, preBodyLabel, postWhileLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel); + addAntecedent(preWhileLabel, currentFlow); + currentFlow = finishFlowLabel(postWhileLabel); + } + function bindDoStatement(node) { + var preDoLabel = createLoopLabel(); + var preConditionLabel = setContinueTarget(node, createBranchLabel()); + var postDoLabel = createBranchLabel(); + addAntecedent(preDoLabel, currentFlow); + currentFlow = preDoLabel; + bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); + addAntecedent(preConditionLabel, currentFlow); + currentFlow = finishFlowLabel(preConditionLabel); + bindCondition(node.expression, preDoLabel, postDoLabel); + currentFlow = finishFlowLabel(postDoLabel); + } + function bindForStatement(node) { + var preLoopLabel = setContinueTarget(node, createLoopLabel()); + var preBodyLabel = createBranchLabel(); + var postLoopLabel = createBranchLabel(); + bind(node.initializer); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + bindCondition(node.condition, preBodyLabel, postLoopLabel); + currentFlow = finishFlowLabel(preBodyLabel); + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + bind(node.incrementor); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindForInOrForOfStatement(node) { + var preLoopLabel = setContinueTarget(node, createLoopLabel()); + var postLoopLabel = createBranchLabel(); + bind(node.expression); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = preLoopLabel; + if (node.kind === 247) { + bind(node.awaitModifier); + } + addAntecedent(postLoopLabel, currentFlow); + bind(node.initializer); + if (node.initializer.kind !== 258) { + bindAssignmentTargetFlow(node.initializer); + } + bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); + addAntecedent(preLoopLabel, currentFlow); + currentFlow = finishFlowLabel(postLoopLabel); + } + function bindIfStatement(node) { + var thenLabel = createBranchLabel(); + var elseLabel = createBranchLabel(); + var postIfLabel = createBranchLabel(); + bindCondition(node.expression, thenLabel, elseLabel); + currentFlow = finishFlowLabel(thenLabel); + bind(node.thenStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(elseLabel); + bind(node.elseStatement); + addAntecedent(postIfLabel, currentFlow); + currentFlow = finishFlowLabel(postIfLabel); + } + function bindReturnOrThrow(node) { + bind(node.expression); + if (node.kind === 250) { + hasExplicitReturn = true; + if (currentReturnTarget) { + addAntecedent(currentReturnTarget, currentFlow); + } + } + currentFlow = unreachableFlow; + } + function findActiveLabel(name) { + for (var label = activeLabelList; label; label = label.next) { + if (label.name === name) { + return label; + } + } + return void 0; + } + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 249 ? breakTarget : continueTarget; + if (flowLabel) { + addAntecedent(flowLabel, currentFlow); + currentFlow = unreachableFlow; + } + } + function bindBreakOrContinueStatement(node) { + bind(node.label); + if (node.label) { + var activeLabel = findActiveLabel(node.label.escapedText); + if (activeLabel) { + activeLabel.referenced = true; + bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); + } + } else { + bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget); + } + } + function bindTryStatement(node) { + var saveReturnTarget = currentReturnTarget; + var saveExceptionTarget = currentExceptionTarget; + var normalExitLabel = createBranchLabel(); + var returnLabel = createBranchLabel(); + var exceptionLabel = createBranchLabel(); + if (node.finallyBlock) { + currentReturnTarget = returnLabel; + } + addAntecedent(exceptionLabel, currentFlow); + currentExceptionTarget = exceptionLabel; + bind(node.tryBlock); + addAntecedent(normalExitLabel, currentFlow); + if (node.catchClause) { + currentFlow = finishFlowLabel(exceptionLabel); + exceptionLabel = createBranchLabel(); + addAntecedent(exceptionLabel, currentFlow); + currentExceptionTarget = exceptionLabel; + bind(node.catchClause); + addAntecedent(normalExitLabel, currentFlow); + } + currentReturnTarget = saveReturnTarget; + currentExceptionTarget = saveExceptionTarget; + if (node.finallyBlock) { + var finallyLabel = createBranchLabel(); + finallyLabel.antecedents = ts6.concatenate(ts6.concatenate(normalExitLabel.antecedents, exceptionLabel.antecedents), returnLabel.antecedents); + currentFlow = finallyLabel; + bind(node.finallyBlock); + if (currentFlow.flags & 1) { + currentFlow = unreachableFlow; + } else { + if (currentReturnTarget && returnLabel.antecedents) { + addAntecedent(currentReturnTarget, createReduceLabel(finallyLabel, returnLabel.antecedents, currentFlow)); + } + if (currentExceptionTarget && exceptionLabel.antecedents) { + addAntecedent(currentExceptionTarget, createReduceLabel(finallyLabel, exceptionLabel.antecedents, currentFlow)); + } + currentFlow = normalExitLabel.antecedents ? createReduceLabel(finallyLabel, normalExitLabel.antecedents, currentFlow) : unreachableFlow; + } + } else { + currentFlow = finishFlowLabel(normalExitLabel); + } + } + function bindSwitchStatement(node) { + var postSwitchLabel = createBranchLabel(); + bind(node.expression); + var saveBreakTarget = currentBreakTarget; + var savePreSwitchCaseFlow = preSwitchCaseFlow; + currentBreakTarget = postSwitchLabel; + preSwitchCaseFlow = currentFlow; + bind(node.caseBlock); + addAntecedent(postSwitchLabel, currentFlow); + var hasDefault = ts6.forEach(node.caseBlock.clauses, function(c) { + return c.kind === 293; + }); + node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; + if (!hasDefault) { + addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); + } + currentBreakTarget = saveBreakTarget; + preSwitchCaseFlow = savePreSwitchCaseFlow; + currentFlow = finishFlowLabel(postSwitchLabel); + } + function bindCaseBlock(node) { + var clauses = node.clauses; + var isNarrowingSwitch = isNarrowingExpression(node.parent.expression); + var fallthroughFlow = unreachableFlow; + for (var i = 0; i < clauses.length; i++) { + var clauseStart = i; + while (!clauses[i].statements.length && i + 1 < clauses.length) { + bind(clauses[i]); + i++; + } + var preCaseLabel = createBranchLabel(); + addAntecedent(preCaseLabel, isNarrowingSwitch ? createFlowSwitchClause(preSwitchCaseFlow, node.parent, clauseStart, i + 1) : preSwitchCaseFlow); + addAntecedent(preCaseLabel, fallthroughFlow); + currentFlow = finishFlowLabel(preCaseLabel); + var clause = clauses[i]; + bind(clause); + fallthroughFlow = currentFlow; + if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) { + clause.fallthroughFlowNode = currentFlow; + } + } + } + function bindCaseClause(node) { + var saveCurrentFlow = currentFlow; + currentFlow = preSwitchCaseFlow; + bind(node.expression); + currentFlow = saveCurrentFlow; + bindEach(node.statements); + } + function bindExpressionStatement(node) { + bind(node.expression); + maybeBindExpressionFlowIfCall(node.expression); + } + function maybeBindExpressionFlowIfCall(node) { + if (node.kind === 210) { + var call = node; + if (call.expression.kind !== 106 && ts6.isDottedName(call.expression)) { + currentFlow = createFlowCall(currentFlow, call); + } + } + } + function bindLabeledStatement(node) { + var postStatementLabel = createBranchLabel(); + activeLabelList = { + next: activeLabelList, + name: node.label.escapedText, + breakTarget: postStatementLabel, + continueTarget: void 0, + referenced: false + }; + bind(node.label); + bind(node.statement); + if (!activeLabelList.referenced && !options.allowUnusedLabels) { + errorOrSuggestionOnNode(ts6.unusedLabelIsError(options), node.label, ts6.Diagnostics.Unused_label); + } + activeLabelList = activeLabelList.next; + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } + function bindDestructuringTargetFlow(node) { + if (node.kind === 223 && node.operatorToken.kind === 63) { + bindAssignmentTargetFlow(node.left); + } else { + bindAssignmentTargetFlow(node); + } + } + function bindAssignmentTargetFlow(node) { + if (isNarrowableReference(node)) { + currentFlow = createFlowMutation(16, currentFlow, node); + } else if (node.kind === 206) { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var e = _a[_i]; + if (e.kind === 227) { + bindAssignmentTargetFlow(e.expression); + } else { + bindDestructuringTargetFlow(e); + } + } + } else if (node.kind === 207) { + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var p = _c[_b]; + if (p.kind === 299) { + bindDestructuringTargetFlow(p.initializer); + } else if (p.kind === 300) { + bindAssignmentTargetFlow(p.name); + } else if (p.kind === 301) { + bindAssignmentTargetFlow(p.expression); + } + } + } + } + function bindLogicalLikeExpression(node, trueTarget, falseTarget) { + var preRightLabel = createBranchLabel(); + if (node.operatorToken.kind === 55 || node.operatorToken.kind === 76) { + bindCondition(node.left, preRightLabel, falseTarget); + } else { + bindCondition(node.left, trueTarget, preRightLabel); + } + currentFlow = finishFlowLabel(preRightLabel); + bind(node.operatorToken); + if (ts6.isLogicalOrCoalescingAssignmentOperator(node.operatorToken.kind)) { + doWithConditionalBranches(bind, node.right, trueTarget, falseTarget); + bindAssignmentTargetFlow(node.left); + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } else { + bindCondition(node.right, trueTarget, falseTarget); + } + } + function bindPrefixUnaryExpressionFlow(node) { + if (node.operator === 53) { + var saveTrueTarget = currentTrueTarget; + currentTrueTarget = currentFalseTarget; + currentFalseTarget = saveTrueTarget; + bindEachChild(node); + currentFalseTarget = currentTrueTarget; + currentTrueTarget = saveTrueTarget; + } else { + bindEachChild(node); + if (node.operator === 45 || node.operator === 46) { + bindAssignmentTargetFlow(node.operand); + } + } + } + function bindPostfixUnaryExpressionFlow(node) { + bindEachChild(node); + if (node.operator === 45 || node.operator === 46) { + bindAssignmentTargetFlow(node.operand); + } + } + function bindDestructuringAssignmentFlow(node) { + if (inAssignmentPattern) { + inAssignmentPattern = false; + bind(node.operatorToken); + bind(node.right); + inAssignmentPattern = true; + bind(node.left); + } else { + inAssignmentPattern = true; + bind(node.left); + inAssignmentPattern = false; + bind(node.operatorToken); + bind(node.right); + } + bindAssignmentTargetFlow(node.left); + } + function createBindBinaryExpressionFlow() { + return ts6.createBinaryExpressionTrampoline( + onEnter, + onLeft, + onOperator, + onRight, + onExit, + /*foldState*/ + void 0 + ); + function onEnter(node, state) { + if (state) { + state.stackIndex++; + ts6.setParent(node, parent); + var saveInStrictMode = inStrictMode; + bindWorker(node); + var saveParent = parent; + parent = node; + state.skip = false; + state.inStrictModeStack[state.stackIndex] = saveInStrictMode; + state.parentStack[state.stackIndex] = saveParent; + } else { + state = { + stackIndex: 0, + skip: false, + inStrictModeStack: [void 0], + parentStack: [void 0] + }; + } + var operator = node.operatorToken.kind; + if (operator === 55 || operator === 56 || operator === 60 || ts6.isLogicalOrCoalescingAssignmentOperator(operator)) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindLogicalLikeExpression(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } else { + bindLogicalLikeExpression(node, currentTrueTarget, currentFalseTarget); + } + state.skip = true; + } + return state; + } + function onLeft(left, state, node) { + if (!state.skip) { + var maybeBound = maybeBind(left); + if (node.operatorToken.kind === 27) { + maybeBindExpressionFlowIfCall(left); + } + return maybeBound; + } + } + function onOperator(operatorToken, state, _node) { + if (!state.skip) { + bind(operatorToken); + } + } + function onRight(right, state, node) { + if (!state.skip) { + var maybeBound = maybeBind(right); + if (node.operatorToken.kind === 27) { + maybeBindExpressionFlowIfCall(right); + } + return maybeBound; + } + } + function onExit(node, state) { + if (!state.skip) { + var operator = node.operatorToken.kind; + if (ts6.isAssignmentOperator(operator) && !ts6.isAssignmentTarget(node)) { + bindAssignmentTargetFlow(node.left); + if (operator === 63 && node.left.kind === 209) { + var elementAccess = node.left; + if (isNarrowableOperand(elementAccess.expression)) { + currentFlow = createFlowMutation(256, currentFlow, node); + } + } + } + } + var savedInStrictMode = state.inStrictModeStack[state.stackIndex]; + var savedParent = state.parentStack[state.stackIndex]; + if (savedInStrictMode !== void 0) { + inStrictMode = savedInStrictMode; + } + if (savedParent !== void 0) { + parent = savedParent; + } + state.skip = false; + state.stackIndex--; + } + function maybeBind(node) { + if (node && ts6.isBinaryExpression(node) && !ts6.isDestructuringAssignment(node)) { + return node; + } + bind(node); + } + } + function bindDeleteExpressionFlow(node) { + bindEachChild(node); + if (node.expression.kind === 208) { + bindAssignmentTargetFlow(node.expression); + } + } + function bindConditionalExpressionFlow(node) { + var trueLabel = createBranchLabel(); + var falseLabel = createBranchLabel(); + var postExpressionLabel = createBranchLabel(); + bindCondition(node.condition, trueLabel, falseLabel); + currentFlow = finishFlowLabel(trueLabel); + bind(node.questionToken); + bind(node.whenTrue); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(falseLabel); + bind(node.colonToken); + bind(node.whenFalse); + addAntecedent(postExpressionLabel, currentFlow); + currentFlow = finishFlowLabel(postExpressionLabel); + } + function bindInitializedVariableFlow(node) { + var name = !ts6.isOmittedExpression(node) ? node.name : void 0; + if (ts6.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var child = _a[_i]; + bindInitializedVariableFlow(child); + } + } else { + currentFlow = createFlowMutation(16, currentFlow, node); + } + } + function bindVariableDeclarationFlow(node) { + bindEachChild(node); + if (node.initializer || ts6.isForInOrOfStatement(node.parent.parent)) { + bindInitializedVariableFlow(node); + } + } + function bindBindingElementFlow(node) { + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + function bindInitializer(node) { + if (!node) { + return; + } + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; + } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); + } + function bindJSDocTypeAlias(node) { + bind(node.tagName); + if (node.kind !== 342 && node.fullName) { + ts6.setParent(node.fullName, node); + ts6.setParentRecursive( + node.fullName, + /*incremental*/ + false + ); + } + if (typeof node.comment !== "string") { + bindEach(node.comment); + } + } + function bindJSDocClassTag(node) { + bindEachChild(node); + var host = ts6.getHostSignatureFromJSDoc(node); + if (host && host.kind !== 171) { + addDeclarationToSymbol( + host.symbol, + host, + 32 + /* SymbolFlags.Class */ + ); + } + } + function bindOptionalExpression(node, trueTarget, falseTarget) { + doWithConditionalBranches(bind, node, trueTarget, falseTarget); + if (!ts6.isOptionalChain(node) || ts6.isOutermostOptionalChain(node)) { + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } + } + function bindOptionalChainRest(node) { + switch (node.kind) { + case 208: + bind(node.questionDotToken); + bind(node.name); + break; + case 209: + bind(node.questionDotToken); + bind(node.argumentExpression); + break; + case 210: + bind(node.questionDotToken); + bindEach(node.typeArguments); + bindEach(node.arguments); + break; + } + } + function bindOptionalChain(node, trueTarget, falseTarget) { + var preChainLabel = ts6.isOptionalChainRoot(node) ? createBranchLabel() : void 0; + bindOptionalExpression(node.expression, preChainLabel || trueTarget, falseTarget); + if (preChainLabel) { + currentFlow = finishFlowLabel(preChainLabel); + } + doWithConditionalBranches(bindOptionalChainRest, node, trueTarget, falseTarget); + if (ts6.isOutermostOptionalChain(node)) { + addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node)); + addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node)); + } + } + function bindOptionalChainFlow(node) { + if (isTopLevelLogicalExpression(node)) { + var postExpressionLabel = createBranchLabel(); + bindOptionalChain(node, postExpressionLabel, postExpressionLabel); + currentFlow = finishFlowLabel(postExpressionLabel); + } else { + bindOptionalChain(node, currentTrueTarget, currentFalseTarget); + } + } + function bindNonNullExpressionFlow(node) { + if (ts6.isOptionalChain(node)) { + bindOptionalChainFlow(node); + } else { + bindEachChild(node); + } + } + function bindAccessExpressionFlow(node) { + if (ts6.isOptionalChain(node)) { + bindOptionalChainFlow(node); + } else { + bindEachChild(node); + } + } + function bindCallExpressionFlow(node) { + if (ts6.isOptionalChain(node)) { + bindOptionalChainFlow(node); + } else { + var expr = ts6.skipParentheses(node.expression); + if (expr.kind === 215 || expr.kind === 216) { + bindEach(node.typeArguments); + bindEach(node.arguments); + bind(node.expression); + } else { + bindEachChild(node); + if (node.expression.kind === 106) { + currentFlow = createFlowCall(currentFlow, node); + } + } + } + if (node.expression.kind === 208) { + var propertyAccess = node.expression; + if (ts6.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts6.isPushOrUnshiftIdentifier(propertyAccess.name)) { + currentFlow = createFlowMutation(256, currentFlow, node); + } + } + } + function getContainerFlags(node) { + switch (node.kind) { + case 228: + case 260: + case 263: + case 207: + case 184: + case 325: + case 289: + return 1; + case 261: + return 1 | 64; + case 264: + case 262: + case 197: + case 178: + return 1 | 32; + case 308: + return 1 | 4 | 32; + case 174: + case 175: + case 171: + if (ts6.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { + return 1 | 4 | 32 | 8 | 128; + } + case 173: + case 259: + case 170: + case 176: + case 326: + case 320: + case 181: + case 177: + case 182: + case 172: + return 1 | 4 | 32 | 8; + case 215: + case 216: + return 1 | 4 | 32 | 8 | 16; + case 265: + return 4; + case 169: + return node.initializer ? 4 : 0; + case 295: + case 245: + case 246: + case 247: + case 266: + return 2; + case 238: + return ts6.isFunctionLike(node.parent) || ts6.isClassStaticBlockDeclaration(node.parent) ? 0 : 2; + } + return 0; + } + function addToContainerChain(next) { + if (lastContainer) { + lastContainer.nextContainer = next; + } + lastContainer = next; + } + function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { + switch (container.kind) { + case 264: + return declareModuleMember(node, symbolFlags, symbolExcludes); + case 308: + return declareSourceFileMember(node, symbolFlags, symbolExcludes); + case 228: + case 260: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 263: + return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); + case 184: + case 325: + case 207: + case 261: + case 289: + return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + case 181: + case 182: + case 176: + case 177: + case 326: + case 178: + case 171: + case 170: + case 173: + case 174: + case 175: + case 259: + case 215: + case 216: + case 320: + case 348: + case 341: + case 172: + case 262: + case 197: + return declareSymbol( + container.locals, + /*parent*/ + void 0, + node, + symbolFlags, + symbolExcludes + ); + } + } + function declareClassMember(node, symbolFlags, symbolExcludes) { + return ts6.isStatic(node) ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); + } + function declareSourceFileMember(node, symbolFlags, symbolExcludes) { + return ts6.isExternalModule(file) ? declareModuleMember(node, symbolFlags, symbolExcludes) : declareSymbol( + file.locals, + /*parent*/ + void 0, + node, + symbolFlags, + symbolExcludes + ); + } + function hasExportDeclarations(node) { + var body = ts6.isSourceFile(node) ? node : ts6.tryCast(node.body, ts6.isModuleBlock); + return !!body && body.statements.some(function(s) { + return ts6.isExportDeclaration(s) || ts6.isExportAssignment(s); + }); + } + function setExportContextFlag(node) { + if (node.flags & 16777216 && !hasExportDeclarations(node)) { + node.flags |= 64; + } else { + node.flags &= ~64; + } + } + function bindModuleDeclaration(node) { + setExportContextFlag(node); + if (ts6.isAmbientModule(node)) { + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + errorOnFirstToken(node, ts6.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); + } + if (ts6.isModuleAugmentationExternal(node)) { + declareModuleSymbol(node); + } else { + var pattern = void 0; + if (node.name.kind === 10) { + var text = node.name.text; + pattern = ts6.tryParsePattern(text); + if (pattern === void 0) { + errorOnFirstToken(node.name, ts6.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text); + } + } + var symbol = declareSymbolAndAddToSymbolTable( + node, + 512, + 110735 + /* SymbolFlags.ValueModuleExcludes */ + ); + file.patternAmbientModules = ts6.append(file.patternAmbientModules, pattern && !ts6.isString(pattern) ? { pattern, symbol } : void 0); + } + } else { + var state = declareModuleSymbol(node); + if (state !== 0) { + var symbol = node.symbol; + symbol.constEnumOnlyModule = !(symbol.flags & (16 | 32 | 256)) && state === 2 && symbol.constEnumOnlyModule !== false; + } + } + } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable( + node, + instantiated ? 512 : 1024, + instantiated ? 110735 : 0 + /* SymbolFlags.NamespaceModuleExcludes */ + ); + return state; + } + function bindFunctionOrConstructorType(node) { + var symbol = createSymbol(131072, getDeclarationName(node)); + addDeclarationToSymbol( + symbol, + node, + 131072 + /* SymbolFlags.Signature */ + ); + var typeLiteralSymbol = createSymbol( + 2048, + "__type" + /* InternalSymbolName.Type */ + ); + addDeclarationToSymbol( + typeLiteralSymbol, + node, + 2048 + /* SymbolFlags.TypeLiteral */ + ); + typeLiteralSymbol.members = ts6.createSymbolTable(); + typeLiteralSymbol.members.set(symbol.escapedName, symbol); + } + function bindObjectLiteralExpression(node) { + return bindAnonymousDeclaration( + node, + 4096, + "__object" + /* InternalSymbolName.Object */ + ); + } + function bindJsxAttributes(node) { + return bindAnonymousDeclaration( + node, + 4096, + "__jsxAttributes" + /* InternalSymbolName.JSXAttributes */ + ); + } + function bindJsxAttribute(node, symbolFlags, symbolExcludes) { + return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } + function bindAnonymousDeclaration(node, symbolFlags, name) { + var symbol = createSymbol(symbolFlags, name); + if (symbolFlags & (8 | 106500)) { + symbol.parent = container.symbol; + } + addDeclarationToSymbol(symbol, node, symbolFlags); + return symbol; + } + function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { + switch (blockScopeContainer.kind) { + case 264: + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + case 308: + if (ts6.isExternalOrCommonJsModule(container)) { + declareModuleMember(node, symbolFlags, symbolExcludes); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = ts6.createSymbolTable(); + addToContainerChain(blockScopeContainer); + } + declareSymbol( + blockScopeContainer.locals, + /*parent*/ + void 0, + node, + symbolFlags, + symbolExcludes + ); + } + } + function delayedBindJSDocTypedefTag() { + if (!delayedTypeAliases) { + return; + } + var saveContainer = container; + var saveLastContainer = lastContainer; + var saveBlockScopeContainer = blockScopeContainer; + var saveParent = parent; + var saveCurrentFlow = currentFlow; + for (var _i = 0, delayedTypeAliases_1 = delayedTypeAliases; _i < delayedTypeAliases_1.length; _i++) { + var typeAlias = delayedTypeAliases_1[_i]; + var host = typeAlias.parent.parent; + container = ts6.findAncestor(host.parent, function(n) { + return !!(getContainerFlags(n) & 1); + }) || file; + blockScopeContainer = ts6.getEnclosingBlockScopeContainer(host) || file; + currentFlow = initFlowNode({ + flags: 2 + /* FlowFlags.Start */ + }); + parent = typeAlias; + bind(typeAlias.typeExpression); + var declName = ts6.getNameOfDeclaration(typeAlias); + if ((ts6.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts6.isPropertyAccessEntityNameExpression(declName.parent)) { + var isTopLevel = isTopLevelNamespaceAssignment(declName.parent); + if (isTopLevel) { + bindPotentiallyMissingNamespaces( + file.symbol, + declName.parent, + isTopLevel, + !!ts6.findAncestor(declName, function(d) { + return ts6.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; + }), + /*containerIsClass*/ + false + ); + var oldContainer = container; + switch (ts6.getAssignmentDeclarationPropertyAccessKind(declName.parent)) { + case 1: + case 2: + if (!ts6.isExternalOrCommonJsModule(file)) { + container = void 0; + } else { + container = file; + } + break; + case 4: + container = declName.parent.expression; + break; + case 3: + container = declName.parent.expression.name; + break; + case 5: + container = isExportsOrModuleExportsOrAlias(file, declName.parent.expression) ? file : ts6.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression; + break; + case 0: + return ts6.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration"); + } + if (container) { + declareModuleMember( + typeAlias, + 524288, + 788968 + /* SymbolFlags.TypeAliasExcludes */ + ); + } + container = oldContainer; + } + } else if (ts6.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 79) { + parent = typeAlias.parent; + bindBlockScopedDeclaration( + typeAlias, + 524288, + 788968 + /* SymbolFlags.TypeAliasExcludes */ + ); + } else { + bind(typeAlias.fullName); + } + } + container = saveContainer; + lastContainer = saveLastContainer; + blockScopeContainer = saveBlockScopeContainer; + parent = saveParent; + currentFlow = saveCurrentFlow; + } + function checkContextualIdentifier(node) { + if (!file.parseDiagnostics.length && !(node.flags & 16777216) && !(node.flags & 8388608) && !ts6.isIdentifierName(node)) { + if (inStrictMode && node.originalKeywordKind >= 117 && node.originalKeywordKind <= 125) { + file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts6.declarationNameToString(node))); + } else if (node.originalKeywordKind === 133) { + if (ts6.isExternalModule(file) && ts6.isInTopLevelContext(node)) { + file.bindDiagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts6.declarationNameToString(node))); + } else if (node.flags & 32768) { + file.bindDiagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, ts6.declarationNameToString(node))); + } + } else if (node.originalKeywordKind === 125 && node.flags & 8192) { + file.bindDiagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, ts6.declarationNameToString(node))); + } + } + } + function getStrictModeIdentifierMessage(node) { + if (ts6.getContainingClass(node)) { + return ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode; + } + return ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode; + } + function checkPrivateIdentifier(node) { + if (node.escapedText === "#constructor") { + if (!file.parseDiagnostics.length) { + file.bindDiagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.constructor_is_a_reserved_word, ts6.declarationNameToString(node))); + } + } + } + function checkStrictModeBinaryExpression(node) { + if (inStrictMode && ts6.isLeftHandSideExpression(node.left) && ts6.isAssignmentOperator(node.operatorToken.kind)) { + checkStrictModeEvalOrArguments(node, node.left); + } + } + function checkStrictModeCatchClause(node) { + if (inStrictMode && node.variableDeclaration) { + checkStrictModeEvalOrArguments(node, node.variableDeclaration.name); + } + } + function checkStrictModeDeleteExpression(node) { + if (inStrictMode && node.expression.kind === 79) { + var span = ts6.getErrorSpanForNode(file, node.expression); + file.bindDiagnostics.push(ts6.createFileDiagnostic(file, span.start, span.length, ts6.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); + } + } + function isEvalOrArgumentsIdentifier(node) { + return ts6.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); + } + function checkStrictModeEvalOrArguments(contextNode, name) { + if (name && name.kind === 79) { + var identifier = name; + if (isEvalOrArgumentsIdentifier(identifier)) { + var span = ts6.getErrorSpanForNode(file, name); + file.bindDiagnostics.push(ts6.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), ts6.idText(identifier))); + } + } + } + function getStrictModeEvalOrArgumentsMessage(node) { + if (ts6.getContainingClass(node)) { + return ts6.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode; + } + if (file.externalModuleIndicator) { + return ts6.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode; + } + return ts6.Diagnostics.Invalid_use_of_0_in_strict_mode; + } + function checkStrictModeFunctionName(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + } + function getStrictModeBlockScopeFunctionDeclarationMessage(node) { + if (ts6.getContainingClass(node)) { + return ts6.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + if (file.externalModuleIndicator) { + return ts6.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + return ts6.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + function checkStrictModeFunctionDeclaration(node) { + if (languageVersion < 2) { + if (blockScopeContainer.kind !== 308 && blockScopeContainer.kind !== 264 && !ts6.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { + var errorSpan = ts6.getErrorSpanForNode(file, node); + file.bindDiagnostics.push(ts6.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } + function checkStrictModeNumericLiteral(node) { + if (languageVersion < 1 && inStrictMode && node.numericLiteralFlags & 32) { + file.bindDiagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); + } + } + function checkStrictModePostfixUnaryExpression(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + function checkStrictModePrefixUnaryExpression(node) { + if (inStrictMode) { + if (node.operator === 45 || node.operator === 46) { + checkStrictModeEvalOrArguments(node, node.operand); + } + } + } + function checkStrictModeWithStatement(node) { + if (inStrictMode) { + errorOnFirstToken(node, ts6.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + function checkStrictModeLabeledStatement(node) { + if (inStrictMode && ts6.getEmitScriptTarget(options) >= 2) { + if (ts6.isDeclarationStatement(node.statement) || ts6.isVariableStatement(node.statement)) { + errorOnFirstToken(node.label, ts6.Diagnostics.A_label_is_not_allowed_here); + } + } + } + function errorOnFirstToken(node, message, arg0, arg1, arg2) { + var span = ts6.getSpanOfTokenAtPosition(file, node.pos); + file.bindDiagnostics.push(ts6.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); + } + function errorOrSuggestionOnNode(isError, node, message) { + errorOrSuggestionOnRange(isError, node, node, message); + } + function errorOrSuggestionOnRange(isError, startNode, endNode, message) { + addErrorOrSuggestionDiagnostic(isError, { pos: ts6.getTokenPosOfNode(startNode, file), end: endNode.end }, message); + } + function addErrorOrSuggestionDiagnostic(isError, range2, message) { + var diag = ts6.createFileDiagnostic(file, range2.pos, range2.end - range2.pos, message); + if (isError) { + file.bindDiagnostics.push(diag); + } else { + file.bindSuggestionDiagnostics = ts6.append(file.bindSuggestionDiagnostics, __assign(__assign({}, diag), { category: ts6.DiagnosticCategory.Suggestion })); + } + } + function bind(node) { + if (!node) { + return; + } + ts6.setParent(node, parent); + if (ts6.tracing) + node.tracingPath = file.path; + var saveInStrictMode = inStrictMode; + bindWorker(node); + if (node.kind > 162) { + var saveParent = parent; + parent = node; + var containerFlags = getContainerFlags(node); + if (containerFlags === 0) { + bindChildren(node); + } else { + bindContainer(node, containerFlags); + } + parent = saveParent; + } else { + var saveParent = parent; + if (node.kind === 1) + parent = node; + bindJSDoc(node); + parent = saveParent; + } + inStrictMode = saveInStrictMode; + } + function bindJSDoc(node) { + if (ts6.hasJSDocNodes(node)) { + if (ts6.isInJSFile(node)) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var j = _a[_i]; + bind(j); + } + } else { + for (var _b = 0, _c = node.jsDoc; _b < _c.length; _b++) { + var j = _c[_b]; + ts6.setParent(j, node); + ts6.setParentRecursive( + j, + /*incremental*/ + false + ); + } + } + } + } + function updateStrictModeStatementList(statements) { + if (!inStrictMode) { + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; + if (!ts6.isPrologueDirective(statement)) { + return; + } + if (isUseStrictPrologueDirective(statement)) { + inStrictMode = true; + return; + } + } + } + } + function isUseStrictPrologueDirective(node) { + var nodeText = ts6.getSourceTextOfNodeFromSourceFile(file, node.expression); + return nodeText === '"use strict"' || nodeText === "'use strict'"; + } + function bindWorker(node) { + switch (node.kind) { + case 79: + if (node.isInJSDocNamespace) { + var parentNode = node.parent; + while (parentNode && !ts6.isJSDocTypeAlias(parentNode)) { + parentNode = parentNode.parent; + } + bindBlockScopedDeclaration( + parentNode, + 524288, + 788968 + /* SymbolFlags.TypeAliasExcludes */ + ); + break; + } + case 108: + if (currentFlow && (ts6.isExpression(node) || parent.kind === 300)) { + node.flowNode = currentFlow; + } + return checkContextualIdentifier(node); + case 163: + if (currentFlow && ts6.isPartOfTypeQuery(node)) { + node.flowNode = currentFlow; + } + break; + case 233: + case 106: + node.flowNode = currentFlow; + break; + case 80: + return checkPrivateIdentifier(node); + case 208: + case 209: + var expr = node; + if (currentFlow && isNarrowableReference(expr)) { + expr.flowNode = currentFlow; + } + if (ts6.isSpecialPropertyDeclaration(expr)) { + bindSpecialPropertyDeclaration(expr); + } + if (ts6.isInJSFile(expr) && file.commonJsModuleIndicator && ts6.isModuleExportsAccessExpression(expr) && !lookupSymbolForName(blockScopeContainer, "module")) { + declareSymbol( + file.locals, + /*parent*/ + void 0, + expr.expression, + 1 | 134217728, + 111550 + /* SymbolFlags.FunctionScopedVariableExcludes */ + ); + } + break; + case 223: + var specialKind = ts6.getAssignmentDeclarationKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node.left, node); + break; + case 6: + bindPrototypeAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 5: + var expression = node.left.expression; + if (ts6.isInJSFile(node) && ts6.isIdentifier(expression)) { + var symbol = lookupSymbolForName(blockScopeContainer, expression.escapedText); + if (ts6.isThisInitializedDeclaration(symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration)) { + bindThisPropertyAssignment(node); + break; + } + } + bindSpecialPropertyAssignment(node); + break; + case 0: + break; + default: + ts6.Debug.fail("Unknown binary expression special property assignment kind"); + } + return checkStrictModeBinaryExpression(node); + case 295: + return checkStrictModeCatchClause(node); + case 217: + return checkStrictModeDeleteExpression(node); + case 8: + return checkStrictModeNumericLiteral(node); + case 222: + return checkStrictModePostfixUnaryExpression(node); + case 221: + return checkStrictModePrefixUnaryExpression(node); + case 251: + return checkStrictModeWithStatement(node); + case 253: + return checkStrictModeLabeledStatement(node); + case 194: + seenThisKeyword = true; + return; + case 179: + break; + case 165: + return bindTypeParameter(node); + case 166: + return bindParameter(node); + case 257: + return bindVariableDeclarationOrBindingElement(node); + case 205: + node.flowNode = currentFlow; + return bindVariableDeclarationOrBindingElement(node); + case 169: + case 168: + return bindPropertyWorker(node); + case 299: + case 300: + return bindPropertyOrMethodOrAccessor( + node, + 4, + 0 + /* SymbolFlags.PropertyExcludes */ + ); + case 302: + return bindPropertyOrMethodOrAccessor( + node, + 8, + 900095 + /* SymbolFlags.EnumMemberExcludes */ + ); + case 176: + case 177: + case 178: + return declareSymbolAndAddToSymbolTable( + node, + 131072, + 0 + /* SymbolFlags.None */ + ); + case 171: + case 170: + return bindPropertyOrMethodOrAccessor( + node, + 8192 | (node.questionToken ? 16777216 : 0), + ts6.isObjectLiteralMethod(node) ? 0 : 103359 + /* SymbolFlags.MethodExcludes */ + ); + case 259: + return bindFunctionDeclaration(node); + case 173: + return declareSymbolAndAddToSymbolTable( + node, + 16384, + /*symbolExcludes:*/ + 0 + /* SymbolFlags.None */ + ); + case 174: + return bindPropertyOrMethodOrAccessor( + node, + 32768, + 46015 + /* SymbolFlags.GetAccessorExcludes */ + ); + case 175: + return bindPropertyOrMethodOrAccessor( + node, + 65536, + 78783 + /* SymbolFlags.SetAccessorExcludes */ + ); + case 181: + case 320: + case 326: + case 182: + return bindFunctionOrConstructorType(node); + case 184: + case 325: + case 197: + return bindAnonymousTypeWorker(node); + case 335: + return bindJSDocClassTag(node); + case 207: + return bindObjectLiteralExpression(node); + case 215: + case 216: + return bindFunctionExpression(node); + case 210: + var assignmentKind = ts6.getAssignmentDeclarationKind(node); + switch (assignmentKind) { + case 7: + return bindObjectDefinePropertyAssignment(node); + case 8: + return bindObjectDefinePropertyExport(node); + case 9: + return bindObjectDefinePrototypeProperty(node); + case 0: + break; + default: + return ts6.Debug.fail("Unknown call expression assignment declaration kind"); + } + if (ts6.isInJSFile(node)) { + bindCallExpression(node); + } + break; + case 228: + case 260: + inStrictMode = true; + return bindClassLikeDeclaration(node); + case 261: + return bindBlockScopedDeclaration( + node, + 64, + 788872 + /* SymbolFlags.InterfaceExcludes */ + ); + case 262: + return bindBlockScopedDeclaration( + node, + 524288, + 788968 + /* SymbolFlags.TypeAliasExcludes */ + ); + case 263: + return bindEnumDeclaration(node); + case 264: + return bindModuleDeclaration(node); + case 289: + return bindJsxAttributes(node); + case 288: + return bindJsxAttribute( + node, + 4, + 0 + /* SymbolFlags.PropertyExcludes */ + ); + case 268: + case 271: + case 273: + case 278: + return declareSymbolAndAddToSymbolTable( + node, + 2097152, + 2097152 + /* SymbolFlags.AliasExcludes */ + ); + case 267: + return bindNamespaceExportDeclaration(node); + case 270: + return bindImportClause(node); + case 275: + return bindExportDeclaration(node); + case 274: + return bindExportAssignment(node); + case 308: + updateStrictModeStatementList(node.statements); + return bindSourceFileIfExternalModule(); + case 238: + if (!ts6.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { + return; + } + case 265: + return updateStrictModeStatementList(node.statements); + case 343: + if (node.parent.kind === 326) { + return bindParameter(node); + } + if (node.parent.kind !== 325) { + break; + } + case 350: + var propTag = node; + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 ? 4 | 16777216 : 4; + return declareSymbolAndAddToSymbolTable( + propTag, + flags, + 0 + /* SymbolFlags.PropertyExcludes */ + ); + case 348: + case 341: + case 342: + return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); + } + } + function bindPropertyWorker(node) { + var isAutoAccessor = ts6.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 : 4; + var excludes = isAutoAccessor ? 13247 : 0; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 : 0), excludes); + } + function bindAnonymousTypeWorker(node) { + return bindAnonymousDeclaration( + node, + 2048, + "__type" + /* InternalSymbolName.Type */ + ); + } + function bindSourceFileIfExternalModule() { + setExportContextFlag(file); + if (ts6.isExternalModule(file)) { + bindSourceFileAsExternalModule(); + } else if (ts6.isJsonSourceFile(file)) { + bindSourceFileAsExternalModule(); + var originalSymbol = file.symbol; + declareSymbol( + file.symbol.exports, + file.symbol, + file, + 4, + 67108863 + /* SymbolFlags.All */ + ); + file.symbol = originalSymbol; + } + } + function bindSourceFileAsExternalModule() { + bindAnonymousDeclaration(file, 512, '"'.concat(ts6.removeFileExtension(file.fileName), '"')); + } + function bindExportAssignment(node) { + if (!container.symbol || !container.symbol.exports) { + bindAnonymousDeclaration(node, 111551, getDeclarationName(node)); + } else { + var flags = ts6.exportAssignmentIsAlias(node) ? 2097152 : 4; + var symbol = declareSymbol( + container.symbol.exports, + container.symbol, + node, + flags, + 67108863 + /* SymbolFlags.All */ + ); + if (node.isExportEquals) { + ts6.setValueDeclaration(symbol, node); + } + } + } + function bindNamespaceExportDeclaration(node) { + if (ts6.some(node.modifiers)) { + file.bindDiagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Modifiers_cannot_appear_here)); + } + var diag = !ts6.isSourceFile(node.parent) ? ts6.Diagnostics.Global_module_exports_may_only_appear_at_top_level : !ts6.isExternalModule(node.parent) ? ts6.Diagnostics.Global_module_exports_may_only_appear_in_module_files : !node.parent.isDeclarationFile ? ts6.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files : void 0; + if (diag) { + file.bindDiagnostics.push(createDiagnosticForNode(node, diag)); + } else { + file.symbol.globalExports = file.symbol.globalExports || ts6.createSymbolTable(); + declareSymbol( + file.symbol.globalExports, + file.symbol, + node, + 2097152, + 2097152 + /* SymbolFlags.AliasExcludes */ + ); + } + } + function bindExportDeclaration(node) { + if (!container.symbol || !container.symbol.exports) { + bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); + } else if (!node.exportClause) { + declareSymbol( + container.symbol.exports, + container.symbol, + node, + 8388608, + 0 + /* SymbolFlags.None */ + ); + } else if (ts6.isNamespaceExport(node.exportClause)) { + ts6.setParent(node.exportClause, node); + declareSymbol( + container.symbol.exports, + container.symbol, + node.exportClause, + 2097152, + 2097152 + /* SymbolFlags.AliasExcludes */ + ); + } + } + function bindImportClause(node) { + if (node.name) { + declareSymbolAndAddToSymbolTable( + node, + 2097152, + 2097152 + /* SymbolFlags.AliasExcludes */ + ); + } + } + function setCommonJsModuleIndicator(node) { + if (file.externalModuleIndicator && file.externalModuleIndicator !== true) { + return false; + } + if (!file.commonJsModuleIndicator) { + file.commonJsModuleIndicator = node; + if (!file.externalModuleIndicator) { + bindSourceFileAsExternalModule(); + } + } + return true; + } + function bindObjectDefinePropertyExport(node) { + if (!setCommonJsModuleIndicator(node)) { + return; + } + var symbol = forEachIdentifierInEntityName( + node.arguments[0], + /*parent*/ + void 0, + function(id, symbol2) { + if (symbol2) { + addDeclarationToSymbol( + symbol2, + id, + 1536 | 67108864 + /* SymbolFlags.Assignment */ + ); + } + return symbol2; + } + ); + if (symbol) { + var flags = 4 | 1048576; + declareSymbol( + symbol.exports, + symbol, + node, + flags, + 0 + /* SymbolFlags.None */ + ); + } + } + function bindExportsPropertyAssignment(node) { + if (!setCommonJsModuleIndicator(node)) { + return; + } + var symbol = forEachIdentifierInEntityName( + node.left.expression, + /*parent*/ + void 0, + function(id, symbol2) { + if (symbol2) { + addDeclarationToSymbol( + symbol2, + id, + 1536 | 67108864 + /* SymbolFlags.Assignment */ + ); + } + return symbol2; + } + ); + if (symbol) { + var isAlias = ts6.isAliasableExpression(node.right) && (ts6.isExportsIdentifier(node.left.expression) || ts6.isModuleExportsAccessExpression(node.left.expression)); + var flags = isAlias ? 2097152 : 4 | 1048576; + ts6.setParent(node.left, node); + declareSymbol( + symbol.exports, + symbol, + node.left, + flags, + 0 + /* SymbolFlags.None */ + ); + } + } + function bindModuleExportsAssignment(node) { + if (!setCommonJsModuleIndicator(node)) { + return; + } + var assignedExpression = ts6.getRightMostAssignedExpression(node.right); + if (ts6.isEmptyObjectLiteral(assignedExpression) || container === file && isExportsOrModuleExportsOrAlias(file, assignedExpression)) { + return; + } + if (ts6.isObjectLiteralExpression(assignedExpression) && ts6.every(assignedExpression.properties, ts6.isShorthandPropertyAssignment)) { + ts6.forEach(assignedExpression.properties, bindExportAssignedObjectMemberAlias); + return; + } + var flags = ts6.exportAssignmentIsAlias(node) ? 2097152 : 4 | 1048576 | 512; + var symbol = declareSymbol( + file.symbol.exports, + file.symbol, + node, + flags | 67108864, + 0 + /* SymbolFlags.None */ + ); + ts6.setValueDeclaration(symbol, node); + } + function bindExportAssignedObjectMemberAlias(node) { + declareSymbol( + file.symbol.exports, + file.symbol, + node, + 2097152 | 67108864, + 0 + /* SymbolFlags.None */ + ); + } + function bindThisPropertyAssignment(node) { + ts6.Debug.assert(ts6.isInJSFile(node)); + var hasPrivateIdentifier = ts6.isBinaryExpression(node) && ts6.isPropertyAccessExpression(node.left) && ts6.isPrivateIdentifier(node.left.name) || ts6.isPropertyAccessExpression(node) && ts6.isPrivateIdentifier(node.name); + if (hasPrivateIdentifier) { + return; + } + var thisContainer = ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + switch (thisContainer.kind) { + case 259: + case 215: + var constructorSymbol = thisContainer.symbol; + if (ts6.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63) { + var l = thisContainer.parent.left; + if (ts6.isBindableStaticAccessExpression(l) && ts6.isPrototypeAccess(l.expression)) { + constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer); + } + } + if (constructorSymbol && constructorSymbol.valueDeclaration) { + constructorSymbol.members = constructorSymbol.members || ts6.createSymbolTable(); + if (ts6.hasDynamicName(node)) { + bindDynamicallyNamedThisPropertyAssignment(node, constructorSymbol, constructorSymbol.members); + } else { + declareSymbol( + constructorSymbol.members, + constructorSymbol, + node, + 4 | 67108864, + 0 & ~4 + /* SymbolFlags.Property */ + ); + } + addDeclarationToSymbol( + constructorSymbol, + constructorSymbol.valueDeclaration, + 32 + /* SymbolFlags.Class */ + ); + } + break; + case 173: + case 169: + case 171: + case 174: + case 175: + case 172: + var containingClass = thisContainer.parent; + var symbolTable = ts6.isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members; + if (ts6.hasDynamicName(node)) { + bindDynamicallyNamedThisPropertyAssignment(node, containingClass.symbol, symbolTable); + } else { + declareSymbol( + symbolTable, + containingClass.symbol, + node, + 4 | 67108864, + 0, + /*isReplaceableByMethod*/ + true + ); + } + break; + case 308: + if (ts6.hasDynamicName(node)) { + break; + } else if (thisContainer.commonJsModuleIndicator) { + declareSymbol( + thisContainer.symbol.exports, + thisContainer.symbol, + node, + 4 | 1048576, + 0 + /* SymbolFlags.None */ + ); + } else { + declareSymbolAndAddToSymbolTable( + node, + 1, + 111550 + /* SymbolFlags.FunctionScopedVariableExcludes */ + ); + } + break; + default: + ts6.Debug.failBadSyntaxKind(thisContainer); + } + } + function bindDynamicallyNamedThisPropertyAssignment(node, symbol, symbolTable) { + declareSymbol( + symbolTable, + symbol, + node, + 4, + 0, + /*isReplaceableByMethod*/ + true, + /*isComputedName*/ + true + ); + addLateBoundAssignmentDeclarationToSymbol(node, symbol); + } + function addLateBoundAssignmentDeclarationToSymbol(node, symbol) { + if (symbol) { + (symbol.assignmentDeclarationMembers || (symbol.assignmentDeclarationMembers = new ts6.Map())).set(ts6.getNodeId(node), node); + } + } + function bindSpecialPropertyDeclaration(node) { + if (node.expression.kind === 108) { + bindThisPropertyAssignment(node); + } else if (ts6.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308) { + if (ts6.isPrototypeAccess(node.expression)) { + bindPrototypePropertyAssignment(node, node.parent); + } else { + bindStaticPropertyAssignment(node); + } + } + } + function bindPrototypeAssignment(node) { + ts6.setParent(node.left, node); + ts6.setParent(node.right, node); + bindPropertyAssignment( + node.left.expression, + node.left, + /*isPrototypeProperty*/ + false, + /*containerIsClass*/ + true + ); + } + function bindObjectDefinePrototypeProperty(node) { + var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0].expression); + if (namespaceSymbol && namespaceSymbol.valueDeclaration) { + addDeclarationToSymbol( + namespaceSymbol, + namespaceSymbol.valueDeclaration, + 32 + /* SymbolFlags.Class */ + ); + } + bindPotentiallyNewExpandoMemberToNamespace( + node, + namespaceSymbol, + /*isPrototypeProperty*/ + true + ); + } + function bindPrototypePropertyAssignment(lhs, parent2) { + var classPrototype = lhs.expression; + var constructorFunction = classPrototype.expression; + ts6.setParent(constructorFunction, classPrototype); + ts6.setParent(classPrototype, lhs); + ts6.setParent(lhs, parent2); + bindPropertyAssignment( + constructorFunction, + lhs, + /*isPrototypeProperty*/ + true, + /*containerIsClass*/ + true + ); + } + function bindObjectDefinePropertyAssignment(node) { + var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); + var isToplevel = node.parent.parent.kind === 308; + namespaceSymbol = bindPotentiallyMissingNamespaces( + namespaceSymbol, + node.arguments[0], + isToplevel, + /*isPrototypeProperty*/ + false, + /*containerIsClass*/ + false + ); + bindPotentiallyNewExpandoMemberToNamespace( + node, + namespaceSymbol, + /*isPrototypeProperty*/ + false + ); + } + function bindSpecialPropertyAssignment(node) { + var _a; + var parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer); + if (!ts6.isInJSFile(node) && !ts6.isFunctionSymbol(parentSymbol)) { + return; + } + var rootExpr = ts6.getLeftmostAccessExpression(node.left); + if (ts6.isIdentifier(rootExpr) && ((_a = lookupSymbolForName(container, rootExpr.escapedText)) === null || _a === void 0 ? void 0 : _a.flags) & 2097152) { + return; + } + ts6.setParent(node.left, node); + ts6.setParent(node.right, node); + if (ts6.isIdentifier(node.left.expression) && container === file && isExportsOrModuleExportsOrAlias(file, node.left.expression)) { + bindExportsPropertyAssignment(node); + } else if (ts6.hasDynamicName(node)) { + bindAnonymousDeclaration( + node, + 4 | 67108864, + "__computed" + /* InternalSymbolName.Computed */ + ); + var sym = bindPotentiallyMissingNamespaces( + parentSymbol, + node.left.expression, + isTopLevelNamespaceAssignment(node.left), + /*isPrototype*/ + false, + /*containerIsClass*/ + false + ); + addLateBoundAssignmentDeclarationToSymbol(node, sym); + } else { + bindStaticPropertyAssignment(ts6.cast(node.left, ts6.isBindableStaticNameExpression)); + } + } + function bindStaticPropertyAssignment(node) { + ts6.Debug.assert(!ts6.isIdentifier(node)); + ts6.setParent(node.expression, node); + bindPropertyAssignment( + node.expression, + node, + /*isPrototypeProperty*/ + false, + /*containerIsClass*/ + false + ); + } + function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty, containerIsClass) { + if ((namespaceSymbol === null || namespaceSymbol === void 0 ? void 0 : namespaceSymbol.flags) & 2097152) { + return namespaceSymbol; + } + if (isToplevel && !isPrototypeProperty) { + var flags_2 = 1536 | 67108864; + var excludeFlags_1 = 110735 & ~67108864; + namespaceSymbol = forEachIdentifierInEntityName(entityName, namespaceSymbol, function(id, symbol, parent2) { + if (symbol) { + addDeclarationToSymbol(symbol, id, flags_2); + return symbol; + } else { + var table = parent2 ? parent2.exports : file.jsGlobalAugmentations || (file.jsGlobalAugmentations = ts6.createSymbolTable()); + return declareSymbol(table, parent2, id, flags_2, excludeFlags_1); + } + }); + } + if (containerIsClass && namespaceSymbol && namespaceSymbol.valueDeclaration) { + addDeclarationToSymbol( + namespaceSymbol, + namespaceSymbol.valueDeclaration, + 32 + /* SymbolFlags.Class */ + ); + } + return namespaceSymbol; + } + function bindPotentiallyNewExpandoMemberToNamespace(declaration, namespaceSymbol, isPrototypeProperty) { + if (!namespaceSymbol || !isExpandoSymbol(namespaceSymbol)) { + return; + } + var symbolTable = isPrototypeProperty ? namespaceSymbol.members || (namespaceSymbol.members = ts6.createSymbolTable()) : namespaceSymbol.exports || (namespaceSymbol.exports = ts6.createSymbolTable()); + var includes = 0; + var excludes = 0; + if (ts6.isFunctionLikeDeclaration(ts6.getAssignedExpandoInitializer(declaration))) { + includes = 8192; + excludes = 103359; + } else if (ts6.isCallExpression(declaration) && ts6.isBindableObjectDefinePropertyCall(declaration)) { + if (ts6.some(declaration.arguments[2].properties, function(p) { + var id = ts6.getNameOfDeclaration(p); + return !!id && ts6.isIdentifier(id) && ts6.idText(id) === "set"; + })) { + includes |= 65536 | 4; + excludes |= 78783; + } + if (ts6.some(declaration.arguments[2].properties, function(p) { + var id = ts6.getNameOfDeclaration(p); + return !!id && ts6.isIdentifier(id) && ts6.idText(id) === "get"; + })) { + includes |= 32768 | 4; + excludes |= 46015; + } + } + if (includes === 0) { + includes = 4; + excludes = 0; + } + declareSymbol( + symbolTable, + namespaceSymbol, + declaration, + includes | 67108864, + excludes & ~67108864 + /* SymbolFlags.Assignment */ + ); + } + function isTopLevelNamespaceAssignment(propertyAccess) { + return ts6.isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 : propertyAccess.parent.parent.kind === 308; + } + function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { + var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); + var isToplevel = isTopLevelNamespaceAssignment(propertyAccess); + namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass); + bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty); + } + function isExpandoSymbol(symbol) { + if (symbol.flags & (16 | 32 | 1024)) { + return true; + } + var node = symbol.valueDeclaration; + if (node && ts6.isCallExpression(node)) { + return !!ts6.getAssignedExpandoInitializer(node); + } + var init = !node ? void 0 : ts6.isVariableDeclaration(node) ? node.initializer : ts6.isBinaryExpression(node) ? node.right : ts6.isPropertyAccessExpression(node) && ts6.isBinaryExpression(node.parent) ? node.parent.right : void 0; + init = init && ts6.getRightMostAssignedExpression(init); + if (init) { + var isPrototypeAssignment = ts6.isPrototypeAccess(ts6.isVariableDeclaration(node) ? node.name : ts6.isBinaryExpression(node) ? node.left : node); + return !!ts6.getExpandoInitializer(ts6.isBinaryExpression(init) && (init.operatorToken.kind === 56 || init.operatorToken.kind === 60) ? init.right : init, isPrototypeAssignment); + } + return false; + } + function getParentOfBinaryExpression(expr) { + while (ts6.isBinaryExpression(expr.parent)) { + expr = expr.parent; + } + return expr.parent; + } + function lookupSymbolForPropertyAccess(node, lookupContainer) { + if (lookupContainer === void 0) { + lookupContainer = container; + } + if (ts6.isIdentifier(node)) { + return lookupSymbolForName(lookupContainer, node.escapedText); + } else { + var symbol = lookupSymbolForPropertyAccess(node.expression); + return symbol && symbol.exports && symbol.exports.get(ts6.getElementOrPropertyAccessName(node)); + } + } + function forEachIdentifierInEntityName(e, parent2, action) { + if (isExportsOrModuleExportsOrAlias(file, e)) { + return file.symbol; + } else if (ts6.isIdentifier(e)) { + return action(e, lookupSymbolForPropertyAccess(e), parent2); + } else { + var s = forEachIdentifierInEntityName(e.expression, parent2, action); + var name = ts6.getNameOrArgument(e); + if (ts6.isPrivateIdentifier(name)) { + ts6.Debug.fail("unexpected PrivateIdentifier"); + } + return action(name, s && s.exports && s.exports.get(ts6.getElementOrPropertyAccessName(e)), s); + } + } + function bindCallExpression(node) { + if (!file.commonJsModuleIndicator && ts6.isRequireCall( + node, + /*checkArgumentIsStringLiteralLike*/ + false + )) { + setCommonJsModuleIndicator(node); + } + } + function bindClassLikeDeclaration(node) { + if (node.kind === 260) { + bindBlockScopedDeclaration( + node, + 32, + 899503 + /* SymbolFlags.ClassExcludes */ + ); + } else { + var bindingName = node.name ? node.name.escapedText : "__class"; + bindAnonymousDeclaration(node, 32, bindingName); + if (node.name) { + classifiableNames.add(node.name.escapedText); + } + } + var symbol = node.symbol; + var prototypeSymbol = createSymbol(4 | 4194304, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.escapedName); + if (symbolExport) { + if (node.name) { + ts6.setParent(node.name, node); + } + file.bindDiagnostics.push(createDiagnosticForNode(symbolExport.declarations[0], ts6.Diagnostics.Duplicate_identifier_0, ts6.symbolName(prototypeSymbol))); + } + symbol.exports.set(prototypeSymbol.escapedName, prototypeSymbol); + prototypeSymbol.parent = symbol; + } + function bindEnumDeclaration(node) { + return ts6.isEnumConst(node) ? bindBlockScopedDeclaration( + node, + 128, + 899967 + /* SymbolFlags.ConstEnumExcludes */ + ) : bindBlockScopedDeclaration( + node, + 256, + 899327 + /* SymbolFlags.RegularEnumExcludes */ + ); + } + function bindVariableDeclarationOrBindingElement(node) { + if (inStrictMode) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (!ts6.isBindingPattern(node.name)) { + var possibleVariableDecl = node.kind === 257 ? node : node.parent.parent; + if (ts6.isInJSFile(node) && ts6.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts6.getJSDocTypeTag(node) && !(ts6.getCombinedModifierFlags(node) & 1)) { + declareSymbolAndAddToSymbolTable( + node, + 2097152, + 2097152 + /* SymbolFlags.AliasExcludes */ + ); + } else if (ts6.isBlockOrCatchScoped(node)) { + bindBlockScopedDeclaration( + node, + 2, + 111551 + /* SymbolFlags.BlockScopedVariableExcludes */ + ); + } else if (ts6.isParameterDeclaration(node)) { + declareSymbolAndAddToSymbolTable( + node, + 1, + 111551 + /* SymbolFlags.ParameterExcludes */ + ); + } else { + declareSymbolAndAddToSymbolTable( + node, + 1, + 111550 + /* SymbolFlags.FunctionScopedVariableExcludes */ + ); + } + } + } + function bindParameter(node) { + if (node.kind === 343 && container.kind !== 326) { + return; + } + if (inStrictMode && !(node.flags & 16777216)) { + checkStrictModeEvalOrArguments(node, node.name); + } + if (ts6.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1, "__" + node.parent.parameters.indexOf(node)); + } else { + declareSymbolAndAddToSymbolTable( + node, + 1, + 111551 + /* SymbolFlags.ParameterExcludes */ + ); + } + if (ts6.isParameterPropertyDeclaration(node, node.parent)) { + var classDeclaration = node.parent.parent; + declareSymbol( + classDeclaration.symbol.members, + classDeclaration.symbol, + node, + 4 | (node.questionToken ? 16777216 : 0), + 0 + /* SymbolFlags.PropertyExcludes */ + ); + } + } + function bindFunctionDeclaration(node) { + if (!file.isDeclarationFile && !(node.flags & 16777216)) { + if (ts6.isAsyncFunction(node)) { + emitFlags |= 2048; + } + } + checkStrictModeFunctionName(node); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + bindBlockScopedDeclaration( + node, + 16, + 110991 + /* SymbolFlags.FunctionExcludes */ + ); + } else { + declareSymbolAndAddToSymbolTable( + node, + 16, + 110991 + /* SymbolFlags.FunctionExcludes */ + ); + } + } + function bindFunctionExpression(node) { + if (!file.isDeclarationFile && !(node.flags & 16777216)) { + if (ts6.isAsyncFunction(node)) { + emitFlags |= 2048; + } + } + if (currentFlow) { + node.flowNode = currentFlow; + } + checkStrictModeFunctionName(node); + var bindingName = node.name ? node.name.escapedText : "__function"; + return bindAnonymousDeclaration(node, 16, bindingName); + } + function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { + if (!file.isDeclarationFile && !(node.flags & 16777216) && ts6.isAsyncFunction(node)) { + emitFlags |= 2048; + } + if (currentFlow && ts6.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { + node.flowNode = currentFlow; + } + return ts6.hasDynamicName(node) ? bindAnonymousDeclaration( + node, + symbolFlags, + "__computed" + /* InternalSymbolName.Computed */ + ) : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } + function getInferTypeContainer(node) { + var extendsType = ts6.findAncestor(node, function(n) { + return n.parent && ts6.isConditionalTypeNode(n.parent) && n.parent.extendsType === n; + }); + return extendsType && extendsType.parent; + } + function bindTypeParameter(node) { + if (ts6.isJSDocTemplateTag(node.parent)) { + var container_1 = ts6.getEffectiveContainerForJSDocTemplateTag(node.parent); + if (container_1) { + if (!container_1.locals) { + container_1.locals = ts6.createSymbolTable(); + } + declareSymbol( + container_1.locals, + /*parent*/ + void 0, + node, + 262144, + 526824 + /* SymbolFlags.TypeParameterExcludes */ + ); + } else { + declareSymbolAndAddToSymbolTable( + node, + 262144, + 526824 + /* SymbolFlags.TypeParameterExcludes */ + ); + } + } else if (node.parent.kind === 192) { + var container_2 = getInferTypeContainer(node.parent); + if (container_2) { + if (!container_2.locals) { + container_2.locals = ts6.createSymbolTable(); + } + declareSymbol( + container_2.locals, + /*parent*/ + void 0, + node, + 262144, + 526824 + /* SymbolFlags.TypeParameterExcludes */ + ); + } else { + bindAnonymousDeclaration(node, 262144, getDeclarationName(node)); + } + } else { + declareSymbolAndAddToSymbolTable( + node, + 262144, + 526824 + /* SymbolFlags.TypeParameterExcludes */ + ); + } + } + function shouldReportErrorOnModuleDeclaration(node) { + var instanceState = getModuleInstanceState(node); + return instanceState === 1 || instanceState === 2 && ts6.shouldPreserveConstEnums(options); + } + function checkUnreachable(node) { + if (!(currentFlow.flags & 1)) { + return false; + } + if (currentFlow === unreachableFlow) { + var reportError = ( + // report error on all statements except empty ones + ts6.isStatementButNotDeclaration(node) && node.kind !== 239 || // report error on class declarations + node.kind === 260 || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + node.kind === 264 && shouldReportErrorOnModuleDeclaration(node) + ); + if (reportError) { + currentFlow = reportedUnreachableFlow; + if (!options.allowUnreachableCode) { + var isError_1 = ts6.unreachableCodeIsError(options) && !(node.flags & 16777216) && (!ts6.isVariableStatement(node) || !!(ts6.getCombinedNodeFlags(node.declarationList) & 3) || node.declarationList.declarations.some(function(d) { + return !!d.initializer; + })); + eachUnreachableRange(node, function(start, end) { + return errorOrSuggestionOnRange(isError_1, start, end, ts6.Diagnostics.Unreachable_code_detected); + }); + } + } + } + return true; + } + } + function eachUnreachableRange(node, cb) { + if (ts6.isStatement(node) && isExecutableStatement(node) && ts6.isBlock(node.parent)) { + var statements = node.parent.statements; + var slice_1 = ts6.sliceAfter(statements, node); + ts6.getRangesWhere(slice_1, isExecutableStatement, function(start, afterEnd) { + return cb(slice_1[start], slice_1[afterEnd - 1]); + }); + } else { + cb(node, node); + } + } + function isExecutableStatement(s) { + return !ts6.isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !ts6.isEnumDeclaration(s) && // `var x;` may declare a variable used above + !(ts6.isVariableStatement(s) && !(ts6.getCombinedNodeFlags(s) & (1 | 2)) && s.declarationList.declarations.some(function(d) { + return !d.initializer; + })); + } + function isPurelyTypeDeclaration(s) { + switch (s.kind) { + case 261: + case 262: + return true; + case 264: + return getModuleInstanceState(s) !== 1; + case 263: + return ts6.hasSyntacticModifier( + s, + 2048 + /* ModifierFlags.Const */ + ); + default: + return false; + } + } + function isExportsOrModuleExportsOrAlias(sourceFile, node) { + var i = 0; + var q = ts6.createQueue(); + q.enqueue(node); + while (!q.isEmpty() && i < 100) { + i++; + node = q.dequeue(); + if (ts6.isExportsIdentifier(node) || ts6.isModuleExportsAccessExpression(node)) { + return true; + } else if (ts6.isIdentifier(node)) { + var symbol = lookupSymbolForName(sourceFile, node.escapedText); + if (!!symbol && !!symbol.valueDeclaration && ts6.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) { + var init = symbol.valueDeclaration.initializer; + q.enqueue(init); + if (ts6.isAssignmentExpression( + init, + /*excludeCompoundAssignment*/ + true + )) { + q.enqueue(init.left); + q.enqueue(init.right); + } + } + } + } + return false; + } + ts6.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias; + function lookupSymbolForName(container, name) { + var local = container.locals && container.locals.get(name); + if (local) { + return local.exportSymbol || local; + } + if (ts6.isSourceFile(container) && container.jsGlobalAugmentations && container.jsGlobalAugmentations.has(name)) { + return container.jsGlobalAugmentations.get(name); + } + return container.symbol && container.symbol.exports && container.symbol.exports.get(name); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, getFirstIdentifier, getTypeArguments) { + return getSymbolWalker; + function getSymbolWalker(accept) { + if (accept === void 0) { + accept = function() { + return true; + }; + } + var visitedTypes = []; + var visitedSymbols = []; + return { + walkType: function(type) { + try { + visitType(type); + return { visitedTypes: ts6.getOwnValues(visitedTypes), visitedSymbols: ts6.getOwnValues(visitedSymbols) }; + } finally { + ts6.clear(visitedTypes); + ts6.clear(visitedSymbols); + } + }, + walkSymbol: function(symbol) { + try { + visitSymbol(symbol); + return { visitedTypes: ts6.getOwnValues(visitedTypes), visitedSymbols: ts6.getOwnValues(visitedSymbols) }; + } finally { + ts6.clear(visitedTypes); + ts6.clear(visitedSymbols); + } + } + }; + function visitType(type) { + if (!type) { + return; + } + if (visitedTypes[type.id]) { + return; + } + visitedTypes[type.id] = type; + var shouldBail = visitSymbol(type.symbol); + if (shouldBail) + return; + if (type.flags & 524288) { + var objectType = type; + var objectFlags = objectType.objectFlags; + if (objectFlags & 4) { + visitTypeReference(type); + } + if (objectFlags & 32) { + visitMappedType(type); + } + if (objectFlags & (1 | 2)) { + visitInterfaceType(type); + } + if (objectFlags & (8 | 16)) { + visitObjectType(objectType); + } + } + if (type.flags & 262144) { + visitTypeParameter(type); + } + if (type.flags & 3145728) { + visitUnionOrIntersectionType(type); + } + if (type.flags & 4194304) { + visitIndexType(type); + } + if (type.flags & 8388608) { + visitIndexedAccessType(type); + } + } + function visitTypeReference(type) { + visitType(type.target); + ts6.forEach(getTypeArguments(type), visitType); + } + function visitTypeParameter(type) { + visitType(getConstraintOfTypeParameter(type)); + } + function visitUnionOrIntersectionType(type) { + ts6.forEach(type.types, visitType); + } + function visitIndexType(type) { + visitType(type.type); + } + function visitIndexedAccessType(type) { + visitType(type.objectType); + visitType(type.indexType); + visitType(type.constraint); + } + function visitMappedType(type) { + visitType(type.typeParameter); + visitType(type.constraintType); + visitType(type.templateType); + visitType(type.modifiersType); + } + function visitSignature(signature) { + var typePredicate = getTypePredicateOfSignature(signature); + if (typePredicate) { + visitType(typePredicate.type); + } + ts6.forEach(signature.typeParameters, visitType); + for (var _i = 0, _a = signature.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + visitSymbol(parameter); + } + visitType(getRestTypeOfSignature(signature)); + visitType(getReturnTypeOfSignature(signature)); + } + function visitInterfaceType(interfaceT) { + visitObjectType(interfaceT); + ts6.forEach(interfaceT.typeParameters, visitType); + ts6.forEach(getBaseTypes(interfaceT), visitType); + visitType(interfaceT.thisType); + } + function visitObjectType(type) { + var resolved = resolveStructuredTypeMembers(type); + for (var _i = 0, _a = resolved.indexInfos; _i < _a.length; _i++) { + var info = _a[_i]; + visitType(info.keyType); + visitType(info.type); + } + for (var _b = 0, _c = resolved.callSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + visitSignature(signature); + } + for (var _d = 0, _e = resolved.constructSignatures; _d < _e.length; _d++) { + var signature = _e[_d]; + visitSignature(signature); + } + for (var _f = 0, _g = resolved.properties; _f < _g.length; _f++) { + var p = _g[_f]; + visitSymbol(p); + } + } + function visitSymbol(symbol) { + if (!symbol) { + return false; + } + var symbolId = ts6.getSymbolId(symbol); + if (visitedSymbols[symbolId]) { + return false; + } + visitedSymbols[symbolId] = symbol; + if (!accept(symbol)) { + return true; + } + var t = getTypeOfSymbol(symbol); + visitType(t); + if (symbol.exports) { + symbol.exports.forEach(visitSymbol); + } + ts6.forEach(symbol.declarations, function(d) { + if (d.type && d.type.kind === 183) { + var query = d.type; + var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); + visitSymbol(entity); + } + }); + return false; + } + } + } + ts6.createGetSymbolWalker = createGetSymbolWalker; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ambientModuleSymbolRegex = /^".+"$/; + var anon = "(anonymous)"; + var nextSymbolId = 1; + var nextNodeId2 = 1; + var nextMergeId = 1; + var nextFlowId = 1; + var IterationUse; + (function(IterationUse2) { + IterationUse2[IterationUse2["AllowsSyncIterablesFlag"] = 1] = "AllowsSyncIterablesFlag"; + IterationUse2[IterationUse2["AllowsAsyncIterablesFlag"] = 2] = "AllowsAsyncIterablesFlag"; + IterationUse2[IterationUse2["AllowsStringInputFlag"] = 4] = "AllowsStringInputFlag"; + IterationUse2[IterationUse2["ForOfFlag"] = 8] = "ForOfFlag"; + IterationUse2[IterationUse2["YieldStarFlag"] = 16] = "YieldStarFlag"; + IterationUse2[IterationUse2["SpreadFlag"] = 32] = "SpreadFlag"; + IterationUse2[IterationUse2["DestructuringFlag"] = 64] = "DestructuringFlag"; + IterationUse2[IterationUse2["PossiblyOutOfBounds"] = 128] = "PossiblyOutOfBounds"; + IterationUse2[IterationUse2["Element"] = 1] = "Element"; + IterationUse2[IterationUse2["Spread"] = 33] = "Spread"; + IterationUse2[IterationUse2["Destructuring"] = 65] = "Destructuring"; + IterationUse2[IterationUse2["ForOf"] = 13] = "ForOf"; + IterationUse2[IterationUse2["ForAwaitOf"] = 15] = "ForAwaitOf"; + IterationUse2[IterationUse2["YieldStar"] = 17] = "YieldStar"; + IterationUse2[IterationUse2["AsyncYieldStar"] = 19] = "AsyncYieldStar"; + IterationUse2[IterationUse2["GeneratorReturnType"] = 1] = "GeneratorReturnType"; + IterationUse2[IterationUse2["AsyncGeneratorReturnType"] = 2] = "AsyncGeneratorReturnType"; + })(IterationUse || (IterationUse = {})); + var IterationTypeKind; + (function(IterationTypeKind2) { + IterationTypeKind2[IterationTypeKind2["Yield"] = 0] = "Yield"; + IterationTypeKind2[IterationTypeKind2["Return"] = 1] = "Return"; + IterationTypeKind2[IterationTypeKind2["Next"] = 2] = "Next"; + })(IterationTypeKind || (IterationTypeKind = {})); + var WideningKind; + (function(WideningKind2) { + WideningKind2[WideningKind2["Normal"] = 0] = "Normal"; + WideningKind2[WideningKind2["FunctionReturn"] = 1] = "FunctionReturn"; + WideningKind2[WideningKind2["GeneratorNext"] = 2] = "GeneratorNext"; + WideningKind2[WideningKind2["GeneratorYield"] = 3] = "GeneratorYield"; + })(WideningKind || (WideningKind = {})); + var TypeFacts; + (function(TypeFacts2) { + TypeFacts2[TypeFacts2["None"] = 0] = "None"; + TypeFacts2[TypeFacts2["TypeofEQString"] = 1] = "TypeofEQString"; + TypeFacts2[TypeFacts2["TypeofEQNumber"] = 2] = "TypeofEQNumber"; + TypeFacts2[TypeFacts2["TypeofEQBigInt"] = 4] = "TypeofEQBigInt"; + TypeFacts2[TypeFacts2["TypeofEQBoolean"] = 8] = "TypeofEQBoolean"; + TypeFacts2[TypeFacts2["TypeofEQSymbol"] = 16] = "TypeofEQSymbol"; + TypeFacts2[TypeFacts2["TypeofEQObject"] = 32] = "TypeofEQObject"; + TypeFacts2[TypeFacts2["TypeofEQFunction"] = 64] = "TypeofEQFunction"; + TypeFacts2[TypeFacts2["TypeofEQHostObject"] = 128] = "TypeofEQHostObject"; + TypeFacts2[TypeFacts2["TypeofNEString"] = 256] = "TypeofNEString"; + TypeFacts2[TypeFacts2["TypeofNENumber"] = 512] = "TypeofNENumber"; + TypeFacts2[TypeFacts2["TypeofNEBigInt"] = 1024] = "TypeofNEBigInt"; + TypeFacts2[TypeFacts2["TypeofNEBoolean"] = 2048] = "TypeofNEBoolean"; + TypeFacts2[TypeFacts2["TypeofNESymbol"] = 4096] = "TypeofNESymbol"; + TypeFacts2[TypeFacts2["TypeofNEObject"] = 8192] = "TypeofNEObject"; + TypeFacts2[TypeFacts2["TypeofNEFunction"] = 16384] = "TypeofNEFunction"; + TypeFacts2[TypeFacts2["TypeofNEHostObject"] = 32768] = "TypeofNEHostObject"; + TypeFacts2[TypeFacts2["EQUndefined"] = 65536] = "EQUndefined"; + TypeFacts2[TypeFacts2["EQNull"] = 131072] = "EQNull"; + TypeFacts2[TypeFacts2["EQUndefinedOrNull"] = 262144] = "EQUndefinedOrNull"; + TypeFacts2[TypeFacts2["NEUndefined"] = 524288] = "NEUndefined"; + TypeFacts2[TypeFacts2["NENull"] = 1048576] = "NENull"; + TypeFacts2[TypeFacts2["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull"; + TypeFacts2[TypeFacts2["Truthy"] = 4194304] = "Truthy"; + TypeFacts2[TypeFacts2["Falsy"] = 8388608] = "Falsy"; + TypeFacts2[TypeFacts2["IsUndefined"] = 16777216] = "IsUndefined"; + TypeFacts2[TypeFacts2["IsNull"] = 33554432] = "IsNull"; + TypeFacts2[TypeFacts2["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull"; + TypeFacts2[TypeFacts2["All"] = 134217727] = "All"; + TypeFacts2[TypeFacts2["BaseStringStrictFacts"] = 3735041] = "BaseStringStrictFacts"; + TypeFacts2[TypeFacts2["BaseStringFacts"] = 12582401] = "BaseStringFacts"; + TypeFacts2[TypeFacts2["StringStrictFacts"] = 16317953] = "StringStrictFacts"; + TypeFacts2[TypeFacts2["StringFacts"] = 16776705] = "StringFacts"; + TypeFacts2[TypeFacts2["EmptyStringStrictFacts"] = 12123649] = "EmptyStringStrictFacts"; + TypeFacts2[TypeFacts2["EmptyStringFacts"] = 12582401] = "EmptyStringFacts"; + TypeFacts2[TypeFacts2["NonEmptyStringStrictFacts"] = 7929345] = "NonEmptyStringStrictFacts"; + TypeFacts2[TypeFacts2["NonEmptyStringFacts"] = 16776705] = "NonEmptyStringFacts"; + TypeFacts2[TypeFacts2["BaseNumberStrictFacts"] = 3734786] = "BaseNumberStrictFacts"; + TypeFacts2[TypeFacts2["BaseNumberFacts"] = 12582146] = "BaseNumberFacts"; + TypeFacts2[TypeFacts2["NumberStrictFacts"] = 16317698] = "NumberStrictFacts"; + TypeFacts2[TypeFacts2["NumberFacts"] = 16776450] = "NumberFacts"; + TypeFacts2[TypeFacts2["ZeroNumberStrictFacts"] = 12123394] = "ZeroNumberStrictFacts"; + TypeFacts2[TypeFacts2["ZeroNumberFacts"] = 12582146] = "ZeroNumberFacts"; + TypeFacts2[TypeFacts2["NonZeroNumberStrictFacts"] = 7929090] = "NonZeroNumberStrictFacts"; + TypeFacts2[TypeFacts2["NonZeroNumberFacts"] = 16776450] = "NonZeroNumberFacts"; + TypeFacts2[TypeFacts2["BaseBigIntStrictFacts"] = 3734276] = "BaseBigIntStrictFacts"; + TypeFacts2[TypeFacts2["BaseBigIntFacts"] = 12581636] = "BaseBigIntFacts"; + TypeFacts2[TypeFacts2["BigIntStrictFacts"] = 16317188] = "BigIntStrictFacts"; + TypeFacts2[TypeFacts2["BigIntFacts"] = 16775940] = "BigIntFacts"; + TypeFacts2[TypeFacts2["ZeroBigIntStrictFacts"] = 12122884] = "ZeroBigIntStrictFacts"; + TypeFacts2[TypeFacts2["ZeroBigIntFacts"] = 12581636] = "ZeroBigIntFacts"; + TypeFacts2[TypeFacts2["NonZeroBigIntStrictFacts"] = 7928580] = "NonZeroBigIntStrictFacts"; + TypeFacts2[TypeFacts2["NonZeroBigIntFacts"] = 16775940] = "NonZeroBigIntFacts"; + TypeFacts2[TypeFacts2["BaseBooleanStrictFacts"] = 3733256] = "BaseBooleanStrictFacts"; + TypeFacts2[TypeFacts2["BaseBooleanFacts"] = 12580616] = "BaseBooleanFacts"; + TypeFacts2[TypeFacts2["BooleanStrictFacts"] = 16316168] = "BooleanStrictFacts"; + TypeFacts2[TypeFacts2["BooleanFacts"] = 16774920] = "BooleanFacts"; + TypeFacts2[TypeFacts2["FalseStrictFacts"] = 12121864] = "FalseStrictFacts"; + TypeFacts2[TypeFacts2["FalseFacts"] = 12580616] = "FalseFacts"; + TypeFacts2[TypeFacts2["TrueStrictFacts"] = 7927560] = "TrueStrictFacts"; + TypeFacts2[TypeFacts2["TrueFacts"] = 16774920] = "TrueFacts"; + TypeFacts2[TypeFacts2["SymbolStrictFacts"] = 7925520] = "SymbolStrictFacts"; + TypeFacts2[TypeFacts2["SymbolFacts"] = 16772880] = "SymbolFacts"; + TypeFacts2[TypeFacts2["ObjectStrictFacts"] = 7888800] = "ObjectStrictFacts"; + TypeFacts2[TypeFacts2["ObjectFacts"] = 16736160] = "ObjectFacts"; + TypeFacts2[TypeFacts2["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts"; + TypeFacts2[TypeFacts2["FunctionFacts"] = 16728e3] = "FunctionFacts"; + TypeFacts2[TypeFacts2["VoidFacts"] = 9830144] = "VoidFacts"; + TypeFacts2[TypeFacts2["UndefinedFacts"] = 26607360] = "UndefinedFacts"; + TypeFacts2[TypeFacts2["NullFacts"] = 42917664] = "NullFacts"; + TypeFacts2[TypeFacts2["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts"; + TypeFacts2[TypeFacts2["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts"; + TypeFacts2[TypeFacts2["UnknownFacts"] = 83886079] = "UnknownFacts"; + TypeFacts2[TypeFacts2["AllTypeofNE"] = 556800] = "AllTypeofNE"; + TypeFacts2[TypeFacts2["OrFactsMask"] = 8256] = "OrFactsMask"; + TypeFacts2[TypeFacts2["AndFactsMask"] = 134209471] = "AndFactsMask"; + })(TypeFacts = ts6.TypeFacts || (ts6.TypeFacts = {})); + var typeofNEFacts = new ts6.Map(ts6.getEntries({ + string: 256, + number: 512, + bigint: 1024, + boolean: 2048, + symbol: 4096, + undefined: 524288, + object: 8192, + function: 16384 + /* TypeFacts.TypeofNEFunction */ + })); + var TypeSystemPropertyName; + (function(TypeSystemPropertyName2) { + TypeSystemPropertyName2[TypeSystemPropertyName2["Type"] = 0] = "Type"; + TypeSystemPropertyName2[TypeSystemPropertyName2["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType"; + TypeSystemPropertyName2[TypeSystemPropertyName2["DeclaredType"] = 2] = "DeclaredType"; + TypeSystemPropertyName2[TypeSystemPropertyName2["ResolvedReturnType"] = 3] = "ResolvedReturnType"; + TypeSystemPropertyName2[TypeSystemPropertyName2["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint"; + TypeSystemPropertyName2[TypeSystemPropertyName2["EnumTagType"] = 5] = "EnumTagType"; + TypeSystemPropertyName2[TypeSystemPropertyName2["ResolvedTypeArguments"] = 6] = "ResolvedTypeArguments"; + TypeSystemPropertyName2[TypeSystemPropertyName2["ResolvedBaseTypes"] = 7] = "ResolvedBaseTypes"; + TypeSystemPropertyName2[TypeSystemPropertyName2["WriteType"] = 8] = "WriteType"; + })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var CheckMode; + (function(CheckMode2) { + CheckMode2[CheckMode2["Normal"] = 0] = "Normal"; + CheckMode2[CheckMode2["Contextual"] = 1] = "Contextual"; + CheckMode2[CheckMode2["Inferential"] = 2] = "Inferential"; + CheckMode2[CheckMode2["SkipContextSensitive"] = 4] = "SkipContextSensitive"; + CheckMode2[CheckMode2["SkipGenericFunctions"] = 8] = "SkipGenericFunctions"; + CheckMode2[CheckMode2["IsForSignatureHelp"] = 16] = "IsForSignatureHelp"; + CheckMode2[CheckMode2["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions"; + CheckMode2[CheckMode2["RestBindingElement"] = 64] = "RestBindingElement"; + })(CheckMode = ts6.CheckMode || (ts6.CheckMode = {})); + var SignatureCheckMode; + (function(SignatureCheckMode2) { + SignatureCheckMode2[SignatureCheckMode2["BivariantCallback"] = 1] = "BivariantCallback"; + SignatureCheckMode2[SignatureCheckMode2["StrictCallback"] = 2] = "StrictCallback"; + SignatureCheckMode2[SignatureCheckMode2["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes"; + SignatureCheckMode2[SignatureCheckMode2["StrictArity"] = 8] = "StrictArity"; + SignatureCheckMode2[SignatureCheckMode2["Callback"] = 3] = "Callback"; + })(SignatureCheckMode = ts6.SignatureCheckMode || (ts6.SignatureCheckMode = {})); + var IntersectionState; + (function(IntersectionState2) { + IntersectionState2[IntersectionState2["None"] = 0] = "None"; + IntersectionState2[IntersectionState2["Source"] = 1] = "Source"; + IntersectionState2[IntersectionState2["Target"] = 2] = "Target"; + })(IntersectionState || (IntersectionState = {})); + var RecursionFlags; + (function(RecursionFlags2) { + RecursionFlags2[RecursionFlags2["None"] = 0] = "None"; + RecursionFlags2[RecursionFlags2["Source"] = 1] = "Source"; + RecursionFlags2[RecursionFlags2["Target"] = 2] = "Target"; + RecursionFlags2[RecursionFlags2["Both"] = 3] = "Both"; + })(RecursionFlags || (RecursionFlags = {})); + var MappedTypeModifiers; + (function(MappedTypeModifiers2) { + MappedTypeModifiers2[MappedTypeModifiers2["IncludeReadonly"] = 1] = "IncludeReadonly"; + MappedTypeModifiers2[MappedTypeModifiers2["ExcludeReadonly"] = 2] = "ExcludeReadonly"; + MappedTypeModifiers2[MappedTypeModifiers2["IncludeOptional"] = 4] = "IncludeOptional"; + MappedTypeModifiers2[MappedTypeModifiers2["ExcludeOptional"] = 8] = "ExcludeOptional"; + })(MappedTypeModifiers || (MappedTypeModifiers = {})); + var ExpandingFlags; + (function(ExpandingFlags2) { + ExpandingFlags2[ExpandingFlags2["None"] = 0] = "None"; + ExpandingFlags2[ExpandingFlags2["Source"] = 1] = "Source"; + ExpandingFlags2[ExpandingFlags2["Target"] = 2] = "Target"; + ExpandingFlags2[ExpandingFlags2["Both"] = 3] = "Both"; + })(ExpandingFlags || (ExpandingFlags = {})); + var MembersOrExportsResolutionKind; + (function(MembersOrExportsResolutionKind2) { + MembersOrExportsResolutionKind2["resolvedExports"] = "resolvedExports"; + MembersOrExportsResolutionKind2["resolvedMembers"] = "resolvedMembers"; + })(MembersOrExportsResolutionKind || (MembersOrExportsResolutionKind = {})); + var UnusedKind; + (function(UnusedKind2) { + UnusedKind2[UnusedKind2["Local"] = 0] = "Local"; + UnusedKind2[UnusedKind2["Parameter"] = 1] = "Parameter"; + })(UnusedKind || (UnusedKind = {})); + var isNotOverloadAndNotAccessor = ts6.and(isNotOverload, isNotAccessor); + var DeclarationMeaning; + (function(DeclarationMeaning2) { + DeclarationMeaning2[DeclarationMeaning2["GetAccessor"] = 1] = "GetAccessor"; + DeclarationMeaning2[DeclarationMeaning2["SetAccessor"] = 2] = "SetAccessor"; + DeclarationMeaning2[DeclarationMeaning2["PropertyAssignment"] = 4] = "PropertyAssignment"; + DeclarationMeaning2[DeclarationMeaning2["Method"] = 8] = "Method"; + DeclarationMeaning2[DeclarationMeaning2["PrivateStatic"] = 16] = "PrivateStatic"; + DeclarationMeaning2[DeclarationMeaning2["GetOrSetAccessor"] = 3] = "GetOrSetAccessor"; + DeclarationMeaning2[DeclarationMeaning2["PropertyAssignmentOrMethod"] = 12] = "PropertyAssignmentOrMethod"; + })(DeclarationMeaning || (DeclarationMeaning = {})); + var DeclarationSpaces; + (function(DeclarationSpaces2) { + DeclarationSpaces2[DeclarationSpaces2["None"] = 0] = "None"; + DeclarationSpaces2[DeclarationSpaces2["ExportValue"] = 1] = "ExportValue"; + DeclarationSpaces2[DeclarationSpaces2["ExportType"] = 2] = "ExportType"; + DeclarationSpaces2[DeclarationSpaces2["ExportNamespace"] = 4] = "ExportNamespace"; + })(DeclarationSpaces || (DeclarationSpaces = {})); + var MinArgumentCountFlags; + (function(MinArgumentCountFlags2) { + MinArgumentCountFlags2[MinArgumentCountFlags2["None"] = 0] = "None"; + MinArgumentCountFlags2[MinArgumentCountFlags2["StrongArityForUntypedJS"] = 1] = "StrongArityForUntypedJS"; + MinArgumentCountFlags2[MinArgumentCountFlags2["VoidIsNonOptional"] = 2] = "VoidIsNonOptional"; + })(MinArgumentCountFlags || (MinArgumentCountFlags = {})); + var IntrinsicTypeKind; + (function(IntrinsicTypeKind2) { + IntrinsicTypeKind2[IntrinsicTypeKind2["Uppercase"] = 0] = "Uppercase"; + IntrinsicTypeKind2[IntrinsicTypeKind2["Lowercase"] = 1] = "Lowercase"; + IntrinsicTypeKind2[IntrinsicTypeKind2["Capitalize"] = 2] = "Capitalize"; + IntrinsicTypeKind2[IntrinsicTypeKind2["Uncapitalize"] = 3] = "Uncapitalize"; + })(IntrinsicTypeKind || (IntrinsicTypeKind = {})); + var intrinsicTypeKinds = new ts6.Map(ts6.getEntries({ + Uppercase: 0, + Lowercase: 1, + Capitalize: 2, + Uncapitalize: 3 + /* IntrinsicTypeKind.Uncapitalize */ + })); + function SymbolLinks() { + } + function NodeLinks() { + this.flags = 0; + } + function getNodeId(node) { + if (!node.id) { + node.id = nextNodeId2; + nextNodeId2++; + } + return node.id; + } + ts6.getNodeId = getNodeId; + function getSymbolId(symbol) { + if (!symbol.id) { + symbol.id = nextSymbolId; + nextSymbolId++; + } + return symbol.id; + } + ts6.getSymbolId = getSymbolId; + function isInstantiatedModule(node, preserveConstEnums) { + var moduleState = ts6.getModuleInstanceState(node); + return moduleState === 1 || preserveConstEnums && moduleState === 2; + } + ts6.isInstantiatedModule = isInstantiatedModule; + function createTypeChecker(host) { + var getPackagesMap = ts6.memoize(function() { + var map = new ts6.Map(); + host.getSourceFiles().forEach(function(sf) { + if (!sf.resolvedModules) + return; + sf.resolvedModules.forEach(function(r) { + if (r && r.packageId) + map.set(r.packageId.name, r.extension === ".d.ts" || !!map.get(r.packageId.name)); + }); + }); + return map; + }); + var deferredDiagnosticsCallbacks = []; + var addLazyDiagnostic = function(arg) { + deferredDiagnosticsCallbacks.push(arg); + }; + var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; + var Symbol2 = ts6.objectAllocator.getSymbolConstructor(); + var Type = ts6.objectAllocator.getTypeConstructor(); + var Signature = ts6.objectAllocator.getSignatureConstructor(); + var typeCount = 0; + var symbolCount = 0; + var enumCount = 0; + var totalInstantiationCount = 0; + var instantiationCount = 0; + var instantiationDepth = 0; + var inlineLevel = 0; + var currentNode; + var varianceTypeParameter; + var emptySymbols = ts6.createSymbolTable(); + var arrayVariances = [ + 1 + /* VarianceFlags.Covariant */ + ]; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + var useDefineForClassFields = ts6.getUseDefineForClassFields(compilerOptions); + var allowSyntheticDefaultImports = ts6.getAllowSyntheticDefaultImports(compilerOptions); + var strictNullChecks = ts6.getStrictOptionValue(compilerOptions, "strictNullChecks"); + var strictFunctionTypes = ts6.getStrictOptionValue(compilerOptions, "strictFunctionTypes"); + var strictBindCallApply = ts6.getStrictOptionValue(compilerOptions, "strictBindCallApply"); + var strictPropertyInitialization = ts6.getStrictOptionValue(compilerOptions, "strictPropertyInitialization"); + var noImplicitAny = ts6.getStrictOptionValue(compilerOptions, "noImplicitAny"); + var noImplicitThis = ts6.getStrictOptionValue(compilerOptions, "noImplicitThis"); + var useUnknownInCatchVariables = ts6.getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables"); + var keyofStringsOnly = !!compilerOptions.keyofStringsOnly; + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192; + var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes; + var checkBinaryExpression = createCheckBinaryExpression(); + var emitResolver = createResolver(); + var nodeBuilder = createNodeBuilder(); + var globals = ts6.createSymbolTable(); + var undefinedSymbol = createSymbol(4, "undefined"); + undefinedSymbol.declarations = []; + var globalThisSymbol = createSymbol( + 1536, + "globalThis", + 8 + /* CheckFlags.Readonly */ + ); + globalThisSymbol.exports = globals; + globalThisSymbol.declarations = []; + globals.set(globalThisSymbol.escapedName, globalThisSymbol); + var argumentsSymbol = createSymbol(4, "arguments"); + var requireSymbol = createSymbol(4, "require"); + var apparentArgumentCount; + var checker = { + getNodeCount: function() { + return ts6.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function() { + return ts6.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function() { + return ts6.sum(host.getSourceFiles(), "symbolCount") + symbolCount; + }, + getTypeCount: function() { + return typeCount; + }, + getInstantiationCount: function() { + return totalInstantiationCount; + }, + getRelationCacheSizes: function() { + return { + assignable: assignableRelation.size, + identity: identityRelation.size, + subtype: subtypeRelation.size, + strictSubtype: strictSubtypeRelation.size + }; + }, + isUndefinedSymbol: function(symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function(symbol) { + return symbol === argumentsSymbol; + }, + isUnknownSymbol: function(symbol) { + return symbol === unknownSymbol; + }, + getMergedSymbol, + getDiagnostics, + getGlobalDiagnostics, + getRecursionIdentity, + getUnmatchedProperties, + getTypeOfSymbolAtLocation: function(symbol, locationIn) { + var location = ts6.getParseTreeNode(locationIn); + return location ? getTypeOfSymbolAtLocation(symbol, location) : errorType; + }, + getTypeOfSymbol, + getSymbolsOfParameterPropertyDeclaration: function(parameterIn, parameterName) { + var parameter = ts6.getParseTreeNode(parameterIn, ts6.isParameter); + if (parameter === void 0) + return ts6.Debug.fail("Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, ts6.escapeLeadingUnderscores(parameterName)); + }, + getDeclaredTypeOfSymbol, + getPropertiesOfType, + getPropertyOfType: function(type, name) { + return getPropertyOfType(type, ts6.escapeLeadingUnderscores(name)); + }, + getPrivateIdentifierPropertyOfType: function(leftType, name, location) { + var node = ts6.getParseTreeNode(location); + if (!node) { + return void 0; + } + var propName = ts6.escapeLeadingUnderscores(name); + var lexicallyScopedIdentifier = lookupSymbolForPrivateIdentifierDeclaration(propName, node); + return lexicallyScopedIdentifier ? getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedIdentifier) : void 0; + }, + getTypeOfPropertyOfType: function(type, name) { + return getTypeOfPropertyOfType(type, ts6.escapeLeadingUnderscores(name)); + }, + getIndexInfoOfType: function(type, kind) { + return getIndexInfoOfType(type, kind === 0 ? stringType : numberType); + }, + getIndexInfosOfType, + getIndexInfosOfIndexSymbol, + getSignaturesOfType, + getIndexTypeOfType: function(type, kind) { + return getIndexTypeOfType(type, kind === 0 ? stringType : numberType); + }, + getIndexType: function(type) { + return getIndexType(type); + }, + getBaseTypes, + getBaseTypeOfLiteralType, + getWidenedType, + getTypeFromTypeNode: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isTypeNode); + return node ? getTypeFromTypeNode(node) : errorType; + }, + getParameterType: getTypeAtPosition, + getParameterIdentifierNameAtPosition, + getPromisedTypeOfPromise, + getAwaitedType: function(type) { + return getAwaitedType(type); + }, + getReturnTypeOfSignature, + isNullableType, + getNullableType, + getNonNullableType, + getNonOptionalType: removeOptionalTypeMarker, + getTypeArguments, + typeToTypeNode: nodeBuilder.typeToTypeNode, + indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, + signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, + symbolToEntityName: nodeBuilder.symbolToEntityName, + symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, + symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, + symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, + typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, + getSymbolsInScope: function(locationIn, meaning) { + var location = ts6.getParseTreeNode(locationIn); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? getSymbolAtLocation( + node, + /*ignoreErrors*/ + true + ) : void 0; + }, + getIndexInfosAtLocation: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? getIndexInfosAtLocation(node) : void 0; + }, + getShorthandAssignmentValueSymbol: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? getShorthandAssignmentValueSymbol(node) : void 0; + }, + getExportSpecifierLocalTargetSymbol: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : void 0; + }, + getExportSymbolOfSymbol: function(symbol) { + return getMergedSymbol(symbol.exportSymbol || symbol); + }, + getTypeAtLocation: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? getTypeOfNode(node) : errorType; + }, + getTypeOfAssignmentPattern: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isAssignmentPattern); + return node && getTypeOfAssignmentPattern(node) || errorType; + }, + getPropertySymbolOfDestructuringAssignment: function(locationIn) { + var location = ts6.getParseTreeNode(locationIn, ts6.isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : void 0; + }, + signatureToString: function(signature, enclosingDeclaration, flags, kind) { + return signatureToString(signature, ts6.getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: function(type, enclosingDeclaration, flags) { + return typeToString(type, ts6.getParseTreeNode(enclosingDeclaration), flags); + }, + symbolToString: function(symbol, enclosingDeclaration, meaning, flags) { + return symbolToString(symbol, ts6.getParseTreeNode(enclosingDeclaration), meaning, flags); + }, + typePredicateToString: function(predicate, enclosingDeclaration, flags) { + return typePredicateToString(predicate, ts6.getParseTreeNode(enclosingDeclaration), flags); + }, + writeSignature: function(signature, enclosingDeclaration, flags, kind, writer) { + return signatureToString(signature, ts6.getParseTreeNode(enclosingDeclaration), flags, kind, writer); + }, + writeType: function(type, enclosingDeclaration, flags, writer) { + return typeToString(type, ts6.getParseTreeNode(enclosingDeclaration), flags, writer); + }, + writeSymbol: function(symbol, enclosingDeclaration, meaning, flags, writer) { + return symbolToString(symbol, ts6.getParseTreeNode(enclosingDeclaration), meaning, flags, writer); + }, + writeTypePredicate: function(predicate, enclosingDeclaration, flags, writer) { + return typePredicateToString(predicate, ts6.getParseTreeNode(enclosingDeclaration), flags, writer); + }, + getAugmentedPropertiesOfType, + getRootSymbols, + getSymbolOfExpando, + getContextualType: function(nodeIn, contextFlags) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isExpression); + if (!node) { + return void 0; + } + if (contextFlags & 4) { + return runWithInferenceBlockedFromSourceNode(node, function() { + return getContextualType(node, contextFlags); + }); + } + return getContextualType(node, contextFlags); + }, + getContextualTypeForObjectLiteralElement: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isObjectLiteralElementLike); + return node ? getContextualTypeForObjectLiteralElement( + node, + /*contextFlags*/ + void 0 + ) : void 0; + }, + getContextualTypeForArgumentAtIndex: function(nodeIn, argIndex) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isCallLikeExpression); + return node && getContextualTypeForArgumentAtIndex(node, argIndex); + }, + getContextualTypeForJsxAttribute: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isJsxAttributeLike); + return node && getContextualTypeForJsxAttribute( + node, + /*contextFlags*/ + void 0 + ); + }, + isContextSensitive, + getTypeOfPropertyOfContextualType, + getFullyQualifiedName, + getResolvedSignature: function(node, candidatesOutArray, argumentCount) { + return getResolvedSignatureWorker( + node, + candidatesOutArray, + argumentCount, + 0 + /* CheckMode.Normal */ + ); + }, + getResolvedSignatureForStringLiteralCompletions: function(call, editingArgument, candidatesOutArray) { + return getResolvedSignatureWorker( + call, + candidatesOutArray, + /*argumentCount*/ + void 0, + 32, + editingArgument + ); + }, + getResolvedSignatureForSignatureHelp: function(node, candidatesOutArray, argumentCount) { + return getResolvedSignatureWorker( + node, + candidatesOutArray, + argumentCount, + 16 + /* CheckMode.IsForSignatureHelp */ + ); + }, + getExpandedParameters, + hasEffectiveRestParameter, + containsArgumentsReference, + getConstantValue: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, canHaveConstantValue); + return node ? getConstantValue(node) : void 0; + }, + isValidPropertyAccess: function(nodeIn, propertyName) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isPropertyAccessOrQualifiedNameOrImportTypeNode); + return !!node && isValidPropertyAccess(node, ts6.escapeLeadingUnderscores(propertyName)); + }, + isValidPropertyAccessForCompletions: function(nodeIn, type, property) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isPropertyAccessExpression); + return !!node && isValidPropertyAccessForCompletions(node, type, property); + }, + getSignatureFromDeclaration: function(declarationIn) { + var declaration = ts6.getParseTreeNode(declarationIn, ts6.isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : void 0; + }, + isImplementationOfOverload: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isFunctionLike); + return node ? isImplementationOfOverload(node) : void 0; + }, + getImmediateAliasedSymbol, + getAliasedSymbol: resolveAlias, + getEmitResolver, + getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule, + forEachExportAndPropertyOfModule, + getSymbolWalker: ts6.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, ts6.getFirstIdentifier, getTypeArguments), + getAmbientModules, + getJsxIntrinsicTagNamesAt, + isOptionalParameter: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isParameter); + return node ? isOptionalParameter(node) : false; + }, + tryGetMemberInModuleExports: function(name, symbol) { + return tryGetMemberInModuleExports(ts6.escapeLeadingUnderscores(name), symbol); + }, + tryGetMemberInModuleExportsAndProperties: function(name, symbol) { + return tryGetMemberInModuleExportsAndProperties(ts6.escapeLeadingUnderscores(name), symbol); + }, + tryFindAmbientModule: function(moduleName) { + return tryFindAmbientModule( + moduleName, + /*withAugmentations*/ + true + ); + }, + tryFindAmbientModuleWithoutAugmentations: function(moduleName) { + return tryFindAmbientModule( + moduleName, + /*withAugmentations*/ + false + ); + }, + getApparentType, + getUnionType, + isTypeAssignableTo, + createAnonymousType, + createSignature, + createSymbol, + createIndexInfo, + getAnyType: function() { + return anyType; + }, + getStringType: function() { + return stringType; + }, + getNumberType: function() { + return numberType; + }, + createPromiseType, + createArrayType, + getElementTypeOfArrayType, + getBooleanType: function() { + return booleanType; + }, + getFalseType: function(fresh) { + return fresh ? falseType : regularFalseType; + }, + getTrueType: function(fresh) { + return fresh ? trueType : regularTrueType; + }, + getVoidType: function() { + return voidType; + }, + getUndefinedType: function() { + return undefinedType; + }, + getNullType: function() { + return nullType; + }, + getESSymbolType: function() { + return esSymbolType; + }, + getNeverType: function() { + return neverType; + }, + getOptionalType: function() { + return optionalType; + }, + getPromiseType: function() { + return getGlobalPromiseType( + /*reportErrors*/ + false + ); + }, + getPromiseLikeType: function() { + return getGlobalPromiseLikeType( + /*reportErrors*/ + false + ); + }, + getAsyncIterableType: function() { + var type = getGlobalAsyncIterableType( + /*reportErrors*/ + false + ); + if (type === emptyGenericType) + return void 0; + return type; + }, + isSymbolAccessible, + isArrayType, + isTupleType, + isArrayLikeType, + isTypeInvalidDueToUnionDiscriminant, + getExactOptionalProperties, + getAllPossiblePropertiesOfTypes, + getSuggestedSymbolForNonexistentProperty, + getSuggestionForNonexistentProperty, + getSuggestedSymbolForNonexistentJSXAttribute, + getSuggestedSymbolForNonexistentSymbol: function(location, name, meaning) { + return getSuggestedSymbolForNonexistentSymbol(location, ts6.escapeLeadingUnderscores(name), meaning); + }, + getSuggestionForNonexistentSymbol: function(location, name, meaning) { + return getSuggestionForNonexistentSymbol(location, ts6.escapeLeadingUnderscores(name), meaning); + }, + getSuggestedSymbolForNonexistentModule, + getSuggestionForNonexistentExport, + getSuggestedSymbolForNonexistentClassMember, + getBaseConstraintOfType, + getDefaultFromTypeParameter: function(type) { + return type && type.flags & 262144 ? getDefaultFromTypeParameter(type) : void 0; + }, + resolveName: function(name, location, meaning, excludeGlobals) { + return resolveName( + location, + ts6.escapeLeadingUnderscores(name), + meaning, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false, + excludeGlobals + ); + }, + getJsxNamespace: function(n) { + return ts6.unescapeLeadingUnderscores(getJsxNamespace(n)); + }, + getJsxFragmentFactory: function(n) { + var jsxFragmentFactory = getJsxFragmentFactoryEntity(n); + return jsxFragmentFactory && ts6.unescapeLeadingUnderscores(ts6.getFirstIdentifier(jsxFragmentFactory).escapedText); + }, + getAccessibleSymbolChain, + getTypePredicateOfSignature, + resolveExternalModuleName: function(moduleSpecifierIn) { + var moduleSpecifier = ts6.getParseTreeNode(moduleSpecifierIn, ts6.isExpression); + return moduleSpecifier && resolveExternalModuleName( + moduleSpecifier, + moduleSpecifier, + /*ignoreErrors*/ + true + ); + }, + resolveExternalModuleSymbol, + tryGetThisTypeAt: function(nodeIn, includeGlobalThis, container) { + var node = ts6.getParseTreeNode(nodeIn); + return node && tryGetThisTypeAt(node, includeGlobalThis, container); + }, + getTypeArgumentConstraint: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isTypeNode); + return node && getTypeArgumentConstraint(node); + }, + getSuggestionDiagnostics: function(fileIn, ct) { + var file = ts6.getParseTreeNode(fileIn, ts6.isSourceFile) || ts6.Debug.fail("Could not determine parsed source file."); + if (ts6.skipTypeChecking(file, compilerOptions, host)) { + return ts6.emptyArray; + } + var diagnostics2; + try { + cancellationToken = ct; + checkSourceFileWithEagerDiagnostics(file); + ts6.Debug.assert(!!(getNodeLinks(file).flags & 1)); + diagnostics2 = ts6.addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName)); + checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function(containingNode, kind, diag) { + if (!ts6.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216))) { + (diagnostics2 || (diagnostics2 = [])).push(__assign(__assign({}, diag), { category: ts6.DiagnosticCategory.Suggestion })); + } + }); + return diagnostics2 || ts6.emptyArray; + } finally { + cancellationToken = void 0; + } + }, + runWithCancellationToken: function(token, callback) { + try { + cancellationToken = token; + return callback(checker); + } finally { + cancellationToken = void 0; + } + }, + getLocalTypeParametersOfClassOrInterfaceOrTypeAlias, + isDeclarationVisible, + isPropertyAccessible, + getTypeOnlyAliasDeclaration, + getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced + }; + function runWithInferenceBlockedFromSourceNode(node, fn) { + var containingCall = ts6.findAncestor(node, ts6.isCallLikeExpression); + var containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature; + if (containingCall) { + var toMarkSkip = node; + do { + getNodeLinks(toMarkSkip).skipDirectInference = true; + toMarkSkip = toMarkSkip.parent; + } while (toMarkSkip && toMarkSkip !== containingCall); + getNodeLinks(containingCall).resolvedSignature = void 0; + } + var result = fn(); + if (containingCall) { + var toMarkSkip = node; + do { + getNodeLinks(toMarkSkip).skipDirectInference = void 0; + toMarkSkip = toMarkSkip.parent; + } while (toMarkSkip && toMarkSkip !== containingCall); + getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature; + } + return result; + } + function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isCallLikeExpression); + apparentArgumentCount = argumentCount; + var res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, function() { + return getResolvedSignature(node, candidatesOutArray, checkMode); + }) : getResolvedSignature(node, candidatesOutArray, checkMode); + apparentArgumentCount = void 0; + return res; + } + var tupleTypes = new ts6.Map(); + var unionTypes = new ts6.Map(); + var intersectionTypes = new ts6.Map(); + var stringLiteralTypes = new ts6.Map(); + var numberLiteralTypes = new ts6.Map(); + var bigIntLiteralTypes = new ts6.Map(); + var enumLiteralTypes = new ts6.Map(); + var indexedAccessTypes = new ts6.Map(); + var templateLiteralTypes = new ts6.Map(); + var stringMappingTypes = new ts6.Map(); + var substitutionTypes = new ts6.Map(); + var subtypeReductionCache = new ts6.Map(); + var cachedTypes = new ts6.Map(); + var evolvingArrayTypes = []; + var undefinedProperties = new ts6.Map(); + var markerTypes = new ts6.Set(); + var unknownSymbol = createSymbol(4, "unknown"); + var resolvingSymbol = createSymbol( + 0, + "__resolving__" + /* InternalSymbolName.Resolving */ + ); + var unresolvedSymbols = new ts6.Map(); + var errorTypes = new ts6.Map(); + var anyType = createIntrinsicType(1, "any"); + var autoType = createIntrinsicType( + 1, + "any", + 262144 + /* ObjectFlags.NonInferrableType */ + ); + var wildcardType = createIntrinsicType(1, "any"); + var errorType = createIntrinsicType(1, "error"); + var unresolvedType = createIntrinsicType(1, "unresolved"); + var nonInferrableAnyType = createIntrinsicType( + 1, + "any", + 65536 + /* ObjectFlags.ContainsWideningType */ + ); + var intrinsicMarkerType = createIntrinsicType(1, "intrinsic"); + var unknownType = createIntrinsicType(2, "unknown"); + var nonNullUnknownType = createIntrinsicType(2, "unknown"); + var undefinedType = createIntrinsicType(32768, "undefined"); + var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType( + 32768, + "undefined", + 65536 + /* ObjectFlags.ContainsWideningType */ + ); + var optionalType = createIntrinsicType(32768, "undefined"); + var missingType = exactOptionalPropertyTypes ? createIntrinsicType(32768, "undefined") : undefinedType; + var nullType = createIntrinsicType(65536, "null"); + var nullWideningType = strictNullChecks ? nullType : createIntrinsicType( + 65536, + "null", + 65536 + /* ObjectFlags.ContainsWideningType */ + ); + var stringType = createIntrinsicType(4, "string"); + var numberType = createIntrinsicType(8, "number"); + var bigintType = createIntrinsicType(64, "bigint"); + var falseType = createIntrinsicType(512, "false"); + var regularFalseType = createIntrinsicType(512, "false"); + var trueType = createIntrinsicType(512, "true"); + var regularTrueType = createIntrinsicType(512, "true"); + trueType.regularType = regularTrueType; + trueType.freshType = trueType; + regularTrueType.regularType = regularTrueType; + regularTrueType.freshType = trueType; + falseType.regularType = regularFalseType; + falseType.freshType = falseType; + regularFalseType.regularType = regularFalseType; + regularFalseType.freshType = falseType; + var booleanType = getUnionType([regularFalseType, regularTrueType]); + var esSymbolType = createIntrinsicType(4096, "symbol"); + var voidType = createIntrinsicType(16384, "void"); + var neverType = createIntrinsicType(131072, "never"); + var silentNeverType = createIntrinsicType( + 131072, + "never", + 262144 + /* ObjectFlags.NonInferrableType */ + ); + var implicitNeverType = createIntrinsicType(131072, "never"); + var unreachableNeverType = createIntrinsicType(131072, "never"); + var nonPrimitiveType = createIntrinsicType(67108864, "object"); + var stringOrNumberType = getUnionType([stringType, numberType]); + var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]); + var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType; + var numberOrBigIntType = getUnionType([numberType, bigintType]); + var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]); + var numericStringType = getTemplateLiteralType(["", ""], [numberType]); + var restrictiveMapper = makeFunctionTypeMapper(function(t) { + return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; + }, function() { + return "(restrictive mapper)"; + }); + var permissiveMapper = makeFunctionTypeMapper(function(t) { + return t.flags & 262144 ? wildcardType : t; + }, function() { + return "(permissive mapper)"; + }); + var uniqueLiteralType = createIntrinsicType(131072, "never"); + var uniqueLiteralMapper = makeFunctionTypeMapper(function(t) { + return t.flags & 262144 ? uniqueLiteralType : t; + }, function() { + return "(unique literal mapper)"; + }); + var outofbandVarianceMarkerHandler; + var reportUnreliableMapper = makeFunctionTypeMapper(function(t) { + if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) { + outofbandVarianceMarkerHandler( + /*onlyUnreliable*/ + true + ); + } + return t; + }, function() { + return "(unmeasurable reporter)"; + }); + var reportUnmeasurableMapper = makeFunctionTypeMapper(function(t) { + if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) { + outofbandVarianceMarkerHandler( + /*onlyUnreliable*/ + false + ); + } + return t; + }, function() { + return "(unreliable reporter)"; + }); + var emptyObjectType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + emptyJsxObjectType.objectFlags |= 2048; + var emptyTypeLiteralSymbol = createSymbol( + 2048, + "__type" + /* InternalSymbolName.Type */ + ); + emptyTypeLiteralSymbol.members = ts6.createSymbolTable(); + var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; + var emptyGenericType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + emptyGenericType.instantiations = new ts6.Map(); + var anyFunctionType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + anyFunctionType.objectFlags |= 262144; + var noConstraintType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var circularConstraintType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var resolvingDefaultType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var markerSuperType = createTypeParameter(); + var markerSubType = createTypeParameter(); + markerSubType.constraint = markerSuperType; + var markerOtherType = createTypeParameter(); + var markerSuperTypeForCheck = createTypeParameter(); + var markerSubTypeForCheck = createTypeParameter(); + markerSubTypeForCheck.constraint = markerSuperTypeForCheck; + var noTypePredicate = createTypePredicate(1, "<>", 0, anyType); + var anySignature = createSignature( + void 0, + void 0, + void 0, + ts6.emptyArray, + anyType, + /*resolvedTypePredicate*/ + void 0, + 0, + 0 + /* SignatureFlags.None */ + ); + var unknownSignature = createSignature( + void 0, + void 0, + void 0, + ts6.emptyArray, + errorType, + /*resolvedTypePredicate*/ + void 0, + 0, + 0 + /* SignatureFlags.None */ + ); + var resolvingSignature = createSignature( + void 0, + void 0, + void 0, + ts6.emptyArray, + anyType, + /*resolvedTypePredicate*/ + void 0, + 0, + 0 + /* SignatureFlags.None */ + ); + var silentNeverSignature = createSignature( + void 0, + void 0, + void 0, + ts6.emptyArray, + silentNeverType, + /*resolvedTypePredicate*/ + void 0, + 0, + 0 + /* SignatureFlags.None */ + ); + var enumNumberIndexInfo = createIndexInfo( + numberType, + stringType, + /*isReadonly*/ + true + ); + var iterationTypesCache = new ts6.Map(); + var noIterationTypes = { + get yieldType() { + return ts6.Debug.fail("Not supported"); + }, + get returnType() { + return ts6.Debug.fail("Not supported"); + }, + get nextType() { + return ts6.Debug.fail("Not supported"); + } + }; + var anyIterationTypes = createIterationTypes(anyType, anyType, anyType); + var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType); + var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType); + var asyncIterationTypesResolver = { + iterableCacheKey: "iterationTypesOfAsyncIterable", + iteratorCacheKey: "iterationTypesOfAsyncIterator", + iteratorSymbolName: "asyncIterator", + getGlobalIteratorType: getGlobalAsyncIteratorType, + getGlobalIterableType: getGlobalAsyncIterableType, + getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType, + getGlobalGeneratorType: getGlobalAsyncGeneratorType, + resolveIterationType: getAwaitedType, + mustHaveANextMethodDiagnostic: ts6.Diagnostics.An_async_iterator_must_have_a_next_method, + mustBeAMethodDiagnostic: ts6.Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method, + mustHaveAValueDiagnostic: ts6.Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + }; + var syncIterationTypesResolver = { + iterableCacheKey: "iterationTypesOfIterable", + iteratorCacheKey: "iterationTypesOfIterator", + iteratorSymbolName: "iterator", + getGlobalIteratorType, + getGlobalIterableType, + getGlobalIterableIteratorType, + getGlobalGeneratorType, + resolveIterationType: function(type, _errorNode) { + return type; + }, + mustHaveANextMethodDiagnostic: ts6.Diagnostics.An_iterator_must_have_a_next_method, + mustBeAMethodDiagnostic: ts6.Diagnostics.The_0_property_of_an_iterator_must_be_a_method, + mustHaveAValueDiagnostic: ts6.Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property + }; + var amalgamatedDuplicates; + var reverseMappedCache = new ts6.Map(); + var inInferTypeForHomomorphicMappedType = false; + var ambientModulesCache; + var patternAmbientModules; + var patternAmbientModuleAugmentations; + var globalObjectType; + var globalFunctionType; + var globalCallableFunctionType; + var globalNewableFunctionType; + var globalArrayType; + var globalReadonlyArrayType; + var globalStringType; + var globalNumberType; + var globalBooleanType; + var globalRegExpType; + var globalThisType; + var anyArrayType; + var autoArrayType; + var anyReadonlyArrayType; + var deferredGlobalNonNullableTypeAlias; + var deferredGlobalESSymbolConstructorSymbol; + var deferredGlobalESSymbolConstructorTypeSymbol; + var deferredGlobalESSymbolType; + var deferredGlobalTypedPropertyDescriptorType; + var deferredGlobalPromiseType; + var deferredGlobalPromiseLikeType; + var deferredGlobalPromiseConstructorSymbol; + var deferredGlobalPromiseConstructorLikeType; + var deferredGlobalIterableType; + var deferredGlobalIteratorType; + var deferredGlobalIterableIteratorType; + var deferredGlobalGeneratorType; + var deferredGlobalIteratorYieldResultType; + var deferredGlobalIteratorReturnResultType; + var deferredGlobalAsyncIterableType; + var deferredGlobalAsyncIteratorType; + var deferredGlobalAsyncIterableIteratorType; + var deferredGlobalAsyncGeneratorType; + var deferredGlobalTemplateStringsArrayType; + var deferredGlobalImportMetaType; + var deferredGlobalImportMetaExpressionType; + var deferredGlobalImportCallOptionsType; + var deferredGlobalExtractSymbol; + var deferredGlobalOmitSymbol; + var deferredGlobalAwaitedSymbol; + var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; + var allPotentiallyUnusedIdentifiers = new ts6.Map(); + var flowLoopStart = 0; + var flowLoopCount = 0; + var sharedFlowCount = 0; + var flowAnalysisDisabled = false; + var flowInvocationCount = 0; + var lastFlowNode; + var lastFlowNodeReachable; + var flowTypeCache; + var emptyStringType = getStringLiteralType(""); + var zeroType = getNumberLiteralType(0); + var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" }); + var resolutionTargets = []; + var resolutionResults = []; + var resolutionPropertyNames = []; + var suggestionCount = 0; + var maximumSuggestionCount = 10; + var mergedSymbols = []; + var symbolLinks = []; + var nodeLinks = []; + var flowLoopCaches = []; + var flowLoopNodes = []; + var flowLoopKeys = []; + var flowLoopTypes = []; + var sharedFlowNodes = []; + var sharedFlowTypes = []; + var flowNodeReachable = []; + var flowNodePostSuper = []; + var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; + var potentialWeakMapSetCollisions = []; + var potentialReflectCollisions = []; + var potentialUnusedRenamedBindingElementsInTypes = []; + var awaitedTypeStack = []; + var diagnostics = ts6.createDiagnosticCollection(); + var suggestionDiagnostics = ts6.createDiagnosticCollection(); + var typeofType = createTypeofType(); + var _jsxNamespace; + var _jsxFactoryEntity; + var subtypeRelation = new ts6.Map(); + var strictSubtypeRelation = new ts6.Map(); + var assignableRelation = new ts6.Map(); + var comparableRelation = new ts6.Map(); + var identityRelation = new ts6.Map(); + var enumRelation = new ts6.Map(); + var builtinGlobals = ts6.createSymbolTable(); + builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); + var suggestedExtensions = [ + [".mts", ".mjs"], + [".ts", ".js"], + [".cts", ".cjs"], + [".mjs", ".mjs"], + [".js", ".js"], + [".cjs", ".cjs"], + [".tsx", compilerOptions.jsx === 1 ? ".jsx" : ".js"], + [".jsx", ".jsx"], + [".json", ".json"] + ]; + initializeTypeChecker(); + return checker; + function getCachedType(key) { + return key ? cachedTypes.get(key) : void 0; + } + function setCachedType(key, type) { + if (key) + cachedTypes.set(key, type); + return type; + } + function getJsxNamespace(location) { + if (location) { + var file = ts6.getSourceFileOfNode(location); + if (file) { + if (ts6.isJsxOpeningFragment(location)) { + if (file.localJsxFragmentNamespace) { + return file.localJsxFragmentNamespace; + } + var jsxFragmentPragma = file.pragmas.get("jsxfrag"); + if (jsxFragmentPragma) { + var chosenPragma = ts6.isArray(jsxFragmentPragma) ? jsxFragmentPragma[0] : jsxFragmentPragma; + file.localJsxFragmentFactory = ts6.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion); + ts6.visitNode(file.localJsxFragmentFactory, markAsSynthetic); + if (file.localJsxFragmentFactory) { + return file.localJsxFragmentNamespace = ts6.getFirstIdentifier(file.localJsxFragmentFactory).escapedText; + } + } + var entity = getJsxFragmentFactoryEntity(location); + if (entity) { + file.localJsxFragmentFactory = entity; + return file.localJsxFragmentNamespace = ts6.getFirstIdentifier(entity).escapedText; + } + } else { + var localJsxNamespace = getLocalJsxNamespace(file); + if (localJsxNamespace) { + return file.localJsxNamespace = localJsxNamespace; + } + } + } + } + if (!_jsxNamespace) { + _jsxNamespace = "React"; + if (compilerOptions.jsxFactory) { + _jsxFactoryEntity = ts6.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion); + ts6.visitNode(_jsxFactoryEntity, markAsSynthetic); + if (_jsxFactoryEntity) { + _jsxNamespace = ts6.getFirstIdentifier(_jsxFactoryEntity).escapedText; + } + } else if (compilerOptions.reactNamespace) { + _jsxNamespace = ts6.escapeLeadingUnderscores(compilerOptions.reactNamespace); + } + } + if (!_jsxFactoryEntity) { + _jsxFactoryEntity = ts6.factory.createQualifiedName(ts6.factory.createIdentifier(ts6.unescapeLeadingUnderscores(_jsxNamespace)), "createElement"); + } + return _jsxNamespace; + } + function getLocalJsxNamespace(file) { + if (file.localJsxNamespace) { + return file.localJsxNamespace; + } + var jsxPragma = file.pragmas.get("jsx"); + if (jsxPragma) { + var chosenPragma = ts6.isArray(jsxPragma) ? jsxPragma[0] : jsxPragma; + file.localJsxFactory = ts6.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion); + ts6.visitNode(file.localJsxFactory, markAsSynthetic); + if (file.localJsxFactory) { + return file.localJsxNamespace = ts6.getFirstIdentifier(file.localJsxFactory).escapedText; + } + } + } + function markAsSynthetic(node) { + ts6.setTextRangePosEnd(node, -1, -1); + return ts6.visitEachChild(node, markAsSynthetic, ts6.nullTransformationContext); + } + function getEmitResolver(sourceFile, cancellationToken2) { + getDiagnostics(sourceFile, cancellationToken2); + return emitResolver; + } + function lookupOrIssueError(location, message, arg0, arg1, arg2, arg3) { + var diagnostic = location ? ts6.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts6.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3); + var existing = diagnostics.lookup(diagnostic); + if (existing) { + return existing; + } else { + diagnostics.add(diagnostic); + return diagnostic; + } + } + function errorSkippedOn(key, location, message, arg0, arg1, arg2, arg3) { + var diagnostic = error(location, message, arg0, arg1, arg2, arg3); + diagnostic.skippedOn = key; + return diagnostic; + } + function createError(location, message, arg0, arg1, arg2, arg3) { + return location ? ts6.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts6.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3); + } + function error(location, message, arg0, arg1, arg2, arg3) { + var diagnostic = createError(location, message, arg0, arg1, arg2, arg3); + diagnostics.add(diagnostic); + return diagnostic; + } + function addErrorOrSuggestion(isError, diagnostic) { + if (isError) { + diagnostics.add(diagnostic); + } else { + suggestionDiagnostics.add(__assign(__assign({}, diagnostic), { category: ts6.DiagnosticCategory.Suggestion })); + } + } + function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) { + if (location.pos < 0 || location.end < 0) { + if (!isError) { + return; + } + var file = ts6.getSourceFileOfNode(location); + addErrorOrSuggestion(isError, "message" in message ? ts6.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts6.createDiagnosticForFileFromMessageChain(file, message)); + return; + } + addErrorOrSuggestion(isError, "message" in message ? ts6.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts6.createDiagnosticForNodeFromMessageChain(location, message)); + } + function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { + var diagnostic = error(location, message, arg0, arg1, arg2, arg3); + if (maybeMissingAwait) { + var related = ts6.createDiagnosticForNode(location, ts6.Diagnostics.Did_you_forget_to_use_await); + ts6.addRelatedInfo(diagnostic, related); + } + return diagnostic; + } + function addDeprecatedSuggestionWorker(declarations, diagnostic) { + var deprecatedTag = Array.isArray(declarations) ? ts6.forEach(declarations, ts6.getJSDocDeprecatedTag) : ts6.getJSDocDeprecatedTag(declarations); + if (deprecatedTag) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(deprecatedTag, ts6.Diagnostics.The_declaration_was_marked_as_deprecated_here)); + } + suggestionDiagnostics.add(diagnostic); + return diagnostic; + } + function isDeprecatedSymbol(symbol) { + return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456); + } + function addDeprecatedSuggestion(location, declarations, deprecatedEntity) { + var diagnostic = ts6.createDiagnosticForNode(location, ts6.Diagnostics._0_is_deprecated, deprecatedEntity); + return addDeprecatedSuggestionWorker(declarations, diagnostic); + } + function addDeprecatedSuggestionWithSignature(location, declaration, deprecatedEntity, signatureString) { + var diagnostic = deprecatedEntity ? ts6.createDiagnosticForNode(location, ts6.Diagnostics.The_signature_0_of_1_is_deprecated, signatureString, deprecatedEntity) : ts6.createDiagnosticForNode(location, ts6.Diagnostics._0_is_deprecated, signatureString); + return addDeprecatedSuggestionWorker(declaration, diagnostic); + } + function createSymbol(flags, name, checkFlags) { + symbolCount++; + var symbol = new Symbol2(flags | 33554432, name); + symbol.checkFlags = checkFlags || 0; + return symbol; + } + function getExcludedSymbolFlags(flags) { + var result = 0; + if (flags & 2) + result |= 111551; + if (flags & 1) + result |= 111550; + if (flags & 4) + result |= 0; + if (flags & 8) + result |= 900095; + if (flags & 16) + result |= 110991; + if (flags & 32) + result |= 899503; + if (flags & 64) + result |= 788872; + if (flags & 256) + result |= 899327; + if (flags & 128) + result |= 899967; + if (flags & 512) + result |= 110735; + if (flags & 8192) + result |= 103359; + if (flags & 32768) + result |= 46015; + if (flags & 65536) + result |= 78783; + if (flags & 262144) + result |= 526824; + if (flags & 524288) + result |= 788968; + if (flags & 2097152) + result |= 2097152; + return result; + } + function recordMergedSymbol(target, source) { + if (!source.mergeId) { + source.mergeId = nextMergeId; + nextMergeId++; + } + mergedSymbols[source.mergeId] = target; + } + function cloneSymbol(symbol) { + var result = createSymbol(symbol.flags, symbol.escapedName); + result.declarations = symbol.declarations ? symbol.declarations.slice() : []; + result.parent = symbol.parent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = new ts6.Map(symbol.members); + if (symbol.exports) + result.exports = new ts6.Map(symbol.exports); + recordMergedSymbol(result, symbol); + return result; + } + function mergeSymbol(target, source, unidirectional) { + if (unidirectional === void 0) { + unidirectional = false; + } + if (!(target.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | target.flags) & 67108864) { + if (source === target) { + return target; + } + if (!(target.flags & 33554432)) { + var resolvedTarget = resolveSymbol(target); + if (resolvedTarget === unknownSymbol) { + return source; + } + target = cloneSymbol(resolvedTarget); + } + if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } + target.flags |= source.flags; + if (source.valueDeclaration) { + ts6.setValueDeclaration(target, source.valueDeclaration); + } + ts6.addRange(target.declarations, source.declarations); + if (source.members) { + if (!target.members) + target.members = ts6.createSymbolTable(); + mergeSymbolTable(target.members, source.members, unidirectional); + } + if (source.exports) { + if (!target.exports) + target.exports = ts6.createSymbolTable(); + mergeSymbolTable(target.exports, source.exports, unidirectional); + } + if (!unidirectional) { + recordMergedSymbol(target, source); + } + } else if (target.flags & 1024) { + if (target !== globalThisSymbol) { + error(source.declarations && ts6.getNameOfDeclaration(source.declarations[0]), ts6.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } + } else { + var isEitherEnum = !!(target.flags & 384 || source.flags & 384); + var isEitherBlockScoped_1 = !!(target.flags & 2 || source.flags & 2); + var message = isEitherEnum ? ts6.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations : isEitherBlockScoped_1 ? ts6.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts6.Diagnostics.Duplicate_identifier_0; + var sourceSymbolFile = source.declarations && ts6.getSourceFileOfNode(source.declarations[0]); + var targetSymbolFile = target.declarations && ts6.getSourceFileOfNode(target.declarations[0]); + var isSourcePlainJs = ts6.isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs); + var isTargetPlainJs = ts6.isPlainJsFile(targetSymbolFile, compilerOptions.checkJs); + var symbolName_1 = symbolToString(source); + if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) { + var firstFile_1 = ts6.comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 ? sourceSymbolFile : targetSymbolFile; + var secondFile_1 = firstFile_1 === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile; + var filesDuplicates = ts6.getOrUpdate(amalgamatedDuplicates, "".concat(firstFile_1.path, "|").concat(secondFile_1.path), function() { + return { firstFile: firstFile_1, secondFile: secondFile_1, conflictingSymbols: new ts6.Map() }; + }); + var conflictingSymbolInfo = ts6.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function() { + return { isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] }; + }); + if (!isSourcePlainJs) + addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source); + if (!isTargetPlainJs) + addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target); + } else { + if (!isSourcePlainJs) + addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target); + if (!isTargetPlainJs) + addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source); + } + } + return target; + function addDuplicateLocations(locs, symbol) { + if (symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts6.pushIfUnique(locs, decl); + } + } + } + } + function addDuplicateDeclarationErrorsForSymbols(target, message, symbolName, source) { + ts6.forEach(target.declarations, function(node) { + addDuplicateDeclarationError(node, message, symbolName, source.declarations); + }); + } + function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) { + var errorNode = (ts6.getExpandoInitializer( + node, + /*isPrototypeAssignment*/ + false + ) ? ts6.getNameOfExpando(node) : ts6.getNameOfDeclaration(node)) || node; + var err = lookupOrIssueError(errorNode, message, symbolName); + var _loop_7 = function(relatedNode2) { + var adjustedNode = (ts6.getExpandoInitializer( + relatedNode2, + /*isPrototypeAssignment*/ + false + ) ? ts6.getNameOfExpando(relatedNode2) : ts6.getNameOfDeclaration(relatedNode2)) || relatedNode2; + if (adjustedNode === errorNode) + return "continue"; + err.relatedInformation = err.relatedInformation || []; + var leadingMessage = ts6.createDiagnosticForNode(adjustedNode, ts6.Diagnostics._0_was_also_declared_here, symbolName); + var followOnMessage = ts6.createDiagnosticForNode(adjustedNode, ts6.Diagnostics.and_here); + if (ts6.length(err.relatedInformation) >= 5 || ts6.some(err.relatedInformation, function(r) { + return ts6.compareDiagnostics(r, followOnMessage) === 0 || ts6.compareDiagnostics(r, leadingMessage) === 0; + })) + return "continue"; + ts6.addRelatedInfo(err, !ts6.length(err.relatedInformation) ? leadingMessage : followOnMessage); + }; + for (var _i = 0, _a = relatedNodes || ts6.emptyArray; _i < _a.length; _i++) { + var relatedNode = _a[_i]; + _loop_7(relatedNode); + } + } + function combineSymbolTables(first, second) { + if (!(first === null || first === void 0 ? void 0 : first.size)) + return second; + if (!(second === null || second === void 0 ? void 0 : second.size)) + return first; + var combined = ts6.createSymbolTable(); + mergeSymbolTable(combined, first); + mergeSymbolTable(combined, second); + return combined; + } + function mergeSymbolTable(target, source, unidirectional) { + if (unidirectional === void 0) { + unidirectional = false; + } + source.forEach(function(sourceSymbol, id) { + var targetSymbol = target.get(id); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); + }); + } + function mergeModuleAugmentation(moduleName) { + var _a, _b, _c; + var moduleAugmentation = moduleName.parent; + if (((_a = moduleAugmentation.symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) !== moduleAugmentation) { + ts6.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); + return; + } + if (ts6.isGlobalScopeAugmentation(moduleAugmentation)) { + mergeSymbolTable(globals, moduleAugmentation.symbol.exports); + } else { + var moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216) ? ts6.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found : void 0; + var mainModule_1 = resolveExternalModuleNameWorker( + moduleName, + moduleName, + moduleNotFoundError, + /*isForAugmentation*/ + true + ); + if (!mainModule_1) { + return; + } + mainModule_1 = resolveExternalModuleSymbol(mainModule_1); + if (mainModule_1.flags & 1920) { + if (ts6.some(patternAmbientModules, function(module2) { + return mainModule_1 === module2.symbol; + })) { + var merged = mergeSymbol( + moduleAugmentation.symbol, + mainModule_1, + /*unidirectional*/ + true + ); + if (!patternAmbientModuleAugmentations) { + patternAmbientModuleAugmentations = new ts6.Map(); + } + patternAmbientModuleAugmentations.set(moduleName.text, merged); + } else { + if (((_b = mainModule_1.exports) === null || _b === void 0 ? void 0 : _b.get( + "__export" + /* InternalSymbolName.ExportStar */ + )) && ((_c = moduleAugmentation.symbol.exports) === null || _c === void 0 ? void 0 : _c.size)) { + var resolvedExports = getResolvedMembersOrExportsOfSymbol( + mainModule_1, + "resolvedExports" + /* MembersOrExportsResolutionKind.resolvedExports */ + ); + for (var _i = 0, _d = ts6.arrayFrom(moduleAugmentation.symbol.exports.entries()); _i < _d.length; _i++) { + var _e = _d[_i], key = _e[0], value = _e[1]; + if (resolvedExports.has(key) && !mainModule_1.exports.has(key)) { + mergeSymbol(resolvedExports.get(key), value); + } + } + } + mergeSymbol(mainModule_1, moduleAugmentation.symbol); + } + } else { + error(moduleName, ts6.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + } + } + } + function addToSymbolTable(target, source, message) { + source.forEach(function(sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts6.forEach(targetSymbol.declarations, addDeclarationDiagnostic(ts6.unescapeLeadingUnderscores(id), message)); + } else { + target.set(id, sourceSymbol); + } + }); + function addDeclarationDiagnostic(id, message2) { + return function(declaration) { + return diagnostics.add(ts6.createDiagnosticForNode(declaration, message2, id)); + }; + } + } + function getSymbolLinks(symbol) { + if (symbol.flags & 33554432) + return symbol; + var id = getSymbolId(symbol); + return symbolLinks[id] || (symbolLinks[id] = new SymbolLinks()); + } + function getNodeLinks(node) { + var nodeId = getNodeId(node); + return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); + } + function isGlobalSourceFile(node) { + return node.kind === 308 && !ts6.isExternalOrCommonJsModule(node); + } + function getSymbol(symbols, name, meaning) { + if (meaning) { + var symbol = getMergedSymbol(symbols.get(name)); + if (symbol) { + ts6.Debug.assert((ts6.getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); + if (symbol.flags & meaning) { + return symbol; + } + if (symbol.flags & 2097152) { + var targetFlags = getAllSymbolFlags(symbol); + if (targetFlags & meaning) { + return symbol; + } + } + } + } + } + function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) { + var constructorDeclaration = parameter.parent; + var classDeclaration = parameter.parent.parent; + var parameterSymbol = getSymbol( + constructorDeclaration.locals, + parameterName, + 111551 + /* SymbolFlags.Value */ + ); + var propertySymbol = getSymbol( + getMembersOfSymbol(classDeclaration.symbol), + parameterName, + 111551 + /* SymbolFlags.Value */ + ); + if (parameterSymbol && propertySymbol) { + return [parameterSymbol, propertySymbol]; + } + return ts6.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration"); + } + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts6.getSourceFileOfNode(declaration); + var useFile = ts6.getSourceFileOfNode(usage); + var declContainer = ts6.getEnclosingBlockScopeContainer(declaration); + if (declarationFile !== useFile) { + if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !ts6.outFile(compilerOptions) || isInTypeQuery(usage) || declaration.flags & 16777216) { + return true; + } + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); + } + if (declaration.pos <= usage.pos && !(ts6.isPropertyDeclaration(declaration) && ts6.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { + if (declaration.kind === 205) { + var errorBindingElement = ts6.getAncestor( + usage, + 205 + /* SyntaxKind.BindingElement */ + ); + if (errorBindingElement) { + return ts6.findAncestor(errorBindingElement, ts6.isBindingElement) !== ts6.findAncestor(declaration, ts6.isBindingElement) || declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts6.getAncestor( + declaration, + 257 + /* SyntaxKind.VariableDeclaration */ + ), usage); + } else if (declaration.kind === 257) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } else if (ts6.isClassDeclaration(declaration)) { + return !ts6.findAncestor(usage, function(n) { + return ts6.isComputedPropertyName(n) && n.parent.parent === declaration; + }); + } else if (ts6.isPropertyDeclaration(declaration)) { + return !isPropertyImmediatelyReferencedWithinDeclaration( + declaration, + usage, + /*stopAtAnyPropertyDeclaration*/ + false + ); + } else if (ts6.isParameterPropertyDeclaration(declaration, declaration.parent)) { + return !(ts6.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields && ts6.getContainingClass(declaration) === ts6.getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration)); + } + return true; + } + if (usage.parent.kind === 278 || usage.parent.kind === 274 && usage.parent.isExportEquals) { + return true; + } + if (usage.kind === 274 && usage.isExportEquals) { + return true; + } + if (!!(usage.flags & 8388608) || isInTypeQuery(usage) || usageInTypeDeclaration()) { + return true; + } + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { + if (ts6.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields && ts6.getContainingClass(declaration) && (ts6.isPropertyDeclaration(declaration) || ts6.isParameterPropertyDeclaration(declaration, declaration.parent))) { + return !isPropertyImmediatelyReferencedWithinDeclaration( + declaration, + usage, + /*stopAtAnyPropertyDeclaration*/ + true + ); + } else { + return true; + } + } + return false; + function usageInTypeDeclaration() { + return !!ts6.findAncestor(usage, function(node) { + return ts6.isInterfaceDeclaration(node) || ts6.isTypeAliasDeclaration(node); + }); + } + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) { + switch (declaration2.parent.parent.kind) { + case 240: + case 245: + case 247: + if (isSameScopeDescendentOf(usage2, declaration2, declContainer)) { + return true; + } + break; + } + var grandparent = declaration2.parent.parent; + return ts6.isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(usage2, grandparent.expression, declContainer); + } + function isUsedInFunctionOrInstanceProperty(usage2, declaration2) { + return !!ts6.findAncestor(usage2, function(current) { + if (current === declContainer) { + return "quit"; + } + if (ts6.isFunctionLike(current)) { + return true; + } + if (ts6.isClassStaticBlockDeclaration(current)) { + return declaration2.pos < usage2.pos; + } + var propertyDeclaration = ts6.tryCast(current.parent, ts6.isPropertyDeclaration); + if (propertyDeclaration) { + var initializerOfProperty = propertyDeclaration.initializer === current; + if (initializerOfProperty) { + if (ts6.isStatic(current.parent)) { + if (declaration2.kind === 171) { + return true; + } + if (ts6.isPropertyDeclaration(declaration2) && ts6.getContainingClass(usage2) === ts6.getContainingClass(declaration2)) { + var propName = declaration2.name; + if (ts6.isIdentifier(propName) || ts6.isPrivateIdentifier(propName)) { + var type = getTypeOfSymbol(getSymbolOfNode(declaration2)); + var staticBlocks = ts6.filter(declaration2.parent.members, ts6.isClassStaticBlockDeclaration); + if (isPropertyInitializedInStaticBlocks(propName, type, staticBlocks, declaration2.parent.pos, current.pos)) { + return true; + } + } + } + } else { + var isDeclarationInstanceProperty = declaration2.kind === 169 && !ts6.isStatic(declaration2); + if (!isDeclarationInstanceProperty || ts6.getContainingClass(usage2) !== ts6.getContainingClass(declaration2)) { + return true; + } + } + } + } + return false; + }); + } + function isPropertyImmediatelyReferencedWithinDeclaration(declaration2, usage2, stopAtAnyPropertyDeclaration) { + if (usage2.end > declaration2.end) { + return false; + } + var ancestorChangingReferenceScope = ts6.findAncestor(usage2, function(node) { + if (node === declaration2) { + return "quit"; + } + switch (node.kind) { + case 216: + return true; + case 169: + return stopAtAnyPropertyDeclaration && (ts6.isPropertyDeclaration(declaration2) && node.parent === declaration2.parent || ts6.isParameterPropertyDeclaration(declaration2, declaration2.parent) && node.parent === declaration2.parent.parent) ? "quit" : true; + case 238: + switch (node.parent.kind) { + case 174: + case 171: + case 175: + return true; + default: + return false; + } + default: + return false; + } + }); + return ancestorChangingReferenceScope === void 0; + } + } + function useOuterVariableScopeInParameter(result, location, lastLocation) { + var target = ts6.getEmitScriptTarget(compilerOptions); + var functionLocation = location; + if (ts6.isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) { + if (target >= 2) { + var links = getNodeLinks(functionLocation); + if (links.declarationRequiresScopeChange === void 0) { + links.declarationRequiresScopeChange = ts6.forEach(functionLocation.parameters, requiresScopeChange) || false; + } + return !links.declarationRequiresScopeChange; + } + } + return false; + function requiresScopeChange(node) { + return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer); + } + function requiresScopeChangeWorker(node) { + switch (node.kind) { + case 216: + case 215: + case 259: + case 173: + return false; + case 171: + case 174: + case 175: + case 299: + return requiresScopeChangeWorker(node.name); + case 169: + if (ts6.hasStaticModifier(node)) { + return target < 99 || !useDefineForClassFields; + } + return requiresScopeChangeWorker(node.name); + default: + if (ts6.isNullishCoalesce(node) || ts6.isOptionalChain(node)) { + return target < 7; + } + if (ts6.isBindingElement(node) && node.dotDotDotToken && ts6.isObjectBindingPattern(node.parent)) { + return target < 4; + } + if (ts6.isTypeNode(node)) + return false; + return ts6.forEachChild(node, requiresScopeChangeWorker) || false; + } + } + } + function isConstAssertion(location) { + return ts6.isAssertionExpression(location) && ts6.isConstTypeReference(location.type) || ts6.isJSDocTypeTag(location) && ts6.isConstTypeReference(location.typeExpression); + } + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { + if (excludeGlobals === void 0) { + excludeGlobals = false; + } + if (getSpellingSuggestions === void 0) { + getSpellingSuggestions = true; + } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); + } + function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { + var _a, _b, _c; + var originalLocation = location; + var result; + var lastLocation; + var lastSelfReferenceLocation; + var propertyWithInvalidInitializer; + var associatedDeclarationForContainingInitializerOrBindingName; + var withinDeferredContext = false; + var errorLocation = location; + var grandparent; + var isInExternalModule = false; + loop: + while (location) { + if (name === "const" && isConstAssertion(location)) { + return void 0; + } + if (location.locals && !isGlobalSourceFile(location)) { + if (result = lookup(location.locals, name, meaning)) { + var useResult = true; + if (ts6.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { + if (meaning & result.flags & 788968 && lastLocation.kind !== 323) { + useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 166 || lastLocation.kind === 343 || lastLocation.kind === 344 || lastLocation.kind === 165 : false; + } + if (meaning & result.flags & 3) { + if (useOuterVariableScopeInParameter(result, location, lastLocation)) { + useResult = false; + } else if (result.flags & 1) { + useResult = lastLocation.kind === 166 || lastLocation === location.type && !!ts6.findAncestor(result.valueDeclaration, ts6.isParameter); + } + } + } else if (location.kind === 191) { + useResult = lastLocation === location.trueType; + } + if (useResult) { + break loop; + } else { + result = void 0; + } + } + } + withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); + switch (location.kind) { + case 308: + if (!ts6.isExternalOrCommonJsModule(location)) + break; + isInExternalModule = true; + case 264: + var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; + if (location.kind === 308 || ts6.isModuleDeclaration(location) && location.flags & 16777216 && !ts6.isGlobalScopeAugmentation(location)) { + if (result = moduleExports.get( + "default" + /* InternalSymbolName.Default */ + )) { + var localSymbol = ts6.getLocalSymbolForExportDefault(result); + if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) { + break loop; + } + result = void 0; + } + var moduleExport = moduleExports.get(name); + if (moduleExport && moduleExport.flags === 2097152 && (ts6.getDeclarationOfKind( + moduleExport, + 278 + /* SyntaxKind.ExportSpecifier */ + ) || ts6.getDeclarationOfKind( + moduleExport, + 277 + /* SyntaxKind.NamespaceExport */ + ))) { + break; + } + } + if (name !== "default" && (result = lookup( + moduleExports, + name, + meaning & 2623475 + /* SymbolFlags.ModuleMember */ + ))) { + if (ts6.isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) === null || _b === void 0 ? void 0 : _b.some(ts6.isJSDocTypeAlias))) { + result = void 0; + } else { + break loop; + } + } + break; + case 263: + if (result = lookup( + ((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, + name, + meaning & 8 + /* SymbolFlags.EnumMember */ + )) { + break loop; + } + break; + case 169: + if (!ts6.isStatic(location)) { + var ctor = findConstructorDeclaration(location.parent); + if (ctor && ctor.locals) { + if (lookup( + ctor.locals, + name, + meaning & 111551 + /* SymbolFlags.Value */ + )) { + ts6.Debug.assertNode(location, ts6.isPropertyDeclaration); + propertyWithInvalidInitializer = location; + } + } + } + break; + case 260: + case 228: + case 261: + if (result = lookup( + getSymbolOfNode(location).members || emptySymbols, + name, + meaning & 788968 + /* SymbolFlags.Type */ + )) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + result = void 0; + break; + } + if (lastLocation && ts6.isStatic(lastLocation)) { + if (nameNotFoundMessage) { + error(errorLocation, ts6.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } + return void 0; + } + break loop; + } + if (location.kind === 228 && meaning & 32) { + var className = location.name; + if (className && name === className.escapedText) { + result = location.symbol; + break loop; + } + } + break; + case 230: + if (lastLocation === location.expression && location.parent.token === 94) { + var container = location.parent.parent; + if (ts6.isClassLike(container) && (result = lookup( + getSymbolOfNode(container).members, + name, + meaning & 788968 + /* SymbolFlags.Type */ + ))) { + if (nameNotFoundMessage) { + error(errorLocation, ts6.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters); + } + return void 0; + } + } + break; + case 164: + grandparent = location.parent.parent; + if (ts6.isClassLike(grandparent) || grandparent.kind === 261) { + if (result = lookup( + getSymbolOfNode(grandparent).members, + name, + meaning & 788968 + /* SymbolFlags.Type */ + )) { + if (nameNotFoundMessage) { + error(errorLocation, ts6.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } + return void 0; + } + } + break; + case 216: + if (ts6.getEmitScriptTarget(compilerOptions) >= 2) { + break; + } + case 171: + case 173: + case 174: + case 175: + case 259: + if (meaning & 3 && name === "arguments") { + result = argumentsSymbol; + break loop; + } + break; + case 215: + if (meaning & 3 && name === "arguments") { + result = argumentsSymbol; + break loop; + } + if (meaning & 16) { + var functionName = location.name; + if (functionName && name === functionName.escapedText) { + result = location.symbol; + break loop; + } + } + break; + case 167: + if (location.parent && location.parent.kind === 166) { + location = location.parent; + } + if (location.parent && (ts6.isClassElement(location.parent) || location.parent.kind === 260)) { + location = location.parent; + } + break; + case 348: + case 341: + case 342: + var root = ts6.getJSDocRoot(location); + if (root) { + location = root.parent; + } + break; + case 166: + if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts6.isBindingPattern(lastLocation))) { + if (!associatedDeclarationForContainingInitializerOrBindingName) { + associatedDeclarationForContainingInitializerOrBindingName = location; + } + } + break; + case 205: + if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts6.isBindingPattern(lastLocation))) { + if (ts6.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { + associatedDeclarationForContainingInitializerOrBindingName = location; + } + } + break; + case 192: + if (meaning & 262144) { + var parameterName = location.typeParameter.name; + if (parameterName && name === parameterName.escapedText) { + result = location.typeParameter.symbol; + break loop; + } + } + break; + } + if (isSelfReferenceLocation(location)) { + lastSelfReferenceLocation = location; + } + lastLocation = location; + location = ts6.isJSDocTemplateTag(location) ? ts6.getEffectiveContainerForJSDocTemplateTag(location) || location.parent : ts6.isJSDocParameterTag(location) || ts6.isJSDocReturnTag(location) ? ts6.getHostSignatureFromJSDoc(location) || location.parent : location.parent; + } + if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) { + result.isReferenced |= meaning; + } + if (!result) { + if (lastLocation) { + ts6.Debug.assert( + lastLocation.kind === 308 + /* SyntaxKind.SourceFile */ + ); + if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { + return lastLocation.symbol; + } + } + if (!excludeGlobals) { + result = lookup(globals, name, meaning); + } + } + if (!result) { + if (originalLocation && ts6.isInJSFile(originalLocation) && originalLocation.parent) { + if (ts6.isRequireCall( + originalLocation.parent, + /*checkArgumentIsStringLiteralLike*/ + false + )) { + return requireSymbol; + } + } + } + function checkAndReportErrorForInvalidInitializer() { + if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts6.getEmitScriptTarget(compilerOptions) >= 9)) { + error(errorLocation, errorLocation && propertyWithInvalidInitializer.type && ts6.textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? ts6.Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : ts6.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts6.declarationNameToString(propertyWithInvalidInitializer.name), diagnosticName(nameArg)); + return true; + } + return false; + } + if (!result) { + if (nameNotFoundMessage) { + addLazyDiagnostic(function() { + if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217 + !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { + var suggestion = void 0; + var suggestedLib = void 0; + if (nameArg) { + suggestedLib = getSuggestedLibForNonExistentName(nameArg); + if (suggestedLib) { + error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib); + } + } + if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) { + suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning); + var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts6.isAmbientModule(suggestion.valueDeclaration) && ts6.isGlobalScopeAugmentation(suggestion.valueDeclaration); + if (isGlobalScopeAugmentationDeclaration) { + suggestion = void 0; + } + if (suggestion) { + var suggestionName = symbolToString(suggestion); + var isUncheckedJS = isUncheckedJSSuggestion( + originalLocation, + suggestion, + /*excludeClasses*/ + false + ); + var message = meaning === 1920 || nameArg && typeof nameArg !== "string" && ts6.nodeIsSynthesized(nameArg) ? ts6.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? ts6.Diagnostics.Could_not_find_name_0_Did_you_mean_1 : ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_1; + var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName); + addErrorOrSuggestion(!isUncheckedJS, diagnostic); + if (suggestion.valueDeclaration) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(suggestion.valueDeclaration, ts6.Diagnostics._0_is_declared_here, suggestionName)); + } + } + } + if (!suggestion && !suggestedLib && nameArg) { + error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg)); + } + suggestionCount++; + } + }); + } + return void 0; + } else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { + return void 0; + } + if (nameNotFoundMessage) { + addLazyDiagnostic(function() { + if (errorLocation && (meaning & 2 || (meaning & 32 || meaning & 384) && (meaning & 111551) === 111551)) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } + } + if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 8388608)) { + var merged = getMergedSymbol(result); + if (ts6.length(merged.declarations) && ts6.every(merged.declarations, function(d) { + return ts6.isNamespaceExportDeclaration(d) || ts6.isSourceFile(d) && !!d.symbol.globalExports; + })) { + errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts6.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts6.unescapeLeadingUnderscores(name)); + } + } + if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551) === 111551) { + var candidate = getMergedSymbol(getLateBoundSymbol(result)); + var root2 = ts6.getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName); + if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializerOrBindingName)) { + error(errorLocation, ts6.Diagnostics.Parameter_0_cannot_reference_itself, ts6.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name)); + } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root2.parent.locals && lookup(root2.parent.locals, candidate.escapedName, meaning) === candidate) { + error(errorLocation, ts6.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts6.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts6.declarationNameToString(errorLocation)); + } + } + if (result && errorLocation && meaning & 111551 && result.flags & 2097152 && !(result.flags & 111551) && !ts6.isValidTypeOnlyAliasUseSite(errorLocation)) { + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration( + result, + 111551 + /* SymbolFlags.Value */ + ); + if (typeOnlyDeclaration) { + var message = typeOnlyDeclaration.kind === 278 ? ts6.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts6.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; + var unescapedName = ts6.unescapeLeadingUnderscores(name); + addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName); + } + } + }); + } + return result; + } + function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { + if (!typeOnlyDeclaration) + return diagnostic; + return ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 ? ts6.Diagnostics._0_was_exported_here : ts6.Diagnostics._0_was_imported_here, unescapedName)); + } + function getIsDeferredContext(location, lastLocation) { + if (location.kind !== 216 && location.kind !== 215) { + return ts6.isTypeQueryNode(location) || (ts6.isFunctionLikeDeclaration(location) || location.kind === 169 && !ts6.isStatic(location)) && (!lastLocation || lastLocation !== location.name); + } + if (lastLocation && lastLocation === location.name) { + return false; + } + if (location.asteriskToken || ts6.hasSyntacticModifier( + location, + 512 + /* ModifierFlags.Async */ + )) { + return true; + } + return !ts6.getImmediatelyInvokedFunctionExpression(location); + } + function isSelfReferenceLocation(node) { + switch (node.kind) { + case 259: + case 260: + case 261: + case 263: + case 262: + case 264: + return true; + default: + return false; + } + } + function diagnosticName(nameArg) { + return ts6.isString(nameArg) ? ts6.unescapeLeadingUnderscores(nameArg) : ts6.declarationNameToString(nameArg); + } + function isTypeParameterSymbolDeclaredInContainer(symbol, container) { + if (symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.kind === 165) { + var parent = ts6.isJSDocTemplateTag(decl.parent) ? ts6.getJSDocHost(decl.parent) : decl.parent; + if (parent === container) { + return !(ts6.isJSDocTemplateTag(decl.parent) && ts6.find(decl.parent.parent.tags, ts6.isJSDocTypeAlias)); + } + } + } + } + return false; + } + function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { + if (!ts6.isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) { + return false; + } + var container = ts6.getThisContainer( + errorLocation, + /*includeArrowFunctions*/ + false + ); + var location = container; + while (location) { + if (ts6.isClassLike(location.parent)) { + var classSymbol = getSymbolOfNode(location.parent); + if (!classSymbol) { + break; + } + var constructorType = getTypeOfSymbol(classSymbol); + if (getPropertyOfType(constructorType, name)) { + error(errorLocation, ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol)); + return true; + } + if (location === container && !ts6.isStatic(location)) { + var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; + if (getPropertyOfType(instanceType, name)) { + error(errorLocation, ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)); + return true; + } + } + } + location = location.parent; + } + return false; + } + function checkAndReportErrorForExtendingInterface(errorLocation) { + var expression = getEntityNameForExtendingInterface(errorLocation); + if (expression && resolveEntityName( + expression, + 64, + /*ignoreErrors*/ + true + )) { + error(errorLocation, ts6.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, ts6.getTextOfNode(expression)); + return true; + } + return false; + } + function getEntityNameForExtendingInterface(node) { + switch (node.kind) { + case 79: + case 208: + return node.parent ? getEntityNameForExtendingInterface(node.parent) : void 0; + case 230: + if (ts6.isEntityNameExpression(node.expression)) { + return node.expression; + } + default: + return void 0; + } + } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { + var namespaceMeaning = 1920 | (ts6.isInJSFile(errorLocation) ? 111551 : 0); + if (meaning === namespaceMeaning) { + var symbol = resolveSymbol(resolveName( + errorLocation, + name, + 788968 & ~namespaceMeaning, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + )); + var parent = errorLocation.parent; + if (symbol) { + if (ts6.isQualifiedName(parent)) { + ts6.Debug.assert(parent.left === errorLocation, "Should only be resolving left side of qualified name as a namespace"); + var propName = parent.right.escapedText; + var propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName); + if (propType) { + error(parent, ts6.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, ts6.unescapeLeadingUnderscores(name), ts6.unescapeLeadingUnderscores(propName)); + return true; + } + } + error(errorLocation, ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, ts6.unescapeLeadingUnderscores(name)); + return true; + } + } + return false; + } + function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) { + if (meaning & (788968 & ~1920)) { + var symbol = resolveSymbol(resolveName( + errorLocation, + name, + ~788968 & 111551, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + )); + if (symbol && !(symbol.flags & 1920)) { + error(errorLocation, ts6.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts6.unescapeLeadingUnderscores(name)); + return true; + } + } + return false; + } + function isPrimitiveTypeName(name) { + return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; + } + function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278) { + error(errorLocation, ts6.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); + return true; + } + return false; + } + function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { + if (meaning & 111551) { + if (isPrimitiveTypeName(name)) { + if (isExtendedByInterface(errorLocation)) { + error(errorLocation, ts6.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts6.unescapeLeadingUnderscores(name)); + } else { + error(errorLocation, ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts6.unescapeLeadingUnderscores(name)); + } + return true; + } + var symbol = resolveSymbol(resolveName( + errorLocation, + name, + 788968 & ~111551, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + )); + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== void 0 && !(allFlags & 111551)) { + var rawName = ts6.unescapeLeadingUnderscores(name); + if (isES2015OrLaterConstructorName(name)) { + error(errorLocation, ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); + } else if (maybeMappedType(errorLocation, symbol)) { + error(errorLocation, ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0, rawName, rawName === "K" ? "P" : "K"); + } else { + error(errorLocation, ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName); + } + return true; + } + } + return false; + } + function isExtendedByInterface(node) { + var grandparent = node.parent.parent; + var parentOfGrandparent = grandparent.parent; + if (grandparent && parentOfGrandparent) { + var isExtending = ts6.isHeritageClause(grandparent) && grandparent.token === 94; + var isInterface = ts6.isInterfaceDeclaration(parentOfGrandparent); + return isExtending && isInterface; + } + return false; + } + function maybeMappedType(node, symbol) { + var container = ts6.findAncestor(node.parent, function(n) { + return ts6.isComputedPropertyName(n) || ts6.isPropertySignature(n) ? false : ts6.isTypeLiteralNode(n) || "quit"; + }); + if (container && container.members.length === 1) { + var type = getDeclaredTypeOfSymbol(symbol); + return !!(type.flags & 1048576) && allTypesAssignableToKind( + type, + 384, + /*strict*/ + true + ); + } + return false; + } + function isES2015OrLaterConstructorName(n) { + switch (n) { + case "Promise": + case "Symbol": + case "Map": + case "WeakMap": + case "Set": + case "WeakSet": + return true; + } + return false; + } + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 & ~788968)) { + var symbol = resolveSymbol(resolveName( + errorLocation, + name, + 1024, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + )); + if (symbol) { + error(errorLocation, ts6.Diagnostics.Cannot_use_namespace_0_as_a_value, ts6.unescapeLeadingUnderscores(name)); + return true; + } + } else if (meaning & (788968 & ~111551)) { + var symbol = resolveSymbol(resolveName( + errorLocation, + name, + 1536, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + )); + if (symbol) { + error(errorLocation, ts6.Diagnostics.Cannot_use_namespace_0_as_a_type, ts6.unescapeLeadingUnderscores(name)); + return true; + } + } + return false; + } + function checkResolvedBlockScopedVariable(result, errorLocation) { + var _a; + ts6.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384)); + if (result.flags & (16 | 1 | 67108864) && result.flags & 32) { + return; + } + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function(d) { + return ts6.isBlockOrCatchScoped(d) || ts6.isClassLike(d) || d.kind === 263; + }); + if (declaration === void 0) + return ts6.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); + if (!(declaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + var diagnosticMessage = void 0; + var declarationName = ts6.declarationNameToString(ts6.getNameOfDeclaration(declaration)); + if (result.flags & 2) { + diagnosticMessage = error(errorLocation, ts6.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName); + } else if (result.flags & 32) { + diagnosticMessage = error(errorLocation, ts6.Diagnostics.Class_0_used_before_its_declaration, declarationName); + } else if (result.flags & 256) { + diagnosticMessage = error(errorLocation, ts6.Diagnostics.Enum_0_used_before_its_declaration, declarationName); + } else { + ts6.Debug.assert(!!(result.flags & 128)); + if (ts6.shouldPreserveConstEnums(compilerOptions)) { + diagnosticMessage = error(errorLocation, ts6.Diagnostics.Enum_0_used_before_its_declaration, declarationName); + } + } + if (diagnosticMessage) { + ts6.addRelatedInfo(diagnosticMessage, ts6.createDiagnosticForNode(declaration, ts6.Diagnostics._0_is_declared_here, declarationName)); + } + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + return !!parent && !!ts6.findAncestor(initial, function(n) { + return n === parent || (n === stopAt || ts6.isFunctionLike(n) && !ts6.getImmediatelyInvokedFunctionExpression(n) ? "quit" : false); + }); + } + function getAnyImportSyntax(node) { + switch (node.kind) { + case 268: + return node; + case 270: + return node.parent; + case 271: + return node.parent.parent; + case 273: + return node.parent.parent.parent; + default: + return void 0; + } + } + function getDeclarationOfAliasSymbol(symbol) { + return symbol.declarations && ts6.findLast(symbol.declarations, isAliasSymbolDeclaration); + } + function isAliasSymbolDeclaration(node) { + return node.kind === 268 || node.kind === 267 || node.kind === 270 && !!node.name || node.kind === 271 || node.kind === 277 || node.kind === 273 || node.kind === 278 || node.kind === 274 && ts6.exportAssignmentIsAlias(node) || ts6.isBinaryExpression(node) && ts6.getAssignmentDeclarationKind(node) === 2 && ts6.exportAssignmentIsAlias(node) || ts6.isAccessExpression(node) && ts6.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableOrJsExpression(node.parent.right) || node.kind === 300 || node.kind === 299 && isAliasableOrJsExpression(node.initializer) || node.kind === 257 && ts6.isVariableDeclarationInitializedToBareOrAccessedRequire(node) || node.kind === 205 && ts6.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + } + function isAliasableOrJsExpression(e) { + return ts6.isAliasableExpression(e) || ts6.isFunctionExpression(e) && isJSConstructor(e); + } + function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { + var commonJSPropertyAccess = getCommonJSPropertyAccess(node); + if (commonJSPropertyAccess) { + var name = ts6.getLeftmostAccessExpression(commonJSPropertyAccess.expression).arguments[0]; + return ts6.isIdentifier(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; + } + if (ts6.isVariableDeclaration(node) || node.moduleReference.kind === 280) { + var immediate = resolveExternalModuleName(node, ts6.getExternalModuleRequireArgument(node) || ts6.getExternalModuleImportEqualsDeclarationExpression(node)); + var resolved_4 = resolveExternalModuleSymbol(immediate); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + immediate, + resolved_4, + /*overwriteEmpty*/ + false + ); + return resolved_4; + } + var resolved = getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); + checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved); + return resolved; + } + function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { + if (markSymbolOfAliasDeclarationIfTypeOnly( + node, + /*immediateTarget*/ + void 0, + resolved, + /*overwriteEmpty*/ + false + ) && !node.isTypeOnly) { + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); + var isExport = typeOnlyDeclaration.kind === 278; + var message = isExport ? ts6.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts6.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; + var relatedMessage = isExport ? ts6.Diagnostics._0_was_exported_here : ts6.Diagnostics._0_was_imported_here; + var name = ts6.unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText); + ts6.addRelatedInfo(error(node.moduleReference, message), ts6.createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name)); + } + } + function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) { + var exportValue = moduleSymbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + var exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name); + var resolved = resolveSymbol(exportSymbol, dontResolveAlias); + markSymbolOfAliasDeclarationIfTypeOnly( + sourceNode, + exportSymbol, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function isSyntacticDefault(node) { + return ts6.isExportAssignment(node) && !node.isExportEquals || ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + ) || ts6.isExportSpecifier(node); + } + function getUsageModeForExpression(usage) { + return ts6.isStringLiteralLike(usage) ? ts6.getModeForUsageLocation(ts6.getSourceFileOfNode(usage), usage) : void 0; + } + function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) { + return usageMode === ts6.ModuleKind.ESNext && targetMode === ts6.ModuleKind.CommonJS; + } + function isOnlyImportedAsDefault(usage) { + var usageMode = getUsageModeForExpression(usage); + return usageMode === ts6.ModuleKind.ESNext && ts6.endsWith( + usage.text, + ".json" + /* Extension.Json */ + ); + } + function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) { + var usageMode = file && getUsageModeForExpression(usage); + if (file && usageMode !== void 0) { + var result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat); + if (usageMode === ts6.ModuleKind.ESNext || result) { + return result; + } + } + if (!allowSyntheticDefaultImports) { + return false; + } + if (!file || file.isDeclarationFile) { + var defaultExportSymbol = resolveExportByName( + moduleSymbol, + "default", + /*sourceNode*/ + void 0, + /*dontResolveAlias*/ + true + ); + if (defaultExportSymbol && ts6.some(defaultExportSymbol.declarations, isSyntacticDefault)) { + return false; + } + if (resolveExportByName( + moduleSymbol, + ts6.escapeLeadingUnderscores("__esModule"), + /*sourceNode*/ + void 0, + dontResolveAlias + )) { + return false; + } + return true; + } + if (!ts6.isSourceFileJS(file)) { + return hasExportAssignmentSymbol(moduleSymbol); + } + return typeof file.externalModuleIndicator !== "object" && !resolveExportByName( + moduleSymbol, + ts6.escapeLeadingUnderscores("__esModule"), + /*sourceNode*/ + void 0, + dontResolveAlias + ); + } + function getTargetOfImportClause(node, dontResolveAlias) { + var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); + if (moduleSymbol) { + return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias); + } + } + function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) { + var _a; + var exportDefaultSymbol; + if (ts6.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } else { + exportDefaultSymbol = resolveExportByName(moduleSymbol, "default", node, dontResolveAlias); + } + var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isSourceFile); + var specifier = getModuleSpecifierForImportOrExport(node); + if (!specifier) { + return exportDefaultSymbol; + } + var hasDefaultOnly = isOnlyImportedAsDefault(specifier); + var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier); + if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) { + if (hasExportAssignmentSymbol(moduleSymbol)) { + var compilerOptionName = moduleKind >= ts6.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; + var exportEqualsSymbol = moduleSymbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + var exportAssignment = exportEqualsSymbol.valueDeclaration; + var err = error(node.name, ts6.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName); + if (exportAssignment) { + ts6.addRelatedInfo(err, ts6.createDiagnosticForNode(exportAssignment, ts6.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName)); + } + } else if (ts6.isImportClause(node)) { + reportNonDefaultExport(moduleSymbol, node); + } else { + errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts6.isImportOrExportSpecifier(node) && node.propertyName || node.name); + } + } else if (hasSyntheticDefault || hasDefaultOnly) { + var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + moduleSymbol, + resolved, + /*overwriteTypeOnly*/ + false + ); + return resolved; + } + markSymbolOfAliasDeclarationIfTypeOnly( + node, + exportDefaultSymbol, + /*finalTarget*/ + void 0, + /*overwriteTypeOnly*/ + false + ); + return exportDefaultSymbol; + } + function getModuleSpecifierForImportOrExport(node) { + switch (node.kind) { + case 270: + return node.parent.moduleSpecifier; + case 268: + return ts6.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : void 0; + case 271: + return node.parent.parent.moduleSpecifier; + case 273: + return node.parent.parent.parent.moduleSpecifier; + case 278: + return node.parent.parent.moduleSpecifier; + default: + return ts6.Debug.assertNever(node); + } + } + function reportNonDefaultExport(moduleSymbol, node) { + var _a, _b, _c; + if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has(node.symbol.escapedName)) { + error(node.name, ts6.Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, symbolToString(moduleSymbol), symbolToString(node.symbol)); + } else { + var diagnostic = error(node.name, ts6.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + var exportStar = (_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.get( + "__export" + /* InternalSymbolName.ExportStar */ + ); + if (exportStar) { + var defaultExport = (_c = exportStar.declarations) === null || _c === void 0 ? void 0 : _c.find(function(decl) { + var _a2, _b2; + return !!(ts6.isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a2 = resolveExternalModuleName(decl, decl.moduleSpecifier)) === null || _a2 === void 0 ? void 0 : _a2.exports) === null || _b2 === void 0 ? void 0 : _b2.has( + "default" + /* InternalSymbolName.Default */ + ))); + }); + if (defaultExport) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(defaultExport, ts6.Diagnostics.export_Asterisk_does_not_re_export_a_default)); + } + } + } + } + function getTargetOfNamespaceImport(node, dontResolveAlias) { + var moduleSpecifier = node.parent.parent.moduleSpecifier; + var immediate = resolveExternalModuleName(node, moduleSpecifier); + var resolved = resolveESModuleSymbol( + immediate, + moduleSpecifier, + dontResolveAlias, + /*suppressUsageError*/ + false + ); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + immediate, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function getTargetOfNamespaceExport(node, dontResolveAlias) { + var moduleSpecifier = node.parent.moduleSpecifier; + var immediate = moduleSpecifier && resolveExternalModuleName(node, moduleSpecifier); + var resolved = moduleSpecifier && resolveESModuleSymbol( + immediate, + moduleSpecifier, + dontResolveAlias, + /*suppressUsageError*/ + false + ); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + immediate, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { + if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) { + return unknownSymbol; + } + if (valueSymbol.flags & (788968 | 1920)) { + return valueSymbol; + } + var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName); + result.declarations = ts6.deduplicate(ts6.concatenate(valueSymbol.declarations, typeSymbol.declarations), ts6.equateValues); + result.parent = valueSymbol.parent || typeSymbol.parent; + if (valueSymbol.valueDeclaration) + result.valueDeclaration = valueSymbol.valueDeclaration; + if (typeSymbol.members) + result.members = new ts6.Map(typeSymbol.members); + if (valueSymbol.exports) + result.exports = new ts6.Map(valueSymbol.exports); + return result; + } + function getExportOfModule(symbol, name, specifier, dontResolveAlias) { + if (symbol.flags & 1536) { + var exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText); + var resolved = resolveSymbol(exportSymbol, dontResolveAlias); + markSymbolOfAliasDeclarationIfTypeOnly( + specifier, + exportSymbol, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + } + function getPropertyOfVariable(symbol, name) { + if (symbol.flags & 3) { + var typeAnnotation = symbol.valueDeclaration.type; + if (typeAnnotation) { + return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); + } + } + } + function getExternalModuleMember(node, specifier, dontResolveAlias) { + var _a; + if (dontResolveAlias === void 0) { + dontResolveAlias = false; + } + var moduleSpecifier = ts6.getExternalModuleRequireArgument(node) || node.moduleSpecifier; + var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); + var name = !ts6.isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name; + if (!ts6.isIdentifier(name)) { + return void 0; + } + var suppressInteropError = name.escapedText === "default" && !!(compilerOptions.allowSyntheticDefaultImports || ts6.getESModuleInterop(compilerOptions)); + var targetSymbol = resolveESModuleSymbol( + moduleSymbol, + moduleSpecifier, + /*dontResolveAlias*/ + false, + suppressInteropError + ); + if (targetSymbol) { + if (name.escapedText) { + if (ts6.isShorthandAmbientModuleSymbol(moduleSymbol)) { + return moduleSymbol; + } + var symbolFromVariable = void 0; + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + )) { + symbolFromVariable = getPropertyOfType( + getTypeOfSymbol(targetSymbol), + name.escapedText, + /*skipObjectFunctionPropertyAugment*/ + true + ); + } else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText); + } + symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); + var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias); + if (symbolFromModule === void 0 && name.escapedText === "default") { + var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isSourceFile); + if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) { + symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); + } + } + var symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; + if (!symbol) { + errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name); + } + return symbol; + } + } + } + function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) { + var _a; + var moduleName = getFullyQualifiedName(moduleSymbol, node); + var declarationName = ts6.declarationNameToString(name); + var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol); + if (suggestion !== void 0) { + var suggestionName = symbolToString(suggestion); + var diagnostic = error(name, ts6.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName); + if (suggestion.valueDeclaration) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(suggestion.valueDeclaration, ts6.Diagnostics._0_is_declared_here, suggestionName)); + } + } else { + if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has( + "default" + /* InternalSymbolName.Default */ + )) { + error(name, ts6.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName); + } else { + reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName); + } + } + } + function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) { + var _a, _b; + var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText); + var exports2 = moduleSymbol.exports; + if (localSymbol) { + var exportedEqualsSymbol = exports2 === null || exports2 === void 0 ? void 0 : exports2.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + if (exportedEqualsSymbol) { + getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error(name, ts6.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); + } else { + var exportedSymbol = exports2 ? ts6.find(symbolsToArray(exports2), function(symbol) { + return !!getSymbolIfSameReference(symbol, localSymbol); + }) : void 0; + var diagnostic = exportedSymbol ? error(name, ts6.Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error(name, ts6.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName); + if (localSymbol.declarations) { + ts6.addRelatedInfo.apply(void 0, __spreadArray([diagnostic], ts6.map(localSymbol.declarations, function(decl, index) { + return ts6.createDiagnosticForNode(decl, index === 0 ? ts6.Diagnostics._0_is_declared_here : ts6.Diagnostics.and_here, declarationName); + }), false)); + } + } + } else { + error(name, ts6.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); + } + } + function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) { + if (moduleKind >= ts6.ModuleKind.ES2015) { + var message = ts6.getESModuleInterop(compilerOptions) ? ts6.Diagnostics._0_can_only_be_imported_by_using_a_default_import : ts6.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; + error(name, message, declarationName); + } else { + if (ts6.isInJSFile(node)) { + var message = ts6.getESModuleInterop(compilerOptions) ? ts6.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import : ts6.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; + error(name, message, declarationName); + } else { + var message = ts6.getESModuleInterop(compilerOptions) ? ts6.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import : ts6.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; + error(name, message, declarationName, declarationName, moduleName); + } + } + } + function getTargetOfImportSpecifier(node, dontResolveAlias) { + if (ts6.isImportSpecifier(node) && ts6.idText(node.propertyName || node.name) === "default") { + var specifier = getModuleSpecifierForImportOrExport(node); + var moduleSymbol = specifier && resolveExternalModuleName(node, specifier); + if (moduleSymbol) { + return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias); + } + } + var root = ts6.isBindingElement(node) ? ts6.getRootDeclaration(node) : node.parent.parent.parent; + var commonJSPropertyAccess = getCommonJSPropertyAccess(root); + var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias); + var name = node.propertyName || node.name; + if (commonJSPropertyAccess && resolved && ts6.isIdentifier(name)) { + return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias); + } + markSymbolOfAliasDeclarationIfTypeOnly( + node, + /*immediateTarget*/ + void 0, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function getCommonJSPropertyAccess(node) { + if (ts6.isVariableDeclaration(node) && node.initializer && ts6.isPropertyAccessExpression(node.initializer)) { + return node.initializer; + } + } + function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { + var resolved = resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + /*immediateTarget*/ + void 0, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) { + if (ts6.idText(node.propertyName || node.name) === "default") { + var specifier = getModuleSpecifierForImportOrExport(node); + var moduleSymbol = specifier && resolveExternalModuleName(node, specifier); + if (moduleSymbol) { + return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias); + } + } + var resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName( + node.propertyName || node.name, + meaning, + /*ignoreErrors*/ + false, + dontResolveAlias + ); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + /*immediateTarget*/ + void 0, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function getTargetOfExportAssignment(node, dontResolveAlias) { + var expression = ts6.isExportAssignment(node) ? node.expression : node.right; + var resolved = getTargetOfAliasLikeExpression(expression, dontResolveAlias); + markSymbolOfAliasDeclarationIfTypeOnly( + node, + /*immediateTarget*/ + void 0, + resolved, + /*overwriteEmpty*/ + false + ); + return resolved; + } + function getTargetOfAliasLikeExpression(expression, dontResolveAlias) { + if (ts6.isClassExpression(expression)) { + return checkExpressionCached(expression).symbol; + } + if (!ts6.isEntityName(expression) && !ts6.isEntityNameExpression(expression)) { + return void 0; + } + var aliasLike = resolveEntityName( + expression, + 111551 | 788968 | 1920, + /*ignoreErrors*/ + true, + dontResolveAlias + ); + if (aliasLike) { + return aliasLike; + } + checkExpressionCached(expression); + return getNodeLinks(expression).resolvedSymbol; + } + function getTargetOfAccessExpression(node, dontRecursivelyResolve) { + if (!(ts6.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63)) { + return void 0; + } + return getTargetOfAliasLikeExpression(node.parent.right, dontRecursivelyResolve); + } + function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { + if (dontRecursivelyResolve === void 0) { + dontRecursivelyResolve = false; + } + switch (node.kind) { + case 268: + case 257: + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); + case 270: + return getTargetOfImportClause(node, dontRecursivelyResolve); + case 271: + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 277: + return getTargetOfNamespaceExport(node, dontRecursivelyResolve); + case 273: + case 205: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 278: + return getTargetOfExportSpecifier(node, 111551 | 788968 | 1920, dontRecursivelyResolve); + case 274: + case 223: + return getTargetOfExportAssignment(node, dontRecursivelyResolve); + case 267: + return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); + case 300: + return resolveEntityName( + node.name, + 111551 | 788968 | 1920, + /*ignoreErrors*/ + true, + dontRecursivelyResolve + ); + case 299: + return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); + case 209: + case 208: + return getTargetOfAccessExpression(node, dontRecursivelyResolve); + default: + return ts6.Debug.fail(); + } + } + function isNonLocalAlias(symbol, excludes) { + if (excludes === void 0) { + excludes = 111551 | 788968 | 1920; + } + if (!symbol) + return false; + return (symbol.flags & (2097152 | excludes)) === 2097152 || !!(symbol.flags & 2097152 && symbol.flags & 67108864); + } + function resolveSymbol(symbol, dontResolveAlias) { + return !dontResolveAlias && isNonLocalAlias(symbol) ? resolveAlias(symbol) : symbol; + } + function resolveAlias(symbol) { + ts6.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.aliasTarget) { + links.aliasTarget = resolvingSymbol; + var node = getDeclarationOfAliasSymbol(symbol); + if (!node) + return ts6.Debug.fail(); + var target = getTargetOfAliasDeclaration(node); + if (links.aliasTarget === resolvingSymbol) { + links.aliasTarget = target || unknownSymbol; + } else { + error(node, ts6.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); + } + } else if (links.aliasTarget === resolvingSymbol) { + links.aliasTarget = unknownSymbol; + } + return links.aliasTarget; + } + function tryResolveAlias(symbol) { + var links = getSymbolLinks(symbol); + if (links.aliasTarget !== resolvingSymbol) { + return resolveAlias(symbol); + } + return void 0; + } + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863; + } + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152) { + if (seenSymbols) { + seenSymbols.add(target); + } else { + seenSymbols = new ts6.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } + function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) { + if (!aliasDeclaration || ts6.isPropertyAccessExpression(aliasDeclaration)) + return false; + var sourceSymbol = getSymbolOfNode(aliasDeclaration); + if (ts6.isTypeOnlyImportOrExportDeclaration(aliasDeclaration)) { + var links_1 = getSymbolLinks(sourceSymbol); + links_1.typeOnlyDeclaration = aliasDeclaration; + return true; + } + var links = getSymbolLinks(sourceSymbol); + return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty); + } + function markSymbolOfAliasDeclarationIfTypeOnlyWorker(aliasDeclarationLinks, target, overwriteEmpty) { + var _a, _b, _c; + if (target && (aliasDeclarationLinks.typeOnlyDeclaration === void 0 || overwriteEmpty && aliasDeclarationLinks.typeOnlyDeclaration === false)) { + var exportSymbol = (_b = (_a = target.exports) === null || _a === void 0 ? void 0 : _a.get( + "export=" + /* InternalSymbolName.ExportEquals */ + )) !== null && _b !== void 0 ? _b : target; + var typeOnly = exportSymbol.declarations && ts6.find(exportSymbol.declarations, ts6.isTypeOnlyImportOrExportDeclaration); + aliasDeclarationLinks.typeOnlyDeclaration = (_c = typeOnly !== null && typeOnly !== void 0 ? typeOnly : getSymbolLinks(exportSymbol).typeOnlyDeclaration) !== null && _c !== void 0 ? _c : false; + } + return !!aliasDeclarationLinks.typeOnlyDeclaration; + } + function getTypeOnlyAliasDeclaration(symbol, include) { + if (!(symbol.flags & 2097152)) { + return void 0; + } + var links = getSymbolLinks(symbol); + if (include === void 0) { + return links.typeOnlyDeclaration || void 0; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : void 0; + } + return void 0; + } + function markExportAsReferenced(node) { + var symbol = getSymbolOfNode(node); + var target = resolveAlias(symbol); + if (target) { + var markAlias = target === unknownSymbol || getAllSymbolFlags(target) & 111551 && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration( + symbol, + 111551 + /* SymbolFlags.Value */ + ); + if (markAlias) { + markAliasSymbolAsReferenced(symbol); + } + } + } + function markAliasSymbolAsReferenced(symbol) { + var links = getSymbolLinks(symbol); + if (!links.referenced) { + links.referenced = true; + var node = getDeclarationOfAliasSymbol(symbol); + if (!node) + return ts6.Debug.fail(); + if (ts6.isInternalModuleImportEqualsDeclaration(node)) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551) { + checkExpressionCached(node.moduleReference); + } + } + } + } + function markConstEnumAliasAsReferenced(symbol) { + var links = getSymbolLinks(symbol); + if (!links.constEnumReferenced) { + links.constEnumReferenced = true; + } + } + function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) { + if (entityName.kind === 79 && ts6.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (entityName.kind === 79 || entityName.parent.kind === 163) { + return resolveEntityName( + entityName, + 1920, + /*ignoreErrors*/ + false, + dontResolveAlias + ); + } else { + ts6.Debug.assert( + entityName.parent.kind === 268 + /* SyntaxKind.ImportEqualsDeclaration */ + ); + return resolveEntityName( + entityName, + 111551 | 788968 | 1920, + /*ignoreErrors*/ + false, + dontResolveAlias + ); + } + } + function getFullyQualifiedName(symbol, containingLocation) { + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString( + symbol, + containingLocation, + /*meaning*/ + void 0, + 32 | 4 + /* SymbolFormatFlags.AllowAnyNodeKind */ + ); + } + function getContainingQualifiedNameNode(node) { + while (ts6.isQualifiedName(node.parent)) { + node = node.parent; + } + return node; + } + function tryGetQualifiedNameAsValue(node) { + var left = ts6.getFirstIdentifier(node); + var symbol = resolveName( + left, + left.escapedText, + 111551, + void 0, + left, + /*isUse*/ + true + ); + if (!symbol) { + return void 0; + } + while (ts6.isQualifiedName(left.parent)) { + var type = getTypeOfSymbol(symbol); + symbol = getPropertyOfType(type, left.parent.right.escapedText); + if (!symbol) { + return void 0; + } + left = left.parent; + } + return symbol; + } + function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { + if (ts6.nodeIsMissing(name)) { + return void 0; + } + var namespaceMeaning = 1920 | (ts6.isInJSFile(name) ? meaning & 111551 : 0); + var symbol; + if (name.kind === 79) { + var message = meaning === namespaceMeaning || ts6.nodeIsSynthesized(name) ? ts6.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(ts6.getFirstIdentifier(name)); + var symbolFromJSPrototype = ts6.isInJSFile(name) && !ts6.nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0; + symbol = getMergedSymbol(resolveName( + location || name, + name.escapedText, + meaning, + ignoreErrors || symbolFromJSPrototype ? void 0 : message, + name, + /*isUse*/ + true, + false + )); + if (!symbol) { + return getMergedSymbol(symbolFromJSPrototype); + } + } else if (name.kind === 163 || name.kind === 208) { + var left = name.kind === 163 ? name.left : name.expression; + var right = name.kind === 163 ? name.right : name.name; + var namespace = resolveEntityName( + left, + namespaceMeaning, + ignoreErrors, + /*dontResolveAlias*/ + false, + location + ); + if (!namespace || ts6.nodeIsMissing(right)) { + return void 0; + } else if (namespace === unknownSymbol) { + return namespace; + } + if (namespace.valueDeclaration && ts6.isInJSFile(namespace.valueDeclaration) && ts6.isVariableDeclaration(namespace.valueDeclaration) && namespace.valueDeclaration.initializer && isCommonJsRequire(namespace.valueDeclaration.initializer)) { + var moduleName = namespace.valueDeclaration.initializer.arguments[0]; + var moduleSym = resolveExternalModuleName(moduleName, moduleName); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + namespace = resolvedModuleSymbol; + } + } + } + symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, meaning)); + if (!symbol) { + if (!ignoreErrors) { + var namespaceName = getFullyQualifiedName(namespace); + var declarationName = ts6.declarationNameToString(right); + var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace); + if (suggestionForNonexistentModule) { + error(right, ts6.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule)); + return void 0; + } + var containingQualifiedName = ts6.isQualifiedName(name) && getContainingQualifiedNameNode(name); + var canSuggestTypeof = globalObjectType && meaning & 788968 && containingQualifiedName && !ts6.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName); + if (canSuggestTypeof) { + error(containingQualifiedName, ts6.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts6.entityNameToString(containingQualifiedName)); + return void 0; + } + if (meaning & 1920 && ts6.isQualifiedName(name.parent)) { + var exportedTypeSymbol = getMergedSymbol(getSymbol( + getExportsOfSymbol(namespace), + right.escapedText, + 788968 + /* SymbolFlags.Type */ + )); + if (exportedTypeSymbol) { + error(name.parent.right, ts6.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts6.unescapeLeadingUnderscores(name.parent.right.escapedText)); + return void 0; + } + } + error(right, ts6.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName); + } + return void 0; + } + } else { + throw ts6.Debug.assertNever(name, "Unknown entity name kind."); + } + ts6.Debug.assert((ts6.getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); + if (!ts6.nodeIsSynthesized(name) && ts6.isEntityName(name) && (symbol.flags & 2097152 || name.parent.kind === 274)) { + markSymbolOfAliasDeclarationIfTypeOnly( + ts6.getAliasDeclarationFromName(name), + symbol, + /*finalTarget*/ + void 0, + /*overwriteEmpty*/ + true + ); + } + return symbol.flags & meaning || dontResolveAlias ? symbol : resolveAlias(symbol); + } + function resolveEntityNameFromAssignmentDeclaration(name, meaning) { + if (isJSDocTypeReference(name.parent)) { + var secondaryLocation = getAssignmentDeclarationLocation(name.parent); + if (secondaryLocation) { + return resolveName( + secondaryLocation, + name.escapedText, + meaning, + /*nameNotFoundMessage*/ + void 0, + name, + /*isUse*/ + true + ); + } + } + } + function getAssignmentDeclarationLocation(node) { + var typeAlias = ts6.findAncestor(node, function(node2) { + return !(ts6.isJSDocNode(node2) || node2.flags & 8388608) ? "quit" : ts6.isJSDocTypeAlias(node2); + }); + if (typeAlias) { + return; + } + var host2 = ts6.getJSDocHost(node); + if (host2 && ts6.isExpressionStatement(host2) && ts6.isPrototypePropertyAssignment(host2.expression)) { + var symbol = getSymbolOfNode(host2.expression.left); + if (symbol) { + return getDeclarationOfJSPrototypeContainer(symbol); + } + } + if (host2 && ts6.isFunctionExpression(host2) && ts6.isPrototypePropertyAssignment(host2.parent) && ts6.isExpressionStatement(host2.parent.parent)) { + var symbol = getSymbolOfNode(host2.parent.left); + if (symbol) { + return getDeclarationOfJSPrototypeContainer(symbol); + } + } + if (host2 && (ts6.isObjectLiteralMethod(host2) || ts6.isPropertyAssignment(host2)) && ts6.isBinaryExpression(host2.parent.parent) && ts6.getAssignmentDeclarationKind(host2.parent.parent) === 6) { + var symbol = getSymbolOfNode(host2.parent.parent.left); + if (symbol) { + return getDeclarationOfJSPrototypeContainer(symbol); + } + } + var sig = ts6.getEffectiveJSDocHost(node); + if (sig && ts6.isFunctionLike(sig)) { + var symbol = getSymbolOfNode(sig); + return symbol && symbol.valueDeclaration; + } + } + function getDeclarationOfJSPrototypeContainer(symbol) { + var decl = symbol.parent.valueDeclaration; + if (!decl) { + return void 0; + } + var initializer = ts6.isAssignmentDeclaration(decl) ? ts6.getAssignedExpandoInitializer(decl) : ts6.hasOnlyExpressionInitializer(decl) ? ts6.getDeclaredExpandoInitializer(decl) : void 0; + return initializer || decl; + } + function getExpandoSymbol(symbol) { + var decl = symbol.valueDeclaration; + if (!decl || !ts6.isInJSFile(decl) || symbol.flags & 524288 || ts6.getExpandoInitializer( + decl, + /*isPrototypeAssignment*/ + false + )) { + return void 0; + } + var init = ts6.isVariableDeclaration(decl) ? ts6.getDeclaredExpandoInitializer(decl) : ts6.getAssignedExpandoInitializer(decl); + if (init) { + var initSymbol = getSymbolOfNode(init); + if (initSymbol) { + return mergeJSSymbols(initSymbol, symbol); + } + } + } + function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) { + var isClassic = ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Classic; + var errorMessage = isClassic ? ts6.Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option : ts6.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; + return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage); + } + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { + if (isForAugmentation === void 0) { + isForAugmentation = false; + } + return ts6.isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0; + } + function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) { + var _a, _b, _c, _d, _e, _f, _g, _h; + if (isForAugmentation === void 0) { + isForAugmentation = false; + } + if (ts6.startsWith(moduleReference, "@types/")) { + var diag = ts6.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1; + var withoutAtTypePrefix = ts6.removePrefix(moduleReference, "@types/"); + error(errorNode, diag, withoutAtTypePrefix, moduleReference); + } + var ambientModule = tryFindAmbientModule( + moduleReference, + /*withAugmentations*/ + true + ); + if (ambientModule) { + return ambientModule; + } + var currentSourceFile = ts6.getSourceFileOfNode(location); + var contextSpecifier = ts6.isStringLiteralLike(location) ? location : ((_a = ts6.findAncestor(location, ts6.isImportCall)) === null || _a === void 0 ? void 0 : _a.arguments[0]) || ((_b = ts6.findAncestor(location, ts6.isImportDeclaration)) === null || _b === void 0 ? void 0 : _b.moduleSpecifier) || ((_c = ts6.findAncestor(location, ts6.isExternalModuleImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.moduleReference.expression) || ((_d = ts6.findAncestor(location, ts6.isExportDeclaration)) === null || _d === void 0 ? void 0 : _d.moduleSpecifier) || ((_e = ts6.isModuleDeclaration(location) ? location : location.parent && ts6.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) === null || _e === void 0 ? void 0 : _e.name) || ((_f = ts6.isLiteralImportTypeNode(location) ? location : void 0) === null || _f === void 0 ? void 0 : _f.argument.literal); + var mode = contextSpecifier && ts6.isStringLiteralLike(contextSpecifier) ? ts6.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat; + var resolvedModule = ts6.getResolvedModule(currentSourceFile, moduleReference, mode); + var resolutionDiagnostic = resolvedModule && ts6.getResolutionDiagnostic(compilerOptions, resolvedModule); + var sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === ts6.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName); + if (sourceFile) { + if (resolutionDiagnostic) { + error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); + } + if (sourceFile.symbol) { + if (resolvedModule.isExternalLibraryImport && !ts6.resolutionExtensionIsTSOrJson(resolvedModule.extension)) { + errorOnImplicitAnyModule( + /*isError*/ + false, + errorNode, + resolvedModule, + moduleReference + ); + } + if (ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeNext) { + var isSyncImport = currentSourceFile.impliedNodeFormat === ts6.ModuleKind.CommonJS && !ts6.findAncestor(location, ts6.isImportCall) || !!ts6.findAncestor(location, ts6.isImportEqualsDeclaration); + var overrideClauseHost = ts6.findAncestor(location, function(l) { + return ts6.isImportTypeNode(l) || ts6.isExportDeclaration(l) || ts6.isImportDeclaration(l); + }); + var overrideClause = overrideClauseHost && ts6.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause; + if (isSyncImport && sourceFile.impliedNodeFormat === ts6.ModuleKind.ESNext && !ts6.getResolutionModeOverrideForClause(overrideClause)) { + if (ts6.findAncestor(location, ts6.isImportEqualsDeclaration)) { + error(errorNode, ts6.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference); + } else { + var diagnosticDetails = void 0; + var ext = ts6.tryGetExtensionFromPath(currentSourceFile.fileName); + if (ext === ".ts" || ext === ".js" || ext === ".tsx" || ext === ".jsx") { + var scope = currentSourceFile.packageJsonScope; + var targetExt = ext === ".ts" ? ".mts" : ext === ".js" ? ".mjs" : void 0; + if (scope && !scope.contents.packageJsonContent.type) { + if (targetExt) { + diagnosticDetails = ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, + targetExt, + ts6.combinePaths(scope.packageDirectory, "package.json") + ); + } else { + diagnosticDetails = ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, + ts6.combinePaths(scope.packageDirectory, "package.json") + ); + } + } else { + if (targetExt) { + diagnosticDetails = ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, + targetExt + ); + } else { + diagnosticDetails = ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module + ); + } + } + } + diagnostics.add(ts6.createDiagnosticForNodeFromMessageChain(errorNode, ts6.chainDiagnosticMessages(diagnosticDetails, ts6.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference))); + } + } + } + return getMergedSymbol(sourceFile.symbol); + } + if (moduleNotFoundError) { + error(errorNode, ts6.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + } + return void 0; + } + if (patternAmbientModules) { + var pattern = ts6.findBestPatternMatch(patternAmbientModules, function(_) { + return _.pattern; + }, moduleReference); + if (pattern) { + var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference); + if (augmentation) { + return getMergedSymbol(augmentation); + } + return getMergedSymbol(pattern.symbol); + } + } + if (resolvedModule && !ts6.resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === ts6.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) { + if (isForAugmentation) { + var diag = ts6.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); + } else { + errorOnImplicitAnyModule( + /*isError*/ + noImplicitAny && !!moduleNotFoundError, + errorNode, + resolvedModule, + moduleReference + ); + } + return void 0; + } + if (moduleNotFoundError) { + if (resolvedModule) { + var redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName); + if (redirect) { + error(errorNode, ts6.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName); + return void 0; + } + } + if (resolutionDiagnostic) { + error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); + } else { + var tsExtension = ts6.tryExtractTSExtension(moduleReference); + var isExtensionlessRelativePathImport = ts6.pathIsRelative(moduleReference) && !ts6.hasExtension(moduleReference); + var moduleResolutionKind = ts6.getEmitModuleResolutionKind(compilerOptions); + var resolutionIsNode16OrNext = moduleResolutionKind === ts6.ModuleResolutionKind.Node16 || moduleResolutionKind === ts6.ModuleResolutionKind.NodeNext; + if (tsExtension) { + var diag = ts6.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; + var importSourceWithoutExtension = ts6.removeExtension(moduleReference, tsExtension); + var replacedImportSource = importSourceWithoutExtension; + if (moduleKind >= ts6.ModuleKind.ES2015) { + replacedImportSource += tsExtension === ".mts" ? ".mjs" : tsExtension === ".cts" ? ".cjs" : ".js"; + } + error(errorNode, diag, tsExtension, replacedImportSource); + } else if (!compilerOptions.resolveJsonModule && ts6.fileExtensionIs( + moduleReference, + ".json" + /* Extension.Json */ + ) && ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.Classic && ts6.hasJsonModuleEmitEnabled(compilerOptions)) { + error(errorNode, ts6.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference); + } else if (mode === ts6.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) { + var absoluteRef_1 = ts6.getNormalizedAbsolutePath(moduleReference, ts6.getDirectoryPath(currentSourceFile.path)); + var suggestedExt = (_h = suggestedExtensions.find(function(_a2) { + var actualExt = _a2[0], _importExt = _a2[1]; + return host.fileExists(absoluteRef_1 + actualExt); + })) === null || _h === void 0 ? void 0 : _h[1]; + if (suggestedExt) { + error(errorNode, ts6.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt); + } else { + error(errorNode, ts6.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path); + } + } else { + error(errorNode, moduleNotFoundError, moduleReference); + } + } + } + return void 0; + } + function errorOnImplicitAnyModule(isError, errorNode, _a, moduleReference) { + var packageId = _a.packageId, resolvedFileName = _a.resolvedFileName; + var errorInfo = !ts6.isExternalModuleNameRelative(moduleReference) && packageId ? typesPackageExists(packageId.name) ? ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1, + packageId.name, + ts6.mangleScopedPackageName(packageId.name) + ) : packageBundlesTypes(packageId.name) ? ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1, + packageId.name, + moduleReference + ) : ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, + moduleReference, + ts6.mangleScopedPackageName(packageId.name) + ) : void 0; + errorOrSuggestion(isError, errorNode, ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedFileName)); + } + function typesPackageExists(packageName) { + return getPackagesMap().has(ts6.getTypesPackageName(packageName)); + } + function packageBundlesTypes(packageName) { + return !!getPackagesMap().get(packageName); + } + function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { + if (moduleSymbol === null || moduleSymbol === void 0 ? void 0 : moduleSymbol.exports) { + var exportEquals = resolveSymbol(moduleSymbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ), dontResolveAlias); + var exported = getCommonJsExportEquals(getMergedSymbol(exportEquals), getMergedSymbol(moduleSymbol)); + return getMergedSymbol(exported) || moduleSymbol; + } + return void 0; + } + function getCommonJsExportEquals(exported, moduleSymbol) { + if (!exported || exported === unknownSymbol || exported === moduleSymbol || moduleSymbol.exports.size === 1 || exported.flags & 2097152) { + return exported; + } + var links = getSymbolLinks(exported); + if (links.cjsExportMerged) { + return links.cjsExportMerged; + } + var merged = exported.flags & 33554432 ? exported : cloneSymbol(exported); + merged.flags = merged.flags | 512; + if (merged.exports === void 0) { + merged.exports = ts6.createSymbolTable(); + } + moduleSymbol.exports.forEach(function(s, name) { + if (name === "export=") + return; + merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s); + }); + getSymbolLinks(merged).cjsExportMerged = merged; + return links.cjsExportMerged = merged; + } + function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias, suppressInteropError) { + var _a; + var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); + if (!dontResolveAlias && symbol) { + if (!suppressInteropError && !(symbol.flags & (1536 | 3)) && !ts6.getDeclarationOfKind( + symbol, + 308 + /* SyntaxKind.SourceFile */ + )) { + var compilerOptionName = moduleKind >= ts6.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; + error(referencingLocation, ts6.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName); + return symbol; + } + var referenceParent = referencingLocation.parent; + if (ts6.isImportDeclaration(referenceParent) && ts6.getNamespaceDeclarationNode(referenceParent) || ts6.isImportCall(referenceParent)) { + var reference = ts6.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier; + var type = getTypeOfSymbol(symbol); + var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference); + if (defaultOnlyType) { + return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent); + } + var targetFile = (_a = moduleSymbol === null || moduleSymbol === void 0 ? void 0 : moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isSourceFile); + var isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat); + if (ts6.getESModuleInterop(compilerOptions) || isEsmCjsRef) { + var sigs = getSignaturesOfStructuredType( + type, + 0 + /* SignatureKind.Call */ + ); + if (!sigs || !sigs.length) { + sigs = getSignaturesOfStructuredType( + type, + 1 + /* SignatureKind.Construct */ + ); + } + if (sigs && sigs.length || getPropertyOfType( + type, + "default", + /*skipObjectFunctionPropertyAugment*/ + true + ) || isEsmCjsRef) { + var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference); + return cloneTypeAsModuleType(symbol, moduleType, referenceParent); + } + } + } + } + return symbol; + } + function cloneTypeAsModuleType(symbol, moduleType, referenceParent) { + var result = createSymbol(symbol.flags, symbol.escapedName); + result.declarations = symbol.declarations ? symbol.declarations.slice() : []; + result.parent = symbol.parent; + result.target = symbol; + result.originatingImport = referenceParent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = new ts6.Map(symbol.members); + if (symbol.exports) + result.exports = new ts6.Map(symbol.exports); + var resolvedModuleType = resolveStructuredTypeMembers(moduleType); + result.type = createAnonymousType(result, resolvedModuleType.members, ts6.emptyArray, ts6.emptyArray, resolvedModuleType.indexInfos); + return result; + } + function hasExportAssignmentSymbol(moduleSymbol) { + return moduleSymbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ) !== void 0; + } + function getExportsOfModuleAsArray(moduleSymbol) { + return symbolsToArray(getExportsOfModule(moduleSymbol)); + } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports2 = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + var type = getTypeOfSymbol(exportEquals); + if (shouldTreatPropertiesOfExternalModuleAsExports(type)) { + ts6.addRange(exports2, getPropertiesOfType(type)); + } + } + return exports2; + } + function forEachExportAndPropertyOfModule(moduleSymbol, cb) { + var exports2 = getExportsOfModule(moduleSymbol); + exports2.forEach(function(symbol, key) { + if (!isReservedMemberName(key)) { + cb(symbol, key); + } + }); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + var type = getTypeOfSymbol(exportEquals); + if (shouldTreatPropertiesOfExternalModuleAsExports(type)) { + forEachPropertyOfType(type, function(symbol, escapedName) { + cb(symbol, escapedName); + }); + } + } + } + function tryGetMemberInModuleExports(memberName, moduleSymbol) { + var symbolTable = getExportsOfModule(moduleSymbol); + if (symbolTable) { + return symbolTable.get(memberName); + } + } + function tryGetMemberInModuleExportsAndProperties(memberName, moduleSymbol) { + var symbol = tryGetMemberInModuleExports(memberName, moduleSymbol); + if (symbol) { + return symbol; + } + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals === moduleSymbol) { + return void 0; + } + var type = getTypeOfSymbol(exportEquals); + return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0; + } + function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) { + return !(resolvedExternalModuleType.flags & 131068 || ts6.getObjectFlags(resolvedExternalModuleType) & 1 || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path + isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType)); + } + function getExportsOfSymbol(symbol) { + return symbol.flags & 6256 ? getResolvedMembersOrExportsOfSymbol( + symbol, + "resolvedExports" + /* MembersOrExportsResolutionKind.resolvedExports */ + ) : symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; + } + function getExportsOfModule(moduleSymbol) { + var links = getSymbolLinks(moduleSymbol); + return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol)); + } + function extendExportSymbols(target, source, lookupTable, exportNode) { + if (!source) + return; + source.forEach(function(sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); + if (lookupTable && exportNode) { + lookupTable.set(id, { + specifierText: ts6.getTextOfNode(exportNode.moduleSpecifier) + }); + } + } else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; + } else { + collisionTracker.exportsWithDuplicate.push(exportNode); + } + } + }); + } + function getExportsOfModuleWorker(moduleSymbol) { + var visitedSymbols = []; + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + return visit(moduleSymbol) || emptySymbols; + function visit(symbol) { + if (!(symbol && symbol.exports && ts6.pushIfUnique(visitedSymbols, symbol))) { + return; + } + var symbols = new ts6.Map(symbol.exports); + var exportStars = symbol.exports.get( + "__export" + /* InternalSymbolName.ExportStar */ + ); + if (exportStars) { + var nestedSymbols = ts6.createSymbolTable(); + var lookupTable_1 = new ts6.Map(); + if (exportStars.declarations) { + for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + var exportedSymbols = visit(resolvedModule); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); + } + } + lookupTable_1.forEach(function(_a2, id) { + var exportsWithDuplicate = _a2.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; + } + for (var _i2 = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i2 < exportsWithDuplicate_1.length; _i2++) { + var node2 = exportsWithDuplicate_1[_i2]; + diagnostics.add(ts6.createDiagnosticForNode(node2, ts6.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, ts6.unescapeLeadingUnderscores(id))); + } + }); + extendExportSymbols(symbols, nestedSymbols); + } + return symbols; + } + } + function getMergedSymbol(symbol) { + var merged; + return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; + } + function getSymbolOfNode(node) { + return getMergedSymbol(node.symbol && getLateBoundSymbol(node.symbol)); + } + function getParentOfSymbol(symbol) { + return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent)); + } + function getAlternativeContainingModules(symbol, enclosingDeclaration) { + var containingFile = ts6.getSourceFileOfNode(enclosingDeclaration); + var id = getNodeId(containingFile); + var links = getSymbolLinks(symbol); + var results; + if (links.extendedContainersByFile && (results = links.extendedContainersByFile.get(id))) { + return results; + } + if (containingFile && containingFile.imports) { + for (var _i = 0, _a = containingFile.imports; _i < _a.length; _i++) { + var importRef = _a[_i]; + if (ts6.nodeIsSynthesized(importRef)) + continue; + var resolvedModule = resolveExternalModuleName( + enclosingDeclaration, + importRef, + /*ignoreErrors*/ + true + ); + if (!resolvedModule) + continue; + var ref = getAliasForSymbolInContainer(resolvedModule, symbol); + if (!ref) + continue; + results = ts6.append(results, resolvedModule); + } + if (ts6.length(results)) { + (links.extendedContainersByFile || (links.extendedContainersByFile = new ts6.Map())).set(id, results); + return results; + } + } + if (links.extendedContainers) { + return links.extendedContainers; + } + var otherFiles = host.getSourceFiles(); + for (var _b = 0, otherFiles_1 = otherFiles; _b < otherFiles_1.length; _b++) { + var file = otherFiles_1[_b]; + if (!ts6.isExternalModule(file)) + continue; + var sym = getSymbolOfNode(file); + var ref = getAliasForSymbolInContainer(sym, symbol); + if (!ref) + continue; + results = ts6.append(results, sym); + } + return links.extendedContainers = results || ts6.emptyArray; + } + function getContainersOfSymbol(symbol, enclosingDeclaration, meaning) { + var container = getParentOfSymbol(symbol); + if (container && !(symbol.flags & 262144)) { + var additionalContainers = ts6.mapDefined(container.declarations, fileSymbolIfFileSymbolExportEqualsContainer); + var reexportContainers = enclosingDeclaration && getAlternativeContainingModules(symbol, enclosingDeclaration); + var objectLiteralContainer = getVariableDeclarationOfObjectLiteral(container, meaning); + if (enclosingDeclaration && container.flags & getQualifiedLeftMeaning(meaning) && getAccessibleSymbolChain( + container, + enclosingDeclaration, + 1920, + /*externalOnly*/ + false + )) { + return ts6.append(ts6.concatenate(ts6.concatenate([container], additionalContainers), reexportContainers), objectLiteralContainer); + } + var firstVariableMatch = !(container.flags & getQualifiedLeftMeaning(meaning)) && container.flags & 788968 && getDeclaredTypeOfSymbol(container).flags & 524288 && meaning === 111551 ? forEachSymbolTableInScope(enclosingDeclaration, function(t) { + return ts6.forEachEntry(t, function(s) { + if (s.flags & getQualifiedLeftMeaning(meaning) && getTypeOfSymbol(s) === getDeclaredTypeOfSymbol(container)) { + return s; + } + }); + }) : void 0; + var res = firstVariableMatch ? __spreadArray(__spreadArray([firstVariableMatch], additionalContainers, true), [container], false) : __spreadArray(__spreadArray([], additionalContainers, true), [container], false); + res = ts6.append(res, objectLiteralContainer); + res = ts6.addRange(res, reexportContainers); + return res; + } + var candidates = ts6.mapDefined(symbol.declarations, function(d) { + if (!ts6.isAmbientModule(d) && d.parent) { + if (hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) { + return getSymbolOfNode(d.parent); + } + if (ts6.isModuleBlock(d.parent) && d.parent.parent && resolveExternalModuleSymbol(getSymbolOfNode(d.parent.parent)) === symbol) { + return getSymbolOfNode(d.parent.parent); + } + } + if (ts6.isClassExpression(d) && ts6.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 && ts6.isAccessExpression(d.parent.left) && ts6.isEntityNameExpression(d.parent.left.expression)) { + if (ts6.isModuleExportsAccessExpression(d.parent.left) || ts6.isExportsIdentifier(d.parent.left.expression)) { + return getSymbolOfNode(ts6.getSourceFileOfNode(d)); + } + checkExpressionCached(d.parent.left.expression); + return getNodeLinks(d.parent.left.expression).resolvedSymbol; + } + }); + if (!ts6.length(candidates)) { + return void 0; + } + return ts6.mapDefined(candidates, function(candidate) { + return getAliasForSymbolInContainer(candidate, symbol) ? candidate : void 0; + }); + function fileSymbolIfFileSymbolExportEqualsContainer(d) { + return container && getFileSymbolIfFileSymbolExportEqualsContainer(d, container); + } + } + function getVariableDeclarationOfObjectLiteral(symbol, meaning) { + var firstDecl = !!ts6.length(symbol.declarations) && ts6.first(symbol.declarations); + if (meaning & 111551 && firstDecl && firstDecl.parent && ts6.isVariableDeclaration(firstDecl.parent)) { + if (ts6.isObjectLiteralExpression(firstDecl) && firstDecl === firstDecl.parent.initializer || ts6.isTypeLiteralNode(firstDecl) && firstDecl === firstDecl.parent.type) { + return getSymbolOfNode(firstDecl.parent); + } + } + } + function getFileSymbolIfFileSymbolExportEqualsContainer(d, container) { + var fileSymbol = getExternalModuleContainer(d); + var exported = fileSymbol && fileSymbol.exports && fileSymbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + return exported && getSymbolIfSameReference(exported, container) ? fileSymbol : void 0; + } + function getAliasForSymbolInContainer(container, symbol) { + if (container === getParentOfSymbol(symbol)) { + return symbol; + } + var exportEquals = container.exports && container.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + if (exportEquals && getSymbolIfSameReference(exportEquals, symbol)) { + return container; + } + var exports2 = getExportsOfSymbol(container); + var quick = exports2.get(symbol.escapedName); + if (quick && getSymbolIfSameReference(quick, symbol)) { + return quick; + } + return ts6.forEachEntry(exports2, function(exported) { + if (getSymbolIfSameReference(exported, symbol)) { + return exported; + } + }); + } + function getSymbolIfSameReference(s1, s2) { + if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) { + return s1; + } + } + function getExportSymbolOfValueSymbolIfExported(symbol) { + return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0 && symbol.exportSymbol || symbol); + } + function symbolIsValue(symbol, includeTypeOnlyMembers) { + return !!(symbol.flags & 111551 || symbol.flags & 2097152 && getAllSymbolFlags(symbol) & 111551 && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + } + function findConstructorDeclaration(node) { + var members = node.members; + for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { + var member = members_3[_i]; + if (member.kind === 173 && ts6.nodeIsPresent(member.body)) { + return member; + } + } + } + function createType(flags) { + var result = new Type(checker, flags); + typeCount++; + result.id = typeCount; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.recordType(result); + return result; + } + function createOriginType(flags) { + return new Type(checker, flags); + } + function createIntrinsicType(kind, intrinsicName, objectFlags) { + if (objectFlags === void 0) { + objectFlags = 0; + } + var type = createType(kind); + type.intrinsicName = intrinsicName; + type.objectFlags = objectFlags; + return type; + } + function createObjectType(objectFlags, symbol) { + var type = createType( + 524288 + /* TypeFlags.Object */ + ); + type.objectFlags = objectFlags; + type.symbol = symbol; + type.members = void 0; + type.properties = void 0; + type.callSignatures = void 0; + type.constructSignatures = void 0; + type.indexInfos = void 0; + return type; + } + function createTypeofType() { + return getUnionType(ts6.arrayFrom(typeofNEFacts.keys(), getStringLiteralType)); + } + function createTypeParameter(symbol) { + var type = createType( + 262144 + /* TypeFlags.TypeParameter */ + ); + if (symbol) + type.symbol = symbol; + return type; + } + function isReservedMemberName(name) { + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64 && name.charCodeAt(2) !== 35; + } + function getNamedMembers(members) { + var result; + members.forEach(function(symbol, id) { + if (isNamedMember(symbol, id)) { + (result || (result = [])).push(symbol); + } + }); + return result || ts6.emptyArray; + } + function isNamedMember(member, escapedName) { + return !isReservedMemberName(escapedName) && symbolIsValue(member); + } + function getNamedOrIndexSignatureMembers(members) { + var result = getNamedMembers(members); + var index = getIndexSymbolFromSymbolTable(members); + return index ? ts6.concatenate(result, [index]) : result; + } + function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos) { + var resolved = type; + resolved.members = members; + resolved.properties = ts6.emptyArray; + resolved.callSignatures = callSignatures; + resolved.constructSignatures = constructSignatures; + resolved.indexInfos = indexInfos; + if (members !== emptySymbols) + resolved.properties = getNamedMembers(members); + return resolved; + } + function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) { + return setStructuredTypeMembers(createObjectType(16, symbol), members, callSignatures, constructSignatures, indexInfos); + } + function getResolvedTypeWithoutAbstractConstructSignatures(type) { + if (type.constructSignatures.length === 0) + return type; + if (type.objectTypeWithoutAbstractConstructSignatures) + return type.objectTypeWithoutAbstractConstructSignatures; + var constructSignatures = ts6.filter(type.constructSignatures, function(signature) { + return !(signature.flags & 4); + }); + if (type.constructSignatures === constructSignatures) + return type; + var typeCopy = createAnonymousType(type.symbol, type.members, type.callSignatures, ts6.some(constructSignatures) ? constructSignatures : ts6.emptyArray, type.indexInfos); + type.objectTypeWithoutAbstractConstructSignatures = typeCopy; + typeCopy.objectTypeWithoutAbstractConstructSignatures = typeCopy; + return typeCopy; + } + function forEachSymbolTableInScope(enclosingDeclaration, callback) { + var result; + var _loop_8 = function(location2) { + if (location2.locals && !isGlobalSourceFile(location2)) { + if (result = callback( + location2.locals, + /*ignoreQualification*/ + void 0, + /*isLocalNameLookup*/ + true, + location2 + )) { + return { value: result }; + } + } + switch (location2.kind) { + case 308: + if (!ts6.isExternalOrCommonJsModule(location2)) { + break; + } + case 264: + var sym = getSymbolOfNode(location2); + if (result = callback( + (sym === null || sym === void 0 ? void 0 : sym.exports) || emptySymbols, + /*ignoreQualification*/ + void 0, + /*isLocalNameLookup*/ + true, + location2 + )) { + return { value: result }; + } + break; + case 260: + case 228: + case 261: + var table_1; + (getSymbolOfNode(location2).members || emptySymbols).forEach(function(memberSymbol, key) { + if (memberSymbol.flags & (788968 & ~67108864)) { + (table_1 || (table_1 = ts6.createSymbolTable())).set(key, memberSymbol); + } + }); + if (table_1 && (result = callback( + table_1, + /*ignoreQualification*/ + void 0, + /*isLocalNameLookup*/ + false, + location2 + ))) { + return { value: result }; + } + break; + } + }; + for (var location = enclosingDeclaration; location; location = location.parent) { + var state_2 = _loop_8(location); + if (typeof state_2 === "object") + return state_2.value; + } + return callback( + globals, + /*ignoreQualification*/ + void 0, + /*isLocalNameLookup*/ + true + ); + } + function getQualifiedLeftMeaning(rightMeaning) { + return rightMeaning === 111551 ? 111551 : 1920; + } + function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) { + if (visitedSymbolTablesMap === void 0) { + visitedSymbolTablesMap = new ts6.Map(); + } + if (!(symbol && !isPropertyOrMethodDeclarationSymbol(symbol))) { + return void 0; + } + var links = getSymbolLinks(symbol); + var cache = links.accessibleChainCache || (links.accessibleChainCache = new ts6.Map()); + var firstRelevantLocation = forEachSymbolTableInScope(enclosingDeclaration, function(_, __, ___, node) { + return node; + }); + var key = "".concat(useOnlyExternalAliasing ? 0 : 1, "|").concat(firstRelevantLocation && getNodeId(firstRelevantLocation), "|").concat(meaning); + if (cache.has(key)) { + return cache.get(key); + } + var id = getSymbolId(symbol); + var visitedSymbolTables = visitedSymbolTablesMap.get(id); + if (!visitedSymbolTables) { + visitedSymbolTablesMap.set(id, visitedSymbolTables = []); + } + var result = forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + cache.set(key, result); + return result; + function getAccessibleSymbolChainFromSymbolTable(symbols, ignoreQualification, isLocalNameLookup) { + if (!ts6.pushIfUnique(visitedSymbolTables, symbols)) { + return void 0; + } + var result2 = trySymbolTable(symbols, ignoreQualification, isLocalNameLookup); + visitedSymbolTables.pop(); + return result2; + } + function canQualifySymbol(symbolFromSymbolTable, meaning2) { + return !needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning2) || // If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too + !!getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning2), useOnlyExternalAliasing, visitedSymbolTablesMap); + } + function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol, ignoreQualification) { + return (symbol === (resolvedAliasSymbol || symbolFromSymbolTable) || getMergedSymbol(symbol) === getMergedSymbol(resolvedAliasSymbol || symbolFromSymbolTable)) && // if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table) + // and if symbolFromSymbolTable or alias resolution matches the symbol, + // check the symbol can be qualified, it is only then this symbol is accessible + !ts6.some(symbolFromSymbolTable.declarations, hasNonGlobalAugmentationExternalModuleSymbol) && (ignoreQualification || canQualifySymbol(getMergedSymbol(symbolFromSymbolTable), meaning)); + } + function trySymbolTable(symbols, ignoreQualification, isLocalNameLookup) { + if (isAccessible( + symbols.get(symbol.escapedName), + /*resolvedAliasSymbol*/ + void 0, + ignoreQualification + )) { + return [symbol]; + } + var result2 = ts6.forEachEntry(symbols, function(symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 2097152 && symbolFromSymbolTable.escapedName !== "export=" && symbolFromSymbolTable.escapedName !== "default" && !(ts6.isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && ts6.isExternalModule(ts6.getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || ts6.some(symbolFromSymbolTable.declarations, ts6.isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !ts6.some(symbolFromSymbolTable.declarations, ts6.isNamespaceReexportDeclaration) : true) && (ignoreQualification || !ts6.getDeclarationOfKind( + symbolFromSymbolTable, + 278 + /* SyntaxKind.ExportSpecifier */ + ))) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); + if (candidate) { + return candidate; + } + } + if (symbolFromSymbolTable.escapedName === symbol.escapedName && symbolFromSymbolTable.exportSymbol) { + if (isAccessible( + getMergedSymbol(symbolFromSymbolTable.exportSymbol), + /*aliasSymbol*/ + void 0, + ignoreQualification + )) { + return [symbol]; + } + } + }); + return result2 || (symbols === globals ? getCandidateListForSymbol(globalThisSymbol, globalThisSymbol, ignoreQualification) : void 0); + } + function getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification) { + if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) { + return [symbolFromSymbolTable]; + } + var candidateTable = getExportsOfSymbol(resolvedImportedSymbol); + var accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable( + candidateTable, + /*ignoreQualification*/ + true + ); + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } + } + } + function needsQualification(symbol, enclosingDeclaration, meaning) { + var qualify = false; + forEachSymbolTableInScope(enclosingDeclaration, function(symbolTable) { + var symbolFromSymbolTable = getMergedSymbol(symbolTable.get(symbol.escapedName)); + if (!symbolFromSymbolTable) { + return false; + } + if (symbolFromSymbolTable === symbol) { + return true; + } + var shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 && !ts6.getDeclarationOfKind( + symbolFromSymbolTable, + 278 + /* SyntaxKind.ExportSpecifier */ + ); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { + qualify = true; + return true; + } + return false; + }); + return qualify; + } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 169: + case 171: + case 174: + case 175: + continue; + default: + return false; + } + } + return true; + } + return false; + } + function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) { + var access = isSymbolAccessibleWorker( + typeSymbol, + enclosingDeclaration, + 788968, + /*shouldComputeAliasesToMakeVisible*/ + false, + /*allowModules*/ + true + ); + return access.accessibility === 0; + } + function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) { + var access = isSymbolAccessibleWorker( + typeSymbol, + enclosingDeclaration, + 111551, + /*shouldComputeAliasesToMakeVisible*/ + false, + /*allowModules*/ + true + ); + return access.accessibility === 0; + } + function isSymbolAccessibleByFlags(typeSymbol, enclosingDeclaration, flags) { + var access = isSymbolAccessibleWorker( + typeSymbol, + enclosingDeclaration, + flags, + /*shouldComputeAliasesToMakeVisible*/ + false, + /*allowModules*/ + false + ); + return access.accessibility === 0; + } + function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible, allowModules) { + if (!ts6.length(symbols)) + return; + var hadAccessibleChain; + var earlyModuleBail = false; + for (var _i = 0, _a = symbols; _i < _a.length; _i++) { + var symbol = _a[_i]; + var accessibleSymbolChain = getAccessibleSymbolChain( + symbol, + enclosingDeclaration, + meaning, + /*useOnlyExternalAliasing*/ + false + ); + if (accessibleSymbolChain) { + hadAccessibleChain = symbol; + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible); + if (hasAccessibleDeclarations) { + return hasAccessibleDeclarations; + } + } + if (allowModules) { + if (ts6.some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { + if (shouldComputeAliasesToMakeVisible) { + earlyModuleBail = true; + continue; + } + return { + accessibility: 0 + /* SymbolAccessibility.Accessible */ + }; + } + } + var containers = getContainersOfSymbol(symbol, enclosingDeclaration, meaning); + var parentResult = isAnySymbolAccessible(containers, enclosingDeclaration, initialSymbol, initialSymbol === symbol ? getQualifiedLeftMeaning(meaning) : meaning, shouldComputeAliasesToMakeVisible, allowModules); + if (parentResult) { + return parentResult; + } + } + if (earlyModuleBail) { + return { + accessibility: 0 + /* SymbolAccessibility.Accessible */ + }; + } + if (hadAccessibleChain) { + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: hadAccessibleChain !== initialSymbol ? symbolToString( + hadAccessibleChain, + enclosingDeclaration, + 1920 + /* SymbolFlags.Namespace */ + ) : void 0 + }; + } + } + function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) { + return isSymbolAccessibleWorker( + symbol, + enclosingDeclaration, + meaning, + shouldComputeAliasesToMakeVisible, + /*allowModules*/ + true + ); + } + function isSymbolAccessibleWorker(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible, allowModules) { + if (symbol && enclosingDeclaration) { + var result = isAnySymbolAccessible([symbol], enclosingDeclaration, symbol, meaning, shouldComputeAliasesToMakeVisible, allowModules); + if (result) { + return result; + } + var symbolExternalModule = ts6.forEach(symbol.declarations, getExternalModuleContainer); + if (symbolExternalModule) { + var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + if (symbolExternalModule !== enclosingExternalModule) { + return { + accessibility: 2, + errorSymbolName: symbolToString(symbol, enclosingDeclaration, meaning), + errorModuleName: symbolToString(symbolExternalModule), + errorNode: ts6.isInJSFile(enclosingDeclaration) ? enclosingDeclaration : void 0 + }; + } + } + return { + accessibility: 1, + errorSymbolName: symbolToString(symbol, enclosingDeclaration, meaning) + }; + } + return { + accessibility: 0 + /* SymbolAccessibility.Accessible */ + }; + } + function getExternalModuleContainer(declaration) { + var node = ts6.findAncestor(declaration, hasExternalModuleSymbol); + return node && getSymbolOfNode(node); + } + function hasExternalModuleSymbol(declaration) { + return ts6.isAmbientModule(declaration) || declaration.kind === 308 && ts6.isExternalOrCommonJsModule(declaration); + } + function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { + return ts6.isModuleWithStringLiteralName(declaration) || declaration.kind === 308 && ts6.isExternalOrCommonJsModule(declaration); + } + function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { + var aliasesToMakeVisible; + if (!ts6.every(ts6.filter(symbol.declarations, function(d) { + return d.kind !== 79; + }), getIsDeclarationVisible)) { + return void 0; + } + return { accessibility: 0, aliasesToMakeVisible }; + function getIsDeclarationVisible(declaration) { + var _a, _b; + if (!isDeclarationVisible(declaration)) { + var anyImportSyntax = getAnyImportSyntax(declaration); + if (anyImportSyntax && !ts6.hasSyntacticModifier( + anyImportSyntax, + 1 + /* ModifierFlags.Export */ + ) && // import clause without export + isDeclarationVisible(anyImportSyntax.parent)) { + return addVisibleAlias(declaration, anyImportSyntax); + } else if (ts6.isVariableDeclaration(declaration) && ts6.isVariableStatement(declaration.parent.parent) && !ts6.hasSyntacticModifier( + declaration.parent.parent, + 1 + /* ModifierFlags.Export */ + ) && // unexported variable statement + isDeclarationVisible(declaration.parent.parent.parent)) { + return addVisibleAlias(declaration, declaration.parent.parent); + } else if (ts6.isLateVisibilityPaintedStatement(declaration) && !ts6.hasSyntacticModifier( + declaration, + 1 + /* ModifierFlags.Export */ + ) && isDeclarationVisible(declaration.parent)) { + return addVisibleAlias(declaration, declaration); + } else if (ts6.isBindingElement(declaration)) { + if (symbol.flags & 2097152 && ts6.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent) && ts6.isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts6.isVariableStatement(declaration.parent.parent.parent.parent) && !ts6.hasSyntacticModifier( + declaration.parent.parent.parent.parent, + 1 + /* ModifierFlags.Export */ + ) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) { + return addVisibleAlias(declaration, declaration.parent.parent.parent.parent); + } else if (symbol.flags & 2) { + var variableStatement = ts6.findAncestor(declaration, ts6.isVariableStatement); + if (ts6.hasSyntacticModifier( + variableStatement, + 1 + /* ModifierFlags.Export */ + )) { + return true; + } + if (!isDeclarationVisible(variableStatement.parent)) { + return false; + } + return addVisibleAlias(declaration, variableStatement); + } + } + return false; + } + return true; + } + function addVisibleAlias(declaration, aliasingStatement) { + if (shouldComputeAliasToMakeVisible) { + getNodeLinks(declaration).isVisible = true; + aliasesToMakeVisible = ts6.appendIfUnique(aliasesToMakeVisible, aliasingStatement); + } + return true; + } + } + function isEntityNameVisible(entityName, enclosingDeclaration) { + var meaning; + if (entityName.parent.kind === 183 || entityName.parent.kind === 230 && !ts6.isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 164) { + meaning = 111551 | 1048576; + } else if (entityName.kind === 163 || entityName.kind === 208 || entityName.parent.kind === 268) { + meaning = 1920; + } else { + meaning = 788968; + } + var firstIdentifier = ts6.getFirstIdentifier(entityName); + var symbol = resolveName( + enclosingDeclaration, + firstIdentifier.escapedText, + meaning, + /*nodeNotFoundErrorMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + ); + if (symbol && symbol.flags & 262144 && meaning & 788968) { + return { + accessibility: 0 + /* SymbolAccessibility.Accessible */ + }; + } + if (!symbol && ts6.isThisIdentifier(firstIdentifier) && isSymbolAccessible( + getSymbolOfNode(ts6.getThisContainer( + firstIdentifier, + /*includeArrowFunctions*/ + false + )), + firstIdentifier, + meaning, + /*computeAliases*/ + false + ).accessibility === 0) { + return { + accessibility: 0 + /* SymbolAccessibility.Accessible */ + }; + } + return symbol && hasVisibleDeclarations( + symbol, + /*shouldComputeAliasToMakeVisible*/ + true + ) || { + accessibility: 1, + errorSymbolName: ts6.getTextOfNode(firstIdentifier), + errorNode: firstIdentifier + }; + } + function symbolToString(symbol, enclosingDeclaration, meaning, flags, writer) { + if (flags === void 0) { + flags = 4; + } + var nodeFlags = 70221824; + if (flags & 2) { + nodeFlags |= 128; + } + if (flags & 1) { + nodeFlags |= 512; + } + if (flags & 8) { + nodeFlags |= 16384; + } + if (flags & 32) { + nodeFlags |= 134217728; + } + if (flags & 16) { + nodeFlags |= 1073741824; + } + var builder = flags & 4 ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; + return writer ? symbolToStringWorker(writer).getText() : ts6.usingSingleLineStringWriter(symbolToStringWorker); + function symbolToStringWorker(writer2) { + var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 ? ts6.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts6.createPrinter({ removeComments: true }); + var sourceFile = enclosingDeclaration && ts6.getSourceFileOfNode(enclosingDeclaration); + printer.writeNode( + 4, + entity, + /*sourceFile*/ + sourceFile, + writer2 + ); + return writer2; + } + } + function signatureToString(signature, enclosingDeclaration, flags, kind, writer) { + if (flags === void 0) { + flags = 0; + } + return writer ? signatureToStringWorker(writer).getText() : ts6.usingSingleLineStringWriter(signatureToStringWorker); + function signatureToStringWorker(writer2) { + var sigOutput; + if (flags & 262144) { + sigOutput = kind === 1 ? 182 : 181; + } else { + sigOutput = kind === 1 ? 177 : 176; + } + var sig = nodeBuilder.signatureToSignatureDeclaration( + signature, + sigOutput, + enclosingDeclaration, + toNodeBuilderFlags(flags) | 70221824 | 512 + /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */ + ); + var printer = ts6.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); + var sourceFile = enclosingDeclaration && ts6.getSourceFileOfNode(enclosingDeclaration); + printer.writeNode( + 4, + sig, + /*sourceFile*/ + sourceFile, + ts6.getTrailingSemicolonDeferringWriter(writer2) + ); + return writer2; + } + } + function typeToString(type, enclosingDeclaration, flags, writer) { + if (flags === void 0) { + flags = 1048576 | 16384; + } + if (writer === void 0) { + writer = ts6.createTextWriter(""); + } + var noTruncation = compilerOptions.noErrorTruncation || flags & 1; + var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | (noTruncation ? 1 : 0), writer); + if (typeNode === void 0) + return ts6.Debug.fail("should always get typenode"); + var options = { removeComments: type !== unresolvedType }; + var printer = ts6.createPrinter(options); + var sourceFile = enclosingDeclaration && ts6.getSourceFileOfNode(enclosingDeclaration); + printer.writeNode( + 4, + typeNode, + /*sourceFile*/ + sourceFile, + writer + ); + var result = writer.getText(); + var maxLength = noTruncation ? ts6.noTruncationMaximumTruncationLength * 2 : ts6.defaultMaximumTruncationLength * 2; + if (maxLength && result && result.length >= maxLength) { + return result.substr(0, maxLength - "...".length) + "..."; + } + return result; + } + function getTypeNamesForErrorDisplay(left, right) { + var leftStr = symbolValueDeclarationIsContextSensitive(left.symbol) ? typeToString(left, left.symbol.valueDeclaration) : typeToString(left); + var rightStr = symbolValueDeclarationIsContextSensitive(right.symbol) ? typeToString(right, right.symbol.valueDeclaration) : typeToString(right); + if (leftStr === rightStr) { + leftStr = getTypeNameForErrorDisplay(left); + rightStr = getTypeNameForErrorDisplay(right); + } + return [leftStr, rightStr]; + } + function getTypeNameForErrorDisplay(type) { + return typeToString( + type, + /*enclosingDeclaration*/ + void 0, + 64 + /* TypeFormatFlags.UseFullyQualifiedType */ + ); + } + function symbolValueDeclarationIsContextSensitive(symbol) { + return symbol && !!symbol.valueDeclaration && ts6.isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration); + } + function toNodeBuilderFlags(flags) { + if (flags === void 0) { + flags = 0; + } + return flags & 848330091; + } + function isClassInstanceSide(type) { + return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288) && !!(ts6.getObjectFlags(type) & 16777216)); + } + function createNodeBuilder() { + return { + typeToTypeNode: function(type, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return typeToTypeNodeHelper(type, context); + }); + }, + indexInfoToIndexSignatureDeclaration: function(indexInfo, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return indexInfoToIndexSignatureDeclarationHelper( + indexInfo, + context, + /*typeNode*/ + void 0 + ); + }); + }, + signatureToSignatureDeclaration: function(signature, kind, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return signatureToSignatureDeclarationHelper(signature, kind, context); + }); + }, + symbolToEntityName: function(symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return symbolToName( + symbol, + context, + meaning, + /*expectsIdentifier*/ + false + ); + }); + }, + symbolToExpression: function(symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return symbolToExpression(symbol, context, meaning); + }); + }, + symbolToTypeParameterDeclarations: function(symbol, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return typeParametersToTypeParameterDeclarations(symbol, context); + }); + }, + symbolToParameterDeclaration: function(symbol, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return symbolToParameterDeclaration(symbol, context); + }); + }, + typeParameterToDeclaration: function(parameter, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return typeParameterToDeclaration(parameter, context); + }); + }, + symbolTableToDeclarationStatements: function(symbolTable, enclosingDeclaration, flags, tracker, bundled) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return symbolTableToDeclarationStatements(symbolTable, context, bundled); + }); + }, + symbolToNode: function(symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function(context) { + return symbolToNode(symbol, context, meaning); + }); + } + }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824) { + if (symbol.valueDeclaration) { + var name = ts6.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts6.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 | 8192)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts6.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } + function withContext(enclosingDeclaration, flags, tracker, cb) { + var _a, _b; + ts6.Debug.assert(enclosingDeclaration === void 0 || (enclosingDeclaration.flags & 8) === 0); + var context = { + enclosingDeclaration, + flags: flags || 0, + // If no full tracker is provided, fake up a dummy one with a basic limited-functionality moduleResolverHost + tracker: tracker && tracker.trackSymbol ? tracker : { trackSymbol: function() { + return false; + }, moduleResolverHost: flags & 134217728 ? { + getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function() { + return host.getCommonSourceDirectory(); + } : function() { + return ""; + }, + getCurrentDirectory: function() { + return host.getCurrentDirectory(); + }, + getSymlinkCache: ts6.maybeBind(host, host.getSymlinkCache), + getPackageJsonInfoCache: function() { + var _a2; + return (_a2 = host.getPackageJsonInfoCache) === null || _a2 === void 0 ? void 0 : _a2.call(host); + }, + useCaseSensitiveFileNames: ts6.maybeBind(host, host.useCaseSensitiveFileNames), + redirectTargetsMap: host.redirectTargetsMap, + getProjectReferenceRedirect: function(fileName) { + return host.getProjectReferenceRedirect(fileName); + }, + isSourceOfProjectReferenceRedirect: function(fileName) { + return host.isSourceOfProjectReferenceRedirect(fileName); + }, + fileExists: function(fileName) { + return host.fileExists(fileName); + }, + getFileIncludeReasons: function() { + return host.getFileIncludeReasons(); + }, + readFile: host.readFile ? function(fileName) { + return host.readFile(fileName); + } : void 0 + } : void 0 }, + encounteredError: false, + reportedDiagnostic: false, + visitedTypes: void 0, + symbolDepth: void 0, + inferTypeParameters: void 0, + approximateLength: 0 + }; + context.tracker = wrapSymbolTrackerToReportForContext(context, context.tracker); + var resultingNode = cb(context); + if (context.truncating && context.flags & 1) { + (_b = (_a = context.tracker) === null || _a === void 0 ? void 0 : _a.reportTruncationError) === null || _b === void 0 ? void 0 : _b.call(_a); + } + return context.encounteredError ? void 0 : resultingNode; + } + function wrapSymbolTrackerToReportForContext(context, tracker) { + var oldTrackSymbol = tracker.trackSymbol; + return __assign(__assign({}, tracker), { reportCyclicStructureError: wrapReportedDiagnostic(tracker.reportCyclicStructureError), reportInaccessibleThisError: wrapReportedDiagnostic(tracker.reportInaccessibleThisError), reportInaccessibleUniqueSymbolError: wrapReportedDiagnostic(tracker.reportInaccessibleUniqueSymbolError), reportLikelyUnsafeImportRequiredError: wrapReportedDiagnostic(tracker.reportLikelyUnsafeImportRequiredError), reportNonlocalAugmentation: wrapReportedDiagnostic(tracker.reportNonlocalAugmentation), reportPrivateInBaseOfClassExpression: wrapReportedDiagnostic(tracker.reportPrivateInBaseOfClassExpression), reportNonSerializableProperty: wrapReportedDiagnostic(tracker.reportNonSerializableProperty), trackSymbol: oldTrackSymbol && function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var result = oldTrackSymbol.apply(void 0, args); + if (result) { + context.reportedDiagnostic = true; + } + return result; + } }); + function wrapReportedDiagnostic(method) { + if (!method) { + return method; + } + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + context.reportedDiagnostic = true; + return method.apply(void 0, args); + }; + } + } + function checkTruncationLength(context) { + if (context.truncating) + return context.truncating; + return context.truncating = context.approximateLength > (context.flags & 1 ? ts6.noTruncationMaximumTruncationLength : ts6.defaultMaximumTruncationLength); + } + function typeToTypeNodeHelper(type, context) { + var savedFlags = context.flags; + var typeNode = typeToTypeNodeWorker(type, context); + context.flags = savedFlags; + return typeNode; + } + function typeToTypeNodeWorker(type, context) { + if (cancellationToken && cancellationToken.throwIfCancellationRequested) { + cancellationToken.throwIfCancellationRequested(); + } + var inTypeAlias = context.flags & 8388608; + context.flags &= ~8388608; + if (!type) { + if (!(context.flags & 262144)) { + context.encounteredError = true; + return void 0; + } + context.approximateLength += 3; + return ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + if (!(context.flags & 536870912)) { + type = getReducedType(type); + } + if (type.flags & 1) { + if (type.aliasSymbol) { + return ts6.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); + } + if (type === unresolvedType) { + return ts6.addSyntheticLeadingComment(ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ), 3, "unresolved"); + } + context.approximateLength += 3; + return ts6.factory.createKeywordTypeNode( + type === intrinsicMarkerType ? 139 : 131 + /* SyntaxKind.AnyKeyword */ + ); + } + if (type.flags & 2) { + return ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + ); + } + if (type.flags & 4) { + context.approximateLength += 6; + return ts6.factory.createKeywordTypeNode( + 152 + /* SyntaxKind.StringKeyword */ + ); + } + if (type.flags & 8) { + context.approximateLength += 6; + return ts6.factory.createKeywordTypeNode( + 148 + /* SyntaxKind.NumberKeyword */ + ); + } + if (type.flags & 64) { + context.approximateLength += 6; + return ts6.factory.createKeywordTypeNode( + 160 + /* SyntaxKind.BigIntKeyword */ + ); + } + if (type.flags & 16 && !type.aliasSymbol) { + context.approximateLength += 7; + return ts6.factory.createKeywordTypeNode( + 134 + /* SyntaxKind.BooleanKeyword */ + ); + } + if (type.flags & 1024 && !(type.flags & 1048576)) { + var parentSymbol = getParentOfSymbol(type.symbol); + var parentName = symbolToTypeNode( + parentSymbol, + context, + 788968 + /* SymbolFlags.Type */ + ); + if (getDeclaredTypeOfSymbol(parentSymbol) === type) { + return parentName; + } + var memberName = ts6.symbolName(type.symbol); + if (ts6.isIdentifierText( + memberName, + 0 + /* ScriptTarget.ES3 */ + )) { + return appendReferenceToType(parentName, ts6.factory.createTypeReferenceNode( + memberName, + /*typeArguments*/ + void 0 + )); + } + if (ts6.isImportTypeNode(parentName)) { + parentName.isTypeOf = true; + return ts6.factory.createIndexedAccessTypeNode(parentName, ts6.factory.createLiteralTypeNode(ts6.factory.createStringLiteral(memberName))); + } else if (ts6.isTypeReferenceNode(parentName)) { + return ts6.factory.createIndexedAccessTypeNode(ts6.factory.createTypeQueryNode(parentName.typeName), ts6.factory.createLiteralTypeNode(ts6.factory.createStringLiteral(memberName))); + } else { + return ts6.Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`."); + } + } + if (type.flags & 1056) { + return symbolToTypeNode( + type.symbol, + context, + 788968 + /* SymbolFlags.Type */ + ); + } + if (type.flags & 128) { + context.approximateLength += type.value.length + 2; + return ts6.factory.createLiteralTypeNode(ts6.setEmitFlags( + ts6.factory.createStringLiteral(type.value, !!(context.flags & 268435456)), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + )); + } + if (type.flags & 256) { + var value = type.value; + context.approximateLength += ("" + value).length; + return ts6.factory.createLiteralTypeNode(value < 0 ? ts6.factory.createPrefixUnaryExpression(40, ts6.factory.createNumericLiteral(-value)) : ts6.factory.createNumericLiteral(value)); + } + if (type.flags & 2048) { + context.approximateLength += ts6.pseudoBigIntToString(type.value).length + 1; + return ts6.factory.createLiteralTypeNode(ts6.factory.createBigIntLiteral(type.value)); + } + if (type.flags & 512) { + context.approximateLength += type.intrinsicName.length; + return ts6.factory.createLiteralTypeNode(type.intrinsicName === "true" ? ts6.factory.createTrue() : ts6.factory.createFalse()); + } + if (type.flags & 8192) { + if (!(context.flags & 1048576)) { + if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { + context.approximateLength += 6; + return symbolToTypeNode( + type.symbol, + context, + 111551 + /* SymbolFlags.Value */ + ); + } + if (context.tracker.reportInaccessibleUniqueSymbolError) { + context.tracker.reportInaccessibleUniqueSymbolError(); + } + } + context.approximateLength += 13; + return ts6.factory.createTypeOperatorNode(156, ts6.factory.createKeywordTypeNode( + 153 + /* SyntaxKind.SymbolKeyword */ + )); + } + if (type.flags & 16384) { + context.approximateLength += 4; + return ts6.factory.createKeywordTypeNode( + 114 + /* SyntaxKind.VoidKeyword */ + ); + } + if (type.flags & 32768) { + context.approximateLength += 9; + return ts6.factory.createKeywordTypeNode( + 155 + /* SyntaxKind.UndefinedKeyword */ + ); + } + if (type.flags & 65536) { + context.approximateLength += 4; + return ts6.factory.createLiteralTypeNode(ts6.factory.createNull()); + } + if (type.flags & 131072) { + context.approximateLength += 5; + return ts6.factory.createKeywordTypeNode( + 144 + /* SyntaxKind.NeverKeyword */ + ); + } + if (type.flags & 4096) { + context.approximateLength += 6; + return ts6.factory.createKeywordTypeNode( + 153 + /* SyntaxKind.SymbolKeyword */ + ); + } + if (type.flags & 67108864) { + context.approximateLength += 6; + return ts6.factory.createKeywordTypeNode( + 149 + /* SyntaxKind.ObjectKeyword */ + ); + } + if (ts6.isThisTypeParameter(type)) { + if (context.flags & 4194304) { + if (!context.encounteredError && !(context.flags & 32768)) { + context.encounteredError = true; + } + if (context.tracker.reportInaccessibleThisError) { + context.tracker.reportInaccessibleThisError(); + } + } + context.approximateLength += 4; + return ts6.factory.createThisTypeNode(); + } + if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) { + var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); + if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32)) + return ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier(""), typeArgumentNodes); + if (ts6.length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) { + return ts6.factory.createArrayTypeNode(typeArgumentNodes[0]); + } + return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes); + } + var objectFlags = ts6.getObjectFlags(type); + if (objectFlags & 4) { + ts6.Debug.assert(!!(type.flags & 524288)); + return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type); + } + if (type.flags & 262144 || objectFlags & 3) { + if (type.flags & 262144 && ts6.contains(context.inferTypeParameters, type)) { + context.approximateLength += ts6.symbolName(type.symbol).length + 6; + var constraintNode = void 0; + var constraint = getConstraintOfTypeParameter(type); + if (constraint) { + var inferredConstraint = getInferredTypeParameterConstraint( + type, + /*omitTypeReferences*/ + true + ); + if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) { + context.approximateLength += 9; + constraintNode = constraint && typeToTypeNodeHelper(constraint, context); + } + } + return ts6.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode)); + } + if (context.flags & 4 && type.flags & 262144 && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) { + var name_2 = typeParameterToName(type, context); + context.approximateLength += ts6.idText(name_2).length; + return ts6.factory.createTypeReferenceNode( + ts6.factory.createIdentifier(ts6.idText(name_2)), + /*typeArguments*/ + void 0 + ); + } + if (type.symbol) { + return symbolToTypeNode( + type.symbol, + context, + 788968 + /* SymbolFlags.Type */ + ); + } + var name = (type === markerSuperTypeForCheck || type === markerSubTypeForCheck) && varianceTypeParameter && varianceTypeParameter.symbol ? (type === markerSubTypeForCheck ? "sub-" : "super-") + ts6.symbolName(varianceTypeParameter.symbol) : "?"; + return ts6.factory.createTypeReferenceNode( + ts6.factory.createIdentifier(name), + /*typeArguments*/ + void 0 + ); + } + if (type.flags & 1048576 && type.origin) { + type = type.origin; + } + if (type.flags & (1048576 | 2097152)) { + var types = type.flags & 1048576 ? formatUnionTypes(type.types) : type.types; + if (ts6.length(types) === 1) { + return typeToTypeNodeHelper(types[0], context); + } + var typeNodes = mapToTypeNodes( + types, + context, + /*isBareList*/ + true + ); + if (typeNodes && typeNodes.length > 0) { + return type.flags & 1048576 ? ts6.factory.createUnionTypeNode(typeNodes) : ts6.factory.createIntersectionTypeNode(typeNodes); + } else { + if (!context.encounteredError && !(context.flags & 262144)) { + context.encounteredError = true; + } + return void 0; + } + } + if (objectFlags & (16 | 32)) { + ts6.Debug.assert(!!(type.flags & 524288)); + return createAnonymousTypeNode(type); + } + if (type.flags & 4194304) { + var indexedType = type.type; + context.approximateLength += 6; + var indexTypeNode = typeToTypeNodeHelper(indexedType, context); + return ts6.factory.createTypeOperatorNode(141, indexTypeNode); + } + if (type.flags & 134217728) { + var texts_1 = type.texts; + var types_1 = type.types; + var templateHead = ts6.factory.createTemplateHead(texts_1[0]); + var templateSpans = ts6.factory.createNodeArray(ts6.map(types_1, function(t, i) { + return ts6.factory.createTemplateLiteralTypeSpan(typeToTypeNodeHelper(t, context), (i < types_1.length - 1 ? ts6.factory.createTemplateMiddle : ts6.factory.createTemplateTail)(texts_1[i + 1])); + })); + context.approximateLength += 2; + return ts6.factory.createTemplateLiteralType(templateHead, templateSpans); + } + if (type.flags & 268435456) { + var typeNode = typeToTypeNodeHelper(type.type, context); + return symbolToTypeNode(type.symbol, context, 788968, [typeNode]); + } + if (type.flags & 8388608) { + var objectTypeNode = typeToTypeNodeHelper(type.objectType, context); + var indexTypeNode = typeToTypeNodeHelper(type.indexType, context); + context.approximateLength += 2; + return ts6.factory.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); + } + if (type.flags & 16777216) { + return visitAndTransformType(type, function(type2) { + return conditionalTypeToTypeNode(type2); + }); + } + if (type.flags & 33554432) { + return typeToTypeNodeHelper(type.baseType, context); + } + return ts6.Debug.fail("Should be unreachable."); + function conditionalTypeToTypeNode(type2) { + var checkTypeNode = typeToTypeNodeHelper(type2.checkType, context); + context.approximateLength += 15; + if (context.flags & 4 && type2.root.isDistributive && !(type2.checkType.flags & 262144)) { + var newParam = createTypeParameter(createSymbol(262144, "T")); + var name2 = typeParameterToName(newParam, context); + var newTypeVariable = ts6.factory.createTypeReferenceNode(name2); + context.approximateLength += 37; + var newMapper = prependTypeMapping(type2.root.checkType, newParam, type2.mapper); + var saveInferTypeParameters_1 = context.inferTypeParameters; + context.inferTypeParameters = type2.root.inferTypeParameters; + var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context); + context.inferTypeParameters = saveInferTypeParameters_1; + var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type2.root.node.trueType), newMapper)); + var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type2.root.node.falseType), newMapper)); + return ts6.factory.createConditionalTypeNode(checkTypeNode, ts6.factory.createInferTypeNode(ts6.factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + ts6.factory.cloneNode(newTypeVariable.typeName) + )), ts6.factory.createConditionalTypeNode(ts6.factory.createTypeReferenceNode(ts6.factory.cloneNode(name2)), typeToTypeNodeHelper(type2.checkType, context), ts6.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts6.factory.createKeywordTypeNode( + 144 + /* SyntaxKind.NeverKeyword */ + )), ts6.factory.createKeywordTypeNode( + 144 + /* SyntaxKind.NeverKeyword */ + )); + } + var saveInferTypeParameters = context.inferTypeParameters; + context.inferTypeParameters = type2.root.inferTypeParameters; + var extendsTypeNode = typeToTypeNodeHelper(type2.extendsType, context); + context.inferTypeParameters = saveInferTypeParameters; + var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type2)); + var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type2)); + return ts6.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode); + } + function typeToTypeNodeOrCircularityElision(type2) { + var _a, _b, _c; + if (type2.flags & 1048576) { + if ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(getTypeId(type2))) { + if (!(context.flags & 131072)) { + context.encounteredError = true; + (_c = (_b = context.tracker) === null || _b === void 0 ? void 0 : _b.reportCyclicStructureError) === null || _c === void 0 ? void 0 : _c.call(_b); + } + return createElidedInformationPlaceholder(context); + } + return visitAndTransformType(type2, function(type3) { + return typeToTypeNodeHelper(type3, context); + }); + } + return typeToTypeNodeHelper(type2, context); + } + function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) { + return isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 262144); + } + function createMappedTypeNodeFromType(type2) { + ts6.Debug.assert(!!(type2.flags & 524288)); + var readonlyToken = type2.declaration.readonlyToken ? ts6.factory.createToken(type2.declaration.readonlyToken.kind) : void 0; + var questionToken = type2.declaration.questionToken ? ts6.factory.createToken(type2.declaration.questionToken.kind) : void 0; + var appropriateConstraintTypeNode; + var newTypeVariable; + if (isMappedTypeWithKeyofConstraintDeclaration(type2)) { + if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4) { + var newParam = createTypeParameter(createSymbol(262144, "T")); + var name2 = typeParameterToName(newParam, context); + newTypeVariable = ts6.factory.createTypeReferenceNode(name2); + } + appropriateConstraintTypeNode = ts6.factory.createTypeOperatorNode(141, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)); + } else { + appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context); + } + var typeParameterNode = typeParameterToDeclarationWithConstraint(getTypeParameterFromMappedType(type2), context, appropriateConstraintTypeNode); + var nameTypeNode = type2.declaration.nameType ? typeToTypeNodeHelper(getNameTypeFromMappedType(type2), context) : void 0; + var templateTypeNode = typeToTypeNodeHelper(removeMissingType(getTemplateTypeFromMappedType(type2), !!(getMappedTypeModifiers(type2) & 4)), context); + var mappedTypeNode = ts6.factory.createMappedTypeNode( + readonlyToken, + typeParameterNode, + nameTypeNode, + questionToken, + templateTypeNode, + /*members*/ + void 0 + ); + context.approximateLength += 10; + var result = ts6.setEmitFlags( + mappedTypeNode, + 1 + /* EmitFlags.SingleLine */ + ); + if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4) { + var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper); + return ts6.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context), ts6.factory.createInferTypeNode(ts6.factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + ts6.factory.cloneNode(newTypeVariable.typeName), + originalConstraint.flags & 2 ? void 0 : typeToTypeNodeHelper(originalConstraint, context) + )), result, ts6.factory.createKeywordTypeNode( + 144 + /* SyntaxKind.NeverKeyword */ + )); + } + return result; + } + function createAnonymousTypeNode(type2) { + var _a; + var typeId = type2.id; + var symbol = type2.symbol; + if (symbol) { + var isInstanceType = isClassInstanceSide(type2) ? 788968 : 111551; + if (isJSConstructor(symbol.valueDeclaration)) { + return symbolToTypeNode(symbol, context, isInstanceType); + } else if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && ts6.isClassLike(symbol.valueDeclaration) && context.flags & 2048 && (!ts6.isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible( + symbol, + context.enclosingDeclaration, + isInstanceType, + /*computeAliases*/ + false + ).accessibility !== 0)) || symbol.flags & (384 | 512) || shouldWriteTypeOfFunctionSymbol()) { + return symbolToTypeNode(symbol, context, isInstanceType); + } else if ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(typeId)) { + var typeAlias = getTypeAliasForTypeLiteral(type2); + if (typeAlias) { + return symbolToTypeNode( + typeAlias, + context, + 788968 + /* SymbolFlags.Type */ + ); + } else { + return createElidedInformationPlaceholder(context); + } + } else { + return visitAndTransformType(type2, createTypeNodeFromObjectType); + } + } else { + return createTypeNodeFromObjectType(type2); + } + function shouldWriteTypeOfFunctionSymbol() { + var _a2; + var isStaticMethodSymbol = !!(symbol.flags & 8192) && // typeof static method + ts6.some(symbol.declarations, function(declaration) { + return ts6.isStatic(declaration); + }); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || // is exported function symbol + ts6.forEach(symbol.declarations, function(declaration) { + return declaration.parent.kind === 308 || declaration.parent.kind === 265; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return (!!(context.flags & 4096) || ((_a2 = context.visitedTypes) === null || _a2 === void 0 ? void 0 : _a2.has(typeId))) && // it is type of the symbol uses itself recursively + (!(context.flags & 8) || isValueSymbolAccessible(symbol, context.enclosingDeclaration)); + } + } + } + function visitAndTransformType(type2, transform) { + var _a, _b; + var typeId = type2.id; + var isConstructorObject = ts6.getObjectFlags(type2) & 16 && type2.symbol && type2.symbol.flags & 32; + var id = ts6.getObjectFlags(type2) & 4 && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0; + if (!context.visitedTypes) { + context.visitedTypes = new ts6.Set(); + } + if (id && !context.symbolDepth) { + context.symbolDepth = new ts6.Map(); + } + var links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration); + var key = "".concat(getTypeId(type2), "|").concat(context.flags); + if (links) { + links.serializedTypes || (links.serializedTypes = new ts6.Map()); + } + var cachedResult = (_a = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _a === void 0 ? void 0 : _a.get(key); + if (cachedResult) { + if (cachedResult.truncating) { + context.truncating = true; + } + context.approximateLength += cachedResult.addedLength; + return deepCloneOrReuseNode(cachedResult); + } + var depth; + if (id) { + depth = context.symbolDepth.get(id) || 0; + if (depth > 10) { + return createElidedInformationPlaceholder(context); + } + context.symbolDepth.set(id, depth + 1); + } + context.visitedTypes.add(typeId); + var startLength = context.approximateLength; + var result = transform(type2); + var addedLength = context.approximateLength - startLength; + if (!context.reportedDiagnostic && !context.encounteredError) { + if (context.truncating) { + result.truncating = true; + } + result.addedLength = addedLength; + (_b = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _b === void 0 ? void 0 : _b.set(key, result); + } + context.visitedTypes.delete(typeId); + if (id) { + context.symbolDepth.set(id, depth); + } + return result; + function deepCloneOrReuseNode(node) { + if (!ts6.nodeIsSynthesized(node) && ts6.getParseTreeNode(node) === node) { + return node; + } + return ts6.setTextRange(ts6.factory.cloneNode(ts6.visitEachChild(node, deepCloneOrReuseNode, ts6.nullTransformationContext, deepCloneOrReuseNodes)), node); + } + function deepCloneOrReuseNodes(nodes, visitor, test, start, count) { + if (nodes && nodes.length === 0) { + return ts6.setTextRange(ts6.factory.createNodeArray( + /*nodes*/ + void 0, + nodes.hasTrailingComma + ), nodes); + } + return ts6.visitNodes(nodes, visitor, test, start, count); + } + } + function createTypeNodeFromObjectType(type2) { + if (isGenericMappedType(type2) || type2.containsError) { + return createMappedTypeNodeFromType(type2); + } + var resolved = resolveStructuredTypeMembers(type2); + if (!resolved.properties.length && !resolved.indexInfos.length) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + context.approximateLength += 2; + return ts6.setEmitFlags( + ts6.factory.createTypeLiteralNode( + /*members*/ + void 0 + ), + 1 + /* EmitFlags.SingleLine */ + ); + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var signature = resolved.callSignatures[0]; + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181, context); + return signatureNode; + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + var signature = resolved.constructSignatures[0]; + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182, context); + return signatureNode; + } + } + var abstractSignatures = ts6.filter(resolved.constructSignatures, function(signature2) { + return !!(signature2.flags & 4); + }); + if (ts6.some(abstractSignatures)) { + var types2 = ts6.map(abstractSignatures, getOrCreateTypeFromSignature); + var typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per + // the logic in `createTypeNodesFromResolvedType`. + (context.flags & 2048 ? ts6.countWhere(resolved.properties, function(p) { + return !(p.flags & 4194304); + }) : ts6.length(resolved.properties)); + if (typeElementCount) { + types2.push(getResolvedTypeWithoutAbstractConstructSignatures(resolved)); + } + return typeToTypeNodeHelper(getIntersectionType(types2), context); + } + var savedFlags = context.flags; + context.flags |= 4194304; + var members = createTypeNodesFromResolvedType(resolved); + context.flags = savedFlags; + var typeLiteralNode = ts6.factory.createTypeLiteralNode(members); + context.approximateLength += 2; + ts6.setEmitFlags( + typeLiteralNode, + context.flags & 1024 ? 0 : 1 + /* EmitFlags.SingleLine */ + ); + return typeLiteralNode; + } + function typeReferenceToTypeNode(type2) { + var typeArguments = getTypeArguments(type2); + if (type2.target === globalArrayType || type2.target === globalReadonlyArrayType) { + if (context.flags & 2) { + var typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context); + return ts6.factory.createTypeReferenceNode(type2.target === globalArrayType ? "Array" : "ReadonlyArray", [typeArgumentNode]); + } + var elementType = typeToTypeNodeHelper(typeArguments[0], context); + var arrayType = ts6.factory.createArrayTypeNode(elementType); + return type2.target === globalArrayType ? arrayType : ts6.factory.createTypeOperatorNode(146, arrayType); + } else if (type2.target.objectFlags & 8) { + typeArguments = ts6.sameMap(typeArguments, function(t, i2) { + return removeMissingType(t, !!(type2.target.elementFlags[i2] & 2)); + }); + if (typeArguments.length > 0) { + var arity = getTypeReferenceArity(type2); + var tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context); + if (tupleConstituentNodes) { + if (type2.target.labeledElementDeclarations) { + for (var i = 0; i < tupleConstituentNodes.length; i++) { + var flags = type2.target.elementFlags[i]; + tupleConstituentNodes[i] = ts6.factory.createNamedTupleMember(flags & 12 ? ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ) : void 0, ts6.factory.createIdentifier(ts6.unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))), flags & 2 ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, flags & 4 ? ts6.factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]); + } + } else { + for (var i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) { + var flags = type2.target.elementFlags[i]; + tupleConstituentNodes[i] = flags & 12 ? ts6.factory.createRestTypeNode(flags & 4 ? ts6.factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]) : flags & 2 ? ts6.factory.createOptionalTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]; + } + } + var tupleTypeNode = ts6.setEmitFlags( + ts6.factory.createTupleTypeNode(tupleConstituentNodes), + 1 + /* EmitFlags.SingleLine */ + ); + return type2.target.readonly ? ts6.factory.createTypeOperatorNode(146, tupleTypeNode) : tupleTypeNode; + } + } + if (context.encounteredError || context.flags & 524288) { + var tupleTypeNode = ts6.setEmitFlags( + ts6.factory.createTupleTypeNode([]), + 1 + /* EmitFlags.SingleLine */ + ); + return type2.target.readonly ? ts6.factory.createTypeOperatorNode(146, tupleTypeNode) : tupleTypeNode; + } + context.encounteredError = true; + return void 0; + } else if (context.flags & 2048 && type2.symbol.valueDeclaration && ts6.isClassLike(type2.symbol.valueDeclaration) && !isValueSymbolAccessible(type2.symbol, context.enclosingDeclaration)) { + return createAnonymousTypeNode(type2); + } else { + var outerTypeParameters = type2.target.outerTypeParameters; + var i = 0; + var resultType = void 0; + if (outerTypeParameters) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { + var start = i; + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + if (!ts6.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context); + var flags_3 = context.flags; + context.flags |= 16; + var ref = symbolToTypeNode(parent, context, 788968, typeArgumentSlice); + context.flags = flags_3; + resultType = !resultType ? ref : appendReferenceToType(resultType, ref); + } + } + } + var typeArgumentNodes2 = void 0; + if (typeArguments.length > 0) { + var typeParameterCount = (type2.target.typeParameters || ts6.emptyArray).length; + typeArgumentNodes2 = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context); + } + var flags = context.flags; + context.flags |= 16; + var finalRef = symbolToTypeNode(type2.symbol, context, 788968, typeArgumentNodes2); + context.flags = flags; + return !resultType ? finalRef : appendReferenceToType(resultType, finalRef); + } + } + function appendReferenceToType(root, ref) { + if (ts6.isImportTypeNode(root)) { + var typeArguments = root.typeArguments; + var qualifier = root.qualifier; + if (qualifier) { + if (ts6.isIdentifier(qualifier)) { + qualifier = ts6.factory.updateIdentifier(qualifier, typeArguments); + } else { + qualifier = ts6.factory.updateQualifiedName(qualifier, qualifier.left, ts6.factory.updateIdentifier(qualifier.right, typeArguments)); + } + } + typeArguments = ref.typeArguments; + var ids = getAccessStack(ref); + for (var _i = 0, ids_1 = ids; _i < ids_1.length; _i++) { + var id = ids_1[_i]; + qualifier = qualifier ? ts6.factory.createQualifiedName(qualifier, id) : id; + } + return ts6.factory.updateImportTypeNode(root, root.argument, root.assertions, qualifier, typeArguments, root.isTypeOf); + } else { + var typeArguments = root.typeArguments; + var typeName = root.typeName; + if (ts6.isIdentifier(typeName)) { + typeName = ts6.factory.updateIdentifier(typeName, typeArguments); + } else { + typeName = ts6.factory.updateQualifiedName(typeName, typeName.left, ts6.factory.updateIdentifier(typeName.right, typeArguments)); + } + typeArguments = ref.typeArguments; + var ids = getAccessStack(ref); + for (var _a = 0, ids_2 = ids; _a < ids_2.length; _a++) { + var id = ids_2[_a]; + typeName = ts6.factory.createQualifiedName(typeName, id); + } + return ts6.factory.updateTypeReferenceNode(root, typeName, typeArguments); + } + } + function getAccessStack(ref) { + var state = ref.typeName; + var ids = []; + while (!ts6.isIdentifier(state)) { + ids.unshift(state.right); + state = state.left; + } + ids.unshift(state); + return ids; + } + function createTypeNodesFromResolvedType(resolvedType) { + if (checkTruncationLength(context)) { + return [ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + "...", + /*questionToken*/ + void 0, + /*type*/ + void 0 + )]; + } + var typeElements = []; + for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176, context)); + } + for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + if (signature.flags & 4) + continue; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177, context)); + } + for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { + var info = _e[_d]; + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(info, context, resolvedType.objectFlags & 1024 ? createElidedInformationPlaceholder(context) : void 0)); + } + var properties = resolvedType.properties; + if (!properties) { + return typeElements; + } + var i = 0; + for (var _f = 0, properties_1 = properties; _f < properties_1.length; _f++) { + var propertySymbol = properties_1[_f]; + i++; + if (context.flags & 2048) { + if (propertySymbol.flags & 4194304) { + continue; + } + if (ts6.getDeclarationModifierFlagsFromSymbol(propertySymbol) & (8 | 16) && context.tracker.reportPrivateInBaseOfClassExpression) { + context.tracker.reportPrivateInBaseOfClassExpression(ts6.unescapeLeadingUnderscores(propertySymbol.escapedName)); + } + } + if (checkTruncationLength(context) && i + 2 < properties.length - 1) { + typeElements.push(ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + "... ".concat(properties.length - i, " more ..."), + /*questionToken*/ + void 0, + /*type*/ + void 0 + )); + addPropertyToElementList(properties[properties.length - 1], context, typeElements); + break; + } + addPropertyToElementList(propertySymbol, context, typeElements); + } + return typeElements.length ? typeElements : void 0; + } + } + function createElidedInformationPlaceholder(context) { + context.approximateLength += 3; + if (!(context.flags & 1)) { + return ts6.factory.createTypeReferenceNode( + ts6.factory.createIdentifier("..."), + /*typeArguments*/ + void 0 + ); + } + return ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + function shouldUsePlaceholderForProperty(propertySymbol, context) { + var _a; + return !!(ts6.getCheckFlags(propertySymbol) & 8192) && (ts6.contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) === null || _a === void 0 ? void 0 : _a[0]) && !(ts6.getObjectFlags(ts6.last(context.reverseMappedStack).propertyType) & 16)); + } + function addPropertyToElementList(propertySymbol, context, typeElements) { + var _a, _b; + var propertyIsReverseMapped = !!(ts6.getCheckFlags(propertySymbol) & 8192); + var propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol); + var saveEnclosingDeclaration = context.enclosingDeclaration; + context.enclosingDeclaration = void 0; + if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) { + if (propertySymbol.declarations) { + var decl = ts6.first(propertySymbol.declarations); + if (hasLateBindableName(decl)) { + if (ts6.isBinaryExpression(decl)) { + var name = ts6.getNameOfDeclaration(decl); + if (name && ts6.isElementAccessExpression(name) && ts6.isPropertyAccessEntityNameExpression(name.argumentExpression)) { + trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context); + } + } else { + trackComputedName(decl.name.expression, saveEnclosingDeclaration, context); + } + } + } else if ((_a = context.tracker) === null || _a === void 0 ? void 0 : _a.reportNonSerializableProperty) { + context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol)); + } + } + context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_b = propertySymbol.declarations) === null || _b === void 0 ? void 0 : _b[0]) || saveEnclosingDeclaration; + var propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); + context.enclosingDeclaration = saveEnclosingDeclaration; + context.approximateLength += ts6.symbolName(propertySymbol).length + 1; + var optionalToken = propertySymbol.flags & 16777216 ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0; + if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) { + var signatures = getSignaturesOfType( + filterType(propertyType, function(t) { + return !(t.flags & 32768); + }), + 0 + /* SignatureKind.Call */ + ); + for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { + var signature = signatures_1[_i]; + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170, context, { name: propertyName, questionToken: optionalToken }); + typeElements.push(preserveCommentsOn(methodDeclaration)); + } + } else { + var propertyTypeNode = void 0; + if (shouldUsePlaceholderForProperty(propertySymbol, context)) { + propertyTypeNode = createElidedInformationPlaceholder(context); + } else { + if (propertyIsReverseMapped) { + context.reverseMappedStack || (context.reverseMappedStack = []); + context.reverseMappedStack.push(propertySymbol); + } + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + if (propertyIsReverseMapped) { + context.reverseMappedStack.pop(); + } + } + var modifiers = isReadonlySymbol(propertySymbol) ? [ts6.factory.createToken( + 146 + /* SyntaxKind.ReadonlyKeyword */ + )] : void 0; + if (modifiers) { + context.approximateLength += 9; + } + var propertySignature = ts6.factory.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode); + typeElements.push(preserveCommentsOn(propertySignature)); + } + function preserveCommentsOn(node) { + var _a2; + if (ts6.some(propertySymbol.declarations, function(d2) { + return d2.kind === 350; + })) { + var d = (_a2 = propertySymbol.declarations) === null || _a2 === void 0 ? void 0 : _a2.find(function(d2) { + return d2.kind === 350; + }); + var commentText = ts6.getTextOfJSDocComment(d.comment); + if (commentText) { + ts6.setSyntheticLeadingComments(node, [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); + } + } else if (propertySymbol.valueDeclaration) { + ts6.setCommentRange(node, propertySymbol.valueDeclaration); + } + return node; + } + } + function mapToTypeNodes(types, context, isBareList) { + if (ts6.some(types)) { + if (checkTruncationLength(context)) { + if (!isBareList) { + return [ts6.factory.createTypeReferenceNode( + "...", + /*typeArguments*/ + void 0 + )]; + } else if (types.length > 2) { + return [ + typeToTypeNodeHelper(types[0], context), + ts6.factory.createTypeReferenceNode( + "... ".concat(types.length - 2, " more ..."), + /*typeArguments*/ + void 0 + ), + typeToTypeNodeHelper(types[types.length - 1], context) + ]; + } + } + var mayHaveNameCollisions = !(context.flags & 64); + var seenNames = mayHaveNameCollisions ? ts6.createUnderscoreEscapedMultiMap() : void 0; + var result_5 = []; + var i = 0; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type = types_2[_i]; + i++; + if (checkTruncationLength(context) && i + 2 < types.length - 1) { + result_5.push(ts6.factory.createTypeReferenceNode( + "... ".concat(types.length - i, " more ..."), + /*typeArguments*/ + void 0 + )); + var typeNode_1 = typeToTypeNodeHelper(types[types.length - 1], context); + if (typeNode_1) { + result_5.push(typeNode_1); + } + break; + } + context.approximateLength += 2; + var typeNode = typeToTypeNodeHelper(type, context); + if (typeNode) { + result_5.push(typeNode); + if (seenNames && ts6.isIdentifierTypeReference(typeNode)) { + seenNames.add(typeNode.typeName.escapedText, [type, result_5.length - 1]); + } + } + } + if (seenNames) { + var saveContextFlags = context.flags; + context.flags |= 64; + seenNames.forEach(function(types2) { + if (!ts6.arrayIsHomogeneous(types2, function(_a2, _b) { + var a = _a2[0]; + var b = _b[0]; + return typesAreSameReference(a, b); + })) { + for (var _i2 = 0, types_3 = types2; _i2 < types_3.length; _i2++) { + var _a = types_3[_i2], type2 = _a[0], resultIndex = _a[1]; + result_5[resultIndex] = typeToTypeNodeHelper(type2, context); + } + } + }); + context.flags = saveContextFlags; + } + return result_5; + } + } + function typesAreSameReference(a, b) { + return a === b || !!a.symbol && a.symbol === b.symbol || !!a.aliasSymbol && a.aliasSymbol === b.aliasSymbol; + } + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, typeNode) { + var name = ts6.getNameFromIndexInfo(indexInfo) || "x"; + var indexerTypeNode = typeToTypeNodeHelper(indexInfo.keyType, context); + var indexingParameter = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + name, + /*questionToken*/ + void 0, + indexerTypeNode, + /*initializer*/ + void 0 + ); + if (!typeNode) { + typeNode = typeToTypeNodeHelper(indexInfo.type || anyType, context); + } + if (!indexInfo.type && !(context.flags & 2097152)) { + context.encounteredError = true; + } + context.approximateLength += name.length + 4; + return ts6.factory.createIndexSignature(indexInfo.isReadonly ? [ts6.factory.createToken( + 146 + /* SyntaxKind.ReadonlyKeyword */ + )] : void 0, [indexingParameter], typeNode); + } + function signatureToSignatureDeclarationHelper(signature, kind, context, options) { + var _a, _b, _c, _d; + var suppressAny = context.flags & 256; + if (suppressAny) + context.flags &= ~256; + context.approximateLength += 3; + var typeParameters; + var typeArguments; + if (context.flags & 32 && signature.target && signature.mapper && signature.target.typeParameters) { + typeArguments = signature.target.typeParameters.map(function(parameter) { + return typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context); + }); + } else { + typeParameters = signature.typeParameters && signature.typeParameters.map(function(parameter) { + return typeParameterToDeclaration(parameter, context); + }); + } + var expandedParams = getExpandedParameters( + signature, + /*skipUnionExpanding*/ + true + )[0]; + var parameters = (ts6.some(expandedParams, function(p) { + return p !== expandedParams[expandedParams.length - 1] && !!(ts6.getCheckFlags(p) & 32768); + }) ? signature.parameters : expandedParams).map(function(parameter) { + return symbolToParameterDeclaration(parameter, context, kind === 173, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); + }); + var thisParameter = context.flags & 33554432 ? void 0 : tryGetThisParameterDeclaration(signature, context); + if (thisParameter) { + parameters.unshift(thisParameter); + } + var returnTypeNode; + var typePredicate = getTypePredicateOfSignature(signature); + if (typePredicate) { + var assertsModifier = typePredicate.kind === 2 || typePredicate.kind === 3 ? ts6.factory.createToken( + 129 + /* SyntaxKind.AssertsKeyword */ + ) : void 0; + var parameterName = typePredicate.kind === 1 || typePredicate.kind === 3 ? ts6.setEmitFlags( + ts6.factory.createIdentifier(typePredicate.parameterName), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ) : ts6.factory.createThisTypeNode(); + var typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context); + returnTypeNode = ts6.factory.createTypePredicateNode(assertsModifier, parameterName, typeNode); + } else { + var returnType = getReturnTypeOfSignature(signature); + if (returnType && !(suppressAny && isTypeAny(returnType))) { + returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); + } else if (!suppressAny) { + returnTypeNode = ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + } + var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; + if (kind === 182 && signature.flags & 4) { + var flags = ts6.modifiersToFlags(modifiers); + modifiers = ts6.factory.createModifiersFromModifierFlags( + flags | 256 + /* ModifierFlags.Abstract */ + ); + } + var node = kind === 176 ? ts6.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 ? ts6.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 ? ts6.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts6.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 ? ts6.factory.createMethodDeclaration( + modifiers, + /*asteriskToken*/ + void 0, + (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts6.factory.createIdentifier(""), + /*questionToken*/ + void 0, + typeParameters, + parameters, + returnTypeNode, + /*body*/ + void 0 + ) : kind === 173 ? ts6.factory.createConstructorDeclaration( + modifiers, + parameters, + /*body*/ + void 0 + ) : kind === 174 ? ts6.factory.createGetAccessorDeclaration( + modifiers, + (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts6.factory.createIdentifier(""), + parameters, + returnTypeNode, + /*body*/ + void 0 + ) : kind === 175 ? ts6.factory.createSetAccessorDeclaration( + modifiers, + (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts6.factory.createIdentifier(""), + parameters, + /*body*/ + void 0 + ) : kind === 178 ? ts6.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : kind === 320 ? ts6.factory.createJSDocFunctionType(parameters, returnTypeNode) : kind === 181 ? ts6.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier(""))) : kind === 182 ? ts6.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier(""))) : kind === 259 ? ts6.factory.createFunctionDeclaration( + modifiers, + /*asteriskToken*/ + void 0, + (options === null || options === void 0 ? void 0 : options.name) ? ts6.cast(options.name, ts6.isIdentifier) : ts6.factory.createIdentifier(""), + typeParameters, + parameters, + returnTypeNode, + /*body*/ + void 0 + ) : kind === 215 ? ts6.factory.createFunctionExpression( + modifiers, + /*asteriskToken*/ + void 0, + (options === null || options === void 0 ? void 0 : options.name) ? ts6.cast(options.name, ts6.isIdentifier) : ts6.factory.createIdentifier(""), + typeParameters, + parameters, + returnTypeNode, + ts6.factory.createBlock([]) + ) : kind === 216 ? ts6.factory.createArrowFunction( + modifiers, + typeParameters, + parameters, + returnTypeNode, + /*equalsGreaterThanToken*/ + void 0, + ts6.factory.createBlock([]) + ) : ts6.Debug.assertNever(kind); + if (typeArguments) { + node.typeArguments = ts6.factory.createNodeArray(typeArguments); + } + return node; + } + function tryGetThisParameterDeclaration(signature, context) { + if (signature.thisParameter) { + return symbolToParameterDeclaration(signature.thisParameter, context); + } + if (signature.declaration) { + var thisTag = ts6.getJSDocThisTag(signature.declaration); + if (thisTag && thisTag.typeExpression) { + return ts6.factory.createParameterDeclaration( + /* modifiers */ + void 0, + /* dotDotDotToken */ + void 0, + "this", + /* questionToken */ + void 0, + typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context) + ); + } + } + } + function typeParameterToDeclarationWithConstraint(type, context, constraintNode) { + var savedContextFlags = context.flags; + context.flags &= ~512; + var modifiers = ts6.factory.createModifiersFromModifierFlags(getVarianceModifiers(type)); + var name = typeParameterToName(type, context); + var defaultParameter = getDefaultFromTypeParameter(type); + var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context); + context.flags = savedContextFlags; + return ts6.factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode); + } + function typeParameterToDeclaration(type, context, constraint) { + if (constraint === void 0) { + constraint = getConstraintOfTypeParameter(type); + } + var constraintNode = constraint && typeToTypeNodeHelper(constraint, context); + return typeParameterToDeclarationWithConstraint(type, context, constraintNode); + } + function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { + var parameterDeclaration = ts6.getDeclarationOfKind( + parameterSymbol, + 166 + /* SyntaxKind.Parameter */ + ); + if (!parameterDeclaration && !ts6.isTransientSymbol(parameterSymbol)) { + parameterDeclaration = ts6.getDeclarationOfKind( + parameterSymbol, + 343 + /* SyntaxKind.JSDocParameterTag */ + ); + } + var parameterType = getTypeOfSymbol(parameterSymbol); + if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { + parameterType = getOptionalType(parameterType); + } + var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports); + var modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && ts6.canHaveModifiers(parameterDeclaration) ? ts6.map(ts6.getModifiers(parameterDeclaration), ts6.factory.cloneNode) : void 0; + var isRest = parameterDeclaration && ts6.isRestParameter(parameterDeclaration) || ts6.getCheckFlags(parameterSymbol) & 32768; + var dotDotDotToken = isRest ? ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ) : void 0; + var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 ? ts6.setEmitFlags( + ts6.factory.cloneNode(parameterDeclaration.name), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ) : parameterDeclaration.name.kind === 163 ? ts6.setEmitFlags( + ts6.factory.cloneNode(parameterDeclaration.name.right), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ) : cloneBindingName(parameterDeclaration.name) : ts6.symbolName(parameterSymbol) : ts6.symbolName(parameterSymbol); + var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts6.getCheckFlags(parameterSymbol) & 16384; + var questionToken = isOptional ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0; + var parameterNode = ts6.factory.createParameterDeclaration( + modifiers, + dotDotDotToken, + name, + questionToken, + parameterTypeNode, + /*initializer*/ + void 0 + ); + context.approximateLength += ts6.symbolName(parameterSymbol).length + 3; + return parameterNode; + function cloneBindingName(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node2) { + if (context.tracker.trackSymbol && ts6.isComputedPropertyName(node2) && isLateBindableName(node2)) { + trackComputedName(node2.expression, context.enclosingDeclaration, context); + } + var visited = ts6.visitEachChild( + node2, + elideInitializerAndSetEmitFlags, + ts6.nullTransformationContext, + /*nodesVisitor*/ + void 0, + elideInitializerAndSetEmitFlags + ); + if (ts6.isBindingElement(visited)) { + visited = ts6.factory.updateBindingElement( + visited, + visited.dotDotDotToken, + visited.propertyName, + visited.name, + /*initializer*/ + void 0 + ); + } + if (!ts6.nodeIsSynthesized(visited)) { + visited = ts6.factory.cloneNode(visited); + } + return ts6.setEmitFlags( + visited, + 1 | 16777216 + /* EmitFlags.NoAsciiEscaping */ + ); + } + } + } + function trackComputedName(accessExpression, enclosingDeclaration, context) { + if (!context.tracker.trackSymbol) + return; + var firstIdentifier = ts6.getFirstIdentifier(accessExpression); + var name = resolveName( + firstIdentifier, + firstIdentifier.escapedText, + 111551 | 1048576, + /*nodeNotFoundErrorMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + true + ); + if (name) { + context.tracker.trackSymbol( + name, + enclosingDeclaration, + 111551 + /* SymbolFlags.Value */ + ); + } + } + function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) { + context.tracker.trackSymbol(symbol, context.enclosingDeclaration, meaning); + return lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol); + } + function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) { + var chain; + var isTypeParameter = symbol.flags & 262144; + if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64) && !(context.flags & 134217728)) { + chain = ts6.Debug.checkDefined(getSymbolChain( + symbol, + meaning, + /*endOfChain*/ + true + )); + ts6.Debug.assert(chain && chain.length > 0); + } else { + chain = [symbol]; + } + return chain; + function getSymbolChain(symbol2, meaning2, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol2, context.enclosingDeclaration, meaning2, !!(context.flags & 128)); + var parentSpecifiers; + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning2 : getQualifiedLeftMeaning(meaning2))) { + var parents_1 = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol2, context.enclosingDeclaration, meaning2); + if (ts6.length(parents_1)) { + parentSpecifiers = parents_1.map(function(symbol3) { + return ts6.some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context) : void 0; + }); + var indices = parents_1.map(function(_, i) { + return i; + }); + indices.sort(sortByBestName); + var sortedParents = indices.map(function(i) { + return parents_1[i]; + }); + for (var _i = 0, sortedParents_1 = sortedParents; _i < sortedParents_1.length; _i++) { + var parent = sortedParents_1[_i]; + var parentChain = getSymbolChain( + parent, + getQualifiedLeftMeaning(meaning2), + /*endOfChain*/ + false + ); + if (parentChain) { + if (parent.exports && parent.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ) && getSymbolIfSameReference(parent.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ), symbol2)) { + accessibleSymbolChain = parentChain; + break; + } + accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [getAliasForSymbolInContainer(parent, symbol2) || symbol2]); + break; + } + } + } + } + if (accessibleSymbolChain) { + return accessibleSymbolChain; + } + if ( + // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols. + endOfChain || // If a parent symbol is an anonymous type, don't write it. + !(symbol2.flags & (2048 | 4096)) + ) { + if (!endOfChain && !yieldModuleSymbol && !!ts6.forEach(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { + return; + } + return [symbol2]; + } + function sortByBestName(a, b) { + var specifierA = parentSpecifiers[a]; + var specifierB = parentSpecifiers[b]; + if (specifierA && specifierB) { + var isBRelative = ts6.pathIsRelative(specifierB); + if (ts6.pathIsRelative(specifierA) === isBRelative) { + return ts6.moduleSpecifiers.countPathComponents(specifierA) - ts6.moduleSpecifiers.countPathComponents(specifierB); + } + if (isBRelative) { + return -1; + } + return 1; + } + return 0; + } + } + } + function typeParametersToTypeParameterDeclarations(symbol, context) { + var typeParameterNodes; + var targetSymbol = getTargetSymbol(symbol); + if (targetSymbol.flags & (32 | 64 | 524288)) { + typeParameterNodes = ts6.factory.createNodeArray(ts6.map(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), function(tp) { + return typeParameterToDeclaration(tp, context); + })); + } + return typeParameterNodes; + } + function lookupTypeParameterNodes(chain, index, context) { + var _a; + ts6.Debug.assert(chain && 0 <= index && index < chain.length); + var symbol = chain[index]; + var symbolId = getSymbolId(symbol); + if ((_a = context.typeParameterSymbolList) === null || _a === void 0 ? void 0 : _a.has(symbolId)) { + return void 0; + } + (context.typeParameterSymbolList || (context.typeParameterSymbolList = new ts6.Set())).add(symbolId); + var typeParameterNodes; + if (context.flags & 512 && index < chain.length - 1) { + var parentSymbol = symbol; + var nextSymbol_1 = chain[index + 1]; + if (ts6.getCheckFlags(nextSymbol_1) & 1) { + var params = getTypeParametersOfClassOrInterface(parentSymbol.flags & 2097152 ? resolveAlias(parentSymbol) : parentSymbol); + typeParameterNodes = mapToTypeNodes(ts6.map(params, function(t) { + return getMappedType(t, nextSymbol_1.mapper); + }), context); + } else { + typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol, context); + } + } + return typeParameterNodes; + } + function getTopmostIndexedAccessType(top) { + if (ts6.isIndexedAccessTypeNode(top.objectType)) { + return getTopmostIndexedAccessType(top.objectType); + } + return top; + } + function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { + var _a; + var file = ts6.getDeclarationOfKind( + symbol, + 308 + /* SyntaxKind.SourceFile */ + ); + if (!file) { + var equivalentFileSymbol = ts6.firstDefined(symbol.declarations, function(d) { + return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); + }); + if (equivalentFileSymbol) { + file = ts6.getDeclarationOfKind( + equivalentFileSymbol, + 308 + /* SyntaxKind.SourceFile */ + ); + } + } + if (file && file.moduleName !== void 0) { + return file.moduleName; + } + if (!file) { + if (context.tracker.trackReferencedAmbientModule) { + var ambientDecls = ts6.filter(symbol.declarations, ts6.isAmbientModule); + if (ts6.length(ambientDecls)) { + for (var _i = 0, _b = ambientDecls; _i < _b.length; _i++) { + var decl = _b[_i]; + context.tracker.trackReferencedAmbientModule(decl, symbol); + } + } + } + if (ambientModuleSymbolRegex.test(symbol.escapedName)) { + return symbol.escapedName.substring(1, symbol.escapedName.length - 1); + } + } + if (!context.enclosingDeclaration || !context.tracker.moduleResolverHost) { + if (ambientModuleSymbolRegex.test(symbol.escapedName)) { + return symbol.escapedName.substring(1, symbol.escapedName.length - 1); + } + return ts6.getSourceFileOfNode(ts6.getNonAugmentationDeclaration(symbol)).fileName; + } + var contextFile = ts6.getSourceFileOfNode(ts6.getOriginalNode(context.enclosingDeclaration)); + var resolutionMode = overrideImportMode || (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat); + var cacheKey = getSpecifierCacheKey(contextFile.path, resolutionMode); + var links = getSymbolLinks(symbol); + var specifier = links.specifierCache && links.specifierCache.get(cacheKey); + if (!specifier) { + var isBundle_1 = !!ts6.outFile(compilerOptions); + var moduleResolverHost = context.tracker.moduleResolverHost; + var specifierCompilerOptions = isBundle_1 ? __assign(__assign({}, compilerOptions), { baseUrl: moduleResolverHost.getCommonSourceDirectory() }) : compilerOptions; + specifier = ts6.first(ts6.moduleSpecifiers.getModuleSpecifiers(symbol, checker, specifierCompilerOptions, contextFile, moduleResolverHost, { + importModuleSpecifierPreference: isBundle_1 ? "non-relative" : "project-relative", + importModuleSpecifierEnding: isBundle_1 ? "minimal" : resolutionMode === ts6.ModuleKind.ESNext ? "js" : void 0 + }, { overrideImportMode })); + (_a = links.specifierCache) !== null && _a !== void 0 ? _a : links.specifierCache = new ts6.Map(); + links.specifierCache.set(cacheKey, specifier); + } + return specifier; + function getSpecifierCacheKey(path, mode) { + return mode === void 0 ? path : "".concat(mode, "|").concat(path); + } + } + function symbolToEntityNameNode(symbol) { + var identifier = ts6.factory.createIdentifier(ts6.unescapeLeadingUnderscores(symbol.escapedName)); + return symbol.parent ? ts6.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier; + } + function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) { + var _a, _b, _c, _d; + var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384)); + var isTypeOf = meaning === 111551; + if (ts6.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { + var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : void 0; + var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context); + var contextFile = ts6.getSourceFileOfNode(ts6.getOriginalNode(context.enclosingDeclaration)); + var targetFile = ts6.getSourceFileOfModule(chain[0]); + var specifier = void 0; + var assertion = void 0; + if (ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeNext) { + if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts6.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) { + specifier = getSpecifierForModuleSymbol(chain[0], context, ts6.ModuleKind.ESNext); + assertion = ts6.factory.createImportTypeAssertionContainer(ts6.factory.createAssertClause(ts6.factory.createNodeArray([ + ts6.factory.createAssertEntry(ts6.factory.createStringLiteral("resolution-mode"), ts6.factory.createStringLiteral("import")) + ]))); + (_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a); + } + } + if (!specifier) { + specifier = getSpecifierForModuleSymbol(chain[0], context); + } + if (!(context.flags & 67108864) && ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) { + var oldSpecifier = specifier; + if (ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeNext) { + var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts6.ModuleKind.ESNext ? ts6.ModuleKind.CommonJS : ts6.ModuleKind.ESNext; + specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode); + if (specifier.indexOf("/node_modules/") >= 0) { + specifier = oldSpecifier; + } else { + assertion = ts6.factory.createImportTypeAssertionContainer(ts6.factory.createAssertClause(ts6.factory.createNodeArray([ + ts6.factory.createAssertEntry(ts6.factory.createStringLiteral("resolution-mode"), ts6.factory.createStringLiteral(swappedMode === ts6.ModuleKind.ESNext ? "import" : "require")) + ]))); + (_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c); + } + } + if (!assertion) { + context.encounteredError = true; + if (context.tracker.reportLikelyUnsafeImportRequiredError) { + context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier); + } + } + } + var lit = ts6.factory.createLiteralTypeNode(ts6.factory.createStringLiteral(specifier)); + if (context.tracker.trackExternalModuleSymbolOfImportTypeNode) + context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]); + context.approximateLength += specifier.length + 10; + if (!nonRootParts || ts6.isEntityName(nonRootParts)) { + if (nonRootParts) { + var lastId = ts6.isIdentifier(nonRootParts) ? nonRootParts : nonRootParts.right; + lastId.typeArguments = void 0; + } + return ts6.factory.createImportTypeNode(lit, assertion, nonRootParts, typeParameterNodes, isTypeOf); + } else { + var splitNode = getTopmostIndexedAccessType(nonRootParts); + var qualifier = splitNode.objectType.typeName; + return ts6.factory.createIndexedAccessTypeNode(ts6.factory.createImportTypeNode(lit, assertion, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType); + } + } + var entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0); + if (ts6.isIndexedAccessTypeNode(entityName)) { + return entityName; + } + if (isTypeOf) { + return ts6.factory.createTypeQueryNode(entityName); + } else { + var lastId = ts6.isIdentifier(entityName) ? entityName : entityName.right; + var lastTypeArgs = lastId.typeArguments; + lastId.typeArguments = void 0; + return ts6.factory.createTypeReferenceNode(entityName, lastTypeArgs); + } + function createAccessFromSymbolChain(chain2, index, stopper) { + var typeParameterNodes2 = index === chain2.length - 1 ? overrideTypeArguments : lookupTypeParameterNodes(chain2, index, context); + var symbol2 = chain2[index]; + var parent = chain2[index - 1]; + var symbolName; + if (index === 0) { + context.flags |= 16777216; + symbolName = getNameOfSymbolAsWritten(symbol2, context); + context.approximateLength += (symbolName ? symbolName.length : 0) + 1; + context.flags ^= 16777216; + } else { + if (parent && getExportsOfSymbol(parent)) { + var exports_2 = getExportsOfSymbol(parent); + ts6.forEachEntry(exports_2, function(ex, name2) { + if (getSymbolIfSameReference(ex, symbol2) && !isLateBoundName(name2) && name2 !== "export=") { + symbolName = ts6.unescapeLeadingUnderscores(name2); + return true; + } + }); + } + } + if (symbolName === void 0) { + var name = ts6.firstDefined(symbol2.declarations, ts6.getNameOfDeclaration); + if (name && ts6.isComputedPropertyName(name) && ts6.isEntityName(name.expression)) { + var LHS = createAccessFromSymbolChain(chain2, index - 1, stopper); + if (ts6.isEntityName(LHS)) { + return ts6.factory.createIndexedAccessTypeNode(ts6.factory.createParenthesizedType(ts6.factory.createTypeQueryNode(LHS)), ts6.factory.createTypeQueryNode(name.expression)); + } + return LHS; + } + symbolName = getNameOfSymbolAsWritten(symbol2, context); + } + context.approximateLength += symbolName.length + 1; + if (!(context.flags & 16) && parent && getMembersOfSymbol(parent) && getMembersOfSymbol(parent).get(symbol2.escapedName) && getSymbolIfSameReference(getMembersOfSymbol(parent).get(symbol2.escapedName), symbol2)) { + var LHS = createAccessFromSymbolChain(chain2, index - 1, stopper); + if (ts6.isIndexedAccessTypeNode(LHS)) { + return ts6.factory.createIndexedAccessTypeNode(LHS, ts6.factory.createLiteralTypeNode(ts6.factory.createStringLiteral(symbolName))); + } else { + return ts6.factory.createIndexedAccessTypeNode(ts6.factory.createTypeReferenceNode(LHS, typeParameterNodes2), ts6.factory.createLiteralTypeNode(ts6.factory.createStringLiteral(symbolName))); + } + } + var identifier = ts6.setEmitFlags( + ts6.factory.createIdentifier(symbolName, typeParameterNodes2), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ); + identifier.symbol = symbol2; + if (index > stopper) { + var LHS = createAccessFromSymbolChain(chain2, index - 1, stopper); + if (!ts6.isEntityName(LHS)) { + return ts6.Debug.fail("Impossible construct - an export of an indexed access cannot be reachable"); + } + return ts6.factory.createQualifiedName(LHS, identifier); + } + return identifier; + } + } + function typeParameterShadowsNameInScope(escapedName, context, type) { + var result = resolveName( + context.enclosingDeclaration, + escapedName, + 788968, + /*nameNotFoundArg*/ + void 0, + escapedName, + /*isUse*/ + false + ); + if (result) { + if (result.flags & 262144 && result === type.symbol) { + return false; + } + return true; + } + return false; + } + function typeParameterToName(type, context) { + var _a, _b; + if (context.flags & 4 && context.typeParameterNames) { + var cached = context.typeParameterNames.get(getTypeId(type)); + if (cached) { + return cached; + } + } + var result = symbolToName( + type.symbol, + context, + 788968, + /*expectsIdentifier*/ + true + ); + if (!(result.kind & 79)) { + return ts6.factory.createIdentifier("(Missing type parameter)"); + } + if (context.flags & 4) { + var rawtext = result.escapedText; + var i = ((_a = context.typeParameterNamesByTextNextNameCount) === null || _a === void 0 ? void 0 : _a.get(rawtext)) || 0; + var text = rawtext; + while (((_b = context.typeParameterNamesByText) === null || _b === void 0 ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) { + i++; + text = "".concat(rawtext, "_").concat(i); + } + if (text !== rawtext) { + result = ts6.factory.createIdentifier(text, result.typeArguments); + } + (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = new ts6.Map())).set(rawtext, i); + (context.typeParameterNames || (context.typeParameterNames = new ts6.Map())).set(getTypeId(type), result); + (context.typeParameterNamesByText || (context.typeParameterNamesByText = new ts6.Set())).add(rawtext); + } + return result; + } + function symbolToName(symbol, context, meaning, expectsIdentifier) { + var chain = lookupSymbolChain(symbol, context, meaning); + if (expectsIdentifier && chain.length !== 1 && !context.encounteredError && !(context.flags & 65536)) { + context.encounteredError = true; + } + return createEntityNameFromSymbolChain(chain, chain.length - 1); + function createEntityNameFromSymbolChain(chain2, index) { + var typeParameterNodes = lookupTypeParameterNodes(chain2, index, context); + var symbol2 = chain2[index]; + if (index === 0) { + context.flags |= 16777216; + } + var symbolName = getNameOfSymbolAsWritten(symbol2, context); + if (index === 0) { + context.flags ^= 16777216; + } + var identifier = ts6.setEmitFlags( + ts6.factory.createIdentifier(symbolName, typeParameterNodes), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ); + identifier.symbol = symbol2; + return index > 0 ? ts6.factory.createQualifiedName(createEntityNameFromSymbolChain(chain2, index - 1), identifier) : identifier; + } + } + function symbolToExpression(symbol, context, meaning) { + var chain = lookupSymbolChain(symbol, context, meaning); + return createExpressionFromSymbolChain(chain, chain.length - 1); + function createExpressionFromSymbolChain(chain2, index) { + var typeParameterNodes = lookupTypeParameterNodes(chain2, index, context); + var symbol2 = chain2[index]; + if (index === 0) { + context.flags |= 16777216; + } + var symbolName = getNameOfSymbolAsWritten(symbol2, context); + if (index === 0) { + context.flags ^= 16777216; + } + var firstChar = symbolName.charCodeAt(0); + if (ts6.isSingleOrDoubleQuote(firstChar) && ts6.some(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { + return ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(symbol2, context)); + } + var canUsePropertyAccess = firstChar === 35 ? symbolName.length > 1 && ts6.isIdentifierStart(symbolName.charCodeAt(1), languageVersion) : ts6.isIdentifierStart(firstChar, languageVersion); + if (index === 0 || canUsePropertyAccess) { + var identifier = ts6.setEmitFlags( + ts6.factory.createIdentifier(symbolName, typeParameterNodes), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ); + identifier.symbol = symbol2; + return index > 0 ? ts6.factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier; + } else { + if (firstChar === 91) { + symbolName = symbolName.substring(1, symbolName.length - 1); + firstChar = symbolName.charCodeAt(0); + } + var expression = void 0; + if (ts6.isSingleOrDoubleQuote(firstChar) && !(symbol2.flags & 8)) { + expression = ts6.factory.createStringLiteral( + ts6.stripQuotes(symbolName).replace(/\\./g, function(s) { + return s.substring(1); + }), + firstChar === 39 + /* CharacterCodes.singleQuote */ + ); + } else if ("" + +symbolName === symbolName) { + expression = ts6.factory.createNumericLiteral(+symbolName); + } + if (!expression) { + expression = ts6.setEmitFlags( + ts6.factory.createIdentifier(symbolName, typeParameterNodes), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ); + expression.symbol = symbol2; + } + return ts6.factory.createElementAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), expression); + } + } + } + function isStringNamed(d) { + var name = ts6.getNameOfDeclaration(d); + return !!name && ts6.isStringLiteral(name); + } + function isSingleQuotedStringNamed(d) { + var name = ts6.getNameOfDeclaration(d); + return !!(name && ts6.isStringLiteral(name) && (name.singleQuote || !ts6.nodeIsSynthesized(name) && ts6.startsWith(ts6.getTextOfNode( + name, + /*includeTrivia*/ + false + ), "'"))); + } + function getPropertyNameNodeForSymbol(symbol, context) { + var singleQuote = !!ts6.length(symbol.declarations) && ts6.every(symbol.declarations, isSingleQuotedStringNamed); + var fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote); + if (fromNameType) { + return fromNameType; + } + var rawName = ts6.unescapeLeadingUnderscores(symbol.escapedName); + var stringNamed = !!ts6.length(symbol.declarations) && ts6.every(symbol.declarations, isStringNamed); + return ts6.createPropertyNameNodeForIdentifierOrLiteral(rawName, ts6.getEmitScriptTarget(compilerOptions), singleQuote, stringNamed); + } + function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote) { + var nameType = getSymbolLinks(symbol).nameType; + if (nameType) { + if (nameType.flags & 384) { + var name = "" + nameType.value; + if (!ts6.isIdentifierText(name, ts6.getEmitScriptTarget(compilerOptions)) && !ts6.isNumericLiteralName(name)) { + return ts6.factory.createStringLiteral(name, !!singleQuote); + } + if (ts6.isNumericLiteralName(name) && ts6.startsWith(name, "-")) { + return ts6.factory.createComputedPropertyName(ts6.factory.createNumericLiteral(+name)); + } + return ts6.createPropertyNameNodeForIdentifierOrLiteral(name, ts6.getEmitScriptTarget(compilerOptions)); + } + if (nameType.flags & 8192) { + return ts6.factory.createComputedPropertyName(symbolToExpression( + nameType.symbol, + context, + 111551 + /* SymbolFlags.Value */ + )); + } + } + } + function cloneNodeBuilderContext(context) { + var initial = __assign({}, context); + if (initial.typeParameterNames) { + initial.typeParameterNames = new ts6.Map(initial.typeParameterNames); + } + if (initial.typeParameterNamesByText) { + initial.typeParameterNamesByText = new ts6.Set(initial.typeParameterNamesByText); + } + if (initial.typeParameterSymbolList) { + initial.typeParameterSymbolList = new ts6.Set(initial.typeParameterSymbolList); + } + initial.tracker = wrapSymbolTrackerToReportForContext(initial, initial.tracker); + return initial; + } + function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) { + return symbol.declarations && ts6.find(symbol.declarations, function(s) { + return !!ts6.getEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!ts6.findAncestor(s, function(n) { + return n === enclosingDeclaration; + })); + }); + } + function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) { + return !(ts6.getObjectFlags(type) & 4) || !ts6.isTypeReferenceNode(existing) || ts6.length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters); + } + function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) { + if (!isErrorType(type) && enclosingDeclaration) { + var declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration); + if (declWithExistingAnnotation && !ts6.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts6.isGetAccessorDeclaration(declWithExistingAnnotation)) { + var existing = ts6.getEffectiveTypeAnnotationNode(declWithExistingAnnotation); + if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) { + var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled); + if (result_6) { + return result_6; + } + } + } + } + var oldFlags = context.flags; + if (type.flags & 8192 && type.symbol === symbol && (!context.enclosingDeclaration || ts6.some(symbol.declarations, function(d) { + return ts6.getSourceFileOfNode(d) === ts6.getSourceFileOfNode(context.enclosingDeclaration); + }))) { + context.flags |= 1048576; + } + var result = typeToTypeNodeHelper(type, context); + context.flags = oldFlags; + return result; + } + function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) { + var typeFromTypeNode = getTypeFromTypeNode(typeNode); + if (typeFromTypeNode === type) { + return true; + } + if (ts6.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) { + return getTypeWithFacts( + type, + 524288 + /* TypeFacts.NEUndefined */ + ) === typeFromTypeNode; + } + return false; + } + function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) { + if (!isErrorType(type) && context.enclosingDeclaration) { + var annotation = signature.declaration && ts6.getEffectiveReturnTypeNode(signature.declaration); + if (!!ts6.findAncestor(annotation, function(n) { + return n === context.enclosingDeclaration; + }) && annotation) { + var annotated = getTypeFromTypeNode(annotation); + var thisInstantiated = annotated.flags & 262144 && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated; + if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) { + var result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled); + if (result) { + return result; + } + } + } + } + return typeToTypeNodeHelper(type, context); + } + function trackExistingEntityName(node, context, includePrivateSymbol) { + var _a, _b; + var introducesError = false; + var leftmost = ts6.getFirstIdentifier(node); + if (ts6.isInJSFile(node) && (ts6.isExportsIdentifier(leftmost) || ts6.isModuleExportsAccessExpression(leftmost.parent) || ts6.isQualifiedName(leftmost.parent) && ts6.isModuleIdentifier(leftmost.parent.left) && ts6.isExportsIdentifier(leftmost.parent.right))) { + introducesError = true; + return { introducesError, node }; + } + var sym = resolveEntityName( + leftmost, + 67108863, + /*ignoreErrors*/ + true, + /*dontResolveALias*/ + true + ); + if (sym) { + if (isSymbolAccessible( + sym, + context.enclosingDeclaration, + 67108863, + /*shouldComputeAliasesToMakeVisible*/ + false + ).accessibility !== 0) { + introducesError = true; + } else { + (_b = (_a = context.tracker) === null || _a === void 0 ? void 0 : _a.trackSymbol) === null || _b === void 0 ? void 0 : _b.call( + _a, + sym, + context.enclosingDeclaration, + 67108863 + /* SymbolFlags.All */ + ); + includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym); + } + if (ts6.isIdentifier(node)) { + var type = getDeclaredTypeOfSymbol(sym); + var name = sym.flags & 262144 && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts6.factory.cloneNode(node); + name.symbol = sym; + return { introducesError, node: ts6.setEmitFlags( + ts6.setOriginalNode(name, node), + 16777216 + /* EmitFlags.NoAsciiEscaping */ + ) }; + } + } + return { introducesError, node }; + } + function serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled) { + if (cancellationToken && cancellationToken.throwIfCancellationRequested) { + cancellationToken.throwIfCancellationRequested(); + } + var hadError = false; + var file = ts6.getSourceFileOfNode(existing); + var transformed = ts6.visitNode(existing, visitExistingNodeTreeSymbols); + if (hadError) { + return void 0; + } + return transformed === existing ? ts6.setTextRange(ts6.factory.cloneNode(existing), existing) : transformed; + function visitExistingNodeTreeSymbols(node) { + if (ts6.isJSDocAllType(node) || node.kind === 322) { + return ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + if (ts6.isJSDocUnknownType(node)) { + return ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + ); + } + if (ts6.isJSDocNullableType(node)) { + return ts6.factory.createUnionTypeNode([ts6.visitNode(node.type, visitExistingNodeTreeSymbols), ts6.factory.createLiteralTypeNode(ts6.factory.createNull())]); + } + if (ts6.isJSDocOptionalType(node)) { + return ts6.factory.createUnionTypeNode([ts6.visitNode(node.type, visitExistingNodeTreeSymbols), ts6.factory.createKeywordTypeNode( + 155 + /* SyntaxKind.UndefinedKeyword */ + )]); + } + if (ts6.isJSDocNonNullableType(node)) { + return ts6.visitNode(node.type, visitExistingNodeTreeSymbols); + } + if (ts6.isJSDocVariadicType(node)) { + return ts6.factory.createArrayTypeNode(ts6.visitNode(node.type, visitExistingNodeTreeSymbols)); + } + if (ts6.isJSDocTypeLiteral(node)) { + return ts6.factory.createTypeLiteralNode(ts6.map(node.jsDocPropertyTags, function(t) { + var name = ts6.isIdentifier(t.name) ? t.name : t.name.right; + var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); + var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0; + return ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + name, + t.isBracketed || t.typeExpression && ts6.isJSDocOptionalType(t.typeExpression.type) ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + overrideTypeNode || t.typeExpression && ts6.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols) || ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ) + ); + })); + } + if (ts6.isTypeReferenceNode(node) && ts6.isIdentifier(node.typeName) && node.typeName.escapedText === "") { + return ts6.setOriginalNode(ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ), node); + } + if ((ts6.isExpressionWithTypeArguments(node) || ts6.isTypeReferenceNode(node)) && ts6.isJSDocIndexSignature(node)) { + return ts6.factory.createTypeLiteralNode([ts6.factory.createIndexSignature( + /*modifiers*/ + void 0, + [ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotdotdotToken*/ + void 0, + "x", + /*questionToken*/ + void 0, + ts6.visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols) + )], + ts6.visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols) + )]); + } + if (ts6.isJSDocFunctionType(node)) { + if (ts6.isJSDocConstructSignature(node)) { + var newTypeNode_1; + return ts6.factory.createConstructorTypeNode( + /*modifiers*/ + void 0, + ts6.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), + ts6.mapDefined(node.parameters, function(p, i) { + return p.name && ts6.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, void 0) : ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + getEffectiveDotDotDotForParameter(p), + getNameForJSDocFunctionParameter(p, i), + p.questionToken, + ts6.visitNode(p.type, visitExistingNodeTreeSymbols), + /*initializer*/ + void 0 + ); + }), + ts6.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ) + ); + } else { + return ts6.factory.createFunctionTypeNode(ts6.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts6.map(node.parameters, function(p, i) { + return ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + getEffectiveDotDotDotForParameter(p), + getNameForJSDocFunctionParameter(p, i), + p.questionToken, + ts6.visitNode(p.type, visitExistingNodeTreeSymbols), + /*initializer*/ + void 0 + ); + }), ts6.visitNode(node.type, visitExistingNodeTreeSymbols) || ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + )); + } + } + if (ts6.isTypeReferenceNode(node) && ts6.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName( + node, + 788968, + /*ignoreErrors*/ + true + ))) { + return ts6.setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node); + } + if (ts6.isLiteralImportTypeNode(node)) { + var nodeSymbol = getNodeLinks(node).resolvedSymbol; + if (ts6.isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic + (!node.isTypeOf && !(nodeSymbol.flags & 788968) || // The import type had type arguments autofilled by js fallback logic + !(ts6.length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) { + return ts6.setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node); + } + return ts6.factory.updateImportTypeNode(node, ts6.factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)), node.assertions, node.qualifier, ts6.visitNodes(node.typeArguments, visitExistingNodeTreeSymbols, ts6.isTypeNode), node.isTypeOf); + } + if (ts6.isEntityName(node) || ts6.isEntityNameExpression(node)) { + var _a = trackExistingEntityName(node, context, includePrivateSymbol), introducesError = _a.introducesError, result = _a.node; + hadError = hadError || introducesError; + if (result !== node) { + return result; + } + } + if (file && ts6.isTupleTypeNode(node) && ts6.getLineAndCharacterOfPosition(file, node.pos).line === ts6.getLineAndCharacterOfPosition(file, node.end).line) { + ts6.setEmitFlags( + node, + 1 + /* EmitFlags.SingleLine */ + ); + } + return ts6.visitEachChild(node, visitExistingNodeTreeSymbols, ts6.nullTransformationContext); + function getEffectiveDotDotDotForParameter(p) { + return p.dotDotDotToken || (p.type && ts6.isJSDocVariadicType(p.type) ? ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ) : void 0); + } + function getNameForJSDocFunctionParameter(p, index) { + return p.name && ts6.isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? "args" : "arg".concat(index); + } + function rewriteModuleSpecifier(parent, lit) { + if (bundled) { + if (context.tracker && context.tracker.moduleResolverHost) { + var targetFile = getExternalModuleFileFromDeclaration(parent); + if (targetFile) { + var getCanonicalFileName = ts6.createGetCanonicalFileName(!!host.useCaseSensitiveFileNames); + var resolverHost = { + getCanonicalFileName, + getCurrentDirectory: function() { + return context.tracker.moduleResolverHost.getCurrentDirectory(); + }, + getCommonSourceDirectory: function() { + return context.tracker.moduleResolverHost.getCommonSourceDirectory(); + } + }; + var newName = ts6.getResolvedExternalModuleName(resolverHost, targetFile); + return ts6.factory.createStringLiteral(newName); + } + } + } else { + if (context.tracker && context.tracker.trackExternalModuleSymbolOfImportTypeNode) { + var moduleSym = resolveExternalModuleNameWorker( + lit, + lit, + /*moduleNotFoundError*/ + void 0 + ); + if (moduleSym) { + context.tracker.trackExternalModuleSymbolOfImportTypeNode(moduleSym); + } + } + } + return lit; + } + } + } + function symbolTableToDeclarationStatements(symbolTable, context, bundled) { + var serializePropertySymbolForClass = makeSerializePropertySymbol( + ts6.factory.createPropertyDeclaration, + 171, + /*useAcessors*/ + true + ); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol( + function(mods, name, question, type) { + return ts6.factory.createPropertySignature(mods, name, question, type); + }, + 170, + /*useAcessors*/ + false + ); + var enclosingDeclaration = context.enclosingDeclaration; + var results = []; + var visitedSymbols = new ts6.Set(); + var deferredPrivatesStack = []; + var oldcontext = context; + context = __assign(__assign({}, oldcontext), { usedSymbolNames: new ts6.Set(oldcontext.usedSymbolNames), remappedSymbolNames: new ts6.Map(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function(sym, decl, meaning) { + var accessibleResult = isSymbolAccessible( + sym, + decl, + meaning, + /*computeAliases*/ + false + ); + if (accessibleResult.accessibility === 0) { + var chain = lookupSymbolChainWorker(sym, context, meaning); + if (!(sym.flags & 4)) { + includePrivateSymbol(chain[0]); + } + } else if (oldcontext.tracker && oldcontext.tracker.trackSymbol) { + return oldcontext.tracker.trackSymbol(sym, decl, meaning); + } + return false; + } }) }); + context.tracker = wrapSymbolTrackerToReportForContext(context, context.tracker); + ts6.forEachEntry(symbolTable, function(symbol, name) { + var baseName = ts6.unescapeLeadingUnderscores(name); + void getInternalSymbolName(symbol, baseName); + }); + var addingDeclare = !bundled; + var exportEquals = symbolTable.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152) { + symbolTable = ts6.createSymbolTable(); + symbolTable.set("export=", exportEquals); + } + visitSymbolTable(symbolTable); + return mergeRedundantStatements(results); + function isIdentifierAndNotUndefined(node) { + return !!node && node.kind === 79; + } + function getNamesOfDeclaration(statement) { + if (ts6.isVariableStatement(statement)) { + return ts6.filter(ts6.map(statement.declarationList.declarations, ts6.getNameOfDeclaration), isIdentifierAndNotUndefined); + } + return ts6.filter([ts6.getNameOfDeclaration(statement)], isIdentifierAndNotUndefined); + } + function flattenExportAssignedNamespace(statements) { + var exportAssignment = ts6.find(statements, ts6.isExportAssignment); + var nsIndex = ts6.findIndex(statements, ts6.isModuleDeclaration); + var ns = nsIndex !== -1 ? statements[nsIndex] : void 0; + if (ns && exportAssignment && exportAssignment.isExportEquals && ts6.isIdentifier(exportAssignment.expression) && ts6.isIdentifier(ns.name) && ts6.idText(ns.name) === ts6.idText(exportAssignment.expression) && ns.body && ts6.isModuleBlock(ns.body)) { + var excessExports = ts6.filter(statements, function(s) { + return !!(ts6.getEffectiveModifierFlags(s) & 1); + }); + var name_3 = ns.name; + var body = ns.body; + if (ts6.length(excessExports)) { + ns = ts6.factory.updateModuleDeclaration(ns, ns.modifiers, ns.name, body = ts6.factory.updateModuleBlock(body, ts6.factory.createNodeArray(__spreadArray(__spreadArray([], ns.body.statements, true), [ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports(ts6.map(ts6.flatMap(excessExports, function(e) { + return getNamesOfDeclaration(e); + }), function(id) { + return ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + /*alias*/ + void 0, + id + ); + })), + /*moduleSpecifier*/ + void 0 + )], false)))); + statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, nsIndex), true), [ns], false), statements.slice(nsIndex + 1), true); + } + if (!ts6.find(statements, function(s) { + return s !== ns && ts6.nodeHasName(s, name_3); + })) { + results = []; + var mixinExportFlag_1 = !ts6.some(body.statements, function(s) { + return ts6.hasSyntacticModifier( + s, + 1 + /* ModifierFlags.Export */ + ) || ts6.isExportAssignment(s) || ts6.isExportDeclaration(s); + }); + ts6.forEach(body.statements, function(s) { + addResult( + s, + mixinExportFlag_1 ? 1 : 0 + /* ModifierFlags.None */ + ); + }); + statements = __spreadArray(__spreadArray([], ts6.filter(statements, function(s) { + return s !== ns && s !== exportAssignment; + }), true), results, true); + } + } + return statements; + } + function mergeExportDeclarations(statements) { + var exports2 = ts6.filter(statements, function(d) { + return ts6.isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && ts6.isNamedExports(d.exportClause); + }); + if (ts6.length(exports2) > 1) { + var nonExports = ts6.filter(statements, function(d) { + return !ts6.isExportDeclaration(d) || !!d.moduleSpecifier || !d.exportClause; + }); + statements = __spreadArray(__spreadArray([], nonExports, true), [ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports(ts6.flatMap(exports2, function(e) { + return ts6.cast(e.exportClause, ts6.isNamedExports).elements; + })), + /*moduleSpecifier*/ + void 0 + )], false); + } + var reexports = ts6.filter(statements, function(d) { + return ts6.isExportDeclaration(d) && !!d.moduleSpecifier && !!d.exportClause && ts6.isNamedExports(d.exportClause); + }); + if (ts6.length(reexports) > 1) { + var groups = ts6.group(reexports, function(decl) { + return ts6.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; + }); + if (groups.length !== reexports.length) { + var _loop_9 = function(group_12) { + if (group_12.length > 1) { + statements = __spreadArray(__spreadArray([], ts6.filter(statements, function(s) { + return group_12.indexOf(s) === -1; + }), true), [ + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports(ts6.flatMap(group_12, function(e) { + return ts6.cast(e.exportClause, ts6.isNamedExports).elements; + })), + group_12[0].moduleSpecifier + ) + ], false); + } + }; + for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) { + var group_1 = groups_1[_i]; + _loop_9(group_1); + } + } + } + return statements; + } + function inlineExportModifiers(statements) { + var index = ts6.findIndex(statements, function(d) { + return ts6.isExportDeclaration(d) && !d.moduleSpecifier && !d.assertClause && !!d.exportClause && ts6.isNamedExports(d.exportClause); + }); + if (index >= 0) { + var exportDecl = statements[index]; + var replacements = ts6.mapDefined(exportDecl.exportClause.elements, function(e) { + if (!e.propertyName) { + var indices = ts6.indicesOf(statements); + var associatedIndices = ts6.filter(indices, function(i) { + return ts6.nodeHasName(statements[i], e.name); + }); + if (ts6.length(associatedIndices) && ts6.every(associatedIndices, function(i) { + return ts6.canHaveExportModifier(statements[i]); + })) { + for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { + var index_1 = associatedIndices_1[_i]; + statements[index_1] = addExportModifier(statements[index_1]); + } + return void 0; + } + } + return e; + }); + if (!ts6.length(replacements)) { + ts6.orderedRemoveItemAt(statements, index); + } else { + statements[index] = ts6.factory.updateExportDeclaration(exportDecl, exportDecl.modifiers, exportDecl.isTypeOnly, ts6.factory.updateNamedExports(exportDecl.exportClause, replacements), exportDecl.moduleSpecifier, exportDecl.assertClause); + } + } + return statements; + } + function mergeRedundantStatements(statements) { + statements = flattenExportAssignedNamespace(statements); + statements = mergeExportDeclarations(statements); + statements = inlineExportModifiers(statements); + if (enclosingDeclaration && (ts6.isSourceFile(enclosingDeclaration) && ts6.isExternalOrCommonJsModule(enclosingDeclaration) || ts6.isModuleDeclaration(enclosingDeclaration)) && (!ts6.some(statements, ts6.isExternalModuleIndicator) || !ts6.hasScopeMarker(statements) && ts6.some(statements, ts6.needsScopeMarker))) { + statements.push(ts6.createEmptyExports(ts6.factory)); + } + return statements; + } + function addExportModifier(node) { + var flags = (ts6.getEffectiveModifierFlags(node) | 1) & ~2; + return ts6.factory.updateModifiers(node, flags); + } + function removeExportModifier(node) { + var flags = ts6.getEffectiveModifierFlags(node) & ~1; + return ts6.factory.updateModifiers(node, flags); + } + function visitSymbolTable(symbolTable2, suppressNewPrivateContext, propertyAsAlias) { + if (!suppressNewPrivateContext) { + deferredPrivatesStack.push(new ts6.Map()); + } + symbolTable2.forEach(function(symbol) { + serializeSymbol( + symbol, + /*isPrivate*/ + false, + !!propertyAsAlias + ); + }); + if (!suppressNewPrivateContext) { + deferredPrivatesStack[deferredPrivatesStack.length - 1].forEach(function(symbol) { + serializeSymbol( + symbol, + /*isPrivate*/ + true, + !!propertyAsAlias + ); + }); + deferredPrivatesStack.pop(); + } + } + function serializeSymbol(symbol, isPrivate, propertyAsAlias) { + var visitedSym = getMergedSymbol(symbol); + if (visitedSymbols.has(getSymbolId(visitedSym))) { + return; + } + visitedSymbols.add(getSymbolId(visitedSym)); + var skipMembershipCheck = !isPrivate; + if (skipMembershipCheck || !!ts6.length(symbol.declarations) && ts6.some(symbol.declarations, function(d) { + return !!ts6.findAncestor(d, function(n) { + return n === enclosingDeclaration; + }); + })) { + var oldContext = context; + context = cloneNodeBuilderContext(context); + serializeSymbolWorker(symbol, isPrivate, propertyAsAlias); + if (context.reportedDiagnostic) { + oldcontext.reportedDiagnostic = context.reportedDiagnostic; + } + context = oldContext; + } + } + function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) { + var _a, _b, _c, _d; + var symbolName = ts6.unescapeLeadingUnderscores(symbol.escapedName); + var isDefault = symbol.escapedName === "default"; + if (isPrivate && !(context.flags & 131072) && ts6.isStringANonContextualKeyword(symbolName) && !isDefault) { + context.encounteredError = true; + return; + } + var needsPostExportDefault = isDefault && !!(symbol.flags & -113 || symbol.flags & 16 && ts6.length(getPropertiesOfType(getTypeOfSymbol(symbol)))) && !(symbol.flags & 2097152); + var needsExportDeclaration = !needsPostExportDefault && !isPrivate && ts6.isStringANonContextualKeyword(symbolName) && !isDefault; + if (needsPostExportDefault || needsExportDeclaration) { + isPrivate = true; + } + var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 1024 : 0); + var isConstMergedWithNS = symbol.flags & 1536 && symbol.flags & (2 | 1 | 4) && symbol.escapedName !== "export="; + var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol); + if (symbol.flags & (16 | 8192) || isConstMergedWithNSPrintableAsSignatureMerge) { + serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags); + } + if (symbol.flags & 524288) { + serializeTypeAlias(symbol, symbolName, modifierFlags); + } + if (symbol.flags & (2 | 1 | 4) && symbol.escapedName !== "export=" && !(symbol.flags & 4194304) && !(symbol.flags & 32) && !(symbol.flags & 8192) && !isConstMergedWithNSPrintableAsSignatureMerge) { + if (propertyAsAlias) { + var createdExport = serializeMaybeAliasAssignment(symbol); + if (createdExport) { + needsExportDeclaration = false; + needsPostExportDefault = false; + } + } else { + var type = getTypeOfSymbol(symbol); + var localName = getInternalSymbolName(symbol, symbolName); + if (!(symbol.flags & 16) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) { + serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags); + } else { + var flags = !(symbol.flags & 2) ? ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) && ts6.isSourceFile((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration) ? 2 : void 0 : isConstVariable(symbol) ? 2 : 1; + var name = needsPostExportDefault || !(symbol.flags & 4) ? localName : getUnusedName(localName, symbol); + var textRange = symbol.declarations && ts6.find(symbol.declarations, function(d) { + return ts6.isVariableDeclaration(d); + }); + if (textRange && ts6.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { + textRange = textRange.parent.parent; + } + var propertyAccessRequire = (_c = symbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts6.isPropertyAccessExpression); + if (propertyAccessRequire && ts6.isBinaryExpression(propertyAccessRequire.parent) && ts6.isIdentifier(propertyAccessRequire.parent.right) && ((_d = type.symbol) === null || _d === void 0 ? void 0 : _d.valueDeclaration) && ts6.isSourceFile(type.symbol.valueDeclaration)) { + var alias = localName === propertyAccessRequire.parent.right.escapedText ? void 0 : propertyAccessRequire.parent.right; + addResult( + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + alias, + localName + )]) + ), + 0 + /* ModifierFlags.None */ + ); + context.tracker.trackSymbol( + type.symbol, + context.enclosingDeclaration, + 111551 + /* SymbolFlags.Value */ + ); + } else { + var statement = ts6.setTextRange(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList([ + ts6.factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) + ) + ], flags) + ), textRange); + addResult(statement, name !== localName ? modifierFlags & ~1 : modifierFlags); + if (name !== localName && !isPrivate) { + addResult( + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + name, + localName + )]) + ), + 0 + /* ModifierFlags.None */ + ); + needsExportDeclaration = false; + needsPostExportDefault = false; + } + } + } + } + } + if (symbol.flags & 384) { + serializeEnum(symbol, symbolName, modifierFlags); + } + if (symbol.flags & 32) { + if (symbol.flags & 4 && symbol.valueDeclaration && ts6.isBinaryExpression(symbol.valueDeclaration.parent) && ts6.isClassExpression(symbol.valueDeclaration.parent.right)) { + serializeAsAlias(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags); + } else { + serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags); + } + } + if (symbol.flags & (512 | 1024) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol)) || isConstMergedWithNSPrintableAsSignatureMerge) { + serializeModule(symbol, symbolName, modifierFlags); + } + if (symbol.flags & 64 && !(symbol.flags & 32)) { + serializeInterface(symbol, symbolName, modifierFlags); + } + if (symbol.flags & 2097152) { + serializeAsAlias(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags); + } + if (symbol.flags & 4 && symbol.escapedName === "export=") { + serializeMaybeAliasAssignment(symbol); + } + if (symbol.flags & 8388608) { + if (symbol.declarations) { + for (var _i = 0, _e = symbol.declarations; _i < _e.length; _i++) { + var node = _e[_i]; + var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); + if (!resolvedModule) + continue; + addResult( + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + /*exportClause*/ + void 0, + ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(resolvedModule, context)) + ), + 0 + /* ModifierFlags.None */ + ); + } + } + } + if (needsPostExportDefault) { + addResult( + ts6.factory.createExportAssignment( + /*modifiers*/ + void 0, + /*isExportAssignment*/ + false, + ts6.factory.createIdentifier(getInternalSymbolName(symbol, symbolName)) + ), + 0 + /* ModifierFlags.None */ + ); + } else if (needsExportDeclaration) { + addResult( + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + getInternalSymbolName(symbol, symbolName), + symbolName + )]) + ), + 0 + /* ModifierFlags.None */ + ); + } + } + function includePrivateSymbol(symbol) { + if (ts6.some(symbol.declarations, ts6.isParameterDeclaration)) + return; + ts6.Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]); + getUnusedName(ts6.unescapeLeadingUnderscores(symbol.escapedName), symbol); + var isExternalImportAlias = !!(symbol.flags & 2097152) && !ts6.some(symbol.declarations, function(d) { + return !!ts6.findAncestor(d, ts6.isExportDeclaration) || ts6.isNamespaceExport(d) || ts6.isImportEqualsDeclaration(d) && !ts6.isExternalModuleReference(d.moduleReference); + }); + deferredPrivatesStack[isExternalImportAlias ? 0 : deferredPrivatesStack.length - 1].set(getSymbolId(symbol), symbol); + } + function isExportingScope(enclosingDeclaration2) { + return ts6.isSourceFile(enclosingDeclaration2) && (ts6.isExternalOrCommonJsModule(enclosingDeclaration2) || ts6.isJsonSourceFile(enclosingDeclaration2)) || ts6.isAmbientModule(enclosingDeclaration2) && !ts6.isGlobalScopeAugmentation(enclosingDeclaration2); + } + function addResult(node, additionalModifierFlags) { + if (ts6.canHaveModifiers(node)) { + var newModifierFlags = 0; + var enclosingDeclaration_1 = context.enclosingDeclaration && (ts6.isJSDocTypeAlias(context.enclosingDeclaration) ? ts6.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); + if (additionalModifierFlags & 1 && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts6.isModuleDeclaration(enclosingDeclaration_1)) && ts6.canHaveExportModifier(node)) { + newModifierFlags |= 1; + } + if (addingDeclare && !(newModifierFlags & 1) && (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 16777216)) && (ts6.isEnumDeclaration(node) || ts6.isVariableStatement(node) || ts6.isFunctionDeclaration(node) || ts6.isClassDeclaration(node) || ts6.isModuleDeclaration(node))) { + newModifierFlags |= 2; + } + if (additionalModifierFlags & 1024 && (ts6.isClassDeclaration(node) || ts6.isInterfaceDeclaration(node) || ts6.isFunctionDeclaration(node))) { + newModifierFlags |= 1024; + } + if (newModifierFlags) { + node = ts6.factory.updateModifiers(node, newModifierFlags | ts6.getEffectiveModifierFlags(node)); + } + } + results.push(node); + } + function serializeTypeAlias(symbol, symbolName, modifierFlags) { + var _a; + var aliasType = getDeclaredTypeOfTypeAlias(symbol); + var typeParams = getSymbolLinks(symbol).typeParameters; + var typeParamDecls = ts6.map(typeParams, function(p) { + return typeParameterToDeclaration(p, context); + }); + var jsdocAliasDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isJSDocTypeAlias); + var commentText = ts6.getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0); + var oldFlags = context.flags; + context.flags |= 8388608; + var oldEnclosingDecl = context.enclosingDeclaration; + context.enclosingDeclaration = jsdocAliasDecl; + var typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && ts6.isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled) || typeToTypeNodeHelper(aliasType, context); + addResult(ts6.setSyntheticLeadingComments(ts6.factory.createTypeAliasDeclaration( + /*modifiers*/ + void 0, + getInternalSymbolName(symbol, symbolName), + typeParamDecls, + typeNode + ), !commentText ? [] : [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]), modifierFlags); + context.flags = oldFlags; + context.enclosingDeclaration = oldEnclosingDecl; + } + function serializeInterface(symbol, symbolName, modifierFlags) { + var interfaceType = getDeclaredTypeOfClassOrInterface(symbol); + var localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + var typeParamDecls = ts6.map(localParams, function(p) { + return typeParameterToDeclaration(p, context); + }); + var baseTypes = getBaseTypes(interfaceType); + var baseType = ts6.length(baseTypes) ? getIntersectionType(baseTypes) : void 0; + var members = ts6.flatMap(getPropertiesOfType(interfaceType), function(p) { + return serializePropertySymbolForInterface(p, baseType); + }); + var callSignatures = serializeSignatures( + 0, + interfaceType, + baseType, + 176 + /* SyntaxKind.CallSignature */ + ); + var constructSignatures = serializeSignatures( + 1, + interfaceType, + baseType, + 177 + /* SyntaxKind.ConstructSignature */ + ); + var indexSignatures = serializeIndexSignatures(interfaceType, baseType); + var heritageClauses = !ts6.length(baseTypes) ? void 0 : [ts6.factory.createHeritageClause(94, ts6.mapDefined(baseTypes, function(b) { + return trySerializeAsTypeReference( + b, + 111551 + /* SymbolFlags.Value */ + ); + }))]; + addResult(ts6.factory.createInterfaceDeclaration( + /*modifiers*/ + void 0, + getInternalSymbolName(symbol, symbolName), + typeParamDecls, + heritageClauses, + __spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), constructSignatures, true), callSignatures, true), members, true) + ), modifierFlags); + } + function getNamespaceMembersForSerialization(symbol) { + return !symbol.exports ? [] : ts6.filter(ts6.arrayFrom(symbol.exports.values()), isNamespaceMember); + } + function isTypeOnlyNamespace(symbol) { + return ts6.every(getNamespaceMembersForSerialization(symbol), function(m) { + return !(getAllSymbolFlags(resolveSymbol(m)) & 111551); + }); + } + function serializeModule(symbol, symbolName, modifierFlags) { + var members = getNamespaceMembersForSerialization(symbol); + var locationMap = ts6.arrayToMultiMap(members, function(m) { + return m.parent && m.parent === symbol ? "real" : "merged"; + }); + var realMembers = locationMap.get("real") || ts6.emptyArray; + var mergedMembers = locationMap.get("merged") || ts6.emptyArray; + if (ts6.length(realMembers)) { + var localName = getInternalSymbolName(symbol, symbolName); + serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 | 67108864))); + } + if (ts6.length(mergedMembers)) { + var containingFile_1 = ts6.getSourceFileOfNode(context.enclosingDeclaration); + var localName = getInternalSymbolName(symbol, symbolName); + var nsBody = ts6.factory.createModuleBlock([ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports(ts6.mapDefined(ts6.filter(mergedMembers, function(n) { + return n.escapedName !== "export="; + }), function(s) { + var _a, _b; + var name = ts6.unescapeLeadingUnderscores(s.escapedName); + var localName2 = getInternalSymbolName(s, name); + var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s); + if (containingFile_1 && (aliasDecl ? containingFile_1 !== ts6.getSourceFileOfNode(aliasDecl) : !ts6.some(s.declarations, function(d) { + return ts6.getSourceFileOfNode(d) === containingFile_1; + }))) { + (_b = (_a = context.tracker) === null || _a === void 0 ? void 0 : _a.reportNonlocalAugmentation) === null || _b === void 0 ? void 0 : _b.call(_a, containingFile_1, symbol, s); + return void 0; + } + var target = aliasDecl && getTargetOfAliasDeclaration( + aliasDecl, + /*dontRecursivelyResolve*/ + true + ); + includePrivateSymbol(target || s); + var targetName = target ? getInternalSymbolName(target, ts6.unescapeLeadingUnderscores(target.escapedName)) : localName2; + return ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + name === targetName ? void 0 : targetName, + name + ); + })) + )]); + addResult( + ts6.factory.createModuleDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createIdentifier(localName), + nsBody, + 16 + /* NodeFlags.Namespace */ + ), + 0 + /* ModifierFlags.None */ + ); + } + } + function serializeEnum(symbol, symbolName, modifierFlags) { + addResult(ts6.factory.createEnumDeclaration(ts6.factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 2048 : 0), getInternalSymbolName(symbol, symbolName), ts6.map(ts6.filter(getPropertiesOfType(getTypeOfSymbol(symbol)), function(p) { + return !!(p.flags & 8); + }), function(p) { + var initializedValue = p.declarations && p.declarations[0] && ts6.isEnumMember(p.declarations[0]) ? getConstantValue(p.declarations[0]) : void 0; + return ts6.factory.createEnumMember(ts6.unescapeLeadingUnderscores(p.escapedName), initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? ts6.factory.createStringLiteral(initializedValue) : ts6.factory.createNumericLiteral(initializedValue)); + })), modifierFlags); + } + function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) { + var signatures = getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var sig = signatures_2[_i]; + var decl = signatureToSignatureDeclarationHelper(sig, 259, context, { name: ts6.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + addResult(ts6.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); + } + if (!(symbol.flags & (512 | 1024) && !!symbol.exports && !!symbol.exports.size)) { + var props = ts6.filter(getPropertiesOfType(type), isNamespaceMember); + serializeAsNamespaceDeclaration( + props, + localName, + modifierFlags, + /*suppressNewPrivateContext*/ + true + ); + } + } + function getSignatureTextRangeLocation(signature) { + if (signature.declaration && signature.declaration.parent) { + if (ts6.isBinaryExpression(signature.declaration.parent) && ts6.getAssignmentDeclarationKind(signature.declaration.parent) === 5) { + return signature.declaration.parent; + } + if (ts6.isVariableDeclaration(signature.declaration.parent) && signature.declaration.parent.parent) { + return signature.declaration.parent.parent; + } + } + return signature.declaration; + } + function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) { + if (ts6.length(props)) { + var localVsRemoteMap = ts6.arrayToMultiMap(props, function(p) { + return !ts6.length(p.declarations) || ts6.some(p.declarations, function(d) { + return ts6.getSourceFileOfNode(d) === ts6.getSourceFileOfNode(context.enclosingDeclaration); + }) ? "local" : "remote"; + }); + var localProps = localVsRemoteMap.get("local") || ts6.emptyArray; + var fakespace = ts6.parseNodeFactory.createModuleDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createIdentifier(localName), + ts6.factory.createModuleBlock([]), + 16 + /* NodeFlags.Namespace */ + ); + ts6.setParent(fakespace, enclosingDeclaration); + fakespace.locals = ts6.createSymbolTable(props); + fakespace.symbol = props[0].parent; + var oldResults = results; + results = []; + var oldAddingDeclare = addingDeclare; + addingDeclare = false; + var subcontext = __assign(__assign({}, context), { enclosingDeclaration: fakespace }); + var oldContext = context; + context = subcontext; + visitSymbolTable( + ts6.createSymbolTable(localProps), + suppressNewPrivateContext, + /*propertyAsAlias*/ + true + ); + context = oldContext; + addingDeclare = oldAddingDeclare; + var declarations = results; + results = oldResults; + var defaultReplaced = ts6.map(declarations, function(d) { + return ts6.isExportAssignment(d) && !d.isExportEquals && ts6.isIdentifier(d.expression) ? ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + d.expression, + ts6.factory.createIdentifier( + "default" + /* InternalSymbolName.Default */ + ) + )]) + ) : d; + }); + var exportModifierStripped = ts6.every(defaultReplaced, function(d) { + return ts6.hasSyntacticModifier( + d, + 1 + /* ModifierFlags.Export */ + ); + }) ? ts6.map(defaultReplaced, removeExportModifier) : defaultReplaced; + fakespace = ts6.factory.updateModuleDeclaration(fakespace, fakespace.modifiers, fakespace.name, ts6.factory.createModuleBlock(exportModifierStripped)); + addResult(fakespace, modifierFlags); + } + } + function isNamespaceMember(p) { + return !!(p.flags & (788968 | 1920 | 2097152)) || !(p.flags & 4194304 || p.escapedName === "prototype" || p.valueDeclaration && ts6.isStatic(p.valueDeclaration) && ts6.isClassLike(p.valueDeclaration.parent)); + } + function sanitizeJSDocImplements(clauses) { + var result = ts6.mapDefined(clauses, function(e) { + var _a; + var oldEnclosing = context.enclosingDeclaration; + context.enclosingDeclaration = e; + var expr = e.expression; + if (ts6.isEntityNameExpression(expr)) { + if (ts6.isIdentifier(expr) && ts6.idText(expr) === "") { + return cleanup( + /*result*/ + void 0 + ); + } + var introducesError = void 0; + _a = trackExistingEntityName(expr, context, includePrivateSymbol), introducesError = _a.introducesError, expr = _a.node; + if (introducesError) { + return cleanup( + /*result*/ + void 0 + ); + } + } + return cleanup(ts6.factory.createExpressionWithTypeArguments(expr, ts6.map(e.typeArguments, function(a) { + return serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context); + }))); + function cleanup(result2) { + context.enclosingDeclaration = oldEnclosing; + return result2; + } + }); + if (result.length === clauses.length) { + return result; + } + return void 0; + } + function serializeAsClass(symbol, localName, modifierFlags) { + var _a, _b; + var originalDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isClassLike); + var oldEnclosing = context.enclosingDeclaration; + context.enclosingDeclaration = originalDecl || oldEnclosing; + var localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + var typeParamDecls = ts6.map(localParams, function(p) { + return typeParameterToDeclaration(p, context); + }); + var classType = getDeclaredTypeOfClassOrInterface(symbol); + var baseTypes = getBaseTypes(classType); + var originalImplements = originalDecl && ts6.getEffectiveImplementsTypeNodes(originalDecl); + var implementsExpressions = originalImplements && sanitizeJSDocImplements(originalImplements) || ts6.mapDefined(getImplementsTypes(classType), serializeImplementedType); + var staticType = getTypeOfSymbol(symbol); + var isClass = !!((_b = staticType.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration) && ts6.isClassLike(staticType.symbol.valueDeclaration); + var staticBaseType = isClass ? getBaseConstructorTypeOfClass(staticType) : anyType; + var heritageClauses = __spreadArray(__spreadArray([], !ts6.length(baseTypes) ? [] : [ts6.factory.createHeritageClause(94, ts6.map(baseTypes, function(b) { + return serializeBaseType(b, staticBaseType, localName); + }))], true), !ts6.length(implementsExpressions) ? [] : [ts6.factory.createHeritageClause(117, implementsExpressions)], true); + var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType)); + var publicSymbolProps = ts6.filter(symbolProps, function(s) { + var valueDecl = s.valueDeclaration; + return !!valueDecl && !(ts6.isNamedDeclaration(valueDecl) && ts6.isPrivateIdentifier(valueDecl.name)); + }); + var hasPrivateIdentifier = ts6.some(symbolProps, function(s) { + var valueDecl = s.valueDeclaration; + return !!valueDecl && ts6.isNamedDeclaration(valueDecl) && ts6.isPrivateIdentifier(valueDecl.name); + }); + var privateProperties = hasPrivateIdentifier ? [ts6.factory.createPropertyDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createPrivateIdentifier("#private"), + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + )] : ts6.emptyArray; + var publicProperties = ts6.flatMap(publicSymbolProps, function(p) { + return serializePropertySymbolForClass( + p, + /*isStatic*/ + false, + baseTypes[0] + ); + }); + var staticMembers = ts6.flatMap(ts6.filter(getPropertiesOfType(staticType), function(p) { + return !(p.flags & 4194304) && p.escapedName !== "prototype" && !isNamespaceMember(p); + }), function(p) { + return serializePropertySymbolForClass( + p, + /*isStatic*/ + true, + staticBaseType + ); + }); + var isNonConstructableClassLikeInJsFile = !isClass && !!symbol.valueDeclaration && ts6.isInJSFile(symbol.valueDeclaration) && !ts6.some(getSignaturesOfType( + staticType, + 1 + /* SignatureKind.Construct */ + )); + var constructors = isNonConstructableClassLikeInJsFile ? [ts6.factory.createConstructorDeclaration( + ts6.factory.createModifiersFromModifierFlags( + 8 + /* ModifierFlags.Private */ + ), + [], + /*body*/ + void 0 + )] : serializeSignatures( + 1, + staticType, + staticBaseType, + 173 + /* SyntaxKind.Constructor */ + ); + var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); + context.enclosingDeclaration = oldEnclosing; + addResult(ts6.setTextRange(ts6.factory.createClassDeclaration( + /*modifiers*/ + void 0, + localName, + typeParamDecls, + heritageClauses, + __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true) + ), symbol.declarations && ts6.filter(symbol.declarations, function(d) { + return ts6.isClassDeclaration(d) || ts6.isClassExpression(d); + })[0]), modifierFlags); + } + function getSomeTargetNameFromDeclarations(declarations) { + return ts6.firstDefined(declarations, function(d) { + if (ts6.isImportSpecifier(d) || ts6.isExportSpecifier(d)) { + return ts6.idText(d.propertyName || d.name); + } + if (ts6.isBinaryExpression(d) || ts6.isExportAssignment(d)) { + var expression = ts6.isExportAssignment(d) ? d.expression : d.right; + if (ts6.isPropertyAccessExpression(expression)) { + return ts6.idText(expression.name); + } + } + if (isAliasSymbolDeclaration(d)) { + var name = ts6.getNameOfDeclaration(d); + if (name && ts6.isIdentifier(name)) { + return ts6.idText(name); + } + } + return void 0; + }); + } + function serializeAsAlias(symbol, localName, modifierFlags) { + var _a, _b, _c, _d, _e; + var node = getDeclarationOfAliasSymbol(symbol); + if (!node) + return ts6.Debug.fail(); + var target = getMergedSymbol(getTargetOfAliasDeclaration( + node, + /*dontRecursivelyResolve*/ + true + )); + if (!target) { + return; + } + var verbatimTargetName = ts6.isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || ts6.unescapeLeadingUnderscores(target.escapedName); + if (verbatimTargetName === "export=" && (ts6.getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) { + verbatimTargetName = "default"; + } + var targetName = getInternalSymbolName(target, verbatimTargetName); + includePrivateSymbol(target); + switch (node.kind) { + case 205: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257) { + var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); + var propertyName = node.propertyName; + addResult( + ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + /*name*/ + void 0, + ts6.factory.createNamedImports([ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + propertyName && ts6.isIdentifier(propertyName) ? ts6.factory.createIdentifier(ts6.idText(propertyName)) : void 0, + ts6.factory.createIdentifier(localName) + )]) + ), + ts6.factory.createStringLiteral(specifier_1), + /*importClause*/ + void 0 + ), + 0 + /* ModifierFlags.None */ + ); + break; + } + ts6.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); + break; + case 300: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223) { + serializeExportSpecifier(ts6.unescapeLeadingUnderscores(symbol.escapedName), targetName); + } + break; + case 257: + if (ts6.isPropertyAccessExpression(node.initializer)) { + var initializer = node.initializer; + var uniqueName = ts6.factory.createUniqueName(localName); + var specifier_2 = getSpecifierForModuleSymbol(target.parent || target, context); + addResult( + ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + uniqueName, + ts6.factory.createExternalModuleReference(ts6.factory.createStringLiteral(specifier_2)) + ), + 0 + /* ModifierFlags.None */ + ); + addResult(ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createIdentifier(localName), + ts6.factory.createQualifiedName(uniqueName, initializer.name) + ), modifierFlags); + break; + } + case 268: + if (target.escapedName === "export=" && ts6.some(target.declarations, ts6.isJsonSourceFile)) { + serializeMaybeAliasAssignment(symbol); + break; + } + var isLocalImport = !(target.flags & 512) && !ts6.isVariableDeclaration(node); + addResult( + ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createIdentifier(localName), + isLocalImport ? symbolToName( + target, + context, + 67108863, + /*expectsIdentifier*/ + false + ) : ts6.factory.createExternalModuleReference(ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))) + ), + isLocalImport ? modifierFlags : 0 + /* ModifierFlags.None */ + ); + break; + case 267: + addResult( + ts6.factory.createNamespaceExportDeclaration(ts6.idText(node.name)), + 0 + /* ModifierFlags.None */ + ); + break; + case 270: + addResult( + ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + ts6.factory.createIdentifier(localName), + /*namedBindings*/ + void 0 + ), + // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned + // And then made into a default by the `esModuleInterop` or `allowSyntheticDefaultImports` flag + // In such cases, the `target` refers to the module itself already + ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), + /*assertClause*/ + void 0 + ), + 0 + /* ModifierFlags.None */ + ); + break; + case 271: + addResult( + ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + /*importClause*/ + void 0, + ts6.factory.createNamespaceImport(ts6.factory.createIdentifier(localName)) + ), + ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), + /*assertClause*/ + void 0 + ), + 0 + /* ModifierFlags.None */ + ); + break; + case 277: + addResult( + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamespaceExport(ts6.factory.createIdentifier(localName)), + ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)) + ), + 0 + /* ModifierFlags.None */ + ); + break; + case 273: + addResult( + ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + /*importClause*/ + void 0, + ts6.factory.createNamedImports([ + ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + localName !== verbatimTargetName ? ts6.factory.createIdentifier(verbatimTargetName) : void 0, + ts6.factory.createIdentifier(localName) + ) + ]) + ), + ts6.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), + /*assertClause*/ + void 0 + ), + 0 + /* ModifierFlags.None */ + ); + break; + case 278: + var specifier = node.parent.parent.moduleSpecifier; + serializeExportSpecifier(ts6.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts6.isStringLiteralLike(specifier) ? ts6.factory.createStringLiteral(specifier.text) : void 0); + break; + case 274: + serializeMaybeAliasAssignment(symbol); + break; + case 223: + case 208: + case 209: + if (symbol.escapedName === "default" || symbol.escapedName === "export=") { + serializeMaybeAliasAssignment(symbol); + } else { + serializeExportSpecifier(localName, targetName); + } + break; + default: + return ts6.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!"); + } + } + function serializeExportSpecifier(localName, targetName, specifier) { + addResult( + ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + localName !== targetName ? targetName : void 0, + localName + )]), + specifier + ), + 0 + /* ModifierFlags.None */ + ); + } + function serializeMaybeAliasAssignment(symbol) { + if (symbol.flags & 4194304) { + return false; + } + var name = ts6.unescapeLeadingUnderscores(symbol.escapedName); + var isExportEquals = name === "export="; + var isDefault = name === "default"; + var isExportAssignmentCompatibleSymbolName = isExportEquals || isDefault; + var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol); + var target = aliasDecl && getTargetOfAliasDeclaration( + aliasDecl, + /*dontRecursivelyResolve*/ + true + ); + if (target && ts6.length(target.declarations) && ts6.some(target.declarations, function(d) { + return ts6.getSourceFileOfNode(d) === ts6.getSourceFileOfNode(enclosingDeclaration); + })) { + var expr = aliasDecl && (ts6.isExportAssignment(aliasDecl) || ts6.isBinaryExpression(aliasDecl) ? ts6.getExportAssignmentExpression(aliasDecl) : ts6.getPropertyAssignmentAliasLikeExpression(aliasDecl)); + var first_1 = expr && ts6.isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0; + var referenced = first_1 && resolveEntityName( + first_1, + 67108863, + /*ignoreErrors*/ + true, + /*dontResolveAlias*/ + true, + enclosingDeclaration + ); + if (referenced || target) { + includePrivateSymbol(referenced || target); + } + var oldTrack = context.tracker.trackSymbol; + context.tracker.trackSymbol = function() { + return false; + }; + if (isExportAssignmentCompatibleSymbolName) { + results.push(ts6.factory.createExportAssignment( + /*modifiers*/ + void 0, + isExportEquals, + symbolToExpression( + target, + context, + 67108863 + /* SymbolFlags.All */ + ) + )); + } else { + if (first_1 === expr && first_1) { + serializeExportSpecifier(name, ts6.idText(first_1)); + } else if (expr && ts6.isClassExpression(expr)) { + serializeExportSpecifier(name, getInternalSymbolName(target, ts6.symbolName(target))); + } else { + var varName = getUnusedName(name, symbol); + addResult( + ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createIdentifier(varName), + symbolToName( + target, + context, + 67108863, + /*expectsIdentifier*/ + false + ) + ), + 0 + /* ModifierFlags.None */ + ); + serializeExportSpecifier(name, varName); + } + } + context.tracker.trackSymbol = oldTrack; + return true; + } else { + var varName = getUnusedName(name, symbol); + var typeToSerialize = getWidenedType(getTypeOfSymbol(getMergedSymbol(symbol))); + if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) { + serializeAsFunctionNamespaceMerge( + typeToSerialize, + symbol, + varName, + isExportAssignmentCompatibleSymbolName ? 0 : 1 + /* ModifierFlags.Export */ + ); + } else { + var statement = ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ + ts6.factory.createVariableDeclaration( + varName, + /*exclamationToken*/ + void 0, + serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled) + ) + ], + 2 + /* NodeFlags.Const */ + ) + ); + addResult( + statement, + target && target.flags & 4 && target.escapedName === "export=" ? 2 : name === varName ? 1 : 0 + /* ModifierFlags.None */ + ); + } + if (isExportAssignmentCompatibleSymbolName) { + results.push(ts6.factory.createExportAssignment( + /*modifiers*/ + void 0, + isExportEquals, + ts6.factory.createIdentifier(varName) + )); + return true; + } else if (name !== varName) { + serializeExportSpecifier(name, varName); + return true; + } + return false; + } + } + function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) { + var ctxSrc = ts6.getSourceFileOfNode(context.enclosingDeclaration); + return ts6.getObjectFlags(typeToSerialize) & (16 | 32) && !ts6.length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class + !!(ts6.length(ts6.filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || ts6.length(getSignaturesOfType( + typeToSerialize, + 0 + /* SignatureKind.Call */ + ))) && !ts6.length(getSignaturesOfType( + typeToSerialize, + 1 + /* SignatureKind.Construct */ + )) && // TODO: could probably serialize as function + ns + class, now that that's OK + !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && ts6.some(typeToSerialize.symbol.declarations, function(d) { + return ts6.getSourceFileOfNode(d) !== ctxSrc; + })) && !ts6.some(getPropertiesOfType(typeToSerialize), function(p) { + return isLateBoundName(p.escapedName); + }) && !ts6.some(getPropertiesOfType(typeToSerialize), function(p) { + return ts6.some(p.declarations, function(d) { + return ts6.getSourceFileOfNode(d) !== ctxSrc; + }); + }) && ts6.every(getPropertiesOfType(typeToSerialize), function(p) { + return ts6.isIdentifierText(ts6.symbolName(p), languageVersion); + }); + } + function makeSerializePropertySymbol(createProperty, methodKind, useAccessors) { + return function serializePropertySymbol(p, isStatic, baseType) { + var _a, _b, _c, _d, _e; + var modifierFlags = ts6.getDeclarationModifierFlagsFromSymbol(p); + var isPrivate = !!(modifierFlags & 8); + if (isStatic && p.flags & (788968 | 1920 | 2097152)) { + return []; + } + if (p.flags & 4194304 || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) { + return []; + } + var flag = modifierFlags & ~512 | (isStatic ? 32 : 0); + var name = getPropertyNameNodeForSymbol(p, context); + var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.or(ts6.isPropertyDeclaration, ts6.isAccessor, ts6.isVariableDeclaration, ts6.isPropertySignature, ts6.isBinaryExpression, ts6.isPropertyAccessExpression)); + if (p.flags & 98304 && useAccessors) { + var result = []; + if (p.flags & 65536) { + result.push(ts6.setTextRange(ts6.factory.createSetAccessorDeclaration( + ts6.factory.createModifiersFromModifierFlags(flag), + name, + [ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "arg", + /*questionToken*/ + void 0, + isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled) + )], + /*body*/ + void 0 + ), ((_b = p.declarations) === null || _b === void 0 ? void 0 : _b.find(ts6.isSetAccessor)) || firstPropertyLikeDecl)); + } + if (p.flags & 32768) { + var isPrivate_1 = modifierFlags & 8; + result.push(ts6.setTextRange(ts6.factory.createGetAccessorDeclaration( + ts6.factory.createModifiersFromModifierFlags(flag), + name, + [], + isPrivate_1 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + /*body*/ + void 0 + ), ((_c = p.declarations) === null || _c === void 0 ? void 0 : _c.find(ts6.isGetAccessor)) || firstPropertyLikeDecl)); + } + return result; + } else if (p.flags & (4 | 3 | 98304)) { + return ts6.setTextRange(createProperty( + ts6.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), + name, + p.flags & 16777216 ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 + // interface members can't have initializers, however class members _can_ + /*initializer*/ + void 0 + ), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts6.or(ts6.isPropertyDeclaration, ts6.isVariableDeclaration))) || firstPropertyLikeDecl); + } + if (p.flags & (8192 | 16)) { + var type = getTypeOfSymbol(p); + var signatures = getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + if (flag & 8) { + return ts6.setTextRange(createProperty( + ts6.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), + name, + p.flags & 16777216 ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ), ((_e = p.declarations) === null || _e === void 0 ? void 0 : _e.find(ts6.isFunctionLikeDeclaration)) || signatures[0] && signatures[0].declaration || p.declarations && p.declarations[0]); + } + var results_1 = []; + for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { + var sig = signatures_3[_i]; + var decl = signatureToSignatureDeclarationHelper(sig, methodKind, context, { + name, + questionToken: p.flags & 16777216 ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + modifiers: flag ? ts6.factory.createModifiersFromModifierFlags(flag) : void 0 + }); + var location = sig.declaration && ts6.isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration; + results_1.push(ts6.setTextRange(decl, location)); + } + return results_1; + } + return ts6.Debug.fail("Unhandled class member kind! ".concat(p.__debugFlags || p.flags)); + }; + } + function serializePropertySymbolForInterface(p, baseType) { + return serializePropertySymbolForInterfaceWorker( + p, + /*isStatic*/ + false, + baseType + ); + } + function serializeSignatures(kind, input, baseType, outputKind) { + var signatures = getSignaturesOfType(input, kind); + if (kind === 1) { + if (!baseType && ts6.every(signatures, function(s2) { + return ts6.length(s2.parameters) === 0; + })) { + return []; + } + if (baseType) { + var baseSigs = getSignaturesOfType( + baseType, + 1 + /* SignatureKind.Construct */ + ); + if (!ts6.length(baseSigs) && ts6.every(signatures, function(s2) { + return ts6.length(s2.parameters) === 0; + })) { + return []; + } + if (baseSigs.length === signatures.length) { + var failed = false; + for (var i = 0; i < baseSigs.length; i++) { + if (!compareSignaturesIdentical( + signatures[i], + baseSigs[i], + /*partialMatch*/ + false, + /*ignoreThisTypes*/ + false, + /*ignoreReturnTypes*/ + true, + compareTypesIdentical + )) { + failed = true; + break; + } + } + if (!failed) { + return []; + } + } + } + var privateProtected = 0; + for (var _i = 0, signatures_4 = signatures; _i < signatures_4.length; _i++) { + var s = signatures_4[_i]; + if (s.declaration) { + privateProtected |= ts6.getSelectedEffectiveModifierFlags( + s.declaration, + 8 | 16 + /* ModifierFlags.Protected */ + ); + } + } + if (privateProtected) { + return [ts6.setTextRange(ts6.factory.createConstructorDeclaration( + ts6.factory.createModifiersFromModifierFlags(privateProtected), + /*parameters*/ + [], + /*body*/ + void 0 + ), signatures[0].declaration)]; + } + } + var results2 = []; + for (var _a = 0, signatures_5 = signatures; _a < signatures_5.length; _a++) { + var sig = signatures_5[_a]; + var decl = signatureToSignatureDeclarationHelper(sig, outputKind, context); + results2.push(ts6.setTextRange(decl, sig.declaration)); + } + return results2; + } + function serializeIndexSignatures(input, baseType) { + var results2 = []; + for (var _i = 0, _a = getIndexInfosOfType(input); _i < _a.length; _i++) { + var info = _a[_i]; + if (baseType) { + var baseInfo = getIndexInfoOfType(baseType, info.keyType); + if (baseInfo) { + if (isTypeIdenticalTo(info.type, baseInfo.type)) { + continue; + } + } + } + results2.push(indexInfoToIndexSignatureDeclarationHelper( + info, + context, + /*typeNode*/ + void 0 + )); + } + return results2; + } + function serializeBaseType(t, staticType, rootName) { + var ref = trySerializeAsTypeReference( + t, + 111551 + /* SymbolFlags.Value */ + ); + if (ref) { + return ref; + } + var tempName = getUnusedName("".concat(rootName, "_base")); + var statement = ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ + ts6.factory.createVariableDeclaration( + tempName, + /*exclamationToken*/ + void 0, + typeToTypeNodeHelper(staticType, context) + ) + ], + 2 + /* NodeFlags.Const */ + ) + ); + addResult( + statement, + 0 + /* ModifierFlags.None */ + ); + return ts6.factory.createExpressionWithTypeArguments( + ts6.factory.createIdentifier(tempName), + /*typeArgs*/ + void 0 + ); + } + function trySerializeAsTypeReference(t, flags) { + var typeArgs; + var reference; + if (t.target && isSymbolAccessibleByFlags(t.target.symbol, enclosingDeclaration, flags)) { + typeArgs = ts6.map(getTypeArguments(t), function(t2) { + return typeToTypeNodeHelper(t2, context); + }); + reference = symbolToExpression( + t.target.symbol, + context, + 788968 + /* SymbolFlags.Type */ + ); + } else if (t.symbol && isSymbolAccessibleByFlags(t.symbol, enclosingDeclaration, flags)) { + reference = symbolToExpression( + t.symbol, + context, + 788968 + /* SymbolFlags.Type */ + ); + } + if (reference) { + return ts6.factory.createExpressionWithTypeArguments(reference, typeArgs); + } + } + function serializeImplementedType(t) { + var ref = trySerializeAsTypeReference( + t, + 788968 + /* SymbolFlags.Type */ + ); + if (ref) { + return ref; + } + if (t.symbol) { + return ts6.factory.createExpressionWithTypeArguments( + symbolToExpression( + t.symbol, + context, + 788968 + /* SymbolFlags.Type */ + ), + /*typeArgs*/ + void 0 + ); + } + } + function getUnusedName(input, symbol) { + var _a, _b; + var id = symbol ? getSymbolId(symbol) : void 0; + if (id) { + if (context.remappedSymbolNames.has(id)) { + return context.remappedSymbolNames.get(id); + } + } + if (symbol) { + input = getNameCandidateWorker(symbol, input); + } + var i = 0; + var original = input; + while ((_a = context.usedSymbolNames) === null || _a === void 0 ? void 0 : _a.has(input)) { + i++; + input = "".concat(original, "_").concat(i); + } + (_b = context.usedSymbolNames) === null || _b === void 0 ? void 0 : _b.add(input); + if (id) { + context.remappedSymbolNames.set(id, input); + } + return input; + } + function getNameCandidateWorker(symbol, localName) { + if (localName === "default" || localName === "__class" || localName === "__function") { + var flags = context.flags; + context.flags |= 16777216; + var nameCandidate = getNameOfSymbolAsWritten(symbol, context); + context.flags = flags; + localName = nameCandidate.length > 0 && ts6.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts6.stripQuotes(nameCandidate) : nameCandidate; + } + if (localName === "default") { + localName = "_default"; + } else if (localName === "export=") { + localName = "_exports"; + } + localName = ts6.isIdentifierText(localName, languageVersion) && !ts6.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_"); + return localName; + } + function getInternalSymbolName(symbol, localName) { + var id = getSymbolId(symbol); + if (context.remappedSymbolNames.has(id)) { + return context.remappedSymbolNames.get(id); + } + localName = getNameCandidateWorker(symbol, localName); + context.remappedSymbolNames.set(id, localName); + return localName; + } + } + } + function typePredicateToString(typePredicate, enclosingDeclaration, flags, writer) { + if (flags === void 0) { + flags = 16384; + } + return writer ? typePredicateToStringWorker(writer).getText() : ts6.usingSingleLineStringWriter(typePredicateToStringWorker); + function typePredicateToStringWorker(writer2) { + var predicate = ts6.factory.createTypePredicateNode( + typePredicate.kind === 2 || typePredicate.kind === 3 ? ts6.factory.createToken( + 129 + /* SyntaxKind.AssertsKeyword */ + ) : void 0, + typePredicate.kind === 1 || typePredicate.kind === 3 ? ts6.factory.createIdentifier(typePredicate.parameterName) : ts6.factory.createThisTypeNode(), + typePredicate.type && nodeBuilder.typeToTypeNode( + typePredicate.type, + enclosingDeclaration, + toNodeBuilderFlags(flags) | 70221824 | 512 + /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */ + ) + // TODO: GH#18217 + ); + var printer = ts6.createPrinter({ removeComments: true }); + var sourceFile = enclosingDeclaration && ts6.getSourceFileOfNode(enclosingDeclaration); + printer.writeNode( + 4, + predicate, + /*sourceFile*/ + sourceFile, + writer2 + ); + return writer2; + } + } + function formatUnionTypes(types) { + var result = []; + var flags = 0; + for (var i = 0; i < types.length; i++) { + var t = types[i]; + flags |= t.flags; + if (!(t.flags & 98304)) { + if (t.flags & (512 | 1024)) { + var baseType = t.flags & 512 ? booleanType : getBaseTypeOfEnumLiteralType(t); + if (baseType.flags & 1048576) { + var count = baseType.types.length; + if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) { + result.push(baseType); + i += count - 1; + continue; + } + } + } + result.push(t); + } + } + if (flags & 65536) + result.push(nullType); + if (flags & 32768) + result.push(undefinedType); + return result || types; + } + function visibilityToString(flags) { + if (flags === 8) { + return "private"; + } + if (flags === 16) { + return "protected"; + } + return "public"; + } + function getTypeAliasForTypeLiteral(type) { + if (type.symbol && type.symbol.flags & 2048 && type.symbol.declarations) { + var node = ts6.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); + if (node.kind === 262) { + return getSymbolOfNode(node); + } + } + return void 0; + } + function isTopLevelInExternalModuleAugmentation(node) { + return node && node.parent && node.parent.kind === 265 && ts6.isExternalModuleAugmentation(node.parent.parent); + } + function isDefaultBindingContext(location) { + return location.kind === 308 || ts6.isAmbientModule(location); + } + function getNameOfSymbolFromNameType(symbol, context) { + var nameType = getSymbolLinks(symbol).nameType; + if (nameType) { + if (nameType.flags & 384) { + var name = "" + nameType.value; + if (!ts6.isIdentifierText(name, ts6.getEmitScriptTarget(compilerOptions)) && !ts6.isNumericLiteralName(name)) { + return '"'.concat(ts6.escapeString( + name, + 34 + /* CharacterCodes.doubleQuote */ + ), '"'); + } + if (ts6.isNumericLiteralName(name) && ts6.startsWith(name, "-")) { + return "[".concat(name, "]"); + } + return name; + } + if (nameType.flags & 8192) { + return "[".concat(getNameOfSymbolAsWritten(nameType.symbol, context), "]"); + } + } + } + function getNameOfSymbolAsWritten(symbol, context) { + if (context && symbol.escapedName === "default" && !(context.flags & 16384) && // If it's not the first part of an entity name, it must print as `default` + (!(context.flags & 16777216) || // if the symbol is synthesized, it will only be referenced externally it must print as `default` + !symbol.declarations || // if not in the same binding context (source file, module declaration), it must print as `default` + context.enclosingDeclaration && ts6.findAncestor(symbol.declarations[0], isDefaultBindingContext) !== ts6.findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) { + return "default"; + } + if (symbol.declarations && symbol.declarations.length) { + var declaration = ts6.firstDefined(symbol.declarations, function(d) { + return ts6.getNameOfDeclaration(d) ? d : void 0; + }); + var name_4 = declaration && ts6.getNameOfDeclaration(declaration); + if (declaration && name_4) { + if (ts6.isCallExpression(declaration) && ts6.isBindableObjectDefinePropertyCall(declaration)) { + return ts6.symbolName(symbol); + } + if (ts6.isComputedPropertyName(name_4) && !(ts6.getCheckFlags(symbol) & 4096)) { + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & 384) { + var result = getNameOfSymbolFromNameType(symbol, context); + if (result !== void 0) { + return result; + } + } + } + return ts6.declarationNameToString(name_4); + } + if (!declaration) { + declaration = symbol.declarations[0]; + } + if (declaration.parent && declaration.parent.kind === 257) { + return ts6.declarationNameToString(declaration.parent.name); + } + switch (declaration.kind) { + case 228: + case 215: + case 216: + if (context && !context.encounteredError && !(context.flags & 131072)) { + context.encounteredError = true; + } + return declaration.kind === 228 ? "(Anonymous class)" : "(Anonymous function)"; + } + } + var name = getNameOfSymbolFromNameType(symbol, context); + return name !== void 0 ? name : ts6.symbolName(symbol); + } + function isDeclarationVisible(node) { + if (node) { + var links = getNodeLinks(node); + if (links.isVisible === void 0) { + links.isVisible = !!determineIfDeclarationIsVisible(); + } + return links.isVisible; + } + return false; + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 341: + case 348: + case 342: + return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts6.isSourceFile(node.parent.parent.parent)); + case 205: + return isDeclarationVisible(node.parent.parent); + case 257: + if (ts6.isBindingPattern(node.name) && !node.name.elements.length) { + return false; + } + case 264: + case 260: + case 261: + case 262: + case 259: + case 263: + case 268: + if (ts6.isExternalModuleAugmentation(node)) { + return true; + } + var parent = getDeclarationContainer(node); + if (!(ts6.getCombinedModifierFlags(node) & 1) && !(node.kind !== 268 && parent.kind !== 308 && parent.flags & 16777216)) { + return isGlobalSourceFile(parent); + } + return isDeclarationVisible(parent); + case 169: + case 168: + case 174: + case 175: + case 171: + case 170: + if (ts6.hasEffectiveModifier( + node, + 8 | 16 + /* ModifierFlags.Protected */ + )) { + return false; + } + case 173: + case 177: + case 176: + case 178: + case 166: + case 265: + case 181: + case 182: + case 184: + case 180: + case 185: + case 186: + case 189: + case 190: + case 193: + case 199: + return isDeclarationVisible(node.parent); + case 270: + case 271: + case 273: + return false; + case 165: + case 308: + case 267: + return true; + case 274: + return false; + default: + return false; + } + } + } + function collectLinkedAliases(node, setVisibility) { + var exportSymbol; + if (node.parent && node.parent.kind === 274) { + exportSymbol = resolveName( + node, + node.escapedText, + 111551 | 788968 | 1920 | 2097152, + /*nameNotFoundMessage*/ + void 0, + node, + /*isUse*/ + false + ); + } else if (node.parent.kind === 278) { + exportSymbol = getTargetOfExportSpecifier( + node.parent, + 111551 | 788968 | 1920 | 2097152 + /* SymbolFlags.Alias */ + ); + } + var result; + var visited; + if (exportSymbol) { + visited = new ts6.Set(); + visited.add(getSymbolId(exportSymbol)); + buildVisibleNodeList(exportSymbol.declarations); + } + return result; + function buildVisibleNodeList(declarations) { + ts6.forEach(declarations, function(declaration) { + var resultNode = getAnyImportSyntax(declaration) || declaration; + if (setVisibility) { + getNodeLinks(declaration).isVisible = true; + } else { + result = result || []; + ts6.pushIfUnique(result, resultNode); + } + if (ts6.isInternalModuleImportEqualsDeclaration(declaration)) { + var internalModuleReference = declaration.moduleReference; + var firstIdentifier = ts6.getFirstIdentifier(internalModuleReference); + var importSymbol = resolveName( + declaration, + firstIdentifier.escapedText, + 111551 | 788968 | 1920, + void 0, + void 0, + /*isUse*/ + false + ); + if (importSymbol && visited) { + if (ts6.tryAddToSet(visited, getSymbolId(importSymbol))) { + buildVisibleNodeList(importSymbol.declarations); + } + } + } + }); + } + } + function pushTypeResolution(target, propertyName) { + var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); + if (resolutionCycleStartIndex >= 0) { + var length_3 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_3; i++) { + resolutionResults[i] = false; + } + return false; + } + resolutionTargets.push(target); + resolutionResults.push( + /*items*/ + true + ); + resolutionPropertyNames.push(propertyName); + return true; + } + function findResolutionCycleStartIndex(target, propertyName) { + for (var i = resolutionTargets.length - 1; i >= 0; i--) { + if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + return -1; + } + if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { + return i; + } + } + return -1; + } + function hasType(target, propertyName) { + switch (propertyName) { + case 0: + return !!getSymbolLinks(target).type; + case 5: + return !!getNodeLinks(target).resolvedEnumType; + case 2: + return !!getSymbolLinks(target).declaredType; + case 1: + return !!target.resolvedBaseConstructorType; + case 3: + return !!target.resolvedReturnType; + case 4: + return !!target.immediateBaseConstraint; + case 6: + return !!target.resolvedTypeArguments; + case 7: + return !!target.baseTypesResolved; + case 8: + return !!getSymbolLinks(target).writeType; + } + return ts6.Debug.assertNever(propertyName); + } + function popTypeResolution() { + resolutionTargets.pop(); + resolutionPropertyNames.pop(); + return resolutionResults.pop(); + } + function getDeclarationContainer(node) { + return ts6.findAncestor(ts6.getRootDeclaration(node), function(node2) { + switch (node2.kind) { + case 257: + case 258: + case 273: + case 272: + case 271: + case 270: + return false; + default: + return true; + } + }).parent; + } + function getTypeOfPrototypeProperty(prototype) { + var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); + return classType.typeParameters ? createTypeReference(classType, ts6.map(classType.typeParameters, function(_) { + return anyType; + })) : classType; + } + function getTypeOfPropertyOfType(type, name) { + var prop = getPropertyOfType(type, name); + return prop ? getTypeOfSymbol(prop) : void 0; + } + function getTypeOfPropertyOrIndexSignature(type, name) { + var _a; + return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) === null || _a === void 0 ? void 0 : _a.type) || unknownType; + } + function isTypeAny(type) { + return type && (type.flags & 1) !== 0; + } + function isErrorType(type) { + return type === errorType || !!(type.flags & 1 && type.aliasSymbol); + } + function getTypeForBindingElementParent(node, checkMode) { + if (checkMode !== 0) { + return getTypeForVariableLikeDeclaration( + node, + /*includeOptionality*/ + false, + checkMode + ); + } + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration( + node, + /*includeOptionality*/ + false, + checkMode + ); + } + function getRestType(source, properties, symbol) { + source = filterType(source, function(t) { + return !(t.flags & 98304); + }); + if (source.flags & 131072) { + return emptyObjectType; + } + if (source.flags & 1048576) { + return mapType(source, function(t) { + return getRestType(t, properties, symbol); + }); + } + var omitKeyType = getUnionType(ts6.map(properties, getLiteralTypeFromPropertyName)); + var spreadableProperties = []; + var unspreadableToRestKeys = []; + for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + var literalTypeFromProperty = getLiteralTypeFromProperty( + prop, + 8576 + /* TypeFlags.StringOrNumberLiteralOrUnique */ + ); + if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(ts6.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16)) && isSpreadableProperty(prop)) { + spreadableProperties.push(prop); + } else { + unspreadableToRestKeys.push(literalTypeFromProperty); + } + } + if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) { + if (unspreadableToRestKeys.length) { + omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true)); + } + if (omitKeyType.flags & 131072) { + return source; + } + var omitTypeAlias = getGlobalOmitSymbol(); + if (!omitTypeAlias) { + return errorType; + } + return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]); + } + var members = ts6.createSymbolTable(); + for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) { + var prop = spreadableProperties_1[_b]; + members.set(prop.escapedName, getSpreadSymbol( + prop, + /*readonly*/ + false + )); + } + var result = createAnonymousType(symbol, members, ts6.emptyArray, ts6.emptyArray, getIndexInfosOfType(source)); + result.objectFlags |= 4194304; + return result; + } + function isGenericTypeWithUndefinedConstraint(type) { + return !!(type.flags & 465829888) && maybeTypeOfKind( + getBaseConstraintOfType(type) || unknownType, + 32768 + /* TypeFlags.Undefined */ + ); + } + function getNonUndefinedType(type) { + var typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, function(t) { + return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; + }) : type; + return getTypeWithFacts( + typeOrConstraint, + 524288 + /* TypeFacts.NEUndefined */ + ); + } + function getFlowTypeOfDestructuring(node, declaredType) { + var reference = getSyntheticElementAccess(node); + return reference ? getFlowTypeOfReference(reference, declaredType) : declaredType; + } + function getSyntheticElementAccess(node) { + var parentAccess = getParentElementAccess(node); + if (parentAccess && parentAccess.flowNode) { + var propName = getDestructuringPropertyName(node); + if (propName) { + var literal2 = ts6.setTextRange(ts6.parseNodeFactory.createStringLiteral(propName), node); + var lhsExpr = ts6.isLeftHandSideExpression(parentAccess) ? parentAccess : ts6.parseNodeFactory.createParenthesizedExpression(parentAccess); + var result = ts6.setTextRange(ts6.parseNodeFactory.createElementAccessExpression(lhsExpr, literal2), node); + ts6.setParent(literal2, result); + ts6.setParent(result, node); + if (lhsExpr !== parentAccess) { + ts6.setParent(lhsExpr, result); + } + result.flowNode = parentAccess.flowNode; + return result; + } + } + } + function getParentElementAccess(node) { + var ancestor = node.parent.parent; + switch (ancestor.kind) { + case 205: + case 299: + return getSyntheticElementAccess(ancestor); + case 206: + return getSyntheticElementAccess(node.parent); + case 257: + return ancestor.initializer; + case 223: + return ancestor.right; + } + } + function getDestructuringPropertyName(node) { + var parent = node.parent; + if (node.kind === 205 && parent.kind === 203) { + return getLiteralPropertyNameText(node.propertyName || node.name); + } + if (node.kind === 299 || node.kind === 300) { + return getLiteralPropertyNameText(node.name); + } + return "" + parent.elements.indexOf(node); + } + function getLiteralPropertyNameText(name) { + var type = getLiteralTypeFromPropertyName(name); + return type.flags & (128 | 256) ? "" + type.value : void 0; + } + function getTypeForBindingElement(declaration) { + var checkMode = declaration.dotDotDotToken ? 64 : 0; + var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode); + return parentType && getBindingElementTypeFromParentType(declaration, parentType); + } + function getBindingElementTypeFromParentType(declaration, parentType) { + if (isTypeAny(parentType)) { + return parentType; + } + var pattern = declaration.parent; + if (strictNullChecks && declaration.flags & 16777216 && ts6.isParameterDeclaration(declaration)) { + parentType = getNonNullableType(parentType); + } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536)) { + parentType = getTypeWithFacts( + parentType, + 524288 + /* TypeFacts.NEUndefined */ + ); + } + var type; + if (pattern.kind === 203) { + if (declaration.dotDotDotToken) { + parentType = getReducedType(parentType); + if (parentType.flags & 2 || !isValidSpreadType(parentType)) { + error(declaration, ts6.Diagnostics.Rest_types_may_only_be_created_from_object_types); + return errorType; + } + var literalMembers = []; + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!element.dotDotDotToken) { + literalMembers.push(element.propertyName || element.name); + } + } + type = getRestType(parentType, literalMembers, declaration.symbol); + } else { + var name = declaration.propertyName || declaration.name; + var indexType = getLiteralTypeFromPropertyName(name); + var declaredType = getIndexedAccessType(parentType, indexType, 32, name); + type = getFlowTypeOfDestructuring(declaration, declaredType); + } + } else { + var elementType = checkIteratedTypeOrElementType(65 | (declaration.dotDotDotToken ? 0 : 128), parentType, undefinedType, pattern); + var index_2 = pattern.elements.indexOf(declaration); + if (declaration.dotDotDotToken) { + type = everyType(parentType, isTupleType) ? mapType(parentType, function(t) { + return sliceTupleType(t, index_2); + }) : createArrayType(elementType); + } else if (isArrayLikeType(parentType)) { + var indexType = getNumberLiteralType(index_2); + var accessFlags = 32 | (hasDefaultValue(declaration) ? 16 : 0); + var declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType; + type = getFlowTypeOfDestructuring(declaration, declaredType); + } else { + type = elementType; + } + } + if (!declaration.initializer) { + return type; + } + if (ts6.getEffectiveTypeAnnotationNode(ts6.walkUpBindingElementsAndPatterns(declaration))) { + return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer( + declaration, + 0 + /* CheckMode.Normal */ + )) & 16777216) ? getNonUndefinedType(type) : type; + } + return widenTypeInferredFromInitializer(declaration, getUnionType( + [getNonUndefinedType(type), checkDeclarationInitializer( + declaration, + 0 + /* CheckMode.Normal */ + )], + 2 + /* UnionReduction.Subtype */ + )); + } + function getTypeForDeclarationFromJSDocComment(declaration) { + var jsdocType = ts6.getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); + } + return void 0; + } + function isNullOrUndefined(node) { + var expr = ts6.skipParentheses( + node, + /*excludeJSDocTypeAssertions*/ + true + ); + return expr.kind === 104 || expr.kind === 79 && getResolvedSymbol(expr) === undefinedSymbol; + } + function isEmptyArrayLiteral(node) { + var expr = ts6.skipParentheses( + node, + /*excludeJSDocTypeAssertions*/ + true + ); + return expr.kind === 206 && expr.elements.length === 0; + } + function addOptionality(type, isProperty, isOptional) { + if (isProperty === void 0) { + isProperty = false; + } + if (isOptional === void 0) { + isOptional = true; + } + return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; + } + function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { + if (ts6.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246) { + var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression( + declaration.parent.parent.expression, + /*checkMode*/ + checkMode + ))); + return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType; + } + if (ts6.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247) { + var forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement) || anyType; + } + if (ts6.isBindingPattern(declaration.parent)) { + return getTypeForBindingElement(declaration); + } + var isProperty = ts6.isPropertyDeclaration(declaration) && !ts6.hasAccessorModifier(declaration) || ts6.isPropertySignature(declaration); + var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts6.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); + var declaredType = tryGetTypeFromEffectiveTypeNode(declaration); + if (declaredType) { + return addOptionality(declaredType, isProperty, isOptional); + } + if ((noImplicitAny || ts6.isInJSFile(declaration)) && ts6.isVariableDeclaration(declaration) && !ts6.isBindingPattern(declaration.name) && !(ts6.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 16777216)) { + if (!(ts6.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { + return autoType; + } + if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) { + return autoArrayType; + } + } + if (ts6.isParameter(declaration)) { + var func = declaration.parent; + if (func.kind === 175 && hasBindableName(func)) { + var getter = ts6.getDeclarationOfKind( + getSymbolOfNode(declaration.parent), + 174 + /* SyntaxKind.GetAccessor */ + ); + if (getter) { + var getterSignature = getSignatureFromDeclaration(getter); + var thisParameter = getAccessorThisParameter(func); + if (thisParameter && declaration === thisParameter) { + ts6.Debug.assert(!thisParameter.type); + return getTypeOfSymbol(getterSignature.thisParameter); + } + return getReturnTypeOfSignature(getterSignature); + } + } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; + var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); + if (type) { + return addOptionality( + type, + /*isProperty*/ + false, + isOptional + ); + } + } + if (ts6.hasOnlyExpressionInitializer(declaration) && !!declaration.initializer) { + if (ts6.isInJSFile(declaration) && !ts6.isParameter(declaration)) { + var containerObjectType = getJSContainerObjectType(declaration, getSymbolOfNode(declaration), ts6.getDeclaredExpandoInitializer(declaration)); + if (containerObjectType) { + return containerObjectType; + } + } + var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode)); + return addOptionality(type, isProperty, isOptional); + } + if (ts6.isPropertyDeclaration(declaration) && (noImplicitAny || ts6.isInJSFile(declaration))) { + if (!ts6.hasStaticModifier(declaration)) { + var constructor = findConstructorDeclaration(declaration.parent); + var type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) : ts6.getEffectiveModifierFlags(declaration) & 2 ? getTypeOfPropertyInBaseClass(declaration.symbol) : void 0; + return type && addOptionality( + type, + /*isProperty*/ + true, + isOptional + ); + } else { + var staticBlocks = ts6.filter(declaration.parent.members, ts6.isClassStaticBlockDeclaration); + var type = staticBlocks.length ? getFlowTypeInStaticBlocks(declaration.symbol, staticBlocks) : ts6.getEffectiveModifierFlags(declaration) & 2 ? getTypeOfPropertyInBaseClass(declaration.symbol) : void 0; + return type && addOptionality( + type, + /*isProperty*/ + true, + isOptional + ); + } + } + if (ts6.isJsxAttribute(declaration)) { + return trueType; + } + if (ts6.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern( + declaration.name, + /*includePatternInType*/ + false, + /*reportErrors*/ + true + ); + } + return void 0; + } + function isConstructorDeclaredProperty(symbol) { + if (symbol.valueDeclaration && ts6.isBinaryExpression(symbol.valueDeclaration)) { + var links = getSymbolLinks(symbol); + if (links.isConstructorDeclaredProperty === void 0) { + links.isConstructorDeclaredProperty = false; + links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts6.every(symbol.declarations, function(declaration) { + return ts6.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && (declaration.left.kind !== 209 || ts6.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration( + /*declaredType*/ + void 0, + declaration, + symbol, + declaration + ); + }); + } + return links.isConstructorDeclaredProperty; + } + return false; + } + function isAutoTypedProperty(symbol) { + var declaration = symbol.valueDeclaration; + return declaration && ts6.isPropertyDeclaration(declaration) && !ts6.getEffectiveTypeAnnotationNode(declaration) && !declaration.initializer && (noImplicitAny || ts6.isInJSFile(declaration)); + } + function getDeclaringConstructor(symbol) { + if (!symbol.declarations) { + return; + } + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var container = ts6.getThisContainer( + declaration, + /*includeArrowFunctions*/ + false + ); + if (container && (container.kind === 173 || isJSConstructor(container))) { + return container; + } + } + } + function getFlowTypeFromCommonJSExport(symbol) { + var file = ts6.getSourceFileOfNode(symbol.declarations[0]); + var accessName = ts6.unescapeLeadingUnderscores(symbol.escapedName); + var areAllModuleExports = symbol.declarations.every(function(d) { + return ts6.isInJSFile(d) && ts6.isAccessExpression(d) && ts6.isModuleExportsAccessExpression(d.expression); + }); + var reference = areAllModuleExports ? ts6.factory.createPropertyAccessExpression(ts6.factory.createPropertyAccessExpression(ts6.factory.createIdentifier("module"), ts6.factory.createIdentifier("exports")), accessName) : ts6.factory.createPropertyAccessExpression(ts6.factory.createIdentifier("exports"), accessName); + if (areAllModuleExports) { + ts6.setParent(reference.expression.expression, reference.expression); + } + ts6.setParent(reference.expression, reference); + ts6.setParent(reference, file); + reference.flowNode = file.endFlowNode; + return getFlowTypeOfReference(reference, autoType, undefinedType); + } + function getFlowTypeInStaticBlocks(symbol, staticBlocks) { + var accessName = ts6.startsWith(symbol.escapedName, "__#") ? ts6.factory.createPrivateIdentifier(symbol.escapedName.split("@")[1]) : ts6.unescapeLeadingUnderscores(symbol.escapedName); + for (var _i = 0, staticBlocks_1 = staticBlocks; _i < staticBlocks_1.length; _i++) { + var staticBlock = staticBlocks_1[_i]; + var reference = ts6.factory.createPropertyAccessExpression(ts6.factory.createThis(), accessName); + ts6.setParent(reference.expression, reference); + ts6.setParent(reference, staticBlock); + reference.flowNode = staticBlock.returnFlowNode; + var flowType = getFlowTypeOfProperty(reference, symbol); + if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) { + error(symbol.valueDeclaration, ts6.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + } + if (everyType(flowType, isNullableType)) { + continue; + } + return convertAutoToAny(flowType); + } + } + function getFlowTypeInConstructor(symbol, constructor) { + var accessName = ts6.startsWith(symbol.escapedName, "__#") ? ts6.factory.createPrivateIdentifier(symbol.escapedName.split("@")[1]) : ts6.unescapeLeadingUnderscores(symbol.escapedName); + var reference = ts6.factory.createPropertyAccessExpression(ts6.factory.createThis(), accessName); + ts6.setParent(reference.expression, reference); + ts6.setParent(reference, constructor); + reference.flowNode = constructor.returnFlowNode; + var flowType = getFlowTypeOfProperty(reference, symbol); + if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) { + error(symbol.valueDeclaration, ts6.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + } + return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType); + } + function getFlowTypeOfProperty(reference, prop) { + var initialType = (prop === null || prop === void 0 ? void 0 : prop.valueDeclaration) && (!isAutoTypedProperty(prop) || ts6.getEffectiveModifierFlags(prop.valueDeclaration) & 2) && getTypeOfPropertyInBaseClass(prop) || undefinedType; + return getFlowTypeOfReference(reference, autoType, initialType); + } + function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) { + var container = ts6.getAssignedExpandoInitializer(symbol.valueDeclaration); + if (container) { + var tag = ts6.getJSDocTypeTag(container); + if (tag && tag.typeExpression) { + return getTypeFromTypeNode(tag.typeExpression); + } + var containerObjectType = symbol.valueDeclaration && getJSContainerObjectType(symbol.valueDeclaration, symbol, container); + return containerObjectType || getWidenedLiteralType(checkExpressionCached(container)); + } + var type; + var definedInConstructor = false; + var definedInMethod = false; + if (isConstructorDeclaredProperty(symbol)) { + type = getFlowTypeInConstructor(symbol, getDeclaringConstructor(symbol)); + } + if (!type) { + var types = void 0; + if (symbol.declarations) { + var jsdocType = void 0; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var expression = ts6.isBinaryExpression(declaration) || ts6.isCallExpression(declaration) ? declaration : ts6.isAccessExpression(declaration) ? ts6.isBinaryExpression(declaration.parent) ? declaration.parent : declaration : void 0; + if (!expression) { + continue; + } + var kind = ts6.isAccessExpression(expression) ? ts6.getAssignmentDeclarationPropertyAccessKind(expression) : ts6.getAssignmentDeclarationKind(expression); + if (kind === 4 || ts6.isBinaryExpression(expression) && isPossiblyAliasedThisProperty(expression, kind)) { + if (isDeclarationInConstructor(expression)) { + definedInConstructor = true; + } else { + definedInMethod = true; + } + } + if (!ts6.isCallExpression(expression)) { + jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration); + } + if (!jsdocType) { + (types || (types = [])).push(ts6.isBinaryExpression(expression) || ts6.isCallExpression(expression) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType); + } + } + type = jsdocType; + } + if (!type) { + if (!ts6.length(types)) { + return errorType; + } + var constructorTypes = definedInConstructor && symbol.declarations ? getConstructorDefinedThisAssignmentTypes(types, symbol.declarations) : void 0; + if (definedInMethod) { + var propType = getTypeOfPropertyInBaseClass(symbol); + if (propType) { + (constructorTypes || (constructorTypes = [])).push(propType); + definedInConstructor = true; + } + } + var sourceTypes = ts6.some(constructorTypes, function(t) { + return !!(t.flags & ~98304); + }) ? constructorTypes : types; + type = getUnionType(sourceTypes); + } + } + var widened = getWidenedType(addOptionality( + type, + /*isProperty*/ + false, + definedInMethod && !definedInConstructor + )); + if (symbol.valueDeclaration && filterType(widened, function(t) { + return !!(t.flags & ~98304); + }) === neverType) { + reportImplicitAny(symbol.valueDeclaration, anyType); + return anyType; + } + return widened; + } + function getJSContainerObjectType(decl, symbol, init) { + var _a, _b; + if (!ts6.isInJSFile(decl) || !init || !ts6.isObjectLiteralExpression(init) || init.properties.length) { + return void 0; + } + var exports2 = ts6.createSymbolTable(); + while (ts6.isBinaryExpression(decl) || ts6.isPropertyAccessExpression(decl)) { + var s_2 = getSymbolOfNode(decl); + if ((_a = s_2 === null || s_2 === void 0 ? void 0 : s_2.exports) === null || _a === void 0 ? void 0 : _a.size) { + mergeSymbolTable(exports2, s_2.exports); + } + decl = ts6.isBinaryExpression(decl) ? decl.parent : decl.parent.parent; + } + var s = getSymbolOfNode(decl); + if ((_b = s === null || s === void 0 ? void 0 : s.exports) === null || _b === void 0 ? void 0 : _b.size) { + mergeSymbolTable(exports2, s.exports); + } + var type = createAnonymousType(symbol, exports2, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + type.objectFlags |= 4096; + return type; + } + function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) { + var _a; + var typeNode = ts6.getEffectiveTypeAnnotationNode(expression.parent); + if (typeNode) { + var type = getWidenedType(getTypeFromTypeNode(typeNode)); + if (!declaredType) { + return type; + } else if (!isErrorType(declaredType) && !isErrorType(type) && !isTypeIdenticalTo(declaredType, type)) { + errorNextVariableOrPropertyDeclarationMustHaveSameType( + /*firstDeclaration*/ + void 0, + declaredType, + declaration, + type + ); + } + } + if ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) { + var typeNode_2 = ts6.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration); + if (typeNode_2) { + var annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName); + if (annotationSymbol) { + return getNonMissingTypeOfSymbol(annotationSymbol); + } + } + } + return declaredType; + } + function getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) { + if (ts6.isCallExpression(expression)) { + if (resolvedSymbol) { + return getTypeOfSymbol(resolvedSymbol); + } + var objectLitType = checkExpressionCached(expression.arguments[2]); + var valueType = getTypeOfPropertyOfType(objectLitType, "value"); + if (valueType) { + return valueType; + } + var getFunc = getTypeOfPropertyOfType(objectLitType, "get"); + if (getFunc) { + var getSig = getSingleCallSignature(getFunc); + if (getSig) { + return getReturnTypeOfSignature(getSig); + } + } + var setFunc = getTypeOfPropertyOfType(objectLitType, "set"); + if (setFunc) { + var setSig = getSingleCallSignature(setFunc); + if (setSig) { + return getTypeOfFirstParameterOfSignature(setSig); + } + } + return anyType; + } + if (containsSameNamedThisProperty(expression.left, expression.right)) { + return anyType; + } + var isDirectExport = kind === 1 && (ts6.isPropertyAccessExpression(expression.left) || ts6.isElementAccessExpression(expression.left)) && (ts6.isModuleExportsAccessExpression(expression.left.expression) || ts6.isIdentifier(expression.left.expression) && ts6.isExportsIdentifier(expression.left.expression)); + var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol) : isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right)) : getWidenedLiteralType(checkExpressionCached(expression.right)); + if (type.flags & 524288 && kind === 2 && symbol.escapedName === "export=") { + var exportedType = resolveStructuredTypeMembers(type); + var members_4 = ts6.createSymbolTable(); + ts6.copyEntries(exportedType.members, members_4); + var initialSize = members_4.size; + if (resolvedSymbol && !resolvedSymbol.exports) { + resolvedSymbol.exports = ts6.createSymbolTable(); + } + (resolvedSymbol || symbol).exports.forEach(function(s, name) { + var _a; + var exportedMember = members_4.get(name); + if (exportedMember && exportedMember !== s && !(s.flags & 2097152)) { + if (s.flags & 111551 && exportedMember.flags & 111551) { + if (s.valueDeclaration && exportedMember.valueDeclaration && ts6.getSourceFileOfNode(s.valueDeclaration) !== ts6.getSourceFileOfNode(exportedMember.valueDeclaration)) { + var unescapedName = ts6.unescapeLeadingUnderscores(s.escapedName); + var exportedMemberName = ((_a = ts6.tryCast(exportedMember.valueDeclaration, ts6.isNamedDeclaration)) === null || _a === void 0 ? void 0 : _a.name) || exportedMember.valueDeclaration; + ts6.addRelatedInfo(error(s.valueDeclaration, ts6.Diagnostics.Duplicate_identifier_0, unescapedName), ts6.createDiagnosticForNode(exportedMemberName, ts6.Diagnostics._0_was_also_declared_here, unescapedName)); + ts6.addRelatedInfo(error(exportedMemberName, ts6.Diagnostics.Duplicate_identifier_0, unescapedName), ts6.createDiagnosticForNode(s.valueDeclaration, ts6.Diagnostics._0_was_also_declared_here, unescapedName)); + } + var union = createSymbol(s.flags | exportedMember.flags, name); + union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]); + union.valueDeclaration = exportedMember.valueDeclaration; + union.declarations = ts6.concatenate(exportedMember.declarations, s.declarations); + members_4.set(name, union); + } else { + members_4.set(name, mergeSymbol(s, exportedMember)); + } + } else { + members_4.set(name, s); + } + }); + var result = createAnonymousType( + initialSize !== members_4.size ? void 0 : exportedType.symbol, + // Only set the type's symbol if it looks to be the same as the original type + members_4, + exportedType.callSignatures, + exportedType.constructSignatures, + exportedType.indexInfos + ); + if (initialSize === members_4.size) { + if (type.aliasSymbol) { + result.aliasSymbol = type.aliasSymbol; + result.aliasTypeArguments = type.aliasTypeArguments; + } + if (ts6.getObjectFlags(type) & 4) { + result.aliasSymbol = type.symbol; + var args = getTypeArguments(type); + result.aliasTypeArguments = ts6.length(args) ? args : void 0; + } + } + result.objectFlags |= ts6.getObjectFlags(type) & 4096; + if (result.symbol && result.symbol.flags & 32 && type === getDeclaredTypeOfClassOrInterface(result.symbol)) { + result.objectFlags |= 16777216; + } + return result; + } + if (isEmptyArrayLiteralType(type)) { + reportImplicitAny(expression, anyArrayType); + return anyArrayType; + } + return type; + } + function containsSameNamedThisProperty(thisProperty, expression) { + return ts6.isPropertyAccessExpression(thisProperty) && thisProperty.expression.kind === 108 && ts6.forEachChildRecursively(expression, function(n) { + return isMatchingReference(thisProperty, n); + }); + } + function isDeclarationInConstructor(expression) { + var thisContainer = ts6.getThisContainer( + expression, + /*includeArrowFunctions*/ + false + ); + return thisContainer.kind === 173 || thisContainer.kind === 259 || thisContainer.kind === 215 && !ts6.isPrototypePropertyAssignment(thisContainer.parent); + } + function getConstructorDefinedThisAssignmentTypes(types, declarations) { + ts6.Debug.assert(types.length === declarations.length); + return types.filter(function(_, i) { + var declaration = declarations[i]; + var expression = ts6.isBinaryExpression(declaration) ? declaration : ts6.isBinaryExpression(declaration.parent) ? declaration.parent : void 0; + return expression && isDeclarationInConstructor(expression); + }); + } + function getTypeFromBindingElement(element, includePatternInType, reportErrors) { + if (element.initializer) { + var contextualType = ts6.isBindingPattern(element.name) ? getTypeFromBindingPattern( + element.name, + /*includePatternInType*/ + true, + /*reportErrors*/ + false + ) : unknownType; + return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0, contextualType))); + } + if (ts6.isBindingPattern(element.name)) { + return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); + } + if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAny(element, anyType); + } + return includePatternInType ? nonInferrableAnyType : anyType; + } + function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { + var members = ts6.createSymbolTable(); + var stringIndexInfo; + var objectFlags = 128 | 131072; + ts6.forEach(pattern.elements, function(e) { + var name = e.propertyName || e.name; + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo( + stringType, + anyType, + /*isReadonly*/ + false + ); + return; + } + var exprType = getLiteralTypeFromPropertyName(name); + if (!isTypeUsableAsPropertyName(exprType)) { + objectFlags |= 512; + return; + } + var text = getPropertyNameFromType(exprType); + var flags = 4 | (e.initializer ? 16777216 : 0); + var symbol = createSymbol(flags, text); + symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); + symbol.bindingElement = e; + members.set(symbol.escapedName, symbol); + }); + var result = createAnonymousType(void 0, members, ts6.emptyArray, ts6.emptyArray, stringIndexInfo ? [stringIndexInfo] : ts6.emptyArray); + result.objectFlags |= objectFlags; + if (includePatternInType) { + result.pattern = pattern; + result.objectFlags |= 131072; + } + return result; + } + function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { + var elements = pattern.elements; + var lastElement = ts6.lastOrUndefined(elements); + var restElement = lastElement && lastElement.kind === 205 && lastElement.dotDotDotToken ? lastElement : void 0; + if (elements.length === 0 || elements.length === 1 && restElement) { + return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; + } + var elementTypes = ts6.map(elements, function(e) { + return ts6.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); + }); + var minLength = ts6.findLastIndex(elements, function(e) { + return !(e === restElement || ts6.isOmittedExpression(e) || hasDefaultValue(e)); + }, elements.length - 1) + 1; + var elementFlags = ts6.map(elements, function(e, i) { + return e === restElement ? 4 : i >= minLength ? 2 : 1; + }); + var result = createTupleType(elementTypes, elementFlags); + if (includePatternInType) { + result = cloneTypeReference(result); + result.pattern = pattern; + result.objectFlags |= 131072; + } + return result; + } + function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { + if (includePatternInType === void 0) { + includePatternInType = false; + } + if (reportErrors === void 0) { + reportErrors = false; + } + return pattern.kind === 203 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); + } + function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { + return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration( + declaration, + /*includeOptionality*/ + true, + 0 + /* CheckMode.Normal */ + ), declaration, reportErrors); + } + function isGlobalSymbolConstructor(node) { + var symbol = getSymbolOfNode(node); + var globalSymbol = getGlobalESSymbolConstructorTypeSymbol( + /*reportErrors*/ + false + ); + return globalSymbol && symbol && symbol === globalSymbol; + } + function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors) { + if (type) { + if (type.flags & 4096 && isGlobalSymbolConstructor(declaration.parent)) { + type = getESSymbolLikeTypeForNode(declaration); + } + if (reportErrors) { + reportErrorsFromWidening(declaration, type); + } + if (type.flags & 8192 && (ts6.isBindingElement(declaration) || !declaration.type) && type.symbol !== getSymbolOfNode(declaration)) { + type = esSymbolType; + } + return getWidenedType(type); + } + type = ts6.isParameter(declaration) && declaration.dotDotDotToken ? anyArrayType : anyType; + if (reportErrors) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { + reportImplicitAny(declaration, type); + } + } + return type; + } + function declarationBelongsToPrivateAmbientMember(declaration) { + var root = ts6.getRootDeclaration(declaration); + var memberDeclaration = root.kind === 166 ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } + function tryGetTypeFromEffectiveTypeNode(node) { + var typeNode = ts6.getEffectiveTypeAnnotationNode(node); + if (typeNode) { + return getTypeFromTypeNode(typeNode); + } + } + function getTypeOfVariableOrParameterOrProperty(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + var type = getTypeOfVariableOrParameterOrPropertyWorker(symbol); + if (!links.type) { + links.type = type; + } + } + return links.type; + } + function getTypeOfVariableOrParameterOrPropertyWorker(symbol) { + if (symbol.flags & 4194304) { + return getTypeOfPrototypeProperty(symbol); + } + if (symbol === requireSymbol) { + return anyType; + } + if (symbol.flags & 134217728 && symbol.valueDeclaration) { + var fileSymbol = getSymbolOfNode(ts6.getSourceFileOfNode(symbol.valueDeclaration)); + var result = createSymbol(fileSymbol.flags, "exports"); + result.declarations = fileSymbol.declarations ? fileSymbol.declarations.slice() : []; + result.parent = symbol; + result.target = fileSymbol; + if (fileSymbol.valueDeclaration) + result.valueDeclaration = fileSymbol.valueDeclaration; + if (fileSymbol.members) + result.members = new ts6.Map(fileSymbol.members); + if (fileSymbol.exports) + result.exports = new ts6.Map(fileSymbol.exports); + var members = ts6.createSymbolTable(); + members.set("exports", result); + return createAnonymousType(symbol, members, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + } + ts6.Debug.assertIsDefined(symbol.valueDeclaration); + var declaration = symbol.valueDeclaration; + if (ts6.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { + var typeNode = ts6.getEffectiveTypeAnnotationNode(declaration); + if (typeNode === void 0) { + return useUnknownInCatchVariables ? unknownType : anyType; + } + var type_1 = getTypeOfNode(typeNode); + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; + } + if (ts6.isSourceFile(declaration) && ts6.isJsonSourceFile(declaration)) { + if (!declaration.statements.length) { + return emptyObjectType; + } + return getWidenedType(getWidenedLiteralType(checkExpression(declaration.statements[0].expression))); + } + if (ts6.isAccessor(declaration)) { + return getTypeOfAccessors(symbol); + } + if (!pushTypeResolution( + symbol, + 0 + /* TypeSystemPropertyName.Type */ + )) { + if (symbol.flags & 512 && !(symbol.flags & 67108864)) { + return getTypeOfFuncClassEnumModule(symbol); + } + return reportCircularityError(symbol); + } + var type; + if (declaration.kind === 274) { + type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); + } else if (ts6.isBinaryExpression(declaration) || ts6.isInJSFile(declaration) && (ts6.isCallExpression(declaration) || (ts6.isPropertyAccessExpression(declaration) || ts6.isBindableStaticElementAccessExpression(declaration)) && ts6.isBinaryExpression(declaration.parent))) { + type = getWidenedTypeForAssignmentDeclaration(symbol); + } else if (ts6.isPropertyAccessExpression(declaration) || ts6.isElementAccessExpression(declaration) || ts6.isIdentifier(declaration) || ts6.isStringLiteralLike(declaration) || ts6.isNumericLiteral(declaration) || ts6.isClassDeclaration(declaration) || ts6.isFunctionDeclaration(declaration) || ts6.isMethodDeclaration(declaration) && !ts6.isObjectLiteralMethod(declaration) || ts6.isMethodSignature(declaration) || ts6.isSourceFile(declaration)) { + if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) { + return getTypeOfFuncClassEnumModule(symbol); + } + type = ts6.isBinaryExpression(declaration.parent) ? getWidenedTypeForAssignmentDeclaration(symbol) : tryGetTypeFromEffectiveTypeNode(declaration) || anyType; + } else if (ts6.isPropertyAssignment(declaration)) { + type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration); + } else if (ts6.isJsxAttribute(declaration)) { + type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration); + } else if (ts6.isShorthandPropertyAssignment(declaration)) { + type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation( + declaration.name, + 0 + /* CheckMode.Normal */ + ); + } else if (ts6.isObjectLiteralMethod(declaration)) { + type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod( + declaration, + 0 + /* CheckMode.Normal */ + ); + } else if (ts6.isParameter(declaration) || ts6.isPropertyDeclaration(declaration) || ts6.isPropertySignature(declaration) || ts6.isVariableDeclaration(declaration) || ts6.isBindingElement(declaration) || ts6.isJSDocPropertyLikeTag(declaration)) { + type = getWidenedTypeForVariableLikeDeclaration( + declaration, + /*includeOptionality*/ + true + ); + } else if (ts6.isEnumDeclaration(declaration)) { + type = getTypeOfFuncClassEnumModule(symbol); + } else if (ts6.isEnumMember(declaration)) { + type = getTypeOfEnumMember(symbol); + } else { + return ts6.Debug.fail("Unhandled declaration kind! " + ts6.Debug.formatSyntaxKind(declaration.kind) + " for " + ts6.Debug.formatSymbol(symbol)); + } + if (!popTypeResolution()) { + if (symbol.flags & 512 && !(symbol.flags & 67108864)) { + return getTypeOfFuncClassEnumModule(symbol); + } + return reportCircularityError(symbol); + } + return type; + } + function getAnnotatedAccessorTypeNode(accessor) { + if (accessor) { + switch (accessor.kind) { + case 174: + var getterTypeAnnotation = ts6.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175: + var setterTypeAnnotation = ts6.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169: + ts6.Debug.assert(ts6.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts6.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; + } + } + return void 0; + } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } + function getAnnotatedAccessorThisParameter(accessor) { + var parameter = getAccessorThisParameter(accessor); + return parameter && parameter.symbol; + } + function getThisTypeOfDeclaration(declaration) { + return getThisTypeOfSignature(getSignatureFromDeclaration(declaration)); + } + function getTypeOfAccessors(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + if (!pushTypeResolution( + symbol, + 0 + /* TypeSystemPropertyName.Type */ + )) { + return errorType; + } + var getter = ts6.getDeclarationOfKind( + symbol, + 174 + /* SyntaxKind.GetAccessor */ + ); + var setter = ts6.getDeclarationOfKind( + symbol, + 175 + /* SyntaxKind.SetAccessor */ + ); + var accessor = ts6.tryCast(ts6.getDeclarationOfKind( + symbol, + 169 + /* SyntaxKind.PropertyDeclaration */ + ), ts6.isAutoAccessorPropertyDeclaration); + var type = getter && ts6.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration( + accessor, + /*includeOptionality*/ + true + ); + if (!type) { + if (setter && !isPrivateWithinAmbient(setter)) { + errorOrSuggestion(noImplicitAny, setter, ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); + } else if (getter && !isPrivateWithinAmbient(getter)) { + errorOrSuggestion(noImplicitAny, getter, ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); + } else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts6.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } + type = anyType; + } + if (!popTypeResolution()) { + if (getAnnotatedAccessorTypeNode(getter)) { + error(getter, ts6.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getAnnotatedAccessorTypeNode(setter)) { + error(setter, ts6.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts6.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { + error(getter, ts6.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } + type = anyType; + } + links.type = type; + } + return links.type; + } + function getWriteTypeOfAccessors(symbol) { + var _a; + var links = getSymbolLinks(symbol); + if (!links.writeType) { + if (!pushTypeResolution( + symbol, + 8 + /* TypeSystemPropertyName.WriteType */ + )) { + return errorType; + } + var setter = (_a = ts6.getDeclarationOfKind( + symbol, + 175 + /* SyntaxKind.SetAccessor */ + )) !== null && _a !== void 0 ? _a : ts6.tryCast(ts6.getDeclarationOfKind( + symbol, + 169 + /* SyntaxKind.PropertyDeclaration */ + ), ts6.isAutoAccessorPropertyDeclaration); + var writeType = getAnnotatedAccessorType(setter); + if (!popTypeResolution()) { + if (getAnnotatedAccessorTypeNode(setter)) { + error(setter, ts6.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + writeType = anyType; + } + links.writeType = writeType || getTypeOfAccessors(symbol); + } + return links.writeType; + } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 8650752 ? baseConstructorType : baseConstructorType.flags & 2097152 ? ts6.find(baseConstructorType.types, function(t) { + return !!(t.flags & 8650752); + }) : void 0; + } + function getTypeOfFuncClassEnumModule(symbol) { + var links = getSymbolLinks(symbol); + var originalLinks = links; + if (!links.type) { + var expando = symbol.valueDeclaration && getSymbolOfExpando( + symbol.valueDeclaration, + /*allowDeclaration*/ + false + ); + if (expando) { + var merged = mergeJSSymbols(symbol, expando); + if (merged) { + symbol = links = merged; + } + } + originalLinks.type = links.type = getTypeOfFuncClassEnumModuleWorker(symbol); + } + return links.type; + } + function getTypeOfFuncClassEnumModuleWorker(symbol) { + var declaration = symbol.valueDeclaration; + if (symbol.flags & 1536 && ts6.isShorthandAmbientModuleSymbol(symbol)) { + return anyType; + } else if (declaration && (declaration.kind === 223 || ts6.isAccessExpression(declaration) && declaration.parent.kind === 223)) { + return getWidenedTypeForAssignmentDeclaration(symbol); + } else if (symbol.flags & 512 && declaration && ts6.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { + var resolvedModule = resolveExternalModuleSymbol(symbol); + if (resolvedModule !== symbol) { + if (!pushTypeResolution( + symbol, + 0 + /* TypeSystemPropertyName.Type */ + )) { + return errorType; + } + var exportEquals = getMergedSymbol(symbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + )); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? void 0 : resolvedModule); + if (!popTypeResolution()) { + return reportCircularityError(symbol); + } + return type_2; + } + } + var type = createObjectType(16, symbol); + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } else { + return strictNullChecks && symbol.flags & 16777216 ? getOptionalType(type) : type; + } + } + function getTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + return links.type || (links.type = getDeclaredTypeOfEnumMember(symbol)); + } + function getTypeOfAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + var targetSymbol = resolveAlias(symbol); + var exportSymbol = symbol.declarations && getTargetOfAliasDeclaration( + getDeclarationOfAliasSymbol(symbol), + /*dontResolveAlias*/ + true + ); + var declaredType = ts6.firstDefined(exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations, function(d) { + return ts6.isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0; + }); + links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getAllSymbolFlags(targetSymbol) & 111551 ? getTypeOfSymbol(targetSymbol) : errorType; + } + return links.type; + } + function getTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + return links.type || (links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper)); + } + function getWriteTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + return links.writeType || (links.writeType = instantiateType(getWriteTypeOfSymbol(links.target), links.mapper)); + } + function reportCircularityError(symbol) { + var declaration = symbol.valueDeclaration; + if (ts6.getEffectiveTypeAnnotationNode(declaration)) { + error(symbol.valueDeclaration, ts6.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return errorType; + } + if (noImplicitAny && (declaration.kind !== 166 || declaration.initializer)) { + error(symbol.valueDeclaration, ts6.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } + function getTypeOfSymbolWithDeferredType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + ts6.Debug.assertIsDefined(links.deferralParent); + ts6.Debug.assertIsDefined(links.deferralConstituents); + links.type = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents); + } + return links.type; + } + function getWriteTypeOfSymbolWithDeferredType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.writeType && links.deferralWriteConstituents) { + ts6.Debug.assertIsDefined(links.deferralParent); + ts6.Debug.assertIsDefined(links.deferralConstituents); + links.writeType = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents); + } + return links.writeType; + } + function getWriteTypeOfSymbol(symbol) { + var checkFlags = ts6.getCheckFlags(symbol); + if (symbol.flags & 4) { + return checkFlags & 2 ? checkFlags & 65536 ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.writeType || symbol.type : getTypeOfSymbol(symbol); + } + if (symbol.flags & 98304) { + return checkFlags & 1 ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol); + } + return getTypeOfSymbol(symbol); + } + function getTypeOfSymbol(symbol) { + var checkFlags = ts6.getCheckFlags(symbol); + if (checkFlags & 65536) { + return getTypeOfSymbolWithDeferredType(symbol); + } + if (checkFlags & 1) { + return getTypeOfInstantiatedSymbol(symbol); + } + if (checkFlags & 262144) { + return getTypeOfMappedSymbol(symbol); + } + if (checkFlags & 8192) { + return getTypeOfReverseMappedSymbol(symbol); + } + if (symbol.flags & (3 | 4)) { + return getTypeOfVariableOrParameterOrProperty(symbol); + } + if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) { + return getTypeOfFuncClassEnumModule(symbol); + } + if (symbol.flags & 8) { + return getTypeOfEnumMember(symbol); + } + if (symbol.flags & 98304) { + return getTypeOfAccessors(symbol); + } + if (symbol.flags & 2097152) { + return getTypeOfAlias(symbol); + } + return errorType; + } + function getNonMissingTypeOfSymbol(symbol) { + return removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216)); + } + function isReferenceToType(type, target) { + return type !== void 0 && target !== void 0 && (ts6.getObjectFlags(type) & 4) !== 0 && type.target === target; + } + function getTargetType(type) { + return ts6.getObjectFlags(type) & 4 ? type.target : type; + } + function hasBaseType(type, checkBase) { + return check(type); + function check(type2) { + if (ts6.getObjectFlags(type2) & (3 | 4)) { + var target = getTargetType(type2); + return target === checkBase || ts6.some(getBaseTypes(target), check); + } else if (type2.flags & 2097152) { + return ts6.some(type2.types, check); + } + return false; + } + } + function appendTypeParameters(typeParameters, declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + typeParameters = ts6.appendIfUnique(typeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration))); + } + return typeParameters; + } + function getOuterTypeParameters(node, includeThisTypes) { + while (true) { + node = node.parent; + if (node && ts6.isBinaryExpression(node)) { + var assignmentKind = ts6.getAssignmentDeclarationKind(node); + if (assignmentKind === 6 || assignmentKind === 3) { + var symbol = getSymbolOfNode(node.left); + if (symbol && symbol.parent && !ts6.findAncestor(symbol.parent.valueDeclaration, function(d) { + return node === d; + })) { + node = symbol.parent.valueDeclaration; + } + } + } + if (!node) { + return void 0; + } + switch (node.kind) { + case 260: + case 228: + case 261: + case 176: + case 177: + case 170: + case 181: + case 182: + case 320: + case 259: + case 171: + case 215: + case 216: + case 262: + case 347: + case 348: + case 342: + case 341: + case 197: + case 191: { + var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); + if (node.kind === 197) { + return ts6.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); + } else if (node.kind === 191) { + return ts6.concatenate(outerTypeParameters, getInferTypeParameters(node)); + } + var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts6.getEffectiveTypeParameterDeclarations(node)); + var thisType = includeThisTypes && (node.kind === 260 || node.kind === 228 || node.kind === 261 || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + return thisType ? ts6.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; + } + case 343: + var paramSymbol = ts6.getParameterSymbolFromJSDoc(node); + if (paramSymbol) { + node = paramSymbol.valueDeclaration; + } + break; + case 323: { + var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); + return node.tags ? appendTypeParameters(outerTypeParameters, ts6.flatMap(node.tags, function(t) { + return ts6.isJSDocTemplateTag(t) ? t.typeParameters : void 0; + })) : outerTypeParameters; + } + } + } + } + function getOuterTypeParametersOfClassOrInterface(symbol) { + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts6.getDeclarationOfKind( + symbol, + 261 + /* SyntaxKind.InterfaceDeclaration */ + ); + ts6.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); + return getOuterTypeParameters(declaration); + } + function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { + if (!symbol.declarations) { + return; + } + var result; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var node = _a[_i]; + if (node.kind === 261 || node.kind === 260 || node.kind === 228 || isJSConstructor(node) || ts6.isTypeAlias(node)) { + var declaration = node; + result = appendTypeParameters(result, ts6.getEffectiveTypeParameterDeclarations(declaration)); + } + } + return result; + } + function getTypeParametersOfClassOrInterface(symbol) { + return ts6.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); + } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType( + type, + 1 + /* SignatureKind.Construct */ + ); + if (signatures.length === 1) { + var s = signatures[0]; + if (!s.typeParameters && s.parameters.length === 1 && signatureHasRestParameter(s)) { + var paramType = getTypeOfParameter(s.parameters[0]); + return isTypeAny(paramType) || getElementTypeOfArrayType(paramType) === anyType; + } + } + return false; + } + function isConstructorType(type) { + if (getSignaturesOfType( + type, + 1 + /* SignatureKind.Construct */ + ).length > 0) { + return true; + } + if (type.flags & 8650752) { + var constraint = getBaseConstraintOfType(type); + return !!constraint && isMixinConstructorType(constraint); + } + return false; + } + function getBaseTypeNodeOfClass(type) { + var decl = ts6.getClassLikeDeclarationOfSymbol(type.symbol); + return decl && ts6.getEffectiveBaseTypeNode(decl); + } + function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var typeArgCount = ts6.length(typeArgumentNodes); + var isJavascript = ts6.isInJSFile(location); + return ts6.filter(getSignaturesOfType( + type, + 1 + /* SignatureKind.Construct */ + ), function(sig) { + return (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts6.length(sig.typeParameters); + }); + } + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location); + var typeArguments = ts6.map(typeArgumentNodes, getTypeFromTypeNode); + return ts6.sameMap(signatures, function(sig) { + return ts6.some(sig.typeParameters) ? getSignatureInstantiation(sig, typeArguments, ts6.isInJSFile(location)) : sig; + }); + } + function getBaseConstructorTypeOfClass(type) { + if (!type.resolvedBaseConstructorType) { + var decl = ts6.getClassLikeDeclarationOfSymbol(type.symbol); + var extended = decl && ts6.getEffectiveBaseTypeNode(decl); + var baseTypeNode = getBaseTypeNodeOfClass(type); + if (!baseTypeNode) { + return type.resolvedBaseConstructorType = undefinedType; + } + if (!pushTypeResolution( + type, + 1 + /* TypeSystemPropertyName.ResolvedBaseConstructorType */ + )) { + return errorType; + } + var baseConstructorType = checkExpression(baseTypeNode.expression); + if (extended && baseTypeNode !== extended) { + ts6.Debug.assert(!extended.typeArguments); + checkExpression(extended.expression); + } + if (baseConstructorType.flags & (524288 | 2097152)) { + resolveStructuredTypeMembers(baseConstructorType); + } + if (!popTypeResolution()) { + error(type.symbol.valueDeclaration, ts6.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); + return type.resolvedBaseConstructorType = errorType; + } + if (!(baseConstructorType.flags & 1) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { + var err = error(baseTypeNode.expression, ts6.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); + if (baseConstructorType.flags & 262144) { + var constraint = getConstraintFromTypeParameter(baseConstructorType); + var ctorReturn = unknownType; + if (constraint) { + var ctorSig = getSignaturesOfType( + constraint, + 1 + /* SignatureKind.Construct */ + ); + if (ctorSig[0]) { + ctorReturn = getReturnTypeOfSignature(ctorSig[0]); + } + } + if (baseConstructorType.symbol.declarations) { + ts6.addRelatedInfo(err, ts6.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts6.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn))); + } + } + return type.resolvedBaseConstructorType = errorType; + } + type.resolvedBaseConstructorType = baseConstructorType; + } + return type.resolvedBaseConstructorType; + } + function getImplementsTypes(type) { + var resolvedImplementsTypes = ts6.emptyArray; + if (type.symbol.declarations) { + for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var implementsTypeNodes = ts6.getEffectiveImplementsTypeNodes(declaration); + if (!implementsTypeNodes) + continue; + for (var _b = 0, implementsTypeNodes_1 = implementsTypeNodes; _b < implementsTypeNodes_1.length; _b++) { + var node = implementsTypeNodes_1[_b]; + var implementsType = getTypeFromTypeNode(node); + if (!isErrorType(implementsType)) { + if (resolvedImplementsTypes === ts6.emptyArray) { + resolvedImplementsTypes = [implementsType]; + } else { + resolvedImplementsTypes.push(implementsType); + } + } + } + } + } + return resolvedImplementsTypes; + } + function reportCircularBaseType(node, type) { + error(node, ts6.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString( + type, + /*enclosingDeclaration*/ + void 0, + 2 + /* TypeFormatFlags.WriteArrayAsGenericType */ + )); + } + function getBaseTypes(type) { + if (!type.baseTypesResolved) { + if (pushTypeResolution( + type, + 7 + /* TypeSystemPropertyName.ResolvedBaseTypes */ + )) { + if (type.objectFlags & 8) { + type.resolvedBaseTypes = [getTupleBaseType(type)]; + } else if (type.symbol.flags & (32 | 64)) { + if (type.symbol.flags & 32) { + resolveBaseTypesOfClass(type); + } + if (type.symbol.flags & 64) { + resolveBaseTypesOfInterface(type); + } + } else { + ts6.Debug.fail("type must be class or interface"); + } + if (!popTypeResolution() && type.symbol.declarations) { + for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 260 || declaration.kind === 261) { + reportCircularBaseType(declaration, type); + } + } + } + } + type.baseTypesResolved = true; + } + return type.resolvedBaseTypes; + } + function getTupleBaseType(type) { + var elementTypes = ts6.sameMap(type.typeParameters, function(t, i) { + return type.elementFlags[i] & 8 ? getIndexedAccessType(t, numberType) : t; + }); + return createArrayType(getUnionType(elementTypes || ts6.emptyArray), type.readonly); + } + function resolveBaseTypesOfClass(type) { + type.resolvedBaseTypes = ts6.resolvingEmptyArray; + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (524288 | 2097152 | 1))) { + return type.resolvedBaseTypes = ts6.emptyArray; + } + var baseTypeNode = getBaseTypeNodeOfClass(type); + var baseType; + var originalBaseType = baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : void 0; + if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 && areAllOuterTypeParametersApplied(originalBaseType)) { + baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); + } else if (baseConstructorType.flags & 1) { + baseType = baseConstructorType; + } else { + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); + if (!constructors.length) { + error(baseTypeNode.expression, ts6.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); + return type.resolvedBaseTypes = ts6.emptyArray; + } + baseType = getReturnTypeOfSignature(constructors[0]); + } + if (isErrorType(baseType)) { + return type.resolvedBaseTypes = ts6.emptyArray; + } + var reducedBaseType = getReducedType(baseType); + if (!isValidBaseType(reducedBaseType)) { + var elaboration = elaborateNeverIntersection( + /*errorInfo*/ + void 0, + baseType + ); + var diagnostic = ts6.chainDiagnosticMessages(elaboration, ts6.Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members, typeToString(reducedBaseType)); + diagnostics.add(ts6.createDiagnosticForNodeFromMessageChain(baseTypeNode.expression, diagnostic)); + return type.resolvedBaseTypes = ts6.emptyArray; + } + if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) { + error(type.symbol.valueDeclaration, ts6.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString( + type, + /*enclosingDeclaration*/ + void 0, + 2 + /* TypeFormatFlags.WriteArrayAsGenericType */ + )); + return type.resolvedBaseTypes = ts6.emptyArray; + } + if (type.resolvedBaseTypes === ts6.resolvingEmptyArray) { + type.members = void 0; + } + return type.resolvedBaseTypes = [reducedBaseType]; + } + function areAllOuterTypeParametersApplied(type) { + var outerTypeParameters = type.outerTypeParameters; + if (outerTypeParameters) { + var last_1 = outerTypeParameters.length - 1; + var typeArguments = getTypeArguments(type); + return outerTypeParameters[last_1].symbol !== typeArguments[last_1].symbol; + } + return true; + } + function isValidBaseType(type) { + if (type.flags & 262144) { + var constraint = getBaseConstraintOfType(type); + if (constraint) { + return isValidBaseType(constraint); + } + } + return !!(type.flags & (524288 | 67108864 | 1) && !isGenericMappedType(type) || type.flags & 2097152 && ts6.every(type.types, isValidBaseType)); + } + function resolveBaseTypesOfInterface(type) { + type.resolvedBaseTypes = type.resolvedBaseTypes || ts6.emptyArray; + if (type.symbol.declarations) { + for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 261 && ts6.getInterfaceBaseTypeNodes(declaration)) { + for (var _b = 0, _c = ts6.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { + var node = _c[_b]; + var baseType = getReducedType(getTypeFromTypeNode(node)); + if (!isErrorType(baseType)) { + if (isValidBaseType(baseType)) { + if (type !== baseType && !hasBaseType(baseType, type)) { + if (type.resolvedBaseTypes === ts6.emptyArray) { + type.resolvedBaseTypes = [baseType]; + } else { + type.resolvedBaseTypes.push(baseType); + } + } else { + reportCircularBaseType(declaration, type); + } + } else { + error(node, ts6.Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members); + } + } + } + } + } + } + } + function isThislessInterface(symbol) { + if (!symbol.declarations) { + return true; + } + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 261) { + if (declaration.flags & 128) { + return false; + } + var baseTypeNodes = ts6.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) { + var node = baseTypeNodes_1[_b]; + if (ts6.isEntityNameExpression(node.expression)) { + var baseSymbol = resolveEntityName( + node.expression, + 788968, + /*ignoreErrors*/ + true + ); + if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } + function getDeclaredTypeOfClassOrInterface(symbol) { + var links = getSymbolLinks(symbol); + var originalLinks = links; + if (!links.declaredType) { + var kind = symbol.flags & 32 ? 1 : 2; + var merged = mergeJSSymbols(symbol, symbol.valueDeclaration && getAssignedClassSymbol(symbol.valueDeclaration)); + if (merged) { + symbol = links = merged; + } + var type = originalLinks.declaredType = links.declaredType = createObjectType(kind, symbol); + var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); + var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + if (outerTypeParameters || localTypeParameters || kind === 1 || !isThislessInterface(symbol)) { + type.objectFlags |= 4; + type.typeParameters = ts6.concatenate(outerTypeParameters, localTypeParameters); + type.outerTypeParameters = outerTypeParameters; + type.localTypeParameters = localTypeParameters; + type.instantiations = new ts6.Map(); + type.instantiations.set(getTypeListId(type.typeParameters), type); + type.target = type; + type.resolvedTypeArguments = type.typeParameters; + type.thisType = createTypeParameter(symbol); + type.thisType.isThisType = true; + type.thisType.constraint = type; + } + } + return links.declaredType; + } + function getDeclaredTypeOfTypeAlias(symbol) { + var _a; + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + if (!pushTypeResolution( + symbol, + 2 + /* TypeSystemPropertyName.DeclaredType */ + )) { + return errorType; + } + var declaration = ts6.Debug.checkDefined((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isTypeAlias), "Type alias symbol with no valid declaration found"); + var typeNode = ts6.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type; + var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType; + if (popTypeResolution()) { + var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + if (typeParameters) { + links.typeParameters = typeParameters; + links.instantiations = new ts6.Map(); + links.instantiations.set(getTypeListId(typeParameters), type); + } + } else { + type = errorType; + if (declaration.kind === 342) { + error(declaration.typeExpression.type, ts6.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } else { + error(ts6.isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, ts6.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } + } + links.declaredType = type; + } + return links.declaredType; + } + function isStringConcatExpression(expr) { + if (ts6.isStringLiteralLike(expr)) { + return true; + } else if (expr.kind === 223) { + return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); + } + return false; + } + function isLiteralEnumMember(member) { + var expr = member.initializer; + if (!expr) { + return !(member.flags & 16777216); + } + switch (expr.kind) { + case 10: + case 8: + case 14: + return true; + case 221: + return expr.operator === 40 && expr.operand.kind === 8; + case 79: + return ts6.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); + case 223: + return isStringConcatExpression(expr); + default: + return false; + } + } + function getEnumKind(symbol) { + var links = getSymbolLinks(symbol); + if (links.enumKind !== void 0) { + return links.enumKind; + } + var hasNonLiteralMember = false; + if (symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 263) { + for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (member.initializer && ts6.isStringLiteralLike(member.initializer)) { + return links.enumKind = 1; + } + if (!isLiteralEnumMember(member)) { + hasNonLiteralMember = true; + } + } + } + } + } + return links.enumKind = hasNonLiteralMember ? 0 : 1; + } + function getBaseTypeOfEnumLiteralType(type) { + return type.flags & 1024 && !(type.flags & 1048576) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type; + } + function getDeclaredTypeOfEnum(symbol) { + var links = getSymbolLinks(symbol); + if (links.declaredType) { + return links.declaredType; + } + if (getEnumKind(symbol) === 1) { + enumCount++; + var memberTypeList = []; + if (symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 263) { + for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { + var member = _c[_b]; + var value = getEnumMemberValue(member); + var memberType = getFreshTypeOfLiteralType(getEnumLiteralType(value !== void 0 ? value : 0, enumCount, getSymbolOfNode(member))); + getSymbolLinks(getSymbolOfNode(member)).declaredType = memberType; + memberTypeList.push(getRegularTypeOfLiteralType(memberType)); + } + } + } + } + if (memberTypeList.length) { + var enumType_1 = getUnionType( + memberTypeList, + 1, + symbol, + /*aliasTypeArguments*/ + void 0 + ); + if (enumType_1.flags & 1048576) { + enumType_1.flags |= 1024; + enumType_1.symbol = symbol; + } + return links.declaredType = enumType_1; + } + } + var enumType = createType( + 32 + /* TypeFlags.Enum */ + ); + enumType.symbol = symbol; + return links.declaredType = enumType; + } + function getDeclaredTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + if (!links.declaredType) { + links.declaredType = enumType; + } + } + return links.declaredType; + } + function getDeclaredTypeOfTypeParameter(symbol) { + var links = getSymbolLinks(symbol); + return links.declaredType || (links.declaredType = createTypeParameter(symbol)); + } + function getDeclaredTypeOfAlias(symbol) { + var links = getSymbolLinks(symbol); + return links.declaredType || (links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol))); + } + function getDeclaredTypeOfSymbol(symbol) { + return tryGetDeclaredTypeOfSymbol(symbol) || errorType; + } + function tryGetDeclaredTypeOfSymbol(symbol) { + if (symbol.flags & (32 | 64)) { + return getDeclaredTypeOfClassOrInterface(symbol); + } + if (symbol.flags & 524288) { + return getDeclaredTypeOfTypeAlias(symbol); + } + if (symbol.flags & 262144) { + return getDeclaredTypeOfTypeParameter(symbol); + } + if (symbol.flags & 384) { + return getDeclaredTypeOfEnum(symbol); + } + if (symbol.flags & 8) { + return getDeclaredTypeOfEnumMember(symbol); + } + if (symbol.flags & 2097152) { + return getDeclaredTypeOfAlias(symbol); + } + return void 0; + } + function isThislessType(node) { + switch (node.kind) { + case 131: + case 157: + case 152: + case 148: + case 160: + case 134: + case 153: + case 149: + case 114: + case 155: + case 144: + case 198: + return true; + case 185: + return isThislessType(node.elementType); + case 180: + return !node.typeArguments || node.typeArguments.every(isThislessType); + } + return false; + } + function isThislessTypeParameter(node) { + var constraint = ts6.getEffectiveConstraintOfTypeParameter(node); + return !constraint || isThislessType(constraint); + } + function isThislessVariableLikeDeclaration(node) { + var typeNode = ts6.getEffectiveTypeAnnotationNode(node); + return typeNode ? isThislessType(typeNode) : !ts6.hasInitializer(node); + } + function isThislessFunctionLikeDeclaration(node) { + var returnType = ts6.getEffectiveReturnTypeNode(node); + var typeParameters = ts6.getEffectiveTypeParameterDeclarations(node); + return (node.kind === 173 || !!returnType && isThislessType(returnType)) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); + } + function isThisless(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 169: + case 168: + return isThislessVariableLikeDeclaration(declaration); + case 171: + case 170: + case 173: + case 174: + case 175: + return isThislessFunctionLikeDeclaration(declaration); + } + } + } + return false; + } + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { + var result = ts6.createSymbolTable(); + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; + result.set(symbol.escapedName, mappingThisOnly && isThisless(symbol) ? symbol : instantiateSymbol(symbol, mapper)); + } + return result; + } + function addInheritedMembers(symbols, baseSymbols) { + for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { + var s = baseSymbols_1[_i]; + if (!symbols.has(s.escapedName) && !isStaticPrivateIdentifierProperty(s)) { + symbols.set(s.escapedName, s); + } + } + } + function isStaticPrivateIdentifierProperty(s) { + return !!s.valueDeclaration && ts6.isPrivateIdentifierClassElementDeclaration(s.valueDeclaration) && ts6.isStatic(s.valueDeclaration); + } + function resolveDeclaredMembers(type) { + if (!type.declaredProperties) { + var symbol = type.symbol; + var members = getMembersOfSymbol(symbol); + type.declaredProperties = getNamedMembers(members); + type.declaredCallSignatures = ts6.emptyArray; + type.declaredConstructSignatures = ts6.emptyArray; + type.declaredIndexInfos = ts6.emptyArray; + type.declaredCallSignatures = getSignaturesOfSymbol(members.get( + "__call" + /* InternalSymbolName.Call */ + )); + type.declaredConstructSignatures = getSignaturesOfSymbol(members.get( + "__new" + /* InternalSymbolName.New */ + )); + type.declaredIndexInfos = getIndexInfosOfSymbol(symbol); + } + return type; + } + function isTypeUsableAsPropertyName(type) { + return !!(type.flags & 8576); + } + function isLateBindableName(node) { + if (!ts6.isComputedPropertyName(node) && !ts6.isElementAccessExpression(node)) { + return false; + } + var expr = ts6.isComputedPropertyName(node) ? node.expression : node.argumentExpression; + return ts6.isEntityNameExpression(expr) && isTypeUsableAsPropertyName(ts6.isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr)); + } + function isLateBoundName(name) { + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) === 64; + } + function hasLateBindableName(node) { + var name = ts6.getNameOfDeclaration(node); + return !!name && isLateBindableName(name); + } + function hasBindableName(node) { + return !ts6.hasDynamicName(node) || hasLateBindableName(node); + } + function isNonBindableDynamicName(node) { + return ts6.isDynamicName(node) && !isLateBindableName(node); + } + function getPropertyNameFromType(type) { + if (type.flags & 8192) { + return type.escapedName; + } + if (type.flags & (128 | 256)) { + return ts6.escapeLeadingUnderscores("" + type.value); + } + return ts6.Debug.fail(); + } + function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) { + ts6.Debug.assert(!!(ts6.getCheckFlags(symbol) & 4096), "Expected a late-bound symbol."); + symbol.flags |= symbolFlags; + getSymbolLinks(member.symbol).lateSymbol = symbol; + if (!symbol.declarations) { + symbol.declarations = [member]; + } else if (!member.symbol.isReplaceableByMethod) { + symbol.declarations.push(member); + } + if (symbolFlags & 111551) { + if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) { + symbol.valueDeclaration = member; + } + } + } + function lateBindMember(parent, earlySymbols, lateSymbols, decl) { + ts6.Debug.assert(!!decl.symbol, "The member is expected to have a symbol."); + var links = getNodeLinks(decl); + if (!links.resolvedSymbol) { + links.resolvedSymbol = decl.symbol; + var declName = ts6.isBinaryExpression(decl) ? decl.left : decl.name; + var type = ts6.isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName); + if (isTypeUsableAsPropertyName(type)) { + var memberName = getPropertyNameFromType(type); + var symbolFlags = decl.symbol.flags; + var lateSymbol = lateSymbols.get(memberName); + if (!lateSymbol) + lateSymbols.set(memberName, lateSymbol = createSymbol( + 0, + memberName, + 4096 + /* CheckFlags.Late */ + )); + var earlySymbol = earlySymbols && earlySymbols.get(memberName); + if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) { + var declarations = earlySymbol ? ts6.concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations; + var name_5 = !(type.flags & 8192) && ts6.unescapeLeadingUnderscores(memberName) || ts6.declarationNameToString(declName); + ts6.forEach(declarations, function(declaration) { + return error(ts6.getNameOfDeclaration(declaration) || declaration, ts6.Diagnostics.Property_0_was_also_declared_here, name_5); + }); + error(declName || decl, ts6.Diagnostics.Duplicate_property_0, name_5); + lateSymbol = createSymbol( + 0, + memberName, + 4096 + /* CheckFlags.Late */ + ); + } + lateSymbol.nameType = type; + addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags); + if (lateSymbol.parent) { + ts6.Debug.assert(lateSymbol.parent === parent, "Existing symbol parent should match new one"); + } else { + lateSymbol.parent = parent; + } + return links.resolvedSymbol = lateSymbol; + } + } + return links.resolvedSymbol; + } + function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) { + var links = getSymbolLinks(symbol); + if (!links[resolutionKind]) { + var isStatic_1 = resolutionKind === "resolvedExports"; + var earlySymbols = !isStatic_1 ? symbol.members : symbol.flags & 1536 ? getExportsOfModuleWorker(symbol) : symbol.exports; + links[resolutionKind] = earlySymbols || emptySymbols; + var lateSymbols = ts6.createSymbolTable(); + for (var _i = 0, _a = symbol.declarations || ts6.emptyArray; _i < _a.length; _i++) { + var decl = _a[_i]; + var members = ts6.getMembersOfDeclaration(decl); + if (members) { + for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { + var member = members_5[_b]; + if (isStatic_1 === ts6.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } + } + } + } + } + var assignments = symbol.assignmentDeclarationMembers; + if (assignments) { + var decls = ts6.arrayFrom(assignments.values()); + for (var _c = 0, decls_1 = decls; _c < decls_1.length; _c++) { + var member = decls_1[_c]; + var assignmentKind = ts6.getAssignmentDeclarationKind(member); + var isInstanceMember = assignmentKind === 3 || ts6.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 || assignmentKind === 6; + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } + } + } + } + links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols; + } + return links[resolutionKind]; + } + function getMembersOfSymbol(symbol) { + return symbol.flags & 6256 ? getResolvedMembersOrExportsOfSymbol( + symbol, + "resolvedMembers" + /* MembersOrExportsResolutionKind.resolvedMembers */ + ) : symbol.members || emptySymbols; + } + function getLateBoundSymbol(symbol) { + if (symbol.flags & 106500 && symbol.escapedName === "__computed") { + var links = getSymbolLinks(symbol); + if (!links.lateSymbol && ts6.some(symbol.declarations, hasLateBindableName)) { + var parent = getMergedSymbol(symbol.parent); + if (ts6.some(symbol.declarations, ts6.hasStaticModifier)) { + getExportsOfSymbol(parent); + } else { + getMembersOfSymbol(parent); + } + } + return links.lateSymbol || (links.lateSymbol = symbol); + } + return symbol; + } + function getTypeWithThisArgument(type, thisArgument, needApparentType) { + if (ts6.getObjectFlags(type) & 4) { + var target = type.target; + var typeArguments = getTypeArguments(type); + if (ts6.length(target.typeParameters) === ts6.length(typeArguments)) { + var ref = createTypeReference(target, ts6.concatenate(typeArguments, [thisArgument || target.thisType])); + return needApparentType ? getApparentType(ref) : ref; + } + } else if (type.flags & 2097152) { + var types = ts6.sameMap(type.types, function(t) { + return getTypeWithThisArgument(t, thisArgument, needApparentType); + }); + return types !== type.types ? getIntersectionType(types) : type; + } + return needApparentType ? getApparentType(type) : type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper; + var members; + var callSignatures; + var constructSignatures; + var indexInfos; + if (ts6.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + members = source.symbol ? getMembersOfSymbol(source.symbol) : ts6.createSymbolTable(source.declaredProperties); + callSignatures = source.declaredCallSignatures; + constructSignatures = source.declaredConstructSignatures; + indexInfos = source.declaredIndexInfos; + } else { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable( + source.declaredProperties, + mapper, + /*mappingThisOnly*/ + typeParameters.length === 1 + ); + callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper); + constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper); + indexInfos = instantiateIndexInfos(source.declaredIndexInfos, mapper); + } + var baseTypes = getBaseTypes(source); + if (baseTypes.length) { + if (source.symbol && members === getMembersOfSymbol(source.symbol)) { + members = ts6.createSymbolTable(source.declaredProperties); + } + setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos); + var thisArgument = ts6.lastOrUndefined(typeArguments); + for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { + var baseType = baseTypes_1[_i]; + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); + callSignatures = ts6.concatenate(callSignatures, getSignaturesOfType( + instantiatedBaseType, + 0 + /* SignatureKind.Call */ + )); + constructSignatures = ts6.concatenate(constructSignatures, getSignaturesOfType( + instantiatedBaseType, + 1 + /* SignatureKind.Construct */ + )); + var inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [createIndexInfo( + stringType, + anyType, + /*isReadonly*/ + false + )]; + indexInfos = ts6.concatenate(indexInfos, ts6.filter(inheritedIndexInfos, function(info) { + return !findIndexInfo(indexInfos, info.keyType); + })); + } + } + setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos); + } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), ts6.emptyArray, ts6.emptyArray); + } + function resolveTypeReferenceMembers(type) { + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts6.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = getTypeArguments(type); + var paddedTypeArguments = typeArguments.length === typeParameters.length ? typeArguments : ts6.concatenate(typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, paddedTypeArguments); + } + function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, resolvedTypePredicate, minArgumentCount, flags) { + var sig = new Signature(checker, flags); + sig.declaration = declaration; + sig.typeParameters = typeParameters; + sig.parameters = parameters; + sig.thisParameter = thisParameter; + sig.resolvedReturnType = resolvedReturnType; + sig.resolvedTypePredicate = resolvedTypePredicate; + sig.minArgumentCount = minArgumentCount; + sig.resolvedMinArgumentCount = void 0; + sig.target = void 0; + sig.mapper = void 0; + sig.compositeSignatures = void 0; + sig.compositeKind = void 0; + return sig; + } + function cloneSignature(sig) { + var result = createSignature( + sig.declaration, + sig.typeParameters, + sig.thisParameter, + sig.parameters, + /*resolvedReturnType*/ + void 0, + /*resolvedTypePredicate*/ + void 0, + sig.minArgumentCount, + sig.flags & 39 + /* SignatureFlags.PropagatingFlags */ + ); + result.target = sig.target; + result.mapper = sig.mapper; + result.compositeSignatures = sig.compositeSignatures; + result.compositeKind = sig.compositeKind; + return result; + } + function createUnionSignature(signature, unionSignatures) { + var result = cloneSignature(signature); + result.compositeSignatures = unionSignatures; + result.compositeKind = 1048576; + result.target = void 0; + result.mapper = void 0; + return result; + } + function getOptionalCallSignature(signature, callChainFlags) { + if ((signature.flags & 24) === callChainFlags) { + return signature; + } + if (!signature.optionalCallSignatureCache) { + signature.optionalCallSignatureCache = {}; + } + var key = callChainFlags === 8 ? "inner" : "outer"; + return signature.optionalCallSignatureCache[key] || (signature.optionalCallSignatureCache[key] = createOptionalCallSignature(signature, callChainFlags)); + } + function createOptionalCallSignature(signature, callChainFlags) { + ts6.Debug.assert(callChainFlags === 8 || callChainFlags === 16, "An optional call signature can either be for an inner call chain or an outer call chain, but not both."); + var result = cloneSignature(signature); + result.flags |= callChainFlags; + return result; + } + function getExpandedParameters(sig, skipUnionExpanding) { + if (signatureHasRestParameter(sig)) { + var restIndex_1 = sig.parameters.length - 1; + var restType = getTypeOfSymbol(sig.parameters[restIndex_1]); + if (isTupleType(restType)) { + return [expandSignatureParametersWithTupleMembers(restType, restIndex_1)]; + } else if (!skipUnionExpanding && restType.flags & 1048576 && ts6.every(restType.types, isTupleType)) { + return ts6.map(restType.types, function(t) { + return expandSignatureParametersWithTupleMembers(t, restIndex_1); + }); + } + } + return [sig.parameters]; + function expandSignatureParametersWithTupleMembers(restType2, restIndex) { + var elementTypes = getTypeArguments(restType2); + var associatedNames = restType2.target.labeledElementDeclarations; + var restParams = ts6.map(elementTypes, function(t, i) { + var tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]); + var name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType2); + var flags = restType2.target.elementFlags[i]; + var checkFlags = flags & 12 ? 32768 : flags & 2 ? 16384 : 0; + var symbol = createSymbol(1, name, checkFlags); + symbol.type = flags & 4 ? createArrayType(t) : t; + return symbol; + }); + return ts6.concatenate(sig.parameters.slice(0, restIndex), restParams); + } + } + function getDefaultConstructSignatures(classType) { + var baseConstructorType = getBaseConstructorTypeOfClass(classType); + var baseSignatures = getSignaturesOfType( + baseConstructorType, + 1 + /* SignatureKind.Construct */ + ); + var declaration = ts6.getClassLikeDeclarationOfSymbol(classType.symbol); + var isAbstract = !!declaration && ts6.hasSyntacticModifier( + declaration, + 256 + /* ModifierFlags.Abstract */ + ); + if (baseSignatures.length === 0) { + return [createSignature( + void 0, + classType.localTypeParameters, + void 0, + ts6.emptyArray, + classType, + /*resolvedTypePredicate*/ + void 0, + 0, + isAbstract ? 4 : 0 + /* SignatureFlags.None */ + )]; + } + var baseTypeNode = getBaseTypeNodeOfClass(classType); + var isJavaScript = ts6.isInJSFile(baseTypeNode); + var typeArguments = typeArgumentsFromTypeReferenceNode(baseTypeNode); + var typeArgCount = ts6.length(typeArguments); + var result = []; + for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { + var baseSig = baseSignatures_1[_i]; + var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); + var typeParamCount = ts6.length(baseSig.typeParameters); + if (isJavaScript || typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount) { + var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, isJavaScript)) : cloneSignature(baseSig); + sig.typeParameters = classType.localTypeParameters; + sig.resolvedReturnType = classType; + sig.flags = isAbstract ? sig.flags | 4 : sig.flags & ~4; + result.push(sig); + } + } + return result; + } + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { + for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { + var s = signatureList_1[_i]; + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, partialMatch ? compareTypesSubtypeOf : compareTypesIdentical)) { + return s; + } + } + } + function findMatchingSignatures(signatureLists, signature, listIndex) { + if (signature.typeParameters) { + if (listIndex > 0) { + return void 0; + } + for (var i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature( + signatureLists[i], + signature, + /*partialMatch*/ + false, + /*ignoreThisTypes*/ + false, + /*ignoreReturnTypes*/ + false + )) { + return void 0; + } + } + return [signature]; + } + var result; + for (var i = 0; i < signatureLists.length; i++) { + var match = i === listIndex ? signature : findMatchingSignature( + signatureLists[i], + signature, + /*partialMatch*/ + true, + /*ignoreThisTypes*/ + false, + /*ignoreReturnTypes*/ + true + ); + if (!match) { + return void 0; + } + result = ts6.appendIfUnique(result, match); + } + return result; + } + function getUnionSignatures(signatureLists) { + var result; + var indexWithLengthOverOne; + for (var i = 0; i < signatureLists.length; i++) { + if (signatureLists[i].length === 0) + return ts6.emptyArray; + if (signatureLists[i].length > 1) { + indexWithLengthOverOne = indexWithLengthOverOne === void 0 ? i : -1; + } + for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { + var signature = _a[_i]; + if (!result || !findMatchingSignature( + result, + signature, + /*partialMatch*/ + false, + /*ignoreThisTypes*/ + false, + /*ignoreReturnTypes*/ + true + )) { + var unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + var s = signature; + if (unionSignatures.length > 1) { + var thisParameter = signature.thisParameter; + var firstThisParameterOfUnionSignatures = ts6.forEach(unionSignatures, function(sig) { + return sig.thisParameter; + }); + if (firstThisParameterOfUnionSignatures) { + var thisType = getIntersectionType(ts6.mapDefined(unionSignatures, function(sig) { + return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); + })); + thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType); + } + s = createUnionSignature(signature, unionSignatures); + s.thisParameter = thisParameter; + } + (result || (result = [])).push(s); + } + } + } + } + if (!ts6.length(result) && indexWithLengthOverOne !== -1) { + var masterList = signatureLists[indexWithLengthOverOne !== void 0 ? indexWithLengthOverOne : 0]; + var results = masterList.slice(); + var _loop_10 = function(signatures2) { + if (signatures2 !== masterList) { + var signature_1 = signatures2[0]; + ts6.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass"); + results = !!signature_1.typeParameters && ts6.some(results, function(s2) { + return !!s2.typeParameters && !compareTypeParametersIdentical(signature_1.typeParameters, s2.typeParameters); + }) ? void 0 : ts6.map(results, function(sig) { + return combineSignaturesOfUnionMembers(sig, signature_1); + }); + if (!results) { + return "break"; + } + } + }; + for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) { + var signatures = signatureLists_1[_b]; + var state_3 = _loop_10(signatures); + if (state_3 === "break") + break; + } + result = results; + } + return result || ts6.emptyArray; + } + function compareTypeParametersIdentical(sourceParams, targetParams) { + if (ts6.length(sourceParams) !== ts6.length(targetParams)) { + return false; + } + if (!sourceParams || !targetParams) { + return true; + } + var mapper = createTypeMapper(targetParams, sourceParams); + for (var i = 0; i < sourceParams.length; i++) { + var source = sourceParams[i]; + var target = targetParams[i]; + if (source === target) + continue; + if (!isTypeIdenticalTo(getConstraintFromTypeParameter(source) || unknownType, instantiateType(getConstraintFromTypeParameter(target) || unknownType, mapper))) + return false; + } + return true; + } + function combineUnionThisParam(left, right, mapper) { + if (!left || !right) { + return left || right; + } + var thisType = getIntersectionType([getTypeOfSymbol(left), instantiateType(getTypeOfSymbol(right), mapper)]); + return createSymbolWithType(left, thisType); + } + function combineUnionParameters(left, right, mapper) { + var leftCount = getParameterCount(left); + var rightCount = getParameterCount(right); + var longest = leftCount >= rightCount ? left : right; + var shorter = longest === left ? right : left; + var longestCount = longest === left ? leftCount : rightCount; + var eitherHasEffectiveRest = hasEffectiveRestParameter(left) || hasEffectiveRestParameter(right); + var needsExtraRestElement = eitherHasEffectiveRest && !hasEffectiveRestParameter(longest); + var params = new Array(longestCount + (needsExtraRestElement ? 1 : 0)); + for (var i = 0; i < longestCount; i++) { + var longestParamType = tryGetTypeAtPosition(longest, i); + if (longest === right) { + longestParamType = instantiateType(longestParamType, mapper); + } + var shorterParamType = tryGetTypeAtPosition(shorter, i) || unknownType; + if (shorter === right) { + shorterParamType = instantiateType(shorterParamType, mapper); + } + var unionParamType = getIntersectionType([longestParamType, shorterParamType]); + var isRestParam = eitherHasEffectiveRest && !needsExtraRestElement && i === longestCount - 1; + var isOptional = i >= getMinArgumentCount(longest) && i >= getMinArgumentCount(shorter); + var leftName = i >= leftCount ? void 0 : getParameterNameAtPosition(left, i); + var rightName = i >= rightCount ? void 0 : getParameterNameAtPosition(right, i); + var paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0; + var paramSymbol = createSymbol(1 | (isOptional && !isRestParam ? 16777216 : 0), paramName || "arg".concat(i)); + paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType; + params[i] = paramSymbol; + } + if (needsExtraRestElement) { + var restParamSymbol = createSymbol(1, "args"); + restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount)); + if (shorter === right) { + restParamSymbol.type = instantiateType(restParamSymbol.type, mapper); + } + params[longestCount] = restParamSymbol; + } + return params; + } + function combineSignaturesOfUnionMembers(left, right) { + var typeParams = left.typeParameters || right.typeParameters; + var paramMapper; + if (left.typeParameters && right.typeParameters) { + paramMapper = createTypeMapper(right.typeParameters, left.typeParameters); + } + var declaration = left.declaration; + var params = combineUnionParameters(left, right, paramMapper); + var thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper); + var minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount); + var result = createSignature( + declaration, + typeParams, + thisParam, + params, + /*resolvedReturnType*/ + void 0, + /*resolvedTypePredicate*/ + void 0, + minArgCount, + (left.flags | right.flags) & 39 + /* SignatureFlags.PropagatingFlags */ + ); + result.compositeKind = 1048576; + result.compositeSignatures = ts6.concatenate(left.compositeKind !== 2097152 && left.compositeSignatures || [left], [right]); + if (paramMapper) { + result.mapper = left.compositeKind !== 2097152 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; + } + return result; + } + function getUnionIndexInfos(types) { + var sourceInfos = getIndexInfosOfType(types[0]); + if (sourceInfos) { + var result = []; + var _loop_11 = function(info2) { + var indexType = info2.keyType; + if (ts6.every(types, function(t) { + return !!getIndexInfoOfType(t, indexType); + })) { + result.push(createIndexInfo(indexType, getUnionType(ts6.map(types, function(t) { + return getIndexTypeOfType(t, indexType); + })), ts6.some(types, function(t) { + return getIndexInfoOfType(t, indexType).isReadonly; + }))); + } + }; + for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) { + var info = sourceInfos_1[_i]; + _loop_11(info); + } + return result; + } + return ts6.emptyArray; + } + function resolveUnionTypeMembers(type) { + var callSignatures = getUnionSignatures(ts6.map(type.types, function(t) { + return t === globalFunctionType ? [unknownSignature] : getSignaturesOfType( + t, + 0 + /* SignatureKind.Call */ + ); + })); + var constructSignatures = getUnionSignatures(ts6.map(type.types, function(t) { + return getSignaturesOfType( + t, + 1 + /* SignatureKind.Construct */ + ); + })); + var indexInfos = getUnionIndexInfos(type.types); + setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, indexInfos); + } + function intersectTypes(type1, type2) { + return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); + } + function findMixins(types) { + var constructorTypeCount = ts6.countWhere(types, function(t) { + return getSignaturesOfType( + t, + 1 + /* SignatureKind.Construct */ + ).length > 0; + }); + var mixinFlags = ts6.map(types, isMixinConstructorType); + if (constructorTypeCount > 0 && constructorTypeCount === ts6.countWhere(mixinFlags, function(b) { + return b; + })) { + var firstMixinIndex = mixinFlags.indexOf( + /*searchElement*/ + true + ); + mixinFlags[firstMixinIndex] = false; + } + return mixinFlags; + } + function includeMixinType(type, types, mixinFlags, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } else if (mixinFlags[i]) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType( + types[i], + 1 + /* SignatureKind.Construct */ + )[0])); + } + } + return getIntersectionType(mixedTypes); + } + function resolveIntersectionTypeMembers(type) { + var callSignatures; + var constructSignatures; + var indexInfos; + var types = type.types; + var mixinFlags = findMixins(types); + var mixinCount = ts6.countWhere(mixinFlags, function(b) { + return b; + }); + var _loop_12 = function(i2) { + var t = type.types[i2]; + if (!mixinFlags[i2]) { + var signatures = getSignaturesOfType( + t, + 1 + /* SignatureKind.Construct */ + ); + if (signatures.length && mixinCount > 0) { + signatures = ts6.map(signatures, function(s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i2); + return clone; + }); + } + constructSignatures = appendSignatures(constructSignatures, signatures); + } + callSignatures = appendSignatures(callSignatures, getSignaturesOfType( + t, + 0 + /* SignatureKind.Call */ + )); + indexInfos = ts6.reduceLeft(getIndexInfosOfType(t), function(infos, newInfo) { + return appendIndexInfo( + infos, + newInfo, + /*union*/ + false + ); + }, indexInfos); + }; + for (var i = 0; i < types.length; i++) { + _loop_12(i); + } + setStructuredTypeMembers(type, emptySymbols, callSignatures || ts6.emptyArray, constructSignatures || ts6.emptyArray, indexInfos || ts6.emptyArray); + } + function appendSignatures(signatures, newSignatures) { + var _loop_13 = function(sig2) { + if (!signatures || ts6.every(signatures, function(s) { + return !compareSignaturesIdentical( + s, + sig2, + /*partialMatch*/ + false, + /*ignoreThisTypes*/ + false, + /*ignoreReturnTypes*/ + false, + compareTypesIdentical + ); + })) { + signatures = ts6.append(signatures, sig2); + } + }; + for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) { + var sig = newSignatures_1[_i]; + _loop_13(sig); + } + return signatures; + } + function appendIndexInfo(indexInfos, newInfo, union) { + if (indexInfos) { + for (var i = 0; i < indexInfos.length; i++) { + var info = indexInfos[i]; + if (info.keyType === newInfo.keyType) { + indexInfos[i] = createIndexInfo(info.keyType, union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]), union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly); + return indexInfos; + } + } + } + return ts6.append(indexInfos, newInfo); + } + function resolveAnonymousTypeMembers(type) { + if (type.target) { + setStructuredTypeMembers(type, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var members_6 = createInstantiatedSymbolTable( + getPropertiesOfObjectType(type.target), + type.mapper, + /*mappingThisOnly*/ + false + ); + var callSignatures = instantiateSignatures(getSignaturesOfType( + type.target, + 0 + /* SignatureKind.Call */ + ), type.mapper); + var constructSignatures = instantiateSignatures(getSignaturesOfType( + type.target, + 1 + /* SignatureKind.Construct */ + ), type.mapper); + var indexInfos_1 = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper); + setStructuredTypeMembers(type, members_6, callSignatures, constructSignatures, indexInfos_1); + return; + } + var symbol = getMergedSymbol(type.symbol); + if (symbol.flags & 2048) { + setStructuredTypeMembers(type, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var members_7 = getMembersOfSymbol(symbol); + var callSignatures = getSignaturesOfSymbol(members_7.get( + "__call" + /* InternalSymbolName.Call */ + )); + var constructSignatures = getSignaturesOfSymbol(members_7.get( + "__new" + /* InternalSymbolName.New */ + )); + var indexInfos_2 = getIndexInfosOfSymbol(symbol); + setStructuredTypeMembers(type, members_7, callSignatures, constructSignatures, indexInfos_2); + return; + } + var members = emptySymbols; + var indexInfos; + if (symbol.exports) { + members = getExportsOfSymbol(symbol); + if (symbol === globalThisSymbol) { + var varsOnly_1 = new ts6.Map(); + members.forEach(function(p) { + var _a; + if (!(p.flags & 418) && !(p.flags & 512 && ((_a = p.declarations) === null || _a === void 0 ? void 0 : _a.length) && ts6.every(p.declarations, ts6.isAmbientModule))) { + varsOnly_1.set(p.escapedName, p); + } + }); + members = varsOnly_1; + } + } + var baseConstructorIndexInfo; + setStructuredTypeMembers(type, members, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + if (symbol.flags & 32) { + var classType = getDeclaredTypeOfClassOrInterface(symbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classType); + if (baseConstructorType.flags & (524288 | 2097152 | 8650752)) { + members = ts6.createSymbolTable(getNamedOrIndexSignatureMembers(members)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); + } else if (baseConstructorType === anyType) { + baseConstructorIndexInfo = createIndexInfo( + stringType, + anyType, + /*isReadonly*/ + false + ); + } + } + var indexSymbol = getIndexSymbolFromSymbolTable(members); + if (indexSymbol) { + indexInfos = getIndexInfosOfIndexSymbol(indexSymbol); + } else { + if (baseConstructorIndexInfo) { + indexInfos = ts6.append(indexInfos, baseConstructorIndexInfo); + } + if (symbol.flags & 384 && (getDeclaredTypeOfSymbol(symbol).flags & 32 || ts6.some(type.properties, function(prop) { + return !!(getTypeOfSymbol(prop).flags & 296); + }))) { + indexInfos = ts6.append(indexInfos, enumNumberIndexInfo); + } + } + setStructuredTypeMembers(type, members, ts6.emptyArray, ts6.emptyArray, indexInfos || ts6.emptyArray); + if (symbol.flags & (16 | 8192)) { + type.callSignatures = getSignaturesOfSymbol(symbol); + } + if (symbol.flags & 32) { + var classType_1 = getDeclaredTypeOfClassOrInterface(symbol); + var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get( + "__constructor" + /* InternalSymbolName.Constructor */ + )) : ts6.emptyArray; + if (symbol.flags & 16) { + constructSignatures = ts6.addRange(constructSignatures.slice(), ts6.mapDefined(type.callSignatures, function(sig) { + return isJSConstructor(sig.declaration) ? createSignature( + sig.declaration, + sig.typeParameters, + sig.thisParameter, + sig.parameters, + classType_1, + /*resolvedTypePredicate*/ + void 0, + sig.minArgumentCount, + sig.flags & 39 + /* SignatureFlags.PropagatingFlags */ + ) : void 0; + })); + } + if (!constructSignatures.length) { + constructSignatures = getDefaultConstructSignatures(classType_1); + } + type.constructSignatures = constructSignatures; + } + } + function replaceIndexedAccess(instantiable, type, replacement) { + return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])])); + } + function resolveReverseMappedTypeMembers(type) { + var indexInfo = getIndexInfoOfType(type.source, stringType); + var modifiers = getMappedTypeModifiers(type.mappedType); + var readonlyMask = modifiers & 1 ? false : true; + var optionalMask = modifiers & 4 ? 0 : 16777216; + var indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : ts6.emptyArray; + var members = ts6.createSymbolTable(); + for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) { + var prop = _a[_i]; + var checkFlags = 8192 | (readonlyMask && isReadonlySymbol(prop) ? 8 : 0); + var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.escapedName, checkFlags); + inferredProp.declarations = prop.declarations; + inferredProp.nameType = getSymbolLinks(prop).nameType; + inferredProp.propertyType = getTypeOfSymbol(prop); + if (type.constraintType.type.flags & 8388608 && type.constraintType.type.objectType.flags & 262144 && type.constraintType.type.indexType.flags & 262144) { + var newTypeParam = type.constraintType.type.objectType; + var newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam); + inferredProp.mappedType = newMappedType; + inferredProp.constraintType = getIndexType(newTypeParam); + } else { + inferredProp.mappedType = type.mappedType; + inferredProp.constraintType = type.constraintType; + } + members.set(prop.escapedName, inferredProp); + } + setStructuredTypeMembers(type, members, ts6.emptyArray, ts6.emptyArray, indexInfos); + } + function getLowerBoundOfKeyType(type) { + if (type.flags & 4194304) { + var t = getApparentType(type.type); + return isGenericTupleType(t) ? getKnownKeysOfTupleType(t) : getIndexType(t); + } + if (type.flags & 16777216) { + if (type.root.isDistributive) { + var checkType = type.checkType; + var constraint = getLowerBoundOfKeyType(checkType); + if (constraint !== checkType) { + return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper)); + } + } + return type; + } + if (type.flags & 1048576) { + return mapType(type, getLowerBoundOfKeyType); + } + if (type.flags & 2097152) { + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 | 8 | 64)) && types[1] === emptyTypeLiteralType) { + return type; + } + return getIntersectionType(ts6.sameMap(type.types, getLowerBoundOfKeyType)); + } + return type; + } + function getIsLateCheckFlag(s) { + return ts6.getCheckFlags(s) & 4096; + } + function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) { + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + cb(getLiteralTypeFromProperty(prop, include)); + } + if (type.flags & 1) { + cb(stringType); + } else { + for (var _b = 0, _c = getIndexInfosOfType(type); _b < _c.length; _b++) { + var info = _c[_b]; + if (!stringsOnly || info.keyType.flags & (4 | 134217728)) { + cb(info.keyType); + } + } + } + } + function resolveMappedTypeMembers(type) { + var members = ts6.createSymbolTable(); + var indexInfos; + setStructuredTypeMembers(type, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + var typeParameter = getTypeParameterFromMappedType(type); + var constraintType = getConstraintTypeFromMappedType(type); + var nameType = getNameTypeFromMappedType(type.target || type); + var templateType = getTemplateTypeFromMappedType(type.target || type); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateModifiers = getMappedTypeModifiers(type); + var include = keyofStringsOnly ? 128 : 8576; + if (isMappedTypeWithKeyofConstraintDeclaration(type)) { + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, include, keyofStringsOnly, addMemberForKeyType); + } else { + forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType); + } + setStructuredTypeMembers(type, members, ts6.emptyArray, ts6.emptyArray, indexInfos || ts6.emptyArray); + function addMemberForKeyType(keyType) { + var propNameType = nameType ? instantiateType(nameType, appendTypeMapping(type.mapper, typeParameter, keyType)) : keyType; + forEachType(propNameType, function(t) { + return addMemberForKeyTypeWorker(keyType, t); + }); + } + function addMemberForKeyTypeWorker(keyType, propNameType) { + if (isTypeUsableAsPropertyName(propNameType)) { + var propName = getPropertyNameFromType(propNameType); + var existingProp = members.get(propName); + if (existingProp) { + existingProp.nameType = getUnionType([existingProp.nameType, propNameType]); + existingProp.keyType = getUnionType([existingProp.keyType, keyType]); + } else { + var modifiersProp = isTypeUsableAsPropertyName(keyType) ? getPropertyOfType(modifiersType, getPropertyNameFromType(keyType)) : void 0; + var isOptional = !!(templateModifiers & 4 || !(templateModifiers & 8) && modifiersProp && modifiersProp.flags & 16777216); + var isReadonly = !!(templateModifiers & 1 || !(templateModifiers & 2) && modifiersProp && isReadonlySymbol(modifiersProp)); + var stripOptional = strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & 16777216; + var lateFlag = modifiersProp ? getIsLateCheckFlag(modifiersProp) : 0; + var prop = createSymbol(4 | (isOptional ? 16777216 : 0), propName, lateFlag | 262144 | (isReadonly ? 8 : 0) | (stripOptional ? 524288 : 0)); + prop.mappedType = type; + prop.nameType = propNameType; + prop.keyType = keyType; + if (modifiersProp) { + prop.syntheticOrigin = modifiersProp; + prop.declarations = nameType ? void 0 : modifiersProp.declarations; + } + members.set(propName, prop); + } + } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 | 32)) { + var indexKeyType = propNameType.flags & (1 | 4) ? stringType : propNameType.flags & (8 | 32) ? numberType : propNameType; + var propType = instantiateType(templateType, appendTypeMapping(type.mapper, typeParameter, keyType)); + var indexInfo = createIndexInfo(indexKeyType, propType, !!(templateModifiers & 1)); + indexInfos = appendIndexInfo( + indexInfos, + indexInfo, + /*union*/ + true + ); + } + } + } + function getTypeOfMappedSymbol(symbol) { + if (!symbol.type) { + var mappedType = symbol.mappedType; + if (!pushTypeResolution( + symbol, + 0 + /* TypeSystemPropertyName.Type */ + )) { + mappedType.containsError = true; + return errorType; + } + var templateType = getTemplateTypeFromMappedType(mappedType.target || mappedType); + var mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.keyType); + var propType = instantiateType(templateType, mapper); + var type = strictNullChecks && symbol.flags & 16777216 && !maybeTypeOfKind( + propType, + 32768 | 16384 + /* TypeFlags.Void */ + ) ? getOptionalType( + propType, + /*isProperty*/ + true + ) : symbol.checkFlags & 524288 ? removeMissingOrUndefinedType(propType) : propType; + if (!popTypeResolution()) { + error(currentNode, ts6.Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType)); + type = errorType; + } + symbol.type = type; + } + return symbol.type; + } + function getTypeParameterFromMappedType(type) { + return type.typeParameter || (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter))); + } + function getConstraintTypeFromMappedType(type) { + return type.constraintType || (type.constraintType = getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)) || errorType); + } + function getNameTypeFromMappedType(type) { + return type.declaration.nameType ? type.nameType || (type.nameType = instantiateType(getTypeFromTypeNode(type.declaration.nameType), type.mapper)) : void 0; + } + function getTemplateTypeFromMappedType(type) { + return type.templateType || (type.templateType = type.declaration.type ? instantiateType(addOptionality( + getTypeFromTypeNode(type.declaration.type), + /*isProperty*/ + true, + !!(getMappedTypeModifiers(type) & 4) + ), type.mapper) : errorType); + } + function getConstraintDeclarationForMappedType(type) { + return ts6.getEffectiveConstraintOfTypeParameter(type.declaration.typeParameter); + } + function isMappedTypeWithKeyofConstraintDeclaration(type) { + var constraintDeclaration = getConstraintDeclarationForMappedType(type); + return constraintDeclaration.kind === 195 && constraintDeclaration.operator === 141; + } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + if (isMappedTypeWithKeyofConstraintDeclaration(type)) { + type.modifiersType = instantiateType(getTypeFromTypeNode(getConstraintDeclarationForMappedType(type).type), type.mapper); + } else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 262144 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 ? instantiateType(extendedConstraint.type, type.mapper) : unknownType; + } + } + return type.modifiersType; + } + function getMappedTypeModifiers(type) { + var declaration = type.declaration; + return (declaration.readonlyToken ? declaration.readonlyToken.kind === 40 ? 2 : 1 : 0) | (declaration.questionToken ? declaration.questionToken.kind === 40 ? 8 : 4 : 0); + } + function getMappedTypeOptionality(type) { + var modifiers = getMappedTypeModifiers(type); + return modifiers & 8 ? -1 : modifiers & 4 ? 1 : 0; + } + function getCombinedMappedTypeOptionality(type) { + var optionality = getMappedTypeOptionality(type); + var modifiersType = getModifiersTypeFromMappedType(type); + return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0); + } + function isPartialMappedType(type) { + return !!(ts6.getObjectFlags(type) & 32 && getMappedTypeModifiers(type) & 4); + } + function isGenericMappedType(type) { + if (ts6.getObjectFlags(type) & 32) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; + } + function resolveStructuredTypeMembers(type) { + if (!type.members) { + if (type.flags & 524288) { + if (type.objectFlags & 4) { + resolveTypeReferenceMembers(type); + } else if (type.objectFlags & 3) { + resolveClassOrInterfaceMembers(type); + } else if (type.objectFlags & 1024) { + resolveReverseMappedTypeMembers(type); + } else if (type.objectFlags & 16) { + resolveAnonymousTypeMembers(type); + } else if (type.objectFlags & 32) { + resolveMappedTypeMembers(type); + } else { + ts6.Debug.fail("Unhandled object type " + ts6.Debug.formatObjectFlags(type.objectFlags)); + } + } else if (type.flags & 1048576) { + resolveUnionTypeMembers(type); + } else if (type.flags & 2097152) { + resolveIntersectionTypeMembers(type); + } else { + ts6.Debug.fail("Unhandled type " + ts6.Debug.formatTypeFlags(type.flags)); + } + } + return type; + } + function getPropertiesOfObjectType(type) { + if (type.flags & 524288) { + return resolveStructuredTypeMembers(type).properties; + } + return ts6.emptyArray; + } + function getPropertyOfObjectType(type, name) { + if (type.flags & 524288) { + var resolved = resolveStructuredTypeMembers(type); + var symbol = resolved.members.get(name); + if (symbol && symbolIsValue(symbol)) { + return symbol; + } + } + } + function getPropertiesOfUnionOrIntersectionType(type) { + if (!type.resolvedProperties) { + var members = ts6.createSymbolTable(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.escapedName)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName); + if (combinedProp) { + members.set(prop.escapedName, combinedProp); + } + } + } + if (type.flags & 1048576 && getIndexInfosOfType(current).length === 0) { + break; + } + } + type.resolvedProperties = getNamedMembers(members); + } + return type.resolvedProperties; + } + function getPropertiesOfType(type) { + type = getReducedApparentType(type); + return type.flags & 3145728 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); + } + function forEachPropertyOfType(type, action) { + type = getReducedApparentType(type); + if (type.flags & 3670016) { + resolveStructuredTypeMembers(type).members.forEach(function(symbol, escapedName) { + if (isNamedMember(symbol, escapedName)) { + action(symbol, escapedName); + } + }); + } + } + function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) { + var list = obj.properties; + return list.some(function(property) { + var nameType = property.name && getLiteralTypeFromPropertyName(property.name); + var name = nameType && isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0; + var expected = name === void 0 ? void 0 : getTypeOfPropertyOfType(contextualType, name); + return !!expected && isLiteralType(expected) && !isTypeAssignableTo(getTypeOfNode(property), expected); + }); + } + function getAllPossiblePropertiesOfTypes(types) { + var unionType = getUnionType(types); + if (!(unionType.flags & 1048576)) { + return getAugmentedPropertiesOfType(unionType); + } + var props = ts6.createSymbolTable(); + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var memberType = types_4[_i]; + for (var _a = 0, _b = getAugmentedPropertiesOfType(memberType); _a < _b.length; _a++) { + var escapedName = _b[_a].escapedName; + if (!props.has(escapedName)) { + var prop = createUnionOrIntersectionProperty(unionType, escapedName); + if (prop) + props.set(escapedName, prop); + } + } + } + return ts6.arrayFrom(props.values()); + } + function getConstraintOfType(type) { + return type.flags & 262144 ? getConstraintOfTypeParameter(type) : type.flags & 8388608 ? getConstraintOfIndexedAccess(type) : type.flags & 16777216 ? getConstraintOfConditionalType(type) : getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0; + } + function getConstraintOfIndexedAccess(type) { + return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0; + } + function getSimplifiedTypeOrConstraint(type) { + var simplified = getSimplifiedType( + type, + /*writing*/ + false + ); + return simplified !== type ? simplified : getConstraintOfType(type); + } + function getConstraintFromIndexedAccess(type) { + if (isMappedTypeGenericIndexedAccess(type)) { + return substituteIndexedMappedType(type.objectType, type.indexType); + } + var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType); + if (indexConstraint && indexConstraint !== type.indexType) { + var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint, type.accessFlags); + if (indexedAccess) { + return indexedAccess; + } + } + var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType); + if (objectConstraint && objectConstraint !== type.objectType) { + return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType, type.accessFlags); + } + return void 0; + } + function getDefaultConstraintOfConditionalType(type) { + if (!type.resolvedDefaultConstraint) { + var trueConstraint = getInferredTrueTypeFromConditionalType(type); + var falseConstraint = getFalseTypeFromConditionalType(type); + type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]); + } + return type.resolvedDefaultConstraint; + } + function getConstraintOfDistributiveConditionalType(type) { + if (type.root.isDistributive && type.restrictiveInstantiation !== type) { + var simplified = getSimplifiedType( + type.checkType, + /*writing*/ + false + ); + var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified; + if (constraint && constraint !== type.checkType) { + var instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper)); + if (!(instantiated.flags & 131072)) { + return instantiated; + } + } + } + return void 0; + } + function getConstraintFromConditionalType(type) { + return getConstraintOfDistributiveConditionalType(type) || getDefaultConstraintOfConditionalType(type); + } + function getConstraintOfConditionalType(type) { + return hasNonCircularBaseConstraint(type) ? getConstraintFromConditionalType(type) : void 0; + } + function getEffectiveConstraintOfIntersection(types, targetIsUnion) { + var constraints; + var hasDisjointDomainType = false; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (t.flags & 465829888) { + var constraint = getConstraintOfType(t); + while (constraint && constraint.flags & (262144 | 4194304 | 16777216)) { + constraint = getConstraintOfType(constraint); + } + if (constraint) { + constraints = ts6.append(constraints, constraint); + if (targetIsUnion) { + constraints = ts6.append(constraints, t); + } + } + } else if (t.flags & 469892092 || isEmptyAnonymousObjectType(t)) { + hasDisjointDomainType = true; + } + } + if (constraints && (targetIsUnion || hasDisjointDomainType)) { + if (hasDisjointDomainType) { + for (var _a = 0, types_6 = types; _a < types_6.length; _a++) { + var t = types_6[_a]; + if (t.flags & 469892092 || isEmptyAnonymousObjectType(t)) { + constraints = ts6.append(constraints, t); + } + } + } + return getNormalizedType( + getIntersectionType(constraints), + /*writing*/ + false + ); + } + return void 0; + } + function getBaseConstraintOfType(type) { + if (type.flags & (58982400 | 3145728 | 134217728 | 268435456)) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0; + } + return type.flags & 4194304 ? keyofConstraintType : void 0; + } + function getBaseConstraintOrType(type) { + return getBaseConstraintOfType(type) || type; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + if (type.resolvedBaseConstraint) { + return type.resolvedBaseConstraint; + } + var stack2 = []; + return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type); + function getImmediateBaseConstraint(t) { + if (!t.immediateBaseConstraint) { + if (!pushTypeResolution( + t, + 4 + /* TypeSystemPropertyName.ImmediateBaseConstraint */ + )) { + return circularConstraintType; + } + var result = void 0; + var identity_1 = getRecursionIdentity(t); + if (stack2.length < 10 || stack2.length < 50 && !ts6.contains(stack2, identity_1)) { + stack2.push(identity_1); + result = computeBaseConstraint(getSimplifiedType( + t, + /*writing*/ + false + )); + stack2.pop(); + } + if (!popTypeResolution()) { + if (t.flags & 262144) { + var errorNode = getConstraintDeclaration(t); + if (errorNode) { + var diagnostic = error(errorNode, ts6.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t)); + if (currentNode && !ts6.isNodeDescendantOf(errorNode, currentNode) && !ts6.isNodeDescendantOf(currentNode, errorNode)) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(currentNode, ts6.Diagnostics.Circularity_originates_in_type_at_this_location)); + } + } + } + result = circularConstraintType; + } + t.immediateBaseConstraint = result || noConstraintType; + } + return t.immediateBaseConstraint; + } + function getBaseConstraint(t) { + var c = getImmediateBaseConstraint(t); + return c !== noConstraintType && c !== circularConstraintType ? c : void 0; + } + function computeBaseConstraint(t) { + if (t.flags & 262144) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType || !constraint ? constraint : getBaseConstraint(constraint); + } + if (t.flags & 3145728) { + var types = t.types; + var baseTypes = []; + var different = false; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); + if (baseType) { + if (baseType !== type_3) { + different = true; + } + baseTypes.push(baseType); + } else { + different = true; + } + } + if (!different) { + return t; + } + return t.flags & 1048576 && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 && baseTypes.length ? getIntersectionType(baseTypes) : void 0; + } + if (t.flags & 4194304) { + return keyofConstraintType; + } + if (t.flags & 134217728) { + var types = t.types; + var constraints = ts6.mapDefined(types, getBaseConstraint); + return constraints.length === types.length ? getTemplateLiteralType(t.texts, constraints) : stringType; + } + if (t.flags & 268435456) { + var constraint = getBaseConstraint(t.type); + return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType; + } + if (t.flags & 8388608) { + if (isMappedTypeGenericIndexedAccess(t)) { + return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType)); + } + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, t.accessFlags); + return baseIndexedAccess && getBaseConstraint(baseIndexedAccess); + } + if (t.flags & 16777216) { + var constraint = getConstraintFromConditionalType(t); + return constraint && getBaseConstraint(constraint); + } + if (t.flags & 33554432) { + return getBaseConstraint(getSubstitutionIntersection(t)); + } + return t; + } + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument( + type, + type, + /*apparentType*/ + true + )); + } + function getResolvedTypeParameterDefault(typeParameter) { + if (!typeParameter.default) { + if (typeParameter.target) { + var targetDefault = getResolvedTypeParameterDefault(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; + } else { + typeParameter.default = resolvingDefaultType; + var defaultDeclaration = typeParameter.symbol && ts6.forEach(typeParameter.symbol.declarations, function(decl) { + return ts6.isTypeParameterDeclaration(decl) && decl.default; + }); + var defaultType = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; + if (typeParameter.default === resolvingDefaultType) { + typeParameter.default = defaultType; + } + } + } else if (typeParameter.default === resolvingDefaultType) { + typeParameter.default = circularConstraintType; + } + return typeParameter.default; + } + function getDefaultFromTypeParameter(typeParameter) { + var defaultType = getResolvedTypeParameterDefault(typeParameter); + return defaultType !== noConstraintType && defaultType !== circularConstraintType ? defaultType : void 0; + } + function hasNonCircularTypeParameterDefault(typeParameter) { + return getResolvedTypeParameterDefault(typeParameter) !== circularConstraintType; + } + function hasTypeParameterDefault(typeParameter) { + return !!(typeParameter.symbol && ts6.forEach(typeParameter.symbol.declarations, function(decl) { + return ts6.isTypeParameterDeclaration(decl) && decl.default; + })); + } + function getApparentTypeOfMappedType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type)); + } + function getResolvedApparentTypeOfMappedType(type) { + var typeVariable = getHomomorphicTypeVariable(type); + if (typeVariable && !type.declaration.nameType) { + var constraint = getConstraintOfTypeParameter(typeVariable); + if (constraint && isArrayOrTupleType(constraint)) { + return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper)); + } + } + return type; + } + function isMappedTypeGenericIndexedAccess(type) { + var objectType; + return !!(type.flags & 8388608 && ts6.getObjectFlags(objectType = type.objectType) & 32 && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8) && !objectType.declaration.nameType); + } + function getApparentType(type) { + var t = !(type.flags & 465829888) ? type : getBaseConstraintOfType(type) || unknownType; + return ts6.getObjectFlags(t) & 32 ? getApparentTypeOfMappedType(t) : t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 ? globalStringType : t.flags & 296 ? globalNumberType : t.flags & 2112 ? getGlobalBigIntType() : t.flags & 528 ? globalBooleanType : t.flags & 12288 ? getGlobalESSymbolType() : t.flags & 67108864 ? emptyObjectType : t.flags & 4194304 ? keyofConstraintType : t.flags & 2 && !strictNullChecks ? emptyObjectType : t; + } + function getReducedApparentType(type) { + return getReducedType(getApparentType(getReducedType(type))); + } + function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) { + var _a, _b; + var singleProp; + var propSet; + var indexTypes; + var isUnion = containingType.flags & 1048576; + var optionalFlag; + var syntheticFlag = 4; + var checkFlags = isUnion ? 0 : 8; + var mergedInstantiations = false; + for (var _i = 0, _c = containingType.types; _i < _c.length; _i++) { + var current = _c[_i]; + var type = getApparentType(current); + if (!(isErrorType(type) || type.flags & 131072)) { + var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); + var modifiers = prop ? ts6.getDeclarationModifierFlagsFromSymbol(prop) : 0; + if (prop) { + if (prop.flags & 106500) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : optionalFlag = isUnion ? 0 : 16777216; + if (isUnion) { + optionalFlag |= prop.flags & 16777216; + } else { + optionalFlag &= prop.flags; + } + } + if (!singleProp) { + singleProp = prop; + } else if (prop !== singleProp) { + var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); + if (isInstantiation && compareProperties(singleProp, prop, function(a, b) { + return a === b ? -1 : 0; + }) === -1) { + mergedInstantiations = !!singleProp.parent && !!ts6.length(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(singleProp.parent)); + } else { + if (!propSet) { + propSet = new ts6.Map(); + propSet.set(getSymbolId(singleProp), singleProp); + } + var id = getSymbolId(prop); + if (!propSet.has(id)) { + propSet.set(id, prop); + } + } + } + if (isUnion && isReadonlySymbol(prop)) { + checkFlags |= 8; + } else if (!isUnion && !isReadonlySymbol(prop)) { + checkFlags &= ~8; + } + checkFlags |= (!(modifiers & 24) ? 256 : 0) | (modifiers & 16 ? 512 : 0) | (modifiers & 8 ? 1024 : 0) | (modifiers & 32 ? 2048 : 0); + if (!isPrototypeProperty(prop)) { + syntheticFlag = 2; + } + } else if (isUnion) { + var indexInfo = !isLateBoundName(name) && getApplicableIndexInfoForName(type, name); + if (indexInfo) { + checkFlags |= 32 | (indexInfo.isReadonly ? 8 : 0); + indexTypes = ts6.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type); + } else if (isObjectLiteralType(type) && !(ts6.getObjectFlags(type) & 2097152)) { + checkFlags |= 32; + indexTypes = ts6.append(indexTypes, undefinedType); + } else { + checkFlags |= 16; + } + } + } + } + if (!singleProp || isUnion && (propSet || checkFlags & 48) && checkFlags & (1024 | 512) && !(propSet && getCommonDeclarationsOfSymbols(ts6.arrayFrom(propSet.values())))) { + return void 0; + } + if (!propSet && !(checkFlags & 16) && !indexTypes) { + if (mergedInstantiations) { + var clone_1 = createSymbolWithType(singleProp, singleProp.type); + clone_1.parent = (_b = (_a = singleProp.valueDeclaration) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.parent; + clone_1.containingType = containingType; + clone_1.mapper = singleProp.mapper; + return clone_1; + } else { + return singleProp; + } + } + var props = propSet ? ts6.arrayFrom(propSet.values()) : [singleProp]; + var declarations; + var firstType; + var nameType; + var propTypes = []; + var writeTypes; + var firstValueDeclaration; + var hasNonUniformValueDeclaration = false; + for (var _d = 0, props_1 = props; _d < props_1.length; _d++) { + var prop = props_1[_d]; + if (!firstValueDeclaration) { + firstValueDeclaration = prop.valueDeclaration; + } else if (prop.valueDeclaration && prop.valueDeclaration !== firstValueDeclaration) { + hasNonUniformValueDeclaration = true; + } + declarations = ts6.addRange(declarations, prop.declarations); + var type = getTypeOfSymbol(prop); + if (!firstType) { + firstType = type; + nameType = getSymbolLinks(prop).nameType; + } + var writeType = getWriteTypeOfSymbol(prop); + if (writeTypes || writeType !== type) { + writeTypes = ts6.append(!writeTypes ? propTypes.slice() : writeTypes, writeType); + } else if (type !== firstType) { + checkFlags |= 64; + } + if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) { + checkFlags |= 128; + } + if (type.flags & 131072 && type !== uniqueLiteralType) { + checkFlags |= 131072; + } + propTypes.push(type); + } + ts6.addRange(propTypes, indexTypes); + var result = createSymbol(4 | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); + result.containingType = containingType; + if (!hasNonUniformValueDeclaration && firstValueDeclaration) { + result.valueDeclaration = firstValueDeclaration; + if (firstValueDeclaration.symbol.parent) { + result.parent = firstValueDeclaration.symbol.parent; + } + } + result.declarations = declarations; + result.nameType = nameType; + if (propTypes.length > 2) { + result.checkFlags |= 65536; + result.deferralParent = containingType; + result.deferralConstituents = propTypes; + result.deferralWriteConstituents = writeTypes; + } else { + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); + if (writeTypes) { + result.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes); + } + } + return result; + } + function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) { + var _a, _b; + var property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) === null || _a === void 0 ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) === null || _b === void 0 ? void 0 : _b.get(name) : void 0; + if (!property) { + property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); + if (property) { + var properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = ts6.createSymbolTable()) : type.propertyCache || (type.propertyCache = ts6.createSymbolTable()); + properties.set(name, property); + } + } + return property; + } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function(symbol2) { + if (!symbol2.declarations) { + return { value: void 0 }; + } + if (!commonDeclarations) { + commonDeclarations = new ts6.Set(symbol2.declarations); + return "continue"; + } + commonDeclarations.forEach(function(declaration) { + if (!ts6.contains(symbol2.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: void 0 }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } + function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { + var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); + return property && !(ts6.getCheckFlags(property) & 16) ? property : void 0; + } + function getReducedType(type) { + if (type.flags & 1048576 && type.objectFlags & 16777216) { + return type.resolvedReducedType || (type.resolvedReducedType = getReducedUnionType(type)); + } else if (type.flags & 2097152) { + if (!(type.objectFlags & 16777216)) { + type.objectFlags |= 16777216 | (ts6.some(getPropertiesOfUnionOrIntersectionType(type), isNeverReducedProperty) ? 33554432 : 0); + } + return type.objectFlags & 33554432 ? neverType : type; + } + return type; + } + function getReducedUnionType(unionType) { + var reducedTypes = ts6.sameMap(unionType.types, getReducedType); + if (reducedTypes === unionType.types) { + return unionType; + } + var reduced = getUnionType(reducedTypes); + if (reduced.flags & 1048576) { + reduced.resolvedReducedType = reduced; + } + return reduced; + } + function isNeverReducedProperty(prop) { + return isDiscriminantWithNeverType(prop) || isConflictingPrivateProperty(prop); + } + function isDiscriminantWithNeverType(prop) { + return !(prop.flags & 16777216) && (ts6.getCheckFlags(prop) & (192 | 131072)) === 192 && !!(getTypeOfSymbol(prop).flags & 131072); + } + function isConflictingPrivateProperty(prop) { + return !prop.valueDeclaration && !!(ts6.getCheckFlags(prop) & 1024); + } + function elaborateNeverIntersection(errorInfo, type) { + if (type.flags & 2097152 && ts6.getObjectFlags(type) & 33554432) { + var neverProp = ts6.find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType); + if (neverProp) { + return ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, typeToString( + type, + /*enclosingDeclaration*/ + void 0, + 536870912 + /* TypeFormatFlags.NoTypeReduction */ + ), symbolToString(neverProp)); + } + var privateProp = ts6.find(getPropertiesOfUnionOrIntersectionType(type), isConflictingPrivateProperty); + if (privateProp) { + return ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, typeToString( + type, + /*enclosingDeclaration*/ + void 0, + 536870912 + /* TypeFormatFlags.NoTypeReduction */ + ), symbolToString(privateProp)); + } + } + return errorInfo; + } + function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) { + type = getReducedApparentType(type); + if (type.flags & 524288) { + var resolved = resolveStructuredTypeMembers(type); + var symbol = resolved.members.get(name); + if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) { + return symbol; + } + if (skipObjectFunctionPropertyAugment) + return void 0; + var functionType = resolved === anyFunctionType ? globalFunctionType : resolved.callSignatures.length ? globalCallableFunctionType : resolved.constructSignatures.length ? globalNewableFunctionType : void 0; + if (functionType) { + var symbol_1 = getPropertyOfObjectType(functionType, name); + if (symbol_1) { + return symbol_1; + } + } + return getPropertyOfObjectType(globalObjectType, name); + } + if (type.flags & 3145728) { + return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment); + } + return void 0; + } + function getSignaturesOfStructuredType(type, kind) { + if (type.flags & 3670016) { + var resolved = resolveStructuredTypeMembers(type); + return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; + } + return ts6.emptyArray; + } + function getSignaturesOfType(type, kind) { + return getSignaturesOfStructuredType(getReducedApparentType(type), kind); + } + function findIndexInfo(indexInfos, keyType) { + return ts6.find(indexInfos, function(info) { + return info.keyType === keyType; + }); + } + function findApplicableIndexInfo(indexInfos, keyType) { + var stringIndexInfo; + var applicableInfo; + var applicableInfos; + for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) { + var info = indexInfos_3[_i]; + if (info.keyType === stringType) { + stringIndexInfo = info; + } else if (isApplicableIndexType(keyType, info.keyType)) { + if (!applicableInfo) { + applicableInfo = info; + } else { + (applicableInfos || (applicableInfos = [applicableInfo])).push(info); + } + } + } + return applicableInfos ? createIndexInfo(unknownType, getIntersectionType(ts6.map(applicableInfos, function(info2) { + return info2.type; + })), ts6.reduceLeft( + applicableInfos, + function(isReadonly, info2) { + return isReadonly && info2.isReadonly; + }, + /*initial*/ + true + )) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0; + } + function isApplicableIndexType(source, target) { + return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128) && ts6.isNumericLiteralName(source.value)); + } + function getIndexInfosOfStructuredType(type) { + if (type.flags & 3670016) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.indexInfos; + } + return ts6.emptyArray; + } + function getIndexInfosOfType(type) { + return getIndexInfosOfStructuredType(getReducedApparentType(type)); + } + function getIndexInfoOfType(type, keyType) { + return findIndexInfo(getIndexInfosOfType(type), keyType); + } + function getIndexTypeOfType(type, keyType) { + var _a; + return (_a = getIndexInfoOfType(type, keyType)) === null || _a === void 0 ? void 0 : _a.type; + } + function getApplicableIndexInfos(type, keyType) { + return getIndexInfosOfType(type).filter(function(info) { + return isApplicableIndexType(keyType, info.keyType); + }); + } + function getApplicableIndexInfo(type, keyType) { + return findApplicableIndexInfo(getIndexInfosOfType(type), keyType); + } + function getApplicableIndexInfoForName(type, name) { + return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(ts6.unescapeLeadingUnderscores(name))); + } + function getTypeParametersFromDeclaration(declaration) { + var _a; + var result; + for (var _i = 0, _b = ts6.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) { + var node = _b[_i]; + result = ts6.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol)); + } + return (result === null || result === void 0 ? void 0 : result.length) ? result : ts6.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters : void 0; + } + function symbolsToArray(symbols) { + var result = []; + symbols.forEach(function(symbol, id) { + if (!isReservedMemberName(id)) { + result.push(symbol); + } + }); + return result; + } + function isJSDocOptionalParameter(node) { + return ts6.isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType + (node.type && node.type.kind === 319 || ts6.getJSDocParameterTags(node).some(function(_a) { + var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319; + })); + } + function tryFindAmbientModule(moduleName, withAugmentations) { + if (ts6.isExternalModuleNameRelative(moduleName)) { + return void 0; + } + var symbol = getSymbol( + globals, + '"' + moduleName + '"', + 512 + /* SymbolFlags.ValueModule */ + ); + return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol; + } + function isOptionalParameter(node) { + if (ts6.hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isJSDocOptionalParameter(node)) { + return true; + } + if (node.initializer) { + var signature = getSignatureFromDeclaration(node.parent); + var parameterIndex = node.parent.parameters.indexOf(node); + ts6.Debug.assert(parameterIndex >= 0); + return parameterIndex >= getMinArgumentCount( + signature, + 1 | 2 + /* MinArgumentCountFlags.VoidIsNonOptional */ + ); + } + var iife = ts6.getImmediatelyInvokedFunctionExpression(node.parent); + if (iife) { + return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= iife.arguments.length; + } + return false; + } + function isOptionalPropertyDeclaration(node) { + return ts6.isPropertyDeclaration(node) && !ts6.hasAccessorModifier(node) && node.questionToken; + } + function isOptionalJSDocPropertyLikeTag(node) { + if (!ts6.isJSDocPropertyLikeTag(node)) { + return false; + } + var isBracketed = node.isBracketed, typeExpression = node.typeExpression; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319; + } + function createTypePredicate(kind, parameterName, parameterIndex, type) { + return { kind, parameterName, parameterIndex, type }; + } + function getMinTypeArgumentCount(typeParameters) { + var minTypeArgumentCount = 0; + if (typeParameters) { + for (var i = 0; i < typeParameters.length; i++) { + if (!hasTypeParameterDefault(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, isJavaScriptImplicitAny) { + var numTypeParameters = ts6.length(typeParameters); + if (!numTypeParameters) { + return []; + } + var numTypeArguments = ts6.length(typeArguments); + if (isJavaScriptImplicitAny || numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters) { + var result = typeArguments ? typeArguments.slice() : []; + for (var i = numTypeArguments; i < numTypeParameters; i++) { + result[i] = errorType; + } + var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny); + for (var i = numTypeArguments; i < numTypeParameters; i++) { + var defaultType = getDefaultFromTypeParameter(typeParameters[i]); + if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) { + defaultType = anyType; + } + result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType; + } + result.length = typeParameters.length; + return result; + } + return typeArguments && typeArguments.slice(); + } + function getSignatureFromDeclaration(declaration) { + var links = getNodeLinks(declaration); + if (!links.resolvedSignature) { + var parameters = []; + var flags = 0; + var minArgumentCount = 0; + var thisParameter = void 0; + var hasThisParameter = false; + var iife = ts6.getImmediatelyInvokedFunctionExpression(declaration); + var isJSConstructSignature = ts6.isJSDocConstructSignature(declaration); + var isUntypedSignatureInJSFile = !iife && ts6.isInJSFile(declaration) && ts6.isValueSignatureDeclaration(declaration) && !ts6.hasJSDocParameterTags(declaration) && !ts6.getJSDocType(declaration); + if (isUntypedSignatureInJSFile) { + flags |= 32; + } + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { + var param = declaration.parameters[i]; + var paramSymbol = param.symbol; + var type = ts6.isJSDocParameterTag(param) ? param.typeExpression && param.typeExpression.type : param.type; + if (paramSymbol && !!(paramSymbol.flags & 4) && !ts6.isBindingPattern(param.name)) { + var resolvedSymbol = resolveName( + param, + paramSymbol.escapedName, + 111551, + void 0, + void 0, + /*isUse*/ + false + ); + paramSymbol = resolvedSymbol; + } + if (i === 0 && paramSymbol.escapedName === "this") { + hasThisParameter = true; + thisParameter = param.symbol; + } else { + parameters.push(paramSymbol); + } + if (type && type.kind === 198) { + flags |= 2; + } + var isOptionalParameter_1 = isOptionalJSDocPropertyLikeTag(param) || param.initializer || param.questionToken || ts6.isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type || isJSDocOptionalParameter(param); + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; + } + } + if ((declaration.kind === 174 || declaration.kind === 175) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { + var otherKind = declaration.kind === 174 ? 175 : 174; + var other = ts6.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); + if (other) { + thisParameter = getAnnotatedAccessorThisParameter(other); + } + } + var classType = declaration.kind === 173 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0; + var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); + if (ts6.hasRestParameter(declaration) || ts6.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { + flags |= 1; + } + if (ts6.isConstructorTypeNode(declaration) && ts6.hasSyntacticModifier( + declaration, + 256 + /* ModifierFlags.Abstract */ + ) || ts6.isConstructorDeclaration(declaration) && ts6.hasSyntacticModifier( + declaration.parent, + 256 + /* ModifierFlags.Abstract */ + )) { + flags |= 4; + } + links.resolvedSignature = createSignature( + declaration, + typeParameters, + thisParameter, + parameters, + /*resolvedReturnType*/ + void 0, + /*resolvedTypePredicate*/ + void 0, + minArgumentCount, + flags + ); + } + return links.resolvedSignature; + } + function maybeAddJsSyntheticRestParameter(declaration, parameters) { + if (ts6.isJSDocSignature(declaration) || !containsArgumentsReference(declaration)) { + return false; + } + var lastParam = ts6.lastOrUndefined(declaration.parameters); + var lastParamTags = lastParam ? ts6.getJSDocParameterTags(lastParam) : ts6.getJSDocTags(declaration).filter(ts6.isJSDocParameterTag); + var lastParamVariadicType = ts6.firstDefined(lastParamTags, function(p) { + return p.typeExpression && ts6.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : void 0; + }); + var syntheticArgsSymbol = createSymbol( + 3, + "args", + 32768 + /* CheckFlags.RestParameter */ + ); + if (lastParamVariadicType) { + syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)); + } else { + syntheticArgsSymbol.checkFlags |= 65536; + syntheticArgsSymbol.deferralParent = neverType; + syntheticArgsSymbol.deferralConstituents = [anyArrayType]; + syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType]; + } + if (lastParamVariadicType) { + parameters.pop(); + } + parameters.push(syntheticArgsSymbol); + return true; + } + function getSignatureOfTypeTag(node) { + if (!(ts6.isInJSFile(node) && ts6.isFunctionLikeDeclaration(node))) + return void 0; + var typeTag = ts6.getJSDocTypeTag(node); + return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression)); + } + function getParameterTypeOfTypeTag(func, parameter) { + var signature = getSignatureOfTypeTag(func); + if (!signature) + return void 0; + var pos = func.parameters.indexOf(parameter); + return parameter.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos); + } + function getReturnTypeOfTypeTag(node) { + var signature = getSignatureOfTypeTag(node); + return signature && getReturnTypeOfSignature(signature); + } + function containsArgumentsReference(declaration) { + var links = getNodeLinks(declaration); + if (links.containsArgumentsReference === void 0) { + if (links.flags & 8192) { + links.containsArgumentsReference = true; + } else { + links.containsArgumentsReference = traverse(declaration.body); + } + } + return links.containsArgumentsReference; + function traverse(node) { + if (!node) + return false; + switch (node.kind) { + case 79: + return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; + case 169: + case 171: + case 174: + case 175: + return node.name.kind === 164 && traverse(node.name); + case 208: + case 209: + return traverse(node.expression); + case 299: + return traverse(node.initializer); + default: + return !ts6.nodeStartsNewLexicalEnvironment(node) && !ts6.isPartOfTypeNode(node) && !!ts6.forEachChild(node, traverse); + } + } + } + function getSignaturesOfSymbol(symbol) { + if (!symbol || !symbol.declarations) + return ts6.emptyArray; + var result = []; + for (var i = 0; i < symbol.declarations.length; i++) { + var decl = symbol.declarations[i]; + if (!ts6.isFunctionLike(decl)) + continue; + if (i > 0 && decl.body) { + var previous = symbol.declarations[i - 1]; + if (decl.parent === previous.parent && decl.kind === previous.kind && decl.pos === previous.end) { + continue; + } + } + result.push(!ts6.isFunctionExpressionOrArrowFunction(decl) && !ts6.isObjectLiteralMethod(decl) && getSignatureOfTypeTag(decl) || getSignatureFromDeclaration(decl)); + } + return result; + } + function resolveExternalModuleTypeByLiteral(name) { + var moduleSym = resolveExternalModuleName(name, name); + if (moduleSym) { + var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym); + if (resolvedModuleSymbol) { + return getTypeOfSymbol(resolvedModuleSymbol); + } + } + return anyType; + } + function getThisTypeOfSignature(signature) { + if (signature.thisParameter) { + return getTypeOfSymbol(signature.thisParameter); + } + } + function getTypePredicateOfSignature(signature) { + if (!signature.resolvedTypePredicate) { + if (signature.target) { + var targetTypePredicate = getTypePredicateOfSignature(signature.target); + signature.resolvedTypePredicate = targetTypePredicate ? instantiateTypePredicate(targetTypePredicate, signature.mapper) : noTypePredicate; + } else if (signature.compositeSignatures) { + signature.resolvedTypePredicate = getUnionOrIntersectionTypePredicate(signature.compositeSignatures, signature.compositeKind) || noTypePredicate; + } else { + var type = signature.declaration && ts6.getEffectiveReturnTypeNode(signature.declaration); + var jsdocPredicate = void 0; + if (!type) { + var jsdocSignature = getSignatureOfTypeTag(signature.declaration); + if (jsdocSignature && signature !== jsdocSignature) { + jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); + } + } + signature.resolvedTypePredicate = type && ts6.isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate; + } + ts6.Debug.assert(!!signature.resolvedTypePredicate); + } + return signature.resolvedTypePredicate === noTypePredicate ? void 0 : signature.resolvedTypePredicate; + } + function createTypePredicateFromTypePredicateNode(node, signature) { + var parameterName = node.parameterName; + var type = node.type && getTypeFromTypeNode(node.type); + return parameterName.kind === 194 ? createTypePredicate( + node.assertsModifier ? 2 : 0, + /*parameterName*/ + void 0, + /*parameterIndex*/ + void 0, + type + ) : createTypePredicate(node.assertsModifier ? 3 : 1, parameterName.escapedText, ts6.findIndex(signature.parameters, function(p) { + return p.escapedName === parameterName.escapedText; + }), type); + } + function getUnionOrIntersectionType(types, kind, unionReduction) { + return kind !== 2097152 ? getUnionType(types, unionReduction) : getIntersectionType(types); + } + function getReturnTypeOfSignature(signature) { + if (!signature.resolvedReturnType) { + if (!pushTypeResolution( + signature, + 3 + /* TypeSystemPropertyName.ResolvedReturnType */ + )) { + return errorType; + } + var type = signature.target ? instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper) : signature.compositeSignatures ? instantiateType(getUnionOrIntersectionType( + ts6.map(signature.compositeSignatures, getReturnTypeOfSignature), + signature.compositeKind, + 2 + /* UnionReduction.Subtype */ + ), signature.mapper) : getReturnTypeFromAnnotation(signature.declaration) || (ts6.nodeIsMissing(signature.declaration.body) ? anyType : getReturnTypeFromBody(signature.declaration)); + if (signature.flags & 8) { + type = addOptionalTypeMarker(type); + } else if (signature.flags & 16) { + type = getOptionalType(type); + } + if (!popTypeResolution()) { + if (signature.declaration) { + var typeNode = ts6.getEffectiveReturnTypeNode(signature.declaration); + if (typeNode) { + error(typeNode, ts6.Diagnostics.Return_type_annotation_circularly_references_itself); + } else if (noImplicitAny) { + var declaration = signature.declaration; + var name = ts6.getNameOfDeclaration(declaration); + if (name) { + error(name, ts6.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts6.declarationNameToString(name)); + } else { + error(declaration, ts6.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } + } + } + type = anyType; + } + signature.resolvedReturnType = type; + } + return signature.resolvedReturnType; + } + function getReturnTypeFromAnnotation(declaration) { + if (declaration.kind === 173) { + return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); + } + if (ts6.isJSDocConstructSignature(declaration)) { + return getTypeFromTypeNode(declaration.parameters[0].type); + } + var typeNode = ts6.getEffectiveReturnTypeNode(declaration); + if (typeNode) { + return getTypeFromTypeNode(typeNode); + } + if (declaration.kind === 174 && hasBindableName(declaration)) { + var jsDocType = ts6.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); + if (jsDocType) { + return jsDocType; + } + var setter = ts6.getDeclarationOfKind( + getSymbolOfNode(declaration), + 175 + /* SyntaxKind.SetAccessor */ + ); + var setterType = getAnnotatedAccessorType(setter); + if (setterType) { + return setterType; + } + } + return getReturnTypeOfTypeTag(declaration); + } + function isResolvingReturnTypeOfSignature(signature) { + return !signature.resolvedReturnType && findResolutionCycleStartIndex( + signature, + 3 + /* TypeSystemPropertyName.ResolvedReturnType */ + ) >= 0; + } + function getRestTypeOfSignature(signature) { + return tryGetRestTypeOfSignature(signature) || anyType; + } + function tryGetRestTypeOfSignature(signature) { + if (signatureHasRestParameter(signature)) { + var sigRestType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + var restType = isTupleType(sigRestType) ? getRestTypeOfTupleType(sigRestType) : sigRestType; + return restType && getIndexTypeOfType(restType, numberType); + } + return void 0; + } + function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) { + var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript)); + if (inferredTypeParameters) { + var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature)); + if (returnSignature) { + var newReturnSignature = cloneSignature(returnSignature); + newReturnSignature.typeParameters = inferredTypeParameters; + var newInstantiatedSignature = cloneSignature(instantiatedSignature); + newInstantiatedSignature.resolvedReturnType = getOrCreateTypeFromSignature(newReturnSignature); + return newInstantiatedSignature; + } + } + return instantiatedSignature; + } + function getSignatureInstantiationWithoutFillingInTypeArguments(signature, typeArguments) { + var instantiations = signature.instantiations || (signature.instantiations = new ts6.Map()); + var id = getTypeListId(typeArguments); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; + } + function createSignatureInstantiation(signature, typeArguments) { + return instantiateSignature( + signature, + createSignatureTypeMapper(signature, typeArguments), + /*eraseTypeParameters*/ + true + ); + } + function createSignatureTypeMapper(signature, typeArguments) { + return createTypeMapper(signature.typeParameters, typeArguments); + } + function getErasedSignature(signature) { + return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature; + } + function createErasedSignature(signature) { + return instantiateSignature( + signature, + createTypeEraser(signature.typeParameters), + /*eraseTypeParameters*/ + true + ); + } + function getCanonicalSignature(signature) { + return signature.typeParameters ? signature.canonicalSignatureCache || (signature.canonicalSignatureCache = createCanonicalSignature(signature)) : signature; + } + function createCanonicalSignature(signature) { + return getSignatureInstantiation(signature, ts6.map(signature.typeParameters, function(tp) { + return tp.target && !getConstraintOfTypeParameter(tp.target) ? tp.target : tp; + }), ts6.isInJSFile(signature.declaration)); + } + function getBaseSignature(signature) { + var typeParameters = signature.typeParameters; + if (typeParameters) { + if (signature.baseSignatureCache) { + return signature.baseSignatureCache; + } + var typeEraser = createTypeEraser(typeParameters); + var baseConstraintMapper_1 = createTypeMapper(typeParameters, ts6.map(typeParameters, function(tp) { + return getConstraintOfTypeParameter(tp) || unknownType; + })); + var baseConstraints = ts6.map(typeParameters, function(tp) { + return instantiateType(tp, baseConstraintMapper_1) || unknownType; + }); + for (var i = 0; i < typeParameters.length - 1; i++) { + baseConstraints = instantiateTypes(baseConstraints, baseConstraintMapper_1); + } + baseConstraints = instantiateTypes(baseConstraints, typeEraser); + return signature.baseSignatureCache = instantiateSignature( + signature, + createTypeMapper(typeParameters, baseConstraints), + /*eraseTypeParameters*/ + true + ); + } + return signature; + } + function getOrCreateTypeFromSignature(signature) { + var _a; + if (!signature.isolatedSignatureType) { + var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; + var isConstructor = kind === void 0 || kind === 173 || kind === 177 || kind === 182; + var type = createObjectType( + 16 + /* ObjectFlags.Anonymous */ + ); + type.members = emptySymbols; + type.properties = ts6.emptyArray; + type.callSignatures = !isConstructor ? [signature] : ts6.emptyArray; + type.constructSignatures = isConstructor ? [signature] : ts6.emptyArray; + type.indexInfos = ts6.emptyArray; + signature.isolatedSignatureType = type; + } + return signature.isolatedSignatureType; + } + function getIndexSymbol(symbol) { + return symbol.members ? getIndexSymbolFromSymbolTable(symbol.members) : void 0; + } + function getIndexSymbolFromSymbolTable(symbolTable) { + return symbolTable.get( + "__index" + /* InternalSymbolName.Index */ + ); + } + function createIndexInfo(keyType, type, isReadonly, declaration) { + return { keyType, type, isReadonly, declaration }; + } + function getIndexInfosOfSymbol(symbol) { + var indexSymbol = getIndexSymbol(symbol); + return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol) : ts6.emptyArray; + } + function getIndexInfosOfIndexSymbol(indexSymbol) { + if (indexSymbol.declarations) { + var indexInfos_4 = []; + var _loop_15 = function(declaration2) { + if (declaration2.parameters.length === 1) { + var parameter = declaration2.parameters[0]; + if (parameter.type) { + forEachType(getTypeFromTypeNode(parameter.type), function(keyType) { + if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) { + indexInfos_4.push(createIndexInfo(keyType, declaration2.type ? getTypeFromTypeNode(declaration2.type) : anyType, ts6.hasEffectiveModifier( + declaration2, + 64 + /* ModifierFlags.Readonly */ + ), declaration2)); + } + }); + } + } + }; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + _loop_15(declaration); + } + return indexInfos_4; + } + return ts6.emptyArray; + } + function isValidIndexKeyType(type) { + return !!(type.flags & (4 | 8 | 4096)) || isPatternLiteralType(type) || !!(type.flags & 2097152) && !isGenericType(type) && ts6.some(type.types, isValidIndexKeyType); + } + function getConstraintDeclaration(type) { + return ts6.mapDefined(ts6.filter(type.symbol && type.symbol.declarations, ts6.isTypeParameterDeclaration), ts6.getEffectiveConstraintOfTypeParameter)[0]; + } + function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) { + var _a; + var inferences; + if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { + var _loop_16 = function(declaration2) { + if (declaration2.parent.kind === 192) { + var _c = ts6.walkUpParenthesizedTypesAndGetParentAndChild(declaration2.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration2.parent : _d, grandParent = _c[1]; + if (grandParent.kind === 180 && !omitTypeReferences) { + var typeReference_1 = grandParent; + var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); + if (typeParameters_1) { + var index = typeReference_1.typeArguments.indexOf(childTypeParameter); + if (index < typeParameters_1.length) { + var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]); + if (declaredConstraint) { + var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function(_, index2) { + return function() { + return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index2); + }; + })); + var constraint = instantiateType(declaredConstraint, mapper); + if (constraint !== typeParameter) { + inferences = ts6.append(inferences, constraint); + } + } + } + } + } else if (grandParent.kind === 166 && grandParent.dotDotDotToken || grandParent.kind === 188 || grandParent.kind === 199 && grandParent.dotDotDotToken) { + inferences = ts6.append(inferences, createArrayType(unknownType)); + } else if (grandParent.kind === 201) { + inferences = ts6.append(inferences, stringType); + } else if (grandParent.kind === 165 && grandParent.parent.kind === 197) { + inferences = ts6.append(inferences, keyofConstraintType); + } else if (grandParent.kind === 197 && grandParent.type && ts6.skipParentheses(grandParent.type) === declaration2.parent && grandParent.parent.kind === 191 && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 && grandParent.parent.checkType.type) { + var checkMappedType_1 = grandParent.parent.checkType; + var nodeType = getTypeFromTypeNode(checkMappedType_1.type); + inferences = ts6.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType))); + } + } + }; + for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { + var declaration = _b[_i]; + _loop_16(declaration); + } + } + return inferences && getIntersectionType(inferences); + } + function getConstraintFromTypeParameter(typeParameter) { + if (!typeParameter.constraint) { + if (typeParameter.target) { + var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; + } else { + var constraintDeclaration = getConstraintDeclaration(typeParameter); + if (!constraintDeclaration) { + typeParameter.constraint = getInferredTypeParameterConstraint(typeParameter) || noConstraintType; + } else { + var type = getTypeFromTypeNode(constraintDeclaration); + if (type.flags & 1 && !isErrorType(type)) { + type = constraintDeclaration.parent.parent.kind === 197 ? keyofConstraintType : unknownType; + } + typeParameter.constraint = type; + } + } + } + return typeParameter.constraint === noConstraintType ? void 0 : typeParameter.constraint; + } + function getParentSymbolOfTypeParameter(typeParameter) { + var tp = ts6.getDeclarationOfKind( + typeParameter.symbol, + 165 + /* SyntaxKind.TypeParameter */ + ); + var host2 = ts6.isJSDocTemplateTag(tp.parent) ? ts6.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; + return host2 && getSymbolOfNode(host2); + } + function getTypeListId(types) { + var result = ""; + if (types) { + var length_4 = types.length; + var i = 0; + while (i < length_4) { + var startId = types[i].id; + var count = 1; + while (i + count < length_4 && types[i + count].id === startId + count) { + count++; + } + if (result.length) { + result += ","; + } + result += startId; + if (count > 1) { + result += ":" + count; + } + i += count; + } + } + return result; + } + function getAliasId(aliasSymbol, aliasTypeArguments) { + return aliasSymbol ? "@".concat(getSymbolId(aliasSymbol)) + (aliasTypeArguments ? ":".concat(getTypeListId(aliasTypeArguments)) : "") : ""; + } + function getPropagatingFlagsOfTypes(types, excludeKinds) { + var result = 0; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; + if (excludeKinds === void 0 || !(type.flags & excludeKinds)) { + result |= ts6.getObjectFlags(type); + } + } + return result & 458752; + } + function createTypeReference(target, typeArguments) { + var id = getTypeListId(typeArguments); + var type = target.instantiations.get(id); + if (!type) { + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); + type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0; + type.target = target; + type.resolvedTypeArguments = typeArguments; + } + return type; + } + function cloneTypeReference(source) { + var type = createType(source.flags); + type.symbol = source.symbol; + type.objectFlags = source.objectFlags; + type.target = source.target; + type.resolvedTypeArguments = source.resolvedTypeArguments; + return type; + } + function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments) { + if (!aliasSymbol) { + aliasSymbol = getAliasSymbolForTypeNode(node); + var localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); + aliasTypeArguments = mapper ? instantiateTypes(localAliasTypeArguments, mapper) : localAliasTypeArguments; + } + var type = createObjectType(4, target.symbol); + type.target = target; + type.node = node; + type.mapper = mapper; + type.aliasSymbol = aliasSymbol; + type.aliasTypeArguments = aliasTypeArguments; + return type; + } + function getTypeArguments(type) { + var _a, _b; + if (!type.resolvedTypeArguments) { + if (!pushTypeResolution( + type, + 6 + /* TypeSystemPropertyName.ResolvedTypeArguments */ + )) { + return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function() { + return errorType; + })) || ts6.emptyArray; + } + var node = type.node; + var typeArguments = !node ? ts6.emptyArray : node.kind === 180 ? ts6.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : node.kind === 185 ? [getTypeFromTypeNode(node.elementType)] : ts6.map(node.elements, getTypeFromTypeNode); + if (popTypeResolution()) { + type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; + } else { + type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function() { + return errorType; + })) || ts6.emptyArray; + error(type.node || currentNode, type.target.symbol ? ts6.Diagnostics.Type_arguments_for_0_circularly_reference_themselves : ts6.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol)); + } + } + return type.resolvedTypeArguments; + } + function getTypeReferenceArity(type) { + return ts6.length(type.target.typeParameters); + } + function getTypeFromClassOrInterfaceReference(node, symbol) { + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); + var typeParameters = type.localTypeParameters; + if (typeParameters) { + var numTypeArguments = ts6.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + var isJs = ts6.isInJSFile(node); + var isJsImplicitAny = !noImplicitAny && isJs; + if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { + var missingAugmentsTag = isJs && ts6.isExpressionWithTypeArguments(node) && !ts6.isJSDocAugmentsTag(node.parent); + var diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag ? ts6.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag : ts6.Diagnostics.Generic_type_0_requires_1_type_argument_s : missingAugmentsTag ? ts6.Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag : ts6.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments; + var typeStr = typeToString( + type, + /*enclosingDeclaration*/ + void 0, + 2 + /* TypeFormatFlags.WriteArrayAsGenericType */ + ); + error(node, diag, typeStr, minTypeArgumentCount, typeParameters.length); + if (!isJs) { + return errorType; + } + } + if (node.kind === 180 && isDeferredTypeReferenceNode(node, ts6.length(node.typeArguments) !== typeParameters.length)) { + return createDeferredTypeReference( + type, + node, + /*mapper*/ + void 0 + ); + } + var typeArguments = ts6.concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgumentsFromTypeReferenceNode(node), typeParameters, minTypeArgumentCount, isJs)); + return createTypeReference(type, typeArguments); + } + return checkNoTypeArguments(node, symbol) ? type : errorType; + } + function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) { + var type = getDeclaredTypeOfSymbol(symbol); + if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) { + return getStringMappingType(symbol, typeArguments[0]); + } + var links = getSymbolLinks(symbol); + var typeParameters = links.typeParameters; + var id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts6.isInJSFile(symbol.valueDeclaration))), aliasSymbol, aliasTypeArguments)); + } + return instantiation; + } + function getTypeFromTypeAliasReference(node, symbol) { + if (ts6.getCheckFlags(symbol) & 1048576) { + var typeArguments = typeArgumentsFromTypeReferenceNode(node); + var id = getAliasId(symbol, typeArguments); + var errorType_1 = errorTypes.get(id); + if (!errorType_1) { + errorType_1 = createIntrinsicType(1, "error"); + errorType_1.aliasSymbol = symbol; + errorType_1.aliasTypeArguments = typeArguments; + errorTypes.set(id, errorType_1); + } + return errorType_1; + } + var type = getDeclaredTypeOfSymbol(symbol); + var typeParameters = getSymbolLinks(symbol).typeParameters; + if (typeParameters) { + var numTypeArguments = ts6.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, minTypeArgumentCount === typeParameters.length ? ts6.Diagnostics.Generic_type_0_requires_1_type_argument_s : ts6.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length); + return errorType; + } + var aliasSymbol = getAliasSymbolForTypeNode(node); + var newAliasSymbol = aliasSymbol && (isLocalTypeAlias(symbol) || !isLocalTypeAlias(aliasSymbol)) ? aliasSymbol : void 0; + return getTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol)); + } + return checkNoTypeArguments(node, symbol) ? type : errorType; + } + function isLocalTypeAlias(symbol) { + var _a; + var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isTypeAlias); + return !!(declaration && ts6.getContainingFunction(declaration)); + } + function getTypeReferenceName(node) { + switch (node.kind) { + case 180: + return node.typeName; + case 230: + var expr = node.expression; + if (ts6.isEntityNameExpression(expr)) { + return expr; + } + } + return void 0; + } + function getSymbolPath(symbol) { + return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; + } + function getUnresolvedSymbolForEntityName(name) { + var identifier = name.kind === 163 ? name.right : name.kind === 208 ? name.name : name; + var text = identifier.escapedText; + if (text) { + var parentSymbol = name.kind === 163 ? getUnresolvedSymbolForEntityName(name.left) : name.kind === 208 ? getUnresolvedSymbolForEntityName(name.expression) : void 0; + var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; + var result = unresolvedSymbols.get(path); + if (!result) { + unresolvedSymbols.set(path, result = createSymbol( + 524288, + text, + 1048576 + /* CheckFlags.Unresolved */ + )); + result.parent = parentSymbol; + result.declaredType = unresolvedType; + } + return result; + } + return unknownSymbol; + } + function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var name = getTypeReferenceName(typeReference); + if (!name) { + return unknownSymbol; + } + var symbol = resolveEntityName(name, meaning, ignoreErrors); + return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); + } + function getTypeReferenceType(node, symbol) { + if (symbol === unknownSymbol) { + return errorType; + } + symbol = getExpandoSymbol(symbol) || symbol; + if (symbol.flags & (32 | 64)) { + return getTypeFromClassOrInterfaceReference(node, symbol); + } + if (symbol.flags & 524288) { + return getTypeFromTypeAliasReference(node, symbol); + } + var res = tryGetDeclaredTypeOfSymbol(symbol); + if (res) { + return checkNoTypeArguments(node, symbol) ? getRegularTypeOfLiteralType(res) : errorType; + } + if (symbol.flags & 111551 && isJSDocTypeReference(node)) { + var jsdocType = getTypeFromJSDocValueReference(node, symbol); + if (jsdocType) { + return jsdocType; + } else { + resolveTypeReferenceName( + node, + 788968 + /* SymbolFlags.Type */ + ); + return getTypeOfSymbol(symbol); + } + } + return errorType; + } + function getTypeFromJSDocValueReference(node, symbol) { + var links = getNodeLinks(node); + if (!links.resolvedJSDocType) { + var valueType = getTypeOfSymbol(symbol); + var typeType = valueType; + if (symbol.valueDeclaration) { + var isImportTypeWithQualifier = node.kind === 202 && node.qualifier; + if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { + typeType = getTypeReferenceType(node, valueType.symbol); + } + } + links.resolvedJSDocType = typeType; + } + return links.resolvedJSDocType; + } + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 || constraint === baseType || !isGenericType(baseType) && !isGenericType(constraint)) { + return baseType; + } + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); + var cached = substitutionTypes.get(id); + if (cached) { + return cached; + } + var result = createType( + 33554432 + /* TypeFlags.Substitution */ + ); + result.baseType = baseType; + result.constraint = constraint; + substitutionTypes.set(id, result); + return result; + } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } + function isUnaryTupleTypeNode(node) { + return node.kind === 186 && node.elements.length === 1; + } + function getImpliedConstraint(type, checkNode, extendsNode) { + return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : getActualTypeVariable(getTypeFromTypeNode(checkNode)) === getActualTypeVariable(type) ? getTypeFromTypeNode(extendsNode) : void 0; + } + function getConditionalFlowTypeOfType(type, node) { + var constraints; + var covariant = true; + while (node && !ts6.isStatement(node) && node.kind !== 323) { + var parent = node.parent; + if (parent.kind === 166) { + covariant = !covariant; + } + if ((covariant || type.flags & 8650752) && parent.kind === 191 && node === parent.trueType) { + var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); + if (constraint) { + constraints = ts6.append(constraints, constraint); + } + } else if (type.flags & 262144 && parent.kind === 197 && node === parent.type) { + var mappedType = getTypeFromTypeNode(parent); + if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { + var typeParameter = getHomomorphicTypeVariable(mappedType); + if (typeParameter) { + var constraint = getConstraintOfTypeParameter(typeParameter); + if (constraint && everyType(constraint, isArrayOrTupleType)) { + constraints = ts6.append(constraints, getUnionType([numberType, numericStringType])); + } + } + } + } + node = parent; + } + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; + } + function isJSDocTypeReference(node) { + return !!(node.flags & 8388608) && (node.kind === 180 || node.kind === 202); + } + function checkNoTypeArguments(node, symbol) { + if (node.typeArguments) { + error(node, ts6.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts6.declarationNameToString(node.typeName) : anon); + return false; + } + return true; + } + function getIntendedTypeFromJSDocTypeReference(node) { + if (ts6.isIdentifier(node.typeName)) { + var typeArgs = node.typeArguments; + switch (node.typeName.escapedText) { + case "String": + checkNoTypeArguments(node); + return stringType; + case "Number": + checkNoTypeArguments(node); + return numberType; + case "Boolean": + checkNoTypeArguments(node); + return booleanType; + case "Void": + checkNoTypeArguments(node); + return voidType; + case "Undefined": + checkNoTypeArguments(node); + return undefinedType; + case "Null": + checkNoTypeArguments(node); + return nullType; + case "Function": + case "function": + checkNoTypeArguments(node); + return globalFunctionType; + case "array": + return (!typeArgs || !typeArgs.length) && !noImplicitAny ? anyArrayType : void 0; + case "promise": + return (!typeArgs || !typeArgs.length) && !noImplicitAny ? createPromiseType(anyType) : void 0; + case "Object": + if (typeArgs && typeArgs.length === 2) { + if (ts6.isJSDocIndexSignature(node)) { + var indexed = getTypeFromTypeNode(typeArgs[0]); + var target = getTypeFromTypeNode(typeArgs[1]); + var indexInfo = indexed === stringType || indexed === numberType ? [createIndexInfo( + indexed, + target, + /*isReadonly*/ + false + )] : ts6.emptyArray; + return createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, indexInfo); + } + return anyType; + } + checkNoTypeArguments(node); + return !noImplicitAny ? anyType : void 0; + } + } + } + function getTypeFromJSDocNullableTypeNode(node) { + var type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getNullableType( + type, + 65536 + /* TypeFlags.Null */ + ) : type; + } + function getTypeFromTypeReference(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (ts6.isConstTypeReference(node) && ts6.isAssertionExpression(node.parent)) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = checkExpressionCached(node.parent.expression); + } + var symbol = void 0; + var type = void 0; + var meaning = 788968; + if (isJSDocTypeReference(node)) { + type = getIntendedTypeFromJSDocTypeReference(node); + if (!type) { + symbol = resolveTypeReferenceName( + node, + meaning, + /*ignoreErrors*/ + true + ); + if (symbol === unknownSymbol) { + symbol = resolveTypeReferenceName( + node, + meaning | 111551 + /* SymbolFlags.Value */ + ); + } else { + resolveTypeReferenceName(node, meaning); + } + type = getTypeReferenceType(node, symbol); + } + } + if (!type) { + symbol = resolveTypeReferenceName(node, meaning); + type = getTypeReferenceType(node, symbol); + } + links.resolvedSymbol = symbol; + links.resolvedType = type; + } + return links.resolvedType; + } + function typeArgumentsFromTypeReferenceNode(node) { + return ts6.map(node.typeArguments, getTypeFromTypeNode); + } + function getTypeFromTypeQueryNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = checkExpressionWithTypeArguments(node); + links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type)); + } + return links.resolvedType; + } + function getTypeOfGlobalSymbol(symbol, arity) { + function getTypeDeclaration(symbol2) { + var declarations = symbol2.declarations; + if (declarations) { + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; + switch (declaration.kind) { + case 260: + case 261: + case 263: + return declaration; + } + } + } + } + if (!symbol) { + return arity ? emptyGenericType : emptyObjectType; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!(type.flags & 524288)) { + error(getTypeDeclaration(symbol), ts6.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, ts6.symbolName(symbol)); + return arity ? emptyGenericType : emptyObjectType; + } + if (ts6.length(type.typeParameters) !== arity) { + error(getTypeDeclaration(symbol), ts6.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts6.symbolName(symbol), arity); + return arity ? emptyGenericType : emptyObjectType; + } + return type; + } + function getGlobalValueSymbol(name, reportErrors) { + return getGlobalSymbol(name, 111551, reportErrors ? ts6.Diagnostics.Cannot_find_global_value_0 : void 0); + } + function getGlobalTypeSymbol(name, reportErrors) { + return getGlobalSymbol(name, 788968, reportErrors ? ts6.Diagnostics.Cannot_find_global_type_0 : void 0); + } + function getGlobalTypeAliasSymbol(name, arity, reportErrors) { + var symbol = getGlobalSymbol(name, 788968, reportErrors ? ts6.Diagnostics.Cannot_find_global_type_0 : void 0); + if (symbol) { + getDeclaredTypeOfSymbol(symbol); + if (ts6.length(getSymbolLinks(symbol).typeParameters) !== arity) { + var decl = symbol.declarations && ts6.find(symbol.declarations, ts6.isTypeAliasDeclaration); + error(decl, ts6.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts6.symbolName(symbol), arity); + return void 0; + } + } + return symbol; + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName( + void 0, + name, + meaning, + diagnostic, + name, + /*isUse*/ + false, + /*excludeGlobals*/ + false, + /*getSpellingSuggestions*/ + false + ); + } + function getGlobalType(name, arity, reportErrors) { + var symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : void 0; + } + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType( + "TypedPropertyDescriptor", + /*arity*/ + 1, + /*reportErrors*/ + true + ) || emptyGenericType); + } + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType( + "TemplateStringsArray", + /*arity*/ + 0, + /*reportErrors*/ + true + ) || emptyObjectType); + } + function getGlobalImportMetaType() { + return deferredGlobalImportMetaType || (deferredGlobalImportMetaType = getGlobalType( + "ImportMeta", + /*arity*/ + 0, + /*reportErrors*/ + true + ) || emptyObjectType); + } + function getGlobalImportMetaExpressionType() { + if (!deferredGlobalImportMetaExpressionType) { + var symbol = createSymbol(0, "ImportMetaExpression"); + var importMetaType = getGlobalImportMetaType(); + var metaPropertySymbol = createSymbol( + 4, + "meta", + 8 + /* CheckFlags.Readonly */ + ); + metaPropertySymbol.parent = symbol; + metaPropertySymbol.type = importMetaType; + var members = ts6.createSymbolTable([metaPropertySymbol]); + symbol.members = members; + deferredGlobalImportMetaExpressionType = createAnonymousType(symbol, members, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + } + return deferredGlobalImportMetaExpressionType; + } + function getGlobalImportCallOptionsType(reportErrors) { + return deferredGlobalImportCallOptionsType || (deferredGlobalImportCallOptionsType = getGlobalType( + "ImportCallOptions", + /*arity*/ + 0, + reportErrors + )) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + function getGlobalESSymbolConstructorTypeSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorTypeSymbol || (deferredGlobalESSymbolConstructorTypeSymbol = getGlobalTypeSymbol("SymbolConstructor", reportErrors)); + } + function getGlobalESSymbolType() { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType( + "Symbol", + /*arity*/ + 0, + /*reportErrors*/ + false + )) || emptyObjectType; + } + function getGlobalPromiseType(reportErrors) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType( + "Promise", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalPromiseLikeType(reportErrors) { + return deferredGlobalPromiseLikeType || (deferredGlobalPromiseLikeType = getGlobalType( + "PromiseLike", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalPromiseConstructorSymbol(reportErrors) { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + function getGlobalPromiseConstructorLikeType(reportErrors) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType( + "PromiseConstructorLike", + /*arity*/ + 0, + reportErrors + )) || emptyObjectType; + } + function getGlobalAsyncIterableType(reportErrors) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType( + "AsyncIterable", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalAsyncIteratorType(reportErrors) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType( + "AsyncIterator", + /*arity*/ + 3, + reportErrors + )) || emptyGenericType; + } + function getGlobalAsyncIterableIteratorType(reportErrors) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType( + "AsyncIterableIterator", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalAsyncGeneratorType(reportErrors) { + return deferredGlobalAsyncGeneratorType || (deferredGlobalAsyncGeneratorType = getGlobalType( + "AsyncGenerator", + /*arity*/ + 3, + reportErrors + )) || emptyGenericType; + } + function getGlobalIterableType(reportErrors) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType( + "Iterable", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalIteratorType(reportErrors) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType( + "Iterator", + /*arity*/ + 3, + reportErrors + )) || emptyGenericType; + } + function getGlobalIterableIteratorType(reportErrors) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType( + "IterableIterator", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalGeneratorType(reportErrors) { + return deferredGlobalGeneratorType || (deferredGlobalGeneratorType = getGlobalType( + "Generator", + /*arity*/ + 3, + reportErrors + )) || emptyGenericType; + } + function getGlobalIteratorYieldResultType(reportErrors) { + return deferredGlobalIteratorYieldResultType || (deferredGlobalIteratorYieldResultType = getGlobalType( + "IteratorYieldResult", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalIteratorReturnResultType(reportErrors) { + return deferredGlobalIteratorReturnResultType || (deferredGlobalIteratorReturnResultType = getGlobalType( + "IteratorReturnResult", + /*arity*/ + 1, + reportErrors + )) || emptyGenericType; + } + function getGlobalTypeOrUndefined(name, arity) { + if (arity === void 0) { + arity = 0; + } + var symbol = getGlobalSymbol( + name, + 788968, + /*diagnostic*/ + void 0 + ); + return symbol && getTypeOfGlobalSymbol(symbol, arity); + } + function getGlobalExtractSymbol() { + deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalTypeAliasSymbol( + "Extract", + /*arity*/ + 2, + /*reportErrors*/ + true + ) || unknownSymbol); + return deferredGlobalExtractSymbol === unknownSymbol ? void 0 : deferredGlobalExtractSymbol; + } + function getGlobalOmitSymbol() { + deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalTypeAliasSymbol( + "Omit", + /*arity*/ + 2, + /*reportErrors*/ + true + ) || unknownSymbol); + return deferredGlobalOmitSymbol === unknownSymbol ? void 0 : deferredGlobalOmitSymbol; + } + function getGlobalAwaitedSymbol(reportErrors) { + deferredGlobalAwaitedSymbol || (deferredGlobalAwaitedSymbol = getGlobalTypeAliasSymbol( + "Awaited", + /*arity*/ + 1, + reportErrors + ) || (reportErrors ? unknownSymbol : void 0)); + return deferredGlobalAwaitedSymbol === unknownSymbol ? void 0 : deferredGlobalAwaitedSymbol; + } + function getGlobalBigIntType() { + return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType( + "BigInt", + /*arity*/ + 0, + /*reportErrors*/ + false + )) || emptyObjectType; + } + function getGlobalNaNSymbol() { + return deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol( + "NaN", + /*reportErrors*/ + false + )); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol( + "Record", + /*arity*/ + 2, + /*reportErrors*/ + true + ) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? void 0 : deferredGlobalRecordSymbol; + } + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; + } + function createTypedPropertyDescriptorType(propertyType) { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); + } + function createIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableType( + /*reportErrors*/ + true + ), [iteratedType]); + } + function createArrayType(elementType, readonly) { + return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]); + } + function getTupleElementFlags(node) { + switch (node.kind) { + case 187: + return 2; + case 188: + return getRestTypeElementFlags(node); + case 199: + return node.questionToken ? 2 : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1; + default: + return 1; + } + } + function getRestTypeElementFlags(node) { + return getArrayElementTypeNode(node.type) ? 4 : 8; + } + function getArrayOrTupleTargetType(node) { + var readonly = isReadonlyTypeOperator(node.parent); + var elementType = getArrayElementTypeNode(node); + if (elementType) { + return readonly ? globalReadonlyArrayType : globalArrayType; + } + var elementFlags = ts6.map(node.elements, getTupleElementFlags); + var missingName = ts6.some(node.elements, function(e) { + return e.kind !== 199; + }); + return getTupleTargetType( + elementFlags, + readonly, + /*associatedNames*/ + missingName ? void 0 : node.elements + ); + } + function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 ? mayResolveTypeAlias(node.elementType) : node.kind === 186 ? ts6.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts6.some(node.typeArguments, mayResolveTypeAlias)); + } + function isResolvedByTypeAlias(node) { + var parent = node.parent; + switch (parent.kind) { + case 193: + case 199: + case 180: + case 189: + case 190: + case 196: + case 191: + case 195: + case 185: + case 186: + return isResolvedByTypeAlias(parent); + case 262: + return true; + } + return false; + } + function mayResolveTypeAlias(node) { + switch (node.kind) { + case 180: + return isJSDocTypeReference(node) || !!(resolveTypeReferenceName( + node, + 788968 + /* SymbolFlags.Type */ + ).flags & 524288); + case 183: + return true; + case 195: + return node.operator !== 156 && mayResolveTypeAlias(node.type); + case 193: + case 187: + case 199: + case 319: + case 317: + case 318: + case 312: + return mayResolveTypeAlias(node.type); + case 188: + return node.type.kind !== 185 || mayResolveTypeAlias(node.type.elementType); + case 189: + case 190: + return ts6.some(node.types, mayResolveTypeAlias); + case 196: + return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); + case 191: + return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); + } + return false; + } + function getTypeFromArrayOrTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var target = getArrayOrTupleTargetType(node); + if (target === emptyGenericType) { + links.resolvedType = emptyObjectType; + } else if (!(node.kind === 186 && ts6.some(node.elements, function(e) { + return !!(getTupleElementFlags(e) & 8); + })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 && node.elements.length === 0 ? target : createDeferredTypeReference( + target, + node, + /*mapper*/ + void 0 + ); + } else { + var elementTypes = node.kind === 185 ? [getTypeFromTypeNode(node.elementType)] : ts6.map(node.elements, getTypeFromTypeNode); + links.resolvedType = createNormalizedTypeReference(target, elementTypes); + } + } + return links.resolvedType; + } + function isReadonlyTypeOperator(node) { + return ts6.isTypeOperatorNode(node) && node.operator === 146; + } + function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { + if (readonly === void 0) { + readonly = false; + } + var tupleTarget = getTupleTargetType(elementFlags || ts6.map(elementTypes, function(_) { + return 1; + }), readonly, namedMemberDeclarations); + return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget; + } + function getTupleTargetType(elementFlags, readonly, namedMemberDeclarations) { + if (elementFlags.length === 1 && elementFlags[0] & 4) { + return readonly ? globalReadonlyArrayType : globalArrayType; + } + var key = ts6.map(elementFlags, function(f) { + return f & 1 ? "#" : f & 2 ? "?" : f & 4 ? "." : "*"; + }).join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + ts6.map(namedMemberDeclarations, getNodeId).join(",") : ""); + var type = tupleTypes.get(key); + if (!type) { + tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations)); + } + return type; + } + function createTupleTargetType(elementFlags, readonly, namedMemberDeclarations) { + var arity = elementFlags.length; + var minLength = ts6.countWhere(elementFlags, function(f) { + return !!(f & (1 | 8)); + }); + var typeParameters; + var properties = []; + var combinedFlags = 0; + if (arity) { + typeParameters = new Array(arity); + for (var i = 0; i < arity; i++) { + var typeParameter = typeParameters[i] = createTypeParameter(); + var flags = elementFlags[i]; + combinedFlags |= flags; + if (!(combinedFlags & 12)) { + var property = createSymbol(4 | (flags & 2 ? 16777216 : 0), "" + i, readonly ? 8 : 0); + property.tupleLabelDeclaration = namedMemberDeclarations === null || namedMemberDeclarations === void 0 ? void 0 : namedMemberDeclarations[i]; + property.type = typeParameter; + properties.push(property); + } + } + } + var fixedLength = properties.length; + var lengthSymbol = createSymbol(4, "length", readonly ? 8 : 0); + if (combinedFlags & 12) { + lengthSymbol.type = numberType; + } else { + var literalTypes = []; + for (var i = minLength; i <= arity; i++) + literalTypes.push(getNumberLiteralType(i)); + lengthSymbol.type = getUnionType(literalTypes); + } + properties.push(lengthSymbol); + var type = createObjectType( + 8 | 4 + /* ObjectFlags.Reference */ + ); + type.typeParameters = typeParameters; + type.outerTypeParameters = void 0; + type.localTypeParameters = typeParameters; + type.instantiations = new ts6.Map(); + type.instantiations.set(getTypeListId(type.typeParameters), type); + type.target = type; + type.resolvedTypeArguments = type.typeParameters; + type.thisType = createTypeParameter(); + type.thisType.isThisType = true; + type.thisType.constraint = type; + type.declaredProperties = properties; + type.declaredCallSignatures = ts6.emptyArray; + type.declaredConstructSignatures = ts6.emptyArray; + type.declaredIndexInfos = ts6.emptyArray; + type.elementFlags = elementFlags; + type.minLength = minLength; + type.fixedLength = fixedLength; + type.hasRestElement = !!(combinedFlags & 12); + type.combinedFlags = combinedFlags; + type.readonly = readonly; + type.labeledElementDeclarations = namedMemberDeclarations; + return type; + } + function createNormalizedTypeReference(target, typeArguments) { + return target.objectFlags & 8 ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments); + } + function createNormalizedTupleType(target, elementTypes) { + var _a, _b, _c; + if (!(target.combinedFlags & 14)) { + return createTypeReference(target, elementTypes); + } + if (target.combinedFlags & 8) { + var unionIndex_1 = ts6.findIndex(elementTypes, function(t, i2) { + return !!(target.elementFlags[i2] & 8 && t.flags & (131072 | 1048576)); + }); + if (unionIndex_1 >= 0) { + return checkCrossProductUnion(ts6.map(elementTypes, function(t, i2) { + return target.elementFlags[i2] & 8 ? t : unknownType; + })) ? mapType(elementTypes[unionIndex_1], function(t) { + return createNormalizedTupleType(target, ts6.replaceElement(elementTypes, unionIndex_1, t)); + }) : errorType; + } + } + var expandedTypes = []; + var expandedFlags = []; + var expandedDeclarations = []; + var lastRequiredIndex = -1; + var firstRestIndex = -1; + var lastOptionalOrRestIndex = -1; + var _loop_17 = function(i2) { + var type = elementTypes[i2]; + var flags = target.elementFlags[i2]; + if (flags & 8) { + if (type.flags & 58982400 || isGenericMappedType(type)) { + addElement(type, 8, (_a = target.labeledElementDeclarations) === null || _a === void 0 ? void 0 : _a[i2]); + } else if (isTupleType(type)) { + var elements = getTypeArguments(type); + if (elements.length + expandedTypes.length >= 1e4) { + error(currentNode, ts6.isPartOfTypeNode(currentNode) ? ts6.Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : ts6.Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent); + return { value: errorType }; + } + ts6.forEach(elements, function(t, n) { + var _a2; + return addElement(t, type.target.elementFlags[n], (_a2 = type.target.labeledElementDeclarations) === null || _a2 === void 0 ? void 0 : _a2[n]); + }); + } else { + addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4, (_b = target.labeledElementDeclarations) === null || _b === void 0 ? void 0 : _b[i2]); + } + } else { + addElement(type, flags, (_c = target.labeledElementDeclarations) === null || _c === void 0 ? void 0 : _c[i2]); + } + }; + for (var i = 0; i < elementTypes.length; i++) { + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; + } + for (var i = 0; i < lastRequiredIndex; i++) { + if (expandedFlags[i] & 2) + expandedFlags[i] = 1; + } + if (firstRestIndex >= 0 && firstRestIndex < lastOptionalOrRestIndex) { + expandedTypes[firstRestIndex] = getUnionType(ts6.sameMap(expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1), function(t, i2) { + return expandedFlags[firstRestIndex + i2] & 8 ? getIndexedAccessType(t, numberType) : t; + })); + expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); + expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); + expandedDeclarations === null || expandedDeclarations === void 0 ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); + } + var tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations); + return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget; + function addElement(type, flags, declaration) { + if (flags & 1) { + lastRequiredIndex = expandedFlags.length; + } + if (flags & 4 && firstRestIndex < 0) { + firstRestIndex = expandedFlags.length; + } + if (flags & (2 | 4)) { + lastOptionalOrRestIndex = expandedFlags.length; + } + expandedTypes.push(flags & 2 ? addOptionality( + type, + /*isProperty*/ + true + ) : type); + expandedFlags.push(flags); + if (expandedDeclarations && declaration) { + expandedDeclarations.push(declaration); + } else { + expandedDeclarations = void 0; + } + } + } + function sliceTupleType(type, index, endSkipCount) { + if (endSkipCount === void 0) { + endSkipCount = 0; + } + var target = type.target; + var endIndex = getTypeReferenceArity(type) - endSkipCount; + return index > target.fixedLength ? getRestArrayTypeOfTupleType(type) || createTupleType(ts6.emptyArray) : createTupleType( + getTypeArguments(type).slice(index, endIndex), + target.elementFlags.slice(index, endIndex), + /*readonly*/ + false, + target.labeledElementDeclarations && target.labeledElementDeclarations.slice(index, endIndex) + ); + } + function getKnownKeysOfTupleType(type) { + return getUnionType(ts6.append(ts6.arrayOf(type.target.fixedLength, function(i) { + return getStringLiteralType("" + i); + }), getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType))); + } + function getStartElementCount(type, flags) { + var index = ts6.findIndex(type.elementFlags, function(f) { + return !(f & flags); + }); + return index >= 0 ? index : type.elementFlags.length; + } + function getEndElementCount(type, flags) { + return type.elementFlags.length - ts6.findLastIndex(type.elementFlags, function(f) { + return !(f & flags); + }) - 1; + } + function getTypeFromOptionalTypeNode(node) { + return addOptionality( + getTypeFromTypeNode(node.type), + /*isProperty*/ + true + ); + } + function getTypeId(type) { + return type.id; + } + function containsType(types, type) { + return ts6.binarySearch(types, type, getTypeId, ts6.compareValues) >= 0; + } + function insertType(types, type) { + var index = ts6.binarySearch(types, type, getTypeId, ts6.compareValues); + if (index < 0) { + types.splice(~index, 0, type); + return true; + } + return false; + } + function addTypeToUnion(typeSet, includes, type) { + var flags = type.flags; + if (flags & 1048576) { + return addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 : 0), type.types); + } + if (!(flags & 131072)) { + includes |= flags & 205258751; + if (flags & 465829888) + includes |= 33554432; + if (type === wildcardType) + includes |= 8388608; + if (!strictNullChecks && flags & 98304) { + if (!(ts6.getObjectFlags(type) & 65536)) + includes |= 4194304; + } else { + var len = typeSet.length; + var index = len && type.id > typeSet[len - 1].id ? ~len : ts6.binarySearch(typeSet, type, getTypeId, ts6.compareValues); + if (index < 0) { + typeSet.splice(~index, 0, type); + } + } + } + return includes; + } + function addTypesToUnion(typeSet, includes, types) { + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var type = types_9[_i]; + includes = addTypeToUnion(typeSet, includes, type); + } + return includes; + } + function removeSubtypes(types, hasObjectTypes) { + if (types.length < 2) { + return types; + } + var id = getTypeListId(types); + var match = subtypeReductionCache.get(id); + if (match) { + return match; + } + var hasEmptyObject = hasObjectTypes && ts6.some(types, function(t2) { + return !!(t2.flags & 524288) && !isGenericMappedType(t2) && isEmptyResolvedType(resolveStructuredTypeMembers(t2)); + }); + var len = types.length; + var i = len; + var count = 0; + while (i > 0) { + i--; + var source = types[i]; + if (hasEmptyObject || source.flags & 469499904) { + var keyProperty = source.flags & (524288 | 2097152 | 58982400) ? ts6.find(getPropertiesOfType(source), function(p) { + return isUnitType(getTypeOfSymbol(p)); + }) : void 0; + var keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty)); + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var target = types_10[_i]; + if (source !== target) { + if (count === 1e5) { + var estimatedCount = count / (len - i) * len; + if (estimatedCount > 1e6) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "removeSubtypes_DepthLimit", { typeIds: types.map(function(t2) { + return t2.id; + }) }); + error(currentNode, ts6.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); + return void 0; + } + } + count++; + if (keyProperty && target.flags & (524288 | 2097152 | 58982400)) { + var t = getTypeOfPropertyOfType(target, keyProperty.escapedName); + if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) { + continue; + } + } + if (isTypeRelatedTo(source, target, strictSubtypeRelation) && (!(ts6.getObjectFlags(getTargetType(source)) & 1) || !(ts6.getObjectFlags(getTargetType(target)) & 1) || isTypeDerivedFrom(source, target))) { + ts6.orderedRemoveItemAt(types, i); + break; + } + } + } + } + } + subtypeReductionCache.set(id, types); + return types; + } + function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) { + var i = types.length; + while (i > 0) { + i--; + var t = types[i]; + var flags = t.flags; + var remove = flags & (128 | 134217728 | 268435456) && includes & 4 || flags & 256 && includes & 8 || flags & 2048 && includes & 64 || flags & 8192 && includes & 4096 || reduceVoidUndefined && flags & 32768 && includes & 16384 || isFreshLiteralType(t) && containsType(types, t.regularType); + if (remove) { + ts6.orderedRemoveItemAt(types, i); + } + } + } + function removeStringLiteralsMatchedByTemplateLiterals(types) { + var templates = ts6.filter(types, isPatternLiteralType); + if (templates.length) { + var i = types.length; + var _loop_18 = function() { + i--; + var t = types[i]; + if (t.flags & 128 && ts6.some(templates, function(template) { + return isTypeMatchedByTemplateLiteralType(t, template); + })) { + ts6.orderedRemoveItemAt(types, i); + } + }; + while (i > 0) { + _loop_18(); + } + } + } + function isNamedUnionType(type) { + return !!(type.flags & 1048576 && (type.aliasSymbol || type.origin)); + } + function addNamedUnions(namedUnions, types) { + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; + if (t.flags & 1048576) { + var origin = t.origin; + if (t.aliasSymbol || origin && !(origin.flags & 1048576)) { + ts6.pushIfUnique(namedUnions, t); + } else if (origin && origin.flags & 1048576) { + addNamedUnions(namedUnions, origin.types); + } + } + } + } + function createOriginUnionOrIntersectionType(flags, types) { + var result = createOriginType(flags); + result.types = types; + return result; + } + function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) { + if (unionReduction === void 0) { + unionReduction = 1; + } + if (types.length === 0) { + return neverType; + } + if (types.length === 1) { + return types[0]; + } + var typeSet = []; + var includes = addTypesToUnion(typeSet, 0, types); + if (unionReduction !== 0) { + if (includes & 3) { + return includes & 1 ? includes & 8388608 ? wildcardType : anyType : includes & 65536 || containsType(typeSet, unknownType) ? unknownType : nonNullUnknownType; + } + if (exactOptionalPropertyTypes && includes & 32768) { + var missingIndex = ts6.binarySearch(typeSet, missingType, getTypeId, ts6.compareValues); + if (missingIndex >= 0 && containsType(typeSet, undefinedType)) { + ts6.orderedRemoveItemAt(typeSet, missingIndex); + } + } + if (includes & (2944 | 8192 | 134217728 | 268435456) || includes & 16384 && includes & 32768) { + removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2)); + } + if (includes & 128 && includes & 134217728) { + removeStringLiteralsMatchedByTemplateLiterals(typeSet); + } + if (unionReduction === 2) { + typeSet = removeSubtypes(typeSet, !!(includes & 524288)); + if (!typeSet) { + return errorType; + } + } + if (typeSet.length === 0) { + return includes & 65536 ? includes & 4194304 ? nullType : nullWideningType : includes & 32768 ? includes & 4194304 ? undefinedType : undefinedWideningType : neverType; + } + } + if (!origin && includes & 1048576) { + var namedUnions = []; + addNamedUnions(namedUnions, types); + var reducedTypes = []; + var _loop_19 = function(t2) { + if (!ts6.some(namedUnions, function(union) { + return containsType(union.types, t2); + })) { + reducedTypes.push(t2); + } + }; + for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { + var t = typeSet_1[_i]; + _loop_19(t); + } + if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { + return namedUnions[0]; + } + var namedTypesCount = ts6.reduceLeft(namedUnions, function(sum, union) { + return sum + union.types.length; + }, 0); + if (namedTypesCount + reducedTypes.length === typeSet.length) { + for (var _a = 0, namedUnions_1 = namedUnions; _a < namedUnions_1.length; _a++) { + var t = namedUnions_1[_a]; + insertType(reducedTypes, t); + } + origin = createOriginUnionOrIntersectionType(1048576, reducedTypes); + } + } + var objectFlags = (includes & 36323363 ? 0 : 32768) | (includes & 2097152 ? 16777216 : 0); + return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin); + } + function getUnionOrIntersectionTypePredicate(signatures, kind) { + var first; + var types = []; + for (var _i = 0, signatures_6 = signatures; _i < signatures_6.length; _i++) { + var sig = signatures_6[_i]; + var pred = getTypePredicateOfSignature(sig); + if (!pred || pred.kind === 2 || pred.kind === 3) { + if (kind !== 2097152) { + continue; + } else { + return; + } + } + if (first) { + if (!typePredicateKindsMatch(first, pred)) { + return void 0; + } + } else { + first = pred; + } + types.push(pred.type); + } + if (!first) { + return void 0; + } + var compositeType = getUnionOrIntersectionType(types, kind); + return createTypePredicate(first.kind, first.parameterName, first.parameterIndex, compositeType); + } + function typePredicateKindsMatch(a, b) { + return a.kind === b.kind && a.parameterIndex === b.parameterIndex; + } + function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) { + if (types.length === 0) { + return neverType; + } + if (types.length === 1) { + return types[0]; + } + var typeKey = !origin ? getTypeListId(types) : origin.flags & 1048576 ? "|".concat(getTypeListId(origin.types)) : origin.flags & 2097152 ? "&".concat(getTypeListId(origin.types)) : "#".concat(origin.type.id, "|").concat(getTypeListId(types)); + var id = typeKey + getAliasId(aliasSymbol, aliasTypeArguments); + var type = unionTypes.get(id); + if (!type) { + type = createType( + 1048576 + /* TypeFlags.Union */ + ); + type.objectFlags = objectFlags | getPropagatingFlagsOfTypes( + types, + /*excludeKinds*/ + 98304 + /* TypeFlags.Nullable */ + ); + type.types = types; + type.origin = origin; + type.aliasSymbol = aliasSymbol; + type.aliasTypeArguments = aliasTypeArguments; + if (types.length === 2 && types[0].flags & 512 && types[1].flags & 512) { + type.flags |= 16; + type.intrinsicName = "boolean"; + } + unionTypes.set(id, type); + } + return type; + } + function getTypeFromUnionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var aliasSymbol = getAliasSymbolForTypeNode(node); + links.resolvedType = getUnionType(ts6.map(node.types, getTypeFromTypeNode), 1, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)); + } + return links.resolvedType; + } + function addTypeToIntersection(typeSet, includes, type) { + var flags = type.flags; + if (flags & 2097152) { + return addTypesToIntersection(typeSet, includes, type.types); + } + if (isEmptyAnonymousObjectType(type)) { + if (!(includes & 16777216)) { + includes |= 16777216; + typeSet.set(type.id.toString(), type); + } + } else { + if (flags & 3) { + if (type === wildcardType) + includes |= 8388608; + } else if (strictNullChecks || !(flags & 98304)) { + if (exactOptionalPropertyTypes && type === missingType) { + includes |= 262144; + type = undefinedType; + } + if (!typeSet.has(type.id.toString())) { + if (type.flags & 109440 && includes & 109440) { + includes |= 67108864; + } + typeSet.set(type.id.toString(), type); + } + } + includes |= flags & 205258751; + } + return includes; + } + function addTypesToIntersection(typeSet, includes, types) { + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var type = types_12[_i]; + includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type)); + } + return includes; + } + function removeRedundantSupertypes(types, includes) { + var i = types.length; + while (i > 0) { + i--; + var t = types[i]; + var remove = t.flags & 4 && includes & (128 | 134217728 | 268435456) || t.flags & 8 && includes & 256 || t.flags & 64 && includes & 2048 || t.flags & 4096 && includes & 8192 || t.flags & 16384 && includes & 32768 || isEmptyAnonymousObjectType(t) && includes & 470302716; + if (remove) { + ts6.orderedRemoveItemAt(types, i); + } + } + } + function eachUnionContains(unionTypes2, type) { + for (var _i = 0, unionTypes_1 = unionTypes2; _i < unionTypes_1.length; _i++) { + var u = unionTypes_1[_i]; + if (!containsType(u.types, type)) { + var primitive = type.flags & 128 ? stringType : type.flags & 256 ? numberType : type.flags & 2048 ? bigintType : type.flags & 8192 ? esSymbolType : void 0; + if (!primitive || !containsType(u.types, primitive)) { + return false; + } + } + } + return true; + } + function extractRedundantTemplateLiterals(types) { + var i = types.length; + var literals = ts6.filter(types, function(t3) { + return !!(t3.flags & 128); + }); + while (i > 0) { + i--; + var t = types[i]; + if (!(t.flags & 134217728)) + continue; + for (var _i = 0, literals_1 = literals; _i < literals_1.length; _i++) { + var t2 = literals_1[_i]; + if (isTypeSubtypeOf(t2, t)) { + ts6.orderedRemoveItemAt(types, i); + break; + } else if (isPatternLiteralType(t)) { + return true; + } + } + } + return false; + } + function eachIsUnionContaining(types, flag) { + return ts6.every(types, function(t) { + return !!(t.flags & 1048576) && ts6.some(t.types, function(tt) { + return !!(tt.flags & flag); + }); + }); + } + function removeFromEach(types, flag) { + for (var i = 0; i < types.length; i++) { + types[i] = filterType(types[i], function(t) { + return !(t.flags & flag); + }); + } + } + function intersectUnionsOfPrimitiveTypes(types) { + var unionTypes2; + var index = ts6.findIndex(types, function(t2) { + return !!(ts6.getObjectFlags(t2) & 32768); + }); + if (index < 0) { + return false; + } + var i = index + 1; + while (i < types.length) { + var t = types[i]; + if (ts6.getObjectFlags(t) & 32768) { + (unionTypes2 || (unionTypes2 = [types[index]])).push(t); + ts6.orderedRemoveItemAt(types, i); + } else { + i++; + } + } + if (!unionTypes2) { + return false; + } + var checked = []; + var result = []; + for (var _i = 0, unionTypes_2 = unionTypes2; _i < unionTypes_2.length; _i++) { + var u = unionTypes_2[_i]; + for (var _a = 0, _b = u.types; _a < _b.length; _a++) { + var t = _b[_a]; + if (insertType(checked, t)) { + if (eachUnionContains(unionTypes2, t)) { + insertType(result, t); + } + } + } + } + types[index] = getUnionTypeFromSortedList( + result, + 32768 + /* ObjectFlags.PrimitiveUnion */ + ); + return true; + } + function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { + var result = createType( + 2097152 + /* TypeFlags.Intersection */ + ); + result.objectFlags = getPropagatingFlagsOfTypes( + types, + /*excludeKinds*/ + 98304 + /* TypeFlags.Nullable */ + ); + result.types = types; + result.aliasSymbol = aliasSymbol; + result.aliasTypeArguments = aliasTypeArguments; + return result; + } + function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) { + var typeMembershipMap = new ts6.Map(); + var includes = addTypesToIntersection(typeMembershipMap, 0, types); + var typeSet = ts6.arrayFrom(typeMembershipMap.values()); + if (includes & 131072) { + return ts6.contains(typeSet, silentNeverType) ? silentNeverType : neverType; + } + if (strictNullChecks && includes & 98304 && includes & (524288 | 67108864 | 16777216) || includes & 67108864 && includes & (469892092 & ~67108864) || includes & 402653316 && includes & (469892092 & ~402653316) || includes & 296 && includes & (469892092 & ~296) || includes & 2112 && includes & (469892092 & ~2112) || includes & 12288 && includes & (469892092 & ~12288) || includes & 49152 && includes & (469892092 & ~49152)) { + return neverType; + } + if (includes & 134217728 && includes & 128 && extractRedundantTemplateLiterals(typeSet)) { + return neverType; + } + if (includes & 1) { + return includes & 8388608 ? wildcardType : anyType; + } + if (!strictNullChecks && includes & 98304) { + return includes & 16777216 ? neverType : includes & 32768 ? undefinedType : nullType; + } + if (includes & 4 && includes & (128 | 134217728 | 268435456) || includes & 8 && includes & 256 || includes & 64 && includes & 2048 || includes & 4096 && includes & 8192 || includes & 16384 && includes & 32768 || includes & 16777216 && includes & 470302716) { + if (!noSupertypeReduction) + removeRedundantSupertypes(typeSet, includes); + } + if (includes & 262144) { + typeSet[typeSet.indexOf(undefinedType)] = missingType; + } + if (typeSet.length === 0) { + return unknownType; + } + if (typeSet.length === 1) { + return typeSet[0]; + } + var id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments); + var result = intersectionTypes.get(id); + if (!result) { + if (includes & 1048576) { + if (intersectUnionsOfPrimitiveTypes(typeSet)) { + result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } else if (eachIsUnionContaining( + typeSet, + 32768 + /* TypeFlags.Undefined */ + )) { + var undefinedOrMissingType = exactOptionalPropertyTypes && ts6.some(typeSet, function(t) { + return containsType(t.types, missingType); + }) ? missingType : undefinedType; + removeFromEach( + typeSet, + 32768 + /* TypeFlags.Undefined */ + ); + result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1, aliasSymbol, aliasTypeArguments); + } else if (eachIsUnionContaining( + typeSet, + 65536 + /* TypeFlags.Null */ + )) { + removeFromEach( + typeSet, + 65536 + /* TypeFlags.Null */ + ); + result = getUnionType([getIntersectionType(typeSet), nullType], 1, aliasSymbol, aliasTypeArguments); + } else { + if (!checkCrossProductUnion(typeSet)) { + return errorType; + } + var constituents = getCrossProductIntersections(typeSet); + var origin = ts6.some(constituents, function(t) { + return !!(t.flags & 2097152); + }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152, typeSet) : void 0; + result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, origin); + } + } else { + result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } + intersectionTypes.set(id, result); + } + return result; + } + function getCrossProductUnionSize(types) { + return ts6.reduceLeft(types, function(n, t) { + return t.flags & 1048576 ? n * t.types.length : t.flags & 131072 ? 0 : n; + }, 1); + } + function checkCrossProductUnion(types) { + var size = getCrossProductUnionSize(types); + if (size >= 1e5) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "checkCrossProductUnion_DepthLimit", { typeIds: types.map(function(t) { + return t.id; + }), size }); + error(currentNode, ts6.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); + return false; + } + return true; + } + function getCrossProductIntersections(types) { + var count = getCrossProductUnionSize(types); + var intersections = []; + for (var i = 0; i < count; i++) { + var constituents = types.slice(); + var n = i; + for (var j = types.length - 1; j >= 0; j--) { + if (types[j].flags & 1048576) { + var sourceTypes = types[j].types; + var length_5 = sourceTypes.length; + constituents[j] = sourceTypes[n % length_5]; + n = Math.floor(n / length_5); + } + } + var t = getIntersectionType(constituents); + if (!(t.flags & 131072)) + intersections.push(t); + } + return intersections; + } + function getConstituentCount(type) { + return !(type.flags & 3145728) || type.aliasSymbol ? 1 : type.flags & 1048576 && type.origin ? getConstituentCount(type.origin) : getConstituentCountOfTypes(type.types); + } + function getConstituentCountOfTypes(types) { + return ts6.reduceLeft(types, function(n, t) { + return n + getConstituentCount(t); + }, 0); + } + function getTypeFromIntersectionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var aliasSymbol = getAliasSymbolForTypeNode(node); + var types = ts6.map(node.types, getTypeFromTypeNode); + var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 | 8 | 64)) && types[1] === emptyTypeLiteralType; + links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction); + } + return links.resolvedType; + } + function createIndexType(type, stringsOnly) { + var result = createType( + 4194304 + /* TypeFlags.Index */ + ); + result.type = type; + result.stringsOnly = stringsOnly; + return result; + } + function createOriginIndexType(type) { + var result = createOriginType( + 4194304 + /* TypeFlags.Index */ + ); + result.type = type; + return result; + } + function getIndexTypeForGenericType(type, stringsOnly) { + return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType( + type, + /*stringsOnly*/ + true + )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType( + type, + /*stringsOnly*/ + false + )); + } + function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) { + var typeParameter = getTypeParameterFromMappedType(type); + var constraintType = getConstraintTypeFromMappedType(type); + var nameType = getNameTypeFromMappedType(type.target || type); + if (!nameType && !noIndexSignatures) { + return constraintType; + } + var keyTypes = []; + if (isMappedTypeWithKeyofConstraintDeclaration(type)) { + if (!isGenericIndexType(constraintType)) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, stringsOnly, addMemberForKeyType); + } else { + return getIndexTypeForGenericType(type, stringsOnly); + } + } else { + forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType); + } + if (isGenericIndexType(constraintType)) { + forEachType(constraintType, addMemberForKeyType); + } + var result = noIndexSignatures ? filterType(getUnionType(keyTypes), function(t) { + return !(t.flags & (1 | 4)); + }) : getUnionType(keyTypes); + if (result.flags & 1048576 && constraintType.flags & 1048576 && getTypeListId(result.types) === getTypeListId(constraintType.types)) { + return constraintType; + } + return result; + function addMemberForKeyType(keyType) { + var propNameType = nameType ? instantiateType(nameType, appendTypeMapping(type.mapper, typeParameter, keyType)) : keyType; + keyTypes.push(propNameType === stringType ? stringOrNumberType : propNameType); + } + } + function hasDistributiveNameType(mappedType) { + var typeVariable = getTypeParameterFromMappedType(mappedType); + return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable); + function isDistributive(type) { + return type.flags & (3 | 131068 | 131072 | 262144 | 524288 | 67108864) ? true : type.flags & 16777216 ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 | 134217728) ? ts6.every(type.types, isDistributive) : type.flags & 8388608 ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 ? isDistributive(type.type) : false; + } + } + function getLiteralTypeFromPropertyName(name) { + if (ts6.isPrivateIdentifier(name)) { + return neverType; + } + return ts6.isIdentifier(name) ? getStringLiteralType(ts6.unescapeLeadingUnderscores(name.escapedText)) : getRegularTypeOfLiteralType(ts6.isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name)); + } + function getLiteralTypeFromProperty(prop, include, includeNonPublic) { + if (includeNonPublic || !(ts6.getDeclarationModifierFlagsFromSymbol(prop) & 24)) { + var type = getSymbolLinks(getLateBoundSymbol(prop)).nameType; + if (!type) { + var name = ts6.getNameOfDeclaration(prop.valueDeclaration); + type = prop.escapedName === "default" ? getStringLiteralType("default") : name && getLiteralTypeFromPropertyName(name) || (!ts6.isKnownSymbol(prop) ? getStringLiteralType(ts6.symbolName(prop)) : void 0); + } + if (type && type.flags & include) { + return type; + } + } + return neverType; + } + function isKeyTypeIncluded(keyType, include) { + return !!(keyType.flags & include || keyType.flags & 2097152 && ts6.some(keyType.types, function(t) { + return isKeyTypeIncluded(t, include); + })); + } + function getLiteralTypeFromProperties(type, include, includeOrigin) { + var origin = includeOrigin && (ts6.getObjectFlags(type) & (3 | 4) || type.aliasSymbol) ? createOriginIndexType(type) : void 0; + var propertyTypes = ts6.map(getPropertiesOfType(type), function(prop) { + return getLiteralTypeFromProperty(prop, include); + }); + var indexKeyTypes = ts6.map(getIndexInfosOfType(type), function(info) { + return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 8 ? stringOrNumberType : info.keyType : neverType; + }); + return getUnionType( + ts6.concatenate(propertyTypes, indexKeyTypes), + 1, + /*aliasSymbol*/ + void 0, + /*aliasTypeArguments*/ + void 0, + origin + ); + } + function isPossiblyReducibleByInstantiation(type) { + var uniqueFilled = getUniqueLiteralFilledInstantiation(type); + return getReducedType(uniqueFilled) !== uniqueFilled; + } + function shouldDeferIndexType(type) { + return !!(type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 && ts6.some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 && maybeTypeOfKind( + type, + 465829888 + /* TypeFlags.Instantiable */ + ) && ts6.some(type.types, isEmptyAnonymousObjectType)); + } + function getIndexType(type, stringsOnly, noIndexSignatures) { + if (stringsOnly === void 0) { + stringsOnly = keyofStringsOnly; + } + type = getReducedType(type); + return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) : type.flags & 1048576 ? getIntersectionType(ts6.map(type.types, function(t) { + return getIndexType(t, stringsOnly, noIndexSignatures); + })) : type.flags & 2097152 ? getUnionType(ts6.map(type.types, function(t) { + return getIndexType(t, stringsOnly, noIndexSignatures); + })) : ts6.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) : type === wildcardType ? wildcardType : type.flags & 2 ? neverType : type.flags & (1 | 131072) ? keyofConstraintType : getLiteralTypeFromProperties(type, (noIndexSignatures ? 128 : 402653316) | (stringsOnly ? 0 : 296 | 12288), stringsOnly === keyofStringsOnly && !noIndexSignatures); + } + function getExtractStringType(type) { + if (keyofStringsOnly) { + return type; + } + var extractTypeAlias = getGlobalExtractSymbol(); + return extractTypeAlias ? getTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType; + } + function getIndexTypeOrString(type) { + var indexType = getExtractStringType(getIndexType(type)); + return indexType.flags & 131072 ? stringType : indexType; + } + function getTypeFromTypeOperatorNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + switch (node.operator) { + case 141: + links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); + break; + case 156: + links.resolvedType = node.type.kind === 153 ? getESSymbolLikeTypeForNode(ts6.walkUpParenthesizedTypes(node.parent)) : errorType; + break; + case 146: + links.resolvedType = getTypeFromTypeNode(node.type); + break; + default: + throw ts6.Debug.assertNever(node.operator); + } + } + return links.resolvedType; + } + function getTypeFromTemplateTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getTemplateLiteralType(__spreadArray([node.head.text], ts6.map(node.templateSpans, function(span) { + return span.literal.text; + }), true), ts6.map(node.templateSpans, function(span) { + return getTypeFromTypeNode(span.type); + })); + } + return links.resolvedType; + } + function getTemplateLiteralType(texts, types) { + var unionIndex = ts6.findIndex(types, function(t) { + return !!(t.flags & (131072 | 1048576)); + }); + if (unionIndex >= 0) { + return checkCrossProductUnion(types) ? mapType(types[unionIndex], function(t) { + return getTemplateLiteralType(texts, ts6.replaceElement(types, unionIndex, t)); + }) : errorType; + } + if (ts6.contains(types, wildcardType)) { + return wildcardType; + } + var newTypes = []; + var newTexts = []; + var text = texts[0]; + if (!addSpans(texts, types)) { + return stringType; + } + if (newTypes.length === 0) { + return getStringLiteralType(text); + } + newTexts.push(text); + if (ts6.every(newTexts, function(t) { + return t === ""; + })) { + if (ts6.every(newTypes, function(t) { + return !!(t.flags & 4); + })) { + return stringType; + } + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } + } + var id = "".concat(getTypeListId(newTypes), "|").concat(ts6.map(newTexts, function(t) { + return t.length; + }).join(","), "|").concat(newTexts.join("")); + var type = templateLiteralTypes.get(id); + if (!type) { + templateLiteralTypes.set(id, type = createTemplateLiteralType(newTexts, newTypes)); + } + return type; + function addSpans(texts2, types2) { + var isTextsArray = ts6.isArray(texts2); + for (var i = 0; i < types2.length; i++) { + var t = types2[i]; + var addText = isTextsArray ? texts2[i + 1] : texts2; + if (t.flags & (2944 | 65536 | 32768)) { + text += getTemplateStringForType(t) || ""; + text += addText; + if (!isTextsArray) + return true; + } else if (t.flags & 134217728) { + text += t.texts[0]; + if (!addSpans(t.texts, t.types)) + return false; + text += addText; + if (!isTextsArray) + return true; + } else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) { + newTypes.push(t); + newTexts.push(text); + text = addText; + } else if (t.flags & 2097152) { + var added = addSpans(texts2[i + 1], t.types); + if (!added) + return false; + } else if (isTextsArray) { + return false; + } + } + return true; + } + } + function getTemplateStringForType(type) { + return type.flags & 128 ? type.value : type.flags & 256 ? "" + type.value : type.flags & 2048 ? ts6.pseudoBigIntToString(type.value) : type.flags & (512 | 98304) ? type.intrinsicName : void 0; + } + function createTemplateLiteralType(texts, types) { + var type = createType( + 134217728 + /* TypeFlags.TemplateLiteral */ + ); + type.texts = texts; + type.types = types; + return type; + } + function getStringMappingType(symbol, type) { + return type.flags & (1048576 | 131072) ? mapType(type, function(t) { + return getStringMappingType(symbol, t); + }) : type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : ( + // Mapping> === Mapping + type.flags & 268435456 && symbol === type.symbol ? type : type.flags & (1 | 4 | 268435456) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : ( + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : type + ) + ); + } + function applyStringMapping(symbol, str) { + switch (intrinsicTypeKinds.get(symbol.escapedName)) { + case 0: + return str.toUpperCase(); + case 1: + return str.toLowerCase(); + case 2: + return str.charAt(0).toUpperCase() + str.slice(1); + case 3: + return str.charAt(0).toLowerCase() + str.slice(1); + } + return str; + } + function applyTemplateStringMapping(symbol, texts, types) { + switch (intrinsicTypeKinds.get(symbol.escapedName)) { + case 0: + return [texts.map(function(t) { + return t.toUpperCase(); + }), types.map(function(t) { + return getStringMappingType(symbol, t); + })]; + case 1: + return [texts.map(function(t) { + return t.toLowerCase(); + }), types.map(function(t) { + return getStringMappingType(symbol, t); + })]; + case 2: + return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toUpperCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types]; + case 3: + return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toLowerCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types]; + } + return [texts, types]; + } + function getStringMappingTypeForGenericType(symbol, type) { + var id = "".concat(getSymbolId(symbol), ",").concat(getTypeId(type)); + var result = stringMappingTypes.get(id); + if (!result) { + stringMappingTypes.set(id, result = createStringMappingType(symbol, type)); + } + return result; + } + function createStringMappingType(symbol, type) { + var result = createType( + 268435456 + /* TypeFlags.StringMapping */ + ); + result.symbol = symbol; + result.type = type; + return result; + } + function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) { + var type = createType( + 8388608 + /* TypeFlags.IndexedAccess */ + ); + type.objectType = objectType; + type.indexType = indexType; + type.accessFlags = accessFlags; + type.aliasSymbol = aliasSymbol; + type.aliasTypeArguments = aliasTypeArguments; + return type; + } + function isJSLiteralType(type) { + if (noImplicitAny) { + return false; + } + if (ts6.getObjectFlags(type) & 4096) { + return true; + } + if (type.flags & 1048576) { + return ts6.every(type.types, isJSLiteralType); + } + if (type.flags & 2097152) { + return ts6.some(type.types, isJSLiteralType); + } + if (type.flags & 465829888) { + var constraint = getResolvedBaseConstraint(type); + return constraint !== type && isJSLiteralType(constraint); + } + return false; + } + function getPropertyNameFromIndex(indexType, accessNode) { + return isTypeUsableAsPropertyName(indexType) ? getPropertyNameFromType(indexType) : accessNode && ts6.isPropertyName(accessNode) ? ( + // late bound names are handled in the first branch, so here we only need to handle normal names + ts6.getPropertyNameForPropertyNameNode(accessNode) + ) : void 0; + } + function isUncalledFunctionReference(node, symbol) { + if (symbol.flags & (16 | 8192)) { + var parent = ts6.findAncestor(node.parent, function(n) { + return !ts6.isAccessExpression(n); + }) || node.parent; + if (ts6.isCallLikeExpression(parent)) { + return ts6.isCallOrNewExpression(parent) && ts6.isIdentifier(node) && hasMatchingArgument(parent, node); + } + return ts6.every(symbol.declarations, function(d) { + return !ts6.isFunctionLike(d) || !!(ts6.getCombinedNodeFlags(d) & 268435456); + }); + } + return true; + } + function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { + var _a; + var accessExpression = accessNode && accessNode.kind === 209 ? accessNode : void 0; + var propName = accessNode && ts6.isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode); + if (propName !== void 0) { + if (accessFlags & 256) { + return getTypeOfPropertyOfContextualType(objectType, propName) || anyType; + } + var prop = getPropertyOfType(objectType, propName); + if (prop) { + if (accessFlags & 64 && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) { + var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : ts6.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode; + addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName); + } + if (accessExpression) { + markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol)); + if (isAssignmentToReadonlyEntity(accessExpression, prop, ts6.getAssignmentTargetKind(accessExpression))) { + error(accessExpression.argumentExpression, ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop)); + return void 0; + } + if (accessFlags & 8) { + getNodeLinks(accessNode).resolvedSymbol = prop; + } + if (isThisPropertyAccessInConstructor(accessExpression, prop)) { + return autoType; + } + } + var propType = getTypeOfSymbol(prop); + return accessExpression && ts6.getAssignmentTargetKind(accessExpression) !== 1 ? getFlowTypeOfReference(accessExpression, propType) : propType; + } + if (everyType(objectType, isTupleType) && ts6.isNumericLiteralName(propName)) { + var index = +propName; + if (accessNode && everyType(objectType, function(t) { + return !t.target.hasRestElement; + }) && !(accessFlags & 16)) { + var indexNode = getIndexNodeForAccessExpression(accessNode); + if (isTupleType(objectType)) { + if (index < 0) { + error(indexNode, ts6.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value); + return undefinedType; + } + error(indexNode, ts6.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts6.unescapeLeadingUnderscores(propName)); + } else { + error(indexNode, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, ts6.unescapeLeadingUnderscores(propName), typeToString(objectType)); + } + } + if (index >= 0) { + errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType)); + return mapType(objectType, function(t) { + var restType = getRestTypeOfTupleType(t) || undefinedType; + return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType; + }); + } + } + } + if (!(indexType.flags & 98304) && isTypeAssignableToKind( + indexType, + 402653316 | 296 | 12288 + /* TypeFlags.ESSymbolLike */ + )) { + if (objectType.flags & (1 | 131072)) { + return objectType; + } + var indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType); + if (indexInfo) { + if (accessFlags & 2 && indexInfo.keyType !== numberType) { + if (accessExpression) { + error(accessExpression, ts6.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType)); + } + return void 0; + } + if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind( + indexType, + 4 | 8 + /* TypeFlags.Number */ + )) { + var indexNode = getIndexNodeForAccessExpression(accessNode); + error(indexNode, ts6.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); + return accessFlags & 1 ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + } + errorIfWritingToReadonlyIndex(indexInfo); + if (accessFlags & 1 && !(objectType.symbol && objectType.symbol.flags & (256 | 128) && (indexType.symbol && indexType.flags & 1024 && getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; + } + if (indexType.flags & 131072) { + return neverType; + } + if (isJSLiteralType(objectType)) { + return anyType; + } + if (accessExpression && !isConstEnumObjectType(objectType)) { + if (isObjectLiteralType(objectType)) { + if (noImplicitAny && indexType.flags & (128 | 256)) { + diagnostics.add(ts6.createDiagnosticForNode(accessExpression, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType))); + return undefinedType; + } else if (indexType.flags & (8 | 4)) { + var types = ts6.map(objectType.properties, function(property) { + return getTypeOfSymbol(property); + }); + return getUnionType(ts6.append(types, undefinedType)); + } + } + if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418) { + error(accessExpression, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, ts6.unescapeLeadingUnderscores(propName), typeToString(objectType)); + } else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128)) { + if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) { + var typeName = typeToString(objectType); + error(accessExpression, ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + ts6.getTextOfNode(accessExpression.argumentExpression) + "]"); + } else if (getIndexTypeOfType(objectType, numberType)) { + error(accessExpression.argumentExpression, ts6.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); + } else { + var suggestion = void 0; + if (propName !== void 0 && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) { + if (suggestion !== void 0) { + error(accessExpression.argumentExpression, ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion); + } + } else { + var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType); + if (suggestion_1 !== void 0) { + error(accessExpression, ts6.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1); + } else { + var errorInfo = void 0; + if (indexType.flags & 1024) { + errorInfo = ts6.chainDiagnosticMessages( + /* details */ + void 0, + ts6.Diagnostics.Property_0_does_not_exist_on_type_1, + "[" + typeToString(indexType) + "]", + typeToString(objectType) + ); + } else if (indexType.flags & 8192) { + var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression); + errorInfo = ts6.chainDiagnosticMessages( + /* details */ + void 0, + ts6.Diagnostics.Property_0_does_not_exist_on_type_1, + "[" + symbolName_2 + "]", + typeToString(objectType) + ); + } else if (indexType.flags & 128) { + errorInfo = ts6.chainDiagnosticMessages( + /* details */ + void 0, + ts6.Diagnostics.Property_0_does_not_exist_on_type_1, + indexType.value, + typeToString(objectType) + ); + } else if (indexType.flags & 256) { + errorInfo = ts6.chainDiagnosticMessages( + /* details */ + void 0, + ts6.Diagnostics.Property_0_does_not_exist_on_type_1, + indexType.value, + typeToString(objectType) + ); + } else if (indexType.flags & (8 | 4)) { + errorInfo = ts6.chainDiagnosticMessages( + /* details */ + void 0, + ts6.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, + typeToString(indexType), + typeToString(objectType) + ); + } + errorInfo = ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType)); + diagnostics.add(ts6.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo)); + } + } + } + } + return void 0; + } + } + if (isJSLiteralType(objectType)) { + return anyType; + } + if (accessNode) { + var indexNode = getIndexNodeForAccessExpression(accessNode); + if (indexType.flags & (128 | 256)) { + error(indexNode, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); + } else if (indexType.flags & (4 | 8)) { + error(indexNode, ts6.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); + } else { + error(indexNode, ts6.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); + } + } + if (isTypeAny(indexType)) { + return indexType; + } + return void 0; + function errorIfWritingToReadonlyIndex(indexInfo2) { + if (indexInfo2 && indexInfo2.isReadonly && accessExpression && (ts6.isAssignmentTarget(accessExpression) || ts6.isDeleteTarget(accessExpression))) { + error(accessExpression, ts6.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + } + } + } + function getIndexNodeForAccessExpression(accessNode) { + return accessNode.kind === 209 ? accessNode.argumentExpression : accessNode.kind === 196 ? accessNode.indexType : accessNode.kind === 164 ? accessNode.expression : accessNode; + } + function isPatternLiteralPlaceholderType(type) { + return !!(type.flags & (1 | 4 | 8 | 64)) || isPatternLiteralType(type); + } + function isPatternLiteralType(type) { + return !!(type.flags & 134217728) && ts6.every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456) && isPatternLiteralPlaceholderType(type.type); + } + function isGenericType(type) { + return !!getGenericObjectFlags(type); + } + function isGenericObjectType(type) { + return !!(getGenericObjectFlags(type) & 4194304); + } + function isGenericIndexType(type) { + return !!(getGenericObjectFlags(type) & 8388608); + } + function getGenericObjectFlags(type) { + if (type.flags & 3145728) { + if (!(type.objectFlags & 2097152)) { + type.objectFlags |= 2097152 | ts6.reduceLeft(type.types, function(flags, t) { + return flags | getGenericObjectFlags(t); + }, 0); + } + return type.objectFlags & 12582912; + } + if (type.flags & 33554432) { + if (!(type.objectFlags & 2097152)) { + type.objectFlags |= 2097152 | getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); + } + return type.objectFlags & 12582912; + } + return (type.flags & 58982400 || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 : 0) | (type.flags & (58982400 | 4194304 | 134217728 | 268435456) && !isPatternLiteralType(type) ? 8388608 : 0); + } + function getSimplifiedType(type, writing) { + return type.flags & 8388608 ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 ? getSimplifiedConditionalType(type, writing) : type; + } + function distributeIndexOverObjectType(objectType, indexType, writing) { + if (objectType.flags & 1048576 || objectType.flags & 2097152 && !shouldDeferIndexType(objectType)) { + var types = ts6.map(objectType.types, function(t) { + return getSimplifiedType(getIndexedAccessType(t, indexType), writing); + }); + return objectType.flags & 2097152 || writing ? getIntersectionType(types) : getUnionType(types); + } + } + function distributeObjectOverIndexType(objectType, indexType, writing) { + if (indexType.flags & 1048576) { + var types = ts6.map(indexType.types, function(t) { + return getSimplifiedType(getIndexedAccessType(objectType, t), writing); + }); + return writing ? getIntersectionType(types) : getUnionType(types); + } + } + function getSimplifiedIndexedAccessType(type, writing) { + var cache = writing ? "simplifiedForWriting" : "simplifiedForReading"; + if (type[cache]) { + return type[cache] === circularConstraintType ? type : type[cache]; + } + type[cache] = circularConstraintType; + var objectType = getSimplifiedType(type.objectType, writing); + var indexType = getSimplifiedType(type.indexType, writing); + var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing); + if (distributedOverIndex) { + return type[cache] = distributedOverIndex; + } + if (!(indexType.flags & 465829888)) { + var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing); + if (distributedOverObject) { + return type[cache] = distributedOverObject; + } + } + if (isGenericTupleType(objectType) && indexType.flags & 296) { + var elementType = getElementTypeOfSliceOfTupleType( + objectType, + indexType.flags & 8 ? 0 : objectType.target.fixedLength, + /*endSkipCount*/ + 0, + writing + ); + if (elementType) { + return type[cache] = elementType; + } + } + if (isGenericMappedType(objectType)) { + var nameType = getNameTypeFromMappedType(objectType); + if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) { + return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function(t) { + return getSimplifiedType(t, writing); + }); + } + } + return type[cache] = type; + } + function getSimplifiedConditionalType(type, writing) { + var checkType = type.checkType; + var extendsType = type.extendsType; + var trueType2 = getTrueTypeFromConditionalType(type); + var falseType2 = getFalseTypeFromConditionalType(type); + if (falseType2.flags & 131072 && getActualTypeVariable(trueType2) === getActualTypeVariable(checkType)) { + if (checkType.flags & 1 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { + return getSimplifiedType(trueType2, writing); + } else if (isIntersectionEmpty(checkType, extendsType)) { + return neverType; + } + } else if (trueType2.flags & 131072 && getActualTypeVariable(falseType2) === getActualTypeVariable(checkType)) { + if (!(checkType.flags & 1) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { + return neverType; + } else if (checkType.flags & 1 || isIntersectionEmpty(checkType, extendsType)) { + return getSimplifiedType(falseType2, writing); + } + } + return type; + } + function isIntersectionEmpty(type1, type2) { + return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072); + } + function substituteIndexedMappedType(objectType, index) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]); + var templateMapper = combineTypeMappers(objectType.mapper, mapper); + return instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) { + if (accessFlags === void 0) { + accessFlags = 0; + } + return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType); + } + function indexTypeLessThan(indexType, limit) { + return everyType(indexType, function(t) { + if (t.flags & 384) { + var propName = getPropertyNameFromType(t); + if (ts6.isNumericLiteralName(propName)) { + var index = +propName; + return index >= 0 && index < limit; + } + } + return false; + }); + } + function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) { + if (accessFlags === void 0) { + accessFlags = 0; + } + if (objectType === wildcardType || indexType === wildcardType) { + return wildcardType; + } + if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304) && isTypeAssignableToKind( + indexType, + 4 | 8 + /* TypeFlags.Number */ + )) { + indexType = stringType; + } + if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32) + accessFlags |= 1; + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { + if (objectType.flags & 3) { + return objectType; + } + var persistentAccessFlags = accessFlags & 1; + var id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments)); + } + return type; + } + var apparentObjectType = getReducedApparentType(objectType); + if (indexType.flags & 1048576 && !(indexType.flags & 16)) { + var propTypes = []; + var wasMissingProp = false; + for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ? 128 : 0)); + if (propType) { + propTypes.push(propType); + } else if (!accessNode) { + return void 0; + } else { + wasMissingProp = true; + } + } + if (wasMissingProp) { + return void 0; + } + return accessFlags & 4 ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1, aliasSymbol, aliasTypeArguments); + } + return getPropertyTypeForIndexType( + objectType, + apparentObjectType, + indexType, + indexType, + accessNode, + accessFlags | 8 | 64 + /* AccessFlags.ReportDeprecated */ + ); + } + function getTypeFromIndexedAccessTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var objectType = getTypeFromTypeNode(node.objectType); + var indexType = getTypeFromTypeNode(node.indexType); + var potentialAlias = getAliasSymbolForTypeNode(node); + links.resolvedType = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); + } + return links.resolvedType; + } + function getTypeFromMappedTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = createObjectType(32, node.symbol); + type.declaration = node; + type.aliasSymbol = getAliasSymbolForTypeNode(node); + type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(type.aliasSymbol); + links.resolvedType = type; + getConstraintTypeFromMappedType(type); + } + return links.resolvedType; + } + function getActualTypeVariable(type) { + if (type.flags & 33554432) { + return type.baseType; + } + if (type.flags & 8388608 && (type.objectType.flags & 33554432 || type.indexType.flags & 33554432)) { + return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType)); + } + return type; + } + function maybeCloneTypeParameter(p) { + var constraint = getConstraintOfTypeParameter(p); + return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p; + } + function isTypicalNondistributiveConditional(root) { + return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType); + } + function isSingletonTupleType(node) { + return ts6.isTupleTypeNode(node) && ts6.length(node.elements) === 1 && !ts6.isOptionalTypeNode(node.elements[0]) && !ts6.isRestTypeNode(node.elements[0]) && !(ts6.isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken)); + } + function unwrapNondistributiveConditionalTuple(root, type) { + return isTypicalNondistributiveConditional(root) && isTupleType(type) ? getTypeArguments(type)[0] : type; + } + function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) { + var result; + var extraTypes; + var tailCount = 0; + while (true) { + if (tailCount === 1e3) { + error(currentNode, ts6.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); + result = errorType; + break; + } + var isUnwrapped = isTypicalNondistributiveConditional(root); + var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); + var checkTypeInstantiable = isGenericType(checkType); + var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); + if (checkType === wildcardType || extendsType === wildcardType) { + return wildcardType; + } + var combinedMapper = void 0; + if (root.inferTypeParameters) { + var freshParams = ts6.sameMap(root.inferTypeParameters, maybeCloneTypeParameter); + var freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : void 0; + var context = createInferenceContext( + freshParams, + /*signature*/ + void 0, + 0 + /* InferenceFlags.None */ + ); + if (freshMapper) { + var freshCombinedMapper = combineTypeMappers(mapper, freshMapper); + for (var _i = 0, freshParams_1 = freshParams; _i < freshParams_1.length; _i++) { + var p = freshParams_1[_i]; + if (root.inferTypeParameters.indexOf(p) === -1) { + p.mapper = freshCombinedMapper; + } + } + } + if (!checkTypeInstantiable) { + inferTypes( + context.inferences, + checkType, + instantiateType(extendsType, freshMapper), + 512 | 1024 + /* InferencePriority.AlwaysStrict */ + ); + } + var innerMapper = combineTypeMappers(freshMapper, context.mapper); + combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper; + } + var inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType; + if (!checkTypeInstantiable && !isGenericType(inferredExtendsType)) { + if (!(inferredExtendsType.flags & 3) && (checkType.flags & 1 && !isUnwrapped || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) { + if (checkType.flags & 1 && !isUnwrapped) { + (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper)); + } + var falseType_1 = getTypeFromTypeNode(root.node.falseType); + if (falseType_1.flags & 16777216) { + var newRoot = falseType_1.root; + if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { + root = newRoot; + continue; + } + if (canTailRecurse(falseType_1, mapper)) { + continue; + } + } + result = instantiateType(falseType_1, mapper); + break; + } + if (inferredExtendsType.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) { + var trueType_1 = getTypeFromTypeNode(root.node.trueType); + var trueMapper = combinedMapper || mapper; + if (canTailRecurse(trueType_1, trueMapper)) { + continue; + } + result = instantiateType(trueType_1, trueMapper); + break; + } + } + result = createType( + 16777216 + /* TypeFlags.Conditional */ + ); + result.root = root; + result.checkType = instantiateType(root.checkType, mapper); + result.extendsType = instantiateType(root.extendsType, mapper); + result.mapper = mapper; + result.combinedMapper = combinedMapper; + result.aliasSymbol = aliasSymbol || root.aliasSymbol; + result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); + break; + } + return extraTypes ? getUnionType(ts6.append(extraTypes, result)) : result; + function canTailRecurse(newType, newMapper) { + if (newType.flags & 16777216 && newMapper) { + var newRoot2 = newType.root; + if (newRoot2.outerTypeParameters) { + var typeParamMapper_1 = combineTypeMappers(newType.mapper, newMapper); + var typeArguments = ts6.map(newRoot2.outerTypeParameters, function(t) { + return getMappedType(t, typeParamMapper_1); + }); + var newRootMapper = createTypeMapper(newRoot2.outerTypeParameters, typeArguments); + var newCheckType = newRoot2.isDistributive ? getMappedType(newRoot2.checkType, newRootMapper) : void 0; + if (!newCheckType || newCheckType === newRoot2.checkType || !(newCheckType.flags & (1048576 | 131072))) { + root = newRoot2; + mapper = newRootMapper; + aliasSymbol = void 0; + aliasTypeArguments = void 0; + if (newRoot2.aliasSymbol) { + tailCount++; + } + return true; + } + } + } + return false; + } + } + function getTrueTypeFromConditionalType(type) { + return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(getTypeFromTypeNode(type.root.node.trueType), type.mapper)); + } + function getFalseTypeFromConditionalType(type) { + return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(getTypeFromTypeNode(type.root.node.falseType), type.mapper)); + } + function getInferredTrueTypeFromConditionalType(type) { + return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(getTypeFromTypeNode(type.root.node.trueType), type.combinedMapper) : getTrueTypeFromConditionalType(type)); + } + function getInferTypeParameters(node) { + var result; + if (node.locals) { + node.locals.forEach(function(symbol) { + if (symbol.flags & 262144) { + result = ts6.append(result, getDeclaredTypeOfSymbol(symbol)); + } + }); + } + return result; + } + function isDistributionDependent(root) { + return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) || isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType)); + } + function getTypeFromConditionalTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var checkType = getTypeFromTypeNode(node.checkType); + var aliasSymbol = getAliasSymbolForTypeNode(node); + var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); + var allOuterTypeParameters = getOuterTypeParameters( + node, + /*includeThisTypes*/ + true + ); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts6.filter(allOuterTypeParameters, function(tp) { + return isTypeParameterPossiblyReferenced(tp, node); + }); + var root = { + node, + checkType, + extendsType: getTypeFromTypeNode(node.extendsType), + isDistributive: !!(checkType.flags & 262144), + inferTypeParameters: getInferTypeParameters(node), + outerTypeParameters, + instantiations: void 0, + aliasSymbol, + aliasTypeArguments + }; + links.resolvedType = getConditionalType( + root, + /*mapper*/ + void 0 + ); + if (outerTypeParameters) { + root.instantiations = new ts6.Map(); + root.instantiations.set(getTypeListId(outerTypeParameters), links.resolvedType); + } + } + return links.resolvedType; + } + function getTypeFromInferTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)); + } + return links.resolvedType; + } + function getIdentifierChain(node) { + if (ts6.isIdentifier(node)) { + return [node]; + } else { + return ts6.append(getIdentifierChain(node.left), node.right); + } + } + function getTypeFromImportTypeNode(node) { + var _a; + var links = getNodeLinks(node); + if (!links.resolvedType) { + if (node.isTypeOf && node.typeArguments) { + error(node, ts6.Diagnostics.Type_arguments_cannot_be_used_here); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = errorType; + } + if (!ts6.isLiteralImportTypeNode(node)) { + error(node.argument, ts6.Diagnostics.String_literal_expected); + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = errorType; + } + var targetMeaning = node.isTypeOf ? 111551 : node.flags & 8388608 ? 111551 | 788968 : 788968; + var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal); + if (!innerModuleSymbol) { + links.resolvedSymbol = unknownSymbol; + return links.resolvedType = errorType; + } + var isExportEquals = !!((_a = innerModuleSymbol.exports) === null || _a === void 0 ? void 0 : _a.get( + "export=" + /* InternalSymbolName.ExportEquals */ + )); + var moduleSymbol = resolveExternalModuleSymbol( + innerModuleSymbol, + /*dontResolveAlias*/ + false + ); + if (!ts6.nodeIsMissing(node.qualifier)) { + var nameStack = getIdentifierChain(node.qualifier); + var currentNamespace = moduleSymbol; + var current = void 0; + while (current = nameStack.shift()) { + var meaning = nameStack.length ? 1920 : targetMeaning; + var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace)); + var symbolFromVariable = node.isTypeOf || ts6.isInJSFile(node) && isExportEquals ? getPropertyOfType( + getTypeOfSymbol(mergedResolvedSymbol), + current.escapedText, + /*skipObjectFunctionPropertyAugment*/ + false, + /*includeTypeOnlyMembers*/ + true + ) : void 0; + var symbolFromModule = node.isTypeOf ? void 0 : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning); + var next = symbolFromModule !== null && symbolFromModule !== void 0 ? symbolFromModule : symbolFromVariable; + if (!next) { + error(current, ts6.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts6.declarationNameToString(current)); + return links.resolvedType = errorType; + } + getNodeLinks(current).resolvedSymbol = next; + getNodeLinks(current.parent).resolvedSymbol = next; + currentNamespace = next; + } + links.resolvedType = resolveImportSymbolType(node, links, currentNamespace, targetMeaning); + } else { + if (moduleSymbol.flags & targetMeaning) { + links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); + } else { + var errorMessage = targetMeaning === 111551 ? ts6.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : ts6.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0; + error(node, errorMessage, node.argument.literal.text); + links.resolvedSymbol = unknownSymbol; + links.resolvedType = errorType; + } + } + } + return links.resolvedType; + } + function resolveImportSymbolType(node, links, symbol, meaning) { + var resolvedSymbol = resolveSymbol(symbol); + links.resolvedSymbol = resolvedSymbol; + if (meaning === 111551) { + return getTypeOfSymbol(symbol); + } else { + return getTypeReferenceType(node, resolvedSymbol); + } + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var aliasSymbol = getAliasSymbolForTypeNode(node); + if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) { + links.resolvedType = emptyTypeLiteralType; + } else { + var type = createObjectType(16, node.symbol); + type.aliasSymbol = aliasSymbol; + type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); + if (ts6.isJSDocTypeLiteral(node) && node.isArrayType) { + type = createArrayType(type); + } + links.resolvedType = type; + } + } + return links.resolvedType; + } + function getAliasSymbolForTypeNode(node) { + var host2 = node.parent; + while (ts6.isParenthesizedTypeNode(host2) || ts6.isJSDocTypeExpression(host2) || ts6.isTypeOperatorNode(host2) && host2.operator === 146) { + host2 = host2.parent; + } + return ts6.isTypeAlias(host2) ? getSymbolOfNode(host2) : void 0; + } + function getTypeArgumentsForAliasSymbol(symbol) { + return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : void 0; + } + function isNonGenericObjectType(type) { + return !!(type.flags & 524288) && !isGenericMappedType(type); + } + function isEmptyObjectTypeOrSpreadsIntoEmptyObject(type) { + return isEmptyObjectType(type) || !!(type.flags & (65536 | 32768 | 528 | 296 | 2112 | 402653316 | 1056 | 67108864 | 4194304)); + } + function tryMergeUnionOfObjectTypeAndEmptyObject(type, readonly) { + if (!(type.flags & 1048576)) { + return type; + } + if (ts6.every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) { + return ts6.find(type.types, isEmptyObjectType) || emptyObjectType; + } + var firstType = ts6.find(type.types, function(t) { + return !isEmptyObjectTypeOrSpreadsIntoEmptyObject(t); + }); + if (!firstType) { + return type; + } + var secondType = ts6.find(type.types, function(t) { + return t !== firstType && !isEmptyObjectTypeOrSpreadsIntoEmptyObject(t); + }); + if (secondType) { + return type; + } + return getAnonymousPartialType(firstType); + function getAnonymousPartialType(type2) { + var members = ts6.createSymbolTable(); + for (var _i = 0, _a = getPropertiesOfType(type2); _i < _a.length; _i++) { + var prop = _a[_i]; + if (ts6.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16)) { + } else if (isSpreadableProperty(prop)) { + var isSetonlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); + var flags = 4 | 16777216; + var result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 : 0)); + result.type = isSetonlyAccessor ? undefinedType : addOptionality( + getTypeOfSymbol(prop), + /*isProperty*/ + true + ); + result.declarations = prop.declarations; + result.nameType = getSymbolLinks(prop).nameType; + result.syntheticOrigin = prop; + members.set(prop.escapedName, result); + } + } + var spread = createAnonymousType(type2.symbol, members, ts6.emptyArray, ts6.emptyArray, getIndexInfosOfType(type2)); + spread.objectFlags |= 128 | 131072; + return spread; + } + } + function getSpreadType(left, right, symbol, objectFlags, readonly) { + if (left.flags & 1 || right.flags & 1) { + return anyType; + } + if (left.flags & 2 || right.flags & 2) { + return unknownType; + } + if (left.flags & 131072) { + return right; + } + if (right.flags & 131072) { + return left; + } + left = tryMergeUnionOfObjectTypeAndEmptyObject(left, readonly); + if (left.flags & 1048576) { + return checkCrossProductUnion([left, right]) ? mapType(left, function(t) { + return getSpreadType(t, right, symbol, objectFlags, readonly); + }) : errorType; + } + right = tryMergeUnionOfObjectTypeAndEmptyObject(right, readonly); + if (right.flags & 1048576) { + return checkCrossProductUnion([left, right]) ? mapType(right, function(t) { + return getSpreadType(left, t, symbol, objectFlags, readonly); + }) : errorType; + } + if (right.flags & (528 | 296 | 2112 | 402653316 | 1056 | 67108864 | 4194304)) { + return left; + } + if (isGenericObjectType(left) || isGenericObjectType(right)) { + if (isEmptyObjectType(left)) { + return right; + } + if (left.flags & 2097152) { + var types = left.types; + var lastLeft = types[types.length - 1]; + if (isNonGenericObjectType(lastLeft) && isNonGenericObjectType(right)) { + return getIntersectionType(ts6.concatenate(types.slice(0, types.length - 1), [getSpreadType(lastLeft, right, symbol, objectFlags, readonly)])); + } + } + return getIntersectionType([left, right]); + } + var members = ts6.createSymbolTable(); + var skippedPrivateMembers = new ts6.Set(); + var indexInfos = left === emptyObjectType ? getIndexInfosOfType(right) : getUnionIndexInfos([left, right]); + for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { + var rightProp = _a[_i]; + if (ts6.getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { + skippedPrivateMembers.add(rightProp.escapedName); + } else if (isSpreadableProperty(rightProp)) { + members.set(rightProp.escapedName, getSpreadSymbol(rightProp, readonly)); + } + } + for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { + var leftProp = _c[_b]; + if (skippedPrivateMembers.has(leftProp.escapedName) || !isSpreadableProperty(leftProp)) { + continue; + } + if (members.has(leftProp.escapedName)) { + var rightProp = members.get(leftProp.escapedName); + var rightType = getTypeOfSymbol(rightProp); + if (rightProp.flags & 16777216) { + var declarations = ts6.concatenate(leftProp.declarations, rightProp.declarations); + var flags = 4 | leftProp.flags & 16777216; + var result = createSymbol(flags, leftProp.escapedName); + result.type = getUnionType( + [getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], + 2 + /* UnionReduction.Subtype */ + ); + result.leftSpread = leftProp; + result.rightSpread = rightProp; + result.declarations = declarations; + result.nameType = getSymbolLinks(leftProp).nameType; + members.set(leftProp.escapedName, result); + } + } else { + members.set(leftProp.escapedName, getSpreadSymbol(leftProp, readonly)); + } + } + var spread = createAnonymousType(symbol, members, ts6.emptyArray, ts6.emptyArray, ts6.sameMap(indexInfos, function(info) { + return getIndexInfoWithReadonly(info, readonly); + })); + spread.objectFlags |= 128 | 131072 | 2097152 | objectFlags; + return spread; + } + function isSpreadableProperty(prop) { + var _a; + return !ts6.some(prop.declarations, ts6.isPrivateIdentifierClassElementDeclaration) && (!(prop.flags & (8192 | 32768 | 65536)) || !((_a = prop.declarations) === null || _a === void 0 ? void 0 : _a.some(function(decl) { + return ts6.isClassLike(decl.parent); + }))); + } + function getSpreadSymbol(prop, readonly) { + var isSetonlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); + if (!isSetonlyAccessor && readonly === isReadonlySymbol(prop)) { + return prop; + } + var flags = 4 | prop.flags & 16777216; + var result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 : 0)); + result.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop); + result.declarations = prop.declarations; + result.nameType = getSymbolLinks(prop).nameType; + result.syntheticOrigin = prop; + return result; + } + function getIndexInfoWithReadonly(info, readonly) { + return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info; + } + function createLiteralType(flags, value, symbol, regularType) { + var type = createType(flags); + type.symbol = symbol; + type.value = value; + type.regularType = regularType || type; + return type; + } + function getFreshTypeOfLiteralType(type) { + if (type.flags & 2944) { + if (!type.freshType) { + var freshType = createLiteralType(type.flags, type.value, type.symbol, type); + freshType.freshType = freshType; + type.freshType = freshType; + } + return type.freshType; + } + return type; + } + function getRegularTypeOfLiteralType(type) { + return type.flags & 2944 ? type.regularType : type.flags & 1048576 ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type; + } + function isFreshLiteralType(type) { + return !!(type.flags & 2944) && type.freshType === type; + } + function getStringLiteralType(value) { + var type; + return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(128, value)), type); + } + function getNumberLiteralType(value) { + var type; + return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(256, value)), type); + } + function getBigIntLiteralType(value) { + var type; + var key = ts6.pseudoBigIntToString(value); + return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(2048, value)), type); + } + function getEnumLiteralType(value, enumId, symbol) { + var type; + var qualifier = typeof value === "string" ? "@" : "#"; + var key = enumId + qualifier + value; + var flags = 1024 | (typeof value === "string" ? 128 : 256); + return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type); + } + function getTypeFromLiteralTypeNode(node) { + if (node.literal.kind === 104) { + return nullType; + } + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal)); + } + return links.resolvedType; + } + function createUniqueESSymbolType(symbol) { + var type = createType( + 8192 + /* TypeFlags.UniqueESSymbol */ + ); + type.symbol = symbol; + type.escapedName = "__@".concat(type.symbol.escapedName, "@").concat(getSymbolId(type.symbol)); + return type; + } + function getESSymbolLikeTypeForNode(node) { + if (ts6.isValidESSymbolDeclaration(node)) { + var symbol = ts6.isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node); + if (symbol) { + var links = getSymbolLinks(symbol); + return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol)); + } + } + return esSymbolType; + } + function getThisType(node) { + var container = ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + var parent = container && container.parent; + if (parent && (ts6.isClassLike(parent) || parent.kind === 261)) { + if (!ts6.isStatic(container) && (!ts6.isConstructorDeclaration(container) || ts6.isNodeDescendantOf(node, container.body))) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + if (parent && ts6.isObjectLiteralExpression(parent) && ts6.isBinaryExpression(parent.parent) && ts6.getAssignmentDeclarationKind(parent.parent) === 6) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent.parent.left).parent).thisType; + } + var host2 = node.flags & 8388608 ? ts6.getHostSignatureFromJSDoc(node) : void 0; + if (host2 && ts6.isFunctionExpression(host2) && ts6.isBinaryExpression(host2.parent) && ts6.getAssignmentDeclarationKind(host2.parent) === 3) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host2.parent.left).parent).thisType; + } + if (isJSConstructor(container) && ts6.isNodeDescendantOf(node, container.body)) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(container)).thisType; + } + error(node, ts6.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return errorType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } + function getTypeFromRestTypeNode(node) { + return getTypeFromTypeNode(getArrayElementTypeNode(node.type) || node.type); + } + function getArrayElementTypeNode(node) { + switch (node.kind) { + case 193: + return getArrayElementTypeNode(node.type); + case 186: + if (node.elements.length === 1) { + node = node.elements[0]; + if (node.kind === 188 || node.kind === 199 && node.dotDotDotToken) { + return getArrayElementTypeNode(node.type); + } + } + break; + case 185: + return node.elementType; + } + return void 0; + } + function getTypeFromNamedTupleTypeNode(node) { + var links = getNodeLinks(node); + return links.resolvedType || (links.resolvedType = node.dotDotDotToken ? getTypeFromRestTypeNode(node) : addOptionality( + getTypeFromTypeNode(node.type), + /*isProperty*/ + true, + !!node.questionToken + )); + } + function getTypeFromTypeNode(node) { + return getConditionalFlowTypeOfType(getTypeFromTypeNodeWorker(node), node); + } + function getTypeFromTypeNodeWorker(node) { + switch (node.kind) { + case 131: + case 315: + case 316: + return anyType; + case 157: + return unknownType; + case 152: + return stringType; + case 148: + return numberType; + case 160: + return bigintType; + case 134: + return booleanType; + case 153: + return esSymbolType; + case 114: + return voidType; + case 155: + return undefinedType; + case 104: + return nullType; + case 144: + return neverType; + case 149: + return node.flags & 262144 && !noImplicitAny ? anyType : nonPrimitiveType; + case 139: + return intrinsicMarkerType; + case 194: + case 108: + return getTypeFromThisTypeNode(node); + case 198: + return getTypeFromLiteralTypeNode(node); + case 180: + return getTypeFromTypeReference(node); + case 179: + return node.assertsModifier ? voidType : booleanType; + case 230: + return getTypeFromTypeReference(node); + case 183: + return getTypeFromTypeQueryNode(node); + case 185: + case 186: + return getTypeFromArrayOrTupleTypeNode(node); + case 187: + return getTypeFromOptionalTypeNode(node); + case 189: + return getTypeFromUnionTypeNode(node); + case 190: + return getTypeFromIntersectionTypeNode(node); + case 317: + return getTypeFromJSDocNullableTypeNode(node); + case 319: + return addOptionality(getTypeFromTypeNode(node.type)); + case 199: + return getTypeFromNamedTupleTypeNode(node); + case 193: + case 318: + case 312: + return getTypeFromTypeNode(node.type); + case 188: + return getTypeFromRestTypeNode(node); + case 321: + return getTypeFromJSDocVariadicType(node); + case 181: + case 182: + case 184: + case 325: + case 320: + case 326: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 195: + return getTypeFromTypeOperatorNode(node); + case 196: + return getTypeFromIndexedAccessTypeNode(node); + case 197: + return getTypeFromMappedTypeNode(node); + case 191: + return getTypeFromConditionalTypeNode(node); + case 192: + return getTypeFromInferTypeNode(node); + case 200: + return getTypeFromTemplateTypeNode(node); + case 202: + return getTypeFromImportTypeNode(node); + case 79: + case 163: + case 208: + var symbol = getSymbolAtLocation(node); + return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; + default: + return errorType; + } + } + function instantiateList(items, mapper, instantiator) { + if (items && items.length) { + for (var i = 0; i < items.length; i++) { + var item = items[i]; + var mapped = instantiator(item, mapper); + if (item !== mapped) { + var result = i === 0 ? [] : items.slice(0, i); + result.push(mapped); + for (i++; i < items.length; i++) { + result.push(instantiator(items[i], mapper)); + } + return result; + } + } + } + return items; + } + function instantiateTypes(types, mapper) { + return instantiateList(types, mapper, instantiateType); + } + function instantiateSignatures(signatures, mapper) { + return instantiateList(signatures, mapper, instantiateSignature); + } + function instantiateIndexInfos(indexInfos, mapper) { + return instantiateList(indexInfos, mapper, instantiateIndexInfo); + } + function createTypeMapper(sources, targets) { + return sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : makeArrayTypeMapper(sources, targets); + } + function getMappedType(type, mapper) { + switch (mapper.kind) { + case 0: + return type === mapper.source ? mapper.target : type; + case 1: { + var sources = mapper.sources; + var targets = mapper.targets; + for (var i = 0; i < sources.length; i++) { + if (type === sources[i]) { + return targets ? targets[i] : anyType; + } + } + return type; + } + case 2: { + var sources = mapper.sources; + var targets = mapper.targets; + for (var i = 0; i < sources.length; i++) { + if (type === sources[i]) { + return targets[i](); + } + } + return type; + } + case 3: + return mapper.func(type); + case 4: + case 5: + var t1 = getMappedType(type, mapper.mapper1); + return t1 !== type && mapper.kind === 4 ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2); + } + } + function makeUnaryTypeMapper(source, target) { + return ts6.Debug.attachDebugPrototypeIfDebug({ kind: 0, source, target }); + } + function makeArrayTypeMapper(sources, targets) { + return ts6.Debug.attachDebugPrototypeIfDebug({ kind: 1, sources, targets }); + } + function makeFunctionTypeMapper(func, debugInfo) { + return ts6.Debug.attachDebugPrototypeIfDebug({ kind: 3, func, debugInfo: ts6.Debug.isDebugging ? debugInfo : void 0 }); + } + function makeDeferredTypeMapper(sources, targets) { + return ts6.Debug.attachDebugPrototypeIfDebug({ kind: 2, sources, targets }); + } + function makeCompositeTypeMapper(kind, mapper1, mapper2) { + return ts6.Debug.attachDebugPrototypeIfDebug({ kind, mapper1, mapper2 }); + } + function createTypeEraser(sources) { + return createTypeMapper( + sources, + /*targets*/ + void 0 + ); + } + function createBackreferenceMapper(context, index) { + var forwardInferences = context.inferences.slice(index); + return createTypeMapper(ts6.map(forwardInferences, function(i) { + return i.typeParameter; + }), ts6.map(forwardInferences, function() { + return unknownType; + })); + } + function combineTypeMappers(mapper1, mapper2) { + return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2; + } + function mergeTypeMappers(mapper1, mapper2) { + return mapper1 ? makeCompositeTypeMapper(5, mapper1, mapper2) : mapper2; + } + function prependTypeMapping(source, target, mapper) { + return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, makeUnaryTypeMapper(source, target), mapper); + } + function appendTypeMapping(mapper, source, target) { + return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, mapper, makeUnaryTypeMapper(source, target)); + } + function getRestrictiveTypeParameter(tp) { + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); + } + function cloneTypeParameter(typeParameter) { + var result = createTypeParameter(typeParameter.symbol); + result.target = typeParameter; + return result; + } + function instantiateTypePredicate(predicate, mapper) { + return createTypePredicate(predicate.kind, predicate.parameterName, predicate.parameterIndex, instantiateType(predicate.type, mapper)); + } + function instantiateSignature(signature, mapper, eraseTypeParameters) { + var freshTypeParameters; + if (signature.typeParameters && !eraseTypeParameters) { + freshTypeParameters = ts6.map(signature.typeParameters, cloneTypeParameter); + mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) { + var tp = freshTypeParameters_1[_i]; + tp.mapper = mapper; + } + } + var result = createSignature( + signature.declaration, + freshTypeParameters, + signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), + instantiateList(signature.parameters, mapper, instantiateSymbol), + /*resolvedReturnType*/ + void 0, + /*resolvedTypePredicate*/ + void 0, + signature.minArgumentCount, + signature.flags & 39 + /* SignatureFlags.PropagatingFlags */ + ); + result.target = signature; + result.mapper = mapper; + return result; + } + function instantiateSymbol(symbol, mapper) { + var links = getSymbolLinks(symbol); + if (links.type && !couldContainTypeVariables(links.type)) { + return symbol; + } + if (ts6.getCheckFlags(symbol) & 1) { + symbol = links.target; + mapper = combineTypeMappers(links.mapper, mapper); + } + var result = createSymbol(symbol.flags, symbol.escapedName, 1 | ts6.getCheckFlags(symbol) & (8 | 4096 | 16384 | 32768)); + result.declarations = symbol.declarations; + result.parent = symbol.parent; + result.target = symbol; + result.mapper = mapper; + if (symbol.valueDeclaration) { + result.valueDeclaration = symbol.valueDeclaration; + } + if (links.nameType) { + result.nameType = links.nameType; + } + return result; + } + function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) { + var declaration = type.objectFlags & 4 ? type.node : type.objectFlags & 8388608 ? type.node : type.symbol.declarations[0]; + var links = getNodeLinks(declaration); + var target = type.objectFlags & 4 ? links.resolvedType : type.objectFlags & 64 ? type.target : type; + var typeParameters = links.outerTypeParameters; + if (!typeParameters) { + var outerTypeParameters = getOuterTypeParameters( + declaration, + /*includeThisTypes*/ + true + ); + if (isJSConstructor(declaration)) { + var templateTagParameters = getTypeParametersFromDeclaration(declaration); + outerTypeParameters = ts6.addRange(outerTypeParameters, templateTagParameters); + } + typeParameters = outerTypeParameters || ts6.emptyArray; + var allDeclarations_1 = type.objectFlags & (4 | 8388608) ? [declaration] : type.symbol.declarations; + typeParameters = (target.objectFlags & (4 | 8388608) || target.symbol.flags & 8192 || target.symbol.flags & 2048) && !target.aliasTypeArguments ? ts6.filter(typeParameters, function(tp) { + return ts6.some(allDeclarations_1, function(d) { + return isTypeParameterPossiblyReferenced(tp, d); + }); + }) : typeParameters; + links.outerTypeParameters = typeParameters; + } + if (typeParameters.length) { + var combinedMapper_1 = combineTypeMappers(type.mapper, mapper); + var typeArguments = ts6.map(typeParameters, function(t) { + return getMappedType(t, combinedMapper_1); + }); + var newAliasSymbol = aliasSymbol || type.aliasSymbol; + var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); + var id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments); + if (!target.instantiations) { + target.instantiations = new ts6.Map(); + target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target); + } + var result = target.instantiations.get(id); + if (!result) { + var newMapper = createTypeMapper(typeParameters, typeArguments); + result = target.objectFlags & 4 ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); + target.instantiations.set(id, result); + } + return result; + } + return type; + } + function maybeTypeParameterReference(node) { + return !(node.parent.kind === 180 && node.parent.typeArguments && node === node.parent.typeName || node.parent.kind === 202 && node.parent.typeArguments && node === node.parent.qualifier); + } + function isTypeParameterPossiblyReferenced(tp, node) { + if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { + var container = tp.symbol.declarations[0].parent; + for (var n = node; n !== container; n = n.parent) { + if (!n || n.kind === 238 || n.kind === 191 && ts6.forEachChild(n.extendsType, containsReference)) { + return true; + } + } + return containsReference(node); + } + return true; + function containsReference(node2) { + switch (node2.kind) { + case 194: + return !!tp.isThisType; + case 79: + return !tp.isThisType && ts6.isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp; + case 183: + var entityName = node2.exprName; + var firstIdentifier = ts6.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; + var tpScope_1; + if (tpDeclaration.kind === 165) { + tpScope_1 = tpDeclaration.parent; + } else if (tp.isThisType) { + tpScope_1 = tpDeclaration; + } else { + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts6.some(firstIdentifierSymbol.declarations, function(idDecl) { + return ts6.isNodeDescendantOf(idDecl, tpScope_1); + }) || ts6.some(node2.typeArguments, containsReference); + } + return true; + case 171: + case 170: + return !node2.type && !!node2.body || ts6.some(node2.typeParameters, containsReference) || ts6.some(node2.parameters, containsReference) || !!node2.type && containsReference(node2.type); + } + return !!ts6.forEachChild(node2, containsReference); + } + } + function getHomomorphicTypeVariable(type) { + var constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & 4194304) { + var typeVariable = getActualTypeVariable(constraintType.type); + if (typeVariable.flags & 262144) { + return typeVariable; + } + } + return void 0; + } + function instantiateMappedType(type, mapper, aliasSymbol, aliasTypeArguments) { + var typeVariable = getHomomorphicTypeVariable(type); + if (typeVariable) { + var mappedTypeVariable = instantiateType(typeVariable, mapper); + if (typeVariable !== mappedTypeVariable) { + return mapTypeWithAlias(getReducedType(mappedTypeVariable), function(t) { + if (t.flags & (3 | 58982400 | 524288 | 2097152) && t !== wildcardType && !isErrorType(t)) { + if (!type.declaration.nameType) { + var constraint = void 0; + if (isArrayType(t) || t.flags & 1 && findResolutionCycleStartIndex( + typeVariable, + 4 + /* TypeSystemPropertyName.ImmediateBaseConstraint */ + ) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) { + return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper)); + } + if (isGenericTupleType(t)) { + return instantiateMappedGenericTupleType(t, type, typeVariable, mapper); + } + if (isTupleType(t)) { + return instantiateMappedTupleType(t, type, prependTypeMapping(typeVariable, t, mapper)); + } + } + return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper)); + } + return t; + }, aliasSymbol, aliasTypeArguments); + } + } + return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments); + } + function getModifiedReadonlyState(state, modifiers) { + return modifiers & 1 ? true : modifiers & 2 ? false : state; + } + function instantiateMappedGenericTupleType(tupleType, mappedType, typeVariable, mapper) { + var elementFlags = tupleType.target.elementFlags; + var elementTypes = ts6.map(getTypeArguments(tupleType), function(t, i) { + var singleton = elementFlags[i] & 8 ? t : elementFlags[i] & 4 ? createArrayType(t) : createTupleType([t], [elementFlags[i]]); + return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper)); + }); + var newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType)); + return createTupleType(elementTypes, ts6.map(elementTypes, function(_) { + return 8; + }), newReadonly); + } + function instantiateMappedArrayType(arrayType, mappedType, mapper) { + var elementType = instantiateMappedTypeTemplate( + mappedType, + numberType, + /*isOptional*/ + true, + mapper + ); + return isErrorType(elementType) ? errorType : createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType))); + } + function instantiateMappedTupleType(tupleType, mappedType, mapper) { + var elementFlags = tupleType.target.elementFlags; + var elementTypes = ts6.map(getTypeArguments(tupleType), function(_, i) { + return instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2), mapper); + }); + var modifiers = getMappedTypeModifiers(mappedType); + var newTupleModifiers = modifiers & 4 ? ts6.map(elementFlags, function(f) { + return f & 1 ? 2 : f; + }) : modifiers & 8 ? ts6.map(elementFlags, function(f) { + return f & 2 ? 1 : f; + }) : elementFlags; + var newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers); + return ts6.contains(elementTypes, errorType) ? errorType : createTupleType(elementTypes, newTupleModifiers, newReadonly, tupleType.target.labeledElementDeclarations); + } + function instantiateMappedTypeTemplate(type, key, isOptional, mapper) { + var templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key); + var propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper); + var modifiers = getMappedTypeModifiers(type); + return strictNullChecks && modifiers & 4 && !maybeTypeOfKind( + propType, + 32768 | 16384 + /* TypeFlags.Void */ + ) ? getOptionalType( + propType, + /*isProperty*/ + true + ) : strictNullChecks && modifiers & 8 && isOptional ? getTypeWithFacts( + propType, + 524288 + /* TypeFacts.NEUndefined */ + ) : propType; + } + function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) { + var result = createObjectType(type.objectFlags | 64, type.symbol); + if (type.objectFlags & 32) { + result.declaration = type.declaration; + var origTypeParameter = getTypeParameterFromMappedType(type); + var freshTypeParameter = cloneTypeParameter(origTypeParameter); + result.typeParameter = freshTypeParameter; + mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper); + freshTypeParameter.mapper = mapper; + } + if (type.objectFlags & 8388608) { + result.node = type.node; + } + result.target = type; + result.mapper = mapper; + result.aliasSymbol = aliasSymbol || type.aliasSymbol; + result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); + result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0; + return result; + } + function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) { + var root = type.root; + if (root.outerTypeParameters) { + var typeArguments = ts6.map(root.outerTypeParameters, function(t) { + return getMappedType(t, mapper); + }); + var id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments); + var result = root.instantiations.get(id); + if (!result) { + var newMapper_1 = createTypeMapper(root.outerTypeParameters, typeArguments); + var checkType_1 = root.checkType; + var distributionType = root.isDistributive ? getMappedType(checkType_1, newMapper_1) : void 0; + result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 | 131072) ? mapTypeWithAlias(getReducedType(distributionType), function(t) { + return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); + }, aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments); + root.instantiations.set(id, result); + } + return result; + } + return type; + } + function instantiateType(type, mapper) { + return type && mapper ? instantiateTypeWithAlias( + type, + mapper, + /*aliasSymbol*/ + void 0, + /*aliasTypeArguments*/ + void 0 + ) : type; + } + function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) { + if (!couldContainTypeVariables(type)) { + return type; + } + if (instantiationDepth === 100 || instantiationCount >= 5e6) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount }); + error(currentNode, ts6.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); + return errorType; + } + totalInstantiationCount++; + instantiationCount++; + instantiationDepth++; + var result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments); + instantiationDepth--; + return result; + } + function instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments) { + var flags = type.flags; + if (flags & 262144) { + return getMappedType(type, mapper); + } + if (flags & 524288) { + var objectFlags = type.objectFlags; + if (objectFlags & (4 | 16 | 32)) { + if (objectFlags & 4 && !type.node) { + var resolvedTypeArguments = type.resolvedTypeArguments; + var newTypeArguments = instantiateTypes(resolvedTypeArguments, mapper); + return newTypeArguments !== resolvedTypeArguments ? createNormalizedTypeReference(type.target, newTypeArguments) : type; + } + if (objectFlags & 1024) { + return instantiateReverseMappedType(type, mapper); + } + return getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments); + } + return type; + } + if (flags & 3145728) { + var origin = type.flags & 1048576 ? type.origin : void 0; + var types = origin && origin.flags & 3145728 ? origin.types : type.types; + var newTypes = instantiateTypes(types, mapper); + if (newTypes === types && aliasSymbol === type.aliasSymbol) { + return type; + } + var newAliasSymbol = aliasSymbol || type.aliasSymbol; + var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); + return flags & 2097152 || origin && origin.flags & 2097152 ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1, newAliasSymbol, newAliasTypeArguments); + } + if (flags & 4194304) { + return getIndexType(instantiateType(type.type, mapper)); + } + if (flags & 134217728) { + return getTemplateLiteralType(type.texts, instantiateTypes(type.types, mapper)); + } + if (flags & 268435456) { + return getStringMappingType(type.symbol, instantiateType(type.type, mapper)); + } + if (flags & 8388608) { + var newAliasSymbol = aliasSymbol || type.aliasSymbol; + var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); + return getIndexedAccessType( + instantiateType(type.objectType, mapper), + instantiateType(type.indexType, mapper), + type.accessFlags, + /*accessNode*/ + void 0, + newAliasSymbol, + newAliasTypeArguments + ); + } + if (flags & 16777216) { + return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); + } + if (flags & 33554432) { + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + if (newBaseType.flags & 8650752 && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); + } + if (newConstraint.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; + } + return newBaseType.flags & 8650752 ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); + } + return type; + } + function instantiateReverseMappedType(type, mapper) { + var innerMappedType = instantiateType(type.mappedType, mapper); + if (!(ts6.getObjectFlags(innerMappedType) & 32)) { + return type; + } + var innerIndexType = instantiateType(type.constraintType, mapper); + if (!(innerIndexType.flags & 4194304)) { + return type; + } + var instantiated = inferTypeForHomomorphicMappedType(instantiateType(type.source, mapper), innerMappedType, innerIndexType); + if (instantiated) { + return instantiated; + } + return type; + } + function getUniqueLiteralFilledInstantiation(type) { + return type.flags & (131068 | 3 | 131072) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper)); + } + function getPermissiveInstantiation(type) { + return type.flags & (131068 | 3 | 131072) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); + } + function getRestrictiveInstantiation(type) { + if (type.flags & (131068 | 3 | 131072)) { + return type; + } + if (type.restrictiveInstantiation) { + return type.restrictiveInstantiation; + } + type.restrictiveInstantiation = instantiateType(type, restrictiveMapper); + type.restrictiveInstantiation.restrictiveInstantiation = type.restrictiveInstantiation; + return type.restrictiveInstantiation; + } + function instantiateIndexInfo(info, mapper) { + return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration); + } + function isContextSensitive(node) { + ts6.Debug.assert(node.kind !== 171 || ts6.isObjectLiteralMethod(node)); + switch (node.kind) { + case 215: + case 216: + case 171: + case 259: + return isContextSensitiveFunctionLikeDeclaration(node); + case 207: + return ts6.some(node.properties, isContextSensitive); + case 206: + return ts6.some(node.elements, isContextSensitive); + case 224: + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + case 223: + return (node.operatorToken.kind === 56 || node.operatorToken.kind === 60) && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 299: + return isContextSensitive(node.initializer); + case 214: + return isContextSensitive(node.expression); + case 289: + return ts6.some(node.properties, isContextSensitive) || ts6.isJsxOpeningElement(node.parent) && ts6.some(node.parent.parent.children, isContextSensitive); + case 288: { + var initializer = node.initializer; + return !!initializer && isContextSensitive(initializer); + } + case 291: { + var expression = node.expression; + return !!expression && isContextSensitive(expression); + } + } + return false; + } + function isContextSensitiveFunctionLikeDeclaration(node) { + return ts6.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); + } + function hasContextSensitiveReturnExpression(node) { + return !node.typeParameters && !ts6.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 && isContextSensitive(node.body); + } + function isContextSensitiveFunctionOrObjectLiteralMethod(func) { + return (ts6.isFunctionExpressionOrArrowFunction(func) || ts6.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); + } + function getTypeWithoutSignatures(type) { + if (type.flags & 524288) { + var resolved = resolveStructuredTypeMembers(type); + if (resolved.constructSignatures.length || resolved.callSignatures.length) { + var result = createObjectType(16, type.symbol); + result.members = resolved.members; + result.properties = resolved.properties; + result.callSignatures = ts6.emptyArray; + result.constructSignatures = ts6.emptyArray; + result.indexInfos = ts6.emptyArray; + return result; + } + } else if (type.flags & 2097152) { + return getIntersectionType(ts6.map(type.types, getTypeWithoutSignatures)); + } + return type; + } + function isTypeIdenticalTo(source, target) { + return isTypeRelatedTo(source, target, identityRelation); + } + function compareTypesIdentical(source, target) { + return isTypeRelatedTo(source, target, identityRelation) ? -1 : 0; + } + function compareTypesAssignable(source, target) { + return isTypeRelatedTo(source, target, assignableRelation) ? -1 : 0; + } + function compareTypesSubtypeOf(source, target) { + return isTypeRelatedTo(source, target, subtypeRelation) ? -1 : 0; + } + function isTypeSubtypeOf(source, target) { + return isTypeRelatedTo(source, target, subtypeRelation); + } + function isTypeAssignableTo(source, target) { + return isTypeRelatedTo(source, target, assignableRelation); + } + function isTypeDerivedFrom(source, target) { + return source.flags & 1048576 ? ts6.every(source.types, function(t) { + return isTypeDerivedFrom(t, target); + }) : target.flags & 1048576 ? ts6.some(target.types, function(t) { + return isTypeDerivedFrom(source, t); + }) : source.flags & 58982400 ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 | 67108864)) : target === globalFunctionType ? !!(source.flags & 524288) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType); + } + function isTypeComparableTo(source, target) { + return isTypeRelatedTo(source, target, comparableRelation); + } + function areTypesComparable(type1, type2) { + return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1); + } + function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain, errorOutputObject) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain, errorOutputObject); + } + function checkTypeAssignableToAndOptionallyElaborate(source, target, errorNode, expr, headMessage, containingMessageChain) { + return checkTypeRelatedToAndOptionallyElaborate( + source, + target, + assignableRelation, + errorNode, + expr, + headMessage, + containingMessageChain, + /*errorOutputContainer*/ + void 0 + ); + } + function checkTypeRelatedToAndOptionallyElaborate(source, target, relation, errorNode, expr, headMessage, containingMessageChain, errorOutputContainer) { + if (isTypeRelatedTo(source, target, relation)) + return true; + if (!errorNode || !elaborateError(expr, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) { + return checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer); + } + return false; + } + function isOrHasGenericConditional(type) { + return !!(type.flags & 16777216 || type.flags & 2097152 && ts6.some(type.types, isOrHasGenericConditional)); + } + function elaborateError(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer) { + if (!node || isOrHasGenericConditional(target)) + return false; + if (!checkTypeRelatedTo( + source, + target, + relation, + /*errorNode*/ + void 0 + ) && elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) { + return true; + } + switch (node.kind) { + case 291: + case 214: + return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); + case 223: + switch (node.operatorToken.kind) { + case 63: + case 27: + return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); + } + break; + case 207: + return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); + case 206: + return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); + case 289: + return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); + case 216: + return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); + } + return false; + } + function elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer) { + var callSignatures = getSignaturesOfType( + source, + 0 + /* SignatureKind.Call */ + ); + var constructSignatures = getSignaturesOfType( + source, + 1 + /* SignatureKind.Construct */ + ); + for (var _i = 0, _a = [constructSignatures, callSignatures]; _i < _a.length; _i++) { + var signatures = _a[_i]; + if (ts6.some(signatures, function(s) { + var returnType = getReturnTypeOfSignature(s); + return !(returnType.flags & (1 | 131072)) && checkTypeRelatedTo( + returnType, + target, + relation, + /*errorNode*/ + void 0 + ); + })) { + var resultObj = errorOutputContainer || {}; + checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj); + var diagnostic = resultObj.errors[resultObj.errors.length - 1]; + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(node, signatures === constructSignatures ? ts6.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts6.Diagnostics.Did_you_mean_to_call_this_expression)); + return true; + } + } + return false; + } + function elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer) { + if (ts6.isBlock(node.body)) { + return false; + } + if (ts6.some(node.parameters, ts6.hasType)) { + return false; + } + var sourceSig = getSingleCallSignature(source); + if (!sourceSig) { + return false; + } + var targetSignatures = getSignaturesOfType( + target, + 0 + /* SignatureKind.Call */ + ); + if (!ts6.length(targetSignatures)) { + return false; + } + var returnExpression = node.body; + var sourceReturn = getReturnTypeOfSignature(sourceSig); + var targetReturn = getUnionType(ts6.map(targetSignatures, getReturnTypeOfSignature)); + if (!checkTypeRelatedTo( + sourceReturn, + targetReturn, + relation, + /*errorNode*/ + void 0 + )) { + var elaborated = returnExpression && elaborateError( + returnExpression, + sourceReturn, + targetReturn, + relation, + /*headMessage*/ + void 0, + containingMessageChain, + errorOutputContainer + ); + if (elaborated) { + return elaborated; + } + var resultObj = errorOutputContainer || {}; + checkTypeRelatedTo( + sourceReturn, + targetReturn, + relation, + returnExpression, + /*message*/ + void 0, + containingMessageChain, + resultObj + ); + if (resultObj.errors) { + if (target.symbol && ts6.length(target.symbol.declarations)) { + ts6.addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], ts6.createDiagnosticForNode(target.symbol.declarations[0], ts6.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature)); + } + if ((ts6.getFunctionFlags(node) & 2) === 0 && !getTypeOfPropertyOfType(sourceReturn, "then") && checkTypeRelatedTo( + createPromiseType(sourceReturn), + targetReturn, + relation, + /*errorNode*/ + void 0 + )) { + ts6.addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], ts6.createDiagnosticForNode(node, ts6.Diagnostics.Did_you_mean_to_mark_this_function_as_async)); + } + return true; + } + } + return false; + } + function getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType) { + var idx = getIndexedAccessTypeOrUndefined(target, nameType); + if (idx) { + return idx; + } + if (target.flags & 1048576) { + var best = getBestMatchingType(source, target); + if (best) { + return getIndexedAccessTypeOrUndefined(best, nameType); + } + } + } + function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) { + next.contextualType = sourcePropType; + try { + return checkExpressionForMutableLocation(next, 1, sourcePropType); + } finally { + next.contextualType = void 0; + } + } + function elaborateElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) { + var reportedError = false; + for (var status = iterator.next(); !status.done; status = iterator.next()) { + var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage; + var targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType); + if (!targetPropType || targetPropType.flags & 8388608) + continue; + var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType); + if (!sourcePropType) + continue; + var propName = getPropertyNameFromIndex( + nameType, + /*accessNode*/ + void 0 + ); + if (!checkTypeRelatedTo( + sourcePropType, + targetPropType, + relation, + /*errorNode*/ + void 0 + )) { + var elaborated = next && elaborateError( + next, + sourcePropType, + targetPropType, + relation, + /*headMessage*/ + void 0, + containingMessageChain, + errorOutputContainer + ); + reportedError = true; + if (!elaborated) { + var resultObj = errorOutputContainer || {}; + var specificSource = next ? checkExpressionForMutableLocationWithContextualType(next, sourcePropType) : sourcePropType; + if (exactOptionalPropertyTypes && isExactOptionalPropertyMismatch(specificSource, targetPropType)) { + var diag = ts6.createDiagnosticForNode(prop, ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target, typeToString(specificSource), typeToString(targetPropType)); + diagnostics.add(diag); + resultObj.errors = [diag]; + } else { + var targetIsOptional = !!(propName && (getPropertyOfType(target, propName) || unknownSymbol).flags & 16777216); + var sourceIsOptional = !!(propName && (getPropertyOfType(source, propName) || unknownSymbol).flags & 16777216); + targetPropType = removeMissingType(targetPropType, targetIsOptional); + sourcePropType = removeMissingType(sourcePropType, targetIsOptional && sourceIsOptional); + var result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj); + if (result && specificSource !== sourcePropType) { + checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj); + } + } + if (resultObj.errors) { + var reportedDiag = resultObj.errors[resultObj.errors.length - 1]; + var propertyName = isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0; + var targetProp = propertyName !== void 0 ? getPropertyOfType(target, propertyName) : void 0; + var issuedElaboration = false; + if (!targetProp) { + var indexInfo = getApplicableIndexInfo(target, nameType); + if (indexInfo && indexInfo.declaration && !ts6.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) { + issuedElaboration = true; + ts6.addRelatedInfo(reportedDiag, ts6.createDiagnosticForNode(indexInfo.declaration, ts6.Diagnostics.The_expected_type_comes_from_this_index_signature)); + } + } + if (!issuedElaboration && (targetProp && ts6.length(targetProp.declarations) || target.symbol && ts6.length(target.symbol.declarations))) { + var targetNode = targetProp && ts6.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0]; + if (!ts6.getSourceFileOfNode(targetNode).hasNoDefaultLib) { + ts6.addRelatedInfo(reportedDiag, ts6.createDiagnosticForNode(targetNode, ts6.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192) ? ts6.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target))); + } + } + } + } + } + } + return reportedError; + } + function generateJsxAttributes(node) { + var _i, _a, prop; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + if (!ts6.length(node.properties)) + return [ + 2 + /*return*/ + ]; + _i = 0, _a = node.properties; + _b.label = 1; + case 1: + if (!(_i < _a.length)) + return [3, 4]; + prop = _a[_i]; + if (ts6.isJsxSpreadAttribute(prop) || isHyphenatedJsxName(ts6.idText(prop.name))) + return [3, 3]; + return [4, { errorNode: prop.name, innerExpression: prop.initializer, nameType: getStringLiteralType(ts6.idText(prop.name)) }]; + case 2: + _b.sent(); + _b.label = 3; + case 3: + _i++; + return [3, 1]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + } + function generateJsxChildren(node, getInvalidTextDiagnostic) { + var memberOffset, i, child, nameType, elem; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!ts6.length(node.children)) + return [ + 2 + /*return*/ + ]; + memberOffset = 0; + i = 0; + _a.label = 1; + case 1: + if (!(i < node.children.length)) + return [3, 5]; + child = node.children[i]; + nameType = getNumberLiteralType(i - memberOffset); + elem = getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic); + if (!elem) + return [3, 3]; + return [4, elem]; + case 2: + _a.sent(); + return [3, 4]; + case 3: + memberOffset++; + _a.label = 4; + case 4: + i++; + return [3, 1]; + case 5: + return [ + 2 + /*return*/ + ]; + } + }); + } + function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { + switch (child.kind) { + case 291: + return { errorNode: child, innerExpression: child.expression, nameType }; + case 11: + if (child.containsOnlyTriviaWhiteSpaces) { + break; + } + return { errorNode: child, innerExpression: void 0, nameType, errorMessage: getInvalidTextDiagnostic() }; + case 281: + case 282: + case 285: + return { errorNode: child, innerExpression: child, nameType }; + default: + return ts6.Debug.assertNever(child, "Found invalid jsx child"); + } + } + function elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer) { + var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation, containingMessageChain, errorOutputContainer); + var invalidTextDiagnostic; + if (ts6.isJsxOpeningElement(node.parent) && ts6.isJsxElement(node.parent.parent)) { + var containingElement = node.parent.parent; + var childPropName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); + var childrenPropName = childPropName === void 0 ? "children" : ts6.unescapeLeadingUnderscores(childPropName); + var childrenNameType = getStringLiteralType(childrenPropName); + var childrenTargetType = getIndexedAccessType(target, childrenNameType); + var validChildren = ts6.getSemanticJsxChildren(containingElement.children); + if (!ts6.length(validChildren)) { + return result; + } + var moreThanOneRealChildren = ts6.length(validChildren) > 1; + var arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType); + var nonArrayLikeTargetParts = filterType(childrenTargetType, function(t) { + return !isArrayOrTupleLikeType(t); + }); + if (moreThanOneRealChildren) { + if (arrayLikeTargetParts !== neverType) { + var realSource = createTupleType(checkJsxChildren( + containingElement, + 0 + /* CheckMode.Normal */ + )); + var children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic); + result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result; + } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { + result = true; + var diag = error(containingElement.openingElement.tagName, ts6.Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided, childrenPropName, typeToString(childrenTargetType)); + if (errorOutputContainer && errorOutputContainer.skipLogging) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + } + } else { + if (nonArrayLikeTargetParts !== neverType) { + var child = validChildren[0]; + var elem_1 = getElaborationElementForJsxChild(child, childrenNameType, getInvalidTextualChildDiagnostic); + if (elem_1) { + result = elaborateElementwise(function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, elem_1]; + case 1: + _a.sent(); + return [ + 2 + /*return*/ + ]; + } + }); + }(), source, target, relation, containingMessageChain, errorOutputContainer) || result; + } + } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { + result = true; + var diag = error(containingElement.openingElement.tagName, ts6.Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided, childrenPropName, typeToString(childrenTargetType)); + if (errorOutputContainer && errorOutputContainer.skipLogging) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + } + } + } + return result; + function getInvalidTextualChildDiagnostic() { + if (!invalidTextDiagnostic) { + var tagNameText = ts6.getTextOfNode(node.parent.tagName); + var childPropName2 = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); + var childrenPropName2 = childPropName2 === void 0 ? "children" : ts6.unescapeLeadingUnderscores(childPropName2); + var childrenTargetType2 = getIndexedAccessType(target, getStringLiteralType(childrenPropName2)); + var diagnostic = ts6.Diagnostics._0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2; + invalidTextDiagnostic = __assign(__assign({}, diagnostic), { key: "!!ALREADY FORMATTED!!", message: ts6.formatMessage( + /*_dummy*/ + void 0, + diagnostic, + tagNameText, + childrenPropName2, + typeToString(childrenTargetType2) + ) }); + } + return invalidTextDiagnostic; + } + } + function generateLimitedTupleElements(node, target) { + var len, i, elem, nameType; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + len = ts6.length(node.elements); + if (!len) + return [ + 2 + /*return*/ + ]; + i = 0; + _a.label = 1; + case 1: + if (!(i < len)) + return [3, 4]; + if (isTupleLikeType(target) && !getPropertyOfType(target, "" + i)) + return [3, 3]; + elem = node.elements[i]; + if (ts6.isOmittedExpression(elem)) + return [3, 3]; + nameType = getNumberLiteralType(i); + return [4, { errorNode: elem, innerExpression: elem, nameType }]; + case 2: + _a.sent(); + _a.label = 3; + case 3: + i++; + return [3, 1]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + } + function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { + if (target.flags & (131068 | 131072)) + return false; + if (isTupleLikeType(source)) { + return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer); + } + var oldContext = node.contextualType; + node.contextualType = target; + try { + var tupleizedType = checkArrayLiteral( + node, + 1, + /*forceTuple*/ + true + ); + node.contextualType = oldContext; + if (isTupleLikeType(tupleizedType)) { + return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer); + } + return false; + } finally { + node.contextualType = oldContext; + } + } + function generateObjectLiteralElements(node) { + var _i, _a, prop, type, _b; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + if (!ts6.length(node.properties)) + return [ + 2 + /*return*/ + ]; + _i = 0, _a = node.properties; + _c.label = 1; + case 1: + if (!(_i < _a.length)) + return [3, 8]; + prop = _a[_i]; + if (ts6.isSpreadAssignment(prop)) + return [3, 7]; + type = getLiteralTypeFromProperty( + getSymbolOfNode(prop), + 8576 + /* TypeFlags.StringOrNumberLiteralOrUnique */ + ); + if (!type || type.flags & 131072) { + return [3, 7]; + } + _b = prop.kind; + switch (_b) { + case 175: + return [3, 2]; + case 174: + return [3, 2]; + case 171: + return [3, 2]; + case 300: + return [3, 2]; + case 299: + return [3, 4]; + } + return [3, 6]; + case 2: + return [4, { errorNode: prop.name, innerExpression: void 0, nameType: type }]; + case 3: + _c.sent(); + return [3, 7]; + case 4: + return [4, { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: ts6.isComputedNonLiteralName(prop.name) ? ts6.Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : void 0 }]; + case 5: + _c.sent(); + return [3, 7]; + case 6: + ts6.Debug.assertNever(prop); + _c.label = 7; + case 7: + _i++; + return [3, 1]; + case 8: + return [ + 2 + /*return*/ + ]; + } + }); + } + function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { + if (target.flags & (131068 | 131072)) + return false; + return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer); + } + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } + function isSignatureAssignableTo(source, target, ignoreReturnTypes) { + return compareSignaturesRelated( + source, + target, + ignoreReturnTypes ? 4 : 0, + /*reportErrors*/ + false, + /*errorReporter*/ + void 0, + /*errorReporter*/ + void 0, + compareTypesAssignable, + /*reportUnreliableMarkers*/ + void 0 + ) !== 0; + } + function isAnySignature(s) { + return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s)); + } + function compareSignaturesRelated(source, target, checkMode, reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) { + if (source === target) { + return -1; + } + if (isAnySignature(target)) { + return -1; + } + var targetCount = getParameterCount(target); + var sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount); + if (sourceHasMoreParameters) { + return 0; + } + if (source.typeParameters && source.typeParameters !== target.typeParameters) { + target = getCanonicalSignature(target); + source = instantiateSignatureInContextOf( + source, + target, + /*inferenceContext*/ + void 0, + compareTypes + ); + } + var sourceCount = getParameterCount(source); + var sourceRestType = getNonArrayRestType(source); + var targetRestType = getNonArrayRestType(target); + if (sourceRestType || targetRestType) { + void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); + } + var kind = target.declaration ? target.declaration.kind : 0; + var strictVariance = !(checkMode & 3) && strictFunctionTypes && kind !== 171 && kind !== 170 && kind !== 173; + var result = -1; + var sourceThisType = getThisTypeOfSignature(source); + if (sourceThisType && sourceThisType !== voidType) { + var targetThisType = getThisTypeOfSignature(target); + if (targetThisType) { + var related = !strictVariance && compareTypes( + sourceThisType, + targetThisType, + /*reportErrors*/ + false + ) || compareTypes(targetThisType, sourceThisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts6.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0; + } + result &= related; + } + } + var paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount); + var restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1; + for (var i = 0; i < paramCount; i++) { + var sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i); + var targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i); + if (sourceType && targetType) { + var sourceSig = checkMode & 3 ? void 0 : getSingleCallSignature(getNonNullableType(sourceType)); + var targetSig = checkMode & 3 ? void 0 : getSingleCallSignature(getNonNullableType(targetType)); + var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648) === (getTypeFacts(targetType) & 50331648); + var related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 | (strictVariance ? 2 : 1), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3) && !strictVariance && compareTypes( + sourceType, + targetType, + /*reportErrors*/ + false + ) || compareTypes(targetType, sourceType, reportErrors); + if (related && checkMode & 8 && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes( + sourceType, + targetType, + /*reportErrors*/ + false + )) { + related = 0; + } + if (!related) { + if (reportErrors) { + errorReporter(ts6.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, ts6.unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), ts6.unescapeLeadingUnderscores(getParameterNameAtPosition(target, i))); + } + return 0; + } + result &= related; + } + } + if (!(checkMode & 4)) { + var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol)) : getReturnTypeOfSignature(target); + if (targetReturnType === voidType || targetReturnType === anyType) { + return result; + } + var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol)) : getReturnTypeOfSignature(source); + var targetTypePredicate = getTypePredicateOfSignature(target); + if (targetTypePredicate) { + var sourceTypePredicate = getTypePredicateOfSignature(source); + if (sourceTypePredicate) { + result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors, errorReporter, compareTypes); + } else if (ts6.isIdentifierTypePredicate(targetTypePredicate)) { + if (reportErrors) { + errorReporter(ts6.Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source)); + } + return 0; + } + } else { + result &= checkMode & 1 && compareTypes( + targetReturnType, + sourceReturnType, + /*reportErrors*/ + false + ) || compareTypes(sourceReturnType, targetReturnType, reportErrors); + if (!result && reportErrors && incompatibleErrorReporter) { + incompatibleErrorReporter(sourceReturnType, targetReturnType); + } + } + } + return result; + } + function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + if (source.kind !== target.kind) { + if (reportErrors) { + errorReporter(ts6.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); + errorReporter(ts6.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + if (source.kind === 1 || source.kind === 3) { + if (source.parameterIndex !== target.parameterIndex) { + if (reportErrors) { + errorReporter(ts6.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, target.parameterName); + errorReporter(ts6.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return 0; + } + } + var related = source.type === target.type ? -1 : source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0; + if (related === 0 && reportErrors) { + errorReporter(ts6.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); + } + return related; + } + function isImplementationCompatibleWithOverload(implementation, overload) { + var erasedSource = getErasedSignature(implementation); + var erasedTarget = getErasedSignature(overload); + var sourceReturnType = getReturnTypeOfSignature(erasedSource); + var targetReturnType = getReturnTypeOfSignature(erasedTarget); + if (targetReturnType === voidType || isTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation) || isTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation)) { + return isSignatureAssignableTo( + erasedSource, + erasedTarget, + /*ignoreReturnTypes*/ + true + ); + } + return false; + } + function isEmptyResolvedType(t) { + return t !== anyFunctionType && t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && t.indexInfos.length === 0; + } + function isEmptyObjectType(type) { + return type.flags & 524288 ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(type)) : type.flags & 67108864 ? true : type.flags & 1048576 ? ts6.some(type.types, isEmptyObjectType) : type.flags & 2097152 ? ts6.every(type.types, isEmptyObjectType) : false; + } + function isEmptyAnonymousObjectType(type) { + return !!(ts6.getObjectFlags(type) & 16 && (type.members && isEmptyResolvedType(type) || type.symbol && type.symbol.flags & 2048 && getMembersOfSymbol(type.symbol).size === 0)); + } + function isUnknownLikeUnionType(type) { + if (strictNullChecks && type.flags & 1048576) { + if (!(type.objectFlags & 33554432)) { + var types = type.types; + type.objectFlags |= 33554432 | (types.length >= 3 && types[0].flags & 32768 && types[1].flags & 65536 && ts6.some(types, isEmptyAnonymousObjectType) ? 67108864 : 0); + } + return !!(type.objectFlags & 67108864); + } + return false; + } + function containsUndefinedType(type) { + return !!((type.flags & 1048576 ? type.types[0] : type).flags & 32768); + } + function isStringIndexSignatureOnlyType(type) { + return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 && ts6.every(type.types, isStringIndexSignatureOnlyType) || false; + } + function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) { + if (sourceSymbol === targetSymbol) { + return true; + } + var id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol); + var entry = enumRelation.get(id); + if (entry !== void 0 && !(!(entry & 4) && entry & 2 && errorReporter)) { + return !!(entry & 1); + } + if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256) || !(targetSymbol.flags & 256)) { + enumRelation.set( + id, + 2 | 4 + /* RelationComparisonResult.Reported */ + ); + return false; + } + var targetEnumType = getTypeOfSymbol(targetSymbol); + for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(sourceSymbol)); _i < _a.length; _i++) { + var property = _a[_i]; + if (property.flags & 8) { + var targetProperty = getPropertyOfType(targetEnumType, property.escapedName); + if (!targetProperty || !(targetProperty.flags & 8)) { + if (errorReporter) { + errorReporter(ts6.Diagnostics.Property_0_is_missing_in_type_1, ts6.symbolName(property), typeToString( + getDeclaredTypeOfSymbol(targetSymbol), + /*enclosingDeclaration*/ + void 0, + 64 + /* TypeFormatFlags.UseFullyQualifiedType */ + )); + enumRelation.set( + id, + 2 | 4 + /* RelationComparisonResult.Reported */ + ); + } else { + enumRelation.set( + id, + 2 + /* RelationComparisonResult.Failed */ + ); + } + return false; + } + } + } + enumRelation.set( + id, + 1 + /* RelationComparisonResult.Succeeded */ + ); + return true; + } + function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { + var s = source.flags; + var t = target.flags; + if (t & 3 || s & 131072 || source === wildcardType) + return true; + if (t & 131072) + return false; + if (s & 402653316 && t & 4) + return true; + if (s & 128 && s & 1024 && t & 128 && !(t & 1024) && source.value === target.value) + return true; + if (s & 296 && t & 8) + return true; + if (s & 256 && s & 1024 && t & 256 && !(t & 1024) && source.value === target.value) + return true; + if (s & 2112 && t & 64) + return true; + if (s & 528 && t & 16) + return true; + if (s & 12288 && t & 4096) + return true; + if (s & 32 && t & 32 && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) + return true; + if (s & 1024 && t & 1024) { + if (s & 1048576 && t & 1048576 && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) + return true; + if (s & 2944 && t & 2944 && source.value === target.value && isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter)) + return true; + } + if (s & 32768 && (!strictNullChecks && !(t & 3145728) || t & (32768 | 16384))) + return true; + if (s & 65536 && (!strictNullChecks && !(t & 3145728) || t & 65536)) + return true; + if (s & 524288 && t & 67108864 && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(ts6.getObjectFlags(source) & 8192))) + return true; + if (relation === assignableRelation || relation === comparableRelation) { + if (s & 1) + return true; + if (s & (8 | 256) && !(s & 1024) && (t & 32 || relation === assignableRelation && t & 256 && t & 1024)) + return true; + if (isUnknownLikeUnionType(target)) + return true; + } + return false; + } + function isTypeRelatedTo(source, target, relation) { + if (isFreshLiteralType(source)) { + source = source.regularType; + } + if (isFreshLiteralType(target)) { + target = target.regularType; + } + if (source === target) { + return true; + } + if (relation !== identityRelation) { + if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) { + return true; + } + } else if (!((source.flags | target.flags) & (3145728 | 8388608 | 16777216 | 33554432))) { + if (source.flags !== target.flags) + return false; + if (source.flags & 67358815) + return true; + } + if (source.flags & 524288 && target.flags & 524288) { + var related = relation.get(getRelationKey( + source, + target, + 0, + relation, + /*ignoreConstraints*/ + false + )); + if (related !== void 0) { + return !!(related & 1); + } + } + if (source.flags & 469499904 || target.flags & 469499904) { + return checkTypeRelatedTo( + source, + target, + relation, + /*errorNode*/ + void 0 + ); + } + return false; + } + function isIgnoredJsxProperty(source, sourceProp) { + return ts6.getObjectFlags(source) & 2048 && isHyphenatedJsxName(sourceProp.escapedName); + } + function getNormalizedType(type, writing) { + while (true) { + var t = isFreshLiteralType(type) ? type.regularType : ts6.getObjectFlags(type) & 4 ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 ? getSimplifiedType(type, writing) : type; + if (t === type) + return t; + type = t; + } + } + function getNormalizedUnionOrIntersectionType(type, writing) { + var reduced = getReducedType(type); + if (reduced !== type) { + return reduced; + } + if (type.flags & 2097152 && ts6.some(type.types, isEmptyAnonymousObjectType)) { + var normalizedTypes = ts6.sameMap(type.types, function(t) { + return getNormalizedType(t, writing); + }); + if (normalizedTypes !== type.types) { + return getIntersectionType(normalizedTypes); + } + } + return type; + } + function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) { + var errorInfo; + var relatedInfo; + var maybeKeys; + var sourceStack; + var targetStack; + var maybeCount = 0; + var sourceDepth = 0; + var targetDepth = 0; + var expandingFlags = 0; + var overflow = false; + var overrideNextErrorInfo = 0; + var lastSkippedInfo; + var incompatibleStack; + var inPropertyCheck = false; + ts6.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); + var result = isRelatedTo( + source, + target, + 3, + /*reportErrors*/ + !!errorNode, + headMessage + ); + if (incompatibleStack) { + reportIncompatibleStack(); + } + if (overflow) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth }); + var diag = error(errorNode || currentNode, ts6.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + if (errorOutputContainer) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + } else if (errorInfo) { + if (containingMessageChain) { + var chain = containingMessageChain(); + if (chain) { + ts6.concatenateDiagnosticMessageChains(chain, errorInfo); + errorInfo = chain; + } + } + var relatedInformation = void 0; + if (headMessage && errorNode && !result && source.symbol) { + var links = getSymbolLinks(source.symbol); + if (links.originatingImport && !ts6.isImportCall(links.originatingImport)) { + var helpfulRetry = checkTypeRelatedTo( + getTypeOfSymbol(links.target), + target, + relation, + /*errorNode*/ + void 0 + ); + if (helpfulRetry) { + var diag_1 = ts6.createDiagnosticForNode(links.originatingImport, ts6.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead); + relatedInformation = ts6.append(relatedInformation, diag_1); + } + } + } + var diag = ts6.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation); + if (relatedInfo) { + ts6.addRelatedInfo.apply(void 0, __spreadArray([diag], relatedInfo, false)); + } + if (errorOutputContainer) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + if (!errorOutputContainer || !errorOutputContainer.skipLogging) { + diagnostics.add(diag); + } + } + if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === 0) { + ts6.Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error."); + } + return result !== 0; + function resetErrorInfo(saved) { + errorInfo = saved.errorInfo; + lastSkippedInfo = saved.lastSkippedInfo; + incompatibleStack = saved.incompatibleStack; + overrideNextErrorInfo = saved.overrideNextErrorInfo; + relatedInfo = saved.relatedInfo; + } + function captureErrorCalculationState() { + return { + errorInfo, + lastSkippedInfo, + incompatibleStack: incompatibleStack === null || incompatibleStack === void 0 ? void 0 : incompatibleStack.slice(), + overrideNextErrorInfo, + relatedInfo: relatedInfo === null || relatedInfo === void 0 ? void 0 : relatedInfo.slice() + }; + } + function reportIncompatibleError(message, arg0, arg1, arg2, arg3) { + overrideNextErrorInfo++; + lastSkippedInfo = void 0; + (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]); + } + function reportIncompatibleStack() { + var stack2 = incompatibleStack || []; + incompatibleStack = void 0; + var info = lastSkippedInfo; + lastSkippedInfo = void 0; + if (stack2.length === 1) { + reportError.apply(void 0, stack2[0]); + if (info) { + reportRelationError.apply(void 0, __spreadArray([ + /*headMessage*/ + void 0 + ], info, false)); + } + return; + } + var path = ""; + var secondaryRootErrors = []; + while (stack2.length) { + var _a = stack2.pop(), msg = _a[0], args = _a.slice(1); + switch (msg.code) { + case ts6.Diagnostics.Types_of_property_0_are_incompatible.code: { + if (path.indexOf("new ") === 0) { + path = "(".concat(path, ")"); + } + var str = "" + args[0]; + if (path.length === 0) { + path = "".concat(str); + } else if (ts6.isIdentifierText(str, ts6.getEmitScriptTarget(compilerOptions))) { + path = "".concat(path, ".").concat(str); + } else if (str[0] === "[" && str[str.length - 1] === "]") { + path = "".concat(path).concat(str); + } else { + path = "".concat(path, "[").concat(str, "]"); + } + break; + } + case ts6.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code: + case ts6.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code: + case ts6.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: + case ts6.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: { + if (path.length === 0) { + var mappedMsg = msg; + if (msg.code === ts6.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { + mappedMsg = ts6.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible; + } else if (msg.code === ts6.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { + mappedMsg = ts6.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible; + } + secondaryRootErrors.unshift([mappedMsg, args[0], args[1]]); + } else { + var prefix2 = msg.code === ts6.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code || msg.code === ts6.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code ? "new " : ""; + var params = msg.code === ts6.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code || msg.code === ts6.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code ? "" : "..."; + path = "".concat(prefix2).concat(path, "(").concat(params, ")"); + } + break; + } + case ts6.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target.code: { + secondaryRootErrors.unshift([ts6.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, args[0], args[1]]); + break; + } + case ts6.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target.code: { + secondaryRootErrors.unshift([ts6.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, args[0], args[1], args[2]]); + break; + } + default: + return ts6.Debug.fail("Unhandled Diagnostic: ".concat(msg.code)); + } + } + if (path) { + reportError(path[path.length - 1] === ")" ? ts6.Diagnostics.The_types_returned_by_0_are_incompatible_between_these_types : ts6.Diagnostics.The_types_of_0_are_incompatible_between_these_types, path); + } else { + secondaryRootErrors.shift(); + } + for (var _i = 0, secondaryRootErrors_1 = secondaryRootErrors; _i < secondaryRootErrors_1.length; _i++) { + var _b = secondaryRootErrors_1[_i], msg = _b[0], args = _b.slice(1); + var originalValue = msg.elidedInCompatabilityPyramid; + msg.elidedInCompatabilityPyramid = false; + reportError.apply(void 0, __spreadArray([msg], args, false)); + msg.elidedInCompatabilityPyramid = originalValue; + } + if (info) { + reportRelationError.apply(void 0, __spreadArray([ + /*headMessage*/ + void 0 + ], info, false)); + } + } + function reportError(message, arg0, arg1, arg2, arg3) { + ts6.Debug.assert(!!errorNode); + if (incompatibleStack) + reportIncompatibleStack(); + if (message.elidedInCompatabilityPyramid) + return; + errorInfo = ts6.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3); + } + function associateRelatedInfo(info) { + ts6.Debug.assert(!!errorInfo); + if (!relatedInfo) { + relatedInfo = [info]; + } else { + relatedInfo.push(info); + } + } + function reportRelationError(message, source2, target2) { + if (incompatibleStack) + reportIncompatibleStack(); + var _a = getTypeNamesForErrorDisplay(source2, target2), sourceType = _a[0], targetType = _a[1]; + var generalizedSource = source2; + var generalizedSourceType = sourceType; + if (isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) { + generalizedSource = getBaseTypeOfLiteralType(source2); + ts6.Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable"); + generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource); + } + if (target2.flags & 262144 && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) { + var constraint = getBaseConstraintOfType(target2); + var needsOriginalSource = void 0; + if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) { + reportError(ts6.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, needsOriginalSource ? sourceType : generalizedSourceType, targetType, typeToString(constraint)); + } else { + errorInfo = void 0; + reportError(ts6.Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1, targetType, generalizedSourceType); + } + } + if (!message) { + if (relation === comparableRelation) { + message = ts6.Diagnostics.Type_0_is_not_comparable_to_type_1; + } else if (sourceType === targetType) { + message = ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated; + } else if (exactOptionalPropertyTypes && getExactOptionalUnassignableProperties(source2, target2).length) { + message = ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties; + } else { + if (source2.flags & 128 && target2.flags & 1048576) { + var suggestedType = getSuggestedTypeForNonexistentStringLiteralType(source2, target2); + if (suggestedType) { + reportError(ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType)); + return; + } + } + message = ts6.Diagnostics.Type_0_is_not_assignable_to_type_1; + } + } else if (message === ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1 && exactOptionalPropertyTypes && getExactOptionalUnassignableProperties(source2, target2).length) { + message = ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties; + } + reportError(message, generalizedSourceType, targetType); + } + function tryElaborateErrorsForPrimitivesAndObjects(source2, target2) { + var sourceType = symbolValueDeclarationIsContextSensitive(source2.symbol) ? typeToString(source2, source2.symbol.valueDeclaration) : typeToString(source2); + var targetType = symbolValueDeclarationIsContextSensitive(target2.symbol) ? typeToString(target2, target2.symbol.valueDeclaration) : typeToString(target2); + if (globalStringType === source2 && stringType === target2 || globalNumberType === source2 && numberType === target2 || globalBooleanType === source2 && booleanType === target2 || getGlobalESSymbolType() === source2 && esSymbolType === target2) { + reportError(ts6.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); + } + } + function tryElaborateArrayLikeErrors(source2, target2, reportErrors) { + if (isTupleType(source2)) { + if (source2.target.readonly && isMutableArrayOrTuple(target2)) { + if (reportErrors) { + reportError(ts6.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source2), typeToString(target2)); + } + return false; + } + return isArrayOrTupleType(target2); + } + if (isReadonlyArrayType(source2) && isMutableArrayOrTuple(target2)) { + if (reportErrors) { + reportError(ts6.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source2), typeToString(target2)); + } + return false; + } + if (isTupleType(target2)) { + return isArrayType(source2); + } + return true; + } + function isRelatedToWorker(source2, target2, reportErrors) { + return isRelatedTo(source2, target2, 3, reportErrors); + } + function isRelatedTo(originalSource, originalTarget, recursionFlags, reportErrors, headMessage2, intersectionState) { + if (recursionFlags === void 0) { + recursionFlags = 3; + } + if (reportErrors === void 0) { + reportErrors = false; + } + if (intersectionState === void 0) { + intersectionState = 0; + } + if (originalSource.flags & 524288 && originalTarget.flags & 131068) { + if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : void 0)) { + return -1; + } + if (reportErrors) { + reportErrorResults(originalSource, originalTarget, originalSource, originalTarget, headMessage2); + } + return 0; + } + var source2 = getNormalizedType( + originalSource, + /*writing*/ + false + ); + var target2 = getNormalizedType( + originalTarget, + /*writing*/ + true + ); + if (source2 === target2) + return -1; + if (relation === identityRelation) { + if (source2.flags !== target2.flags) + return 0; + if (source2.flags & 67358815) + return -1; + traceUnionsOrIntersectionsTooLarge(source2, target2); + return recursiveTypeRelatedTo( + source2, + target2, + /*reportErrors*/ + false, + 0, + recursionFlags + ); + } + if (source2.flags & 262144 && getConstraintOfType(source2) === target2) { + return -1; + } + if (source2.flags & 470302716 && target2.flags & 1048576) { + var types = target2.types; + var candidate = types.length === 2 && types[0].flags & 98304 ? types[1] : types.length === 3 && types[0].flags & 98304 && types[1].flags & 98304 ? types[2] : void 0; + if (candidate && !(candidate.flags & 98304)) { + target2 = getNormalizedType( + candidate, + /*writing*/ + true + ); + if (source2 === target2) + return -1; + } + } + if (relation === comparableRelation && !(target2.flags & 131072) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors ? reportError : void 0)) + return -1; + if (source2.flags & 469499904 || target2.flags & 469499904) { + var isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType(source2) && ts6.getObjectFlags(source2) & 8192); + if (isPerformingExcessPropertyChecks) { + if (hasExcessProperties(source2, target2, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage2, source2, originalTarget.aliasSymbol ? originalTarget : target2); + } + return 0; + } + } + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2) && source2.flags & (131068 | 524288 | 2097152) && source2 !== globalObjectType && target2.flags & (524288 | 2097152) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); + var isComparingJsxAttributes = !!(ts6.getObjectFlags(source2) & 2048); + if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) { + if (reportErrors) { + var sourceString = typeToString(originalSource.aliasSymbol ? originalSource : source2); + var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target2); + var calls = getSignaturesOfType( + source2, + 0 + /* SignatureKind.Call */ + ); + var constructs = getSignaturesOfType( + source2, + 1 + /* SignatureKind.Construct */ + ); + if (calls.length > 0 && isRelatedTo( + getReturnTypeOfSignature(calls[0]), + target2, + 1, + /*reportErrors*/ + false + ) || constructs.length > 0 && isRelatedTo( + getReturnTypeOfSignature(constructs[0]), + target2, + 1, + /*reportErrors*/ + false + )) { + reportError(ts6.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString); + } else { + reportError(ts6.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString); + } + } + return 0; + } + traceUnionsOrIntersectionsTooLarge(source2, target2); + var skipCaching = source2.flags & 1048576 && source2.types.length < 4 && !(target2.flags & 1048576) || target2.flags & 1048576 && target2.types.length < 4 && !(source2.flags & 469499904); + var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors, intersectionState, recursionFlags); + if (result_7) { + return result_7; + } + } + if (reportErrors) { + reportErrorResults(originalSource, originalTarget, source2, target2, headMessage2); + } + return 0; + } + function reportErrorResults(originalSource, originalTarget, source2, target2, headMessage2) { + var _a, _b; + var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource); + var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget); + source2 = originalSource.aliasSymbol || sourceHasBase ? originalSource : source2; + target2 = originalTarget.aliasSymbol || targetHasBase ? originalTarget : target2; + var maybeSuppress = overrideNextErrorInfo > 0; + if (maybeSuppress) { + overrideNextErrorInfo--; + } + if (source2.flags & 524288 && target2.flags & 524288) { + var currentError = errorInfo; + tryElaborateArrayLikeErrors( + source2, + target2, + /*reportErrors*/ + true + ); + if (errorInfo !== currentError) { + maybeSuppress = !!errorInfo; + } + } + if (source2.flags & 524288 && target2.flags & 131068) { + tryElaborateErrorsForPrimitivesAndObjects(source2, target2); + } else if (source2.symbol && source2.flags & 524288 && globalObjectType === source2) { + reportError(ts6.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); + } else if (ts6.getObjectFlags(source2) & 2048 && target2.flags & 2097152) { + var targetTypes = target2.types; + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode); + var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode); + if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) && (ts6.contains(targetTypes, intrinsicAttributes) || ts6.contains(targetTypes, intrinsicClassAttributes))) { + return; + } + } else { + errorInfo = elaborateNeverIntersection(errorInfo, originalTarget); + } + if (!headMessage2 && maybeSuppress) { + lastSkippedInfo = [source2, target2]; + return; + } + reportRelationError(headMessage2, source2, target2); + if (source2.flags & 262144 && ((_b = (_a = source2.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source2)) { + var syntheticParam = cloneTypeParameter(source2); + syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam)); + if (hasNonCircularBaseConstraint(syntheticParam)) { + var targetConstraintString = typeToString(target2, source2.symbol.declarations[0]); + associateRelatedInfo(ts6.createDiagnosticForNode(source2.symbol.declarations[0], ts6.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString)); + } + } + } + function traceUnionsOrIntersectionsTooLarge(source2, target2) { + if (!ts6.tracing) { + return; + } + if (source2.flags & 3145728 && target2.flags & 3145728) { + var sourceUnionOrIntersection = source2; + var targetUnionOrIntersection = target2; + if (sourceUnionOrIntersection.objectFlags & targetUnionOrIntersection.objectFlags & 32768) { + return; + } + var sourceSize = sourceUnionOrIntersection.types.length; + var targetSize = targetUnionOrIntersection.types.length; + if (sourceSize * targetSize > 1e6) { + ts6.tracing.instant("checkTypes", "traceUnionsOrIntersectionsTooLarge_DepthLimit", { + sourceId: source2.id, + sourceSize, + targetId: target2.id, + targetSize, + pos: errorNode === null || errorNode === void 0 ? void 0 : errorNode.pos, + end: errorNode === null || errorNode === void 0 ? void 0 : errorNode.end + }); + } + } + } + function getTypeOfPropertyInTypes(types, name) { + var appendPropType = function(propTypes, type) { + var _a; + type = getApparentType(type); + var prop = type.flags & 3145728 ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name); + var propType = prop && getTypeOfSymbol(prop) || ((_a = getApplicableIndexInfoForName(type, name)) === null || _a === void 0 ? void 0 : _a.type) || undefinedType; + return ts6.append(propTypes, propType); + }; + return getUnionType(ts6.reduceLeft( + types, + appendPropType, + /*initial*/ + void 0 + ) || ts6.emptyArray); + } + function hasExcessProperties(source2, target2, reportErrors) { + var _a; + if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && ts6.getObjectFlags(target2) & 4096) { + return false; + } + var isComparingJsxAttributes = !!(ts6.getObjectFlags(source2) & 2048); + if ((relation === assignableRelation || relation === comparableRelation) && (isTypeSubsetOf(globalObjectType, target2) || !isComparingJsxAttributes && isEmptyObjectType(target2))) { + return false; + } + var reducedTarget = target2; + var checkTypes; + if (target2.flags & 1048576) { + reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target2); + checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget]; + } + var _loop_20 = function(prop2) { + if (shouldCheckAsExcessProperty(prop2, source2.symbol) && !isIgnoredJsxProperty(source2, prop2)) { + if (!isKnownProperty(reducedTarget, prop2.escapedName, isComparingJsxAttributes)) { + if (reportErrors) { + var errorTarget = filterType(reducedTarget, isExcessPropertyCheckTarget); + if (!errorNode) + return { value: ts6.Debug.fail() }; + if (ts6.isJsxAttributes(errorNode) || ts6.isJsxOpeningLikeElement(errorNode) || ts6.isJsxOpeningLikeElement(errorNode.parent)) { + if (prop2.valueDeclaration && ts6.isJsxAttribute(prop2.valueDeclaration) && ts6.getSourceFileOfNode(errorNode) === ts6.getSourceFileOfNode(prop2.valueDeclaration.name)) { + errorNode = prop2.valueDeclaration.name; + } + var propName = symbolToString(prop2); + var suggestionSymbol = getSuggestedSymbolForNonexistentJSXAttribute(propName, errorTarget); + var suggestion = suggestionSymbol ? symbolToString(suggestionSymbol) : void 0; + if (suggestion) { + reportError(ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(errorTarget), suggestion); + } else { + reportError(ts6.Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget)); + } + } else { + var objectLiteralDeclaration_1 = ((_a = source2.symbol) === null || _a === void 0 ? void 0 : _a.declarations) && ts6.firstOrUndefined(source2.symbol.declarations); + var suggestion = void 0; + if (prop2.valueDeclaration && ts6.findAncestor(prop2.valueDeclaration, function(d) { + return d === objectLiteralDeclaration_1; + }) && ts6.getSourceFileOfNode(objectLiteralDeclaration_1) === ts6.getSourceFileOfNode(errorNode)) { + var propDeclaration = prop2.valueDeclaration; + ts6.Debug.assertNode(propDeclaration, ts6.isObjectLiteralElementLike); + errorNode = propDeclaration; + var name = propDeclaration.name; + if (ts6.isIdentifier(name)) { + suggestion = getSuggestionForNonexistentProperty(name, errorTarget); + } + } + if (suggestion !== void 0) { + reportError(ts6.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop2), typeToString(errorTarget), suggestion); + } else { + reportError(ts6.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop2), typeToString(errorTarget)); + } + } + } + return { value: true }; + } + if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop2), getTypeOfPropertyInTypes(checkTypes, prop2.escapedName), 3, reportErrors)) { + if (reportErrors) { + reportIncompatibleError(ts6.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop2)); + } + return { value: true }; + } + } + }; + for (var _i = 0, _b = getPropertiesOfType(source2); _i < _b.length; _i++) { + var prop = _b[_i]; + var state_6 = _loop_20(prop); + if (typeof state_6 === "object") + return state_6.value; + } + return false; + } + function shouldCheckAsExcessProperty(prop, container) { + return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration; + } + function unionOrIntersectionRelatedTo(source2, target2, reportErrors, intersectionState) { + if (source2.flags & 1048576) { + return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors && !(source2.flags & 131068), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors && !(source2.flags & 131068), intersectionState); + } + if (target2.flags & 1048576) { + return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors && !(source2.flags & 131068) && !(target2.flags & 131068)); + } + if (target2.flags & 2097152) { + return typeRelatedToEachType( + source2, + target2, + reportErrors, + 2 + /* IntersectionState.Target */ + ); + } + if (relation === comparableRelation && target2.flags & 131068) { + var constraints = ts6.sameMap(source2.types, function(t) { + return t.flags & 465829888 ? getBaseConstraintOfType(t) || unknownType : t; + }); + if (constraints !== source2.types) { + source2 = getIntersectionType(constraints); + if (source2.flags & 131072) { + return 0; + } + if (!(source2.flags & 2097152)) { + return isRelatedTo( + source2, + target2, + 1, + /*reportErrors*/ + false + ) || isRelatedTo( + target2, + source2, + 1, + /*reportErrors*/ + false + ); + } + } + } + return someTypeRelatedToType( + source2, + target2, + /*reportErrors*/ + false, + 1 + /* IntersectionState.Source */ + ); + } + function eachTypeRelatedToSomeType(source2, target2) { + var result2 = -1; + var sourceTypes = source2.types; + for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { + var sourceType = sourceTypes_1[_i]; + var related = typeRelatedToSomeType( + sourceType, + target2, + /*reportErrors*/ + false + ); + if (!related) { + return 0; + } + result2 &= related; + } + return result2; + } + function typeRelatedToSomeType(source2, target2, reportErrors) { + var targetTypes = target2.types; + if (target2.flags & 1048576) { + if (containsType(targetTypes, source2)) { + return -1; + } + var match = getMatchingUnionConstituentForType(target2, source2); + if (match) { + var related = isRelatedTo( + source2, + match, + 2, + /*reportErrors*/ + false + ); + if (related) { + return related; + } + } + } + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var type = targetTypes_1[_i]; + var related = isRelatedTo( + source2, + type, + 2, + /*reportErrors*/ + false + ); + if (related) { + return related; + } + } + if (reportErrors) { + var bestMatchingType = getBestMatchingType(source2, target2, isRelatedTo); + if (bestMatchingType) { + isRelatedTo( + source2, + bestMatchingType, + 2, + /*reportErrors*/ + true + ); + } + } + return 0; + } + function typeRelatedToEachType(source2, target2, reportErrors, intersectionState) { + var result2 = -1; + var targetTypes = target2.types; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var targetType = targetTypes_2[_i]; + var related = isRelatedTo( + source2, + targetType, + 2, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + if (!related) { + return 0; + } + result2 &= related; + } + return result2; + } + function someTypeRelatedToType(source2, target2, reportErrors, intersectionState) { + var sourceTypes = source2.types; + if (source2.flags & 1048576 && containsType(sourceTypes, target2)) { + return -1; + } + var len = sourceTypes.length; + for (var i = 0; i < len; i++) { + var related = isRelatedTo( + sourceTypes[i], + target2, + 1, + reportErrors && i === len - 1, + /*headMessage*/ + void 0, + intersectionState + ); + if (related) { + return related; + } + } + return 0; + } + function getUndefinedStrippedTargetIfNeeded(source2, target2) { + if (source2.flags & 1048576 && target2.flags & 1048576 && !(source2.types[0].flags & 32768) && target2.types[0].flags & 32768) { + return extractTypesOfKind( + target2, + ~32768 + /* TypeFlags.Undefined */ + ); + } + return target2; + } + function eachTypeRelatedToType(source2, target2, reportErrors, intersectionState) { + var result2 = -1; + var sourceTypes = source2.types; + var undefinedStrippedTarget = getUndefinedStrippedTargetIfNeeded(source2, target2); + for (var i = 0; i < sourceTypes.length; i++) { + var sourceType = sourceTypes[i]; + if (undefinedStrippedTarget.flags & 1048576 && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) { + var related_1 = isRelatedTo( + sourceType, + undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length], + 3, + /*reportErrors*/ + false, + /*headMessage*/ + void 0, + intersectionState + ); + if (related_1) { + result2 &= related_1; + continue; + } + } + var related = isRelatedTo( + sourceType, + target2, + 1, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + if (!related) { + return 0; + } + result2 &= related; + } + return result2; + } + function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, intersectionState) { + if (sources === void 0) { + sources = ts6.emptyArray; + } + if (targets === void 0) { + targets = ts6.emptyArray; + } + if (variances === void 0) { + variances = ts6.emptyArray; + } + if (sources.length !== targets.length && relation === identityRelation) { + return 0; + } + var length = sources.length <= targets.length ? sources.length : targets.length; + var result2 = -1; + for (var i = 0; i < length; i++) { + var varianceFlags = i < variances.length ? variances[i] : 1; + var variance = varianceFlags & 7; + if (variance !== 4) { + var s = sources[i]; + var t = targets[i]; + var related = -1; + if (varianceFlags & 8) { + related = relation === identityRelation ? isRelatedTo( + s, + t, + 3, + /*reportErrors*/ + false + ) : compareTypesIdentical(s, t); + } else if (variance === 1) { + related = isRelatedTo( + s, + t, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + } else if (variance === 2) { + related = isRelatedTo( + t, + s, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + } else if (variance === 3) { + related = isRelatedTo( + t, + s, + 3, + /*reportErrors*/ + false + ); + if (!related) { + related = isRelatedTo( + s, + t, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + } + } else { + related = isRelatedTo( + s, + t, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + if (related) { + related &= isRelatedTo( + t, + s, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + } + } + if (!related) { + return 0; + } + result2 &= related; + } + } + return result2; + } + function recursiveTypeRelatedTo(source2, target2, reportErrors, intersectionState, recursionFlags) { + if (overflow) { + return 0; + } + var id = getRelationKey( + source2, + target2, + intersectionState, + relation, + /*ingnoreConstraints*/ + false + ); + var entry = relation.get(id); + if (entry !== void 0) { + if (reportErrors && entry & 2 && !(entry & 4)) { + } else { + if (outofbandVarianceMarkerHandler) { + var saved = entry & 24; + if (saved & 8) { + instantiateType(source2, reportUnmeasurableMapper); + } + if (saved & 16) { + instantiateType(source2, reportUnreliableMapper); + } + } + return entry & 1 ? -1 : 0; + } + } + if (!maybeKeys) { + maybeKeys = []; + sourceStack = []; + targetStack = []; + } else { + var broadestEquivalentId = id.startsWith("*") ? getRelationKey( + source2, + target2, + intersectionState, + relation, + /*ignoreConstraints*/ + true + ) : void 0; + for (var i = 0; i < maybeCount; i++) { + if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { + return 3; + } + } + if (sourceDepth === 100 || targetDepth === 100) { + overflow = true; + return 0; + } + } + var maybeStart = maybeCount; + maybeKeys[maybeCount] = id; + maybeCount++; + var saveExpandingFlags = expandingFlags; + if (recursionFlags & 1) { + sourceStack[sourceDepth] = source2; + sourceDepth++; + if (!(expandingFlags & 1) && isDeeplyNestedType(source2, sourceStack, sourceDepth)) + expandingFlags |= 1; + } + if (recursionFlags & 2) { + targetStack[targetDepth] = target2; + targetDepth++; + if (!(expandingFlags & 2) && isDeeplyNestedType(target2, targetStack, targetDepth)) + expandingFlags |= 2; + } + var originalHandler; + var propagatingVarianceFlags = 0; + if (outofbandVarianceMarkerHandler) { + originalHandler = outofbandVarianceMarkerHandler; + outofbandVarianceMarkerHandler = function(onlyUnreliable) { + propagatingVarianceFlags |= onlyUnreliable ? 16 : 8; + return originalHandler(onlyUnreliable); + }; + } + var result2; + if (expandingFlags === 3) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "recursiveTypeRelatedTo_DepthLimit", { + sourceId: source2.id, + sourceIdStack: sourceStack.map(function(t) { + return t.id; + }), + targetId: target2.id, + targetIdStack: targetStack.map(function(t) { + return t.id; + }), + depth: sourceDepth, + targetDepth + }); + result2 = 3; + } else { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source2.id, targetId: target2.id }); + result2 = structuredTypeRelatedTo(source2, target2, reportErrors, intersectionState); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + if (outofbandVarianceMarkerHandler) { + outofbandVarianceMarkerHandler = originalHandler; + } + if (recursionFlags & 1) { + sourceDepth--; + } + if (recursionFlags & 2) { + targetDepth--; + } + expandingFlags = saveExpandingFlags; + if (result2) { + if (result2 === -1 || sourceDepth === 0 && targetDepth === 0) { + if (result2 === -1 || result2 === 3) { + for (var i = maybeStart; i < maybeCount; i++) { + relation.set(maybeKeys[i], 1 | propagatingVarianceFlags); + } + } + maybeCount = maybeStart; + } + } else { + relation.set(id, (reportErrors ? 4 : 0) | 2 | propagatingVarianceFlags); + maybeCount = maybeStart; + } + return result2; + } + function structuredTypeRelatedTo(source2, target2, reportErrors, intersectionState) { + var saveErrorInfo = captureErrorCalculationState(); + var result2 = structuredTypeRelatedToWorker(source2, target2, reportErrors, intersectionState, saveErrorInfo); + if (relation !== identityRelation) { + if (!result2 && (source2.flags & 2097152 || source2.flags & 262144 && target2.flags & 1048576)) { + var constraint = getEffectiveConstraintOfIntersection(source2.flags & 2097152 ? source2.types : [source2], !!(target2.flags & 1048576)); + if (constraint && everyType(constraint, function(c) { + return c !== source2; + })) { + result2 = isRelatedTo( + constraint, + target2, + 1, + /*reportErrors*/ + false, + /*headMessage*/ + void 0, + intersectionState + ); + } + } + if (result2 && !inPropertyCheck && (target2.flags & 2097152 && !isGenericObjectType(target2) && source2.flags & (524288 | 2097152) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 && getApparentType(source2).flags & 3670016 && !ts6.some(source2.types, function(t) { + return !!(ts6.getObjectFlags(t) & 262144); + }))) { + inPropertyCheck = true; + result2 &= propertiesRelatedTo( + source2, + target2, + reportErrors, + /*excludedProperties*/ + void 0, + 0 + /* IntersectionState.None */ + ); + inPropertyCheck = false; + } + } + if (result2) { + resetErrorInfo(saveErrorInfo); + } + return result2; + } + function structuredTypeRelatedToWorker(source2, target2, reportErrors, intersectionState, saveErrorInfo) { + var result2; + var originalErrorInfo; + var varianceCheckFailed = false; + var sourceFlags = source2.flags; + var targetFlags = target2.flags; + if (relation === identityRelation) { + if (sourceFlags & 3145728) { + var result_8 = eachTypeRelatedToSomeType(source2, target2); + if (result_8) { + result_8 &= eachTypeRelatedToSomeType(target2, source2); + } + return result_8; + } + if (sourceFlags & 4194304) { + return isRelatedTo( + source2.type, + target2.type, + 3, + /*reportErrors*/ + false + ); + } + if (sourceFlags & 8388608) { + if (result2 = isRelatedTo( + source2.objectType, + target2.objectType, + 3, + /*reportErrors*/ + false + )) { + if (result2 &= isRelatedTo( + source2.indexType, + target2.indexType, + 3, + /*reportErrors*/ + false + )) { + return result2; + } + } + } + if (sourceFlags & 16777216) { + if (source2.root.isDistributive === target2.root.isDistributive) { + if (result2 = isRelatedTo( + source2.checkType, + target2.checkType, + 3, + /*reportErrors*/ + false + )) { + if (result2 &= isRelatedTo( + source2.extendsType, + target2.extendsType, + 3, + /*reportErrors*/ + false + )) { + if (result2 &= isRelatedTo( + getTrueTypeFromConditionalType(source2), + getTrueTypeFromConditionalType(target2), + 3, + /*reportErrors*/ + false + )) { + if (result2 &= isRelatedTo( + getFalseTypeFromConditionalType(source2), + getFalseTypeFromConditionalType(target2), + 3, + /*reportErrors*/ + false + )) { + return result2; + } + } + } + } + } + } + if (sourceFlags & 33554432) { + if (result2 = isRelatedTo( + source2.baseType, + target2.baseType, + 3, + /*reportErrors*/ + false + )) { + if (result2 &= isRelatedTo( + source2.constraint, + target2.constraint, + 3, + /*reportErrors*/ + false + )) { + return result2; + } + } + } + if (!(sourceFlags & 524288)) { + return 0; + } + } else if (sourceFlags & 3145728 || targetFlags & 3145728) { + if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors, intersectionState)) { + return result2; + } + if (!(sourceFlags & 465829888 || sourceFlags & 524288 && targetFlags & 1048576 || sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) { + return 0; + } + } + if (sourceFlags & (524288 | 16777216) && source2.aliasSymbol && source2.aliasTypeArguments && source2.aliasSymbol === target2.aliasSymbol && !(isMarkerType(source2) || isMarkerType(target2))) { + var variances = getAliasVariances(source2.aliasSymbol); + if (variances === ts6.emptyArray) { + return 1; + } + var varianceResult = relateVariances(source2.aliasTypeArguments, target2.aliasTypeArguments, variances, intersectionState); + if (varianceResult !== void 0) { + return varianceResult; + } + } + if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo( + getTypeArguments(source2)[0], + target2, + 1 + /* RecursionFlags.Source */ + )) || isSingleElementGenericTupleType(target2) && (target2.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source2) || source2)) && (result2 = isRelatedTo( + source2, + getTypeArguments(target2)[0], + 2 + /* RecursionFlags.Target */ + ))) { + return result2; + } + if (targetFlags & 262144) { + if (ts6.getObjectFlags(source2) & 32 && !source2.declaration.nameType && isRelatedTo( + getIndexType(target2), + getConstraintTypeFromMappedType(source2), + 3 + /* RecursionFlags.Both */ + )) { + if (!(getMappedTypeModifiers(source2) & 4)) { + var templateType = getTemplateTypeFromMappedType(source2); + var indexedAccessType = getIndexedAccessType(target2, getTypeParameterFromMappedType(source2)); + if (result2 = isRelatedTo(templateType, indexedAccessType, 3, reportErrors)) { + return result2; + } + } + } + if (relation === comparableRelation && sourceFlags & 262144) { + var constraint = getConstraintOfTypeParameter(source2); + if (constraint && hasNonCircularBaseConstraint(source2)) { + while (constraint && someType(constraint, function(c2) { + return !!(c2.flags & 262144); + })) { + if (result2 = isRelatedTo( + constraint, + target2, + 1, + /*reportErrors*/ + false + )) { + return result2; + } + constraint = getConstraintOfTypeParameter(constraint); + } + } + return 0; + } + } else if (targetFlags & 4194304) { + var targetType_1 = target2.type; + if (sourceFlags & 4194304) { + if (result2 = isRelatedTo( + targetType_1, + source2.type, + 3, + /*reportErrors*/ + false + )) { + return result2; + } + } + if (isTupleType(targetType_1)) { + if (result2 = isRelatedTo(source2, getKnownKeysOfTupleType(targetType_1), 2, reportErrors)) { + return result2; + } + } else { + var constraint = getSimplifiedTypeOrConstraint(targetType_1); + if (constraint) { + if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2, reportErrors) === -1) { + return -1; + } + } else if (isGenericMappedType(targetType_1)) { + var nameType_1 = getNameTypeFromMappedType(targetType_1); + var constraintType = getConstraintTypeFromMappedType(targetType_1); + var targetKeys = void 0; + if (nameType_1 && isMappedTypeWithKeyofConstraintDeclaration(targetType_1)) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType_1)); + var mappedKeys_1 = []; + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType( + modifiersType, + 8576, + /*stringsOnly*/ + false, + function(t) { + return void mappedKeys_1.push(instantiateType(nameType_1, appendTypeMapping(targetType_1.mapper, getTypeParameterFromMappedType(targetType_1), t))); + } + ); + targetKeys = getUnionType(__spreadArray(__spreadArray([], mappedKeys_1, true), [nameType_1], false)); + } else { + targetKeys = nameType_1 || constraintType; + } + if (isRelatedTo(source2, targetKeys, 2, reportErrors) === -1) { + return -1; + } + } + } + } else if (targetFlags & 8388608) { + if (sourceFlags & 8388608) { + if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3, reportErrors)) { + result2 &= isRelatedTo(source2.indexType, target2.indexType, 3, reportErrors); + } + if (result2) { + return result2; + } + if (reportErrors) { + originalErrorInfo = errorInfo; + } + } + if (relation === assignableRelation || relation === comparableRelation) { + var objectType = target2.objectType; + var indexType = target2.indexType; + var baseObjectType = getBaseConstraintOfType(objectType) || objectType; + var baseIndexType = getBaseConstraintOfType(indexType) || indexType; + if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) { + var accessFlags = 4 | (baseObjectType !== objectType ? 2 : 0); + var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, accessFlags); + if (constraint) { + if (reportErrors && originalErrorInfo) { + resetErrorInfo(saveErrorInfo); + } + if (result2 = isRelatedTo( + source2, + constraint, + 2, + reportErrors, + /* headMessage */ + void 0, + intersectionState + )) { + return result2; + } + if (reportErrors && originalErrorInfo && errorInfo) { + errorInfo = countMessageChainBreadth([originalErrorInfo]) <= countMessageChainBreadth([errorInfo]) ? originalErrorInfo : errorInfo; + } + } + } + } + if (reportErrors) { + originalErrorInfo = void 0; + } + } else if (isGenericMappedType(target2) && relation !== identityRelation) { + var keysRemapped = !!target2.declaration.nameType; + var templateType = getTemplateTypeFromMappedType(target2); + var modifiers = getMappedTypeModifiers(target2); + if (!(modifiers & 8)) { + if (!keysRemapped && templateType.flags & 8388608 && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) { + return -1; + } + if (!isGenericMappedType(source2)) { + var targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2); + var sourceKeys = getIndexType( + source2, + /*stringsOnly*/ + void 0, + /*noIndexSignatures*/ + true + ); + var includeOptional = modifiers & 4; + var filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0; + if (includeOptional ? !(filteredByApplicability.flags & 131072) : isRelatedTo( + targetKeys, + sourceKeys, + 3 + /* RecursionFlags.Both */ + )) { + var templateType_1 = getTemplateTypeFromMappedType(target2); + var typeParameter = getTypeParameterFromMappedType(target2); + var nonNullComponent = extractTypesOfKind( + templateType_1, + ~98304 + /* TypeFlags.Nullable */ + ); + if (!keysRemapped && nonNullComponent.flags & 8388608 && nonNullComponent.indexType === typeParameter) { + if (result2 = isRelatedTo(source2, nonNullComponent.objectType, 2, reportErrors)) { + return result2; + } + } else { + var indexingType = keysRemapped ? filteredByApplicability || targetKeys : filteredByApplicability ? getIntersectionType([filteredByApplicability, typeParameter]) : typeParameter; + var indexedAccessType = getIndexedAccessType(source2, indexingType); + if (result2 = isRelatedTo(indexedAccessType, templateType_1, 3, reportErrors)) { + return result2; + } + } + } + originalErrorInfo = errorInfo; + resetErrorInfo(saveErrorInfo); + } + } + } else if (targetFlags & 16777216) { + if (isDeeplyNestedType(target2, targetStack, targetDepth, 10)) { + return 3; + } + var c = target2; + if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) { + var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType)); + var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType)); + if (result2 = skipTrue ? -1 : isRelatedTo( + source2, + getTrueTypeFromConditionalType(c), + 2, + /*reportErrors*/ + false, + /*headMessage*/ + void 0, + intersectionState + )) { + result2 &= skipFalse ? -1 : isRelatedTo( + source2, + getFalseTypeFromConditionalType(c), + 2, + /*reportErrors*/ + false, + /*headMessage*/ + void 0, + intersectionState + ); + if (result2) { + return result2; + } + } + } + } else if (targetFlags & 134217728) { + if (sourceFlags & 134217728) { + if (relation === comparableRelation) { + return templateLiteralTypesDefinitelyUnrelated(source2, target2) ? 0 : -1; + } + instantiateType(source2, reportUnreliableMapper); + } + if (isTypeMatchedByTemplateLiteralType(source2, target2)) { + return -1; + } + } else if (target2.flags & 268435456) { + if (!(source2.flags & 268435456)) { + if (isMemberOfStringMapping(source2, target2)) { + return -1; + } + } + } + if (sourceFlags & 8650752) { + if (!(sourceFlags & 8388608 && targetFlags & 8388608)) { + var constraint = getConstraintOfType(source2) || unknownType; + if (result2 = isRelatedTo( + constraint, + target2, + 1, + /*reportErrors*/ + false, + /*headMessage*/ + void 0, + intersectionState + )) { + return result2; + } else if (result2 = isRelatedTo( + getTypeWithThisArgument(constraint, source2), + target2, + 1, + reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), + /*headMessage*/ + void 0, + intersectionState + )) { + return result2; + } + if (isMappedTypeGenericIndexedAccess(source2)) { + var indexConstraint = getConstraintOfType(source2.indexType); + if (indexConstraint) { + if (result2 = isRelatedTo(getIndexedAccessType(source2.objectType, indexConstraint), target2, 1, reportErrors)) { + return result2; + } + } + } + } + } else if (sourceFlags & 4194304) { + if (result2 = isRelatedTo(keyofConstraintType, target2, 1, reportErrors)) { + return result2; + } + } else if (sourceFlags & 134217728 && !(targetFlags & 524288)) { + if (!(targetFlags & 134217728)) { + var constraint = getBaseConstraintOfType(source2); + if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1, reportErrors))) { + return result2; + } + } + } else if (sourceFlags & 268435456) { + if (targetFlags & 268435456) { + if (source2.symbol !== target2.symbol) { + return 0; + } + if (result2 = isRelatedTo(source2.type, target2.type, 3, reportErrors)) { + return result2; + } + } else { + var constraint = getBaseConstraintOfType(source2); + if (constraint && (result2 = isRelatedTo(constraint, target2, 1, reportErrors))) { + return result2; + } + } + } else if (sourceFlags & 16777216) { + if (isDeeplyNestedType(source2, sourceStack, sourceDepth, 10)) { + return 3; + } + if (targetFlags & 16777216) { + var sourceParams = source2.root.inferTypeParameters; + var sourceExtends = source2.extendsType; + var mapper = void 0; + if (sourceParams) { + var ctx = createInferenceContext( + sourceParams, + /*signature*/ + void 0, + 0, + isRelatedToWorker + ); + inferTypes( + ctx.inferences, + target2.extendsType, + sourceExtends, + 512 | 1024 + /* InferencePriority.AlwaysStrict */ + ); + sourceExtends = instantiateType(sourceExtends, ctx.mapper); + mapper = ctx.mapper; + } + if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo( + source2.checkType, + target2.checkType, + 3 + /* RecursionFlags.Both */ + ) || isRelatedTo( + target2.checkType, + source2.checkType, + 3 + /* RecursionFlags.Both */ + ))) { + if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2), 3, reportErrors)) { + result2 &= isRelatedTo(getFalseTypeFromConditionalType(source2), getFalseTypeFromConditionalType(target2), 3, reportErrors); + } + if (result2) { + return result2; + } + } + } else { + var distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0; + if (distributiveConstraint) { + if (result2 = isRelatedTo(distributiveConstraint, target2, 1, reportErrors)) { + return result2; + } + } + } + var defaultConstraint = getDefaultConstraintOfConditionalType(source2); + if (defaultConstraint) { + if (result2 = isRelatedTo(defaultConstraint, target2, 1, reportErrors)) { + return result2; + } + } + } else { + if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) { + return -1; + } + if (isGenericMappedType(target2)) { + if (isGenericMappedType(source2)) { + if (result2 = mappedTypeRelatedTo(source2, target2, reportErrors)) { + return result2; + } + } + return 0; + } + var sourceIsPrimitive = !!(sourceFlags & 131068); + if (relation !== identityRelation) { + source2 = getApparentType(source2); + sourceFlags = source2.flags; + } else if (isGenericMappedType(source2)) { + return 0; + } + if (ts6.getObjectFlags(source2) & 4 && ts6.getObjectFlags(target2) & 4 && source2.target === target2.target && !isTupleType(source2) && !(isMarkerType(source2) || isMarkerType(target2))) { + if (isEmptyArrayLiteralType(source2)) { + return -1; + } + var variances = getVariances(source2.target); + if (variances === ts6.emptyArray) { + return 1; + } + var varianceResult = relateVariances(getTypeArguments(source2), getTypeArguments(target2), variances, intersectionState); + if (varianceResult !== void 0) { + return varianceResult; + } + } else if (isReadonlyArrayType(target2) ? isArrayOrTupleType(source2) : isArrayType(target2) && isTupleType(source2) && !source2.target.readonly) { + if (relation !== identityRelation) { + return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3, reportErrors); + } else { + return 0; + } + } else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target2) && ts6.getObjectFlags(target2) & 8192 && !isEmptyObjectType(source2)) { + return 0; + } + if (sourceFlags & (524288 | 2097152) && targetFlags & 524288) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive; + result2 = propertiesRelatedTo( + source2, + target2, + reportStructuralErrors, + /*excludedProperties*/ + void 0, + intersectionState + ); + if (result2) { + result2 &= signaturesRelatedTo(source2, target2, 0, reportStructuralErrors); + if (result2) { + result2 &= signaturesRelatedTo(source2, target2, 1, reportStructuralErrors); + if (result2) { + result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState); + } + } + } + if (varianceCheckFailed && result2) { + errorInfo = originalErrorInfo || errorInfo || saveErrorInfo.errorInfo; + } else if (result2) { + return result2; + } + } + if (sourceFlags & (524288 | 2097152) && targetFlags & 1048576) { + var objectOnlyTarget = extractTypesOfKind( + target2, + 524288 | 2097152 | 33554432 + /* TypeFlags.Substitution */ + ); + if (objectOnlyTarget.flags & 1048576) { + var result_9 = typeRelatedToDiscriminatedType(source2, objectOnlyTarget); + if (result_9) { + return result_9; + } + } + } + } + return 0; + function countMessageChainBreadth(info) { + if (!info) + return 0; + return ts6.reduceLeft(info, function(value, chain2) { + return value + 1 + countMessageChainBreadth(chain2.next); + }, 0); + } + function relateVariances(sourceTypeArguments, targetTypeArguments, variances2, intersectionState2) { + if (result2 = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances2, reportErrors, intersectionState2)) { + return result2; + } + if (ts6.some(variances2, function(v) { + return !!(v & 24); + })) { + originalErrorInfo = void 0; + resetErrorInfo(saveErrorInfo); + return void 0; + } + var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances2); + varianceCheckFailed = !allowStructuralFallback; + if (variances2 !== ts6.emptyArray && !allowStructuralFallback) { + if (varianceCheckFailed && !(reportErrors && ts6.some(variances2, function(v) { + return (v & 7) === 0; + }))) { + return 0; + } + originalErrorInfo = errorInfo; + resetErrorInfo(saveErrorInfo); + } + } + } + function mappedTypeRelatedTo(source2, target2, reportErrors) { + var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) : getCombinedMappedTypeOptionality(source2) <= getCombinedMappedTypeOptionality(target2)); + if (modifiersRelated) { + var result_10; + var targetConstraint = getConstraintTypeFromMappedType(target2); + var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2), getCombinedMappedTypeOptionality(source2) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper); + if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3, reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source2)], [getTypeParameterFromMappedType(target2)]); + if (instantiateType(getNameTypeFromMappedType(source2), mapper) === instantiateType(getNameTypeFromMappedType(target2), mapper)) { + return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source2), mapper), getTemplateTypeFromMappedType(target2), 3, reportErrors); + } + } + } + return 0; + } + function typeRelatedToDiscriminatedType(source2, target2) { + var sourceProperties = getPropertiesOfType(source2); + var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target2); + if (!sourcePropertiesFiltered) + return 0; + var numCombinations = 1; + for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) { + var sourceProperty = sourcePropertiesFiltered_1[_i]; + numCombinations *= countTypes(getNonMissingTypeOfSymbol(sourceProperty)); + if (numCombinations > 25) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source2.id, targetId: target2.id, numCombinations }); + return 0; + } + } + var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length); + var excludedProperties = new ts6.Set(); + for (var i = 0; i < sourcePropertiesFiltered.length; i++) { + var sourceProperty = sourcePropertiesFiltered[i]; + var sourcePropertyType = getNonMissingTypeOfSymbol(sourceProperty); + sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 ? sourcePropertyType.types : [sourcePropertyType]; + excludedProperties.add(sourceProperty.escapedName); + } + var discriminantCombinations = ts6.cartesianProduct(sourceDiscriminantTypes); + var matchingTypes = []; + var _loop_21 = function(combination2) { + var hasMatch = false; + outer: + for (var _c = 0, _d = target2.types; _c < _d.length; _c++) { + var type2 = _d[_c]; + var _loop_22 = function(i3) { + var sourceProperty2 = sourcePropertiesFiltered[i3]; + var targetProperty = getPropertyOfType(type2, sourceProperty2.escapedName); + if (!targetProperty) + return "continue-outer"; + if (sourceProperty2 === targetProperty) + return "continue"; + var related = propertyRelatedTo( + source2, + target2, + sourceProperty2, + targetProperty, + function(_) { + return combination2[i3]; + }, + /*reportErrors*/ + false, + 0, + /*skipOptional*/ + strictNullChecks || relation === comparableRelation + ); + if (!related) { + return "continue-outer"; + } + }; + for (var i2 = 0; i2 < sourcePropertiesFiltered.length; i2++) { + var state_8 = _loop_22(i2); + switch (state_8) { + case "continue-outer": + continue outer; + } + } + ts6.pushIfUnique(matchingTypes, type2, ts6.equateValues); + hasMatch = true; + } + if (!hasMatch) { + return { + value: 0 + /* Ternary.False */ + }; + } + }; + for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { + var combination = discriminantCombinations_1[_a]; + var state_7 = _loop_21(combination); + if (typeof state_7 === "object") + return state_7.value; + } + var result2 = -1; + for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) { + var type = matchingTypes_1[_b]; + result2 &= propertiesRelatedTo( + source2, + type, + /*reportErrors*/ + false, + excludedProperties, + 0 + /* IntersectionState.None */ + ); + if (result2) { + result2 &= signaturesRelatedTo( + source2, + type, + 0, + /*reportStructuralErrors*/ + false + ); + if (result2) { + result2 &= signaturesRelatedTo( + source2, + type, + 1, + /*reportStructuralErrors*/ + false + ); + if (result2 && !(isTupleType(source2) && isTupleType(type))) { + result2 &= indexSignaturesRelatedTo( + source2, + type, + /*sourceIsPrimitive*/ + false, + /*reportStructuralErrors*/ + false, + 0 + /* IntersectionState.None */ + ); + } + } + } + if (!result2) { + return result2; + } + } + return result2; + } + function excludeProperties(properties, excludedProperties) { + if (!excludedProperties || properties.length === 0) + return properties; + var result2; + for (var i = 0; i < properties.length; i++) { + if (!excludedProperties.has(properties[i].escapedName)) { + if (result2) { + result2.push(properties[i]); + } + } else if (!result2) { + result2 = properties.slice(0, i); + } + } + return result2 || properties; + } + function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState) { + var targetIsOptional = strictNullChecks && !!(ts6.getCheckFlags(targetProp) & 48); + var effectiveTarget = addOptionality( + getNonMissingTypeOfSymbol(targetProp), + /*isProperty*/ + false, + targetIsOptional + ); + var effectiveSource = getTypeOfSourceProperty(sourceProp); + return isRelatedTo( + effectiveSource, + effectiveTarget, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + } + function propertyRelatedTo(source2, target2, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState, skipOptional) { + var sourcePropFlags = ts6.getDeclarationModifierFlagsFromSymbol(sourceProp); + var targetPropFlags = ts6.getDeclarationModifierFlagsFromSymbol(targetProp); + if (sourcePropFlags & 8 || targetPropFlags & 8) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourcePropFlags & 8 && targetPropFlags & 8) { + reportError(ts6.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } else { + reportError(ts6.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source2 : target2), typeToString(sourcePropFlags & 8 ? target2 : source2)); + } + } + return 0; + } + } else if (targetPropFlags & 16) { + if (!isValidOverrideOf(sourceProp, targetProp)) { + if (reportErrors) { + reportError(ts6.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source2), typeToString(getDeclaringClass(targetProp) || target2)); + } + return 0; + } + } else if (sourcePropFlags & 16) { + if (reportErrors) { + reportError(ts6.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2)); + } + return 0; + } + if (relation === strictSubtypeRelation && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) { + return 0; + } + var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState); + if (!related) { + if (reportErrors) { + reportIncompatibleError(ts6.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0; + } + if (!skipOptional && sourceProp.flags & 16777216 && targetProp.flags & 106500 && !(targetProp.flags & 16777216)) { + if (reportErrors) { + reportError(ts6.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2)); + } + return 0; + } + return related; + } + function reportUnmatchedProperty(source2, target2, unmatchedProperty, requireOptionalProperties) { + var shouldSkipElaboration = false; + if (unmatchedProperty.valueDeclaration && ts6.isNamedDeclaration(unmatchedProperty.valueDeclaration) && ts6.isPrivateIdentifier(unmatchedProperty.valueDeclaration.name) && source2.symbol && source2.symbol.flags & 32) { + var privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText; + var symbolTableKey = ts6.getSymbolNameForPrivateIdentifier(source2.symbol, privateIdentifierDescription); + if (symbolTableKey && getPropertyOfType(source2, symbolTableKey)) { + var sourceName = ts6.factory.getDeclarationName(source2.symbol.valueDeclaration); + var targetName = ts6.factory.getDeclarationName(target2.symbol.valueDeclaration); + reportError(ts6.Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2, diagnosticName(privateIdentifierDescription), diagnosticName(sourceName.escapedText === "" ? anon : sourceName), diagnosticName(targetName.escapedText === "" ? anon : targetName)); + return; + } + } + var props = ts6.arrayFrom(getUnmatchedProperties( + source2, + target2, + requireOptionalProperties, + /*matchDiscriminantProperties*/ + false + )); + if (!headMessage || headMessage.code !== ts6.Diagnostics.Class_0_incorrectly_implements_interface_1.code && headMessage.code !== ts6.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code) { + shouldSkipElaboration = true; + } + if (props.length === 1) { + var propName = symbolToString( + unmatchedProperty, + /*enclosingDeclaration*/ + void 0, + 0, + 4 | 16 + /* SymbolFormatFlags.WriteComputedProps */ + ); + reportError.apply(void 0, __spreadArray([ts6.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source2, target2), false)); + if (ts6.length(unmatchedProperty.declarations)) { + associateRelatedInfo(ts6.createDiagnosticForNode(unmatchedProperty.declarations[0], ts6.Diagnostics._0_is_declared_here, propName)); + } + if (shouldSkipElaboration && errorInfo) { + overrideNextErrorInfo++; + } + } else if (tryElaborateArrayLikeErrors( + source2, + target2, + /*reportErrors*/ + false + )) { + if (props.length > 5) { + reportError(ts6.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source2), typeToString(target2), ts6.map(props.slice(0, 4), function(p) { + return symbolToString(p); + }).join(", "), props.length - 4); + } else { + reportError(ts6.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source2), typeToString(target2), ts6.map(props, function(p) { + return symbolToString(p); + }).join(", ")); + } + if (shouldSkipElaboration && errorInfo) { + overrideNextErrorInfo++; + } + } + } + function propertiesRelatedTo(source2, target2, reportErrors, excludedProperties, intersectionState) { + if (relation === identityRelation) { + return propertiesIdenticalTo(source2, target2, excludedProperties); + } + var result2 = -1; + if (isTupleType(target2)) { + if (isArrayOrTupleType(source2)) { + if (!target2.target.readonly && (isReadonlyArrayType(source2) || isTupleType(source2) && source2.target.readonly)) { + return 0; + } + var sourceArity = getTypeReferenceArity(source2); + var targetArity = getTypeReferenceArity(target2); + var sourceRestFlag = isTupleType(source2) ? source2.target.combinedFlags & 4 : 4; + var targetRestFlag = target2.target.combinedFlags & 4; + var sourceMinLength = isTupleType(source2) ? source2.target.minLength : 0; + var targetMinLength = target2.target.minLength; + if (!sourceRestFlag && sourceArity < targetMinLength) { + if (reportErrors) { + reportError(ts6.Diagnostics.Source_has_0_element_s_but_target_requires_1, sourceArity, targetMinLength); + } + return 0; + } + if (!targetRestFlag && targetArity < sourceMinLength) { + if (reportErrors) { + reportError(ts6.Diagnostics.Source_has_0_element_s_but_target_allows_only_1, sourceMinLength, targetArity); + } + return 0; + } + if (!targetRestFlag && (sourceRestFlag || targetArity < sourceArity)) { + if (reportErrors) { + if (sourceMinLength < targetMinLength) { + reportError(ts6.Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer, targetMinLength); + } else { + reportError(ts6.Diagnostics.Target_allows_only_0_element_s_but_source_may_have_more, targetArity); + } + } + return 0; + } + var sourceTypeArguments = getTypeArguments(source2); + var targetTypeArguments = getTypeArguments(target2); + var startCount = Math.min(isTupleType(source2) ? getStartElementCount( + source2.target, + 11 + /* ElementFlags.NonRest */ + ) : 0, getStartElementCount( + target2.target, + 11 + /* ElementFlags.NonRest */ + )); + var endCount = Math.min(isTupleType(source2) ? getEndElementCount( + source2.target, + 11 + /* ElementFlags.NonRest */ + ) : 0, targetRestFlag ? getEndElementCount( + target2.target, + 11 + /* ElementFlags.NonRest */ + ) : 0); + var canExcludeDiscriminants = !!excludedProperties; + for (var i = 0; i < targetArity; i++) { + var sourceIndex = i < targetArity - endCount ? i : i + sourceArity - targetArity; + var sourceFlags = isTupleType(source2) && (i < startCount || i >= targetArity - endCount) ? source2.target.elementFlags[sourceIndex] : 4; + var targetFlags = target2.target.elementFlags[i]; + if (targetFlags & 8 && !(sourceFlags & 8)) { + if (reportErrors) { + reportError(ts6.Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, i); + } + return 0; + } + if (sourceFlags & 8 && !(targetFlags & 12)) { + if (reportErrors) { + reportError(ts6.Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourceIndex, i); + } + return 0; + } + if (targetFlags & 1 && !(sourceFlags & 1)) { + if (reportErrors) { + reportError(ts6.Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, i); + } + return 0; + } + if (canExcludeDiscriminants) { + if (sourceFlags & 12 || targetFlags & 12) { + canExcludeDiscriminants = false; + } + if (canExcludeDiscriminants && (excludedProperties === null || excludedProperties === void 0 ? void 0 : excludedProperties.has("" + i))) { + continue; + } + } + var sourceType = !isTupleType(source2) ? sourceTypeArguments[0] : i < startCount || i >= targetArity - endCount ? removeMissingType(sourceTypeArguments[sourceIndex], !!(sourceFlags & targetFlags & 2)) : getElementTypeOfSliceOfTupleType(source2, startCount, endCount) || neverType; + var targetType = targetTypeArguments[i]; + var targetCheckType = sourceFlags & 8 && targetFlags & 4 ? createArrayType(targetType) : removeMissingType(targetType, !!(targetFlags & 2)); + var related = isRelatedTo( + sourceType, + targetCheckType, + 3, + reportErrors, + /*headMessage*/ + void 0, + intersectionState + ); + if (!related) { + if (reportErrors && (targetArity > 1 || sourceArity > 1)) { + if (i < startCount || i >= targetArity - endCount || sourceArity - startCount - endCount === 1) { + reportIncompatibleError(ts6.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourceIndex, i); + } else { + reportIncompatibleError(ts6.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, startCount, sourceArity - endCount - 1, i); + } + } + return 0; + } + result2 &= related; + } + return result2; + } + if (target2.target.combinedFlags & 12) { + return 0; + } + } + var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source2) && !isEmptyArrayLiteralType(source2) && !isTupleType(source2); + var unmatchedProperty = getUnmatchedProperty( + source2, + target2, + requireOptionalProperties, + /*matchDiscriminantProperties*/ + false + ); + if (unmatchedProperty) { + if (reportErrors && shouldReportUnmatchedPropertyError(source2, target2)) { + reportUnmatchedProperty(source2, target2, unmatchedProperty, requireOptionalProperties); + } + return 0; + } + if (isObjectLiteralType(target2)) { + for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source2), excludedProperties); _i < _a.length; _i++) { + var sourceProp = _a[_i]; + if (!getPropertyOfObjectType(target2, sourceProp.escapedName)) { + var sourceType = getTypeOfSymbol(sourceProp); + if (!(sourceType.flags & 32768)) { + if (reportErrors) { + reportError(ts6.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target2)); + } + return 0; + } + } + } + } + var properties = getPropertiesOfType(target2); + var numericNamesOnly = isTupleType(source2) && isTupleType(target2); + for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) { + var targetProp = _c[_b]; + var name = targetProp.escapedName; + if (!(targetProp.flags & 4194304) && (!numericNamesOnly || ts6.isNumericLiteralName(name) || name === "length")) { + var sourceProp = getPropertyOfType(source2, name); + if (sourceProp && sourceProp !== targetProp) { + var related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors, intersectionState, relation === comparableRelation); + if (!related) { + return 0; + } + result2 &= related; + } + } + } + return result2; + } + function propertiesIdenticalTo(source2, target2, excludedProperties) { + if (!(source2.flags & 524288 && target2.flags & 524288)) { + return 0; + } + var sourceProperties = excludeProperties(getPropertiesOfObjectType(source2), excludedProperties); + var targetProperties = excludeProperties(getPropertiesOfObjectType(target2), excludedProperties); + if (sourceProperties.length !== targetProperties.length) { + return 0; + } + var result2 = -1; + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProp = sourceProperties_1[_i]; + var targetProp = getPropertyOfObjectType(target2, sourceProp.escapedName); + if (!targetProp) { + return 0; + } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0; + } + result2 &= related; + } + return result2; + } + function signaturesRelatedTo(source2, target2, kind, reportErrors) { + var _a, _b; + if (relation === identityRelation) { + return signaturesIdenticalTo(source2, target2, kind); + } + if (target2 === anyFunctionType || source2 === anyFunctionType) { + return -1; + } + var sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration); + var targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration); + var sourceSignatures = getSignaturesOfType(source2, sourceIsJSConstructor && kind === 1 ? 0 : kind); + var targetSignatures = getSignaturesOfType(target2, targetIsJSConstructor && kind === 1 ? 0 : kind); + if (kind === 1 && sourceSignatures.length && targetSignatures.length) { + var sourceIsAbstract = !!(sourceSignatures[0].flags & 4); + var targetIsAbstract = !!(targetSignatures[0].flags & 4); + if (sourceIsAbstract && !targetIsAbstract) { + if (reportErrors) { + reportError(ts6.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0; + } + if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) { + return 0; + } + } + var result2 = -1; + var incompatibleReporter = kind === 1 ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn; + var sourceObjectFlags = ts6.getObjectFlags(source2); + var targetObjectFlags = ts6.getObjectFlags(target2); + if (sourceObjectFlags & 64 && targetObjectFlags & 64 && source2.symbol === target2.symbol || sourceObjectFlags & 4 && targetObjectFlags & 4 && source2.target === target2.target) { + for (var i = 0; i < targetSignatures.length; i++) { + var related = signatureRelatedTo( + sourceSignatures[i], + targetSignatures[i], + /*erase*/ + true, + reportErrors, + incompatibleReporter(sourceSignatures[i], targetSignatures[i]) + ); + if (!related) { + return 0; + } + result2 &= related; + } + } else if (sourceSignatures.length === 1 && targetSignatures.length === 1) { + var eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks; + var sourceSignature = ts6.first(sourceSignatures); + var targetSignature = ts6.first(targetSignatures); + result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); + if (!result2 && reportErrors && kind === 1 && sourceObjectFlags & targetObjectFlags && (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173)) { + var constructSignatureToString = function(signature) { + return signatureToString( + signature, + /*enclosingDeclaration*/ + void 0, + 262144, + kind + ); + }; + reportError(ts6.Diagnostics.Type_0_is_not_assignable_to_type_1, constructSignatureToString(sourceSignature), constructSignatureToString(targetSignature)); + reportError(ts6.Diagnostics.Types_of_construct_signatures_are_incompatible); + return result2; + } + } else { + outer: + for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) { + var t = targetSignatures_1[_i]; + var saveErrorInfo = captureErrorCalculationState(); + var shouldElaborateErrors = reportErrors; + for (var _c = 0, sourceSignatures_1 = sourceSignatures; _c < sourceSignatures_1.length; _c++) { + var s = sourceSignatures_1[_c]; + var related = signatureRelatedTo( + s, + t, + /*erase*/ + true, + shouldElaborateErrors, + incompatibleReporter(s, t) + ); + if (related) { + result2 &= related; + resetErrorInfo(saveErrorInfo); + continue outer; + } + shouldElaborateErrors = false; + } + if (shouldElaborateErrors) { + reportError(ts6.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source2), signatureToString( + t, + /*enclosingDeclaration*/ + void 0, + /*flags*/ + void 0, + kind + )); + } + return 0; + } + } + return result2; + } + function shouldReportUnmatchedPropertyError(source2, target2) { + var typeCallSignatures = getSignaturesOfStructuredType( + source2, + 0 + /* SignatureKind.Call */ + ); + var typeConstructSignatures = getSignaturesOfStructuredType( + source2, + 1 + /* SignatureKind.Construct */ + ); + var typeProperties = getPropertiesOfObjectType(source2); + if ((typeCallSignatures.length || typeConstructSignatures.length) && !typeProperties.length) { + if (getSignaturesOfType( + target2, + 0 + /* SignatureKind.Call */ + ).length && typeCallSignatures.length || getSignaturesOfType( + target2, + 1 + /* SignatureKind.Construct */ + ).length && typeConstructSignatures.length) { + return true; + } + return false; + } + return true; + } + function reportIncompatibleCallSignatureReturn(siga, sigb) { + if (siga.parameters.length === 0 && sigb.parameters.length === 0) { + return function(source2, target2) { + return reportIncompatibleError(ts6.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source2), typeToString(target2)); + }; + } + return function(source2, target2) { + return reportIncompatibleError(ts6.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2)); + }; + } + function reportIncompatibleConstructSignatureReturn(siga, sigb) { + if (siga.parameters.length === 0 && sigb.parameters.length === 0) { + return function(source2, target2) { + return reportIncompatibleError(ts6.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source2), typeToString(target2)); + }; + } + return function(source2, target2) { + return reportIncompatibleError(ts6.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2)); + }; + } + function signatureRelatedTo(source2, target2, erase, reportErrors, incompatibleReporter) { + return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, relation === strictSubtypeRelation ? 8 : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper); + } + function signaturesIdenticalTo(source2, target2, kind) { + var sourceSignatures = getSignaturesOfType(source2, kind); + var targetSignatures = getSignaturesOfType(target2, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return 0; + } + var result2 = -1; + for (var i = 0; i < sourceSignatures.length; i++) { + var related = compareSignaturesIdentical( + sourceSignatures[i], + targetSignatures[i], + /*partialMatch*/ + false, + /*ignoreThisTypes*/ + false, + /*ignoreReturnTypes*/ + false, + isRelatedTo + ); + if (!related) { + return 0; + } + result2 &= related; + } + return result2; + } + function membersRelatedToIndexInfo(source2, targetInfo, reportErrors) { + var result2 = -1; + var keyType = targetInfo.keyType; + var props = source2.flags & 2097152 ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2); + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; + if (isIgnoredJsxProperty(source2, prop)) { + continue; + } + if (isApplicableIndexType(getLiteralTypeFromProperty( + prop, + 8576 + /* TypeFlags.StringOrNumberLiteralOrUnique */ + ), keyType)) { + var propType = getNonMissingTypeOfSymbol(prop); + var type = exactOptionalPropertyTypes || propType.flags & 32768 || keyType === numberType || !(prop.flags & 16777216) ? propType : getTypeWithFacts( + propType, + 524288 + /* TypeFacts.NEUndefined */ + ); + var related = isRelatedTo(type, targetInfo.type, 3, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts6.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); + } + return 0; + } + result2 &= related; + } + } + for (var _a = 0, _b = getIndexInfosOfType(source2); _a < _b.length; _a++) { + var info = _b[_a]; + if (isApplicableIndexType(info.keyType, keyType)) { + var related = indexInfoRelatedTo(info, targetInfo, reportErrors); + if (!related) { + return 0; + } + result2 &= related; + } + } + return result2; + } + function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) { + var related = isRelatedTo(sourceInfo.type, targetInfo.type, 3, reportErrors); + if (!related && reportErrors) { + if (sourceInfo.keyType === targetInfo.keyType) { + reportError(ts6.Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType)); + } else { + reportError(ts6.Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType)); + } + } + return related; + } + function indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportErrors, intersectionState) { + if (relation === identityRelation) { + return indexSignaturesIdenticalTo(source2, target2); + } + var indexInfos = getIndexInfosOfType(target2); + var targetHasStringIndex = ts6.some(indexInfos, function(info) { + return info.keyType === stringType; + }); + var result2 = -1; + for (var _i = 0, indexInfos_5 = indexInfos; _i < indexInfos_5.length; _i++) { + var targetInfo = indexInfos_5[_i]; + var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 ? -1 : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3, reportErrors) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors, intersectionState); + if (!related) { + return 0; + } + result2 &= related; + } + return result2; + } + function typeRelatedToIndexInfo(source2, targetInfo, reportErrors, intersectionState) { + var sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType); + if (sourceInfo) { + return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); + } + if (!(intersectionState & 1) && isObjectTypeWithInferableIndex(source2)) { + return membersRelatedToIndexInfo(source2, targetInfo, reportErrors); + } + if (reportErrors) { + reportError(ts6.Diagnostics.Index_signature_for_type_0_is_missing_in_type_1, typeToString(targetInfo.keyType), typeToString(source2)); + } + return 0; + } + function indexSignaturesIdenticalTo(source2, target2) { + var sourceInfos = getIndexInfosOfType(source2); + var targetInfos = getIndexInfosOfType(target2); + if (sourceInfos.length !== targetInfos.length) { + return 0; + } + for (var _i = 0, targetInfos_1 = targetInfos; _i < targetInfos_1.length; _i++) { + var targetInfo = targetInfos_1[_i]; + var sourceInfo = getIndexInfoOfType(source2, targetInfo.keyType); + if (!(sourceInfo && isRelatedTo( + sourceInfo.type, + targetInfo.type, + 3 + /* RecursionFlags.Both */ + ) && sourceInfo.isReadonly === targetInfo.isReadonly)) { + return 0; + } + } + return -1; + } + function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) { + if (!sourceSignature.declaration || !targetSignature.declaration) { + return true; + } + var sourceAccessibility = ts6.getSelectedEffectiveModifierFlags( + sourceSignature.declaration, + 24 + /* ModifierFlags.NonPublicAccessibilityModifier */ + ); + var targetAccessibility = ts6.getSelectedEffectiveModifierFlags( + targetSignature.declaration, + 24 + /* ModifierFlags.NonPublicAccessibilityModifier */ + ); + if (targetAccessibility === 8) { + return true; + } + if (targetAccessibility === 16 && sourceAccessibility !== 8) { + return true; + } + if (targetAccessibility !== 16 && !sourceAccessibility) { + return true; + } + if (reportErrors) { + reportError(ts6.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); + } + return false; + } + } + function typeCouldHaveTopLevelSingletonTypes(type) { + if (type.flags & 16) { + return false; + } + if (type.flags & 3145728) { + return !!ts6.forEach(type.types, typeCouldHaveTopLevelSingletonTypes); + } + if (type.flags & 465829888) { + var constraint = getConstraintOfType(type); + if (constraint && constraint !== type) { + return typeCouldHaveTopLevelSingletonTypes(constraint); + } + } + return isUnitType(type) || !!(type.flags & 134217728) || !!(type.flags & 268435456); + } + function getExactOptionalUnassignableProperties(source, target) { + if (isTupleType(source) && isTupleType(target)) + return ts6.emptyArray; + return getPropertiesOfType(target).filter(function(targetProp) { + return isExactOptionalPropertyMismatch(getTypeOfPropertyOfType(source, targetProp.escapedName), getTypeOfSymbol(targetProp)); + }); + } + function isExactOptionalPropertyMismatch(source, target) { + return !!source && !!target && maybeTypeOfKind( + source, + 32768 + /* TypeFlags.Undefined */ + ) && !!containsMissingType(target); + } + function getExactOptionalProperties(type) { + return getPropertiesOfType(type).filter(function(targetProp) { + return containsMissingType(getTypeOfSymbol(targetProp)); + }); + } + function getBestMatchingType(source, target, isRelatedTo) { + if (isRelatedTo === void 0) { + isRelatedTo = compareTypesAssignable; + } + return findMatchingDiscriminantType( + source, + target, + isRelatedTo, + /*skipPartial*/ + true + ) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target); + } + function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue, skipPartial) { + var discriminable = target.types.map(function(_) { + return void 0; + }); + for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) { + var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1]; + var targetProp = getUnionOrIntersectionProperty(target, propertyName); + if (skipPartial && targetProp && ts6.getCheckFlags(targetProp) & 16) { + continue; + } + var i = 0; + for (var _b = 0, _c = target.types; _b < _c.length; _b++) { + var type = _c[_b]; + var targetType = getTypeOfPropertyOfType(type, propertyName); + if (targetType && related(getDiscriminatingType(), targetType)) { + discriminable[i] = discriminable[i] === void 0 ? true : discriminable[i]; + } else { + discriminable[i] = false; + } + i++; + } + } + var match = discriminable.indexOf( + /*searchElement*/ + true + ); + if (match === -1) { + return defaultValue; + } + var nextMatch = discriminable.indexOf( + /*searchElement*/ + true, + match + 1 + ); + while (nextMatch !== -1) { + if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) { + return defaultValue; + } + nextMatch = discriminable.indexOf( + /*searchElement*/ + true, + nextMatch + 1 + ); + } + return target.types[match]; + } + function isWeakType(type) { + if (type.flags & 524288) { + var resolved = resolveStructuredTypeMembers(type); + return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 && resolved.properties.length > 0 && ts6.every(resolved.properties, function(p) { + return !!(p.flags & 16777216); + }); + } + if (type.flags & 2097152) { + return ts6.every(type.types, isWeakType); + } + return false; + } + function hasCommonProperties(source, target, isComparingJsxAttributes) { + for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) { + return true; + } + } + return false; + } + function getVariances(type) { + return type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & 8 ? arrayVariances : getVariancesWorker(type.symbol, type.typeParameters); + } + function getAliasVariances(symbol) { + return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters); + } + function getVariancesWorker(symbol, typeParameters) { + if (typeParameters === void 0) { + typeParameters = ts6.emptyArray; + } + var links = getSymbolLinks(symbol); + if (!links.variances) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); + links.variances = ts6.emptyArray; + var variances = []; + var _loop_23 = function(tp2) { + var modifiers = getVarianceModifiers(tp2); + var variance = modifiers & 65536 ? modifiers & 32768 ? 0 : 1 : modifiers & 32768 ? 2 : void 0; + if (variance === void 0) { + var unmeasurable_1 = false; + var unreliable_1 = false; + var oldHandler = outofbandVarianceMarkerHandler; + outofbandVarianceMarkerHandler = function(onlyUnreliable) { + return onlyUnreliable ? unreliable_1 = true : unmeasurable_1 = true; + }; + var typeWithSuper = createMarkerType(symbol, tp2, markerSuperType); + var typeWithSub = createMarkerType(symbol, tp2, markerSubType); + variance = (isTypeAssignableTo(typeWithSub, typeWithSuper) ? 1 : 0) | (isTypeAssignableTo(typeWithSuper, typeWithSub) ? 2 : 0); + if (variance === 3 && isTypeAssignableTo(createMarkerType(symbol, tp2, markerOtherType), typeWithSuper)) { + variance = 4; + } + outofbandVarianceMarkerHandler = oldHandler; + if (unmeasurable_1 || unreliable_1) { + if (unmeasurable_1) { + variance |= 8; + } + if (unreliable_1) { + variance |= 16; + } + } + } + variances.push(variance); + }; + for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { + var tp = typeParameters_2[_i]; + _loop_23(tp); + } + links.variances = variances; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop({ variances: variances.map(ts6.Debug.formatVariance) }); + } + return links.variances; + } + function createMarkerType(symbol, source, target) { + var mapper = makeUnaryTypeMapper(source, target); + var type = getDeclaredTypeOfSymbol(symbol); + if (isErrorType(type)) { + return type; + } + var result = symbol.flags & 524288 ? getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters, mapper)) : createTypeReference(type, instantiateTypes(type.typeParameters, mapper)); + markerTypes.add(getTypeId(result)); + return result; + } + function isMarkerType(type) { + return markerTypes.has(getTypeId(type)); + } + function getVarianceModifiers(tp) { + var _a, _b; + return (ts6.some((_a = tp.symbol) === null || _a === void 0 ? void 0 : _a.declarations, function(d) { + return ts6.hasSyntacticModifier( + d, + 32768 + /* ModifierFlags.In */ + ); + }) ? 32768 : 0) | (ts6.some((_b = tp.symbol) === null || _b === void 0 ? void 0 : _b.declarations, function(d) { + return ts6.hasSyntacticModifier( + d, + 65536 + /* ModifierFlags.Out */ + ); + }) ? 65536 : 0); + } + function hasCovariantVoidArgument(typeArguments, variances) { + for (var i = 0; i < variances.length; i++) { + if ((variances[i] & 7) === 1 && typeArguments[i].flags & 16384) { + return true; + } + } + return false; + } + function isUnconstrainedTypeParameter(type) { + return type.flags & 262144 && !getConstraintOfTypeParameter(type); + } + function isNonDeferredTypeReference(type) { + return !!(ts6.getObjectFlags(type) & 4) && !type.node; + } + function isTypeReferenceWithGenericArguments(type) { + return isNonDeferredTypeReference(type) && ts6.some(getTypeArguments(type), function(t) { + return !!(t.flags & 262144) || isTypeReferenceWithGenericArguments(t); + }); + } + function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) { + var typeParameters = []; + var constraintMarker = ""; + var sourceId = getTypeReferenceId(source, 0); + var targetId = getTypeReferenceId(target, 0); + return "".concat(constraintMarker).concat(sourceId, ",").concat(targetId).concat(postFix); + function getTypeReferenceId(type, depth) { + if (depth === void 0) { + depth = 0; + } + var result = "" + type.target.id; + for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 262144) { + if (ignoreConstraints || isUnconstrainedTypeParameter(t)) { + var index = typeParameters.indexOf(t); + if (index < 0) { + index = typeParameters.length; + typeParameters.push(t); + } + result += "=" + index; + continue; + } + constraintMarker = "*"; + } else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) { + result += "<" + getTypeReferenceId(t, depth + 1) + ">"; + continue; + } + result += "-" + t.id; + } + return result; + } + } + function getRelationKey(source, target, intersectionState, relation, ignoreConstraints) { + if (relation === identityRelation && source.id > target.id) { + var temp = source; + source = target; + target = temp; + } + var postFix = intersectionState ? ":" + intersectionState : ""; + return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ? getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) : "".concat(source.id, ",").concat(target.id).concat(postFix); + } + function forEachProperty(prop, callback) { + if (ts6.getCheckFlags(prop) & 6) { + for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var p = getPropertyOfType(t, prop.escapedName); + var result = p && forEachProperty(p, callback); + if (result) { + return result; + } + } + return void 0; + } + return callback(prop); + } + function getDeclaringClass(prop) { + return prop.parent && prop.parent.flags & 32 ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : void 0; + } + function getTypeOfPropertyInBaseClass(property) { + var classType = getDeclaringClass(property); + var baseClassType = classType && getBaseTypes(classType)[0]; + return baseClassType && getTypeOfPropertyOfType(baseClassType, property.escapedName); + } + function isPropertyInClassDerivedFrom(prop, baseClass) { + return forEachProperty(prop, function(sp) { + var sourceClass = getDeclaringClass(sp); + return sourceClass ? hasBaseType(sourceClass, baseClass) : false; + }); + } + function isValidOverrideOf(sourceProp, targetProp) { + return !forEachProperty(targetProp, function(tp) { + return ts6.getDeclarationModifierFlagsFromSymbol(tp) & 16 ? !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; + }); + } + function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) { + return forEachProperty(prop, function(p) { + return ts6.getDeclarationModifierFlagsFromSymbol(p, writing) & 16 ? !hasBaseType(checkClass, getDeclaringClass(p)) : false; + }) ? void 0 : checkClass; + } + function isDeeplyNestedType(type, stack2, depth, maxDepth) { + if (maxDepth === void 0) { + maxDepth = 3; + } + if (depth >= maxDepth) { + var identity_2 = getRecursionIdentity(type); + var count = 0; + var lastTypeId = 0; + for (var i = 0; i < depth; i++) { + var t = stack2[i]; + if (getRecursionIdentity(t) === identity_2) { + if (t.id >= lastTypeId) { + count++; + if (count >= maxDepth) { + return true; + } + } + lastTypeId = t.id; + } + } + } + return false; + } + function getRecursionIdentity(type) { + if (type.flags & 524288 && !isObjectOrArrayLiteralType(type)) { + if (ts6.getObjectFlags(type) && 4 && type.node) { + return type.node; + } + if (type.symbol && !(ts6.getObjectFlags(type) & 16 && type.symbol.flags & 32)) { + return type.symbol; + } + if (isTupleType(type)) { + return type.target; + } + } + if (type.flags & 262144) { + return type.symbol; + } + if (type.flags & 8388608) { + do { + type = type.objectType; + } while (type.flags & 8388608); + return type; + } + if (type.flags & 16777216) { + return type.root; + } + return type; + } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1; + } + var sourcePropAccessibility = ts6.getDeclarationModifierFlagsFromSymbol(sourceProp) & 24; + var targetPropAccessibility = ts6.getDeclarationModifierFlagsFromSymbol(targetProp) & 24; + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0; + } + } else { + if ((sourceProp.flags & 16777216) !== (targetProp.flags & 16777216)) { + return 0; + } + } + if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { + return 0; + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + function isMatchingSignature(source, target, partialMatch) { + var sourceParameterCount = getParameterCount(source); + var targetParameterCount = getParameterCount(target); + var sourceMinArgumentCount = getMinArgumentCount(source); + var targetMinArgumentCount = getMinArgumentCount(target); + var sourceHasRestParameter = hasEffectiveRestParameter(source); + var targetHasRestParameter = hasEffectiveRestParameter(target); + if (sourceParameterCount === targetParameterCount && sourceMinArgumentCount === targetMinArgumentCount && sourceHasRestParameter === targetHasRestParameter) { + return true; + } + if (partialMatch && sourceMinArgumentCount <= targetMinArgumentCount) { + return true; + } + return false; + } + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { + if (source === target) { + return -1; + } + if (!isMatchingSignature(source, target, partialMatch)) { + return 0; + } + if (ts6.length(source.typeParameters) !== ts6.length(target.typeParameters)) { + return 0; + } + if (target.typeParameters) { + var mapper = createTypeMapper(source.typeParameters, target.typeParameters); + for (var i = 0; i < target.typeParameters.length; i++) { + var s = source.typeParameters[i]; + var t = target.typeParameters[i]; + if (!(s === t || compareTypes(instantiateType(getConstraintFromTypeParameter(s), mapper) || unknownType, getConstraintFromTypeParameter(t) || unknownType) && compareTypes(instantiateType(getDefaultFromTypeParameter(s), mapper) || unknownType, getDefaultFromTypeParameter(t) || unknownType))) { + return 0; + } + } + source = instantiateSignature( + source, + mapper, + /*eraseTypeParameters*/ + true + ); + } + var result = -1; + if (!ignoreThisTypes) { + var sourceThisType = getThisTypeOfSignature(source); + if (sourceThisType) { + var targetThisType = getThisTypeOfSignature(target); + if (targetThisType) { + var related = compareTypes(sourceThisType, targetThisType); + if (!related) { + return 0; + } + result &= related; + } + } + } + var targetLen = getParameterCount(target); + for (var i = 0; i < targetLen; i++) { + var s = getTypeAtPosition(source, i); + var t = getTypeAtPosition(target, i); + var related = compareTypes(t, s); + if (!related) { + return 0; + } + result &= related; + } + if (!ignoreReturnTypes) { + var sourceTypePredicate = getTypePredicateOfSignature(source); + var targetTypePredicate = getTypePredicateOfSignature(target); + result &= sourceTypePredicate || targetTypePredicate ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) : compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; + } + function compareTypePredicatesIdentical(source, target, compareTypes) { + return !(source && target && typePredicateKindsMatch(source, target)) ? 0 : source.type === target.type ? -1 : source.type && target.type ? compareTypes(source.type, target.type) : 0; + } + function literalTypesWithSameBaseType(types) { + var commonBaseType; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; + if (!(t.flags & 131072)) { + var baseType = getBaseTypeOfLiteralType(t); + commonBaseType !== null && commonBaseType !== void 0 ? commonBaseType : commonBaseType = baseType; + if (baseType === t || baseType !== commonBaseType) { + return false; + } + } + } + return true; + } + function getCombinedTypeFlags(types) { + return ts6.reduceLeft(types, function(flags, t) { + return flags | (t.flags & 1048576 ? getCombinedTypeFlags(t.types) : t.flags); + }, 0); + } + function getCommonSupertype(types) { + if (types.length === 1) { + return types[0]; + } + var primaryTypes = strictNullChecks ? ts6.sameMap(types, function(t) { + return filterType(t, function(u) { + return !(u.flags & 98304); + }); + }) : types; + var superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : ts6.reduceLeft(primaryTypes, function(s, t) { + return isTypeSubtypeOf(s, t) ? t : s; + }); + return primaryTypes === types ? superTypeOrUnion : getNullableType( + superTypeOrUnion, + getCombinedTypeFlags(types) & 98304 + /* TypeFlags.Nullable */ + ); + } + function getCommonSubtype(types) { + return ts6.reduceLeft(types, function(s, t) { + return isTypeSubtypeOf(t, s) ? t : s; + }); + } + function isArrayType(type) { + return !!(ts6.getObjectFlags(type) & 4) && (type.target === globalArrayType || type.target === globalReadonlyArrayType); + } + function isReadonlyArrayType(type) { + return !!(ts6.getObjectFlags(type) & 4) && type.target === globalReadonlyArrayType; + } + function isArrayOrTupleType(type) { + return isArrayType(type) || isTupleType(type); + } + function isMutableArrayOrTuple(type) { + return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly; + } + function getElementTypeOfArrayType(type) { + return isArrayType(type) ? getTypeArguments(type)[0] : void 0; + } + function isArrayLikeType(type) { + return isArrayType(type) || !(type.flags & 98304) && isTypeAssignableTo(type, anyReadonlyArrayType); + } + function getSingleBaseForNonAugmentingSubtype(type) { + if (!(ts6.getObjectFlags(type) & 4) || !(ts6.getObjectFlags(type.target) & 3)) { + return void 0; + } + if (ts6.getObjectFlags(type) & 33554432) { + return ts6.getObjectFlags(type) & 67108864 ? type.cachedEquivalentBaseType : void 0; + } + type.objectFlags |= 33554432; + var target = type.target; + if (ts6.getObjectFlags(target) & 1) { + var baseTypeNode = getBaseTypeNodeOfClass(target); + if (baseTypeNode && baseTypeNode.expression.kind !== 79 && baseTypeNode.expression.kind !== 208) { + return void 0; + } + } + var bases = getBaseTypes(target); + if (bases.length !== 1) { + return void 0; + } + if (getMembersOfSymbol(type.symbol).size) { + return void 0; + } + var instantiatedBase = !ts6.length(target.typeParameters) ? bases[0] : instantiateType(bases[0], createTypeMapper(target.typeParameters, getTypeArguments(type).slice(0, target.typeParameters.length))); + if (ts6.length(getTypeArguments(type)) > ts6.length(target.typeParameters)) { + instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts6.last(getTypeArguments(type))); + } + type.objectFlags |= 67108864; + return type.cachedEquivalentBaseType = instantiatedBase; + } + function isEmptyLiteralType(type) { + return strictNullChecks ? type === implicitNeverType : type === undefinedWideningType; + } + function isEmptyArrayLiteralType(type) { + var elementType = getElementTypeOfArrayType(type); + return !!elementType && isEmptyLiteralType(elementType); + } + function isTupleLikeType(type) { + return isTupleType(type) || !!getPropertyOfType(type, "0"); + } + function isArrayOrTupleLikeType(type) { + return isArrayLikeType(type) || isTupleLikeType(type); + } + function getTupleElementType(type, index) { + var propType = getTypeOfPropertyOfType(type, "" + index); + if (propType) { + return propType; + } + if (everyType(type, isTupleType)) { + return mapType(type, function(t) { + return getRestTypeOfTupleType(t) || undefinedType; + }); + } + return void 0; + } + function isNeitherUnitTypeNorNever(type) { + return !(type.flags & (109440 | 131072)); + } + function isUnitType(type) { + return !!(type.flags & 109440); + } + function isUnitLikeType(type) { + var t = getBaseConstraintOrType(type); + return t.flags & 2097152 ? ts6.some(t.types, isUnitType) : isUnitType(t); + } + function extractUnitType(type) { + return type.flags & 2097152 ? ts6.find(type.types, isUnitType) || type : type; + } + function isLiteralType(type) { + return type.flags & 16 ? true : type.flags & 1048576 ? type.flags & 1024 ? true : ts6.every(type.types, isUnitType) : isUnitType(type); + } + function getBaseTypeOfLiteralType(type) { + return type.flags & 1024 ? getBaseTypeOfEnumLiteralType(type) : type.flags & (128 | 134217728 | 268435456) ? stringType : type.flags & 256 ? numberType : type.flags & 2048 ? bigintType : type.flags & 512 ? booleanType : type.flags & 1048576 ? getBaseTypeOfLiteralTypeUnion(type) : type; + } + function getBaseTypeOfLiteralTypeUnion(type) { + var _a; + var key = "B".concat(getTypeId(type)); + return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType)); + } + function getWidenedLiteralType(type) { + return type.flags & 1024 && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) : type.flags & 128 && isFreshLiteralType(type) ? stringType : type.flags & 256 && isFreshLiteralType(type) ? numberType : type.flags & 2048 && isFreshLiteralType(type) ? bigintType : type.flags & 512 && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 ? mapType(type, getWidenedLiteralType) : type; + } + function getWidenedUniqueESSymbolType(type) { + return type.flags & 8192 ? esSymbolType : type.flags & 1048576 ? mapType(type, getWidenedUniqueESSymbolType) : type; + } + function getWidenedLiteralLikeTypeForContextualType(type, contextualType) { + if (!isLiteralOfContextualType(type, contextualType)) { + type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); + } + return getRegularTypeOfLiteralType(type); + } + function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { + if (type && isUnitType(type)) { + var contextualType = !contextualSignatureReturnType ? void 0 : isAsync ? getPromisedTypeOfPromise(contextualSignatureReturnType) : contextualSignatureReturnType; + type = getWidenedLiteralLikeTypeForContextualType(type, contextualType); + } + return type; + } + function getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(type, contextualSignatureReturnType, kind, isAsyncGenerator) { + if (type && isUnitType(type)) { + var contextualType = !contextualSignatureReturnType ? void 0 : getIterationTypeOfGeneratorFunctionReturnType(kind, contextualSignatureReturnType, isAsyncGenerator); + type = getWidenedLiteralLikeTypeForContextualType(type, contextualType); + } + return type; + } + function isTupleType(type) { + return !!(ts6.getObjectFlags(type) & 4 && type.target.objectFlags & 8); + } + function isGenericTupleType(type) { + return isTupleType(type) && !!(type.target.combinedFlags & 8); + } + function isSingleElementGenericTupleType(type) { + return isGenericTupleType(type) && type.target.elementFlags.length === 1; + } + function getRestTypeOfTupleType(type) { + return getElementTypeOfSliceOfTupleType(type, type.target.fixedLength); + } + function getRestArrayTypeOfTupleType(type) { + var restType = getRestTypeOfTupleType(type); + return restType && createArrayType(restType); + } + function getElementTypeOfSliceOfTupleType(type, index, endSkipCount, writing) { + if (endSkipCount === void 0) { + endSkipCount = 0; + } + if (writing === void 0) { + writing = false; + } + var length = getTypeReferenceArity(type) - endSkipCount; + if (index < length) { + var typeArguments = getTypeArguments(type); + var elementTypes = []; + for (var i = index; i < length; i++) { + var t = typeArguments[i]; + elementTypes.push(type.target.elementFlags[i] & 8 ? getIndexedAccessType(t, numberType) : t); + } + return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes); + } + return void 0; + } + function isTupleTypeStructureMatching(t1, t2) { + return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && ts6.every(t1.target.elementFlags, function(f, i) { + return (f & 12) === (t2.target.elementFlags[i] & 12); + }); + } + function isZeroBigInt(_a) { + var value = _a.value; + return value.base10Value === "0"; + } + function removeDefinitelyFalsyTypes(type) { + return filterType(type, function(t) { + return !!(getTypeFacts(t) & 4194304); + }); + } + function extractDefinitelyFalsyTypes(type) { + return mapType(type, getDefinitelyFalsyPartOfType); + } + function getDefinitelyFalsyPartOfType(type) { + return type.flags & 4 ? emptyStringType : type.flags & 8 ? zeroType : type.flags & 64 ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16384 | 32768 | 65536 | 3) || type.flags & 128 && type.value === "" || type.flags & 256 && type.value === 0 || type.flags & 2048 && isZeroBigInt(type) ? type : neverType; + } + function getNullableType(type, flags) { + var missing = flags & ~type.flags & (32768 | 65536); + return missing === 0 ? type : missing === 32768 ? getUnionType([type, undefinedType]) : missing === 65536 ? getUnionType([type, nullType]) : getUnionType([type, undefinedType, nullType]); + } + function getOptionalType(type, isProperty) { + if (isProperty === void 0) { + isProperty = false; + } + ts6.Debug.assert(strictNullChecks); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 || type.flags & 1048576 && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); + } + function getGlobalNonNullableTypeInstantiation(type) { + if (!deferredGlobalNonNullableTypeAlias) { + deferredGlobalNonNullableTypeAlias = getGlobalSymbol( + "NonNullable", + 524288, + /*diagnostic*/ + void 0 + ) || unknownSymbol; + } + return deferredGlobalNonNullableTypeAlias !== unknownSymbol ? getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) : getIntersectionType([type, emptyObjectType]); + } + function getNonNullableType(type) { + return strictNullChecks ? getAdjustedTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ) : type; + } + function addOptionalTypeMarker(type) { + return strictNullChecks ? getUnionType([type, optionalType]) : type; + } + function removeOptionalTypeMarker(type) { + return strictNullChecks ? removeType(type, optionalType) : type; + } + function propagateOptionalTypeMarker(type, node, wasOptional) { + return wasOptional ? ts6.isOutermostOptionalChain(node) ? getOptionalType(type) : addOptionalTypeMarker(type) : type; + } + function getOptionalExpressionType(exprType, expression) { + return ts6.isExpressionOfOptionalChainRoot(expression) ? getNonNullableType(exprType) : ts6.isOptionalChain(expression) ? removeOptionalTypeMarker(exprType) : exprType; + } + function removeMissingType(type, isOptional) { + return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type; + } + function containsMissingType(type) { + return exactOptionalPropertyTypes && (type === missingType || type.flags & 1048576 && containsType(type.types, missingType)); + } + function removeMissingOrUndefinedType(type) { + return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts( + type, + 524288 + /* TypeFacts.NEUndefined */ + ); + } + function isCoercibleUnderDoubleEquals(source, target) { + return (source.flags & (8 | 4 | 512)) !== 0 && (target.flags & (8 | 4 | 16)) !== 0; + } + function isObjectTypeWithInferableIndex(type) { + var objectFlags = ts6.getObjectFlags(type); + return type.flags & 2097152 ? ts6.every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 | 2048 | 384 | 512)) !== 0 && !(type.symbol.flags & 32) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304) || !!(objectFlags & 1024 && isObjectTypeWithInferableIndex(type.source)); + } + function createSymbolWithType(source, type) { + var symbol = createSymbol( + source.flags, + source.escapedName, + ts6.getCheckFlags(source) & 8 + /* CheckFlags.Readonly */ + ); + symbol.declarations = source.declarations; + symbol.parent = source.parent; + symbol.type = type; + symbol.target = source; + if (source.valueDeclaration) { + symbol.valueDeclaration = source.valueDeclaration; + } + var nameType = getSymbolLinks(source).nameType; + if (nameType) { + symbol.nameType = nameType; + } + return symbol; + } + function transformTypeOfMembers(type, f) { + var members = ts6.createSymbolTable(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var property = _a[_i]; + var original = getTypeOfSymbol(property); + var updated = f(original); + members.set(property.escapedName, updated === original ? property : createSymbolWithType(property, updated)); + } + return members; + } + function getRegularTypeOfObjectLiteral(type) { + if (!(isObjectLiteralType(type) && ts6.getObjectFlags(type) & 8192)) { + return type; + } + var regularType = type.regularType; + if (regularType) { + return regularType; + } + var resolved = type; + var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral); + var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.indexInfos); + regularNew.flags = resolved.flags; + regularNew.objectFlags |= resolved.objectFlags & ~8192; + type.regularType = regularNew; + return regularNew; + } + function createWideningContext(parent, propertyName, siblings) { + return { parent, propertyName, siblings, resolvedProperties: void 0 }; + } + function getSiblingsOfContext(context) { + if (!context.siblings) { + var siblings_1 = []; + for (var _i = 0, _a = getSiblingsOfContext(context.parent); _i < _a.length; _i++) { + var type = _a[_i]; + if (isObjectLiteralType(type)) { + var prop = getPropertyOfObjectType(type, context.propertyName); + if (prop) { + forEachType(getTypeOfSymbol(prop), function(t) { + siblings_1.push(t); + }); + } + } + } + context.siblings = siblings_1; + } + return context.siblings; + } + function getPropertiesOfContext(context) { + if (!context.resolvedProperties) { + var names = new ts6.Map(); + for (var _i = 0, _a = getSiblingsOfContext(context); _i < _a.length; _i++) { + var t = _a[_i]; + if (isObjectLiteralType(t) && !(ts6.getObjectFlags(t) & 2097152)) { + for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) { + var prop = _c[_b]; + names.set(prop.escapedName, prop); + } + } + } + context.resolvedProperties = ts6.arrayFrom(names.values()); + } + return context.resolvedProperties; + } + function getWidenedProperty(prop, context) { + if (!(prop.flags & 4)) { + return prop; + } + var original = getTypeOfSymbol(prop); + var propContext = context && createWideningContext( + context, + prop.escapedName, + /*siblings*/ + void 0 + ); + var widened = getWidenedTypeWithContext(original, propContext); + return widened === original ? prop : createSymbolWithType(prop, widened); + } + function getUndefinedProperty(prop) { + var cached = undefinedProperties.get(prop.escapedName); + if (cached) { + return cached; + } + var result = createSymbolWithType(prop, missingType); + result.flags |= 16777216; + undefinedProperties.set(prop.escapedName, result); + return result; + } + function getWidenedTypeOfObjectLiteral(type, context) { + var members = ts6.createSymbolTable(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + members.set(prop.escapedName, getWidenedProperty(prop, context)); + } + if (context) { + for (var _b = 0, _c = getPropertiesOfContext(context); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.escapedName)) { + members.set(prop.escapedName, getUndefinedProperty(prop)); + } + } + } + var result = createAnonymousType(type.symbol, members, ts6.emptyArray, ts6.emptyArray, ts6.sameMap(getIndexInfosOfType(type), function(info) { + return createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly); + })); + result.objectFlags |= ts6.getObjectFlags(type) & (4096 | 262144); + return result; + } + function getWidenedType(type) { + return getWidenedTypeWithContext( + type, + /*context*/ + void 0 + ); + } + function getWidenedTypeWithContext(type, context) { + if (ts6.getObjectFlags(type) & 196608) { + if (context === void 0 && type.widened) { + return type.widened; + } + var result = void 0; + if (type.flags & (1 | 98304)) { + result = anyType; + } else if (isObjectLiteralType(type)) { + result = getWidenedTypeOfObjectLiteral(type, context); + } else if (type.flags & 1048576) { + var unionContext_1 = context || createWideningContext( + /*parent*/ + void 0, + /*propertyName*/ + void 0, + type.types + ); + var widenedTypes = ts6.sameMap(type.types, function(t) { + return t.flags & 98304 ? t : getWidenedTypeWithContext(t, unionContext_1); + }); + result = getUnionType( + widenedTypes, + ts6.some(widenedTypes, isEmptyObjectType) ? 2 : 1 + /* UnionReduction.Literal */ + ); + } else if (type.flags & 2097152) { + result = getIntersectionType(ts6.sameMap(type.types, getWidenedType)); + } else if (isArrayOrTupleType(type)) { + result = createTypeReference(type.target, ts6.sameMap(getTypeArguments(type), getWidenedType)); + } + if (result && context === void 0) { + type.widened = result; + } + return result || type; + } + return type; + } + function reportWideningErrorsInType(type) { + var errorReported = false; + if (ts6.getObjectFlags(type) & 65536) { + if (type.flags & 1048576) { + if (ts6.some(type.types, isEmptyObjectType)) { + errorReported = true; + } else { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (reportWideningErrorsInType(t)) { + errorReported = true; + } + } + } + } + if (isArrayOrTupleType(type)) { + for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) { + var t = _c[_b]; + if (reportWideningErrorsInType(t)) { + errorReported = true; + } + } + } + if (isObjectLiteralType(type)) { + for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { + var p = _e[_d]; + var t = getTypeOfSymbol(p); + if (ts6.getObjectFlags(t) & 65536) { + if (!reportWideningErrorsInType(t)) { + error(p.valueDeclaration, ts6.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t))); + } + errorReported = true; + } + } + } + } + return errorReported; + } + function reportImplicitAny(declaration, type, wideningKind) { + var typeAsString = typeToString(getWidenedType(type)); + if (ts6.isInJSFile(declaration) && !ts6.isCheckJsEnabledForFile(ts6.getSourceFileOfNode(declaration), compilerOptions)) { + return; + } + var diagnostic; + switch (declaration.kind) { + case 223: + case 169: + case 168: + diagnostic = noImplicitAny ? ts6.Diagnostics.Member_0_implicitly_has_an_1_type : ts6.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; + break; + case 166: + var param = declaration; + if (ts6.isIdentifier(param.name) && (ts6.isCallSignatureDeclaration(param.parent) || ts6.isMethodSignature(param.parent) || ts6.isFunctionTypeNode(param.parent)) && param.parent.parameters.indexOf(param) > -1 && (resolveName( + param, + param.name.escapedText, + 788968, + void 0, + param.name.escapedText, + /*isUse*/ + true + ) || param.name.originalKeywordKind && ts6.isTypeNodeKind(param.name.originalKeywordKind))) { + var newName = "arg" + param.parent.parameters.indexOf(param); + var typeName = ts6.declarationNameToString(param.name) + (param.dotDotDotToken ? "[]" : ""); + errorOrSuggestion(noImplicitAny, declaration, ts6.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, typeName); + return; + } + diagnostic = declaration.dotDotDotToken ? noImplicitAny ? ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; + break; + case 205: + diagnostic = ts6.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + if (!noImplicitAny) { + return; + } + break; + case 320: + error(declaration, ts6.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + return; + case 259: + case 171: + case 170: + case 174: + case 175: + case 215: + case 216: + if (noImplicitAny && !declaration.name) { + if (wideningKind === 3) { + error(declaration, ts6.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); + } else { + error(declaration, ts6.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + } + return; + } + diagnostic = !noImplicitAny ? ts6.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage : wideningKind === 3 ? ts6.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts6.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + break; + case 197: + if (noImplicitAny) { + error(declaration, ts6.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); + } + return; + default: + diagnostic = noImplicitAny ? ts6.Diagnostics.Variable_0_implicitly_has_an_1_type : ts6.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; + } + errorOrSuggestion(noImplicitAny, declaration, diagnostic, ts6.declarationNameToString(ts6.getNameOfDeclaration(declaration)), typeAsString); + } + function reportErrorsFromWidening(declaration, type, wideningKind) { + addLazyDiagnostic(function() { + if (noImplicitAny && ts6.getObjectFlags(type) & 65536 && (!wideningKind || !getContextualSignatureForFunctionLikeDeclaration(declaration))) { + if (!reportWideningErrorsInType(type)) { + reportImplicitAny(declaration, type, wideningKind); + } + } + }); + } + function applyToParameterTypes(source, target, callback) { + var sourceCount = getParameterCount(source); + var targetCount = getParameterCount(target); + var sourceRestType = getEffectiveRestType(source); + var targetRestType = getEffectiveRestType(target); + var targetNonRestCount = targetRestType ? targetCount - 1 : targetCount; + var paramCount = sourceRestType ? targetNonRestCount : Math.min(sourceCount, targetNonRestCount); + var sourceThisType = getThisTypeOfSignature(source); + if (sourceThisType) { + var targetThisType = getThisTypeOfSignature(target); + if (targetThisType) { + callback(sourceThisType, targetThisType); + } + } + for (var i = 0; i < paramCount; i++) { + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); + } + if (targetRestType) { + callback(getRestTypeAtPosition(source, paramCount), targetRestType); + } + } + function applyToReturnTypes(source, target, callback) { + var sourceTypePredicate = getTypePredicateOfSignature(source); + var targetTypePredicate = getTypePredicateOfSignature(target); + if (sourceTypePredicate && targetTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) { + callback(sourceTypePredicate.type, targetTypePredicate.type); + } else { + callback(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + } + function createInferenceContext(typeParameters, signature, flags, compareTypes) { + return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable); + } + function cloneInferenceContext(context, extraFlags) { + if (extraFlags === void 0) { + extraFlags = 0; + } + return context && createInferenceContextWorker(ts6.map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes); + } + function createInferenceContextWorker(inferences, signature, flags, compareTypes) { + var context = { + inferences, + signature, + flags, + compareTypes, + mapper: reportUnmeasurableMapper, + nonFixingMapper: reportUnmeasurableMapper + }; + context.mapper = makeFixingMapperForContext(context); + context.nonFixingMapper = makeNonFixingMapperForContext(context); + return context; + } + function makeFixingMapperForContext(context) { + return makeDeferredTypeMapper(ts6.map(context.inferences, function(i) { + return i.typeParameter; + }), ts6.map(context.inferences, function(inference, i) { + return function() { + if (!inference.isFixed) { + inferFromIntraExpressionSites(context); + clearCachedInferences(context.inferences); + inference.isFixed = true; + } + return getInferredType(context, i); + }; + })); + } + function makeNonFixingMapperForContext(context) { + return makeDeferredTypeMapper(ts6.map(context.inferences, function(i) { + return i.typeParameter; + }), ts6.map(context.inferences, function(_, i) { + return function() { + return getInferredType(context, i); + }; + })); + } + function clearCachedInferences(inferences) { + for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) { + var inference = inferences_1[_i]; + if (!inference.isFixed) { + inference.inferredType = void 0; + } + } + } + function addIntraExpressionInferenceSite(context, node, type) { + var _a; + ((_a = context.intraExpressionInferenceSites) !== null && _a !== void 0 ? _a : context.intraExpressionInferenceSites = []).push({ node, type }); + } + function inferFromIntraExpressionSites(context) { + if (context.intraExpressionInferenceSites) { + for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { + var _b = _a[_i], node = _b.node, type = _b.type; + var contextualType = node.kind === 171 ? getContextualTypeForObjectLiteralMethod( + node, + 2 + /* ContextFlags.NoConstraints */ + ) : getContextualType( + node, + 2 + /* ContextFlags.NoConstraints */ + ); + if (contextualType) { + inferTypes(context.inferences, type, contextualType); + } + } + context.intraExpressionInferenceSites = void 0; + } + } + function createInferenceInfo(typeParameter) { + return { + typeParameter, + candidates: void 0, + contraCandidates: void 0, + inferredType: void 0, + priority: void 0, + topLevel: true, + isFixed: false, + impliedArity: void 0 + }; + } + function cloneInferenceInfo(inference) { + return { + typeParameter: inference.typeParameter, + candidates: inference.candidates && inference.candidates.slice(), + contraCandidates: inference.contraCandidates && inference.contraCandidates.slice(), + inferredType: inference.inferredType, + priority: inference.priority, + topLevel: inference.topLevel, + isFixed: inference.isFixed, + impliedArity: inference.impliedArity + }; + } + function cloneInferredPartOfContext(context) { + var inferences = ts6.filter(context.inferences, hasInferenceCandidates); + return inferences.length ? createInferenceContextWorker(ts6.map(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) : void 0; + } + function getMapperFromContext(context) { + return context && context.mapper; + } + function couldContainTypeVariables(type) { + var objectFlags = ts6.getObjectFlags(type); + if (objectFlags & 524288) { + return !!(objectFlags & 1048576); + } + var result = !!(type.flags & 465829888 || type.flags & 524288 && !isNonGenericTopLevelType(type) && (objectFlags & 4 && (type.node || ts6.forEach(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations || objectFlags & (32 | 1024 | 4194304 | 8388608)) || type.flags & 3145728 && !(type.flags & 1024) && !isNonGenericTopLevelType(type) && ts6.some(type.types, couldContainTypeVariables)); + if (type.flags & 3899393) { + type.objectFlags |= 524288 | (result ? 1048576 : 0); + } + return result; + } + function isNonGenericTopLevelType(type) { + if (type.aliasSymbol && !type.aliasTypeArguments) { + var declaration = ts6.getDeclarationOfKind( + type.aliasSymbol, + 262 + /* SyntaxKind.TypeAliasDeclaration */ + ); + return !!(declaration && ts6.findAncestor(declaration.parent, function(n) { + return n.kind === 308 ? true : n.kind === 264 ? false : "quit"; + })); + } + return false; + } + function isTypeParameterAtTopLevel(type, typeParameter) { + return !!(type === typeParameter || type.flags & 3145728 && ts6.some(type.types, function(t) { + return isTypeParameterAtTopLevel(t, typeParameter); + }) || type.flags & 16777216 && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter)); + } + function createEmptyObjectTypeFromStringLiteral(type) { + var members = ts6.createSymbolTable(); + forEachType(type, function(t) { + if (!(t.flags & 128)) { + return; + } + var name = ts6.escapeLeadingUnderscores(t.value); + var literalProp = createSymbol(4, name); + literalProp.type = anyType; + if (t.symbol) { + literalProp.declarations = t.symbol.declarations; + literalProp.valueDeclaration = t.symbol.valueDeclaration; + } + members.set(name, literalProp); + }); + var indexInfos = type.flags & 4 ? [createIndexInfo( + stringType, + emptyObjectType, + /*isReadonly*/ + false + )] : ts6.emptyArray; + return createAnonymousType(void 0, members, ts6.emptyArray, ts6.emptyArray, indexInfos); + } + function inferTypeForHomomorphicMappedType(source, target, constraint) { + if (inInferTypeForHomomorphicMappedType) { + return void 0; + } + var key = source.id + "," + target.id + "," + constraint.id; + if (reverseMappedCache.has(key)) { + return reverseMappedCache.get(key); + } + inInferTypeForHomomorphicMappedType = true; + var type = createReverseMappedType(source, target, constraint); + inInferTypeForHomomorphicMappedType = false; + reverseMappedCache.set(key, type); + return type; + } + function isPartiallyInferableType(type) { + return !(ts6.getObjectFlags(type) & 262144) || isObjectLiteralType(type) && ts6.some(getPropertiesOfType(type), function(prop) { + return isPartiallyInferableType(getTypeOfSymbol(prop)); + }) || isTupleType(type) && ts6.some(getTypeArguments(type), isPartiallyInferableType); + } + function createReverseMappedType(source, target, constraint) { + if (!(getIndexInfoOfType(source, stringType) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) { + return void 0; + } + if (isArrayType(source)) { + return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source)); + } + if (isTupleType(source)) { + var elementTypes = ts6.map(getTypeArguments(source), function(t) { + return inferReverseMappedType(t, target, constraint); + }); + var elementFlags = getMappedTypeModifiers(target) & 4 ? ts6.sameMap(source.target.elementFlags, function(f) { + return f & 2 ? 1 : f; + }) : source.target.elementFlags; + return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations); + } + var reversed = createObjectType( + 1024 | 16, + /*symbol*/ + void 0 + ); + reversed.source = source; + reversed.mappedType = target; + reversed.constraintType = constraint; + return reversed; + } + function getTypeOfReverseMappedSymbol(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = inferReverseMappedType(symbol.propertyType, symbol.mappedType, symbol.constraintType); + } + return links.type; + } + function inferReverseMappedType(sourceType, target, constraint) { + var typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + var inference = createInferenceInfo(typeParameter); + inferTypes([inference], sourceType, templateType); + return getTypeFromInference(inference) || unknownType; + } + function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) { + var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + properties = getPropertiesOfType(target); + _i = 0, properties_2 = properties; + _a.label = 1; + case 1: + if (!(_i < properties_2.length)) + return [3, 6]; + targetProp = properties_2[_i]; + if (isStaticPrivateIdentifierProperty(targetProp)) { + return [3, 5]; + } + if (!(requireOptionalProperties || !(targetProp.flags & 16777216 || ts6.getCheckFlags(targetProp) & 48))) + return [3, 5]; + sourceProp = getPropertyOfType(source, targetProp.escapedName); + if (!!sourceProp) + return [3, 3]; + return [4, targetProp]; + case 2: + _a.sent(); + return [3, 5]; + case 3: + if (!matchDiscriminantProperties) + return [3, 5]; + targetType = getTypeOfSymbol(targetProp); + if (!(targetType.flags & 109440)) + return [3, 5]; + sourceType = getTypeOfSymbol(sourceProp); + if (!!(sourceType.flags & 1 || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) + return [3, 5]; + return [4, targetProp]; + case 4: + _a.sent(); + _a.label = 5; + case 5: + _i++; + return [3, 1]; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + } + function getUnmatchedProperty(source, target, requireOptionalProperties, matchDiscriminantProperties) { + var result = getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties).next(); + if (!result.done) + return result.value; + } + function tupleTypesDefinitelyUnrelated(source, target) { + return !(target.target.combinedFlags & 8) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength); + } + function typesDefinitelyUnrelated(source, target) { + return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty( + source, + target, + /*requireOptionalProperties*/ + false, + /*matchDiscriminantProperties*/ + true + ) && !!getUnmatchedProperty( + target, + source, + /*requireOptionalProperties*/ + false, + /*matchDiscriminantProperties*/ + false + ); + } + function getTypeFromInference(inference) { + return inference.candidates ? getUnionType( + inference.candidates, + 2 + /* UnionReduction.Subtype */ + ) : inference.contraCandidates ? getIntersectionType(inference.contraCandidates) : void 0; + } + function hasSkipDirectInferenceFlag(node) { + return !!getNodeLinks(node).skipDirectInference; + } + function isFromInferenceBlockedSource(type) { + return !!(type.symbol && ts6.some(type.symbol.declarations, hasSkipDirectInferenceFlag)); + } + function templateLiteralTypesDefinitelyUnrelated(source, target) { + var sourceStart = source.texts[0]; + var targetStart = target.texts[0]; + var sourceEnd = source.texts[source.texts.length - 1]; + var targetEnd = target.texts[target.texts.length - 1]; + var startLen = Math.min(sourceStart.length, targetStart.length); + var endLen = Math.min(sourceEnd.length, targetEnd.length); + return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) || sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen); + } + function isValidNumberString(s, roundTripOnly) { + if (s === "") + return false; + var n = +s; + return isFinite(n) && (!roundTripOnly || "" + n === s); + } + function parseBigIntLiteralType(text) { + var negative = text.startsWith("-"); + var base10Value = ts6.parsePseudoBigInt("".concat(negative ? text.slice(1) : text, "n")); + return getBigIntLiteralType({ negative, base10Value }); + } + function isValidBigIntString(s, roundTripOnly) { + if (s === "") + return false; + var scanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false + ); + var success = true; + scanner.setOnError(function() { + return success = false; + }); + scanner.setText(s + "n"); + var result = scanner.scan(); + var negative = result === 40; + if (negative) { + result = scanner.scan(); + } + var flags = scanner.getTokenFlags(); + return success && result === 9 && scanner.getTextPos() === s.length + 1 && !(flags & 512) && (!roundTripOnly || s === ts6.pseudoBigIntToString({ negative, base10Value: ts6.parsePseudoBigInt(scanner.getTokenValue()) })); + } + function isMemberOfStringMapping(source, target) { + if (target.flags & (4 | 1)) { + return true; + } + if (target.flags & 134217728) { + return isTypeAssignableTo(source, target); + } + if (target.flags & 268435456) { + var mappingStack = []; + while (target.flags & 268435456) { + mappingStack.unshift(target.symbol); + target = target.type; + } + var mappedSource = ts6.reduceLeft(mappingStack, function(memo, value) { + return getStringMappingType(value, memo); + }, source); + return mappedSource === source && isMemberOfStringMapping(source, target); + } + return false; + } + function isValidTypeForTemplateLiteralPlaceholder(source, target) { + if (source === target || target.flags & (1 | 4)) { + return true; + } + if (source.flags & 128) { + var value = source.value; + return !!(target.flags & 8 && isValidNumberString( + value, + /*roundTripOnly*/ + false + ) || target.flags & 64 && isValidBigIntString( + value, + /*roundTripOnly*/ + false + ) || target.flags & (512 | 98304) && value === target.intrinsicName || target.flags & 268435456 && isMemberOfStringMapping(getStringLiteralType(value), target)); + } + if (source.flags & 134217728) { + var texts = source.texts; + return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target); + } + return isTypeAssignableTo(source, target); + } + function inferTypesFromTemplateLiteralType(source, target) { + return source.flags & 128 ? inferFromLiteralPartsToTemplateLiteral([source.value], ts6.emptyArray, target) : source.flags & 134217728 ? ts6.arraysEqual(source.texts, target.texts) ? ts6.map(source.types, getStringLikeTypeForType) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0; + } + function isTypeMatchedByTemplateLiteralType(source, target) { + var inferences = inferTypesFromTemplateLiteralType(source, target); + return !!inferences && ts6.every(inferences, function(r, i) { + return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); + }); + } + function getStringLikeTypeForType(type) { + return type.flags & (1 | 402653316) ? type : getTemplateLiteralType(["", ""], [type]); + } + function inferFromLiteralPartsToTemplateLiteral(sourceTexts, sourceTypes, target) { + var lastSourceIndex = sourceTexts.length - 1; + var sourceStartText = sourceTexts[0]; + var sourceEndText = sourceTexts[lastSourceIndex]; + var targetTexts = target.texts; + var lastTargetIndex = targetTexts.length - 1; + var targetStartText = targetTexts[0]; + var targetEndText = targetTexts[lastTargetIndex]; + if (lastSourceIndex === 0 && sourceStartText.length < targetStartText.length + targetEndText.length || !sourceStartText.startsWith(targetStartText) || !sourceEndText.endsWith(targetEndText)) + return void 0; + var remainingEndText = sourceEndText.slice(0, sourceEndText.length - targetEndText.length); + var matches = []; + var seg = 0; + var pos = targetStartText.length; + for (var i = 1; i < lastTargetIndex; i++) { + var delim = targetTexts[i]; + if (delim.length > 0) { + var s = seg; + var p = pos; + while (true) { + p = getSourceText(s).indexOf(delim, p); + if (p >= 0) + break; + s++; + if (s === sourceTexts.length) + return void 0; + p = 0; + } + addMatch(s, p); + pos += delim.length; + } else if (pos < getSourceText(seg).length) { + addMatch(seg, pos + 1); + } else if (seg < lastSourceIndex) { + addMatch(seg + 1, 0); + } else { + return void 0; + } + } + addMatch(lastSourceIndex, getSourceText(lastSourceIndex).length); + return matches; + function getSourceText(index) { + return index < lastSourceIndex ? sourceTexts[index] : remainingEndText; + } + function addMatch(s2, p2) { + var matchType = s2 === seg ? getStringLiteralType(getSourceText(s2).slice(pos, p2)) : getTemplateLiteralType(__spreadArray(__spreadArray([sourceTexts[seg].slice(pos)], sourceTexts.slice(seg + 1, s2), true), [getSourceText(s2).slice(0, p2)], false), sourceTypes.slice(seg, s2)); + matches.push(matchType); + seg = s2; + pos = p2; + } + } + function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) { + if (priority === void 0) { + priority = 0; + } + if (contravariant === void 0) { + contravariant = false; + } + var bivariant = false; + var propagationType; + var inferencePriority = 2048; + var allowComplexConstraintInference = true; + var visited; + var sourceStack; + var targetStack; + var expandingFlags = 0; + inferFromTypes(originalSource, originalTarget); + function inferFromTypes(source, target) { + if (!couldContainTypeVariables(target)) { + return; + } + if (source === wildcardType) { + var savePropagationType = propagationType; + propagationType = source; + inferFromTypes(target, target); + propagationType = savePropagationType; + return; + } + if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) { + if (source.aliasTypeArguments) { + inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol)); + } + return; + } + if (source === target && source.flags & 3145728) { + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + inferFromTypes(t, t); + } + return; + } + if (target.flags & 1048576) { + var _b = inferFromMatchingTypes(source.flags & 1048576 ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1]; + var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1]; + if (targets.length === 0) { + return; + } + target = getUnionType(targets); + if (sources.length === 0) { + inferWithPriority( + source, + target, + 1 + /* InferencePriority.NakedTypeVariable */ + ); + return; + } + source = getUnionType(sources); + } else if (target.flags & 2097152 && ts6.some(target.types, function(t2) { + return !!getInferenceInfoForType(t2) || isGenericMappedType(t2) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t2) || neverType); + })) { + if (!(source.flags & 1048576)) { + var _d = inferFromMatchingTypes(source.flags & 2097152 ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1]; + if (sources.length === 0 || targets.length === 0) { + return; + } + source = getIntersectionType(sources); + target = getIntersectionType(targets); + } + } else if (target.flags & (8388608 | 33554432)) { + target = getActualTypeVariable(target); + } + if (target.flags & 8650752) { + if (isFromInferenceBlockedSource(source)) { + return; + } + var inference = getInferenceInfoForType(target); + if (inference) { + if (ts6.getObjectFlags(source) & 262144 || source === nonInferrableAnyType) { + return; + } + if (!inference.isFixed) { + if (inference.priority === void 0 || priority < inference.priority) { + inference.candidates = void 0; + inference.contraCandidates = void 0; + inference.topLevel = true; + inference.priority = priority; + } + if (priority === inference.priority) { + var candidate = propagationType || source; + if (contravariant && !bivariant) { + if (!ts6.contains(inference.contraCandidates, candidate)) { + inference.contraCandidates = ts6.append(inference.contraCandidates, candidate); + clearCachedInferences(inferences); + } + } else if (!ts6.contains(inference.candidates, candidate)) { + inference.candidates = ts6.append(inference.candidates, candidate); + clearCachedInferences(inferences); + } + } + if (!(priority & 128) && target.flags & 262144 && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { + inference.topLevel = false; + clearCachedInferences(inferences); + } + } + inferencePriority = Math.min(inferencePriority, priority); + return; + } + var simplified = getSimplifiedType( + target, + /*writing*/ + false + ); + if (simplified !== target) { + inferFromTypes(source, simplified); + } else if (target.flags & 8388608) { + var indexType = getSimplifiedType( + target.indexType, + /*writing*/ + false + ); + if (indexType.flags & 465829888) { + var simplified_1 = distributeIndexOverObjectType( + getSimplifiedType( + target.objectType, + /*writing*/ + false + ), + indexType, + /*writing*/ + false + ); + if (simplified_1 && simplified_1 !== target) { + inferFromTypes(source, simplified_1); + } + } + } + } + if (ts6.getObjectFlags(source) & 4 && ts6.getObjectFlags(target) & 4 && (source.target === target.target || isArrayType(source) && isArrayType(target)) && !(source.node && target.node)) { + inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target)); + } else if (source.flags & 4194304 && target.flags & 4194304) { + inferFromContravariantTypes(source.type, target.type); + } else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) { + var empty = createEmptyObjectTypeFromStringLiteral(source); + inferFromContravariantTypesWithPriority( + empty, + target.type, + 256 + /* InferencePriority.LiteralKeyof */ + ); + } else if (source.flags & 8388608 && target.flags & 8388608) { + inferFromTypes(source.objectType, target.objectType); + inferFromTypes(source.indexType, target.indexType); + } else if (source.flags & 268435456 && target.flags & 268435456) { + if (source.symbol === target.symbol) { + inferFromTypes(source.type, target.type); + } + } else if (source.flags & 33554432) { + inferFromTypes(source.baseType, target); + inferWithPriority( + getSubstitutionIntersection(source), + target, + 4 + /* InferencePriority.SubstituteSource */ + ); + } else if (target.flags & 16777216) { + invokeOnce(source, target, inferToConditionalType); + } else if (target.flags & 3145728) { + inferToMultipleTypes(source, target.types, target.flags); + } else if (source.flags & 1048576) { + var sourceTypes = source.types; + for (var _e = 0, sourceTypes_2 = sourceTypes; _e < sourceTypes_2.length; _e++) { + var sourceType = sourceTypes_2[_e]; + inferFromTypes(sourceType, target); + } + } else if (target.flags & 134217728) { + inferToTemplateLiteralType(source, target); + } else { + source = getReducedType(source); + if (!(priority & 512 && source.flags & (2097152 | 465829888))) { + var apparentSource = getApparentType(source); + if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 | 2097152))) { + allowComplexConstraintInference = false; + return inferFromTypes(apparentSource, target); + } + source = apparentSource; + } + if (source.flags & (524288 | 2097152)) { + invokeOnce(source, target, inferFromObjectTypes); + } + } + } + function inferWithPriority(source, target, newPriority) { + var savePriority = priority; + priority |= newPriority; + inferFromTypes(source, target); + priority = savePriority; + } + function inferFromContravariantTypesWithPriority(source, target, newPriority) { + var savePriority = priority; + priority |= newPriority; + inferFromContravariantTypes(source, target); + priority = savePriority; + } + function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) { + var savePriority = priority; + priority |= newPriority; + inferToMultipleTypes(source, targets, targetFlags); + priority = savePriority; + } + function invokeOnce(source, target, action) { + var key = source.id + "," + target.id; + var status = visited && visited.get(key); + if (status !== void 0) { + inferencePriority = Math.min(inferencePriority, status); + return; + } + (visited || (visited = new ts6.Map())).set( + key, + -1 + /* InferencePriority.Circularity */ + ); + var saveInferencePriority = inferencePriority; + inferencePriority = 2048; + var saveExpandingFlags = expandingFlags; + var sourceIdentity = getRecursionIdentity(source); + var targetIdentity = getRecursionIdentity(target); + if (ts6.contains(sourceStack, sourceIdentity)) + expandingFlags |= 1; + if (ts6.contains(targetStack, targetIdentity)) + expandingFlags |= 2; + if (expandingFlags !== 3) { + (sourceStack || (sourceStack = [])).push(sourceIdentity); + (targetStack || (targetStack = [])).push(targetIdentity); + action(source, target); + targetStack.pop(); + sourceStack.pop(); + } else { + inferencePriority = -1; + } + expandingFlags = saveExpandingFlags; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); + } + function inferFromMatchingTypes(sources, targets, matches) { + var matchedSources; + var matchedTargets; + for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) { + var t = targets_1[_i]; + for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) { + var s = sources_1[_a]; + if (matches(s, t)) { + inferFromTypes(s, t); + matchedSources = ts6.appendIfUnique(matchedSources, s); + matchedTargets = ts6.appendIfUnique(matchedTargets, t); + } + } + } + return [ + matchedSources ? ts6.filter(sources, function(t2) { + return !ts6.contains(matchedSources, t2); + }) : sources, + matchedTargets ? ts6.filter(targets, function(t2) { + return !ts6.contains(matchedTargets, t2); + }) : targets + ]; + } + function inferFromTypeArguments(sourceTypes, targetTypes, variances) { + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { + if (i < variances.length && (variances[i] & 7) === 2) { + inferFromContravariantTypes(sourceTypes[i], targetTypes[i]); + } else { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + } + function inferFromContravariantTypes(source, target) { + contravariant = !contravariant; + inferFromTypes(source, target); + contravariant = !contravariant; + } + function inferFromContravariantTypesIfStrictFunctionTypes(source, target) { + if (strictFunctionTypes || priority & 1024) { + inferFromContravariantTypes(source, target); + } else { + inferFromTypes(source, target); + } + } + function getInferenceInfoForType(type) { + if (type.flags & 8650752) { + for (var _i = 0, inferences_2 = inferences; _i < inferences_2.length; _i++) { + var inference = inferences_2[_i]; + if (type === inference.typeParameter) { + return inference; + } + } + } + return void 0; + } + function getSingleTypeVariableFromIntersectionTypes(types) { + var typeVariable; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var type = types_14[_i]; + var t = type.flags & 2097152 && ts6.find(type.types, function(t2) { + return !!getInferenceInfoForType(t2); + }); + if (!t || typeVariable && t !== typeVariable) { + return void 0; + } + typeVariable = t; + } + return typeVariable; + } + function inferToMultipleTypes(source, targets, targetFlags) { + var typeVariableCount = 0; + if (targetFlags & 1048576) { + var nakedTypeVariable = void 0; + var sources = source.flags & 1048576 ? source.types : [source]; + var matched_1 = new Array(sources.length); + var inferenceCircularity = false; + for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) { + var t = targets_2[_i]; + if (getInferenceInfoForType(t)) { + nakedTypeVariable = t; + typeVariableCount++; + } else { + for (var i = 0; i < sources.length; i++) { + var saveInferencePriority = inferencePriority; + inferencePriority = 2048; + inferFromTypes(sources[i], t); + if (inferencePriority === priority) + matched_1[i] = true; + inferenceCircularity = inferenceCircularity || inferencePriority === -1; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); + } + } + } + if (typeVariableCount === 0) { + var intersectionTypeVariable = getSingleTypeVariableFromIntersectionTypes(targets); + if (intersectionTypeVariable) { + inferWithPriority( + source, + intersectionTypeVariable, + 1 + /* InferencePriority.NakedTypeVariable */ + ); + } + return; + } + if (typeVariableCount === 1 && !inferenceCircularity) { + var unmatched = ts6.flatMap(sources, function(s, i2) { + return matched_1[i2] ? void 0 : s; + }); + if (unmatched.length) { + inferFromTypes(getUnionType(unmatched), nakedTypeVariable); + return; + } + } + } else { + for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) { + var t = targets_3[_a]; + if (getInferenceInfoForType(t)) { + typeVariableCount++; + } else { + inferFromTypes(source, t); + } + } + } + if (targetFlags & 2097152 ? typeVariableCount === 1 : typeVariableCount > 0) { + for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) { + var t = targets_4[_b]; + if (getInferenceInfoForType(t)) { + inferWithPriority( + source, + t, + 1 + /* InferencePriority.NakedTypeVariable */ + ); + } + } + } + } + function inferToMappedType(source, target, constraintType) { + if (constraintType.flags & 1048576) { + var result = false; + for (var _i = 0, _a = constraintType.types; _i < _a.length; _i++) { + var type = _a[_i]; + result = inferToMappedType(source, target, type) || result; + } + return result; + } + if (constraintType.flags & 4194304) { + var inference = getInferenceInfoForType(constraintType.type); + if (inference && !inference.isFixed && !isFromInferenceBlockedSource(source)) { + var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); + if (inferredType) { + inferWithPriority( + inferredType, + inference.typeParameter, + ts6.getObjectFlags(source) & 262144 ? 16 : 8 + /* InferencePriority.HomomorphicMappedType */ + ); + } + } + return true; + } + if (constraintType.flags & 262144) { + inferWithPriority( + getIndexType(source), + constraintType, + 32 + /* InferencePriority.MappedTypeConstraint */ + ); + var extendedConstraint = getConstraintOfType(constraintType); + if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) { + return true; + } + var propTypes = ts6.map(getPropertiesOfType(source), getTypeOfSymbol); + var indexTypes = ts6.map(getIndexInfosOfType(source), function(info) { + return info !== enumNumberIndexInfo ? info.type : neverType; + }); + inferFromTypes(getUnionType(ts6.concatenate(propTypes, indexTypes)), getTemplateTypeFromMappedType(target)); + return true; + } + return false; + } + function inferToConditionalType(source, target) { + if (source.flags & 16777216) { + inferFromTypes(source.checkType, target.checkType); + inferFromTypes(source.extendsType, target.extendsType); + inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target)); + inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target)); + } else { + var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)]; + inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 : 0); + } + } + function inferToTemplateLiteralType(source, target) { + var matches = inferTypesFromTemplateLiteralType(source, target); + var types = target.types; + if (matches || ts6.every(target.texts, function(s) { + return s.length === 0; + })) { + var _loop_24 = function(i2) { + var source_1 = matches ? matches[i2] : neverType; + var target_3 = types[i2]; + if (source_1.flags & 128 && target_3.flags & 8650752) { + var inferenceContext = getInferenceInfoForType(target_3); + var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : void 0; + if (constraint && !isTypeAny(constraint)) { + var constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint]; + var allTypeFlags_1 = ts6.reduceLeft(constraintTypes, function(flags, t) { + return flags | t.flags; + }, 0); + if (!(allTypeFlags_1 & 4)) { + var str_1 = source_1.value; + if (allTypeFlags_1 & 296 && !isValidNumberString( + str_1, + /*roundTripOnly*/ + true + )) { + allTypeFlags_1 &= ~296; + } + if (allTypeFlags_1 & 2112 && !isValidBigIntString( + str_1, + /*roundTripOnly*/ + true + )) { + allTypeFlags_1 &= ~2112; + } + var matchingType = ts6.reduceLeft(constraintTypes, function(left, right) { + return !(right.flags & allTypeFlags_1) ? left : left.flags & 4 ? left : right.flags & 4 ? source_1 : left.flags & 134217728 ? left : right.flags & 134217728 && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 : left.flags & 268435456 ? left : right.flags & 268435456 && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 : left.flags & 128 ? left : right.flags & 128 && right.value === str_1 ? right : left.flags & 8 ? left : right.flags & 8 ? getNumberLiteralType(+str_1) : left.flags & 32 ? left : right.flags & 32 ? getNumberLiteralType(+str_1) : left.flags & 256 ? left : right.flags & 256 && right.value === +str_1 ? right : left.flags & 64 ? left : right.flags & 64 ? parseBigIntLiteralType(str_1) : left.flags & 2048 ? left : right.flags & 2048 && ts6.pseudoBigIntToString(right.value) === str_1 ? right : left.flags & 16 ? left : right.flags & 16 ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType : left.flags & 512 ? left : right.flags & 512 && right.intrinsicName === str_1 ? right : left.flags & 32768 ? left : right.flags & 32768 && right.intrinsicName === str_1 ? right : left.flags & 65536 ? left : right.flags & 65536 && right.intrinsicName === str_1 ? right : left; + }, neverType); + if (!(matchingType.flags & 131072)) { + inferFromTypes(matchingType, target_3); + return "continue"; + } + } + } + } + inferFromTypes(source_1, target_3); + }; + for (var i = 0; i < types.length; i++) { + _loop_24(i); + } + } + } + function inferFromObjectTypes(source, target) { + if (ts6.getObjectFlags(source) & 4 && ts6.getObjectFlags(target) & 4 && (source.target === target.target || isArrayType(source) && isArrayType(target))) { + inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target)); + return; + } + if (isGenericMappedType(source) && isGenericMappedType(target)) { + inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target)); + inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + var sourceNameType = getNameTypeFromMappedType(source); + var targetNameType = getNameTypeFromMappedType(target); + if (sourceNameType && targetNameType) + inferFromTypes(sourceNameType, targetNameType); + } + if (ts6.getObjectFlags(target) & 32 && !target.declaration.nameType) { + var constraintType = getConstraintTypeFromMappedType(target); + if (inferToMappedType(source, target, constraintType)) { + return; + } + } + if (!typesDefinitelyUnrelated(source, target)) { + if (isArrayOrTupleType(source)) { + if (isTupleType(target)) { + var sourceArity = getTypeReferenceArity(source); + var targetArity = getTypeReferenceArity(target); + var elementTypes = getTypeArguments(target); + var elementFlags = target.target.elementFlags; + if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) { + for (var i = 0; i < targetArity; i++) { + inferFromTypes(getTypeArguments(source)[i], elementTypes[i]); + } + return; + } + var startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0; + var endLength = Math.min(isTupleType(source) ? getEndElementCount( + source.target, + 3 + /* ElementFlags.Fixed */ + ) : 0, target.target.hasRestElement ? getEndElementCount( + target.target, + 3 + /* ElementFlags.Fixed */ + ) : 0); + for (var i = 0; i < startLength; i++) { + inferFromTypes(getTypeArguments(source)[i], elementTypes[i]); + } + if (!isTupleType(source) || sourceArity - startLength - endLength === 1 && source.target.elementFlags[startLength] & 4) { + var restType = getTypeArguments(source)[startLength]; + for (var i = startLength; i < targetArity - endLength; i++) { + inferFromTypes(elementFlags[i] & 8 ? createArrayType(restType) : restType, elementTypes[i]); + } + } else { + var middleLength = targetArity - startLength - endLength; + if (middleLength === 2 && elementFlags[startLength] & elementFlags[startLength + 1] & 8 && isTupleType(source)) { + var targetInfo = getInferenceInfoForType(elementTypes[startLength]); + if (targetInfo && targetInfo.impliedArity !== void 0) { + inferFromTypes(sliceTupleType(source, startLength, endLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]); + inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]); + } + } else if (middleLength === 1 && elementFlags[startLength] & 8) { + var endsInOptional = target.target.elementFlags[targetArity - 1] & 2; + var sourceSlice = isTupleType(source) ? sliceTupleType(source, startLength, endLength) : createArrayType(getTypeArguments(source)[0]); + inferWithPriority(sourceSlice, elementTypes[startLength], endsInOptional ? 2 : 0); + } else if (middleLength === 1 && elementFlags[startLength] & 4) { + var restType = isTupleType(source) ? getElementTypeOfSliceOfTupleType(source, startLength, endLength) : getTypeArguments(source)[0]; + if (restType) { + inferFromTypes(restType, elementTypes[startLength]); + } + } + } + for (var i = 0; i < endLength; i++) { + inferFromTypes(getTypeArguments(source)[sourceArity - i - 1], elementTypes[targetArity - i - 1]); + } + return; + } + if (isArrayType(target)) { + inferFromIndexTypes(source, target); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures( + source, + target, + 0 + /* SignatureKind.Call */ + ); + inferFromSignatures( + source, + target, + 1 + /* SignatureKind.Construct */ + ); + inferFromIndexTypes(source, target); + } + } + function inferFromProperties(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var targetProp = properties_3[_i]; + var sourceProp = getPropertyOfType(source, targetProp.escapedName); + if (sourceProp && !ts6.some(sourceProp.declarations, hasSkipDirectInferenceFlag)) { + inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + } + } + function inferFromSignatures(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var sourceLen = sourceSignatures.length; + var targetLen = targetSignatures.length; + var len = sourceLen < targetLen ? sourceLen : targetLen; + for (var i = 0; i < len; i++) { + inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); + } + } + function inferFromSignature(source, target) { + var saveBivariant = bivariant; + var kind = target.declaration ? target.declaration.kind : 0; + bivariant = bivariant || kind === 171 || kind === 170 || kind === 173; + applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); + bivariant = saveBivariant; + applyToReturnTypes(source, target, inferFromTypes); + } + function inferFromIndexTypes(source, target) { + var priority2 = ts6.getObjectFlags(source) & ts6.getObjectFlags(target) & 32 ? 8 : 0; + var indexInfos = getIndexInfosOfType(target); + if (isObjectTypeWithInferableIndex(source)) { + for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) { + var targetInfo = indexInfos_6[_i]; + var propTypes = []; + for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { + var prop = _b[_a]; + if (isApplicableIndexType(getLiteralTypeFromProperty( + prop, + 8576 + /* TypeFlags.StringOrNumberLiteralOrUnique */ + ), targetInfo.keyType)) { + var propType = getTypeOfSymbol(prop); + propTypes.push(prop.flags & 16777216 ? removeMissingOrUndefinedType(propType) : propType); + } + } + for (var _c = 0, _d = getIndexInfosOfType(source); _c < _d.length; _c++) { + var info = _d[_c]; + if (isApplicableIndexType(info.keyType, targetInfo.keyType)) { + propTypes.push(info.type); + } + } + if (propTypes.length) { + inferWithPriority(getUnionType(propTypes), targetInfo.type, priority2); + } + } + } + for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) { + var targetInfo = indexInfos_7[_e]; + var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType); + if (sourceInfo) { + inferWithPriority(sourceInfo.type, targetInfo.type, priority2); + } + } + } + } + function isTypeOrBaseIdenticalTo(s, t) { + return exactOptionalPropertyTypes && t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 4 && s.flags & 128 || t.flags & 8 && s.flags & 256); + } + function isTypeCloselyMatchedBy(s, t) { + return !!(s.flags & 524288 && t.flags & 524288 && s.symbol && s.symbol === t.symbol || s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol); + } + function hasPrimitiveConstraint(type) { + var constraint = getConstraintOfTypeParameter(type); + return !!constraint && maybeTypeOfKind( + constraint.flags & 16777216 ? getDefaultConstraintOfConditionalType(constraint) : constraint, + 131068 | 4194304 | 134217728 | 268435456 + /* TypeFlags.StringMapping */ + ); + } + function isObjectLiteralType(type) { + return !!(ts6.getObjectFlags(type) & 128); + } + function isObjectOrArrayLiteralType(type) { + return !!(ts6.getObjectFlags(type) & (128 | 16384)); + } + function unionObjectAndArrayLiteralCandidates(candidates) { + if (candidates.length > 1) { + var objectLiterals = ts6.filter(candidates, isObjectOrArrayLiteralType); + if (objectLiterals.length) { + var literalsType = getUnionType( + objectLiterals, + 2 + /* UnionReduction.Subtype */ + ); + return ts6.concatenate(ts6.filter(candidates, function(t) { + return !isObjectOrArrayLiteralType(t); + }), [literalsType]); + } + } + return candidates; + } + function getContravariantInference(inference) { + return inference.priority & 416 ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates); + } + function getCovariantInference(inference, signature) { + var candidates = unionObjectAndArrayLiteralCandidates(inference.candidates); + var primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter); + var widenLiteralTypes = !primitiveConstraint && inference.topLevel && (inference.isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), inference.typeParameter)); + var baseCandidates = primitiveConstraint ? ts6.sameMap(candidates, getRegularTypeOfLiteralType) : widenLiteralTypes ? ts6.sameMap(candidates, getWidenedLiteralType) : candidates; + var unwidenedType = inference.priority & 416 ? getUnionType( + baseCandidates, + 2 + /* UnionReduction.Subtype */ + ) : getCommonSupertype(baseCandidates); + return getWidenedType(unwidenedType); + } + function getInferredType(context, index) { + var inference = context.inferences[index]; + if (!inference.inferredType) { + var inferredType = void 0; + var signature = context.signature; + if (signature) { + var inferredCovariantType_1 = inference.candidates ? getCovariantInference(inference, signature) : void 0; + if (inference.contraCandidates) { + inferredType = inferredCovariantType_1 && !(inferredCovariantType_1.flags & 131072) && ts6.some(inference.contraCandidates, function(t) { + return isTypeSubtypeOf(inferredCovariantType_1, t); + }) ? inferredCovariantType_1 : getContravariantInference(inference); + } else if (inferredCovariantType_1) { + inferredType = inferredCovariantType_1; + } else if (context.flags & 1) { + inferredType = silentNeverType; + } else { + var defaultType = getDefaultFromTypeParameter(inference.typeParameter); + if (defaultType) { + inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper)); + } + } + } else { + inferredType = getTypeFromInference(inference); + } + inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2)); + var constraint = getConstraintOfTypeParameter(inference.typeParameter); + if (constraint) { + var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper); + if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + inference.inferredType = inferredType = instantiatedConstraint; + } + } + } + return inference.inferredType; + } + function getDefaultTypeArgumentType(isInJavaScriptFile) { + return isInJavaScriptFile ? anyType : unknownType; + } + function getInferredTypes(context) { + var result = []; + for (var i = 0; i < context.inferences.length; i++) { + result.push(getInferredType(context, i)); + } + return result; + } + function getCannotFindNameDiagnosticForName(node) { + switch (node.escapedText) { + case "document": + case "console": + return ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom; + case "$": + return compilerOptions.types ? ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig : ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery; + case "describe": + case "suite": + case "it": + case "test": + return compilerOptions.types ? ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig : ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha; + case "process": + case "require": + case "Buffer": + case "module": + return compilerOptions.types ? ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig : ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; + case "Map": + case "Set": + case "Promise": + case "Symbol": + case "WeakMap": + case "WeakSet": + case "Iterator": + case "AsyncIterator": + case "SharedArrayBuffer": + case "Atomics": + case "AsyncIterable": + case "AsyncIterableIterator": + case "AsyncGenerator": + case "AsyncGeneratorFunction": + case "BigInt": + case "Reflect": + case "BigInt64Array": + case "BigUint64Array": + return ts6.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later; + case "await": + if (ts6.isCallExpression(node.parent)) { + return ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function; + } + default: + if (node.parent.kind === 300) { + return ts6.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; + } else { + return ts6.Diagnostics.Cannot_find_name_0; + } + } + } + function getResolvedSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = !ts6.nodeIsMissing(node) && resolveName( + node, + node.escapedText, + 111551 | 1048576, + getCannotFindNameDiagnosticForName(node), + node, + !ts6.isWriteOnlyAccess(node), + /*excludeGlobals*/ + false + ) || unknownSymbol; + } + return links.resolvedSymbol; + } + function isInTypeQuery(node) { + return !!ts6.findAncestor(node, function(n) { + return n.kind === 183 ? true : n.kind === 79 || n.kind === 163 ? false : "quit"; + }); + } + function getFlowCacheKey(node, declaredType, initialType, flowContainer) { + switch (node.kind) { + case 79: + if (!ts6.isThisInTypeQuery(node)) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType), "|").concat(getSymbolId(symbol)) : void 0; + } + case 108: + return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); + case 232: + case 214: + return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); + case 163: + var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); + return left && left + "." + node.right.escapedText; + case 208: + case 209: + var propName = getAccessedPropertyName(node); + if (propName !== void 0) { + var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); + return key && key + "." + propName; + } + break; + case 203: + case 204: + case 259: + case 215: + case 216: + case 171: + return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); + } + return void 0; + } + function isMatchingReference(source, target) { + switch (target.kind) { + case 214: + case 232: + return isMatchingReference(source, target.expression); + case 223: + return ts6.isAssignmentExpression(target) && isMatchingReference(source, target.left) || ts6.isBinaryExpression(target) && target.operatorToken.kind === 27 && isMatchingReference(source, target.right); + } + switch (source.kind) { + case 233: + return target.kind === 233 && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; + case 79: + case 80: + return ts6.isThisInTypeQuery(source) ? target.kind === 108 : target.kind === 79 && getResolvedSymbol(source) === getResolvedSymbol(target) || (target.kind === 257 || target.kind === 205) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); + case 108: + return target.kind === 108; + case 106: + return target.kind === 106; + case 232: + case 214: + return isMatchingReference(source.expression, target); + case 208: + case 209: + var sourcePropertyName = getAccessedPropertyName(source); + var targetPropertyName = ts6.isAccessExpression(target) ? getAccessedPropertyName(target) : void 0; + return sourcePropertyName !== void 0 && targetPropertyName !== void 0 && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); + case 163: + return ts6.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); + case 223: + return ts6.isBinaryExpression(source) && source.operatorToken.kind === 27 && isMatchingReference(source.right, target); + } + return false; + } + function getAccessedPropertyName(access) { + if (ts6.isPropertyAccessExpression(access)) { + return access.name.escapedText; + } + if (ts6.isElementAccessExpression(access)) { + return tryGetElementAccessExpressionName(access); + } + if (ts6.isBindingElement(access)) { + var name = getDestructuringPropertyName(access); + return name ? ts6.escapeLeadingUnderscores(name) : void 0; + } + if (ts6.isParameter(access)) { + return "" + access.parent.parameters.indexOf(access); + } + return void 0; + } + function tryGetNameFromType(type) { + return type.flags & 8192 ? type.escapedName : type.flags & 384 ? ts6.escapeLeadingUnderscores("" + type.value) : void 0; + } + function tryGetElementAccessExpressionName(node) { + if (ts6.isStringOrNumericLiteralLike(node.argumentExpression)) { + return ts6.escapeLeadingUnderscores(node.argumentExpression.text); + } + if (ts6.isEntityNameExpression(node.argumentExpression)) { + var symbol = resolveEntityName( + node.argumentExpression, + 111551, + /*ignoreErrors*/ + true + ); + if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8)) + return void 0; + var declaration = symbol.valueDeclaration; + if (declaration === void 0) + return void 0; + var type = tryGetTypeFromEffectiveTypeNode(declaration); + if (type) { + var name = tryGetNameFromType(type); + if (name !== void 0) { + return name; + } + } + if (ts6.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { + var initializer = ts6.getEffectiveInitializer(declaration); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts6.isEnumMember(declaration)) { + return ts6.getTextOfPropertyName(declaration.name); + } + } + } + return void 0; + } + function containsMatchingReference(source, target) { + while (ts6.isAccessExpression(source)) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; + } + } + return false; + } + function optionalChainContainsReference(source, target) { + while (ts6.isOptionalChain(source)) { + source = source.expression; + if (isMatchingReference(source, target)) { + return true; + } + } + return false; + } + function isDiscriminantProperty(type, name) { + if (type && type.flags & 1048576) { + var prop = getUnionOrIntersectionProperty(type, name); + if (prop && ts6.getCheckFlags(prop) & 2) { + if (prop.isDiscriminantProperty === void 0) { + prop.isDiscriminantProperty = (prop.checkFlags & 192) === 192 && !isGenericType(getTypeOfSymbol(prop)); + } + return !!prop.isDiscriminantProperty; + } + } + return false; + } + function findDiscriminantProperties(sourceProperties, target) { + var result; + for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { + var sourceProperty = sourceProperties_2[_i]; + if (isDiscriminantProperty(target, sourceProperty.escapedName)) { + if (result) { + result.push(sourceProperty); + continue; + } + result = [sourceProperty]; + } + } + return result; + } + function mapTypesByKeyProperty(types, name) { + var map = new ts6.Map(); + var count = 0; + var _loop_25 = function(type2) { + if (type2.flags & (524288 | 2097152 | 58982400)) { + var discriminant = getTypeOfPropertyOfType(type2, name); + if (discriminant) { + if (!isLiteralType(discriminant)) { + return { value: void 0 }; + } + var duplicate_1 = false; + forEachType(discriminant, function(t) { + var id = getTypeId(getRegularTypeOfLiteralType(t)); + var existing = map.get(id); + if (!existing) { + map.set(id, type2); + } else if (existing !== unknownType) { + map.set(id, unknownType); + duplicate_1 = true; + } + }); + if (!duplicate_1) + count++; + } + } + }; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var type = types_15[_i]; + var state_9 = _loop_25(type); + if (typeof state_9 === "object") + return state_9.value; + } + return count >= 10 && count * 2 >= types.length ? map : void 0; + } + function getKeyPropertyName(unionType) { + var types = unionType.types; + if (types.length < 10 || ts6.getObjectFlags(unionType) & 32768 || ts6.countWhere(types, function(t) { + return !!(t.flags & (524288 | 58982400)); + }) < 10) { + return void 0; + } + if (unionType.keyPropertyName === void 0) { + var keyPropertyName = ts6.forEach(types, function(t) { + return t.flags & (524288 | 58982400) ? ts6.forEach(getPropertiesOfType(t), function(p) { + return isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0; + }) : void 0; + }); + var mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName); + unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : ""; + unionType.constituentMap = mapByKeyProperty; + } + return unionType.keyPropertyName.length ? unionType.keyPropertyName : void 0; + } + function getConstituentTypeForKeyType(unionType, keyType) { + var _a; + var result = (_a = unionType.constituentMap) === null || _a === void 0 ? void 0 : _a.get(getTypeId(getRegularTypeOfLiteralType(keyType))); + return result !== unknownType ? result : void 0; + } + function getMatchingUnionConstituentForType(unionType, type) { + var keyPropertyName = getKeyPropertyName(unionType); + var propType = keyPropertyName && getTypeOfPropertyOfType(type, keyPropertyName); + return propType && getConstituentTypeForKeyType(unionType, propType); + } + function getMatchingUnionConstituentForObjectLiteral(unionType, node) { + var keyPropertyName = getKeyPropertyName(unionType); + var propNode = keyPropertyName && ts6.find(node.properties, function(p) { + return p.symbol && p.kind === 299 && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); + }); + var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); + return propType && getConstituentTypeForKeyType(unionType, propType); + } + function isOrContainsMatchingReference(source, target) { + return isMatchingReference(source, target) || containsMatchingReference(source, target); + } + function hasMatchingArgument(expression, reference) { + if (expression.arguments) { + for (var _i = 0, _a = expression.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (isOrContainsMatchingReference(reference, argument)) { + return true; + } + } + } + if (expression.expression.kind === 208 && isOrContainsMatchingReference(reference, expression.expression.expression)) { + return true; + } + return false; + } + function getFlowNodeId(flow) { + if (!flow.id || flow.id < 0) { + flow.id = nextFlowId; + nextFlowId++; + } + return flow.id; + } + function typeMaybeAssignableTo(source, target) { + if (!(source.flags & 1048576)) { + return isTypeAssignableTo(source, target); + } + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isTypeAssignableTo(t, target)) { + return true; + } + } + return false; + } + function getAssignmentReducedType(declaredType, assignedType) { + var _a; + if (declaredType === assignedType) { + return declaredType; + } + if (assignedType.flags & 131072) { + return assignedType; + } + var key = "A".concat(getTypeId(declaredType), ",").concat(getTypeId(assignedType)); + return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType)); + } + function getAssignmentReducedTypeWorker(declaredType, assignedType) { + var filteredType = filterType(declaredType, function(t) { + return typeMaybeAssignableTo(assignedType, t); + }); + var reducedType = assignedType.flags & 512 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType; + return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType; + } + function isFunctionObjectType(type) { + var resolved = resolveStructuredTypeMembers(type); + return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); + } + function getTypeFacts(type) { + if (type.flags & (2097152 | 465829888)) { + type = getBaseConstraintOfType(type) || unknownType; + } + var flags = type.flags; + if (flags & (4 | 268435456)) { + return strictNullChecks ? 16317953 : 16776705; + } + if (flags & (128 | 134217728)) { + var isEmpty = flags & 128 && type.value === ""; + return strictNullChecks ? isEmpty ? 12123649 : 7929345 : isEmpty ? 12582401 : 16776705; + } + if (flags & (8 | 32)) { + return strictNullChecks ? 16317698 : 16776450; + } + if (flags & 256) { + var isZero = type.value === 0; + return strictNullChecks ? isZero ? 12123394 : 7929090 : isZero ? 12582146 : 16776450; + } + if (flags & 64) { + return strictNullChecks ? 16317188 : 16775940; + } + if (flags & 2048) { + var isZero = isZeroBigInt(type); + return strictNullChecks ? isZero ? 12122884 : 7928580 : isZero ? 12581636 : 16775940; + } + if (flags & 16) { + return strictNullChecks ? 16316168 : 16774920; + } + if (flags & 528) { + return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 : 7927560 : type === falseType || type === regularFalseType ? 12580616 : 16774920; + } + if (flags & 524288) { + return ts6.getObjectFlags(type) & 16 && isEmptyObjectType(type) ? strictNullChecks ? 83427327 : 83886079 : isFunctionObjectType(type) ? strictNullChecks ? 7880640 : 16728e3 : strictNullChecks ? 7888800 : 16736160; + } + if (flags & 16384) { + return 9830144; + } + if (flags & 32768) { + return 26607360; + } + if (flags & 65536) { + return 42917664; + } + if (flags & 12288) { + return strictNullChecks ? 7925520 : 16772880; + } + if (flags & 67108864) { + return strictNullChecks ? 7888800 : 16736160; + } + if (flags & 131072) { + return 0; + } + if (flags & 1048576) { + return ts6.reduceLeft( + type.types, + function(facts, t) { + return facts | getTypeFacts(t); + }, + 0 + /* TypeFacts.None */ + ); + } + if (flags & 2097152) { + return getIntersectionTypeFacts(type); + } + return 83886079; + } + function getIntersectionTypeFacts(type) { + var ignoreObjects = maybeTypeOfKind( + type, + 131068 + /* TypeFlags.Primitive */ + ); + var oredFacts = 0; + var andedFacts = 134217727; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!(ignoreObjects && t.flags & 524288)) { + var f = getTypeFacts(t); + oredFacts |= f; + andedFacts &= f; + } + } + return oredFacts & 8256 | andedFacts & 134209471; + } + function getTypeWithFacts(type, include) { + return filterType(type, function(t) { + return (getTypeFacts(t) & include) !== 0; + }); + } + function getAdjustedTypeWithFacts(type, facts) { + var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 ? unknownUnionType : type, facts)); + if (strictNullChecks) { + switch (facts) { + case 524288: + return mapType(reduced, function(t) { + return getTypeFacts(t) & 65536 ? getIntersectionType([t, getTypeFacts(t) & 131072 && !maybeTypeOfKind( + reduced, + 65536 + /* TypeFlags.Null */ + ) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; + }); + case 1048576: + return mapType(reduced, function(t) { + return getTypeFacts(t) & 131072 ? getIntersectionType([t, getTypeFacts(t) & 65536 && !maybeTypeOfKind( + reduced, + 32768 + /* TypeFlags.Undefined */ + ) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; + }); + case 2097152: + case 4194304: + return mapType(reduced, function(t) { + return getTypeFacts(t) & 262144 ? getGlobalNonNullableTypeInstantiation(t) : t; + }); + } + } + return reduced; + } + function recombineUnknownType(type) { + return type === unknownUnionType ? unknownType : type; + } + function getTypeWithDefault(type, defaultExpression) { + return defaultExpression ? getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) : type; + } + function getTypeOfDestructuredProperty(type, name) { + var _a; + var nameType = getLiteralTypeFromPropertyName(name); + if (!isTypeUsableAsPropertyName(nameType)) + return errorType; + var text = getPropertyNameFromType(nameType); + return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a = getApplicableIndexInfoForName(type, text)) === null || _a === void 0 ? void 0 : _a.type) || errorType; + } + function getTypeOfDestructuredArrayElement(type, index) { + return everyType(type, isTupleLikeType) && getTupleElementType(type, index) || includeUndefinedInIndexSignature(checkIteratedTypeOrElementType( + 65, + type, + undefinedType, + /*errorNode*/ + void 0 + )) || errorType; + } + function includeUndefinedInIndexSignature(type) { + if (!type) + return type; + return compilerOptions.noUncheckedIndexedAccess ? getUnionType([type, undefinedType]) : type; + } + function getTypeOfDestructuredSpreadExpression(type) { + return createArrayType(checkIteratedTypeOrElementType( + 65, + type, + undefinedType, + /*errorNode*/ + void 0 + ) || errorType); + } + function getAssignedTypeOfBinaryExpression(node) { + var isDestructuringDefaultAssignment = node.parent.kind === 206 && isDestructuringAssignmentTarget(node.parent) || node.parent.kind === 299 && isDestructuringAssignmentTarget(node.parent.parent); + return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); + } + function isDestructuringAssignmentTarget(parent) { + return parent.parent.kind === 223 && parent.parent.left === parent || parent.parent.kind === 247 && parent.parent.initializer === parent; + } + function getAssignedTypeOfArrayLiteralElement(node, element) { + return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); + } + function getAssignedTypeOfSpreadExpression(node) { + return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent)); + } + function getAssignedTypeOfPropertyAssignment(node) { + return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); + } + function getAssignedTypeOfShorthandPropertyAssignment(node) { + return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer); + } + function getAssignedType(node) { + var parent = node.parent; + switch (parent.kind) { + case 246: + return stringType; + case 247: + return checkRightHandSideOfForOf(parent) || errorType; + case 223: + return getAssignedTypeOfBinaryExpression(parent); + case 217: + return undefinedType; + case 206: + return getAssignedTypeOfArrayLiteralElement(parent, node); + case 227: + return getAssignedTypeOfSpreadExpression(parent); + case 299: + return getAssignedTypeOfPropertyAssignment(parent); + case 300: + return getAssignedTypeOfShorthandPropertyAssignment(parent); + } + return errorType; + } + function getInitialTypeOfBindingElement(node) { + var pattern = node.parent; + var parentType = getInitialType(pattern.parent); + var type = pattern.kind === 203 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); + return getTypeWithDefault(type, node.initializer); + } + function getTypeOfInitializer(node) { + var links = getNodeLinks(node); + return links.resolvedType || getTypeOfExpression(node); + } + function getInitialTypeOfVariableDeclaration(node) { + if (node.initializer) { + return getTypeOfInitializer(node.initializer); + } + if (node.parent.parent.kind === 246) { + return stringType; + } + if (node.parent.parent.kind === 247) { + return checkRightHandSideOfForOf(node.parent.parent) || errorType; + } + return errorType; + } + function getInitialType(node) { + return node.kind === 257 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); + } + function isEmptyArrayAssignment(node) { + return node.kind === 257 && node.initializer && isEmptyArrayLiteral(node.initializer) || node.kind !== 205 && node.parent.kind === 223 && isEmptyArrayLiteral(node.parent.right); + } + function getReferenceCandidate(node) { + switch (node.kind) { + case 214: + return getReferenceCandidate(node.expression); + case 223: + switch (node.operatorToken.kind) { + case 63: + case 75: + case 76: + case 77: + return getReferenceCandidate(node.left); + case 27: + return getReferenceCandidate(node.right); + } + } + return node; + } + function getReferenceRoot(node) { + var parent = node.parent; + return parent.kind === 214 || parent.kind === 223 && parent.operatorToken.kind === 63 && parent.left === node || parent.kind === 223 && parent.operatorToken.kind === 27 && parent.right === node ? getReferenceRoot(parent) : node; + } + function getTypeOfSwitchClause(clause) { + if (clause.kind === 292) { + return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); + } + return neverType; + } + function getSwitchClauseTypes(switchStatement) { + var links = getNodeLinks(switchStatement); + if (!links.switchTypes) { + links.switchTypes = []; + for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + links.switchTypes.push(getTypeOfSwitchClause(clause)); + } + } + return links.switchTypes; + } + function getSwitchClauseTypeOfWitnesses(switchStatement) { + if (ts6.some(switchStatement.caseBlock.clauses, function(clause2) { + return clause2.kind === 292 && !ts6.isStringLiteralLike(clause2.expression); + })) { + return void 0; + } + var witnesses = []; + for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + var text = clause.kind === 292 ? clause.expression.text : void 0; + witnesses.push(text && !ts6.contains(witnesses, text) ? text : void 0); + } + return witnesses; + } + function eachTypeContainedIn(source, types) { + return source.flags & 1048576 ? !ts6.forEach(source.types, function(t) { + return !ts6.contains(types, t); + }) : ts6.contains(types, source); + } + function isTypeSubsetOf(source, target) { + return source === target || target.flags & 1048576 && isTypeSubsetOfUnion(source, target); + } + function isTypeSubsetOfUnion(source, target) { + if (source.flags & 1048576) { + for (var _i = 0, _a = source.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!containsType(target.types, t)) { + return false; + } + } + return true; + } + if (source.flags & 1024 && getBaseTypeOfEnumLiteralType(source) === target) { + return true; + } + return containsType(target.types, source); + } + function forEachType(type, f) { + return type.flags & 1048576 ? ts6.forEach(type.types, f) : f(type); + } + function someType(type, f) { + return type.flags & 1048576 ? ts6.some(type.types, f) : f(type); + } + function everyType(type, f) { + return type.flags & 1048576 ? ts6.every(type.types, f) : f(type); + } + function everyContainedType(type, f) { + return type.flags & 3145728 ? ts6.every(type.types, f) : f(type); + } + function filterType(type, f) { + if (type.flags & 1048576) { + var types = type.types; + var filtered = ts6.filter(types, f); + if (filtered === types) { + return type; + } + var origin = type.origin; + var newOrigin = void 0; + if (origin && origin.flags & 1048576) { + var originTypes = origin.types; + var originFiltered = ts6.filter(originTypes, function(t) { + return !!(t.flags & 1048576) || f(t); + }); + if (originTypes.length - originFiltered.length === types.length - filtered.length) { + if (originFiltered.length === 1) { + return originFiltered[0]; + } + newOrigin = createOriginUnionOrIntersectionType(1048576, originFiltered); + } + } + return getUnionTypeFromSortedList( + filtered, + type.objectFlags, + /*aliasSymbol*/ + void 0, + /*aliasTypeArguments*/ + void 0, + newOrigin + ); + } + return type.flags & 131072 || f(type) ? type : neverType; + } + function removeType(type, targetType) { + return filterType(type, function(t) { + return t !== targetType; + }); + } + function countTypes(type) { + return type.flags & 1048576 ? type.types.length : 1; + } + function mapType(type, mapper, noReductions) { + if (type.flags & 131072) { + return type; + } + if (!(type.flags & 1048576)) { + return mapper(type); + } + var origin = type.origin; + var types = origin && origin.flags & 1048576 ? origin.types : type.types; + var mappedTypes; + var changed = false; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; + var mapped = t.flags & 1048576 ? mapType(t, mapper, noReductions) : mapper(t); + changed || (changed = t !== mapped); + if (mapped) { + if (!mappedTypes) { + mappedTypes = [mapped]; + } else { + mappedTypes.push(mapped); + } + } + } + return changed ? mappedTypes && getUnionType( + mappedTypes, + noReductions ? 0 : 1 + /* UnionReduction.Literal */ + ) : type; + } + function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) { + return type.flags & 1048576 && aliasSymbol ? getUnionType(ts6.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) : mapType(type, mapper); + } + function extractTypesOfKind(type, kind) { + return filterType(type, function(t) { + return (t.flags & kind) !== 0; + }); + } + function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) { + if (maybeTypeOfKind( + typeWithPrimitives, + 4 | 134217728 | 8 | 64 + /* TypeFlags.BigInt */ + ) && maybeTypeOfKind( + typeWithLiterals, + 128 | 134217728 | 268435456 | 256 | 2048 + /* TypeFlags.BigIntLiteral */ + )) { + return mapType(typeWithPrimitives, function(t) { + return t.flags & 4 ? extractTypesOfKind( + typeWithLiterals, + 4 | 128 | 134217728 | 268435456 + /* TypeFlags.StringMapping */ + ) : isPatternLiteralType(t) && !maybeTypeOfKind( + typeWithLiterals, + 4 | 134217728 | 268435456 + /* TypeFlags.StringMapping */ + ) ? extractTypesOfKind( + typeWithLiterals, + 128 + /* TypeFlags.StringLiteral */ + ) : t.flags & 8 ? extractTypesOfKind( + typeWithLiterals, + 8 | 256 + /* TypeFlags.NumberLiteral */ + ) : t.flags & 64 ? extractTypesOfKind( + typeWithLiterals, + 64 | 2048 + /* TypeFlags.BigIntLiteral */ + ) : t; + }); + } + return typeWithPrimitives; + } + function isIncomplete(flowType) { + return flowType.flags === 0; + } + function getTypeFromFlowType(flowType) { + return flowType.flags === 0 ? flowType.type : flowType; + } + function createFlowType(type, incomplete) { + return incomplete ? { flags: 0, type: type.flags & 131072 ? silentNeverType : type } : type; + } + function createEvolvingArrayType(elementType) { + var result = createObjectType( + 256 + /* ObjectFlags.EvolvingArray */ + ); + result.elementType = elementType; + return result; + } + function getEvolvingArrayType(elementType) { + return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); + } + function addEvolvingArrayElementType(evolvingArrayType, node) { + var elementType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node))); + return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); + } + function createFinalArrayType(elementType) { + return elementType.flags & 131072 ? autoArrayType : createArrayType(elementType.flags & 1048576 ? getUnionType( + elementType.types, + 2 + /* UnionReduction.Subtype */ + ) : elementType); + } + function getFinalArrayType(evolvingArrayType) { + return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType)); + } + function finalizeEvolvingArrayType(type) { + return ts6.getObjectFlags(type) & 256 ? getFinalArrayType(type) : type; + } + function getElementTypeOfEvolvingArrayType(type) { + return ts6.getObjectFlags(type) & 256 ? type.elementType : neverType; + } + function isEvolvingArrayTypeList(types) { + var hasEvolvingArrayType = false; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; + if (!(t.flags & 131072)) { + if (!(ts6.getObjectFlags(t) & 256)) { + return false; + } + hasEvolvingArrayType = true; + } + } + return hasEvolvingArrayType; + } + function isEvolvingArrayOperationTarget(node) { + var root = getReferenceRoot(node); + var parent = root.parent; + var isLengthPushOrUnshift = ts6.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || parent.parent.kind === 210 && ts6.isIdentifier(parent.name) && ts6.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 209 && parent.expression === root && parent.parent.kind === 223 && parent.parent.operatorToken.kind === 63 && parent.parent.left === parent && !ts6.isAssignmentTarget(parent.parent) && isTypeAssignableToKind( + getTypeOfExpression(parent.argumentExpression), + 296 + /* TypeFlags.NumberLike */ + ); + return isLengthPushOrUnshift || isElementAssignment; + } + function isDeclarationWithExplicitTypeAnnotation(node) { + return (ts6.isVariableDeclaration(node) || ts6.isPropertyDeclaration(node) || ts6.isPropertySignature(node) || ts6.isParameter(node)) && !!(ts6.getEffectiveTypeAnnotationNode(node) || ts6.isInJSFile(node) && ts6.hasInitializer(node) && node.initializer && ts6.isFunctionExpressionOrArrowFunction(node.initializer) && ts6.getEffectiveReturnTypeNode(node.initializer)); + } + function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); + if (symbol.flags & (16 | 8192 | 32 | 512)) { + return getTypeOfSymbol(symbol); + } + if (symbol.flags & (3 | 4)) { + if (ts6.getCheckFlags(symbol) & 262144) { + var origin = symbol.syntheticOrigin; + if (origin && getExplicitTypeOfSymbol(origin)) { + return getTypeOfSymbol(symbol); + } + } + var declaration = symbol.valueDeclaration; + if (declaration) { + if (isDeclarationWithExplicitTypeAnnotation(declaration)) { + return getTypeOfSymbol(symbol); + } + if (ts6.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247) { + var statement = declaration.parent.parent; + var expressionType = getTypeOfDottedName( + statement.expression, + /*diagnostic*/ + void 0 + ); + if (expressionType) { + var use = statement.awaitModifier ? 15 : 13; + return checkIteratedTypeOrElementType( + use, + expressionType, + undefinedType, + /*errorNode*/ + void 0 + ); + } + } + if (diagnostic) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(declaration, ts6.Diagnostics._0_needs_an_explicit_type_annotation, symbolToString(symbol))); + } + } + } + } + function getTypeOfDottedName(node, diagnostic) { + if (!(node.flags & 33554432)) { + switch (node.kind) { + case 79: + var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); + return getExplicitTypeOfSymbol(symbol, diagnostic); + case 108: + return getExplicitThisType(node); + case 106: + return checkSuperExpression(node); + case 208: { + var type = getTypeOfDottedName(node.expression, diagnostic); + if (type) { + var name = node.name; + var prop = void 0; + if (ts6.isPrivateIdentifier(name)) { + if (!type.symbol) { + return void 0; + } + prop = getPropertyOfType(type, ts6.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText)); + } else { + prop = getPropertyOfType(type, name.escapedText); + } + return prop && getExplicitTypeOfSymbol(prop, diagnostic); + } + return void 0; + } + case 214: + return getTypeOfDottedName(node.expression, diagnostic); + } + } + } + function getEffectsSignature(node) { + var links = getNodeLinks(node); + var signature = links.effectsSignature; + if (signature === void 0) { + var funcType = void 0; + if (node.parent.kind === 241) { + funcType = getTypeOfDottedName( + node.expression, + /*diagnostic*/ + void 0 + ); + } else if (node.expression.kind !== 106) { + if (ts6.isOptionalChain(node)) { + funcType = checkNonNullType(getOptionalExpressionType(checkExpression(node.expression), node.expression), node.expression); + } else { + funcType = checkNonNullExpression(node.expression); + } + } + var signatures = getSignaturesOfType( + funcType && getApparentType(funcType) || unknownType, + 0 + /* SignatureKind.Call */ + ); + var candidate = signatures.length === 1 && !signatures[0].typeParameters ? signatures[0] : ts6.some(signatures, hasTypePredicateOrNeverReturnType) ? getResolvedSignature(node) : void 0; + signature = links.effectsSignature = candidate && hasTypePredicateOrNeverReturnType(candidate) ? candidate : unknownSignature; + } + return signature === unknownSignature ? void 0 : signature; + } + function hasTypePredicateOrNeverReturnType(signature) { + return !!(getTypePredicateOfSignature(signature) || signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & 131072); + } + function getTypePredicateArgument(predicate, callExpression) { + if (predicate.kind === 1 || predicate.kind === 3) { + return callExpression.arguments[predicate.parameterIndex]; + } + var invokedExpression = ts6.skipParentheses(callExpression.expression); + return ts6.isAccessExpression(invokedExpression) ? ts6.skipParentheses(invokedExpression.expression) : void 0; + } + function reportFlowControlError(node) { + var block = ts6.findAncestor(node, ts6.isFunctionOrModuleBlock); + var sourceFile = ts6.getSourceFileOfNode(node); + var span = ts6.getSpanOfTokenAtPosition(sourceFile, block.statements.pos); + diagnostics.add(ts6.createFileDiagnostic(sourceFile, span.start, span.length, ts6.Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)); + } + function isReachableFlowNode(flow) { + var result = isReachableFlowNodeWorker( + flow, + /*noCacheCheck*/ + false + ); + lastFlowNode = flow; + lastFlowNodeReachable = result; + return result; + } + function isFalseExpression(expr) { + var node = ts6.skipParentheses( + expr, + /*excludeJSDocTypeAssertions*/ + true + ); + return node.kind === 95 || node.kind === 223 && (node.operatorToken.kind === 55 && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 && isFalseExpression(node.left) && isFalseExpression(node.right)); + } + function isReachableFlowNodeWorker(flow, noCacheCheck) { + while (true) { + if (flow === lastFlowNode) { + return lastFlowNodeReachable; + } + var flags = flow.flags; + if (flags & 4096) { + if (!noCacheCheck) { + var id = getFlowNodeId(flow); + var reachable = flowNodeReachable[id]; + return reachable !== void 0 ? reachable : flowNodeReachable[id] = isReachableFlowNodeWorker( + flow, + /*noCacheCheck*/ + true + ); + } + noCacheCheck = false; + } + if (flags & (16 | 96 | 256)) { + flow = flow.antecedent; + } else if (flags & 512) { + var signature = getEffectsSignature(flow.node); + if (signature) { + var predicate = getTypePredicateOfSignature(signature); + if (predicate && predicate.kind === 3 && !predicate.type) { + var predicateArgument = flow.node.arguments[predicate.parameterIndex]; + if (predicateArgument && isFalseExpression(predicateArgument)) { + return false; + } + } + if (getReturnTypeOfSignature(signature).flags & 131072) { + return false; + } + } + flow = flow.antecedent; + } else if (flags & 4) { + return ts6.some(flow.antecedents, function(f) { + return isReachableFlowNodeWorker( + f, + /*noCacheCheck*/ + false + ); + }); + } else if (flags & 8) { + var antecedents = flow.antecedents; + if (antecedents === void 0 || antecedents.length === 0) { + return false; + } + flow = antecedents[0]; + } else if (flags & 128) { + if (flow.clauseStart === flow.clauseEnd && isExhaustiveSwitchStatement(flow.switchStatement)) { + return false; + } + flow = flow.antecedent; + } else if (flags & 1024) { + lastFlowNode = void 0; + var target = flow.target; + var saveAntecedents = target.antecedents; + target.antecedents = flow.antecedents; + var result = isReachableFlowNodeWorker( + flow.antecedent, + /*noCacheCheck*/ + false + ); + target.antecedents = saveAntecedents; + return result; + } else { + return !(flags & 1); + } + } + } + function isPostSuperFlowNode(flow, noCacheCheck) { + while (true) { + var flags = flow.flags; + if (flags & 4096) { + if (!noCacheCheck) { + var id = getFlowNodeId(flow); + var postSuper = flowNodePostSuper[id]; + return postSuper !== void 0 ? postSuper : flowNodePostSuper[id] = isPostSuperFlowNode( + flow, + /*noCacheCheck*/ + true + ); + } + noCacheCheck = false; + } + if (flags & (16 | 96 | 256 | 128)) { + flow = flow.antecedent; + } else if (flags & 512) { + if (flow.node.expression.kind === 106) { + return true; + } + flow = flow.antecedent; + } else if (flags & 4) { + return ts6.every(flow.antecedents, function(f) { + return isPostSuperFlowNode( + f, + /*noCacheCheck*/ + false + ); + }); + } else if (flags & 8) { + flow = flow.antecedents[0]; + } else if (flags & 1024) { + var target = flow.target; + var saveAntecedents = target.antecedents; + target.antecedents = flow.antecedents; + var result = isPostSuperFlowNode( + flow.antecedent, + /*noCacheCheck*/ + false + ); + target.antecedents = saveAntecedents; + return result; + } else { + return !!(flags & 1); + } + } + } + function isConstantReference(node) { + switch (node.kind) { + case 79: { + var symbol = getResolvedSymbol(node); + return isConstVariable(symbol) || ts6.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); + } + case 208: + case 209: + return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); + } + return false; + } + function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, flowNode) { + if (initialType === void 0) { + initialType = declaredType; + } + if (flowNode === void 0) { + flowNode = reference.flowNode; + } + var key; + var isKeySet = false; + var flowDepth = 0; + if (flowAnalysisDisabled) { + return errorType; + } + if (!flowNode) { + return declaredType; + } + flowInvocationCount++; + var sharedFlowStart = sharedFlowCount; + var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); + sharedFlowCount = sharedFlowStart; + var resultType = ts6.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 && !(resultType.flags & 131072) && getTypeWithFacts( + resultType, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ).flags & 131072) { + return declaredType; + } + return resultType === nonNullUnknownType ? unknownType : resultType; + function getOrSetCacheKey() { + if (isKeySet) { + return key; + } + isKeySet = true; + return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer); + } + function getTypeAtFlowNode(flow) { + if (flowDepth === 2e3) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("checkTypes", "getTypeAtFlowNode_DepthLimit", { flowId: flow.id }); + flowAnalysisDisabled = true; + reportFlowControlError(reference); + return errorType; + } + flowDepth++; + var sharedFlow; + while (true) { + var flags = flow.flags; + if (flags & 4096) { + for (var i = sharedFlowStart; i < sharedFlowCount; i++) { + if (sharedFlowNodes[i] === flow) { + flowDepth--; + return sharedFlowTypes[i]; + } + } + sharedFlow = flow; + } + var type = void 0; + if (flags & 16) { + type = getTypeAtFlowAssignment(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } else if (flags & 512) { + type = getTypeAtFlowCall(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } else if (flags & 96) { + type = getTypeAtFlowCondition(flow); + } else if (flags & 128) { + type = getTypeAtSwitchClause(flow); + } else if (flags & 12) { + if (flow.antecedents.length === 1) { + flow = flow.antecedents[0]; + continue; + } + type = flags & 4 ? getTypeAtFlowBranchLabel(flow) : getTypeAtFlowLoopLabel(flow); + } else if (flags & 256) { + type = getTypeAtFlowArrayMutation(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } else if (flags & 1024) { + var target = flow.target; + var saveAntecedents = target.antecedents; + target.antecedents = flow.antecedents; + type = getTypeAtFlowNode(flow.antecedent); + target.antecedents = saveAntecedents; + } else if (flags & 2) { + var container = flow.node; + if (container && container !== flowContainer && reference.kind !== 208 && reference.kind !== 209 && reference.kind !== 108) { + flow = container.flowNode; + continue; + } + type = initialType; + } else { + type = convertAutoToAny(declaredType); + } + if (sharedFlow) { + sharedFlowNodes[sharedFlowCount] = sharedFlow; + sharedFlowTypes[sharedFlowCount] = type; + sharedFlowCount++; + } + flowDepth--; + return type; + } + } + function getInitialOrAssignedType(flow) { + var node = flow.node; + return getNarrowableTypeForReference(node.kind === 257 || node.kind === 205 ? getInitialType(node) : getAssignedType(node), reference); + } + function getTypeAtFlowAssignment(flow) { + var node = flow.node; + if (isMatchingReference(reference, node)) { + if (!isReachableFlowNode(flow)) { + return unreachableNeverType; + } + if (ts6.getAssignmentTargetKind(node) === 2) { + var flowType = getTypeAtFlowNode(flow.antecedent); + return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType)); + } + if (declaredType === autoType || declaredType === autoArrayType) { + if (isEmptyArrayAssignment(node)) { + return getEvolvingArrayType(neverType); + } + var assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow)); + return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType; + } + if (declaredType.flags & 1048576) { + return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow)); + } + return declaredType; + } + if (containsMatchingReference(reference, node)) { + if (!isReachableFlowNode(flow)) { + return unreachableNeverType; + } + if (ts6.isVariableDeclaration(node) && (ts6.isInJSFile(node) || ts6.isVarConst(node))) { + var init = ts6.getDeclaredExpandoInitializer(node); + if (init && (init.kind === 215 || init.kind === 216)) { + return getTypeAtFlowNode(flow.antecedent); + } + } + return declaredType; + } + if (ts6.isVariableDeclaration(node) && node.parent.parent.kind === 246 && isMatchingReference(reference, node.parent.parent.expression)) { + return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); + } + return void 0; + } + function narrowTypeByAssertion(type, expr) { + var node = ts6.skipParentheses( + expr, + /*excludeJSDocTypeAssertions*/ + true + ); + if (node.kind === 95) { + return unreachableNeverType; + } + if (node.kind === 223) { + if (node.operatorToken.kind === 55) { + return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); + } + if (node.operatorToken.kind === 56) { + return getUnionType([narrowTypeByAssertion(type, node.left), narrowTypeByAssertion(type, node.right)]); + } + } + return narrowType( + type, + node, + /*assumeTrue*/ + true + ); + } + function getTypeAtFlowCall(flow) { + var signature = getEffectsSignature(flow.node); + if (signature) { + var predicate = getTypePredicateOfSignature(signature); + if (predicate && (predicate.kind === 2 || predicate.kind === 3)) { + var flowType = getTypeAtFlowNode(flow.antecedent); + var type = finalizeEvolvingArrayType(getTypeFromFlowType(flowType)); + var narrowedType = predicate.type ? narrowTypeByTypePredicate( + type, + predicate, + flow.node, + /*assumeTrue*/ + true + ) : predicate.kind === 3 && predicate.parameterIndex >= 0 && predicate.parameterIndex < flow.node.arguments.length ? narrowTypeByAssertion(type, flow.node.arguments[predicate.parameterIndex]) : type; + return narrowedType === type ? flowType : createFlowType(narrowedType, isIncomplete(flowType)); + } + if (getReturnTypeOfSignature(signature).flags & 131072) { + return unreachableNeverType; + } + } + return void 0; + } + function getTypeAtFlowArrayMutation(flow) { + if (declaredType === autoType || declaredType === autoArrayType) { + var node = flow.node; + var expr = node.kind === 210 ? node.expression.expression : node.left.expression; + if (isMatchingReference(reference, getReferenceCandidate(expr))) { + var flowType = getTypeAtFlowNode(flow.antecedent); + var type = getTypeFromFlowType(flowType); + if (ts6.getObjectFlags(type) & 256) { + var evolvedType_1 = type; + if (node.kind === 210) { + for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { + var arg = _a[_i]; + evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); + } + } else { + var indexType = getContextFreeTypeOfExpression(node.left.argumentExpression); + if (isTypeAssignableToKind( + indexType, + 296 + /* TypeFlags.NumberLike */ + )) { + evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); + } + } + return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType)); + } + return flowType; + } + } + return void 0; + } + function getTypeAtFlowCondition(flow) { + var flowType = getTypeAtFlowNode(flow.antecedent); + var type = getTypeFromFlowType(flowType); + if (type.flags & 131072) { + return flowType; + } + var assumeTrue = (flow.flags & 32) !== 0; + var nonEvolvingType = finalizeEvolvingArrayType(type); + var narrowedType = narrowType(nonEvolvingType, flow.node, assumeTrue); + if (narrowedType === nonEvolvingType) { + return flowType; + } + return createFlowType(narrowedType, isIncomplete(flowType)); + } + function getTypeAtSwitchClause(flow) { + var expr = flow.switchStatement.expression; + var flowType = getTypeAtFlowNode(flow.antecedent); + var type = getTypeFromFlowType(flowType); + if (isMatchingReference(reference, expr)) { + type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + } else if (expr.kind === 218 && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + } else { + if (strictNullChecks) { + if (optionalChainContainsReference(expr, reference)) { + type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function(t) { + return !(t.flags & (32768 | 131072)); + }); + } else if (expr.kind === 218 && optionalChainContainsReference(expr.expression, reference)) { + type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function(t) { + return !(t.flags & 131072 || t.flags & 128 && t.value === "undefined"); + }); + } + } + var access = getDiscriminantPropertyAccess(expr, type); + if (access) { + type = narrowTypeBySwitchOnDiscriminantProperty(type, access, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + } + } + return createFlowType(type, isIncomplete(flowType)); + } + function getTypeAtFlowBranchLabel(flow) { + var antecedentTypes = []; + var subtypeReduction = false; + var seenIncomplete = false; + var bypassFlow; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + if (!bypassFlow && antecedent.flags & 128 && antecedent.clauseStart === antecedent.clauseEnd) { + bypassFlow = antecedent; + continue; + } + var flowType = getTypeAtFlowNode(antecedent); + var type = getTypeFromFlowType(flowType); + if (type === declaredType && declaredType === initialType) { + return type; + } + ts6.pushIfUnique(antecedentTypes, type); + if (!isTypeSubsetOf(type, declaredType)) { + subtypeReduction = true; + } + if (isIncomplete(flowType)) { + seenIncomplete = true; + } + } + if (bypassFlow) { + var flowType = getTypeAtFlowNode(bypassFlow); + var type = getTypeFromFlowType(flowType); + if (!ts6.contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.switchStatement)) { + if (type === declaredType && declaredType === initialType) { + return type; + } + antecedentTypes.push(type); + if (!isTypeSubsetOf(type, declaredType)) { + subtypeReduction = true; + } + if (isIncomplete(flowType)) { + seenIncomplete = true; + } + } + } + return createFlowType(getUnionOrEvolvingArrayType( + antecedentTypes, + subtypeReduction ? 2 : 1 + /* UnionReduction.Literal */ + ), seenIncomplete); + } + function getTypeAtFlowLoopLabel(flow) { + var id = getFlowNodeId(flow); + var cache = flowLoopCaches[id] || (flowLoopCaches[id] = new ts6.Map()); + var key2 = getOrSetCacheKey(); + if (!key2) { + return declaredType; + } + var cached = cache.get(key2); + if (cached) { + return cached; + } + for (var i = flowLoopStart; i < flowLoopCount; i++) { + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key2 && flowLoopTypes[i].length) { + return createFlowType( + getUnionOrEvolvingArrayType( + flowLoopTypes[i], + 1 + /* UnionReduction.Literal */ + ), + /*incomplete*/ + true + ); + } + } + var antecedentTypes = []; + var subtypeReduction = false; + var firstAntecedentType; + for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { + var antecedent = _a[_i]; + var flowType = void 0; + if (!firstAntecedentType) { + flowType = firstAntecedentType = getTypeAtFlowNode(antecedent); + } else { + flowLoopNodes[flowLoopCount] = flow; + flowLoopKeys[flowLoopCount] = key2; + flowLoopTypes[flowLoopCount] = antecedentTypes; + flowLoopCount++; + var saveFlowTypeCache = flowTypeCache; + flowTypeCache = void 0; + flowType = getTypeAtFlowNode(antecedent); + flowTypeCache = saveFlowTypeCache; + flowLoopCount--; + var cached_1 = cache.get(key2); + if (cached_1) { + return cached_1; + } + } + var type = getTypeFromFlowType(flowType); + ts6.pushIfUnique(antecedentTypes, type); + if (!isTypeSubsetOf(type, declaredType)) { + subtypeReduction = true; + } + if (type === declaredType) { + break; + } + } + var result = getUnionOrEvolvingArrayType( + antecedentTypes, + subtypeReduction ? 2 : 1 + /* UnionReduction.Literal */ + ); + if (isIncomplete(firstAntecedentType)) { + return createFlowType( + result, + /*incomplete*/ + true + ); + } + cache.set(key2, result); + return result; + } + function getUnionOrEvolvingArrayType(types, subtypeReduction) { + if (isEvolvingArrayTypeList(types)) { + return getEvolvingArrayType(getUnionType(ts6.map(types, getElementTypeOfEvolvingArrayType))); + } + var result = recombineUnknownType(getUnionType(ts6.sameMap(types, finalizeEvolvingArrayType), subtypeReduction)); + if (result !== declaredType && result.flags & declaredType.flags & 1048576 && ts6.arraysEqual(result.types, declaredType.types)) { + return declaredType; + } + return result; + } + function getCandidateDiscriminantPropertyAccess(expr) { + if (ts6.isBindingPattern(reference) || ts6.isFunctionExpressionOrArrowFunction(reference) || ts6.isObjectLiteralMethod(reference)) { + if (ts6.isIdentifier(expr)) { + var symbol = getResolvedSymbol(expr); + var declaration = symbol.valueDeclaration; + if (declaration && (ts6.isBindingElement(declaration) || ts6.isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) { + return declaration; + } + } + } else if (ts6.isAccessExpression(expr)) { + if (isMatchingReference(reference, expr.expression)) { + return expr; + } + } else if (ts6.isIdentifier(expr)) { + var symbol = getResolvedSymbol(expr); + if (isConstVariable(symbol)) { + var declaration = symbol.valueDeclaration; + if (ts6.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts6.isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) { + return declaration.initializer; + } + if (ts6.isBindingElement(declaration) && !declaration.initializer) { + var parent = declaration.parent.parent; + if (ts6.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts6.isIdentifier(parent.initializer) || ts6.isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) { + return declaration; + } + } + } + } + return void 0; + } + function getDiscriminantPropertyAccess(expr, computedType) { + var type = declaredType.flags & 1048576 ? declaredType : computedType; + if (type.flags & 1048576) { + var access = getCandidateDiscriminantPropertyAccess(expr); + if (access) { + var name = getAccessedPropertyName(access); + if (name && isDiscriminantProperty(type, name)) { + return access; + } + } + } + return void 0; + } + function narrowTypeByDiscriminant(type, access, narrowType2) { + var propName = getAccessedPropertyName(access); + if (propName === void 0) { + return type; + } + var removeNullable = strictNullChecks && ts6.isOptionalChain(access) && maybeTypeOfKind( + type, + 98304 + /* TypeFlags.Nullable */ + ); + var propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ) : type, propName); + if (!propType) { + return type; + } + propType = removeNullable ? getOptionalType(propType) : propType; + var narrowedPropType = narrowType2(propType); + return filterType(type, function(t) { + var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); + return !(discriminantType.flags & 131072) && !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType); + }); + } + function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { + if ((operator === 36 || operator === 37) && type.flags & 1048576) { + var keyPropertyName = getKeyPropertyName(type); + if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access)) { + var candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value)); + if (candidate) { + return operator === (assumeTrue ? 36 : 37) ? candidate : isUnitType(getTypeOfPropertyOfType(candidate, keyPropertyName) || unknownType) ? removeType(type, candidate) : type; + } + } + } + return narrowTypeByDiscriminant(type, access, function(t) { + return narrowTypeByEquality(t, operator, value, assumeTrue); + }); + } + function narrowTypeBySwitchOnDiscriminantProperty(type, access, switchStatement, clauseStart, clauseEnd) { + if (clauseStart < clauseEnd && type.flags & 1048576 && getKeyPropertyName(type) === getAccessedPropertyName(access)) { + var clauseTypes = getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd); + var candidate = getUnionType(ts6.map(clauseTypes, function(t) { + return getConstituentTypeForKeyType(type, t) || unknownType; + })); + if (candidate !== unknownType) { + return candidate; + } + } + return narrowTypeByDiscriminant(type, access, function(t) { + return narrowTypeBySwitchOnDiscriminant(t, switchStatement, clauseStart, clauseEnd); + }); + } + function narrowTypeByTruthiness(type, expr, assumeTrue) { + if (isMatchingReference(reference, expr)) { + return getAdjustedTypeWithFacts( + type, + assumeTrue ? 4194304 : 8388608 + /* TypeFacts.Falsy */ + ); + } + if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) { + type = getAdjustedTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ); + } + var access = getDiscriminantPropertyAccess(expr, type); + if (access) { + return narrowTypeByDiscriminant(type, access, function(t) { + return getTypeWithFacts( + t, + assumeTrue ? 4194304 : 8388608 + /* TypeFacts.Falsy */ + ); + }); + } + return type; + } + function isTypePresencePossible(type, propName, assumeTrue) { + var prop = getPropertyOfType(type, propName); + return prop ? !!(prop.flags & 16777216) || assumeTrue : !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty2 = someType(type, function(t) { + return isTypePresencePossible( + t, + name, + /*assumeTrue*/ + true + ); + }); + if (isKnownProperty2) { + return filterType(type, function(t) { + return isTypePresencePossible(t, name, assumeTrue); + }); + } + if (assumeTrue) { + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } + return type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 63: + case 75: + case 76: + case 77: + return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue); + case 34: + case 35: + case 36: + case 37: + var operator = expr.operatorToken.kind; + var left = getReferenceCandidate(expr.left); + var right = getReferenceCandidate(expr.right); + if (left.kind === 218 && ts6.isStringLiteralLike(right)) { + return narrowTypeByTypeof(type, left, operator, right, assumeTrue); + } + if (right.kind === 218 && ts6.isStringLiteralLike(left)) { + return narrowTypeByTypeof(type, right, operator, left, assumeTrue); + } + if (isMatchingReference(reference, left)) { + return narrowTypeByEquality(type, operator, right, assumeTrue); + } + if (isMatchingReference(reference, right)) { + return narrowTypeByEquality(type, operator, left, assumeTrue); + } + if (strictNullChecks) { + if (optionalChainContainsReference(left, reference)) { + type = narrowTypeByOptionalChainContainment(type, operator, right, assumeTrue); + } else if (optionalChainContainsReference(right, reference)) { + type = narrowTypeByOptionalChainContainment(type, operator, left, assumeTrue); + } + } + var leftAccess = getDiscriminantPropertyAccess(left, type); + if (leftAccess) { + return narrowTypeByDiscriminantProperty(type, leftAccess, operator, right, assumeTrue); + } + var rightAccess = getDiscriminantPropertyAccess(right, type); + if (rightAccess) { + return narrowTypeByDiscriminantProperty(type, rightAccess, operator, left, assumeTrue); + } + if (isMatchingConstructorReference(left)) { + return narrowTypeByConstructor(type, operator, right, assumeTrue); + } + if (isMatchingConstructorReference(right)) { + return narrowTypeByConstructor(type, operator, left, assumeTrue); + } + break; + case 102: + return narrowTypeByInstanceof(type, expr, assumeTrue); + case 101: + if (ts6.isPrivateIdentifier(expr.left)) { + return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); + } + var target = getReferenceCandidate(expr.right); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576) { + if (containsMissingType(type) && ts6.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { + return getTypeWithFacts( + type, + assumeTrue ? 524288 : 65536 + /* TypeFacts.EQUndefined */ + ); + } + if (isMatchingReference(reference, target)) { + return narrowTypeByInKeyword(type, leftType, assumeTrue); + } + } + break; + case 27: + return narrowType(type, expr.right, assumeTrue); + case 55: + return assumeTrue ? narrowType( + narrowType( + type, + expr.left, + /*assumeTrue*/ + true + ), + expr.right, + /*assumeTrue*/ + true + ) : getUnionType([narrowType( + type, + expr.left, + /*assumeTrue*/ + false + ), narrowType( + type, + expr.right, + /*assumeTrue*/ + false + )]); + case 56: + return assumeTrue ? getUnionType([narrowType( + type, + expr.left, + /*assumeTrue*/ + true + ), narrowType( + type, + expr.right, + /*assumeTrue*/ + true + )]) : narrowType( + narrowType( + type, + expr.left, + /*assumeTrue*/ + false + ), + expr.right, + /*assumeTrue*/ + false + ); + } + return type; + } + function narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue) { + var target = getReferenceCandidate(expr.right); + if (!isMatchingReference(reference, target)) { + return type; + } + ts6.Debug.assertNode(expr.left, ts6.isPrivateIdentifier); + var symbol = getSymbolForPrivateIdentifierExpression(expr.left); + if (symbol === void 0) { + return type; + } + var classSymbol = symbol.parent; + var targetType = ts6.hasStaticModifier(ts6.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); + return getNarrowedType( + type, + targetType, + assumeTrue, + /*checkDerived*/ + true + ); + } + function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) { + var equalsOperator = operator === 34 || operator === 36; + var nullableFlags = operator === 34 || operator === 35 ? 98304 : 32768; + var valueType = getTypeOfExpression(value); + var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function(t) { + return !!(t.flags & nullableFlags); + }) || equalsOperator === assumeTrue && everyType(valueType, function(t) { + return !(t.flags & (3 | nullableFlags)); + }); + return removeNullable ? getAdjustedTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ) : type; + } + function narrowTypeByEquality(type, operator, value, assumeTrue) { + if (type.flags & 1) { + return type; + } + if (operator === 35 || operator === 37) { + assumeTrue = !assumeTrue; + } + var valueType = getTypeOfExpression(value); + var doubleEquals = operator === 34 || operator === 35; + if (valueType.flags & 98304) { + if (!strictNullChecks) { + return type; + } + var facts = doubleEquals ? assumeTrue ? 262144 : 2097152 : valueType.flags & 65536 ? assumeTrue ? 131072 : 1048576 : assumeTrue ? 65536 : 524288; + return getAdjustedTypeWithFacts(type, facts); + } + if (assumeTrue) { + if (!doubleEquals && (type.flags & 2 || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 | 67108864) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function(t) { + return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); + }); + return replacePrimitivesWithLiterals(filteredType, valueType); + } + if (isUnitType(valueType)) { + return filterType(type, function(t) { + return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); + }); + } + return type; + } + function narrowTypeByTypeof(type, typeOfExpr, operator, literal2, assumeTrue) { + if (operator === 35 || operator === 37) { + assumeTrue = !assumeTrue; + } + var target = getReferenceCandidate(typeOfExpr.expression); + if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function(t) { + return narrowTypeByLiteralExpression(t, literal2, assumeTrue); + }); + } + if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal2.text !== "undefined")) { + return getAdjustedTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ); + } + return type; + } + return narrowTypeByLiteralExpression(type, literal2, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal2, assumeTrue) { + return assumeTrue ? narrowTypeByTypeName(type, literal2.text) : getTypeWithFacts( + type, + typeofNEFacts.get(literal2.text) || 32768 + /* TypeFacts.TypeofNEHostObject */ + ); + } + function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) { + var everyClauseChecks = clauseStart !== clauseEnd && ts6.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck); + return everyClauseChecks ? getTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ) : type; + } + function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { + var switchTypes = getSwitchClauseTypes(switchStatement); + if (!switchTypes.length) { + return type; + } + var clauseTypes = switchTypes.slice(clauseStart, clauseEnd); + var hasDefaultClause = clauseStart === clauseEnd || ts6.contains(clauseTypes, neverType); + if (type.flags & 2 && !hasDefaultClause) { + var groundClauseTypes = void 0; + for (var i = 0; i < clauseTypes.length; i += 1) { + var t = clauseTypes[i]; + if (t.flags & (131068 | 67108864)) { + if (groundClauseTypes !== void 0) { + groundClauseTypes.push(t); + } + } else if (t.flags & 524288) { + if (groundClauseTypes === void 0) { + groundClauseTypes = clauseTypes.slice(0, i); + } + groundClauseTypes.push(nonPrimitiveType); + } else { + return type; + } + } + return getUnionType(groundClauseTypes === void 0 ? clauseTypes : groundClauseTypes); + } + var discriminantType = getUnionType(clauseTypes); + var caseType = discriminantType.flags & 131072 ? neverType : replacePrimitivesWithLiterals(filterType(type, function(t2) { + return areTypesComparable(discriminantType, t2); + }), discriminantType); + if (!hasDefaultClause) { + return caseType; + } + var defaultType = filterType(type, function(t2) { + return !(isUnitLikeType(t2) && ts6.contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t2)))); + }); + return caseType.flags & 131072 ? defaultType : getUnionType([caseType, defaultType]); + } + function narrowTypeByTypeName(type, typeName) { + switch (typeName) { + case "string": + return narrowTypeByTypeFacts( + type, + stringType, + 1 + /* TypeFacts.TypeofEQString */ + ); + case "number": + return narrowTypeByTypeFacts( + type, + numberType, + 2 + /* TypeFacts.TypeofEQNumber */ + ); + case "bigint": + return narrowTypeByTypeFacts( + type, + bigintType, + 4 + /* TypeFacts.TypeofEQBigInt */ + ); + case "boolean": + return narrowTypeByTypeFacts( + type, + booleanType, + 8 + /* TypeFacts.TypeofEQBoolean */ + ); + case "symbol": + return narrowTypeByTypeFacts( + type, + esSymbolType, + 16 + /* TypeFacts.TypeofEQSymbol */ + ); + case "object": + return type.flags & 1 ? type : getUnionType([narrowTypeByTypeFacts( + type, + nonPrimitiveType, + 32 + /* TypeFacts.TypeofEQObject */ + ), narrowTypeByTypeFacts( + type, + nullType, + 131072 + /* TypeFacts.EQNull */ + )]); + case "function": + return type.flags & 1 ? type : narrowTypeByTypeFacts( + type, + globalFunctionType, + 64 + /* TypeFacts.TypeofEQFunction */ + ); + case "undefined": + return narrowTypeByTypeFacts( + type, + undefinedType, + 65536 + /* TypeFacts.EQUndefined */ + ); + } + return narrowTypeByTypeFacts( + type, + nonPrimitiveType, + 128 + /* TypeFacts.TypeofEQHostObject */ + ); + } + function narrowTypeByTypeFacts(type, impliedType, facts) { + return mapType(type, function(t) { + return isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : ( + // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied + // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`. + isTypeSubtypeOf(impliedType, t) ? impliedType : ( + // Neither the constituent nor the implied type is a subtype of the other, however their domains may still + // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate + // possible overlap, we form an intersection. Otherwise, we eliminate the constituent. + getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType + ) + ); + }); + } + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); + if (!witnesses) { + return type; + } + var defaultIndex = ts6.findIndex(switchStatement.caseBlock.clauses, function(clause) { + return clause.kind === 293; + }); + var hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd; + if (hasDefaultClause) { + var notEqualFacts_1 = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses); + return filterType(type, function(t) { + return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; + }); + } + var clauseWitnesses = witnesses.slice(clauseStart, clauseEnd); + return getUnionType(ts6.map(clauseWitnesses, function(text) { + return text ? narrowTypeByTypeName(type, text) : neverType; + })); + } + function isMatchingConstructorReference(expr) { + return (ts6.isPropertyAccessExpression(expr) && ts6.idText(expr.name) === "constructor" || ts6.isElementAccessExpression(expr) && ts6.isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression); + } + function narrowTypeByConstructor(type, operator, identifier, assumeTrue) { + if (assumeTrue ? operator !== 34 && operator !== 36 : operator !== 35 && operator !== 37) { + return type; + } + var identifierType = getTypeOfExpression(identifier); + if (!isFunctionType(identifierType) && !isConstructorType(identifierType)) { + return type; + } + var prototypeProperty = getPropertyOfType(identifierType, "prototype"); + if (!prototypeProperty) { + return type; + } + var prototypeType = getTypeOfSymbol(prototypeProperty); + var candidate = !isTypeAny(prototypeType) ? prototypeType : void 0; + if (!candidate || candidate === globalObjectType || candidate === globalFunctionType) { + return type; + } + if (isTypeAny(type)) { + return candidate; + } + return filterType(type, function(t) { + return isConstructedBy(t, candidate); + }); + function isConstructedBy(source, target) { + if (source.flags & 524288 && ts6.getObjectFlags(source) & 1 || target.flags & 524288 && ts6.getObjectFlags(target) & 1) { + return source.symbol === target.symbol; + } + return isTypeSubtypeOf(source, target); + } + } + function narrowTypeByInstanceof(type, expr, assumeTrue) { + var left = getReferenceCandidate(expr.left); + if (!isMatchingReference(reference, left)) { + if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) { + return getAdjustedTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ); + } + return type; + } + var rightType = getTypeOfExpression(expr.right); + if (!isTypeDerivedFrom(rightType, globalFunctionType)) { + return type; + } + var targetType; + var prototypeProperty = getPropertyOfType(rightType, "prototype"); + if (prototypeProperty) { + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (!isTypeAny(prototypePropertyType)) { + targetType = prototypePropertyType; + } + } + if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) { + return type; + } + if (!targetType) { + var constructSignatures = getSignaturesOfType( + rightType, + 1 + /* SignatureKind.Construct */ + ); + targetType = constructSignatures.length ? getUnionType(ts6.map(constructSignatures, function(signature) { + return getReturnTypeOfSignature(getErasedSignature(signature)); + })) : emptyObjectType; + } + if (!assumeTrue && rightType.flags & 1048576) { + var nonConstructorTypeInUnion = ts6.find(rightType.types, function(t) { + return !isConstructorType(t); + }); + if (!nonConstructorTypeInUnion) + return type; + } + return getNarrowedType( + type, + targetType, + assumeTrue, + /*checkDerived*/ + true + ); + } + function getNarrowedType(type, candidate, assumeTrue, checkDerived) { + var _a; + var key2 = type.flags & 1048576 ? "N".concat(getTypeId(type), ",").concat(getTypeId(candidate), ",").concat((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : void 0; + return (_a = getCachedType(key2)) !== null && _a !== void 0 ? _a : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived)); + } + function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) { + var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf; + if (!assumeTrue) { + return filterType(type, function(t) { + return !isRelated(t, candidate); + }); + } + if (type.flags & 3) { + return candidate; + } + var keyPropertyName = type.flags & 1048576 ? getKeyPropertyName(type) : void 0; + var narrowedType = mapType(candidate, function(c) { + var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); + var matching = discriminant && getConstituentTypeForKeyType(type, discriminant); + var directlyRelated = mapType(matching || type, checkDerived ? function(t) { + return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; + } : function(t) { + return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; + }); + return directlyRelated.flags & 131072 ? mapType(type, function(t) { + return maybeTypeOfKind( + t, + 465829888 + /* TypeFlags.Instantiable */ + ) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; + }) : directlyRelated; + }); + return !(narrowedType.flags & 131072) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); + } + function narrowTypeByCallExpression(type, callExpression, assumeTrue) { + if (hasMatchingArgument(callExpression, reference)) { + var signature = assumeTrue || !ts6.isCallChain(callExpression) ? getEffectsSignature(callExpression) : void 0; + var predicate = signature && getTypePredicateOfSignature(signature); + if (predicate && (predicate.kind === 0 || predicate.kind === 1)) { + return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue); + } + } + if (containsMissingType(type) && ts6.isAccessExpression(reference) && ts6.isPropertyAccessExpression(callExpression.expression)) { + var callAccess = callExpression.expression; + if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) && ts6.isIdentifier(callAccess.name) && callAccess.name.escapedText === "hasOwnProperty" && callExpression.arguments.length === 1) { + var argument = callExpression.arguments[0]; + if (ts6.isStringLiteralLike(argument) && getAccessedPropertyName(reference) === ts6.escapeLeadingUnderscores(argument.text)) { + return getTypeWithFacts( + type, + assumeTrue ? 524288 : 65536 + /* TypeFacts.EQUndefined */ + ); + } + } + } + return type; + } + function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) { + if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) { + var predicateArgument = getTypePredicateArgument(predicate, callExpression); + if (predicateArgument) { + if (isMatchingReference(reference, predicateArgument)) { + return getNarrowedType( + type, + predicate.type, + assumeTrue, + /*checkDerived*/ + false + ); + } + if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536)) { + type = getAdjustedTypeWithFacts( + type, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ); + } + var access = getDiscriminantPropertyAccess(predicateArgument, type); + if (access) { + return narrowTypeByDiscriminant(type, access, function(t) { + return getNarrowedType( + t, + predicate.type, + assumeTrue, + /*checkDerived*/ + false + ); + }); + } + } + } + return type; + } + function narrowType(type, expr, assumeTrue) { + if (ts6.isExpressionOfOptionalChainRoot(expr) || ts6.isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 && expr.parent.left === expr) { + return narrowTypeByOptionality(type, expr, assumeTrue); + } + switch (expr.kind) { + case 79: + if (!isMatchingReference(reference, expr) && inlineLevel < 5) { + var symbol = getResolvedSymbol(expr); + if (isConstVariable(symbol)) { + var declaration = symbol.valueDeclaration; + if (declaration && ts6.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isConstantReference(reference)) { + inlineLevel++; + var result = narrowType(type, declaration.initializer, assumeTrue); + inlineLevel--; + return result; + } + } + } + case 108: + case 106: + case 208: + case 209: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 210: + return narrowTypeByCallExpression(type, expr, assumeTrue); + case 214: + case 232: + return narrowType(type, expr.expression, assumeTrue); + case 223: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 221: + if (expr.operator === 53) { + return narrowType(type, expr.operand, !assumeTrue); + } + break; + } + return type; + } + function narrowTypeByOptionality(type, expr, assumePresent) { + if (isMatchingReference(reference, expr)) { + return getAdjustedTypeWithFacts( + type, + assumePresent ? 2097152 : 262144 + /* TypeFacts.EQUndefinedOrNull */ + ); + } + var access = getDiscriminantPropertyAccess(expr, type); + if (access) { + return narrowTypeByDiscriminant(type, access, function(t) { + return getTypeWithFacts( + t, + assumePresent ? 2097152 : 262144 + /* TypeFacts.EQUndefinedOrNull */ + ); + }); + } + return type; + } + } + function getTypeOfSymbolAtLocation(symbol, location) { + symbol = symbol.exportSymbol || symbol; + if (location.kind === 79 || location.kind === 80) { + if (ts6.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts6.isExpressionNode(location) && (!ts6.isAssignmentTarget(location) || ts6.isWriteAccess(location))) { + var type = getTypeOfExpression(location); + if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { + return type; + } + } + } + if (ts6.isDeclarationName(location) && ts6.isSetAccessor(location.parent) && getAnnotatedAccessorTypeNode(location.parent)) { + return getWriteTypeOfAccessors(location.parent.symbol); + } + return getNonMissingTypeOfSymbol(symbol); + } + function getControlFlowContainer(node) { + return ts6.findAncestor(node.parent, function(node2) { + return ts6.isFunctionLike(node2) && !ts6.getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 || node2.kind === 308 || node2.kind === 169; + }); + } + function isSymbolAssigned(symbol) { + if (!symbol.valueDeclaration) { + return false; + } + var parent = ts6.getRootDeclaration(symbol.valueDeclaration).parent; + var links = getNodeLinks(parent); + if (!(links.flags & 8388608)) { + links.flags |= 8388608; + if (!hasParentWithAssignmentsMarked(parent)) { + markNodeAssignments(parent); + } + } + return symbol.isAssigned || false; + } + function hasParentWithAssignmentsMarked(node) { + return !!ts6.findAncestor(node.parent, function(node2) { + return (ts6.isFunctionLike(node2) || ts6.isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 8388608); + }); + } + function markNodeAssignments(node) { + if (node.kind === 79) { + if (ts6.isAssignmentTarget(node)) { + var symbol = getResolvedSymbol(node); + if (ts6.isParameterOrCatchClauseVariable(symbol)) { + symbol.isAssigned = true; + } + } + } else { + ts6.forEachChild(node, markNodeAssignments); + } + } + function isConstVariable(symbol) { + return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0; + } + function removeOptionalityFromDeclaredType(declaredType, declaration) { + if (pushTypeResolution( + declaration.symbol, + 2 + /* TypeSystemPropertyName.DeclaredType */ + )) { + var annotationIncludesUndefined = strictNullChecks && declaration.kind === 166 && declaration.initializer && getTypeFacts(declaredType) & 16777216 && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216); + popTypeResolution(); + return annotationIncludesUndefined ? getTypeWithFacts( + declaredType, + 524288 + /* TypeFacts.NEUndefined */ + ) : declaredType; + } else { + reportCircularityError(declaration.symbol); + return declaredType; + } + } + function isConstraintPosition(type, node) { + var parent = node.parent; + return parent.kind === 208 || parent.kind === 163 || parent.kind === 210 && parent.expression === node || parent.kind === 209 && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); + } + function isGenericTypeWithUnionConstraint(type) { + return type.flags & 2097152 ? ts6.some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576)); + } + function isGenericTypeWithoutNullableConstraint(type) { + return type.flags & 2097152 ? ts6.some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 && !maybeTypeOfKind( + getBaseConstraintOrType(type), + 98304 + /* TypeFlags.Nullable */ + )); + } + function hasContextualTypeWithNoGenericTypes(node, checkMode) { + var contextualType = (ts6.isIdentifier(node) || ts6.isPropertyAccessExpression(node) || ts6.isElementAccessExpression(node)) && !((ts6.isJsxOpeningElement(node.parent) || ts6.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 ? getContextualType( + node, + 8 + /* ContextFlags.SkipBindingPatterns */ + ) : getContextualType( + node, + /*contextFlags*/ + void 0 + )); + return contextualType && !isGenericType(contextualType); + } + function getNarrowableTypeForReference(type, reference, checkMode) { + var substituteConstraints = !(checkMode && checkMode & 2) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode)); + return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type; + } + function isExportOrExportExpression(location) { + return !!ts6.findAncestor(location, function(n) { + var parent = n.parent; + if (parent === void 0) { + return "quit"; + } + if (ts6.isExportAssignment(parent)) { + return parent.expression === n && ts6.isEntityNameExpression(n); + } + if (ts6.isExportSpecifier(parent)) { + return parent.name === n || parent.propertyName === n; + } + return false; + }); + } + function markAliasReferenced(symbol, location) { + if (isNonLocalAlias( + symbol, + /*excludes*/ + 111551 + /* SymbolFlags.Value */ + ) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration( + symbol, + 111551 + /* SymbolFlags.Value */ + )) { + var target = resolveAlias(symbol); + if (getAllSymbolFlags(target) & (111551 | 1048576)) { + if (compilerOptions.isolatedModules || ts6.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { + markAliasSymbolAsReferenced(symbol); + } else { + markConstEnumAliasAsReferenced(symbol); + } + } + } + } + function getNarrowedTypeOfSymbol(symbol, location) { + var declaration = symbol.valueDeclaration; + if (declaration) { + if (ts6.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { + var parent = declaration.parent.parent; + if (parent.kind === 257 && ts6.getCombinedNodeFlags(declaration) & 2 || parent.kind === 166) { + var links = getNodeLinks(parent); + if (!(links.flags & 268435456)) { + links.flags |= 268435456; + var parentType = getTypeForBindingElementParent( + parent, + 0 + /* CheckMode.Normal */ + ); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); + links.flags &= ~268435456; + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 && !(parent.kind === 166 && isSymbolAssigned(symbol))) { + var pattern = declaration.parent; + var narrowedType = getFlowTypeOfReference( + pattern, + parentTypeConstraint, + parentTypeConstraint, + /*flowContainer*/ + void 0, + location.flowNode + ); + if (narrowedType.flags & 131072) { + return neverType; + } + return getBindingElementTypeFromParentType(declaration, narrowedType); + } + } + } + } + if (ts6.isParameter(declaration) && !declaration.type && !declaration.initializer && !declaration.dotDotDotToken) { + var func = declaration.parent; + if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) { + var restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0])); + if (restType.flags & 1048576 && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) { + var narrowedType = getFlowTypeOfReference( + func, + restType, + restType, + /*flowContainer*/ + void 0, + location.flowNode + ); + var index = func.parameters.indexOf(declaration) - (ts6.getThisParameter(func) ? 1 : 0); + return getIndexedAccessType(narrowedType, getNumberLiteralType(index)); + } + } + } + } + } + return getTypeOfSymbol(symbol); + } + function checkIdentifier(node, checkMode) { + if (ts6.isThisInTypeQuery(node)) { + return checkThisExpression(node); + } + var symbol = getResolvedSymbol(node); + if (symbol === unknownSymbol) { + return errorType; + } + if (symbol === argumentsSymbol) { + if (isInPropertyInitializerOrClassStaticBlock(node)) { + error(node, ts6.Diagnostics.arguments_cannot_be_referenced_in_property_initializers); + return errorType; + } + var container = ts6.getContainingFunction(node); + if (languageVersion < 2) { + if (container.kind === 216) { + error(node, ts6.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); + } else if (ts6.hasSyntacticModifier( + container, + 512 + /* ModifierFlags.Async */ + )) { + error(node, ts6.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); + } + } + getNodeLinks(container).flags |= 8192; + return getTypeOfSymbol(symbol); + } + if (shouldMarkIdentifierAliasReferenced(node)) { + markAliasReferenced(symbol, node); + } + var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node); + if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) { + addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText); + } + var declaration = localOrExportSymbol.valueDeclaration; + if (declaration && localOrExportSymbol.flags & 32) { + if (declaration.kind === 260 && ts6.nodeIsDecorated(declaration)) { + var container = ts6.getContainingClass(node); + while (container !== void 0) { + if (container === declaration && container.name !== node) { + getNodeLinks(declaration).flags |= 16777216; + getNodeLinks(node).flags |= 33554432; + break; + } + container = ts6.getContainingClass(container); + } + } else if (declaration.kind === 228) { + var container = ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + while (container.kind !== 308) { + if (container.parent === declaration) { + if (ts6.isPropertyDeclaration(container) && ts6.isStatic(container) || ts6.isClassStaticBlockDeclaration(container)) { + getNodeLinks(declaration).flags |= 16777216; + getNodeLinks(node).flags |= 33554432; + } + break; + } + container = ts6.getThisContainer( + container, + /*includeArrowFunctions*/ + false + ); + } + } + } + checkNestedBlockScopedBinding(node, symbol); + var type = getNarrowedTypeOfSymbol(localOrExportSymbol, node); + var assignmentKind = ts6.getAssignmentTargetKind(node); + if (assignmentKind) { + if (!(localOrExportSymbol.flags & 3) && !(ts6.isInJSFile(node) && localOrExportSymbol.flags & 512)) { + var assignmentError = localOrExportSymbol.flags & 384 ? ts6.Diagnostics.Cannot_assign_to_0_because_it_is_an_enum : localOrExportSymbol.flags & 32 ? ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_class : localOrExportSymbol.flags & 1536 ? ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_namespace : localOrExportSymbol.flags & 16 ? ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_function : localOrExportSymbol.flags & 2097152 ? ts6.Diagnostics.Cannot_assign_to_0_because_it_is_an_import : ts6.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable; + error(node, assignmentError, symbolToString(symbol)); + return errorType; + } + if (isReadonlySymbol(localOrExportSymbol)) { + if (localOrExportSymbol.flags & 3) { + error(node, ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol)); + } else { + error(node, ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol)); + } + return errorType; + } + } + var isAlias = localOrExportSymbol.flags & 2097152; + if (localOrExportSymbol.flags & 3) { + if (assignmentKind === 1) { + return type; + } + } else if (isAlias) { + declaration = getDeclarationOfAliasSymbol(symbol); + } else { + return type; + } + if (!declaration) { + return type; + } + type = getNarrowableTypeForReference(type, node, checkMode); + var isParameter2 = ts6.getRootDeclaration(declaration).kind === 166; + var declarationContainer = getControlFlowContainer(declaration); + var flowContainer = getControlFlowContainer(node); + var isOuterVariable = flowContainer !== declarationContainer; + var isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && ts6.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); + var isModuleExports = symbol.flags & 134217728; + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 || flowContainer.kind === 216 || ts6.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) { + flowContainer = getControlFlowContainer(flowContainer); + } + var assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 || isInTypeQuery(node) || node.parent.kind === 278) || node.parent.kind === 232 || declaration.kind === 257 && declaration.exclamationToken || declaration.flags & 16777216; + var initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type); + var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer); + if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) { + if (flowType === autoType || flowType === autoArrayType) { + if (noImplicitAny) { + error(ts6.getNameOfDeclaration(declaration), ts6.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); + error(node, ts6.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + } + return convertAutoToAny(flowType); + } + } else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) { + error(node, ts6.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + return type; + } + return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; + } + function isSameScopedBindingElement(node, declaration) { + if (ts6.isBindingElement(declaration)) { + var bindingElement = ts6.findAncestor(node, ts6.isBindingElement); + return bindingElement && ts6.getRootDeclaration(bindingElement) === ts6.getRootDeclaration(declaration); + } + } + function shouldMarkIdentifierAliasReferenced(node) { + var _a; + var parent = node.parent; + if (parent) { + if (ts6.isPropertyAccessExpression(parent) && parent.expression === node) { + return false; + } + if (ts6.isExportSpecifier(parent) && parent.isTypeOnly) { + return false; + } + var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent; + if (greatGrandparent && ts6.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) { + return false; + } + } + return true; + } + function isInsideFunctionOrInstancePropertyInitializer(node, threshold) { + return !!ts6.findAncestor(node, function(n) { + return n === threshold ? "quit" : ts6.isFunctionLike(n) || n.parent && ts6.isPropertyDeclaration(n.parent) && !ts6.hasStaticModifier(n.parent) && n.parent.initializer === n; + }); + } + function getPartOfForStatementContainingNode(node, container) { + return ts6.findAncestor(node, function(n) { + return n === container ? "quit" : n === container.initializer || n === container.condition || n === container.incrementor || n === container.statement; + }); + } + function getEnclosingIterationStatement(node) { + return ts6.findAncestor(node, function(n) { + return !n || ts6.nodeStartsNewLexicalEnvironment(n) ? "quit" : ts6.isIterationStatement( + n, + /*lookInLabeledStatements*/ + false + ); + }); + } + function checkNestedBlockScopedBinding(node, symbol) { + if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || !symbol.valueDeclaration || ts6.isSourceFile(symbol.valueDeclaration) || symbol.valueDeclaration.parent.kind === 295) { + return; + } + var container = ts6.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + var isCaptured = isInsideFunctionOrInstancePropertyInitializer(node, container); + var enclosingIterationStatement = getEnclosingIterationStatement(container); + if (enclosingIterationStatement) { + if (isCaptured) { + var capturesBlockScopeBindingInLoopBody = true; + if (ts6.isForStatement(container)) { + var varDeclList = ts6.getAncestor( + symbol.valueDeclaration, + 258 + /* SyntaxKind.VariableDeclarationList */ + ); + if (varDeclList && varDeclList.parent === container) { + var part = getPartOfForStatementContainingNode(node.parent, container); + if (part) { + var links = getNodeLinks(part); + links.flags |= 131072; + var capturedBindings = links.capturedBlockScopeBindings || (links.capturedBlockScopeBindings = []); + ts6.pushIfUnique(capturedBindings, symbol); + if (part === container.initializer) { + capturesBlockScopeBindingInLoopBody = false; + } + } + } + } + if (capturesBlockScopeBindingInLoopBody) { + getNodeLinks(enclosingIterationStatement).flags |= 65536; + } + } + if (ts6.isForStatement(container)) { + var varDeclList = ts6.getAncestor( + symbol.valueDeclaration, + 258 + /* SyntaxKind.VariableDeclarationList */ + ); + if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { + getNodeLinks(symbol.valueDeclaration).flags |= 4194304; + } + } + getNodeLinks(symbol.valueDeclaration).flags |= 524288; + } + if (isCaptured) { + getNodeLinks(symbol.valueDeclaration).flags |= 262144; + } + } + function isBindingCapturedByNode(node, decl) { + var links = getNodeLinks(node); + return !!links && ts6.contains(links.capturedBlockScopeBindings, getSymbolOfNode(decl)); + } + function isAssignedInBodyOfForStatement(node, container) { + var current = node; + while (current.parent.kind === 214) { + current = current.parent; + } + var isAssigned = false; + if (ts6.isAssignmentTarget(current)) { + isAssigned = true; + } else if (current.parent.kind === 221 || current.parent.kind === 222) { + var expr = current.parent; + isAssigned = expr.operator === 45 || expr.operator === 46; + } + if (!isAssigned) { + return false; + } + return !!ts6.findAncestor(current, function(n) { + return n === container ? "quit" : n === container.statement; + }); + } + function captureLexicalThis(node, container) { + getNodeLinks(node).flags |= 2; + if (container.kind === 169 || container.kind === 173) { + var classNode = container.parent; + getNodeLinks(classNode).flags |= 4; + } else { + getNodeLinks(container).flags |= 4; + } + } + function findFirstSuperCall(node) { + return ts6.isSuperCall(node) ? node : ts6.isFunctionLike(node) ? void 0 : ts6.forEachChild(node, findFirstSuperCall); + } + function classDeclarationExtendsNull(classDecl) { + var classSymbol = getSymbolOfNode(classDecl); + var classInstanceType = getDeclaredTypeOfSymbol(classSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); + return baseConstructorType === nullWideningType; + } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts6.getClassExtendsHeritageElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + if (node.flowNode && !isPostSuperFlowNode( + node.flowNode, + /*noCacheCheck*/ + false + )) { + error(node, diagnosticMessage); + } + } + } + function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) { + if (ts6.isPropertyDeclaration(container) && ts6.hasStaticModifier(container) && container.initializer && ts6.textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && ts6.hasDecorators(container.parent)) { + error(thisExpression, ts6.Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class); + } + } + function checkThisExpression(node) { + var isNodeInTypeQuery = isInTypeQuery(node); + var container = ts6.getThisContainer( + node, + /* includeArrowFunctions */ + true + ); + var capturedByArrowFunction = false; + if (container.kind === 173) { + checkThisBeforeSuper(node, container, ts6.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); + } + if (container.kind === 216) { + container = ts6.getThisContainer( + container, + /* includeArrowFunctions */ + false + ); + capturedByArrowFunction = true; + } + checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); + switch (container.kind) { + case 264: + error(node, ts6.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); + break; + case 263: + error(node, ts6.Diagnostics.this_cannot_be_referenced_in_current_location); + break; + case 173: + if (isInConstructorArgumentInitializer(node, container)) { + error(node, ts6.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + } + break; + case 164: + error(node, ts6.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; + } + if (!isNodeInTypeQuery && capturedByArrowFunction && languageVersion < 2) { + captureLexicalThis(node, container); + } + var type = tryGetThisTypeAt( + node, + /*includeGlobalThis*/ + true, + container + ); + if (noImplicitThis) { + var globalThisType_1 = getTypeOfSymbol(globalThisSymbol); + if (type === globalThisType_1 && capturedByArrowFunction) { + error(node, ts6.Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this); + } else if (!type) { + var diag = error(node, ts6.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + if (!ts6.isSourceFile(container)) { + var outsideThis = tryGetThisTypeAt(container); + if (outsideThis && outsideThis !== globalThisType_1) { + ts6.addRelatedInfo(diag, ts6.createDiagnosticForNode(container, ts6.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container)); + } + } + } + } + return type || anyType; + } + function tryGetThisTypeAt(node, includeGlobalThis, container) { + if (includeGlobalThis === void 0) { + includeGlobalThis = true; + } + if (container === void 0) { + container = ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + } + var isInJS = ts6.isInJSFile(node); + if (ts6.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts6.getThisParameter(container))) { + var thisType = getThisTypeOfDeclaration(container) || isInJS && getTypeForThisExpressionFromJSDoc(container); + if (!thisType) { + var className = getClassNameFromPrototypeMethod(container); + if (isInJS && className) { + var classSymbol = checkExpression(className).symbol; + if (classSymbol && classSymbol.members && classSymbol.flags & 16) { + thisType = getDeclaredTypeOfSymbol(classSymbol).thisType; + } + } else if (isJSConstructor(container)) { + thisType = getDeclaredTypeOfSymbol(getMergedSymbol(container.symbol)).thisType; + } + thisType || (thisType = getContextualThisParameterType(container)); + } + if (thisType) { + return getFlowTypeOfReference(node, thisType); + } + } + if (ts6.isClassLike(container.parent)) { + var symbol = getSymbolOfNode(container.parent); + var type = ts6.isStatic(container) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getFlowTypeOfReference(node, type); + } + if (ts6.isSourceFile(container)) { + if (container.commonJsModuleIndicator) { + var fileSymbol = getSymbolOfNode(container); + return fileSymbol && getTypeOfSymbol(fileSymbol); + } else if (container.externalModuleIndicator) { + return undefinedType; + } else if (includeGlobalThis) { + return getTypeOfSymbol(globalThisSymbol); + } + } + } + function getExplicitThisType(node) { + var container = ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + if (ts6.isFunctionLike(container)) { + var signature = getSignatureFromDeclaration(container); + if (signature.thisParameter) { + return getExplicitTypeOfSymbol(signature.thisParameter); + } + } + if (ts6.isClassLike(container.parent)) { + var symbol = getSymbolOfNode(container.parent); + return ts6.isStatic(container) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + } + } + function getClassNameFromPrototypeMethod(container) { + if (container.kind === 215 && ts6.isBinaryExpression(container.parent) && ts6.getAssignmentDeclarationKind(container.parent) === 3) { + return container.parent.left.expression.expression; + } else if (container.kind === 171 && container.parent.kind === 207 && ts6.isBinaryExpression(container.parent.parent) && ts6.getAssignmentDeclarationKind(container.parent.parent) === 6) { + return container.parent.parent.left.expression; + } else if (container.kind === 215 && container.parent.kind === 299 && container.parent.parent.kind === 207 && ts6.isBinaryExpression(container.parent.parent.parent) && ts6.getAssignmentDeclarationKind(container.parent.parent.parent) === 6) { + return container.parent.parent.parent.left.expression; + } else if (container.kind === 215 && ts6.isPropertyAssignment(container.parent) && ts6.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && ts6.isObjectLiteralExpression(container.parent.parent) && ts6.isCallExpression(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && ts6.getAssignmentDeclarationKind(container.parent.parent.parent) === 9) { + return container.parent.parent.parent.arguments[0].expression; + } else if (ts6.isMethodDeclaration(container) && ts6.isIdentifier(container.name) && (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && ts6.isObjectLiteralExpression(container.parent) && ts6.isCallExpression(container.parent.parent) && container.parent.parent.arguments[2] === container.parent && ts6.getAssignmentDeclarationKind(container.parent.parent) === 9) { + return container.parent.parent.arguments[0].expression; + } + } + function getTypeForThisExpressionFromJSDoc(node) { + var jsdocType = ts6.getJSDocType(node); + if (jsdocType && jsdocType.kind === 320) { + var jsDocFunctionType = jsdocType; + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this") { + return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); + } + } + var thisTag = ts6.getJSDocThisTag(node); + if (thisTag && thisTag.typeExpression) { + return getTypeFromTypeNode(thisTag.typeExpression); + } + } + function isInConstructorArgumentInitializer(node, constructorDecl) { + return !!ts6.findAncestor(node, function(n) { + return ts6.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 && n.parent === constructorDecl; + }); + } + function checkSuperExpression(node) { + var isCallExpression2 = node.parent.kind === 210 && node.parent.expression === node; + var immediateContainer = ts6.getSuperContainer( + node, + /*stopOnFunctions*/ + true + ); + var container = immediateContainer; + var needToCaptureLexicalThis = false; + var inAsyncFunction = false; + if (!isCallExpression2) { + while (container && container.kind === 216) { + if (ts6.hasSyntacticModifier( + container, + 512 + /* ModifierFlags.Async */ + )) + inAsyncFunction = true; + container = ts6.getSuperContainer( + container, + /*stopOnFunctions*/ + true + ); + needToCaptureLexicalThis = languageVersion < 2; + } + if (container && ts6.hasSyntacticModifier( + container, + 512 + /* ModifierFlags.Async */ + )) + inAsyncFunction = true; + } + var canUseSuperExpression = isLegalUsageOfSuperExpression(container); + var nodeCheckFlag = 0; + if (!canUseSuperExpression) { + var current = ts6.findAncestor(node, function(n) { + return n === container ? "quit" : n.kind === 164; + }); + if (current && current.kind === 164) { + error(node, ts6.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } else if (isCallExpression2) { + error(node, ts6.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } else if (!container || !container.parent || !(ts6.isClassLike(container.parent) || container.parent.kind === 207)) { + error(node, ts6.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + } else { + error(node, ts6.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + } + return errorType; + } + if (!isCallExpression2 && immediateContainer.kind === 173) { + checkThisBeforeSuper(node, container, ts6.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } + if (ts6.isStatic(container) || isCallExpression2) { + nodeCheckFlag = 512; + if (!isCallExpression2 && languageVersion >= 2 && languageVersion <= 8 && (ts6.isPropertyDeclaration(container) || ts6.isClassStaticBlockDeclaration(container))) { + ts6.forEachEnclosingBlockScopeContainer(node.parent, function(current2) { + if (!ts6.isSourceFile(current2) || ts6.isExternalOrCommonJsModule(current2)) { + getNodeLinks(current2).flags |= 134217728; + } + }); + } + } else { + nodeCheckFlag = 256; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (container.kind === 171 && inAsyncFunction) { + if (ts6.isSuperProperty(node.parent) && ts6.isAssignmentTarget(node.parent)) { + getNodeLinks(container).flags |= 4096; + } else { + getNodeLinks(container).flags |= 2048; + } + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + if (container.parent.kind === 207) { + if (languageVersion < 2) { + error(node, ts6.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + return errorType; + } else { + return anyType; + } + } + var classLikeDeclaration = container.parent; + if (!ts6.getClassExtendsHeritageElement(classLikeDeclaration)) { + error(node, ts6.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + return errorType; + } + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration)); + var baseClassType = classType && getBaseTypes(classType)[0]; + if (!baseClassType) { + return errorType; + } + if (container.kind === 173 && isInConstructorArgumentInitializer(node, container)) { + error(node, ts6.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + return errorType; + } + return nodeCheckFlag === 512 ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType); + function isLegalUsageOfSuperExpression(container2) { + if (!container2) { + return false; + } + if (isCallExpression2) { + return container2.kind === 173; + } else { + if (ts6.isClassLike(container2.parent) || container2.parent.kind === 207) { + if (ts6.isStatic(container2)) { + return container2.kind === 171 || container2.kind === 170 || container2.kind === 174 || container2.kind === 175 || container2.kind === 169 || container2.kind === 172; + } else { + return container2.kind === 171 || container2.kind === 170 || container2.kind === 174 || container2.kind === 175 || container2.kind === 169 || container2.kind === 168 || container2.kind === 173; + } + } + } + return false; + } + } + function getContainingObjectLiteral(func) { + return (func.kind === 171 || func.kind === 174 || func.kind === 175) && func.parent.kind === 207 ? func.parent : func.kind === 215 && func.parent.kind === 299 ? func.parent.parent : void 0; + } + function getThisTypeArgument(type) { + return ts6.getObjectFlags(type) & 4 && type.target === globalThisType ? getTypeArguments(type)[0] : void 0; + } + function getThisTypeFromContextualType(type) { + return mapType(type, function(t) { + return t.flags & 2097152 ? ts6.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + }); + } + function getContextualThisParameterType(func) { + if (func.kind === 216) { + return void 0; + } + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var thisParameter = contextualSignature.thisParameter; + if (thisParameter) { + return getTypeOfSymbol(thisParameter); + } + } + } + var inJs = ts6.isInJSFile(func); + if (noImplicitThis || inJs) { + var containingLiteral = getContainingObjectLiteral(func); + if (containingLiteral) { + var contextualType = getApparentTypeOfContextualType( + containingLiteral, + /*contextFlags*/ + void 0 + ); + var literal2 = containingLiteral; + var type = contextualType; + while (type) { + var thisType = getThisTypeFromContextualType(type); + if (thisType) { + return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); + } + if (literal2.parent.kind !== 299) { + break; + } + literal2 = literal2.parent.parent; + type = getApparentTypeOfContextualType( + literal2, + /*contextFlags*/ + void 0 + ); + } + return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral)); + } + var parent = ts6.walkUpParenthesizedExpressions(func.parent); + if (parent.kind === 223 && parent.operatorToken.kind === 63) { + var target = parent.left; + if (ts6.isAccessExpression(target)) { + var expression = target.expression; + if (inJs && ts6.isIdentifier(expression)) { + var sourceFile = ts6.getSourceFileOfNode(parent); + if (sourceFile.commonJsModuleIndicator && getResolvedSymbol(expression) === sourceFile.symbol) { + return void 0; + } + } + return getWidenedType(checkExpressionCached(expression)); + } + } + } + return void 0; + } + function getContextuallyTypedParameterType(parameter) { + var func = parameter.parent; + if (!isContextSensitiveFunctionOrObjectLiteralMethod(func)) { + return void 0; + } + var iife = ts6.getImmediatelyInvokedFunctionExpression(func); + if (iife && iife.arguments) { + var args = getEffectiveCallArguments(iife); + var indexOfParameter = func.parameters.indexOf(parameter); + if (parameter.dotDotDotToken) { + return getSpreadArgumentType( + args, + indexOfParameter, + args.length, + anyType, + /*context*/ + void 0, + 0 + /* CheckMode.Normal */ + ); + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < args.length ? getWidenedLiteralType(checkExpression(args[indexOfParameter])) : parameter.initializer ? void 0 : undefinedWideningType; + links.resolvedSignature = cached; + return type; + } + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var index = func.parameters.indexOf(parameter) - (ts6.getThisParameter(func) ? 1 : 0); + return parameter.dotDotDotToken && ts6.lastOrUndefined(func.parameters) === parameter ? getRestTypeAtPosition(contextualSignature, index) : tryGetTypeAtPosition(contextualSignature, index); + } + } + function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) { + var typeNode = ts6.getEffectiveTypeAnnotationNode(declaration); + if (typeNode) { + return getTypeFromTypeNode(typeNode); + } + switch (declaration.kind) { + case 166: + return getContextuallyTypedParameterType(declaration); + case 205: + return getContextualTypeForBindingElement(declaration, contextFlags); + case 169: + if (ts6.isStatic(declaration)) { + return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); + } + } + } + function getContextualTypeForBindingElement(declaration, contextFlags) { + var parent = declaration.parent.parent; + var name = declaration.propertyName || declaration.name; + var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 205 && parent.initializer && checkDeclarationInitializer( + parent, + declaration.dotDotDotToken ? 64 : 0 + /* CheckMode.Normal */ + ); + if (!parentType || ts6.isBindingPattern(name) || ts6.isComputedNonLiteralName(name)) + return void 0; + if (parent.name.kind === 204) { + var index = ts6.indexOfNode(declaration.parent.elements, declaration); + if (index < 0) + return void 0; + return getContextualTypeForElementExpression(parentType, index); + } + var nameType = getLiteralTypeFromPropertyName(name); + if (isTypeUsableAsPropertyName(nameType)) { + var text = getPropertyNameFromType(nameType); + return getTypeOfPropertyOfType(parentType, text); + } + } + function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) { + var parentType = ts6.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags); + if (!parentType) + return void 0; + return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName); + } + function getContextualTypeForInitializerExpression(node, contextFlags) { + var declaration = node.parent; + if (ts6.hasInitializer(declaration) && node === declaration.initializer) { + var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags); + if (result) { + return result; + } + if (!(contextFlags & 8) && ts6.isBindingPattern(declaration.name) && declaration.name.elements.length > 0) { + return getTypeFromBindingPattern( + declaration.name, + /*includePatternInType*/ + true, + /*reportErrors*/ + false + ); + } + } + return void 0; + } + function getContextualTypeForReturnExpression(node, contextFlags) { + var func = ts6.getContainingFunction(node); + if (func) { + var contextualReturnType = getContextualReturnType(func, contextFlags); + if (contextualReturnType) { + var functionFlags = ts6.getFunctionFlags(func); + if (functionFlags & 1) { + var isAsyncGenerator_1 = (functionFlags & 2) !== 0; + if (contextualReturnType.flags & 1048576) { + contextualReturnType = filterType(contextualReturnType, function(type) { + return !!getIterationTypeOfGeneratorFunctionReturnType(1, type, isAsyncGenerator_1); + }); + } + var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1, contextualReturnType, (functionFlags & 2) !== 0); + if (!iterationReturnType) { + return void 0; + } + contextualReturnType = iterationReturnType; + } + if (functionFlags & 2) { + var contextualAwaitedType = mapType(contextualReturnType, getAwaitedTypeNoAlias); + return contextualAwaitedType && getUnionType([contextualAwaitedType, createPromiseLikeType(contextualAwaitedType)]); + } + return contextualReturnType; + } + } + return void 0; + } + function getContextualTypeForAwaitOperand(node, contextFlags) { + var contextualType = getContextualType(node, contextFlags); + if (contextualType) { + var contextualAwaitedType = getAwaitedTypeNoAlias(contextualType); + return contextualAwaitedType && getUnionType([contextualAwaitedType, createPromiseLikeType(contextualAwaitedType)]); + } + return void 0; + } + function getContextualTypeForYieldOperand(node, contextFlags) { + var func = ts6.getContainingFunction(node); + if (func) { + var functionFlags = ts6.getFunctionFlags(func); + var contextualReturnType = getContextualReturnType(func, contextFlags); + if (contextualReturnType) { + var isAsyncGenerator_2 = (functionFlags & 2) !== 0; + if (!node.asteriskToken && contextualReturnType.flags & 1048576) { + contextualReturnType = filterType(contextualReturnType, function(type) { + return !!getIterationTypeOfGeneratorFunctionReturnType(1, type, isAsyncGenerator_2); + }); + } + return node.asteriskToken ? contextualReturnType : getIterationTypeOfGeneratorFunctionReturnType(0, contextualReturnType, isAsyncGenerator_2); + } + } + return void 0; + } + function isInParameterInitializerBeforeContainingFunction(node) { + var inBindingInitializer = false; + while (node.parent && !ts6.isFunctionLike(node.parent)) { + if (ts6.isParameter(node.parent) && (inBindingInitializer || node.parent.initializer === node)) { + return true; + } + if (ts6.isBindingElement(node.parent) && node.parent.initializer === node) { + inBindingInitializer = true; + } + node = node.parent; + } + return false; + } + function getContextualIterationType(kind, functionDecl) { + var isAsync = !!(ts6.getFunctionFlags(functionDecl) & 2); + var contextualReturnType = getContextualReturnType( + functionDecl, + /*contextFlags*/ + void 0 + ); + if (contextualReturnType) { + return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync) || void 0; + } + return void 0; + } + function getContextualReturnType(functionDecl, contextFlags) { + var returnType = getReturnTypeFromAnnotation(functionDecl); + if (returnType) { + return returnType; + } + var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); + if (signature && !isResolvingReturnTypeOfSignature(signature)) { + return getReturnTypeOfSignature(signature); + } + var iife = ts6.getImmediatelyInvokedFunctionExpression(functionDecl); + if (iife) { + return getContextualType(iife, contextFlags); + } + return void 0; + } + function getContextualTypeForArgument(callTarget, arg) { + var args = getEffectiveCallArguments(callTarget); + var argIndex = args.indexOf(arg); + return argIndex === -1 ? void 0 : getContextualTypeForArgumentAtIndex(callTarget, argIndex); + } + function getContextualTypeForArgumentAtIndex(callTarget, argIndex) { + if (ts6.isImportCall(callTarget)) { + return argIndex === 0 ? stringType : argIndex === 1 ? getGlobalImportCallOptionsType( + /*reportErrors*/ + false + ) : anyType; + } + var signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget); + if (ts6.isJsxOpeningLikeElement(callTarget) && argIndex === 0) { + return getEffectiveFirstArgumentForJsxSignature(signature, callTarget); + } + var restIndex = signature.parameters.length - 1; + return signatureHasRestParameter(signature) && argIndex >= restIndex ? getIndexedAccessType( + getTypeOfSymbol(signature.parameters[restIndex]), + getNumberLiteralType(argIndex - restIndex), + 256 + /* AccessFlags.Contextual */ + ) : getTypeAtPosition(signature, argIndex); + } + function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { + if (template.parent.kind === 212) { + return getContextualTypeForArgument(template.parent, substitutionExpression); + } + return void 0; + } + function getContextualTypeForBinaryOperand(node, contextFlags) { + var binaryExpression = node.parent; + var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right; + switch (operatorToken.kind) { + case 63: + case 76: + case 75: + case 77: + return node === right ? getContextualTypeForAssignmentDeclaration(binaryExpression) : void 0; + case 56: + case 60: + var type = getContextualType(binaryExpression, contextFlags); + return node === right && (type && type.pattern || !type && !ts6.isDefaultedExpandoInitializer(binaryExpression)) ? getTypeOfExpression(left) : type; + case 55: + case 27: + return node === right ? getContextualType(binaryExpression, contextFlags) : void 0; + default: + return void 0; + } + } + function getSymbolForExpression(e) { + if (e.symbol) { + return e.symbol; + } + if (ts6.isIdentifier(e)) { + return getResolvedSymbol(e); + } + if (ts6.isPropertyAccessExpression(e)) { + var lhsType = getTypeOfExpression(e.expression); + return ts6.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText); + } + if (ts6.isElementAccessExpression(e)) { + var propType = checkExpressionCached(e.argumentExpression); + if (!isTypeUsableAsPropertyName(propType)) { + return void 0; + } + var lhsType = getTypeOfExpression(e.expression); + return getPropertyOfType(lhsType, getPropertyNameFromType(propType)); + } + return void 0; + function tryGetPrivateIdentifierPropertyOfType(type, id) { + var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id); + return lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(type, lexicallyScopedSymbol); + } + } + function getContextualTypeForAssignmentDeclaration(binaryExpression) { + var _a, _b; + var kind = ts6.getAssignmentDeclarationKind(binaryExpression); + switch (kind) { + case 0: + case 4: + var lhsSymbol = getSymbolForExpression(binaryExpression.left); + var decl = lhsSymbol && lhsSymbol.valueDeclaration; + if (decl && (ts6.isPropertyDeclaration(decl) || ts6.isPropertySignature(decl))) { + var overallAnnotation = ts6.getEffectiveTypeAnnotationNode(decl); + return overallAnnotation && instantiateType(getTypeFromTypeNode(overallAnnotation), getSymbolLinks(lhsSymbol).mapper) || (ts6.isPropertyDeclaration(decl) ? decl.initializer && getTypeOfExpression(binaryExpression.left) : void 0); + } + if (kind === 0) { + return getTypeOfExpression(binaryExpression.left); + } + return getContextualTypeForThisPropertyAssignment(binaryExpression); + case 5: + if (isPossiblyAliasedThisProperty(binaryExpression, kind)) { + return getContextualTypeForThisPropertyAssignment(binaryExpression); + } else if (!binaryExpression.left.symbol) { + return getTypeOfExpression(binaryExpression.left); + } else { + var decl_1 = binaryExpression.left.symbol.valueDeclaration; + if (!decl_1) { + return void 0; + } + var lhs = ts6.cast(binaryExpression.left, ts6.isAccessExpression); + var overallAnnotation = ts6.getEffectiveTypeAnnotationNode(decl_1); + if (overallAnnotation) { + return getTypeFromTypeNode(overallAnnotation); + } else if (ts6.isIdentifier(lhs.expression)) { + var id = lhs.expression; + var parentSymbol = resolveName( + id, + id.escapedText, + 111551, + void 0, + id.escapedText, + /*isUse*/ + true + ); + if (parentSymbol) { + var annotated_1 = parentSymbol.valueDeclaration && ts6.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration); + if (annotated_1) { + var nameStr = ts6.getElementOrPropertyAccessName(lhs); + if (nameStr !== void 0) { + return getTypeOfPropertyOfContextualType(getTypeFromTypeNode(annotated_1), nameStr); + } + } + return void 0; + } + } + return ts6.isInJSFile(decl_1) ? void 0 : getTypeOfExpression(binaryExpression.left); + } + case 1: + case 6: + case 3: + case 2: + var valueDeclaration = void 0; + if (kind !== 2) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } + valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); + var annotated = valueDeclaration && ts6.getEffectiveTypeAnnotationNode(valueDeclaration); + return annotated ? getTypeFromTypeNode(annotated) : void 0; + case 7: + case 8: + case 9: + return ts6.Debug.fail("Does not apply"); + default: + return ts6.Debug.assertNever(kind); + } + } + function isPossiblyAliasedThisProperty(declaration, kind) { + if (kind === void 0) { + kind = ts6.getAssignmentDeclarationKind(declaration); + } + if (kind === 4) { + return true; + } + if (!ts6.isInJSFile(declaration) || kind !== 5 || !ts6.isIdentifier(declaration.left.expression)) { + return false; + } + var name = declaration.left.expression.escapedText; + var symbol = resolveName( + declaration.left, + name, + 111551, + void 0, + void 0, + /*isUse*/ + true, + /*excludeGlobals*/ + true + ); + return ts6.isThisInitializedDeclaration(symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration); + } + function getContextualTypeForThisPropertyAssignment(binaryExpression) { + if (!binaryExpression.symbol) + return getTypeOfExpression(binaryExpression.left); + if (binaryExpression.symbol.valueDeclaration) { + var annotated = ts6.getEffectiveTypeAnnotationNode(binaryExpression.symbol.valueDeclaration); + if (annotated) { + var type = getTypeFromTypeNode(annotated); + if (type) { + return type; + } + } + } + var thisAccess = ts6.cast(binaryExpression.left, ts6.isAccessExpression); + if (!ts6.isObjectLiteralMethod(ts6.getThisContainer( + thisAccess.expression, + /*includeArrowFunctions*/ + false + ))) { + return void 0; + } + var thisType = checkThisExpression(thisAccess.expression); + var nameStr = ts6.getElementOrPropertyAccessName(thisAccess); + return nameStr !== void 0 && getTypeOfPropertyOfContextualType(thisType, nameStr) || void 0; + } + function isCircularMappedProperty(symbol) { + return !!(ts6.getCheckFlags(symbol) & 262144 && !symbol.type && findResolutionCycleStartIndex( + symbol, + 0 + /* TypeSystemPropertyName.Type */ + ) >= 0); + } + function getTypeOfPropertyOfContextualType(type, name, nameType) { + return mapType( + type, + function(t) { + var _a; + if (isGenericMappedType(t) && !t.declaration.nameType) { + var constraint = getConstraintTypeFromMappedType(t); + var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; + var propertyNameType = nameType || getStringLiteralType(ts6.unescapeLeadingUnderscores(name)); + if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { + return substituteIndexedMappedType(t, propertyNameType); + } + } else if (t.flags & 3670016) { + var prop = getPropertyOfType(t, name); + if (prop) { + return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop); + } + if (isTupleType(t)) { + var restType = getRestTypeOfTupleType(t); + if (restType && ts6.isNumericLiteralName(name) && +name >= 0) { + return restType; + } + } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts6.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; + } + return void 0; + }, + /*noReductions*/ + true + ); + } + function getContextualTypeForObjectLiteralMethod(node, contextFlags) { + ts6.Debug.assert(ts6.isObjectLiteralMethod(node)); + if (node.flags & 33554432) { + return void 0; + } + return getContextualTypeForObjectLiteralElement(node, contextFlags); + } + function getContextualTypeForObjectLiteralElement(element, contextFlags) { + var objectLiteral = element.parent; + var propertyAssignmentType = ts6.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags); + if (propertyAssignmentType) { + return propertyAssignmentType; + } + var type = getApparentTypeOfContextualType(objectLiteral, contextFlags); + if (type) { + if (hasBindableName(element)) { + var symbol = getSymbolOfNode(element); + return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType); + } + if (element.name) { + var nameType_2 = getLiteralTypeFromPropertyName(element.name); + return mapType( + type, + function(t) { + var _a; + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType_2)) === null || _a === void 0 ? void 0 : _a.type; + }, + /*noReductions*/ + true + ); + } + } + return void 0; + } + function getContextualTypeForElementExpression(arrayContextualType, index) { + return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType( + arrayContextualType, + function(t) { + return getIteratedTypeOrElementType( + 1, + t, + undefinedType, + /*errorNode*/ + void 0, + /*checkAssignability*/ + false + ); + }, + /*noReductions*/ + true + )); + } + function getContextualTypeForConditionalOperand(node, contextFlags) { + var conditional = node.parent; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : void 0; + } + function getContextualTypeForChildJsxExpression(node, child, contextFlags) { + var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags); + var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); + if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) { + return void 0; + } + var realChildren = ts6.getSemanticJsxChildren(node.children); + var childIndex = realChildren.indexOf(child); + var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName); + return childFieldType && (realChildren.length === 1 ? childFieldType : mapType( + childFieldType, + function(t) { + if (isArrayLikeType(t)) { + return getIndexedAccessType(t, getNumberLiteralType(childIndex)); + } else { + return t; + } + }, + /*noReductions*/ + true + )); + } + function getContextualTypeForJsxExpression(node, contextFlags) { + var exprParent = node.parent; + return ts6.isJsxAttributeLike(exprParent) ? getContextualType(node, contextFlags) : ts6.isJsxElement(exprParent) ? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags) : void 0; + } + function getContextualTypeForJsxAttribute(attribute, contextFlags) { + if (ts6.isJsxAttribute(attribute)) { + var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags); + if (!attributesType || isTypeAny(attributesType)) { + return void 0; + } + return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText); + } else { + return getContextualType(attribute.parent, contextFlags); + } + } + function isPossiblyDiscriminantValue(node) { + switch (node.kind) { + case 10: + case 8: + case 9: + case 14: + case 110: + case 95: + case 104: + case 79: + case 155: + return true; + case 208: + case 214: + return isPossiblyDiscriminantValue(node.expression); + case 291: + return !node.expression || isPossiblyDiscriminantValue(node.expression); + } + return false; + } + function discriminateContextualTypeByObjectMembers(node, contextualType) { + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts6.concatenate(ts6.map(ts6.filter(node.properties, function(p) { + return !!p.symbol && p.kind === 299 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); + }), function(prop) { + return [function() { + return getContextFreeTypeOfExpression(prop.initializer); + }, prop.symbol.escapedName]; + }), ts6.map(ts6.filter(getPropertiesOfType(contextualType), function(s) { + var _a; + return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); + }), function(s) { + return [function() { + return undefinedType; + }, s.escapedName]; + })), isTypeAssignableTo, contextualType); + } + function discriminateContextualTypeByJSXAttributes(node, contextualType) { + return discriminateTypeByDiscriminableItems(contextualType, ts6.concatenate(ts6.map(ts6.filter(node.properties, function(p) { + return !!p.symbol && p.kind === 288 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); + }), function(prop) { + return [!prop.initializer ? function() { + return trueType; + } : function() { + return getContextFreeTypeOfExpression(prop.initializer); + }, prop.symbol.escapedName]; + }), ts6.map(ts6.filter(getPropertiesOfType(contextualType), function(s) { + var _a; + return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); + }), function(s) { + return [function() { + return undefinedType; + }, s.escapedName]; + })), isTypeAssignableTo, contextualType); + } + function getApparentTypeOfContextualType(node, contextFlags) { + var contextualType = ts6.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags); + var instantiatedType = instantiateContextualType(contextualType, node, contextFlags); + if (instantiatedType && !(contextFlags && contextFlags & 2 && instantiatedType.flags & 8650752)) { + var apparentType = mapType( + instantiatedType, + getApparentType, + /*noReductions*/ + true + ); + return apparentType.flags & 1048576 && ts6.isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 && ts6.isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; + } + } + function instantiateContextualType(contextualType, node, contextFlags) { + if (contextualType && maybeTypeOfKind( + contextualType, + 465829888 + /* TypeFlags.Instantiable */ + )) { + var inferenceContext = getInferenceContext(node); + if (inferenceContext && contextFlags & 1 && ts6.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { + return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); + } + if (inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnMapper) { + var type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper); + return type.flags & 1048576 && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, function(t) { + return t !== regularFalseType && t !== regularTrueType; + }) : type; + } + } + return contextualType; + } + function instantiateInstantiableTypes(type, mapper) { + if (type.flags & 465829888) { + return instantiateType(type, mapper); + } + if (type.flags & 1048576) { + return getUnionType( + ts6.map(type.types, function(t) { + return instantiateInstantiableTypes(t, mapper); + }), + 0 + /* UnionReduction.None */ + ); + } + if (type.flags & 2097152) { + return getIntersectionType(ts6.map(type.types, function(t) { + return instantiateInstantiableTypes(t, mapper); + })); + } + return type; + } + function getContextualType(node, contextFlags) { + if (node.flags & 33554432) { + return void 0; + } + if (node.contextualType) { + return node.contextualType; + } + var parent = node.parent; + switch (parent.kind) { + case 257: + case 166: + case 169: + case 168: + case 205: + return getContextualTypeForInitializerExpression(node, contextFlags); + case 216: + case 250: + return getContextualTypeForReturnExpression(node, contextFlags); + case 226: + return getContextualTypeForYieldOperand(parent, contextFlags); + case 220: + return getContextualTypeForAwaitOperand(parent, contextFlags); + case 210: + case 211: + return getContextualTypeForArgument(parent, node); + case 213: + case 231: + return ts6.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); + case 223: + return getContextualTypeForBinaryOperand(node, contextFlags); + case 299: + case 300: + return getContextualTypeForObjectLiteralElement(parent, contextFlags); + case 301: + return getContextualType(parent.parent, contextFlags); + case 206: { + var arrayLiteral = parent; + var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); + return getContextualTypeForElementExpression(type, ts6.indexOfNode(arrayLiteral.elements, node)); + } + case 224: + return getContextualTypeForConditionalOperand(node, contextFlags); + case 236: + ts6.Debug.assert( + parent.parent.kind === 225 + /* SyntaxKind.TemplateExpression */ + ); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 214: { + var tag = ts6.isInJSFile(parent) ? ts6.getJSDocTypeTag(parent) : void 0; + return !tag ? getContextualType(parent, contextFlags) : ts6.isJSDocTypeTag(tag) && ts6.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); + } + case 232: + return getContextualType(parent, contextFlags); + case 235: + return getTypeFromTypeNode(parent.type); + case 274: + return tryGetTypeFromEffectiveTypeNode(parent); + case 291: + return getContextualTypeForJsxExpression(parent, contextFlags); + case 288: + case 290: + return getContextualTypeForJsxAttribute(parent, contextFlags); + case 283: + case 282: + return getContextualJsxElementAttributesType(parent, contextFlags); + } + return void 0; + function tryFindWhenConstTypeReference(node2) { + return getContextualType(node2, contextFlags); + } + } + function getInferenceContext(node) { + var ancestor = ts6.findAncestor(node, function(n) { + return !!n.inferenceContext; + }); + return ancestor && ancestor.inferenceContext; + } + function getContextualJsxElementAttributesType(node, contextFlags) { + if (ts6.isJsxOpeningElement(node) && node.parent.contextualType && contextFlags !== 4) { + return node.parent.contextualType; + } + return getContextualTypeForArgumentAtIndex(node, 0); + } + function getEffectiveFirstArgumentForJsxSignature(signature, node) { + return getJsxReferenceKind(node) !== 0 ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node); + } + function getJsxPropsTypeFromCallSignature(sig, context) { + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType); + propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType); + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (!isErrorType(intrinsicAttribs)) { + propsType = intersectTypes(intrinsicAttribs, propsType); + } + return propsType; + } + function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) { + if (sig.compositeSignatures) { + var results = []; + for (var _i = 0, _a = sig.compositeSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + var instance = getReturnTypeOfSignature(signature); + if (isTypeAny(instance)) { + return instance; + } + var propType = getTypeOfPropertyOfType(instance, forcedLookupLocation); + if (!propType) { + return; + } + results.push(propType); + } + return getIntersectionType(results); + } + var instanceType = getReturnTypeOfSignature(sig); + return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); + } + function getStaticTypeOfReferencedJsxConstructor(context) { + if (isJsxIntrinsicIdentifier(context.tagName)) { + var result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context); + var fakeSignature = createSignatureForJSXIntrinsic(context, result); + return getOrCreateTypeFromSignature(fakeSignature); + } + var tagType = checkExpressionCached(context.tagName); + if (tagType.flags & 128) { + var result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context); + if (!result) { + return errorType; + } + var fakeSignature = createSignatureForJSXIntrinsic(context, result); + return getOrCreateTypeFromSignature(fakeSignature); + } + return tagType; + } + function getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType) { + var managedSym = getJsxLibraryManagedAttributes(ns); + if (managedSym) { + var declaredManagedType = getDeclaredTypeOfSymbol(managedSym); + var ctorType = getStaticTypeOfReferencedJsxConstructor(context); + if (managedSym.flags & 524288) { + var params = getSymbolLinks(managedSym).typeParameters; + if (ts6.length(params) >= 2) { + var args = fillMissingTypeArguments([ctorType, attributesType], params, 2, ts6.isInJSFile(context)); + return getTypeAliasInstantiation(managedSym, args); + } + } + if (ts6.length(declaredManagedType.typeParameters) >= 2) { + var args = fillMissingTypeArguments([ctorType, attributesType], declaredManagedType.typeParameters, 2, ts6.isInJSFile(context)); + return createTypeReference(declaredManagedType, args); + } + } + return attributesType; + } + function getJsxPropsTypeFromClassType(sig, context) { + var ns = getJsxNamespaceAt(context); + var forcedLookupLocation = getJsxElementPropertiesName(ns); + var attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); + if (!attributesType) { + if (!!forcedLookupLocation && !!ts6.length(context.attributes.properties)) { + error(context, ts6.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts6.unescapeLeadingUnderscores(forcedLookupLocation)); + } + return unknownType; + } + attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType); + if (isTypeAny(attributesType)) { + return attributesType; + } else { + var apparentAttributesType = attributesType; + var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context); + if (!isErrorType(intrinsicClassAttribs)) { + var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); + var hostClassType = getReturnTypeOfSignature(sig); + var libraryManagedAttributeType = void 0; + if (typeParams) { + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts6.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); + } + var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); + if (!isErrorType(intrinsicAttribs)) { + apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType); + } + return apparentAttributesType; + } + } + function getIntersectedSignatures(signatures) { + return ts6.getStrictOptionValue(compilerOptions, "noImplicitAny") ? ts6.reduceLeft(signatures, function(left, right) { + return left === right || !left ? left : compareTypeParametersIdentical(left.typeParameters, right.typeParameters) ? combineSignaturesOfIntersectionMembers(left, right) : void 0; + }) : void 0; + } + function combineIntersectionThisParam(left, right, mapper) { + if (!left || !right) { + return left || right; + } + var thisType = getUnionType([getTypeOfSymbol(left), instantiateType(getTypeOfSymbol(right), mapper)]); + return createSymbolWithType(left, thisType); + } + function combineIntersectionParameters(left, right, mapper) { + var leftCount = getParameterCount(left); + var rightCount = getParameterCount(right); + var longest = leftCount >= rightCount ? left : right; + var shorter = longest === left ? right : left; + var longestCount = longest === left ? leftCount : rightCount; + var eitherHasEffectiveRest = hasEffectiveRestParameter(left) || hasEffectiveRestParameter(right); + var needsExtraRestElement = eitherHasEffectiveRest && !hasEffectiveRestParameter(longest); + var params = new Array(longestCount + (needsExtraRestElement ? 1 : 0)); + for (var i = 0; i < longestCount; i++) { + var longestParamType = tryGetTypeAtPosition(longest, i); + if (longest === right) { + longestParamType = instantiateType(longestParamType, mapper); + } + var shorterParamType = tryGetTypeAtPosition(shorter, i) || unknownType; + if (shorter === right) { + shorterParamType = instantiateType(shorterParamType, mapper); + } + var unionParamType = getUnionType([longestParamType, shorterParamType]); + var isRestParam = eitherHasEffectiveRest && !needsExtraRestElement && i === longestCount - 1; + var isOptional = i >= getMinArgumentCount(longest) && i >= getMinArgumentCount(shorter); + var leftName = i >= leftCount ? void 0 : getParameterNameAtPosition(left, i); + var rightName = i >= rightCount ? void 0 : getParameterNameAtPosition(right, i); + var paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0; + var paramSymbol = createSymbol(1 | (isOptional && !isRestParam ? 16777216 : 0), paramName || "arg".concat(i)); + paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType; + params[i] = paramSymbol; + } + if (needsExtraRestElement) { + var restParamSymbol = createSymbol(1, "args"); + restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount)); + if (shorter === right) { + restParamSymbol.type = instantiateType(restParamSymbol.type, mapper); + } + params[longestCount] = restParamSymbol; + } + return params; + } + function combineSignaturesOfIntersectionMembers(left, right) { + var typeParams = left.typeParameters || right.typeParameters; + var paramMapper; + if (left.typeParameters && right.typeParameters) { + paramMapper = createTypeMapper(right.typeParameters, left.typeParameters); + } + var declaration = left.declaration; + var params = combineIntersectionParameters(left, right, paramMapper); + var thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper); + var minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount); + var result = createSignature( + declaration, + typeParams, + thisParam, + params, + /*resolvedReturnType*/ + void 0, + /*resolvedTypePredicate*/ + void 0, + minArgCount, + (left.flags | right.flags) & 39 + /* SignatureFlags.PropagatingFlags */ + ); + result.compositeKind = 2097152; + result.compositeSignatures = ts6.concatenate(left.compositeKind === 2097152 && left.compositeSignatures || [left], [right]); + if (paramMapper) { + result.mapper = left.compositeKind === 2097152 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; + } + return result; + } + function getContextualCallSignature(type, node) { + var signatures = getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + var applicableByArity = ts6.filter(signatures, function(s) { + return !isAritySmaller(s, node); + }); + return applicableByArity.length === 1 ? applicableByArity[0] : getIntersectedSignatures(applicableByArity); + } + function isAritySmaller(signature, target) { + var targetParameterCount = 0; + for (; targetParameterCount < target.parameters.length; targetParameterCount++) { + var param = target.parameters[targetParameterCount]; + if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { + break; + } + } + if (target.parameters.length && ts6.parameterIsThisKeyword(target.parameters[0])) { + targetParameterCount--; + } + return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount; + } + function getContextualSignatureForFunctionLikeDeclaration(node) { + return ts6.isFunctionExpressionOrArrowFunction(node) || ts6.isObjectLiteralMethod(node) ? getContextualSignature(node) : void 0; + } + function getContextualSignature(node) { + ts6.Debug.assert(node.kind !== 171 || ts6.isObjectLiteralMethod(node)); + var typeTagSignature = getSignatureOfTypeTag(node); + if (typeTagSignature) { + return typeTagSignature; + } + var type = getApparentTypeOfContextualType( + node, + 1 + /* ContextFlags.Signature */ + ); + if (!type) { + return void 0; + } + if (!(type.flags & 1048576)) { + return getContextualCallSignature(type, node); + } + var signatureList; + var types = type.types; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var current = types_18[_i]; + var signature = getContextualCallSignature(current, node); + if (signature) { + if (!signatureList) { + signatureList = [signature]; + } else if (!compareSignaturesIdentical( + signatureList[0], + signature, + /*partialMatch*/ + false, + /*ignoreThisTypes*/ + true, + /*ignoreReturnTypes*/ + true, + compareTypesIdentical + )) { + return void 0; + } else { + signatureList.push(signature); + } + } + } + if (signatureList) { + return signatureList.length === 1 ? signatureList[0] : createUnionSignature(signatureList[0], signatureList); + } + } + function checkSpreadExpression(node, checkMode) { + if (languageVersion < 2) { + checkExternalEmitHelpers( + node, + compilerOptions.downlevelIteration ? 1536 : 1024 + /* ExternalEmitHelpers.SpreadArray */ + ); + } + var arrayOrIterableType = checkExpression(node.expression, checkMode); + return checkIteratedTypeOrElementType(33, arrayOrIterableType, undefinedType, node.expression); + } + function checkSyntheticExpression(node) { + return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; + } + function hasDefaultValue(node) { + return node.kind === 205 && !!node.initializer || node.kind === 223 && node.operatorToken.kind === 63; + } + function checkArrayLiteral(node, checkMode, forceTuple) { + var elements = node.elements; + var elementCount = elements.length; + var elementTypes = []; + var elementFlags = []; + var contextualType = getApparentTypeOfContextualType( + node, + /*contextFlags*/ + void 0 + ); + var inDestructuringPattern = ts6.isAssignmentTarget(node); + var inConstContext = isConstContext(node); + var hasOmittedExpression = false; + for (var i = 0; i < elementCount; i++) { + var e = elements[i]; + if (e.kind === 227) { + if (languageVersion < 2) { + checkExternalEmitHelpers( + e, + compilerOptions.downlevelIteration ? 1536 : 1024 + /* ExternalEmitHelpers.SpreadArray */ + ); + } + var spreadType = checkExpression(e.expression, checkMode, forceTuple); + if (isArrayLikeType(spreadType)) { + elementTypes.push(spreadType); + elementFlags.push( + 8 + /* ElementFlags.Variadic */ + ); + } else if (inDestructuringPattern) { + var restElementType = getIndexTypeOfType(spreadType, numberType) || getIteratedTypeOrElementType( + 65, + spreadType, + undefinedType, + /*errorNode*/ + void 0, + /*checkAssignability*/ + false + ) || unknownType; + elementTypes.push(restElementType); + elementFlags.push( + 4 + /* ElementFlags.Rest */ + ); + } else { + elementTypes.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, e.expression)); + elementFlags.push( + 4 + /* ElementFlags.Rest */ + ); + } + } else if (exactOptionalPropertyTypes && e.kind === 229) { + hasOmittedExpression = true; + elementTypes.push(missingType); + elementFlags.push( + 2 + /* ElementFlags.Optional */ + ); + } else { + var elementContextualType = getContextualTypeForElementExpression(contextualType, elementTypes.length); + var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple); + elementTypes.push(addOptionality( + type, + /*isProperty*/ + true, + hasOmittedExpression + )); + elementFlags.push( + hasOmittedExpression ? 2 : 1 + /* ElementFlags.Required */ + ); + if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & 2 && !(checkMode & 4) && isContextSensitive(e)) { + var inferenceContext = getInferenceContext(node); + ts6.Debug.assert(inferenceContext); + addIntraExpressionInferenceSite(inferenceContext, e, type); + } + } + } + if (inDestructuringPattern) { + return createTupleType(elementTypes, elementFlags); + } + if (forceTuple || inConstContext || contextualType && someType(contextualType, isTupleLikeType)) { + return createArrayLiteralType(createTupleType( + elementTypes, + elementFlags, + /*readonly*/ + inConstContext + )); + } + return createArrayLiteralType(createArrayType(elementTypes.length ? getUnionType( + ts6.sameMap(elementTypes, function(t, i2) { + return elementFlags[i2] & 8 ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t; + }), + 2 + /* UnionReduction.Subtype */ + ) : strictNullChecks ? implicitNeverType : undefinedWideningType, inConstContext)); + } + function createArrayLiteralType(type) { + if (!(ts6.getObjectFlags(type) & 4)) { + return type; + } + var literalType = type.literalType; + if (!literalType) { + literalType = type.literalType = cloneTypeReference(type); + literalType.objectFlags |= 16384 | 131072; + } + return literalType; + } + function isNumericName(name) { + switch (name.kind) { + case 164: + return isNumericComputedName(name); + case 79: + return ts6.isNumericLiteralName(name.escapedText); + case 8: + case 10: + return ts6.isNumericLiteralName(name.text); + default: + return false; + } + } + function isNumericComputedName(name) { + return isTypeAssignableToKind( + checkComputedPropertyName(name), + 296 + /* TypeFlags.NumberLike */ + ); + } + function checkComputedPropertyName(node) { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + if ((ts6.isTypeLiteralNode(node.parent.parent) || ts6.isClassLike(node.parent.parent) || ts6.isInterfaceDeclaration(node.parent.parent)) && ts6.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 && node.parent.kind !== 174 && node.parent.kind !== 175) { + return links.resolvedType = errorType; + } + links.resolvedType = checkExpression(node.expression); + if (ts6.isPropertyDeclaration(node.parent) && !ts6.hasStaticModifier(node.parent) && ts6.isClassExpression(node.parent.parent)) { + var container = ts6.getEnclosingBlockScopeContainer(node.parent.parent); + var enclosingIterationStatement = getEnclosingIterationStatement(container); + if (enclosingIterationStatement) { + getNodeLinks(enclosingIterationStatement).flags |= 65536; + getNodeLinks(node).flags |= 524288; + getNodeLinks(node.parent.parent).flags |= 524288; + } + } + if (links.resolvedType.flags & 98304 || !isTypeAssignableToKind( + links.resolvedType, + 402653316 | 296 | 12288 + /* TypeFlags.ESSymbolLike */ + ) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) { + error(node, ts6.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + } + return links.resolvedType; + } + function isSymbolWithNumericName(symbol) { + var _a; + var firstDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; + return ts6.isNumericLiteralName(symbol.escapedName) || firstDecl && ts6.isNamedDeclaration(firstDecl) && isNumericName(firstDecl.name); + } + function isSymbolWithSymbolName(symbol) { + var _a; + var firstDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; + return ts6.isKnownSymbol(symbol) || firstDecl && ts6.isNamedDeclaration(firstDecl) && ts6.isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind( + checkComputedPropertyName(firstDecl.name), + 4096 + /* TypeFlags.ESSymbol */ + ); + } + function getObjectLiteralIndexInfo(node, offset, properties, keyType) { + var propTypes = []; + for (var i = offset; i < properties.length; i++) { + var prop = properties[i]; + if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) { + propTypes.push(getTypeOfSymbol(properties[i])); + } + } + var unionType = propTypes.length ? getUnionType( + propTypes, + 2 + /* UnionReduction.Subtype */ + ) : undefinedType; + return createIndexInfo(keyType, unionType, isConstContext(node)); + } + function getImmediateAliasedSymbol(symbol) { + ts6.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + var node = getDeclarationOfAliasSymbol(symbol); + if (!node) + return ts6.Debug.fail(); + links.immediateTarget = getTargetOfAliasDeclaration( + node, + /*dontRecursivelyResolve*/ + true + ); + } + return links.immediateTarget; + } + function checkObjectLiteral(node, checkMode) { + var inDestructuringPattern = ts6.isAssignmentTarget(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); + var allPropertiesTable = strictNullChecks ? ts6.createSymbolTable() : void 0; + var propertiesTable = ts6.createSymbolTable(); + var propertiesArray = []; + var spread = emptyObjectType; + var contextualType = getApparentTypeOfContextualType( + node, + /*contextFlags*/ + void 0 + ); + var contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 203 || contextualType.pattern.kind === 207); + var inConstContext = isConstContext(node); + var checkFlags = inConstContext ? 8 : 0; + var isInJavascript = ts6.isInJSFile(node) && !ts6.isInJsonFile(node); + var enumTag = ts6.getJSDocEnumTag(node); + var isJSObjectLiteral = !contextualType && isInJavascript && !enumTag; + var objectFlags = freshObjectLiteralFlag; + var patternWithComputedProperties = false; + var hasComputedStringProperty = false; + var hasComputedNumberProperty = false; + var hasComputedSymbolProperty = false; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var elem = _a[_i]; + if (elem.name && ts6.isComputedPropertyName(elem.name)) { + checkComputedPropertyName(elem.name); + } + } + var offset = 0; + for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { + var memberDecl = _c[_b]; + var member = getSymbolOfNode(memberDecl); + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 ? checkComputedPropertyName(memberDecl.name) : void 0; + if (memberDecl.kind === 299 || memberDecl.kind === 300 || ts6.isObjectLiteralMethod(memberDecl)) { + var type = memberDecl.kind === 299 ? checkPropertyAssignment(memberDecl, checkMode) : ( + // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring + // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. + // we don't want to say "could not find 'a'". + memberDecl.kind === 300 ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode) + ); + if (isInJavascript) { + var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); + if (jsDocType) { + checkTypeAssignableTo(type, jsDocType, memberDecl); + type = jsDocType; + } else if (enumTag && enumTag.typeExpression) { + checkTypeAssignableTo(type, getTypeFromTypeNode(enumTag.typeExpression), memberDecl); + } + } + objectFlags |= ts6.getObjectFlags(type) & 458752; + var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0; + var prop = nameType ? createSymbol( + 4 | member.flags, + getPropertyNameFromType(nameType), + checkFlags | 4096 + /* CheckFlags.Late */ + ) : createSymbol(4 | member.flags, member.escapedName, checkFlags); + if (nameType) { + prop.nameType = nameType; + } + if (inDestructuringPattern) { + var isOptional = memberDecl.kind === 299 && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 300 && memberDecl.objectAssignmentInitializer; + if (isOptional) { + prop.flags |= 16777216; + } + } else if (contextualTypeHasPattern && !(ts6.getObjectFlags(contextualType) & 512)) { + var impliedProp = getPropertyOfType(contextualType, member.escapedName); + if (impliedProp) { + prop.flags |= impliedProp.flags & 16777216; + } else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) { + error(memberDecl.name, ts6.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + prop.type = type; + prop.target = member; + member = prop; + allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); + if (contextualType && checkMode && checkMode & 2 && !(checkMode & 4) && (memberDecl.kind === 299 || memberDecl.kind === 171) && isContextSensitive(memberDecl)) { + var inferenceContext = getInferenceContext(node); + ts6.Debug.assert(inferenceContext); + var inferenceNode = memberDecl.kind === 299 ? memberDecl.initializer : memberDecl; + addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); + } + } else if (memberDecl.kind === 301) { + if (languageVersion < 2) { + checkExternalEmitHelpers( + memberDecl, + 2 + /* ExternalEmitHelpers.Assign */ + ); + } + if (propertiesArray.length > 0) { + spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext); + propertiesArray = []; + propertiesTable = ts6.createSymbolTable(); + hasComputedStringProperty = false; + hasComputedNumberProperty = false; + hasComputedSymbolProperty = false; + } + var type = getReducedType(checkExpression(memberDecl.expression)); + if (isValidSpreadType(type)) { + var mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext); + if (allPropertiesTable) { + checkSpreadPropOverrides(mergedType, allPropertiesTable, memberDecl); + } + offset = propertiesArray.length; + if (isErrorType(spread)) { + continue; + } + spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext); + } else { + error(memberDecl, ts6.Diagnostics.Spread_types_may_only_be_created_from_object_types); + spread = errorType; + } + continue; + } else { + ts6.Debug.assert( + memberDecl.kind === 174 || memberDecl.kind === 175 + /* SyntaxKind.SetAccessor */ + ); + checkNodeDeferred(memberDecl); + } + if (computedNameType && !(computedNameType.flags & 8576)) { + if (isTypeAssignableTo(computedNameType, stringNumberSymbolType)) { + if (isTypeAssignableTo(computedNameType, numberType)) { + hasComputedNumberProperty = true; + } else if (isTypeAssignableTo(computedNameType, esSymbolType)) { + hasComputedSymbolProperty = true; + } else { + hasComputedStringProperty = true; + } + if (inDestructuringPattern) { + patternWithComputedProperties = true; + } + } + } else { + propertiesTable.set(member.escapedName, member); + } + propertiesArray.push(member); + } + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts6.findAncestor(contextualType.pattern.parent, function(n) { + return n.kind === 257 || n.kind === 223 || n.kind === 166; + }); + var spreadOrOutsideRootObject = ts6.findAncestor(node, function(n) { + return n === rootPatternParent_1 || n.kind === 301; + }); + if (spreadOrOutsideRootObject.kind !== 301) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216)) { + error(prop.valueDeclaration || prop.bindingElement, ts6.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); + } + } + } + } + if (isErrorType(spread)) { + return errorType; + } + if (spread !== emptyObjectType) { + if (propertiesArray.length > 0) { + spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext); + propertiesArray = []; + propertiesTable = ts6.createSymbolTable(); + hasComputedStringProperty = false; + hasComputedNumberProperty = false; + } + return mapType(spread, function(t) { + return t === emptyObjectType ? createObjectLiteralType() : t; + }); + } + return createObjectLiteralType(); + function createObjectLiteralType() { + var indexInfos = []; + if (hasComputedStringProperty) + indexInfos.push(getObjectLiteralIndexInfo(node, offset, propertiesArray, stringType)); + if (hasComputedNumberProperty) + indexInfos.push(getObjectLiteralIndexInfo(node, offset, propertiesArray, numberType)); + if (hasComputedSymbolProperty) + indexInfos.push(getObjectLiteralIndexInfo(node, offset, propertiesArray, esSymbolType)); + var result = createAnonymousType(node.symbol, propertiesTable, ts6.emptyArray, ts6.emptyArray, indexInfos); + result.objectFlags |= objectFlags | 128 | 131072; + if (isJSObjectLiteral) { + result.objectFlags |= 4096; + } + if (patternWithComputedProperties) { + result.objectFlags |= 512; + } + if (inDestructuringPattern) { + result.pattern = node; + } + return result; + } + } + function isValidSpreadType(type) { + var t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType)); + return !!(t.flags & (1 | 67108864 | 524288 | 58982400) || t.flags & 3145728 && ts6.every(t.types, isValidSpreadType)); + } + function checkJsxSelfClosingElementDeferred(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node); + } + function checkJsxSelfClosingElement(node, _checkMode) { + checkNodeDeferred(node); + return getJsxElementTypeAt(node) || anyType; + } + function checkJsxElementDeferred(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); + } else { + checkExpression(node.closingElement.tagName); + } + checkJsxChildren(node); + } + function checkJsxElement(node, _checkMode) { + checkNodeDeferred(node); + return getJsxElementTypeAt(node) || anyType; + } + function checkJsxFragment(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); + var nodeSourceFile = ts6.getSourceFileOfNode(node); + if (ts6.getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) { + error(node, compilerOptions.jsxFactory ? ts6.Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : ts6.Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments); + } + checkJsxChildren(node); + return getJsxElementTypeAt(node) || anyType; + } + function isHyphenatedJsxName(name) { + return ts6.stringContains(name, "-"); + } + function isJsxIntrinsicIdentifier(tagName) { + return tagName.kind === 79 && ts6.isIntrinsicJsxName(tagName.escapedText); + } + function checkJsxAttribute(node, checkMode) { + return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType; + } + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { + var attributes = openingLikeElement.attributes; + var attributesType = getContextualType( + attributes, + 0 + /* ContextFlags.None */ + ); + var allAttributesTable = strictNullChecks ? ts6.createSymbolTable() : void 0; + var attributesTable = ts6.createSymbolTable(); + var spread = emptyJsxObjectType; + var hasSpreadAnyType = false; + var typeToIntersect; + var explicitlySpecifyChildrenAttribute = false; + var objectFlags = 2048; + var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(openingLikeElement)); + for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { + var attributeDecl = _a[_i]; + var member = attributeDecl.symbol; + if (ts6.isJsxAttribute(attributeDecl)) { + var exprType = checkJsxAttribute(attributeDecl, checkMode); + objectFlags |= ts6.getObjectFlags(exprType) & 458752; + var attributeSymbol = createSymbol(4 | member.flags, member.escapedName); + attributeSymbol.declarations = member.declarations; + attributeSymbol.parent = member.parent; + if (member.valueDeclaration) { + attributeSymbol.valueDeclaration = member.valueDeclaration; + } + attributeSymbol.type = exprType; + attributeSymbol.target = member; + attributesTable.set(attributeSymbol.escapedName, attributeSymbol); + allAttributesTable === null || allAttributesTable === void 0 ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol); + if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { + explicitlySpecifyChildrenAttribute = true; + } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } + } else { + ts6.Debug.assert( + attributeDecl.kind === 290 + /* SyntaxKind.JsxSpreadAttribute */ + ); + if (attributesTable.size > 0) { + spread = getSpreadType( + spread, + createJsxAttributesType(), + attributes.symbol, + objectFlags, + /*readonly*/ + false + ); + attributesTable = ts6.createSymbolTable(); + } + var exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode)); + if (isTypeAny(exprType)) { + hasSpreadAnyType = true; + } + if (isValidSpreadType(exprType)) { + spread = getSpreadType( + spread, + exprType, + attributes.symbol, + objectFlags, + /*readonly*/ + false + ); + if (allAttributesTable) { + checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl); + } + } else { + error(attributeDecl.expression, ts6.Diagnostics.Spread_types_may_only_be_created_from_object_types); + typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; + } + } + } + if (!hasSpreadAnyType) { + if (attributesTable.size > 0) { + spread = getSpreadType( + spread, + createJsxAttributesType(), + attributes.symbol, + objectFlags, + /*readonly*/ + false + ); + } + } + var parent = openingLikeElement.parent.kind === 281 ? openingLikeElement.parent : void 0; + if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { + var childrenTypes = checkJsxChildren(parent, checkMode); + if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { + if (explicitlySpecifyChildrenAttribute) { + error(attributes, ts6.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts6.unescapeLeadingUnderscores(jsxChildrenPropertyName)); + } + var contextualType = getApparentTypeOfContextualType( + openingLikeElement.attributes, + /*contextFlags*/ + void 0 + ); + var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName); + var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName); + childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes)); + childrenPropSymbol.valueDeclaration = ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + ts6.unescapeLeadingUnderscores(jsxChildrenPropertyName), + /*questionToken*/ + void 0, + /*type*/ + void 0 + ); + ts6.setParent(childrenPropSymbol.valueDeclaration, attributes); + childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol; + var childPropMap = ts6.createSymbolTable(); + childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol); + spread = getSpreadType( + spread, + createAnonymousType(attributes.symbol, childPropMap, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray), + attributes.symbol, + objectFlags, + /*readonly*/ + false + ); + } + } + if (hasSpreadAnyType) { + return anyType; + } + if (typeToIntersect && spread !== emptyJsxObjectType) { + return getIntersectionType([typeToIntersect, spread]); + } + return typeToIntersect || (spread === emptyJsxObjectType ? createJsxAttributesType() : spread); + function createJsxAttributesType() { + objectFlags |= freshObjectLiteralFlag; + var result = createAnonymousType(attributes.symbol, attributesTable, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + result.objectFlags |= objectFlags | 128 | 131072; + return result; + } + } + function checkJsxChildren(node, checkMode) { + var childrenTypes = []; + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + if (child.kind === 11) { + if (!child.containsOnlyTriviaWhiteSpaces) { + childrenTypes.push(stringType); + } + } else if (child.kind === 291 && !child.expression) { + continue; + } else { + childrenTypes.push(checkExpressionForMutableLocation(child, checkMode)); + } + } + return childrenTypes; + } + function checkSpreadPropOverrides(type, props, spread) { + for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { + var right = _a[_i]; + if (!(right.flags & 16777216)) { + var left = props.get(right.escapedName); + if (left) { + var diagnostic = error(left.valueDeclaration, ts6.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts6.unescapeLeadingUnderscores(left.escapedName)); + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(spread, ts6.Diagnostics.This_spread_always_overwrites_this_property)); + } + } + } + } + function checkJsxAttributes(node, checkMode) { + return createJsxAttributesTypeFromAttributesProperty(node.parent, checkMode); + } + function getJsxType(name, location) { + var namespace = getJsxNamespaceAt(location); + var exports2 = namespace && getExportsOfSymbol(namespace); + var typeSymbol = exports2 && getSymbol( + exports2, + name, + 788968 + /* SymbolFlags.Type */ + ); + return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType; + } + function getIntrinsicTagSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node); + if (!isErrorType(intrinsicElementsType)) { + if (!ts6.isIdentifier(node.tagName)) + return ts6.Debug.fail(); + var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.escapedText); + if (intrinsicProp) { + links.jsxFlags |= 1; + return links.resolvedSymbol = intrinsicProp; + } + var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, stringType); + if (indexSignatureType) { + links.jsxFlags |= 2; + return links.resolvedSymbol = intrinsicElementsType.symbol; + } + error(node, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, ts6.idText(node.tagName), "JSX." + JsxNames.IntrinsicElements); + return links.resolvedSymbol = unknownSymbol; + } else { + if (noImplicitAny) { + error(node, ts6.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, ts6.unescapeLeadingUnderscores(JsxNames.IntrinsicElements)); + } + return links.resolvedSymbol = unknownSymbol; + } + } + return links.resolvedSymbol; + } + function getJsxNamespaceContainerForImplicitImport(location) { + var file = location && ts6.getSourceFileOfNode(location); + var links = file && getNodeLinks(file); + if (links && links.jsxImplicitImportContainer === false) { + return void 0; + } + if (links && links.jsxImplicitImportContainer) { + return links.jsxImplicitImportContainer; + } + var runtimeImportSpecifier = ts6.getJSXRuntimeImport(ts6.getJSXImplicitImportBase(compilerOptions, file), compilerOptions); + if (!runtimeImportSpecifier) { + return void 0; + } + var isClassic = ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Classic; + var errorMessage = isClassic ? ts6.Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option : ts6.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; + var mod = resolveExternalModule(location, runtimeImportSpecifier, errorMessage, location); + var result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0; + if (links) { + links.jsxImplicitImportContainer = result || false; + } + return result; + } + function getJsxNamespaceAt(location) { + var links = location && getNodeLinks(location); + if (links && links.jsxNamespace) { + return links.jsxNamespace; + } + if (!links || links.jsxNamespace !== false) { + var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location); + if (!resolvedNamespace || resolvedNamespace === unknownSymbol) { + var namespaceName = getJsxNamespace(location); + resolvedNamespace = resolveName( + location, + namespaceName, + 1920, + /*diagnosticMessage*/ + void 0, + namespaceName, + /*isUse*/ + false + ); + } + if (resolvedNamespace) { + var candidate = resolveSymbol(getSymbol( + getExportsOfSymbol(resolveSymbol(resolvedNamespace)), + JsxNames.JSX, + 1920 + /* SymbolFlags.Namespace */ + )); + if (candidate && candidate !== unknownSymbol) { + if (links) { + links.jsxNamespace = candidate; + } + return candidate; + } + } + if (links) { + links.jsxNamespace = false; + } + } + var s = resolveSymbol(getGlobalSymbol( + JsxNames.JSX, + 1920, + /*diagnosticMessage*/ + void 0 + )); + if (s === unknownSymbol) { + return void 0; + } + return s; + } + function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) { + var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol( + jsxNamespace.exports, + nameOfAttribPropContainer, + 788968 + /* SymbolFlags.Type */ + ); + var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym); + var propertiesOfJsxElementAttribPropInterface = jsxElementAttribPropInterfaceType && getPropertiesOfType(jsxElementAttribPropInterfaceType); + if (propertiesOfJsxElementAttribPropInterface) { + if (propertiesOfJsxElementAttribPropInterface.length === 0) { + return ""; + } else if (propertiesOfJsxElementAttribPropInterface.length === 1) { + return propertiesOfJsxElementAttribPropInterface[0].escapedName; + } else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) { + error(jsxElementAttribPropInterfaceSym.declarations[0], ts6.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, ts6.unescapeLeadingUnderscores(nameOfAttribPropContainer)); + } + } + return void 0; + } + function getJsxLibraryManagedAttributes(jsxNamespace) { + return jsxNamespace && getSymbol( + jsxNamespace.exports, + JsxNames.LibraryManagedAttributes, + 788968 + /* SymbolFlags.Type */ + ); + } + function getJsxElementPropertiesName(jsxNamespace) { + return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace); + } + function getJsxElementChildrenPropertyName(jsxNamespace) { + return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace); + } + function getUninstantiatedJsxSignaturesOfType(elementType, caller) { + if (elementType.flags & 4) { + return [anySignature]; + } else if (elementType.flags & 128) { + var intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller); + if (!intrinsicType) { + error(caller, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements); + return ts6.emptyArray; + } else { + var fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType); + return [fakeSignature]; + } + } + var apparentElemType = getApparentType(elementType); + var signatures = getSignaturesOfType( + apparentElemType, + 1 + /* SignatureKind.Construct */ + ); + if (signatures.length === 0) { + signatures = getSignaturesOfType( + apparentElemType, + 0 + /* SignatureKind.Call */ + ); + } + if (signatures.length === 0 && apparentElemType.flags & 1048576) { + signatures = getUnionSignatures(ts6.map(apparentElemType.types, function(t) { + return getUninstantiatedJsxSignaturesOfType(t, caller); + })); + } + return signatures; + } + function getIntrinsicAttributesTypeFromStringLiteralType(type, location) { + var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, location); + if (!isErrorType(intrinsicElementsType)) { + var stringLiteralTypeName = type.value; + var intrinsicProp = getPropertyOfType(intrinsicElementsType, ts6.escapeLeadingUnderscores(stringLiteralTypeName)); + if (intrinsicProp) { + return getTypeOfSymbol(intrinsicProp); + } + var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, stringType); + if (indexSignatureType) { + return indexSignatureType; + } + return void 0; + } + return anyType; + } + function checkJsxReturnAssignableToAppropriateBound(refKind, elemInstanceType, openingLikeElement) { + if (refKind === 1) { + var sfcReturnConstraint = getJsxStatelessElementTypeAt(openingLikeElement); + if (sfcReturnConstraint) { + checkTypeRelatedTo(elemInstanceType, sfcReturnConstraint, assignableRelation, openingLikeElement.tagName, ts6.Diagnostics.Its_return_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain); + } + } else if (refKind === 0) { + var classConstraint = getJsxElementClassTypeAt(openingLikeElement); + if (classConstraint) { + checkTypeRelatedTo(elemInstanceType, classConstraint, assignableRelation, openingLikeElement.tagName, ts6.Diagnostics.Its_instance_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain); + } + } else { + var sfcReturnConstraint = getJsxStatelessElementTypeAt(openingLikeElement); + var classConstraint = getJsxElementClassTypeAt(openingLikeElement); + if (!sfcReturnConstraint || !classConstraint) { + return; + } + var combined = getUnionType([sfcReturnConstraint, classConstraint]); + checkTypeRelatedTo(elemInstanceType, combined, assignableRelation, openingLikeElement.tagName, ts6.Diagnostics.Its_element_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain); + } + function generateInitialErrorChain() { + var componentName = ts6.getTextOfNode(openingLikeElement.tagName); + return ts6.chainDiagnosticMessages( + /* details */ + void 0, + ts6.Diagnostics._0_cannot_be_used_as_a_JSX_component, + componentName + ); + } + } + function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { + ts6.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); + var links = getNodeLinks(node); + if (!links.resolvedJsxElementAttributesType) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) || errorType; + } else if (links.jsxFlags & 2) { + return links.resolvedJsxElementAttributesType = getIndexTypeOfType(getJsxType(JsxNames.IntrinsicElements, node), stringType) || errorType; + } else { + return links.resolvedJsxElementAttributesType = errorType; + } + } + return links.resolvedJsxElementAttributesType; + } + function getJsxElementClassTypeAt(location) { + var type = getJsxType(JsxNames.ElementClass, location); + if (isErrorType(type)) + return void 0; + return type; + } + function getJsxElementTypeAt(location) { + return getJsxType(JsxNames.Element, location); + } + function getJsxStatelessElementTypeAt(location) { + var jsxElementType = getJsxElementTypeAt(location); + if (jsxElementType) { + return getUnionType([jsxElementType, nullType]); + } + } + function getJsxIntrinsicTagNamesAt(location) { + var intrinsics = getJsxType(JsxNames.IntrinsicElements, location); + return intrinsics ? getPropertiesOfType(intrinsics) : ts6.emptyArray; + } + function checkJsxPreconditions(errorNode) { + if ((compilerOptions.jsx || 0) === 0) { + error(errorNode, ts6.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); + } + if (getJsxElementTypeAt(errorNode) === void 0) { + if (noImplicitAny) { + error(errorNode, ts6.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); + } + } + } + function checkJsxOpeningLikeElementOrOpeningFragment(node) { + var isNodeOpeningLikeElement = ts6.isJsxOpeningLikeElement(node); + if (isNodeOpeningLikeElement) { + checkGrammarJsxElement(node); + } + checkJsxPreconditions(node); + if (!getJsxNamespaceContainerForImplicitImport(node)) { + var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 ? ts6.Diagnostics.Cannot_find_name_0 : void 0; + var jsxFactoryNamespace = getJsxNamespace(node); + var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node; + var jsxFactorySym = void 0; + if (!(ts6.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) { + jsxFactorySym = resolveName( + jsxFactoryLocation, + jsxFactoryNamespace, + 111551, + jsxFactoryRefErr, + jsxFactoryNamespace, + /*isUse*/ + true + ); + } + if (jsxFactorySym) { + jsxFactorySym.isReferenced = 67108863; + if (jsxFactorySym.flags & 2097152 && !getTypeOnlyAliasDeclaration(jsxFactorySym)) { + markAliasSymbolAsReferenced(jsxFactorySym); + } + } + if (ts6.isJsxOpeningFragment(node)) { + var file = ts6.getSourceFileOfNode(node); + var localJsxNamespace = getLocalJsxNamespace(file); + if (localJsxNamespace) { + resolveName( + jsxFactoryLocation, + localJsxNamespace, + 111551, + jsxFactoryRefErr, + localJsxNamespace, + /*isUse*/ + true + ); + } + } + } + if (isNodeOpeningLikeElement) { + var jsxOpeningLikeNode = node; + var sig = getResolvedSignature(jsxOpeningLikeNode); + checkDeprecatedSignature(sig, node); + checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode); + } + } + function isKnownProperty(targetType, name, isComparingJsxAttributes) { + if (targetType.flags & 524288) { + if (getPropertyOfObjectType(targetType, name) || getApplicableIndexInfoForName(targetType, name) || isLateBoundName(name) && getIndexInfoOfType(targetType, stringType) || isComparingJsxAttributes && isHyphenatedJsxName(name)) { + return true; + } + } else if (targetType.flags & 3145728 && isExcessPropertyCheckTarget(targetType)) { + for (var _i = 0, _a = targetType.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name, isComparingJsxAttributes)) { + return true; + } + } + } + return false; + } + function isExcessPropertyCheckTarget(type) { + return !!(type.flags & 524288 && !(ts6.getObjectFlags(type) & 512) || type.flags & 67108864 || type.flags & 1048576 && ts6.some(type.types, isExcessPropertyCheckTarget) || type.flags & 2097152 && ts6.every(type.types, isExcessPropertyCheckTarget)); + } + function checkJsxExpression(node, checkMode) { + checkGrammarJsxExpression(node); + if (node.expression) { + var type = checkExpression(node.expression, checkMode); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts6.Diagnostics.JSX_spread_child_must_be_an_array_type); + } + return type; + } else { + return errorType; + } + } + function getDeclarationNodeFlagsFromSymbol(s) { + return s.valueDeclaration ? ts6.getCombinedNodeFlags(s.valueDeclaration) : 0; + } + function isPrototypeProperty(symbol) { + if (symbol.flags & 8192 || ts6.getCheckFlags(symbol) & 4) { + return true; + } + if (ts6.isInJSFile(symbol.valueDeclaration)) { + var parent = symbol.valueDeclaration.parent; + return parent && ts6.isBinaryExpression(parent) && ts6.getAssignmentDeclarationKind(parent) === 3; + } + } + function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { + if (reportError === void 0) { + reportError = true; + } + var errorNode = !reportError ? void 0 : node.kind === 163 ? node.right : node.kind === 202 ? node : node.kind === 205 && node.propertyName ? node.propertyName : node.name; + return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); + } + function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) { + var flags = ts6.getDeclarationModifierFlagsFromSymbol(prop, writing); + if (isSuper) { + if (languageVersion < 2) { + if (symbolHasNonMethodDeclaration(prop)) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + } + return false; + } + } + if (flags & 256) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); + } + return false; + } + } + if (flags & 256 && symbolHasNonMethodDeclaration(prop) && (ts6.isThisProperty(location) || ts6.isThisInitializedObjectBindingExpression(location) || ts6.isObjectBindingPattern(location.parent) && ts6.isThisInitializedDeclaration(location.parent.parent))) { + var declaringClassDeclaration = ts6.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), ts6.getTextOfIdentifierOrLiteral(declaringClassDeclaration.name)); + } + return false; + } + } + if (!(flags & 24)) { + return true; + } + if (flags & 8) { + var declaringClassDeclaration = ts6.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(location, declaringClassDeclaration)) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))); + } + return false; + } + return true; + } + if (isSuper) { + return true; + } + var enclosingClass = forEachEnclosingClass(location, function(enclosingDeclaration) { + var enclosingClass2 = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return isClassDerivedFromDeclaringClasses(enclosingClass2, prop, writing); + }); + if (!enclosingClass) { + enclosingClass = getEnclosingClassFromThisParameter(location); + enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing); + if (flags & 32 || !enclosingClass) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType)); + } + return false; + } + } + if (flags & 32) { + return true; + } + if (containingType.flags & 262144) { + containingType = containingType.isThisType ? getConstraintOfTypeParameter(containingType) : getBaseConstraintOfType(containingType); + } + if (!containingType || !hasBaseType(containingType, enclosingClass)) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2, symbolToString(prop), typeToString(enclosingClass), typeToString(containingType)); + } + return false; + } + return true; + } + function getEnclosingClassFromThisParameter(node) { + var thisParameter = getThisParameterFromNodeContext(node); + var thisType = (thisParameter === null || thisParameter === void 0 ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type); + if (thisType && thisType.flags & 262144) { + thisType = getConstraintOfTypeParameter(thisType); + } + if (thisType && ts6.getObjectFlags(thisType) & (3 | 4)) { + return getTargetType(thisType); + } + return void 0; + } + function getThisParameterFromNodeContext(node) { + var thisContainer = ts6.getThisContainer( + node, + /* includeArrowFunctions */ + false + ); + return thisContainer && ts6.isFunctionLike(thisContainer) ? ts6.getThisParameter(thisContainer) : void 0; + } + function symbolHasNonMethodDeclaration(symbol) { + return !!forEachProperty(symbol, function(prop) { + return !(prop.flags & 8192); + }); + } + function checkNonNullExpression(node) { + return checkNonNullType(checkExpression(node), node); + } + function isNullableType(type) { + return !!(getTypeFacts(type) & 50331648); + } + function getNonNullableTypeIfNeeded(type) { + return isNullableType(type) ? getNonNullableType(type) : type; + } + function reportObjectPossiblyNullOrUndefinedError(node, facts) { + var nodeText = ts6.isEntityNameExpression(node) ? ts6.entityNameToString(node) : void 0; + if (node.kind === 104) { + error(node, ts6.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== void 0 && nodeText.length < 100) { + if (ts6.isIdentifier(node) && nodeText === "undefined") { + error(node, ts6.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 ? facts & 33554432 ? ts6.Diagnostics._0_is_possibly_null_or_undefined : ts6.Diagnostics._0_is_possibly_undefined : ts6.Diagnostics._0_is_possibly_null, nodeText); + } else { + error(node, facts & 16777216 ? facts & 33554432 ? ts6.Diagnostics.Object_is_possibly_null_or_undefined : ts6.Diagnostics.Object_is_possibly_undefined : ts6.Diagnostics.Object_is_possibly_null); + } + } + function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { + error(node, facts & 16777216 ? facts & 33554432 ? ts6.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined : ts6.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined : ts6.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null); + } + function checkNonNullTypeWithReporter(type, node, reportError) { + if (strictNullChecks && type.flags & 2) { + if (ts6.isEntityNameExpression(node)) { + var nodeText = ts6.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts6.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } + error(node, ts6.Diagnostics.Object_is_of_type_unknown); + return errorType; + } + var facts = getTypeFacts(type); + if (facts & 50331648) { + reportError(node, facts); + var t = getNonNullableType(type); + return t.flags & (98304 | 131072) ? errorType : t; + } + return type; + } + function checkNonNullType(type, node) { + return checkNonNullTypeWithReporter(type, node, reportObjectPossiblyNullOrUndefinedError); + } + function checkNonNullNonVoidType(type, node) { + var nonNullType = checkNonNullType(type, node); + if (nonNullType.flags & 16384) { + if (ts6.isEntityNameExpression(node)) { + var nodeText = ts6.entityNameToString(node); + if (ts6.isIdentifier(node) && nodeText === "undefined") { + error(node, ts6.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts6.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } + error(node, ts6.Diagnostics.Object_is_possibly_undefined); + } + return nonNullType; + } + function checkPropertyAccessExpression(node, checkMode) { + return node.flags & 32 ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode); + } + function checkPropertyAccessChain(node, checkMode) { + var leftType = checkExpression(node.expression); + var nonOptionalType = getOptionalExpressionType(leftType, node.expression); + return propagateOptionalTypeMarker(checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullType(nonOptionalType, node.expression), node.name, checkMode), node, nonOptionalType !== leftType); + } + function checkQualifiedName(node, checkMode) { + var leftType = ts6.isPartOfTypeQuery(node) && ts6.isThisIdentifier(node.left) ? checkNonNullType(checkThisExpression(node.left), node.left) : checkNonNullExpression(node.left); + return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); + } + function isMethodAccessForCall(node) { + while (node.parent.kind === 214) { + node = node.parent; + } + return ts6.isCallOrNewExpression(node.parent) && node.parent.expression === node; + } + function lookupSymbolForPrivateIdentifierDeclaration(propName, location) { + for (var containingClass = ts6.getContainingClass(location); !!containingClass; containingClass = ts6.getContainingClass(containingClass)) { + var symbol = containingClass.symbol; + var name = ts6.getSymbolNameForPrivateIdentifier(symbol, propName); + var prop = symbol.members && symbol.members.get(name) || symbol.exports && symbol.exports.get(name); + if (prop) { + return prop; + } + } + } + function checkGrammarPrivateIdentifierExpression(privId) { + if (!ts6.getContainingClass(privId)) { + return grammarErrorOnNode(privId, ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + } + if (!ts6.isForInStatement(privId.parent)) { + if (!ts6.isExpressionNode(privId)) { + return grammarErrorOnNode(privId, ts6.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression); + } + var isInOperation = ts6.isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101; + if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) { + return grammarErrorOnNode(privId, ts6.Diagnostics.Cannot_find_name_0, ts6.idText(privId)); + } + } + return false; + } + function checkPrivateIdentifierExpression(privId) { + checkGrammarPrivateIdentifierExpression(privId); + var symbol = getSymbolForPrivateIdentifierExpression(privId); + if (symbol) { + markPropertyAsReferenced( + symbol, + /* nodeForCheckWriteOnly: */ + void 0, + /* isThisAccess: */ + false + ); + } + return anyType; + } + function getSymbolForPrivateIdentifierExpression(privId) { + if (!ts6.isExpressionNode(privId)) { + return void 0; + } + var links = getNodeLinks(privId); + if (links.resolvedSymbol === void 0) { + links.resolvedSymbol = lookupSymbolForPrivateIdentifierDeclaration(privId.escapedText, privId); + } + return links.resolvedSymbol; + } + function getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedIdentifier) { + return getPropertyOfType(leftType, lexicallyScopedIdentifier.escapedName); + } + function checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedIdentifier) { + var propertyOnType; + var properties = getPropertiesOfType(leftType); + if (properties) { + ts6.forEach(properties, function(symbol) { + var decl = symbol.valueDeclaration; + if (decl && ts6.isNamedDeclaration(decl) && ts6.isPrivateIdentifier(decl.name) && decl.name.escapedText === right.escapedText) { + propertyOnType = symbol; + return true; + } + }); + } + var diagName = diagnosticName(right); + if (propertyOnType) { + var typeValueDecl = ts6.Debug.checkDefined(propertyOnType.valueDeclaration); + var typeClass_1 = ts6.Debug.checkDefined(ts6.getContainingClass(typeValueDecl)); + if (lexicallyScopedIdentifier === null || lexicallyScopedIdentifier === void 0 ? void 0 : lexicallyScopedIdentifier.valueDeclaration) { + var lexicalValueDecl = lexicallyScopedIdentifier.valueDeclaration; + var lexicalClass = ts6.getContainingClass(lexicalValueDecl); + ts6.Debug.assert(!!lexicalClass); + if (ts6.findAncestor(lexicalClass, function(n) { + return typeClass_1 === n; + })) { + var diagnostic = error(right, ts6.Diagnostics.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling, diagName, typeToString(leftType)); + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(lexicalValueDecl, ts6.Diagnostics.The_shadowing_declaration_of_0_is_defined_here, diagName), ts6.createDiagnosticForNode(typeValueDecl, ts6.Diagnostics.The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here, diagName)); + return true; + } + } + error(right, ts6.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier, diagName, diagnosticName(typeClass_1.name || anon)); + return true; + } + return false; + } + function isThisPropertyAccessInConstructor(node, prop) { + return (isConstructorDeclaredProperty(prop) || ts6.isThisProperty(node) && isAutoTypedProperty(prop)) && ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + true + ) === getDeclaringConstructor(prop); + } + function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode) { + var parentSymbol = getNodeLinks(left).resolvedSymbol; + var assignmentKind = ts6.getAssignmentTargetKind(node); + var apparentType = getApparentType(assignmentKind !== 0 || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType); + var isAnyLike = isTypeAny(apparentType) || apparentType === silentNeverType; + var prop; + if (ts6.isPrivateIdentifier(right)) { + if (languageVersion < 99) { + if (assignmentKind !== 0) { + checkExternalEmitHelpers( + node, + 1048576 + /* ExternalEmitHelpers.ClassPrivateFieldSet */ + ); + } + if (assignmentKind !== 1) { + checkExternalEmitHelpers( + node, + 524288 + /* ExternalEmitHelpers.ClassPrivateFieldGet */ + ); + } + } + var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right); + if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts6.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) { + grammarErrorOnNode(right, ts6.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts6.idText(right)); + } + if (isAnyLike) { + if (lexicallyScopedSymbol) { + return isErrorType(apparentType) ? errorType : apparentType; + } + if (!ts6.getContainingClass(right)) { + grammarErrorOnNode(right, ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + return anyType; + } + } + prop = lexicallyScopedSymbol ? getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol) : void 0; + if (!prop && checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) { + return errorType; + } else { + var isSetonlyAccessor = prop && prop.flags & 65536 && !(prop.flags & 32768); + if (isSetonlyAccessor && assignmentKind !== 1) { + error(node, ts6.Diagnostics.Private_accessor_was_defined_without_a_getter); + } + } + } else { + if (isAnyLike) { + if (ts6.isIdentifier(left) && parentSymbol) { + markAliasReferenced(parentSymbol, node); + } + return isErrorType(apparentType) ? errorType : apparentType; + } + prop = getPropertyOfType( + apparentType, + right.escapedText, + /*skipObjectFunctionPropertyAugment*/ + false, + /*includeTypeOnlyMembers*/ + node.kind === 163 + /* SyntaxKind.QualifiedName */ + ); + } + if (ts6.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 && node.parent.kind === 302)) || ts6.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { + markAliasReferenced(parentSymbol, node); + } + var propType; + if (!prop) { + var indexInfo = !ts6.isPrivateIdentifier(right) && (assignmentKind === 0 || !isGenericObjectType(leftType) || ts6.isThisTypeParameter(leftType)) ? getApplicableIndexInfoForName(apparentType, right.escapedText) : void 0; + if (!(indexInfo && indexInfo.type)) { + var isUncheckedJS = isUncheckedJSSuggestion( + node, + leftType.symbol, + /*excludeClasses*/ + true + ); + if (!isUncheckedJS && isJSLiteralType(leftType)) { + return anyType; + } + if (leftType.symbol === globalThisSymbol) { + if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418) { + error(right, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, ts6.unescapeLeadingUnderscores(right.escapedText), typeToString(leftType)); + } else if (noImplicitAny) { + error(right, ts6.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType)); + } + return anyType; + } + if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) { + reportNonexistentProperty(right, ts6.isThisTypeParameter(leftType) ? apparentType : leftType, isUncheckedJS); + } + return errorType; + } + if (indexInfo.isReadonly && (ts6.isAssignmentTarget(node) || ts6.isDeleteTarget(node))) { + error(node, ts6.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType)); + } + propType = compilerOptions.noUncheckedIndexedAccess && !ts6.isAssignmentTarget(node) ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + if (compilerOptions.noPropertyAccessFromIndexSignature && ts6.isPropertyAccessExpression(node)) { + error(right, ts6.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts6.unescapeLeadingUnderscores(right.escapedText)); + } + if (indexInfo.declaration && ts6.getCombinedNodeFlags(indexInfo.declaration) & 268435456) { + addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText); + } + } else { + if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) { + addDeprecatedSuggestion(right, prop.declarations, right.escapedText); + } + checkPropertyNotUsedBeforeDeclaration(prop, node, right); + markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol)); + getNodeLinks(node).resolvedSymbol = prop; + var writing = ts6.isWriteAccess(node); + checkPropertyAccessibility(node, left.kind === 106, writing, apparentType, prop); + if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) { + error(right, ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts6.idText(right)); + return errorType; + } + propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop); + } + return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode); + } + function isUncheckedJSSuggestion(node, suggestion, excludeClasses) { + var file = ts6.getSourceFileOfNode(node); + if (file) { + if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 || file.scriptKind === 2)) { + var declarationFile = ts6.forEach(suggestion === null || suggestion === void 0 ? void 0 : suggestion.declarations, ts6.getSourceFileOfNode); + return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32) && !(!!node && excludeClasses && ts6.isPropertyAccessExpression(node) && node.expression.kind === 108); + } + } + return false; + } + function getFlowTypeOfAccessExpression(node, prop, propType, errorNode, checkMode) { + var assignmentKind = ts6.getAssignmentTargetKind(node); + if (assignmentKind === 1) { + return removeMissingType(propType, !!(prop && prop.flags & 16777216)); + } + if (prop && !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 1048576) && !isDuplicatedCommonJSExport(prop.declarations)) { + return propType; + } + if (propType === autoType) { + return getFlowTypeOfProperty(node, prop); + } + propType = getNarrowableTypeForReference(propType, node, checkMode); + var assumeUninitialized = false; + if (strictNullChecks && strictPropertyInitialization && ts6.isAccessExpression(node) && node.expression.kind === 108) { + var declaration = prop && prop.valueDeclaration; + if (declaration && isPropertyWithoutInitializer(declaration)) { + if (!ts6.isStatic(declaration)) { + var flowContainer = getControlFlowContainer(node); + if (flowContainer.kind === 173 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) { + assumeUninitialized = true; + } + } + } + } else if (strictNullChecks && prop && prop.valueDeclaration && ts6.isPropertyAccessExpression(prop.valueDeclaration) && ts6.getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration) && getControlFlowContainer(node) === getControlFlowContainer(prop.valueDeclaration)) { + assumeUninitialized = true; + } + var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType); + if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) { + error(errorNode, ts6.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); + return propType; + } + return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; + } + function checkPropertyNotUsedBeforeDeclaration(prop, node, right) { + var valueDeclaration = prop.valueDeclaration; + if (!valueDeclaration || ts6.getSourceFileOfNode(node).isDeclarationFile) { + return; + } + var diagnosticMessage; + var declarationName = ts6.idText(right); + if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(ts6.isAccessExpression(node) && ts6.isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(ts6.isMethodDeclaration(valueDeclaration) && ts6.getCombinedModifierFlags(valueDeclaration) & 32) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { + diagnosticMessage = error(right, ts6.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); + } else if (valueDeclaration.kind === 260 && node.parent.kind !== 180 && !(valueDeclaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { + diagnosticMessage = error(right, ts6.Diagnostics.Class_0_used_before_its_declaration, declarationName); + } + if (diagnosticMessage) { + ts6.addRelatedInfo(diagnosticMessage, ts6.createDiagnosticForNode(valueDeclaration, ts6.Diagnostics._0_is_declared_here, declarationName)); + } + } + function isInPropertyInitializerOrClassStaticBlock(node) { + return !!ts6.findAncestor(node, function(node2) { + switch (node2.kind) { + case 169: + return true; + case 299: + case 171: + case 174: + case 175: + case 301: + case 164: + case 236: + case 291: + case 288: + case 289: + case 290: + case 283: + case 230: + case 294: + return false; + case 216: + case 241: + return ts6.isBlock(node2.parent) && ts6.isClassStaticBlockDeclaration(node2.parent.parent) ? true : "quit"; + default: + return ts6.isExpressionNode(node2) ? false : "quit"; + } + }); + } + function isPropertyDeclaredInAncestorClass(prop) { + if (!(prop.parent.flags & 32)) { + return false; + } + var classType = getTypeOfSymbol(prop.parent); + while (true) { + classType = classType.symbol && getSuperClass(classType); + if (!classType) { + return false; + } + var superProperty = getPropertyOfType(classType, prop.escapedName); + if (superProperty && superProperty.valueDeclaration) { + return true; + } + } + } + function getSuperClass(classType) { + var x = getBaseTypes(classType); + if (x.length === 0) { + return void 0; + } + return getIntersectionType(x); + } + function reportNonexistentProperty(propNode, containingType, isUncheckedJS) { + var errorInfo; + var relatedInfo; + if (!ts6.isPrivateIdentifier(propNode) && containingType.flags & 1048576 && !(containingType.flags & 131068)) { + for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) { + var subtype = _a[_i]; + if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) { + errorInfo = ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, ts6.declarationNameToString(propNode), typeToString(subtype)); + break; + } + } + } + if (typeHasStaticProperty(propNode.escapedText, containingType)) { + var propName = ts6.declarationNameToString(propNode); + var typeName = typeToString(containingType); + errorInfo = ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "." + propName); + } else { + var promisedType = getPromisedTypeOfPromise(containingType); + if (promisedType && getPropertyOfType(promisedType, propNode.escapedText)) { + errorInfo = ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Property_0_does_not_exist_on_type_1, ts6.declarationNameToString(propNode), typeToString(containingType)); + relatedInfo = ts6.createDiagnosticForNode(propNode, ts6.Diagnostics.Did_you_forget_to_use_await); + } else { + var missingProperty = ts6.declarationNameToString(propNode); + var container = typeToString(containingType); + var libSuggestion = getSuggestedLibForNonExistentProperty(missingProperty, containingType); + if (libSuggestion !== void 0) { + errorInfo = ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later, missingProperty, container, libSuggestion); + } else { + var suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType); + if (suggestion !== void 0) { + var suggestedName = ts6.symbolName(suggestion); + var message = isUncheckedJS ? ts6.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2 : ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2; + errorInfo = ts6.chainDiagnosticMessages(errorInfo, message, missingProperty, container, suggestedName); + relatedInfo = suggestion.valueDeclaration && ts6.createDiagnosticForNode(suggestion.valueDeclaration, ts6.Diagnostics._0_is_declared_here, suggestedName); + } else { + var diagnostic = containerSeemsToBeEmptyDomElement(containingType) ? ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom : ts6.Diagnostics.Property_0_does_not_exist_on_type_1; + errorInfo = ts6.chainDiagnosticMessages(elaborateNeverIntersection(errorInfo, containingType), diagnostic, missingProperty, container); + } + } + } + } + var resultDiagnostic = ts6.createDiagnosticForNodeFromMessageChain(propNode, errorInfo); + if (relatedInfo) { + ts6.addRelatedInfo(resultDiagnostic, relatedInfo); + } + addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== ts6.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic); + } + function containerSeemsToBeEmptyDomElement(containingType) { + return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, function(type) { + return type.symbol && /^(EventTarget|Node|((HTML[a-zA-Z]*)?Element))$/.test(ts6.unescapeLeadingUnderscores(type.symbol.escapedName)); + }) && isEmptyObjectType(containingType); + } + function typeHasStaticProperty(propName, containingType) { + var prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName); + return prop !== void 0 && !!prop.valueDeclaration && ts6.isStatic(prop.valueDeclaration); + } + function getSuggestedLibForNonExistentName(name) { + var missingName = diagnosticName(name); + var allFeatures = ts6.getScriptTargetFeatures(); + var libTargets = ts6.getOwnKeys(allFeatures); + for (var _i = 0, libTargets_1 = libTargets; _i < libTargets_1.length; _i++) { + var libTarget = libTargets_1[_i]; + var containingTypes = ts6.getOwnKeys(allFeatures[libTarget]); + if (containingTypes !== void 0 && ts6.contains(containingTypes, missingName)) { + return libTarget; + } + } + } + function getSuggestedLibForNonExistentProperty(missingProperty, containingType) { + var container = getApparentType(containingType).symbol; + if (!container) { + return void 0; + } + var allFeatures = ts6.getScriptTargetFeatures(); + var libTargets = ts6.getOwnKeys(allFeatures); + for (var _i = 0, libTargets_2 = libTargets; _i < libTargets_2.length; _i++) { + var libTarget = libTargets_2[_i]; + var featuresOfLib = allFeatures[libTarget]; + var featuresOfContainingType = featuresOfLib[ts6.symbolName(container)]; + if (featuresOfContainingType !== void 0 && ts6.contains(featuresOfContainingType, missingProperty)) { + return libTarget; + } + } + } + function getSuggestedSymbolForNonexistentClassMember(name, baseType) { + return getSpellingSuggestionForName( + name, + getPropertiesOfType(baseType), + 106500 + /* SymbolFlags.ClassMember */ + ); + } + function getSuggestedSymbolForNonexistentProperty(name, containingType) { + var props = getPropertiesOfType(containingType); + if (typeof name !== "string") { + var parent_3 = name.parent; + if (ts6.isPropertyAccessExpression(parent_3)) { + props = ts6.filter(props, function(prop) { + return isValidPropertyAccessForCompletions(parent_3, containingType, prop); + }); + } + name = ts6.idText(name); + } + return getSpellingSuggestionForName( + name, + props, + 111551 + /* SymbolFlags.Value */ + ); + } + function getSuggestedSymbolForNonexistentJSXAttribute(name, containingType) { + var strName = ts6.isString(name) ? name : ts6.idText(name); + var properties = getPropertiesOfType(containingType); + var jsxSpecific = strName === "for" ? ts6.find(properties, function(x) { + return ts6.symbolName(x) === "htmlFor"; + }) : strName === "class" ? ts6.find(properties, function(x) { + return ts6.symbolName(x) === "className"; + }) : void 0; + return jsxSpecific !== null && jsxSpecific !== void 0 ? jsxSpecific : getSpellingSuggestionForName( + strName, + properties, + 111551 + /* SymbolFlags.Value */ + ); + } + function getSuggestionForNonexistentProperty(name, containingType) { + var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType); + return suggestion && ts6.symbolName(suggestion); + } + function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) { + ts6.Debug.assert(outerName !== void 0, "outername should always be defined"); + var result = resolveNameHelper( + location, + outerName, + meaning, + /*nameNotFoundMessage*/ + void 0, + outerName, + /*isUse*/ + false, + /*excludeGlobals*/ + false, + /*getSpellingSuggestions*/ + true, + function(symbols, name, meaning2) { + ts6.Debug.assertEqual(outerName, name, "name should equal outerName"); + var symbol = getSymbol(symbols, name, meaning2); + if (symbol) + return symbol; + var candidates; + if (symbols === globals) { + var primitives = ts6.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function(s) { + return symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288, s) : void 0; + }); + candidates = primitives.concat(ts6.arrayFrom(symbols.values())); + } else { + candidates = ts6.arrayFrom(symbols.values()); + } + return getSpellingSuggestionForName(ts6.unescapeLeadingUnderscores(name), candidates, meaning2); + } + ); + return result; + } + function getSuggestionForNonexistentSymbol(location, outerName, meaning) { + var symbolResult = getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning); + return symbolResult && ts6.symbolName(symbolResult); + } + function getSuggestedSymbolForNonexistentModule(name, targetModule) { + return targetModule.exports && getSpellingSuggestionForName( + ts6.idText(name), + getExportsOfModuleAsArray(targetModule), + 2623475 + /* SymbolFlags.ModuleMember */ + ); + } + function getSuggestionForNonexistentExport(name, targetModule) { + var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule); + return suggestion && ts6.symbolName(suggestion); + } + function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) { + function hasProp(name) { + var prop = getPropertyOfObjectType(objectType, name); + if (prop) { + var s = getSingleCallSignature(getTypeOfSymbol(prop)); + return !!s && getMinArgumentCount(s) >= 1 && isTypeAssignableTo(keyedType, getTypeAtPosition(s, 0)); + } + return false; + } + var suggestedMethod = ts6.isAssignmentTarget(expr) ? "set" : "get"; + if (!hasProp(suggestedMethod)) { + return void 0; + } + var suggestion = ts6.tryGetPropertyAccessOrIdentifierToString(expr.expression); + if (suggestion === void 0) { + suggestion = suggestedMethod; + } else { + suggestion += "." + suggestedMethod; + } + return suggestion; + } + function getSuggestedTypeForNonexistentStringLiteralType(source, target) { + var candidates = target.types.filter(function(type) { + return !!(type.flags & 128); + }); + return ts6.getSpellingSuggestion(source.value, candidates, function(type) { + return type.value; + }); + } + function getSpellingSuggestionForName(name, symbols, meaning) { + return ts6.getSpellingSuggestion(name, symbols, getCandidateName); + function getCandidateName(candidate) { + var candidateName = ts6.symbolName(candidate); + if (ts6.startsWith(candidateName, '"')) { + return void 0; + } + if (candidate.flags & meaning) { + return candidateName; + } + if (candidate.flags & 2097152) { + var alias = tryResolveAlias(candidate); + if (alias && alias.flags & meaning) { + return candidateName; + } + } + return void 0; + } + } + function markPropertyAsReferenced(prop, nodeForCheckWriteOnly, isSelfTypeAccess2) { + var valueDeclaration = prop && prop.flags & 106500 && prop.valueDeclaration; + if (!valueDeclaration) { + return; + } + var hasPrivateModifier = ts6.hasEffectiveModifier( + valueDeclaration, + 8 + /* ModifierFlags.Private */ + ); + var hasPrivateIdentifier = prop.valueDeclaration && ts6.isNamedDeclaration(prop.valueDeclaration) && ts6.isPrivateIdentifier(prop.valueDeclaration.name); + if (!hasPrivateModifier && !hasPrivateIdentifier) { + return; + } + if (nodeForCheckWriteOnly && ts6.isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & 65536)) { + return; + } + if (isSelfTypeAccess2) { + var containingMethod = ts6.findAncestor(nodeForCheckWriteOnly, ts6.isFunctionLikeDeclaration); + if (containingMethod && containingMethod.symbol === prop) { + return; + } + } + (ts6.getCheckFlags(prop) & 1 ? getSymbolLinks(prop).target : prop).isReferenced = 67108863; + } + function isSelfTypeAccess(name, parent) { + return name.kind === 108 || !!parent && ts6.isEntityNameExpression(name) && parent === getResolvedSymbol(ts6.getFirstIdentifier(name)); + } + function isValidPropertyAccess(node, propertyName) { + switch (node.kind) { + case 208: + return isValidPropertyAccessWithType(node, node.expression.kind === 106, propertyName, getWidenedType(checkExpression(node.expression))); + case 163: + return isValidPropertyAccessWithType( + node, + /*isSuper*/ + false, + propertyName, + getWidenedType(checkExpression(node.left)) + ); + case 202: + return isValidPropertyAccessWithType( + node, + /*isSuper*/ + false, + propertyName, + getTypeFromTypeNode(node) + ); + } + } + function isValidPropertyAccessForCompletions(node, type, property) { + return isPropertyAccessible( + node, + node.kind === 208 && node.expression.kind === 106, + /* isWrite */ + false, + type, + property + ); + } + function isValidPropertyAccessWithType(node, isSuper, propertyName, type) { + if (isTypeAny(type)) { + return true; + } + var prop = getPropertyOfType(type, propertyName); + return !!prop && isPropertyAccessible( + node, + isSuper, + /* isWrite */ + false, + type, + prop + ); + } + function isPropertyAccessible(node, isSuper, isWrite, containingType, property) { + if (isTypeAny(containingType)) { + return true; + } + if (property.valueDeclaration && ts6.isPrivateIdentifierClassElementDeclaration(property.valueDeclaration)) { + var declClass_1 = ts6.getContainingClass(property.valueDeclaration); + return !ts6.isOptionalChain(node) && !!ts6.findAncestor(node, function(parent) { + return parent === declClass_1; + }); + } + return checkPropertyAccessibilityAtLocation(node, isSuper, isWrite, containingType, property); + } + function getForInVariableSymbol(node) { + var initializer = node.initializer; + if (initializer.kind === 258) { + var variable = initializer.declarations[0]; + if (variable && !ts6.isBindingPattern(variable.name)) { + return getSymbolOfNode(variable); + } + } else if (initializer.kind === 79) { + return getResolvedSymbol(initializer); + } + return void 0; + } + function hasNumericPropertyNames(type) { + return getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, numberType); + } + function isForInVariableForNumericPropertyNames(expr) { + var e = ts6.skipParentheses(expr); + if (e.kind === 79) { + var symbol = getResolvedSymbol(e); + if (symbol.flags & 3) { + var child = expr; + var node = expr.parent; + while (node) { + if (node.kind === 246 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { + return true; + } + child = node; + node = node.parent; + } + } + } + return false; + } + function checkIndexedAccess(node, checkMode) { + return node.flags & 32 ? checkElementAccessChain(node, checkMode) : checkElementAccessExpression(node, checkNonNullExpression(node.expression), checkMode); + } + function checkElementAccessChain(node, checkMode) { + var exprType = checkExpression(node.expression); + var nonOptionalType = getOptionalExpressionType(exprType, node.expression); + return propagateOptionalTypeMarker(checkElementAccessExpression(node, checkNonNullType(nonOptionalType, node.expression), checkMode), node, nonOptionalType !== exprType); + } + function checkElementAccessExpression(node, exprType, checkMode) { + var objectType = ts6.getAssignmentTargetKind(node) !== 0 || isMethodAccessForCall(node) ? getWidenedType(exprType) : exprType; + var indexExpression = node.argumentExpression; + var indexType = checkExpression(indexExpression); + if (isErrorType(objectType) || objectType === silentNeverType) { + return objectType; + } + if (isConstEnumObjectType(objectType) && !ts6.isStringLiteralLike(indexExpression)) { + error(indexExpression, ts6.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + return errorType; + } + var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; + var accessFlags = ts6.isAssignmentTarget(node) ? 4 | (isGenericObjectType(objectType) && !ts6.isThisTypeParameter(objectType) ? 2 : 0) : 32; + var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType; + return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); + } + function callLikeExpressionMayHaveTypeArguments(node) { + return ts6.isCallOrNewExpression(node) || ts6.isTaggedTemplateExpression(node) || ts6.isJsxOpeningLikeElement(node); + } + function resolveUntypedCall(node) { + if (callLikeExpressionMayHaveTypeArguments(node)) { + ts6.forEach(node.typeArguments, checkSourceElement); + } + if (node.kind === 212) { + checkExpression(node.template); + } else if (ts6.isJsxOpeningLikeElement(node)) { + checkExpression(node.attributes); + } else if (node.kind !== 167) { + ts6.forEach(node.arguments, function(argument) { + checkExpression(argument); + }); + } + return anySignature; + } + function resolveErrorCall(node) { + resolveUntypedCall(node); + return unknownSignature; + } + function reorderCandidates(signatures, result, callChainFlags) { + var lastParent; + var lastSymbol; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; + ts6.Debug.assert(!result.length); + for (var _i = 0, signatures_7 = signatures; _i < signatures_7.length; _i++) { + var signature = signatures_7[_i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + index = index + 1; + } else { + lastParent = parent; + index = cutoffIndex; + } + } else { + index = cutoffIndex = result.length; + lastParent = parent; + } + lastSymbol = symbol; + if (signatureHasLiteralTypes(signature)) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; + } else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, callChainFlags ? getOptionalCallSignature(signature, callChainFlags) : signature); + } + } + function isSpreadArgument(arg) { + return !!arg && (arg.kind === 227 || arg.kind === 234 && arg.isSpread); + } + function getSpreadArgumentIndex(args) { + return ts6.findIndex(args, isSpreadArgument); + } + function acceptsVoid(t) { + return !!(t.flags & 16384); + } + function acceptsVoidUndefinedUnknownOrAny(t) { + return !!(t.flags & (16384 | 32768 | 2 | 1)); + } + function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) { + if (signatureHelpTrailingComma === void 0) { + signatureHelpTrailingComma = false; + } + var argCount; + var callIsIncomplete = false; + var effectiveParameterCount = getParameterCount(signature); + var effectiveMinimumArguments = getMinArgumentCount(signature); + if (node.kind === 212) { + argCount = args.length; + if (node.template.kind === 225) { + var lastSpan = ts6.last(node.template.templateSpans); + callIsIncomplete = ts6.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; + } else { + var templateLiteral = node.template; + ts6.Debug.assert( + templateLiteral.kind === 14 + /* SyntaxKind.NoSubstitutionTemplateLiteral */ + ); + callIsIncomplete = !!templateLiteral.isUnterminated; + } + } else if (node.kind === 167) { + argCount = getDecoratorArgumentCount(node, signature); + } else if (ts6.isJsxOpeningLikeElement(node)) { + callIsIncomplete = node.attributes.end === node.end; + if (callIsIncomplete) { + return true; + } + argCount = effectiveMinimumArguments === 0 ? args.length : 1; + effectiveParameterCount = args.length === 0 ? effectiveParameterCount : 1; + effectiveMinimumArguments = Math.min(effectiveMinimumArguments, 1); + } else if (!node.arguments) { + ts6.Debug.assert( + node.kind === 211 + /* SyntaxKind.NewExpression */ + ); + return getMinArgumentCount(signature) === 0; + } else { + argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = node.arguments.end === node.end; + var spreadArgIndex = getSpreadArgumentIndex(args); + if (spreadArgIndex >= 0) { + return spreadArgIndex >= getMinArgumentCount(signature) && (hasEffectiveRestParameter(signature) || spreadArgIndex < getParameterCount(signature)); + } + } + if (!hasEffectiveRestParameter(signature) && argCount > effectiveParameterCount) { + return false; + } + if (callIsIncomplete || argCount >= effectiveMinimumArguments) { + return true; + } + for (var i = argCount; i < effectiveMinimumArguments; i++) { + var type = getTypeAtPosition(signature, i); + if (filterType(type, ts6.isInJSFile(node) && !strictNullChecks ? acceptsVoidUndefinedUnknownOrAny : acceptsVoid).flags & 131072) { + return false; + } + } + return true; + } + function hasCorrectTypeArgumentArity(signature, typeArguments) { + var numTypeParameters = ts6.length(signature.typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); + return !ts6.some(typeArguments) || typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters; + } + function getSingleCallSignature(type) { + return getSingleSignature( + type, + 0, + /*allowMembers*/ + false + ); + } + function getSingleCallOrConstructSignature(type) { + return getSingleSignature( + type, + 0, + /*allowMembers*/ + false + ) || getSingleSignature( + type, + 1, + /*allowMembers*/ + false + ); + } + function getSingleSignature(type, kind, allowMembers) { + if (type.flags & 524288) { + var resolved = resolveStructuredTypeMembers(type); + if (allowMembers || resolved.properties.length === 0 && resolved.indexInfos.length === 0) { + if (kind === 0 && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) { + return resolved.callSignatures[0]; + } + if (kind === 1 && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) { + return resolved.constructSignatures[0]; + } + } + } + return void 0; + } + function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) { + var context = createInferenceContext(signature.typeParameters, signature, 0, compareTypes); + var restType = getEffectiveRestType(contextualSignature); + var mapper = inferenceContext && (restType && restType.flags & 262144 ? inferenceContext.nonFixingMapper : inferenceContext.mapper); + var sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature; + applyToParameterTypes(sourceSignature, signature, function(source, target) { + inferTypes(context.inferences, source, target); + }); + if (!inferenceContext) { + applyToReturnTypes(contextualSignature, signature, function(source, target) { + inferTypes( + context.inferences, + source, + target, + 128 + /* InferencePriority.ReturnType */ + ); + }); + } + return getSignatureInstantiation(signature, getInferredTypes(context), ts6.isInJSFile(contextualSignature.declaration)); + } + function inferJsxTypeArguments(node, signature, checkMode, context) { + var paramType = getEffectiveFirstArgumentForJsxSignature(signature, node); + var checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode); + inferTypes(context.inferences, checkAttrType, paramType); + return getInferredTypes(context); + } + function getThisArgumentType(thisArgumentNode) { + if (!thisArgumentNode) { + return voidType; + } + var thisArgumentType = checkExpression(thisArgumentNode); + return ts6.isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : ts6.isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType; + } + function inferTypeArguments(node, signature, args, checkMode, context) { + if (ts6.isJsxOpeningLikeElement(node)) { + return inferJsxTypeArguments(node, signature, checkMode, context); + } + if (node.kind !== 167) { + var skipBindingPatterns = ts6.every(signature.typeParameters, function(p) { + return !!getDefaultFromTypeParameter(p); + }); + var contextualType = getContextualType( + node, + skipBindingPatterns ? 8 : 0 + /* ContextFlags.None */ + ); + if (contextualType) { + var inferenceTargetType = getReturnTypeOfSignature(signature); + if (couldContainTypeVariables(inferenceTargetType)) { + var outerContext = getInferenceContext(node); + var isFromBindingPattern = !skipBindingPatterns && getContextualType( + node, + 8 + /* ContextFlags.SkipBindingPatterns */ + ) !== contextualType; + if (!isFromBindingPattern) { + var outerMapper = getMapperFromContext(cloneInferenceContext( + outerContext, + 1 + /* InferenceFlags.NoDefault */ + )); + var instantiatedType = instantiateType(contextualType, outerMapper); + var contextualSignature = getSingleCallSignature(instantiatedType); + var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType; + inferTypes( + context.inferences, + inferenceSourceType, + inferenceTargetType, + 128 + /* InferencePriority.ReturnType */ + ); + } + var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags); + var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper); + inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); + context.returnMapper = ts6.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0; + } + } + } + var restType = getNonArrayRestType(signature); + var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; + if (restType && restType.flags & 262144) { + var info = ts6.find(context.inferences, function(info2) { + return info2.typeParameter === restType; + }); + if (info) { + info.impliedArity = ts6.findIndex(args, isSpreadArgument, argCount) < 0 ? args.length - argCount : void 0; + } + } + var thisType = getThisTypeOfSignature(signature); + if (thisType && couldContainTypeVariables(thisType)) { + var thisArgumentNode = getThisArgumentOfCall(node); + inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType); + } + for (var i = 0; i < argCount; i++) { + var arg = args[i]; + if (arg.kind !== 229 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) { + var paramType = getTypeAtPosition(signature, i); + if (couldContainTypeVariables(paramType)) { + var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); + inferTypes(context.inferences, argType, paramType); + } + } + } + if (restType && couldContainTypeVariables(restType)) { + var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode); + inferTypes(context.inferences, spreadType, restType); + } + return getInferredTypes(context); + } + function getMutableArrayOrTupleType(type) { + return type.flags & 1048576 ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType( + getTypeArguments(type), + type.target.elementFlags, + /*readonly*/ + false, + type.target.labeledElementDeclarations + ) : createTupleType([type], [ + 8 + /* ElementFlags.Variadic */ + ]); + } + function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) { + if (index >= argCount - 1) { + var arg = args[argCount - 1]; + if (isSpreadArgument(arg)) { + return getMutableArrayOrTupleType(arg.kind === 234 ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); + } + } + var types = []; + var flags = []; + var names = []; + for (var i = index; i < argCount; i++) { + var arg = args[i]; + if (isSpreadArgument(arg)) { + var spreadType = arg.kind === 234 ? arg.type : checkExpression(arg.expression); + if (isArrayLikeType(spreadType)) { + types.push(spreadType); + flags.push( + 8 + /* ElementFlags.Variadic */ + ); + } else { + types.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, arg.kind === 227 ? arg.expression : arg)); + flags.push( + 4 + /* ElementFlags.Rest */ + ); + } + } else { + var contextualType = getIndexedAccessType( + restType, + getNumberLiteralType(i - index), + 256 + /* AccessFlags.Contextual */ + ); + var argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode); + var hasPrimitiveContextualType = maybeTypeOfKind( + contextualType, + 131068 | 4194304 | 134217728 | 268435456 + /* TypeFlags.StringMapping */ + ); + types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); + flags.push( + 1 + /* ElementFlags.Required */ + ); + } + if (arg.kind === 234 && arg.tupleNameSource) { + names.push(arg.tupleNameSource); + } + } + return createTupleType( + types, + flags, + /*readonly*/ + false, + ts6.length(names) === ts6.length(types) ? names : void 0 + ); + } + function checkTypeArguments(signature, typeArgumentNodes, reportErrors, headMessage) { + var isJavascript = ts6.isInJSFile(signature.declaration); + var typeParameters = signature.typeParameters; + var typeArgumentTypes = fillMissingTypeArguments(ts6.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), isJavascript); + var mapper; + for (var i = 0; i < typeArgumentNodes.length; i++) { + ts6.Debug.assert(typeParameters[i] !== void 0, "Should not call checkTypeArguments with too many type arguments"); + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + var errorInfo = reportErrors && headMessage ? function() { + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Type_0_does_not_satisfy_the_constraint_1 + ); + } : void 0; + var typeArgumentHeadMessage = headMessage || ts6.Diagnostics.Type_0_does_not_satisfy_the_constraint_1; + if (!mapper) { + mapper = createTypeMapper(typeParameters, typeArgumentTypes); + } + var typeArgument = typeArgumentTypes[i]; + if (!checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : void 0, typeArgumentHeadMessage, errorInfo)) { + return void 0; + } + } + } + return typeArgumentTypes; + } + function getJsxReferenceKind(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return 2; + } + var tagType = getApparentType(checkExpression(node.tagName)); + if (ts6.length(getSignaturesOfType( + tagType, + 1 + /* SignatureKind.Construct */ + ))) { + return 0; + } + if (ts6.length(getSignaturesOfType( + tagType, + 0 + /* SignatureKind.Call */ + ))) { + return 1; + } + return 2; + } + function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer) { + var paramType = getEffectiveFirstArgumentForJsxSignature(signature, node); + var attributesType = checkExpressionWithContextualType( + node.attributes, + paramType, + /*inferenceContext*/ + void 0, + checkMode + ); + return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate( + attributesType, + paramType, + relation, + reportErrors ? node.tagName : void 0, + node.attributes, + /*headMessage*/ + void 0, + containingMessageChain, + errorOutputContainer + ); + function checkTagNameDoesNotExpectTooManyArguments() { + var _a; + if (getJsxNamespaceContainerForImplicitImport(node)) { + return true; + } + var tagType = ts6.isJsxOpeningElement(node) || ts6.isJsxSelfClosingElement(node) && !isJsxIntrinsicIdentifier(node.tagName) ? checkExpression(node.tagName) : void 0; + if (!tagType) { + return true; + } + var tagCallSignatures = getSignaturesOfType( + tagType, + 0 + /* SignatureKind.Call */ + ); + if (!ts6.length(tagCallSignatures)) { + return true; + } + var factory = getJsxFactoryEntity(node); + if (!factory) { + return true; + } + var factorySymbol = resolveEntityName( + factory, + 111551, + /*ignoreErrors*/ + true, + /*dontResolveAlias*/ + false, + node + ); + if (!factorySymbol) { + return true; + } + var factoryType = getTypeOfSymbol(factorySymbol); + var callSignatures = getSignaturesOfType( + factoryType, + 0 + /* SignatureKind.Call */ + ); + if (!ts6.length(callSignatures)) { + return true; + } + var hasFirstParamSignatures = false; + var maxParamCount = 0; + for (var _i = 0, callSignatures_1 = callSignatures; _i < callSignatures_1.length; _i++) { + var sig = callSignatures_1[_i]; + var firstparam = getTypeAtPosition(sig, 0); + var signaturesOfParam = getSignaturesOfType( + firstparam, + 0 + /* SignatureKind.Call */ + ); + if (!ts6.length(signaturesOfParam)) + continue; + for (var _b = 0, signaturesOfParam_1 = signaturesOfParam; _b < signaturesOfParam_1.length; _b++) { + var paramSig = signaturesOfParam_1[_b]; + hasFirstParamSignatures = true; + if (hasEffectiveRestParameter(paramSig)) { + return true; + } + var paramCount = getParameterCount(paramSig); + if (paramCount > maxParamCount) { + maxParamCount = paramCount; + } + } + } + if (!hasFirstParamSignatures) { + return true; + } + var absoluteMinArgCount = Infinity; + for (var _c = 0, tagCallSignatures_1 = tagCallSignatures; _c < tagCallSignatures_1.length; _c++) { + var tagSig = tagCallSignatures_1[_c]; + var tagRequiredArgCount = getMinArgumentCount(tagSig); + if (tagRequiredArgCount < absoluteMinArgCount) { + absoluteMinArgCount = tagRequiredArgCount; + } + } + if (absoluteMinArgCount <= maxParamCount) { + return true; + } + if (reportErrors) { + var diag = ts6.createDiagnosticForNode(node.tagName, ts6.Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, ts6.entityNameToString(node.tagName), absoluteMinArgCount, ts6.entityNameToString(factory), maxParamCount); + var tagNameDeclaration = (_a = getSymbolAtLocation(node.tagName)) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + if (tagNameDeclaration) { + ts6.addRelatedInfo(diag, ts6.createDiagnosticForNode(tagNameDeclaration, ts6.Diagnostics._0_is_declared_here, ts6.entityNameToString(node.tagName))); + } + if (errorOutputContainer && errorOutputContainer.skipLogging) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + if (!errorOutputContainer.skipLogging) { + diagnostics.add(diag); + } + } + return false; + } + } + function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors, containingMessageChain) { + var errorOutputContainer = { errors: void 0, skipLogging: true }; + if (ts6.isJsxOpeningLikeElement(node)) { + if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) { + ts6.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors"); + return errorOutputContainer.errors || ts6.emptyArray; + } + return void 0; + } + var thisType = getThisTypeOfSignature(signature); + if (thisType && thisType !== voidType && node.kind !== 211) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = getThisArgumentType(thisArgumentNode); + var errorNode = reportErrors ? thisArgumentNode || node : void 0; + var headMessage_1 = ts6.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) { + ts6.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors"); + return errorOutputContainer.errors || ts6.emptyArray; + } + } + var headMessage = ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + var restType = getNonArrayRestType(signature); + var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; + for (var i = 0; i < argCount; i++) { + var arg = args[i]; + if (arg.kind !== 229) { + var paramType = getTypeAtPosition(signature, i); + var argType = checkExpressionWithContextualType( + arg, + paramType, + /*inferenceContext*/ + void 0, + checkMode + ); + var checkArgType = checkMode & 4 ? getRegularTypeOfObjectLiteral(argType) : argType; + if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : void 0, arg, headMessage, containingMessageChain, errorOutputContainer)) { + ts6.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors"); + maybeAddMissingAwaitInfo(arg, checkArgType, paramType); + return errorOutputContainer.errors || ts6.emptyArray; + } + } + } + if (restType) { + var spreadType = getSpreadArgumentType( + args, + argCount, + args.length, + restType, + /*context*/ + void 0, + checkMode + ); + var restArgCount = args.length - argCount; + var errorNode = !reportErrors ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? args[argCount] : ts6.setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end); + if (!checkTypeRelatedTo( + spreadType, + restType, + relation, + errorNode, + headMessage, + /*containingMessageChain*/ + void 0, + errorOutputContainer + )) { + ts6.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors"); + maybeAddMissingAwaitInfo(errorNode, spreadType, restType); + return errorOutputContainer.errors || ts6.emptyArray; + } + } + return void 0; + function maybeAddMissingAwaitInfo(errorNode2, source, target) { + if (errorNode2 && reportErrors && errorOutputContainer.errors && errorOutputContainer.errors.length) { + if (getAwaitedTypeOfPromise(target)) { + return; + } + var awaitedTypeOfSource = getAwaitedTypeOfPromise(source); + if (awaitedTypeOfSource && isTypeRelatedTo(awaitedTypeOfSource, target, relation)) { + ts6.addRelatedInfo(errorOutputContainer.errors[0], ts6.createDiagnosticForNode(errorNode2, ts6.Diagnostics.Did_you_forget_to_use_await)); + } + } + } + } + function getThisArgumentOfCall(node) { + var expression = node.kind === 210 ? node.expression : node.kind === 212 ? node.tag : void 0; + if (expression) { + var callee = ts6.skipOuterExpressions(expression); + if (ts6.isAccessExpression(callee)) { + return callee.expression; + } + } + } + function createSyntheticExpression(parent, type, isSpread, tupleNameSource) { + var result = ts6.parseNodeFactory.createSyntheticExpression(type, isSpread, tupleNameSource); + ts6.setTextRange(result, parent); + ts6.setParent(result, parent); + return result; + } + function getEffectiveCallArguments(node) { + if (node.kind === 212) { + var template = node.template; + var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; + if (template.kind === 225) { + ts6.forEach(template.templateSpans, function(span) { + args_3.push(span.expression); + }); + } + return args_3; + } + if (node.kind === 167) { + return getEffectiveDecoratorArguments(node); + } + if (ts6.isJsxOpeningLikeElement(node)) { + return node.attributes.properties.length > 0 || ts6.isJsxOpeningElement(node) && node.parent.children.length > 0 ? [node.attributes] : ts6.emptyArray; + } + var args = node.arguments || ts6.emptyArray; + var spreadIndex = getSpreadArgumentIndex(args); + if (spreadIndex >= 0) { + var effectiveArgs_1 = args.slice(0, spreadIndex); + var _loop_26 = function(i2) { + var arg = args[i2]; + var spreadType = arg.kind === 227 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + if (spreadType && isTupleType(spreadType)) { + ts6.forEach(getTypeArguments(spreadType), function(t, i3) { + var _a; + var flags = spreadType.target.elementFlags[i3]; + var syntheticArg = createSyntheticExpression(arg, flags & 4 ? createArrayType(t) : t, !!(flags & 12), (_a = spreadType.target.labeledElementDeclarations) === null || _a === void 0 ? void 0 : _a[i3]); + effectiveArgs_1.push(syntheticArg); + }); + } else { + effectiveArgs_1.push(arg); + } + }; + for (var i = spreadIndex; i < args.length; i++) { + _loop_26(i); + } + return effectiveArgs_1; + } + return args; + } + function getEffectiveDecoratorArguments(node) { + var parent = node.parent; + var expr = node.expression; + switch (parent.kind) { + case 260: + case 228: + return [ + createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) + ]; + case 166: + var func = parent.parent; + return [ + createSyntheticExpression(expr, parent.parent.kind === 173 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, anyType), + createSyntheticExpression(expr, numberType) + ]; + case 169: + case 171: + case 174: + case 175: + var hasPropDesc = languageVersion !== 0 && (!ts6.isPropertyDeclaration(parent) || ts6.hasAccessorModifier(parent)); + return [ + createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), + createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), + createSyntheticExpression(expr, hasPropDesc ? createTypedPropertyDescriptorType(getTypeOfNode(parent)) : anyType) + ]; + } + return ts6.Debug.fail(); + } + function getDecoratorArgumentCount(node, signature) { + switch (node.parent.kind) { + case 260: + case 228: + return 1; + case 169: + return ts6.hasAccessorModifier(node.parent) ? 3 : 2; + case 171: + case 174: + case 175: + return languageVersion === 0 || signature.parameters.length <= 2 ? 2 : 3; + case 166: + return 3; + default: + return ts6.Debug.fail(); + } + } + function getDiagnosticSpanForCallNode(node, doNotIncludeArguments) { + var start; + var length; + var sourceFile = ts6.getSourceFileOfNode(node); + if (ts6.isPropertyAccessExpression(node.expression)) { + var nameSpan = ts6.getErrorSpanForNode(sourceFile, node.expression.name); + start = nameSpan.start; + length = doNotIncludeArguments ? nameSpan.length : node.end - start; + } else { + var expressionSpan = ts6.getErrorSpanForNode(sourceFile, node.expression); + start = expressionSpan.start; + length = doNotIncludeArguments ? expressionSpan.length : node.end - start; + } + return { start, length, sourceFile }; + } + function getDiagnosticForCallNode(node, message, arg0, arg1, arg2, arg3) { + if (ts6.isCallExpression(node)) { + var _a = getDiagnosticSpanForCallNode(node), sourceFile = _a.sourceFile, start = _a.start, length_6 = _a.length; + return ts6.createFileDiagnostic(sourceFile, start, length_6, message, arg0, arg1, arg2, arg3); + } else { + return ts6.createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3); + } + } + function isPromiseResolveArityError(node) { + if (!ts6.isCallExpression(node) || !ts6.isIdentifier(node.expression)) + return false; + var symbol = resolveName(node.expression, node.expression.escapedText, 111551, void 0, void 0, false); + var decl = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration; + if (!decl || !ts6.isParameter(decl) || !ts6.isFunctionExpressionOrArrowFunction(decl.parent) || !ts6.isNewExpression(decl.parent.parent) || !ts6.isIdentifier(decl.parent.parent.expression)) { + return false; + } + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol( + /*reportErrors*/ + false + ); + if (!globalPromiseSymbol) + return false; + var constructorSymbol = getSymbolAtLocation( + decl.parent.parent.expression, + /*ignoreErrors*/ + true + ); + return constructorSymbol === globalPromiseSymbol; + } + function getArgumentArityError(node, signatures, args) { + var _a; + var spreadIndex = getSpreadArgumentIndex(args); + if (spreadIndex > -1) { + return ts6.createDiagnosticForNode(args[spreadIndex], ts6.Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter); + } + var min = Number.POSITIVE_INFINITY; + var max = Number.NEGATIVE_INFINITY; + var maxBelow = Number.NEGATIVE_INFINITY; + var minAbove = Number.POSITIVE_INFINITY; + var closestSignature; + for (var _i = 0, signatures_8 = signatures; _i < signatures_8.length; _i++) { + var sig = signatures_8[_i]; + var minParameter = getMinArgumentCount(sig); + var maxParameter = getParameterCount(sig); + if (minParameter < min) { + min = minParameter; + closestSignature = sig; + } + max = Math.max(max, maxParameter); + if (minParameter < args.length && minParameter > maxBelow) + maxBelow = minParameter; + if (args.length < maxParameter && maxParameter < minAbove) + minAbove = maxParameter; + } + var hasRestParameter = ts6.some(signatures, hasEffectiveRestParameter); + var parameterRange = hasRestParameter ? min : min < max ? min + "-" + max : min; + var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node); + if (isVoidPromiseError && ts6.isInJSFile(node)) { + return getDiagnosticForCallNode(node, ts6.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments); + } + var error2 = hasRestParameter ? ts6.Diagnostics.Expected_at_least_0_arguments_but_got_1 : isVoidPromiseError ? ts6.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise : ts6.Diagnostics.Expected_0_arguments_but_got_1; + if (min < args.length && args.length < max) { + return getDiagnosticForCallNode(node, ts6.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove); + } else if (args.length < min) { + var diagnostic = getDiagnosticForCallNode(node, error2, parameterRange, args.length); + var parameter = (_a = closestSignature === null || closestSignature === void 0 ? void 0 : closestSignature.declaration) === null || _a === void 0 ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length]; + if (parameter) { + var parameterError = ts6.createDiagnosticForNode(parameter, ts6.isBindingPattern(parameter.name) ? ts6.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : ts6.isRestParameter(parameter) ? ts6.Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided : ts6.Diagnostics.An_argument_for_0_was_not_provided, !parameter.name ? args.length : !ts6.isBindingPattern(parameter.name) ? ts6.idText(ts6.getFirstIdentifier(parameter.name)) : void 0); + return ts6.addRelatedInfo(diagnostic, parameterError); + } + return diagnostic; + } else { + var errorSpan = ts6.factory.createNodeArray(args.slice(max)); + var pos = ts6.first(errorSpan).pos; + var end = ts6.last(errorSpan).end; + if (end === pos) { + end++; + } + ts6.setTextRangePosEnd(errorSpan, pos, end); + return ts6.createDiagnosticForNodeArray(ts6.getSourceFileOfNode(node), errorSpan, error2, parameterRange, args.length); + } + } + function getTypeArgumentArityError(node, signatures, typeArguments) { + var argCount = typeArguments.length; + if (signatures.length === 1) { + var sig = signatures[0]; + var min_1 = getMinTypeArgumentCount(sig.typeParameters); + var max = ts6.length(sig.typeParameters); + return ts6.createDiagnosticForNodeArray(ts6.getSourceFileOfNode(node), typeArguments, ts6.Diagnostics.Expected_0_type_arguments_but_got_1, min_1 < max ? min_1 + "-" + max : min_1, argCount); + } + var belowArgCount = -Infinity; + var aboveArgCount = Infinity; + for (var _i = 0, signatures_9 = signatures; _i < signatures_9.length; _i++) { + var sig = signatures_9[_i]; + var min_2 = getMinTypeArgumentCount(sig.typeParameters); + var max = ts6.length(sig.typeParameters); + if (min_2 > argCount) { + aboveArgCount = Math.min(aboveArgCount, min_2); + } else if (max < argCount) { + belowArgCount = Math.max(belowArgCount, max); + } + } + if (belowArgCount !== -Infinity && aboveArgCount !== Infinity) { + return ts6.createDiagnosticForNodeArray(ts6.getSourceFileOfNode(node), typeArguments, ts6.Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount); + } + return ts6.createDiagnosticForNodeArray(ts6.getSourceFileOfNode(node), typeArguments, ts6.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); + } + function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { + var isTaggedTemplate = node.kind === 212; + var isDecorator = node.kind === 167; + var isJsxOpeningOrSelfClosingElement = ts6.isJsxOpeningLikeElement(node); + var reportErrors = !candidatesOutArray; + var typeArguments; + if (!isDecorator && !ts6.isSuperCall(node)) { + typeArguments = node.typeArguments; + if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106) { + ts6.forEach(typeArguments, checkSourceElement); + } + } + var candidates = candidatesOutArray || []; + reorderCandidates(signatures, candidates, callChainFlags); + if (!candidates.length) { + if (reportErrors) { + diagnostics.add(getDiagnosticForCallNode(node, ts6.Diagnostics.Call_target_does_not_contain_any_signatures)); + } + return resolveErrorCall(node); + } + var args = getEffectiveCallArguments(node); + var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters; + var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts6.some(args, isContextSensitive) ? 4 : 0; + argCheckMode |= checkMode & 32; + var candidatesForArgumentError; + var candidateForArgumentArityError; + var candidateForTypeArgumentError; + var result; + var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 210 && node.arguments.hasTrailingComma; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); + } + if (!result) { + result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); + } + if (result) { + return result; + } + result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode); + getNodeLinks(node).resolvedSignature = result; + if (reportErrors) { + if (candidatesForArgumentError) { + if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) { + var last_2 = candidatesForArgumentError[candidatesForArgumentError.length - 1]; + var chain_1; + if (candidatesForArgumentError.length > 3) { + chain_1 = ts6.chainDiagnosticMessages(chain_1, ts6.Diagnostics.The_last_overload_gave_the_following_error); + chain_1 = ts6.chainDiagnosticMessages(chain_1, ts6.Diagnostics.No_overload_matches_this_call); + } + var diags = getSignatureApplicabilityError( + node, + args, + last_2, + assignableRelation, + 0, + /*reportErrors*/ + true, + function() { + return chain_1; + } + ); + if (diags) { + for (var _i = 0, diags_1 = diags; _i < diags_1.length; _i++) { + var d = diags_1[_i]; + if (last_2.declaration && candidatesForArgumentError.length > 3) { + ts6.addRelatedInfo(d, ts6.createDiagnosticForNode(last_2.declaration, ts6.Diagnostics.The_last_overload_is_declared_here)); + } + addImplementationSuccessElaboration(last_2, d); + diagnostics.add(d); + } + } else { + ts6.Debug.fail("No error for last overload signature"); + } + } else { + var allDiagnostics = []; + var max = 0; + var min_3 = Number.MAX_VALUE; + var minIndex = 0; + var i_1 = 0; + var _loop_27 = function(c2) { + var chain_2 = function() { + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Overload_0_of_1_2_gave_the_following_error, + i_1 + 1, + candidates.length, + signatureToString(c2) + ); + }; + var diags_2 = getSignatureApplicabilityError( + node, + args, + c2, + assignableRelation, + 0, + /*reportErrors*/ + true, + chain_2 + ); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; + minIndex = i_1; + } + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); + } else { + ts6.Debug.fail("No error for 3 or fewer overload signatures"); + } + i_1++; + }; + for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { + var c = candidatesForArgumentError_1[_a]; + _loop_27(c); + } + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts6.flatten(allDiagnostics); + ts6.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts6.chainDiagnosticMessages(ts6.map(diags_3, ts6.createDiagnosticMessageChainFromDiagnostic), ts6.Diagnostics.No_overload_matches_this_call); + var related = __spreadArray([], ts6.flatMap(diags_3, function(d2) { + return d2.relatedInformation; + }), true); + var diag = void 0; + if (ts6.every(diags_3, function(d2) { + return d2.start === diags_3[0].start && d2.length === diags_3[0].length && d2.file === diags_3[0].file; + })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; + diag = { file, start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; + } else { + diag = ts6.createDiagnosticForNodeFromMessageChain(node, chain, related); + } + addImplementationSuccessElaboration(candidatesForArgumentError[0], diag); + diagnostics.add(diag); + } + } else if (candidateForArgumentArityError) { + diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args)); + } else if (candidateForTypeArgumentError) { + checkTypeArguments( + candidateForTypeArgumentError, + node.typeArguments, + /*reportErrors*/ + true, + fallbackError + ); + } else { + var signaturesWithCorrectTypeArgumentArity = ts6.filter(signatures, function(s) { + return hasCorrectTypeArgumentArity(s, typeArguments); + }); + if (signaturesWithCorrectTypeArgumentArity.length === 0) { + diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments)); + } else if (!isDecorator) { + diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args)); + } else if (fallbackError) { + diagnostics.add(getDiagnosticForCallNode(node, fallbackError)); + } + } + } + return result; + function addImplementationSuccessElaboration(failed, diagnostic) { + var _a2, _b2; + var oldCandidatesForArgumentError = candidatesForArgumentError; + var oldCandidateForArgumentArityError = candidateForArgumentArityError; + var oldCandidateForTypeArgumentError = candidateForTypeArgumentError; + var failedSignatureDeclarations = ((_b2 = (_a2 = failed.declaration) === null || _a2 === void 0 ? void 0 : _a2.symbol) === null || _b2 === void 0 ? void 0 : _b2.declarations) || ts6.emptyArray; + var isOverload = failedSignatureDeclarations.length > 1; + var implDecl = isOverload ? ts6.find(failedSignatureDeclarations, function(d2) { + return ts6.isFunctionLikeDeclaration(d2) && ts6.nodeIsPresent(d2.body); + }) : void 0; + if (implDecl) { + var candidate = getSignatureFromDeclaration(implDecl); + var isSingleNonGenericCandidate_1 = !candidate.typeParameters; + if (chooseOverload([candidate], assignableRelation, isSingleNonGenericCandidate_1)) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(implDecl, ts6.Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible)); + } + } + candidatesForArgumentError = oldCandidatesForArgumentError; + candidateForArgumentArityError = oldCandidateForArgumentArityError; + candidateForTypeArgumentError = oldCandidateForTypeArgumentError; + } + function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2) { + if (signatureHelpTrailingComma2 === void 0) { + signatureHelpTrailingComma2 = false; + } + candidatesForArgumentError = void 0; + candidateForArgumentArityError = void 0; + candidateForTypeArgumentError = void 0; + if (isSingleNonGenericCandidate2) { + var candidate = candidates2[0]; + if (ts6.some(typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) { + return void 0; + } + if (getSignatureApplicabilityError( + node, + args, + candidate, + relation, + 0, + /*reportErrors*/ + false, + /*containingMessageChain*/ + void 0 + )) { + candidatesForArgumentError = [candidate]; + return void 0; + } + return candidate; + } + for (var candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) { + var candidate = candidates2[candidateIndex]; + if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) { + continue; + } + var checkCandidate = void 0; + var inferenceContext = void 0; + if (candidate.typeParameters) { + var typeArgumentTypes = void 0; + if (ts6.some(typeArguments)) { + typeArgumentTypes = checkTypeArguments( + candidate, + typeArguments, + /*reportErrors*/ + false + ); + if (!typeArgumentTypes) { + candidateForTypeArgumentError = candidate; + continue; + } + } else { + inferenceContext = createInferenceContext( + candidate.typeParameters, + candidate, + /*flags*/ + ts6.isInJSFile(node) ? 2 : 0 + /* InferenceFlags.None */ + ); + typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8, inferenceContext); + argCheckMode |= inferenceContext.flags & 4 ? 8 : 0; + } + checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts6.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters); + if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) { + candidateForArgumentArityError = checkCandidate; + continue; + } + } else { + checkCandidate = candidate; + } + if (getSignatureApplicabilityError( + node, + args, + checkCandidate, + relation, + argCheckMode, + /*reportErrors*/ + false, + /*containingMessageChain*/ + void 0 + )) { + (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate); + continue; + } + if (argCheckMode) { + argCheckMode = checkMode & 32; + if (inferenceContext) { + var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext); + checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts6.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters); + if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) { + candidateForArgumentArityError = checkCandidate; + continue; + } + } + if (getSignatureApplicabilityError( + node, + args, + checkCandidate, + relation, + argCheckMode, + /*reportErrors*/ + false, + /*containingMessageChain*/ + void 0 + )) { + (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate); + continue; + } + } + candidates2[candidateIndex] = checkCandidate; + return checkCandidate; + } + return void 0; + } + } + function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray, checkMode) { + ts6.Debug.assert(candidates.length > 0); + checkNodeDeferred(node); + return hasCandidatesOutArray || candidates.length === 1 || candidates.some(function(c) { + return !!c.typeParameters; + }) ? pickLongestCandidateSignature(node, candidates, args, checkMode) : createUnionOfSignaturesForOverloadFailure(candidates); + } + function createUnionOfSignaturesForOverloadFailure(candidates) { + var thisParameters = ts6.mapDefined(candidates, function(c) { + return c.thisParameter; + }); + var thisParameter; + if (thisParameters.length) { + thisParameter = createCombinedSymbolFromTypes(thisParameters, thisParameters.map(getTypeOfParameter)); + } + var _a = ts6.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; + var parameters = []; + var _loop_28 = function(i2) { + var symbols = ts6.mapDefined(candidates, function(s) { + return signatureHasRestParameter(s) ? i2 < s.parameters.length - 1 ? s.parameters[i2] : ts6.last(s.parameters) : i2 < s.parameters.length ? s.parameters[i2] : void 0; + }); + ts6.Debug.assert(symbols.length !== 0); + parameters.push(createCombinedSymbolFromTypes(symbols, ts6.mapDefined(candidates, function(candidate) { + return tryGetTypeAtPosition(candidate, i2); + }))); + }; + for (var i = 0; i < maxNonRestParam; i++) { + _loop_28(i); + } + var restParameterSymbols = ts6.mapDefined(candidates, function(c) { + return signatureHasRestParameter(c) ? ts6.last(c.parameters) : void 0; + }); + var flags = 0; + if (restParameterSymbols.length !== 0) { + var type = createArrayType(getUnionType( + ts6.mapDefined(candidates, tryGetRestTypeOfSignature), + 2 + /* UnionReduction.Subtype */ + )); + parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type)); + flags |= 1; + } + if (candidates.some(signatureHasLiteralTypes)) { + flags |= 2; + } + return createSignature( + candidates[0].declaration, + /*typeParameters*/ + void 0, + // Before calling this we tested for `!candidates.some(c => !!c.typeParameters)`. + thisParameter, + parameters, + /*resolvedReturnType*/ + getIntersectionType(candidates.map(getReturnTypeOfSignature)), + /*typePredicate*/ + void 0, + minArgumentCount, + flags + ); + } + function getNumNonRestParameters(signature) { + var numParams = signature.parameters.length; + return signatureHasRestParameter(signature) ? numParams - 1 : numParams; + } + function createCombinedSymbolFromTypes(sources, types) { + return createCombinedSymbolForOverloadFailure(sources, getUnionType( + types, + 2 + /* UnionReduction.Subtype */ + )); + } + function createCombinedSymbolForOverloadFailure(sources, type) { + return createSymbolWithType(ts6.first(sources), type); + } + function pickLongestCandidateSignature(node, candidates, args, checkMode) { + var bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === void 0 ? args.length : apparentArgumentCount); + var candidate = candidates[bestIndex]; + var typeParameters = candidate.typeParameters; + if (!typeParameters) { + return candidate; + } + var typeArgumentNodes = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments : void 0; + var instantiated = typeArgumentNodes ? createSignatureInstantiation(candidate, getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, ts6.isInJSFile(node))) : inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode); + candidates[bestIndex] = instantiated; + return instantiated; + } + function getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, isJs) { + var typeArguments = typeArgumentNodes.map(getTypeOfNode); + while (typeArguments.length > typeParameters.length) { + typeArguments.pop(); + } + while (typeArguments.length < typeParameters.length) { + typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs)); + } + return typeArguments; + } + function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode) { + var inferenceContext = createInferenceContext( + typeParameters, + candidate, + /*flags*/ + ts6.isInJSFile(node) ? 2 : 0 + /* InferenceFlags.None */ + ); + var typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 | 8, inferenceContext); + return createSignatureInstantiation(candidate, typeArgumentTypes); + } + function getLongestCandidateIndex(candidates, argsCount) { + var maxParamsIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + var paramCount = getParameterCount(candidate); + if (hasEffectiveRestParameter(candidate) || paramCount >= argsCount) { + return i; + } + if (paramCount > maxParams) { + maxParams = paramCount; + maxParamsIndex = i; + } + } + return maxParamsIndex; + } + function resolveCallExpression(node, candidatesOutArray, checkMode) { + if (node.expression.kind === 106) { + var superType = checkSuperExpression(node.expression); + if (isTypeAny(superType)) { + for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { + var arg = _a[_i]; + checkExpression(arg); + } + return anySignature; + } + if (!isErrorType(superType)) { + var baseTypeNode = ts6.getEffectiveBaseTypeNode(ts6.getContainingClass(node)); + if (baseTypeNode) { + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); + return resolveCall( + node, + baseConstructors, + candidatesOutArray, + checkMode, + 0 + /* SignatureFlags.None */ + ); + } + } + return resolveUntypedCall(node); + } + var callChainFlags; + var funcType = checkExpression(node.expression); + if (ts6.isCallChain(node)) { + var nonOptionalType = getOptionalExpressionType(funcType, node.expression); + callChainFlags = nonOptionalType === funcType ? 0 : ts6.isOutermostOptionalChain(node) ? 16 : 8; + funcType = nonOptionalType; + } else { + callChainFlags = 0; + } + funcType = checkNonNullTypeWithReporter(funcType, node.expression, reportCannotInvokePossiblyNullOrUndefinedError); + if (funcType === silentNeverType) { + return silentNeverSignature; + } + var apparentType = getApparentType(funcType); + if (isErrorType(apparentType)) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType( + apparentType, + 0 + /* SignatureKind.Call */ + ); + var numConstructSignatures = getSignaturesOfType( + apparentType, + 1 + /* SignatureKind.Construct */ + ).length; + if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) { + if (!isErrorType(funcType) && node.typeArguments) { + error(node, ts6.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + if (numConstructSignatures) { + error(node, ts6.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + } else { + var relatedInformation = void 0; + if (node.arguments.length === 1) { + var text = ts6.getSourceFileOfNode(node).text; + if (ts6.isLineBreak(text.charCodeAt(ts6.skipTrivia( + text, + node.expression.end, + /* stopAfterLineBreak */ + true + ) - 1))) { + relatedInformation = ts6.createDiagnosticForNode(node.expression, ts6.Diagnostics.Are_you_missing_a_semicolon); + } + } + invocationError(node.expression, apparentType, 0, relatedInformation); + } + return resolveErrorCall(node); + } + if (checkMode & 8 && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) { + skippedGenericFunction(node, checkMode); + return resolvingSignature; + } + if (callSignatures.some(function(sig) { + return ts6.isInJSFile(sig.declaration) && !!ts6.getJSDocClassTag(sig.declaration); + })) { + error(node, ts6.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags); + } + function isGenericFunctionReturningFunction(signature) { + return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature))); + } + function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) { + return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576) && !(getReducedType(apparentFuncType).flags & 131072) && isTypeAssignableTo(funcType, globalFunctionType); + } + function resolveNewExpression(node, candidatesOutArray, checkMode) { + if (node.arguments && languageVersion < 1) { + var spreadIndex = getSpreadArgumentIndex(node.arguments); + if (spreadIndex >= 0) { + error(node.arguments[spreadIndex], ts6.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); + } + } + var expressionType = checkNonNullExpression(node.expression); + if (expressionType === silentNeverType) { + return silentNeverSignature; + } + expressionType = getApparentType(expressionType); + if (isErrorType(expressionType)) { + return resolveErrorCall(node); + } + if (isTypeAny(expressionType)) { + if (node.typeArguments) { + error(node, ts6.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + var constructSignatures = getSignaturesOfType( + expressionType, + 1 + /* SignatureKind.Construct */ + ); + if (constructSignatures.length) { + if (!isConstructorAccessible(node, constructSignatures[0])) { + return resolveErrorCall(node); + } + if (someSignature(constructSignatures, function(signature2) { + return !!(signature2.flags & 4); + })) { + error(node, ts6.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); + return resolveErrorCall(node); + } + var valueDecl = expressionType.symbol && ts6.getClassLikeDeclarationOfSymbol(expressionType.symbol); + if (valueDecl && ts6.hasSyntacticModifier( + valueDecl, + 256 + /* ModifierFlags.Abstract */ + )) { + error(node, ts6.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); + return resolveErrorCall(node); + } + return resolveCall( + node, + constructSignatures, + candidatesOutArray, + checkMode, + 0 + /* SignatureFlags.None */ + ); + } + var callSignatures = getSignaturesOfType( + expressionType, + 0 + /* SignatureKind.Call */ + ); + if (callSignatures.length) { + var signature = resolveCall( + node, + callSignatures, + candidatesOutArray, + checkMode, + 0 + /* SignatureFlags.None */ + ); + if (!noImplicitAny) { + if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) { + error(node, ts6.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + } + if (getThisTypeOfSignature(signature) === voidType) { + error(node, ts6.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } + } + return signature; + } + invocationError( + node.expression, + expressionType, + 1 + /* SignatureKind.Construct */ + ); + return resolveErrorCall(node); + } + function someSignature(signatures, f) { + if (ts6.isArray(signatures)) { + return ts6.some(signatures, function(signature) { + return someSignature(signature, f); + }); + } + return signatures.compositeKind === 1048576 ? ts6.some(signatures.compositeSignatures, f) : f(signatures); + } + function typeHasProtectedAccessibleBase(target, type) { + var baseTypes = getBaseTypes(type); + if (!ts6.length(baseTypes)) { + return false; + } + var firstBase = baseTypes[0]; + if (firstBase.flags & 2097152) { + var types = firstBase.types; + var mixinFlags = findMixins(types); + var i = 0; + for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) { + var intersectionMember = _a[_i]; + if (!mixinFlags[i]) { + if (ts6.getObjectFlags(intersectionMember) & (1 | 2)) { + if (intersectionMember.symbol === target) { + return true; + } + if (typeHasProtectedAccessibleBase(target, intersectionMember)) { + return true; + } + } + } + i++; + } + return false; + } + if (firstBase.symbol === target) { + return true; + } + return typeHasProtectedAccessibleBase(target, firstBase); + } + function isConstructorAccessible(node, signature) { + if (!signature || !signature.declaration) { + return true; + } + var declaration = signature.declaration; + var modifiers = ts6.getSelectedEffectiveModifierFlags( + declaration, + 24 + /* ModifierFlags.NonPublicAccessibilityModifier */ + ); + if (!modifiers || declaration.kind !== 173) { + return true; + } + var declaringClassDeclaration = ts6.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); + var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + var containingClass = ts6.getContainingClass(node); + if (containingClass && modifiers & 16) { + var containingType = getTypeOfNode(containingClass); + if (typeHasProtectedAccessibleBase(declaration.parent.symbol, containingType)) { + return true; + } + } + if (modifiers & 8) { + error(node, ts6.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + if (modifiers & 16) { + error(node, ts6.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + } + return false; + } + return true; + } + function invocationErrorDetails(errorTarget, apparentType, kind) { + var errorInfo; + var isCall = kind === 0; + var awaitedType = getAwaitedType(apparentType); + var maybeMissingAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0; + if (apparentType.flags & 1048576) { + var types = apparentType.types; + var hasSignatures = false; + for (var _i = 0, types_19 = types; _i < types_19.length; _i++) { + var constituent = types_19[_i]; + var signatures = getSignaturesOfType(constituent, kind); + if (signatures.length !== 0) { + hasSignatures = true; + if (errorInfo) { + break; + } + } else { + if (!errorInfo) { + errorInfo = ts6.chainDiagnosticMessages(errorInfo, isCall ? ts6.Diagnostics.Type_0_has_no_call_signatures : ts6.Diagnostics.Type_0_has_no_construct_signatures, typeToString(constituent)); + errorInfo = ts6.chainDiagnosticMessages(errorInfo, isCall ? ts6.Diagnostics.Not_all_constituents_of_type_0_are_callable : ts6.Diagnostics.Not_all_constituents_of_type_0_are_constructable, typeToString(apparentType)); + } + if (hasSignatures) { + break; + } + } + } + if (!hasSignatures) { + errorInfo = ts6.chainDiagnosticMessages( + /* detials */ + void 0, + isCall ? ts6.Diagnostics.No_constituent_of_type_0_is_callable : ts6.Diagnostics.No_constituent_of_type_0_is_constructable, + typeToString(apparentType) + ); + } + if (!errorInfo) { + errorInfo = ts6.chainDiagnosticMessages(errorInfo, isCall ? ts6.Diagnostics.Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other : ts6.Diagnostics.Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other, typeToString(apparentType)); + } + } else { + errorInfo = ts6.chainDiagnosticMessages(errorInfo, isCall ? ts6.Diagnostics.Type_0_has_no_call_signatures : ts6.Diagnostics.Type_0_has_no_construct_signatures, typeToString(apparentType)); + } + var headMessage = isCall ? ts6.Diagnostics.This_expression_is_not_callable : ts6.Diagnostics.This_expression_is_not_constructable; + if (ts6.isCallExpression(errorTarget.parent) && errorTarget.parent.arguments.length === 0) { + var resolvedSymbol = getNodeLinks(errorTarget).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol.flags & 32768) { + headMessage = ts6.Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without; + } + } + return { + messageChain: ts6.chainDiagnosticMessages(errorInfo, headMessage), + relatedMessage: maybeMissingAwait ? ts6.Diagnostics.Did_you_forget_to_use_await : void 0 + }; + } + function invocationError(errorTarget, apparentType, kind, relatedInformation) { + var _a = invocationErrorDetails(errorTarget, apparentType, kind), messageChain = _a.messageChain, relatedInfo = _a.relatedMessage; + var diagnostic = ts6.createDiagnosticForNodeFromMessageChain(errorTarget, messageChain); + if (relatedInfo) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(errorTarget, relatedInfo)); + } + if (ts6.isCallExpression(errorTarget.parent)) { + var _b = getDiagnosticSpanForCallNode( + errorTarget.parent, + /* doNotIncludeArguments */ + true + ), start = _b.start, length_8 = _b.length; + diagnostic.start = start; + diagnostic.length = length_8; + } + diagnostics.add(diagnostic); + invocationErrorRecovery(apparentType, kind, relatedInformation ? ts6.addRelatedInfo(diagnostic, relatedInformation) : diagnostic); + } + function invocationErrorRecovery(apparentType, kind, diagnostic) { + if (!apparentType.symbol) { + return; + } + var importNode = getSymbolLinks(apparentType.symbol).originatingImport; + if (importNode && !ts6.isImportCall(importNode)) { + var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind); + if (!sigs || !sigs.length) + return; + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(importNode, ts6.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead)); + } + } + function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (isErrorType(apparentType)) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType( + apparentType, + 0 + /* SignatureKind.Call */ + ); + var numConstructSignatures = getSignaturesOfType( + apparentType, + 1 + /* SignatureKind.Construct */ + ).length; + if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, numConstructSignatures)) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + if (ts6.isArrayLiteralExpression(node.parent)) { + var diagnostic = ts6.createDiagnosticForNode(node.tag, ts6.Diagnostics.It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked); + diagnostics.add(diagnostic); + return resolveErrorCall(node); + } + invocationError( + node.tag, + apparentType, + 0 + /* SignatureKind.Call */ + ); + return resolveErrorCall(node); + } + return resolveCall( + node, + callSignatures, + candidatesOutArray, + checkMode, + 0 + /* SignatureFlags.None */ + ); + } + function getDiagnosticHeadMessageForDecoratorResolution(node) { + switch (node.parent.kind) { + case 260: + case 228: + return ts6.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; + case 166: + return ts6.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; + case 169: + return ts6.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; + case 171: + case 174: + case 175: + return ts6.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; + default: + return ts6.Debug.fail(); + } + } + function resolveDecorator(node, candidatesOutArray, checkMode) { + var funcType = checkExpression(node.expression); + var apparentType = getApparentType(funcType); + if (isErrorType(apparentType)) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType( + apparentType, + 0 + /* SignatureKind.Call */ + ); + var numConstructSignatures = getSignaturesOfType( + apparentType, + 1 + /* SignatureKind.Construct */ + ).length; + if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) { + return resolveUntypedCall(node); + } + if (isPotentiallyUncalledDecorator(node, callSignatures)) { + var nodeStr = ts6.getTextOfNode( + node.expression, + /*includeTrivia*/ + false + ); + error(node, ts6.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr); + return resolveErrorCall(node); + } + var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); + if (!callSignatures.length) { + var errorDetails = invocationErrorDetails( + node.expression, + apparentType, + 0 + /* SignatureKind.Call */ + ); + var messageChain = ts6.chainDiagnosticMessages(errorDetails.messageChain, headMessage); + var diag = ts6.createDiagnosticForNodeFromMessageChain(node.expression, messageChain); + if (errorDetails.relatedMessage) { + ts6.addRelatedInfo(diag, ts6.createDiagnosticForNode(node.expression, errorDetails.relatedMessage)); + } + diagnostics.add(diag); + invocationErrorRecovery(apparentType, 0, diag); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0, headMessage); + } + function createSignatureForJSXIntrinsic(node, result) { + var namespace = getJsxNamespaceAt(node); + var exports2 = namespace && getExportsOfSymbol(namespace); + var typeSymbol = exports2 && getSymbol( + exports2, + JsxNames.Element, + 788968 + /* SymbolFlags.Type */ + ); + var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968, node); + var declaration = ts6.factory.createFunctionTypeNode( + /*typeParameters*/ + void 0, + [ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotdotdot*/ + void 0, + "props", + /*questionMark*/ + void 0, + nodeBuilder.typeToTypeNode(result, node) + )], + returnNode ? ts6.factory.createTypeReferenceNode( + returnNode, + /*typeArguments*/ + void 0 + ) : ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ) + ); + var parameterSymbol = createSymbol(1, "props"); + parameterSymbol.type = result; + return createSignature( + declaration, + /*typeParameters*/ + void 0, + /*thisParameter*/ + void 0, + [parameterSymbol], + typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, + /*returnTypePredicate*/ + void 0, + 1, + 0 + /* SignatureFlags.None */ + ); + } + function resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + var result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + var fakeSignature = createSignatureForJSXIntrinsic(node, result); + checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType( + node.attributes, + getEffectiveFirstArgumentForJsxSignature(fakeSignature, node), + /*mapper*/ + void 0, + 0 + /* CheckMode.Normal */ + ), result, node.tagName, node.attributes); + if (ts6.length(node.typeArguments)) { + ts6.forEach(node.typeArguments, checkSourceElement); + diagnostics.add(ts6.createDiagnosticForNodeArray(ts6.getSourceFileOfNode(node), node.typeArguments, ts6.Diagnostics.Expected_0_type_arguments_but_got_1, 0, ts6.length(node.typeArguments))); + } + return fakeSignature; + } + var exprTypes = checkExpression(node.tagName); + var apparentType = getApparentType(exprTypes); + if (isErrorType(apparentType)) { + return resolveErrorCall(node); + } + var signatures = getUninstantiatedJsxSignaturesOfType(exprTypes, node); + if (isUntypedFunctionCall( + exprTypes, + apparentType, + signatures.length, + /*constructSignatures*/ + 0 + )) { + return resolveUntypedCall(node); + } + if (signatures.length === 0) { + error(node.tagName, ts6.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts6.getTextOfNode(node.tagName)); + return resolveErrorCall(node); + } + return resolveCall( + node, + signatures, + candidatesOutArray, + checkMode, + 0 + /* SignatureFlags.None */ + ); + } + function isPotentiallyUncalledDecorator(decorator, signatures) { + return signatures.length && ts6.every(signatures, function(signature) { + return signature.minArgumentCount === 0 && !signatureHasRestParameter(signature) && signature.parameters.length < getDecoratorArgumentCount(decorator, signature); + }); + } + function resolveSignature(node, candidatesOutArray, checkMode) { + switch (node.kind) { + case 210: + return resolveCallExpression(node, candidatesOutArray, checkMode); + case 211: + return resolveNewExpression(node, candidatesOutArray, checkMode); + case 212: + return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); + case 167: + return resolveDecorator(node, candidatesOutArray, checkMode); + case 283: + case 282: + return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); + } + throw ts6.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); + } + function getResolvedSignature(node, candidatesOutArray, checkMode) { + var links = getNodeLinks(node); + var cached = links.resolvedSignature; + if (cached && cached !== resolvingSignature && !candidatesOutArray) { + return cached; + } + links.resolvedSignature = resolvingSignature; + var result = resolveSignature( + node, + candidatesOutArray, + checkMode || 0 + /* CheckMode.Normal */ + ); + if (result !== resolvingSignature) { + links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; + } + return result; + } + function isJSConstructor(node) { + var _a; + if (!node || !ts6.isInJSFile(node)) { + return false; + } + var func = ts6.isFunctionDeclaration(node) || ts6.isFunctionExpression(node) ? node : (ts6.isVariableDeclaration(node) || ts6.isPropertyAssignment(node)) && node.initializer && ts6.isFunctionExpression(node.initializer) ? node.initializer : void 0; + if (func) { + if (ts6.getJSDocClassTag(node)) + return true; + if (ts6.isPropertyAssignment(ts6.walkUpParenthesizedExpressions(func.parent))) + return false; + var symbol = getSymbolOfNode(func); + return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); + } + return false; + } + function mergeJSSymbols(target, source) { + var _a, _b; + if (source) { + var links = getSymbolLinks(source); + if (!links.inferredClassSymbol || !links.inferredClassSymbol.has(getSymbolId(target))) { + var inferred = ts6.isTransientSymbol(target) ? target : cloneSymbol(target); + inferred.exports = inferred.exports || ts6.createSymbolTable(); + inferred.members = inferred.members || ts6.createSymbolTable(); + inferred.flags |= source.flags & 32; + if ((_a = source.exports) === null || _a === void 0 ? void 0 : _a.size) { + mergeSymbolTable(inferred.exports, source.exports); + } + if ((_b = source.members) === null || _b === void 0 ? void 0 : _b.size) { + mergeSymbolTable(inferred.members, source.members); + } + (links.inferredClassSymbol || (links.inferredClassSymbol = new ts6.Map())).set(getSymbolId(inferred), inferred); + return inferred; + } + return links.inferredClassSymbol.get(getSymbolId(target)); + } + } + function getAssignedClassSymbol(decl) { + var _a; + var assignmentSymbol = decl && getSymbolOfExpando( + decl, + /*allowDeclaration*/ + true + ); + var prototype = (_a = assignmentSymbol === null || assignmentSymbol === void 0 ? void 0 : assignmentSymbol.exports) === null || _a === void 0 ? void 0 : _a.get("prototype"); + var init = (prototype === null || prototype === void 0 ? void 0 : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration); + return init ? getSymbolOfNode(init) : void 0; + } + function getSymbolOfExpando(node, allowDeclaration) { + if (!node.parent) { + return void 0; + } + var name; + var decl; + if (ts6.isVariableDeclaration(node.parent) && node.parent.initializer === node) { + if (!ts6.isInJSFile(node) && !(ts6.isVarConst(node.parent) && ts6.isFunctionLikeDeclaration(node))) { + return void 0; + } + name = node.parent.name; + decl = node.parent; + } else if (ts6.isBinaryExpression(node.parent)) { + var parentNode = node.parent; + var parentNodeOperator = node.parent.operatorToken.kind; + if (parentNodeOperator === 63 && (allowDeclaration || parentNode.right === node)) { + name = parentNode.left; + decl = name; + } else if (parentNodeOperator === 56 || parentNodeOperator === 60) { + if (ts6.isVariableDeclaration(parentNode.parent) && parentNode.parent.initializer === parentNode) { + name = parentNode.parent.name; + decl = parentNode.parent; + } else if (ts6.isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === 63 && (allowDeclaration || parentNode.parent.right === parentNode)) { + name = parentNode.parent.left; + decl = name; + } + if (!name || !ts6.isBindableStaticNameExpression(name) || !ts6.isSameEntityName(name, parentNode.left)) { + return void 0; + } + } + } else if (allowDeclaration && ts6.isFunctionDeclaration(node)) { + name = node.name; + decl = node; + } + if (!decl || !name || !allowDeclaration && !ts6.getExpandoInitializer(node, ts6.isPrototypeAccess(name))) { + return void 0; + } + return getSymbolOfNode(decl); + } + function getAssignedJSPrototype(node) { + if (!node.parent) { + return false; + } + var parent = node.parent; + while (parent && parent.kind === 208) { + parent = parent.parent; + } + if (parent && ts6.isBinaryExpression(parent) && ts6.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63) { + var right = ts6.getInitializerOfBinaryExpression(parent); + return ts6.isObjectLiteralExpression(right) && right; + } + } + function checkCallExpression(node, checkMode) { + var _a; + checkGrammarTypeArguments(node, node.typeArguments); + var signature = getResolvedSignature( + node, + /*candidatesOutArray*/ + void 0, + checkMode + ); + if (signature === resolvingSignature) { + return silentNeverType; + } + checkDeprecatedSignature(signature, node); + if (node.expression.kind === 106) { + return voidType; + } + if (node.kind === 211) { + var declaration = signature.declaration; + if (declaration && declaration.kind !== 173 && declaration.kind !== 177 && declaration.kind !== 182 && !ts6.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { + if (noImplicitAny) { + error(node, ts6.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + } + return anyType; + } + } + if (ts6.isInJSFile(node) && isCommonJsRequire(node)) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } + var returnType = getReturnTypeOfSignature(signature); + if (returnType.flags & 12288 && isSymbolOrSymbolForCall(node)) { + return getESSymbolLikeTypeForNode(ts6.walkUpParenthesizedExpressions(node.parent)); + } + if (node.kind === 210 && !node.questionDotToken && node.parent.kind === 241 && returnType.flags & 16384 && getTypePredicateOfSignature(signature)) { + if (!ts6.isDottedName(node.expression)) { + error(node.expression, ts6.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); + } else if (!getEffectsSignature(node)) { + var diagnostic = error(node.expression, ts6.Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation); + getTypeOfDottedName(node.expression, diagnostic); + } + } + if (ts6.isInJSFile(node)) { + var jsSymbol = getSymbolOfExpando( + node, + /*allowDeclaration*/ + false + ); + if ((_a = jsSymbol === null || jsSymbol === void 0 ? void 0 : jsSymbol.exports) === null || _a === void 0 ? void 0 : _a.size) { + var jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + jsAssignmentType.objectFlags |= 4096; + return getIntersectionType([returnType, jsAssignmentType]); + } + } + return returnType; + } + function checkDeprecatedSignature(signature, node) { + if (signature.declaration && signature.declaration.flags & 268435456) { + var suggestionNode = getDeprecatedSuggestionNode(node); + var name = ts6.tryGetPropertyAccessOrIdentifierToString(ts6.getInvokedExpression(node)); + addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature)); + } + } + function getDeprecatedSuggestionNode(node) { + node = ts6.skipParentheses(node); + switch (node.kind) { + case 210: + case 167: + case 211: + return getDeprecatedSuggestionNode(node.expression); + case 212: + return getDeprecatedSuggestionNode(node.tag); + case 283: + case 282: + return getDeprecatedSuggestionNode(node.tagName); + case 209: + return node.argumentExpression; + case 208: + return node.name; + case 180: + var typeReference = node; + return ts6.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; + default: + return node; + } + } + function isSymbolOrSymbolForCall(node) { + if (!ts6.isCallExpression(node)) + return false; + var left = node.expression; + if (ts6.isPropertyAccessExpression(left) && left.name.escapedText === "for") { + left = left.expression; + } + if (!ts6.isIdentifier(left) || left.escapedText !== "Symbol") { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol( + /*reportErrors*/ + false + ); + if (!globalESSymbol) { + return false; + } + return globalESSymbol === resolveName( + left, + "Symbol", + 111551, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + ); + } + function checkImportCallExpression(node) { + checkGrammarImportCallExpression(node); + if (node.arguments.length === 0) { + return createPromiseReturnType(node, anyType); + } + var specifier = node.arguments[0]; + var specifierType = checkExpressionCached(specifier); + var optionsType = node.arguments.length > 1 ? checkExpressionCached(node.arguments[1]) : void 0; + for (var i = 2; i < node.arguments.length; ++i) { + checkExpressionCached(node.arguments[i]); + } + if (specifierType.flags & 32768 || specifierType.flags & 65536 || !isTypeAssignableTo(specifierType, stringType)) { + error(specifier, ts6.Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); + } + if (optionsType) { + var importCallOptionsType = getGlobalImportCallOptionsType( + /*reportErrors*/ + true + ); + if (importCallOptionsType !== emptyObjectType) { + checkTypeAssignableTo(optionsType, getNullableType( + importCallOptionsType, + 32768 + /* TypeFlags.Undefined */ + ), node.arguments[1]); + } + } + var moduleSymbol = resolveExternalModuleName(node, specifier); + if (moduleSymbol) { + var esModuleSymbol = resolveESModuleSymbol( + moduleSymbol, + specifier, + /*dontRecursivelyResolve*/ + true, + /*suppressUsageError*/ + false + ); + if (esModuleSymbol) { + return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) || getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier)); + } + } + return createPromiseReturnType(node, anyType); + } + function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) { + var memberTable = ts6.createSymbolTable(); + var newSymbol = createSymbol( + 2097152, + "default" + /* InternalSymbolName.Default */ + ); + newSymbol.parent = originalSymbol; + newSymbol.nameType = getStringLiteralType("default"); + newSymbol.aliasTarget = resolveSymbol(symbol); + memberTable.set("default", newSymbol); + return createAnonymousType(anonymousSymbol, memberTable, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + } + function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) { + var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier); + if (hasDefaultOnly && type && !isErrorType(type)) { + var synthType = type; + if (!synthType.defaultOnlyType) { + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; + } + return synthType.defaultOnlyType; + } + return void 0; + } + function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) { + var _a; + if (allowSyntheticDefaultImports && type && !isErrorType(type)) { + var synthType = type; + if (!synthType.syntheticType) { + var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts6.isSourceFile); + var hasSyntheticDefault = canHaveSyntheticDefault( + file, + originalSymbol, + /*dontResolveAlias*/ + false, + moduleSpecifier + ); + if (hasSyntheticDefault) { + var anonymousSymbol = createSymbol( + 2048, + "__type" + /* InternalSymbolName.Type */ + ); + var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol); + anonymousSymbol.type = defaultContainingObject; + synthType.syntheticType = isValidSpreadType(type) ? getSpreadType( + type, + defaultContainingObject, + anonymousSymbol, + /*objectFlags*/ + 0, + /*readonly*/ + false + ) : defaultContainingObject; + } else { + synthType.syntheticType = type; + } + } + return synthType.syntheticType; + } + return type; + } + function isCommonJsRequire(node) { + if (!ts6.isRequireCall( + node, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + return false; + } + if (!ts6.isIdentifier(node.expression)) + return ts6.Debug.fail(); + var resolvedRequire = resolveName( + node.expression, + node.expression.escapedText, + 111551, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + true + ); + if (resolvedRequire === requireSymbol) { + return true; + } + if (resolvedRequire.flags & 2097152) { + return false; + } + var targetDeclarationKind = resolvedRequire.flags & 16 ? 259 : resolvedRequire.flags & 3 ? 257 : 0; + if (targetDeclarationKind !== 0) { + var decl = ts6.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); + return !!decl && !!(decl.flags & 16777216); + } + return false; + } + function checkTaggedTemplateExpression(node) { + if (!checkGrammarTaggedTemplateChain(node)) + checkGrammarTypeArguments(node, node.typeArguments); + if (languageVersion < 2) { + checkExternalEmitHelpers( + node, + 262144 + /* ExternalEmitHelpers.MakeTemplateObject */ + ); + } + var signature = getResolvedSignature(node); + checkDeprecatedSignature(signature, node); + return getReturnTypeOfSignature(signature); + } + function checkAssertion(node) { + if (node.kind === 213) { + var file = ts6.getSourceFileOfNode(node); + if (file && ts6.fileExtensionIsOneOf(file.fileName, [ + ".cts", + ".mts" + /* Extension.Mts */ + ])) { + grammarErrorOnNode(node, ts6.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); + } + } + return checkAssertionWorker(node, node.type, node.expression); + } + function isValidConstAssertionArgument(node) { + switch (node.kind) { + case 10: + case 14: + case 8: + case 9: + case 110: + case 95: + case 206: + case 207: + case 225: + return true; + case 214: + return isValidConstAssertionArgument(node.expression); + case 221: + var op = node.operator; + var arg = node.operand; + return op === 40 && (arg.kind === 8 || arg.kind === 9) || op === 39 && arg.kind === 8; + case 208: + case 209: + var expr = node.expression; + var symbol = getTypeOfNode(expr).symbol; + if (symbol && symbol.flags & 2097152) { + symbol = resolveAlias(symbol); + } + return !!(symbol && getAllSymbolFlags(symbol) & 384 && getEnumKind(symbol) === 1); + } + return false; + } + function checkAssertionWorker(errNode, type, expression, checkMode) { + var exprType = checkExpression(expression, checkMode); + if (ts6.isConstTypeReference(type)) { + if (!isValidConstAssertionArgument(expression)) { + error(expression, ts6.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); + } + return getRegularTypeOfLiteralType(exprType); + } + checkSourceElement(type); + exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType)); + var targetType = getTypeFromTypeNode(type); + if (!isErrorType(targetType)) { + addLazyDiagnostic(function() { + var widenedType = getWidenedType(exprType); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, errNode, ts6.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first); + } + }); + } + return targetType; + } + function checkNonNullChain(node) { + var leftType = checkExpression(node.expression); + var nonOptionalType = getOptionalExpressionType(leftType, node.expression); + return propagateOptionalTypeMarker(getNonNullableType(nonOptionalType), node, nonOptionalType !== leftType); + } + function checkNonNullAssertion(node) { + return node.flags & 32 ? checkNonNullChain(node) : getNonNullableType(checkExpression(node.expression)); + } + function checkExpressionWithTypeArguments(node) { + checkGrammarExpressionWithTypeArguments(node); + var exprType = node.kind === 230 ? checkExpression(node.expression) : ts6.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); + var typeArguments = node.typeArguments; + if (exprType === silentNeverType || isErrorType(exprType) || !ts6.some(typeArguments)) { + return exprType; + } + var hasSomeApplicableSignature = false; + var nonApplicableType; + var result = getInstantiatedType(exprType); + var errorType2 = hasSomeApplicableSignature ? nonApplicableType : exprType; + if (errorType2) { + diagnostics.add(ts6.createDiagnosticForNodeArray(ts6.getSourceFileOfNode(node), typeArguments, ts6.Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType2))); + } + return result; + function getInstantiatedType(type) { + var hasSignatures = false; + var hasApplicableSignature = false; + var result2 = getInstantiatedTypePart(type); + hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature); + if (hasSignatures && !hasApplicableSignature) { + nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : nonApplicableType = type; + } + return result2; + function getInstantiatedTypePart(type2) { + if (type2.flags & 524288) { + var resolved = resolveStructuredTypeMembers(type2); + var callSignatures = getInstantiatedSignatures(resolved.callSignatures); + var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures); + hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0); + hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0); + if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) { + var result_11 = createAnonymousType(void 0, resolved.members, callSignatures, constructSignatures, resolved.indexInfos); + result_11.objectFlags |= 8388608; + result_11.node = node; + return result_11; + } + } else if (type2.flags & 58982400) { + var constraint = getBaseConstraintOfType(type2); + if (constraint) { + var instantiated = getInstantiatedTypePart(constraint); + if (instantiated !== constraint) { + return instantiated; + } + } + } else if (type2.flags & 1048576) { + return mapType(type2, getInstantiatedType); + } else if (type2.flags & 2097152) { + return getIntersectionType(ts6.sameMap(type2.types, getInstantiatedTypePart)); + } + return type2; + } + } + function getInstantiatedSignatures(signatures) { + var applicableSignatures = ts6.filter(signatures, function(sig) { + return !!sig.typeParameters && hasCorrectTypeArgumentArity(sig, typeArguments); + }); + return ts6.sameMap(applicableSignatures, function(sig) { + var typeArgumentTypes = checkTypeArguments( + sig, + typeArguments, + /*reportErrors*/ + true + ); + return typeArgumentTypes ? getSignatureInstantiation(sig, typeArgumentTypes, ts6.isInJSFile(sig.declaration)) : sig; + }); + } + } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var exprType = checkExpression(node.expression); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts6.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + if (node.keywordToken === 103) { + return checkNewTargetMetaProperty(node); + } + if (node.keywordToken === 100) { + return checkImportMetaProperty(node); + } + return ts6.Debug.assertNever(node.keywordToken); + } + function checkMetaPropertyKeyword(node) { + switch (node.keywordToken) { + case 100: + return getGlobalImportMetaExpressionType(); + case 103: + var type = checkNewTargetMetaProperty(node); + return isErrorType(type) ? errorType : createNewTargetExpressionType(type); + default: + ts6.Debug.assertNever(node.keywordToken); + } + } + function checkNewTargetMetaProperty(node) { + var container = ts6.getNewTargetContainer(node); + if (!container) { + error(node, ts6.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return errorType; + } else if (container.kind === 173) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } + function checkImportMetaProperty(node) { + if (moduleKind === ts6.ModuleKind.Node16 || moduleKind === ts6.ModuleKind.NodeNext) { + if (ts6.getSourceFileOfNode(node).impliedNodeFormat !== ts6.ModuleKind.ESNext) { + error(node, ts6.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output); + } + } else if (moduleKind < ts6.ModuleKind.ES2020 && moduleKind !== ts6.ModuleKind.System) { + error(node, ts6.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext); + } + var file = ts6.getSourceFileOfNode(node); + ts6.Debug.assert(!!(file.flags & 4194304), "Containing file is missing import meta node flag."); + return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType; + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && ts6.hasInitializer(declaration)) { + return getOptionalType(type); + } + } + return type; + } + function getTupleElementLabel(d) { + ts6.Debug.assert(ts6.isIdentifier(d.name)); + return d.name.escapedText; + } + function getParameterNameAtPosition(signature, pos, overrideRestType) { + var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + if (pos < paramCount) { + return signature.parameters[pos].escapedName; + } + var restParameter = signature.parameters[paramCount] || unknownSymbol; + var restType = overrideRestType || getTypeOfSymbol(restParameter); + if (isTupleType(restType)) { + var associatedNames = restType.target.labeledElementDeclarations; + var index = pos - paramCount; + return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index; + } + return restParameter.escapedName; + } + function getParameterIdentifierNameAtPosition(signature, pos) { + var _a; + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320) { + return void 0; + } + var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + if (pos < paramCount) { + var param = signature.parameters[pos]; + return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : void 0; + } + var restParameter = signature.parameters[paramCount] || unknownSymbol; + if (!isParameterDeclarationWithIdentifierName(restParameter)) { + return void 0; + } + var restType = getTypeOfSymbol(restParameter); + if (isTupleType(restType)) { + var associatedNames = restType.target.labeledElementDeclarations; + var index = pos - paramCount; + var associatedName = associatedNames === null || associatedNames === void 0 ? void 0 : associatedNames[index]; + var isRestTupleElement = !!(associatedName === null || associatedName === void 0 ? void 0 : associatedName.dotDotDotToken); + return associatedName ? [ + getTupleElementLabel(associatedName), + isRestTupleElement + ] : void 0; + } + if (pos === paramCount) { + return [restParameter.escapedName, true]; + } + return void 0; + } + function isParameterDeclarationWithIdentifierName(symbol) { + return symbol.valueDeclaration && ts6.isParameter(symbol.valueDeclaration) && ts6.isIdentifier(symbol.valueDeclaration.name); + } + function isValidDeclarationForTupleLabel(d) { + return d.kind === 199 || ts6.isParameter(d) && d.name && ts6.isIdentifier(d.name); + } + function getNameableDeclarationAtPosition(signature, pos) { + var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + if (pos < paramCount) { + var decl = signature.parameters[pos].valueDeclaration; + return decl && isValidDeclarationForTupleLabel(decl) ? decl : void 0; + } + var restParameter = signature.parameters[paramCount] || unknownSymbol; + var restType = getTypeOfSymbol(restParameter); + if (isTupleType(restType)) { + var associatedNames = restType.target.labeledElementDeclarations; + var index = pos - paramCount; + return associatedNames && associatedNames[index]; + } + return restParameter.valueDeclaration && isValidDeclarationForTupleLabel(restParameter.valueDeclaration) ? restParameter.valueDeclaration : void 0; + } + function getTypeAtPosition(signature, pos) { + return tryGetTypeAtPosition(signature, pos) || anyType; + } + function tryGetTypeAtPosition(signature, pos) { + var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + if (pos < paramCount) { + return getTypeOfParameter(signature.parameters[pos]); + } + if (signatureHasRestParameter(signature)) { + var restType = getTypeOfSymbol(signature.parameters[paramCount]); + var index = pos - paramCount; + if (!isTupleType(restType) || restType.target.hasRestElement || index < restType.target.fixedLength) { + return getIndexedAccessType(restType, getNumberLiteralType(index)); + } + } + return void 0; + } + function getRestTypeAtPosition(source, pos) { + var parameterCount = getParameterCount(source); + var minArgumentCount = getMinArgumentCount(source); + var restType = getEffectiveRestType(source); + if (restType && pos >= parameterCount - 1) { + return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType)); + } + var types = []; + var flags = []; + var names = []; + for (var i = pos; i < parameterCount; i++) { + if (!restType || i < parameterCount - 1) { + types.push(getTypeAtPosition(source, i)); + flags.push( + i < minArgumentCount ? 1 : 2 + /* ElementFlags.Optional */ + ); + } else { + types.push(restType); + flags.push( + 8 + /* ElementFlags.Variadic */ + ); + } + var name = getNameableDeclarationAtPosition(source, i); + if (name) { + names.push(name); + } + } + return createTupleType( + types, + flags, + /*readonly*/ + false, + ts6.length(names) === ts6.length(types) ? names : void 0 + ); + } + function getParameterCount(signature) { + var length = signature.parameters.length; + if (signatureHasRestParameter(signature)) { + var restType = getTypeOfSymbol(signature.parameters[length - 1]); + if (isTupleType(restType)) { + return length + restType.target.fixedLength - (restType.target.hasRestElement ? 0 : 1); + } + } + return length; + } + function getMinArgumentCount(signature, flags) { + var strongArityForUntypedJS = flags & 1; + var voidIsNonOptional = flags & 2; + if (voidIsNonOptional || signature.resolvedMinArgumentCount === void 0) { + var minArgumentCount = void 0; + if (signatureHasRestParameter(signature)) { + var restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + if (isTupleType(restType)) { + var firstOptionalIndex = ts6.findIndex(restType.target.elementFlags, function(f) { + return !(f & 1); + }); + var requiredCount = firstOptionalIndex < 0 ? restType.target.fixedLength : firstOptionalIndex; + if (requiredCount > 0) { + minArgumentCount = signature.parameters.length - 1 + requiredCount; + } + } + } + if (minArgumentCount === void 0) { + if (!strongArityForUntypedJS && signature.flags & 32) { + return 0; + } + minArgumentCount = signature.minArgumentCount; + } + if (voidIsNonOptional) { + return minArgumentCount; + } + for (var i = minArgumentCount - 1; i >= 0; i--) { + var type = getTypeAtPosition(signature, i); + if (filterType(type, acceptsVoid).flags & 131072) { + break; + } + minArgumentCount = i; + } + signature.resolvedMinArgumentCount = minArgumentCount; + } + return signature.resolvedMinArgumentCount; + } + function hasEffectiveRestParameter(signature) { + if (signatureHasRestParameter(signature)) { + var restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + return !isTupleType(restType) || restType.target.hasRestElement; + } + return false; + } + function getEffectiveRestType(signature) { + if (signatureHasRestParameter(signature)) { + var restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + if (!isTupleType(restType)) { + return restType; + } + if (restType.target.hasRestElement) { + return sliceTupleType(restType, restType.target.fixedLength); + } + } + return void 0; + } + function getNonArrayRestType(signature) { + var restType = getEffectiveRestType(signature); + return restType && !isArrayType(restType) && !isTypeAny(restType) && (getReducedType(restType).flags & 131072) === 0 ? restType : void 0; + } + function getTypeOfFirstParameterOfSignature(signature) { + return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); + } + function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType; + } + function inferFromAnnotatedParameters(signature, context, inferenceContext) { + var len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + for (var i = 0; i < len; i++) { + var declaration = signature.parameters[i].valueDeclaration; + if (declaration.type) { + var typeNode = ts6.getEffectiveTypeAnnotationNode(declaration); + if (typeNode) { + inferTypes(inferenceContext.inferences, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i)); + } + } + } + } + function assignContextualParameterTypes(signature, context) { + if (context.typeParameters) { + if (!signature.typeParameters) { + signature.typeParameters = context.typeParameters; + } else { + return; + } + } + if (context.thisParameter) { + var parameter = signature.thisParameter; + if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { + if (!parameter) { + signature.thisParameter = createSymbolWithType( + context.thisParameter, + /*type*/ + void 0 + ); + } + assignParameterType(signature.thisParameter, getTypeOfSymbol(context.thisParameter)); + } + } + var len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); + for (var i = 0; i < len; i++) { + var parameter = signature.parameters[i]; + if (!ts6.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) { + var contextualParameterType = tryGetTypeAtPosition(context, i); + assignParameterType(parameter, contextualParameterType); + } + } + if (signatureHasRestParameter(signature)) { + var parameter = ts6.last(signature.parameters); + if (parameter.valueDeclaration ? !ts6.getEffectiveTypeAnnotationNode(parameter.valueDeclaration) : !!(ts6.getCheckFlags(parameter) & 65536)) { + var contextualParameterType = getRestTypeAtPosition(context, len); + assignParameterType(parameter, contextualParameterType); + } + } + } + function assignNonContextualParameterTypes(signature) { + if (signature.thisParameter) { + assignParameterType(signature.thisParameter); + } + for (var _i = 0, _a = signature.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + assignParameterType(parameter); + } + } + function assignParameterType(parameter, type) { + var links = getSymbolLinks(parameter); + if (!links.type) { + var declaration = parameter.valueDeclaration; + links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration( + declaration, + /*reportErrors*/ + true + ) : getTypeOfSymbol(parameter)); + if (declaration && declaration.name.kind !== 79) { + if (links.type === unknownType) { + links.type = getTypeFromBindingPattern(declaration.name); + } + assignBindingElementTypes(declaration.name, links.type); + } + } else if (type) { + ts6.Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type"); + } + } + function assignBindingElementTypes(pattern, parentType) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + var type = getBindingElementTypeFromParentType(element, parentType); + if (element.name.kind === 79) { + getSymbolLinks(getSymbolOfNode(element)).type = type; + } else { + assignBindingElementTypes(element.name, type); + } + } + } + } + function createPromiseType(promisedType) { + var globalPromiseType = getGlobalPromiseType( + /*reportErrors*/ + true + ); + if (globalPromiseType !== emptyGenericType) { + promisedType = getAwaitedTypeNoAlias(unwrapAwaitedType(promisedType)) || unknownType; + return createTypeReference(globalPromiseType, [promisedType]); + } + return unknownType; + } + function createPromiseLikeType(promisedType) { + var globalPromiseLikeType = getGlobalPromiseLikeType( + /*reportErrors*/ + true + ); + if (globalPromiseLikeType !== emptyGenericType) { + promisedType = getAwaitedTypeNoAlias(unwrapAwaitedType(promisedType)) || unknownType; + return createTypeReference(globalPromiseLikeType, [promisedType]); + } + return unknownType; + } + function createPromiseReturnType(func, promisedType) { + var promiseType = createPromiseType(promisedType); + if (promiseType === unknownType) { + error(func, ts6.isImportCall(func) ? ts6.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : ts6.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); + return errorType; + } else if (!getGlobalPromiseConstructorSymbol( + /*reportErrors*/ + true + )) { + error(func, ts6.isImportCall(func) ? ts6.Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : ts6.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + return promiseType; + } + function createNewTargetExpressionType(targetType) { + var symbol = createSymbol(0, "NewTargetExpression"); + var targetPropertySymbol = createSymbol( + 4, + "target", + 8 + /* CheckFlags.Readonly */ + ); + targetPropertySymbol.parent = symbol; + targetPropertySymbol.type = targetType; + var members = ts6.createSymbolTable([targetPropertySymbol]); + symbol.members = members; + return createAnonymousType(symbol, members, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + } + function getReturnTypeFromBody(func, checkMode) { + if (!func.body) { + return errorType; + } + var functionFlags = ts6.getFunctionFlags(func); + var isAsync = (functionFlags & 2) !== 0; + var isGenerator = (functionFlags & 1) !== 0; + var returnType; + var yieldType; + var nextType; + var fallbackReturnType = voidType; + if (func.body.kind !== 238) { + returnType = checkExpressionCached( + func.body, + checkMode && checkMode & ~8 + /* CheckMode.SkipGenericFunctions */ + ); + if (isAsync) { + returnType = unwrapAwaitedType(checkAwaitedType( + returnType, + /*withAlias*/ + false, + /*errorNode*/ + func, + ts6.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + )); + } + } else if (isGenerator) { + var returnTypes = checkAndAggregateReturnExpressionTypes(func, checkMode); + if (!returnTypes) { + fallbackReturnType = neverType; + } else if (returnTypes.length > 0) { + returnType = getUnionType( + returnTypes, + 2 + /* UnionReduction.Subtype */ + ); + } + var _a = checkAndAggregateYieldOperandTypes(func, checkMode), yieldTypes = _a.yieldTypes, nextTypes = _a.nextTypes; + yieldType = ts6.some(yieldTypes) ? getUnionType( + yieldTypes, + 2 + /* UnionReduction.Subtype */ + ) : void 0; + nextType = ts6.some(nextTypes) ? getIntersectionType(nextTypes) : void 0; + } else { + var types = checkAndAggregateReturnExpressionTypes(func, checkMode); + if (!types) { + return functionFlags & 2 ? createPromiseReturnType(func, neverType) : neverType; + } + if (types.length === 0) { + return functionFlags & 2 ? createPromiseReturnType(func, voidType) : voidType; + } + returnType = getUnionType( + types, + 2 + /* UnionReduction.Subtype */ + ); + } + if (returnType || yieldType || nextType) { + if (yieldType) + reportErrorsFromWidening( + func, + yieldType, + 3 + /* WideningKind.GeneratorYield */ + ); + if (returnType) + reportErrorsFromWidening( + func, + returnType, + 1 + /* WideningKind.FunctionReturn */ + ); + if (nextType) + reportErrorsFromWidening( + func, + nextType, + 2 + /* WideningKind.GeneratorNext */ + ); + if (returnType && isUnitType(returnType) || yieldType && isUnitType(yieldType) || nextType && isUnitType(nextType)) { + var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + var contextualType = !contextualSignature ? void 0 : contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? void 0 : returnType : instantiateContextualType( + getReturnTypeOfSignature(contextualSignature), + func, + /*contextFlags*/ + void 0 + ); + if (isGenerator) { + yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync); + returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync); + nextType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(nextType, contextualType, 2, isAsync); + } else { + returnType = getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(returnType, contextualType, isAsync); + } + } + if (yieldType) + yieldType = getWidenedType(yieldType); + if (returnType) + returnType = getWidenedType(returnType); + if (nextType) + nextType = getWidenedType(nextType); + } + if (isGenerator) { + return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2, func) || unknownType, isAsync); + } else { + return isAsync ? createPromiseType(returnType || fallbackReturnType) : returnType || fallbackReturnType; + } + } + function createGeneratorReturnType(yieldType, returnType, nextType, isAsyncGenerator) { + var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver; + var globalGeneratorType = resolver.getGlobalGeneratorType( + /*reportErrors*/ + false + ); + yieldType = resolver.resolveIterationType( + yieldType, + /*errorNode*/ + void 0 + ) || unknownType; + returnType = resolver.resolveIterationType( + returnType, + /*errorNode*/ + void 0 + ) || unknownType; + nextType = resolver.resolveIterationType( + nextType, + /*errorNode*/ + void 0 + ) || unknownType; + if (globalGeneratorType === emptyGenericType) { + var globalType = resolver.getGlobalIterableIteratorType( + /*reportErrors*/ + false + ); + var iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : void 0; + var iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType; + var iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType; + if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) { + if (globalType !== emptyGenericType) { + return createTypeFromGenericGlobalType(globalType, [yieldType]); + } + resolver.getGlobalIterableIteratorType( + /*reportErrors*/ + true + ); + return emptyObjectType; + } + resolver.getGlobalGeneratorType( + /*reportErrors*/ + true + ); + return emptyObjectType; + } + return createTypeFromGenericGlobalType(globalGeneratorType, [yieldType, returnType, nextType]); + } + function checkAndAggregateYieldOperandTypes(func, checkMode) { + var yieldTypes = []; + var nextTypes = []; + var isAsync = (ts6.getFunctionFlags(func) & 2) !== 0; + ts6.forEachYieldExpression(func.body, function(yieldExpression) { + var yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType; + ts6.pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync)); + var nextType; + if (yieldExpression.asteriskToken) { + var iterationTypes = getIterationTypesOfIterable(yieldExpressionType, isAsync ? 19 : 17, yieldExpression.expression); + nextType = iterationTypes && iterationTypes.nextType; + } else { + nextType = getContextualType( + yieldExpression, + /*contextFlags*/ + void 0 + ); + } + if (nextType) + ts6.pushIfUnique(nextTypes, nextType); + }); + return { yieldTypes, nextTypes }; + } + function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) { + var errorNode = node.expression || node; + var yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 : 17, expressionType, sentType, errorNode) : expressionType; + return !isAsync ? yieldedType : getAwaitedType(yieldedType, errorNode, node.asteriskToken ? ts6.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member : ts6.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); + } + function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) { + var facts = 0; + for (var i = 0; i < witnesses.length; i++) { + var witness = i < start || i >= end ? witnesses[i] : void 0; + facts |= witness !== void 0 ? typeofNEFacts.get(witness) || 32768 : 0; + } + return facts; + } + function isExhaustiveSwitchStatement(node) { + var links = getNodeLinks(node); + if (links.isExhaustive === void 0) { + links.isExhaustive = 0; + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } else if (links.isExhaustive === 0) { + links.isExhaustive = false; + } + return links.isExhaustive; + } + function computeExhaustiveSwitchStatement(node) { + if (node.expression.kind === 218) { + var witnesses = getSwitchClauseTypeOfWitnesses(node); + if (!witnesses) { + return false; + } + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); + var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); + if (operandConstraint.flags & 3) { + return (556800 & notEqualFacts_2) === 556800; + } + return !someType(operandConstraint, function(t) { + return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; + }); + } + var type = checkExpressionCached(node.expression); + if (!isLiteralType(type)) { + return false; + } + var switchTypes = getSwitchClauseTypes(node); + if (!switchTypes.length || ts6.some(switchTypes, isNeitherUnitTypeNorNever)) { + return false; + } + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); + } + function functionHasImplicitReturn(func) { + return func.endFlowNode && isReachableFlowNode(func.endFlowNode); + } + function checkAndAggregateReturnExpressionTypes(func, checkMode) { + var functionFlags = ts6.getFunctionFlags(func); + var aggregatedTypes = []; + var hasReturnWithNoExpression = functionHasImplicitReturn(func); + var hasReturnOfTypeNever = false; + ts6.forEachReturnStatement(func.body, function(returnStatement) { + var expr = returnStatement.expression; + if (expr) { + var type = checkExpressionCached( + expr, + checkMode && checkMode & ~8 + /* CheckMode.SkipGenericFunctions */ + ); + if (functionFlags & 2) { + type = unwrapAwaitedType(checkAwaitedType( + type, + /*withAlias*/ + false, + func, + ts6.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + )); + } + if (type.flags & 131072) { + hasReturnOfTypeNever = true; + } + ts6.pushIfUnique(aggregatedTypes, type); + } else { + hasReturnWithNoExpression = true; + } + }); + if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || mayReturnNever(func))) { + return void 0; + } + if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression && !(isJSConstructor(func) && aggregatedTypes.some(function(t) { + return t.symbol === func.symbol; + }))) { + ts6.pushIfUnique(aggregatedTypes, undefinedType); + } + return aggregatedTypes; + } + function mayReturnNever(func) { + switch (func.kind) { + case 215: + case 216: + return true; + case 171: + return func.parent.kind === 207; + default: + return false; + } + } + function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { + addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics); + return; + function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() { + var functionFlags = ts6.getFunctionFlags(func); + var type = returnType && unwrapReturnType(returnType, functionFlags); + if (type && maybeTypeOfKind( + type, + 1 | 16384 + /* TypeFlags.Void */ + )) { + return; + } + if (func.kind === 170 || ts6.nodeIsMissing(func.body) || func.body.kind !== 238 || !functionHasImplicitReturn(func)) { + return; + } + var hasExplicitReturn = func.flags & 512; + var errorNode = ts6.getEffectiveReturnTypeNode(func) || func; + if (type && type.flags & 131072) { + error(errorNode, ts6.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); + } else if (type && !hasExplicitReturn) { + error(errorNode, ts6.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); + } else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) { + error(errorNode, ts6.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } else if (compilerOptions.noImplicitReturns) { + if (!type) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + return; + } + } + error(errorNode, ts6.Diagnostics.Not_all_code_paths_return_a_value); + } + } + } + function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + ts6.Debug.assert(node.kind !== 171 || ts6.isObjectLiteralMethod(node)); + checkNodeDeferred(node); + if (ts6.isFunctionExpression(node)) { + checkCollisionsForDeclarationName(node, node.name); + } + if (checkMode && checkMode & 4 && isContextSensitive(node)) { + if (!ts6.getEffectiveReturnTypeNode(node) && !ts6.hasContextSensitiveParameters(node)) { + var contextualSignature = getContextualSignature(node); + if (contextualSignature && couldContainTypeVariables(getReturnTypeOfSignature(contextualSignature))) { + var links = getNodeLinks(node); + if (links.contextFreeType) { + return links.contextFreeType; + } + var returnType = getReturnTypeFromBody(node, checkMode); + var returnOnlySignature = createSignature( + void 0, + void 0, + void 0, + ts6.emptyArray, + returnType, + /*resolvedTypePredicate*/ + void 0, + 0, + 0 + /* SignatureFlags.None */ + ); + var returnOnlyType = createAnonymousType(node.symbol, emptySymbols, [returnOnlySignature], ts6.emptyArray, ts6.emptyArray); + returnOnlyType.objectFlags |= 262144; + return links.contextFreeType = returnOnlyType; + } + } + return anyFunctionType; + } + var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + if (!hasGrammarError && node.kind === 215) { + checkGrammarForGenerator(node); + } + contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return getTypeOfSymbol(getSymbolOfNode(node)); + } + function contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + var links = getNodeLinks(node); + if (!(links.flags & 1024)) { + var contextualSignature = getContextualSignature(node); + if (!(links.flags & 1024)) { + links.flags |= 1024; + var signature = ts6.firstOrUndefined(getSignaturesOfType( + getTypeOfSymbol(getSymbolOfNode(node)), + 0 + /* SignatureKind.Call */ + )); + if (!signature) { + return; + } + if (isContextSensitive(node)) { + if (contextualSignature) { + var inferenceContext = getInferenceContext(node); + var instantiatedContextualSignature = void 0; + if (checkMode && checkMode & 2) { + inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext); + var restType = getEffectiveRestType(contextualSignature); + if (restType && restType.flags & 262144) { + instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper); + } + } + instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ? instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature); + assignContextualParameterTypes(signature, instantiatedContextualSignature); + } else { + assignNonContextualParameterTypes(signature); + } + } + if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) { + var returnType = getReturnTypeFromBody(node, checkMode); + if (!signature.resolvedReturnType) { + signature.resolvedReturnType = returnType; + } + } + checkSignatureDeclaration(node); + } + } + } + function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { + ts6.Debug.assert(node.kind !== 171 || ts6.isObjectLiteralMethod(node)); + var functionFlags = ts6.getFunctionFlags(node); + var returnType = getReturnTypeFromAnnotation(node); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); + if (node.body) { + if (!ts6.getEffectiveReturnTypeNode(node)) { + getReturnTypeOfSignature(getSignatureFromDeclaration(node)); + } + if (node.body.kind === 238) { + checkSourceElement(node.body); + } else { + var exprType = checkExpression(node.body); + var returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags); + if (returnOrPromisedType) { + if ((functionFlags & 3) === 2) { + var awaitedType = checkAwaitedType( + exprType, + /*withAlias*/ + false, + node.body, + ts6.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + ); + checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, node.body, node.body); + } else { + checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, node.body, node.body); + } + } + } + } + } + function checkArithmeticOperandType(operand, type, diagnostic, isAwaitValid) { + if (isAwaitValid === void 0) { + isAwaitValid = false; + } + if (!isTypeAssignableTo(type, numberOrBigIntType)) { + var awaitedType = isAwaitValid && getAwaitedTypeOfPromise(type); + errorAndMaybeSuggestAwait(operand, !!awaitedType && isTypeAssignableTo(awaitedType, numberOrBigIntType), diagnostic); + return false; + } + return true; + } + function isReadonlyAssignmentDeclaration(d) { + if (!ts6.isCallExpression(d)) { + return false; + } + if (!ts6.isBindableObjectDefinePropertyCall(d)) { + return false; + } + var objectLitType = checkExpressionCached(d.arguments[2]); + var valueType = getTypeOfPropertyOfType(objectLitType, "value"); + if (valueType) { + var writableProp = getPropertyOfType(objectLitType, "writable"); + var writableType = writableProp && getTypeOfSymbol(writableProp); + if (!writableType || writableType === falseType || writableType === regularFalseType) { + return true; + } + if (writableProp && writableProp.valueDeclaration && ts6.isPropertyAssignment(writableProp.valueDeclaration)) { + var initializer = writableProp.valueDeclaration.initializer; + var rawOriginalType = checkExpression(initializer); + if (rawOriginalType === falseType || rawOriginalType === regularFalseType) { + return true; + } + } + return false; + } + var setProp = getPropertyOfType(objectLitType, "set"); + return !setProp; + } + function isReadonlySymbol(symbol) { + return !!(ts6.getCheckFlags(symbol) & 8 || symbol.flags & 4 && ts6.getDeclarationModifierFlagsFromSymbol(symbol) & 64 || symbol.flags & 3 && getDeclarationNodeFlagsFromSymbol(symbol) & 2 || symbol.flags & 98304 && !(symbol.flags & 65536) || symbol.flags & 8 || ts6.some(symbol.declarations, isReadonlyAssignmentDeclaration)); + } + function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) { + var _a, _b; + if (assignmentKind === 0) { + return false; + } + if (isReadonlySymbol(symbol)) { + if (symbol.flags & 4 && ts6.isAccessExpression(expr) && expr.expression.kind === 108) { + var ctor = ts6.getContainingFunction(expr); + if (!(ctor && (ctor.kind === 173 || isJSConstructor(ctor)))) { + return true; + } + if (symbol.valueDeclaration) { + var isAssignmentDeclaration_1 = ts6.isBinaryExpression(symbol.valueDeclaration); + var isLocalPropertyDeclaration = ctor.parent === symbol.valueDeclaration.parent; + var isLocalParameterProperty = ctor === symbol.valueDeclaration.parent; + var isLocalThisPropertyAssignment = isAssignmentDeclaration_1 && ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) === ctor.parent; + var isLocalThisPropertyAssignmentConstructorFunction = isAssignmentDeclaration_1 && ((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration) === ctor; + var isWriteableSymbol = isLocalPropertyDeclaration || isLocalParameterProperty || isLocalThisPropertyAssignment || isLocalThisPropertyAssignmentConstructorFunction; + return !isWriteableSymbol; + } + } + return true; + } + if (ts6.isAccessExpression(expr)) { + var node = ts6.skipParentheses(expr.expression); + if (node.kind === 79) { + var symbol_2 = getNodeLinks(node).resolvedSymbol; + if (symbol_2.flags & 2097152) { + var declaration = getDeclarationOfAliasSymbol(symbol_2); + return !!declaration && declaration.kind === 271; + } + } + } + return false; + } + function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) { + var node = ts6.skipOuterExpressions( + expr, + 6 | 1 + /* OuterExpressionKinds.Parentheses */ + ); + if (node.kind !== 79 && !ts6.isAccessExpression(node)) { + error(expr, invalidReferenceMessage); + return false; + } + if (node.flags & 32) { + error(expr, invalidOptionalChainMessage); + return false; + } + return true; + } + function checkDeleteExpression(node) { + checkExpression(node.expression); + var expr = ts6.skipParentheses(node.expression); + if (!ts6.isAccessExpression(expr)) { + error(expr, ts6.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + if (ts6.isPropertyAccessExpression(expr) && ts6.isPrivateIdentifier(expr.name)) { + error(expr, ts6.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier); + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol) { + if (isReadonlySymbol(symbol)) { + error(expr, ts6.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } + checkDeleteExpressionMustBeOptional(expr, symbol); + } + return booleanType; + } + function checkDeleteExpressionMustBeOptional(expr, symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks && !(type.flags & (3 | 131072)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 : getTypeFacts(type) & 16777216)) { + error(expr, ts6.Diagnostics.The_operand_of_a_delete_operator_must_be_optional); + } + } + function checkTypeOfExpression(node) { + checkExpression(node.expression); + return typeofType; + } + function checkVoidExpression(node) { + checkExpression(node.expression); + return undefinedWideningType; + } + function checkAwaitExpressionGrammar(node) { + var container = ts6.getContainingFunctionOrClassStaticBlock(node); + if (container && ts6.isClassStaticBlockDeclaration(container)) { + error(node, ts6.Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block); + } else if (!(node.flags & 32768)) { + if (ts6.isInTopLevelContext(node)) { + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = void 0; + if (!ts6.isEffectiveExternalModule(sourceFile, compilerOptions)) { + span !== null && span !== void 0 ? span : span = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos); + var diagnostic = ts6.createFileDiagnostic(sourceFile, span.start, span.length, ts6.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module); + diagnostics.add(diagnostic); + } + switch (moduleKind) { + case ts6.ModuleKind.Node16: + case ts6.ModuleKind.NodeNext: + if (sourceFile.impliedNodeFormat === ts6.ModuleKind.CommonJS) { + span !== null && span !== void 0 ? span : span = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts6.createFileDiagnostic(sourceFile, span.start, span.length, ts6.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)); + break; + } + case ts6.ModuleKind.ES2022: + case ts6.ModuleKind.ESNext: + case ts6.ModuleKind.System: + if (languageVersion >= 4) { + break; + } + default: + span !== null && span !== void 0 ? span : span = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts6.createFileDiagnostic(sourceFile, span.start, span.length, ts6.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)); + break; + } + } + } else { + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos); + var diagnostic = ts6.createFileDiagnostic(sourceFile, span.start, span.length, ts6.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); + if (container && container.kind !== 173 && (ts6.getFunctionFlags(container) & 2) === 0) { + var relatedInfo = ts6.createDiagnosticForNode(container, ts6.Diagnostics.Did_you_mean_to_mark_this_function_as_async); + ts6.addRelatedInfo(diagnostic, relatedInfo); + } + diagnostics.add(diagnostic); + } + } + } + if (isInParameterInitializerBeforeContainingFunction(node)) { + error(node, ts6.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer); + } + } + function checkAwaitExpression(node) { + addLazyDiagnostic(function() { + return checkAwaitExpressionGrammar(node); + }); + var operandType = checkExpression(node.expression); + var awaitedType = checkAwaitedType( + operandType, + /*withAlias*/ + true, + node, + ts6.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + ); + if (awaitedType === operandType && !isErrorType(awaitedType) && !(operandType.flags & 3)) { + addErrorOrSuggestion( + /*isError*/ + false, + ts6.createDiagnosticForNode(node, ts6.Diagnostics.await_has_no_effect_on_the_type_of_this_expression) + ); + } + return awaitedType; + } + function checkPrefixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + if (operandType === silentNeverType) { + return silentNeverType; + } + switch (node.operand.kind) { + case 8: + switch (node.operator) { + case 40: + return getFreshTypeOfLiteralType(getNumberLiteralType(-node.operand.text)); + case 39: + return getFreshTypeOfLiteralType(getNumberLiteralType(+node.operand.text)); + } + break; + case 9: + if (node.operator === 40) { + return getFreshTypeOfLiteralType(getBigIntLiteralType({ + negative: true, + base10Value: ts6.parsePseudoBigInt(node.operand.text) + })); + } + } + switch (node.operator) { + case 39: + case 40: + case 54: + checkNonNullType(operandType, node.operand); + if (maybeTypeOfKindConsideringBaseConstraint( + operandType, + 12288 + /* TypeFlags.ESSymbolLike */ + )) { + error(node.operand, ts6.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts6.tokenToString(node.operator)); + } + if (node.operator === 39) { + if (maybeTypeOfKindConsideringBaseConstraint( + operandType, + 2112 + /* TypeFlags.BigIntLike */ + )) { + error(node.operand, ts6.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts6.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); + } + return numberType; + } + return getUnaryResultType(operandType); + case 53: + checkTruthinessExpression(node.operand); + var facts = getTypeFacts(operandType) & (4194304 | 8388608); + return facts === 4194304 ? falseType : facts === 8388608 ? trueType : booleanType; + case 45: + case 46: + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts6.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts6.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access, ts6.Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access); + } + return getUnaryResultType(operandType); + } + return errorType; + } + function checkPostfixUnaryExpression(node) { + var operandType = checkExpression(node.operand); + if (operandType === silentNeverType) { + return silentNeverType; + } + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts6.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts6.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access, ts6.Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access); + } + return getUnaryResultType(operandType); + } + function getUnaryResultType(operandType) { + if (maybeTypeOfKind( + operandType, + 2112 + /* TypeFlags.BigIntLike */ + )) { + return isTypeAssignableToKind( + operandType, + 3 + /* TypeFlags.AnyOrUnknown */ + ) || maybeTypeOfKind( + operandType, + 296 + /* TypeFlags.NumberLike */ + ) ? numberOrBigIntType : bigintType; + } + return numberType; + } + function maybeTypeOfKindConsideringBaseConstraint(type, kind) { + if (maybeTypeOfKind(type, kind)) { + return true; + } + var baseConstraint = getBaseConstraintOrType(type); + return !!baseConstraint && maybeTypeOfKind(baseConstraint, kind); + } + function maybeTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 3145728) { + var types = type.types; + for (var _i = 0, types_20 = types; _i < types_20.length; _i++) { + var t = types_20[_i]; + if (maybeTypeOfKind(t, kind)) { + return true; + } + } + } + return false; + } + function isTypeAssignableToKind(source, kind, strict) { + if (source.flags & kind) { + return true; + } + if (strict && source.flags & (3 | 16384 | 32768 | 65536)) { + return false; + } + return !!(kind & 296) && isTypeAssignableTo(source, numberType) || !!(kind & 2112) && isTypeAssignableTo(source, bigintType) || !!(kind & 402653316) && isTypeAssignableTo(source, stringType) || !!(kind & 528) && isTypeAssignableTo(source, booleanType) || !!(kind & 16384) && isTypeAssignableTo(source, voidType) || !!(kind & 131072) && isTypeAssignableTo(source, neverType) || !!(kind & 65536) && isTypeAssignableTo(source, nullType) || !!(kind & 32768) && isTypeAssignableTo(source, undefinedType) || !!(kind & 4096) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 67108864) && isTypeAssignableTo(source, nonPrimitiveType); + } + function allTypesAssignableToKind(source, kind, strict) { + return source.flags & 1048576 ? ts6.every(source.types, function(subType) { + return allTypesAssignableToKind(subType, kind, strict); + }) : isTypeAssignableToKind(source, kind, strict); + } + function isConstEnumObjectType(type) { + return !!(ts6.getObjectFlags(type) & 16) && !!type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128) !== 0; + } + function checkInstanceOfExpression(left, right, leftType, rightType) { + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } + if (!isTypeAny(leftType) && allTypesAssignableToKind( + leftType, + 131068 + /* TypeFlags.Primitive */ + )) { + error(left, ts6.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + error(right, ts6.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + } + return booleanType; + } + function hasEmptyObjectIntersection(type) { + return someType(type, function(t) { + return t === unknownEmptyObjectType || !!(t.flags & 2097152) && ts6.some(t.types, isEmptyAnonymousObjectType); + }); + } + function checkInExpression(left, right, leftType, rightType) { + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } + if (ts6.isPrivateIdentifier(left)) { + if (languageVersion < 99) { + checkExternalEmitHelpers( + left, + 2097152 + /* ExternalEmitHelpers.ClassPrivateFieldIn */ + ); + } + if (!getNodeLinks(left).resolvedSymbol && ts6.getContainingClass(left)) { + var isUncheckedJS = isUncheckedJSSuggestion( + left, + rightType.symbol, + /*excludeClasses*/ + true + ); + reportNonexistentProperty(left, rightType, isUncheckedJS); + } + } else { + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts6.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); + } + } + return booleanType; + } + function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { + var properties = node.properties; + if (strictNullChecks && properties.length === 0) { + return checkNonNullType(sourceType, node); + } + for (var i = 0; i < properties.length; i++) { + checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis); + } + return sourceType; + } + function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) { + if (rightIsThis === void 0) { + rightIsThis = false; + } + var properties = node.properties; + var property = properties[propertyIndex]; + if (property.kind === 299 || property.kind === 300) { + var name = property.name; + var exprType = getLiteralTypeFromPropertyName(name); + if (isTypeUsableAsPropertyName(exprType)) { + var text = getPropertyNameFromType(exprType); + var prop = getPropertyOfType(objectLiteralType, text); + if (prop) { + markPropertyAsReferenced(prop, property, rightIsThis); + checkPropertyAccessibility( + property, + /*isSuper*/ + false, + /*writing*/ + true, + objectLiteralType, + prop + ); + } + } + var elementType = getIndexedAccessType(objectLiteralType, exprType, 32, name); + var type = getFlowTypeOfDestructuring(property, elementType); + return checkDestructuringAssignment(property.kind === 300 ? property : property.initializer, type); + } else if (property.kind === 301) { + if (propertyIndex < properties.length - 1) { + error(property, ts6.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); + } else { + if (languageVersion < 99) { + checkExternalEmitHelpers( + property, + 4 + /* ExternalEmitHelpers.Rest */ + ); + } + var nonRestNames = []; + if (allProperties) { + for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) { + var otherProperty = allProperties_1[_i]; + if (!ts6.isSpreadAssignment(otherProperty)) { + nonRestNames.push(otherProperty.name); + } + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + checkGrammarForDisallowedTrailingComma(allProperties, ts6.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + return checkDestructuringAssignment(property.expression, type); + } + } else { + error(property, ts6.Diagnostics.Property_assignment_expected); + } + } + function checkArrayLiteralAssignment(node, sourceType, checkMode) { + var elements = node.elements; + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers( + node, + 512 + /* ExternalEmitHelpers.Read */ + ); + } + var possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 | 128, sourceType, undefinedType, node) || errorType; + var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? void 0 : possiblyOutOfBoundsType; + for (var i = 0; i < elements.length; i++) { + var type = possiblyOutOfBoundsType; + if (node.elements[i].kind === 227) { + type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : checkIteratedTypeOrElementType(65, sourceType, undefinedType, node) || errorType; + } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); + } + return sourceType; + } + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { + var elements = node.elements; + var element = elements[elementIndex]; + if (element.kind !== 229) { + if (element.kind !== 227) { + var indexType = getNumberLiteralType(elementIndex); + if (isArrayLikeType(sourceType)) { + var accessFlags = 32 | (hasDefaultValue(element) ? 16 : 0); + var elementType_2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType; + var assignedType = hasDefaultValue(element) ? getTypeWithFacts( + elementType_2, + 524288 + /* TypeFacts.NEUndefined */ + ) : elementType_2; + var type = getFlowTypeOfDestructuring(element, assignedType); + return checkDestructuringAssignment(element, type, checkMode); + } + return checkDestructuringAssignment(element, elementType, checkMode); + } + if (elementIndex < elements.length - 1) { + error(element, ts6.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); + } else { + var restExpression = element.expression; + if (restExpression.kind === 223 && restExpression.operatorToken.kind === 63) { + error(restExpression.operatorToken, ts6.Diagnostics.A_rest_element_cannot_have_an_initializer); + } else { + checkGrammarForDisallowedTrailingComma(node.elements, ts6.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + var type = everyType(sourceType, isTupleType) ? mapType(sourceType, function(t) { + return sliceTupleType(t, elementIndex); + }) : createArrayType(elementType); + return checkDestructuringAssignment(restExpression, type, checkMode); + } + } + } + return void 0; + } + function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { + var target; + if (exprOrAssignment.kind === 300) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216)) { + sourceType = getTypeWithFacts( + sourceType, + 524288 + /* TypeFacts.NEUndefined */ + ); + } + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode); + } + target = exprOrAssignment.name; + } else { + target = exprOrAssignment; + } + if (target.kind === 223 && target.operatorToken.kind === 63) { + checkBinaryExpression(target, checkMode); + target = target.left; + if (strictNullChecks) { + sourceType = getTypeWithFacts( + sourceType, + 524288 + /* TypeFacts.NEUndefined */ + ); + } + } + if (target.kind === 207) { + return checkObjectLiteralAssignment(target, sourceType, rightIsThis); + } + if (target.kind === 206) { + return checkArrayLiteralAssignment(target, sourceType, checkMode); + } + return checkReferenceAssignment(target, sourceType, checkMode); + } + function checkReferenceAssignment(target, sourceType, checkMode) { + var targetType = checkExpression(target, checkMode); + var error2 = target.parent.kind === 301 ? ts6.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts6.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + var optionalError = target.parent.kind === 301 ? ts6.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts6.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; + if (checkReferenceExpression(target, error2, optionalError)) { + checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target); + } + if (ts6.isPrivateIdentifierPropertyAccessExpression(target)) { + checkExternalEmitHelpers( + target.parent, + 1048576 + /* ExternalEmitHelpers.ClassPrivateFieldSet */ + ); + } + return sourceType; + } + function isSideEffectFree(node) { + node = ts6.skipParentheses(node); + switch (node.kind) { + case 79: + case 10: + case 13: + case 212: + case 225: + case 14: + case 8: + case 9: + case 110: + case 95: + case 104: + case 155: + case 215: + case 228: + case 216: + case 206: + case 207: + case 218: + case 232: + case 282: + case 281: + return true; + case 224: + return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); + case 223: + if (ts6.isAssignmentOperator(node.operatorToken.kind)) { + return false; + } + return isSideEffectFree(node.left) && isSideEffectFree(node.right); + case 221: + case 222: + switch (node.operator) { + case 53: + case 39: + case 40: + case 54: + return true; + } + return false; + case 219: + case 213: + case 231: + default: + return false; + } + } + function isTypeEqualityComparableTo(source, target) { + return (target.flags & 98304) !== 0 || isTypeComparableTo(source, target); + } + function createCheckBinaryExpression() { + var trampoline = ts6.createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState); + return function(node, checkMode) { + var result = trampoline(node, checkMode); + ts6.Debug.assertIsDefined(result); + return result; + }; + function onEnter(node, state, checkMode) { + if (state) { + state.stackIndex++; + state.skip = false; + setLeftType( + state, + /*type*/ + void 0 + ); + setLastResult( + state, + /*type*/ + void 0 + ); + } else { + state = { + checkMode, + skip: false, + stackIndex: 0, + typeStack: [void 0, void 0] + }; + } + if (ts6.isInJSFile(node) && ts6.getAssignedExpandoInitializer(node)) { + state.skip = true; + setLastResult(state, checkExpression(node.right, checkMode)); + return state; + } + checkGrammarNullishCoalesceWithLogicalExpression(node); + var operator = node.operatorToken.kind; + if (operator === 63 && (node.left.kind === 207 || node.left.kind === 206)) { + state.skip = true; + setLastResult(state, checkDestructuringAssignment( + node.left, + checkExpression(node.right, checkMode), + checkMode, + node.right.kind === 108 + /* SyntaxKind.ThisKeyword */ + )); + return state; + } + return state; + } + function onLeft(left, state, _node) { + if (!state.skip) { + return maybeCheckExpression(state, left); + } + } + function onOperator(operatorToken, state, node) { + if (!state.skip) { + var leftType = getLastResult(state); + ts6.Debug.assertIsDefined(leftType); + setLeftType(state, leftType); + setLastResult( + state, + /*type*/ + void 0 + ); + var operator = operatorToken.kind; + if (operator === 55 || operator === 56 || operator === 60) { + if (operator === 55) { + var parent = node.parent; + while (parent.kind === 214 || ts6.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 || parent.operatorToken.kind === 56)) { + parent = parent.parent; + } + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts6.isIfStatement(parent) ? parent.thenStatement : void 0); + } + checkTruthinessOfType(leftType, node.left); + } + } + } + function onRight(right, state, _node) { + if (!state.skip) { + return maybeCheckExpression(state, right); + } + } + function onExit(node, state) { + var result; + if (state.skip) { + result = getLastResult(state); + } else { + var leftType = getLeftType(state); + ts6.Debug.assertIsDefined(leftType); + var rightType = getLastResult(state); + ts6.Debug.assertIsDefined(rightType); + result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, node); + } + state.skip = false; + setLeftType( + state, + /*type*/ + void 0 + ); + setLastResult( + state, + /*type*/ + void 0 + ); + state.stackIndex--; + return result; + } + function foldState(state, result, _side) { + setLastResult(state, result); + return state; + } + function maybeCheckExpression(state, node) { + if (ts6.isBinaryExpression(node)) { + return node; + } + setLastResult(state, checkExpression(node, state.checkMode)); + } + function getLeftType(state) { + return state.typeStack[state.stackIndex]; + } + function setLeftType(state, type) { + state.typeStack[state.stackIndex] = type; + } + function getLastResult(state) { + return state.typeStack[state.stackIndex + 1]; + } + function setLastResult(state, type) { + state.typeStack[state.stackIndex + 1] = type; + } + } + function checkGrammarNullishCoalesceWithLogicalExpression(node) { + var left = node.left, operatorToken = node.operatorToken, right = node.right; + if (operatorToken.kind === 60) { + if (ts6.isBinaryExpression(left) && (left.operatorToken.kind === 56 || left.operatorToken.kind === 55)) { + grammarErrorOnNode(left, ts6.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, ts6.tokenToString(left.operatorToken.kind), ts6.tokenToString(operatorToken.kind)); + } + if (ts6.isBinaryExpression(right) && (right.operatorToken.kind === 56 || right.operatorToken.kind === 55)) { + grammarErrorOnNode(right, ts6.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, ts6.tokenToString(right.operatorToken.kind), ts6.tokenToString(operatorToken.kind)); + } + } + } + function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { + var operator = operatorToken.kind; + if (operator === 63 && (left.kind === 207 || left.kind === 206)) { + return checkDestructuringAssignment( + left, + checkExpression(right, checkMode), + checkMode, + right.kind === 108 + /* SyntaxKind.ThisKeyword */ + ); + } + var leftType; + if (operator === 55 || operator === 56 || operator === 60) { + leftType = checkTruthinessExpression(left, checkMode); + } else { + leftType = checkExpression(left, checkMode); + } + var rightType = checkExpression(right, checkMode); + return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode); + } + function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) { + var operator = operatorToken.kind; + switch (operator) { + case 41: + case 42: + case 66: + case 67: + case 43: + case 68: + case 44: + case 69: + case 40: + case 65: + case 47: + case 70: + case 48: + case 71: + case 49: + case 72: + case 51: + case 74: + case 52: + case 78: + case 50: + case 73: + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + var suggestedOperator = void 0; + if (leftType.flags & 528 && rightType.flags & 528 && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) { + error(errorNode || operatorToken, ts6.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts6.tokenToString(operatorToken.kind), ts6.tokenToString(suggestedOperator)); + return numberType; + } else { + var leftOk = checkArithmeticOperandType( + left, + leftType, + ts6.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, + /*isAwaitValid*/ + true + ); + var rightOk = checkArithmeticOperandType( + right, + rightType, + ts6.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, + /*isAwaitValid*/ + true + ); + var resultType_1; + if (isTypeAssignableToKind( + leftType, + 3 + /* TypeFlags.AnyOrUnknown */ + ) && isTypeAssignableToKind( + rightType, + 3 + /* TypeFlags.AnyOrUnknown */ + ) || // Or, if neither could be bigint, implicit coercion results in a number result + !(maybeTypeOfKind( + leftType, + 2112 + /* TypeFlags.BigIntLike */ + ) || maybeTypeOfKind( + rightType, + 2112 + /* TypeFlags.BigIntLike */ + ))) { + resultType_1 = numberType; + } else if (bothAreBigIntLike(leftType, rightType)) { + switch (operator) { + case 49: + case 72: + reportOperatorError(); + break; + case 42: + case 67: + if (languageVersion < 3) { + error(errorNode, ts6.Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later); + } + } + resultType_1 = bigintType; + } else { + reportOperatorError(bothAreBigIntLike); + resultType_1 = errorType; + } + if (leftOk && rightOk) { + checkAssignmentOperator(resultType_1); + } + return resultType_1; + } + case 39: + case 64: + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } + if (!isTypeAssignableToKind( + leftType, + 402653316 + /* TypeFlags.StringLike */ + ) && !isTypeAssignableToKind( + rightType, + 402653316 + /* TypeFlags.StringLike */ + )) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } + var resultType = void 0; + if (isTypeAssignableToKind( + leftType, + 296, + /*strict*/ + true + ) && isTypeAssignableToKind( + rightType, + 296, + /*strict*/ + true + )) { + resultType = numberType; + } else if (isTypeAssignableToKind( + leftType, + 2112, + /*strict*/ + true + ) && isTypeAssignableToKind( + rightType, + 2112, + /*strict*/ + true + )) { + resultType = bigintType; + } else if (isTypeAssignableToKind( + leftType, + 402653316, + /*strict*/ + true + ) || isTypeAssignableToKind( + rightType, + 402653316, + /*strict*/ + true + )) { + resultType = stringType; + } else if (isTypeAny(leftType) || isTypeAny(rightType)) { + resultType = isErrorType(leftType) || isErrorType(rightType) ? errorType : anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } + if (!resultType) { + var closeEnoughKind_1 = 296 | 2112 | 402653316 | 3; + reportOperatorError(function(left2, right2) { + return isTypeAssignableToKind(left2, closeEnoughKind_1) && isTypeAssignableToKind(right2, closeEnoughKind_1); + }); + return anyType; + } + if (operator === 64) { + checkAssignmentOperator(resultType); + } + return resultType; + case 29: + case 31: + case 32: + case 33: + if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); + reportOperatorErrorUnless(function(left2, right2) { + return isTypeComparableTo(left2, right2) || isTypeComparableTo(right2, left2) || isTypeAssignableTo(left2, numberOrBigIntType) && isTypeAssignableTo(right2, numberOrBigIntType); + }); + } + return booleanType; + case 34: + case 35: + case 36: + case 37: + if (ts6.isLiteralExpressionOfObject(left) || ts6.isLiteralExpressionOfObject(right)) { + var eqType = operator === 34 || operator === 36; + error(errorNode, ts6.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); + } + checkNaNEquality(errorNode, operator, left, right); + reportOperatorErrorUnless(function(left2, right2) { + return isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2); + }); + return booleanType; + case 102: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 101: + return checkInExpression(left, right, leftType, rightType); + case 55: + case 76: { + var resultType_2 = getTypeFacts(leftType) & 4194304 ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType; + if (operator === 76) { + checkAssignmentOperator(rightType); + } + return resultType_2; + } + case 56: + case 75: { + var resultType_3 = getTypeFacts(leftType) & 8388608 ? getUnionType( + [getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], + 2 + /* UnionReduction.Subtype */ + ) : leftType; + if (operator === 75) { + checkAssignmentOperator(rightType); + } + return resultType_3; + } + case 60: + case 77: { + var resultType_4 = getTypeFacts(leftType) & 262144 ? getUnionType( + [getNonNullableType(leftType), rightType], + 2 + /* UnionReduction.Subtype */ + ) : leftType; + if (operator === 77) { + checkAssignmentOperator(rightType); + } + return resultType_4; + } + case 63: + var declKind = ts6.isBinaryExpression(left.parent) ? ts6.getAssignmentDeclarationKind(left.parent) : 0; + checkAssignmentDeclaration(declKind, rightType); + if (isAssignmentDeclaration(declKind)) { + if (!(rightType.flags & 524288) || declKind !== 2 && declKind !== 6 && !isEmptyObjectType(rightType) && !isFunctionObjectType(rightType) && !(ts6.getObjectFlags(rightType) & 1)) { + checkAssignmentOperator(rightType); + } + return leftType; + } else { + checkAssignmentOperator(rightType); + return getRegularTypeOfObjectLiteral(rightType); + } + case 27: + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { + var sf = ts6.getSourceFileOfNode(left); + var sourceText = sf.text; + var start_3 = ts6.skipTrivia(sourceText, left.pos); + var isInDiag2657 = sf.parseDiagnostics.some(function(diag) { + if (diag.code !== ts6.Diagnostics.JSX_expressions_must_have_one_parent_element.code) + return false; + return ts6.textSpanContainsPosition(diag, start_3); + }); + if (!isInDiag2657) + error(left, ts6.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); + } + return rightType; + default: + return ts6.Debug.fail(); + } + function bothAreBigIntLike(left2, right2) { + return isTypeAssignableToKind( + left2, + 2112 + /* TypeFlags.BigIntLike */ + ) && isTypeAssignableToKind( + right2, + 2112 + /* TypeFlags.BigIntLike */ + ); + } + function checkAssignmentDeclaration(kind, rightType2) { + if (kind === 2) { + for (var _i = 0, _a = getPropertiesOfObjectType(rightType2); _i < _a.length; _i++) { + var prop = _a[_i]; + var propType = getTypeOfSymbol(prop); + if (propType.symbol && propType.symbol.flags & 32) { + var name = prop.escapedName; + var symbol = resolveName( + prop.valueDeclaration, + name, + 788968, + void 0, + name, + /*isUse*/ + false + ); + if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.declarations.some(ts6.isJSDocTypedefTag)) { + addDuplicateDeclarationErrorsForSymbols(symbol, ts6.Diagnostics.Duplicate_identifier_0, ts6.unescapeLeadingUnderscores(name), prop); + addDuplicateDeclarationErrorsForSymbols(prop, ts6.Diagnostics.Duplicate_identifier_0, ts6.unescapeLeadingUnderscores(name), symbol); + } + } + } + } + } + function isEvalNode(node) { + return node.kind === 79 && node.escapedText === "eval"; + } + function checkForDisallowedESSymbolOperand(operator2) { + var offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint( + leftType, + 12288 + /* TypeFlags.ESSymbolLike */ + ) ? left : maybeTypeOfKindConsideringBaseConstraint( + rightType, + 12288 + /* TypeFlags.ESSymbolLike */ + ) ? right : void 0; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts6.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts6.tokenToString(operator2)); + return false; + } + return true; + } + function getSuggestedBooleanOperator(operator2) { + switch (operator2) { + case 51: + case 74: + return 56; + case 52: + case 78: + return 37; + case 50: + case 73: + return 55; + default: + return void 0; + } + } + function checkAssignmentOperator(valueType) { + if (ts6.isAssignmentOperator(operator)) { + addLazyDiagnostic(checkAssignmentOperatorWorker); + } + function checkAssignmentOperatorWorker() { + if (checkReferenceExpression(left, ts6.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, ts6.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access) && (!ts6.isIdentifier(left) || ts6.unescapeLeadingUnderscores(left.escapedText) !== "exports")) { + var headMessage = void 0; + if (exactOptionalPropertyTypes && ts6.isPropertyAccessExpression(left) && maybeTypeOfKind( + valueType, + 32768 + /* TypeFlags.Undefined */ + )) { + var target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText); + if (isExactOptionalPropertyMismatch(valueType, target)) { + headMessage = ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target; + } + } + checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right, headMessage); + } + } + } + function isAssignmentDeclaration(kind) { + var _a; + switch (kind) { + case 2: + return true; + case 1: + case 5: + case 6: + case 3: + case 4: + var symbol = getSymbolOfNode(left); + var init = ts6.getAssignedExpandoInitializer(right); + return !!init && ts6.isObjectLiteralExpression(init) && !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.exports) === null || _a === void 0 ? void 0 : _a.size); + default: + return false; + } + } + function reportOperatorErrorUnless(typesAreCompatible) { + if (!typesAreCompatible(leftType, rightType)) { + reportOperatorError(typesAreCompatible); + return true; + } + return false; + } + function reportOperatorError(isRelated) { + var _a; + var wouldWorkWithAwait = false; + var errNode = errorNode || operatorToken; + if (isRelated) { + var awaitedLeftType = getAwaitedTypeNoAlias(leftType); + var awaitedRightType = getAwaitedTypeNoAlias(rightType); + wouldWorkWithAwait = !(awaitedLeftType === leftType && awaitedRightType === rightType) && !!(awaitedLeftType && awaitedRightType) && isRelated(awaitedLeftType, awaitedRightType); + } + var effectiveLeft = leftType; + var effectiveRight = rightType; + if (!wouldWorkWithAwait && isRelated) { + _a = getBaseTypesIfUnrelated(leftType, rightType, isRelated), effectiveLeft = _a[0], effectiveRight = _a[1]; + } + var _b = getTypeNamesForErrorDisplay(effectiveLeft, effectiveRight), leftStr = _b[0], rightStr = _b[1]; + if (!tryGiveBetterPrimaryError(errNode, wouldWorkWithAwait, leftStr, rightStr)) { + errorAndMaybeSuggestAwait(errNode, wouldWorkWithAwait, ts6.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts6.tokenToString(operatorToken.kind), leftStr, rightStr); + } + } + function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { + switch (operatorToken.kind) { + case 36: + case 34: + case 37: + case 35: + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts6.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return void 0; + } + } + function checkNaNEquality(errorNode2, operator2, left2, right2) { + var isLeftNaN = isGlobalNaN(ts6.skipParentheses(left2)); + var isRightNaN = isGlobalNaN(ts6.skipParentheses(right2)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode2, ts6.Diagnostics.This_condition_will_always_return_0, ts6.tokenToString( + operator2 === 36 || operator2 === 34 ? 95 : 110 + /* SyntaxKind.TrueKeyword */ + )); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator2 === 37 || operator2 === 35 ? ts6.tokenToString( + 53 + /* SyntaxKind.ExclamationToken */ + ) : ""; + var location = isLeftNaN ? right2 : left2; + var expression = ts6.skipParentheses(location); + ts6.addRelatedInfo(err, ts6.createDiagnosticForNode(location, ts6.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts6.isEntityNameExpression(expression) ? ts6.entityNameToString(expression) : "...", ")"))); + } + } + function isGlobalNaN(expr) { + if (ts6.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; + } + } + function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { + var effectiveLeft = leftType; + var effectiveRight = rightType; + var leftBase = getBaseTypeOfLiteralType(leftType); + var rightBase = getBaseTypeOfLiteralType(rightType); + if (!isRelated(leftBase, rightBase)) { + effectiveLeft = leftBase; + effectiveRight = rightBase; + } + return [effectiveLeft, effectiveRight]; + } + function checkYieldExpression(node) { + addLazyDiagnostic(checkYieldExpressionGrammar); + var func = ts6.getContainingFunction(node); + if (!func) + return anyType; + var functionFlags = ts6.getFunctionFlags(func); + if (!(functionFlags & 1)) { + return anyType; + } + var isAsync = (functionFlags & 2) !== 0; + if (node.asteriskToken) { + if (isAsync && languageVersion < 99) { + checkExternalEmitHelpers( + node, + 26624 + /* ExternalEmitHelpers.AsyncDelegatorIncludes */ + ); + } + if (!isAsync && languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers( + node, + 256 + /* ExternalEmitHelpers.Values */ + ); + } + } + var returnType = getReturnTypeFromAnnotation(func); + var iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync); + var signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType; + var signatureNextType = iterationTypes && iterationTypes.nextType || anyType; + var resolvedSignatureNextType = isAsync ? getAwaitedType(signatureNextType) || anyType : signatureNextType; + var yieldExpressionType = node.expression ? checkExpression(node.expression) : undefinedWideningType; + var yieldedType = getYieldedTypeOfYieldExpression(node, yieldExpressionType, resolvedSignatureNextType, isAsync); + if (returnType && yieldedType) { + checkTypeAssignableToAndOptionallyElaborate(yieldedType, signatureYieldType, node.expression || node, node.expression); + } + if (node.asteriskToken) { + var use = isAsync ? 19 : 17; + return getIterationTypeOfIterable(use, 1, yieldExpressionType, node.expression) || anyType; + } else if (returnType) { + return getIterationTypeOfGeneratorFunctionReturnType(2, returnType, isAsync) || anyType; + } + var type = getContextualIterationType(2, func); + if (!type) { + type = anyType; + addLazyDiagnostic(function() { + if (noImplicitAny && !ts6.expressionResultIsUnused(node)) { + var contextualType = getContextualType( + node, + /*contextFlags*/ + void 0 + ); + if (!contextualType || isTypeAny(contextualType)) { + error(node, ts6.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation); + } + } + }); + } + return type; + function checkYieldExpressionGrammar() { + if (!(node.flags & 8192)) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); + } + if (isInParameterInitializerBeforeContainingFunction(node)) { + error(node, ts6.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer); + } + } + } + function checkConditionalExpression(node, checkMode) { + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); + var type1 = checkExpression(node.whenTrue, checkMode); + var type2 = checkExpression(node.whenFalse, checkMode); + return getUnionType( + [type1, type2], + 2 + /* UnionReduction.Subtype */ + ); + } + function isTemplateLiteralContext(node) { + var parent = node.parent; + return ts6.isParenthesizedExpression(parent) && isTemplateLiteralContext(parent) || ts6.isElementAccessExpression(parent) && parent.argumentExpression === node; + } + function checkTemplateExpression(node) { + var texts = [node.head.text]; + var types = []; + for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) { + var span = _a[_i]; + var type = checkExpression(span.expression); + if (maybeTypeOfKindConsideringBaseConstraint( + type, + 12288 + /* TypeFlags.ESSymbolLike */ + )) { + error(span.expression, ts6.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); + } + texts.push(span.literal.text); + types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType); + } + return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType( + node, + /*contextFlags*/ + void 0 + ) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType; + } + function isTemplateLiteralContextualType(type) { + return !!(type.flags & (128 | 134217728) || type.flags & 58982400 && maybeTypeOfKind( + getBaseConstraintOfType(type) || unknownType, + 402653316 + /* TypeFlags.StringLike */ + )); + } + function getContextNode(node) { + if (node.kind === 289 && !ts6.isJsxSelfClosingElement(node.parent)) { + return node.parent.parent; + } + return node; + } + function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) { + var context = getContextNode(node); + var saveContextualType = context.contextualType; + var saveInferenceContext = context.inferenceContext; + try { + context.contextualType = contextualType; + context.inferenceContext = inferenceContext; + var type = checkExpression(node, checkMode | 1 | (inferenceContext ? 2 : 0)); + if (inferenceContext && inferenceContext.intraExpressionInferenceSites) { + inferenceContext.intraExpressionInferenceSites = void 0; + } + var result = maybeTypeOfKind( + type, + 2944 + /* TypeFlags.Literal */ + ) && isLiteralOfContextualType(type, instantiateContextualType( + contextualType, + node, + /*contextFlags*/ + void 0 + )) ? getRegularTypeOfLiteralType(type) : type; + return result; + } finally { + context.contextualType = saveContextualType; + context.inferenceContext = saveInferenceContext; + } + } + function checkExpressionCached(node, checkMode) { + if (checkMode && checkMode !== 0) { + return checkExpression(node, checkMode); + } + var links = getNodeLinks(node); + if (!links.resolvedType) { + var saveFlowLoopStart = flowLoopStart; + var saveFlowTypeCache = flowTypeCache; + flowLoopStart = flowLoopCount; + flowTypeCache = void 0; + links.resolvedType = checkExpression(node, checkMode); + flowTypeCache = saveFlowTypeCache; + flowLoopStart = saveFlowLoopStart; + } + return links.resolvedType; + } + function isTypeAssertion(node) { + node = ts6.skipParentheses( + node, + /*excludeJSDocTypeAssertions*/ + true + ); + return node.kind === 213 || node.kind === 231 || ts6.isJSDocTypeAssertion(node); + } + function checkDeclarationInitializer(declaration, checkMode, contextualType) { + var initializer = ts6.getEffectiveInitializer(declaration); + var type = getQuickTypeOfExpression(initializer) || (contextualType ? checkExpressionWithContextualType( + initializer, + contextualType, + /*inferenceContext*/ + void 0, + checkMode || 0 + /* CheckMode.Normal */ + ) : checkExpressionCached(initializer, checkMode)); + return ts6.isParameter(declaration) && declaration.name.kind === 204 && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; + } + function padTupleType(type, pattern) { + var patternElements = pattern.elements; + var elementTypes = getTypeArguments(type).slice(); + var elementFlags = type.target.elementFlags.slice(); + for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { + var e = patternElements[i]; + if (i < patternElements.length - 1 || !(e.kind === 205 && e.dotDotDotToken)) { + elementTypes.push(!ts6.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement( + e, + /*includePatternInType*/ + false, + /*reportErrors*/ + false + ) : anyType); + elementFlags.push( + 2 + /* ElementFlags.Optional */ + ); + if (!ts6.isOmittedExpression(e) && !hasDefaultValue(e)) { + reportImplicitAny(e, anyType); + } + } + } + return createTupleType(elementTypes, elementFlags, type.target.readonly); + } + function widenTypeInferredFromInitializer(declaration, type) { + var widened = ts6.getCombinedNodeFlags(declaration) & 2 || ts6.isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + if (ts6.isInJSFile(declaration)) { + if (isEmptyLiteralType(widened)) { + reportImplicitAny(declaration, anyType); + return anyType; + } else if (isEmptyArrayLiteralType(widened)) { + reportImplicitAny(declaration, anyArrayType); + return anyArrayType; + } + } + return widened; + } + function isLiteralOfContextualType(candidateType, contextualType) { + if (contextualType) { + if (contextualType.flags & 3145728) { + var types = contextualType.types; + return ts6.some(types, function(t) { + return isLiteralOfContextualType(candidateType, t); + }); + } + if (contextualType.flags & 58982400) { + var constraint = getBaseConstraintOfType(contextualType) || unknownType; + return maybeTypeOfKind( + constraint, + 4 + /* TypeFlags.String */ + ) && maybeTypeOfKind( + candidateType, + 128 + /* TypeFlags.StringLiteral */ + ) || maybeTypeOfKind( + constraint, + 8 + /* TypeFlags.Number */ + ) && maybeTypeOfKind( + candidateType, + 256 + /* TypeFlags.NumberLiteral */ + ) || maybeTypeOfKind( + constraint, + 64 + /* TypeFlags.BigInt */ + ) && maybeTypeOfKind( + candidateType, + 2048 + /* TypeFlags.BigIntLiteral */ + ) || maybeTypeOfKind( + constraint, + 4096 + /* TypeFlags.ESSymbol */ + ) && maybeTypeOfKind( + candidateType, + 8192 + /* TypeFlags.UniqueESSymbol */ + ) || isLiteralOfContextualType(candidateType, constraint); + } + return !!(contextualType.flags & (128 | 4194304 | 134217728 | 268435456) && maybeTypeOfKind( + candidateType, + 128 + /* TypeFlags.StringLiteral */ + ) || contextualType.flags & 256 && maybeTypeOfKind( + candidateType, + 256 + /* TypeFlags.NumberLiteral */ + ) || contextualType.flags & 2048 && maybeTypeOfKind( + candidateType, + 2048 + /* TypeFlags.BigIntLiteral */ + ) || contextualType.flags & 512 && maybeTypeOfKind( + candidateType, + 512 + /* TypeFlags.BooleanLiteral */ + ) || contextualType.flags & 8192 && maybeTypeOfKind( + candidateType, + 8192 + /* TypeFlags.UniqueESSymbol */ + )); + } + return false; + } + function isConstContext(node) { + var parent = node.parent; + return ts6.isAssertionExpression(parent) && ts6.isConstTypeReference(parent.type) || ts6.isJSDocTypeAssertion(parent) && ts6.isConstTypeReference(ts6.getJSDocTypeAssertionType(parent)) || (ts6.isParenthesizedExpression(parent) || ts6.isArrayLiteralExpression(parent) || ts6.isSpreadElement(parent)) && isConstContext(parent) || (ts6.isPropertyAssignment(parent) || ts6.isShorthandPropertyAssignment(parent) || ts6.isTemplateSpan(parent)) && isConstContext(parent.parent); + } + function checkExpressionForMutableLocation(node, checkMode, contextualType, forceTuple) { + var type = checkExpression(node, checkMode, forceTuple); + return isConstContext(node) || ts6.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) : isTypeAssertion(node) ? type : getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType( + arguments.length === 2 ? getContextualType( + node, + /*contextFlags*/ + void 0 + ) : contextualType, + node, + /*contextFlags*/ + void 0 + )); + } + function checkPropertyAssignment(node, checkMode) { + if (node.name.kind === 164) { + checkComputedPropertyName(node.name); + } + return checkExpressionForMutableLocation(node.initializer, checkMode); + } + function checkObjectLiteralMethod(node, checkMode) { + checkGrammarMethod(node); + if (node.name.kind === 164) { + checkComputedPropertyName(node.name); + } + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); + } + function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { + if (checkMode && checkMode & (2 | 8)) { + var callSignature = getSingleSignature( + type, + 0, + /*allowMembers*/ + true + ); + var constructSignature = getSingleSignature( + type, + 1, + /*allowMembers*/ + true + ); + var signature = callSignature || constructSignature; + if (signature && signature.typeParameters) { + var contextualType = getApparentTypeOfContextualType( + node, + 2 + /* ContextFlags.NoConstraints */ + ); + if (contextualType) { + var contextualSignature = getSingleSignature( + getNonNullableType(contextualType), + callSignature ? 0 : 1, + /*allowMembers*/ + false + ); + if (contextualSignature && !contextualSignature.typeParameters) { + if (checkMode & 8) { + skippedGenericFunction(node, checkMode); + return anyFunctionType; + } + var context = getInferenceContext(node); + var returnType = context.signature && getReturnTypeOfSignature(context.signature); + var returnSignature = returnType && getSingleCallOrConstructSignature(returnType); + if (returnSignature && !returnSignature.typeParameters && !ts6.every(context.inferences, hasInferenceCandidates)) { + var uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters); + var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters); + var inferences_3 = ts6.map(context.inferences, function(info) { + return createInferenceInfo(info.typeParameter); + }); + applyToParameterTypes(instantiatedSignature, contextualSignature, function(source, target) { + inferTypes( + inferences_3, + source, + target, + /*priority*/ + 0, + /*contravariant*/ + true + ); + }); + if (ts6.some(inferences_3, hasInferenceCandidates)) { + applyToReturnTypes(instantiatedSignature, contextualSignature, function(source, target) { + inferTypes(inferences_3, source, target); + }); + if (!hasOverlappingInferences(context.inferences, inferences_3)) { + mergeInferences(context.inferences, inferences_3); + context.inferredTypeParameters = ts6.concatenate(context.inferredTypeParameters, uniqueTypeParameters); + return getOrCreateTypeFromSignature(instantiatedSignature); + } + } + } + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context)); + } + } + } + } + return type; + } + function skippedGenericFunction(node, checkMode) { + if (checkMode & 2) { + var context = getInferenceContext(node); + context.flags |= 4; + } + } + function hasInferenceCandidates(info) { + return !!(info.candidates || info.contraCandidates); + } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } + function hasOverlappingInferences(a, b) { + for (var i = 0; i < a.length; i++) { + if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { + return true; + } + } + return false; + } + function mergeInferences(target, source) { + for (var i = 0; i < target.length; i++) { + if (!hasInferenceCandidates(target[i]) && hasInferenceCandidates(source[i])) { + target[i] = source[i]; + } + } + } + function getUniqueTypeParameters(context, typeParameters) { + var result = []; + var oldTypeParameters; + var newTypeParameters; + for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) { + var tp = typeParameters_3[_i]; + var name = tp.symbol.escapedName; + if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) { + var newName = getUniqueTypeParameterName(ts6.concatenate(context.inferredTypeParameters, result), name); + var symbol = createSymbol(262144, newName); + var newTypeParameter = createTypeParameter(symbol); + newTypeParameter.target = tp; + oldTypeParameters = ts6.append(oldTypeParameters, tp); + newTypeParameters = ts6.append(newTypeParameters, newTypeParameter); + result.push(newTypeParameter); + } else { + result.push(tp); + } + } + if (newTypeParameters) { + var mapper = createTypeMapper(oldTypeParameters, newTypeParameters); + for (var _a = 0, newTypeParameters_1 = newTypeParameters; _a < newTypeParameters_1.length; _a++) { + var tp = newTypeParameters_1[_a]; + tp.mapper = mapper; + } + } + return result; + } + function hasTypeParameterByName(typeParameters, name) { + return ts6.some(typeParameters, function(tp) { + return tp.symbol.escapedName === name; + }); + } + function getUniqueTypeParameterName(typeParameters, baseName) { + var len = baseName.length; + while (len > 1 && baseName.charCodeAt(len - 1) >= 48 && baseName.charCodeAt(len - 1) <= 57) + len--; + var s = baseName.slice(0, len); + for (var index = 1; true; index++) { + var augmentedName = s + index; + if (!hasTypeParameterByName(typeParameters, augmentedName)) { + return augmentedName; + } + } + } + function getReturnTypeOfSingleNonGenericCallSignature(funcType) { + var signature = getSingleCallSignature(funcType); + if (signature && !signature.typeParameters) { + return getReturnTypeOfSignature(signature); + } + } + function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) { + var funcType = checkExpression(expr.expression); + var nonOptionalType = getOptionalExpressionType(funcType, expr.expression); + var returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType); + return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType); + } + function getTypeOfExpression(node) { + var quickType = getQuickTypeOfExpression(node); + if (quickType) { + return quickType; + } + if (node.flags & 134217728 && flowTypeCache) { + var cachedType = flowTypeCache[getNodeId(node)]; + if (cachedType) { + return cachedType; + } + } + var startInvocationCount = flowInvocationCount; + var type = checkExpression(node); + if (flowInvocationCount !== startInvocationCount) { + var cache = flowTypeCache || (flowTypeCache = []); + cache[getNodeId(node)] = type; + ts6.setNodeFlags( + node, + node.flags | 134217728 + /* NodeFlags.TypeCached */ + ); + } + return type; + } + function getQuickTypeOfExpression(node) { + var expr = ts6.skipParentheses( + node, + /*excludeJSDocTypeAssertions*/ + true + ); + if (ts6.isJSDocTypeAssertion(expr)) { + var type = ts6.getJSDocTypeAssertionType(expr); + if (!ts6.isConstTypeReference(type)) { + return getTypeFromTypeNode(type); + } + } + expr = ts6.skipParentheses(node); + if (ts6.isCallExpression(expr) && expr.expression.kind !== 106 && !ts6.isRequireCall( + expr, + /*checkArgumentIsStringLiteralLike*/ + true + ) && !isSymbolOrSymbolForCall(expr)) { + var type = ts6.isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression)); + if (type) { + return type; + } + } else if (ts6.isAssertionExpression(expr) && !ts6.isConstTypeReference(expr.type)) { + return getTypeFromTypeNode(expr.type); + } else if (node.kind === 8 || node.kind === 10 || node.kind === 110 || node.kind === 95) { + return checkExpression(node); + } + return void 0; + } + function getContextFreeTypeOfExpression(node) { + var links = getNodeLinks(node); + if (links.contextFreeType) { + return links.contextFreeType; + } + var saveContextualType = node.contextualType; + node.contextualType = anyType; + try { + var type = links.contextFreeType = checkExpression( + node, + 4 + /* CheckMode.SkipContextSensitive */ + ); + return type; + } finally { + node.contextualType = saveContextualType; + } + } + function checkExpression(node, checkMode, forceTuple) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); + var saveCurrentNode = currentNode; + currentNode = node; + instantiationCount = 0; + var uninstantiatedType = checkExpressionWorker(node, checkMode, forceTuple); + var type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); + if (isConstEnumObjectType(type)) { + checkConstEnumAccess(node, type); + } + currentNode = saveCurrentNode; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return type; + } + function checkConstEnumAccess(node, type) { + var ok = node.parent.kind === 208 && node.parent.expression === node || node.parent.kind === 209 && node.parent.expression === node || ((node.kind === 79 || node.kind === 163) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 183 && node.parent.exprName === node) || node.parent.kind === 278; + if (!ok) { + error(node, ts6.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); + } + if (compilerOptions.isolatedModules) { + ts6.Debug.assert(!!(type.symbol.flags & 128)); + var constEnumDeclaration = type.symbol.valueDeclaration; + if (constEnumDeclaration.flags & 16777216) { + error(node, ts6.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided); + } + } + } + function checkParenthesizedExpression(node, checkMode) { + if (ts6.hasJSDocNodes(node) && ts6.isJSDocTypeAssertion(node)) { + var type = ts6.getJSDocTypeAssertionType(node); + return checkAssertionWorker(type, type, node.expression, checkMode); + } + return checkExpression(node.expression, checkMode); + } + function checkExpressionWorker(node, checkMode, forceTuple) { + var kind = node.kind; + if (cancellationToken) { + switch (kind) { + case 228: + case 215: + case 216: + cancellationToken.throwIfCancellationRequested(); + } + } + switch (kind) { + case 79: + return checkIdentifier(node, checkMode); + case 80: + return checkPrivateIdentifierExpression(node); + case 108: + return checkThisExpression(node); + case 106: + return checkSuperExpression(node); + case 104: + return nullWideningType; + case 14: + case 10: + return getFreshTypeOfLiteralType(getStringLiteralType(node.text)); + case 8: + checkGrammarNumericLiteral(node); + return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text)); + case 9: + checkGrammarBigIntLiteral(node); + return getFreshTypeOfLiteralType(getBigIntLiteralType({ + negative: false, + base10Value: ts6.parsePseudoBigInt(node.text) + })); + case 110: + return trueType; + case 95: + return falseType; + case 225: + return checkTemplateExpression(node); + case 13: + return globalRegExpType; + case 206: + return checkArrayLiteral(node, checkMode, forceTuple); + case 207: + return checkObjectLiteral(node, checkMode); + case 208: + return checkPropertyAccessExpression(node, checkMode); + case 163: + return checkQualifiedName(node, checkMode); + case 209: + return checkIndexedAccess(node, checkMode); + case 210: + if (node.expression.kind === 100) { + return checkImportCallExpression(node); + } + case 211: + return checkCallExpression(node, checkMode); + case 212: + return checkTaggedTemplateExpression(node); + case 214: + return checkParenthesizedExpression(node, checkMode); + case 228: + return checkClassExpression(node); + case 215: + case 216: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 218: + return checkTypeOfExpression(node); + case 213: + case 231: + return checkAssertion(node); + case 232: + return checkNonNullAssertion(node); + case 230: + return checkExpressionWithTypeArguments(node); + case 235: + return checkSatisfiesExpression(node); + case 233: + return checkMetaProperty(node); + case 217: + return checkDeleteExpression(node); + case 219: + return checkVoidExpression(node); + case 220: + return checkAwaitExpression(node); + case 221: + return checkPrefixUnaryExpression(node); + case 222: + return checkPostfixUnaryExpression(node); + case 223: + return checkBinaryExpression(node, checkMode); + case 224: + return checkConditionalExpression(node, checkMode); + case 227: + return checkSpreadExpression(node, checkMode); + case 229: + return undefinedWideningType; + case 226: + return checkYieldExpression(node); + case 234: + return checkSyntheticExpression(node); + case 291: + return checkJsxExpression(node, checkMode); + case 281: + return checkJsxElement(node, checkMode); + case 282: + return checkJsxSelfClosingElement(node, checkMode); + case 285: + return checkJsxFragment(node); + case 289: + return checkJsxAttributes(node, checkMode); + case 283: + ts6.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); + } + return errorType; + } + function checkTypeParameter(node) { + checkGrammarModifiers(node); + if (node.expression) { + grammarErrorOnFirstToken(node.expression, ts6.Diagnostics.Type_expected); + } + checkSourceElement(node.constraint); + checkSourceElement(node.default); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + getBaseConstraintOfType(typeParameter); + if (!hasNonCircularTypeParameterDefault(typeParameter)) { + error(node.default, ts6.Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); + } + var constraintType = getConstraintOfTypeParameter(typeParameter); + var defaultType = getDefaultFromTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts6.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + checkNodeDeferred(node); + addLazyDiagnostic(function() { + return checkTypeNameIsReserved(node.name, ts6.Diagnostics.Type_parameter_name_cannot_be_0); + }); + } + function checkTypeParameterDeferred(node) { + if (ts6.isInterfaceDeclaration(node.parent) || ts6.isClassLike(node.parent) || ts6.isTypeAliasDeclaration(node.parent)) { + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + var modifiers = getVarianceModifiers(typeParameter); + if (modifiers) { + var symbol = getSymbolOfNode(node.parent); + if (ts6.isTypeAliasDeclaration(node.parent) && !(ts6.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 | 32))) { + error(node, ts6.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types); + } else if (modifiers === 32768 || modifiers === 65536) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("checkTypes", "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) }); + var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubTypeForCheck : markerSuperTypeForCheck); + var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperTypeForCheck : markerSubTypeForCheck); + var saveVarianceTypeParameter = typeParameter; + varianceTypeParameter = typeParameter; + checkTypeAssignableTo(source, target, node, ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation); + varianceTypeParameter = saveVarianceTypeParameter; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + } + } + } + function checkParameter(node) { + checkGrammarDecoratorsAndModifiers(node); + checkVariableLikeDeclaration(node); + var func = ts6.getContainingFunction(node); + if (ts6.hasSyntacticModifier( + node, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + )) { + if (!(func.kind === 173 && ts6.nodeIsPresent(func.body))) { + error(node, ts6.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + if (func.kind === 173 && ts6.isIdentifier(node.name) && node.name.escapedText === "constructor") { + error(node.name, ts6.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); + } + } + if ((node.questionToken || isJSDocOptionalParameter(node)) && ts6.isBindingPattern(node.name) && func.body) { + error(node, ts6.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + } + if (node.name && ts6.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { + if (func.parameters.indexOf(node) !== 0) { + error(node, ts6.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); + } + if (func.kind === 173 || func.kind === 177 || func.kind === 182) { + error(node, ts6.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + if (func.kind === 216) { + error(node, ts6.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); + } + if (func.kind === 174 || func.kind === 175) { + error(node, ts6.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); + } + } + if (node.dotDotDotToken && !ts6.isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) { + error(node, ts6.Diagnostics.A_rest_parameter_must_be_of_an_array_type); + } + } + function checkTypePredicate(node) { + var parent = getTypePredicateParent(node); + if (!parent) { + error(node, ts6.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + } + var signature = getSignatureFromDeclaration(parent); + var typePredicate = getTypePredicateOfSignature(signature); + if (!typePredicate) { + return; + } + checkSourceElement(node.type); + var parameterName = node.parameterName; + if (typePredicate.kind === 0 || typePredicate.kind === 2) { + getTypeFromThisTypeNode(parameterName); + } else { + if (typePredicate.parameterIndex >= 0) { + if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) { + error(parameterName, ts6.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + } else { + if (typePredicate.type) { + var leadingError = function() { + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type + ); + }; + checkTypeAssignableTo( + typePredicate.type, + getTypeOfSymbol(signature.parameters[typePredicate.parameterIndex]), + node.type, + /*headMessage*/ + void 0, + leadingError + ); + } + } + } else if (parameterName) { + var hasReportedError = false; + for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { + var name = _a[_i].name; + if (ts6.isBindingPattern(name) && checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { + hasReportedError = true; + break; + } + } + if (!hasReportedError) { + error(node.parameterName, ts6.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + } + } + } + } + function getTypePredicateParent(node) { + switch (node.parent.kind) { + case 216: + case 176: + case 259: + case 215: + case 181: + case 171: + case 170: + var parent = node.parent; + if (node === parent.type) { + return parent; + } + } + } + function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (ts6.isOmittedExpression(element)) { + continue; + } + var name = element.name; + if (name.kind === 79 && name.escapedText === predicateVariableName) { + error(predicateVariableNode, ts6.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); + return true; + } else if (name.kind === 204 || name.kind === 203) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { + return true; + } + } + } + } + function checkSignatureDeclaration(node) { + if (node.kind === 178) { + checkGrammarIndexSignature(node); + } else if (node.kind === 181 || node.kind === 259 || node.kind === 182 || node.kind === 176 || node.kind === 173 || node.kind === 177) { + checkGrammarFunctionLikeDeclaration(node); + } + var functionFlags = ts6.getFunctionFlags(node); + if (!(functionFlags & 4)) { + if ((functionFlags & 3) === 3 && languageVersion < 99) { + checkExternalEmitHelpers( + node, + 6144 + /* ExternalEmitHelpers.AsyncGeneratorIncludes */ + ); + } + if ((functionFlags & 3) === 2 && languageVersion < 4) { + checkExternalEmitHelpers( + node, + 64 + /* ExternalEmitHelpers.Awaiter */ + ); + } + if ((functionFlags & 3) !== 0 && languageVersion < 2) { + checkExternalEmitHelpers( + node, + 128 + /* ExternalEmitHelpers.Generator */ + ); + } + } + checkTypeParameters(ts6.getEffectiveTypeParameterDeclarations(node)); + checkUnmatchedJSDocParameters(node); + ts6.forEach(node.parameters, checkParameter); + if (node.type) { + checkSourceElement(node.type); + } + addLazyDiagnostic(checkSignatureDeclarationDiagnostics); + function checkSignatureDeclarationDiagnostics() { + checkCollisionWithArgumentsInGeneratedCode(node); + var returnTypeNode = ts6.getEffectiveReturnTypeNode(node); + if (noImplicitAny && !returnTypeNode) { + switch (node.kind) { + case 177: + error(node, ts6.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + case 176: + error(node, ts6.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + } + } + if (returnTypeNode) { + var functionFlags_1 = ts6.getFunctionFlags(node); + if ((functionFlags_1 & (4 | 1)) === 1) { + var returnType = getTypeFromTypeNode(returnTypeNode); + if (returnType === voidType) { + error(returnTypeNode, ts6.Diagnostics.A_generator_cannot_have_a_void_type_annotation); + } else { + var generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0, returnType, (functionFlags_1 & 2) !== 0) || anyType; + var generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, (functionFlags_1 & 2) !== 0) || generatorYieldType; + var generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2, returnType, (functionFlags_1 & 2) !== 0) || unknownType; + var generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags_1 & 2)); + checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode); + } + } else if ((functionFlags_1 & 3) === 2) { + checkAsyncFunctionReturnType(node, returnTypeNode); + } + } + if (node.kind !== 178 && node.kind !== 320) { + registerForUnusedIdentifiersCheck(node); + } + } + } + function checkClassForDuplicateDeclarations(node) { + var instanceNames = new ts6.Map(); + var staticNames = new ts6.Map(); + var privateIdentifiers = new ts6.Map(); + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 173) { + for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { + var param = _c[_b]; + if (ts6.isParameterPropertyDeclaration(param, member) && !ts6.isBindingPattern(param.name)) { + addName( + instanceNames, + param.name, + param.name.escapedText, + 3 + /* DeclarationMeaning.GetOrSetAccessor */ + ); + } + } + } else { + var isStaticMember = ts6.isStatic(member); + var name = member.name; + if (!name) { + continue; + } + var isPrivate = ts6.isPrivateIdentifier(name); + var privateStaticFlags = isPrivate && isStaticMember ? 16 : 0; + var names = isPrivate ? privateIdentifiers : isStaticMember ? staticNames : instanceNames; + var memberName = name && ts6.getPropertyNameForPropertyNameNode(name); + if (memberName) { + switch (member.kind) { + case 174: + addName(names, name, memberName, 1 | privateStaticFlags); + break; + case 175: + addName(names, name, memberName, 2 | privateStaticFlags); + break; + case 169: + addName(names, name, memberName, 3 | privateStaticFlags); + break; + case 171: + addName(names, name, memberName, 8 | privateStaticFlags); + break; + } + } + } + } + function addName(names2, location, name2, meaning) { + var prev = names2.get(name2); + if (prev) { + if ((prev & 16) !== (meaning & 16)) { + error(location, ts6.Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, ts6.getTextOfNode(location)); + } else { + var prevIsMethod = !!(prev & 8); + var isMethod = !!(meaning & 8); + if (prevIsMethod || isMethod) { + if (prevIsMethod !== isMethod) { + error(location, ts6.Diagnostics.Duplicate_identifier_0, ts6.getTextOfNode(location)); + } + } else if (prev & meaning & ~16) { + error(location, ts6.Diagnostics.Duplicate_identifier_0, ts6.getTextOfNode(location)); + } else { + names2.set(name2, prev | meaning); + } + } + } else { + names2.set(name2, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStaticMember = ts6.isStatic(member); + if (isStaticMember && memberNameNode) { + var memberName = ts6.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts6.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbolAsWritten(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } + } + } + } + function checkObjectTypeForDuplicateDeclarations(node) { + var names = new ts6.Map(); + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 168) { + var memberName = void 0; + var name = member.name; + switch (name.kind) { + case 10: + case 8: + memberName = name.text; + break; + case 79: + memberName = ts6.idText(name); + break; + default: + continue; + } + if (names.get(memberName)) { + error(ts6.getNameOfDeclaration(member.symbol.valueDeclaration), ts6.Diagnostics.Duplicate_identifier_0, memberName); + error(member.name, ts6.Diagnostics.Duplicate_identifier_0, memberName); + } else { + names.set(memberName, true); + } + } + } + } + function checkTypeForDuplicateIndexSignatures(node) { + if (node.kind === 261) { + var nodeSymbol = getSymbolOfNode(node); + if (nodeSymbol.declarations && nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { + return; + } + } + var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { + var indexSignatureMap_1 = new ts6.Map(); + var _loop_29 = function(declaration2) { + if (declaration2.parameters.length === 1 && declaration2.parameters[0].type) { + forEachType(getTypeFromTypeNode(declaration2.parameters[0].type), function(type) { + var entry = indexSignatureMap_1.get(getTypeId(type)); + if (entry) { + entry.declarations.push(declaration2); + } else { + indexSignatureMap_1.set(getTypeId(type), { type, declarations: [declaration2] }); + } + }); + } + }; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + _loop_29(declaration); + } + indexSignatureMap_1.forEach(function(entry) { + if (entry.declarations.length > 1) { + for (var _i2 = 0, _a2 = entry.declarations; _i2 < _a2.length; _i2++) { + var declaration2 = _a2[_i2]; + error(declaration2, ts6.Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type)); + } + } + }); + } + } + function checkPropertyDeclaration(node) { + if (!checkGrammarDecoratorsAndModifiers(node) && !checkGrammarProperty(node)) + checkGrammarComputedPropertyName(node.name); + checkVariableLikeDeclaration(node); + setNodeLinksForPrivateIdentifierScope(node); + if (ts6.hasSyntacticModifier( + node, + 256 + /* ModifierFlags.Abstract */ + ) && node.kind === 169 && node.initializer) { + error(node, ts6.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts6.declarationNameToString(node.name)); + } + } + function checkPropertySignature(node) { + if (ts6.isPrivateIdentifier(node.name)) { + error(node, ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + } + return checkPropertyDeclaration(node); + } + function checkMethodDeclaration(node) { + if (!checkGrammarMethod(node)) + checkGrammarComputedPropertyName(node.name); + if (ts6.isMethodDeclaration(node) && node.asteriskToken && ts6.isIdentifier(node.name) && ts6.idText(node.name) === "constructor") { + error(node.name, ts6.Diagnostics.Class_constructor_may_not_be_a_generator); + } + checkFunctionOrMethodDeclaration(node); + if (ts6.hasSyntacticModifier( + node, + 256 + /* ModifierFlags.Abstract */ + ) && node.kind === 171 && node.body) { + error(node, ts6.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts6.declarationNameToString(node.name)); + } + if (ts6.isPrivateIdentifier(node.name) && !ts6.getContainingClass(node)) { + error(node, ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + } + setNodeLinksForPrivateIdentifierScope(node); + } + function setNodeLinksForPrivateIdentifierScope(node) { + if (ts6.isPrivateIdentifier(node.name) && languageVersion < 99) { + for (var lexicalScope = ts6.getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = ts6.getEnclosingBlockScopeContainer(lexicalScope)) { + getNodeLinks(lexicalScope).flags |= 67108864; + } + if (ts6.isClassExpression(node.parent)) { + var enclosingIterationStatement = getEnclosingIterationStatement(node.parent); + if (enclosingIterationStatement) { + getNodeLinks(node.name).flags |= 524288; + getNodeLinks(enclosingIterationStatement).flags |= 65536; + } + } + } + } + function checkClassStaticBlockDeclaration(node) { + checkGrammarDecoratorsAndModifiers(node); + ts6.forEachChild(node, checkSourceElement); + } + function checkConstructorDeclaration(node) { + checkSignatureDeclaration(node); + if (!checkGrammarConstructorTypeParameters(node)) + checkGrammarConstructorTypeAnnotation(node); + checkSourceElement(node.body); + var symbol = getSymbolOfNode(node); + var firstDeclaration = ts6.getDeclarationOfKind(symbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(symbol); + } + if (ts6.nodeIsMissing(node.body)) { + return; + } + addLazyDiagnostic(checkConstructorDeclarationDiagnostics); + return; + function isInstancePropertyWithInitializerOrPrivateIdentifierProperty(n) { + if (ts6.isPrivateIdentifierClassElementDeclaration(n)) { + return true; + } + return n.kind === 169 && !ts6.isStatic(n) && !!n.initializer; + } + function checkConstructorDeclarationDiagnostics() { + var containingClassDecl = node.parent; + if (ts6.getClassExtendsHeritageElement(containingClassDecl)) { + captureLexicalThis(node.parent, containingClassDecl); + var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); + var superCall = findFirstSuperCall(node.body); + if (superCall) { + if (classExtendsNull) { + error(superCall, ts6.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + } + var superCallShouldBeRootLevel = (ts6.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) && (ts6.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || ts6.some(node.parameters, function(p) { + return ts6.hasSyntacticModifier( + p, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + ); + })); + if (superCallShouldBeRootLevel) { + if (!superCallIsRootLevelInConstructor(superCall, node.body)) { + error(superCall, ts6.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers); + } else { + var superCallStatement = void 0; + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (ts6.isExpressionStatement(statement) && ts6.isSuperCall(ts6.skipOuterExpressions(statement.expression))) { + superCallStatement = statement; + break; + } + if (nodeImmediatelyReferencesSuperOrThis(statement)) { + break; + } + } + if (superCallStatement === void 0) { + error(node, ts6.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers); + } + } + } + } else if (!classExtendsNull) { + error(node, ts6.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + } + } + } + } + function superCallIsRootLevelInConstructor(superCall, body) { + var superCallParent = ts6.walkUpParenthesizedExpressions(superCall.parent); + return ts6.isExpressionStatement(superCallParent) && superCallParent.parent === body; + } + function nodeImmediatelyReferencesSuperOrThis(node) { + if (node.kind === 106 || node.kind === 108) { + return true; + } + if (ts6.isThisContainerOrFunctionBlock(node)) { + return false; + } + return !!ts6.forEachChild(node, nodeImmediatelyReferencesSuperOrThis); + } + function checkAccessorDeclaration(node) { + if (ts6.isIdentifier(node.name) && ts6.idText(node.name) === "constructor") { + error(node.name, ts6.Diagnostics.Class_constructor_may_not_be_an_accessor); + } + addLazyDiagnostic(checkAccessorDeclarationDiagnostics); + checkSourceElement(node.body); + setNodeLinksForPrivateIdentifierScope(node); + function checkAccessorDeclarationDiagnostics() { + if (!checkGrammarFunctionLikeDeclaration(node) && !checkGrammarAccessor(node)) + checkGrammarComputedPropertyName(node.name); + checkDecorators(node); + checkSignatureDeclaration(node); + if (node.kind === 174) { + if (!(node.flags & 16777216) && ts6.nodeIsPresent(node.body) && node.flags & 256) { + if (!(node.flags & 512)) { + error(node.name, ts6.Diagnostics.A_get_accessor_must_return_a_value); + } + } + } + if (node.name.kind === 164) { + checkComputedPropertyName(node.name); + } + if (hasBindableName(node)) { + var symbol = getSymbolOfNode(node); + var getter = ts6.getDeclarationOfKind( + symbol, + 174 + /* SyntaxKind.GetAccessor */ + ); + var setter = ts6.getDeclarationOfKind( + symbol, + 175 + /* SyntaxKind.SetAccessor */ + ); + if (getter && setter && !(getNodeCheckFlags(getter) & 1)) { + getNodeLinks(getter).flags |= 1; + var getterFlags = ts6.getEffectiveModifierFlags(getter); + var setterFlags = ts6.getEffectiveModifierFlags(setter); + if ((getterFlags & 256) !== (setterFlags & 256)) { + error(getter.name, ts6.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + error(setter.name, ts6.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + } + if (getterFlags & 16 && !(setterFlags & (16 | 8)) || getterFlags & 8 && !(setterFlags & 8)) { + error(getter.name, ts6.Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); + error(setter.name, ts6.Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); + } + var getterType = getAnnotatedAccessorType(getter); + var setterType = getAnnotatedAccessorType(setter); + if (getterType && setterType) { + checkTypeAssignableTo(getterType, setterType, getter, ts6.Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type); + } + } + } + var returnType = getTypeOfAccessors(getSymbolOfNode(node)); + if (node.kind === 174) { + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); + } + } + } + function checkMissingDeclaration(node) { + checkDecorators(node); + } + function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { + if (node.typeArguments && index < node.typeArguments.length) { + return getTypeFromTypeNode(node.typeArguments[index]); + } + return getEffectiveTypeArguments(node, typeParameters)[index]; + } + function getEffectiveTypeArguments(node, typeParameters) { + return fillMissingTypeArguments(ts6.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts6.isInJSFile(node)); + } + function checkTypeArgumentConstraints(node, typeParameters) { + var typeArguments; + var mapper; + var result = true; + for (var i = 0; i < typeParameters.length; i++) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + if (!typeArguments) { + typeArguments = getEffectiveTypeArguments(node, typeParameters); + mapper = createTypeMapper(typeParameters, typeArguments); + } + result = result && checkTypeAssignableTo(typeArguments[i], instantiateType(constraint, mapper), node.typeArguments[i], ts6.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + return result; + } + function getTypeParametersForTypeReference(node) { + var type = getTypeFromTypeReference(node); + if (!isErrorType(type)) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol) { + return symbol.flags & 524288 && getSymbolLinks(symbol).typeParameters || (ts6.getObjectFlags(type) & 4 ? type.target.localTypeParameters : void 0); + } + } + return void 0; + } + function checkTypeReferenceNode(node) { + checkGrammarTypeArguments(node, node.typeArguments); + if (node.kind === 180 && node.typeName.jsdocDotPos !== void 0 && !ts6.isInJSFile(node) && !ts6.isInJSDoc(node)) { + grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts6.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); + } + ts6.forEach(node.typeArguments, checkSourceElement); + var type = getTypeFromTypeReference(node); + if (!isErrorType(type)) { + if (node.typeArguments) { + addLazyDiagnostic(function() { + var typeParameters = getTypeParametersForTypeReference(node); + if (typeParameters) { + checkTypeArgumentConstraints(node, typeParameters); + } + }); + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol) { + if (ts6.some(symbol.declarations, function(d) { + return ts6.isTypeDeclaration(d) && !!(d.flags & 268435456); + })) { + addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); + } + if (type.flags & 32 && symbol.flags & 8) { + error(node, ts6.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type)); + } + } + } + } + function getTypeArgumentConstraint(node) { + var typeReferenceNode = ts6.tryCast(node.parent, ts6.isTypeReferenceType); + if (!typeReferenceNode) + return void 0; + var typeParameters = getTypeParametersForTypeReference(typeReferenceNode); + if (!typeParameters) + return void 0; + var constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]); + return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters))); + } + function checkTypeQuery(node) { + getTypeFromTypeQueryNode(node); + } + function checkTypeLiteral(node) { + ts6.forEach(node.members, checkSourceElement); + addLazyDiagnostic(checkTypeLiteralDiagnostics); + function checkTypeLiteralDiagnostics() { + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + checkIndexConstraints(type, type.symbol); + checkTypeForDuplicateIndexSignatures(node); + checkObjectTypeForDuplicateDeclarations(node); + } + } + function checkArrayType(node) { + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + var elementTypes = node.elements; + var seenOptionalElement = false; + var seenRestElement = false; + var hasNamedElement = ts6.some(elementTypes, ts6.isNamedTupleMember); + for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { + var e = elementTypes_1[_i]; + if (e.kind !== 199 && hasNamedElement) { + grammarErrorOnNode(e, ts6.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); + break; + } + var flags = getTupleElementFlags(e); + if (flags & 8) { + var type = getTypeFromTypeNode(e.type); + if (!isArrayLikeType(type)) { + error(e, ts6.Diagnostics.A_rest_element_type_must_be_an_array_type); + break; + } + if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4) { + seenRestElement = true; + } + } else if (flags & 4) { + if (seenRestElement) { + grammarErrorOnNode(e, ts6.Diagnostics.A_rest_element_cannot_follow_another_rest_element); + break; + } + seenRestElement = true; + } else if (flags & 2) { + if (seenRestElement) { + grammarErrorOnNode(e, ts6.Diagnostics.An_optional_element_cannot_follow_a_rest_element); + break; + } + seenOptionalElement = true; + } else if (seenOptionalElement) { + grammarErrorOnNode(e, ts6.Diagnostics.A_required_element_cannot_follow_an_optional_element); + break; + } + } + ts6.forEach(node.elements, checkSourceElement); + getTypeFromTypeNode(node); + } + function checkUnionOrIntersectionType(node) { + ts6.forEach(node.types, checkSourceElement); + getTypeFromTypeNode(node); + } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 8388608)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType( + objectType, + /*stringsOnly*/ + false + ))) { + if (accessNode.kind === 209 && ts6.isAssignmentTarget(accessNode) && ts6.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) { + error(accessNode, ts6.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + } + return type; + } + var apparentObjectType = getApparentType(objectType); + if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind( + indexType, + 296 + /* TypeFlags.NumberLike */ + )) { + return type; + } + if (isGenericObjectType(objectType)) { + var propertyName_1 = getPropertyNameFromIndex(indexType, accessNode); + if (propertyName_1) { + var propertySymbol = forEachType(apparentObjectType, function(t) { + return getPropertyOfType(t, propertyName_1); + }); + if (propertySymbol && ts6.getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24) { + error(accessNode, ts6.Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, ts6.unescapeLeadingUnderscores(propertyName_1)); + return errorType; + } + } + } + error(accessNode, ts6.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return errorType; + } + function checkIndexedAccessType(node) { + checkSourceElement(node.objectType); + checkSourceElement(node.indexType); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); + } + function checkMappedType(node) { + checkGrammarMappedType(node); + checkSourceElement(node.typeParameter); + checkSourceElement(node.nameType); + checkSourceElement(node.type); + if (!node.type) { + reportImplicitAny(node, anyType); + } + var type = getTypeFromMappedTypeNode(node); + var nameType = getNameTypeFromMappedType(type); + if (nameType) { + checkTypeAssignableTo(nameType, keyofConstraintType, node.nameType); + } else { + var constraintType = getConstraintTypeFromMappedType(type); + checkTypeAssignableTo(constraintType, keyofConstraintType, ts6.getEffectiveConstraintOfTypeParameter(node.typeParameter)); + } + } + function checkGrammarMappedType(node) { + var _a; + if ((_a = node.members) === null || _a === void 0 ? void 0 : _a.length) { + return grammarErrorOnNode(node.members[0], ts6.Diagnostics.A_mapped_type_may_not_declare_properties_or_methods); + } + } + function checkThisType(node) { + getTypeFromThisTypeNode(node); + } + function checkTypeOperator(node) { + checkGrammarTypeOperatorNode(node); + checkSourceElement(node.type); + } + function checkConditionalType(node) { + ts6.forEachChild(node, checkSourceElement); + } + function checkInferType(node) { + if (!ts6.findAncestor(node, function(n) { + return n.parent && n.parent.kind === 191 && n.parent.extendsType === n; + })) { + grammarErrorOnNode(node, ts6.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); + } + checkSourceElement(node.typeParameter); + var symbol = getSymbolOfNode(node.typeParameter); + if (symbol.declarations && symbol.declarations.length > 1) { + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var typeParameter = getDeclaredTypeOfTypeParameter(symbol); + var declarations = ts6.getDeclarationsOfKind( + symbol, + 165 + /* SyntaxKind.TypeParameter */ + ); + if (!areTypeParametersIdentical(declarations, [typeParameter], function(decl) { + return [decl]; + })) { + var name = symbolToString(symbol); + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; + error(declaration.name, ts6.Diagnostics.All_declarations_of_0_must_have_identical_constraints, name); + } + } + } + } + registerForUnusedIdentifiersCheck(node); + } + function checkTemplateLiteralType(node) { + for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) { + var span = _a[_i]; + checkSourceElement(span.type); + var type = getTypeFromTypeNode(span.type); + checkTypeAssignableTo(type, templateConstraintType, span.type); + } + getTypeFromTypeNode(node); + } + function checkImportType(node) { + checkSourceElement(node.argument); + if (node.assertions) { + var override = ts6.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode); + if (override) { + if (!ts6.isNightly()) { + grammarErrorOnNode(node.assertions.assertClause, ts6.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next); + } + if (ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.Node16 && ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.NodeNext) { + grammarErrorOnNode(node.assertions.assertClause, ts6.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext); + } + } + } + getTypeFromTypeNode(node); + } + function checkNamedTupleMember(node) { + if (node.dotDotDotToken && node.questionToken) { + grammarErrorOnNode(node, ts6.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); + } + if (node.type.kind === 187) { + grammarErrorOnNode(node.type, ts6.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); + } + if (node.type.kind === 188) { + grammarErrorOnNode(node.type, ts6.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); + } + checkSourceElement(node.type); + getTypeFromTypeNode(node); + } + function isPrivateWithinAmbient(node) { + return (ts6.hasEffectiveModifier( + node, + 8 + /* ModifierFlags.Private */ + ) || ts6.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216); + } + function getEffectiveDeclarationFlags(n, flagsToCheck) { + var flags = ts6.getCombinedModifierFlags(n); + if (n.parent.kind !== 261 && n.parent.kind !== 260 && n.parent.kind !== 228 && n.flags & 16777216) { + if (!(flags & 2) && !(ts6.isModuleBlock(n.parent) && ts6.isModuleDeclaration(n.parent.parent) && ts6.isGlobalScopeAugmentation(n.parent.parent))) { + flags |= 1; + } + flags |= 2; + } + return flags & flagsToCheck; + } + function checkFunctionOrConstructorSymbol(symbol) { + addLazyDiagnostic(function() { + return checkFunctionOrConstructorSymbolWorker(symbol); + }); + } + function checkFunctionOrConstructorSymbolWorker(symbol) { + function getCanonicalOverload(overloads, implementation) { + var implementationSharesContainerWithFirstOverload = implementation !== void 0 && implementation.parent === overloads[0].parent; + return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; + } + function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck2, someOverloadFlags, allOverloadFlags) { + var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + if (someButNotAllOverloadFlags !== 0) { + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck2); + ts6.forEach(overloads, function(o) { + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags_1; + if (deviation & 1) { + error(ts6.getNameOfDeclaration(o), ts6.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); + } else if (deviation & 2) { + error(ts6.getNameOfDeclaration(o), ts6.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + } else if (deviation & (8 | 16)) { + error(ts6.getNameOfDeclaration(o) || o, ts6.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + } else if (deviation & 256) { + error(ts6.getNameOfDeclaration(o), ts6.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); + } + }); + } + } + function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken2, allHaveQuestionToken2) { + if (someHaveQuestionToken2 !== allHaveQuestionToken2) { + var canonicalHasQuestionToken_1 = ts6.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + ts6.forEach(overloads, function(o) { + var deviation = ts6.hasQuestionToken(o) !== canonicalHasQuestionToken_1; + if (deviation) { + error(ts6.getNameOfDeclaration(o), ts6.Diagnostics.Overload_signatures_must_all_be_optional_or_required); + } + }); + } + } + var flagsToCheck = 1 | 2 | 8 | 16 | 256; + var someNodeFlags = 0; + var allNodeFlags = flagsToCheck; + var someHaveQuestionToken = false; + var allHaveQuestionToken = true; + var hasOverloads = false; + var bodyDeclaration; + var lastSeenNonAmbientDeclaration; + var previousDeclaration; + var declarations = symbol.declarations; + var isConstructor = (symbol.flags & 16384) !== 0; + function reportImplementationExpectedError(node2) { + if (node2.name && ts6.nodeIsMissing(node2.name)) { + return; + } + var seen = false; + var subsequentNode = ts6.forEachChild(node2.parent, function(c) { + if (seen) { + return c; + } else { + seen = c === node2; + } + }); + if (subsequentNode && subsequentNode.pos === node2.end) { + if (subsequentNode.kind === node2.kind) { + var errorNode_1 = subsequentNode.name || subsequentNode; + var subsequentName = subsequentNode.name; + if (node2.name && subsequentName && // both are private identifiers + (ts6.isPrivateIdentifier(node2.name) && ts6.isPrivateIdentifier(subsequentName) && node2.name.escapedText === subsequentName.escapedText || // Both are computed property names + // TODO: GH#17345: These are methods, so handle computed name case. (`Always allowing computed property names is *not* the correct behavior!) + ts6.isComputedPropertyName(node2.name) && ts6.isComputedPropertyName(subsequentName) || // Both are literal property names that are the same. + ts6.isPropertyNameLiteral(node2.name) && ts6.isPropertyNameLiteral(subsequentName) && ts6.getEscapedTextOfIdentifierOrLiteral(node2.name) === ts6.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { + var reportError = (node2.kind === 171 || node2.kind === 170) && ts6.isStatic(node2) !== ts6.isStatic(subsequentNode); + if (reportError) { + var diagnostic = ts6.isStatic(node2) ? ts6.Diagnostics.Function_overload_must_be_static : ts6.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } + return; + } + if (ts6.nodeIsPresent(subsequentNode.body)) { + error(errorNode_1, ts6.Diagnostics.Function_implementation_name_must_be_0, ts6.declarationNameToString(node2.name)); + return; + } + } + } + var errorNode = node2.name || node2; + if (isConstructor) { + error(errorNode, ts6.Diagnostics.Constructor_implementation_is_missing); + } else { + if (ts6.hasSyntacticModifier( + node2, + 256 + /* ModifierFlags.Abstract */ + )) { + error(errorNode, ts6.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); + } else { + error(errorNode, ts6.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + } + } + } + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; + var hasNonAmbientClass = false; + var functionDeclarations = []; + if (declarations) { + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var current = declarations_5[_i]; + var node = current; + var inAmbientContext = node.flags & 16777216; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 || node.parent.kind === 184) || inAmbientContext; + if (inAmbientContextOrInterface) { + previousDeclaration = void 0; + } + if ((node.kind === 260 || node.kind === 228) && !inAmbientContext) { + hasNonAmbientClass = true; + } + if (node.kind === 259 || node.kind === 171 || node.kind === 170 || node.kind === 173) { + functionDeclarations.push(node); + var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + someNodeFlags |= currentNodeFlags; + allNodeFlags &= currentNodeFlags; + someHaveQuestionToken = someHaveQuestionToken || ts6.hasQuestionToken(node); + allHaveQuestionToken = allHaveQuestionToken && ts6.hasQuestionToken(node); + var bodyIsPresent = ts6.nodeIsPresent(node.body); + if (bodyIsPresent && bodyDeclaration) { + if (isConstructor) { + multipleConstructorImplementation = true; + } else { + duplicateFunctionDeclaration = true; + } + } else if ((previousDeclaration === null || previousDeclaration === void 0 ? void 0 : previousDeclaration.parent) === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); + } + if (bodyIsPresent) { + if (!bodyDeclaration) { + bodyDeclaration = node; + } + } else { + hasOverloads = true; + } + previousDeclaration = node; + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } + } + } + } + if (multipleConstructorImplementation) { + ts6.forEach(functionDeclarations, function(declaration) { + error(declaration, ts6.Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + if (duplicateFunctionDeclaration) { + ts6.forEach(functionDeclarations, function(declaration) { + error(ts6.getNameOfDeclaration(declaration) || declaration, ts6.Diagnostics.Duplicate_function_implementation); + }); + } + if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 && declarations) { + var relatedDiagnostics_1 = ts6.filter(declarations, function(d) { + return d.kind === 260; + }).map(function(d) { + return ts6.createDiagnosticForNode(d, ts6.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); + }); + ts6.forEach(declarations, function(declaration) { + var diagnostic = declaration.kind === 260 ? ts6.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 : declaration.kind === 259 ? ts6.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : void 0; + if (diagnostic) { + ts6.addRelatedInfo.apply(void 0, __spreadArray([error(ts6.getNameOfDeclaration(declaration) || declaration, diagnostic, ts6.symbolName(symbol))], relatedDiagnostics_1, false)); + } + }); + } + if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && !ts6.hasSyntacticModifier( + lastSeenNonAmbientDeclaration, + 256 + /* ModifierFlags.Abstract */ + ) && !lastSeenNonAmbientDeclaration.questionToken) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); + } + if (hasOverloads) { + if (declarations) { + checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags); + checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); + } + if (bodyDeclaration) { + var signatures = getSignaturesOfSymbol(symbol); + var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + for (var _a = 0, signatures_10 = signatures; _a < signatures_10.length; _a++) { + var signature = signatures_10[_a]; + if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { + ts6.addRelatedInfo(error(signature.declaration, ts6.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts6.createDiagnosticForNode(bodyDeclaration, ts6.Diagnostics.The_implementation_signature_is_declared_here)); + break; + } + } + } + } + } + function checkExportsOnMergedDeclarations(node) { + addLazyDiagnostic(function() { + return checkExportsOnMergedDeclarationsWorker(node); + }); + } + function checkExportsOnMergedDeclarationsWorker(node) { + var symbol = node.localSymbol; + if (!symbol) { + symbol = getSymbolOfNode(node); + if (!symbol.exportSymbol) { + return; + } + } + if (ts6.getDeclarationOfKind(symbol, node.kind) !== node) { + return; + } + var exportedDeclarationSpaces = 0; + var nonExportedDeclarationSpaces = 0; + var defaultExportedDeclarationSpaces = 0; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var d = _a[_i]; + var declarationSpaces = getDeclarationSpaces(d); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags( + d, + 1 | 1024 + /* ModifierFlags.Default */ + ); + if (effectiveDeclarationFlags & 1) { + if (effectiveDeclarationFlags & 1024) { + defaultExportedDeclarationSpaces |= declarationSpaces; + } else { + exportedDeclarationSpaces |= declarationSpaces; + } + } else { + nonExportedDeclarationSpaces |= declarationSpaces; + } + } + var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; + var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; + if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declarationSpaces = getDeclarationSpaces(d); + var name = ts6.getNameOfDeclaration(d); + if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { + error(name, ts6.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts6.declarationNameToString(name)); + } else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { + error(name, ts6.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts6.declarationNameToString(name)); + } + } + } + function getDeclarationSpaces(decl) { + var d2 = decl; + switch (d2.kind) { + case 261: + case 262: + case 348: + case 341: + case 342: + return 2; + case 264: + return ts6.isAmbientModule(d2) || ts6.getModuleInstanceState(d2) !== 0 ? 4 | 1 : 4; + case 260: + case 263: + case 302: + return 2 | 1; + case 308: + return 2 | 1 | 4; + case 274: + case 223: + var node_2 = d2; + var expression = ts6.isExportAssignment(node_2) ? node_2.expression : node_2.right; + if (!ts6.isEntityNameExpression(expression)) { + return 1; + } + d2 = expression; + case 268: + case 271: + case 270: + var result_12 = 0; + var target = resolveAlias(getSymbolOfNode(d2)); + ts6.forEach(target.declarations, function(d3) { + result_12 |= getDeclarationSpaces(d3); + }); + return result_12; + case 257: + case 205: + case 259: + case 273: + case 79: + return 1; + default: + return ts6.Debug.failBadSyntaxKind(d2); + } + } + } + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, arg0) { + var promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0); + } + function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) { + if (isTypeAny(type)) { + return void 0; + } + var typeAsPromise = type; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; + } + if (isReferenceToType(type, getGlobalPromiseType( + /*reportErrors*/ + false + ))) { + return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; + } + if (allTypesAssignableToKind( + getBaseConstraintOrType(type), + 131068 | 131072 + /* TypeFlags.Never */ + )) { + return void 0; + } + var thenFunction = getTypeOfPropertyOfType(type, "then"); + if (isTypeAny(thenFunction)) { + return void 0; + } + var thenSignatures = thenFunction ? getSignaturesOfType( + thenFunction, + 0 + /* SignatureKind.Call */ + ) : ts6.emptyArray; + if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.A_promise_must_have_a_then_method); + } + return void 0; + } + var thisTypeForError; + var candidates; + for (var _i = 0, thenSignatures_1 = thenSignatures; _i < thenSignatures_1.length; _i++) { + var thenSignature = thenSignatures_1[_i]; + var thisType = getThisTypeOfSignature(thenSignature); + if (thisType && thisType !== voidType && !isTypeRelatedTo(type, thisType, subtypeRelation)) { + thisTypeForError = thisType; + } else { + candidates = ts6.append(candidates, thenSignature); + } + } + if (!candidates) { + ts6.Debug.assertIsDefined(thisTypeForError); + if (thisTypeForErrorOut) { + thisTypeForErrorOut.value = thisTypeForError; + } + if (errorNode) { + error(errorNode, ts6.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError)); + } + return void 0; + } + var onfulfilledParameterType = getTypeWithFacts( + getUnionType(ts6.map(candidates, getTypeOfFirstParameterOfSignature)), + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ); + if (isTypeAny(onfulfilledParameterType)) { + return void 0; + } + var onfulfilledParameterSignatures = getSignaturesOfType( + onfulfilledParameterType, + 0 + /* SignatureKind.Call */ + ); + if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } + return void 0; + } + return typeAsPromise.promisedTypeOfPromise = getUnionType( + ts6.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), + 2 + /* UnionReduction.Subtype */ + ); + } + function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, arg0) { + var awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0); + return awaitedType || errorType; + } + function isThenableType(type) { + if (allTypesAssignableToKind( + getBaseConstraintOrType(type), + 131068 | 131072 + /* TypeFlags.Never */ + )) { + return false; + } + var thenFunction = getTypeOfPropertyOfType(type, "then"); + return !!thenFunction && getSignaturesOfType( + getTypeWithFacts( + thenFunction, + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ), + 0 + /* SignatureKind.Call */ + ).length > 0; + } + function isAwaitedTypeInstantiation(type) { + var _a; + if (type.flags & 16777216) { + var awaitedSymbol = getGlobalAwaitedSymbol( + /*reportErrors*/ + false + ); + return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a = type.aliasTypeArguments) === null || _a === void 0 ? void 0 : _a.length) === 1; + } + return false; + } + function unwrapAwaitedType(type) { + return type.flags & 1048576 ? mapType(type, unwrapAwaitedType) : isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] : type; + } + function isAwaitedTypeNeeded(type) { + if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) { + return false; + } + if (isGenericObjectType(type)) { + var baseConstraint = getBaseConstraintOfType(type); + if (baseConstraint ? baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind( + type, + 8650752 + /* TypeFlags.TypeVariable */ + )) { + return true; + } + } + return false; + } + function tryCreateAwaitedType(type) { + var awaitedSymbol = getGlobalAwaitedSymbol( + /*reportErrors*/ + true + ); + if (awaitedSymbol) { + return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]); + } + return void 0; + } + function createAwaitedTypeIfNeeded(type) { + if (isAwaitedTypeNeeded(type)) { + var awaitedType = tryCreateAwaitedType(type); + if (awaitedType) { + return awaitedType; + } + } + ts6.Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like."); + return type; + } + function getAwaitedType(type, errorNode, diagnosticMessage, arg0) { + var awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0); + return awaitedType && createAwaitedTypeIfNeeded(awaitedType); + } + function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0) { + if (isTypeAny(type)) { + return type; + } + if (isAwaitedTypeInstantiation(type)) { + return type; + } + var typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; + } + if (type.flags & 1048576) { + if (awaitedTypeStack.lastIndexOf(type.id) >= 0) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); + } + return void 0; + } + var mapper = errorNode ? function(constituentType) { + return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); + } : getAwaitedTypeNoAlias; + awaitedTypeStack.push(type.id); + var mapped = mapType(type, mapper); + awaitedTypeStack.pop(); + return typeAsAwaitable.awaitedTypeOfType = mapped; + } + if (isAwaitedTypeNeeded(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + var thisTypeForErrorOut = { value: void 0 }; + var promisedType = getPromisedTypeOfPromise( + type, + /*errorNode*/ + void 0, + thisTypeForErrorOut + ); + if (promisedType) { + if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); + } + return void 0; + } + awaitedTypeStack.push(type.id); + var awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, arg0); + awaitedTypeStack.pop(); + if (!awaitedType) { + return void 0; + } + return typeAsAwaitable.awaitedTypeOfType = awaitedType; + } + if (isThenableType(type)) { + if (errorNode) { + ts6.Debug.assertIsDefined(diagnosticMessage); + var chain = void 0; + if (thisTypeForErrorOut.value) { + chain = ts6.chainDiagnosticMessages(chain, ts6.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value)); + } + chain = ts6.chainDiagnosticMessages(chain, diagnosticMessage, arg0); + diagnostics.add(ts6.createDiagnosticForNodeFromMessageChain(errorNode, chain)); + } + return void 0; + } + return typeAsAwaitable.awaitedTypeOfType = type; + } + function checkAsyncFunctionReturnType(node, returnTypeNode) { + var returnType = getTypeFromTypeNode(returnTypeNode); + if (languageVersion >= 2) { + if (isErrorType(returnType)) { + return; + } + var globalPromiseType = getGlobalPromiseType( + /*reportErrors*/ + true + ); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { + error(returnTypeNode, ts6.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType)); + return; + } + } else { + markTypeNodeAsReferenced(returnTypeNode); + if (isErrorType(returnType)) { + return; + } + var promiseConstructorName = ts6.getEntityNameFromTypeNode(returnTypeNode); + if (promiseConstructorName === void 0) { + error(returnTypeNode, ts6.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType)); + return; + } + var promiseConstructorSymbol = resolveEntityName( + promiseConstructorName, + 111551, + /*ignoreErrors*/ + true + ); + var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType; + if (isErrorType(promiseConstructorType)) { + if (promiseConstructorName.kind === 79 && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType( + /*reportErrors*/ + false + )) { + error(returnTypeNode, ts6.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } else { + error(returnTypeNode, ts6.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts6.entityNameToString(promiseConstructorName)); + } + return; + } + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType( + /*reportErrors*/ + true + ); + if (globalPromiseConstructorLikeType === emptyObjectType) { + error(returnTypeNode, ts6.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts6.entityNameToString(promiseConstructorName)); + return; + } + if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeNode, ts6.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) { + return; + } + var rootName = promiseConstructorName && ts6.getFirstIdentifier(promiseConstructorName); + var collidingSymbol = getSymbol( + node.locals, + rootName.escapedText, + 111551 + /* SymbolFlags.Value */ + ); + if (collidingSymbol) { + error(collidingSymbol.valueDeclaration, ts6.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts6.idText(rootName), ts6.entityNameToString(promiseConstructorName)); + return; + } + } + checkAwaitedType( + returnType, + /*withAlias*/ + false, + node, + ts6.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + ); + } + function checkDecorator(node) { + var signature = getResolvedSignature(node); + checkDeprecatedSignature(signature, node); + var returnType = getReturnTypeOfSignature(signature); + if (returnType.flags & 1) { + return; + } + var headMessage; + var expectedReturnType; + switch (node.parent.kind) { + case 260: + headMessage = ts6.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; + var classSymbol = getSymbolOfNode(node.parent); + var classConstructorType = getTypeOfSymbol(classSymbol); + expectedReturnType = getUnionType([classConstructorType, voidType]); + break; + case 169: + case 166: + headMessage = ts6.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; + expectedReturnType = voidType; + break; + case 171: + case 174: + case 175: + headMessage = ts6.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; + var methodType = getTypeOfNode(node.parent); + var descriptorType = createTypedPropertyDescriptorType(methodType); + expectedReturnType = getUnionType([descriptorType, voidType]); + break; + default: + return ts6.Debug.fail(); + } + checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage); + } + function markTypeNodeAsReferenced(node) { + markEntityNameOrEntityExpressionAsReference( + node && ts6.getEntityNameFromTypeNode(node), + /*forDecoratorMetadata*/ + false + ); + } + function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) { + if (!typeName) + return; + var rootName = ts6.getFirstIdentifier(typeName); + var meaning = (typeName.kind === 79 ? 788968 : 1920) | 2097152; + var rootSymbol = resolveName( + rootName, + rootName.escapedText, + meaning, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isReference*/ + true + ); + if (rootSymbol && rootSymbol.flags & 2097152) { + if (symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) { + markAliasSymbolAsReferenced(rootSymbol); + } else if (forDecoratorMetadata && compilerOptions.isolatedModules && ts6.getEmitModuleKind(compilerOptions) >= ts6.ModuleKind.ES2015 && !symbolIsValue(rootSymbol) && !ts6.some(rootSymbol.declarations, ts6.isTypeOnlyImportOrExportDeclaration)) { + var diag = error(typeName, ts6.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled); + var aliasDeclaration = ts6.find(rootSymbol.declarations || ts6.emptyArray, isAliasSymbolDeclaration); + if (aliasDeclaration) { + ts6.addRelatedInfo(diag, ts6.createDiagnosticForNode(aliasDeclaration, ts6.Diagnostics._0_was_imported_here, ts6.idText(rootName))); + } + } + } + } + function markDecoratorMedataDataTypeNodeAsReferenced(node) { + var entityName = getEntityNameForDecoratorMetadata(node); + if (entityName && ts6.isEntityName(entityName)) { + markEntityNameOrEntityExpressionAsReference( + entityName, + /*forDecoratorMetadata*/ + true + ); + } + } + function getEntityNameForDecoratorMetadata(node) { + if (node) { + switch (node.kind) { + case 190: + case 189: + return getEntityNameForDecoratorMetadataFromTypeList(node.types); + case 191: + return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); + case 193: + case 199: + return getEntityNameForDecoratorMetadata(node.type); + case 180: + return node.typeName; + } + } + } + function getEntityNameForDecoratorMetadataFromTypeList(types) { + var commonEntityName; + for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { + var typeNode = types_21[_i]; + while (typeNode.kind === 193 || typeNode.kind === 199) { + typeNode = typeNode.type; + } + if (typeNode.kind === 144) { + continue; + } + if (!strictNullChecks && (typeNode.kind === 198 && typeNode.literal.kind === 104 || typeNode.kind === 155)) { + continue; + } + var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); + if (!individualEntityName) { + return void 0; + } + if (commonEntityName) { + if (!ts6.isIdentifier(commonEntityName) || !ts6.isIdentifier(individualEntityName) || commonEntityName.escapedText !== individualEntityName.escapedText) { + return void 0; + } + } else { + commonEntityName = individualEntityName; + } + } + return commonEntityName; + } + function getParameterTypeNodeForDecoratorCheck(node) { + var typeNode = ts6.getEffectiveTypeAnnotationNode(node); + return ts6.isRestParameter(node) ? ts6.getRestParameterElementType(typeNode) : typeNode; + } + function checkDecorators(node) { + if (!ts6.canHaveDecorators(node) || !ts6.hasDecorators(node) || !node.modifiers || !ts6.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { + return; + } + if (!compilerOptions.experimentalDecorators) { + error(node, ts6.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning); + } + var firstDecorator = ts6.find(node.modifiers, ts6.isDecorator); + if (!firstDecorator) { + return; + } + checkExternalEmitHelpers( + firstDecorator, + 8 + /* ExternalEmitHelpers.Decorate */ + ); + if (node.kind === 166) { + checkExternalEmitHelpers( + firstDecorator, + 32 + /* ExternalEmitHelpers.Param */ + ); + } + if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers( + firstDecorator, + 16 + /* ExternalEmitHelpers.Metadata */ + ); + switch (node.kind) { + case 260: + var constructor = ts6.getFirstConstructorWithBody(node); + if (constructor) { + for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); + } + } + break; + case 174: + case 175: + var otherKind = node.kind === 174 ? 175 : 174; + var otherAccessor = ts6.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 171: + for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { + var parameter = _c[_b]; + markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); + } + markDecoratorMedataDataTypeNodeAsReferenced(ts6.getEffectiveReturnTypeNode(node)); + break; + case 169: + markDecoratorMedataDataTypeNodeAsReferenced(ts6.getEffectiveTypeAnnotationNode(node)); + break; + case 166: + markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + var containingSignature = node.parent; + for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { + var parameter = _e[_d]; + markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); + } + break; + } + } + for (var _f = 0, _g = node.modifiers; _f < _g.length; _f++) { + var modifier = _g[_f]; + if (ts6.isDecorator(modifier)) { + checkDecorator(modifier); + } + } + } + function checkFunctionDeclaration(node) { + addLazyDiagnostic(checkFunctionDeclarationDiagnostics); + function checkFunctionDeclarationDiagnostics() { + checkFunctionOrMethodDeclaration(node); + checkGrammarForGenerator(node); + checkCollisionsForDeclarationName(node, node.name); + } + } + function checkJSDocTypeAliasTag(node) { + if (!node.typeExpression) { + error(node.name, ts6.Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags); + } + if (node.name) { + checkTypeNameIsReserved(node.name, ts6.Diagnostics.Type_alias_name_cannot_be_0); + } + checkSourceElement(node.typeExpression); + checkTypeParameters(ts6.getEffectiveTypeParameterDeclarations(node)); + } + function checkJSDocTemplateTag(node) { + checkSourceElement(node.constraint); + for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) { + var tp = _a[_i]; + checkSourceElement(tp); + } + } + function checkJSDocTypeTag(node) { + checkSourceElement(node.typeExpression); + } + function checkJSDocLinkLikeTag(node) { + if (node.name) { + resolveJSDocMemberName( + node.name, + /*ignoreErrors*/ + true + ); + } + } + function checkJSDocParameterTag(node) { + checkSourceElement(node.typeExpression); + } + function checkJSDocPropertyTag(node) { + checkSourceElement(node.typeExpression); + } + function checkJSDocFunctionType(node) { + addLazyDiagnostic(checkJSDocFunctionTypeImplicitAny); + checkSignatureDeclaration(node); + function checkJSDocFunctionTypeImplicitAny() { + if (!node.type && !ts6.isJSDocConstructSignature(node)) { + reportImplicitAny(node, anyType); + } + } + } + function checkJSDocImplementsTag(node) { + var classLike = ts6.getEffectiveJSDocHost(node); + if (!classLike || !ts6.isClassDeclaration(classLike) && !ts6.isClassExpression(classLike)) { + error(classLike, ts6.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts6.idText(node.tagName)); + } + } + function checkJSDocAugmentsTag(node) { + var classLike = ts6.getEffectiveJSDocHost(node); + if (!classLike || !ts6.isClassDeclaration(classLike) && !ts6.isClassExpression(classLike)) { + error(classLike, ts6.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts6.idText(node.tagName)); + return; + } + var augmentsTags = ts6.getJSDocTags(classLike).filter(ts6.isJSDocAugmentsTag); + ts6.Debug.assert(augmentsTags.length > 0); + if (augmentsTags.length > 1) { + error(augmentsTags[1], ts6.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); + } + var name = getIdentifierFromEntityNameExpression(node.class.expression); + var extend = ts6.getClassExtendsHeritageElement(classLike); + if (extend) { + var className = getIdentifierFromEntityNameExpression(extend.expression); + if (className && name.escapedText !== className.escapedText) { + error(name, ts6.Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, ts6.idText(node.tagName), ts6.idText(name), ts6.idText(className)); + } + } + } + function checkJSDocAccessibilityModifiers(node) { + var host2 = ts6.getJSDocHost(node); + if (host2 && ts6.isPrivateIdentifierClassElementDeclaration(host2)) { + error(node, ts6.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); + } + } + function getIdentifierFromEntityNameExpression(node) { + switch (node.kind) { + case 79: + return node; + case 208: + return node.name; + default: + return void 0; + } + } + function checkFunctionOrMethodDeclaration(node) { + var _a; + checkDecorators(node); + checkSignatureDeclaration(node); + var functionFlags = ts6.getFunctionFlags(node); + if (node.name && node.name.kind === 164) { + checkComputedPropertyName(node.name); + } + if (hasBindableName(node)) { + var symbol = getSymbolOfNode(node); + var localSymbol = node.localSymbol || symbol; + var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find( + // Get first non javascript function declaration + function(declaration) { + return declaration.kind === node.kind && !(declaration.flags & 262144); + } + ); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(localSymbol); + } + if (symbol.parent) { + checkFunctionOrConstructorSymbol(symbol); + } + } + var body = node.kind === 170 ? void 0 : node.body; + checkSourceElement(body); + checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); + addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); + if (ts6.isInJSFile(node)) { + var typeTag = ts6.getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) { + error(typeTag.typeExpression.type, ts6.Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature); + } + } + function checkFunctionOrMethodDeclarationDiagnostics() { + if (!ts6.getEffectiveReturnTypeNode(node)) { + if (ts6.nodeIsMissing(body) && !isPrivateWithinAmbient(node)) { + reportImplicitAny(node, anyType); + } + if (functionFlags & 1 && ts6.nodeIsPresent(body)) { + getReturnTypeOfSignature(getSignatureFromDeclaration(node)); + } + } + } + } + function registerForUnusedIdentifiersCheck(node) { + addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics); + function registerForUnusedIdentifiersCheckDiagnostics() { + var sourceFile = ts6.getSourceFileOfNode(node); + var potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path); + if (!potentiallyUnusedIdentifiers) { + potentiallyUnusedIdentifiers = []; + allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers); + } + potentiallyUnusedIdentifiers.push(node); + } + } + function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) { + for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { + var node = potentiallyUnusedIdentifiers_1[_i]; + switch (node.kind) { + case 260: + case 228: + checkUnusedClassMembers(node, addDiagnostic); + checkUnusedTypeParameters(node, addDiagnostic); + break; + case 308: + case 264: + case 238: + case 266: + case 245: + case 246: + case 247: + checkUnusedLocalsAndParameters(node, addDiagnostic); + break; + case 173: + case 215: + case 259: + case 216: + case 171: + case 174: + case 175: + if (node.body) { + checkUnusedLocalsAndParameters(node, addDiagnostic); + } + checkUnusedTypeParameters(node, addDiagnostic); + break; + case 170: + case 176: + case 177: + case 181: + case 182: + case 262: + case 261: + checkUnusedTypeParameters(node, addDiagnostic); + break; + case 192: + checkUnusedInferTypeParameter(node, addDiagnostic); + break; + default: + ts6.Debug.assertNever(node, "Node should not have been registered for unused identifiers check"); + } + } + } + function errorUnusedLocal(declaration, name, addDiagnostic) { + var node = ts6.getNameOfDeclaration(declaration) || declaration; + var message = ts6.isTypeDeclaration(declaration) ? ts6.Diagnostics._0_is_declared_but_never_used : ts6.Diagnostics._0_is_declared_but_its_value_is_never_read; + addDiagnostic(declaration, 0, ts6.createDiagnosticForNode(node, message, name)); + } + function isIdentifierThatStartsWithUnderscore(node) { + return ts6.isIdentifier(node) && ts6.idText(node).charCodeAt(0) === 95; + } + function checkUnusedClassMembers(node, addDiagnostic) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + switch (member.kind) { + case 171: + case 169: + case 174: + case 175: + if (member.kind === 175 && member.symbol.flags & 32768) { + break; + } + var symbol = getSymbolOfNode(member); + if (!symbol.isReferenced && (ts6.hasEffectiveModifier( + member, + 8 + /* ModifierFlags.Private */ + ) || ts6.isNamedDeclaration(member) && ts6.isPrivateIdentifier(member.name)) && !(member.flags & 16777216)) { + addDiagnostic(member, 0, ts6.createDiagnosticForNode(member.name, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); + } + break; + case 173: + for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { + var parameter = _c[_b]; + if (!parameter.symbol.isReferenced && ts6.hasSyntacticModifier( + parameter, + 8 + /* ModifierFlags.Private */ + )) { + addDiagnostic(parameter, 0, ts6.createDiagnosticForNode(parameter.name, ts6.Diagnostics.Property_0_is_declared_but_its_value_is_never_read, ts6.symbolName(parameter.symbol))); + } + } + break; + case 178: + case 237: + case 172: + break; + default: + ts6.Debug.fail("Unexpected class member"); + } + } + } + function checkUnusedInferTypeParameter(node, addDiagnostic) { + var typeParameter = node.typeParameter; + if (isTypeParameterUnused(typeParameter)) { + addDiagnostic(node, 1, ts6.createDiagnosticForNode(node, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, ts6.idText(typeParameter.name))); + } + } + function checkUnusedTypeParameters(node, addDiagnostic) { + var declarations = getSymbolOfNode(node).declarations; + if (!declarations || ts6.last(declarations) !== node) + return; + var typeParameters = ts6.getEffectiveTypeParameterDeclarations(node); + var seenParentsWithEveryUnused = new ts6.Set(); + for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) { + var typeParameter = typeParameters_4[_i]; + if (!isTypeParameterUnused(typeParameter)) + continue; + var name = ts6.idText(typeParameter.name); + var parent = typeParameter.parent; + if (parent.kind !== 192 && parent.typeParameters.every(isTypeParameterUnused)) { + if (ts6.tryAddToSet(seenParentsWithEveryUnused, parent)) { + var sourceFile = ts6.getSourceFileOfNode(parent); + var range2 = ts6.isJSDocTemplateTag(parent) ? ts6.rangeOfNode(parent) : ts6.rangeOfTypeParameters(sourceFile, parent.typeParameters); + var only = parent.typeParameters.length === 1; + var message = only ? ts6.Diagnostics._0_is_declared_but_its_value_is_never_read : ts6.Diagnostics.All_type_parameters_are_unused; + var arg0 = only ? name : void 0; + addDiagnostic(typeParameter, 1, ts6.createFileDiagnostic(sourceFile, range2.pos, range2.end - range2.pos, message, arg0)); + } + } else { + addDiagnostic(typeParameter, 1, ts6.createDiagnosticForNode(typeParameter, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, name)); + } + } + } + function isTypeParameterUnused(typeParameter) { + return !(getMergedSymbol(typeParameter.symbol).isReferenced & 262144) && !isIdentifierThatStartsWithUnderscore(typeParameter.name); + } + function addToGroup(map, key, value, getKey) { + var keyString = String(getKey(key)); + var group = map.get(keyString); + if (group) { + group[1].push(value); + } else { + map.set(keyString, [key, [value]]); + } + } + function tryGetRootParameterDeclaration(node) { + return ts6.tryCast(ts6.getRootDeclaration(node), ts6.isParameter); + } + function isValidUnusedLocalDeclaration(declaration) { + if (ts6.isBindingElement(declaration)) { + if (ts6.isObjectBindingPattern(declaration.parent)) { + return !!(declaration.propertyName && isIdentifierThatStartsWithUnderscore(declaration.name)); + } + return isIdentifierThatStartsWithUnderscore(declaration.name); + } + return ts6.isAmbientModule(declaration) || (ts6.isVariableDeclaration(declaration) && ts6.isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderscore(declaration.name); + } + function checkUnusedLocalsAndParameters(nodeWithLocals, addDiagnostic) { + var unusedImports = new ts6.Map(); + var unusedDestructures = new ts6.Map(); + var unusedVariables = new ts6.Map(); + nodeWithLocals.locals.forEach(function(local) { + if (local.flags & 262144 ? !(local.flags & 3 && !(local.isReferenced & 3)) : local.isReferenced || local.exportSymbol) { + return; + } + if (local.declarations) { + for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (isValidUnusedLocalDeclaration(declaration)) { + continue; + } + if (isImportedDeclaration(declaration)) { + addToGroup(unusedImports, importClauseFromImported(declaration), declaration, getNodeId); + } else if (ts6.isBindingElement(declaration) && ts6.isObjectBindingPattern(declaration.parent)) { + var lastElement = ts6.last(declaration.parent.elements); + if (declaration === lastElement || !ts6.last(declaration.parent.elements).dotDotDotToken) { + addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId); + } + } else if (ts6.isVariableDeclaration(declaration)) { + addToGroup(unusedVariables, declaration.parent, declaration, getNodeId); + } else { + var parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration); + var name = local.valueDeclaration && ts6.getNameOfDeclaration(local.valueDeclaration); + if (parameter && name) { + if (!ts6.isParameterPropertyDeclaration(parameter, parameter.parent) && !ts6.parameterIsThisKeyword(parameter) && !isIdentifierThatStartsWithUnderscore(name)) { + if (ts6.isBindingElement(declaration) && ts6.isArrayBindingPattern(declaration.parent)) { + addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId); + } else { + addDiagnostic(parameter, 1, ts6.createDiagnosticForNode(name, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, ts6.symbolName(local))); + } + } + } else { + errorUnusedLocal(declaration, ts6.symbolName(local), addDiagnostic); + } + } + } + } + }); + unusedImports.forEach(function(_a) { + var importClause = _a[0], unuseds = _a[1]; + var importDecl = importClause.parent; + var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 271 ? 1 : importClause.namedBindings.elements.length : 0); + if (nDeclarations === unuseds.length) { + addDiagnostic(importDecl, 0, unuseds.length === 1 ? ts6.createDiagnosticForNode(importDecl, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, ts6.idText(ts6.first(unuseds).name)) : ts6.createDiagnosticForNode(importDecl, ts6.Diagnostics.All_imports_in_import_declaration_are_unused)); + } else { + for (var _i = 0, unuseds_1 = unuseds; _i < unuseds_1.length; _i++) { + var unused = unuseds_1[_i]; + errorUnusedLocal(unused, ts6.idText(unused.name), addDiagnostic); + } + } + }); + unusedDestructures.forEach(function(_a) { + var bindingPattern = _a[0], bindingElements = _a[1]; + var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 : 0; + if (bindingPattern.elements.length === bindingElements.length) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 && bindingPattern.parent.parent.kind === 258) { + addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); + } else { + addDiagnostic(bindingPattern, kind, bindingElements.length === 1 ? ts6.createDiagnosticForNode(bindingPattern, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts6.first(bindingElements).name)) : ts6.createDiagnosticForNode(bindingPattern, ts6.Diagnostics.All_destructured_elements_are_unused)); + } + } else { + for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) { + var e = bindingElements_1[_i]; + addDiagnostic(e, kind, ts6.createDiagnosticForNode(e, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(e.name))); + } + } + }); + unusedVariables.forEach(function(_a) { + var declarationList = _a[0], declarations = _a[1]; + if (declarationList.declarations.length === declarations.length) { + addDiagnostic(declarationList, 0, declarations.length === 1 ? ts6.createDiagnosticForNode(ts6.first(declarations).name, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts6.first(declarations).name)) : ts6.createDiagnosticForNode(declarationList.parent.kind === 240 ? declarationList.parent : declarationList, ts6.Diagnostics.All_variables_are_unused)); + } else { + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var decl = declarations_6[_i]; + addDiagnostic(decl, 0, ts6.createDiagnosticForNode(decl, ts6.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name))); + } + } + }); + } + function checkPotentialUncheckedRenamedBindingElementsInTypes() { + var _a; + for (var _i = 0, potentialUnusedRenamedBindingElementsInTypes_1 = potentialUnusedRenamedBindingElementsInTypes; _i < potentialUnusedRenamedBindingElementsInTypes_1.length; _i++) { + var node = potentialUnusedRenamedBindingElementsInTypes_1[_i]; + if (!((_a = getSymbolOfNode(node)) === null || _a === void 0 ? void 0 : _a.isReferenced)) { + var wrappingDeclaration = ts6.walkUpBindingElementsAndPatterns(node); + ts6.Debug.assert(ts6.isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here"); + var diagnostic = ts6.createDiagnosticForNode(node.name, ts6.Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, ts6.declarationNameToString(node.name), ts6.declarationNameToString(node.propertyName)); + if (!wrappingDeclaration.type) { + ts6.addRelatedInfo(diagnostic, ts6.createFileDiagnostic(ts6.getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 1, ts6.Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, ts6.declarationNameToString(node.propertyName))); + } + diagnostics.add(diagnostic); + } + } + } + function bindingNameText(name) { + switch (name.kind) { + case 79: + return ts6.idText(name); + case 204: + case 203: + return bindingNameText(ts6.cast(ts6.first(name.elements), ts6.isBindingElement).name); + default: + return ts6.Debug.assertNever(name); + } + } + function isImportedDeclaration(node) { + return node.kind === 270 || node.kind === 273 || node.kind === 271; + } + function importClauseFromImported(decl) { + return decl.kind === 270 ? decl : decl.kind === 271 ? decl.parent : decl.parent.parent; + } + function checkBlock(node) { + if (node.kind === 238) { + checkGrammarStatementInAmbientContext(node); + } + if (ts6.isFunctionOrModuleBlock(node)) { + var saveFlowAnalysisDisabled = flowAnalysisDisabled; + ts6.forEach(node.statements, checkSourceElement); + flowAnalysisDisabled = saveFlowAnalysisDisabled; + } else { + ts6.forEach(node.statements, checkSourceElement); + } + if (node.locals) { + registerForUnusedIdentifiersCheck(node); + } + } + function checkCollisionWithArgumentsInGeneratedCode(node) { + if (languageVersion >= 2 || !ts6.hasRestParameter(node) || node.flags & 16777216 || ts6.nodeIsMissing(node.body)) { + return; + } + ts6.forEach(node.parameters, function(p) { + if (p.name && !ts6.isBindingPattern(p.name) && p.name.escapedText === argumentsSymbol.escapedName) { + errorSkippedOn("noEmit", p, ts6.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + } + }); + } + function needCollisionCheckForIdentifier(node, identifier, name) { + if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { + return false; + } + if (node.kind === 169 || node.kind === 168 || node.kind === 171 || node.kind === 170 || node.kind === 174 || node.kind === 175 || node.kind === 299) { + return false; + } + if (node.flags & 16777216) { + return false; + } + if (ts6.isImportClause(node) || ts6.isImportEqualsDeclaration(node) || ts6.isImportSpecifier(node)) { + if (ts6.isTypeOnlyImportOrExportDeclaration(node)) { + return false; + } + } + var root = ts6.getRootDeclaration(node); + if (ts6.isParameter(root) && ts6.nodeIsMissing(root.parent.body)) { + return false; + } + return true; + } + function checkIfThisIsCapturedInEnclosingScope(node) { + ts6.findAncestor(node, function(current) { + if (getNodeCheckFlags(current) & 4) { + var isDeclaration_1 = node.kind !== 79; + if (isDeclaration_1) { + error(ts6.getNameOfDeclaration(node), ts6.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + } else { + error(node, ts6.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + } + return true; + } + return false; + }); + } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + ts6.findAncestor(node, function(current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 79; + if (isDeclaration_2) { + error(ts6.getNameOfDeclaration(node), ts6.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } else { + error(node, ts6.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return true; + } + return false; + }); + } + function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + if (moduleKind >= ts6.ModuleKind.ES2015 && !(moduleKind >= ts6.ModuleKind.Node16 && ts6.getSourceFileOfNode(node).impliedNodeFormat === ts6.ModuleKind.CommonJS)) { + return; + } + if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { + return; + } + if (ts6.isModuleDeclaration(node) && ts6.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 308 && ts6.isExternalOrCommonJsModule(parent)) { + errorSkippedOn("noEmit", name, ts6.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts6.declarationNameToString(name), ts6.declarationNameToString(name)); + } + } + function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { + if (!name || languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { + return; + } + if (ts6.isModuleDeclaration(node) && ts6.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 308 && ts6.isExternalOrCommonJsModule(parent) && parent.flags & 2048) { + errorSkippedOn("noEmit", name, ts6.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts6.declarationNameToString(name), ts6.declarationNameToString(name)); + } + } + function recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name) { + if (languageVersion <= 8 && (needCollisionCheckForIdentifier(node, name, "WeakMap") || needCollisionCheckForIdentifier(node, name, "WeakSet"))) { + potentialWeakMapSetCollisions.push(node); + } + } + function checkWeakMapSetCollision(node) { + var enclosingBlockScope = ts6.getEnclosingBlockScopeContainer(node); + if (getNodeCheckFlags(enclosingBlockScope) & 67108864) { + ts6.Debug.assert(ts6.isNamedDeclaration(node) && ts6.isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier"); + errorSkippedOn("noEmit", node, ts6.Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText); + } + } + function recordPotentialCollisionWithReflectInGeneratedCode(node, name) { + if (name && languageVersion >= 2 && languageVersion <= 8 && needCollisionCheckForIdentifier(node, name, "Reflect")) { + potentialReflectCollisions.push(node); + } + } + function checkReflectCollision(node) { + var hasCollision = false; + if (ts6.isClassExpression(node)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (getNodeCheckFlags(member) & 134217728) { + hasCollision = true; + break; + } + } + } else if (ts6.isFunctionExpression(node)) { + if (getNodeCheckFlags(node) & 134217728) { + hasCollision = true; + } + } else { + var container = ts6.getEnclosingBlockScopeContainer(node); + if (container && getNodeCheckFlags(container) & 134217728) { + hasCollision = true; + } + } + if (hasCollision) { + ts6.Debug.assert(ts6.isNamedDeclaration(node) && ts6.isIdentifier(node.name), "The target of a Reflect collision check should be an identifier"); + errorSkippedOn("noEmit", node, ts6.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, ts6.declarationNameToString(node.name), "Reflect"); + } + } + function checkCollisionsForDeclarationName(node, name) { + if (!name) + return; + checkCollisionWithRequireExportsInGeneratedCode(node, name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, name); + recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name); + recordPotentialCollisionWithReflectInGeneratedCode(node, name); + if (ts6.isClassLike(node)) { + checkTypeNameIsReserved(name, ts6.Diagnostics.Class_name_cannot_be_0); + if (!(node.flags & 16777216)) { + checkClassNameCollisionWithObject(name); + } + } else if (ts6.isEnumDeclaration(node)) { + checkTypeNameIsReserved(name, ts6.Diagnostics.Enum_name_cannot_be_0); + } + } + function checkVarDeclaredNamesNotShadowed(node) { + if ((ts6.getCombinedNodeFlags(node) & 3) !== 0 || ts6.isParameterDeclaration(node)) { + return; + } + if (node.kind === 257 && !node.initializer) { + return; + } + var symbol = getSymbolOfNode(node); + if (symbol.flags & 1) { + if (!ts6.isIdentifier(node.name)) + return ts6.Debug.fail(); + var localDeclarationSymbol = resolveName( + node, + node.name.escapedText, + 3, + /*nodeNotFoundErrorMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + ); + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { + if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { + var varDeclList = ts6.getAncestor( + localDeclarationSymbol.valueDeclaration, + 258 + /* SyntaxKind.VariableDeclarationList */ + ); + var container = varDeclList.parent.kind === 240 && varDeclList.parent.parent ? varDeclList.parent.parent : void 0; + var namesShareScope = container && (container.kind === 238 && ts6.isFunctionLike(container.parent) || container.kind === 265 || container.kind === 264 || container.kind === 308); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(node, ts6.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } + } + } + } + } + function convertAutoToAny(type) { + return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type; + } + function checkVariableLikeDeclaration(node) { + var _a; + checkDecorators(node); + if (!ts6.isBindingElement(node)) { + checkSourceElement(node.type); + } + if (!node.name) { + return; + } + if (node.name.kind === 164) { + checkComputedPropertyName(node.name); + if (ts6.hasOnlyExpressionInitializer(node) && node.initializer) { + checkExpressionCached(node.initializer); + } + } + if (ts6.isBindingElement(node)) { + if (node.propertyName && ts6.isIdentifier(node.name) && ts6.isParameterDeclaration(node) && ts6.nodeIsMissing(ts6.getContainingFunction(node).body)) { + potentialUnusedRenamedBindingElementsInTypes.push(node); + return; + } + if (ts6.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5) { + checkExternalEmitHelpers( + node, + 4 + /* ExternalEmitHelpers.Rest */ + ); + } + if (node.propertyName && node.propertyName.kind === 164) { + checkComputedPropertyName(node.propertyName); + } + var parent = node.parent.parent; + var parentCheckMode = node.dotDotDotToken ? 64 : 0; + var parentType = getTypeForBindingElementParent(parent, parentCheckMode); + var name = node.propertyName || node.name; + if (parentType && !ts6.isBindingPattern(name)) { + var exprType = getLiteralTypeFromPropertyName(name); + if (isTypeUsableAsPropertyName(exprType)) { + var nameText = getPropertyNameFromType(exprType); + var property = getPropertyOfType(parentType, nameText); + if (property) { + markPropertyAsReferenced( + property, + /*nodeForCheckWriteOnly*/ + void 0, + /*isSelfTypeAccess*/ + false + ); + checkPropertyAccessibility( + node, + !!parent.initializer && parent.initializer.kind === 106, + /*writing*/ + false, + parentType, + property + ); + } + } + } + } + if (ts6.isBindingPattern(node.name)) { + if (node.name.kind === 204 && languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers( + node, + 512 + /* ExternalEmitHelpers.Read */ + ); + } + ts6.forEach(node.name.elements, checkSourceElement); + } + if (ts6.isParameter(node) && node.initializer && ts6.nodeIsMissing(ts6.getContainingFunction(node).body)) { + error(node, ts6.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + return; + } + if (ts6.isBindingPattern(node.name)) { + var needCheckInitializer = ts6.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246; + var needCheckWidenedType = !ts6.some(node.name.elements, ts6.not(ts6.isOmittedExpression)); + if (needCheckInitializer || needCheckWidenedType) { + var widenedType = getWidenedTypeForVariableLikeDeclaration(node); + if (needCheckInitializer) { + var initializerType = checkExpressionCached(node.initializer); + if (strictNullChecks && needCheckWidenedType) { + checkNonNullNonVoidType(initializerType, node); + } else { + checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer); + } + } + if (needCheckWidenedType) { + if (ts6.isArrayBindingPattern(node.name)) { + checkIteratedTypeOrElementType(65, widenedType, undefinedType, node); + } else if (strictNullChecks) { + checkNonNullNonVoidType(widenedType, node); + } + } + } + return; + } + var symbol = getSymbolOfNode(node); + if (symbol.flags & 2097152 && ts6.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 ? node.parent.parent : node)) { + checkAliasSymbol(node); + return; + } + var type = convertAutoToAny(getTypeOfSymbol(symbol)); + if (node === symbol.valueDeclaration) { + var initializer = ts6.hasOnlyExpressionInitializer(node) && ts6.getEffectiveInitializer(node); + if (initializer) { + var isJSObjectLiteralInitializer = ts6.isInJSFile(node) && ts6.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts6.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246) { + checkTypeAssignableToAndOptionallyElaborate( + checkExpressionCached(initializer), + type, + node, + initializer, + /*headMessage*/ + void 0 + ); + } + } + if (symbol.declarations && symbol.declarations.length > 1) { + if (ts6.some(symbol.declarations, function(d) { + return d !== node && ts6.isVariableLike(d) && !areDeclarationFlagsIdentical(d, node); + })) { + error(node.name, ts6.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts6.declarationNameToString(node.name)); + } + } + } else { + var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node)); + if (!isErrorType(type) && !isErrorType(declarationType) && !isTypeIdenticalTo(type, declarationType) && !(symbol.flags & 67108864)) { + errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); + } + if (ts6.hasOnlyExpressionInitializer(node) && node.initializer) { + checkTypeAssignableToAndOptionallyElaborate( + checkExpressionCached(node.initializer), + declarationType, + node, + node.initializer, + /*headMessage*/ + void 0 + ); + } + if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) { + error(node.name, ts6.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts6.declarationNameToString(node.name)); + } + } + if (node.kind !== 169 && node.kind !== 168) { + checkExportsOnMergedDeclarations(node); + if (node.kind === 257 || node.kind === 205) { + checkVarDeclaredNamesNotShadowed(node); + } + checkCollisionsForDeclarationName(node, node.name); + } + } + function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { + var nextDeclarationName = ts6.getNameOfDeclaration(nextDeclaration); + var message = nextDeclaration.kind === 169 || nextDeclaration.kind === 168 ? ts6.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts6.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; + var declName = ts6.declarationNameToString(nextDeclarationName); + var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType)); + if (firstDeclaration) { + ts6.addRelatedInfo(err, ts6.createDiagnosticForNode(firstDeclaration, ts6.Diagnostics._0_was_also_declared_here, declName)); + } + } + function areDeclarationFlagsIdentical(left, right) { + if (left.kind === 166 && right.kind === 257 || left.kind === 257 && right.kind === 166) { + return true; + } + if (ts6.hasQuestionToken(left) !== ts6.hasQuestionToken(right)) { + return false; + } + var interestingFlags = 8 | 16 | 512 | 256 | 64 | 32; + return ts6.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts6.getSelectedEffectiveModifierFlags(right, interestingFlags); + } + function checkVariableDeclaration(node) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("check", "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); + checkGrammarVariableDeclaration(node); + checkVariableLikeDeclaration(node); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + function checkBindingElement(node) { + checkGrammarBindingElement(node); + return checkVariableLikeDeclaration(node); + } + function checkVariableStatement(node) { + if (!checkGrammarDecoratorsAndModifiers(node) && !checkGrammarVariableDeclarationList(node.declarationList)) + checkGrammarForDisallowedLetOrConstStatement(node); + ts6.forEach(node.declarationList.declarations, checkSourceElement); + } + function checkExpressionStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + } + function checkIfStatement(node) { + checkGrammarStatementInAmbientContext(node); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); + checkSourceElement(node.thenStatement); + if (node.thenStatement.kind === 239) { + error(node.thenStatement, ts6.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + } + checkSourceElement(node.elseStatement); + } + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { + if (!strictNullChecks) + return; + helper(condExpr, body); + while (ts6.isBinaryExpression(condExpr) && condExpr.operatorToken.kind === 56) { + condExpr = condExpr.left; + helper(condExpr, body); + } + function helper(condExpr2, body2) { + var location = ts6.isBinaryExpression(condExpr2) && (condExpr2.operatorToken.kind === 56 || condExpr2.operatorToken.kind === 55) ? condExpr2.right : condExpr2; + if (ts6.isModuleExportsAccessExpression(location)) + return; + var type = location === condExpr2 ? condType : checkTruthinessExpression(location); + var isPropertyExpressionCast = ts6.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); + if (!(getTypeFacts(type) & 4194304) || isPropertyExpressionCast) + return; + var callSignatures = getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + var isPromise = !!getAwaitedTypeOfPromise(type); + if (callSignatures.length === 0 && !isPromise) { + return; + } + var testedNode = ts6.isIdentifier(location) ? location : ts6.isPropertyAccessExpression(location) ? location.name : ts6.isBinaryExpression(location) && ts6.isIdentifier(location.right) ? location.right : void 0; + var testedSymbol = testedNode && getSymbolAtLocation(testedNode); + if (!testedSymbol && !isPromise) { + return; + } + var isUsed = testedSymbol && ts6.isBinaryExpression(condExpr2.parent) && isSymbolUsedInBinaryExpressionChain(condExpr2.parent, testedSymbol) || testedSymbol && body2 && isSymbolUsedInConditionBody(condExpr2, body2, testedNode, testedSymbol); + if (!isUsed) { + if (isPromise) { + errorAndMaybeSuggestAwait( + location, + /*maybeMissingAwait*/ + true, + ts6.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, + getTypeNameForErrorDisplay(type) + ); + } else { + error(location, ts6.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead); + } + } + } + } + function isSymbolUsedInConditionBody(expr, body, testedNode, testedSymbol) { + return !!ts6.forEachChild(body, function check(childNode) { + if (ts6.isIdentifier(childNode)) { + var childSymbol = getSymbolAtLocation(childNode); + if (childSymbol && childSymbol === testedSymbol) { + if (ts6.isIdentifier(expr) || ts6.isIdentifier(testedNode) && ts6.isBinaryExpression(testedNode.parent)) { + return true; + } + var testedExpression = testedNode.parent; + var childExpression = childNode.parent; + while (testedExpression && childExpression) { + if (ts6.isIdentifier(testedExpression) && ts6.isIdentifier(childExpression) || testedExpression.kind === 108 && childExpression.kind === 108) { + return getSymbolAtLocation(testedExpression) === getSymbolAtLocation(childExpression); + } else if (ts6.isPropertyAccessExpression(testedExpression) && ts6.isPropertyAccessExpression(childExpression)) { + if (getSymbolAtLocation(testedExpression.name) !== getSymbolAtLocation(childExpression.name)) { + return false; + } + childExpression = childExpression.expression; + testedExpression = testedExpression.expression; + } else if (ts6.isCallExpression(testedExpression) && ts6.isCallExpression(childExpression)) { + childExpression = childExpression.expression; + testedExpression = testedExpression.expression; + } else { + return false; + } + } + } + } + return ts6.forEachChild(childNode, check); + }); + } + function isSymbolUsedInBinaryExpressionChain(node, testedSymbol) { + while (ts6.isBinaryExpression(node) && node.operatorToken.kind === 55) { + var isUsed = ts6.forEachChild(node.right, function visit(child) { + if (ts6.isIdentifier(child)) { + var symbol = getSymbolAtLocation(child); + if (symbol && symbol === testedSymbol) { + return true; + } + } + return ts6.forEachChild(child, visit); + }); + if (isUsed) { + return true; + } + node = node.parent; + } + return false; + } + function checkDoStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkSourceElement(node.statement); + checkTruthinessExpression(node.expression); + } + function checkWhileStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkTruthinessExpression(node.expression); + checkSourceElement(node.statement); + } + function checkTruthinessOfType(type, node) { + if (type.flags & 16384) { + error(node, ts6.Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness); + } + return type; + } + function checkTruthinessExpression(node, checkMode) { + return checkTruthinessOfType(checkExpression(node, checkMode), node); + } + function checkForStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind === 258) { + checkGrammarVariableDeclarationList(node.initializer); + } + } + if (node.initializer) { + if (node.initializer.kind === 258) { + ts6.forEach(node.initializer.declarations, checkVariableDeclaration); + } else { + checkExpression(node.initializer); + } + } + if (node.condition) + checkTruthinessExpression(node.condition); + if (node.incrementor) + checkExpression(node.incrementor); + checkSourceElement(node.statement); + if (node.locals) { + registerForUnusedIdentifiersCheck(node); + } + } + function checkForOfStatement(node) { + checkGrammarForInOrForOfStatement(node); + var container = ts6.getContainingFunctionOrClassStaticBlock(node); + if (node.awaitModifier) { + if (container && ts6.isClassStaticBlockDeclaration(container)) { + grammarErrorOnNode(node.awaitModifier, ts6.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block); + } else { + var functionFlags = ts6.getFunctionFlags(container); + if ((functionFlags & (4 | 2)) === 2 && languageVersion < 99) { + checkExternalEmitHelpers( + node, + 16384 + /* ExternalEmitHelpers.ForAwaitOfIncludes */ + ); + } + } + } else if (compilerOptions.downlevelIteration && languageVersion < 2) { + checkExternalEmitHelpers( + node, + 256 + /* ExternalEmitHelpers.ForOfIncludes */ + ); + } + if (node.initializer.kind === 258) { + checkForInOrForOfVariableDeclaration(node); + } else { + var varExpr = node.initializer; + var iteratedType = checkRightHandSideOfForOf(node); + if (varExpr.kind === 206 || varExpr.kind === 207) { + checkDestructuringAssignment(varExpr, iteratedType || errorType); + } else { + var leftType = checkExpression(varExpr); + checkReferenceExpression(varExpr, ts6.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access, ts6.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access); + if (iteratedType) { + checkTypeAssignableToAndOptionallyElaborate(iteratedType, leftType, varExpr, node.expression); + } + } + } + checkSourceElement(node.statement); + if (node.locals) { + registerForUnusedIdentifiersCheck(node); + } + } + function checkForInStatement(node) { + checkGrammarForInOrForOfStatement(node); + var rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression)); + if (node.initializer.kind === 258) { + var variable = node.initializer.declarations[0]; + if (variable && ts6.isBindingPattern(variable.name)) { + error(variable.name, ts6.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + } + checkForInOrForOfVariableDeclaration(node); + } else { + var varExpr = node.initializer; + var leftType = checkExpression(varExpr); + if (varExpr.kind === 206 || varExpr.kind === 207) { + error(varExpr, ts6.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { + error(varExpr, ts6.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + } else { + checkReferenceExpression(varExpr, ts6.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access, ts6.Diagnostics.The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access); + } + } + if (rightType === neverType || !isTypeAssignableToKind( + rightType, + 67108864 | 58982400 + /* TypeFlags.InstantiableNonPrimitive */ + )) { + error(node.expression, ts6.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); + } + checkSourceElement(node.statement); + if (node.locals) { + registerForUnusedIdentifiersCheck(node); + } + } + function checkForInOrForOfVariableDeclaration(iterationStatement) { + var variableDeclarationList = iterationStatement.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + checkVariableDeclaration(decl); + } + } + function checkRightHandSideOfForOf(statement) { + var use = statement.awaitModifier ? 15 : 13; + return checkIteratedTypeOrElementType(use, checkNonNullExpression(statement.expression), undefinedType, statement.expression); + } + function checkIteratedTypeOrElementType(use, inputType, sentType, errorNode) { + if (isTypeAny(inputType)) { + return inputType; + } + return getIteratedTypeOrElementType( + use, + inputType, + sentType, + errorNode, + /*checkAssignability*/ + true + ) || anyType; + } + function getIteratedTypeOrElementType(use, inputType, sentType, errorNode, checkAssignability) { + var allowAsyncIterables = (use & 2) !== 0; + if (inputType === neverType) { + reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables); + return void 0; + } + var uplevelIteration = languageVersion >= 2; + var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + var possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & 128); + if (uplevelIteration || downlevelIteration || allowAsyncIterables) { + var iterationTypes = getIterationTypesOfIterable(inputType, use, uplevelIteration ? errorNode : void 0); + if (checkAssignability) { + if (iterationTypes) { + var diagnostic = use & 8 ? ts6.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0 : use & 32 ? ts6.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0 : use & 64 ? ts6.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0 : use & 16 ? ts6.Diagnostics.Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0 : void 0; + if (diagnostic) { + checkTypeAssignableTo(sentType, iterationTypes.nextType, errorNode, diagnostic); + } + } + } + if (iterationTypes || uplevelIteration) { + return possibleOutOfBounds ? includeUndefinedInIndexSignature(iterationTypes && iterationTypes.yieldType) : iterationTypes && iterationTypes.yieldType; + } + } + var arrayType = inputType; + var reportedError = false; + var hasStringConstituent = false; + if (use & 4) { + if (arrayType.flags & 1048576) { + var arrayTypes = inputType.types; + var filteredTypes = ts6.filter(arrayTypes, function(t) { + return !(t.flags & 402653316); + }); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType( + filteredTypes, + 2 + /* UnionReduction.Subtype */ + ); + } + } else if (arrayType.flags & 402653316) { + arrayType = neverType; + } + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < 1) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + if (arrayType.flags & 131072) { + return possibleOutOfBounds ? includeUndefinedInIndexSignature(stringType) : stringType; + } + } + } + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + var allowsStrings = !!(use & 4) && !hasStringConstituent; + var _a = getIterationDiagnosticDetails(allowsStrings, downlevelIteration), defaultDiagnostic = _a[0], maybeMissingAwait = _a[1]; + errorAndMaybeSuggestAwait(errorNode, maybeMissingAwait && !!getAwaitedTypeOfPromise(arrayType), defaultDiagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? possibleOutOfBounds ? includeUndefinedInIndexSignature(stringType) : stringType : void 0; + } + var arrayElementType = getIndexTypeOfType(arrayType, numberType); + if (hasStringConstituent && arrayElementType) { + if (arrayElementType.flags & 402653316 && !compilerOptions.noUncheckedIndexedAccess) { + return stringType; + } + return getUnionType( + possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], + 2 + /* UnionReduction.Subtype */ + ); + } + return use & 128 ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType; + function getIterationDiagnosticDetails(allowsStrings2, downlevelIteration2) { + var _a2; + if (downlevelIteration2) { + return allowsStrings2 ? [ts6.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true] : [ts6.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true]; + } + var yieldType = getIterationTypeOfIterable( + use, + 0, + inputType, + /*errorNode*/ + void 0 + ); + if (yieldType) { + return [ts6.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false]; + } + if (isES2015OrLaterIterable((_a2 = inputType.symbol) === null || _a2 === void 0 ? void 0 : _a2.escapedName)) { + return [ts6.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true]; + } + return allowsStrings2 ? [ts6.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type, true] : [ts6.Diagnostics.Type_0_is_not_an_array_type, true]; + } + } + function isES2015OrLaterIterable(n) { + switch (n) { + case "Float32Array": + case "Float64Array": + case "Int16Array": + case "Int32Array": + case "Int8Array": + case "NodeList": + case "Uint16Array": + case "Uint32Array": + case "Uint8Array": + case "Uint8ClampedArray": + return true; + } + return false; + } + function getIterationTypeOfIterable(use, typeKind, inputType, errorNode) { + if (isTypeAny(inputType)) { + return void 0; + } + var iterationTypes = getIterationTypesOfIterable(inputType, use, errorNode); + return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(typeKind)]; + } + function createIterationTypes(yieldType, returnType, nextType) { + if (yieldType === void 0) { + yieldType = neverType; + } + if (returnType === void 0) { + returnType = neverType; + } + if (nextType === void 0) { + nextType = unknownType; + } + if (yieldType.flags & 67359327 && returnType.flags & (1 | 131072 | 2 | 16384 | 32768) && nextType.flags & (1 | 131072 | 2 | 16384 | 32768)) { + var id = getTypeListId([yieldType, returnType, nextType]); + var iterationTypes = iterationTypesCache.get(id); + if (!iterationTypes) { + iterationTypes = { yieldType, returnType, nextType }; + iterationTypesCache.set(id, iterationTypes); + } + return iterationTypes; + } + return { yieldType, returnType, nextType }; + } + function combineIterationTypes(array) { + var yieldTypes; + var returnTypes; + var nextTypes; + for (var _i = 0, array_11 = array; _i < array_11.length; _i++) { + var iterationTypes = array_11[_i]; + if (iterationTypes === void 0 || iterationTypes === noIterationTypes) { + continue; + } + if (iterationTypes === anyIterationTypes) { + return anyIterationTypes; + } + yieldTypes = ts6.append(yieldTypes, iterationTypes.yieldType); + returnTypes = ts6.append(returnTypes, iterationTypes.returnType); + nextTypes = ts6.append(nextTypes, iterationTypes.nextType); + } + if (yieldTypes || returnTypes || nextTypes) { + return createIterationTypes(yieldTypes && getUnionType(yieldTypes), returnTypes && getUnionType(returnTypes), nextTypes && getIntersectionType(nextTypes)); + } + return noIterationTypes; + } + function getCachedIterationTypes(type, cacheKey) { + return type[cacheKey]; + } + function setCachedIterationTypes(type, cacheKey, cachedTypes2) { + return type[cacheKey] = cachedTypes2; + } + function getIterationTypesOfIterable(type, use, errorNode) { + var _a, _b; + if (isTypeAny(type)) { + return anyIterationTypes; + } + if (!(type.flags & 1048576)) { + var errorOutputContainer = errorNode ? { errors: void 0 } : void 0; + var iterationTypes_1 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer); + if (iterationTypes_1 === noIterationTypes) { + if (errorNode) { + var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2)); + if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) { + ts6.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false)); + } + } + return void 0; + } else if ((_a = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _a === void 0 ? void 0 : _a.length) { + for (var _i = 0, _c = errorOutputContainer.errors; _i < _c.length; _i++) { + var diag = _c[_i]; + diagnostics.add(diag); + } + } + return iterationTypes_1; + } + var cacheKey = use & 2 ? "iterationTypesOfAsyncIterable" : "iterationTypesOfIterable"; + var cachedTypes2 = getCachedIterationTypes(type, cacheKey); + if (cachedTypes2) + return cachedTypes2 === noIterationTypes ? void 0 : cachedTypes2; + var allIterationTypes; + for (var _d = 0, _e = type.types; _d < _e.length; _d++) { + var constituent = _e[_d]; + var errorOutputContainer = errorNode ? { errors: void 0 } : void 0; + var iterationTypes_2 = getIterationTypesOfIterableWorker(constituent, use, errorNode, errorOutputContainer); + if (iterationTypes_2 === noIterationTypes) { + if (errorNode) { + var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2)); + if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) { + ts6.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false)); + } + } + setCachedIterationTypes(type, cacheKey, noIterationTypes); + return void 0; + } else if ((_b = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _b === void 0 ? void 0 : _b.length) { + for (var _f = 0, _g = errorOutputContainer.errors; _f < _g.length; _f++) { + var diag = _g[_f]; + diagnostics.add(diag); + } + } + allIterationTypes = ts6.append(allIterationTypes, iterationTypes_2); + } + var iterationTypes = allIterationTypes ? combineIterationTypes(allIterationTypes) : noIterationTypes; + setCachedIterationTypes(type, cacheKey, iterationTypes); + return iterationTypes === noIterationTypes ? void 0 : iterationTypes; + } + function getAsyncFromSyncIterationTypes(iterationTypes, errorNode) { + if (iterationTypes === noIterationTypes) + return noIterationTypes; + if (iterationTypes === anyIterationTypes) + return anyIterationTypes; + var yieldType = iterationTypes.yieldType, returnType = iterationTypes.returnType, nextType = iterationTypes.nextType; + if (errorNode) { + getGlobalAwaitedSymbol( + /*reportErrors*/ + true + ); + } + return createIterationTypes(getAwaitedType(yieldType, errorNode) || anyType, getAwaitedType(returnType, errorNode) || anyType, nextType); + } + function getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer) { + if (isTypeAny(type)) { + return anyIterationTypes; + } + var noCache = false; + if (use & 2) { + var iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver); + if (iterationTypes) { + if (iterationTypes === noIterationTypes && errorNode) { + noCache = true; + } else { + return use & 8 ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode) : iterationTypes; + } + } + } + if (use & 1) { + var iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) || getIterationTypesOfIterableFast(type, syncIterationTypesResolver); + if (iterationTypes) { + if (iterationTypes === noIterationTypes && errorNode) { + noCache = true; + } else { + if (use & 2) { + if (iterationTypes !== noIterationTypes) { + iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode); + return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes); + } + } else { + return iterationTypes; + } + } + } + } + if (use & 2) { + var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache); + if (iterationTypes !== noIterationTypes) { + return iterationTypes; + } + } + if (use & 1) { + var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache); + if (iterationTypes !== noIterationTypes) { + if (use & 2) { + iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode); + return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes); + } else { + return iterationTypes; + } + } + } + return noIterationTypes; + } + function getIterationTypesOfIterableCached(type, resolver) { + return getCachedIterationTypes(type, resolver.iterableCacheKey); + } + function getIterationTypesOfGlobalIterableType(globalType, resolver) { + var globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow( + globalType, + resolver, + /*errorNode*/ + void 0, + /*errorOutputContainer*/ + void 0, + /*noCache*/ + false + ); + return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes; + } + function getIterationTypesOfIterableFast(type, resolver) { + var globalType; + if (isReferenceToType(type, globalType = resolver.getGlobalIterableType( + /*reportErrors*/ + false + )) || isReferenceToType(type, globalType = resolver.getGlobalIterableIteratorType( + /*reportErrors*/ + false + ))) { + var yieldType = getTypeArguments(type)[0]; + var _a = getIterationTypesOfGlobalIterableType(globalType, resolver), returnType = _a.returnType, nextType = _a.nextType; + return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType( + yieldType, + /*errorNode*/ + void 0 + ) || yieldType, resolver.resolveIterationType( + returnType, + /*errorNode*/ + void 0 + ) || returnType, nextType)); + } + if (isReferenceToType(type, resolver.getGlobalGeneratorType( + /*reportErrors*/ + false + ))) { + var _b = getTypeArguments(type), yieldType = _b[0], returnType = _b[1], nextType = _b[2]; + return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType( + yieldType, + /*errorNode*/ + void 0 + ) || yieldType, resolver.resolveIterationType( + returnType, + /*errorNode*/ + void 0 + ) || returnType, nextType)); + } + } + function getPropertyNameForKnownSymbolName(symbolName) { + var ctorType = getGlobalESSymbolConstructorSymbol( + /*reportErrors*/ + false + ); + var uniqueType = ctorType && getTypeOfPropertyOfType(getTypeOfSymbol(ctorType), ts6.escapeLeadingUnderscores(symbolName)); + return uniqueType && isTypeUsableAsPropertyName(uniqueType) ? getPropertyNameFromType(uniqueType) : "__@".concat(symbolName); + } + function getIterationTypesOfIterableSlow(type, resolver, errorNode, errorOutputContainer, noCache) { + var _a; + var method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName)); + var methodType = method && !(method.flags & 16777216) ? getTypeOfSymbol(method) : void 0; + if (isTypeAny(methodType)) { + return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes); + } + var signatures = methodType ? getSignaturesOfType( + methodType, + 0 + /* SignatureKind.Call */ + ) : void 0; + if (!ts6.some(signatures)) { + return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes); + } + var iteratorType = getIntersectionType(ts6.map(signatures, getReturnTypeOfSignature)); + var iterationTypes = (_a = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache)) !== null && _a !== void 0 ? _a : noIterationTypes; + return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes); + } + function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { + var message = allowAsyncIterables ? ts6.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts6.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; + var suggestAwait = ( + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && ts6.isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType( + /** reportErrors */ + false + ) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType( + /** reportErrors */ + false + )) + ); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); + } + function getIterationTypesOfIterator(type, resolver, errorNode, errorOutputContainer) { + return getIterationTypesOfIteratorWorker( + type, + resolver, + errorNode, + errorOutputContainer, + /*noCache*/ + false + ); + } + function getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, noCache) { + if (isTypeAny(type)) { + return anyIterationTypes; + } + var iterationTypes = getIterationTypesOfIteratorCached(type, resolver) || getIterationTypesOfIteratorFast(type, resolver); + if (iterationTypes === noIterationTypes && errorNode) { + iterationTypes = void 0; + noCache = true; + } + iterationTypes !== null && iterationTypes !== void 0 ? iterationTypes : iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache); + return iterationTypes === noIterationTypes ? void 0 : iterationTypes; + } + function getIterationTypesOfIteratorCached(type, resolver) { + return getCachedIterationTypes(type, resolver.iteratorCacheKey); + } + function getIterationTypesOfIteratorFast(type, resolver) { + var globalType = resolver.getGlobalIterableIteratorType( + /*reportErrors*/ + false + ); + if (isReferenceToType(type, globalType)) { + var yieldType = getTypeArguments(type)[0]; + var globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow( + globalType, + resolver, + /*errorNode*/ + void 0, + /*errorOutputContainer*/ + void 0, + /*noCache*/ + false + ); + var _a = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes, returnType = _a.returnType, nextType = _a.nextType; + return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType)); + } + if (isReferenceToType(type, resolver.getGlobalIteratorType( + /*reportErrors*/ + false + )) || isReferenceToType(type, resolver.getGlobalGeneratorType( + /*reportErrors*/ + false + ))) { + var _b = getTypeArguments(type), yieldType = _b[0], returnType = _b[1], nextType = _b[2]; + return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType)); + } + } + function isIteratorResult(type, kind) { + var doneType = getTypeOfPropertyOfType(type, "done") || falseType; + return isTypeAssignableTo(kind === 0 ? falseType : trueType, doneType); + } + function isYieldIteratorResult(type) { + return isIteratorResult( + type, + 0 + /* IterationTypeKind.Yield */ + ); + } + function isReturnIteratorResult(type) { + return isIteratorResult( + type, + 1 + /* IterationTypeKind.Return */ + ); + } + function getIterationTypesOfIteratorResult(type) { + if (isTypeAny(type)) { + return anyIterationTypes; + } + var cachedTypes2 = getCachedIterationTypes(type, "iterationTypesOfIteratorResult"); + if (cachedTypes2) { + return cachedTypes2; + } + if (isReferenceToType(type, getGlobalIteratorYieldResultType( + /*reportErrors*/ + false + ))) { + var yieldType_1 = getTypeArguments(type)[0]; + return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes( + yieldType_1, + /*returnType*/ + void 0, + /*nextType*/ + void 0 + )); + } + if (isReferenceToType(type, getGlobalIteratorReturnResultType( + /*reportErrors*/ + false + ))) { + var returnType_1 = getTypeArguments(type)[0]; + return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes( + /*yieldType*/ + void 0, + returnType_1, + /*nextType*/ + void 0 + )); + } + var yieldIteratorResult = filterType(type, isYieldIteratorResult); + var yieldType = yieldIteratorResult !== neverType ? getTypeOfPropertyOfType(yieldIteratorResult, "value") : void 0; + var returnIteratorResult = filterType(type, isReturnIteratorResult); + var returnType = returnIteratorResult !== neverType ? getTypeOfPropertyOfType(returnIteratorResult, "value") : void 0; + if (!yieldType && !returnType) { + return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", noIterationTypes); + } + return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes( + yieldType, + returnType || voidType, + /*nextType*/ + void 0 + )); + } + function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) { + var _a, _b, _c, _d, _e, _f; + var method = getPropertyOfType(type, methodName); + if (!method && methodName !== "next") { + return void 0; + } + var methodType = method && !(methodName === "next" && method.flags & 16777216) ? methodName === "next" ? getTypeOfSymbol(method) : getTypeWithFacts( + getTypeOfSymbol(method), + 2097152 + /* TypeFacts.NEUndefinedOrNull */ + ) : void 0; + if (isTypeAny(methodType)) { + return methodName === "next" ? anyIterationTypes : anyIterationTypesExceptNext; + } + var methodSignatures = methodType ? getSignaturesOfType( + methodType, + 0 + /* SignatureKind.Call */ + ) : ts6.emptyArray; + if (methodSignatures.length === 0) { + if (errorNode) { + var diagnostic = methodName === "next" ? resolver.mustHaveANextMethodDiagnostic : resolver.mustBeAMethodDiagnostic; + if (errorOutputContainer) { + (_a = errorOutputContainer.errors) !== null && _a !== void 0 ? _a : errorOutputContainer.errors = []; + errorOutputContainer.errors.push(ts6.createDiagnosticForNode(errorNode, diagnostic, methodName)); + } else { + error(errorNode, diagnostic, methodName); + } + } + return methodName === "next" ? noIterationTypes : void 0; + } + if ((methodType === null || methodType === void 0 ? void 0 : methodType.symbol) && methodSignatures.length === 1) { + var globalGeneratorType = resolver.getGlobalGeneratorType( + /*reportErrors*/ + false + ); + var globalIteratorType = resolver.getGlobalIteratorType( + /*reportErrors*/ + false + ); + var isGeneratorMethod = ((_c = (_b = globalGeneratorType.symbol) === null || _b === void 0 ? void 0 : _b.members) === null || _c === void 0 ? void 0 : _c.get(methodName)) === methodType.symbol; + var isIteratorMethod = !isGeneratorMethod && ((_e = (_d = globalIteratorType.symbol) === null || _d === void 0 ? void 0 : _d.members) === null || _e === void 0 ? void 0 : _e.get(methodName)) === methodType.symbol; + if (isGeneratorMethod || isIteratorMethod) { + var globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType; + var mapper = methodType.mapper; + return createIterationTypes(getMappedType(globalType.typeParameters[0], mapper), getMappedType(globalType.typeParameters[1], mapper), methodName === "next" ? getMappedType(globalType.typeParameters[2], mapper) : void 0); + } + } + var methodParameterTypes; + var methodReturnTypes; + for (var _i = 0, methodSignatures_1 = methodSignatures; _i < methodSignatures_1.length; _i++) { + var signature = methodSignatures_1[_i]; + if (methodName !== "throw" && ts6.some(signature.parameters)) { + methodParameterTypes = ts6.append(methodParameterTypes, getTypeAtPosition(signature, 0)); + } + methodReturnTypes = ts6.append(methodReturnTypes, getReturnTypeOfSignature(signature)); + } + var returnTypes; + var nextType; + if (methodName !== "throw") { + var methodParameterType = methodParameterTypes ? getUnionType(methodParameterTypes) : unknownType; + if (methodName === "next") { + nextType = methodParameterType; + } else if (methodName === "return") { + var resolvedMethodParameterType = resolver.resolveIterationType(methodParameterType, errorNode) || anyType; + returnTypes = ts6.append(returnTypes, resolvedMethodParameterType); + } + } + var yieldType; + var methodReturnType = methodReturnTypes ? getIntersectionType(methodReturnTypes) : neverType; + var resolvedMethodReturnType = resolver.resolveIterationType(methodReturnType, errorNode) || anyType; + var iterationTypes = getIterationTypesOfIteratorResult(resolvedMethodReturnType); + if (iterationTypes === noIterationTypes) { + if (errorNode) { + if (errorOutputContainer) { + (_f = errorOutputContainer.errors) !== null && _f !== void 0 ? _f : errorOutputContainer.errors = []; + errorOutputContainer.errors.push(ts6.createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName)); + } else { + error(errorNode, resolver.mustHaveAValueDiagnostic, methodName); + } + } + yieldType = anyType; + returnTypes = ts6.append(returnTypes, anyType); + } else { + yieldType = iterationTypes.yieldType; + returnTypes = ts6.append(returnTypes, iterationTypes.returnType); + } + return createIterationTypes(yieldType, getUnionType(returnTypes), nextType); + } + function getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache) { + var iterationTypes = combineIterationTypes([ + getIterationTypesOfMethod(type, resolver, "next", errorNode, errorOutputContainer), + getIterationTypesOfMethod(type, resolver, "return", errorNode, errorOutputContainer), + getIterationTypesOfMethod(type, resolver, "throw", errorNode, errorOutputContainer) + ]); + return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes); + } + function getIterationTypeOfGeneratorFunctionReturnType(kind, returnType, isAsyncGenerator) { + if (isTypeAny(returnType)) { + return void 0; + } + var iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsyncGenerator); + return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(kind)]; + } + function getIterationTypesOfGeneratorFunctionReturnType(type, isAsyncGenerator) { + if (isTypeAny(type)) { + return anyIterationTypes; + } + var use = isAsyncGenerator ? 2 : 1; + var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver; + return getIterationTypesOfIterable( + type, + use, + /*errorNode*/ + void 0 + ) || getIterationTypesOfIterator( + type, + resolver, + /*errorNode*/ + void 0, + /*errorOutputContainer*/ + void 0 + ); + } + function checkBreakOrContinueStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) + checkGrammarBreakOrContinueStatement(node); + } + function unwrapReturnType(returnType, functionFlags) { + var isGenerator = !!(functionFlags & 1); + var isAsync = !!(functionFlags & 2); + if (isGenerator) { + var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync); + if (!returnIterationType) { + return errorType; + } + return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType; + } + return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType; + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = unwrapReturnType(returnType, ts6.getFunctionFlags(func)); + return !!unwrappedReturnType && maybeTypeOfKind( + unwrappedReturnType, + 16384 | 3 + /* TypeFlags.AnyOrUnknown */ + ); + } + function checkReturnStatement(node) { + var _a; + if (checkGrammarStatementInAmbientContext(node)) { + return; + } + var container = ts6.getContainingFunctionOrClassStaticBlock(node); + if (container && ts6.isClassStaticBlockDeclaration(container)) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block); + return; + } + if (!container) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + return; + } + var signature = getSignatureFromDeclaration(container); + var returnType = getReturnTypeOfSignature(signature); + var functionFlags = ts6.getFunctionFlags(container); + if (strictNullChecks || node.expression || returnType.flags & 131072) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; + if (container.kind === 175) { + if (node.expression) { + error(node, ts6.Diagnostics.Setters_cannot_return_a_value); + } + } else if (container.kind === 173) { + if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { + error(node, ts6.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + } + } else if (getReturnTypeFromAnnotation(container)) { + var unwrappedReturnType = (_a = unwrapReturnType(returnType, functionFlags)) !== null && _a !== void 0 ? _a : returnType; + var unwrappedExprType = functionFlags & 2 ? checkAwaitedType( + exprType, + /*withAlias*/ + false, + node, + ts6.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + ) : exprType; + if (unwrappedReturnType) { + checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression); + } + } + } else if (container.kind !== 173 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + error(node, ts6.Diagnostics.Not_all_code_paths_return_a_value); + } + } + function checkWithStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.flags & 32768) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); + } + } + checkExpression(node.expression); + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var start = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos).start; + var end = node.statement.pos; + grammarErrorAtPos(sourceFile, start, end - start, ts6.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any); + } + } + function checkSwitchStatement(node) { + checkGrammarStatementInAmbientContext(node); + var firstDefaultClause; + var hasDuplicateDefaultClause = false; + var expressionType = checkExpression(node.expression); + var expressionIsLiteral = isLiteralType(expressionType); + ts6.forEach(node.caseBlock.clauses, function(clause) { + if (clause.kind === 293 && !hasDuplicateDefaultClause) { + if (firstDefaultClause === void 0) { + firstDefaultClause = clause; + } else { + grammarErrorOnNode(clause, ts6.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + hasDuplicateDefaultClause = true; + } + } + if (clause.kind === 292) { + addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); + } + ts6.forEach(clause.statements, checkSourceElement); + if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) { + error(clause, ts6.Diagnostics.Fallthrough_case_in_switch); + } + function createLazyCaseClauseDiagnostics(clause2) { + return function() { + var caseType = checkExpression(clause2.expression); + var caseIsLiteral = isLiteralType(caseType); + var comparedExpressionType = expressionType; + if (!caseIsLiteral || !expressionIsLiteral) { + caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType; + comparedExpressionType = getBaseTypeOfLiteralType(expressionType); + } + if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) { + checkTypeComparableTo( + caseType, + comparedExpressionType, + clause2.expression, + /*headMessage*/ + void 0 + ); + } + }; + } + }); + if (node.caseBlock.locals) { + registerForUnusedIdentifiersCheck(node.caseBlock); + } + } + function checkLabeledStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + ts6.findAncestor(node.parent, function(current) { + if (ts6.isFunctionLike(current)) { + return "quit"; + } + if (current.kind === 253 && current.label.escapedText === node.label.escapedText) { + grammarErrorOnNode(node.label, ts6.Diagnostics.Duplicate_label_0, ts6.getTextOfNode(node.label)); + return true; + } + return false; + }); + } + checkSourceElement(node.statement); + } + function checkThrowStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (ts6.isIdentifier(node.expression) && !node.expression.escapedText) { + grammarErrorAfterFirstToken(node, ts6.Diagnostics.Line_break_not_permitted_here); + } + } + if (node.expression) { + checkExpression(node.expression); + } + } + function checkTryStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkBlock(node.tryBlock); + var catchClause = node.catchClause; + if (catchClause) { + if (catchClause.variableDeclaration) { + var declaration = catchClause.variableDeclaration; + var typeNode = ts6.getEffectiveTypeAnnotationNode(ts6.getRootDeclaration(declaration)); + if (typeNode) { + var type = getTypeForVariableLikeDeclaration( + declaration, + /*includeOptionality*/ + false, + 0 + /* CheckMode.Normal */ + ); + if (type && !(type.flags & 3)) { + grammarErrorOnFirstToken(typeNode, ts6.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified); + } + } else if (declaration.initializer) { + grammarErrorOnFirstToken(declaration.initializer, ts6.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); + } else { + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts6.forEachKey(catchClause.locals, function(caughtName) { + var blockLocal = blockLocals_1.get(caughtName); + if ((blockLocal === null || blockLocal === void 0 ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2) !== 0) { + grammarErrorOnNode(blockLocal.valueDeclaration, ts6.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); + } + }); + } + } + } + checkBlock(catchClause.block); + } + if (node.finallyBlock) { + checkBlock(node.finallyBlock); + } + } + function checkIndexConstraints(type, symbol, isStaticIndex) { + var indexInfos = getIndexInfosOfType(type); + if (indexInfos.length === 0) { + return; + } + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + if (!(isStaticIndex && prop.flags & 4194304)) { + checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty( + prop, + 8576, + /*includeNonPublic*/ + true + ), getNonMissingTypeOfSymbol(prop)); + } + } + var typeDeclaration = symbol.valueDeclaration; + if (typeDeclaration && ts6.isClassLike(typeDeclaration)) { + for (var _b = 0, _c = typeDeclaration.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (!ts6.isStatic(member) && !hasBindableName(member)) { + var symbol_3 = getSymbolOfNode(member); + checkIndexConstraintForProperty(type, symbol_3, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol_3)); + } + } + } + if (indexInfos.length > 1) { + for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) { + var info = indexInfos_8[_d]; + checkIndexConstraintForIndexSignature(type, info); + } + } + } + function checkIndexConstraintForProperty(type, prop, propNameType, propType) { + var declaration = prop.valueDeclaration; + var name = ts6.getNameOfDeclaration(declaration); + if (name && ts6.isPrivateIdentifier(name)) { + return; + } + var indexInfos = getApplicableIndexInfos(type, propNameType); + var interfaceDeclaration = ts6.getObjectFlags(type) & 2 ? ts6.getDeclarationOfKind( + type.symbol, + 261 + /* SyntaxKind.InterfaceDeclaration */ + ) : void 0; + var propDeclaration = declaration && declaration.kind === 223 || name && name.kind === 164 ? declaration : void 0; + var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : void 0; + var _loop_30 = function(info2) { + var localIndexDeclaration = info2.declaration && getParentOfSymbol(getSymbolOfNode(info2.declaration)) === type.symbol ? info2.declaration : void 0; + var errorNode = localPropDeclaration || localIndexDeclaration || (interfaceDeclaration && !ts6.some(getBaseTypes(type), function(base) { + return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info2.keyType); + }) ? interfaceDeclaration : void 0); + if (errorNode && !isTypeAssignableTo(propType, info2.type)) { + var diagnostic = createError(errorNode, ts6.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info2.keyType), typeToString(info2.type)); + if (propDeclaration && errorNode !== propDeclaration) { + ts6.addRelatedInfo(diagnostic, ts6.createDiagnosticForNode(propDeclaration, ts6.Diagnostics._0_is_declared_here, symbolToString(prop))); + } + diagnostics.add(diagnostic); + } + }; + for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { + var info = indexInfos_9[_i]; + _loop_30(info); + } + } + function checkIndexConstraintForIndexSignature(type, checkInfo) { + var declaration = checkInfo.declaration; + var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); + var interfaceDeclaration = ts6.getObjectFlags(type) & 2 ? ts6.getDeclarationOfKind( + type.symbol, + 261 + /* SyntaxKind.InterfaceDeclaration */ + ) : void 0; + var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : void 0; + var _loop_31 = function(info2) { + if (info2 === checkInfo) + return "continue"; + var localIndexDeclaration = info2.declaration && getParentOfSymbol(getSymbolOfNode(info2.declaration)) === type.symbol ? info2.declaration : void 0; + var errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !ts6.some(getBaseTypes(type), function(base) { + return !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info2.keyType); + }) ? interfaceDeclaration : void 0); + if (errorNode && !isTypeAssignableTo(checkInfo.type, info2.type)) { + error(errorNode, ts6.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info2.keyType), typeToString(info2.type)); + } + }; + for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { + var info = indexInfos_10[_i]; + _loop_31(info); + } + } + function checkTypeNameIsReserved(name, message) { + switch (name.escapedText) { + case "any": + case "unknown": + case "never": + case "number": + case "bigint": + case "boolean": + case "string": + case "symbol": + case "void": + case "object": + error(name, message, name.escapedText); + } + } + function checkClassNameCollisionWithObject(name) { + if (languageVersion >= 1 && name.escapedText === "Object" && (moduleKind < ts6.ModuleKind.ES2015 || ts6.getSourceFileOfNode(name).impliedNodeFormat === ts6.ModuleKind.CommonJS)) { + error(name, ts6.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts6.ModuleKind[moduleKind]); + } + } + function checkUnmatchedJSDocParameters(node) { + var jsdocParameters = ts6.filter(ts6.getJSDocTags(node), ts6.isJSDocParameterTag); + if (!ts6.length(jsdocParameters)) + return; + var isJs = ts6.isInJSFile(node); + var parameters = new ts6.Set(); + var excludedParameters = new ts6.Set(); + ts6.forEach(node.parameters, function(_a, index) { + var name = _a.name; + if (ts6.isIdentifier(name)) { + parameters.add(name.escapedText); + } + if (ts6.isBindingPattern(name)) { + excludedParameters.add(index); + } + }); + var containsArguments = containsArgumentsReference(node); + if (containsArguments) { + var lastJSDocParam = ts6.lastOrUndefined(jsdocParameters); + if (isJs && lastJSDocParam && ts6.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) { + error(lastJSDocParam.name, ts6.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts6.idText(lastJSDocParam.name)); + } + } else { + ts6.forEach(jsdocParameters, function(_a, index) { + var name = _a.name, isNameFirst = _a.isNameFirst; + if (excludedParameters.has(index) || ts6.isIdentifier(name) && parameters.has(name.escapedText)) { + return; + } + if (ts6.isQualifiedName(name)) { + if (isJs) { + error(name, ts6.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts6.entityNameToString(name), ts6.entityNameToString(name.left)); + } + } else { + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts6.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts6.idText(name)); + } + } + }); + } + } + function checkTypeParameters(typeParameterDeclarations) { + var seenDefault = false; + if (typeParameterDeclarations) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { + var node = typeParameterDeclarations[i]; + checkTypeParameter(node); + addLazyDiagnostic(createCheckTypeParameterDiagnostic(node, i)); + } + } + function createCheckTypeParameterDiagnostic(node2, i2) { + return function() { + if (node2.default) { + seenDefault = true; + checkTypeParametersNotReferenced(node2.default, typeParameterDeclarations, i2); + } else if (seenDefault) { + error(node2, ts6.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } + for (var j = 0; j < i2; j++) { + if (typeParameterDeclarations[j].symbol === node2.symbol) { + error(node2.name, ts6.Diagnostics.Duplicate_identifier_0, ts6.declarationNameToString(node2.name)); + } + } + }; + } + } + function checkTypeParametersNotReferenced(root, typeParameters, index) { + visit(root); + function visit(node) { + if (node.kind === 180) { + var type = getTypeFromTypeReference(node); + if (type.flags & 262144) { + for (var i = index; i < typeParameters.length; i++) { + if (type.symbol === getSymbolOfNode(typeParameters[i])) { + error(node, ts6.Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters); + } + } + } + } + ts6.forEachChild(node, visit); + } + } + function checkTypeParameterListsIdentical(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + return; + } + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (!declarations || declarations.length <= 1) { + return; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters, ts6.getEffectiveTypeParameterDeclarations)) { + var name = symbolToString(symbol); + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + error(declaration.name, ts6.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); + } + } + } + } + function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) { + var maxTypeArgumentCount = ts6.length(targetParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters); + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + var sourceParameters = getTypeParameterDeclarations(declaration); + var numTypeParameters = sourceParameters.length; + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; + } + for (var i = 0; i < numTypeParameters; i++) { + var source = sourceParameters[i]; + var target = targetParameters[i]; + if (source.name.escapedText !== target.symbol.escapedName) { + return false; + } + var constraint = ts6.getEffectiveConstraintOfTypeParameter(source); + var sourceConstraint = constraint && getTypeFromTypeNode(constraint); + var targetConstraint = getConstraintOfTypeParameter(target); + if (sourceConstraint && targetConstraint && !isTypeIdenticalTo(sourceConstraint, targetConstraint)) { + return false; + } + var sourceDefault = source.default && getTypeFromTypeNode(source.default); + var targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; + } + } + } + return true; + } + function checkClassExpression(node) { + checkClassLikeDeclaration(node); + checkNodeDeferred(node); + return getTypeOfSymbol(getSymbolOfNode(node)); + } + function checkClassExpressionDeferred(node) { + ts6.forEach(node.members, checkSourceElement); + registerForUnusedIdentifiersCheck(node); + } + function checkClassDeclaration(node) { + var firstDecorator = ts6.find(node.modifiers, ts6.isDecorator); + if (firstDecorator && ts6.some(node.members, function(p) { + return ts6.hasStaticModifier(p) && ts6.isPrivateIdentifierClassElementDeclaration(p); + })) { + grammarErrorOnNode(firstDecorator, ts6.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); + } + if (!node.name && !ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + )) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); + } + checkClassLikeDeclaration(node); + ts6.forEach(node.members, checkSourceElement); + registerForUnusedIdentifiersCheck(node); + } + function checkClassLikeDeclaration(node) { + checkGrammarClassLikeDeclaration(node); + checkDecorators(node); + checkCollisionsForDeclarationName(node, node.name); + checkTypeParameters(ts6.getEffectiveTypeParameterDeclarations(node)); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); + var staticType = getTypeOfSymbol(symbol); + checkTypeParameterListsIdentical(symbol); + checkFunctionOrConstructorSymbol(symbol); + checkClassForDuplicateDeclarations(node); + var nodeInAmbientContext = !!(node.flags & 16777216); + if (!nodeInAmbientContext) { + checkClassForStaticPropertyNameConflicts(node); + } + var baseTypeNode = ts6.getEffectiveBaseTypeNode(node); + if (baseTypeNode) { + ts6.forEach(baseTypeNode.typeArguments, checkSourceElement); + if (languageVersion < 2) { + checkExternalEmitHelpers( + baseTypeNode.parent, + 1 + /* ExternalEmitHelpers.Extends */ + ); + } + var extendsNode = ts6.getClassExtendsHeritageElement(node); + if (extendsNode && extendsNode !== baseTypeNode) { + checkExpression(extendsNode.expression); + } + var baseTypes_2 = getBaseTypes(type); + if (baseTypes_2.length) { + addLazyDiagnostic(function() { + var baseType = baseTypes_2[0]; + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); + checkBaseTypeAccessibility(staticBaseType, baseTypeNode); + checkSourceElement(baseTypeNode.expression); + if (ts6.some(baseTypeNode.typeArguments)) { + ts6.forEach(baseTypeNode.typeArguments, checkSourceElement); + for (var _i2 = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i2 < _a.length; _i2++) { + var constructor = _a[_i2]; + if (!checkTypeArgumentConstraints(baseTypeNode, constructor.typeParameters)) { + break; + } + } + } + var baseWithThis = getTypeWithThisArgument(baseType, type.thisType); + if (!checkTypeAssignableTo( + typeWithThis, + baseWithThis, + /*errorNode*/ + void 0 + )) { + issueMemberSpecificError(node, typeWithThis, baseWithThis, ts6.Diagnostics.Class_0_incorrectly_extends_base_class_1); + } else { + checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts6.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); + } + if (baseConstructorType.flags & 8650752) { + if (!isMixinConstructorType(staticType)) { + error(node.name || node, ts6.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + } else { + var constructSignatures = getSignaturesOfType( + baseConstructorType, + 1 + /* SignatureKind.Construct */ + ); + if (constructSignatures.some(function(signature) { + return signature.flags & 4; + }) && !ts6.hasSyntacticModifier( + node, + 256 + /* ModifierFlags.Abstract */ + )) { + error(node.name || node, ts6.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); + } + } + } + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 8650752)) { + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); + if (ts6.forEach(constructors, function(sig) { + return !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType); + })) { + error(baseTypeNode.expression, ts6.Diagnostics.Base_constructors_must_all_have_the_same_return_type); + } + } + checkKindsOfPropertyMemberOverrides(type, baseType); + }); + } + } + checkMembersForOverrideModifier(node, type, typeWithThis, staticType); + var implementedTypeNodes = ts6.getEffectiveImplementsTypeNodes(node); + if (implementedTypeNodes) { + for (var _i = 0, implementedTypeNodes_1 = implementedTypeNodes; _i < implementedTypeNodes_1.length; _i++) { + var typeRefNode = implementedTypeNodes_1[_i]; + if (!ts6.isEntityNameExpression(typeRefNode.expression) || ts6.isOptionalChain(typeRefNode.expression)) { + error(typeRefNode.expression, ts6.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkTypeReferenceNode(typeRefNode); + addLazyDiagnostic(createImplementsDiagnostics(typeRefNode)); + } + } + addLazyDiagnostic(function() { + checkIndexConstraints(type, symbol); + checkIndexConstraints( + staticType, + symbol, + /*isStaticIndex*/ + true + ); + checkTypeForDuplicateIndexSignatures(node); + checkPropertyInitialization(node); + }); + function createImplementsDiagnostics(typeRefNode2) { + return function() { + var t = getReducedType(getTypeFromTypeNode(typeRefNode2)); + if (!isErrorType(t)) { + if (isValidBaseType(t)) { + var genericDiag = t.symbol && t.symbol.flags & 32 ? ts6.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass : ts6.Diagnostics.Class_0_incorrectly_implements_interface_1; + var baseWithThis = getTypeWithThisArgument(t, type.thisType); + if (!checkTypeAssignableTo( + typeWithThis, + baseWithThis, + /*errorNode*/ + void 0 + )) { + issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag); + } + } else { + error(typeRefNode2, ts6.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members); + } + } + }; + } + } + function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) { + var baseTypeNode = ts6.getEffectiveBaseTypeNode(node); + var baseTypes = baseTypeNode && getBaseTypes(type); + var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts6.first(baseTypes), type.thisType) : void 0; + var baseStaticType = getBaseConstructorTypeOfClass(type); + var _loop_32 = function(member2) { + if (ts6.hasAmbientModifier(member2)) { + return "continue"; + } + if (ts6.isConstructorDeclaration(member2)) { + ts6.forEach(member2.parameters, function(param) { + if (ts6.isParameterPropertyDeclaration(param, member2)) { + checkExistingMemberForOverrideModifier( + node, + staticType, + baseStaticType, + baseWithThis, + type, + typeWithThis, + param, + /* memberIsParameterProperty */ + true + ); + } + }); + } + checkExistingMemberForOverrideModifier( + node, + staticType, + baseStaticType, + baseWithThis, + type, + typeWithThis, + member2, + /* memberIsParameterProperty */ + false + ); + }; + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + _loop_32(member); + } + } + function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) { + if (reportErrors === void 0) { + reportErrors = true; + } + var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); + if (!declaredProp) { + return 0; + } + return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts6.hasOverrideModifier(member), ts6.hasAbstractModifier(member), ts6.isStatic(member), memberIsParameterProperty, ts6.symbolName(declaredProp), reportErrors ? member : void 0); + } + function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) { + var isJs = ts6.isInJSFile(node); + var nodeInAmbientContext = !!(node.flags & 16777216); + if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) { + var memberEscapedName = ts6.escapeLeadingUnderscores(memberName); + var thisType = memberIsStatic ? staticType : typeWithThis; + var baseType = memberIsStatic ? baseStaticType : baseWithThis; + var prop = getPropertyOfType(thisType, memberEscapedName); + var baseProp = getPropertyOfType(baseType, memberEscapedName); + var baseClassName = typeToString(baseWithThis); + if (prop && !baseProp && memberHasOverrideModifier) { + if (errorNode) { + var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); + suggestion ? error(errorNode, isJs ? ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 : ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) : error(errorNode, isJs ? ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 : ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); + } + return 2; + } else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { + var baseHasAbstract = ts6.some(baseProp.declarations, ts6.hasAbstractModifier); + if (memberHasOverrideModifier) { + return 0; + } + if (!baseHasAbstract) { + if (errorNode) { + var diag = memberIsParameterProperty ? isJs ? ts6.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : ts6.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : isJs ? ts6.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; + error(errorNode, diag, baseClassName); + } + return 1; + } else if (memberHasAbstractModifier && baseHasAbstract) { + if (errorNode) { + error(errorNode, ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); + } + return 1; + } + } + } else if (memberHasOverrideModifier) { + if (errorNode) { + var className = typeToString(type); + error(errorNode, isJs ? ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class : ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className); + } + return 2; + } + return 0; + } + function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { + var issuedMemberError = false; + var _loop_33 = function(member2) { + if (ts6.isStatic(member2)) { + return "continue"; + } + var declaredProp = member2.name && getSymbolAtLocation(member2.name) || getSymbolAtLocation(member2); + if (declaredProp) { + var prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); + var baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); + if (prop && baseProp) { + var rootChain = function() { + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, + symbolToString(declaredProp), + typeToString(typeWithThis), + typeToString(baseWithThis) + ); + }; + if (!checkTypeAssignableTo( + getTypeOfSymbol(prop), + getTypeOfSymbol(baseProp), + member2.name || member2, + /*message*/ + void 0, + rootChain + )) { + issuedMemberError = true; + } + } + } + }; + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + _loop_33(member); + } + if (!issuedMemberError) { + checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag); + } + } + function checkBaseTypeAccessibility(type, node) { + var signatures = getSignaturesOfType( + type, + 1 + /* SignatureKind.Construct */ + ); + if (signatures.length) { + var declaration = signatures[0].declaration; + if (declaration && ts6.hasEffectiveModifier( + declaration, + 8 + /* ModifierFlags.Private */ + )) { + var typeClassDeclaration = ts6.getClassLikeDeclarationOfSymbol(type.symbol); + if (!isNodeWithinClass(node, typeClassDeclaration)) { + error(node, ts6.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); + } + } + } + } + function getMemberOverrideModifierStatus(node, member) { + if (!member.name) { + return 0; + } + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); + var staticType = getTypeOfSymbol(symbol); + var baseTypeNode = ts6.getEffectiveBaseTypeNode(node); + var baseTypes = baseTypeNode && getBaseTypes(type); + var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts6.first(baseTypes), type.thisType) : void 0; + var baseStaticType = getBaseConstructorTypeOfClass(type); + var memberHasOverrideModifier = member.parent ? ts6.hasOverrideModifier(member) : ts6.hasSyntacticModifier( + member, + 16384 + /* ModifierFlags.Override */ + ); + var memberName = ts6.unescapeLeadingUnderscores(ts6.getTextOfPropertyName(member.name)); + return checkMemberForOverrideModifier( + node, + staticType, + baseStaticType, + baseWithThis, + type, + typeWithThis, + memberHasOverrideModifier, + ts6.hasAbstractModifier(member), + ts6.isStatic(member), + /* memberIsParameterProperty */ + false, + memberName + ); + } + function getTargetSymbol(s) { + return ts6.getCheckFlags(s) & 1 ? s.target : s; + } + function getClassOrInterfaceDeclarationsOfSymbol(symbol) { + return ts6.filter(symbol.declarations, function(d) { + return d.kind === 260 || d.kind === 261; + }); + } + function checkKindsOfPropertyMemberOverrides(type, baseType) { + var _a, _b, _c, _d; + var baseProperties = getPropertiesOfType(baseType); + var _loop_34 = function(baseProperty2) { + var base = getTargetSymbol(baseProperty2); + if (base.flags & 4194304) { + return "continue"; + } + var baseSymbol = getPropertyOfObjectType(type, base.escapedName); + if (!baseSymbol) { + return "continue"; + } + var derived = getTargetSymbol(baseSymbol); + var baseDeclarationFlags = ts6.getDeclarationModifierFlagsFromSymbol(base); + ts6.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); + if (derived === base) { + var derivedClassDecl = ts6.getClassLikeDeclarationOfSymbol(type.symbol); + if (baseDeclarationFlags & 256 && (!derivedClassDecl || !ts6.hasSyntacticModifier( + derivedClassDecl, + 256 + /* ModifierFlags.Abstract */ + ))) { + for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) { + var otherBaseType = _f[_e]; + if (otherBaseType === baseType) + continue; + var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName); + var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1); + if (derivedElsewhere && derivedElsewhere !== base) { + return "continue-basePropertyCheck"; + } + } + if (derivedClassDecl.kind === 228) { + error(derivedClassDecl, ts6.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty2), typeToString(baseType)); + } else { + error(derivedClassDecl, ts6.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty2), typeToString(baseType)); + } + } + } else { + var derivedDeclarationFlags = ts6.getDeclarationModifierFlagsFromSymbol(derived); + if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) { + return "continue"; + } + var errorMessage = void 0; + var basePropertyFlags = base.flags & 98308; + var derivedPropertyFlags = derived.flags & 98308; + if (basePropertyFlags && derivedPropertyFlags) { + if ((ts6.getCheckFlags(base) & 6 ? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function(d) { + return isPropertyAbstractOrInterface(d, baseDeclarationFlags); + }) : (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function(d) { + return isPropertyAbstractOrInterface(d, baseDeclarationFlags); + })) || ts6.getCheckFlags(base) & 262144 || derived.valueDeclaration && ts6.isBinaryExpression(derived.valueDeclaration)) { + return "continue"; + } + var overriddenInstanceProperty = basePropertyFlags !== 4 && derivedPropertyFlags === 4; + var overriddenInstanceAccessor = basePropertyFlags === 4 && derivedPropertyFlags !== 4; + if (overriddenInstanceProperty || overriddenInstanceAccessor) { + var errorMessage_1 = overriddenInstanceProperty ? ts6.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : ts6.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor; + error(ts6.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); + } else if (useDefineForClassFields) { + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function(d) { + return d.kind === 169 && !d.initializer; + }); + if (uninitialized && !(derived.flags & 33554432) && !(baseDeclarationFlags & 256) && !(derivedDeclarationFlags & 256) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function(d) { + return !!(d.flags & 16777216); + }))) { + var constructor = findConstructorDeclaration(ts6.getClassLikeDeclarationOfSymbol(type.symbol)); + var propName = uninitialized.name; + if (uninitialized.exclamationToken || !constructor || !ts6.isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) { + var errorMessage_2 = ts6.Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration; + error(ts6.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_2, symbolToString(base), typeToString(baseType)); + } + } + } + return "continue"; + } else if (isPrototypeProperty(base)) { + if (isPrototypeProperty(derived) || derived.flags & 4) { + return "continue"; + } else { + ts6.Debug.assert(!!(derived.flags & 98304)); + errorMessage = ts6.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; + } + } else if (base.flags & 98304) { + errorMessage = ts6.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + } else { + errorMessage = ts6.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + } + error(ts6.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + } + }; + basePropertyCheck: + for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { + var baseProperty = baseProperties_1[_i]; + var state_10 = _loop_34(baseProperty); + switch (state_10) { + case "continue-basePropertyCheck": + continue basePropertyCheck; + } + } + } + function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { + return baseDeclarationFlags & 256 && (!ts6.isPropertyDeclaration(declaration) || !declaration.initializer) || ts6.isInterfaceDeclaration(declaration.parent); + } + function getNonInheritedProperties(type, baseTypes, properties) { + if (!ts6.length(baseTypes)) { + return properties; + } + var seen = new ts6.Map(); + ts6.forEach(properties, function(p) { + seen.set(p.escapedName, p); + }); + for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) { + var base = baseTypes_3[_i]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; + var existing = seen.get(prop.escapedName); + if (existing && prop.parent === existing.parent) { + seen.delete(prop.escapedName); + } + } + } + return ts6.arrayFrom(seen.values()); + } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + var baseTypes = getBaseTypes(type); + if (baseTypes.length < 2) { + return true; + } + var seen = new ts6.Map(); + ts6.forEach(resolveDeclaredMembers(type).declaredProperties, function(p) { + seen.set(p.escapedName, { prop: p, containingType: type }); + }); + var ok = true; + for (var _i = 0, baseTypes_4 = baseTypes; _i < baseTypes_4.length; _i++) { + var base = baseTypes_4[_i]; + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { + var prop = properties_6[_a]; + var existing = seen.get(prop.escapedName); + if (!existing) { + seen.set(prop.escapedName, { prop, containingType: base }); + } else { + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, + symbolToString(prop), + typeName1, + typeName2 + ); + errorInfo = ts6.chainDiagnosticMessages(errorInfo, ts6.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + diagnostics.add(ts6.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); + } + } + } + } + return ok; + } + function checkPropertyInitialization(node) { + if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216) { + return; + } + var constructor = findConstructorDeclaration(node); + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (ts6.getEffectiveModifierFlags(member) & 2) { + continue; + } + if (!ts6.isStatic(member) && isPropertyWithoutInitializer(member)) { + var propName = member.name; + if (ts6.isIdentifier(propName) || ts6.isPrivateIdentifier(propName) || ts6.isComputedPropertyName(propName)) { + var type = getTypeOfSymbol(getSymbolOfNode(member)); + if (!(type.flags & 3 || containsUndefinedType(type))) { + if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) { + error(member.name, ts6.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts6.declarationNameToString(propName)); + } + } + } + } + } + } + function isPropertyWithoutInitializer(node) { + return node.kind === 169 && !ts6.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; + } + function isPropertyInitializedInStaticBlocks(propName, propType, staticBlocks, startPos, endPos) { + for (var _i = 0, staticBlocks_2 = staticBlocks; _i < staticBlocks_2.length; _i++) { + var staticBlock = staticBlocks_2[_i]; + if (staticBlock.pos >= startPos && staticBlock.pos <= endPos) { + var reference = ts6.factory.createPropertyAccessExpression(ts6.factory.createThis(), propName); + ts6.setParent(reference.expression, reference); + ts6.setParent(reference, staticBlock); + reference.flowNode = staticBlock.returnFlowNode; + var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType)); + if (!containsUndefinedType(flowType)) { + return true; + } + } + } + return false; + } + function isPropertyInitializedInConstructor(propName, propType, constructor) { + var reference = ts6.isComputedPropertyName(propName) ? ts6.factory.createElementAccessExpression(ts6.factory.createThis(), propName.expression) : ts6.factory.createPropertyAccessExpression(ts6.factory.createThis(), propName); + ts6.setParent(reference.expression, reference); + ts6.setParent(reference, constructor); + reference.flowNode = constructor.returnFlowNode; + var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType)); + return !containsUndefinedType(flowType); + } + function checkInterfaceDeclaration(node) { + if (!checkGrammarDecoratorsAndModifiers(node)) + checkGrammarInterfaceDeclaration(node); + checkTypeParameters(node.typeParameters); + addLazyDiagnostic(function() { + checkTypeNameIsReserved(node.name, ts6.Diagnostics.Interface_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + checkTypeParameterListsIdentical(symbol); + var firstInterfaceDecl = ts6.getDeclarationOfKind( + symbol, + 261 + /* SyntaxKind.InterfaceDeclaration */ + ); + if (node === firstInterfaceDecl) { + var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); + if (checkInheritedPropertiesAreIdentical(type, node.name)) { + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts6.Diagnostics.Interface_0_incorrectly_extends_interface_1); + } + checkIndexConstraints(type, symbol); + } + } + checkObjectTypeForDuplicateDeclarations(node); + }); + ts6.forEach(ts6.getInterfaceBaseTypeNodes(node), function(heritageElement) { + if (!ts6.isEntityNameExpression(heritageElement.expression) || ts6.isOptionalChain(heritageElement.expression)) { + error(heritageElement.expression, ts6.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + } + checkTypeReferenceNode(heritageElement); + }); + ts6.forEach(node.members, checkSourceElement); + addLazyDiagnostic(function() { + checkTypeForDuplicateIndexSignatures(node); + registerForUnusedIdentifiersCheck(node); + }); + } + function checkTypeAliasDeclaration(node) { + checkGrammarDecoratorsAndModifiers(node); + checkTypeNameIsReserved(node.name, ts6.Diagnostics.Type_alias_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + checkTypeParameters(node.typeParameters); + if (node.type.kind === 139) { + if (!intrinsicTypeKinds.has(node.name.escapedText) || ts6.length(node.typeParameters) !== 1) { + error(node.type, ts6.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); + } + } else { + checkSourceElement(node.type); + registerForUnusedIdentifiersCheck(node); + } + } + function computeEnumMemberValues(node) { + var nodeLinks2 = getNodeLinks(node); + if (!(nodeLinks2.flags & 16384)) { + nodeLinks2.flags |= 16384; + var autoValue = 0; + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var value = computeMemberValue(member, autoValue); + getNodeLinks(member).enumMemberValue = value; + autoValue = typeof value === "number" ? value + 1 : void 0; + } + } + } + function computeMemberValue(member, autoValue) { + if (ts6.isComputedNonLiteralName(member.name)) { + error(member.name, ts6.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } else { + var text = ts6.getTextOfPropertyName(member.name); + if (ts6.isNumericLiteralName(text) && !ts6.isInfinityOrNaNString(text)) { + error(member.name, ts6.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + } + if (member.initializer) { + return computeConstantValue(member); + } + if (member.parent.flags & 16777216 && !ts6.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) { + return void 0; + } + if (autoValue !== void 0) { + return autoValue; + } + error(member.name, ts6.Diagnostics.Enum_member_must_have_initializer); + return void 0; + } + function computeConstantValue(member) { + var enumKind = getEnumKind(getSymbolOfNode(member.parent)); + var isConstEnum = ts6.isEnumConst(member.parent); + var initializer = member.initializer; + var value = enumKind === 1 && !isLiteralEnumMember(member) ? void 0 : evaluate(initializer); + if (value !== void 0) { + if (isConstEnum && typeof value === "number" && !isFinite(value)) { + error(initializer, isNaN(value) ? ts6.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : ts6.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } else if (enumKind === 1) { + error(initializer, ts6.Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members); + return 0; + } else if (isConstEnum) { + error(initializer, ts6.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values); + } else if (member.parent.flags & 16777216) { + error(initializer, ts6.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } else { + var source = checkExpression(initializer); + if (!isTypeAssignableToKind( + source, + 296 + /* TypeFlags.NumberLike */ + )) { + error(initializer, ts6.Diagnostics.Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead, typeToString(source)); + } else { + checkTypeAssignableTo( + source, + getDeclaredTypeOfSymbol(getSymbolOfNode(member.parent)), + initializer, + /*headMessage*/ + void 0 + ); + } + } + return value; + function evaluate(expr) { + switch (expr.kind) { + case 221: + var value_2 = evaluate(expr.operand); + if (typeof value_2 === "number") { + switch (expr.operator) { + case 39: + return value_2; + case 40: + return -value_2; + case 54: + return ~value_2; + } + } + break; + case 223: + var left = evaluate(expr.left); + var right = evaluate(expr.right); + if (typeof left === "number" && typeof right === "number") { + switch (expr.operatorToken.kind) { + case 51: + return left | right; + case 50: + return left & right; + case 48: + return left >> right; + case 49: + return left >>> right; + case 47: + return left << right; + case 52: + return left ^ right; + case 41: + return left * right; + case 43: + return left / right; + case 39: + return left + right; + case 40: + return left - right; + case 44: + return left % right; + case 42: + return Math.pow(left, right); + } + } else if (typeof left === "string" && typeof right === "string" && expr.operatorToken.kind === 39) { + return left + right; + } + break; + case 10: + case 14: + return expr.text; + case 8: + checkGrammarNumericLiteral(expr); + return +expr.text; + case 214: + return evaluate(expr.expression); + case 79: + var identifier = expr; + if (ts6.isInfinityOrNaNString(identifier.escapedText)) { + return +identifier.escapedText; + } + return ts6.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); + case 209: + case 208: + if (isConstantMemberAccess(expr)) { + var type = getTypeOfExpression(expr.expression); + if (type.symbol && type.symbol.flags & 384) { + var name = void 0; + if (expr.kind === 208) { + name = expr.name.escapedText; + } else { + name = ts6.escapeLeadingUnderscores(ts6.cast(expr.argumentExpression, ts6.isLiteralExpression).text); + } + return evaluateEnumMember(expr, type.symbol, name); + } + } + break; + } + return void 0; + } + function evaluateEnumMember(expr, enumSymbol, name) { + var memberSymbol = enumSymbol.exports.get(name); + if (memberSymbol) { + var declaration = memberSymbol.valueDeclaration; + if (declaration !== member) { + if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member) && ts6.isEnumDeclaration(declaration.parent)) { + return getEnumMemberValue(declaration); + } + error(expr, ts6.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); + return 0; + } else { + error(expr, ts6.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(memberSymbol)); + } + } + return void 0; + } + } + function isConstantMemberAccess(node) { + var type = getTypeOfExpression(node); + if (type === errorType) { + return false; + } + return node.kind === 79 || node.kind === 208 && isConstantMemberAccess(node.expression) || node.kind === 209 && isConstantMemberAccess(node.expression) && ts6.isStringLiteralLike(node.argumentExpression); + } + function checkEnumDeclaration(node) { + addLazyDiagnostic(function() { + return checkEnumDeclarationWorker(node); + }); + } + function checkEnumDeclarationWorker(node) { + checkGrammarDecoratorsAndModifiers(node); + checkCollisionsForDeclarationName(node, node.name); + checkExportsOnMergedDeclarations(node); + node.members.forEach(checkEnumMember); + computeEnumMemberValues(node); + var enumSymbol = getSymbolOfNode(node); + var firstDeclaration = ts6.getDeclarationOfKind(enumSymbol, node.kind); + if (node === firstDeclaration) { + if (enumSymbol.declarations && enumSymbol.declarations.length > 1) { + var enumIsConst_1 = ts6.isEnumConst(node); + ts6.forEach(enumSymbol.declarations, function(decl) { + if (ts6.isEnumDeclaration(decl) && ts6.isEnumConst(decl) !== enumIsConst_1) { + error(ts6.getNameOfDeclaration(decl), ts6.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } + var seenEnumMissingInitialInitializer_1 = false; + ts6.forEach(enumSymbol.declarations, function(declaration) { + if (declaration.kind !== 263) { + return false; + } + var enumDeclaration = declaration; + if (!enumDeclaration.members.length) { + return false; + } + var firstEnumMember = enumDeclaration.members[0]; + if (!firstEnumMember.initializer) { + if (seenEnumMissingInitialInitializer_1) { + error(firstEnumMember.name, ts6.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + } else { + seenEnumMissingInitialInitializer_1 = true; + } + } + }); + } + } + function checkEnumMember(node) { + if (ts6.isPrivateIdentifier(node.name)) { + error(node, ts6.Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier); + } + } + function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; + if ((declaration.kind === 260 || declaration.kind === 259 && ts6.nodeIsPresent(declaration.body)) && !(declaration.flags & 16777216)) { + return declaration; + } + } + } + return void 0; + } + function inSameLexicalScope(node1, node2) { + var container1 = ts6.getEnclosingBlockScopeContainer(node1); + var container2 = ts6.getEnclosingBlockScopeContainer(node2); + if (isGlobalSourceFile(container1)) { + return isGlobalSourceFile(container2); + } else if (isGlobalSourceFile(container2)) { + return false; + } else { + return container1 === container2; + } + } + function checkModuleDeclaration(node) { + if (node.body) { + checkSourceElement(node.body); + if (!ts6.isGlobalScopeAugmentation(node)) { + registerForUnusedIdentifiersCheck(node); + } + } + addLazyDiagnostic(checkModuleDeclarationDiagnostics); + function checkModuleDeclarationDiagnostics() { + var isGlobalAugmentation = ts6.isGlobalScopeAugmentation(node); + var inAmbientContext = node.flags & 16777216; + if (isGlobalAugmentation && !inAmbientContext) { + error(node.name, ts6.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + } + var isAmbientExternalModule = ts6.isAmbientModule(node); + var contextErrorMessage = isAmbientExternalModule ? ts6.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts6.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module; + if (checkGrammarModuleElementContext(node, contextErrorMessage)) { + return; + } + if (!checkGrammarDecoratorsAndModifiers(node)) { + if (!inAmbientContext && node.name.kind === 10) { + grammarErrorOnNode(node.name, ts6.Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + } + if (ts6.isIdentifier(node.name)) { + checkCollisionsForDeclarationName(node, node.name); + } + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + if (symbol.flags & 512 && !inAmbientContext && symbol.declarations && symbol.declarations.length > 1 && isInstantiatedModule(node, ts6.shouldPreserveConstEnums(compilerOptions))) { + var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + if (firstNonAmbientClassOrFunc) { + if (ts6.getSourceFileOfNode(node) !== ts6.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { + error(node.name, ts6.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + } else if (node.pos < firstNonAmbientClassOrFunc.pos) { + error(node.name, ts6.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + } + } + var mergedClass = ts6.getDeclarationOfKind( + symbol, + 260 + /* SyntaxKind.ClassDeclaration */ + ); + if (mergedClass && inSameLexicalScope(node, mergedClass)) { + getNodeLinks(node).flags |= 32768; + } + } + if (isAmbientExternalModule) { + if (ts6.isExternalModuleAugmentation(node)) { + var checkBody = isGlobalAugmentation || getSymbolOfNode(node).flags & 33554432; + if (checkBody && node.body) { + for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + checkModuleAugmentationElement(statement, isGlobalAugmentation); + } + } + } else if (isGlobalSourceFile(node.parent)) { + if (isGlobalAugmentation) { + error(node.name, ts6.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } else if (ts6.isExternalModuleNameRelative(ts6.getTextOfIdentifierOrLiteral(node.name))) { + error(node.name, ts6.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + } + } else { + if (isGlobalAugmentation) { + error(node.name, ts6.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + } else { + error(node.name, ts6.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + } + } + } + } + } + function checkModuleAugmentationElement(node, isGlobalAugmentation) { + switch (node.kind) { + case 240: + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + checkModuleAugmentationElement(decl, isGlobalAugmentation); + } + break; + case 274: + case 275: + grammarErrorOnFirstToken(node, ts6.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); + break; + case 268: + case 269: + grammarErrorOnFirstToken(node, ts6.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); + break; + case 205: + case 257: + var name = node.name; + if (ts6.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; + checkModuleAugmentationElement(el, isGlobalAugmentation); + } + break; + } + case 260: + case 263: + case 259: + case 261: + case 264: + case 262: + if (isGlobalAugmentation) { + return; + } + break; + } + } + function getFirstNonModuleExportsIdentifier(node) { + switch (node.kind) { + case 79: + return node; + case 163: + do { + node = node.left; + } while (node.kind !== 79); + return node; + case 208: + do { + if (ts6.isModuleExportsAccessExpression(node.expression) && !ts6.isPrivateIdentifier(node.name)) { + return node.name; + } + node = node.expression; + } while (node.kind !== 79); + return node; + } + } + function checkExternalImportOrExportDeclaration(node) { + var moduleName = ts6.getExternalModuleName(node); + if (!moduleName || ts6.nodeIsMissing(moduleName)) { + return false; + } + if (!ts6.isStringLiteral(moduleName)) { + error(moduleName, ts6.Diagnostics.String_literal_expected); + return false; + } + var inAmbientExternalModule = node.parent.kind === 265 && ts6.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 ? ts6.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts6.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); + return false; + } + if (inAmbientExternalModule && ts6.isExternalModuleNameRelative(moduleName.text)) { + if (!isTopLevelInExternalModuleAugmentation(node)) { + error(node, ts6.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + return false; + } + } + if (!ts6.isImportEqualsDeclaration(node) && node.assertClause) { + var hasError = false; + for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) { + var clause = _a[_i]; + if (!ts6.isStringLiteral(clause.value)) { + hasError = true; + error(clause.value, ts6.Diagnostics.Import_assertion_values_must_be_string_literal_expressions); + } + } + return !hasError; + } + return true; + } + function checkAliasSymbol(node) { + var _a, _b, _c, _d, _e; + var symbol = getSymbolOfNode(node); + var target = resolveAlias(symbol); + if (target !== unknownSymbol) { + symbol = getMergedSymbol(symbol.exportSymbol || symbol); + if (ts6.isInJSFile(node) && !(target.flags & 111551) && !ts6.isTypeOnlyImportOrExportDeclaration(node)) { + var errorNode = ts6.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts6.isNamedDeclaration(node) ? node.name : node; + ts6.Debug.assert( + node.kind !== 277 + /* SyntaxKind.NamespaceExport */ + ); + if (node.kind === 278) { + var diag = error(errorNode, ts6.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); + var alreadyExportedSymbol = (_b = (_a = ts6.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); + if (alreadyExportedSymbol === target) { + var exportingDeclaration = (_c = alreadyExportedSymbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts6.isJSDocNode); + if (exportingDeclaration) { + ts6.addRelatedInfo(diag, ts6.createDiagnosticForNode(exportingDeclaration, ts6.Diagnostics._0_is_automatically_exported_here, ts6.unescapeLeadingUnderscores(alreadyExportedSymbol.escapedName))); + } + } + } else { + ts6.Debug.assert( + node.kind !== 257 + /* SyntaxKind.VariableDeclaration */ + ); + var importDeclaration = ts6.findAncestor(node, ts6.or(ts6.isImportDeclaration, ts6.isImportEqualsDeclaration)); + var moduleSpecifier = (_e = importDeclaration && ((_d = ts6.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text)) !== null && _e !== void 0 ? _e : "..."; + var importedIdentifier = ts6.unescapeLeadingUnderscores(ts6.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); + error(errorNode, ts6.Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation, importedIdentifier, 'import("'.concat(moduleSpecifier, '").').concat(importedIdentifier)); + } + return; + } + var targetFlags = getAllSymbolFlags(target); + var excludedMeanings = (symbol.flags & (111551 | 1048576) ? 111551 : 0) | (symbol.flags & 788968 ? 788968 : 0) | (symbol.flags & 1920 ? 1920 : 0); + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 ? ts6.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts6.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + error(node, message, symbolToString(symbol)); + } + if (compilerOptions.isolatedModules && !ts6.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216)) { + var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); + var isType = !(targetFlags & 111551); + if (isType || typeOnlyAlias) { + switch (node.kind) { + case 270: + case 273: + case 268: { + if (compilerOptions.preserveValueImports) { + ts6.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); + var message = isType ? ts6.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts6.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; + var name = ts6.idText(node.kind === 273 ? node.propertyName || node.name : node.name); + addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? void 0 : typeOnlyAlias, name); + } + if (isType && node.kind === 268 && ts6.hasEffectiveModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + error(node, ts6.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); + } + break; + } + case 278: { + if (ts6.getSourceFileOfNode(typeOnlyAlias) !== ts6.getSourceFileOfNode(node)) { + var message = isType ? ts6.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type : ts6.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled; + var name = ts6.idText(node.propertyName || node.name); + addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? void 0 : typeOnlyAlias, name); + return; + } + } + } + } + } + if (ts6.isImportSpecifier(node)) { + var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node); + if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) { + addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName); + } + } + } + } + function isDeprecatedAliasedSymbol(symbol) { + return !!symbol.declarations && ts6.every(symbol.declarations, function(d) { + return !!(ts6.getCombinedNodeFlags(d) & 268435456); + }); + } + function checkDeprecatedAliasedSymbol(symbol, location) { + if (!(symbol.flags & 2097152)) + return symbol; + var targetSymbol = resolveAlias(symbol); + if (targetSymbol === unknownSymbol) + return targetSymbol; + while (symbol.flags & 2097152) { + var target = getImmediateAliasedSymbol(symbol); + if (target) { + if (target === targetSymbol) + break; + if (target.declarations && ts6.length(target.declarations)) { + if (isDeprecatedAliasedSymbol(target)) { + addDeprecatedSuggestion(location, target.declarations, target.escapedName); + break; + } else { + if (symbol === targetSymbol) + break; + symbol = target; + } + } + } else { + break; + } + } + return targetSymbol; + } + function checkImportBinding(node) { + checkCollisionsForDeclarationName(node, node.name); + checkAliasSymbol(node); + if (node.kind === 273 && ts6.idText(node.propertyName || node.name) === "default" && ts6.getESModuleInterop(compilerOptions) && moduleKind !== ts6.ModuleKind.System && (moduleKind < ts6.ModuleKind.ES2015 || ts6.getSourceFileOfNode(node).impliedNodeFormat === ts6.ModuleKind.CommonJS)) { + checkExternalEmitHelpers( + node, + 131072 + /* ExternalEmitHelpers.ImportDefault */ + ); + } + } + function checkAssertClause(declaration) { + var _a; + if (declaration.assertClause) { + var validForTypeAssertions = ts6.isExclusivelyTypeOnlyImportOrExport(declaration); + var override = ts6.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : void 0); + if (validForTypeAssertions && override) { + if (!ts6.isNightly()) { + grammarErrorOnNode(declaration.assertClause, ts6.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next); + } + if (ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.Node16 && ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.NodeNext) { + return grammarErrorOnNode(declaration.assertClause, ts6.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext); + } + return; + } + var mode = moduleKind === ts6.ModuleKind.NodeNext && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier); + if (mode !== ts6.ModuleKind.ESNext && moduleKind !== ts6.ModuleKind.ESNext) { + return grammarErrorOnNode(declaration.assertClause, moduleKind === ts6.ModuleKind.NodeNext ? ts6.Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls : ts6.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext); + } + if (ts6.isImportDeclaration(declaration) ? (_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) { + return grammarErrorOnNode(declaration.assertClause, ts6.Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); + } + if (override) { + return grammarErrorOnNode(declaration.assertClause, ts6.Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports); + } + } + } + function checkImportDeclaration(node) { + if (checkGrammarModuleElementContext(node, ts6.isInJSFile(node) ? ts6.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts6.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) { + return; + } + if (!checkGrammarDecoratorsAndModifiers(node) && ts6.hasEffectiveModifiers(node)) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.An_import_declaration_cannot_have_modifiers); + } + if (checkExternalImportOrExportDeclaration(node)) { + var importClause = node.importClause; + if (importClause && !checkGrammarImportClause(importClause)) { + if (importClause.name) { + checkImportBinding(importClause); + } + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === 271) { + checkImportBinding(importClause.namedBindings); + if (moduleKind !== ts6.ModuleKind.System && (moduleKind < ts6.ModuleKind.ES2015 || ts6.getSourceFileOfNode(node).impliedNodeFormat === ts6.ModuleKind.CommonJS) && ts6.getESModuleInterop(compilerOptions)) { + checkExternalEmitHelpers( + node, + 65536 + /* ExternalEmitHelpers.ImportStar */ + ); + } + } else { + var moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier); + if (moduleExisted) { + ts6.forEach(importClause.namedBindings.elements, checkImportBinding); + } + } + } + } + } + checkAssertClause(node); + } + function checkImportEqualsDeclaration(node) { + if (checkGrammarModuleElementContext(node, ts6.isInJSFile(node) ? ts6.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts6.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) { + return; + } + checkGrammarDecoratorsAndModifiers(node); + if (ts6.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { + checkImportBinding(node); + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + markExportAsReferenced(node); + } + if (node.moduleReference.kind !== 280) { + var target = resolveAlias(getSymbolOfNode(node)); + if (target !== unknownSymbol) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551) { + var moduleName = ts6.getFirstIdentifier(node.moduleReference); + if (!(resolveEntityName( + moduleName, + 111551 | 1920 + /* SymbolFlags.Namespace */ + ).flags & 1920)) { + error(moduleName, ts6.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts6.declarationNameToString(moduleName)); + } + } + if (targetFlags & 788968) { + checkTypeNameIsReserved(node.name, ts6.Diagnostics.Import_name_cannot_be_0); + } + } + if (node.isTypeOnly) { + grammarErrorOnNode(node, ts6.Diagnostics.An_import_alias_cannot_use_import_type); + } + } else { + if (moduleKind >= ts6.ModuleKind.ES2015 && ts6.getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216)) { + grammarErrorOnNode(node, ts6.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); + } + } + } + } + function checkExportDeclaration(node) { + if (checkGrammarModuleElementContext(node, ts6.isInJSFile(node) ? ts6.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts6.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) { + return; + } + if (!checkGrammarDecoratorsAndModifiers(node) && ts6.hasSyntacticModifiers(node)) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.An_export_declaration_cannot_have_modifiers); + } + if (node.moduleSpecifier && node.exportClause && ts6.isNamedExports(node.exportClause) && ts6.length(node.exportClause.elements) && languageVersion === 0) { + checkExternalEmitHelpers( + node, + 4194304 + /* ExternalEmitHelpers.CreateBinding */ + ); + } + checkGrammarExportDeclaration(node); + if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { + if (node.exportClause && !ts6.isNamespaceExport(node.exportClause)) { + ts6.forEach(node.exportClause.elements, checkExportSpecifier); + var inAmbientExternalModule = node.parent.kind === 265 && ts6.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 && !node.moduleSpecifier && node.flags & 16777216; + if (node.parent.kind !== 308 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + error(node, ts6.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); + } + } else { + var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); + if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { + error(node.moduleSpecifier, ts6.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + } else if (node.exportClause) { + checkAliasSymbol(node.exportClause); + } + if (moduleKind !== ts6.ModuleKind.System && (moduleKind < ts6.ModuleKind.ES2015 || ts6.getSourceFileOfNode(node).impliedNodeFormat === ts6.ModuleKind.CommonJS)) { + if (node.exportClause) { + if (ts6.getESModuleInterop(compilerOptions)) { + checkExternalEmitHelpers( + node, + 65536 + /* ExternalEmitHelpers.ImportStar */ + ); + } + } else { + checkExternalEmitHelpers( + node, + 32768 + /* ExternalEmitHelpers.ExportStar */ + ); + } + } + } + } + checkAssertClause(node); + } + function checkGrammarExportDeclaration(node) { + var _a; + if (node.isTypeOnly) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276) { + return checkGrammarNamedImportsOrExports(node.exportClause); + } else { + return grammarErrorOnNode(node, ts6.Diagnostics.Only_named_exports_may_use_export_type); + } + } + return false; + } + function checkGrammarModuleElementContext(node, errorMessage) { + var isInAppropriateContext = node.parent.kind === 308 || node.parent.kind === 265 || node.parent.kind === 264; + if (!isInAppropriateContext) { + grammarErrorOnFirstToken(node, errorMessage); + } + return !isInAppropriateContext; + } + function importClauseContainsReferencedImport(importClause) { + return ts6.forEachImportClauseDeclaration(importClause, function(declaration) { + return !!getSymbolOfNode(declaration).isReferenced; + }); + } + function importClauseContainsConstEnumUsedAsValue(importClause) { + return ts6.forEachImportClauseDeclaration(importClause, function(declaration) { + return !!getSymbolLinks(getSymbolOfNode(declaration)).constEnumReferenced; + }); + } + function canConvertImportDeclarationToTypeOnly(statement) { + return ts6.isImportDeclaration(statement) && statement.importClause && !statement.importClause.isTypeOnly && importClauseContainsReferencedImport(statement.importClause) && !isReferencedAliasDeclaration( + statement.importClause, + /*checkChildren*/ + true + ) && !importClauseContainsConstEnumUsedAsValue(statement.importClause); + } + function canConvertImportEqualsDeclarationToTypeOnly(statement) { + return ts6.isImportEqualsDeclaration(statement) && ts6.isExternalModuleReference(statement.moduleReference) && !statement.isTypeOnly && getSymbolOfNode(statement).isReferenced && !isReferencedAliasDeclaration( + statement, + /*checkChildren*/ + false + ) && !getSymbolLinks(getSymbolOfNode(statement)).constEnumReferenced; + } + function checkImportsForTypeOnlyConversion(sourceFile) { + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) { + error(statement, ts6.Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error); + } + } + } + function checkExportSpecifier(node) { + checkAliasSymbol(node); + if (ts6.getEmitDeclarations(compilerOptions)) { + collectLinkedAliases( + node.propertyName || node.name, + /*setVisibility*/ + true + ); + } + if (!node.parent.parent.moduleSpecifier) { + var exportedName = node.propertyName || node.name; + var symbol = resolveName( + exportedName, + exportedName.escapedText, + 111551 | 788968 | 1920 | 2097152, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + true + ); + if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { + error(exportedName, ts6.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts6.idText(exportedName)); + } else { + if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) { + markExportAsReferenced(node); + } + var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol); + if (!target || getAllSymbolFlags(target) & 111551) { + checkExpressionCached(node.propertyName || node.name); + } + } + } else { + if (ts6.getESModuleInterop(compilerOptions) && moduleKind !== ts6.ModuleKind.System && (moduleKind < ts6.ModuleKind.ES2015 || ts6.getSourceFileOfNode(node).impliedNodeFormat === ts6.ModuleKind.CommonJS) && ts6.idText(node.propertyName || node.name) === "default") { + checkExternalEmitHelpers( + node, + 131072 + /* ExternalEmitHelpers.ImportDefault */ + ); + } + } + } + function checkExportAssignment(node) { + var illegalContextMessage = node.isExportEquals ? ts6.Diagnostics.An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration : ts6.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration; + if (checkGrammarModuleElementContext(node, illegalContextMessage)) { + return; + } + var container = node.parent.kind === 308 ? node.parent : node.parent.parent; + if (container.kind === 264 && !ts6.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts6.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } else { + error(node, ts6.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } + return; + } + if (!checkGrammarDecoratorsAndModifiers(node) && ts6.hasEffectiveModifiers(node)) { + grammarErrorOnFirstToken(node, ts6.Diagnostics.An_export_assignment_cannot_have_modifiers); + } + var typeAnnotationNode = ts6.getEffectiveTypeAnnotationNode(node); + if (typeAnnotationNode) { + checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression); + } + if (node.expression.kind === 79) { + var id = node.expression; + var sym = resolveEntityName( + id, + 67108863, + /*ignoreErrors*/ + true, + /*dontResolveAlias*/ + true, + node + ); + if (sym) { + markAliasReferenced(sym, id); + var target = sym.flags & 2097152 ? resolveAlias(sym) : sym; + if (getAllSymbolFlags(target) & 111551) { + checkExpressionCached(node.expression); + } + } else { + checkExpressionCached(node.expression); + } + if (ts6.getEmitDeclarations(compilerOptions)) { + collectLinkedAliases( + node.expression, + /*setVisibility*/ + true + ); + } + } else { + checkExpressionCached(node.expression); + } + checkExternalModuleExports(container); + if (node.flags & 16777216 && !ts6.isEntityNameExpression(node.expression)) { + grammarErrorOnNode(node.expression, ts6.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context); + } + if (node.isExportEquals && !(node.flags & 16777216)) { + if (moduleKind >= ts6.ModuleKind.ES2015 && ts6.getSourceFileOfNode(node).impliedNodeFormat !== ts6.ModuleKind.CommonJS) { + grammarErrorOnNode(node, ts6.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead); + } else if (moduleKind === ts6.ModuleKind.System) { + grammarErrorOnNode(node, ts6.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); + } + } + } + function hasExportedMembers(moduleSymbol) { + return ts6.forEachEntry(moduleSymbol.exports, function(_, id) { + return id !== "export="; + }); + } + function checkExternalModuleExports(node) { + var moduleSymbol = getSymbolOfNode(node); + var links = getSymbolLinks(moduleSymbol); + if (!links.exportsChecked) { + var exportEqualsSymbol = moduleSymbol.exports.get("export="); + if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { + var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; + if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !ts6.isInJSFile(declaration)) { + error(declaration, ts6.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + } + var exports_3 = getExportsOfModule(moduleSymbol); + if (exports_3) { + exports_3.forEach(function(_a, id) { + var declarations = _a.declarations, flags = _a.flags; + if (id === "__export") { + return; + } + if (flags & (1920 | 384)) { + return; + } + var exportedDeclarationsCount = ts6.countWhere(declarations, ts6.and(isNotOverloadAndNotAccessor, ts6.not(ts6.isInterfaceDeclaration))); + if (flags & 524288 && exportedDeclarationsCount <= 2) { + return; + } + if (exportedDeclarationsCount > 1) { + if (!isDuplicatedCommonJSExport(declarations)) { + for (var _i = 0, _b = declarations; _i < _b.length; _i++) { + var declaration2 = _b[_i]; + if (isNotOverload(declaration2)) { + diagnostics.add(ts6.createDiagnosticForNode(declaration2, ts6.Diagnostics.Cannot_redeclare_exported_variable_0, ts6.unescapeLeadingUnderscores(id))); + } + } + } + } + }); + } + links.exportsChecked = true; + } + } + function isDuplicatedCommonJSExport(declarations) { + return declarations && declarations.length > 1 && declarations.every(function(d) { + return ts6.isInJSFile(d) && ts6.isAccessExpression(d) && (ts6.isExportsIdentifier(d.expression) || ts6.isModuleExportsAccessExpression(d.expression)); + }); + } + function checkSourceElement(node) { + if (node) { + var saveCurrentNode = currentNode; + currentNode = node; + instantiationCount = 0; + checkSourceElementWorker(node); + currentNode = saveCurrentNode; + } + } + function checkSourceElementWorker(node) { + ts6.forEach(node.jsDoc, function(_a) { + var comment = _a.comment, tags = _a.tags; + checkJSDocCommentWorker(comment); + ts6.forEach(tags, function(tag) { + checkJSDocCommentWorker(tag.comment); + if (ts6.isInJSFile(node)) { + checkSourceElement(tag); + } + }); + }); + var kind = node.kind; + if (cancellationToken) { + switch (kind) { + case 264: + case 260: + case 261: + case 259: + cancellationToken.throwIfCancellationRequested(); + } + } + if (kind >= 240 && kind <= 256 && node.flowNode && !isReachableFlowNode(node.flowNode)) { + errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts6.Diagnostics.Unreachable_code_detected); + } + switch (kind) { + case 165: + return checkTypeParameter(node); + case 166: + return checkParameter(node); + case 169: + return checkPropertyDeclaration(node); + case 168: + return checkPropertySignature(node); + case 182: + case 181: + case 176: + case 177: + case 178: + return checkSignatureDeclaration(node); + case 171: + case 170: + return checkMethodDeclaration(node); + case 172: + return checkClassStaticBlockDeclaration(node); + case 173: + return checkConstructorDeclaration(node); + case 174: + case 175: + return checkAccessorDeclaration(node); + case 180: + return checkTypeReferenceNode(node); + case 179: + return checkTypePredicate(node); + case 183: + return checkTypeQuery(node); + case 184: + return checkTypeLiteral(node); + case 185: + return checkArrayType(node); + case 186: + return checkTupleType(node); + case 189: + case 190: + return checkUnionOrIntersectionType(node); + case 193: + case 187: + case 188: + return checkSourceElement(node.type); + case 194: + return checkThisType(node); + case 195: + return checkTypeOperator(node); + case 191: + return checkConditionalType(node); + case 192: + return checkInferType(node); + case 200: + return checkTemplateLiteralType(node); + case 202: + return checkImportType(node); + case 199: + return checkNamedTupleMember(node); + case 331: + return checkJSDocAugmentsTag(node); + case 332: + return checkJSDocImplementsTag(node); + case 348: + case 341: + case 342: + return checkJSDocTypeAliasTag(node); + case 347: + return checkJSDocTemplateTag(node); + case 346: + return checkJSDocTypeTag(node); + case 327: + case 328: + case 329: + return checkJSDocLinkLikeTag(node); + case 343: + return checkJSDocParameterTag(node); + case 350: + return checkJSDocPropertyTag(node); + case 320: + checkJSDocFunctionType(node); + case 318: + case 317: + case 315: + case 316: + case 325: + checkJSDocTypeIsInJsFile(node); + ts6.forEachChild(node, checkSourceElement); + return; + case 321: + checkJSDocVariadicType(node); + return; + case 312: + return checkSourceElement(node.type); + case 336: + case 338: + case 337: + return checkJSDocAccessibilityModifiers(node); + case 196: + return checkIndexedAccessType(node); + case 197: + return checkMappedType(node); + case 259: + return checkFunctionDeclaration(node); + case 238: + case 265: + return checkBlock(node); + case 240: + return checkVariableStatement(node); + case 241: + return checkExpressionStatement(node); + case 242: + return checkIfStatement(node); + case 243: + return checkDoStatement(node); + case 244: + return checkWhileStatement(node); + case 245: + return checkForStatement(node); + case 246: + return checkForInStatement(node); + case 247: + return checkForOfStatement(node); + case 248: + case 249: + return checkBreakOrContinueStatement(node); + case 250: + return checkReturnStatement(node); + case 251: + return checkWithStatement(node); + case 252: + return checkSwitchStatement(node); + case 253: + return checkLabeledStatement(node); + case 254: + return checkThrowStatement(node); + case 255: + return checkTryStatement(node); + case 257: + return checkVariableDeclaration(node); + case 205: + return checkBindingElement(node); + case 260: + return checkClassDeclaration(node); + case 261: + return checkInterfaceDeclaration(node); + case 262: + return checkTypeAliasDeclaration(node); + case 263: + return checkEnumDeclaration(node); + case 264: + return checkModuleDeclaration(node); + case 269: + return checkImportDeclaration(node); + case 268: + return checkImportEqualsDeclaration(node); + case 275: + return checkExportDeclaration(node); + case 274: + return checkExportAssignment(node); + case 239: + case 256: + checkGrammarStatementInAmbientContext(node); + return; + case 279: + return checkMissingDeclaration(node); + } + } + function checkJSDocCommentWorker(node) { + if (ts6.isArray(node)) { + ts6.forEach(node, function(tag) { + if (ts6.isJSDocLinkLike(tag)) { + checkSourceElement(tag); + } + }); + } + } + function checkJSDocTypeIsInJsFile(node) { + if (!ts6.isInJSFile(node)) { + grammarErrorOnNode(node, ts6.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); + } + } + function checkJSDocVariadicType(node) { + checkJSDocTypeIsInJsFile(node); + checkSourceElement(node.type); + var parent = node.parent; + if (ts6.isParameter(parent) && ts6.isJSDocFunctionType(parent.parent)) { + if (ts6.last(parent.parent.parameters) !== parent) { + error(node, ts6.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + return; + } + if (!ts6.isJSDocTypeExpression(parent)) { + error(node, ts6.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); + } + var paramTag = node.parent.parent; + if (!ts6.isJSDocParameterTag(paramTag)) { + error(node, ts6.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); + return; + } + var param = ts6.getParameterSymbolFromJSDoc(paramTag); + if (!param) { + return; + } + var host2 = ts6.getHostSignatureFromJSDoc(paramTag); + if (!host2 || ts6.last(host2.parameters).symbol !== param) { + error(node, ts6.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + } + function getTypeFromJSDocVariadicType(node) { + var type = getTypeFromTypeNode(node.type); + var parent = node.parent; + var paramTag = node.parent.parent; + if (ts6.isJSDocTypeExpression(node.parent) && ts6.isJSDocParameterTag(paramTag)) { + var host_1 = ts6.getHostSignatureFromJSDoc(paramTag); + var isCallbackTag = ts6.isJSDocCallbackTag(paramTag.parent.parent); + if (host_1 || isCallbackTag) { + var lastParamDeclaration = isCallbackTag ? ts6.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters) : ts6.lastOrUndefined(host_1.parameters); + var symbol = ts6.getParameterSymbolFromJSDoc(paramTag); + if (!lastParamDeclaration || symbol && lastParamDeclaration.symbol === symbol && ts6.isRestParameter(lastParamDeclaration)) { + return createArrayType(type); + } + } + } + if (ts6.isParameter(parent) && ts6.isJSDocFunctionType(parent.parent)) { + return createArrayType(type); + } + return addOptionality(type); + } + function checkNodeDeferred(node) { + var enclosingFile = ts6.getSourceFileOfNode(node); + var links = getNodeLinks(enclosingFile); + if (!(links.flags & 1)) { + links.deferredNodes || (links.deferredNodes = new ts6.Set()); + links.deferredNodes.add(node); + } + } + function checkDeferredNodes(context) { + var links = getNodeLinks(context); + if (links.deferredNodes) { + links.deferredNodes.forEach(checkDeferredNode); + } + } + function checkDeferredNode(node) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("check", "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); + var saveCurrentNode = currentNode; + currentNode = node; + instantiationCount = 0; + switch (node.kind) { + case 210: + case 211: + case 212: + case 167: + case 283: + resolveUntypedCall(node); + break; + case 215: + case 216: + case 171: + case 170: + checkFunctionExpressionOrObjectLiteralMethodDeferred(node); + break; + case 174: + case 175: + checkAccessorDeclaration(node); + break; + case 228: + checkClassExpressionDeferred(node); + break; + case 165: + checkTypeParameterDeferred(node); + break; + case 282: + checkJsxSelfClosingElementDeferred(node); + break; + case 281: + checkJsxElementDeferred(node); + break; + } + currentNode = saveCurrentNode; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + function checkSourceFile(node) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push( + "check", + "checkSourceFile", + { path: node.path }, + /*separateBeginAndEnd*/ + true + ); + ts6.performance.mark("beforeCheck"); + checkSourceFileWorker(node); + ts6.performance.mark("afterCheck"); + ts6.performance.measure("Check", "beforeCheck", "afterCheck"); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + function unusedIsError(kind, isAmbient) { + if (isAmbient) { + return false; + } + switch (kind) { + case 0: + return !!compilerOptions.noUnusedLocals; + case 1: + return !!compilerOptions.noUnusedParameters; + default: + return ts6.Debug.assertNever(kind); + } + } + function getPotentiallyUnusedIdentifiers(sourceFile) { + return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || ts6.emptyArray; + } + function checkSourceFileWorker(node) { + var links = getNodeLinks(node); + if (!(links.flags & 1)) { + if (ts6.skipTypeChecking(node, compilerOptions, host)) { + return; + } + checkGrammarSourceFile(node); + ts6.clear(potentialThisCollisions); + ts6.clear(potentialNewTargetCollisions); + ts6.clear(potentialWeakMapSetCollisions); + ts6.clear(potentialReflectCollisions); + ts6.clear(potentialUnusedRenamedBindingElementsInTypes); + ts6.forEach(node.statements, checkSourceElement); + checkSourceElement(node.endOfFileToken); + checkDeferredNodes(node); + if (ts6.isExternalOrCommonJsModule(node)) { + registerForUnusedIdentifiersCheck(node); + } + addLazyDiagnostic(function() { + if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { + checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function(containingNode, kind, diag) { + if (!ts6.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216))) { + diagnostics.add(diag); + } + }); + } + if (!node.isDeclarationFile) { + checkPotentialUncheckedRenamedBindingElementsInTypes(); + } + }); + if (compilerOptions.importsNotUsedAsValues === 2 && !node.isDeclarationFile && ts6.isExternalModule(node)) { + checkImportsForTypeOnlyConversion(node); + } + if (ts6.isExternalOrCommonJsModule(node)) { + checkExternalModuleExports(node); + } + if (potentialThisCollisions.length) { + ts6.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); + ts6.clear(potentialThisCollisions); + } + if (potentialNewTargetCollisions.length) { + ts6.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + ts6.clear(potentialNewTargetCollisions); + } + if (potentialWeakMapSetCollisions.length) { + ts6.forEach(potentialWeakMapSetCollisions, checkWeakMapSetCollision); + ts6.clear(potentialWeakMapSetCollisions); + } + if (potentialReflectCollisions.length) { + ts6.forEach(potentialReflectCollisions, checkReflectCollision); + ts6.clear(potentialReflectCollisions); + } + links.flags |= 1; + } + } + function getDiagnostics(sourceFile, ct) { + try { + cancellationToken = ct; + return getDiagnosticsWorker(sourceFile); + } finally { + cancellationToken = void 0; + } + } + function ensurePendingDiagnosticWorkComplete() { + for (var _i = 0, deferredDiagnosticsCallbacks_1 = deferredDiagnosticsCallbacks; _i < deferredDiagnosticsCallbacks_1.length; _i++) { + var cb = deferredDiagnosticsCallbacks_1[_i]; + cb(); + } + deferredDiagnosticsCallbacks = []; + } + function checkSourceFileWithEagerDiagnostics(sourceFile) { + ensurePendingDiagnosticWorkComplete(); + var oldAddLazyDiagnostics = addLazyDiagnostic; + addLazyDiagnostic = function(cb) { + return cb(); + }; + checkSourceFile(sourceFile); + addLazyDiagnostic = oldAddLazyDiagnostics; + } + function getDiagnosticsWorker(sourceFile) { + if (sourceFile) { + ensurePendingDiagnosticWorkComplete(); + var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); + var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; + checkSourceFileWithEagerDiagnostics(sourceFile); + var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); + if (currentGlobalDiagnostics !== previousGlobalDiagnostics) { + var deferredGlobalDiagnostics = ts6.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts6.compareDiagnostics); + return ts6.concatenate(deferredGlobalDiagnostics, semanticDiagnostics); + } else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) { + return ts6.concatenate(currentGlobalDiagnostics, semanticDiagnostics); + } + return semanticDiagnostics; + } + ts6.forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics); + return diagnostics.getDiagnostics(); + } + function getGlobalDiagnostics() { + ensurePendingDiagnosticWorkComplete(); + return diagnostics.getGlobalDiagnostics(); + } + function getSymbolsInScope(location, meaning) { + if (location.flags & 33554432) { + return []; + } + var symbols = ts6.createSymbolTable(); + var isStaticSymbol = false; + populateSymbols(); + symbols.delete( + "this" + /* InternalSymbolName.This */ + ); + return symbolsToArray(symbols); + function populateSymbols() { + while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + copySymbols(location.locals, meaning); + } + switch (location.kind) { + case 308: + if (!ts6.isExternalModule(location)) + break; + case 264: + copyLocallyVisibleExportSymbols( + getSymbolOfNode(location).exports, + meaning & 2623475 + /* SymbolFlags.ModuleMember */ + ); + break; + case 263: + copySymbols( + getSymbolOfNode(location).exports, + meaning & 8 + /* SymbolFlags.EnumMember */ + ); + break; + case 228: + var className = location.name; + if (className) { + copySymbol(location.symbol, meaning); + } + case 260: + case 261: + if (!isStaticSymbol) { + copySymbols( + getMembersOfSymbol(getSymbolOfNode(location)), + meaning & 788968 + /* SymbolFlags.Type */ + ); + } + break; + case 215: + var funcName = location.name; + if (funcName) { + copySymbol(location.symbol, meaning); + } + break; + } + if (ts6.introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } + isStaticSymbol = ts6.isStatic(location); + location = location.parent; + } + copySymbols(globals, meaning); + } + function copySymbol(symbol, meaning2) { + if (ts6.getCombinedLocalAndExportSymbolFlags(symbol) & meaning2) { + var id = symbol.escapedName; + if (!symbols.has(id)) { + symbols.set(id, symbol); + } + } + } + function copySymbols(source, meaning2) { + if (meaning2) { + source.forEach(function(symbol) { + copySymbol(symbol, meaning2); + }); + } + } + function copyLocallyVisibleExportSymbols(source, meaning2) { + if (meaning2) { + source.forEach(function(symbol) { + if (!ts6.getDeclarationOfKind( + symbol, + 278 + /* SyntaxKind.ExportSpecifier */ + ) && !ts6.getDeclarationOfKind( + symbol, + 277 + /* SyntaxKind.NamespaceExport */ + )) { + copySymbol(symbol, meaning2); + } + }); + } + } + } + function isTypeDeclarationName(name) { + return name.kind === 79 && ts6.isTypeDeclaration(name.parent) && ts6.getNameOfDeclaration(name.parent) === name; + } + function isTypeReferenceIdentifier(node) { + while (node.parent.kind === 163) { + node = node.parent; + } + return node.parent.kind === 180; + } + function isHeritageClauseElementIdentifier(node) { + while (node.parent.kind === 208) { + node = node.parent; + } + return node.parent.kind === 230; + } + function forEachEnclosingClass(node, callback) { + var result; + while (true) { + node = ts6.getContainingClass(node); + if (!node) + break; + if (result = callback(node)) + break; + } + return result; + } + function isNodeUsedDuringClassInitialization(node) { + return !!ts6.findAncestor(node, function(element) { + if (ts6.isConstructorDeclaration(element) && ts6.nodeIsPresent(element.body) || ts6.isPropertyDeclaration(element)) { + return true; + } else if (ts6.isClassLike(element) || ts6.isFunctionLikeDeclaration(element)) { + return "quit"; + } + return false; + }); + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function(n) { + return n === classDeclaration; + }); + } + function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { + while (nodeOnRightSide.parent.kind === 163) { + nodeOnRightSide = nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 268) { + return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : void 0; + } + if (nodeOnRightSide.parent.kind === 274) { + return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : void 0; + } + return void 0; + } + function isInRightSideOfImportOrExportAssignment(node) { + return getLeftSideOfImportEqualsOrExportAssignment(node) !== void 0; + } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { + var specialPropertyAssignmentKind = ts6.getAssignmentDeclarationKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + case 5: + return getSymbolOfNode(entityName.parent.parent); + } + } + function isImportTypeQualifierPart(node) { + var parent = node.parent; + while (ts6.isQualifiedName(parent)) { + node = parent; + parent = parent.parent; + } + if (parent && parent.kind === 202 && parent.qualifier === node) { + return parent; + } + return void 0; + } + function getSymbolOfNameOrPropertyAccessExpression(name) { + if (ts6.isDeclarationName(name)) { + return getSymbolOfNode(name.parent); + } + if (ts6.isInJSFile(name) && name.parent.kind === 208 && name.parent === name.parent.parent.left) { + if (!ts6.isPrivateIdentifier(name) && !ts6.isJSDocMemberName(name)) { + var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; + } + } + } + if (name.parent.kind === 274 && ts6.isEntityNameExpression(name)) { + var success = resolveEntityName( + name, + /*all meanings*/ + 111551 | 788968 | 1920 | 2097152, + /*ignoreErrors*/ + true + ); + if (success && success !== unknownSymbol) { + return success; + } + } else if (ts6.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { + var importEqualsDeclaration = ts6.getAncestor( + name, + 268 + /* SyntaxKind.ImportEqualsDeclaration */ + ); + ts6.Debug.assert(importEqualsDeclaration !== void 0); + return getSymbolOfPartOfRightHandSideOfImportEquals( + name, + /*dontResolveAlias*/ + true + ); + } + if (ts6.isEntityName(name)) { + var possibleImportNode = isImportTypeQualifierPart(name); + if (possibleImportNode) { + getTypeFromTypeNode(possibleImportNode); + var sym = getNodeLinks(name).resolvedSymbol; + return sym === unknownSymbol ? void 0 : sym; + } + } + while (ts6.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) { + name = name.parent; + } + if (isHeritageClauseElementIdentifier(name)) { + var meaning = 0; + if (name.parent.kind === 230) { + meaning = 788968; + if (ts6.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { + meaning |= 111551; + } + } else { + meaning = 1920; + } + meaning |= 2097152; + var entityNameSymbol = ts6.isEntityNameExpression(name) ? resolveEntityName(name, meaning) : void 0; + if (entityNameSymbol) { + return entityNameSymbol; + } + } + if (name.parent.kind === 343) { + return ts6.getParameterSymbolFromJSDoc(name.parent); + } + if (name.parent.kind === 165 && name.parent.parent.kind === 347) { + ts6.Debug.assert(!ts6.isInJSFile(name)); + var typeParameter = ts6.getTypeParameterFromJsDoc(name.parent); + return typeParameter && typeParameter.symbol; + } + if (ts6.isExpressionNode(name)) { + if (ts6.nodeIsMissing(name)) { + return void 0; + } + var isJSDoc_1 = ts6.findAncestor(name, ts6.or(ts6.isJSDocLinkLike, ts6.isJSDocNameReference, ts6.isJSDocMemberName)); + var meaning = isJSDoc_1 ? 788968 | 1920 | 111551 : 111551; + if (name.kind === 79) { + if (ts6.isJSXTagName(name) && isJsxIntrinsicIdentifier(name)) { + var symbol = getIntrinsicTagSymbol(name.parent); + return symbol === unknownSymbol ? void 0 : symbol; + } + var result = resolveEntityName( + name, + meaning, + /*ignoreErrors*/ + false, + /* dontResolveAlias */ + true, + ts6.getHostSignatureFromJSDoc(name) + ); + if (!result && isJSDoc_1) { + var container = ts6.findAncestor(name, ts6.or(ts6.isClassLike, ts6.isInterfaceDeclaration)); + if (container) { + return resolveJSDocMemberName( + name, + /*ignoreErrors*/ + false, + getSymbolOfNode(container) + ); + } + } + if (result && isJSDoc_1) { + var container = ts6.getJSDocHost(name); + if (container && ts6.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName( + name, + meaning, + /*ignoreErrors*/ + true, + /* dontResolveAlias */ + true, + ts6.getSourceFileOfNode(container) + ) || result; + } + } + return result; + } else if (ts6.isPrivateIdentifier(name)) { + return getSymbolForPrivateIdentifierExpression(name); + } else if (name.kind === 208 || name.kind === 163) { + var links = getNodeLinks(name); + if (links.resolvedSymbol) { + return links.resolvedSymbol; + } + if (name.kind === 208) { + checkPropertyAccessExpression( + name, + 0 + /* CheckMode.Normal */ + ); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get( + "__index" + /* InternalSymbolName.Index */ + ); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts6.mapDefined(infos, function(i) { + return i.declaration; + }); + var nodeListId = ts6.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts6.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } else { + var copy = createSymbol( + 131072, + "__index" + /* InternalSymbolName.Index */ + ); + copy.declarations = ts6.mapDefined(infos, function(i) { + return i.declaration; + }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } + } else { + checkQualifiedName( + name, + 0 + /* CheckMode.Normal */ + ); + } + if (!links.resolvedSymbol && isJSDoc_1 && ts6.isQualifiedName(name)) { + return resolveJSDocMemberName(name); + } + return links.resolvedSymbol; + } else if (ts6.isJSDocMemberName(name)) { + return resolveJSDocMemberName(name); + } + } else if (isTypeReferenceIdentifier(name)) { + var meaning = name.parent.kind === 180 ? 788968 : 1920; + var symbol = resolveEntityName( + name, + meaning, + /*ignoreErrors*/ + false, + /*dontResolveAlias*/ + true + ); + return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); + } + if (name.parent.kind === 179) { + return resolveEntityName( + name, + /*meaning*/ + 1 + /* SymbolFlags.FunctionScopedVariable */ + ); + } + return void 0; + } + function resolveJSDocMemberName(name, ignoreErrors, container) { + if (ts6.isEntityName(name)) { + var meaning = 788968 | 1920 | 111551; + var symbol = resolveEntityName( + name, + meaning, + ignoreErrors, + /*dontResolveAlias*/ + true, + ts6.getHostSignatureFromJSDoc(name) + ); + if (!symbol && ts6.isIdentifier(name) && container) { + symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning)); + } + if (symbol) { + return symbol; + } + } + var left = ts6.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container); + var right = ts6.isIdentifier(name) ? name.escapedText : name.right.escapedText; + if (left) { + var proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype"); + var t = proto ? getTypeOfSymbol(proto) : getDeclaredTypeOfSymbol(left); + return getPropertyOfType(t, right); + } + } + function getSymbolAtLocation(node, ignoreErrors) { + if (node.kind === 308) { + return ts6.isExternalModule(node) ? getMergedSymbol(node.symbol) : void 0; + } + var parent = node.parent; + var grandParent = parent.parent; + if (node.flags & 33554432) { + return void 0; + } + if (isDeclarationNameOrImportPropertyName(node)) { + var parentSymbol = getSymbolOfNode(parent); + return ts6.isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node ? getImmediateAliasedSymbol(parentSymbol) : parentSymbol; + } else if (ts6.isLiteralComputedPropertyDeclarationName(node)) { + return getSymbolOfNode(parent.parent); + } + if (node.kind === 79) { + if (isInRightSideOfImportOrExportAssignment(node)) { + return getSymbolOfNameOrPropertyAccessExpression(node); + } else if (parent.kind === 205 && grandParent.kind === 203 && node === parent.propertyName) { + var typeOfPattern = getTypeOfNode(grandParent); + var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); + if (propertyDeclaration) { + return propertyDeclaration; + } + } else if (ts6.isMetaProperty(parent) && parent.name === node) { + if (parent.keywordToken === 103 && ts6.idText(node) === "target") { + return checkNewTargetMetaProperty(parent).symbol; + } + if (parent.keywordToken === 100 && ts6.idText(node) === "meta") { + return getGlobalImportMetaExpressionType().members.get("meta"); + } + return void 0; + } + } + switch (node.kind) { + case 79: + case 80: + case 208: + case 163: + if (!ts6.isThisInTypeQuery(node)) { + return getSymbolOfNameOrPropertyAccessExpression(node); + } + case 108: + var container = ts6.getThisContainer( + node, + /*includeArrowFunctions*/ + false + ); + if (ts6.isFunctionLike(container)) { + var sig = getSignatureFromDeclaration(container); + if (sig.thisParameter) { + return sig.thisParameter; + } + } + if (ts6.isInExpressionContext(node)) { + return checkExpression(node).symbol; + } + case 194: + return getTypeFromThisTypeNode(node).symbol; + case 106: + return checkExpression(node).symbol; + case 135: + var constructorDeclaration = node.parent; + if (constructorDeclaration && constructorDeclaration.kind === 173) { + return constructorDeclaration.parent.symbol; + } + return void 0; + case 10: + case 14: + if (ts6.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts6.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 269 || node.parent.kind === 275) && node.parent.moduleSpecifier === node || (ts6.isInJSFile(node) && ts6.isRequireCall( + node.parent, + /*checkArgumentIsStringLiteralLike*/ + false + ) || ts6.isImportCall(node.parent)) || ts6.isLiteralTypeNode(node.parent) && ts6.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) { + return resolveExternalModuleName(node, node, ignoreErrors); + } + if (ts6.isCallExpression(parent) && ts6.isBindableObjectDefinePropertyCall(parent) && parent.arguments[1] === node) { + return getSymbolOfNode(parent); + } + case 8: + var objectType = ts6.isElementAccessExpression(parent) ? parent.argumentExpression === node ? getTypeOfExpression(parent.expression) : void 0 : ts6.isLiteralTypeNode(parent) && ts6.isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0; + return objectType && getPropertyOfType(objectType, ts6.escapeLeadingUnderscores(node.text)); + case 88: + case 98: + case 38: + case 84: + return getSymbolOfNode(node.parent); + case 202: + return ts6.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : void 0; + case 93: + return ts6.isExportAssignment(node.parent) ? ts6.Debug.checkDefined(node.parent.symbol) : void 0; + case 100: + case 103: + return ts6.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : void 0; + case 233: + return checkExpression(node).symbol; + default: + return void 0; + } + } + function getIndexInfosAtLocation(node) { + if (ts6.isIdentifier(node) && ts6.isPropertyAccessExpression(node.parent) && node.parent.name === node) { + var keyType_1 = getLiteralTypeFromPropertyName(node); + var objectType = getTypeOfExpression(node.parent.expression); + var objectTypes = objectType.flags & 1048576 ? objectType.types : [objectType]; + return ts6.flatMap(objectTypes, function(t) { + return ts6.filter(getIndexInfosOfType(t), function(info) { + return isApplicableIndexType(keyType_1, info.keyType); + }); + }); + } + return void 0; + } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 300) { + return resolveEntityName( + location.name, + 111551 | 2097152 + /* SymbolFlags.Alias */ + ); + } + return void 0; + } + function getExportSpecifierLocalTargetSymbol(node) { + if (ts6.isExportSpecifier(node)) { + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName( + node.propertyName || node.name, + 111551 | 788968 | 1920 | 2097152 + /* SymbolFlags.Alias */ + ); + } else { + return resolveEntityName( + node, + 111551 | 788968 | 1920 | 2097152 + /* SymbolFlags.Alias */ + ); + } + } + function getTypeOfNode(node) { + if (ts6.isSourceFile(node) && !ts6.isExternalModule(node)) { + return errorType; + } + if (node.flags & 33554432) { + return errorType; + } + var classDecl = ts6.tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node); + var classType = classDecl && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(classDecl.class)); + if (ts6.isPartOfTypeNode(node)) { + var typeFromTypeNode = getTypeFromTypeNode(node); + return classType ? getTypeWithThisArgument(typeFromTypeNode, classType.thisType) : typeFromTypeNode; + } + if (ts6.isExpressionNode(node)) { + return getRegularTypeOfExpression(node); + } + if (classType && !classDecl.isImplements) { + var baseType = ts6.firstOrUndefined(getBaseTypes(classType)); + return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; + } + if (ts6.isTypeDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getDeclaredTypeOfSymbol(symbol); + } + if (isTypeDeclarationName(node)) { + var symbol = getSymbolAtLocation(node); + return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; + } + if (ts6.isDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return symbol ? getTypeOfSymbol(symbol) : errorType; + } + if (isDeclarationNameOrImportPropertyName(node)) { + var symbol = getSymbolAtLocation(node); + if (symbol) { + return getTypeOfSymbol(symbol); + } + return errorType; + } + if (ts6.isBindingPattern(node)) { + return getTypeForVariableLikeDeclaration( + node.parent, + /*includeOptionality*/ + true, + 0 + /* CheckMode.Normal */ + ) || errorType; + } + if (isInRightSideOfImportOrExportAssignment(node)) { + var symbol = getSymbolAtLocation(node); + if (symbol) { + var declaredType = getDeclaredTypeOfSymbol(symbol); + return !isErrorType(declaredType) ? declaredType : getTypeOfSymbol(symbol); + } + } + if (ts6.isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) { + return checkMetaPropertyKeyword(node.parent); + } + return errorType; + } + function getTypeOfAssignmentPattern(expr) { + ts6.Debug.assert( + expr.kind === 207 || expr.kind === 206 + /* SyntaxKind.ArrayLiteralExpression */ + ); + if (expr.parent.kind === 247) { + var iteratedType = checkRightHandSideOfForOf(expr.parent); + return checkDestructuringAssignment(expr, iteratedType || errorType); + } + if (expr.parent.kind === 223) { + var iteratedType = getTypeOfExpression(expr.parent.right); + return checkDestructuringAssignment(expr, iteratedType || errorType); + } + if (expr.parent.kind === 299) { + var node_3 = ts6.cast(expr.parent.parent, ts6.isObjectLiteralExpression); + var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; + var propertyIndex = ts6.indexOfNode(node_3.properties, expr.parent); + return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex); + } + var node = ts6.cast(expr.parent, ts6.isArrayLiteralExpression); + var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType; + var elementType = checkIteratedTypeOrElementType(65, typeOfArrayLiteral, undefinedType, expr.parent) || errorType; + return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType); + } + function getPropertySymbolOfDestructuringAssignment(location) { + var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts6.cast(location.parent.parent, ts6.isAssignmentPattern)); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText); + } + function getRegularTypeOfExpression(expr) { + if (ts6.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + expr = expr.parent; + } + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); + } + function getParentTypeOfClassElement(node) { + var classSymbol = getSymbolOfNode(node.parent); + return ts6.isStatic(node) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); + } + function getClassElementPropertyKeyType(element) { + var name = element.name; + switch (name.kind) { + case 79: + return getStringLiteralType(ts6.idText(name)); + case 8: + case 10: + return getStringLiteralType(name.text); + case 164: + var nameType = checkComputedPropertyName(name); + return isTypeAssignableToKind( + nameType, + 12288 + /* TypeFlags.ESSymbolLike */ + ) ? nameType : stringType; + default: + return ts6.Debug.fail("Unsupported property name."); + } + } + function getAugmentedPropertiesOfType(type) { + type = getApparentType(type); + var propsByName = ts6.createSymbolTable(getPropertiesOfType(type)); + var functionType = getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ).length ? globalCallableFunctionType : getSignaturesOfType( + type, + 1 + /* SignatureKind.Construct */ + ).length ? globalNewableFunctionType : void 0; + if (functionType) { + ts6.forEach(getPropertiesOfType(functionType), function(p) { + if (!propsByName.has(p.escapedName)) { + propsByName.set(p.escapedName, p); + } + }); + } + return getNamedMembers(propsByName); + } + function typeHasCallOrConstructSignatures(type) { + return ts6.typeHasCallOrConstructSignatures(type, checker); + } + function getRootSymbols(symbol) { + var roots = getImmediateRootSymbols(symbol); + return roots ? ts6.flatMap(roots, getRootSymbols) : [symbol]; + } + function getImmediateRootSymbols(symbol) { + if (ts6.getCheckFlags(symbol) & 6) { + return ts6.mapDefined(getSymbolLinks(symbol).containingType.types, function(type) { + return getPropertyOfType(type, symbol.escapedName); + }); + } else if (symbol.flags & 33554432) { + var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin; + return leftSpread ? [leftSpread, rightSpread] : syntheticOrigin ? [syntheticOrigin] : ts6.singleElementArray(tryGetTarget(symbol)); + } + return void 0; + } + function tryGetTarget(symbol) { + var target; + var next = symbol; + while (next = getSymbolLinks(next).target) { + target = next; + } + return target; + } + function isArgumentsLocalBinding(nodeIn) { + if (ts6.isGeneratedIdentifier(nodeIn)) + return false; + var node = ts6.getParseTreeNode(nodeIn, ts6.isIdentifier); + if (!node) + return false; + var parent = node.parent; + if (!parent) + return false; + var isPropertyName = (ts6.isPropertyAccessExpression(parent) || ts6.isPropertyAssignment(parent)) && parent.name === node; + return !isPropertyName && getReferencedValueSymbol(node) === argumentsSymbol; + } + function moduleExportsSomeValue(moduleReferenceExpression) { + var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol || ts6.isShorthandAmbientModuleSymbol(moduleSymbol)) { + return true; + } + var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol); + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + var symbolLinks2 = getSymbolLinks(moduleSymbol); + if (symbolLinks2.exportsSomeValue === void 0) { + symbolLinks2.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 111551) : ts6.forEachEntry(getExportsOfModule(moduleSymbol), isValue); + } + return symbolLinks2.exportsSomeValue; + function isValue(s) { + s = resolveSymbol(s); + return s && !!(getAllSymbolFlags(s) & 111551); + } + } + function isNameOfModuleOrEnumDeclaration(node) { + return ts6.isModuleOrEnumDeclaration(node.parent) && node === node.parent.name; + } + function getReferencedExportContainer(nodeIn, prefixLocals) { + var _a; + var node = ts6.getParseTreeNode(nodeIn, ts6.isIdentifier); + if (node) { + var symbol = getReferencedValueSymbol( + node, + /*startInDeclarationContainer*/ + isNameOfModuleOrEnumDeclaration(node) + ); + if (symbol) { + if (symbol.flags & 1048576) { + var exportSymbol = getMergedSymbol(symbol.exportSymbol); + if (!prefixLocals && exportSymbol.flags & 944 && !(exportSymbol.flags & 3)) { + return void 0; + } + symbol = exportSymbol; + } + var parentSymbol_1 = getParentOfSymbol(symbol); + if (parentSymbol_1) { + if (parentSymbol_1.flags & 512 && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308) { + var symbolFile = parentSymbol_1.valueDeclaration; + var referenceFile = ts6.getSourceFileOfNode(node); + var symbolIsUmdExport = symbolFile !== referenceFile; + return symbolIsUmdExport ? void 0 : symbolFile; + } + return ts6.findAncestor(node.parent, function(n) { + return ts6.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; + }); + } + } + } + } + function getReferencedImportDeclaration(nodeIn) { + if (nodeIn.generatedImportReference) { + return nodeIn.generatedImportReference; + } + var node = ts6.getParseTreeNode(nodeIn, ts6.isIdentifier); + if (node) { + var symbol = getReferencedValueOrAliasSymbol(node); + if (isNonLocalAlias( + symbol, + /*excludes*/ + 111551 + /* SymbolFlags.Value */ + ) && !getTypeOnlyAliasDeclaration( + symbol, + 111551 + /* SymbolFlags.Value */ + )) { + return getDeclarationOfAliasSymbol(symbol); + } + } + return void 0; + } + function isSymbolOfDestructuredElementOfCatchBinding(symbol) { + return symbol.valueDeclaration && ts6.isBindingElement(symbol.valueDeclaration) && ts6.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295; + } + function isSymbolOfDeclarationWithCollidingName(symbol) { + if (symbol.flags & 418 && symbol.valueDeclaration && !ts6.isSourceFile(symbol.valueDeclaration)) { + var links = getSymbolLinks(symbol); + if (links.isDeclarationWithCollidingName === void 0) { + var container = ts6.getEnclosingBlockScopeContainer(symbol.valueDeclaration); + if (ts6.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) { + var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); + if (resolveName( + container.parent, + symbol.escapedName, + 111551, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + )) { + links.isDeclarationWithCollidingName = true; + } else if (nodeLinks_1.flags & 262144) { + var isDeclaredInLoop = nodeLinks_1.flags & 524288; + var inLoopInitializer = ts6.isIterationStatement( + container, + /*lookInLabeledStatements*/ + false + ); + var inLoopBodyBlock = container.kind === 238 && ts6.isIterationStatement( + container.parent, + /*lookInLabeledStatements*/ + false + ); + links.isDeclarationWithCollidingName = !ts6.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || !inLoopInitializer && !inLoopBodyBlock); + } else { + links.isDeclarationWithCollidingName = false; + } + } + } + return links.isDeclarationWithCollidingName; + } + return false; + } + function getReferencedDeclarationWithCollidingName(nodeIn) { + if (!ts6.isGeneratedIdentifier(nodeIn)) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isIdentifier); + if (node) { + var symbol = getReferencedValueSymbol(node); + if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) { + return symbol.valueDeclaration; + } + } + } + return void 0; + } + function isDeclarationWithCollidingName(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isDeclaration); + if (node) { + var symbol = getSymbolOfNode(node); + if (symbol) { + return isSymbolOfDeclarationWithCollidingName(symbol); + } + } + return false; + } + function isValueAliasDeclaration(node) { + switch (node.kind) { + case 268: + return isAliasResolvedToValue(getSymbolOfNode(node)); + case 270: + case 271: + case 273: + case 278: + var symbol = getSymbolOfNode(node); + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration( + symbol, + 111551 + /* SymbolFlags.Value */ + ); + case 275: + var exportClause = node.exportClause; + return !!exportClause && (ts6.isNamespaceExport(exportClause) || ts6.some(exportClause.elements, isValueAliasDeclaration)); + case 274: + return node.expression && node.expression.kind === 79 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + } + return false; + } + function isTopLevelValueImportEqualsWithEntityName(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isImportEqualsDeclaration); + if (node === void 0 || node.parent.kind !== 308 || !ts6.isInternalModuleImportEqualsDeclaration(node)) { + return false; + } + var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + return isValue && node.moduleReference && !ts6.nodeIsMissing(node.moduleReference); + } + function isAliasResolvedToValue(symbol) { + var _a; + if (!symbol) { + return false; + } + var target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol)); + if (target === unknownSymbol) { + return true; + } + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551) && (ts6.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || !!s.constEnumOnlyModule; + } + function isReferencedAliasDeclaration(node, checkChildren) { + if (isAliasSymbolDeclaration(node)) { + var symbol = getSymbolOfNode(node); + var links = symbol && getSymbolLinks(symbol); + if (links === null || links === void 0 ? void 0 : links.referenced) { + return true; + } + var target = getSymbolLinks(symbol).aliasTarget; + if (target && ts6.getEffectiveModifierFlags(node) & 1 && getAllSymbolFlags(target) & 111551 && (ts6.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { + return true; + } + } + if (checkChildren) { + return !!ts6.forEachChild(node, function(node2) { + return isReferencedAliasDeclaration(node2, checkChildren); + }); + } + return false; + } + function isImplementationOfOverload(node) { + if (ts6.nodeIsPresent(node.body)) { + if (ts6.isGetAccessor(node) || ts6.isSetAccessor(node)) + return false; + var symbol = getSymbolOfNode(node); + var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + return signaturesOfSymbol.length > 1 || // If there is single signature for the symbol, it is overload if that signature isn't coming from the node + // e.g.: function foo(a: string): string; + // function foo(a: any) { // This is implementation of the overloads + // return a; + // } + signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node; + } + return false; + } + function isRequiredInitializedParameter(parameter) { + return !!strictNullChecks && !isOptionalParameter(parameter) && !ts6.isJSDocParameterTag(parameter) && !!parameter.initializer && !ts6.hasSyntacticModifier( + parameter, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + ); + } + function isOptionalUninitializedParameterProperty(parameter) { + return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && ts6.hasSyntacticModifier( + parameter, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + ); + } + function isExpandoFunctionDeclaration(node) { + var declaration = ts6.getParseTreeNode(node, ts6.isFunctionDeclaration); + if (!declaration) { + return false; + } + var symbol = getSymbolOfNode(declaration); + if (!symbol || !(symbol.flags & 16)) { + return false; + } + return !!ts6.forEachEntry(getExportsOfSymbol(symbol), function(p) { + return p.flags & 111551 && p.valueDeclaration && ts6.isPropertyAccessExpression(p.valueDeclaration); + }); + } + function getPropertiesOfContainerFunction(node) { + var declaration = ts6.getParseTreeNode(node, ts6.isFunctionDeclaration); + if (!declaration) { + return ts6.emptyArray; + } + var symbol = getSymbolOfNode(declaration); + return symbol && getPropertiesOfType(getTypeOfSymbol(symbol)) || ts6.emptyArray; + } + function getNodeCheckFlags(node) { + var _a; + var nodeId = node.id || 0; + if (nodeId < 0 || nodeId >= nodeLinks.length) + return 0; + return ((_a = nodeLinks[nodeId]) === null || _a === void 0 ? void 0 : _a.flags) || 0; + } + function getEnumMemberValue(node) { + computeEnumMemberValues(node.parent); + return getNodeLinks(node).enumMemberValue; + } + function canHaveConstantValue(node) { + switch (node.kind) { + case 302: + case 208: + case 209: + return true; + } + return false; + } + function getConstantValue(node) { + if (node.kind === 302) { + return getEnumMemberValue(node); + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && symbol.flags & 8) { + var member = symbol.valueDeclaration; + if (ts6.isEnumConst(member.parent)) { + return getEnumMemberValue(member); + } + } + return void 0; + } + function isFunctionType(type) { + return !!(type.flags & 524288) && getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ).length > 0; + } + function getTypeReferenceSerializationKind(typeNameIn, location) { + var _a, _b; + var typeName = ts6.getParseTreeNode(typeNameIn, ts6.isEntityName); + if (!typeName) + return ts6.TypeReferenceSerializationKind.Unknown; + if (location) { + location = ts6.getParseTreeNode(location); + if (!location) + return ts6.TypeReferenceSerializationKind.Unknown; + } + var isTypeOnly = false; + if (ts6.isQualifiedName(typeName)) { + var rootValueSymbol = resolveEntityName( + ts6.getFirstIdentifier(typeName), + 111551, + /*ignoreErrors*/ + true, + /*dontResolveAlias*/ + true, + location + ); + isTypeOnly = !!((_a = rootValueSymbol === null || rootValueSymbol === void 0 ? void 0 : rootValueSymbol.declarations) === null || _a === void 0 ? void 0 : _a.every(ts6.isTypeOnlyImportOrExportDeclaration)); + } + var valueSymbol = resolveEntityName( + typeName, + 111551, + /*ignoreErrors*/ + true, + /*dontResolveAlias*/ + true, + location + ); + var resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 ? resolveAlias(valueSymbol) : valueSymbol; + isTypeOnly || (isTypeOnly = !!((_b = valueSymbol === null || valueSymbol === void 0 ? void 0 : valueSymbol.declarations) === null || _b === void 0 ? void 0 : _b.every(ts6.isTypeOnlyImportOrExportDeclaration))); + var typeSymbol = resolveEntityName( + typeName, + 788968, + /*ignoreErrors*/ + true, + /*dontResolveAlias*/ + false, + location + ); + if (resolvedSymbol && resolvedSymbol === typeSymbol) { + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol( + /*reportErrors*/ + false + ); + if (globalPromiseSymbol && resolvedSymbol === globalPromiseSymbol) { + return ts6.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(resolvedSymbol); + if (constructorType && isConstructorType(constructorType)) { + return isTypeOnly ? ts6.TypeReferenceSerializationKind.TypeWithCallSignature : ts6.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } + if (!typeSymbol) { + return isTypeOnly ? ts6.TypeReferenceSerializationKind.ObjectType : ts6.TypeReferenceSerializationKind.Unknown; + } + var type = getDeclaredTypeOfSymbol(typeSymbol); + if (isErrorType(type)) { + return isTypeOnly ? ts6.TypeReferenceSerializationKind.ObjectType : ts6.TypeReferenceSerializationKind.Unknown; + } else if (type.flags & 3) { + return ts6.TypeReferenceSerializationKind.ObjectType; + } else if (isTypeAssignableToKind( + type, + 16384 | 98304 | 131072 + /* TypeFlags.Never */ + )) { + return ts6.TypeReferenceSerializationKind.VoidNullableOrNeverType; + } else if (isTypeAssignableToKind( + type, + 528 + /* TypeFlags.BooleanLike */ + )) { + return ts6.TypeReferenceSerializationKind.BooleanType; + } else if (isTypeAssignableToKind( + type, + 296 + /* TypeFlags.NumberLike */ + )) { + return ts6.TypeReferenceSerializationKind.NumberLikeType; + } else if (isTypeAssignableToKind( + type, + 2112 + /* TypeFlags.BigIntLike */ + )) { + return ts6.TypeReferenceSerializationKind.BigIntLikeType; + } else if (isTypeAssignableToKind( + type, + 402653316 + /* TypeFlags.StringLike */ + )) { + return ts6.TypeReferenceSerializationKind.StringLikeType; + } else if (isTupleType(type)) { + return ts6.TypeReferenceSerializationKind.ArrayLikeType; + } else if (isTypeAssignableToKind( + type, + 12288 + /* TypeFlags.ESSymbolLike */ + )) { + return ts6.TypeReferenceSerializationKind.ESSymbolType; + } else if (isFunctionType(type)) { + return ts6.TypeReferenceSerializationKind.TypeWithCallSignature; + } else if (isArrayType(type)) { + return ts6.TypeReferenceSerializationKind.ArrayLikeType; + } else { + return ts6.TypeReferenceSerializationKind.ObjectType; + } + } + function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { + var declaration = ts6.getParseTreeNode(declarationIn, ts6.isVariableLikeOrAccessor); + if (!declaration) { + return ts6.factory.createToken( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + var symbol = getSymbolOfNode(declaration); + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType; + if (type.flags & 8192 && type.symbol === symbol) { + flags |= 1048576; + } + if (addUndefined) { + type = getOptionalType(type); + } + return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker); + } + function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { + var signatureDeclaration = ts6.getParseTreeNode(signatureDeclarationIn, ts6.isFunctionLike); + if (!signatureDeclaration) { + return ts6.factory.createToken( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + var signature = getSignatureFromDeclaration(signatureDeclaration); + return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024, tracker); + } + function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { + var expr = ts6.getParseTreeNode(exprIn, ts6.isExpression); + if (!expr) { + return ts6.factory.createToken( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + var type = getWidenedType(getRegularTypeOfExpression(expr)); + return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker); + } + function hasGlobalName(name) { + return globals.has(ts6.escapeLeadingUnderscores(name)); + } + function getReferencedValueSymbol(reference, startInDeclarationContainer) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol) { + return resolvedSymbol; + } + var location = reference; + if (startInDeclarationContainer) { + var parent = reference.parent; + if (ts6.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); + } + } + return resolveName( + location, + reference.escapedText, + 111551 | 1048576 | 2097152, + /*nodeNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + true + ); + } + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName( + reference, + reference.escapedText, + 111551 | 1048576 | 2097152, + /*nodeNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + true, + /*excludeGlobals*/ + void 0, + /*getSpellingSuggestions*/ + void 0 + ); + } + function getReferencedValueDeclaration(referenceIn) { + if (!ts6.isGeneratedIdentifier(referenceIn)) { + var reference = ts6.getParseTreeNode(referenceIn, ts6.isIdentifier); + if (reference) { + var symbol = getReferencedValueSymbol(reference); + if (symbol) { + return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } + } + } + return void 0; + } + function isLiteralConstDeclaration(node) { + if (ts6.isDeclarationReadonly(node) || ts6.isVariableDeclaration(node) && ts6.isVarConst(node)) { + return isFreshLiteralType(getTypeOfSymbol(getSymbolOfNode(node))); + } + return false; + } + function literalTypeToNode(type, enclosing, tracker) { + var enumResult = type.flags & 1024 ? nodeBuilder.symbolToExpression( + type.symbol, + 111551, + enclosing, + /*flags*/ + void 0, + tracker + ) : type === trueType ? ts6.factory.createTrue() : type === falseType && ts6.factory.createFalse(); + if (enumResult) + return enumResult; + var literalValue = type.value; + return typeof literalValue === "object" ? ts6.factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? ts6.factory.createNumericLiteral(literalValue) : ts6.factory.createStringLiteral(literalValue); + } + function createLiteralConstValue(node, tracker) { + var type = getTypeOfSymbol(getSymbolOfNode(node)); + return literalTypeToNode(type, node, tracker); + } + function getJsxFactoryEntity(location) { + return location ? (getJsxNamespace(location), ts6.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity) : _jsxFactoryEntity; + } + function getJsxFragmentFactoryEntity(location) { + if (location) { + var file = ts6.getSourceFileOfNode(location); + if (file) { + if (file.localJsxFragmentFactory) { + return file.localJsxFragmentFactory; + } + var jsxFragPragmas = file.pragmas.get("jsxfrag"); + var jsxFragPragma = ts6.isArray(jsxFragPragmas) ? jsxFragPragmas[0] : jsxFragPragmas; + if (jsxFragPragma) { + file.localJsxFragmentFactory = ts6.parseIsolatedEntityName(jsxFragPragma.arguments.factory, languageVersion); + return file.localJsxFragmentFactory; + } + } + } + if (compilerOptions.jsxFragmentFactory) { + return ts6.parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion); + } + } + function createResolver() { + var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + var fileToDirective; + if (resolvedTypeReferenceDirectives) { + fileToDirective = new ts6.Map(); + resolvedTypeReferenceDirectives.forEach(function(resolvedDirective, key, mode) { + if (!resolvedDirective || !resolvedDirective.resolvedFileName) { + return; + } + var file = host.getSourceFile(resolvedDirective.resolvedFileName); + if (file) { + addReferencedFilesToTypeDirective(file, key, mode); + } + }); + } + return { + getReferencedExportContainer, + getReferencedImportDeclaration, + getReferencedDeclarationWithCollidingName, + isDeclarationWithCollidingName, + isValueAliasDeclaration: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? isValueAliasDeclaration(node) : true; + }, + hasGlobalName, + isReferencedAliasDeclaration: function(nodeIn, checkChildren) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn); + return node ? getNodeCheckFlags(node) : 0; + }, + isTopLevelValueImportEqualsWithEntityName, + isDeclarationVisible, + isImplementationOfOverload, + isRequiredInitializedParameter, + isOptionalUninitializedParameterProperty, + isExpandoFunctionDeclaration, + getPropertiesOfContainerFunction, + createTypeOfDeclaration, + createReturnTypeOfSignatureDeclaration, + createTypeOfExpression, + createLiteralConstValue, + isSymbolAccessible, + isEntityNameVisible, + getConstantValue: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, canHaveConstantValue); + return node ? getConstantValue(node) : void 0; + }, + collectLinkedAliases, + getReferencedValueDeclaration, + getTypeReferenceSerializationKind, + isOptionalParameter, + moduleExportsSomeValue, + isArgumentsLocalBinding, + getExternalModuleFileFromDeclaration: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.hasPossibleExternalModuleReference); + return node && getExternalModuleFileFromDeclaration(node); + }, + getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol, + isLiteralConstDeclaration, + isLateBound: function(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isDeclaration); + var symbol = node && getSymbolOfNode(node); + return !!(symbol && ts6.getCheckFlags(symbol) & 4096); + }, + getJsxFactoryEntity, + getJsxFragmentFactoryEntity, + getAllAccessorDeclarations: function(accessor) { + accessor = ts6.getParseTreeNode(accessor, ts6.isGetOrSetAccessorDeclaration); + var otherKind = accessor.kind === 175 ? 174 : 175; + var otherAccessor = ts6.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); + var firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor; + var secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 ? accessor : otherAccessor; + return { + firstAccessor, + secondAccessor, + setAccessor, + getAccessor + }; + }, + getSymbolOfExternalModuleSpecifier: function(moduleName) { + return resolveExternalModuleNameWorker( + moduleName, + moduleName, + /*moduleNotFoundError*/ + void 0 + ); + }, + isBindingCapturedByNode: function(node, decl) { + var parseNode = ts6.getParseTreeNode(node); + var parseDecl = ts6.getParseTreeNode(decl); + return !!parseNode && !!parseDecl && (ts6.isVariableDeclaration(parseDecl) || ts6.isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl); + }, + getDeclarationStatementsForSourceFile: function(node, flags, tracker, bundled) { + var n = ts6.getParseTreeNode(node); + ts6.Debug.assert(n && n.kind === 308, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + var sym = getSymbolOfNode(node); + if (!sym) { + return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); + } + return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled); + }, + isImportRequiredByAugmentation + }; + function isImportRequiredByAugmentation(node) { + var file = ts6.getSourceFileOfNode(node); + if (!file.symbol) + return false; + var importTarget = getExternalModuleFileFromDeclaration(node); + if (!importTarget) + return false; + if (importTarget === file) + return false; + var exports2 = getExportsOfModule(file.symbol); + for (var _i = 0, _a = ts6.arrayFrom(exports2.values()); _i < _a.length; _i++) { + var s = _a[_i]; + if (s.mergeId) { + var merged = getMergedSymbol(s); + if (merged.declarations) { + for (var _b = 0, _c = merged.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declFile = ts6.getSourceFileOfNode(d); + if (declFile === importTarget) { + return true; + } + } + } + } + } + return false; + } + function isInHeritageClause(node) { + return node.parent && node.parent.kind === 230 && node.parent.parent && node.parent.parent.kind === 294; + } + function getTypeReferenceDirectivesForEntityName(node) { + if (!fileToDirective) { + return void 0; + } + var meaning; + if (node.parent.kind === 164) { + meaning = 111551 | 1048576; + } else { + meaning = 788968 | 1920; + if (node.kind === 79 && isInTypeQuery(node) || node.kind === 208 && !isInHeritageClause(node)) { + meaning = 111551 | 1048576; + } + } + var symbol = resolveEntityName( + node, + meaning, + /*ignoreErrors*/ + true + ); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0; + } + function getTypeReferenceDirectivesForSymbol(symbol, meaning) { + if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) { + return void 0; + } + var typeReferenceDirectives; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.symbol && decl.symbol.flags & meaning) { + var file = ts6.getSourceFileOfNode(decl); + var typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } else { + return void 0; + } + } + } + return typeReferenceDirectives; + } + function isSymbolFromTypeDeclarationFile(symbol) { + if (!symbol.declarations) { + return false; + } + var current = symbol; + while (true) { + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; + } else { + break; + } + } + if (current.valueDeclaration && current.valueDeclaration.kind === 308 && current.flags & 512) { + return false; + } + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var file = ts6.getSourceFileOfNode(decl); + if (fileToDirective.has(file.path)) { + return true; + } + } + return false; + } + function addReferencedFilesToTypeDirective(file, key, mode) { + if (fileToDirective.has(file.path)) + return; + fileToDirective.set(file.path, [key, mode]); + for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) { + var _b = _a[_i], fileName = _b.fileName, resolutionMode = _b.resolutionMode; + var resolvedFile = ts6.resolveTripleslashReference(fileName, file.fileName); + var referencedFile = host.getSourceFile(resolvedFile); + if (referencedFile) { + addReferencedFilesToTypeDirective(referencedFile, key, resolutionMode || file.impliedNodeFormat); + } + } + } + } + function getExternalModuleFileFromDeclaration(declaration) { + var specifier = declaration.kind === 264 ? ts6.tryCast(declaration.name, ts6.isStringLiteral) : ts6.getExternalModuleName(declaration); + var moduleSymbol = resolveExternalModuleNameWorker( + specifier, + specifier, + /*moduleNotFoundError*/ + void 0 + ); + if (!moduleSymbol) { + return void 0; + } + return ts6.getDeclarationOfKind( + moduleSymbol, + 308 + /* SyntaxKind.SourceFile */ + ); + } + function initializeTypeChecker() { + for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { + var file = _a[_i]; + ts6.bindSourceFile(file, compilerOptions); + } + amalgamatedDuplicates = new ts6.Map(); + var augmentations; + for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { + var file = _c[_b]; + if (file.redirectInfo) { + continue; + } + if (!ts6.isExternalOrCommonJsModule(file)) { + var fileGlobalThisSymbol = file.locals.get("globalThis"); + if (fileGlobalThisSymbol === null || fileGlobalThisSymbol === void 0 ? void 0 : fileGlobalThisSymbol.declarations) { + for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) { + var declaration = _e[_d]; + diagnostics.add(ts6.createDiagnosticForNode(declaration, ts6.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis")); + } + } + mergeSymbolTable(globals, file.locals); + } + if (file.jsGlobalAugmentations) { + mergeSymbolTable(globals, file.jsGlobalAugmentations); + } + if (file.patternAmbientModules && file.patternAmbientModules.length) { + patternAmbientModules = ts6.concatenate(patternAmbientModules, file.patternAmbientModules); + } + if (file.moduleAugmentations.length) { + (augmentations || (augmentations = [])).push(file.moduleAugmentations); + } + if (file.symbol && file.symbol.globalExports) { + var source = file.symbol.globalExports; + source.forEach(function(sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); + } + }); + } + } + if (augmentations) { + for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) { + var list = augmentations_1[_f]; + for (var _g = 0, list_1 = list; _g < list_1.length; _g++) { + var augmentation = list_1[_g]; + if (!ts6.isGlobalScopeAugmentation(augmentation.parent)) + continue; + mergeModuleAugmentation(augmentation); + } + } + } + addToSymbolTable(globals, builtinGlobals, ts6.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); + getSymbolLinks(undefinedSymbol).type = undefinedWideningType; + getSymbolLinks(argumentsSymbol).type = getGlobalType( + "IArguments", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + getSymbolLinks(unknownSymbol).type = errorType; + getSymbolLinks(globalThisSymbol).type = createObjectType(16, globalThisSymbol); + globalArrayType = getGlobalType( + "Array", + /*arity*/ + 1, + /*reportErrors*/ + true + ); + globalObjectType = getGlobalType( + "Object", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + globalFunctionType = getGlobalType( + "Function", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + globalCallableFunctionType = strictBindCallApply && getGlobalType( + "CallableFunction", + /*arity*/ + 0, + /*reportErrors*/ + true + ) || globalFunctionType; + globalNewableFunctionType = strictBindCallApply && getGlobalType( + "NewableFunction", + /*arity*/ + 0, + /*reportErrors*/ + true + ) || globalFunctionType; + globalStringType = getGlobalType( + "String", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + globalNumberType = getGlobalType( + "Number", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + globalBooleanType = getGlobalType( + "Boolean", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + globalRegExpType = getGlobalType( + "RegExp", + /*arity*/ + 0, + /*reportErrors*/ + true + ); + anyArrayType = createArrayType(anyType); + autoArrayType = createArrayType(autoType); + if (autoArrayType === emptyObjectType) { + autoArrayType = createAnonymousType(void 0, emptySymbols, ts6.emptyArray, ts6.emptyArray, ts6.emptyArray); + } + globalReadonlyArrayType = getGlobalTypeOrUndefined( + "ReadonlyArray", + /*arity*/ + 1 + ) || globalArrayType; + anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; + globalThisType = getGlobalTypeOrUndefined( + "ThisType", + /*arity*/ + 1 + ); + if (augmentations) { + for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) { + var list = augmentations_2[_h]; + for (var _j = 0, list_2 = list; _j < list_2.length; _j++) { + var augmentation = list_2[_j]; + if (ts6.isGlobalScopeAugmentation(augmentation.parent)) + continue; + mergeModuleAugmentation(augmentation); + } + } + } + amalgamatedDuplicates.forEach(function(_a2) { + var firstFile = _a2.firstFile, secondFile = _a2.secondFile, conflictingSymbols = _a2.conflictingSymbols; + if (conflictingSymbols.size < 8) { + conflictingSymbols.forEach(function(_a3, symbolName) { + var isBlockScoped = _a3.isBlockScoped, firstFileLocations = _a3.firstFileLocations, secondFileLocations = _a3.secondFileLocations; + var message = isBlockScoped ? ts6.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts6.Diagnostics.Duplicate_identifier_0; + for (var _i2 = 0, firstFileLocations_1 = firstFileLocations; _i2 < firstFileLocations_1.length; _i2++) { + var node = firstFileLocations_1[_i2]; + addDuplicateDeclarationError(node, message, symbolName, secondFileLocations); + } + for (var _b2 = 0, secondFileLocations_1 = secondFileLocations; _b2 < secondFileLocations_1.length; _b2++) { + var node = secondFileLocations_1[_b2]; + addDuplicateDeclarationError(node, message, symbolName, firstFileLocations); + } + }); + } else { + var list2 = ts6.arrayFrom(conflictingSymbols.keys()).join(", "); + diagnostics.add(ts6.addRelatedInfo(ts6.createDiagnosticForNode(firstFile, ts6.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list2), ts6.createDiagnosticForNode(secondFile, ts6.Diagnostics.Conflicts_are_in_this_file))); + diagnostics.add(ts6.addRelatedInfo(ts6.createDiagnosticForNode(secondFile, ts6.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list2), ts6.createDiagnosticForNode(firstFile, ts6.Diagnostics.Conflicts_are_in_this_file))); + } + }); + amalgamatedDuplicates = void 0; + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts6.getSourceFileOfNode(location); + if (ts6.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 4194304; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name = getHelperName(helper); + var symbol = getSymbol( + helpersModule.exports, + ts6.escapeLeadingUnderscores(name), + 111551 + /* SymbolFlags.Value */ + ); + if (!symbol) { + error(location, ts6.Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, ts6.externalHelpersModuleNameText, name); + } else if (helper & 524288) { + if (!ts6.some(getSignaturesOfSymbol(symbol), function(signature) { + return getParameterCount(signature) > 3; + })) { + error(location, ts6.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, ts6.externalHelpersModuleNameText, name, 4); + } + } else if (helper & 1048576) { + if (!ts6.some(getSignaturesOfSymbol(symbol), function(signature) { + return getParameterCount(signature) > 4; + })) { + error(location, ts6.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, ts6.externalHelpersModuleNameText, name, 5); + } + } else if (helper & 1024) { + if (!ts6.some(getSignaturesOfSymbol(symbol), function(signature) { + return getParameterCount(signature) > 2; + })) { + error(location, ts6.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, ts6.externalHelpersModuleNameText, name, 3); + } + } + } + } + } + requestedExternalEmitHelpers |= helpers; + } + } + } + function getHelperName(helper) { + switch (helper) { + case 1: + return "__extends"; + case 2: + return "__assign"; + case 4: + return "__rest"; + case 8: + return "__decorate"; + case 16: + return "__metadata"; + case 32: + return "__param"; + case 64: + return "__awaiter"; + case 128: + return "__generator"; + case 256: + return "__values"; + case 512: + return "__read"; + case 1024: + return "__spreadArray"; + case 2048: + return "__await"; + case 4096: + return "__asyncGenerator"; + case 8192: + return "__asyncDelegator"; + case 16384: + return "__asyncValues"; + case 32768: + return "__exportStar"; + case 65536: + return "__importStar"; + case 131072: + return "__importDefault"; + case 262144: + return "__makeTemplateObject"; + case 524288: + return "__classPrivateFieldGet"; + case 1048576: + return "__classPrivateFieldSet"; + case 2097152: + return "__classPrivateFieldIn"; + case 4194304: + return "__createBinding"; + default: + return ts6.Debug.fail("Unrecognized helper"); + } + } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts6.externalHelpersModuleNameText, ts6.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } + function checkGrammarDecoratorsAndModifiers(node) { + return checkGrammarDecorators(node) || checkGrammarModifiers(node); + } + function checkGrammarDecorators(node) { + if (ts6.canHaveIllegalDecorators(node) && ts6.some(node.illegalDecorators)) { + return grammarErrorOnFirstToken(node, ts6.Diagnostics.Decorators_are_not_valid_here); + } + if (!ts6.canHaveDecorators(node) || !ts6.hasDecorators(node)) { + return false; + } + if (!ts6.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { + if (node.kind === 171 && !ts6.nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, ts6.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } else { + return grammarErrorOnFirstToken(node, ts6.Diagnostics.Decorators_are_not_valid_here); + } + } else if (node.kind === 174 || node.kind === 175) { + var accessors = ts6.getAllAccessorDeclarations(node.parent.members, node); + if (ts6.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { + return grammarErrorOnFirstToken(node, ts6.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); + } + } + return false; + } + function checkGrammarModifiers(node) { + var quickResult = reportObviousModifierErrors(node); + if (quickResult !== void 0) { + return quickResult; + } + var lastStatic, lastDeclare, lastAsync, lastOverride; + var flags = 0; + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; + if (ts6.isDecorator(modifier)) + continue; + if (modifier.kind !== 146) { + if (node.kind === 168 || node.kind === 170) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts6.tokenToString(modifier.kind)); + } + if (node.kind === 178 && (modifier.kind !== 124 || !ts6.isClassLike(node.parent))) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts6.tokenToString(modifier.kind)); + } + } + if (modifier.kind !== 101 && modifier.kind !== 145) { + if (node.kind === 165) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts6.tokenToString(modifier.kind)); + } + } + switch (modifier.kind) { + case 85: + if (node.kind !== 263) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts6.tokenToString( + 85 + /* SyntaxKind.ConstKeyword */ + )); + } + break; + case 161: + if (flags & 16384) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "override"); + } else if (flags & 2) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare"); + } else if (flags & 64) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); + } else if (flags & 128) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } else if (flags & 512) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); + } + flags |= 16384; + lastOverride = modifier; + break; + case 123: + case 122: + case 121: + var text = visibilityToString(ts6.modifierToFlag(modifier.kind)); + if (flags & 28) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.Accessibility_modifier_already_seen); + } else if (flags & 16384) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, text, "override"); + } else if (flags & 32) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } else if (flags & 128) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } else if (flags & 512) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); + } else if (node.parent.kind === 265 || node.parent.kind === 308) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); + } else if (flags & 256) { + if (modifier.kind === 121) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); + } else { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); + } + } else if (ts6.isPrivateIdentifierClassElementDeclaration(node)) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); + } + flags |= ts6.modifierToFlag(modifier.kind); + break; + case 124: + if (flags & 32) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "static"); + } else if (flags & 64) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } else if (flags & 512) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); + } else if (flags & 128) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } else if (node.parent.kind === 265 || node.parent.kind === 308) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); + } else if (node.kind === 166) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } else if (flags & 256) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + } else if (flags & 16384) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "static", "override"); + } + flags |= 32; + lastStatic = modifier; + break; + case 127: + if (flags & 128) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "accessor"); + } else if (flags & 64) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } else if (flags & 2) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } else if (node.kind !== 169) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128; + break; + case 146: + if (flags & 64) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "readonly"); + } else if (node.kind !== 169 && node.kind !== 168 && node.kind !== 178 && node.kind !== 166) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= 64; + break; + case 93: + if (flags & 1) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "export"); + } else if (flags & 2) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } else if (flags & 256) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); + } else if (flags & 512) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); + } else if (ts6.isClassLike(node.parent)) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); + } else if (node.kind === 166) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= 1; + break; + case 88: + var container = node.parent.kind === 308 ? node.parent : node.parent.parent; + if (container.kind === 264 && !ts6.isAmbientModule(container)) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } else if (!(flags & 1)) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); + } + flags |= 1024; + break; + case 136: + if (flags & 2) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "declare"); + } else if (flags & 512) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); + } else if (flags & 16384) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); + } else if (ts6.isClassLike(node.parent) && !ts6.isPropertyDeclaration(node)) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); + } else if (node.kind === 166) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } else if (node.parent.flags & 16777216 && node.parent.kind === 265) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } else if (ts6.isPrivateIdentifierClassElementDeclaration(node)) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare"); + } + flags |= 2; + lastDeclare = modifier; + break; + case 126: + if (flags & 256) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "abstract"); + } + if (node.kind !== 260 && node.kind !== 182) { + if (node.kind !== 171 && node.kind !== 169 && node.kind !== 174 && node.kind !== 175) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); + } + if (!(node.parent.kind === 260 && ts6.hasSyntacticModifier( + node.parent, + 256 + /* ModifierFlags.Abstract */ + ))) { + return grammarErrorOnNode(modifier, ts6.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); + } + if (flags & 32) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + } + if (flags & 8) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); + } + if (flags & 512 && lastAsync) { + return grammarErrorOnNode(lastAsync, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); + } + if (flags & 16384) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); + } + if (flags & 128) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } + } + if (ts6.isNamedDeclaration(node) && node.name.kind === 80) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); + } + flags |= 256; + break; + case 132: + if (flags & 512) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, "async"); + } else if (flags & 2 || node.parent.flags & 16777216) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); + } else if (node.kind === 166) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); + } + if (flags & 256) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); + } + flags |= 512; + lastAsync = modifier; + break; + case 101: + case 145: + var inOutFlag = modifier.kind === 101 ? 32768 : 65536; + var inOutText = modifier.kind === 101 ? "in" : "out"; + if (node.kind !== 165 || !(ts6.isInterfaceDeclaration(node.parent) || ts6.isClassLike(node.parent) || ts6.isTypeAliasDeclaration(node.parent))) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); + } + if (flags & inOutFlag) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_already_seen, inOutText); + } + if (inOutFlag & 32768 && flags & 65536) { + return grammarErrorOnNode(modifier, ts6.Diagnostics._0_modifier_must_precede_1_modifier, "in", "out"); + } + flags |= inOutFlag; + break; + } + } + if (node.kind === 173) { + if (flags & 32) { + return grammarErrorOnNode(lastStatic, ts6.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + if (flags & 16384) { + return grammarErrorOnNode(lastOverride, ts6.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); + } + if (flags & 512) { + return grammarErrorOnNode(lastAsync, ts6.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); + } + return false; + } else if ((node.kind === 269 || node.kind === 268) && flags & 2) { + return grammarErrorOnNode(lastDeclare, ts6.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } else if (node.kind === 166 && flags & 16476 && ts6.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); + } else if (node.kind === 166 && flags & 16476 && node.dotDotDotToken) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); + } + if (flags & 512) { + return checkGrammarAsyncModifier(node, lastAsync); + } + return false; + } + function reportObviousModifierErrors(node) { + return !node.modifiers ? false : shouldReportBadModifier(node) ? grammarErrorOnFirstToken(node, ts6.Diagnostics.Modifiers_cannot_appear_here) : void 0; + } + function shouldReportBadModifier(node) { + switch (node.kind) { + case 174: + case 175: + case 173: + case 169: + case 168: + case 171: + case 170: + case 178: + case 264: + case 269: + case 268: + case 275: + case 274: + case 215: + case 216: + case 166: + case 165: + return false; + case 172: + case 299: + case 300: + case 267: + case 181: + case 279: + return true; + default: + if (node.parent.kind === 265 || node.parent.kind === 308) { + return false; + } + switch (node.kind) { + case 259: + return nodeHasAnyModifiersExcept( + node, + 132 + /* SyntaxKind.AsyncKeyword */ + ); + case 260: + case 182: + return nodeHasAnyModifiersExcept( + node, + 126 + /* SyntaxKind.AbstractKeyword */ + ); + case 228: + case 261: + case 240: + case 262: + return true; + case 263: + return nodeHasAnyModifiersExcept( + node, + 85 + /* SyntaxKind.ConstKeyword */ + ); + default: + ts6.Debug.assertNever(node); + } + } + } + function nodeHasAnyModifiersExcept(node, allowedModifier) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; + if (ts6.isDecorator(modifier)) + continue; + return modifier.kind !== allowedModifier; + } + return false; + } + function checkGrammarAsyncModifier(node, asyncModifier) { + switch (node.kind) { + case 171: + case 259: + case 215: + case 216: + return false; + } + return grammarErrorOnNode(asyncModifier, ts6.Diagnostics._0_modifier_cannot_be_used_here, "async"); + } + function checkGrammarForDisallowedTrailingComma(list, diag) { + if (diag === void 0) { + diag = ts6.Diagnostics.Trailing_comma_not_allowed; + } + if (list && list.hasTrailingComma) { + return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); + } + return false; + } + function checkGrammarTypeParameterList(typeParameters, file) { + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var end = ts6.skipTrivia(file.text, typeParameters.end) + ">".length; + return grammarErrorAtPos(file, start, end - start, ts6.Diagnostics.Type_parameter_list_cannot_be_empty); + } + return false; + } + function checkGrammarParameterList(parameters) { + var seenOptionalParameter = false; + var parameterCount = parameters.length; + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== parameterCount - 1) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts6.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + if (!(parameter.flags & 16777216)) { + checkGrammarForDisallowedTrailingComma(parameters, ts6.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts6.Diagnostics.A_rest_parameter_cannot_be_optional); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } else if (isOptionalParameter(parameter)) { + seenOptionalParameter = true; + if (parameter.questionToken && parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } else if (seenOptionalParameter && !parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } + function getNonSimpleParameters(parameters) { + return ts6.filter(parameters, function(parameter) { + return !!parameter.initializer || ts6.isBindingPattern(parameter.name) || ts6.isRestParameter(parameter); + }); + } + function checkGrammarForUseStrictSimpleParameterList(node) { + if (languageVersion >= 3) { + var useStrictDirective_1 = node.body && ts6.isBlock(node.body) && ts6.findUseStrictPrologue(node.body.statements); + if (useStrictDirective_1) { + var nonSimpleParameters = getNonSimpleParameters(node.parameters); + if (ts6.length(nonSimpleParameters)) { + ts6.forEach(nonSimpleParameters, function(parameter) { + ts6.addRelatedInfo(error(parameter, ts6.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts6.createDiagnosticForNode(useStrictDirective_1, ts6.Diagnostics.use_strict_directive_used_here)); + }); + var diagnostics_2 = nonSimpleParameters.map(function(parameter, index) { + return index === 0 ? ts6.createDiagnosticForNode(parameter, ts6.Diagnostics.Non_simple_parameter_declared_here) : ts6.createDiagnosticForNode(parameter, ts6.Diagnostics.and_here); + }); + ts6.addRelatedInfo.apply(void 0, __spreadArray([error(useStrictDirective_1, ts6.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)], diagnostics_2, false)); + return true; + } + } + } + return false; + } + function checkGrammarFunctionLikeDeclaration(node) { + var file = ts6.getSourceFileOfNode(node); + return checkGrammarDecoratorsAndModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file) || ts6.isFunctionLikeDeclaration(node) && checkGrammarForUseStrictSimpleParameterList(node); + } + function checkGrammarClassLikeDeclaration(node) { + var file = ts6.getSourceFileOfNode(node); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); + } + function checkGrammarArrowFunction(node, file) { + if (!ts6.isArrowFunction(node)) { + return false; + } + if (node.typeParameters && !(ts6.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) { + if (file && ts6.fileExtensionIsOneOf(file.fileName, [ + ".mts", + ".cts" + /* Extension.Cts */ + ])) { + grammarErrorOnNode(node.typeParameters[0], ts6.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint); + } + } + var equalsGreaterThanToken = node.equalsGreaterThanToken; + var startLine = ts6.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line; + var endLine = ts6.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line; + return startLine !== endLine && grammarErrorOnNode(equalsGreaterThanToken, ts6.Diagnostics.Line_terminator_not_permitted_before_arrow); + } + function checkGrammarIndexSignatureParameters(node) { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } else { + return grammarErrorOnNode(node, ts6.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + } + checkGrammarForDisallowedTrailingComma(node.parameters, ts6.Diagnostics.An_index_signature_cannot_have_a_trailing_comma); + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts6.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); + } + if (ts6.hasEffectiveModifiers(parameter)) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts6.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); + } + if (!parameter.type) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); + } + var type = getTypeFromTypeNode(parameter.type); + if (someType(type, function(t) { + return !!(t.flags & 8576); + }) || isGenericType(type)) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead); + } + if (!everyType(type, isValidIndexKeyType)) { + return grammarErrorOnNode(parameter.name, ts6.Diagnostics.An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type); + } + if (!node.type) { + return grammarErrorOnNode(node, ts6.Diagnostics.An_index_signature_must_have_a_type_annotation); + } + return false; + } + function checkGrammarIndexSignature(node) { + return checkGrammarDecoratorsAndModifiers(node) || checkGrammarIndexSignatureParameters(node); + } + function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { + if (typeArguments && typeArguments.length === 0) { + var sourceFile = ts6.getSourceFileOfNode(node); + var start = typeArguments.pos - "<".length; + var end = ts6.skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, ts6.Diagnostics.Type_argument_list_cannot_be_empty); + } + return false; + } + function checkGrammarTypeArguments(node, typeArguments) { + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + } + function checkGrammarTaggedTemplateChain(node) { + if (node.questionDotToken || node.flags & 32) { + return grammarErrorOnNode(node.template, ts6.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain); + } + return false; + } + function checkGrammarHeritageClause(node) { + var types = node.types; + if (checkGrammarForDisallowedTrailingComma(types)) { + return true; + } + if (types && types.length === 0) { + var listType = ts6.tokenToString(node.token); + return grammarErrorAtPos(node, types.pos, 0, ts6.Diagnostics._0_list_cannot_be_empty, listType); + } + return ts6.some(types, checkGrammarExpressionWithTypeArguments); + } + function checkGrammarExpressionWithTypeArguments(node) { + if (ts6.isExpressionWithTypeArguments(node) && ts6.isImportKeyword(node.expression) && node.typeArguments) { + return grammarErrorOnNode(node, ts6.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); + } + return checkGrammarTypeArguments(node, node.typeArguments); + } + function checkGrammarClassDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + var seenImplementsClause = false; + if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; + if (heritageClause.token === 94) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts6.Diagnostics.extends_clause_already_seen); + } + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts6.Diagnostics.extends_clause_must_precede_implements_clause); + } + if (heritageClause.types.length > 1) { + return grammarErrorOnFirstToken(heritageClause.types[1], ts6.Diagnostics.Classes_can_only_extend_a_single_class); + } + seenExtendsClause = true; + } else { + ts6.Debug.assert( + heritageClause.token === 117 + /* SyntaxKind.ImplementsKeyword */ + ); + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts6.Diagnostics.implements_clause_already_seen); + } + seenImplementsClause = true; + } + checkGrammarHeritageClause(heritageClause); + } + } + } + function checkGrammarInterfaceDeclaration(node) { + var seenExtendsClause = false; + if (node.heritageClauses) { + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; + if (heritageClause.token === 94) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts6.Diagnostics.extends_clause_already_seen); + } + seenExtendsClause = true; + } else { + ts6.Debug.assert( + heritageClause.token === 117 + /* SyntaxKind.ImplementsKeyword */ + ); + return grammarErrorOnFirstToken(heritageClause, ts6.Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + checkGrammarHeritageClause(heritageClause); + } + } + return false; + } + function checkGrammarComputedPropertyName(node) { + if (node.kind !== 164) { + return false; + } + var computedPropertyName = node; + if (computedPropertyName.expression.kind === 223 && computedPropertyName.expression.operatorToken.kind === 27) { + return grammarErrorOnNode(computedPropertyName.expression, ts6.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } + return false; + } + function checkGrammarForGenerator(node) { + if (node.asteriskToken) { + ts6.Debug.assert( + node.kind === 259 || node.kind === 215 || node.kind === 171 + /* SyntaxKind.MethodDeclaration */ + ); + if (node.flags & 16777216) { + return grammarErrorOnNode(node.asteriskToken, ts6.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); + } + if (!node.body) { + return grammarErrorOnNode(node.asteriskToken, ts6.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); + } + } + } + function checkGrammarForInvalidQuestionMark(questionToken, message) { + return !!questionToken && grammarErrorOnNode(questionToken, message); + } + function checkGrammarForInvalidExclamationToken(exclamationToken, message) { + return !!exclamationToken && grammarErrorOnNode(exclamationToken, message); + } + function checkGrammarObjectLiteralExpression(node, inDestructuring) { + var seen = new ts6.Map(); + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + if (prop.kind === 301) { + if (inDestructuring) { + var expression = ts6.skipParentheses(prop.expression); + if (ts6.isArrayLiteralExpression(expression) || ts6.isObjectLiteralExpression(expression)) { + return grammarErrorOnNode(prop.expression, ts6.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); + } + } + continue; + } + var name = prop.name; + if (name.kind === 164) { + checkGrammarComputedPropertyName(name); + } + if (prop.kind === 300 && !inDestructuring && prop.objectAssignmentInitializer) { + grammarErrorOnNode(prop.equalsToken, ts6.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); + } + if (name.kind === 80) { + grammarErrorOnNode(name, ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + } + if (ts6.canHaveModifiers(prop) && prop.modifiers) { + for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { + var mod = _c[_b]; + if (ts6.isModifier(mod) && (mod.kind !== 132 || prop.kind !== 171)) { + grammarErrorOnNode(mod, ts6.Diagnostics._0_modifier_cannot_be_used_here, ts6.getTextOfNode(mod)); + } + } + } else if (ts6.canHaveIllegalModifiers(prop) && prop.modifiers) { + for (var _d = 0, _e = prop.modifiers; _d < _e.length; _d++) { + var mod = _e[_d]; + grammarErrorOnNode(mod, ts6.Diagnostics._0_modifier_cannot_be_used_here, ts6.getTextOfNode(mod)); + } + } + var currentKind = void 0; + switch (prop.kind) { + case 300: + case 299: + checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts6.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); + checkGrammarForInvalidQuestionMark(prop.questionToken, ts6.Diagnostics.An_object_member_cannot_be_declared_optional); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); + } + currentKind = 4; + break; + case 171: + currentKind = 8; + break; + case 174: + currentKind = 1; + break; + case 175: + currentKind = 2; + break; + default: + throw ts6.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind); + } + if (!inDestructuring) { + var effectiveName = ts6.getPropertyNameForPropertyNameNode(name); + if (effectiveName === void 0) { + continue; + } + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); + } else { + if (currentKind & 8 && existingKind & 8) { + grammarErrorOnNode(name, ts6.Diagnostics.Duplicate_identifier_0, ts6.getTextOfNode(name)); + } else if (currentKind & 4 && existingKind & 4) { + grammarErrorOnNode(name, ts6.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name, ts6.getTextOfNode(name)); + } else if (currentKind & 3 && existingKind & 3) { + if (existingKind !== 3 && currentKind !== existingKind) { + seen.set(effectiveName, currentKind | existingKind); + } else { + return grammarErrorOnNode(name, ts6.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + } + } else { + return grammarErrorOnNode(name, ts6.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + } + } + } + } + } + function checkGrammarJsxElement(node) { + checkGrammarJsxName(node.tagName); + checkGrammarTypeArguments(node, node.typeArguments); + var seen = new ts6.Map(); + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { + var attr = _a[_i]; + if (attr.kind === 290) { + continue; + } + var name = attr.name, initializer = attr.initializer; + if (!seen.get(name.escapedText)) { + seen.set(name.escapedText, true); + } else { + return grammarErrorOnNode(name, ts6.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + } + if (initializer && initializer.kind === 291 && !initializer.expression) { + return grammarErrorOnNode(initializer, ts6.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); + } + } + } + function checkGrammarJsxName(node) { + if (ts6.isPropertyAccessExpression(node)) { + var propName = node; + do { + var check_1 = checkGrammarJsxNestedIdentifier(propName.name); + if (check_1) { + return check_1; + } + propName = propName.expression; + } while (ts6.isPropertyAccessExpression(propName)); + var check = checkGrammarJsxNestedIdentifier(propName); + if (check) { + return check; + } + } + function checkGrammarJsxNestedIdentifier(name) { + if (ts6.isIdentifier(name) && ts6.idText(name).indexOf(":") !== -1) { + return grammarErrorOnNode(name, ts6.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names); + } + } + } + function checkGrammarJsxExpression(node) { + if (node.expression && ts6.isCommaSequence(node.expression)) { + return grammarErrorOnNode(node.expression, ts6.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array); + } + } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.kind === 247 && forInOrOfStatement.awaitModifier) { + if (!(forInOrOfStatement.flags & 32768)) { + var sourceFile = ts6.getSourceFileOfNode(forInOrOfStatement); + if (ts6.isInTopLevelContext(forInOrOfStatement)) { + if (!hasParseDiagnostics(sourceFile)) { + if (!ts6.isEffectiveExternalModule(sourceFile, compilerOptions)) { + diagnostics.add(ts6.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts6.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module)); + } + switch (moduleKind) { + case ts6.ModuleKind.Node16: + case ts6.ModuleKind.NodeNext: + if (sourceFile.impliedNodeFormat === ts6.ModuleKind.CommonJS) { + diagnostics.add(ts6.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts6.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)); + break; + } + case ts6.ModuleKind.ES2022: + case ts6.ModuleKind.ESNext: + case ts6.ModuleKind.System: + if (languageVersion >= 4) { + break; + } + default: + diagnostics.add(ts6.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts6.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)); + break; + } + } + } else { + if (!hasParseDiagnostics(sourceFile)) { + var diagnostic = ts6.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts6.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); + var func = ts6.getContainingFunction(forInOrOfStatement); + if (func && func.kind !== 173) { + ts6.Debug.assert((ts6.getFunctionFlags(func) & 2) === 0, "Enclosing function should never be an async function."); + var relatedInfo = ts6.createDiagnosticForNode(func, ts6.Diagnostics.Did_you_mean_to_mark_this_function_as_async); + ts6.addRelatedInfo(diagnostic, relatedInfo); + } + diagnostics.add(diagnostic); + return true; + } + } + return false; + } + } + if (ts6.isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 32768) && ts6.isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") { + grammarErrorOnNode(forInOrOfStatement.initializer, ts6.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); + return false; + } + if (forInOrOfStatement.initializer.kind === 258) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + var declarations = variableList.declarations; + if (!declarations.length) { + return false; + } + if (declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 246 ? ts6.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts6.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); + } + var firstDeclaration = declarations[0]; + if (firstDeclaration.initializer) { + var diagnostic = forInOrOfStatement.kind === 246 ? ts6.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts6.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === 246 ? ts6.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts6.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + return false; + } + function checkGrammarAccessor(accessor) { + if (!(accessor.flags & 16777216) && accessor.parent.kind !== 184 && accessor.parent.kind !== 261) { + if (languageVersion < 1) { + return grammarErrorOnNode(accessor.name, ts6.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + if (languageVersion < 2 && ts6.isPrivateIdentifier(accessor.name)) { + return grammarErrorOnNode(accessor.name, ts6.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (accessor.body === void 0 && !ts6.hasSyntacticModifier( + accessor, + 256 + /* ModifierFlags.Abstract */ + )) { + return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts6.Diagnostics._0_expected, "{"); + } + } + if (accessor.body) { + if (ts6.hasSyntacticModifier( + accessor, + 256 + /* ModifierFlags.Abstract */ + )) { + return grammarErrorOnNode(accessor, ts6.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } + if (accessor.parent.kind === 184 || accessor.parent.kind === 261) { + return grammarErrorOnNode(accessor.body, ts6.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); + } + } + if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, ts6.Diagnostics.An_accessor_cannot_have_type_parameters); + } + if (!doesAccessorHaveCorrectParameterCount(accessor)) { + return grammarErrorOnNode(accessor.name, accessor.kind === 174 ? ts6.Diagnostics.A_get_accessor_cannot_have_parameters : ts6.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + if (accessor.kind === 175) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, ts6.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + var parameter = ts6.Debug.checkDefined(ts6.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion."); + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts6.Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts6.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, ts6.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + return false; + } + function doesAccessorHaveCorrectParameterCount(accessor) { + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 ? 0 : 1); + } + function getAccessorThisParameter(accessor) { + if (accessor.parameters.length === (accessor.kind === 174 ? 1 : 2)) { + return ts6.getThisParameter(accessor); + } + } + function checkGrammarTypeOperatorNode(node) { + if (node.operator === 156) { + if (node.type.kind !== 153) { + return grammarErrorOnNode(node.type, ts6.Diagnostics._0_expected, ts6.tokenToString( + 153 + /* SyntaxKind.SymbolKeyword */ + )); + } + var parent = ts6.walkUpParenthesizedTypes(node.parent); + if (ts6.isInJSFile(parent) && ts6.isJSDocTypeExpression(parent)) { + var host_2 = ts6.getJSDocHost(parent); + if (host_2) { + parent = ts6.getSingleVariableOfVariableStatement(host_2) || host_2; + } + } + switch (parent.kind) { + case 257: + var decl = parent; + if (decl.name.kind !== 79) { + return grammarErrorOnNode(node, ts6.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); + } + if (!ts6.isVariableDeclarationInVariableStatement(decl)) { + return grammarErrorOnNode(node, ts6.Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement); + } + if (!(decl.parent.flags & 2)) { + return grammarErrorOnNode(parent.name, ts6.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); + } + break; + case 169: + if (!ts6.isStatic(parent) || !ts6.hasEffectiveReadonlyModifier(parent)) { + return grammarErrorOnNode(parent.name, ts6.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); + } + break; + case 168: + if (!ts6.hasSyntacticModifier( + parent, + 64 + /* ModifierFlags.Readonly */ + )) { + return grammarErrorOnNode(parent.name, ts6.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); + } + break; + default: + return grammarErrorOnNode(node, ts6.Diagnostics.unique_symbol_types_are_not_allowed_here); + } + } else if (node.operator === 146) { + if (node.type.kind !== 185 && node.type.kind !== 186) { + return grammarErrorOnFirstToken(node, ts6.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts6.tokenToString( + 153 + /* SyntaxKind.SymbolKeyword */ + )); + } + } + } + function checkGrammarForInvalidDynamicName(node, message) { + if (isNonBindableDynamicName(node)) { + return grammarErrorOnNode(node, message); + } + } + function checkGrammarMethod(node) { + if (checkGrammarFunctionLikeDeclaration(node)) { + return true; + } + if (node.kind === 171) { + if (node.parent.kind === 207) { + if (node.modifiers && !(node.modifiers.length === 1 && ts6.first(node.modifiers).kind === 132)) { + return grammarErrorOnFirstToken(node, ts6.Diagnostics.Modifiers_cannot_appear_here); + } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts6.Diagnostics.An_object_member_cannot_be_declared_optional)) { + return true; + } else if (checkGrammarForInvalidExclamationToken(node.exclamationToken, ts6.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context)) { + return true; + } else if (node.body === void 0) { + return grammarErrorAtPos(node, node.end - 1, ";".length, ts6.Diagnostics._0_expected, "{"); + } + } + if (checkGrammarForGenerator(node)) { + return true; + } + } + if (ts6.isClassLike(node.parent)) { + if (languageVersion < 2 && ts6.isPrivateIdentifier(node.name)) { + return grammarErrorOnNode(node.name, ts6.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (node.flags & 16777216) { + return checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); + } else if (node.kind === 171 && !node.body) { + return checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); + } + } else if (node.parent.kind === 261) { + return checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); + } else if (node.parent.kind === 184) { + return checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); + } + } + function checkGrammarBreakOrContinueStatement(node) { + var current = node; + while (current) { + if (ts6.isFunctionLikeOrClassStaticBlockDeclaration(current)) { + return grammarErrorOnNode(node, ts6.Diagnostics.Jump_target_cannot_cross_function_boundary); + } + switch (current.kind) { + case 253: + if (node.label && current.label.escapedText === node.label.escapedText) { + var isMisplacedContinueLabel = node.kind === 248 && !ts6.isIterationStatement( + current.statement, + /*lookInLabeledStatement*/ + true + ); + if (isMisplacedContinueLabel) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); + } + return false; + } + break; + case 252: + if (node.kind === 249 && !node.label) { + return false; + } + break; + default: + if (ts6.isIterationStatement( + current, + /*lookInLabeledStatement*/ + false + ) && !node.label) { + return false; + } + break; + } + current = current.parent; + } + if (node.label) { + var message = node.kind === 249 ? ts6.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts6.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } else { + var message = node.kind === 249 ? ts6.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts6.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + } + function checkGrammarBindingElement(node) { + if (node.dotDotDotToken) { + var elements = node.parent.elements; + if (node !== ts6.last(elements)) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); + } + checkGrammarForDisallowedTrailingComma(elements, ts6.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + if (node.propertyName) { + return grammarErrorOnNode(node.name, ts6.Diagnostics.A_rest_element_cannot_have_a_property_name); + } + } + if (node.dotDotDotToken && node.initializer) { + return grammarErrorAtPos(node, node.initializer.pos - 1, 1, ts6.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + } + function isStringOrNumberLiteralExpression(expr) { + return ts6.isStringOrNumericLiteralLike(expr) || expr.kind === 221 && expr.operator === 40 && expr.operand.kind === 8; + } + function isBigIntLiteralExpression(expr) { + return expr.kind === 9 || expr.kind === 221 && expr.operator === 40 && expr.operand.kind === 9; + } + function isSimpleLiteralEnumReference(expr) { + if ((ts6.isPropertyAccessExpression(expr) || ts6.isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && ts6.isEntityNameExpression(expr.expression)) { + return !!(checkExpressionCached(expr).flags & 1024); + } + } + function checkAmbientInitializer(node) { + var initializer = node.initializer; + if (initializer) { + var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 110 || initializer.kind === 95 || isBigIntLiteralExpression(initializer)); + var isConstOrReadonly = ts6.isDeclarationReadonly(node) || ts6.isVariableDeclaration(node) && ts6.isVarConst(node); + if (isConstOrReadonly && !node.type) { + if (isInvalidInitializer) { + return grammarErrorOnNode(initializer, ts6.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference); + } + } else { + return grammarErrorOnNode(initializer, ts6.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + } + function checkGrammarVariableDeclaration(node) { + if (node.parent.parent.kind !== 246 && node.parent.parent.kind !== 247) { + if (node.flags & 16777216) { + checkAmbientInitializer(node); + } else if (!node.initializer) { + if (ts6.isBindingPattern(node.name) && !ts6.isBindingPattern(node.parent)) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_destructuring_declaration_must_have_an_initializer); + } + if (ts6.isVarConst(node)) { + return grammarErrorOnNode(node, ts6.Diagnostics.const_declarations_must_be_initialized); + } + } + } + if (node.exclamationToken && (node.parent.parent.kind !== 240 || !node.type || node.initializer || node.flags & 16777216)) { + var message = node.initializer ? ts6.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? ts6.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : ts6.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; + return grammarErrorOnNode(node.exclamationToken, message); + } + if ((moduleKind < ts6.ModuleKind.ES2015 || ts6.getSourceFileOfNode(node).impliedNodeFormat === ts6.ModuleKind.CommonJS) && moduleKind !== ts6.ModuleKind.System && !(node.parent.parent.flags & 16777216) && ts6.hasSyntacticModifier( + node.parent.parent, + 1 + /* ModifierFlags.Export */ + )) { + checkESModuleMarker(node.name); + } + var checkLetConstNames = ts6.isLet(node) || ts6.isVarConst(node); + return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); + } + function checkESModuleMarker(name) { + if (name.kind === 79) { + if (ts6.idText(name) === "__esModule") { + return grammarErrorOnNodeSkippedOn("noEmit", name, ts6.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + } + } else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (!ts6.isOmittedExpression(element)) { + return checkESModuleMarker(element.name); + } + } + } + return false; + } + function checkGrammarNameInLetOrConstDeclarations(name) { + if (name.kind === 79) { + if (name.originalKeywordKind === 119) { + return grammarErrorOnNode(name, ts6.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); + } + } else { + var elements = name.elements; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var element = elements_3[_i]; + if (!ts6.isOmittedExpression(element)) { + checkGrammarNameInLetOrConstDeclarations(element.name); + } + } + } + return false; + } + function checkGrammarVariableDeclarationList(declarationList) { + var declarations = declarationList.declarations; + if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) { + return true; + } + if (!declarationList.declarations.length) { + return grammarErrorAtPos(declarationList, declarations.pos, declarations.end - declarations.pos, ts6.Diagnostics.Variable_declaration_list_cannot_be_empty); + } + return false; + } + function allowLetAndConstDeclarations(parent) { + switch (parent.kind) { + case 242: + case 243: + case 244: + case 251: + case 245: + case 246: + case 247: + return false; + case 253: + return allowLetAndConstDeclarations(parent.parent); + } + return true; + } + function checkGrammarForDisallowedLetOrConstStatement(node) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (ts6.isLet(node.declarationList)) { + return grammarErrorOnNode(node, ts6.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } else if (ts6.isVarConst(node.declarationList)) { + return grammarErrorOnNode(node, ts6.Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } + } + function checkGrammarMetaProperty(node) { + var escapedText = node.name.escapedText; + switch (node.keywordToken) { + case 103: + if (escapedText !== "target") { + return grammarErrorOnNode(node.name, ts6.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts6.tokenToString(node.keywordToken), "target"); + } + break; + case 100: + if (escapedText !== "meta") { + return grammarErrorOnNode(node.name, ts6.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts6.tokenToString(node.keywordToken), "meta"); + } + break; + } + } + function hasParseDiagnostics(sourceFile) { + return sourceFile.parseDiagnostics.length > 0; + } + function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts6.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)); + return true; + } + return false; + } + function grammarErrorAtPos(nodeForSourceFile, start, length, message, arg0, arg1, arg2) { + var sourceFile = ts6.getSourceFileOfNode(nodeForSourceFile); + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.add(ts6.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + return true; + } + return false; + } + function grammarErrorOnNodeSkippedOn(key, node, message, arg0, arg1, arg2) { + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + errorSkippedOn(key, node, message, arg0, arg1, arg2); + return true; + } + return false; + } + function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.add(ts6.createDiagnosticForNode(node, message, arg0, arg1, arg2)); + return true; + } + return false; + } + function checkGrammarConstructorTypeParameters(node) { + var jsdocTypeParameters = ts6.isInJSFile(node) ? ts6.getJSDocTypeParameterDeclarations(node) : void 0; + var range2 = node.typeParameters || jsdocTypeParameters && ts6.firstOrUndefined(jsdocTypeParameters); + if (range2) { + var pos = range2.pos === range2.end ? range2.pos : ts6.skipTrivia(ts6.getSourceFileOfNode(node).text, range2.pos); + return grammarErrorAtPos(node, pos, range2.end - pos, ts6.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarConstructorTypeAnnotation(node) { + var type = node.type || ts6.getEffectiveReturnTypeNode(node); + if (type) { + return grammarErrorOnNode(type, ts6.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarProperty(node) { + if (ts6.isComputedPropertyName(node.name) && ts6.isBinaryExpression(node.name.expression) && node.name.expression.operatorToken.kind === 101) { + return grammarErrorOnNode(node.parent.members[0], ts6.Diagnostics.A_mapped_type_may_not_declare_properties_or_methods); + } + if (ts6.isClassLike(node.parent)) { + if (ts6.isStringLiteral(node.name) && node.name.text === "constructor") { + return grammarErrorOnNode(node.name, ts6.Diagnostics.Classes_may_not_have_a_field_named_constructor); + } + if (checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type)) { + return true; + } + if (languageVersion < 2 && ts6.isPrivateIdentifier(node.name)) { + return grammarErrorOnNode(node.name, ts6.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (languageVersion < 2 && ts6.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts6.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts6.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts6.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } + } else if (node.parent.kind === 261) { + if (checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { + return true; + } + ts6.Debug.assertNode(node, ts6.isPropertySignature); + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts6.Diagnostics.An_interface_property_cannot_have_an_initializer); + } + } else if (ts6.isTypeLiteralNode(node.parent)) { + if (checkGrammarForInvalidDynamicName(node.name, ts6.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { + return true; + } + ts6.Debug.assertNode(node, ts6.isPropertySignature); + if (node.initializer) { + return grammarErrorOnNode(node.initializer, ts6.Diagnostics.A_type_literal_property_cannot_have_an_initializer); + } + } + if (node.flags & 16777216) { + checkAmbientInitializer(node); + } + if (ts6.isPropertyDeclaration(node) && node.exclamationToken && (!ts6.isClassLike(node.parent) || !node.type || node.initializer || node.flags & 16777216 || ts6.isStatic(node) || ts6.hasAbstractModifier(node))) { + var message = node.initializer ? ts6.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? ts6.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : ts6.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; + return grammarErrorOnNode(node.exclamationToken, message); + } + } + function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { + if (node.kind === 261 || node.kind === 262 || node.kind === 269 || node.kind === 268 || node.kind === 275 || node.kind === 274 || node.kind === 267 || ts6.hasSyntacticModifier( + node, + 2 | 1 | 1024 + /* ModifierFlags.Default */ + )) { + return false; + } + return grammarErrorOnFirstToken(node, ts6.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); + } + function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts6.isDeclaration(decl) || decl.kind === 240) { + if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { + return true; + } + } + } + return false; + } + function checkGrammarSourceFile(node) { + return !!(node.flags & 16777216) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); + } + function checkGrammarStatementInAmbientContext(node) { + if (node.flags & 16777216) { + var links = getNodeLinks(node); + if (!links.hasReportedStatementInAmbientContext && (ts6.isFunctionLike(node.parent) || ts6.isAccessor(node.parent))) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts6.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); + } + if (node.parent.kind === 238 || node.parent.kind === 265 || node.parent.kind === 308) { + var links_2 = getNodeLinks(node.parent); + if (!links_2.hasReportedStatementInAmbientContext) { + return links_2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts6.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + } + } else { + } + } + return false; + } + function checkGrammarNumericLiteral(node) { + if (node.numericLiteralFlags & 32) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts6.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } else if (ts6.isChildOfNodeWithKind( + node, + 198 + /* SyntaxKind.LiteralType */ + )) { + diagnosticMessage = ts6.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } else if (ts6.isChildOfNodeWithKind( + node, + 302 + /* SyntaxKind.EnumMember */ + )) { + diagnosticMessage = ts6.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts6.isPrefixUnaryExpression(node.parent) && node.parent.operator === 40; + var literal2 = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal2); + } + } + checkNumericLiteralValueSize(node); + return false; + } + function checkNumericLiteralValueSize(node) { + var isFractional = ts6.getTextOfNode(node).indexOf(".") !== -1; + var isScientific = node.numericLiteralFlags & 16; + if (isFractional || isScientific) { + return; + } + var value = +node.text; + if (value <= Math.pow(2, 53) - 1) { + return; + } + addErrorOrSuggestion( + /*isError*/ + false, + ts6.createDiagnosticForNode(node, ts6.Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers) + ); + } + function checkGrammarBigIntLiteral(node) { + var literalType = ts6.isLiteralTypeNode(node.parent) || ts6.isPrefixUnaryExpression(node.parent) && ts6.isLiteralTypeNode(node.parent.parent); + if (!literalType) { + if (languageVersion < 7) { + if (grammarErrorOnNode(node, ts6.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) { + return true; + } + } + } + return false; + } + function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts6.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts6.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts6.createFileDiagnostic( + sourceFile, + ts6.textSpanEnd(span), + /*length*/ + 0, + message, + arg0, + arg1, + arg2 + )); + return true; + } + return false; + } + function getAmbientModules() { + if (!ambientModulesCache) { + ambientModulesCache = []; + globals.forEach(function(global2, sym) { + if (ambientModuleSymbolRegex.test(sym)) { + ambientModulesCache.push(global2); + } + }); + } + return ambientModulesCache; + } + function checkGrammarImportClause(node) { + var _a; + if (node.isTypeOnly && node.name && node.namedBindings) { + return grammarErrorOnNode(node, ts6.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); + } + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272) { + return checkGrammarNamedImportsOrExports(node.namedBindings); + } + return false; + } + function checkGrammarNamedImportsOrExports(namedBindings) { + return !!ts6.forEach(namedBindings.elements, function(specifier) { + if (specifier.isTypeOnly) { + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 ? ts6.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts6.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); + } + }); + } + function checkGrammarImportCallExpression(node) { + if (moduleKind === ts6.ModuleKind.ES2015) { + return grammarErrorOnNode(node, ts6.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext); + } + if (node.typeArguments) { + return grammarErrorOnNode(node, ts6.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); + } + var nodeArguments = node.arguments; + if (moduleKind !== ts6.ModuleKind.ESNext && moduleKind !== ts6.ModuleKind.NodeNext && moduleKind !== ts6.ModuleKind.Node16) { + checkGrammarForDisallowedTrailingComma(nodeArguments); + if (nodeArguments.length > 1) { + var assertionArgument = nodeArguments[1]; + return grammarErrorOnNode(assertionArgument, ts6.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext); + } + } + if (nodeArguments.length === 0 || nodeArguments.length > 2) { + return grammarErrorOnNode(node, ts6.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments); + } + var spreadElement = ts6.find(nodeArguments, ts6.isSpreadElement); + if (spreadElement) { + return grammarErrorOnNode(spreadElement, ts6.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element); + } + return false; + } + function findMatchingTypeReferenceOrTypeAliasReference(source, unionTarget) { + var sourceObjectFlags = ts6.getObjectFlags(source); + if (sourceObjectFlags & (4 | 16) && unionTarget.flags & 1048576) { + return ts6.find(unionTarget.types, function(target) { + if (target.flags & 524288) { + var overlapObjFlags = sourceObjectFlags & ts6.getObjectFlags(target); + if (overlapObjFlags & 4) { + return source.target === target.target; + } + if (overlapObjFlags & 16) { + return !!source.aliasSymbol && source.aliasSymbol === target.aliasSymbol; + } + } + return false; + }); + } + } + function findBestTypeForObjectLiteral(source, unionTarget) { + if (ts6.getObjectFlags(source) & 128 && someType(unionTarget, isArrayLikeType)) { + return ts6.find(unionTarget.types, function(t) { + return !isArrayLikeType(t); + }); + } + } + function findBestTypeForInvokable(source, unionTarget) { + var signatureKind = 0; + var hasSignatures = getSignaturesOfType(source, signatureKind).length > 0 || (signatureKind = 1, getSignaturesOfType(source, signatureKind).length > 0); + if (hasSignatures) { + return ts6.find(unionTarget.types, function(t) { + return getSignaturesOfType(t, signatureKind).length > 0; + }); + } + } + function findMostOverlappyType(source, unionTarget) { + var bestMatch; + if (!(source.flags & (131068 | 406847488))) { + var matchingCount = 0; + for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) { + var target = _a[_i]; + if (!(target.flags & (131068 | 406847488))) { + var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]); + if (overlap.flags & 4194304) { + return target; + } else if (isUnitType(overlap) || overlap.flags & 1048576) { + var len = overlap.flags & 1048576 ? ts6.countWhere(overlap.types, isUnitType) : 1; + if (len >= matchingCount) { + bestMatch = target; + matchingCount = len; + } + } + } + } + } + return bestMatch; + } + function filterPrimitivesIfContainsNonPrimitive(type) { + if (maybeTypeOfKind( + type, + 67108864 + /* TypeFlags.NonPrimitive */ + )) { + var result = filterType(type, function(t) { + return !(t.flags & 131068); + }); + if (!(result.flags & 131072)) { + return result; + } + } + return type; + } + function findMatchingDiscriminantType(source, target, isRelatedTo, skipPartial) { + if (target.flags & 1048576 && source.flags & (2097152 | 524288)) { + var match = getMatchingUnionConstituentForType(target, source); + if (match) { + return match; + } + var sourceProperties = getPropertiesOfType(source); + if (sourceProperties) { + var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target); + if (sourcePropertiesFiltered) { + return discriminateTypeByDiscriminableItems( + target, + ts6.map(sourcePropertiesFiltered, function(p) { + return [function() { + return getTypeOfSymbol(p); + }, p.escapedName]; + }), + isRelatedTo, + /*defaultValue*/ + void 0, + skipPartial + ); + } + } + } + return void 0; + } + } + ts6.createTypeChecker = createTypeChecker; + function isNotAccessor(declaration) { + return !ts6.isAccessor(declaration); + } + function isNotOverload(declaration) { + return declaration.kind !== 259 && declaration.kind !== 171 || !!declaration.body; + } + function isDeclarationNameOrImportPropertyName(name) { + switch (name.parent.kind) { + case 273: + case 278: + return ts6.isIdentifier(name); + default: + return ts6.isDeclarationName(name); + } + } + var JsxNames; + (function(JsxNames2) { + JsxNames2.JSX = "JSX"; + JsxNames2.IntrinsicElements = "IntrinsicElements"; + JsxNames2.ElementClass = "ElementClass"; + JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; + JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute"; + JsxNames2.Element = "Element"; + JsxNames2.IntrinsicAttributes = "IntrinsicAttributes"; + JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes"; + JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes"; + })(JsxNames || (JsxNames = {})); + function getIterationTypesKeyFromIterationTypeKind(typeKind) { + switch (typeKind) { + case 0: + return "yieldType"; + case 1: + return "returnType"; + case 2: + return "nextType"; + } + } + function signatureHasRestParameter(s) { + return !!(s.flags & 1); + } + ts6.signatureHasRestParameter = signatureHasRestParameter; + function signatureHasLiteralTypes(s) { + return !!(s.flags & 2); + } + ts6.signatureHasLiteralTypes = signatureHasLiteralTypes; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var _a; + function visitNode(node, visitor, test, lift) { + if (node === void 0 || visitor === void 0) { + return node; + } + var visited = visitor(node); + if (visited === node) { + return node; + } + var visitedNode; + if (visited === void 0) { + return void 0; + } else if (ts6.isArray(visited)) { + visitedNode = (lift || extractSingleNode)(visited); + } else { + visitedNode = visited; + } + ts6.Debug.assertNode(visitedNode, test); + return visitedNode; + } + ts6.visitNode = visitNode; + function visitNodes(nodes, visitor, test, start, count) { + if (nodes === void 0 || visitor === void 0) { + return nodes; + } + var length = nodes.length; + if (start === void 0 || start < 0) { + start = 0; + } + if (count === void 0 || count > length - start) { + count = length - start; + } + var hasTrailingComma; + var pos = -1; + var end = -1; + if (start > 0 || count < length) { + hasTrailingComma = nodes.hasTrailingComma && start + count === length; + } else { + pos = nodes.pos; + end = nodes.end; + hasTrailingComma = nodes.hasTrailingComma; + } + var updated = visitArrayWorker(nodes, visitor, test, start, count); + if (updated !== nodes) { + var updatedArray = ts6.factory.createNodeArray(updated, hasTrailingComma); + ts6.setTextRangePosEnd(updatedArray, pos, end); + return updatedArray; + } + return nodes; + } + ts6.visitNodes = visitNodes; + function visitArray(nodes, visitor, test, start, count) { + if (nodes === void 0) { + return nodes; + } + var length = nodes.length; + if (start === void 0 || start < 0) { + start = 0; + } + if (count === void 0 || count > length - start) { + count = length - start; + } + return visitArrayWorker(nodes, visitor, test, start, count); + } + ts6.visitArray = visitArray; + function visitArrayWorker(nodes, visitor, test, start, count) { + var updated; + var length = nodes.length; + if (start > 0 || count < length) { + updated = []; + } + for (var i = 0; i < count; i++) { + var node = nodes[i + start]; + var visited = node !== void 0 ? visitor(node) : void 0; + if (updated !== void 0 || visited === void 0 || visited !== node) { + if (updated === void 0) { + updated = nodes.slice(0, i); + } + if (visited) { + if (ts6.isArray(visited)) { + for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { + var visitedNode = visited_1[_i]; + void ts6.Debug.assertNode(visitedNode, test); + updated.push(visitedNode); + } + } else { + void ts6.Debug.assertNode(visited, test); + updated.push(visited); + } + } + } + } + return updated !== null && updated !== void 0 ? updated : nodes; + } + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict, nodesVisitor) { + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } + context.startLexicalEnvironment(); + statements = nodesVisitor(statements, visitor, ts6.isStatement, start); + if (ensureUseStrict) + statements = context.factory.ensureUseStrict(statements); + return ts6.factory.mergeLexicalEnvironment(statements, context.endLexicalEnvironment()); + } + ts6.visitLexicalEnvironment = visitLexicalEnvironment; + function visitParameterList(nodes, visitor, context, nodesVisitor) { + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } + var updated; + context.startLexicalEnvironment(); + if (nodes) { + context.setLexicalEnvironmentFlags(1, true); + updated = nodesVisitor(nodes, visitor, ts6.isParameterDeclaration); + if (context.getLexicalEnvironmentFlags() & 2 && ts6.getEmitScriptTarget(context.getCompilerOptions()) >= 2) { + updated = addDefaultValueAssignmentsIfNeeded(updated, context); + } + context.setLexicalEnvironmentFlags(1, false); + } + context.suspendLexicalEnvironment(); + return updated; + } + ts6.visitParameterList = visitParameterList; + function addDefaultValueAssignmentsIfNeeded(parameters, context) { + var result; + for (var i = 0; i < parameters.length; i++) { + var parameter = parameters[i]; + var updated = addDefaultValueAssignmentIfNeeded(parameter, context); + if (result || updated !== parameter) { + if (!result) + result = parameters.slice(0, i); + result[i] = updated; + } + } + if (result) { + return ts6.setTextRange(context.factory.createNodeArray(result, parameters.hasTrailingComma), parameters); + } + return parameters; + } + function addDefaultValueAssignmentIfNeeded(parameter, context) { + return parameter.dotDotDotToken ? parameter : ts6.isBindingPattern(parameter.name) ? addDefaultValueAssignmentForBindingPattern(parameter, context) : parameter.initializer ? addDefaultValueAssignmentForInitializer(parameter, parameter.name, parameter.initializer, context) : parameter; + } + function addDefaultValueAssignmentForBindingPattern(parameter, context) { + var factory = context.factory; + context.addInitializationStatement(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + parameter.name, + /*exclamationToken*/ + void 0, + parameter.type, + parameter.initializer ? factory.createConditionalExpression( + factory.createStrictEquality(factory.getGeneratedNameForNode(parameter), factory.createVoidZero()), + /*questionToken*/ + void 0, + parameter.initializer, + /*colonToken*/ + void 0, + factory.getGeneratedNameForNode(parameter) + ) : factory.getGeneratedNameForNode(parameter) + ) + ]) + )); + return factory.updateParameterDeclaration( + parameter, + parameter.modifiers, + parameter.dotDotDotToken, + factory.getGeneratedNameForNode(parameter), + parameter.questionToken, + parameter.type, + /*initializer*/ + void 0 + ); + } + function addDefaultValueAssignmentForInitializer(parameter, name, initializer, context) { + var factory = context.factory; + context.addInitializationStatement(factory.createIfStatement(factory.createTypeCheck(factory.cloneNode(name), "undefined"), ts6.setEmitFlags( + ts6.setTextRange(factory.createBlock([ + factory.createExpressionStatement(ts6.setEmitFlags( + ts6.setTextRange(factory.createAssignment(ts6.setEmitFlags( + factory.cloneNode(name), + 48 + /* EmitFlags.NoSourceMap */ + ), ts6.setEmitFlags( + initializer, + 48 | ts6.getEmitFlags(initializer) | 1536 + /* EmitFlags.NoComments */ + )), parameter), + 1536 + /* EmitFlags.NoComments */ + )) + ]), parameter), + 1 | 32 | 384 | 1536 + /* EmitFlags.NoComments */ + ))); + return factory.updateParameterDeclaration( + parameter, + parameter.modifiers, + parameter.dotDotDotToken, + parameter.name, + parameter.questionToken, + parameter.type, + /*initializer*/ + void 0 + ); + } + function visitFunctionBody(node, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } + context.resumeLexicalEnvironment(); + var updated = nodeVisitor(node, visitor, ts6.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts6.some(declarations)) { + if (!updated) { + return context.factory.createBlock(declarations); + } + var block = context.factory.converters.convertToFunctionBlock(updated); + var statements = ts6.factory.mergeLexicalEnvironment(block.statements, declarations); + return context.factory.updateBlock(block, statements); + } + return updated; + } + ts6.visitFunctionBody = visitFunctionBody; + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } + context.startBlockScope(); + var updated = nodeVisitor(body, visitor, ts6.isStatement, context.factory.liftToBlock); + var declarations = context.endBlockScope(); + if (ts6.some(declarations)) { + if (ts6.isBlock(updated)) { + declarations.push.apply(declarations, updated.statements); + return context.factory.updateBlock(updated, declarations); + } + declarations.push(updated); + return context.factory.createBlock(declarations); + } + return updated; + } + ts6.visitIterationBody = visitIterationBody; + function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor, nodeVisitor) { + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } + if (node === void 0) { + return void 0; + } + var fn = visitEachChildTable[node.kind]; + return fn === void 0 ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); + } + ts6.visitEachChild = visitEachChild; + var visitEachChildTable = (_a = {}, _a[ + 79 + /* SyntaxKind.Identifier */ + ] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts6.isTypeNodeOrTypeParameterDeclaration)); + }, _a[ + 163 + /* SyntaxKind.QualifiedName */ + ] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts6.isEntityName), nodeVisitor(node.right, visitor, ts6.isIdentifier)); + }, _a[ + 164 + /* SyntaxKind.ComputedPropertyName */ + ] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, // Signature elements + _a[ + 165 + /* SyntaxKind.TypeParameter */ + ] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodeVisitor(node.constraint, visitor, ts6.isTypeNode), nodeVisitor(node.default, visitor, ts6.isTypeNode)); + }, _a[ + 166 + /* SyntaxKind.Parameter */ + ] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts6.isDotDotDotToken), nodeVisitor(node.name, visitor, ts6.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts6.isQuestionToken), nodeVisitor(node.type, visitor, ts6.isTypeNode), nodeVisitor(node.initializer, visitor, ts6.isExpression)); + }, _a[ + 167 + /* SyntaxKind.Decorator */ + ] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, // Type elements + _a[ + 168 + /* SyntaxKind.PropertySignature */ + ] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts6.isToken), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 169 + /* SyntaxKind.PropertyDeclaration */ + ] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a2; + return context.factory.updatePropertyDeclaration( + node, + nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), + nodeVisitor(node.name, visitor, ts6.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a2 = node.questionToken) !== null && _a2 !== void 0 ? _a2 : node.exclamationToken, tokenVisitor, ts6.isQuestionOrExclamationToken), + nodeVisitor(node.type, visitor, ts6.isTypeNode), + nodeVisitor(node.initializer, visitor, ts6.isExpression) + ); + }, _a[ + 170 + /* SyntaxKind.MethodSignature */ + ] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts6.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts6.isParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 171 + /* SyntaxKind.MethodDeclaration */ + ] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts6.isAsteriskToken), nodeVisitor(node.name, visitor, ts6.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts6.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts6.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 173 + /* SyntaxKind.Constructor */ + ] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 174 + /* SyntaxKind.GetAccessor */ + ] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), nodeVisitor(node.name, visitor, ts6.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts6.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 175 + /* SyntaxKind.SetAccessor */ + ] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), nodeVisitor(node.name, visitor, ts6.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 172 + /* SyntaxKind.ClassStaticBlockDeclaration */ + ] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 176 + /* SyntaxKind.CallSignature */ + ] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts6.isParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 177 + /* SyntaxKind.ConstructSignature */ + ] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts6.isParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 178 + /* SyntaxKind.IndexSignature */ + ] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodesVisitor(node.parameters, visitor, ts6.isParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, // Types + _a[ + 179 + /* SyntaxKind.TypePredicate */ + ] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts6.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts6.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 180 + /* SyntaxKind.TypeReference */ + ] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts6.isEntityName), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode)); + }, _a[ + 181 + /* SyntaxKind.FunctionType */ + ] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts6.isParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 182 + /* SyntaxKind.ConstructorType */ + ] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts6.isParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 183 + /* SyntaxKind.TypeQuery */ + ] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts6.isEntityName), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode)); + }, _a[ + 184 + /* SyntaxKind.TypeLiteral */ + ] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts6.isTypeElement)); + }, _a[ + 185 + /* SyntaxKind.ArrayType */ + ] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts6.isTypeNode)); + }, _a[ + 186 + /* SyntaxKind.TupleType */ + ] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts6.isTypeNode)); + }, _a[ + 187 + /* SyntaxKind.OptionalType */ + ] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 188 + /* SyntaxKind.RestType */ + ] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 189 + /* SyntaxKind.UnionType */ + ] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts6.isTypeNode)); + }, _a[ + 190 + /* SyntaxKind.IntersectionType */ + ] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts6.isTypeNode)); + }, _a[ + 191 + /* SyntaxKind.ConditionalType */ + ] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts6.isTypeNode), nodeVisitor(node.extendsType, visitor, ts6.isTypeNode), nodeVisitor(node.trueType, visitor, ts6.isTypeNode), nodeVisitor(node.falseType, visitor, ts6.isTypeNode)); + }, _a[ + 192 + /* SyntaxKind.InferType */ + ] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts6.isTypeParameterDeclaration)); + }, _a[ + 202 + /* SyntaxKind.ImportType */ + ] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts6.isTypeNode), nodeVisitor(node.assertions, visitor, ts6.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts6.isEntityName), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), node.isTypeOf); + }, _a[ + 298 + /* SyntaxKind.ImportTypeAssertionContainer */ + ] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts6.isAssertClause), node.multiLine); + }, _a[ + 199 + /* SyntaxKind.NamedTupleMember */ + ] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts6.isDotDotDotToken), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts6.isQuestionToken), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 193 + /* SyntaxKind.ParenthesizedType */ + ] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 195 + /* SyntaxKind.TypeOperator */ + ] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 196 + /* SyntaxKind.IndexedAccessType */ + ] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts6.isTypeNode), nodeVisitor(node.indexType, visitor, ts6.isTypeNode)); + }, _a[ + 197 + /* SyntaxKind.MappedType */ + ] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts6.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts6.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts6.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts6.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts6.isTypeNode), nodesVisitor(node.members, visitor, ts6.isTypeElement)); + }, _a[ + 198 + /* SyntaxKind.LiteralType */ + ] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts6.isExpression)); + }, _a[ + 200 + /* SyntaxKind.TemplateLiteralType */ + ] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts6.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts6.isTemplateLiteralTypeSpan)); + }, _a[ + 201 + /* SyntaxKind.TemplateLiteralTypeSpan */ + ] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts6.isTypeNode), nodeVisitor(node.literal, visitor, ts6.isTemplateMiddleOrTemplateTail)); + }, // Binding patterns + _a[ + 203 + /* SyntaxKind.ObjectBindingPattern */ + ] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts6.isBindingElement)); + }, _a[ + 204 + /* SyntaxKind.ArrayBindingPattern */ + ] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts6.isArrayBindingElement)); + }, _a[ + 205 + /* SyntaxKind.BindingElement */ + ] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts6.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts6.isPropertyName), nodeVisitor(node.name, visitor, ts6.isBindingName), nodeVisitor(node.initializer, visitor, ts6.isExpression)); + }, // Expression + _a[ + 206 + /* SyntaxKind.ArrayLiteralExpression */ + ] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts6.isExpression)); + }, _a[ + 207 + /* SyntaxKind.ObjectLiteralExpression */ + ] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts6.isObjectLiteralElementLike)); + }, _a[ + 208 + /* SyntaxKind.PropertyAccessExpression */ + ] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts6.isPropertyAccessChain(node) ? context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts6.isQuestionDotToken), nodeVisitor(node.name, visitor, ts6.isMemberName)) : context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.name, visitor, ts6.isMemberName)); + }, _a[ + 209 + /* SyntaxKind.ElementAccessExpression */ + ] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts6.isElementAccessChain(node) ? context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts6.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts6.isExpression)) : context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.argumentExpression, visitor, ts6.isExpression)); + }, _a[ + 210 + /* SyntaxKind.CallExpression */ + ] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts6.isCallChain(node) ? context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts6.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), nodesVisitor(node.arguments, visitor, ts6.isExpression)) : context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), nodesVisitor(node.arguments, visitor, ts6.isExpression)); + }, _a[ + 211 + /* SyntaxKind.NewExpression */ + ] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), nodesVisitor(node.arguments, visitor, ts6.isExpression)); + }, _a[ + 212 + /* SyntaxKind.TaggedTemplateExpression */ + ] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts6.isExpression), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), nodeVisitor(node.template, visitor, ts6.isTemplateLiteral)); + }, _a[ + 213 + /* SyntaxKind.TypeAssertionExpression */ + ] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts6.isTypeNode), nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 214 + /* SyntaxKind.ParenthesizedExpression */ + ] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 215 + /* SyntaxKind.FunctionExpression */ + ] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts6.isAsteriskToken), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts6.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 216 + /* SyntaxKind.ArrowFunction */ + ] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts6.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts6.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 217 + /* SyntaxKind.DeleteExpression */ + ] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 218 + /* SyntaxKind.TypeOfExpression */ + ] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 219 + /* SyntaxKind.VoidExpression */ + ] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 220 + /* SyntaxKind.AwaitExpression */ + ] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 221 + /* SyntaxKind.PrefixUnaryExpression */ + ] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts6.isExpression)); + }, _a[ + 222 + /* SyntaxKind.PostfixUnaryExpression */ + ] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts6.isExpression)); + }, _a[ + 223 + /* SyntaxKind.BinaryExpression */ + ] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts6.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts6.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts6.isExpression)); + }, _a[ + 224 + /* SyntaxKind.ConditionalExpression */ + ] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts6.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts6.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts6.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts6.isColonToken), nodeVisitor(node.whenFalse, visitor, ts6.isExpression)); + }, _a[ + 225 + /* SyntaxKind.TemplateExpression */ + ] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts6.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts6.isTemplateSpan)); + }, _a[ + 226 + /* SyntaxKind.YieldExpression */ + ] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts6.isAsteriskToken), nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 227 + /* SyntaxKind.SpreadElement */ + ] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 228 + /* SyntaxKind.ClassExpression */ + ] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts6.isHeritageClause), nodesVisitor(node.members, visitor, ts6.isClassElement)); + }, _a[ + 230 + /* SyntaxKind.ExpressionWithTypeArguments */ + ] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode)); + }, _a[ + 231 + /* SyntaxKind.AsExpression */ + ] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 235 + /* SyntaxKind.SatisfiesExpression */ + ] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 232 + /* SyntaxKind.NonNullExpression */ + ] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts6.isOptionalChain(node) ? context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts6.isExpression)) : context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 233 + /* SyntaxKind.MetaProperty */ + ] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts6.isIdentifier)); + }, // Misc + _a[ + 236 + /* SyntaxKind.TemplateSpan */ + ] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.literal, visitor, ts6.isTemplateMiddleOrTemplateTail)); + }, // Element + _a[ + 238 + /* SyntaxKind.Block */ + ] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts6.isStatement)); + }, _a[ + 240 + /* SyntaxKind.VariableStatement */ + ] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.declarationList, visitor, ts6.isVariableDeclarationList)); + }, _a[ + 241 + /* SyntaxKind.ExpressionStatement */ + ] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 242 + /* SyntaxKind.IfStatement */ + ] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.thenStatement, visitor, ts6.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts6.isStatement, context.factory.liftToBlock)); + }, _a[ + 243 + /* SyntaxKind.DoStatement */ + ] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 244 + /* SyntaxKind.WhileStatement */ + ] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, _a[ + 245 + /* SyntaxKind.ForStatement */ + ] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts6.isForInitializer), nodeVisitor(node.condition, visitor, ts6.isExpression), nodeVisitor(node.incrementor, visitor, ts6.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, _a[ + 246 + /* SyntaxKind.ForInStatement */ + ] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts6.isForInitializer), nodeVisitor(node.expression, visitor, ts6.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, _a[ + 247 + /* SyntaxKind.ForOfStatement */ + ] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts6.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts6.isForInitializer), nodeVisitor(node.expression, visitor, ts6.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, _a[ + 248 + /* SyntaxKind.ContinueStatement */ + ] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts6.isIdentifier)); + }, _a[ + 249 + /* SyntaxKind.BreakStatement */ + ] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts6.isIdentifier)); + }, _a[ + 250 + /* SyntaxKind.ReturnStatement */ + ] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 251 + /* SyntaxKind.WithStatement */ + ] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.statement, visitor, ts6.isStatement, context.factory.liftToBlock)); + }, _a[ + 252 + /* SyntaxKind.SwitchStatement */ + ] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodeVisitor(node.caseBlock, visitor, ts6.isCaseBlock)); + }, _a[ + 253 + /* SyntaxKind.LabeledStatement */ + ] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts6.isIdentifier), nodeVisitor(node.statement, visitor, ts6.isStatement, context.factory.liftToBlock)); + }, _a[ + 254 + /* SyntaxKind.ThrowStatement */ + ] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 255 + /* SyntaxKind.TryStatement */ + ] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts6.isBlock), nodeVisitor(node.catchClause, visitor, ts6.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts6.isBlock)); + }, _a[ + 257 + /* SyntaxKind.VariableDeclaration */ + ] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts6.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts6.isExclamationToken), nodeVisitor(node.type, visitor, ts6.isTypeNode), nodeVisitor(node.initializer, visitor, ts6.isExpression)); + }, _a[ + 258 + /* SyntaxKind.VariableDeclarationList */ + ] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts6.isVariableDeclaration)); + }, _a[ + 259 + /* SyntaxKind.FunctionDeclaration */ + ] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts6.isAsteriskToken), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts6.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, _a[ + 260 + /* SyntaxKind.ClassDeclaration */ + ] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifierLike), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts6.isHeritageClause), nodesVisitor(node.members, visitor, ts6.isClassElement)); + }, _a[ + 261 + /* SyntaxKind.InterfaceDeclaration */ + ] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts6.isHeritageClause), nodesVisitor(node.members, visitor, ts6.isTypeElement)); + }, _a[ + 262 + /* SyntaxKind.TypeAliasDeclaration */ + ] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts6.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts6.isTypeNode)); + }, _a[ + 263 + /* SyntaxKind.EnumDeclaration */ + ] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isIdentifier), nodesVisitor(node.members, visitor, ts6.isEnumMember)); + }, _a[ + 264 + /* SyntaxKind.ModuleDeclaration */ + ] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.name, visitor, ts6.isModuleName), nodeVisitor(node.body, visitor, ts6.isModuleBody)); + }, _a[ + 265 + /* SyntaxKind.ModuleBlock */ + ] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts6.isStatement)); + }, _a[ + 266 + /* SyntaxKind.CaseBlock */ + ] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts6.isCaseOrDefaultClause)); + }, _a[ + 267 + /* SyntaxKind.NamespaceExportDeclaration */ + ] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts6.isIdentifier)); + }, _a[ + 268 + /* SyntaxKind.ImportEqualsDeclaration */ + ] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts6.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts6.isModuleReference)); + }, _a[ + 269 + /* SyntaxKind.ImportDeclaration */ + ] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.importClause, visitor, ts6.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts6.isExpression), nodeVisitor(node.assertClause, visitor, ts6.isAssertClause)); + }, _a[ + 296 + /* SyntaxKind.AssertClause */ + ] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts6.isAssertEntry), node.multiLine); + }, _a[ + 297 + /* SyntaxKind.AssertEntry */ + ] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts6.isAssertionKey), nodeVisitor(node.value, visitor, ts6.isExpression)); + }, _a[ + 270 + /* SyntaxKind.ImportClause */ + ] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts6.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts6.isNamedImportBindings)); + }, _a[ + 271 + /* SyntaxKind.NamespaceImport */ + ] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts6.isIdentifier)); + }, _a[ + 277 + /* SyntaxKind.NamespaceExport */ + ] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts6.isIdentifier)); + }, _a[ + 272 + /* SyntaxKind.NamedImports */ + ] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts6.isImportSpecifier)); + }, _a[ + 273 + /* SyntaxKind.ImportSpecifier */ + ] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts6.isIdentifier), nodeVisitor(node.name, visitor, ts6.isIdentifier)); + }, _a[ + 274 + /* SyntaxKind.ExportAssignment */ + ] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 275 + /* SyntaxKind.ExportDeclaration */ + ] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts6.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts6.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts6.isExpression), nodeVisitor(node.assertClause, visitor, ts6.isAssertClause)); + }, _a[ + 276 + /* SyntaxKind.NamedExports */ + ] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts6.isExportSpecifier)); + }, _a[ + 278 + /* SyntaxKind.ExportSpecifier */ + ] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts6.isIdentifier), nodeVisitor(node.name, visitor, ts6.isIdentifier)); + }, // Module references + _a[ + 280 + /* SyntaxKind.ExternalModuleReference */ + ] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, // JSX + _a[ + 281 + /* SyntaxKind.JsxElement */ + ] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts6.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts6.isJsxChild), nodeVisitor(node.closingElement, visitor, ts6.isJsxClosingElement)); + }, _a[ + 282 + /* SyntaxKind.JsxSelfClosingElement */ + ] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts6.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), nodeVisitor(node.attributes, visitor, ts6.isJsxAttributes)); + }, _a[ + 283 + /* SyntaxKind.JsxOpeningElement */ + ] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts6.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts6.isTypeNode), nodeVisitor(node.attributes, visitor, ts6.isJsxAttributes)); + }, _a[ + 284 + /* SyntaxKind.JsxClosingElement */ + ] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts6.isJsxTagNameExpression)); + }, _a[ + 285 + /* SyntaxKind.JsxFragment */ + ] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts6.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts6.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts6.isJsxClosingFragment)); + }, _a[ + 288 + /* SyntaxKind.JsxAttribute */ + ] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts6.isIdentifier), nodeVisitor(node.initializer, visitor, ts6.isStringLiteralOrJsxExpression)); + }, _a[ + 289 + /* SyntaxKind.JsxAttributes */ + ] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts6.isJsxAttributeLike)); + }, _a[ + 290 + /* SyntaxKind.JsxSpreadAttribute */ + ] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 291 + /* SyntaxKind.JsxExpression */ + ] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, // Clauses + _a[ + 292 + /* SyntaxKind.CaseClause */ + ] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts6.isExpression), nodesVisitor(node.statements, visitor, ts6.isStatement)); + }, _a[ + 293 + /* SyntaxKind.DefaultClause */ + ] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts6.isStatement)); + }, _a[ + 294 + /* SyntaxKind.HeritageClause */ + ] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts6.isExpressionWithTypeArguments)); + }, _a[ + 295 + /* SyntaxKind.CatchClause */ + ] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts6.isVariableDeclaration), nodeVisitor(node.block, visitor, ts6.isBlock)); + }, // Property assignments + _a[ + 299 + /* SyntaxKind.PropertyAssignment */ + ] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts6.isPropertyName), nodeVisitor(node.initializer, visitor, ts6.isExpression)); + }, _a[ + 300 + /* SyntaxKind.ShorthandPropertyAssignment */ + ] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts6.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts6.isExpression)); + }, _a[ + 301 + /* SyntaxKind.SpreadAssignment */ + ] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, // Enum + _a[ + 302 + /* SyntaxKind.EnumMember */ + ] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts6.isPropertyName), nodeVisitor(node.initializer, visitor, ts6.isExpression)); + }, // Top-level nodes + _a[ + 308 + /* SyntaxKind.SourceFile */ + ] = function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); + }, // Transformation nodes + _a[ + 353 + /* SyntaxKind.PartiallyEmittedExpression */ + ] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts6.isExpression)); + }, _a[ + 354 + /* SyntaxKind.CommaListExpression */ + ] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts6.isExpression)); + }, _a); + function extractSingleNode(nodes) { + ts6.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts6.singleOrUndefined(nodes); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) { + var _a = generatorOptions.extendedDiagnostics ? ts6.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : ts6.performance.nullTimer, enter = _a.enter, exit = _a.exit; + var rawSources = []; + var sources = []; + var sourceToSourceIndexMap = new ts6.Map(); + var sourcesContent; + var names = []; + var nameToNameIndexMap; + var mappingCharCodes = []; + var mappings = ""; + var lastGeneratedLine = 0; + var lastGeneratedCharacter = 0; + var lastSourceIndex = 0; + var lastSourceLine = 0; + var lastSourceCharacter = 0; + var lastNameIndex = 0; + var hasLast = false; + var pendingGeneratedLine = 0; + var pendingGeneratedCharacter = 0; + var pendingSourceIndex = 0; + var pendingSourceLine = 0; + var pendingSourceCharacter = 0; + var pendingNameIndex = 0; + var hasPending = false; + var hasPendingSource = false; + var hasPendingName = false; + return { + getSources: function() { + return rawSources; + }, + addSource, + setSourceContent, + addName, + addMapping, + appendSourceMap, + toJSON, + toString: function() { + return JSON.stringify(toJSON()); + } + }; + function addSource(fileName) { + enter(); + var source = ts6.getRelativePathToDirectoryOrUrl( + sourcesDirectoryPath, + fileName, + host.getCurrentDirectory(), + host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ + true + ); + var sourceIndex = sourceToSourceIndexMap.get(source); + if (sourceIndex === void 0) { + sourceIndex = sources.length; + sources.push(source); + rawSources.push(fileName); + sourceToSourceIndexMap.set(source, sourceIndex); + } + exit(); + return sourceIndex; + } + function setSourceContent(sourceIndex, content) { + enter(); + if (content !== null) { + if (!sourcesContent) + sourcesContent = []; + while (sourcesContent.length < sourceIndex) { + sourcesContent.push(null); + } + sourcesContent[sourceIndex] = content; + } + exit(); + } + function addName(name) { + enter(); + if (!nameToNameIndexMap) + nameToNameIndexMap = new ts6.Map(); + var nameIndex = nameToNameIndexMap.get(name); + if (nameIndex === void 0) { + nameIndex = names.length; + names.push(name); + nameToNameIndexMap.set(name, nameIndex); + } + exit(); + return nameIndex; + } + function isNewGeneratedPosition(generatedLine, generatedCharacter) { + return !hasPending || pendingGeneratedLine !== generatedLine || pendingGeneratedCharacter !== generatedCharacter; + } + function isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter) { + return sourceIndex !== void 0 && sourceLine !== void 0 && sourceCharacter !== void 0 && pendingSourceIndex === sourceIndex && (pendingSourceLine > sourceLine || pendingSourceLine === sourceLine && pendingSourceCharacter > sourceCharacter); + } + function addMapping(generatedLine, generatedCharacter, sourceIndex, sourceLine, sourceCharacter, nameIndex) { + ts6.Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); + ts6.Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); + ts6.Debug.assert(sourceIndex === void 0 || sourceIndex >= 0, "sourceIndex cannot be negative"); + ts6.Debug.assert(sourceLine === void 0 || sourceLine >= 0, "sourceLine cannot be negative"); + ts6.Debug.assert(sourceCharacter === void 0 || sourceCharacter >= 0, "sourceCharacter cannot be negative"); + enter(); + if (isNewGeneratedPosition(generatedLine, generatedCharacter) || isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter)) { + commitPendingMapping(); + pendingGeneratedLine = generatedLine; + pendingGeneratedCharacter = generatedCharacter; + hasPendingSource = false; + hasPendingName = false; + hasPending = true; + } + if (sourceIndex !== void 0 && sourceLine !== void 0 && sourceCharacter !== void 0) { + pendingSourceIndex = sourceIndex; + pendingSourceLine = sourceLine; + pendingSourceCharacter = sourceCharacter; + hasPendingSource = true; + if (nameIndex !== void 0) { + pendingNameIndex = nameIndex; + hasPendingName = true; + } + } + exit(); + } + function appendSourceMap(generatedLine, generatedCharacter, map, sourceMapPath, start, end) { + ts6.Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); + ts6.Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); + enter(); + var sourceIndexToNewSourceIndexMap = []; + var nameIndexToNewNameIndexMap; + var mappingIterator = decodeMappings(map.mappings); + for (var iterResult = mappingIterator.next(); !iterResult.done; iterResult = mappingIterator.next()) { + var raw = iterResult.value; + if (end && (raw.generatedLine > end.line || raw.generatedLine === end.line && raw.generatedCharacter > end.character)) { + break; + } + if (start && (raw.generatedLine < start.line || start.line === raw.generatedLine && raw.generatedCharacter < start.character)) { + continue; + } + var newSourceIndex = void 0; + var newSourceLine = void 0; + var newSourceCharacter = void 0; + var newNameIndex = void 0; + if (raw.sourceIndex !== void 0) { + newSourceIndex = sourceIndexToNewSourceIndexMap[raw.sourceIndex]; + if (newSourceIndex === void 0) { + var rawPath = map.sources[raw.sourceIndex]; + var relativePath = map.sourceRoot ? ts6.combinePaths(map.sourceRoot, rawPath) : rawPath; + var combinedPath = ts6.combinePaths(ts6.getDirectoryPath(sourceMapPath), relativePath); + sourceIndexToNewSourceIndexMap[raw.sourceIndex] = newSourceIndex = addSource(combinedPath); + if (map.sourcesContent && typeof map.sourcesContent[raw.sourceIndex] === "string") { + setSourceContent(newSourceIndex, map.sourcesContent[raw.sourceIndex]); + } + } + newSourceLine = raw.sourceLine; + newSourceCharacter = raw.sourceCharacter; + if (map.names && raw.nameIndex !== void 0) { + if (!nameIndexToNewNameIndexMap) + nameIndexToNewNameIndexMap = []; + newNameIndex = nameIndexToNewNameIndexMap[raw.nameIndex]; + if (newNameIndex === void 0) { + nameIndexToNewNameIndexMap[raw.nameIndex] = newNameIndex = addName(map.names[raw.nameIndex]); + } + } + } + var rawGeneratedLine = raw.generatedLine - (start ? start.line : 0); + var newGeneratedLine = rawGeneratedLine + generatedLine; + var rawGeneratedCharacter = start && start.line === raw.generatedLine ? raw.generatedCharacter - start.character : raw.generatedCharacter; + var newGeneratedCharacter = rawGeneratedLine === 0 ? rawGeneratedCharacter + generatedCharacter : rawGeneratedCharacter; + addMapping(newGeneratedLine, newGeneratedCharacter, newSourceIndex, newSourceLine, newSourceCharacter, newNameIndex); + } + exit(); + } + function shouldCommitMapping() { + return !hasLast || lastGeneratedLine !== pendingGeneratedLine || lastGeneratedCharacter !== pendingGeneratedCharacter || lastSourceIndex !== pendingSourceIndex || lastSourceLine !== pendingSourceLine || lastSourceCharacter !== pendingSourceCharacter || lastNameIndex !== pendingNameIndex; + } + function appendMappingCharCode(charCode) { + mappingCharCodes.push(charCode); + if (mappingCharCodes.length >= 1024) { + flushMappingBuffer(); + } + } + function commitPendingMapping() { + if (!hasPending || !shouldCommitMapping()) { + return; + } + enter(); + if (lastGeneratedLine < pendingGeneratedLine) { + do { + appendMappingCharCode( + 59 + /* CharacterCodes.semicolon */ + ); + lastGeneratedLine++; + } while (lastGeneratedLine < pendingGeneratedLine); + lastGeneratedCharacter = 0; + } else { + ts6.Debug.assertEqual(lastGeneratedLine, pendingGeneratedLine, "generatedLine cannot backtrack"); + if (hasLast) { + appendMappingCharCode( + 44 + /* CharacterCodes.comma */ + ); + } + } + appendBase64VLQ(pendingGeneratedCharacter - lastGeneratedCharacter); + lastGeneratedCharacter = pendingGeneratedCharacter; + if (hasPendingSource) { + appendBase64VLQ(pendingSourceIndex - lastSourceIndex); + lastSourceIndex = pendingSourceIndex; + appendBase64VLQ(pendingSourceLine - lastSourceLine); + lastSourceLine = pendingSourceLine; + appendBase64VLQ(pendingSourceCharacter - lastSourceCharacter); + lastSourceCharacter = pendingSourceCharacter; + if (hasPendingName) { + appendBase64VLQ(pendingNameIndex - lastNameIndex); + lastNameIndex = pendingNameIndex; + } + } + hasLast = true; + exit(); + } + function flushMappingBuffer() { + if (mappingCharCodes.length > 0) { + mappings += String.fromCharCode.apply(void 0, mappingCharCodes); + mappingCharCodes.length = 0; + } + } + function toJSON() { + commitPendingMapping(); + flushMappingBuffer(); + return { + version: 3, + file, + sourceRoot, + sources, + names, + mappings, + sourcesContent + }; + } + function appendBase64VLQ(inValue) { + if (inValue < 0) { + inValue = (-inValue << 1) + 1; + } else { + inValue = inValue << 1; + } + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + appendMappingCharCode(base64FormatEncode(currentDigit)); + } while (inValue > 0); + } + } + ts6.createSourceMapGenerator = createSourceMapGenerator; + var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/; + var whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/; + function getLineInfo(text, lineStarts) { + return { + getLineCount: function() { + return lineStarts.length; + }, + getLineText: function(line) { + return text.substring(lineStarts[line], lineStarts[line + 1]); + } + }; + } + ts6.getLineInfo = getLineInfo; + function tryGetSourceMappingURL(lineInfo) { + for (var index = lineInfo.getLineCount() - 1; index >= 0; index--) { + var line = lineInfo.getLineText(index); + var comment = sourceMapCommentRegExp.exec(line); + if (comment) { + return ts6.trimStringEnd(comment[1]); + } else if (!line.match(whitespaceOrMapCommentRegExp)) { + break; + } + } + } + ts6.tryGetSourceMappingURL = tryGetSourceMappingURL; + function isStringOrNull(x) { + return typeof x === "string" || x === null; + } + function isRawSourceMap(x) { + return x !== null && typeof x === "object" && x.version === 3 && typeof x.file === "string" && typeof x.mappings === "string" && ts6.isArray(x.sources) && ts6.every(x.sources, ts6.isString) && (x.sourceRoot === void 0 || x.sourceRoot === null || typeof x.sourceRoot === "string") && (x.sourcesContent === void 0 || x.sourcesContent === null || ts6.isArray(x.sourcesContent) && ts6.every(x.sourcesContent, isStringOrNull)) && (x.names === void 0 || x.names === null || ts6.isArray(x.names) && ts6.every(x.names, ts6.isString)); + } + ts6.isRawSourceMap = isRawSourceMap; + function tryParseRawSourceMap(text) { + try { + var parsed = JSON.parse(text); + if (isRawSourceMap(parsed)) { + return parsed; + } + } catch (_a) { + } + return void 0; + } + ts6.tryParseRawSourceMap = tryParseRawSourceMap; + function decodeMappings(mappings) { + var done = false; + var pos = 0; + var generatedLine = 0; + var generatedCharacter = 0; + var sourceIndex = 0; + var sourceLine = 0; + var sourceCharacter = 0; + var nameIndex = 0; + var error; + return { + get pos() { + return pos; + }, + get error() { + return error; + }, + get state() { + return captureMapping( + /*hasSource*/ + true, + /*hasName*/ + true + ); + }, + next: function() { + while (!done && pos < mappings.length) { + var ch = mappings.charCodeAt(pos); + if (ch === 59) { + generatedLine++; + generatedCharacter = 0; + pos++; + continue; + } + if (ch === 44) { + pos++; + continue; + } + var hasSource = false; + var hasName = false; + generatedCharacter += base64VLQFormatDecode(); + if (hasReportedError()) + return stopIterating(); + if (generatedCharacter < 0) + return setErrorAndStopIterating("Invalid generatedCharacter found"); + if (!isSourceMappingSegmentEnd()) { + hasSource = true; + sourceIndex += base64VLQFormatDecode(); + if (hasReportedError()) + return stopIterating(); + if (sourceIndex < 0) + return setErrorAndStopIterating("Invalid sourceIndex found"); + if (isSourceMappingSegmentEnd()) + return setErrorAndStopIterating("Unsupported Format: No entries after sourceIndex"); + sourceLine += base64VLQFormatDecode(); + if (hasReportedError()) + return stopIterating(); + if (sourceLine < 0) + return setErrorAndStopIterating("Invalid sourceLine found"); + if (isSourceMappingSegmentEnd()) + return setErrorAndStopIterating("Unsupported Format: No entries after sourceLine"); + sourceCharacter += base64VLQFormatDecode(); + if (hasReportedError()) + return stopIterating(); + if (sourceCharacter < 0) + return setErrorAndStopIterating("Invalid sourceCharacter found"); + if (!isSourceMappingSegmentEnd()) { + hasName = true; + nameIndex += base64VLQFormatDecode(); + if (hasReportedError()) + return stopIterating(); + if (nameIndex < 0) + return setErrorAndStopIterating("Invalid nameIndex found"); + if (!isSourceMappingSegmentEnd()) + return setErrorAndStopIterating("Unsupported Error Format: Entries after nameIndex"); + } + } + return { value: captureMapping(hasSource, hasName), done }; + } + return stopIterating(); + } + }; + function captureMapping(hasSource, hasName) { + return { + generatedLine, + generatedCharacter, + sourceIndex: hasSource ? sourceIndex : void 0, + sourceLine: hasSource ? sourceLine : void 0, + sourceCharacter: hasSource ? sourceCharacter : void 0, + nameIndex: hasName ? nameIndex : void 0 + }; + } + function stopIterating() { + done = true; + return { value: void 0, done: true }; + } + function setError(message) { + if (error === void 0) { + error = message; + } + } + function setErrorAndStopIterating(message) { + setError(message); + return stopIterating(); + } + function hasReportedError() { + return error !== void 0; + } + function isSourceMappingSegmentEnd() { + return pos === mappings.length || mappings.charCodeAt(pos) === 44 || mappings.charCodeAt(pos) === 59; + } + function base64VLQFormatDecode() { + var moreDigits = true; + var shiftCount = 0; + var value = 0; + for (; moreDigits; pos++) { + if (pos >= mappings.length) + return setError("Error in decoding base64VLQFormatDecode, past the mapping string"), -1; + var currentByte = base64FormatDecode(mappings.charCodeAt(pos)); + if (currentByte === -1) + return setError("Invalid character in VLQ"), -1; + moreDigits = (currentByte & 32) !== 0; + value = value | (currentByte & 31) << shiftCount; + shiftCount += 5; + } + if ((value & 1) === 0) { + value = value >> 1; + } else { + value = value >> 1; + value = -value; + } + return value; + } + } + ts6.decodeMappings = decodeMappings; + function sameMapping(left, right) { + return left === right || left.generatedLine === right.generatedLine && left.generatedCharacter === right.generatedCharacter && left.sourceIndex === right.sourceIndex && left.sourceLine === right.sourceLine && left.sourceCharacter === right.sourceCharacter && left.nameIndex === right.nameIndex; + } + ts6.sameMapping = sameMapping; + function isSourceMapping(mapping) { + return mapping.sourceIndex !== void 0 && mapping.sourceLine !== void 0 && mapping.sourceCharacter !== void 0; + } + ts6.isSourceMapping = isSourceMapping; + function base64FormatEncode(value) { + return value >= 0 && value < 26 ? 65 + value : value >= 26 && value < 52 ? 97 + value - 26 : value >= 52 && value < 62 ? 48 + value - 52 : value === 62 ? 43 : value === 63 ? 47 : ts6.Debug.fail("".concat(value, ": not a base64 value")); + } + function base64FormatDecode(ch) { + return ch >= 65 && ch <= 90 ? ch - 65 : ch >= 97 && ch <= 122 ? ch - 97 + 26 : ch >= 48 && ch <= 57 ? ch - 48 + 52 : ch === 43 ? 62 : ch === 47 ? 63 : -1; + } + function isSourceMappedPosition(value) { + return value.sourceIndex !== void 0 && value.sourcePosition !== void 0; + } + function sameMappedPosition(left, right) { + return left.generatedPosition === right.generatedPosition && left.sourceIndex === right.sourceIndex && left.sourcePosition === right.sourcePosition; + } + function compareSourcePositions(left, right) { + ts6.Debug.assert(left.sourceIndex === right.sourceIndex); + return ts6.compareValues(left.sourcePosition, right.sourcePosition); + } + function compareGeneratedPositions(left, right) { + return ts6.compareValues(left.generatedPosition, right.generatedPosition); + } + function getSourcePositionOfMapping(value) { + return value.sourcePosition; + } + function getGeneratedPositionOfMapping(value) { + return value.generatedPosition; + } + function createDocumentPositionMapper(host, map, mapPath) { + var mapDirectory = ts6.getDirectoryPath(mapPath); + var sourceRoot = map.sourceRoot ? ts6.getNormalizedAbsolutePath(map.sourceRoot, mapDirectory) : mapDirectory; + var generatedAbsoluteFilePath = ts6.getNormalizedAbsolutePath(map.file, mapDirectory); + var generatedFile = host.getSourceFileLike(generatedAbsoluteFilePath); + var sourceFileAbsolutePaths = map.sources.map(function(source) { + return ts6.getNormalizedAbsolutePath(source, sourceRoot); + }); + var sourceToSourceIndexMap = new ts6.Map(sourceFileAbsolutePaths.map(function(source, i) { + return [host.getCanonicalFileName(source), i]; + })); + var decodedMappings; + var generatedMappings; + var sourceMappings; + return { + getSourcePosition, + getGeneratedPosition + }; + function processMapping(mapping) { + var generatedPosition = generatedFile !== void 0 ? ts6.getPositionOfLineAndCharacter( + generatedFile, + mapping.generatedLine, + mapping.generatedCharacter, + /*allowEdits*/ + true + ) : -1; + var source; + var sourcePosition; + if (isSourceMapping(mapping)) { + var sourceFile = host.getSourceFileLike(sourceFileAbsolutePaths[mapping.sourceIndex]); + source = map.sources[mapping.sourceIndex]; + sourcePosition = sourceFile !== void 0 ? ts6.getPositionOfLineAndCharacter( + sourceFile, + mapping.sourceLine, + mapping.sourceCharacter, + /*allowEdits*/ + true + ) : -1; + } + return { + generatedPosition, + source, + sourceIndex: mapping.sourceIndex, + sourcePosition, + nameIndex: mapping.nameIndex + }; + } + function getDecodedMappings() { + if (decodedMappings === void 0) { + var decoder = decodeMappings(map.mappings); + var mappings = ts6.arrayFrom(decoder, processMapping); + if (decoder.error !== void 0) { + if (host.log) { + host.log("Encountered error while decoding sourcemap: ".concat(decoder.error)); + } + decodedMappings = ts6.emptyArray; + } else { + decodedMappings = mappings; + } + } + return decodedMappings; + } + function getSourceMappings(sourceIndex) { + if (sourceMappings === void 0) { + var lists = []; + for (var _i = 0, _a = getDecodedMappings(); _i < _a.length; _i++) { + var mapping = _a[_i]; + if (!isSourceMappedPosition(mapping)) + continue; + var list = lists[mapping.sourceIndex]; + if (!list) + lists[mapping.sourceIndex] = list = []; + list.push(mapping); + } + sourceMappings = lists.map(function(list2) { + return ts6.sortAndDeduplicate(list2, compareSourcePositions, sameMappedPosition); + }); + } + return sourceMappings[sourceIndex]; + } + function getGeneratedMappings() { + if (generatedMappings === void 0) { + var list = []; + for (var _i = 0, _a = getDecodedMappings(); _i < _a.length; _i++) { + var mapping = _a[_i]; + list.push(mapping); + } + generatedMappings = ts6.sortAndDeduplicate(list, compareGeneratedPositions, sameMappedPosition); + } + return generatedMappings; + } + function getGeneratedPosition(loc) { + var sourceIndex = sourceToSourceIndexMap.get(host.getCanonicalFileName(loc.fileName)); + if (sourceIndex === void 0) + return loc; + var sourceMappings2 = getSourceMappings(sourceIndex); + if (!ts6.some(sourceMappings2)) + return loc; + var targetIndex = ts6.binarySearchKey(sourceMappings2, loc.pos, getSourcePositionOfMapping, ts6.compareValues); + if (targetIndex < 0) { + targetIndex = ~targetIndex; + } + var mapping = sourceMappings2[targetIndex]; + if (mapping === void 0 || mapping.sourceIndex !== sourceIndex) { + return loc; + } + return { fileName: generatedAbsoluteFilePath, pos: mapping.generatedPosition }; + } + function getSourcePosition(loc) { + var generatedMappings2 = getGeneratedMappings(); + if (!ts6.some(generatedMappings2)) + return loc; + var targetIndex = ts6.binarySearchKey(generatedMappings2, loc.pos, getGeneratedPositionOfMapping, ts6.compareValues); + if (targetIndex < 0) { + targetIndex = ~targetIndex; + } + var mapping = generatedMappings2[targetIndex]; + if (mapping === void 0 || !isSourceMappedPosition(mapping)) { + return loc; + } + return { fileName: sourceFileAbsolutePaths[mapping.sourceIndex], pos: mapping.sourcePosition }; + } + } + ts6.createDocumentPositionMapper = createDocumentPositionMapper; + ts6.identitySourceMapConsumer = { + getSourcePosition: ts6.identity, + getGeneratedPosition: ts6.identity + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getOriginalNodeId(node) { + node = ts6.getOriginalNode(node); + return node ? ts6.getNodeId(node) : 0; + } + ts6.getOriginalNodeId = getOriginalNodeId; + function containsDefaultReference(node) { + if (!node) + return false; + if (!ts6.isNamedImports(node)) + return false; + return ts6.some(node.elements, isNamedDefaultReference); + } + function isNamedDefaultReference(e) { + return e.propertyName !== void 0 && e.propertyName.escapedText === "default"; + } + function chainBundle(context, transformSourceFile) { + return transformSourceFileOrBundle; + function transformSourceFileOrBundle(node) { + return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); + } + function transformBundle(node) { + return context.factory.createBundle(ts6.map(node.sourceFiles, transformSourceFile), node.prepends); + } + } + ts6.chainBundle = chainBundle; + function getExportNeedsImportStarHelper(node) { + return !!ts6.getNamespaceDeclarationNode(node); + } + ts6.getExportNeedsImportStarHelper = getExportNeedsImportStarHelper; + function getImportNeedsImportStarHelper(node) { + if (!!ts6.getNamespaceDeclarationNode(node)) { + return true; + } + var bindings = node.importClause && node.importClause.namedBindings; + if (!bindings) { + return false; + } + if (!ts6.isNamedImports(bindings)) + return false; + var defaultRefCount = 0; + for (var _i = 0, _a = bindings.elements; _i < _a.length; _i++) { + var binding = _a[_i]; + if (isNamedDefaultReference(binding)) { + defaultRefCount++; + } + } + return defaultRefCount > 0 && defaultRefCount !== bindings.elements.length || !!(bindings.elements.length - defaultRefCount) && ts6.isDefaultImport(node); + } + ts6.getImportNeedsImportStarHelper = getImportNeedsImportStarHelper; + function getImportNeedsImportDefaultHelper(node) { + return !getImportNeedsImportStarHelper(node) && (ts6.isDefaultImport(node) || !!node.importClause && ts6.isNamedImports(node.importClause.namedBindings) && containsDefaultReference(node.importClause.namedBindings)); + } + ts6.getImportNeedsImportDefaultHelper = getImportNeedsImportDefaultHelper; + function collectExternalModuleInfo(context, sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts6.createMultiMap(); + var exportedBindings = []; + var uniqueExports = new ts6.Map(); + var exportedNames; + var hasExportDefault = false; + var exportEquals; + var hasExportStarsToExportValues = false; + var hasImportStar = false; + var hasImportDefault = false; + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 269: + externalImports.push(node); + if (!hasImportStar && getImportNeedsImportStarHelper(node)) { + hasImportStar = true; + } + if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) { + hasImportDefault = true; + } + break; + case 268: + if (node.moduleReference.kind === 280) { + externalImports.push(node); + } + break; + case 275: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } else { + externalImports.push(node); + if (ts6.isNamedExports(node.exportClause)) { + addExportedNamesForExportDeclaration(node); + } else { + var name = node.exportClause.name; + if (!uniqueExports.get(ts6.idText(name))) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); + uniqueExports.set(ts6.idText(name), true); + exportedNames = ts6.append(exportedNames, name); + } + hasImportStar = true; + } + } + } else { + addExportedNamesForExportDeclaration(node); + } + break; + case 274: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + case 240: + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { + var decl = _c[_b]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 259: + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + if (ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + )) { + if (!hasExportDefault) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); + hasExportDefault = true; + } + } else { + var name = node.name; + if (!uniqueExports.get(ts6.idText(name))) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); + uniqueExports.set(ts6.idText(name), true); + exportedNames = ts6.append(exportedNames, name); + } + } + } + break; + case 260: + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + if (ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + )) { + if (!hasExportDefault) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); + hasExportDefault = true; + } + } else { + var name = node.name; + if (name && !uniqueExports.get(ts6.idText(name))) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); + uniqueExports.set(ts6.idText(name), true); + exportedNames = ts6.append(exportedNames, name); + } + } + } + break; + } + } + var externalHelpersImportDeclaration = ts6.createExternalHelpersImportDeclarationIfNeeded(context.factory, context.getEmitHelperFactory(), sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault); + if (externalHelpersImportDeclaration) { + externalImports.unshift(externalHelpersImportDeclaration); + } + return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, externalHelpersImportDeclaration }; + function addExportedNamesForExportDeclaration(node2) { + for (var _i2 = 0, _a2 = ts6.cast(node2.exportClause, ts6.isNamedExports).elements; _i2 < _a2.length; _i2++) { + var specifier = _a2[_i2]; + if (!uniqueExports.get(ts6.idText(specifier.name))) { + var name2 = specifier.propertyName || specifier.name; + if (!node2.moduleSpecifier) { + exportSpecifiers.add(ts6.idText(name2), specifier); + } + var decl2 = resolver.getReferencedImportDeclaration(name2) || resolver.getReferencedValueDeclaration(name2); + if (decl2) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl2), specifier.name); + } + uniqueExports.set(ts6.idText(specifier.name), true); + exportedNames = ts6.append(exportedNames, specifier.name); + } + } + } + } + ts6.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts6.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); + } + } + } else if (!ts6.isGeneratedIdentifier(decl.name)) { + var text = ts6.idText(decl.name); + if (!uniqueExports.get(text)) { + uniqueExports.set(text, true); + exportedNames = ts6.append(exportedNames, decl.name); + } + } + return exportedNames; + } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } else { + map[key] = values = [value]; + } + return values; + } + function isSimpleCopiableExpression(expression) { + return ts6.isStringLiteralLike(expression) || expression.kind === 8 || ts6.isKeyword(expression.kind) || ts6.isIdentifier(expression); + } + ts6.isSimpleCopiableExpression = isSimpleCopiableExpression; + function isSimpleInlineableExpression(expression) { + return !ts6.isIdentifier(expression) && isSimpleCopiableExpression(expression); + } + ts6.isSimpleInlineableExpression = isSimpleInlineableExpression; + function isCompoundAssignment(kind) { + return kind >= 64 && kind <= 78; + } + ts6.isCompoundAssignment = isCompoundAssignment; + function getNonAssignmentOperatorForCompoundAssignment(kind) { + switch (kind) { + case 64: + return 39; + case 65: + return 40; + case 66: + return 41; + case 67: + return 42; + case 68: + return 43; + case 69: + return 44; + case 70: + return 47; + case 71: + return 48; + case 72: + return 49; + case 73: + return 50; + case 74: + return 51; + case 78: + return 52; + case 75: + return 56; + case 76: + return 55; + case 77: + return 60; + } + } + ts6.getNonAssignmentOperatorForCompoundAssignment = getNonAssignmentOperatorForCompoundAssignment; + function getSuperCallFromStatement(statement) { + if (!ts6.isExpressionStatement(statement)) { + return void 0; + } + var expression = ts6.skipParentheses(statement.expression); + return ts6.isSuperCall(expression) ? expression : void 0; + } + ts6.getSuperCallFromStatement = getSuperCallFromStatement; + function findSuperStatementIndex(statements, indexAfterLastPrologueStatement) { + for (var i = indexAfterLastPrologueStatement; i < statements.length; i += 1) { + var statement = statements[i]; + if (getSuperCallFromStatement(statement)) { + return i; + } + } + return -1; + } + ts6.findSuperStatementIndex = findSuperStatementIndex; + function getProperties(node, requireInitializer, isStatic) { + return ts6.filter(node.members, function(m) { + return isInitializedOrStaticProperty(m, requireInitializer, isStatic); + }); + } + ts6.getProperties = getProperties; + function isStaticPropertyDeclarationOrClassStaticBlockDeclaration(element) { + return isStaticPropertyDeclaration(element) || ts6.isClassStaticBlockDeclaration(element); + } + function getStaticPropertiesAndClassStaticBlock(node) { + return ts6.filter(node.members, isStaticPropertyDeclarationOrClassStaticBlockDeclaration); + } + ts6.getStaticPropertiesAndClassStaticBlock = getStaticPropertiesAndClassStaticBlock; + function isInitializedOrStaticProperty(member, requireInitializer, isStatic) { + return ts6.isPropertyDeclaration(member) && (!!member.initializer || !requireInitializer) && ts6.hasStaticModifier(member) === isStatic; + } + function isStaticPropertyDeclaration(member) { + return ts6.isPropertyDeclaration(member) && ts6.hasStaticModifier(member); + } + function isInitializedProperty(member) { + return member.kind === 169 && member.initializer !== void 0; + } + ts6.isInitializedProperty = isInitializedProperty; + function isNonStaticMethodOrAccessorWithPrivateName(member) { + return !ts6.isStatic(member) && (ts6.isMethodOrAccessor(member) || ts6.isAutoAccessorPropertyDeclaration(member)) && ts6.isPrivateIdentifier(member.name); + } + ts6.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; + function getDecoratorsOfParameters(node) { + var decorators; + if (node) { + var parameters = node.parameters; + var firstParameterIsThis = parameters.length > 0 && ts6.parameterIsThisKeyword(parameters[0]); + var firstParameterOffset = firstParameterIsThis ? 1 : 0; + var numParameters = firstParameterIsThis ? parameters.length - 1 : parameters.length; + for (var i = 0; i < numParameters; i++) { + var parameter = parameters[i + firstParameterOffset]; + if (decorators || ts6.hasDecorators(parameter)) { + if (!decorators) { + decorators = new Array(numParameters); + } + decorators[i] = ts6.getDecorators(parameter); + } + } + } + return decorators; + } + function getAllDecoratorsOfClass(node) { + var decorators = ts6.getDecorators(node); + var parameters = getDecoratorsOfParameters(ts6.getFirstConstructorWithBody(node)); + if (!ts6.some(decorators) && !ts6.some(parameters)) { + return void 0; + } + return { + decorators, + parameters + }; + } + ts6.getAllDecoratorsOfClass = getAllDecoratorsOfClass; + function getAllDecoratorsOfClassElement(member, parent) { + switch (member.kind) { + case 174: + case 175: + return getAllDecoratorsOfAccessors(member, parent); + case 171: + return getAllDecoratorsOfMethod(member); + case 169: + return getAllDecoratorsOfProperty(member); + default: + return void 0; + } + } + ts6.getAllDecoratorsOfClassElement = getAllDecoratorsOfClassElement; + function getAllDecoratorsOfAccessors(accessor, parent) { + if (!accessor.body) { + return void 0; + } + var _a = ts6.getAllAccessorDeclarations(parent.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var firstAccessorWithDecorators = ts6.hasDecorators(firstAccessor) ? firstAccessor : secondAccessor && ts6.hasDecorators(secondAccessor) ? secondAccessor : void 0; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { + return void 0; + } + var decorators = ts6.getDecorators(firstAccessorWithDecorators); + var parameters = getDecoratorsOfParameters(setAccessor); + if (!ts6.some(decorators) && !ts6.some(parameters)) { + return void 0; + } + return { + decorators, + parameters, + getDecorators: getAccessor && ts6.getDecorators(getAccessor), + setDecorators: setAccessor && ts6.getDecorators(setAccessor) + }; + } + function getAllDecoratorsOfMethod(method) { + if (!method.body) { + return void 0; + } + var decorators = ts6.getDecorators(method); + var parameters = getDecoratorsOfParameters(method); + if (!ts6.some(decorators) && !ts6.some(parameters)) { + return void 0; + } + return { decorators, parameters }; + } + function getAllDecoratorsOfProperty(property) { + var decorators = ts6.getDecorators(property); + if (!ts6.some(decorators)) { + return void 0; + } + return { decorators }; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var FlattenLevel; + (function(FlattenLevel2) { + FlattenLevel2[FlattenLevel2["All"] = 0] = "All"; + FlattenLevel2[FlattenLevel2["ObjectRest"] = 1] = "ObjectRest"; + })(FlattenLevel = ts6.FlattenLevel || (ts6.FlattenLevel = {})); + function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { + var location = node; + var value; + if (ts6.isDestructuringAssignment(node)) { + value = node.right; + while (ts6.isEmptyArrayLiteral(node.left) || ts6.isEmptyObjectLiteral(node.left)) { + if (ts6.isDestructuringAssignment(value)) { + location = node = value; + value = node.right; + } else { + return ts6.visitNode(value, visitor, ts6.isExpression); + } + } + } + var expressions; + var flattenContext = { + context, + level, + downlevelIteration: !!context.getCompilerOptions().downlevelIteration, + hoistTempVariables: true, + emitExpression, + emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: function(elements) { + return makeArrayAssignmentPattern(context.factory, elements); + }, + createObjectBindingOrAssignmentPattern: function(elements) { + return makeObjectAssignmentPattern(context.factory, elements); + }, + createArrayBindingOrAssignmentElement: makeAssignmentElement, + visitor + }; + if (value) { + value = ts6.visitNode(value, visitor, ts6.isExpression); + if (ts6.isIdentifier(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node)) { + value = ensureIdentifier( + flattenContext, + value, + /*reuseIdentifierExpressions*/ + false, + location + ); + } else if (needsValue) { + value = ensureIdentifier( + flattenContext, + value, + /*reuseIdentifierExpressions*/ + true, + location + ); + } else if (ts6.nodeIsSynthesized(node)) { + location = value; + } + } + flattenBindingOrAssignmentElement( + flattenContext, + node, + value, + location, + /*skipInitializer*/ + ts6.isDestructuringAssignment(node) + ); + if (value && needsValue) { + if (!ts6.some(expressions)) { + return value; + } + expressions.push(value); + } + return context.factory.inlineExpressions(expressions) || context.factory.createOmittedExpression(); + function emitExpression(expression) { + expressions = ts6.append(expressions, expression); + } + function emitBindingOrAssignment(target, value2, location2, original) { + ts6.Debug.assertNode(target, createAssignmentCallback ? ts6.isIdentifier : ts6.isExpression); + var expression = createAssignmentCallback ? createAssignmentCallback(target, value2, location2) : ts6.setTextRange(context.factory.createAssignment(ts6.visitNode(target, visitor, ts6.isExpression), value2), location2); + expression.original = original; + emitExpression(expression); + } + } + ts6.flattenDestructuringAssignment = flattenDestructuringAssignment; + function bindingOrAssignmentElementAssignsToName(element, escapedName) { + var target = ts6.getTargetOfBindingOrAssignmentElement(element); + if (ts6.isBindingOrAssignmentPattern(target)) { + return bindingOrAssignmentPatternAssignsToName(target, escapedName); + } else if (ts6.isIdentifier(target)) { + return target.escapedText === escapedName; + } + return false; + } + function bindingOrAssignmentPatternAssignsToName(pattern, escapedName) { + var elements = ts6.getElementsOfBindingOrAssignmentPattern(pattern); + for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { + var element = elements_4[_i]; + if (bindingOrAssignmentElementAssignsToName(element, escapedName)) { + return true; + } + } + return false; + } + function bindingOrAssignmentElementContainsNonLiteralComputedName(element) { + var propertyName = ts6.tryGetPropertyNameOfBindingOrAssignmentElement(element); + if (propertyName && ts6.isComputedPropertyName(propertyName) && !ts6.isLiteralExpression(propertyName.expression)) { + return true; + } + var target = ts6.getTargetOfBindingOrAssignmentElement(element); + return !!target && ts6.isBindingOrAssignmentPattern(target) && bindingOrAssignmentPatternContainsNonLiteralComputedName(target); + } + function bindingOrAssignmentPatternContainsNonLiteralComputedName(pattern) { + return !!ts6.forEach(ts6.getElementsOfBindingOrAssignmentPattern(pattern), bindingOrAssignmentElementContainsNonLiteralComputedName); + } + function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + if (hoistTempVariables === void 0) { + hoistTempVariables = false; + } + var pendingExpressions; + var pendingDeclarations = []; + var declarations = []; + var flattenContext = { + context, + level, + downlevelIteration: !!context.getCompilerOptions().downlevelIteration, + hoistTempVariables, + emitExpression, + emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: function(elements) { + return makeArrayBindingPattern(context.factory, elements); + }, + createObjectBindingOrAssignmentPattern: function(elements) { + return makeObjectBindingPattern(context.factory, elements); + }, + createArrayBindingOrAssignmentElement: function(name2) { + return makeBindingElement(context.factory, name2); + }, + visitor + }; + if (ts6.isVariableDeclaration(node)) { + var initializer = ts6.getInitializerOfBindingOrAssignmentElement(node); + if (initializer && (ts6.isIdentifier(initializer) && bindingOrAssignmentElementAssignsToName(node, initializer.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node))) { + initializer = ensureIdentifier( + flattenContext, + ts6.visitNode(initializer, flattenContext.visitor), + /*reuseIdentifierExpressions*/ + false, + initializer + ); + node = context.factory.updateVariableDeclaration( + node, + node.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + initializer + ); + } + } + flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer); + if (pendingExpressions) { + var temp = context.factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + if (hoistTempVariables) { + var value = context.factory.inlineExpressions(pendingExpressions); + pendingExpressions = void 0; + emitBindingOrAssignment( + temp, + value, + /*location*/ + void 0, + /*original*/ + void 0 + ); + } else { + context.hoistVariableDeclaration(temp); + var pendingDeclaration = ts6.last(pendingDeclarations); + pendingDeclaration.pendingExpressions = ts6.append(pendingDeclaration.pendingExpressions, context.factory.createAssignment(temp, pendingDeclaration.value)); + ts6.addRange(pendingDeclaration.pendingExpressions, pendingExpressions); + pendingDeclaration.value = temp; + } + } + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = context.factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + pendingExpressions_1 ? context.factory.inlineExpressions(ts6.append(pendingExpressions_1, value)) : value + ); + variable.original = original; + ts6.setTextRange(variable, location); + declarations.push(variable); + } + return declarations; + function emitExpression(value2) { + pendingExpressions = ts6.append(pendingExpressions, value2); + } + function emitBindingOrAssignment(target, value2, location2, original2) { + ts6.Debug.assertNode(target, ts6.isBindingName); + if (pendingExpressions) { + value2 = context.factory.inlineExpressions(ts6.append(pendingExpressions, value2)); + pendingExpressions = void 0; + } + pendingDeclarations.push({ pendingExpressions, name: target, value: value2, location: location2, original: original2 }); + } + } + ts6.flattenDestructuringBinding = flattenDestructuringBinding; + function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) { + var bindingTarget = ts6.getTargetOfBindingOrAssignmentElement(element); + if (!skipInitializer) { + var initializer = ts6.visitNode(ts6.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts6.isExpression); + if (initializer) { + if (value) { + value = createDefaultValueCheck(flattenContext, value, initializer, location); + if (!ts6.isSimpleInlineableExpression(initializer) && ts6.isBindingOrAssignmentPattern(bindingTarget)) { + value = ensureIdentifier( + flattenContext, + value, + /*reuseIdentifierExpressions*/ + true, + location + ); + } + } else { + value = initializer; + } + } else if (!value) { + value = flattenContext.context.factory.createVoidZero(); + } + } + if (ts6.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } else if (ts6.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } else { + flattenContext.emitBindingOrAssignment( + bindingTarget, + value, + location, + /*original*/ + element + ); + } + } + function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts6.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (numElements !== 1) { + var reuseIdentifierExpressions = !ts6.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var computedTempVariables; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (!ts6.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var propertyName = ts6.getPropertyNameOfBindingOrAssignmentElement(element); + if (flattenContext.level >= 1 && !(element.transformFlags & (32768 | 65536)) && !(ts6.getTargetOfBindingOrAssignmentElement(element).transformFlags & (32768 | 65536)) && !ts6.isComputedPropertyName(propertyName)) { + bindingElements = ts6.append(bindingElements, ts6.visitNode(element, flattenContext.visitor)); + } else { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = void 0; + } + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts6.isComputedPropertyName(propertyName)) { + computedTempVariables = ts6.append(computedTempVariables, rhsValue.argumentExpression); + } + flattenBindingOrAssignmentElement( + flattenContext, + element, + rhsValue, + /*location*/ + element + ); + } + } else if (i === numElements - 1) { + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = void 0; + } + var rhsValue = flattenContext.context.getEmitHelperFactory().createRestHelper(value, elements, computedTempVariables, pattern); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + } + function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { + var elements = ts6.getElementsOfBindingOrAssignmentPattern(pattern); + var numElements = elements.length; + if (flattenContext.level < 1 && flattenContext.downlevelIteration) { + value = ensureIdentifier( + flattenContext, + ts6.setTextRange(flattenContext.context.getEmitHelperFactory().createReadHelper(value, numElements > 0 && ts6.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) ? void 0 : numElements), location), + /*reuseIdentifierExpressions*/ + false, + location + ); + } else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0) || ts6.every(elements, ts6.isOmittedExpression)) { + var reuseIdentifierExpressions = !ts6.isDeclarationBindingElement(parent) || numElements !== 0; + value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); + } + var bindingElements; + var restContainingElements; + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (flattenContext.level >= 1) { + if (element.transformFlags & 65536 || flattenContext.hasTransformedPriorElement && !isSimpleBindingOrAssignmentElement(element)) { + flattenContext.hasTransformedPriorElement = true; + var temp = flattenContext.context.factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + } + restContainingElements = ts6.append(restContainingElements, [temp, element]); + bindingElements = ts6.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); + } else { + bindingElements = ts6.append(bindingElements, element); + } + } else if (ts6.isOmittedExpression(element)) { + continue; + } else if (!ts6.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = flattenContext.context.factory.createElementAccessExpression(value, i); + flattenBindingOrAssignmentElement( + flattenContext, + element, + rhsValue, + /*location*/ + element + ); + } else if (i === numElements - 1) { + var rhsValue = flattenContext.context.factory.createArraySliceCall(value, i); + flattenBindingOrAssignmentElement( + flattenContext, + element, + rhsValue, + /*location*/ + element + ); + } + } + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); + } + if (restContainingElements) { + for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) { + var _a = restContainingElements_1[_i], id = _a[0], element = _a[1]; + flattenBindingOrAssignmentElement(flattenContext, element, id, element); + } + } + } + function isSimpleBindingOrAssignmentElement(element) { + var target = ts6.getTargetOfBindingOrAssignmentElement(element); + if (!target || ts6.isOmittedExpression(target)) + return true; + var propertyName = ts6.tryGetPropertyNameOfBindingOrAssignmentElement(element); + if (propertyName && !ts6.isPropertyNameLiteral(propertyName)) + return false; + var initializer = ts6.getInitializerOfBindingOrAssignmentElement(element); + if (initializer && !ts6.isSimpleInlineableExpression(initializer)) + return false; + if (ts6.isBindingOrAssignmentPattern(target)) + return ts6.every(ts6.getElementsOfBindingOrAssignmentPattern(target), isSimpleBindingOrAssignmentElement); + return ts6.isIdentifier(target); + } + function createDefaultValueCheck(flattenContext, value, defaultValue, location) { + value = ensureIdentifier( + flattenContext, + value, + /*reuseIdentifierExpressions*/ + true, + location + ); + return flattenContext.context.factory.createConditionalExpression( + flattenContext.context.factory.createTypeCheck(value, "undefined"), + /*questionToken*/ + void 0, + defaultValue, + /*colonToken*/ + void 0, + value + ); + } + function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + if (ts6.isComputedPropertyName(propertyName)) { + var argumentExpression = ensureIdentifier( + flattenContext, + ts6.visitNode(propertyName.expression, flattenContext.visitor), + /*reuseIdentifierExpressions*/ + false, + /*location*/ + propertyName + ); + return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression); + } else if (ts6.isStringOrNumericLiteralLike(propertyName)) { + var argumentExpression = ts6.factory.cloneNode(propertyName); + return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression); + } else { + var name = flattenContext.context.factory.createIdentifier(ts6.idText(propertyName)); + return flattenContext.context.factory.createPropertyAccessExpression(value, name); + } + } + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { + if (ts6.isIdentifier(value) && reuseIdentifierExpressions) { + return value; + } else { + var temp = flattenContext.context.factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts6.setTextRange(flattenContext.context.factory.createAssignment(temp, value), location)); + } else { + flattenContext.emitBindingOrAssignment( + temp, + value, + location, + /*original*/ + void 0 + ); + } + return temp; + } + } + function makeArrayBindingPattern(factory, elements) { + ts6.Debug.assertEachNode(elements, ts6.isArrayBindingElement); + return factory.createArrayBindingPattern(elements); + } + function makeArrayAssignmentPattern(factory, elements) { + return factory.createArrayLiteralExpression(ts6.map(elements, factory.converters.convertToArrayAssignmentElement)); + } + function makeObjectBindingPattern(factory, elements) { + ts6.Debug.assertEachNode(elements, ts6.isBindingElement); + return factory.createObjectBindingPattern(elements); + } + function makeObjectAssignmentPattern(factory, elements) { + return factory.createObjectLiteralExpression(ts6.map(elements, factory.converters.convertToObjectAssignmentElement)); + } + function makeBindingElement(factory, name) { + return factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + name + ); + } + function makeAssignmentElement(name) { + return name; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ProcessLevel; + (function(ProcessLevel2) { + ProcessLevel2[ProcessLevel2["LiftRestriction"] = 0] = "LiftRestriction"; + ProcessLevel2[ProcessLevel2["All"] = 1] = "All"; + })(ProcessLevel = ts6.ProcessLevel || (ts6.ProcessLevel = {})); + function processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, level) { + var tag = ts6.visitNode(node.tag, visitor, ts6.isExpression); + var templateArguments = [void 0]; + var cookedStrings = []; + var rawStrings = []; + var template = node.template; + if (level === ProcessLevel.LiftRestriction && !ts6.hasInvalidEscape(template)) { + return ts6.visitEachChild(node, visitor, context); + } + if (ts6.isNoSubstitutionTemplateLiteral(template)) { + cookedStrings.push(createTemplateCooked(template)); + rawStrings.push(getRawLiteral(template, currentSourceFile)); + } else { + cookedStrings.push(createTemplateCooked(template.head)); + rawStrings.push(getRawLiteral(template.head, currentSourceFile)); + for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) { + var templateSpan = _a[_i]; + cookedStrings.push(createTemplateCooked(templateSpan.literal)); + rawStrings.push(getRawLiteral(templateSpan.literal, currentSourceFile)); + templateArguments.push(ts6.visitNode(templateSpan.expression, visitor, ts6.isExpression)); + } + } + var helperCall = context.getEmitHelperFactory().createTemplateObjectHelper(ts6.factory.createArrayLiteralExpression(cookedStrings), ts6.factory.createArrayLiteralExpression(rawStrings)); + if (ts6.isExternalModule(currentSourceFile)) { + var tempVar = ts6.factory.createUniqueName("templateObject"); + recordTaggedTemplateString(tempVar); + templateArguments[0] = ts6.factory.createLogicalOr(tempVar, ts6.factory.createAssignment(tempVar, helperCall)); + } else { + templateArguments[0] = helperCall; + } + return ts6.factory.createCallExpression( + tag, + /*typeArguments*/ + void 0, + templateArguments + ); + } + ts6.processTaggedTemplateExpression = processTaggedTemplateExpression; + function createTemplateCooked(template) { + return template.templateFlags ? ts6.factory.createVoidZero() : ts6.factory.createStringLiteral(template.text); + } + function getRawLiteral(node, currentSourceFile) { + var text = node.rawText; + if (text === void 0) { + ts6.Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform."); + text = ts6.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var isLast = node.kind === 14 || node.kind === 17; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + } + text = text.replace(/\r\n?/g, "\n"); + return ts6.setTextRange(ts6.factory.createStringLiteral(text), node); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var USE_NEW_TYPE_METADATA_FORMAT = false; + var TypeScriptSubstitutionFlags; + (function(TypeScriptSubstitutionFlags2) { + TypeScriptSubstitutionFlags2[TypeScriptSubstitutionFlags2["NamespaceExports"] = 2] = "NamespaceExports"; + TypeScriptSubstitutionFlags2[TypeScriptSubstitutionFlags2["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers"; + })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); + var ClassFacts; + (function(ClassFacts2) { + ClassFacts2[ClassFacts2["None"] = 0] = "None"; + ClassFacts2[ClassFacts2["HasStaticInitializedProperties"] = 1] = "HasStaticInitializedProperties"; + ClassFacts2[ClassFacts2["HasConstructorDecorators"] = 2] = "HasConstructorDecorators"; + ClassFacts2[ClassFacts2["HasMemberDecorators"] = 4] = "HasMemberDecorators"; + ClassFacts2[ClassFacts2["IsExportOfNamespace"] = 8] = "IsExportOfNamespace"; + ClassFacts2[ClassFacts2["IsNamedExternalExport"] = 16] = "IsNamedExternalExport"; + ClassFacts2[ClassFacts2["IsDefaultExternalExport"] = 32] = "IsDefaultExternalExport"; + ClassFacts2[ClassFacts2["IsDerivedClass"] = 64] = "IsDerivedClass"; + ClassFacts2[ClassFacts2["UseImmediatelyInvokedFunctionExpression"] = 128] = "UseImmediatelyInvokedFunctionExpression"; + ClassFacts2[ClassFacts2["HasAnyDecorators"] = 6] = "HasAnyDecorators"; + ClassFacts2[ClassFacts2["NeedsName"] = 5] = "NeedsName"; + ClassFacts2[ClassFacts2["MayNeedImmediatelyInvokedFunctionExpression"] = 7] = "MayNeedImmediatelyInvokedFunctionExpression"; + ClassFacts2[ClassFacts2["IsExported"] = 56] = "IsExported"; + })(ClassFacts || (ClassFacts = {})); + function transformTypeScript(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + var typeSerializer = compilerOptions.emitDecoratorMetadata ? ts6.createRuntimeTypeSerializer(context) : void 0; + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableSubstitution( + 208 + /* SyntaxKind.PropertyAccessExpression */ + ); + context.enableSubstitution( + 209 + /* SyntaxKind.ElementAccessExpression */ + ); + var currentSourceFile; + var currentNamespace; + var currentNamespaceContainerName; + var currentLexicalScope; + var currentScopeFirstDeclarationsOfName; + var currentClassHasParameterProperties; + var enabledSubstitutions; + var applicableSubstitutions; + return transformSourceFileOrBundle; + function transformSourceFileOrBundle(node) { + if (node.kind === 309) { + return transformBundle(node); + } + return transformSourceFile(node); + } + function transformBundle(node) { + return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts6.mapDefined(node.prepends, function(prepend) { + if (prepend.kind === 311) { + return ts6.createUnparsedSourceFile(prepend, "js"); + } + return prepend; + })); + } + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + currentSourceFile = node; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = void 0; + return visited; + } + function saveStateAndInvoke(node, f) { + var savedCurrentScope = currentLexicalScope; + var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; + var savedCurrentClassHasParameterProperties = currentClassHasParameterProperties; + onBeforeVisitNode(node); + var visited = f(node); + if (currentLexicalScope !== savedCurrentScope) { + currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; + } + currentLexicalScope = savedCurrentScope; + currentClassHasParameterProperties = savedCurrentClassHasParameterProperties; + return visited; + } + function onBeforeVisitNode(node) { + switch (node.kind) { + case 308: + case 266: + case 265: + case 238: + currentLexicalScope = node; + currentScopeFirstDeclarationsOfName = void 0; + break; + case 260: + case 259: + if (ts6.hasSyntacticModifier( + node, + 2 + /* ModifierFlags.Ambient */ + )) { + break; + } + if (node.name) { + recordEmittedDeclarationInScope(node); + } else { + ts6.Debug.assert(node.kind === 260 || ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + )); + } + break; + } + } + function visitor(node) { + return saveStateAndInvoke(node, visitorWorker); + } + function visitorWorker(node) { + if (node.transformFlags & 1) { + return visitTypeScript(node); + } + return node; + } + function sourceElementVisitor(node) { + return saveStateAndInvoke(node, sourceElementVisitorWorker); + } + function sourceElementVisitorWorker(node) { + switch (node.kind) { + case 269: + case 268: + case 274: + case 275: + return visitElidableStatement(node); + default: + return visitorWorker(node); + } + } + function visitElidableStatement(node) { + var parsed = ts6.getParseTreeNode(node); + if (parsed !== node) { + if (node.transformFlags & 1) { + return ts6.visitEachChild(node, visitor, context); + } + return node; + } + switch (node.kind) { + case 269: + return visitImportDeclaration(node); + case 268: + return visitImportEqualsDeclaration(node); + case 274: + return visitExportAssignment(node); + case 275: + return visitExportDeclaration(node); + default: + ts6.Debug.fail("Unhandled ellided statement"); + } + } + function namespaceElementVisitor(node) { + return saveStateAndInvoke(node, namespaceElementVisitorWorker); + } + function namespaceElementVisitorWorker(node) { + if (node.kind === 275 || node.kind === 269 || node.kind === 270 || node.kind === 268 && node.moduleReference.kind === 280) { + return void 0; + } else if (node.transformFlags & 1 || ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + return visitTypeScript(node); + } + return node; + } + function getClassElementVisitor(parent) { + return function(node) { + return saveStateAndInvoke(node, function(n) { + return classElementVisitorWorker(n, parent); + }); + }; + } + function classElementVisitorWorker(node, parent) { + switch (node.kind) { + case 173: + return visitConstructor(node); + case 169: + return visitPropertyDeclaration(node, parent); + case 174: + return visitGetAccessor(node, parent); + case 175: + return visitSetAccessor(node, parent); + case 171: + return visitMethodDeclaration(node, parent); + case 172: + return ts6.visitEachChild(node, visitor, context); + case 237: + return node; + case 178: + return; + default: + return ts6.Debug.failBadSyntaxKind(node); + } + } + function getObjectLiteralElementVisitor(parent) { + return function(node) { + return saveStateAndInvoke(node, function(n) { + return objectLiteralElementVisitorWorker(n, parent); + }); + }; + } + function objectLiteralElementVisitorWorker(node, parent) { + switch (node.kind) { + case 299: + case 300: + case 301: + return visitor(node); + case 174: + return visitGetAccessor(node, parent); + case 175: + return visitSetAccessor(node, parent); + case 171: + return visitMethodDeclaration(node, parent); + default: + return ts6.Debug.failBadSyntaxKind(node); + } + } + function modifierVisitor(node) { + if (ts6.isDecorator(node)) + return void 0; + if (ts6.modifierToFlag(node.kind) & 117086) { + return void 0; + } else if (currentNamespace && node.kind === 93) { + return void 0; + } + return node; + } + function visitTypeScript(node) { + if (ts6.isStatement(node) && ts6.hasSyntacticModifier( + node, + 2 + /* ModifierFlags.Ambient */ + )) { + return factory.createNotEmittedStatement(node); + } + switch (node.kind) { + case 93: + case 88: + return currentNamespace ? void 0 : node; + case 123: + case 121: + case 122: + case 126: + case 161: + case 85: + case 136: + case 146: + case 101: + case 145: + case 185: + case 186: + case 187: + case 188: + case 184: + case 179: + case 165: + case 131: + case 157: + case 134: + case 152: + case 148: + case 144: + case 114: + case 153: + case 182: + case 181: + case 183: + case 180: + case 189: + case 190: + case 191: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 178: + return void 0; + case 262: + return factory.createNotEmittedStatement(node); + case 267: + return void 0; + case 261: + return factory.createNotEmittedStatement(node); + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 294: + return visitHeritageClause(node); + case 230: + return visitExpressionWithTypeArguments(node); + case 207: + return visitObjectLiteralExpression(node); + case 173: + case 169: + case 171: + case 174: + case 175: + case 172: + return ts6.Debug.fail("Class and object literal elements must be visited with their respective visitors"); + case 259: + return visitFunctionDeclaration(node); + case 215: + return visitFunctionExpression(node); + case 216: + return visitArrowFunction(node); + case 166: + return visitParameter(node); + case 214: + return visitParenthesizedExpression(node); + case 213: + case 231: + return visitAssertionExpression(node); + case 235: + return visitSatisfiesExpression(node); + case 210: + return visitCallExpression(node); + case 211: + return visitNewExpression(node); + case 212: + return visitTaggedTemplateExpression(node); + case 232: + return visitNonNullExpression(node); + case 263: + return visitEnumDeclaration(node); + case 240: + return visitVariableStatement(node); + case 257: + return visitVariableDeclaration(node); + case 264: + return visitModuleDeclaration(node); + case 268: + return visitImportEqualsDeclaration(node); + case 282: + return visitJsxSelfClosingElement(node); + case 283: + return visitJsxJsxOpeningElement(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitSourceFile(node) { + var alwaysStrict = ts6.getStrictOptionValue(compilerOptions, "alwaysStrict") && !(ts6.isExternalModule(node) && moduleKind >= ts6.ModuleKind.ES2015) && !ts6.isJsonSourceFile(node); + return factory.updateSourceFile(node, ts6.visitLexicalEnvironment( + node.statements, + sourceElementVisitor, + context, + /*start*/ + 0, + alwaysStrict + )); + } + function visitObjectLiteralExpression(node) { + return factory.updateObjectLiteralExpression(node, ts6.visitNodes(node.properties, getObjectLiteralElementVisitor(node), ts6.isObjectLiteralElement)); + } + function getClassFacts(node, staticProperties) { + var facts = 0; + if (ts6.some(staticProperties)) + facts |= 1; + var extendsClauseElement = ts6.getEffectiveBaseTypeNode(node); + if (extendsClauseElement && ts6.skipOuterExpressions(extendsClauseElement.expression).kind !== 104) + facts |= 64; + if (ts6.classOrConstructorParameterIsDecorated(node)) + facts |= 2; + if (ts6.childIsDecorated(node)) + facts |= 4; + if (isExportOfNamespace(node)) + facts |= 8; + else if (isDefaultExternalModuleExport(node)) + facts |= 32; + else if (isNamedExternalModuleExport(node)) + facts |= 16; + if (languageVersion <= 1 && facts & 7) + facts |= 128; + return facts; + } + function hasTypeScriptClassSyntax(node) { + return !!(node.transformFlags & 8192); + } + function isClassLikeDeclarationWithTypeScriptSyntax(node) { + return ts6.hasDecorators(node) || ts6.some(node.typeParameters) || ts6.some(node.heritageClauses, hasTypeScriptClassSyntax) || ts6.some(node.members, hasTypeScriptClassSyntax); + } + function visitClassDeclaration(node) { + if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ))) { + return factory.updateClassDeclaration( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + node.name, + /*typeParameters*/ + void 0, + ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause), + ts6.visitNodes(node.members, getClassElementVisitor(node), ts6.isClassElement) + ); + } + var staticProperties = ts6.getProperties( + node, + /*requireInitializer*/ + true, + /*isStatic*/ + true + ); + var facts = getClassFacts(node, staticProperties); + if (facts & 128) { + context.startLexicalEnvironment(); + } + var name = node.name || (facts & 5 ? factory.getGeneratedNameForNode(node) : void 0); + var allDecorators = ts6.getAllDecoratorsOfClass(node); + var decorators = transformAllDecoratorsOfDeclaration(node, node, allDecorators); + var modifiers = !(facts & 128) ? ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier) : ts6.elideNodes(factory, node.modifiers); + var classStatement = factory.updateClassDeclaration( + node, + ts6.concatenate(decorators, modifiers), + name, + /*typeParameters*/ + void 0, + ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause), + transformClassMembers(node) + ); + var emitFlags = ts6.getEmitFlags(node); + if (facts & 1) { + emitFlags |= 32; + } + ts6.setEmitFlags(classStatement, emitFlags); + var statements = [classStatement]; + if (facts & 128) { + var closingBraceLocation = ts6.createTokenRange( + ts6.skipTrivia(currentSourceFile.text, node.members.end), + 19 + /* SyntaxKind.CloseBraceToken */ + ); + var localName = factory.getInternalName(node); + var outer = factory.createPartiallyEmittedExpression(localName); + ts6.setTextRangeEnd(outer, closingBraceLocation.end); + ts6.setEmitFlags( + outer, + 1536 + /* EmitFlags.NoComments */ + ); + var statement = factory.createReturnStatement(outer); + ts6.setTextRangePos(statement, closingBraceLocation.pos); + ts6.setEmitFlags( + statement, + 1536 | 384 + /* EmitFlags.NoTokenSourceMaps */ + ); + statements.push(statement); + ts6.insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment()); + var iife = factory.createImmediatelyInvokedArrowFunction(statements); + ts6.setEmitFlags( + iife, + 33554432 + /* EmitFlags.TypeScriptClassWrapper */ + ); + var varStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + false + ), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + iife + ) + ]) + ); + ts6.setOriginalNode(varStatement, node); + ts6.setCommentRange(varStatement, node); + ts6.setSourceMapRange(varStatement, ts6.moveRangePastDecorators(node)); + ts6.startOnNewLine(varStatement); + statements = [varStatement]; + } + if (facts & 8) { + addExportMemberAssignment(statements, node); + } else if (facts & 128 || facts & 2) { + if (facts & 32) { + statements.push(factory.createExportDefault(factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ))); + } else if (facts & 16) { + statements.push(factory.createExternalModuleExport(factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ))); + } + } + if (statements.length > 1) { + statements.push(factory.createEndOfDeclarationMarker(node)); + ts6.setEmitFlags( + classStatement, + ts6.getEmitFlags(classStatement) | 4194304 + /* EmitFlags.HasEndOfDeclarationMarker */ + ); + } + return ts6.singleOrMany(statements); + } + function visitClassExpression(node) { + var allDecorators = ts6.getAllDecoratorsOfClass(node); + var decorators = transformAllDecoratorsOfDeclaration(node, node, allDecorators); + return factory.updateClassExpression( + node, + decorators, + node.name, + /*typeParameters*/ + void 0, + ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause), + isClassLikeDeclarationWithTypeScriptSyntax(node) ? transformClassMembers(node) : ts6.visitNodes(node.members, getClassElementVisitor(node), ts6.isClassElement) + ); + } + function transformClassMembers(node) { + var members = []; + var constructor = ts6.getFirstConstructorWithBody(node); + var parametersWithPropertyAssignments = constructor && ts6.filter(constructor.parameters, function(p) { + return ts6.isParameterPropertyDeclaration(p, constructor); + }); + if (parametersWithPropertyAssignments) { + for (var _i = 0, parametersWithPropertyAssignments_1 = parametersWithPropertyAssignments; _i < parametersWithPropertyAssignments_1.length; _i++) { + var parameter = parametersWithPropertyAssignments_1[_i]; + if (ts6.isIdentifier(parameter.name)) { + members.push(ts6.setOriginalNode(factory.createPropertyDeclaration( + /*modifiers*/ + void 0, + parameter.name, + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ), parameter)); + } + } + } + ts6.addRange(members, ts6.visitNodes(node.members, getClassElementVisitor(node), ts6.isClassElement)); + return ts6.setTextRange( + factory.createNodeArray(members), + /*location*/ + node.members + ); + } + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { + var _a, _b, _c, _d; + if (!allDecorators) { + return void 0; + } + var decorators = ts6.visitArray(allDecorators.decorators, visitor, ts6.isDecorator); + var parameterDecorators = ts6.flatMap(allDecorators.parameters, transformDecoratorsOfParameter); + var metadataDecorators = ts6.some(decorators) || ts6.some(parameterDecorators) ? getTypeMetadata(node, container) : void 0; + var result = factory.createNodeArray(ts6.concatenate(ts6.concatenate(decorators, parameterDecorators), metadataDecorators)); + var pos = (_b = (_a = ts6.firstOrUndefined(allDecorators.decorators)) === null || _a === void 0 ? void 0 : _a.pos) !== null && _b !== void 0 ? _b : -1; + var end = (_d = (_c = ts6.lastOrUndefined(allDecorators.decorators)) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : -1; + ts6.setTextRangePosEnd(result, pos, end); + return result; + } + function transformDecoratorsOfParameter(parameterDecorators, parameterOffset) { + if (parameterDecorators) { + var decorators = []; + for (var _i = 0, parameterDecorators_1 = parameterDecorators; _i < parameterDecorators_1.length; _i++) { + var parameterDecorator = parameterDecorators_1[_i]; + var expression = ts6.visitNode(parameterDecorator.expression, visitor, ts6.isExpression); + var helper = emitHelpers().createParamHelper(expression, parameterOffset); + ts6.setTextRange(helper, parameterDecorator.expression); + ts6.setEmitFlags( + helper, + 1536 + /* EmitFlags.NoComments */ + ); + var decorator = factory.createDecorator(helper); + ts6.setSourceMapRange(decorator, parameterDecorator.expression); + ts6.setCommentRange(decorator, parameterDecorator.expression); + ts6.setEmitFlags( + decorator, + 1536 + /* EmitFlags.NoComments */ + ); + decorators.push(decorator); + } + return decorators; + } + } + function getTypeMetadata(node, container) { + return USE_NEW_TYPE_METADATA_FORMAT ? getNewTypeMetadata(node, container) : getOldTypeMetadata(node, container); + } + function getOldTypeMetadata(node, container) { + if (typeSerializer) { + var decorators = void 0; + if (shouldAddTypeMetadata(node)) { + var typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)); + decorators = ts6.append(decorators, factory.createDecorator(typeMetadata)); + } + if (shouldAddParamTypesMetadata(node)) { + var paramTypesMetadata = emitHelpers().createMetadataHelper("design:paramtypes", typeSerializer.serializeParameterTypesOfNode({ currentLexicalScope, currentNameScope: container }, node, container)); + decorators = ts6.append(decorators, factory.createDecorator(paramTypesMetadata)); + } + if (shouldAddReturnTypeMetadata(node)) { + var returnTypeMetadata = emitHelpers().createMetadataHelper("design:returntype", typeSerializer.serializeReturnTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)); + decorators = ts6.append(decorators, factory.createDecorator(returnTypeMetadata)); + } + return decorators; + } + } + function getNewTypeMetadata(node, container) { + if (typeSerializer) { + var properties = void 0; + if (shouldAddTypeMetadata(node)) { + var typeProperty = factory.createPropertyAssignment("type", factory.createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + [], + /*type*/ + void 0, + factory.createToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ), + typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node) + )); + properties = ts6.append(properties, typeProperty); + } + if (shouldAddParamTypesMetadata(node)) { + var paramTypeProperty = factory.createPropertyAssignment("paramTypes", factory.createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + [], + /*type*/ + void 0, + factory.createToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ), + typeSerializer.serializeParameterTypesOfNode({ currentLexicalScope, currentNameScope: container }, node, container) + )); + properties = ts6.append(properties, paramTypeProperty); + } + if (shouldAddReturnTypeMetadata(node)) { + var returnTypeProperty = factory.createPropertyAssignment("returnType", factory.createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + [], + /*type*/ + void 0, + factory.createToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ), + typeSerializer.serializeReturnTypeOfNode({ currentLexicalScope, currentNameScope: container }, node) + )); + properties = ts6.append(properties, returnTypeProperty); + } + if (properties) { + var typeInfoMetadata = emitHelpers().createMetadataHelper("design:typeinfo", factory.createObjectLiteralExpression( + properties, + /*multiLine*/ + true + )); + return [factory.createDecorator(typeInfoMetadata)]; + } + } + } + function shouldAddTypeMetadata(node) { + var kind = node.kind; + return kind === 171 || kind === 174 || kind === 175 || kind === 169; + } + function shouldAddReturnTypeMetadata(node) { + return node.kind === 171; + } + function shouldAddParamTypesMetadata(node) { + switch (node.kind) { + case 260: + case 228: + return ts6.getFirstConstructorWithBody(node) !== void 0; + case 171: + case 174: + case 175: + return true; + } + return false; + } + function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { + var name = member.name; + if (ts6.isPrivateIdentifier(name)) { + return factory.createIdentifier(""); + } else if (ts6.isComputedPropertyName(name)) { + return generateNameForComputedPropertyName && !ts6.isSimpleInlineableExpression(name.expression) ? factory.getGeneratedNameForNode(name) : name.expression; + } else if (ts6.isIdentifier(name)) { + return factory.createStringLiteral(ts6.idText(name)); + } else { + return factory.cloneNode(name); + } + } + function visitPropertyNameOfClassElement(member) { + var name = member.name; + if (ts6.isComputedPropertyName(name) && (!ts6.hasStaticModifier(member) && currentClassHasParameterProperties || ts6.hasDecorators(member))) { + var expression = ts6.visitNode(name.expression, visitor, ts6.isExpression); + var innerExpression = ts6.skipPartiallyEmittedExpressions(expression); + if (!ts6.isSimpleInlineableExpression(innerExpression)) { + var generatedName = factory.getGeneratedNameForNode(name); + hoistVariableDeclaration(generatedName); + return factory.updateComputedPropertyName(name, factory.createAssignment(generatedName, expression)); + } + } + return ts6.visitNode(name, visitor, ts6.isPropertyName); + } + function visitHeritageClause(node) { + if (node.token === 117) { + return void 0; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitExpressionWithTypeArguments(node) { + return factory.updateExpressionWithTypeArguments( + node, + ts6.visitNode(node.expression, visitor, ts6.isLeftHandSideExpression), + /*typeArguments*/ + void 0 + ); + } + function shouldEmitFunctionLikeDeclaration(node) { + return !ts6.nodeIsMissing(node.body); + } + function visitPropertyDeclaration(node, parent) { + var isAmbient = node.flags & 16777216 || ts6.hasSyntacticModifier( + node, + 256 + /* ModifierFlags.Abstract */ + ); + if (isAmbient && !ts6.hasDecorators(node)) { + return void 0; + } + var allDecorators = ts6.getAllDecoratorsOfClassElement(node, parent); + var decorators = transformAllDecoratorsOfDeclaration(node, parent, allDecorators); + if (isAmbient) { + return factory.updatePropertyDeclaration( + node, + ts6.concatenate(decorators, factory.createModifiersFromModifierFlags( + 2 + /* ModifierFlags.Ambient */ + )), + ts6.visitNode(node.name, visitor, ts6.isPropertyName), + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ); + } + return factory.updatePropertyDeclaration( + node, + ts6.concatenate(decorators, ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike)), + visitPropertyNameOfClassElement(node), + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(node.initializer, visitor) + ); + } + function visitConstructor(node) { + if (!shouldEmitFunctionLikeDeclaration(node)) { + return void 0; + } + return factory.updateConstructorDeclaration( + node, + /*modifiers*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + transformConstructorBody(node.body, node) + ); + } + function transformConstructorBody(body, constructor) { + var parametersWithPropertyAssignments = constructor && ts6.filter(constructor.parameters, function(p) { + return ts6.isParameterPropertyDeclaration(p, constructor); + }); + if (!ts6.some(parametersWithPropertyAssignments)) { + return ts6.visitFunctionBody(body, visitor, context); + } + var statements = []; + resumeLexicalEnvironment(); + var prologueStatementCount = factory.copyPrologue( + body.statements, + statements, + /*ensureUseStrict*/ + false, + visitor + ); + var superStatementIndex = ts6.findSuperStatementIndex(body.statements, prologueStatementCount); + if (superStatementIndex >= 0) { + ts6.addRange(statements, ts6.visitNodes(body.statements, visitor, ts6.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount)); + } + var parameterPropertyAssignments = ts6.mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment); + if (superStatementIndex >= 0) { + ts6.addRange(statements, parameterPropertyAssignments); + } else { + statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true); + } + var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount; + ts6.addRange(statements, ts6.visitNodes(body.statements, visitor, ts6.isStatement, start)); + statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + var block = factory.createBlock( + ts6.setTextRange(factory.createNodeArray(statements), body.statements), + /*multiLine*/ + true + ); + ts6.setTextRange( + block, + /*location*/ + body + ); + ts6.setOriginalNode(block, body); + return block; + } + function transformParameterWithPropertyAssignment(node) { + var name = node.name; + if (!ts6.isIdentifier(name)) { + return void 0; + } + var propertyName = ts6.setParent(ts6.setTextRange(factory.cloneNode(name), name), name.parent); + ts6.setEmitFlags( + propertyName, + 1536 | 48 + /* EmitFlags.NoSourceMap */ + ); + var localName = ts6.setParent(ts6.setTextRange(factory.cloneNode(name), name), name.parent); + ts6.setEmitFlags( + localName, + 1536 + /* EmitFlags.NoComments */ + ); + return ts6.startOnNewLine(ts6.removeAllComments(ts6.setTextRange(ts6.setOriginalNode(factory.createExpressionStatement(factory.createAssignment(ts6.setTextRange(factory.createPropertyAccessExpression(factory.createThis(), propertyName), node.name), localName)), node), ts6.moveRangePos(node, -1)))); + } + function visitMethodDeclaration(node, parent) { + if (!(node.transformFlags & 1)) { + return node; + } + if (!shouldEmitFunctionLikeDeclaration(node)) { + return void 0; + } + var allDecorators = ts6.isClassLike(parent) ? ts6.getAllDecoratorsOfClassElement(node, parent) : void 0; + var decorators = ts6.isClassLike(parent) ? transformAllDecoratorsOfDeclaration(node, parent, allDecorators) : void 0; + return factory.updateMethodDeclaration( + node, + ts6.concatenate(decorators, ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike)), + node.asteriskToken, + visitPropertyNameOfClassElement(node), + /*questionToken*/ + void 0, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.visitFunctionBody(node.body, visitor, context) + ); + } + function shouldEmitAccessorDeclaration(node) { + return !(ts6.nodeIsMissing(node.body) && ts6.hasSyntacticModifier( + node, + 256 + /* ModifierFlags.Abstract */ + )); + } + function visitGetAccessor(node, parent) { + if (!(node.transformFlags & 1)) { + return node; + } + if (!shouldEmitAccessorDeclaration(node)) { + return void 0; + } + var decorators = ts6.isClassLike(parent) ? transformAllDecoratorsOfDeclaration(node, parent, ts6.getAllDecoratorsOfClassElement(node, parent)) : void 0; + return factory.updateGetAccessorDeclaration( + node, + ts6.concatenate(decorators, ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike)), + visitPropertyNameOfClassElement(node), + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.visitFunctionBody(node.body, visitor, context) || factory.createBlock([]) + ); + } + function visitSetAccessor(node, parent) { + if (!(node.transformFlags & 1)) { + return node; + } + if (!shouldEmitAccessorDeclaration(node)) { + return void 0; + } + var decorators = ts6.isClassLike(parent) ? transformAllDecoratorsOfDeclaration(node, parent, ts6.getAllDecoratorsOfClassElement(node, parent)) : void 0; + return factory.updateSetAccessorDeclaration(node, ts6.concatenate(decorators, ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike)), visitPropertyNameOfClassElement(node), ts6.visitParameterList(node.parameters, visitor, context), ts6.visitFunctionBody(node.body, visitor, context) || factory.createBlock([])); + } + function visitFunctionDeclaration(node) { + if (!shouldEmitFunctionLikeDeclaration(node)) { + return factory.createNotEmittedStatement(node); + } + var updated = factory.updateFunctionDeclaration( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + node.asteriskToken, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.visitFunctionBody(node.body, visitor, context) || factory.createBlock([]) + ); + if (isExportOfNamespace(node)) { + var statements = [updated]; + addExportMemberAssignment(statements, node); + return statements; + } + return updated; + } + function visitFunctionExpression(node) { + if (!shouldEmitFunctionLikeDeclaration(node)) { + return factory.createOmittedExpression(); + } + var updated = factory.updateFunctionExpression( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + node.asteriskToken, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.visitFunctionBody(node.body, visitor, context) || factory.createBlock([]) + ); + return updated; + } + function visitArrowFunction(node) { + var updated = factory.updateArrowFunction( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + node.equalsGreaterThanToken, + ts6.visitFunctionBody(node.body, visitor, context) + ); + return updated; + } + function visitParameter(node) { + if (ts6.parameterIsThisKeyword(node)) { + return void 0; + } + var updated = factory.updateParameterDeclaration( + node, + ts6.elideNodes(factory, node.modifiers), + // preserve positions, if available + node.dotDotDotToken, + ts6.visitNode(node.name, visitor, ts6.isBindingName), + /*questionToken*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(node.initializer, visitor, ts6.isExpression) + ); + if (updated !== node) { + ts6.setCommentRange(updated, node); + ts6.setTextRange(updated, ts6.moveRangePastModifiers(node)); + ts6.setSourceMapRange(updated, ts6.moveRangePastModifiers(node)); + ts6.setEmitFlags( + updated.name, + 32 + /* EmitFlags.NoTrailingSourceMap */ + ); + } + return updated; + } + function visitVariableStatement(node) { + if (isExportOfNamespace(node)) { + var variables = ts6.getInitializedVariables(node.declarationList); + if (variables.length === 0) { + return void 0; + } + return ts6.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(ts6.map(variables, transformInitializedVariable))), node); + } else { + return ts6.visitEachChild(node, visitor, context); + } + } + function transformInitializedVariable(node) { + var name = node.name; + if (ts6.isBindingPattern(name)) { + return ts6.flattenDestructuringAssignment( + node, + visitor, + context, + 0, + /*needsValue*/ + false, + createNamespaceExportExpression + ); + } else { + return ts6.setTextRange( + factory.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts6.visitNode(node.initializer, visitor, ts6.isExpression)), + /*location*/ + node + ); + } + } + function visitVariableDeclaration(node) { + var updated = factory.updateVariableDeclaration( + node, + ts6.visitNode(node.name, visitor, ts6.isBindingName), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(node.initializer, visitor, ts6.isExpression) + ); + if (node.type) { + ts6.setTypeNode(updated.name, node.type); + } + return updated; + } + function visitParenthesizedExpression(node) { + var innerExpression = ts6.skipOuterExpressions( + node.expression, + ~6 + /* OuterExpressionKinds.Assertions */ + ); + if (ts6.isAssertionExpression(innerExpression)) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitAssertionExpression(node) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } + function visitNonNullExpression(node) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isLeftHandSideExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } + function visitSatisfiesExpression(node) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } + function visitCallExpression(node) { + return factory.updateCallExpression( + node, + ts6.visitNode(node.expression, visitor, ts6.isExpression), + /*typeArguments*/ + void 0, + ts6.visitNodes(node.arguments, visitor, ts6.isExpression) + ); + } + function visitNewExpression(node) { + return factory.updateNewExpression( + node, + ts6.visitNode(node.expression, visitor, ts6.isExpression), + /*typeArguments*/ + void 0, + ts6.visitNodes(node.arguments, visitor, ts6.isExpression) + ); + } + function visitTaggedTemplateExpression(node) { + return factory.updateTaggedTemplateExpression( + node, + ts6.visitNode(node.tag, visitor, ts6.isExpression), + /*typeArguments*/ + void 0, + ts6.visitNode(node.template, visitor, ts6.isExpression) + ); + } + function visitJsxSelfClosingElement(node) { + return factory.updateJsxSelfClosingElement( + node, + ts6.visitNode(node.tagName, visitor, ts6.isJsxTagNameExpression), + /*typeArguments*/ + void 0, + ts6.visitNode(node.attributes, visitor, ts6.isJsxAttributes) + ); + } + function visitJsxJsxOpeningElement(node) { + return factory.updateJsxOpeningElement( + node, + ts6.visitNode(node.tagName, visitor, ts6.isJsxTagNameExpression), + /*typeArguments*/ + void 0, + ts6.visitNode(node.attributes, visitor, ts6.isJsxAttributes) + ); + } + function shouldEmitEnumDeclaration(node) { + return !ts6.isEnumConst(node) || ts6.shouldPreserveConstEnums(compilerOptions); + } + function visitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return factory.createNotEmittedStatement(node); + } + var statements = []; + var emitFlags = 2; + var varAdded = addVarForEnumOrModuleDeclaration(statements, node); + if (varAdded) { + if (moduleKind !== ts6.ModuleKind.System || currentLexicalScope !== currentSourceFile) { + emitFlags |= 512; + } + } + var parameterName = getNamespaceParameterName(node); + var containerName = getNamespaceContainerName(node); + var exportName = ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ) ? factory.getExternalModuleOrNamespaceExportName( + currentNamespaceContainerName, + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ) : factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + var moduleArg = factory.createLogicalOr(exportName, factory.createAssignment(exportName, factory.createObjectLiteralExpression())); + if (hasNamespaceQualifiedExportName(node)) { + var localName = factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + moduleArg = factory.createAssignment(localName, moduleArg); + } + var enumStatement = factory.createExpressionStatement(factory.createCallExpression( + factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + parameterName + )], + /*type*/ + void 0, + transformEnumBody(node, containerName) + ), + /*typeArguments*/ + void 0, + [moduleArg] + )); + ts6.setOriginalNode(enumStatement, node); + if (varAdded) { + ts6.setSyntheticLeadingComments(enumStatement, void 0); + ts6.setSyntheticTrailingComments(enumStatement, void 0); + } + ts6.setTextRange(enumStatement, node); + ts6.addEmitFlags(enumStatement, emitFlags); + statements.push(enumStatement); + statements.push(factory.createEndOfDeclarationMarker(node)); + return statements; + } + function transformEnumBody(node, localName) { + var savedCurrentNamespaceLocalName = currentNamespaceContainerName; + currentNamespaceContainerName = localName; + var statements = []; + startLexicalEnvironment(); + var members = ts6.map(node.members, transformEnumMember); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + ts6.addRange(statements, members); + currentNamespaceContainerName = savedCurrentNamespaceLocalName; + return factory.createBlock( + ts6.setTextRange( + factory.createNodeArray(statements), + /*location*/ + node.members + ), + /*multiLine*/ + true + ); + } + function transformEnumMember(member) { + var name = getExpressionForPropertyName( + member, + /*generateNameForComputedPropertyName*/ + false + ); + var valueExpression = transformEnumMemberDeclarationValue(member); + var innerAssignment = factory.createAssignment(factory.createElementAccessExpression(currentNamespaceContainerName, name), valueExpression); + var outerAssignment = valueExpression.kind === 10 ? innerAssignment : factory.createAssignment(factory.createElementAccessExpression(currentNamespaceContainerName, innerAssignment), name); + return ts6.setTextRange(factory.createExpressionStatement(ts6.setTextRange(outerAssignment, member)), member); + } + function transformEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== void 0) { + return typeof value === "string" ? factory.createStringLiteral(value) : factory.createNumericLiteral(value); + } else { + enableSubstitutionForNonQualifiedEnumMembers(); + if (member.initializer) { + return ts6.visitNode(member.initializer, visitor, ts6.isExpression); + } else { + return factory.createVoidZero(); + } + } + } + function shouldEmitModuleDeclaration(nodeIn) { + var node = ts6.getParseTreeNode(nodeIn, ts6.isModuleDeclaration); + if (!node) { + return true; + } + return ts6.isInstantiatedModule(node, ts6.shouldPreserveConstEnums(compilerOptions)); + } + function hasNamespaceQualifiedExportName(node) { + return isExportOfNamespace(node) || isExternalModuleExport(node) && moduleKind !== ts6.ModuleKind.ES2015 && moduleKind !== ts6.ModuleKind.ES2020 && moduleKind !== ts6.ModuleKind.ES2022 && moduleKind !== ts6.ModuleKind.ESNext && moduleKind !== ts6.ModuleKind.System; + } + function recordEmittedDeclarationInScope(node) { + if (!currentScopeFirstDeclarationsOfName) { + currentScopeFirstDeclarationsOfName = new ts6.Map(); + } + var name = declaredNameInScope(node); + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); + } + } + function isFirstEmittedDeclarationInScope(node) { + if (currentScopeFirstDeclarationsOfName) { + var name = declaredNameInScope(node); + return currentScopeFirstDeclarationsOfName.get(name) === node; + } + return true; + } + function declaredNameInScope(node) { + ts6.Debug.assertNode(node.name, ts6.isIdentifier); + return node.name.escapedText; + } + function addVarForEnumOrModuleDeclaration(statements, node) { + var statement = factory.createVariableStatement(ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration(factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + )) + ], + currentLexicalScope.kind === 308 ? 0 : 1 + /* NodeFlags.Let */ + )); + ts6.setOriginalNode(statement, node); + recordEmittedDeclarationInScope(node); + if (isFirstEmittedDeclarationInScope(node)) { + if (node.kind === 263) { + ts6.setSourceMapRange(statement.declarationList, node); + } else { + ts6.setSourceMapRange(statement, node); + } + ts6.setCommentRange(statement, node); + ts6.addEmitFlags( + statement, + 1024 | 4194304 + /* EmitFlags.HasEndOfDeclarationMarker */ + ); + statements.push(statement); + return true; + } else { + var mergeMarker = factory.createMergeDeclarationMarker(statement); + ts6.setEmitFlags( + mergeMarker, + 1536 | 4194304 + /* EmitFlags.HasEndOfDeclarationMarker */ + ); + statements.push(mergeMarker); + return false; + } + } + function visitModuleDeclaration(node) { + if (!shouldEmitModuleDeclaration(node)) { + return factory.createNotEmittedStatement(node); + } + ts6.Debug.assertNode(node.name, ts6.isIdentifier, "A TypeScript namespace should have an Identifier name."); + enableSubstitutionForNamespaceExports(); + var statements = []; + var emitFlags = 2; + var varAdded = addVarForEnumOrModuleDeclaration(statements, node); + if (varAdded) { + if (moduleKind !== ts6.ModuleKind.System || currentLexicalScope !== currentSourceFile) { + emitFlags |= 512; + } + } + var parameterName = getNamespaceParameterName(node); + var containerName = getNamespaceContainerName(node); + var exportName = ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ) ? factory.getExternalModuleOrNamespaceExportName( + currentNamespaceContainerName, + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ) : factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + var moduleArg = factory.createLogicalOr(exportName, factory.createAssignment(exportName, factory.createObjectLiteralExpression())); + if (hasNamespaceQualifiedExportName(node)) { + var localName = factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + moduleArg = factory.createAssignment(localName, moduleArg); + } + var moduleStatement = factory.createExpressionStatement(factory.createCallExpression( + factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + parameterName + )], + /*type*/ + void 0, + transformModuleBody(node, containerName) + ), + /*typeArguments*/ + void 0, + [moduleArg] + )); + ts6.setOriginalNode(moduleStatement, node); + if (varAdded) { + ts6.setSyntheticLeadingComments(moduleStatement, void 0); + ts6.setSyntheticTrailingComments(moduleStatement, void 0); + } + ts6.setTextRange(moduleStatement, node); + ts6.addEmitFlags(moduleStatement, emitFlags); + statements.push(moduleStatement); + statements.push(factory.createEndOfDeclarationMarker(node)); + return statements; + } + function transformModuleBody(node, namespaceLocalName) { + var savedCurrentNamespaceContainerName = currentNamespaceContainerName; + var savedCurrentNamespace = currentNamespace; + var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; + currentNamespaceContainerName = namespaceLocalName; + currentNamespace = node; + currentScopeFirstDeclarationsOfName = void 0; + var statements = []; + startLexicalEnvironment(); + var statementsLocation; + var blockLocation; + if (node.body) { + if (node.body.kind === 265) { + saveStateAndInvoke(node.body, function(body) { + return ts6.addRange(statements, ts6.visitNodes(body.statements, namespaceElementVisitor, ts6.isStatement)); + }); + statementsLocation = node.body.statements; + blockLocation = node.body; + } else { + var result = visitModuleDeclaration(node.body); + if (result) { + if (ts6.isArray(result)) { + ts6.addRange(statements, result); + } else { + statements.push(result); + } + } + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + statementsLocation = ts6.moveRangePos(moduleBlock.statements, -1); + } + } + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + currentNamespaceContainerName = savedCurrentNamespaceContainerName; + currentNamespace = savedCurrentNamespace; + currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; + var block = factory.createBlock( + ts6.setTextRange( + factory.createNodeArray(statements), + /*location*/ + statementsLocation + ), + /*multiLine*/ + true + ); + ts6.setTextRange(block, blockLocation); + if (!node.body || node.body.kind !== 265) { + ts6.setEmitFlags( + block, + ts6.getEmitFlags(block) | 1536 + /* EmitFlags.NoComments */ + ); + } + return block; + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 264) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function visitImportDeclaration(node) { + if (!node.importClause) { + return node; + } + if (node.importClause.isTypeOnly) { + return void 0; + } + var importClause = ts6.visitNode(node.importClause, visitImportClause, ts6.isImportClause); + return importClause || compilerOptions.importsNotUsedAsValues === 1 || compilerOptions.importsNotUsedAsValues === 2 ? factory.updateImportDeclaration( + node, + /*modifiers*/ + void 0, + importClause, + node.moduleSpecifier, + node.assertClause + ) : void 0; + } + function visitImportClause(node) { + ts6.Debug.assert(!node.isTypeOnly); + var name = shouldEmitAliasDeclaration(node) ? node.name : void 0; + var namedBindings = ts6.visitNode(node.namedBindings, visitNamedImportBindings, ts6.isNamedImportBindings); + return name || namedBindings ? factory.updateImportClause( + node, + /*isTypeOnly*/ + false, + name, + namedBindings + ) : void 0; + } + function visitNamedImportBindings(node) { + if (node.kind === 271) { + return shouldEmitAliasDeclaration(node) ? node : void 0; + } else { + var allowEmpty = compilerOptions.preserveValueImports && (compilerOptions.importsNotUsedAsValues === 1 || compilerOptions.importsNotUsedAsValues === 2); + var elements = ts6.visitNodes(node.elements, visitImportSpecifier, ts6.isImportSpecifier); + return allowEmpty || ts6.some(elements) ? factory.updateNamedImports(node, elements) : void 0; + } + } + function visitImportSpecifier(node) { + return !node.isTypeOnly && shouldEmitAliasDeclaration(node) ? node : void 0; + } + function visitExportAssignment(node) { + return resolver.isValueAliasDeclaration(node) ? ts6.visitEachChild(node, visitor, context) : void 0; + } + function visitExportDeclaration(node) { + if (node.isTypeOnly) { + return void 0; + } + if (!node.exportClause || ts6.isNamespaceExport(node.exportClause)) { + return node; + } + var allowEmpty = !!node.moduleSpecifier && (compilerOptions.importsNotUsedAsValues === 1 || compilerOptions.importsNotUsedAsValues === 2); + var exportClause = ts6.visitNode(node.exportClause, function(bindings) { + return visitNamedExportBindings(bindings, allowEmpty); + }, ts6.isNamedExportBindings); + return exportClause ? factory.updateExportDeclaration( + node, + /*modifiers*/ + void 0, + node.isTypeOnly, + exportClause, + node.moduleSpecifier, + node.assertClause + ) : void 0; + } + function visitNamedExports(node, allowEmpty) { + var elements = ts6.visitNodes(node.elements, visitExportSpecifier, ts6.isExportSpecifier); + return allowEmpty || ts6.some(elements) ? factory.updateNamedExports(node, elements) : void 0; + } + function visitNamespaceExports(node) { + return factory.updateNamespaceExport(node, ts6.visitNode(node.name, visitor, ts6.isIdentifier)); + } + function visitNamedExportBindings(node, allowEmpty) { + return ts6.isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty); + } + function visitExportSpecifier(node) { + return !node.isTypeOnly && resolver.isValueAliasDeclaration(node) ? node : void 0; + } + function shouldEmitImportEqualsDeclaration(node) { + return shouldEmitAliasDeclaration(node) || !ts6.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node); + } + function visitImportEqualsDeclaration(node) { + if (node.isTypeOnly) { + return void 0; + } + if (ts6.isExternalModuleImportEqualsDeclaration(node)) { + var isReferenced = shouldEmitAliasDeclaration(node); + if (!isReferenced && compilerOptions.importsNotUsedAsValues === 1) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createImportDeclaration( + /*modifiers*/ + void 0, + /*importClause*/ + void 0, + node.moduleReference.expression, + /*assertClause*/ + void 0 + ), node), node); + } + return isReferenced ? ts6.visitEachChild(node, visitor, context) : void 0; + } + if (!shouldEmitImportEqualsDeclaration(node)) { + return void 0; + } + var moduleReference = ts6.createExpressionFromEntityName(factory, node.moduleReference); + ts6.setEmitFlags( + moduleReference, + 1536 | 2048 + /* EmitFlags.NoNestedComments */ + ); + if (isNamedExternalModuleExport(node) || !isExportOfNamespace(node)) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createVariableStatement(ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), factory.createVariableDeclarationList([ + ts6.setOriginalNode(factory.createVariableDeclaration( + node.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + moduleReference + ), node) + ])), node), node); + } else { + return ts6.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node); + } + } + function isExportOfNamespace(node) { + return currentNamespace !== void 0 && ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ); + } + function isExternalModuleExport(node) { + return currentNamespace === void 0 && ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ); + } + function isNamedExternalModuleExport(node) { + return isExternalModuleExport(node) && !ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + ); + } + function isDefaultExternalModuleExport(node) { + return isExternalModuleExport(node) && ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + ); + } + function addExportMemberAssignment(statements, node) { + var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName( + currentNamespaceContainerName, + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ), factory.getLocalName(node)); + ts6.setSourceMapRange(expression, ts6.createRange(node.name ? node.name.pos : node.pos, node.end)); + var statement = factory.createExpressionStatement(expression); + ts6.setSourceMapRange(statement, ts6.createRange(-1, node.end)); + statements.push(statement); + } + function createNamespaceExport(exportName, exportValue, location) { + return ts6.setTextRange(factory.createExpressionStatement(factory.createAssignment(factory.getNamespaceMemberName( + currentNamespaceContainerName, + exportName, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ), exportValue)), location); + } + function createNamespaceExportExpression(exportName, exportValue, location) { + return ts6.setTextRange(factory.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location); + } + function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { + return factory.getNamespaceMemberName( + currentNamespaceContainerName, + name, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + } + function getNamespaceParameterName(node) { + var name = factory.getGeneratedNameForNode(node); + ts6.setSourceMapRange(name, node.name); + return name; + } + function getNamespaceContainerName(node) { + return factory.getGeneratedNameForNode(node); + } + function enableSubstitutionForNonQualifiedEnumMembers() { + if ((enabledSubstitutions & 8) === 0) { + enabledSubstitutions |= 8; + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + } + } + function enableSubstitutionForNamespaceExports() { + if ((enabledSubstitutions & 2) === 0) { + enabledSubstitutions |= 2; + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + context.enableSubstitution( + 300 + /* SyntaxKind.ShorthandPropertyAssignment */ + ); + context.enableEmitNotification( + 264 + /* SyntaxKind.ModuleDeclaration */ + ); + } + } + function isTransformedModuleDeclaration(node) { + return ts6.getOriginalNode(node).kind === 264; + } + function isTransformedEnumDeclaration(node) { + return ts6.getOriginalNode(node).kind === 263; + } + function onEmitNode(hint, node, emitCallback) { + var savedApplicableSubstitutions = applicableSubstitutions; + var savedCurrentSourceFile = currentSourceFile; + if (ts6.isSourceFile(node)) { + currentSourceFile = node; + } + if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) { + applicableSubstitutions |= 2; + } + if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) { + applicableSubstitutions |= 8; + } + previousOnEmitNode(hint, node, emitCallback); + applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { + return substituteExpression(node); + } else if (ts6.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } + return node; + } + function substituteShorthandPropertyAssignment(node) { + if (enabledSubstitutions & 2) { + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); + if (exportedName) { + if (node.objectAssignmentInitializer) { + var initializer = factory.createAssignment(exportedName, node.objectAssignmentInitializer); + return ts6.setTextRange(factory.createPropertyAssignment(name, initializer), node); + } + return ts6.setTextRange(factory.createPropertyAssignment(name, exportedName), node); + } + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 79: + return substituteExpressionIdentifier(node); + case 208: + return substitutePropertyAccessExpression(node); + case 209: + return substituteElementAccessExpression(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + return trySubstituteNamespaceExportedName(node) || node; + } + function trySubstituteNamespaceExportedName(node) { + if (enabledSubstitutions & applicableSubstitutions && !ts6.isGeneratedIdentifier(node) && !ts6.isLocalName(node)) { + var container = resolver.getReferencedExportContainer( + node, + /*prefixLocals*/ + false + ); + if (container && container.kind !== 308) { + var substitute = applicableSubstitutions & 2 && container.kind === 264 || applicableSubstitutions & 8 && container.kind === 263; + if (substitute) { + return ts6.setTextRange( + factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), + /*location*/ + node + ); + } + } + } + return void 0; + } + function substitutePropertyAccessExpression(node) { + return substituteConstantValue(node); + } + function substituteElementAccessExpression(node) { + return substituteConstantValue(node); + } + function safeMultiLineComment(value) { + return value.replace(/\*\//g, "*_/"); + } + function substituteConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== void 0) { + ts6.setConstantValue(node, constantValue); + var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue); + if (!compilerOptions.removeComments) { + var originalNode = ts6.getOriginalNode(node, ts6.isAccessExpression); + ts6.addSyntheticTrailingComment(substitute, 3, " ".concat(safeMultiLineComment(ts6.getTextOfNode(originalNode)), " ")); + } + return substitute; + } + return node; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return void 0; + } + return ts6.isPropertyAccessExpression(node) || ts6.isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0; + } + function shouldEmitAliasDeclaration(node) { + return ts6.isInJSFile(node) || (compilerOptions.preserveValueImports ? resolver.isValueAliasDeclaration(node) : resolver.isReferencedAliasDeclaration(node)); + } + } + ts6.transformTypeScript = transformTypeScript; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ClassPropertySubstitutionFlags; + (function(ClassPropertySubstitutionFlags2) { + ClassPropertySubstitutionFlags2[ClassPropertySubstitutionFlags2["ClassAliases"] = 1] = "ClassAliases"; + ClassPropertySubstitutionFlags2[ClassPropertySubstitutionFlags2["ClassStaticThisOrSuperReference"] = 2] = "ClassStaticThisOrSuperReference"; + })(ClassPropertySubstitutionFlags || (ClassPropertySubstitutionFlags = {})); + var PrivateIdentifierKind; + (function(PrivateIdentifierKind2) { + PrivateIdentifierKind2["Field"] = "f"; + PrivateIdentifierKind2["Method"] = "m"; + PrivateIdentifierKind2["Accessor"] = "a"; + })(PrivateIdentifierKind = ts6.PrivateIdentifierKind || (ts6.PrivateIdentifierKind = {})); + var ClassFacts; + (function(ClassFacts2) { + ClassFacts2[ClassFacts2["None"] = 0] = "None"; + ClassFacts2[ClassFacts2["ClassWasDecorated"] = 1] = "ClassWasDecorated"; + ClassFacts2[ClassFacts2["NeedsClassConstructorReference"] = 2] = "NeedsClassConstructorReference"; + ClassFacts2[ClassFacts2["NeedsClassSuperReference"] = 4] = "NeedsClassSuperReference"; + ClassFacts2[ClassFacts2["NeedsSubstitutionForThisInClassStaticField"] = 8] = "NeedsSubstitutionForThisInClassStaticField"; + })(ClassFacts || (ClassFacts = {})); + function transformClassFields(context) { + var factory = context.factory, hoistVariableDeclaration = context.hoistVariableDeclaration, endLexicalEnvironment = context.endLexicalEnvironment, startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, addBlockScopedVariable = context.addBlockScopedVariable; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var useDefineForClassFields = ts6.getUseDefineForClassFields(compilerOptions); + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9; + var shouldTransformAutoAccessors = languageVersion < 99; + var shouldTransformThisInStaticInitializers = languageVersion < 9; + var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2; + var shouldTransformAnything = shouldTransformInitializers || shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformAutoAccessors; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var enabledSubstitutions; + var classAliases; + var pendingExpressions; + var pendingStatements; + var classLexicalEnvironmentStack = []; + var classLexicalEnvironmentMap = new ts6.Map(); + var currentClassLexicalEnvironment; + var currentClassContainer; + var currentComputedPropertyNameClassLexicalEnvironment; + var currentStaticPropertyDeclarationOrStaticBlock; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile || !shouldTransformAnything) { + return node; + } + var visited = ts6.visitEachChild(node, visitor, context); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + if (!(node.transformFlags & 16777216) && !(node.transformFlags & 134234112)) { + return node; + } + switch (node.kind) { + case 127: + return shouldTransformAutoAccessors ? void 0 : node; + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 172: + return visitClassStaticBlockDeclaration(node); + case 169: + return visitPropertyDeclaration(node); + case 240: + return visitVariableStatement(node); + case 80: + return visitPrivateIdentifier(node); + case 208: + return visitPropertyAccessExpression(node); + case 209: + return visitElementAccessExpression(node); + case 221: + case 222: + return visitPreOrPostfixUnaryExpression( + node, + /*valueIsDiscarded*/ + false + ); + case 223: + return visitBinaryExpression( + node, + /*valueIsDiscarded*/ + false + ); + case 210: + return visitCallExpression(node); + case 241: + return visitExpressionStatement(node); + case 212: + return visitTaggedTemplateExpression(node); + case 245: + return visitForStatement(node); + case 259: + case 215: + case 173: + case 171: + case 174: + case 175: { + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ + void 0, + fallbackVisitor, + node + ); + } + default: + return fallbackVisitor(node); + } + } + function fallbackVisitor(node) { + return ts6.visitEachChild(node, visitor, context); + } + function discardedValueVisitor(node) { + switch (node.kind) { + case 221: + case 222: + return visitPreOrPostfixUnaryExpression( + node, + /*valueIsDiscarded*/ + true + ); + case 223: + return visitBinaryExpression( + node, + /*valueIsDiscarded*/ + true + ); + default: + return visitor(node); + } + } + function heritageClauseVisitor(node) { + switch (node.kind) { + case 294: + return ts6.visitEachChild(node, heritageClauseVisitor, context); + case 230: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); + } + } + function assignmentTargetVisitor(node) { + switch (node.kind) { + case 207: + case 206: + return visitAssignmentPattern(node); + default: + return visitor(node); + } + } + function classElementVisitor(node) { + switch (node.kind) { + case 173: + return visitConstructorDeclaration(node); + case 174: + case 175: + case 171: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ + void 0, + visitMethodOrAccessorDeclaration, + node + ); + case 169: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ + void 0, + visitPropertyDeclaration, + node + ); + case 164: + return visitComputedPropertyName(node); + case 237: + return node; + default: + return visitor(node); + } + } + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169: + return transformFieldInitializer(node); + case 174: + case 175: + return classElementVisitor(node); + default: + ts6.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } + function visitPrivateIdentifier(node) { + if (!shouldTransformPrivateElementsOrClassStaticBlocks) { + return node; + } + if (ts6.isStatement(node.parent)) { + return node; + } + return ts6.setOriginalNode(factory.createIdentifier(""), node); + } + function isPrivateIdentifierInExpression(node) { + return ts6.isPrivateIdentifier(node.left) && node.operatorToken.kind === 101; + } + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); + if (info) { + var receiver = ts6.visitNode(node.right, visitor, ts6.isExpression); + return ts6.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitVariableStatement(node) { + var savedPendingStatements = pendingStatements; + pendingStatements = []; + var visitedNode = ts6.visitEachChild(node, visitor, context); + var statement = ts6.some(pendingStatements) ? __spreadArray([visitedNode], pendingStatements, true) : visitedNode; + pendingStatements = savedPendingStatements; + return statement; + } + function visitComputedPropertyName(node) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + if (ts6.some(pendingExpressions)) { + if (ts6.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = void 0; + } + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); + } + function visitMethodOrAccessorDeclaration(node) { + ts6.Debug.assert(!ts6.hasDecorators(node)); + if (!shouldTransformPrivateElementsOrClassStaticBlocks || !ts6.isPrivateIdentifier(node.name)) { + return ts6.visitEachChild(node, classElementVisitor, context); + } + var info = accessPrivateIdentifier(node.name); + ts6.Debug.assert(info, "Undeclared private name for property declaration."); + if (!info.isValid) { + return node; + } + var functionName = getHoistedFunctionName(node); + if (functionName) { + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression( + ts6.filter(node.modifiers, function(m) { + return ts6.isModifier(m) && !ts6.isStaticModifier(m) && !ts6.isAccessorModifier(m); + }), + node.asteriskToken, + functionName, + /* typeParameters */ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /* type */ + void 0, + ts6.visitFunctionBody(node.body, visitor, context) + ))); + } + return void 0; + } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor2, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor2(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } + function getHoistedFunctionName(node) { + ts6.Debug.assert(ts6.isPrivateIdentifier(node.name)); + var info = accessPrivateIdentifier(node.name); + ts6.Debug.assert(info, "Undeclared private name for property declaration."); + if (info.kind === "m") { + return info.methodName; + } + if (info.kind === "a") { + if (ts6.isGetAccessor(node)) { + return info.getterName; + } + if (ts6.isSetAccessor(node)) { + return info.setterName; + } + } + } + function transformAutoAccessor(node) { + ts6.Debug.assertEachNode(node.modifiers, ts6.isModifier); + var commentRange = ts6.getCommentRange(node); + var sourceMapRange = ts6.getSourceMapRange(node); + var name = node.name; + var getterName = name; + var setterName = name; + if (ts6.isComputedPropertyName(name) && !ts6.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts6.setSourceMapRange(temp, name.expression); + var expression = ts6.visitNode(name.expression, visitor, ts6.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts6.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts6.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts6.setOriginalNode(backingField, node); + ts6.setEmitFlags( + backingField, + 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(backingField, sourceMapRange); + var getter = ts6.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts6.setOriginalNode(getter, node); + ts6.setCommentRange(getter, commentRange); + ts6.setSourceMapRange(getter, sourceMapRange); + var setter = ts6.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts6.setOriginalNode(setter, node); + ts6.setEmitFlags( + setter, + 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(setter, sourceMapRange); + return ts6.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts6.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var info = accessPrivateIdentifier(node.name); + ts6.Debug.assert(info, "Undeclared private name for property declaration."); + return info.isValid ? void 0 : node; + } + if (shouldTransformInitializersUsingSet && !ts6.isStatic(node)) { + return factory.updatePropertyDeclaration( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), + node.name, + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + var expr = getPropertyNameExpressionIfNeeded( + node.name, + /*shouldHoist*/ + !!node.initializer || useDefineForClassFields + ); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts6.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts6.setOriginalNode(staticBlock, node); + ts6.setCommentRange(staticBlock, node); + ts6.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts6.setSyntheticLeadingComments(initializerStatement, void 0); + ts6.setSyntheticTrailingComments(initializerStatement, void 0); + return staticBlock; + } + } + return void 0; + } + return ts6.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts6.Debug.assert(!ts6.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts6.isPrivateIdentifierClassElementDeclaration(node) ? transformPrivateFieldInitializer(node) : transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + if (shouldTransformAutoAccessors && ts6.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); + } + function createPrivateIdentifierAccess(info, receiver) { + return createPrivateIdentifierAccessHelper(info, ts6.visitNode(receiver, visitor, ts6.isExpression)); + } + function createPrivateIdentifierAccessHelper(info, receiver) { + ts6.setCommentRange(receiver, ts6.moveRangePos(receiver, -1)); + switch (info.kind) { + case "a": + return context.getEmitHelperFactory().createClassPrivateFieldGetHelper(receiver, info.brandCheckIdentifier, info.kind, info.getterName); + case "m": + return context.getEmitHelperFactory().createClassPrivateFieldGetHelper(receiver, info.brandCheckIdentifier, info.kind, info.methodName); + case "f": + return context.getEmitHelperFactory().createClassPrivateFieldGetHelper(receiver, info.brandCheckIdentifier, info.kind, info.variableName); + default: + ts6.Debug.assertNever(info, "Unknown private element type"); + } + } + function visitPropertyAccessExpression(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifier(node.name)) { + var privateIdentifierInfo = accessPrivateIdentifier(node.name); + if (privateIdentifierInfo) { + return ts6.setTextRange(ts6.setOriginalNode(createPrivateIdentifierAccess(privateIdentifierInfo, node.expression), node), node); + } + } + if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(node) && ts6.isIdentifier(node.name) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; + if (facts & 1) { + return visitInvalidSuperProperty(node); + } + if (classConstructor && superClassReference) { + var superProperty = factory.createReflectGetCall(superClassReference, factory.createStringLiteralFromNode(node.name), classConstructor); + ts6.setOriginalNode(superProperty, node.expression); + ts6.setTextRange(superProperty, node.expression); + return superProperty; + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitElementAccessExpression(node) { + if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(node) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; + if (facts & 1) { + return visitInvalidSuperProperty(node); + } + if (classConstructor && superClassReference) { + var superProperty = factory.createReflectGetCall(superClassReference, ts6.visitNode(node.argumentExpression, visitor, ts6.isExpression), classConstructor); + ts6.setOriginalNode(superProperty, node.expression); + ts6.setTextRange(superProperty, node.expression); + return superProperty; + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { + if (node.operator === 45 || node.operator === 46) { + var operand = ts6.skipParentheses(node.operand); + if (shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifierPropertyAccessExpression(operand)) { + var info = void 0; + if (info = accessPrivateIdentifier(operand.name)) { + var receiver = ts6.visitNode(operand.expression, visitor, ts6.isExpression); + var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression; + var expression = createPrivateIdentifierAccess(info, readExpression); + var temp = ts6.isPrefixUnaryExpression(node) || valueIsDiscarded ? void 0 : factory.createTempVariable(hoistVariableDeclaration); + expression = ts6.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp); + expression = createPrivateIdentifierAssignment( + info, + initializeExpression || readExpression, + expression, + 63 + /* SyntaxKind.EqualsToken */ + ); + ts6.setOriginalNode(expression, node); + ts6.setTextRange(expression, node); + if (temp) { + expression = factory.createComma(expression, temp); + ts6.setTextRange(expression, node); + } + return expression; + } + } else if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(operand) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; + if (facts & 1) { + var expression = visitInvalidSuperProperty(operand); + return ts6.isPrefixUnaryExpression(node) ? factory.updatePrefixUnaryExpression(node, expression) : factory.updatePostfixUnaryExpression(node, expression); + } + if (classConstructor && superClassReference) { + var setterName = void 0; + var getterName = void 0; + if (ts6.isPropertyAccessExpression(operand)) { + if (ts6.isIdentifier(operand.name)) { + getterName = setterName = factory.createStringLiteralFromNode(operand.name); + } + } else { + if (ts6.isSimpleInlineableExpression(operand.argumentExpression)) { + getterName = setterName = operand.argumentExpression; + } else { + getterName = factory.createTempVariable(hoistVariableDeclaration); + setterName = factory.createAssignment(getterName, ts6.visitNode(operand.argumentExpression, visitor, ts6.isExpression)); + } + } + if (setterName && getterName) { + var expression = factory.createReflectGetCall(superClassReference, getterName, classConstructor); + ts6.setTextRange(expression, operand); + var temp = valueIsDiscarded ? void 0 : factory.createTempVariable(hoistVariableDeclaration); + expression = ts6.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp); + expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor); + ts6.setOriginalNode(expression, node); + ts6.setTextRange(expression, node); + if (temp) { + expression = factory.createComma(expression, temp); + ts6.setTextRange(expression, node); + } + return expression; + } + } + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return factory.updateForStatement(node, ts6.visitNode(node.initializer, discardedValueVisitor, ts6.isForInitializer), ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, discardedValueVisitor, ts6.isExpression), ts6.visitIterationBody(node.statement, visitor, context)); + } + function visitExpressionStatement(node) { + return factory.updateExpressionStatement(node, ts6.visitNode(node.expression, discardedValueVisitor, ts6.isExpression)); + } + function createCopiableReceiverExpr(receiver) { + var clone = ts6.nodeIsSynthesized(receiver) ? receiver : factory.cloneNode(receiver); + if (ts6.isSimpleInlineableExpression(receiver)) { + return { readExpression: clone, initializeExpression: void 0 }; + } + var readExpression = factory.createTempVariable(hoistVariableDeclaration); + var initializeExpression = factory.createAssignment(readExpression, clone); + return { readExpression, initializeExpression }; + } + function visitCallExpression(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; + if (ts6.isCallChain(node)) { + return factory.updateCallChain( + node, + factory.createPropertyAccessChain(ts6.visitNode(target, visitor), node.questionDotToken, "call"), + /*questionDotToken*/ + void 0, + /*typeArguments*/ + void 0, + __spreadArray([ts6.visitNode(thisArg, visitor, ts6.isExpression)], ts6.visitNodes(node.arguments, visitor, ts6.isExpression), true) + ); + } + return factory.updateCallExpression( + node, + factory.createPropertyAccessExpression(ts6.visitNode(target, visitor), "call"), + /*typeArguments*/ + void 0, + __spreadArray([ts6.visitNode(thisArg, visitor, ts6.isExpression)], ts6.visitNodes(node.arguments, visitor, ts6.isExpression), true) + ); + } + if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + var invocation = factory.createFunctionCallCall(ts6.visitNode(node.expression, visitor, ts6.isExpression), currentClassLexicalEnvironment.classConstructor, ts6.visitNodes(node.arguments, visitor, ts6.isExpression)); + ts6.setOriginalNode(invocation, node); + ts6.setTextRange(invocation, node); + return invocation; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitTaggedTemplateExpression(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; + return factory.updateTaggedTemplateExpression( + node, + factory.createCallExpression( + factory.createPropertyAccessExpression(ts6.visitNode(target, visitor), "bind"), + /*typeArguments*/ + void 0, + [ts6.visitNode(thisArg, visitor, ts6.isExpression)] + ), + /*typeArguments*/ + void 0, + ts6.visitNode(node.template, visitor, ts6.isTemplateLiteral) + ); + } + if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(node.tag) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + var invocation = factory.createFunctionBindCall(ts6.visitNode(node.tag, visitor, ts6.isExpression), currentClassLexicalEnvironment.classConstructor, []); + ts6.setOriginalNode(invocation, node); + ts6.setTextRange(invocation, node); + return factory.updateTaggedTemplateExpression( + node, + invocation, + /*typeArguments*/ + void 0, + ts6.visitNode(node.template, visitor, ts6.isTemplateLiteral) + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function transformClassStaticBlockDeclaration(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + if (currentClassLexicalEnvironment) { + classLexicalEnvironmentMap.set(ts6.getOriginalNodeId(node), currentClassLexicalEnvironment); + } + startLexicalEnvironment(); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function(statements2) { + return ts6.visitNodes(statements2, visitor, ts6.isStatement); + }, node.body.statements); + statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + var iife = factory.createImmediatelyInvokedArrowFunction(statements); + ts6.setOriginalNode(iife, node); + ts6.setTextRange(iife, node); + ts6.addEmitFlags( + iife, + 2 + /* EmitFlags.AdviseOnEmitNode */ + ); + return iife; + } + } + function visitBinaryExpression(node, valueIsDiscarded) { + if (ts6.isDestructuringAssignment(node)) { + var savedPendingExpressions = pendingExpressions; + pendingExpressions = void 0; + node = factory.updateBinaryExpression(node, ts6.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts6.visitNode(node.right, visitor)); + var expr = ts6.some(pendingExpressions) ? factory.inlineExpressions(ts6.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; + pendingExpressions = savedPendingExpressions; + return expr; + } + if (ts6.isAssignmentExpression(node)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifierPropertyAccessExpression(node.left)) { + var info = accessPrivateIdentifier(node.left.name); + if (info) { + return ts6.setTextRange(ts6.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); + } + } else if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; + if (facts & 1) { + return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts6.visitNode(node.right, visitor, ts6.isExpression)); + } + if (classConstructor && superClassReference) { + var setterName = ts6.isElementAccessExpression(node.left) ? ts6.visitNode(node.left.argumentExpression, visitor, ts6.isExpression) : ts6.isIdentifier(node.left.name) ? factory.createStringLiteralFromNode(node.left.name) : void 0; + if (setterName) { + var expression = ts6.visitNode(node.right, visitor, ts6.isExpression); + if (ts6.isCompoundAssignment(node.operatorToken.kind)) { + var getterName = setterName; + if (!ts6.isSimpleInlineableExpression(setterName)) { + getterName = factory.createTempVariable(hoistVariableDeclaration); + setterName = factory.createAssignment(getterName, setterName); + } + var superPropertyGet = factory.createReflectGetCall(superClassReference, getterName, classConstructor); + ts6.setOriginalNode(superPropertyGet, node.left); + ts6.setTextRange(superPropertyGet, node.left); + expression = factory.createBinaryExpression(superPropertyGet, ts6.getNonAssignmentOperatorForCompoundAssignment(node.operatorToken.kind), expression); + ts6.setTextRange(expression, node); + } + var temp = valueIsDiscarded ? void 0 : factory.createTempVariable(hoistVariableDeclaration); + if (temp) { + expression = factory.createAssignment(temp, expression); + ts6.setTextRange(temp, node); + } + expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor); + ts6.setOriginalNode(expression, node); + ts6.setTextRange(expression, node); + if (temp) { + expression = factory.createComma(expression, temp); + ts6.setTextRange(expression, node); + } + return expression; + } + } + } + } + if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierInExpression(node)) { + return transformPrivateIdentifierInInExpression(node); + } + return ts6.visitEachChild(node, visitor, context); + } + function createPrivateIdentifierAssignment(info, receiver, right, operator) { + receiver = ts6.visitNode(receiver, visitor, ts6.isExpression); + right = ts6.visitNode(right, visitor, ts6.isExpression); + if (ts6.isCompoundAssignment(operator)) { + var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression; + receiver = initializeExpression || readExpression; + right = factory.createBinaryExpression(createPrivateIdentifierAccessHelper(info, readExpression), ts6.getNonAssignmentOperatorForCompoundAssignment(operator), right); + } + ts6.setCommentRange(receiver, ts6.moveRangePos(receiver, -1)); + switch (info.kind) { + case "a": + return context.getEmitHelperFactory().createClassPrivateFieldSetHelper(receiver, info.brandCheckIdentifier, right, info.kind, info.setterName); + case "m": + return context.getEmitHelperFactory().createClassPrivateFieldSetHelper( + receiver, + info.brandCheckIdentifier, + right, + info.kind, + /* f */ + void 0 + ); + case "f": + return context.getEmitHelperFactory().createClassPrivateFieldSetHelper(receiver, info.brandCheckIdentifier, right, info.kind, info.variableName); + default: + ts6.Debug.assertNever(info, "Unknown private element type"); + } + } + function getPrivateInstanceMethodsAndAccessors(node) { + return ts6.filter(node.members, ts6.isNonStaticMethodOrAccessorWithPrivateName); + } + function getClassFacts(node) { + var facts = 0; + var original = ts6.getOriginalNode(node); + if (ts6.isClassDeclaration(original) && ts6.classOrConstructorParameterIsDecorated(original)) { + facts |= 1; + } + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (!ts6.isStatic(member)) + continue; + if (member.name && (ts6.isPrivateIdentifier(member.name) || ts6.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { + facts |= 2; + } + if (ts6.isPropertyDeclaration(member) || ts6.isClassStaticBlockDeclaration(member)) { + if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384) { + facts |= 8; + if (!(facts & 1)) { + facts |= 2; + } + } + if (shouldTransformSuperInStaticInitializers && member.transformFlags & 134217728) { + if (!(facts & 1)) { + facts |= 2 | 4; + } + } + } + } + return facts; + } + function visitExpressionWithTypeArgumentsInHeritageClause(node) { + var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0; + if (facts & 4) { + var temp = factory.createTempVariable( + hoistVariableDeclaration, + /*reserveInNestedScopes*/ + true + ); + getClassLexicalEnvironment().superClassReference = temp; + return factory.updateExpressionWithTypeArguments( + node, + factory.createAssignment(temp, ts6.visitNode(node.expression, visitor, ts6.isExpression)), + /*typeArguments*/ + void 0 + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitInNewClassLexicalEnvironment(node, visitor2) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = void 0; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts6.getNameOfDeclaration(node); + if (name && ts6.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts6.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } + var facts = getClassFacts(node); + if (facts) { + getClassLexicalEnvironment().facts = facts; + } + if (facts & 8) { + enableSubstitutionForClassStaticThisOrSuperReference(); + } + var result = visitor2(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { + var pendingClassReferenceAssignment; + if (facts & 2) { + var temp = factory.createTempVariable( + hoistVariableDeclaration, + /*reservedInNestedScopes*/ + true + ); + getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); + pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); + } + var modifiers = ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike); + var heritageClauses = ts6.visitNodes(node.heritageClauses, heritageClauseVisitor, ts6.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration( + node, + modifiers, + node.name, + /*typeParameters*/ + void 0, + heritageClauses, + members + ); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); + if (pendingClassReferenceAssignment) { + getPendingExpressions().unshift(pendingClassReferenceAssignment); + } + if (ts6.some(pendingExpressions)) { + statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); + } + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + var staticProperties = ts6.getStaticPropertiesAndClassStaticBlock(node); + if (ts6.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } + } + return statements; + } + function visitClassExpression(node) { + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { + var isDecoratedClassDeclaration = !!(facts & 1); + var staticPropertiesOrClassStaticBlocks = ts6.getStaticPropertiesAndClassStaticBlock(node); + var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216; + var temp; + function createClassTempVar() { + var classCheckFlags = resolver.getNodeCheckFlags(node); + var isClassWithConstructorReference2 = classCheckFlags & 16777216; + var requiresBlockScopedVar = classCheckFlags & 524288; + return factory.createTempVariable(requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, !!isClassWithConstructorReference2); + } + if (facts & 2) { + temp = createClassTempVar(); + getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); + } + var modifiers = ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike); + var heritageClauses = ts6.visitNodes(node.heritageClauses, heritageClauseVisitor, ts6.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression( + node, + modifiers, + node.name, + /*typeParameters*/ + void 0, + heritageClauses, + members + ); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts6.some(staticPropertiesOrClassStaticBlocks, function(node2) { + return ts6.isClassStaticBlockDeclaration(node2) || ts6.isPrivateIdentifierClassElementDeclaration(node2) || shouldTransformInitializers && ts6.isInitializedProperty(node2); + }); + if (hasTransformableStatics || ts6.some(pendingExpressions)) { + if (isDecoratedClassDeclaration) { + ts6.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); + if (pendingStatements && pendingExpressions && ts6.some(pendingExpressions)) { + pendingStatements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); + } + if (pendingStatements && ts6.some(staticPropertiesOrClassStaticBlocks)) { + addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); + } + if (temp) { + expressions.push(ts6.startOnNewLine(factory.createAssignment(temp, classExpression)), ts6.startOnNewLine(temp)); + } else { + expressions.push(classExpression); + if (prologue) { + ts6.startOnNewLine(classExpression); + } + } + } else { + temp || (temp = createClassTempVar()); + if (isClassWithConstructorReference) { + enableSubstitutionForClassAliases(); + var alias = factory.cloneNode(temp); + alias.autoGenerateFlags &= ~8; + classAliases[ts6.getOriginalNodeId(node)] = alias; + } + ts6.setEmitFlags(classExpression, 65536 | ts6.getEmitFlags(classExpression)); + expressions.push(ts6.startOnNewLine(factory.createAssignment(temp, classExpression))); + ts6.addRange(expressions, ts6.map(pendingExpressions, ts6.startOnNewLine)); + ts6.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); + expressions.push(ts6.startOnNewLine(temp)); + } + } else { + expressions.push(classExpression); + if (prologue) { + ts6.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); + } + function visitClassStaticBlockDeclaration(node) { + if (!shouldTransformPrivateElementsOrClassStaticBlocks) { + return ts6.visitEachChild(node, visitor, context); + } + return void 0; + } + function transformClassMembers(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (ts6.isPrivateIdentifierClassElementDeclaration(member)) { + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); + } + } + if (ts6.some(getPrivateInstanceMethodsAndAccessors(node))) { + createBrandCheckWeakSetForPrivateMethods(); + } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts6.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode( + member.name, + /*prefix*/ + void 0, + "_accessor_storage" + ); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } + } + var members = ts6.visitNodes(node.members, classElementVisitor, ts6.isClassElement); + var syntheticConstructor; + if (!ts6.some(members, ts6.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor( + /*constructor*/ + void 0, + node + ); + } + var prologue; + var syntheticStaticBlock; + if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts6.some(pendingExpressions)) { + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + /*equalsGreaterThanToken*/ + void 0, + factory.createBlock([statement]) + ); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression( + temp, + /*typeArguments*/ + void 0, + [] + )); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); + pendingExpressions = void 0; + } + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts6.append(membersArray, syntheticConstructor); + membersArray = ts6.append(membersArray, syntheticStaticBlock); + membersArray = ts6.addRange(membersArray, members); + members = ts6.setTextRange( + factory.createNodeArray(membersArray), + /*location*/ + node.members + ); + } + return { members, prologue }; + } + function createBrandCheckWeakSetForPrivateMethods() { + var weakSetName = getPrivateIdentifierEnvironment().weakSetName; + ts6.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); + getPendingExpressions().push(factory.createAssignment(weakSetName, factory.createNewExpression( + factory.createIdentifier("WeakSet"), + /*typeArguments*/ + void 0, + [] + ))); + } + function isClassElementThatRequiresConstructorStatement(member) { + if (ts6.isStatic(member) || ts6.hasAbstractModifier(ts6.getOriginalNode(member))) { + return false; + } + return shouldTransformInitializersUsingDefine && ts6.isPropertyDeclaration(member) || shouldTransformInitializersUsingSet && ts6.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifierClassElementDeclaration(member) || shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts6.isAutoAccessorPropertyDeclaration(member); + } + function transformConstructor(constructor, container) { + constructor = ts6.visitNode(constructor, visitor, ts6.isConstructorDeclaration); + if (!ts6.some(container.members, isClassElementThatRequiresConstructorStatement)) { + return constructor; + } + var extendsClauseElement = ts6.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts6.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); + var parameters = ts6.visitParameterList(constructor ? constructor.parameters : void 0, visitor, context); + var body = transformConstructorBody(container, constructor, isDerivedClass); + if (!body) { + return constructor; + } + if (constructor) { + ts6.Debug.assert(parameters); + return factory.updateConstructorDeclaration( + constructor, + /*modifiers*/ + void 0, + parameters, + body + ); + } + return ts6.startOnNewLine(ts6.setOriginalNode(ts6.setTextRange(factory.createConstructorDeclaration( + /*modifiers*/ + void 0, + parameters !== null && parameters !== void 0 ? parameters : [], + body + ), constructor || container), constructor)); + } + function transformConstructorBody(node, constructor, isDerivedClass) { + var _a, _b; + var properties = ts6.getProperties( + node, + /*requireInitializer*/ + false, + /*isStatic*/ + false + ); + if (!useDefineForClassFields) { + properties = ts6.filter(properties, function(property) { + return !!property.initializer || ts6.isPrivateIdentifier(property.name) || ts6.hasAccessorModifier(property); + }); + } + var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + var needsConstructorBody = ts6.some(properties) || ts6.some(privateMethodsAndAccessors); + if (!constructor && !needsConstructorBody) { + return ts6.visitFunctionBody( + /*node*/ + void 0, + visitor, + context + ); + } + resumeLexicalEnvironment(); + var needsSyntheticConstructor = !constructor && isDerivedClass; + var indexOfFirstStatementAfterSuperAndPrologue = 0; + var prologueStatementCount = 0; + var superStatementIndex = -1; + var statements = []; + if ((_a = constructor === null || constructor === void 0 ? void 0 : constructor.body) === null || _a === void 0 ? void 0 : _a.statements) { + prologueStatementCount = factory.copyPrologue( + constructor.body.statements, + statements, + /*ensureUseStrict*/ + false, + visitor + ); + superStatementIndex = ts6.findSuperStatementIndex(constructor.body.statements, prologueStatementCount); + if (superStatementIndex >= 0) { + indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1; + statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts6.visitNodes(constructor.body.statements, visitor, ts6.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true); + } else if (prologueStatementCount >= 0) { + indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount; + } + } + if (needsSyntheticConstructor) { + statements.push(factory.createExpressionStatement(factory.createCallExpression( + factory.createSuper(), + /*typeArguments*/ + void 0, + [factory.createSpreadElement(factory.createIdentifier("arguments"))] + ))); + } + var parameterPropertyDeclarationCount = 0; + if (constructor === null || constructor === void 0 ? void 0 : constructor.body) { + if (useDefineForClassFields) { + statements = statements.filter(function(statement2) { + return !ts6.isParameterPropertyDeclaration(ts6.getOriginalNode(statement2), constructor); + }); + } else { + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; + if (ts6.isParameterPropertyDeclaration(ts6.getOriginalNode(statement), constructor)) { + parameterPropertyDeclarationCount++; + } + } + if (parameterPropertyDeclarationCount > 0) { + var parameterProperties = ts6.visitNodes(constructor.body.statements, visitor, ts6.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount); + if (superStatementIndex >= 0) { + ts6.addRange(statements, parameterProperties); + } else { + var superAndPrologueStatementCount = prologueStatementCount; + if (needsSyntheticConstructor) + superAndPrologueStatementCount++; + statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true); + } + indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount; + } + } + } + var receiver = factory.createThis(); + addMethodStatements(statements, privateMethodsAndAccessors, receiver); + addPropertyOrClassStaticBlockStatements(statements, properties, receiver); + if (constructor) { + ts6.addRange(statements, ts6.visitNodes(constructor.body.statements, visitBodyStatement, ts6.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); + } + statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return void 0; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : statements.length > 0; + return ts6.setTextRange( + factory.createBlock(ts6.setTextRange( + factory.createNodeArray(statements), + /*location*/ + constructor ? constructor.body.statements : node.members + ), multiLine), + /*location*/ + constructor ? constructor.body : void 0 + ); + function visitBodyStatement(statement2) { + if (useDefineForClassFields && ts6.isParameterPropertyDeclaration(ts6.getOriginalNode(statement2), constructor)) { + return void 0; + } + return visitor(statement2); + } + } + function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) { + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var property = properties_7[_i]; + if (ts6.isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { + continue; + } + var statement = transformPropertyOrClassStaticBlock(property, receiver); + if (!statement) { + continue; + } + statements.push(statement); + } + } + function transformPropertyOrClassStaticBlock(property, receiver) { + var expression = ts6.isClassStaticBlockDeclaration(property) ? transformClassStaticBlockDeclaration(property) : transformProperty(property, receiver); + if (!expression) { + return void 0; + } + var statement = factory.createExpressionStatement(expression); + ts6.setOriginalNode(statement, property); + ts6.addEmitFlags( + statement, + ts6.getEmitFlags(property) & 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(statement, ts6.moveRangePastModifiers(property)); + ts6.setCommentRange(statement, property); + ts6.setSyntheticLeadingComments(expression, void 0); + ts6.setSyntheticTrailingComments(expression, void 0); + return statement; + } + function generateInitializedPropertyExpressionsOrClassStaticBlock(propertiesOrClassStaticBlocks, receiver) { + var expressions = []; + for (var _i = 0, propertiesOrClassStaticBlocks_1 = propertiesOrClassStaticBlocks; _i < propertiesOrClassStaticBlocks_1.length; _i++) { + var property = propertiesOrClassStaticBlocks_1[_i]; + var expression = ts6.isClassStaticBlockDeclaration(property) ? transformClassStaticBlockDeclaration(property) : transformProperty(property, receiver); + if (!expression) { + continue; + } + ts6.startOnNewLine(expression); + ts6.setOriginalNode(expression, property); + ts6.addEmitFlags( + expression, + ts6.getEmitFlags(property) & 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(expression, ts6.moveRangePastModifiers(property)); + ts6.setCommentRange(expression, property); + expressions.push(expression); + } + return expressions; + } + function transformProperty(property, receiver) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + var transformed = transformPropertyWorker(property, receiver); + if (transformed && ts6.hasStaticModifier(property) && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts)) { + ts6.setOriginalNode(transformed, property); + ts6.addEmitFlags( + transformed, + 2 + /* EmitFlags.AdviseOnEmitNode */ + ); + classLexicalEnvironmentMap.set(ts6.getOriginalNodeId(transformed), currentClassLexicalEnvironment); + } + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return transformed; + } + function transformPropertyWorker(property, receiver) { + var _a; + var emitAssignment = !useDefineForClassFields; + var propertyName = ts6.hasAccessorModifier(property) ? factory.getGeneratedPrivateNameForNode(property.name) : ts6.isComputedPropertyName(property.name) && !ts6.isSimpleInlineableExpression(property.name.expression) ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : property.name; + if (ts6.hasStaticModifier(property)) { + currentStaticPropertyDeclarationOrStaticBlock = property; + } + if (shouldTransformPrivateElementsOrClassStaticBlocks && ts6.isPrivateIdentifier(propertyName)) { + var privateIdentifierInfo = accessPrivateIdentifier(propertyName); + if (privateIdentifierInfo) { + if (privateIdentifierInfo.kind === "f") { + if (!privateIdentifierInfo.isStatic) { + return createPrivateInstanceFieldInitializer(receiver, ts6.visitNode(property.initializer, visitor, ts6.isExpression), privateIdentifierInfo.brandCheckIdentifier); + } else { + return createPrivateStaticFieldInitializer(privateIdentifierInfo.variableName, ts6.visitNode(property.initializer, visitor, ts6.isExpression)); + } + } else { + return void 0; + } + } else { + ts6.Debug.fail("Undeclared private name for property declaration."); + } + } + if ((ts6.isPrivateIdentifier(propertyName) || ts6.hasStaticModifier(property)) && !property.initializer) { + return void 0; + } + var propertyOriginalNode = ts6.getOriginalNode(property); + if (ts6.hasSyntacticModifier( + propertyOriginalNode, + 256 + /* ModifierFlags.Abstract */ + )) { + return void 0; + } + var initializer = property.initializer || emitAssignment ? (_a = ts6.visitNode(property.initializer, visitor, ts6.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() : ts6.isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && ts6.isIdentifier(propertyName) ? propertyName : factory.createVoidZero(); + if (emitAssignment || ts6.isPrivateIdentifier(propertyName)) { + var memberAccess = ts6.createMemberAccessForPropertyName( + factory, + receiver, + propertyName, + /*location*/ + propertyName + ); + return factory.createAssignment(memberAccess, initializer); + } else { + var name = ts6.isComputedPropertyName(propertyName) ? propertyName.expression : ts6.isIdentifier(propertyName) ? factory.createStringLiteral(ts6.unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; + var descriptor = factory.createPropertyDescriptor({ value: initializer, configurable: true, writable: true, enumerable: true }); + return factory.createObjectDefinePropertyCall(receiver, name, descriptor); + } + } + function enableSubstitutionForClassAliases() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + classAliases = []; + } + } + function enableSubstitutionForClassStaticThisOrSuperReference() { + if ((enabledSubstitutions & 2) === 0) { + enabledSubstitutions |= 2; + context.enableSubstitution( + 108 + /* SyntaxKind.ThisKeyword */ + ); + context.enableEmitNotification( + 259 + /* SyntaxKind.FunctionDeclaration */ + ); + context.enableEmitNotification( + 215 + /* SyntaxKind.FunctionExpression */ + ); + context.enableEmitNotification( + 173 + /* SyntaxKind.Constructor */ + ); + context.enableEmitNotification( + 174 + /* SyntaxKind.GetAccessor */ + ); + context.enableEmitNotification( + 175 + /* SyntaxKind.SetAccessor */ + ); + context.enableEmitNotification( + 171 + /* SyntaxKind.MethodDeclaration */ + ); + context.enableEmitNotification( + 169 + /* SyntaxKind.PropertyDeclaration */ + ); + context.enableEmitNotification( + 164 + /* SyntaxKind.ComputedPropertyName */ + ); + } + } + function addMethodStatements(statements, methods, receiver) { + if (!shouldTransformPrivateElementsOrClassStaticBlocks || !ts6.some(methods)) { + return; + } + var weakSetName = getPrivateIdentifierEnvironment().weakSetName; + ts6.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); + statements.push(factory.createExpressionStatement(createPrivateInstanceMethodInitializer(receiver, weakSetName))); + } + function visitInvalidSuperProperty(node) { + return ts6.isPropertyAccessExpression(node) ? factory.updatePropertyAccessExpression(node, factory.createVoidZero(), node.name) : factory.updateElementAccessExpression(node, factory.createVoidZero(), ts6.visitNode(node.argumentExpression, visitor, ts6.isExpression)); + } + function onEmitNode(hint, node, emitCallback) { + var original = ts6.getOriginalNode(node); + if (original.id) { + var classLexicalEnvironment = classLexicalEnvironmentMap.get(original.id); + if (classLexicalEnvironment) { + var savedClassLexicalEnvironment = currentClassLexicalEnvironment; + var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; + currentClassLexicalEnvironment = classLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = classLexicalEnvironment; + previousOnEmitNode(hint, node, emitCallback); + currentClassLexicalEnvironment = savedClassLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; + return; + } + } + switch (node.kind) { + case 215: + if (ts6.isArrowFunction(original) || ts6.getEmitFlags(node) & 262144) { + break; + } + case 259: + case 173: { + var savedClassLexicalEnvironment = currentClassLexicalEnvironment; + var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; + currentClassLexicalEnvironment = void 0; + currentComputedPropertyNameClassLexicalEnvironment = void 0; + previousOnEmitNode(hint, node, emitCallback); + currentClassLexicalEnvironment = savedClassLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; + return; + } + case 174: + case 175: + case 171: + case 169: { + var savedClassLexicalEnvironment = currentClassLexicalEnvironment; + var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; + currentClassLexicalEnvironment = void 0; + previousOnEmitNode(hint, node, emitCallback); + currentClassLexicalEnvironment = savedClassLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; + return; + } + case 164: { + var savedClassLexicalEnvironment = currentClassLexicalEnvironment; + var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; + currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = void 0; + previousOnEmitNode(hint, node, emitCallback); + currentClassLexicalEnvironment = savedClassLexicalEnvironment; + currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 79: + return substituteExpressionIdentifier(node); + case 108: + return substituteThisExpression(node); + } + return node; + } + function substituteThisExpression(node) { + if (enabledSubstitutions & 2 && currentClassLexicalEnvironment) { + var facts = currentClassLexicalEnvironment.facts, classConstructor = currentClassLexicalEnvironment.classConstructor; + if (facts & 1) { + return factory.createParenthesizedExpression(factory.createVoidZero()); + } + if (classConstructor) { + return ts6.setTextRange(ts6.setOriginalNode(factory.cloneNode(classConstructor), node), node); + } + } + return node; + } + function substituteExpressionIdentifier(node) { + return trySubstituteClassAlias(node) || node; + } + function trySubstituteClassAlias(node) { + if (enabledSubstitutions & 1) { + if (resolver.getNodeCheckFlags(node) & 33554432) { + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = classAliases[declaration.id]; + if (classAlias) { + var clone_2 = factory.cloneNode(classAlias); + ts6.setSourceMapRange(clone_2, node); + ts6.setCommentRange(clone_2, node); + return clone_2; + } + } + } + } + return void 0; + } + function getPropertyNameExpressionIfNeeded(name, shouldHoist) { + if (ts6.isComputedPropertyName(name)) { + var expression = ts6.visitNode(name.expression, visitor, ts6.isExpression); + var innerExpression = ts6.skipPartiallyEmittedExpressions(expression); + var inlinable = ts6.isSimpleInlineableExpression(innerExpression); + var alreadyTransformed = ts6.isAssignmentExpression(innerExpression) && ts6.isGeneratedIdentifier(innerExpression.left); + if (!alreadyTransformed && !inlinable && shouldHoist) { + var generatedName = factory.getGeneratedNameForNode(name); + if (resolver.getNodeCheckFlags(name) & 524288) { + addBlockScopedVariable(generatedName); + } else { + hoistVariableDeclaration(generatedName); + } + return factory.createAssignment(generatedName, expression); + } + return inlinable || ts6.isIdentifier(innerExpression) ? void 0 : expression; + } + } + function startClassLexicalEnvironment() { + classLexicalEnvironmentStack.push(currentClassLexicalEnvironment); + currentClassLexicalEnvironment = void 0; + } + function endClassLexicalEnvironment() { + currentClassLexicalEnvironment = classLexicalEnvironmentStack.pop(); + } + function getClassLexicalEnvironment() { + return currentClassLexicalEnvironment || (currentClassLexicalEnvironment = { + facts: 0, + classConstructor: void 0, + superClassReference: void 0, + privateIdentifierEnvironment: void 0 + }); + } + function getPrivateIdentifierEnvironment() { + var lex = getClassLexicalEnvironment(); + lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { + className: void 0, + weakSetName: void 0, + identifiers: void 0, + generatedIdentifiers: void 0 + }); + return lex.privateIdentifierEnvironment; + } + function getPendingExpressions() { + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : pendingExpressions = []; + } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts6.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } else if (ts6.isPropertyDeclaration(node)) { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } else if (ts6.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } else if (ts6.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } else if (ts6.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts6.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f", + brandCheckIdentifier: lex.classConstructor, + variableName, + isStatic: true, + isValid + }); + } else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f", + brandCheckIdentifier: weakMapName, + variableName: void 0, + isStatic: false, + isValid + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression( + factory.createIdentifier("WeakMap"), + /*typeArguments*/ + void 0, + [] + ))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? ts6.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : ts6.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m", + methodName, + brandCheckIdentifier, + isStatic, + isValid + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? ts6.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : ts6.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } else { + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName, + setterName: void 0, + brandCheckIdentifier, + isStatic, + isValid + }); + } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? ts6.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : ts6.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } else { + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: void 0, + setterName, + brandCheckIdentifier, + isStatic, + isValid + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? ts6.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : ts6.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName, + setterName, + brandCheckIdentifier, + isStatic, + isValid + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts6.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === void 0; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { + var className = getPrivateIdentifierEnvironment().className; + var prefix2 = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 | 8, prefix2, suffix) : typeof name === "string" ? factory.createUniqueName(name, 16, prefix2, suffix) : factory.createTempVariable( + /*recordTempVariable*/ + void 0, + /*reserveInNestedScopes*/ + true, + prefix2, + suffix + ); + if (resolver.getNodeCheckFlags(node) & 524288) { + addBlockScopedVariable(identifier); + } else { + hoistVariableDeclaration(identifier); + } + return identifier; + } + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts6.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); + } + function accessPrivateIdentifier(name) { + if (ts6.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts6.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo2, privateIdentifierKey) { + if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo2(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } + } + for (var i = classLexicalEnvironmentStack.length - 1; i >= 0; --i) { + var env = classLexicalEnvironmentStack[i]; + if (!env) { + continue; + } + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo2(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } + } + } + return void 0; + } + function wrapPrivateIdentifierForDestructuringTarget(node) { + var parameter = factory.getGeneratedNameForNode(node); + var info = accessPrivateIdentifier(node.name); + if (!info) { + return ts6.visitEachChild(node, visitor, context); + } + var receiver = node.expression; + if (ts6.isThisProperty(node) || ts6.isSuperProperty(node) || !ts6.isSimpleCopiableExpression(node.expression)) { + receiver = factory.createTempVariable( + hoistVariableDeclaration, + /*reservedInNestedScopes*/ + true + ); + getPendingExpressions().push(factory.createBinaryExpression(receiver, 63, ts6.visitNode(node.expression, visitor, ts6.isExpression))); + } + return factory.createAssignmentTargetWrapper(parameter, createPrivateIdentifierAssignment( + info, + receiver, + parameter, + 63 + /* SyntaxKind.EqualsToken */ + )); + } + function visitArrayAssignmentTarget(node) { + var target = ts6.getTargetOfBindingOrAssignmentElement(node); + if (target) { + var wrapped = void 0; + if (ts6.isPrivateIdentifierPropertyAccessExpression(target)) { + wrapped = wrapPrivateIdentifierForDestructuringTarget(target); + } else if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(target) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; + if (facts & 1) { + wrapped = visitInvalidSuperProperty(target); + } else if (classConstructor && superClassReference) { + var name = ts6.isElementAccessExpression(target) ? ts6.visitNode(target.argumentExpression, visitor, ts6.isExpression) : ts6.isIdentifier(target.name) ? factory.createStringLiteralFromNode(target.name) : void 0; + if (name) { + var temp = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + wrapped = factory.createAssignmentTargetWrapper(temp, factory.createReflectSetCall(superClassReference, name, temp, classConstructor)); + } + } + } + if (wrapped) { + if (ts6.isAssignmentExpression(node)) { + return factory.updateBinaryExpression(node, wrapped, node.operatorToken, ts6.visitNode(node.right, visitor, ts6.isExpression)); + } else if (ts6.isSpreadElement(node)) { + return factory.updateSpreadElement(node, wrapped); + } else { + return wrapped; + } + } + } + return ts6.visitNode(node, assignmentTargetVisitor); + } + function visitObjectAssignmentTarget(node) { + if (ts6.isObjectBindingOrAssignmentElement(node) && !ts6.isShorthandPropertyAssignment(node)) { + var target = ts6.getTargetOfBindingOrAssignmentElement(node); + var wrapped = void 0; + if (target) { + if (ts6.isPrivateIdentifierPropertyAccessExpression(target)) { + wrapped = wrapPrivateIdentifierForDestructuringTarget(target); + } else if (shouldTransformSuperInStaticInitializers && ts6.isSuperProperty(target) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; + if (facts & 1) { + wrapped = visitInvalidSuperProperty(target); + } else if (classConstructor && superClassReference) { + var name = ts6.isElementAccessExpression(target) ? ts6.visitNode(target.argumentExpression, visitor, ts6.isExpression) : ts6.isIdentifier(target.name) ? factory.createStringLiteralFromNode(target.name) : void 0; + if (name) { + var temp = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + wrapped = factory.createAssignmentTargetWrapper(temp, factory.createReflectSetCall(superClassReference, name, temp, classConstructor)); + } + } + } + } + if (ts6.isPropertyAssignment(node)) { + var initializer = ts6.getInitializerOfBindingOrAssignmentElement(node); + return factory.updatePropertyAssignment(node, ts6.visitNode(node.name, visitor, ts6.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts6.visitNode(initializer, visitor)) : wrapped : ts6.visitNode(node.initializer, assignmentTargetVisitor, ts6.isExpression)); + } + if (ts6.isSpreadAssignment(node)) { + return factory.updateSpreadAssignment(node, wrapped || ts6.visitNode(node.expression, assignmentTargetVisitor, ts6.isExpression)); + } + ts6.Debug.assert(wrapped === void 0, "Should not have generated a wrapped target"); + } + return ts6.visitNode(node, visitor); + } + function visitAssignmentPattern(node) { + if (ts6.isArrayLiteralExpression(node)) { + return factory.updateArrayLiteralExpression(node, ts6.visitNodes(node.elements, visitArrayAssignmentTarget, ts6.isExpression)); + } else { + return factory.updateObjectLiteralExpression(node, ts6.visitNodes(node.properties, visitObjectAssignmentTarget, ts6.isObjectLiteralElementLike)); + } + } + } + ts6.transformClassFields = transformClassFields; + function createPrivateStaticFieldInitializer(variableName, initializer) { + return ts6.factory.createAssignment(variableName, ts6.factory.createObjectLiteralExpression([ + ts6.factory.createPropertyAssignment("value", initializer || ts6.factory.createVoidZero()) + ])); + } + function createPrivateInstanceFieldInitializer(receiver, initializer, weakMapName) { + return ts6.factory.createCallExpression( + ts6.factory.createPropertyAccessExpression(weakMapName, "set"), + /*typeArguments*/ + void 0, + [receiver, initializer || ts6.factory.createVoidZero()] + ); + } + function createPrivateInstanceMethodInitializer(receiver, weakSetName) { + return ts6.factory.createCallExpression( + ts6.factory.createPropertyAccessExpression(weakSetName, "add"), + /*typeArguments*/ + void 0, + [receiver] + ); + } + function isReservedPrivateName(node) { + return !ts6.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts6.isGeneratedPrivateIdentifier(name) ? getGeneratedPrivateIdentifierInfo(privateEnv, ts6.getNodeForGeneratedName(name)) : getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts6.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : privateEnv.generatedIdentifiers = new ts6.Map(); + privateEnv.generatedIdentifiers.set(ts6.getNodeForGeneratedName(name), info); + } else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : privateEnv.identifiers = new ts6.Map(); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createRuntimeTypeSerializer(context) { + var hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var strictNullChecks = ts6.getStrictOptionValue(compilerOptions, "strictNullChecks"); + var currentLexicalScope; + var currentNameScope; + return { + serializeTypeNode: function(serializerContext, node) { + return setSerializerContextAnd(serializerContext, serializeTypeNode, node); + }, + serializeTypeOfNode: function(serializerContext, node) { + return setSerializerContextAnd(serializerContext, serializeTypeOfNode, node); + }, + serializeParameterTypesOfNode: function(serializerContext, node, container) { + return setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container); + }, + serializeReturnTypeOfNode: function(serializerContext, node) { + return setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node); + } + }; + function setSerializerContextAnd(serializerContext, cb, node, arg) { + var savedCurrentLexicalScope = currentLexicalScope; + var savedCurrentNameScope = currentNameScope; + currentLexicalScope = serializerContext.currentLexicalScope; + currentNameScope = serializerContext.currentNameScope; + var result = arg === void 0 ? cb(node) : cb(node, arg); + currentLexicalScope = savedCurrentLexicalScope; + currentNameScope = savedCurrentNameScope; + return result; + } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts6.getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && ts6.getEffectiveReturnTypeNode(accessors.getAccessor); + } + function serializeTypeOfNode(node) { + switch (node.kind) { + case 169: + case 166: + return serializeTypeNode(node.type); + case 175: + case 174: + return serializeTypeNode(getAccessorTypeNode(node)); + case 260: + case 228: + case 171: + return ts6.factory.createIdentifier("Function"); + default: + return ts6.factory.createVoidZero(); + } + } + function serializeParameterTypesOfNode(node, container) { + var valueDeclaration = ts6.isClassLike(node) ? ts6.getFirstConstructorWithBody(node) : ts6.isFunctionLike(node) && ts6.nodeIsPresent(node.body) ? node : void 0; + var expressions = []; + if (valueDeclaration) { + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); + var numParameters = parameters.length; + for (var i = 0; i < numParameters; i++) { + var parameter = parameters[i]; + if (i === 0 && ts6.isIdentifier(parameter.name) && parameter.name.escapedText === "this") { + continue; + } + if (parameter.dotDotDotToken) { + expressions.push(serializeTypeNode(ts6.getRestParameterElementType(parameter.type))); + } else { + expressions.push(serializeTypeOfNode(parameter)); + } + } + } + return ts6.factory.createArrayLiteralExpression(expressions); + } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 174) { + var setAccessor = ts6.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } + function serializeReturnTypeOfNode(node) { + if (ts6.isFunctionLike(node) && node.type) { + return serializeTypeNode(node.type); + } else if (ts6.isAsyncFunction(node)) { + return ts6.factory.createIdentifier("Promise"); + } + return ts6.factory.createVoidZero(); + } + function serializeTypeNode(node) { + if (node === void 0) { + return ts6.factory.createIdentifier("Object"); + } + node = ts6.skipTypeParentheses(node); + switch (node.kind) { + case 114: + case 155: + case 144: + return ts6.factory.createVoidZero(); + case 181: + case 182: + return ts6.factory.createIdentifier("Function"); + case 185: + case 186: + return ts6.factory.createIdentifier("Array"); + case 179: + return node.assertsModifier ? ts6.factory.createVoidZero() : ts6.factory.createIdentifier("Boolean"); + case 134: + return ts6.factory.createIdentifier("Boolean"); + case 200: + case 152: + return ts6.factory.createIdentifier("String"); + case 149: + return ts6.factory.createIdentifier("Object"); + case 198: + return serializeLiteralOfLiteralTypeNode(node.literal); + case 148: + return ts6.factory.createIdentifier("Number"); + case 160: + return getGlobalConstructor( + "BigInt", + 7 + /* ScriptTarget.ES2020 */ + ); + case 153: + return getGlobalConstructor( + "Symbol", + 2 + /* ScriptTarget.ES2015 */ + ); + case 180: + return serializeTypeReferenceNode(node); + case 190: + return serializeUnionOrIntersectionConstituents( + node.types, + /*isIntersection*/ + true + ); + case 189: + return serializeUnionOrIntersectionConstituents( + node.types, + /*isIntersection*/ + false + ); + case 191: + return serializeUnionOrIntersectionConstituents( + [node.trueType, node.falseType], + /*isIntersection*/ + false + ); + case 195: + if (node.operator === 146) { + return serializeTypeNode(node.type); + } + break; + case 183: + case 196: + case 197: + case 184: + case 131: + case 157: + case 194: + case 202: + break; + case 315: + case 316: + case 320: + case 321: + case 322: + break; + case 317: + case 318: + case 319: + return serializeTypeNode(node.type); + default: + return ts6.Debug.failBadSyntaxKind(node); + } + return ts6.factory.createIdentifier("Object"); + } + function serializeLiteralOfLiteralTypeNode(node) { + switch (node.kind) { + case 10: + case 14: + return ts6.factory.createIdentifier("String"); + case 221: { + var operand = node.operand; + switch (operand.kind) { + case 8: + case 9: + return serializeLiteralOfLiteralTypeNode(operand); + default: + return ts6.Debug.failBadSyntaxKind(operand); + } + } + case 8: + return ts6.factory.createIdentifier("Number"); + case 9: + return getGlobalConstructor( + "BigInt", + 7 + /* ScriptTarget.ES2020 */ + ); + case 110: + case 95: + return ts6.factory.createIdentifier("Boolean"); + case 104: + return ts6.factory.createVoidZero(); + default: + return ts6.Debug.failBadSyntaxKind(node); + } + } + function serializeUnionOrIntersectionConstituents(types, isIntersection) { + var serializedType; + for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { + var typeNode = types_22[_i]; + typeNode = ts6.skipTypeParentheses(typeNode); + if (typeNode.kind === 144) { + if (isIntersection) + return ts6.factory.createVoidZero(); + continue; + } + if (typeNode.kind === 157) { + if (!isIntersection) + return ts6.factory.createIdentifier("Object"); + continue; + } + if (typeNode.kind === 131) { + return ts6.factory.createIdentifier("Object"); + } + if (!strictNullChecks && (ts6.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 || typeNode.kind === 155)) { + continue; + } + var serializedConstituent = serializeTypeNode(typeNode); + if (ts6.isIdentifier(serializedConstituent) && serializedConstituent.escapedText === "Object") { + return serializedConstituent; + } + if (serializedType) { + if (!equateSerializedTypeNodes(serializedType, serializedConstituent)) { + return ts6.factory.createIdentifier("Object"); + } + } else { + serializedType = serializedConstituent; + } + } + return serializedType !== null && serializedType !== void 0 ? serializedType : ts6.factory.createVoidZero(); + } + function equateSerializedTypeNodes(left, right) { + return ( + // temp vars used in fallback + ts6.isGeneratedIdentifier(left) ? ts6.isGeneratedIdentifier(right) : ( + // entity names + ts6.isIdentifier(left) ? ts6.isIdentifier(right) && left.escapedText === right.escapedText : ts6.isPropertyAccessExpression(left) ? ts6.isPropertyAccessExpression(right) && equateSerializedTypeNodes(left.expression, right.expression) && equateSerializedTypeNodes(left.name, right.name) : ( + // `void 0` + ts6.isVoidExpression(left) ? ts6.isVoidExpression(right) && ts6.isNumericLiteral(left.expression) && left.expression.text === "0" && ts6.isNumericLiteral(right.expression) && right.expression.text === "0" : ( + // `"undefined"` or `"function"` in `typeof` checks + ts6.isStringLiteral(left) ? ts6.isStringLiteral(right) && left.text === right.text : ( + // used in `typeof` checks for fallback + ts6.isTypeOfExpression(left) ? ts6.isTypeOfExpression(right) && equateSerializedTypeNodes(left.expression, right.expression) : ( + // parens in `typeof` checks with temps + ts6.isParenthesizedExpression(left) ? ts6.isParenthesizedExpression(right) && equateSerializedTypeNodes(left.expression, right.expression) : ( + // conditionals used in fallback + ts6.isConditionalExpression(left) ? ts6.isConditionalExpression(right) && equateSerializedTypeNodes(left.condition, right.condition) && equateSerializedTypeNodes(left.whenTrue, right.whenTrue) && equateSerializedTypeNodes(left.whenFalse, right.whenFalse) : ( + // logical binary and assignments used in fallback + ts6.isBinaryExpression(left) ? ts6.isBinaryExpression(right) && left.operatorToken.kind === right.operatorToken.kind && equateSerializedTypeNodes(left.left, right.left) && equateSerializedTypeNodes(left.right, right.right) : false + ) + ) + ) + ) + ) + ) + ) + ); + } + function serializeTypeReferenceNode(node) { + var kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentNameScope !== null && currentNameScope !== void 0 ? currentNameScope : currentLexicalScope); + switch (kind) { + case ts6.TypeReferenceSerializationKind.Unknown: + if (ts6.findAncestor(node, function(n) { + return n.parent && ts6.isConditionalTypeNode(n.parent) && (n.parent.trueType === n || n.parent.falseType === n); + })) { + return ts6.factory.createIdentifier("Object"); + } + var serialized = serializeEntityNameAsExpressionFallback(node.typeName); + var temp = ts6.factory.createTempVariable(hoistVariableDeclaration); + return ts6.factory.createConditionalExpression( + ts6.factory.createTypeCheck(ts6.factory.createAssignment(temp, serialized), "function"), + /*questionToken*/ + void 0, + temp, + /*colonToken*/ + void 0, + ts6.factory.createIdentifier("Object") + ); + case ts6.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + return serializeEntityNameAsExpression(node.typeName); + case ts6.TypeReferenceSerializationKind.VoidNullableOrNeverType: + return ts6.factory.createVoidZero(); + case ts6.TypeReferenceSerializationKind.BigIntLikeType: + return getGlobalConstructor( + "BigInt", + 7 + /* ScriptTarget.ES2020 */ + ); + case ts6.TypeReferenceSerializationKind.BooleanType: + return ts6.factory.createIdentifier("Boolean"); + case ts6.TypeReferenceSerializationKind.NumberLikeType: + return ts6.factory.createIdentifier("Number"); + case ts6.TypeReferenceSerializationKind.StringLikeType: + return ts6.factory.createIdentifier("String"); + case ts6.TypeReferenceSerializationKind.ArrayLikeType: + return ts6.factory.createIdentifier("Array"); + case ts6.TypeReferenceSerializationKind.ESSymbolType: + return getGlobalConstructor( + "Symbol", + 2 + /* ScriptTarget.ES2015 */ + ); + case ts6.TypeReferenceSerializationKind.TypeWithCallSignature: + return ts6.factory.createIdentifier("Function"); + case ts6.TypeReferenceSerializationKind.Promise: + return ts6.factory.createIdentifier("Promise"); + case ts6.TypeReferenceSerializationKind.ObjectType: + return ts6.factory.createIdentifier("Object"); + default: + return ts6.Debug.assertNever(kind); + } + } + function createCheckedValue(left, right) { + return ts6.factory.createLogicalAnd(ts6.factory.createStrictInequality(ts6.factory.createTypeOfExpression(left), ts6.factory.createStringLiteral("undefined")), right); + } + function serializeEntityNameAsExpressionFallback(node) { + if (node.kind === 79) { + var copied = serializeEntityNameAsExpression(node); + return createCheckedValue(copied, copied); + } + if (node.left.kind === 79) { + return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node)); + } + var left = serializeEntityNameAsExpressionFallback(node.left); + var temp = ts6.factory.createTempVariable(hoistVariableDeclaration); + return ts6.factory.createLogicalAnd(ts6.factory.createLogicalAnd(left.left, ts6.factory.createStrictInequality(ts6.factory.createAssignment(temp, left.right), ts6.factory.createVoidZero())), ts6.factory.createPropertyAccessExpression(temp, node.right)); + } + function serializeEntityNameAsExpression(node) { + switch (node.kind) { + case 79: + var name = ts6.setParent(ts6.setTextRange(ts6.parseNodeFactory.cloneNode(node), node), node.parent); + name.original = void 0; + ts6.setParent(name, ts6.getParseTreeNode(currentLexicalScope)); + return name; + case 163: + return serializeQualifiedNameAsExpression(node); + } + } + function serializeQualifiedNameAsExpression(node) { + return ts6.factory.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right); + } + function getGlobalConstructorWithFallback(name) { + return ts6.factory.createConditionalExpression( + ts6.factory.createTypeCheck(ts6.factory.createIdentifier(name), "function"), + /*questionToken*/ + void 0, + ts6.factory.createIdentifier(name), + /*colonToken*/ + void 0, + ts6.factory.createIdentifier("Object") + ); + } + function getGlobalConstructor(name, minLanguageVersion) { + return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : ts6.factory.createIdentifier(name); + } + } + ts6.createRuntimeTypeSerializer = createRuntimeTypeSerializer; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformLegacyDecorators(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var classAliases; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + var visited = ts6.visitEachChild(node, visitor, context); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function modifierVisitor(node) { + return ts6.isDecorator(node) ? void 0 : node; + } + function visitor(node) { + if (!(node.transformFlags & 33554432)) { + return node; + } + switch (node.kind) { + case 167: + return void 0; + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 173: + return visitConstructorDeclaration(node); + case 171: + return visitMethodDeclaration(node); + case 175: + return visitSetAccessorDeclaration(node); + case 174: + return visitGetAccessorDeclaration(node); + case 169: + return visitPropertyDeclaration(node); + case 166: + return visitParameterDeclaration(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitClassDeclaration(node) { + if (!(ts6.classOrConstructorParameterIsDecorated(node) || ts6.childIsDecorated(node))) + return ts6.visitEachChild(node, visitor, context); + var statements = ts6.hasDecorators(node) ? transformClassDeclarationWithClassDecorators(node, node.name) : transformClassDeclarationWithoutClassDecorators(node, node.name); + if (statements.length > 1) { + statements.push(factory.createEndOfDeclarationMarker(node)); + ts6.setEmitFlags( + statements[0], + ts6.getEmitFlags(statements[0]) | 4194304 + /* EmitFlags.HasEndOfDeclarationMarker */ + ); + } + return ts6.singleOrMany(statements); + } + function decoratorContainsPrivateIdentifierInExpression(decorator) { + return !!(decorator.transformFlags & 536870912); + } + function parameterDecoratorsContainPrivateIdentifierInExpression(parameterDecorators) { + return ts6.some(parameterDecorators, decoratorContainsPrivateIdentifierInExpression); + } + function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (!ts6.canHaveDecorators(member)) + continue; + var allDecorators = ts6.getAllDecoratorsOfClassElement(member, node); + if (ts6.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.decorators, decoratorContainsPrivateIdentifierInExpression)) + return true; + if (ts6.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.parameters, parameterDecoratorsContainPrivateIdentifierInExpression)) + return true; + } + return false; + } + function transformDecoratorsOfClassElements(node, members) { + var decorationStatements = []; + addClassElementDecorationStatements( + decorationStatements, + node, + /*isStatic*/ + false + ); + addClassElementDecorationStatements( + decorationStatements, + node, + /*isStatic*/ + true + ); + if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) { + members = ts6.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], members, true), [ + factory.createClassStaticBlockDeclaration(factory.createBlock( + decorationStatements, + /*multiLine*/ + true + )) + ], false)), members); + decorationStatements = void 0; + } + return { decorationStatements, members }; + } + function transformClassDeclarationWithoutClassDecorators(node, name) { + var _a; + var modifiers = ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier); + var heritageClauses = ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause); + var members = ts6.visitNodes(node.members, visitor, ts6.isClassElement); + var decorationStatements = []; + _a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements; + var updated = factory.updateClassDeclaration( + node, + modifiers, + name, + /*typeParameters*/ + void 0, + heritageClauses, + members + ); + return ts6.addRange([updated], decorationStatements); + } + function transformClassDeclarationWithClassDecorators(node, name) { + var _a; + var location = ts6.moveRangePastModifiers(node); + var classAlias = getClassAliasIfNeeded(node); + var declName = languageVersion <= 2 ? factory.getInternalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ) : factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + var heritageClauses = ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause); + var members = ts6.visitNodes(node.members, visitor, ts6.isClassElement); + var decorationStatements = []; + _a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements; + var classExpression = factory.createClassExpression( + /*modifiers*/ + void 0, + name, + /*typeParameters*/ + void 0, + heritageClauses, + members + ); + ts6.setOriginalNode(classExpression, node); + ts6.setTextRange(classExpression, location); + var statement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + declName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + classAlias ? factory.createAssignment(classAlias, classExpression) : classExpression + ) + ], + 1 + /* NodeFlags.Let */ + ) + ); + ts6.setOriginalNode(statement, node); + ts6.setTextRange(statement, location); + ts6.setCommentRange(statement, node); + var statements = [statement]; + ts6.addRange(statements, decorationStatements); + addConstructorDecorationStatement(statements, node); + return statements; + } + function visitClassExpression(node) { + return factory.updateClassExpression( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + node.name, + /*typeParameters*/ + void 0, + ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause), + ts6.visitNodes(node.members, visitor, ts6.isClassElement) + ); + } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), ts6.visitNodes(node.parameters, visitor, ts6.isParameterDeclaration), ts6.visitNode(node.body, visitor, ts6.isBlock)); + } + function finishClassElement(updated, original) { + if (updated !== original) { + ts6.setCommentRange(updated, original); + ts6.setSourceMapRange(updated, ts6.moveRangePastModifiers(original)); + } + return updated; + } + function visitMethodDeclaration(node) { + return finishClassElement(factory.updateMethodDeclaration( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + node.asteriskToken, + ts6.visitNode(node.name, visitor, ts6.isPropertyName), + /*questionToken*/ + void 0, + /*typeParameters*/ + void 0, + ts6.visitNodes(node.parameters, visitor, ts6.isParameterDeclaration), + /*type*/ + void 0, + ts6.visitNode(node.body, visitor, ts6.isBlock) + ), node); + } + function visitGetAccessorDeclaration(node) { + return finishClassElement(factory.updateGetAccessorDeclaration( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + ts6.visitNode(node.name, visitor, ts6.isPropertyName), + ts6.visitNodes(node.parameters, visitor, ts6.isParameterDeclaration), + /*type*/ + void 0, + ts6.visitNode(node.body, visitor, ts6.isBlock) + ), node); + } + function visitSetAccessorDeclaration(node) { + return finishClassElement(factory.updateSetAccessorDeclaration(node, ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), ts6.visitNode(node.name, visitor, ts6.isPropertyName), ts6.visitNodes(node.parameters, visitor, ts6.isParameterDeclaration), ts6.visitNode(node.body, visitor, ts6.isBlock)), node); + } + function visitPropertyDeclaration(node) { + if (node.flags & 16777216 || ts6.hasSyntacticModifier( + node, + 2 + /* ModifierFlags.Ambient */ + )) { + return void 0; + } + return finishClassElement(factory.updatePropertyDeclaration( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + ts6.visitNode(node.name, visitor, ts6.isPropertyName), + /*questionOrExclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(node.initializer, visitor, ts6.isExpression) + ), node); + } + function visitParameterDeclaration(node) { + var updated = factory.updateParameterDeclaration( + node, + ts6.elideNodes(factory, node.modifiers), + node.dotDotDotToken, + ts6.visitNode(node.name, visitor, ts6.isBindingName), + /*questionToken*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(node.initializer, visitor, ts6.isExpression) + ); + if (updated !== node) { + ts6.setCommentRange(updated, node); + ts6.setTextRange(updated, ts6.moveRangePastModifiers(node)); + ts6.setSourceMapRange(updated, ts6.moveRangePastModifiers(node)); + ts6.setEmitFlags( + updated.name, + 32 + /* EmitFlags.NoTrailingSourceMap */ + ); + } + return updated; + } + function transformAllDecoratorsOfDeclaration(allDecorators) { + if (!allDecorators) { + return void 0; + } + var decoratorExpressions = []; + ts6.addRange(decoratorExpressions, ts6.map(allDecorators.decorators, transformDecorator)); + ts6.addRange(decoratorExpressions, ts6.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); + return decoratorExpressions; + } + function addClassElementDecorationStatements(statements, node, isStatic) { + ts6.addRange(statements, ts6.map(generateClassElementDecorationExpressions(node, isStatic), function(expr) { + return factory.createExpressionStatement(expr); + })); + } + function isDecoratedClassElement(member, isStaticElement, parent) { + return ts6.nodeOrChildIsDecorated(member, parent) && isStaticElement === ts6.isStatic(member); + } + function getDecoratedClassElements(node, isStatic) { + return ts6.filter(node.members, function(m) { + return isDecoratedClassElement(m, isStatic, node); + }); + } + function generateClassElementDecorationExpressions(node, isStatic) { + var members = getDecoratedClassElements(node, isStatic); + var expressions; + for (var _i = 0, members_8 = members; _i < members_8.length; _i++) { + var member = members_8[_i]; + expressions = ts6.append(expressions, generateClassElementDecorationExpression(node, member)); + } + return expressions; + } + function generateClassElementDecorationExpression(node, member) { + var allDecorators = ts6.getAllDecoratorsOfClassElement(member, node); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators); + if (!decoratorExpressions) { + return void 0; + } + var prefix2 = getClassMemberPrefix(node, member); + var memberName = getExpressionForPropertyName( + member, + /*generateNameForComputedPropertyName*/ + !ts6.hasSyntacticModifier( + member, + 2 + /* ModifierFlags.Ambient */ + ) + ); + var descriptor = languageVersion > 0 ? ts6.isPropertyDeclaration(member) && !ts6.hasAccessorModifier(member) ? factory.createVoidZero() : factory.createNull() : void 0; + var helper = emitHelpers().createDecorateHelper(decoratorExpressions, prefix2, memberName, descriptor); + ts6.setEmitFlags( + helper, + 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(helper, ts6.moveRangePastModifiers(member)); + return helper; + } + function addConstructorDecorationStatement(statements, node) { + var expression = generateConstructorDecorationExpression(node); + if (expression) { + statements.push(ts6.setOriginalNode(factory.createExpressionStatement(expression), node)); + } + } + function generateConstructorDecorationExpression(node) { + var allDecorators = ts6.getAllDecoratorsOfClass(node); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators); + if (!decoratorExpressions) { + return void 0; + } + var classAlias = classAliases && classAliases[ts6.getOriginalNodeId(node)]; + var localName = languageVersion <= 2 ? factory.getInternalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ) : factory.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); + var decorate = emitHelpers().createDecorateHelper(decoratorExpressions, localName); + var expression = factory.createAssignment(localName, classAlias ? factory.createAssignment(classAlias, decorate) : decorate); + ts6.setEmitFlags( + expression, + 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(expression, ts6.moveRangePastModifiers(node)); + return expression; + } + function transformDecorator(decorator) { + return ts6.visitNode(decorator.expression, visitor, ts6.isExpression); + } + function transformDecoratorsOfParameter(decorators, parameterOffset) { + var expressions; + if (decorators) { + expressions = []; + for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { + var decorator = decorators_1[_i]; + var helper = emitHelpers().createParamHelper(transformDecorator(decorator), parameterOffset); + ts6.setTextRange(helper, decorator.expression); + ts6.setEmitFlags( + helper, + 1536 + /* EmitFlags.NoComments */ + ); + expressions.push(helper); + } + } + return expressions; + } + function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { + var name = member.name; + if (ts6.isPrivateIdentifier(name)) { + return factory.createIdentifier(""); + } else if (ts6.isComputedPropertyName(name)) { + return generateNameForComputedPropertyName && !ts6.isSimpleInlineableExpression(name.expression) ? factory.getGeneratedNameForNode(name) : name.expression; + } else if (ts6.isIdentifier(name)) { + return factory.createStringLiteral(ts6.idText(name)); + } else { + return factory.cloneNode(name); + } + } + function enableSubstitutionForClassAliases() { + if (!classAliases) { + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + classAliases = []; + } + } + function getClassAliasIfNeeded(node) { + if (resolver.getNodeCheckFlags(node) & 16777216) { + enableSubstitutionForClassAliases(); + var classAlias = factory.createUniqueName(node.name && !ts6.isGeneratedIdentifier(node.name) ? ts6.idText(node.name) : "default"); + classAliases[ts6.getOriginalNodeId(node)] = classAlias; + hoistVariableDeclaration(classAlias); + return classAlias; + } + } + function getClassPrototype(node) { + return factory.createPropertyAccessExpression(factory.getDeclarationName(node), "prototype"); + } + function getClassMemberPrefix(node, member) { + return ts6.isStatic(member) ? factory.getDeclarationName(node) : getClassPrototype(node); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 79: + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + var _a; + return (_a = trySubstituteClassAlias(node)) !== null && _a !== void 0 ? _a : node; + } + function trySubstituteClassAlias(node) { + if (classAliases) { + if (resolver.getNodeCheckFlags(node) & 33554432) { + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = classAliases[declaration.id]; + if (classAlias) { + var clone_3 = factory.cloneNode(classAlias); + ts6.setSourceMapRange(clone_3, node); + ts6.setCommentRange(clone_3, node); + return clone_3; + } + } + } + } + return void 0; + } + } + ts6.transformLegacyDecorators = transformLegacyDecorators; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ES2017SubstitutionFlags; + (function(ES2017SubstitutionFlags2) { + ES2017SubstitutionFlags2[ES2017SubstitutionFlags2["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); + var ContextFlags; + (function(ContextFlags2) { + ContextFlags2[ContextFlags2["NonTopLevel"] = 1] = "NonTopLevel"; + ContextFlags2[ContextFlags2["HasLexicalThis"] = 2] = "HasLexicalThis"; + })(ContextFlags || (ContextFlags = {})); + function transformES2017(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var enabledSubstitutions; + var enclosingSuperContainerFlags = 0; + var enclosingFunctionParameterNames; + var capturedSuperProperties; + var hasSuperElementAccess; + var substitutedSuperAccessors = []; + var contextFlags = 0; + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + setContextFlag(1, false); + setContextFlag(2, !ts6.isEffectiveStrictModeSourceFile(node, compilerOptions)); + var visited = ts6.visitEachChild(node, visitor, context); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function setContextFlag(flag, val) { + contextFlags = val ? contextFlags | flag : contextFlags & ~flag; + } + function inContext(flags) { + return (contextFlags & flags) !== 0; + } + function inTopLevelContext() { + return !inContext( + 1 + /* ContextFlags.NonTopLevel */ + ); + } + function inHasLexicalThisContext() { + return inContext( + 2 + /* ContextFlags.HasLexicalThis */ + ); + } + function doWithContext(flags, cb, value) { + var contextFlagsToSet = flags & ~contextFlags; + if (contextFlagsToSet) { + setContextFlag( + contextFlagsToSet, + /*val*/ + true + ); + var result = cb(value); + setContextFlag( + contextFlagsToSet, + /*val*/ + false + ); + return result; + } + return cb(value); + } + function visitDefault(node) { + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 256) === 0) { + return node; + } + switch (node.kind) { + case 132: + return void 0; + case 220: + return visitAwaitExpression(node); + case 171: + return doWithContext(1 | 2, visitMethodDeclaration, node); + case 259: + return doWithContext(1 | 2, visitFunctionDeclaration, node); + case 215: + return doWithContext(1 | 2, visitFunctionExpression, node); + case 216: + return doWithContext(1, visitArrowFunction, node); + case 208: + if (capturedSuperProperties && ts6.isPropertyAccessExpression(node) && node.expression.kind === 106) { + capturedSuperProperties.add(node.name.escapedText); + } + return ts6.visitEachChild(node, visitor, context); + case 209: + if (capturedSuperProperties && node.expression.kind === 106) { + hasSuperElementAccess = true; + } + return ts6.visitEachChild(node, visitor, context); + case 174: + return doWithContext(1 | 2, visitGetAccessorDeclaration, node); + case 175: + return doWithContext(1 | 2, visitSetAccessorDeclaration, node); + case 173: + return doWithContext(1 | 2, visitConstructorDeclaration, node); + case 260: + case 228: + return doWithContext(1 | 2, visitDefault, node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function asyncBodyVisitor(node) { + if (ts6.isNodeWithPossibleHoistedDeclaration(node)) { + switch (node.kind) { + case 240: + return visitVariableStatementInAsyncBody(node); + case 245: + return visitForStatementInAsyncBody(node); + case 246: + return visitForInStatementInAsyncBody(node); + case 247: + return visitForOfStatementInAsyncBody(node); + case 295: + return visitCatchClauseInAsyncBody(node); + case 238: + case 252: + case 266: + case 292: + case 293: + case 255: + case 243: + case 244: + case 242: + case 251: + case 253: + return ts6.visitEachChild(node, asyncBodyVisitor, context); + default: + return ts6.Debug.assertNever(node, "Unhandled node."); + } + } + return visitor(node); + } + function visitCatchClauseInAsyncBody(node) { + var catchClauseNames = new ts6.Set(); + recordDeclarationName(node.variableDeclaration, catchClauseNames); + var catchClauseUnshadowedNames; + catchClauseNames.forEach(function(_, escapedName) { + if (enclosingFunctionParameterNames.has(escapedName)) { + if (!catchClauseUnshadowedNames) { + catchClauseUnshadowedNames = new ts6.Set(enclosingFunctionParameterNames); + } + catchClauseUnshadowedNames.delete(escapedName); + } + }); + if (catchClauseUnshadowedNames) { + var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; + enclosingFunctionParameterNames = catchClauseUnshadowedNames; + var result = ts6.visitEachChild(node, asyncBodyVisitor, context); + enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames; + return result; + } else { + return ts6.visitEachChild(node, asyncBodyVisitor, context); + } + } + function visitVariableStatementInAsyncBody(node) { + if (isVariableDeclarationListWithCollidingName(node.declarationList)) { + var expression = visitVariableDeclarationListWithCollidingNames( + node.declarationList, + /*hasReceiver*/ + false + ); + return expression ? factory.createExpressionStatement(expression) : void 0; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitForInStatementInAsyncBody(node) { + return factory.updateForInStatement(node, isVariableDeclarationListWithCollidingName(node.initializer) ? visitVariableDeclarationListWithCollidingNames( + node.initializer, + /*hasReceiver*/ + true + ) : ts6.visitNode(node.initializer, visitor, ts6.isForInitializer), ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, asyncBodyVisitor, context)); + } + function visitForOfStatementInAsyncBody(node) { + return factory.updateForOfStatement(node, ts6.visitNode(node.awaitModifier, visitor, ts6.isToken), isVariableDeclarationListWithCollidingName(node.initializer) ? visitVariableDeclarationListWithCollidingNames( + node.initializer, + /*hasReceiver*/ + true + ) : ts6.visitNode(node.initializer, visitor, ts6.isForInitializer), ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, asyncBodyVisitor, context)); + } + function visitForStatementInAsyncBody(node) { + var initializer = node.initializer; + return factory.updateForStatement(node, isVariableDeclarationListWithCollidingName(initializer) ? visitVariableDeclarationListWithCollidingNames( + initializer, + /*hasReceiver*/ + false + ) : ts6.visitNode(node.initializer, visitor, ts6.isForInitializer), ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, asyncBodyVisitor, context)); + } + function visitAwaitExpression(node) { + if (inTopLevelContext()) { + return ts6.visitEachChild(node, visitor, context); + } + return ts6.setOriginalNode(ts6.setTextRange(factory.createYieldExpression( + /*asteriskToken*/ + void 0, + ts6.visitNode(node.expression, visitor, ts6.isExpression) + ), node), node); + } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), ts6.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } + function visitMethodDeclaration(node) { + return factory.updateMethodDeclaration( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), + node.asteriskToken, + node.name, + /*questionToken*/ + void 0, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.getFunctionFlags(node) & 2 ? transformAsyncFunctionBody(node) : transformMethodBody(node) + ); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), + node.name, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + transformMethodBody(node) + ); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), node.name, ts6.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } + function visitFunctionDeclaration(node) { + return factory.updateFunctionDeclaration( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), + node.asteriskToken, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.getFunctionFlags(node) & 2 ? transformAsyncFunctionBody(node) : ts6.visitFunctionBody(node.body, visitor, context) + ); + } + function visitFunctionExpression(node) { + return factory.updateFunctionExpression( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), + node.asteriskToken, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + ts6.getFunctionFlags(node) & 2 ? transformAsyncFunctionBody(node) : ts6.visitFunctionBody(node.body, visitor, context) + ); + } + function visitArrowFunction(node) { + return factory.updateArrowFunction( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifierLike), + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + node.equalsGreaterThanToken, + ts6.getFunctionFlags(node) & 2 ? transformAsyncFunctionBody(node) : ts6.visitFunctionBody(node.body, visitor, context) + ); + } + function recordDeclarationName(_a, names) { + var name = _a.name; + if (ts6.isIdentifier(name)) { + names.add(name.escapedText); + } else { + for (var _i = 0, _b = name.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (!ts6.isOmittedExpression(element)) { + recordDeclarationName(element, names); + } + } + } + } + function isVariableDeclarationListWithCollidingName(node) { + return !!node && ts6.isVariableDeclarationList(node) && !(node.flags & 3) && node.declarations.some(collidesWithParameterName); + } + function visitVariableDeclarationListWithCollidingNames(node, hasReceiver) { + hoistVariableDeclarationList(node); + var variables = ts6.getInitializedVariables(node); + if (variables.length === 0) { + if (hasReceiver) { + return ts6.visitNode(factory.converters.convertToAssignmentElementTarget(node.declarations[0].name), visitor, ts6.isExpression); + } + return void 0; + } + return factory.inlineExpressions(ts6.map(variables, transformInitializedVariable)); + } + function hoistVariableDeclarationList(node) { + ts6.forEach(node.declarations, hoistVariable); + } + function hoistVariable(_a) { + var name = _a.name; + if (ts6.isIdentifier(name)) { + hoistVariableDeclaration(name); + } else { + for (var _i = 0, _b = name.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (!ts6.isOmittedExpression(element)) { + hoistVariable(element); + } + } + } + } + function transformInitializedVariable(node) { + var converted = ts6.setSourceMapRange(factory.createAssignment(factory.converters.convertToAssignmentElementTarget(node.name), node.initializer), node); + return ts6.visitNode(converted, visitor, ts6.isExpression); + } + function collidesWithParameterName(_a) { + var name = _a.name; + if (ts6.isIdentifier(name)) { + return enclosingFunctionParameterNames.has(name.escapedText); + } else { + for (var _i = 0, _b = name.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (!ts6.isOmittedExpression(element) && collidesWithParameterName(element)) { + return true; + } + } + } + return false; + } + function transformMethodBody(node) { + ts6.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts6.Set(); + hasSuperElementAccess = false; + var updated = ts6.visitFunctionBody(node.body, visitor, context); + var originalMethod = ts6.getOriginalNode(node, ts6.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048) && (ts6.getFunctionFlags(originalMethod) & 3) !== 3; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts6.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts6.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + if (resolver.getNodeCheckFlags(node) & 4096) { + ts6.addEmitHelper(updated, ts6.advancedAsyncSuperHelper); + } else if (resolver.getNodeCheckFlags(node) & 2048) { + ts6.addEmitHelper(updated, ts6.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } + function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); + var original = ts6.getOriginalNode(node, ts6.isFunctionLike); + var nodeType = original.type; + var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : void 0; + var isArrowFunction2 = node.kind === 216; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; + var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; + enclosingFunctionParameterNames = new ts6.Set(); + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + recordDeclarationName(parameter, enclosingFunctionParameterNames); + } + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + if (!isArrowFunction2) { + capturedSuperProperties = new ts6.Set(); + hasSuperElementAccess = false; + } + var result; + if (!isArrowFunction2) { + var statements = []; + var statementOffset = factory.copyPrologue( + node.body.statements, + statements, + /*ensureUseStrict*/ + false, + visitor + ); + statements.push(factory.createReturnStatement(emitHelpers().createAwaiterHelper(inHasLexicalThisContext(), hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset)))); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048); + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts6.getNodeId(variableStatement)] = true; + ts6.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + } + } + var block = factory.createBlock( + statements, + /*multiLine*/ + true + ); + ts6.setTextRange(block, node.body); + if (emitSuperHelpers && hasSuperElementAccess) { + if (resolver.getNodeCheckFlags(node) & 4096) { + ts6.addEmitHelper(block, ts6.advancedAsyncSuperHelper); + } else if (resolver.getNodeCheckFlags(node) & 2048) { + ts6.addEmitHelper(block, ts6.asyncSuperHelper); + } + } + result = block; + } else { + var expression = emitHelpers().createAwaiterHelper(inHasLexicalThisContext(), hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts6.some(declarations)) { + var block = factory.converters.convertToFunctionBlock(expression); + result = factory.updateBlock(block, ts6.setTextRange(factory.createNodeArray(ts6.concatenate(declarations, block.statements)), block.statements)); + } else { + result = expression; + } + } + enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames; + if (!isArrowFunction2) { + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + } + return result; + } + function transformAsyncFunctionBodyWorker(body, start) { + if (ts6.isBlock(body)) { + return factory.updateBlock(body, ts6.visitNodes(body.statements, asyncBodyVisitor, ts6.isStatement, start)); + } else { + return factory.converters.convertToFunctionBlock(ts6.visitNode(body, asyncBodyVisitor, ts6.isConciseBody)); + } + } + function getPromiseConstructor(type) { + var typeName = type && ts6.getEntityNameFromTypeNode(type); + if (typeName && ts6.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts6.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue || serializationKind === ts6.TypeReferenceSerializationKind.Unknown) { + return typeName; + } + } + return void 0; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution( + 210 + /* SyntaxKind.CallExpression */ + ); + context.enableSubstitution( + 208 + /* SyntaxKind.PropertyAccessExpression */ + ); + context.enableSubstitution( + 209 + /* SyntaxKind.ElementAccessExpression */ + ); + context.enableEmitNotification( + 260 + /* SyntaxKind.ClassDeclaration */ + ); + context.enableEmitNotification( + 171 + /* SyntaxKind.MethodDeclaration */ + ); + context.enableEmitNotification( + 174 + /* SyntaxKind.GetAccessor */ + ); + context.enableEmitNotification( + 175 + /* SyntaxKind.SetAccessor */ + ); + context.enableEmitNotification( + 173 + /* SyntaxKind.Constructor */ + ); + context.enableEmitNotification( + 240 + /* SyntaxKind.VariableStatement */ + ); + } + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } else if (enabledSubstitutions && substitutedSuperAccessors[ts6.getNodeId(node)]) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = 0; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 208: + return substitutePropertyAccessExpression(node); + case 209: + return substituteElementAccessExpression(node); + case 210: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 106) { + return ts6.setTextRange(factory.createPropertyAccessExpression(factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), node.name), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 106) { + return createSuperElementAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts6.isSuperProperty(expression)) { + var argumentExpression = ts6.isPropertyAccessExpression(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); + return factory.createCallExpression( + factory.createPropertyAccessExpression(argumentExpression, "call"), + /*typeArguments*/ + void 0, + __spreadArray([ + factory.createThis() + ], node.arguments, true) + ); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 260 || kind === 173 || kind === 171 || kind === 174 || kind === 175; + } + function createSuperElementAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts6.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression( + factory.createUniqueName( + "_superIndex", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), + /*typeArguments*/ + void 0, + [argumentExpression] + ), "value"), location); + } else { + return ts6.setTextRange(factory.createCallExpression( + factory.createUniqueName( + "_superIndex", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), + /*typeArguments*/ + void 0, + [argumentExpression] + ), location); + } + } + } + ts6.transformES2017 = transformES2017; + function createSuperAccessVariableStatement(factory, resolver, node, names) { + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096) !== 0; + var accessors = []; + names.forEach(function(_, key) { + var name = ts6.unescapeLeadingUnderscores(key); + var getterAndSetter = []; + getterAndSetter.push(factory.createPropertyAssignment("get", factory.createArrowFunction( + /* modifiers */ + void 0, + /* typeParameters */ + void 0, + /* parameters */ + [], + /* type */ + void 0, + /* equalsGreaterThanToken */ + void 0, + ts6.setEmitFlags( + factory.createPropertyAccessExpression(ts6.setEmitFlags( + factory.createSuper(), + 4 + /* EmitFlags.NoSubstitution */ + ), name), + 4 + /* EmitFlags.NoSubstitution */ + ) + ))); + if (hasBinding) { + getterAndSetter.push(factory.createPropertyAssignment("set", factory.createArrowFunction( + /* modifiers */ + void 0, + /* typeParameters */ + void 0, + /* parameters */ + [ + factory.createParameterDeclaration( + /* modifiers */ + void 0, + /* dotDotDotToken */ + void 0, + "v", + /* questionToken */ + void 0, + /* type */ + void 0, + /* initializer */ + void 0 + ) + ], + /* type */ + void 0, + /* equalsGreaterThanToken */ + void 0, + factory.createAssignment(ts6.setEmitFlags( + factory.createPropertyAccessExpression(ts6.setEmitFlags( + factory.createSuper(), + 4 + /* EmitFlags.NoSubstitution */ + ), name), + 4 + /* EmitFlags.NoSubstitution */ + ), factory.createIdentifier("v")) + ))); + } + accessors.push(factory.createPropertyAssignment(name, factory.createObjectLiteralExpression(getterAndSetter))); + }); + return factory.createVariableStatement( + /* modifiers */ + void 0, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), + /*exclamationToken*/ + void 0, + /* type */ + void 0, + factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "create"), + /* typeArguments */ + void 0, + [ + factory.createNull(), + factory.createObjectLiteralExpression( + accessors, + /* multiline */ + true + ) + ] + ) + ) + ], + 2 + /* NodeFlags.Const */ + ) + ); + } + ts6.createSuperAccessVariableStatement = createSuperAccessVariableStatement; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ESNextSubstitutionFlags; + (function(ESNextSubstitutionFlags2) { + ESNextSubstitutionFlags2[ESNextSubstitutionFlags2["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ESNextSubstitutionFlags || (ESNextSubstitutionFlags = {})); + var HierarchyFacts; + (function(HierarchyFacts2) { + HierarchyFacts2[HierarchyFacts2["None"] = 0] = "None"; + HierarchyFacts2[HierarchyFacts2["HasLexicalThis"] = 1] = "HasLexicalThis"; + HierarchyFacts2[HierarchyFacts2["IterationContainer"] = 2] = "IterationContainer"; + HierarchyFacts2[HierarchyFacts2["AncestorFactsMask"] = 3] = "AncestorFactsMask"; + HierarchyFacts2[HierarchyFacts2["SourceFileIncludes"] = 1] = "SourceFileIncludes"; + HierarchyFacts2[HierarchyFacts2["SourceFileExcludes"] = 2] = "SourceFileExcludes"; + HierarchyFacts2[HierarchyFacts2["StrictModeSourceFileIncludes"] = 0] = "StrictModeSourceFileIncludes"; + HierarchyFacts2[HierarchyFacts2["ClassOrFunctionIncludes"] = 1] = "ClassOrFunctionIncludes"; + HierarchyFacts2[HierarchyFacts2["ClassOrFunctionExcludes"] = 2] = "ClassOrFunctionExcludes"; + HierarchyFacts2[HierarchyFacts2["ArrowFunctionIncludes"] = 0] = "ArrowFunctionIncludes"; + HierarchyFacts2[HierarchyFacts2["ArrowFunctionExcludes"] = 2] = "ArrowFunctionExcludes"; + HierarchyFacts2[HierarchyFacts2["IterationStatementIncludes"] = 2] = "IterationStatementIncludes"; + HierarchyFacts2[HierarchyFacts2["IterationStatementExcludes"] = 0] = "IterationStatementExcludes"; + })(HierarchyFacts || (HierarchyFacts = {})); + function transformES2018(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var exportedVariableStatement = false; + var enabledSubstitutions; + var enclosingFunctionFlags; + var parametersWithPrecedingObjectRestOrSpread; + var enclosingSuperContainerFlags = 0; + var hierarchyFacts = 0; + var currentSourceFile; + var taggedTemplateStringDeclarations; + var capturedSuperProperties; + var hasSuperElementAccess; + var substitutedSuperAccessors = []; + return ts6.chainBundle(context, transformSourceFile); + function affectsSubtree(excludeFacts, includeFacts) { + return hierarchyFacts !== (hierarchyFacts & ~excludeFacts | includeFacts); + } + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 3; + return ancestorFacts; + } + function exitSubtree(ancestorFacts) { + hierarchyFacts = ancestorFacts; + } + function recordTaggedTemplateString(temp) { + taggedTemplateStringDeclarations = ts6.append(taggedTemplateStringDeclarations, factory.createVariableDeclaration(temp)); + } + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + currentSourceFile = node; + var visited = visitSourceFile(node); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = void 0; + taggedTemplateStringDeclarations = void 0; + return visited; + } + function visitor(node) { + return visitorWorker( + node, + /*expressionResultIsUnused*/ + false + ); + } + function visitorWithUnusedExpressionResult(node) { + return visitorWorker( + node, + /*expressionResultIsUnused*/ + true + ); + } + function visitorNoAsyncModifier(node) { + if (node.kind === 132) { + return void 0; + } + return node; + } + function doWithHierarchyFacts(cb, value, excludeFacts, includeFacts) { + if (affectsSubtree(excludeFacts, includeFacts)) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var result = cb(value); + exitSubtree(ancestorFacts); + return result; + } + return cb(value); + } + function visitDefault(node) { + return ts6.visitEachChild(node, visitor, context); + } + function visitorWorker(node, expressionResultIsUnused) { + if ((node.transformFlags & 128) === 0) { + return node; + } + switch (node.kind) { + case 220: + return visitAwaitExpression(node); + case 226: + return visitYieldExpression(node); + case 250: + return visitReturnStatement(node); + case 253: + return visitLabeledStatement(node); + case 207: + return visitObjectLiteralExpression(node); + case 223: + return visitBinaryExpression(node, expressionResultIsUnused); + case 354: + return visitCommaListExpression(node, expressionResultIsUnused); + case 295: + return visitCatchClause(node); + case 240: + return visitVariableStatement(node); + case 257: + return visitVariableDeclaration(node); + case 243: + case 244: + case 246: + return doWithHierarchyFacts( + visitDefault, + node, + 0, + 2 + /* HierarchyFacts.IterationStatementIncludes */ + ); + case 247: + return visitForOfStatement( + node, + /*outermostLabeledStatement*/ + void 0 + ); + case 245: + return doWithHierarchyFacts( + visitForStatement, + node, + 0, + 2 + /* HierarchyFacts.IterationStatementIncludes */ + ); + case 219: + return visitVoidExpression(node); + case 173: + return doWithHierarchyFacts( + visitConstructorDeclaration, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + case 171: + return doWithHierarchyFacts( + visitMethodDeclaration, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + case 174: + return doWithHierarchyFacts( + visitGetAccessorDeclaration, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + case 175: + return doWithHierarchyFacts( + visitSetAccessorDeclaration, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + case 259: + return doWithHierarchyFacts( + visitFunctionDeclaration, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + case 215: + return doWithHierarchyFacts( + visitFunctionExpression, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + case 216: + return doWithHierarchyFacts( + visitArrowFunction, + node, + 2, + 0 + /* HierarchyFacts.ArrowFunctionIncludes */ + ); + case 166: + return visitParameter(node); + case 241: + return visitExpressionStatement(node); + case 214: + return visitParenthesizedExpression(node, expressionResultIsUnused); + case 212: + return visitTaggedTemplateExpression(node); + case 208: + if (capturedSuperProperties && ts6.isPropertyAccessExpression(node) && node.expression.kind === 106) { + capturedSuperProperties.add(node.name.escapedText); + } + return ts6.visitEachChild(node, visitor, context); + case 209: + if (capturedSuperProperties && node.expression.kind === 106) { + hasSuperElementAccess = true; + } + return ts6.visitEachChild(node, visitor, context); + case 260: + case 228: + return doWithHierarchyFacts( + visitDefault, + node, + 2, + 1 + /* HierarchyFacts.ClassOrFunctionIncludes */ + ); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitAwaitExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + return ts6.setOriginalNode(ts6.setTextRange( + factory.createYieldExpression( + /*asteriskToken*/ + void 0, + emitHelpers().createAwaitHelper(ts6.visitNode(node.expression, visitor, ts6.isExpression)) + ), + /*location*/ + node + ), node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + if (node.asteriskToken) { + var expression = ts6.visitNode(ts6.Debug.checkDefined(node.expression), visitor, ts6.isExpression); + return ts6.setOriginalNode(ts6.setTextRange(factory.createYieldExpression( + /*asteriskToken*/ + void 0, + emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts6.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts6.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression))) + ), node), node); + } + return ts6.setOriginalNode(ts6.setTextRange(factory.createYieldExpression( + /*asteriskToken*/ + void 0, + createDownlevelAwait(node.expression ? ts6.visitNode(node.expression, visitor, ts6.isExpression) : factory.createVoidZero()) + ), node), node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitReturnStatement(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + return factory.updateReturnStatement(node, createDownlevelAwait(node.expression ? ts6.visitNode(node.expression, visitor, ts6.isExpression) : factory.createVoidZero())); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitLabeledStatement(node) { + if (enclosingFunctionFlags & 2) { + var statement = ts6.unwrapInnermostStatementOfLabel(node); + if (statement.kind === 247 && statement.awaitModifier) { + return visitForOfStatement(statement, node); + } + return factory.restoreEnclosingLabel(ts6.visitNode(statement, visitor, ts6.isStatement, factory.liftToBlock), node); + } + return ts6.visitEachChild(node, visitor, context); + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { + var e = elements_5[_i]; + if (e.kind === 301) { + if (chunkObject) { + objects.push(factory.createObjectLiteralExpression(chunkObject)); + chunkObject = void 0; + } + var target = e.expression; + objects.push(ts6.visitNode(target, visitor, ts6.isExpression)); + } else { + chunkObject = ts6.append(chunkObject, e.kind === 299 ? factory.createPropertyAssignment(e.name, ts6.visitNode(e.initializer, visitor, ts6.isExpression)) : ts6.visitNode(e, visitor, ts6.isObjectLiteralElementLike)); + } + } + if (chunkObject) { + objects.push(factory.createObjectLiteralExpression(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 65536) { + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 207) { + objects.unshift(factory.createObjectLiteralExpression()); + } + var expression = objects[0]; + if (objects.length > 1) { + for (var i = 1; i < objects.length; i++) { + expression = emitHelpers().createAssignHelper([expression, objects[i]]); + } + return expression; + } else { + return emitHelpers().createAssignHelper(objects); + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts6.visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + function visitParenthesizedExpression(node, expressionResultIsUnused) { + return ts6.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); + } + function visitSourceFile(node) { + var ancestorFacts = enterSubtree( + 2, + ts6.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 : 1 + /* HierarchyFacts.SourceFileIncludes */ + ); + exportedVariableStatement = false; + var visited = ts6.visitEachChild(node, visitor, context); + var statement = ts6.concatenate(visited.statements, taggedTemplateStringDeclarations && [ + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList(taggedTemplateStringDeclarations) + ) + ]); + var result = factory.updateSourceFile(visited, ts6.setTextRange(factory.createNodeArray(statement), node.statements)); + exitSubtree(ancestorFacts); + return result; + } + function visitTaggedTemplateExpression(node) { + return ts6.processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, ts6.ProcessLevel.LiftRestriction); + } + function visitBinaryExpression(node, expressionResultIsUnused) { + if (ts6.isDestructuringAssignment(node) && node.left.transformFlags & 65536) { + return ts6.flattenDestructuringAssignment(node, visitor, context, 1, !expressionResultIsUnused); + } + if (node.operatorToken.kind === 27) { + return factory.updateBinaryExpression(node, ts6.visitNode(node.left, visitorWithUnusedExpressionResult, ts6.isExpression), node.operatorToken, ts6.visitNode(node.right, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, ts6.isExpression)); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitCommaListExpression(node, expressionResultIsUnused) { + if (expressionResultIsUnused) { + return ts6.visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + var result; + for (var i = 0; i < node.elements.length; i++) { + var element = node.elements[i]; + var visited = ts6.visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, ts6.isExpression); + if (result || visited !== element) { + result || (result = node.elements.slice(0, i)); + result.push(visited); + } + } + var elements = result ? ts6.setTextRange(factory.createNodeArray(result), node.elements) : node.elements; + return factory.updateCommaListExpression(node, elements); + } + function visitCatchClause(node) { + if (node.variableDeclaration && ts6.isBindingPattern(node.variableDeclaration.name) && node.variableDeclaration.name.transformFlags & 65536) { + var name = factory.getGeneratedNameForNode(node.variableDeclaration.name); + var updatedDecl = factory.updateVariableDeclaration( + node.variableDeclaration, + node.variableDeclaration.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + name + ); + var visitedBindings = ts6.flattenDestructuringBinding( + updatedDecl, + visitor, + context, + 1 + /* FlattenLevel.ObjectRest */ + ); + var block = ts6.visitNode(node.block, visitor, ts6.isBlock); + if (ts6.some(visitedBindings)) { + block = factory.updateBlock(block, __spreadArray([ + factory.createVariableStatement( + /*modifiers*/ + void 0, + visitedBindings + ) + ], block.statements, true)); + } + return factory.updateCatchClause(node, factory.updateVariableDeclaration( + node.variableDeclaration, + name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ), block); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitVariableStatement(node) { + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + var savedExportedVariableStatement = exportedVariableStatement; + exportedVariableStatement = true; + var visited = ts6.visitEachChild(node, visitor, context); + exportedVariableStatement = savedExportedVariableStatement; + return visited; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitVariableDeclaration(node) { + if (exportedVariableStatement) { + var savedExportedVariableStatement = exportedVariableStatement; + exportedVariableStatement = false; + var visited = visitVariableDeclarationWorker( + node, + /*exportedVariableStatement*/ + true + ); + exportedVariableStatement = savedExportedVariableStatement; + return visited; + } + return visitVariableDeclarationWorker( + node, + /*exportedVariableStatement*/ + false + ); + } + function visitVariableDeclarationWorker(node, exportedVariableStatement2) { + if (ts6.isBindingPattern(node.name) && node.name.transformFlags & 65536) { + return ts6.flattenDestructuringBinding( + node, + visitor, + context, + 1, + /*rval*/ + void 0, + exportedVariableStatement2 + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return factory.updateForStatement(node, ts6.visitNode(node.initializer, visitorWithUnusedExpressionResult, ts6.isForInitializer), ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, visitorWithUnusedExpressionResult, ts6.isExpression), ts6.visitIterationBody(node.statement, visitor, context)); + } + function visitVoidExpression(node) { + return ts6.visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + function visitForOfStatement(node, outermostLabeledStatement) { + var ancestorFacts = enterSubtree( + 0, + 2 + /* HierarchyFacts.IterationStatementIncludes */ + ); + if (node.initializer.transformFlags & 65536) { + node = transformForOfStatementWithObjectRest(node); + } + var result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory.restoreEnclosingLabel(ts6.visitEachChild(node, visitor, context), outermostLabeledStatement); + exitSubtree(ancestorFacts); + return result; + } + function transformForOfStatementWithObjectRest(node) { + var initializerWithoutParens = ts6.skipParentheses(node.initializer); + if (ts6.isVariableDeclarationList(initializerWithoutParens) || ts6.isAssignmentPattern(initializerWithoutParens)) { + var bodyLocation = void 0; + var statementsLocation = void 0; + var temp = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var statements = [ts6.createForOfBindingStatement(factory, initializerWithoutParens, temp)]; + if (ts6.isBlock(node.statement)) { + ts6.addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; + } else if (node.statement) { + ts6.append(statements, node.statement); + bodyLocation = node.statement; + statementsLocation = node.statement; + } + return factory.updateForOfStatement(node, node.awaitModifier, ts6.setTextRange(factory.createVariableDeclarationList( + [ + ts6.setTextRange(factory.createVariableDeclaration(temp), node.initializer) + ], + 1 + /* NodeFlags.Let */ + ), node.initializer), node.expression, ts6.setTextRange(factory.createBlock( + ts6.setTextRange(factory.createNodeArray(statements), statementsLocation), + /*multiLine*/ + true + ), bodyLocation)); + } + return node; + } + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts6.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts6.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts6.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts6.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts6.visitNode(binding, visitor, ts6.isStatement)); + var bodyLocation; + var statementsLocation; + var statement = ts6.visitIterationBody(node.statement, visitor, context); + if (ts6.isBlock(statement)) { + ts6.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } else { + statements.push(statement); + } + var body = ts6.setEmitFlags( + ts6.setTextRange(factory.createBlock( + ts6.setTextRange(factory.createNodeArray(statements), statementsLocation), + /*multiLine*/ + true + ), bodyLocation), + 48 | 384 + /* EmitFlags.NoTokenSourceMaps */ + ); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement( + body, + /*catchClause*/ + void 0, + factory.createBlock([ + enterNonUserCodeStatement + ]) + ) + ]); + } + function createDownlevelAwait(expression) { + return enclosingFunctionFlags & 1 ? factory.createYieldExpression( + /*asteriskToken*/ + void 0, + emitHelpers().createAwaitHelper(expression) + ) : factory.createAwaitExpression(expression); + } + function transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + var iterator = ts6.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var result = ts6.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var nonUserCode = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var done = factory.createTempVariable(hoistVariableDeclaration); + var errorRecord = factory.createUniqueName("e"); + var catchVariable = factory.getGeneratedNameForNode(errorRecord); + var returnMethod = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var callValues = ts6.setTextRange(emitHelpers().createAsyncValuesHelper(expression), node.expression); + var callNext = factory.createCallExpression( + factory.createPropertyAccessExpression(iterator, "next"), + /*typeArguments*/ + void 0, + [] + ); + var getDone = factory.createPropertyAccessExpression(result, "done"); + var getValue = factory.createPropertyAccessExpression(result, "value"); + var callReturn = factory.createFunctionCallCall(returnMethod, iterator, []); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var initializer = ancestorFacts & 2 ? factory.inlineExpressions([factory.createAssignment(errorRecord, factory.createVoidZero()), callValues]) : callValues; + var forStatement = ts6.setEmitFlags( + ts6.setTextRange( + factory.createForStatement( + /*initializer*/ + ts6.setEmitFlags( + ts6.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + nonUserCode, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createTrue() + ), + ts6.setTextRange(factory.createVariableDeclaration( + iterator, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + initializer + ), node.expression), + factory.createVariableDeclaration(result) + ]), node.expression), + 2097152 + /* EmitFlags.NoHoisting */ + ), + /*condition*/ + factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), + /*incrementor*/ + void 0, + /*statement*/ + convertForOfStatementHead(node, getValue, nonUserCode) + ), + /*location*/ + node + ), + 256 + /* EmitFlags.NoTokenTrailingSourceMaps */ + ); + ts6.setOriginalNode(forStatement, node); + return factory.createTryStatement(factory.createBlock([ + factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement) + ]), factory.createCatchClause(factory.createVariableDeclaration(catchVariable), ts6.setEmitFlags( + factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(errorRecord, factory.createObjectLiteralExpression([ + factory.createPropertyAssignment("error", catchVariable) + ]))) + ]), + 1 + /* EmitFlags.SingleLine */ + )), factory.createBlock([ + factory.createTryStatement( + /*tryBlock*/ + factory.createBlock([ + ts6.setEmitFlags( + factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), + 1 + /* EmitFlags.SingleLine */ + ) + ]), + /*catchClause*/ + void 0, + /*finallyBlock*/ + ts6.setEmitFlags( + factory.createBlock([ + ts6.setEmitFlags( + factory.createIfStatement(errorRecord, factory.createThrowStatement(factory.createPropertyAccessExpression(errorRecord, "error"))), + 1 + /* EmitFlags.SingleLine */ + ) + ]), + 1 + /* EmitFlags.SingleLine */ + ) + ) + ])); + } + function parameterVisitor(node) { + ts6.Debug.assertNode(node, ts6.isParameter); + return visitParameter(node); + } + function visitParameter(node) { + if (parametersWithPrecedingObjectRestOrSpread === null || parametersWithPrecedingObjectRestOrSpread === void 0 ? void 0 : parametersWithPrecedingObjectRestOrSpread.has(node)) { + return factory.updateParameterDeclaration( + node, + /*modifiers*/ + void 0, + node.dotDotDotToken, + ts6.isBindingPattern(node.name) ? factory.getGeneratedNameForNode(node) : node.name, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ); + } + if (node.transformFlags & 65536) { + return factory.updateParameterDeclaration( + node, + /*modifiers*/ + void 0, + node.dotDotDotToken, + factory.getGeneratedNameForNode(node), + /*questionToken*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(node.initializer, visitor, ts6.isExpression) + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function collectParametersWithPrecedingObjectRestOrSpread(node) { + var parameters; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameters) { + parameters.add(parameter); + } else if (parameter.transformFlags & 65536) { + parameters = new ts6.Set(); + } + } + return parameters; + } + function visitConstructorDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateConstructorDeclaration(node, node.modifiers, ts6.visitParameterList(node.parameters, parameterVisitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function visitGetAccessorDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateGetAccessorDeclaration( + node, + node.modifiers, + ts6.visitNode(node.name, visitor, ts6.isPropertyName), + ts6.visitParameterList(node.parameters, parameterVisitor, context), + /*type*/ + void 0, + transformFunctionBody(node) + ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function visitSetAccessorDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateSetAccessorDeclaration(node, node.modifiers, ts6.visitNode(node.name, visitor, ts6.isPropertyName), ts6.visitParameterList(node.parameters, parameterVisitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function visitMethodDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateMethodDeclaration( + node, + enclosingFunctionFlags & 1 ? ts6.visitNodes(node.modifiers, visitorNoAsyncModifier, ts6.isModifierLike) : node.modifiers, + enclosingFunctionFlags & 2 ? void 0 : node.asteriskToken, + ts6.visitNode(node.name, visitor, ts6.isPropertyName), + ts6.visitNode( + /*questionToken*/ + void 0, + visitor, + ts6.isToken + ), + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, parameterVisitor, context), + /*type*/ + void 0, + enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node) + ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function visitFunctionDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateFunctionDeclaration( + node, + enclosingFunctionFlags & 1 ? ts6.visitNodes(node.modifiers, visitorNoAsyncModifier, ts6.isModifier) : node.modifiers, + enclosingFunctionFlags & 2 ? void 0 : node.asteriskToken, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, parameterVisitor, context), + /*type*/ + void 0, + enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node) + ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function visitArrowFunction(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateArrowFunction( + node, + node.modifiers, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, parameterVisitor, context), + /*type*/ + void 0, + node.equalsGreaterThanToken, + transformFunctionBody(node) + ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function visitFunctionExpression(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + var savedParametersWithPrecedingObjectRestOrSpread = parametersWithPrecedingObjectRestOrSpread; + enclosingFunctionFlags = ts6.getFunctionFlags(node); + parametersWithPrecedingObjectRestOrSpread = collectParametersWithPrecedingObjectRestOrSpread(node); + var updated = factory.updateFunctionExpression( + node, + enclosingFunctionFlags & 1 ? ts6.visitNodes(node.modifiers, visitorNoAsyncModifier, ts6.isModifier) : node.modifiers, + enclosingFunctionFlags & 2 ? void 0 : node.asteriskToken, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, parameterVisitor, context), + /*type*/ + void 0, + enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node) + ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread; + return updated; + } + function transformAsyncGeneratorFunctionBody(node) { + resumeLexicalEnvironment(); + var statements = []; + var statementOffset = factory.copyPrologue( + node.body.statements, + statements, + /*ensureUseStrict*/ + false, + visitor + ); + appendObjectRestAssignmentsIfNeeded(statements, node); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts6.Set(); + hasSuperElementAccess = false; + var returnStatement = factory.createReturnStatement(emitHelpers().createAsyncGeneratorHelper(factory.createFunctionExpression( + /*modifiers*/ + void 0, + factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ), + node.name && factory.getGeneratedNameForNode(node.name), + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + factory.updateBlock(node.body, ts6.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)) + ), !!(hierarchyFacts & 1))); + var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048); + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + var variableStatement = ts6.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts6.getNodeId(variableStatement)] = true; + ts6.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + } + statements.push(returnStatement); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var block = factory.updateBlock(node.body, statements); + if (emitSuperHelpers && hasSuperElementAccess) { + if (resolver.getNodeCheckFlags(node) & 4096) { + ts6.addEmitHelper(block, ts6.advancedAsyncSuperHelper); + } else if (resolver.getNodeCheckFlags(node) & 2048) { + ts6.addEmitHelper(block, ts6.asyncSuperHelper); + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return block; + } + function transformFunctionBody(node) { + var _a; + resumeLexicalEnvironment(); + var statementOffset = 0; + var statements = []; + var body = (_a = ts6.visitNode(node.body, visitor, ts6.isConciseBody)) !== null && _a !== void 0 ? _a : factory.createBlock([]); + if (ts6.isBlock(body)) { + statementOffset = factory.copyPrologue( + body.statements, + statements, + /*ensureUseStrict*/ + false, + visitor + ); + } + ts6.addRange(statements, appendObjectRestAssignmentsIfNeeded( + /*statements*/ + void 0, + node + )); + var leadingStatements = endLexicalEnvironment(); + if (statementOffset > 0 || ts6.some(statements) || ts6.some(leadingStatements)) { + var block = factory.converters.convertToFunctionBlock( + body, + /*multiLine*/ + true + ); + ts6.insertStatementsAfterStandardPrologue(statements, leadingStatements); + ts6.addRange(statements, block.statements.slice(statementOffset)); + return factory.updateBlock(block, ts6.setTextRange(factory.createNodeArray(statements), block.statements)); + } + return body; + } + function appendObjectRestAssignmentsIfNeeded(statements, node) { + var containsPrecedingObjectRestOrSpread = false; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (containsPrecedingObjectRestOrSpread) { + if (ts6.isBindingPattern(parameter.name)) { + if (parameter.name.elements.length > 0) { + var declarations = ts6.flattenDestructuringBinding(parameter, visitor, context, 0, factory.getGeneratedNameForNode(parameter)); + if (ts6.some(declarations)) { + var declarationList = factory.createVariableDeclarationList(declarations); + var statement = factory.createVariableStatement( + /*modifiers*/ + void 0, + declarationList + ); + ts6.setEmitFlags( + statement, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + statements = ts6.append(statements, statement); + } + } else if (parameter.initializer) { + var name = factory.getGeneratedNameForNode(parameter); + var initializer = ts6.visitNode(parameter.initializer, visitor, ts6.isExpression); + var assignment = factory.createAssignment(name, initializer); + var statement = factory.createExpressionStatement(assignment); + ts6.setEmitFlags( + statement, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + statements = ts6.append(statements, statement); + } + } else if (parameter.initializer) { + var name = factory.cloneNode(parameter.name); + ts6.setTextRange(name, parameter.name); + ts6.setEmitFlags( + name, + 48 + /* EmitFlags.NoSourceMap */ + ); + var initializer = ts6.visitNode(parameter.initializer, visitor, ts6.isExpression); + ts6.addEmitFlags( + initializer, + 48 | 1536 + /* EmitFlags.NoComments */ + ); + var assignment = factory.createAssignment(name, initializer); + ts6.setTextRange(assignment, parameter); + ts6.setEmitFlags( + assignment, + 1536 + /* EmitFlags.NoComments */ + ); + var block = factory.createBlock([factory.createExpressionStatement(assignment)]); + ts6.setTextRange(block, parameter); + ts6.setEmitFlags( + block, + 1 | 32 | 384 | 1536 + /* EmitFlags.NoComments */ + ); + var typeCheck = factory.createTypeCheck(factory.cloneNode(parameter.name), "undefined"); + var statement = factory.createIfStatement(typeCheck, block); + ts6.startOnNewLine(statement); + ts6.setTextRange(statement, parameter); + ts6.setEmitFlags( + statement, + 384 | 32 | 1048576 | 1536 + /* EmitFlags.NoComments */ + ); + statements = ts6.append(statements, statement); + } + } else if (parameter.transformFlags & 65536) { + containsPrecedingObjectRestOrSpread = true; + var declarations = ts6.flattenDestructuringBinding( + parameter, + visitor, + context, + 1, + factory.getGeneratedNameForNode(parameter), + /*doNotRecordTempVariablesInLine*/ + false, + /*skipInitializer*/ + true + ); + if (ts6.some(declarations)) { + var declarationList = factory.createVariableDeclarationList(declarations); + var statement = factory.createVariableStatement( + /*modifiers*/ + void 0, + declarationList + ); + ts6.setEmitFlags( + statement, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + statements = ts6.append(statements, statement); + } + } + } + return statements; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution( + 210 + /* SyntaxKind.CallExpression */ + ); + context.enableSubstitution( + 208 + /* SyntaxKind.PropertyAccessExpression */ + ); + context.enableSubstitution( + 209 + /* SyntaxKind.ElementAccessExpression */ + ); + context.enableEmitNotification( + 260 + /* SyntaxKind.ClassDeclaration */ + ); + context.enableEmitNotification( + 171 + /* SyntaxKind.MethodDeclaration */ + ); + context.enableEmitNotification( + 174 + /* SyntaxKind.GetAccessor */ + ); + context.enableEmitNotification( + 175 + /* SyntaxKind.SetAccessor */ + ); + context.enableEmitNotification( + 173 + /* SyntaxKind.Constructor */ + ); + context.enableEmitNotification( + 240 + /* SyntaxKind.VariableStatement */ + ); + } + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } else if (enabledSubstitutions && substitutedSuperAccessors[ts6.getNodeId(node)]) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = 0; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 208: + return substitutePropertyAccessExpression(node); + case 209: + return substituteElementAccessExpression(node); + case 210: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 106) { + return ts6.setTextRange(factory.createPropertyAccessExpression(factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), node.name), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 106) { + return createSuperElementAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts6.isSuperProperty(expression)) { + var argumentExpression = ts6.isPropertyAccessExpression(expression) ? substitutePropertyAccessExpression(expression) : substituteElementAccessExpression(expression); + return factory.createCallExpression( + factory.createPropertyAccessExpression(argumentExpression, "call"), + /*typeArguments*/ + void 0, + __spreadArray([ + factory.createThis() + ], node.arguments, true) + ); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 260 || kind === 173 || kind === 171 || kind === 174 || kind === 175; + } + function createSuperElementAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts6.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression( + factory.createIdentifier("_superIndex"), + /*typeArguments*/ + void 0, + [argumentExpression] + ), "value"), location); + } else { + return ts6.setTextRange(factory.createCallExpression( + factory.createIdentifier("_superIndex"), + /*typeArguments*/ + void 0, + [argumentExpression] + ), location); + } + } + } + ts6.transformES2018 = transformES2018; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformES2019(context) { + var factory = context.factory; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 64) === 0) { + return node; + } + switch (node.kind) { + case 295: + return visitCatchClause(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitCatchClause(node) { + if (!node.variableDeclaration) { + return factory.updateCatchClause(node, factory.createVariableDeclaration(factory.createTempVariable( + /*recordTempVariable*/ + void 0 + )), ts6.visitNode(node.block, visitor, ts6.isBlock)); + } + return ts6.visitEachChild(node, visitor, context); + } + } + ts6.transformES2019 = transformES2019; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformES2020(context) { + var factory = context.factory, hoistVariableDeclaration = context.hoistVariableDeclaration; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 32) === 0) { + return node; + } + switch (node.kind) { + case 210: { + var updated = visitNonOptionalCallExpression( + node, + /*captureThisArg*/ + false + ); + ts6.Debug.assertNotNode(updated, ts6.isSyntheticReference); + return updated; + } + case 208: + case 209: + if (ts6.isOptionalChain(node)) { + var updated = visitOptionalExpression( + node, + /*captureThisArg*/ + false, + /*isDelete*/ + false + ); + ts6.Debug.assertNotNode(updated, ts6.isSyntheticReference); + return updated; + } + return ts6.visitEachChild(node, visitor, context); + case 223: + if (node.operatorToken.kind === 60) { + return transformNullishCoalescingExpression(node); + } + return ts6.visitEachChild(node, visitor, context); + case 217: + return visitDeleteExpression(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function flattenChain(chain) { + ts6.Debug.assertNotNode(chain, ts6.isNonNullChain); + var links = [chain]; + while (!chain.questionDotToken && !ts6.isTaggedTemplateExpression(chain)) { + chain = ts6.cast(ts6.skipPartiallyEmittedExpressions(chain.expression), ts6.isOptionalChain); + ts6.Debug.assertNotNode(chain, ts6.isNonNullChain); + links.unshift(chain); + } + return { expression: chain.expression, chain: links }; + } + function visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete) { + var expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete); + if (ts6.isSyntheticReference(expression)) { + return factory.createSyntheticReferenceExpression(factory.updateParenthesizedExpression(node, expression.expression), expression.thisArg); + } + return factory.updateParenthesizedExpression(node, expression); + } + function visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete) { + if (ts6.isOptionalChain(node)) { + return visitOptionalExpression(node, captureThisArg, isDelete); + } + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + ts6.Debug.assertNotNode(expression, ts6.isSyntheticReference); + var thisArg; + if (captureThisArg) { + if (!ts6.isSimpleCopiableExpression(expression)) { + thisArg = factory.createTempVariable(hoistVariableDeclaration); + expression = factory.createAssignment(thisArg, expression); + } else { + thisArg = expression; + } + } + expression = node.kind === 208 ? factory.updatePropertyAccessExpression(node, expression, ts6.visitNode(node.name, visitor, ts6.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts6.visitNode(node.argumentExpression, visitor, ts6.isExpression)); + return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; + } + function visitNonOptionalCallExpression(node, captureThisArg) { + if (ts6.isOptionalChain(node)) { + return visitOptionalExpression( + node, + captureThisArg, + /*isDelete*/ + false + ); + } + if (ts6.isParenthesizedExpression(node.expression) && ts6.isOptionalChain(ts6.skipParentheses(node.expression))) { + var expression = visitNonOptionalParenthesizedExpression( + node.expression, + /*captureThisArg*/ + true, + /*isDelete*/ + false + ); + var args = ts6.visitNodes(node.arguments, visitor, ts6.isExpression); + if (ts6.isSyntheticReference(expression)) { + return ts6.setTextRange(factory.createFunctionCallCall(expression.expression, expression.thisArg, args), node); + } + return factory.updateCallExpression( + node, + expression, + /*typeArguments*/ + void 0, + args + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitNonOptionalExpression(node, captureThisArg, isDelete) { + switch (node.kind) { + case 214: + return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208: + case 209: + return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210: + return visitNonOptionalCallExpression(node, captureThisArg); + default: + return ts6.visitNode(node, visitor, ts6.isExpression); + } + } + function visitOptionalExpression(node, captureThisArg, isDelete) { + var _a = flattenChain(node), expression = _a.expression, chain = _a.chain; + var left = visitNonOptionalExpression( + ts6.skipPartiallyEmittedExpressions(expression), + ts6.isCallChain(chain[0]), + /*isDelete*/ + false + ); + var leftThisArg = ts6.isSyntheticReference(left) ? left.thisArg : void 0; + var capturedLeft = ts6.isSyntheticReference(left) ? left.expression : left; + var leftExpression = factory.restoreOuterExpressions( + expression, + capturedLeft, + 8 + /* OuterExpressionKinds.PartiallyEmittedExpressions */ + ); + if (!ts6.isSimpleCopiableExpression(capturedLeft)) { + capturedLeft = factory.createTempVariable(hoistVariableDeclaration); + leftExpression = factory.createAssignment(capturedLeft, leftExpression); + } + var rightExpression = capturedLeft; + var thisArg; + for (var i = 0; i < chain.length; i++) { + var segment = chain[i]; + switch (segment.kind) { + case 208: + case 209: + if (i === chain.length - 1 && captureThisArg) { + if (!ts6.isSimpleCopiableExpression(rightExpression)) { + thisArg = factory.createTempVariable(hoistVariableDeclaration); + rightExpression = factory.createAssignment(thisArg, rightExpression); + } else { + thisArg = rightExpression; + } + } + rightExpression = segment.kind === 208 ? factory.createPropertyAccessExpression(rightExpression, ts6.visitNode(segment.name, visitor, ts6.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts6.visitNode(segment.argumentExpression, visitor, ts6.isExpression)); + break; + case 210: + if (i === 0 && leftThisArg) { + if (!ts6.isGeneratedIdentifier(leftThisArg)) { + leftThisArg = factory.cloneNode(leftThisArg); + ts6.addEmitFlags( + leftThisArg, + 1536 + /* EmitFlags.NoComments */ + ); + } + rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 ? factory.createThis() : leftThisArg, ts6.visitNodes(segment.arguments, visitor, ts6.isExpression)); + } else { + rightExpression = factory.createCallExpression( + rightExpression, + /*typeArguments*/ + void 0, + ts6.visitNodes(segment.arguments, visitor, ts6.isExpression) + ); + } + break; + } + ts6.setOriginalNode(rightExpression, segment); + } + var target = isDelete ? factory.createConditionalExpression( + createNotNullCondition( + leftExpression, + capturedLeft, + /*invert*/ + true + ), + /*questionToken*/ + void 0, + factory.createTrue(), + /*colonToken*/ + void 0, + factory.createDeleteExpression(rightExpression) + ) : factory.createConditionalExpression( + createNotNullCondition( + leftExpression, + capturedLeft, + /*invert*/ + true + ), + /*questionToken*/ + void 0, + factory.createVoidZero(), + /*colonToken*/ + void 0, + rightExpression + ); + ts6.setTextRange(target, node); + return thisArg ? factory.createSyntheticReferenceExpression(target, thisArg) : target; + } + function createNotNullCondition(left, right, invert) { + return factory.createBinaryExpression(factory.createBinaryExpression(left, factory.createToken( + invert ? 36 : 37 + /* SyntaxKind.ExclamationEqualsEqualsToken */ + ), factory.createNull()), factory.createToken( + invert ? 56 : 55 + /* SyntaxKind.AmpersandAmpersandToken */ + ), factory.createBinaryExpression(right, factory.createToken( + invert ? 36 : 37 + /* SyntaxKind.ExclamationEqualsEqualsToken */ + ), factory.createVoidZero())); + } + function transformNullishCoalescingExpression(node) { + var left = ts6.visitNode(node.left, visitor, ts6.isExpression); + var right = left; + if (!ts6.isSimpleCopiableExpression(left)) { + right = factory.createTempVariable(hoistVariableDeclaration); + left = factory.createAssignment(right, left); + } + return ts6.setTextRange(factory.createConditionalExpression( + createNotNullCondition(left, right), + /*questionToken*/ + void 0, + right, + /*colonToken*/ + void 0, + ts6.visitNode(node.right, visitor, ts6.isExpression) + ), node); + } + function visitDeleteExpression(node) { + return ts6.isOptionalChain(ts6.skipParentheses(node.expression)) ? ts6.setOriginalNode(visitNonOptionalExpression( + node.expression, + /*captureThisArg*/ + false, + /*isDelete*/ + true + ), node) : factory.updateDeleteExpression(node, ts6.visitNode(node.expression, visitor, ts6.isExpression)); + } + } + ts6.transformES2020 = transformES2020; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformES2021(context) { + var hoistVariableDeclaration = context.hoistVariableDeclaration, factory = context.factory; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 16) === 0) { + return node; + } + switch (node.kind) { + case 223: + var binaryExpression = node; + if (ts6.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { + return transformLogicalAssignment(binaryExpression); + } + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function transformLogicalAssignment(binaryExpression) { + var operator = binaryExpression.operatorToken; + var nonAssignmentOperator = ts6.getNonAssignmentOperatorForCompoundAssignment(operator.kind); + var left = ts6.skipParentheses(ts6.visitNode(binaryExpression.left, visitor, ts6.isLeftHandSideExpression)); + var assignmentTarget = left; + var right = ts6.skipParentheses(ts6.visitNode(binaryExpression.right, visitor, ts6.isExpression)); + if (ts6.isAccessExpression(left)) { + var propertyAccessTargetSimpleCopiable = ts6.isSimpleCopiableExpression(left.expression); + var propertyAccessTarget = propertyAccessTargetSimpleCopiable ? left.expression : factory.createTempVariable(hoistVariableDeclaration); + var propertyAccessTargetAssignment = propertyAccessTargetSimpleCopiable ? left.expression : factory.createAssignment(propertyAccessTarget, left.expression); + if (ts6.isPropertyAccessExpression(left)) { + assignmentTarget = factory.createPropertyAccessExpression(propertyAccessTarget, left.name); + left = factory.createPropertyAccessExpression(propertyAccessTargetAssignment, left.name); + } else { + var elementAccessArgumentSimpleCopiable = ts6.isSimpleCopiableExpression(left.argumentExpression); + var elementAccessArgument = elementAccessArgumentSimpleCopiable ? left.argumentExpression : factory.createTempVariable(hoistVariableDeclaration); + assignmentTarget = factory.createElementAccessExpression(propertyAccessTarget, elementAccessArgument); + left = factory.createElementAccessExpression(propertyAccessTargetAssignment, elementAccessArgumentSimpleCopiable ? left.argumentExpression : factory.createAssignment(elementAccessArgument, left.argumentExpression)); + } + } + return factory.createBinaryExpression(left, nonAssignmentOperator, factory.createParenthesizedExpression(factory.createAssignment(assignmentTarget, right))); + } + } + ts6.transformES2021 = transformES2021; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformESNext(context) { + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 4) === 0) { + return node; + } + switch (node.kind) { + default: + return ts6.visitEachChild(node, visitor, context); + } + } + } + ts6.transformESNext = transformESNext; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformJsx(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory; + var compilerOptions = context.getCompilerOptions(); + var currentSourceFile; + var currentFileState; + return ts6.chainBundle(context, transformSourceFile); + function getCurrentFileNameExpression() { + if (currentFileState.filenameDeclaration) { + return currentFileState.filenameDeclaration.name; + } + var declaration = factory.createVariableDeclaration( + factory.createUniqueName( + "_jsxFileName", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), + /*exclaimationToken*/ + void 0, + /*type*/ + void 0, + factory.createStringLiteral(currentSourceFile.fileName) + ); + currentFileState.filenameDeclaration = declaration; + return currentFileState.filenameDeclaration.name; + } + function getJsxFactoryCalleePrimitive(isStaticChildren) { + return compilerOptions.jsx === 5 ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx"; + } + function getJsxFactoryCallee(isStaticChildren) { + var type = getJsxFactoryCalleePrimitive(isStaticChildren); + return getImplicitImportForName(type); + } + function getImplicitJsxFragmentReference() { + return getImplicitImportForName("Fragment"); + } + function getImplicitImportForName(name) { + var _a, _b; + var importSource = name === "createElement" ? currentFileState.importSpecifier : ts6.getJSXRuntimeImport(currentFileState.importSpecifier, compilerOptions); + var existing = (_b = (_a = currentFileState.utilizedImplicitRuntimeImports) === null || _a === void 0 ? void 0 : _a.get(importSource)) === null || _b === void 0 ? void 0 : _b.get(name); + if (existing) { + return existing.name; + } + if (!currentFileState.utilizedImplicitRuntimeImports) { + currentFileState.utilizedImplicitRuntimeImports = new ts6.Map(); + } + var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource); + if (!specifierSourceImports) { + specifierSourceImports = new ts6.Map(); + currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports); + } + var generatedName = factory.createUniqueName( + "_".concat(name), + 16 | 32 | 64 + /* GeneratedIdentifierFlags.AllowNameSubstitution */ + ); + var specifier = factory.createImportSpecifier( + /*isTypeOnly*/ + false, + factory.createIdentifier(name), + generatedName + ); + generatedName.generatedImportReference = specifier; + specifierSourceImports.set(name, specifier); + return generatedName; + } + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + currentSourceFile = node; + currentFileState = {}; + currentFileState.importSpecifier = ts6.getJSXImplicitImportBase(compilerOptions, node); + var visited = ts6.visitEachChild(node, visitor, context); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + var statements = visited.statements; + if (currentFileState.filenameDeclaration) { + statements = ts6.insertStatementAfterCustomPrologue(statements.slice(), factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [currentFileState.filenameDeclaration], + 2 + /* NodeFlags.Const */ + ) + )); + } + if (currentFileState.utilizedImplicitRuntimeImports) { + for (var _i = 0, _a = ts6.arrayFrom(currentFileState.utilizedImplicitRuntimeImports.entries()); _i < _a.length; _i++) { + var _b = _a[_i], importSource = _b[0], importSpecifiersMap = _b[1]; + if (ts6.isExternalModule(node)) { + var importStatement = factory.createImportDeclaration( + /*modifiers*/ + void 0, + factory.createImportClause( + /*typeOnly*/ + false, + /*name*/ + void 0, + factory.createNamedImports(ts6.arrayFrom(importSpecifiersMap.values())) + ), + factory.createStringLiteral(importSource), + /*assertClause*/ + void 0 + ); + ts6.setParentRecursive( + importStatement, + /*incremental*/ + false + ); + statements = ts6.insertStatementAfterCustomPrologue(statements.slice(), importStatement); + } else if (ts6.isExternalOrCommonJsModule(node)) { + var requireStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + factory.createObjectBindingPattern(ts6.map(ts6.arrayFrom(importSpecifiersMap.values()), function(s) { + return factory.createBindingElement( + /*dotdotdot*/ + void 0, + s.propertyName, + s.name + ); + })), + /*exclaimationToken*/ + void 0, + /*type*/ + void 0, + factory.createCallExpression( + factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + [factory.createStringLiteral(importSource)] + ) + ) + ], + 2 + /* NodeFlags.Const */ + ) + ); + ts6.setParentRecursive( + requireStatement, + /*incremental*/ + false + ); + statements = ts6.insertStatementAfterCustomPrologue(statements.slice(), requireStatement); + } else { + } + } + } + if (statements !== visited.statements) { + visited = factory.updateSourceFile(visited, statements); + } + currentFileState = void 0; + return visited; + } + function visitor(node) { + if (node.transformFlags & 2) { + return visitorWorker(node); + } else { + return node; + } + } + function visitorWorker(node) { + switch (node.kind) { + case 281: + return visitJsxElement( + node, + /*isChild*/ + false + ); + case 282: + return visitJsxSelfClosingElement( + node, + /*isChild*/ + false + ); + case 285: + return visitJsxFragment( + node, + /*isChild*/ + false + ); + case 291: + return visitJsxExpression(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function transformJsxChildToExpression(node) { + switch (node.kind) { + case 11: + return visitJsxText(node); + case 291: + return visitJsxExpression(node); + case 281: + return visitJsxElement( + node, + /*isChild*/ + true + ); + case 282: + return visitJsxSelfClosingElement( + node, + /*isChild*/ + true + ); + case 285: + return visitJsxFragment( + node, + /*isChild*/ + true + ); + default: + return ts6.Debug.failBadSyntaxKind(node); + } + } + function hasKeyAfterPropsSpread(node) { + var spread = false; + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts6.isJsxSpreadAttribute(elem)) { + spread = true; + } else if (spread && ts6.isJsxAttribute(elem) && elem.name.escapedText === "key") { + return true; + } + } + return false; + } + function shouldUseCreateElement(node) { + return currentFileState.importSpecifier === void 0 || hasKeyAfterPropsSpread(node); + } + function visitJsxElement(node, isChild) { + var tagTransform = shouldUseCreateElement(node.openingElement) ? visitJsxOpeningLikeElementCreateElement : visitJsxOpeningLikeElementJSX; + return tagTransform( + node.openingElement, + node.children, + isChild, + /*location*/ + node + ); + } + function visitJsxSelfClosingElement(node, isChild) { + var tagTransform = shouldUseCreateElement(node) ? visitJsxOpeningLikeElementCreateElement : visitJsxOpeningLikeElementJSX; + return tagTransform( + node, + /*children*/ + void 0, + isChild, + /*location*/ + node + ); + } + function visitJsxFragment(node, isChild) { + var tagTransform = currentFileState.importSpecifier === void 0 ? visitJsxOpeningFragmentCreateElement : visitJsxOpeningFragmentJSX; + return tagTransform( + node.openingFragment, + node.children, + isChild, + /*location*/ + node + ); + } + function convertJsxChildrenToChildrenPropObject(children) { + var prop = convertJsxChildrenToChildrenPropAssignment(children); + return prop && factory.createObjectLiteralExpression([prop]); + } + function convertJsxChildrenToChildrenPropAssignment(children) { + var nonWhitespaceChildren = ts6.getSemanticJsxChildren(children); + if (ts6.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) { + var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]); + return result_13 && factory.createPropertyAssignment("children", result_13); + } + var result = ts6.mapDefined(children, transformJsxChildToExpression); + return ts6.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : void 0; + } + function visitJsxOpeningLikeElementJSX(node, children, isChild, location) { + var tagName = getTagName(node); + var childrenProp = children && children.length ? convertJsxChildrenToChildrenPropAssignment(children) : void 0; + var keyAttr = ts6.find(node.attributes.properties, function(p) { + return !!p.name && ts6.isIdentifier(p.name) && p.name.escapedText === "key"; + }); + var attrs = keyAttr ? ts6.filter(node.attributes.properties, function(p) { + return p !== keyAttr; + }) : node.attributes.properties; + var objectProperties = ts6.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) : factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts6.emptyArray); + return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts6.emptyArray, isChild, location); + } + function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) { + var _a; + var nonWhitespaceChildren = ts6.getSemanticJsxChildren(children); + var isStaticChildren = ts6.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken); + var args = [tagName, objectProperties]; + if (keyAttr) { + args.push(transformJsxAttributeInitializer(keyAttr.initializer)); + } + if (compilerOptions.jsx === 5) { + var originalFile = ts6.getOriginalNode(currentSourceFile); + if (originalFile && ts6.isSourceFile(originalFile)) { + if (keyAttr === void 0) { + args.push(factory.createVoidZero()); + } + args.push(isStaticChildren ? factory.createTrue() : factory.createFalse()); + var lineCol = ts6.getLineAndCharacterOfPosition(originalFile, location.pos); + args.push(factory.createObjectLiteralExpression([ + factory.createPropertyAssignment("fileName", getCurrentFileNameExpression()), + factory.createPropertyAssignment("lineNumber", factory.createNumericLiteral(lineCol.line + 1)), + factory.createPropertyAssignment("columnNumber", factory.createNumericLiteral(lineCol.character + 1)) + ])); + args.push(factory.createThis()); + } + } + var element = ts6.setTextRange(factory.createCallExpression( + getJsxFactoryCallee(isStaticChildren), + /*typeArguments*/ + void 0, + args + ), location); + if (isChild) { + ts6.startOnNewLine(element); + } + return element; + } + function visitJsxOpeningLikeElementCreateElement(node, children, isChild, location) { + var tagName = getTagName(node); + var attrs = node.attributes.properties; + var objectProperties = ts6.length(attrs) ? transformJsxAttributesToObjectProps(attrs) : factory.createNull(); + var callee = currentFileState.importSpecifier === void 0 ? ts6.createJsxFactoryExpression( + factory, + context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), + compilerOptions.reactNamespace, + // TODO: GH#18217 + node + ) : getImplicitImportForName("createElement"); + var element = ts6.createExpressionForJsxElement(factory, callee, tagName, objectProperties, ts6.mapDefined(children, transformJsxChildToExpression), location); + if (isChild) { + ts6.startOnNewLine(element); + } + return element; + } + function visitJsxOpeningFragmentJSX(_node, children, isChild, location) { + var childrenProps; + if (children && children.length) { + var result = convertJsxChildrenToChildrenPropObject(children); + if (result) { + childrenProps = result; + } + } + return visitJsxOpeningLikeElementOrFragmentJSX( + getImplicitJsxFragmentReference(), + childrenProps || factory.createObjectLiteralExpression([]), + /*keyAttr*/ + void 0, + children, + isChild, + location + ); + } + function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) { + var element = ts6.createExpressionForJsxFragment( + factory, + context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), + context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), + compilerOptions.reactNamespace, + // TODO: GH#18217 + ts6.mapDefined(children, transformJsxChildToExpression), + node, + location + ); + if (isChild) { + ts6.startOnNewLine(element); + } + return element; + } + function transformJsxSpreadAttributeToSpreadAssignment(node) { + return factory.createSpreadAssignment(ts6.visitNode(node.expression, visitor, ts6.isExpression)); + } + function transformJsxAttributesToObjectProps(attrs, children) { + var target = ts6.getEmitScriptTarget(compilerOptions); + return target && target >= 5 ? factory.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children); + } + function transformJsxAttributesToProps(attrs, children) { + var props = ts6.flatten(ts6.spanMap(attrs, ts6.isJsxSpreadAttribute, function(attrs2, isSpread) { + return ts6.map(attrs2, function(attr) { + return isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr); + }); + })); + if (children) { + props.push(children); + } + return props; + } + function transformJsxAttributesToExpression(attrs, children) { + var expressions = ts6.flatten(ts6.spanMap(attrs, ts6.isJsxSpreadAttribute, function(attrs2, isSpread) { + return isSpread ? ts6.map(attrs2, transformJsxSpreadAttributeToExpression) : factory.createObjectLiteralExpression(ts6.map(attrs2, transformJsxAttributeToObjectLiteralElement)); + })); + if (ts6.isJsxSpreadAttribute(attrs[0])) { + expressions.unshift(factory.createObjectLiteralExpression()); + } + if (children) { + expressions.push(factory.createObjectLiteralExpression([children])); + } + return ts6.singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions); + } + function transformJsxSpreadAttributeToExpression(node) { + return ts6.visitNode(node.expression, visitor, ts6.isExpression); + } + function transformJsxAttributeToObjectLiteralElement(node) { + var name = getAttributeName(node); + var expression = transformJsxAttributeInitializer(node.initializer); + return factory.createPropertyAssignment(name, expression); + } + function transformJsxAttributeInitializer(node) { + if (node === void 0) { + return factory.createTrue(); + } + if (node.kind === 10) { + var singleQuote = node.singleQuote !== void 0 ? node.singleQuote : !ts6.isStringDoubleQuoted(node, currentSourceFile); + var literal2 = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); + return ts6.setTextRange(literal2, node); + } + if (node.kind === 291) { + if (node.expression === void 0) { + return factory.createTrue(); + } + return ts6.visitNode(node.expression, visitor, ts6.isExpression); + } + if (ts6.isJsxElement(node)) { + return visitJsxElement( + node, + /*isChild*/ + false + ); + } + if (ts6.isJsxSelfClosingElement(node)) { + return visitJsxSelfClosingElement( + node, + /*isChild*/ + false + ); + } + if (ts6.isJsxFragment(node)) { + return visitJsxFragment( + node, + /*isChild*/ + false + ); + } + return ts6.Debug.failBadSyntaxKind(node); + } + function visitJsxText(node) { + var fixed = fixupWhitespaceAndDecodeEntities(node.text); + return fixed === void 0 ? void 0 : factory.createStringLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts6.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); + } + firstNonWhitespace = -1; + } else if (!ts6.isWhiteSpaceSingleLine(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + return firstNonWhitespace !== -1 ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) : acc; + } + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === void 0 ? decoded : acc + " " + decoded; + } + function decodeEntities(text) { + return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function(match, _all, _number, _digits, decimal, hex, word) { + if (decimal) { + return ts6.utf16EncodeAsString(parseInt(decimal, 10)); + } else if (hex) { + return ts6.utf16EncodeAsString(parseInt(hex, 16)); + } else { + var ch = entities.get(word); + return ch ? ts6.utf16EncodeAsString(ch) : match; + } + }); + } + function tryDecodeEntities(text) { + var decoded = decodeEntities(text); + return decoded === text ? void 0 : decoded; + } + function getTagName(node) { + if (node.kind === 281) { + return getTagName(node.openingElement); + } else { + var name = node.tagName; + if (ts6.isIdentifier(name) && ts6.isIntrinsicJsxName(name.escapedText)) { + return factory.createStringLiteral(ts6.idText(name)); + } else { + return ts6.createExpressionFromEntityName(factory, name); + } + } + } + function getAttributeName(node) { + var name = node.name; + var text = ts6.idText(name); + if (/^[A-Za-z_]\w*$/.test(text)) { + return name; + } else { + return factory.createStringLiteral(text); + } + } + function visitJsxExpression(node) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + return node.dotDotDotToken ? factory.createSpreadElement(expression) : expression; + } + } + ts6.transformJsx = transformJsx; + var entities = new ts6.Map(ts6.getEntries({ + quot: 34, + amp: 38, + apos: 39, + lt: 60, + gt: 62, + nbsp: 160, + iexcl: 161, + cent: 162, + pound: 163, + curren: 164, + yen: 165, + brvbar: 166, + sect: 167, + uml: 168, + copy: 169, + ordf: 170, + laquo: 171, + not: 172, + shy: 173, + reg: 174, + macr: 175, + deg: 176, + plusmn: 177, + sup2: 178, + sup3: 179, + acute: 180, + micro: 181, + para: 182, + middot: 183, + cedil: 184, + sup1: 185, + ordm: 186, + raquo: 187, + frac14: 188, + frac12: 189, + frac34: 190, + iquest: 191, + Agrave: 192, + Aacute: 193, + Acirc: 194, + Atilde: 195, + Auml: 196, + Aring: 197, + AElig: 198, + Ccedil: 199, + Egrave: 200, + Eacute: 201, + Ecirc: 202, + Euml: 203, + Igrave: 204, + Iacute: 205, + Icirc: 206, + Iuml: 207, + ETH: 208, + Ntilde: 209, + Ograve: 210, + Oacute: 211, + Ocirc: 212, + Otilde: 213, + Ouml: 214, + times: 215, + Oslash: 216, + Ugrave: 217, + Uacute: 218, + Ucirc: 219, + Uuml: 220, + Yacute: 221, + THORN: 222, + szlig: 223, + agrave: 224, + aacute: 225, + acirc: 226, + atilde: 227, + auml: 228, + aring: 229, + aelig: 230, + ccedil: 231, + egrave: 232, + eacute: 233, + ecirc: 234, + euml: 235, + igrave: 236, + iacute: 237, + icirc: 238, + iuml: 239, + eth: 240, + ntilde: 241, + ograve: 242, + oacute: 243, + ocirc: 244, + otilde: 245, + ouml: 246, + divide: 247, + oslash: 248, + ugrave: 249, + uacute: 250, + ucirc: 251, + uuml: 252, + yacute: 253, + thorn: 254, + yuml: 255, + OElig: 338, + oelig: 339, + Scaron: 352, + scaron: 353, + Yuml: 376, + fnof: 402, + circ: 710, + tilde: 732, + Alpha: 913, + Beta: 914, + Gamma: 915, + Delta: 916, + Epsilon: 917, + Zeta: 918, + Eta: 919, + Theta: 920, + Iota: 921, + Kappa: 922, + Lambda: 923, + Mu: 924, + Nu: 925, + Xi: 926, + Omicron: 927, + Pi: 928, + Rho: 929, + Sigma: 931, + Tau: 932, + Upsilon: 933, + Phi: 934, + Chi: 935, + Psi: 936, + Omega: 937, + alpha: 945, + beta: 946, + gamma: 947, + delta: 948, + epsilon: 949, + zeta: 950, + eta: 951, + theta: 952, + iota: 953, + kappa: 954, + lambda: 955, + mu: 956, + nu: 957, + xi: 958, + omicron: 959, + pi: 960, + rho: 961, + sigmaf: 962, + sigma: 963, + tau: 964, + upsilon: 965, + phi: 966, + chi: 967, + psi: 968, + omega: 969, + thetasym: 977, + upsih: 978, + piv: 982, + ensp: 8194, + emsp: 8195, + thinsp: 8201, + zwnj: 8204, + zwj: 8205, + lrm: 8206, + rlm: 8207, + ndash: 8211, + mdash: 8212, + lsquo: 8216, + rsquo: 8217, + sbquo: 8218, + ldquo: 8220, + rdquo: 8221, + bdquo: 8222, + dagger: 8224, + Dagger: 8225, + bull: 8226, + hellip: 8230, + permil: 8240, + prime: 8242, + Prime: 8243, + lsaquo: 8249, + rsaquo: 8250, + oline: 8254, + frasl: 8260, + euro: 8364, + image: 8465, + weierp: 8472, + real: 8476, + trade: 8482, + alefsym: 8501, + larr: 8592, + uarr: 8593, + rarr: 8594, + darr: 8595, + harr: 8596, + crarr: 8629, + lArr: 8656, + uArr: 8657, + rArr: 8658, + dArr: 8659, + hArr: 8660, + forall: 8704, + part: 8706, + exist: 8707, + empty: 8709, + nabla: 8711, + isin: 8712, + notin: 8713, + ni: 8715, + prod: 8719, + sum: 8721, + minus: 8722, + lowast: 8727, + radic: 8730, + prop: 8733, + infin: 8734, + ang: 8736, + and: 8743, + or: 8744, + cap: 8745, + cup: 8746, + int: 8747, + there4: 8756, + sim: 8764, + cong: 8773, + asymp: 8776, + ne: 8800, + equiv: 8801, + le: 8804, + ge: 8805, + sub: 8834, + sup: 8835, + nsub: 8836, + sube: 8838, + supe: 8839, + oplus: 8853, + otimes: 8855, + perp: 8869, + sdot: 8901, + lceil: 8968, + rceil: 8969, + lfloor: 8970, + rfloor: 8971, + lang: 9001, + rang: 9002, + loz: 9674, + spades: 9824, + clubs: 9827, + hearts: 9829, + diams: 9830 + })); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformES2016(context) { + var factory = context.factory, hoistVariableDeclaration = context.hoistVariableDeclaration; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 512) === 0) { + return node; + } + switch (node.kind) { + case 223: + return visitBinaryExpression(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitBinaryExpression(node) { + switch (node.operatorToken.kind) { + case 67: + return visitExponentiationAssignmentExpression(node); + case 42: + return visitExponentiationExpression(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitExponentiationAssignmentExpression(node) { + var target; + var value; + var left = ts6.visitNode(node.left, visitor, ts6.isExpression); + var right = ts6.visitNode(node.right, visitor, ts6.isExpression); + if (ts6.isElementAccessExpression(left)) { + var expressionTemp = factory.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = factory.createTempVariable(hoistVariableDeclaration); + target = ts6.setTextRange(factory.createElementAccessExpression(ts6.setTextRange(factory.createAssignment(expressionTemp, left.expression), left.expression), ts6.setTextRange(factory.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left); + value = ts6.setTextRange(factory.createElementAccessExpression(expressionTemp, argumentExpressionTemp), left); + } else if (ts6.isPropertyAccessExpression(left)) { + var expressionTemp = factory.createTempVariable(hoistVariableDeclaration); + target = ts6.setTextRange(factory.createPropertyAccessExpression(ts6.setTextRange(factory.createAssignment(expressionTemp, left.expression), left.expression), left.name), left); + value = ts6.setTextRange(factory.createPropertyAccessExpression(expressionTemp, left.name), left); + } else { + target = left; + value = left; + } + return ts6.setTextRange(factory.createAssignment(target, ts6.setTextRange(factory.createGlobalMethodCall("Math", "pow", [value, right]), node)), node); + } + function visitExponentiationExpression(node) { + var left = ts6.visitNode(node.left, visitor, ts6.isExpression); + var right = ts6.visitNode(node.right, visitor, ts6.isExpression); + return ts6.setTextRange(factory.createGlobalMethodCall("Math", "pow", [left, right]), node); + } + } + ts6.transformES2016 = transformES2016; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ES2015SubstitutionFlags; + (function(ES2015SubstitutionFlags2) { + ES2015SubstitutionFlags2[ES2015SubstitutionFlags2["CapturedThis"] = 1] = "CapturedThis"; + ES2015SubstitutionFlags2[ES2015SubstitutionFlags2["BlockScopedBindings"] = 2] = "BlockScopedBindings"; + })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {})); + var LoopOutParameterFlags; + (function(LoopOutParameterFlags2) { + LoopOutParameterFlags2[LoopOutParameterFlags2["Body"] = 1] = "Body"; + LoopOutParameterFlags2[LoopOutParameterFlags2["Initializer"] = 2] = "Initializer"; + })(LoopOutParameterFlags || (LoopOutParameterFlags = {})); + var CopyDirection; + (function(CopyDirection2) { + CopyDirection2[CopyDirection2["ToOriginal"] = 0] = "ToOriginal"; + CopyDirection2[CopyDirection2["ToOutParameter"] = 1] = "ToOutParameter"; + })(CopyDirection || (CopyDirection = {})); + var Jump; + (function(Jump2) { + Jump2[Jump2["Break"] = 2] = "Break"; + Jump2[Jump2["Continue"] = 4] = "Continue"; + Jump2[Jump2["Return"] = 8] = "Return"; + })(Jump || (Jump = {})); + var HierarchyFacts; + (function(HierarchyFacts2) { + HierarchyFacts2[HierarchyFacts2["None"] = 0] = "None"; + HierarchyFacts2[HierarchyFacts2["Function"] = 1] = "Function"; + HierarchyFacts2[HierarchyFacts2["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts2[HierarchyFacts2["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts2[HierarchyFacts2["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts2[HierarchyFacts2["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts2[HierarchyFacts2["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts2[HierarchyFacts2["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts2[HierarchyFacts2["Block"] = 128] = "Block"; + HierarchyFacts2[HierarchyFacts2["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts2[HierarchyFacts2["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts2[HierarchyFacts2["IterationContainer"] = 1024] = "IterationContainer"; + HierarchyFacts2[HierarchyFacts2["ForStatement"] = 2048] = "ForStatement"; + HierarchyFacts2[HierarchyFacts2["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement"; + HierarchyFacts2[HierarchyFacts2["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper"; + HierarchyFacts2[HierarchyFacts2["StaticInitializer"] = 16384] = "StaticInitializer"; + HierarchyFacts2[HierarchyFacts2["AncestorFactsMask"] = 32767] = "AncestorFactsMask"; + HierarchyFacts2[HierarchyFacts2["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts2[HierarchyFacts2["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes"; + HierarchyFacts2[HierarchyFacts2["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts2[HierarchyFacts2["SourceFileExcludes"] = 8064] = "SourceFileExcludes"; + HierarchyFacts2[HierarchyFacts2["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts2[HierarchyFacts2["FunctionExcludes"] = 32670] = "FunctionExcludes"; + HierarchyFacts2[HierarchyFacts2["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts2[HierarchyFacts2["AsyncFunctionBodyExcludes"] = 32662] = "AsyncFunctionBodyExcludes"; + HierarchyFacts2[HierarchyFacts2["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts2[HierarchyFacts2["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes"; + HierarchyFacts2[HierarchyFacts2["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts2[HierarchyFacts2["ConstructorExcludes"] = 32662] = "ConstructorExcludes"; + HierarchyFacts2[HierarchyFacts2["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes"; + HierarchyFacts2[HierarchyFacts2["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + HierarchyFacts2[HierarchyFacts2["ForStatementIncludes"] = 3328] = "ForStatementIncludes"; + HierarchyFacts2[HierarchyFacts2["ForStatementExcludes"] = 5056] = "ForStatementExcludes"; + HierarchyFacts2[HierarchyFacts2["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes"; + HierarchyFacts2[HierarchyFacts2["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes"; + HierarchyFacts2[HierarchyFacts2["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts2[HierarchyFacts2["BlockExcludes"] = 6976] = "BlockExcludes"; + HierarchyFacts2[HierarchyFacts2["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts2[HierarchyFacts2["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes"; + HierarchyFacts2[HierarchyFacts2["StaticInitializerIncludes"] = 16449] = "StaticInitializerIncludes"; + HierarchyFacts2[HierarchyFacts2["StaticInitializerExcludes"] = 32670] = "StaticInitializerExcludes"; + HierarchyFacts2[HierarchyFacts2["NewTarget"] = 32768] = "NewTarget"; + HierarchyFacts2[HierarchyFacts2["CapturedLexicalThis"] = 65536] = "CapturedLexicalThis"; + HierarchyFacts2[HierarchyFacts2["SubtreeFactsMask"] = -32768] = "SubtreeFactsMask"; + HierarchyFacts2[HierarchyFacts2["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes"; + HierarchyFacts2[HierarchyFacts2["FunctionSubtreeExcludes"] = 98304] = "FunctionSubtreeExcludes"; + })(HierarchyFacts || (HierarchyFacts = {})); + var SpreadSegmentKind; + (function(SpreadSegmentKind2) { + SpreadSegmentKind2[SpreadSegmentKind2["None"] = 0] = "None"; + SpreadSegmentKind2[SpreadSegmentKind2["UnpackedSpread"] = 1] = "UnpackedSpread"; + SpreadSegmentKind2[SpreadSegmentKind2["PackedSpread"] = 2] = "PackedSpread"; + })(SpreadSegmentKind || (SpreadSegmentKind = {})); + function createSpreadSegment(kind, expression) { + return { kind, expression }; + } + function transformES2015(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + var currentSourceFile; + var currentText; + var hierarchyFacts; + var taggedTemplateStringDeclarations; + function recordTaggedTemplateString(temp) { + taggedTemplateStringDeclarations = ts6.append(taggedTemplateStringDeclarations, factory.createVariableDeclaration(temp)); + } + var convertedLoopState; + var enabledSubstitutions; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + currentSourceFile = node; + currentText = node.text; + var visited = visitSourceFile(node); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = void 0; + currentText = void 0; + taggedTemplateStringDeclarations = void 0; + hierarchyFacts = 0; + return visited; + } + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 32767; + return ancestorFacts; + } + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 | ancestorFacts; + } + function isReturnVoidStatementInConstructorWithCapturedSuper(node) { + return (hierarchyFacts & 8192) !== 0 && node.kind === 250 && !node.expression; + } + function isOrMayContainReturnCompletion(node) { + return node.transformFlags & 4194304 && (ts6.isReturnStatement(node) || ts6.isIfStatement(node) || ts6.isWithStatement(node) || ts6.isSwitchStatement(node) || ts6.isCaseBlock(node) || ts6.isCaseClause(node) || ts6.isDefaultClause(node) || ts6.isTryStatement(node) || ts6.isCatchClause(node) || ts6.isLabeledStatement(node) || ts6.isIterationStatement( + node, + /*lookInLabeledStatements*/ + false + ) || ts6.isBlock(node)); + } + function shouldVisitNode(node) { + return (node.transformFlags & 1024) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 && isOrMayContainReturnCompletion(node) || ts6.isIterationStatement( + node, + /*lookInLabeledStatements*/ + false + ) && shouldConvertIterationStatement(node) || (ts6.getEmitFlags(node) & 33554432) !== 0; + } + function visitor(node) { + return shouldVisitNode(node) ? visitorWorker( + node, + /*expressionResultIsUnused*/ + false + ) : node; + } + function visitorWithUnusedExpressionResult(node) { + return shouldVisitNode(node) ? visitorWorker( + node, + /*expressionResultIsUnused*/ + true + ) : node; + } + function classWrapperStatementVisitor(node) { + if (shouldVisitNode(node)) { + var original = ts6.getOriginalNode(node); + if (ts6.isPropertyDeclaration(original) && ts6.hasStaticModifier(original)) { + var ancestorFacts = enterSubtree( + 32670, + 16449 + /* HierarchyFacts.StaticInitializerIncludes */ + ); + var result = visitorWorker( + node, + /*expressionResultIsUnused*/ + false + ); + exitSubtree( + ancestorFacts, + 98304, + 0 + /* HierarchyFacts.None */ + ); + return result; + } + return visitorWorker( + node, + /*expressionResultIsUnused*/ + false + ); + } + return node; + } + function callExpressionVisitor(node) { + if (node.kind === 106) { + return visitSuperKeyword( + /*isExpressionOfCall*/ + true + ); + } + return visitor(node); + } + function visitorWorker(node, expressionResultIsUnused) { + switch (node.kind) { + case 124: + return void 0; + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 166: + return visitParameter(node); + case 259: + return visitFunctionDeclaration(node); + case 216: + return visitArrowFunction(node); + case 215: + return visitFunctionExpression(node); + case 257: + return visitVariableDeclaration(node); + case 79: + return visitIdentifier(node); + case 258: + return visitVariableDeclarationList(node); + case 252: + return visitSwitchStatement(node); + case 266: + return visitCaseBlock(node); + case 238: + return visitBlock( + node, + /*isFunctionBody*/ + false + ); + case 249: + case 248: + return visitBreakOrContinueStatement(node); + case 253: + return visitLabeledStatement(node); + case 243: + case 244: + return visitDoOrWhileStatement( + node, + /*outermostLabeledStatement*/ + void 0 + ); + case 245: + return visitForStatement( + node, + /*outermostLabeledStatement*/ + void 0 + ); + case 246: + return visitForInStatement( + node, + /*outermostLabeledStatement*/ + void 0 + ); + case 247: + return visitForOfStatement( + node, + /*outermostLabeledStatement*/ + void 0 + ); + case 241: + return visitExpressionStatement(node); + case 207: + return visitObjectLiteralExpression(node); + case 295: + return visitCatchClause(node); + case 300: + return visitShorthandPropertyAssignment(node); + case 164: + return visitComputedPropertyName(node); + case 206: + return visitArrayLiteralExpression(node); + case 210: + return visitCallExpression(node); + case 211: + return visitNewExpression(node); + case 214: + return visitParenthesizedExpression(node, expressionResultIsUnused); + case 223: + return visitBinaryExpression(node, expressionResultIsUnused); + case 354: + return visitCommaListExpression(node, expressionResultIsUnused); + case 14: + case 15: + case 16: + case 17: + return visitTemplateLiteral(node); + case 10: + return visitStringLiteral(node); + case 8: + return visitNumericLiteral(node); + case 212: + return visitTaggedTemplateExpression(node); + case 225: + return visitTemplateExpression(node); + case 226: + return visitYieldExpression(node); + case 227: + return visitSpreadElement(node); + case 106: + return visitSuperKeyword( + /*isExpressionOfCall*/ + false + ); + case 108: + return visitThisKeyword(node); + case 233: + return visitMetaProperty(node); + case 171: + return visitMethodDeclaration(node); + case 174: + case 175: + return visitAccessorDeclaration(node); + case 240: + return visitVariableStatement(node); + case 250: + return visitReturnStatement(node); + case 219: + return visitVoidExpression(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitSourceFile(node) { + var ancestorFacts = enterSubtree( + 8064, + 64 + /* HierarchyFacts.SourceFileIncludes */ + ); + var prologue = []; + var statements = []; + startLexicalEnvironment(); + var statementOffset = factory.copyPrologue( + node.statements, + prologue, + /*ensureUseStrict*/ + false, + visitor + ); + ts6.addRange(statements, ts6.visitNodes(node.statements, visitor, ts6.isStatement, statementOffset)); + if (taggedTemplateStringDeclarations) { + statements.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList(taggedTemplateStringDeclarations) + )); + } + factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment()); + insertCaptureThisForNodeIfNeeded(prologue, node); + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return factory.updateSourceFile(node, ts6.setTextRange(factory.createNodeArray(ts6.concatenate(prologue, statements)), node.statements)); + } + function visitSwitchStatement(node) { + if (convertedLoopState !== void 0) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts6.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree( + 7104, + 0 + /* HierarchyFacts.BlockScopeIncludes */ + ); + var updated = ts6.visitEachChild(node, visitor, context); + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return updated; + } + function returnCapturedThis(node) { + return ts6.setOriginalNode(factory.createReturnStatement(factory.createUniqueName( + "_this", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + )), node); + } + function visitReturnStatement(node) { + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return factory.createReturnStatement(factory.createObjectLiteralExpression([ + factory.createPropertyAssignment(factory.createIdentifier("value"), node.expression ? ts6.visitNode(node.expression, visitor, ts6.isExpression) : factory.createVoidZero()) + ])); + } else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitThisKeyword(node) { + if (hierarchyFacts & 2 && !(hierarchyFacts & 16384)) { + hierarchyFacts |= 65536; + } + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = factory.createUniqueName("this")); + } + return node; + } + function visitVoidExpression(node) { + return ts6.visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + function visitIdentifier(node) { + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } + } + if (node.hasExtendedUnicodeEscape) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createIdentifier(ts6.unescapeLeadingUnderscores(node.escapedText)), node), node); + } + return node; + } + function visitBreakOrContinueStatement(node) { + if (convertedLoopState) { + var jump = node.kind === 249 ? 2 : 4; + var canUseBreakOrContinue = node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts6.idText(node.label)) || !node.label && convertedLoopState.allowedNonLabeledJumps & jump; + if (!canUseBreakOrContinue) { + var labelMarker = void 0; + var label = node.label; + if (!label) { + if (node.kind === 249) { + convertedLoopState.nonLocalJumps |= 2; + labelMarker = "break"; + } else { + convertedLoopState.nonLocalJumps |= 4; + labelMarker = "continue"; + } + } else { + if (node.kind === 249) { + labelMarker = "break-".concat(label.escapedText); + setLabeledJump( + convertedLoopState, + /*isBreak*/ + true, + ts6.idText(label), + labelMarker + ); + } else { + labelMarker = "continue-".concat(label.escapedText); + setLabeledJump( + convertedLoopState, + /*isBreak*/ + false, + ts6.idText(label), + labelMarker + ); + } + } + var returnExpression = factory.createStringLiteral(labelMarker); + if (convertedLoopState.loopOutParameters.length) { + var outParams = convertedLoopState.loopOutParameters; + var expr = void 0; + for (var i = 0; i < outParams.length; i++) { + var copyExpr = copyOutParameter( + outParams[i], + 1 + /* CopyDirection.ToOutParameter */ + ); + if (i === 0) { + expr = copyExpr; + } else { + expr = factory.createBinaryExpression(expr, 27, copyExpr); + } + } + returnExpression = factory.createBinaryExpression(expr, 27, returnExpression); + } + return factory.createReturnStatement(returnExpression); + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitClassDeclaration(node) { + var variable = factory.createVariableDeclaration( + factory.getLocalName( + node, + /*allowComments*/ + true + ), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + transformClassLikeDeclarationToExpression(node) + ); + ts6.setOriginalNode(variable, node); + var statements = []; + var statement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([variable]) + ); + ts6.setOriginalNode(statement, node); + ts6.setTextRange(statement, node); + ts6.startOnNewLine(statement); + statements.push(statement); + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + var exportStatement = ts6.hasSyntacticModifier( + node, + 1024 + /* ModifierFlags.Default */ + ) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); + ts6.setOriginalNode(exportStatement, statement); + statements.push(exportStatement); + } + var emitFlags = ts6.getEmitFlags(node); + if ((emitFlags & 4194304) === 0) { + statements.push(factory.createEndOfDeclarationMarker(node)); + ts6.setEmitFlags( + statement, + emitFlags | 4194304 + /* EmitFlags.HasEndOfDeclarationMarker */ + ); + } + return ts6.singleOrMany(statements); + } + function visitClassExpression(node) { + return transformClassLikeDeclarationToExpression(node); + } + function transformClassLikeDeclarationToExpression(node) { + if (node.name) { + enableSubstitutionsForBlockScopedBindings(); + } + var extendsClauseElement = ts6.getClassExtendsHeritageElement(node); + var classFunction = factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + extendsClauseElement ? [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ) + )] : [], + /*type*/ + void 0, + transformClassBody(node, extendsClauseElement) + ); + ts6.setEmitFlags( + classFunction, + ts6.getEmitFlags(node) & 65536 | 524288 + /* EmitFlags.ReuseTempVariableScope */ + ); + var inner = factory.createPartiallyEmittedExpression(classFunction); + ts6.setTextRangeEnd(inner, node.end); + ts6.setEmitFlags( + inner, + 1536 + /* EmitFlags.NoComments */ + ); + var outer = factory.createPartiallyEmittedExpression(inner); + ts6.setTextRangeEnd(outer, ts6.skipTrivia(currentText, node.pos)); + ts6.setEmitFlags( + outer, + 1536 + /* EmitFlags.NoComments */ + ); + var result = factory.createParenthesizedExpression(factory.createCallExpression( + outer, + /*typeArguments*/ + void 0, + extendsClauseElement ? [ts6.visitNode(extendsClauseElement.expression, visitor, ts6.isExpression)] : [] + )); + ts6.addSyntheticLeadingComment(result, 3, "* @class "); + return result; + } + function transformClassBody(node, extendsClauseElement) { + var statements = []; + var name = factory.getInternalName(node); + var constructorLikeName = ts6.isIdentifierANonContextualKeyword(name) ? factory.getGeneratedNameForNode(name) : name; + startLexicalEnvironment(); + addExtendsHelperIfNeeded(statements, node, extendsClauseElement); + addConstructor(statements, node, constructorLikeName, extendsClauseElement); + addClassMembers(statements, node); + var closingBraceLocation = ts6.createTokenRange( + ts6.skipTrivia(currentText, node.members.end), + 19 + /* SyntaxKind.CloseBraceToken */ + ); + var outer = factory.createPartiallyEmittedExpression(constructorLikeName); + ts6.setTextRangeEnd(outer, closingBraceLocation.end); + ts6.setEmitFlags( + outer, + 1536 + /* EmitFlags.NoComments */ + ); + var statement = factory.createReturnStatement(outer); + ts6.setTextRangePos(statement, closingBraceLocation.pos); + ts6.setEmitFlags( + statement, + 1536 | 384 + /* EmitFlags.NoTokenSourceMaps */ + ); + statements.push(statement); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var block = factory.createBlock( + ts6.setTextRange( + factory.createNodeArray(statements), + /*location*/ + node.members + ), + /*multiLine*/ + true + ); + ts6.setEmitFlags( + block, + 1536 + /* EmitFlags.NoComments */ + ); + return block; + } + function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { + if (extendsClauseElement) { + statements.push(ts6.setTextRange( + factory.createExpressionStatement(emitHelpers().createExtendsHelper(factory.getInternalName(node))), + /*location*/ + extendsClauseElement + )); + } + } + function addConstructor(statements, node, name, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var ancestorFacts = enterSubtree( + 32662, + 73 + /* HierarchyFacts.ConstructorIncludes */ + ); + var constructor = ts6.getFirstConstructorWithBody(node); + var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== void 0); + var constructorFunction = factory.createFunctionDeclaration( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + name, + /*typeParameters*/ + void 0, + transformConstructorParameters(constructor, hasSynthesizedSuper), + /*type*/ + void 0, + transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) + ); + ts6.setTextRange(constructorFunction, constructor || node); + if (extendsClauseElement) { + ts6.setEmitFlags( + constructorFunction, + 8 + /* EmitFlags.CapturesThis */ + ); + } + statements.push(constructorFunction); + exitSubtree( + ancestorFacts, + 98304, + 0 + /* HierarchyFacts.None */ + ); + convertedLoopState = savedConvertedLoopState; + } + function transformConstructorParameters(constructor, hasSynthesizedSuper) { + return ts6.visitParameterList(constructor && !hasSynthesizedSuper ? constructor.parameters : void 0, visitor, context) || []; + } + function createDefaultConstructorBody(node, isDerivedClass) { + var statements = []; + resumeLexicalEnvironment(); + factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (isDerivedClass) { + statements.push(factory.createReturnStatement(createDefaultSuperCallOrThis())); + } + var statementsArray = factory.createNodeArray(statements); + ts6.setTextRange(statementsArray, node.members); + var block = factory.createBlock( + statementsArray, + /*multiLine*/ + true + ); + ts6.setTextRange(block, node); + ts6.setEmitFlags( + block, + 1536 + /* EmitFlags.NoComments */ + ); + return block; + } + function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { + var isDerivedClass = !!extendsClauseElement && ts6.skipOuterExpressions(extendsClauseElement.expression).kind !== 104; + if (!constructor) + return createDefaultConstructorBody(node, isDerivedClass); + var prologue = []; + var statements = []; + resumeLexicalEnvironment(); + var existingPrologue = ts6.takeWhile(constructor.body.statements, ts6.isPrologueDirective); + var _a = findSuperCallAndStatementIndex(constructor.body.statements, existingPrologue), superCall = _a.superCall, superStatementIndex = _a.superStatementIndex; + var postSuperStatementsStart = superStatementIndex === -1 ? existingPrologue.length : superStatementIndex + 1; + var statementOffset = postSuperStatementsStart; + if (!hasSynthesizedSuper) + statementOffset = factory.copyStandardPrologue( + constructor.body.statements, + prologue, + statementOffset, + /*ensureUseStrict*/ + false + ); + if (!hasSynthesizedSuper) + statementOffset = factory.copyCustomPrologue( + constructor.body.statements, + statements, + statementOffset, + visitor, + /*filter*/ + void 0 + ); + var superCallExpression; + if (hasSynthesizedSuper) { + superCallExpression = createDefaultSuperCallOrThis(); + } else if (superCall) { + superCallExpression = visitSuperCallInBody(superCall); + } + if (superCallExpression) { + hierarchyFacts |= 8192; + } + addDefaultValueAssignmentsIfNeeded(prologue, constructor); + addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper); + ts6.addRange(statements, ts6.visitNodes( + constructor.body.statements, + visitor, + ts6.isStatement, + /*start*/ + statementOffset + )); + factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment()); + insertCaptureNewTargetIfNeeded( + prologue, + constructor, + /*copyOnWrite*/ + false + ); + if (isDerivedClass || superCallExpression) { + if (superCallExpression && postSuperStatementsStart === constructor.body.statements.length && !(constructor.body.transformFlags & 16384)) { + var superCall_1 = ts6.cast(ts6.cast(superCallExpression, ts6.isBinaryExpression).left, ts6.isCallExpression); + var returnStatement = factory.createReturnStatement(superCallExpression); + ts6.setCommentRange(returnStatement, ts6.getCommentRange(superCall_1)); + ts6.setEmitFlags( + superCall_1, + 1536 + /* EmitFlags.NoComments */ + ); + statements.push(returnStatement); + } else { + if (superStatementIndex <= existingPrologue.length) { + insertCaptureThisForNode(statements, constructor, superCallExpression || createActualThis()); + } else { + insertCaptureThisForNode(prologue, constructor, createActualThis()); + if (superCallExpression) { + insertSuperThisCaptureThisForNode(statements, superCallExpression); + } + } + if (!isSufficientlyCoveredByReturnStatements(constructor.body)) { + statements.push(factory.createReturnStatement(factory.createUniqueName( + "_this", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ))); + } + } + } else { + insertCaptureThisForNodeIfNeeded(prologue, constructor); + } + var body = factory.createBlock( + ts6.setTextRange( + factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), superStatementIndex <= existingPrologue.length ? ts6.emptyArray : ts6.visitNodes(constructor.body.statements, visitor, ts6.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length), true), statements, true)), + /*location*/ + constructor.body.statements + ), + /*multiLine*/ + true + ); + ts6.setTextRange(body, constructor.body); + return body; + } + function findSuperCallAndStatementIndex(originalBodyStatements, existingPrologue) { + for (var i = existingPrologue.length; i < originalBodyStatements.length; i += 1) { + var superCall = ts6.getSuperCallFromStatement(originalBodyStatements[i]); + if (superCall) { + return { + superCall, + superStatementIndex: i + }; + } + } + return { + superStatementIndex: -1 + }; + } + function isSufficientlyCoveredByReturnStatements(statement) { + if (statement.kind === 250) { + return true; + } else if (statement.kind === 242) { + var ifStatement = statement; + if (ifStatement.elseStatement) { + return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); + } + } else if (statement.kind === 238) { + var lastStatement = ts6.lastOrUndefined(statement.statements); + if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { + return true; + } + } + return false; + } + function createActualThis() { + return ts6.setEmitFlags( + factory.createThis(), + 4 + /* EmitFlags.NoSubstitution */ + ); + } + function createDefaultSuperCallOrThis() { + return factory.createLogicalOr(factory.createLogicalAnd(factory.createStrictInequality(factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), factory.createNull()), factory.createFunctionApplyCall(factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), createActualThis(), factory.createIdentifier("arguments"))), createActualThis()); + } + function visitParameter(node) { + if (node.dotDotDotToken) { + return void 0; + } else if (ts6.isBindingPattern(node.name)) { + return ts6.setOriginalNode( + ts6.setTextRange( + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + factory.getGeneratedNameForNode(node), + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ), + /*location*/ + node + ), + /*original*/ + node + ); + } else if (node.initializer) { + return ts6.setOriginalNode( + ts6.setTextRange( + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + node.name, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ), + /*location*/ + node + ), + /*original*/ + node + ); + } else { + return node; + } + } + function hasDefaultValueOrBindingPattern(node) { + return node.initializer !== void 0 || ts6.isBindingPattern(node.name); + } + function addDefaultValueAssignmentsIfNeeded(statements, node) { + if (!ts6.some(node.parameters, hasDefaultValueOrBindingPattern)) { + return false; + } + var added = false; + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + if (dotDotDotToken) { + continue; + } + if (ts6.isBindingPattern(name)) { + added = insertDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) || added; + } else if (initializer) { + insertDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); + added = true; + } + } + return added; + } + function insertDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) { + if (name.elements.length > 0) { + ts6.insertStatementAfterCustomPrologue(statements, ts6.setEmitFlags( + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList(ts6.flattenDestructuringBinding(parameter, visitor, context, 0, factory.getGeneratedNameForNode(parameter))) + ), + 1048576 + /* EmitFlags.CustomPrologue */ + )); + return true; + } else if (initializer) { + ts6.insertStatementAfterCustomPrologue(statements, ts6.setEmitFlags( + factory.createExpressionStatement(factory.createAssignment(factory.getGeneratedNameForNode(parameter), ts6.visitNode(initializer, visitor, ts6.isExpression))), + 1048576 + /* EmitFlags.CustomPrologue */ + )); + return true; + } + return false; + } + function insertDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { + initializer = ts6.visitNode(initializer, visitor, ts6.isExpression); + var statement = factory.createIfStatement(factory.createTypeCheck(factory.cloneNode(name), "undefined"), ts6.setEmitFlags( + ts6.setTextRange(factory.createBlock([ + factory.createExpressionStatement(ts6.setEmitFlags( + ts6.setTextRange(factory.createAssignment( + // TODO(rbuckton): Does this need to be parented? + ts6.setEmitFlags( + ts6.setParent(ts6.setTextRange(factory.cloneNode(name), name), name.parent), + 48 + /* EmitFlags.NoSourceMap */ + ), + ts6.setEmitFlags( + initializer, + 48 | ts6.getEmitFlags(initializer) | 1536 + /* EmitFlags.NoComments */ + ) + ), parameter), + 1536 + /* EmitFlags.NoComments */ + )) + ]), parameter), + 1 | 32 | 384 | 1536 + /* EmitFlags.NoComments */ + )); + ts6.startOnNewLine(statement); + ts6.setTextRange(statement, parameter); + ts6.setEmitFlags( + statement, + 384 | 32 | 1048576 | 1536 + /* EmitFlags.NoComments */ + ); + ts6.insertStatementAfterCustomPrologue(statements, statement); + } + function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) { + return !!(node && node.dotDotDotToken && !inConstructorWithSynthesizedSuper); + } + function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) { + var prologueStatements = []; + var parameter = ts6.lastOrUndefined(node.parameters); + if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { + return false; + } + var declarationName = parameter.name.kind === 79 ? ts6.setParent(ts6.setTextRange(factory.cloneNode(parameter.name), parameter.name), parameter.name.parent) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + ts6.setEmitFlags( + declarationName, + 48 + /* EmitFlags.NoSourceMap */ + ); + var expressionName = parameter.name.kind === 79 ? factory.cloneNode(parameter.name) : declarationName; + var restIndex = node.parameters.length - 1; + var temp = factory.createLoopVariable(); + prologueStatements.push(ts6.setEmitFlags( + ts6.setTextRange( + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + declarationName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createArrayLiteralExpression([]) + ) + ]) + ), + /*location*/ + parameter + ), + 1048576 + /* EmitFlags.CustomPrologue */ + )); + var forStatement = factory.createForStatement(ts6.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + temp, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createNumericLiteral(restIndex) + ) + ]), parameter), ts6.setTextRange(factory.createLessThan(temp, factory.createPropertyAccessExpression(factory.createIdentifier("arguments"), "length")), parameter), ts6.setTextRange(factory.createPostfixIncrement(temp), parameter), factory.createBlock([ + ts6.startOnNewLine(ts6.setTextRange( + factory.createExpressionStatement(factory.createAssignment(factory.createElementAccessExpression(expressionName, restIndex === 0 ? temp : factory.createSubtract(temp, factory.createNumericLiteral(restIndex))), factory.createElementAccessExpression(factory.createIdentifier("arguments"), temp))), + /*location*/ + parameter + )) + ])); + ts6.setEmitFlags( + forStatement, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + ts6.startOnNewLine(forStatement); + prologueStatements.push(forStatement); + if (parameter.name.kind !== 79) { + prologueStatements.push(ts6.setEmitFlags( + ts6.setTextRange(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList(ts6.flattenDestructuringBinding(parameter, visitor, context, 0, expressionName)) + ), parameter), + 1048576 + /* EmitFlags.CustomPrologue */ + )); + } + ts6.insertStatementsAfterCustomPrologue(statements, prologueStatements); + return true; + } + function insertCaptureThisForNodeIfNeeded(statements, node) { + if (hierarchyFacts & 65536 && node.kind !== 216) { + insertCaptureThisForNode(statements, node, factory.createThis()); + return true; + } + return false; + } + function insertSuperThisCaptureThisForNode(statements, superExpression) { + enableSubstitutionsForCapturedThis(); + var assignSuperExpression = factory.createExpressionStatement(factory.createBinaryExpression(factory.createThis(), 63, superExpression)); + ts6.insertStatementAfterCustomPrologue(statements, assignSuperExpression); + ts6.setCommentRange(assignSuperExpression, ts6.getOriginalNode(superExpression).parent); + } + function insertCaptureThisForNode(statements, node, initializer) { + enableSubstitutionsForCapturedThis(); + var captureThisStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + factory.createUniqueName( + "_this", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + initializer + ) + ]) + ); + ts6.setEmitFlags( + captureThisStatement, + 1536 | 1048576 + /* EmitFlags.CustomPrologue */ + ); + ts6.setSourceMapRange(captureThisStatement, node); + ts6.insertStatementAfterCustomPrologue(statements, captureThisStatement); + } + function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 32768) { + var newTarget = void 0; + switch (node.kind) { + case 216: + return statements; + case 171: + case 174: + case 175: + newTarget = factory.createVoidZero(); + break; + case 173: + newTarget = factory.createPropertyAccessExpression(ts6.setEmitFlags( + factory.createThis(), + 4 + /* EmitFlags.NoSubstitution */ + ), "constructor"); + break; + case 259: + case 215: + newTarget = factory.createConditionalExpression( + factory.createLogicalAnd(ts6.setEmitFlags( + factory.createThis(), + 4 + /* EmitFlags.NoSubstitution */ + ), factory.createBinaryExpression(ts6.setEmitFlags( + factory.createThis(), + 4 + /* EmitFlags.NoSubstitution */ + ), 102, factory.getLocalName(node))), + /*questionToken*/ + void 0, + factory.createPropertyAccessExpression(ts6.setEmitFlags( + factory.createThis(), + 4 + /* EmitFlags.NoSubstitution */ + ), "constructor"), + /*colonToken*/ + void 0, + factory.createVoidZero() + ); + break; + default: + return ts6.Debug.failBadSyntaxKind(node); + } + var captureNewTargetStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + factory.createUniqueName( + "_newTarget", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + newTarget + ) + ]) + ); + ts6.setEmitFlags( + captureNewTargetStatement, + 1536 | 1048576 + /* EmitFlags.CustomPrologue */ + ); + if (copyOnWrite) { + statements = statements.slice(); + } + ts6.insertStatementAfterCustomPrologue(statements, captureNewTargetStatement); + } + return statements; + } + function addClassMembers(statements, node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + switch (member.kind) { + case 237: + statements.push(transformSemicolonClassElementToStatement(member)); + break; + case 171: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); + break; + case 174: + case 175: + var accessors = ts6.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); + } + break; + case 173: + case 172: + break; + default: + ts6.Debug.failBadSyntaxKind(member, currentSourceFile && currentSourceFile.fileName); + break; + } + } + } + function transformSemicolonClassElementToStatement(member) { + return ts6.setTextRange(factory.createEmptyStatement(), member); + } + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var commentRange = ts6.getCommentRange(member); + var sourceMapRange = ts6.getSourceMapRange(member); + var memberFunction = transformFunctionLikeToExpression( + member, + /*location*/ + member, + /*name*/ + void 0, + container + ); + var propertyName = ts6.visitNode(member.name, visitor, ts6.isPropertyName); + var e; + if (!ts6.isPrivateIdentifier(propertyName) && ts6.getUseDefineForClassFields(context.getCompilerOptions())) { + var name = ts6.isComputedPropertyName(propertyName) ? propertyName.expression : ts6.isIdentifier(propertyName) ? factory.createStringLiteral(ts6.unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName; + e = factory.createObjectDefinePropertyCall(receiver, name, factory.createPropertyDescriptor({ value: memberFunction, enumerable: false, writable: true, configurable: true })); + } else { + var memberName = ts6.createMemberAccessForPropertyName( + factory, + receiver, + propertyName, + /*location*/ + member.name + ); + e = factory.createAssignment(memberName, memberFunction); + } + ts6.setEmitFlags( + memberFunction, + 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(memberFunction, sourceMapRange); + var statement = ts6.setTextRange( + factory.createExpressionStatement(e), + /*location*/ + member + ); + ts6.setOriginalNode(statement, member); + ts6.setCommentRange(statement, commentRange); + ts6.setEmitFlags( + statement, + 48 + /* EmitFlags.NoSourceMap */ + ); + return statement; + } + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = factory.createExpressionStatement(transformAccessorsToExpression( + receiver, + accessors, + container, + /*startsOnNewLine*/ + false + )); + ts6.setEmitFlags( + statement, + 1536 + /* EmitFlags.NoComments */ + ); + ts6.setSourceMapRange(statement, ts6.getSourceMapRange(accessors.firstAccessor)); + return statement; + } + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { + var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var target = ts6.setParent(ts6.setTextRange(factory.cloneNode(receiver), receiver), receiver.parent); + ts6.setEmitFlags( + target, + 1536 | 32 + /* EmitFlags.NoTrailingSourceMap */ + ); + ts6.setSourceMapRange(target, firstAccessor.name); + var visitedAccessorName = ts6.visitNode(firstAccessor.name, visitor, ts6.isPropertyName); + if (ts6.isPrivateIdentifier(visitedAccessorName)) { + return ts6.Debug.failBadSyntaxKind(visitedAccessorName, "Encountered unhandled private identifier while transforming ES2015."); + } + var propertyName = ts6.createExpressionForPropertyName(factory, visitedAccessorName); + ts6.setEmitFlags( + propertyName, + 1536 | 16 + /* EmitFlags.NoLeadingSourceMap */ + ); + ts6.setSourceMapRange(propertyName, firstAccessor.name); + var properties = []; + if (getAccessor) { + var getterFunction = transformFunctionLikeToExpression( + getAccessor, + /*location*/ + void 0, + /*name*/ + void 0, + container + ); + ts6.setSourceMapRange(getterFunction, ts6.getSourceMapRange(getAccessor)); + ts6.setEmitFlags( + getterFunction, + 512 + /* EmitFlags.NoLeadingComments */ + ); + var getter = factory.createPropertyAssignment("get", getterFunction); + ts6.setCommentRange(getter, ts6.getCommentRange(getAccessor)); + properties.push(getter); + } + if (setAccessor) { + var setterFunction = transformFunctionLikeToExpression( + setAccessor, + /*location*/ + void 0, + /*name*/ + void 0, + container + ); + ts6.setSourceMapRange(setterFunction, ts6.getSourceMapRange(setAccessor)); + ts6.setEmitFlags( + setterFunction, + 512 + /* EmitFlags.NoLeadingComments */ + ); + var setter = factory.createPropertyAssignment("set", setterFunction); + ts6.setCommentRange(setter, ts6.getCommentRange(setAccessor)); + properties.push(setter); + } + properties.push(factory.createPropertyAssignment("enumerable", getAccessor || setAccessor ? factory.createFalse() : factory.createTrue()), factory.createPropertyAssignment("configurable", factory.createTrue())); + var call = factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ + void 0, + [ + target, + propertyName, + factory.createObjectLiteralExpression( + properties, + /*multiLine*/ + true + ) + ] + ); + if (startsOnNewLine) { + ts6.startOnNewLine(call); + } + return call; + } + function visitArrowFunction(node) { + if (node.transformFlags & 16384 && !(hierarchyFacts & 16384)) { + hierarchyFacts |= 65536; + } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var ancestorFacts = enterSubtree( + 15232, + 66 + /* HierarchyFacts.ArrowFunctionIncludes */ + ); + var func = factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + transformFunctionBody(node) + ); + ts6.setTextRange(func, node); + ts6.setOriginalNode(func, node); + ts6.setEmitFlags( + func, + 8 + /* EmitFlags.CapturesThis */ + ); + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + convertedLoopState = savedConvertedLoopState; + return func; + } + function visitFunctionExpression(node) { + var ancestorFacts = ts6.getEmitFlags(node) & 262144 ? enterSubtree( + 32662, + 69 + /* HierarchyFacts.AsyncFunctionBodyIncludes */ + ) : enterSubtree( + 32670, + 65 + /* HierarchyFacts.FunctionIncludes */ + ); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var parameters = ts6.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + var name = hierarchyFacts & 32768 ? factory.getLocalName(node) : node.name; + exitSubtree( + ancestorFacts, + 98304, + 0 + /* HierarchyFacts.None */ + ); + convertedLoopState = savedConvertedLoopState; + return factory.updateFunctionExpression( + node, + /*modifiers*/ + void 0, + node.asteriskToken, + name, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ); + } + function visitFunctionDeclaration(node) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var ancestorFacts = enterSubtree( + 32670, + 65 + /* HierarchyFacts.FunctionIncludes */ + ); + var parameters = ts6.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + var name = hierarchyFacts & 32768 ? factory.getLocalName(node) : node.name; + exitSubtree( + ancestorFacts, + 98304, + 0 + /* HierarchyFacts.None */ + ); + convertedLoopState = savedConvertedLoopState; + return factory.updateFunctionDeclaration( + node, + ts6.visitNodes(node.modifiers, visitor, ts6.isModifier), + node.asteriskToken, + name, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ); + } + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var ancestorFacts = container && ts6.isClassLike(container) && !ts6.isStatic(node) ? enterSubtree( + 32670, + 65 | 8 + /* HierarchyFacts.NonStaticClassElement */ + ) : enterSubtree( + 32670, + 65 + /* HierarchyFacts.FunctionIncludes */ + ); + var parameters = ts6.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 32768 && !name && (node.kind === 259 || node.kind === 215)) { + name = factory.getGeneratedNameForNode(node); + } + exitSubtree( + ancestorFacts, + 98304, + 0 + /* HierarchyFacts.None */ + ); + convertedLoopState = savedConvertedLoopState; + return ts6.setOriginalNode( + ts6.setTextRange(factory.createFunctionExpression( + /*modifiers*/ + void 0, + node.asteriskToken, + name, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ), location), + /*original*/ + node + ); + } + function transformFunctionBody(node) { + var multiLine = false; + var singleLine = false; + var statementsLocation; + var closeBraceLocation; + var prologue = []; + var statements = []; + var body = node.body; + var statementOffset; + resumeLexicalEnvironment(); + if (ts6.isBlock(body)) { + statementOffset = factory.copyStandardPrologue( + body.statements, + prologue, + 0, + /*ensureUseStrict*/ + false + ); + statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts6.isHoistedFunction); + statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts6.isHoistedVariableStatement); + } + multiLine = addDefaultValueAssignmentsIfNeeded(statements, node) || multiLine; + multiLine = addRestParameterIfNeeded( + statements, + node, + /*inConstructorWithSynthesizedSuper*/ + false + ) || multiLine; + if (ts6.isBlock(body)) { + statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor); + statementsLocation = body.statements; + ts6.addRange(statements, ts6.visitNodes(body.statements, visitor, ts6.isStatement, statementOffset)); + if (!multiLine && body.multiLine) { + multiLine = true; + } + } else { + ts6.Debug.assert( + node.kind === 216 + /* SyntaxKind.ArrowFunction */ + ); + statementsLocation = ts6.moveRangeEnd(body, -1); + var equalsGreaterThanToken = node.equalsGreaterThanToken; + if (!ts6.nodeIsSynthesized(equalsGreaterThanToken) && !ts6.nodeIsSynthesized(body)) { + if (ts6.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) { + singleLine = true; + } else { + multiLine = true; + } + } + var expression = ts6.visitNode(body, visitor, ts6.isExpression); + var returnStatement = factory.createReturnStatement(expression); + ts6.setTextRange(returnStatement, body); + ts6.moveSyntheticComments(returnStatement, body); + ts6.setEmitFlags( + returnStatement, + 384 | 32 | 1024 + /* EmitFlags.NoTrailingComments */ + ); + statements.push(returnStatement); + closeBraceLocation = body; + } + factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment()); + insertCaptureNewTargetIfNeeded( + prologue, + node, + /*copyOnWrite*/ + false + ); + insertCaptureThisForNodeIfNeeded(prologue, node); + if (ts6.some(prologue)) { + multiLine = true; + } + statements.unshift.apply(statements, prologue); + if (ts6.isBlock(body) && ts6.arrayIsEqualTo(statements, body.statements)) { + return body; + } + var block = factory.createBlock(ts6.setTextRange(factory.createNodeArray(statements), statementsLocation), multiLine); + ts6.setTextRange(block, node.body); + if (!multiLine && singleLine) { + ts6.setEmitFlags( + block, + 1 + /* EmitFlags.SingleLine */ + ); + } + if (closeBraceLocation) { + ts6.setTokenSourceMapRange(block, 19, closeBraceLocation); + } + ts6.setOriginalNode(block, node.body); + return block; + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts6.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 ? enterSubtree( + 7104, + 512 + /* HierarchyFacts.IterationStatementBlockIncludes */ + ) : enterSubtree( + 6976, + 128 + /* HierarchyFacts.BlockIncludes */ + ); + var updated = ts6.visitEachChild(node, visitor, context); + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return updated; + } + function visitExpressionStatement(node) { + return ts6.visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + function visitParenthesizedExpression(node, expressionResultIsUnused) { + return ts6.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); + } + function visitBinaryExpression(node, expressionResultIsUnused) { + if (ts6.isDestructuringAssignment(node)) { + return ts6.flattenDestructuringAssignment(node, visitor, context, 0, !expressionResultIsUnused); + } + if (node.operatorToken.kind === 27) { + return factory.updateBinaryExpression(node, ts6.visitNode(node.left, visitorWithUnusedExpressionResult, ts6.isExpression), node.operatorToken, ts6.visitNode(node.right, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, ts6.isExpression)); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitCommaListExpression(node, expressionResultIsUnused) { + if (expressionResultIsUnused) { + return ts6.visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + var result; + for (var i = 0; i < node.elements.length; i++) { + var element = node.elements[i]; + var visited = ts6.visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, ts6.isExpression); + if (result || visited !== element) { + result || (result = node.elements.slice(0, i)); + result.push(visited); + } + } + var elements = result ? ts6.setTextRange(factory.createNodeArray(result), node.elements) : node.elements; + return factory.updateCommaListExpression(node, elements); + } + function isVariableStatementOfTypeScriptClassWrapper(node) { + return node.declarationList.declarations.length === 1 && !!node.declarationList.declarations[0].initializer && !!(ts6.getEmitFlags(node.declarationList.declarations[0].initializer) & 33554432); + } + function visitVariableStatement(node) { + var ancestorFacts = enterSubtree( + 0, + ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ) ? 32 : 0 + /* HierarchyFacts.None */ + ); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) { + var assignments = void 0; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl); + if (decl.initializer) { + var assignment = void 0; + if (ts6.isBindingPattern(decl.name)) { + assignment = ts6.flattenDestructuringAssignment( + decl, + visitor, + context, + 0 + /* FlattenLevel.All */ + ); + } else { + assignment = factory.createBinaryExpression(decl.name, 63, ts6.visitNode(decl.initializer, visitor, ts6.isExpression)); + ts6.setTextRange(assignment, decl); + } + assignments = ts6.append(assignments, assignment); + } + } + if (assignments) { + updated = ts6.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(assignments)), node); + } else { + updated = void 0; + } + } else { + updated = ts6.visitEachChild(node, visitor, context); + } + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return updated; + } + function visitVariableDeclarationList(node) { + if (node.flags & 3 || node.transformFlags & 524288) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts6.flatMap(node.declarations, node.flags & 1 ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration); + var declarationList = factory.createVariableDeclarationList(declarations); + ts6.setOriginalNode(declarationList, node); + ts6.setTextRange(declarationList, node); + ts6.setCommentRange(declarationList, node); + if (node.transformFlags & 524288 && (ts6.isBindingPattern(node.declarations[0].name) || ts6.isBindingPattern(ts6.last(node.declarations).name))) { + ts6.setSourceMapRange(declarationList, getRangeUnion(declarations)); + } + return declarationList; + } + return ts6.visitEachChild(node, visitor, context); + } + function getRangeUnion(declarations) { + var pos = -1, end = -1; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var node = declarations_10[_i]; + pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos); + end = Math.max(end, node.end); + } + return ts6.createRange(pos, end); + } + function shouldEmitExplicitInitializerForLetDeclaration(node) { + var flags = resolver.getNodeCheckFlags(node); + var isCapturedInFunction = flags & 262144; + var isDeclaredInLoop = flags & 524288; + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512) !== 0; + var emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 | 4096)) === 0); + return emitExplicitInitializer; + } + function visitVariableDeclarationInLetDeclarationList(node) { + var name = node.name; + if (ts6.isBindingPattern(name)) { + return visitVariableDeclaration(node); + } + if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { + return factory.updateVariableDeclaration( + node, + node.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createVoidZero() + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree( + 32, + 0 + /* HierarchyFacts.None */ + ); + var updated; + if (ts6.isBindingPattern(node.name)) { + updated = ts6.flattenDestructuringBinding( + node, + visitor, + context, + 0, + /*value*/ + void 0, + (ancestorFacts & 32) !== 0 + ); + } else { + updated = ts6.visitEachChild(node, visitor, context); + } + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels.set(ts6.idText(node.label), true); + } + function resetLabel(node) { + convertedLoopState.labels.set(ts6.idText(node.label), false); + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = new ts6.Map(); + } + var statement = ts6.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return ts6.isIterationStatement( + statement, + /*lookInLabeledStatements*/ + false + ) ? visitIterationStatement( + statement, + /*outermostLabeledStatement*/ + node + ) : factory.restoreEnclosingLabel(ts6.visitNode(statement, visitor, ts6.isStatement, factory.liftToBlock), node, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 243: + case 244: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 245: + return visitForStatement(node, outermostLabeledStatement); + case 246: + return visitForInStatement(node, outermostLabeledStatement); + case 247: + return visitForOfStatement(node, outermostLabeledStatement); + } + } + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert); + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return updated; + } + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 1280, node, outermostLabeledStatement); + } + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(5056, 3328, node, outermostLabeledStatement); + } + function visitEachChildOfForStatement(node) { + return factory.updateForStatement(node, ts6.visitNode(node.initializer, visitorWithUnusedExpressionResult, ts6.isForInitializer), ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, visitorWithUnusedExpressionResult, ts6.isExpression), ts6.visitNode(node.statement, visitor, ts6.isStatement, factory.liftToBlock)); + } + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 5376, node, outermostLabeledStatement); + } + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 5376, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); + } + function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { + var statements = []; + var initializer = node.initializer; + if (ts6.isVariableDeclarationList(initializer)) { + if (node.initializer.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var firstOriginalDeclaration = ts6.firstOrUndefined(initializer.declarations); + if (firstOriginalDeclaration && ts6.isBindingPattern(firstOriginalDeclaration.name)) { + var declarations = ts6.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, boundValue); + var declarationList = ts6.setTextRange(factory.createVariableDeclarationList(declarations), node.initializer); + ts6.setOriginalNode(declarationList, node.initializer); + ts6.setSourceMapRange(declarationList, ts6.createRange(declarations[0].pos, ts6.last(declarations).end)); + statements.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + declarationList + )); + } else { + statements.push(ts6.setTextRange(factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.setOriginalNode(ts6.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + firstOriginalDeclaration ? firstOriginalDeclaration.name : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + boundValue + ) + ]), ts6.moveRangePos(initializer, -1)), initializer) + ), ts6.moveRangeEnd(initializer, -1))); + } + } else { + var assignment = factory.createAssignment(initializer, boundValue); + if (ts6.isDestructuringAssignment(assignment)) { + statements.push(factory.createExpressionStatement(visitBinaryExpression( + assignment, + /*expressionResultIsUnused*/ + true + ))); + } else { + ts6.setTextRangeEnd(assignment, initializer.end); + statements.push(ts6.setTextRange(factory.createExpressionStatement(ts6.visitNode(assignment, visitor, ts6.isExpression)), ts6.moveRangeEnd(initializer, -1))); + } + } + if (convertedLoopBodyStatements) { + return createSyntheticBlockForConvertedStatements(ts6.addRange(statements, convertedLoopBodyStatements)); + } else { + var statement = ts6.visitNode(node.statement, visitor, ts6.isStatement, factory.liftToBlock); + if (ts6.isBlock(statement)) { + return factory.updateBlock(statement, ts6.setTextRange(factory.createNodeArray(ts6.concatenate(statements, statement.statements)), statement.statements)); + } else { + statements.push(statement); + return createSyntheticBlockForConvertedStatements(statements); + } + } + } + function createSyntheticBlockForConvertedStatements(statements) { + return ts6.setEmitFlags( + factory.createBlock( + factory.createNodeArray(statements), + /*multiLine*/ + true + ), + 48 | 384 + /* EmitFlags.NoTokenSourceMaps */ + ); + } + function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + var counter = factory.createLoopVariable(); + var rhsReference = ts6.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + ts6.setEmitFlags(expression, 48 | ts6.getEmitFlags(expression)); + var forStatement = ts6.setTextRange( + factory.createForStatement( + /*initializer*/ + ts6.setEmitFlags( + ts6.setTextRange(factory.createVariableDeclarationList([ + ts6.setTextRange(factory.createVariableDeclaration( + counter, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createNumericLiteral(0) + ), ts6.moveRangePos(node.expression, -1)), + ts6.setTextRange(factory.createVariableDeclaration( + rhsReference, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + expression + ), node.expression) + ]), node.expression), + 2097152 + /* EmitFlags.NoHoisting */ + ), + /*condition*/ + ts6.setTextRange(factory.createLessThan(counter, factory.createPropertyAccessExpression(rhsReference, "length")), node.expression), + /*incrementor*/ + ts6.setTextRange(factory.createPostfixIncrement(counter), node.expression), + /*statement*/ + convertForOfStatementHead(node, factory.createElementAccessExpression(rhsReference, counter), convertedLoopBodyStatements) + ), + /*location*/ + node + ); + ts6.setEmitFlags( + forStatement, + 256 + /* EmitFlags.NoTokenTrailingSourceMaps */ + ); + ts6.setTextRange(forStatement, node); + return factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + var iterator = ts6.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var result = ts6.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var errorRecord = factory.createUniqueName("e"); + var catchVariable = factory.getGeneratedNameForNode(errorRecord); + var returnMethod = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var values = ts6.setTextRange(emitHelpers().createValuesHelper(expression), node.expression); + var next = factory.createCallExpression( + factory.createPropertyAccessExpression(iterator, "next"), + /*typeArguments*/ + void 0, + [] + ); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var initializer = ancestorFacts & 1024 ? factory.inlineExpressions([factory.createAssignment(errorRecord, factory.createVoidZero()), values]) : values; + var forStatement = ts6.setEmitFlags( + ts6.setTextRange( + factory.createForStatement( + /*initializer*/ + ts6.setEmitFlags( + ts6.setTextRange(factory.createVariableDeclarationList([ + ts6.setTextRange(factory.createVariableDeclaration( + iterator, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + initializer + ), node.expression), + factory.createVariableDeclaration( + result, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + next + ) + ]), node.expression), + 2097152 + /* EmitFlags.NoHoisting */ + ), + /*condition*/ + factory.createLogicalNot(factory.createPropertyAccessExpression(result, "done")), + /*incrementor*/ + factory.createAssignment(result, next), + /*statement*/ + convertForOfStatementHead(node, factory.createPropertyAccessExpression(result, "value"), convertedLoopBodyStatements) + ), + /*location*/ + node + ), + 256 + /* EmitFlags.NoTokenTrailingSourceMaps */ + ); + return factory.createTryStatement(factory.createBlock([ + factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) + ]), factory.createCatchClause(factory.createVariableDeclaration(catchVariable), ts6.setEmitFlags( + factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(errorRecord, factory.createObjectLiteralExpression([ + factory.createPropertyAssignment("error", catchVariable) + ]))) + ]), + 1 + /* EmitFlags.SingleLine */ + )), factory.createBlock([ + factory.createTryStatement( + /*tryBlock*/ + factory.createBlock([ + ts6.setEmitFlags( + factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(factory.createPropertyAccessExpression(result, "done"))), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(factory.createFunctionCallCall(returnMethod, iterator, []))), + 1 + /* EmitFlags.SingleLine */ + ) + ]), + /*catchClause*/ + void 0, + /*finallyBlock*/ + ts6.setEmitFlags( + factory.createBlock([ + ts6.setEmitFlags( + factory.createIfStatement(errorRecord, factory.createThrowStatement(factory.createPropertyAccessExpression(errorRecord, "error"))), + 1 + /* EmitFlags.SingleLine */ + ) + ]), + 1 + /* EmitFlags.SingleLine */ + ) + ) + ])); + } + function visitObjectLiteralExpression(node) { + var properties = node.properties; + var numInitialProperties = -1, hasComputed = false; + for (var i = 0; i < properties.length; i++) { + var property = properties[i]; + if (property.transformFlags & 1048576 && hierarchyFacts & 4 || (hasComputed = ts6.Debug.checkDefined(property.name).kind === 164)) { + numInitialProperties = i; + break; + } + } + if (numInitialProperties < 0) { + return ts6.visitEachChild(node, visitor, context); + } + var temp = factory.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = factory.createAssignment(temp, ts6.setEmitFlags(factory.createObjectLiteralExpression(ts6.visitNodes(properties, visitor, ts6.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), hasComputed ? 65536 : 0)); + if (node.multiLine) { + ts6.startOnNewLine(assignment); + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts6.startOnNewLine(ts6.setParent(ts6.setTextRange(factory.cloneNode(temp), temp), temp.parent)) : temp); + return factory.inlineExpressions(expressions); + } + function shouldConvertPartOfIterationStatement(node) { + return (resolver.getNodeCheckFlags(node) & 131072) !== 0; + } + function shouldConvertInitializerOfForStatement(node) { + return ts6.isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer); + } + function shouldConvertConditionOfForStatement(node) { + return ts6.isForStatement(node) && !!node.condition && shouldConvertPartOfIterationStatement(node.condition); + } + function shouldConvertIncrementorOfForStatement(node) { + return ts6.isForStatement(node) && !!node.incrementor && shouldConvertPartOfIterationStatement(node.incrementor); + } + function shouldConvertIterationStatement(node) { + return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node); + } + function shouldConvertBodyOfIterationStatement(node) { + return (resolver.getNodeCheckFlags(node) & 65536) !== 0; + } + function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) { + if (!state.hoistedLocalVariables) { + state.hoistedLocalVariables = []; + } + visit(node.name); + function visit(node2) { + if (node2.kind === 79) { + state.hoistedLocalVariables.push(node2); + } else { + for (var _i = 0, _a = node2.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + visit(element.name); + } + } + } + } + } + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) { + if (!shouldConvertIterationStatement(node)) { + var saveAllowedNonLabeledJumps = void 0; + if (convertedLoopState) { + saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps = 2 | 4; + } + var result = convert ? convert( + node, + outermostLabeledStatement, + /*convertedLoopBodyStatements*/ + void 0, + ancestorFacts + ) : factory.restoreEnclosingLabel(ts6.isForStatement(node) ? visitEachChildOfForStatement(node) : ts6.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); + if (convertedLoopState) { + convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; + } + return result; + } + var currentState = createConvertedLoopState(node); + var statements = []; + var outerConvertedLoopState = convertedLoopState; + convertedLoopState = currentState; + var initializerFunction = shouldConvertInitializerOfForStatement(node) ? createFunctionForInitializerOfForStatement(node, currentState) : void 0; + var bodyFunction = shouldConvertBodyOfIterationStatement(node) ? createFunctionForBodyOfIterationStatement(node, currentState, outerConvertedLoopState) : void 0; + convertedLoopState = outerConvertedLoopState; + if (initializerFunction) + statements.push(initializerFunction.functionDeclaration); + if (bodyFunction) + statements.push(bodyFunction.functionDeclaration); + addExtraDeclarationsForConvertedLoop(statements, currentState, outerConvertedLoopState); + if (initializerFunction) { + statements.push(generateCallToConvertedLoopInitializer(initializerFunction.functionName, initializerFunction.containsYield)); + } + var loop; + if (bodyFunction) { + if (convert) { + loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts); + } else { + var clone_4 = convertIterationStatementCore(node, initializerFunction, factory.createBlock( + bodyFunction.part, + /*multiLine*/ + true + )); + loop = factory.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); + } + } else { + var clone_5 = convertIterationStatementCore(node, initializerFunction, ts6.visitNode(node.statement, visitor, ts6.isStatement, factory.liftToBlock)); + loop = factory.restoreEnclosingLabel(clone_5, outermostLabeledStatement, convertedLoopState && resetLabel); + } + statements.push(loop); + return statements; + } + function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { + switch (node.kind) { + case 245: + return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246: + return convertForInStatement(node, convertedLoopBody); + case 247: + return convertForOfStatement(node, convertedLoopBody); + case 243: + return convertDoStatement(node, convertedLoopBody); + case 244: + return convertWhileStatement(node, convertedLoopBody); + default: + return ts6.Debug.failBadSyntaxKind(node, "IterationStatement expected"); + } + } + function convertForStatement(node, initializerFunction, convertedLoopBody) { + var shouldConvertCondition = node.condition && shouldConvertPartOfIterationStatement(node.condition); + var shouldConvertIncrementor = shouldConvertCondition || node.incrementor && shouldConvertPartOfIterationStatement(node.incrementor); + return factory.updateForStatement(node, ts6.visitNode(initializerFunction ? initializerFunction.part : node.initializer, visitorWithUnusedExpressionResult, ts6.isForInitializer), ts6.visitNode(shouldConvertCondition ? void 0 : node.condition, visitor, ts6.isExpression), ts6.visitNode(shouldConvertIncrementor ? void 0 : node.incrementor, visitorWithUnusedExpressionResult, ts6.isExpression), convertedLoopBody); + } + function convertForOfStatement(node, convertedLoopBody) { + return factory.updateForOfStatement( + node, + /*awaitModifier*/ + void 0, + ts6.visitNode(node.initializer, visitor, ts6.isForInitializer), + ts6.visitNode(node.expression, visitor, ts6.isExpression), + convertedLoopBody + ); + } + function convertForInStatement(node, convertedLoopBody) { + return factory.updateForInStatement(node, ts6.visitNode(node.initializer, visitor, ts6.isForInitializer), ts6.visitNode(node.expression, visitor, ts6.isExpression), convertedLoopBody); + } + function convertDoStatement(node, convertedLoopBody) { + return factory.updateDoStatement(node, convertedLoopBody, ts6.visitNode(node.expression, visitor, ts6.isExpression)); + } + function convertWhileStatement(node, convertedLoopBody) { + return factory.updateWhileStatement(node, ts6.visitNode(node.expression, visitor, ts6.isExpression), convertedLoopBody); + } + function createConvertedLoopState(node) { + var loopInitializer; + switch (node.kind) { + case 245: + case 246: + case 247: + var initializer = node.initializer; + if (initializer && initializer.kind === 258) { + loopInitializer = initializer; + } + break; + } + var loopParameters = []; + var loopOutParameters = []; + if (loopInitializer && ts6.getCombinedNodeFlags(loopInitializer) & 3) { + var hasCapturedBindingsInForHead = shouldConvertInitializerOfForStatement(node) || shouldConvertConditionOfForStatement(node) || shouldConvertIncrementorOfForStatement(node); + for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + processLoopVariableDeclaration(node, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForHead); + } + } + var currentState = { loopParameters, loopOutParameters }; + if (convertedLoopState) { + if (convertedLoopState.argumentsName) { + currentState.argumentsName = convertedLoopState.argumentsName; + } + if (convertedLoopState.thisName) { + currentState.thisName = convertedLoopState.thisName; + } + if (convertedLoopState.hoistedLocalVariables) { + currentState.hoistedLocalVariables = convertedLoopState.hoistedLocalVariables; + } + } + return currentState; + } + function addExtraDeclarationsForConvertedLoop(statements, state, outerState) { + var extraVariableDeclarations; + if (state.argumentsName) { + if (outerState) { + outerState.argumentsName = state.argumentsName; + } else { + (extraVariableDeclarations || (extraVariableDeclarations = [])).push(factory.createVariableDeclaration( + state.argumentsName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createIdentifier("arguments") + )); + } + } + if (state.thisName) { + if (outerState) { + outerState.thisName = state.thisName; + } else { + (extraVariableDeclarations || (extraVariableDeclarations = [])).push(factory.createVariableDeclaration( + state.thisName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createIdentifier("this") + )); + } + } + if (state.hoistedLocalVariables) { + if (outerState) { + outerState.hoistedLocalVariables = state.hoistedLocalVariables; + } else { + if (!extraVariableDeclarations) { + extraVariableDeclarations = []; + } + for (var _i = 0, _a = state.hoistedLocalVariables; _i < _a.length; _i++) { + var identifier = _a[_i]; + extraVariableDeclarations.push(factory.createVariableDeclaration(identifier)); + } + } + } + if (state.loopOutParameters.length) { + if (!extraVariableDeclarations) { + extraVariableDeclarations = []; + } + for (var _b = 0, _c = state.loopOutParameters; _b < _c.length; _b++) { + var outParam = _c[_b]; + extraVariableDeclarations.push(factory.createVariableDeclaration(outParam.outParamName)); + } + } + if (state.conditionVariable) { + if (!extraVariableDeclarations) { + extraVariableDeclarations = []; + } + extraVariableDeclarations.push(factory.createVariableDeclaration( + state.conditionVariable, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createFalse() + )); + } + if (extraVariableDeclarations) { + statements.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList(extraVariableDeclarations) + )); + } + } + function createOutVariable(p) { + return factory.createVariableDeclaration( + p.originalName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + p.outParamName + ); + } + function createFunctionForInitializerOfForStatement(node, currentState) { + var functionName = factory.createUniqueName("_loop_init"); + var containsYield = (node.initializer.transformFlags & 1048576) !== 0; + var emitFlags = 0; + if (currentState.containsLexicalThis) + emitFlags |= 8; + if (containsYield && hierarchyFacts & 4) + emitFlags |= 262144; + var statements = []; + statements.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + node.initializer + )); + copyOutParameters(currentState.loopOutParameters, 2, 1, statements); + var functionDeclaration = factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.setEmitFlags( + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + functionName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.setEmitFlags(factory.createFunctionExpression( + /*modifiers*/ + void 0, + containsYield ? factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ) : void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + void 0, + /*type*/ + void 0, + ts6.visitNode(factory.createBlock( + statements, + /*multiLine*/ + true + ), visitor, ts6.isBlock) + ), emitFlags) + ) + ]), + 2097152 + /* EmitFlags.NoHoisting */ + ) + ); + var part = factory.createVariableDeclarationList(ts6.map(currentState.loopOutParameters, createOutVariable)); + return { functionName, containsYield, functionDeclaration, part }; + } + function createFunctionForBodyOfIterationStatement(node, currentState, outerState) { + var functionName = factory.createUniqueName("_loop"); + startLexicalEnvironment(); + var statement = ts6.visitNode(node.statement, visitor, ts6.isStatement, factory.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); + var statements = []; + if (shouldConvertConditionOfForStatement(node) || shouldConvertIncrementorOfForStatement(node)) { + currentState.conditionVariable = factory.createUniqueName("inc"); + if (node.incrementor) { + statements.push(factory.createIfStatement(currentState.conditionVariable, factory.createExpressionStatement(ts6.visitNode(node.incrementor, visitor, ts6.isExpression)), factory.createExpressionStatement(factory.createAssignment(currentState.conditionVariable, factory.createTrue())))); + } else { + statements.push(factory.createIfStatement(factory.createLogicalNot(currentState.conditionVariable), factory.createExpressionStatement(factory.createAssignment(currentState.conditionVariable, factory.createTrue())))); + } + if (shouldConvertConditionOfForStatement(node)) { + statements.push(factory.createIfStatement(factory.createPrefixUnaryExpression(53, ts6.visitNode(node.condition, visitor, ts6.isExpression)), ts6.visitNode(factory.createBreakStatement(), visitor, ts6.isStatement))); + } + } + if (ts6.isBlock(statement)) { + ts6.addRange(statements, statement.statements); + } else { + statements.push(statement); + } + copyOutParameters(currentState.loopOutParameters, 1, 1, statements); + ts6.insertStatementsAfterStandardPrologue(statements, lexicalEnvironment); + var loopBody = factory.createBlock( + statements, + /*multiLine*/ + true + ); + if (ts6.isBlock(statement)) + ts6.setOriginalNode(loopBody, statement); + var containsYield = (node.statement.transformFlags & 1048576) !== 0; + var emitFlags = 524288; + if (currentState.containsLexicalThis) + emitFlags |= 8; + if (containsYield && (hierarchyFacts & 4) !== 0) + emitFlags |= 262144; + var functionDeclaration = factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.setEmitFlags( + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + functionName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.setEmitFlags(factory.createFunctionExpression( + /*modifiers*/ + void 0, + containsYield ? factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ) : void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + currentState.loopParameters, + /*type*/ + void 0, + loopBody + ), emitFlags) + ) + ]), + 2097152 + /* EmitFlags.NoHoisting */ + ) + ); + var part = generateCallToConvertedLoop(functionName, currentState, outerState, containsYield); + return { functionName, containsYield, functionDeclaration, part }; + } + function copyOutParameter(outParam, copyDirection) { + var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName; + var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName; + return factory.createBinaryExpression(target, 63, source); + } + function copyOutParameters(outParams, partFlags, copyDirection, statements) { + for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) { + var outParam = outParams_1[_i]; + if (outParam.flags & partFlags) { + statements.push(factory.createExpressionStatement(copyOutParameter(outParam, copyDirection))); + } + } + } + function generateCallToConvertedLoopInitializer(initFunctionExpressionName, containsYield) { + var call = factory.createCallExpression( + initFunctionExpressionName, + /*typeArguments*/ + void 0, + [] + ); + var callResult = containsYield ? factory.createYieldExpression(factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ), ts6.setEmitFlags( + call, + 8388608 + /* EmitFlags.Iterator */ + )) : call; + return factory.createExpressionStatement(callResult); + } + function generateCallToConvertedLoop(loopFunctionExpressionName, state, outerState, containsYield) { + var statements = []; + var isSimpleLoop = !(state.nonLocalJumps & ~4) && !state.labeledNonLocalBreaks && !state.labeledNonLocalContinues; + var call = factory.createCallExpression( + loopFunctionExpressionName, + /*typeArguments*/ + void 0, + ts6.map(state.loopParameters, function(p) { + return p.name; + }) + ); + var callResult = containsYield ? factory.createYieldExpression(factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ), ts6.setEmitFlags( + call, + 8388608 + /* EmitFlags.Iterator */ + )) : call; + if (isSimpleLoop) { + statements.push(factory.createExpressionStatement(callResult)); + copyOutParameters(state.loopOutParameters, 1, 0, statements); + } else { + var loopResultName = factory.createUniqueName("state"); + var stateVariable = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([factory.createVariableDeclaration( + loopResultName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + callResult + )]) + ); + statements.push(stateVariable); + copyOutParameters(state.loopOutParameters, 1, 0, statements); + if (state.nonLocalJumps & 8) { + var returnStatement = void 0; + if (outerState) { + outerState.nonLocalJumps |= 8; + returnStatement = factory.createReturnStatement(loopResultName); + } else { + returnStatement = factory.createReturnStatement(factory.createPropertyAccessExpression(loopResultName, "value")); + } + statements.push(factory.createIfStatement(factory.createTypeCheck(loopResultName, "object"), returnStatement)); + } + if (state.nonLocalJumps & 2) { + statements.push(factory.createIfStatement(factory.createStrictEquality(loopResultName, factory.createStringLiteral("break")), factory.createBreakStatement())); + } + if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) { + var caseClauses = []; + processLabeledJumps( + state.labeledNonLocalBreaks, + /*isBreak*/ + true, + loopResultName, + outerState, + caseClauses + ); + processLabeledJumps( + state.labeledNonLocalContinues, + /*isBreak*/ + false, + loopResultName, + outerState, + caseClauses + ); + statements.push(factory.createSwitchStatement(loopResultName, factory.createCaseBlock(caseClauses))); + } + } + return statements; + } + function setLabeledJump(state, isBreak, labelText, labelMarker) { + if (isBreak) { + if (!state.labeledNonLocalBreaks) { + state.labeledNonLocalBreaks = new ts6.Map(); + } + state.labeledNonLocalBreaks.set(labelText, labelMarker); + } else { + if (!state.labeledNonLocalContinues) { + state.labeledNonLocalContinues = new ts6.Map(); + } + state.labeledNonLocalContinues.set(labelText, labelMarker); + } + } + function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { + if (!table) { + return; + } + table.forEach(function(labelMarker, labelText) { + var statements = []; + if (!outerLoop || outerLoop.labels && outerLoop.labels.get(labelText)) { + var label = factory.createIdentifier(labelText); + statements.push(isBreak ? factory.createBreakStatement(label) : factory.createContinueStatement(label)); + } else { + setLabeledJump(outerLoop, isBreak, labelText, labelMarker); + statements.push(factory.createReturnStatement(loopResultName)); + } + caseClauses.push(factory.createCaseClause(factory.createStringLiteral(labelMarker), statements)); + }); + } + function processLoopVariableDeclaration(container, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForHead) { + var name = decl.name; + if (ts6.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + processLoopVariableDeclaration(container, element, loopParameters, loopOutParameters, hasCapturedBindingsInForHead); + } + } + } else { + loopParameters.push(factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + name + )); + var checkFlags = resolver.getNodeCheckFlags(decl); + if (checkFlags & 4194304 || hasCapturedBindingsInForHead) { + var outParamName = factory.createUniqueName("out_" + ts6.idText(name)); + var flags = 0; + if (checkFlags & 4194304) { + flags |= 1; + } + if (ts6.isForStatement(container)) { + if (container.initializer && resolver.isBindingCapturedByNode(container.initializer, decl)) { + flags |= 2; + } + if (container.condition && resolver.isBindingCapturedByNode(container.condition, decl) || container.incrementor && resolver.isBindingCapturedByNode(container.incrementor, decl)) { + flags |= 1; + } + } + loopOutParameters.push({ flags, originalName: name, outParamName }); + } + } + } + function addObjectLiteralMembers(expressions, node, receiver, start) { + var properties = node.properties; + var numProperties = properties.length; + for (var i = start; i < numProperties; i++) { + var property = properties[i]; + switch (property.kind) { + case 174: + case 175: + var accessors = ts6.getAllAccessorDeclarations(node.properties, property); + if (property === accessors.firstAccessor) { + expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); + } + break; + case 171: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 299: + expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); + break; + case 300: + expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); + break; + default: + ts6.Debug.failBadSyntaxKind(node); + break; + } + } + } + function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { + var expression = factory.createAssignment(ts6.createMemberAccessForPropertyName(factory, receiver, ts6.visitNode(property.name, visitor, ts6.isPropertyName)), ts6.visitNode(property.initializer, visitor, ts6.isExpression)); + ts6.setTextRange(expression, property); + if (startsOnNewLine) { + ts6.startOnNewLine(expression); + } + return expression; + } + function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { + var expression = factory.createAssignment(ts6.createMemberAccessForPropertyName(factory, receiver, ts6.visitNode(property.name, visitor, ts6.isPropertyName)), factory.cloneNode(property.name)); + ts6.setTextRange(expression, property); + if (startsOnNewLine) { + ts6.startOnNewLine(expression); + } + return expression; + } + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var expression = factory.createAssignment(ts6.createMemberAccessForPropertyName(factory, receiver, ts6.visitNode(method.name, visitor, ts6.isPropertyName)), transformFunctionLikeToExpression( + method, + /*location*/ + method, + /*name*/ + void 0, + container + )); + ts6.setTextRange(expression, method); + if (startsOnNewLine) { + ts6.startOnNewLine(expression); + } + return expression; + } + function visitCatchClause(node) { + var ancestorFacts = enterSubtree( + 7104, + 0 + /* HierarchyFacts.BlockScopeIncludes */ + ); + var updated; + ts6.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015."); + if (ts6.isBindingPattern(node.variableDeclaration.name)) { + var temp = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + var newVariableDeclaration = factory.createVariableDeclaration(temp); + ts6.setTextRange(newVariableDeclaration, node.variableDeclaration); + var vars = ts6.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = factory.createVariableDeclarationList(vars); + ts6.setTextRange(list, node.variableDeclaration); + var destructure = factory.createVariableStatement( + /*modifiers*/ + void 0, + list + ); + updated = factory.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } else { + updated = ts6.visitEachChild(node, visitor, context); + } + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return updated; + } + function addStatementToStartOfBlock(block, statement) { + var transformedStatements = ts6.visitNodes(block.statements, visitor, ts6.isStatement); + return factory.updateBlock(block, __spreadArray([statement], transformedStatements, true)); + } + function visitMethodDeclaration(node) { + ts6.Debug.assert(!ts6.isComputedPropertyName(node.name)); + var functionExpression = transformFunctionLikeToExpression( + node, + /*location*/ + ts6.moveRangePos(node, -1), + /*name*/ + void 0, + /*container*/ + void 0 + ); + ts6.setEmitFlags(functionExpression, 512 | ts6.getEmitFlags(functionExpression)); + return ts6.setTextRange( + factory.createPropertyAssignment(node.name, functionExpression), + /*location*/ + node + ); + } + function visitAccessorDeclaration(node) { + ts6.Debug.assert(!ts6.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var ancestorFacts = enterSubtree( + 32670, + 65 + /* HierarchyFacts.FunctionIncludes */ + ); + var updated; + var parameters = ts6.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (node.kind === 174) { + updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); + } else { + updated = factory.updateSetAccessorDeclaration(node, node.modifiers, node.name, parameters, body); + } + exitSubtree( + ancestorFacts, + 98304, + 0 + /* HierarchyFacts.None */ + ); + convertedLoopState = savedConvertedLoopState; + return updated; + } + function visitShorthandPropertyAssignment(node) { + return ts6.setTextRange( + factory.createPropertyAssignment(node.name, visitIdentifier(factory.cloneNode(node.name))), + /*location*/ + node + ); + } + function visitComputedPropertyName(node) { + return ts6.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + return ts6.visitEachChild(node, visitor, context); + } + function visitArrayLiteralExpression(node) { + if (ts6.some(node.elements, ts6.isSpreadElement)) { + return transformAndSpreadElements( + node.elements, + /*isArgumentList*/ + false, + !!node.multiLine, + /*hasTrailingComma*/ + !!node.elements.hasTrailingComma + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitCallExpression(node) { + if (ts6.getEmitFlags(node) & 33554432) { + return visitTypeScriptClassWrapper(node); + } + var expression = ts6.skipOuterExpressions(node.expression); + if (expression.kind === 106 || ts6.isSuperProperty(expression) || ts6.some(node.arguments, ts6.isSpreadElement)) { + return visitCallExpressionWithPotentialCapturedThisAssignment( + node, + /*assignToCapturedThis*/ + true + ); + } + return factory.updateCallExpression( + node, + ts6.visitNode(node.expression, callExpressionVisitor, ts6.isExpression), + /*typeArguments*/ + void 0, + ts6.visitNodes(node.arguments, visitor, ts6.isExpression) + ); + } + function visitTypeScriptClassWrapper(node) { + var body = ts6.cast(ts6.cast(ts6.skipOuterExpressions(node.expression), ts6.isArrowFunction).body, ts6.isBlock); + var isVariableStatementWithInitializer = function(stmt) { + return ts6.isVariableStatement(stmt) && !!ts6.first(stmt.declarationList.declarations).initializer; + }; + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = void 0; + var bodyStatements = ts6.visitNodes(body.statements, classWrapperStatementVisitor, ts6.isStatement); + convertedLoopState = savedConvertedLoopState; + var classStatements = ts6.filter(bodyStatements, isVariableStatementWithInitializer); + var remainingStatements = ts6.filter(bodyStatements, function(stmt) { + return !isVariableStatementWithInitializer(stmt); + }); + var varStatement = ts6.cast(ts6.first(classStatements), ts6.isVariableStatement); + var variable = varStatement.declarationList.declarations[0]; + var initializer = ts6.skipOuterExpressions(variable.initializer); + var aliasAssignment = ts6.tryCast(initializer, ts6.isAssignmentExpression); + if (!aliasAssignment && ts6.isBinaryExpression(initializer) && initializer.operatorToken.kind === 27) { + aliasAssignment = ts6.tryCast(initializer.left, ts6.isAssignmentExpression); + } + var call = ts6.cast(aliasAssignment ? ts6.skipOuterExpressions(aliasAssignment.right) : initializer, ts6.isCallExpression); + var func = ts6.cast(ts6.skipOuterExpressions(call.expression), ts6.isFunctionExpression); + var funcStatements = func.body.statements; + var classBodyStart = 0; + var classBodyEnd = -1; + var statements = []; + if (aliasAssignment) { + var extendsCall = ts6.tryCast(funcStatements[classBodyStart], ts6.isExpressionStatement); + if (extendsCall) { + statements.push(extendsCall); + classBodyStart++; + } + statements.push(funcStatements[classBodyStart]); + classBodyStart++; + statements.push(factory.createExpressionStatement(factory.createAssignment(aliasAssignment.left, ts6.cast(variable.name, ts6.isIdentifier)))); + } + while (!ts6.isReturnStatement(ts6.elementAt(funcStatements, classBodyEnd))) { + classBodyEnd--; + } + ts6.addRange(statements, funcStatements, classBodyStart, classBodyEnd); + if (classBodyEnd < -1) { + ts6.addRange(statements, funcStatements, classBodyEnd + 1); + } + ts6.addRange(statements, remainingStatements); + ts6.addRange( + statements, + classStatements, + /*start*/ + 1 + ); + return factory.restoreOuterExpressions(node.expression, factory.restoreOuterExpressions(variable.initializer, factory.restoreOuterExpressions(aliasAssignment && aliasAssignment.right, factory.updateCallExpression( + call, + factory.restoreOuterExpressions(call.expression, factory.updateFunctionExpression( + func, + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + func.parameters, + /*type*/ + void 0, + factory.updateBlock(func.body, statements) + )), + /*typeArguments*/ + void 0, + call.arguments + )))); + } + function visitSuperCallInBody(node) { + return visitCallExpressionWithPotentialCapturedThisAssignment( + node, + /*assignToCapturedThis*/ + false + ); + } + function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { + if (node.transformFlags & 32768 || node.expression.kind === 106 || ts6.isSuperProperty(ts6.skipOuterExpressions(node.expression))) { + var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + if (node.expression.kind === 106) { + ts6.setEmitFlags( + thisArg, + 4 + /* EmitFlags.NoSubstitution */ + ); + } + var resultingCall = void 0; + if (node.transformFlags & 32768) { + resultingCall = factory.createFunctionApplyCall(ts6.visitNode(target, callExpressionVisitor, ts6.isExpression), node.expression.kind === 106 ? thisArg : ts6.visitNode(thisArg, visitor, ts6.isExpression), transformAndSpreadElements( + node.arguments, + /*isArgumentList*/ + true, + /*multiLine*/ + false, + /*hasTrailingComma*/ + false + )); + } else { + resultingCall = ts6.setTextRange(factory.createFunctionCallCall(ts6.visitNode(target, callExpressionVisitor, ts6.isExpression), node.expression.kind === 106 ? thisArg : ts6.visitNode(thisArg, visitor, ts6.isExpression), ts6.visitNodes(node.arguments, visitor, ts6.isExpression)), node); + } + if (node.expression.kind === 106) { + var initializer = factory.createLogicalOr(resultingCall, createActualThis()); + resultingCall = assignToCapturedThis ? factory.createAssignment(factory.createUniqueName( + "_this", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), initializer) : initializer; + } + return ts6.setOriginalNode(resultingCall, node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitNewExpression(node) { + if (ts6.some(node.arguments, ts6.isSpreadElement)) { + var _a = factory.createCallBinding(factory.createPropertyAccessExpression(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return factory.createNewExpression( + factory.createFunctionApplyCall(ts6.visitNode(target, visitor, ts6.isExpression), thisArg, transformAndSpreadElements( + factory.createNodeArray(__spreadArray([factory.createVoidZero()], node.arguments, true)), + /*isArgumentList*/ + true, + /*multiLine*/ + false, + /*hasTrailingComma*/ + false + )), + /*typeArguments*/ + void 0, + [] + ); + } + return ts6.visitEachChild(node, visitor, context); + } + function transformAndSpreadElements(elements, isArgumentList, multiLine, hasTrailingComma) { + var numElements = elements.length; + var segments = ts6.flatten( + // As we visit each element, we return one of two functions to use as the "key": + // - `visitSpanOfSpreads` for one or more contiguous `...` spread expressions, i.e. `...a, ...b` in `[1, 2, ...a, ...b]` + // - `visitSpanOfNonSpreads` for one or more contiguous non-spread elements, i.e. `1, 2`, in `[1, 2, ...a, ...b]` + ts6.spanMap(elements, partitionSpread, function(partition, visitPartition, _start, end) { + return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); + }) + ); + if (segments.length === 1) { + var firstSegment = segments[0]; + if (isArgumentList && !compilerOptions.downlevelIteration || ts6.isPackedArrayLiteral(firstSegment.expression) || ts6.isCallToHelper(firstSegment.expression, "___spreadArray")) { + return firstSegment.expression; + } + } + var helpers = emitHelpers(); + var startsWithSpread = segments[0].kind !== 0; + var expression = startsWithSpread ? factory.createArrayLiteralExpression() : segments[0].expression; + for (var i = startsWithSpread ? 0 : 1; i < segments.length; i++) { + var segment = segments[i]; + expression = helpers.createSpreadArrayHelper(expression, segment.expression, segment.kind === 1 && !isArgumentList); + } + return expression; + } + function partitionSpread(node) { + return ts6.isSpreadElement(node) ? visitSpanOfSpreads : visitSpanOfNonSpreads; + } + function visitSpanOfSpreads(chunk) { + return ts6.map(chunk, visitExpressionOfSpread); + } + function visitExpressionOfSpread(node) { + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + var isCallToReadHelper = ts6.isCallToHelper(expression, "___read"); + var kind = isCallToReadHelper || ts6.isPackedArrayLiteral(expression) ? 2 : 1; + if (compilerOptions.downlevelIteration && kind === 1 && !ts6.isArrayLiteralExpression(expression) && !isCallToReadHelper) { + expression = emitHelpers().createReadHelper( + expression, + /*count*/ + void 0 + ); + kind = 2; + } + return createSpreadSegment(kind, expression); + } + function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { + var expression = factory.createArrayLiteralExpression(ts6.visitNodes(factory.createNodeArray(chunk, hasTrailingComma), visitor, ts6.isExpression), multiLine); + return createSpreadSegment(0, expression); + } + function visitSpreadElement(node) { + return ts6.visitNode(node.expression, visitor, ts6.isExpression); + } + function visitTemplateLiteral(node) { + return ts6.setTextRange(factory.createStringLiteral(node.text), node); + } + function visitStringLiteral(node) { + if (node.hasExtendedUnicodeEscape) { + return ts6.setTextRange(factory.createStringLiteral(node.text), node); + } + return node; + } + function visitNumericLiteral(node) { + if (node.numericLiteralFlags & 384) { + return ts6.setTextRange(factory.createNumericLiteral(node.text), node); + } + return node; + } + function visitTaggedTemplateExpression(node) { + return ts6.processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, ts6.ProcessLevel.All); + } + function visitTemplateExpression(node) { + var expression = factory.createStringLiteral(node.head.text); + for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) { + var span = _a[_i]; + var args = [ts6.visitNode(span.expression, visitor, ts6.isExpression)]; + if (span.literal.text.length > 0) { + args.push(factory.createStringLiteral(span.literal.text)); + } + expression = factory.createCallExpression( + factory.createPropertyAccessExpression(expression, "concat"), + /*typeArguments*/ + void 0, + args + ); + } + return ts6.setTextRange(expression, node); + } + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 && !isExpressionOfCall ? factory.createPropertyAccessExpression(factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), "prototype") : factory.createUniqueName( + "_super", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ); + } + function visitMetaProperty(node) { + if (node.keywordToken === 103 && node.name.escapedText === "target") { + hierarchyFacts |= 32768; + return factory.createUniqueName( + "_newTarget", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ); + } + return node; + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && ts6.isFunctionLike(node)) { + var ancestorFacts = enterSubtree( + 32670, + ts6.getEmitFlags(node) & 8 ? 65 | 16 : 65 + /* HierarchyFacts.FunctionIncludes */ + ); + previousOnEmitNode(hint, node, emitCallback); + exitSubtree( + ancestorFacts, + 0, + 0 + /* HierarchyFacts.None */ + ); + return; + } + previousOnEmitNode(hint, node, emitCallback); + } + function enableSubstitutionsForBlockScopedBindings() { + if ((enabledSubstitutions & 2) === 0) { + enabledSubstitutions |= 2; + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + } + } + function enableSubstitutionsForCapturedThis() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution( + 108 + /* SyntaxKind.ThisKeyword */ + ); + context.enableEmitNotification( + 173 + /* SyntaxKind.Constructor */ + ); + context.enableEmitNotification( + 171 + /* SyntaxKind.MethodDeclaration */ + ); + context.enableEmitNotification( + 174 + /* SyntaxKind.GetAccessor */ + ); + context.enableEmitNotification( + 175 + /* SyntaxKind.SetAccessor */ + ); + context.enableEmitNotification( + 216 + /* SyntaxKind.ArrowFunction */ + ); + context.enableEmitNotification( + 215 + /* SyntaxKind.FunctionExpression */ + ); + context.enableEmitNotification( + 259 + /* SyntaxKind.FunctionDeclaration */ + ); + } + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { + return substituteExpression(node); + } + if (ts6.isIdentifier(node)) { + return substituteIdentifier(node); + } + return node; + } + function substituteIdentifier(node) { + if (enabledSubstitutions & 2 && !ts6.isInternalName(node)) { + var original = ts6.getParseTreeNode(node, ts6.isIdentifier); + if (original && isNameOfDeclarationWithCollidingName(original)) { + return ts6.setTextRange(factory.getGeneratedNameForNode(original), node); + } + } + return node; + } + function isNameOfDeclarationWithCollidingName(node) { + switch (node.parent.kind) { + case 205: + case 260: + case 263: + case 257: + return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); + } + return false; + } + function substituteExpression(node) { + switch (node.kind) { + case 79: + return substituteExpressionIdentifier(node); + case 108: + return substituteThisKeyword(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (enabledSubstitutions & 2 && !ts6.isInternalName(node)) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); + if (declaration && !(ts6.isClassLike(declaration) && isPartOfClassBody(declaration, node))) { + return ts6.setTextRange(factory.getGeneratedNameForNode(ts6.getNameOfDeclaration(declaration)), node); + } + } + return node; + } + function isPartOfClassBody(declaration, node) { + var currentNode = ts6.getParseTreeNode(node); + if (!currentNode || currentNode === declaration || currentNode.end <= declaration.pos || currentNode.pos >= declaration.end) { + return false; + } + var blockScope = ts6.getEnclosingBlockScopeContainer(declaration); + while (currentNode) { + if (currentNode === blockScope || currentNode === declaration) { + return false; + } + if (ts6.isClassElement(currentNode) && currentNode.parent === declaration) { + return true; + } + currentNode = currentNode.parent; + } + return false; + } + function substituteThisKeyword(node) { + if (enabledSubstitutions & 1 && hierarchyFacts & 16) { + return ts6.setTextRange(factory.createUniqueName( + "_this", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ), node); + } + return node; + } + function getClassMemberPrefix(node, member) { + return ts6.isStatic(member) ? factory.getInternalName(node) : factory.createPropertyAccessExpression(factory.getInternalName(node), "prototype"); + } + function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) { + if (!constructor || !hasExtendsClause) { + return false; + } + if (ts6.some(constructor.parameters)) { + return false; + } + var statement = ts6.firstOrUndefined(constructor.body.statements); + if (!statement || !ts6.nodeIsSynthesized(statement) || statement.kind !== 241) { + return false; + } + var statementExpression = statement.expression; + if (!ts6.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210) { + return false; + } + var callTarget = statementExpression.expression; + if (!ts6.nodeIsSynthesized(callTarget) || callTarget.kind !== 106) { + return false; + } + var callArgument = ts6.singleOrUndefined(statementExpression.arguments); + if (!callArgument || !ts6.nodeIsSynthesized(callArgument) || callArgument.kind !== 227) { + return false; + } + var expression = callArgument.expression; + return ts6.isIdentifier(expression) && expression.escapedText === "arguments"; + } + } + ts6.transformES2015 = transformES2015; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformES5(context) { + var factory = context.factory; + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification( + 283 + /* SyntaxKind.JsxOpeningElement */ + ); + context.enableEmitNotification( + 284 + /* SyntaxKind.JsxClosingElement */ + ); + context.enableEmitNotification( + 282 + /* SyntaxKind.JsxSelfClosingElement */ + ); + noSubstitution = []; + } + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + context.enableSubstitution( + 208 + /* SyntaxKind.PropertyAccessExpression */ + ); + context.enableSubstitution( + 299 + /* SyntaxKind.PropertyAssignment */ + ); + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + return node; + } + function onEmitNode(hint, node, emitCallback) { + switch (node.kind) { + case 283: + case 284: + case 282: + var tagName = node.tagName; + noSubstitution[ts6.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(hint, node); + } + node = previousOnSubstituteNode(hint, node); + if (ts6.isPropertyAccessExpression(node)) { + return substitutePropertyAccessExpression(node); + } else if (ts6.isPropertyAssignment(node)) { + return substitutePropertyAssignment(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (ts6.isPrivateIdentifier(node.name)) { + return node; + } + var literalName = trySubstituteReservedName(node.name); + if (literalName) { + return ts6.setTextRange(factory.createElementAccessExpression(node.expression, literalName), node); + } + return node; + } + function substitutePropertyAssignment(node) { + var literalName = ts6.isIdentifier(node.name) && trySubstituteReservedName(node.name); + if (literalName) { + return factory.updatePropertyAssignment(node, literalName, node.initializer); + } + return node; + } + function trySubstituteReservedName(name) { + var token = name.originalKeywordKind || (ts6.nodeIsSynthesized(name) ? ts6.stringToToken(ts6.idText(name)) : void 0); + if (token !== void 0 && token >= 81 && token <= 116) { + return ts6.setTextRange(factory.createStringLiteralFromNode(name), name); + } + return void 0; + } + } + ts6.transformES5 = transformES5; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var OpCode; + (function(OpCode2) { + OpCode2[OpCode2["Nop"] = 0] = "Nop"; + OpCode2[OpCode2["Statement"] = 1] = "Statement"; + OpCode2[OpCode2["Assign"] = 2] = "Assign"; + OpCode2[OpCode2["Break"] = 3] = "Break"; + OpCode2[OpCode2["BreakWhenTrue"] = 4] = "BreakWhenTrue"; + OpCode2[OpCode2["BreakWhenFalse"] = 5] = "BreakWhenFalse"; + OpCode2[OpCode2["Yield"] = 6] = "Yield"; + OpCode2[OpCode2["YieldStar"] = 7] = "YieldStar"; + OpCode2[OpCode2["Return"] = 8] = "Return"; + OpCode2[OpCode2["Throw"] = 9] = "Throw"; + OpCode2[OpCode2["Endfinally"] = 10] = "Endfinally"; + })(OpCode || (OpCode = {})); + var BlockAction; + (function(BlockAction2) { + BlockAction2[BlockAction2["Open"] = 0] = "Open"; + BlockAction2[BlockAction2["Close"] = 1] = "Close"; + })(BlockAction || (BlockAction = {})); + var CodeBlockKind; + (function(CodeBlockKind2) { + CodeBlockKind2[CodeBlockKind2["Exception"] = 0] = "Exception"; + CodeBlockKind2[CodeBlockKind2["With"] = 1] = "With"; + CodeBlockKind2[CodeBlockKind2["Switch"] = 2] = "Switch"; + CodeBlockKind2[CodeBlockKind2["Loop"] = 3] = "Loop"; + CodeBlockKind2[CodeBlockKind2["Labeled"] = 4] = "Labeled"; + })(CodeBlockKind || (CodeBlockKind = {})); + var ExceptionBlockState; + (function(ExceptionBlockState2) { + ExceptionBlockState2[ExceptionBlockState2["Try"] = 0] = "Try"; + ExceptionBlockState2[ExceptionBlockState2["Catch"] = 1] = "Catch"; + ExceptionBlockState2[ExceptionBlockState2["Finally"] = 2] = "Finally"; + ExceptionBlockState2[ExceptionBlockState2["Done"] = 3] = "Done"; + })(ExceptionBlockState || (ExceptionBlockState = {})); + var Instruction; + (function(Instruction2) { + Instruction2[Instruction2["Next"] = 0] = "Next"; + Instruction2[Instruction2["Throw"] = 1] = "Throw"; + Instruction2[Instruction2["Return"] = 2] = "Return"; + Instruction2[Instruction2["Break"] = 3] = "Break"; + Instruction2[Instruction2["Yield"] = 4] = "Yield"; + Instruction2[Instruction2["YieldStar"] = 5] = "YieldStar"; + Instruction2[Instruction2["Catch"] = 6] = "Catch"; + Instruction2[Instruction2["Endfinally"] = 7] = "Endfinally"; + })(Instruction || (Instruction = {})); + function getInstructionName(instruction) { + switch (instruction) { + case 2: + return "return"; + case 3: + return "break"; + case 4: + return "yield"; + case 5: + return "yield*"; + case 7: + return "endfinally"; + default: + return void 0; + } + } + function transformGenerators(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var resolver = context.getEmitResolver(); + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var renamedCatchVariables; + var renamedCatchVariableDeclarations; + var inGeneratorFunctionBody; + var inStatementContainingYield; + var blocks; + var blockOffsets; + var blockActions; + var blockStack; + var labelOffsets; + var labelExpressions; + var nextLabelId = 1; + var operations; + var operationArguments; + var operationLocations; + var state; + var blockIndex = 0; + var labelNumber = 0; + var labelNumbers; + var lastOperationWasAbrupt; + var lastOperationWasCompletion; + var clauses; + var statements; + var exceptionBlockStack; + var currentExceptionBlock; + var withBlockStack; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile || (node.transformFlags & 2048) === 0) { + return node; + } + var visited = ts6.visitEachChild(node, visitor, context); + ts6.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + var transformFlags = node.transformFlags; + if (inStatementContainingYield) { + return visitJavaScriptInStatementContainingYield(node); + } else if (inGeneratorFunctionBody) { + return visitJavaScriptInGeneratorFunctionBody(node); + } else if (ts6.isFunctionLikeDeclaration(node) && node.asteriskToken) { + return visitGenerator(node); + } else if (transformFlags & 2048) { + return ts6.visitEachChild(node, visitor, context); + } else { + return node; + } + } + function visitJavaScriptInStatementContainingYield(node) { + switch (node.kind) { + case 243: + return visitDoStatement(node); + case 244: + return visitWhileStatement(node); + case 252: + return visitSwitchStatement(node); + case 253: + return visitLabeledStatement(node); + default: + return visitJavaScriptInGeneratorFunctionBody(node); + } + } + function visitJavaScriptInGeneratorFunctionBody(node) { + switch (node.kind) { + case 259: + return visitFunctionDeclaration(node); + case 215: + return visitFunctionExpression(node); + case 174: + case 175: + return visitAccessorDeclaration(node); + case 240: + return visitVariableStatement(node); + case 245: + return visitForStatement(node); + case 246: + return visitForInStatement(node); + case 249: + return visitBreakStatement(node); + case 248: + return visitContinueStatement(node); + case 250: + return visitReturnStatement(node); + default: + if (node.transformFlags & 1048576) { + return visitJavaScriptContainingYield(node); + } else if (node.transformFlags & (2048 | 4194304)) { + return ts6.visitEachChild(node, visitor, context); + } else { + return node; + } + } + } + function visitJavaScriptContainingYield(node) { + switch (node.kind) { + case 223: + return visitBinaryExpression(node); + case 354: + return visitCommaListExpression(node); + case 224: + return visitConditionalExpression(node); + case 226: + return visitYieldExpression(node); + case 206: + return visitArrayLiteralExpression(node); + case 207: + return visitObjectLiteralExpression(node); + case 209: + return visitElementAccessExpression(node); + case 210: + return visitCallExpression(node); + case 211: + return visitNewExpression(node); + default: + return ts6.visitEachChild(node, visitor, context); + } + } + function visitGenerator(node) { + switch (node.kind) { + case 259: + return visitFunctionDeclaration(node); + case 215: + return visitFunctionExpression(node); + default: + return ts6.Debug.failBadSyntaxKind(node); + } + } + function visitFunctionDeclaration(node) { + if (node.asteriskToken) { + node = ts6.setOriginalNode(ts6.setTextRange( + factory.createFunctionDeclaration( + node.modifiers, + /*asteriskToken*/ + void 0, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + transformGeneratorFunctionBody(node.body) + ), + /*location*/ + node + ), node); + } else { + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + inGeneratorFunctionBody = false; + inStatementContainingYield = false; + node = ts6.visitEachChild(node, visitor, context); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + } + if (inGeneratorFunctionBody) { + hoistFunctionDeclaration(node); + return void 0; + } else { + return node; + } + } + function visitFunctionExpression(node) { + if (node.asteriskToken) { + node = ts6.setOriginalNode(ts6.setTextRange( + factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + node.name, + /*typeParameters*/ + void 0, + ts6.visitParameterList(node.parameters, visitor, context), + /*type*/ + void 0, + transformGeneratorFunctionBody(node.body) + ), + /*location*/ + node + ), node); + } else { + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + inGeneratorFunctionBody = false; + inStatementContainingYield = false; + node = ts6.visitEachChild(node, visitor, context); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + } + return node; + } + function visitAccessorDeclaration(node) { + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + inGeneratorFunctionBody = false; + inStatementContainingYield = false; + node = ts6.visitEachChild(node, visitor, context); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + return node; + } + function transformGeneratorFunctionBody(body) { + var statements2 = []; + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + var savedBlocks = blocks; + var savedBlockOffsets = blockOffsets; + var savedBlockActions = blockActions; + var savedBlockStack = blockStack; + var savedLabelOffsets = labelOffsets; + var savedLabelExpressions = labelExpressions; + var savedNextLabelId = nextLabelId; + var savedOperations = operations; + var savedOperationArguments = operationArguments; + var savedOperationLocations = operationLocations; + var savedState = state; + inGeneratorFunctionBody = true; + inStatementContainingYield = false; + blocks = void 0; + blockOffsets = void 0; + blockActions = void 0; + blockStack = void 0; + labelOffsets = void 0; + labelExpressions = void 0; + nextLabelId = 1; + operations = void 0; + operationArguments = void 0; + operationLocations = void 0; + state = factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + resumeLexicalEnvironment(); + var statementOffset = factory.copyPrologue( + body.statements, + statements2, + /*ensureUseStrict*/ + false, + visitor + ); + transformAndEmitStatements(body.statements, statementOffset); + var buildResult = build(); + ts6.insertStatementsAfterStandardPrologue(statements2, endLexicalEnvironment()); + statements2.push(factory.createReturnStatement(buildResult)); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + blocks = savedBlocks; + blockOffsets = savedBlockOffsets; + blockActions = savedBlockActions; + blockStack = savedBlockStack; + labelOffsets = savedLabelOffsets; + labelExpressions = savedLabelExpressions; + nextLabelId = savedNextLabelId; + operations = savedOperations; + operationArguments = savedOperationArguments; + operationLocations = savedOperationLocations; + state = savedState; + return ts6.setTextRange(factory.createBlock(statements2, body.multiLine), body); + } + function visitVariableStatement(node) { + if (node.transformFlags & 1048576) { + transformAndEmitVariableDeclarationList(node.declarationList); + return void 0; + } else { + if (ts6.getEmitFlags(node) & 1048576) { + return node; + } + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + hoistVariableDeclaration(variable.name); + } + var variables = ts6.getInitializedVariables(node.declarationList); + if (variables.length === 0) { + return void 0; + } + return ts6.setSourceMapRange(factory.createExpressionStatement(factory.inlineExpressions(ts6.map(variables, transformInitializedVariable))), node); + } + } + function visitBinaryExpression(node) { + var assoc = ts6.getExpressionAssociativity(node); + switch (assoc) { + case 0: + return visitLeftAssociativeBinaryExpression(node); + case 1: + return visitRightAssociativeBinaryExpression(node); + default: + return ts6.Debug.assertNever(assoc); + } + } + function visitRightAssociativeBinaryExpression(node) { + var left = node.left, right = node.right; + if (containsYield(right)) { + var target = void 0; + switch (left.kind) { + case 208: + target = factory.updatePropertyAccessExpression(left, cacheExpression(ts6.visitNode(left.expression, visitor, ts6.isLeftHandSideExpression)), left.name); + break; + case 209: + target = factory.updateElementAccessExpression(left, cacheExpression(ts6.visitNode(left.expression, visitor, ts6.isLeftHandSideExpression)), cacheExpression(ts6.visitNode(left.argumentExpression, visitor, ts6.isExpression))); + break; + default: + target = ts6.visitNode(left, visitor, ts6.isExpression); + break; + } + var operator = node.operatorToken.kind; + if (ts6.isCompoundAssignment(operator)) { + return ts6.setTextRange(factory.createAssignment(target, ts6.setTextRange(factory.createBinaryExpression(cacheExpression(target), ts6.getNonAssignmentOperatorForCompoundAssignment(operator), ts6.visitNode(right, visitor, ts6.isExpression)), node)), node); + } else { + return factory.updateBinaryExpression(node, target, node.operatorToken, ts6.visitNode(right, visitor, ts6.isExpression)); + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitLeftAssociativeBinaryExpression(node) { + if (containsYield(node.right)) { + if (ts6.isLogicalOperator(node.operatorToken.kind)) { + return visitLogicalBinaryExpression(node); + } else if (node.operatorToken.kind === 27) { + return visitCommaExpression(node); + } + return factory.updateBinaryExpression(node, cacheExpression(ts6.visitNode(node.left, visitor, ts6.isExpression)), node.operatorToken, ts6.visitNode(node.right, visitor, ts6.isExpression)); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitCommaExpression(node) { + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + function visit(node2) { + if (ts6.isBinaryExpression(node2) && node2.operatorToken.kind === 27) { + visit(node2.left); + visit(node2.right); + } else { + if (containsYield(node2) && pendingExpressions.length > 0) { + emitWorker(1, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts6.visitNode(node2, visitor, ts6.isExpression)); + } + } + } + function visitCommaListExpression(node) { + var pendingExpressions = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts6.isBinaryExpression(elem) && elem.operatorToken.kind === 27) { + pendingExpressions.push(visitCommaExpression(elem)); + } else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(1, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts6.visitNode(elem, visitor, ts6.isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } + function visitLogicalBinaryExpression(node) { + var resultLabel = defineLabel(); + var resultLocal = declareLocal(); + emitAssignment( + resultLocal, + ts6.visitNode(node.left, visitor, ts6.isExpression), + /*location*/ + node.left + ); + if (node.operatorToken.kind === 55) { + emitBreakWhenFalse( + resultLabel, + resultLocal, + /*location*/ + node.left + ); + } else { + emitBreakWhenTrue( + resultLabel, + resultLocal, + /*location*/ + node.left + ); + } + emitAssignment( + resultLocal, + ts6.visitNode(node.right, visitor, ts6.isExpression), + /*location*/ + node.right + ); + markLabel(resultLabel); + return resultLocal; + } + function visitConditionalExpression(node) { + if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) { + var whenFalseLabel = defineLabel(); + var resultLabel = defineLabel(); + var resultLocal = declareLocal(); + emitBreakWhenFalse( + whenFalseLabel, + ts6.visitNode(node.condition, visitor, ts6.isExpression), + /*location*/ + node.condition + ); + emitAssignment( + resultLocal, + ts6.visitNode(node.whenTrue, visitor, ts6.isExpression), + /*location*/ + node.whenTrue + ); + emitBreak(resultLabel); + markLabel(whenFalseLabel); + emitAssignment( + resultLocal, + ts6.visitNode(node.whenFalse, visitor, ts6.isExpression), + /*location*/ + node.whenFalse + ); + markLabel(resultLabel); + return resultLocal; + } + return ts6.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + var resumeLabel = defineLabel(); + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + if (node.asteriskToken) { + var iterator = (ts6.getEmitFlags(node.expression) & 8388608) === 0 ? ts6.setTextRange(emitHelpers().createValuesHelper(expression), node) : expression; + emitYieldStar( + iterator, + /*location*/ + node + ); + } else { + emitYield( + expression, + /*location*/ + node + ); + } + markLabel(resumeLabel); + return createGeneratorResume( + /*location*/ + node + ); + } + function visitArrayLiteralExpression(node) { + return visitElements( + node.elements, + /*leadingElement*/ + void 0, + /*location*/ + void 0, + node.multiLine + ); + } + function visitElements(elements, leadingElement, location, multiLine) { + var numInitialElements = countInitialNodesWithoutYield(elements); + var temp; + if (numInitialElements > 0) { + temp = declareLocal(); + var initialElements = ts6.visitNodes(elements, visitor, ts6.isExpression, 0, numInitialElements); + emitAssignment(temp, factory.createArrayLiteralExpression(leadingElement ? __spreadArray([leadingElement], initialElements, true) : initialElements)); + leadingElement = void 0; + } + var expressions = ts6.reduceLeft(elements, reduceElement, [], numInitialElements); + return temp ? factory.createArrayConcatCall(temp, [factory.createArrayLiteralExpression(expressions, multiLine)]) : ts6.setTextRange(factory.createArrayLiteralExpression(leadingElement ? __spreadArray([leadingElement], expressions, true) : expressions, multiLine), location); + function reduceElement(expressions2, element) { + if (containsYield(element) && expressions2.length > 0) { + var hasAssignedTemp = temp !== void 0; + if (!temp) { + temp = declareLocal(); + } + emitAssignment(temp, hasAssignedTemp ? factory.createArrayConcatCall(temp, [factory.createArrayLiteralExpression(expressions2, multiLine)]) : factory.createArrayLiteralExpression(leadingElement ? __spreadArray([leadingElement], expressions2, true) : expressions2, multiLine)); + leadingElement = void 0; + expressions2 = []; + } + expressions2.push(ts6.visitNode(element, visitor, ts6.isExpression)); + return expressions2; + } + } + function visitObjectLiteralExpression(node) { + var properties = node.properties; + var multiLine = node.multiLine; + var numInitialProperties = countInitialNodesWithoutYield(properties); + var temp = declareLocal(); + emitAssignment(temp, factory.createObjectLiteralExpression(ts6.visitNodes(properties, visitor, ts6.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); + var expressions = ts6.reduceLeft(properties, reduceProperty, [], numInitialProperties); + expressions.push(multiLine ? ts6.startOnNewLine(ts6.setParent(ts6.setTextRange(factory.cloneNode(temp), temp), temp.parent)) : temp); + return factory.inlineExpressions(expressions); + function reduceProperty(expressions2, property) { + if (containsYield(property) && expressions2.length > 0) { + emitStatement(factory.createExpressionStatement(factory.inlineExpressions(expressions2))); + expressions2 = []; + } + var expression = ts6.createExpressionForObjectLiteralElementLike(factory, node, property, temp); + var visited = ts6.visitNode(expression, visitor, ts6.isExpression); + if (visited) { + if (multiLine) { + ts6.startOnNewLine(visited); + } + expressions2.push(visited); + } + return expressions2; + } + } + function visitElementAccessExpression(node) { + if (containsYield(node.argumentExpression)) { + return factory.updateElementAccessExpression(node, cacheExpression(ts6.visitNode(node.expression, visitor, ts6.isLeftHandSideExpression)), ts6.visitNode(node.argumentExpression, visitor, ts6.isExpression)); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitCallExpression(node) { + if (!ts6.isImportCall(node) && ts6.forEach(node.arguments, containsYield)) { + var _a = factory.createCallBinding( + node.expression, + hoistVariableDeclaration, + languageVersion, + /*cacheIdentifiers*/ + true + ), target = _a.target, thisArg = _a.thisArg; + return ts6.setOriginalNode(ts6.setTextRange(factory.createFunctionApplyCall(cacheExpression(ts6.visitNode(target, visitor, ts6.isLeftHandSideExpression)), thisArg, visitElements(node.arguments)), node), node); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitNewExpression(node) { + if (ts6.forEach(node.arguments, containsYield)) { + var _a = factory.createCallBinding(factory.createPropertyAccessExpression(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts6.setOriginalNode(ts6.setTextRange(factory.createNewExpression( + factory.createFunctionApplyCall(cacheExpression(ts6.visitNode(target, visitor, ts6.isExpression)), thisArg, visitElements( + node.arguments, + /*leadingElement*/ + factory.createVoidZero() + )), + /*typeArguments*/ + void 0, + [] + ), node), node); + } + return ts6.visitEachChild(node, visitor, context); + } + function transformAndEmitStatements(statements2, start) { + if (start === void 0) { + start = 0; + } + var numStatements = statements2.length; + for (var i = start; i < numStatements; i++) { + transformAndEmitStatement(statements2[i]); + } + } + function transformAndEmitEmbeddedStatement(node) { + if (ts6.isBlock(node)) { + transformAndEmitStatements(node.statements); + } else { + transformAndEmitStatement(node); + } + } + function transformAndEmitStatement(node) { + var savedInStatementContainingYield = inStatementContainingYield; + if (!inStatementContainingYield) { + inStatementContainingYield = containsYield(node); + } + transformAndEmitStatementWorker(node); + inStatementContainingYield = savedInStatementContainingYield; + } + function transformAndEmitStatementWorker(node) { + switch (node.kind) { + case 238: + return transformAndEmitBlock(node); + case 241: + return transformAndEmitExpressionStatement(node); + case 242: + return transformAndEmitIfStatement(node); + case 243: + return transformAndEmitDoStatement(node); + case 244: + return transformAndEmitWhileStatement(node); + case 245: + return transformAndEmitForStatement(node); + case 246: + return transformAndEmitForInStatement(node); + case 248: + return transformAndEmitContinueStatement(node); + case 249: + return transformAndEmitBreakStatement(node); + case 250: + return transformAndEmitReturnStatement(node); + case 251: + return transformAndEmitWithStatement(node); + case 252: + return transformAndEmitSwitchStatement(node); + case 253: + return transformAndEmitLabeledStatement(node); + case 254: + return transformAndEmitThrowStatement(node); + case 255: + return transformAndEmitTryStatement(node); + default: + return emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function transformAndEmitBlock(node) { + if (containsYield(node)) { + transformAndEmitStatements(node.statements); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function transformAndEmitExpressionStatement(node) { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + function transformAndEmitVariableDeclarationList(node) { + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + var name = factory.cloneNode(variable.name); + ts6.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); + } + var variables = ts6.getInitializedVariables(node); + var numVariables = variables.length; + var variablesWritten = 0; + var pendingExpressions = []; + while (variablesWritten < numVariables) { + for (var i = variablesWritten; i < numVariables; i++) { + var variable = variables[i]; + if (containsYield(variable.initializer) && pendingExpressions.length > 0) { + break; + } + pendingExpressions.push(transformInitializedVariable(variable)); + } + if (pendingExpressions.length) { + emitStatement(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); + variablesWritten += pendingExpressions.length; + pendingExpressions = []; + } + } + return void 0; + } + function transformInitializedVariable(node) { + return ts6.setSourceMapRange(factory.createAssignment(ts6.setSourceMapRange(factory.cloneNode(node.name), node.name), ts6.visitNode(node.initializer, visitor, ts6.isExpression)), node); + } + function transformAndEmitIfStatement(node) { + if (containsYield(node)) { + if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { + var endLabel = defineLabel(); + var elseLabel = node.elseStatement ? defineLabel() : void 0; + emitBreakWhenFalse( + node.elseStatement ? elseLabel : endLabel, + ts6.visitNode(node.expression, visitor, ts6.isExpression), + /*location*/ + node.expression + ); + transformAndEmitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + emitBreak(endLabel); + markLabel(elseLabel); + transformAndEmitEmbeddedStatement(node.elseStatement); + } + markLabel(endLabel); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function transformAndEmitDoStatement(node) { + if (containsYield(node)) { + var conditionLabel = defineLabel(); + var loopLabel = defineLabel(); + beginLoopBlock( + /*continueLabel*/ + conditionLabel + ); + markLabel(loopLabel); + transformAndEmitEmbeddedStatement(node.statement); + markLabel(conditionLabel); + emitBreakWhenTrue(loopLabel, ts6.visitNode(node.expression, visitor, ts6.isExpression)); + endLoopBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function visitDoStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + node = ts6.visitEachChild(node, visitor, context); + endLoopBlock(); + return node; + } else { + return ts6.visitEachChild(node, visitor, context); + } + } + function transformAndEmitWhileStatement(node) { + if (containsYield(node)) { + var loopLabel = defineLabel(); + var endLabel = beginLoopBlock(loopLabel); + markLabel(loopLabel); + emitBreakWhenFalse(endLabel, ts6.visitNode(node.expression, visitor, ts6.isExpression)); + transformAndEmitEmbeddedStatement(node.statement); + emitBreak(loopLabel); + endLoopBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function visitWhileStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + node = ts6.visitEachChild(node, visitor, context); + endLoopBlock(); + return node; + } else { + return ts6.visitEachChild(node, visitor, context); + } + } + function transformAndEmitForStatement(node) { + if (containsYield(node)) { + var conditionLabel = defineLabel(); + var incrementLabel = defineLabel(); + var endLabel = beginLoopBlock(incrementLabel); + if (node.initializer) { + var initializer = node.initializer; + if (ts6.isVariableDeclarationList(initializer)) { + transformAndEmitVariableDeclarationList(initializer); + } else { + emitStatement(ts6.setTextRange(factory.createExpressionStatement(ts6.visitNode(initializer, visitor, ts6.isExpression)), initializer)); + } + } + markLabel(conditionLabel); + if (node.condition) { + emitBreakWhenFalse(endLabel, ts6.visitNode(node.condition, visitor, ts6.isExpression)); + } + transformAndEmitEmbeddedStatement(node.statement); + markLabel(incrementLabel); + if (node.incrementor) { + emitStatement(ts6.setTextRange(factory.createExpressionStatement(ts6.visitNode(node.incrementor, visitor, ts6.isExpression)), node.incrementor)); + } + emitBreak(conditionLabel); + endLoopBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function visitForStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + } + var initializer = node.initializer; + if (initializer && ts6.isVariableDeclarationList(initializer)) { + for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + hoistVariableDeclaration(variable.name); + } + var variables = ts6.getInitializedVariables(initializer); + node = factory.updateForStatement(node, variables.length > 0 ? factory.inlineExpressions(ts6.map(variables, transformInitializedVariable)) : void 0, ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, visitor, context)); + } else { + node = ts6.visitEachChild(node, visitor, context); + } + if (inStatementContainingYield) { + endLoopBlock(); + } + return node; + } + function transformAndEmitForInStatement(node) { + if (containsYield(node)) { + var obj = declareLocal(); + var keysArray = declareLocal(); + var key = declareLocal(); + var keysIndex = factory.createLoopVariable(); + var initializer = node.initializer; + hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts6.visitNode(node.expression, visitor, ts6.isExpression)); + emitAssignment(keysArray, factory.createArrayLiteralExpression()); + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression( + factory.createPropertyAccessExpression(keysArray, "push"), + /*typeArguments*/ + void 0, + [key] + )))); + emitAssignment(keysIndex, factory.createNumericLiteral(0)); + var conditionLabel = defineLabel(); + var incrementLabel = defineLabel(); + var endLoopLabel = beginLoopBlock(incrementLabel); + markLabel(conditionLabel); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101, obj)); + var variable = void 0; + if (ts6.isVariableDeclarationList(initializer)) { + for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { + var variable_1 = _a[_i]; + hoistVariableDeclaration(variable_1.name); + } + variable = factory.cloneNode(initializer.declarations[0].name); + } else { + variable = ts6.visitNode(initializer, visitor, ts6.isExpression); + ts6.Debug.assert(ts6.isLeftHandSideExpression(variable)); + } + emitAssignment(variable, key); + transformAndEmitEmbeddedStatement(node.statement); + markLabel(incrementLabel); + emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); + emitBreak(conditionLabel); + endLoopBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function visitForInStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + } + var initializer = node.initializer; + if (ts6.isVariableDeclarationList(initializer)) { + for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + hoistVariableDeclaration(variable.name); + } + node = factory.updateForInStatement(node, initializer.declarations[0].name, ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitNode(node.statement, visitor, ts6.isStatement, factory.liftToBlock)); + } else { + node = ts6.visitEachChild(node, visitor, context); + } + if (inStatementContainingYield) { + endLoopBlock(); + } + return node; + } + function transformAndEmitContinueStatement(node) { + var label = findContinueTarget(node.label ? ts6.idText(node.label) : void 0); + if (label > 0) { + emitBreak( + label, + /*location*/ + node + ); + } else { + emitStatement(node); + } + } + function visitContinueStatement(node) { + if (inStatementContainingYield) { + var label = findContinueTarget(node.label && ts6.idText(node.label)); + if (label > 0) { + return createInlineBreak( + label, + /*location*/ + node + ); + } + } + return ts6.visitEachChild(node, visitor, context); + } + function transformAndEmitBreakStatement(node) { + var label = findBreakTarget(node.label ? ts6.idText(node.label) : void 0); + if (label > 0) { + emitBreak( + label, + /*location*/ + node + ); + } else { + emitStatement(node); + } + } + function visitBreakStatement(node) { + if (inStatementContainingYield) { + var label = findBreakTarget(node.label && ts6.idText(node.label)); + if (label > 0) { + return createInlineBreak( + label, + /*location*/ + node + ); + } + } + return ts6.visitEachChild(node, visitor, context); + } + function transformAndEmitReturnStatement(node) { + emitReturn( + ts6.visitNode(node.expression, visitor, ts6.isExpression), + /*location*/ + node + ); + } + function visitReturnStatement(node) { + return createInlineReturn( + ts6.visitNode(node.expression, visitor, ts6.isExpression), + /*location*/ + node + ); + } + function transformAndEmitWithStatement(node) { + if (containsYield(node)) { + beginWithBlock(cacheExpression(ts6.visitNode(node.expression, visitor, ts6.isExpression))); + transformAndEmitEmbeddedStatement(node.statement); + endWithBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function transformAndEmitSwitchStatement(node) { + if (containsYield(node.caseBlock)) { + var caseBlock = node.caseBlock; + var numClauses = caseBlock.clauses.length; + var endLabel = beginSwitchBlock(); + var expression = cacheExpression(ts6.visitNode(node.expression, visitor, ts6.isExpression)); + var clauseLabels = []; + var defaultClauseIndex = -1; + for (var i = 0; i < numClauses; i++) { + var clause = caseBlock.clauses[i]; + clauseLabels.push(defineLabel()); + if (clause.kind === 293 && defaultClauseIndex === -1) { + defaultClauseIndex = i; + } + } + var clausesWritten = 0; + var pendingClauses = []; + while (clausesWritten < numClauses) { + var defaultClausesSkipped = 0; + for (var i = clausesWritten; i < numClauses; i++) { + var clause = caseBlock.clauses[i]; + if (clause.kind === 292) { + if (containsYield(clause.expression) && pendingClauses.length > 0) { + break; + } + pendingClauses.push(factory.createCaseClause(ts6.visitNode(clause.expression, visitor, ts6.isExpression), [ + createInlineBreak( + clauseLabels[i], + /*location*/ + clause.expression + ) + ])); + } else { + defaultClausesSkipped++; + } + } + if (pendingClauses.length) { + emitStatement(factory.createSwitchStatement(expression, factory.createCaseBlock(pendingClauses))); + clausesWritten += pendingClauses.length; + pendingClauses = []; + } + if (defaultClausesSkipped > 0) { + clausesWritten += defaultClausesSkipped; + defaultClausesSkipped = 0; + } + } + if (defaultClauseIndex >= 0) { + emitBreak(clauseLabels[defaultClauseIndex]); + } else { + emitBreak(endLabel); + } + for (var i = 0; i < numClauses; i++) { + markLabel(clauseLabels[i]); + transformAndEmitStatements(caseBlock.clauses[i].statements); + } + endSwitchBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function visitSwitchStatement(node) { + if (inStatementContainingYield) { + beginScriptSwitchBlock(); + } + node = ts6.visitEachChild(node, visitor, context); + if (inStatementContainingYield) { + endSwitchBlock(); + } + return node; + } + function transformAndEmitLabeledStatement(node) { + if (containsYield(node)) { + beginLabeledBlock(ts6.idText(node.label)); + transformAndEmitEmbeddedStatement(node.statement); + endLabeledBlock(); + } else { + emitStatement(ts6.visitNode(node, visitor, ts6.isStatement)); + } + } + function visitLabeledStatement(node) { + if (inStatementContainingYield) { + beginScriptLabeledBlock(ts6.idText(node.label)); + } + node = ts6.visitEachChild(node, visitor, context); + if (inStatementContainingYield) { + endLabeledBlock(); + } + return node; + } + function transformAndEmitThrowStatement(node) { + var _a; + emitThrow( + ts6.visitNode((_a = node.expression) !== null && _a !== void 0 ? _a : factory.createVoidZero(), visitor, ts6.isExpression), + /*location*/ + node + ); + } + function transformAndEmitTryStatement(node) { + if (containsYield(node)) { + beginExceptionBlock(); + transformAndEmitEmbeddedStatement(node.tryBlock); + if (node.catchClause) { + beginCatchBlock(node.catchClause.variableDeclaration); + transformAndEmitEmbeddedStatement(node.catchClause.block); + } + if (node.finallyBlock) { + beginFinallyBlock(); + transformAndEmitEmbeddedStatement(node.finallyBlock); + } + endExceptionBlock(); + } else { + emitStatement(ts6.visitEachChild(node, visitor, context)); + } + } + function containsYield(node) { + return !!node && (node.transformFlags & 1048576) !== 0; + } + function countInitialNodesWithoutYield(nodes) { + var numNodes = nodes.length; + for (var i = 0; i < numNodes; i++) { + if (containsYield(nodes[i])) { + return i; + } + } + return -1; + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + if (ts6.isIdentifier(node)) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (!ts6.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(ts6.idText(node))) { + var original = ts6.getOriginalNode(node); + if (ts6.isIdentifier(original) && original.parent) { + var declaration = resolver.getReferencedValueDeclaration(original); + if (declaration) { + var name = renamedCatchVariableDeclarations[ts6.getOriginalNodeId(declaration)]; + if (name) { + var clone_6 = ts6.setParent(ts6.setTextRange(factory.cloneNode(name), name), name.parent); + ts6.setSourceMapRange(clone_6, node); + ts6.setCommentRange(clone_6, node); + return clone_6; + } + } + } + } + return node; + } + function cacheExpression(node) { + if (ts6.isGeneratedIdentifier(node) || ts6.getEmitFlags(node) & 4096) { + return node; + } + var temp = factory.createTempVariable(hoistVariableDeclaration); + emitAssignment( + temp, + node, + /*location*/ + node + ); + return temp; + } + function declareLocal(name) { + var temp = name ? factory.createUniqueName(name) : factory.createTempVariable( + /*recordTempVariable*/ + void 0 + ); + hoistVariableDeclaration(temp); + return temp; + } + function defineLabel() { + if (!labelOffsets) { + labelOffsets = []; + } + var label = nextLabelId; + nextLabelId++; + labelOffsets[label] = -1; + return label; + } + function markLabel(label) { + ts6.Debug.assert(labelOffsets !== void 0, "No labels were defined."); + labelOffsets[label] = operations ? operations.length : 0; + } + function beginBlock(block) { + if (!blocks) { + blocks = []; + blockActions = []; + blockOffsets = []; + blockStack = []; + } + var index = blockActions.length; + blockActions[index] = 0; + blockOffsets[index] = operations ? operations.length : 0; + blocks[index] = block; + blockStack.push(block); + return index; + } + function endBlock() { + var block = peekBlock(); + if (block === void 0) + return ts6.Debug.fail("beginBlock was never called."); + var index = blockActions.length; + blockActions[index] = 1; + blockOffsets[index] = operations ? operations.length : 0; + blocks[index] = block; + blockStack.pop(); + return block; + } + function peekBlock() { + return ts6.lastOrUndefined(blockStack); + } + function peekBlockKind() { + var block = peekBlock(); + return block && block.kind; + } + function beginWithBlock(expression) { + var startLabel = defineLabel(); + var endLabel = defineLabel(); + markLabel(startLabel); + beginBlock({ + kind: 1, + expression, + startLabel, + endLabel + }); + } + function endWithBlock() { + ts6.Debug.assert( + peekBlockKind() === 1 + /* CodeBlockKind.With */ + ); + var block = endBlock(); + markLabel(block.endLabel); + } + function beginExceptionBlock() { + var startLabel = defineLabel(); + var endLabel = defineLabel(); + markLabel(startLabel); + beginBlock({ + kind: 0, + state: 0, + startLabel, + endLabel + }); + emitNop(); + return endLabel; + } + function beginCatchBlock(variable) { + ts6.Debug.assert( + peekBlockKind() === 0 + /* CodeBlockKind.Exception */ + ); + var name; + if (ts6.isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); + } else { + var text = ts6.idText(variable.name); + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = new ts6.Map(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + } + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[ts6.getOriginalNodeId(variable)] = name; + } + var exception = peekBlock(); + ts6.Debug.assert( + exception.state < 1 + /* ExceptionBlockState.Catch */ + ); + var endLabel = exception.endLabel; + emitBreak(endLabel); + var catchLabel = defineLabel(); + markLabel(catchLabel); + exception.state = 1; + exception.catchVariable = name; + exception.catchLabel = catchLabel; + emitAssignment(name, factory.createCallExpression( + factory.createPropertyAccessExpression(state, "sent"), + /*typeArguments*/ + void 0, + [] + )); + emitNop(); + } + function beginFinallyBlock() { + ts6.Debug.assert( + peekBlockKind() === 0 + /* CodeBlockKind.Exception */ + ); + var exception = peekBlock(); + ts6.Debug.assert( + exception.state < 2 + /* ExceptionBlockState.Finally */ + ); + var endLabel = exception.endLabel; + emitBreak(endLabel); + var finallyLabel = defineLabel(); + markLabel(finallyLabel); + exception.state = 2; + exception.finallyLabel = finallyLabel; + } + function endExceptionBlock() { + ts6.Debug.assert( + peekBlockKind() === 0 + /* CodeBlockKind.Exception */ + ); + var exception = endBlock(); + var state2 = exception.state; + if (state2 < 2) { + emitBreak(exception.endLabel); + } else { + emitEndfinally(); + } + markLabel(exception.endLabel); + emitNop(); + exception.state = 3; + } + function beginScriptLoopBlock() { + beginBlock({ + kind: 3, + isScript: true, + breakLabel: -1, + continueLabel: -1 + }); + } + function beginLoopBlock(continueLabel) { + var breakLabel = defineLabel(); + beginBlock({ + kind: 3, + isScript: false, + breakLabel, + continueLabel + }); + return breakLabel; + } + function endLoopBlock() { + ts6.Debug.assert( + peekBlockKind() === 3 + /* CodeBlockKind.Loop */ + ); + var block = endBlock(); + var breakLabel = block.breakLabel; + if (!block.isScript) { + markLabel(breakLabel); + } + } + function beginScriptSwitchBlock() { + beginBlock({ + kind: 2, + isScript: true, + breakLabel: -1 + }); + } + function beginSwitchBlock() { + var breakLabel = defineLabel(); + beginBlock({ + kind: 2, + isScript: false, + breakLabel + }); + return breakLabel; + } + function endSwitchBlock() { + ts6.Debug.assert( + peekBlockKind() === 2 + /* CodeBlockKind.Switch */ + ); + var block = endBlock(); + var breakLabel = block.breakLabel; + if (!block.isScript) { + markLabel(breakLabel); + } + } + function beginScriptLabeledBlock(labelText) { + beginBlock({ + kind: 4, + isScript: true, + labelText, + breakLabel: -1 + }); + } + function beginLabeledBlock(labelText) { + var breakLabel = defineLabel(); + beginBlock({ + kind: 4, + isScript: false, + labelText, + breakLabel + }); + } + function endLabeledBlock() { + ts6.Debug.assert( + peekBlockKind() === 4 + /* CodeBlockKind.Labeled */ + ); + var block = endBlock(); + if (!block.isScript) { + markLabel(block.breakLabel); + } + } + function supportsUnlabeledBreak(block) { + return block.kind === 2 || block.kind === 3; + } + function supportsLabeledBreakOrContinue(block) { + return block.kind === 4; + } + function supportsUnlabeledContinue(block) { + return block.kind === 3; + } + function hasImmediateContainingLabeledBlock(labelText, start) { + for (var j = start; j >= 0; j--) { + var containingBlock = blockStack[j]; + if (supportsLabeledBreakOrContinue(containingBlock)) { + if (containingBlock.labelText === labelText) { + return true; + } + } else { + break; + } + } + return false; + } + function findBreakTarget(labelText) { + if (blockStack) { + if (labelText) { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) { + return block.breakLabel; + } else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block.breakLabel; + } + } + } else { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledBreak(block)) { + return block.breakLabel; + } + } + } + } + return 0; + } + function findContinueTarget(labelText) { + if (blockStack) { + if (labelText) { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block.continueLabel; + } + } + } else { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledContinue(block)) { + return block.continueLabel; + } + } + } + } + return 0; + } + function createLabel(label) { + if (label !== void 0 && label > 0) { + if (labelExpressions === void 0) { + labelExpressions = []; + } + var expression = factory.createNumericLiteral(-1); + if (labelExpressions[label] === void 0) { + labelExpressions[label] = [expression]; + } else { + labelExpressions[label].push(expression); + } + return expression; + } + return factory.createOmittedExpression(); + } + function createInstruction(instruction) { + var literal2 = factory.createNumericLiteral(instruction); + ts6.addSyntheticTrailingComment(literal2, 3, getInstructionName(instruction)); + return literal2; + } + function createInlineBreak(label, location) { + ts6.Debug.assertLessThan(0, label, "Invalid label"); + return ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([ + createInstruction( + 3 + /* Instruction.Break */ + ), + createLabel(label) + ])), location); + } + function createInlineReturn(expression, location) { + return ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression(expression ? [createInstruction( + 2 + /* Instruction.Return */ + ), expression] : [createInstruction( + 2 + /* Instruction.Return */ + )])), location); + } + function createGeneratorResume(location) { + return ts6.setTextRange(factory.createCallExpression( + factory.createPropertyAccessExpression(state, "sent"), + /*typeArguments*/ + void 0, + [] + ), location); + } + function emitNop() { + emitWorker( + 0 + /* OpCode.Nop */ + ); + } + function emitStatement(node) { + if (node) { + emitWorker(1, [node]); + } else { + emitNop(); + } + } + function emitAssignment(left, right, location) { + emitWorker(2, [left, right], location); + } + function emitBreak(label, location) { + emitWorker(3, [label], location); + } + function emitBreakWhenTrue(label, condition, location) { + emitWorker(4, [label, condition], location); + } + function emitBreakWhenFalse(label, condition, location) { + emitWorker(5, [label, condition], location); + } + function emitYieldStar(expression, location) { + emitWorker(7, [expression], location); + } + function emitYield(expression, location) { + emitWorker(6, [expression], location); + } + function emitReturn(expression, location) { + emitWorker(8, [expression], location); + } + function emitThrow(expression, location) { + emitWorker(9, [expression], location); + } + function emitEndfinally() { + emitWorker( + 10 + /* OpCode.Endfinally */ + ); + } + function emitWorker(code, args, location) { + if (operations === void 0) { + operations = []; + operationArguments = []; + operationLocations = []; + } + if (labelOffsets === void 0) { + markLabel(defineLabel()); + } + var operationIndex = operations.length; + operations[operationIndex] = code; + operationArguments[operationIndex] = args; + operationLocations[operationIndex] = location; + } + function build() { + blockIndex = 0; + labelNumber = 0; + labelNumbers = void 0; + lastOperationWasAbrupt = false; + lastOperationWasCompletion = false; + clauses = void 0; + statements = void 0; + exceptionBlockStack = void 0; + currentExceptionBlock = void 0; + withBlockStack = void 0; + var buildResult = buildStatements(); + return emitHelpers().createGeneratorHelper(ts6.setEmitFlags( + factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + state + )], + /*type*/ + void 0, + factory.createBlock( + buildResult, + /*multiLine*/ + buildResult.length > 0 + ) + ), + 524288 + /* EmitFlags.ReuseTempVariableScope */ + )); + } + function buildStatements() { + if (operations) { + for (var operationIndex = 0; operationIndex < operations.length; operationIndex++) { + writeOperation(operationIndex); + } + flushFinalLabel(operations.length); + } else { + flushFinalLabel(0); + } + if (clauses) { + var labelExpression = factory.createPropertyAccessExpression(state, "label"); + var switchStatement = factory.createSwitchStatement(labelExpression, factory.createCaseBlock(clauses)); + return [ts6.startOnNewLine(switchStatement)]; + } + if (statements) { + return statements; + } + return []; + } + function flushLabel() { + if (!statements) { + return; + } + appendLabel( + /*markLabelEnd*/ + !lastOperationWasAbrupt + ); + lastOperationWasAbrupt = false; + lastOperationWasCompletion = false; + labelNumber++; + } + function flushFinalLabel(operationIndex) { + if (isFinalLabelReachable(operationIndex)) { + tryEnterLabel(operationIndex); + withBlockStack = void 0; + writeReturn( + /*expression*/ + void 0, + /*operationLocation*/ + void 0 + ); + } + if (statements && clauses) { + appendLabel( + /*markLabelEnd*/ + false + ); + } + updateLabelExpressions(); + } + function isFinalLabelReachable(operationIndex) { + if (!lastOperationWasCompletion) { + return true; + } + if (!labelOffsets || !labelExpressions) { + return false; + } + for (var label = 0; label < labelOffsets.length; label++) { + if (labelOffsets[label] === operationIndex && labelExpressions[label]) { + return true; + } + } + return false; + } + function appendLabel(markLabelEnd) { + if (!clauses) { + clauses = []; + } + if (statements) { + if (withBlockStack) { + for (var i = withBlockStack.length - 1; i >= 0; i--) { + var withBlock = withBlockStack[i]; + statements = [factory.createWithStatement(withBlock.expression, factory.createBlock(statements))]; + } + } + if (currentExceptionBlock) { + var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel; + statements.unshift(factory.createExpressionStatement(factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(state, "trys"), "push"), + /*typeArguments*/ + void 0, + [ + factory.createArrayLiteralExpression([ + createLabel(startLabel), + createLabel(catchLabel), + createLabel(finallyLabel), + createLabel(endLabel) + ]) + ] + ))); + currentExceptionBlock = void 0; + } + if (markLabelEnd) { + statements.push(factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(state, "label"), factory.createNumericLiteral(labelNumber + 1)))); + } + } + clauses.push(factory.createCaseClause(factory.createNumericLiteral(labelNumber), statements || [])); + statements = void 0; + } + function tryEnterLabel(operationIndex) { + if (!labelOffsets) { + return; + } + for (var label = 0; label < labelOffsets.length; label++) { + if (labelOffsets[label] === operationIndex) { + flushLabel(); + if (labelNumbers === void 0) { + labelNumbers = []; + } + if (labelNumbers[labelNumber] === void 0) { + labelNumbers[labelNumber] = [label]; + } else { + labelNumbers[labelNumber].push(label); + } + } + } + } + function updateLabelExpressions() { + if (labelExpressions !== void 0 && labelNumbers !== void 0) { + for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) { + var labels = labelNumbers[labelNumber_1]; + if (labels !== void 0) { + for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) { + var label = labels_1[_i]; + var expressions = labelExpressions[label]; + if (expressions !== void 0) { + for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) { + var expression = expressions_1[_a]; + expression.text = String(labelNumber_1); + } + } + } + } + } + } + } + function tryEnterOrLeaveBlock(operationIndex) { + if (blocks) { + for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) { + var block = blocks[blockIndex]; + var blockAction = blockActions[blockIndex]; + switch (block.kind) { + case 0: + if (blockAction === 0) { + if (!exceptionBlockStack) { + exceptionBlockStack = []; + } + if (!statements) { + statements = []; + } + exceptionBlockStack.push(currentExceptionBlock); + currentExceptionBlock = block; + } else if (blockAction === 1) { + currentExceptionBlock = exceptionBlockStack.pop(); + } + break; + case 1: + if (blockAction === 0) { + if (!withBlockStack) { + withBlockStack = []; + } + withBlockStack.push(block); + } else if (blockAction === 1) { + withBlockStack.pop(); + } + break; + } + } + } + } + function writeOperation(operationIndex) { + tryEnterLabel(operationIndex); + tryEnterOrLeaveBlock(operationIndex); + if (lastOperationWasAbrupt) { + return; + } + lastOperationWasAbrupt = false; + lastOperationWasCompletion = false; + var opcode = operations[operationIndex]; + if (opcode === 0) { + return; + } else if (opcode === 10) { + return writeEndfinally(); + } + var args = operationArguments[operationIndex]; + if (opcode === 1) { + return writeStatement(args[0]); + } + var location = operationLocations[operationIndex]; + switch (opcode) { + case 2: + return writeAssign(args[0], args[1], location); + case 3: + return writeBreak(args[0], location); + case 4: + return writeBreakWhenTrue(args[0], args[1], location); + case 5: + return writeBreakWhenFalse(args[0], args[1], location); + case 6: + return writeYield(args[0], location); + case 7: + return writeYieldStar(args[0], location); + case 8: + return writeReturn(args[0], location); + case 9: + return writeThrow(args[0], location); + } + } + function writeStatement(statement) { + if (statement) { + if (!statements) { + statements = [statement]; + } else { + statements.push(statement); + } + } + } + function writeAssign(left, right, operationLocation) { + writeStatement(ts6.setTextRange(factory.createExpressionStatement(factory.createAssignment(left, right)), operationLocation)); + } + function writeThrow(expression, operationLocation) { + lastOperationWasAbrupt = true; + lastOperationWasCompletion = true; + writeStatement(ts6.setTextRange(factory.createThrowStatement(expression), operationLocation)); + } + function writeReturn(expression, operationLocation) { + lastOperationWasAbrupt = true; + lastOperationWasCompletion = true; + writeStatement(ts6.setEmitFlags( + ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression(expression ? [createInstruction( + 2 + /* Instruction.Return */ + ), expression] : [createInstruction( + 2 + /* Instruction.Return */ + )])), operationLocation), + 384 + /* EmitFlags.NoTokenSourceMaps */ + )); + } + function writeBreak(label, operationLocation) { + lastOperationWasAbrupt = true; + writeStatement(ts6.setEmitFlags( + ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([ + createInstruction( + 3 + /* Instruction.Break */ + ), + createLabel(label) + ])), operationLocation), + 384 + /* EmitFlags.NoTokenSourceMaps */ + )); + } + function writeBreakWhenTrue(label, condition, operationLocation) { + writeStatement(ts6.setEmitFlags( + factory.createIfStatement(condition, ts6.setEmitFlags( + ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([ + createInstruction( + 3 + /* Instruction.Break */ + ), + createLabel(label) + ])), operationLocation), + 384 + /* EmitFlags.NoTokenSourceMaps */ + )), + 1 + /* EmitFlags.SingleLine */ + )); + } + function writeBreakWhenFalse(label, condition, operationLocation) { + writeStatement(ts6.setEmitFlags( + factory.createIfStatement(factory.createLogicalNot(condition), ts6.setEmitFlags( + ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([ + createInstruction( + 3 + /* Instruction.Break */ + ), + createLabel(label) + ])), operationLocation), + 384 + /* EmitFlags.NoTokenSourceMaps */ + )), + 1 + /* EmitFlags.SingleLine */ + )); + } + function writeYield(expression, operationLocation) { + lastOperationWasAbrupt = true; + writeStatement(ts6.setEmitFlags( + ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression(expression ? [createInstruction( + 4 + /* Instruction.Yield */ + ), expression] : [createInstruction( + 4 + /* Instruction.Yield */ + )])), operationLocation), + 384 + /* EmitFlags.NoTokenSourceMaps */ + )); + } + function writeYieldStar(expression, operationLocation) { + lastOperationWasAbrupt = true; + writeStatement(ts6.setEmitFlags( + ts6.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([ + createInstruction( + 5 + /* Instruction.YieldStar */ + ), + expression + ])), operationLocation), + 384 + /* EmitFlags.NoTokenSourceMaps */ + )); + } + function writeEndfinally() { + lastOperationWasAbrupt = true; + writeStatement(factory.createReturnStatement(factory.createArrayLiteralExpression([ + createInstruction( + 7 + /* Instruction.Endfinally */ + ) + ]))); + } + } + ts6.transformGenerators = transformGenerators; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformModule(context) { + function getTransformModuleDelegate(moduleKind2) { + switch (moduleKind2) { + case ts6.ModuleKind.AMD: + return transformAMDModule; + case ts6.ModuleKind.UMD: + return transformUMDModule; + default: + return transformCommonJSModule; + } + } + var factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var host = context.getEmitHost(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.onEmitNode = onEmitNode; + context.enableSubstitution( + 210 + /* SyntaxKind.CallExpression */ + ); + context.enableSubstitution( + 212 + /* SyntaxKind.TaggedTemplateExpression */ + ); + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + context.enableSubstitution( + 223 + /* SyntaxKind.BinaryExpression */ + ); + context.enableSubstitution( + 300 + /* SyntaxKind.ShorthandPropertyAssignment */ + ); + context.enableEmitNotification( + 308 + /* SyntaxKind.SourceFile */ + ); + var moduleInfoMap = []; + var deferredExports = []; + var currentSourceFile; + var currentModuleInfo; + var noSubstitution = []; + var needUMDDynamicImportHelper; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile || !(ts6.isEffectiveExternalModule(node, compilerOptions) || node.transformFlags & 8388608 || ts6.isJsonSourceFile(node) && ts6.hasJsonModuleEmitEnabled(compilerOptions) && ts6.outFile(compilerOptions))) { + return node; + } + currentSourceFile = node; + currentModuleInfo = ts6.collectExternalModuleInfo(context, node, resolver, compilerOptions); + moduleInfoMap[ts6.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule2 = getTransformModuleDelegate(moduleKind); + var updated = transformModule2(node); + currentSourceFile = void 0; + currentModuleInfo = void 0; + needUMDDynamicImportHelper = false; + return updated; + } + function shouldEmitUnderscoreUnderscoreESModule() { + if (!currentModuleInfo.exportEquals && ts6.isExternalModule(currentSourceFile)) { + return true; + } + return false; + } + function transformCommonJSModule(node) { + startLexicalEnvironment(); + var statements = []; + var ensureUseStrict = ts6.getStrictOptionValue(compilerOptions, "alwaysStrict") || !compilerOptions.noImplicitUseStrict && ts6.isExternalModule(currentSourceFile); + var statementOffset = factory.copyPrologue(node.statements, statements, ensureUseStrict && !ts6.isJsonSourceFile(node), topLevelVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts6.append(statements, createUnderscoreUnderscoreESModule()); + } + if (ts6.length(currentModuleInfo.exportedNames)) { + var chunkSize = 50; + for (var i = 0; i < currentModuleInfo.exportedNames.length; i += chunkSize) { + ts6.append(statements, factory.createExpressionStatement(ts6.reduceLeft(currentModuleInfo.exportedNames.slice(i, i + chunkSize), function(prev, nextId) { + return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts6.idText(nextId))), prev); + }, factory.createVoidZero()))); + } + } + ts6.append(statements, ts6.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts6.isStatement)); + ts6.addRange(statements, ts6.visitNodes(node.statements, topLevelVisitor, ts6.isStatement, statementOffset)); + addExportEqualsIfNeeded( + statements, + /*emitAsReturn*/ + false + ); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var updated = factory.updateSourceFile(node, ts6.setTextRange(factory.createNodeArray(statements), node.statements)); + ts6.addEmitHelpers(updated, context.readEmitHelpers()); + return updated; + } + function transformAMDModule(node) { + var define2 = factory.createIdentifier("define"); + var moduleName = ts6.tryGetModuleNameFromFile(factory, node, host, compilerOptions); + var jsonSourceFile = ts6.isJsonSourceFile(node) && node; + var _a = collectAsynchronousDependencies( + node, + /*includeNonAmdDependencies*/ + true + ), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var updated = factory.updateSourceFile(node, ts6.setTextRange( + factory.createNodeArray([ + factory.createExpressionStatement(factory.createCallExpression( + define2, + /*typeArguments*/ + void 0, + __spreadArray(__spreadArray([], moduleName ? [moduleName] : [], true), [ + // Add the dependency array argument: + // + // ["require", "exports", module1", "module2", ...] + factory.createArrayLiteralExpression(jsonSourceFile ? ts6.emptyArray : __spreadArray(__spreadArray([ + factory.createStringLiteral("require"), + factory.createStringLiteral("exports") + ], aliasedModuleNames, true), unaliasedModuleNames, true)), + // Add the module body function argument: + // + // function (require, exports, module1, module2) ... + jsonSourceFile ? jsonSourceFile.statements.length ? jsonSourceFile.statements[0].expression : factory.createObjectLiteralExpression() : factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + __spreadArray([ + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "require" + ), + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "exports" + ) + ], importAliasNames, true), + /*type*/ + void 0, + transformAsynchronousModuleBody(node) + ) + ], false) + )) + ]), + /*location*/ + node.statements + )); + ts6.addEmitHelpers(updated, context.readEmitHelpers()); + return updated; + } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies( + node, + /*includeNonAmdDependencies*/ + false + ), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var moduleName = ts6.tryGetModuleNameFromFile(factory, node, host, compilerOptions); + var umdHeader = factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "factory" + )], + /*type*/ + void 0, + ts6.setTextRange( + factory.createBlock( + [ + factory.createIfStatement(factory.createLogicalAnd(factory.createTypeCheck(factory.createIdentifier("module"), "object"), factory.createTypeCheck(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), "object")), factory.createBlock([ + factory.createVariableStatement( + /*modifiers*/ + void 0, + [ + factory.createVariableDeclaration( + "v", + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createCallExpression( + factory.createIdentifier("factory"), + /*typeArguments*/ + void 0, + [ + factory.createIdentifier("require"), + factory.createIdentifier("exports") + ] + ) + ) + ] + ), + ts6.setEmitFlags( + factory.createIfStatement(factory.createStrictInequality(factory.createIdentifier("v"), factory.createIdentifier("undefined")), factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), factory.createIdentifier("v")))), + 1 + /* EmitFlags.SingleLine */ + ) + ]), factory.createIfStatement(factory.createLogicalAnd(factory.createTypeCheck(factory.createIdentifier("define"), "function"), factory.createPropertyAccessExpression(factory.createIdentifier("define"), "amd")), factory.createBlock([ + factory.createExpressionStatement(factory.createCallExpression( + factory.createIdentifier("define"), + /*typeArguments*/ + void 0, + __spreadArray(__spreadArray([], moduleName ? [moduleName] : [], true), [ + factory.createArrayLiteralExpression(__spreadArray(__spreadArray([ + factory.createStringLiteral("require"), + factory.createStringLiteral("exports") + ], aliasedModuleNames, true), unaliasedModuleNames, true)), + factory.createIdentifier("factory") + ], false) + )) + ]))) + ], + /*multiLine*/ + true + ), + /*location*/ + void 0 + ) + ); + var updated = factory.updateSourceFile(node, ts6.setTextRange( + factory.createNodeArray([ + factory.createExpressionStatement(factory.createCallExpression( + umdHeader, + /*typeArguments*/ + void 0, + [ + // Add the module body function argument: + // + // function (require, exports) ... + factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + __spreadArray([ + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "require" + ), + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "exports" + ) + ], importAliasNames, true), + /*type*/ + void 0, + transformAsynchronousModuleBody(node) + ) + ] + )) + ]), + /*location*/ + node.statements + )); + ts6.addEmitHelpers(updated, context.readEmitHelpers()); + return updated; + } + function collectAsynchronousDependencies(node, includeNonAmdDependencies) { + var aliasedModuleNames = []; + var unaliasedModuleNames = []; + var importAliasNames = []; + for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { + var amdDependency = _a[_i]; + if (amdDependency.name) { + aliasedModuleNames.push(factory.createStringLiteral(amdDependency.path)); + importAliasNames.push(factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + amdDependency.name + )); + } else { + unaliasedModuleNames.push(factory.createStringLiteral(amdDependency.path)); + } + } + for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { + var importNode = _c[_b]; + var externalModuleName = ts6.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions); + var importAliasName = ts6.getLocalNameForExternalImport(factory, importNode, currentSourceFile); + if (externalModuleName) { + if (includeNonAmdDependencies && importAliasName) { + ts6.setEmitFlags( + importAliasName, + 4 + /* EmitFlags.NoSubstitution */ + ); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + importAliasName + )); + } else { + unaliasedModuleNames.push(externalModuleName); + } + } + } + return { aliasedModuleNames, unaliasedModuleNames, importAliasNames }; + } + function getAMDImportExpressionForImport(node) { + if (ts6.isImportEqualsDeclaration(node) || ts6.isExportDeclaration(node) || !ts6.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions)) { + return void 0; + } + var name = ts6.getLocalNameForExternalImport(factory, node, currentSourceFile); + var expr = getHelperExpressionForImport(node, name); + if (expr === name) { + return void 0; + } + return factory.createExpressionStatement(factory.createAssignment(name, expr)); + } + function transformAsynchronousModuleBody(node) { + startLexicalEnvironment(); + var statements = []; + var statementOffset = factory.copyPrologue( + node.statements, + statements, + /*ensureUseStrict*/ + !compilerOptions.noImplicitUseStrict, + topLevelVisitor + ); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts6.append(statements, createUnderscoreUnderscoreESModule()); + } + if (ts6.length(currentModuleInfo.exportedNames)) { + ts6.append(statements, factory.createExpressionStatement(ts6.reduceLeft(currentModuleInfo.exportedNames, function(prev, nextId) { + return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts6.idText(nextId))), prev); + }, factory.createVoidZero()))); + } + ts6.append(statements, ts6.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts6.isStatement)); + if (moduleKind === ts6.ModuleKind.AMD) { + ts6.addRange(statements, ts6.mapDefined(currentModuleInfo.externalImports, getAMDImportExpressionForImport)); + } + ts6.addRange(statements, ts6.visitNodes(node.statements, topLevelVisitor, ts6.isStatement, statementOffset)); + addExportEqualsIfNeeded( + statements, + /*emitAsReturn*/ + true + ); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var body = factory.createBlock( + statements, + /*multiLine*/ + true + ); + if (needUMDDynamicImportHelper) { + ts6.addEmitHelper(body, dynamicImportUMDHelper); + } + return body; + } + function addExportEqualsIfNeeded(statements, emitAsReturn) { + if (currentModuleInfo.exportEquals) { + var expressionResult = ts6.visitNode(currentModuleInfo.exportEquals.expression, visitor); + if (expressionResult) { + if (emitAsReturn) { + var statement = factory.createReturnStatement(expressionResult); + ts6.setTextRange(statement, currentModuleInfo.exportEquals); + ts6.setEmitFlags( + statement, + 384 | 1536 + /* EmitFlags.NoComments */ + ); + statements.push(statement); + } else { + var statement = factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), expressionResult)); + ts6.setTextRange(statement, currentModuleInfo.exportEquals); + ts6.setEmitFlags( + statement, + 1536 + /* EmitFlags.NoComments */ + ); + statements.push(statement); + } + } + } + } + function topLevelVisitor(node) { + switch (node.kind) { + case 269: + return visitImportDeclaration(node); + case 268: + return visitImportEqualsDeclaration(node); + case 275: + return visitExportDeclaration(node); + case 274: + return visitExportAssignment(node); + case 240: + return visitVariableStatement(node); + case 259: + return visitFunctionDeclaration(node); + case 260: + return visitClassDeclaration(node); + case 355: + return visitMergeDeclarationMarker(node); + case 356: + return visitEndOfDeclarationMarker(node); + default: + return visitor(node); + } + } + function visitorWorker(node, valueIsDiscarded) { + if (!(node.transformFlags & (8388608 | 4096 | 268435456))) { + return node; + } + switch (node.kind) { + case 245: + return visitForStatement(node); + case 241: + return visitExpressionStatement(node); + case 214: + return visitParenthesizedExpression(node, valueIsDiscarded); + case 353: + return visitPartiallyEmittedExpression(node, valueIsDiscarded); + case 210: + if (ts6.isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) { + return visitImportCallExpression(node); + } + break; + case 223: + if (ts6.isDestructuringAssignment(node)) { + return visitDestructuringAssignment(node, valueIsDiscarded); + } + break; + case 221: + case 222: + return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + return visitorWorker( + node, + /*valueIsDiscarded*/ + false + ); + } + function discardedValueVisitor(node) { + return visitorWorker( + node, + /*valueIsDiscarded*/ + true + ); + } + function destructuringNeedsFlattening(node) { + if (ts6.isObjectLiteralExpression(node)) { + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var elem = _a[_i]; + switch (elem.kind) { + case 299: + if (destructuringNeedsFlattening(elem.initializer)) { + return true; + } + break; + case 300: + if (destructuringNeedsFlattening(elem.name)) { + return true; + } + break; + case 301: + if (destructuringNeedsFlattening(elem.expression)) { + return true; + } + break; + case 171: + case 174: + case 175: + return false; + default: + ts6.Debug.assertNever(elem, "Unhandled object member kind"); + } + } + } else if (ts6.isArrayLiteralExpression(node)) { + for (var _b = 0, _c = node.elements; _b < _c.length; _b++) { + var elem = _c[_b]; + if (ts6.isSpreadElement(elem)) { + if (destructuringNeedsFlattening(elem.expression)) { + return true; + } + } else if (destructuringNeedsFlattening(elem)) { + return true; + } + } + } else if (ts6.isIdentifier(node)) { + return ts6.length(getExports(node)) > (ts6.isExportName(node) ? 1 : 0); + } + return false; + } + function visitDestructuringAssignment(node, valueIsDiscarded) { + if (destructuringNeedsFlattening(node.left)) { + return ts6.flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded, createAllExportExpressions); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return factory.updateForStatement(node, ts6.visitNode(node.initializer, discardedValueVisitor, ts6.isForInitializer), ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, discardedValueVisitor, ts6.isExpression), ts6.visitIterationBody(node.statement, visitor, context)); + } + function visitExpressionStatement(node) { + return factory.updateExpressionStatement(node, ts6.visitNode(node.expression, discardedValueVisitor, ts6.isExpression)); + } + function visitParenthesizedExpression(node, valueIsDiscarded) { + return factory.updateParenthesizedExpression(node, ts6.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts6.isExpression)); + } + function visitPartiallyEmittedExpression(node, valueIsDiscarded) { + return factory.updatePartiallyEmittedExpression(node, ts6.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts6.isExpression)); + } + function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { + if ((node.operator === 45 || node.operator === 46) && ts6.isIdentifier(node.operand) && !ts6.isGeneratedIdentifier(node.operand) && !ts6.isLocalName(node.operand) && !ts6.isDeclarationNameOfEnumOrNamespace(node.operand)) { + var exportedNames = getExports(node.operand); + if (exportedNames) { + var temp = void 0; + var expression = ts6.visitNode(node.operand, visitor, ts6.isExpression); + if (ts6.isPrefixUnaryExpression(node)) { + expression = factory.updatePrefixUnaryExpression(node, expression); + } else { + expression = factory.updatePostfixUnaryExpression(node, expression); + if (!valueIsDiscarded) { + temp = factory.createTempVariable(hoistVariableDeclaration); + expression = factory.createAssignment(temp, expression); + ts6.setTextRange(expression, node); + } + expression = factory.createComma(expression, factory.cloneNode(node.operand)); + ts6.setTextRange(expression, node); + } + for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) { + var exportName = exportedNames_1[_i]; + noSubstitution[ts6.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression); + ts6.setTextRange(expression, node); + } + if (temp) { + noSubstitution[ts6.getNodeId(expression)] = true; + expression = factory.createComma(expression, temp); + ts6.setTextRange(expression, node); + } + return expression; + } + } + return ts6.visitEachChild(node, visitor, context); + } + function visitImportCallExpression(node) { + var externalModuleName = ts6.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions); + var firstArgument = ts6.visitNode(ts6.firstOrUndefined(node.arguments), visitor); + var argument = externalModuleName && (!firstArgument || !ts6.isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument; + var containsLexicalThis = !!(node.transformFlags & 16384); + switch (compilerOptions.module) { + case ts6.ModuleKind.AMD: + return createImportCallExpressionAMD(argument, containsLexicalThis); + case ts6.ModuleKind.UMD: + return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); + case ts6.ModuleKind.CommonJS: + default: + return createImportCallExpressionCommonJS(argument); + } + } + function createImportCallExpressionUMD(arg, containsLexicalThis) { + needUMDDynamicImportHelper = true; + if (ts6.isSimpleCopiableExpression(arg)) { + var argClone = ts6.isGeneratedIdentifier(arg) ? arg : ts6.isStringLiteral(arg) ? factory.createStringLiteralFromNode(arg) : ts6.setEmitFlags( + ts6.setTextRange(factory.cloneNode(arg), arg), + 1536 + /* EmitFlags.NoComments */ + ); + return factory.createConditionalExpression( + /*condition*/ + factory.createIdentifier("__syncRequire"), + /*questionToken*/ + void 0, + /*whenTrue*/ + createImportCallExpressionCommonJS(arg), + /*colonToken*/ + void 0, + /*whenFalse*/ + createImportCallExpressionAMD(argClone, containsLexicalThis) + ); + } else { + var temp = factory.createTempVariable(hoistVariableDeclaration); + return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( + /*condition*/ + factory.createIdentifier("__syncRequire"), + /*questionToken*/ + void 0, + /*whenTrue*/ + createImportCallExpressionCommonJS( + temp, + /* isInlineable */ + true + ), + /*colonToken*/ + void 0, + /*whenFalse*/ + createImportCallExpressionAMD(temp, containsLexicalThis) + )); + } + } + function createImportCallExpressionAMD(arg, containsLexicalThis) { + var resolve = factory.createUniqueName("resolve"); + var reject = factory.createUniqueName("reject"); + var parameters = [ + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + resolve + ), + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + reject + ) + ]; + var body = factory.createBlock([ + factory.createExpressionStatement(factory.createCallExpression( + factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + [factory.createArrayLiteralExpression([arg || factory.createOmittedExpression()]), resolve, reject] + )) + ]); + var func; + if (languageVersion >= 2) { + func = factory.createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + /*equalsGreaterThanToken*/ + void 0, + body + ); + } else { + func = factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ); + if (containsLexicalThis) { + ts6.setEmitFlags( + func, + 8 + /* EmitFlags.CapturesThis */ + ); + } + } + var promise = factory.createNewExpression( + factory.createIdentifier("Promise"), + /*typeArguments*/ + void 0, + [func] + ); + if (ts6.getESModuleInterop(compilerOptions)) { + return factory.createCallExpression( + factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), + /*typeArguments*/ + void 0, + [emitHelpers().createImportStarCallbackHelper()] + ); + } + return promise; + } + function createImportCallExpressionCommonJS(arg, isInlineable) { + var temp = arg && !ts6.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : void 0; + var promiseResolveCall = factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ + void 0, + /*argumentsArray*/ + [] + ); + var requireCall = factory.createCallExpression( + factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + temp ? [temp] : arg ? [arg] : [] + ); + if (ts6.getESModuleInterop(compilerOptions)) { + requireCall = emitHelpers().createImportStarHelper(requireCall); + } + var func; + if (languageVersion >= 2) { + func = factory.createArrowFunction( + /*modifiers*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + /*equalsGreaterThanToken*/ + void 0, + requireCall + ); + } else { + func = factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + factory.createBlock([factory.createReturnStatement(requireCall)]) + ); + } + var downleveledImport = factory.createCallExpression( + factory.createPropertyAccessExpression(promiseResolveCall, "then"), + /*typeArguments*/ + void 0, + [func] + ); + return temp === void 0 ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); + } + function getHelperExpressionForExport(node, innerExpr) { + if (!ts6.getESModuleInterop(compilerOptions) || ts6.getEmitFlags(node) & 67108864) { + return innerExpr; + } + if (ts6.getExportNeedsImportStarHelper(node)) { + return emitHelpers().createImportStarHelper(innerExpr); + } + return innerExpr; + } + function getHelperExpressionForImport(node, innerExpr) { + if (!ts6.getESModuleInterop(compilerOptions) || ts6.getEmitFlags(node) & 67108864) { + return innerExpr; + } + if (ts6.getImportNeedsImportStarHelper(node)) { + return emitHelpers().createImportStarHelper(innerExpr); + } + if (ts6.getImportNeedsImportDefaultHelper(node)) { + return emitHelpers().createImportDefaultHelper(innerExpr); + } + return innerExpr; + } + function visitImportDeclaration(node) { + var statements; + var namespaceDeclaration = ts6.getNamespaceDeclarationNode(node); + if (moduleKind !== ts6.ModuleKind.AMD) { + if (!node.importClause) { + return ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(createRequireCall(node)), node), node); + } else { + var variables = []; + if (namespaceDeclaration && !ts6.isDefaultImport(node)) { + variables.push(factory.createVariableDeclaration( + factory.cloneNode(namespaceDeclaration.name), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + getHelperExpressionForImport(node, createRequireCall(node)) + )); + } else { + variables.push(factory.createVariableDeclaration( + factory.getGeneratedNameForNode(node), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + getHelperExpressionForImport(node, createRequireCall(node)) + )); + if (namespaceDeclaration && ts6.isDefaultImport(node)) { + variables.push(factory.createVariableDeclaration( + factory.cloneNode(namespaceDeclaration.name), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.getGeneratedNameForNode(node) + )); + } + } + statements = ts6.append(statements, ts6.setOriginalNode( + ts6.setTextRange( + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + variables, + languageVersion >= 2 ? 2 : 0 + /* NodeFlags.None */ + ) + ), + /*location*/ + node + ), + /*original*/ + node + )); + } + } else if (namespaceDeclaration && ts6.isDefaultImport(node)) { + statements = ts6.append(statements, factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [ + ts6.setOriginalNode( + ts6.setTextRange( + factory.createVariableDeclaration( + factory.cloneNode(namespaceDeclaration.name), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.getGeneratedNameForNode(node) + ), + /*location*/ + node + ), + /*original*/ + node + ) + ], + languageVersion >= 2 ? 2 : 0 + /* NodeFlags.None */ + ) + )); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfImportDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function createRequireCall(importNode) { + var moduleName = ts6.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions); + var args = []; + if (moduleName) { + args.push(moduleName); + } + return factory.createCallExpression( + factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + args + ); + } + function visitImportEqualsDeclaration(node) { + ts6.Debug.assert(ts6.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + if (moduleKind !== ts6.ModuleKind.AMD) { + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + statements = ts6.append(statements, ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(createExportExpression(node.name, createRequireCall(node))), node), node)); + } else { + statements = ts6.append(statements, ts6.setOriginalNode(ts6.setTextRange(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + factory.cloneNode(node.name), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + createRequireCall(node) + ) + ], + /*flags*/ + languageVersion >= 2 ? 2 : 0 + /* NodeFlags.None */ + ) + ), node), node)); + } + } else { + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + statements = ts6.append(statements, ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(node), factory.getLocalName(node))), node), node)); + } + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfImportEqualsDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function visitExportDeclaration(node) { + if (!node.moduleSpecifier) { + return void 0; + } + var generatedName = factory.getGeneratedNameForNode(node); + if (node.exportClause && ts6.isNamedExports(node.exportClause)) { + var statements = []; + if (moduleKind !== ts6.ModuleKind.AMD) { + statements.push(ts6.setOriginalNode( + ts6.setTextRange( + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + generatedName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + createRequireCall(node) + ) + ]) + ), + /*location*/ + node + ), + /* original */ + node + )); + } + for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { + var specifier = _a[_i]; + if (languageVersion === 0) { + statements.push(ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : void 0)), specifier), specifier)); + } else { + var exportNeedsImportDefault = !!ts6.getESModuleInterop(compilerOptions) && !(ts6.getEmitFlags(node) & 67108864) && ts6.idText(specifier.propertyName || specifier.name) === "default"; + var exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name); + statements.push(ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(createExportExpression( + factory.getExportName(specifier), + exportedValue, + /* location */ + void 0, + /* liveBinding */ + true + )), specifier), specifier)); + } + } + return ts6.singleOrMany(statements); + } else if (node.exportClause) { + var statements = []; + statements.push(ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(createExportExpression(factory.cloneNode(node.exportClause.name), getHelperExpressionForExport(node, moduleKind !== ts6.ModuleKind.AMD ? createRequireCall(node) : ts6.isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory.createIdentifier(ts6.idText(node.exportClause.name))))), node), node)); + return ts6.singleOrMany(statements); + } else { + return ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(emitHelpers().createExportStarHelper(moduleKind !== ts6.ModuleKind.AMD ? createRequireCall(node) : generatedName)), node), node); + } + } + function visitExportAssignment(node) { + if (node.isExportEquals) { + return void 0; + } + var statements; + var original = node.original; + if (original && hasAssociatedEndOfDeclarationMarker(original)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportStatement( + deferredExports[id], + factory.createIdentifier("default"), + ts6.visitNode(node.expression, visitor), + /*location*/ + node, + /*allowComments*/ + true + ); + } else { + statements = appendExportStatement( + statements, + factory.createIdentifier("default"), + ts6.visitNode(node.expression, visitor), + /*location*/ + node, + /*allowComments*/ + true + ); + } + return ts6.singleOrMany(statements); + } + function visitFunctionDeclaration(node) { + var statements; + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + statements = ts6.append(statements, ts6.setOriginalNode( + ts6.setTextRange( + factory.createFunctionDeclaration( + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier), + node.asteriskToken, + factory.getDeclarationName( + node, + /*allowComments*/ + true, + /*allowSourceMaps*/ + true + ), + /*typeParameters*/ + void 0, + ts6.visitNodes(node.parameters, visitor), + /*type*/ + void 0, + ts6.visitEachChild(node.body, visitor, context) + ), + /*location*/ + node + ), + /*original*/ + node + )); + } else { + statements = ts6.append(statements, ts6.visitEachChild(node, visitor, context)); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfHoistedDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function visitClassDeclaration(node) { + var statements; + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + statements = ts6.append(statements, ts6.setOriginalNode(ts6.setTextRange(factory.createClassDeclaration( + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike), + factory.getDeclarationName( + node, + /*allowComments*/ + true, + /*allowSourceMaps*/ + true + ), + /*typeParameters*/ + void 0, + ts6.visitNodes(node.heritageClauses, visitor), + ts6.visitNodes(node.members, visitor) + ), node), node)); + } else { + statements = ts6.append(statements, ts6.visitEachChild(node, visitor, context)); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfHoistedDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function visitVariableStatement(node) { + var statements; + var variables; + var expressions; + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + var modifiers = void 0; + var removeCommentsOnExpressions = false; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (ts6.isIdentifier(variable.name) && ts6.isLocalName(variable.name)) { + if (!modifiers) { + modifiers = ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifier); + } + variables = ts6.append(variables, variable); + } else if (variable.initializer) { + if (!ts6.isBindingPattern(variable.name) && (ts6.isArrowFunction(variable.initializer) || ts6.isFunctionExpression(variable.initializer) || ts6.isClassExpression(variable.initializer))) { + var expression = factory.createAssignment(ts6.setTextRange( + factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name), + /*location*/ + variable.name + ), factory.createIdentifier(ts6.getTextOfIdentifierOrLiteral(variable.name))); + var updatedVariable = factory.createVariableDeclaration(variable.name, variable.exclamationToken, variable.type, ts6.visitNode(variable.initializer, visitor)); + variables = ts6.append(variables, updatedVariable); + expressions = ts6.append(expressions, expression); + removeCommentsOnExpressions = true; + } else { + expressions = ts6.append(expressions, transformInitializedVariable(variable)); + } + } + } + if (variables) { + statements = ts6.append(statements, factory.updateVariableStatement(node, modifiers, factory.updateVariableDeclarationList(node.declarationList, variables))); + } + if (expressions) { + var statement = ts6.setOriginalNode(ts6.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(expressions)), node), node); + if (removeCommentsOnExpressions) { + ts6.removeAllComments(statement); + } + statements = ts6.append(statements, statement); + } + } else { + statements = ts6.append(statements, ts6.visitEachChild(node, visitor, context)); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); + } else { + statements = appendExportsOfVariableStatement(statements, node); + } + return ts6.singleOrMany(statements); + } + function createAllExportExpressions(name, value, location) { + var exportedNames = getExports(name); + if (exportedNames) { + var expression = ts6.isExportName(name) ? value : factory.createAssignment(name, value); + for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { + var exportName = exportedNames_2[_i]; + ts6.setEmitFlags( + expression, + 4 + /* EmitFlags.NoSubstitution */ + ); + expression = createExportExpression( + exportName, + expression, + /*location*/ + location + ); + } + return expression; + } + return factory.createAssignment(name, value); + } + function transformInitializedVariable(node) { + if (ts6.isBindingPattern(node.name)) { + return ts6.flattenDestructuringAssignment( + ts6.visitNode(node, visitor), + /*visitor*/ + void 0, + context, + 0, + /*needsValue*/ + false, + createAllExportExpressions + ); + } else { + return factory.createAssignment(ts6.setTextRange( + factory.createPropertyAccessExpression(factory.createIdentifier("exports"), node.name), + /*location*/ + node.name + ), node.initializer ? ts6.visitNode(node.initializer, visitor) : factory.createVoidZero()); + } + } + function visitMergeDeclarationMarker(node) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); + } + return node; + } + function hasAssociatedEndOfDeclarationMarker(node) { + return (ts6.getEmitFlags(node) & 4194304) !== 0; + } + function visitEndOfDeclarationMarker(node) { + var id = ts6.getOriginalNodeId(node); + var statements = deferredExports[id]; + if (statements) { + delete deferredExports[id]; + return ts6.append(statements, node); + } + return node; + } + function appendExportsOfImportDeclaration(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + var importClause = decl.importClause; + if (!importClause) { + return statements; + } + if (importClause.name) { + statements = appendExportsOfDeclaration(statements, importClause); + } + var namedBindings = importClause.namedBindings; + if (namedBindings) { + switch (namedBindings.kind) { + case 271: + statements = appendExportsOfDeclaration(statements, namedBindings); + break; + case 272: + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var importBinding = _a[_i]; + statements = appendExportsOfDeclaration( + statements, + importBinding, + /* liveBinding */ + true + ); + } + break; + } + } + return statements; + } + function appendExportsOfImportEqualsDeclaration(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + return appendExportsOfDeclaration(statements, decl); + } + function appendExportsOfVariableStatement(statements, node) { + if (currentModuleInfo.exportEquals) { + return statements; + } + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + statements = appendExportsOfBindingElement(statements, decl); + } + return statements; + } + function appendExportsOfBindingElement(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + if (ts6.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + statements = appendExportsOfBindingElement(statements, element); + } + } + } else if (!ts6.isGeneratedIdentifier(decl.name)) { + statements = appendExportsOfDeclaration(statements, decl); + } + return statements; + } + function appendExportsOfHoistedDeclaration(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + if (ts6.hasSyntacticModifier( + decl, + 1 + /* ModifierFlags.Export */ + )) { + var exportName = ts6.hasSyntacticModifier( + decl, + 1024 + /* ModifierFlags.Default */ + ) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + statements = appendExportStatement( + statements, + exportName, + factory.getLocalName(decl), + /*location*/ + decl + ); + } + if (decl.name) { + statements = appendExportsOfDeclaration(statements, decl); + } + return statements; + } + function appendExportsOfDeclaration(statements, decl, liveBinding) { + var name = factory.getDeclarationName(decl); + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(ts6.idText(name)); + if (exportSpecifiers) { + for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { + var exportSpecifier = exportSpecifiers_1[_i]; + statements = appendExportStatement( + statements, + exportSpecifier.name, + name, + /*location*/ + exportSpecifier.name, + /* allowComments */ + void 0, + liveBinding + ); + } + } + return statements; + } + function appendExportStatement(statements, exportName, expression, location, allowComments, liveBinding) { + statements = ts6.append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding)); + return statements; + } + function createUnderscoreUnderscoreESModule() { + var statement; + if (languageVersion === 0) { + statement = factory.createExpressionStatement(createExportExpression(factory.createIdentifier("__esModule"), factory.createTrue())); + } else { + statement = factory.createExpressionStatement(factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ + void 0, + [ + factory.createIdentifier("exports"), + factory.createStringLiteral("__esModule"), + factory.createObjectLiteralExpression([ + factory.createPropertyAssignment("value", factory.createTrue()) + ]) + ] + )); + } + ts6.setEmitFlags( + statement, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + return statement; + } + function createExportStatement(name, value, location, allowComments, liveBinding) { + var statement = ts6.setTextRange(factory.createExpressionStatement(createExportExpression( + name, + value, + /* location */ + void 0, + liveBinding + )), location); + ts6.startOnNewLine(statement); + if (!allowComments) { + ts6.setEmitFlags( + statement, + 1536 + /* EmitFlags.NoComments */ + ); + } + return statement; + } + function createExportExpression(name, value, location, liveBinding) { + return ts6.setTextRange(liveBinding && languageVersion !== 0 ? factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ + void 0, + [ + factory.createIdentifier("exports"), + factory.createStringLiteralFromNode(name), + factory.createObjectLiteralExpression([ + factory.createPropertyAssignment("enumerable", factory.createTrue()), + factory.createPropertyAssignment("get", factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + factory.createBlock([factory.createReturnStatement(value)]) + )) + ]) + ] + ) : factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(name)), value), location); + } + function modifierVisitor(node) { + switch (node.kind) { + case 93: + case 88: + return void 0; + } + return node; + } + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 308) { + currentSourceFile = node; + currentModuleInfo = moduleInfoMap[ts6.getOriginalNodeId(currentSourceFile)]; + previousOnEmitNode(hint, node, emitCallback); + currentSourceFile = void 0; + currentModuleInfo = void 0; + } else { + previousOnEmitNode(hint, node, emitCallback); + } + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (node.id && noSubstitution[node.id]) { + return node; + } + if (hint === 1) { + return substituteExpression(node); + } else if (ts6.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } + return node; + } + function substituteShorthandPropertyAssignment(node) { + var name = node.name; + var exportedOrImportedName = substituteExpressionIdentifier(name); + if (exportedOrImportedName !== name) { + if (node.objectAssignmentInitializer) { + var initializer = factory.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); + return ts6.setTextRange(factory.createPropertyAssignment(name, initializer), node); + } + return ts6.setTextRange(factory.createPropertyAssignment(name, exportedOrImportedName), node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 79: + return substituteExpressionIdentifier(node); + case 210: + return substituteCallExpression(node); + case 212: + return substituteTaggedTemplateExpression(node); + case 223: + return substituteBinaryExpression(node); + } + return node; + } + function substituteCallExpression(node) { + if (ts6.isIdentifier(node.expression)) { + var expression = substituteExpressionIdentifier(node.expression); + noSubstitution[ts6.getNodeId(expression)] = true; + if (!ts6.isIdentifier(expression) && !(ts6.getEmitFlags(node.expression) & 4096)) { + return ts6.addEmitFlags( + factory.updateCallExpression( + node, + expression, + /*typeArguments*/ + void 0, + node.arguments + ), + 536870912 + /* EmitFlags.IndirectCall */ + ); + } + } + return node; + } + function substituteTaggedTemplateExpression(node) { + if (ts6.isIdentifier(node.tag)) { + var tag = substituteExpressionIdentifier(node.tag); + noSubstitution[ts6.getNodeId(tag)] = true; + if (!ts6.isIdentifier(tag) && !(ts6.getEmitFlags(node.tag) & 4096)) { + return ts6.addEmitFlags( + factory.updateTaggedTemplateExpression( + node, + tag, + /*typeArguments*/ + void 0, + node.template + ), + 536870912 + /* EmitFlags.IndirectCall */ + ); + } + } + return node; + } + function substituteExpressionIdentifier(node) { + var _a, _b; + if (ts6.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts6.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return factory.createPropertyAccessExpression(externalHelpersModuleName, node); + } + return node; + } else if (!(ts6.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64)) && !ts6.isLocalName(node)) { + var exportContainer = resolver.getReferencedExportContainer(node, ts6.isExportName(node)); + if (exportContainer && exportContainer.kind === 308) { + return ts6.setTextRange( + factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), + /*location*/ + node + ); + } + var importDeclaration = resolver.getReferencedImportDeclaration(node); + if (importDeclaration) { + if (ts6.isImportClause(importDeclaration)) { + return ts6.setTextRange( + factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default")), + /*location*/ + node + ); + } else if (ts6.isImportSpecifier(importDeclaration)) { + var name = importDeclaration.propertyName || importDeclaration.name; + return ts6.setTextRange( + factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(name)), + /*location*/ + node + ); + } + } + } + return node; + } + function substituteBinaryExpression(node) { + if (ts6.isAssignmentOperator(node.operatorToken.kind) && ts6.isIdentifier(node.left) && !ts6.isGeneratedIdentifier(node.left) && !ts6.isLocalName(node.left) && !ts6.isDeclarationNameOfEnumOrNamespace(node.left)) { + var exportedNames = getExports(node.left); + if (exportedNames) { + var expression = node; + for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { + var exportName = exportedNames_3[_i]; + noSubstitution[ts6.getNodeId(expression)] = true; + expression = createExportExpression( + exportName, + expression, + /*location*/ + node + ); + } + return expression; + } + } + return node; + } + function getExports(name) { + if (!ts6.isGeneratedIdentifier(name)) { + var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); + if (valueDeclaration) { + return currentModuleInfo && currentModuleInfo.exportedBindings[ts6.getOriginalNodeId(valueDeclaration)]; + } + } + } + } + ts6.transformModule = transformModule; + var dynamicImportUMDHelper = { + name: "typescript:dynamicimport-sync-require", + scoped: true, + text: '\n var __syncRequire = typeof module === "object" && typeof module.exports === "object";' + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformSystemModule(context) { + var factory = context.factory, startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var host = context.getEmitHost(); + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.onEmitNode = onEmitNode; + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + context.enableSubstitution( + 300 + /* SyntaxKind.ShorthandPropertyAssignment */ + ); + context.enableSubstitution( + 223 + /* SyntaxKind.BinaryExpression */ + ); + context.enableSubstitution( + 233 + /* SyntaxKind.MetaProperty */ + ); + context.enableEmitNotification( + 308 + /* SyntaxKind.SourceFile */ + ); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; + var contextObjectMap = []; + var currentSourceFile; + var moduleInfo; + var exportFunction; + var contextObject; + var hoistedStatements; + var enclosingBlockScopedContainer; + var noSubstitution; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile || !(ts6.isEffectiveExternalModule(node, compilerOptions) || node.transformFlags & 8388608)) { + return node; + } + var id = ts6.getOriginalNodeId(node); + currentSourceFile = node; + enclosingBlockScopedContainer = node; + moduleInfo = moduleInfoMap[id] = ts6.collectExternalModuleInfo(context, node, resolver, compilerOptions); + exportFunction = factory.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; + contextObject = contextObjectMap[id] = factory.createUniqueName("context"); + var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); + var moduleBodyFunction = factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + [ + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + exportFunction + ), + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + contextObject + ) + ], + /*type*/ + void 0, + moduleBodyBlock + ); + var moduleName = ts6.tryGetModuleNameFromFile(factory, node, host, compilerOptions); + var dependencies = factory.createArrayLiteralExpression(ts6.map(dependencyGroups, function(dependencyGroup) { + return dependencyGroup.name; + })); + var updated = ts6.setEmitFlags( + factory.updateSourceFile(node, ts6.setTextRange(factory.createNodeArray([ + factory.createExpressionStatement(factory.createCallExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("System"), "register"), + /*typeArguments*/ + void 0, + moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction] + )) + ]), node.statements)), + 1024 + /* EmitFlags.NoTrailingComments */ + ); + if (!ts6.outFile(compilerOptions)) { + ts6.moveEmitHelpers(updated, moduleBodyBlock, function(helper) { + return !helper.scoped; + }); + } + if (noSubstitution) { + noSubstitutionMap[id] = noSubstitution; + noSubstitution = void 0; + } + currentSourceFile = void 0; + moduleInfo = void 0; + exportFunction = void 0; + contextObject = void 0; + hoistedStatements = void 0; + enclosingBlockScopedContainer = void 0; + return updated; + } + function collectDependencyGroups(externalImports) { + var groupIndices = new ts6.Map(); + var dependencyGroups = []; + for (var _i = 0, externalImports_1 = externalImports; _i < externalImports_1.length; _i++) { + var externalImport = externalImports_1[_i]; + var externalModuleName = ts6.getExternalModuleNameLiteral(factory, externalImport, currentSourceFile, host, resolver, compilerOptions); + if (externalModuleName) { + var text = externalModuleName.text; + var groupIndex = groupIndices.get(text); + if (groupIndex !== void 0) { + dependencyGroups[groupIndex].externalImports.push(externalImport); + } else { + groupIndices.set(text, dependencyGroups.length); + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] + }); + } + } + } + return dependencyGroups; + } + function createSystemModuleBody(node, dependencyGroups) { + var statements = []; + startLexicalEnvironment(); + var ensureUseStrict = ts6.getStrictOptionValue(compilerOptions, "alwaysStrict") || !compilerOptions.noImplicitUseStrict && ts6.isExternalModule(currentSourceFile); + var statementOffset = factory.copyPrologue(node.statements, statements, ensureUseStrict, topLevelVisitor); + statements.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + "__moduleName", + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createLogicalAnd(contextObject, factory.createPropertyAccessExpression(contextObject, "id")) + ) + ]) + )); + ts6.visitNode(moduleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts6.isStatement); + var executeStatements = ts6.visitNodes(node.statements, topLevelVisitor, ts6.isStatement, statementOffset); + ts6.addRange(statements, hoistedStatements); + ts6.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var exportStarFunction = addExportStarIfNeeded(statements); + var modifiers = node.transformFlags & 2097152 ? factory.createModifiersFromModifierFlags( + 512 + /* ModifierFlags.Async */ + ) : void 0; + var moduleObject = factory.createObjectLiteralExpression( + [ + factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), + factory.createPropertyAssignment("execute", factory.createFunctionExpression( + modifiers, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + /*parameters*/ + [], + /*type*/ + void 0, + factory.createBlock( + executeStatements, + /*multiLine*/ + true + ) + )) + ], + /*multiLine*/ + true + ); + statements.push(factory.createReturnStatement(moduleObject)); + return factory.createBlock( + statements, + /*multiLine*/ + true + ); + } + function addExportStarIfNeeded(statements) { + if (!moduleInfo.hasExportStarsToExportValues) { + return; + } + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { + var hasExportDeclarationWithExportClause = false; + for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { + var externalImport = _a[_i]; + if (externalImport.kind === 275 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + var exportStarFunction_1 = createExportStarFunction( + /*localNames*/ + void 0 + ); + statements.push(exportStarFunction_1); + return exportStarFunction_1.name; + } + } + var exportedNames = []; + if (moduleInfo.exportedNames) { + for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { + var exportedLocalName = _c[_b]; + if (exportedLocalName.escapedText === "default") { + continue; + } + exportedNames.push(factory.createPropertyAssignment(factory.createStringLiteralFromNode(exportedLocalName), factory.createTrue())); + } + } + var exportedNamesStorageRef = factory.createUniqueName("exportedNames"); + statements.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + exportedNamesStorageRef, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createObjectLiteralExpression( + exportedNames, + /*multiline*/ + true + ) + ) + ]) + )); + var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); + statements.push(exportStarFunction); + return exportStarFunction.name; + } + function createExportStarFunction(localNames) { + var exportStarFunction = factory.createUniqueName("exportStar"); + var m = factory.createIdentifier("m"); + var n = factory.createIdentifier("n"); + var exports2 = factory.createIdentifier("exports"); + var condition = factory.createStrictInequality(n, factory.createStringLiteral("default")); + if (localNames) { + condition = factory.createLogicalAnd(condition, factory.createLogicalNot(factory.createCallExpression( + factory.createPropertyAccessExpression(localNames, "hasOwnProperty"), + /*typeArguments*/ + void 0, + [n] + ))); + } + return factory.createFunctionDeclaration( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + exportStarFunction, + /*typeParameters*/ + void 0, + [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + m + )], + /*type*/ + void 0, + factory.createBlock( + [ + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + exports2, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createObjectLiteralExpression([]) + ) + ]) + ), + factory.createForInStatement(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(n) + ]), m, factory.createBlock([ + ts6.setEmitFlags( + factory.createIfStatement(condition, factory.createExpressionStatement(factory.createAssignment(factory.createElementAccessExpression(exports2, n), factory.createElementAccessExpression(m, n)))), + 1 + /* EmitFlags.SingleLine */ + ) + ])), + factory.createExpressionStatement(factory.createCallExpression( + exportFunction, + /*typeArguments*/ + void 0, + [exports2] + )) + ], + /*multiline*/ + true + ) + ); + } + function createSettersArray(exportStarFunction, dependencyGroups) { + var setters = []; + for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { + var group_2 = dependencyGroups_1[_i]; + var localName = ts6.forEach(group_2.externalImports, function(i) { + return ts6.getLocalNameForExternalImport(factory, i, currentSourceFile); + }); + var parameterName = localName ? factory.getGeneratedNameForNode(localName) : factory.createUniqueName(""); + var statements = []; + for (var _a = 0, _b = group_2.externalImports; _a < _b.length; _a++) { + var entry = _b[_a]; + var importVariableName = ts6.getLocalNameForExternalImport(factory, entry, currentSourceFile); + switch (entry.kind) { + case 269: + if (!entry.importClause) { + break; + } + case 268: + ts6.Debug.assert(importVariableName !== void 0); + statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts6.hasSyntacticModifier( + entry, + 1 + /* ModifierFlags.Export */ + )) { + statements.push(factory.createExpressionStatement(factory.createCallExpression( + exportFunction, + /*typeArguments*/ + void 0, + [ + factory.createStringLiteral(ts6.idText(importVariableName)), + parameterName + ] + ))); + } + break; + case 275: + ts6.Debug.assert(importVariableName !== void 0); + if (entry.exportClause) { + if (ts6.isNamedExports(entry.exportClause)) { + var properties = []; + for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + properties.push(factory.createPropertyAssignment(factory.createStringLiteral(ts6.idText(e.name)), factory.createElementAccessExpression(parameterName, factory.createStringLiteral(ts6.idText(e.propertyName || e.name))))); + } + statements.push(factory.createExpressionStatement(factory.createCallExpression( + exportFunction, + /*typeArguments*/ + void 0, + [factory.createObjectLiteralExpression( + properties, + /*multiline*/ + true + )] + ))); + } else { + statements.push(factory.createExpressionStatement(factory.createCallExpression( + exportFunction, + /*typeArguments*/ + void 0, + [ + factory.createStringLiteral(ts6.idText(entry.exportClause.name)), + parameterName + ] + ))); + } + } else { + statements.push(factory.createExpressionStatement(factory.createCallExpression( + exportStarFunction, + /*typeArguments*/ + void 0, + [parameterName] + ))); + } + break; + } + } + setters.push(factory.createFunctionExpression( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + /*name*/ + void 0, + /*typeParameters*/ + void 0, + [factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + parameterName + )], + /*type*/ + void 0, + factory.createBlock( + statements, + /*multiLine*/ + true + ) + )); + } + return factory.createArrayLiteralExpression( + setters, + /*multiLine*/ + true + ); + } + function topLevelVisitor(node) { + switch (node.kind) { + case 269: + return visitImportDeclaration(node); + case 268: + return visitImportEqualsDeclaration(node); + case 275: + return visitExportDeclaration(node); + case 274: + return visitExportAssignment(node); + default: + return topLevelNestedVisitor(node); + } + } + function visitImportDeclaration(node) { + var statements; + if (node.importClause) { + hoistVariableDeclaration(ts6.getLocalNameForExternalImport(factory, node, currentSourceFile)); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfImportDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function visitExportDeclaration(node) { + ts6.Debug.assertIsDefined(node); + return void 0; + } + function visitImportEqualsDeclaration(node) { + ts6.Debug.assert(ts6.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + hoistVariableDeclaration(ts6.getLocalNameForExternalImport(factory, node, currentSourceFile)); + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfImportEqualsDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function visitExportAssignment(node) { + if (node.isExportEquals) { + return void 0; + } + var expression = ts6.visitNode(node.expression, visitor, ts6.isExpression); + var original = node.original; + if (original && hasAssociatedEndOfDeclarationMarker(original)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportStatement( + deferredExports[id], + factory.createIdentifier("default"), + expression, + /*allowComments*/ + true + ); + } else { + return createExportStatement( + factory.createIdentifier("default"), + expression, + /*allowComments*/ + true + ); + } + } + function visitFunctionDeclaration(node) { + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + hoistedStatements = ts6.append(hoistedStatements, factory.updateFunctionDeclaration( + node, + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike), + node.asteriskToken, + factory.getDeclarationName( + node, + /*allowComments*/ + true, + /*allowSourceMaps*/ + true + ), + /*typeParameters*/ + void 0, + ts6.visitNodes(node.parameters, visitor, ts6.isParameterDeclaration), + /*type*/ + void 0, + ts6.visitNode(node.body, visitor, ts6.isBlock) + )); + } else { + hoistedStatements = ts6.append(hoistedStatements, ts6.visitEachChild(node, visitor, context)); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } else { + hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); + } + return void 0; + } + function visitClassDeclaration(node) { + var statements; + var name = factory.getLocalName(node); + hoistVariableDeclaration(name); + statements = ts6.append(statements, ts6.setTextRange(factory.createExpressionStatement(factory.createAssignment(name, ts6.setTextRange(factory.createClassExpression( + ts6.visitNodes(node.modifiers, modifierVisitor, ts6.isModifierLike), + node.name, + /*typeParameters*/ + void 0, + ts6.visitNodes(node.heritageClauses, visitor, ts6.isHeritageClause), + ts6.visitNodes(node.members, visitor, ts6.isClassElement) + ), node))), node)); + if (hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } else { + statements = appendExportsOfHoistedDeclaration(statements, node); + } + return ts6.singleOrMany(statements); + } + function visitVariableStatement(node) { + if (!shouldHoistVariableDeclarationList(node.declarationList)) { + return ts6.visitNode(node, visitor, ts6.isStatement); + } + var expressions; + var isExportedDeclaration = ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ); + var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (variable.initializer) { + expressions = ts6.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); + } else { + hoistBindingElement(variable); + } + } + var statements; + if (expressions) { + statements = ts6.append(statements, ts6.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(expressions)), node)); + } + if (isMarkedDeclaration) { + var id = ts6.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); + } else { + statements = appendExportsOfVariableStatement( + statements, + node, + /*exportSelf*/ + false + ); + } + return ts6.singleOrMany(statements); + } + function hoistBindingElement(node) { + if (ts6.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + hoistBindingElement(element); + } + } + } else { + hoistVariableDeclaration(factory.cloneNode(node.name)); + } + } + function shouldHoistVariableDeclarationList(node) { + return (ts6.getEmitFlags(node) & 2097152) === 0 && (enclosingBlockScopedContainer.kind === 308 || (ts6.getOriginalNode(node).flags & 3) === 0); + } + function transformInitializedVariable(node, isExportedDeclaration) { + var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; + return ts6.isBindingPattern(node.name) ? ts6.flattenDestructuringAssignment( + node, + visitor, + context, + 0, + /*needsValue*/ + false, + createAssignment + ) : node.initializer ? createAssignment(node.name, ts6.visitNode(node.initializer, visitor, ts6.isExpression)) : node.name; + } + function createExportedVariableAssignment(name, value, location) { + return createVariableAssignment( + name, + value, + location, + /*isExportedDeclaration*/ + true + ); + } + function createNonExportedVariableAssignment(name, value, location) { + return createVariableAssignment( + name, + value, + location, + /*isExportedDeclaration*/ + false + ); + } + function createVariableAssignment(name, value, location, isExportedDeclaration) { + hoistVariableDeclaration(factory.cloneNode(name)); + return isExportedDeclaration ? createExportExpression(name, preventSubstitution(ts6.setTextRange(factory.createAssignment(name, value), location))) : preventSubstitution(ts6.setTextRange(factory.createAssignment(name, value), location)); + } + function visitMergeDeclarationMarker(node) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240) { + var id = ts6.getOriginalNodeId(node); + var isExportedDeclaration = ts6.hasSyntacticModifier( + node.original, + 1 + /* ModifierFlags.Export */ + ); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); + } + return node; + } + function hasAssociatedEndOfDeclarationMarker(node) { + return (ts6.getEmitFlags(node) & 4194304) !== 0; + } + function visitEndOfDeclarationMarker(node) { + var id = ts6.getOriginalNodeId(node); + var statements = deferredExports[id]; + if (statements) { + delete deferredExports[id]; + return ts6.append(statements, node); + } else { + var original = ts6.getOriginalNode(node); + if (ts6.isModuleOrEnumDeclaration(original)) { + return ts6.append(appendExportsOfDeclaration(statements, original), node); + } + } + return node; + } + function appendExportsOfImportDeclaration(statements, decl) { + if (moduleInfo.exportEquals) { + return statements; + } + var importClause = decl.importClause; + if (!importClause) { + return statements; + } + if (importClause.name) { + statements = appendExportsOfDeclaration(statements, importClause); + } + var namedBindings = importClause.namedBindings; + if (namedBindings) { + switch (namedBindings.kind) { + case 271: + statements = appendExportsOfDeclaration(statements, namedBindings); + break; + case 272: + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var importBinding = _a[_i]; + statements = appendExportsOfDeclaration(statements, importBinding); + } + break; + } + } + return statements; + } + function appendExportsOfImportEqualsDeclaration(statements, decl) { + if (moduleInfo.exportEquals) { + return statements; + } + return appendExportsOfDeclaration(statements, decl); + } + function appendExportsOfVariableStatement(statements, node, exportSelf) { + if (moduleInfo.exportEquals) { + return statements; + } + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.initializer || exportSelf) { + statements = appendExportsOfBindingElement(statements, decl, exportSelf); + } + } + return statements; + } + function appendExportsOfBindingElement(statements, decl, exportSelf) { + if (moduleInfo.exportEquals) { + return statements; + } + if (ts6.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isOmittedExpression(element)) { + statements = appendExportsOfBindingElement(statements, element, exportSelf); + } + } + } else if (!ts6.isGeneratedIdentifier(decl.name)) { + var excludeName = void 0; + if (exportSelf) { + statements = appendExportStatement(statements, decl.name, factory.getLocalName(decl)); + excludeName = ts6.idText(decl.name); + } + statements = appendExportsOfDeclaration(statements, decl, excludeName); + } + return statements; + } + function appendExportsOfHoistedDeclaration(statements, decl) { + if (moduleInfo.exportEquals) { + return statements; + } + var excludeName; + if (ts6.hasSyntacticModifier( + decl, + 1 + /* ModifierFlags.Export */ + )) { + var exportName = ts6.hasSyntacticModifier( + decl, + 1024 + /* ModifierFlags.Default */ + ) ? factory.createStringLiteral("default") : decl.name; + statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); + excludeName = ts6.getTextOfIdentifierOrLiteral(exportName); + } + if (decl.name) { + statements = appendExportsOfDeclaration(statements, decl, excludeName); + } + return statements; + } + function appendExportsOfDeclaration(statements, decl, excludeName) { + if (moduleInfo.exportEquals) { + return statements; + } + var name = factory.getDeclarationName(decl); + var exportSpecifiers = moduleInfo.exportSpecifiers.get(ts6.idText(name)); + if (exportSpecifiers) { + for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { + var exportSpecifier = exportSpecifiers_2[_i]; + if (exportSpecifier.name.escapedText !== excludeName) { + statements = appendExportStatement(statements, exportSpecifier.name, name); + } + } + } + return statements; + } + function appendExportStatement(statements, exportName, expression, allowComments) { + statements = ts6.append(statements, createExportStatement(exportName, expression, allowComments)); + return statements; + } + function createExportStatement(name, value, allowComments) { + var statement = factory.createExpressionStatement(createExportExpression(name, value)); + ts6.startOnNewLine(statement); + if (!allowComments) { + ts6.setEmitFlags( + statement, + 1536 + /* EmitFlags.NoComments */ + ); + } + return statement; + } + function createExportExpression(name, value) { + var exportName = ts6.isIdentifier(name) ? factory.createStringLiteralFromNode(name) : name; + ts6.setEmitFlags( + value, + ts6.getEmitFlags(value) | 1536 + /* EmitFlags.NoComments */ + ); + return ts6.setCommentRange(factory.createCallExpression( + exportFunction, + /*typeArguments*/ + void 0, + [exportName, value] + ), value); + } + function topLevelNestedVisitor(node) { + switch (node.kind) { + case 240: + return visitVariableStatement(node); + case 259: + return visitFunctionDeclaration(node); + case 260: + return visitClassDeclaration(node); + case 245: + return visitForStatement( + node, + /*isTopLevel*/ + true + ); + case 246: + return visitForInStatement(node); + case 247: + return visitForOfStatement(node); + case 243: + return visitDoStatement(node); + case 244: + return visitWhileStatement(node); + case 253: + return visitLabeledStatement(node); + case 251: + return visitWithStatement(node); + case 252: + return visitSwitchStatement(node); + case 266: + return visitCaseBlock(node); + case 292: + return visitCaseClause(node); + case 293: + return visitDefaultClause(node); + case 255: + return visitTryStatement(node); + case 295: + return visitCatchClause(node); + case 238: + return visitBlock(node); + case 355: + return visitMergeDeclarationMarker(node); + case 356: + return visitEndOfDeclarationMarker(node); + default: + return visitor(node); + } + } + function visitForStatement(node, isTopLevel) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = factory.updateForStatement(node, ts6.visitNode(node.initializer, isTopLevel ? visitForInitializer : discardedValueVisitor, ts6.isForInitializer), ts6.visitNode(node.condition, visitor, ts6.isExpression), ts6.visitNode(node.incrementor, discardedValueVisitor, ts6.isExpression), ts6.visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitForInStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = factory.updateForInStatement(node, visitForInitializer(node.initializer), ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, topLevelNestedVisitor, context)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitForOfStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = factory.updateForOfStatement(node, node.awaitModifier, visitForInitializer(node.initializer), ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, topLevelNestedVisitor, context)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function shouldHoistForInitializer(node) { + return ts6.isVariableDeclarationList(node) && shouldHoistVariableDeclarationList(node); + } + function visitForInitializer(node) { + if (shouldHoistForInitializer(node)) { + var expressions = void 0; + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + expressions = ts6.append(expressions, transformInitializedVariable( + variable, + /*isExportedDeclaration*/ + false + )); + if (!variable.initializer) { + hoistBindingElement(variable); + } + } + return expressions ? factory.inlineExpressions(expressions) : factory.createOmittedExpression(); + } else { + return ts6.visitNode(node, discardedValueVisitor, ts6.isExpression); + } + } + function visitDoStatement(node) { + return factory.updateDoStatement(node, ts6.visitIterationBody(node.statement, topLevelNestedVisitor, context), ts6.visitNode(node.expression, visitor, ts6.isExpression)); + } + function visitWhileStatement(node) { + return factory.updateWhileStatement(node, ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitIterationBody(node.statement, topLevelNestedVisitor, context)); + } + function visitLabeledStatement(node) { + return factory.updateLabeledStatement(node, node.label, ts6.visitNode(node.statement, topLevelNestedVisitor, ts6.isStatement, factory.liftToBlock)); + } + function visitWithStatement(node) { + return factory.updateWithStatement(node, ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitNode(node.statement, topLevelNestedVisitor, ts6.isStatement, factory.liftToBlock)); + } + function visitSwitchStatement(node) { + return factory.updateSwitchStatement(node, ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitNode(node.caseBlock, topLevelNestedVisitor, ts6.isCaseBlock)); + } + function visitCaseBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = factory.updateCaseBlock(node, ts6.visitNodes(node.clauses, topLevelNestedVisitor, ts6.isCaseOrDefaultClause)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitCaseClause(node) { + return factory.updateCaseClause(node, ts6.visitNode(node.expression, visitor, ts6.isExpression), ts6.visitNodes(node.statements, topLevelNestedVisitor, ts6.isStatement)); + } + function visitDefaultClause(node) { + return ts6.visitEachChild(node, topLevelNestedVisitor, context); + } + function visitTryStatement(node) { + return ts6.visitEachChild(node, topLevelNestedVisitor, context); + } + function visitCatchClause(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = factory.updateCatchClause(node, node.variableDeclaration, ts6.visitNode(node.block, topLevelNestedVisitor, ts6.isBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts6.visitEachChild(node, topLevelNestedVisitor, context); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitorWorker(node, valueIsDiscarded) { + if (!(node.transformFlags & (4096 | 8388608 | 268435456))) { + return node; + } + switch (node.kind) { + case 245: + return visitForStatement( + node, + /*isTopLevel*/ + false + ); + case 241: + return visitExpressionStatement(node); + case 214: + return visitParenthesizedExpression(node, valueIsDiscarded); + case 353: + return visitPartiallyEmittedExpression(node, valueIsDiscarded); + case 223: + if (ts6.isDestructuringAssignment(node)) { + return visitDestructuringAssignment(node, valueIsDiscarded); + } + break; + case 210: + if (ts6.isImportCall(node)) { + return visitImportCallExpression(node); + } + break; + case 221: + case 222: + return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); + } + return ts6.visitEachChild(node, visitor, context); + } + function visitor(node) { + return visitorWorker( + node, + /*valueIsDiscarded*/ + false + ); + } + function discardedValueVisitor(node) { + return visitorWorker( + node, + /*valueIsDiscarded*/ + true + ); + } + function visitExpressionStatement(node) { + return factory.updateExpressionStatement(node, ts6.visitNode(node.expression, discardedValueVisitor, ts6.isExpression)); + } + function visitParenthesizedExpression(node, valueIsDiscarded) { + return factory.updateParenthesizedExpression(node, ts6.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts6.isExpression)); + } + function visitPartiallyEmittedExpression(node, valueIsDiscarded) { + return factory.updatePartiallyEmittedExpression(node, ts6.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts6.isExpression)); + } + function visitImportCallExpression(node) { + var externalModuleName = ts6.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions); + var firstArgument = ts6.visitNode(ts6.firstOrUndefined(node.arguments), visitor); + var argument = externalModuleName && (!firstArgument || !ts6.isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument; + return factory.createCallExpression( + factory.createPropertyAccessExpression(contextObject, factory.createIdentifier("import")), + /*typeArguments*/ + void 0, + argument ? [argument] : [] + ); + } + function visitDestructuringAssignment(node, valueIsDiscarded) { + if (hasExportedReferenceInDestructuringTarget(node.left)) { + return ts6.flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded); + } + return ts6.visitEachChild(node, visitor, context); + } + function hasExportedReferenceInDestructuringTarget(node) { + if (ts6.isAssignmentExpression( + node, + /*excludeCompoundAssignment*/ + true + )) { + return hasExportedReferenceInDestructuringTarget(node.left); + } else if (ts6.isSpreadElement(node)) { + return hasExportedReferenceInDestructuringTarget(node.expression); + } else if (ts6.isObjectLiteralExpression(node)) { + return ts6.some(node.properties, hasExportedReferenceInDestructuringTarget); + } else if (ts6.isArrayLiteralExpression(node)) { + return ts6.some(node.elements, hasExportedReferenceInDestructuringTarget); + } else if (ts6.isShorthandPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.name); + } else if (ts6.isPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.initializer); + } else if (ts6.isIdentifier(node)) { + var container = resolver.getReferencedExportContainer(node); + return container !== void 0 && container.kind === 308; + } else { + return false; + } + } + function visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded) { + if ((node.operator === 45 || node.operator === 46) && ts6.isIdentifier(node.operand) && !ts6.isGeneratedIdentifier(node.operand) && !ts6.isLocalName(node.operand) && !ts6.isDeclarationNameOfEnumOrNamespace(node.operand)) { + var exportedNames = getExports(node.operand); + if (exportedNames) { + var temp = void 0; + var expression = ts6.visitNode(node.operand, visitor, ts6.isExpression); + if (ts6.isPrefixUnaryExpression(node)) { + expression = factory.updatePrefixUnaryExpression(node, expression); + } else { + expression = factory.updatePostfixUnaryExpression(node, expression); + if (!valueIsDiscarded) { + temp = factory.createTempVariable(hoistVariableDeclaration); + expression = factory.createAssignment(temp, expression); + ts6.setTextRange(expression, node); + } + expression = factory.createComma(expression, factory.cloneNode(node.operand)); + ts6.setTextRange(expression, node); + } + for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { + var exportName = exportedNames_4[_i]; + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + if (temp) { + expression = factory.createComma(expression, temp); + ts6.setTextRange(expression, node); + } + return expression; + } + } + return ts6.visitEachChild(node, visitor, context); + } + function modifierVisitor(node) { + switch (node.kind) { + case 93: + case 88: + return void 0; + } + return node; + } + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 308) { + var id = ts6.getOriginalNodeId(node); + currentSourceFile = node; + moduleInfo = moduleInfoMap[id]; + exportFunction = exportFunctionsMap[id]; + noSubstitution = noSubstitutionMap[id]; + contextObject = contextObjectMap[id]; + if (noSubstitution) { + delete noSubstitutionMap[id]; + } + previousOnEmitNode(hint, node, emitCallback); + currentSourceFile = void 0; + moduleInfo = void 0; + exportFunction = void 0; + contextObject = void 0; + noSubstitution = void 0; + } else { + previousOnEmitNode(hint, node, emitCallback); + } + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (isSubstitutionPrevented(node)) { + return node; + } + if (hint === 1) { + return substituteExpression(node); + } else if (hint === 4) { + return substituteUnspecified(node); + } + return node; + } + function substituteUnspecified(node) { + switch (node.kind) { + case 300: + return substituteShorthandPropertyAssignment(node); + } + return node; + } + function substituteShorthandPropertyAssignment(node) { + var _a, _b; + var name = node.name; + if (!ts6.isGeneratedIdentifier(name) && !ts6.isLocalName(name)) { + var importDeclaration = resolver.getReferencedImportDeclaration(name); + if (importDeclaration) { + if (ts6.isImportClause(importDeclaration)) { + return ts6.setTextRange( + factory.createPropertyAssignment(factory.cloneNode(name), factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default"))), + /*location*/ + node + ); + } else if (ts6.isImportSpecifier(importDeclaration)) { + return ts6.setTextRange( + factory.createPropertyAssignment(factory.cloneNode(name), factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(importDeclaration.propertyName || importDeclaration.name))), + /*location*/ + node + ); + } + } + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 79: + return substituteExpressionIdentifier(node); + case 223: + return substituteBinaryExpression(node); + case 233: + return substituteMetaProperty(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + var _a, _b; + if (ts6.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts6.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return factory.createPropertyAccessExpression(externalHelpersModuleName, node); + } + return node; + } + if (!ts6.isGeneratedIdentifier(node) && !ts6.isLocalName(node)) { + var importDeclaration = resolver.getReferencedImportDeclaration(node); + if (importDeclaration) { + if (ts6.isImportClause(importDeclaration)) { + return ts6.setTextRange( + factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default")), + /*location*/ + node + ); + } else if (ts6.isImportSpecifier(importDeclaration)) { + return ts6.setTextRange( + factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(importDeclaration.propertyName || importDeclaration.name)), + /*location*/ + node + ); + } + } + } + return node; + } + function substituteBinaryExpression(node) { + if (ts6.isAssignmentOperator(node.operatorToken.kind) && ts6.isIdentifier(node.left) && !ts6.isGeneratedIdentifier(node.left) && !ts6.isLocalName(node.left) && !ts6.isDeclarationNameOfEnumOrNamespace(node.left)) { + var exportedNames = getExports(node.left); + if (exportedNames) { + var expression = node; + for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) { + var exportName = exportedNames_5[_i]; + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + return expression; + } + } + return node; + } + function substituteMetaProperty(node) { + if (ts6.isImportMeta(node)) { + return factory.createPropertyAccessExpression(contextObject, factory.createIdentifier("meta")); + } + return node; + } + function getExports(name) { + var exportedNames; + if (!ts6.isGeneratedIdentifier(name)) { + var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); + if (valueDeclaration) { + var exportContainer = resolver.getReferencedExportContainer( + name, + /*prefixLocals*/ + false + ); + if (exportContainer && exportContainer.kind === 308) { + exportedNames = ts6.append(exportedNames, factory.getDeclarationName(valueDeclaration)); + } + exportedNames = ts6.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts6.getOriginalNodeId(valueDeclaration)]); + } + } + return exportedNames; + } + function preventSubstitution(node) { + if (noSubstitution === void 0) + noSubstitution = []; + noSubstitution[ts6.getNodeId(node)] = true; + return node; + } + function isSubstitutionPrevented(node) { + return noSubstitution && node.id && noSubstitution[node.id]; + } + } + ts6.transformSystemModule = transformSystemModule; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformECMAScriptModule(context) { + var factory = context.factory, emitHelpers = context.getEmitHelperFactory; + var host = context.getEmitHost(); + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification( + 308 + /* SyntaxKind.SourceFile */ + ); + context.enableSubstitution( + 79 + /* SyntaxKind.Identifier */ + ); + var helperNameSubstitutions; + var currentSourceFile; + var importRequireStatements; + return ts6.chainBundle(context, transformSourceFile); + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + if (ts6.isExternalModule(node) || compilerOptions.isolatedModules) { + currentSourceFile = node; + importRequireStatements = void 0; + var result = updateExternalModule(node); + currentSourceFile = void 0; + if (importRequireStatements) { + result = factory.updateSourceFile(result, ts6.setTextRange(factory.createNodeArray(ts6.insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)); + } + if (!ts6.isExternalModule(node) || ts6.some(result.statements, ts6.isExternalModuleIndicator)) { + return result; + } + return factory.updateSourceFile(result, ts6.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], result.statements, true), [ts6.createEmptyExports(factory)], false)), result.statements)); + } + return node; + } + function updateExternalModule(node) { + var externalHelpersImportDeclaration = ts6.createExternalHelpersImportDeclarationIfNeeded(factory, emitHelpers(), node, compilerOptions); + if (externalHelpersImportDeclaration) { + var statements = []; + var statementOffset = factory.copyPrologue(node.statements, statements); + ts6.append(statements, externalHelpersImportDeclaration); + ts6.addRange(statements, ts6.visitNodes(node.statements, visitor, ts6.isStatement, statementOffset)); + return factory.updateSourceFile(node, ts6.setTextRange(factory.createNodeArray(statements), node.statements)); + } else { + return ts6.visitEachChild(node, visitor, context); + } + } + function visitor(node) { + switch (node.kind) { + case 268: + return ts6.getEmitModuleKind(compilerOptions) >= ts6.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : void 0; + case 274: + return visitExportAssignment(node); + case 275: + var exportDecl = node; + return visitExportDeclaration(exportDecl); + } + return node; + } + function createRequireCall(importNode) { + var moduleName = ts6.getExternalModuleNameLiteral(factory, importNode, ts6.Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions); + var args = []; + if (moduleName) { + args.push(moduleName); + } + if (!importRequireStatements) { + var createRequireName = factory.createUniqueName( + "_createRequire", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ); + var importStatement = factory.createImportDeclaration( + /*modifiers*/ + void 0, + factory.createImportClause( + /*isTypeOnly*/ + false, + /*name*/ + void 0, + factory.createNamedImports([ + factory.createImportSpecifier( + /*isTypeOnly*/ + false, + factory.createIdentifier("createRequire"), + createRequireName + ) + ]) + ), + factory.createStringLiteral("module") + ); + var requireHelperName = factory.createUniqueName( + "__require", + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ); + var requireStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + requireHelperName, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory.createCallExpression( + factory.cloneNode(createRequireName), + /*typeArguments*/ + void 0, + [ + factory.createPropertyAccessExpression(factory.createMetaProperty(100, factory.createIdentifier("meta")), factory.createIdentifier("url")) + ] + ) + ) + ], + /*flags*/ + languageVersion >= 2 ? 2 : 0 + /* NodeFlags.None */ + ) + ); + importRequireStatements = [importStatement, requireStatement]; + } + var name = importRequireStatements[1].declarationList.declarations[0].name; + ts6.Debug.assertNode(name, ts6.isIdentifier); + return factory.createCallExpression( + factory.cloneNode(name), + /*typeArguments*/ + void 0, + args + ); + } + function visitImportEqualsDeclaration(node) { + ts6.Debug.assert(ts6.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + statements = ts6.append(statements, ts6.setOriginalNode(ts6.setTextRange(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + factory.cloneNode(node.name), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + createRequireCall(node) + ) + ], + /*flags*/ + languageVersion >= 2 ? 2 : 0 + /* NodeFlags.None */ + ) + ), node), node)); + statements = appendExportsOfImportEqualsDeclaration(statements, node); + return ts6.singleOrMany(statements); + } + function appendExportsOfImportEqualsDeclaration(statements, node) { + if (ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + )) { + statements = ts6.append(statements, factory.createExportDeclaration( + /*modifiers*/ + void 0, + node.isTypeOnly, + factory.createNamedExports([factory.createExportSpecifier( + /*isTypeOnly*/ + false, + /*propertyName*/ + void 0, + ts6.idText(node.name) + )]) + )); + } + return statements; + } + function visitExportAssignment(node) { + return node.isExportEquals ? void 0 : node; + } + function visitExportDeclaration(node) { + if (compilerOptions.module !== void 0 && compilerOptions.module > ts6.ModuleKind.ES2015) { + return node; + } + if (!node.exportClause || !ts6.isNamespaceExport(node.exportClause) || !node.moduleSpecifier) { + return node; + } + var oldIdentifier = node.exportClause.name; + var synthName = factory.getGeneratedNameForNode(oldIdentifier); + var importDecl = factory.createImportDeclaration( + /*modifiers*/ + void 0, + factory.createImportClause( + /*isTypeOnly*/ + false, + /*name*/ + void 0, + factory.createNamespaceImport(synthName) + ), + node.moduleSpecifier, + node.assertClause + ); + ts6.setOriginalNode(importDecl, node.exportClause); + var exportDecl = ts6.isExportNamespaceAsDefaultDeclaration(node) ? factory.createExportDefault(synthName) : factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + factory.createNamedExports([factory.createExportSpecifier( + /*isTypeOnly*/ + false, + synthName, + oldIdentifier + )]) + ); + ts6.setOriginalNode(exportDecl, node); + return [importDecl, exportDecl]; + } + function onEmitNode(hint, node, emitCallback) { + if (ts6.isSourceFile(node)) { + if ((ts6.isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) { + helperNameSubstitutions = new ts6.Map(); + } + previousOnEmitNode(hint, node, emitCallback); + helperNameSubstitutions = void 0; + } else { + previousOnEmitNode(hint, node, emitCallback); + } + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (helperNameSubstitutions && ts6.isIdentifier(node) && ts6.getEmitFlags(node) & 4096) { + return substituteHelperName(node); + } + return node; + } + function substituteHelperName(node) { + var name = ts6.idText(node); + var substitution = helperNameSubstitutions.get(name); + if (!substitution) { + helperNameSubstitutions.set(name, substitution = factory.createUniqueName( + name, + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + )); + } + return substitution; + } + } + ts6.transformECMAScriptModule = transformECMAScriptModule; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transformNodeModule(context) { + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + var esmTransform = ts6.transformECMAScriptModule(context); + var esmOnSubstituteNode = context.onSubstituteNode; + var esmOnEmitNode = context.onEmitNode; + context.onSubstituteNode = previousOnSubstituteNode; + context.onEmitNode = previousOnEmitNode; + var cjsTransform = ts6.transformModule(context); + var cjsOnSubstituteNode = context.onSubstituteNode; + var cjsOnEmitNode = context.onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.onEmitNode = onEmitNode; + context.enableSubstitution( + 308 + /* SyntaxKind.SourceFile */ + ); + context.enableEmitNotification( + 308 + /* SyntaxKind.SourceFile */ + ); + var currentSourceFile; + return transformSourceFileOrBundle; + function onSubstituteNode(hint, node) { + if (ts6.isSourceFile(node)) { + currentSourceFile = node; + return previousOnSubstituteNode(hint, node); + } else { + if (!currentSourceFile) { + return previousOnSubstituteNode(hint, node); + } + if (currentSourceFile.impliedNodeFormat === ts6.ModuleKind.ESNext) { + return esmOnSubstituteNode(hint, node); + } + return cjsOnSubstituteNode(hint, node); + } + } + function onEmitNode(hint, node, emitCallback) { + if (ts6.isSourceFile(node)) { + currentSourceFile = node; + } + if (!currentSourceFile) { + return previousOnEmitNode(hint, node, emitCallback); + } + if (currentSourceFile.impliedNodeFormat === ts6.ModuleKind.ESNext) { + return esmOnEmitNode(hint, node, emitCallback); + } + return cjsOnEmitNode(hint, node, emitCallback); + } + function getModuleTransformForFile(file) { + return file.impliedNodeFormat === ts6.ModuleKind.ESNext ? esmTransform : cjsTransform; + } + function transformSourceFile(node) { + if (node.isDeclarationFile) { + return node; + } + currentSourceFile = node; + var result = getModuleTransformForFile(node)(node); + currentSourceFile = void 0; + ts6.Debug.assert(ts6.isSourceFile(result)); + return result; + } + function transformSourceFileOrBundle(node) { + return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); + } + function transformBundle(node) { + return context.factory.createBundle(ts6.map(node.sourceFiles, transformSourceFile), node.prepends); + } + } + ts6.transformNodeModule = transformNodeModule; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function canProduceDiagnostics(node) { + return ts6.isVariableDeclaration(node) || ts6.isPropertyDeclaration(node) || ts6.isPropertySignature(node) || ts6.isBindingElement(node) || ts6.isSetAccessor(node) || ts6.isGetAccessor(node) || ts6.isConstructSignatureDeclaration(node) || ts6.isCallSignatureDeclaration(node) || ts6.isMethodDeclaration(node) || ts6.isMethodSignature(node) || ts6.isFunctionDeclaration(node) || ts6.isParameter(node) || ts6.isTypeParameterDeclaration(node) || ts6.isExpressionWithTypeArguments(node) || ts6.isImportEqualsDeclaration(node) || ts6.isTypeAliasDeclaration(node) || ts6.isConstructorDeclaration(node) || ts6.isIndexSignatureDeclaration(node) || ts6.isPropertyAccessExpression(node) || ts6.isJSDocTypeAlias(node); + } + ts6.canProduceDiagnostics = canProduceDiagnostics; + function createGetSymbolAccessibilityDiagnosticForNodeName(node) { + if (ts6.isSetAccessor(node) || ts6.isGetAccessor(node)) { + return getAccessorNameVisibilityError; + } else if (ts6.isMethodSignature(node) || ts6.isMethodDeclaration(node)) { + return getMethodNameVisibilityError; + } else { + return createGetSymbolAccessibilityDiagnosticForNode(node); + } + function getAccessorNameVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== void 0 ? { + diagnosticMessage, + errorNode: node, + typeName: node.name + } : void 0; + } + function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (ts6.isStatic(node)) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } else if (node.parent.kind === 260) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } else { + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + function getMethodNameVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== void 0 ? { + diagnosticMessage, + errorNode: node, + typeName: node.name + } : void 0; + } + function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (ts6.isStatic(node)) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; + } else if (node.parent.kind === 260) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1; + } else { + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + } + ts6.createGetSymbolAccessibilityDiagnosticForNodeName = createGetSymbolAccessibilityDiagnosticForNodeName; + function createGetSymbolAccessibilityDiagnosticForNode(node) { + if (ts6.isVariableDeclaration(node) || ts6.isPropertyDeclaration(node) || ts6.isPropertySignature(node) || ts6.isPropertyAccessExpression(node) || ts6.isBindingElement(node) || ts6.isConstructorDeclaration(node)) { + return getVariableDeclarationTypeVisibilityError; + } else if (ts6.isSetAccessor(node) || ts6.isGetAccessor(node)) { + return getAccessorDeclarationTypeVisibilityError; + } else if (ts6.isConstructSignatureDeclaration(node) || ts6.isCallSignatureDeclaration(node) || ts6.isMethodDeclaration(node) || ts6.isMethodSignature(node) || ts6.isFunctionDeclaration(node) || ts6.isIndexSignatureDeclaration(node)) { + return getReturnTypeVisibilityError; + } else if (ts6.isParameter(node)) { + if (ts6.isParameterPropertyDeclaration(node, node.parent) && ts6.hasSyntacticModifier( + node.parent, + 8 + /* ModifierFlags.Private */ + )) { + return getVariableDeclarationTypeVisibilityError; + } + return getParameterDeclarationTypeVisibilityError; + } else if (ts6.isTypeParameterDeclaration(node)) { + return getTypeParameterConstraintVisibilityError; + } else if (ts6.isExpressionWithTypeArguments(node)) { + return getHeritageClauseVisibilityError; + } else if (ts6.isImportEqualsDeclaration(node)) { + return getImportEntityNameVisibilityError; + } else if (ts6.isTypeAliasDeclaration(node) || ts6.isJSDocTypeAlias(node)) { + return getTypeAliasDeclarationVisibilityError; + } else { + return ts6.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts6.Debug.formatSyntaxKind(node.kind))); + } + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 257 || node.kind === 205) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + } else if (node.kind === 169 || node.kind === 208 || node.kind === 168 || node.kind === 166 && ts6.hasSyntacticModifier( + node.parent, + 8 + /* ModifierFlags.Private */ + )) { + if (ts6.isStatic(node)) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } else if (node.parent.kind === 260 || node.kind === 166) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } else { + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + } + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== void 0 ? { + diagnosticMessage, + errorNode: node, + typeName: node.name + } : void 0; + } + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + if (node.kind === 175) { + if (ts6.isStatic(node)) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1; + } else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1; + } + } else { + if (ts6.isStatic(node)) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1; + } else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1; + } + } + return { + diagnosticMessage, + errorNode: node.name, + typeName: node.name + }; + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 177: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 176: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 178: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 171: + case 170: + if (ts6.isStatic(node)) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts6.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + } else if (node.parent.kind === 260) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts6.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + } else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + } + break; + case 259: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts6.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts6.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + break; + default: + return ts6.Debug.fail("This is unknown kind for signature: " + node.kind); + } + return { + diagnosticMessage, + errorNode: node.name || node + }; + } + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== void 0 ? { + diagnosticMessage, + errorNode: node, + typeName: node.name + } : void 0; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + switch (node.parent.kind) { + case 173: + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + case 177: + case 182: + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + case 176: + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 178: + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 171: + case 170: + if (ts6.isStatic(node.parent)) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } else if (node.parent.parent.kind === 260) { + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } else { + return symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + case 259: + case 181: + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + case 175: + case 174: + return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts6.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts6.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 : ts6.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1; + default: + return ts6.Debug.fail("Unknown parent for parameter: ".concat(ts6.Debug.formatSyntaxKind(node.parent.kind))); + } + } + function getTypeParameterConstraintVisibilityError() { + var diagnosticMessage; + switch (node.parent.kind) { + case 260: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 261: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 197: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; + break; + case 182: + case 177: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 176: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 171: + case 170: + if (ts6.isStatic(node.parent)) { + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } else if (node.parent.parent.kind === 260) { + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } else { + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 181: + case 259: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + case 262: + diagnosticMessage = ts6.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; + break; + default: + return ts6.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); + } + return { + diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + function getHeritageClauseVisibilityError() { + var diagnosticMessage; + if (ts6.isClassDeclaration(node.parent.parent)) { + diagnosticMessage = ts6.isHeritageClause(node.parent) && node.parent.token === 117 ? ts6.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : node.parent.parent.name ? ts6.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts6.Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0; + } else { + diagnosticMessage = ts6.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + } + return { + diagnosticMessage, + errorNode: node, + typeName: ts6.getNameOfDeclaration(node.parent.parent) + }; + } + function getImportEntityNameVisibilityError() { + return { + diagnosticMessage: ts6.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; + } + function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { + return { + diagnosticMessage: symbolAccessibilityResult.errorModuleName ? ts6.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2 : ts6.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: ts6.isJSDocTypeAlias(node) ? ts6.Debug.checkDefined(node.typeExpression) : node.type, + typeName: ts6.isJSDocTypeAlias(node) ? ts6.getNameOfDeclaration(node) : node.name + }; + } + } + ts6.createGetSymbolAccessibilityDiagnosticForNode = createGetSymbolAccessibilityDiagnosticForNode; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getDeclarationDiagnostics(host, resolver, file) { + var compilerOptions = host.getCompilerOptions(); + var result = ts6.transformNodes( + resolver, + host, + ts6.factory, + compilerOptions, + file ? [file] : ts6.filter(host.getSourceFiles(), ts6.isSourceFileNotJson), + [transformDeclarations], + /*allowDtsFiles*/ + false + ); + return result.diagnostics; + } + ts6.getDeclarationDiagnostics = getDeclarationDiagnostics; + function hasInternalAnnotation(range2, currentSourceFile) { + var comment = currentSourceFile.text.substring(range2.pos, range2.end); + return ts6.stringContains(comment, "@internal"); + } + function isInternalDeclaration(node, currentSourceFile) { + var parseTreeNode = ts6.getParseTreeNode(node); + if (parseTreeNode && parseTreeNode.kind === 166) { + var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); + var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0; + var text = currentSourceFile.text; + var commentRanges = previousSibling ? ts6.concatenate( + // to handle + // ... parameters, /* @internal */ + // public param: string + ts6.getTrailingCommentRanges(text, ts6.skipTrivia( + text, + previousSibling.end + 1, + /* stopAfterLineBreak */ + false, + /* stopAtComments */ + true + )), + ts6.getLeadingCommentRanges(text, node.pos) + ) : ts6.getTrailingCommentRanges(text, ts6.skipTrivia( + text, + node.pos, + /* stopAfterLineBreak */ + false, + /* stopAtComments */ + true + )); + return commentRanges && commentRanges.length && hasInternalAnnotation(ts6.last(commentRanges), currentSourceFile); + } + var leadingCommentRanges = parseTreeNode && ts6.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile); + return !!ts6.forEach(leadingCommentRanges, function(range2) { + return hasInternalAnnotation(range2, currentSourceFile); + }); + } + ts6.isInternalDeclaration = isInternalDeclaration; + var declarationEmitNodeBuilderFlags = 1024 | 2048 | 4096 | 8 | 524288 | 4 | 1; + function transformDeclarations(context) { + var throwDiagnostic = function() { + return ts6.Debug.fail("Diagnostic emitted without context"); + }; + var getSymbolAccessibilityDiagnostic = throwDiagnostic; + var needsDeclare = true; + var isBundledEmit = false; + var resultHasExternalModuleIndicator = false; + var needsScopeFixMarker = false; + var resultHasScopeMarker = false; + var enclosingDeclaration; + var necessaryTypeReferences; + var lateMarkedStatements; + var lateStatementReplacementMap; + var suppressNewDiagnosticContexts; + var exportedModulesFromDeclarationEmit; + var factory = context.factory; + var host = context.getEmitHost(); + var symbolTracker = { + trackSymbol, + reportInaccessibleThisError, + reportInaccessibleUniqueSymbolError, + reportCyclicStructureError, + reportPrivateInBaseOfClassExpression, + reportLikelyUnsafeImportRequiredError, + reportTruncationError, + moduleResolverHost: host, + trackReferencedAmbientModule, + trackExternalModuleSymbolOfImportTypeNode, + reportNonlocalAugmentation, + reportNonSerializableProperty, + reportImportTypeNodeResolutionModeOverride + }; + var errorNameNode; + var errorFallbackNode; + var currentSourceFile; + var refs; + var libs; + var emittedImports; + var resolver = context.getEmitResolver(); + var options = context.getCompilerOptions(); + var noResolve = options.noResolve, stripInternal = options.stripInternal; + return transformRoot; + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + necessaryTypeReferences = necessaryTypeReferences || new ts6.Set(); + for (var _i = 0, typeReferenceDirectives_2 = typeReferenceDirectives; _i < typeReferenceDirectives_2.length; _i++) { + var ref = typeReferenceDirectives_2[_i]; + necessaryTypeReferences.add(ref); + } + } + function trackReferencedAmbientModule(node, symbol) { + var directives = resolver.getTypeReferenceDirectivesForSymbol( + symbol, + 67108863 + /* SymbolFlags.All */ + ); + if (ts6.length(directives)) { + return recordTypeReferenceDirectivesIfNecessary(directives); + } + var container = ts6.getSourceFileOfNode(node); + refs.set(ts6.getOriginalNodeId(container), container); + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0) { + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + if (!lateMarkedStatements) { + lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible; + } else { + for (var _i = 0, _a = symbolAccessibilityResult.aliasesToMakeVisible; _i < _a.length; _i++) { + var ref = _a[_i]; + ts6.pushIfUnique(lateMarkedStatements, ref); + } + } + } + } else { + var errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); + if (errorInfo) { + if (errorInfo.typeName) { + context.addDiagnostic(ts6.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts6.getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + } else { + context.addDiagnostic(ts6.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + } + return true; + } + } + return false; + } + function trackExternalModuleSymbolOfImportTypeNode(symbol) { + if (!isBundledEmit) { + (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol); + } + } + function trackSymbol(symbol, enclosingDeclaration2, meaning) { + if (symbol.flags & 262144) + return false; + var issuedDiagnostic = handleSymbolAccessibilityError(resolver.isSymbolAccessible( + symbol, + enclosingDeclaration2, + meaning, + /*shouldComputeAliasesToMakeVisible*/ + true + )); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); + return issuedDiagnostic; + } + function reportPrivateInBaseOfClassExpression(propertyName) { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName)); + } + } + function errorDeclarationNameWithFallback() { + return errorNameNode ? ts6.declarationNameToString(errorNameNode) : errorFallbackNode && ts6.getNameOfDeclaration(errorFallbackNode) ? ts6.declarationNameToString(ts6.getNameOfDeclaration(errorFallbackNode)) : errorFallbackNode && ts6.isExportAssignment(errorFallbackNode) ? errorFallbackNode.isExportEquals ? "export=" : "default" : "(Missing)"; + } + function reportInaccessibleUniqueSymbolError() { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol")); + } + } + function reportCyclicStructureError() { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary, errorDeclarationNameWithFallback())); + } + } + function reportInaccessibleThisError() { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this")); + } + } + function reportLikelyUnsafeImportRequiredError(specifier) { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier)); + } + } + function reportTruncationError() { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed)); + } + } + function reportNonlocalAugmentation(containingFile, parentSymbol, symbol) { + var _a; + var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function(d) { + return ts6.getSourceFileOfNode(d) === containingFile; + }); + var augmentingDeclarations = ts6.filter(symbol.declarations, function(d) { + return ts6.getSourceFileOfNode(d) !== containingFile; + }); + if (primaryDeclaration && augmentingDeclarations) { + for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { + var augmentations = augmentingDeclarations_1[_i]; + context.addDiagnostic(ts6.addRelatedInfo(ts6.createDiagnosticForNode(augmentations, ts6.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts6.createDiagnosticForNode(primaryDeclaration, ts6.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); + } + } + } + function reportNonSerializableProperty(propertyName) { + if (errorNameNode || errorFallbackNode) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName)); + } + } + function reportImportTypeNodeResolutionModeOverride() { + if (!ts6.isNightly() && (errorNameNode || errorFallbackNode)) { + context.addDiagnostic(ts6.createDiagnosticForNode(errorNameNode || errorFallbackNode, ts6.Diagnostics.The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next)); + } + } + function transformDeclarationsForJS(sourceFile, bundled) { + var oldDiag = getSymbolAccessibilityDiagnostic; + getSymbolAccessibilityDiagnostic = function(s) { + return s.errorNode && ts6.canProduceDiagnostics(s.errorNode) ? ts6.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : { + diagnosticMessage: s.errorModuleName ? ts6.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : ts6.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit, + errorNode: s.errorNode || sourceFile + }; + }; + var result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker, bundled); + getSymbolAccessibilityDiagnostic = oldDiag; + return result; + } + function transformRoot(node) { + if (node.kind === 308 && node.isDeclarationFile) { + return node; + } + if (node.kind === 309) { + isBundledEmit = true; + refs = new ts6.Map(); + libs = new ts6.Map(); + var hasNoDefaultLib_1 = false; + var bundle = factory.createBundle(ts6.map(node.sourceFiles, function(sourceFile) { + if (sourceFile.isDeclarationFile) + return void 0; + hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib; + currentSourceFile = sourceFile; + enclosingDeclaration = sourceFile; + lateMarkedStatements = void 0; + suppressNewDiagnosticContexts = false; + lateStatementReplacementMap = new ts6.Map(); + getSymbolAccessibilityDiagnostic = throwDiagnostic; + needsScopeFixMarker = false; + resultHasScopeMarker = false; + collectReferences(sourceFile, refs); + collectLibs(sourceFile, libs); + if (ts6.isExternalOrCommonJsModule(sourceFile) || ts6.isJsonSourceFile(sourceFile)) { + resultHasExternalModuleIndicator = false; + needsDeclare = false; + var statements2 = ts6.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS( + sourceFile, + /*bundled*/ + true + )) : ts6.visitNodes(sourceFile.statements, visitDeclarationStatements); + var newFile = factory.updateSourceFile( + sourceFile, + [factory.createModuleDeclaration([factory.createModifier( + 136 + /* SyntaxKind.DeclareKeyword */ + )], factory.createStringLiteral(ts6.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts6.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements2)), sourceFile.statements)))], + /*isDeclarationFile*/ + true, + /*referencedFiles*/ + [], + /*typeReferences*/ + [], + /*hasNoDefaultLib*/ + false, + /*libReferences*/ + [] + ); + return newFile; + } + needsDeclare = true; + var updated2 = ts6.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts6.visitNodes(sourceFile.statements, visitDeclarationStatements); + return factory.updateSourceFile( + sourceFile, + transformAndReplaceLatePaintedStatements(updated2), + /*isDeclarationFile*/ + true, + /*referencedFiles*/ + [], + /*typeReferences*/ + [], + /*hasNoDefaultLib*/ + false, + /*libReferences*/ + [] + ); + }), ts6.mapDefined(node.prepends, function(prepend) { + if (prepend.kind === 311) { + var sourceFile = ts6.createUnparsedSourceFile(prepend, "dts", stripInternal); + hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; + collectReferences(sourceFile, refs); + recordTypeReferenceDirectivesIfNecessary(ts6.map(sourceFile.typeReferenceDirectives, function(ref) { + return [ref.fileName, ref.resolutionMode]; + })); + collectLibs(sourceFile, libs); + return sourceFile; + } + return prepend; + })); + bundle.syntheticFileReferences = []; + bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences(); + bundle.syntheticLibReferences = getLibReferences(); + bundle.hasNoDefaultLib = hasNoDefaultLib_1; + var outputFilePath_1 = ts6.getDirectoryPath(ts6.normalizeSlashes(ts6.getOutputPathsFor( + node, + host, + /*forceDtsPaths*/ + true + ).declarationFilePath)); + var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); + refs.forEach(referenceVisitor_1); + return bundle; + } + needsDeclare = true; + needsScopeFixMarker = false; + resultHasScopeMarker = false; + enclosingDeclaration = node; + currentSourceFile = node; + getSymbolAccessibilityDiagnostic = throwDiagnostic; + isBundledEmit = false; + resultHasExternalModuleIndicator = false; + suppressNewDiagnosticContexts = false; + lateMarkedStatements = void 0; + lateStatementReplacementMap = new ts6.Map(); + necessaryTypeReferences = void 0; + refs = collectReferences(currentSourceFile, new ts6.Map()); + libs = collectLibs(currentSourceFile, new ts6.Map()); + var references = []; + var outputFilePath = ts6.getDirectoryPath(ts6.normalizeSlashes(ts6.getOutputPathsFor( + node, + host, + /*forceDtsPaths*/ + true + ).declarationFilePath)); + var referenceVisitor = mapReferencesIntoArray(references, outputFilePath); + var combinedStatements; + if (ts6.isSourceFileJS(currentSourceFile)) { + combinedStatements = factory.createNodeArray(transformDeclarationsForJS(node)); + refs.forEach(referenceVisitor); + emittedImports = ts6.filter(combinedStatements, ts6.isAnyImportSyntax); + } else { + var statements = ts6.visitNodes(node.statements, visitDeclarationStatements); + combinedStatements = ts6.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements); + refs.forEach(referenceVisitor); + emittedImports = ts6.filter(combinedStatements, ts6.isAnyImportSyntax); + if (ts6.isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) { + combinedStatements = ts6.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], combinedStatements, true), [ts6.createEmptyExports(factory)], false)), combinedStatements); + } + } + var updated = factory.updateSourceFile( + node, + combinedStatements, + /*isDeclarationFile*/ + true, + references, + getFileReferencesForUsedTypeReferences(), + node.hasNoDefaultLib, + getLibReferences() + ); + updated.exportedModulesFromDeclarationEmit = exportedModulesFromDeclarationEmit; + return updated; + function getLibReferences() { + return ts6.map(ts6.arrayFrom(libs.keys()), function(lib) { + return { fileName: lib, pos: -1, end: -1 }; + }); + } + function getFileReferencesForUsedTypeReferences() { + return necessaryTypeReferences ? ts6.mapDefined(ts6.arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForSpecifierModeTuple) : []; + } + function getFileReferenceForSpecifierModeTuple(_a) { + var typeName = _a[0], mode = _a[1]; + if (emittedImports) { + for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) { + var importStatement = emittedImports_1[_i]; + if (ts6.isImportEqualsDeclaration(importStatement) && ts6.isExternalModuleReference(importStatement.moduleReference)) { + var expr = importStatement.moduleReference.expression; + if (ts6.isStringLiteralLike(expr) && expr.text === typeName) { + return void 0; + } + } else if (ts6.isImportDeclaration(importStatement) && ts6.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { + return void 0; + } + } + } + return __assign({ fileName: typeName, pos: -1, end: -1 }, mode ? { resolutionMode: mode } : void 0); + } + function mapReferencesIntoArray(references2, outputFilePath2) { + return function(file) { + var declFileName; + if (file.isDeclarationFile) { + declFileName = file.fileName; + } else { + if (isBundledEmit && ts6.contains(node.sourceFiles, file)) + return; + var paths = ts6.getOutputPathsFor( + file, + host, + /*forceDtsPaths*/ + true + ); + declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName; + } + if (declFileName) { + var specifier = ts6.moduleSpecifiers.getModuleSpecifier(options, currentSourceFile, ts6.toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName), ts6.toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName), host); + if (!ts6.pathIsRelative(specifier)) { + recordTypeReferenceDirectivesIfNecessary([[ + specifier, + /*mode*/ + void 0 + ]]); + return; + } + var fileName = ts6.getRelativePathToDirectoryOrUrl( + outputFilePath2, + declFileName, + host.getCurrentDirectory(), + host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ + false + ); + if (ts6.startsWith(fileName, "./") && ts6.hasExtension(fileName)) { + fileName = fileName.substring(2); + } + if (ts6.startsWith(fileName, "node_modules/") || ts6.pathContainsNodeModules(fileName)) { + return; + } + references2.push({ pos: -1, end: -1, fileName }); + } + }; + } + } + function collectReferences(sourceFile, ret) { + if (noResolve || !ts6.isUnparsedSource(sourceFile) && ts6.isSourceFileJS(sourceFile)) + return ret; + ts6.forEach(sourceFile.referencedFiles, function(f) { + var elem = host.getSourceFileFromReference(sourceFile, f); + if (elem) { + ret.set(ts6.getOriginalNodeId(elem), elem); + } + }); + return ret; + } + function collectLibs(sourceFile, ret) { + ts6.forEach(sourceFile.libReferenceDirectives, function(ref) { + var lib = host.getLibFileFromReference(ref); + if (lib) { + ret.set(ts6.toFileNameLowerCase(ref.fileName), true); + } + }); + return ret; + } + function filterBindingPatternInitializersAndRenamings(name) { + if (name.kind === 79) { + return name; + } else { + if (name.kind === 204) { + return factory.updateArrayBindingPattern(name, ts6.visitNodes(name.elements, visitBindingElement)); + } else { + return factory.updateObjectBindingPattern(name, ts6.visitNodes(name.elements, visitBindingElement)); + } + } + function visitBindingElement(elem) { + if (elem.kind === 229) { + return elem; + } + if (elem.propertyName && ts6.isIdentifier(elem.propertyName) && ts6.isIdentifier(elem.name) && !elem.symbol.isReferenced) { + return factory.updateBindingElement( + elem, + elem.dotDotDotToken, + /* propertyName */ + void 0, + elem.propertyName, + shouldPrintWithInitializer(elem) ? elem.initializer : void 0 + ); + } + return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializersAndRenamings(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : void 0); + } + } + function ensureParameter(p, modifierMask, type) { + var oldDiag; + if (!suppressNewDiagnosticContexts) { + oldDiag = getSymbolAccessibilityDiagnostic; + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(p); + } + var newParam = factory.updateParameterDeclaration( + p, + maskModifiers(p, modifierMask), + p.dotDotDotToken, + filterBindingPatternInitializersAndRenamings(p.name), + resolver.isOptionalParameter(p) ? p.questionToken || factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + ensureType( + p, + type || p.type, + /*ignorePrivate*/ + true + ), + // Ignore private param props, since this type is going straight back into a param + ensureNoInitializer(p) + ); + if (!suppressNewDiagnosticContexts) { + getSymbolAccessibilityDiagnostic = oldDiag; + } + return newParam; + } + function shouldPrintWithInitializer(node) { + return canHaveLiteralInitializer(node) && resolver.isLiteralConstDeclaration(ts6.getParseTreeNode(node)); + } + function ensureNoInitializer(node) { + if (shouldPrintWithInitializer(node)) { + return resolver.createLiteralConstValue(ts6.getParseTreeNode(node), symbolTracker); + } + return void 0; + } + function ensureType(node, type, ignorePrivate) { + if (!ignorePrivate && ts6.hasEffectiveModifier( + node, + 8 + /* ModifierFlags.Private */ + )) { + return; + } + if (shouldPrintWithInitializer(node)) { + return; + } + var shouldUseResolverType = node.kind === 166 && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); + if (type && !shouldUseResolverType) { + return ts6.visitNode(type, visitDeclarationSubtree); + } + if (!ts6.getParseTreeNode(node)) { + return type ? ts6.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + if (node.kind === 175) { + return factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + errorNameNode = node.name; + var oldDiag; + if (!suppressNewDiagnosticContexts) { + oldDiag = getSymbolAccessibilityDiagnostic; + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(node); + } + if (node.kind === 257 || node.kind === 205) { + return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); + } + if (node.kind === 166 || node.kind === 169 || node.kind === 168) { + if (ts6.isPropertySignature(node) || !node.initializer) + return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); + return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); + } + return cleanup(resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); + function cleanup(returnValue) { + errorNameNode = void 0; + if (!suppressNewDiagnosticContexts) { + getSymbolAccessibilityDiagnostic = oldDiag; + } + return returnValue || factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + } + function isDeclarationAndNotVisible(node) { + node = ts6.getParseTreeNode(node); + switch (node.kind) { + case 259: + case 264: + case 261: + case 260: + case 262: + case 263: + return !resolver.isDeclarationVisible(node); + case 257: + return !getBindingNameVisible(node); + case 268: + case 269: + case 275: + case 274: + return false; + case 172: + return true; + } + return false; + } + function shouldEmitFunctionProperties(input) { + var _a; + if (input.body) { + return true; + } + var overloadSignatures = (_a = input.symbol.declarations) === null || _a === void 0 ? void 0 : _a.filter(function(decl) { + return ts6.isFunctionDeclaration(decl) && !decl.body; + }); + return !overloadSignatures || overloadSignatures.indexOf(input) === overloadSignatures.length - 1; + } + function getBindingNameVisible(elem) { + if (ts6.isOmittedExpression(elem)) { + return false; + } + if (ts6.isBindingPattern(elem.name)) { + return ts6.some(elem.name.elements, getBindingNameVisible); + } else { + return resolver.isDeclarationVisible(elem); + } + } + function updateParamsList(node, params, modifierMask) { + if (ts6.hasEffectiveModifier( + node, + 8 + /* ModifierFlags.Private */ + )) { + return void 0; + } + var newParams = ts6.map(params, function(p) { + return ensureParameter(p, modifierMask); + }); + if (!newParams) { + return void 0; + } + return factory.createNodeArray(newParams, params.hasTrailingComma); + } + function updateAccessorParamsList(input, isPrivate) { + var newParams; + if (!isPrivate) { + var thisParameter = ts6.getThisParameter(input); + if (thisParameter) { + newParams = [ensureParameter(thisParameter)]; + } + } + if (ts6.isSetAccessorDeclaration(input)) { + var newValueParameter = void 0; + if (!isPrivate) { + var valueParameter = ts6.getSetAccessorValueParameter(input); + if (valueParameter) { + var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input)); + newValueParameter = ensureParameter( + valueParameter, + /*modifierMask*/ + void 0, + accessorType + ); + } + } + if (!newValueParameter) { + newValueParameter = factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "value" + ); + } + newParams = ts6.append(newParams, newValueParameter); + } + return factory.createNodeArray(newParams || ts6.emptyArray); + } + function ensureTypeParams(node, params) { + return ts6.hasEffectiveModifier( + node, + 8 + /* ModifierFlags.Private */ + ) ? void 0 : ts6.visitNodes(params, visitDeclarationSubtree); + } + function isEnclosingDeclaration(node) { + return ts6.isSourceFile(node) || ts6.isTypeAliasDeclaration(node) || ts6.isModuleDeclaration(node) || ts6.isClassDeclaration(node) || ts6.isInterfaceDeclaration(node) || ts6.isFunctionLike(node) || ts6.isIndexSignatureDeclaration(node) || ts6.isMappedTypeNode(node); + } + function checkEntityNameVisibility(entityName, enclosingDeclaration2) { + var visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2); + handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); + } + function preserveJsDoc(updated, original) { + if (ts6.hasJSDocNodes(updated) && ts6.hasJSDocNodes(original)) { + updated.jsDoc = original.jsDoc; + } + return ts6.setCommentRange(updated, ts6.getCommentRange(original)); + } + function rewriteModuleSpecifier(parent, input) { + if (!input) + return void 0; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 264 && parent.kind !== 202; + if (ts6.isStringLiteralLike(input)) { + if (isBundledEmit) { + var newName = ts6.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); + if (newName) { + return factory.createStringLiteral(newName); + } + } else { + var symbol = resolver.getSymbolOfExternalModuleSpecifier(input); + if (symbol) { + (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol); + } + } + } + return input; + } + function transformImportEqualsDeclaration(decl) { + if (!resolver.isDeclarationVisible(decl)) + return; + if (decl.moduleReference.kind === 280) { + var specifier = ts6.getExternalModuleImportEqualsDeclarationExpression(decl); + return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); + } else { + var oldDiag = getSymbolAccessibilityDiagnostic; + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(decl); + checkEntityNameVisibility(decl.moduleReference, enclosingDeclaration); + getSymbolAccessibilityDiagnostic = oldDiag; + return decl; + } + } + function transformImportDeclaration(decl) { + if (!decl.importClause) { + return factory.updateImportDeclaration(decl, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); + } + var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0; + if (!decl.importClause.namedBindings) { + return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause( + decl.importClause, + decl.importClause.isTypeOnly, + visibleDefaultBinding, + /*namedBindings*/ + void 0 + ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); + } + if (decl.importClause.namedBindings.kind === 271) { + var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : ( + /*namedBindings*/ + void 0 + ); + return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : void 0; + } + var bindingList = ts6.mapDefined(decl.importClause.namedBindings.elements, function(b) { + return resolver.isDeclarationVisible(b) ? b : void 0; + }); + if (bindingList && bindingList.length || visibleDefaultBinding) { + return factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); + } + if (resolver.isImportRequiredByAugmentation(decl)) { + return factory.updateImportDeclaration( + decl, + decl.modifiers, + /*importClause*/ + void 0, + rewriteModuleSpecifier(decl, decl.moduleSpecifier), + getResolutionModeOverrideForClauseInNightly(decl.assertClause) + ); + } + } + function getResolutionModeOverrideForClauseInNightly(assertClause) { + var mode = ts6.getResolutionModeOverrideForClause(assertClause); + if (mode !== void 0) { + if (!ts6.isNightly()) { + context.addDiagnostic(ts6.createDiagnosticForNode(assertClause, ts6.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next)); + } + return assertClause; + } + return void 0; + } + function transformAndReplaceLatePaintedStatements(statements) { + while (ts6.length(lateMarkedStatements)) { + var i = lateMarkedStatements.shift(); + if (!ts6.isLateVisibilityPaintedStatement(i)) { + return ts6.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: ".concat(ts6.Debug.formatSyntaxKind(i.kind))); + } + var priorNeedsDeclare = needsDeclare; + needsDeclare = i.parent && ts6.isSourceFile(i.parent) && !(ts6.isExternalModule(i.parent) && isBundledEmit); + var result = transformTopLevelDeclaration(i); + needsDeclare = priorNeedsDeclare; + lateStatementReplacementMap.set(ts6.getOriginalNodeId(i), result); + } + return ts6.visitNodes(statements, visitLateVisibilityMarkedStatements); + function visitLateVisibilityMarkedStatements(statement) { + if (ts6.isLateVisibilityPaintedStatement(statement)) { + var key = ts6.getOriginalNodeId(statement); + if (lateStatementReplacementMap.has(key)) { + var result2 = lateStatementReplacementMap.get(key); + lateStatementReplacementMap.delete(key); + if (result2) { + if (ts6.isArray(result2) ? ts6.some(result2, ts6.needsScopeMarker) : ts6.needsScopeMarker(result2)) { + needsScopeFixMarker = true; + } + if (ts6.isSourceFile(statement.parent) && (ts6.isArray(result2) ? ts6.some(result2, ts6.isExternalModuleIndicator) : ts6.isExternalModuleIndicator(result2))) { + resultHasExternalModuleIndicator = true; + } + } + return result2; + } + } + return statement; + } + } + function visitDeclarationSubtree(input) { + if (shouldStripInternal(input)) + return; + if (ts6.isDeclaration(input)) { + if (isDeclarationAndNotVisible(input)) + return; + if (ts6.hasDynamicName(input) && !resolver.isLateBound(ts6.getParseTreeNode(input))) { + return; + } + } + if (ts6.isFunctionLike(input) && resolver.isImplementationOfOverload(input)) + return; + if (ts6.isSemicolonClassElement(input)) + return; + var previousEnclosingDeclaration; + if (isEnclosingDeclaration(input)) { + previousEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = input; + } + var oldDiag = getSymbolAccessibilityDiagnostic; + var canProduceDiagnostic = ts6.canProduceDiagnostics(input); + var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; + var shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 184 || input.kind === 197) && input.parent.kind !== 262; + if (ts6.isMethodDeclaration(input) || ts6.isMethodSignature(input)) { + if (ts6.hasEffectiveModifier( + input, + 8 + /* ModifierFlags.Private */ + )) { + if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) + return; + return cleanup(factory.createPropertyDeclaration( + ensureModifiers(input), + input.name, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + )); + } + } + if (canProduceDiagnostic && !suppressNewDiagnosticContexts) { + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(input); + } + if (ts6.isTypeQueryNode(input)) { + checkEntityNameVisibility(input.exprName, enclosingDeclaration); + } + if (shouldEnterSuppressNewDiagnosticsContextContext) { + suppressNewDiagnosticContexts = true; + } + if (isProcessedComponent(input)) { + switch (input.kind) { + case 230: { + if (ts6.isEntityName(input.expression) || ts6.isEntityNameExpression(input.expression)) { + checkEntityNameVisibility(input.expression, enclosingDeclaration); + } + var node = ts6.visitEachChild(input, visitDeclarationSubtree, context); + return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); + } + case 180: { + checkEntityNameVisibility(input.typeName, enclosingDeclaration); + var node = ts6.visitEachChild(input, visitDeclarationSubtree, context); + return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); + } + case 177: + return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); + case 173: { + var ctor = factory.createConstructorDeclaration( + /*modifiers*/ + ensureModifiers(input), + updateParamsList( + input, + input.parameters, + 0 + /* ModifierFlags.None */ + ), + /*body*/ + void 0 + ); + return cleanup(ctor); + } + case 171: { + if (ts6.isPrivateIdentifier(input.name)) { + return cleanup( + /*returnValue*/ + void 0 + ); + } + var sig = factory.createMethodDeclaration( + ensureModifiers(input), + /*asteriskToken*/ + void 0, + input.name, + input.questionToken, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + /*body*/ + void 0 + ); + return cleanup(sig); + } + case 174: { + if (ts6.isPrivateIdentifier(input.name)) { + return cleanup( + /*returnValue*/ + void 0 + ); + } + var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input)); + return cleanup(factory.updateGetAccessorDeclaration( + input, + ensureModifiers(input), + input.name, + updateAccessorParamsList(input, ts6.hasEffectiveModifier( + input, + 8 + /* ModifierFlags.Private */ + )), + ensureType(input, accessorType), + /*body*/ + void 0 + )); + } + case 175: { + if (ts6.isPrivateIdentifier(input.name)) { + return cleanup( + /*returnValue*/ + void 0 + ); + } + return cleanup(factory.updateSetAccessorDeclaration( + input, + ensureModifiers(input), + input.name, + updateAccessorParamsList(input, ts6.hasEffectiveModifier( + input, + 8 + /* ModifierFlags.Private */ + )), + /*body*/ + void 0 + )); + } + case 169: + if (ts6.isPrivateIdentifier(input.name)) { + return cleanup( + /*returnValue*/ + void 0 + ); + } + return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); + case 168: + if (ts6.isPrivateIdentifier(input.name)) { + return cleanup( + /*returnValue*/ + void 0 + ); + } + return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); + case 170: { + if (ts6.isPrivateIdentifier(input.name)) { + return cleanup( + /*returnValue*/ + void 0 + ); + } + return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); + } + case 176: { + return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); + } + case 178: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts6.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ))); + } + case 257: { + if (ts6.isBindingPattern(input.name)) { + return recreateBindingPattern(input.name); + } + shouldEnterSuppressNewDiagnosticsContextContext = true; + suppressNewDiagnosticContexts = true; + return cleanup(factory.updateVariableDeclaration( + input, + input.name, + /*exclamationToken*/ + void 0, + ensureType(input, input.type), + ensureNoInitializer(input) + )); + } + case 165: { + if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { + return cleanup(factory.updateTypeParameterDeclaration( + input, + input.modifiers, + input.name, + /*constraint*/ + void 0, + /*defaultType*/ + void 0 + )); + } + return cleanup(ts6.visitEachChild(input, visitDeclarationSubtree, context)); + } + case 191: { + var checkType = ts6.visitNode(input.checkType, visitDeclarationSubtree); + var extendsType = ts6.visitNode(input.extendsType, visitDeclarationSubtree); + var oldEnclosingDecl = enclosingDeclaration; + enclosingDeclaration = input.trueType; + var trueType = ts6.visitNode(input.trueType, visitDeclarationSubtree); + enclosingDeclaration = oldEnclosingDecl; + var falseType = ts6.visitNode(input.falseType, visitDeclarationSubtree); + return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); + } + case 181: { + return cleanup(factory.updateFunctionTypeNode(input, ts6.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts6.visitNode(input.type, visitDeclarationSubtree))); + } + case 182: { + return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts6.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts6.visitNode(input.type, visitDeclarationSubtree))); + } + case 202: { + if (!ts6.isLiteralImportTypeNode(input)) + return cleanup(input); + return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts6.visitNodes(input.typeArguments, visitDeclarationSubtree, ts6.isTypeNode), input.isTypeOf)); + } + default: + ts6.Debug.assertNever(input, "Attempted to process unhandled node kind: ".concat(ts6.Debug.formatSyntaxKind(input.kind))); + } + } + if (ts6.isTupleTypeNode(input) && ts6.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts6.getLineAndCharacterOfPosition(currentSourceFile, input.end).line) { + ts6.setEmitFlags( + input, + 1 + /* EmitFlags.SingleLine */ + ); + } + return cleanup(ts6.visitEachChild(input, visitDeclarationSubtree, context)); + function cleanup(returnValue) { + if (returnValue && canProduceDiagnostic && ts6.hasDynamicName(input)) { + checkName(input); + } + if (isEnclosingDeclaration(input)) { + enclosingDeclaration = previousEnclosingDeclaration; + } + if (canProduceDiagnostic && !suppressNewDiagnosticContexts) { + getSymbolAccessibilityDiagnostic = oldDiag; + } + if (shouldEnterSuppressNewDiagnosticsContextContext) { + suppressNewDiagnosticContexts = oldWithinObjectLiteralType; + } + if (returnValue === input) { + return returnValue; + } + return returnValue && ts6.setOriginalNode(preserveJsDoc(returnValue, input), input); + } + } + function isPrivateMethodTypeParameter(node) { + return node.parent.kind === 171 && ts6.hasEffectiveModifier( + node.parent, + 8 + /* ModifierFlags.Private */ + ); + } + function visitDeclarationStatements(input) { + if (!isPreservedDeclarationStatement(input)) { + return; + } + if (shouldStripInternal(input)) + return; + switch (input.kind) { + case 275: { + if (ts6.isSourceFile(input.parent)) { + resultHasExternalModuleIndicator = true; + } + resultHasScopeMarker = true; + return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts6.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : void 0); + } + case 274: { + if (ts6.isSourceFile(input.parent)) { + resultHasExternalModuleIndicator = true; + } + resultHasScopeMarker = true; + if (input.expression.kind === 79) { + return input; + } else { + var newId = factory.createUniqueName( + "_default", + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ); + getSymbolAccessibilityDiagnostic = function() { + return { + diagnosticMessage: ts6.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, + errorNode: input + }; + }; + errorFallbackNode = input; + var varDecl = factory.createVariableDeclaration( + newId, + /*exclamationToken*/ + void 0, + resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), + /*initializer*/ + void 0 + ); + errorFallbackNode = void 0; + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier( + 136 + /* SyntaxKind.DeclareKeyword */ + )] : [], factory.createVariableDeclarationList( + [varDecl], + 2 + /* NodeFlags.Const */ + )); + preserveJsDoc(statement, input); + ts6.removeAllComments(input); + return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; + } + } + } + var result = transformTopLevelDeclaration(input); + lateStatementReplacementMap.set(ts6.getOriginalNodeId(input), result); + return input; + } + function stripExportModifiers(statement) { + if (ts6.isImportEqualsDeclaration(statement) || ts6.hasEffectiveModifier( + statement, + 1024 + /* ModifierFlags.Default */ + ) || !ts6.canHaveModifiers(statement)) { + return statement; + } + var modifiers = factory.createModifiersFromModifierFlags(ts6.getEffectiveModifierFlags(statement) & (258047 ^ 1)); + return factory.updateModifiers(statement, modifiers); + } + function transformTopLevelDeclaration(input) { + if (lateMarkedStatements) { + while (ts6.orderedRemoveItem(lateMarkedStatements, input)) + ; + } + if (shouldStripInternal(input)) + return; + switch (input.kind) { + case 268: { + return transformImportEqualsDeclaration(input); + } + case 269: { + return transformImportDeclaration(input); + } + } + if (ts6.isDeclaration(input) && isDeclarationAndNotVisible(input)) + return; + if (ts6.isFunctionLike(input) && resolver.isImplementationOfOverload(input)) + return; + var previousEnclosingDeclaration; + if (isEnclosingDeclaration(input)) { + previousEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = input; + } + var canProdiceDiagnostic = ts6.canProduceDiagnostics(input); + var oldDiag = getSymbolAccessibilityDiagnostic; + if (canProdiceDiagnostic) { + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(input); + } + var previousNeedsDeclare = needsDeclare; + switch (input.kind) { + case 262: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts6.visitNodes(input.typeParameters, visitDeclarationSubtree, ts6.isTypeParameterDeclaration), ts6.visitNode(input.type, visitDeclarationSubtree, ts6.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261: { + return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts6.visitNodes(input.members, visitDeclarationSubtree))); + } + case 259: { + var clean = cleanup(factory.updateFunctionDeclaration( + input, + ensureModifiers(input), + /*asteriskToken*/ + void 0, + input.name, + ensureTypeParams(input, input.typeParameters), + updateParamsList(input, input.parameters), + ensureType(input, input.type), + /*body*/ + void 0 + )); + if (clean && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) { + var props = resolver.getPropertiesOfContainerFunction(input); + var fakespace_1 = ts6.parseNodeFactory.createModuleDeclaration( + /*modifiers*/ + void 0, + clean.name || factory.createIdentifier("_default"), + factory.createModuleBlock([]), + 16 + /* NodeFlags.Namespace */ + ); + ts6.setParent(fakespace_1, enclosingDeclaration); + fakespace_1.locals = ts6.createSymbolTable(props); + fakespace_1.symbol = props[0].parent; + var exportMappings_1 = []; + var declarations = ts6.mapDefined(props, function(p) { + if (!p.valueDeclaration || !ts6.isPropertyAccessExpression(p.valueDeclaration)) { + return void 0; + } + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); + var type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace_1, declarationEmitNodeBuilderFlags, symbolTracker); + getSymbolAccessibilityDiagnostic = oldDiag; + var nameStr = ts6.unescapeLeadingUnderscores(p.escapedName); + var isNonContextualKeywordName = ts6.isStringANonContextualKeyword(nameStr); + var name = isNonContextualKeywordName ? factory.getGeneratedNameForNode(p.valueDeclaration) : factory.createIdentifier(nameStr); + if (isNonContextualKeywordName) { + exportMappings_1.push([name, nameStr]); + } + var varDecl2 = factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + type, + /*initializer*/ + void 0 + ); + return factory.createVariableStatement(isNonContextualKeywordName ? void 0 : [factory.createToken( + 93 + /* SyntaxKind.ExportKeyword */ + )], factory.createVariableDeclarationList([varDecl2])); + }); + if (!exportMappings_1.length) { + declarations = ts6.mapDefined(declarations, function(declaration) { + return factory.updateModifiers( + declaration, + 0 + /* ModifierFlags.None */ + ); + }); + } else { + declarations.push(factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + factory.createNamedExports(ts6.map(exportMappings_1, function(_a) { + var gen = _a[0], exp = _a[1]; + return factory.createExportSpecifier( + /*isTypeOnly*/ + false, + gen, + exp + ); + })) + )); + } + var namespaceDecl = factory.createModuleDeclaration( + ensureModifiers(input), + input.name, + factory.createModuleBlock(declarations), + 16 + /* NodeFlags.Namespace */ + ); + if (!ts6.hasEffectiveModifier( + clean, + 1024 + /* ModifierFlags.Default */ + )) { + return [clean, namespaceDecl]; + } + var modifiers = factory.createModifiersFromModifierFlags( + ts6.getEffectiveModifierFlags(clean) & ~1025 | 2 + /* ModifierFlags.Ambient */ + ); + var cleanDeclaration = factory.updateFunctionDeclaration( + clean, + modifiers, + /*asteriskToken*/ + void 0, + clean.name, + clean.typeParameters, + clean.parameters, + clean.type, + /*body*/ + void 0 + ); + var namespaceDeclaration = factory.updateModuleDeclaration(namespaceDecl, modifiers, namespaceDecl.name, namespaceDecl.body); + var exportDefaultDeclaration = factory.createExportAssignment( + /*modifiers*/ + void 0, + /*isExportEquals*/ + false, + namespaceDecl.name + ); + if (ts6.isSourceFile(input.parent)) { + resultHasExternalModuleIndicator = true; + } + resultHasScopeMarker = true; + return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration]; + } else { + return clean; + } + } + case 264: { + needsDeclare = false; + var inner = input.body; + if (inner && inner.kind === 265) { + var oldNeedsScopeFix = needsScopeFixMarker; + var oldHasScopeFix = resultHasScopeMarker; + resultHasScopeMarker = false; + needsScopeFixMarker = false; + var statements = ts6.visitNodes(inner.statements, visitDeclarationStatements); + var lateStatements = transformAndReplaceLatePaintedStatements(statements); + if (input.flags & 16777216) { + needsScopeFixMarker = false; + } + if (!ts6.isGlobalScopeAugmentation(input) && !hasScopeMarker(lateStatements) && !resultHasScopeMarker) { + if (needsScopeFixMarker) { + lateStatements = factory.createNodeArray(__spreadArray(__spreadArray([], lateStatements, true), [ts6.createEmptyExports(factory)], false)); + } else { + lateStatements = ts6.visitNodes(lateStatements, stripExportModifiers); + } + } + var body = factory.updateModuleBlock(inner, lateStatements); + needsDeclare = previousNeedsDeclare; + needsScopeFixMarker = oldNeedsScopeFix; + resultHasScopeMarker = oldHasScopeFix; + var mods = ensureModifiers(input); + return cleanup(factory.updateModuleDeclaration(input, mods, ts6.isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name, body)); + } else { + needsDeclare = previousNeedsDeclare; + var mods = ensureModifiers(input); + needsDeclare = false; + ts6.visitNode(inner, visitDeclarationStatements); + var id = ts6.getOriginalNodeId(inner); + var body = lateStatementReplacementMap.get(id); + lateStatementReplacementMap.delete(id); + return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); + } + } + case 260: { + errorNameNode = input.name; + errorFallbackNode = input; + var modifiers = factory.createNodeArray(ensureModifiers(input)); + var typeParameters = ensureTypeParams(input, input.typeParameters); + var ctor = ts6.getFirstConstructorWithBody(input); + var parameterProperties = void 0; + if (ctor) { + var oldDiag_1 = getSymbolAccessibilityDiagnostic; + parameterProperties = ts6.compact(ts6.flatMap(ctor.parameters, function(param) { + if (!ts6.hasSyntacticModifier( + param, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + ) || shouldStripInternal(param)) + return; + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(param); + if (param.name.kind === 79) { + return preserveJsDoc(factory.createPropertyDeclaration(ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param); + } else { + return walkBindingPattern(param.name); + } + function walkBindingPattern(pattern) { + var elems; + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var elem = _a[_i]; + if (ts6.isOmittedExpression(elem)) + continue; + if (ts6.isBindingPattern(elem.name)) { + elems = ts6.concatenate(elems, walkBindingPattern(elem.name)); + } + elems = elems || []; + elems.push(factory.createPropertyDeclaration( + ensureModifiers(param), + elem.name, + /*questionToken*/ + void 0, + ensureType( + elem, + /*type*/ + void 0 + ), + /*initializer*/ + void 0 + )); + } + return elems; + } + })); + getSymbolAccessibilityDiagnostic = oldDiag_1; + } + var hasPrivateIdentifier = ts6.some(input.members, function(member) { + return !!member.name && ts6.isPrivateIdentifier(member.name); + }); + var privateIdentifier = hasPrivateIdentifier ? [ + factory.createPropertyDeclaration( + /*modifiers*/ + void 0, + factory.createPrivateIdentifier("#private"), + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ) + ] : void 0; + var memberNodes = ts6.concatenate(ts6.concatenate(privateIdentifier, parameterProperties), ts6.visitNodes(input.members, visitDeclarationSubtree)); + var members = factory.createNodeArray(memberNodes); + var extendsClause_1 = ts6.getEffectiveBaseTypeNode(input); + if (extendsClause_1 && !ts6.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 104) { + var oldId = input.name ? ts6.unescapeLeadingUnderscores(input.name.escapedText) : "default"; + var newId_1 = factory.createUniqueName( + "".concat(oldId, "_base"), + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ); + getSymbolAccessibilityDiagnostic = function() { + return { + diagnosticMessage: ts6.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, + errorNode: extendsClause_1, + typeName: input.name + }; + }; + var varDecl = factory.createVariableDeclaration( + newId_1, + /*exclamationToken*/ + void 0, + resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), + /*initializer*/ + void 0 + ); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier( + 136 + /* SyntaxKind.DeclareKeyword */ + )] : [], factory.createVariableDeclarationList( + [varDecl], + 2 + /* NodeFlags.Const */ + )); + var heritageClauses = factory.createNodeArray(ts6.map(input.heritageClauses, function(clause) { + if (clause.token === 94) { + var oldDiag_2 = getSymbolAccessibilityDiagnostic; + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]); + var newClause = factory.updateHeritageClause(clause, ts6.map(clause.types, function(t) { + return factory.updateExpressionWithTypeArguments(t, newId_1, ts6.visitNodes(t.typeArguments, visitDeclarationSubtree)); + })); + getSymbolAccessibilityDiagnostic = oldDiag_2; + return newClause; + } + return factory.updateHeritageClause(clause, ts6.visitNodes(factory.createNodeArray(ts6.filter(clause.types, function(t) { + return ts6.isEntityNameExpression(t.expression) || t.expression.kind === 104; + })), visitDeclarationSubtree)); + })); + return [statement, cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members))]; + } else { + var heritageClauses = transformHeritageClauses(input.heritageClauses); + return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); + } + } + case 240: { + return cleanup(transformVariableStatement(input)); + } + case 263: { + return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts6.mapDefined(input.members, function(m) { + if (shouldStripInternal(m)) + return; + var constValue = resolver.getConstantValue(m); + return preserveJsDoc(factory.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory.createStringLiteral(constValue) : factory.createNumericLiteral(constValue) : void 0), m); + })))); + } + } + return ts6.Debug.assertNever(input, "Unhandled top-level node in declaration emit: ".concat(ts6.Debug.formatSyntaxKind(input.kind))); + function cleanup(node) { + if (isEnclosingDeclaration(input)) { + enclosingDeclaration = previousEnclosingDeclaration; + } + if (canProdiceDiagnostic) { + getSymbolAccessibilityDiagnostic = oldDiag; + } + if (input.kind === 264) { + needsDeclare = previousNeedsDeclare; + } + if (node === input) { + return node; + } + errorFallbackNode = void 0; + errorNameNode = void 0; + return node && ts6.setOriginalNode(preserveJsDoc(node, input), input); + } + } + function transformVariableStatement(input) { + if (!ts6.forEach(input.declarationList.declarations, getBindingNameVisible)) + return; + var nodes = ts6.visitNodes(input.declarationList.declarations, visitDeclarationSubtree); + if (!ts6.length(nodes)) + return; + return factory.updateVariableStatement(input, factory.createNodeArray(ensureModifiers(input)), factory.updateVariableDeclarationList(input.declarationList, nodes)); + } + function recreateBindingPattern(d) { + return ts6.flatten(ts6.mapDefined(d.elements, function(e) { + return recreateBindingElement(e); + })); + } + function recreateBindingElement(e) { + if (e.kind === 229) { + return; + } + if (e.name) { + if (!getBindingNameVisible(e)) + return; + if (ts6.isBindingPattern(e.name)) { + return recreateBindingPattern(e.name); + } else { + return factory.createVariableDeclaration( + e.name, + /*exclamationToken*/ + void 0, + ensureType( + e, + /*type*/ + void 0 + ), + /*initializer*/ + void 0 + ); + } + } + } + function checkName(node) { + var oldDiag; + if (!suppressNewDiagnosticContexts) { + oldDiag = getSymbolAccessibilityDiagnostic; + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNodeName(node); + } + errorNameNode = node.name; + ts6.Debug.assert(resolver.isLateBound(ts6.getParseTreeNode(node))); + var decl = node; + var entityName = decl.name.expression; + checkEntityNameVisibility(entityName, enclosingDeclaration); + if (!suppressNewDiagnosticContexts) { + getSymbolAccessibilityDiagnostic = oldDiag; + } + errorNameNode = void 0; + } + function shouldStripInternal(node) { + return !!stripInternal && !!node && isInternalDeclaration(node, currentSourceFile); + } + function isScopeMarker(node) { + return ts6.isExportAssignment(node) || ts6.isExportDeclaration(node); + } + function hasScopeMarker(statements) { + return ts6.some(statements, isScopeMarker); + } + function ensureModifiers(node) { + var currentFlags = ts6.getEffectiveModifierFlags(node); + var newFlags = ensureModifierFlags(node); + if (currentFlags === newFlags) { + return ts6.visitArray(node.modifiers, function(n) { + return ts6.tryCast(n, ts6.isModifier); + }, ts6.isModifier); + } + return factory.createModifiersFromModifierFlags(newFlags); + } + function ensureModifierFlags(node) { + var mask = 258047 ^ (4 | 512 | 16384); + var additions = needsDeclare && !isAlwaysType(node) ? 2 : 0; + var parentIsFile = node.parent.kind === 308; + if (!parentIsFile || isBundledEmit && parentIsFile && ts6.isExternalModule(node.parent)) { + mask ^= 2; + additions = 0; + } + return maskModifierFlags(node, mask, additions); + } + function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) { + var accessorType = getTypeAnnotationFromAccessor(node); + if (!accessorType && node !== accessors.firstAccessor) { + accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor); + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor); + } + if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) { + accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor); + getSymbolAccessibilityDiagnostic = ts6.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor); + } + return accessorType; + } + function transformHeritageClauses(nodes) { + return factory.createNodeArray(ts6.filter(ts6.map(nodes, function(clause) { + return factory.updateHeritageClause(clause, ts6.visitNodes(factory.createNodeArray(ts6.filter(clause.types, function(t) { + return ts6.isEntityNameExpression(t.expression) || clause.token === 94 && t.expression.kind === 104; + })), visitDeclarationSubtree)); + }), function(clause) { + return clause.types && !!clause.types.length; + })); + } + } + ts6.transformDeclarations = transformDeclarations; + function isAlwaysType(node) { + if (node.kind === 261) { + return true; + } + return false; + } + function maskModifiers(node, modifierMask, modifierAdditions) { + return ts6.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); + } + function maskModifierFlags(node, modifierMask, modifierAdditions) { + if (modifierMask === void 0) { + modifierMask = 258047 ^ 4; + } + if (modifierAdditions === void 0) { + modifierAdditions = 0; + } + var flags = ts6.getEffectiveModifierFlags(node) & modifierMask | modifierAdditions; + if (flags & 1024 && !(flags & 1)) { + flags ^= 1; + } + if (flags & 1024 && flags & 2) { + flags ^= 2; + } + return flags; + } + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 174 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : void 0; + } + } + function canHaveLiteralInitializer(node) { + switch (node.kind) { + case 169: + case 168: + return !ts6.hasEffectiveModifier( + node, + 8 + /* ModifierFlags.Private */ + ); + case 166: + case 257: + return true; + } + return false; + } + function isPreservedDeclarationStatement(node) { + switch (node.kind) { + case 259: + case 264: + case 268: + case 261: + case 260: + case 262: + case 263: + case 240: + case 269: + case 275: + case 274: + return true; + } + return false; + } + function isProcessedComponent(node) { + switch (node.kind) { + case 177: + case 173: + case 171: + case 174: + case 175: + case 169: + case 168: + case 170: + case 176: + case 178: + case 257: + case 165: + case 230: + case 180: + case 191: + case 181: + case 182: + case 202: + return true; + } + return false; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts6.ModuleKind.ESNext: + case ts6.ModuleKind.ES2022: + case ts6.ModuleKind.ES2020: + case ts6.ModuleKind.ES2015: + return ts6.transformECMAScriptModule; + case ts6.ModuleKind.System: + return ts6.transformSystemModule; + case ts6.ModuleKind.Node16: + case ts6.ModuleKind.NodeNext: + return ts6.transformNodeModule; + default: + return ts6.transformModule; + } + } + var TransformationState; + (function(TransformationState2) { + TransformationState2[TransformationState2["Uninitialized"] = 0] = "Uninitialized"; + TransformationState2[TransformationState2["Initialized"] = 1] = "Initialized"; + TransformationState2[TransformationState2["Completed"] = 2] = "Completed"; + TransformationState2[TransformationState2["Disposed"] = 3] = "Disposed"; + })(TransformationState || (TransformationState = {})); + var SyntaxKindFeatureFlags; + (function(SyntaxKindFeatureFlags2) { + SyntaxKindFeatureFlags2[SyntaxKindFeatureFlags2["Substitution"] = 1] = "Substitution"; + SyntaxKindFeatureFlags2[SyntaxKindFeatureFlags2["EmitNotifications"] = 2] = "EmitNotifications"; + })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); + ts6.noTransformers = { scriptTransformers: ts6.emptyArray, declarationTransformers: ts6.emptyArray }; + function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) { + return { + scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles), + declarationTransformers: getDeclarationTransformers(customTransformers) + }; + } + ts6.getTransformers = getTransformers; + function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) { + if (emitOnlyDtsFiles) + return ts6.emptyArray; + var languageVersion = ts6.getEmitScriptTarget(compilerOptions); + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + var transformers = []; + ts6.addRange(transformers, customTransformers && ts6.map(customTransformers.before, wrapScriptTransformerFactory)); + transformers.push(ts6.transformTypeScript); + transformers.push(ts6.transformLegacyDecorators); + transformers.push(ts6.transformClassFields); + if (ts6.getJSXTransformEnabled(compilerOptions)) { + transformers.push(ts6.transformJsx); + } + if (languageVersion < 99) { + transformers.push(ts6.transformESNext); + } + if (languageVersion < 8) { + transformers.push(ts6.transformES2021); + } + if (languageVersion < 7) { + transformers.push(ts6.transformES2020); + } + if (languageVersion < 6) { + transformers.push(ts6.transformES2019); + } + if (languageVersion < 5) { + transformers.push(ts6.transformES2018); + } + if (languageVersion < 4) { + transformers.push(ts6.transformES2017); + } + if (languageVersion < 3) { + transformers.push(ts6.transformES2016); + } + if (languageVersion < 2) { + transformers.push(ts6.transformES2015); + transformers.push(ts6.transformGenerators); + } + transformers.push(getModuleTransformer(moduleKind)); + if (languageVersion < 1) { + transformers.push(ts6.transformES5); + } + ts6.addRange(transformers, customTransformers && ts6.map(customTransformers.after, wrapScriptTransformerFactory)); + return transformers; + } + function getDeclarationTransformers(customTransformers) { + var transformers = []; + transformers.push(ts6.transformDeclarations); + ts6.addRange(transformers, customTransformers && ts6.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory)); + return transformers; + } + function wrapCustomTransformer(transformer) { + return function(node) { + return ts6.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); + }; + } + function wrapCustomTransformerFactory(transformer, handleDefault) { + return function(context) { + var customTransformer = transformer(context); + return typeof customTransformer === "function" ? handleDefault(context, customTransformer) : wrapCustomTransformer(customTransformer); + }; + } + function wrapScriptTransformerFactory(transformer) { + return wrapCustomTransformerFactory(transformer, ts6.chainBundle); + } + function wrapDeclarationTransformerFactory(transformer) { + return wrapCustomTransformerFactory(transformer, function(_, node) { + return node; + }); + } + function noEmitSubstitution(_hint, node) { + return node; + } + ts6.noEmitSubstitution = noEmitSubstitution; + function noEmitNotification(hint, node, callback) { + callback(hint, node); + } + ts6.noEmitNotification = noEmitNotification; + function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { + var enabledSyntaxKindFeatures = new Array( + 358 + /* SyntaxKind.Count */ + ); + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; + var lexicalEnvironmentStatements; + var lexicalEnvironmentFlags = 0; + var lexicalEnvironmentVariableDeclarationsStack = []; + var lexicalEnvironmentFunctionDeclarationsStack = []; + var lexicalEnvironmentStatementsStack = []; + var lexicalEnvironmentFlagsStack = []; + var lexicalEnvironmentStackOffset = 0; + var lexicalEnvironmentSuspended = false; + var blockScopedVariableDeclarationsStack = []; + var blockScopeStackOffset = 0; + var blockScopedVariableDeclarations; + var emitHelpers; + var onSubstituteNode = noEmitSubstitution; + var onEmitNode = noEmitNotification; + var state = 0; + var diagnostics = []; + var context = { + factory, + getCompilerOptions: function() { + return options; + }, + getEmitResolver: function() { + return resolver; + }, + getEmitHost: function() { + return host; + }, + getEmitHelperFactory: ts6.memoize(function() { + return ts6.createEmitHelperFactory(context); + }), + startLexicalEnvironment, + suspendLexicalEnvironment, + resumeLexicalEnvironment, + endLexicalEnvironment, + setLexicalEnvironmentFlags, + getLexicalEnvironmentFlags, + hoistVariableDeclaration, + hoistFunctionDeclaration, + addInitializationStatement, + startBlockScope, + endBlockScope, + addBlockScopedVariable, + requestEmitHelper, + readEmitHelpers, + enableSubstitution, + enableEmitNotification, + isSubstitutionEnabled, + isEmitNotificationEnabled, + get onSubstituteNode() { + return onSubstituteNode; + }, + set onSubstituteNode(value) { + ts6.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts6.Debug.assert(value !== void 0, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { + return onEmitNode; + }, + set onEmitNode(value) { + ts6.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts6.Debug.assert(value !== void 0, "Value must not be 'undefined'"); + onEmitNode = value; + }, + addDiagnostic: function(diag) { + diagnostics.push(diag); + } + }; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + ts6.disposeEmitNodes(ts6.getSourceFileOfNode(ts6.getParseTreeNode(node))); + } + ts6.performance.mark("beforeTransform"); + var transformersWithContext = transformers.map(function(t) { + return t(context); + }); + var transformation = function(node2) { + for (var _i2 = 0, transformersWithContext_1 = transformersWithContext; _i2 < transformersWithContext_1.length; _i2++) { + var transform = transformersWithContext_1[_i2]; + node2 = transform(node2); + } + return node2; + }; + state = 1; + var transformed = []; + for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { + var node = nodes_3[_a]; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("emit", "transformNodes", node.kind === 308 ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + state = 2; + ts6.performance.mark("afterTransform"); + ts6.performance.measure("transformTime", "beforeTransform", "afterTransform"); + return { + transformed, + substituteNode, + emitNodeWithNotification, + isEmitNotificationEnabled, + dispose, + diagnostics + }; + function transformRoot(node2) { + return node2 && (!ts6.isSourceFile(node2) || !node2.isDeclarationFile) ? transformation(node2) : node2; + } + function enableSubstitution(kind) { + ts6.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); + enabledSyntaxKindFeatures[kind] |= 1; + } + function isSubstitutionEnabled(node2) { + return (enabledSyntaxKindFeatures[node2.kind] & 1) !== 0 && (ts6.getEmitFlags(node2) & 4) === 0; + } + function substituteNode(hint, node2) { + ts6.Debug.assert(state < 3, "Cannot substitute a node after the result is disposed."); + return node2 && isSubstitutionEnabled(node2) && onSubstituteNode(hint, node2) || node2; + } + function enableEmitNotification(kind) { + ts6.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); + enabledSyntaxKindFeatures[kind] |= 2; + } + function isEmitNotificationEnabled(node2) { + return (enabledSyntaxKindFeatures[node2.kind] & 2) !== 0 || (ts6.getEmitFlags(node2) & 2) !== 0; + } + function emitNodeWithNotification(hint, node2, emitCallback) { + ts6.Debug.assert(state < 3, "Cannot invoke TransformationResult callbacks after the result is disposed."); + if (node2) { + if (isEmitNotificationEnabled(node2)) { + onEmitNode(hint, node2, emitCallback); + } else { + emitCallback(hint, node2); + } + } + } + function hoistVariableDeclaration(name) { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + var decl = ts6.setEmitFlags( + factory.createVariableDeclaration(name), + 64 + /* EmitFlags.NoNestedSourceMaps */ + ); + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; + } else { + lexicalEnvironmentVariableDeclarations.push(decl); + } + if (lexicalEnvironmentFlags & 1) { + lexicalEnvironmentFlags |= 2; + } + } + function hoistFunctionDeclaration(func) { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + ts6.setEmitFlags( + func, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; + } else { + lexicalEnvironmentFunctionDeclarations.push(func); + } + } + function addInitializationStatement(node2) { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + ts6.setEmitFlags( + node2, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + if (!lexicalEnvironmentStatements) { + lexicalEnvironmentStatements = [node2]; + } else { + lexicalEnvironmentStatements.push(node2); + } + } + function startLexicalEnvironment() { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + ts6.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); + lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; + lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentStatements; + lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFlags; + lexicalEnvironmentStackOffset++; + lexicalEnvironmentVariableDeclarations = void 0; + lexicalEnvironmentFunctionDeclarations = void 0; + lexicalEnvironmentStatements = void 0; + lexicalEnvironmentFlags = 0; + } + function suspendLexicalEnvironment() { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + ts6.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); + lexicalEnvironmentSuspended = true; + } + function resumeLexicalEnvironment() { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + ts6.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); + lexicalEnvironmentSuspended = false; + } + function endLexicalEnvironment() { + ts6.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); + ts6.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); + var statements; + if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations || lexicalEnvironmentStatements) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = __spreadArray([], lexicalEnvironmentFunctionDeclarations, true); + } + if (lexicalEnvironmentVariableDeclarations) { + var statement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations) + ); + ts6.setEmitFlags( + statement, + 1048576 + /* EmitFlags.CustomPrologue */ + ); + if (!statements) { + statements = [statement]; + } else { + statements.push(statement); + } + } + if (lexicalEnvironmentStatements) { + if (!statements) { + statements = __spreadArray([], lexicalEnvironmentStatements, true); + } else { + statements = __spreadArray(__spreadArray([], statements, true), lexicalEnvironmentStatements, true); + } + } + } + lexicalEnvironmentStackOffset--; + lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentStatements = lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset]; + lexicalEnvironmentFlags = lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset]; + if (lexicalEnvironmentStackOffset === 0) { + lexicalEnvironmentVariableDeclarationsStack = []; + lexicalEnvironmentFunctionDeclarationsStack = []; + lexicalEnvironmentStatementsStack = []; + lexicalEnvironmentFlagsStack = []; + } + return statements; + } + function setLexicalEnvironmentFlags(flags, value) { + lexicalEnvironmentFlags = value ? lexicalEnvironmentFlags | flags : lexicalEnvironmentFlags & ~flags; + } + function getLexicalEnvironmentFlags() { + return lexicalEnvironmentFlags; + } + function startBlockScope() { + ts6.Debug.assert(state > 0, "Cannot start a block scope during initialization."); + ts6.Debug.assert(state < 2, "Cannot start a block scope after transformation has completed."); + blockScopedVariableDeclarationsStack[blockScopeStackOffset] = blockScopedVariableDeclarations; + blockScopeStackOffset++; + blockScopedVariableDeclarations = void 0; + } + function endBlockScope() { + ts6.Debug.assert(state > 0, "Cannot end a block scope during initialization."); + ts6.Debug.assert(state < 2, "Cannot end a block scope after transformation has completed."); + var statements = ts6.some(blockScopedVariableDeclarations) ? [ + factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + blockScopedVariableDeclarations.map(function(identifier) { + return factory.createVariableDeclaration(identifier); + }), + 1 + /* NodeFlags.Let */ + ) + ) + ] : void 0; + blockScopeStackOffset--; + blockScopedVariableDeclarations = blockScopedVariableDeclarationsStack[blockScopeStackOffset]; + if (blockScopeStackOffset === 0) { + blockScopedVariableDeclarationsStack = []; + } + return statements; + } + function addBlockScopedVariable(name) { + ts6.Debug.assert(blockScopeStackOffset > 0, "Cannot add a block scoped variable outside of an iteration body."); + (blockScopedVariableDeclarations || (blockScopedVariableDeclarations = [])).push(name); + } + function requestEmitHelper(helper) { + ts6.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); + ts6.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); + if (helper.dependencies) { + for (var _i2 = 0, _a2 = helper.dependencies; _i2 < _a2.length; _i2++) { + var h = _a2[_i2]; + requestEmitHelper(h); + } + } + emitHelpers = ts6.append(emitHelpers, helper); + } + function readEmitHelpers() { + ts6.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts6.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); + var helpers = emitHelpers; + emitHelpers = void 0; + return helpers; + } + function dispose() { + if (state < 3) { + for (var _i2 = 0, nodes_4 = nodes; _i2 < nodes_4.length; _i2++) { + var node2 = nodes_4[_i2]; + ts6.disposeEmitNodes(ts6.getSourceFileOfNode(ts6.getParseTreeNode(node2))); + } + lexicalEnvironmentVariableDeclarations = void 0; + lexicalEnvironmentVariableDeclarationsStack = void 0; + lexicalEnvironmentFunctionDeclarations = void 0; + lexicalEnvironmentFunctionDeclarationsStack = void 0; + onSubstituteNode = void 0; + onEmitNode = void 0; + emitHelpers = void 0; + state = 3; + } + } + } + ts6.transformNodes = transformNodes; + ts6.nullTransformationContext = { + factory: ts6.factory, + getCompilerOptions: function() { + return {}; + }, + getEmitResolver: ts6.notImplemented, + getEmitHost: ts6.notImplemented, + getEmitHelperFactory: ts6.notImplemented, + startLexicalEnvironment: ts6.noop, + resumeLexicalEnvironment: ts6.noop, + suspendLexicalEnvironment: ts6.noop, + endLexicalEnvironment: ts6.returnUndefined, + setLexicalEnvironmentFlags: ts6.noop, + getLexicalEnvironmentFlags: function() { + return 0; + }, + hoistVariableDeclaration: ts6.noop, + hoistFunctionDeclaration: ts6.noop, + addInitializationStatement: ts6.noop, + startBlockScope: ts6.noop, + endBlockScope: ts6.returnUndefined, + addBlockScopedVariable: ts6.noop, + requestEmitHelper: ts6.noop, + readEmitHelpers: ts6.notImplemented, + enableSubstitution: ts6.noop, + enableEmitNotification: ts6.noop, + isSubstitutionEnabled: ts6.notImplemented, + isEmitNotificationEnabled: ts6.notImplemented, + onSubstituteNode: noEmitSubstitution, + onEmitNode: noEmitNotification, + addDiagnostic: ts6.noop + }; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var brackets = createBracketsMap(); + function isBuildInfoFile(file) { + return ts6.fileExtensionIs( + file, + ".tsbuildinfo" + /* Extension.TsBuildInfo */ + ); + } + ts6.isBuildInfoFile = isBuildInfoFile; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) { + if (forceDtsEmit === void 0) { + forceDtsEmit = false; + } + var sourceFiles = ts6.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts6.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit); + var options = host.getCompilerOptions(); + if (ts6.outFile(options)) { + var prepends = host.getPrependNodes(); + if (sourceFiles.length || prepends.length) { + var bundle = ts6.factory.createBundle(sourceFiles, prepends); + var result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle); + if (result) { + return result; + } + } + } else { + if (!onlyBuildInfo) { + for (var _a = 0, sourceFiles_1 = sourceFiles; _a < sourceFiles_1.length; _a++) { + var sourceFile = sourceFiles_1[_a]; + var result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile); + if (result) { + return result; + } + } + } + if (includeBuildInfo) { + var buildInfoPath = getTsBuildInfoEmitOutputFilePath(options); + if (buildInfoPath) + return action( + { buildInfoPath }, + /*sourceFileOrBundle*/ + void 0 + ); + } + } + } + ts6.forEachEmittedFile = forEachEmittedFile; + function getTsBuildInfoEmitOutputFilePath(options) { + var configFile = options.configFilePath; + if (!ts6.isIncrementalCompilation(options)) + return void 0; + if (options.tsBuildInfoFile) + return options.tsBuildInfoFile; + var outPath = ts6.outFile(options); + var buildInfoExtensionLess; + if (outPath) { + buildInfoExtensionLess = ts6.removeFileExtension(outPath); + } else { + if (!configFile) + return void 0; + var configFileExtensionLess = ts6.removeFileExtension(configFile); + buildInfoExtensionLess = options.outDir ? options.rootDir ? ts6.resolvePath(options.outDir, ts6.getRelativePathFromDirectory( + options.rootDir, + configFileExtensionLess, + /*ignoreCase*/ + true + )) : ts6.combinePaths(options.outDir, ts6.getBaseFileName(configFileExtensionLess)) : configFileExtensionLess; + } + return buildInfoExtensionLess + ".tsbuildinfo"; + } + ts6.getTsBuildInfoEmitOutputFilePath = getTsBuildInfoEmitOutputFilePath; + function getOutputPathsForBundle(options, forceDtsPaths) { + var outPath = ts6.outFile(options); + var jsFilePath = options.emitDeclarationOnly ? void 0 : outPath; + var sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = forceDtsPaths || ts6.getEmitDeclarations(options) ? ts6.removeFileExtension(outPath) + ".d.ts" : void 0; + var declarationMapPath = declarationFilePath && ts6.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0; + var buildInfoPath = getTsBuildInfoEmitOutputFilePath(options); + return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath }; + } + ts6.getOutputPathsForBundle = getOutputPathsForBundle; + function getOutputPathsFor(sourceFile, host, forceDtsPaths) { + var options = host.getCompilerOptions(); + if (sourceFile.kind === 309) { + return getOutputPathsForBundle(options, forceDtsPaths); + } else { + var ownOutputFilePath = ts6.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options)); + var isJsonFile = ts6.isJsonSourceFile(sourceFile); + var isJsonEmittedToSameLocation = isJsonFile && ts6.comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0; + var jsFilePath = options.emitDeclarationOnly || isJsonEmittedToSameLocation ? void 0 : ownOutputFilePath; + var sourceMapFilePath = !jsFilePath || ts6.isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = forceDtsPaths || ts6.getEmitDeclarations(options) && !isJsonFile ? ts6.getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0; + var declarationMapPath = declarationFilePath && ts6.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0; + return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath: void 0 }; + } + } + ts6.getOutputPathsFor = getOutputPathsFor; + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap && !options.inlineSourceMap ? jsFilePath + ".map" : void 0; + } + function getOutputExtension(fileName, options) { + return ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + ) ? ".json" : options.jsx === 1 && ts6.fileExtensionIsOneOf(fileName, [ + ".jsx", + ".tsx" + /* Extension.Tsx */ + ]) ? ".jsx" : ts6.fileExtensionIsOneOf(fileName, [ + ".mts", + ".mjs" + /* Extension.Mjs */ + ]) ? ".mjs" : ts6.fileExtensionIsOneOf(fileName, [ + ".cts", + ".cjs" + /* Extension.Cjs */ + ]) ? ".cjs" : ".js"; + } + ts6.getOutputExtension = getOutputExtension; + function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory2) { + return outputDir ? ts6.resolvePath(outputDir, ts6.getRelativePathFromDirectory(getCommonSourceDirectory2 ? getCommonSourceDirectory2() : getCommonSourceDirectoryOfConfig(configFile, ignoreCase), inputFileName, ignoreCase)) : inputFileName; + } + function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) { + return ts6.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory2), ts6.getDeclarationEmitExtensionForPath(inputFileName)); + } + ts6.getOutputDeclarationFileName = getOutputDeclarationFileName; + function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) { + if (configFile.options.emitDeclarationOnly) + return void 0; + var isJsonFile = ts6.fileExtensionIs( + inputFileName, + ".json" + /* Extension.Json */ + ); + var outputFileName = ts6.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory2), getOutputExtension(inputFileName, configFile.options)); + return !isJsonFile || ts6.comparePaths(inputFileName, outputFileName, ts6.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 ? outputFileName : void 0; + } + function createAddOutput() { + var outputs; + return { addOutput, getOutputs }; + function addOutput(path) { + if (path) { + (outputs || (outputs = [])).push(path); + } + } + function getOutputs() { + return outputs || ts6.emptyArray; + } + } + function getSingleOutputFileNames(configFile, addOutput) { + var _a = getOutputPathsForBundle( + configFile.options, + /*forceDtsPaths*/ + false + ), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath; + addOutput(jsFilePath); + addOutput(sourceMapFilePath); + addOutput(declarationFilePath); + addOutput(declarationMapPath); + addOutput(buildInfoPath); + } + function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) { + if (ts6.isDeclarationFileName(inputFileName)) + return; + var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2); + addOutput(js); + if (ts6.fileExtensionIs( + inputFileName, + ".json" + /* Extension.Json */ + )) + return; + if (js && configFile.options.sourceMap) { + addOutput("".concat(js, ".map")); + } + if (ts6.getEmitDeclarations(configFile.options)) { + var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2); + addOutput(dts); + if (configFile.options.declarationMap) { + addOutput("".concat(dts, ".map")); + } + } + } + function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCanonicalFileName, checkSourceFilesBelongToPath) { + var commonSourceDirectory; + if (options.rootDir) { + commonSourceDirectory = ts6.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + checkSourceFilesBelongToPath === null || checkSourceFilesBelongToPath === void 0 ? void 0 : checkSourceFilesBelongToPath(options.rootDir); + } else if (options.composite && options.configFilePath) { + commonSourceDirectory = ts6.getDirectoryPath(ts6.normalizeSlashes(options.configFilePath)); + checkSourceFilesBelongToPath === null || checkSourceFilesBelongToPath === void 0 ? void 0 : checkSourceFilesBelongToPath(commonSourceDirectory); + } else { + commonSourceDirectory = ts6.computeCommonSourceDirectoryOfFilenames(emittedFiles(), currentDirectory, getCanonicalFileName); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts6.directorySeparator) { + commonSourceDirectory += ts6.directorySeparator; + } + return commonSourceDirectory; + } + ts6.getCommonSourceDirectory = getCommonSourceDirectory; + function getCommonSourceDirectoryOfConfig(_a, ignoreCase) { + var options = _a.options, fileNames = _a.fileNames; + return getCommonSourceDirectory(options, function() { + return ts6.filter(fileNames, function(file) { + return !(options.noEmitForJsFiles && ts6.fileExtensionIsOneOf(file, ts6.supportedJSExtensionsFlat)) && !ts6.isDeclarationFileName(file); + }); + }, ts6.getDirectoryPath(ts6.normalizeSlashes(ts6.Debug.checkDefined(options.configFilePath))), ts6.createGetCanonicalFileName(!ignoreCase)); + } + ts6.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig; + function getAllProjectOutputs(configFile, ignoreCase) { + var _a = createAddOutput(), addOutput = _a.addOutput, getOutputs = _a.getOutputs; + if (ts6.outFile(configFile.options)) { + getSingleOutputFileNames(configFile, addOutput); + } else { + var getCommonSourceDirectory_1 = ts6.memoize(function() { + return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); + }); + for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) { + var inputFileName = _c[_b]; + getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory_1); + } + addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options)); + } + return getOutputs(); + } + ts6.getAllProjectOutputs = getAllProjectOutputs; + function getOutputFileNames(commandLine, inputFileName, ignoreCase) { + inputFileName = ts6.normalizePath(inputFileName); + ts6.Debug.assert(ts6.contains(commandLine.fileNames, inputFileName), "Expected fileName to be present in command line"); + var _a = createAddOutput(), addOutput = _a.addOutput, getOutputs = _a.getOutputs; + if (ts6.outFile(commandLine.options)) { + getSingleOutputFileNames(commandLine, addOutput); + } else { + getOwnOutputFileNames(commandLine, inputFileName, ignoreCase, addOutput); + } + return getOutputs(); + } + ts6.getOutputFileNames = getOutputFileNames; + function getFirstProjectOutput(configFile, ignoreCase) { + if (ts6.outFile(configFile.options)) { + var jsFilePath = getOutputPathsForBundle( + configFile.options, + /*forceDtsPaths*/ + false + ).jsFilePath; + return ts6.Debug.checkDefined(jsFilePath, "project ".concat(configFile.options.configFilePath, " expected to have at least one output")); + } + var getCommonSourceDirectory2 = ts6.memoize(function() { + return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); + }); + for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) { + var inputFileName = _b[_a]; + if (ts6.isDeclarationFileName(inputFileName)) + continue; + var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2); + if (jsFilePath) + return jsFilePath; + if (ts6.fileExtensionIs( + inputFileName, + ".json" + /* Extension.Json */ + )) + continue; + if (ts6.getEmitDeclarations(configFile.options)) { + return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2); + } + } + var buildInfoPath = getTsBuildInfoEmitOutputFilePath(configFile.options); + if (buildInfoPath) + return buildInfoPath; + return ts6.Debug.fail("project ".concat(configFile.options.configFilePath, " expected to have at least one output")); + } + ts6.getFirstProjectOutput = getFirstProjectOutput; + function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo, forceDtsEmit) { + var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers; + var compilerOptions = host.getCompilerOptions(); + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts6.getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0; + var emitterDiagnostics = ts6.createDiagnosticCollection(); + var newLine = ts6.getNewLineCharacter(compilerOptions, function() { + return host.getNewLine(); + }); + var writer = ts6.createTextWriter(newLine); + var _b = ts6.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit; + var bundleBuildInfo; + var emitSkipped = false; + enter(); + forEachEmittedFile(host, emitSourceFileOrBundle, ts6.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile); + exit(); + return { + emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, + sourceMaps: sourceMapDataList + }; + function emitSourceFileOrBundle(_a2, sourceFileOrBundle) { + var jsFilePath = _a2.jsFilePath, sourceMapFilePath = _a2.sourceMapFilePath, declarationFilePath = _a2.declarationFilePath, declarationMapPath = _a2.declarationMapPath, buildInfoPath = _a2.buildInfoPath; + var buildInfoDirectory; + if (buildInfoPath && sourceFileOrBundle && ts6.isBundle(sourceFileOrBundle)) { + buildInfoDirectory = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); + bundleBuildInfo = { + commonSourceDirectory: relativeToBuildInfo(host.getCommonSourceDirectory()), + sourceFiles: sourceFileOrBundle.sourceFiles.map(function(file) { + return relativeToBuildInfo(ts6.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory())); + }) + }; + } + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("emit", "emitJsFileOrBundle", { jsFilePath }); + emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("emit", "emitDeclarationFileOrBundle", { declarationFilePath }); + emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("emit", "emitBuildInfo", { buildInfoPath }); + emitBuildInfo(bundleBuildInfo, buildInfoPath); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + if (!emitSkipped && emittedFilesList) { + if (!emitOnlyDtsFiles) { + if (jsFilePath) { + emittedFilesList.push(jsFilePath); + } + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (buildInfoPath) { + emittedFilesList.push(buildInfoPath); + } + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + if (declarationMapPath) { + emittedFilesList.push(declarationMapPath); + } + } + function relativeToBuildInfo(path) { + return ts6.ensurePathIsNonModuleName(ts6.getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName)); + } + } + function emitBuildInfo(bundle, buildInfoPath) { + if (!buildInfoPath || targetSourceFile || emitSkipped) + return; + var program = host.getProgramBuildInfo(); + if (host.isEmitBlocked(buildInfoPath)) { + emitSkipped = true; + return; + } + var version = ts6.version; + var buildInfo = { bundle, program, version }; + ts6.writeFile( + host, + emitterDiagnostics, + buildInfoPath, + getBuildInfoText(buildInfo), + /*writeByteOrderMark*/ + false, + /*sourceFiles*/ + void 0, + { buildInfo } + ); + } + function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) { + if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) { + return; + } + if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) { + emitSkipped = true; + return; + } + var transform = ts6.transformNodes( + resolver, + host, + ts6.factory, + compilerOptions, + [sourceFileOrBundle], + scriptTransformers, + /*allowDtsFiles*/ + false + ); + var printerOptions = { + removeComments: compilerOptions.removeComments, + newLine: compilerOptions.newLine, + noEmitHelpers: compilerOptions.noEmitHelpers, + module: compilerOptions.module, + target: compilerOptions.target, + sourceMap: compilerOptions.sourceMap, + inlineSourceMap: compilerOptions.inlineSourceMap, + inlineSources: compilerOptions.inlineSources, + extendedDiagnostics: compilerOptions.extendedDiagnostics, + writeBundleFileInfo: !!bundleBuildInfo, + relativeToBuildInfo + }; + var printer = createPrinter(printerOptions, { + // resolver hooks + hasGlobalName: resolver.hasGlobalName, + // transform hooks + onEmitNode: transform.emitNodeWithNotification, + isEmitNotificationEnabled: transform.isEmitNotificationEnabled, + substituteNode: transform.substituteNode + }); + ts6.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform"); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions); + transform.dispose(); + if (bundleBuildInfo) + bundleBuildInfo.js = printer.bundleFileInfo; + } + function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) { + if (!sourceFileOrBundle) + return; + if (!declarationFilePath) { + if (emitOnlyDtsFiles || compilerOptions.emitDeclarationOnly) + emitSkipped = true; + return; + } + var sourceFiles = ts6.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles; + var filesForEmit = forceDtsEmit ? sourceFiles : ts6.filter(sourceFiles, ts6.isSourceFileNotJson); + var inputListOrBundle = ts6.outFile(compilerOptions) ? [ts6.factory.createBundle(filesForEmit, !ts6.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : void 0)] : filesForEmit; + if (emitOnlyDtsFiles && !ts6.getEmitDeclarations(compilerOptions)) { + filesForEmit.forEach(collectLinkedAliases); + } + var declarationTransform = ts6.transformNodes( + resolver, + host, + ts6.factory, + compilerOptions, + inputListOrBundle, + declarationTransformers, + /*allowDtsFiles*/ + false + ); + if (ts6.length(declarationTransform.diagnostics)) { + for (var _a2 = 0, _b2 = declarationTransform.diagnostics; _a2 < _b2.length; _a2++) { + var diagnostic = _b2[_a2]; + emitterDiagnostics.add(diagnostic); + } + } + var printerOptions = { + removeComments: compilerOptions.removeComments, + newLine: compilerOptions.newLine, + noEmitHelpers: true, + module: compilerOptions.module, + target: compilerOptions.target, + sourceMap: !forceDtsEmit && compilerOptions.declarationMap, + inlineSourceMap: compilerOptions.inlineSourceMap, + extendedDiagnostics: compilerOptions.extendedDiagnostics, + onlyPrintJsDocStyle: true, + writeBundleFileInfo: !!bundleBuildInfo, + recordInternalSection: !!bundleBuildInfo, + relativeToBuildInfo + }; + var declarationPrinter = createPrinter(printerOptions, { + // resolver hooks + hasGlobalName: resolver.hasGlobalName, + // transform hooks + onEmitNode: declarationTransform.emitNodeWithNotification, + isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled, + substituteNode: declarationTransform.substituteNode + }); + var declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit; + emitSkipped = emitSkipped || declBlocked; + if (!declBlocked || forceDtsEmit) { + ts6.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform"); + printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, { + sourceMap: printerOptions.sourceMap, + sourceRoot: compilerOptions.sourceRoot, + mapRoot: compilerOptions.mapRoot, + extendedDiagnostics: compilerOptions.extendedDiagnostics + // Explicitly do not passthru either `inline` option + }); + } + declarationTransform.dispose(); + if (bundleBuildInfo) + bundleBuildInfo.dts = declarationPrinter.bundleFileInfo; + } + function collectLinkedAliases(node) { + if (ts6.isExportAssignment(node)) { + if (node.expression.kind === 79) { + resolver.collectLinkedAliases( + node.expression, + /*setVisibility*/ + true + ); + } + return; + } else if (ts6.isExportSpecifier(node)) { + resolver.collectLinkedAliases( + node.propertyName || node.name, + /*setVisibility*/ + true + ); + return; + } + ts6.forEachChild(node, collectLinkedAliases); + } + function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { + var sourceFileOrBundle = transform.transformed[0]; + var bundle = sourceFileOrBundle.kind === 309 ? sourceFileOrBundle : void 0; + var sourceFile = sourceFileOrBundle.kind === 308 ? sourceFileOrBundle : void 0; + var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; + var sourceMapGenerator; + if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { + sourceMapGenerator = ts6.createSourceMapGenerator(host, ts6.getBaseFileName(ts6.normalizeSlashes(jsFilePath)), getSourceRoot(mapOptions), getSourceMapDirectory(mapOptions, jsFilePath, sourceFile), mapOptions); + } + if (bundle) { + printer.writeBundle(bundle, writer, sourceMapGenerator); + } else { + printer.writeFile(sourceFile, writer, sourceMapGenerator); + } + var sourceMapUrlPos; + if (sourceMapGenerator) { + if (sourceMapDataList) { + sourceMapDataList.push({ + inputSourceFileNames: sourceMapGenerator.getSources(), + sourceMap: sourceMapGenerator.toJSON() + }); + } + var sourceMappingURL = getSourceMappingURL(mapOptions, sourceMapGenerator, jsFilePath, sourceMapFilePath, sourceFile); + if (sourceMappingURL) { + if (!writer.isAtStartOfLine()) + writer.rawWrite(newLine); + sourceMapUrlPos = writer.getTextPos(); + writer.writeComment("//# ".concat("sourceMappingURL", "=").concat(sourceMappingURL)); + } + if (sourceMapFilePath) { + var sourceMap = sourceMapGenerator.toString(); + ts6.writeFile( + host, + emitterDiagnostics, + sourceMapFilePath, + sourceMap, + /*writeByteOrderMark*/ + false, + sourceFiles + ); + if (printer.bundleFileInfo) + printer.bundleFileInfo.mapHash = ts6.computeSignature(sourceMap, ts6.maybeBind(host, host.createHash)); + } + } else { + writer.writeLine(); + } + var text = writer.getText(); + ts6.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos, diagnostics: transform.diagnostics }); + if (printer.bundleFileInfo) + printer.bundleFileInfo.hash = ts6.computeSignature(text, ts6.maybeBind(host, host.createHash)); + writer.clear(); + } + function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { + return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 308 || !ts6.fileExtensionIs( + sourceFileOrBundle.fileName, + ".json" + /* Extension.Json */ + )); + } + function getSourceRoot(mapOptions) { + var sourceRoot = ts6.normalizeSlashes(mapOptions.sourceRoot || ""); + return sourceRoot ? ts6.ensureTrailingDirectorySeparator(sourceRoot) : sourceRoot; + } + function getSourceMapDirectory(mapOptions, filePath, sourceFile) { + if (mapOptions.sourceRoot) + return host.getCommonSourceDirectory(); + if (mapOptions.mapRoot) { + var sourceMapDir = ts6.normalizeSlashes(mapOptions.mapRoot); + if (sourceFile) { + sourceMapDir = ts6.getDirectoryPath(ts6.getSourceFilePathInNewDir(sourceFile.fileName, host, sourceMapDir)); + } + if (ts6.getRootLength(sourceMapDir) === 0) { + sourceMapDir = ts6.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + } + return sourceMapDir; + } + return ts6.getDirectoryPath(ts6.normalizePath(filePath)); + } + function getSourceMappingURL(mapOptions, sourceMapGenerator, filePath, sourceMapFilePath, sourceFile) { + if (mapOptions.inlineSourceMap) { + var sourceMapText = sourceMapGenerator.toString(); + var base64SourceMapText = ts6.base64encode(ts6.sys, sourceMapText); + return "data:application/json;base64,".concat(base64SourceMapText); + } + var sourceMapFile = ts6.getBaseFileName(ts6.normalizeSlashes(ts6.Debug.checkDefined(sourceMapFilePath))); + if (mapOptions.mapRoot) { + var sourceMapDir = ts6.normalizeSlashes(mapOptions.mapRoot); + if (sourceFile) { + sourceMapDir = ts6.getDirectoryPath(ts6.getSourceFilePathInNewDir(sourceFile.fileName, host, sourceMapDir)); + } + if (ts6.getRootLength(sourceMapDir) === 0) { + sourceMapDir = ts6.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + return encodeURI(ts6.getRelativePathToDirectoryOrUrl( + ts6.getDirectoryPath(ts6.normalizePath(filePath)), + // get the relative sourceMapDir path based on jsFilePath + ts6.combinePaths(sourceMapDir, sourceMapFile), + // this is where user expects to see sourceMap + host.getCurrentDirectory(), + host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ + true + )); + } else { + return encodeURI(ts6.combinePaths(sourceMapDir, sourceMapFile)); + } + } + return encodeURI(sourceMapFile); + } + } + ts6.emitFiles = emitFiles; + function getBuildInfoText(buildInfo) { + return JSON.stringify(buildInfo); + } + ts6.getBuildInfoText = getBuildInfoText; + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts6.readJsonOrUndefined(buildInfoFile, buildInfoText); + } + ts6.getBuildInfo = getBuildInfo; + ts6.notImplementedResolver = { + hasGlobalName: ts6.notImplemented, + getReferencedExportContainer: ts6.notImplemented, + getReferencedImportDeclaration: ts6.notImplemented, + getReferencedDeclarationWithCollidingName: ts6.notImplemented, + isDeclarationWithCollidingName: ts6.notImplemented, + isValueAliasDeclaration: ts6.notImplemented, + isReferencedAliasDeclaration: ts6.notImplemented, + isTopLevelValueImportEqualsWithEntityName: ts6.notImplemented, + getNodeCheckFlags: ts6.notImplemented, + isDeclarationVisible: ts6.notImplemented, + isLateBound: function(_node) { + return false; + }, + collectLinkedAliases: ts6.notImplemented, + isImplementationOfOverload: ts6.notImplemented, + isRequiredInitializedParameter: ts6.notImplemented, + isOptionalUninitializedParameterProperty: ts6.notImplemented, + isExpandoFunctionDeclaration: ts6.notImplemented, + getPropertiesOfContainerFunction: ts6.notImplemented, + createTypeOfDeclaration: ts6.notImplemented, + createReturnTypeOfSignatureDeclaration: ts6.notImplemented, + createTypeOfExpression: ts6.notImplemented, + createLiteralConstValue: ts6.notImplemented, + isSymbolAccessible: ts6.notImplemented, + isEntityNameVisible: ts6.notImplemented, + // Returns the constant value this property access resolves to: notImplemented, or 'undefined' for a non-constant + getConstantValue: ts6.notImplemented, + getReferencedValueDeclaration: ts6.notImplemented, + getTypeReferenceSerializationKind: ts6.notImplemented, + isOptionalParameter: ts6.notImplemented, + moduleExportsSomeValue: ts6.notImplemented, + isArgumentsLocalBinding: ts6.notImplemented, + getExternalModuleFileFromDeclaration: ts6.notImplemented, + getTypeReferenceDirectivesForEntityName: ts6.notImplemented, + getTypeReferenceDirectivesForSymbol: ts6.notImplemented, + isLiteralConstDeclaration: ts6.notImplemented, + getJsxFactoryEntity: ts6.notImplemented, + getJsxFragmentFactoryEntity: ts6.notImplemented, + getAllAccessorDeclarations: ts6.notImplemented, + getSymbolOfExternalModuleSpecifier: ts6.notImplemented, + isBindingCapturedByNode: ts6.notImplemented, + getDeclarationStatementsForSourceFile: ts6.notImplemented, + isImportRequiredByAugmentation: ts6.notImplemented + }; + function createSourceFilesFromBundleBuildInfo(bundle, buildInfoDirectory, host) { + var _a; + var jsBundle = ts6.Debug.checkDefined(bundle.js); + var prologueMap = ((_a = jsBundle.sources) === null || _a === void 0 ? void 0 : _a.prologues) && ts6.arrayToMap(jsBundle.sources.prologues, function(prologueInfo) { + return prologueInfo.file; + }); + return bundle.sourceFiles.map(function(fileName, index) { + var _a2, _b; + var prologueInfo = prologueMap === null || prologueMap === void 0 ? void 0 : prologueMap.get(index); + var statements = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.directives.map(function(directive) { + var literal2 = ts6.setTextRange(ts6.factory.createStringLiteral(directive.expression.text), directive.expression); + var statement = ts6.setTextRange(ts6.factory.createExpressionStatement(literal2), directive); + ts6.setParent(literal2, statement); + return statement; + }); + var eofToken = ts6.factory.createToken( + 1 + /* SyntaxKind.EndOfFileToken */ + ); + var sourceFile = ts6.factory.createSourceFile( + statements !== null && statements !== void 0 ? statements : [], + eofToken, + 0 + /* NodeFlags.None */ + ); + sourceFile.fileName = ts6.getRelativePathFromDirectory(host.getCurrentDirectory(), ts6.getNormalizedAbsolutePath(fileName, buildInfoDirectory), !host.useCaseSensitiveFileNames()); + sourceFile.text = (_a2 = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.text) !== null && _a2 !== void 0 ? _a2 : ""; + ts6.setTextRangePosWidth(sourceFile, 0, (_b = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.text.length) !== null && _b !== void 0 ? _b : 0); + ts6.setEachParent(sourceFile.statements, sourceFile); + ts6.setTextRangePosWidth(eofToken, sourceFile.end, 0); + ts6.setParent(eofToken, sourceFile); + return sourceFile; + }); + } + function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) { + var createHash = ts6.maybeBind(host, host.createHash); + var _a = getOutputPathsForBundle( + config.options, + /*forceDtsPaths*/ + false + ), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath; + var buildInfo; + if (host.getBuildInfo) { + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); + } else { + var buildInfoText = host.readFile(buildInfoPath); + if (!buildInfoText) + return buildInfoPath; + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); + } + if (!buildInfo) + return buildInfoPath; + if (!buildInfo.bundle || !buildInfo.bundle.js || declarationFilePath && !buildInfo.bundle.dts) + return buildInfoPath; + var jsFileText = host.readFile(ts6.Debug.checkDefined(jsFilePath)); + if (!jsFileText) + return jsFilePath; + if (ts6.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash) + return jsFilePath; + var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath); + if (sourceMapFilePath && !sourceMapText || config.options.inlineSourceMap) + return sourceMapFilePath || "inline sourcemap decoding"; + if (sourceMapFilePath && ts6.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash) + return sourceMapFilePath; + var declarationText = declarationFilePath && host.readFile(declarationFilePath); + if (declarationFilePath && !declarationText) + return declarationFilePath; + if (declarationFilePath && ts6.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash) + return declarationFilePath; + var declarationMapText = declarationMapPath && host.readFile(declarationMapPath); + if (declarationMapPath && !declarationMapText || config.options.inlineSourceMap) + return declarationMapPath || "inline sourcemap decoding"; + if (declarationMapPath && ts6.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash) + return declarationMapPath; + var buildInfoDirectory = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); + var ownPrependInput = ts6.createInputFiles( + jsFileText, + declarationText, + sourceMapFilePath, + sourceMapText, + declarationMapPath, + declarationMapText, + jsFilePath, + declarationFilePath, + buildInfoPath, + buildInfo, + /*onlyOwnText*/ + true + ); + var outputFiles = []; + var prependNodes = ts6.createPrependNodes(config.projectReferences, getCommandLine, function(f) { + return host.readFile(f); + }); + var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host); + var changedDtsText; + var changedDtsData; + var emitHost = { + getPrependNodes: ts6.memoize(function() { + return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); + }), + getCanonicalFileName: host.getCanonicalFileName, + getCommonSourceDirectory: function() { + return ts6.getNormalizedAbsolutePath(buildInfo.bundle.commonSourceDirectory, buildInfoDirectory); + }, + getCompilerOptions: function() { + return config.options; + }, + getCurrentDirectory: function() { + return host.getCurrentDirectory(); + }, + getNewLine: function() { + return host.getNewLine(); + }, + getSourceFile: ts6.returnUndefined, + getSourceFileByPath: ts6.returnUndefined, + getSourceFiles: function() { + return sourceFilesForJsEmit; + }, + getLibFileFromReference: ts6.notImplemented, + isSourceFileFromExternalLibrary: ts6.returnFalse, + getResolvedProjectReferenceToRedirect: ts6.returnUndefined, + getProjectReferenceRedirect: ts6.returnUndefined, + isSourceOfProjectReferenceRedirect: ts6.returnFalse, + writeFile: function(name, text, writeByteOrderMark, _onError, _sourceFiles, data) { + switch (name) { + case jsFilePath: + if (jsFileText === text) + return; + break; + case sourceMapFilePath: + if (sourceMapText === text) + return; + break; + case buildInfoPath: + var newBuildInfo = data.buildInfo; + newBuildInfo.program = buildInfo.program; + if (newBuildInfo.program && changedDtsText !== void 0 && config.options.composite) { + newBuildInfo.program.outSignature = ts6.computeSignature(changedDtsText, createHash, changedDtsData); + } + var _a2 = buildInfo.bundle, js = _a2.js, dts = _a2.dts, sourceFiles = _a2.sourceFiles; + newBuildInfo.bundle.js.sources = js.sources; + if (dts) { + newBuildInfo.bundle.dts.sources = dts.sources; + } + newBuildInfo.bundle.sourceFiles = sourceFiles; + outputFiles.push({ name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark, buildInfo: newBuildInfo }); + return; + case declarationFilePath: + if (declarationText === text) + return; + changedDtsText = text; + changedDtsData = data; + break; + case declarationMapPath: + if (declarationMapText === text) + return; + break; + default: + ts6.Debug.fail("Unexpected path: ".concat(name)); + } + outputFiles.push({ name, text, writeByteOrderMark }); + }, + isEmitBlocked: ts6.returnFalse, + readFile: function(f) { + return host.readFile(f); + }, + fileExists: function(f) { + return host.fileExists(f); + }, + useCaseSensitiveFileNames: function() { + return host.useCaseSensitiveFileNames(); + }, + getProgramBuildInfo: ts6.returnUndefined, + getSourceFileFromReference: ts6.returnUndefined, + redirectTargetsMap: ts6.createMultiMap(), + getFileIncludeReasons: ts6.notImplemented, + createHash + }; + emitFiles( + ts6.notImplementedResolver, + emitHost, + /*targetSourceFile*/ + void 0, + ts6.getTransformers(config.options, customTransformers) + ); + return outputFiles; + } + ts6.emitUsingBuildInfo = emitUsingBuildInfo; + var PipelinePhase; + (function(PipelinePhase2) { + PipelinePhase2[PipelinePhase2["Notification"] = 0] = "Notification"; + PipelinePhase2[PipelinePhase2["Substitution"] = 1] = "Substitution"; + PipelinePhase2[PipelinePhase2["Comments"] = 2] = "Comments"; + PipelinePhase2[PipelinePhase2["SourceMaps"] = 3] = "SourceMaps"; + PipelinePhase2[PipelinePhase2["Emit"] = 4] = "Emit"; + })(PipelinePhase || (PipelinePhase = {})); + function createPrinter(printerOptions, handlers) { + if (printerOptions === void 0) { + printerOptions = {}; + } + if (handlers === void 0) { + handlers = {}; + } + var hasGlobalName = handlers.hasGlobalName, _a = handlers.onEmitNode, onEmitNode = _a === void 0 ? ts6.noEmitNotification : _a, isEmitNotificationEnabled = handlers.isEmitNotificationEnabled, _b = handlers.substituteNode, substituteNode = _b === void 0 ? ts6.noEmitSubstitution : _b, onBeforeEmitNode = handlers.onBeforeEmitNode, onAfterEmitNode = handlers.onAfterEmitNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; + var extendedDiagnostics = !!printerOptions.extendedDiagnostics; + var newLine = ts6.getNewLineCharacter(printerOptions); + var moduleKind = ts6.getEmitModuleKind(printerOptions); + var bundledHelpers = new ts6.Map(); + var currentSourceFile; + var nodeIdToGeneratedName; + var autoGeneratedIdToGeneratedName; + var generatedNames; + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; + var privateNameTempFlags; + var tempFlagsStack; + var tempFlags; + var reservedNamesStack; + var reservedNames; + var preserveSourceNewlines = printerOptions.preserveSourceNewlines; + var nextListElementPos; + var writer; + var ownWriter; + var write = writeBase; + var isOwnFileEmit; + var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0; + var relativeToBuildInfo = bundleFileInfo ? ts6.Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0; + var recordInternalSection = printerOptions.recordInternalSection; + var sourceFileTextPos = 0; + var sourceFileTextKind = "text"; + var sourceMapsDisabled = true; + var sourceMapGenerator; + var sourceMapSource; + var sourceMapSourceIndex = -1; + var mostRecentlyAddedSourceMapSource; + var mostRecentlyAddedSourceMapSourceIndex = -1; + var containerPos = -1; + var containerEnd = -1; + var declarationListContainerEnd = -1; + var currentLineMap; + var detachedCommentsInfo; + var hasWrittenComment = false; + var commentsDisabled = !!printerOptions.removeComments; + var lastSubstitution; + var currentParenthesizerRule; + var _c = ts6.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit; + var parenthesizer = ts6.factory.parenthesizer; + var typeArgumentParenthesizerRuleSelector = { + select: function(index) { + return index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : void 0; + } + }; + var emitBinaryExpression = createEmitBinaryExpression(); + reset(); + return { + // public API + printNode, + printList, + printFile, + printBundle, + // internal API + writeNode, + writeList, + writeFile, + writeBundle, + bundleFileInfo + }; + function printNode(hint, node, sourceFile) { + switch (hint) { + case 0: + ts6.Debug.assert(ts6.isSourceFile(node), "Expected a SourceFile node."); + break; + case 2: + ts6.Debug.assert(ts6.isIdentifier(node), "Expected an Identifier node."); + break; + case 1: + ts6.Debug.assert(ts6.isExpression(node), "Expected an Expression node."); + break; + } + switch (node.kind) { + case 308: + return printFile(node); + case 309: + return printBundle(node); + case 310: + return printUnparsedSource(node); + } + writeNode(hint, node, sourceFile, beginPrint()); + return endPrint(); + } + function printList(format, nodes, sourceFile) { + writeList(format, nodes, sourceFile, beginPrint()); + return endPrint(); + } + function printBundle(bundle) { + writeBundle( + bundle, + beginPrint(), + /*sourceMapEmitter*/ + void 0 + ); + return endPrint(); + } + function printFile(sourceFile) { + writeFile( + sourceFile, + beginPrint(), + /*sourceMapEmitter*/ + void 0 + ); + return endPrint(); + } + function printUnparsedSource(unparsed) { + writeUnparsedSource(unparsed, beginPrint()); + return endPrint(); + } + function writeNode(hint, node, sourceFile, output) { + var previousWriter = writer; + setWriter( + output, + /*_sourceMapGenerator*/ + void 0 + ); + print(hint, node, sourceFile); + reset(); + writer = previousWriter; + } + function writeList(format, nodes, sourceFile, output) { + var previousWriter = writer; + setWriter( + output, + /*_sourceMapGenerator*/ + void 0 + ); + if (sourceFile) { + setSourceFile(sourceFile); + } + emitList( + /*parentNode*/ + void 0, + nodes, + format + ); + reset(); + writer = previousWriter; + } + function getTextPosWithWriteLine() { + return writer.getTextPosWithWriteLine ? writer.getTextPosWithWriteLine() : writer.getTextPos(); + } + function updateOrPushBundleFileTextLike(pos, end, kind) { + var last = ts6.lastOrUndefined(bundleFileInfo.sections); + if (last && last.kind === kind) { + last.end = end; + } else { + bundleFileInfo.sections.push({ pos, end, kind }); + } + } + function recordBundleFileInternalSectionStart(node) { + if (recordInternalSection && bundleFileInfo && currentSourceFile && (ts6.isDeclaration(node) || ts6.isVariableStatement(node)) && ts6.isInternalDeclaration(node, currentSourceFile) && sourceFileTextKind !== "internal") { + var prevSourceFileTextKind = sourceFileTextKind; + recordBundleFileTextLikeSection(writer.getTextPos()); + sourceFileTextPos = getTextPosWithWriteLine(); + sourceFileTextKind = "internal"; + return prevSourceFileTextKind; + } + return void 0; + } + function recordBundleFileInternalSectionEnd(prevSourceFileTextKind) { + if (prevSourceFileTextKind) { + recordBundleFileTextLikeSection(writer.getTextPos()); + sourceFileTextPos = getTextPosWithWriteLine(); + sourceFileTextKind = prevSourceFileTextKind; + } + } + function recordBundleFileTextLikeSection(end) { + if (sourceFileTextPos < end) { + updateOrPushBundleFileTextLike(sourceFileTextPos, end, sourceFileTextKind); + return true; + } + return false; + } + function writeBundle(bundle, output, sourceMapGenerator2) { + var _a2; + isOwnFileEmit = false; + var previousWriter = writer; + setWriter(output, sourceMapGenerator2); + emitShebangIfNeeded(bundle); + emitPrologueDirectivesIfNeeded(bundle); + emitHelpers(bundle); + emitSyntheticTripleSlashReferencesIfNeeded(bundle); + for (var _b2 = 0, _c2 = bundle.prepends; _b2 < _c2.length; _b2++) { + var prepend = _c2[_b2]; + writeLine(); + var pos = writer.getTextPos(); + var savedSections = bundleFileInfo && bundleFileInfo.sections; + if (savedSections) + bundleFileInfo.sections = []; + print( + 4, + prepend, + /*sourceFile*/ + void 0 + ); + if (bundleFileInfo) { + var newSections = bundleFileInfo.sections; + bundleFileInfo.sections = savedSections; + if (prepend.oldFileOfCurrentEmit) + (_a2 = bundleFileInfo.sections).push.apply(_a2, newSections); + else { + newSections.forEach(function(section) { + return ts6.Debug.assert(ts6.isBundleFileTextLike(section)); + }); + bundleFileInfo.sections.push({ + pos, + end: writer.getTextPos(), + kind: "prepend", + data: relativeToBuildInfo(prepend.fileName), + texts: newSections + }); + } + } + } + sourceFileTextPos = getTextPosWithWriteLine(); + for (var _d = 0, _e = bundle.sourceFiles; _d < _e.length; _d++) { + var sourceFile = _e[_d]; + print(0, sourceFile, sourceFile); + } + if (bundleFileInfo && bundle.sourceFiles.length) { + var end = writer.getTextPos(); + if (recordBundleFileTextLikeSection(end)) { + var prologues = getPrologueDirectivesFromBundledSourceFiles(bundle); + if (prologues) { + if (!bundleFileInfo.sources) + bundleFileInfo.sources = {}; + bundleFileInfo.sources.prologues = prologues; + } + var helpers = getHelpersFromBundledSourceFiles(bundle); + if (helpers) { + if (!bundleFileInfo.sources) + bundleFileInfo.sources = {}; + bundleFileInfo.sources.helpers = helpers; + } + } + } + reset(); + writer = previousWriter; + } + function writeUnparsedSource(unparsed, output) { + var previousWriter = writer; + setWriter( + output, + /*_sourceMapGenerator*/ + void 0 + ); + print( + 4, + unparsed, + /*sourceFile*/ + void 0 + ); + reset(); + writer = previousWriter; + } + function writeFile(sourceFile, output, sourceMapGenerator2) { + isOwnFileEmit = true; + var previousWriter = writer; + setWriter(output, sourceMapGenerator2); + emitShebangIfNeeded(sourceFile); + emitPrologueDirectivesIfNeeded(sourceFile); + print(0, sourceFile, sourceFile); + reset(); + writer = previousWriter; + } + function beginPrint() { + return ownWriter || (ownWriter = ts6.createTextWriter(newLine)); + } + function endPrint() { + var text = ownWriter.getText(); + ownWriter.clear(); + return text; + } + function print(hint, node, sourceFile) { + if (sourceFile) { + setSourceFile(sourceFile); + } + pipelineEmit( + hint, + node, + /*parenthesizerRule*/ + void 0 + ); + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + currentLineMap = void 0; + detachedCommentsInfo = void 0; + if (sourceFile) { + setSourceMapSource(sourceFile); + } + } + function setWriter(_writer, _sourceMapGenerator) { + if (_writer && printerOptions.omitTrailingSemicolon) { + _writer = ts6.getTrailingSemicolonDeferringWriter(_writer); + } + writer = _writer; + sourceMapGenerator = _sourceMapGenerator; + sourceMapsDisabled = !writer || !sourceMapGenerator; + } + function reset() { + nodeIdToGeneratedName = []; + autoGeneratedIdToGeneratedName = []; + generatedNames = new ts6.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts6.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0; + tempFlagsStack = []; + tempFlags = 0; + reservedNamesStack = []; + currentSourceFile = void 0; + currentLineMap = void 0; + detachedCommentsInfo = void 0; + setWriter( + /*output*/ + void 0, + /*_sourceMapGenerator*/ + void 0 + ); + } + function getCurrentLineMap() { + return currentLineMap || (currentLineMap = ts6.getLineStarts(ts6.Debug.checkDefined(currentSourceFile))); + } + function emit(node, parenthesizerRule) { + if (node === void 0) + return; + var prevSourceFileTextKind = recordBundleFileInternalSectionStart(node); + pipelineEmit(4, node, parenthesizerRule); + recordBundleFileInternalSectionEnd(prevSourceFileTextKind); + } + function emitIdentifierName(node) { + if (node === void 0) + return; + pipelineEmit( + 2, + node, + /*parenthesizerRule*/ + void 0 + ); + } + function emitExpression(node, parenthesizerRule) { + if (node === void 0) + return; + pipelineEmit(1, node, parenthesizerRule); + } + function emitJsxAttributeValue(node) { + pipelineEmit(ts6.isStringLiteral(node) ? 6 : 4, node); + } + function beforeEmitNode(node) { + if (preserveSourceNewlines && ts6.getEmitFlags(node) & 134217728) { + preserveSourceNewlines = false; + } + } + function afterEmitNode(savedPreserveSourceNewlines) { + preserveSourceNewlines = savedPreserveSourceNewlines; + } + function pipelineEmit(emitHint, node, parenthesizerRule) { + currentParenthesizerRule = parenthesizerRule; + var pipelinePhase = getPipelinePhase(0, emitHint, node); + pipelinePhase(emitHint, node); + currentParenthesizerRule = void 0; + } + function shouldEmitComments(node) { + return !commentsDisabled && !ts6.isSourceFile(node); + } + function shouldEmitSourceMaps(node) { + return !sourceMapsDisabled && !ts6.isSourceFile(node) && !ts6.isInJsonFile(node) && !ts6.isUnparsedSource(node) && !ts6.isUnparsedPrepend(node); + } + function getPipelinePhase(phase, emitHint, node) { + switch (phase) { + case 0: + if (onEmitNode !== ts6.noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) { + return pipelineEmitWithNotification; + } + case 1: + if (substituteNode !== ts6.noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) { + if (currentParenthesizerRule) { + lastSubstitution = currentParenthesizerRule(lastSubstitution); + } + return pipelineEmitWithSubstitution; + } + case 2: + if (shouldEmitComments(node)) { + return pipelineEmitWithComments; + } + case 3: + if (shouldEmitSourceMaps(node)) { + return pipelineEmitWithSourceMaps; + } + case 4: + return pipelineEmitWithHint; + default: + return ts6.Debug.assertNever(phase); + } + } + function getNextPipelinePhase(currentPhase, emitHint, node) { + return getPipelinePhase(currentPhase + 1, emitHint, node); + } + function pipelineEmitWithNotification(hint, node) { + var pipelinePhase = getNextPipelinePhase(0, hint, node); + onEmitNode(hint, node, pipelinePhase); + } + function pipelineEmitWithHint(hint, node) { + onBeforeEmitNode === null || onBeforeEmitNode === void 0 ? void 0 : onBeforeEmitNode(node); + if (preserveSourceNewlines) { + var savedPreserveSourceNewlines = preserveSourceNewlines; + beforeEmitNode(node); + pipelineEmitWithHintWorker(hint, node); + afterEmitNode(savedPreserveSourceNewlines); + } else { + pipelineEmitWithHintWorker(hint, node); + } + onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(node); + currentParenthesizerRule = void 0; + } + function pipelineEmitWithHintWorker(hint, node, allowSnippets) { + if (allowSnippets === void 0) { + allowSnippets = true; + } + if (allowSnippets) { + var snippet = ts6.getSnippetElement(node); + if (snippet) { + return emitSnippetNode(hint, node, snippet); + } + } + if (hint === 0) + return emitSourceFile(ts6.cast(node, ts6.isSourceFile)); + if (hint === 2) + return emitIdentifier(ts6.cast(node, ts6.isIdentifier)); + if (hint === 6) + return emitLiteral( + ts6.cast(node, ts6.isStringLiteral), + /*jsxAttributeEscape*/ + true + ); + if (hint === 3) + return emitMappedTypeParameter(ts6.cast(node, ts6.isTypeParameterDeclaration)); + if (hint === 5) { + ts6.Debug.assertNode(node, ts6.isEmptyStatement); + return emitEmptyStatement( + /*isEmbeddedStatement*/ + true + ); + } + if (hint === 4) { + switch (node.kind) { + case 15: + case 16: + case 17: + return emitLiteral( + node, + /*jsxAttributeEscape*/ + false + ); + case 79: + return emitIdentifier(node); + case 80: + return emitPrivateIdentifier(node); + case 163: + return emitQualifiedName(node); + case 164: + return emitComputedPropertyName(node); + case 165: + return emitTypeParameter(node); + case 166: + return emitParameter(node); + case 167: + return emitDecorator(node); + case 168: + return emitPropertySignature(node); + case 169: + return emitPropertyDeclaration(node); + case 170: + return emitMethodSignature(node); + case 171: + return emitMethodDeclaration(node); + case 172: + return emitClassStaticBlockDeclaration(node); + case 173: + return emitConstructor(node); + case 174: + case 175: + return emitAccessorDeclaration(node); + case 176: + return emitCallSignature(node); + case 177: + return emitConstructSignature(node); + case 178: + return emitIndexSignature(node); + case 179: + return emitTypePredicate(node); + case 180: + return emitTypeReference(node); + case 181: + return emitFunctionType(node); + case 182: + return emitConstructorType(node); + case 183: + return emitTypeQuery(node); + case 184: + return emitTypeLiteral(node); + case 185: + return emitArrayType(node); + case 186: + return emitTupleType(node); + case 187: + return emitOptionalType(node); + case 189: + return emitUnionType(node); + case 190: + return emitIntersectionType(node); + case 191: + return emitConditionalType(node); + case 192: + return emitInferType(node); + case 193: + return emitParenthesizedType(node); + case 230: + return emitExpressionWithTypeArguments(node); + case 194: + return emitThisType(); + case 195: + return emitTypeOperator(node); + case 196: + return emitIndexedAccessType(node); + case 197: + return emitMappedType(node); + case 198: + return emitLiteralType(node); + case 199: + return emitNamedTupleMember(node); + case 200: + return emitTemplateType(node); + case 201: + return emitTemplateTypeSpan(node); + case 202: + return emitImportTypeNode(node); + case 203: + return emitObjectBindingPattern(node); + case 204: + return emitArrayBindingPattern(node); + case 205: + return emitBindingElement(node); + case 236: + return emitTemplateSpan(node); + case 237: + return emitSemicolonClassElement(); + case 238: + return emitBlock(node); + case 240: + return emitVariableStatement(node); + case 239: + return emitEmptyStatement( + /*isEmbeddedStatement*/ + false + ); + case 241: + return emitExpressionStatement(node); + case 242: + return emitIfStatement(node); + case 243: + return emitDoStatement(node); + case 244: + return emitWhileStatement(node); + case 245: + return emitForStatement(node); + case 246: + return emitForInStatement(node); + case 247: + return emitForOfStatement(node); + case 248: + return emitContinueStatement(node); + case 249: + return emitBreakStatement(node); + case 250: + return emitReturnStatement(node); + case 251: + return emitWithStatement(node); + case 252: + return emitSwitchStatement(node); + case 253: + return emitLabeledStatement(node); + case 254: + return emitThrowStatement(node); + case 255: + return emitTryStatement(node); + case 256: + return emitDebuggerStatement(node); + case 257: + return emitVariableDeclaration(node); + case 258: + return emitVariableDeclarationList(node); + case 259: + return emitFunctionDeclaration(node); + case 260: + return emitClassDeclaration(node); + case 261: + return emitInterfaceDeclaration(node); + case 262: + return emitTypeAliasDeclaration(node); + case 263: + return emitEnumDeclaration(node); + case 264: + return emitModuleDeclaration(node); + case 265: + return emitModuleBlock(node); + case 266: + return emitCaseBlock(node); + case 267: + return emitNamespaceExportDeclaration(node); + case 268: + return emitImportEqualsDeclaration(node); + case 269: + return emitImportDeclaration(node); + case 270: + return emitImportClause(node); + case 271: + return emitNamespaceImport(node); + case 277: + return emitNamespaceExport(node); + case 272: + return emitNamedImports(node); + case 273: + return emitImportSpecifier(node); + case 274: + return emitExportAssignment(node); + case 275: + return emitExportDeclaration(node); + case 276: + return emitNamedExports(node); + case 278: + return emitExportSpecifier(node); + case 296: + return emitAssertClause(node); + case 297: + return emitAssertEntry(node); + case 279: + return; + case 280: + return emitExternalModuleReference(node); + case 11: + return emitJsxText(node); + case 283: + case 286: + return emitJsxOpeningElementOrFragment(node); + case 284: + case 287: + return emitJsxClosingElementOrFragment(node); + case 288: + return emitJsxAttribute(node); + case 289: + return emitJsxAttributes(node); + case 290: + return emitJsxSpreadAttribute(node); + case 291: + return emitJsxExpression(node); + case 292: + return emitCaseClause(node); + case 293: + return emitDefaultClause(node); + case 294: + return emitHeritageClause(node); + case 295: + return emitCatchClause(node); + case 299: + return emitPropertyAssignment(node); + case 300: + return emitShorthandPropertyAssignment(node); + case 301: + return emitSpreadAssignment(node); + case 302: + return emitEnumMember(node); + case 303: + return writeUnparsedNode(node); + case 310: + case 304: + return emitUnparsedSourceOrPrepend(node); + case 305: + case 306: + return emitUnparsedTextLike(node); + case 307: + return emitUnparsedSyntheticReference(node); + case 308: + return emitSourceFile(node); + case 309: + return ts6.Debug.fail("Bundles should be printed using printBundle"); + case 311: + return ts6.Debug.fail("InputFiles should not be printed"); + case 312: + return emitJSDocTypeExpression(node); + case 313: + return emitJSDocNameReference(node); + case 315: + return writePunctuation("*"); + case 316: + return writePunctuation("?"); + case 317: + return emitJSDocNullableType(node); + case 318: + return emitJSDocNonNullableType(node); + case 319: + return emitJSDocOptionalType(node); + case 320: + return emitJSDocFunctionType(node); + case 188: + case 321: + return emitRestOrJSDocVariadicType(node); + case 322: + return; + case 323: + return emitJSDoc(node); + case 325: + return emitJSDocTypeLiteral(node); + case 326: + return emitJSDocSignature(node); + case 330: + case 335: + case 340: + return emitJSDocSimpleTag(node); + case 331: + case 332: + return emitJSDocHeritageTag(node); + case 333: + case 334: + return; + case 336: + case 337: + case 338: + case 339: + return; + case 341: + return emitJSDocCallbackTag(node); + case 343: + case 350: + return emitJSDocPropertyLikeTag(node); + case 342: + case 344: + case 345: + case 346: + return emitJSDocSimpleTypedTag(node); + case 347: + return emitJSDocTemplateTag(node); + case 348: + return emitJSDocTypedefTag(node); + case 349: + return emitJSDocSeeTag(node); + case 352: + case 356: + case 355: + return; + } + if (ts6.isExpression(node)) { + hint = 1; + if (substituteNode !== ts6.noEmitSubstitution) { + var substitute = substituteNode(hint, node) || node; + if (substitute !== node) { + node = substitute; + if (currentParenthesizerRule) { + node = currentParenthesizerRule(node); + } + } + } + } + } + if (hint === 1) { + switch (node.kind) { + case 8: + case 9: + return emitNumericOrBigIntLiteral(node); + case 10: + case 13: + case 14: + return emitLiteral( + node, + /*jsxAttributeEscape*/ + false + ); + case 79: + return emitIdentifier(node); + case 80: + return emitPrivateIdentifier(node); + case 206: + return emitArrayLiteralExpression(node); + case 207: + return emitObjectLiteralExpression(node); + case 208: + return emitPropertyAccessExpression(node); + case 209: + return emitElementAccessExpression(node); + case 210: + return emitCallExpression(node); + case 211: + return emitNewExpression(node); + case 212: + return emitTaggedTemplateExpression(node); + case 213: + return emitTypeAssertionExpression(node); + case 214: + return emitParenthesizedExpression(node); + case 215: + return emitFunctionExpression(node); + case 216: + return emitArrowFunction(node); + case 217: + return emitDeleteExpression(node); + case 218: + return emitTypeOfExpression(node); + case 219: + return emitVoidExpression(node); + case 220: + return emitAwaitExpression(node); + case 221: + return emitPrefixUnaryExpression(node); + case 222: + return emitPostfixUnaryExpression(node); + case 223: + return emitBinaryExpression(node); + case 224: + return emitConditionalExpression(node); + case 225: + return emitTemplateExpression(node); + case 226: + return emitYieldExpression(node); + case 227: + return emitSpreadElement(node); + case 228: + return emitClassExpression(node); + case 229: + return; + case 231: + return emitAsExpression(node); + case 232: + return emitNonNullExpression(node); + case 230: + return emitExpressionWithTypeArguments(node); + case 235: + return emitSatisfiesExpression(node); + case 233: + return emitMetaProperty(node); + case 234: + return ts6.Debug.fail("SyntheticExpression should never be printed."); + case 281: + return emitJsxElement(node); + case 282: + return emitJsxSelfClosingElement(node); + case 285: + return emitJsxFragment(node); + case 351: + return ts6.Debug.fail("SyntaxList should not be printed"); + case 352: + return; + case 353: + return emitPartiallyEmittedExpression(node); + case 354: + return emitCommaList(node); + case 355: + case 356: + return; + case 357: + return ts6.Debug.fail("SyntheticReferenceExpression should not be printed"); + } + } + if (ts6.isKeyword(node.kind)) + return writeTokenNode(node, writeKeyword); + if (ts6.isTokenKind(node.kind)) + return writeTokenNode(node, writePunctuation); + ts6.Debug.fail("Unhandled SyntaxKind: ".concat(ts6.Debug.formatSyntaxKind(node.kind), ".")); + } + function emitMappedTypeParameter(node) { + emit(node.name); + writeSpace(); + writeKeyword("in"); + writeSpace(); + emit(node.constraint); + } + function pipelineEmitWithSubstitution(hint, node) { + var pipelinePhase = getNextPipelinePhase(1, hint, node); + ts6.Debug.assertIsDefined(lastSubstitution); + node = lastSubstitution; + lastSubstitution = void 0; + pipelinePhase(hint, node); + } + function getHelpersFromBundledSourceFiles(bundle) { + var result; + if (moduleKind === ts6.ModuleKind.None || printerOptions.noEmitHelpers) { + return void 0; + } + var bundledHelpers2 = new ts6.Map(); + for (var _a2 = 0, _b2 = bundle.sourceFiles; _a2 < _b2.length; _a2++) { + var sourceFile = _b2[_a2]; + var shouldSkip = ts6.getExternalHelpersModuleName(sourceFile) !== void 0; + var helpers = getSortedEmitHelpers(sourceFile); + if (!helpers) + continue; + for (var _c2 = 0, helpers_5 = helpers; _c2 < helpers_5.length; _c2++) { + var helper = helpers_5[_c2]; + if (!helper.scoped && !shouldSkip && !bundledHelpers2.get(helper.name)) { + bundledHelpers2.set(helper.name, true); + (result || (result = [])).push(helper.name); + } + } + } + return result; + } + function emitHelpers(node) { + var helpersEmitted = false; + var bundle = node.kind === 309 ? node : void 0; + if (bundle && moduleKind === ts6.ModuleKind.None) { + return; + } + var numPrepends = bundle ? bundle.prepends.length : 0; + var numNodes = bundle ? bundle.sourceFiles.length + numPrepends : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node; + var sourceFile = ts6.isSourceFile(currentNode) ? currentNode : ts6.isUnparsedSource(currentNode) ? void 0 : currentSourceFile; + var shouldSkip = printerOptions.noEmitHelpers || !!sourceFile && ts6.hasRecordedExternalHelpers(sourceFile); + var shouldBundle = (ts6.isSourceFile(currentNode) || ts6.isUnparsedSource(currentNode)) && !isOwnFileEmit; + var helpers = ts6.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode); + if (helpers) { + for (var _a2 = 0, helpers_6 = helpers; _a2 < helpers_6.length; _a2++) { + var helper = helpers_6[_a2]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } else if (bundle) { + continue; + } + var pos = getTextPosWithWriteLine(); + if (typeof helper.text === "string") { + writeLines(helper.text); + } else { + writeLines(helper.text(makeFileLevelOptimisticUniqueName)); + } + if (bundleFileInfo) + bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "emitHelpers", data: helper.name }); + helpersEmitted = true; + } + } + } + return helpersEmitted; + } + function getSortedEmitHelpers(node) { + var helpers = ts6.getEmitHelpers(node); + return helpers && ts6.stableSort(helpers, ts6.compareEmitHelpers); + } + function emitNumericOrBigIntLiteral(node) { + emitLiteral( + node, + /*jsxAttributeEscape*/ + false + ); + } + function emitLiteral(node, jsxAttributeEscape) { + var text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape); + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 10 || ts6.isTemplateLiteralKind(node.kind))) { + writeLiteral(text); + } else { + writeStringLiteral(text); + } + } + function emitUnparsedSourceOrPrepend(unparsed) { + for (var _a2 = 0, _b2 = unparsed.texts; _a2 < _b2.length; _a2++) { + var text = _b2[_a2]; + writeLine(); + emit(text); + } + } + function writeUnparsedNode(unparsed) { + writer.rawWrite(unparsed.parent.text.substring(unparsed.pos, unparsed.end)); + } + function emitUnparsedTextLike(unparsed) { + var pos = getTextPosWithWriteLine(); + writeUnparsedNode(unparsed); + if (bundleFileInfo) { + updateOrPushBundleFileTextLike( + pos, + writer.getTextPos(), + unparsed.kind === 305 ? "text" : "internal" + /* BundleFileSectionKind.Internal */ + ); + } + } + function emitUnparsedSyntheticReference(unparsed) { + var pos = getTextPosWithWriteLine(); + writeUnparsedNode(unparsed); + if (bundleFileInfo) { + var section = ts6.clone(unparsed.section); + section.pos = pos; + section.end = writer.getTextPos(); + bundleFileInfo.sections.push(section); + } + } + function emitSnippetNode(hint, node, snippet) { + switch (snippet.kind) { + case 1: + emitPlaceholder(hint, node, snippet); + break; + case 0: + emitTabStop(hint, node, snippet); + break; + } + } + function emitPlaceholder(hint, node, snippet) { + nonEscapingWrite("${".concat(snippet.order, ":")); + pipelineEmitWithHintWorker( + hint, + node, + /*allowSnippets*/ + false + ); + nonEscapingWrite("}"); + } + function emitTabStop(hint, node, snippet) { + ts6.Debug.assert(node.kind === 239, "A tab stop cannot be attached to a node of kind ".concat(ts6.Debug.formatSyntaxKind(node.kind), ".")); + ts6.Debug.assert(hint !== 5, "A tab stop cannot be attached to an embedded statement."); + nonEscapingWrite("$".concat(snippet.order)); + } + function emitIdentifier(node) { + var writeText = node.symbol ? writeSymbol : write; + writeText(getTextOfNode( + node, + /*includeTrivia*/ + false + ), node.symbol); + emitList( + node, + node.typeArguments, + 53776 + /* ListFormat.TypeParameters */ + ); + } + function emitPrivateIdentifier(node) { + var writeText = node.symbol ? writeSymbol : write; + writeText(getTextOfNode( + node, + /*includeTrivia*/ + false + ), node.symbol); + } + function emitQualifiedName(node) { + emitEntityName(node.left); + writePunctuation("."); + emit(node.right); + } + function emitEntityName(node) { + if (node.kind === 79) { + emitExpression(node); + } else { + emit(node); + } + } + function emitComputedPropertyName(node) { + writePunctuation("["); + emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfComputedPropertyName); + writePunctuation("]"); + } + function emitTypeParameter(node) { + emitModifiers(node, node.modifiers); + emit(node.name); + if (node.constraint) { + writeSpace(); + writeKeyword("extends"); + writeSpace(); + emit(node.constraint); + } + if (node.default) { + writeSpace(); + writeOperator("="); + writeSpace(); + emit(node.default); + } + } + function emitParameter(node) { + emitDecoratorsAndModifiers(node, node.modifiers); + emit(node.dotDotDotToken); + emitNodeWithWriter(node.name, writeParameter); + emit(node.questionToken); + if (node.parent && node.parent.kind === 320 && !node.name) { + emit(node.type); + } else { + emitTypeAnnotation(node.type); + } + emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name ? node.name.end : node.modifiers ? node.modifiers.end : node.pos, node, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitDecorator(decorator) { + writePunctuation("@"); + emitExpression(decorator.expression, parenthesizer.parenthesizeLeftSideOfAccess); + } + function emitPropertySignature(node) { + emitModifiers(node, node.modifiers); + emitNodeWithWriter(node.name, writeProperty); + emit(node.questionToken); + emitTypeAnnotation(node.type); + writeTrailingSemicolon(); + } + function emitPropertyDeclaration(node) { + emitDecoratorsAndModifiers(node, node.modifiers); + emit(node.name); + emit(node.questionToken); + emit(node.exclamationToken); + emitTypeAnnotation(node.type); + emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node); + writeTrailingSemicolon(); + } + function emitMethodSignature(node) { + pushNameGenerationScope(node); + emitModifiers(node, node.modifiers); + emit(node.name); + emit(node.questionToken); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitTypeAnnotation(node.type); + writeTrailingSemicolon(); + popNameGenerationScope(node); + } + function emitMethodDeclaration(node) { + emitDecoratorsAndModifiers(node, node.modifiers); + emit(node.asteriskToken); + emit(node.name); + emit(node.questionToken); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitClassStaticBlockDeclaration(node) { + writeKeyword("static"); + emitBlockFunctionBody(node.body); + } + function emitConstructor(node) { + emitModifiers(node, node.modifiers); + writeKeyword("constructor"); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitAccessorDeclaration(node) { + emitDecoratorsAndModifiers(node, node.modifiers); + writeKeyword(node.kind === 174 ? "get" : "set"); + writeSpace(); + emit(node.name); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitCallSignature(node) { + pushNameGenerationScope(node); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitTypeAnnotation(node.type); + writeTrailingSemicolon(); + popNameGenerationScope(node); + } + function emitConstructSignature(node) { + pushNameGenerationScope(node); + writeKeyword("new"); + writeSpace(); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitTypeAnnotation(node.type); + writeTrailingSemicolon(); + popNameGenerationScope(node); + } + function emitIndexSignature(node) { + emitModifiers(node, node.modifiers); + emitParametersForIndexSignature(node, node.parameters); + emitTypeAnnotation(node.type); + writeTrailingSemicolon(); + } + function emitTemplateTypeSpan(node) { + emit(node.type); + emit(node.literal); + } + function emitSemicolonClassElement() { + writeTrailingSemicolon(); + } + function emitTypePredicate(node) { + if (node.assertsModifier) { + emit(node.assertsModifier); + writeSpace(); + } + emit(node.parameterName); + if (node.type) { + writeSpace(); + writeKeyword("is"); + writeSpace(); + emit(node.type); + } + } + function emitTypeReference(node) { + emit(node.typeName); + emitTypeArguments(node, node.typeArguments); + } + function emitFunctionType(node) { + pushNameGenerationScope(node); + emitTypeParameters(node, node.typeParameters); + emitParametersForArrow(node, node.parameters); + writeSpace(); + writePunctuation("=>"); + writeSpace(); + emit(node.type); + popNameGenerationScope(node); + } + function emitJSDocFunctionType(node) { + writeKeyword("function"); + emitParameters(node, node.parameters); + writePunctuation(":"); + emit(node.type); + } + function emitJSDocNullableType(node) { + writePunctuation("?"); + emit(node.type); + } + function emitJSDocNonNullableType(node) { + writePunctuation("!"); + emit(node.type); + } + function emitJSDocOptionalType(node) { + emit(node.type); + writePunctuation("="); + } + function emitConstructorType(node) { + pushNameGenerationScope(node); + emitModifiers(node, node.modifiers); + writeKeyword("new"); + writeSpace(); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + writeSpace(); + writePunctuation("=>"); + writeSpace(); + emit(node.type); + popNameGenerationScope(node); + } + function emitTypeQuery(node) { + writeKeyword("typeof"); + writeSpace(); + emit(node.exprName); + emitTypeArguments(node, node.typeArguments); + } + function emitTypeLiteral(node) { + writePunctuation("{"); + var flags = ts6.getEmitFlags(node) & 1 ? 768 : 32897; + emitList( + node, + node.members, + flags | 524288 + /* ListFormat.NoSpaceIfEmpty */ + ); + writePunctuation("}"); + } + function emitArrayType(node) { + emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType); + writePunctuation("["); + writePunctuation("]"); + } + function emitRestOrJSDocVariadicType(node) { + writePunctuation("..."); + emit(node.type); + } + function emitTupleType(node) { + emitTokenWithComment(22, node.pos, writePunctuation, node); + var flags = ts6.getEmitFlags(node) & 1 ? 528 : 657; + emitList(node, node.elements, flags | 524288, parenthesizer.parenthesizeElementTypeOfTupleType); + emitTokenWithComment(23, node.elements.end, writePunctuation, node); + } + function emitNamedTupleMember(node) { + emit(node.dotDotDotToken); + emit(node.name); + emit(node.questionToken); + emitTokenWithComment(58, node.name.end, writePunctuation, node); + writeSpace(); + emit(node.type); + } + function emitOptionalType(node) { + emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType); + writePunctuation("?"); + } + function emitUnionType(node) { + emitList(node, node.types, 516, parenthesizer.parenthesizeConstituentTypeOfUnionType); + } + function emitIntersectionType(node) { + emitList(node, node.types, 520, parenthesizer.parenthesizeConstituentTypeOfIntersectionType); + } + function emitConditionalType(node) { + emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType); + writeSpace(); + writeKeyword("extends"); + writeSpace(); + emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType); + writeSpace(); + writePunctuation("?"); + writeSpace(); + emit(node.trueType); + writeSpace(); + writePunctuation(":"); + writeSpace(); + emit(node.falseType); + } + function emitInferType(node) { + writeKeyword("infer"); + writeSpace(); + emit(node.typeParameter); + } + function emitParenthesizedType(node) { + writePunctuation("("); + emit(node.type); + writePunctuation(")"); + } + function emitThisType() { + writeKeyword("this"); + } + function emitTypeOperator(node) { + writeTokenText(node.operator, writeKeyword); + writeSpace(); + var parenthesizerRule = node.operator === 146 ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; + emit(node.type, parenthesizerRule); + } + function emitIndexedAccessType(node) { + emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType); + writePunctuation("["); + emit(node.indexType); + writePunctuation("]"); + } + function emitMappedType(node) { + var emitFlags = ts6.getEmitFlags(node); + writePunctuation("{"); + if (emitFlags & 1) { + writeSpace(); + } else { + writeLine(); + increaseIndent(); + } + if (node.readonlyToken) { + emit(node.readonlyToken); + if (node.readonlyToken.kind !== 146) { + writeKeyword("readonly"); + } + writeSpace(); + } + writePunctuation("["); + pipelineEmit(3, node.typeParameter); + if (node.nameType) { + writeSpace(); + writeKeyword("as"); + writeSpace(); + emit(node.nameType); + } + writePunctuation("]"); + if (node.questionToken) { + emit(node.questionToken); + if (node.questionToken.kind !== 57) { + writePunctuation("?"); + } + } + writePunctuation(":"); + writeSpace(); + emit(node.type); + writeTrailingSemicolon(); + if (emitFlags & 1) { + writeSpace(); + } else { + writeLine(); + decreaseIndent(); + } + emitList( + node, + node.members, + 2 + /* ListFormat.PreserveLines */ + ); + writePunctuation("}"); + } + function emitLiteralType(node) { + emitExpression(node.literal); + } + function emitTemplateType(node) { + emit(node.head); + emitList( + node, + node.templateSpans, + 262144 + /* ListFormat.TemplateExpressionSpans */ + ); + } + function emitImportTypeNode(node) { + if (node.isTypeOf) { + writeKeyword("typeof"); + writeSpace(); + } + writeKeyword("import"); + writePunctuation("("); + emit(node.argument); + if (node.assertions) { + writePunctuation(","); + writeSpace(); + writePunctuation("{"); + writeSpace(); + writeKeyword("assert"); + writePunctuation(":"); + writeSpace(); + var elements = node.assertions.assertClause.elements; + emitList( + node.assertions.assertClause, + elements, + 526226 + /* ListFormat.ImportClauseEntries */ + ); + writeSpace(); + writePunctuation("}"); + } + writePunctuation(")"); + if (node.qualifier) { + writePunctuation("."); + emit(node.qualifier); + } + emitTypeArguments(node, node.typeArguments); + } + function emitObjectBindingPattern(node) { + writePunctuation("{"); + emitList( + node, + node.elements, + 525136 + /* ListFormat.ObjectBindingPatternElements */ + ); + writePunctuation("}"); + } + function emitArrayBindingPattern(node) { + writePunctuation("["); + emitList( + node, + node.elements, + 524880 + /* ListFormat.ArrayBindingPatternElements */ + ); + writePunctuation("]"); + } + function emitBindingElement(node) { + emit(node.dotDotDotToken); + if (node.propertyName) { + emit(node.propertyName); + writePunctuation(":"); + writeSpace(); + } + emit(node.name); + emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitArrayLiteralExpression(node) { + var elements = node.elements; + var preferNewLine = node.multiLine ? 65536 : 0; + emitExpressionList(node, elements, 8914 | preferNewLine, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitObjectLiteralExpression(node) { + ts6.forEach(node.properties, generateMemberNames); + var indentedFlag = ts6.getEmitFlags(node) & 65536; + if (indentedFlag) { + increaseIndent(); + } + var preferNewLine = node.multiLine ? 65536 : 0; + var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 && !ts6.isJsonSourceFile(currentSourceFile) ? 64 : 0; + emitList(node, node.properties, 526226 | allowTrailingComma | preferNewLine); + if (indentedFlag) { + decreaseIndent(); + } + } + function emitPropertyAccessExpression(node) { + emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); + var token = node.questionDotToken || ts6.setTextRangePosEnd(ts6.factory.createToken( + 24 + /* SyntaxKind.DotToken */ + ), node.expression.end, node.name.pos); + var linesBeforeDot = getLinesBetweenNodes(node, node.expression, token); + var linesAfterDot = getLinesBetweenNodes(node, token, node.name); + writeLinesAndIndent( + linesBeforeDot, + /*writeSpaceIfNotIndenting*/ + false + ); + var shouldEmitDotDot = token.kind !== 28 && mayNeedDotDotForPropertyAccess(node.expression) && !writer.hasTrailingComment() && !writer.hasTrailingWhitespace(); + if (shouldEmitDotDot) { + writePunctuation("."); + } + if (node.questionDotToken) { + emit(token); + } else { + emitTokenWithComment(token.kind, node.expression.end, writePunctuation, node); + } + writeLinesAndIndent( + linesAfterDot, + /*writeSpaceIfNotIndenting*/ + false + ); + emit(node.name); + decreaseIndentIf(linesBeforeDot, linesAfterDot); + } + function mayNeedDotDotForPropertyAccess(expression) { + expression = ts6.skipPartiallyEmittedExpressions(expression); + if (ts6.isNumericLiteral(expression)) { + var text = getLiteralTextOfNode( + expression, + /*neverAsciiEscape*/ + true, + /*jsxAttributeEscape*/ + false + ); + return !expression.numericLiteralFlags && !ts6.stringContains(text, ts6.tokenToString( + 24 + /* SyntaxKind.DotToken */ + )); + } else if (ts6.isAccessExpression(expression)) { + var constantValue = ts6.getConstantValue(expression); + return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + function emitElementAccessExpression(node) { + emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); + emit(node.questionDotToken); + emitTokenWithComment(22, node.expression.end, writePunctuation, node); + emitExpression(node.argumentExpression); + emitTokenWithComment(23, node.argumentExpression.end, writePunctuation, node); + } + function emitCallExpression(node) { + var indirectCall = ts6.getEmitFlags(node) & 536870912; + if (indirectCall) { + writePunctuation("("); + writeLiteral("0"); + writePunctuation(","); + writeSpace(); + } + emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); + if (indirectCall) { + writePunctuation(")"); + } + emit(node.questionDotToken); + emitTypeArguments(node, node.typeArguments); + emitExpressionList(node, node.arguments, 2576, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitNewExpression(node) { + emitTokenWithComment(103, node.pos, writeKeyword, node); + writeSpace(); + emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfNew); + emitTypeArguments(node, node.typeArguments); + emitExpressionList(node, node.arguments, 18960, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitTaggedTemplateExpression(node) { + var indirectCall = ts6.getEmitFlags(node) & 536870912; + if (indirectCall) { + writePunctuation("("); + writeLiteral("0"); + writePunctuation(","); + writeSpace(); + } + emitExpression(node.tag, parenthesizer.parenthesizeLeftSideOfAccess); + if (indirectCall) { + writePunctuation(")"); + } + emitTypeArguments(node, node.typeArguments); + writeSpace(); + emitExpression(node.template); + } + function emitTypeAssertionExpression(node) { + writePunctuation("<"); + emit(node.type); + writePunctuation(">"); + emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); + } + function emitParenthesizedExpression(node) { + var openParenPos = emitTokenWithComment(20, node.pos, writePunctuation, node); + var indented = writeLineSeparatorsAndIndentBefore(node.expression, node); + emitExpression( + node.expression, + /*parenthesizerRules*/ + void 0 + ); + writeLineSeparatorsAfter(node.expression, node); + decreaseIndentIf(indented); + emitTokenWithComment(21, node.expression ? node.expression.end : openParenPos, writePunctuation, node); + } + function emitFunctionExpression(node) { + generateNameIfNeeded(node.name); + emitFunctionDeclarationOrExpression(node); + } + function emitArrowFunction(node) { + emitModifiers(node, node.modifiers); + emitSignatureAndBody(node, emitArrowFunctionHead); + } + function emitArrowFunctionHead(node) { + emitTypeParameters(node, node.typeParameters); + emitParametersForArrow(node, node.parameters); + emitTypeAnnotation(node.type); + writeSpace(); + emit(node.equalsGreaterThanToken); + } + function emitDeleteExpression(node) { + emitTokenWithComment(89, node.pos, writeKeyword, node); + writeSpace(); + emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); + } + function emitTypeOfExpression(node) { + emitTokenWithComment(112, node.pos, writeKeyword, node); + writeSpace(); + emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); + } + function emitVoidExpression(node) { + emitTokenWithComment(114, node.pos, writeKeyword, node); + writeSpace(); + emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); + } + function emitAwaitExpression(node) { + emitTokenWithComment(133, node.pos, writeKeyword, node); + writeSpace(); + emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); + } + function emitPrefixUnaryExpression(node) { + writeTokenText(node.operator, writeOperator); + if (shouldEmitWhitespaceBeforeOperand(node)) { + writeSpace(); + } + emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPrefixUnary); + } + function shouldEmitWhitespaceBeforeOperand(node) { + var operand = node.operand; + return operand.kind === 221 && (node.operator === 39 && (operand.operator === 39 || operand.operator === 45) || node.operator === 40 && (operand.operator === 40 || operand.operator === 46)); + } + function emitPostfixUnaryExpression(node) { + emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPostfixUnary); + writeTokenText(node.operator, writeOperator); + } + function createEmitBinaryExpression() { + return ts6.createBinaryExpressionTrampoline( + onEnter, + onLeft, + onOperator, + onRight, + onExit, + /*foldState*/ + void 0 + ); + function onEnter(node, state) { + if (state) { + state.stackIndex++; + state.preserveSourceNewlinesStack[state.stackIndex] = preserveSourceNewlines; + state.containerPosStack[state.stackIndex] = containerPos; + state.containerEndStack[state.stackIndex] = containerEnd; + state.declarationListContainerEndStack[state.stackIndex] = declarationListContainerEnd; + var emitComments_1 = state.shouldEmitCommentsStack[state.stackIndex] = shouldEmitComments(node); + var emitSourceMaps = state.shouldEmitSourceMapsStack[state.stackIndex] = shouldEmitSourceMaps(node); + onBeforeEmitNode === null || onBeforeEmitNode === void 0 ? void 0 : onBeforeEmitNode(node); + if (emitComments_1) + emitCommentsBeforeNode(node); + if (emitSourceMaps) + emitSourceMapsBeforeNode(node); + beforeEmitNode(node); + } else { + state = { + stackIndex: 0, + preserveSourceNewlinesStack: [void 0], + containerPosStack: [-1], + containerEndStack: [-1], + declarationListContainerEndStack: [-1], + shouldEmitCommentsStack: [false], + shouldEmitSourceMapsStack: [false] + }; + } + return state; + } + function onLeft(next, _workArea, parent) { + return maybeEmitExpression(next, parent, "left"); + } + function onOperator(operatorToken, _state, node) { + var isCommaOperator = operatorToken.kind !== 27; + var linesBeforeOperator = getLinesBetweenNodes(node, node.left, operatorToken); + var linesAfterOperator = getLinesBetweenNodes(node, operatorToken, node.right); + writeLinesAndIndent(linesBeforeOperator, isCommaOperator); + emitLeadingCommentsOfPosition(operatorToken.pos); + writeTokenNode(operatorToken, operatorToken.kind === 101 ? writeKeyword : writeOperator); + emitTrailingCommentsOfPosition( + operatorToken.end, + /*prefixSpace*/ + true + ); + writeLinesAndIndent( + linesAfterOperator, + /*writeSpaceIfNotIndenting*/ + true + ); + } + function onRight(next, _workArea, parent) { + return maybeEmitExpression(next, parent, "right"); + } + function onExit(node, state) { + var linesBeforeOperator = getLinesBetweenNodes(node, node.left, node.operatorToken); + var linesAfterOperator = getLinesBetweenNodes(node, node.operatorToken, node.right); + decreaseIndentIf(linesBeforeOperator, linesAfterOperator); + if (state.stackIndex > 0) { + var savedPreserveSourceNewlines = state.preserveSourceNewlinesStack[state.stackIndex]; + var savedContainerPos = state.containerPosStack[state.stackIndex]; + var savedContainerEnd = state.containerEndStack[state.stackIndex]; + var savedDeclarationListContainerEnd = state.declarationListContainerEndStack[state.stackIndex]; + var shouldEmitComments_1 = state.shouldEmitCommentsStack[state.stackIndex]; + var shouldEmitSourceMaps_1 = state.shouldEmitSourceMapsStack[state.stackIndex]; + afterEmitNode(savedPreserveSourceNewlines); + if (shouldEmitSourceMaps_1) + emitSourceMapsAfterNode(node); + if (shouldEmitComments_1) + emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd); + onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(node); + state.stackIndex--; + } + } + function maybeEmitExpression(next, parent, side) { + var parenthesizerRule = side === "left" ? parenthesizer.getParenthesizeLeftSideOfBinaryForOperator(parent.operatorToken.kind) : parenthesizer.getParenthesizeRightSideOfBinaryForOperator(parent.operatorToken.kind); + var pipelinePhase = getPipelinePhase(0, 1, next); + if (pipelinePhase === pipelineEmitWithSubstitution) { + ts6.Debug.assertIsDefined(lastSubstitution); + next = parenthesizerRule(ts6.cast(lastSubstitution, ts6.isExpression)); + pipelinePhase = getNextPipelinePhase(1, 1, next); + lastSubstitution = void 0; + } + if (pipelinePhase === pipelineEmitWithComments || pipelinePhase === pipelineEmitWithSourceMaps || pipelinePhase === pipelineEmitWithHint) { + if (ts6.isBinaryExpression(next)) { + return next; + } + } + currentParenthesizerRule = parenthesizerRule; + pipelinePhase(1, next); + } + } + function emitConditionalExpression(node) { + var linesBeforeQuestion = getLinesBetweenNodes(node, node.condition, node.questionToken); + var linesAfterQuestion = getLinesBetweenNodes(node, node.questionToken, node.whenTrue); + var linesBeforeColon = getLinesBetweenNodes(node, node.whenTrue, node.colonToken); + var linesAfterColon = getLinesBetweenNodes(node, node.colonToken, node.whenFalse); + emitExpression(node.condition, parenthesizer.parenthesizeConditionOfConditionalExpression); + writeLinesAndIndent( + linesBeforeQuestion, + /*writeSpaceIfNotIndenting*/ + true + ); + emit(node.questionToken); + writeLinesAndIndent( + linesAfterQuestion, + /*writeSpaceIfNotIndenting*/ + true + ); + emitExpression(node.whenTrue, parenthesizer.parenthesizeBranchOfConditionalExpression); + decreaseIndentIf(linesBeforeQuestion, linesAfterQuestion); + writeLinesAndIndent( + linesBeforeColon, + /*writeSpaceIfNotIndenting*/ + true + ); + emit(node.colonToken); + writeLinesAndIndent( + linesAfterColon, + /*writeSpaceIfNotIndenting*/ + true + ); + emitExpression(node.whenFalse, parenthesizer.parenthesizeBranchOfConditionalExpression); + decreaseIndentIf(linesBeforeColon, linesAfterColon); + } + function emitTemplateExpression(node) { + emit(node.head); + emitList( + node, + node.templateSpans, + 262144 + /* ListFormat.TemplateExpressionSpans */ + ); + } + function emitYieldExpression(node) { + emitTokenWithComment(125, node.pos, writeKeyword, node); + emit(node.asteriskToken); + emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma); + } + function emitSpreadElement(node) { + emitTokenWithComment(25, node.pos, writePunctuation, node); + emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitClassExpression(node) { + generateNameIfNeeded(node.name); + emitClassDeclarationOrExpression(node); + } + function emitExpressionWithTypeArguments(node) { + emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); + emitTypeArguments(node, node.typeArguments); + } + function emitAsExpression(node) { + emitExpression( + node.expression, + /*parenthesizerRules*/ + void 0 + ); + if (node.type) { + writeSpace(); + writeKeyword("as"); + writeSpace(); + emit(node.type); + } + } + function emitNonNullExpression(node) { + emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); + writeOperator("!"); + } + function emitSatisfiesExpression(node) { + emitExpression( + node.expression, + /*parenthesizerRules*/ + void 0 + ); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos, writePunctuation); + writePunctuation("."); + emit(node.name); + } + function emitTemplateSpan(node) { + emitExpression(node.expression); + emit(node.literal); + } + function emitBlock(node) { + emitBlockStatements( + node, + /*forceSingleLine*/ + !node.multiLine && isEmptyBlock(node) + ); + } + function emitBlockStatements(node, forceSingleLine) { + emitTokenWithComment( + 18, + node.pos, + writePunctuation, + /*contextNode*/ + node + ); + var format = forceSingleLine || ts6.getEmitFlags(node) & 1 ? 768 : 129; + emitList(node, node.statements, format); + emitTokenWithComment( + 19, + node.statements.end, + writePunctuation, + /*contextNode*/ + node, + /*indentLeading*/ + !!(format & 1) + ); + } + function emitVariableStatement(node) { + emitModifiers(node, node.modifiers); + emit(node.declarationList); + writeTrailingSemicolon(); + } + function emitEmptyStatement(isEmbeddedStatement) { + if (isEmbeddedStatement) { + writePunctuation(";"); + } else { + writeTrailingSemicolon(); + } + } + function emitExpressionStatement(node) { + emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement); + if (!currentSourceFile || !ts6.isJsonSourceFile(currentSourceFile) || ts6.nodeIsSynthesized(node.expression)) { + writeTrailingSemicolon(); + } + } + function emitIfStatement(node) { + var openParenPos = emitTokenWithComment(99, node.pos, writeKeyword, node); + writeSpace(); + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emitExpression(node.expression); + emitTokenWithComment(21, node.expression.end, writePunctuation, node); + emitEmbeddedStatement(node, node.thenStatement); + if (node.elseStatement) { + writeLineOrSpace(node, node.thenStatement, node.elseStatement); + emitTokenWithComment(91, node.thenStatement.end, writeKeyword, node); + if (node.elseStatement.kind === 242) { + writeSpace(); + emit(node.elseStatement); + } else { + emitEmbeddedStatement(node, node.elseStatement); + } + } + } + function emitWhileClause(node, startPos) { + var openParenPos = emitTokenWithComment(115, startPos, writeKeyword, node); + writeSpace(); + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emitExpression(node.expression); + emitTokenWithComment(21, node.expression.end, writePunctuation, node); + } + function emitDoStatement(node) { + emitTokenWithComment(90, node.pos, writeKeyword, node); + emitEmbeddedStatement(node, node.statement); + if (ts6.isBlock(node.statement) && !preserveSourceNewlines) { + writeSpace(); + } else { + writeLineOrSpace(node, node.statement, node.expression); + } + emitWhileClause(node, node.statement.end); + writeTrailingSemicolon(); + } + function emitWhileStatement(node) { + emitWhileClause(node, node.pos); + emitEmbeddedStatement(node, node.statement); + } + function emitForStatement(node) { + var openParenPos = emitTokenWithComment(97, node.pos, writeKeyword, node); + writeSpace(); + var pos = emitTokenWithComment( + 20, + openParenPos, + writePunctuation, + /*contextNode*/ + node + ); + emitForBinding(node.initializer); + pos = emitTokenWithComment(26, node.initializer ? node.initializer.end : pos, writePunctuation, node); + emitExpressionWithLeadingSpace(node.condition); + pos = emitTokenWithComment(26, node.condition ? node.condition.end : pos, writePunctuation, node); + emitExpressionWithLeadingSpace(node.incrementor); + emitTokenWithComment(21, node.incrementor ? node.incrementor.end : pos, writePunctuation, node); + emitEmbeddedStatement(node, node.statement); + } + function emitForInStatement(node) { + var openParenPos = emitTokenWithComment(97, node.pos, writeKeyword, node); + writeSpace(); + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emitForBinding(node.initializer); + writeSpace(); + emitTokenWithComment(101, node.initializer.end, writeKeyword, node); + writeSpace(); + emitExpression(node.expression); + emitTokenWithComment(21, node.expression.end, writePunctuation, node); + emitEmbeddedStatement(node, node.statement); + } + function emitForOfStatement(node) { + var openParenPos = emitTokenWithComment(97, node.pos, writeKeyword, node); + writeSpace(); + emitWithTrailingSpace(node.awaitModifier); + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emitForBinding(node.initializer); + writeSpace(); + emitTokenWithComment(162, node.initializer.end, writeKeyword, node); + writeSpace(); + emitExpression(node.expression); + emitTokenWithComment(21, node.expression.end, writePunctuation, node); + emitEmbeddedStatement(node, node.statement); + } + function emitForBinding(node) { + if (node !== void 0) { + if (node.kind === 258) { + emit(node); + } else { + emitExpression(node); + } + } + } + function emitContinueStatement(node) { + emitTokenWithComment(86, node.pos, writeKeyword, node); + emitWithLeadingSpace(node.label); + writeTrailingSemicolon(); + } + function emitBreakStatement(node) { + emitTokenWithComment(81, node.pos, writeKeyword, node); + emitWithLeadingSpace(node.label); + writeTrailingSemicolon(); + } + function emitTokenWithComment(token, pos, writer2, contextNode, indentLeading) { + var node = ts6.getParseTreeNode(contextNode); + var isSimilarNode = node && node.kind === contextNode.kind; + var startPos = pos; + if (isSimilarNode && currentSourceFile) { + pos = ts6.skipTrivia(currentSourceFile.text, pos); + } + if (isSimilarNode && contextNode.pos !== startPos) { + var needsIndent = indentLeading && currentSourceFile && !ts6.positionsAreOnSameLine(startPos, pos, currentSourceFile); + if (needsIndent) { + increaseIndent(); + } + emitLeadingCommentsOfPosition(startPos); + if (needsIndent) { + decreaseIndent(); + } + } + pos = writeTokenText(token, writer2, pos); + if (isSimilarNode && contextNode.end !== pos) { + var isJsxExprContext = contextNode.kind === 291; + emitTrailingCommentsOfPosition( + pos, + /*prefixSpace*/ + !isJsxExprContext, + /*forceNoNewline*/ + isJsxExprContext + ); + } + return pos; + } + function commentWillEmitNewLine(node) { + return node.kind === 2 || !!node.hasTrailingNewLine; + } + function willEmitLeadingNewLine(node) { + if (!currentSourceFile) + return false; + if (ts6.some(ts6.getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine)) + return true; + if (ts6.some(ts6.getSyntheticLeadingComments(node), commentWillEmitNewLine)) + return true; + if (ts6.isPartiallyEmittedExpression(node)) { + if (node.pos !== node.expression.pos) { + if (ts6.some(ts6.getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine)) + return true; + } + return willEmitLeadingNewLine(node.expression); + } + return false; + } + function parenthesizeExpressionForNoAsi(node) { + if (!commentsDisabled && ts6.isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) { + var parseNode = ts6.getParseTreeNode(node); + if (parseNode && ts6.isParenthesizedExpression(parseNode)) { + var parens = ts6.factory.createParenthesizedExpression(node.expression); + ts6.setOriginalNode(parens, node); + ts6.setTextRange(parens, parseNode); + return parens; + } + return ts6.factory.createParenthesizedExpression(node); + } + return node; + } + function parenthesizeExpressionForNoAsiAndDisallowedComma(node) { + return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node)); + } + function emitReturnStatement(node) { + emitTokenWithComment( + 105, + node.pos, + writeKeyword, + /*contextNode*/ + node + ); + emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi); + writeTrailingSemicolon(); + } + function emitWithStatement(node) { + var openParenPos = emitTokenWithComment(116, node.pos, writeKeyword, node); + writeSpace(); + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emitExpression(node.expression); + emitTokenWithComment(21, node.expression.end, writePunctuation, node); + emitEmbeddedStatement(node, node.statement); + } + function emitSwitchStatement(node) { + var openParenPos = emitTokenWithComment(107, node.pos, writeKeyword, node); + writeSpace(); + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emitExpression(node.expression); + emitTokenWithComment(21, node.expression.end, writePunctuation, node); + writeSpace(); + emit(node.caseBlock); + } + function emitLabeledStatement(node) { + emit(node.label); + emitTokenWithComment(58, node.label.end, writePunctuation, node); + writeSpace(); + emit(node.statement); + } + function emitThrowStatement(node) { + emitTokenWithComment(109, node.pos, writeKeyword, node); + emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi); + writeTrailingSemicolon(); + } + function emitTryStatement(node) { + emitTokenWithComment(111, node.pos, writeKeyword, node); + writeSpace(); + emit(node.tryBlock); + if (node.catchClause) { + writeLineOrSpace(node, node.tryBlock, node.catchClause); + emit(node.catchClause); + } + if (node.finallyBlock) { + writeLineOrSpace(node, node.catchClause || node.tryBlock, node.finallyBlock); + emitTokenWithComment(96, (node.catchClause || node.tryBlock).end, writeKeyword, node); + writeSpace(); + emit(node.finallyBlock); + } + } + function emitDebuggerStatement(node) { + writeToken(87, node.pos, writeKeyword); + writeTrailingSemicolon(); + } + function emitVariableDeclaration(node) { + var _a2, _b2, _c2, _d, _e; + emit(node.name); + emit(node.exclamationToken); + emitTypeAnnotation(node.type); + emitInitializer(node.initializer, (_e = (_b2 = (_a2 = node.type) === null || _a2 === void 0 ? void 0 : _a2.end) !== null && _b2 !== void 0 ? _b2 : (_d = (_c2 = node.name.emitNode) === null || _c2 === void 0 ? void 0 : _c2.typeNode) === null || _d === void 0 ? void 0 : _d.end) !== null && _e !== void 0 ? _e : node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitVariableDeclarationList(node) { + writeKeyword(ts6.isLet(node) ? "let" : ts6.isVarConst(node) ? "const" : "var"); + writeSpace(); + emitList( + node, + node.declarations, + 528 + /* ListFormat.VariableDeclarationList */ + ); + } + function emitFunctionDeclaration(node) { + emitFunctionDeclarationOrExpression(node); + } + function emitFunctionDeclarationOrExpression(node) { + emitModifiers(node, node.modifiers); + writeKeyword("function"); + emit(node.asteriskToken); + writeSpace(); + emitIdentifierName(node.name); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitSignatureAndBody(node, emitSignatureHead2) { + var body = node.body; + if (body) { + if (ts6.isBlock(body)) { + var indentedFlag = ts6.getEmitFlags(node) & 65536; + if (indentedFlag) { + increaseIndent(); + } + pushNameGenerationScope(node); + ts6.forEach(node.parameters, generateNames); + generateNames(node.body); + emitSignatureHead2(node); + emitBlockFunctionBody(body); + popNameGenerationScope(node); + if (indentedFlag) { + decreaseIndent(); + } + } else { + emitSignatureHead2(node); + writeSpace(); + emitExpression(body, parenthesizer.parenthesizeConciseBodyOfArrowFunction); + } + } else { + emitSignatureHead2(node); + writeTrailingSemicolon(); + } + } + function emitSignatureHead(node) { + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitTypeAnnotation(node.type); + } + function shouldEmitBlockFunctionBodyOnSingleLine(body) { + if (ts6.getEmitFlags(body) & 1) { + return true; + } + if (body.multiLine) { + return false; + } + if (!ts6.nodeIsSynthesized(body) && currentSourceFile && !ts6.rangeIsOnSingleLine(body, currentSourceFile)) { + return false; + } + if (getLeadingLineTerminatorCount( + body, + ts6.firstOrUndefined(body.statements), + 2 + /* ListFormat.PreserveLines */ + ) || getClosingLineTerminatorCount(body, ts6.lastOrUndefined(body.statements), 2, body.statements)) { + return false; + } + var previousStatement; + for (var _a2 = 0, _b2 = body.statements; _a2 < _b2.length; _a2++) { + var statement = _b2[_a2]; + if (getSeparatingLineTerminatorCount( + previousStatement, + statement, + 2 + /* ListFormat.PreserveLines */ + ) > 0) { + return false; + } + previousStatement = statement; + } + return true; + } + function emitBlockFunctionBody(body) { + onBeforeEmitNode === null || onBeforeEmitNode === void 0 ? void 0 : onBeforeEmitNode(body); + writeSpace(); + writePunctuation("{"); + increaseIndent(); + var emitBlockFunctionBody2 = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine : emitBlockFunctionBodyWorker; + emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody2); + decreaseIndent(); + writeToken(19, body.statements.end, writePunctuation, body); + onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body); + } + function emitBlockFunctionBodyOnSingleLine(body) { + emitBlockFunctionBodyWorker( + body, + /*emitBlockFunctionBodyOnSingleLine*/ + true + ); + } + function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine2) { + var statementOffset = emitPrologueDirectives(body.statements); + var pos = writer.getTextPos(); + emitHelpers(body); + if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine2) { + decreaseIndent(); + emitList( + body, + body.statements, + 768 + /* ListFormat.SingleLineFunctionBodyStatements */ + ); + increaseIndent(); + } else { + emitList( + body, + body.statements, + 1, + /*parenthesizerRule*/ + void 0, + statementOffset + ); + } + } + function emitClassDeclaration(node) { + emitClassDeclarationOrExpression(node); + } + function emitClassDeclarationOrExpression(node) { + ts6.forEach(node.members, generateMemberNames); + emitDecoratorsAndModifiers(node, node.modifiers); + writeKeyword("class"); + if (node.name) { + writeSpace(); + emitIdentifierName(node.name); + } + var indentedFlag = ts6.getEmitFlags(node) & 65536; + if (indentedFlag) { + increaseIndent(); + } + emitTypeParameters(node, node.typeParameters); + emitList( + node, + node.heritageClauses, + 0 + /* ListFormat.ClassHeritageClauses */ + ); + writeSpace(); + writePunctuation("{"); + emitList( + node, + node.members, + 129 + /* ListFormat.ClassMembers */ + ); + writePunctuation("}"); + if (indentedFlag) { + decreaseIndent(); + } + } + function emitInterfaceDeclaration(node) { + emitModifiers(node, node.modifiers); + writeKeyword("interface"); + writeSpace(); + emit(node.name); + emitTypeParameters(node, node.typeParameters); + emitList( + node, + node.heritageClauses, + 512 + /* ListFormat.HeritageClauses */ + ); + writeSpace(); + writePunctuation("{"); + emitList( + node, + node.members, + 129 + /* ListFormat.InterfaceMembers */ + ); + writePunctuation("}"); + } + function emitTypeAliasDeclaration(node) { + emitModifiers(node, node.modifiers); + writeKeyword("type"); + writeSpace(); + emit(node.name); + emitTypeParameters(node, node.typeParameters); + writeSpace(); + writePunctuation("="); + writeSpace(); + emit(node.type); + writeTrailingSemicolon(); + } + function emitEnumDeclaration(node) { + emitModifiers(node, node.modifiers); + writeKeyword("enum"); + writeSpace(); + emit(node.name); + writeSpace(); + writePunctuation("{"); + emitList( + node, + node.members, + 145 + /* ListFormat.EnumMembers */ + ); + writePunctuation("}"); + } + function emitModuleDeclaration(node) { + emitModifiers(node, node.modifiers); + if (~node.flags & 1024) { + writeKeyword(node.flags & 16 ? "namespace" : "module"); + writeSpace(); + } + emit(node.name); + var body = node.body; + if (!body) + return writeTrailingSemicolon(); + while (body && ts6.isModuleDeclaration(body)) { + writePunctuation("."); + emit(body.name); + body = body.body; + } + writeSpace(); + emit(body); + } + function emitModuleBlock(node) { + pushNameGenerationScope(node); + ts6.forEach(node.statements, generateNames); + emitBlockStatements( + node, + /*forceSingleLine*/ + isEmptyBlock(node) + ); + popNameGenerationScope(node); + } + function emitCaseBlock(node) { + emitTokenWithComment(18, node.pos, writePunctuation, node); + emitList( + node, + node.clauses, + 129 + /* ListFormat.CaseBlockClauses */ + ); + emitTokenWithComment( + 19, + node.clauses.end, + writePunctuation, + node, + /*indentLeading*/ + true + ); + } + function emitImportEqualsDeclaration(node) { + emitModifiers(node, node.modifiers); + emitTokenWithComment(100, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); + writeSpace(); + if (node.isTypeOnly) { + emitTokenWithComment(154, node.pos, writeKeyword, node); + writeSpace(); + } + emit(node.name); + writeSpace(); + emitTokenWithComment(63, node.name.end, writePunctuation, node); + writeSpace(); + emitModuleReference(node.moduleReference); + writeTrailingSemicolon(); + } + function emitModuleReference(node) { + if (node.kind === 79) { + emitExpression(node); + } else { + emit(node); + } + } + function emitImportDeclaration(node) { + emitModifiers(node, node.modifiers); + emitTokenWithComment(100, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); + writeSpace(); + if (node.importClause) { + emit(node.importClause); + writeSpace(); + emitTokenWithComment(158, node.importClause.end, writeKeyword, node); + writeSpace(); + } + emitExpression(node.moduleSpecifier); + if (node.assertClause) { + emitWithLeadingSpace(node.assertClause); + } + writeTrailingSemicolon(); + } + function emitImportClause(node) { + if (node.isTypeOnly) { + emitTokenWithComment(154, node.pos, writeKeyword, node); + writeSpace(); + } + emit(node.name); + if (node.name && node.namedBindings) { + emitTokenWithComment(27, node.name.end, writePunctuation, node); + writeSpace(); + } + emit(node.namedBindings); + } + function emitNamespaceImport(node) { + var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node); + writeSpace(); + emitTokenWithComment(128, asPos, writeKeyword, node); + writeSpace(); + emit(node.name); + } + function emitNamedImports(node) { + emitNamedImportsOrExports(node); + } + function emitImportSpecifier(node) { + emitImportOrExportSpecifier(node); + } + function emitExportAssignment(node) { + var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); + writeSpace(); + if (node.isExportEquals) { + emitTokenWithComment(63, nextPos, writeOperator, node); + } else { + emitTokenWithComment(88, nextPos, writeKeyword, node); + } + writeSpace(); + emitExpression(node.expression, node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator( + 63 + /* SyntaxKind.EqualsToken */ + ) : parenthesizer.parenthesizeExpressionOfExportDefault); + writeTrailingSemicolon(); + } + function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); + var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); + writeSpace(); + if (node.isTypeOnly) { + nextPos = emitTokenWithComment(154, nextPos, writeKeyword, node); + writeSpace(); + } + if (node.exportClause) { + emit(node.exportClause); + } else { + nextPos = emitTokenWithComment(41, nextPos, writePunctuation, node); + } + if (node.moduleSpecifier) { + writeSpace(); + var fromPos = node.exportClause ? node.exportClause.end : nextPos; + emitTokenWithComment(158, fromPos, writeKeyword, node); + writeSpace(); + emitExpression(node.moduleSpecifier); + } + if (node.assertClause) { + emitWithLeadingSpace(node.assertClause); + } + writeTrailingSemicolon(); + } + function emitAssertClause(node) { + emitTokenWithComment(130, node.pos, writeKeyword, node); + writeSpace(); + var elements = node.elements; + emitList( + node, + elements, + 526226 + /* ListFormat.ImportClauseEntries */ + ); + } + function emitAssertEntry(node) { + emit(node.name); + writePunctuation(":"); + writeSpace(); + var value = node.value; + if ((ts6.getEmitFlags(value) & 512) === 0) { + var commentRange = ts6.getCommentRange(value); + emitTrailingCommentsOfPosition(commentRange.pos); + } + emit(value); + } + function emitNamespaceExportDeclaration(node) { + var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); + writeSpace(); + nextPos = emitTokenWithComment(128, nextPos, writeKeyword, node); + writeSpace(); + nextPos = emitTokenWithComment(143, nextPos, writeKeyword, node); + writeSpace(); + emit(node.name); + writeTrailingSemicolon(); + } + function emitNamespaceExport(node) { + var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node); + writeSpace(); + emitTokenWithComment(128, asPos, writeKeyword, node); + writeSpace(); + emit(node.name); + } + function emitNamedExports(node) { + emitNamedImportsOrExports(node); + } + function emitExportSpecifier(node) { + emitImportOrExportSpecifier(node); + } + function emitNamedImportsOrExports(node) { + writePunctuation("{"); + emitList( + node, + node.elements, + 525136 + /* ListFormat.NamedImportsOrExportsElements */ + ); + writePunctuation("}"); + } + function emitImportOrExportSpecifier(node) { + if (node.isTypeOnly) { + writeKeyword("type"); + writeSpace(); + } + if (node.propertyName) { + emit(node.propertyName); + writeSpace(); + emitTokenWithComment(128, node.propertyName.end, writeKeyword, node); + writeSpace(); + } + emit(node.name); + } + function emitExternalModuleReference(node) { + writeKeyword("require"); + writePunctuation("("); + emitExpression(node.expression); + writePunctuation(")"); + } + function emitJsxElement(node) { + emit(node.openingElement); + emitList( + node, + node.children, + 262144 + /* ListFormat.JsxElementOrFragmentChildren */ + ); + emit(node.closingElement); + } + function emitJsxSelfClosingElement(node) { + writePunctuation("<"); + emitJsxTagName(node.tagName); + emitTypeArguments(node, node.typeArguments); + writeSpace(); + emit(node.attributes); + writePunctuation("/>"); + } + function emitJsxFragment(node) { + emit(node.openingFragment); + emitList( + node, + node.children, + 262144 + /* ListFormat.JsxElementOrFragmentChildren */ + ); + emit(node.closingFragment); + } + function emitJsxOpeningElementOrFragment(node) { + writePunctuation("<"); + if (ts6.isJsxOpeningElement(node)) { + var indented = writeLineSeparatorsAndIndentBefore(node.tagName, node); + emitJsxTagName(node.tagName); + emitTypeArguments(node, node.typeArguments); + if (node.attributes.properties && node.attributes.properties.length > 0) { + writeSpace(); + } + emit(node.attributes); + writeLineSeparatorsAfter(node.attributes, node); + decreaseIndentIf(indented); + } + writePunctuation(">"); + } + function emitJsxText(node) { + writer.writeLiteral(node.text); + } + function emitJsxClosingElementOrFragment(node) { + writePunctuation(""); + } + function emitJsxAttributes(node) { + emitList( + node, + node.properties, + 262656 + /* ListFormat.JsxElementAttributes */ + ); + } + function emitJsxAttribute(node) { + emit(node.name); + emitNodeWithPrefix("=", writePunctuation, node.initializer, emitJsxAttributeValue); + } + function emitJsxSpreadAttribute(node) { + writePunctuation("{..."); + emitExpression(node.expression); + writePunctuation("}"); + } + function hasTrailingCommentsAtPosition(pos) { + var result = false; + ts6.forEachTrailingCommentRange((currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.text) || "", pos + 1, function() { + return result = true; + }); + return result; + } + function hasLeadingCommentsAtPosition(pos) { + var result = false; + ts6.forEachLeadingCommentRange((currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.text) || "", pos + 1, function() { + return result = true; + }); + return result; + } + function hasCommentsAtPosition(pos) { + return hasTrailingCommentsAtPosition(pos) || hasLeadingCommentsAtPosition(pos); + } + function emitJsxExpression(node) { + var _a2; + if (node.expression || !commentsDisabled && !ts6.nodeIsSynthesized(node) && hasCommentsAtPosition(node.pos)) { + var isMultiline = currentSourceFile && !ts6.nodeIsSynthesized(node) && ts6.getLineAndCharacterOfPosition(currentSourceFile, node.pos).line !== ts6.getLineAndCharacterOfPosition(currentSourceFile, node.end).line; + if (isMultiline) { + writer.increaseIndent(); + } + var end = emitTokenWithComment(18, node.pos, writePunctuation, node); + emit(node.dotDotDotToken); + emitExpression(node.expression); + emitTokenWithComment(19, ((_a2 = node.expression) === null || _a2 === void 0 ? void 0 : _a2.end) || end, writePunctuation, node); + if (isMultiline) { + writer.decreaseIndent(); + } + } + } + function emitJsxTagName(node) { + if (node.kind === 79) { + emitExpression(node); + } else { + emit(node); + } + } + function emitCaseClause(node) { + emitTokenWithComment(82, node.pos, writeKeyword, node); + writeSpace(); + emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma); + emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end); + } + function emitDefaultClause(node) { + var pos = emitTokenWithComment(88, node.pos, writeKeyword, node); + emitCaseOrDefaultClauseRest(node, node.statements, pos); + } + function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) { + var emitAsSingleStatement = statements.length === 1 && // treat synthesized nodes as located on the same line for emit purposes + (!currentSourceFile || ts6.nodeIsSynthesized(parentNode) || ts6.nodeIsSynthesized(statements[0]) || ts6.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)); + var format = 163969; + if (emitAsSingleStatement) { + writeToken(58, colonPos, writePunctuation, parentNode); + writeSpace(); + format &= ~(1 | 128); + } else { + emitTokenWithComment(58, colonPos, writePunctuation, parentNode); + } + emitList(parentNode, statements, format); + } + function emitHeritageClause(node) { + writeSpace(); + writeTokenText(node.token, writeKeyword); + writeSpace(); + emitList( + node, + node.types, + 528 + /* ListFormat.HeritageClauseTypes */ + ); + } + function emitCatchClause(node) { + var openParenPos = emitTokenWithComment(83, node.pos, writeKeyword, node); + writeSpace(); + if (node.variableDeclaration) { + emitTokenWithComment(20, openParenPos, writePunctuation, node); + emit(node.variableDeclaration); + emitTokenWithComment(21, node.variableDeclaration.end, writePunctuation, node); + writeSpace(); + } + emit(node.block); + } + function emitPropertyAssignment(node) { + emit(node.name); + writePunctuation(":"); + writeSpace(); + var initializer = node.initializer; + if ((ts6.getEmitFlags(initializer) & 512) === 0) { + var commentRange = ts6.getCommentRange(initializer); + emitTrailingCommentsOfPosition(commentRange.pos); + } + emitExpression(initializer, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitShorthandPropertyAssignment(node) { + emit(node.name); + if (node.objectAssignmentInitializer) { + writeSpace(); + writePunctuation("="); + writeSpace(); + emitExpression(node.objectAssignmentInitializer, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + } + function emitSpreadAssignment(node) { + if (node.expression) { + emitTokenWithComment(25, node.pos, writePunctuation, node); + emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + } + function emitEnumMember(node) { + emit(node.name); + emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma); + } + function emitJSDoc(node) { + write("/**"); + if (node.comment) { + var text = ts6.getTextOfJSDocComment(node.comment); + if (text) { + var lines = text.split(/\r\n?|\n/g); + for (var _a2 = 0, lines_2 = lines; _a2 < lines_2.length; _a2++) { + var line = lines_2[_a2]; + writeLine(); + writeSpace(); + writePunctuation("*"); + writeSpace(); + write(line); + } + } + } + if (node.tags) { + if (node.tags.length === 1 && node.tags[0].kind === 346 && !node.comment) { + writeSpace(); + emit(node.tags[0]); + } else { + emitList( + node, + node.tags, + 33 + /* ListFormat.JSDocComment */ + ); + } + } + writeSpace(); + write("*/"); + } + function emitJSDocSimpleTypedTag(tag) { + emitJSDocTagName(tag.tagName); + emitJSDocTypeExpression(tag.typeExpression); + emitJSDocComment(tag.comment); + } + function emitJSDocSeeTag(tag) { + emitJSDocTagName(tag.tagName); + emit(tag.name); + emitJSDocComment(tag.comment); + } + function emitJSDocNameReference(node) { + writeSpace(); + writePunctuation("{"); + emit(node.name); + writePunctuation("}"); + } + function emitJSDocHeritageTag(tag) { + emitJSDocTagName(tag.tagName); + writeSpace(); + writePunctuation("{"); + emit(tag.class); + writePunctuation("}"); + emitJSDocComment(tag.comment); + } + function emitJSDocTemplateTag(tag) { + emitJSDocTagName(tag.tagName); + emitJSDocTypeExpression(tag.constraint); + writeSpace(); + emitList( + tag, + tag.typeParameters, + 528 + /* ListFormat.CommaListElements */ + ); + emitJSDocComment(tag.comment); + } + function emitJSDocTypedefTag(tag) { + emitJSDocTagName(tag.tagName); + if (tag.typeExpression) { + if (tag.typeExpression.kind === 312) { + emitJSDocTypeExpression(tag.typeExpression); + } else { + writeSpace(); + writePunctuation("{"); + write("Object"); + if (tag.typeExpression.isArrayType) { + writePunctuation("["); + writePunctuation("]"); + } + writePunctuation("}"); + } + } + if (tag.fullName) { + writeSpace(); + emit(tag.fullName); + } + emitJSDocComment(tag.comment); + if (tag.typeExpression && tag.typeExpression.kind === 325) { + emitJSDocTypeLiteral(tag.typeExpression); + } + } + function emitJSDocCallbackTag(tag) { + emitJSDocTagName(tag.tagName); + if (tag.name) { + writeSpace(); + emit(tag.name); + } + emitJSDocComment(tag.comment); + emitJSDocSignature(tag.typeExpression); + } + function emitJSDocSimpleTag(tag) { + emitJSDocTagName(tag.tagName); + emitJSDocComment(tag.comment); + } + function emitJSDocTypeLiteral(lit) { + emitList( + lit, + ts6.factory.createNodeArray(lit.jsDocPropertyTags), + 33 + /* ListFormat.JSDocComment */ + ); + } + function emitJSDocSignature(sig) { + if (sig.typeParameters) { + emitList( + sig, + ts6.factory.createNodeArray(sig.typeParameters), + 33 + /* ListFormat.JSDocComment */ + ); + } + if (sig.parameters) { + emitList( + sig, + ts6.factory.createNodeArray(sig.parameters), + 33 + /* ListFormat.JSDocComment */ + ); + } + if (sig.type) { + writeLine(); + writeSpace(); + writePunctuation("*"); + writeSpace(); + emit(sig.type); + } + } + function emitJSDocPropertyLikeTag(param) { + emitJSDocTagName(param.tagName); + emitJSDocTypeExpression(param.typeExpression); + writeSpace(); + if (param.isBracketed) { + writePunctuation("["); + } + emit(param.name); + if (param.isBracketed) { + writePunctuation("]"); + } + emitJSDocComment(param.comment); + } + function emitJSDocTagName(tagName) { + writePunctuation("@"); + emit(tagName); + } + function emitJSDocComment(comment) { + var text = ts6.getTextOfJSDocComment(comment); + if (text) { + writeSpace(); + write(text); + } + } + function emitJSDocTypeExpression(typeExpression) { + if (typeExpression) { + writeSpace(); + writePunctuation("{"); + emit(typeExpression.type); + writePunctuation("}"); + } + } + function emitSourceFile(node) { + writeLine(); + var statements = node.statements; + var shouldEmitDetachedComment = statements.length === 0 || !ts6.isPrologueDirective(statements[0]) || ts6.nodeIsSynthesized(statements[0]); + if (shouldEmitDetachedComment) { + emitBodyWithDetachedComments(node, statements, emitSourceFileWorker); + return; + } + emitSourceFileWorker(node); + } + function emitSyntheticTripleSlashReferencesIfNeeded(node) { + emitTripleSlashDirectives(!!node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []); + for (var _a2 = 0, _b2 = node.prepends; _a2 < _b2.length; _a2++) { + var prepend = _b2[_a2]; + if (ts6.isUnparsedSource(prepend) && prepend.syntheticReferences) { + for (var _c2 = 0, _d = prepend.syntheticReferences; _c2 < _d.length; _c2++) { + var ref = _d[_c2]; + emit(ref); + writeLine(); + } + } + } + } + function emitTripleSlashDirectivesIfNeeded(node) { + if (node.isDeclarationFile) + emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives); + } + function emitTripleSlashDirectives(hasNoDefaultLib, files, types, libs) { + if (hasNoDefaultLib) { + var pos = writer.getTextPos(); + writeComment('/// '); + if (bundleFileInfo) + bundleFileInfo.sections.push({ + pos, + end: writer.getTextPos(), + kind: "no-default-lib" + /* BundleFileSectionKind.NoDefaultLib */ + }); + writeLine(); + } + if (currentSourceFile && currentSourceFile.moduleName) { + writeComment('/// ')); + writeLine(); + } + if (currentSourceFile && currentSourceFile.amdDependencies) { + for (var _a2 = 0, _b2 = currentSourceFile.amdDependencies; _a2 < _b2.length; _a2++) { + var dep = _b2[_a2]; + if (dep.name) { + writeComment('/// ')); + } else { + writeComment('/// ')); + } + writeLine(); + } + } + for (var _c2 = 0, files_2 = files; _c2 < files_2.length; _c2++) { + var directive = files_2[_c2]; + var pos = writer.getTextPos(); + writeComment('/// ')); + if (bundleFileInfo) + bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "reference", data: directive.fileName }); + writeLine(); + } + for (var _d = 0, types_23 = types; _d < types_23.length; _d++) { + var directive = types_23[_d]; + var pos = writer.getTextPos(); + var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat) ? 'resolution-mode="'.concat(directive.resolutionMode === ts6.ModuleKind.ESNext ? "import" : "require", '"') : ""; + writeComment('/// ")); + if (bundleFileInfo) + bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: !directive.resolutionMode ? "type" : directive.resolutionMode === ts6.ModuleKind.ESNext ? "type-import" : "type-require", data: directive.fileName }); + writeLine(); + } + for (var _e = 0, libs_1 = libs; _e < libs_1.length; _e++) { + var directive = libs_1[_e]; + var pos = writer.getTextPos(); + writeComment('/// ')); + if (bundleFileInfo) + bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "lib", data: directive.fileName }); + writeLine(); + } + } + function emitSourceFileWorker(node) { + var statements = node.statements; + pushNameGenerationScope(node); + ts6.forEach(node.statements, generateNames); + emitHelpers(node); + var index = ts6.findIndex(statements, function(statement) { + return !ts6.isPrologueDirective(statement); + }); + emitTripleSlashDirectivesIfNeeded(node); + emitList( + node, + statements, + 1, + /*parenthesizerRule*/ + void 0, + index === -1 ? statements.length : index + ); + popNameGenerationScope(node); + } + function emitPartiallyEmittedExpression(node) { + var emitFlags = ts6.getEmitFlags(node); + if (!(emitFlags & 512) && node.pos !== node.expression.pos) { + emitTrailingCommentsOfPosition(node.expression.pos); + } + emitExpression(node.expression); + if (!(emitFlags & 1024) && node.end !== node.expression.end) { + emitLeadingCommentsOfPosition(node.expression.end); + } + } + function emitCommaList(node) { + emitExpressionList( + node, + node.elements, + 528, + /*parenthesizerRule*/ + void 0 + ); + } + function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) { + var needsToSetSourceFile = !!sourceFile; + for (var i = 0; i < statements.length; i++) { + var statement = statements[i]; + if (ts6.isPrologueDirective(statement)) { + var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; + if (shouldEmitPrologueDirective) { + if (needsToSetSourceFile) { + needsToSetSourceFile = false; + setSourceFile(sourceFile); + } + writeLine(); + var pos = writer.getTextPos(); + emit(statement); + if (recordBundleFileSection && bundleFileInfo) + bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "prologue", data: statement.expression.text }); + if (seenPrologueDirectives) { + seenPrologueDirectives.add(statement.expression.text); + } + } + } else { + return i; + } + } + return statements.length; + } + function emitUnparsedPrologues(prologues, seenPrologueDirectives) { + for (var _a2 = 0, prologues_1 = prologues; _a2 < prologues_1.length; _a2++) { + var prologue = prologues_1[_a2]; + if (!seenPrologueDirectives.has(prologue.data)) { + writeLine(); + var pos = writer.getTextPos(); + emit(prologue); + if (bundleFileInfo) + bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "prologue", data: prologue.data }); + if (seenPrologueDirectives) { + seenPrologueDirectives.add(prologue.data); + } + } + } + } + function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { + if (ts6.isSourceFile(sourceFileOrBundle)) { + emitPrologueDirectives(sourceFileOrBundle.statements, sourceFileOrBundle); + } else { + var seenPrologueDirectives = new ts6.Set(); + for (var _a2 = 0, _b2 = sourceFileOrBundle.prepends; _a2 < _b2.length; _a2++) { + var prepend = _b2[_a2]; + emitUnparsedPrologues(prepend.prologues, seenPrologueDirectives); + } + for (var _c2 = 0, _d = sourceFileOrBundle.sourceFiles; _c2 < _d.length; _c2++) { + var sourceFile = _d[_c2]; + emitPrologueDirectives( + sourceFile.statements, + sourceFile, + seenPrologueDirectives, + /*recordBundleFileSection*/ + true + ); + } + setSourceFile(void 0); + } + } + function getPrologueDirectivesFromBundledSourceFiles(bundle) { + var seenPrologueDirectives = new ts6.Set(); + var prologues; + for (var index = 0; index < bundle.sourceFiles.length; index++) { + var sourceFile = bundle.sourceFiles[index]; + var directives = void 0; + var end = 0; + for (var _a2 = 0, _b2 = sourceFile.statements; _a2 < _b2.length; _a2++) { + var statement = _b2[_a2]; + if (!ts6.isPrologueDirective(statement)) + break; + if (seenPrologueDirectives.has(statement.expression.text)) + continue; + seenPrologueDirectives.add(statement.expression.text); + (directives || (directives = [])).push({ + pos: statement.pos, + end: statement.end, + expression: { + pos: statement.expression.pos, + end: statement.expression.end, + text: statement.expression.text + } + }); + end = end < statement.end ? statement.end : end; + } + if (directives) + (prologues || (prologues = [])).push({ file: index, text: sourceFile.text.substring(0, end), directives }); + } + return prologues; + } + function emitShebangIfNeeded(sourceFileOrBundle) { + if (ts6.isSourceFile(sourceFileOrBundle) || ts6.isUnparsedSource(sourceFileOrBundle)) { + var shebang = ts6.getShebang(sourceFileOrBundle.text); + if (shebang) { + writeComment(shebang); + writeLine(); + return true; + } + } else { + for (var _a2 = 0, _b2 = sourceFileOrBundle.prepends; _a2 < _b2.length; _a2++) { + var prepend = _b2[_a2]; + ts6.Debug.assertNode(prepend, ts6.isUnparsedSource); + if (emitShebangIfNeeded(prepend)) { + return true; + } + } + for (var _c2 = 0, _d = sourceFileOrBundle.sourceFiles; _c2 < _d.length; _c2++) { + var sourceFile = _d[_c2]; + if (emitShebangIfNeeded(sourceFile)) { + return true; + } + } + } + } + function emitNodeWithWriter(node, writer2) { + if (!node) + return; + var savedWrite = write; + write = writer2; + emit(node); + write = savedWrite; + } + function emitDecoratorsAndModifiers(node, modifiers) { + if (modifiers === null || modifiers === void 0 ? void 0 : modifiers.length) { + if (ts6.every(modifiers, ts6.isModifier)) { + return emitModifiers(node, modifiers); + } + if (ts6.every(modifiers, ts6.isDecorator)) { + return emitDecorators(node, modifiers); + } + onBeforeEmitNodeArray === null || onBeforeEmitNodeArray === void 0 ? void 0 : onBeforeEmitNodeArray(modifiers); + var lastMode = void 0; + var mode = void 0; + var start = 0; + var pos = 0; + while (start < modifiers.length) { + while (pos < modifiers.length) { + var modifier = modifiers[pos]; + mode = ts6.isDecorator(modifier) ? "decorators" : "modifiers"; + if (lastMode === void 0) { + lastMode = mode; + } else if (mode !== lastMode) { + break; + } + pos++; + } + var textRange = { pos: -1, end: -1 }; + if (start === 0) + textRange.pos = modifiers.pos; + if (pos === modifiers.length - 1) + textRange.end = modifiers.end; + emitNodeListItems( + emit, + node, + modifiers, + lastMode === "modifiers" ? 2359808 : 2146305, + /*parenthesizerRule*/ + void 0, + start, + pos - start, + /*hasTrailingComma*/ + false, + textRange + ); + start = pos; + lastMode = mode; + pos++; + } + onAfterEmitNodeArray === null || onAfterEmitNodeArray === void 0 ? void 0 : onAfterEmitNodeArray(modifiers); + } + } + function emitModifiers(node, modifiers) { + emitList( + node, + modifiers, + 2359808 + /* ListFormat.Modifiers */ + ); + } + function emitTypeAnnotation(node) { + if (node) { + writePunctuation(":"); + writeSpace(); + emit(node); + } + } + function emitInitializer(node, equalCommentStartPos, container, parenthesizerRule) { + if (node) { + writeSpace(); + emitTokenWithComment(63, equalCommentStartPos, writeOperator, container); + writeSpace(); + emitExpression(node, parenthesizerRule); + } + } + function emitNodeWithPrefix(prefix2, prefixWriter, node, emit2) { + if (node) { + prefixWriter(prefix2); + emit2(node); + } + } + function emitWithLeadingSpace(node) { + if (node) { + writeSpace(); + emit(node); + } + } + function emitExpressionWithLeadingSpace(node, parenthesizerRule) { + if (node) { + writeSpace(); + emitExpression(node, parenthesizerRule); + } + } + function emitWithTrailingSpace(node) { + if (node) { + emit(node); + writeSpace(); + } + } + function emitEmbeddedStatement(parent, node) { + if (ts6.isBlock(node) || ts6.getEmitFlags(parent) & 1) { + writeSpace(); + emit(node); + } else { + writeLine(); + increaseIndent(); + if (ts6.isEmptyStatement(node)) { + pipelineEmit(5, node); + } else { + emit(node); + } + decreaseIndent(); + } + } + function emitDecorators(parentNode, decorators) { + emitList( + parentNode, + decorators, + 2146305 + /* ListFormat.Decorators */ + ); + } + function emitTypeArguments(parentNode, typeArguments) { + emitList(parentNode, typeArguments, 53776, typeArgumentParenthesizerRuleSelector); + } + function emitTypeParameters(parentNode, typeParameters) { + if (ts6.isFunctionLike(parentNode) && parentNode.typeArguments) { + return emitTypeArguments(parentNode, parentNode.typeArguments); + } + emitList( + parentNode, + typeParameters, + 53776 + /* ListFormat.TypeParameters */ + ); + } + function emitParameters(parentNode, parameters) { + emitList( + parentNode, + parameters, + 2576 + /* ListFormat.Parameters */ + ); + } + function canEmitSimpleArrowHead(parentNode, parameters) { + var parameter = ts6.singleOrUndefined(parameters); + return parameter && parameter.pos === parentNode.pos && ts6.isArrowFunction(parentNode) && !parentNode.type && !ts6.some(parentNode.modifiers) && !ts6.some(parentNode.typeParameters) && !ts6.some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && ts6.isIdentifier(parameter.name); + } + function emitParametersForArrow(parentNode, parameters) { + if (canEmitSimpleArrowHead(parentNode, parameters)) { + emitList( + parentNode, + parameters, + 2576 & ~2048 + /* ListFormat.Parenthesis */ + ); + } else { + emitParameters(parentNode, parameters); + } + } + function emitParametersForIndexSignature(parentNode, parameters) { + emitList( + parentNode, + parameters, + 8848 + /* ListFormat.IndexSignatureParameters */ + ); + } + function writeDelimiter(format) { + switch (format & 60) { + case 0: + break; + case 16: + writePunctuation(","); + break; + case 4: + writeSpace(); + writePunctuation("|"); + break; + case 32: + writeSpace(); + writePunctuation("*"); + writeSpace(); + break; + case 8: + writeSpace(); + writePunctuation("&"); + break; + } + } + function emitList(parentNode, children, format, parenthesizerRule, start, count) { + emitNodeList(emit, parentNode, children, format, parenthesizerRule, start, count); + } + function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count) { + emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count); + } + function emitNodeList(emit2, parentNode, children, format, parenthesizerRule, start, count) { + if (start === void 0) { + start = 0; + } + if (count === void 0) { + count = children ? children.length - start : 0; + } + var isUndefined = children === void 0; + if (isUndefined && format & 16384) { + return; + } + var isEmpty = children === void 0 || start >= children.length || count === 0; + if (isEmpty && format & 32768) { + onBeforeEmitNodeArray === null || onBeforeEmitNodeArray === void 0 ? void 0 : onBeforeEmitNodeArray(children); + onAfterEmitNodeArray === null || onAfterEmitNodeArray === void 0 ? void 0 : onAfterEmitNodeArray(children); + return; + } + if (format & 15360) { + writePunctuation(getOpeningBracket(format)); + if (isEmpty && children) { + emitTrailingCommentsOfPosition( + children.pos, + /*prefixSpace*/ + true + ); + } + } + onBeforeEmitNodeArray === null || onBeforeEmitNodeArray === void 0 ? void 0 : onBeforeEmitNodeArray(children); + if (isEmpty) { + if (format & 1 && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts6.rangeIsOnSingleLine(parentNode, currentSourceFile)))) { + writeLine(); + } else if (format & 256 && !(format & 524288)) { + writeSpace(); + } + } else { + emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count, children.hasTrailingComma, children); + } + onAfterEmitNodeArray === null || onAfterEmitNodeArray === void 0 ? void 0 : onAfterEmitNodeArray(children); + if (format & 15360) { + if (isEmpty && children) { + emitLeadingCommentsOfPosition(children.end); + } + writePunctuation(getClosingBracket(format)); + } + } + function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count, hasTrailingComma, childrenTextRange) { + var mayEmitInterveningComments = (format & 262144) === 0; + var shouldEmitInterveningComments = mayEmitInterveningComments; + var leadingLineTerminatorCount = getLeadingLineTerminatorCount(parentNode, children[start], format); + if (leadingLineTerminatorCount) { + writeLine(leadingLineTerminatorCount); + shouldEmitInterveningComments = false; + } else if (format & 256) { + writeSpace(); + } + if (format & 128) { + increaseIndent(); + } + var emitListItem = getEmitListItem(emit2, parenthesizerRule); + var previousSibling; + var previousSourceFileTextKind; + var shouldDecreaseIndentAfterEmit = false; + for (var i = 0; i < count; i++) { + var child = children[start + i]; + if (format & 32) { + writeLine(); + writeDelimiter(format); + } else if (previousSibling) { + if (format & 60 && previousSibling.end !== (parentNode ? parentNode.end : -1)) { + emitLeadingCommentsOfPosition(previousSibling.end); + } + writeDelimiter(format); + recordBundleFileInternalSectionEnd(previousSourceFileTextKind); + var separatingLineTerminatorCount = getSeparatingLineTerminatorCount(previousSibling, child, format); + if (separatingLineTerminatorCount > 0) { + if ((format & (3 | 128)) === 0) { + increaseIndent(); + shouldDecreaseIndentAfterEmit = true; + } + writeLine(separatingLineTerminatorCount); + shouldEmitInterveningComments = false; + } else if (previousSibling && format & 512) { + writeSpace(); + } + } + previousSourceFileTextKind = recordBundleFileInternalSectionStart(child); + if (shouldEmitInterveningComments) { + var commentRange = ts6.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } else { + shouldEmitInterveningComments = mayEmitInterveningComments; + } + nextListElementPos = child.pos; + emitListItem(child, emit2, parenthesizerRule, i); + if (shouldDecreaseIndentAfterEmit) { + decreaseIndent(); + shouldDecreaseIndentAfterEmit = false; + } + previousSibling = child; + } + var emitFlags = previousSibling ? ts6.getEmitFlags(previousSibling) : 0; + var skipTrailingComments = commentsDisabled || !!(emitFlags & 1024); + var emitTrailingComma = hasTrailingComma && format & 64 && format & 16; + if (emitTrailingComma) { + if (previousSibling && !skipTrailingComments) { + emitTokenWithComment(27, previousSibling.end, writePunctuation, previousSibling); + } else { + writePunctuation(","); + } + } + if (previousSibling && (parentNode ? parentNode.end : -1) !== previousSibling.end && format & 60 && !skipTrailingComments) { + emitLeadingCommentsOfPosition(emitTrailingComma && (childrenTextRange === null || childrenTextRange === void 0 ? void 0 : childrenTextRange.end) ? childrenTextRange.end : previousSibling.end); + } + if (format & 128) { + decreaseIndent(); + } + recordBundleFileInternalSectionEnd(previousSourceFileTextKind); + var closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count - 1], format, childrenTextRange); + if (closingLineTerminatorCount) { + writeLine(closingLineTerminatorCount); + } else if (format & (2097152 | 256)) { + writeSpace(); + } + } + function writeLiteral(s) { + writer.writeLiteral(s); + } + function writeStringLiteral(s) { + writer.writeStringLiteral(s); + } + function writeBase(s) { + writer.write(s); + } + function writeSymbol(s, sym) { + writer.writeSymbol(s, sym); + } + function writePunctuation(s) { + writer.writePunctuation(s); + } + function writeTrailingSemicolon() { + writer.writeTrailingSemicolon(";"); + } + function writeKeyword(s) { + writer.writeKeyword(s); + } + function writeOperator(s) { + writer.writeOperator(s); + } + function writeParameter(s) { + writer.writeParameter(s); + } + function writeComment(s) { + writer.writeComment(s); + } + function writeSpace() { + writer.writeSpace(" "); + } + function writeProperty(s) { + writer.writeProperty(s); + } + function nonEscapingWrite(s) { + if (writer.nonEscapingWrite) { + writer.nonEscapingWrite(s); + } else { + writer.write(s); + } + } + function writeLine(count) { + if (count === void 0) { + count = 1; + } + for (var i = 0; i < count; i++) { + writer.writeLine(i > 0); + } + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } + function writeToken(token, pos, writer2, contextNode) { + return !sourceMapsDisabled ? emitTokenWithSourceMap(contextNode, token, writer2, pos, writeTokenText) : writeTokenText(token, writer2, pos); + } + function writeTokenNode(node, writer2) { + if (onBeforeEmitToken) { + onBeforeEmitToken(node); + } + writer2(ts6.tokenToString(node.kind)); + if (onAfterEmitToken) { + onAfterEmitToken(node); + } + } + function writeTokenText(token, writer2, pos) { + var tokenString = ts6.tokenToString(token); + writer2(tokenString); + return pos < 0 ? pos : pos + tokenString.length; + } + function writeLineOrSpace(parentNode, prevChildNode, nextChildNode) { + if (ts6.getEmitFlags(parentNode) & 1) { + writeSpace(); + } else if (preserveSourceNewlines) { + var lines = getLinesBetweenNodes(parentNode, prevChildNode, nextChildNode); + if (lines) { + writeLine(lines); + } else { + writeSpace(); + } + } else { + writeLine(); + } + } + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = ts6.guessIndentation(lines); + for (var _a2 = 0, lines_3 = lines; _a2 < lines_3.length; _a2++) { + var lineText = lines_3[_a2]; + var line = indentation ? lineText.slice(indentation) : lineText; + if (line.length) { + writeLine(); + write(line); + } + } + } + function writeLinesAndIndent(lineCount, writeSpaceIfNotIndenting) { + if (lineCount) { + increaseIndent(); + writeLine(lineCount); + } else if (writeSpaceIfNotIndenting) { + writeSpace(); + } + } + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function getLeadingLineTerminatorCount(parentNode, firstChild, format) { + if (format & 2 || preserveSourceNewlines) { + if (format & 65536) { + return 1; + } + if (firstChild === void 0) { + return !parentNode || currentSourceFile && ts6.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1; + } + if (firstChild.pos === nextListElementPos) { + return 0; + } + if (firstChild.kind === 11) { + return 0; + } + if (currentSourceFile && parentNode && !ts6.positionIsSynthesized(parentNode.pos) && !ts6.nodeIsSynthesized(firstChild) && (!firstChild.parent || ts6.getOriginalNode(firstChild.parent) === ts6.getOriginalNode(parentNode))) { + if (preserveSourceNewlines) { + return getEffectiveLines(function(includeComments) { + return ts6.getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(firstChild.pos, parentNode.pos, currentSourceFile, includeComments); + }); + } + return ts6.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile) ? 0 : 1; + } + if (synthesizedNodeStartsOnNewLine(firstChild, format)) { + return 1; + } + } + return format & 1 ? 1 : 0; + } + function getSeparatingLineTerminatorCount(previousNode, nextNode, format) { + if (format & 2 || preserveSourceNewlines) { + if (previousNode === void 0 || nextNode === void 0) { + return 0; + } + if (nextNode.kind === 11) { + return 0; + } else if (currentSourceFile && !ts6.nodeIsSynthesized(previousNode) && !ts6.nodeIsSynthesized(nextNode)) { + if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) { + return getEffectiveLines(function(includeComments) { + return ts6.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); + }); + } else if (!preserveSourceNewlines && originalNodesHaveSameParent(previousNode, nextNode)) { + return ts6.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1; + } + return format & 65536 ? 1 : 0; + } else if (synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format)) { + return 1; + } + } else if (ts6.getStartsOnNewLine(nextNode)) { + return 1; + } + return format & 1 ? 1 : 0; + } + function getClosingLineTerminatorCount(parentNode, lastChild, format, childrenTextRange) { + if (format & 2 || preserveSourceNewlines) { + if (format & 65536) { + return 1; + } + if (lastChild === void 0) { + return !parentNode || currentSourceFile && ts6.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1; + } + if (currentSourceFile && parentNode && !ts6.positionIsSynthesized(parentNode.pos) && !ts6.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) { + if (preserveSourceNewlines) { + var end_1 = childrenTextRange && !ts6.positionIsSynthesized(childrenTextRange.end) ? childrenTextRange.end : lastChild.end; + return getEffectiveLines(function(includeComments) { + return ts6.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); + }); + } + return ts6.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile) ? 0 : 1; + } + if (synthesizedNodeStartsOnNewLine(lastChild, format)) { + return 1; + } + } + if (format & 1 && !(format & 131072)) { + return 1; + } + return 0; + } + function getEffectiveLines(getLineDifference) { + ts6.Debug.assert(!!preserveSourceNewlines); + var lines = getLineDifference( + /*includeComments*/ + true + ); + if (lines === 0) { + return getLineDifference( + /*includeComments*/ + false + ); + } + return lines; + } + function writeLineSeparatorsAndIndentBefore(node, parent) { + var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount( + parent, + node, + 0 + /* ListFormat.None */ + ); + if (leadingNewlines) { + writeLinesAndIndent( + leadingNewlines, + /*writeSpaceIfNotIndenting*/ + false + ); + } + return !!leadingNewlines; + } + function writeLineSeparatorsAfter(node, parent) { + var trailingNewlines = preserveSourceNewlines && getClosingLineTerminatorCount( + parent, + node, + 0, + /*childrenTextRange*/ + void 0 + ); + if (trailingNewlines) { + writeLine(trailingNewlines); + } + } + function synthesizedNodeStartsOnNewLine(node, format) { + if (ts6.nodeIsSynthesized(node)) { + var startsOnNewLine = ts6.getStartsOnNewLine(node); + if (startsOnNewLine === void 0) { + return (format & 65536) !== 0; + } + return startsOnNewLine; + } + return (format & 65536) !== 0; + } + function getLinesBetweenNodes(parent, node1, node2) { + if (ts6.getEmitFlags(parent) & 131072) { + return 0; + } + parent = skipSynthesizedParentheses(parent); + node1 = skipSynthesizedParentheses(node1); + node2 = skipSynthesizedParentheses(node2); + if (ts6.getStartsOnNewLine(node2)) { + return 1; + } + if (currentSourceFile && !ts6.nodeIsSynthesized(parent) && !ts6.nodeIsSynthesized(node1) && !ts6.nodeIsSynthesized(node2)) { + if (preserveSourceNewlines) { + return getEffectiveLines(function(includeComments) { + return ts6.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); + }); + } + return ts6.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile) ? 0 : 1; + } + return 0; + } + function isEmptyBlock(block) { + return block.statements.length === 0 && (!currentSourceFile || ts6.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); + } + function skipSynthesizedParentheses(node) { + while (node.kind === 214 && ts6.nodeIsSynthesized(node)) { + node = node.expression; + } + return node; + } + function getTextOfNode(node, includeTrivia) { + if (ts6.isGeneratedIdentifier(node) || ts6.isGeneratedPrivateIdentifier(node)) { + return generateName(node); + } + if (ts6.isStringLiteral(node) && node.textSourceNode) { + return getTextOfNode(node.textSourceNode, includeTrivia); + } + var sourceFile = currentSourceFile; + var canUseSourceFile = !!sourceFile && !!node.parent && !ts6.nodeIsSynthesized(node); + if (ts6.isMemberName(node)) { + if (!canUseSourceFile || ts6.getSourceFileOfNode(node) !== ts6.getOriginalNode(sourceFile)) { + return ts6.idText(node); + } + } else { + ts6.Debug.assertNode(node, ts6.isLiteralExpression); + if (!canUseSourceFile) { + return node.text; + } + } + return ts6.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia); + } + function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { + if (node.kind === 10 && node.textSourceNode) { + var textSourceNode = node.textSourceNode; + if (ts6.isIdentifier(textSourceNode) || ts6.isPrivateIdentifier(textSourceNode) || ts6.isNumericLiteral(textSourceNode)) { + var text = ts6.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); + return jsxAttributeEscape ? '"'.concat(ts6.escapeJsxAttributeString(text), '"') : neverAsciiEscape || ts6.getEmitFlags(node) & 16777216 ? '"'.concat(ts6.escapeString(text), '"') : '"'.concat(ts6.escapeNonAsciiString(text), '"'); + } else { + return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape); + } + } + var flags = (neverAsciiEscape ? 1 : 0) | (jsxAttributeEscape ? 2 : 0) | (printerOptions.terminateUnterminatedLiterals ? 4 : 0) | (printerOptions.target && printerOptions.target === 99 ? 8 : 0); + return ts6.getLiteralText(node, currentSourceFile, flags); + } + function pushNameGenerationScope(node) { + if (node && ts6.getEmitFlags(node) & 524288) { + return; + } + tempFlagsStack.push(tempFlags); + tempFlags = 0; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = void 0; + reservedNamesStack.push(reservedNames); + } + function popNameGenerationScope(node) { + if (node && ts6.getEmitFlags(node) & 524288) { + return; + } + tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); + reservedNames = reservedNamesStack.pop(); + } + function reserveNameInNestedScopes(name) { + if (!reservedNames || reservedNames === ts6.lastOrUndefined(reservedNamesStack)) { + reservedNames = new ts6.Set(); + } + reservedNames.add(name); + } + function generateNames(node) { + if (!node) + return; + switch (node.kind) { + case 238: + ts6.forEach(node.statements, generateNames); + break; + case 253: + case 251: + case 243: + case 244: + generateNames(node.statement); + break; + case 242: + generateNames(node.thenStatement); + generateNames(node.elseStatement); + break; + case 245: + case 247: + case 246: + generateNames(node.initializer); + generateNames(node.statement); + break; + case 252: + generateNames(node.caseBlock); + break; + case 266: + ts6.forEach(node.clauses, generateNames); + break; + case 292: + case 293: + ts6.forEach(node.statements, generateNames); + break; + case 255: + generateNames(node.tryBlock); + generateNames(node.catchClause); + generateNames(node.finallyBlock); + break; + case 295: + generateNames(node.variableDeclaration); + generateNames(node.block); + break; + case 240: + generateNames(node.declarationList); + break; + case 258: + ts6.forEach(node.declarations, generateNames); + break; + case 257: + case 166: + case 205: + case 260: + generateNameIfNeeded(node.name); + break; + case 259: + generateNameIfNeeded(node.name); + if (ts6.getEmitFlags(node) & 524288) { + ts6.forEach(node.parameters, generateNames); + generateNames(node.body); + } + break; + case 203: + case 204: + ts6.forEach(node.elements, generateNames); + break; + case 269: + generateNames(node.importClause); + break; + case 270: + generateNameIfNeeded(node.name); + generateNames(node.namedBindings); + break; + case 271: + generateNameIfNeeded(node.name); + break; + case 277: + generateNameIfNeeded(node.name); + break; + case 272: + ts6.forEach(node.elements, generateNames); + break; + case 273: + generateNameIfNeeded(node.propertyName || node.name); + break; + } + } + function generateMemberNames(node) { + if (!node) + return; + switch (node.kind) { + case 299: + case 300: + case 169: + case 171: + case 174: + case 175: + generateNameIfNeeded(node.name); + break; + } + } + function generateNameIfNeeded(name) { + if (name) { + if (ts6.isGeneratedIdentifier(name) || ts6.isGeneratedPrivateIdentifier(name)) { + generateName(name); + } else if (ts6.isBindingPattern(name)) { + generateNames(name); + } + } + } + function generateName(name) { + if ((name.autoGenerateFlags & 7) === 4) { + return generateNameCached(ts6.getNodeForGeneratedName(name), ts6.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); + } else { + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); + } + } + function generateNameCached(node, privateName, flags, prefix2, suffix) { + var nodeId = ts6.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0, ts6.formatGeneratedNamePart(prefix2, generateName), ts6.formatGeneratedNamePart(suffix))); + } + function isUniqueName(name) { + return isFileLevelUniqueName(name) && !generatedNames.has(name) && !(reservedNames && reservedNames.has(name)); + } + function isFileLevelUniqueName(name) { + return currentSourceFile ? ts6.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true; + } + function isUniqueLocalName(name, container) { + for (var node = container; ts6.isNodeDescendantOf(node, container); node = node.nextContainer) { + if (node.locals) { + var local = node.locals.get(ts6.escapeLeadingUnderscores(name)); + if (local && local.flags & (111551 | 1048576 | 2097152)) { + return false; + } + } + } + return true; + } + function getTempFlags(formattedNameKey) { + var _a2; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a2 = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a2 !== void 0 ? _a2 : 0; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : formattedNameTempFlags = new ts6.Map(); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix2, suffix) { + if (prefix2.length > 0 && prefix2.charCodeAt(0) === 35) { + prefix2 = prefix2.slice(1); + } + var key = ts6.formatGeneratedName(privateName, prefix2, "", suffix); + var tempFlags2 = getTempFlags(key); + if (flags && !(tempFlags2 & flags)) { + var name = flags === 268435456 ? "_i" : "_n"; + var fullName = ts6.formatGeneratedName(privateName, prefix2, name, suffix); + if (isUniqueName(fullName)) { + tempFlags2 |= flags; + if (reservedInNestedScopes) { + reserveNameInNestedScopes(fullName); + } + setTempFlags(key, tempFlags2); + return fullName; + } + } + while (true) { + var count = tempFlags2 & 268435455; + tempFlags2++; + if (count !== 8 && count !== 13) { + var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + var fullName = ts6.formatGeneratedName(privateName, prefix2, name, suffix); + if (isUniqueName(fullName)) { + if (reservedInNestedScopes) { + reserveNameInNestedScopes(fullName); + } + setTempFlags(key, tempFlags2); + return fullName; + } + } + } + } + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix2, suffix) { + if (checkFn === void 0) { + checkFn = isUniqueName; + } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35) { + baseName = baseName.slice(1); + } + if (prefix2.length > 0 && prefix2.charCodeAt(0) === 35) { + prefix2 = prefix2.slice(1); + } + if (optimistic) { + var fullName = ts6.formatGeneratedName(privateName, prefix2, baseName, suffix); + if (checkFn(fullName)) { + if (scoped) { + reserveNameInNestedScopes(fullName); + } else { + generatedNames.add(fullName); + } + return fullName; + } + } + if (baseName.charCodeAt(baseName.length - 1) !== 95) { + baseName += "_"; + } + var i = 1; + while (true) { + var fullName = ts6.formatGeneratedName(privateName, prefix2, baseName + i, suffix); + if (checkFn(fullName)) { + if (scoped) { + reserveNameInNestedScopes(fullName); + } else { + generatedNames.add(fullName); + } + return fullName; + } + i++; + } + } + function makeFileLevelOptimisticUniqueName(name) { + return makeUniqueName( + name, + isFileLevelUniqueName, + /*optimistic*/ + true, + /*scoped*/ + false, + /*privateName*/ + false, + /*prefix*/ + "", + /*suffix*/ + "" + ); + } + function generateNameForModuleOrEnum(node) { + var name = getTextOfNode(node.name); + return isUniqueLocalName(name, node) ? name : makeUniqueName( + name, + isUniqueName, + /*optimistic*/ + false, + /*scoped*/ + false, + /*privateName*/ + false, + /*prefix*/ + "", + /*suffix*/ + "" + ); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts6.getExternalModuleName(node); + var baseName = ts6.isStringLiteral(expr) ? ts6.makeIdentifierFromModuleName(expr.text) : "module"; + return makeUniqueName( + baseName, + isUniqueName, + /*optimistic*/ + false, + /*scoped*/ + false, + /*privateName*/ + false, + /*prefix*/ + "", + /*suffix*/ + "" + ); + } + function generateNameForExportDefault() { + return makeUniqueName( + "default", + isUniqueName, + /*optimistic*/ + false, + /*scoped*/ + false, + /*privateName*/ + false, + /*prefix*/ + "", + /*suffix*/ + "" + ); + } + function generateNameForClassExpression() { + return makeUniqueName( + "class", + isUniqueName, + /*optimistic*/ + false, + /*scoped*/ + false, + /*privateName*/ + false, + /*prefix*/ + "", + /*suffix*/ + "" + ); + } + function generateNameForMethodOrAccessor(node, privateName, prefix2, suffix) { + if (ts6.isIdentifier(node.name)) { + return generateNameCached(node.name, privateName); + } + return makeTempVariableName( + 0, + /*reservedInNestedScopes*/ + false, + privateName, + prefix2, + suffix + ); + } + function generateNameForNode(node, privateName, flags, prefix2, suffix) { + switch (node.kind) { + case 79: + case 80: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8), privateName, prefix2, suffix); + case 264: + case 263: + ts6.Debug.assert(!prefix2 && !suffix && !privateName); + return generateNameForModuleOrEnum(node); + case 269: + case 275: + ts6.Debug.assert(!prefix2 && !suffix && !privateName); + return generateNameForImportOrExportDeclaration(node); + case 259: + case 260: + case 274: + ts6.Debug.assert(!prefix2 && !suffix && !privateName); + return generateNameForExportDefault(); + case 228: + ts6.Debug.assert(!prefix2 && !suffix && !privateName); + return generateNameForClassExpression(); + case 171: + case 174: + case 175: + return generateNameForMethodOrAccessor(node, privateName, prefix2, suffix); + case 164: + return makeTempVariableName( + 0, + /*reserveInNestedScopes*/ + true, + privateName, + prefix2, + suffix + ); + default: + return makeTempVariableName( + 0, + /*reserveInNestedScopes*/ + false, + privateName, + prefix2, + suffix + ); + } + } + function makeName(name) { + var prefix2 = ts6.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts6.formatGeneratedNamePart(name.autoGenerateSuffix); + switch (name.autoGenerateFlags & 7) { + case 1: + return makeTempVariableName(0, !!(name.autoGenerateFlags & 8), ts6.isPrivateIdentifier(name), prefix2, suffix); + case 2: + ts6.Debug.assertNode(name, ts6.isIdentifier); + return makeTempVariableName( + 268435456, + !!(name.autoGenerateFlags & 8), + /*privateName*/ + false, + prefix2, + suffix + ); + case 3: + return makeUniqueName(ts6.idText(name), name.autoGenerateFlags & 32 ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16), !!(name.autoGenerateFlags & 8), ts6.isPrivateIdentifier(name), prefix2, suffix); + } + return ts6.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts6.Debug.formatEnum( + name.autoGenerateFlags & 7, + ts6.GeneratedIdentifierFlags, + /*isFlags*/ + true + ), ".")); + } + function pipelineEmitWithComments(hint, node) { + var pipelinePhase = getNextPipelinePhase(2, hint, node); + var savedContainerPos = containerPos; + var savedContainerEnd = containerEnd; + var savedDeclarationListContainerEnd = declarationListContainerEnd; + emitCommentsBeforeNode(node); + pipelinePhase(hint, node); + emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd); + } + function emitCommentsBeforeNode(node) { + var emitFlags = ts6.getEmitFlags(node); + var commentRange = ts6.getCommentRange(node); + emitLeadingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end); + if (emitFlags & 2048) { + commentsDisabled = true; + } + } + function emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) { + var emitFlags = ts6.getEmitFlags(node); + var commentRange = ts6.getCommentRange(node); + if (emitFlags & 2048) { + commentsDisabled = false; + } + emitTrailingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd); + var typeNode = ts6.getTypeNode(node); + if (typeNode) { + emitTrailingCommentsOfNode(node, emitFlags, typeNode.pos, typeNode.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd); + } + } + function emitLeadingCommentsOfNode(node, emitFlags, pos, end) { + enterComment(); + hasWrittenComment = false; + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 11; + var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11; + if ((pos > 0 || end > 0) && pos !== end) { + if (!skipLeadingComments) { + emitLeadingComments( + pos, + /*isEmittedNode*/ + node.kind !== 352 + /* SyntaxKind.NotEmittedStatement */ + ); + } + if (!skipLeadingComments || pos >= 0 && (emitFlags & 512) !== 0) { + containerPos = pos; + } + if (!skipTrailingComments || end >= 0 && (emitFlags & 1024) !== 0) { + containerEnd = end; + if (node.kind === 258) { + declarationListContainerEnd = end; + } + } + } + ts6.forEach(ts6.getSyntheticLeadingComments(node), emitLeadingSynthesizedComment); + exitComment(); + } + function emitTrailingCommentsOfNode(node, emitFlags, pos, end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) { + enterComment(); + var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11; + ts6.forEach(ts6.getSyntheticTrailingComments(node), emitTrailingSynthesizedComment); + if ((pos > 0 || end > 0) && pos !== end) { + containerPos = savedContainerPos; + containerEnd = savedContainerEnd; + declarationListContainerEnd = savedDeclarationListContainerEnd; + if (!skipTrailingComments && node.kind !== 352) { + emitTrailingComments(end); + } + } + exitComment(); + } + function emitLeadingSynthesizedComment(comment) { + if (comment.hasLeadingNewline || comment.kind === 2) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === 2) { + writer.writeLine(); + } else { + writer.writeSpace(" "); + } + } + function emitTrailingSynthesizedComment(comment) { + if (!writer.isAtStartOfLine()) { + writer.writeSpace(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + function writeSynthesizedComment(comment) { + var text = formatSynthesizedComment(comment); + var lineMap = comment.kind === 3 ? ts6.computeLineStarts(text) : void 0; + ts6.writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + function formatSynthesizedComment(comment) { + return comment.kind === 3 ? "/*".concat(comment.text, "*/") : "//".concat(comment.text); + } + function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { + enterComment(); + var pos = detachedRange.pos, end = detachedRange.end; + var emitFlags = ts6.getEmitFlags(node); + var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; + var skipTrailingComments = commentsDisabled || end < 0 || (emitFlags & 1024) !== 0; + if (!skipLeadingComments) { + emitDetachedCommentsAndUpdateCommentsInfo(detachedRange); + } + exitComment(); + if (emitFlags & 2048 && !commentsDisabled) { + commentsDisabled = true; + emitCallback(node); + commentsDisabled = false; + } else { + emitCallback(node); + } + enterComment(); + if (!skipTrailingComments) { + emitLeadingComments( + detachedRange.end, + /*isEmittedNode*/ + true + ); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } + } + exitComment(); + } + function originalNodesHaveSameParent(nodeA, nodeB) { + nodeA = ts6.getOriginalNode(nodeA); + return nodeA.parent && nodeA.parent === ts6.getOriginalNode(nodeB).parent; + } + function siblingNodePositionsAreComparable(previousNode, nextNode) { + if (nextNode.pos < previousNode.end) { + return false; + } + previousNode = ts6.getOriginalNode(previousNode); + nextNode = ts6.getOriginalNode(nextNode); + var parent = previousNode.parent; + if (!parent || parent !== nextNode.parent) { + return false; + } + var parentNodeArray = ts6.getContainingNodeArray(previousNode); + var prevNodeIndex = parentNodeArray === null || parentNodeArray === void 0 ? void 0 : parentNodeArray.indexOf(previousNode); + return prevNodeIndex !== void 0 && prevNodeIndex > -1 && parentNodeArray.indexOf(nextNode) === prevNodeIndex + 1; + } + function emitLeadingComments(pos, isEmittedNode) { + hasWrittenComment = false; + if (isEmittedNode) { + if (pos === 0 && (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.isDeclarationFile)) { + forEachLeadingCommentToEmit(pos, emitNonTripleSlashLeadingComment); + } else { + forEachLeadingCommentToEmit(pos, emitLeadingComment); + } + } else if (pos === 0) { + forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment); + } + } + function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) { + if (isTripleSlashComment(commentPos, commentEnd)) { + emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos); + } + } + function emitNonTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) { + if (!isTripleSlashComment(commentPos, commentEnd)) { + emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos); + } + } + function shouldWriteComment(text, pos) { + if (printerOptions.onlyPrintJsDocStyle) { + return ts6.isJSDocLikeText(text, pos) || ts6.isPinnedComment(text, pos); + } + return true; + } + function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) { + if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos)) + return; + if (!hasWrittenComment) { + ts6.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos); + hasWrittenComment = true; + } + emitPos(commentPos); + ts6.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (hasTrailingNewLine) { + writer.writeLine(); + } else if (kind === 3) { + writer.writeSpace(" "); + } + } + function emitLeadingCommentsOfPosition(pos) { + if (commentsDisabled || pos === -1) { + return; + } + emitLeadingComments( + pos, + /*isEmittedNode*/ + true + ); + } + function emitTrailingComments(pos) { + forEachTrailingCommentToEmit(pos, emitTrailingComment); + } + function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) { + if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos)) + return; + if (!writer.isAtStartOfLine()) { + writer.writeSpace(" "); + } + emitPos(commentPos); + ts6.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (hasTrailingNewLine) { + writer.writeLine(); + } + } + function emitTrailingCommentsOfPosition(pos, prefixSpace, forceNoNewline) { + if (commentsDisabled) { + return; + } + enterComment(); + forEachTrailingCommentToEmit(pos, prefixSpace ? emitTrailingComment : forceNoNewline ? emitTrailingCommentOfPositionNoNewline : emitTrailingCommentOfPosition); + exitComment(); + } + function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) { + if (!currentSourceFile) + return; + emitPos(commentPos); + ts6.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (kind === 2) { + writer.writeLine(); + } + } + function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { + if (!currentSourceFile) + return; + emitPos(commentPos); + ts6.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (hasTrailingNewLine) { + writer.writeLine(); + } else { + writer.writeSpace(" "); + } + } + function forEachLeadingCommentToEmit(pos, cb) { + if (currentSourceFile && (containerPos === -1 || pos !== containerPos)) { + if (hasDetachedComments(pos)) { + forEachLeadingCommentWithoutDetachedComments(cb); + } else { + ts6.forEachLeadingCommentRange( + currentSourceFile.text, + pos, + cb, + /*state*/ + pos + ); + } + } + } + function forEachTrailingCommentToEmit(end, cb) { + if (currentSourceFile && (containerEnd === -1 || end !== containerEnd && end !== declarationListContainerEnd)) { + ts6.forEachTrailingCommentRange(currentSourceFile.text, end, cb); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== void 0 && ts6.last(detachedCommentsInfo).nodePos === pos; + } + function forEachLeadingCommentWithoutDetachedComments(cb) { + if (!currentSourceFile) + return; + var pos = ts6.last(detachedCommentsInfo).detachedCommentEndPos; + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } else { + detachedCommentsInfo = void 0; + } + ts6.forEachLeadingCommentRange( + currentSourceFile.text, + pos, + cb, + /*state*/ + pos + ); + } + function emitDetachedCommentsAndUpdateCommentsInfo(range2) { + var currentDetachedCommentInfo = currentSourceFile && ts6.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range2, newLine, commentsDisabled); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + function emitComment(text, lineMap, writer2, commentPos, commentEnd, newLine2) { + if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos)) + return; + emitPos(commentPos); + ts6.writeCommentRange(text, lineMap, writer2, commentPos, commentEnd, newLine2); + emitPos(commentEnd); + } + function isTripleSlashComment(commentPos, commentEnd) { + return !!currentSourceFile && ts6.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd); + } + function getParsedSourceMap(node) { + if (node.parsedSourceMap === void 0 && node.sourceMapText !== void 0) { + node.parsedSourceMap = ts6.tryParseRawSourceMap(node.sourceMapText) || false; + } + return node.parsedSourceMap || void 0; + } + function pipelineEmitWithSourceMaps(hint, node) { + var pipelinePhase = getNextPipelinePhase(3, hint, node); + emitSourceMapsBeforeNode(node); + pipelinePhase(hint, node); + emitSourceMapsAfterNode(node); + } + function emitSourceMapsBeforeNode(node) { + var emitFlags = ts6.getEmitFlags(node); + var sourceMapRange = ts6.getSourceMapRange(node); + if (ts6.isUnparsedNode(node)) { + ts6.Debug.assertIsDefined(node.parent, "UnparsedNodes must have parent pointers"); + var parsed = getParsedSourceMap(node.parent); + if (parsed && sourceMapGenerator) { + sourceMapGenerator.appendSourceMap(writer.getLine(), writer.getColumn(), parsed, node.parent.sourceMapPath, node.parent.getLineAndCharacterOfPosition(node.pos), node.parent.getLineAndCharacterOfPosition(node.end)); + } + } else { + var source = sourceMapRange.source || sourceMapSource; + if (node.kind !== 352 && (emitFlags & 16) === 0 && sourceMapRange.pos >= 0) { + emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); + } + if (emitFlags & 64) { + sourceMapsDisabled = true; + } + } + } + function emitSourceMapsAfterNode(node) { + var emitFlags = ts6.getEmitFlags(node); + var sourceMapRange = ts6.getSourceMapRange(node); + if (!ts6.isUnparsedNode(node)) { + if (emitFlags & 64) { + sourceMapsDisabled = false; + } + if (node.kind !== 352 && (emitFlags & 32) === 0 && sourceMapRange.end >= 0) { + emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); + } + } + } + function skipSourceTrivia(source, pos) { + return source.skipTrivia ? source.skipTrivia(pos) : ts6.skipTrivia(source.text, pos); + } + function emitPos(pos) { + if (sourceMapsDisabled || ts6.positionIsSynthesized(pos) || isJsonSourceMapSource(sourceMapSource)) { + return; + } + var _a2 = ts6.getLineAndCharacterOfPosition(sourceMapSource, pos), sourceLine = _a2.line, sourceCharacter = _a2.character; + sourceMapGenerator.addMapping( + writer.getLine(), + writer.getColumn(), + sourceMapSourceIndex, + sourceLine, + sourceCharacter, + /*nameIndex*/ + void 0 + ); + } + function emitSourcePos(source, pos) { + if (source !== sourceMapSource) { + var savedSourceMapSource = sourceMapSource; + var savedSourceMapSourceIndex = sourceMapSourceIndex; + setSourceMapSource(source); + emitPos(pos); + resetSourceMapSource(savedSourceMapSource, savedSourceMapSourceIndex); + } else { + emitPos(pos); + } + } + function emitTokenWithSourceMap(node, token, writer2, tokenPos, emitCallback) { + if (sourceMapsDisabled || node && ts6.isInJsonFile(node)) { + return emitCallback(token, writer2, tokenPos); + } + var emitNode = node && node.emitNode; + var emitFlags = emitNode && emitNode.flags || 0; + var range2 = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; + var source = range2 && range2.source || sourceMapSource; + tokenPos = skipSourceTrivia(source, range2 ? range2.pos : tokenPos); + if ((emitFlags & 128) === 0 && tokenPos >= 0) { + emitSourcePos(source, tokenPos); + } + tokenPos = emitCallback(token, writer2, tokenPos); + if (range2) + tokenPos = range2.end; + if ((emitFlags & 256) === 0 && tokenPos >= 0) { + emitSourcePos(source, tokenPos); + } + return tokenPos; + } + function setSourceMapSource(source) { + if (sourceMapsDisabled) { + return; + } + sourceMapSource = source; + if (source === mostRecentlyAddedSourceMapSource) { + sourceMapSourceIndex = mostRecentlyAddedSourceMapSourceIndex; + return; + } + if (isJsonSourceMapSource(source)) { + return; + } + sourceMapSourceIndex = sourceMapGenerator.addSource(source.fileName); + if (printerOptions.inlineSources) { + sourceMapGenerator.setSourceContent(sourceMapSourceIndex, source.text); + } + mostRecentlyAddedSourceMapSource = source; + mostRecentlyAddedSourceMapSourceIndex = sourceMapSourceIndex; + } + function resetSourceMapSource(source, sourceIndex) { + sourceMapSource = source; + sourceMapSourceIndex = sourceIndex; + } + function isJsonSourceMapSource(sourceFile) { + return ts6.fileExtensionIs( + sourceFile.fileName, + ".json" + /* Extension.Json */ + ); + } + } + ts6.createPrinter = createPrinter; + function createBracketsMap() { + var brackets2 = []; + brackets2[ + 1024 + /* ListFormat.Braces */ + ] = ["{", "}"]; + brackets2[ + 2048 + /* ListFormat.Parenthesis */ + ] = ["(", ")"]; + brackets2[ + 4096 + /* ListFormat.AngleBrackets */ + ] = ["<", ">"]; + brackets2[ + 8192 + /* ListFormat.SquareBrackets */ + ] = ["[", "]"]; + return brackets2; + } + function getOpeningBracket(format) { + return brackets[ + format & 15360 + /* ListFormat.BracketsMask */ + ][0]; + } + function getClosingBracket(format) { + return brackets[ + format & 15360 + /* ListFormat.BracketsMask */ + ][1]; + } + var TempFlags; + (function(TempFlags2) { + TempFlags2[TempFlags2["Auto"] = 0] = "Auto"; + TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask"; + TempFlags2[TempFlags2["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); + function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) { + emit(node); + } + function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) { + emit(node, parenthesizerRuleSelector.select(index)); + } + function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) { + emit(node, parenthesizerRule); + } + function getEmitListItem(emit, parenthesizerRule) { + return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames) { + if (!host.getDirectories || !host.readDirectory) { + return void 0; + } + var cachedReadDirectoryResult = new ts6.Map(); + var getCanonicalFileName = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + return { + useCaseSensitiveFileNames, + fileExists, + readFile: function(path, encoding) { + return host.readFile(path, encoding); + }, + directoryExists: host.directoryExists && directoryExists, + getDirectories, + readDirectory, + createDirectory: host.createDirectory && createDirectory, + writeFile: host.writeFile && writeFile, + addOrDeleteFileOrDirectory, + addOrDeleteFile, + clearCache, + realpath: host.realpath && realpath + }; + function toPath(fileName) { + return ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + } + function getCachedFileSystemEntries(rootDirPath) { + return cachedReadDirectoryResult.get(ts6.ensureTrailingDirectorySeparator(rootDirPath)); + } + function getCachedFileSystemEntriesForBaseDir(path) { + var entries = getCachedFileSystemEntries(ts6.getDirectoryPath(path)); + if (!entries) { + return entries; + } + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; + } + function getBaseNameOfFileName(fileName) { + return ts6.getBaseFileName(ts6.normalizePath(fileName)); + } + function createCachedFileSystemEntries(rootDir, rootDirPath) { + var _a; + if (!host.realpath || ts6.ensureTrailingDirectorySeparator(toPath(host.realpath(rootDir))) === rootDirPath) { + var resultFromHost = { + files: ts6.map(host.readDirectory( + rootDir, + /*extensions*/ + void 0, + /*exclude*/ + void 0, + /*include*/ + ["*.*"] + ), getBaseNameOfFileName) || [], + directories: host.getDirectories(rootDir) || [] + }; + cachedReadDirectoryResult.set(ts6.ensureTrailingDirectorySeparator(rootDirPath), resultFromHost); + return resultFromHost; + } + if ((_a = host.directoryExists) === null || _a === void 0 ? void 0 : _a.call(host, rootDir)) { + cachedReadDirectoryResult.set(rootDirPath, false); + return false; + } + return void 0; + } + function tryReadDirectory(rootDir, rootDirPath) { + rootDirPath = ts6.ensureTrailingDirectorySeparator(rootDirPath); + var cachedResult = getCachedFileSystemEntries(rootDirPath); + if (cachedResult) { + return cachedResult; + } + try { + return createCachedFileSystemEntries(rootDir, rootDirPath); + } catch (_e) { + ts6.Debug.assert(!cachedReadDirectoryResult.has(ts6.ensureTrailingDirectorySeparator(rootDirPath))); + return void 0; + } + } + function hasEntry(entries, name) { + var index = ts6.binarySearch(entries, name, ts6.identity, ts6.compareStringsCaseSensitive); + return index >= 0; + } + function writeFile(fileName, data, writeByteOrderMark) { + var path = toPath(fileName); + var result = getCachedFileSystemEntriesForBaseDir(path); + if (result) { + updateFilesOfFileSystemEntry( + result, + getBaseNameOfFileName(fileName), + /*fileExists*/ + true + ); + } + return host.writeFile(fileName, data, writeByteOrderMark); + } + function fileExists(fileName) { + var path = toPath(fileName); + var result = getCachedFileSystemEntriesForBaseDir(path); + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); + } + function directoryExists(dirPath) { + var path = toPath(dirPath); + return cachedReadDirectoryResult.has(ts6.ensureTrailingDirectorySeparator(path)) || host.directoryExists(dirPath); + } + function createDirectory(dirPath) { + var path = toPath(dirPath); + var result = getCachedFileSystemEntriesForBaseDir(path); + if (result) { + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + if (ts6.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts6.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } + } + host.createDirectory(dirPath); + } + function getDirectories(rootDir) { + var rootDirPath = toPath(rootDir); + var result = tryReadDirectory(rootDir, rootDirPath); + if (result) { + return result.directories.slice(); + } + return host.getDirectories(rootDir); + } + function readDirectory(rootDir, extensions, excludes, includes, depth) { + var rootDirPath = toPath(rootDir); + var rootResult = tryReadDirectory(rootDir, rootDirPath); + var rootSymLinkResult; + if (rootResult !== void 0) { + return ts6.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath); + } + return host.readDirectory(rootDir, extensions, excludes, includes, depth); + function getFileSystemEntries(dir) { + var path = toPath(dir); + if (path === rootDirPath) { + return rootResult || getFileSystemEntriesFromHost(dir, path); + } + var result = tryReadDirectory(dir, path); + return result !== void 0 ? result || getFileSystemEntriesFromHost(dir, path) : ts6.emptyFileSystemEntries; + } + function getFileSystemEntriesFromHost(dir, path) { + if (rootSymLinkResult && path === rootDirPath) + return rootSymLinkResult; + var result = { + files: ts6.map(host.readDirectory( + dir, + /*extensions*/ + void 0, + /*exclude*/ + void 0, + /*include*/ + ["*.*"] + ), getBaseNameOfFileName) || ts6.emptyArray, + directories: host.getDirectories(dir) || ts6.emptyArray + }; + if (path === rootDirPath) + rootSymLinkResult = result; + return result; + } + } + function realpath(s) { + return host.realpath ? host.realpath(s) : s; + } + function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { + var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); + if (existingResult !== void 0) { + clearCache(); + return void 0; + } + var parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath); + if (!parentResult) { + return void 0; + } + if (!host.directoryExists) { + clearCache(); + return void 0; + } + var baseName = getBaseNameOfFileName(fileOrDirectory); + var fsQueryResult = { + fileExists: host.fileExists(fileOrDirectoryPath), + directoryExists: host.directoryExists(fileOrDirectoryPath) + }; + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { + clearCache(); + } else { + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } + return fsQueryResult; + } + function addOrDeleteFile(fileName, filePath, eventKind) { + if (eventKind === ts6.FileWatcherEventKind.Changed) { + return; + } + var parentResult = getCachedFileSystemEntriesForBaseDir(filePath); + if (parentResult) { + updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === ts6.FileWatcherEventKind.Created); + } + } + function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) { + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists2) { + if (ts6.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts6.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } else { + var sortedIndex = ts6.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts6.identity, ts6.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function(entry) { + return getCanonicalFileName(entry) === canonicalizedBaseName; + }); + parentResult.files.splice(unsortedIndex, 1); + } + } + } + function clearCache() { + cachedReadDirectoryResult.clear(); + } + } + ts6.createCachedDirectoryStructureHost = createCachedDirectoryStructureHost; + var ConfigFileProgramReloadLevel; + (function(ConfigFileProgramReloadLevel2) { + ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None"; + ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial"; + ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Full"] = 2] = "Full"; + })(ConfigFileProgramReloadLevel = ts6.ConfigFileProgramReloadLevel || (ts6.ConfigFileProgramReloadLevel = {})); + function updateSharedExtendedConfigFileWatcher(projectPath, options, extendedConfigFilesMap, createExtendedConfigFileWatch, toPath) { + var _a; + var extendedConfigs = ts6.arrayToMap(((_a = options === null || options === void 0 ? void 0 : options.configFile) === null || _a === void 0 ? void 0 : _a.extendedSourceFiles) || ts6.emptyArray, toPath); + extendedConfigFilesMap.forEach(function(watcher, extendedConfigFilePath) { + if (!extendedConfigs.has(extendedConfigFilePath)) { + watcher.projects.delete(projectPath); + watcher.close(); + } + }); + extendedConfigs.forEach(function(extendedConfigFileName, extendedConfigFilePath) { + var existing = extendedConfigFilesMap.get(extendedConfigFilePath); + if (existing) { + existing.projects.add(projectPath); + } else { + extendedConfigFilesMap.set(extendedConfigFilePath, { + projects: new ts6.Set([projectPath]), + watcher: createExtendedConfigFileWatch(extendedConfigFileName, extendedConfigFilePath), + close: function() { + var existing2 = extendedConfigFilesMap.get(extendedConfigFilePath); + if (!existing2 || existing2.projects.size !== 0) + return; + existing2.watcher.close(); + extendedConfigFilesMap.delete(extendedConfigFilePath); + } + }); + } + }); + } + ts6.updateSharedExtendedConfigFileWatcher = updateSharedExtendedConfigFileWatcher; + function clearSharedExtendedConfigFileWatcher(projectPath, extendedConfigFilesMap) { + extendedConfigFilesMap.forEach(function(watcher) { + if (watcher.projects.delete(projectPath)) + watcher.close(); + }); + } + ts6.clearSharedExtendedConfigFileWatcher = clearSharedExtendedConfigFileWatcher; + function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath) { + if (!extendedConfigCache.delete(extendedConfigFilePath)) + return; + extendedConfigCache.forEach(function(_a, key) { + var _b; + var extendedResult = _a.extendedResult; + if ((_b = extendedResult.extendedSourceFiles) === null || _b === void 0 ? void 0 : _b.some(function(extendedFile) { + return toPath(extendedFile) === extendedConfigFilePath; + })) { + cleanExtendedConfigCache(extendedConfigCache, key, toPath); + } + }); + } + ts6.cleanExtendedConfigCache = cleanExtendedConfigCache; + function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWatch) { + var newMap = new ts6.Map(lookups); + ts6.mutateMap(packageJsonWatches, newMap, { + createNewValue: createPackageJsonWatch, + onDeleteValue: ts6.closeFileWatcher + }); + } + ts6.updatePackageJsonWatch = updatePackageJsonWatch; + function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) { + var missingFilePaths = program.getMissingFilePaths(); + var newMissingFilePathMap = ts6.arrayToMap(missingFilePaths, ts6.identity, ts6.returnTrue); + ts6.mutateMap(missingFileWatches, newMissingFilePathMap, { + // Watch the missing files + createNewValue: createMissingFileWatch, + // Files that are no longer missing (e.g. because they are no longer required) + // should no longer be watched. + onDeleteValue: ts6.closeFileWatcher + }); + } + ts6.updateMissingFilePathsWatch = updateMissingFilePathsWatch; + function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) { + ts6.mutateMap(existingWatchedForWildcards, wildcardDirectories, { + // Create new watch and recursive info + createNewValue: createWildcardDirectoryWatcher, + // Close existing watch thats not needed any more + onDeleteValue: closeFileWatcherOf, + // Close existing watch that doesnt match in the flags + onExistingValue: updateWildcardDirectoryWatcher + }); + function createWildcardDirectoryWatcher(directory, flags) { + return { + watcher: watchDirectory(directory, flags), + flags + }; + } + function updateWildcardDirectoryWatcher(existingWatcher, flags, directory) { + if (existingWatcher.flags === flags) { + return; + } + existingWatcher.watcher.close(); + existingWatchedForWildcards.set(directory, createWildcardDirectoryWatcher(directory, flags)); + } + } + ts6.updateWatchingWildcardDirectories = updateWatchingWildcardDirectories; + function isIgnoredFileFromWildCardWatching(_a) { + var watchedDirPath = _a.watchedDirPath, fileOrDirectory = _a.fileOrDirectory, fileOrDirectoryPath = _a.fileOrDirectoryPath, configFileName = _a.configFileName, options = _a.options, program = _a.program, extraFileExtensions = _a.extraFileExtensions, currentDirectory = _a.currentDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, writeLog = _a.writeLog, toPath = _a.toPath; + var newPath = ts6.removeIgnoredPath(fileOrDirectoryPath); + if (!newPath) { + writeLog("Project: ".concat(configFileName, " Detected ignored path: ").concat(fileOrDirectory)); + return true; + } + fileOrDirectoryPath = newPath; + if (fileOrDirectoryPath === watchedDirPath) + return false; + if (ts6.hasExtension(fileOrDirectoryPath) && !ts6.isSupportedSourceFileName(fileOrDirectory, options, extraFileExtensions)) { + writeLog("Project: ".concat(configFileName, " Detected file add/remove of non supported extension: ").concat(fileOrDirectory)); + return true; + } + if (ts6.isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, ts6.getNormalizedAbsolutePath(ts6.getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) { + writeLog("Project: ".concat(configFileName, " Detected excluded file: ").concat(fileOrDirectory)); + return true; + } + if (!program) + return false; + if (ts6.outFile(options) || options.outDir) + return false; + if (ts6.isDeclarationFileName(fileOrDirectoryPath)) { + if (options.declarationDir) + return false; + } else if (!ts6.fileExtensionIsOneOf(fileOrDirectoryPath, ts6.supportedJSExtensionsFlat)) { + return false; + } + var filePathWithoutExtension = ts6.removeFileExtension(fileOrDirectoryPath); + var realProgram = ts6.isArray(program) ? void 0 : isBuilderProgram(program) ? program.getProgramOrUndefined() : program; + var builderProgram = !realProgram && !ts6.isArray(program) ? program : void 0; + if (hasSourceFile(filePathWithoutExtension + ".ts") || hasSourceFile(filePathWithoutExtension + ".tsx")) { + writeLog("Project: ".concat(configFileName, " Detected output file: ").concat(fileOrDirectory)); + return true; + } + return false; + function hasSourceFile(file) { + return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.getState().fileInfos.has(file) : !!ts6.find(program, function(rootFile) { + return toPath(rootFile) === file; + }); + } + } + ts6.isIgnoredFileFromWildCardWatching = isIgnoredFileFromWildCardWatching; + function isBuilderProgram(program) { + return !!program.getState; + } + function isEmittedFileOfProgram(program, file) { + if (!program) { + return false; + } + return program.isEmittedFile(file); + } + ts6.isEmittedFileOfProgram = isEmittedFileOfProgram; + var WatchLogLevel; + (function(WatchLogLevel2) { + WatchLogLevel2[WatchLogLevel2["None"] = 0] = "None"; + WatchLogLevel2[WatchLogLevel2["TriggerOnly"] = 1] = "TriggerOnly"; + WatchLogLevel2[WatchLogLevel2["Verbose"] = 2] = "Verbose"; + })(WatchLogLevel = ts6.WatchLogLevel || (ts6.WatchLogLevel = {})); + function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo) { + ts6.setSysLog(watchLogLevel === WatchLogLevel.Verbose ? log : ts6.noop); + var plainInvokeFactory = { + watchFile: function(file, callback, pollingInterval, options) { + return host.watchFile(file, callback, pollingInterval, options); + }, + watchDirectory: function(directory, callback, flags, options) { + return host.watchDirectory(directory, callback, (flags & 1) !== 0, options); + } + }; + var triggerInvokingFactory = watchLogLevel !== WatchLogLevel.None ? { + watchFile: createTriggerLoggingAddWatch("watchFile"), + watchDirectory: createTriggerLoggingAddWatch("watchDirectory") + } : void 0; + var factory = watchLogLevel === WatchLogLevel.Verbose ? { + watchFile: createFileWatcherWithLogging, + watchDirectory: createDirectoryWatcherWithLogging + } : triggerInvokingFactory || plainInvokeFactory; + var excludeWatcherFactory = watchLogLevel === WatchLogLevel.Verbose ? createExcludeWatcherWithLogging : ts6.returnNoopFileWatcher; + return { + watchFile: createExcludeHandlingAddWatch("watchFile"), + watchDirectory: createExcludeHandlingAddWatch("watchDirectory") + }; + function createExcludeHandlingAddWatch(key) { + return function(file, cb, flags, options, detailInfo1, detailInfo2) { + var _a; + return !ts6.matchesExclude(file, key === "watchFile" ? options === null || options === void 0 ? void 0 : options.excludeFiles : options === null || options === void 0 ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) === null || _a === void 0 ? void 0 : _a.call(host)) || "") ? factory[key].call( + /*thisArgs*/ + void 0, + file, + cb, + flags, + options, + detailInfo1, + detailInfo2 + ) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2); + }; + } + function useCaseSensitiveFileNames() { + return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames(); + } + function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) { + log("ExcludeWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); + return { + close: function() { + return log("ExcludeWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); + } + }; + } + function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) { + log("FileWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); + var watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2); + return { + close: function() { + log("FileWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); + watcher.close(); + } + }; + } + function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) { + var watchInfo = "DirectoryWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); + log(watchInfo); + var start = ts6.timestamp(); + var watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2); + var elapsed = ts6.timestamp() - start; + log("Elapsed:: ".concat(elapsed, "ms ").concat(watchInfo)); + return { + close: function() { + var watchInfo2 = "DirectoryWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); + log(watchInfo2); + var start2 = ts6.timestamp(); + watcher.close(); + var elapsed2 = ts6.timestamp() - start2; + log("Elapsed:: ".concat(elapsed2, "ms ").concat(watchInfo2)); + } + }; + } + function createTriggerLoggingAddWatch(key) { + return function(file, cb, flags, options, detailInfo1, detailInfo2) { + return plainInvokeFactory[key].call( + /*thisArgs*/ + void 0, + file, + function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var triggerredInfo = "".concat(key === "watchFile" ? "FileWatcher" : "DirectoryWatcher", ":: Triggered with ").concat(args[0], " ").concat(args[1] !== void 0 ? args[1] : "", ":: ").concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); + log(triggerredInfo); + var start = ts6.timestamp(); + cb.call.apply(cb, __spreadArray([ + /*thisArg*/ + void 0 + ], args, false)); + var elapsed = ts6.timestamp() - start; + log("Elapsed:: ".concat(elapsed, "ms ").concat(triggerredInfo)); + }, + flags, + options, + detailInfo1, + detailInfo2 + ); + }; + } + function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2) { + return "WatchInfo: ".concat(file, " ").concat(flags, " ").concat(JSON.stringify(options), " ").concat(getDetailWatchInfo2 ? getDetailWatchInfo2(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : "".concat(detailInfo1, " ").concat(detailInfo2)); + } + } + ts6.getWatchFactory = getWatchFactory; + function getFallbackOptions(options) { + var fallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling; + return { + watchFile: fallbackPolling !== void 0 ? fallbackPolling : ts6.WatchFileKind.PriorityPollingInterval + }; + } + ts6.getFallbackOptions = getFallbackOptions; + function closeFileWatcherOf(objWithWatcher) { + objWithWatcher.watcher.close(); + } + ts6.closeFileWatcherOf = closeFileWatcherOf; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function findConfigFile(searchPath, fileExists, configName) { + if (configName === void 0) { + configName = "tsconfig.json"; + } + return ts6.forEachAncestorDirectory(searchPath, function(ancestor) { + var fileName = ts6.combinePaths(ancestor, configName); + return fileExists(fileName) ? fileName : void 0; + }); + } + ts6.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts6.getDirectoryPath(containingFile); + var referencedFileName = ts6.isRootedDiskPath(moduleName) ? moduleName : ts6.combinePaths(basePath, moduleName); + return ts6.normalizePath(referencedFileName); + } + ts6.resolveTripleslashReference = resolveTripleslashReference; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts6.forEach(fileNames, function(sourceFile) { + var sourcePathComponents = ts6.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts6.getPathFromPathComponents(commonPathComponents); + } + ts6.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function createCompilerHost(options, setParentNodes) { + return createCompilerHostWorker(options, setParentNodes); + } + ts6.createCompilerHost = createCompilerHost; + function createCompilerHostWorker(options, setParentNodes, system) { + if (system === void 0) { + system = ts6.sys; + } + var existingDirectories = new ts6.Map(); + var getCanonicalFileName = ts6.createGetCanonicalFileName(system.useCaseSensitiveFileNames); + function getSourceFile(fileName, languageVersionOrOptions, onError) { + var text; + try { + ts6.performance.mark("beforeIORead"); + text = compilerHost.readFile(fileName); + ts6.performance.mark("afterIORead"); + ts6.performance.measure("I/O Read", "beforeIORead", "afterIORead"); + } catch (e) { + if (onError) { + onError(e.message); + } + text = ""; + } + return text !== void 0 ? ts6.createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0; + } + function directoryExists(directoryPath) { + if (existingDirectories.has(directoryPath)) { + return true; + } + if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) { + existingDirectories.set(directoryPath, true); + return true; + } + return false; + } + function writeFile(fileName, data, writeByteOrderMark, onError) { + try { + ts6.performance.mark("beforeIOWrite"); + ts6.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function(path, data2, writeByteOrderMark2) { + return system.writeFile(path, data2, writeByteOrderMark2); + }, function(path) { + return (compilerHost.createDirectory || system.createDirectory)(path); + }, function(path) { + return directoryExists(path); + }); + ts6.performance.mark("afterIOWrite"); + ts6.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite"); + } catch (e) { + if (onError) { + onError(e.message); + } + } + } + function getDefaultLibLocation() { + return ts6.getDirectoryPath(ts6.normalizePath(system.getExecutingFilePath())); + } + var newLine = ts6.getNewLineCharacter(options, function() { + return system.newLine; + }); + var realpath = system.realpath && function(path) { + return system.realpath(path); + }; + var compilerHost = { + getSourceFile, + getDefaultLibLocation, + getDefaultLibFileName: function(options2) { + return ts6.combinePaths(getDefaultLibLocation(), ts6.getDefaultLibFileName(options2)); + }, + writeFile, + getCurrentDirectory: ts6.memoize(function() { + return system.getCurrentDirectory(); + }), + useCaseSensitiveFileNames: function() { + return system.useCaseSensitiveFileNames; + }, + getCanonicalFileName, + getNewLine: function() { + return newLine; + }, + fileExists: function(fileName) { + return system.fileExists(fileName); + }, + readFile: function(fileName) { + return system.readFile(fileName); + }, + trace: function(s) { + return system.write(s + newLine); + }, + directoryExists: function(directoryName) { + return system.directoryExists(directoryName); + }, + getEnvironmentVariable: function(name) { + return system.getEnvironmentVariable ? system.getEnvironmentVariable(name) : ""; + }, + getDirectories: function(path) { + return system.getDirectories(path); + }, + realpath, + readDirectory: function(path, extensions, include, exclude, depth) { + return system.readDirectory(path, extensions, include, exclude, depth); + }, + createDirectory: function(d) { + return system.createDirectory(d); + }, + createHash: ts6.maybeBind(system, system.createHash) + }; + return compilerHost; + } + ts6.createCompilerHostWorker = createCompilerHostWorker; + function changeCompilerHostLikeToUseCache(host, toPath, getSourceFile) { + var originalReadFile = host.readFile; + var originalFileExists = host.fileExists; + var originalDirectoryExists = host.directoryExists; + var originalCreateDirectory = host.createDirectory; + var originalWriteFile = host.writeFile; + var readFileCache = new ts6.Map(); + var fileExistsCache = new ts6.Map(); + var directoryExistsCache = new ts6.Map(); + var sourceFileCache = new ts6.Map(); + var readFileWithCache = function(fileName) { + var key = toPath(fileName); + var value = readFileCache.get(key); + if (value !== void 0) + return value !== false ? value : void 0; + return setReadFileCache(key, fileName); + }; + var setReadFileCache = function(key, fileName) { + var newValue = originalReadFile.call(host, fileName); + readFileCache.set(key, newValue !== void 0 ? newValue : false); + return newValue; + }; + host.readFile = function(fileName) { + var key = toPath(fileName); + var value = readFileCache.get(key); + if (value !== void 0) + return value !== false ? value : void 0; + if (!ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + ) && !ts6.isBuildInfoFile(fileName)) { + return originalReadFile.call(host, fileName); + } + return setReadFileCache(key, fileName); + }; + var getSourceFileWithCache = getSourceFile ? function(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { + var key = toPath(fileName); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); + if (value) + return value; + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); + if (sourceFile && (ts6.isDeclarationFileName(fileName) || ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + ))) { + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts6.Map()).set(key, sourceFile)); + } + return sourceFile; + } : void 0; + host.fileExists = function(fileName) { + var key = toPath(fileName); + var value = fileExistsCache.get(key); + if (value !== void 0) + return value; + var newValue = originalFileExists.call(host, fileName); + fileExistsCache.set(key, !!newValue); + return newValue; + }; + if (originalWriteFile) { + host.writeFile = function(fileName, data) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } + var key = toPath(fileName); + fileExistsCache.delete(key); + var value = readFileCache.get(key); + if (value !== void 0 && value !== data) { + readFileCache.delete(key); + sourceFileCache.forEach(function(map) { + return map.delete(key); + }); + } else if (getSourceFileWithCache) { + sourceFileCache.forEach(function(map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); + } + originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); + }; + } + if (originalDirectoryExists) { + host.directoryExists = function(directory) { + var key = toPath(directory); + var value = directoryExistsCache.get(key); + if (value !== void 0) + return value; + var newValue = originalDirectoryExists.call(host, directory); + directoryExistsCache.set(key, !!newValue); + return newValue; + }; + if (originalCreateDirectory) { + host.createDirectory = function(directory) { + var key = toPath(directory); + directoryExistsCache.delete(key); + originalCreateDirectory.call(host, directory); + }; + } + } + return { + originalReadFile, + originalFileExists, + originalDirectoryExists, + originalCreateDirectory, + originalWriteFile, + getSourceFileWithCache, + readFileWithCache + }; + } + ts6.changeCompilerHostLikeToUseCache = changeCompilerHostLikeToUseCache; + function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { + var diagnostics; + diagnostics = ts6.addRange(diagnostics, program.getConfigFileParsingDiagnostics()); + diagnostics = ts6.addRange(diagnostics, program.getOptionsDiagnostics(cancellationToken)); + diagnostics = ts6.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile, cancellationToken)); + diagnostics = ts6.addRange(diagnostics, program.getGlobalDiagnostics(cancellationToken)); + diagnostics = ts6.addRange(diagnostics, program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (ts6.getEmitDeclarations(program.getCompilerOptions())) { + diagnostics = ts6.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken)); + } + return ts6.sortAndDeduplicateDiagnostics(diagnostics || ts6.emptyArray); + } + ts6.getPreEmitDiagnostics = getPreEmitDiagnostics; + function formatDiagnostics3(diagnostics, host) { + var output = ""; + for (var _i = 0, diagnostics_3 = diagnostics; _i < diagnostics_3.length; _i++) { + var diagnostic = diagnostics_3[_i]; + output += formatDiagnostic(diagnostic, host); + } + return output; + } + ts6.formatDiagnostics = formatDiagnostics3; + function formatDiagnostic(diagnostic, host) { + var errorMessage = "".concat(ts6.diagnosticCategoryName(diagnostic), " TS").concat(diagnostic.code, ": ").concat(flattenDiagnosticMessageText2(diagnostic.messageText, host.getNewLine())).concat(host.getNewLine()); + if (diagnostic.file) { + var _a = ts6.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character; + var fileName = diagnostic.file.fileName; + var relativeFileName = ts6.convertToRelativePath(fileName, host.getCurrentDirectory(), function(fileName2) { + return host.getCanonicalFileName(fileName2); + }); + return "".concat(relativeFileName, "(").concat(line + 1, ",").concat(character + 1, "): ") + errorMessage; + } + return errorMessage; + } + ts6.formatDiagnostic = formatDiagnostic; + var ForegroundColorEscapeSequences; + (function(ForegroundColorEscapeSequences2) { + ForegroundColorEscapeSequences2["Grey"] = "\x1B[90m"; + ForegroundColorEscapeSequences2["Red"] = "\x1B[91m"; + ForegroundColorEscapeSequences2["Yellow"] = "\x1B[93m"; + ForegroundColorEscapeSequences2["Blue"] = "\x1B[94m"; + ForegroundColorEscapeSequences2["Cyan"] = "\x1B[96m"; + })(ForegroundColorEscapeSequences = ts6.ForegroundColorEscapeSequences || (ts6.ForegroundColorEscapeSequences = {})); + var gutterStyleSequence = "\x1B[7m"; + var gutterSeparator = " "; + var resetEscapeSequence = "\x1B[0m"; + var ellipsis = "..."; + var halfIndent = " "; + var indent = " "; + function getCategoryFormat(category) { + switch (category) { + case ts6.DiagnosticCategory.Error: + return ForegroundColorEscapeSequences.Red; + case ts6.DiagnosticCategory.Warning: + return ForegroundColorEscapeSequences.Yellow; + case ts6.DiagnosticCategory.Suggestion: + return ts6.Debug.fail("Should never get an Info diagnostic on the command line."); + case ts6.DiagnosticCategory.Message: + return ForegroundColorEscapeSequences.Blue; + } + } + function formatColorAndReset(text, formatStyle) { + return formatStyle + text + resetEscapeSequence; + } + ts6.formatColorAndReset = formatColorAndReset; + function formatCodeSpan(file, start, length, indent2, squiggleColor, host) { + var _a = ts6.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; + var _b = ts6.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character; + var lastLineInFile = ts6.getLineAndCharacterOfPosition(file, file.text.length).line; + var hasMoreThanFiveLines = lastLine - firstLine >= 4; + var gutterWidth = (lastLine + 1 + "").length; + if (hasMoreThanFiveLines) { + gutterWidth = Math.max(ellipsis.length, gutterWidth); + } + var context = ""; + for (var i = firstLine; i <= lastLine; i++) { + context += host.getNewLine(); + if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) { + context += indent2 + formatColorAndReset(ts6.padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine(); + i = lastLine - 1; + } + var lineStart = ts6.getPositionOfLineAndCharacter(file, i, 0); + var lineEnd = i < lastLineInFile ? ts6.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length; + var lineContent = file.text.slice(lineStart, lineEnd); + lineContent = ts6.trimStringEnd(lineContent); + lineContent = lineContent.replace(/\t/g, " "); + context += indent2 + formatColorAndReset(ts6.padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator; + context += lineContent + host.getNewLine(); + context += indent2 + formatColorAndReset(ts6.padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator; + context += squiggleColor; + if (i === firstLine) { + var lastCharForLine = i === lastLine ? lastLineChar : void 0; + context += lineContent.slice(0, firstLineChar).replace(/\S/g, " "); + context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~"); + } else if (i === lastLine) { + context += lineContent.slice(0, lastLineChar).replace(/./g, "~"); + } else { + context += lineContent.replace(/./g, "~"); + } + context += resetEscapeSequence; + } + return context; + } + function formatLocation(file, start, host, color) { + if (color === void 0) { + color = formatColorAndReset; + } + var _a = ts6.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; + var relativeFileName = host ? ts6.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function(fileName) { + return host.getCanonicalFileName(fileName); + }) : file.fileName; + var output = ""; + output += color(relativeFileName, ForegroundColorEscapeSequences.Cyan); + output += ":"; + output += color("".concat(firstLine + 1), ForegroundColorEscapeSequences.Yellow); + output += ":"; + output += color("".concat(firstLineChar + 1), ForegroundColorEscapeSequences.Yellow); + return output; + } + ts6.formatLocation = formatLocation; + function formatDiagnosticsWithColorAndContext2(diagnostics, host) { + var output = ""; + for (var _i = 0, diagnostics_4 = diagnostics; _i < diagnostics_4.length; _i++) { + var diagnostic = diagnostics_4[_i]; + if (diagnostic.file) { + var file = diagnostic.file, start = diagnostic.start; + output += formatLocation(file, start, host); + output += " - "; + } + output += formatColorAndReset(ts6.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category)); + output += formatColorAndReset(" TS".concat(diagnostic.code, ": "), ForegroundColorEscapeSequences.Grey); + output += flattenDiagnosticMessageText2(diagnostic.messageText, host.getNewLine()); + if (diagnostic.file) { + output += host.getNewLine(); + output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host); + } + if (diagnostic.relatedInformation) { + output += host.getNewLine(); + for (var _a = 0, _b = diagnostic.relatedInformation; _a < _b.length; _a++) { + var _c = _b[_a], file = _c.file, start = _c.start, length_9 = _c.length, messageText = _c.messageText; + if (file) { + output += host.getNewLine(); + output += halfIndent + formatLocation(file, start, host); + output += formatCodeSpan(file, start, length_9, indent, ForegroundColorEscapeSequences.Cyan, host); + } + output += host.getNewLine(); + output += indent + flattenDiagnosticMessageText2(messageText, host.getNewLine()); + } + } + output += host.getNewLine(); + } + return output; + } + ts6.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext2; + function flattenDiagnosticMessageText2(diag, newLine, indent2) { + if (indent2 === void 0) { + indent2 = 0; + } + if (ts6.isString(diag)) { + return diag; + } else if (diag === void 0) { + return ""; + } + var result = ""; + if (indent2) { + result += newLine; + for (var i = 0; i < indent2; i++) { + result += " "; + } + } + result += diag.messageText; + indent2++; + if (diag.next) { + for (var _i = 0, _a = diag.next; _i < _a.length; _i++) { + var kid = _a[_i]; + result += flattenDiagnosticMessageText2(kid, newLine, indent2); + } + } + return result; + } + ts6.flattenDiagnosticMessageText = flattenDiagnosticMessageText2; + function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = new ts6.Map(); + for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { + var name = names_2[_i]; + var result = void 0; + var mode = getModeForFileReference(name, containingFileMode); + var strName = ts6.isString(name) ? name : name.fileName.toLowerCase(); + var cacheKey = mode !== void 0 ? "".concat(mode, "|").concat(strName) : strName; + if (cache.has(cacheKey)) { + result = cache.get(cacheKey); + } else { + cache.set(cacheKey, result = loader(strName, containingFile, redirectedReference, mode)); + } + resolutions.push(result); + } + return resolutions; + } + ts6.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; + function getModeForFileReference(ref, containingFileMode) { + return (ts6.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode; + } + ts6.getModeForFileReference = getModeForFileReference; + function getModeForResolutionAtIndex(file, index) { + if (file.impliedNodeFormat === void 0) + return void 0; + return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index)); + } + ts6.getModeForResolutionAtIndex = getModeForResolutionAtIndex; + function isExclusivelyTypeOnlyImportOrExport(decl) { + var _a; + if (ts6.isExportDeclaration(decl)) { + return decl.isTypeOnly; + } + if ((_a = decl.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly) { + return true; + } + return false; + } + ts6.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport; + function getModeForUsageLocation(file, usage) { + var _a, _b; + if (file.impliedNodeFormat === void 0) + return void 0; + if (ts6.isImportDeclaration(usage.parent) || ts6.isExportDeclaration(usage.parent)) { + var isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent); + if (isTypeOnly) { + var override = getResolutionModeOverrideForClause(usage.parent.assertClause); + if (override) { + return override; + } + } + } + if (usage.parent.parent && ts6.isImportTypeNode(usage.parent.parent)) { + var override = getResolutionModeOverrideForClause((_a = usage.parent.parent.assertions) === null || _a === void 0 ? void 0 : _a.assertClause); + if (override) { + return override; + } + } + if (file.impliedNodeFormat !== ts6.ModuleKind.ESNext) { + return ts6.isImportCall(ts6.walkUpParenthesizedExpressions(usage.parent)) ? ts6.ModuleKind.ESNext : ts6.ModuleKind.CommonJS; + } + var exprParentParent = (_b = ts6.walkUpParenthesizedExpressions(usage.parent)) === null || _b === void 0 ? void 0 : _b.parent; + return exprParentParent && ts6.isImportEqualsDeclaration(exprParentParent) ? ts6.ModuleKind.CommonJS : ts6.ModuleKind.ESNext; + } + ts6.getModeForUsageLocation = getModeForUsageLocation; + function getResolutionModeOverrideForClause(clause, grammarErrorOnNode) { + if (!clause) + return void 0; + if (ts6.length(clause.elements) !== 1) { + grammarErrorOnNode === null || grammarErrorOnNode === void 0 ? void 0 : grammarErrorOnNode(clause, ts6.Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require); + return void 0; + } + var elem = clause.elements[0]; + if (!ts6.isStringLiteralLike(elem.name)) + return void 0; + if (elem.name.text !== "resolution-mode") { + grammarErrorOnNode === null || grammarErrorOnNode === void 0 ? void 0 : grammarErrorOnNode(elem.name, ts6.Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions); + return void 0; + } + if (!ts6.isStringLiteralLike(elem.value)) + return void 0; + if (elem.value.text !== "import" && elem.value.text !== "require") { + grammarErrorOnNode === null || grammarErrorOnNode === void 0 ? void 0 : grammarErrorOnNode(elem.value, ts6.Diagnostics.resolution_mode_should_be_either_require_or_import); + return void 0; + } + return elem.value.text === "import" ? ts6.ModuleKind.ESNext : ts6.ModuleKind.CommonJS; + } + ts6.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause; + function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = new ts6.Map(); + var i = 0; + for (var _i = 0, names_3 = names; _i < names_3.length; _i++) { + var name = names_3[_i]; + var result = void 0; + var mode = getModeForResolutionAtIndex(containingFile, i); + i++; + var cacheKey = mode !== void 0 ? "".concat(mode, "|").concat(name) : name; + if (cache.has(cacheKey)) { + result = cache.get(cacheKey); + } else { + cache.set(cacheKey, result = loader(name, mode, containingFileName, redirectedReference)); + } + resolutions.push(result); + } + return resolutions; + } + ts6.loadWithModeAwareCache = loadWithModeAwareCache; + function forEachResolvedProjectReference(resolvedProjectReferences, cb) { + return forEachProjectReference( + /*projectReferences*/ + void 0, + resolvedProjectReferences, + function(resolvedRef, parent) { + return resolvedRef && cb(resolvedRef, parent); + } + ); + } + ts6.forEachResolvedProjectReference = forEachResolvedProjectReference; + function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) { + var seenResolvedRefs; + return worker( + projectReferences, + resolvedProjectReferences, + /*parent*/ + void 0 + ); + function worker(projectReferences2, resolvedProjectReferences2, parent) { + if (cbRef) { + var result = cbRef(projectReferences2, parent); + if (result) + return result; + } + return ts6.forEach(resolvedProjectReferences2, function(resolvedRef, index) { + if (resolvedRef && (seenResolvedRefs === null || seenResolvedRefs === void 0 ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) { + return void 0; + } + var result2 = cbResolvedRef(resolvedRef, parent, index); + if (result2 || !resolvedRef) + return result2; + (seenResolvedRefs || (seenResolvedRefs = new ts6.Set())).add(resolvedRef.sourceFile.path); + return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef); + }); + } + } + ts6.inferredTypesContainingFile = "__inferred type names__.ts"; + function isReferencedFile(reason) { + switch (reason === null || reason === void 0 ? void 0 : reason.kind) { + case ts6.FileIncludeKind.Import: + case ts6.FileIncludeKind.ReferenceFile: + case ts6.FileIncludeKind.TypeReferenceDirective: + case ts6.FileIncludeKind.LibReferenceDirective: + return true; + default: + return false; + } + } + ts6.isReferencedFile = isReferencedFile; + function isReferenceFileLocation(location) { + return location.pos !== void 0; + } + ts6.isReferenceFileLocation = isReferenceFileLocation; + function getReferencedFileLocation(getSourceFileByPath, ref) { + var _a, _b, _c; + var _d, _e, _f, _g; + var file = ts6.Debug.checkDefined(getSourceFileByPath(ref.file)); + var kind = ref.kind, index = ref.index; + var pos, end, packageId, resolutionMode; + switch (kind) { + case ts6.FileIncludeKind.Import: + var importLiteral = getModuleNameStringLiteralAt(file, index); + packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId; + if (importLiteral.pos === -1) + return { file, packageId, text: importLiteral.text }; + pos = ts6.skipTrivia(file.text, importLiteral.pos); + end = importLiteral.end; + break; + case ts6.FileIncludeKind.ReferenceFile: + _a = file.referencedFiles[index], pos = _a.pos, end = _a.end; + break; + case ts6.FileIncludeKind.TypeReferenceDirective: + _b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode; + packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts6.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) === null || _g === void 0 ? void 0 : _g.packageId; + break; + case ts6.FileIncludeKind.LibReferenceDirective: + _c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end; + break; + default: + return ts6.Debug.assertNever(kind); + } + return { file, pos, end, packageId }; + } + ts6.getReferencedFileLocation = getReferencedFileLocation; + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) + return false; + if (!ts6.arrayIsEqualTo(program.getRootFileNames(), rootFileNames)) + return false; + var seenResolvedRefs; + if (!ts6.arrayIsEqualTo(program.getProjectReferences(), projectReferences, projectReferenceUptoDate)) + return false; + if (program.getSourceFiles().some(sourceFileNotUptoDate)) + return false; + if (program.getMissingFilePaths().some(fileExists)) + return false; + var currentOptions = program.getCompilerOptions(); + if (!ts6.compareDataObjects(currentOptions, newOptions)) + return false; + if (currentOptions.configFile && newOptions.configFile) + return currentOptions.configFile.text === newOptions.configFile.text; + return true; + function sourceFileNotUptoDate(sourceFile) { + return !sourceFileVersionUptoDate(sourceFile) || hasInvalidatedResolutions(sourceFile.path); + } + function sourceFileVersionUptoDate(sourceFile) { + return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); + } + function projectReferenceUptoDate(oldRef, newRef, index) { + return ts6.projectReferenceIsEqualTo(oldRef, newRef) && resolvedProjectReferenceUptoDate(program.getResolvedProjectReferences()[index], oldRef); + } + function resolvedProjectReferenceUptoDate(oldResolvedRef, oldRef) { + if (oldResolvedRef) { + if (ts6.contains(seenResolvedRefs, oldResolvedRef)) + return true; + var refPath_1 = resolveProjectReferencePath(oldRef); + var newParsedCommandLine = getParsedCommandLine(refPath_1); + if (!newParsedCommandLine) + return false; + if (oldResolvedRef.commandLine.options.configFile !== newParsedCommandLine.options.configFile) + return false; + if (!ts6.arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newParsedCommandLine.fileNames)) + return false; + (seenResolvedRefs || (seenResolvedRefs = [])).push(oldResolvedRef); + return !ts6.forEach(oldResolvedRef.references, function(childResolvedRef, index) { + return !resolvedProjectReferenceUptoDate(childResolvedRef, oldResolvedRef.commandLine.projectReferences[index]); + }); + } + var refPath = resolveProjectReferencePath(oldRef); + return !getParsedCommandLine(refPath); + } + } + ts6.isProgramUptoDate = isProgramUptoDate; + function getConfigFileParsingDiagnostics(configFileParseResult) { + return configFileParseResult.options.configFile ? __spreadArray(__spreadArray([], configFileParseResult.options.configFile.parseDiagnostics, true), configFileParseResult.errors, true) : configFileParseResult.errors; + } + ts6.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics; + function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) { + var result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options); + return typeof result === "object" ? result.impliedNodeFormat : result; + } + ts6.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile; + function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) { + switch (ts6.getEmitModuleResolutionKind(options)) { + case ts6.ModuleResolutionKind.Node16: + case ts6.ModuleResolutionKind.NodeNext: + return ts6.fileExtensionIsOneOf(fileName, [ + ".d.mts", + ".mts", + ".mjs" + /* Extension.Mjs */ + ]) ? ts6.ModuleKind.ESNext : ts6.fileExtensionIsOneOf(fileName, [ + ".d.cts", + ".cts", + ".cjs" + /* Extension.Cjs */ + ]) ? ts6.ModuleKind.CommonJS : ts6.fileExtensionIsOneOf(fileName, [ + ".d.ts", + ".ts", + ".tsx", + ".js", + ".jsx" + /* Extension.Jsx */ + ]) ? lookupFromPackageJson() : void 0; + default: + return void 0; + } + function lookupFromPackageJson() { + var state = ts6.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options); + var packageJsonLocations = []; + state.failedLookupLocations = packageJsonLocations; + state.affectingLocations = packageJsonLocations; + var packageJsonScope = ts6.getPackageScopeForPath(fileName, state); + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts6.ModuleKind.ESNext : ts6.ModuleKind.CommonJS; + return { impliedNodeFormat, packageJsonLocations, packageJsonScope }; + } + } + ts6.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker; + ts6.plainJSErrors = new ts6.Set([ + // binder errors + ts6.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code, + ts6.Diagnostics.A_module_cannot_have_multiple_default_exports.code, + ts6.Diagnostics.Another_export_default_is_here.code, + ts6.Diagnostics.The_first_export_default_is_here.code, + ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code, + ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code, + ts6.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code, + ts6.Diagnostics.constructor_is_a_reserved_word.code, + ts6.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code, + ts6.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code, + ts6.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code, + ts6.Diagnostics.Invalid_use_of_0_in_strict_mode.code, + ts6.Diagnostics.A_label_is_not_allowed_here.code, + ts6.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code, + ts6.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code, + // grammar errors + ts6.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code, + ts6.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code, + ts6.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code, + ts6.Diagnostics.A_class_member_cannot_have_the_0_keyword.code, + ts6.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code, + ts6.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code, + ts6.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code, + ts6.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code, + ts6.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code, + ts6.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code, + ts6.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code, + ts6.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code, + ts6.Diagnostics.A_get_accessor_cannot_have_parameters.code, + ts6.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code, + ts6.Diagnostics.A_rest_element_cannot_have_a_property_name.code, + ts6.Diagnostics.A_rest_element_cannot_have_an_initializer.code, + ts6.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code, + ts6.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code, + ts6.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code, + ts6.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code, + ts6.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code, + ts6.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code, + ts6.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code, + ts6.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code, + ts6.Diagnostics.An_export_declaration_cannot_have_modifiers.code, + ts6.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code, + ts6.Diagnostics.An_import_declaration_cannot_have_modifiers.code, + ts6.Diagnostics.An_object_member_cannot_be_declared_optional.code, + ts6.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code, + ts6.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code, + ts6.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code, + ts6.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code, + ts6.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code, + ts6.Diagnostics.Classes_can_only_extend_a_single_class.code, + ts6.Diagnostics.Classes_may_not_have_a_field_named_constructor.code, + ts6.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code, + ts6.Diagnostics.Duplicate_label_0.code, + ts6.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code, + ts6.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code, + ts6.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code, + ts6.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code, + ts6.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code, + ts6.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code, + ts6.Diagnostics.Jump_target_cannot_cross_function_boundary.code, + ts6.Diagnostics.Line_terminator_not_permitted_before_arrow.code, + ts6.Diagnostics.Modifiers_cannot_appear_here.code, + ts6.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code, + ts6.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code, + ts6.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code, + ts6.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code, + ts6.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code, + ts6.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code, + ts6.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code, + ts6.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code, + ts6.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code, + ts6.Diagnostics.Trailing_comma_not_allowed.code, + ts6.Diagnostics.Variable_declaration_list_cannot_be_empty.code, + ts6.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code, + ts6.Diagnostics._0_expected.code, + ts6.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code, + ts6.Diagnostics._0_list_cannot_be_empty.code, + ts6.Diagnostics._0_modifier_already_seen.code, + ts6.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code, + ts6.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code, + ts6.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code, + ts6.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code, + ts6.Diagnostics._0_modifier_cannot_be_used_here.code, + ts6.Diagnostics._0_modifier_must_precede_1_modifier.code, + ts6.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code, + ts6.Diagnostics.const_declarations_must_be_initialized.code, + ts6.Diagnostics.extends_clause_already_seen.code, + ts6.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code, + ts6.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code, + ts6.Diagnostics.Class_constructor_may_not_be_a_generator.code, + ts6.Diagnostics.Class_constructor_may_not_be_an_accessor.code, + ts6.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code + ]); + function shouldProgramCreateNewSourceFiles(program, newOptions) { + if (!program) + return false; + return ts6.optionsHaveChanges(program.getCompilerOptions(), newOptions, ts6.sourceFileAffectingCompilerOptions); + } + function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics) { + return { + rootNames, + options, + host, + oldProgram, + configFileParsingDiagnostics + }; + } + function createProgram2(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) { + var _a, _b, _c, _d; + var createProgramOptions = ts6.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; + var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences; + var oldProgram = createProgramOptions.oldProgram; + var processingDefaultLibFiles; + var processingOtherFiles; + var files; + var symlinks; + var commonSourceDirectory; + var typeChecker; + var classifiableNames; + var ambientModuleNameToUnmodifiedFileName = new ts6.Map(); + var fileReasons = ts6.createMultiMap(); + var cachedBindAndCheckDiagnosticsForFile = {}; + var cachedDeclarationDiagnosticsForFile = {}; + var resolvedTypeReferenceDirectives = ts6.createModeAwareCache(); + var fileProcessingDiagnostics; + var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; + var currentNodeModulesDepth = 0; + var modulesWithElidedImports = new ts6.Map(); + var sourceFilesFoundSearchingNodeModules = new ts6.Map(); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push( + "program", + "createProgram", + { configFilePath: options.configFilePath, rootDir: options.rootDir }, + /*separateBeginAndEnd*/ + true + ); + ts6.performance.mark("beforeProgram"); + var host = createProgramOptions.host || createCompilerHost(options); + var configParsingHost = parseConfigHostFromCompilerHostLike(host); + var skipDefaultLib = options.noLib; + var getDefaultLibraryFileName = ts6.memoize(function() { + return host.getDefaultLibFileName(options); + }); + var defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts6.getDirectoryPath(getDefaultLibraryFileName()); + var programDiagnostics = ts6.createDiagnosticCollection(); + var currentDirectory = host.getCurrentDirectory(); + var supportedExtensions = ts6.getSupportedExtensions(options); + var supportedExtensionsWithJsonIfResolveJsonModule = ts6.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions); + var hasEmitBlockingDiagnostics = new ts6.Map(); + var _compilerOptionsObjectLiteralSyntax; + var moduleResolutionCache; + var typeReferenceDirectiveResolutionCache; + var actualResolveModuleNamesWorker; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts6.returnFalse; + if (host.resolveModuleNames) { + actualResolveModuleNamesWorker = function(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { + return host.resolveModuleNames(ts6.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function(resolved) { + if (!resolved || resolved.extension !== void 0) { + return resolved; + } + var withExtension = ts6.clone(resolved); + withExtension.extension = ts6.extensionFromPath(resolved.resolvedFileName); + return withExtension; + }); + }; + moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host); + } else { + moduleResolutionCache = ts6.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options); + var loader_1 = function(moduleName, resolverMode, containingFileName, redirectedReference) { + return ts6.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; + }; + actualResolveModuleNamesWorker = function(moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { + return loadWithModeAwareCache(ts6.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); + }; + } + var actualResolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + actualResolveTypeReferenceDirectiveNamesWorker = function(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { + return host.resolveTypeReferenceDirectives(ts6.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); + }; + } else { + typeReferenceDirectiveResolutionCache = ts6.createTypeReferenceDirectiveResolutionCache( + currentDirectory, + getCanonicalFileName, + /*options*/ + void 0, + moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache() + ); + var loader_2 = function(typesRef, containingFile, redirectedReference, resolutionMode) { + return ts6.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; + }; + actualResolveTypeReferenceDirectiveNamesWorker = function(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { + return loadWithTypeDirectiveCache(ts6.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); + }; + } + var packageIdToSourceFile = new ts6.Map(); + var sourceFileToPackageName = new ts6.Map(); + var redirectTargetsMap = ts6.createMultiMap(); + var usesUriStyleNodeCoreModules = false; + var filesByName = new ts6.Map(); + var missingFilePaths; + var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? new ts6.Map() : void 0; + var resolvedProjectReferences; + var projectReferenceRedirects; + var mapFromFileToProjectReferenceRedirects; + var mapFromToProjectReferenceRedirectSource; + var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) && !options.disableSourceOfProjectReferenceRedirect; + var _e = updateHostForUseSourceOfProjectReferenceRedirect({ + compilerHost: host, + getSymlinkCache, + useSourceOfProjectReferenceRedirect, + toPath, + getResolvedProjectReferences, + getSourceOfProjectReferenceRedirect, + forEachResolvedProjectReference: forEachResolvedProjectReference2 + }), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists; + var readFile = host.readFile.bind(host); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram }); + var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + var structureIsReused; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "tryReuseStructureFromOldProgram", {}); + structureIsReused = tryReuseStructureFromOldProgram(); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + if (structureIsReused !== 2) { + processingDefaultLibFiles = []; + processingOtherFiles = []; + if (projectReferences) { + if (!resolvedProjectReferences) { + resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile); + } + if (rootNames.length) { + resolvedProjectReferences === null || resolvedProjectReferences === void 0 ? void 0 : resolvedProjectReferences.forEach(function(parsedRef, index) { + if (!parsedRef) + return; + var out = ts6.outFile(parsedRef.commandLine.options); + if (useSourceOfProjectReferenceRedirect) { + if (out || ts6.getEmitModuleKind(parsedRef.commandLine.options) === ts6.ModuleKind.None) { + for (var _i2 = 0, _a2 = parsedRef.commandLine.fileNames; _i2 < _a2.length; _i2++) { + var fileName = _a2[_i2]; + processProjectReferenceFile(fileName, { kind: ts6.FileIncludeKind.SourceFromProjectReference, index }); + } + } + } else { + if (out) { + processProjectReferenceFile(ts6.changeExtension(out, ".d.ts"), { kind: ts6.FileIncludeKind.OutputFromProjectReference, index }); + } else if (ts6.getEmitModuleKind(parsedRef.commandLine.options) === ts6.ModuleKind.None) { + var getCommonSourceDirectory_2 = ts6.memoize(function() { + return ts6.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); + }); + for (var _b2 = 0, _c2 = parsedRef.commandLine.fileNames; _b2 < _c2.length; _b2++) { + var fileName = _c2[_b2]; + if (!ts6.isDeclarationFileName(fileName) && !ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + )) { + processProjectReferenceFile(ts6.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts6.FileIncludeKind.OutputFromProjectReference, index }); + } + } + } + } + }); + } + } + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "processRootFiles", { count: rootNames.length }); + ts6.forEach(rootNames, function(name, index) { + return processRootFile( + name, + /*isDefaultLib*/ + false, + /*ignoreNoDefaultLib*/ + false, + { kind: ts6.FileIncludeKind.RootFile, index } + ); + }); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + var typeReferences = rootNames.length ? ts6.getAutomaticTypeDirectiveNames(options, host) : ts6.emptyArray; + if (typeReferences.length) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "processTypeReferences", { count: typeReferences.length }); + var containingDirectory = options.configFilePath ? ts6.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts6.combinePaths(containingDirectory, ts6.inferredTypesContainingFile); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); + for (var i = 0; i < typeReferences.length; i++) { + processTypeReferenceDirective( + typeReferences[i], + /*mode*/ + void 0, + resolutions[i], + { kind: ts6.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId } + ); + } + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + if (rootNames.length && !skipDefaultLib) { + var defaultLibraryFileName = getDefaultLibraryFileName(); + if (!options.lib && defaultLibraryFileName) { + processRootFile( + defaultLibraryFileName, + /*isDefaultLib*/ + true, + /*ignoreNoDefaultLib*/ + false, + { kind: ts6.FileIncludeKind.LibFile } + ); + } else { + ts6.forEach(options.lib, function(libFileName, index) { + processRootFile( + pathForLibFile(libFileName), + /*isDefaultLib*/ + true, + /*ignoreNoDefaultLib*/ + false, + { kind: ts6.FileIncludeKind.LibFile, index } + ); + }); + } + } + missingFilePaths = ts6.arrayFrom(ts6.mapDefinedIterator(filesByName.entries(), function(_a2) { + var path = _a2[0], file = _a2[1]; + return file === void 0 ? path : void 0; + })); + files = ts6.stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles); + processingDefaultLibFiles = void 0; + processingOtherFiles = void 0; + } + ts6.Debug.assert(!!missingFilePaths); + if (oldProgram && host.onReleaseOldSourceFile) { + var oldSourceFiles = oldProgram.getSourceFiles(); + for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { + var oldSourceFile = oldSourceFiles_1[_i]; + var newFile = getSourceFileByPath(oldSourceFile.resolvedPath); + if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is + oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) { + host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path)); + } + } + if (!host.getParsedCommandLine) { + oldProgram.forEachResolvedProjectReference(function(resolvedProjectReference) { + if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) { + host.onReleaseOldSourceFile( + resolvedProjectReference.sourceFile, + oldProgram.getCompilerOptions(), + /*hasSourceFileByPath*/ + false + ); + } + }); + } + } + if (oldProgram && host.onReleaseParsedCommandLine) { + forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function(oldResolvedRef, parent, index) { + var oldReference = (parent === null || parent === void 0 ? void 0 : parent.commandLine.projectReferences[index]) || oldProgram.getProjectReferences()[index]; + var oldRefPath = resolveProjectReferencePath(oldReference); + if (!(projectReferenceRedirects === null || projectReferenceRedirects === void 0 ? void 0 : projectReferenceRedirects.has(toPath(oldRefPath)))) { + host.onReleaseParsedCommandLine(oldRefPath, oldResolvedRef, oldProgram.getCompilerOptions()); + } + }); + } + typeReferenceDirectiveResolutionCache = void 0; + oldProgram = void 0; + var program = { + getRootFileNames: function() { + return rootNames; + }, + getSourceFile, + getSourceFileByPath, + getSourceFiles: function() { + return files; + }, + getMissingFilePaths: function() { + return missingFilePaths; + }, + getModuleResolutionCache: function() { + return moduleResolutionCache; + }, + getFilesByNameMap: function() { + return filesByName; + }, + getCompilerOptions: function() { + return options; + }, + getSyntacticDiagnostics, + getOptionsDiagnostics, + getGlobalDiagnostics, + getSemanticDiagnostics, + getCachedSemanticDiagnostics, + getSuggestionDiagnostics, + getDeclarationDiagnostics, + getBindAndCheckDiagnostics, + getProgramDiagnostics: getProgramDiagnostics2, + getTypeChecker, + getClassifiableNames, + getCommonSourceDirectory, + emit, + getCurrentDirectory: function() { + return currentDirectory; + }, + getNodeCount: function() { + return getTypeChecker().getNodeCount(); + }, + getIdentifierCount: function() { + return getTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function() { + return getTypeChecker().getSymbolCount(); + }, + getTypeCount: function() { + return getTypeChecker().getTypeCount(); + }, + getInstantiationCount: function() { + return getTypeChecker().getInstantiationCount(); + }, + getRelationCacheSizes: function() { + return getTypeChecker().getRelationCacheSizes(); + }, + getFileProcessingDiagnostics: function() { + return fileProcessingDiagnostics; + }, + getResolvedTypeReferenceDirectives: function() { + return resolvedTypeReferenceDirectives; + }, + isSourceFileFromExternalLibrary, + isSourceFileDefaultLibrary, + getSourceFileFromReference, + getLibFileFromReference, + sourceFileToPackageName, + redirectTargetsMap, + usesUriStyleNodeCoreModules, + isEmittedFile, + getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2, + getResolvedModuleWithFailedLookupLocationsFromCache, + getProjectReferences, + getResolvedProjectReferences, + getProjectReferenceRedirect, + getResolvedProjectReferenceToRedirect, + getResolvedProjectReferenceByPath, + forEachResolvedProjectReference: forEachResolvedProjectReference2, + isSourceOfProjectReferenceRedirect, + emitBuildInfo, + fileExists, + readFile, + directoryExists, + getSymlinkCache, + realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host), + useCaseSensitiveFileNames: function() { + return host.useCaseSensitiveFileNames(); + }, + getFileIncludeReasons: function() { + return fileReasons; + }, + structureIsReused, + writeFile + }; + onProgramCreateComplete(); + fileProcessingDiagnostics === null || fileProcessingDiagnostics === void 0 ? void 0 : fileProcessingDiagnostics.forEach(function(diagnostic) { + switch (diagnostic.kind) { + case 1: + return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || ts6.emptyArray)); + case 0: + var _a2 = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a2.file, pos = _a2.pos, end = _a2.end; + return programDiagnostics.add(ts6.createFileDiagnostic.apply(void 0, __spreadArray([file, ts6.Debug.checkDefined(pos), ts6.Debug.checkDefined(end) - pos, diagnostic.diagnostic], diagnostic.args || ts6.emptyArray, false))); + default: + ts6.Debug.assertNever(diagnostic); + } + }); + verifyCompilerOptions(); + ts6.performance.mark("afterProgram"); + ts6.performance.measure("Program", "beforeProgram", "afterProgram"); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return program; + function addResolutionDiagnostics(list) { + if (!list) + return; + for (var _i2 = 0, list_3 = list; _i2 < list_3.length; _i2++) { + var elem = list_3[_i2]; + programDiagnostics.add(elem); + } + } + function pullDiagnosticsFromCache(names, containingFile) { + var _a2; + if (!moduleResolutionCache) + return; + var containingFileName = ts6.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory); + var containingFileMode = !ts6.isString(containingFile) ? containingFile.impliedNodeFormat : void 0; + var containingDir = ts6.getDirectoryPath(containingFileName); + var redirectedReference = getRedirectReferenceForResolution(containingFile); + var i2 = 0; + for (var _i2 = 0, names_4 = names; _i2 < names_4.length; _i2++) { + var n = names_4[_i2]; + var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i2) : getModeForFileReference(n, containingFileMode); + var name = typeof n === "string" ? n : n.fileName; + i2++; + if (ts6.isExternalModuleNameRelative(name)) + continue; + var diags = (_a2 = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a2 === void 0 ? void 0 : _a2.resolutionDiagnostics; + addResolutionDiagnostics(diags); + } + } + function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) { + if (!moduleNames.length) + return ts6.emptyArray; + var containingFileName = ts6.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory); + var redirectedReference = getRedirectReferenceForResolution(containingFile); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "resolveModuleNamesWorker", { containingFileName }); + ts6.performance.mark("beforeResolveModule"); + var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference); + ts6.performance.mark("afterResolveModule"); + ts6.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule"); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + pullDiagnosticsFromCache(moduleNames, containingFile); + return result; + } + function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) { + if (!typeDirectiveNames.length) + return []; + var containingFileName = !ts6.isString(containingFile) ? ts6.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile; + var redirectedReference = !ts6.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : void 0; + var containingFileMode = !ts6.isString(containingFile) ? containingFile.impliedNodeFormat : void 0; + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); + ts6.performance.mark("beforeResolveTypeReference"); + var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode); + ts6.performance.mark("afterResolveTypeReference"); + ts6.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference"); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return result; + } + function getRedirectReferenceForResolution(file) { + var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName); + if (redirect || !ts6.isDeclarationFileName(file.originalFileName)) + return redirect; + var resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path); + if (resultFromDts) + return resultFromDts; + if (!host.realpath || !options.preserveSymlinks || !ts6.stringContains(file.originalFileName, ts6.nodeModulesPathPart)) + return void 0; + var realDeclarationPath = toPath(host.realpath(file.originalFileName)); + return realDeclarationPath === file.path ? void 0 : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath); + } + function getRedirectReferenceForResolutionFromSourceOfProject(filePath) { + var source = getSourceOfProjectReferenceRedirect(filePath); + if (ts6.isString(source)) + return getResolvedProjectReferenceToRedirect(source); + if (!source) + return void 0; + return forEachResolvedProjectReference2(function(resolvedRef) { + var out = ts6.outFile(resolvedRef.commandLine.options); + if (!out) + return void 0; + return toPath(out) === filePath ? resolvedRef : void 0; + }); + } + function compareDefaultLibFiles(a, b) { + return ts6.compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b)); + } + function getDefaultLibFilePriority(a) { + if (ts6.containsPath( + defaultLibraryPath, + a.fileName, + /*ignoreCase*/ + false + )) { + var basename = ts6.getBaseFileName(a.fileName); + if (basename === "lib.d.ts" || basename === "lib.es6.d.ts") + return 0; + var name = ts6.removeSuffix(ts6.removePrefix(basename, "lib."), ".d.ts"); + var index = ts6.libs.indexOf(name); + if (index !== -1) + return index + 1; + } + return ts6.libs.length + 2; + } + function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) { + return moduleResolutionCache && ts6.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode); + } + function toPath(fileName) { + return ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + } + function getCommonSourceDirectory() { + if (commonSourceDirectory === void 0) { + var emittedFiles_1 = ts6.filter(files, function(file) { + return ts6.sourceFileMayBeEmitted(file, program); + }); + commonSourceDirectory = ts6.getCommonSourceDirectory(options, function() { + return ts6.mapDefined(emittedFiles_1, function(file) { + return file.isDeclarationFile ? void 0 : file.fileName; + }); + }, currentDirectory, getCanonicalFileName, function(commonSourceDirectory2) { + return checkSourceFilesBelongToPath(emittedFiles_1, commonSourceDirectory2); + }); + } + return commonSourceDirectory; + } + function getClassifiableNames() { + var _a2; + if (!classifiableNames) { + getTypeChecker(); + classifiableNames = new ts6.Set(); + for (var _i2 = 0, files_3 = files; _i2 < files_3.length; _i2++) { + var sourceFile = files_3[_i2]; + (_a2 = sourceFile.classifiableNames) === null || _a2 === void 0 ? void 0 : _a2.forEach(function(value) { + return classifiableNames.add(value); + }); + } + } + return classifiableNames; + } + function resolveModuleNamesReusingOldState(moduleNames, file) { + if (structureIsReused === 0 && !file.ambientModuleNames.length) { + return resolveModuleNamesWorker( + moduleNames, + file, + /*reusedNames*/ + void 0 + ); + } + var oldSourceFile2 = oldProgram && oldProgram.getSourceFile(file.fileName); + if (oldSourceFile2 !== file && file.resolvedModules) { + var result_14 = []; + var i2 = 0; + for (var _i2 = 0, moduleNames_1 = moduleNames; _i2 < moduleNames_1.length; _i2++) { + var moduleName = moduleNames_1[_i2]; + var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i2)); + i2++; + result_14.push(resolvedModule); + } + return result_14; + } + var unknownModuleNames; + var result; + var reusedNames; + var predictedToResolveToAmbientModuleMarker = {}; + for (var i2 = 0; i2 < moduleNames.length; i2++) { + var moduleName = moduleNames[i2]; + if (file === oldSourceFile2 && !hasInvalidatedResolutions(oldSourceFile2.path)) { + var oldResolvedModule = ts6.getResolvedModule(oldSourceFile2, moduleName, getModeForResolutionAtIndex(oldSourceFile2, i2)); + if (oldResolvedModule) { + if (ts6.isTraceEnabled(options, host)) { + ts6.trace(host, oldResolvedModule.packageId ? ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2, moduleName, ts6.getNormalizedAbsolutePath(file.originalFileName, currentDirectory), oldResolvedModule.resolvedFileName, oldResolvedModule.packageId && ts6.packageIdToString(oldResolvedModule.packageId)); + } + (result || (result = new Array(moduleNames.length)))[i2] = oldResolvedModule; + (reusedNames || (reusedNames = [])).push(moduleName); + continue; + } + } + var resolvesToAmbientModuleInNonModifiedFile = false; + if (ts6.contains(file.ambientModuleNames, moduleName)) { + resolvesToAmbientModuleInNonModifiedFile = true; + if (ts6.isTraceEnabled(options, host)) { + ts6.trace(host, ts6.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, ts6.getNormalizedAbsolutePath(file.originalFileName, currentDirectory)); + } + } else { + resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i2); + } + if (resolvesToAmbientModuleInNonModifiedFile) { + (result || (result = new Array(moduleNames.length)))[i2] = predictedToResolveToAmbientModuleMarker; + } else { + (unknownModuleNames || (unknownModuleNames = [])).push(moduleName); + } + } + var resolutions2 = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : ts6.emptyArray; + if (!result) { + ts6.Debug.assert(resolutions2.length === moduleNames.length); + return resolutions2; + } + var j = 0; + for (var i2 = 0; i2 < result.length; i2++) { + if (result[i2]) { + if (result[i2] === predictedToResolveToAmbientModuleMarker) { + result[i2] = void 0; + } + } else { + result[i2] = resolutions2[j]; + j++; + } + } + ts6.Debug.assert(j === resolutions2.length); + return result; + function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName2, index) { + if (index >= ts6.length(oldSourceFile2 === null || oldSourceFile2 === void 0 ? void 0 : oldSourceFile2.imports) + ts6.length(oldSourceFile2 === null || oldSourceFile2 === void 0 ? void 0 : oldSourceFile2.moduleAugmentations)) + return false; + var resolutionToFile = ts6.getResolvedModule(oldSourceFile2, moduleName2, oldSourceFile2 && getModeForResolutionAtIndex(oldSourceFile2, index)); + var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName); + if (resolutionToFile && resolvedFile) { + return false; + } + var unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName2); + if (!unmodifiedFile) { + return false; + } + if (ts6.isTraceEnabled(options, host)) { + ts6.trace(host, ts6.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName2, unmodifiedFile); + } + return true; + } + } + function canReuseProjectReferences() { + return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function(oldResolvedRef, parent, index) { + var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index]; + var newResolvedRef = parseProjectReferenceConfigFile(newRef); + if (oldResolvedRef) { + return !newResolvedRef || newResolvedRef.sourceFile !== oldResolvedRef.sourceFile || !ts6.arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newResolvedRef.commandLine.fileNames); + } else { + return newResolvedRef !== void 0; + } + }, function(oldProjectReferences, parent) { + var newReferences = parent ? getResolvedProjectReferenceByPath(parent.sourceFile.path).commandLine.projectReferences : projectReferences; + return !ts6.arrayIsEqualTo(oldProjectReferences, newReferences, ts6.projectReferenceIsEqualTo); + }); + } + function tryReuseStructureFromOldProgram() { + var _a2, _b2; + if (!oldProgram) { + return 0; + } + var oldOptions = oldProgram.getCompilerOptions(); + if (ts6.changesAffectModuleResolution(oldOptions, options)) { + return 0; + } + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts6.arrayIsEqualTo(oldRootNames, rootNames)) { + return 0; + } + if (!canReuseProjectReferences()) { + return 0; + } + if (projectReferences) { + resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile); + } + var newSourceFiles = []; + var modifiedSourceFiles = []; + structureIsReused = 2; + if (oldProgram.getMissingFilePaths().some(function(missingFilePath) { + return host.fileExists(missingFilePath); + })) { + return 0; + } + var oldSourceFiles2 = oldProgram.getSourceFiles(); + var SeenPackageName; + (function(SeenPackageName2) { + SeenPackageName2[SeenPackageName2["Exists"] = 0] = "Exists"; + SeenPackageName2[SeenPackageName2["Modified"] = 1] = "Modified"; + })(SeenPackageName || (SeenPackageName = {})); + var seenPackageNames = new ts6.Map(); + for (var _i2 = 0, oldSourceFiles_2 = oldSourceFiles2; _i2 < oldSourceFiles_2.length; _i2++) { + var oldSourceFile2 = oldSourceFiles_2[_i2]; + var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile2.fileName, moduleResolutionCache, host, options); + var newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath( + oldSourceFile2.fileName, + oldSourceFile2.resolvedPath, + sourceFileOptions, + /*onError*/ + void 0, + shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile2.impliedNodeFormat + ) : host.getSourceFile( + oldSourceFile2.fileName, + sourceFileOptions, + /*onError*/ + void 0, + shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile2.impliedNodeFormat + ); + if (!newSourceFile) { + return 0; + } + newSourceFile.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) === null || _a2 === void 0 ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0; + newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope; + ts6.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`"); + var fileChanged = void 0; + if (oldSourceFile2.redirectInfo) { + if (newSourceFile !== oldSourceFile2.redirectInfo.unredirected) { + return 0; + } + fileChanged = false; + newSourceFile = oldSourceFile2; + } else if (oldProgram.redirectTargetsMap.has(oldSourceFile2.path)) { + if (newSourceFile !== oldSourceFile2) { + return 0; + } + fileChanged = false; + } else { + fileChanged = newSourceFile !== oldSourceFile2; + } + newSourceFile.path = oldSourceFile2.path; + newSourceFile.originalFileName = oldSourceFile2.originalFileName; + newSourceFile.resolvedPath = oldSourceFile2.resolvedPath; + newSourceFile.fileName = oldSourceFile2.fileName; + var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile2.path); + if (packageName !== void 0) { + var prevKind = seenPackageNames.get(packageName); + var newKind = fileChanged ? 1 : 0; + if (prevKind !== void 0 && newKind === 1 || prevKind === 1) { + return 0; + } + seenPackageNames.set(packageName, newKind); + } + if (fileChanged) { + if (oldSourceFile2.impliedNodeFormat !== newSourceFile.impliedNodeFormat) { + structureIsReused = 1; + } else if (!ts6.arrayIsEqualTo(oldSourceFile2.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) { + structureIsReused = 1; + } else if (oldSourceFile2.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + structureIsReused = 1; + } else if (!ts6.arrayIsEqualTo(oldSourceFile2.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + structureIsReused = 1; + } else { + collectExternalModuleReferences(newSourceFile); + if (!ts6.arrayIsEqualTo(oldSourceFile2.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + structureIsReused = 1; + } else if (!ts6.arrayIsEqualTo(oldSourceFile2.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + structureIsReused = 1; + } else if ((oldSourceFile2.flags & 6291456) !== (newSourceFile.flags & 6291456)) { + structureIsReused = 1; + } else if (!ts6.arrayIsEqualTo(oldSourceFile2.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + structureIsReused = 1; + } + } + modifiedSourceFiles.push({ oldFile: oldSourceFile2, newFile: newSourceFile }); + } else if (hasInvalidatedResolutions(oldSourceFile2.path)) { + structureIsReused = 1; + modifiedSourceFiles.push({ oldFile: oldSourceFile2, newFile: newSourceFile }); + } + newSourceFiles.push(newSourceFile); + } + if (structureIsReused !== 2) { + return structureIsReused; + } + var modifiedFiles = modifiedSourceFiles.map(function(f) { + return f.oldFile; + }); + for (var _c2 = 0, oldSourceFiles_3 = oldSourceFiles2; _c2 < oldSourceFiles_3.length; _c2++) { + var oldFile = oldSourceFiles_3[_c2]; + if (!ts6.contains(modifiedFiles, oldFile)) { + for (var _d2 = 0, _e2 = oldFile.ambientModuleNames; _d2 < _e2.length; _d2++) { + var moduleName = _e2[_d2]; + ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName); + } + } + } + for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) { + var _g = modifiedSourceFiles_1[_f], oldSourceFile2 = _g.oldFile, newSourceFile = _g.newFile; + var moduleNames = getModuleNames(newSourceFile); + var resolutions2 = resolveModuleNamesReusingOldState(moduleNames, newSourceFile); + var resolutionsChanged = ts6.hasChangesInResolutions(moduleNames, resolutions2, oldSourceFile2.resolvedModules, oldSourceFile2, ts6.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + structureIsReused = 1; + newSourceFile.resolvedModules = ts6.zipToModeAwareCache(newSourceFile, moduleNames, resolutions2); + } else { + newSourceFile.resolvedModules = oldSourceFile2.resolvedModules; + } + var typesReferenceDirectives = newSourceFile.typeReferenceDirectives; + var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile); + var typeReferenceResolutionsChanged = ts6.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile2.resolvedTypeReferenceDirectiveNames, oldSourceFile2, ts6.typeDirectiveIsEqualTo); + if (typeReferenceResolutionsChanged) { + structureIsReused = 1; + newSourceFile.resolvedTypeReferenceDirectiveNames = ts6.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions); + } else { + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile2.resolvedTypeReferenceDirectiveNames; + } + } + if (structureIsReused !== 2) { + return structureIsReused; + } + if (ts6.changesAffectingProgramStructure(oldOptions, options) || ((_b2 = host.hasChangedAutomaticTypeDirectiveNames) === null || _b2 === void 0 ? void 0 : _b2.call(host))) { + return 1; + } + missingFilePaths = oldProgram.getMissingFilePaths(); + ts6.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length); + for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) { + var newSourceFile = newSourceFiles_1[_h]; + filesByName.set(newSourceFile.path, newSourceFile); + } + var oldFilesByNameMap = oldProgram.getFilesByNameMap(); + oldFilesByNameMap.forEach(function(oldFile2, path) { + if (!oldFile2) { + filesByName.set(path, oldFile2); + return; + } + if (oldFile2.path === path) { + if (oldProgram.isSourceFileFromExternalLibrary(oldFile2)) { + sourceFilesFoundSearchingNodeModules.set(oldFile2.path, true); + } + return; + } + filesByName.set(path, filesByName.get(oldFile2.path)); + }); + files = newSourceFiles; + fileReasons = oldProgram.getFileIncludeReasons(); + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); + sourceFileToPackageName = oldProgram.sourceFileToPackageName; + redirectTargetsMap = oldProgram.redirectTargetsMap; + usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules; + return 2; + } + function getEmitHost(writeFileCallback) { + return { + getPrependNodes, + getCanonicalFileName, + getCommonSourceDirectory: program.getCommonSourceDirectory, + getCompilerOptions: program.getCompilerOptions, + getCurrentDirectory: function() { + return currentDirectory; + }, + getNewLine: function() { + return host.getNewLine(); + }, + getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, + getSourceFiles: program.getSourceFiles, + getLibFileFromReference: program.getLibFileFromReference, + isSourceFileFromExternalLibrary, + getResolvedProjectReferenceToRedirect, + getProjectReferenceRedirect, + isSourceOfProjectReferenceRedirect, + getSymlinkCache, + writeFile: writeFileCallback || writeFile, + isEmitBlocked, + readFile: function(f) { + return host.readFile(f); + }, + fileExists: function(f) { + var path = toPath(f); + if (getSourceFileByPath(path)) + return true; + if (ts6.contains(missingFilePaths, path)) + return false; + return host.fileExists(f); + }, + useCaseSensitiveFileNames: function() { + return host.useCaseSensitiveFileNames(); + }, + getProgramBuildInfo: function() { + return program.getProgramBuildInfo && program.getProgramBuildInfo(); + }, + getSourceFileFromReference: function(file, ref) { + return program.getSourceFileFromReference(file, ref); + }, + redirectTargetsMap, + getFileIncludeReasons: program.getFileIncludeReasons, + createHash: ts6.maybeBind(host, host.createHash) + }; + } + function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) { + host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data); + } + function emitBuildInfo(writeFileCallback) { + ts6.Debug.assert(!ts6.outFile(options)); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push( + "emit", + "emitBuildInfo", + {}, + /*separateBeginAndEnd*/ + true + ); + ts6.performance.mark("beforeEmit"); + var emitResult = ts6.emitFiles( + ts6.notImplementedResolver, + getEmitHost(writeFileCallback), + /*targetSourceFile*/ + void 0, + /*transformers*/ + ts6.noTransformers, + /*emitOnlyDtsFiles*/ + false, + /*onlyBuildInfo*/ + true + ); + ts6.performance.mark("afterEmit"); + ts6.performance.measure("Emit", "beforeEmit", "afterEmit"); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return emitResult; + } + function getResolvedProjectReferences() { + return resolvedProjectReferences; + } + function getProjectReferences() { + return projectReferences; + } + function getPrependNodes() { + return createPrependNodes(projectReferences, function(_ref, index) { + var _a2; + return (_a2 = resolvedProjectReferences[index]) === null || _a2 === void 0 ? void 0 : _a2.commandLine; + }, function(fileName) { + var path = toPath(fileName); + var sourceFile = getSourceFileByPath(path); + return sourceFile ? sourceFile.text : filesByName.has(path) ? void 0 : host.readFile(path); + }); + } + function isSourceFileFromExternalLibrary(file) { + return !!sourceFilesFoundSearchingNodeModules.get(file.path); + } + function isSourceFileDefaultLibrary(file) { + if (!file.isDeclarationFile) { + return false; + } + if (file.hasNoDefaultLib) { + return true; + } + if (!options.noLib) { + return false; + } + var equalityComparer = host.useCaseSensitiveFileNames() ? ts6.equateStringsCaseSensitive : ts6.equateStringsCaseInsensitive; + if (!options.lib) { + return equalityComparer(file.fileName, getDefaultLibraryFileName()); + } else { + return ts6.some(options.lib, function(libFileName) { + return equalityComparer(file.fileName, pathForLibFile(libFileName)); + }); + } + } + function getTypeChecker() { + return typeChecker || (typeChecker = ts6.createTypeChecker(program)); + } + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push( + "emit", + "emit", + { path: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.path }, + /*separateBeginAndEnd*/ + true + ); + var result = runWithCancellationToken(function() { + return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit); + }); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return result; + } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.has(toPath(emitFileName)); + } + function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit) { + if (!forceDtsEmit) { + var result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken); + if (result) + return result; + } + var emitResolver = getTypeChecker().getEmitResolver(ts6.outFile(options) ? void 0 : sourceFile, cancellationToken); + ts6.performance.mark("beforeEmit"); + var emitResult = ts6.emitFiles( + emitResolver, + getEmitHost(writeFileCallback), + sourceFile, + ts6.getTransformers(options, customTransformers, emitOnlyDtsFiles), + emitOnlyDtsFiles, + /*onlyBuildInfo*/ + false, + forceDtsEmit + ); + ts6.performance.mark("afterEmit"); + ts6.performance.measure("Emit", "beforeEmit", "afterEmit"); + return emitResult; + } + function getSourceFile(fileName) { + return getSourceFileByPath(toPath(fileName)); + } + function getSourceFileByPath(path) { + return filesByName.get(path) || void 0; + } + function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { + if (sourceFile) { + return getDiagnostics(sourceFile, cancellationToken); + } + return ts6.sortAndDeduplicateDiagnostics(ts6.flatMap(program.getSourceFiles(), function(sourceFile2) { + if (cancellationToken) { + cancellationToken.throwIfCancellationRequested(); + } + return getDiagnostics(sourceFile2, cancellationToken); + })); + } + function getSyntacticDiagnostics(sourceFile, cancellationToken) { + return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); + } + function getSemanticDiagnostics(sourceFile, cancellationToken) { + return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); + } + function getCachedSemanticDiagnostics(sourceFile) { + var _a2; + return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) === null || _a2 === void 0 ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics; + } + function getBindAndCheckDiagnostics(sourceFile, cancellationToken) { + return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken); + } + function getProgramDiagnostics2(sourceFile) { + var _a2; + if (ts6.skipTypeChecking(sourceFile, options, program)) { + return ts6.emptyArray; + } + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + if (!((_a2 = sourceFile.commentDirectives) === null || _a2 === void 0 ? void 0 : _a2.length)) { + return programDiagnosticsInFile; + } + return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics; + } + function getDeclarationDiagnostics(sourceFile, cancellationToken) { + var options2 = program.getCompilerOptions(); + if (!sourceFile || ts6.outFile(options2)) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } + } + function getSyntacticDiagnosticsForFile(sourceFile) { + if (ts6.isSourceFileJS(sourceFile)) { + if (!sourceFile.additionalSyntacticDiagnostics) { + sourceFile.additionalSyntacticDiagnostics = getJSSyntacticDiagnosticsForFile(sourceFile); + } + return ts6.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics); + } + return sourceFile.parseDiagnostics; + } + function runWithCancellationToken(func) { + try { + return func(); + } catch (e) { + if (e instanceof ts6.OperationCanceledException) { + typeChecker = void 0; + } + throw e; + } + } + function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return ts6.concatenate(filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options), getProgramDiagnostics2(sourceFile)); + } + function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache); + } + function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) { + return runWithCancellationToken(function() { + if (ts6.skipTypeChecking(sourceFile, options, program)) { + return ts6.emptyArray; + } + var typeChecker2 = getTypeChecker(); + ts6.Debug.assert(!!sourceFile.bindDiagnostics); + var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2; + var isCheckJs = isJs && ts6.isCheckJsEnabledForFile(sourceFile, options); + var isPlainJs = ts6.isPlainJsFile(sourceFile, options.checkJs); + var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false; + var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4 || sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7); + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts6.emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker2.getDiagnostics(sourceFile, cancellationToken) : ts6.emptyArray; + if (isPlainJs) { + bindDiagnostics = ts6.filter(bindDiagnostics, function(d) { + return ts6.plainJSErrors.has(d.code); + }); + checkDiagnostics = ts6.filter(checkDiagnostics, function(d) { + return ts6.plainJSErrors.has(d.code); + }); + } + return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0); + }); + } + function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) { + var _a2; + var allDiagnostics = []; + for (var _i2 = 2; _i2 < arguments.length; _i2++) { + allDiagnostics[_i2 - 2] = arguments[_i2]; + } + var flatDiagnostics = ts6.flatten(allDiagnostics); + if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) === null || _a2 === void 0 ? void 0 : _a2.length)) { + return flatDiagnostics; + } + var _b2 = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics), diagnostics = _b2.diagnostics, directives = _b2.directives; + for (var _c2 = 0, _d2 = directives.getUnusedExpectations(); _c2 < _d2.length; _c2++) { + var errorExpectation = _d2[_c2]; + diagnostics.push(ts6.createDiagnosticForRange(sourceFile, errorExpectation.range, ts6.Diagnostics.Unused_ts_expect_error_directive)); + } + return diagnostics; + } + function getDiagnosticsWithPrecedingDirectives(sourceFile, commentDirectives, flatDiagnostics) { + var directives = ts6.createCommentDirectivesMap(sourceFile, commentDirectives); + var diagnostics = flatDiagnostics.filter(function(diagnostic) { + return markPrecedingCommentDirectiveLine(diagnostic, directives) === -1; + }); + return { diagnostics, directives }; + } + function getSuggestionDiagnostics(sourceFile, cancellationToken) { + return runWithCancellationToken(function() { + return getTypeChecker().getSuggestionDiagnostics(sourceFile, cancellationToken); + }); + } + function markPrecedingCommentDirectiveLine(diagnostic, directives) { + var file = diagnostic.file, start = diagnostic.start; + if (!file) { + return -1; + } + var lineStarts = ts6.getLineStarts(file); + var line = ts6.computeLineAndCharacterOfPosition(lineStarts, start).line - 1; + while (line >= 0) { + if (directives.markUsed(line)) { + return line; + } + var lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim(); + if (lineText !== "" && !/^(\s*)\/\/(.*)$/.test(lineText)) { + return -1; + } + line--; + } + return -1; + } + function getJSSyntacticDiagnosticsForFile(sourceFile) { + return runWithCancellationToken(function() { + var diagnostics = []; + walk(sourceFile, sourceFile); + ts6.forEachChildRecursively(sourceFile, walk, walkArray); + return diagnostics; + function walk(node, parent) { + switch (parent.kind) { + case 166: + case 169: + case 171: + if (parent.questionToken === node) { + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); + return "skip"; + } + case 170: + case 173: + case 174: + case 175: + case 215: + case 259: + case 216: + case 257: + if (parent.type === node) { + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + } + switch (node.kind) { + case 270: + if (node.isTypeOnly) { + diagnostics.push(createDiagnosticForNode(parent, ts6.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); + return "skip"; + } + break; + case 275: + if (node.isTypeOnly) { + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); + return "skip"; + } + break; + case 273: + case 278: + if (node.isTypeOnly) { + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts6.isImportSpecifier(node) ? "import...type" : "export...type")); + return "skip"; + } + break; + case 268: + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.import_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 274: + if (node.isExportEquals) { + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.export_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + break; + case 294: + var heritageClause = node; + if (heritageClause.token === 117) { + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + break; + case 261: + var interfaceKeyword = ts6.tokenToString( + 118 + /* SyntaxKind.InterfaceKeyword */ + ); + ts6.Debug.assertIsDefined(interfaceKeyword); + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); + return "skip"; + case 264: + var moduleKeyword = node.flags & 16 ? ts6.tokenToString( + 143 + /* SyntaxKind.NamespaceKeyword */ + ) : ts6.tokenToString( + 142 + /* SyntaxKind.ModuleKeyword */ + ); + ts6.Debug.assertIsDefined(moduleKeyword); + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); + return "skip"; + case 262: + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 263: + var enumKeyword = ts6.Debug.checkDefined(ts6.tokenToString( + 92 + /* SyntaxKind.EnumKeyword */ + )); + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); + return "skip"; + case 232: + diagnostics.push(createDiagnosticForNode(node, ts6.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 231: + diagnostics.push(createDiagnosticForNode(node.type, ts6.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 235: + diagnostics.push(createDiagnosticForNode(node.type, ts6.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213: + ts6.Debug.fail(); + } + } + function walkArray(nodes, parent) { + if (ts6.canHaveModifiers(parent) && parent.modifiers === nodes && ts6.some(nodes, ts6.isDecorator) && !options.experimentalDecorators) { + diagnostics.push(createDiagnosticForNode(parent, ts6.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); + } + switch (parent.kind) { + case 260: + case 228: + case 171: + case 173: + case 174: + case 175: + case 215: + case 259: + case 216: + if (nodes === parent.typeParameters) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts6.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + case 240: + if (nodes === parent.modifiers) { + checkModifiers( + parent.modifiers, + parent.kind === 240 + /* SyntaxKind.VariableStatement */ + ); + return "skip"; + } + break; + case 169: + if (nodes === parent.modifiers) { + for (var _i2 = 0, _a2 = nodes; _i2 < _a2.length; _i2++) { + var modifier = _a2[_i2]; + if (ts6.isModifier(modifier) && modifier.kind !== 124 && modifier.kind !== 127) { + diagnostics.push(createDiagnosticForNode(modifier, ts6.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts6.tokenToString(modifier.kind))); + } + } + return "skip"; + } + break; + case 166: + if (nodes === parent.modifiers && ts6.some(nodes, ts6.isModifier)) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts6.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + break; + case 210: + case 211: + case 230: + case 282: + case 283: + case 212: + if (nodes === parent.typeArguments) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts6.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + break; + } + } + function checkModifiers(modifiers, isConstValid) { + for (var _i2 = 0, modifiers_2 = modifiers; _i2 < modifiers_2.length; _i2++) { + var modifier = modifiers_2[_i2]; + switch (modifier.kind) { + case 85: + if (isConstValid) { + continue; + } + case 123: + case 121: + case 122: + case 146: + case 136: + case 126: + case 161: + case 101: + case 145: + diagnostics.push(createDiagnosticForNode(modifier, ts6.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts6.tokenToString(modifier.kind))); + break; + case 124: + case 93: + case 88: + case 127: + } + } + } + function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) { + var start = nodes.pos; + return ts6.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2); + } + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + return ts6.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); + } + }); + } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); + } + function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { + return runWithCancellationToken(function() { + var resolver = getTypeChecker().getEmitResolver(sourceFile, cancellationToken); + return ts6.getDeclarationDiagnostics(getEmitHost(ts6.noop), resolver, sourceFile) || ts6.emptyArray; + }); + } + function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { + var _a2; + var cachedResult = sourceFile ? (_a2 = cache.perFile) === null || _a2 === void 0 ? void 0 : _a2.get(sourceFile.path) : cache.allDiagnostics; + if (cachedResult) { + return cachedResult; + } + var result = getDiagnostics(sourceFile, cancellationToken); + if (sourceFile) { + (cache.perFile || (cache.perFile = new ts6.Map())).set(sourceFile.path, result); + } else { + cache.allDiagnostics = result; + } + return result; + } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + function getOptionsDiagnostics() { + return ts6.sortAndDeduplicateDiagnostics(ts6.concatenate(programDiagnostics.getGlobalDiagnostics(), getOptionsDiagnosticsOfConfigFile())); + } + function getOptionsDiagnosticsOfConfigFile() { + if (!options.configFile) + return ts6.emptyArray; + var diagnostics = programDiagnostics.getDiagnostics(options.configFile.fileName); + forEachResolvedProjectReference2(function(resolvedRef) { + diagnostics = ts6.concatenate(diagnostics, programDiagnostics.getDiagnostics(resolvedRef.sourceFile.fileName)); + }); + return diagnostics; + } + function getGlobalDiagnostics() { + return rootNames.length ? ts6.sortAndDeduplicateDiagnostics(getTypeChecker().getGlobalDiagnostics().slice()) : ts6.emptyArray; + } + function getConfigFileParsingDiagnostics2() { + return configFileParsingDiagnostics || ts6.emptyArray; + } + function processRootFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason) { + processSourceFile( + ts6.normalizePath(fileName), + isDefaultLib, + ignoreNoDefaultLib, + /*packageId*/ + void 0, + reason + ); + } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; + } + function moduleNameIsEqualTo(a, b) { + return a.kind === 79 ? b.kind === 79 && a.escapedText === b.escapedText : b.kind === 10 && a.text === b.text; + } + function createSyntheticImport(text, file) { + var externalHelpersModuleReference = ts6.factory.createStringLiteral(text); + var importDecl = ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + /*importClause*/ + void 0, + externalHelpersModuleReference, + /*assertClause*/ + void 0 + ); + ts6.addEmitFlags( + importDecl, + 67108864 + /* EmitFlags.NeverApplyImportHelper */ + ); + ts6.setParent(externalHelpersModuleReference, importDecl); + ts6.setParent(importDecl, file); + externalHelpersModuleReference.flags &= ~8; + importDecl.flags &= ~8; + return externalHelpersModuleReference; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; + } + var isJavaScriptFile = ts6.isSourceFileJS(file); + var isExternalModuleFile = ts6.isExternalModule(file); + var imports; + var moduleAugmentations; + var ambientModules; + if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { + if (options.importHelpers) { + imports = [createSyntheticImport(ts6.externalHelpersModuleNameText, file)]; + } + var jsxImport = ts6.getJSXRuntimeImport(ts6.getJSXImplicitImportBase(options, file), options); + if (jsxImport) { + (imports || (imports = [])).push(createSyntheticImport(jsxImport, file)); + } + } + for (var _i2 = 0, _a2 = file.statements; _i2 < _a2.length; _i2++) { + var node = _a2[_i2]; + collectModuleReferences( + node, + /*inAmbientModule*/ + false + ); + } + if (file.flags & 2097152 || isJavaScriptFile) { + collectDynamicImportOrRequireCalls(file); + } + file.imports = imports || ts6.emptyArray; + file.moduleAugmentations = moduleAugmentations || ts6.emptyArray; + file.ambientModuleNames = ambientModules || ts6.emptyArray; + return; + function collectModuleReferences(node2, inAmbientModule) { + if (ts6.isAnyImportOrReExport(node2)) { + var moduleNameExpr = ts6.getExternalModuleName(node2); + if (moduleNameExpr && ts6.isStringLiteral(moduleNameExpr) && moduleNameExpr.text && (!inAmbientModule || !ts6.isExternalModuleNameRelative(moduleNameExpr.text))) { + ts6.setParentRecursive( + node2, + /*incremental*/ + false + ); + imports = ts6.append(imports, moduleNameExpr); + if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) { + usesUriStyleNodeCoreModules = ts6.startsWith(moduleNameExpr.text, "node:"); + } + } + } else if (ts6.isModuleDeclaration(node2)) { + if (ts6.isAmbientModule(node2) && (inAmbientModule || ts6.hasSyntacticModifier( + node2, + 2 + /* ModifierFlags.Ambient */ + ) || file.isDeclarationFile)) { + node2.name.parent = node2; + var nameText = ts6.getTextOfIdentifierOrLiteral(node2.name); + if (isExternalModuleFile || inAmbientModule && !ts6.isExternalModuleNameRelative(nameText)) { + (moduleAugmentations || (moduleAugmentations = [])).push(node2.name); + } else if (!inAmbientModule) { + if (file.isDeclarationFile) { + (ambientModules || (ambientModules = [])).push(nameText); + } + var body = node2.body; + if (body) { + for (var _i3 = 0, _a3 = body.statements; _i3 < _a3.length; _i3++) { + var statement = _a3[_i3]; + collectModuleReferences( + statement, + /*inAmbientModule*/ + true + ); + } + } + } + } + } + } + function collectDynamicImportOrRequireCalls(file2) { + var r = /import|require/g; + while (r.exec(file2.text) !== null) { + var node2 = getNodeAtPosition(file2, r.lastIndex); + if (isJavaScriptFile && ts6.isRequireCall( + node2, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + ts6.setParentRecursive( + node2, + /*incremental*/ + false + ); + imports = ts6.append(imports, node2.arguments[0]); + } else if (ts6.isImportCall(node2) && node2.arguments.length >= 1 && ts6.isStringLiteralLike(node2.arguments[0])) { + ts6.setParentRecursive( + node2, + /*incremental*/ + false + ); + imports = ts6.append(imports, node2.arguments[0]); + } else if (ts6.isLiteralImportTypeNode(node2)) { + ts6.setParentRecursive( + node2, + /*incremental*/ + false + ); + imports = ts6.append(imports, node2.argument.literal); + } + } + } + function getNodeAtPosition(sourceFile, position) { + var current = sourceFile; + var getContainingChild = function(child2) { + if (child2.pos <= position && (position < child2.end || position === child2.end && child2.kind === 1)) { + return child2; + } + }; + while (true) { + var child = isJavaScriptFile && ts6.hasJSDocNodes(current) && ts6.forEach(current.jsDoc, getContainingChild) || ts6.forEachChild(current, getContainingChild); + if (!child) { + return current; + } + current = child; + } + } + } + function getLibFileFromReference(ref) { + var libName = ts6.toFileNameLowerCase(ref.fileName); + var libFileName = ts6.libMap.get(libName); + if (libFileName) { + return getSourceFile(pathForLibFile(libFileName)); + } + } + function getSourceFileFromReference(referencingFile, ref) { + return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile); + } + function getSourceFileFromReferenceWorker(fileName, getSourceFile2, fail, reason) { + if (ts6.hasExtension(fileName)) { + var canonicalFileName_1 = host.getCanonicalFileName(fileName); + if (!options.allowNonTsExtensions && !ts6.forEach(ts6.flatten(supportedExtensionsWithJsonIfResolveJsonModule), function(extension) { + return ts6.fileExtensionIs(canonicalFileName_1, extension); + })) { + if (fail) { + if (ts6.hasJSFileExtension(canonicalFileName_1)) { + fail(ts6.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName); + } else { + fail(ts6.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + ts6.flatten(supportedExtensions).join("', '") + "'"); + } + } + return void 0; + } + var sourceFile = getSourceFile2(fileName); + if (fail) { + if (!sourceFile) { + var redirect = getProjectReferenceRedirect(fileName); + if (redirect) { + fail(ts6.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, fileName); + } else { + fail(ts6.Diagnostics.File_0_not_found, fileName); + } + } else if (isReferencedFile(reason) && canonicalFileName_1 === host.getCanonicalFileName(getSourceFileByPath(reason.file).fileName)) { + fail(ts6.Diagnostics.A_file_cannot_have_a_reference_to_itself); + } + } + return sourceFile; + } else { + var sourceFileNoExtension = options.allowNonTsExtensions && getSourceFile2(fileName); + if (sourceFileNoExtension) + return sourceFileNoExtension; + if (fail && options.allowNonTsExtensions) { + fail(ts6.Diagnostics.File_0_not_found, fileName); + return void 0; + } + var sourceFileWithAddedExtension = ts6.forEach(supportedExtensions[0], function(extension) { + return getSourceFile2(fileName + extension); + }); + if (fail && !sourceFileWithAddedExtension) + fail(ts6.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + ts6.flatten(supportedExtensions).join("', '") + "'"); + return sourceFileWithAddedExtension; + } + } + function processSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, packageId, reason) { + getSourceFileFromReferenceWorker( + fileName, + function(fileName2) { + return findSourceFile(fileName2, isDefaultLib, ignoreNoDefaultLib, reason, packageId); + }, + // TODO: GH#18217 + function(diagnostic) { + var args = []; + for (var _i2 = 1; _i2 < arguments.length; _i2++) { + args[_i2 - 1] = arguments[_i2]; + } + return addFilePreprocessingFileExplainingDiagnostic( + /*file*/ + void 0, + reason, + diagnostic, + args + ); + }, + reason + ); + } + function processProjectReferenceFile(fileName, reason) { + return processSourceFile( + fileName, + /*isDefaultLib*/ + false, + /*ignoreNoDefaultLib*/ + false, + /*packageId*/ + void 0, + reason + ); + } + function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) { + var hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && ts6.some(fileReasons.get(existingFile.path), isReferencedFile); + if (hasExistingReasonToReportErrorOn) { + addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts6.Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]); + } else { + addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts6.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, [fileName, existingFile.fileName]); + } + } + function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) { + var _a2; + var redirect = Object.create(redirectTarget); + redirect.fileName = fileName; + redirect.path = path; + redirect.resolvedPath = resolvedPath; + redirect.originalFileName = originalFileName; + redirect.redirectInfo = { redirectTarget, unredirected }; + redirect.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) === null || _a2 === void 0 ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0; + redirect.packageJsonScope = sourceFileOptions.packageJsonScope; + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); + Object.defineProperties(redirect, { + id: { + get: function() { + return this.redirectInfo.redirectTarget.id; + }, + set: function(value) { + this.redirectInfo.redirectTarget.id = value; + } + }, + symbol: { + get: function() { + return this.redirectInfo.redirectTarget.symbol; + }, + set: function(value) { + this.redirectInfo.redirectTarget.symbol = value; + } + } + }); + return redirect; + } + function findSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "findSourceFile", { + fileName, + isDefaultLib: isDefaultLib || void 0, + fileIncludeKind: ts6.FileIncludeKind[reason.kind] + }); + var result = findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + return result; + } + function getCreateSourceFileOptions(fileName, moduleResolutionCache2, host2, options2) { + var result = getImpliedNodeFormatForFileWorker(ts6.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 === null || moduleResolutionCache2 === void 0 ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2); + var languageVersion = ts6.getEmitScriptTarget(options2); + var setExternalModuleIndicator = ts6.getSetExternalModuleIndicator(options2); + return typeof result === "object" ? __assign(__assign({}, result), { languageVersion, setExternalModuleIndicator }) : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator }; + } + function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { + var _a2, _b2; + var path = toPath(fileName); + if (useSourceOfProjectReferenceRedirect) { + var source = getSourceOfProjectReferenceRedirect(path); + if (!source && host.realpath && options.preserveSymlinks && ts6.isDeclarationFileName(fileName) && ts6.stringContains(fileName, ts6.nodeModulesPathPart)) { + var realPath = toPath(host.realpath(fileName)); + if (realPath !== path) + source = getSourceOfProjectReferenceRedirect(realPath); + } + if (source) { + var file_1 = ts6.isString(source) ? findSourceFile(source, isDefaultLib, ignoreNoDefaultLib, reason, packageId) : void 0; + if (file_1) + addFileToFilesByName( + file_1, + path, + /*redirectedPath*/ + void 0 + ); + return file_1; + } + } + var originalFileName = fileName; + if (filesByName.has(path)) { + var file_2 = filesByName.get(path); + addFileIncludeReason(file_2 || void 0, reason); + if (file_2 && options.forceConsistentCasingInFileNames) { + var checkedName = file_2.fileName; + var isRedirect = toPath(checkedName) !== toPath(fileName); + if (isRedirect) { + fileName = getProjectReferenceRedirect(fileName) || fileName; + } + var checkedAbsolutePath = ts6.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory); + var inputAbsolutePath = ts6.getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory); + if (checkedAbsolutePath !== inputAbsolutePath) { + reportFileNamesDifferOnlyInCasingError(fileName, file_2, reason); + } + } + if (file_2 && sourceFilesFoundSearchingNodeModules.get(file_2.path) && currentNodeModulesDepth === 0) { + sourceFilesFoundSearchingNodeModules.set(file_2.path, false); + if (!options.noResolve) { + processReferencedFiles(file_2, isDefaultLib); + processTypeReferenceDirectives(file_2); + } + if (!options.noLib) { + processLibReferenceDirectives(file_2); + } + modulesWithElidedImports.set(file_2.path, false); + processImportedModules(file_2); + } else if (file_2 && modulesWithElidedImports.get(file_2.path)) { + if (currentNodeModulesDepth < maxNodeModuleJsDepth) { + modulesWithElidedImports.set(file_2.path, false); + processImportedModules(file_2); + } + } + return file_2 || void 0; + } + var redirectedPath; + if (isReferencedFile(reason) && !useSourceOfProjectReferenceRedirect) { + var redirectProject = getProjectReferenceRedirectProject(fileName); + if (redirectProject) { + if (ts6.outFile(redirectProject.commandLine.options)) { + return void 0; + } + var redirect = getProjectReferenceOutputName(redirectProject, fileName); + fileName = redirect; + redirectedPath = toPath(redirect); + } + } + var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options); + var file = host.getSourceFile(fileName, sourceFileOptions, function(hostErrorMessage) { + return addFilePreprocessingFileExplainingDiagnostic( + /*file*/ + void 0, + reason, + ts6.Diagnostics.Cannot_read_file_0_Colon_1, + [fileName, hostErrorMessage] + ); + }, shouldCreateNewSourceFile || ((_a2 = oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFileByPath(toPath(fileName))) === null || _a2 === void 0 ? void 0 : _a2.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat); + if (packageId) { + var packageIdKey = ts6.packageIdToString(packageId); + var fileFromPackageId = packageIdToSourceFile.get(packageIdKey); + if (fileFromPackageId) { + var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName, sourceFileOptions); + redirectTargetsMap.add(fileFromPackageId.path, fileName); + addFileToFilesByName(dupFile, path, redirectedPath); + addFileIncludeReason(dupFile, reason); + sourceFileToPackageName.set(path, ts6.packageIdToPackageName(packageId)); + processingOtherFiles.push(dupFile); + return dupFile; + } else if (file) { + packageIdToSourceFile.set(packageIdKey, file); + sourceFileToPackageName.set(path, ts6.packageIdToPackageName(packageId)); + } + } + addFileToFilesByName(file, path, redirectedPath); + if (file) { + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); + file.fileName = fileName; + file.path = path; + file.resolvedPath = toPath(fileName); + file.originalFileName = originalFileName; + file.packageJsonLocations = ((_b2 = sourceFileOptions.packageJsonLocations) === null || _b2 === void 0 ? void 0 : _b2.length) ? sourceFileOptions.packageJsonLocations : void 0; + file.packageJsonScope = sourceFileOptions.packageJsonScope; + addFileIncludeReason(file, reason); + if (host.useCaseSensitiveFileNames()) { + var pathLowerCase = ts6.toFileNameLowerCase(path); + var existingFile = filesByNameIgnoreCase.get(pathLowerCase); + if (existingFile) { + reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason); + } else { + filesByNameIgnoreCase.set(pathLowerCase, file); + } + } + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib && !ignoreNoDefaultLib; + if (!options.noResolve) { + processReferencedFiles(file, isDefaultLib); + processTypeReferenceDirectives(file); + } + if (!options.noLib) { + processLibReferenceDirectives(file); + } + processImportedModules(file); + if (isDefaultLib) { + processingDefaultLibFiles.push(file); + } else { + processingOtherFiles.push(file); + } + } + return file; + } + function addFileIncludeReason(file, reason) { + if (file) + fileReasons.add(file.path, reason); + } + function addFileToFilesByName(file, path, redirectedPath) { + if (redirectedPath) { + filesByName.set(redirectedPath, file); + filesByName.set(path, file || false); + } else { + filesByName.set(path, file); + } + } + function getProjectReferenceRedirect(fileName) { + var referencedProject = getProjectReferenceRedirectProject(fileName); + return referencedProject && getProjectReferenceOutputName(referencedProject, fileName); + } + function getProjectReferenceRedirectProject(fileName) { + if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts6.isDeclarationFileName(fileName) || ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + )) { + return void 0; + } + return getResolvedProjectReferenceToRedirect(fileName); + } + function getProjectReferenceOutputName(referencedProject, fileName) { + var out = ts6.outFile(referencedProject.commandLine.options); + return out ? ts6.changeExtension( + out, + ".d.ts" + /* Extension.Dts */ + ) : ts6.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames()); + } + function getResolvedProjectReferenceToRedirect(fileName) { + if (mapFromFileToProjectReferenceRedirects === void 0) { + mapFromFileToProjectReferenceRedirects = new ts6.Map(); + forEachResolvedProjectReference2(function(referencedProject) { + if (toPath(options.configFilePath) !== referencedProject.sourceFile.path) { + referencedProject.commandLine.fileNames.forEach(function(f) { + return mapFromFileToProjectReferenceRedirects.set(toPath(f), referencedProject.sourceFile.path); + }); + } + }); + } + var referencedProjectPath = mapFromFileToProjectReferenceRedirects.get(toPath(fileName)); + return referencedProjectPath && getResolvedProjectReferenceByPath(referencedProjectPath); + } + function forEachResolvedProjectReference2(cb) { + return ts6.forEachResolvedProjectReference(resolvedProjectReferences, cb); + } + function getSourceOfProjectReferenceRedirect(path) { + if (!ts6.isDeclarationFileName(path)) + return void 0; + if (mapFromToProjectReferenceRedirectSource === void 0) { + mapFromToProjectReferenceRedirectSource = new ts6.Map(); + forEachResolvedProjectReference2(function(resolvedRef) { + var out = ts6.outFile(resolvedRef.commandLine.options); + if (out) { + var outputDts = ts6.changeExtension( + out, + ".d.ts" + /* Extension.Dts */ + ); + mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), true); + } else { + var getCommonSourceDirectory_3 = ts6.memoize(function() { + return ts6.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); + }); + ts6.forEach(resolvedRef.commandLine.fileNames, function(fileName) { + if (!ts6.isDeclarationFileName(fileName) && !ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + )) { + var outputDts2 = ts6.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3); + mapFromToProjectReferenceRedirectSource.set(toPath(outputDts2), fileName); + } + }); + } + }); + } + return mapFromToProjectReferenceRedirectSource.get(path); + } + function isSourceOfProjectReferenceRedirect(fileName) { + return useSourceOfProjectReferenceRedirect && !!getResolvedProjectReferenceToRedirect(fileName); + } + function getResolvedProjectReferenceByPath(projectReferencePath) { + if (!projectReferenceRedirects) { + return void 0; + } + return projectReferenceRedirects.get(projectReferencePath) || void 0; + } + function processReferencedFiles(file, isDefaultLib) { + ts6.forEach(file.referencedFiles, function(ref, index) { + processSourceFile( + resolveTripleslashReference(ref.fileName, file.fileName), + isDefaultLib, + /*ignoreNoDefaultLib*/ + false, + /*packageId*/ + void 0, + { kind: ts6.FileIncludeKind.ReferenceFile, file: file.path, index } + ); + }); + } + function processTypeReferenceDirectives(file) { + var typeDirectives = file.typeReferenceDirectives; + if (!typeDirectives) { + return; + } + var resolutions2 = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file); + for (var index = 0; index < typeDirectives.length; index++) { + var ref = file.typeReferenceDirectives[index]; + var resolvedTypeReferenceDirective = resolutions2[index]; + var fileName = ts6.toFileNameLowerCase(ref.fileName); + ts6.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective); + var mode = ref.resolutionMode || file.impliedNodeFormat; + if (mode && ts6.getEmitModuleResolutionKind(options) !== ts6.ModuleResolutionKind.Node16 && ts6.getEmitModuleResolutionKind(options) !== ts6.ModuleResolutionKind.NodeNext) { + programDiagnostics.add(ts6.createDiagnosticForRange(file, ref, ts6.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)); + } + processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts6.FileIncludeKind.TypeReferenceDirective, file: file.path, index }); + } + } + function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 }); + processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason); + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.pop(); + } + function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) { + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode); + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.isExternalLibraryImport) + currentNodeModulesDepth++; + if (resolvedTypeReferenceDirective.primary) { + processSourceFile( + resolvedTypeReferenceDirective.resolvedFileName, + /*isDefaultLib*/ + false, + /*ignoreNoDefaultLib*/ + false, + resolvedTypeReferenceDirective.packageId, + reason + ); + } else { + if (previousResolution) { + if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + var existingFile = getSourceFile(previousResolution.resolvedFileName); + if (otherFileText !== existingFile.text) { + addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts6.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, [typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName]); + } + } + saveResolution = false; + } else { + processSourceFile( + resolvedTypeReferenceDirective.resolvedFileName, + /*isDefaultLib*/ + false, + /*ignoreNoDefaultLib*/ + false, + resolvedTypeReferenceDirective.packageId, + reason + ); + } + } + if (resolvedTypeReferenceDirective.isExternalLibraryImport) + currentNodeModulesDepth--; + } else { + addFilePreprocessingFileExplainingDiagnostic( + /*file*/ + void 0, + reason, + ts6.Diagnostics.Cannot_find_type_definition_file_for_0, + [typeReferenceDirective] + ); + } + if (saveResolution) { + resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective); + } + } + function pathForLibFile(libFileName) { + var components = libFileName.split("."); + var path = components[1]; + var i2 = 2; + while (components[i2] && components[i2] !== "d") { + path += (i2 === 2 ? "/" : "-") + components[i2]; + i2++; + } + var resolveFrom = ts6.combinePaths(currentDirectory, "__lib_node_modules_lookup_".concat(libFileName, "__.ts")); + var localOverrideModuleResult = ts6.resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: ts6.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache); + if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) { + return localOverrideModuleResult.resolvedModule.resolvedFileName; + } + return ts6.combinePaths(defaultLibraryPath, libFileName); + } + function processLibReferenceDirectives(file) { + ts6.forEach(file.libReferenceDirectives, function(libReference, index) { + var libName = ts6.toFileNameLowerCase(libReference.fileName); + var libFileName = ts6.libMap.get(libName); + if (libFileName) { + processRootFile( + pathForLibFile(libFileName), + /*isDefaultLib*/ + true, + /*ignoreNoDefaultLib*/ + true, + { kind: ts6.FileIncludeKind.LibReferenceDirective, file: file.path, index } + ); + } else { + var unqualifiedLibName = ts6.removeSuffix(ts6.removePrefix(libName, "lib."), ".d.ts"); + var suggestion = ts6.getSpellingSuggestion(unqualifiedLibName, ts6.libs, ts6.identity); + var diagnostic = suggestion ? ts6.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts6.Diagnostics.Cannot_find_lib_definition_for_0; + (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({ + kind: 0, + reason: { kind: ts6.FileIncludeKind.LibReferenceDirective, file: file.path, index }, + diagnostic, + args: [libName, suggestion] + }); + } + }); + } + function getCanonicalFileName(fileName) { + return host.getCanonicalFileName(fileName); + } + function processImportedModules(file) { + var _a2; + collectExternalModuleReferences(file); + if (file.imports.length || file.moduleAugmentations.length) { + var moduleNames = getModuleNames(file); + var resolutions2 = resolveModuleNamesReusingOldState(moduleNames, file); + ts6.Debug.assert(resolutions2.length === moduleNames.length); + var optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) === null || _a2 === void 0 ? void 0 : _a2.commandLine.options : void 0) || options; + for (var index = 0; index < moduleNames.length; index++) { + var resolution = resolutions2[index]; + ts6.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index)); + if (!resolution) { + continue; + } + var isFromNodeModulesSearch = resolution.isExternalLibraryImport; + var isJsFile = !ts6.resolutionExtensionIsTSOrJson(resolution.extension); + var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile; + var resolvedFileName = resolution.resolvedFileName; + if (isFromNodeModulesSearch) { + currentNodeModulesDepth++; + } + var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; + var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !ts6.getAllowJSCompilerOption(optionsForFile)) && (ts6.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608)); + if (elideImport) { + modulesWithElidedImports.set(file.path, true); + } else if (shouldAddFile) { + findSourceFile( + resolvedFileName, + /*isDefaultLib*/ + false, + /*ignoreNoDefaultLib*/ + false, + { kind: ts6.FileIncludeKind.Import, file: file.path, index }, + resolution.packageId + ); + } + if (isFromNodeModulesSearch) { + currentNodeModulesDepth--; + } + } + } else { + file.resolvedModules = void 0; + } + } + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts6.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i2 = 0, sourceFiles_2 = sourceFiles; _i2 < sourceFiles_2.length; _i2++) { + var sourceFile = sourceFiles_2[_i2]; + if (!sourceFile.isDeclarationFile) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts6.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + addProgramDiagnosticExplainingFile(sourceFile, ts6.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, [sourceFile.fileName, rootDirectory]); + allFilesBelongToPath = false; + } + } + } + return allFilesBelongToPath; + } + function parseProjectReferenceConfigFile(ref) { + if (!projectReferenceRedirects) { + projectReferenceRedirects = new ts6.Map(); + } + var refPath = resolveProjectReferencePath(ref); + var sourceFilePath = toPath(refPath); + var fromCache = projectReferenceRedirects.get(sourceFilePath); + if (fromCache !== void 0) { + return fromCache || void 0; + } + var commandLine; + var sourceFile; + if (host.getParsedCommandLine) { + commandLine = host.getParsedCommandLine(refPath); + if (!commandLine) { + addFileToFilesByName( + /*sourceFile*/ + void 0, + sourceFilePath, + /*redirectedPath*/ + void 0 + ); + projectReferenceRedirects.set(sourceFilePath, false); + return void 0; + } + sourceFile = ts6.Debug.checkDefined(commandLine.options.configFile); + ts6.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath); + addFileToFilesByName( + sourceFile, + sourceFilePath, + /*redirectedPath*/ + void 0 + ); + } else { + var basePath = ts6.getNormalizedAbsolutePath(ts6.getDirectoryPath(refPath), host.getCurrentDirectory()); + sourceFile = host.getSourceFile( + refPath, + 100 + /* ScriptTarget.JSON */ + ); + addFileToFilesByName( + sourceFile, + sourceFilePath, + /*redirectedPath*/ + void 0 + ); + if (sourceFile === void 0) { + projectReferenceRedirects.set(sourceFilePath, false); + return void 0; + } + commandLine = ts6.parseJsonSourceFileConfigFileContent( + sourceFile, + configParsingHost, + basePath, + /*existingOptions*/ + void 0, + refPath + ); + } + sourceFile.fileName = refPath; + sourceFile.path = sourceFilePath; + sourceFile.resolvedPath = sourceFilePath; + sourceFile.originalFileName = refPath; + var resolvedRef = { commandLine, sourceFile }; + projectReferenceRedirects.set(sourceFilePath, resolvedRef); + if (commandLine.projectReferences) { + resolvedRef.references = commandLine.projectReferences.map(parseProjectReferenceConfigFile); + } + return resolvedRef; + } + function verifyCompilerOptions() { + if (options.strictPropertyInitialization && !ts6.getStrictOptionValue(options, "strictNullChecks")) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks"); + } + if (options.exactOptionalPropertyTypes && !ts6.getStrictOptionValue(options, "strictNullChecks")) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks"); + } + if (options.isolatedModules) { + if (options.out) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"); + } + if (options.outFile) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"); + } + } + if (options.inlineSourceMap) { + if (options.sourceMap) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"); + } + if (options.mapRoot) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"); + } + } + if (options.composite) { + if (options.declaration === false) { + createDiagnosticForOptionName(ts6.Diagnostics.Composite_projects_may_not_disable_declaration_emit, "declaration"); + } + if (options.incremental === false) { + createDiagnosticForOptionName(ts6.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration"); + } + } + var outputFile = ts6.outFile(options); + if (options.tsBuildInfoFile) { + if (!ts6.isIncrementalCompilation(options)) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite"); + } + } else if (options.incremental && !outputFile && !options.configFilePath) { + programDiagnostics.add(ts6.createCompilerDiagnostic(ts6.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); + } + verifyProjectReferences(); + if (options.composite) { + var rootPaths = new ts6.Set(rootNames.map(toPath)); + for (var _i2 = 0, files_4 = files; _i2 < files_4.length; _i2++) { + var file = files_4[_i2]; + if (ts6.sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) { + addProgramDiagnosticExplainingFile(file, ts6.Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, [file.fileName, options.configFilePath || ""]); + } + } + } + if (options.paths) { + for (var key in options.paths) { + if (!ts6.hasProperty(options.paths, key)) { + continue; + } + if (!ts6.hasZeroOrOneAsteriskCharacter(key)) { + createDiagnosticForOptionPaths( + /*onKey*/ + true, + key, + ts6.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, + key + ); + } + if (ts6.isArray(options.paths[key])) { + var len = options.paths[key].length; + if (len === 0) { + createDiagnosticForOptionPaths( + /*onKey*/ + false, + key, + ts6.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, + key + ); + } + for (var i2 = 0; i2 < len; i2++) { + var subst = options.paths[key][i2]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!ts6.hasZeroOrOneAsteriskCharacter(subst)) { + createDiagnosticForOptionPathKeyValue(key, i2, ts6.Diagnostics.Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character, subst, key); + } + if (!options.baseUrl && !ts6.pathIsRelative(subst) && !ts6.pathIsAbsolute(subst)) { + createDiagnosticForOptionPathKeyValue(key, i2, ts6.Diagnostics.Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash); + } + } else { + createDiagnosticForOptionPathKeyValue(key, i2, ts6.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst); + } + } + } else { + createDiagnosticForOptionPaths( + /*onKey*/ + false, + key, + ts6.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, + key + ); + } + } + } + if (!options.sourceMap && !options.inlineSourceMap) { + if (options.inlineSources) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources"); + } + if (options.sourceRoot) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot"); + } + } + if (options.out && options.outFile) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"); + } + if (options.mapRoot && !(options.sourceMap || options.declarationMap)) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMap"); + } + if (options.declarationDir) { + if (!ts6.getEmitDeclarations(options)) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "declarationDir", "declaration", "composite"); + } + if (outputFile) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile"); + } + } + if (options.declarationMap && !ts6.getEmitDeclarations(options)) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "declarationMap", "declaration", "composite"); + } + if (options.lib && options.noLib) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib"); + } + if (options.noImplicitUseStrict && ts6.getStrictOptionValue(options, "alwaysStrict")) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"); + } + var languageVersion = ts6.getEmitScriptTarget(options); + var firstNonAmbientExternalModuleSourceFile = ts6.find(files, function(f) { + return ts6.isExternalModule(f) && !f.isDeclarationFile; + }); + if (options.isolatedModules) { + if (options.module === ts6.ModuleKind.None && languageVersion < 2) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target"); + } + if (options.preserveConstEnums === false) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); + } + for (var _a2 = 0, files_5 = files; _a2 < files_5.length; _a2++) { + var file = files_5[_a2]; + if (!ts6.isExternalModule(file) && !ts6.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6) { + var span = ts6.getErrorSpanForNode(file, file); + programDiagnostics.add(ts6.createFileDiagnostic(file, span.start, span.length, ts6.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts6.getBaseFileName(file.fileName))); + } + } + } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts6.ModuleKind.None) { + var span = ts6.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts6.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts6.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)); + } + if (outputFile && !options.emitDeclarationOnly) { + if (options.module && !(options.module === ts6.ModuleKind.AMD || options.module === ts6.ModuleKind.System)) { + createDiagnosticForOptionName(ts6.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module"); + } else if (options.module === void 0 && firstNonAmbientExternalModuleSourceFile) { + var span = ts6.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts6.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts6.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile")); + } + } + if (options.resolveJsonModule) { + if (ts6.getEmitModuleResolutionKind(options) !== ts6.ModuleResolutionKind.NodeJs && ts6.getEmitModuleResolutionKind(options) !== ts6.ModuleResolutionKind.Node16 && ts6.getEmitModuleResolutionKind(options) !== ts6.ModuleResolutionKind.NodeNext) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule"); + } else if (!ts6.hasJsonModuleEmitEnabled(options)) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module"); + } + } + if (options.outDir || // there is --outDir specified + options.rootDir || // there is --rootDir specified + options.sourceRoot || // there is --sourceRoot specified + options.mapRoot) { + var dir = getCommonSourceDirectory(); + if (options.outDir && dir === "" && files.some(function(file2) { + return ts6.getRootLength(file2.fileName) > 1; + })) { + createDiagnosticForOptionName(ts6.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir"); + } + } + if (options.useDefineForClassFields && languageVersion === 0) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3, "useDefineForClassFields"); + } + if (options.checkJs && !ts6.getAllowJSCompilerOption(options)) { + programDiagnostics.add(ts6.createCompilerDiagnostic(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); + } + if (options.emitDeclarationOnly) { + if (!ts6.getEmitDeclarations(options)) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite"); + } + if (options.noEmit) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit"); + } + } + if (options.emitDecoratorMetadata && !options.experimentalDecorators) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"); + } + if (options.jsxFactory) { + if (options.reactNamespace) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory"); + } + if (options.jsx === 4 || options.jsx === 5) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxFactory", ts6.inverseJsxOptionMap.get("" + options.jsx)); + } + if (!ts6.parseIsolatedEntityName(options.jsxFactory, languageVersion)) { + createOptionValueDiagnostic("jsxFactory", ts6.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory); + } + } else if (options.reactNamespace && !ts6.isIdentifierText(options.reactNamespace, languageVersion)) { + createOptionValueDiagnostic("reactNamespace", ts6.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace); + } + if (options.jsxFragmentFactory) { + if (!options.jsxFactory) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "jsxFragmentFactory", "jsxFactory"); + } + if (options.jsx === 4 || options.jsx === 5) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxFragmentFactory", ts6.inverseJsxOptionMap.get("" + options.jsx)); + } + if (!ts6.parseIsolatedEntityName(options.jsxFragmentFactory, languageVersion)) { + createOptionValueDiagnostic("jsxFragmentFactory", ts6.Diagnostics.Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFragmentFactory); + } + } + if (options.reactNamespace) { + if (options.jsx === 4 || options.jsx === 5) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "reactNamespace", ts6.inverseJsxOptionMap.get("" + options.jsx)); + } + } + if (options.jsxImportSource) { + if (options.jsx === 2) { + createDiagnosticForOptionName(ts6.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxImportSource", ts6.inverseJsxOptionMap.get("" + options.jsx)); + } + } + if (options.preserveValueImports && ts6.getEmitModuleKind(options) < ts6.ModuleKind.ES2015) { + createOptionValueDiagnostic("importsNotUsedAsValues", ts6.Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later); + } + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = new ts6.Set(); + ts6.forEachEmittedFile(emitHost, function(emitFileNames) { + if (!options.emitDeclarationOnly) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + } + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = toPath(emitFileName); + if (filesByName.has(emitFilePath)) { + var chain = void 0; + if (!options.configFilePath) { + chain = ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig + ); + } + chain = ts6.chainDiagnosticMessages(chain, ts6.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); + blockEmittingOfFile(emitFileName, ts6.createCompilerDiagnosticFromMessageChain(chain)); + } + var emitFileKey = !host.useCaseSensitiveFileNames() ? ts6.toFileNameLowerCase(emitFilePath) : emitFilePath; + if (emitFilesSeen.has(emitFileKey)) { + blockEmittingOfFile(emitFileName, ts6.createCompilerDiagnostic(ts6.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName)); + } else { + emitFilesSeen.add(emitFileKey); + } + } + } + } + function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) { + var _a2; + var fileIncludeReasons; + var relatedInfo; + var locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0; + if (file) + (_a2 = fileReasons.get(file.path)) === null || _a2 === void 0 ? void 0 : _a2.forEach(processReason); + if (fileProcessingReason) + processReason(fileProcessingReason); + if (locationReason && (fileIncludeReasons === null || fileIncludeReasons === void 0 ? void 0 : fileIncludeReasons.length) === 1) + fileIncludeReasons = void 0; + var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason); + var fileIncludeReasonDetails = fileIncludeReasons && ts6.chainDiagnosticMessages(fileIncludeReasons, ts6.Diagnostics.The_file_is_in_the_program_because_Colon); + var redirectInfo = file && ts6.explainIfFileIsRedirectAndImpliedFormat(file); + var chain = ts6.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts6.emptyArray, false)); + return location && isReferenceFileLocation(location) ? ts6.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : ts6.createCompilerDiagnosticFromMessageChain(chain, relatedInfo); + function processReason(reason) { + (fileIncludeReasons || (fileIncludeReasons = [])).push(ts6.fileIncludeReasonToDiagnostics(program, reason)); + if (!locationReason && isReferencedFile(reason)) { + locationReason = reason; + } else if (locationReason !== reason) { + relatedInfo = ts6.append(relatedInfo, fileIncludeReasonToRelatedInformation(reason)); + } + if (reason === fileProcessingReason) + fileProcessingReason = void 0; + } + } + function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) { + (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({ + kind: 1, + file: file && file.path, + fileProcessingReason, + diagnostic, + args + }); + } + function addProgramDiagnosticExplainingFile(file, diagnostic, args) { + programDiagnostics.add(createDiagnosticExplainingFile( + file, + /*fileProcessingReason*/ + void 0, + diagnostic, + args + )); + } + function fileIncludeReasonToRelatedInformation(reason) { + if (isReferencedFile(reason)) { + var referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason); + var message_2; + switch (reason.kind) { + case ts6.FileIncludeKind.Import: + message_2 = ts6.Diagnostics.File_is_included_via_import_here; + break; + case ts6.FileIncludeKind.ReferenceFile: + message_2 = ts6.Diagnostics.File_is_included_via_reference_here; + break; + case ts6.FileIncludeKind.TypeReferenceDirective: + message_2 = ts6.Diagnostics.File_is_included_via_type_library_reference_here; + break; + case ts6.FileIncludeKind.LibReferenceDirective: + message_2 = ts6.Diagnostics.File_is_included_via_library_reference_here; + break; + default: + ts6.Debug.assertNever(reason); + } + return isReferenceFileLocation(referenceLocation) ? ts6.createFileDiagnostic(referenceLocation.file, referenceLocation.pos, referenceLocation.end - referenceLocation.pos, message_2) : void 0; + } + if (!options.configFile) + return void 0; + var configFileNode; + var message; + switch (reason.kind) { + case ts6.FileIncludeKind.RootFile: + if (!options.configFile.configFileSpecs) + return void 0; + var fileName = ts6.getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory); + var matchedByFiles = ts6.getMatchedFileSpec(program, fileName); + if (matchedByFiles) { + configFileNode = ts6.getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles); + message = ts6.Diagnostics.File_is_matched_by_files_list_specified_here; + break; + } + var matchedByInclude = ts6.getMatchedIncludeSpec(program, fileName); + if (!matchedByInclude || !ts6.isString(matchedByInclude)) + return void 0; + configFileNode = ts6.getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude); + message = ts6.Diagnostics.File_is_matched_by_include_pattern_specified_here; + break; + case ts6.FileIncludeKind.SourceFromProjectReference: + case ts6.FileIncludeKind.OutputFromProjectReference: + var referencedResolvedRef_1 = ts6.Debug.checkDefined(resolvedProjectReferences === null || resolvedProjectReferences === void 0 ? void 0 : resolvedProjectReferences[reason.index]); + var referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, function(resolvedRef, parent, index2) { + return resolvedRef === referencedResolvedRef_1 ? { sourceFile: (parent === null || parent === void 0 ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0; + }); + if (!referenceInfo) + return void 0; + var sourceFile = referenceInfo.sourceFile, index = referenceInfo.index; + var referencesSyntax = ts6.firstDefined(ts6.getTsConfigPropArray(sourceFile, "references"), function(property) { + return ts6.isArrayLiteralExpression(property.initializer) ? property.initializer : void 0; + }); + return referencesSyntax && referencesSyntax.elements.length > index ? ts6.createDiagnosticForNodeInSourceFile(sourceFile, referencesSyntax.elements[index], reason.kind === ts6.FileIncludeKind.OutputFromProjectReference ? ts6.Diagnostics.File_is_output_from_referenced_project_specified_here : ts6.Diagnostics.File_is_source_from_referenced_project_specified_here) : void 0; + case ts6.FileIncludeKind.AutomaticTypeDirectiveFile: + if (!options.types) + return void 0; + configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference); + message = ts6.Diagnostics.File_is_entry_point_of_type_library_specified_here; + break; + case ts6.FileIncludeKind.LibFile: + if (reason.index !== void 0) { + configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib[reason.index]); + message = ts6.Diagnostics.File_is_library_specified_here; + break; + } + var target = ts6.forEachEntry(ts6.targetOptionDeclaration.type, function(value, key) { + return value === ts6.getEmitScriptTarget(options) ? key : void 0; + }); + configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0; + message = ts6.Diagnostics.File_is_default_library_for_target_specified_here; + break; + default: + ts6.Debug.assertNever(reason); + } + return configFileNode && ts6.createDiagnosticForNodeInSourceFile(options.configFile, configFileNode, message); + } + function verifyProjectReferences() { + var buildInfoPath = !options.suppressOutputPathCheck ? ts6.getTsBuildInfoEmitOutputFilePath(options) : void 0; + forEachProjectReference(projectReferences, resolvedProjectReferences, function(resolvedRef, parent, index) { + var ref = (parent ? parent.commandLine.projectReferences : projectReferences)[index]; + var parentFile = parent && parent.sourceFile; + if (!resolvedRef) { + createDiagnosticForReference(parentFile, index, ts6.Diagnostics.File_0_not_found, ref.path); + return; + } + var options2 = resolvedRef.commandLine.options; + if (!options2.composite || options2.noEmit) { + var inputs = parent ? parent.commandLine.fileNames : rootNames; + if (inputs.length) { + if (!options2.composite) + createDiagnosticForReference(parentFile, index, ts6.Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path); + if (options2.noEmit) + createDiagnosticForReference(parentFile, index, ts6.Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path); + } + } + if (ref.prepend) { + var out = ts6.outFile(options2); + if (out) { + if (!host.fileExists(out)) { + createDiagnosticForReference(parentFile, index, ts6.Diagnostics.Output_file_0_from_project_1_does_not_exist, out, ref.path); + } + } else { + createDiagnosticForReference(parentFile, index, ts6.Diagnostics.Cannot_prepend_project_0_because_it_does_not_have_outFile_set, ref.path); + } + } + if (!parent && buildInfoPath && buildInfoPath === ts6.getTsBuildInfoEmitOutputFilePath(options2)) { + createDiagnosticForReference(parentFile, index, ts6.Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path); + hasEmitBlockingDiagnostics.set(toPath(buildInfoPath), true); + } + }); + } + function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) { + var needCompilerDiagnostic = true; + var pathsSyntax = getOptionPathsSyntax(); + for (var _i2 = 0, pathsSyntax_1 = pathsSyntax; _i2 < pathsSyntax_1.length; _i2++) { + var pathProp = pathsSyntax_1[_i2]; + if (ts6.isObjectLiteralExpression(pathProp.initializer)) { + for (var _a2 = 0, _b2 = ts6.getPropertyAssignment(pathProp.initializer, key); _a2 < _b2.length; _a2++) { + var keyProps = _b2[_a2]; + var initializer = keyProps.initializer; + if (ts6.isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) { + programDiagnostics.add(ts6.createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, arg0, arg1, arg2)); + needCompilerDiagnostic = false; + } + } + } + } + if (needCompilerDiagnostic) { + programDiagnostics.add(ts6.createCompilerDiagnostic(message, arg0, arg1, arg2)); + } + } + function createDiagnosticForOptionPaths(onKey, key, message, arg0) { + var needCompilerDiagnostic = true; + var pathsSyntax = getOptionPathsSyntax(); + for (var _i2 = 0, pathsSyntax_2 = pathsSyntax; _i2 < pathsSyntax_2.length; _i2++) { + var pathProp = pathsSyntax_2[_i2]; + if (ts6.isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax( + pathProp.initializer, + onKey, + key, + /*key2*/ + void 0, + message, + arg0 + )) { + needCompilerDiagnostic = false; + } + } + if (needCompilerDiagnostic) { + programDiagnostics.add(ts6.createCompilerDiagnostic(message, arg0)); + } + } + function getOptionsSyntaxByName(name) { + var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + return compilerOptionsObjectLiteralSyntax && ts6.getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name); + } + function getOptionPathsSyntax() { + return getOptionsSyntaxByName("paths") || ts6.emptyArray; + } + function getOptionsSyntaxByValue(name, value) { + var syntaxByName = getOptionsSyntaxByName(name); + return syntaxByName && ts6.firstDefined(syntaxByName, function(property) { + return ts6.isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0; + }); + } + function getOptionsSyntaxByArrayElementValue(name, value) { + var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + return compilerOptionsObjectLiteralSyntax && ts6.getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value); + } + function createDiagnosticForOptionName(message, option1, option2, option3) { + createDiagnosticForOption( + /*onKey*/ + true, + option1, + option2, + message, + option1, + option2, + option3 + ); + } + function createOptionValueDiagnostic(option1, message, arg0, arg1) { + createDiagnosticForOption( + /*onKey*/ + false, + option1, + /*option2*/ + void 0, + message, + arg0, + arg1 + ); + } + function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) { + var referencesSyntax = ts6.firstDefined(ts6.getTsConfigPropArray(sourceFile || options.configFile, "references"), function(property) { + return ts6.isArrayLiteralExpression(property.initializer) ? property.initializer : void 0; + }); + if (referencesSyntax && referencesSyntax.elements.length > index) { + programDiagnostics.add(ts6.createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1)); + } else { + programDiagnostics.add(ts6.createCompilerDiagnostic(message, arg0, arg1)); + } + } + function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) { + var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + var needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2); + if (needCompilerDiagnostic) { + programDiagnostics.add(ts6.createCompilerDiagnostic(message, arg0, arg1, arg2)); + } + } + function getCompilerOptionsObjectLiteralSyntax() { + if (_compilerOptionsObjectLiteralSyntax === void 0) { + _compilerOptionsObjectLiteralSyntax = false; + var jsonObjectLiteral = ts6.getTsConfigObjectLiteralExpression(options.configFile); + if (jsonObjectLiteral) { + for (var _i2 = 0, _a2 = ts6.getPropertyAssignment(jsonObjectLiteral, "compilerOptions"); _i2 < _a2.length; _i2++) { + var prop = _a2[_i2]; + if (ts6.isObjectLiteralExpression(prop.initializer)) { + _compilerOptionsObjectLiteralSyntax = prop.initializer; + break; + } + } + } + } + return _compilerOptionsObjectLiteralSyntax || void 0; + } + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) { + var props = ts6.getPropertyAssignment(objectLiteral, key1, key2); + for (var _i2 = 0, props_3 = props; _i2 < props_3.length; _i2++) { + var prop = props_3[_i2]; + programDiagnostics.add(ts6.createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2)); + } + return !!props.length; + } + function blockEmittingOfFile(emitFileName, diag) { + hasEmitBlockingDiagnostics.set(toPath(emitFileName), true); + programDiagnostics.add(diag); + } + function isEmittedFile(file) { + if (options.noEmit) { + return false; + } + var filePath = toPath(file); + if (getSourceFileByPath(filePath)) { + return false; + } + var out = ts6.outFile(options); + if (out) { + return isSameFile(filePath, out) || isSameFile( + filePath, + ts6.removeFileExtension(out) + ".d.ts" + /* Extension.Dts */ + ); + } + if (options.declarationDir && ts6.containsPath(options.declarationDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames())) { + return true; + } + if (options.outDir) { + return ts6.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames()); + } + if (ts6.fileExtensionIsOneOf(filePath, ts6.supportedJSExtensionsFlat) || ts6.isDeclarationFileName(filePath)) { + var filePathWithoutExtension = ts6.removeFileExtension(filePath); + return !!getSourceFileByPath(filePathWithoutExtension + ".ts") || !!getSourceFileByPath(filePathWithoutExtension + ".tsx"); + } + return false; + } + function isSameFile(file1, file2) { + return ts6.comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) === 0; + } + function getSymlinkCache() { + if (host.getSymlinkCache) { + return host.getSymlinkCache(); + } + if (!symlinks) { + symlinks = ts6.createSymlinkCache(currentDirectory, getCanonicalFileName); + } + if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) { + symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives); + } + return symlinks; + } + } + ts6.createProgram = createProgram2; + function updateHostForUseSourceOfProjectReferenceRedirect(host) { + var setOfDeclarationDirectories; + var originalFileExists = host.compilerHost.fileExists; + var originalDirectoryExists = host.compilerHost.directoryExists; + var originalGetDirectories = host.compilerHost.getDirectories; + var originalRealpath = host.compilerHost.realpath; + if (!host.useSourceOfProjectReferenceRedirect) + return { onProgramCreateComplete: ts6.noop, fileExists }; + host.compilerHost.fileExists = fileExists; + var directoryExists; + if (originalDirectoryExists) { + directoryExists = host.compilerHost.directoryExists = function(path) { + if (originalDirectoryExists.call(host.compilerHost, path)) { + handleDirectoryCouldBeSymlink(path); + return true; + } + if (!host.getResolvedProjectReferences()) + return false; + if (!setOfDeclarationDirectories) { + setOfDeclarationDirectories = new ts6.Set(); + host.forEachResolvedProjectReference(function(ref) { + var out = ts6.outFile(ref.commandLine.options); + if (out) { + setOfDeclarationDirectories.add(ts6.getDirectoryPath(host.toPath(out))); + } else { + var declarationDir = ref.commandLine.options.declarationDir || ref.commandLine.options.outDir; + if (declarationDir) { + setOfDeclarationDirectories.add(host.toPath(declarationDir)); + } + } + }); + } + return fileOrDirectoryExistsUsingSource( + path, + /*isFile*/ + false + ); + }; + } + if (originalGetDirectories) { + host.compilerHost.getDirectories = function(path) { + return !host.getResolvedProjectReferences() || originalDirectoryExists && originalDirectoryExists.call(host.compilerHost, path) ? originalGetDirectories.call(host.compilerHost, path) : []; + }; + } + if (originalRealpath) { + host.compilerHost.realpath = function(s) { + var _a; + return ((_a = host.getSymlinkCache().getSymlinkedFiles()) === null || _a === void 0 ? void 0 : _a.get(host.toPath(s))) || originalRealpath.call(host.compilerHost, s); + }; + } + return { onProgramCreateComplete, fileExists, directoryExists }; + function onProgramCreateComplete() { + host.compilerHost.fileExists = originalFileExists; + host.compilerHost.directoryExists = originalDirectoryExists; + host.compilerHost.getDirectories = originalGetDirectories; + } + function fileExists(file) { + if (originalFileExists.call(host.compilerHost, file)) + return true; + if (!host.getResolvedProjectReferences()) + return false; + if (!ts6.isDeclarationFileName(file)) + return false; + return fileOrDirectoryExistsUsingSource( + file, + /*isFile*/ + true + ); + } + function fileExistsIfProjectReferenceDts(file) { + var source = host.getSourceOfProjectReferenceRedirect(host.toPath(file)); + return source !== void 0 ? ts6.isString(source) ? originalFileExists.call(host.compilerHost, source) : true : void 0; + } + function directoryExistsIfProjectReferenceDeclDir(dir) { + var dirPath = host.toPath(dir); + var dirPathWithTrailingDirectorySeparator = "".concat(dirPath).concat(ts6.directorySeparator); + return ts6.forEachKey(setOfDeclarationDirectories, function(declDirPath) { + return dirPath === declDirPath || // Any parent directory of declaration dir + ts6.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) || // Any directory inside declaration dir + ts6.startsWith(dirPath, "".concat(declDirPath, "/")); + }); + } + function handleDirectoryCouldBeSymlink(directory) { + var _a; + if (!host.getResolvedProjectReferences() || ts6.containsIgnoredPath(directory)) + return; + if (!originalRealpath || !ts6.stringContains(directory, ts6.nodeModulesPathPart)) + return; + var symlinkCache = host.getSymlinkCache(); + var directoryPath = ts6.ensureTrailingDirectorySeparator(host.toPath(directory)); + if ((_a = symlinkCache.getSymlinkedDirectories()) === null || _a === void 0 ? void 0 : _a.has(directoryPath)) + return; + var real = ts6.normalizePath(originalRealpath.call(host.compilerHost, directory)); + var realPath; + if (real === directory || (realPath = ts6.ensureTrailingDirectorySeparator(host.toPath(real))) === directoryPath) { + symlinkCache.setSymlinkedDirectory(directoryPath, false); + return; + } + symlinkCache.setSymlinkedDirectory(directory, { + real: ts6.ensureTrailingDirectorySeparator(real), + realPath + }); + } + function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) { + var _a; + var fileOrDirectoryExistsUsingSource2 = isFile ? function(file) { + return fileExistsIfProjectReferenceDts(file); + } : function(dir) { + return directoryExistsIfProjectReferenceDeclDir(dir); + }; + var result = fileOrDirectoryExistsUsingSource2(fileOrDirectory); + if (result !== void 0) + return result; + var symlinkCache = host.getSymlinkCache(); + var symlinkedDirectories = symlinkCache.getSymlinkedDirectories(); + if (!symlinkedDirectories) + return false; + var fileOrDirectoryPath = host.toPath(fileOrDirectory); + if (!ts6.stringContains(fileOrDirectoryPath, ts6.nodeModulesPathPart)) + return false; + if (isFile && ((_a = symlinkCache.getSymlinkedFiles()) === null || _a === void 0 ? void 0 : _a.has(fileOrDirectoryPath))) + return true; + return ts6.firstDefinedIterator(symlinkedDirectories.entries(), function(_a2) { + var directoryPath = _a2[0], symlinkedDirectory = _a2[1]; + if (!symlinkedDirectory || !ts6.startsWith(fileOrDirectoryPath, directoryPath)) + return void 0; + var result2 = fileOrDirectoryExistsUsingSource2(fileOrDirectoryPath.replace(directoryPath, symlinkedDirectory.realPath)); + if (isFile && result2) { + var absolutePath = ts6.getNormalizedAbsolutePath(fileOrDirectory, host.compilerHost.getCurrentDirectory()); + symlinkCache.setSymlinkedFile(fileOrDirectoryPath, "".concat(symlinkedDirectory.real).concat(absolutePath.replace(new RegExp(directoryPath, "i"), ""))); + } + return result2; + }) || false; + } + } + ts6.emitSkippedWithNoDiagnostics = { diagnostics: ts6.emptyArray, sourceMaps: void 0, emittedFiles: void 0, emitSkipped: true }; + function handleNoEmitOptions(program, sourceFile, writeFile, cancellationToken) { + var options = program.getCompilerOptions(); + if (options.noEmit) { + program.getSemanticDiagnostics(sourceFile, cancellationToken); + return sourceFile || ts6.outFile(options) ? ts6.emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile, cancellationToken); + } + if (!options.noEmitOnError) + return void 0; + var diagnostics = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], program.getOptionsDiagnostics(cancellationToken), true), program.getSyntacticDiagnostics(sourceFile, cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true), program.getSemanticDiagnostics(sourceFile, cancellationToken), true); + if (diagnostics.length === 0 && ts6.getEmitDeclarations(program.getCompilerOptions())) { + diagnostics = program.getDeclarationDiagnostics( + /*sourceFile*/ + void 0, + cancellationToken + ); + } + if (!diagnostics.length) + return void 0; + var emittedFiles; + if (!sourceFile && !ts6.outFile(options)) { + var emitResult = program.emitBuildInfo(writeFile, cancellationToken); + if (emitResult.diagnostics) + diagnostics = __spreadArray(__spreadArray([], diagnostics, true), emitResult.diagnostics, true); + emittedFiles = emitResult.emittedFiles; + } + return { diagnostics, sourceMaps: void 0, emittedFiles, emitSkipped: true }; + } + ts6.handleNoEmitOptions = handleNoEmitOptions; + function filterSemanticDiagnostics(diagnostic, option) { + return ts6.filter(diagnostic, function(d) { + return !d.skippedOn || !option[d.skippedOn]; + }); + } + ts6.filterSemanticDiagnostics = filterSemanticDiagnostics; + function parseConfigHostFromCompilerHostLike(host, directoryStructureHost) { + if (directoryStructureHost === void 0) { + directoryStructureHost = host; + } + return { + fileExists: function(f) { + return directoryStructureHost.fileExists(f); + }, + readDirectory: function(root, extensions, excludes, includes, depth) { + ts6.Debug.assertIsDefined(directoryStructureHost.readDirectory, "'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'"); + return directoryStructureHost.readDirectory(root, extensions, excludes, includes, depth); + }, + readFile: function(f) { + return directoryStructureHost.readFile(f); + }, + useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(), + getCurrentDirectory: function() { + return host.getCurrentDirectory(); + }, + onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic || ts6.returnUndefined, + trace: host.trace ? function(s) { + return host.trace(s); + } : void 0 + }; + } + ts6.parseConfigHostFromCompilerHostLike = parseConfigHostFromCompilerHostLike; + function createPrependNodes(projectReferences, getCommandLine, readFile) { + if (!projectReferences) + return ts6.emptyArray; + var nodes; + for (var i = 0; i < projectReferences.length; i++) { + var ref = projectReferences[i]; + var resolvedRefOpts = getCommandLine(ref, i); + if (ref.prepend && resolvedRefOpts && resolvedRefOpts.options) { + var out = ts6.outFile(resolvedRefOpts.options); + if (!out) + continue; + var _a = ts6.getOutputPathsForBundle( + resolvedRefOpts.options, + /*forceDtsPaths*/ + true + ), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath; + var node = ts6.createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath); + (nodes || (nodes = [])).push(node); + } + } + return nodes || ts6.emptyArray; + } + ts6.createPrependNodes = createPrependNodes; + function resolveProjectReferencePath(hostOrRef, ref) { + var passedInRef = ref ? ref : hostOrRef; + return ts6.resolveConfigFileProjectName(passedInRef.path); + } + ts6.resolveProjectReferencePath = resolveProjectReferencePath; + function getResolutionDiagnostic(options, _a) { + var extension = _a.extension; + switch (extension) { + case ".ts": + case ".d.ts": + return void 0; + case ".tsx": + return needJsx(); + case ".jsx": + return needJsx() || needAllowJs(); + case ".js": + return needAllowJs(); + case ".json": + return needResolveJsonModule(); + } + function needJsx() { + return options.jsx ? void 0 : ts6.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set; + } + function needAllowJs() { + return ts6.getAllowJSCompilerOption(options) || !ts6.getStrictOptionValue(options, "noImplicitAny") ? void 0 : ts6.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type; + } + function needResolveJsonModule() { + return options.resolveJsonModule ? void 0 : ts6.Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used; + } + } + ts6.getResolutionDiagnostic = getResolutionDiagnostic; + function getModuleNames(_a) { + var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; + var res = imports.map(function(i) { + return i.text; + }); + for (var _i = 0, moduleAugmentations_1 = moduleAugmentations; _i < moduleAugmentations_1.length; _i++) { + var aug = moduleAugmentations_1[_i]; + if (aug.kind === 10) { + res.push(aug.text); + } + } + return res; + } + function getModuleNameStringLiteralAt(_a, index) { + var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations; + if (index < imports.length) + return imports[index]; + var augIndex = imports.length; + for (var _i = 0, moduleAugmentations_2 = moduleAugmentations; _i < moduleAugmentations_2.length; _i++) { + var aug = moduleAugmentations_2[_i]; + if (aug.kind === 10) { + if (index === augIndex) + return aug; + augIndex++; + } + } + ts6.Debug.fail("should never ask for module name at index higher than possible module name"); + } + ts6.getModuleNameStringLiteralAt = getModuleNameStringLiteralAt; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) { + var outputFiles = []; + var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics; + return { outputFiles, emitSkipped, diagnostics }; + function writeFile(fileName, text, writeByteOrderMark) { + outputFiles.push({ name: fileName, writeByteOrderMark, text }); + } + } + ts6.getFileEmitOutput = getFileEmitOutput; + var BuilderState; + (function(BuilderState2) { + function createManyToManyPathMap() { + function create2(forward, reverse, deleted) { + var map = { + getKeys: function(v) { + return reverse.get(v); + }, + getValues: function(k) { + return forward.get(k); + }, + keys: function() { + return forward.keys(); + }, + deleteKey: function(k) { + (deleted || (deleted = new ts6.Set())).add(k); + var set = forward.get(k); + if (!set) { + return false; + } + set.forEach(function(v) { + return deleteFromMultimap(reverse, v, k); + }); + forward.delete(k); + return true; + }, + set: function(k, vSet) { + deleted === null || deleted === void 0 ? void 0 : deleted.delete(k); + var existingVSet = forward.get(k); + forward.set(k, vSet); + existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function(v) { + if (!vSet.has(v)) { + deleteFromMultimap(reverse, v, k); + } + }); + vSet.forEach(function(v) { + if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) { + addToMultimap(reverse, v, k); + } + }); + return map; + } + }; + return map; + } + return create2( + new ts6.Map(), + new ts6.Map(), + /*deleted*/ + void 0 + ); + } + BuilderState2.createManyToManyPathMap = createManyToManyPathMap; + function addToMultimap(map, k, v) { + var set = map.get(k); + if (!set) { + set = new ts6.Set(); + map.set(k, set); + } + set.add(v); + } + function deleteFromMultimap(map, k, v) { + var set = map.get(k); + if (set === null || set === void 0 ? void 0 : set.delete(v)) { + if (!set.size) { + map.delete(k); + } + return true; + } + return false; + } + function getReferencedFilesFromImportedModuleSymbol(symbol) { + return ts6.mapDefined(symbol.declarations, function(declaration) { + var _a; + return (_a = ts6.getSourceFileOfNode(declaration)) === null || _a === void 0 ? void 0 : _a.resolvedPath; + }); + } + function getReferencedFilesFromImportLiteral(checker, importName) { + var symbol = checker.getSymbolAtLocation(importName); + return symbol && getReferencedFilesFromImportedModuleSymbol(symbol); + } + function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) { + return ts6.toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName); + } + function getReferencedFiles(program, sourceFile, getCanonicalFileName) { + var referencedFiles; + if (sourceFile.imports && sourceFile.imports.length > 0) { + var checker = program.getTypeChecker(); + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importName = _a[_i]; + var declarationSourceFilePaths = getReferencedFilesFromImportLiteral(checker, importName); + declarationSourceFilePaths === null || declarationSourceFilePaths === void 0 ? void 0 : declarationSourceFilePaths.forEach(addReferencedFile); + } + } + var sourceFileDirectory = ts6.getDirectoryPath(sourceFile.resolvedPath); + if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) { + for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { + var referencedFile = _c[_b]; + var referencedPath = getReferencedFileFromFileName(program, referencedFile.fileName, sourceFileDirectory, getCanonicalFileName); + addReferencedFile(referencedPath); + } + } + if (sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function(resolvedTypeReferenceDirective) { + if (!resolvedTypeReferenceDirective) { + return; + } + var fileName = resolvedTypeReferenceDirective.resolvedFileName; + var typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName); + addReferencedFile(typeFilePath); + }); + } + if (sourceFile.moduleAugmentations.length) { + var checker = program.getTypeChecker(); + for (var _d = 0, _e = sourceFile.moduleAugmentations; _d < _e.length; _d++) { + var moduleName = _e[_d]; + if (!ts6.isStringLiteral(moduleName)) + continue; + var symbol = checker.getSymbolAtLocation(moduleName); + if (!symbol) + continue; + addReferenceFromAmbientModule(symbol); + } + } + for (var _f = 0, _g = program.getTypeChecker().getAmbientModules(); _f < _g.length; _f++) { + var ambientModule = _g[_f]; + if (ambientModule.declarations && ambientModule.declarations.length > 1) { + addReferenceFromAmbientModule(ambientModule); + } + } + return referencedFiles; + function addReferenceFromAmbientModule(symbol2) { + if (!symbol2.declarations) { + return; + } + for (var _i2 = 0, _a2 = symbol2.declarations; _i2 < _a2.length; _i2++) { + var declaration = _a2[_i2]; + var declarationSourceFile = ts6.getSourceFileOfNode(declaration); + if (declarationSourceFile && declarationSourceFile !== sourceFile) { + addReferencedFile(declarationSourceFile.resolvedPath); + } + } + } + function addReferencedFile(referencedPath2) { + (referencedFiles || (referencedFiles = new ts6.Set())).add(referencedPath2); + } + } + function canReuseOldState(newReferencedMap, oldState) { + return oldState && !oldState.referencedMap === !newReferencedMap; + } + BuilderState2.canReuseOldState = canReuseOldState; + function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) { + var _a, _b, _c; + var fileInfos = new ts6.Map(); + var referencedMap = newProgram.getCompilerOptions().module !== ts6.ModuleKind.None ? createManyToManyPathMap() : void 0; + var exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0; + var useOldState = canReuseOldState(referencedMap, oldState); + newProgram.getTypeChecker(); + for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) { + var sourceFile = _d[_i]; + var version_2 = ts6.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set"); + var oldUncommittedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : void 0; + var signature = oldUncommittedSignature === void 0 ? useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : void 0 : oldUncommittedSignature || void 0; + if (referencedMap) { + var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName); + if (newReferences) { + referencedMap.set(sourceFile.resolvedPath, newReferences); + } + if (useOldState) { + var oldUncommittedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath); + var exportedModules = oldUncommittedExportedModules === void 0 ? oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) : oldUncommittedExportedModules || void 0; + if (exportedModules) { + exportedModulesMap.set(sourceFile.resolvedPath, exportedModules); + } + } + } + fileInfos.set(sourceFile.resolvedPath, { + version: version_2, + signature, + affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || void 0, + impliedFormat: sourceFile.impliedNodeFormat + }); + } + return { + fileInfos, + referencedMap, + exportedModulesMap, + useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState + }; + } + BuilderState2.create = create; + function releaseCache(state) { + state.allFilesExcludingDefaultLibraryFile = void 0; + state.allFileNames = void 0; + } + BuilderState2.releaseCache = releaseCache; + function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) { + var _a, _b; + var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName); + (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear(); + (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear(); + return result; + } + BuilderState2.getFilesAffectedBy = getFilesAffectedBy; + function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) { + var sourceFile = programOfThisState.getSourceFileByPath(path); + if (!sourceFile) { + return ts6.emptyArray; + } + if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) { + return [sourceFile]; + } + return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName); + } + BuilderState2.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState; + function updateSignatureOfFile(state, signature, path) { + state.fileInfos.get(path).signature = signature; + (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts6.Set())).add(path); + } + BuilderState2.updateSignatureOfFile = updateSignatureOfFile; + function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) { + var _a; + if (useFileVersionAsSignature === void 0) { + useFileVersionAsSignature = state.useFileVersionAsSignature; + } + if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath)) + return false; + var info = state.fileInfos.get(sourceFile.resolvedPath); + var prevSignature = info.signature; + var latestSignature; + if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) { + programOfThisState.emit( + sourceFile, + function(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) { + ts6.Debug.assert(ts6.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: ".concat(fileName)); + latestSignature = ts6.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data); + if (latestSignature !== prevSignature) { + updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit); + } + }, + cancellationToken, + /*emitOnlyDtsFiles*/ + true, + /*customTransformers*/ + void 0, + /*forceDtsEmit*/ + true + ); + } + if (latestSignature === void 0) { + latestSignature = sourceFile.version; + if (state.exportedModulesMap && latestSignature !== prevSignature) { + (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts6.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false); + var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : void 0; + if (references) { + state.exportedModulesMap.set(sourceFile.resolvedPath, references); + } else { + state.exportedModulesMap.deleteKey(sourceFile.resolvedPath); + } + } + } + (state.oldSignatures || (state.oldSignatures = new ts6.Map())).set(sourceFile.resolvedPath, prevSignature || false); + (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts6.Set())).add(sourceFile.resolvedPath); + info.signature = latestSignature; + return latestSignature !== prevSignature; + } + BuilderState2.updateShapeSignature = updateShapeSignature; + function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) { + if (!state.exportedModulesMap) + return; + (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts6.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false); + if (!exportedModulesFromDeclarationEmit) { + state.exportedModulesMap.deleteKey(sourceFile.resolvedPath); + return; + } + var exportedModules; + exportedModulesFromDeclarationEmit.forEach(function(symbol) { + return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); + }); + if (exportedModules) { + state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules); + } else { + state.exportedModulesMap.deleteKey(sourceFile.resolvedPath); + } + function addExportedModule(exportedModulePaths) { + if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) { + if (!exportedModules) { + exportedModules = new ts6.Set(); + } + exportedModulePaths.forEach(function(path) { + return exportedModules.add(path); + }); + } + } + } + BuilderState2.updateExportedModules = updateExportedModules; + function getAllDependencies(state, programOfThisState, sourceFile) { + var compilerOptions = programOfThisState.getCompilerOptions(); + if (ts6.outFile(compilerOptions)) { + return getAllFileNames(state, programOfThisState); + } + if (!state.referencedMap || isFileAffectingGlobalScope(sourceFile)) { + return getAllFileNames(state, programOfThisState); + } + var seenMap = new ts6.Set(); + var queue = [sourceFile.resolvedPath]; + while (queue.length) { + var path = queue.pop(); + if (!seenMap.has(path)) { + seenMap.add(path); + var references = state.referencedMap.getValues(path); + if (references) { + var iterator = references.keys(); + for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) { + queue.push(iterResult.value); + } + } + } + } + return ts6.arrayFrom(ts6.mapDefinedIterator(seenMap.keys(), function(path2) { + var _a, _b; + return (_b = (_a = programOfThisState.getSourceFileByPath(path2)) === null || _a === void 0 ? void 0 : _a.fileName) !== null && _b !== void 0 ? _b : path2; + })); + } + BuilderState2.getAllDependencies = getAllDependencies; + function getAllFileNames(state, programOfThisState) { + if (!state.allFileNames) { + var sourceFiles = programOfThisState.getSourceFiles(); + state.allFileNames = sourceFiles === ts6.emptyArray ? ts6.emptyArray : sourceFiles.map(function(file) { + return file.fileName; + }); + } + return state.allFileNames; + } + function getReferencedByPaths(state, referencedFilePath) { + var keys = state.referencedMap.getKeys(referencedFilePath); + return keys ? ts6.arrayFrom(keys.keys()) : []; + } + BuilderState2.getReferencedByPaths = getReferencedByPaths; + function containsOnlyAmbientModules(sourceFile) { + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (!ts6.isModuleWithStringLiteralName(statement)) { + return false; + } + } + return true; + } + function containsGlobalScopeAugmentation(sourceFile) { + return ts6.some(sourceFile.moduleAugmentations, function(augmentation) { + return ts6.isGlobalScopeAugmentation(augmentation.parent); + }); + } + function isFileAffectingGlobalScope(sourceFile) { + return containsGlobalScopeAugmentation(sourceFile) || !ts6.isExternalOrCommonJsModule(sourceFile) && !ts6.isJsonSourceFile(sourceFile) && !containsOnlyAmbientModules(sourceFile); + } + function getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, firstSourceFile) { + if (state.allFilesExcludingDefaultLibraryFile) { + return state.allFilesExcludingDefaultLibraryFile; + } + var result; + if (firstSourceFile) + addSourceFile(firstSourceFile); + for (var _i = 0, _a = programOfThisState.getSourceFiles(); _i < _a.length; _i++) { + var sourceFile = _a[_i]; + if (sourceFile !== firstSourceFile) { + addSourceFile(sourceFile); + } + } + state.allFilesExcludingDefaultLibraryFile = result || ts6.emptyArray; + return state.allFilesExcludingDefaultLibraryFile; + function addSourceFile(sourceFile2) { + if (!programOfThisState.isSourceFileDefaultLibrary(sourceFile2)) { + (result || (result = [])).push(sourceFile2); + } + } + } + BuilderState2.getAllFilesExcludingDefaultLibraryFile = getAllFilesExcludingDefaultLibraryFile; + function getFilesAffectedByUpdatedShapeWhenNonModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape) { + var compilerOptions = programOfThisState.getCompilerOptions(); + if (compilerOptions && ts6.outFile(compilerOptions)) { + return [sourceFileWithUpdatedShape]; + } + return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape); + } + function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) { + if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) { + return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape); + } + var compilerOptions = programOfThisState.getCompilerOptions(); + if (compilerOptions && (compilerOptions.isolatedModules || ts6.outFile(compilerOptions))) { + return [sourceFileWithUpdatedShape]; + } + var seenFileNamesMap = new ts6.Map(); + seenFileNamesMap.set(sourceFileWithUpdatedShape.resolvedPath, sourceFileWithUpdatedShape); + var queue = getReferencedByPaths(state, sourceFileWithUpdatedShape.resolvedPath); + while (queue.length > 0) { + var currentPath = queue.pop(); + if (!seenFileNamesMap.has(currentPath)) { + var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath); + seenFileNamesMap.set(currentPath, currentSourceFile); + if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) { + queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath)); + } + } + } + return ts6.arrayFrom(ts6.mapDefinedIterator(seenFileNamesMap.values(), function(value) { + return value; + })); + } + })(BuilderState = ts6.BuilderState || (ts6.BuilderState = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var BuilderFileEmit; + (function(BuilderFileEmit2) { + BuilderFileEmit2[BuilderFileEmit2["DtsOnly"] = 0] = "DtsOnly"; + BuilderFileEmit2[BuilderFileEmit2["Full"] = 1] = "Full"; + })(BuilderFileEmit = ts6.BuilderFileEmit || (ts6.BuilderFileEmit = {})); + function hasSameKeys(map1, map2) { + return map1 === map2 || map1 !== void 0 && map2 !== void 0 && map1.size === map2.size && !ts6.forEachKey(map1, function(key) { + return !map2.has(key); + }); + } + function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) { + var _a, _b; + var state = ts6.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature); + state.program = newProgram; + var compilerOptions = newProgram.getCompilerOptions(); + state.compilerOptions = compilerOptions; + var outFilePath = ts6.outFile(compilerOptions); + if (!outFilePath) { + state.semanticDiagnosticsPerFile = new ts6.Map(); + } else if (compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.outSignature) && outFilePath === ts6.outFile(oldState === null || oldState === void 0 ? void 0 : oldState.compilerOptions)) { + state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature; + } + state.changedFilesSet = new ts6.Set(); + state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : void 0; + var useOldState = ts6.BuilderState.canReuseOldState(state.referencedMap, oldState); + var oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0; + var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts6.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && !ts6.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); + if (useOldState) { + (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function(value) { + return state.changedFilesSet.add(value); + }); + if (!outFilePath && oldState.affectedFilesPendingEmit) { + state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice(); + state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts6.Map(oldState.affectedFilesPendingEmitKind); + state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex; + state.seenAffectedFiles = new ts6.Set(); + } + } + var referencedMap = state.referencedMap; + var oldReferencedMap = useOldState ? oldState.referencedMap : void 0; + var copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck; + var copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck; + state.fileInfos.forEach(function(info, sourceFilePath) { + var oldInfo; + var newReferences; + if (!useOldState || // File wasn't present in old state + !(oldInfo = oldState.fileInfos.get(sourceFilePath)) || // versions dont match + oldInfo.version !== info.version || // Implied formats dont match + oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed + !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program + newReferences && ts6.forEachKey(newReferences, function(path) { + return !state.fileInfos.has(path) && oldState.fileInfos.has(path); + })) { + state.changedFilesSet.add(sourceFilePath); + } else if (canCopySemanticDiagnostics) { + var sourceFile = newProgram.getSourceFileByPath(sourceFilePath); + if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics) + return; + if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics) + return; + var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath); + if (diagnostics) { + state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) : diagnostics); + if (!state.semanticDiagnosticsFromOldState) { + state.semanticDiagnosticsFromOldState = new ts6.Set(); + } + state.semanticDiagnosticsFromOldState.add(sourceFilePath); + } + } + if (canCopyEmitSignatures) { + var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath); + if (oldEmitSignature) + (state.emitSignatures || (state.emitSignatures = new ts6.Map())).set(sourceFilePath, oldEmitSignature); + } + }); + if (useOldState && ts6.forEachEntry(oldState.fileInfos, function(info, sourceFilePath) { + return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); + })) { + ts6.BuilderState.getAllFilesExcludingDefaultLibraryFile( + state, + newProgram, + /*firstSourceFile*/ + void 0 + ).forEach(function(file) { + return state.changedFilesSet.add(file.resolvedPath); + }); + } else if (oldCompilerOptions && !outFilePath && ts6.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) { + newProgram.getSourceFiles().forEach(function(f) { + return addToAffectedFilesPendingEmit( + state, + f.resolvedPath, + 1 + /* BuilderFileEmit.Full */ + ); + }); + ts6.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size); + state.seenAffectedFiles = state.seenAffectedFiles || new ts6.Set(); + } + state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0); + return state; + } + function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) { + if (!diagnostics.length) + return ts6.emptyArray; + var buildInfoDirectory = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(ts6.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory())); + return diagnostics.map(function(diagnostic) { + var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath); + result.reportsUnnecessary = diagnostic.reportsUnnecessary; + result.reportsDeprecated = diagnostic.reportDeprecated; + result.source = diagnostic.source; + result.skippedOn = diagnostic.skippedOn; + var relatedInformation = diagnostic.relatedInformation; + result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map(function(r) { + return convertToDiagnosticRelatedInformation(r, newProgram, toPath); + }) : [] : void 0; + return result; + }); + function toPath(path) { + return ts6.toPath(path, buildInfoDirectory, getCanonicalFileName); + } + } + function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) { + var file = diagnostic.file; + return __assign(__assign({}, diagnostic), { file: file ? newProgram.getSourceFileByPath(toPath(file)) : void 0 }); + } + function releaseCache(state) { + ts6.BuilderState.releaseCache(state); + state.program = void 0; + } + function backupBuilderProgramEmitState(state) { + var outFilePath = ts6.outFile(state.compilerOptions); + ts6.Debug.assert(!state.changedFilesSet.size || outFilePath); + return { + affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(), + affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts6.Map(state.affectedFilesPendingEmitKind), + affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex, + seenEmittedFiles: state.seenEmittedFiles && new ts6.Map(state.seenEmittedFiles), + programEmitComplete: state.programEmitComplete, + emitSignatures: state.emitSignatures && new ts6.Map(state.emitSignatures), + outSignature: state.outSignature, + latestChangedDtsFile: state.latestChangedDtsFile, + hasChangedEmitSignature: state.hasChangedEmitSignature, + changedFilesSet: outFilePath ? new ts6.Set(state.changedFilesSet) : void 0 + }; + } + function restoreBuilderProgramEmitState(state, savedEmitState) { + state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit; + state.affectedFilesPendingEmitKind = savedEmitState.affectedFilesPendingEmitKind; + state.affectedFilesPendingEmitIndex = savedEmitState.affectedFilesPendingEmitIndex; + state.seenEmittedFiles = savedEmitState.seenEmittedFiles; + state.programEmitComplete = savedEmitState.programEmitComplete; + state.emitSignatures = savedEmitState.emitSignatures; + state.outSignature = savedEmitState.outSignature; + state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile; + state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature; + if (savedEmitState.changedFilesSet) + state.changedFilesSet = savedEmitState.changedFilesSet; + } + function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) { + ts6.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath)); + } + function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) { + var _a, _b; + while (true) { + var affectedFiles = state.affectedFiles; + if (affectedFiles) { + var seenAffectedFiles = state.seenAffectedFiles; + var affectedFilesIndex = state.affectedFilesIndex; + while (affectedFilesIndex < affectedFiles.length) { + var affectedFile = affectedFiles[affectedFilesIndex]; + if (!seenAffectedFiles.has(affectedFile.resolvedPath)) { + state.affectedFilesIndex = affectedFilesIndex; + handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host); + return affectedFile; + } + affectedFilesIndex++; + } + state.changedFilesSet.delete(state.currentChangedFilePath); + state.currentChangedFilePath = void 0; + (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear(); + (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear(); + state.affectedFiles = void 0; + } + var nextKey = state.changedFilesSet.keys().next(); + if (nextKey.done) { + return void 0; + } + var program = ts6.Debug.checkDefined(state.program); + var compilerOptions = program.getCompilerOptions(); + if (ts6.outFile(compilerOptions)) { + ts6.Debug.assert(!state.semanticDiagnosticsPerFile); + return program; + } + state.affectedFiles = ts6.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName); + state.currentChangedFilePath = nextKey.value; + state.affectedFilesIndex = 0; + if (!state.seenAffectedFiles) + state.seenAffectedFiles = new ts6.Set(); + } + } + function clearAffectedFilesPendingEmit(state) { + state.affectedFilesPendingEmit = void 0; + state.affectedFilesPendingEmitKind = void 0; + state.affectedFilesPendingEmitIndex = void 0; + } + function getNextAffectedFilePendingEmit(state) { + var affectedFilesPendingEmit = state.affectedFilesPendingEmit; + if (affectedFilesPendingEmit) { + var seenEmittedFiles = state.seenEmittedFiles || (state.seenEmittedFiles = new ts6.Map()); + for (var i = state.affectedFilesPendingEmitIndex; i < affectedFilesPendingEmit.length; i++) { + var affectedFile = ts6.Debug.checkDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]); + if (affectedFile) { + var seenKind = seenEmittedFiles.get(affectedFile.resolvedPath); + var emitKind = ts6.Debug.checkDefined(ts6.Debug.checkDefined(state.affectedFilesPendingEmitKind).get(affectedFile.resolvedPath)); + if (seenKind === void 0 || seenKind < emitKind) { + state.affectedFilesPendingEmitIndex = i; + return { affectedFile, emitKind }; + } + } + } + clearAffectedFilesPendingEmit(state); + } + return void 0; + } + function removeDiagnosticsOfLibraryFiles(state) { + if (!state.cleanedDiagnosticsOfLibFiles) { + state.cleanedDiagnosticsOfLibFiles = true; + var program_1 = ts6.Debug.checkDefined(state.program); + var options_2 = program_1.getCompilerOptions(); + ts6.forEach(program_1.getSourceFiles(), function(f) { + return program_1.isSourceFileDefaultLibrary(f) && !ts6.skipTypeChecking(f, options_2, program_1) && removeSemanticDiagnosticsOf(state, f.resolvedPath); + }); + } + } + function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) { + removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath); + if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) { + removeDiagnosticsOfLibraryFiles(state); + ts6.BuilderState.updateShapeSignature(state, ts6.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName); + return; + } + if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) + return; + handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host); + } + function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) { + removeSemanticDiagnosticsOf(state, path); + if (!state.changedFilesSet.has(path)) { + var program = ts6.Debug.checkDefined(state.program); + var sourceFile = program.getSourceFileByPath(path); + if (sourceFile) { + ts6.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature); + if (ts6.getEmitDeclarations(state.compilerOptions)) { + addToAffectedFilesPendingEmit( + state, + path, + 0 + /* BuilderFileEmit.DtsOnly */ + ); + } + } + } + } + function removeSemanticDiagnosticsOf(state, path) { + if (!state.semanticDiagnosticsFromOldState) { + return true; + } + state.semanticDiagnosticsFromOldState.delete(path); + state.semanticDiagnosticsPerFile.delete(path); + return !state.semanticDiagnosticsFromOldState.size; + } + function isChangedSignature(state, path) { + var oldSignature = ts6.Debug.checkDefined(state.oldSignatures).get(path) || void 0; + var newSignature = ts6.Debug.checkDefined(state.fileInfos.get(path)).signature; + return newSignature !== oldSignature; + } + function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) { + var _a; + if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope)) + return false; + ts6.BuilderState.getAllFilesExcludingDefaultLibraryFile( + state, + state.program, + /*firstSourceFile*/ + void 0 + ).forEach(function(file) { + return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); + }); + removeDiagnosticsOfLibraryFiles(state); + return true; + } + function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) { + var _a; + if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) + return; + if (!isChangedSignature(state, affectedFile.resolvedPath)) + return; + if (state.compilerOptions.isolatedModules) { + var seenFileNamesMap = new ts6.Map(); + seenFileNamesMap.set(affectedFile.resolvedPath, true); + var queue = ts6.BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath); + while (queue.length > 0) { + var currentPath = queue.pop(); + if (!seenFileNamesMap.has(currentPath)) { + seenFileNamesMap.set(currentPath, true); + if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host)) + return; + handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host); + if (isChangedSignature(state, currentPath)) { + var currentSourceFile = ts6.Debug.checkDefined(state.program).getSourceFileByPath(currentPath); + queue.push.apply(queue, ts6.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath)); + } + } + } + } + var seenFileAndExportsOfFile = new ts6.Set(); + (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function(exportedFromPath) { + if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host)) + return true; + var references = state.referencedMap.getKeys(exportedFromPath); + return references && ts6.forEachKey(references, function(filePath) { + return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host); + }); + }); + } + function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) { + var _a, _b; + if (!ts6.tryAddToSet(seenFileAndExportsOfFile, filePath)) + return void 0; + if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host)) + return true; + handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host); + (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function(exportedFromPath) { + return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host); + }); + (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function(referencingFilePath) { + return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file + handleDtsMayChangeOf( + // Dont add to seen since this is not yet done with the export removal + state, + referencingFilePath, + cancellationToken, + computeHash, + getCanonicalFileName, + host + ); + }); + return void 0; + } + function doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit) { + if (isBuildInfoEmit) { + state.buildInfoEmitPending = false; + } else if (affected === state.program) { + state.changedFilesSet.clear(); + state.programEmitComplete = true; + } else { + state.seenAffectedFiles.add(affected.resolvedPath); + state.buildInfoEmitPending = true; + if (emitKind !== void 0) { + (state.seenEmittedFiles || (state.seenEmittedFiles = new ts6.Map())).set(affected.resolvedPath, emitKind); + } + if (isPendingEmit) { + state.affectedFilesPendingEmitIndex++; + } else { + state.affectedFilesIndex++; + } + } + } + function toAffectedFileResult(state, result, affected) { + doneWithAffectedFile(state, affected); + return { result, affected }; + } + function toAffectedFileEmitResult(state, result, affected, emitKind, isPendingEmit, isBuildInfoEmit) { + doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit); + return { result, affected }; + } + function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) { + return ts6.concatenate(getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken), ts6.Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)); + } + function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) { + var path = sourceFile.resolvedPath; + if (state.semanticDiagnosticsPerFile) { + var cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path); + if (cachedDiagnostics) { + return ts6.filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions); + } + } + var diagnostics = ts6.Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken); + if (state.semanticDiagnosticsPerFile) { + state.semanticDiagnosticsPerFile.set(path, diagnostics); + } + return ts6.filterSemanticDiagnostics(diagnostics, state.compilerOptions); + } + function isProgramBundleEmitBuildInfo(info) { + return !!ts6.outFile(info.options || {}); + } + ts6.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo; + function getProgramBuildInfo(state, getCanonicalFileName) { + var outFilePath = ts6.outFile(state.compilerOptions); + if (outFilePath && !state.compilerOptions.composite) + return; + var currentDirectory = ts6.Debug.checkDefined(state.program).getCurrentDirectory(); + var buildInfoDirectory = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(ts6.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory)); + var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0; + if (outFilePath) { + var fileNames_1 = []; + var fileInfos_1 = []; + state.program.getRootFileNames().forEach(function(f) { + var sourceFile = state.program.getSourceFile(f); + if (!sourceFile) + return; + fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath)); + fileInfos_1.push(sourceFile.version); + }); + var result_15 = { + fileNames: fileNames_1, + fileInfos: fileInfos_1, + options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"), + outSignature: state.outSignature, + latestChangedDtsFile + }; + return result_15; + } + var fileNames = []; + var fileNameToFileId = new ts6.Map(); + var fileIdsList; + var fileNamesToFileIdListId; + var emitSignatures; + var fileInfos = ts6.arrayFrom(state.fileInfos.entries(), function(_a2) { + var _b2, _c2; + var key2 = _a2[0], value2 = _a2[1]; + var fileId = toFileId(key2); + ts6.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key2)); + var oldSignature = (_b2 = state.oldSignatures) === null || _b2 === void 0 ? void 0 : _b2.get(key2); + var actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value2.signature; + if (state.compilerOptions.composite) { + var file = state.program.getSourceFileByPath(key2); + if (!ts6.isJsonSourceFile(file) && ts6.sourceFileMayBeEmitted(file, state.program)) { + var emitSignature = (_c2 = state.emitSignatures) === null || _c2 === void 0 ? void 0 : _c2.get(key2); + if (emitSignature !== actualSignature) { + (emitSignatures || (emitSignatures = [])).push(emitSignature === void 0 ? fileId : [fileId, emitSignature]); + } + } + } + return value2.version === actualSignature ? value2.affectsGlobalScope || value2.impliedFormat ? ( + // If file version is same as signature, dont serialize signature + { version: value2.version, signature: void 0, affectsGlobalScope: value2.affectsGlobalScope, impliedFormat: value2.impliedFormat } + ) : ( + // If file info only contains version and signature and both are same we can just write string + value2.version + ) : actualSignature !== void 0 ? ( + // If signature is not same as version, encode signature in the fileInfo + oldSignature === void 0 ? ( + // If we havent computed signature, use fileInfo as is + value2 + ) : ( + // Serialize fileInfo with new updated signature + { version: value2.version, signature: actualSignature, affectsGlobalScope: value2.affectsGlobalScope, impliedFormat: value2.impliedFormat } + ) + ) : ( + // Signature of the FileInfo is undefined, serialize it as false + { version: value2.version, signature: false, affectsGlobalScope: value2.affectsGlobalScope, impliedFormat: value2.impliedFormat } + ); + }); + var referencedMap; + if (state.referencedMap) { + referencedMap = ts6.arrayFrom(state.referencedMap.keys()).sort(ts6.compareStringsCaseSensitive).map(function(key2) { + return [ + toFileId(key2), + toFileIdListId(state.referencedMap.getValues(key2)) + ]; + }); + } + var exportedModulesMap; + if (state.exportedModulesMap) { + exportedModulesMap = ts6.mapDefined(ts6.arrayFrom(state.exportedModulesMap.keys()).sort(ts6.compareStringsCaseSensitive), function(key2) { + var _a2; + var oldValue = (_a2 = state.oldExportedModulesMap) === null || _a2 === void 0 ? void 0 : _a2.get(key2); + if (oldValue === void 0) + return [toFileId(key2), toFileIdListId(state.exportedModulesMap.getValues(key2))]; + if (oldValue) + return [toFileId(key2), toFileIdListId(oldValue)]; + return void 0; + }); + } + var semanticDiagnosticsPerFile; + if (state.semanticDiagnosticsPerFile) { + for (var _i = 0, _a = ts6.arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(ts6.compareStringsCaseSensitive); _i < _a.length; _i++) { + var key = _a[_i]; + var value = state.semanticDiagnosticsPerFile.get(key); + (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ? [ + toFileId(key), + convertToReusableDiagnostics(value, relativeToBuildInfo) + ] : toFileId(key)); + } + } + var affectedFilesPendingEmit; + if (state.affectedFilesPendingEmit) { + var seenFiles = new ts6.Set(); + for (var _b = 0, _c = state.affectedFilesPendingEmit.slice(state.affectedFilesPendingEmitIndex).sort(ts6.compareStringsCaseSensitive); _b < _c.length; _b++) { + var path = _c[_b]; + if (ts6.tryAddToSet(seenFiles, path)) { + (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push([toFileId(path), state.affectedFilesPendingEmitKind.get(path)]); + } + } + } + var changeFileSet; + if (state.changedFilesSet.size) { + for (var _d = 0, _e = ts6.arrayFrom(state.changedFilesSet.keys()).sort(ts6.compareStringsCaseSensitive); _d < _e.length; _d++) { + var path = _e[_d]; + (changeFileSet || (changeFileSet = [])).push(toFileId(path)); + } + } + var result = { + fileNames, + fileInfos, + options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"), + fileIdsList, + referencedMap, + exportedModulesMap, + semanticDiagnosticsPerFile, + affectedFilesPendingEmit, + changeFileSet, + emitSignatures, + latestChangedDtsFile + }; + return result; + function relativeToBuildInfoEnsuringAbsolutePath(path2) { + return relativeToBuildInfo(ts6.getNormalizedAbsolutePath(path2, currentDirectory)); + } + function relativeToBuildInfo(path2) { + return ts6.ensurePathIsNonModuleName(ts6.getRelativePathFromDirectory(buildInfoDirectory, path2, getCanonicalFileName)); + } + function toFileId(path2) { + var fileId = fileNameToFileId.get(path2); + if (fileId === void 0) { + fileNames.push(relativeToBuildInfo(path2)); + fileNameToFileId.set(path2, fileId = fileNames.length); + } + return fileId; + } + function toFileIdListId(set) { + var fileIds = ts6.arrayFrom(set.keys(), toFileId).sort(ts6.compareValues); + var key2 = fileIds.join(); + var fileIdListId = fileNamesToFileIdListId === null || fileNamesToFileIdListId === void 0 ? void 0 : fileNamesToFileIdListId.get(key2); + if (fileIdListId === void 0) { + (fileIdsList || (fileIdsList = [])).push(fileIds); + (fileNamesToFileIdListId || (fileNamesToFileIdListId = new ts6.Map())).set(key2, fileIdListId = fileIdsList.length); + } + return fileIdListId; + } + function convertToProgramBuildInfoCompilerOptions(options, optionKey) { + var result2; + var optionsNameMap = ts6.getOptionsNameMap().optionsNameMap; + for (var _i2 = 0, _a2 = ts6.getOwnKeys(options).sort(ts6.compareStringsCaseSensitive); _i2 < _a2.length; _i2++) { + var name = _a2[_i2]; + var optionInfo = optionsNameMap.get(name.toLowerCase()); + if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) { + (result2 || (result2 = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath); + } + } + return result2; + } + } + function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) { + if (option) { + if (option.type === "list") { + var values = value; + if (option.element.isFilePath && values.length) { + return values.map(relativeToBuildInfo); + } + } else if (option.isFilePath) { + return relativeToBuildInfo(value); + } + } + return value; + } + function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) { + ts6.Debug.assert(!!diagnostics.length); + return diagnostics.map(function(diagnostic) { + var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo); + result.reportsUnnecessary = diagnostic.reportsUnnecessary; + result.reportDeprecated = diagnostic.reportsDeprecated; + result.source = diagnostic.source; + result.skippedOn = diagnostic.skippedOn; + var relatedInformation = diagnostic.relatedInformation; + result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map(function(r) { + return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); + }) : [] : void 0; + return result; + }); + } + function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) { + var file = diagnostic.file; + return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : void 0 }); + } + var BuilderProgramKind; + (function(BuilderProgramKind2) { + BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram"; + BuilderProgramKind2[BuilderProgramKind2["EmitAndSemanticDiagnosticsBuilderProgram"] = 1] = "EmitAndSemanticDiagnosticsBuilderProgram"; + })(BuilderProgramKind = ts6.BuilderProgramKind || (ts6.BuilderProgramKind = {})); + function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) { + var host; + var newProgram; + var oldProgram; + if (newProgramOrRootNames === void 0) { + ts6.Debug.assert(hostOrOptions === void 0); + host = oldProgramOrHost; + oldProgram = configFileParsingDiagnosticsOrOldProgram; + ts6.Debug.assert(!!oldProgram); + newProgram = oldProgram.getProgram(); + } else if (ts6.isArray(newProgramOrRootNames)) { + oldProgram = configFileParsingDiagnosticsOrOldProgram; + newProgram = ts6.createProgram({ + rootNames: newProgramOrRootNames, + options: hostOrOptions, + host: oldProgramOrHost, + oldProgram: oldProgram && oldProgram.getProgramOrUndefined(), + configFileParsingDiagnostics, + projectReferences + }); + host = oldProgramOrHost; + } else { + newProgram = newProgramOrRootNames; + host = hostOrOptions; + oldProgram = oldProgramOrHost; + configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram; + } + return { host, newProgram, oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts6.emptyArray }; + } + ts6.getBuilderCreationParameters = getBuilderCreationParameters; + function getTextHandlingSourceMapForSignature(text, data) { + return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== void 0 ? text.substring(0, data.sourceMapUrlPos) : text; + } + function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) { + var _a; + text = getTextHandlingSourceMapForSignature(text, data); + var sourceFileDirectory; + if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) { + text += data.diagnostics.map(function(diagnostic) { + return "".concat(locationInfo(diagnostic)).concat(ts6.DiagnosticCategory[diagnostic.category]).concat(diagnostic.code, ": ").concat(flattenDiagnosticMessageText2(diagnostic.messageText)); + }).join("\n"); + } + return (computeHash !== null && computeHash !== void 0 ? computeHash : ts6.generateDjb2Hash)(text); + function flattenDiagnosticMessageText2(diagnostic) { + return ts6.isString(diagnostic) ? diagnostic : diagnostic === void 0 ? "" : !diagnostic.next ? diagnostic.messageText : diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText2).join("\n"); + } + function locationInfo(diagnostic) { + if (diagnostic.file.resolvedPath === sourceFile.resolvedPath) + return "(".concat(diagnostic.start, ",").concat(diagnostic.length, ")"); + if (sourceFileDirectory === void 0) + sourceFileDirectory = ts6.getDirectoryPath(sourceFile.resolvedPath); + return "".concat(ts6.ensurePathIsNonModuleName(ts6.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)), "(").concat(diagnostic.start, ",").concat(diagnostic.length, ")"); + } + } + ts6.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics; + function computeSignature(text, computeHash, data) { + return (computeHash !== null && computeHash !== void 0 ? computeHash : ts6.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data)); + } + ts6.computeSignature = computeSignature; + function createBuilderProgram(kind, _a) { + var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics; + var oldState = oldProgram && oldProgram.getState(); + if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) { + newProgram = void 0; + oldState = void 0; + return oldProgram; + } + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + var computeHash = ts6.maybeBind(host, host.createHash); + var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature); + newProgram.getProgramBuildInfo = function() { + return getProgramBuildInfo(state, getCanonicalFileName); + }; + newProgram = void 0; + oldProgram = void 0; + oldState = void 0; + var getState = function() { + return state; + }; + var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics); + builderProgram.getState = getState; + builderProgram.saveEmitState = function() { + return backupBuilderProgramEmitState(state); + }; + builderProgram.restoreEmitState = function(saved) { + return restoreBuilderProgramEmitState(state, saved); + }; + builderProgram.hasChangedEmitSignature = function() { + return !!state.hasChangedEmitSignature; + }; + builderProgram.getAllDependencies = function(sourceFile) { + return ts6.BuilderState.getAllDependencies(state, ts6.Debug.checkDefined(state.program), sourceFile); + }; + builderProgram.getSemanticDiagnostics = getSemanticDiagnostics; + builderProgram.emit = emit; + builderProgram.releaseProgram = function() { + return releaseCache(state); + }; + if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) { + builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile; + } else if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile; + builderProgram.emitNextAffectedFile = emitNextAffectedFile; + builderProgram.emitBuildInfo = emitBuildInfo; + } else { + ts6.notImplemented(); + } + return builderProgram; + function emitBuildInfo(writeFile, cancellationToken) { + if (state.buildInfoEmitPending) { + var result = ts6.Debug.checkDefined(state.program).emitBuildInfo(writeFile || ts6.maybeBind(host, host.writeFile), cancellationToken); + state.buildInfoEmitPending = false; + return result; + } + return ts6.emitSkippedWithNoDiagnostics; + } + function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { + var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host); + var emitKind = 1; + var isPendingEmitFile = false; + if (!affected) { + if (!ts6.outFile(state.compilerOptions)) { + var pendingAffectedFile = getNextAffectedFilePendingEmit(state); + if (!pendingAffectedFile) { + if (!state.buildInfoEmitPending) { + return void 0; + } + var affected_1 = ts6.Debug.checkDefined(state.program); + return toAffectedFileEmitResult( + state, + // When whole program is affected, do emit only once (eg when --out or --outFile is specified) + // Otherwise just affected file + affected_1.emitBuildInfo(writeFile || ts6.maybeBind(host, host.writeFile), cancellationToken), + affected_1, + 1, + /*isPendingEmitFile*/ + false, + /*isBuildInfoEmit*/ + true + ); + } + affected = pendingAffectedFile.affectedFile, emitKind = pendingAffectedFile.emitKind; + isPendingEmitFile = true; + } else { + var program = ts6.Debug.checkDefined(state.program); + if (state.programEmitComplete) + return void 0; + affected = program; + } + } + return toAffectedFileEmitResult( + state, + // When whole program is affected, do emit only once (eg when --out or --outFile is specified) + // Otherwise just affected file + ts6.Debug.checkDefined(state.program).emit(affected === state.program ? void 0 : affected, ts6.getEmitDeclarations(state.compilerOptions) ? getWriteFileCallback(writeFile, customTransformers) : writeFile || ts6.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), + affected, + emitKind, + isPendingEmitFile + ); + } + function getWriteFileCallback(writeFile, customTransformers) { + return function(fileName, text, writeByteOrderMark, onError, sourceFiles, data) { + var _a2, _b, _c, _d, _e, _f, _g; + if (ts6.isDeclarationFileName(fileName)) { + if (!ts6.outFile(state.compilerOptions)) { + ts6.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1); + var emitSignature = void 0; + if (!customTransformers) { + var file = sourceFiles[0]; + var info = state.fileInfos.get(file.resolvedPath); + if (info.signature === file.version) { + var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data); + if (!((_a2 = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a2 === void 0 ? void 0 : _a2.length)) + emitSignature = signature; + if (signature !== file.version) { + if (host.storeFilesChangingSignatureDuringEmit) + ((_b = state.filesChangingSignature) !== null && _b !== void 0 ? _b : state.filesChangingSignature = new ts6.Set()).add(file.resolvedPath); + if (state.exportedModulesMap) + ts6.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit); + if (state.affectedFiles) { + var existing = (_c = state.oldSignatures) === null || _c === void 0 ? void 0 : _c.get(file.resolvedPath); + if (existing === void 0) + ((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : state.oldSignatures = new ts6.Map()).set(file.resolvedPath, info.signature || false); + info.signature = signature; + } else { + info.signature = signature; + (_e = state.oldExportedModulesMap) === null || _e === void 0 ? void 0 : _e.clear(); + } + } + } + } + if (state.compilerOptions.composite) { + var filePath = sourceFiles[0].resolvedPath; + var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath); + emitSignature !== null && emitSignature !== void 0 ? emitSignature : emitSignature = computeSignature(text, computeHash, data); + if (emitSignature === oldSignature) + return; + ((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : state.emitSignatures = new ts6.Map()).set(filePath, emitSignature); + state.hasChangedEmitSignature = true; + state.latestChangedDtsFile = fileName; + } + } else if (state.compilerOptions.composite) { + var newSignature = computeSignature(text, computeHash, data); + if (newSignature === state.outSignature) + return; + state.outSignature = newSignature; + state.hasChangedEmitSignature = true; + state.latestChangedDtsFile = fileName; + } + } + if (writeFile) + writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data); + else if (host.writeFile) + host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data); + else + state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data); + }; + } + function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { + var _a2; + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile); + } + var result = ts6.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken); + if (result) + return result; + if (!targetSourceFile) { + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + var sourceMaps = []; + var emitSkipped = false; + var diagnostics = void 0; + var emittedFiles = []; + var affectedEmitResult = void 0; + while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) { + emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped; + diagnostics = ts6.addRange(diagnostics, affectedEmitResult.result.diagnostics); + emittedFiles = ts6.addRange(emittedFiles, affectedEmitResult.result.emittedFiles); + sourceMaps = ts6.addRange(sourceMaps, affectedEmitResult.result.sourceMaps); + } + return { + emitSkipped, + diagnostics: diagnostics || ts6.emptyArray, + emittedFiles, + sourceMaps + }; + } else if ((_a2 = state.affectedFilesPendingEmitKind) === null || _a2 === void 0 ? void 0 : _a2.size) { + ts6.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram); + if (!emitOnlyDtsFiles || ts6.every(state.affectedFilesPendingEmit, function(path, index) { + return index < state.affectedFilesPendingEmitIndex || state.affectedFilesPendingEmitKind.get(path) === 0; + })) { + clearAffectedFilesPendingEmit(state); + } + } + } + return ts6.Debug.checkDefined(state.program).emit(targetSourceFile, ts6.getEmitDeclarations(state.compilerOptions) ? getWriteFileCallback(writeFile, customTransformers) : writeFile || ts6.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers); + } + function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) { + while (true) { + var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host); + if (!affected) { + return void 0; + } else if (affected === state.program) { + return toAffectedFileResult(state, state.program.getSemanticDiagnostics( + /*targetSourceFile*/ + void 0, + cancellationToken + ), affected); + } + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram || state.compilerOptions.noEmit || state.compilerOptions.noEmitOnError) { + addToAffectedFilesPendingEmit( + state, + affected.resolvedPath, + 1 + /* BuilderFileEmit.Full */ + ); + } + if (ignoreSourceFile && ignoreSourceFile(affected)) { + doneWithAffectedFile(state, affected); + continue; + } + return toAffectedFileResult(state, getSemanticDiagnosticsOfFile(state, affected, cancellationToken), affected); + } + } + function getSemanticDiagnostics(sourceFile, cancellationToken) { + assertSourceFileOkWithoutNextAffectedCall(state, sourceFile); + var compilerOptions = ts6.Debug.checkDefined(state.program).getCompilerOptions(); + if (ts6.outFile(compilerOptions)) { + ts6.Debug.assert(!state.semanticDiagnosticsPerFile); + return ts6.Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken); + } + if (sourceFile) { + return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken); + } + while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) { + } + var diagnostics; + for (var _i = 0, _a2 = ts6.Debug.checkDefined(state.program).getSourceFiles(); _i < _a2.length; _i++) { + var sourceFile_1 = _a2[_i]; + diagnostics = ts6.addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile_1, cancellationToken)); + } + return diagnostics || ts6.emptyArray; + } + } + ts6.createBuilderProgram = createBuilderProgram; + function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) { + if (!state.affectedFilesPendingEmit) + state.affectedFilesPendingEmit = []; + if (!state.affectedFilesPendingEmitKind) + state.affectedFilesPendingEmitKind = new ts6.Map(); + var existingKind = state.affectedFilesPendingEmitKind.get(affectedFilePendingEmit); + state.affectedFilesPendingEmit.push(affectedFilePendingEmit); + state.affectedFilesPendingEmitKind.set(affectedFilePendingEmit, existingKind || kind); + if (state.affectedFilesPendingEmitIndex === void 0) { + state.affectedFilesPendingEmitIndex = 0; + } + } + function toBuilderStateFileInfo(fileInfo) { + return ts6.isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : ts6.isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat }; + } + ts6.toBuilderStateFileInfo = toBuilderStateFileInfo; + function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) { + var _a, _b, _c, _d; + var buildInfoDirectory = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + var state; + var filePaths; + var filePathsSetList; + var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0; + if (isProgramBundleEmitBuildInfo(program)) { + state = { + fileInfos: new ts6.Map(), + compilerOptions: program.options ? ts6.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {}, + latestChangedDtsFile, + outSignature: program.outSignature + }; + } else { + filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath); + filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function(fileIds) { + return new ts6.Set(fileIds.map(toFilePath)); + }); + var fileInfos_2 = new ts6.Map(); + var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts6.outFile(program.options) ? new ts6.Map() : void 0; + program.fileInfos.forEach(function(fileInfo, index) { + var path = toFilePath(index + 1); + var stateFileInfo = toBuilderStateFileInfo(fileInfo); + fileInfos_2.set(path, stateFileInfo); + if (emitSignatures_1 && stateFileInfo.signature) + emitSignatures_1.set(path, stateFileInfo.signature); + }); + (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function(value) { + if (ts6.isNumber(value)) + emitSignatures_1.delete(toFilePath(value)); + else + emitSignatures_1.set(toFilePath(value[0]), value[1]); + }); + state = { + fileInfos: fileInfos_2, + compilerOptions: program.options ? ts6.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {}, + referencedMap: toManyToManyPathMap(program.referencedMap), + exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap), + semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts6.arrayToMap(program.semanticDiagnosticsPerFile, function(value) { + return toFilePath(ts6.isNumber(value) ? value : value[0]); + }, function(value) { + return ts6.isNumber(value) ? ts6.emptyArray : value[1]; + }), + hasReusableDiagnostic: true, + affectedFilesPendingEmit: ts6.map(program.affectedFilesPendingEmit, function(value) { + return toFilePath(value[0]); + }), + affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts6.arrayToMap(program.affectedFilesPendingEmit, function(value) { + return toFilePath(value[0]); + }, function(value) { + return value[1]; + }), + affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0, + changedFilesSet: new ts6.Set(ts6.map(program.changeFileSet, toFilePath)), + latestChangedDtsFile, + emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : void 0 + }; + } + return { + getState: function() { + return state; + }, + saveEmitState: ts6.noop, + restoreEmitState: ts6.noop, + getProgram: ts6.notImplemented, + getProgramOrUndefined: ts6.returnUndefined, + releaseProgram: ts6.noop, + getCompilerOptions: function() { + return state.compilerOptions; + }, + getSourceFile: ts6.notImplemented, + getSourceFiles: ts6.notImplemented, + getOptionsDiagnostics: ts6.notImplemented, + getGlobalDiagnostics: ts6.notImplemented, + getConfigFileParsingDiagnostics: ts6.notImplemented, + getSyntacticDiagnostics: ts6.notImplemented, + getDeclarationDiagnostics: ts6.notImplemented, + getSemanticDiagnostics: ts6.notImplemented, + emit: ts6.notImplemented, + getAllDependencies: ts6.notImplemented, + getCurrentDirectory: ts6.notImplemented, + emitNextAffectedFile: ts6.notImplemented, + getSemanticDiagnosticsOfNextAffectedFile: ts6.notImplemented, + emitBuildInfo: ts6.notImplemented, + close: ts6.noop, + hasChangedEmitSignature: ts6.returnFalse + }; + function toPath(path) { + return ts6.toPath(path, buildInfoDirectory, getCanonicalFileName); + } + function toAbsolutePath(path) { + return ts6.getNormalizedAbsolutePath(path, buildInfoDirectory); + } + function toFilePath(fileId) { + return filePaths[fileId - 1]; + } + function toFilePathsSet(fileIdsListId) { + return filePathsSetList[fileIdsListId - 1]; + } + function toManyToManyPathMap(referenceMap) { + if (!referenceMap) { + return void 0; + } + var map = ts6.BuilderState.createManyToManyPathMap(); + referenceMap.forEach(function(_a2) { + var fileId = _a2[0], fileIdListId = _a2[1]; + return map.set(toFilePath(fileId), toFilePathsSet(fileIdListId)); + }); + return map; + } + } + ts6.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo; + function getBuildInfoFileVersionMap(program, buildInfoPath, host) { + var buildInfoDirectory = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + var fileInfos = new ts6.Map(); + program.fileInfos.forEach(function(fileInfo, index) { + var path = ts6.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName); + var version = ts6.isString(fileInfo) ? fileInfo : fileInfo.version; + fileInfos.set(path, version); + }); + return fileInfos; + } + ts6.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap; + function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) { + return { + getState: ts6.notImplemented, + saveEmitState: ts6.noop, + restoreEmitState: ts6.noop, + getProgram, + getProgramOrUndefined: function() { + return getState().program; + }, + releaseProgram: function() { + return getState().program = void 0; + }, + getCompilerOptions: function() { + return getState().compilerOptions; + }, + getSourceFile: function(fileName) { + return getProgram().getSourceFile(fileName); + }, + getSourceFiles: function() { + return getProgram().getSourceFiles(); + }, + getOptionsDiagnostics: function(cancellationToken) { + return getProgram().getOptionsDiagnostics(cancellationToken); + }, + getGlobalDiagnostics: function(cancellationToken) { + return getProgram().getGlobalDiagnostics(cancellationToken); + }, + getConfigFileParsingDiagnostics: function() { + return configFileParsingDiagnostics; + }, + getSyntacticDiagnostics: function(sourceFile, cancellationToken) { + return getProgram().getSyntacticDiagnostics(sourceFile, cancellationToken); + }, + getDeclarationDiagnostics: function(sourceFile, cancellationToken) { + return getProgram().getDeclarationDiagnostics(sourceFile, cancellationToken); + }, + getSemanticDiagnostics: function(sourceFile, cancellationToken) { + return getProgram().getSemanticDiagnostics(sourceFile, cancellationToken); + }, + emit: function(sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers) { + return getProgram().emit(sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers); + }, + emitBuildInfo: function(writeFile, cancellationToken) { + return getProgram().emitBuildInfo(writeFile, cancellationToken); + }, + getAllDependencies: ts6.notImplemented, + getCurrentDirectory: function() { + return getProgram().getCurrentDirectory(); + }, + close: ts6.noop + }; + function getProgram() { + return ts6.Debug.checkDefined(getState().program); + } + } + ts6.createRedirectedBuilderProgram = createRedirectedBuilderProgram; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) { + return ts6.createBuilderProgram(ts6.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts6.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences)); + } + ts6.createSemanticDiagnosticsBuilderProgram = createSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) { + return ts6.createBuilderProgram(ts6.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts6.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences)); + } + ts6.createEmitAndSemanticDiagnosticsBuilderProgram = createEmitAndSemanticDiagnosticsBuilderProgram; + function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) { + var _a = ts6.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences), newProgram = _a.newProgram, newConfigFileParsingDiagnostics = _a.configFileParsingDiagnostics; + return ts6.createRedirectedBuilderProgram(function() { + return { program: newProgram, compilerOptions: newProgram.getCompilerOptions() }; + }, newConfigFileParsingDiagnostics); + } + ts6.createAbstractBuilder = createAbstractBuilder; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function removeIgnoredPath(path) { + if (ts6.endsWith(path, "/node_modules/.staging")) { + return ts6.removeSuffix(path, "/.staging"); + } + return ts6.some(ts6.ignoredPaths, function(searchPath) { + return ts6.stringContains(path, searchPath); + }) ? void 0 : path; + } + ts6.removeIgnoredPath = removeIgnoredPath; + function canWatchDirectoryOrFile(dirPath) { + var rootLength = ts6.getRootLength(dirPath); + if (dirPath.length === rootLength) { + return false; + } + var nextDirectorySeparator = dirPath.indexOf(ts6.directorySeparator, rootLength); + if (nextDirectorySeparator === -1) { + return false; + } + var pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1); + var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47; + if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { + nextDirectorySeparator = dirPath.indexOf(ts6.directorySeparator, nextDirectorySeparator + 1); + if (nextDirectorySeparator === -1) { + return false; + } + pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1); + } + if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) { + return true; + } + for (var searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) { + searchIndex = dirPath.indexOf(ts6.directorySeparator, searchIndex) + 1; + if (searchIndex === 0) { + return false; + } + } + return true; + } + ts6.canWatchDirectoryOrFile = canWatchDirectoryOrFile; + function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) { + var filesWithChangedSetOfUnresolvedImports; + var filesWithInvalidatedResolutions; + var filesWithInvalidatedNonRelativeUnresolvedImports; + var nonRelativeExternalModuleResolutions = ts6.createMultiMap(); + var resolutionsWithFailedLookups = []; + var resolutionsWithOnlyAffectingLocations = []; + var resolvedFileToResolution = ts6.createMultiMap(); + var impliedFormatPackageJsons = new ts6.Map(); + var hasChangedAutomaticTypeDirectiveNames = false; + var affectingPathChecksForFile; + var affectingPathChecks; + var failedLookupChecks; + var startsWithPathChecks; + var isInDirectoryChecks; + var getCurrentDirectory = ts6.memoize(function() { + return resolutionHost.getCurrentDirectory(); + }); + var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost(); + var resolvedModuleNames = new ts6.Map(); + var perDirectoryResolvedModuleNames = ts6.createCacheWithRedirects(); + var nonRelativeModuleNameCache = ts6.createCacheWithRedirects(); + var moduleResolutionCache = ts6.createModuleResolutionCache( + getCurrentDirectory(), + resolutionHost.getCanonicalFileName, + /*options*/ + void 0, + perDirectoryResolvedModuleNames, + nonRelativeModuleNameCache + ); + var resolvedTypeReferenceDirectives = new ts6.Map(); + var perDirectoryResolvedTypeReferenceDirectives = ts6.createCacheWithRedirects(); + var typeReferenceDirectiveResolutionCache = ts6.createTypeReferenceDirectiveResolutionCache( + getCurrentDirectory(), + resolutionHost.getCanonicalFileName, + /*options*/ + void 0, + moduleResolutionCache.getPackageJsonInfoCache(), + perDirectoryResolvedTypeReferenceDirectives + ); + var failedLookupDefaultExtensions = [ + ".ts", + ".tsx", + ".js", + ".jsx", + ".json" + /* Extension.Json */ + ]; + var customFailedLookupPaths = new ts6.Map(); + var directoryWatchesOfFailedLookups = new ts6.Map(); + var fileWatchesOfAffectingLocations = new ts6.Map(); + var rootDir = rootDirForResolution && ts6.removeTrailingDirectorySeparator(ts6.getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory())); + var rootPath = rootDir && resolutionHost.toPath(rootDir); + var rootSplitLength = rootPath !== void 0 ? rootPath.split(ts6.directorySeparator).length : 0; + var typeRootsWatches = new ts6.Map(); + return { + getModuleResolutionCache: function() { + return moduleResolutionCache; + }, + startRecordingFilesWithChangedResolutions, + finishRecordingFilesWithChangedResolutions, + // perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update + // (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution) + startCachingPerDirectoryResolution, + finishCachingPerDirectoryResolution, + resolveModuleNames, + getResolvedModuleWithFailedLookupLocationsFromCache, + resolveTypeReferenceDirectives, + removeResolutionsFromProjectReferenceRedirects, + removeResolutionsOfFile, + hasChangedAutomaticTypeDirectiveNames: function() { + return hasChangedAutomaticTypeDirectiveNames; + }, + invalidateResolutionOfFile, + invalidateResolutionsOfFailedLookupLocations, + setFilesWithInvalidatedNonRelativeUnresolvedImports, + createHasInvalidatedResolutions, + isFileWithInvalidatedNonRelativeUnresolvedImports, + updateTypeRootsWatch, + closeTypeRootsWatch, + clear + }; + function getResolvedModule(resolution) { + return resolution.resolvedModule; + } + function getResolvedTypeReferenceDirective(resolution) { + return resolution.resolvedTypeReferenceDirective; + } + function isInDirectoryPath(dir, file) { + if (dir === void 0 || file.length <= dir.length) { + return false; + } + return ts6.startsWith(file, dir) && file[dir.length] === ts6.directorySeparator; + } + function clear() { + ts6.clearMap(directoryWatchesOfFailedLookups, ts6.closeFileWatcherOf); + ts6.clearMap(fileWatchesOfAffectingLocations, ts6.closeFileWatcherOf); + customFailedLookupPaths.clear(); + nonRelativeExternalModuleResolutions.clear(); + closeTypeRootsWatch(); + resolvedModuleNames.clear(); + resolvedTypeReferenceDirectives.clear(); + resolvedFileToResolution.clear(); + resolutionsWithFailedLookups.length = 0; + resolutionsWithOnlyAffectingLocations.length = 0; + failedLookupChecks = void 0; + startsWithPathChecks = void 0; + isInDirectoryChecks = void 0; + affectingPathChecks = void 0; + affectingPathChecksForFile = void 0; + moduleResolutionCache.clear(); + typeReferenceDirectiveResolutionCache.clear(); + impliedFormatPackageJsons.clear(); + hasChangedAutomaticTypeDirectiveNames = false; + } + function startRecordingFilesWithChangedResolutions() { + filesWithChangedSetOfUnresolvedImports = []; + } + function finishRecordingFilesWithChangedResolutions() { + var collected = filesWithChangedSetOfUnresolvedImports; + filesWithChangedSetOfUnresolvedImports = void 0; + return collected; + } + function isFileWithInvalidatedNonRelativeUnresolvedImports(path) { + if (!filesWithInvalidatedNonRelativeUnresolvedImports) { + return false; + } + var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); + return !!value && !!value.length; + } + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { + invalidateResolutionsOfFailedLookupLocations(); + var collected = filesWithInvalidatedResolutions; + filesWithInvalidatedResolutions = void 0; + return function(path) { + return customHasInvalidatedResolutions(path) || !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); + }; + } + function startCachingPerDirectoryResolution() { + moduleResolutionCache.clearAllExceptPackageJsonInfoCache(); + typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache(); + nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions); + nonRelativeExternalModuleResolutions.clear(); + } + function finishCachingPerDirectoryResolution(newProgram, oldProgram) { + filesWithInvalidatedNonRelativeUnresolvedImports = void 0; + nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions); + nonRelativeExternalModuleResolutions.clear(); + if (newProgram !== oldProgram) { + newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function(newFile) { + var _a, _b, _c; + var expected = ts6.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0; + var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts6.emptyArray; + for (var i = existing.length; i < expected; i++) { + createFileWatcherOfAffectingLocation( + newFile.packageJsonLocations[i], + /*forResolution*/ + false + ); + } + if (existing.length > expected) { + for (var i = expected; i < existing.length; i++) { + fileWatchesOfAffectingLocations.get(existing[i]).files--; + } + } + if (expected) + impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations); + else + impliedFormatPackageJsons.delete(newFile.path); + }); + impliedFormatPackageJsons.forEach(function(existing, path) { + if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) { + existing.forEach(function(location) { + return fileWatchesOfAffectingLocations.get(location).files--; + }); + impliedFormatPackageJsons.delete(path); + } + }); + } + directoryWatchesOfFailedLookups.forEach(function(watcher, path) { + if (watcher.refCount === 0) { + directoryWatchesOfFailedLookups.delete(path); + watcher.watcher.close(); + } + }); + fileWatchesOfAffectingLocations.forEach(function(watcher, path) { + if (watcher.files === 0 && watcher.resolutions === 0) { + fileWatchesOfAffectingLocations.delete(path); + watcher.watcher.close(); + } + }); + hasChangedAutomaticTypeDirectiveNames = false; + } + function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) { + var _a, _b; + var primaryResult = ts6.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode); + if (!resolutionHost.getGlobalCache) { + return primaryResult; + } + var globalCache = resolutionHost.getGlobalCache(); + if (globalCache !== void 0 && !ts6.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts6.extensionIsTS(primaryResult.resolvedModule.extension))) { + var _c = ts6.loadModuleFromGlobalCache(ts6.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _c.resolvedModule, failedLookupLocations = _c.failedLookupLocations, affectingLocations = _c.affectingLocations; + if (resolvedModule) { + primaryResult.resolvedModule = resolvedModule; + (_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations); + (_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations); + return primaryResult; + } + } + return primaryResult; + } + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, _containingSourceFile, resolutionMode) { + return ts6.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); + } + function resolveNamesWithLocalCache(_a) { + var _b, _c, _d; + var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile, containingSourceFileMode = _a.containingSourceFileMode; + var path = resolutionHost.toPath(containingFile); + var resolutionsInFile = cache.get(path) || cache.set(path, ts6.createModeAwareCache()).get(path); + var dirPath = ts6.getDirectoryPath(path); + var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference); + var perDirectoryResolution = perDirectoryCache.get(dirPath); + if (!perDirectoryResolution) { + perDirectoryResolution = ts6.createModeAwareCache(); + perDirectoryCache.set(dirPath, perDirectoryResolution); + } + var resolvedModules = []; + var compilerOptions = resolutionHost.getCompilationSettings(); + var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path); + var program = resolutionHost.getCurrentProgram(); + var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile); + var unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference; + var seenNamesInFile = ts6.createModeAwareCache(); + var i = 0; + for (var _i = 0, names_5 = names; _i < names_5.length; _i++) { + var entry = names_5[_i]; + var name = ts6.isString(entry) ? entry : entry.fileName.toLowerCase(); + var mode = !ts6.isString(entry) ? ts6.getModeForFileReference(entry, containingSourceFileMode) : containingSourceFile ? ts6.getModeForResolutionAtIndex(containingSourceFile, i) : void 0; + i++; + var resolution = resolutionsInFile.get(name, mode); + if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate + hasInvalidatedNonRelativeUnresolvedImport && !ts6.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) { + var existingResolution = resolution; + var resolutionInDirectory = perDirectoryResolution.get(name, mode); + if (resolutionInDirectory) { + resolution = resolutionInDirectory; + var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost; + if (ts6.isTraceEnabled(compilerOptions, host)) { + var resolved = getResolutionWithResolvedFileName(resolution); + ts6.trace(host, loader === resolveModuleName ? (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ? resolved.packagetId ? ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved : (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ? resolved.packagetId ? ts6.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : ts6.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : ts6.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved, name, containingFile, ts6.getDirectoryPath(containingFile), resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts6.packageIdToString(resolved.packagetId)); + } + } else { + resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode); + perDirectoryResolution.set(name, mode, resolution); + if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) { + resolutionHost.onDiscoveredSymlink(); + } + } + resolutionsInFile.set(name, mode, resolution); + watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName); + if (existingResolution) { + stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName); + } + if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { + filesWithChangedSetOfUnresolvedImports.push(path); + logChanges = false; + } + } else { + var host = ((_d = resolutionHost.getCompilerHost) === null || _d === void 0 ? void 0 : _d.call(resolutionHost)) || resolutionHost; + if (ts6.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name, mode)) { + var resolved = getResolutionWithResolvedFileName(resolution); + ts6.trace(host, loader === resolveModuleName ? (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ? resolved.packagetId ? ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : ts6.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved : (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ? resolved.packagetId ? ts6.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : ts6.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : ts6.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved, name, containingFile, resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts6.packageIdToString(resolved.packagetId)); + } + } + ts6.Debug.assert(resolution !== void 0 && !resolution.isInvalidated); + seenNamesInFile.set(name, mode, true); + resolvedModules.push(getResolutionWithResolvedFileName(resolution)); + } + resolutionsInFile.forEach(function(resolution2, name2, mode2) { + if (!seenNamesInFile.has(name2, mode2) && !ts6.contains(reusedNames, name2)) { + stopWatchFailedLookupLocationOfResolution(resolution2, path, getResolutionWithResolvedFileName); + resolutionsInFile.delete(name2, mode2); + } + }); + return resolvedModules; + function resolutionIsEqualTo(oldResolution, newResolution) { + if (oldResolution === newResolution) { + return true; + } + if (!oldResolution || !newResolution) { + return false; + } + var oldResult = getResolutionWithResolvedFileName(oldResolution); + var newResult = getResolutionWithResolvedFileName(newResolution); + if (oldResult === newResult) { + return true; + } + if (!oldResult || !newResult) { + return false; + } + return oldResult.resolvedFileName === newResult.resolvedFileName; + } + } + function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { + return resolveNamesWithLocalCache({ + names: typeDirectiveNames, + containingFile, + redirectedReference, + cache: resolvedTypeReferenceDirectives, + perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives, + loader: resolveTypeReferenceDirective, + getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective, + shouldRetryResolution: function(resolution) { + return resolution.resolvedTypeReferenceDirective === void 0; + }, + containingSourceFileMode: containingFileMode + }); + } + function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) { + return resolveNamesWithLocalCache({ + names: moduleNames, + containingFile, + redirectedReference, + cache: resolvedModuleNames, + perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames, + loader: resolveModuleName, + getResolutionWithResolvedFileName: getResolvedModule, + shouldRetryResolution: function(resolution) { + return !resolution.resolvedModule || !ts6.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); + }, + reusedNames, + logChanges: logChangesWhenResolvingModule, + containingSourceFile + }); + } + function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) { + var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile)); + if (!cache) + return void 0; + return cache.get(moduleName, resolutionMode); + } + function isNodeModulesAtTypesDirectory(dirPath) { + return ts6.endsWith(dirPath, "/node_modules/@types"); + } + function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) { + if (isInDirectoryPath(rootPath, failedLookupLocationPath)) { + failedLookupLocation = ts6.isRootedDiskPath(failedLookupLocation) ? ts6.normalizePath(failedLookupLocation) : ts6.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()); + var failedLookupPathSplit = failedLookupLocationPath.split(ts6.directorySeparator); + var failedLookupSplit = failedLookupLocation.split(ts6.directorySeparator); + ts6.Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, "FailedLookup: ".concat(failedLookupLocation, " failedLookupLocationPath: ").concat(failedLookupLocationPath)); + if (failedLookupPathSplit.length > rootSplitLength + 1) { + return { + dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(ts6.directorySeparator), + dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(ts6.directorySeparator) + }; + } else { + return { + dir: rootDir, + dirPath: rootPath, + nonRecursive: false + }; + } + } + return getDirectoryToWatchFromFailedLookupLocationDirectory(ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts6.getDirectoryPath(failedLookupLocationPath)); + } + function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) { + while (ts6.pathContainsNodeModules(dirPath)) { + dir = ts6.getDirectoryPath(dir); + dirPath = ts6.getDirectoryPath(dirPath); + } + if (ts6.isNodeModulesDirectory(dirPath)) { + return canWatchDirectoryOrFile(ts6.getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0; + } + var nonRecursive = true; + var subDirectoryPath, subDirectory; + if (rootPath !== void 0) { + while (!isInDirectoryPath(dirPath, rootPath)) { + var parentPath = ts6.getDirectoryPath(dirPath); + if (parentPath === dirPath) { + break; + } + nonRecursive = false; + subDirectoryPath = dirPath; + subDirectory = dir; + dirPath = parentPath; + dir = ts6.getDirectoryPath(dir); + } + } + return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0; + } + function isPathWithDefaultFailedLookupExtension(path) { + return ts6.fileExtensionIsOneOf(path, failedLookupDefaultExtensions); + } + function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) { + if (resolution.refCount) { + resolution.refCount++; + ts6.Debug.assertIsDefined(resolution.files); + } else { + resolution.refCount = 1; + ts6.Debug.assert(ts6.length(resolution.files) === 0); + if (ts6.isExternalModuleNameRelative(name)) { + watchFailedLookupLocationOfResolution(resolution); + } else { + nonRelativeExternalModuleResolutions.add(name, resolution); + } + var resolved = getResolutionWithResolvedFileName(resolution); + if (resolved && resolved.resolvedFileName) { + resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution); + } + } + (resolution.files || (resolution.files = [])).push(filePath); + } + function watchFailedLookupLocationOfResolution(resolution) { + ts6.Debug.assert(!!resolution.refCount); + var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations; + if (!failedLookupLocations.length && !affectingLocations.length) + return; + if (failedLookupLocations.length) + resolutionsWithFailedLookups.push(resolution); + var setAtRoot = false; + for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) { + var failedLookupLocation = failedLookupLocations_1[_i]; + var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation); + var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath); + if (toWatch) { + var dir = toWatch.dir, dirPath = toWatch.dirPath, nonRecursive = toWatch.nonRecursive; + if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) { + var refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0; + customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1); + } + if (dirPath === rootPath) { + ts6.Debug.assert(!nonRecursive); + setAtRoot = true; + } else { + setDirectoryWatcher(dir, dirPath, nonRecursive); + } + } + } + if (setAtRoot) { + setDirectoryWatcher( + rootDir, + rootPath, + /*nonRecursive*/ + true + ); + } + watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length); + } + function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) { + ts6.Debug.assert(!!resolution.refCount); + var affectingLocations = resolution.affectingLocations; + if (!affectingLocations.length) + return; + if (addToResolutionsWithOnlyAffectingLocations) + resolutionsWithOnlyAffectingLocations.push(resolution); + for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) { + var affectingLocation = affectingLocations_1[_i]; + createFileWatcherOfAffectingLocation( + affectingLocation, + /*forResolution*/ + true + ); + } + } + function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) { + var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation); + if (fileWatcher) { + if (forResolution) + fileWatcher.resolutions++; + else + fileWatcher.files++; + return; + } + var locationToWatch = affectingLocation; + if (resolutionHost.realpath) { + locationToWatch = resolutionHost.realpath(affectingLocation); + if (affectingLocation !== locationToWatch) { + var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatch); + if (fileWatcher_1) { + if (forResolution) + fileWatcher_1.resolutions++; + else + fileWatcher_1.files++; + fileWatcher_1.paths.add(affectingLocation); + fileWatchesOfAffectingLocations.set(affectingLocation, fileWatcher_1); + return; + } + } + } + var paths = new ts6.Set(); + paths.add(locationToWatch); + var actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, function(fileName, eventKind) { + cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind); + var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap(); + paths.forEach(function(path) { + if (watcher.resolutions) + (affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : affectingPathChecks = new ts6.Set()).add(path); + if (watcher.files) + (affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : affectingPathChecksForFile = new ts6.Set()).add(path); + packageJsonMap === null || packageJsonMap === void 0 ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path)); + }); + resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations(); + }) : ts6.noopFileWatcher; + var watcher = { + watcher: actualWatcher !== ts6.noopFileWatcher ? { + close: function() { + actualWatcher.close(); + actualWatcher = ts6.noopFileWatcher; + } + } : actualWatcher, + resolutions: forResolution ? 1 : 0, + files: forResolution ? 0 : 1, + paths + }; + fileWatchesOfAffectingLocations.set(locationToWatch, watcher); + if (affectingLocation !== locationToWatch) { + fileWatchesOfAffectingLocations.set(affectingLocation, watcher); + paths.add(affectingLocation); + } + } + function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) { + var program = resolutionHost.getCurrentProgram(); + if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) { + resolutions.forEach(watchFailedLookupLocationOfResolution); + } else { + resolutions.forEach(function(resolution) { + return watchAffectingLocationsOfResolution( + resolution, + /*addToResolutionWithOnlyAffectingLocations*/ + true + ); + }); + } + } + function setDirectoryWatcher(dir, dirPath, nonRecursive) { + var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath); + if (dirWatcher) { + ts6.Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive); + dirWatcher.refCount++; + } else { + directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive }); + } + } + function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) { + ts6.unorderedRemoveItem(ts6.Debug.checkDefined(resolution.files), filePath); + resolution.refCount--; + if (resolution.refCount) { + return; + } + var resolved = getResolutionWithResolvedFileName(resolution); + if (resolved && resolved.resolvedFileName) { + resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution); + } + var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations; + if (ts6.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) { + var removeAtRoot = false; + for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) { + var failedLookupLocation = failedLookupLocations_2[_i]; + var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation); + var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath); + if (toWatch) { + var dirPath = toWatch.dirPath; + var refCount = customFailedLookupPaths.get(failedLookupLocationPath); + if (refCount) { + if (refCount === 1) { + customFailedLookupPaths.delete(failedLookupLocationPath); + } else { + ts6.Debug.assert(refCount > 1); + customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1); + } + } + if (dirPath === rootPath) { + removeAtRoot = true; + } else { + removeDirectoryWatcher(dirPath); + } + } + } + if (removeAtRoot) { + removeDirectoryWatcher(rootPath); + } + } else if (affectingLocations.length) { + ts6.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution); + } + for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) { + var affectingLocation = affectingLocations_2[_a]; + var watcher = fileWatchesOfAffectingLocations.get(affectingLocation); + watcher.resolutions--; + } + } + function removeDirectoryWatcher(dirPath) { + var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath); + dirWatcher.refCount--; + } + function createDirectoryWatcher(directory, dirPath, nonRecursive) { + return resolutionHost.watchDirectoryOfFailedLookupLocation( + directory, + function(fileOrDirectory) { + var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory); + if (cachedDirectoryStructureHost) { + cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + } + scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath); + }, + nonRecursive ? 0 : 1 + /* WatchDirectoryFlags.Recursive */ + ); + } + function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) { + var resolutions = cache.get(filePath); + if (resolutions) { + resolutions.forEach(function(resolution) { + return stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName); + }); + cache.delete(filePath); + } + } + function removeResolutionsFromProjectReferenceRedirects(filePath) { + if (!ts6.fileExtensionIs( + filePath, + ".json" + /* Extension.Json */ + )) + return; + var program = resolutionHost.getCurrentProgram(); + if (!program) + return; + var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath); + if (!resolvedProjectReference) + return; + resolvedProjectReference.commandLine.fileNames.forEach(function(f) { + return removeResolutionsOfFile(resolutionHost.toPath(f)); + }); + } + function removeResolutionsOfFile(filePath) { + removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule); + removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective); + } + function invalidateResolutions(resolutions, canInvalidate) { + if (!resolutions) + return false; + var invalidated = false; + for (var _i = 0, resolutions_1 = resolutions; _i < resolutions_1.length; _i++) { + var resolution = resolutions_1[_i]; + if (resolution.isInvalidated || !canInvalidate(resolution)) + continue; + resolution.isInvalidated = invalidated = true; + for (var _a = 0, _b = ts6.Debug.checkDefined(resolution.files); _a < _b.length; _a++) { + var containingFilePath = _b[_a]; + (filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : filesWithInvalidatedResolutions = new ts6.Set()).add(containingFilePath); + hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts6.endsWith(containingFilePath, ts6.inferredTypesContainingFile); + } + } + return invalidated; + } + function invalidateResolutionOfFile(filePath) { + removeResolutionsOfFile(filePath); + var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; + if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts6.returnTrue) && hasChangedAutomaticTypeDirectiveNames && !prevHasChangedAutomaticTypeDirectiveNames) { + resolutionHost.onChangedAutomaticTypeDirectiveNames(); + } + } + function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) { + ts6.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === void 0); + filesWithInvalidatedNonRelativeUnresolvedImports = filesMap; + } + function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) { + if (isCreatingWatchedDirectory) { + (isInDirectoryChecks || (isInDirectoryChecks = new ts6.Set())).add(fileOrDirectoryPath); + } else { + var updatedPath = removeIgnoredPath(fileOrDirectoryPath); + if (!updatedPath) + return false; + fileOrDirectoryPath = updatedPath; + if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) { + return false; + } + var dirOfFileOrDirectory = ts6.getDirectoryPath(fileOrDirectoryPath); + if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || ts6.isNodeModulesDirectory(fileOrDirectoryPath) || isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || ts6.isNodeModulesDirectory(dirOfFileOrDirectory)) { + (failedLookupChecks || (failedLookupChecks = new ts6.Set())).add(fileOrDirectoryPath); + (startsWithPathChecks || (startsWithPathChecks = new ts6.Set())).add(fileOrDirectoryPath); + } else { + if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) { + return false; + } + if (ts6.isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) { + return false; + } + (failedLookupChecks || (failedLookupChecks = new ts6.Set())).add(fileOrDirectoryPath); + var packagePath = ts6.parseNodeModuleFromPath(fileOrDirectoryPath); + if (packagePath) + (startsWithPathChecks || (startsWithPathChecks = new ts6.Set())).add(packagePath); + } + } + resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations(); + } + function invalidateResolutionsOfFailedLookupLocations() { + var _a; + var invalidated = false; + if (affectingPathChecksForFile) { + (_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function(f) { + if (ts6.some(f.packageJsonLocations, function(location) { + return affectingPathChecksForFile.has(location); + })) { + (filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : filesWithInvalidatedResolutions = new ts6.Set()).add(f.path); + invalidated = true; + } + }); + affectingPathChecksForFile = void 0; + } + if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) { + return invalidated; + } + invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated; + var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap(); + if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) { + packageJsonMap.forEach(function(_value, path) { + return isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0; + }); + } + failedLookupChecks = void 0; + startsWithPathChecks = void 0; + isInDirectoryChecks = void 0; + invalidated = invalidateResolutions(resolutionsWithOnlyAffectingLocations, canInvalidatedFailedLookupResolutionWithAffectingLocation) || invalidated; + affectingPathChecks = void 0; + return invalidated; + } + function canInvalidateFailedLookupResolution(resolution) { + if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution)) + return true; + if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) + return false; + return resolution.failedLookupLocations.some(function(location) { + return isInvalidatedFailedLookup(resolutionHost.toPath(location)); + }); + } + function isInvalidatedFailedLookup(locationPath) { + return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) || ts6.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts6.emptyIterator, function(fileOrDirectoryPath) { + return ts6.startsWith(locationPath, fileOrDirectoryPath) ? true : void 0; + }) || ts6.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts6.emptyIterator, function(fileOrDirectoryPath) { + return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0; + }); + } + function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) { + return !!affectingPathChecks && resolution.affectingLocations.some(function(location) { + return affectingPathChecks.has(location); + }); + } + function closeTypeRootsWatch() { + ts6.clearMap(typeRootsWatches, ts6.closeFileWatcher); + } + function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) { + if (isInDirectoryPath(rootPath, typeRootPath)) { + return rootPath; + } + var toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath); + return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0; + } + function createTypeRootsWatch(typeRootPath, typeRoot) { + return resolutionHost.watchTypeRootsDirectory( + typeRoot, + function(fileOrDirectory) { + var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory); + if (cachedDirectoryStructureHost) { + cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + } + hasChangedAutomaticTypeDirectiveNames = true; + resolutionHost.onChangedAutomaticTypeDirectiveNames(); + var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath); + if (dirPath) { + scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath); + } + }, + 1 + /* WatchDirectoryFlags.Recursive */ + ); + } + function updateTypeRootsWatch() { + var options = resolutionHost.getCompilationSettings(); + if (options.types) { + closeTypeRootsWatch(); + return; + } + var typeRoots = ts6.getEffectiveTypeRoots(options, { directoryExists: directoryExistsForTypeRootWatch, getCurrentDirectory }); + if (typeRoots) { + ts6.mutateMap(typeRootsWatches, ts6.arrayToMap(typeRoots, function(tr) { + return resolutionHost.toPath(tr); + }), { + createNewValue: createTypeRootsWatch, + onDeleteValue: ts6.closeFileWatcher + }); + } else { + closeTypeRootsWatch(); + } + } + function directoryExistsForTypeRootWatch(nodeTypesDirectory) { + var dir = ts6.getDirectoryPath(ts6.getDirectoryPath(nodeTypesDirectory)); + var dirPath = resolutionHost.toPath(dir); + return dirPath === rootPath || canWatchDirectoryOrFile(dirPath); + } + } + ts6.createResolutionCache = createResolutionCache; + function resolutionIsSymlink(resolution) { + var _a, _b; + return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) || ((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath)); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var moduleSpecifiers; + (function(moduleSpecifiers_1) { + var RelativePreference; + (function(RelativePreference2) { + RelativePreference2[RelativePreference2["Relative"] = 0] = "Relative"; + RelativePreference2[RelativePreference2["NonRelative"] = 1] = "NonRelative"; + RelativePreference2[RelativePreference2["Shortest"] = 2] = "Shortest"; + RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative"; + })(RelativePreference || (RelativePreference = {})); + var Ending; + (function(Ending2) { + Ending2[Ending2["Minimal"] = 0] = "Minimal"; + Ending2[Ending2["Index"] = 1] = "Index"; + Ending2[Ending2["JsExtension"] = 2] = "JsExtension"; + })(Ending || (Ending = {})); + function getPreferences(host, _a, compilerOptions, importingSourceFile) { + var importModuleSpecifierPreference = _a.importModuleSpecifierPreference, importModuleSpecifierEnding = _a.importModuleSpecifierEnding; + return { + relativePreference: importModuleSpecifierPreference === "relative" ? 0 : importModuleSpecifierPreference === "non-relative" ? 1 : importModuleSpecifierPreference === "project-relative" ? 3 : 2, + ending: getEnding() + }; + function getEnding() { + switch (importModuleSpecifierEnding) { + case "minimal": + return 0; + case "index": + return 1; + case "js": + return 2; + default: + return usesJsExtensionOnImports(importingSourceFile) || isFormatRequiringExtensions(compilerOptions, importingSourceFile.path, host) ? 2 : ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.NodeJs ? 1 : 0; + } + } + } + function getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host) { + return { + relativePreference: ts6.isExternalModuleNameRelative(oldImportSpecifier) ? 0 : 1, + ending: ts6.hasJSFileExtension(oldImportSpecifier) || isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) ? 2 : ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.NodeJs || ts6.endsWith(oldImportSpecifier, "index") ? 1 : 0 + }; + } + function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) { + var _a; + if (ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.Node16 && ts6.getEmitModuleResolutionKind(compilerOptions) !== ts6.ModuleResolutionKind.NodeNext) { + return false; + } + return ts6.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts6.ModuleKind.CommonJS; + } + function getModuleResolutionHost(host) { + var _a; + return { + fileExists: host.fileExists, + readFile: ts6.Debug.checkDefined(host.readFile), + directoryExists: host.directoryExists, + getCurrentDirectory: host.getCurrentDirectory, + realpath: host.realpath, + useCaseSensitiveFileNames: (_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host) + }; + } + function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, oldImportSpecifier, options) { + if (options === void 0) { + options = {}; + } + var res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {}, options); + if (res === oldImportSpecifier) + return void 0; + return res; + } + moduleSpecifiers_1.updateModuleSpecifier = updateModuleSpecifier; + function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, options) { + if (options === void 0) { + options = {}; + } + return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {}, options); + } + moduleSpecifiers_1.getModuleSpecifier = getModuleSpecifier; + function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options) { + if (options === void 0) { + options = {}; + } + var info = getInfo(importingSourceFile.path, host); + var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options); + return ts6.firstDefined(modulePaths, function(modulePath) { + return tryGetModuleNameAsNodeModule( + modulePath, + info, + importingSourceFile, + host, + compilerOptions, + preferences, + /*packageNameOnly*/ + true, + options.overrideImportMode + ); + }); + } + moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName; + function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) { + if (options === void 0) { + options = {}; + } + var info = getInfo(importingSourceFileName, host); + var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options); + return ts6.firstDefined(modulePaths, function(modulePath) { + return tryGetModuleNameAsNodeModule( + modulePath, + info, + importingSourceFile, + host, + compilerOptions, + userPreferences, + /*packageNameOnly*/ + void 0, + options.overrideImportMode + ); + }) || getLocalModuleSpecifier(toFileName, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences); + } + function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) { + if (options === void 0) { + options = {}; + } + return tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options)[0]; + } + moduleSpecifiers_1.tryGetModuleSpecifiersFromCache = tryGetModuleSpecifiersFromCache; + function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options) { + var _a; + if (options === void 0) { + options = {}; + } + var moduleSourceFile = ts6.getSourceFileOfModule(moduleSymbol); + if (!moduleSourceFile) { + return ts6.emptyArray; + } + var cache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host); + var cached = cache === null || cache === void 0 ? void 0 : cache.get(importingSourceFile.path, moduleSourceFile.path, userPreferences, options); + return [cached === null || cached === void 0 ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached === null || cached === void 0 ? void 0 : cached.modulePaths, cache]; + } + function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options) { + if (options === void 0) { + options = {}; + } + return getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options).moduleSpecifiers; + } + moduleSpecifiers_1.getModuleSpecifiers = getModuleSpecifiers; + function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options) { + if (options === void 0) { + options = {}; + } + var computedWithoutCache = false; + var ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker); + if (ambient) + return { moduleSpecifiers: [ambient], computedWithoutCache }; + var _a = tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options), specifiers = _a[0], moduleSourceFile = _a[1], modulePaths = _a[2], cache = _a[3]; + if (specifiers) + return { moduleSpecifiers: specifiers, computedWithoutCache }; + if (!moduleSourceFile) + return { moduleSpecifiers: ts6.emptyArray, computedWithoutCache }; + computedWithoutCache = true; + modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host)); + var result = computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options); + cache === null || cache === void 0 ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result); + return { moduleSpecifiers: result, computedWithoutCache }; + } + moduleSpecifiers_1.getModuleSpecifiersWithCacheInfo = getModuleSpecifiersWithCacheInfo; + function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options) { + if (options === void 0) { + options = {}; + } + var info = getInfo(importingSourceFile.path, host); + var preferences = getPreferences(host, userPreferences, compilerOptions, importingSourceFile); + var existingSpecifier = ts6.forEach(modulePaths, function(modulePath2) { + return ts6.forEach(host.getFileIncludeReasons().get(ts6.toPath(modulePath2.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function(reason) { + if (reason.kind !== ts6.FileIncludeKind.Import || reason.file !== importingSourceFile.path) + return void 0; + if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== ts6.getModeForResolutionAtIndex(importingSourceFile, reason.index)) + return void 0; + var specifier2 = ts6.getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; + return preferences.relativePreference !== 1 || !ts6.pathIsRelative(specifier2) ? specifier2 : void 0; + }); + }); + if (existingSpecifier) { + var moduleSpecifiers_2 = [existingSpecifier]; + return moduleSpecifiers_2; + } + var importedFileIsInNodeModules = ts6.some(modulePaths, function(p) { + return p.isInNodeModules; + }); + var nodeModulesSpecifiers; + var pathsSpecifiers; + var relativeSpecifiers; + for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) { + var modulePath = modulePaths_1[_i]; + var specifier = tryGetModuleNameAsNodeModule( + modulePath, + info, + importingSourceFile, + host, + compilerOptions, + userPreferences, + /*packageNameOnly*/ + void 0, + options.overrideImportMode + ); + nodeModulesSpecifiers = ts6.append(nodeModulesSpecifiers, specifier); + if (specifier && modulePath.isRedirect) { + return nodeModulesSpecifiers; + } + if (!specifier && !modulePath.isRedirect) { + var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences); + if (ts6.pathIsBareSpecifier(local)) { + pathsSpecifiers = ts6.append(pathsSpecifiers, local); + } else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) { + relativeSpecifiers = ts6.append(relativeSpecifiers, local); + } + } + } + return (pathsSpecifiers === null || pathsSpecifiers === void 0 ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (nodeModulesSpecifiers === null || nodeModulesSpecifiers === void 0 ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : ts6.Debug.checkDefined(relativeSpecifiers); + } + function getInfo(importingSourceFileName, host) { + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true); + var sourceDirectory = ts6.getDirectoryPath(importingSourceFileName); + return { getCanonicalFileName, importingSourceFileName, sourceDirectory }; + } + function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, _a) { + var ending = _a.ending, relativePreference = _a.relativePreference; + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs; + var sourceDirectory = info.sourceDirectory, getCanonicalFileName = info.getCanonicalFileName; + var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) || removeExtensionAndIndexPostFix(ts6.ensurePathIsNonModuleName(ts6.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions); + if (!baseUrl && !paths || relativePreference === 0) { + return relativePath; + } + var baseDirectory = ts6.getNormalizedAbsolutePath(ts6.getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory()); + var relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseDirectory, getCanonicalFileName); + if (!relativeToBaseUrl) { + return relativePath; + } + var fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions); + var nonRelative = fromPaths === void 0 && baseUrl !== void 0 ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths; + if (!nonRelative) { + return relativePath; + } + if (relativePreference === 1) { + return nonRelative; + } + if (relativePreference === 3) { + var projectDirectory = compilerOptions.configFilePath ? ts6.toPath(ts6.getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory()); + var modulePath = ts6.toPath(moduleFileName, projectDirectory, getCanonicalFileName); + var sourceIsInternal = ts6.startsWith(sourceDirectory, projectDirectory); + var targetIsInternal = ts6.startsWith(modulePath, projectDirectory); + if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) { + return nonRelative; + } + var nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, ts6.getDirectoryPath(modulePath)); + var nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory); + if (nearestSourcePackageJson !== nearestTargetPackageJson) { + return nonRelative; + } + return relativePath; + } + if (relativePreference !== 2) + ts6.Debug.assertNever(relativePreference); + return isPathRelativeToParent(nonRelative) || countPathComponents(relativePath) < countPathComponents(nonRelative) ? relativePath : nonRelative; + } + function countPathComponents(path) { + var count = 0; + for (var i = ts6.startsWith(path, "./") ? 2 : 0; i < path.length; i++) { + if (path.charCodeAt(i) === 47) + count++; + } + return count; + } + moduleSpecifiers_1.countPathComponents = countPathComponents; + function usesJsExtensionOnImports(_a) { + var imports = _a.imports; + return ts6.firstDefined(imports, function(_a2) { + var text = _a2.text; + return ts6.pathIsRelative(text) ? ts6.hasJSFileExtension(text) : void 0; + }) || false; + } + function comparePathsByRedirectAndNumberOfDirectorySeparators(a, b) { + return ts6.compareBooleans(b.isRedirect, a.isRedirect) || ts6.compareNumberOfDirectorySeparators(a.path, b.path); + } + function getNearestAncestorDirectoryWithPackageJson(host, fileName) { + if (host.getNearestAncestorDirectoryWithPackageJson) { + return host.getNearestAncestorDirectoryWithPackageJson(fileName); + } + return !!ts6.forEachAncestorDirectory(fileName, function(directory) { + return host.fileExists(ts6.combinePaths(directory, "package.json")) ? true : void 0; + }); + } + function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) { + var _a; + var getCanonicalFileName = ts6.hostGetCanonicalFileName(host); + var cwd = host.getCurrentDirectory(); + var referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.getProjectReferenceRedirect(importedFileName) : void 0; + var importedPath = ts6.toPath(importedFileName, cwd, getCanonicalFileName); + var redirects = host.redirectTargetsMap.get(importedPath) || ts6.emptyArray; + var importedFileNames = __spreadArray(__spreadArray(__spreadArray([], referenceRedirect ? [referenceRedirect] : ts6.emptyArray, true), [importedFileName], false), redirects, true); + var targets = importedFileNames.map(function(f) { + return ts6.getNormalizedAbsolutePath(f, cwd); + }); + var shouldFilterIgnoredPaths = !ts6.every(targets, ts6.containsIgnoredPath); + if (!preferSymlinks) { + var result_16 = ts6.forEach(targets, function(p) { + return !(shouldFilterIgnoredPaths && ts6.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); + }); + if (result_16) + return result_16; + } + var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath(); + var fullImportedFileName = ts6.getNormalizedAbsolutePath(importedFileName, cwd); + var result = symlinkedDirectories && ts6.forEachAncestorDirectory(ts6.getDirectoryPath(fullImportedFileName), function(realPathDirectory) { + var symlinkDirectories = symlinkedDirectories.get(ts6.ensureTrailingDirectorySeparator(ts6.toPath(realPathDirectory, cwd, getCanonicalFileName))); + if (!symlinkDirectories) + return void 0; + if (ts6.startsWithDirectory(importingFileName, realPathDirectory, getCanonicalFileName)) { + return false; + } + return ts6.forEach(targets, function(target) { + if (!ts6.startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) { + return; + } + var relative = ts6.getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName); + for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) { + var symlinkDirectory = symlinkDirectories_1[_i]; + var option = ts6.resolvePath(symlinkDirectory, relative); + var result_17 = cb(option, target === referenceRedirect); + shouldFilterIgnoredPaths = true; + if (result_17) + return result_17; + } + }); + }); + return result || (preferSymlinks ? ts6.forEach(targets, function(p) { + return shouldFilterIgnoredPaths && ts6.containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect); + }) : void 0); + } + moduleSpecifiers_1.forEachFileNameOfModule = forEachFileNameOfModule; + function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options) { + var _a; + if (options === void 0) { + options = {}; + } + var importedFilePath = ts6.toPath(importedFileName, host.getCurrentDirectory(), ts6.hostGetCanonicalFileName(host)); + var cache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host); + if (cache) { + var cached = cache.get(importingFilePath, importedFilePath, preferences, options); + if (cached === null || cached === void 0 ? void 0 : cached.modulePaths) + return cached.modulePaths; + } + var modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host); + if (cache) { + cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths); + } + return modulePaths; + } + function getAllModulePathsWorker(importingFileName, importedFileName, host) { + var getCanonicalFileName = ts6.hostGetCanonicalFileName(host); + var allFileNames = new ts6.Map(); + var importedFileFromNodeModules = false; + forEachFileNameOfModule( + importingFileName, + importedFileName, + host, + /*preferSymlinks*/ + true, + function(path, isRedirect) { + var isInNodeModules = ts6.pathContainsNodeModules(path); + allFileNames.set(path, { path: getCanonicalFileName(path), isRedirect, isInNodeModules }); + importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules; + } + ); + var sortedPaths = []; + var _loop_35 = function(directory2) { + var directoryStart = ts6.ensureTrailingDirectorySeparator(directory2); + var pathsInDirectory; + allFileNames.forEach(function(_a, fileName) { + var path = _a.path, isRedirect = _a.isRedirect, isInNodeModules = _a.isInNodeModules; + if (ts6.startsWith(path, directoryStart)) { + (pathsInDirectory || (pathsInDirectory = [])).push({ path: fileName, isRedirect, isInNodeModules }); + allFileNames.delete(fileName); + } + }); + if (pathsInDirectory) { + if (pathsInDirectory.length > 1) { + pathsInDirectory.sort(comparePathsByRedirectAndNumberOfDirectorySeparators); + } + sortedPaths.push.apply(sortedPaths, pathsInDirectory); + } + var newDirectory = ts6.getDirectoryPath(directory2); + if (newDirectory === directory2) + return out_directory_1 = directory2, "break"; + directory2 = newDirectory; + out_directory_1 = directory2; + }; + var out_directory_1; + for (var directory = ts6.getDirectoryPath(importingFileName); allFileNames.size !== 0; ) { + var state_11 = _loop_35(directory); + directory = out_directory_1; + if (state_11 === "break") + break; + } + if (allFileNames.size) { + var remainingPaths = ts6.arrayFrom(allFileNames.values()); + if (remainingPaths.length > 1) + remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators); + sortedPaths.push.apply(sortedPaths, remainingPaths); + } + return sortedPaths; + } + function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) { + var _a; + var decl = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function(d) { + return ts6.isNonGlobalAmbientModule(d) && (!ts6.isExternalModuleAugmentation(d) || !ts6.isExternalModuleNameRelative(ts6.getTextOfIdentifierOrLiteral(d.name))); + }); + if (decl) { + return decl.name.text; + } + var ambientModuleDeclareCandidates = ts6.mapDefined(moduleSymbol.declarations, function(d) { + var _a2, _b, _c, _d; + if (!ts6.isModuleDeclaration(d)) + return; + var topNamespace = getTopNamespace(d); + if (!(((_a2 = topNamespace === null || topNamespace === void 0 ? void 0 : topNamespace.parent) === null || _a2 === void 0 ? void 0 : _a2.parent) && ts6.isModuleBlock(topNamespace.parent) && ts6.isAmbientModule(topNamespace.parent.parent) && ts6.isSourceFile(topNamespace.parent.parent.parent))) + return; + var exportAssignment = (_d = (_c = (_b = topNamespace.parent.parent.symbol.exports) === null || _b === void 0 ? void 0 : _b.get("export=")) === null || _c === void 0 ? void 0 : _c.valueDeclaration) === null || _d === void 0 ? void 0 : _d.expression; + if (!exportAssignment) + return; + var exportSymbol = checker.getSymbolAtLocation(exportAssignment); + if (!exportSymbol) + return; + var originalExportSymbol = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.flags) & 2097152 ? checker.getAliasedSymbol(exportSymbol) : exportSymbol; + if (originalExportSymbol === d.symbol) + return topNamespace.parent.parent; + function getTopNamespace(namespaceDeclaration) { + while (namespaceDeclaration.flags & 4) { + namespaceDeclaration = namespaceDeclaration.parent; + } + return namespaceDeclaration; + } + }); + var ambientModuleDeclare = ambientModuleDeclareCandidates[0]; + if (ambientModuleDeclare) { + return ambientModuleDeclare.name.text; + } + } + function getAllowedEndings(preferredEnding, compilerOptions, importMode) { + if (ts6.getEmitModuleResolutionKind(compilerOptions) >= ts6.ModuleResolutionKind.Node16 && importMode === ts6.ModuleKind.ESNext) { + return [ + 2 + /* Ending.JsExtension */ + ]; + } + switch (preferredEnding) { + case 2: + return [ + 2, + 0, + 1 + /* Ending.Index */ + ]; + case 1: + return [ + 1, + 0, + 2 + /* Ending.JsExtension */ + ]; + case 0: + return [ + 0, + 1, + 2 + /* Ending.JsExtension */ + ]; + default: + ts6.Debug.assertNever(preferredEnding); + } + } + function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { + for (var key in paths) { + var _loop_36 = function(patternText_12) { + var pattern = ts6.normalizePath(patternText_12); + var indexOfStar = pattern.indexOf("*"); + var candidates = allowedEndings.map(function(ending2) { + return { + ending: ending2, + value: removeExtensionAndIndexPostFix(relativeToBaseUrl, ending2, compilerOptions) + }; + }); + if (ts6.tryGetExtensionFromPath(pattern)) { + candidates.push({ ending: void 0, value: relativeToBaseUrl }); + } + if (indexOfStar !== -1) { + var prefix2 = pattern.substring(0, indexOfStar); + var suffix = pattern.substring(indexOfStar + 1); + for (var _b = 0, candidates_3 = candidates; _b < candidates_3.length; _b++) { + var _c = candidates_3[_b], ending = _c.ending, value = _c.value; + if (value.length >= prefix2.length + suffix.length && ts6.startsWith(value, prefix2) && ts6.endsWith(value, suffix) && validateEnding({ ending, value })) { + var matchedStar = value.substring(prefix2.length, value.length - suffix.length); + return { value: key.replace("*", matchedStar) }; + } + } + } else if (ts6.some(candidates, function(c) { + return c.ending !== 0 && pattern === c.value; + }) || ts6.some(candidates, function(c) { + return c.ending === 0 && pattern === c.value && validateEnding(c); + })) { + return { value: key }; + } + }; + for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { + var patternText_1 = _a[_i]; + var state_12 = _loop_36(patternText_1); + if (typeof state_12 === "object") + return state_12.value; + } + } + function validateEnding(_a2) { + var ending = _a2.ending, value = _a2.value; + return ending !== 0 || value === removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions, host); + } + } + var MatchingMode; + (function(MatchingMode2) { + MatchingMode2[MatchingMode2["Exact"] = 0] = "Exact"; + MatchingMode2[MatchingMode2["Directory"] = 1] = "Directory"; + MatchingMode2[MatchingMode2["Pattern"] = 2] = "Pattern"; + })(MatchingMode || (MatchingMode = {})); + function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports2, conditions, mode) { + if (mode === void 0) { + mode = 0; + } + if (typeof exports2 === "string") { + var pathOrPattern = ts6.getNormalizedAbsolutePath( + ts6.combinePaths(packageDirectory, exports2), + /*currentDirectory*/ + void 0 + ); + var extensionSwappedTarget = ts6.hasTSFileExtension(targetFilePath) ? ts6.removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0; + switch (mode) { + case 0: + if (ts6.comparePaths(targetFilePath, pathOrPattern) === 0 || extensionSwappedTarget && ts6.comparePaths(extensionSwappedTarget, pathOrPattern) === 0) { + return { moduleFileToTry: packageName }; + } + break; + case 1: + if (ts6.containsPath(pathOrPattern, targetFilePath)) { + var fragment = ts6.getRelativePathFromDirectory( + pathOrPattern, + targetFilePath, + /*ignoreCase*/ + false + ); + return { moduleFileToTry: ts6.getNormalizedAbsolutePath( + ts6.combinePaths(ts6.combinePaths(packageName, exports2), fragment), + /*currentDirectory*/ + void 0 + ) }; + } + break; + case 2: + var starPos = pathOrPattern.indexOf("*"); + var leadingSlice = pathOrPattern.slice(0, starPos); + var trailingSlice = pathOrPattern.slice(starPos + 1); + if (ts6.startsWith(targetFilePath, leadingSlice) && ts6.endsWith(targetFilePath, trailingSlice)) { + var starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length); + return { moduleFileToTry: packageName.replace("*", starReplacement) }; + } + if (extensionSwappedTarget && ts6.startsWith(extensionSwappedTarget, leadingSlice) && ts6.endsWith(extensionSwappedTarget, trailingSlice)) { + var starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length); + return { moduleFileToTry: packageName.replace("*", starReplacement) }; + } + break; + } + } else if (Array.isArray(exports2)) { + return ts6.forEach(exports2, function(e) { + return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions); + }); + } else if (typeof exports2 === "object" && exports2 !== null) { + if (ts6.allKeysStartWithDot(exports2)) { + return ts6.forEach(ts6.getOwnKeys(exports2), function(k) { + var subPackageName = ts6.getNormalizedAbsolutePath( + ts6.combinePaths(packageName, k), + /*currentDirectory*/ + void 0 + ); + var mode2 = ts6.endsWith(k, "/") ? 1 : ts6.stringContains(k, "*") ? 2 : 0; + return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports2[k], conditions, mode2); + }); + } else { + for (var _i = 0, _a = ts6.getOwnKeys(exports2); _i < _a.length; _i++) { + var key = _a[_i]; + if (key === "default" || conditions.indexOf(key) >= 0 || ts6.isApplicableVersionedTypesKey(conditions, key)) { + var subTarget = exports2[key]; + var result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions); + if (result) { + return result; + } + } + } + } + } + return void 0; + } + function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === void 0) { + return void 0; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts6.flatMap(normalizedSourcePaths, function(sourcePath) { + return ts6.map(normalizedTargetPaths, function(targetPath) { + return ts6.ensurePathIsNonModuleName(ts6.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); + }); + }); + var shortest = ts6.min(relativePaths, ts6.compareNumberOfDirectorySeparators); + if (!shortest) { + return void 0; + } + return ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeJs ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) : ts6.removeFileExtension(shortest); + } + function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { + var path = _a.path, isRedirect = _a.isRedirect; + var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory; + if (!host.fileExists || !host.readFile) { + return void 0; + } + var parts = ts6.getNodeModulePathParts(path); + if (!parts) { + return void 0; + } + var preferences = getPreferences(host, userPreferences, options, importingSourceFile); + var moduleSpecifier = path; + var isPackageRootPath = false; + if (!packageNameOnly) { + var packageRootIndex = parts.packageRootIndex; + var moduleFileName = void 0; + while (true) { + var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports; + if (ts6.getEmitModuleResolutionKind(options) !== ts6.ModuleResolutionKind.Classic) { + if (blockedByExports) { + return void 0; + } + if (verbatimFromExports) { + return moduleFileToTry; + } + } + if (packageRootPath) { + moduleSpecifier = packageRootPath; + isPackageRootPath = true; + break; + } + if (!moduleFileName) + moduleFileName = moduleFileToTry; + packageRootIndex = path.indexOf(ts6.directorySeparator, packageRootIndex + 1); + if (packageRootIndex === -1) { + moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host); + break; + } + } + } + if (isRedirect && !isPackageRootPath) { + return void 0; + } + var globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation(); + var pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex)); + if (!(ts6.startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && ts6.startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) { + return void 0; + } + var nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1); + var packageName = ts6.getPackageNameFromTypesPackageName(nodeModulesDirectoryName); + return ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? void 0 : packageName; + function tryDirectoryWithPackageJson(packageRootIndex2) { + var _a2, _b2; + var packageRootPath2 = path.substring(0, packageRootIndex2); + var packageJsonPath = ts6.combinePaths(packageRootPath2, "package.json"); + var moduleFileToTry2 = path; + var maybeBlockedByTypesVersions = false; + var cachedPackageJson = (_b2 = (_a2 = host.getPackageJsonInfoCache) === null || _a2 === void 0 ? void 0 : _a2.call(host)) === null || _b2 === void 0 ? void 0 : _b2.getPackageJsonInfo(packageJsonPath); + if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) { + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var importMode = overrideMode || importingSourceFile.impliedNodeFormat; + if (ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(options) === ts6.ModuleResolutionKind.NodeNext) { + var conditions = ["node", importMode === ts6.ModuleKind.ESNext ? "import" : "require", "types"]; + var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath2, ts6.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0; + if (fromExports) { + var withJsExtension = !ts6.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts6.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) }; + return __assign(__assign({}, withJsExtension), { verbatimFromExports: true }); + } + if (packageJsonContent.exports) { + return { moduleFileToTry: path, blockedByExports: true }; + } + } + var versionPaths = packageJsonContent.typesVersions ? ts6.getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0; + if (versionPaths) { + var subModuleName = path.slice(packageRootPath2.length + 1); + var fromPaths = tryGetModuleNameFromPaths(subModuleName, versionPaths.paths, getAllowedEndings(preferences.ending, options, importMode), host, options); + if (fromPaths === void 0) { + maybeBlockedByTypesVersions = true; + } else { + moduleFileToTry2 = ts6.combinePaths(packageRootPath2, fromPaths); + } + } + var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js"; + if (ts6.isString(mainFileRelative) && !(maybeBlockedByTypesVersions && ts6.matchPatternOrExact(ts6.tryParsePatterns(versionPaths.paths), mainFileRelative))) { + var mainExportFile = ts6.toPath(mainFileRelative, packageRootPath2, getCanonicalFileName); + if (ts6.removeFileExtension(mainExportFile) === ts6.removeFileExtension(getCanonicalFileName(moduleFileToTry2))) { + return { packageRootPath: packageRootPath2, moduleFileToTry: moduleFileToTry2 }; + } + } + } else { + var fileName = getCanonicalFileName(moduleFileToTry2.substring(parts.packageRootIndex + 1)); + if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") { + return { moduleFileToTry: moduleFileToTry2, packageRootPath: packageRootPath2 }; + } + } + return { moduleFileToTry: moduleFileToTry2 }; + } + } + function tryGetAnyFileFromPath(host, path) { + if (!host.fileExists) + return; + var extensions = ts6.flatten(ts6.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { + extension: "json", + isMixedContent: false, + scriptKind: 6 + /* ScriptKind.JSON */ + }])); + for (var _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) { + var e = extensions_3[_i]; + var fullPath = path + e; + if (host.fileExists(fullPath)) { + return fullPath; + } + } + } + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts6.mapDefined(rootDirs, function(rootDir) { + var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); + return relativePath !== void 0 && isPathRelativeToParent(relativePath) ? void 0 : relativePath; + }); + } + function removeExtensionAndIndexPostFix(fileName, ending, options, host) { + if (ts6.fileExtensionIsOneOf(fileName, [ + ".json", + ".mjs", + ".cjs" + /* Extension.Cjs */ + ])) + return fileName; + var noExtension = ts6.removeFileExtension(fileName); + if (fileName === noExtension) + return fileName; + if (ts6.fileExtensionIsOneOf(fileName, [ + ".d.mts", + ".mts", + ".d.cts", + ".cts" + /* Extension.Cts */ + ])) + return noExtension + getJSExtensionForFile(fileName, options); + switch (ending) { + case 0: + var withoutIndex = ts6.removeSuffix(noExtension, "/index"); + if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) { + return noExtension; + } + return withoutIndex; + case 1: + return noExtension; + case 2: + return noExtension + getJSExtensionForFile(fileName, options); + default: + return ts6.Debug.assertNever(ending); + } + } + function getJSExtensionForFile(fileName, options) { + var _a; + return (_a = tryGetJSExtensionForFile(fileName, options)) !== null && _a !== void 0 ? _a : ts6.Debug.fail("Extension ".concat(ts6.extensionFromPath(fileName), " is unsupported:: FileName:: ").concat(fileName)); + } + function tryGetJSExtensionForFile(fileName, options) { + var ext = ts6.tryGetExtensionFromPath(fileName); + switch (ext) { + case ".ts": + case ".d.ts": + return ".js"; + case ".tsx": + return options.jsx === 1 ? ".jsx" : ".js"; + case ".js": + case ".jsx": + case ".json": + return ext; + case ".d.mts": + case ".mts": + case ".mjs": + return ".mjs"; + case ".d.cts": + case ".cts": + case ".cjs": + return ".cjs"; + default: + return void 0; + } + } + moduleSpecifiers_1.tryGetJSExtensionForFile = tryGetJSExtensionForFile; + function getRelativePathIfInDirectory(path, directoryPath, getCanonicalFileName) { + var relativePath = ts6.getRelativePathToDirectoryOrUrl( + directoryPath, + path, + directoryPath, + getCanonicalFileName, + /*isAbsolutePathAnUrl*/ + false + ); + return ts6.isRootedDiskPath(relativePath) ? void 0 : relativePath; + } + function isPathRelativeToParent(path) { + return ts6.startsWith(path, ".."); + } + })(moduleSpecifiers = ts6.moduleSpecifiers || (ts6.moduleSpecifiers = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var sysFormatDiagnosticsHost = ts6.sys ? { + getCurrentDirectory: function() { + return ts6.sys.getCurrentDirectory(); + }, + getNewLine: function() { + return ts6.sys.newLine; + }, + getCanonicalFileName: ts6.createGetCanonicalFileName(ts6.sys.useCaseSensitiveFileNames) + } : void 0; + function createDiagnosticReporter(system, pretty) { + var host = system === ts6.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : { + getCurrentDirectory: function() { + return system.getCurrentDirectory(); + }, + getNewLine: function() { + return system.newLine; + }, + getCanonicalFileName: ts6.createGetCanonicalFileName(system.useCaseSensitiveFileNames) + }; + if (!pretty) { + return function(diagnostic) { + return system.write(ts6.formatDiagnostic(diagnostic, host)); + }; + } + var diagnostics = new Array(1); + return function(diagnostic) { + diagnostics[0] = diagnostic; + system.write(ts6.formatDiagnosticsWithColorAndContext(diagnostics, host) + host.getNewLine()); + diagnostics[0] = void 0; + }; + } + ts6.createDiagnosticReporter = createDiagnosticReporter; + function clearScreenIfNotWatchingForFileChanges(system, diagnostic, options) { + if (system.clearScreen && !options.preserveWatchOutput && !options.extendedDiagnostics && !options.diagnostics && ts6.contains(ts6.screenStartingMessageCodes, diagnostic.code)) { + system.clearScreen(); + return true; + } + return false; + } + ts6.screenStartingMessageCodes = [ + ts6.Diagnostics.Starting_compilation_in_watch_mode.code, + ts6.Diagnostics.File_change_detected_Starting_incremental_compilation.code + ]; + function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) { + return ts6.contains(ts6.screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine; + } + function getLocaleTimeString(system) { + return !system.now ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : ( + // On some systems / builds of Node, there's a non-breaking space between the time and AM/PM. + // This branch is solely for testing, so just switch it to a normal space for baseline stability. + // See: + // - https://github.com/nodejs/node/issues/45171 + // - https://github.com/nodejs/node/issues/45753 + system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }).replace("\u202F", " ") + ); + } + ts6.getLocaleTimeString = getLocaleTimeString; + function createWatchStatusReporter(system, pretty) { + return pretty ? function(diagnostic, newLine, options) { + clearScreenIfNotWatchingForFileChanges(system, diagnostic, options); + var output = "[".concat(ts6.formatColorAndReset(getLocaleTimeString(system), ts6.ForegroundColorEscapeSequences.Grey), "] "); + output += "".concat(ts6.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)).concat(newLine + newLine); + system.write(output); + } : function(diagnostic, newLine, options) { + var output = ""; + if (!clearScreenIfNotWatchingForFileChanges(system, diagnostic, options)) { + output += newLine; + } + output += "".concat(getLocaleTimeString(system), " - "); + output += "".concat(ts6.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)).concat(getPlainDiagnosticFollowingNewLines(diagnostic, newLine)); + system.write(output); + }; + } + ts6.createWatchStatusReporter = createWatchStatusReporter; + function parseConfigFileWithSystem(configFileName, optionsToExtend, extendedConfigCache, watchOptionsToExtend, system, reportDiagnostic) { + var host = system; + host.onUnRecoverableConfigFileDiagnostic = function(diagnostic) { + return reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); + }; + var result = ts6.getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend); + host.onUnRecoverableConfigFileDiagnostic = void 0; + return result; + } + ts6.parseConfigFileWithSystem = parseConfigFileWithSystem; + function getErrorCountForSummary(diagnostics) { + return ts6.countWhere(diagnostics, function(diagnostic) { + return diagnostic.category === ts6.DiagnosticCategory.Error; + }); + } + ts6.getErrorCountForSummary = getErrorCountForSummary; + function getFilesInErrorForSummary(diagnostics) { + var filesInError = ts6.filter(diagnostics, function(diagnostic) { + return diagnostic.category === ts6.DiagnosticCategory.Error; + }).map(function(errorDiagnostic) { + if (errorDiagnostic.file === void 0) + return; + return "".concat(errorDiagnostic.file.fileName); + }); + return filesInError.map(function(fileName) { + var diagnosticForFileName = ts6.find(diagnostics, function(diagnostic) { + return diagnostic.file !== void 0 && diagnostic.file.fileName === fileName; + }); + if (diagnosticForFileName !== void 0) { + var line = ts6.getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start).line; + return { + fileName, + line: line + 1 + }; + } + }); + } + ts6.getFilesInErrorForSummary = getFilesInErrorForSummary; + function getWatchErrorSummaryDiagnosticMessage(errorCount) { + return errorCount === 1 ? ts6.Diagnostics.Found_1_error_Watching_for_file_changes : ts6.Diagnostics.Found_0_errors_Watching_for_file_changes; + } + ts6.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage; + function prettyPathForFileError(error, cwd) { + var line = ts6.formatColorAndReset(":" + error.line, ts6.ForegroundColorEscapeSequences.Grey); + if (ts6.pathIsAbsolute(error.fileName) && ts6.pathIsAbsolute(cwd)) { + return ts6.getRelativePathFromDirectory( + cwd, + error.fileName, + /* ignoreCase */ + false + ) + line; + } + return error.fileName + line; + } + function getErrorSummaryText(errorCount, filesInError, newLine, host) { + if (errorCount === 0) + return ""; + var nonNilFiles = filesInError.filter(function(fileInError) { + return fileInError !== void 0; + }); + var distinctFileNamesWithLines = nonNilFiles.map(function(fileInError) { + return "".concat(fileInError.fileName, ":").concat(fileInError.line); + }).filter(function(value, index, self2) { + return self2.indexOf(value) === index; + }); + var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory()); + var d = errorCount === 1 ? ts6.createCompilerDiagnostic(filesInError[0] !== void 0 ? ts6.Diagnostics.Found_1_error_in_1 : ts6.Diagnostics.Found_1_error, errorCount, firstFileReference) : ts6.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ? ts6.Diagnostics.Found_0_errors : distinctFileNamesWithLines.length === 1 ? ts6.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 : ts6.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length); + var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : ""; + return "".concat(newLine).concat(ts6.flattenDiagnosticMessageText(d.messageText, newLine)).concat(newLine).concat(newLine).concat(suffix); + } + ts6.getErrorSummaryText = getErrorSummaryText; + function createTabularErrorsDisplay(filesInError, host) { + var distinctFiles = filesInError.filter(function(value, index, self2) { + return index === self2.findIndex(function(file) { + return (file === null || file === void 0 ? void 0 : file.fileName) === (value === null || value === void 0 ? void 0 : value.fileName); + }); + }); + if (distinctFiles.length === 0) + return ""; + var numberLength = function(num) { + return Math.log(num) * Math.LOG10E + 1; + }; + var fileToErrorCount = distinctFiles.map(function(file) { + return [file, ts6.countWhere(filesInError, function(fileInError) { + return fileInError.fileName === file.fileName; + })]; + }); + var maxErrors = fileToErrorCount.reduce(function(acc, value) { + return Math.max(acc, value[1] || 0); + }, 0); + var headerRow = ts6.Diagnostics.Errors_Files.message; + var leftColumnHeadingLength = headerRow.split(" ")[0].length; + var leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors)); + var headerPadding = Math.max(numberLength(maxErrors) - leftColumnHeadingLength, 0); + var tabularData = ""; + tabularData += " ".repeat(headerPadding) + headerRow + "\n"; + fileToErrorCount.forEach(function(row) { + var file = row[0], errorCount = row[1]; + var errorCountDigitsLength = Math.log(errorCount) * Math.LOG10E + 1 | 0; + var leftPadding = errorCountDigitsLength < leftPaddingGoal ? " ".repeat(leftPaddingGoal - errorCountDigitsLength) : ""; + var fileRef = prettyPathForFileError(file, host.getCurrentDirectory()); + tabularData += "".concat(leftPadding).concat(errorCount, " ").concat(fileRef, "\n"); + }); + return tabularData; + } + function isBuilderProgram(program) { + return !!program.getState; + } + ts6.isBuilderProgram = isBuilderProgram; + function listFiles(program, write) { + var options = program.getCompilerOptions(); + if (options.explainFiles) { + explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write); + } else if (options.listFiles || options.listFilesOnly) { + ts6.forEach(program.getSourceFiles(), function(file) { + write(file.fileName); + }); + } + } + ts6.listFiles = listFiles; + function explainFiles(program, write) { + var _a, _b; + var reasons = program.getFileIncludeReasons(); + var getCanonicalFileName = ts6.createGetCanonicalFileName(program.useCaseSensitiveFileNames()); + var relativeFileName = function(fileName) { + return ts6.convertToRelativePath(fileName, program.getCurrentDirectory(), getCanonicalFileName); + }; + for (var _i = 0, _c = program.getSourceFiles(); _i < _c.length; _i++) { + var file = _c[_i]; + write("".concat(toFileName(file, relativeFileName))); + (_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function(reason) { + return write(" ".concat(fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText)); + }); + (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function(d) { + return write(" ".concat(d.messageText)); + }); + } + } + ts6.explainFiles = explainFiles; + function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) { + var _a; + var result; + if (file.path !== file.resolvedPath) { + (result !== null && result !== void 0 ? result : result = []).push(ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.File_is_output_of_project_reference_source_0, + toFileName(file.originalFileName, fileNameConvertor) + )); + } + if (file.redirectInfo) { + (result !== null && result !== void 0 ? result : result = []).push(ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.File_redirects_to_file_0, + toFileName(file.redirectInfo.redirectTarget, fileNameConvertor) + )); + } + if (ts6.isExternalOrCommonJsModule(file)) { + switch (file.impliedNodeFormat) { + case ts6.ModuleKind.ESNext: + if (file.packageJsonScope) { + (result !== null && result !== void 0 ? result : result = []).push(ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, + toFileName(ts6.last(file.packageJsonLocations), fileNameConvertor) + )); + } + break; + case ts6.ModuleKind.CommonJS: + if (file.packageJsonScope) { + (result !== null && result !== void 0 ? result : result = []).push(ts6.chainDiagnosticMessages( + /*details*/ + void 0, + file.packageJsonScope.contents.packageJsonContent.type ? ts6.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts6.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, + toFileName(ts6.last(file.packageJsonLocations), fileNameConvertor) + )); + } else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) { + (result !== null && result !== void 0 ? result : result = []).push(ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found + )); + } + break; + } + } + return result; + } + ts6.explainIfFileIsRedirectAndImpliedFormat = explainIfFileIsRedirectAndImpliedFormat; + function getMatchedFileSpec(program, fileName) { + var _a; + var configFile = program.getCompilerOptions().configFile; + if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedFilesSpec)) + return void 0; + var getCanonicalFileName = ts6.createGetCanonicalFileName(program.useCaseSensitiveFileNames()); + var filePath = getCanonicalFileName(fileName); + var basePath = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory())); + return ts6.find(configFile.configFileSpecs.validatedFilesSpec, function(fileSpec) { + return getCanonicalFileName(ts6.getNormalizedAbsolutePath(fileSpec, basePath)) === filePath; + }); + } + ts6.getMatchedFileSpec = getMatchedFileSpec; + function getMatchedIncludeSpec(program, fileName) { + var _a, _b; + var configFile = program.getCompilerOptions().configFile; + if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedIncludeSpecs)) + return void 0; + if (configFile.configFileSpecs.isDefaultIncludeSpec) + return true; + var isJsonFile = ts6.fileExtensionIs( + fileName, + ".json" + /* Extension.Json */ + ); + var basePath = ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory())); + var useCaseSensitiveFileNames = program.useCaseSensitiveFileNames(); + return ts6.find((_b = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _b === void 0 ? void 0 : _b.validatedIncludeSpecs, function(includeSpec) { + if (isJsonFile && !ts6.endsWith( + includeSpec, + ".json" + /* Extension.Json */ + )) + return false; + var pattern = ts6.getPatternFromSpec(includeSpec, basePath, "files"); + return !!pattern && ts6.getRegexFromPattern("(".concat(pattern, ")$"), useCaseSensitiveFileNames).test(fileName); + }); + } + ts6.getMatchedIncludeSpec = getMatchedIncludeSpec; + function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) { + var _a, _b; + var options = program.getCompilerOptions(); + if (ts6.isReferencedFile(reason)) { + var referenceLocation = ts6.getReferencedFileLocation(function(path) { + return program.getSourceFileByPath(path); + }, reason); + var referenceText = ts6.isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : '"'.concat(referenceLocation.text, '"'); + var message = void 0; + ts6.Debug.assert(ts6.isReferenceFileLocation(referenceLocation) || reason.kind === ts6.FileIncludeKind.Import, "Only synthetic references are imports"); + switch (reason.kind) { + case ts6.FileIncludeKind.Import: + if (ts6.isReferenceFileLocation(referenceLocation)) { + message = referenceLocation.packageId ? ts6.Diagnostics.Imported_via_0_from_file_1_with_packageId_2 : ts6.Diagnostics.Imported_via_0_from_file_1; + } else if (referenceLocation.text === ts6.externalHelpersModuleNameText) { + message = referenceLocation.packageId ? ts6.Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions : ts6.Diagnostics.Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions; + } else { + message = referenceLocation.packageId ? ts6.Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions : ts6.Diagnostics.Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions; + } + break; + case ts6.FileIncludeKind.ReferenceFile: + ts6.Debug.assert(!referenceLocation.packageId); + message = ts6.Diagnostics.Referenced_via_0_from_file_1; + break; + case ts6.FileIncludeKind.TypeReferenceDirective: + message = referenceLocation.packageId ? ts6.Diagnostics.Type_library_referenced_via_0_from_file_1_with_packageId_2 : ts6.Diagnostics.Type_library_referenced_via_0_from_file_1; + break; + case ts6.FileIncludeKind.LibReferenceDirective: + ts6.Debug.assert(!referenceLocation.packageId); + message = ts6.Diagnostics.Library_referenced_via_0_from_file_1; + break; + default: + ts6.Debug.assertNever(reason); + } + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + message, + referenceText, + toFileName(referenceLocation.file, fileNameConvertor), + referenceLocation.packageId && ts6.packageIdToString(referenceLocation.packageId) + ); + } + switch (reason.kind) { + case ts6.FileIncludeKind.RootFile: + if (!((_a = options.configFile) === null || _a === void 0 ? void 0 : _a.configFileSpecs)) + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Root_file_specified_for_compilation + ); + var fileName = ts6.getNormalizedAbsolutePath(program.getRootFileNames()[reason.index], program.getCurrentDirectory()); + var matchedByFiles = getMatchedFileSpec(program, fileName); + if (matchedByFiles) + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Part_of_files_list_in_tsconfig_json + ); + var matchedByInclude = getMatchedIncludeSpec(program, fileName); + return ts6.isString(matchedByInclude) ? ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Matched_by_include_pattern_0_in_1, + matchedByInclude, + toFileName(options.configFile, fileNameConvertor) + ) : ( + // Could be additional files specified as roots or matched by default include + ts6.chainDiagnosticMessages( + /*details*/ + void 0, + matchedByInclude ? ts6.Diagnostics.Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk : ts6.Diagnostics.Root_file_specified_for_compilation + ) + ); + case ts6.FileIncludeKind.SourceFromProjectReference: + case ts6.FileIncludeKind.OutputFromProjectReference: + var isOutput = reason.kind === ts6.FileIncludeKind.OutputFromProjectReference; + var referencedResolvedRef = ts6.Debug.checkDefined((_b = program.getResolvedProjectReferences()) === null || _b === void 0 ? void 0 : _b[reason.index]); + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.outFile(options) ? isOutput ? ts6.Diagnostics.Output_from_referenced_project_0_included_because_1_specified : ts6.Diagnostics.Source_from_referenced_project_0_included_because_1_specified : isOutput ? ts6.Diagnostics.Output_from_referenced_project_0_included_because_module_is_specified_as_none : ts6.Diagnostics.Source_from_referenced_project_0_included_because_module_is_specified_as_none, + toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor), + options.outFile ? "--outFile" : "--out" + ); + case ts6.FileIncludeKind.AutomaticTypeDirectiveFile: + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + options.types ? reason.packageId ? ts6.Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1 : ts6.Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions : reason.packageId ? ts6.Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1 : ts6.Diagnostics.Entry_point_for_implicit_type_library_0, + reason.typeReference, + reason.packageId && ts6.packageIdToString(reason.packageId) + ); + case ts6.FileIncludeKind.LibFile: + if (reason.index !== void 0) + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + ts6.Diagnostics.Library_0_specified_in_compilerOptions, + options.lib[reason.index] + ); + var target = ts6.forEachEntry(ts6.targetOptionDeclaration.type, function(value, key) { + return value === ts6.getEmitScriptTarget(options) ? key : void 0; + }); + return ts6.chainDiagnosticMessages( + /*details*/ + void 0, + target ? ts6.Diagnostics.Default_library_for_target_0 : ts6.Diagnostics.Default_library, + target + ); + default: + ts6.Debug.assertNever(reason); + } + } + ts6.fileIncludeReasonToDiagnostics = fileIncludeReasonToDiagnostics; + function toFileName(file, fileNameConvertor) { + var fileName = ts6.isString(file) ? file : file.fileName; + return fileNameConvertor ? fileNameConvertor(fileName) : fileName; + } + function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { + var isListFilesOnly = !!program.getCompilerOptions().listFilesOnly; + var allDiagnostics = program.getConfigFileParsingDiagnostics().slice(); + var configFileParsingDiagnosticsLength = allDiagnostics.length; + ts6.addRange(allDiagnostics, program.getSyntacticDiagnostics( + /*sourceFile*/ + void 0, + cancellationToken + )); + if (allDiagnostics.length === configFileParsingDiagnosticsLength) { + ts6.addRange(allDiagnostics, program.getOptionsDiagnostics(cancellationToken)); + if (!isListFilesOnly) { + ts6.addRange(allDiagnostics, program.getGlobalDiagnostics(cancellationToken)); + if (allDiagnostics.length === configFileParsingDiagnosticsLength) { + ts6.addRange(allDiagnostics, program.getSemanticDiagnostics( + /*sourceFile*/ + void 0, + cancellationToken + )); + } + } + } + var emitResult = isListFilesOnly ? { emitSkipped: true, diagnostics: ts6.emptyArray } : program.emit( + /*targetSourceFile*/ + void 0, + writeFile, + cancellationToken, + emitOnlyDtsFiles, + customTransformers + ); + var emittedFiles = emitResult.emittedFiles, emitDiagnostics = emitResult.diagnostics; + ts6.addRange(allDiagnostics, emitDiagnostics); + var diagnostics = ts6.sortAndDeduplicateDiagnostics(allDiagnostics); + diagnostics.forEach(reportDiagnostic); + if (write) { + var currentDir_1 = program.getCurrentDirectory(); + ts6.forEach(emittedFiles, function(file) { + var filepath = ts6.getNormalizedAbsolutePath(file, currentDir_1); + write("TSFILE: ".concat(filepath)); + }); + listFiles(program, write); + } + if (reportSummary) { + reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics)); + } + return { + emitResult, + diagnostics + }; + } + ts6.emitFilesAndReportErrors = emitFilesAndReportErrors; + function emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { + var _a = emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), emitResult = _a.emitResult, diagnostics = _a.diagnostics; + if (emitResult.emitSkipped && diagnostics.length > 0) { + return ts6.ExitStatus.DiagnosticsPresent_OutputsSkipped; + } else if (diagnostics.length > 0) { + return ts6.ExitStatus.DiagnosticsPresent_OutputsGenerated; + } + return ts6.ExitStatus.Success; + } + ts6.emitFilesAndReportErrorsAndGetExitStatus = emitFilesAndReportErrorsAndGetExitStatus; + ts6.noopFileWatcher = { close: ts6.noop }; + ts6.returnNoopFileWatcher = function() { + return ts6.noopFileWatcher; + }; + function createWatchHost(system, reportWatchStatus) { + if (system === void 0) { + system = ts6.sys; + } + var onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system); + return { + onWatchStatusChange, + watchFile: ts6.maybeBind(system, system.watchFile) || ts6.returnNoopFileWatcher, + watchDirectory: ts6.maybeBind(system, system.watchDirectory) || ts6.returnNoopFileWatcher, + setTimeout: ts6.maybeBind(system, system.setTimeout) || ts6.noop, + clearTimeout: ts6.maybeBind(system, system.clearTimeout) || ts6.noop + }; + } + ts6.createWatchHost = createWatchHost; + ts6.WatchType = { + ConfigFile: "Config file", + ExtendedConfigFile: "Extended config file", + SourceFile: "Source file", + MissingFile: "Missing file", + WildcardDirectory: "Wild card directory", + FailedLookupLocations: "Failed Lookup Locations", + AffectingFileLocation: "File location affecting resolution", + TypeRoots: "Type roots", + ConfigFileOfReferencedProject: "Config file of referened project", + ExtendedConfigOfReferencedProject: "Extended config file of referenced project", + WildcardDirectoryOfReferencedProject: "Wild card directory of referenced project", + PackageJson: "package.json file", + ClosedScriptInfo: "Closed Script info", + ConfigFileForInferredRoot: "Config file for the inferred project root", + NodeModules: "node_modules for closed script infos and package.jsons affecting module specifier cache", + MissingSourceMapFile: "Missing source map file", + NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root", + MissingGeneratedFile: "Missing generated file", + NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation" + }; + function createWatchFactory(host, options) { + var watchLogLevel = host.trace ? options.extendedDiagnostics ? ts6.WatchLogLevel.Verbose : options.diagnostics ? ts6.WatchLogLevel.TriggerOnly : ts6.WatchLogLevel.None : ts6.WatchLogLevel.None; + var writeLog = watchLogLevel !== ts6.WatchLogLevel.None ? function(s) { + return host.trace(s); + } : ts6.noop; + var result = ts6.getWatchFactory(host, watchLogLevel, writeLog); + result.writeLog = writeLog; + return result; + } + ts6.createWatchFactory = createWatchFactory; + function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost) { + if (directoryStructureHost === void 0) { + directoryStructureHost = host; + } + var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); + var hostGetNewLine = ts6.memoize(function() { + return host.getNewLine(); + }); + var compilerHost = { + getSourceFile: function(fileName, languageVersionOrOptions, onError) { + var text; + try { + ts6.performance.mark("beforeIORead"); + var encoding = getCompilerOptions().charset; + text = !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding); + ts6.performance.mark("afterIORead"); + ts6.performance.measure("I/O Read", "beforeIORead", "afterIORead"); + } catch (e) { + if (onError) { + onError(e.message); + } + text = ""; + } + return text !== void 0 ? ts6.createSourceFile(fileName, text, languageVersionOrOptions) : void 0; + }, + getDefaultLibLocation: ts6.maybeBind(host, host.getDefaultLibLocation), + getDefaultLibFileName: function(options) { + return host.getDefaultLibFileName(options); + }, + writeFile, + getCurrentDirectory: ts6.memoize(function() { + return host.getCurrentDirectory(); + }), + useCaseSensitiveFileNames: function() { + return useCaseSensitiveFileNames; + }, + getCanonicalFileName: ts6.createGetCanonicalFileName(useCaseSensitiveFileNames), + getNewLine: function() { + return ts6.getNewLineCharacter(getCompilerOptions(), hostGetNewLine); + }, + fileExists: function(f) { + return host.fileExists(f); + }, + readFile: function(f) { + return host.readFile(f); + }, + trace: ts6.maybeBind(host, host.trace), + directoryExists: ts6.maybeBind(directoryStructureHost, directoryStructureHost.directoryExists), + getDirectories: ts6.maybeBind(directoryStructureHost, directoryStructureHost.getDirectories), + realpath: ts6.maybeBind(host, host.realpath), + getEnvironmentVariable: ts6.maybeBind(host, host.getEnvironmentVariable) || function() { + return ""; + }, + createHash: ts6.maybeBind(host, host.createHash), + readDirectory: ts6.maybeBind(host, host.readDirectory), + disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature, + storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit + }; + return compilerHost; + function writeFile(fileName, text, writeByteOrderMark, onError) { + try { + ts6.performance.mark("beforeIOWrite"); + ts6.writeFileEnsuringDirectories(fileName, text, writeByteOrderMark, function(path, data, writeByteOrderMark2) { + return host.writeFile(path, data, writeByteOrderMark2); + }, function(path) { + return host.createDirectory(path); + }, function(path) { + return host.directoryExists(path); + }); + ts6.performance.mark("afterIOWrite"); + ts6.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite"); + } catch (e) { + if (onError) { + onError(e.message); + } + } + } + } + ts6.createCompilerHostFromProgramHost = createCompilerHostFromProgramHost; + function setGetSourceFileAsHashVersioned(compilerHost) { + var originalGetSourceFile = compilerHost.getSourceFile; + var computeHash = ts6.maybeBind(compilerHost, compilerHost.createHash) || ts6.generateDjb2Hash; + compilerHost.getSourceFile = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var result = originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false)); + if (result) { + result.version = computeHash(result.text); + } + return result; + }; + } + ts6.setGetSourceFileAsHashVersioned = setGetSourceFileAsHashVersioned; + function createProgramHost(system, createProgram2) { + var getDefaultLibLocation = ts6.memoize(function() { + return ts6.getDirectoryPath(ts6.normalizePath(system.getExecutingFilePath())); + }); + return { + useCaseSensitiveFileNames: function() { + return system.useCaseSensitiveFileNames; + }, + getNewLine: function() { + return system.newLine; + }, + getCurrentDirectory: ts6.memoize(function() { + return system.getCurrentDirectory(); + }), + getDefaultLibLocation, + getDefaultLibFileName: function(options) { + return ts6.combinePaths(getDefaultLibLocation(), ts6.getDefaultLibFileName(options)); + }, + fileExists: function(path) { + return system.fileExists(path); + }, + readFile: function(path, encoding) { + return system.readFile(path, encoding); + }, + directoryExists: function(path) { + return system.directoryExists(path); + }, + getDirectories: function(path) { + return system.getDirectories(path); + }, + readDirectory: function(path, extensions, exclude, include, depth) { + return system.readDirectory(path, extensions, exclude, include, depth); + }, + realpath: ts6.maybeBind(system, system.realpath), + getEnvironmentVariable: ts6.maybeBind(system, system.getEnvironmentVariable), + trace: function(s) { + return system.write(s + system.newLine); + }, + createDirectory: function(path) { + return system.createDirectory(path); + }, + writeFile: function(path, data, writeByteOrderMark) { + return system.writeFile(path, data, writeByteOrderMark); + }, + createHash: ts6.maybeBind(system, system.createHash), + createProgram: createProgram2 || ts6.createEmitAndSemanticDiagnosticsBuilderProgram, + disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature, + storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit, + now: ts6.maybeBind(system, system.now) + }; + } + ts6.createProgramHost = createProgramHost; + function createWatchCompilerHost(system, createProgram2, reportDiagnostic, reportWatchStatus) { + if (system === void 0) { + system = ts6.sys; + } + var write = function(s) { + return system.write(s + system.newLine); + }; + var result = createProgramHost(system, createProgram2); + ts6.copyProperties(result, createWatchHost(system, reportWatchStatus)); + result.afterProgramCreate = function(builderProgram) { + var compilerOptions = builderProgram.getCompilerOptions(); + var newLine = ts6.getNewLineCharacter(compilerOptions, function() { + return system.newLine; + }); + emitFilesAndReportErrors(builderProgram, reportDiagnostic, write, function(errorCount) { + return result.onWatchStatusChange(ts6.createCompilerDiagnostic(getWatchErrorSummaryDiagnosticMessage(errorCount), errorCount), newLine, compilerOptions, errorCount); + }); + }; + return result; + } + function reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic) { + reportDiagnostic(diagnostic); + system.exit(ts6.ExitStatus.DiagnosticsPresent_OutputsSkipped); + } + function createWatchCompilerHostOfConfigFile(_a) { + var configFileName = _a.configFileName, optionsToExtend = _a.optionsToExtend, watchOptionsToExtend = _a.watchOptionsToExtend, extraFileExtensions = _a.extraFileExtensions, system = _a.system, createProgram2 = _a.createProgram, reportDiagnostic = _a.reportDiagnostic, reportWatchStatus = _a.reportWatchStatus; + var diagnosticReporter = reportDiagnostic || createDiagnosticReporter(system); + var host = createWatchCompilerHost(system, createProgram2, diagnosticReporter, reportWatchStatus); + host.onUnRecoverableConfigFileDiagnostic = function(diagnostic) { + return reportUnrecoverableDiagnostic(system, diagnosticReporter, diagnostic); + }; + host.configFileName = configFileName; + host.optionsToExtend = optionsToExtend; + host.watchOptionsToExtend = watchOptionsToExtend; + host.extraFileExtensions = extraFileExtensions; + return host; + } + ts6.createWatchCompilerHostOfConfigFile = createWatchCompilerHostOfConfigFile; + function createWatchCompilerHostOfFilesAndCompilerOptions(_a) { + var rootFiles = _a.rootFiles, options = _a.options, watchOptions = _a.watchOptions, projectReferences = _a.projectReferences, system = _a.system, createProgram2 = _a.createProgram, reportDiagnostic = _a.reportDiagnostic, reportWatchStatus = _a.reportWatchStatus; + var host = createWatchCompilerHost(system, createProgram2, reportDiagnostic || createDiagnosticReporter(system), reportWatchStatus); + host.rootFiles = rootFiles; + host.options = options; + host.watchOptions = watchOptions; + host.projectReferences = projectReferences; + return host; + } + ts6.createWatchCompilerHostOfFilesAndCompilerOptions = createWatchCompilerHostOfFilesAndCompilerOptions; + function performIncrementalCompilation(input) { + var system = input.system || ts6.sys; + var host = input.host || (input.host = ts6.createIncrementalCompilerHost(input.options, system)); + var builderProgram = ts6.createIncrementalProgram(input); + var exitStatus = emitFilesAndReportErrorsAndGetExitStatus(builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), function(s) { + return host.trace && host.trace(s); + }, input.reportErrorSummary || input.options.pretty ? function(errorCount, filesInError) { + return system.write(getErrorSummaryText(errorCount, filesInError, system.newLine, host)); + } : void 0); + if (input.afterProgramEmitAndDiagnostics) + input.afterProgramEmitAndDiagnostics(builderProgram); + return exitStatus; + } + ts6.performIncrementalCompilation = performIncrementalCompilation; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function readBuilderProgram(compilerOptions, host) { + var buildInfoPath = ts6.getTsBuildInfoEmitOutputFilePath(compilerOptions); + if (!buildInfoPath) + return void 0; + var buildInfo; + if (host.getBuildInfo) { + buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); + } else { + var content = host.readFile(buildInfoPath); + if (!content) + return void 0; + buildInfo = ts6.getBuildInfo(buildInfoPath, content); + } + if (!buildInfo || buildInfo.version !== ts6.version || !buildInfo.program) + return void 0; + return ts6.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); + } + ts6.readBuilderProgram = readBuilderProgram; + function createIncrementalCompilerHost(options, system) { + if (system === void 0) { + system = ts6.sys; + } + var host = ts6.createCompilerHostWorker( + options, + /*setParentNodes*/ + void 0, + system + ); + host.createHash = ts6.maybeBind(system, system.createHash); + host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature; + host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit; + ts6.setGetSourceFileAsHashVersioned(host); + ts6.changeCompilerHostLikeToUseCache(host, function(fileName) { + return ts6.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); + }); + return host; + } + ts6.createIncrementalCompilerHost = createIncrementalCompilerHost; + function createIncrementalProgram(_a) { + var rootNames = _a.rootNames, options = _a.options, configFileParsingDiagnostics = _a.configFileParsingDiagnostics, projectReferences = _a.projectReferences, host = _a.host, createProgram2 = _a.createProgram; + host = host || createIncrementalCompilerHost(options); + createProgram2 = createProgram2 || ts6.createEmitAndSemanticDiagnosticsBuilderProgram; + var oldProgram = readBuilderProgram(options, host); + return createProgram2(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); + } + ts6.createIncrementalProgram = createIncrementalProgram; + function createWatchCompilerHost(rootFilesOrConfigFileName, options, system, createProgram2, reportDiagnostic, reportWatchStatus, projectReferencesOrWatchOptionsToExtend, watchOptionsOrExtraFileExtensions) { + if (ts6.isArray(rootFilesOrConfigFileName)) { + return ts6.createWatchCompilerHostOfFilesAndCompilerOptions({ + rootFiles: rootFilesOrConfigFileName, + options, + watchOptions: watchOptionsOrExtraFileExtensions, + projectReferences: projectReferencesOrWatchOptionsToExtend, + system, + createProgram: createProgram2, + reportDiagnostic, + reportWatchStatus + }); + } else { + return ts6.createWatchCompilerHostOfConfigFile({ + configFileName: rootFilesOrConfigFileName, + optionsToExtend: options, + watchOptionsToExtend: projectReferencesOrWatchOptionsToExtend, + extraFileExtensions: watchOptionsOrExtraFileExtensions, + system, + createProgram: createProgram2, + reportDiagnostic, + reportWatchStatus + }); + } + } + ts6.createWatchCompilerHost = createWatchCompilerHost; + function createWatchProgram(host) { + var builderProgram; + var reloadLevel; + var missingFilesMap; + var watchedWildcardDirectories; + var timerToUpdateProgram; + var timerToInvalidateFailedLookupResolutions; + var parsedConfigs; + var sharedExtendedConfigFileWatchers; + var extendedConfigCache = host.extendedConfigCache; + var reportFileChangeDetectedOnCreateProgram = false; + var sourceFilesCache = new ts6.Map(); + var missingFilePathsRequestedForRelease; + var hasChangedCompilerOptions = false; + var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); + var currentDirectory = host.getCurrentDirectory(); + var configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = _a === void 0 ? {} : _a, watchOptionsToExtend = host.watchOptionsToExtend, extraFileExtensions = host.extraFileExtensions, createProgram2 = host.createProgram; + var rootFileNames = host.rootFiles, compilerOptions = host.options, watchOptions = host.watchOptions, projectReferences = host.projectReferences; + var wildcardDirectories; + var configFileParsingDiagnostics; + var canConfigFileJsonReportNoInputFiles = false; + var hasChangedConfigFileParsingErrors = false; + var cachedDirectoryStructureHost = configFileName === void 0 ? void 0 : ts6.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); + var directoryStructureHost = cachedDirectoryStructureHost || host; + var parseConfigFileHost = ts6.parseConfigHostFromCompilerHostLike(host, directoryStructureHost); + var newLine = updateNewLine(); + if (configFileName && host.configFileParsingResult) { + setConfigFileParsingResult(host.configFileParsingResult); + newLine = updateNewLine(); + } + reportWatchDiagnostic(ts6.Diagnostics.Starting_compilation_in_watch_mode); + if (configFileName && !host.configFileParsingResult) { + newLine = ts6.getNewLineCharacter(optionsToExtendForConfigFile, function() { + return host.getNewLine(); + }); + ts6.Debug.assert(!rootFileNames); + parseConfigFile(); + newLine = updateNewLine(); + } + var _b = ts6.createWatchFactory(host, compilerOptions), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory, writeLog = _b.writeLog; + var getCanonicalFileName = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + writeLog("Current directory: ".concat(currentDirectory, " CaseSensitiveFileNames: ").concat(useCaseSensitiveFileNames)); + var configFileWatcher; + if (configFileName) { + configFileWatcher = watchFile(configFileName, scheduleProgramReload, ts6.PollingInterval.High, watchOptions, ts6.WatchType.ConfigFile); + } + var compilerHost = ts6.createCompilerHostFromProgramHost(host, function() { + return compilerOptions; + }, directoryStructureHost); + ts6.setGetSourceFileAsHashVersioned(compilerHost); + var getNewSourceFile = compilerHost.getSourceFile; + compilerHost.getSourceFile = function(fileName) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return getVersionedSourceFileByPath.apply(void 0, __spreadArray([fileName, toPath(fileName)], args, false)); + }; + compilerHost.getSourceFileByPath = getVersionedSourceFileByPath; + compilerHost.getNewLine = function() { + return newLine; + }; + compilerHost.fileExists = fileExists; + compilerHost.onReleaseOldSourceFile = onReleaseOldSourceFile; + compilerHost.onReleaseParsedCommandLine = onReleaseParsedCommandLine; + compilerHost.toPath = toPath; + compilerHost.getCompilationSettings = function() { + return compilerOptions; + }; + compilerHost.useSourceOfProjectReferenceRedirect = ts6.maybeBind(host, host.useSourceOfProjectReferenceRedirect); + compilerHost.watchDirectoryOfFailedLookupLocation = function(dir, cb, flags) { + return watchDirectory(dir, cb, flags, watchOptions, ts6.WatchType.FailedLookupLocations); + }; + compilerHost.watchAffectingFileLocation = function(file, cb) { + return watchFile(file, cb, ts6.PollingInterval.High, watchOptions, ts6.WatchType.AffectingFileLocation); + }; + compilerHost.watchTypeRootsDirectory = function(dir, cb, flags) { + return watchDirectory(dir, cb, flags, watchOptions, ts6.WatchType.TypeRoots); + }; + compilerHost.getCachedDirectoryStructureHost = function() { + return cachedDirectoryStructureHost; + }; + compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations; + compilerHost.onInvalidatedResolution = scheduleProgramUpdate; + compilerHost.onChangedAutomaticTypeDirectiveNames = scheduleProgramUpdate; + compilerHost.fileIsOpen = ts6.returnFalse; + compilerHost.getCurrentProgram = getCurrentProgram; + compilerHost.writeLog = writeLog; + compilerHost.getParsedCommandLine = getParsedCommandLine; + var resolutionCache = ts6.createResolutionCache( + compilerHost, + configFileName ? ts6.getDirectoryPath(ts6.getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory, + /*logChangesWhenResolvingModule*/ + false + ); + compilerHost.resolveModuleNames = host.resolveModuleNames ? function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return host.resolveModuleNames.apply(host, args); + } : function(moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { + return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); + }; + compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ? function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return host.resolveTypeReferenceDirectives.apply(host, args); + } : function(typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { + return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); + }; + compilerHost.getModuleResolutionCache = host.resolveModuleNames ? ts6.maybeBind(host, host.getModuleResolutionCache) : function() { + return resolutionCache.getModuleResolutionCache(); + }; + var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + var customHasInvalidatedResolutions = userProvidedResolution ? ts6.maybeBind(host, host.hasInvalidatedResolutions) || ts6.returnTrue : ts6.returnFalse; + builderProgram = readBuilderProgram(compilerOptions, compilerHost); + synchronizeProgram(); + watchConfigFileWildCardDirectories(); + if (configFileName) + updateExtendedConfigFilesWatches(toPath(configFileName), compilerOptions, watchOptions, ts6.WatchType.ExtendedConfigFile); + return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close }; + function close() { + clearInvalidateResolutionsOfFailedLookupLocations(); + resolutionCache.clear(); + ts6.clearMap(sourceFilesCache, function(value) { + if (value && value.fileWatcher) { + value.fileWatcher.close(); + value.fileWatcher = void 0; + } + }); + if (configFileWatcher) { + configFileWatcher.close(); + configFileWatcher = void 0; + } + extendedConfigCache === null || extendedConfigCache === void 0 ? void 0 : extendedConfigCache.clear(); + extendedConfigCache = void 0; + if (sharedExtendedConfigFileWatchers) { + ts6.clearMap(sharedExtendedConfigFileWatchers, ts6.closeFileWatcherOf); + sharedExtendedConfigFileWatchers = void 0; + } + if (watchedWildcardDirectories) { + ts6.clearMap(watchedWildcardDirectories, ts6.closeFileWatcherOf); + watchedWildcardDirectories = void 0; + } + if (missingFilesMap) { + ts6.clearMap(missingFilesMap, ts6.closeFileWatcher); + missingFilesMap = void 0; + } + if (parsedConfigs) { + ts6.clearMap(parsedConfigs, function(config) { + var _a2; + (_a2 = config.watcher) === null || _a2 === void 0 ? void 0 : _a2.close(); + config.watcher = void 0; + if (config.watchedDirectories) + ts6.clearMap(config.watchedDirectories, ts6.closeFileWatcherOf); + config.watchedDirectories = void 0; + }); + parsedConfigs = void 0; + } + } + function getCurrentBuilderProgram() { + return builderProgram; + } + function getCurrentProgram() { + return builderProgram && builderProgram.getProgramOrUndefined(); + } + function synchronizeProgram() { + writeLog("Synchronizing program"); + clearInvalidateResolutionsOfFailedLookupLocations(); + var program = getCurrentBuilderProgram(); + if (hasChangedCompilerOptions) { + newLine = updateNewLine(); + if (program && ts6.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) { + resolutionCache.clear(); + } + } + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a2 = ts6.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a2.originalReadFile, originalFileExists = _a2.originalFileExists, originalDirectoryExists = _a2.originalDirectoryExists, originalCreateDirectory = _a2.originalCreateDirectory, originalWriteFile = _a2.originalWriteFile, readFileWithCache = _a2.readFileWithCache; + if (ts6.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, function(path) { + return getSourceVersion(path, readFileWithCache); + }, function(fileName) { + return compilerHost.fileExists(fileName); + }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (hasChangedConfigFileParsingErrors) { + if (reportFileChangeDetectedOnCreateProgram) { + reportWatchDiagnostic(ts6.Diagnostics.File_change_detected_Starting_incremental_compilation); + } + builderProgram = createProgram2( + /*rootNames*/ + void 0, + /*options*/ + void 0, + compilerHost, + builderProgram, + configFileParsingDiagnostics, + projectReferences + ); + hasChangedConfigFileParsingErrors = false; + } + } else { + if (reportFileChangeDetectedOnCreateProgram) { + reportWatchDiagnostic(ts6.Diagnostics.File_change_detected_Starting_incremental_compilation); + } + createNewProgram(hasInvalidatedResolutions); + } + reportFileChangeDetectedOnCreateProgram = false; + if (host.afterProgramCreate && program !== builderProgram) { + host.afterProgramCreate(builderProgram); + } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; + return builderProgram; + } + function createNewProgram(hasInvalidatedResolutions) { + writeLog("CreatingProgramWith::"); + writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); + writeLog(" options: ".concat(JSON.stringify(compilerOptions))); + if (projectReferences) + writeLog(" projectReferences: ".concat(JSON.stringify(projectReferences))); + var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram(); + hasChangedCompilerOptions = false; + hasChangedConfigFileParsingErrors = false; + resolutionCache.startCachingPerDirectoryResolution(); + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; + compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; + var oldProgram = getCurrentProgram(); + builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); + resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram); + ts6.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts6.Map()), watchMissingFilePath); + if (needsUpdateInTypeRootWatch) { + resolutionCache.updateTypeRootsWatch(); + } + if (missingFilePathsRequestedForRelease) { + for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) { + var missingFilePath = missingFilePathsRequestedForRelease_1[_i]; + if (!missingFilesMap.has(missingFilePath)) { + sourceFilesCache.delete(missingFilePath); + } + } + missingFilePathsRequestedForRelease = void 0; + } + } + function updateRootFileNames(files) { + ts6.Debug.assert(!configFileName, "Cannot update root file names with config file watch mode"); + rootFileNames = files; + scheduleProgramUpdate(); + } + function updateNewLine() { + return ts6.getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, function() { + return host.getNewLine(); + }); + } + function toPath(fileName) { + return ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + } + function isFileMissingOnHost(hostSourceFile) { + return typeof hostSourceFile === "boolean"; + } + function isFilePresenceUnknownOnHost(hostSourceFile) { + return typeof hostSourceFile.version === "boolean"; + } + function fileExists(fileName) { + var path = toPath(fileName); + if (isFileMissingOnHost(sourceFilesCache.get(path))) { + return false; + } + return directoryStructureHost.fileExists(fileName); + } + function getVersionedSourceFileByPath(fileName, path, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { + var hostSourceFile = sourceFilesCache.get(path); + if (isFileMissingOnHost(hostSourceFile)) { + return void 0; + } + if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) { + var sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError); + if (hostSourceFile) { + if (sourceFile) { + hostSourceFile.sourceFile = sourceFile; + hostSourceFile.version = sourceFile.version; + if (!hostSourceFile.fileWatcher) { + hostSourceFile.fileWatcher = watchFilePath(path, fileName, onSourceFileChange, ts6.PollingInterval.Low, watchOptions, ts6.WatchType.SourceFile); + } + } else { + if (hostSourceFile.fileWatcher) { + hostSourceFile.fileWatcher.close(); + } + sourceFilesCache.set(path, false); + } + } else { + if (sourceFile) { + var fileWatcher = watchFilePath(path, fileName, onSourceFileChange, ts6.PollingInterval.Low, watchOptions, ts6.WatchType.SourceFile); + sourceFilesCache.set(path, { sourceFile, version: sourceFile.version, fileWatcher }); + } else { + sourceFilesCache.set(path, false); + } + } + return sourceFile; + } + return hostSourceFile.sourceFile; + } + function nextSourceFileVersion(path) { + var hostSourceFile = sourceFilesCache.get(path); + if (hostSourceFile !== void 0) { + if (isFileMissingOnHost(hostSourceFile)) { + sourceFilesCache.set(path, { version: false }); + } else { + hostSourceFile.version = false; + } + } + } + function getSourceVersion(path, readFileWithCache) { + var hostSourceFile = sourceFilesCache.get(path); + if (!hostSourceFile) + return void 0; + if (hostSourceFile.version) + return hostSourceFile.version; + var text = readFileWithCache(path); + return text !== void 0 ? (compilerHost.createHash || ts6.generateDjb2Hash)(text) : void 0; + } + function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) { + var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath); + if (hostSourceFileInfo !== void 0) { + if (isFileMissingOnHost(hostSourceFileInfo)) { + (missingFilePathsRequestedForRelease || (missingFilePathsRequestedForRelease = [])).push(oldSourceFile.path); + } else if (hostSourceFileInfo.sourceFile === oldSourceFile) { + if (hostSourceFileInfo.fileWatcher) { + hostSourceFileInfo.fileWatcher.close(); + } + sourceFilesCache.delete(oldSourceFile.resolvedPath); + if (!hasSourceFileByPath) { + resolutionCache.removeResolutionsOfFile(oldSourceFile.path); + } + } + } + } + function reportWatchDiagnostic(message) { + if (host.onWatchStatusChange) { + host.onWatchStatusChange(ts6.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile); + } + } + function hasChangedAutomaticTypeDirectiveNames() { + return resolutionCache.hasChangedAutomaticTypeDirectiveNames(); + } + function clearInvalidateResolutionsOfFailedLookupLocations() { + if (!timerToInvalidateFailedLookupResolutions) + return false; + host.clearTimeout(timerToInvalidateFailedLookupResolutions); + timerToInvalidateFailedLookupResolutions = void 0; + return true; + } + function scheduleInvalidateResolutionsOfFailedLookupLocations() { + if (!host.setTimeout || !host.clearTimeout) { + return resolutionCache.invalidateResolutionsOfFailedLookupLocations(); + } + var pending = clearInvalidateResolutionsOfFailedLookupLocations(); + writeLog("Scheduling invalidateFailedLookup".concat(pending ? ", Cancelled earlier one" : "")); + timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250); + } + function invalidateResolutionsOfFailedLookup() { + timerToInvalidateFailedLookupResolutions = void 0; + if (resolutionCache.invalidateResolutionsOfFailedLookupLocations()) { + scheduleProgramUpdate(); + } + } + function scheduleProgramUpdate() { + if (!host.setTimeout || !host.clearTimeout) { + return; + } + if (timerToUpdateProgram) { + host.clearTimeout(timerToUpdateProgram); + } + writeLog("Scheduling update"); + timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250); + } + function scheduleProgramReload() { + ts6.Debug.assert(!!configFileName); + reloadLevel = ts6.ConfigFileProgramReloadLevel.Full; + scheduleProgramUpdate(); + } + function updateProgramWithWatchStatus() { + timerToUpdateProgram = void 0; + reportFileChangeDetectedOnCreateProgram = true; + updateProgram(); + } + function updateProgram() { + switch (reloadLevel) { + case ts6.ConfigFileProgramReloadLevel.Partial: + ts6.perfLogger.logStartUpdateProgram("PartialConfigReload"); + reloadFileNamesFromConfigFile(); + break; + case ts6.ConfigFileProgramReloadLevel.Full: + ts6.perfLogger.logStartUpdateProgram("FullConfigReload"); + reloadConfigFile(); + break; + default: + ts6.perfLogger.logStartUpdateProgram("SynchronizeProgram"); + synchronizeProgram(); + break; + } + ts6.perfLogger.logStopUpdateProgram("Done"); + return getCurrentBuilderProgram(); + } + function reloadFileNamesFromConfigFile() { + writeLog("Reloading new file names and options"); + reloadLevel = ts6.ConfigFileProgramReloadLevel.None; + rootFileNames = ts6.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts6.getNormalizedAbsolutePath(ts6.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions); + if (ts6.updateErrorForNoInputFiles(rootFileNames, ts6.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) { + hasChangedConfigFileParsingErrors = true; + } + synchronizeProgram(); + } + function reloadConfigFile() { + writeLog("Reloading config file: ".concat(configFileName)); + reloadLevel = ts6.ConfigFileProgramReloadLevel.None; + if (cachedDirectoryStructureHost) { + cachedDirectoryStructureHost.clearCache(); + } + parseConfigFile(); + hasChangedCompilerOptions = true; + synchronizeProgram(); + watchConfigFileWildCardDirectories(); + updateExtendedConfigFilesWatches(toPath(configFileName), compilerOptions, watchOptions, ts6.WatchType.ExtendedConfigFile); + } + function parseConfigFile() { + setConfigFileParsingResult(ts6.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost, extendedConfigCache || (extendedConfigCache = new ts6.Map()), watchOptionsToExtend, extraFileExtensions)); + } + function setConfigFileParsingResult(configFileParseResult) { + rootFileNames = configFileParseResult.fileNames; + compilerOptions = configFileParseResult.options; + watchOptions = configFileParseResult.watchOptions; + projectReferences = configFileParseResult.projectReferences; + wildcardDirectories = configFileParseResult.wildcardDirectories; + configFileParsingDiagnostics = ts6.getConfigFileParsingDiagnostics(configFileParseResult).slice(); + canConfigFileJsonReportNoInputFiles = ts6.canJsonReportNoInputFiles(configFileParseResult.raw); + hasChangedConfigFileParsingErrors = true; + } + function getParsedCommandLine(configFileName2) { + var configPath = toPath(configFileName2); + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath); + if (config) { + if (!config.reloadLevel) + return config.parsedCommandLine; + if (config.parsedCommandLine && config.reloadLevel === ts6.ConfigFileProgramReloadLevel.Partial && !host.getParsedCommandLine) { + writeLog("Reloading new file names and options"); + var fileNames = ts6.getFileNamesFromConfigSpecs(config.parsedCommandLine.options.configFile.configFileSpecs, ts6.getNormalizedAbsolutePath(ts6.getDirectoryPath(configFileName2), currentDirectory), compilerOptions, parseConfigFileHost); + config.parsedCommandLine = __assign(__assign({}, config.parsedCommandLine), { fileNames }); + config.reloadLevel = void 0; + return config.parsedCommandLine; + } + } + writeLog("Loading config file: ".concat(configFileName2)); + var parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2); + if (config) { + config.parsedCommandLine = parsedCommandLine; + config.reloadLevel = void 0; + } else { + (parsedConfigs || (parsedConfigs = new ts6.Map())).set(configPath, config = { parsedCommandLine }); + } + watchReferencedProject(configFileName2, configPath, config); + return parsedCommandLine; + } + function getParsedCommandLineFromConfigFileHost(configFileName2) { + var onUnRecoverableConfigFileDiagnostic = parseConfigFileHost.onUnRecoverableConfigFileDiagnostic; + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts6.noop; + var parsedCommandLine = ts6.getParsedCommandLineOfConfigFile( + configFileName2, + /*optionsToExtend*/ + void 0, + parseConfigFileHost, + extendedConfigCache || (extendedConfigCache = new ts6.Map()), + watchOptionsToExtend + ); + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = onUnRecoverableConfigFileDiagnostic; + return parsedCommandLine; + } + function onReleaseParsedCommandLine(fileName) { + var _a2; + var path = toPath(fileName); + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(path); + if (!config) + return; + parsedConfigs.delete(path); + if (config.watchedDirectories) + ts6.clearMap(config.watchedDirectories, ts6.closeFileWatcherOf); + (_a2 = config.watcher) === null || _a2 === void 0 ? void 0 : _a2.close(); + ts6.clearSharedExtendedConfigFileWatcher(path, sharedExtendedConfigFileWatchers); + } + function watchFilePath(path, file, callback, pollingInterval, options, watchType) { + return watchFile(file, function(fileName, eventKind) { + return callback(fileName, eventKind, path); + }, pollingInterval, options, watchType); + } + function onSourceFileChange(fileName, eventKind, path) { + updateCachedSystemWithFile(fileName, path, eventKind); + if (eventKind === ts6.FileWatcherEventKind.Deleted && sourceFilesCache.has(path)) { + resolutionCache.invalidateResolutionOfFile(path); + } + nextSourceFileVersion(path); + scheduleProgramUpdate(); + } + function updateCachedSystemWithFile(fileName, path, eventKind) { + if (cachedDirectoryStructureHost) { + cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind); + } + } + function watchMissingFilePath(missingFilePath) { + return (parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.has(missingFilePath)) ? ts6.noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, ts6.PollingInterval.Medium, watchOptions, ts6.WatchType.MissingFile); + } + function onMissingFileChange(fileName, eventKind, missingFilePath) { + updateCachedSystemWithFile(fileName, missingFilePath, eventKind); + if (eventKind === ts6.FileWatcherEventKind.Created && missingFilesMap.has(missingFilePath)) { + missingFilesMap.get(missingFilePath).close(); + missingFilesMap.delete(missingFilePath); + nextSourceFileVersion(missingFilePath); + scheduleProgramUpdate(); + } + } + function watchConfigFileWildCardDirectories() { + if (wildcardDirectories) { + ts6.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = new ts6.Map()), new ts6.Map(ts6.getEntries(wildcardDirectories)), watchWildcardDirectory); + } else if (watchedWildcardDirectories) { + ts6.clearMap(watchedWildcardDirectories, ts6.closeFileWatcherOf); + } + } + function watchWildcardDirectory(directory, flags) { + return watchDirectory(directory, function(fileOrDirectory) { + ts6.Debug.assert(!!configFileName); + var fileOrDirectoryPath = toPath(fileOrDirectory); + if (cachedDirectoryStructureHost) { + cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + } + nextSourceFileVersion(fileOrDirectoryPath); + if (ts6.isIgnoredFileFromWildCardWatching({ + watchedDirPath: toPath(directory), + fileOrDirectory, + fileOrDirectoryPath, + configFileName, + extraFileExtensions, + options: compilerOptions, + program: getCurrentBuilderProgram() || rootFileNames, + currentDirectory, + useCaseSensitiveFileNames, + writeLog, + toPath + })) + return; + if (reloadLevel !== ts6.ConfigFileProgramReloadLevel.Full) { + reloadLevel = ts6.ConfigFileProgramReloadLevel.Partial; + scheduleProgramUpdate(); + } + }, flags, watchOptions, ts6.WatchType.WildcardDirectory); + } + function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) { + ts6.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts6.Map()), function(extendedConfigFileName, extendedConfigFilePath) { + return watchFile(extendedConfigFileName, function(_fileName, eventKind) { + var _a2; + updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind); + if (extendedConfigCache) + ts6.cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath); + var projects = (_a2 = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) === null || _a2 === void 0 ? void 0 : _a2.projects; + if (!(projects === null || projects === void 0 ? void 0 : projects.size)) + return; + projects.forEach(function(projectPath) { + if (toPath(configFileName) === projectPath) { + reloadLevel = ts6.ConfigFileProgramReloadLevel.Full; + } else { + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath); + if (config) + config.reloadLevel = ts6.ConfigFileProgramReloadLevel.Full; + resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath); + } + scheduleProgramUpdate(); + }); + }, ts6.PollingInterval.High, watchOptions2, watchType); + }, toPath); + } + function watchReferencedProject(configFileName2, configPath, commandLine) { + var _a2, _b2, _c, _d, _e; + commandLine.watcher || (commandLine.watcher = watchFile(configFileName2, function(_fileName, eventKind) { + updateCachedSystemWithFile(configFileName2, configPath, eventKind); + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath); + if (config) + config.reloadLevel = ts6.ConfigFileProgramReloadLevel.Full; + resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath); + scheduleProgramUpdate(); + }, ts6.PollingInterval.High, ((_a2 = commandLine.parsedCommandLine) === null || _a2 === void 0 ? void 0 : _a2.watchOptions) || watchOptions, ts6.WatchType.ConfigFileOfReferencedProject)); + if ((_b2 = commandLine.parsedCommandLine) === null || _b2 === void 0 ? void 0 : _b2.wildcardDirectories) { + ts6.updateWatchingWildcardDirectories(commandLine.watchedDirectories || (commandLine.watchedDirectories = new ts6.Map()), new ts6.Map(ts6.getEntries((_c = commandLine.parsedCommandLine) === null || _c === void 0 ? void 0 : _c.wildcardDirectories)), function(directory, flags) { + var _a3; + return watchDirectory(directory, function(fileOrDirectory) { + var fileOrDirectoryPath = toPath(fileOrDirectory); + if (cachedDirectoryStructureHost) { + cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + } + nextSourceFileVersion(fileOrDirectoryPath); + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath); + if (!(config === null || config === void 0 ? void 0 : config.parsedCommandLine)) + return; + if (ts6.isIgnoredFileFromWildCardWatching({ + watchedDirPath: toPath(directory), + fileOrDirectory, + fileOrDirectoryPath, + configFileName: configFileName2, + options: config.parsedCommandLine.options, + program: config.parsedCommandLine.fileNames, + currentDirectory, + useCaseSensitiveFileNames, + writeLog, + toPath + })) + return; + if (config.reloadLevel !== ts6.ConfigFileProgramReloadLevel.Full) { + config.reloadLevel = ts6.ConfigFileProgramReloadLevel.Partial; + scheduleProgramUpdate(); + } + }, flags, ((_a3 = commandLine.parsedCommandLine) === null || _a3 === void 0 ? void 0 : _a3.watchOptions) || watchOptions, ts6.WatchType.WildcardDirectoryOfReferencedProject); + }); + } else if (commandLine.watchedDirectories) { + ts6.clearMap(commandLine.watchedDirectories, ts6.closeFileWatcherOf); + commandLine.watchedDirectories = void 0; + } + updateExtendedConfigFilesWatches(configPath, (_d = commandLine.parsedCommandLine) === null || _d === void 0 ? void 0 : _d.options, ((_e = commandLine.parsedCommandLine) === null || _e === void 0 ? void 0 : _e.watchOptions) || watchOptions, ts6.WatchType.ExtendedConfigOfReferencedProject); + } + } + ts6.createWatchProgram = createWatchProgram; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var UpToDateStatusType; + (function(UpToDateStatusType2) { + UpToDateStatusType2[UpToDateStatusType2["Unbuildable"] = 0] = "Unbuildable"; + UpToDateStatusType2[UpToDateStatusType2["UpToDate"] = 1] = "UpToDate"; + UpToDateStatusType2[UpToDateStatusType2["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes"; + UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; + UpToDateStatusType2[UpToDateStatusType2["OutputMissing"] = 4] = "OutputMissing"; + UpToDateStatusType2[UpToDateStatusType2["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; + UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 15] = "ForceBuild"; + })(UpToDateStatusType = ts6.UpToDateStatusType || (ts6.UpToDateStatusType = {})); + function resolveConfigFileProjectName(project) { + if (ts6.fileExtensionIs( + project, + ".json" + /* Extension.Json */ + )) { + return project; + } + return ts6.combinePaths(project, "tsconfig.json"); + } + ts6.resolveConfigFileProjectName = resolveConfigFileProjectName; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var minimumDate = /* @__PURE__ */ new Date(-864e13); + var maximumDate = /* @__PURE__ */ new Date(864e13); + var BuildResultFlags; + (function(BuildResultFlags2) { + BuildResultFlags2[BuildResultFlags2["None"] = 0] = "None"; + BuildResultFlags2[BuildResultFlags2["Success"] = 1] = "Success"; + BuildResultFlags2[BuildResultFlags2["DeclarationOutputUnchanged"] = 2] = "DeclarationOutputUnchanged"; + BuildResultFlags2[BuildResultFlags2["ConfigFileErrors"] = 4] = "ConfigFileErrors"; + BuildResultFlags2[BuildResultFlags2["SyntaxErrors"] = 8] = "SyntaxErrors"; + BuildResultFlags2[BuildResultFlags2["TypeErrors"] = 16] = "TypeErrors"; + BuildResultFlags2[BuildResultFlags2["DeclarationEmitErrors"] = 32] = "DeclarationEmitErrors"; + BuildResultFlags2[BuildResultFlags2["EmitErrors"] = 64] = "EmitErrors"; + BuildResultFlags2[BuildResultFlags2["AnyErrors"] = 124] = "AnyErrors"; + })(BuildResultFlags || (BuildResultFlags = {})); + function getOrCreateValueFromConfigFileMap(configFileMap, resolved, createT) { + var existingValue = configFileMap.get(resolved); + var newValue; + if (!existingValue) { + newValue = createT(); + configFileMap.set(resolved, newValue); + } + return existingValue || newValue; + } + function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) { + return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function() { + return new ts6.Map(); + }); + } + function getCurrentTime(host) { + return host.now ? host.now() : /* @__PURE__ */ new Date(); + } + ts6.getCurrentTime = getCurrentTime; + function isCircularBuildOrder(buildOrder) { + return !!buildOrder && !!buildOrder.buildOrder; + } + ts6.isCircularBuildOrder = isCircularBuildOrder; + function getBuildOrderFromAnyBuildOrder(anyBuildOrder) { + return isCircularBuildOrder(anyBuildOrder) ? anyBuildOrder.buildOrder : anyBuildOrder; + } + ts6.getBuildOrderFromAnyBuildOrder = getBuildOrderFromAnyBuildOrder; + function createBuilderStatusReporter(system, pretty) { + return function(diagnostic) { + var output = pretty ? "[".concat(ts6.formatColorAndReset(ts6.getLocaleTimeString(system), ts6.ForegroundColorEscapeSequences.Grey), "] ") : "".concat(ts6.getLocaleTimeString(system), " - "); + output += "".concat(ts6.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)).concat(system.newLine + system.newLine); + system.write(output); + }; + } + ts6.createBuilderStatusReporter = createBuilderStatusReporter; + function createSolutionBuilderHostBase(system, createProgram2, reportDiagnostic, reportSolutionBuilderStatus) { + var host = ts6.createProgramHost(system, createProgram2); + host.getModifiedTime = system.getModifiedTime ? function(path) { + return system.getModifiedTime(path); + } : ts6.returnUndefined; + host.setModifiedTime = system.setModifiedTime ? function(path, date) { + return system.setModifiedTime(path, date); + } : ts6.noop; + host.deleteFile = system.deleteFile ? function(path) { + return system.deleteFile(path); + } : ts6.noop; + host.reportDiagnostic = reportDiagnostic || ts6.createDiagnosticReporter(system); + host.reportSolutionBuilderStatus = reportSolutionBuilderStatus || createBuilderStatusReporter(system); + host.now = ts6.maybeBind(system, system.now); + return host; + } + function createSolutionBuilderHost(system, createProgram2, reportDiagnostic, reportSolutionBuilderStatus, reportErrorSummary2) { + if (system === void 0) { + system = ts6.sys; + } + var host = createSolutionBuilderHostBase(system, createProgram2, reportDiagnostic, reportSolutionBuilderStatus); + host.reportErrorSummary = reportErrorSummary2; + return host; + } + ts6.createSolutionBuilderHost = createSolutionBuilderHost; + function createSolutionBuilderWithWatchHost(system, createProgram2, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus2) { + if (system === void 0) { + system = ts6.sys; + } + var host = createSolutionBuilderHostBase(system, createProgram2, reportDiagnostic, reportSolutionBuilderStatus); + var watchHost = ts6.createWatchHost(system, reportWatchStatus2); + ts6.copyProperties(host, watchHost); + return host; + } + ts6.createSolutionBuilderWithWatchHost = createSolutionBuilderWithWatchHost; + function getCompilerOptionsOfBuildOptions(buildOptions) { + var result = {}; + ts6.commonOptionsWithBuild.forEach(function(option) { + if (ts6.hasProperty(buildOptions, option.name)) + result[option.name] = buildOptions[option.name]; + }); + return result; + } + function createSolutionBuilder(host, rootNames, defaultOptions) { + return createSolutionBuilderWorker( + /*watch*/ + false, + host, + rootNames, + defaultOptions + ); + } + ts6.createSolutionBuilder = createSolutionBuilder; + function createSolutionBuilderWithWatch(host, rootNames, defaultOptions, baseWatchOptions) { + return createSolutionBuilderWorker( + /*watch*/ + true, + host, + rootNames, + defaultOptions, + baseWatchOptions + ); + } + ts6.createSolutionBuilderWithWatch = createSolutionBuilderWithWatch; + function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) { + var host = hostOrHostWithWatch; + var hostWithWatch = hostOrHostWithWatch; + var currentDirectory = host.getCurrentDirectory(); + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + var baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); + var compilerHost = ts6.createCompilerHostFromProgramHost(host, function() { + return state.projectCompilerOptions; + }); + ts6.setGetSourceFileAsHashVersioned(compilerHost); + compilerHost.getParsedCommandLine = function(fileName) { + return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); + }; + compilerHost.resolveModuleNames = ts6.maybeBind(host, host.resolveModuleNames); + compilerHost.resolveTypeReferenceDirectives = ts6.maybeBind(host, host.resolveTypeReferenceDirectives); + compilerHost.getModuleResolutionCache = ts6.maybeBind(host, host.getModuleResolutionCache); + var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts6.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : void 0; + var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts6.createTypeReferenceDirectiveResolutionCache( + currentDirectory, + getCanonicalFileName, + /*options*/ + void 0, + moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache() + ) : void 0; + if (!compilerHost.resolveModuleNames) { + var loader_3 = function(moduleName, resolverMode, containingFile, redirectedReference) { + return ts6.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; + }; + compilerHost.resolveModuleNames = function(moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) { + return ts6.loadWithModeAwareCache(ts6.Debug.checkEachDefined(moduleNames), ts6.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3); + }; + compilerHost.getModuleResolutionCache = function() { + return moduleResolutionCache; + }; + } + if (!compilerHost.resolveTypeReferenceDirectives) { + var loader_4 = function(moduleName, containingFile, redirectedReference, containingFileMode) { + return ts6.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; + }; + compilerHost.resolveTypeReferenceDirectives = function(typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { + return ts6.loadWithTypeDirectiveCache(ts6.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4); + }; + } + compilerHost.getBuildInfo = function(fileName, configFilePath) { + return getBuildInfo( + state, + fileName, + toResolvedConfigFilePath(state, configFilePath), + /*modifiedTime*/ + void 0 + ); + }; + var _a = ts6.createWatchFactory(hostWithWatch, options), watchFile2 = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog; + var state = { + host, + hostWithWatch, + currentDirectory, + getCanonicalFileName, + parseConfigFileHost: ts6.parseConfigHostFromCompilerHostLike(host), + write: ts6.maybeBind(host, host.trace), + // State of solution + options, + baseCompilerOptions, + rootNames, + baseWatchOptions, + resolvedConfigFilePaths: new ts6.Map(), + configFileCache: new ts6.Map(), + projectStatus: new ts6.Map(), + extendedConfigCache: new ts6.Map(), + buildInfoCache: new ts6.Map(), + outputTimeStamps: new ts6.Map(), + builderPrograms: new ts6.Map(), + diagnostics: new ts6.Map(), + projectPendingBuild: new ts6.Map(), + projectErrorsReported: new ts6.Map(), + compilerHost, + moduleResolutionCache, + typeReferenceDirectiveResolutionCache, + // Mutable state + buildOrder: void 0, + readFileWithCache: function(f) { + return host.readFile(f); + }, + projectCompilerOptions: baseCompilerOptions, + cache: void 0, + allProjectBuildPending: true, + needsSummary: true, + watchAllProjectsPending: watch, + // Watch state + watch, + allWatchedWildcardDirectories: new ts6.Map(), + allWatchedInputFiles: new ts6.Map(), + allWatchedConfigFiles: new ts6.Map(), + allWatchedExtendedConfigFiles: new ts6.Map(), + allWatchedPackageJsonFiles: new ts6.Map(), + filesWatched: new ts6.Map(), + lastCachedPackageJsonLookups: new ts6.Map(), + timerToBuildInvalidatedProject: void 0, + reportFileChangeDetected: false, + watchFile: watchFile2, + watchDirectory, + writeLog + }; + return state; + } + function toPath(state, fileName) { + return ts6.toPath(fileName, state.currentDirectory, state.getCanonicalFileName); + } + function toResolvedConfigFilePath(state, fileName) { + var resolvedConfigFilePaths = state.resolvedConfigFilePaths; + var path = resolvedConfigFilePaths.get(fileName); + if (path !== void 0) + return path; + var resolvedPath = toPath(state, fileName); + resolvedConfigFilePaths.set(fileName, resolvedPath); + return resolvedPath; + } + function isParsedCommandLine(entry) { + return !!entry.options; + } + function getCachedParsedConfigFile(state, configFilePath) { + var value = state.configFileCache.get(configFilePath); + return value && isParsedCommandLine(value) ? value : void 0; + } + function parseConfigFile(state, configFileName, configFilePath) { + var configFileCache = state.configFileCache; + var value = configFileCache.get(configFilePath); + if (value) { + return isParsedCommandLine(value) ? value : void 0; + } + ts6.performance.mark("SolutionBuilder::beforeConfigFileParsing"); + var diagnostic; + var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; + var parsed; + if (host.getParsedCommandLine) { + parsed = host.getParsedCommandLine(configFileName); + if (!parsed) + diagnostic = ts6.createCompilerDiagnostic(ts6.Diagnostics.File_0_not_found, configFileName); + } else { + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function(d) { + return diagnostic = d; + }; + parsed = ts6.getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache, baseWatchOptions); + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts6.noop; + } + configFileCache.set(configFilePath, parsed || diagnostic); + ts6.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts6.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); + return parsed; + } + function resolveProjectName(state, name) { + return ts6.resolveConfigFileProjectName(ts6.resolvePath(state.currentDirectory, name)); + } + function createBuildOrder(state, roots) { + var temporaryMarks = new ts6.Map(); + var permanentMarks = new ts6.Map(); + var circularityReportStack = []; + var buildOrder; + var circularDiagnostics; + for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) { + var root = roots_1[_i]; + visit(root); + } + return circularDiagnostics ? { buildOrder: buildOrder || ts6.emptyArray, circularDiagnostics } : buildOrder || ts6.emptyArray; + function visit(configFileName, inCircularContext) { + var projPath = toResolvedConfigFilePath(state, configFileName); + if (permanentMarks.has(projPath)) + return; + if (temporaryMarks.has(projPath)) { + if (!inCircularContext) { + (circularDiagnostics || (circularDiagnostics = [])).push(ts6.createCompilerDiagnostic(ts6.Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n"))); + } + return; + } + temporaryMarks.set(projPath, true); + circularityReportStack.push(configFileName); + var parsed = parseConfigFile(state, configFileName, projPath); + if (parsed && parsed.projectReferences) { + for (var _i2 = 0, _a = parsed.projectReferences; _i2 < _a.length; _i2++) { + var ref = _a[_i2]; + var resolvedRefPath = resolveProjectName(state, ref.path); + visit(resolvedRefPath, inCircularContext || ref.circular); + } + } + circularityReportStack.pop(); + permanentMarks.set(projPath, true); + (buildOrder || (buildOrder = [])).push(configFileName); + } + } + function getBuildOrder(state) { + return state.buildOrder || createStateBuildOrder(state); + } + function createStateBuildOrder(state) { + var buildOrder = createBuildOrder(state, state.rootNames.map(function(f) { + return resolveProjectName(state, f); + })); + state.resolvedConfigFilePaths.clear(); + var currentProjects = new ts6.Map(getBuildOrderFromAnyBuildOrder(buildOrder).map(function(resolved) { + return [toResolvedConfigFilePath(state, resolved), true]; + })); + var noopOnDelete = { onDeleteValue: ts6.noop }; + ts6.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete); + ts6.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete); + if (state.watch) { + ts6.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts6.closeFileWatcher }); + state.allWatchedExtendedConfigFiles.forEach(function(watcher) { + watcher.projects.forEach(function(project) { + if (!currentProjects.has(project)) { + watcher.projects.delete(project); + } + }); + watcher.close(); + }); + ts6.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function(existingMap) { + return existingMap.forEach(ts6.closeFileWatcherOf); + } }); + ts6.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function(existingMap) { + return existingMap.forEach(ts6.closeFileWatcher); + } }); + ts6.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function(existingMap) { + return existingMap.forEach(ts6.closeFileWatcher); + } }); + } + return state.buildOrder = buildOrder; + } + function getBuildOrderFor(state, project, onlyReferences) { + var resolvedProject = project && resolveProjectName(state, project); + var buildOrderFromState = getBuildOrder(state); + if (isCircularBuildOrder(buildOrderFromState)) + return buildOrderFromState; + if (resolvedProject) { + var projectPath_1 = toResolvedConfigFilePath(state, resolvedProject); + var projectIndex = ts6.findIndex(buildOrderFromState, function(configFileName) { + return toResolvedConfigFilePath(state, configFileName) === projectPath_1; + }); + if (projectIndex === -1) + return void 0; + } + var buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) : buildOrderFromState; + ts6.Debug.assert(!isCircularBuildOrder(buildOrder)); + ts6.Debug.assert(!onlyReferences || resolvedProject !== void 0); + ts6.Debug.assert(!onlyReferences || buildOrder[buildOrder.length - 1] === resolvedProject); + return onlyReferences ? buildOrder.slice(0, buildOrder.length - 1) : buildOrder; + } + function enableCache(state) { + if (state.cache) { + disableCache(state); + } + var compilerHost = state.compilerHost, host = state.host; + var originalReadFileWithCache = state.readFileWithCache; + var originalGetSourceFile = compilerHost.getSourceFile; + var _a = ts6.changeCompilerHostLikeToUseCache(host, function(fileName) { + return toPath(state, fileName); + }, function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false)); + }), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, readFileWithCache = _a.readFileWithCache; + state.readFileWithCache = readFileWithCache; + compilerHost.getSourceFile = getSourceFileWithCache; + state.cache = { + originalReadFile, + originalFileExists, + originalDirectoryExists, + originalCreateDirectory, + originalWriteFile, + originalReadFileWithCache, + originalGetSourceFile + }; + } + function disableCache(state) { + if (!state.cache) + return; + var cache = state.cache, host = state.host, compilerHost = state.compilerHost, extendedConfigCache = state.extendedConfigCache, moduleResolutionCache = state.moduleResolutionCache, typeReferenceDirectiveResolutionCache = state.typeReferenceDirectiveResolutionCache; + host.readFile = cache.originalReadFile; + host.fileExists = cache.originalFileExists; + host.directoryExists = cache.originalDirectoryExists; + host.createDirectory = cache.originalCreateDirectory; + host.writeFile = cache.originalWriteFile; + compilerHost.getSourceFile = cache.originalGetSourceFile; + state.readFileWithCache = cache.originalReadFileWithCache; + extendedConfigCache.clear(); + moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.clear(); + typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.clear(); + state.cache = void 0; + } + function clearProjectStatus(state, resolved) { + state.projectStatus.delete(resolved); + state.diagnostics.delete(resolved); + } + function addProjToQueue(_a, proj, reloadLevel) { + var projectPendingBuild = _a.projectPendingBuild; + var value = projectPendingBuild.get(proj); + if (value === void 0) { + projectPendingBuild.set(proj, reloadLevel); + } else if (value < reloadLevel) { + projectPendingBuild.set(proj, reloadLevel); + } + } + function setupInitialBuild(state, cancellationToken) { + if (!state.allProjectBuildPending) + return; + state.allProjectBuildPending = false; + if (state.options.watch) + reportWatchStatus(state, ts6.Diagnostics.Starting_compilation_in_watch_mode); + enableCache(state); + var buildOrder = getBuildOrderFromAnyBuildOrder(getBuildOrder(state)); + buildOrder.forEach(function(configFileName) { + return state.projectPendingBuild.set(toResolvedConfigFilePath(state, configFileName), ts6.ConfigFileProgramReloadLevel.None); + }); + if (cancellationToken) { + cancellationToken.throwIfCancellationRequested(); + } + } + var InvalidatedProjectKind; + (function(InvalidatedProjectKind2) { + InvalidatedProjectKind2[InvalidatedProjectKind2["Build"] = 0] = "Build"; + InvalidatedProjectKind2[InvalidatedProjectKind2["UpdateBundle"] = 1] = "UpdateBundle"; + InvalidatedProjectKind2[InvalidatedProjectKind2["UpdateOutputFileStamps"] = 2] = "UpdateOutputFileStamps"; + })(InvalidatedProjectKind = ts6.InvalidatedProjectKind || (ts6.InvalidatedProjectKind = {})); + function doneInvalidatedProject(state, projectPath) { + state.projectPendingBuild.delete(projectPath); + return state.diagnostics.has(projectPath) ? ts6.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts6.ExitStatus.Success; + } + function createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder) { + var updateOutputFileStampsPending = true; + return { + kind: InvalidatedProjectKind.UpdateOutputFileStamps, + project, + projectPath, + buildOrder, + getCompilerOptions: function() { + return config.options; + }, + getCurrentDirectory: function() { + return state.currentDirectory; + }, + updateOutputFileStatmps: function() { + updateOutputTimestamps(state, config, projectPath); + updateOutputFileStampsPending = false; + }, + done: function() { + if (updateOutputFileStampsPending) { + updateOutputTimestamps(state, config, projectPath); + } + ts6.performance.mark("SolutionBuilder::Timestamps only updates"); + return doneInvalidatedProject(state, projectPath); + } + }; + } + var BuildStep; + (function(BuildStep2) { + BuildStep2[BuildStep2["CreateProgram"] = 0] = "CreateProgram"; + BuildStep2[BuildStep2["SyntaxDiagnostics"] = 1] = "SyntaxDiagnostics"; + BuildStep2[BuildStep2["SemanticDiagnostics"] = 2] = "SemanticDiagnostics"; + BuildStep2[BuildStep2["Emit"] = 3] = "Emit"; + BuildStep2[BuildStep2["EmitBundle"] = 4] = "EmitBundle"; + BuildStep2[BuildStep2["EmitBuildInfo"] = 5] = "EmitBuildInfo"; + BuildStep2[BuildStep2["BuildInvalidatedProjectOfBundle"] = 6] = "BuildInvalidatedProjectOfBundle"; + BuildStep2[BuildStep2["QueueReferencingProjects"] = 7] = "QueueReferencingProjects"; + BuildStep2[BuildStep2["Done"] = 8] = "Done"; + })(BuildStep || (BuildStep = {})); + function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath, projectIndex, config, buildOrder) { + var step = kind === InvalidatedProjectKind.Build ? BuildStep.CreateProgram : BuildStep.EmitBundle; + var program; + var buildResult; + var invalidatedProjectOfBundle; + return kind === InvalidatedProjectKind.Build ? { + kind, + project, + projectPath, + buildOrder, + getCompilerOptions: function() { + return config.options; + }, + getCurrentDirectory: function() { + return state.currentDirectory; + }, + getBuilderProgram: function() { + return withProgramOrUndefined(ts6.identity); + }, + getProgram: function() { + return withProgramOrUndefined(function(program2) { + return program2.getProgramOrUndefined(); + }); + }, + getSourceFile: function(fileName) { + return withProgramOrUndefined(function(program2) { + return program2.getSourceFile(fileName); + }); + }, + getSourceFiles: function() { + return withProgramOrEmptyArray(function(program2) { + return program2.getSourceFiles(); + }); + }, + getOptionsDiagnostics: function(cancellationToken) { + return withProgramOrEmptyArray(function(program2) { + return program2.getOptionsDiagnostics(cancellationToken); + }); + }, + getGlobalDiagnostics: function(cancellationToken) { + return withProgramOrEmptyArray(function(program2) { + return program2.getGlobalDiagnostics(cancellationToken); + }); + }, + getConfigFileParsingDiagnostics: function() { + return withProgramOrEmptyArray(function(program2) { + return program2.getConfigFileParsingDiagnostics(); + }); + }, + getSyntacticDiagnostics: function(sourceFile, cancellationToken) { + return withProgramOrEmptyArray(function(program2) { + return program2.getSyntacticDiagnostics(sourceFile, cancellationToken); + }); + }, + getAllDependencies: function(sourceFile) { + return withProgramOrEmptyArray(function(program2) { + return program2.getAllDependencies(sourceFile); + }); + }, + getSemanticDiagnostics: function(sourceFile, cancellationToken) { + return withProgramOrEmptyArray(function(program2) { + return program2.getSemanticDiagnostics(sourceFile, cancellationToken); + }); + }, + getSemanticDiagnosticsOfNextAffectedFile: function(cancellationToken, ignoreSourceFile) { + return withProgramOrUndefined(function(program2) { + return program2.getSemanticDiagnosticsOfNextAffectedFile && program2.getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile); + }); + }, + emit: function(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) { + if (targetSourceFile || emitOnlyDtsFiles) { + return withProgramOrUndefined(function(program2) { + var _a, _b; + return program2.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project))); + }); + } + executeSteps(BuildStep.SemanticDiagnostics, cancellationToken); + if (step === BuildStep.EmitBuildInfo) { + return emitBuildInfo(writeFile, cancellationToken); + } + if (step !== BuildStep.Emit) + return void 0; + return emit(writeFile, cancellationToken, customTransformers); + }, + done + } : { + kind, + project, + projectPath, + buildOrder, + getCompilerOptions: function() { + return config.options; + }, + getCurrentDirectory: function() { + return state.currentDirectory; + }, + emit: function(writeFile, customTransformers) { + if (step !== BuildStep.EmitBundle) + return invalidatedProjectOfBundle; + return emitBundle(writeFile, customTransformers); + }, + done + }; + function done(cancellationToken, writeFile, customTransformers) { + executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts6.performance.mark("SolutionBuilder::Projects built"); + else + ts6.performance.mark("SolutionBuilder::Bundles updated"); + return doneInvalidatedProject(state, projectPath); + } + function withProgramOrUndefined(action) { + executeSteps(BuildStep.CreateProgram); + return program && action(program); + } + function withProgramOrEmptyArray(action) { + return withProgramOrUndefined(action) || ts6.emptyArray; + } + function createProgram2() { + var _a, _b; + ts6.Debug.assert(program === void 0); + if (state.options.dry) { + reportStatus(state, ts6.Diagnostics.A_non_dry_build_would_build_project_0, project); + buildResult = BuildResultFlags.Success; + step = BuildStep.QueueReferencingProjects; + return; + } + if (state.options.verbose) + reportStatus(state, ts6.Diagnostics.Building_project_0, project); + if (config.fileNames.length === 0) { + reportAndStoreErrors(state, projectPath, ts6.getConfigFileParsingDiagnostics(config)); + buildResult = BuildResultFlags.None; + step = BuildStep.QueueReferencingProjects; + return; + } + var host = state.host, compilerHost = state.compilerHost; + state.projectCompilerOptions = config.options; + (_a = state.moduleResolutionCache) === null || _a === void 0 ? void 0 : _a.update(config.options); + (_b = state.typeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.update(config.options); + program = host.createProgram(config.fileNames, config.options, compilerHost, getOldProgram(state, projectPath, config), ts6.getConfigFileParsingDiagnostics(config), config.projectReferences); + if (state.watch) { + state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts6.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function(_a2) { + var path = _a2[0], data = _a2[1]; + return [state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data]; + })); + state.builderPrograms.set(projectPath, program); + } + step++; + } + function handleDiagnostics(diagnostics, errorFlags, errorType) { + var _a; + if (diagnostics.length) { + _a = buildErrors(state, projectPath, program, config, diagnostics, errorFlags, errorType), buildResult = _a.buildResult, step = _a.step; + } else { + step++; + } + } + function getSyntaxDiagnostics(cancellationToken) { + ts6.Debug.assertIsDefined(program); + handleDiagnostics(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], program.getConfigFileParsingDiagnostics(), true), program.getOptionsDiagnostics(cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true), program.getSyntacticDiagnostics( + /*sourceFile*/ + void 0, + cancellationToken + ), true), BuildResultFlags.SyntaxErrors, "Syntactic"); + } + function getSemanticDiagnostics(cancellationToken) { + handleDiagnostics(ts6.Debug.checkDefined(program).getSemanticDiagnostics( + /*sourceFile*/ + void 0, + cancellationToken + ), BuildResultFlags.TypeErrors, "Semantic"); + } + function emit(writeFileCallback, cancellationToken, customTransformers) { + var _a; + var _b, _c, _d; + ts6.Debug.assertIsDefined(program); + ts6.Debug.assert(step === BuildStep.Emit); + var saved = program.saveEmitState(); + var declDiagnostics; + var reportDeclarationDiagnostics = function(d) { + return (declDiagnostics || (declDiagnostics = [])).push(d); + }; + var outputFiles = []; + var emitResult = ts6.emitFilesAndReportErrors( + program, + reportDeclarationDiagnostics, + /*write*/ + void 0, + /*reportSummary*/ + void 0, + function(name, text, writeByteOrderMark, _onError, _sourceFiles, data) { + return outputFiles.push({ name, text, writeByteOrderMark, buildInfo: data === null || data === void 0 ? void 0 : data.buildInfo }); + }, + cancellationToken, + /*emitOnlyDts*/ + false, + customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project)) + ).emitResult; + if (declDiagnostics) { + program.restoreEmitState(saved); + _a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step; + return { + emitSkipped: true, + diagnostics: emitResult.diagnostics + }; + } + var host = state.host, compilerHost = state.compilerHost; + var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged; + var emitterDiagnostics = ts6.createDiagnosticCollection(); + var emittedOutputs = new ts6.Map(); + var options = program.getCompilerOptions(); + var isIncremental = ts6.isIncrementalCompilation(options); + var outputTimeStampMap; + var now; + outputFiles.forEach(function(_a2) { + var name = _a2.name, text = _a2.text, writeByteOrderMark = _a2.writeByteOrderMark, buildInfo = _a2.buildInfo; + var path = toPath(state, name); + emittedOutputs.set(toPath(state, name), name); + if (buildInfo) + setBuildInfo(state, buildInfo, projectPath, options, resultFlags); + ts6.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); + if (!isIncremental && state.watch) { + (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host))); + } + }); + finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts6.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags); + return emitResult; + } + function emitBuildInfo(writeFileCallback, cancellationToken) { + ts6.Debug.assertIsDefined(program); + ts6.Debug.assert(step === BuildStep.EmitBuildInfo); + var emitResult = program.emitBuildInfo(function(name, text, writeByteOrderMark, onError, sourceFiles, data) { + if (data === null || data === void 0 ? void 0 : data.buildInfo) + setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged); + if (writeFileCallback) + writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data); + else + state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data); + }, cancellationToken); + if (emitResult.diagnostics.length) { + reportErrors(state, emitResult.diagnostics); + state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true)); + buildResult = BuildResultFlags.EmitErrors & buildResult; + } + if (emitResult.emittedFiles && state.write) { + emitResult.emittedFiles.forEach(function(name) { + return listEmittedFile(state, config, name); + }); + } + afterProgramDone(state, program, config); + step = BuildStep.QueueReferencingProjects; + return emitResult; + } + function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) { + var _a; + var emitDiagnostics = emitterDiagnostics.getDiagnostics(); + if (emitDiagnostics.length) { + _a = buildErrors(state, projectPath, program, config, emitDiagnostics, BuildResultFlags.EmitErrors, "Emit"), buildResult = _a.buildResult, step = _a.step; + return emitDiagnostics; + } + if (state.write) { + emittedOutputs.forEach(function(name) { + return listEmittedFile(state, config, name); + }); + } + updateOutputTimestampsWorker(state, config, projectPath, ts6.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); + state.diagnostics.delete(projectPath); + state.projectStatus.set(projectPath, { + type: ts6.UpToDateStatusType.UpToDate, + oldestOutputFileName + }); + afterProgramDone(state, program, config); + step = BuildStep.QueueReferencingProjects; + buildResult = resultFlags; + return emitDiagnostics; + } + function emitBundle(writeFileCallback, customTransformers) { + var _a, _b; + ts6.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle); + if (state.options.dry) { + reportStatus(state, ts6.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project); + buildResult = BuildResultFlags.Success; + step = BuildStep.QueueReferencingProjects; + return void 0; + } + if (state.options.verbose) + reportStatus(state, ts6.Diagnostics.Updating_output_of_project_0, project); + var compilerHost = state.compilerHost; + state.projectCompilerOptions = config.options; + var outputFiles = ts6.emitUsingBuildInfo(config, compilerHost, function(ref) { + var refName = resolveProjectName(state, ref.path); + return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName)); + }, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project))); + if (ts6.isString(outputFiles)) { + reportStatus(state, ts6.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles)); + step = BuildStep.BuildInvalidatedProjectOfBundle; + return invalidatedProjectOfBundle = createBuildOrUpdateInvalidedProject(InvalidatedProjectKind.Build, state, project, projectPath, projectIndex, config, buildOrder); + } + ts6.Debug.assert(!!outputFiles.length); + var emitterDiagnostics = ts6.createDiagnosticCollection(); + var emittedOutputs = new ts6.Map(); + var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || void 0; + outputFiles.forEach(function(_a2) { + var _b2, _c; + var name = _a2.name, text = _a2.text, writeByteOrderMark = _a2.writeByteOrderMark, buildInfo = _a2.buildInfo; + emittedOutputs.set(toPath(state, name), name); + if (buildInfo) { + if (((_b2 = buildInfo.program) === null || _b2 === void 0 ? void 0 : _b2.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; + } + setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); + } + ts6.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); + }); + var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags); + return { emitSkipped: false, diagnostics: emitDiagnostics }; + } + function executeSteps(till, cancellationToken, writeFile, customTransformers) { + while (step <= till && step < BuildStep.Done) { + var currentStep = step; + switch (step) { + case BuildStep.CreateProgram: + createProgram2(); + break; + case BuildStep.SyntaxDiagnostics: + getSyntaxDiagnostics(cancellationToken); + break; + case BuildStep.SemanticDiagnostics: + getSemanticDiagnostics(cancellationToken); + break; + case BuildStep.Emit: + emit(writeFile, cancellationToken, customTransformers); + break; + case BuildStep.EmitBuildInfo: + emitBuildInfo(writeFile, cancellationToken); + break; + case BuildStep.EmitBundle: + emitBundle(writeFile, customTransformers); + break; + case BuildStep.BuildInvalidatedProjectOfBundle: + ts6.Debug.checkDefined(invalidatedProjectOfBundle).done(cancellationToken, writeFile, customTransformers); + step = BuildStep.Done; + break; + case BuildStep.QueueReferencingProjects: + queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, ts6.Debug.checkDefined(buildResult)); + step++; + break; + case BuildStep.Done: + default: + ts6.assertType(step); + } + ts6.Debug.assert(step > currentStep); + } + } + } + function needsBuild(_a, status, config) { + var options = _a.options; + if (status.type !== ts6.UpToDateStatusType.OutOfDateWithPrepend || options.force) + return true; + return config.fileNames.length === 0 || !!ts6.getConfigFileParsingDiagnostics(config).length || !ts6.isIncrementalCompilation(config.options); + } + function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) { + if (!state.projectPendingBuild.size) + return void 0; + if (isCircularBuildOrder(buildOrder)) + return void 0; + var options = state.options, projectPendingBuild = state.projectPendingBuild; + for (var projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) { + var project = buildOrder[projectIndex]; + var projectPath = toResolvedConfigFilePath(state, project); + var reloadLevel = state.projectPendingBuild.get(projectPath); + if (reloadLevel === void 0) + continue; + if (reportQueue) { + reportQueue = false; + reportBuildQueue(state, buildOrder); + } + var config = parseConfigFile(state, project, projectPath); + if (!config) { + reportParseConfigFileDiagnostic(state, projectPath); + projectPendingBuild.delete(projectPath); + continue; + } + if (reloadLevel === ts6.ConfigFileProgramReloadLevel.Full) { + watchConfigFile(state, project, projectPath, config); + watchExtendedConfigFiles(state, projectPath, config); + watchWildCardDirectories(state, project, projectPath, config); + watchInputFiles(state, project, projectPath, config); + watchPackageJsonFiles(state, project, projectPath, config); + } else if (reloadLevel === ts6.ConfigFileProgramReloadLevel.Partial) { + config.fileNames = ts6.getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, ts6.getDirectoryPath(project), config.options, state.parseConfigFileHost); + ts6.updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, ts6.canJsonReportNoInputFiles(config.raw)); + watchInputFiles(state, project, projectPath, config); + watchPackageJsonFiles(state, project, projectPath, config); + } + var status = getUpToDateStatus(state, config, projectPath); + if (!options.force) { + if (status.type === ts6.UpToDateStatusType.UpToDate) { + verboseReportProjectStatus(state, project, status); + reportAndStoreErrors(state, projectPath, ts6.getConfigFileParsingDiagnostics(config)); + projectPendingBuild.delete(projectPath); + if (options.dry) { + reportStatus(state, ts6.Diagnostics.Project_0_is_up_to_date, project); + } + continue; + } + if (status.type === ts6.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts6.UpToDateStatusType.UpToDateWithInputFileText) { + reportAndStoreErrors(state, projectPath, ts6.getConfigFileParsingDiagnostics(config)); + return { + kind: InvalidatedProjectKind.UpdateOutputFileStamps, + status, + project, + projectPath, + projectIndex, + config + }; + } + } + if (status.type === ts6.UpToDateStatusType.UpstreamBlocked) { + verboseReportProjectStatus(state, project, status); + reportAndStoreErrors(state, projectPath, ts6.getConfigFileParsingDiagnostics(config)); + projectPendingBuild.delete(projectPath); + if (options.verbose) { + reportStatus(state, status.upstreamProjectBlocked ? ts6.Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built : ts6.Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); + } + continue; + } + if (status.type === ts6.UpToDateStatusType.ContainerOnly) { + verboseReportProjectStatus(state, project, status); + reportAndStoreErrors(state, projectPath, ts6.getConfigFileParsingDiagnostics(config)); + projectPendingBuild.delete(projectPath); + continue; + } + return { + kind: needsBuild(state, status, config) ? InvalidatedProjectKind.Build : InvalidatedProjectKind.UpdateBundle, + status, + project, + projectPath, + projectIndex, + config + }; + } + return void 0; + } + function createInvalidatedProjectWithInfo(state, info, buildOrder) { + verboseReportProjectStatus(state, info.project, info.status); + return info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps ? createBuildOrUpdateInvalidedProject(info.kind, state, info.project, info.projectPath, info.projectIndex, info.config, buildOrder) : createUpdateOutputFileStampsProject(state, info.project, info.projectPath, info.config, buildOrder); + } + function getNextInvalidatedProject(state, buildOrder, reportQueue) { + var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue); + if (!info) + return info; + return createInvalidatedProjectWithInfo(state, info, buildOrder); + } + function listEmittedFile(_a, proj, file) { + var write = _a.write; + if (write && proj.options.listEmittedFiles) { + write("TSFILE: ".concat(file)); + } + } + function getOldProgram(_a, proj, parsed) { + var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost; + if (options.force) + return void 0; + var value = builderPrograms.get(proj); + if (value) + return value; + return ts6.readBuilderProgram(parsed.options, compilerHost); + } + function afterProgramDone(state, program, config) { + if (program) { + if (state.write) + ts6.listFiles(program, state.write); + if (state.host.afterProgramEmitAndDiagnostics) { + state.host.afterProgramEmitAndDiagnostics(program); + } + program.releaseProgram(); + } else if (state.host.afterEmitBundle) { + state.host.afterEmitBundle(config); + } + state.projectCompilerOptions = state.baseCompilerOptions; + } + function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) { + var canEmitBuildInfo = program && !ts6.outFile(program.getCompilerOptions()); + reportAndStoreErrors(state, resolvedPath, diagnostics); + state.projectStatus.set(resolvedPath, { type: ts6.UpToDateStatusType.Unbuildable, reason: "".concat(errorType, " errors") }); + if (canEmitBuildInfo) + return { buildResult, step: BuildStep.EmitBuildInfo }; + afterProgramDone(state, program, config); + return { buildResult, step: BuildStep.QueueReferencingProjects }; + } + function isFileWatcherWithModifiedTime(value) { + return !!value.watcher; + } + function getModifiedTime(state, fileName) { + var path = toPath(state, fileName); + var existing = state.filesWatched.get(path); + if (state.watch && !!existing) { + if (!isFileWatcherWithModifiedTime(existing)) + return existing; + if (existing.modifiedTime) + return existing.modifiedTime; + } + var result = ts6.getModifiedTime(state.host, fileName); + if (state.watch) { + if (existing) + existing.modifiedTime = result; + else + state.filesWatched.set(path, result); + } + return result; + } + function watchFile(state, file, callback, pollingInterval, options, watchType, project) { + var path = toPath(state, file); + var existing = state.filesWatched.get(path); + if (existing && isFileWatcherWithModifiedTime(existing)) { + existing.callbacks.push(callback); + } else { + var watcher = state.watchFile(file, function(fileName, eventKind, modifiedTime) { + var existing2 = ts6.Debug.checkDefined(state.filesWatched.get(path)); + ts6.Debug.assert(isFileWatcherWithModifiedTime(existing2)); + existing2.modifiedTime = modifiedTime; + existing2.callbacks.forEach(function(cb) { + return cb(fileName, eventKind, modifiedTime); + }); + }, pollingInterval, options, watchType, project); + state.filesWatched.set(path, { callbacks: [callback], watcher, modifiedTime: existing }); + } + return { + close: function() { + var existing2 = ts6.Debug.checkDefined(state.filesWatched.get(path)); + ts6.Debug.assert(isFileWatcherWithModifiedTime(existing2)); + if (existing2.callbacks.length === 1) { + state.filesWatched.delete(path); + ts6.closeFileWatcherOf(existing2); + } else { + ts6.unorderedRemoveItem(existing2.callbacks, callback); + } + } + }; + } + function getOutputTimeStampMap(state, resolvedConfigFilePath) { + if (!state.watch) + return void 0; + var result = state.outputTimeStamps.get(resolvedConfigFilePath); + if (!result) + state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts6.Map()); + return result; + } + function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) { + var buildInfoPath = ts6.getTsBuildInfoEmitOutputFilePath(options); + var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath); + var modifiedTime = getCurrentTime(state.host); + if (existing) { + existing.buildInfo = buildInfo; + existing.modifiedTime = modifiedTime; + if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged)) + existing.latestChangedDtsTime = modifiedTime; + } else { + state.buildInfoCache.set(resolvedConfigPath, { + path: toPath(state, buildInfoPath), + buildInfo, + modifiedTime, + latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? void 0 : modifiedTime + }); + } + } + function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) { + var path = toPath(state, buildInfoPath); + var existing = state.buildInfoCache.get(resolvedConfigPath); + return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : void 0; + } + function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) { + var path = toPath(state, buildInfoPath); + var existing = state.buildInfoCache.get(resolvedConfigPath); + if (existing !== void 0 && existing.path === path) { + return existing.buildInfo || void 0; + } + var value = state.readFileWithCache(buildInfoPath); + var buildInfo = value ? ts6.getBuildInfo(buildInfoPath, value) : void 0; + state.buildInfoCache.set(resolvedConfigPath, { path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts6.missingFileModifiedTime }); + return buildInfo; + } + function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) { + var tsconfigTime = getModifiedTime(state, configFile); + if (oldestOutputFileTime < tsconfigTime) { + return { + type: ts6.UpToDateStatusType.OutOfDateWithSelf, + outOfDateOutputFileName: oldestOutputFileName, + newerInputFileName: configFile + }; + } + } + function getUpToDateStatusWorker(state, project, resolvedPath) { + var _a, _b; + if (!project.fileNames.length && !ts6.canJsonReportNoInputFiles(project.raw)) { + return { + type: ts6.UpToDateStatusType.ContainerOnly + }; + } + var referenceStatuses; + var force = !!state.options.force; + if (project.projectReferences) { + state.projectStatus.set(resolvedPath, { type: ts6.UpToDateStatusType.ComputingUpstream }); + for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) { + var ref = _c[_i]; + var resolvedRef = ts6.resolveProjectReferencePath(ref); + var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef); + var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath); + var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath); + if (refStatus.type === ts6.UpToDateStatusType.ComputingUpstream || refStatus.type === ts6.UpToDateStatusType.ContainerOnly) { + continue; + } + if (refStatus.type === ts6.UpToDateStatusType.Unbuildable || refStatus.type === ts6.UpToDateStatusType.UpstreamBlocked) { + return { + type: ts6.UpToDateStatusType.UpstreamBlocked, + upstreamProjectName: ref.path, + upstreamProjectBlocked: refStatus.type === ts6.UpToDateStatusType.UpstreamBlocked + }; + } + if (refStatus.type !== ts6.UpToDateStatusType.UpToDate) { + return { + type: ts6.UpToDateStatusType.UpstreamOutOfDate, + upstreamProjectName: ref.path + }; + } + if (!force) + (referenceStatuses || (referenceStatuses = [])).push({ ref, refStatus, resolvedRefPath, resolvedConfig }); + } + } + if (force) + return { type: ts6.UpToDateStatusType.ForceBuild }; + var host = state.host; + var buildInfoPath = ts6.getTsBuildInfoEmitOutputFilePath(project.options); + var oldestOutputFileName; + var oldestOutputFileTime = maximumDate; + var buildInfoTime; + var buildInfoProgram; + var buildInfoVersionMap; + if (buildInfoPath) { + var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath); + buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts6.getModifiedTime(host, buildInfoPath); + if (buildInfoTime === ts6.missingFileModifiedTime) { + if (!buildInfoCacheEntry_1) { + state.buildInfoCache.set(resolvedPath, { + path: toPath(state, buildInfoPath), + buildInfo: false, + modifiedTime: buildInfoTime + }); + } + return { + type: ts6.UpToDateStatusType.OutputMissing, + missingOutputFileName: buildInfoPath + }; + } + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + return { + type: ts6.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } + if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts6.version) { + return { + type: ts6.UpToDateStatusType.TsVersionOutputOfDate, + version: buildInfo.version + }; + } + if (buildInfo.program) { + if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : ts6.some(buildInfo.program.semanticDiagnosticsPerFile, ts6.isArray))) { + return { + type: ts6.UpToDateStatusType.OutOfDateBuildInfo, + buildInfoFile: buildInfoPath + }; + } + buildInfoProgram = buildInfo.program; + } + oldestOutputFileTime = buildInfoTime; + oldestOutputFileName = buildInfoPath; + } + var newestInputFileName = void 0; + var newestInputFileTime = minimumDate; + var pseudoInputUpToDate = false; + for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) { + var inputFile = _e[_d]; + var inputTime = getModifiedTime(state, inputFile); + if (inputTime === ts6.missingFileModifiedTime) { + return { + type: ts6.UpToDateStatusType.Unbuildable, + reason: "".concat(inputFile, " does not exist") + }; + } + if (buildInfoTime && buildInfoTime < inputTime) { + var version_3 = void 0; + var currentVersion = void 0; + if (buildInfoProgram) { + if (!buildInfoVersionMap) + buildInfoVersionMap = ts6.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host); + version_3 = buildInfoVersionMap.get(toPath(state, inputFile)); + var text = version_3 ? state.readFileWithCache(inputFile) : void 0; + currentVersion = text !== void 0 ? (host.createHash || ts6.generateDjb2Hash)(text) : void 0; + if (version_3 && version_3 === currentVersion) + pseudoInputUpToDate = true; + } + if (!version_3 || version_3 !== currentVersion) { + return { + type: ts6.UpToDateStatusType.OutOfDateWithSelf, + outOfDateOutputFileName: buildInfoPath, + newerInputFileName: inputFile + }; + } + } + if (inputTime > newestInputFileTime) { + newestInputFileName = inputFile; + newestInputFileTime = inputTime; + } + } + if (!buildInfoPath) { + var outputs = ts6.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames()); + var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath); + for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) { + var output = outputs_1[_f]; + var path = toPath(state, output); + var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path); + if (!outputTime) { + outputTime = ts6.getModifiedTime(state.host, output); + outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime); + } + if (outputTime === ts6.missingFileModifiedTime) { + return { + type: ts6.UpToDateStatusType.OutputMissing, + missingOutputFileName: output + }; + } + if (outputTime < newestInputFileTime) { + return { + type: ts6.UpToDateStatusType.OutOfDateWithSelf, + outOfDateOutputFileName: output, + newerInputFileName: newestInputFileName + }; + } + if (outputTime < oldestOutputFileTime) { + oldestOutputFileTime = outputTime; + oldestOutputFileName = output; + } + } + } + var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath); + var pseudoUpToDate = false; + var usesPrepend = false; + var upstreamChangedProject; + if (referenceStatuses) { + for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) { + var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath; + usesPrepend = usesPrepend || !!ref.prepend; + if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) { + continue; + } + if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) { + return { + type: ts6.UpToDateStatusType.OutOfDateWithUpstream, + outOfDateOutputFileName: buildInfoPath, + newerProjectName: ref.path + }; + } + var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath); + if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) { + pseudoUpToDate = true; + upstreamChangedProject = ref.path; + continue; + } + ts6.Debug.assert(oldestOutputFileName !== void 0, "Should have an oldest output filename here"); + return { + type: ts6.UpToDateStatusType.OutOfDateWithUpstream, + outOfDateOutputFileName: oldestOutputFileName, + newerProjectName: ref.path + }; + } + } + var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName); + if (configStatus) + return configStatus; + var extendedConfigStatus = ts6.forEach(project.options.configFile.extendedSourceFiles || ts6.emptyArray, function(configFile) { + return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); + }); + if (extendedConfigStatus) + return extendedConfigStatus; + var dependentPackageFileStatus = ts6.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts6.emptyArray, function(_a2) { + var path2 = _a2[0]; + return checkConfigFileUpToDateStatus(state, path2, oldestOutputFileTime, oldestOutputFileName); + }); + if (dependentPackageFileStatus) + return dependentPackageFileStatus; + if (usesPrepend && pseudoUpToDate) { + return { + type: ts6.UpToDateStatusType.OutOfDateWithPrepend, + outOfDateOutputFileName: oldestOutputFileName, + newerProjectName: upstreamChangedProject + }; + } + return { + type: pseudoUpToDate ? ts6.UpToDateStatusType.UpToDateWithUpstreamTypes : pseudoInputUpToDate ? ts6.UpToDateStatusType.UpToDateWithInputFileText : ts6.UpToDateStatusType.UpToDate, + newestInputFileTime, + newestInputFileName, + oldestOutputFileName + }; + } + function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) { + var refBuildInfo = state.buildInfoCache.get(resolvedRefPath); + return refBuildInfo.path === buildInfoCacheEntry.path; + } + function getUpToDateStatus(state, project, resolvedPath) { + if (project === void 0) { + return { type: ts6.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" }; + } + var prior = state.projectStatus.get(resolvedPath); + if (prior !== void 0) { + return prior; + } + ts6.performance.mark("SolutionBuilder::beforeUpToDateCheck"); + var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts6.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts6.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); + state.projectStatus.set(resolvedPath, actual); + return actual; + } + function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) { + if (proj.options.noEmit) + return; + var now; + var buildInfoPath = ts6.getTsBuildInfoEmitOutputFilePath(proj.options); + if (buildInfoPath) { + if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) { + if (!!state.options.verbose) + reportStatus(state, verboseMessage, proj.options.configFilePath); + state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host)); + getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now; + } + state.outputTimeStamps.delete(projectPath); + return; + } + var host = state.host; + var outputs = ts6.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); + var outputTimeStampMap = getOutputTimeStampMap(state, projectPath); + var modifiedOutputs = outputTimeStampMap ? new ts6.Set() : void 0; + if (!skipOutputs || outputs.length !== skipOutputs.size) { + var reportVerbose = !!state.options.verbose; + for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) { + var file = outputs_2[_i]; + var path = toPath(state, file); + if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path)) + continue; + if (reportVerbose) { + reportVerbose = false; + reportStatus(state, verboseMessage, proj.options.configFilePath); + } + host.setModifiedTime(file, now || (now = getCurrentTime(state.host))); + if (outputTimeStampMap) { + outputTimeStampMap.set(path, now); + modifiedOutputs.add(path); + } + } + } + outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function(_value, key) { + if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key)) + outputTimeStampMap.delete(key); + }); + } + function getLatestChangedDtsTime(state, options, resolvedConfigPath) { + if (!options.composite) + return void 0; + var entry = ts6.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath)); + if (entry.latestChangedDtsTime !== void 0) + return entry.latestChangedDtsTime || void 0; + var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ? state.host.getModifiedTime(ts6.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts6.getDirectoryPath(entry.path))) : void 0; + entry.latestChangedDtsTime = latestChangedDtsTime || false; + return latestChangedDtsTime; + } + function updateOutputTimestamps(state, proj, resolvedPath) { + if (state.options.dry) { + return reportStatus(state, ts6.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath); + } + updateOutputTimestampsWorker(state, proj, resolvedPath, ts6.Diagnostics.Updating_output_timestamps_of_project_0); + state.projectStatus.set(resolvedPath, { + type: ts6.UpToDateStatusType.UpToDate, + oldestOutputFileName: ts6.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames()) + }); + } + function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) { + if (buildResult & BuildResultFlags.AnyErrors) + return; + if (!config.options.composite) + return; + for (var index = projectIndex + 1; index < buildOrder.length; index++) { + var nextProject = buildOrder[index]; + var nextProjectPath = toResolvedConfigFilePath(state, nextProject); + if (state.projectPendingBuild.has(nextProjectPath)) + continue; + var nextProjectConfig = parseConfigFile(state, nextProject, nextProjectPath); + if (!nextProjectConfig || !nextProjectConfig.projectReferences) + continue; + for (var _i = 0, _a = nextProjectConfig.projectReferences; _i < _a.length; _i++) { + var ref = _a[_i]; + var resolvedRefPath = resolveProjectName(state, ref.path); + if (toResolvedConfigFilePath(state, resolvedRefPath) !== projectPath) + continue; + var status = state.projectStatus.get(nextProjectPath); + if (status) { + switch (status.type) { + case ts6.UpToDateStatusType.UpToDate: + if (buildResult & BuildResultFlags.DeclarationOutputUnchanged) { + if (ref.prepend) { + state.projectStatus.set(nextProjectPath, { + type: ts6.UpToDateStatusType.OutOfDateWithPrepend, + outOfDateOutputFileName: status.oldestOutputFileName, + newerProjectName: project + }); + } else { + status.type = ts6.UpToDateStatusType.UpToDateWithUpstreamTypes; + } + break; + } + case ts6.UpToDateStatusType.UpToDateWithInputFileText: + case ts6.UpToDateStatusType.UpToDateWithUpstreamTypes: + case ts6.UpToDateStatusType.OutOfDateWithPrepend: + if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) { + state.projectStatus.set(nextProjectPath, { + type: ts6.UpToDateStatusType.OutOfDateWithUpstream, + outOfDateOutputFileName: status.type === ts6.UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, + newerProjectName: project + }); + } + break; + case ts6.UpToDateStatusType.UpstreamBlocked: + if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) { + clearProjectStatus(state, nextProjectPath); + } + break; + } + } + addProjToQueue(state, nextProjectPath, ts6.ConfigFileProgramReloadLevel.None); + break; + } + } + } + function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts6.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts6.performance.mark("SolutionBuilder::afterBuild"); + ts6.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + var buildOrder = getBuildOrderFor(state, project, onlyReferences); + if (!buildOrder) + return ts6.ExitStatus.InvalidProject_OutputsSkipped; + setupInitialBuild(state, cancellationToken); + var reportQueue = true; + var successfulProjects = 0; + while (true) { + var invalidatedProject = getNextInvalidatedProject(state, buildOrder, reportQueue); + if (!invalidatedProject) + break; + reportQueue = false; + invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project)); + if (!state.diagnostics.has(invalidatedProject.projectPath)) + successfulProjects++; + } + disableCache(state); + reportErrorSummary(state, buildOrder); + startWatching(state, buildOrder); + return isCircularBuildOrder(buildOrder) ? ts6.ExitStatus.ProjectReferenceCycle_OutputsSkipped : !buildOrder.some(function(p) { + return state.diagnostics.has(toResolvedConfigFilePath(state, p)); + }) ? ts6.ExitStatus.Success : successfulProjects ? ts6.ExitStatus.DiagnosticsPresent_OutputsGenerated : ts6.ExitStatus.DiagnosticsPresent_OutputsSkipped; + } + function clean(state, project, onlyReferences) { + ts6.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts6.performance.mark("SolutionBuilder::afterClean"); + ts6.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { + var buildOrder = getBuildOrderFor(state, project, onlyReferences); + if (!buildOrder) + return ts6.ExitStatus.InvalidProject_OutputsSkipped; + if (isCircularBuildOrder(buildOrder)) { + reportErrors(state, buildOrder.circularDiagnostics); + return ts6.ExitStatus.ProjectReferenceCycle_OutputsSkipped; + } + var options = state.options, host = state.host; + var filesToDelete = options.dry ? [] : void 0; + for (var _i = 0, buildOrder_1 = buildOrder; _i < buildOrder_1.length; _i++) { + var proj = buildOrder_1[_i]; + var resolvedPath = toResolvedConfigFilePath(state, proj); + var parsed = parseConfigFile(state, proj, resolvedPath); + if (parsed === void 0) { + reportParseConfigFileDiagnostic(state, resolvedPath); + continue; + } + var outputs = ts6.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames()); + if (!outputs.length) + continue; + var inputFileNames = new ts6.Set(parsed.fileNames.map(function(f) { + return toPath(state, f); + })); + for (var _a = 0, outputs_3 = outputs; _a < outputs_3.length; _a++) { + var output = outputs_3[_a]; + if (inputFileNames.has(toPath(state, output))) + continue; + if (host.fileExists(output)) { + if (filesToDelete) { + filesToDelete.push(output); + } else { + host.deleteFile(output); + invalidateProject(state, resolvedPath, ts6.ConfigFileProgramReloadLevel.None); + } + } + } + } + if (filesToDelete) { + reportStatus(state, ts6.Diagnostics.A_non_dry_build_would_delete_the_following_files_Colon_0, filesToDelete.map(function(f) { + return "\r\n * ".concat(f); + }).join("")); + } + return ts6.ExitStatus.Success; + } + function invalidateProject(state, resolved, reloadLevel) { + if (state.host.getParsedCommandLine && reloadLevel === ts6.ConfigFileProgramReloadLevel.Partial) { + reloadLevel = ts6.ConfigFileProgramReloadLevel.Full; + } + if (reloadLevel === ts6.ConfigFileProgramReloadLevel.Full) { + state.configFileCache.delete(resolved); + state.buildOrder = void 0; + } + state.needsSummary = true; + clearProjectStatus(state, resolved); + addProjToQueue(state, resolved, reloadLevel); + enableCache(state); + } + function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) { + state.reportFileChangeDetected = true; + invalidateProject(state, resolvedPath, reloadLevel); + scheduleBuildInvalidatedProject( + state, + 250, + /*changeDetected*/ + true + ); + } + function scheduleBuildInvalidatedProject(state, time, changeDetected) { + var hostWithWatch = state.hostWithWatch; + if (!hostWithWatch.setTimeout || !hostWithWatch.clearTimeout) { + return; + } + if (state.timerToBuildInvalidatedProject) { + hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject); + } + state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); + } + function buildNextInvalidatedProject(state, changeDetected) { + ts6.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts6.performance.mark("SolutionBuilder::afterBuild"); + ts6.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { + state.timerToBuildInvalidatedProject = void 0; + if (state.reportFileChangeDetected) { + state.reportFileChangeDetected = false; + state.projectErrorsReported.clear(); + reportWatchStatus(state, ts6.Diagnostics.File_change_detected_Starting_incremental_compilation); + } + var projectsBuilt = 0; + var buildOrder = getBuildOrder(state); + var invalidatedProject = getNextInvalidatedProject( + state, + buildOrder, + /*reportQueue*/ + false + ); + if (invalidatedProject) { + invalidatedProject.done(); + projectsBuilt++; + while (state.projectPendingBuild.size) { + if (state.timerToBuildInvalidatedProject) + return; + var info = getNextInvalidatedProjectCreateInfo( + state, + buildOrder, + /*reportQueue*/ + false + ); + if (!info) + break; + if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps && (changeDetected || projectsBuilt === 5)) { + scheduleBuildInvalidatedProject( + state, + 100, + /*changeDetected*/ + false + ); + return; + } + var project = createInvalidatedProjectWithInfo(state, info, buildOrder); + project.done(); + if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps) + projectsBuilt++; + } + } + disableCache(state); + return buildOrder; + } + function watchConfigFile(state, resolved, resolvedPath, parsed) { + if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) + return; + state.allWatchedConfigFiles.set(resolvedPath, watchFile(state, resolved, function() { + return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts6.ConfigFileProgramReloadLevel.Full); + }, ts6.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts6.WatchType.ConfigFile, resolved)); + } + function watchExtendedConfigFiles(state, resolvedPath, parsed) { + ts6.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function(extendedConfigFileName, extendedConfigFilePath) { + return watchFile(state, extendedConfigFileName, function() { + var _a; + return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function(projectConfigFilePath) { + return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts6.ConfigFileProgramReloadLevel.Full); + }); + }, ts6.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts6.WatchType.ExtendedConfigFile); + }, function(fileName) { + return toPath(state, fileName); + }); + } + function watchWildCardDirectories(state, resolved, resolvedPath, parsed) { + if (!state.watch) + return; + ts6.updateWatchingWildcardDirectories(getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), new ts6.Map(ts6.getEntries(parsed.wildcardDirectories)), function(dir, flags) { + return state.watchDirectory(dir, function(fileOrDirectory) { + var _a; + if (ts6.isIgnoredFileFromWildCardWatching({ + watchedDirPath: toPath(state, dir), + fileOrDirectory, + fileOrDirectoryPath: toPath(state, fileOrDirectory), + configFileName: resolved, + currentDirectory: state.currentDirectory, + options: parsed.options, + program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) === null || _a === void 0 ? void 0 : _a.fileNames), + useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, + writeLog: function(s) { + return state.writeLog(s); + }, + toPath: function(fileName) { + return toPath(state, fileName); + } + })) + return; + invalidateProjectAndScheduleBuilds(state, resolvedPath, ts6.ConfigFileProgramReloadLevel.Partial); + }, flags, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts6.WatchType.WildcardDirectory, resolved); + }); + } + function watchInputFiles(state, resolved, resolvedPath, parsed) { + if (!state.watch) + return; + ts6.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts6.arrayToMap(parsed.fileNames, function(fileName) { + return toPath(state, fileName); + }), { + createNewValue: function(_path, input) { + return watchFile(state, input, function() { + return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts6.ConfigFileProgramReloadLevel.None); + }, ts6.PollingInterval.Low, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts6.WatchType.SourceFile, resolved); + }, + onDeleteValue: ts6.closeFileWatcher + }); + } + function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) { + if (!state.watch || !state.lastCachedPackageJsonLookups) + return; + ts6.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts6.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), { + createNewValue: function(path, _input) { + return watchFile(state, path, function() { + return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts6.ConfigFileProgramReloadLevel.None); + }, ts6.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts6.WatchType.PackageJson, resolved); + }, + onDeleteValue: ts6.closeFileWatcher + }); + } + function startWatching(state, buildOrder) { + if (!state.watchAllProjectsPending) + return; + ts6.performance.mark("SolutionBuilder::beforeWatcherCreation"); + state.watchAllProjectsPending = false; + for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { + var resolved = _a[_i]; + var resolvedPath = toResolvedConfigFilePath(state, resolved); + var cfg = parseConfigFile(state, resolved, resolvedPath); + watchConfigFile(state, resolved, resolvedPath, cfg); + watchExtendedConfigFiles(state, resolvedPath, cfg); + if (cfg) { + watchWildCardDirectories(state, resolved, resolvedPath, cfg); + watchInputFiles(state, resolved, resolvedPath, cfg); + watchPackageJsonFiles(state, resolved, resolvedPath, cfg); + } + } + ts6.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts6.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); + } + function stopWatching(state) { + ts6.clearMap(state.allWatchedConfigFiles, ts6.closeFileWatcher); + ts6.clearMap(state.allWatchedExtendedConfigFiles, ts6.closeFileWatcherOf); + ts6.clearMap(state.allWatchedWildcardDirectories, function(watchedWildcardDirectories) { + return ts6.clearMap(watchedWildcardDirectories, ts6.closeFileWatcherOf); + }); + ts6.clearMap(state.allWatchedInputFiles, function(watchedWildcardDirectories) { + return ts6.clearMap(watchedWildcardDirectories, ts6.closeFileWatcher); + }); + ts6.clearMap(state.allWatchedPackageJsonFiles, function(watchedPacageJsonFiles) { + return ts6.clearMap(watchedPacageJsonFiles, ts6.closeFileWatcher); + }); + } + function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) { + var state = createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions); + return { + build: function(project, cancellationToken, writeFile, getCustomTransformers) { + return build(state, project, cancellationToken, writeFile, getCustomTransformers); + }, + clean: function(project) { + return clean(state, project); + }, + buildReferences: function(project, cancellationToken, writeFile, getCustomTransformers) { + return build( + state, + project, + cancellationToken, + writeFile, + getCustomTransformers, + /*onlyReferences*/ + true + ); + }, + cleanReferences: function(project) { + return clean( + state, + project, + /*onlyReferences*/ + true + ); + }, + getNextInvalidatedProject: function(cancellationToken) { + setupInitialBuild(state, cancellationToken); + return getNextInvalidatedProject( + state, + getBuildOrder(state), + /*reportQueue*/ + false + ); + }, + getBuildOrder: function() { + return getBuildOrder(state); + }, + getUpToDateStatusOfProject: function(project) { + var configFileName = resolveProjectName(state, project); + var configFilePath = toResolvedConfigFilePath(state, configFileName); + return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath); + }, + invalidateProject: function(configFilePath, reloadLevel) { + return invalidateProject(state, configFilePath, reloadLevel || ts6.ConfigFileProgramReloadLevel.None); + }, + close: function() { + return stopWatching(state); + } + }; + } + function relName(state, path) { + return ts6.convertToRelativePath(path, state.currentDirectory, function(f) { + return state.getCanonicalFileName(f); + }); + } + function reportStatus(state, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + state.host.reportSolutionBuilderStatus(ts6.createCompilerDiagnostic.apply(void 0, __spreadArray([message], args, false))); + } + function reportWatchStatus(state, message) { + var _a, _b; + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + (_b = (_a = state.hostWithWatch).onWatchStatusChange) === null || _b === void 0 ? void 0 : _b.call(_a, ts6.createCompilerDiagnostic.apply(void 0, __spreadArray([message], args, false)), state.host.getNewLine(), state.baseCompilerOptions); + } + function reportErrors(_a, errors2) { + var host = _a.host; + errors2.forEach(function(err) { + return host.reportDiagnostic(err); + }); + } + function reportAndStoreErrors(state, proj, errors2) { + reportErrors(state, errors2); + state.projectErrorsReported.set(proj, true); + if (errors2.length) { + state.diagnostics.set(proj, errors2); + } + } + function reportParseConfigFileDiagnostic(state, proj) { + reportAndStoreErrors(state, proj, [state.configFileCache.get(proj)]); + } + function reportErrorSummary(state, buildOrder) { + if (!state.needsSummary) + return; + state.needsSummary = false; + var canReportSummary = state.watch || !!state.host.reportErrorSummary; + var diagnostics = state.diagnostics; + var totalErrors = 0; + var filesInError = []; + if (isCircularBuildOrder(buildOrder)) { + reportBuildQueue(state, buildOrder.buildOrder); + reportErrors(state, buildOrder.circularDiagnostics); + if (canReportSummary) + totalErrors += ts6.getErrorCountForSummary(buildOrder.circularDiagnostics); + if (canReportSummary) + filesInError = __spreadArray(__spreadArray([], filesInError, true), ts6.getFilesInErrorForSummary(buildOrder.circularDiagnostics), true); + } else { + buildOrder.forEach(function(project) { + var projectPath = toResolvedConfigFilePath(state, project); + if (!state.projectErrorsReported.has(projectPath)) { + reportErrors(state, diagnostics.get(projectPath) || ts6.emptyArray); + } + }); + if (canReportSummary) + diagnostics.forEach(function(singleProjectErrors) { + return totalErrors += ts6.getErrorCountForSummary(singleProjectErrors); + }); + if (canReportSummary) + diagnostics.forEach(function(singleProjectErrors) { + return __spreadArray(__spreadArray([], filesInError, true), ts6.getFilesInErrorForSummary(singleProjectErrors), true); + }); + } + if (state.watch) { + reportWatchStatus(state, ts6.getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors); + } else if (state.host.reportErrorSummary) { + state.host.reportErrorSummary(totalErrors, filesInError); + } + } + function reportBuildQueue(state, buildQueue) { + if (state.options.verbose) { + reportStatus(state, ts6.Diagnostics.Projects_in_this_build_Colon_0, buildQueue.map(function(s) { + return "\r\n * " + relName(state, s); + }).join("")); + } + } + function reportUpToDateStatus(state, configFileName, status) { + switch (status.type) { + case ts6.UpToDateStatusType.OutOfDateWithSelf: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerInputFileName)); + case ts6.UpToDateStatusType.OutOfDateWithUpstream: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); + case ts6.UpToDateStatusType.OutputMissing: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts6.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); + case ts6.UpToDateStatusType.OutOfDateBuildInfo: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); + case ts6.UpToDateStatusType.UpToDate: + if (status.newestInputFileTime !== void 0) { + return reportStatus(state, ts6.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2, relName(state, configFileName), relName(state, status.newestInputFileName || ""), relName(state, status.oldestOutputFileName || "")); + } + break; + case ts6.UpToDateStatusType.OutOfDateWithPrepend: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName)); + case ts6.UpToDateStatusType.UpToDateWithUpstreamTypes: + return reportStatus(state, ts6.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName)); + case ts6.UpToDateStatusType.UpToDateWithInputFileText: + return reportStatus(state, ts6.Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName)); + case ts6.UpToDateStatusType.UpstreamOutOfDate: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName)); + case ts6.UpToDateStatusType.UpstreamBlocked: + return reportStatus(state, status.upstreamProjectBlocked ? ts6.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : ts6.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(state, configFileName), relName(state, status.upstreamProjectName)); + case ts6.UpToDateStatusType.Unbuildable: + return reportStatus(state, ts6.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason); + case ts6.UpToDateStatusType.TsVersionOutputOfDate: + return reportStatus(state, ts6.Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relName(state, configFileName), status.version, ts6.version); + case ts6.UpToDateStatusType.ForceBuild: + return reportStatus(state, ts6.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName)); + case ts6.UpToDateStatusType.ContainerOnly: + case ts6.UpToDateStatusType.ComputingUpstream: + break; + default: + ts6.assertType(status); + } + } + function verboseReportProjectStatus(state, configFileName, status) { + if (state.options.verbose) { + reportUpToDateStatus(state, configFileName, status); + } + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var server; + (function(server2) { + server2.ActionSet = "action::set"; + server2.ActionInvalidate = "action::invalidate"; + server2.ActionPackageInstalled = "action::packageInstalled"; + server2.EventTypesRegistry = "event::typesRegistry"; + server2.EventBeginInstallTypes = "event::beginInstallTypes"; + server2.EventEndInstallTypes = "event::endInstallTypes"; + server2.EventInitializationFailed = "event::initializationFailed"; + var Arguments; + (function(Arguments2) { + Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation"; + Arguments2.LogFile = "--logFile"; + Arguments2.EnableTelemetry = "--enableTelemetry"; + Arguments2.TypingSafeListLocation = "--typingSafeListLocation"; + Arguments2.TypesMapLocation = "--typesMapLocation"; + Arguments2.NpmLocation = "--npmLocation"; + Arguments2.ValidateDefaultNpmLocation = "--validateDefaultNpmLocation"; + })(Arguments = server2.Arguments || (server2.Arguments = {})); + function hasArgument(argumentName) { + return ts6.sys.args.indexOf(argumentName) >= 0; + } + server2.hasArgument = hasArgument; + function findArgument(argumentName) { + var index = ts6.sys.args.indexOf(argumentName); + return index >= 0 && index < ts6.sys.args.length - 1 ? ts6.sys.args[index + 1] : void 0; + } + server2.findArgument = findArgument; + function nowString() { + var d = /* @__PURE__ */ new Date(); + return "".concat(ts6.padLeft(d.getHours().toString(), 2, "0"), ":").concat(ts6.padLeft(d.getMinutes().toString(), 2, "0"), ":").concat(ts6.padLeft(d.getSeconds().toString(), 2, "0"), ".").concat(ts6.padLeft(d.getMilliseconds().toString(), 3, "0")); + } + server2.nowString = nowString; + })(server = ts6.server || (ts6.server = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var JsTyping; + (function(JsTyping2) { + function isTypingUpToDate(cachedTyping, availableTypingVersions) { + var availableVersion = new ts6.Version(ts6.getProperty(availableTypingVersions, "ts".concat(ts6.versionMajorMinor)) || ts6.getProperty(availableTypingVersions, "latest")); + return availableVersion.compareTo(cachedTyping.version) <= 0; + } + JsTyping2.isTypingUpToDate = isTypingUpToDate; + var unprefixedNodeCoreModuleList = [ + "assert", + "assert/strict", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "diagnostics_channel", + "dns", + "dns/promises", + "domain", + "events", + "fs", + "fs/promises", + "http", + "https", + "http2", + "inspector", + "module", + "net", + "os", + "path", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "repl", + "stream", + "stream/promises", + "string_decoder", + "timers", + "timers/promises", + "tls", + "trace_events", + "tty", + "url", + "util", + "util/types", + "v8", + "vm", + "wasi", + "worker_threads", + "zlib" + ]; + JsTyping2.prefixedNodeCoreModuleList = unprefixedNodeCoreModuleList.map(function(name) { + return "node:".concat(name); + }); + JsTyping2.nodeCoreModuleList = __spreadArray(__spreadArray([], unprefixedNodeCoreModuleList, true), JsTyping2.prefixedNodeCoreModuleList, true); + JsTyping2.nodeCoreModules = new ts6.Set(JsTyping2.nodeCoreModuleList); + function nonRelativeModuleNameForTypingCache(moduleName) { + return JsTyping2.nodeCoreModules.has(moduleName) ? "node" : moduleName; + } + JsTyping2.nonRelativeModuleNameForTypingCache = nonRelativeModuleNameForTypingCache; + function loadSafeList(host, safeListPath) { + var result = ts6.readConfigFile(safeListPath, function(path) { + return host.readFile(path); + }); + return new ts6.Map(ts6.getEntries(result.config)); + } + JsTyping2.loadSafeList = loadSafeList; + function loadTypesMap(host, typesMapPath) { + var result = ts6.readConfigFile(typesMapPath, function(path) { + return host.readFile(path); + }); + if (result.config) { + return new ts6.Map(ts6.getEntries(result.config.simpleMap)); + } + return void 0; + } + JsTyping2.loadTypesMap = loadTypesMap; + function discoverTypings(host, log, fileNames, projectRootPath, safeList, packageNameToTypingLocation, typeAcquisition, unresolvedImports, typesRegistry, compilerOptions) { + if (!typeAcquisition || !typeAcquisition.enable) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + var inferredTypings = new ts6.Map(); + fileNames = ts6.mapDefined(fileNames, function(fileName) { + var path = ts6.normalizePath(fileName); + if (ts6.hasJSFileExtension(path)) { + return path; + } + }); + var filesToWatch = []; + if (typeAcquisition.include) + addInferredTypings(typeAcquisition.include, "Explicitly included types"); + var exclude = typeAcquisition.exclude || []; + if (!compilerOptions.types) { + var possibleSearchDirs = new ts6.Set(fileNames.map(ts6.getDirectoryPath)); + possibleSearchDirs.add(projectRootPath); + possibleSearchDirs.forEach(function(searchDir) { + getTypingNames(searchDir, "bower.json", "bower_components", filesToWatch); + getTypingNames(searchDir, "package.json", "node_modules", filesToWatch); + }); + } + if (!typeAcquisition.disableFilenameBasedTypeAcquisition) { + getTypingNamesFromSourceFileNames(fileNames); + } + if (unresolvedImports) { + var module_1 = ts6.deduplicate(unresolvedImports.map(nonRelativeModuleNameForTypingCache), ts6.equateStringsCaseSensitive, ts6.compareStringsCaseSensitive); + addInferredTypings(module_1, "Inferred typings from unresolved imports"); + } + packageNameToTypingLocation.forEach(function(typing, name) { + var registryEntry = typesRegistry.get(name); + if (inferredTypings.has(name) && inferredTypings.get(name) === void 0 && registryEntry !== void 0 && isTypingUpToDate(typing, registryEntry)) { + inferredTypings.set(name, typing.typingLocation); + } + }); + for (var _i = 0, exclude_1 = exclude; _i < exclude_1.length; _i++) { + var excludeTypingName = exclude_1[_i]; + var didDelete = inferredTypings.delete(excludeTypingName); + if (didDelete && log) + log("Typing for ".concat(excludeTypingName, " is in exclude list, will be ignored.")); + } + var newTypingNames = []; + var cachedTypingPaths = []; + inferredTypings.forEach(function(inferred, typing) { + if (inferred !== void 0) { + cachedTypingPaths.push(inferred); + } else { + newTypingNames.push(typing); + } + }); + var result = { cachedTypingPaths, newTypingNames, filesToWatch }; + if (log) + log("Result: ".concat(JSON.stringify(result))); + return result; + function addInferredTyping(typingName) { + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, void 0); + } + } + function addInferredTypings(typingNames, message) { + if (log) + log("".concat(message, ": ").concat(JSON.stringify(typingNames))); + ts6.forEach(typingNames, addInferredTyping); + } + function getTypingNames(projectRootPath2, manifestName, modulesDirName, filesToWatch2) { + var manifestPath = ts6.combinePaths(projectRootPath2, manifestName); + var manifest; + var manifestTypingNames; + if (host.fileExists(manifestPath)) { + filesToWatch2.push(manifestPath); + manifest = ts6.readConfigFile(manifestPath, function(path) { + return host.readFile(path); + }).config; + manifestTypingNames = ts6.flatMap([manifest.dependencies, manifest.devDependencies, manifest.optionalDependencies, manifest.peerDependencies], ts6.getOwnKeys); + addInferredTypings(manifestTypingNames, "Typing names in '".concat(manifestPath, "' dependencies")); + } + var packagesFolderPath = ts6.combinePaths(projectRootPath2, modulesDirName); + filesToWatch2.push(packagesFolderPath); + if (!host.directoryExists(packagesFolderPath)) { + return; + } + var packageNames = []; + var dependencyManifestNames = manifestTypingNames ? manifestTypingNames.map(function(typingName) { + return ts6.combinePaths(packagesFolderPath, typingName, manifestName); + }) : host.readDirectory( + packagesFolderPath, + [ + ".json" + /* Extension.Json */ + ], + /*excludes*/ + void 0, + /*includes*/ + void 0, + /*depth*/ + 3 + ).filter(function(manifestPath2) { + if (ts6.getBaseFileName(manifestPath2) !== manifestName) { + return false; + } + var pathComponents = ts6.getPathComponents(ts6.normalizePath(manifestPath2)); + var isScoped = pathComponents[pathComponents.length - 3][0] === "@"; + return isScoped && pathComponents[pathComponents.length - 4].toLowerCase() === modulesDirName || // `node_modules/@foo/bar` + !isScoped && pathComponents[pathComponents.length - 3].toLowerCase() === modulesDirName; + }); + if (log) + log("Searching for typing names in ".concat(packagesFolderPath, "; all files: ").concat(JSON.stringify(dependencyManifestNames))); + for (var _i2 = 0, dependencyManifestNames_1 = dependencyManifestNames; _i2 < dependencyManifestNames_1.length; _i2++) { + var manifestPath_1 = dependencyManifestNames_1[_i2]; + var normalizedFileName = ts6.normalizePath(manifestPath_1); + var result_1 = ts6.readConfigFile(normalizedFileName, function(path) { + return host.readFile(path); + }); + var manifest_1 = result_1.config; + if (!manifest_1.name) { + continue; + } + var ownTypes = manifest_1.types || manifest_1.typings; + if (ownTypes) { + var absolutePath = ts6.getNormalizedAbsolutePath(ownTypes, ts6.getDirectoryPath(normalizedFileName)); + if (host.fileExists(absolutePath)) { + if (log) + log(" Package '".concat(manifest_1.name, "' provides its own types.")); + inferredTypings.set(manifest_1.name, absolutePath); + } else { + if (log) + log(" Package '".concat(manifest_1.name, "' provides its own types but they are missing.")); + } + } else { + packageNames.push(manifest_1.name); + } + } + addInferredTypings(packageNames, " Found package names"); + } + function getTypingNamesFromSourceFileNames(fileNames2) { + var fromFileNames = ts6.mapDefined(fileNames2, function(j) { + if (!ts6.hasJSFileExtension(j)) + return void 0; + var inferredTypingName = ts6.removeFileExtension(ts6.getBaseFileName(j.toLowerCase())); + var cleanedTypingName = ts6.removeMinAndVersionNumbers(inferredTypingName); + return safeList.get(cleanedTypingName); + }); + if (fromFileNames.length) { + addInferredTypings(fromFileNames, "Inferred typings from file names"); + } + var hasJsxFile = ts6.some(fileNames2, function(f) { + return ts6.fileExtensionIs( + f, + ".jsx" + /* Extension.Jsx */ + ); + }); + if (hasJsxFile) { + if (log) + log("Inferred 'react' typings due to presence of '.jsx' extension"); + addInferredTyping("react"); + } + } + } + JsTyping2.discoverTypings = discoverTypings; + var NameValidationResult; + (function(NameValidationResult2) { + NameValidationResult2[NameValidationResult2["Ok"] = 0] = "Ok"; + NameValidationResult2[NameValidationResult2["EmptyName"] = 1] = "EmptyName"; + NameValidationResult2[NameValidationResult2["NameTooLong"] = 2] = "NameTooLong"; + NameValidationResult2[NameValidationResult2["NameStartsWithDot"] = 3] = "NameStartsWithDot"; + NameValidationResult2[NameValidationResult2["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore"; + NameValidationResult2[NameValidationResult2["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters"; + })(NameValidationResult = JsTyping2.NameValidationResult || (JsTyping2.NameValidationResult = {})); + var maxPackageNameLength = 214; + function validatePackageName(packageName) { + return validatePackageNameWorker( + packageName, + /*supportScopedPackage*/ + true + ); + } + JsTyping2.validatePackageName = validatePackageName; + function validatePackageNameWorker(packageName, supportScopedPackage) { + if (!packageName) { + return 1; + } + if (packageName.length > maxPackageNameLength) { + return 2; + } + if (packageName.charCodeAt(0) === 46) { + return 3; + } + if (packageName.charCodeAt(0) === 95) { + return 4; + } + if (supportScopedPackage) { + var matches = /^@([^/]+)\/([^/]+)$/.exec(packageName); + if (matches) { + var scopeResult = validatePackageNameWorker( + matches[1], + /*supportScopedPackage*/ + false + ); + if (scopeResult !== 0) { + return { name: matches[1], isScopeName: true, result: scopeResult }; + } + var packageResult = validatePackageNameWorker( + matches[2], + /*supportScopedPackage*/ + false + ); + if (packageResult !== 0) { + return { name: matches[2], isScopeName: false, result: packageResult }; + } + return 0; + } + } + if (encodeURIComponent(packageName) !== packageName) { + return 5; + } + return 0; + } + function renderPackageNameValidationFailure(result, typing) { + return typeof result === "object" ? renderPackageNameValidationFailureWorker(typing, result.result, result.name, result.isScopeName) : renderPackageNameValidationFailureWorker( + typing, + result, + typing, + /*isScopeName*/ + false + ); + } + JsTyping2.renderPackageNameValidationFailure = renderPackageNameValidationFailure; + function renderPackageNameValidationFailureWorker(typing, result, name, isScopeName) { + var kind = isScopeName ? "Scope" : "Package"; + switch (result) { + case 1: + return "'".concat(typing, "':: ").concat(kind, " name '").concat(name, "' cannot be empty"); + case 2: + return "'".concat(typing, "':: ").concat(kind, " name '").concat(name, "' should be less than ").concat(maxPackageNameLength, " characters"); + case 3: + return "'".concat(typing, "':: ").concat(kind, " name '").concat(name, "' cannot start with '.'"); + case 4: + return "'".concat(typing, "':: ").concat(kind, " name '").concat(name, "' cannot start with '_'"); + case 5: + return "'".concat(typing, "':: ").concat(kind, " name '").concat(name, "' contains non URI safe characters"); + case 0: + return ts6.Debug.fail(); + default: + throw ts6.Debug.assertNever(result); + } + } + })(JsTyping = ts6.JsTyping || (ts6.JsTyping = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ScriptSnapshot; + (function(ScriptSnapshot2) { + var StringScriptSnapshot = ( + /** @class */ + function() { + function StringScriptSnapshot2(text) { + this.text = text; + } + StringScriptSnapshot2.prototype.getText = function(start, end) { + return start === 0 && end === this.text.length ? this.text : this.text.substring(start, end); + }; + StringScriptSnapshot2.prototype.getLength = function() { + return this.text.length; + }; + StringScriptSnapshot2.prototype.getChangeRange = function() { + return void 0; + }; + return StringScriptSnapshot2; + }() + ); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot2.fromString = fromString; + })(ScriptSnapshot = ts6.ScriptSnapshot || (ts6.ScriptSnapshot = {})); + var PackageJsonDependencyGroup; + (function(PackageJsonDependencyGroup2) { + PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["Dependencies"] = 1] = "Dependencies"; + PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["DevDependencies"] = 2] = "DevDependencies"; + PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["PeerDependencies"] = 4] = "PeerDependencies"; + PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["OptionalDependencies"] = 8] = "OptionalDependencies"; + PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["All"] = 15] = "All"; + })(PackageJsonDependencyGroup = ts6.PackageJsonDependencyGroup || (ts6.PackageJsonDependencyGroup = {})); + var PackageJsonAutoImportPreference; + (function(PackageJsonAutoImportPreference2) { + PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["Off"] = 0] = "Off"; + PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["On"] = 1] = "On"; + PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["Auto"] = 2] = "Auto"; + })(PackageJsonAutoImportPreference = ts6.PackageJsonAutoImportPreference || (ts6.PackageJsonAutoImportPreference = {})); + var LanguageServiceMode; + (function(LanguageServiceMode2) { + LanguageServiceMode2[LanguageServiceMode2["Semantic"] = 0] = "Semantic"; + LanguageServiceMode2[LanguageServiceMode2["PartialSemantic"] = 1] = "PartialSemantic"; + LanguageServiceMode2[LanguageServiceMode2["Syntactic"] = 2] = "Syntactic"; + })(LanguageServiceMode = ts6.LanguageServiceMode || (ts6.LanguageServiceMode = {})); + ts6.emptyOptions = {}; + var SemanticClassificationFormat; + (function(SemanticClassificationFormat2) { + SemanticClassificationFormat2["Original"] = "original"; + SemanticClassificationFormat2["TwentyTwenty"] = "2020"; + })(SemanticClassificationFormat = ts6.SemanticClassificationFormat || (ts6.SemanticClassificationFormat = {})); + var OrganizeImportsMode; + (function(OrganizeImportsMode2) { + OrganizeImportsMode2["All"] = "All"; + OrganizeImportsMode2["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode2["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = ts6.OrganizeImportsMode || (ts6.OrganizeImportsMode = {})); + var CompletionTriggerKind; + (function(CompletionTriggerKind2) { + CompletionTriggerKind2[CompletionTriggerKind2["Invoked"] = 1] = "Invoked"; + CompletionTriggerKind2[CompletionTriggerKind2["TriggerCharacter"] = 2] = "TriggerCharacter"; + CompletionTriggerKind2[CompletionTriggerKind2["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions"; + })(CompletionTriggerKind = ts6.CompletionTriggerKind || (ts6.CompletionTriggerKind = {})); + var InlayHintKind; + (function(InlayHintKind2) { + InlayHintKind2["Type"] = "Type"; + InlayHintKind2["Parameter"] = "Parameter"; + InlayHintKind2["Enum"] = "Enum"; + })(InlayHintKind = ts6.InlayHintKind || (ts6.InlayHintKind = {})); + var HighlightSpanKind; + (function(HighlightSpanKind2) { + HighlightSpanKind2["none"] = "none"; + HighlightSpanKind2["definition"] = "definition"; + HighlightSpanKind2["reference"] = "reference"; + HighlightSpanKind2["writtenReference"] = "writtenReference"; + })(HighlightSpanKind = ts6.HighlightSpanKind || (ts6.HighlightSpanKind = {})); + var IndentStyle; + (function(IndentStyle2) { + IndentStyle2[IndentStyle2["None"] = 0] = "None"; + IndentStyle2[IndentStyle2["Block"] = 1] = "Block"; + IndentStyle2[IndentStyle2["Smart"] = 2] = "Smart"; + })(IndentStyle = ts6.IndentStyle || (ts6.IndentStyle = {})); + var SemicolonPreference; + (function(SemicolonPreference2) { + SemicolonPreference2["Ignore"] = "ignore"; + SemicolonPreference2["Insert"] = "insert"; + SemicolonPreference2["Remove"] = "remove"; + })(SemicolonPreference = ts6.SemicolonPreference || (ts6.SemicolonPreference = {})); + function getDefaultFormatCodeSettings(newLineCharacter) { + return { + indentSize: 4, + tabSize: 4, + newLineCharacter: newLineCharacter || "\n", + convertTabsToSpaces: true, + indentStyle: IndentStyle.Smart, + insertSpaceAfterConstructor: false, + insertSpaceAfterCommaDelimiter: true, + insertSpaceAfterSemicolonInForStatements: true, + insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterKeywordsInControlFlowStatements: true, + insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, + placeOpenBraceOnNewLineForFunctions: false, + placeOpenBraceOnNewLineForControlBlocks: false, + semicolons: SemicolonPreference.Ignore, + trimTrailingWhitespace: true + }; + } + ts6.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; + ts6.testFormatSettings = getDefaultFormatCodeSettings("\n"); + var SymbolDisplayPartKind; + (function(SymbolDisplayPartKind2) { + SymbolDisplayPartKind2[SymbolDisplayPartKind2["aliasName"] = 0] = "aliasName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["className"] = 1] = "className"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["enumName"] = 2] = "enumName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["fieldName"] = 3] = "fieldName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["interfaceName"] = 4] = "interfaceName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["keyword"] = 5] = "keyword"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["lineBreak"] = 6] = "lineBreak"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["numericLiteral"] = 7] = "numericLiteral"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["stringLiteral"] = 8] = "stringLiteral"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["localName"] = 9] = "localName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["methodName"] = 10] = "methodName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["moduleName"] = 11] = "moduleName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["operator"] = 12] = "operator"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["parameterName"] = 13] = "parameterName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["propertyName"] = 14] = "propertyName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["punctuation"] = 15] = "punctuation"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["space"] = 16] = "space"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["text"] = 17] = "text"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["typeParameterName"] = 18] = "typeParameterName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["enumMemberName"] = 19] = "enumMemberName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["functionName"] = 20] = "functionName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["link"] = 22] = "link"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["linkName"] = 23] = "linkName"; + SymbolDisplayPartKind2[SymbolDisplayPartKind2["linkText"] = 24] = "linkText"; + })(SymbolDisplayPartKind = ts6.SymbolDisplayPartKind || (ts6.SymbolDisplayPartKind = {})); + var CompletionInfoFlags; + (function(CompletionInfoFlags2) { + CompletionInfoFlags2[CompletionInfoFlags2["None"] = 0] = "None"; + CompletionInfoFlags2[CompletionInfoFlags2["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports"; + CompletionInfoFlags2[CompletionInfoFlags2["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion"; + CompletionInfoFlags2[CompletionInfoFlags2["IsContinuation"] = 4] = "IsContinuation"; + CompletionInfoFlags2[CompletionInfoFlags2["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers"; + CompletionInfoFlags2[CompletionInfoFlags2["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit"; + CompletionInfoFlags2[CompletionInfoFlags2["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets"; + })(CompletionInfoFlags = ts6.CompletionInfoFlags || (ts6.CompletionInfoFlags = {})); + var OutliningSpanKind; + (function(OutliningSpanKind2) { + OutliningSpanKind2["Comment"] = "comment"; + OutliningSpanKind2["Region"] = "region"; + OutliningSpanKind2["Code"] = "code"; + OutliningSpanKind2["Imports"] = "imports"; + })(OutliningSpanKind = ts6.OutliningSpanKind || (ts6.OutliningSpanKind = {})); + var OutputFileType; + (function(OutputFileType2) { + OutputFileType2[OutputFileType2["JavaScript"] = 0] = "JavaScript"; + OutputFileType2[OutputFileType2["SourceMap"] = 1] = "SourceMap"; + OutputFileType2[OutputFileType2["Declaration"] = 2] = "Declaration"; + })(OutputFileType = ts6.OutputFileType || (ts6.OutputFileType = {})); + var EndOfLineState; + (function(EndOfLineState2) { + EndOfLineState2[EndOfLineState2["None"] = 0] = "None"; + EndOfLineState2[EndOfLineState2["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState2[EndOfLineState2["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState2[EndOfLineState2["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState2[EndOfLineState2["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState2[EndOfLineState2["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState2[EndOfLineState2["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; + })(EndOfLineState = ts6.EndOfLineState || (ts6.EndOfLineState = {})); + var TokenClass; + (function(TokenClass2) { + TokenClass2[TokenClass2["Punctuation"] = 0] = "Punctuation"; + TokenClass2[TokenClass2["Keyword"] = 1] = "Keyword"; + TokenClass2[TokenClass2["Operator"] = 2] = "Operator"; + TokenClass2[TokenClass2["Comment"] = 3] = "Comment"; + TokenClass2[TokenClass2["Whitespace"] = 4] = "Whitespace"; + TokenClass2[TokenClass2["Identifier"] = 5] = "Identifier"; + TokenClass2[TokenClass2["NumberLiteral"] = 6] = "NumberLiteral"; + TokenClass2[TokenClass2["BigIntLiteral"] = 7] = "BigIntLiteral"; + TokenClass2[TokenClass2["StringLiteral"] = 8] = "StringLiteral"; + TokenClass2[TokenClass2["RegExpLiteral"] = 9] = "RegExpLiteral"; + })(TokenClass = ts6.TokenClass || (ts6.TokenClass = {})); + var ScriptElementKind; + (function(ScriptElementKind2) { + ScriptElementKind2["unknown"] = ""; + ScriptElementKind2["warning"] = "warning"; + ScriptElementKind2["keyword"] = "keyword"; + ScriptElementKind2["scriptElement"] = "script"; + ScriptElementKind2["moduleElement"] = "module"; + ScriptElementKind2["classElement"] = "class"; + ScriptElementKind2["localClassElement"] = "local class"; + ScriptElementKind2["interfaceElement"] = "interface"; + ScriptElementKind2["typeElement"] = "type"; + ScriptElementKind2["enumElement"] = "enum"; + ScriptElementKind2["enumMemberElement"] = "enum member"; + ScriptElementKind2["variableElement"] = "var"; + ScriptElementKind2["localVariableElement"] = "local var"; + ScriptElementKind2["functionElement"] = "function"; + ScriptElementKind2["localFunctionElement"] = "local function"; + ScriptElementKind2["memberFunctionElement"] = "method"; + ScriptElementKind2["memberGetAccessorElement"] = "getter"; + ScriptElementKind2["memberSetAccessorElement"] = "setter"; + ScriptElementKind2["memberVariableElement"] = "property"; + ScriptElementKind2["memberAccessorVariableElement"] = "accessor"; + ScriptElementKind2["constructorImplementationElement"] = "constructor"; + ScriptElementKind2["callSignatureElement"] = "call"; + ScriptElementKind2["indexSignatureElement"] = "index"; + ScriptElementKind2["constructSignatureElement"] = "construct"; + ScriptElementKind2["parameterElement"] = "parameter"; + ScriptElementKind2["typeParameterElement"] = "type parameter"; + ScriptElementKind2["primitiveType"] = "primitive type"; + ScriptElementKind2["label"] = "label"; + ScriptElementKind2["alias"] = "alias"; + ScriptElementKind2["constElement"] = "const"; + ScriptElementKind2["letElement"] = "let"; + ScriptElementKind2["directory"] = "directory"; + ScriptElementKind2["externalModuleName"] = "external module name"; + ScriptElementKind2["jsxAttribute"] = "JSX attribute"; + ScriptElementKind2["string"] = "string"; + ScriptElementKind2["link"] = "link"; + ScriptElementKind2["linkName"] = "link name"; + ScriptElementKind2["linkText"] = "link text"; + })(ScriptElementKind = ts6.ScriptElementKind || (ts6.ScriptElementKind = {})); + var ScriptElementKindModifier; + (function(ScriptElementKindModifier2) { + ScriptElementKindModifier2["none"] = ""; + ScriptElementKindModifier2["publicMemberModifier"] = "public"; + ScriptElementKindModifier2["privateMemberModifier"] = "private"; + ScriptElementKindModifier2["protectedMemberModifier"] = "protected"; + ScriptElementKindModifier2["exportedModifier"] = "export"; + ScriptElementKindModifier2["ambientModifier"] = "declare"; + ScriptElementKindModifier2["staticModifier"] = "static"; + ScriptElementKindModifier2["abstractModifier"] = "abstract"; + ScriptElementKindModifier2["optionalModifier"] = "optional"; + ScriptElementKindModifier2["deprecatedModifier"] = "deprecated"; + ScriptElementKindModifier2["dtsModifier"] = ".d.ts"; + ScriptElementKindModifier2["tsModifier"] = ".ts"; + ScriptElementKindModifier2["tsxModifier"] = ".tsx"; + ScriptElementKindModifier2["jsModifier"] = ".js"; + ScriptElementKindModifier2["jsxModifier"] = ".jsx"; + ScriptElementKindModifier2["jsonModifier"] = ".json"; + ScriptElementKindModifier2["dmtsModifier"] = ".d.mts"; + ScriptElementKindModifier2["mtsModifier"] = ".mts"; + ScriptElementKindModifier2["mjsModifier"] = ".mjs"; + ScriptElementKindModifier2["dctsModifier"] = ".d.cts"; + ScriptElementKindModifier2["ctsModifier"] = ".cts"; + ScriptElementKindModifier2["cjsModifier"] = ".cjs"; + })(ScriptElementKindModifier = ts6.ScriptElementKindModifier || (ts6.ScriptElementKindModifier = {})); + var ClassificationTypeNames; + (function(ClassificationTypeNames2) { + ClassificationTypeNames2["comment"] = "comment"; + ClassificationTypeNames2["identifier"] = "identifier"; + ClassificationTypeNames2["keyword"] = "keyword"; + ClassificationTypeNames2["numericLiteral"] = "number"; + ClassificationTypeNames2["bigintLiteral"] = "bigint"; + ClassificationTypeNames2["operator"] = "operator"; + ClassificationTypeNames2["stringLiteral"] = "string"; + ClassificationTypeNames2["whiteSpace"] = "whitespace"; + ClassificationTypeNames2["text"] = "text"; + ClassificationTypeNames2["punctuation"] = "punctuation"; + ClassificationTypeNames2["className"] = "class name"; + ClassificationTypeNames2["enumName"] = "enum name"; + ClassificationTypeNames2["interfaceName"] = "interface name"; + ClassificationTypeNames2["moduleName"] = "module name"; + ClassificationTypeNames2["typeParameterName"] = "type parameter name"; + ClassificationTypeNames2["typeAliasName"] = "type alias name"; + ClassificationTypeNames2["parameterName"] = "parameter name"; + ClassificationTypeNames2["docCommentTagName"] = "doc comment tag name"; + ClassificationTypeNames2["jsxOpenTagName"] = "jsx open tag name"; + ClassificationTypeNames2["jsxCloseTagName"] = "jsx close tag name"; + ClassificationTypeNames2["jsxSelfClosingTagName"] = "jsx self closing tag name"; + ClassificationTypeNames2["jsxAttribute"] = "jsx attribute"; + ClassificationTypeNames2["jsxText"] = "jsx text"; + ClassificationTypeNames2["jsxAttributeStringLiteralValue"] = "jsx attribute string literal value"; + })(ClassificationTypeNames = ts6.ClassificationTypeNames || (ts6.ClassificationTypeNames = {})); + var ClassificationType; + (function(ClassificationType2) { + ClassificationType2[ClassificationType2["comment"] = 1] = "comment"; + ClassificationType2[ClassificationType2["identifier"] = 2] = "identifier"; + ClassificationType2[ClassificationType2["keyword"] = 3] = "keyword"; + ClassificationType2[ClassificationType2["numericLiteral"] = 4] = "numericLiteral"; + ClassificationType2[ClassificationType2["operator"] = 5] = "operator"; + ClassificationType2[ClassificationType2["stringLiteral"] = 6] = "stringLiteral"; + ClassificationType2[ClassificationType2["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; + ClassificationType2[ClassificationType2["whiteSpace"] = 8] = "whiteSpace"; + ClassificationType2[ClassificationType2["text"] = 9] = "text"; + ClassificationType2[ClassificationType2["punctuation"] = 10] = "punctuation"; + ClassificationType2[ClassificationType2["className"] = 11] = "className"; + ClassificationType2[ClassificationType2["enumName"] = 12] = "enumName"; + ClassificationType2[ClassificationType2["interfaceName"] = 13] = "interfaceName"; + ClassificationType2[ClassificationType2["moduleName"] = 14] = "moduleName"; + ClassificationType2[ClassificationType2["typeParameterName"] = 15] = "typeParameterName"; + ClassificationType2[ClassificationType2["typeAliasName"] = 16] = "typeAliasName"; + ClassificationType2[ClassificationType2["parameterName"] = 17] = "parameterName"; + ClassificationType2[ClassificationType2["docCommentTagName"] = 18] = "docCommentTagName"; + ClassificationType2[ClassificationType2["jsxOpenTagName"] = 19] = "jsxOpenTagName"; + ClassificationType2[ClassificationType2["jsxCloseTagName"] = 20] = "jsxCloseTagName"; + ClassificationType2[ClassificationType2["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; + ClassificationType2[ClassificationType2["jsxAttribute"] = 22] = "jsxAttribute"; + ClassificationType2[ClassificationType2["jsxText"] = 23] = "jsxText"; + ClassificationType2[ClassificationType2["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; + ClassificationType2[ClassificationType2["bigintLiteral"] = 25] = "bigintLiteral"; + })(ClassificationType = ts6.ClassificationType || (ts6.ClassificationType = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.scanner = ts6.createScanner( + 99, + /*skipTrivia*/ + true + ); + var SemanticMeaning; + (function(SemanticMeaning2) { + SemanticMeaning2[SemanticMeaning2["None"] = 0] = "None"; + SemanticMeaning2[SemanticMeaning2["Value"] = 1] = "Value"; + SemanticMeaning2[SemanticMeaning2["Type"] = 2] = "Type"; + SemanticMeaning2[SemanticMeaning2["Namespace"] = 4] = "Namespace"; + SemanticMeaning2[SemanticMeaning2["All"] = 7] = "All"; + })(SemanticMeaning = ts6.SemanticMeaning || (ts6.SemanticMeaning = {})); + function getMeaningFromDeclaration(node) { + switch (node.kind) { + case 257: + return ts6.isInJSFile(node) && ts6.getJSDocEnumTag(node) ? 7 : 1; + case 166: + case 205: + case 169: + case 168: + case 299: + case 300: + case 171: + case 170: + case 173: + case 174: + case 175: + case 259: + case 215: + case 216: + case 295: + case 288: + return 1; + case 165: + case 261: + case 262: + case 184: + return 2; + case 348: + return node.name === void 0 ? 1 | 2 : 2; + case 302: + case 260: + return 1 | 2; + case 264: + if (ts6.isAmbientModule(node)) { + return 4 | 1; + } else if (ts6.getModuleInstanceState(node) === 1) { + return 4 | 1; + } else { + return 4; + } + case 263: + case 272: + case 273: + case 268: + case 269: + case 274: + case 275: + return 7; + case 308: + return 4 | 1; + } + return 7; + } + ts6.getMeaningFromDeclaration = getMeaningFromDeclaration; + function getMeaningFromLocation(node) { + node = getAdjustedReferenceLocation(node); + var parent = node.parent; + if (node.kind === 308) { + return 1; + } else if (ts6.isExportAssignment(parent) || ts6.isExportSpecifier(parent) || ts6.isExternalModuleReference(parent) || ts6.isImportSpecifier(parent) || ts6.isImportClause(parent) || ts6.isImportEqualsDeclaration(parent) && node === parent.name) { + return 7; + } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { + return getMeaningFromRightHandSideOfImportEquals(node); + } else if (ts6.isDeclarationName(node)) { + return getMeaningFromDeclaration(parent); + } else if (ts6.isEntityName(node) && ts6.findAncestor(node, ts6.or(ts6.isJSDocNameReference, ts6.isJSDocLinkLike, ts6.isJSDocMemberName))) { + return 7; + } else if (isTypeReference(node)) { + return 2; + } else if (isNamespaceReference(node)) { + return 4; + } else if (ts6.isTypeParameterDeclaration(parent)) { + ts6.Debug.assert(ts6.isJSDocTemplateTag(parent.parent)); + return 2; + } else if (ts6.isLiteralTypeNode(parent)) { + return 2 | 1; + } else { + return 1; + } + } + ts6.getMeaningFromLocation = getMeaningFromLocation; + function getMeaningFromRightHandSideOfImportEquals(node) { + var name = node.kind === 163 ? node : ts6.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : void 0; + return name && name.parent.kind === 268 ? 7 : 4; + } + function isInRightSideOfInternalImportEqualsDeclaration(node) { + while (node.parent.kind === 163) { + node = node.parent; + } + return ts6.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; + } + ts6.isInRightSideOfInternalImportEqualsDeclaration = isInRightSideOfInternalImportEqualsDeclaration; + function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isQualifiedNameNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 163) { + while (root.parent && root.parent.kind === 163) { + root = root.parent; + } + isLastClause = root.right === node; + } + return root.parent.kind === 180 && !isLastClause; + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 208) { + while (root.parent && root.parent.kind === 208) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 230 && root.parent.parent.kind === 294) { + var decl = root.parent.parent.parent; + return decl.kind === 260 && root.parent.parent.token === 117 || decl.kind === 261 && root.parent.parent.token === 94; + } + return false; + } + function isTypeReference(node) { + if (ts6.isRightSideOfQualifiedNameOrPropertyAccess(node)) { + node = node.parent; + } + switch (node.kind) { + case 108: + return !ts6.isExpressionNode(node); + case 194: + return true; + } + switch (node.parent.kind) { + case 180: + return true; + case 202: + return !node.parent.isTypeOf; + case 230: + return ts6.isPartOfTypeNode(node.parent); + } + return false; + } + function isCallExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } + return isCalleeWorker(node, ts6.isCallExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); + } + ts6.isCallExpressionTarget = isCallExpressionTarget; + function isNewExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } + return isCalleeWorker(node, ts6.isNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); + } + ts6.isNewExpressionTarget = isNewExpressionTarget; + function isCallOrNewExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } + return isCalleeWorker(node, ts6.isCallOrNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); + } + ts6.isCallOrNewExpressionTarget = isCallOrNewExpressionTarget; + function isTaggedTemplateTag(node, includeElementAccess, skipPastOuterExpressions) { + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } + return isCalleeWorker(node, ts6.isTaggedTemplateExpression, selectTagOfTaggedTemplateExpression, includeElementAccess, skipPastOuterExpressions); + } + ts6.isTaggedTemplateTag = isTaggedTemplateTag; + function isDecoratorTarget(node, includeElementAccess, skipPastOuterExpressions) { + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } + return isCalleeWorker(node, ts6.isDecorator, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); + } + ts6.isDecoratorTarget = isDecoratorTarget; + function isJsxOpeningLikeElementTagName(node, includeElementAccess, skipPastOuterExpressions) { + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } + return isCalleeWorker(node, ts6.isJsxOpeningLikeElement, selectTagNameOfJsxOpeningLikeElement, includeElementAccess, skipPastOuterExpressions); + } + ts6.isJsxOpeningLikeElementTagName = isJsxOpeningLikeElementTagName; + function selectExpressionOfCallOrNewExpressionOrDecorator(node) { + return node.expression; + } + function selectTagOfTaggedTemplateExpression(node) { + return node.tag; + } + function selectTagNameOfJsxOpeningLikeElement(node) { + return node.tagName; + } + function isCalleeWorker(node, pred, calleeSelector, includeElementAccess, skipPastOuterExpressions) { + var target = includeElementAccess ? climbPastPropertyOrElementAccess(node) : climbPastPropertyAccess(node); + if (skipPastOuterExpressions) { + target = ts6.skipOuterExpressions(target); + } + return !!target && !!target.parent && pred(target.parent) && calleeSelector(target.parent) === target; + } + function climbPastPropertyAccess(node) { + return isRightSideOfPropertyAccess(node) ? node.parent : node; + } + ts6.climbPastPropertyAccess = climbPastPropertyAccess; + function climbPastPropertyOrElementAccess(node) { + return isRightSideOfPropertyAccess(node) || isArgumentExpressionOfElementAccess(node) ? node.parent : node; + } + ts6.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; + function getTargetLabel(referenceNode, labelName) { + while (referenceNode) { + if (referenceNode.kind === 253 && referenceNode.label.escapedText === labelName) { + return referenceNode.label; + } + referenceNode = referenceNode.parent; + } + return void 0; + } + ts6.getTargetLabel = getTargetLabel; + function hasPropertyAccessExpressionWithName(node, funcName) { + if (!ts6.isPropertyAccessExpression(node.expression)) { + return false; + } + return node.expression.name.text === funcName; + } + ts6.hasPropertyAccessExpressionWithName = hasPropertyAccessExpressionWithName; + function isJumpStatementTarget(node) { + var _a; + return ts6.isIdentifier(node) && ((_a = ts6.tryCast(node.parent, ts6.isBreakOrContinueStatement)) === null || _a === void 0 ? void 0 : _a.label) === node; + } + ts6.isJumpStatementTarget = isJumpStatementTarget; + function isLabelOfLabeledStatement(node) { + var _a; + return ts6.isIdentifier(node) && ((_a = ts6.tryCast(node.parent, ts6.isLabeledStatement)) === null || _a === void 0 ? void 0 : _a.label) === node; + } + ts6.isLabelOfLabeledStatement = isLabelOfLabeledStatement; + function isLabelName(node) { + return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); + } + ts6.isLabelName = isLabelName; + function isTagName(node) { + var _a; + return ((_a = ts6.tryCast(node.parent, ts6.isJSDocTag)) === null || _a === void 0 ? void 0 : _a.tagName) === node; + } + ts6.isTagName = isTagName; + function isRightSideOfQualifiedName(node) { + var _a; + return ((_a = ts6.tryCast(node.parent, ts6.isQualifiedName)) === null || _a === void 0 ? void 0 : _a.right) === node; + } + ts6.isRightSideOfQualifiedName = isRightSideOfQualifiedName; + function isRightSideOfPropertyAccess(node) { + var _a; + return ((_a = ts6.tryCast(node.parent, ts6.isPropertyAccessExpression)) === null || _a === void 0 ? void 0 : _a.name) === node; + } + ts6.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; + function isArgumentExpressionOfElementAccess(node) { + var _a; + return ((_a = ts6.tryCast(node.parent, ts6.isElementAccessExpression)) === null || _a === void 0 ? void 0 : _a.argumentExpression) === node; + } + ts6.isArgumentExpressionOfElementAccess = isArgumentExpressionOfElementAccess; + function isNameOfModuleDeclaration(node) { + var _a; + return ((_a = ts6.tryCast(node.parent, ts6.isModuleDeclaration)) === null || _a === void 0 ? void 0 : _a.name) === node; + } + ts6.isNameOfModuleDeclaration = isNameOfModuleDeclaration; + function isNameOfFunctionDeclaration(node) { + var _a; + return ts6.isIdentifier(node) && ((_a = ts6.tryCast(node.parent, ts6.isFunctionLike)) === null || _a === void 0 ? void 0 : _a.name) === node; + } + ts6.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { + switch (node.parent.kind) { + case 169: + case 168: + case 299: + case 302: + case 171: + case 170: + case 174: + case 175: + case 264: + return ts6.getNameOfDeclaration(node.parent) === node; + case 209: + return node.parent.argumentExpression === node; + case 164: + return true; + case 198: + return node.parent.parent.kind === 196; + default: + return false; + } + } + ts6.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess; + function isExpressionOfExternalModuleImportEqualsDeclaration(node) { + return ts6.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts6.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node; + } + ts6.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; + function getContainerNode(node) { + if (ts6.isJSDocTypeAlias(node)) { + node = node.parent.parent; + } + while (true) { + node = node.parent; + if (!node) { + return void 0; + } + switch (node.kind) { + case 308: + case 171: + case 170: + case 259: + case 215: + case 174: + case 175: + case 260: + case 261: + case 263: + case 264: + return node; + } + } + } + ts6.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 308: + return ts6.isExternalModule(node) ? "module" : "script"; + case 264: + return "module"; + case 260: + case 228: + return "class"; + case 261: + return "interface"; + case 262: + case 341: + case 348: + return "type"; + case 263: + return "enum"; + case 257: + return getKindOfVariableDeclaration(node); + case 205: + return getKindOfVariableDeclaration(ts6.getRootDeclaration(node)); + case 216: + case 259: + case 215: + return "function"; + case 174: + return "getter"; + case 175: + return "setter"; + case 171: + case 170: + return "method"; + case 299: + var initializer = node.initializer; + return ts6.isFunctionLike(initializer) ? "method" : "property"; + case 169: + case 168: + case 300: + case 301: + return "property"; + case 178: + return "index"; + case 177: + return "construct"; + case 176: + return "call"; + case 173: + case 172: + return "constructor"; + case 165: + return "type parameter"; + case 302: + return "enum member"; + case 166: + return ts6.hasSyntacticModifier( + node, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + ) ? "property" : "parameter"; + case 268: + case 273: + case 278: + case 271: + case 277: + return "alias"; + case 223: + var kind = ts6.getAssignmentDeclarationKind(node); + var right = node.right; + switch (kind) { + case 7: + case 8: + case 9: + case 0: + return ""; + case 1: + case 2: + var rightKind = getNodeKind(right); + return rightKind === "" ? "const" : rightKind; + case 3: + return ts6.isFunctionExpression(right) ? "method" : "property"; + case 4: + return "property"; + case 5: + return ts6.isFunctionExpression(right) ? "method" : "property"; + case 6: + return "local class"; + default: { + ts6.assertType(kind); + return ""; + } + } + case 79: + return ts6.isImportClause(node.parent) ? "alias" : ""; + case 274: + var scriptKind = getNodeKind(node.expression); + return scriptKind === "" ? "const" : scriptKind; + default: + return ""; + } + function getKindOfVariableDeclaration(v) { + return ts6.isVarConst(v) ? "const" : ts6.isLet(v) ? "let" : "var"; + } + } + ts6.getNodeKind = getNodeKind; + function isThis(node) { + switch (node.kind) { + case 108: + return true; + case 79: + return ts6.identifierIsThisKeyword(node) && node.parent.kind === 166; + default: + return false; + } + } + ts6.isThis = isThis; + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= range2.end; + } + ts6.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range2, start, end) { + return range2.pos <= start && range2.end >= end; + } + ts6.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts6.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function nodeOverlapsWithStartEnd(node, sourceFile, start, end) { + return startEndOverlapsWithStartEnd(node.getStart(sourceFile), node.end, start, end); + } + ts6.nodeOverlapsWithStartEnd = nodeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts6.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + function positionBelongsToNode(candidate, position, sourceFile) { + ts6.Debug.assert(candidate.pos <= position); + return position < candidate.end || !isCompletedNode(candidate, sourceFile); + } + ts6.positionBelongsToNode = positionBelongsToNode; + function isCompletedNode(n, sourceFile) { + if (n === void 0 || ts6.nodeIsMissing(n)) { + return false; + } + switch (n.kind) { + case 260: + case 261: + case 263: + case 207: + case 203: + case 184: + case 238: + case 265: + case 266: + case 272: + case 276: + return nodeEndsWith(n, 19, sourceFile); + case 295: + return isCompletedNode(n.block, sourceFile); + case 211: + if (!n.arguments) { + return true; + } + case 210: + case 214: + case 193: + return nodeEndsWith(n, 21, sourceFile); + case 181: + case 182: + return isCompletedNode(n.type, sourceFile); + case 173: + case 174: + case 175: + case 259: + case 215: + case 171: + case 170: + case 177: + case 176: + case 216: + if (n.body) { + return isCompletedNode(n.body, sourceFile); + } + if (n.type) { + return isCompletedNode(n.type, sourceFile); + } + return hasChildOfKind(n, 21, sourceFile); + case 264: + return !!n.body && isCompletedNode(n.body, sourceFile); + case 242: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 241: + return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26, sourceFile); + case 206: + case 204: + case 209: + case 164: + case 186: + return nodeEndsWith(n, 23, sourceFile); + case 178: + if (n.type) { + return isCompletedNode(n.type, sourceFile); + } + return hasChildOfKind(n, 23, sourceFile); + case 292: + case 293: + return false; + case 245: + case 246: + case 247: + case 244: + return isCompletedNode(n.statement, sourceFile); + case 243: + return hasChildOfKind(n, 115, sourceFile) ? nodeEndsWith(n, 21, sourceFile) : isCompletedNode(n.statement, sourceFile); + case 183: + return isCompletedNode(n.exprName, sourceFile); + case 218: + case 217: + case 219: + case 226: + case 227: + var unaryWordExpression = n; + return isCompletedNode(unaryWordExpression.expression, sourceFile); + case 212: + return isCompletedNode(n.template, sourceFile); + case 225: + var lastSpan = ts6.lastOrUndefined(n.templateSpans); + return isCompletedNode(lastSpan, sourceFile); + case 236: + return ts6.nodeIsPresent(n.literal); + case 275: + case 269: + return ts6.nodeIsPresent(n.moduleSpecifier); + case 221: + return isCompletedNode(n.operand, sourceFile); + case 223: + return isCompletedNode(n.right, sourceFile); + case 224: + return isCompletedNode(n.whenFalse, sourceFile); + default: + return true; + } + } + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var lastChild = ts6.last(children); + if (lastChild.kind === expectedLastToken) { + return true; + } else if (lastChild.kind === 26 && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function findListItemInfo(node) { + var list = findContainingList(node); + if (!list) { + return void 0; + } + var children = list.getChildren(); + var listItemIndex = ts6.indexOfNode(children, node); + return { + listItemIndex, + list + }; + } + ts6.findListItemInfo = findListItemInfo; + function hasChildOfKind(n, kind, sourceFile) { + return !!findChildOfKind(n, kind, sourceFile); + } + ts6.hasChildOfKind = hasChildOfKind; + function findChildOfKind(n, kind, sourceFile) { + return ts6.find(n.getChildren(sourceFile), function(c) { + return c.kind === kind; + }); + } + ts6.findChildOfKind = findChildOfKind; + function findContainingList(node) { + var syntaxList = ts6.find(node.parent.getChildren(), function(c) { + return ts6.isSyntaxList(c) && rangeContainsRange(c, node); + }); + ts6.Debug.assert(!syntaxList || ts6.contains(syntaxList.getChildren(), node)); + return syntaxList; + } + ts6.findContainingList = findContainingList; + function isDefaultModifier(node) { + return node.kind === 88; + } + function isClassKeyword(node) { + return node.kind === 84; + } + function isFunctionKeyword(node) { + return node.kind === 98; + } + function getAdjustedLocationForClass(node) { + if (ts6.isNamedDeclaration(node)) { + return node.name; + } + if (ts6.isClassDeclaration(node)) { + var defaultModifier = node.modifiers && ts6.find(node.modifiers, isDefaultModifier); + if (defaultModifier) + return defaultModifier; + } + if (ts6.isClassExpression(node)) { + var classKeyword = ts6.find(node.getChildren(), isClassKeyword); + if (classKeyword) + return classKeyword; + } + } + function getAdjustedLocationForFunction(node) { + if (ts6.isNamedDeclaration(node)) { + return node.name; + } + if (ts6.isFunctionDeclaration(node)) { + var defaultModifier = ts6.find(node.modifiers, isDefaultModifier); + if (defaultModifier) + return defaultModifier; + } + if (ts6.isFunctionExpression(node)) { + var functionKeyword = ts6.find(node.getChildren(), isFunctionKeyword); + if (functionKeyword) + return functionKeyword; + } + } + function getAncestorTypeNode(node) { + var lastTypeNode; + ts6.findAncestor(node, function(a) { + if (ts6.isTypeNode(a)) { + lastTypeNode = a; + } + return !ts6.isQualifiedName(a.parent) && !ts6.isTypeNode(a.parent) && !ts6.isTypeElement(a.parent); + }); + return lastTypeNode; + } + function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { + if (node.flags & (8388608 & ~262144)) + return void 0; + var contextualType = getContextualTypeFromParent(node, checker); + if (contextualType) + return contextualType; + var ancestorTypeNode = getAncestorTypeNode(node); + return ancestorTypeNode && checker.getTypeAtLocation(ancestorTypeNode); + } + ts6.getContextualTypeFromParentOrAncestorTypeNode = getContextualTypeFromParentOrAncestorTypeNode; + function getAdjustedLocationForDeclaration(node, forRename) { + if (!forRename) { + switch (node.kind) { + case 260: + case 228: + return getAdjustedLocationForClass(node); + case 259: + case 215: + return getAdjustedLocationForFunction(node); + case 173: + return node; + } + } + if (ts6.isNamedDeclaration(node)) { + return node.name; + } + } + function getAdjustedLocationForImportDeclaration(node, forRename) { + if (node.importClause) { + if (node.importClause.name && node.importClause.namedBindings) { + return; + } + if (node.importClause.name) { + return node.importClause.name; + } + if (node.importClause.namedBindings) { + if (ts6.isNamedImports(node.importClause.namedBindings)) { + var onlyBinding = ts6.singleOrUndefined(node.importClause.namedBindings.elements); + if (!onlyBinding) { + return; + } + return onlyBinding.name; + } else if (ts6.isNamespaceImport(node.importClause.namedBindings)) { + return node.importClause.namedBindings.name; + } + } + } + if (!forRename) { + return node.moduleSpecifier; + } + } + function getAdjustedLocationForExportDeclaration(node, forRename) { + if (node.exportClause) { + if (ts6.isNamedExports(node.exportClause)) { + var onlyBinding = ts6.singleOrUndefined(node.exportClause.elements); + if (!onlyBinding) { + return; + } + return node.exportClause.elements[0].name; + } else if (ts6.isNamespaceExport(node.exportClause)) { + return node.exportClause.name; + } + } + if (!forRename) { + return node.moduleSpecifier; + } + } + function getAdjustedLocationForHeritageClause(node) { + if (node.types.length === 1) { + return node.types[0].expression; + } + } + function getAdjustedLocation(node, forRename) { + var parent = node.parent; + if (ts6.isModifier(node) && (forRename || node.kind !== 88) ? ts6.canHaveModifiers(parent) && ts6.contains(parent.modifiers, node) : node.kind === 84 ? ts6.isClassDeclaration(parent) || ts6.isClassExpression(node) : node.kind === 98 ? ts6.isFunctionDeclaration(parent) || ts6.isFunctionExpression(node) : node.kind === 118 ? ts6.isInterfaceDeclaration(parent) : node.kind === 92 ? ts6.isEnumDeclaration(parent) : node.kind === 154 ? ts6.isTypeAliasDeclaration(parent) : node.kind === 143 || node.kind === 142 ? ts6.isModuleDeclaration(parent) : node.kind === 100 ? ts6.isImportEqualsDeclaration(parent) : node.kind === 137 ? ts6.isGetAccessorDeclaration(parent) : node.kind === 151 && ts6.isSetAccessorDeclaration(parent)) { + var location = getAdjustedLocationForDeclaration(parent, forRename); + if (location) { + return location; + } + } + if ((node.kind === 113 || node.kind === 85 || node.kind === 119) && ts6.isVariableDeclarationList(parent) && parent.declarations.length === 1) { + var decl = parent.declarations[0]; + if (ts6.isIdentifier(decl.name)) { + return decl.name; + } + } + if (node.kind === 154) { + if (ts6.isImportClause(parent) && parent.isTypeOnly) { + var location = getAdjustedLocationForImportDeclaration(parent.parent, forRename); + if (location) { + return location; + } + } + if (ts6.isExportDeclaration(parent) && parent.isTypeOnly) { + var location = getAdjustedLocationForExportDeclaration(parent, forRename); + if (location) { + return location; + } + } + } + if (node.kind === 128) { + if (ts6.isImportSpecifier(parent) && parent.propertyName || ts6.isExportSpecifier(parent) && parent.propertyName || ts6.isNamespaceImport(parent) || ts6.isNamespaceExport(parent)) { + return parent.name; + } + if (ts6.isExportDeclaration(parent) && parent.exportClause && ts6.isNamespaceExport(parent.exportClause)) { + return parent.exportClause.name; + } + } + if (node.kind === 100 && ts6.isImportDeclaration(parent)) { + var location = getAdjustedLocationForImportDeclaration(parent, forRename); + if (location) { + return location; + } + } + if (node.kind === 93) { + if (ts6.isExportDeclaration(parent)) { + var location = getAdjustedLocationForExportDeclaration(parent, forRename); + if (location) { + return location; + } + } + if (ts6.isExportAssignment(parent)) { + return ts6.skipOuterExpressions(parent.expression); + } + } + if (node.kind === 147 && ts6.isExternalModuleReference(parent)) { + return parent.expression; + } + if (node.kind === 158 && (ts6.isImportDeclaration(parent) || ts6.isExportDeclaration(parent)) && parent.moduleSpecifier) { + return parent.moduleSpecifier; + } + if ((node.kind === 94 || node.kind === 117) && ts6.isHeritageClause(parent) && parent.token === node.kind) { + var location = getAdjustedLocationForHeritageClause(parent); + if (location) { + return location; + } + } + if (node.kind === 94) { + if (ts6.isTypeParameterDeclaration(parent) && parent.constraint && ts6.isTypeReferenceNode(parent.constraint)) { + return parent.constraint.typeName; + } + if (ts6.isConditionalTypeNode(parent) && ts6.isTypeReferenceNode(parent.extendsType)) { + return parent.extendsType.typeName; + } + } + if (node.kind === 138 && ts6.isInferTypeNode(parent)) { + return parent.typeParameter.name; + } + if (node.kind === 101 && ts6.isTypeParameterDeclaration(parent) && ts6.isMappedTypeNode(parent.parent)) { + return parent.name; + } + if (node.kind === 141 && ts6.isTypeOperatorNode(parent) && parent.operator === 141 && ts6.isTypeReferenceNode(parent.type)) { + return parent.type.typeName; + } + if (node.kind === 146 && ts6.isTypeOperatorNode(parent) && parent.operator === 146 && ts6.isArrayTypeNode(parent.type) && ts6.isTypeReferenceNode(parent.type.elementType)) { + return parent.type.elementType.typeName; + } + if (!forRename) { + if (node.kind === 103 && ts6.isNewExpression(parent) || node.kind === 114 && ts6.isVoidExpression(parent) || node.kind === 112 && ts6.isTypeOfExpression(parent) || node.kind === 133 && ts6.isAwaitExpression(parent) || node.kind === 125 && ts6.isYieldExpression(parent) || node.kind === 89 && ts6.isDeleteExpression(parent)) { + if (parent.expression) { + return ts6.skipOuterExpressions(parent.expression); + } + } + if ((node.kind === 101 || node.kind === 102) && ts6.isBinaryExpression(parent) && parent.operatorToken === node) { + return ts6.skipOuterExpressions(parent.right); + } + if (node.kind === 128 && ts6.isAsExpression(parent) && ts6.isTypeReferenceNode(parent.type)) { + return parent.type.typeName; + } + if (node.kind === 101 && ts6.isForInStatement(parent) || node.kind === 162 && ts6.isForOfStatement(parent)) { + return ts6.skipOuterExpressions(parent.expression); + } + } + return node; + } + function getAdjustedReferenceLocation(node) { + return getAdjustedLocation( + node, + /*forRename*/ + false + ); + } + ts6.getAdjustedReferenceLocation = getAdjustedReferenceLocation; + function getAdjustedRenameLocation(node) { + return getAdjustedLocation( + node, + /*forRename*/ + true + ); + } + ts6.getAdjustedRenameLocation = getAdjustedRenameLocation; + function getTouchingPropertyName(sourceFile, position) { + return getTouchingToken(sourceFile, position, function(n) { + return ts6.isPropertyNameLiteral(n) || ts6.isKeyword(n.kind) || ts6.isPrivateIdentifier(n); + }); + } + ts6.getTouchingPropertyName = getTouchingPropertyName; + function getTouchingToken(sourceFile, position, includePrecedingTokenAtEndPosition) { + return getTokenAtPositionWorker( + sourceFile, + position, + /*allowPositionInLeadingTrivia*/ + false, + includePrecedingTokenAtEndPosition, + /*includeEndPosition*/ + false + ); + } + ts6.getTouchingToken = getTouchingToken; + function getTokenAtPosition(sourceFile, position) { + return getTokenAtPositionWorker( + sourceFile, + position, + /*allowPositionInLeadingTrivia*/ + true, + /*includePrecedingTokenAtEndPosition*/ + void 0, + /*includeEndPosition*/ + false + ); + } + ts6.getTokenAtPosition = getTokenAtPosition; + function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includePrecedingTokenAtEndPosition, includeEndPosition) { + var current = sourceFile; + var foundToken; + var _loop_1 = function() { + var children = current.getChildren(sourceFile); + var i = ts6.binarySearchKey(children, position, function(_, i2) { + return i2; + }, function(middle, _) { + var end = children[middle].getEnd(); + if (end < position) { + return -1; + } + var start = allowPositionInLeadingTrivia ? children[middle].getFullStart() : children[middle].getStart( + sourceFile, + /*includeJsDoc*/ + true + ); + if (start > position) { + return 1; + } + if (nodeContainsPosition(children[middle], start, end)) { + if (children[middle - 1]) { + if (nodeContainsPosition(children[middle - 1])) { + return 1; + } + } + return 0; + } + if (includePrecedingTokenAtEndPosition && start === position && children[middle - 1] && children[middle - 1].getEnd() === position && nodeContainsPosition(children[middle - 1])) { + return 1; + } + return -1; + }); + if (foundToken) { + return { value: foundToken }; + } + if (i >= 0 && children[i]) { + current = children[i]; + return "continue-outer"; + } + return { value: current }; + }; + outer: + while (true) { + var state_1 = _loop_1(); + if (typeof state_1 === "object") + return state_1.value; + switch (state_1) { + case "continue-outer": + continue outer; + } + } + function nodeContainsPosition(node, start, end) { + end !== null && end !== void 0 ? end : end = node.getEnd(); + if (end < position) { + return false; + } + start !== null && start !== void 0 ? start : start = allowPositionInLeadingTrivia ? node.getFullStart() : node.getStart( + sourceFile, + /*includeJsDoc*/ + true + ); + if (start > position) { + return false; + } + if (position < end || position === end && (node.kind === 1 || includeEndPosition)) { + return true; + } else if (includePrecedingTokenAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, node); + if (previousToken && includePrecedingTokenAtEndPosition(previousToken)) { + foundToken = previousToken; + return true; + } + } + return false; + } + } + function findFirstNonJsxWhitespaceToken(sourceFile, position) { + var tokenAtPosition = getTokenAtPosition(sourceFile, position); + while (isWhiteSpaceOnlyJsxText(tokenAtPosition)) { + var nextToken = findNextToken(tokenAtPosition, tokenAtPosition.parent, sourceFile); + if (!nextToken) + return; + tokenAtPosition = nextToken; + } + return tokenAtPosition; + } + ts6.findFirstNonJsxWhitespaceToken = findFirstNonJsxWhitespaceToken; + function findTokenOnLeftOfPosition(file, position) { + var tokenAtPosition = getTokenAtPosition(file, position); + if (ts6.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + return findPrecedingToken(position, file); + } + ts6.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; + function findNextToken(previousToken, parent, sourceFile) { + return find(parent); + function find(n) { + if (ts6.isToken(n) && n.pos === previousToken.end) { + return n; + } + return ts6.firstDefined(n.getChildren(sourceFile), function(child) { + var shouldDiveInChildNode = ( + // previous token is enclosed somewhere in the child + child.pos <= previousToken.pos && child.end > previousToken.end || // previous token ends exactly at the beginning of child + child.pos === previousToken.end + ); + return shouldDiveInChildNode && nodeHasTokens(child, sourceFile) ? find(child) : void 0; + }); + } + } + ts6.findNextToken = findNextToken; + function findPrecedingToken(position, sourceFile, startNode, excludeJsdoc) { + var result = find(startNode || sourceFile); + ts6.Debug.assert(!(result && isWhiteSpaceOnlyJsxText(result))); + return result; + function find(n) { + if (isNonWhitespaceToken(n) && n.kind !== 1) { + return n; + } + var children = n.getChildren(sourceFile); + var i = ts6.binarySearchKey(children, position, function(_, i2) { + return i2; + }, function(middle, _) { + if (position < children[middle].end) { + if (!children[middle - 1] || position >= children[middle - 1].end) { + return 0; + } + return 1; + } + return -1; + }); + if (i >= 0 && children[i]) { + var child = children[i]; + if (position < child.end) { + var start = child.getStart( + sourceFile, + /*includeJsDoc*/ + !excludeJsdoc + ); + var lookInPreviousChild = start >= position || // cursor in the leading trivia + !nodeHasTokens(child, sourceFile) || isWhiteSpaceOnlyJsxText(child); + if (lookInPreviousChild) { + var candidate_1 = findRightmostChildNodeWithTokens( + children, + /*exclusiveStartPosition*/ + i, + sourceFile, + n.kind + ); + return candidate_1 && findRightmostToken(candidate_1, sourceFile); + } else { + return find(child); + } + } + } + ts6.Debug.assert(startNode !== void 0 || n.kind === 308 || n.kind === 1 || ts6.isJSDocCommentContainingNode(n)); + var candidate = findRightmostChildNodeWithTokens( + children, + /*exclusiveStartPosition*/ + children.length, + sourceFile, + n.kind + ); + return candidate && findRightmostToken(candidate, sourceFile); + } + } + ts6.findPrecedingToken = findPrecedingToken; + function isNonWhitespaceToken(n) { + return ts6.isToken(n) && !isWhiteSpaceOnlyJsxText(n); + } + function findRightmostToken(n, sourceFile) { + if (isNonWhitespaceToken(n)) { + return n; + } + var children = n.getChildren(sourceFile); + if (children.length === 0) { + return n; + } + var candidate = findRightmostChildNodeWithTokens( + children, + /*exclusiveStartPosition*/ + children.length, + sourceFile, + n.kind + ); + return candidate && findRightmostToken(candidate, sourceFile); + } + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile, parentKind) { + for (var i = exclusiveStartPosition - 1; i >= 0; i--) { + var child = children[i]; + if (isWhiteSpaceOnlyJsxText(child)) { + if (i === 0 && (parentKind === 11 || parentKind === 282)) { + ts6.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); + } + } else if (nodeHasTokens(children[i], sourceFile)) { + return children[i]; + } + } + } + function isInString(sourceFile, position, previousToken) { + if (previousToken === void 0) { + previousToken = findPrecedingToken(position, sourceFile); + } + if (previousToken && ts6.isStringTextContainingNode(previousToken)) { + var start = previousToken.getStart(sourceFile); + var end = previousToken.getEnd(); + if (start < position && position < end) { + return true; + } + if (position === end) { + return !!previousToken.isUnterminated; + } + } + return false; + } + ts6.isInString = isInString; + function isInsideJsxElementOrAttribute(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (!token) { + return false; + } + if (token.kind === 11) { + return true; + } + if (token.kind === 29 && token.parent.kind === 11) { + return true; + } + if (token.kind === 29 && token.parent.kind === 291) { + return true; + } + if (token && token.kind === 19 && token.parent.kind === 291) { + return true; + } + if (token.kind === 29 && token.parent.kind === 284) { + return true; + } + return false; + } + ts6.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; + function isWhiteSpaceOnlyJsxText(node) { + return ts6.isJsxText(node) && node.containsOnlyTriviaWhiteSpaces; + } + function isInTemplateString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return ts6.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + ts6.isInTemplateString = isInTemplateString; + function isInJSXText(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (ts6.isJsxText(token)) { + return true; + } + if (token.kind === 18 && ts6.isJsxExpression(token.parent) && ts6.isJsxElement(token.parent.parent)) { + return true; + } + if (token.kind === 29 && ts6.isJsxOpeningLikeElement(token.parent) && ts6.isJsxElement(token.parent.parent)) { + return true; + } + return false; + } + ts6.isInJSXText = isInJSXText; + function isInsideJsxElement(sourceFile, position) { + function isInsideJsxElementTraversal(node) { + while (node) { + if (node.kind >= 282 && node.kind <= 291 || node.kind === 11 || node.kind === 29 || node.kind === 31 || node.kind === 79 || node.kind === 19 || node.kind === 18 || node.kind === 43) { + node = node.parent; + } else if (node.kind === 281) { + if (position > node.getStart(sourceFile)) + return true; + node = node.parent; + } else { + return false; + } + } + return false; + } + return isInsideJsxElementTraversal(getTokenAtPosition(sourceFile, position)); + } + ts6.isInsideJsxElement = isInsideJsxElement; + function findPrecedingMatchingToken(token, matchingTokenKind, sourceFile) { + var closeTokenText = ts6.tokenToString(token.kind); + var matchingTokenText = ts6.tokenToString(matchingTokenKind); + var tokenFullStart = token.getFullStart(); + var bestGuessIndex = sourceFile.text.lastIndexOf(matchingTokenText, tokenFullStart); + if (bestGuessIndex === -1) { + return void 0; + } + if (sourceFile.text.lastIndexOf(closeTokenText, tokenFullStart - 1) < bestGuessIndex) { + var nodeAtGuess = findPrecedingToken(bestGuessIndex + 1, sourceFile); + if (nodeAtGuess && nodeAtGuess.kind === matchingTokenKind) { + return nodeAtGuess; + } + } + var tokenKind = token.kind; + var remainingMatchingTokens = 0; + while (true) { + var preceding = findPrecedingToken(token.getFullStart(), sourceFile); + if (!preceding) { + return void 0; + } + token = preceding; + if (token.kind === matchingTokenKind) { + if (remainingMatchingTokens === 0) { + return token; + } + remainingMatchingTokens--; + } else if (token.kind === tokenKind) { + remainingMatchingTokens++; + } + } + } + ts6.findPrecedingMatchingToken = findPrecedingMatchingToken; + function removeOptionality(type, isOptionalExpression, isOptionalChain2) { + return isOptionalExpression ? type.getNonNullableType() : isOptionalChain2 ? type.getNonOptionalType() : type; + } + ts6.removeOptionality = removeOptionality; + function isPossiblyTypeArgumentPosition(token, sourceFile, checker) { + var info = getPossibleTypeArgumentsInfo(token, sourceFile); + return info !== void 0 && (ts6.isPartOfTypeNode(info.called) || getPossibleGenericSignatures(info.called, info.nTypeArguments, checker).length !== 0 || isPossiblyTypeArgumentPosition(info.called, sourceFile, checker)); + } + ts6.isPossiblyTypeArgumentPosition = isPossiblyTypeArgumentPosition; + function getPossibleGenericSignatures(called, typeArgumentCount, checker) { + var type = checker.getTypeAtLocation(called); + if (ts6.isOptionalChain(called.parent)) { + type = removeOptionality( + type, + ts6.isOptionalChainRoot(called.parent), + /*isOptionalChain*/ + true + ); + } + var signatures = ts6.isNewExpression(called.parent) ? type.getConstructSignatures() : type.getCallSignatures(); + return signatures.filter(function(candidate) { + return !!candidate.typeParameters && candidate.typeParameters.length >= typeArgumentCount; + }); + } + ts6.getPossibleGenericSignatures = getPossibleGenericSignatures; + function getPossibleTypeArgumentsInfo(tokenIn, sourceFile) { + if (sourceFile.text.lastIndexOf("<", tokenIn ? tokenIn.pos : sourceFile.text.length) === -1) { + return void 0; + } + var token = tokenIn; + var remainingLessThanTokens = 0; + var nTypeArguments = 0; + while (token) { + switch (token.kind) { + case 29: + token = findPrecedingToken(token.getFullStart(), sourceFile); + if (token && token.kind === 28) { + token = findPrecedingToken(token.getFullStart(), sourceFile); + } + if (!token || !ts6.isIdentifier(token)) + return void 0; + if (!remainingLessThanTokens) { + return ts6.isDeclarationName(token) ? void 0 : { called: token, nTypeArguments }; + } + remainingLessThanTokens--; + break; + case 49: + remainingLessThanTokens = 3; + break; + case 48: + remainingLessThanTokens = 2; + break; + case 31: + remainingLessThanTokens++; + break; + case 19: + token = findPrecedingMatchingToken(token, 18, sourceFile); + if (!token) + return void 0; + break; + case 21: + token = findPrecedingMatchingToken(token, 20, sourceFile); + if (!token) + return void 0; + break; + case 23: + token = findPrecedingMatchingToken(token, 22, sourceFile); + if (!token) + return void 0; + break; + case 27: + nTypeArguments++; + break; + case 38: + case 79: + case 10: + case 8: + case 9: + case 110: + case 95: + case 112: + case 94: + case 141: + case 24: + case 51: + case 57: + case 58: + break; + default: + if (ts6.isTypeNode(token)) { + break; + } + return void 0; + } + token = findPrecedingToken(token.getFullStart(), sourceFile); + } + return void 0; + } + ts6.getPossibleTypeArgumentsInfo = getPossibleTypeArgumentsInfo; + function isInComment(sourceFile, position, tokenAtPosition) { + return ts6.formatting.getRangeOfEnclosingComment( + sourceFile, + position, + /*precedingToken*/ + void 0, + tokenAtPosition + ); + } + ts6.isInComment = isInComment; + function hasDocComment(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return !!ts6.findAncestor(token, ts6.isJSDoc); + } + ts6.hasDocComment = hasDocComment; + function nodeHasTokens(n, sourceFile) { + return n.kind === 1 ? !!n.jsDoc : n.getWidth(sourceFile) !== 0; + } + function getNodeModifiers(node, excludeFlags) { + if (excludeFlags === void 0) { + excludeFlags = 0; + } + var result = []; + var flags = ts6.isDeclaration(node) ? ts6.getCombinedNodeFlagsAlwaysIncludeJSDoc(node) & ~excludeFlags : 0; + if (flags & 8) + result.push( + "private" + /* ScriptElementKindModifier.privateMemberModifier */ + ); + if (flags & 16) + result.push( + "protected" + /* ScriptElementKindModifier.protectedMemberModifier */ + ); + if (flags & 4) + result.push( + "public" + /* ScriptElementKindModifier.publicMemberModifier */ + ); + if (flags & 32 || ts6.isClassStaticBlockDeclaration(node)) + result.push( + "static" + /* ScriptElementKindModifier.staticModifier */ + ); + if (flags & 256) + result.push( + "abstract" + /* ScriptElementKindModifier.abstractModifier */ + ); + if (flags & 1) + result.push( + "export" + /* ScriptElementKindModifier.exportedModifier */ + ); + if (flags & 8192) + result.push( + "deprecated" + /* ScriptElementKindModifier.deprecatedModifier */ + ); + if (node.flags & 16777216) + result.push( + "declare" + /* ScriptElementKindModifier.ambientModifier */ + ); + if (node.kind === 274) + result.push( + "export" + /* ScriptElementKindModifier.exportedModifier */ + ); + return result.length > 0 ? result.join(",") : ""; + } + ts6.getNodeModifiers = getNodeModifiers; + function getTypeArgumentOrTypeParameterList(node) { + if (node.kind === 180 || node.kind === 210) { + return node.typeArguments; + } + if (ts6.isFunctionLike(node) || node.kind === 260 || node.kind === 261) { + return node.typeParameters; + } + return void 0; + } + ts6.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; + function isComment(kind) { + return kind === 2 || kind === 3; + } + ts6.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 10 || kind === 13 || ts6.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts6.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; + function isPunctuation(kind) { + return 18 <= kind && kind <= 78; + } + ts6.isPunctuation = isPunctuation; + function isInsideTemplateLiteral(node, position, sourceFile) { + return ts6.isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end; + } + ts6.isInsideTemplateLiteral = isInsideTemplateLiteral; + function isAccessibilityModifier(kind) { + switch (kind) { + case 123: + case 121: + case 122: + return true; + } + return false; + } + ts6.isAccessibilityModifier = isAccessibilityModifier; + function cloneCompilerOptions(options) { + var result = ts6.clone(options); + ts6.setConfigFileInOptions(result, options && options.configFile); + return result; + } + ts6.cloneCompilerOptions = cloneCompilerOptions; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { + if (node.kind === 206 || node.kind === 207) { + if (node.parent.kind === 223 && node.parent.left === node && node.parent.operatorToken.kind === 63) { + return true; + } + if (node.parent.kind === 247 && node.parent.initializer === node) { + return true; + } + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 ? node.parent.parent : node.parent)) { + return true; + } + } + return false; + } + ts6.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; + function isInReferenceComment(sourceFile, position) { + return isInReferenceCommentWorker( + sourceFile, + position, + /*shouldBeReference*/ + true + ); + } + ts6.isInReferenceComment = isInReferenceComment; + function isInNonReferenceComment(sourceFile, position) { + return isInReferenceCommentWorker( + sourceFile, + position, + /*shouldBeReference*/ + false + ); + } + ts6.isInNonReferenceComment = isInNonReferenceComment; + function isInReferenceCommentWorker(sourceFile, position, shouldBeReference) { + var range2 = isInComment( + sourceFile, + position, + /*tokenAtPosition*/ + void 0 + ); + return !!range2 && shouldBeReference === tripleSlashDirectivePrefixRegex.test(sourceFile.text.substring(range2.pos, range2.end)); + } + function getReplacementSpanForContextToken(contextToken) { + if (!contextToken) + return void 0; + switch (contextToken.kind) { + case 10: + case 14: + return createTextSpanFromStringLiteralLikeContent(contextToken); + default: + return createTextSpanFromNode(contextToken); + } + } + ts6.getReplacementSpanForContextToken = getReplacementSpanForContextToken; + function createTextSpanFromNode(node, sourceFile, endNode) { + return ts6.createTextSpanFromBounds(node.getStart(sourceFile), (endNode || node).getEnd()); + } + ts6.createTextSpanFromNode = createTextSpanFromNode; + function createTextSpanFromStringLiteralLikeContent(node) { + if (node.isUnterminated) + return void 0; + return ts6.createTextSpanFromBounds(node.getStart() + 1, node.getEnd() - 1); + } + ts6.createTextSpanFromStringLiteralLikeContent = createTextSpanFromStringLiteralLikeContent; + function createTextRangeFromNode(node, sourceFile) { + return ts6.createRange(node.getStart(sourceFile), node.end); + } + ts6.createTextRangeFromNode = createTextRangeFromNode; + function createTextSpanFromRange(range2) { + return ts6.createTextSpanFromBounds(range2.pos, range2.end); + } + ts6.createTextSpanFromRange = createTextSpanFromRange; + function createTextRangeFromSpan(span) { + return ts6.createRange(span.start, span.start + span.length); + } + ts6.createTextRangeFromSpan = createTextRangeFromSpan; + function createTextChangeFromStartLength(start, length, newText) { + return createTextChange(ts6.createTextSpan(start, length), newText); + } + ts6.createTextChangeFromStartLength = createTextChangeFromStartLength; + function createTextChange(span, newText) { + return { span, newText }; + } + ts6.createTextChange = createTextChange; + ts6.typeKeywords = [ + 131, + 129, + 160, + 134, + 95, + 138, + 141, + 144, + 104, + 148, + 149, + 146, + 152, + 153, + 110, + 114, + 155, + 156, + 157 + ]; + function isTypeKeyword(kind) { + return ts6.contains(ts6.typeKeywords, kind); + } + ts6.isTypeKeyword = isTypeKeyword; + function isTypeKeywordToken(node) { + return node.kind === 154; + } + ts6.isTypeKeywordToken = isTypeKeywordToken; + function isTypeKeywordTokenOrIdentifier(node) { + return isTypeKeywordToken(node) || ts6.isIdentifier(node) && node.text === "type"; + } + ts6.isTypeKeywordTokenOrIdentifier = isTypeKeywordTokenOrIdentifier; + function isExternalModuleSymbol(moduleSymbol) { + return !!(moduleSymbol.flags & 1536) && moduleSymbol.name.charCodeAt(0) === 34; + } + ts6.isExternalModuleSymbol = isExternalModuleSymbol; + function nodeSeenTracker() { + var seen = []; + return function(node) { + var id = ts6.getNodeId(node); + return !seen[id] && (seen[id] = true); + }; + } + ts6.nodeSeenTracker = nodeSeenTracker; + function getSnapshotText(snap) { + return snap.getText(0, snap.getLength()); + } + ts6.getSnapshotText = getSnapshotText; + function repeatString(str, count) { + var result = ""; + for (var i = 0; i < count; i++) { + result += str; + } + return result; + } + ts6.repeatString = repeatString; + function skipConstraint(type) { + return type.isTypeParameter() ? type.getConstraint() || type : type; + } + ts6.skipConstraint = skipConstraint; + function getNameFromPropertyName(name) { + return name.kind === 164 ? ts6.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : void 0 : ts6.isPrivateIdentifier(name) ? ts6.idText(name) : ts6.getTextOfIdentifierOrLiteral(name); + } + ts6.getNameFromPropertyName = getNameFromPropertyName; + function programContainsModules(program) { + return program.getSourceFiles().some(function(s) { + return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!(s.externalModuleIndicator || s.commonJsModuleIndicator); + }); + } + ts6.programContainsModules = programContainsModules; + function programContainsEsModules(program) { + return program.getSourceFiles().some(function(s) { + return !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator; + }); + } + ts6.programContainsEsModules = programContainsEsModules; + function compilerOptionsIndicateEsModules(compilerOptions) { + return !!compilerOptions.module || ts6.getEmitScriptTarget(compilerOptions) >= 2 || !!compilerOptions.noEmit; + } + ts6.compilerOptionsIndicateEsModules = compilerOptionsIndicateEsModules; + function createModuleSpecifierResolutionHost(program, host) { + return { + fileExists: function(fileName) { + return program.fileExists(fileName); + }, + getCurrentDirectory: function() { + return host.getCurrentDirectory(); + }, + readFile: ts6.maybeBind(host, host.readFile), + useCaseSensitiveFileNames: ts6.maybeBind(host, host.useCaseSensitiveFileNames), + getSymlinkCache: ts6.maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache, + getModuleSpecifierCache: ts6.maybeBind(host, host.getModuleSpecifierCache), + getPackageJsonInfoCache: function() { + var _a; + return (_a = program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); + }, + getGlobalTypingsCacheLocation: ts6.maybeBind(host, host.getGlobalTypingsCacheLocation), + redirectTargetsMap: program.redirectTargetsMap, + getProjectReferenceRedirect: function(fileName) { + return program.getProjectReferenceRedirect(fileName); + }, + isSourceOfProjectReferenceRedirect: function(fileName) { + return program.isSourceOfProjectReferenceRedirect(fileName); + }, + getNearestAncestorDirectoryWithPackageJson: ts6.maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson), + getFileIncludeReasons: function() { + return program.getFileIncludeReasons(); + } + }; + } + ts6.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost; + function getModuleSpecifierResolverHost(program, host) { + return __assign(__assign({}, createModuleSpecifierResolutionHost(program, host)), { getCommonSourceDirectory: function() { + return program.getCommonSourceDirectory(); + } }); + } + ts6.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost; + function moduleResolutionRespectsExports(moduleResolution) { + return moduleResolution >= ts6.ModuleResolutionKind.Node16 && moduleResolution <= ts6.ModuleResolutionKind.NodeNext; + } + ts6.moduleResolutionRespectsExports = moduleResolutionRespectsExports; + function moduleResolutionUsesNodeModules(moduleResolution) { + return moduleResolution === ts6.ModuleResolutionKind.NodeJs || moduleResolution >= ts6.ModuleResolutionKind.Node16 && moduleResolution <= ts6.ModuleResolutionKind.NodeNext; + } + ts6.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules; + function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) { + return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0; + } + ts6.makeImportIfNecessary = makeImportIfNecessary; + function makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference, isTypeOnly) { + return ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + defaultImport || namedImports ? ts6.factory.createImportClause(!!isTypeOnly, defaultImport, namedImports && namedImports.length ? ts6.factory.createNamedImports(namedImports) : void 0) : void 0, + typeof moduleSpecifier === "string" ? makeStringLiteral(moduleSpecifier, quotePreference) : moduleSpecifier, + /*assertClause*/ + void 0 + ); + } + ts6.makeImport = makeImport; + function makeStringLiteral(text, quotePreference) { + return ts6.factory.createStringLiteral( + text, + quotePreference === 0 + /* QuotePreference.Single */ + ); + } + ts6.makeStringLiteral = makeStringLiteral; + var QuotePreference; + (function(QuotePreference2) { + QuotePreference2[QuotePreference2["Single"] = 0] = "Single"; + QuotePreference2[QuotePreference2["Double"] = 1] = "Double"; + })(QuotePreference = ts6.QuotePreference || (ts6.QuotePreference = {})); + function quotePreferenceFromString(str, sourceFile) { + return ts6.isStringDoubleQuoted(str, sourceFile) ? 1 : 0; + } + ts6.quotePreferenceFromString = quotePreferenceFromString; + function getQuotePreference(sourceFile, preferences) { + if (preferences.quotePreference && preferences.quotePreference !== "auto") { + return preferences.quotePreference === "single" ? 0 : 1; + } else { + var firstModuleSpecifier = sourceFile.imports && ts6.find(sourceFile.imports, function(n) { + return ts6.isStringLiteral(n) && !ts6.nodeIsSynthesized(n.parent); + }); + return firstModuleSpecifier ? quotePreferenceFromString(firstModuleSpecifier, sourceFile) : 1; + } + } + ts6.getQuotePreference = getQuotePreference; + function getQuoteFromPreference(qp) { + switch (qp) { + case 0: + return "'"; + case 1: + return '"'; + default: + return ts6.Debug.assertNever(qp); + } + } + ts6.getQuoteFromPreference = getQuoteFromPreference; + function symbolNameNoDefault(symbol) { + var escaped = symbolEscapedNameNoDefault(symbol); + return escaped === void 0 ? void 0 : ts6.unescapeLeadingUnderscores(escaped); + } + ts6.symbolNameNoDefault = symbolNameNoDefault; + function symbolEscapedNameNoDefault(symbol) { + if (symbol.escapedName !== "default") { + return symbol.escapedName; + } + return ts6.firstDefined(symbol.declarations, function(decl) { + var name = ts6.getNameOfDeclaration(decl); + return name && name.kind === 79 ? name.escapedText : void 0; + }); + } + ts6.symbolEscapedNameNoDefault = symbolEscapedNameNoDefault; + function isModuleSpecifierLike(node) { + return ts6.isStringLiteralLike(node) && (ts6.isExternalModuleReference(node.parent) || ts6.isImportDeclaration(node.parent) || ts6.isRequireCall( + node.parent, + /*requireStringLiteralLikeArgument*/ + false + ) && node.parent.arguments[0] === node || ts6.isImportCall(node.parent) && node.parent.arguments[0] === node); + } + ts6.isModuleSpecifierLike = isModuleSpecifierLike; + function isObjectBindingElementWithoutPropertyName(bindingElement) { + return ts6.isBindingElement(bindingElement) && ts6.isObjectBindingPattern(bindingElement.parent) && ts6.isIdentifier(bindingElement.name) && !bindingElement.propertyName; + } + ts6.isObjectBindingElementWithoutPropertyName = isObjectBindingElementWithoutPropertyName; + function getPropertySymbolFromBindingElement(checker, bindingElement) { + var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + ts6.getPropertySymbolFromBindingElement = getPropertySymbolFromBindingElement; + function getParentNodeInSpan(node, file, span) { + if (!node) + return void 0; + while (node.parent) { + if (ts6.isSourceFile(node.parent) || !spanContainsNode(span, node.parent, file)) { + return node; + } + node = node.parent; + } + } + ts6.getParentNodeInSpan = getParentNodeInSpan; + function spanContainsNode(span, node, file) { + return ts6.textSpanContainsPosition(span, node.getStart(file)) && node.getEnd() <= ts6.textSpanEnd(span); + } + function findModifier(node, kind) { + return ts6.canHaveModifiers(node) ? ts6.find(node.modifiers, function(m) { + return m.kind === kind; + }) : void 0; + } + ts6.findModifier = findModifier; + function insertImports(changes, sourceFile, imports, blankLineBetween) { + var decl = ts6.isArray(imports) ? imports[0] : imports; + var importKindPredicate = decl.kind === 240 ? ts6.isRequireVariableStatement : ts6.isAnyImportSyntax; + var existingImportStatements = ts6.filter(sourceFile.statements, importKindPredicate); + var sortedNewImports = ts6.isArray(imports) ? ts6.stableSort(imports, ts6.OrganizeImports.compareImportsOrRequireStatements) : [imports]; + if (!existingImportStatements.length) { + changes.insertNodesAtTopOfFile(sourceFile, sortedNewImports, blankLineBetween); + } else if (existingImportStatements && ts6.OrganizeImports.importsAreSorted(existingImportStatements)) { + for (var _i = 0, sortedNewImports_1 = sortedNewImports; _i < sortedNewImports_1.length; _i++) { + var newImport = sortedNewImports_1[_i]; + var insertionIndex = ts6.OrganizeImports.getImportDeclarationInsertionIndex(existingImportStatements, newImport); + if (insertionIndex === 0) { + var options = existingImportStatements[0] === sourceFile.statements[0] ? { leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.Exclude } : {}; + changes.insertNodeBefore( + sourceFile, + existingImportStatements[0], + newImport, + /*blankLineBetween*/ + false, + options + ); + } else { + var prevImport = existingImportStatements[insertionIndex - 1]; + changes.insertNodeAfter(sourceFile, prevImport, newImport); + } + } + } else { + var lastExistingImport = ts6.lastOrUndefined(existingImportStatements); + if (lastExistingImport) { + changes.insertNodesAfter(sourceFile, lastExistingImport, sortedNewImports); + } else { + changes.insertNodesAtTopOfFile(sourceFile, sortedNewImports, blankLineBetween); + } + } + } + ts6.insertImports = insertImports; + function getTypeKeywordOfTypeOnlyImport(importClause, sourceFile) { + ts6.Debug.assert(importClause.isTypeOnly); + return ts6.cast(importClause.getChildAt(0, sourceFile), isTypeKeywordToken); + } + ts6.getTypeKeywordOfTypeOnlyImport = getTypeKeywordOfTypeOnlyImport; + function textSpansEqual(a, b) { + return !!a && !!b && a.start === b.start && a.length === b.length; + } + ts6.textSpansEqual = textSpansEqual; + function documentSpansEqual(a, b) { + return a.fileName === b.fileName && textSpansEqual(a.textSpan, b.textSpan); + } + ts6.documentSpansEqual = documentSpansEqual; + function forEachUnique(array, callback) { + if (array) { + for (var i = 0; i < array.length; i++) { + if (array.indexOf(array[i]) === i) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + } + return void 0; + } + ts6.forEachUnique = forEachUnique; + function isTextWhiteSpaceLike(text, startPos, endPos) { + for (var i = startPos; i < endPos; i++) { + if (!ts6.isWhiteSpaceLike(text.charCodeAt(i))) { + return false; + } + } + return true; + } + ts6.isTextWhiteSpaceLike = isTextWhiteSpaceLike; + function getMappedLocation(location, sourceMapper, fileExists) { + var mapsTo = sourceMapper.tryGetSourcePosition(location); + return mapsTo && (!fileExists || fileExists(ts6.normalizePath(mapsTo.fileName)) ? mapsTo : void 0); + } + ts6.getMappedLocation = getMappedLocation; + function getMappedDocumentSpan(documentSpan, sourceMapper, fileExists) { + var fileName = documentSpan.fileName, textSpan = documentSpan.textSpan; + var newPosition = getMappedLocation({ fileName, pos: textSpan.start }, sourceMapper, fileExists); + if (!newPosition) + return void 0; + var newEndPosition = getMappedLocation({ fileName, pos: textSpan.start + textSpan.length }, sourceMapper, fileExists); + var newLength = newEndPosition ? newEndPosition.pos - newPosition.pos : textSpan.length; + return { + fileName: newPosition.fileName, + textSpan: { + start: newPosition.pos, + length: newLength + }, + originalFileName: documentSpan.fileName, + originalTextSpan: documentSpan.textSpan, + contextSpan: getMappedContextSpan(documentSpan, sourceMapper, fileExists), + originalContextSpan: documentSpan.contextSpan + }; + } + ts6.getMappedDocumentSpan = getMappedDocumentSpan; + function getMappedContextSpan(documentSpan, sourceMapper, fileExists) { + var contextSpanStart = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start }, sourceMapper, fileExists); + var contextSpanEnd = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length }, sourceMapper, fileExists); + return contextSpanStart && contextSpanEnd ? { start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } : void 0; + } + ts6.getMappedContextSpan = getMappedContextSpan; + function isFirstDeclarationOfSymbolParameter(symbol) { + var declaration = symbol.declarations ? ts6.firstOrUndefined(symbol.declarations) : void 0; + return !!ts6.findAncestor(declaration, function(n) { + return ts6.isParameter(n) ? true : ts6.isBindingElement(n) || ts6.isObjectBindingPattern(n) || ts6.isArrayBindingPattern(n) ? false : "quit"; + }); + } + ts6.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter() { + var absoluteMaximumLength = ts6.defaultMaximumTruncationLength * 10; + var displayParts; + var lineStart; + var indent; + var length; + resetWriter(); + var unknownWrite = function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.text); + }; + return { + displayParts: function() { + var finalText = displayParts.length && displayParts[displayParts.length - 1].text; + if (length > absoluteMaximumLength && finalText && finalText !== "...") { + if (!ts6.isWhiteSpaceLike(finalText.charCodeAt(finalText.length - 1))) { + displayParts.push(displayPart(" ", ts6.SymbolDisplayPartKind.space)); + } + displayParts.push(displayPart("...", ts6.SymbolDisplayPartKind.punctuation)); + } + return displayParts; + }, + writeKeyword: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.keyword); + }, + writeOperator: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.operator); + }, + writePunctuation: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.punctuation); + }, + writeTrailingSemicolon: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.punctuation); + }, + writeSpace: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.space); + }, + writeStringLiteral: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.stringLiteral); + }, + writeParameter: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.parameterName); + }, + writeProperty: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.propertyName); + }, + writeLiteral: function(text) { + return writeKind(text, ts6.SymbolDisplayPartKind.stringLiteral); + }, + writeSymbol, + writeLine, + write: unknownWrite, + writeComment: unknownWrite, + getText: function() { + return ""; + }, + getTextPos: function() { + return 0; + }, + getColumn: function() { + return 0; + }, + getLine: function() { + return 0; + }, + isAtStartOfLine: function() { + return false; + }, + hasTrailingWhitespace: function() { + return false; + }, + hasTrailingComment: function() { + return false; + }, + rawWrite: ts6.notImplemented, + getIndent: function() { + return indent; + }, + increaseIndent: function() { + indent++; + }, + decreaseIndent: function() { + indent--; + }, + clear: resetWriter, + trackSymbol: function() { + return false; + }, + reportInaccessibleThisError: ts6.noop, + reportInaccessibleUniqueSymbolError: ts6.noop, + reportPrivateInBaseOfClassExpression: ts6.noop + }; + function writeIndent() { + if (length > absoluteMaximumLength) + return; + if (lineStart) { + var indentString = ts6.getIndentString(indent); + if (indentString) { + length += indentString.length; + displayParts.push(displayPart(indentString, ts6.SymbolDisplayPartKind.space)); + } + lineStart = false; + } + } + function writeKind(text, kind) { + if (length > absoluteMaximumLength) + return; + writeIndent(); + length += text.length; + displayParts.push(displayPart(text, kind)); + } + function writeSymbol(text, symbol) { + if (length > absoluteMaximumLength) + return; + writeIndent(); + length += text.length; + displayParts.push(symbolPart(text, symbol)); + } + function writeLine() { + if (length > absoluteMaximumLength) + return; + length += 1; + displayParts.push(lineBreakPart()); + lineStart = true; + } + function resetWriter() { + displayParts = []; + lineStart = true; + indent = 0; + length = 0; + } + } + function symbolPart(text, symbol) { + return displayPart(text, displayPartKind(symbol)); + function displayPartKind(symbol2) { + var flags = symbol2.flags; + if (flags & 3) { + return isFirstDeclarationOfSymbolParameter(symbol2) ? ts6.SymbolDisplayPartKind.parameterName : ts6.SymbolDisplayPartKind.localName; + } + if (flags & 4) + return ts6.SymbolDisplayPartKind.propertyName; + if (flags & 32768) + return ts6.SymbolDisplayPartKind.propertyName; + if (flags & 65536) + return ts6.SymbolDisplayPartKind.propertyName; + if (flags & 8) + return ts6.SymbolDisplayPartKind.enumMemberName; + if (flags & 16) + return ts6.SymbolDisplayPartKind.functionName; + if (flags & 32) + return ts6.SymbolDisplayPartKind.className; + if (flags & 64) + return ts6.SymbolDisplayPartKind.interfaceName; + if (flags & 384) + return ts6.SymbolDisplayPartKind.enumName; + if (flags & 1536) + return ts6.SymbolDisplayPartKind.moduleName; + if (flags & 8192) + return ts6.SymbolDisplayPartKind.methodName; + if (flags & 262144) + return ts6.SymbolDisplayPartKind.typeParameterName; + if (flags & 524288) + return ts6.SymbolDisplayPartKind.aliasName; + if (flags & 2097152) + return ts6.SymbolDisplayPartKind.aliasName; + return ts6.SymbolDisplayPartKind.text; + } + } + ts6.symbolPart = symbolPart; + function displayPart(text, kind) { + return { text, kind: ts6.SymbolDisplayPartKind[kind] }; + } + ts6.displayPart = displayPart; + function spacePart() { + return displayPart(" ", ts6.SymbolDisplayPartKind.space); + } + ts6.spacePart = spacePart; + function keywordPart(kind) { + return displayPart(ts6.tokenToString(kind), ts6.SymbolDisplayPartKind.keyword); + } + ts6.keywordPart = keywordPart; + function punctuationPart(kind) { + return displayPart(ts6.tokenToString(kind), ts6.SymbolDisplayPartKind.punctuation); + } + ts6.punctuationPart = punctuationPart; + function operatorPart(kind) { + return displayPart(ts6.tokenToString(kind), ts6.SymbolDisplayPartKind.operator); + } + ts6.operatorPart = operatorPart; + function parameterNamePart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.parameterName); + } + ts6.parameterNamePart = parameterNamePart; + function propertyNamePart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.propertyName); + } + ts6.propertyNamePart = propertyNamePart; + function textOrKeywordPart(text) { + var kind = ts6.stringToToken(text); + return kind === void 0 ? textPart(text) : keywordPart(kind); + } + ts6.textOrKeywordPart = textOrKeywordPart; + function textPart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.text); + } + ts6.textPart = textPart; + function typeAliasNamePart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.aliasName); + } + ts6.typeAliasNamePart = typeAliasNamePart; + function typeParameterNamePart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.typeParameterName); + } + ts6.typeParameterNamePart = typeParameterNamePart; + function linkTextPart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.linkText); + } + ts6.linkTextPart = linkTextPart; + function linkNamePart(text, target) { + return { + text, + kind: ts6.SymbolDisplayPartKind[ts6.SymbolDisplayPartKind.linkName], + target: { + fileName: ts6.getSourceFileOfNode(target).fileName, + textSpan: createTextSpanFromNode(target) + } + }; + } + ts6.linkNamePart = linkNamePart; + function linkPart(text) { + return displayPart(text, ts6.SymbolDisplayPartKind.link); + } + ts6.linkPart = linkPart; + function buildLinkParts(link, checker) { + var _a; + var prefix2 = ts6.isJSDocLink(link) ? "link" : ts6.isJSDocLinkCode(link) ? "linkcode" : "linkplain"; + var parts = [linkPart("{@".concat(prefix2, " "))]; + if (!link.name) { + if (link.text) { + parts.push(linkTextPart(link.text)); + } + } else { + var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name); + var suffix = findLinkNameEnd(link.text); + var name = ts6.getTextOfNode(link.name) + link.text.slice(0, suffix); + var text = skipSeparatorFromLinkText(link.text.slice(suffix)); + var decl = (symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]); + if (decl) { + parts.push(linkNamePart(name, decl)); + if (text) + parts.push(linkTextPart(text)); + } else { + parts.push(linkTextPart(name + (suffix || text.indexOf("://") === 0 ? "" : " ") + text)); + } + } + parts.push(linkPart("}")); + return parts; + } + ts6.buildLinkParts = buildLinkParts; + function skipSeparatorFromLinkText(text) { + var pos = 0; + if (text.charCodeAt(pos++) === 124) { + while (pos < text.length && text.charCodeAt(pos) === 32) + pos++; + return text.slice(pos); + } + return text; + } + function findLinkNameEnd(text) { + if (text.indexOf("()") === 0) + return 2; + if (text[0] !== "<") + return 0; + var brackets = 0; + var i = 0; + while (i < text.length) { + if (text[i] === "<") + brackets++; + if (text[i] === ">") + brackets--; + i++; + if (!brackets) + return i; + } + return 0; + } + var carriageReturnLineFeed = "\r\n"; + function getNewLineOrDefaultFromHost(host, formatSettings) { + var _a; + return (formatSettings === null || formatSettings === void 0 ? void 0 : formatSettings.newLineCharacter) || ((_a = host.getNewLine) === null || _a === void 0 ? void 0 : _a.call(host)) || carriageReturnLineFeed; + } + ts6.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; + function lineBreakPart() { + return displayPart("\n", ts6.SymbolDisplayPartKind.lineBreak); + } + ts6.lineBreakPart = lineBreakPart; + function mapToDisplayParts(writeDisplayParts) { + try { + writeDisplayParts(displayPartWriter); + return displayPartWriter.displayParts(); + } finally { + displayPartWriter.clear(); + } + } + ts6.mapToDisplayParts = mapToDisplayParts; + function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { + if (flags === void 0) { + flags = 0; + } + return mapToDisplayParts(function(writer) { + typechecker.writeType(type, enclosingDeclaration, flags | 1024 | 16384, writer); + }); + } + ts6.typeToDisplayParts = typeToDisplayParts; + function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { + if (flags === void 0) { + flags = 0; + } + return mapToDisplayParts(function(writer) { + typeChecker.writeSymbol(symbol, enclosingDeclaration, meaning, flags | 8, writer); + }); + } + ts6.symbolToDisplayParts = symbolToDisplayParts; + function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + if (flags === void 0) { + flags = 0; + } + flags |= 16384 | 1024 | 32 | 8192; + return mapToDisplayParts(function(writer) { + typechecker.writeSignature( + signature, + enclosingDeclaration, + flags, + /*signatureKind*/ + void 0, + writer + ); + }); + } + ts6.signatureToDisplayParts = signatureToDisplayParts; + function nodeToDisplayParts(node, enclosingDeclaration) { + var file = enclosingDeclaration.getSourceFile(); + return mapToDisplayParts(function(writer) { + var printer = ts6.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); + printer.writeNode(4, node, file, writer); + }); + } + ts6.nodeToDisplayParts = nodeToDisplayParts; + function isImportOrExportSpecifierName(location) { + return !!location.parent && ts6.isImportOrExportSpecifier(location.parent) && location.parent.propertyName === location; + } + ts6.isImportOrExportSpecifierName = isImportOrExportSpecifierName; + function getScriptKind(fileName, host) { + return ts6.ensureScriptKind(fileName, host.getScriptKind && host.getScriptKind(fileName)); + } + ts6.getScriptKind = getScriptKind; + function getSymbolTarget(symbol, checker) { + var next = symbol; + while (isAliasSymbol(next) || isTransientSymbol(next) && next.target) { + if (isTransientSymbol(next) && next.target) { + next = next.target; + } else { + next = ts6.skipAlias(next, checker); + } + } + return next; + } + ts6.getSymbolTarget = getSymbolTarget; + function isTransientSymbol(symbol) { + return (symbol.flags & 33554432) !== 0; + } + function isAliasSymbol(symbol) { + return (symbol.flags & 2097152) !== 0; + } + function getUniqueSymbolId(symbol, checker) { + return ts6.getSymbolId(ts6.skipAlias(symbol, checker)); + } + ts6.getUniqueSymbolId = getUniqueSymbolId; + function getFirstNonSpaceCharacterPosition(text, position) { + while (ts6.isWhiteSpaceLike(text.charCodeAt(position))) { + position += 1; + } + return position; + } + ts6.getFirstNonSpaceCharacterPosition = getFirstNonSpaceCharacterPosition; + function getPrecedingNonSpaceCharacterPosition(text, position) { + while (position > -1 && ts6.isWhiteSpaceSingleLine(text.charCodeAt(position))) { + position -= 1; + } + return position + 1; + } + ts6.getPrecedingNonSpaceCharacterPosition = getPrecedingNonSpaceCharacterPosition; + function getSynthesizedDeepClone(node, includeTrivia) { + if (includeTrivia === void 0) { + includeTrivia = true; + } + var clone = node && getSynthesizedDeepCloneWorker(node); + if (clone && !includeTrivia) + suppressLeadingAndTrailingTrivia(clone); + return clone; + } + ts6.getSynthesizedDeepClone = getSynthesizedDeepClone; + function getSynthesizedDeepCloneWithReplacements(node, includeTrivia, replaceNode) { + var clone = replaceNode(node); + if (clone) { + ts6.setOriginalNode(clone, node); + } else { + clone = getSynthesizedDeepCloneWorker(node, replaceNode); + } + if (clone && !includeTrivia) + suppressLeadingAndTrailingTrivia(clone); + return clone; + } + ts6.getSynthesizedDeepCloneWithReplacements = getSynthesizedDeepCloneWithReplacements; + function getSynthesizedDeepCloneWorker(node, replaceNode) { + var nodeClone = replaceNode ? function(n) { + return getSynthesizedDeepCloneWithReplacements( + n, + /*includeTrivia*/ + true, + replaceNode + ); + } : getSynthesizedDeepClone; + var nodesClone = replaceNode ? function(ns) { + return ns && getSynthesizedDeepClonesWithReplacements( + ns, + /*includeTrivia*/ + true, + replaceNode + ); + } : function(ns) { + return ns && getSynthesizedDeepClones(ns); + }; + var visited = ts6.visitEachChild(node, nodeClone, ts6.nullTransformationContext, nodesClone, nodeClone); + if (visited === node) { + var clone_1 = ts6.isStringLiteral(node) ? ts6.setOriginalNode(ts6.factory.createStringLiteralFromNode(node), node) : ts6.isNumericLiteral(node) ? ts6.setOriginalNode(ts6.factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) : ts6.factory.cloneNode(node); + return ts6.setTextRange(clone_1, node); + } + visited.parent = void 0; + return visited; + } + function getSynthesizedDeepClones(nodes, includeTrivia) { + if (includeTrivia === void 0) { + includeTrivia = true; + } + return nodes && ts6.factory.createNodeArray(nodes.map(function(n) { + return getSynthesizedDeepClone(n, includeTrivia); + }), nodes.hasTrailingComma); + } + ts6.getSynthesizedDeepClones = getSynthesizedDeepClones; + function getSynthesizedDeepClonesWithReplacements(nodes, includeTrivia, replaceNode) { + return ts6.factory.createNodeArray(nodes.map(function(n) { + return getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode); + }), nodes.hasTrailingComma); + } + ts6.getSynthesizedDeepClonesWithReplacements = getSynthesizedDeepClonesWithReplacements; + function suppressLeadingAndTrailingTrivia(node) { + suppressLeadingTrivia(node); + suppressTrailingTrivia(node); + } + ts6.suppressLeadingAndTrailingTrivia = suppressLeadingAndTrailingTrivia; + function suppressLeadingTrivia(node) { + addEmitFlagsRecursively(node, 512, getFirstChild); + } + ts6.suppressLeadingTrivia = suppressLeadingTrivia; + function suppressTrailingTrivia(node) { + addEmitFlagsRecursively(node, 1024, ts6.getLastChild); + } + ts6.suppressTrailingTrivia = suppressTrailingTrivia; + function copyComments(sourceNode, targetNode) { + var sourceFile = sourceNode.getSourceFile(); + var text = sourceFile.text; + if (hasLeadingLineBreak(sourceNode, text)) { + copyLeadingComments(sourceNode, targetNode, sourceFile); + } else { + copyTrailingAsLeadingComments(sourceNode, targetNode, sourceFile); + } + copyTrailingComments(sourceNode, targetNode, sourceFile); + } + ts6.copyComments = copyComments; + function hasLeadingLineBreak(node, text) { + var start = node.getFullStart(); + var end = node.getStart(); + for (var i = start; i < end; i++) { + if (text.charCodeAt(i) === 10) + return true; + } + return false; + } + function addEmitFlagsRecursively(node, flag, getChild) { + ts6.addEmitFlags(node, flag); + var child = getChild(node); + if (child) + addEmitFlagsRecursively(child, flag, getChild); + } + function getFirstChild(node) { + return node.forEachChild(function(child) { + return child; + }); + } + function getUniqueName(baseName, sourceFile) { + var nameText = baseName; + for (var i = 1; !ts6.isFileLevelUniqueName(sourceFile, nameText); i++) { + nameText = "".concat(baseName, "_").concat(i); + } + return nameText; + } + ts6.getUniqueName = getUniqueName; + function getRenameLocation(edits, renameFilename, name, preferLastLocation) { + var delta = 0; + var lastPos = -1; + for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { + var _a = edits_1[_i], fileName = _a.fileName, textChanges_2 = _a.textChanges; + ts6.Debug.assert(fileName === renameFilename); + for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) { + var change = textChanges_1[_b]; + var span = change.span, newText = change.newText; + var index = indexInTextChange(newText, ts6.escapeString(name)); + if (index !== -1) { + lastPos = span.start + delta + index; + if (!preferLastLocation) { + return lastPos; + } + } + delta += newText.length - span.length; + } + } + ts6.Debug.assert(preferLastLocation); + ts6.Debug.assert(lastPos >= 0); + return lastPos; + } + ts6.getRenameLocation = getRenameLocation; + function copyLeadingComments(sourceNode, targetNode, sourceFile, commentKind, hasTrailingNewLine) { + ts6.forEachLeadingCommentRange(sourceFile.text, sourceNode.pos, getAddCommentsFunction(targetNode, sourceFile, commentKind, hasTrailingNewLine, ts6.addSyntheticLeadingComment)); + } + ts6.copyLeadingComments = copyLeadingComments; + function copyTrailingComments(sourceNode, targetNode, sourceFile, commentKind, hasTrailingNewLine) { + ts6.forEachTrailingCommentRange(sourceFile.text, sourceNode.end, getAddCommentsFunction(targetNode, sourceFile, commentKind, hasTrailingNewLine, ts6.addSyntheticTrailingComment)); + } + ts6.copyTrailingComments = copyTrailingComments; + function copyTrailingAsLeadingComments(sourceNode, targetNode, sourceFile, commentKind, hasTrailingNewLine) { + ts6.forEachTrailingCommentRange(sourceFile.text, sourceNode.pos, getAddCommentsFunction(targetNode, sourceFile, commentKind, hasTrailingNewLine, ts6.addSyntheticLeadingComment)); + } + ts6.copyTrailingAsLeadingComments = copyTrailingAsLeadingComments; + function getAddCommentsFunction(targetNode, sourceFile, commentKind, hasTrailingNewLine, cb) { + return function(pos, end, kind, htnl) { + if (kind === 3) { + pos += 2; + end -= 2; + } else { + pos += 2; + } + cb(targetNode, commentKind || kind, sourceFile.text.slice(pos, end), hasTrailingNewLine !== void 0 ? hasTrailingNewLine : htnl); + }; + } + function indexInTextChange(change, name) { + if (ts6.startsWith(change, name)) + return 0; + var idx = change.indexOf(" " + name); + if (idx === -1) + idx = change.indexOf("." + name); + if (idx === -1) + idx = change.indexOf('"' + name); + return idx === -1 ? -1 : idx + 1; + } + function needsParentheses(expression) { + return ts6.isBinaryExpression(expression) && expression.operatorToken.kind === 27 || ts6.isObjectLiteralExpression(expression) || ts6.isAsExpression(expression) && ts6.isObjectLiteralExpression(expression.expression); + } + ts6.needsParentheses = needsParentheses; + function getContextualTypeFromParent(node, checker) { + var parent = node.parent; + switch (parent.kind) { + case 211: + return checker.getContextualType(parent); + case 223: { + var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; + return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); + } + case 292: + return parent.expression === node ? getSwitchedType(parent, checker) : void 0; + default: + return checker.getContextualType(node); + } + } + ts6.getContextualTypeFromParent = getContextualTypeFromParent; + function quote(sourceFile, preferences, text) { + var quotePreference = getQuotePreference(sourceFile, preferences); + var quoted = JSON.stringify(text); + return quotePreference === 0 ? "'".concat(ts6.stripQuotes(quoted).replace(/'/g, "\\'").replace(/\\"/g, '"'), "'") : quoted; + } + ts6.quote = quote; + function isEqualityOperatorKind(kind) { + switch (kind) { + case 36: + case 34: + case 37: + case 35: + return true; + default: + return false; + } + } + ts6.isEqualityOperatorKind = isEqualityOperatorKind; + function isStringLiteralOrTemplate(node) { + switch (node.kind) { + case 10: + case 14: + case 225: + case 212: + return true; + default: + return false; + } + } + ts6.isStringLiteralOrTemplate = isStringLiteralOrTemplate; + function hasIndexSignature(type) { + return !!type.getStringIndexType() || !!type.getNumberIndexType(); + } + ts6.hasIndexSignature = hasIndexSignature; + function getSwitchedType(caseClause, checker) { + return checker.getTypeAtLocation(caseClause.parent.parent.expression); + } + ts6.getSwitchedType = getSwitchedType; + ts6.ANONYMOUS = "anonymous function"; + function getTypeNodeIfAccessible(type, enclosingScope, program, host) { + var checker = program.getTypeChecker(); + var typeIsAccessible = true; + var notAccessible = function() { + return typeIsAccessible = false; + }; + var res = checker.typeToTypeNode(type, enclosingScope, 1, { + trackSymbol: function(symbol, declaration, meaning) { + typeIsAccessible = typeIsAccessible && checker.isSymbolAccessible( + symbol, + declaration, + meaning, + /*shouldComputeAliasToMarkVisible*/ + false + ).accessibility === 0; + return !typeIsAccessible; + }, + reportInaccessibleThisError: notAccessible, + reportPrivateInBaseOfClassExpression: notAccessible, + reportInaccessibleUniqueSymbolError: notAccessible, + moduleResolverHost: getModuleSpecifierResolverHost(program, host) + }); + return typeIsAccessible ? res : void 0; + } + ts6.getTypeNodeIfAccessible = getTypeNodeIfAccessible; + function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { + return kind === 176 || kind === 177 || kind === 178 || kind === 168 || kind === 170; + } + function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { + return kind === 259 || kind === 173 || kind === 171 || kind === 174 || kind === 175; + } + function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { + return kind === 264; + } + function syntaxRequiresTrailingSemicolonOrASI(kind) { + return kind === 240 || kind === 241 || kind === 243 || kind === 248 || kind === 249 || kind === 250 || kind === 254 || kind === 256 || kind === 169 || kind === 262 || kind === 269 || kind === 268 || kind === 275 || kind === 267 || kind === 274; + } + ts6.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; + ts6.syntaxMayBeASICandidate = ts6.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); + function nodeIsASICandidate(node, sourceFile) { + var lastToken = node.getLastToken(sourceFile); + if (lastToken && lastToken.kind === 26) { + return false; + } + if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) { + if (lastToken && lastToken.kind === 27) { + return false; + } + } else if (syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(node.kind)) { + var lastChild = ts6.last(node.getChildren(sourceFile)); + if (lastChild && ts6.isModuleBlock(lastChild)) { + return false; + } + } else if (syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(node.kind)) { + var lastChild = ts6.last(node.getChildren(sourceFile)); + if (lastChild && ts6.isFunctionBlock(lastChild)) { + return false; + } + } else if (!syntaxRequiresTrailingSemicolonOrASI(node.kind)) { + return false; + } + if (node.kind === 243) { + return true; + } + var topNode = ts6.findAncestor(node, function(ancestor) { + return !ancestor.parent; + }); + var nextToken = findNextToken(node, topNode, sourceFile); + if (!nextToken || nextToken.kind === 19) { + return true; + } + var startLine = sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(nextToken.getStart(sourceFile)).line; + return startLine !== endLine; + } + function positionIsASICandidate(pos, context, sourceFile) { + var contextAncestor = ts6.findAncestor(context, function(ancestor) { + if (ancestor.end !== pos) { + return "quit"; + } + return ts6.syntaxMayBeASICandidate(ancestor.kind); + }); + return !!contextAncestor && nodeIsASICandidate(contextAncestor, sourceFile); + } + ts6.positionIsASICandidate = positionIsASICandidate; + function probablyUsesSemicolons(sourceFile) { + var withSemicolon = 0; + var withoutSemicolon = 0; + var nStatementsToObserve = 5; + ts6.forEachChild(sourceFile, function visit(node) { + if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) { + var lastToken = node.getLastToken(sourceFile); + if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26) { + withSemicolon++; + } else { + withoutSemicolon++; + } + } else if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) { + var lastToken = node.getLastToken(sourceFile); + if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26) { + withSemicolon++; + } else if (lastToken && lastToken.kind !== 27) { + var lastTokenLine = ts6.getLineAndCharacterOfPosition(sourceFile, lastToken.getStart(sourceFile)).line; + var nextTokenLine = ts6.getLineAndCharacterOfPosition(sourceFile, ts6.getSpanOfTokenAtPosition(sourceFile, lastToken.end).start).line; + if (lastTokenLine !== nextTokenLine) { + withoutSemicolon++; + } + } + } + if (withSemicolon + withoutSemicolon >= nStatementsToObserve) { + return true; + } + return ts6.forEachChild(node, visit); + }); + if (withSemicolon === 0 && withoutSemicolon <= 1) { + return true; + } + return withSemicolon / withoutSemicolon > 1 / nStatementsToObserve; + } + ts6.probablyUsesSemicolons = probablyUsesSemicolons; + function tryGetDirectories(host, directoryName) { + return tryIOAndConsumeErrors(host, host.getDirectories, directoryName) || []; + } + ts6.tryGetDirectories = tryGetDirectories; + function tryReadDirectory(host, path, extensions, exclude, include) { + return tryIOAndConsumeErrors(host, host.readDirectory, path, extensions, exclude, include) || ts6.emptyArray; + } + ts6.tryReadDirectory = tryReadDirectory; + function tryFileExists(host, path) { + return tryIOAndConsumeErrors(host, host.fileExists, path); + } + ts6.tryFileExists = tryFileExists; + function tryDirectoryExists(host, path) { + return tryAndIgnoreErrors(function() { + return ts6.directoryProbablyExists(path, host); + }) || false; + } + ts6.tryDirectoryExists = tryDirectoryExists; + function tryAndIgnoreErrors(cb) { + try { + return cb(); + } catch (_a) { + return void 0; + } + } + ts6.tryAndIgnoreErrors = tryAndIgnoreErrors; + function tryIOAndConsumeErrors(host, toApply) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + return tryAndIgnoreErrors(function() { + return toApply && toApply.apply(host, args); + }); + } + ts6.tryIOAndConsumeErrors = tryIOAndConsumeErrors; + function findPackageJsons(startDirectory, host, stopDirectory) { + var paths = []; + ts6.forEachAncestorDirectory(startDirectory, function(ancestor) { + if (ancestor === stopDirectory) { + return true; + } + var currentConfigPath = ts6.combinePaths(ancestor, "package.json"); + if (tryFileExists(host, currentConfigPath)) { + paths.push(currentConfigPath); + } + }); + return paths; + } + ts6.findPackageJsons = findPackageJsons; + function findPackageJson(directory, host) { + var packageJson; + ts6.forEachAncestorDirectory(directory, function(ancestor) { + if (ancestor === "node_modules") + return true; + packageJson = ts6.findConfigFile(ancestor, function(f) { + return tryFileExists(host, f); + }, "package.json"); + if (packageJson) { + return true; + } + }); + return packageJson; + } + ts6.findPackageJson = findPackageJson; + function getPackageJsonsVisibleToFile(fileName, host) { + if (!host.fileExists) { + return []; + } + var packageJsons = []; + ts6.forEachAncestorDirectory(ts6.getDirectoryPath(fileName), function(ancestor) { + var packageJsonFileName = ts6.combinePaths(ancestor, "package.json"); + if (host.fileExists(packageJsonFileName)) { + var info = createPackageJsonInfo(packageJsonFileName, host); + if (info) { + packageJsons.push(info); + } + } + }); + return packageJsons; + } + ts6.getPackageJsonsVisibleToFile = getPackageJsonsVisibleToFile; + function createPackageJsonInfo(fileName, host) { + if (!host.readFile) { + return void 0; + } + var dependencyKeys = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]; + var stringContent = host.readFile(fileName) || ""; + var content = tryParseJson(stringContent); + var info = {}; + if (content) { + for (var _i = 0, dependencyKeys_1 = dependencyKeys; _i < dependencyKeys_1.length; _i++) { + var key = dependencyKeys_1[_i]; + var dependencies = content[key]; + if (!dependencies) { + continue; + } + var dependencyMap = new ts6.Map(); + for (var packageName in dependencies) { + dependencyMap.set(packageName, dependencies[packageName]); + } + info[key] = dependencyMap; + } + } + var dependencyGroups = [ + [1, info.dependencies], + [2, info.devDependencies], + [8, info.optionalDependencies], + [4, info.peerDependencies] + ]; + return __assign(__assign({}, info), { parseable: !!content, fileName, get, has: function(dependencyName, inGroups) { + return !!get(dependencyName, inGroups); + } }); + function get(dependencyName, inGroups) { + if (inGroups === void 0) { + inGroups = 15; + } + for (var _i2 = 0, dependencyGroups_1 = dependencyGroups; _i2 < dependencyGroups_1.length; _i2++) { + var _a = dependencyGroups_1[_i2], group_1 = _a[0], deps = _a[1]; + if (deps && inGroups & group_1) { + var dep = deps.get(dependencyName); + if (dep !== void 0) { + return dep; + } + } + } + } + } + ts6.createPackageJsonInfo = createPackageJsonInfo; + function createPackageJsonImportFilter(fromFile, preferences, host) { + var packageJsons = (host.getPackageJsonsVisibleToFile && host.getPackageJsonsVisibleToFile(fromFile.fileName) || getPackageJsonsVisibleToFile(fromFile.fileName, host)).filter(function(p) { + return p.parseable; + }); + var usesNodeCoreModules; + return { allowsImportingAmbientModule, allowsImportingSourceFile, allowsImportingSpecifier }; + function moduleSpecifierIsCoveredByPackageJson(specifier) { + var packageName = getNodeModuleRootSpecifier(specifier); + for (var _i = 0, packageJsons_1 = packageJsons; _i < packageJsons_1.length; _i++) { + var packageJson = packageJsons_1[_i]; + if (packageJson.has(packageName) || packageJson.has(ts6.getTypesPackageName(packageName))) { + return true; + } + } + return false; + } + function allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost) { + if (!packageJsons.length || !moduleSymbol.valueDeclaration) { + return true; + } + var declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile(); + var declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost); + if (typeof declaringNodeModuleName === "undefined") { + return true; + } + var declaredModuleSpecifier = ts6.stripQuotes(moduleSymbol.getName()); + if (isAllowedCoreNodeModulesImport(declaredModuleSpecifier)) { + return true; + } + return moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier); + } + function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) { + if (!packageJsons.length) { + return true; + } + var moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost); + if (!moduleSpecifier) { + return true; + } + return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier); + } + function allowsImportingSpecifier(moduleSpecifier) { + if (!packageJsons.length || isAllowedCoreNodeModulesImport(moduleSpecifier)) { + return true; + } + if (ts6.pathIsRelative(moduleSpecifier) || ts6.isRootedDiskPath(moduleSpecifier)) { + return true; + } + return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier); + } + function isAllowedCoreNodeModulesImport(moduleSpecifier) { + if (ts6.isSourceFileJS(fromFile) && ts6.JsTyping.nodeCoreModules.has(moduleSpecifier)) { + if (usesNodeCoreModules === void 0) { + usesNodeCoreModules = consumesNodeCoreModules(fromFile); + } + if (usesNodeCoreModules) { + return true; + } + } + return false; + } + function getNodeModulesPackageNameFromFileName(importedFileName, moduleSpecifierResolutionHost) { + if (!ts6.stringContains(importedFileName, "node_modules")) { + return void 0; + } + var specifier = ts6.moduleSpecifiers.getNodeModulesPackageName(host.getCompilationSettings(), fromFile, importedFileName, moduleSpecifierResolutionHost, preferences); + if (!specifier) { + return void 0; + } + if (!ts6.pathIsRelative(specifier) && !ts6.isRootedDiskPath(specifier)) { + return getNodeModuleRootSpecifier(specifier); + } + } + function getNodeModuleRootSpecifier(fullSpecifier) { + var components = ts6.getPathComponents(ts6.getPackageNameFromTypesPackageName(fullSpecifier)).slice(1); + if (ts6.startsWith(components[0], "@")) { + return "".concat(components[0], "/").concat(components[1]); + } + return components[0]; + } + } + ts6.createPackageJsonImportFilter = createPackageJsonImportFilter; + function tryParseJson(text) { + try { + return JSON.parse(text); + } catch (_a) { + return void 0; + } + } + function consumesNodeCoreModules(sourceFile) { + return ts6.some(sourceFile.imports, function(_a) { + var text = _a.text; + return ts6.JsTyping.nodeCoreModules.has(text); + }); + } + ts6.consumesNodeCoreModules = consumesNodeCoreModules; + function isInsideNodeModules(fileOrDirectory) { + return ts6.contains(ts6.getPathComponents(fileOrDirectory), "node_modules"); + } + ts6.isInsideNodeModules = isInsideNodeModules; + function isDiagnosticWithLocation(diagnostic) { + return diagnostic.file !== void 0 && diagnostic.start !== void 0 && diagnostic.length !== void 0; + } + ts6.isDiagnosticWithLocation = isDiagnosticWithLocation; + function findDiagnosticForNode(node, sortedFileDiagnostics) { + var span = createTextSpanFromNode(node); + var index = ts6.binarySearchKey(sortedFileDiagnostics, span, ts6.identity, ts6.compareTextSpans); + if (index >= 0) { + var diagnostic = sortedFileDiagnostics[index]; + ts6.Debug.assertEqual(diagnostic.file, node.getSourceFile(), "Diagnostics proided to 'findDiagnosticForNode' must be from a single SourceFile"); + return ts6.cast(diagnostic, isDiagnosticWithLocation); + } + } + ts6.findDiagnosticForNode = findDiagnosticForNode; + function getDiagnosticsWithinSpan(span, sortedFileDiagnostics) { + var _a; + var index = ts6.binarySearchKey(sortedFileDiagnostics, span.start, function(diag) { + return diag.start; + }, ts6.compareValues); + if (index < 0) { + index = ~index; + } + while (((_a = sortedFileDiagnostics[index - 1]) === null || _a === void 0 ? void 0 : _a.start) === span.start) { + index--; + } + var result = []; + var end = ts6.textSpanEnd(span); + while (true) { + var diagnostic = ts6.tryCast(sortedFileDiagnostics[index], isDiagnosticWithLocation); + if (!diagnostic || diagnostic.start > end) { + break; + } + if (ts6.textSpanContainsTextSpan(span, diagnostic)) { + result.push(diagnostic); + } + index++; + } + return result; + } + ts6.getDiagnosticsWithinSpan = getDiagnosticsWithinSpan; + function getRefactorContextSpan(_a) { + var startPosition = _a.startPosition, endPosition = _a.endPosition; + return ts6.createTextSpanFromBounds(startPosition, endPosition === void 0 ? startPosition : endPosition); + } + ts6.getRefactorContextSpan = getRefactorContextSpan; + function getFixableErrorSpanExpression(sourceFile, span) { + var token = getTokenAtPosition(sourceFile, span.start); + var expression = ts6.findAncestor(token, function(node) { + if (node.getStart(sourceFile) < span.start || node.getEnd() > ts6.textSpanEnd(span)) { + return "quit"; + } + return ts6.isExpression(node) && textSpansEqual(span, createTextSpanFromNode(node, sourceFile)); + }); + return expression; + } + ts6.getFixableErrorSpanExpression = getFixableErrorSpanExpression; + function mapOneOrMany(valueOrArray, f, resultSelector) { + if (resultSelector === void 0) { + resultSelector = ts6.identity; + } + return valueOrArray ? ts6.isArray(valueOrArray) ? resultSelector(ts6.map(valueOrArray, f)) : f(valueOrArray, 0) : void 0; + } + ts6.mapOneOrMany = mapOneOrMany; + function firstOrOnly(valueOrArray) { + return ts6.isArray(valueOrArray) ? ts6.first(valueOrArray) : valueOrArray; + } + ts6.firstOrOnly = firstOrOnly; + function getNamesForExportedSymbol(symbol, scriptTarget) { + if (needsNameFromDeclaration(symbol)) { + var fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol); + if (fromDeclaration) + return fromDeclaration; + var fileNameCase = ts6.codefix.moduleSymbolToValidIdentifier( + getSymbolParentOrFail(symbol), + scriptTarget, + /*preferCapitalized*/ + false + ); + var capitalized = ts6.codefix.moduleSymbolToValidIdentifier( + getSymbolParentOrFail(symbol), + scriptTarget, + /*preferCapitalized*/ + true + ); + if (fileNameCase === capitalized) + return fileNameCase; + return [fileNameCase, capitalized]; + } + return symbol.name; + } + ts6.getNamesForExportedSymbol = getNamesForExportedSymbol; + function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) { + if (needsNameFromDeclaration(symbol)) { + return getDefaultLikeExportNameFromDeclaration(symbol) || ts6.codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized); + } + return symbol.name; + } + ts6.getNameForExportedSymbol = getNameForExportedSymbol; + function needsNameFromDeclaration(symbol) { + return !(symbol.flags & 33554432) && (symbol.escapedName === "export=" || symbol.escapedName === "default"); + } + function getDefaultLikeExportNameFromDeclaration(symbol) { + return ts6.firstDefined(symbol.declarations, function(d) { + var _a; + return ts6.isExportAssignment(d) ? (_a = ts6.tryCast(ts6.skipOuterExpressions(d.expression), ts6.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text : void 0; + }); + } + function getSymbolParentOrFail(symbol) { + var _a; + return ts6.Debug.checkDefined(symbol.parent, "Symbol parent was undefined. Flags: ".concat(ts6.Debug.formatSymbolFlags(symbol.flags), ". ") + "Declarations: ".concat((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.map(function(d) { + var kind = ts6.Debug.formatSyntaxKind(d.kind); + var inJS = ts6.isInJSFile(d); + var expression = d.expression; + return (inJS ? "[JS]" : "") + kind + (expression ? " (expression: ".concat(ts6.Debug.formatSyntaxKind(expression.kind), ")") : ""); + }).join(", "), ".")); + } + function stringContainsAt(haystack, needle, startIndex) { + var needleLength = needle.length; + if (needleLength + startIndex > haystack.length) { + return false; + } + for (var i = 0; i < needleLength; i++) { + if (needle.charCodeAt(i) !== haystack.charCodeAt(i + startIndex)) + return false; + } + return true; + } + ts6.stringContainsAt = stringContainsAt; + function startsWithUnderscore(name) { + return name.charCodeAt(0) === 95; + } + ts6.startsWithUnderscore = startsWithUnderscore; + function isGlobalDeclaration(declaration) { + return !isNonGlobalDeclaration(declaration); + } + ts6.isGlobalDeclaration = isGlobalDeclaration; + function isNonGlobalDeclaration(declaration) { + var sourceFile = declaration.getSourceFile(); + if (!sourceFile.externalModuleIndicator && !sourceFile.commonJsModuleIndicator) { + return false; + } + return ts6.isInJSFile(declaration) || !ts6.findAncestor(declaration, ts6.isGlobalScopeAugmentation); + } + ts6.isNonGlobalDeclaration = isNonGlobalDeclaration; + function isDeprecatedDeclaration(decl) { + return !!(ts6.getCombinedNodeFlagsAlwaysIncludeJSDoc(decl) & 8192); + } + ts6.isDeprecatedDeclaration = isDeprecatedDeclaration; + function shouldUseUriStyleNodeCoreModules(file, program) { + var decisionFromFile = ts6.firstDefined(file.imports, function(node) { + if (ts6.JsTyping.nodeCoreModules.has(node.text)) { + return ts6.startsWith(node.text, "node:"); + } + }); + return decisionFromFile !== null && decisionFromFile !== void 0 ? decisionFromFile : program.usesUriStyleNodeCoreModules; + } + ts6.shouldUseUriStyleNodeCoreModules = shouldUseUriStyleNodeCoreModules; + function getNewLineKind(newLineCharacter) { + return newLineCharacter === "\n" ? 1 : 0; + } + ts6.getNewLineKind = getNewLineKind; + function diagnosticToString(diag) { + return ts6.isArray(diag) ? ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(diag[0]), diag.slice(1)) : ts6.getLocaleSpecificMessage(diag); + } + ts6.diagnosticToString = diagnosticToString; + function getFormatCodeSettingsForWriting(_a, sourceFile) { + var options = _a.options; + var shouldAutoDetectSemicolonPreference = !options.semicolons || options.semicolons === ts6.SemicolonPreference.Ignore; + var shouldRemoveSemicolons = options.semicolons === ts6.SemicolonPreference.Remove || shouldAutoDetectSemicolonPreference && !probablyUsesSemicolons(sourceFile); + return __assign(__assign({}, options), { semicolons: shouldRemoveSemicolons ? ts6.SemicolonPreference.Remove : ts6.SemicolonPreference.Ignore }); + } + ts6.getFormatCodeSettingsForWriting = getFormatCodeSettingsForWriting; + function jsxModeNeedsExplicitImport(jsx) { + return jsx === 2 || jsx === 3; + } + ts6.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport; + function isSourceFileFromLibrary(program, node) { + return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); + } + ts6.isSourceFileFromLibrary = isSourceFileFromLibrary; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var ImportKind; + (function(ImportKind2) { + ImportKind2[ImportKind2["Named"] = 0] = "Named"; + ImportKind2[ImportKind2["Default"] = 1] = "Default"; + ImportKind2[ImportKind2["Namespace"] = 2] = "Namespace"; + ImportKind2[ImportKind2["CommonJS"] = 3] = "CommonJS"; + })(ImportKind = ts6.ImportKind || (ts6.ImportKind = {})); + var ExportKind; + (function(ExportKind2) { + ExportKind2[ExportKind2["Named"] = 0] = "Named"; + ExportKind2[ExportKind2["Default"] = 1] = "Default"; + ExportKind2[ExportKind2["ExportEquals"] = 2] = "ExportEquals"; + ExportKind2[ExportKind2["UMD"] = 3] = "UMD"; + })(ExportKind = ts6.ExportKind || (ts6.ExportKind = {})); + function createCacheableExportInfoMap(host) { + var exportInfoId = 1; + var exportInfo = ts6.createMultiMap(); + var symbols = new ts6.Map(); + var packages = new ts6.Map(); + var usableByFileName; + var cache = { + isUsableByFile: function(importingFile) { + return importingFile === usableByFileName; + }, + isEmpty: function() { + return !exportInfo.size; + }, + clear: function() { + exportInfo.clear(); + symbols.clear(); + usableByFileName = void 0; + }, + add: function(importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, checker) { + if (importingFile !== usableByFileName) { + cache.clear(); + usableByFileName = importingFile; + } + var packageName; + if (moduleFile) { + var nodeModulesPathParts = ts6.getNodeModulePathParts(moduleFile.fileName); + if (nodeModulesPathParts) { + var topLevelNodeModulesIndex = nodeModulesPathParts.topLevelNodeModulesIndex, topLevelPackageNameIndex = nodeModulesPathParts.topLevelPackageNameIndex, packageRootIndex = nodeModulesPathParts.packageRootIndex; + packageName = ts6.unmangleScopedPackageName(ts6.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex))); + if (ts6.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) { + var prevDeepestNodeModulesPath = packages.get(packageName); + var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex + 1); + if (prevDeepestNodeModulesPath) { + var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts6.nodeModulesPathPart); + if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) { + packages.set(packageName, nodeModulesPath); + } + } else { + packages.set(packageName, nodeModulesPath); + } + } + } + } + var isDefault = exportKind === 1; + var namedSymbol = isDefault && ts6.getLocalSymbolForExportDefault(symbol) || symbol; + var names = exportKind === 0 || ts6.isExternalModuleSymbol(namedSymbol) ? ts6.unescapeLeadingUnderscores(symbolTableKey) : ts6.getNamesForExportedSymbol( + namedSymbol, + /*scriptTarget*/ + void 0 + ); + var symbolName = typeof names === "string" ? names : names[0]; + var capitalizedSymbolName = typeof names === "string" ? void 0 : names[1]; + var moduleName = ts6.stripQuotes(moduleSymbol.name); + var id = exportInfoId++; + var target = ts6.skipAlias(symbol, checker); + var storedSymbol = symbol.flags & 33554432 ? void 0 : symbol; + var storedModuleSymbol = moduleSymbol.flags & 33554432 ? void 0 : moduleSymbol; + if (!storedSymbol || !storedModuleSymbol) + symbols.set(id, [symbol, moduleSymbol]); + exportInfo.add(key(symbolName, symbol, ts6.isExternalModuleNameRelative(moduleName) ? void 0 : moduleName, checker), { + id, + symbolTableKey, + symbolName, + capitalizedSymbolName, + moduleName, + moduleFile, + moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, + packageName, + exportKind, + targetFlags: target.flags, + isFromPackageJson, + symbol: storedSymbol, + moduleSymbol: storedModuleSymbol + }); + }, + get: function(importingFile, key2) { + if (importingFile !== usableByFileName) + return; + var result = exportInfo.get(key2); + return result === null || result === void 0 ? void 0 : result.map(rehydrateCachedInfo); + }, + search: function(importingFile, preferCapitalized, matches, action) { + if (importingFile !== usableByFileName) + return; + return ts6.forEachEntry(exportInfo, function(info, key2) { + var _a = parseKey(key2), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; + var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; + if (matches(name, info[0].targetFlags)) { + var rehydrated = info.map(rehydrateCachedInfo); + var filtered = rehydrated.filter(function(r, i) { + return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); + }); + if (filtered.length) { + var res = action(filtered, name, !!ambientModuleName, key2); + if (res !== void 0) + return res; + } + } + }); + }, + releaseSymbols: function() { + symbols.clear(); + }, + onFileChanged: function(oldSourceFile, newSourceFile, typeAcquisitionEnabled) { + if (fileIsGlobalOnly(oldSourceFile) && fileIsGlobalOnly(newSourceFile)) { + return false; + } + if (usableByFileName && usableByFileName !== newSourceFile.path || // If ATA is enabled, auto-imports uses existing imports to guess whether you want auto-imports from node. + // Adding or removing imports from node could change the outcome of that guess, so could change the suggestions list. + typeAcquisitionEnabled && ts6.consumesNodeCoreModules(oldSourceFile) !== ts6.consumesNodeCoreModules(newSourceFile) || // Module agumentation and ambient module changes can add or remove exports available to be auto-imported. + // Changes elsewhere in the file can change the *type* of an export in a module augmentation, + // but type info is gathered in getCompletionEntryDetails, which doesn’t use the cache. + !ts6.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations) || !ambientModuleDeclarationsAreEqual(oldSourceFile, newSourceFile)) { + cache.clear(); + return true; + } + usableByFileName = newSourceFile.path; + return false; + } + }; + if (ts6.Debug.isDebugging) { + Object.defineProperty(cache, "__cache", { get: function() { + return exportInfo; + } }); + } + return cache; + function rehydrateCachedInfo(info) { + if (info.symbol && info.moduleSymbol) + return info; + var id = info.id, exportKind = info.exportKind, targetFlags = info.targetFlags, isFromPackageJson = info.isFromPackageJson, moduleFileName = info.moduleFileName; + var _a = symbols.get(id) || ts6.emptyArray, cachedSymbol = _a[0], cachedModuleSymbol = _a[1]; + if (cachedSymbol && cachedModuleSymbol) { + return { + symbol: cachedSymbol, + moduleSymbol: cachedModuleSymbol, + moduleFileName, + exportKind, + targetFlags, + isFromPackageJson + }; + } + var checker = (isFromPackageJson ? host.getPackageJsonAutoImportProvider() : host.getCurrentProgram()).getTypeChecker(); + var moduleSymbol = info.moduleSymbol || cachedModuleSymbol || ts6.Debug.checkDefined(info.moduleFile ? checker.getMergedSymbol(info.moduleFile.symbol) : checker.tryFindAmbientModule(info.moduleName)); + var symbol = info.symbol || cachedSymbol || ts6.Debug.checkDefined(exportKind === 2 ? checker.resolveExternalModuleSymbol(moduleSymbol) : checker.tryGetMemberInModuleExportsAndProperties(ts6.unescapeLeadingUnderscores(info.symbolTableKey), moduleSymbol), "Could not find symbol '".concat(info.symbolName, "' by key '").concat(info.symbolTableKey, "' in module ").concat(moduleSymbol.name)); + symbols.set(id, [symbol, moduleSymbol]); + return { + symbol, + moduleSymbol, + moduleFileName, + exportKind, + targetFlags, + isFromPackageJson + }; + } + function key(importedName, symbol, ambientModuleName, checker) { + var moduleKey = ambientModuleName || ""; + return "".concat(importedName, "|").concat(ts6.getSymbolId(ts6.skipAlias(symbol, checker)), "|").concat(moduleKey); + } + function parseKey(key2) { + var symbolName = key2.substring(0, key2.indexOf("|")); + var moduleKey = key2.substring(key2.lastIndexOf("|") + 1); + var ambientModuleName = moduleKey === "" ? void 0 : moduleKey; + return { symbolName, ambientModuleName }; + } + function fileIsGlobalOnly(file) { + return !file.commonJsModuleIndicator && !file.externalModuleIndicator && !file.moduleAugmentations && !file.ambientModuleNames; + } + function ambientModuleDeclarationsAreEqual(oldSourceFile, newSourceFile) { + if (!ts6.arrayIsEqualTo(oldSourceFile.ambientModuleNames, newSourceFile.ambientModuleNames)) { + return false; + } + var oldFileStatementIndex = -1; + var newFileStatementIndex = -1; + var _loop_2 = function(ambientModuleName2) { + var isMatchingModuleDeclaration = function(node) { + return ts6.isNonGlobalAmbientModule(node) && node.name.text === ambientModuleName2; + }; + oldFileStatementIndex = ts6.findIndex(oldSourceFile.statements, isMatchingModuleDeclaration, oldFileStatementIndex + 1); + newFileStatementIndex = ts6.findIndex(newSourceFile.statements, isMatchingModuleDeclaration, newFileStatementIndex + 1); + if (oldSourceFile.statements[oldFileStatementIndex] !== newSourceFile.statements[newFileStatementIndex]) { + return { value: false }; + } + }; + for (var _i = 0, _a = newSourceFile.ambientModuleNames; _i < _a.length; _i++) { + var ambientModuleName = _a[_i]; + var state_2 = _loop_2(ambientModuleName); + if (typeof state_2 === "object") + return state_2.value; + } + return true; + } + function isNotShadowedByDeeperNodeModulesPackage(info, packageName) { + if (!packageName || !info.moduleFileName) + return true; + var typingsCacheLocation = host.getGlobalTypingsCacheLocation(); + if (typingsCacheLocation && ts6.startsWith(info.moduleFileName, typingsCacheLocation)) + return true; + var packageDeepestNodeModulesPath = packages.get(packageName); + return !packageDeepestNodeModulesPath || ts6.startsWith(info.moduleFileName, packageDeepestNodeModulesPath); + } + } + ts6.createCacheableExportInfoMap = createCacheableExportInfoMap; + function isImportableFile(program, from, to, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) { + var _a; + if (from === to) + return false; + var cachedResult = moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {}); + if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== void 0) { + return !cachedResult.isBlockedByPackageJsonDependencies; + } + var getCanonicalFileName = ts6.hostGetCanonicalFileName(moduleSpecifierResolutionHost); + var globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(moduleSpecifierResolutionHost); + var hasImportablePath = !!ts6.moduleSpecifiers.forEachFileNameOfModule( + from.fileName, + to.fileName, + moduleSpecifierResolutionHost, + /*preferSymlinks*/ + false, + function(toPath) { + var toFile = program.getSourceFile(toPath); + return (toFile === to || !toFile) && isImportablePath(from.fileName, toPath, getCanonicalFileName, globalTypingsCache); + } + ); + if (packageJsonFilter) { + var isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost); + moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable); + return isAutoImportable; + } + return hasImportablePath; + } + ts6.isImportableFile = isImportableFile; + function isImportablePath(fromPath, toPath, getCanonicalFileName, globalCachePath) { + var toNodeModules = ts6.forEachAncestorDirectory(toPath, function(ancestor) { + return ts6.getBaseFileName(ancestor) === "node_modules" ? ancestor : void 0; + }); + var toNodeModulesParent = toNodeModules && ts6.getDirectoryPath(getCanonicalFileName(toNodeModules)); + return toNodeModulesParent === void 0 || ts6.startsWith(getCanonicalFileName(fromPath), toNodeModulesParent) || !!globalCachePath && ts6.startsWith(getCanonicalFileName(globalCachePath), toNodeModulesParent); + } + function forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, cb) { + var _a, _b; + var useCaseSensitiveFileNames = ts6.hostUsesCaseSensitiveFileNames(host); + var excludePatterns = preferences.autoImportFileExcludePatterns && ts6.mapDefined(preferences.autoImportFileExcludePatterns, function(spec) { + var pattern = ts6.getPatternFromSpec(spec, "", "exclude"); + return pattern ? ts6.getRegexFromPattern(pattern, useCaseSensitiveFileNames) : void 0; + }); + forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, function(module2, file) { + return cb( + module2, + file, + program, + /*isFromPackageJson*/ + false + ); + }); + var autoImportProvider = useAutoImportProvider && ((_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host)); + if (autoImportProvider) { + var start = ts6.timestamp(); + forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, function(module2, file) { + return cb( + module2, + file, + autoImportProvider, + /*isFromPackageJson*/ + true + ); + }); + (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, "forEachExternalModuleToImportFrom autoImportProvider: ".concat(ts6.timestamp() - start)); + } + } + ts6.forEachExternalModuleToImportFrom = forEachExternalModuleToImportFrom; + function forEachExternalModule(checker, allSourceFiles, excludePatterns, cb) { + var _a; + var isExcluded = function(fileName) { + return excludePatterns === null || excludePatterns === void 0 ? void 0 : excludePatterns.some(function(p) { + return p.test(fileName); + }); + }; + for (var _i = 0, _b = checker.getAmbientModules(); _i < _b.length; _i++) { + var ambient = _b[_i]; + if (!ts6.stringContains(ambient.name, "*") && !(excludePatterns && ((_a = ambient.declarations) === null || _a === void 0 ? void 0 : _a.every(function(d) { + return isExcluded(d.getSourceFile().fileName); + })))) { + cb( + ambient, + /*sourceFile*/ + void 0 + ); + } + } + for (var _c = 0, allSourceFiles_1 = allSourceFiles; _c < allSourceFiles_1.length; _c++) { + var sourceFile = allSourceFiles_1[_c]; + if (ts6.isExternalOrCommonJsModule(sourceFile) && !isExcluded(sourceFile.fileName)) { + cb(checker.getMergedSymbol(sourceFile.symbol), sourceFile); + } + } + } + function getExportInfoMap(importingFile, host, program, preferences, cancellationToken) { + var _a, _b, _c, _d, _e; + var start = ts6.timestamp(); + (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host); + var cache = ((_b = host.getCachedExportInfoMap) === null || _b === void 0 ? void 0 : _b.call(host)) || createCacheableExportInfoMap({ + getCurrentProgram: function() { + return program; + }, + getPackageJsonAutoImportProvider: function() { + var _a2; + return (_a2 = host.getPackageJsonAutoImportProvider) === null || _a2 === void 0 ? void 0 : _a2.call(host); + }, + getGlobalTypingsCacheLocation: function() { + var _a2; + return (_a2 = host.getGlobalTypingsCacheLocation) === null || _a2 === void 0 ? void 0 : _a2.call(host); + } + }); + if (cache.isUsableByFile(importingFile.path)) { + (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, "getExportInfoMap: cache hit"); + return cache; + } + (_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results"); + var compilerOptions = program.getCompilerOptions(); + var moduleCount = 0; + try { + forEachExternalModuleToImportFrom( + program, + host, + preferences, + /*useAutoImportProvider*/ + true, + function(moduleSymbol, moduleFile, program2, isFromPackageJson) { + if (++moduleCount % 100 === 0) + cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.throwIfCancellationRequested(); + var seenExports = new ts6.Map(); + var checker = program2.getTypeChecker(); + var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); + if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) { + cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 ? "default" : "export=", moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker); + } + checker.forEachExportAndPropertyOfModule(moduleSymbol, function(exported, key) { + if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts6.addToSeen(seenExports, key)) { + cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0, isFromPackageJson, checker); + } + }); + } + ); + } catch (err) { + cache.clear(); + throw err; + } + (_e = host.log) === null || _e === void 0 ? void 0 : _e.call(host, "getExportInfoMap: done in ".concat(ts6.timestamp() - start, " ms")); + return cache; + } + ts6.getExportInfoMap = getExportInfoMap; + function getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions) { + var exported = getDefaultLikeExportWorker(moduleSymbol, checker); + if (!exported) + return void 0; + var symbol = exported.symbol, exportKind = exported.exportKind; + var info = getDefaultExportInfoWorker(symbol, checker, compilerOptions); + return info && __assign({ symbol, exportKind }, info); + } + ts6.getDefaultLikeExportInfo = getDefaultLikeExportInfo; + function isImportableSymbol(symbol, checker) { + return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !ts6.isKnownSymbol(symbol) && !ts6.isPrivateIdentifierSymbol(symbol); + } + function getDefaultLikeExportWorker(moduleSymbol, checker) { + var exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) + return { + symbol: exportEquals, + exportKind: 2 + /* ExportKind.ExportEquals */ + }; + var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); + if (defaultExport) + return { + symbol: defaultExport, + exportKind: 1 + /* ExportKind.Default */ + }; + } + function getDefaultExportInfoWorker(defaultExport, checker, compilerOptions) { + var localSymbol = ts6.getLocalSymbolForExportDefault(defaultExport); + if (localSymbol) + return { symbolForMeaning: localSymbol, name: localSymbol.name }; + var name = getNameForExportDefault(defaultExport); + if (name !== void 0) + return { symbolForMeaning: defaultExport, name }; + if (defaultExport.flags & 2097152) { + var aliased = checker.getImmediateAliasedSymbol(defaultExport); + if (aliased && aliased.parent) { + return getDefaultExportInfoWorker(aliased, checker, compilerOptions); + } + } + if (defaultExport.escapedName !== "default" && defaultExport.escapedName !== "export=") { + return { symbolForMeaning: defaultExport, name: defaultExport.getName() }; + } + return { symbolForMeaning: defaultExport, name: ts6.getNameForExportedSymbol(defaultExport, compilerOptions.target) }; + } + function getNameForExportDefault(symbol) { + return symbol.declarations && ts6.firstDefined(symbol.declarations, function(declaration) { + var _a; + if (ts6.isExportAssignment(declaration)) { + return (_a = ts6.tryCast(ts6.skipOuterExpressions(declaration.expression), ts6.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; + } else if (ts6.isExportSpecifier(declaration)) { + ts6.Debug.assert(declaration.name.text === "default", "Expected the specifier to be a default export"); + return declaration.propertyName && declaration.propertyName.text; + } + }); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function createClassifier() { + var scanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false + ); + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } + function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { + var token = 0; + var lastNonTriviaToken = 0; + var templateStack = []; + var _a = getPrefixFromLexState(lexState), prefix2 = _a.prefix, pushTemplate = _a.pushTemplate; + text = prefix2 + text; + var offset = prefix2.length; + if (pushTemplate) { + templateStack.push( + 15 + /* SyntaxKind.TemplateHead */ + ); + } + scanner.setText(text); + var endOfLineState = 0; + var spans = []; + var angleBracketStack = 0; + do { + token = scanner.scan(); + if (!ts6.isTrivia(token)) { + handleToken(); + lastNonTriviaToken = token; + } + var end = scanner.getTextPos(); + pushEncodedClassification(scanner.getTokenPos(), end, offset, classFromKind(token), spans); + if (end >= text.length) { + var end_1 = getNewEndOfLineState(scanner, token, ts6.lastOrUndefined(templateStack)); + if (end_1 !== void 0) { + endOfLineState = end_1; + } + } + } while (token !== 1); + function handleToken() { + switch (token) { + case 43: + case 68: + if (!noRegexTable[lastNonTriviaToken] && scanner.reScanSlashToken() === 13) { + token = 13; + } + break; + case 29: + if (lastNonTriviaToken === 79) { + angleBracketStack++; + } + break; + case 31: + if (angleBracketStack > 0) { + angleBracketStack--; + } + break; + case 131: + case 152: + case 148: + case 134: + case 153: + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { + token = 79; + } + break; + case 15: + templateStack.push(token); + break; + case 18: + if (templateStack.length > 0) { + templateStack.push(token); + } + break; + case 19: + if (templateStack.length > 0) { + var lastTemplateStackToken = ts6.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 15) { + token = scanner.reScanTemplateToken( + /* isTaggedTemplate */ + false + ); + if (token === 17) { + templateStack.pop(); + } else { + ts6.Debug.assertEqual(token, 16, "Should have been a template middle."); + } + } else { + ts6.Debug.assertEqual(lastTemplateStackToken, 18, "Should have been an open brace"); + templateStack.pop(); + } + } + break; + default: + if (!ts6.isKeyword(token)) { + break; + } + if (lastNonTriviaToken === 24) { + token = 79; + } else if (ts6.isKeyword(lastNonTriviaToken) && ts6.isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + token = 79; + } + } + } + return { endOfLineState, spans }; + } + return { getClassificationsForLine, getEncodedLexicalClassifications }; + } + ts6.createClassifier = createClassifier; + var noRegexTable = ts6.arrayToNumericMap([ + 79, + 10, + 8, + 9, + 13, + 108, + 45, + 46, + 21, + 23, + 19, + 110, + 95 + ], function(token) { + return token; + }, function() { + return true; + }); + function getNewEndOfLineState(scanner, token, lastOnTemplateStack) { + switch (token) { + case 10: { + if (!scanner.isUnterminated()) + return void 0; + var tokenText = scanner.getTokenText(); + var lastCharIndex = tokenText.length - 1; + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { + numBackslashes++; + } + if ((numBackslashes & 1) === 0) + return void 0; + return tokenText.charCodeAt(0) === 34 ? 3 : 2; + } + case 3: + return scanner.isUnterminated() ? 1 : void 0; + default: + if (ts6.isTemplateLiteralKind(token)) { + if (!scanner.isUnterminated()) { + return void 0; + } + switch (token) { + case 17: + return 5; + case 14: + return 4; + default: + return ts6.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + return lastOnTemplateStack === 15 ? 6 : void 0; + } + } + function pushEncodedClassification(start, end, offset, classification, result) { + if (classification === 8) { + return; + } + if (start === 0 && offset > 0) { + start += offset; + } + var length = end - start; + if (length > 0) { + result.push(start - offset, length, classification); + } + } + function convertClassificationsToResult(classifications, text) { + var entries = []; + var dense = classifications.spans; + var lastEnd = 0; + for (var i = 0; i < dense.length; i += 3) { + var start = dense[i]; + var length_1 = dense[i + 1]; + var type = dense[i + 2]; + if (lastEnd >= 0) { + var whitespaceLength_1 = start - lastEnd; + if (whitespaceLength_1 > 0) { + entries.push({ length: whitespaceLength_1, classification: ts6.TokenClass.Whitespace }); + } + } + entries.push({ length: length_1, classification: convertClassification(type) }); + lastEnd = start + length_1; + } + var whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: ts6.TokenClass.Whitespace }); + } + return { entries, finalLexState: classifications.endOfLineState }; + } + function convertClassification(type) { + switch (type) { + case 1: + return ts6.TokenClass.Comment; + case 3: + return ts6.TokenClass.Keyword; + case 4: + return ts6.TokenClass.NumberLiteral; + case 25: + return ts6.TokenClass.BigIntLiteral; + case 5: + return ts6.TokenClass.Operator; + case 6: + return ts6.TokenClass.StringLiteral; + case 8: + return ts6.TokenClass.Whitespace; + case 10: + return ts6.TokenClass.Punctuation; + case 2: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 9: + case 17: + return ts6.TokenClass.Identifier; + default: + return void 0; + } + } + function canFollow(keyword1, keyword2) { + if (!ts6.isAccessibilityModifier(keyword1)) { + return true; + } + switch (keyword2) { + case 137: + case 151: + case 135: + case 124: + case 127: + return true; + default: + return false; + } + } + function getPrefixFromLexState(lexState) { + switch (lexState) { + case 3: + return { prefix: '"\\\n' }; + case 2: + return { prefix: "'\\\n" }; + case 1: + return { prefix: "/*\n" }; + case 4: + return { prefix: "`\n" }; + case 5: + return { prefix: "}\n", pushTemplate: true }; + case 6: + return { prefix: "", pushTemplate: true }; + case 0: + return { prefix: "" }; + default: + return ts6.Debug.assertNever(lexState); + } + } + function isBinaryExpressionOperatorToken(token) { + switch (token) { + case 41: + case 43: + case 44: + case 39: + case 40: + case 47: + case 48: + case 49: + case 29: + case 31: + case 32: + case 33: + case 102: + case 101: + case 128: + case 150: + case 34: + case 35: + case 36: + case 37: + case 50: + case 52: + case 51: + case 55: + case 56: + case 74: + case 73: + case 78: + case 70: + case 71: + case 72: + case 64: + case 65: + case 66: + case 68: + case 69: + case 63: + case 27: + case 60: + case 75: + case 76: + case 77: + return true; + default: + return false; + } + } + function isPrefixUnaryExpressionOperatorToken(token) { + switch (token) { + case 39: + case 40: + case 54: + case 53: + case 45: + case 46: + return true; + default: + return false; + } + } + function classFromKind(token) { + if (ts6.isKeyword(token)) { + return 3; + } else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { + return 5; + } else if (token >= 18 && token <= 78) { + return 10; + } + switch (token) { + case 8: + return 4; + case 9: + return 25; + case 10: + return 6; + case 13: + return 7; + case 7: + case 3: + case 2: + return 1; + case 5: + case 4: + return 8; + case 79: + default: + if (ts6.isTemplateLiteralKind(token)) { + return 6; + } + return 2; + } + } + function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) { + return convertClassificationsToSpans(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span)); + } + ts6.getSemanticClassifications = getSemanticClassifications; + function checkForClassificationCancellation(cancellationToken, kind) { + switch (kind) { + case 264: + case 260: + case 261: + case 259: + case 228: + case 215: + case 216: + cancellationToken.throwIfCancellationRequested(); + } + } + function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) { + var spans = []; + sourceFile.forEachChild(function cb(node) { + if (!node || !ts6.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { + return; + } + checkForClassificationCancellation(cancellationToken, node.kind); + if (ts6.isIdentifier(node) && !ts6.nodeIsMissing(node) && classifiableNames.has(node.escapedText)) { + var symbol = typeChecker.getSymbolAtLocation(node); + var type = symbol && classifySymbol(symbol, ts6.getMeaningFromLocation(node), typeChecker); + if (type) { + pushClassification(node.getStart(sourceFile), node.getEnd(), type); + } + } + node.forEachChild(cb); + }); + return { + spans, + endOfLineState: 0 + /* EndOfLineState.None */ + }; + function pushClassification(start, end, type) { + var length = end - start; + ts6.Debug.assert(length > 0, "Classification had non-positive length of ".concat(length)); + spans.push(start); + spans.push(length); + spans.push(type); + } + } + ts6.getEncodedSemanticClassifications = getEncodedSemanticClassifications; + function classifySymbol(symbol, meaningAtPosition, checker) { + var flags = symbol.getFlags(); + if ((flags & 2885600) === 0) { + return void 0; + } else if (flags & 32) { + return 11; + } else if (flags & 384) { + return 12; + } else if (flags & 524288) { + return 16; + } else if (flags & 1536) { + return meaningAtPosition & 4 || meaningAtPosition & 1 && hasValueSideModule(symbol) ? 14 : void 0; + } else if (flags & 2097152) { + return classifySymbol(checker.getAliasedSymbol(symbol), meaningAtPosition, checker); + } else if (meaningAtPosition & 2) { + return flags & 64 ? 13 : flags & 262144 ? 15 : void 0; + } else { + return void 0; + } + } + function hasValueSideModule(symbol) { + return ts6.some(symbol.declarations, function(declaration) { + return ts6.isModuleDeclaration(declaration) && ts6.getModuleInstanceState(declaration) === 1; + }); + } + function getClassificationTypeName(type) { + switch (type) { + case 1: + return "comment"; + case 2: + return "identifier"; + case 3: + return "keyword"; + case 4: + return "number"; + case 25: + return "bigint"; + case 5: + return "operator"; + case 6: + return "string"; + case 8: + return "whitespace"; + case 9: + return "text"; + case 10: + return "punctuation"; + case 11: + return "class name"; + case 12: + return "enum name"; + case 13: + return "interface name"; + case 14: + return "module name"; + case 15: + return "type parameter name"; + case 16: + return "type alias name"; + case 17: + return "parameter name"; + case 18: + return "doc comment tag name"; + case 19: + return "jsx open tag name"; + case 20: + return "jsx close tag name"; + case 21: + return "jsx self closing tag name"; + case 22: + return "jsx attribute"; + case 23: + return "jsx text"; + case 24: + return "jsx attribute string literal value"; + default: + return void 0; + } + } + function convertClassificationsToSpans(classifications) { + ts6.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0; i < dense.length; i += 3) { + result.push({ + textSpan: ts6.createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + return result; + } + function getSyntacticClassifications(cancellationToken, sourceFile, span) { + return convertClassificationsToSpans(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)); + } + ts6.getSyntacticClassifications = getSyntacticClassifications; + function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) { + var spanStart = span.start; + var spanLength = span.length; + var triviaScanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false, + sourceFile.languageVariant, + sourceFile.text + ); + var mergeConflictScanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false, + sourceFile.languageVariant, + sourceFile.text + ); + var result = []; + processElement(sourceFile); + return { + spans: result, + endOfLineState: 0 + /* EndOfLineState.None */ + }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } + function classifyLeadingTriviaAndGetTokenStart(token) { + triviaScanner.setTextPos(token.pos); + while (true) { + var start = triviaScanner.getTextPos(); + if (!ts6.couldStartTrivia(sourceFile.text, start)) { + return start; + } + var kind = triviaScanner.scan(); + var end = triviaScanner.getTextPos(); + var width = end - start; + if (!ts6.isTrivia(kind)) { + return start; + } + switch (kind) { + case 4: + case 5: + continue; + case 2: + case 3: + classifyComment(token, kind, start, width); + triviaScanner.setTextPos(end); + continue; + case 7: + var text = sourceFile.text; + var ch = text.charCodeAt(start); + if (ch === 60 || ch === 62) { + pushClassification( + start, + width, + 1 + /* ClassificationType.comment */ + ); + continue; + } + ts6.Debug.assert( + ch === 124 || ch === 61 + /* CharacterCodes.equals */ + ); + classifyDisabledMergeCode(text, start, end); + break; + case 6: + break; + default: + ts6.Debug.assertNever(kind); + } + } + } + function classifyComment(token, kind, start, width) { + if (kind === 3) { + var docCommentAndDiagnostics = ts6.parseIsolatedJSDocComment(sourceFile.text, start, width); + if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) { + ts6.setParent(docCommentAndDiagnostics.jsDoc, token); + classifyJSDocComment(docCommentAndDiagnostics.jsDoc); + return; + } + } else if (kind === 2) { + if (tryClassifyTripleSlashComment(start, width)) { + return; + } + } + pushCommentRange(start, width); + } + function pushCommentRange(start, width) { + pushClassification( + start, + width, + 1 + /* ClassificationType.comment */ + ); + } + function classifyJSDocComment(docComment) { + var _a, _b, _c, _d, _e, _f, _g; + var pos = docComment.pos; + if (docComment.tags) { + for (var _i = 0, _h = docComment.tags; _i < _h.length; _i++) { + var tag = _h[_i]; + if (tag.pos !== pos) { + pushCommentRange(pos, tag.pos - pos); + } + pushClassification( + tag.pos, + 1, + 10 + /* ClassificationType.punctuation */ + ); + pushClassification( + tag.tagName.pos, + tag.tagName.end - tag.tagName.pos, + 18 + /* ClassificationType.docCommentTagName */ + ); + pos = tag.tagName.end; + var commentStart = tag.tagName.end; + switch (tag.kind) { + case 343: + var param = tag; + processJSDocParameterTag(param); + commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; + break; + case 350: + var prop = tag; + commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; + break; + case 347: + processJSDocTemplateTag(tag); + pos = tag.end; + commentStart = tag.typeParameters.end; + break; + case 348: + var type = tag; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + break; + case 341: + commentStart = tag.typeExpression.end; + break; + case 346: + processElement(tag.typeExpression); + pos = tag.end; + commentStart = tag.typeExpression.end; + break; + case 345: + case 342: + commentStart = tag.typeExpression.end; + break; + case 344: + processElement(tag.typeExpression); + pos = tag.end; + commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; + break; + case 349: + commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; + break; + case 331: + case 332: + commentStart = tag.class.end; + break; + } + if (typeof tag.comment === "object") { + pushCommentRange(tag.comment.pos, tag.comment.end - tag.comment.pos); + } else if (typeof tag.comment === "string") { + pushCommentRange(commentStart, tag.end - commentStart); + } + } + } + if (pos !== docComment.end) { + pushCommentRange(pos, docComment.end - pos); + } + return; + function processJSDocParameterTag(tag2) { + if (tag2.isNameFirst) { + pushCommentRange(pos, tag2.name.pos - pos); + pushClassification( + tag2.name.pos, + tag2.name.end - tag2.name.pos, + 17 + /* ClassificationType.parameterName */ + ); + pos = tag2.name.end; + } + if (tag2.typeExpression) { + pushCommentRange(pos, tag2.typeExpression.pos - pos); + processElement(tag2.typeExpression); + pos = tag2.typeExpression.end; + } + if (!tag2.isNameFirst) { + pushCommentRange(pos, tag2.name.pos - pos); + pushClassification( + tag2.name.pos, + tag2.name.end - tag2.name.pos, + 17 + /* ClassificationType.parameterName */ + ); + pos = tag2.name.end; + } + } + } + function tryClassifyTripleSlashComment(start, width) { + var tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im; + var attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img; + var text = sourceFile.text.substr(start, width); + var match = tripleSlashXMLCommentRegEx.exec(text); + if (!match) { + return false; + } + if (!match[3] || !(match[3] in ts6.commentPragmas)) { + return false; + } + var pos = start; + pushCommentRange(pos, match[1].length); + pos += match[1].length; + pushClassification( + pos, + match[2].length, + 10 + /* ClassificationType.punctuation */ + ); + pos += match[2].length; + pushClassification( + pos, + match[3].length, + 21 + /* ClassificationType.jsxSelfClosingTagName */ + ); + pos += match[3].length; + var attrText = match[4]; + var attrPos = pos; + while (true) { + var attrMatch = attributeRegex.exec(attrText); + if (!attrMatch) { + break; + } + var newAttrPos = pos + attrMatch.index + attrMatch[1].length; + if (newAttrPos > attrPos) { + pushCommentRange(attrPos, newAttrPos - attrPos); + attrPos = newAttrPos; + } + pushClassification( + attrPos, + attrMatch[2].length, + 22 + /* ClassificationType.jsxAttribute */ + ); + attrPos += attrMatch[2].length; + if (attrMatch[3].length) { + pushCommentRange(attrPos, attrMatch[3].length); + attrPos += attrMatch[3].length; + } + pushClassification( + attrPos, + attrMatch[4].length, + 5 + /* ClassificationType.operator */ + ); + attrPos += attrMatch[4].length; + if (attrMatch[5].length) { + pushCommentRange(attrPos, attrMatch[5].length); + attrPos += attrMatch[5].length; + } + pushClassification( + attrPos, + attrMatch[6].length, + 24 + /* ClassificationType.jsxAttributeStringLiteralValue */ + ); + attrPos += attrMatch[6].length; + } + pos += match[4].length; + if (pos > attrPos) { + pushCommentRange(attrPos, pos - attrPos); + } + if (match[5]) { + pushClassification( + pos, + match[5].length, + 10 + /* ClassificationType.punctuation */ + ); + pos += match[5].length; + } + var end = start + width; + if (pos < end) { + pushCommentRange(pos, end - pos); + } + return true; + } + function processJSDocTemplateTag(tag) { + for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) { + var child = _a[_i]; + processElement(child); + } + } + function classifyDisabledMergeCode(text, start, end) { + var i; + for (i = start; i < end; i++) { + if (ts6.isLineBreak(text.charCodeAt(i))) { + break; + } + } + pushClassification( + start, + i - start, + 1 + /* ClassificationType.comment */ + ); + mergeConflictScanner.setTextPos(i); + while (mergeConflictScanner.getTextPos() < end) { + classifyDisabledCodeToken(); + } + } + function classifyDisabledCodeToken() { + var start = mergeConflictScanner.getTextPos(); + var tokenKind = mergeConflictScanner.scan(); + var end = mergeConflictScanner.getTextPos(); + var type = classifyTokenType(tokenKind); + if (type) { + pushClassification(start, end - start, type); + } + } + function tryClassifyNode(node) { + if (ts6.isJSDoc(node)) { + return true; + } + if (ts6.nodeIsMissing(node)) { + return true; + } + var classifiedElementName = tryClassifyJsxElementName(node); + if (!ts6.isToken(node) && node.kind !== 11 && classifiedElementName === void 0) { + return false; + } + var tokenStart = node.kind === 11 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenWidth = node.end - tokenStart; + ts6.Debug.assert(tokenWidth >= 0); + if (tokenWidth > 0) { + var type = classifiedElementName || classifyTokenType(node.kind, node); + if (type) { + pushClassification(tokenStart, tokenWidth, type); + } + } + return true; + } + function tryClassifyJsxElementName(token) { + switch (token.parent && token.parent.kind) { + case 283: + if (token.parent.tagName === token) { + return 19; + } + break; + case 284: + if (token.parent.tagName === token) { + return 20; + } + break; + case 282: + if (token.parent.tagName === token) { + return 21; + } + break; + case 288: + if (token.parent.name === token) { + return 22; + } + break; + } + return void 0; + } + function classifyTokenType(tokenKind, token) { + if (ts6.isKeyword(tokenKind)) { + return 3; + } + if (tokenKind === 29 || tokenKind === 31) { + if (token && ts6.getTypeArgumentOrTypeParameterList(token.parent)) { + return 10; + } + } + if (ts6.isPunctuation(tokenKind)) { + if (token) { + var parent = token.parent; + if (tokenKind === 63) { + if (parent.kind === 257 || parent.kind === 169 || parent.kind === 166 || parent.kind === 288) { + return 5; + } + } + if (parent.kind === 223 || parent.kind === 221 || parent.kind === 222 || parent.kind === 224) { + return 5; + } + } + return 10; + } else if (tokenKind === 8) { + return 4; + } else if (tokenKind === 9) { + return 25; + } else if (tokenKind === 10) { + return token && token.parent.kind === 288 ? 24 : 6; + } else if (tokenKind === 13) { + return 6; + } else if (ts6.isTemplateLiteralKind(tokenKind)) { + return 6; + } else if (tokenKind === 11) { + return 23; + } else if (tokenKind === 79) { + if (token) { + switch (token.parent.kind) { + case 260: + if (token.parent.name === token) { + return 11; + } + return; + case 165: + if (token.parent.name === token) { + return 15; + } + return; + case 261: + if (token.parent.name === token) { + return 13; + } + return; + case 263: + if (token.parent.name === token) { + return 12; + } + return; + case 264: + if (token.parent.name === token) { + return 14; + } + return; + case 166: + if (token.parent.name === token) { + return ts6.isThisIdentifier(token) ? 3 : 17; + } + return; + } + if (ts6.isConstTypeReference(token.parent)) { + return 3; + } + } + return 2; + } + } + function processElement(element) { + if (!element) { + return; + } + if (ts6.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { + checkForClassificationCancellation(cancellationToken, element.kind); + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; + if (!tryClassifyNode(child)) { + processElement(child); + } + } + } + } + } + ts6.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var classifier; + (function(classifier2) { + var v2020; + (function(v20202) { + var TokenEncodingConsts; + (function(TokenEncodingConsts2) { + TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset"; + TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask"; + })(TokenEncodingConsts = v20202.TokenEncodingConsts || (v20202.TokenEncodingConsts = {})); + var TokenType; + (function(TokenType2) { + TokenType2[TokenType2["class"] = 0] = "class"; + TokenType2[TokenType2["enum"] = 1] = "enum"; + TokenType2[TokenType2["interface"] = 2] = "interface"; + TokenType2[TokenType2["namespace"] = 3] = "namespace"; + TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter"; + TokenType2[TokenType2["type"] = 5] = "type"; + TokenType2[TokenType2["parameter"] = 6] = "parameter"; + TokenType2[TokenType2["variable"] = 7] = "variable"; + TokenType2[TokenType2["enumMember"] = 8] = "enumMember"; + TokenType2[TokenType2["property"] = 9] = "property"; + TokenType2[TokenType2["function"] = 10] = "function"; + TokenType2[TokenType2["member"] = 11] = "member"; + })(TokenType = v20202.TokenType || (v20202.TokenType = {})); + var TokenModifier; + (function(TokenModifier2) { + TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration"; + TokenModifier2[TokenModifier2["static"] = 1] = "static"; + TokenModifier2[TokenModifier2["async"] = 2] = "async"; + TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly"; + TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary"; + TokenModifier2[TokenModifier2["local"] = 5] = "local"; + })(TokenModifier = v20202.TokenModifier || (v20202.TokenModifier = {})); + function getSemanticClassifications(program, cancellationToken, sourceFile, span) { + var classifications = getEncodedSemanticClassifications(program, cancellationToken, sourceFile, span); + ts6.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0; i < dense.length; i += 3) { + result.push({ + textSpan: ts6.createTextSpan(dense[i], dense[i + 1]), + classificationType: dense[i + 2] + }); + } + return result; + } + v20202.getSemanticClassifications = getSemanticClassifications; + function getEncodedSemanticClassifications(program, cancellationToken, sourceFile, span) { + return { + spans: getSemanticTokens(program, sourceFile, span, cancellationToken), + endOfLineState: 0 + /* EndOfLineState.None */ + }; + } + v20202.getEncodedSemanticClassifications = getEncodedSemanticClassifications; + function getSemanticTokens(program, sourceFile, span, cancellationToken) { + var resultTokens = []; + var collector = function(node, typeIdx, modifierSet) { + resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8) + modifierSet); + }; + if (program && sourceFile) { + collectTokens(program, sourceFile, span, collector, cancellationToken); + } + return resultTokens; + } + function collectTokens(program, sourceFile, span, collector, cancellationToken) { + var typeChecker = program.getTypeChecker(); + var inJSXElement = false; + function visit(node) { + switch (node.kind) { + case 264: + case 260: + case 261: + case 259: + case 228: + case 215: + case 216: + cancellationToken.throwIfCancellationRequested(); + } + if (!node || !ts6.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { + return; + } + var prevInJSXElement = inJSXElement; + if (ts6.isJsxElement(node) || ts6.isJsxSelfClosingElement(node)) { + inJSXElement = true; + } + if (ts6.isJsxExpression(node)) { + inJSXElement = false; + } + if (ts6.isIdentifier(node) && !inJSXElement && !inImportClause(node) && !ts6.isInfinityOrNaNString(node.escapedText)) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + if (symbol.flags & 2097152) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + var typeIdx = classifySymbol(symbol, ts6.getMeaningFromLocation(node)); + if (typeIdx !== void 0) { + var modifierSet = 0; + if (node.parent) { + var parentIsDeclaration = ts6.isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx; + if (parentIsDeclaration && node.parent.name === node) { + modifierSet = 1 << 0; + } + } + if (typeIdx === 6 && isRightSideOfQualifiedNameOrPropertyAccess(node)) { + typeIdx = 9; + } + typeIdx = reclassifyByType(typeChecker, node, typeIdx); + var decl = symbol.valueDeclaration; + if (decl) { + var modifiers = ts6.getCombinedModifierFlags(decl); + var nodeFlags = ts6.getCombinedNodeFlags(decl); + if (modifiers & 32) { + modifierSet |= 1 << 1; + } + if (modifiers & 512) { + modifierSet |= 1 << 2; + } + if (typeIdx !== 0 && typeIdx !== 2) { + if (modifiers & 64 || nodeFlags & 2 || symbol.getFlags() & 8) { + modifierSet |= 1 << 3; + } + } + if ((typeIdx === 7 || typeIdx === 10) && isLocalDeclaration(decl, sourceFile)) { + modifierSet |= 1 << 5; + } + if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) { + modifierSet |= 1 << 4; + } + } else if (symbol.declarations && symbol.declarations.some(function(d) { + return program.isSourceFileDefaultLibrary(d.getSourceFile()); + })) { + modifierSet |= 1 << 4; + } + collector(node, typeIdx, modifierSet); + } + } + } + ts6.forEachChild(node, visit); + inJSXElement = prevInJSXElement; + } + visit(sourceFile); + } + function classifySymbol(symbol, meaning) { + var flags = symbol.getFlags(); + if (flags & 32) { + return 0; + } else if (flags & 384) { + return 1; + } else if (flags & 524288) { + return 5; + } else if (flags & 64) { + if (meaning & 2) { + return 2; + } + } else if (flags & 262144) { + return 4; + } + var decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0]; + if (decl && ts6.isBindingElement(decl)) { + decl = getDeclarationForBindingElement(decl); + } + return decl && tokenFromDeclarationMapping.get(decl.kind); + } + function reclassifyByType(typeChecker, node, typeIdx) { + if (typeIdx === 7 || typeIdx === 9 || typeIdx === 6) { + var type_1 = typeChecker.getTypeAtLocation(node); + if (type_1) { + var test = function(condition) { + return condition(type_1) || type_1.isUnion() && type_1.types.some(condition); + }; + if (typeIdx !== 6 && test(function(t) { + return t.getConstructSignatures().length > 0; + })) { + return 0; + } + if (test(function(t) { + return t.getCallSignatures().length > 0; + }) && !test(function(t) { + return t.getProperties().length > 0; + }) || isExpressionInCallExpression(node)) { + return typeIdx === 9 ? 11 : 10; + } + } + } + return typeIdx; + } + function isLocalDeclaration(decl, sourceFile) { + if (ts6.isBindingElement(decl)) { + decl = getDeclarationForBindingElement(decl); + } + if (ts6.isVariableDeclaration(decl)) { + return (!ts6.isSourceFile(decl.parent.parent.parent) || ts6.isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile; + } else if (ts6.isFunctionDeclaration(decl)) { + return !ts6.isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile; + } + return false; + } + function getDeclarationForBindingElement(element) { + while (true) { + if (ts6.isBindingElement(element.parent.parent)) { + element = element.parent.parent; + } else { + return element.parent.parent; + } + } + } + function inImportClause(node) { + var parent = node.parent; + return parent && (ts6.isImportClause(parent) || ts6.isImportSpecifier(parent) || ts6.isNamespaceImport(parent)); + } + function isExpressionInCallExpression(node) { + while (isRightSideOfQualifiedNameOrPropertyAccess(node)) { + node = node.parent; + } + return ts6.isCallExpression(node.parent) && node.parent.expression === node; + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return ts6.isQualifiedName(node.parent) && node.parent.right === node || ts6.isPropertyAccessExpression(node.parent) && node.parent.name === node; + } + var tokenFromDeclarationMapping = new ts6.Map([ + [ + 257, + 7 + /* TokenType.variable */ + ], + [ + 166, + 6 + /* TokenType.parameter */ + ], + [ + 169, + 9 + /* TokenType.property */ + ], + [ + 264, + 3 + /* TokenType.namespace */ + ], + [ + 263, + 1 + /* TokenType.enum */ + ], + [ + 302, + 8 + /* TokenType.enumMember */ + ], + [ + 260, + 0 + /* TokenType.class */ + ], + [ + 171, + 11 + /* TokenType.member */ + ], + [ + 259, + 10 + /* TokenType.function */ + ], + [ + 215, + 10 + /* TokenType.function */ + ], + [ + 170, + 11 + /* TokenType.member */ + ], + [ + 174, + 9 + /* TokenType.property */ + ], + [ + 175, + 9 + /* TokenType.property */ + ], + [ + 168, + 9 + /* TokenType.property */ + ], + [ + 261, + 2 + /* TokenType.interface */ + ], + [ + 262, + 5 + /* TokenType.type */ + ], + [ + 165, + 4 + /* TokenType.typeParameter */ + ], + [ + 299, + 9 + /* TokenType.property */ + ], + [ + 300, + 9 + /* TokenType.property */ + ] + ]); + })(v2020 = classifier2.v2020 || (classifier2.v2020 = {})); + })(classifier = ts6.classifier || (ts6.classifier = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var Completions; + (function(Completions2) { + var StringCompletions; + (function(StringCompletions2) { + var _a; + var kindPrecedence = (_a = {}, _a[ + "directory" + /* ScriptElementKind.directory */ + ] = 0, _a[ + "script" + /* ScriptElementKind.scriptElement */ + ] = 1, _a[ + "external module name" + /* ScriptElementKind.externalModuleName */ + ] = 2, _a); + function createNameAndKindSet() { + var map = new ts6.Map(); + function add(value) { + var existing = map.get(value.name); + if (!existing || kindPrecedence[existing.kind] < kindPrecedence[value.kind]) { + map.set(value.name, value); + } + } + return { + add, + has: map.has.bind(map), + values: map.values.bind(map) + }; + } + function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) { + if (ts6.isInReferenceComment(sourceFile, position)) { + var entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host); + return entries && convertPathCompletions(entries); + } + if (ts6.isInString(sourceFile, position, contextToken)) { + if (!contextToken || !ts6.isStringLiteralLike(contextToken)) + return void 0; + var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences); + return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences); + } + } + StringCompletions2.getStringLiteralCompletions = getStringLiteralCompletions; + function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences) { + if (completion === void 0) { + return void 0; + } + var optionalReplacementSpan = ts6.createTextSpanFromStringLiteralLikeContent(contextToken); + switch (completion.kind) { + case 0: + return convertPathCompletions(completion.paths); + case 1: { + var entries = ts6.createSortedArray(); + Completions2.getCompletionEntriesFromSymbols( + completion.symbols, + entries, + contextToken, + contextToken, + sourceFile, + sourceFile, + host, + program, + 99, + log, + 4, + preferences, + options, + /*formatContext*/ + void 0 + ); + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries }; + } + case 2: { + var entries = completion.types.map(function(type) { + return { + name: type.value, + kindModifiers: "", + kind: "string", + sortText: Completions2.SortText.LocationPriority, + replacementSpan: ts6.getReplacementSpanForContextToken(contextToken) + }; + }); + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries }; + } + default: + return ts6.Debug.assertNever(completion); + } + } + function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, checker, options, host, cancellationToken, preferences) { + if (!contextToken || !ts6.isStringLiteralLike(contextToken)) + return void 0; + var completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position, checker, options, host, preferences); + return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile, checker, cancellationToken); + } + StringCompletions2.getStringLiteralCompletionDetails = getStringLiteralCompletionDetails; + function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) { + switch (completion.kind) { + case 0: { + var match = ts6.find(completion.paths, function(p) { + return p.name === name; + }); + return match && Completions2.createCompletionDetails(name, kindModifiersFromExtension(match.extension), match.kind, [ts6.textPart(name)]); + } + case 1: { + var match = ts6.find(completion.symbols, function(s) { + return s.name === name; + }); + return match && Completions2.createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken); + } + case 2: + return ts6.find(completion.types, function(t) { + return t.value === name; + }) ? Completions2.createCompletionDetails(name, "", "type", [ts6.textPart(name)]) : void 0; + default: + return ts6.Debug.assertNever(completion); + } + } + function convertPathCompletions(pathCompletions) { + var isGlobalCompletion = false; + var isNewIdentifierLocation = true; + var entries = pathCompletions.map(function(_a2) { + var name = _a2.name, kind = _a2.kind, span = _a2.span, extension = _a2.extension; + return { name, kind, kindModifiers: kindModifiersFromExtension(extension), sortText: Completions2.SortText.LocationPriority, replacementSpan: span }; + }); + return { isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation, entries }; + } + function kindModifiersFromExtension(extension) { + switch (extension) { + case ".d.ts": + return ".d.ts"; + case ".js": + return ".js"; + case ".json": + return ".json"; + case ".jsx": + return ".jsx"; + case ".ts": + return ".ts"; + case ".tsx": + return ".tsx"; + case ".d.mts": + return ".d.mts"; + case ".mjs": + return ".mjs"; + case ".mts": + return ".mts"; + case ".d.cts": + return ".d.cts"; + case ".cjs": + return ".cjs"; + case ".cts": + return ".cts"; + case ".tsbuildinfo": + return ts6.Debug.fail("Extension ".concat(".tsbuildinfo", " is unsupported.")); + case void 0: + return ""; + default: + return ts6.Debug.assertNever(extension); + } + } + var StringLiteralCompletionKind; + (function(StringLiteralCompletionKind2) { + StringLiteralCompletionKind2[StringLiteralCompletionKind2["Paths"] = 0] = "Paths"; + StringLiteralCompletionKind2[StringLiteralCompletionKind2["Properties"] = 1] = "Properties"; + StringLiteralCompletionKind2[StringLiteralCompletionKind2["Types"] = 2] = "Types"; + })(StringLiteralCompletionKind || (StringLiteralCompletionKind = {})); + function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { + var parent = walkUpParentheses(node.parent); + switch (parent.kind) { + case 198: { + var grandParent_1 = walkUpParentheses(parent.parent); + switch (grandParent_1.kind) { + case 230: + case 180: { + var typeArgument = ts6.findAncestor(parent, function(n) { + return n.parent === grandParent_1; + }); + if (typeArgument) { + return { kind: 2, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; + } + return void 0; + } + case 196: + var _a2 = grandParent_1, indexType = _a2.indexType, objectType = _a2.objectType; + if (!ts6.rangeContainsPosition(indexType, position)) { + return void 0; + } + return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); + case 202: + return { kind: 0, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; + case 189: { + if (!ts6.isTypeReferenceNode(grandParent_1.parent)) { + return void 0; + } + var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(grandParent_1, parent); + var types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent_1)).filter(function(t) { + return !ts6.contains(alreadyUsedTypes_1, t.value); + }); + return { kind: 2, types, isNewIdentifier: false }; + } + default: + return void 0; + } + } + case 299: + if (ts6.isObjectLiteralExpression(parent.parent) && parent.name === node) { + return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); + } + return fromContextualType(); + case 209: { + var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; + if (node === ts6.skipParentheses(argumentExpression)) { + return stringLiteralCompletionsFromProperties(typeChecker.getTypeAtLocation(expression)); + } + return void 0; + } + case 210: + case 211: + case 288: + if (!isRequireCallArgument(node) && !ts6.isImportCall(parent)) { + var argumentInfo = ts6.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 ? parent.parent : node, position, sourceFile); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + } + case 269: + case 275: + case 280: + return { kind: 0, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; + default: + return fromContextualType(); + } + function fromContextualType() { + return { kind: 2, types: getStringLiteralTypes(ts6.getContextualTypeFromParent(node, typeChecker)), isNewIdentifier: false }; + } + } + function walkUpParentheses(node) { + switch (node.kind) { + case 193: + return ts6.walkUpParenthesizedTypes(node); + case 214: + return ts6.walkUpParenthesizedExpressions(node); + default: + return node; + } + } + function getAlreadyUsedTypesInStringLiteralUnion(union, current) { + return ts6.mapDefined(union.types, function(type) { + return type !== current && ts6.isLiteralTypeNode(type) && ts6.isStringLiteral(type.literal) ? type.literal.text : void 0; + }); + } + function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) { + var isNewIdentifier = false; + var uniques = new ts6.Map(); + var candidates = []; + var editingArgument = ts6.isJsxOpeningLikeElement(call) ? ts6.Debug.checkDefined(ts6.findAncestor(arg.parent, ts6.isJsxAttribute)) : arg; + checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates); + var types = ts6.flatMap(candidates, function(candidate) { + if (!ts6.signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length) + return; + var type = candidate.getTypeParameterAtPosition(argumentInfo.argumentIndex); + if (ts6.isJsxOpeningLikeElement(call)) { + var propType = checker.getTypeOfPropertyOfType(type, editingArgument.name.text); + if (propType) { + type = propType; + } + } + isNewIdentifier = isNewIdentifier || !!(type.flags & 4); + return getStringLiteralTypes(type, uniques); + }); + return ts6.length(types) ? { kind: 2, types, isNewIdentifier } : void 0; + } + function stringLiteralCompletionsFromProperties(type) { + return type && { + kind: 1, + symbols: ts6.filter(type.getApparentProperties(), function(prop) { + return !(prop.valueDeclaration && ts6.isPrivateIdentifierClassElementDeclaration(prop.valueDeclaration)); + }), + hasIndexSignature: ts6.hasIndexSignature(type) + }; + } + function stringLiteralCompletionsForObjectLiteral(checker, objectLiteralExpression) { + var contextualType = checker.getContextualType(objectLiteralExpression); + if (!contextualType) + return void 0; + var completionsType = checker.getContextualType( + objectLiteralExpression, + 4 + /* ContextFlags.Completions */ + ); + var symbols = Completions2.getPropertiesForObjectExpression(contextualType, completionsType, objectLiteralExpression, checker); + return { + kind: 1, + symbols, + hasIndexSignature: ts6.hasIndexSignature(contextualType) + }; + } + function getStringLiteralTypes(type, uniques) { + if (uniques === void 0) { + uniques = new ts6.Map(); + } + if (!type) + return ts6.emptyArray; + type = ts6.skipConstraint(type); + return type.isUnion() ? ts6.flatMap(type.types, function(t) { + return getStringLiteralTypes(t, uniques); + }) : type.isStringLiteral() && !(type.flags & 1024) && ts6.addToSeen(uniques, type.value) ? [type] : ts6.emptyArray; + } + function nameAndKind(name, kind, extension) { + return { name, kind, extension }; + } + function directoryResult(name) { + return nameAndKind( + name, + "directory", + /*extension*/ + void 0 + ); + } + function addReplacementSpans(text, textStart, names) { + var span = getDirectoryFragmentTextSpan(text, textStart); + var wholeSpan = text.length === 0 ? void 0 : ts6.createTextSpan(textStart, text.length); + return names.map(function(_a2) { + var name = _a2.name, kind = _a2.kind, extension = _a2.extension; + return Math.max(name.indexOf(ts6.directorySeparator), name.indexOf(ts6.altDirectorySeparator)) !== -1 ? { name, kind, extension, span: wholeSpan } : { name, kind, extension, span }; + }); + } + function getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) { + return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, compilerOptions, host, typeChecker, preferences)); + } + function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, compilerOptions, host, typeChecker, preferences) { + var literalValue = ts6.normalizeSlashes(node.text); + var mode = ts6.isStringLiteralLike(node) ? ts6.getModeForUsageLocation(sourceFile, node) : void 0; + var scriptPath = sourceFile.path; + var scriptDirectory = ts6.getDirectoryPath(scriptPath); + return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (ts6.isRootedDiskPath(literalValue) || ts6.isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, getIncludeExtensionOption()) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, getIncludeExtensionOption(), typeChecker); + function getIncludeExtensionOption() { + var mode2 = ts6.isStringLiteralLike(node) ? ts6.getModeForUsageLocation(sourceFile, node) : void 0; + return preferences.importModuleSpecifierEnding === "js" || mode2 === ts6.ModuleKind.ESNext ? 2 : 0; + } + } + function getExtensionOptions(compilerOptions, includeExtensionsOption) { + if (includeExtensionsOption === void 0) { + includeExtensionsOption = 0; + } + return { extensions: ts6.flatten(getSupportedExtensionsForModuleResolution(compilerOptions)), includeExtensionsOption }; + } + function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, includeExtensions) { + var extensionOptions = getExtensionOptions(compilerOptions, includeExtensions); + if (compilerOptions.rootDirs) { + return getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensionOptions, compilerOptions, host, scriptPath); + } else { + return ts6.arrayFrom(getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensionOptions, host, scriptPath).values()); + } + } + function isEmitResolutionKindUsingNodeModules(compilerOptions) { + return ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeJs || ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeNext; + } + function isEmitModuleResolutionRespectingExportMaps(compilerOptions) { + return ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.Node16 || ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeNext; + } + function getSupportedExtensionsForModuleResolution(compilerOptions) { + var extensions = ts6.getSupportedExtensions(compilerOptions); + return isEmitResolutionKindUsingNodeModules(compilerOptions) ? ts6.getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions; + } + function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase) { + rootDirs = rootDirs.map(function(rootDirectory) { + return ts6.normalizePath(ts6.isRootedDiskPath(rootDirectory) ? rootDirectory : ts6.combinePaths(basePath, rootDirectory)); + }); + var relativeDirectory = ts6.firstDefined(rootDirs, function(rootDirectory) { + return ts6.containsPath(rootDirectory, scriptDirectory, basePath, ignoreCase) ? scriptDirectory.substr(rootDirectory.length) : void 0; + }); + return ts6.deduplicate(__spreadArray(__spreadArray([], rootDirs.map(function(rootDirectory) { + return ts6.combinePaths(rootDirectory, relativeDirectory); + }), true), [scriptDirectory], false), ts6.equateStringsCaseSensitive, ts6.compareStringsCaseSensitive); + } + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, compilerOptions, host, exclude) { + var basePath = compilerOptions.project || host.getCurrentDirectory(); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase); + return ts6.flatMap(baseDirectories, function(baseDirectory) { + return ts6.arrayFrom(getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensionOptions, host, exclude).values()); + }); + } + var IncludeExtensionsOption; + (function(IncludeExtensionsOption2) { + IncludeExtensionsOption2[IncludeExtensionsOption2["Exclude"] = 0] = "Exclude"; + IncludeExtensionsOption2[IncludeExtensionsOption2["Include"] = 1] = "Include"; + IncludeExtensionsOption2[IncludeExtensionsOption2["ModuleSpecifierCompletion"] = 2] = "ModuleSpecifierCompletion"; + })(IncludeExtensionsOption || (IncludeExtensionsOption = {})); + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensionOptions, host, exclude, result) { + var _a2; + if (result === void 0) { + result = createNameAndKindSet(); + } + if (fragment === void 0) { + fragment = ""; + } + fragment = ts6.normalizeSlashes(fragment); + if (!ts6.hasTrailingDirectorySeparator(fragment)) { + fragment = ts6.getDirectoryPath(fragment); + } + if (fragment === "") { + fragment = "." + ts6.directorySeparator; + } + fragment = ts6.ensureTrailingDirectorySeparator(fragment); + var absolutePath = ts6.resolvePath(scriptPath, fragment); + var baseDirectory = ts6.hasTrailingDirectorySeparator(absolutePath) ? absolutePath : ts6.getDirectoryPath(absolutePath); + var packageJsonPath = ts6.findPackageJson(baseDirectory, host); + if (packageJsonPath) { + var packageJson = ts6.readJson(packageJsonPath, host); + var typesVersions = packageJson.typesVersions; + if (typeof typesVersions === "object") { + var versionPaths = (_a2 = ts6.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _a2 === void 0 ? void 0 : _a2.paths; + if (versionPaths) { + var packageDirectory = ts6.getDirectoryPath(packageJsonPath); + var pathInPackage = absolutePath.slice(ts6.ensureTrailingDirectorySeparator(packageDirectory).length); + if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) { + return result; + } + } + } + } + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + if (!ts6.tryDirectoryExists(host, baseDirectory)) + return result; + var files = ts6.tryReadDirectory( + host, + baseDirectory, + extensionOptions.extensions, + /*exclude*/ + void 0, + /*include*/ + ["./*"] + ); + if (files) { + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var filePath = files_1[_i]; + filePath = ts6.normalizePath(filePath); + if (exclude && ts6.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0) { + continue; + } + var _b = getFilenameWithExtensionOption(ts6.getBaseFileName(filePath), host.getCompilationSettings(), extensionOptions.includeExtensionsOption), name = _b.name, extension = _b.extension; + result.add(nameAndKind(name, "script", extension)); + } + } + var directories = ts6.tryGetDirectories(host, baseDirectory); + if (directories) { + for (var _c = 0, directories_1 = directories; _c < directories_1.length; _c++) { + var directory = directories_1[_c]; + var directoryName = ts6.getBaseFileName(ts6.normalizePath(directory)); + if (directoryName !== "@types") { + result.add(directoryResult(directoryName)); + } + } + } + return result; + } + function getFilenameWithExtensionOption(name, compilerOptions, includeExtensionsOption) { + var outputExtension = ts6.moduleSpecifiers.tryGetJSExtensionForFile(name, compilerOptions); + if (includeExtensionsOption === 0 && !ts6.fileExtensionIsOneOf(name, [ + ".json", + ".mts", + ".cts", + ".d.mts", + ".d.cts", + ".mjs", + ".cjs" + /* Extension.Cjs */ + ])) { + return { name: ts6.removeFileExtension(name), extension: ts6.tryGetExtensionFromPath(name) }; + } else if ((ts6.fileExtensionIsOneOf(name, [ + ".mts", + ".cts", + ".d.mts", + ".d.cts", + ".mjs", + ".cjs" + /* Extension.Cjs */ + ]) || includeExtensionsOption === 2) && outputExtension) { + return { name: ts6.changeExtension(name, outputExtension), extension: outputExtension }; + } else { + return { name, extension: ts6.tryGetExtensionFromPath(name) }; + } + } + function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) { + var getPatternsForKey = function(key) { + return paths[key]; + }; + var comparePaths = function(a, b) { + var patternA = ts6.tryParsePattern(a); + var patternB = ts6.tryParsePattern(b); + var lengthA = typeof patternA === "object" ? patternA.prefix.length : a.length; + var lengthB = typeof patternB === "object" ? patternB.prefix.length : b.length; + return ts6.compareValues(lengthB, lengthA); + }; + return addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory, extensionOptions, host, ts6.getOwnKeys(paths), getPatternsForKey, comparePaths); + } + function addCompletionEntriesFromPathsOrExports(result, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths) { + var pathResults = []; + var matchedPath; + for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { + var key = keys_1[_i]; + if (key === ".") + continue; + var keyWithoutLeadingDotSlash = key.replace(/^\.\//, ""); + var patterns = getPatternsForKey(key); + if (patterns) { + var pathPattern = ts6.tryParsePattern(keyWithoutLeadingDotSlash); + if (!pathPattern) + continue; + var isMatch = typeof pathPattern === "object" && ts6.isPatternMatch(pathPattern, fragment); + var isLongestMatch = isMatch && (matchedPath === void 0 || comparePaths(key, matchedPath) === -1); + if (isLongestMatch) { + matchedPath = key; + pathResults = pathResults.filter(function(r) { + return !r.matchedPattern; + }); + } + if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths(key, matchedPath) !== 1) { + pathResults.push({ + matchedPattern: isMatch, + results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, host).map(function(_a2) { + var name = _a2.name, kind = _a2.kind, extension = _a2.extension; + return nameAndKind(name, kind, extension); + }) + }); + } + } + } + pathResults.forEach(function(pathResult) { + return pathResult.results.forEach(function(r) { + return result.add(r); + }); + }); + return matchedPath !== void 0; + } + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, compilerOptions, host, includeExtensionsOption, typeChecker) { + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; + var result = createNameAndKindSet(); + var extensionOptions = getExtensionOptions(compilerOptions, includeExtensionsOption); + if (baseUrl) { + var projectDir = compilerOptions.project || host.getCurrentDirectory(); + var absolute = ts6.normalizePath(ts6.combinePaths(projectDir, baseUrl)); + getCompletionEntriesForDirectoryFragment( + fragment, + absolute, + extensionOptions, + host, + /*exclude*/ + void 0, + result + ); + if (paths) { + addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths); + } + } + var fragmentDirectory = getFragmentDirectory(fragment); + for (var _i = 0, _a2 = getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker); _i < _a2.length; _i++) { + var ambientName = _a2[_i]; + result.add(nameAndKind( + ambientName, + "external module name", + /*extension*/ + void 0 + )); + } + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result); + if (isEmitResolutionKindUsingNodeModules(compilerOptions)) { + var foundGlobal = false; + if (fragmentDirectory === void 0) { + for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) { + var moduleName = _c[_b]; + var moduleResult = nameAndKind( + moduleName, + "external module name", + /*extension*/ + void 0 + ); + if (!result.has(moduleResult.name)) { + foundGlobal = true; + result.add(moduleResult); + } + } + } + if (!foundGlobal) { + var ancestorLookup = function(ancestor) { + var nodeModules = ts6.combinePaths(ancestor, "node_modules"); + if (ts6.tryDirectoryExists(host, nodeModules)) { + getCompletionEntriesForDirectoryFragment( + fragment, + nodeModules, + extensionOptions, + host, + /*exclude*/ + void 0, + result + ); + } + }; + if (fragmentDirectory && isEmitModuleResolutionRespectingExportMaps(compilerOptions)) { + var nodeModulesDirectoryLookup_1 = ancestorLookup; + ancestorLookup = function(ancestor) { + var components = ts6.getPathComponents(fragment); + components.shift(); + var packagePath = components.shift(); + if (!packagePath) { + return nodeModulesDirectoryLookup_1(ancestor); + } + if (ts6.startsWith(packagePath, "@")) { + var subName = components.shift(); + if (!subName) { + return nodeModulesDirectoryLookup_1(ancestor); + } + packagePath = ts6.combinePaths(packagePath, subName); + } + var packageDirectory = ts6.combinePaths(ancestor, "node_modules", packagePath); + var packageFile = ts6.combinePaths(packageDirectory, "package.json"); + if (ts6.tryFileExists(host, packageFile)) { + var packageJson = ts6.readJson(packageFile, host); + var exports_1 = packageJson.exports; + if (exports_1) { + if (typeof exports_1 !== "object" || exports_1 === null) { + return; + } + var keys = ts6.getOwnKeys(exports_1); + var fragmentSubpath = components.join("/") + (components.length && ts6.hasTrailingDirectorySeparator(fragment) ? "/" : ""); + var conditions_1 = mode === ts6.ModuleKind.ESNext ? ["node", "import", "types"] : ["node", "require", "types"]; + addCompletionEntriesFromPathsOrExports(result, fragmentSubpath, packageDirectory, extensionOptions, host, keys, function(key) { + return ts6.singleElementArray(getPatternFromFirstMatchingCondition(exports_1[key], conditions_1)); + }, ts6.comparePatternKeys); + return; + } + } + return nodeModulesDirectoryLookup_1(ancestor); + }; + } + ts6.forEachAncestorDirectory(scriptPath, ancestorLookup); + } + } + return ts6.arrayFrom(result.values()); + } + function getPatternFromFirstMatchingCondition(target, conditions) { + if (typeof target === "string") { + return target; + } + if (target && typeof target === "object" && !ts6.isArray(target)) { + for (var condition in target) { + if (condition === "default" || conditions.indexOf(condition) > -1 || ts6.isApplicableVersionedTypesKey(conditions, condition)) { + var pattern = target[condition]; + return getPatternFromFirstMatchingCondition(pattern, conditions); + } + } + } + } + function getFragmentDirectory(fragment) { + return containsSlash(fragment) ? ts6.hasTrailingDirectorySeparator(fragment) ? fragment : ts6.getDirectoryPath(fragment) : void 0; + } + function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, host) { + if (!ts6.endsWith(path, "*")) { + return !ts6.stringContains(path, "*") ? justPathMappingName( + path, + "script" + /* ScriptElementKind.scriptElement */ + ) : ts6.emptyArray; + } + var pathPrefix = path.slice(0, path.length - 1); + var remainingFragment = ts6.tryRemovePrefix(fragment, pathPrefix); + if (remainingFragment === void 0) { + var starIsFullPathComponent = path[path.length - 2] === "/"; + return starIsFullPathComponent ? justPathMappingName( + pathPrefix, + "directory" + /* ScriptElementKind.directory */ + ) : ts6.flatMap(patterns, function(pattern) { + var _a2; + return (_a2 = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) === null || _a2 === void 0 ? void 0 : _a2.map(function(_a3) { + var name = _a3.name, rest = __rest(_a3, ["name"]); + return __assign({ name: pathPrefix + name }, rest); + }); + }); + } + return ts6.flatMap(patterns, function(pattern) { + return getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, host); + }); + function justPathMappingName(name, kind) { + return ts6.startsWith(name, fragment) ? [{ name: ts6.removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : ts6.emptyArray; + } + } + function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, host) { + if (!host.readDirectory) { + return void 0; + } + var parsed = ts6.tryParsePattern(pattern); + if (parsed === void 0 || ts6.isString(parsed)) { + return void 0; + } + var normalizedPrefix = ts6.resolvePath(parsed.prefix); + var normalizedPrefixDirectory = ts6.hasTrailingDirectorySeparator(parsed.prefix) ? normalizedPrefix : ts6.getDirectoryPath(normalizedPrefix); + var normalizedPrefixBase = ts6.hasTrailingDirectorySeparator(parsed.prefix) ? "" : ts6.getBaseFileName(normalizedPrefix); + var fragmentHasPath = containsSlash(fragment); + var fragmentDirectory = fragmentHasPath ? ts6.hasTrailingDirectorySeparator(fragment) ? fragment : ts6.getDirectoryPath(fragment) : void 0; + var expandedPrefixDirectory = fragmentHasPath ? ts6.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + fragmentDirectory) : normalizedPrefixDirectory; + var normalizedSuffix = ts6.normalizePath(parsed.suffix); + var baseDirectory = ts6.normalizePath(ts6.combinePaths(packageDirectory, expandedPrefixDirectory)); + var completePrefix = fragmentHasPath ? baseDirectory : ts6.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + var includeGlob = normalizedSuffix ? "**/*" + normalizedSuffix : "./*"; + var matches = ts6.mapDefined(ts6.tryReadDirectory( + host, + baseDirectory, + extensionOptions.extensions, + /*exclude*/ + void 0, + [includeGlob] + ), function(match) { + var trimmedWithPattern = trimPrefixAndSuffix(match); + if (trimmedWithPattern) { + if (containsSlash(trimmedWithPattern)) { + return directoryResult(ts6.getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]); + } + var _a2 = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions.includeExtensionsOption), name = _a2.name, extension = _a2.extension; + return nameAndKind(name, "script", extension); + } + }); + var directories = normalizedSuffix ? ts6.emptyArray : ts6.mapDefined(ts6.tryGetDirectories(host, baseDirectory), function(dir) { + return dir === "node_modules" ? void 0 : directoryResult(dir); + }); + return __spreadArray(__spreadArray([], matches, true), directories, true); + function trimPrefixAndSuffix(path) { + var inner = withoutStartAndEnd(ts6.normalizePath(path), completePrefix, normalizedSuffix); + return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner); + } + } + function withoutStartAndEnd(s, start, end) { + return ts6.startsWith(s, start) && ts6.endsWith(s, end) ? s.slice(start.length, s.length - end.length) : void 0; + } + function removeLeadingDirectorySeparator(path) { + return path[0] === ts6.directorySeparator ? path.slice(1) : path; + } + function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) { + var ambientModules = checker.getAmbientModules().map(function(sym) { + return ts6.stripQuotes(sym.name); + }); + var nonRelativeModuleNames = ambientModules.filter(function(moduleName) { + return ts6.startsWith(moduleName, fragment); + }); + if (fragmentDirectory !== void 0) { + var moduleNameWithSeparator_1 = ts6.ensureTrailingDirectorySeparator(fragmentDirectory); + return nonRelativeModuleNames.map(function(nonRelativeModuleName) { + return ts6.removePrefix(nonRelativeModuleName, moduleNameWithSeparator_1); + }); + } + return nonRelativeModuleNames; + } + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { + var token = ts6.getTokenAtPosition(sourceFile, position); + var commentRanges = ts6.getLeadingCommentRanges(sourceFile.text, token.pos); + var range2 = commentRanges && ts6.find(commentRanges, function(commentRange) { + return position >= commentRange.pos && position <= commentRange.end; + }); + if (!range2) { + return void 0; + } + var text = sourceFile.text.slice(range2.pos, position); + var match = tripleSlashDirectiveFragmentRegex.exec(text); + if (!match) { + return void 0; + } + var prefix2 = match[1], kind = match[2], toComplete = match[3]; + var scriptPath = ts6.getDirectoryPath(sourceFile.path); + var names = kind === "path" ? getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, getExtensionOptions( + compilerOptions, + 1 + /* IncludeExtensionsOption.Include */ + ), host, sourceFile.path) : kind === "types" ? getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions)) : ts6.Debug.fail(); + return addReplacementSpans(toComplete, range2.pos + prefix2.length, ts6.arrayFrom(names.values())); + } + function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result) { + if (result === void 0) { + result = createNameAndKindSet(); + } + var seen = new ts6.Map(); + var typeRoots = ts6.tryAndIgnoreErrors(function() { + return ts6.getEffectiveTypeRoots(options, host); + }) || ts6.emptyArray; + for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { + var root = typeRoots_1[_i]; + getCompletionEntriesFromDirectories(root); + } + for (var _a2 = 0, _b = ts6.findPackageJsons(scriptPath, host); _a2 < _b.length; _a2++) { + var packageJson = _b[_a2]; + var typesDir = ts6.combinePaths(ts6.getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(typesDir); + } + return result; + function getCompletionEntriesFromDirectories(directory) { + if (!ts6.tryDirectoryExists(host, directory)) + return; + for (var _i2 = 0, _a3 = ts6.tryGetDirectories(host, directory); _i2 < _a3.length; _i2++) { + var typeDirectoryName = _a3[_i2]; + var packageName = ts6.unmangleScopedPackageName(typeDirectoryName); + if (options.types && !ts6.contains(options.types, packageName)) + continue; + if (fragmentDirectory === void 0) { + if (!seen.has(packageName)) { + result.add(nameAndKind( + packageName, + "external module name", + /*extension*/ + void 0 + )); + seen.set(packageName, true); + } + } else { + var baseDirectory = ts6.combinePaths(directory, typeDirectoryName); + var remainingFragment = ts6.tryRemoveDirectoryPrefix(fragmentDirectory, packageName, ts6.hostGetCanonicalFileName(host)); + if (remainingFragment !== void 0) { + getCompletionEntriesForDirectoryFragment( + remainingFragment, + baseDirectory, + extensionOptions, + host, + /*exclude*/ + void 0, + result + ); + } + } + } + } + } + function enumerateNodeModulesVisibleToScript(host, scriptPath) { + if (!host.readFile || !host.fileExists) + return ts6.emptyArray; + var result = []; + for (var _i = 0, _a2 = ts6.findPackageJsons(scriptPath, host); _i < _a2.length; _i++) { + var packageJson = _a2[_i]; + var contents = ts6.readJson(packageJson, host); + for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { + var key = nodeModulesDependencyKeys_1[_b]; + var dependencies = contents[key]; + if (!dependencies) + continue; + for (var dep in dependencies) { + if (ts6.hasProperty(dependencies, dep) && !ts6.startsWith(dep, "@types/")) { + result.push(dep); + } + } + } + } + return result; + } + function getDirectoryFragmentTextSpan(text, textStart) { + var index = Math.max(text.lastIndexOf(ts6.directorySeparator), text.lastIndexOf(ts6.altDirectorySeparator)); + var offset = index !== -1 ? index + 1 : 0; + var length = text.length - offset; + return length === 0 || ts6.isIdentifierText( + text.substr(offset, length), + 99 + /* ScriptTarget.ESNext */ + ) ? void 0 : ts6.createTextSpan(textStart + offset, length); + } + function isPathRelativeToScript(path) { + if (path && path.length >= 2 && path.charCodeAt(0) === 46) { + var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 ? 2 : 1; + var slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === 47 || slashCharCode === 92; + } + return false; + } + var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s* 0; + }, + resolvedBeyondLimit: function() { + return resolvedCount > Completions2.moduleSpecifierResolutionLimit; + } + }); + var hitRateMessage = cacheAttemptCount ? " (".concat((resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1), "% hit rate)") : ""; + (_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, "".concat(logPrefix, ": resolved ").concat(resolvedCount, " module specifiers, plus ").concat(ambientCount, " ambient and ").concat(resolvedFromCacheCount, " from cache").concat(hitRateMessage)); + (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, "".concat(logPrefix, ": response is ").concat(skippedAny ? "incomplete" : "complete")); + (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, "".concat(logPrefix, ": ").concat(ts6.timestamp() - start)); + return result; + function tryResolve(exportInfo, symbolName, isFromAmbientModule) { + if (isFromAmbientModule) { + var result_1 = resolver.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite); + if (result_1) { + ambientCount++; + } + return result_1 || "failed"; + } + var shouldResolveModuleSpecifier = needsFullResolution || preferences.allowIncompleteCompletions && resolvedCount < Completions2.moduleSpecifierResolutionLimit; + var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions2.moduleSpecifierResolutionCacheAttemptLimit; + var result2 = shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache ? resolver.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, shouldGetModuleSpecifierFromCache) : void 0; + if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result2) { + skippedAny = true; + } + resolvedCount += (result2 === null || result2 === void 0 ? void 0 : result2.computedWithoutCacheCount) || 0; + resolvedFromCacheCount += exportInfo.length - ((result2 === null || result2 === void 0 ? void 0 : result2.computedWithoutCacheCount) || 0); + if (shouldGetModuleSpecifierFromCache) { + cacheAttemptCount++; + } + return result2 || (needsFullResolution ? "failed" : "skipped"); + } + } + function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) { + var _a; + var previousToken = getRelevantTokens(position, sourceFile).previousToken; + if (triggerCharacter && !ts6.isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) { + return void 0; + } + if (triggerCharacter === " ") { + if (preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + return { isGlobalCompletion: true, isMemberCompletion: false, isNewIdentifierLocation: true, isIncomplete: true, entries: [] }; + } + return void 0; + } + var compilerOptions = program.getCompilerOptions(); + var incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a = host.getIncompleteCompletionsCache) === null || _a === void 0 ? void 0 : _a.call(host) : void 0; + if (incompleteCompletionsCache && completionKind === 3 && previousToken && ts6.isIdentifier(previousToken)) { + var incompleteContinuation = continuePreviousIncompleteResponse(incompleteCompletionsCache, sourceFile, previousToken, program, host, preferences, cancellationToken); + if (incompleteContinuation) { + return incompleteContinuation; + } + } else { + incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.clear(); + } + var stringCompletions = Completions2.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences); + if (stringCompletions) { + return stringCompletions; + } + if (previousToken && ts6.isBreakOrContinueStatement(previousToken.parent) && (previousToken.kind === 81 || previousToken.kind === 86 || previousToken.kind === 79)) { + return getLabelCompletionAtPosition(previousToken.parent); + } + var completionData = getCompletionData( + program, + log, + sourceFile, + compilerOptions, + position, + preferences, + /*detailsEntryId*/ + void 0, + host, + formatContext, + cancellationToken + ); + if (!completionData) { + return void 0; + } + switch (completionData.kind) { + case 0: + var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position); + if (response === null || response === void 0 ? void 0 : response.isIncomplete) { + incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response); + } + return response; + case 1: + return jsdocCompletionInfo(ts6.JsDoc.getJSDocTagNameCompletions()); + case 2: + return jsdocCompletionInfo(ts6.JsDoc.getJSDocTagCompletions()); + case 3: + return jsdocCompletionInfo(ts6.JsDoc.getJSDocParameterNameCompletions(completionData.tag)); + case 4: + return specificKeywordCompletionInfo(completionData.keywordCompletions, completionData.isNewIdentifierLocation); + default: + return ts6.Debug.assertNever(completionData); + } + } + Completions2.getCompletionsAtPosition = getCompletionsAtPosition; + function compareCompletionEntries(entryInArray, entryToInsert) { + var _a, _b; + var result = ts6.compareStringsCaseSensitiveUI(entryInArray.sortText, entryToInsert.sortText); + if (result === 0) { + result = ts6.compareStringsCaseSensitiveUI(entryInArray.name, entryToInsert.name); + } + if (result === 0 && ((_a = entryInArray.data) === null || _a === void 0 ? void 0 : _a.moduleSpecifier) && ((_b = entryToInsert.data) === null || _b === void 0 ? void 0 : _b.moduleSpecifier)) { + result = ts6.compareNumberOfDirectorySeparators(entryInArray.data.moduleSpecifier, entryToInsert.data.moduleSpecifier); + } + if (result === 0) { + return -1; + } + return result; + } + function completionEntryDataIsResolved(data) { + return !!(data === null || data === void 0 ? void 0 : data.moduleSpecifier); + } + function continuePreviousIncompleteResponse(cache, file, location, program, host, preferences, cancellationToken) { + var previousResponse = cache.get(); + if (!previousResponse) + return void 0; + var lowerCaseTokenText = location.text.toLowerCase(); + var exportMap = ts6.getExportInfoMap(file, host, program, preferences, cancellationToken); + var newEntries = resolvingModuleSpecifiers( + "continuePreviousIncompleteResponse", + host, + ts6.codefix.createImportSpecifierResolver(file, program, host, preferences), + program, + location.getStart(), + preferences, + /*isForImportStatementCompletion*/ + false, + ts6.isValidTypeOnlyAliasUseSite(location), + function(context) { + var entries = ts6.mapDefined(previousResponse.entries, function(entry) { + var _a; + if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) { + return entry; + } + if (!charactersFuzzyMatchInString(entry.name, lowerCaseTokenText)) { + return void 0; + } + var origin = ts6.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin; + var info = exportMap.get(file.path, entry.data.exportMapKey); + var result = info && context.tryResolve(info, entry.name, !ts6.isExternalModuleNameRelative(ts6.stripQuotes(origin.moduleSymbol.name))); + if (result === "skipped") + return entry; + if (!result || result === "failed") { + (_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, "Unexpected failure resolving auto import for '".concat(entry.name, "' from '").concat(entry.source, "'")); + return void 0; + } + var newOrigin = __assign(__assign({}, origin), { kind: 32, moduleSpecifier: result.moduleSpecifier }); + entry.data = originToCompletionEntryData(newOrigin); + entry.source = getSourceFromOrigin(newOrigin); + entry.sourceDisplay = [ts6.textPart(newOrigin.moduleSpecifier)]; + return entry; + }); + if (!context.skippedAny()) { + previousResponse.isIncomplete = void 0; + } + return entries; + } + ); + previousResponse.entries = newEntries; + previousResponse.flags = (previousResponse.flags || 0) | 4; + return previousResponse; + } + function jsdocCompletionInfo(entries) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; + } + function keywordToCompletionEntry(keyword) { + return { + name: ts6.tokenToString(keyword), + kind: "keyword", + kindModifiers: "", + sortText: Completions2.SortText.GlobalsOrKeywords + }; + } + function specificKeywordCompletionInfo(entries, isNewIdentifierLocation) { + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation, + entries: entries.slice() + }; + } + function keywordCompletionData(keywordFilters, filterOutTsOnlyKeywords, isNewIdentifierLocation) { + return { + kind: 4, + keywordCompletions: getKeywordCompletions(keywordFilters, filterOutTsOnlyKeywords), + isNewIdentifierLocation + }; + } + function keywordFiltersFromSyntaxKind(keywordCompletion) { + switch (keywordCompletion) { + case 154: + return 8; + default: + ts6.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); + } + } + function getOptionalReplacementSpan(location) { + return (location === null || location === void 0 ? void 0 : location.kind) === 79 ? ts6.createTextSpanFromNode(location) : void 0; + } + function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + if (ts6.getLanguageVariant(sourceFile.scriptKind) === 1) { + var completionInfo = getJsxClosingTagCompletion(location, sourceFile); + if (completionInfo) { + return completionInfo; + } + } + var entries = ts6.createSortedArray(); + var isChecked = isCheckedFile(sourceFile, compilerOptions); + if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0) { + return void 0; + } + var uniqueNames = getCompletionEntriesFromSymbols( + symbols, + entries, + /*replacementToken*/ + void 0, + contextToken, + location, + sourceFile, + host, + program, + ts6.getEmitScriptTarget(compilerOptions), + log, + completionKind, + preferences, + compilerOptions, + formatContext, + isTypeOnlyLocation, + propertyAccessToConvert, + isJsxIdentifierExpected, + isJsxInitializer, + importStatementCompletion, + recommendedCompletion, + symbolToOriginInfoMap, + symbolToSortTextMap, + isJsxIdentifierExpected, + isRightOfOpenTag + ); + if (keywordFilters !== 0) { + for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts6.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { + var keywordEntry = _a[_i]; + if (isTypeOnlyLocation && ts6.isTypeKeyword(ts6.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) { + uniqueNames.add(keywordEntry.name); + ts6.insertSorted( + entries, + keywordEntry, + compareCompletionEntries, + /*allowDuplicates*/ + true + ); + } + } + } + for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) { + var keywordEntry = _c[_b]; + if (!uniqueNames.has(keywordEntry.name)) { + uniqueNames.add(keywordEntry.name); + ts6.insertSorted( + entries, + keywordEntry, + compareCompletionEntries, + /*allowDuplicates*/ + true + ); + } + } + for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) { + var literal2 = literals_1[_d]; + var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal2); + uniqueNames.add(literalEntry.name); + ts6.insertSorted( + entries, + literalEntry, + compareCompletionEntries, + /*allowDuplicates*/ + true + ); + } + if (!isChecked) { + getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts6.getEmitScriptTarget(compilerOptions), entries); + } + return { + flags: completionData.flags, + isGlobalCompletion: isInSnippetScope, + isIncomplete: preferences.allowIncompleteCompletions && hasUnresolvedAutoImports ? true : void 0, + isMemberCompletion: isMemberCompletionKind(completionKind), + isNewIdentifierLocation, + optionalReplacementSpan: getOptionalReplacementSpan(location), + entries + }; + } + function isCheckedFile(sourceFile, compilerOptions) { + return !ts6.isSourceFileJS(sourceFile) || !!ts6.isCheckJsEnabledForFile(sourceFile, compilerOptions); + } + function isMemberCompletionKind(kind) { + switch (kind) { + case 0: + case 3: + case 2: + return true; + default: + return false; + } + } + function getJsxClosingTagCompletion(location, sourceFile) { + var jsxClosingElement = ts6.findAncestor(location, function(node) { + switch (node.kind) { + case 284: + return true; + case 43: + case 31: + case 79: + case 208: + return false; + default: + return "quit"; + } + }); + if (jsxClosingElement) { + var hasClosingAngleBracket = !!ts6.findChildOfKind(jsxClosingElement, 31, sourceFile); + var tagName = jsxClosingElement.parent.openingElement.tagName; + var closingTag = tagName.getText(sourceFile); + var fullClosingTag = closingTag + (hasClosingAngleBracket ? "" : ">"); + var replacementSpan = ts6.createTextSpanFromNode(jsxClosingElement.tagName); + var entry = { + name: fullClosingTag, + kind: "class", + kindModifiers: void 0, + sortText: Completions2.SortText.LocationPriority + }; + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, optionalReplacementSpan: replacementSpan, entries: [entry] }; + } + return; + } + function getJSCompletionEntries(sourceFile, position, uniqueNames, target, entries) { + ts6.getNameTable(sourceFile).forEach(function(pos, name) { + if (pos === position) { + return; + } + var realName = ts6.unescapeLeadingUnderscores(name); + if (!uniqueNames.has(realName) && ts6.isIdentifierText(realName, target)) { + uniqueNames.add(realName); + ts6.insertSorted(entries, { + name: realName, + kind: "warning", + kindModifiers: "", + sortText: Completions2.SortText.JavascriptIdentifiers, + isFromUncheckedFile: true + }, compareCompletionEntries); + } + }); + } + function completionNameForLiteral(sourceFile, preferences, literal2) { + return typeof literal2 === "object" ? ts6.pseudoBigIntToString(literal2) + "n" : ts6.isString(literal2) ? ts6.quote(sourceFile, preferences, literal2) : JSON.stringify(literal2); + } + function createCompletionEntryForLiteral(sourceFile, preferences, literal2) { + return { name: completionNameForLiteral(sourceFile, preferences, literal2), kind: "string", kindModifiers: "", sortText: Completions2.SortText.LocationPriority }; + } + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + var _a, _b; + var insertText; + var replacementSpan = ts6.getReplacementSpanForContextToken(replacementToken); + var data; + var isSnippet; + var source = getSourceFromOrigin(origin); + var sourceDisplay; + var hasAction; + var labelDetails; + var typeChecker = program.getTypeChecker(); + var insertQuestionDot = origin && originIsNullableMember(origin); + var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess; + if (origin && originIsThisType(origin)) { + insertText = needsConvertPropertyAccess ? "this".concat(insertQuestionDot ? "?." : "", "[").concat(quotePropertyName(sourceFile, preferences, name), "]") : "this".concat(insertQuestionDot ? "?." : ".").concat(name); + } else if ((useBraces || insertQuestionDot) && propertyAccessToConvert) { + insertText = useBraces ? needsConvertPropertyAccess ? "[".concat(quotePropertyName(sourceFile, preferences, name), "]") : "[".concat(name, "]") : name; + if (insertQuestionDot || propertyAccessToConvert.questionDotToken) { + insertText = "?.".concat(insertText); + } + var dot = ts6.findChildOfKind(propertyAccessToConvert, 24, sourceFile) || ts6.findChildOfKind(propertyAccessToConvert, 28, sourceFile); + if (!dot) { + return void 0; + } + var end = ts6.startsWith(name, propertyAccessToConvert.name.text) ? propertyAccessToConvert.name.end : dot.end; + replacementSpan = ts6.createTextSpanFromBounds(dot.getStart(sourceFile), end); + } + if (isJsxInitializer) { + if (insertText === void 0) + insertText = name; + insertText = "{".concat(insertText, "}"); + if (typeof isJsxInitializer !== "boolean") { + replacementSpan = ts6.createTextSpanFromNode(isJsxInitializer, sourceFile); + } + } + if (origin && originIsPromise(origin) && propertyAccessToConvert) { + if (insertText === void 0) + insertText = name; + var precedingToken = ts6.findPrecedingToken(propertyAccessToConvert.pos, sourceFile); + var awaitText = ""; + if (precedingToken && ts6.positionIsASICandidate(precedingToken.end, precedingToken.parent, sourceFile)) { + awaitText = ";"; + } + awaitText += "(await ".concat(propertyAccessToConvert.expression.getText(), ")"); + insertText = needsConvertPropertyAccess ? "".concat(awaitText).concat(insertText) : "".concat(awaitText).concat(insertQuestionDot ? "?." : ".").concat(insertText); + replacementSpan = ts6.createTextSpanFromBounds(propertyAccessToConvert.getStart(sourceFile), propertyAccessToConvert.end); + } + if (originIsResolvedExport(origin)) { + sourceDisplay = [ts6.textPart(origin.moduleSpecifier)]; + if (importStatementCompletion) { + _a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan; + isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0; + } + } + if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64) { + hasAction = true; + } + if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 && isClassLikeMemberCompletion(symbol, location, sourceFile)) { + var importAdder = void 0; + _b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan; + sortText = Completions2.SortText.ClassMemberSnippets; + if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) { + hasAction = true; + source = CompletionSource.ClassMemberSnippet; + } + } + if (origin && originIsObjectLiteralMethod(origin)) { + insertText = origin.insertText, isSnippet = origin.isSnippet, labelDetails = origin.labelDetails; + if (!preferences.useLabelDetailsInCompletionEntries) { + name = name + labelDetails.detail; + labelDetails = void 0; + } + source = CompletionSource.ObjectLiteralMethodSnippet; + sortText = Completions2.SortText.SortBelow(sortText); + } + if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") { + var useBraces_1 = preferences.jsxAttributeCompletionStyle === "braces"; + var type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528) && !(type.flags & 1048576 && ts6.find(type.types, function(type2) { + return !!(type2.flags & 528); + }))) { + if (type.flags & 402653316 || type.flags & 1048576 && ts6.every(type.types, function(type2) { + return !!(type2.flags & (402653316 | 32768)); + })) { + insertText = "".concat(ts6.escapeSnippetText(name), "=").concat(ts6.quote(sourceFile, preferences, "$1")); + isSnippet = true; + } else { + useBraces_1 = true; + } + } + if (useBraces_1) { + insertText = "".concat(ts6.escapeSnippetText(name), "={$1}"); + isSnippet = true; + } + } + if (insertText !== void 0 && !preferences.includeCompletionsWithInsertText) { + return void 0; + } + if (originIsExport(origin) || originIsResolvedExport(origin)) { + data = originToCompletionEntryData(origin); + hasAction = !importStatementCompletion; + } + return { + name, + kind: ts6.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts6.SymbolDisplay.getSymbolModifiers(typeChecker, symbol), + sortText, + source, + hasAction: hasAction ? true : void 0, + isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0, + insertText, + replacementSpan, + sourceDisplay, + labelDetails, + isSnippet, + isPackageJsonImport: originIsPackageJsonImport(origin) || void 0, + isImportStatementCompletion: !!importStatementCompletion || void 0, + data + }; + } + function isClassLikeMemberCompletion(symbol, location, sourceFile) { + if (ts6.isInJSFile(location)) { + return false; + } + var memberFlags = 106500 & 900095; + return !!(symbol.flags & memberFlags) && (ts6.isClassLike(location) || location.parent && location.parent.parent && ts6.isClassElement(location.parent) && location === location.parent.name && location.parent.getLastToken(sourceFile) === location.parent.name && ts6.isClassLike(location.parent.parent) || location.parent && ts6.isSyntaxList(location) && ts6.isClassLike(location.parent)); + } + function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext) { + var classLikeDeclaration = ts6.findAncestor(location, ts6.isClassLike); + if (!classLikeDeclaration) { + return { insertText: name }; + } + var isSnippet; + var replacementSpan; + var insertText = name; + var checker = program.getTypeChecker(); + var sourceFile = location.getSourceFile(); + var printer = createSnippetPrinter({ + removeComments: true, + module: options.module, + target: options.target, + omitTrailingSemicolon: false, + newLine: ts6.getNewLineKind(ts6.getNewLineCharacter(options, ts6.maybeBind(host, host.getNewLine))) + }); + var importAdder = ts6.codefix.createImportAdder(sourceFile, program, preferences, host); + var body; + if (preferences.includeCompletionsWithSnippetText) { + isSnippet = true; + var emptyStmt = ts6.factory.createEmptyStatement(); + body = ts6.factory.createBlock( + [emptyStmt], + /* multiline */ + true + ); + ts6.setSnippetElement(emptyStmt, { kind: 0, order: 0 }); + } else { + body = ts6.factory.createBlock( + [], + /* multiline */ + true + ); + } + var modifiers = 0; + var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; + var isAbstract = !!(presentModifiers & 256); + var completionNodes = []; + ts6.codefix.addNewNodeForMemberSymbol( + symbol, + classLikeDeclaration, + sourceFile, + { program, host }, + preferences, + importAdder, + // `addNewNodeForMemberSymbol` calls this callback function for each new member node + // it adds for the given member symbol. + // We store these member nodes in the `completionNodes` array. + // Note: there might be: + // - No nodes if `addNewNodeForMemberSymbol` cannot figure out a node for the member; + // - One node; + // - More than one node if the member is overloaded (e.g. a method with overload signatures). + function(node) { + var requiredModifiers = 0; + if (isAbstract) { + requiredModifiers |= 256; + } + if (ts6.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1) { + requiredModifiers |= 16384; + } + if (!completionNodes.length) { + modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers; + } + node = ts6.factory.updateModifiers(node, modifiers); + completionNodes.push(node); + }, + body, + 2, + isAbstract + ); + if (completionNodes.length) { + var format = 1 | 131072; + replacementSpan = modifiersSpan; + if (formatContext) { + insertText = printer.printAndFormatSnippetList(format, ts6.factory.createNodeArray(completionNodes), sourceFile, formatContext); + } else { + insertText = printer.printSnippetList(format, ts6.factory.createNodeArray(completionNodes), sourceFile); + } + } + return { insertText, isSnippet, importAdder, replacementSpan }; + } + function getPresentModifiers(contextToken) { + if (!contextToken) { + return { + modifiers: 0 + /* ModifierFlags.None */ + }; + } + var modifiers = 0; + var span; + var contextMod; + if (contextMod = isModifierLike(contextToken)) { + modifiers |= ts6.modifierToFlag(contextMod); + span = ts6.createTextSpanFromNode(contextToken); + } + if (ts6.isPropertyDeclaration(contextToken.parent)) { + modifiers |= ts6.modifiersToFlags(contextToken.parent.modifiers) & 126975; + span = ts6.createTextSpanFromNode(contextToken.parent); + } + return { modifiers, span }; + } + function isModifierLike(node) { + if (ts6.isModifier(node)) { + return node.kind; + } + if (ts6.isIdentifier(node) && node.originalKeywordKind && ts6.isModifierKind(node.originalKeywordKind)) { + return node.originalKeywordKind; + } + return void 0; + } + function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclaration, program, host, options, preferences, formatContext) { + var isSnippet = preferences.includeCompletionsWithSnippetText || void 0; + var insertText = name; + var sourceFile = enclosingDeclaration.getSourceFile(); + var method = createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences); + if (!method) { + return void 0; + } + var printer = createSnippetPrinter({ + removeComments: true, + module: options.module, + target: options.target, + omitTrailingSemicolon: false, + newLine: ts6.getNewLineKind(ts6.getNewLineCharacter(options, ts6.maybeBind(host, host.getNewLine))) + }); + if (formatContext) { + insertText = printer.printAndFormatSnippetList(16 | 64, ts6.factory.createNodeArray( + [method], + /*hasTrailingComma*/ + true + ), sourceFile, formatContext); + } else { + insertText = printer.printSnippetList(16 | 64, ts6.factory.createNodeArray( + [method], + /*hasTrailingComma*/ + true + ), sourceFile); + } + var signaturePrinter = ts6.createPrinter({ + removeComments: true, + module: options.module, + target: options.target, + omitTrailingSemicolon: true + }); + var methodSignature = ts6.factory.createMethodSignature( + /*modifiers*/ + void 0, + /*name*/ + "", + method.questionToken, + method.typeParameters, + method.parameters, + method.type + ); + var labelDetails = { detail: signaturePrinter.printNode(4, methodSignature, sourceFile) }; + return { isSnippet, insertText, labelDetails }; + } + function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return void 0; + } + var checker = program.getTypeChecker(); + var declaration = declarations[0]; + var name = ts6.getSynthesizedDeepClone( + ts6.getNameOfDeclaration(declaration), + /*includeTrivia*/ + false + ); + var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); + var quotePreference = ts6.getQuotePreference(sourceFile, preferences); + var builderFlags = 33554432 | (quotePreference === 0 ? 268435456 : 0); + switch (declaration.kind) { + case 168: + case 169: + case 170: + case 171: { + var effectiveType = type.flags & 1048576 && type.types.length < 10 ? checker.getUnionType( + type.types, + 2 + /* UnionReduction.Subtype */ + ) : type; + if (effectiveType.flags & 1048576) { + var functionTypes = ts6.filter(effectiveType.types, function(type2) { + return checker.getSignaturesOfType( + type2, + 0 + /* SignatureKind.Call */ + ).length > 0; + }); + if (functionTypes.length === 1) { + effectiveType = functionTypes[0]; + } else { + return void 0; + } + } + var signatures = checker.getSignaturesOfType( + effectiveType, + 0 + /* SignatureKind.Call */ + ); + if (signatures.length !== 1) { + return void 0; + } + var typeNode = checker.typeToTypeNode(effectiveType, enclosingDeclaration, builderFlags, ts6.codefix.getNoopSymbolTrackerWithResolver({ program, host })); + if (!typeNode || !ts6.isFunctionTypeNode(typeNode)) { + return void 0; + } + var body = void 0; + if (preferences.includeCompletionsWithSnippetText) { + var emptyStmt = ts6.factory.createEmptyStatement(); + body = ts6.factory.createBlock( + [emptyStmt], + /* multiline */ + true + ); + ts6.setSnippetElement(emptyStmt, { kind: 0, order: 0 }); + } else { + body = ts6.factory.createBlock( + [], + /* multiline */ + true + ); + } + var parameters = typeNode.parameters.map(function(typedParam) { + return ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + typedParam.dotDotDotToken, + typedParam.name, + /*questionToken*/ + void 0, + /*type*/ + void 0, + typedParam.initializer + ); + }); + return ts6.factory.createMethodDeclaration( + /*modifiers*/ + void 0, + /*asteriskToken*/ + void 0, + name, + /*questionToken*/ + void 0, + /*typeParameters*/ + void 0, + parameters, + /*type*/ + void 0, + body + ); + } + default: + return void 0; + } + } + function createSnippetPrinter(printerOptions) { + var escapes; + var baseWriter = ts6.textChanges.createWriter(ts6.getNewLineCharacter(printerOptions)); + var printer = ts6.createPrinter(printerOptions, baseWriter); + var writer = __assign(__assign({}, baseWriter), { write: function(s) { + return escapingWrite(s, function() { + return baseWriter.write(s); + }); + }, nonEscapingWrite: baseWriter.write, writeLiteral: function(s) { + return escapingWrite(s, function() { + return baseWriter.writeLiteral(s); + }); + }, writeStringLiteral: function(s) { + return escapingWrite(s, function() { + return baseWriter.writeStringLiteral(s); + }); + }, writeSymbol: function(s, symbol) { + return escapingWrite(s, function() { + return baseWriter.writeSymbol(s, symbol); + }); + }, writeParameter: function(s) { + return escapingWrite(s, function() { + return baseWriter.writeParameter(s); + }); + }, writeComment: function(s) { + return escapingWrite(s, function() { + return baseWriter.writeComment(s); + }); + }, writeProperty: function(s) { + return escapingWrite(s, function() { + return baseWriter.writeProperty(s); + }); + } }); + return { + printSnippetList, + printAndFormatSnippetList + }; + function escapingWrite(s, write) { + var escaped = ts6.escapeSnippetText(s); + if (escaped !== s) { + var start = baseWriter.getTextPos(); + write(); + var end = baseWriter.getTextPos(); + escapes = ts6.append(escapes || (escapes = []), { newText: escaped, span: { start, length: end - start } }); + } else { + write(); + } + } + function printSnippetList(format, list, sourceFile) { + var unescaped = printUnescapedSnippetList(format, list, sourceFile); + return escapes ? ts6.textChanges.applyChanges(unescaped, escapes) : unescaped; + } + function printUnescapedSnippetList(format, list, sourceFile) { + escapes = void 0; + writer.clear(); + printer.writeList(format, list, sourceFile, writer); + return writer.getText(); + } + function printAndFormatSnippetList(format, list, sourceFile, formatContext) { + var syntheticFile = { + text: printUnescapedSnippetList(format, list, sourceFile), + getLineAndCharacterOfPosition: function(pos) { + return ts6.getLineAndCharacterOfPosition(this, pos); + } + }; + var formatOptions = ts6.getFormatCodeSettingsForWriting(formatContext, sourceFile); + var changes = ts6.flatMap(list, function(node) { + var nodeWithPos = ts6.textChanges.assignPositionsToNode(node); + return ts6.formatting.formatNodeGivenIndentation( + nodeWithPos, + syntheticFile, + sourceFile.languageVariant, + /* indentation */ + 0, + /* delta */ + 0, + __assign(__assign({}, formatContext), { options: formatOptions }) + ); + }); + var allChanges = escapes ? ts6.stableSort(ts6.concatenate(changes, escapes), function(a, b) { + return ts6.compareTextSpans(a.span, b.span); + }) : changes; + return ts6.textChanges.applyChanges(syntheticFile.text, allChanges); + } + } + function originToCompletionEntryData(origin) { + var ambientModuleName = origin.fileName ? void 0 : ts6.stripQuotes(origin.moduleSymbol.name); + var isPackageJsonImport = origin.isFromPackageJson ? true : void 0; + if (originIsResolvedExport(origin)) { + var resolvedData = { + exportName: origin.exportName, + moduleSpecifier: origin.moduleSpecifier, + ambientModuleName, + fileName: origin.fileName, + isPackageJsonImport + }; + return resolvedData; + } + var unresolvedData = { + exportName: origin.exportName, + exportMapKey: origin.exportMapKey, + fileName: origin.fileName, + ambientModuleName: origin.fileName ? void 0 : ts6.stripQuotes(origin.moduleSymbol.name), + isPackageJsonImport: origin.isFromPackageJson ? true : void 0 + }; + return unresolvedData; + } + function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbol) { + var isDefaultExport = data.exportName === "default"; + var isFromPackageJson = !!data.isPackageJsonImport; + if (completionEntryDataIsResolved(data)) { + var resolvedOrigin = { + kind: 32, + exportName: data.exportName, + moduleSpecifier: data.moduleSpecifier, + symbolName: completionName, + fileName: data.fileName, + moduleSymbol, + isDefaultExport, + isFromPackageJson + }; + return resolvedOrigin; + } + var unresolvedOrigin = { + kind: 4, + exportName: data.exportName, + exportMapKey: data.exportMapKey, + symbolName: completionName, + fileName: data.fileName, + moduleSymbol, + isDefaultExport, + isFromPackageJson + }; + return unresolvedOrigin; + } + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; + var quotedModuleSpecifier = ts6.quote(sourceFile, preferences, origin.moduleSpecifier); + var exportKind = origin.isDefaultExport ? 1 : origin.exportName === "export=" ? 2 : 0; + var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; + var importKind = ts6.codefix.getImportKind( + sourceFile, + exportKind, + options, + /*forceImportKeyword*/ + true + ); + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts6.tokenToString( + 154 + /* SyntaxKind.TypeKeyword */ + ), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts6.tokenToString( + 154 + /* SyntaxKind.TypeKeyword */ + ), " ") : ""; + var suffix = useSemicolons ? ";" : ""; + switch (importKind) { + case 3: + return { replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts6.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; + case 1: + return { replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts6.escapeSnippetText(name)).concat(tabStop, " from ").concat(quotedModuleSpecifier).concat(suffix) }; + case 2: + return { replacementSpan, insertText: "import".concat(topLevelTypeOnlyText, "* as ").concat(ts6.escapeSnippetText(name), " from ").concat(quotedModuleSpecifier).concat(suffix) }; + case 0: + return { replacementSpan, insertText: "import".concat(topLevelTypeOnlyText, "{ ").concat(importSpecifierTypeOnlyText).concat(ts6.escapeSnippetText(name)).concat(tabStop, " } from ").concat(quotedModuleSpecifier).concat(suffix) }; + } + } + function quotePropertyName(sourceFile, preferences, name) { + if (/^\d+$/.test(name)) { + return name; + } + return ts6.quote(sourceFile, preferences, name); + } + function isRecommendedCompletionMatch(localSymbol, recommendedCompletion, checker) { + return localSymbol === recommendedCompletion || !!(localSymbol.flags & 1048576) && checker.getExportSymbolOfSymbol(localSymbol) === recommendedCompletion; + } + function getSourceFromOrigin(origin) { + if (originIsExport(origin)) { + return ts6.stripQuotes(origin.moduleSymbol.name); + } + if (originIsResolvedExport(origin)) { + return origin.moduleSpecifier; + } + if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 1) { + return CompletionSource.ThisProperty; + } + if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64) { + return CompletionSource.TypeOnlyAlias; + } + } + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + var _a; + var start = ts6.timestamp(); + var variableDeclaration = getVariableDeclaration(location); + var useSemicolons = ts6.probablyUsesSemicolons(sourceFile); + var typeChecker = program.getTypeChecker(); + var uniques = new ts6.Map(); + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + var origin = symbolToOriginInfoMap === null || symbolToOriginInfoMap === void 0 ? void 0 : symbolToOriginInfoMap[i]; + var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, !!jsxIdentifierExpected); + if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === 1 && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) { + continue; + } + var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; + var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts6.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions2.SortText.LocationPriority; + var sortText = isDeprecated(symbol, typeChecker) ? Completions2.SortText.Deprecated(originalSortText) : originalSortText; + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + if (!entry) { + continue; + } + var shouldShadowLaterSymbols = (!origin || originIsTypeOnlyAlias(origin)) && !(symbol.parent === void 0 && !ts6.some(symbol.declarations, function(d) { + return d.getSourceFile() === location.getSourceFile(); + })); + uniques.set(name, shouldShadowLaterSymbols); + ts6.insertSorted( + entries, + entry, + compareCompletionEntries, + /*allowDuplicates*/ + true + ); + } + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts6.timestamp() - start)); + return { + has: function(name2) { + return uniques.has(name2); + }, + add: function(name2) { + return uniques.set(name2, true); + } + }; + function shouldIncludeSymbol(symbol2, symbolToSortTextMap2) { + var allFlags = symbol2.flags; + if (!ts6.isSourceFile(location)) { + if (ts6.isExportAssignment(location.parent)) { + return true; + } + if (variableDeclaration && symbol2.valueDeclaration === variableDeclaration) { + return false; + } + var symbolOrigin = ts6.skipAlias(symbol2, typeChecker); + if (!!sourceFile.externalModuleIndicator && !compilerOptions.allowUmdGlobalAccess && symbolToSortTextMap2[ts6.getSymbolId(symbol2)] === Completions2.SortText.GlobalsOrKeywords && (symbolToSortTextMap2[ts6.getSymbolId(symbolOrigin)] === Completions2.SortText.AutoImportSuggestions || symbolToSortTextMap2[ts6.getSymbolId(symbolOrigin)] === Completions2.SortText.LocationPriority)) { + return false; + } + allFlags |= ts6.getCombinedLocalAndExportSymbolFlags(symbolOrigin); + if (ts6.isInRightSideOfInternalImportEqualsDeclaration(location)) { + return !!(allFlags & 1920); + } + if (isTypeOnlyLocation) { + return symbolCanBeReferencedAtTypeLocation(symbol2, typeChecker); + } + } + return !!(allFlags & 111551); + } + } + Completions2.getCompletionEntriesFromSymbols = getCompletionEntriesFromSymbols; + function getLabelCompletionAtPosition(node) { + var entries = getLabelStatementCompletions(node); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; + } + } + function getLabelStatementCompletions(node) { + var entries = []; + var uniques = new ts6.Map(); + var current = node; + while (current) { + if (ts6.isFunctionLike(current)) { + break; + } + if (ts6.isLabeledStatement(current)) { + var name = current.label.text; + if (!uniques.has(name)) { + uniques.set(name, true); + entries.push({ + name, + kindModifiers: "", + kind: "label", + sortText: Completions2.SortText.LocationPriority + }); + } + } + current = current.parent; + } + return entries; + } + function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences) { + if (entryId.data) { + var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host); + if (autoImport) { + var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken; + return { + type: "symbol", + symbol: autoImport.symbol, + location: ts6.getTouchingPropertyName(sourceFile, position), + previousToken: previousToken_1, + contextToken: contextToken_1, + isJsxInitializer: false, + isTypeOnlyLocation: false, + origin: autoImport.origin + }; + } + } + var compilerOptions = program.getCompilerOptions(); + var completionData = getCompletionData( + program, + log, + sourceFile, + compilerOptions, + position, + { includeCompletionsForModuleExports: true, includeCompletionsWithInsertText: true }, + entryId, + host, + /*formatContext*/ + void 0 + ); + if (!completionData) { + return { type: "none" }; + } + if (completionData.kind !== 0) { + return { type: "request", request: completionData }; + } + var symbols = completionData.symbols, literals = completionData.literals, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, contextToken = completionData.contextToken, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation; + var literal2 = ts6.find(literals, function(l) { + return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; + }); + if (literal2 !== void 0) + return { type: "literal", literal: literal2 }; + return ts6.firstDefined(symbols, function(symbol, index) { + var origin = symbolToOriginInfoMap[index]; + var info = getCompletionEntryDisplayNameForSymbol(symbol, ts6.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected); + return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & 106500 || entryId.source === CompletionSource.ObjectLiteralMethodSnippet && symbol.flags & (4 | 8192) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0; + }) || { type: "none" }; + } + function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) { + var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); + var name = entryId.name, source = entryId.source, data = entryId.data; + var contextToken = ts6.findPrecedingToken(position, sourceFile); + if (ts6.isInString(sourceFile, position, contextToken)) { + return Completions2.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences); + } + var symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences); + switch (symbolCompletion.type) { + case "request": { + var request = symbolCompletion.request; + switch (request.kind) { + case 1: + return ts6.JsDoc.getJSDocTagNameCompletionDetails(name); + case 2: + return ts6.JsDoc.getJSDocTagCompletionDetails(name); + case 3: + return ts6.JsDoc.getJSDocParameterNameCompletionDetails(name); + case 4: + return ts6.some(request.keywordCompletions, function(c) { + return c.name === name; + }) ? createSimpleDetails(name, "keyword", ts6.SymbolDisplayPartKind.keyword) : void 0; + default: + return ts6.Debug.assertNever(request); + } + } + case "symbol": { + var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); + } + case "literal": { + var literal2 = symbolCompletion.literal; + return createSimpleDetails(completionNameForLiteral(sourceFile, preferences, literal2), "string", typeof literal2 === "string" ? ts6.SymbolDisplayPartKind.stringLiteral : ts6.SymbolDisplayPartKind.numericLiteral); + } + case "none": + return allKeywordsCompletions().some(function(c) { + return c.name === name; + }) ? createSimpleDetails(name, "keyword", ts6.SymbolDisplayPartKind.keyword) : void 0; + default: + ts6.Debug.assertNever(symbolCompletion); + } + } + Completions2.getCompletionEntryDetails = getCompletionEntryDetails; + function createSimpleDetails(name, kind, kind2) { + return createCompletionDetails(name, "", kind, [ts6.displayPart(name, kind2)]); + } + function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) { + var _a = checker.runWithCancellationToken(cancellationToken, function(checker2) { + return ts6.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind( + checker2, + symbol, + sourceFile, + location, + location, + 7 + /* SemanticMeaning.All */ + ); + }), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; + return createCompletionDetails(symbol.name, ts6.SymbolDisplay.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay); + } + Completions2.createCompletionDetailsForSymbol = createCompletionDetailsForSymbol; + function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) { + return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source }; + } + Completions2.createCompletionDetails = createCompletionDetails; + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { + if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { + return { codeActions: void 0, sourceDisplay: [ts6.textPart(data.moduleSpecifier)] }; + } + } + if (source === CompletionSource.ClassMemberSnippet) { + var importAdder = getEntryForMemberCompletion(host, program, compilerOptions, preferences, name, symbol, location, contextToken, formatContext).importAdder; + if (importAdder) { + var changes = ts6.textChanges.ChangeTracker.with({ host, formatContext, preferences }, importAdder.writeFixes); + return { + sourceDisplay: void 0, + codeActions: [{ + changes, + description: ts6.diagnosticToString([ts6.Diagnostics.Includes_imports_of_types_referenced_by_0, name]) + }] + }; + } + } + if (originIsTypeOnlyAlias(origin)) { + var codeAction_1 = ts6.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences); + ts6.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias"); + return { codeActions: [codeAction_1], sourceDisplay: void 0 }; + } + if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) { + return { codeActions: void 0, sourceDisplay: void 0 }; + } + var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); + var moduleSymbol = origin.moduleSymbol; + var targetSymbol = checker.getMergedSymbol(ts6.skipAlias(symbol.exportSymbol || symbol, checker)); + var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 && ts6.isJsxOpeningLikeElement(contextToken.parent); + var _a = ts6.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts6.getNameForExportedSymbol(symbol, ts6.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts6.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + ts6.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); + return { sourceDisplay: [ts6.textPart(moduleSpecifier)], codeActions: [codeAction] }; + } + function getCompletionEntrySymbol(program, log, sourceFile, position, entryId, host, preferences) { + var completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences); + return completion.type === "symbol" ? completion.symbol : void 0; + } + Completions2.getCompletionEntrySymbol = getCompletionEntrySymbol; + var CompletionDataKind; + (function(CompletionDataKind2) { + CompletionDataKind2[CompletionDataKind2["Data"] = 0] = "Data"; + CompletionDataKind2[CompletionDataKind2["JsDocTagName"] = 1] = "JsDocTagName"; + CompletionDataKind2[CompletionDataKind2["JsDocTag"] = 2] = "JsDocTag"; + CompletionDataKind2[CompletionDataKind2["JsDocParameterName"] = 3] = "JsDocParameterName"; + CompletionDataKind2[CompletionDataKind2["Keywords"] = 4] = "Keywords"; + })(CompletionDataKind || (CompletionDataKind = {})); + var CompletionKind; + (function(CompletionKind2) { + CompletionKind2[CompletionKind2["ObjectPropertyDeclaration"] = 0] = "ObjectPropertyDeclaration"; + CompletionKind2[CompletionKind2["Global"] = 1] = "Global"; + CompletionKind2[CompletionKind2["PropertyAccess"] = 2] = "PropertyAccess"; + CompletionKind2[CompletionKind2["MemberLike"] = 3] = "MemberLike"; + CompletionKind2[CompletionKind2["String"] = 4] = "String"; + CompletionKind2[CompletionKind2["None"] = 5] = "None"; + })(CompletionKind = Completions2.CompletionKind || (Completions2.CompletionKind = {})); + function getRecommendedCompletion(previousToken, contextualType, checker) { + return ts6.firstDefined(contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]), function(type) { + var symbol = type && type.symbol; + return symbol && (symbol.flags & (8 | 384 | 32) && !ts6.isAbstractConstructorSymbol(symbol)) ? getFirstSymbolInChain(symbol, previousToken, checker) : void 0; + }); + } + function getContextualType(previousToken, position, sourceFile, checker) { + var parent = previousToken.parent; + switch (previousToken.kind) { + case 79: + return ts6.getContextualTypeFromParent(previousToken, checker); + case 63: + switch (parent.kind) { + case 257: + return checker.getContextualType(parent.initializer); + case 223: + return checker.getTypeAtLocation(parent.left); + case 288: + return checker.getContextualTypeForJsxAttribute(parent); + default: + return void 0; + } + case 103: + return checker.getContextualType(parent); + case 82: + var caseClause = ts6.tryCast(parent, ts6.isCaseClause); + return caseClause ? ts6.getSwitchedType(caseClause, checker) : void 0; + case 18: + return ts6.isJsxExpression(parent) && !ts6.isJsxElement(parent.parent) && !ts6.isJsxFragment(parent.parent) ? checker.getContextualTypeForJsxAttribute(parent.parent) : void 0; + default: + var argInfo = ts6.SignatureHelp.getArgumentInfoForCompletions(previousToken, position, sourceFile); + return argInfo ? ( + // At `,`, treat this as the next argument after the comma. + checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === 27 ? 1 : 0)) + ) : ts6.isEqualityOperatorKind(previousToken.kind) && ts6.isBinaryExpression(parent) && ts6.isEqualityOperatorKind(parent.operatorToken.kind) ? ( + // completion at `x ===/**/` should be for the right side + checker.getTypeAtLocation(parent.left) + ) : checker.getContextualType(previousToken); + } + } + function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { + var chain = checker.getAccessibleSymbolChain( + symbol, + enclosingDeclaration, + /*meaning*/ + 67108863, + /*useOnlyExternalAliasing*/ + false + ); + if (chain) + return ts6.first(chain); + return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); + } + function isModuleSymbol(symbol) { + var _a; + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function(d) { + return d.kind === 308; + })); + } + function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { + var typeChecker = program.getTypeChecker(); + var inCheckedFile = isCheckedFile(sourceFile, compilerOptions); + var start = ts6.timestamp(); + var currentToken = ts6.getTokenAtPosition(sourceFile, position); + log("getCompletionData: Get current token: " + (ts6.timestamp() - start)); + start = ts6.timestamp(); + var insideComment = ts6.isInComment(sourceFile, position, currentToken); + log("getCompletionData: Is inside comment: " + (ts6.timestamp() - start)); + var insideJsDocTagTypeExpression = false; + var isInSnippetScope = false; + if (insideComment) { + if (ts6.hasDocComment(sourceFile, position)) { + if (sourceFile.text.charCodeAt(position - 1) === 64) { + return { + kind: 1 + /* CompletionDataKind.JsDocTagName */ + }; + } else { + var lineStart = ts6.getLineStartPositionForPosition(position, sourceFile); + if (!/[^\*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) { + return { + kind: 2 + /* CompletionDataKind.JsDocTag */ + }; + } + } + } + var tag = getJsDocTagAtPosition(currentToken, position); + if (tag) { + if (tag.tagName.pos <= position && position <= tag.tagName.end) { + return { + kind: 1 + /* CompletionDataKind.JsDocTagName */ + }; + } + var typeExpression = tryGetTypeExpressionFromTag(tag); + if (typeExpression) { + currentToken = ts6.getTokenAtPosition(sourceFile, position); + if (!currentToken || !ts6.isDeclarationName(currentToken) && (currentToken.parent.kind !== 350 || currentToken.parent.name !== currentToken)) { + insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); + } + } + if (!insideJsDocTagTypeExpression && ts6.isJSDocParameterTag(tag) && (ts6.nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) { + return { kind: 3, tag }; + } + } + if (!insideJsDocTagTypeExpression) { + log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); + return void 0; + } + } + start = ts6.timestamp(); + var isJsOnlyLocation = !insideJsDocTagTypeExpression && ts6.isSourceFileJS(sourceFile); + var tokens = getRelevantTokens(position, sourceFile); + var previousToken = tokens.previousToken; + var contextToken = tokens.contextToken; + log("getCompletionData: Get previous token: " + (ts6.timestamp() - start)); + var node = currentToken; + var propertyAccessToConvert; + var isRightOfDot = false; + var isRightOfQuestionDot = false; + var isRightOfOpenTag = false; + var isStartingCloseTag = false; + var isJsxInitializer = false; + var isJsxIdentifierExpected = false; + var importStatementCompletion; + var location = ts6.getTouchingPropertyName(sourceFile, position); + var keywordFilters = 0; + var isNewIdentifierLocation = false; + var flags = 0; + if (contextToken) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { + return { + kind: 4, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation + }; + } + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); + } + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + flags |= 2; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; + } + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { + log("Returning an empty list because completion was requested in an invalid position."); + return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) : void 0; + } + var parent = contextToken.parent; + if (contextToken.kind === 24 || contextToken.kind === 28) { + isRightOfDot = contextToken.kind === 24; + isRightOfQuestionDot = contextToken.kind === 28; + switch (parent.kind) { + case 208: + propertyAccessToConvert = parent; + node = propertyAccessToConvert.expression; + var leftmostAccessExpression = ts6.getLeftmostAccessExpression(propertyAccessToConvert); + if (ts6.nodeIsMissing(leftmostAccessExpression) || (ts6.isCallExpression(node) || ts6.isFunctionLike(node)) && node.end === contextToken.pos && node.getChildCount(sourceFile) && ts6.last(node.getChildren(sourceFile)).kind !== 21) { + return void 0; + } + break; + case 163: + node = parent.left; + break; + case 264: + node = parent.name; + break; + case 202: + node = parent; + break; + case 233: + node = parent.getFirstToken(sourceFile); + ts6.Debug.assert( + node.kind === 100 || node.kind === 103 + /* SyntaxKind.NewKeyword */ + ); + break; + default: + return void 0; + } + } else if (!importStatementCompletion) { + if (parent && parent.kind === 208) { + contextToken = parent; + parent = parent.parent; + } + if (currentToken.parent === location) { + switch (currentToken.kind) { + case 31: + if (currentToken.parent.kind === 281 || currentToken.parent.kind === 283) { + location = currentToken; + } + break; + case 43: + if (currentToken.parent.kind === 282) { + location = currentToken; + } + break; + } + } + switch (parent.kind) { + case 284: + if (contextToken.kind === 43) { + isStartingCloseTag = true; + location = contextToken; + } + break; + case 223: + if (!binaryExpressionMayBeOpenTag(parent)) { + break; + } + case 282: + case 281: + case 283: + isJsxIdentifierExpected = true; + if (contextToken.kind === 29) { + isRightOfOpenTag = true; + location = contextToken; + } + break; + case 291: + case 290: + if (previousToken.kind === 19 && currentToken.kind === 31) { + isJsxIdentifierExpected = true; + } + break; + case 288: + if (parent.initializer === previousToken && previousToken.end < position) { + isJsxIdentifierExpected = true; + break; + } + switch (previousToken.kind) { + case 63: + isJsxInitializer = true; + break; + case 79: + isJsxIdentifierExpected = true; + if (parent !== previousToken.parent && !parent.initializer && ts6.findChildOfKind(parent, 63, sourceFile)) { + isJsxInitializer = previousToken; + } + } + break; + } + } + } + var semanticStart = ts6.timestamp(); + var completionKind = 5; + var isNonContextualObjectLiteral = false; + var hasUnresolvedAutoImports = false; + var symbols = []; + var importSpecifierResolver; + var symbolToOriginInfoMap = []; + var symbolToSortTextMap = []; + var seenPropertySymbols = new ts6.Map(); + var isTypeOnlyLocation = isTypeOnlyCompletion(); + var getModuleSpecifierResolutionHost = ts6.memoizeOne(function(isFromPackageJson) { + return ts6.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); + }); + if (isRightOfDot || isRightOfQuestionDot) { + getTypeScriptMemberSymbols(); + } else if (isRightOfOpenTag) { + symbols = typeChecker.getJsxIntrinsicTagNamesAt(location); + ts6.Debug.assertEachIsDefined(symbols, "getJsxIntrinsicTagNames() should all be defined"); + tryGetGlobalSymbols(); + completionKind = 1; + keywordFilters = 0; + } else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + var tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (tagSymbol) { + symbols = [tagSymbol]; + } + completionKind = 1; + keywordFilters = 0; + } else { + if (!tryGetGlobalSymbols()) { + return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierLocation) : void 0; + } + } + log("getCompletionData: Semantic work: " + (ts6.timestamp() - semanticStart)); + var contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker); + var literals = ts6.mapDefined(contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]), function(t) { + return t.isLiteral() && !(t.flags & 1024) ? t.value : void 0; + }); + var recommendedCompletion = previousToken && contextualType && getRecommendedCompletion(previousToken, contextualType, typeChecker); + return { + kind: 0, + symbols, + completionKind, + isInSnippetScope, + propertyAccessToConvert, + isNewIdentifierLocation, + location, + keywordFilters, + literals, + symbolToOriginInfoMap, + recommendedCompletion, + previousToken, + contextToken, + isJsxInitializer, + insideJsDocTagTypeExpression, + symbolToSortTextMap, + isTypeOnlyLocation, + isJsxIdentifierExpected, + isRightOfOpenTag, + importStatementCompletion, + hasUnresolvedAutoImports, + flags + }; + function isTagWithTypeExpression(tag2) { + switch (tag2.kind) { + case 343: + case 350: + case 344: + case 346: + case 348: + return true; + case 347: + return !!tag2.constraint; + default: + return false; + } + } + function tryGetTypeExpressionFromTag(tag2) { + if (isTagWithTypeExpression(tag2)) { + var typeExpression2 = ts6.isJSDocTemplateTag(tag2) ? tag2.constraint : tag2.typeExpression; + return typeExpression2 && typeExpression2.kind === 312 ? typeExpression2 : void 0; + } + return void 0; + } + function getTypeScriptMemberSymbols() { + completionKind = 2; + var isImportType = ts6.isLiteralImportTypeNode(node); + var isTypeLocation = insideJsDocTagTypeExpression || isImportType && !node.isTypeOf || ts6.isPartOfTypeNode(node.parent) || ts6.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker); + var isRhsOfImportDeclaration = ts6.isInRightSideOfInternalImportEqualsDeclaration(node); + if (ts6.isEntityName(node) || isImportType || ts6.isPropertyAccessExpression(node)) { + var isNamespaceName = ts6.isModuleDeclaration(node.parent); + if (isNamespaceName) + isNewIdentifierLocation = true; + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + symbol = ts6.skipAlias(symbol, typeChecker); + if (symbol.flags & (1536 | 384)) { + var exportedSymbols = typeChecker.getExportsOfModule(symbol); + ts6.Debug.assertEachIsDefined(exportedSymbols, "getExportsOfModule() should all be defined"); + var isValidValueAccess_1 = function(symbol2) { + return typeChecker.isValidPropertyAccess(isImportType ? node : node.parent, symbol2.name); + }; + var isValidTypeAccess_1 = function(symbol2) { + return symbolCanBeReferencedAtTypeLocation(symbol2, typeChecker); + }; + var isValidAccess = isNamespaceName ? function(symbol2) { + var _a; + return !!(symbol2.flags & 1920) && !((_a = symbol2.declarations) === null || _a === void 0 ? void 0 : _a.every(function(d) { + return d.parent === node.parent; + })); + } : isRhsOfImportDeclaration ? ( + // Any kind is allowed when dotting off namespace in internal import equals declaration + function(symbol2) { + return isValidTypeAccess_1(symbol2) || isValidValueAccess_1(symbol2); + } + ) : isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1; + for (var _i = 0, exportedSymbols_1 = exportedSymbols; _i < exportedSymbols_1.length; _i++) { + var exportedSymbol = exportedSymbols_1[_i]; + if (isValidAccess(exportedSymbol)) { + symbols.push(exportedSymbol); + } + } + if (!isTypeLocation && symbol.declarations && symbol.declarations.some(function(d) { + return d.kind !== 308 && d.kind !== 264 && d.kind !== 263; + })) { + var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); + var insertQuestionDot = false; + if (type.isNullableType()) { + var canCorrectToQuestionDot = isRightOfDot && !isRightOfQuestionDot && preferences.includeAutomaticOptionalChainCompletions !== false; + if (canCorrectToQuestionDot || isRightOfQuestionDot) { + type = type.getNonNullableType(); + if (canCorrectToQuestionDot) { + insertQuestionDot = true; + } + } + } + addTypeProperties(type, !!(node.flags & 32768), insertQuestionDot); + } + return; + } + } + } + if (!isTypeLocation) { + typeChecker.tryGetThisTypeAt( + node, + /*includeGlobalThis*/ + false + ); + var type = typeChecker.getTypeAtLocation(node).getNonOptionalType(); + var insertQuestionDot = false; + if (type.isNullableType()) { + var canCorrectToQuestionDot = isRightOfDot && !isRightOfQuestionDot && preferences.includeAutomaticOptionalChainCompletions !== false; + if (canCorrectToQuestionDot || isRightOfQuestionDot) { + type = type.getNonNullableType(); + if (canCorrectToQuestionDot) { + insertQuestionDot = true; + } + } + } + addTypeProperties(type, !!(node.flags & 32768), insertQuestionDot); + } + } + function addTypeProperties(type, insertAwait, insertQuestionDot) { + isNewIdentifierLocation = !!type.getStringIndexType(); + if (isRightOfQuestionDot && ts6.some(type.getCallSignatures())) { + isNewIdentifierLocation = true; + } + var propertyAccess = node.kind === 202 ? node : node.parent; + if (inCheckedFile) { + for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { + var symbol = _a[_i]; + if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) { + addPropertySymbol( + symbol, + /* insertAwait */ + false, + insertQuestionDot + ); + } + } + } else { + symbols.push.apply(symbols, ts6.filter(getPropertiesForCompletion(type, typeChecker), function(s) { + return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); + })); + } + if (insertAwait && preferences.includeCompletionsWithInsertText) { + var promiseType = typeChecker.getPromisedTypeOfPromise(type); + if (promiseType) { + for (var _b = 0, _c = promiseType.getApparentProperties(); _b < _c.length; _b++) { + var symbol = _c[_b]; + if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, promiseType, symbol)) { + addPropertySymbol( + symbol, + /* insertAwait */ + true, + insertQuestionDot + ); + } + } + } + } + } + function addPropertySymbol(symbol, insertAwait, insertQuestionDot) { + var _a; + var computedPropertyName = ts6.firstDefined(symbol.declarations, function(decl) { + return ts6.tryCast(ts6.getNameOfDeclaration(decl), ts6.isComputedPropertyName); + }); + if (computedPropertyName) { + var leftMostName = getLeftMostName(computedPropertyName.expression); + var nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName); + var firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker); + if (firstAccessibleSymbol && ts6.addToSeen(seenPropertySymbols, ts6.getSymbolId(firstAccessibleSymbol))) { + var index = symbols.length; + symbols.push(firstAccessibleSymbol); + var moduleSymbol = firstAccessibleSymbol.parent; + if (!moduleSymbol || !ts6.isExternalModuleSymbol(moduleSymbol) || typeChecker.tryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.name, moduleSymbol) !== firstAccessibleSymbol) { + symbolToOriginInfoMap[index] = { kind: getNullableSymbolOriginInfoKind( + 2 + /* SymbolOriginInfoKind.SymbolMemberNoExport */ + ) }; + } else { + var fileName = ts6.isExternalModuleNameRelative(ts6.stripQuotes(moduleSymbol.name)) ? (_a = ts6.getSourceFileOfModule(moduleSymbol)) === null || _a === void 0 ? void 0 : _a.fileName : void 0; + var moduleSpecifier = ((importSpecifierResolver || (importSpecifierResolver = ts6.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences))).getModuleSpecifierForBestExportInfo([{ + exportKind: 0, + moduleFileName: fileName, + isFromPackageJson: false, + moduleSymbol, + symbol: firstAccessibleSymbol, + targetFlags: ts6.skipAlias(firstAccessibleSymbol, typeChecker).flags + }], firstAccessibleSymbol.name, position, ts6.isValidTypeOnlyAliasUseSite(location)) || {}).moduleSpecifier; + if (moduleSpecifier) { + var origin = { + kind: getNullableSymbolOriginInfoKind( + 6 + /* SymbolOriginInfoKind.SymbolMemberExport */ + ), + moduleSymbol, + isDefaultExport: false, + symbolName: firstAccessibleSymbol.name, + exportName: firstAccessibleSymbol.name, + fileName, + moduleSpecifier + }; + symbolToOriginInfoMap[index] = origin; + } + } + } else if (preferences.includeCompletionsWithInsertText) { + addSymbolOriginInfo(symbol); + addSymbolSortInfo(symbol); + symbols.push(symbol); + } + } else { + addSymbolOriginInfo(symbol); + addSymbolSortInfo(symbol); + symbols.push(symbol); + } + function addSymbolSortInfo(symbol2) { + if (isStaticProperty(symbol2)) { + symbolToSortTextMap[ts6.getSymbolId(symbol2)] = Completions2.SortText.LocalDeclarationPriority; + } + } + function addSymbolOriginInfo(symbol2) { + if (preferences.includeCompletionsWithInsertText) { + if (insertAwait && ts6.addToSeen(seenPropertySymbols, ts6.getSymbolId(symbol2))) { + symbolToOriginInfoMap[symbols.length] = { kind: getNullableSymbolOriginInfoKind( + 8 + /* SymbolOriginInfoKind.Promise */ + ) }; + } else if (insertQuestionDot) { + symbolToOriginInfoMap[symbols.length] = { + kind: 16 + /* SymbolOriginInfoKind.Nullable */ + }; + } + } + } + function getNullableSymbolOriginInfoKind(kind) { + return insertQuestionDot ? kind | 16 : kind; + } + } + function getLeftMostName(e) { + return ts6.isIdentifier(e) ? e : ts6.isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : void 0; + } + function tryGetGlobalSymbols() { + var result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1); + return result === 1; + } + function tryGetConstructorCompletion() { + if (!tryGetConstructorLikeCompletionContainer(contextToken)) + return 0; + completionKind = 5; + isNewIdentifierLocation = true; + keywordFilters = 4; + return 1; + } + function tryGetJsxCompletionSymbols() { + var jsxContainer = tryGetContainingJsxElement(contextToken); + var attrsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes); + if (!attrsType) + return 0; + var completionsType = jsxContainer && typeChecker.getContextualType( + jsxContainer.attributes, + 4 + /* ContextFlags.Completions */ + ); + symbols = ts6.concatenate(symbols, filterJsxAttributes(getPropertiesForObjectExpression(attrsType, completionsType, jsxContainer.attributes, typeChecker), jsxContainer.attributes.properties)); + setSortTextToOptionalMember(); + completionKind = 3; + isNewIdentifierLocation = false; + return 1; + } + function tryGetImportCompletionSymbols() { + if (!importStatementCompletion) + return 0; + isNewIdentifierLocation = true; + collectAutoImports(); + return 1; + } + function getGlobalCompletions() { + keywordFilters = tryGetFunctionLikeBodyCompletionContainer(contextToken) ? 5 : 1; + completionKind = 1; + isNewIdentifierLocation = isNewIdentifierDefinitionLocation(); + if (previousToken !== contextToken) { + ts6.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'."); + } + var adjustedPosition = previousToken !== contextToken ? previousToken.getStart() : position; + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; + isInSnippetScope = isSnippetScope(scopeNode); + var symbolMeanings = (isTypeOnlyLocation ? 0 : 111551) | 788968 | 1920 | 2097152; + var typeOnlyAliasNeedsPromotion = previousToken && !ts6.isValidTypeOnlyAliasUseSite(previousToken); + symbols = ts6.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings)); + ts6.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined"); + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + if (!typeChecker.isArgumentsSymbol(symbol) && !ts6.some(symbol.declarations, function(d) { + return d.getSourceFile() === sourceFile; + })) { + symbolToSortTextMap[ts6.getSymbolId(symbol)] = Completions2.SortText.GlobalsOrKeywords; + } + if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551)) { + var typeOnlyAliasDeclaration = symbol.declarations && ts6.find(symbol.declarations, ts6.isTypeOnlyImportOrExportDeclaration); + if (typeOnlyAliasDeclaration) { + var origin = { kind: 64, declaration: typeOnlyAliasDeclaration }; + symbolToOriginInfoMap[i] = origin; + } + } + } + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308) { + var thisType = typeChecker.tryGetThisTypeAt( + scopeNode, + /*includeGlobalThis*/ + false, + ts6.isClassLike(scopeNode.parent) ? scopeNode : void 0 + ); + if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { + for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { + var symbol = _a[_i]; + symbolToOriginInfoMap[symbols.length] = { + kind: 1 + /* SymbolOriginInfoKind.ThisType */ + }; + symbols.push(symbol); + symbolToSortTextMap[ts6.getSymbolId(symbol)] = Completions2.SortText.SuggestedClassMembers; + } + } + } + collectAutoImports(); + if (isTypeOnlyLocation) { + keywordFilters = contextToken && ts6.isAssertionExpression(contextToken.parent) ? 6 : 7; + } + } + function shouldOfferImportCompletions() { + if (importStatementCompletion) + return true; + if (isNonContextualObjectLiteral) + return false; + if (!preferences.includeCompletionsForModuleExports) + return false; + if (sourceFile.externalModuleIndicator || sourceFile.commonJsModuleIndicator) + return true; + if (ts6.compilerOptionsIndicateEsModules(program.getCompilerOptions())) + return true; + return ts6.programContainsModules(program); + } + function isSnippetScope(scopeNode) { + switch (scopeNode.kind) { + case 308: + case 225: + case 291: + case 238: + return true; + default: + return ts6.isStatement(scopeNode); + } + } + function isTypeOnlyCompletion() { + return insideJsDocTagTypeExpression || !!importStatementCompletion && ts6.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts6.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts6.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)); + } + function isContextTokenValueLocation(contextToken2) { + return contextToken2 && (contextToken2.kind === 112 && (contextToken2.parent.kind === 183 || ts6.isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 129 && contextToken2.parent.kind === 179); + } + function isContextTokenTypeLocation(contextToken2) { + if (contextToken2) { + var parentKind = contextToken2.parent.kind; + switch (contextToken2.kind) { + case 58: + return parentKind === 169 || parentKind === 168 || parentKind === 166 || parentKind === 257 || ts6.isFunctionLikeKind(parentKind); + case 63: + return parentKind === 262; + case 128: + return parentKind === 231; + case 29: + return parentKind === 180 || parentKind === 213; + case 94: + return parentKind === 165; + case 150: + return parentKind === 235; + } + } + return false; + } + function collectAutoImports() { + var _a, _b; + if (!shouldOfferImportCompletions()) + return; + ts6.Debug.assert(!(detailsEntryId === null || detailsEntryId === void 0 ? void 0 : detailsEntryId.data), "Should not run 'collectAutoImports' when faster path is available via `data`"); + if (detailsEntryId && !detailsEntryId.source) { + return; + } + flags |= 1; + var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken && importStatementCompletion; + var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts6.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; + var moduleSpecifierCache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host); + var exportInfo = ts6.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); + var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); + var packageJsonFilter = detailsEntryId ? void 0 : ts6.createPackageJsonImportFilter(sourceFile, preferences, host); + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts6.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts6.isValidTypeOnlyAliasUseSite(location), function(context) { + exportInfo.search( + sourceFile.path, + /*preferCapitalized*/ + isRightOfOpenTag, + function(symbolName, targetFlags) { + if (!ts6.isIdentifierText(symbolName, ts6.getEmitScriptTarget(host.getCompilationSettings()))) + return false; + if (!detailsEntryId && ts6.isStringANonContextualKeyword(symbolName)) + return false; + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551)) + return false; + if (isTypeOnlyLocation && !(targetFlags & (1536 | 788968))) + return false; + var firstChar = symbolName.charCodeAt(0); + if (isRightOfOpenTag && (firstChar < 65 || firstChar > 90)) + return false; + if (detailsEntryId) + return true; + return charactersFuzzyMatchInString(symbolName, lowerCaseTokenText); + }, + function(info, symbolName, isFromAmbientModule, exportMapKey) { + var _a2; + if (detailsEntryId && !ts6.some(info, function(i) { + return detailsEntryId.source === ts6.stripQuotes(i.moduleSymbol.name); + })) { + return; + } + var firstImportableExportInfo = ts6.find(info, isImportableExportInfo); + if (!firstImportableExportInfo) { + return; + } + var result = context.tryResolve(info, symbolName, isFromAmbientModule) || {}; + if (result === "failed") + return; + var exportInfo2 = firstImportableExportInfo, moduleSpecifier; + if (result !== "skipped") { + _a2 = result.exportInfo, exportInfo2 = _a2 === void 0 ? firstImportableExportInfo : _a2, moduleSpecifier = result.moduleSpecifier; + } + var isDefaultExport = exportInfo2.exportKind === 1; + var symbol = isDefaultExport && ts6.getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol; + pushAutoImportSymbol(symbol, { + kind: moduleSpecifier ? 32 : 4, + moduleSpecifier, + symbolName, + exportMapKey, + exportName: exportInfo2.exportKind === 2 ? "export=" : exportInfo2.symbol.name, + fileName: exportInfo2.moduleFileName, + isDefaultExport, + moduleSymbol: exportInfo2.moduleSymbol, + isFromPackageJson: exportInfo2.isFromPackageJson + }); + } + ); + hasUnresolvedAutoImports = context.skippedAny(); + flags |= context.resolvedAny() ? 8 : 0; + flags |= context.resolvedBeyondLimit() ? 16 : 0; + }); + function isImportableExportInfo(info) { + var moduleFile = ts6.tryCast(info.moduleSymbol.valueDeclaration, ts6.isSourceFile); + if (!moduleFile) { + var moduleName = ts6.stripQuotes(info.moduleSymbol.name); + if (ts6.JsTyping.nodeCoreModules.has(moduleName) && ts6.startsWith(moduleName, "node:") !== ts6.shouldUseUriStyleNodeCoreModules(sourceFile, program)) { + return false; + } + return packageJsonFilter ? packageJsonFilter.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson)) : true; + } + return ts6.isImportableFile(info.isFromPackageJson ? packageJsonAutoImportProvider : program, sourceFile, moduleFile, preferences, packageJsonFilter, getModuleSpecifierResolutionHost(info.isFromPackageJson), moduleSpecifierCache); + } + } + function pushAutoImportSymbol(symbol, origin) { + var symbolId = ts6.getSymbolId(symbol); + if (symbolToSortTextMap[symbolId] === Completions2.SortText.GlobalsOrKeywords) { + return; + } + symbolToOriginInfoMap[symbols.length] = origin; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions2.SortText.LocationPriority : Completions2.SortText.AutoImportSuggestions; + symbols.push(symbol); + } + function collectObjectLiteralMethodSymbols(members, enclosingDeclaration) { + if (ts6.isInJSFile(location)) { + return; + } + members.forEach(function(member) { + if (!isObjectLiteralMethodSymbol(member)) { + return; + } + var displayName = getCompletionEntryDisplayNameForSymbol( + member, + ts6.getEmitScriptTarget(compilerOptions), + /*origin*/ + void 0, + 0, + /*jsxIdentifierExpected*/ + false + ); + if (!displayName) { + return; + } + var name = displayName.name; + var entryProps = getEntryForObjectLiteralMethodCompletion(member, name, enclosingDeclaration, program, host, compilerOptions, preferences, formatContext); + if (!entryProps) { + return; + } + var origin = __assign({ + kind: 128 + /* SymbolOriginInfoKind.ObjectLiteralMethod */ + }, entryProps); + flags |= 32; + symbolToOriginInfoMap[symbols.length] = origin; + symbols.push(member); + }); + } + function isObjectLiteralMethodSymbol(symbol) { + if (!(symbol.flags & (4 | 8192))) { + return false; + } + return true; + } + function getScopeNode(initialToken, position2, sourceFile2) { + var scope = initialToken; + while (scope && !ts6.positionBelongsToNode(scope, position2, sourceFile2)) { + scope = scope.parent; + } + return scope; + } + function isCompletionListBlocker(contextToken2) { + var start2 = ts6.timestamp(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) || isSolelyIdentifierDefinitionLocation(contextToken2) || isDotOfNumericLiteral(contextToken2) || isInJsxText(contextToken2) || ts6.isBigIntLiteral(contextToken2); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (ts6.timestamp() - start2)); + return result; + } + function isInJsxText(contextToken2) { + if (contextToken2.kind === 11) { + return true; + } + if (contextToken2.kind === 31 && contextToken2.parent) { + if (location === contextToken2.parent && (location.kind === 283 || location.kind === 282)) { + return false; + } + if (contextToken2.parent.kind === 283) { + return location.parent.kind !== 283; + } + if (contextToken2.parent.kind === 284 || contextToken2.parent.kind === 282) { + return !!contextToken2.parent.parent && contextToken2.parent.parent.kind === 281; + } + } + return false; + } + function isNewIdentifierDefinitionLocation() { + if (contextToken) { + var containingNodeKind = contextToken.parent.kind; + var tokenKind = keywordForNode(contextToken); + switch (tokenKind) { + case 27: + return containingNodeKind === 210 || containingNodeKind === 173 || containingNodeKind === 211 || containingNodeKind === 206 || containingNodeKind === 223 || containingNodeKind === 181 || containingNodeKind === 207; + case 20: + return containingNodeKind === 210 || containingNodeKind === 173 || containingNodeKind === 211 || containingNodeKind === 214 || containingNodeKind === 193; + case 22: + return containingNodeKind === 206 || containingNodeKind === 178 || containingNodeKind === 164; + case 142: + case 143: + case 100: + return true; + case 24: + return containingNodeKind === 264; + case 18: + return containingNodeKind === 260 || containingNodeKind === 207; + case 63: + return containingNodeKind === 257 || containingNodeKind === 223; + case 15: + return containingNodeKind === 225; + case 16: + return containingNodeKind === 236; + case 132: + return containingNodeKind === 171 || containingNodeKind === 300; + case 41: + return containingNodeKind === 171; + } + if (isClassMemberCompletionKeyword(tokenKind)) { + return true; + } + } + return false; + } + function isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) { + return (ts6.isRegularExpressionLiteral(contextToken2) || ts6.isStringTextContainingNode(contextToken2)) && (ts6.rangeContainsPositionExclusive(ts6.createTextRangeFromSpan(ts6.createTextSpanFromNode(contextToken2)), position) || position === contextToken2.end && (!!contextToken2.isUnterminated || ts6.isRegularExpressionLiteral(contextToken2))); + } + function tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() { + var typeLiteralNode = tryGetTypeLiteralNode(contextToken); + if (!typeLiteralNode) + return 0; + var intersectionTypeNode = ts6.isIntersectionTypeNode(typeLiteralNode.parent) ? typeLiteralNode.parent : void 0; + var containerTypeNode = intersectionTypeNode || typeLiteralNode; + var containerExpectedType = getConstraintOfTypeArgumentProperty(containerTypeNode, typeChecker); + if (!containerExpectedType) + return 0; + var containerActualType = typeChecker.getTypeFromTypeNode(containerTypeNode); + var members = getPropertiesForCompletion(containerExpectedType, typeChecker); + var existingMembers = getPropertiesForCompletion(containerActualType, typeChecker); + var existingMemberEscapedNames = new ts6.Set(); + existingMembers.forEach(function(s) { + return existingMemberEscapedNames.add(s.escapedName); + }); + symbols = ts6.concatenate(symbols, ts6.filter(members, function(s) { + return !existingMemberEscapedNames.has(s.escapedName); + })); + completionKind = 0; + isNewIdentifierLocation = true; + return 1; + } + function tryGetObjectLikeCompletionSymbols() { + var symbolsStartIndex = symbols.length; + var objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken); + if (!objectLikeContainer) + return 0; + completionKind = 0; + var typeMembers; + var existingMembers; + if (objectLikeContainer.kind === 207) { + var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); + if (instantiatedType === void 0) { + if (objectLikeContainer.flags & 33554432) { + return 2; + } + isNonContextualObjectLiteral = true; + return 0; + } + var completionsType = typeChecker.getContextualType( + objectLikeContainer, + 4 + /* ContextFlags.Completions */ + ); + var hasStringIndexType = (completionsType || instantiatedType).getStringIndexType(); + var hasNumberIndextype = (completionsType || instantiatedType).getNumberIndexType(); + isNewIdentifierLocation = !!hasStringIndexType || !!hasNumberIndextype; + typeMembers = getPropertiesForObjectExpression(instantiatedType, completionsType, objectLikeContainer, typeChecker); + existingMembers = objectLikeContainer.properties; + if (typeMembers.length === 0) { + if (!hasNumberIndextype) { + isNonContextualObjectLiteral = true; + return 0; + } + } + } else { + ts6.Debug.assert( + objectLikeContainer.kind === 203 + /* SyntaxKind.ObjectBindingPattern */ + ); + isNewIdentifierLocation = false; + var rootDeclaration = ts6.getRootDeclaration(objectLikeContainer.parent); + if (!ts6.isVariableLike(rootDeclaration)) + return ts6.Debug.fail("Root declaration is not variable-like."); + var canGetType = ts6.hasInitializer(rootDeclaration) || !!ts6.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247; + if (!canGetType && rootDeclaration.kind === 166) { + if (ts6.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } else if (rootDeclaration.parent.kind === 171 || rootDeclaration.parent.kind === 175) { + canGetType = ts6.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { + var typeForObject_1 = typeChecker.getTypeAtLocation(objectLikeContainer); + if (!typeForObject_1) + return 2; + typeMembers = typeChecker.getPropertiesOfType(typeForObject_1).filter(function(propertySymbol) { + return typeChecker.isPropertyAccessible( + objectLikeContainer, + /*isSuper*/ + false, + /*writing*/ + false, + typeForObject_1, + propertySymbol + ); + }); + existingMembers = objectLikeContainer.elements; + } + } + if (typeMembers && typeMembers.length > 0) { + var filteredMembers = filterObjectMembersList(typeMembers, ts6.Debug.checkDefined(existingMembers)); + symbols = ts6.concatenate(symbols, filteredMembers); + setSortTextToOptionalMember(); + if (objectLikeContainer.kind === 207 && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { + transformObjectLiteralMembersSortText(symbolsStartIndex); + collectObjectLiteralMethodSymbols(filteredMembers, objectLikeContainer); + } + } + return 1; + } + function tryGetImportOrExportClauseCompletionSymbols() { + if (!contextToken) + return 0; + var namedImportsOrExports = contextToken.kind === 18 || contextToken.kind === 27 ? ts6.tryCast(contextToken.parent, ts6.isNamedImportsOrExports) : ts6.isTypeKeywordTokenOrIdentifier(contextToken) ? ts6.tryCast(contextToken.parent.parent, ts6.isNamedImportsOrExports) : void 0; + if (!namedImportsOrExports) + return 0; + if (!ts6.isTypeKeywordTokenOrIdentifier(contextToken)) { + keywordFilters = 8; + } + var moduleSpecifier = (namedImportsOrExports.kind === 272 ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + if (!moduleSpecifier) { + isNewIdentifierLocation = true; + return namedImportsOrExports.kind === 272 ? 2 : 0; + } + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + isNewIdentifierLocation = true; + return 2; + } + completionKind = 3; + isNewIdentifierLocation = false; + var exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + var existing = new ts6.Set(namedImportsOrExports.elements.filter(function(n) { + return !isCurrentlyEditingNode(n); + }).map(function(n) { + return (n.propertyName || n.name).escapedText; + })); + var uniques = exports2.filter(function(e) { + return e.escapedName !== "default" && !existing.has(e.escapedName); + }); + symbols = ts6.concatenate(symbols, uniques); + if (!uniques.length) { + keywordFilters = 0; + } + return 1; + } + function tryGetLocalNamedExportCompletionSymbols() { + var _a; + var namedExports = contextToken && (contextToken.kind === 18 || contextToken.kind === 27) ? ts6.tryCast(contextToken.parent, ts6.isNamedExports) : void 0; + if (!namedExports) { + return 0; + } + var localsContainer = ts6.findAncestor(namedExports, ts6.or(ts6.isSourceFile, ts6.isModuleDeclaration)); + completionKind = 5; + isNewIdentifierLocation = false; + (_a = localsContainer.locals) === null || _a === void 0 ? void 0 : _a.forEach(function(symbol, name) { + var _a2, _b; + symbols.push(symbol); + if ((_b = (_a2 = localsContainer.symbol) === null || _a2 === void 0 ? void 0 : _a2.exports) === null || _b === void 0 ? void 0 : _b.has(name)) { + symbolToSortTextMap[ts6.getSymbolId(symbol)] = Completions2.SortText.OptionalMember; + } + }); + return 1; + } + function tryGetClassLikeCompletionSymbols() { + var decl = tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position); + if (!decl) + return 0; + completionKind = 3; + isNewIdentifierLocation = true; + keywordFilters = contextToken.kind === 41 ? 0 : ts6.isClassLike(decl) ? 2 : 3; + if (!ts6.isClassLike(decl)) + return 1; + var classElement = contextToken.kind === 26 ? contextToken.parent.parent : contextToken.parent; + var classElementModifierFlags = ts6.isClassElement(classElement) ? ts6.getEffectiveModifierFlags(classElement) : 0; + if (contextToken.kind === 79 && !isCurrentlyEditingNode(contextToken)) { + switch (contextToken.getText()) { + case "private": + classElementModifierFlags = classElementModifierFlags | 8; + break; + case "static": + classElementModifierFlags = classElementModifierFlags | 32; + break; + case "override": + classElementModifierFlags = classElementModifierFlags | 16384; + break; + } + } + if (ts6.isClassStaticBlockDeclaration(classElement)) { + classElementModifierFlags |= 32; + } + if (!(classElementModifierFlags & 8)) { + var baseTypeNodes = ts6.isClassLike(decl) && classElementModifierFlags & 16384 ? ts6.singleElementArray(ts6.getEffectiveBaseTypeNode(decl)) : ts6.getAllSuperTypeNodes(decl); + var baseSymbols = ts6.flatMap(baseTypeNodes, function(baseTypeNode) { + var type = typeChecker.getTypeAtLocation(baseTypeNode); + return classElementModifierFlags & 32 ? (type === null || type === void 0 ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type); + }); + symbols = ts6.concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags)); + } + return 1; + } + function isConstructorParameterCompletion(node2) { + return !!node2.parent && ts6.isParameter(node2.parent) && ts6.isConstructorDeclaration(node2.parent.parent) && (ts6.isParameterPropertyModifier(node2.kind) || ts6.isDeclarationName(node2)); + } + function tryGetConstructorLikeCompletionContainer(contextToken2) { + if (contextToken2) { + var parent2 = contextToken2.parent; + switch (contextToken2.kind) { + case 20: + case 27: + return ts6.isConstructorDeclaration(contextToken2.parent) ? contextToken2.parent : void 0; + default: + if (isConstructorParameterCompletion(contextToken2)) { + return parent2.parent; + } + } + } + return void 0; + } + function tryGetFunctionLikeBodyCompletionContainer(contextToken2) { + if (contextToken2) { + var prev_1; + var container = ts6.findAncestor(contextToken2.parent, function(node2) { + if (ts6.isClassLike(node2)) { + return "quit"; + } + if (ts6.isFunctionLikeDeclaration(node2) && prev_1 === node2.body) { + return true; + } + prev_1 = node2; + return false; + }); + return container && container; + } + } + function tryGetContainingJsxElement(contextToken2) { + if (contextToken2) { + var parent2 = contextToken2.parent; + switch (contextToken2.kind) { + case 31: + case 30: + case 43: + case 79: + case 208: + case 289: + case 288: + case 290: + if (parent2 && (parent2.kind === 282 || parent2.kind === 283)) { + if (contextToken2.kind === 31) { + var precedingToken = ts6.findPrecedingToken( + contextToken2.pos, + sourceFile, + /*startNode*/ + void 0 + ); + if (!parent2.typeArguments || precedingToken && precedingToken.kind === 43) + break; + } + return parent2; + } else if (parent2.kind === 288) { + return parent2.parent.parent; + } + break; + case 10: + if (parent2 && (parent2.kind === 288 || parent2.kind === 290)) { + return parent2.parent.parent; + } + break; + case 19: + if (parent2 && parent2.kind === 291 && parent2.parent && parent2.parent.kind === 288) { + return parent2.parent.parent.parent; + } + if (parent2 && parent2.kind === 290) { + return parent2.parent.parent; + } + break; + } + } + return void 0; + } + function isSolelyIdentifierDefinitionLocation(contextToken2) { + var parent2 = contextToken2.parent; + var containingNodeKind = parent2.kind; + switch (contextToken2.kind) { + case 27: + return containingNodeKind === 257 || isVariableDeclarationListButNotTypeArgument(contextToken2) || containingNodeKind === 240 || containingNodeKind === 263 || // enum a { foo, | + isFunctionLikeButNotConstructor(containingNodeKind) || containingNodeKind === 261 || // interface A= contextToken2.pos; + case 24: + return containingNodeKind === 204; + case 58: + return containingNodeKind === 205; + case 22: + return containingNodeKind === 204; + case 20: + return containingNodeKind === 295 || isFunctionLikeButNotConstructor(containingNodeKind); + case 18: + return containingNodeKind === 263; + case 29: + return containingNodeKind === 260 || // class A< | + containingNodeKind === 228 || // var C = class D< | + containingNodeKind === 261 || // interface A< | + containingNodeKind === 262 || // type List< | + ts6.isFunctionLikeKind(containingNodeKind); + case 124: + return containingNodeKind === 169 && !ts6.isClassLike(parent2.parent); + case 25: + return containingNodeKind === 166 || !!parent2.parent && parent2.parent.kind === 204; + case 123: + case 121: + case 122: + return containingNodeKind === 166 && !ts6.isConstructorDeclaration(parent2.parent); + case 128: + return containingNodeKind === 273 || containingNodeKind === 278 || containingNodeKind === 271; + case 137: + case 151: + return !isFromObjectTypeDeclaration(contextToken2); + case 79: + if (containingNodeKind === 273 && contextToken2 === parent2.name && contextToken2.text === "type") { + return false; + } + break; + case 84: + case 92: + case 118: + case 98: + case 113: + case 100: + case 119: + case 85: + case 138: + return true; + case 154: + return containingNodeKind !== 273; + case 41: + return ts6.isFunctionLike(contextToken2.parent) && !ts6.isMethodDeclaration(contextToken2.parent); + } + if (isClassMemberCompletionKeyword(keywordForNode(contextToken2)) && isFromObjectTypeDeclaration(contextToken2)) { + return false; + } + if (isConstructorParameterCompletion(contextToken2)) { + if (!ts6.isIdentifier(contextToken2) || ts6.isParameterPropertyModifier(keywordForNode(contextToken2)) || isCurrentlyEditingNode(contextToken2)) { + return false; + } + } + switch (keywordForNode(contextToken2)) { + case 126: + case 84: + case 85: + case 136: + case 92: + case 98: + case 118: + case 119: + case 121: + case 122: + case 123: + case 124: + case 113: + return true; + case 132: + return ts6.isPropertyDeclaration(contextToken2.parent); + } + var ancestorClassLike = ts6.findAncestor(contextToken2.parent, ts6.isClassLike); + if (ancestorClassLike && contextToken2 === previousToken && isPreviousPropertyDeclarationTerminated(contextToken2, position)) { + return false; + } + var ancestorPropertyDeclaraion = ts6.getAncestor( + contextToken2.parent, + 169 + /* SyntaxKind.PropertyDeclaration */ + ); + if (ancestorPropertyDeclaraion && contextToken2 !== previousToken && ts6.isClassLike(previousToken.parent.parent) && position <= previousToken.end) { + if (isPreviousPropertyDeclarationTerminated(contextToken2, previousToken.end)) { + return false; + } else if (contextToken2.kind !== 63 && (ts6.isInitializedProperty(ancestorPropertyDeclaraion) || ts6.hasType(ancestorPropertyDeclaraion))) { + return true; + } + } + return ts6.isDeclarationName(contextToken2) && !ts6.isShorthandPropertyAssignment(contextToken2.parent) && !ts6.isJsxAttribute(contextToken2.parent) && !(ts6.isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end)); + } + function isPreviousPropertyDeclarationTerminated(contextToken2, position2) { + return contextToken2.kind !== 63 && (contextToken2.kind === 26 || !ts6.positionsAreOnSameLine(contextToken2.end, position2, sourceFile)); + } + function isFunctionLikeButNotConstructor(kind) { + return ts6.isFunctionLikeKind(kind) && kind !== 173; + } + function isDotOfNumericLiteral(contextToken2) { + if (contextToken2.kind === 8) { + var text = contextToken2.getFullText(); + return text.charAt(text.length - 1) === "."; + } + return false; + } + function isVariableDeclarationListButNotTypeArgument(node2) { + return node2.parent.kind === 258 && !ts6.isPossiblyTypeArgumentPosition(node2, sourceFile, typeChecker); + } + function filterObjectMembersList(contextualMemberSymbols, existingMembers) { + if (existingMembers.length === 0) { + return contextualMemberSymbols; + } + var membersDeclaredBySpreadAssignment = new ts6.Set(); + var existingMemberNames = new ts6.Set(); + for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { + var m = existingMembers_1[_i]; + if (m.kind !== 299 && m.kind !== 300 && m.kind !== 205 && m.kind !== 171 && m.kind !== 174 && m.kind !== 175 && m.kind !== 301) { + continue; + } + if (isCurrentlyEditingNode(m)) { + continue; + } + var existingName = void 0; + if (ts6.isSpreadAssignment(m)) { + setMembersDeclaredBySpreadAssignment(m, membersDeclaredBySpreadAssignment); + } else if (ts6.isBindingElement(m) && m.propertyName) { + if (m.propertyName.kind === 79) { + existingName = m.propertyName.escapedText; + } + } else { + var name = ts6.getNameOfDeclaration(m); + existingName = name && ts6.isPropertyNameLiteral(name) ? ts6.getEscapedTextOfIdentifierOrLiteral(name) : void 0; + } + if (existingName !== void 0) { + existingMemberNames.add(existingName); + } + } + var filteredSymbols = contextualMemberSymbols.filter(function(m2) { + return !existingMemberNames.has(m2.escapedName); + }); + setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment, filteredSymbols); + return filteredSymbols; + } + function setMembersDeclaredBySpreadAssignment(declaration, membersDeclaredBySpreadAssignment) { + var expression = declaration.expression; + var symbol = typeChecker.getSymbolAtLocation(expression); + var type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, expression); + var properties = type && type.properties; + if (properties) { + properties.forEach(function(property) { + membersDeclaredBySpreadAssignment.add(property.name); + }); + } + } + function setSortTextToOptionalMember() { + symbols.forEach(function(m) { + var _a; + if (m.flags & 16777216) { + var symbolId = ts6.getSymbolId(m); + symbolToSortTextMap[symbolId] = (_a = symbolToSortTextMap[symbolId]) !== null && _a !== void 0 ? _a : Completions2.SortText.OptionalMember; + } + }); + } + function setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment, contextualMemberSymbols) { + if (membersDeclaredBySpreadAssignment.size === 0) { + return; + } + for (var _i = 0, contextualMemberSymbols_1 = contextualMemberSymbols; _i < contextualMemberSymbols_1.length; _i++) { + var contextualMemberSymbol = contextualMemberSymbols_1[_i]; + if (membersDeclaredBySpreadAssignment.has(contextualMemberSymbol.name)) { + symbolToSortTextMap[ts6.getSymbolId(contextualMemberSymbol)] = Completions2.SortText.MemberDeclaredBySpreadAssignment; + } + } + } + function transformObjectLiteralMembersSortText(start2) { + var _a; + for (var i = start2; i < symbols.length; i++) { + var symbol = symbols[i]; + var symbolId = ts6.getSymbolId(symbol); + var origin = symbolToOriginInfoMap === null || symbolToOriginInfoMap === void 0 ? void 0 : symbolToOriginInfoMap[i]; + var target = ts6.getEmitScriptTarget(compilerOptions); + var displayName = getCompletionEntryDisplayNameForSymbol( + symbol, + target, + origin, + 0, + /*jsxIdentifierExpected*/ + false + ); + if (displayName) { + var originalSortText = (_a = symbolToSortTextMap[symbolId]) !== null && _a !== void 0 ? _a : Completions2.SortText.LocationPriority; + var name = displayName.name; + symbolToSortTextMap[symbolId] = Completions2.SortText.ObjectLiteralProperty(originalSortText, name); + } + } + } + function filterClassMembersList(baseSymbols, existingMembers, currentClassElementModifierFlags) { + var existingMemberNames = new ts6.Set(); + for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { + var m = existingMembers_2[_i]; + if (m.kind !== 169 && m.kind !== 171 && m.kind !== 174 && m.kind !== 175) { + continue; + } + if (isCurrentlyEditingNode(m)) { + continue; + } + if (ts6.hasEffectiveModifier( + m, + 8 + /* ModifierFlags.Private */ + )) { + continue; + } + if (ts6.isStatic(m) !== !!(currentClassElementModifierFlags & 32)) { + continue; + } + var existingName = ts6.getPropertyNameForPropertyNameNode(m.name); + if (existingName) { + existingMemberNames.add(existingName); + } + } + return baseSymbols.filter(function(propertySymbol) { + return !existingMemberNames.has(propertySymbol.escapedName) && !!propertySymbol.declarations && !(ts6.getDeclarationModifierFlagsFromSymbol(propertySymbol) & 8) && !(propertySymbol.valueDeclaration && ts6.isPrivateIdentifierClassElementDeclaration(propertySymbol.valueDeclaration)); + }); + } + function filterJsxAttributes(symbols2, attributes) { + var seenNames = new ts6.Set(); + var membersDeclaredBySpreadAssignment = new ts6.Set(); + for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { + var attr = attributes_1[_i]; + if (isCurrentlyEditingNode(attr)) { + continue; + } + if (attr.kind === 288) { + seenNames.add(attr.name.escapedText); + } else if (ts6.isJsxSpreadAttribute(attr)) { + setMembersDeclaredBySpreadAssignment(attr, membersDeclaredBySpreadAssignment); + } + } + var filteredSymbols = symbols2.filter(function(a) { + return !seenNames.has(a.escapedName); + }); + setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment, filteredSymbols); + return filteredSymbols; + } + function isCurrentlyEditingNode(node2) { + return node2.getStart(sourceFile) <= position && position <= node2.getEnd(); + } + } + function tryGetObjectLikeCompletionContainer(contextToken) { + if (contextToken) { + var parent = contextToken.parent; + switch (contextToken.kind) { + case 18: + case 27: + if (ts6.isObjectLiteralExpression(parent) || ts6.isObjectBindingPattern(parent)) { + return parent; + } + break; + case 41: + return ts6.isMethodDeclaration(parent) ? ts6.tryCast(parent.parent, ts6.isObjectLiteralExpression) : void 0; + case 79: + return contextToken.text === "async" && ts6.isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0; + } + } + return void 0; + } + function getRelevantTokens(position, sourceFile) { + var previousToken = ts6.findPrecedingToken(position, sourceFile); + if (previousToken && position <= previousToken.end && (ts6.isMemberName(previousToken) || ts6.isKeyword(previousToken.kind))) { + var contextToken = ts6.findPrecedingToken( + previousToken.getFullStart(), + sourceFile, + /*startNode*/ + void 0 + ); + return { contextToken, previousToken }; + } + return { contextToken: previousToken, previousToken }; + } + function getAutoImportSymbolFromCompletionEntryData(name, data, program, host) { + var containingProgram = data.isPackageJsonImport ? host.getPackageJsonAutoImportProvider() : program; + var checker = containingProgram.getTypeChecker(); + var moduleSymbol = data.ambientModuleName ? checker.tryFindAmbientModule(data.ambientModuleName) : data.fileName ? checker.getMergedSymbol(ts6.Debug.checkDefined(containingProgram.getSourceFile(data.fileName)).symbol) : void 0; + if (!moduleSymbol) + return void 0; + var symbol = data.exportName === "export=" ? checker.resolveExternalModuleSymbol(moduleSymbol) : checker.tryGetMemberInModuleExportsAndProperties(data.exportName, moduleSymbol); + if (!symbol) + return void 0; + var isDefaultExport = data.exportName === "default"; + symbol = isDefaultExport && ts6.getLocalSymbolForExportDefault(symbol) || symbol; + return { symbol, origin: completionEntryDataToSymbolOriginInfo(data, name, moduleSymbol) }; + } + function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, jsxIdentifierExpected) { + var name = originIncludesSymbolName(origin) ? origin.symbolName : symbol.name; + if (name === void 0 || symbol.flags & 1536 && ts6.isSingleOrDoubleQuote(name.charCodeAt(0)) || ts6.isKnownSymbol(symbol)) { + return void 0; + } + var validNameResult = { name, needsConvertPropertyAccess: false }; + if (ts6.isIdentifierText( + name, + target, + jsxIdentifierExpected ? 1 : 0 + /* LanguageVariant.Standard */ + ) || symbol.valueDeclaration && ts6.isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) { + return validNameResult; + } + switch (kind) { + case 3: + return void 0; + case 0: + return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; + case 2: + case 1: + return name.charCodeAt(0) === 32 ? void 0 : { name, needsConvertPropertyAccess: true }; + case 5: + case 4: + return validNameResult; + default: + ts6.Debug.assertNever(kind); + } + } + var _keywordCompletions = []; + var allKeywordsCompletions = ts6.memoize(function() { + var res = []; + for (var i = 81; i <= 162; i++) { + res.push({ + name: ts6.tokenToString(i), + kind: "keyword", + kindModifiers: "", + sortText: Completions2.SortText.GlobalsOrKeywords + }); + } + return res; + }); + function getKeywordCompletions(keywordFilter, filterOutTsOnlyKeywords) { + if (!filterOutTsOnlyKeywords) + return getTypescriptKeywordCompletions(keywordFilter); + var index = keywordFilter + 8 + 1; + return _keywordCompletions[index] || (_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter).filter(function(entry) { + return !isTypeScriptOnlyKeyword(ts6.stringToToken(entry.name)); + })); + } + function getTypescriptKeywordCompletions(keywordFilter) { + return _keywordCompletions[keywordFilter] || (_keywordCompletions[keywordFilter] = allKeywordsCompletions().filter(function(entry) { + var kind = ts6.stringToToken(entry.name); + switch (keywordFilter) { + case 0: + return false; + case 1: + return isFunctionLikeBodyKeyword(kind) || kind === 136 || kind === 142 || kind === 154 || kind === 143 || kind === 126 || ts6.isTypeKeyword(kind) && kind !== 155; + case 5: + return isFunctionLikeBodyKeyword(kind); + case 2: + return isClassMemberCompletionKeyword(kind); + case 3: + return isInterfaceOrTypeLiteralCompletionKeyword(kind); + case 4: + return ts6.isParameterPropertyModifier(kind); + case 6: + return ts6.isTypeKeyword(kind) || kind === 85; + case 7: + return ts6.isTypeKeyword(kind); + case 8: + return kind === 154; + default: + return ts6.Debug.assertNever(keywordFilter); + } + })); + } + function isTypeScriptOnlyKeyword(kind) { + switch (kind) { + case 126: + case 131: + case 160: + case 134: + case 136: + case 92: + case 159: + case 117: + case 138: + case 118: + case 140: + case 141: + case 142: + case 143: + case 144: + case 148: + case 149: + case 161: + case 121: + case 122: + case 123: + case 146: + case 152: + case 153: + case 154: + case 156: + case 157: + return true; + default: + return false; + } + } + function isInterfaceOrTypeLiteralCompletionKeyword(kind) { + return kind === 146; + } + function isClassMemberCompletionKeyword(kind) { + switch (kind) { + case 126: + case 127: + case 135: + case 137: + case 151: + case 132: + case 136: + case 161: + return true; + default: + return ts6.isClassMemberModifier(kind); + } + } + function isFunctionLikeBodyKeyword(kind) { + return kind === 132 || kind === 133 || kind === 128 || kind === 150 || kind === 154 || !ts6.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); + } + function keywordForNode(node) { + return ts6.isIdentifier(node) ? node.originalKeywordKind || 0 : node.kind; + } + function getContextualKeywords(contextToken, position) { + var entries = []; + if (contextToken) { + var file = contextToken.getSourceFile(); + var parent = contextToken.parent; + var tokenLine = file.getLineAndCharacterOfPosition(contextToken.end).line; + var currentLine = file.getLineAndCharacterOfPosition(position).line; + if ((ts6.isImportDeclaration(parent) || ts6.isExportDeclaration(parent) && parent.moduleSpecifier) && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { + entries.push({ + name: ts6.tokenToString( + 130 + /* SyntaxKind.AssertKeyword */ + ), + kind: "keyword", + kindModifiers: "", + sortText: Completions2.SortText.GlobalsOrKeywords + }); + } + } + return entries; + } + function getJsDocTagAtPosition(node, position) { + return ts6.findAncestor(node, function(n) { + return ts6.isJSDocTag(n) && ts6.rangeContainsPosition(n, position) ? true : ts6.isJSDoc(n) ? "quit" : false; + }); + } + function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) { + var hasCompletionsType = completionsType && completionsType !== contextualType; + var type = hasCompletionsType && !(completionsType.flags & 3) ? checker.getUnionType([contextualType, completionsType]) : contextualType; + var properties = getApparentProperties(type, obj, checker); + return type.isClass() && containsNonPublicProperties(properties) ? [] : hasCompletionsType ? ts6.filter(properties, hasDeclarationOtherThanSelf) : properties; + function hasDeclarationOtherThanSelf(member) { + if (!ts6.length(member.declarations)) + return true; + return ts6.some(member.declarations, function(decl) { + return decl.parent !== obj; + }); + } + } + Completions2.getPropertiesForObjectExpression = getPropertiesForObjectExpression; + function getApparentProperties(type, node, checker) { + if (!type.isUnion()) + return type.getApparentProperties(); + return checker.getAllPossiblePropertiesOfTypes(ts6.filter(type.types, function(memberType) { + return !(memberType.flags & 131068 || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || ts6.typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())); + })); + } + function containsNonPublicProperties(props) { + return ts6.some(props, function(p) { + return !!(ts6.getDeclarationModifierFlagsFromSymbol(p) & 24); + }); + } + function getPropertiesForCompletion(type, checker) { + return type.isUnion() ? ts6.Debug.checkEachDefined(checker.getAllPossiblePropertiesOfTypes(type.types), "getAllPossiblePropertiesOfTypes() should all be defined") : ts6.Debug.checkEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); + } + function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { + switch (location.kind) { + case 351: + return ts6.tryCast(location.parent, ts6.isObjectTypeDeclaration); + case 1: + var cls = ts6.tryCast(ts6.lastOrUndefined(ts6.cast(location.parent, ts6.isSourceFile).statements), ts6.isObjectTypeDeclaration); + if (cls && !ts6.findChildOfKind(cls, 19, sourceFile)) { + return cls; + } + break; + case 79: { + var originalKeywordKind = location.originalKeywordKind; + if (originalKeywordKind && ts6.isKeyword(originalKeywordKind)) { + return void 0; + } + if (ts6.isPropertyDeclaration(location.parent) && location.parent.initializer === location) { + return void 0; + } + if (isFromObjectTypeDeclaration(location)) { + return ts6.findAncestor(location, ts6.isObjectTypeDeclaration); + } + } + } + if (!contextToken) + return void 0; + if (location.kind === 135 || ts6.isIdentifier(contextToken) && ts6.isPropertyDeclaration(contextToken.parent) && ts6.isClassLike(location)) { + return ts6.findAncestor(contextToken, ts6.isClassLike); + } + switch (contextToken.kind) { + case 63: + return void 0; + case 26: + case 19: + return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : ts6.tryCast(location, ts6.isObjectTypeDeclaration); + case 18: + case 27: + return ts6.tryCast(contextToken.parent, ts6.isObjectTypeDeclaration); + default: + if (!isFromObjectTypeDeclaration(contextToken)) { + if (ts6.getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== ts6.getLineAndCharacterOfPosition(sourceFile, position).line && ts6.isObjectTypeDeclaration(location)) { + return location; + } + return void 0; + } + var isValidKeyword = ts6.isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword; + return isValidKeyword(contextToken.kind) || contextToken.kind === 41 || ts6.isIdentifier(contextToken) && isValidKeyword(ts6.stringToToken(contextToken.text)) ? contextToken.parent.parent : void 0; + } + } + function tryGetTypeLiteralNode(node) { + if (!node) + return void 0; + var parent = node.parent; + switch (node.kind) { + case 18: + if (ts6.isTypeLiteralNode(parent)) { + return parent; + } + break; + case 26: + case 27: + case 79: + if (parent.kind === 168 && ts6.isTypeLiteralNode(parent.parent)) { + return parent.parent; + } + break; + } + return void 0; + } + function getConstraintOfTypeArgumentProperty(node, checker) { + if (!node) + return void 0; + if (ts6.isTypeNode(node) && ts6.isTypeReferenceType(node.parent)) { + return checker.getTypeArgumentConstraint(node); + } + var t = getConstraintOfTypeArgumentProperty(node.parent, checker); + if (!t) + return void 0; + switch (node.kind) { + case 168: + return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); + case 190: + case 184: + case 189: + return t; + } + } + function isFromObjectTypeDeclaration(node) { + return node.parent && ts6.isClassOrTypeElement(node.parent) && ts6.isObjectTypeDeclaration(node.parent.parent); + } + function isValidTrigger(sourceFile, triggerCharacter, contextToken, position) { + switch (triggerCharacter) { + case ".": + case "@": + return true; + case '"': + case "'": + case "`": + return !!contextToken && ts6.isStringLiteralOrTemplate(contextToken) && position === contextToken.getStart(sourceFile) + 1; + case "#": + return !!contextToken && ts6.isPrivateIdentifier(contextToken) && !!ts6.getContainingClass(contextToken); + case "<": + return !!contextToken && contextToken.kind === 29 && (!ts6.isBinaryExpression(contextToken.parent) || binaryExpressionMayBeOpenTag(contextToken.parent)); + case "/": + return !!contextToken && (ts6.isStringLiteralLike(contextToken) ? !!ts6.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 && ts6.isJsxClosingElement(contextToken.parent)); + case " ": + return !!contextToken && ts6.isImportKeyword(contextToken) && contextToken.parent.kind === 308; + default: + return ts6.Debug.assertNever(triggerCharacter); + } + } + function binaryExpressionMayBeOpenTag(_a) { + var left = _a.left; + return ts6.nodeIsMissing(left); + } + function isProbablyGlobalType(type, sourceFile, checker) { + var selfSymbol = checker.resolveName( + "self", + /*location*/ + void 0, + 111551, + /*excludeGlobals*/ + false + ); + if (selfSymbol && checker.getTypeOfSymbolAtLocation(selfSymbol, sourceFile) === type) { + return true; + } + var globalSymbol = checker.resolveName( + "global", + /*location*/ + void 0, + 111551, + /*excludeGlobals*/ + false + ); + if (globalSymbol && checker.getTypeOfSymbolAtLocation(globalSymbol, sourceFile) === type) { + return true; + } + var globalThisSymbol = checker.resolveName( + "globalThis", + /*location*/ + void 0, + 111551, + /*excludeGlobals*/ + false + ); + if (globalThisSymbol && checker.getTypeOfSymbolAtLocation(globalThisSymbol, sourceFile) === type) { + return true; + } + return false; + } + function isStaticProperty(symbol) { + return !!(symbol.valueDeclaration && ts6.getEffectiveModifierFlags(symbol.valueDeclaration) & 32 && ts6.isClassLike(symbol.valueDeclaration.parent)); + } + function tryGetObjectLiteralContextualType(node, typeChecker) { + var type = typeChecker.getContextualType(node); + if (type) { + return type; + } + var parent = ts6.walkUpParenthesizedExpressions(node.parent); + if (ts6.isBinaryExpression(parent) && parent.operatorToken.kind === 63 && node === parent.left) { + return typeChecker.getTypeAtLocation(parent); + } + if (ts6.isExpression(parent)) { + return typeChecker.getContextualType(parent); + } + return void 0; + } + function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; + var keywordCompletion; + var isKeywordOnlyCompletion = false; + var candidate = getCandidate(); + return { + isKeywordOnlyCompletion, + keywordCompletion, + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154), + isTopLevelTypeOnly: !!((_b = (_a = ts6.tryCast(candidate, ts6.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts6.tryCast(candidate, ts6.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate) + }; + function getCandidate() { + var parent = contextToken.parent; + if (ts6.isImportEqualsDeclaration(parent)) { + keywordCompletion = contextToken.kind === 154 ? void 0 : 154; + return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : void 0; + } + if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { + return parent; + } + if (ts6.isNamedImports(parent) || ts6.isNamespaceImport(parent)) { + if (!parent.parent.isTypeOnly && (contextToken.kind === 18 || contextToken.kind === 100 || contextToken.kind === 27)) { + keywordCompletion = 154; + } + if (canCompleteFromNamedBindings(parent)) { + if (contextToken.kind === 19 || contextToken.kind === 79) { + isKeywordOnlyCompletion = true; + keywordCompletion = 158; + } else { + return parent.parent.parent; + } + } + return void 0; + } + if (ts6.isImportKeyword(contextToken) && ts6.isSourceFile(parent)) { + keywordCompletion = 154; + return contextToken; + } + if (ts6.isImportKeyword(contextToken) && ts6.isImportDeclaration(parent)) { + keywordCompletion = 154; + return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : void 0; + } + return void 0; + } + } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return void 0; + var top = (_a = ts6.findAncestor(node, ts6.or(ts6.isImportDeclaration, ts6.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts6.rangeIsOnSingleLine(top, sourceFile)) { + return ts6.createTextSpanFromNode(top, sourceFile); + } + ts6.Debug.assert( + top.kind !== 100 && top.kind !== 273 + /* SyntaxKind.ImportSpecifier */ + ); + var potentialSplitPoint = top.kind === 269 ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos + }; + if (ts6.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts6.createTextSpanFromRange(withoutModuleSpecifier); + } + } + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts6.find((_a = ts6.tryCast(namedBindings, ts6.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function(e) { + var _a2; + return !e.propertyName && ts6.isStringANonContextualKeyword(e.name.text) && ((_a2 = ts6.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a2 === void 0 ? void 0 : _a2.kind) !== 27; + }); + } + function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { + return ts6.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts6.isTypeKeywordTokenOrIdentifier(contextToken)); + } + function canCompleteFromNamedBindings(namedBindings) { + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts6.isNamedImports(namedBindings)) { + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; + } + function isModuleSpecifierMissingOrEmpty(specifier) { + var _a; + if (ts6.nodeIsMissing(specifier)) + return true; + return !((_a = ts6.tryCast(ts6.isExternalModuleReference(specifier) ? specifier.expression : specifier, ts6.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text); + } + function getVariableDeclaration(property) { + var variableDeclaration = ts6.findAncestor(property, function(node) { + return ts6.isFunctionBlock(node) || isArrowFunctionBody(node) || ts6.isBindingPattern(node) ? "quit" : ts6.isVariableDeclaration(node); + }); + return variableDeclaration; + } + function isArrowFunctionBody(node) { + return node.parent && ts6.isArrowFunction(node.parent) && node.parent.body === node; + } + function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { + if (seenModules === void 0) { + seenModules = new ts6.Map(); + } + return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(ts6.skipAlias(symbol.exportSymbol || symbol, checker)); + function nonAliasCanBeReferencedAtTypeLocation(symbol2) { + return !!(symbol2.flags & 788968) || checker.isUnknownSymbol(symbol2) || !!(symbol2.flags & 1536) && ts6.addToSeen(seenModules, ts6.getSymbolId(symbol2)) && checker.getExportsOfModule(symbol2).some(function(e) { + return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); + }); + } + } + function isDeprecated(symbol, checker) { + var declarations = ts6.skipAlias(symbol, checker).declarations; + return !!ts6.length(declarations) && ts6.every(declarations, ts6.isDeprecatedDeclaration); + } + function charactersFuzzyMatchInString(identifierString, lowercaseCharacters) { + if (lowercaseCharacters.length === 0) { + return true; + } + var matchedFirstCharacter = false; + var prevChar; + var characterIndex = 0; + var len = identifierString.length; + for (var strIndex = 0; strIndex < len; strIndex++) { + var strChar = identifierString.charCodeAt(strIndex); + var testChar = lowercaseCharacters.charCodeAt(characterIndex); + if (strChar === testChar || strChar === toUpperCharCode(testChar)) { + matchedFirstCharacter || (matchedFirstCharacter = prevChar === void 0 || // Beginning of word + 97 <= prevChar && prevChar <= 122 && 65 <= strChar && strChar <= 90 || // camelCase transition + prevChar === 95 && strChar !== 95); + if (matchedFirstCharacter) { + characterIndex++; + } + if (characterIndex === lowercaseCharacters.length) { + return true; + } + } + prevChar = strChar; + } + return false; + } + function toUpperCharCode(charCode) { + if (97 <= charCode && charCode <= 122) { + return charCode - 32; + } + return charCode; + } + })(Completions = ts6.Completions || (ts6.Completions = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var DocumentHighlights; + (function(DocumentHighlights2) { + function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) { + var node = ts6.getTouchingPropertyName(sourceFile, position); + if (node.parent && (ts6.isJsxOpeningElement(node.parent) && node.parent.tagName === node || ts6.isJsxClosingElement(node.parent))) { + var _a = node.parent.parent, openingElement = _a.openingElement, closingElement = _a.closingElement; + var highlightSpans = [openingElement, closingElement].map(function(_a2) { + var tagName = _a2.tagName; + return getHighlightSpanForNode(tagName, sourceFile); + }); + return [{ fileName: sourceFile.fileName, highlightSpans }]; + } + return getSemanticDocumentHighlights(position, node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile); + } + DocumentHighlights2.getDocumentHighlights = getDocumentHighlights; + function getHighlightSpanForNode(node, sourceFile) { + return { + fileName: sourceFile.fileName, + textSpan: ts6.createTextSpanFromNode(node, sourceFile), + kind: "none" + /* HighlightSpanKind.none */ + }; + } + function getSemanticDocumentHighlights(position, node, program, cancellationToken, sourceFilesToSearch) { + var sourceFilesSet = new ts6.Set(sourceFilesToSearch.map(function(f) { + return f.fileName; + })); + var referenceEntries = ts6.FindAllReferences.getReferenceEntriesForNode( + position, + node, + program, + sourceFilesToSearch, + cancellationToken, + /*options*/ + void 0, + sourceFilesSet + ); + if (!referenceEntries) + return void 0; + var map = ts6.arrayToMultiMap(referenceEntries.map(ts6.FindAllReferences.toHighlightSpan), function(e) { + return e.fileName; + }, function(e) { + return e.span; + }); + var getCanonicalFileName = ts6.createGetCanonicalFileName(program.useCaseSensitiveFileNames()); + return ts6.mapDefined(ts6.arrayFrom(map.entries()), function(_a) { + var fileName = _a[0], highlightSpans = _a[1]; + if (!sourceFilesSet.has(fileName)) { + if (!program.redirectTargetsMap.has(ts6.toPath(fileName, program.getCurrentDirectory(), getCanonicalFileName))) { + return void 0; + } + var redirectTarget_1 = program.getSourceFile(fileName); + var redirect = ts6.find(sourceFilesToSearch, function(f) { + return !!f.redirectInfo && f.redirectInfo.redirectTarget === redirectTarget_1; + }); + fileName = redirect.fileName; + ts6.Debug.assert(sourceFilesSet.has(fileName)); + } + return { fileName, highlightSpans }; + }); + } + function getSyntacticDocumentHighlights(node, sourceFile) { + var highlightSpans = getHighlightSpans(node, sourceFile); + return highlightSpans && [{ fileName: sourceFile.fileName, highlightSpans }]; + } + function getHighlightSpans(node, sourceFile) { + switch (node.kind) { + case 99: + case 91: + return ts6.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : void 0; + case 105: + return useParent(node.parent, ts6.isReturnStatement, getReturnOccurrences); + case 109: + return useParent(node.parent, ts6.isThrowStatement, getThrowOccurrences); + case 111: + case 83: + case 96: + var tryStatement = node.kind === 83 ? node.parent.parent : node.parent; + return useParent(tryStatement, ts6.isTryStatement, getTryCatchFinallyOccurrences); + case 107: + return useParent(node.parent, ts6.isSwitchStatement, getSwitchCaseDefaultOccurrences); + case 82: + case 88: { + if (ts6.isDefaultClause(node.parent) || ts6.isCaseClause(node.parent)) { + return useParent(node.parent.parent.parent, ts6.isSwitchStatement, getSwitchCaseDefaultOccurrences); + } + return void 0; + } + case 81: + case 86: + return useParent(node.parent, ts6.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences); + case 97: + case 115: + case 90: + return useParent(node.parent, function(n) { + return ts6.isIterationStatement( + n, + /*lookInLabeledStatements*/ + true + ); + }, getLoopBreakContinueOccurrences); + case 135: + return getFromAllDeclarations(ts6.isConstructorDeclaration, [ + 135 + /* SyntaxKind.ConstructorKeyword */ + ]); + case 137: + case 151: + return getFromAllDeclarations(ts6.isAccessor, [ + 137, + 151 + /* SyntaxKind.SetKeyword */ + ]); + case 133: + return useParent(node.parent, ts6.isAwaitExpression, getAsyncAndAwaitOccurrences); + case 132: + return highlightSpans(getAsyncAndAwaitOccurrences(node)); + case 125: + return highlightSpans(getYieldOccurrences(node)); + case 101: + return void 0; + default: + return ts6.isModifierKind(node.kind) && (ts6.isDeclaration(node.parent) || ts6.isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0; + } + function getFromAllDeclarations(nodeTest, keywords) { + return useParent(node.parent, nodeTest, function(decl) { + return ts6.mapDefined(decl.symbol.declarations, function(d) { + return nodeTest(d) ? ts6.find(d.getChildren(sourceFile), function(c) { + return ts6.contains(keywords, c.kind); + }) : void 0; + }); + }); + } + function useParent(node2, nodeTest, getNodes) { + return nodeTest(node2) ? highlightSpans(getNodes(node2, sourceFile)) : void 0; + } + function highlightSpans(nodes) { + return nodes && nodes.map(function(node2) { + return getHighlightSpanForNode(node2, sourceFile); + }); + } + } + function aggregateOwnedThrowStatements(node) { + if (ts6.isThrowStatement(node)) { + return [node]; + } else if (ts6.isTryStatement(node)) { + return ts6.concatenate(node.catchClause ? aggregateOwnedThrowStatements(node.catchClause) : node.tryBlock && aggregateOwnedThrowStatements(node.tryBlock), node.finallyBlock && aggregateOwnedThrowStatements(node.finallyBlock)); + } + return ts6.isFunctionLike(node) ? void 0 : flatMapChildren(node, aggregateOwnedThrowStatements); + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent = child.parent; + if (ts6.isFunctionBlock(parent) || parent.kind === 308) { + return parent; + } + if (ts6.isTryStatement(parent) && parent.tryBlock === child && parent.catchClause) { + return child; + } + child = parent; + } + return void 0; + } + function aggregateAllBreakAndContinueStatements(node) { + return ts6.isBreakOrContinueStatement(node) ? [node] : ts6.isFunctionLike(node) ? void 0 : flatMapChildren(node, aggregateAllBreakAndContinueStatements); + } + function flatMapChildren(node, cb) { + var result = []; + node.forEachChild(function(child) { + var value = cb(child); + if (value !== void 0) { + result.push.apply(result, ts6.toArray(value)); + } + }); + return result; + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return !!actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + return ts6.findAncestor(statement, function(node) { + switch (node.kind) { + case 252: + if (statement.kind === 248) { + return false; + } + case 245: + case 246: + case 247: + case 244: + case 243: + return !statement.label || isLabeledBy(node, statement.label.escapedText); + default: + return ts6.isFunctionLike(node) && "quit"; + } + }); + } + function getModifierOccurrences(modifier, declaration) { + return ts6.mapDefined(getNodesToSearchForModifier(declaration, ts6.modifierToFlag(modifier)), function(node) { + return ts6.findModifier(node, modifier); + }); + } + function getNodesToSearchForModifier(declaration, modifierFlag) { + var container = declaration.parent; + switch (container.kind) { + case 265: + case 308: + case 238: + case 292: + case 293: + if (modifierFlag & 256 && ts6.isClassDeclaration(declaration)) { + return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); + } else { + return container.statements; + } + case 173: + case 171: + case 259: + return __spreadArray(__spreadArray([], container.parameters, true), ts6.isClassLike(container.parent) ? container.parent.members : [], true); + case 260: + case 228: + case 261: + case 184: + var nodes = container.members; + if (modifierFlag & (28 | 64)) { + var constructor = ts6.find(container.members, ts6.isConstructorDeclaration); + if (constructor) { + return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); + } + } else if (modifierFlag & 256) { + return __spreadArray(__spreadArray([], nodes, true), [container], false); + } + return nodes; + case 207: + return void 0; + default: + ts6.Debug.assertNever(container, "Invalid container kind."); + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts6.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf( + keywords, + loopNode.getFirstToken(), + 97, + 115, + 90 + /* SyntaxKind.DoKeyword */ + )) { + if (loopNode.kind === 243) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf( + keywords, + loopTokens[i], + 115 + /* SyntaxKind.WhileKeyword */ + )) { + break; + } + } + } + } + ts6.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function(statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf( + keywords, + statement.getFirstToken(), + 81, + 86 + /* SyntaxKind.ContinueKeyword */ + ); + } + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 245: + case 246: + case 247: + case 243: + case 244: + return getLoopBreakContinueOccurrences(owner); + case 252: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return void 0; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf( + keywords, + switchStatement.getFirstToken(), + 107 + /* SyntaxKind.SwitchKeyword */ + ); + ts6.forEach(switchStatement.caseBlock.clauses, function(clause) { + pushKeywordIf( + keywords, + clause.getFirstToken(), + 82, + 88 + /* SyntaxKind.DefaultKeyword */ + ); + ts6.forEach(aggregateAllBreakAndContinueStatements(clause), function(statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf( + keywords, + statement.getFirstToken(), + 81 + /* SyntaxKind.BreakKeyword */ + ); + } + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf( + keywords, + tryStatement.getFirstToken(), + 111 + /* SyntaxKind.TryKeyword */ + ); + if (tryStatement.catchClause) { + pushKeywordIf( + keywords, + tryStatement.catchClause.getFirstToken(), + 83 + /* SyntaxKind.CatchKeyword */ + ); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts6.findChildOfKind(tryStatement, 96, sourceFile); + pushKeywordIf( + keywords, + finallyKeyword, + 96 + /* SyntaxKind.FinallyKeyword */ + ); + } + return keywords; + } + function getThrowOccurrences(throwStatement, sourceFile) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return void 0; + } + var keywords = []; + ts6.forEach(aggregateOwnedThrowStatements(owner), function(throwStatement2) { + keywords.push(ts6.findChildOfKind(throwStatement2, 109, sourceFile)); + }); + if (ts6.isFunctionBlock(owner)) { + ts6.forEachReturnStatement(owner, function(returnStatement) { + keywords.push(ts6.findChildOfKind(returnStatement, 105, sourceFile)); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement, sourceFile) { + var func = ts6.getContainingFunction(returnStatement); + if (!func) { + return void 0; + } + var keywords = []; + ts6.forEachReturnStatement(ts6.cast(func.body, ts6.isBlock), function(returnStatement2) { + keywords.push(ts6.findChildOfKind(returnStatement2, 105, sourceFile)); + }); + ts6.forEach(aggregateOwnedThrowStatements(func.body), function(throwStatement) { + keywords.push(ts6.findChildOfKind(throwStatement, 109, sourceFile)); + }); + return keywords; + } + function getAsyncAndAwaitOccurrences(node) { + var func = ts6.getContainingFunction(node); + if (!func) { + return void 0; + } + var keywords = []; + if (func.modifiers) { + func.modifiers.forEach(function(modifier) { + pushKeywordIf( + keywords, + modifier, + 132 + /* SyntaxKind.AsyncKeyword */ + ); + }); + } + ts6.forEachChild(func, function(child) { + traverseWithoutCrossingFunction(child, function(node2) { + if (ts6.isAwaitExpression(node2)) { + pushKeywordIf( + keywords, + node2.getFirstToken(), + 133 + /* SyntaxKind.AwaitKeyword */ + ); + } + }); + }); + return keywords; + } + function getYieldOccurrences(node) { + var func = ts6.getContainingFunction(node); + if (!func) { + return void 0; + } + var keywords = []; + ts6.forEachChild(func, function(child) { + traverseWithoutCrossingFunction(child, function(node2) { + if (ts6.isYieldExpression(node2)) { + pushKeywordIf( + keywords, + node2.getFirstToken(), + 125 + /* SyntaxKind.YieldKeyword */ + ); + } + }); + }); + return keywords; + } + function traverseWithoutCrossingFunction(node, cb) { + cb(node); + if (!ts6.isFunctionLike(node) && !ts6.isClassLike(node) && !ts6.isInterfaceDeclaration(node) && !ts6.isModuleDeclaration(node) && !ts6.isTypeAliasDeclaration(node) && !ts6.isTypeNode(node)) { + ts6.forEachChild(node, function(child) { + return traverseWithoutCrossingFunction(child, cb); + }); + } + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = getIfElseKeywords(ifStatement, sourceFile); + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 91 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldCombineElseAndIf = true; + for (var j = ifKeyword.getStart(sourceFile) - 1; j >= elseKeyword.end; j--) { + if (!ts6.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombineElseAndIf = false; + break; + } + } + if (shouldCombineElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts6.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: "reference" + /* HighlightSpanKind.reference */ + }); + i++; + continue; + } + } + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); + } + return result; + } + function getIfElseKeywords(ifStatement, sourceFile) { + var keywords = []; + while (ts6.isIfStatement(ifStatement.parent) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (true) { + var children = ifStatement.getChildren(sourceFile); + pushKeywordIf( + keywords, + children[0], + 99 + /* SyntaxKind.IfKeyword */ + ); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf( + keywords, + children[i], + 91 + /* SyntaxKind.ElseKeyword */ + )) { + break; + } + } + if (!ifStatement.elseStatement || !ts6.isIfStatement(ifStatement.elseStatement)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + return keywords; + } + function isLabeledBy(node, labelName) { + return !!ts6.findAncestor(node.parent, function(owner) { + return !ts6.isLabeledStatement(owner) ? "quit" : owner.label.escapedText === labelName; + }); + } + })(DocumentHighlights = ts6.DocumentHighlights || (ts6.DocumentHighlights = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function isDocumentRegistryEntry(entry) { + return !!entry.sourceFile; + } + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + return createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory); + } + ts6.createDocumentRegistry = createDocumentRegistry; + function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory, externalCache) { + if (currentDirectory === void 0) { + currentDirectory = ""; + } + var buckets = new ts6.Map(); + var getCanonicalFileName = ts6.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function reportStats() { + var bucketInfoArray = ts6.arrayFrom(buckets.keys()).filter(function(name) { + return name && name.charAt(0) === "_"; + }).map(function(name) { + var entries = buckets.get(name); + var sourceFiles = []; + entries.forEach(function(entry, name2) { + if (isDocumentRegistryEntry(entry)) { + sourceFiles.push({ + name: name2, + scriptKind: entry.sourceFile.scriptKind, + refCount: entry.languageServiceRefCount + }); + } else { + entry.forEach(function(value, scriptKind) { + return sourceFiles.push({ name: name2, scriptKind, refCount: value.languageServiceRefCount }); + }); + } + }); + sourceFiles.sort(function(x, y) { + return y.refCount - x.refCount; + }); + return { + bucket: name, + sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, void 0, 2); + } + function getCompilationSettings(settingsOrHost) { + if (typeof settingsOrHost.getCompilationSettings === "function") { + return settingsOrHost.getCompilationSettings(); + } + return settingsOrHost; + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind, languageVersionOrOptions) { + var path = ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings)); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions) { + return acquireOrUpdateDocument( + fileName, + path, + compilationSettings, + key, + scriptSnapshot, + version, + /*acquiring*/ + true, + scriptKind, + languageVersionOrOptions + ); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind, languageVersionOrOptions) { + var path = ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings)); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions) { + return acquireOrUpdateDocument( + fileName, + path, + getCompilationSettings(compilationSettings), + key, + scriptSnapshot, + version, + /*acquiring*/ + false, + scriptKind, + languageVersionOrOptions + ); + } + function getDocumentRegistryEntry(bucketEntry, scriptKind) { + var entry = isDocumentRegistryEntry(bucketEntry) ? bucketEntry : bucketEntry.get(ts6.Debug.checkDefined(scriptKind, "If there are more than one scriptKind's for same document the scriptKind should be provided")); + ts6.Debug.assert(scriptKind === void 0 || !entry || entry.sourceFile.scriptKind === scriptKind, "Script kind should match provided ScriptKind:".concat(scriptKind, " and sourceFile.scriptKind: ").concat(entry === null || entry === void 0 ? void 0 : entry.sourceFile.scriptKind, ", !entry: ").concat(!entry)); + return entry; + } + function acquireOrUpdateDocument(fileName, path, compilationSettingsOrHost, key, scriptSnapshot, version, acquiring, scriptKind, languageVersionOrOptions) { + var _a, _b, _c, _d; + scriptKind = ts6.ensureScriptKind(fileName, scriptKind); + var compilationSettings = getCompilationSettings(compilationSettingsOrHost); + var host = compilationSettingsOrHost === compilationSettings ? void 0 : compilationSettingsOrHost; + var scriptTarget = scriptKind === 6 ? 100 : ts6.getEmitScriptTarget(compilationSettings); + var sourceFileOptions = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { + languageVersion: scriptTarget, + impliedNodeFormat: host && ts6.getImpliedNodeFormatForFile(path, (_d = (_c = (_b = (_a = host.getCompilerHost) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getModuleResolutionCache) === null || _c === void 0 ? void 0 : _c.call(_b)) === null || _d === void 0 ? void 0 : _d.getPackageJsonInfoCache(), host, compilationSettings), + setExternalModuleIndicator: ts6.getSetExternalModuleIndicator(compilationSettings) + }; + sourceFileOptions.languageVersion = scriptTarget; + var oldBucketCount = buckets.size; + var keyWithMode = getDocumentRegistryBucketKeyWithMode(key, sourceFileOptions.impliedNodeFormat); + var bucket = ts6.getOrUpdate(buckets, keyWithMode, function() { + return new ts6.Map(); + }); + if (ts6.tracing) { + if (buckets.size > oldBucketCount) { + ts6.tracing.instant("session", "createdDocumentRegistryBucket", { configFilePath: compilationSettings.configFilePath, key: keyWithMode }); + } + var otherBucketKey = !ts6.isDeclarationFileName(path) && ts6.forEachEntry(buckets, function(bucket2, bucketKey) { + return bucketKey !== keyWithMode && bucket2.has(path) && bucketKey; + }); + if (otherBucketKey) { + ts6.tracing.instant("session", "documentRegistryBucketOverlap", { path, key1: otherBucketKey, key2: keyWithMode }); + } + } + var bucketEntry = bucket.get(path); + var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind); + if (!entry && externalCache) { + var sourceFile = externalCache.getDocument(keyWithMode, path); + if (sourceFile) { + ts6.Debug.assert(acquiring); + entry = { + sourceFile, + languageServiceRefCount: 0 + }; + setBucketEntry(); + } + } + if (!entry) { + var sourceFile = ts6.createLanguageServiceSourceFile( + fileName, + scriptSnapshot, + sourceFileOptions, + version, + /*setNodeParents*/ + false, + scriptKind + ); + if (externalCache) { + externalCache.setDocument(keyWithMode, path, sourceFile); + } + entry = { + sourceFile, + languageServiceRefCount: 1 + }; + setBucketEntry(); + } else { + if (entry.sourceFile.version !== version) { + entry.sourceFile = ts6.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); + if (externalCache) { + externalCache.setDocument(keyWithMode, path, entry.sourceFile); + } + } + if (acquiring) { + entry.languageServiceRefCount++; + } + } + ts6.Debug.assert(entry.languageServiceRefCount !== 0); + return entry.sourceFile; + function setBucketEntry() { + if (!bucketEntry) { + bucket.set(path, entry); + } else if (isDocumentRegistryEntry(bucketEntry)) { + var scriptKindMap = new ts6.Map(); + scriptKindMap.set(bucketEntry.sourceFile.scriptKind, bucketEntry); + scriptKindMap.set(scriptKind, entry); + bucket.set(path, scriptKindMap); + } else { + bucketEntry.set(scriptKind, entry); + } + } + } + function releaseDocument(fileName, compilationSettings, scriptKind, impliedNodeFormat) { + var path = ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key, scriptKind, impliedNodeFormat); + } + function releaseDocumentWithKey(path, key, scriptKind, impliedNodeFormat) { + var bucket = ts6.Debug.checkDefined(buckets.get(getDocumentRegistryBucketKeyWithMode(key, impliedNodeFormat))); + var bucketEntry = bucket.get(path); + var entry = getDocumentRegistryEntry(bucketEntry, scriptKind); + entry.languageServiceRefCount--; + ts6.Debug.assert(entry.languageServiceRefCount >= 0); + if (entry.languageServiceRefCount === 0) { + if (isDocumentRegistryEntry(bucketEntry)) { + bucket.delete(path); + } else { + bucketEntry.delete(scriptKind); + if (bucketEntry.size === 1) { + bucket.set(path, ts6.firstDefinedIterator(bucketEntry.values(), ts6.identity)); + } + } + } + } + function getLanguageServiceRefCounts(path, scriptKind) { + return ts6.arrayFrom(buckets.entries(), function(_a) { + var key = _a[0], bucket = _a[1]; + var bucketEntry = bucket.get(path); + var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind); + return [key, entry && entry.languageServiceRefCount]; + }); + } + return { + acquireDocument, + acquireDocumentWithKey, + updateDocument, + updateDocumentWithKey, + releaseDocument, + releaseDocumentWithKey, + getLanguageServiceRefCounts, + reportStats, + getKeyForCompilationSettings + }; + } + ts6.createDocumentRegistryInternal = createDocumentRegistryInternal; + function compilerOptionValueToString(value) { + var _a; + if (value === null || typeof value !== "object") { + return "" + value; + } + if (ts6.isArray(value)) { + return "[".concat((_a = ts6.map(value, function(e) { + return compilerOptionValueToString(e); + })) === null || _a === void 0 ? void 0 : _a.join(","), "]"); + } + var str = "{"; + for (var key in value) { + if (ts6.hasProperty(value, key)) { + str += "".concat(key, ": ").concat(compilerOptionValueToString(value[key])); + } + } + return str + "}"; + } + function getKeyForCompilationSettings(settings) { + return ts6.sourceFileAffectingCompilerOptions.map(function(option) { + return compilerOptionValueToString(ts6.getCompilerOptionValue(settings, option)); + }).join("|") + (settings.pathsBasePath ? "|".concat(settings.pathsBasePath) : void 0); + } + function getDocumentRegistryBucketKeyWithMode(key, mode) { + return mode ? "".concat(key, "|").concat(mode) : key; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var FindAllReferences; + (function(FindAllReferences2) { + function createImportTracker(sourceFiles, sourceFilesSet, checker, cancellationToken) { + var allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); + return function(exportSymbol, exportInfo, isForRename) { + var _a = getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, exportInfo, checker, cancellationToken), directImports = _a.directImports, indirectUsers = _a.indirectUsers; + return __assign({ indirectUsers }, getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename)); + }; + } + FindAllReferences2.createImportTracker = createImportTracker; + var ExportKind; + (function(ExportKind2) { + ExportKind2[ExportKind2["Named"] = 0] = "Named"; + ExportKind2[ExportKind2["Default"] = 1] = "Default"; + ExportKind2[ExportKind2["ExportEquals"] = 2] = "ExportEquals"; + })(ExportKind = FindAllReferences2.ExportKind || (FindAllReferences2.ExportKind = {})); + var ImportExport; + (function(ImportExport2) { + ImportExport2[ImportExport2["Import"] = 0] = "Import"; + ImportExport2[ImportExport2["Export"] = 1] = "Export"; + })(ImportExport = FindAllReferences2.ImportExport || (FindAllReferences2.ImportExport = {})); + function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, _a, checker, cancellationToken) { + var exportingModuleSymbol = _a.exportingModuleSymbol, exportKind = _a.exportKind; + var markSeenDirectImport = ts6.nodeSeenTracker(); + var markSeenIndirectUser = ts6.nodeSeenTracker(); + var directImports = []; + var isAvailableThroughGlobal = !!exportingModuleSymbol.globalExports; + var indirectUserDeclarations = isAvailableThroughGlobal ? void 0 : []; + handleDirectImports(exportingModuleSymbol); + return { directImports, indirectUsers: getIndirectUsers() }; + function getIndirectUsers() { + if (isAvailableThroughGlobal) { + return sourceFiles; + } + if (exportingModuleSymbol.declarations) { + for (var _i = 0, _a2 = exportingModuleSymbol.declarations; _i < _a2.length; _i++) { + var decl = _a2[_i]; + if (ts6.isExternalModuleAugmentation(decl) && sourceFilesSet.has(decl.getSourceFile().fileName)) { + addIndirectUser(decl); + } + } + } + return indirectUserDeclarations.map(ts6.getSourceFileOfNode); + } + function handleDirectImports(exportingModuleSymbol2) { + var theseDirectImports = getDirectImports(exportingModuleSymbol2); + if (theseDirectImports) { + for (var _i = 0, theseDirectImports_1 = theseDirectImports; _i < theseDirectImports_1.length; _i++) { + var direct = theseDirectImports_1[_i]; + if (!markSeenDirectImport(direct)) { + continue; + } + if (cancellationToken) + cancellationToken.throwIfCancellationRequested(); + switch (direct.kind) { + case 210: + if (ts6.isImportCall(direct)) { + handleImportCall(direct); + break; + } + if (!isAvailableThroughGlobal) { + var parent = direct.parent; + if (exportKind === 2 && parent.kind === 257) { + var name = parent.name; + if (name.kind === 79) { + directImports.push(name); + break; + } + } + } + break; + case 79: + break; + case 268: + handleNamespaceImport( + direct, + direct.name, + ts6.hasSyntacticModifier( + direct, + 1 + /* ModifierFlags.Export */ + ), + /*alreadyAddedDirect*/ + false + ); + break; + case 269: + directImports.push(direct); + var namedBindings = direct.importClause && direct.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 271) { + handleNamespaceImport( + direct, + namedBindings.name, + /*isReExport*/ + false, + /*alreadyAddedDirect*/ + true + ); + } else if (!isAvailableThroughGlobal && ts6.isDefaultImport(direct)) { + addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); + } + break; + case 275: + if (!direct.exportClause) { + handleDirectImports(getContainingModuleSymbol(direct, checker)); + } else if (direct.exportClause.kind === 277) { + addIndirectUser( + getSourceFileLikeForImportDeclaration(direct), + /** addTransitiveDependencies */ + true + ); + } else { + directImports.push(direct); + } + break; + case 202: + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { + addIndirectUser( + direct.getSourceFile(), + /** addTransitiveDependencies */ + true + ); + } + directImports.push(direct); + break; + default: + ts6.Debug.failBadSyntaxKind(direct, "Unexpected import kind."); + } + } + } + } + function handleImportCall(importCall) { + var top = ts6.findAncestor(importCall, isAmbientModuleDeclaration) || importCall.getSourceFile(); + addIndirectUser( + top, + /** addTransitiveDependencies */ + !!isExported( + importCall, + /** stopAtAmbientModule */ + true + ) + ); + } + function isExported(node, stopAtAmbientModule) { + if (stopAtAmbientModule === void 0) { + stopAtAmbientModule = false; + } + return ts6.findAncestor(node, function(node2) { + if (stopAtAmbientModule && isAmbientModuleDeclaration(node2)) + return "quit"; + return ts6.canHaveModifiers(node2) && ts6.some(node2.modifiers, ts6.isExportModifier); + }); + } + function handleNamespaceImport(importDeclaration, name, isReExport, alreadyAddedDirect) { + if (exportKind === 2) { + if (!alreadyAddedDirect) + directImports.push(importDeclaration); + } else if (!isAvailableThroughGlobal) { + var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); + ts6.Debug.assert( + sourceFileLike.kind === 308 || sourceFileLike.kind === 264 + /* SyntaxKind.ModuleDeclaration */ + ); + if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { + addIndirectUser( + sourceFileLike, + /** addTransitiveDependencies */ + true + ); + } else { + addIndirectUser(sourceFileLike); + } + } + } + function addIndirectUser(sourceFileLike, addTransitiveDependencies) { + if (addTransitiveDependencies === void 0) { + addTransitiveDependencies = false; + } + ts6.Debug.assert(!isAvailableThroughGlobal); + var isNew = markSeenIndirectUser(sourceFileLike); + if (!isNew) + return; + indirectUserDeclarations.push(sourceFileLike); + if (!addTransitiveDependencies) + return; + var moduleSymbol = checker.getMergedSymbol(sourceFileLike.symbol); + if (!moduleSymbol) + return; + ts6.Debug.assert(!!(moduleSymbol.flags & 1536)); + var directImports2 = getDirectImports(moduleSymbol); + if (directImports2) { + for (var _i = 0, directImports_1 = directImports2; _i < directImports_1.length; _i++) { + var directImport = directImports_1[_i]; + if (!ts6.isImportTypeNode(directImport)) { + addIndirectUser( + getSourceFileLikeForImportDeclaration(directImport), + /** addTransitiveDependencies */ + true + ); + } + } + } + } + function getDirectImports(moduleSymbol) { + return allDirectImports.get(ts6.getSymbolId(moduleSymbol).toString()); + } + } + function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { + var importSearches = []; + var singleReferences = []; + function addSearch(location, symbol) { + importSearches.push([location, symbol]); + } + if (directImports) { + for (var _i = 0, directImports_2 = directImports; _i < directImports_2.length; _i++) { + var decl = directImports_2[_i]; + handleImport(decl); + } + } + return { importSearches, singleReferences }; + function handleImport(decl2) { + if (decl2.kind === 268) { + if (isExternalModuleImportEquals(decl2)) { + handleNamespaceImportLike(decl2.name); + } + return; + } + if (decl2.kind === 79) { + handleNamespaceImportLike(decl2); + return; + } + if (decl2.kind === 202) { + if (decl2.qualifier) { + var firstIdentifier = ts6.getFirstIdentifier(decl2.qualifier); + if (firstIdentifier.escapedText === ts6.symbolName(exportSymbol)) { + singleReferences.push(firstIdentifier); + } + } else if (exportKind === 2) { + singleReferences.push(decl2.argument.literal); + } + return; + } + if (decl2.moduleSpecifier.kind !== 10) { + return; + } + if (decl2.kind === 275) { + if (decl2.exportClause && ts6.isNamedExports(decl2.exportClause)) { + searchForNamedImport(decl2.exportClause); + } + return; + } + var _a = decl2.importClause || { name: void 0, namedBindings: void 0 }, name = _a.name, namedBindings = _a.namedBindings; + if (namedBindings) { + switch (namedBindings.kind) { + case 271: + handleNamespaceImportLike(namedBindings.name); + break; + case 272: + if (exportKind === 0 || exportKind === 1) { + searchForNamedImport(namedBindings); + } + break; + default: + ts6.Debug.assertNever(namedBindings); + } + } + if (name && (exportKind === 1 || exportKind === 2) && (!isForRename || name.escapedText === ts6.symbolEscapedNameNoDefault(exportSymbol))) { + var defaultImportAlias = checker.getSymbolAtLocation(name); + addSearch(name, defaultImportAlias); + } + } + function handleNamespaceImportLike(importName) { + if (exportKind === 2 && (!isForRename || isNameMatch(importName.escapedText))) { + addSearch(importName, checker.getSymbolAtLocation(importName)); + } + } + function searchForNamedImport(namedBindings) { + if (!namedBindings) { + return; + } + for (var _i2 = 0, _a = namedBindings.elements; _i2 < _a.length; _i2++) { + var element = _a[_i2]; + var name = element.name, propertyName = element.propertyName; + if (!isNameMatch((propertyName || name).escapedText)) { + continue; + } + if (propertyName) { + singleReferences.push(propertyName); + if (!isForRename || name.escapedText === exportSymbol.escapedName) { + addSearch(name, checker.getSymbolAtLocation(name)); + } + } else { + var localSymbol = element.kind === 278 && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); + addSearch(name, localSymbol); + } + } + } + function isNameMatch(name) { + return name === exportSymbol.escapedName || exportKind !== 0 && name === "default"; + } + } + function findNamespaceReExports(sourceFileLike, name, checker) { + var namespaceImportSymbol = checker.getSymbolAtLocation(name); + return !!forEachPossibleImportOrExportStatement(sourceFileLike, function(statement) { + if (!ts6.isExportDeclaration(statement)) + return; + var exportClause = statement.exportClause, moduleSpecifier = statement.moduleSpecifier; + return !moduleSpecifier && exportClause && ts6.isNamedExports(exportClause) && exportClause.elements.some(function(element) { + return checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol; + }); + }); + } + function findModuleReferences(program, sourceFiles, searchModuleSymbol) { + var refs = []; + var checker = program.getTypeChecker(); + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var referencingFile = sourceFiles_1[_i]; + var searchSourceFile = searchModuleSymbol.valueDeclaration; + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308) { + for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { + var ref = _b[_a]; + if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { + refs.push({ kind: "reference", referencingFile, ref }); + } + } + for (var _c = 0, _d = referencingFile.typeReferenceDirectives; _c < _d.length; _c++) { + var ref = _d[_c]; + var referenced = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat); + if (referenced !== void 0 && referenced.resolvedFileName === searchSourceFile.fileName) { + refs.push({ kind: "reference", referencingFile, ref }); + } + } + } + forEachImport(referencingFile, function(_importDecl, moduleSpecifier) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol === searchModuleSymbol) { + refs.push({ kind: "import", literal: moduleSpecifier }); + } + }); + } + return refs; + } + FindAllReferences2.findModuleReferences = findModuleReferences; + function getDirectImportsMap(sourceFiles, checker, cancellationToken) { + var map = new ts6.Map(); + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var sourceFile = sourceFiles_2[_i]; + if (cancellationToken) + cancellationToken.throwIfCancellationRequested(); + forEachImport(sourceFile, function(importDecl, moduleSpecifier) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol) { + var id = ts6.getSymbolId(moduleSymbol).toString(); + var imports = map.get(id); + if (!imports) { + map.set(id, imports = []); + } + imports.push(importDecl); + } + }); + } + return map; + } + function forEachPossibleImportOrExportStatement(sourceFileLike, action) { + return ts6.forEach(sourceFileLike.kind === 308 ? sourceFileLike.statements : sourceFileLike.body.statements, function(statement) { + return action(statement) || isAmbientModuleDeclaration(statement) && ts6.forEach(statement.body && statement.body.statements, action); + }); + } + function forEachImport(sourceFile, action) { + if (sourceFile.externalModuleIndicator || sourceFile.imports !== void 0) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var i = _a[_i]; + action(ts6.importFromModuleSpecifier(i), i); + } + } else { + forEachPossibleImportOrExportStatement(sourceFile, function(statement) { + switch (statement.kind) { + case 275: + case 269: { + var decl = statement; + if (decl.moduleSpecifier && ts6.isStringLiteral(decl.moduleSpecifier)) { + action(decl, decl.moduleSpecifier); + } + break; + } + case 268: { + var decl = statement; + if (isExternalModuleImportEquals(decl)) { + action(decl, decl.moduleReference.expression); + } + break; + } + } + }); + } + } + function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { + return comingFromExport ? getExport() : getExport() || getImport(); + function getExport() { + var _a; + var parent = node.parent; + var grandparent = parent.parent; + if (symbol.exportSymbol) { + if (parent.kind === 208) { + return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function(d) { + return d === parent; + })) && ts6.isBinaryExpression(grandparent) ? getSpecialPropertyExport( + grandparent, + /*useLhsSymbol*/ + false + ) : void 0; + } else { + return exportInfo(symbol.exportSymbol, getExportKindForDeclaration(parent)); + } + } else { + var exportNode = getExportNode(parent, node); + if (exportNode && ts6.hasSyntacticModifier( + exportNode, + 1 + /* ModifierFlags.Export */ + )) { + if (ts6.isImportEqualsDeclaration(exportNode) && exportNode.moduleReference === node) { + if (comingFromExport) { + return void 0; + } + var lhsSymbol = checker.getSymbolAtLocation(exportNode.name); + return { kind: 0, symbol: lhsSymbol }; + } else { + return exportInfo(symbol, getExportKindForDeclaration(exportNode)); + } + } else if (ts6.isNamespaceExport(parent)) { + return exportInfo( + symbol, + 0 + /* ExportKind.Named */ + ); + } else if (ts6.isExportAssignment(parent)) { + return getExportAssignmentExport(parent); + } else if (ts6.isExportAssignment(grandparent)) { + return getExportAssignmentExport(grandparent); + } else if (ts6.isBinaryExpression(parent)) { + return getSpecialPropertyExport( + parent, + /*useLhsSymbol*/ + true + ); + } else if (ts6.isBinaryExpression(grandparent)) { + return getSpecialPropertyExport( + grandparent, + /*useLhsSymbol*/ + true + ); + } else if (ts6.isJSDocTypedefTag(parent)) { + return exportInfo( + symbol, + 0 + /* ExportKind.Named */ + ); + } + } + function getExportAssignmentExport(ex) { + if (!ex.symbol.parent) + return void 0; + var exportKind = ex.isExportEquals ? 2 : 1; + return { kind: 1, symbol, exportInfo: { exportingModuleSymbol: ex.symbol.parent, exportKind } }; + } + function getSpecialPropertyExport(node2, useLhsSymbol) { + var kind; + switch (ts6.getAssignmentDeclarationKind(node2)) { + case 1: + kind = 0; + break; + case 2: + kind = 2; + break; + default: + return void 0; + } + var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts6.getNameOfAccessExpression(ts6.cast(node2.left, ts6.isAccessExpression))) : symbol; + return sym && exportInfo(sym, kind); + } + } + function getImport() { + var isImport = isNodeImport(node); + if (!isImport) + return void 0; + var importedSymbol = checker.getImmediateAliasedSymbol(symbol); + if (!importedSymbol) + return void 0; + importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker); + if (importedSymbol.escapedName === "export=") { + importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === void 0) + return void 0; + } + var importedName = ts6.symbolEscapedNameNoDefault(importedSymbol); + if (importedName === void 0 || importedName === "default" || importedName === symbol.escapedName) { + return { kind: 0, symbol: importedSymbol }; + } + } + function exportInfo(symbol2, kind) { + var exportInfo2 = getExportInfo(symbol2, kind, checker); + return exportInfo2 && { kind: 1, symbol: symbol2, exportInfo: exportInfo2 }; + } + function getExportKindForDeclaration(node2) { + return ts6.hasSyntacticModifier( + node2, + 1024 + /* ModifierFlags.Default */ + ) ? 1 : 0; + } + } + FindAllReferences2.getImportOrExportSymbol = getImportOrExportSymbol; + function getExportEqualsLocalSymbol(importedSymbol, checker) { + if (importedSymbol.flags & 2097152) { + return checker.getImmediateAliasedSymbol(importedSymbol); + } + var decl = ts6.Debug.checkDefined(importedSymbol.valueDeclaration); + if (ts6.isExportAssignment(decl)) { + return decl.expression.symbol; + } else if (ts6.isBinaryExpression(decl)) { + return decl.right.symbol; + } else if (ts6.isSourceFile(decl)) { + return decl.symbol; + } + return void 0; + } + function getExportNode(parent, node) { + var declaration = ts6.isVariableDeclaration(parent) ? parent : ts6.isBindingElement(parent) ? ts6.walkUpBindingElementsAndPatterns(parent) : void 0; + if (declaration) { + return parent.name !== node ? void 0 : ts6.isCatchClause(declaration.parent) ? void 0 : ts6.isVariableStatement(declaration.parent.parent) ? declaration.parent.parent : void 0; + } else { + return parent; + } + } + function isNodeImport(node) { + var parent = node.parent; + switch (parent.kind) { + case 268: + return parent.name === node && isExternalModuleImportEquals(parent); + case 273: + return !parent.propertyName; + case 270: + case 271: + ts6.Debug.assert(parent.name === node); + return true; + case 205: + return ts6.isInJSFile(node) && ts6.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); + default: + return false; + } + } + function getExportInfo(exportSymbol, exportKind, checker) { + var moduleSymbol = exportSymbol.parent; + if (!moduleSymbol) + return void 0; + var exportingModuleSymbol = checker.getMergedSymbol(moduleSymbol); + return ts6.isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol, exportKind } : void 0; + } + FindAllReferences2.getExportInfo = getExportInfo; + function skipExportSpecifierSymbol(symbol, checker) { + if (symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts6.isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) { + return checker.getExportSpecifierLocalTargetSymbol(declaration); + } else if (ts6.isPropertyAccessExpression(declaration) && ts6.isModuleExportsAccessExpression(declaration.expression) && !ts6.isPrivateIdentifier(declaration.name)) { + return checker.getSymbolAtLocation(declaration); + } else if (ts6.isShorthandPropertyAssignment(declaration) && ts6.isBinaryExpression(declaration.parent.parent) && ts6.getAssignmentDeclarationKind(declaration.parent.parent) === 2) { + return checker.getExportSpecifierLocalTargetSymbol(declaration.name); + } + } + } + return symbol; + } + function getContainingModuleSymbol(importer, checker) { + return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); + } + function getSourceFileLikeForImportDeclaration(node) { + if (node.kind === 210) { + return node.getSourceFile(); + } + var parent = node.parent; + if (parent.kind === 308) { + return parent; + } + ts6.Debug.assert( + parent.kind === 265 + /* SyntaxKind.ModuleBlock */ + ); + return ts6.cast(parent.parent, isAmbientModuleDeclaration); + } + function isAmbientModuleDeclaration(node) { + return node.kind === 264 && node.name.kind === 10; + } + function isExternalModuleImportEquals(eq) { + return eq.moduleReference.kind === 280 && eq.moduleReference.expression.kind === 10; + } + })(FindAllReferences = ts6.FindAllReferences || (ts6.FindAllReferences = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var FindAllReferences; + (function(FindAllReferences2) { + var DefinitionKind; + (function(DefinitionKind2) { + DefinitionKind2[DefinitionKind2["Symbol"] = 0] = "Symbol"; + DefinitionKind2[DefinitionKind2["Label"] = 1] = "Label"; + DefinitionKind2[DefinitionKind2["Keyword"] = 2] = "Keyword"; + DefinitionKind2[DefinitionKind2["This"] = 3] = "This"; + DefinitionKind2[DefinitionKind2["String"] = 4] = "String"; + DefinitionKind2[DefinitionKind2["TripleSlashReference"] = 5] = "TripleSlashReference"; + })(DefinitionKind = FindAllReferences2.DefinitionKind || (FindAllReferences2.DefinitionKind = {})); + var EntryKind; + (function(EntryKind2) { + EntryKind2[EntryKind2["Span"] = 0] = "Span"; + EntryKind2[EntryKind2["Node"] = 1] = "Node"; + EntryKind2[EntryKind2["StringLiteral"] = 2] = "StringLiteral"; + EntryKind2[EntryKind2["SearchedLocalFoundProperty"] = 3] = "SearchedLocalFoundProperty"; + EntryKind2[EntryKind2["SearchedPropertyFoundLocal"] = 4] = "SearchedPropertyFoundLocal"; + })(EntryKind = FindAllReferences2.EntryKind || (FindAllReferences2.EntryKind = {})); + function nodeEntry(node, kind) { + if (kind === void 0) { + kind = 1; + } + return { + kind, + node: node.name || node, + context: getContextNodeForNodeEntry(node) + }; + } + FindAllReferences2.nodeEntry = nodeEntry; + function isContextWithStartAndEndNode(node) { + return node && node.kind === void 0; + } + FindAllReferences2.isContextWithStartAndEndNode = isContextWithStartAndEndNode; + function getContextNodeForNodeEntry(node) { + if (ts6.isDeclaration(node)) { + return getContextNode(node); + } + if (!node.parent) + return void 0; + if (!ts6.isDeclaration(node.parent) && !ts6.isExportAssignment(node.parent)) { + if (ts6.isInJSFile(node)) { + var binaryExpression = ts6.isBinaryExpression(node.parent) ? node.parent : ts6.isAccessExpression(node.parent) && ts6.isBinaryExpression(node.parent.parent) && node.parent.parent.left === node.parent ? node.parent.parent : void 0; + if (binaryExpression && ts6.getAssignmentDeclarationKind(binaryExpression) !== 0) { + return getContextNode(binaryExpression); + } + } + if (ts6.isJsxOpeningElement(node.parent) || ts6.isJsxClosingElement(node.parent)) { + return node.parent.parent; + } else if (ts6.isJsxSelfClosingElement(node.parent) || ts6.isLabeledStatement(node.parent) || ts6.isBreakOrContinueStatement(node.parent)) { + return node.parent; + } else if (ts6.isStringLiteralLike(node)) { + var validImport = ts6.tryGetImportFromModuleSpecifier(node); + if (validImport) { + var declOrStatement = ts6.findAncestor(validImport, function(node2) { + return ts6.isDeclaration(node2) || ts6.isStatement(node2) || ts6.isJSDocTag(node2); + }); + return ts6.isDeclaration(declOrStatement) ? getContextNode(declOrStatement) : declOrStatement; + } + } + var propertyName = ts6.findAncestor(node, ts6.isComputedPropertyName); + return propertyName ? getContextNode(propertyName.parent) : void 0; + } + if (node.parent.name === node || // node is name of declaration, use parent + ts6.isConstructorDeclaration(node.parent) || ts6.isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent + (ts6.isImportOrExportSpecifier(node.parent) || ts6.isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export + node.kind === 88 && ts6.hasSyntacticModifier( + node.parent, + 1025 + /* ModifierFlags.ExportDefault */ + )) { + return getContextNode(node.parent); + } + return void 0; + } + function getContextNode(node) { + if (!node) + return void 0; + switch (node.kind) { + case 257: + return !ts6.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts6.isVariableStatement(node.parent.parent) ? node.parent.parent : ts6.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; + case 205: + return getContextNode(node.parent.parent); + case 273: + return node.parent.parent.parent; + case 278: + case 271: + return node.parent.parent; + case 270: + case 277: + return node.parent; + case 223: + return ts6.isExpressionStatement(node.parent) ? node.parent : node; + case 247: + case 246: + return { + start: node.initializer, + end: node.expression + }; + case 299: + case 300: + return ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts6.findAncestor(node.parent, function(node2) { + return ts6.isBinaryExpression(node2) || ts6.isForInOrOfStatement(node2); + })) : node; + default: + return node; + } + } + FindAllReferences2.getContextNode = getContextNode; + function toContextSpan(textSpan, sourceFile, context) { + if (!context) + return void 0; + var contextSpan = isContextWithStartAndEndNode(context) ? getTextSpan(context.start, sourceFile, context.end) : getTextSpan(context, sourceFile); + return contextSpan.start !== textSpan.start || contextSpan.length !== textSpan.length ? { contextSpan } : void 0; + } + FindAllReferences2.toContextSpan = toContextSpan; + var FindReferencesUse; + (function(FindReferencesUse2) { + FindReferencesUse2[FindReferencesUse2["Other"] = 0] = "Other"; + FindReferencesUse2[FindReferencesUse2["References"] = 1] = "References"; + FindReferencesUse2[FindReferencesUse2["Rename"] = 2] = "Rename"; + })(FindReferencesUse = FindAllReferences2.FindReferencesUse || (FindAllReferences2.FindReferencesUse = {})); + function findReferencedSymbols(program, cancellationToken, sourceFiles, sourceFile, position) { + var node = ts6.getTouchingPropertyName(sourceFile, position); + var options = { + use: 1 + /* FindReferencesUse.References */ + }; + var referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options); + var checker = program.getTypeChecker(); + var adjustedNode = Core.getAdjustedNode(node, options); + var symbol = isDefinitionForReference(adjustedNode) ? checker.getSymbolAtLocation(adjustedNode) : void 0; + return !referencedSymbols || !referencedSymbols.length ? void 0 : ts6.mapDefined(referencedSymbols, function(_a) { + var definition = _a.definition, references = _a.references; + return definition && { + definition: checker.runWithCancellationToken(cancellationToken, function(checker2) { + return definitionToReferencedSymbolDefinitionInfo(definition, checker2, node); + }), + references: references.map(function(r) { + return toReferencedSymbolEntry(r, symbol); + }) + }; + }); + } + FindAllReferences2.findReferencedSymbols = findReferencedSymbols; + function isDefinitionForReference(node) { + return node.kind === 88 || !!ts6.getDeclarationFromName(node) || ts6.isLiteralComputedPropertyDeclarationName(node) || node.kind === 135 && ts6.isConstructorDeclaration(node.parent); + } + function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { + var node = ts6.getTouchingPropertyName(sourceFile, position); + var referenceEntries; + var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); + if (node.parent.kind === 208 || node.parent.kind === 205 || node.parent.kind === 209 || node.kind === 106) { + referenceEntries = entries && __spreadArray([], entries, true); + } else if (entries) { + var queue = ts6.createQueue(entries); + var seenNodes = new ts6.Map(); + while (!queue.isEmpty()) { + var entry = queue.dequeue(); + if (!ts6.addToSeen(seenNodes, ts6.getNodeId(entry.node))) { + continue; + } + referenceEntries = ts6.append(referenceEntries, entry); + var entries_1 = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, entry.node, entry.node.pos); + if (entries_1) { + queue.enqueue.apply(queue, entries_1); + } + } + } + var checker = program.getTypeChecker(); + return ts6.map(referenceEntries, function(entry2) { + return toImplementationLocation(entry2, checker); + }); + } + FindAllReferences2.getImplementationsAtPosition = getImplementationsAtPosition; + function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { + if (node.kind === 308) { + return void 0; + } + var checker = program.getTypeChecker(); + if (node.parent.kind === 300) { + var result_2 = []; + Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function(node2) { + return result_2.push(nodeEntry(node2)); + }); + return result_2; + } else if (node.kind === 106 || ts6.isSuperProperty(node.parent)) { + var symbol = checker.getSymbolAtLocation(node); + return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)]; + } else { + return getReferenceEntriesForNode(position, node, program, sourceFiles, cancellationToken, { + implementations: true, + use: 1 + /* FindReferencesUse.References */ + }); + } + } + function findReferenceOrRenameEntries(program, cancellationToken, sourceFiles, node, position, options, convertEntry) { + return ts6.map(flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options)), function(entry) { + return convertEntry(entry, node, program.getTypeChecker()); + }); + } + FindAllReferences2.findReferenceOrRenameEntries = findReferenceOrRenameEntries; + function getReferenceEntriesForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { + if (options === void 0) { + options = {}; + } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts6.Set(sourceFiles.map(function(f) { + return f.fileName; + })); + } + return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet)); + } + FindAllReferences2.getReferenceEntriesForNode = getReferenceEntriesForNode; + function flattenEntries(referenceSymbols) { + return referenceSymbols && ts6.flatMap(referenceSymbols, function(r) { + return r.references; + }); + } + function definitionToReferencedSymbolDefinitionInfo(def, checker, originalNode) { + var info = function() { + switch (def.type) { + case 0: { + var symbol = def.symbol; + var _a = getDefinitionKindAndDisplayParts(symbol, checker, originalNode), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var name_1 = displayParts_1.map(function(p) { + return p.text; + }).join(""); + var declaration = symbol.declarations && ts6.firstOrUndefined(symbol.declarations); + var node = declaration ? ts6.getNameOfDeclaration(declaration) || declaration : originalNode; + return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: name_1, kind: kind_1, displayParts: displayParts_1, context: getContextNode(declaration) }); + } + case 1: { + var node = def.node; + return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: node.text, kind: "label", displayParts: [ts6.displayPart(node.text, ts6.SymbolDisplayPartKind.text)] }); + } + case 2: { + var node = def.node; + var name_2 = ts6.tokenToString(node.kind); + return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: name_2, kind: "keyword", displayParts: [{ + text: name_2, + kind: "keyword" + /* ScriptElementKind.keyword */ + }] }); + } + case 3: { + var node = def.node; + var symbol = checker.getSymbolAtLocation(node); + var displayParts_2 = symbol && ts6.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), ts6.getContainerNode(node), node).displayParts || [ts6.textPart("this")]; + return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: "this", kind: "var", displayParts: displayParts_2 }); + } + case 4: { + var node = def.node; + return __assign(__assign({}, getFileAndTextSpanFromNode(node)), { name: node.text, kind: "var", displayParts: [ts6.displayPart(ts6.getTextOfNode(node), ts6.SymbolDisplayPartKind.stringLiteral)] }); + } + case 5: { + return { + textSpan: ts6.createTextSpanFromRange(def.reference), + sourceFile: def.file, + name: def.reference.fileName, + kind: "string", + displayParts: [ts6.displayPart('"'.concat(def.reference.fileName, '"'), ts6.SymbolDisplayPartKind.stringLiteral)] + }; + } + default: + return ts6.Debug.assertNever(def); + } + }(); + var sourceFile = info.sourceFile, textSpan = info.textSpan, name = info.name, kind = info.kind, displayParts = info.displayParts, context = info.context; + return __assign({ containerKind: "", containerName: "", fileName: sourceFile.fileName, kind, name, textSpan, displayParts }, toContextSpan(textSpan, sourceFile, context)); + } + function getFileAndTextSpanFromNode(node) { + var sourceFile = node.getSourceFile(); + return { + sourceFile, + textSpan: getTextSpan(ts6.isComputedPropertyName(node) ? node.expression : node, sourceFile) + }; + } + function getDefinitionKindAndDisplayParts(symbol, checker, node) { + var meaning = Core.getIntersectingMeaningFromDeclarations(node, symbol); + var enclosingDeclaration = symbol.declarations && ts6.firstOrUndefined(symbol.declarations) || node; + var _a = ts6.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + return { displayParts, kind: symbolKind }; + } + function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText) { + return __assign(__assign({}, entryToDocumentSpan(entry)), providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker)); + } + FindAllReferences2.toRenameLocation = toRenameLocation; + function toReferencedSymbolEntry(entry, symbol) { + var referenceEntry = toReferenceEntry(entry); + if (!symbol) + return referenceEntry; + return __assign(__assign({}, referenceEntry), { isDefinition: entry.kind !== 0 && isDeclarationOfSymbol(entry.node, symbol) }); + } + function toReferenceEntry(entry) { + var documentSpan = entryToDocumentSpan(entry); + if (entry.kind === 0) { + return __assign(__assign({}, documentSpan), { isWriteAccess: false }); + } + var kind = entry.kind, node = entry.node; + return __assign(__assign({}, documentSpan), { isWriteAccess: isWriteAccessForReference(node), isInString: kind === 2 ? true : void 0 }); + } + FindAllReferences2.toReferenceEntry = toReferenceEntry; + function entryToDocumentSpan(entry) { + if (entry.kind === 0) { + return { textSpan: entry.textSpan, fileName: entry.fileName }; + } else { + var sourceFile = entry.node.getSourceFile(); + var textSpan = getTextSpan(entry.node, sourceFile); + return __assign({ textSpan, fileName: sourceFile.fileName }, toContextSpan(textSpan, sourceFile, entry.context)); + } + } + function getPrefixAndSuffixText(entry, originalNode, checker) { + if (entry.kind !== 0 && ts6.isIdentifier(originalNode)) { + var node = entry.node, kind = entry.kind; + var parent = node.parent; + var name = originalNode.text; + var isShorthandAssignment = ts6.isShorthandPropertyAssignment(parent); + if (isShorthandAssignment || ts6.isObjectBindingElementWithoutPropertyName(parent) && parent.name === node && parent.dotDotDotToken === void 0) { + var prefixColon = { prefixText: name + ": " }; + var suffixColon = { suffixText: ": " + name }; + if (kind === 3) { + return prefixColon; + } + if (kind === 4) { + return suffixColon; + } + if (isShorthandAssignment) { + var grandParent = parent.parent; + if (ts6.isObjectLiteralExpression(grandParent) && ts6.isBinaryExpression(grandParent.parent) && ts6.isModuleExportsAccessExpression(grandParent.parent.left)) { + return prefixColon; + } + return suffixColon; + } else { + return prefixColon; + } + } else if (ts6.isImportSpecifier(parent) && !parent.propertyName) { + var originalSymbol = ts6.isExportSpecifier(originalNode.parent) ? checker.getExportSpecifierLocalTargetSymbol(originalNode.parent) : checker.getSymbolAtLocation(originalNode); + return ts6.contains(originalSymbol.declarations, parent) ? { prefixText: name + " as " } : ts6.emptyOptions; + } else if (ts6.isExportSpecifier(parent) && !parent.propertyName) { + return originalNode === entry.node || checker.getSymbolAtLocation(originalNode) === checker.getSymbolAtLocation(entry.node) ? { prefixText: name + " as " } : { suffixText: " as " + name }; + } + } + return ts6.emptyOptions; + } + function toImplementationLocation(entry, checker) { + var documentSpan = entryToDocumentSpan(entry); + if (entry.kind !== 0) { + var node = entry.node; + return __assign(__assign({}, documentSpan), implementationKindDisplayParts(node, checker)); + } else { + return __assign(__assign({}, documentSpan), { kind: "", displayParts: [] }); + } + } + function implementationKindDisplayParts(node, checker) { + var symbol = checker.getSymbolAtLocation(ts6.isDeclaration(node) && node.name ? node.name : node); + if (symbol) { + return getDefinitionKindAndDisplayParts(symbol, checker, node); + } else if (node.kind === 207) { + return { + kind: "interface", + displayParts: [ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + ), ts6.textPart("object literal"), ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )] + }; + } else if (node.kind === 228) { + return { + kind: "local class", + displayParts: [ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + ), ts6.textPart("anonymous local class"), ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )] + }; + } else { + return { kind: ts6.getNodeKind(node), displayParts: [] }; + } + } + function toHighlightSpan(entry) { + var documentSpan = entryToDocumentSpan(entry); + if (entry.kind === 0) { + return { + fileName: documentSpan.fileName, + span: { + textSpan: documentSpan.textSpan, + kind: "reference" + /* HighlightSpanKind.reference */ + } + }; + } + var writeAccess = isWriteAccessForReference(entry.node); + var span = __assign({ textSpan: documentSpan.textSpan, kind: writeAccess ? "writtenReference" : "reference", isInString: entry.kind === 2 ? true : void 0 }, documentSpan.contextSpan && { contextSpan: documentSpan.contextSpan }); + return { fileName: documentSpan.fileName, span }; + } + FindAllReferences2.toHighlightSpan = toHighlightSpan; + function getTextSpan(node, sourceFile, endNode) { + var start = node.getStart(sourceFile); + var end = (endNode || node).getEnd(); + if (ts6.isStringLiteralLike(node) && end - start > 2) { + ts6.Debug.assert(endNode === void 0); + start += 1; + end -= 1; + } + return ts6.createTextSpanFromBounds(start, end); + } + function getTextSpanOfEntry(entry) { + return entry.kind === 0 ? entry.textSpan : getTextSpan(entry.node, entry.node.getSourceFile()); + } + FindAllReferences2.getTextSpanOfEntry = getTextSpanOfEntry; + function isWriteAccessForReference(node) { + var decl = ts6.getDeclarationFromName(node); + return !!decl && declarationIsWriteAccess(decl) || node.kind === 88 || ts6.isWriteAccess(node); + } + function isDeclarationOfSymbol(node, target) { + var _a; + if (!target) + return false; + var source = ts6.getDeclarationFromName(node) || (node.kind === 88 ? node.parent : ts6.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent : node.kind === 135 && ts6.isConstructorDeclaration(node.parent) ? node.parent.parent : void 0); + var commonjsSource = source && ts6.isBinaryExpression(source) ? source.left : void 0; + return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function(d) { + return d === source || d === commonjsSource; + }))); + } + FindAllReferences2.isDeclarationOfSymbol = isDeclarationOfSymbol; + function declarationIsWriteAccess(decl) { + if (!!(decl.flags & 16777216)) + return true; + switch (decl.kind) { + case 223: + case 205: + case 260: + case 228: + case 88: + case 263: + case 302: + case 278: + case 270: + case 268: + case 273: + case 261: + case 341: + case 348: + case 288: + case 264: + case 267: + case 271: + case 277: + case 166: + case 300: + case 262: + case 165: + return true; + case 299: + return !ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); + case 259: + case 215: + case 173: + case 171: + case 174: + case 175: + return !!decl.body; + case 257: + case 169: + return !!decl.initializer || ts6.isCatchClause(decl.parent); + case 170: + case 168: + case 350: + case 343: + return false; + default: + return ts6.Debug.failBadSyntaxKind(decl); + } + } + var Core; + (function(Core2) { + function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { + var _a, _b; + if (options === void 0) { + options = {}; + } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts6.Set(sourceFiles.map(function(f) { + return f.fileName; + })); + } + node = getAdjustedNode(node, options); + if (ts6.isSourceFile(node)) { + var resolvedRef = ts6.GoToDefinition.getReferenceAtPosition(node, position, program); + if (!(resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file)) { + return void 0; + } + var moduleSymbol = program.getTypeChecker().getMergedSymbol(resolvedRef.file.symbol); + if (moduleSymbol) { + return getReferencedSymbolsForModule( + program, + moduleSymbol, + /*excludeImportTypeOfExportEquals*/ + false, + sourceFiles, + sourceFilesSet + ); + } + var fileIncludeReasons = program.getFileIncludeReasons(); + if (!fileIncludeReasons) { + return void 0; + } + return [{ + definition: { type: 5, reference: resolvedRef.reference, file: node }, + references: getReferencesForNonModule(resolvedRef.file, fileIncludeReasons, program) || ts6.emptyArray + }]; + } + if (!options.implementations) { + var special = getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken); + if (special) { + return special; + } + } + var checker = program.getTypeChecker(); + var symbol = checker.getSymbolAtLocation(ts6.isConstructorDeclaration(node) && node.parent.name || node); + if (!symbol) { + if (!options.implementations && ts6.isStringLiteralLike(node)) { + if (ts6.isModuleSpecifierLike(node)) { + var fileIncludeReasons = program.getFileIncludeReasons(); + var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text, ts6.getModeForUsageLocation(node.getSourceFile(), node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName; + var referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0; + if (referencedFile) { + return [{ definition: { type: 4, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts6.emptyArray }]; + } + } + return getReferencesForStringLiteral(node, sourceFiles, checker, cancellationToken); + } + return void 0; + } + if (symbol.escapedName === "export=") { + return getReferencedSymbolsForModule( + program, + symbol.parent, + /*excludeImportTypeOfExportEquals*/ + false, + sourceFiles, + sourceFilesSet + ); + } + var moduleReferences = getReferencedSymbolsForModuleIfDeclaredBySourceFile(symbol, program, sourceFiles, cancellationToken, options, sourceFilesSet); + if (moduleReferences && !(symbol.flags & 33554432)) { + return moduleReferences; + } + var aliasedSymbol = getMergedAliasedSymbolOfNamespaceExportDeclaration(node, symbol, checker); + var moduleReferencesOfExportTarget = aliasedSymbol && getReferencedSymbolsForModuleIfDeclaredBySourceFile(aliasedSymbol, program, sourceFiles, cancellationToken, options, sourceFilesSet); + var references = getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options); + return mergeReferences(program, moduleReferences, references, moduleReferencesOfExportTarget); + } + Core2.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + function getAdjustedNode(node, options) { + if (options.use === 1) { + node = ts6.getAdjustedReferenceLocation(node); + } else if (options.use === 2) { + node = ts6.getAdjustedRenameLocation(node); + } + return node; + } + Core2.getAdjustedNode = getAdjustedNode; + function getReferencesForFileName(fileName, program, sourceFiles, sourceFilesSet) { + var _a, _b; + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts6.Set(sourceFiles.map(function(f) { + return f.fileName; + })); + } + var moduleSymbol = (_a = program.getSourceFile(fileName)) === null || _a === void 0 ? void 0 : _a.symbol; + if (moduleSymbol) { + return ((_b = getReferencedSymbolsForModule( + program, + moduleSymbol, + /*excludeImportTypeOfExportEquals*/ + false, + sourceFiles, + sourceFilesSet + )[0]) === null || _b === void 0 ? void 0 : _b.references) || ts6.emptyArray; + } + var fileIncludeReasons = program.getFileIncludeReasons(); + var referencedFile = program.getSourceFile(fileName); + return referencedFile && fileIncludeReasons && getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts6.emptyArray; + } + Core2.getReferencesForFileName = getReferencesForFileName; + function getReferencesForNonModule(referencedFile, refFileMap, program) { + var entries; + var references = refFileMap.get(referencedFile.path) || ts6.emptyArray; + for (var _i = 0, references_1 = references; _i < references_1.length; _i++) { + var ref = references_1[_i]; + if (ts6.isReferencedFile(ref)) { + var referencingFile = program.getSourceFileByPath(ref.file); + var location = ts6.getReferencedFileLocation(program.getSourceFileByPath, ref); + if (ts6.isReferenceFileLocation(location)) { + entries = ts6.append(entries, { + kind: 0, + fileName: referencingFile.fileName, + textSpan: ts6.createTextSpanFromRange(location) + }); + } + } + } + return entries; + } + function getMergedAliasedSymbolOfNamespaceExportDeclaration(node, symbol, checker) { + if (node.parent && ts6.isNamespaceExportDeclaration(node.parent)) { + var aliasedSymbol = checker.getAliasedSymbol(symbol); + var targetSymbol = checker.getMergedSymbol(aliasedSymbol); + if (aliasedSymbol !== targetSymbol) { + return targetSymbol; + } + } + return void 0; + } + function getReferencedSymbolsForModuleIfDeclaredBySourceFile(symbol, program, sourceFiles, cancellationToken, options, sourceFilesSet) { + var moduleSourceFile = symbol.flags & 1536 && symbol.declarations && ts6.find(symbol.declarations, ts6.isSourceFile); + if (!moduleSourceFile) + return void 0; + var exportEquals = symbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + var moduleReferences = getReferencedSymbolsForModule(program, symbol, !!exportEquals, sourceFiles, sourceFilesSet); + if (!exportEquals || !sourceFilesSet.has(moduleSourceFile.fileName)) + return moduleReferences; + var checker = program.getTypeChecker(); + symbol = ts6.skipAlias(exportEquals, checker); + return mergeReferences(program, moduleReferences, getReferencedSymbolsForSymbol( + symbol, + /*node*/ + void 0, + sourceFiles, + sourceFilesSet, + checker, + cancellationToken, + options + )); + } + function mergeReferences(program) { + var referencesToMerge = []; + for (var _i = 1; _i < arguments.length; _i++) { + referencesToMerge[_i - 1] = arguments[_i]; + } + var result; + for (var _a = 0, referencesToMerge_1 = referencesToMerge; _a < referencesToMerge_1.length; _a++) { + var references = referencesToMerge_1[_a]; + if (!references || !references.length) + continue; + if (!result) { + result = references; + continue; + } + var _loop_3 = function(entry2) { + if (!entry2.definition || entry2.definition.type !== 0) { + result.push(entry2); + return "continue"; + } + var symbol = entry2.definition.symbol; + var refIndex = ts6.findIndex(result, function(ref) { + return !!ref.definition && ref.definition.type === 0 && ref.definition.symbol === symbol; + }); + if (refIndex === -1) { + result.push(entry2); + return "continue"; + } + var reference = result[refIndex]; + result[refIndex] = { + definition: reference.definition, + references: reference.references.concat(entry2.references).sort(function(entry1, entry22) { + var entry1File = getSourceFileIndexOfEntry(program, entry1); + var entry2File = getSourceFileIndexOfEntry(program, entry22); + if (entry1File !== entry2File) { + return ts6.compareValues(entry1File, entry2File); + } + var entry1Span = getTextSpanOfEntry(entry1); + var entry2Span = getTextSpanOfEntry(entry22); + return entry1Span.start !== entry2Span.start ? ts6.compareValues(entry1Span.start, entry2Span.start) : ts6.compareValues(entry1Span.length, entry2Span.length); + }) + }; + }; + for (var _b = 0, references_2 = references; _b < references_2.length; _b++) { + var entry = references_2[_b]; + _loop_3(entry); + } + } + return result; + } + function getSourceFileIndexOfEntry(program, entry) { + var sourceFile = entry.kind === 0 ? program.getSourceFile(entry.fileName) : entry.node.getSourceFile(); + return program.getSourceFiles().indexOf(sourceFile); + } + function getReferencedSymbolsForModule(program, symbol, excludeImportTypeOfExportEquals, sourceFiles, sourceFilesSet) { + ts6.Debug.assert(!!symbol.valueDeclaration); + var references = ts6.mapDefined(FindAllReferences2.findModuleReferences(program, sourceFiles, symbol), function(reference) { + if (reference.kind === "import") { + var parent = reference.literal.parent; + if (ts6.isLiteralTypeNode(parent)) { + var importType = ts6.cast(parent.parent, ts6.isImportTypeNode); + if (excludeImportTypeOfExportEquals && !importType.qualifier) { + return void 0; + } + } + return nodeEntry(reference.literal); + } else { + return { + kind: 0, + fileName: reference.referencingFile.fileName, + textSpan: ts6.createTextSpanFromRange(reference.ref) + }; + } + }); + if (symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + switch (decl.kind) { + case 308: + break; + case 264: + if (sourceFilesSet.has(decl.getSourceFile().fileName)) { + references.push(nodeEntry(decl.name)); + } + break; + default: + ts6.Debug.assert(!!(symbol.flags & 33554432), "Expected a module symbol to be declared by a SourceFile or ModuleDeclaration."); + } + } + } + var exported = symbol.exports.get( + "export=" + /* InternalSymbolName.ExportEquals */ + ); + if (exported === null || exported === void 0 ? void 0 : exported.declarations) { + for (var _b = 0, _c = exported.declarations; _b < _c.length; _b++) { + var decl = _c[_b]; + var sourceFile = decl.getSourceFile(); + if (sourceFilesSet.has(sourceFile.fileName)) { + var node = ts6.isBinaryExpression(decl) && ts6.isPropertyAccessExpression(decl.left) ? decl.left.expression : ts6.isExportAssignment(decl) ? ts6.Debug.checkDefined(ts6.findChildOfKind(decl, 93, sourceFile)) : ts6.getNameOfDeclaration(decl) || decl; + references.push(nodeEntry(node)); + } + } + } + return references.length ? [{ definition: { type: 0, symbol }, references }] : ts6.emptyArray; + } + function isReadonlyTypeOperator(node) { + return node.kind === 146 && ts6.isTypeOperatorNode(node.parent) && node.parent.operator === 146; + } + function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { + if (ts6.isTypeKeyword(node.kind)) { + if (node.kind === 114 && ts6.isVoidExpression(node.parent)) { + return void 0; + } + if (node.kind === 146 && !isReadonlyTypeOperator(node)) { + return void 0; + } + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 ? isReadonlyTypeOperator : void 0); + } + if (ts6.isImportMeta(node.parent) && node.parent.name === node) { + return getAllReferencesForImportMeta(sourceFiles, cancellationToken); + } + if (ts6.isStaticModifier(node) && ts6.isClassStaticBlockDeclaration(node.parent)) { + return [{ definition: { type: 2, node }, references: [nodeEntry(node)] }]; + } + if (ts6.isJumpStatementTarget(node)) { + var labelDefinition = ts6.getTargetLabel(node.parent, node.text); + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition); + } else if (ts6.isLabelOfLabeledStatement(node)) { + return getLabelReferencesInNode(node.parent, node); + } + if (ts6.isThis(node)) { + return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); + } + if (node.kind === 106) { + return getReferencesForSuperKeyword(node); + } + return void 0; + } + function getReferencedSymbolsForSymbol(originalSymbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options) { + var symbol = node && skipPastExportOrImportSpecifierOrUnion( + originalSymbol, + node, + checker, + /*useLocalSymbolForExportSpecifier*/ + !isForRenameWithPrefixAndSuffixText(options) + ) || originalSymbol; + var searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : 7; + var result = []; + var state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : 0, checker, cancellationToken, searchMeaning, options, result); + var exportSpecifier = !isForRenameWithPrefixAndSuffixText(options) || !symbol.declarations ? void 0 : ts6.find(symbol.declarations, ts6.isExportSpecifier); + if (exportSpecifier) { + getReferencesAtExportSpecifier( + exportSpecifier.name, + symbol, + exportSpecifier, + state.createSearch( + node, + originalSymbol, + /*comingFrom*/ + void 0 + ), + state, + /*addReferencesHere*/ + true, + /*alwaysGetReferences*/ + true + ); + } else if (node && node.kind === 88 && symbol.escapedName === "default" && symbol.parent) { + addReference(node, symbol, state); + searchForImportsOfExport(node, symbol, { + exportingModuleSymbol: symbol.parent, + exportKind: 1 + /* ExportKind.Default */ + }, state); + } else { + var search = state.createSearch( + node, + symbol, + /*comingFrom*/ + void 0, + { allSearchSymbols: node ? populateSearchSymbolSet(symbol, node, checker, options.use === 2, !!options.providePrefixAndSuffixTextForRename, !!options.implementations) : [symbol] } + ); + getReferencesInContainerOrFiles(symbol, state, search); + } + return result; + } + function getReferencesInContainerOrFiles(symbol, state, search) { + var scope = getSymbolScope(symbol); + if (scope) { + getReferencesInContainer( + scope, + scope.getSourceFile(), + search, + state, + /*addReferencesHere*/ + !(ts6.isSourceFile(scope) && !ts6.contains(state.sourceFiles, scope)) + ); + } else { + for (var _i = 0, _a = state.sourceFiles; _i < _a.length; _i++) { + var sourceFile = _a[_i]; + state.cancellationToken.throwIfCancellationRequested(); + searchForName(sourceFile, search, state); + } + } + } + function getSpecialSearchKind(node) { + switch (node.kind) { + case 173: + case 135: + return 1; + case 79: + if (ts6.isClassLike(node.parent)) { + ts6.Debug.assert(node.parent.name === node); + return 2; + } + default: + return 0; + } + } + function skipPastExportOrImportSpecifierOrUnion(symbol, node, checker, useLocalSymbolForExportSpecifier) { + var parent = node.parent; + if (ts6.isExportSpecifier(parent) && useLocalSymbolForExportSpecifier) { + return getLocalSymbolForExportSpecifier(node, symbol, parent, checker); + } + return ts6.firstDefined(symbol.declarations, function(decl) { + if (!decl.parent) { + if (symbol.flags & 33554432) + return void 0; + ts6.Debug.fail("Unexpected symbol at ".concat(ts6.Debug.formatSyntaxKind(node.kind), ": ").concat(ts6.Debug.formatSymbol(symbol))); + } + return ts6.isTypeLiteralNode(decl.parent) && ts6.isUnionTypeNode(decl.parent.parent) ? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name) : void 0; + }); + } + var SpecialSearchKind; + (function(SpecialSearchKind2) { + SpecialSearchKind2[SpecialSearchKind2["None"] = 0] = "None"; + SpecialSearchKind2[SpecialSearchKind2["Constructor"] = 1] = "Constructor"; + SpecialSearchKind2[SpecialSearchKind2["Class"] = 2] = "Class"; + })(SpecialSearchKind || (SpecialSearchKind = {})); + function getNonModuleSymbolOfMergedModuleSymbol(symbol) { + if (!(symbol.flags & (1536 | 33554432))) + return void 0; + var decl = symbol.declarations && ts6.find(symbol.declarations, function(d) { + return !ts6.isSourceFile(d) && !ts6.isModuleDeclaration(d); + }); + return decl && decl.symbol; + } + var State = ( + /** @class */ + function() { + function State2(sourceFiles, sourceFilesSet, specialSearchKind, checker, cancellationToken, searchMeaning, options, result) { + this.sourceFiles = sourceFiles; + this.sourceFilesSet = sourceFilesSet; + this.specialSearchKind = specialSearchKind; + this.checker = checker; + this.cancellationToken = cancellationToken; + this.searchMeaning = searchMeaning; + this.options = options; + this.result = result; + this.inheritsFromCache = new ts6.Map(); + this.markSeenContainingTypeReference = ts6.nodeSeenTracker(); + this.markSeenReExportRHS = ts6.nodeSeenTracker(); + this.symbolIdToReferences = []; + this.sourceFileToSeenSymbols = []; + } + State2.prototype.includesSourceFile = function(sourceFile) { + return this.sourceFilesSet.has(sourceFile.fileName); + }; + State2.prototype.getImportSearches = function(exportSymbol, exportInfo) { + if (!this.importTracker) + this.importTracker = FindAllReferences2.createImportTracker(this.sourceFiles, this.sourceFilesSet, this.checker, this.cancellationToken); + return this.importTracker( + exportSymbol, + exportInfo, + this.options.use === 2 + /* FindReferencesUse.Rename */ + ); + }; + State2.prototype.createSearch = function(location, symbol, comingFrom, searchOptions) { + if (searchOptions === void 0) { + searchOptions = {}; + } + var _a = searchOptions.text, text = _a === void 0 ? ts6.stripQuotes(ts6.symbolName(ts6.getLocalSymbolForExportDefault(symbol) || getNonModuleSymbolOfMergedModuleSymbol(symbol) || symbol)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = _b === void 0 ? [symbol] : _b; + var escapedText = ts6.escapeLeadingUnderscores(text); + var parents = this.options.implementations && location ? getParentSymbolsOfPropertyAccess(location, symbol, this.checker) : void 0; + return { symbol, comingFrom, text, escapedText, parents, allSearchSymbols, includes: function(sym) { + return ts6.contains(allSearchSymbols, sym); + } }; + }; + State2.prototype.referenceAdder = function(searchSymbol) { + var symbolId = ts6.getSymbolId(searchSymbol); + var references = this.symbolIdToReferences[symbolId]; + if (!references) { + references = this.symbolIdToReferences[symbolId] = []; + this.result.push({ definition: { type: 0, symbol: searchSymbol }, references }); + } + return function(node, kind) { + return references.push(nodeEntry(node, kind)); + }; + }; + State2.prototype.addStringOrCommentReference = function(fileName, textSpan) { + this.result.push({ + definition: void 0, + references: [{ kind: 0, fileName, textSpan }] + }); + }; + State2.prototype.markSearchedSymbols = function(sourceFile, symbols) { + var sourceId = ts6.getNodeId(sourceFile); + var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = new ts6.Set()); + var anyNewSymbols = false; + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var sym = symbols_1[_i]; + anyNewSymbols = ts6.tryAddToSet(seenSymbols, ts6.getSymbolId(sym)) || anyNewSymbols; + } + return anyNewSymbols; + }; + return State2; + }() + ); + function searchForImportsOfExport(exportLocation, exportSymbol, exportInfo, state) { + var _a = state.getImportSearches(exportSymbol, exportInfo), importSearches = _a.importSearches, singleReferences = _a.singleReferences, indirectUsers = _a.indirectUsers; + if (singleReferences.length) { + var addRef = state.referenceAdder(exportSymbol); + for (var _i = 0, singleReferences_1 = singleReferences; _i < singleReferences_1.length; _i++) { + var singleRef = singleReferences_1[_i]; + if (shouldAddSingleReference(singleRef, state)) + addRef(singleRef); + } + } + for (var _b = 0, importSearches_1 = importSearches; _b < importSearches_1.length; _b++) { + var _c = importSearches_1[_b], importLocation = _c[0], importSymbol = _c[1]; + getReferencesInSourceFile(importLocation.getSourceFile(), state.createSearch( + importLocation, + importSymbol, + 1 + /* ImportExport.Export */ + ), state); + } + if (indirectUsers.length) { + var indirectSearch = void 0; + switch (exportInfo.exportKind) { + case 0: + indirectSearch = state.createSearch( + exportLocation, + exportSymbol, + 1 + /* ImportExport.Export */ + ); + break; + case 1: + indirectSearch = state.options.use === 2 ? void 0 : state.createSearch(exportLocation, exportSymbol, 1, { text: "default" }); + break; + case 2: + break; + } + if (indirectSearch) { + for (var _d = 0, indirectUsers_1 = indirectUsers; _d < indirectUsers_1.length; _d++) { + var indirectUser = indirectUsers_1[_d]; + searchForName(indirectUser, indirectSearch, state); + } + } + } + } + function eachExportReference(sourceFiles, checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName, isDefaultExport, cb) { + var importTracker = FindAllReferences2.createImportTracker(sourceFiles, new ts6.Set(sourceFiles.map(function(f) { + return f.fileName; + })), checker, cancellationToken); + var _a = importTracker( + exportSymbol, + { exportKind: isDefaultExport ? 1 : 0, exportingModuleSymbol }, + /*isForRename*/ + false + ), importSearches = _a.importSearches, indirectUsers = _a.indirectUsers, singleReferences = _a.singleReferences; + for (var _i = 0, importSearches_2 = importSearches; _i < importSearches_2.length; _i++) { + var importLocation = importSearches_2[_i][0]; + cb(importLocation); + } + for (var _b = 0, singleReferences_2 = singleReferences; _b < singleReferences_2.length; _b++) { + var singleReference = singleReferences_2[_b]; + if (ts6.isIdentifier(singleReference) && ts6.isImportTypeNode(singleReference.parent)) { + cb(singleReference); + } + } + for (var _c = 0, indirectUsers_2 = indirectUsers; _c < indirectUsers_2.length; _c++) { + var indirectUser = indirectUsers_2[_c]; + for (var _d = 0, _e = getPossibleSymbolReferenceNodes(indirectUser, isDefaultExport ? "default" : exportName); _d < _e.length; _d++) { + var node = _e[_d]; + var symbol = checker.getSymbolAtLocation(node); + var hasExportAssignmentDeclaration = ts6.some(symbol === null || symbol === void 0 ? void 0 : symbol.declarations, function(d) { + return ts6.tryCast(d, ts6.isExportAssignment) ? true : false; + }); + if (ts6.isIdentifier(node) && !ts6.isImportOrExportSpecifier(node.parent) && (symbol === exportSymbol || hasExportAssignmentDeclaration)) { + cb(node); + } + } + } + } + Core2.eachExportReference = eachExportReference; + function shouldAddSingleReference(singleRef, state) { + if (!hasMatchingMeaning(singleRef, state)) + return false; + if (state.options.use !== 2) + return true; + if (!ts6.isIdentifier(singleRef)) + return false; + return !(ts6.isImportOrExportSpecifier(singleRef.parent) && singleRef.escapedText === "default"); + } + function searchForImportedSymbol(symbol, state) { + if (!symbol.declarations) + return; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var exportingFile = declaration.getSourceFile(); + getReferencesInSourceFile(exportingFile, state.createSearch( + declaration, + symbol, + 0 + /* ImportExport.Import */ + ), state, state.includesSourceFile(exportingFile)); + } + } + function searchForName(sourceFile, search, state) { + if (ts6.getNameTable(sourceFile).get(search.escapedText) !== void 0) { + getReferencesInSourceFile(sourceFile, search, state); + } + } + function getPropertySymbolOfDestructuringAssignment(location, checker) { + return ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) ? checker.getPropertySymbolOfDestructuringAssignment(location) : void 0; + } + function getSymbolScope(symbol) { + var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 215 || valueDeclaration.kind === 228)) { + return valueDeclaration; + } + if (!declarations) { + return void 0; + } + if (flags & (4 | 8192)) { + var privateDeclaration = ts6.find(declarations, function(d) { + return ts6.hasEffectiveModifier( + d, + 8 + /* ModifierFlags.Private */ + ) || ts6.isPrivateIdentifierClassElementDeclaration(d); + }); + if (privateDeclaration) { + return ts6.getAncestor( + privateDeclaration, + 260 + /* SyntaxKind.ClassDeclaration */ + ); + } + return void 0; + } + if (declarations.some(ts6.isObjectBindingElementWithoutPropertyName)) { + return void 0; + } + var exposedByParent = parent && !(symbol.flags & 262144); + if (exposedByParent && !(ts6.isExternalModuleSymbol(parent) && !parent.globalExports)) { + return void 0; + } + var scope; + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; + var container = ts6.getContainerNode(declaration); + if (scope && scope !== container) { + return void 0; + } + if (!container || container.kind === 308 && !ts6.isExternalOrCommonJsModule(container)) { + return void 0; + } + scope = container; + if (ts6.isFunctionExpression(scope)) { + var next = void 0; + while (next = ts6.getNextJSDocCommentLocation(scope)) { + scope = next; + } + } + } + return exposedByParent ? scope.getSourceFile() : scope; + } + function isSymbolReferencedInFile(definition, checker, sourceFile, searchContainer) { + if (searchContainer === void 0) { + searchContainer = sourceFile; + } + return eachSymbolReferenceInFile(definition, checker, sourceFile, function() { + return true; + }, searchContainer) || false; + } + Core2.isSymbolReferencedInFile = isSymbolReferencedInFile; + function eachSymbolReferenceInFile(definition, checker, sourceFile, cb, searchContainer) { + if (searchContainer === void 0) { + searchContainer = sourceFile; + } + var symbol = ts6.isParameterPropertyDeclaration(definition.parent, definition.parent.parent) ? ts6.first(checker.getSymbolsOfParameterPropertyDeclaration(definition.parent, definition.text)) : checker.getSymbolAtLocation(definition); + if (!symbol) + return void 0; + for (var _i = 0, _a = getPossibleSymbolReferenceNodes(sourceFile, symbol.name, searchContainer); _i < _a.length; _i++) { + var token = _a[_i]; + if (!ts6.isIdentifier(token) || token === definition || token.escapedText !== definition.escapedText) + continue; + var referenceSymbol = checker.getSymbolAtLocation(token); + if (referenceSymbol === symbol || checker.getShorthandAssignmentValueSymbol(token.parent) === symbol || ts6.isExportSpecifier(token.parent) && getLocalSymbolForExportSpecifier(token, referenceSymbol, token.parent, checker) === symbol) { + var res = cb(token); + if (res) + return res; + } + } + } + Core2.eachSymbolReferenceInFile = eachSymbolReferenceInFile; + function getTopMostDeclarationNamesInFile(declarationName, sourceFile) { + var candidates = ts6.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function(name) { + return !!ts6.getDeclarationFromName(name); + }); + return candidates.reduce(function(topMost, decl) { + var depth = getDepth(decl); + if (!ts6.some(topMost.declarationNames) || depth === topMost.depth) { + topMost.declarationNames.push(decl); + topMost.depth = depth; + } else if (depth < topMost.depth) { + topMost.declarationNames = [decl]; + topMost.depth = depth; + } + return topMost; + }, { depth: Infinity, declarationNames: [] }).declarationNames; + function getDepth(declaration) { + var depth = 0; + while (declaration) { + declaration = ts6.getContainerNode(declaration); + depth++; + } + return depth; + } + } + Core2.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile; + function someSignatureUsage(signature, sourceFiles, checker, cb) { + if (!signature.name || !ts6.isIdentifier(signature.name)) + return false; + var symbol = ts6.Debug.checkDefined(checker.getSymbolAtLocation(signature.name)); + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; + for (var _a = 0, _b = getPossibleSymbolReferenceNodes(sourceFile, symbol.name); _a < _b.length; _a++) { + var name = _b[_a]; + if (!ts6.isIdentifier(name) || name === signature.name || name.escapedText !== signature.name.escapedText) + continue; + var called = ts6.climbPastPropertyAccess(name); + var call = ts6.isCallExpression(called.parent) && called.parent.expression === called ? called.parent : void 0; + var referenceSymbol = checker.getSymbolAtLocation(name); + if (referenceSymbol && checker.getRootSymbols(referenceSymbol).some(function(s) { + return s === symbol; + })) { + if (cb(name, call)) { + return true; + } + } + } + } + return false; + } + Core2.someSignatureUsage = someSignatureUsage; + function getPossibleSymbolReferenceNodes(sourceFile, symbolName, container) { + if (container === void 0) { + container = sourceFile; + } + return getPossibleSymbolReferencePositions(sourceFile, symbolName, container).map(function(pos) { + return ts6.getTouchingPropertyName(sourceFile, pos); + }); + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, container) { + if (container === void 0) { + container = sourceFile; + } + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, container.pos); + while (position >= 0) { + if (position > container.end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts6.isIdentifierPart( + text.charCodeAt(position - 1), + 99 + /* ScriptTarget.Latest */ + )) && (endPosition === sourceLength || !ts6.isIdentifierPart( + text.charCodeAt(endPosition), + 99 + /* ScriptTarget.Latest */ + ))) { + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel) { + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var references = ts6.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), function(node) { + return node === targetLabel || ts6.isJumpStatementTarget(node) && ts6.getTargetLabel(node, labelName) === targetLabel ? nodeEntry(node) : void 0; + }); + return [{ definition: { type: 1, node: targetLabel }, references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + switch (node.kind) { + case 80: + if (ts6.isJSDocMemberName(node.parent)) { + return true; + } + case 79: + return node.text.length === searchSymbolName.length; + case 14: + case 10: { + var str = node; + return (ts6.isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || ts6.isNameOfModuleDeclaration(node) || ts6.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts6.isCallExpression(node.parent) && ts6.isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node) && str.text.length === searchSymbolName.length; + } + case 8: + return ts6.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length; + case 88: + return "default".length === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForImportMeta(sourceFiles, cancellationToken) { + var references = ts6.flatMap(sourceFiles, function(sourceFile) { + cancellationToken.throwIfCancellationRequested(); + return ts6.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "meta", sourceFile), function(node) { + var parent = node.parent; + if (ts6.isImportMeta(parent)) { + return nodeEntry(parent); + } + }); + }); + return references.length ? [{ definition: { type: 2, node: references[0].node }, references }] : void 0; + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken, filter) { + var references = ts6.flatMap(sourceFiles, function(sourceFile) { + cancellationToken.throwIfCancellationRequested(); + return ts6.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, ts6.tokenToString(keywordKind), sourceFile), function(referenceLocation) { + if (referenceLocation.kind === keywordKind && (!filter || filter(referenceLocation))) { + return nodeEntry(referenceLocation); + } + }); + }); + return references.length ? [{ definition: { type: 2, node: references[0].node }, references }] : void 0; + } + function getReferencesInSourceFile(sourceFile, search, state, addReferencesHere) { + if (addReferencesHere === void 0) { + addReferencesHere = true; + } + state.cancellationToken.throwIfCancellationRequested(); + return getReferencesInContainer(sourceFile, sourceFile, search, state, addReferencesHere); + } + function getReferencesInContainer(container, sourceFile, search, state, addReferencesHere) { + if (!state.markSearchedSymbols(sourceFile, search.allSearchSymbols)) { + return; + } + for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container); _i < _a.length; _i++) { + var position = _a[_i]; + getReferencesAtLocation(sourceFile, position, search, state, addReferencesHere); + } + } + function hasMatchingMeaning(referenceLocation, state) { + return !!(ts6.getMeaningFromLocation(referenceLocation) & state.searchMeaning); + } + function getReferencesAtLocation(sourceFile, position, search, state, addReferencesHere) { + var referenceLocation = ts6.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, search.text)) { + if (!state.options.implementations && (state.options.findInStrings && ts6.isInString(sourceFile, position) || state.options.findInComments && ts6.isInNonReferenceComment(sourceFile, position))) { + state.addStringOrCommentReference(sourceFile.fileName, ts6.createTextSpan(position, search.text.length)); + } + return; + } + if (!hasMatchingMeaning(referenceLocation, state)) + return; + var referenceSymbol = state.checker.getSymbolAtLocation(referenceLocation); + if (!referenceSymbol) { + return; + } + var parent = referenceLocation.parent; + if (ts6.isImportSpecifier(parent) && parent.propertyName === referenceLocation) { + return; + } + if (ts6.isExportSpecifier(parent)) { + ts6.Debug.assert( + referenceLocation.kind === 79 + /* SyntaxKind.Identifier */ + ); + getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere); + return; + } + var relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state); + if (!relatedSymbol) { + getReferenceForShorthandProperty(referenceSymbol, search, state); + return; + } + switch (state.specialSearchKind) { + case 0: + if (addReferencesHere) + addReference(referenceLocation, relatedSymbol, state); + break; + case 1: + addConstructorReferences(referenceLocation, sourceFile, search, state); + break; + case 2: + addClassStaticThisReferences(referenceLocation, search, state); + break; + default: + ts6.Debug.assertNever(state.specialSearchKind); + } + if (ts6.isInJSFile(referenceLocation) && referenceLocation.parent.kind === 205 && ts6.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { + referenceSymbol = referenceLocation.parent.symbol; + if (!referenceSymbol) + return; + } + getImportOrExportReferences(referenceLocation, referenceSymbol, search, state); + } + function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state, addReferencesHere, alwaysGetReferences) { + ts6.Debug.assert(!alwaysGetReferences || !!state.options.providePrefixAndSuffixTextForRename, "If alwaysGetReferences is true, then prefix/suffix text must be enabled"); + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + var exportDeclaration = parent.parent; + var localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); + if (!alwaysGetReferences && !search.includes(localSymbol)) { + return; + } + if (!propertyName) { + if (!(state.options.use === 2 && name.escapedText === "default")) { + addRef(); + } + } else if (referenceLocation === propertyName) { + if (!exportDeclaration.moduleSpecifier) { + addRef(); + } + if (addReferencesHere && state.options.use !== 2 && state.markSeenReExportRHS(name)) { + addReference(name, ts6.Debug.checkDefined(exportSpecifier.symbol), state); + } + } else { + if (state.markSeenReExportRHS(referenceLocation)) { + addRef(); + } + } + if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) { + var isDefaultExport = referenceLocation.originalKeywordKind === 88 || exportSpecifier.name.originalKeywordKind === 88; + var exportKind = isDefaultExport ? 1 : 0; + var exportSymbol = ts6.Debug.checkDefined(exportSpecifier.symbol); + var exportInfo = FindAllReferences2.getExportInfo(exportSymbol, exportKind, state.checker); + if (exportInfo) { + searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo, state); + } + } + if (search.comingFrom !== 1 && exportDeclaration.moduleSpecifier && !propertyName && !isForRenameWithPrefixAndSuffixText(state.options)) { + var imported = state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); + if (imported) + searchForImportedSymbol(imported, state); + } + function addRef() { + if (addReferencesHere) + addReference(referenceLocation, localSymbol, state); + } + } + function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { + return isExportSpecifierAlias(referenceLocation, exportSpecifier) && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) || referenceSymbol; + } + function isExportSpecifierAlias(referenceLocation, exportSpecifier) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + ts6.Debug.assert(propertyName === referenceLocation || name === referenceLocation); + if (propertyName) { + return propertyName === referenceLocation; + } else { + return !parent.parent.moduleSpecifier; + } + } + function getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) { + var importOrExport = FindAllReferences2.getImportOrExportSymbol( + referenceLocation, + referenceSymbol, + state.checker, + search.comingFrom === 1 + /* ImportExport.Export */ + ); + if (!importOrExport) + return; + var symbol = importOrExport.symbol; + if (importOrExport.kind === 0) { + if (!isForRenameWithPrefixAndSuffixText(state.options)) { + searchForImportedSymbol(symbol, state); + } + } else { + searchForImportsOfExport(referenceLocation, symbol, importOrExport.exportInfo, state); + } + } + function getReferenceForShorthandProperty(_a, search, state) { + var flags = _a.flags, valueDeclaration = _a.valueDeclaration; + var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); + var name = valueDeclaration && ts6.getNameOfDeclaration(valueDeclaration); + if (!(flags & 33554432) && name && search.includes(shorthandValueSymbol)) { + addReference(name, shorthandValueSymbol, state); + } + } + function addReference(referenceLocation, relatedSymbol, state) { + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: void 0, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; + if (state.options.use === 2 && referenceLocation.kind === 88) { + return; + } + var addRef = state.referenceAdder(symbol); + if (state.options.implementations) { + addImplementationReferences(referenceLocation, addRef, state); + } else { + addRef(referenceLocation, kind); + } + } + function addConstructorReferences(referenceLocation, sourceFile, search, state) { + if (ts6.isNewExpressionTarget(referenceLocation)) { + addReference(referenceLocation, search.symbol, state); + } + var pusher = function() { + return state.referenceAdder(search.symbol); + }; + if (ts6.isClassLike(referenceLocation.parent)) { + ts6.Debug.assert(referenceLocation.kind === 88 || referenceLocation.parent.name === referenceLocation); + findOwnConstructorReferences(search.symbol, sourceFile, pusher()); + } else { + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending) { + findSuperConstructorAccesses(classExtending, pusher()); + findInheritedConstructorReferences(classExtending, state); + } + } + } + function addClassStaticThisReferences(referenceLocation, search, state) { + addReference(referenceLocation, search.symbol, state); + var classLike = referenceLocation.parent; + if (state.options.use === 2 || !ts6.isClassLike(classLike)) + return; + ts6.Debug.assert(classLike.name === referenceLocation); + var addRef = state.referenceAdder(search.symbol); + for (var _i = 0, _a = classLike.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (!(ts6.isMethodOrAccessor(member) && ts6.isStatic(member))) { + continue; + } + if (member.body) { + member.body.forEachChild(function cb(node) { + if (node.kind === 108) { + addRef(node); + } else if (!ts6.isFunctionLike(node) && !ts6.isClassLike(node)) { + node.forEachChild(cb); + } + }); + } + } + } + function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { + var constructorSymbol = getClassConstructorSymbol(classSymbol); + if (constructorSymbol && constructorSymbol.declarations) { + for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts6.findChildOfKind(decl, 135, sourceFile); + ts6.Debug.assert(decl.kind === 173 && !!ctrKeyword); + addNode(ctrKeyword); + } + } + if (classSymbol.exports) { + classSymbol.exports.forEach(function(member) { + var decl2 = member.valueDeclaration; + if (decl2 && decl2.kind === 171) { + var body = decl2.body; + if (body) { + forEachDescendantOfKind(body, 108, function(thisKeyword) { + if (ts6.isNewExpressionTarget(thisKeyword)) { + addNode(thisKeyword); + } + }); + } + } + }); + } + } + function getClassConstructorSymbol(classSymbol) { + return classSymbol.members && classSymbol.members.get( + "__constructor" + /* InternalSymbolName.Constructor */ + ); + } + function findSuperConstructorAccesses(classDeclaration, addNode) { + var constructor = getClassConstructorSymbol(classDeclaration.symbol); + if (!(constructor && constructor.declarations)) { + return; + } + for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts6.Debug.assert( + decl.kind === 173 + /* SyntaxKind.Constructor */ + ); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 106, function(node) { + if (ts6.isCallExpressionTarget(node)) { + addNode(node); + } + }); + } + } + } + function hasOwnConstructor(classDeclaration) { + return !!getClassConstructorSymbol(classDeclaration.symbol); + } + function findInheritedConstructorReferences(classDeclaration, state) { + if (hasOwnConstructor(classDeclaration)) + return; + var classSymbol = classDeclaration.symbol; + var search = state.createSearch( + /*location*/ + void 0, + classSymbol, + /*comingFrom*/ + void 0 + ); + getReferencesInContainerOrFiles(classSymbol, state, search); + } + function addImplementationReferences(refNode, addReference2, state) { + if (ts6.isDeclarationName(refNode) && isImplementation(refNode.parent)) { + addReference2(refNode); + return; + } + if (refNode.kind !== 79) { + return; + } + if (refNode.parent.kind === 300) { + getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2); + } + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + addReference2(containingClass); + return; + } + var typeNode = ts6.findAncestor(refNode, function(a) { + return !ts6.isQualifiedName(a.parent) && !ts6.isTypeNode(a.parent) && !ts6.isTypeElement(a.parent); + }); + var typeHavingNode = typeNode.parent; + if (ts6.hasType(typeHavingNode) && typeHavingNode.type === typeNode && state.markSeenContainingTypeReference(typeHavingNode)) { + if (ts6.hasInitializer(typeHavingNode)) { + addIfImplementation(typeHavingNode.initializer); + } else if (ts6.isFunctionLike(typeHavingNode) && typeHavingNode.body) { + var body = typeHavingNode.body; + if (body.kind === 238) { + ts6.forEachReturnStatement(body, function(returnStatement) { + if (returnStatement.expression) + addIfImplementation(returnStatement.expression); + }); + } else { + addIfImplementation(body); + } + } else if (ts6.isAssertionExpression(typeHavingNode)) { + addIfImplementation(typeHavingNode.expression); + } + } + function addIfImplementation(e) { + if (isImplementationExpression(e)) + addReference2(e); + } + } + function getContainingClassIfInHeritageClause(node) { + return ts6.isIdentifier(node) || ts6.isPropertyAccessExpression(node) ? getContainingClassIfInHeritageClause(node.parent) : ts6.isExpressionWithTypeArguments(node) ? ts6.tryCast(node.parent.parent, ts6.isClassLike) : void 0; + } + function isImplementationExpression(node) { + switch (node.kind) { + case 214: + return isImplementationExpression(node.expression); + case 216: + case 215: + case 207: + case 228: + case 206: + return true; + default: + return false; + } + } + function explicitlyInheritsFrom(symbol, parent, cachedResults, checker) { + if (symbol === parent) { + return true; + } + var key = ts6.getSymbolId(symbol) + "," + ts6.getSymbolId(parent); + var cached = cachedResults.get(key); + if (cached !== void 0) { + return cached; + } + cachedResults.set(key, false); + var inherits = !!symbol.declarations && symbol.declarations.some(function(declaration) { + return ts6.getAllSuperTypeNodes(declaration).some(function(typeReference) { + var type = checker.getTypeAtLocation(typeReference); + return !!type && !!type.symbol && explicitlyInheritsFrom(type.symbol, parent, cachedResults, checker); + }); + }); + cachedResults.set(key, inherits); + return inherits; + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts6.getSuperContainer( + superKeyword, + /*stopOnFunctions*/ + false + ); + if (!searchSpaceNode) { + return void 0; + } + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 169: + case 168: + case 171: + case 170: + case 173: + case 174: + case 175: + staticFlag &= ts6.getSyntacticModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + default: + return void 0; + } + var sourceFile = searchSpaceNode.getSourceFile(); + var references = ts6.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function(node) { + if (node.kind !== 106) { + return; + } + var container = ts6.getSuperContainer( + node, + /*stopOnFunctions*/ + false + ); + return container && ts6.isStatic(container) === !!staticFlag && container.parent.symbol === searchSpaceNode.symbol ? nodeEntry(node) : void 0; + }); + return [{ definition: { type: 0, symbol: searchSpaceNode.symbol }, references }]; + } + function isParameterName(node) { + return node.kind === 79 && node.parent.kind === 166 && node.parent.name === node; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { + var searchSpaceNode = ts6.getThisContainer( + thisOrSuperKeyword, + /* includeArrowFunctions */ + false + ); + var staticFlag = 32; + switch (searchSpaceNode.kind) { + case 171: + case 170: + if (ts6.isObjectLiteralMethod(searchSpaceNode)) { + staticFlag &= ts6.getSyntacticModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + } + case 169: + case 168: + case 173: + case 174: + case 175: + staticFlag &= ts6.getSyntacticModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; + break; + case 308: + if (ts6.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { + return void 0; + } + case 259: + case 215: + break; + default: + return void 0; + } + var references = ts6.flatMap(searchSpaceNode.kind === 308 ? sourceFiles : [searchSpaceNode.getSourceFile()], function(sourceFile) { + cancellationToken.throwIfCancellationRequested(); + return getPossibleSymbolReferenceNodes(sourceFile, "this", ts6.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function(node) { + if (!ts6.isThis(node)) { + return false; + } + var container = ts6.getThisContainer( + node, + /* includeArrowFunctions */ + false + ); + switch (searchSpaceNode.kind) { + case 215: + case 259: + return searchSpaceNode.symbol === container.symbol; + case 171: + case 170: + return ts6.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; + case 228: + case 260: + case 207: + return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts6.isStatic(container) === !!staticFlag; + case 308: + return container.kind === 308 && !ts6.isExternalModule(container) && !isParameterName(node); + } + }); + }).map(function(n) { + return nodeEntry(n); + }); + var thisParameter = ts6.firstDefined(references, function(r) { + return ts6.isParameter(r.node.parent) ? r.node : void 0; + }); + return [{ + definition: { type: 3, node: thisParameter || thisOrSuperKeyword }, + references + }]; + } + function getReferencesForStringLiteral(node, sourceFiles, checker, cancellationToken) { + var type = ts6.getContextualTypeFromParentOrAncestorTypeNode(node, checker); + var references = ts6.flatMap(sourceFiles, function(sourceFile) { + cancellationToken.throwIfCancellationRequested(); + return ts6.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, node.text), function(ref) { + if (ts6.isStringLiteralLike(ref) && ref.text === node.text) { + if (type) { + var refType = ts6.getContextualTypeFromParentOrAncestorTypeNode(ref, checker); + if (type !== checker.getStringType() && type === refType) { + return nodeEntry( + ref, + 2 + /* EntryKind.StringLiteral */ + ); + } + } else { + return ts6.isNoSubstitutionTemplateLiteral(ref) && !ts6.rangeIsOnSingleLine(ref, sourceFile) ? void 0 : nodeEntry( + ref, + 2 + /* EntryKind.StringLiteral */ + ); + } + } + }); + }); + return [{ + definition: { type: 4, node }, + references + }]; + } + function populateSearchSymbolSet(symbol, location, checker, isForRename, providePrefixAndSuffixText, implementations) { + var result = []; + forEachRelatedSymbol( + symbol, + location, + checker, + isForRename, + !(isForRename && providePrefixAndSuffixText), + function(sym, root, base) { + if (base) { + if (isStaticSymbol(symbol) !== isStaticSymbol(base)) { + base = void 0; + } + } + result.push(base || root || sym); + }, + // when try to find implementation, implementations is true, and not allowed to find base class + /*allowBaseTypes*/ + function() { + return !implementations; + } + ); + return result; + } + function forEachRelatedSymbol(symbol, location, checker, isForRenamePopulateSearchSymbolSet, onlyIncludeBindingElementAtReferenceLocation, cbSymbol, allowBaseTypes) { + var containingObjectLiteralElement = ts6.getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement) { + var shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol && isForRenamePopulateSearchSymbolSet) { + return cbSymbol( + shorthandValueSymbol, + /*rootSymbol*/ + void 0, + /*baseSymbol*/ + void 0, + 3 + /* EntryKind.SearchedLocalFoundProperty */ + ); + } + var contextualType = checker.getContextualType(containingObjectLiteralElement.parent); + var res_1 = contextualType && ts6.firstDefined(ts6.getPropertySymbolsFromContextualType( + containingObjectLiteralElement, + checker, + contextualType, + /*unionSymbolOk*/ + true + ), function(sym) { + return fromRoot( + sym, + 4 + /* EntryKind.SearchedPropertyFoundLocal */ + ); + }); + if (res_1) + return res_1; + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); + var res1 = propertySymbol && cbSymbol( + propertySymbol, + /*rootSymbol*/ + void 0, + /*baseSymbol*/ + void 0, + 4 + /* EntryKind.SearchedPropertyFoundLocal */ + ); + if (res1) + return res1; + var res2 = shorthandValueSymbol && cbSymbol( + shorthandValueSymbol, + /*rootSymbol*/ + void 0, + /*baseSymbol*/ + void 0, + 3 + /* EntryKind.SearchedLocalFoundProperty */ + ); + if (res2) + return res2; + } + var aliasedSymbol = getMergedAliasedSymbolOfNamespaceExportDeclaration(location, symbol, checker); + if (aliasedSymbol) { + var res_2 = cbSymbol( + aliasedSymbol, + /*rootSymbol*/ + void 0, + /*baseSymbol*/ + void 0, + 1 + /* EntryKind.Node */ + ); + if (res_2) + return res_2; + } + var res = fromRoot(symbol); + if (res) + return res; + if (symbol.valueDeclaration && ts6.isParameterPropertyDeclaration(symbol.valueDeclaration, symbol.valueDeclaration.parent)) { + var paramProps = checker.getSymbolsOfParameterPropertyDeclaration(ts6.cast(symbol.valueDeclaration, ts6.isParameter), symbol.name); + ts6.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1) && !!(paramProps[1].flags & 4)); + return fromRoot(symbol.flags & 1 ? paramProps[1] : paramProps[0]); + } + var exportSpecifier = ts6.getDeclarationOfKind( + symbol, + 278 + /* SyntaxKind.ExportSpecifier */ + ); + if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { + var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); + if (localSymbol) { + var res_3 = cbSymbol( + localSymbol, + /*rootSymbol*/ + void 0, + /*baseSymbol*/ + void 0, + 1 + /* EntryKind.Node */ + ); + if (res_3) + return res_3; + } + } + if (!isForRenamePopulateSearchSymbolSet) { + var bindingElementPropertySymbol = void 0; + if (onlyIncludeBindingElementAtReferenceLocation) { + bindingElementPropertySymbol = ts6.isObjectBindingElementWithoutPropertyName(location.parent) ? ts6.getPropertySymbolFromBindingElement(checker, location.parent) : void 0; + } else { + bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); + } + return bindingElementPropertySymbol && fromRoot( + bindingElementPropertySymbol, + 4 + /* EntryKind.SearchedPropertyFoundLocal */ + ); + } + ts6.Debug.assert(isForRenamePopulateSearchSymbolSet); + var includeOriginalSymbolOfBindingElement = onlyIncludeBindingElementAtReferenceLocation; + if (includeOriginalSymbolOfBindingElement) { + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); + return bindingElementPropertySymbol && fromRoot( + bindingElementPropertySymbol, + 4 + /* EntryKind.SearchedPropertyFoundLocal */ + ); + } + function fromRoot(sym, kind) { + return ts6.firstDefined(checker.getRootSymbols(sym), function(rootSymbol) { + return cbSymbol( + sym, + rootSymbol, + /*baseSymbol*/ + void 0, + kind + ) || (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64) && allowBaseTypes(rootSymbol) ? getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, function(base) { + return cbSymbol(sym, rootSymbol, base, kind); + }) : void 0); + }); + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol2, checker2) { + var bindingElement = ts6.getDeclarationOfKind( + symbol2, + 205 + /* SyntaxKind.BindingElement */ + ); + if (bindingElement && ts6.isObjectBindingElementWithoutPropertyName(bindingElement)) { + return ts6.getPropertySymbolFromBindingElement(checker2, bindingElement); + } + } + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, cb) { + var seen = new ts6.Map(); + return recur(symbol); + function recur(symbol2) { + if (!(symbol2.flags & (32 | 64)) || !ts6.addToSeen(seen, ts6.getSymbolId(symbol2))) + return; + return ts6.firstDefined(symbol2.declarations, function(declaration) { + return ts6.firstDefined(ts6.getAllSuperTypeNodes(declaration), function(typeReference) { + var type = checker.getTypeAtLocation(typeReference); + var propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); + return type && propertySymbol && (ts6.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)); + }); + }); + } + } + function isStaticSymbol(symbol) { + if (!symbol.valueDeclaration) + return false; + var modifierFlags = ts6.getEffectiveModifierFlags(symbol.valueDeclaration); + return !!(modifierFlags & 32); + } + function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) { + var checker = state.checker; + return forEachRelatedSymbol( + referenceSymbol, + referenceLocation, + checker, + /*isForRenamePopulateSearchSymbolSet*/ + false, + /*onlyIncludeBindingElementAtReferenceLocation*/ + state.options.use !== 2 || !!state.options.providePrefixAndSuffixTextForRename, + function(sym, rootSymbol, baseSymbol, kind) { + if (baseSymbol) { + if (isStaticSymbol(referenceSymbol) !== isStaticSymbol(baseSymbol)) { + baseSymbol = void 0; + } + } + return search.includes(baseSymbol || rootSymbol || sym) ? { symbol: rootSymbol && !(ts6.getCheckFlags(sym) & 6) ? rootSymbol : sym, kind } : void 0; + }, + /*allowBaseTypes*/ + function(rootSymbol) { + return !(search.parents && !search.parents.some(function(parent) { + return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker); + })); + } + ); + } + function getIntersectingMeaningFromDeclarations(node, symbol) { + var meaning = ts6.getMeaningFromLocation(node); + var declarations = symbol.declarations; + if (declarations) { + var lastIterationMeaning = void 0; + do { + lastIterationMeaning = meaning; + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + var declarationMeaning = ts6.getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; + } + Core2.getIntersectingMeaningFromDeclarations = getIntersectingMeaningFromDeclarations; + function isImplementation(node) { + return !!(node.flags & 16777216) ? !(ts6.isInterfaceDeclaration(node) || ts6.isTypeAliasDeclaration(node)) : ts6.isVariableLike(node) ? ts6.hasInitializer(node) : ts6.isFunctionLikeDeclaration(node) ? !!node.body : ts6.isClassLike(node) || ts6.isModuleOrEnumDeclaration(node); + } + function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference2) { + var refSymbol = checker.getSymbolAtLocation(node); + var shorthandSymbol = checker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); + if (shorthandSymbol) { + for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts6.getMeaningFromDeclaration(declaration) & 1) { + addReference2(declaration); + } + } + } + } + Core2.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; + function forEachDescendantOfKind(node, kind, action) { + ts6.forEachChild(node, function(child) { + if (child.kind === kind) { + action(child); + } + forEachDescendantOfKind(child, kind, action); + }); + } + function tryGetClassByExtendingIdentifier(node) { + return ts6.tryGetClassExtendingExpressionWithTypeArguments(ts6.climbPastPropertyAccess(node).parent); + } + function getParentSymbolsOfPropertyAccess(location, symbol, checker) { + var propertyAccessExpression = ts6.isRightSideOfPropertyAccess(location) ? location.parent : void 0; + var lhsType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression); + var res = ts6.mapDefined(lhsType && (lhsType.isUnionOrIntersection() ? lhsType.types : lhsType.symbol === symbol.parent ? void 0 : [lhsType]), function(t) { + return t.symbol && t.symbol.flags & (32 | 64) ? t.symbol : void 0; + }); + return res.length === 0 ? void 0 : res; + } + function isForRenameWithPrefixAndSuffixText(options) { + return options.use === 2 && options.providePrefixAndSuffixTextForRename; + } + })(Core = FindAllReferences2.Core || (FindAllReferences2.Core = {})); + })(FindAllReferences = ts6.FindAllReferences || (ts6.FindAllReferences = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var CallHierarchy; + (function(CallHierarchy2) { + function isNamedExpression(node) { + return (ts6.isFunctionExpression(node) || ts6.isClassExpression(node)) && ts6.isNamedDeclaration(node); + } + function isConstNamedExpression(node) { + return (ts6.isFunctionExpression(node) || ts6.isArrowFunction(node) || ts6.isClassExpression(node)) && ts6.isVariableDeclaration(node.parent) && node === node.parent.initializer && ts6.isIdentifier(node.parent.name) && !!(ts6.getCombinedNodeFlags(node.parent) & 2); + } + function isPossibleCallHierarchyDeclaration(node) { + return ts6.isSourceFile(node) || ts6.isModuleDeclaration(node) || ts6.isFunctionDeclaration(node) || ts6.isFunctionExpression(node) || ts6.isClassDeclaration(node) || ts6.isClassExpression(node) || ts6.isClassStaticBlockDeclaration(node) || ts6.isMethodDeclaration(node) || ts6.isMethodSignature(node) || ts6.isGetAccessorDeclaration(node) || ts6.isSetAccessorDeclaration(node); + } + function isValidCallHierarchyDeclaration(node) { + return ts6.isSourceFile(node) || ts6.isModuleDeclaration(node) && ts6.isIdentifier(node.name) || ts6.isFunctionDeclaration(node) || ts6.isClassDeclaration(node) || ts6.isClassStaticBlockDeclaration(node) || ts6.isMethodDeclaration(node) || ts6.isMethodSignature(node) || ts6.isGetAccessorDeclaration(node) || ts6.isSetAccessorDeclaration(node) || isNamedExpression(node) || isConstNamedExpression(node); + } + function getCallHierarchyDeclarationReferenceNode(node) { + if (ts6.isSourceFile(node)) + return node; + if (ts6.isNamedDeclaration(node)) + return node.name; + if (isConstNamedExpression(node)) + return node.parent.name; + return ts6.Debug.checkDefined(node.modifiers && ts6.find(node.modifiers, isDefaultModifier)); + } + function isDefaultModifier(node) { + return node.kind === 88; + } + function getSymbolOfCallHierarchyDeclaration(typeChecker, node) { + var location = getCallHierarchyDeclarationReferenceNode(node); + return location && typeChecker.getSymbolAtLocation(location); + } + function getCallHierarchyItemName(program, node) { + if (ts6.isSourceFile(node)) { + return { text: node.fileName, pos: 0, end: 0 }; + } + if ((ts6.isFunctionDeclaration(node) || ts6.isClassDeclaration(node)) && !ts6.isNamedDeclaration(node)) { + var defaultModifier = node.modifiers && ts6.find(node.modifiers, isDefaultModifier); + if (defaultModifier) { + return { text: "default", pos: defaultModifier.getStart(), end: defaultModifier.getEnd() }; + } + } + if (ts6.isClassStaticBlockDeclaration(node)) { + var sourceFile = node.getSourceFile(); + var pos = ts6.skipTrivia(sourceFile.text, ts6.moveRangePastModifiers(node).pos); + var end = pos + 6; + var typeChecker = program.getTypeChecker(); + var symbol = typeChecker.getSymbolAtLocation(node.parent); + var prefix2 = symbol ? "".concat(typeChecker.symbolToString(symbol, node.parent), " ") : ""; + return { text: "".concat(prefix2, "static {}"), pos, end }; + } + var declName = isConstNamedExpression(node) ? node.parent.name : ts6.Debug.checkDefined(ts6.getNameOfDeclaration(node), "Expected call hierarchy item to have a name"); + var text = ts6.isIdentifier(declName) ? ts6.idText(declName) : ts6.isStringOrNumericLiteralLike(declName) ? declName.text : ts6.isComputedPropertyName(declName) ? ts6.isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0; + if (text === void 0) { + var typeChecker = program.getTypeChecker(); + var symbol = typeChecker.getSymbolAtLocation(declName); + if (symbol) { + text = typeChecker.symbolToString(symbol, node); + } + } + if (text === void 0) { + var printer_1 = ts6.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); + text = ts6.usingSingleLineStringWriter(function(writer) { + return printer_1.writeNode(4, node, node.getSourceFile(), writer); + }); + } + return { text, pos: declName.getStart(), end: declName.getEnd() }; + } + function getCallHierarchItemContainerName(node) { + var _a, _b; + if (isConstNamedExpression(node)) { + if (ts6.isModuleBlock(node.parent.parent.parent.parent) && ts6.isIdentifier(node.parent.parent.parent.parent.parent.name)) { + return node.parent.parent.parent.parent.parent.name.getText(); + } + return; + } + switch (node.kind) { + case 174: + case 175: + case 171: + if (node.parent.kind === 207) { + return (_a = ts6.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); + } + return (_b = ts6.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); + case 259: + case 260: + case 264: + if (ts6.isModuleBlock(node.parent) && ts6.isIdentifier(node.parent.parent.name)) { + return node.parent.parent.name.getText(); + } + } + } + function findImplementation(typeChecker, node) { + if (node.body) { + return node; + } + if (ts6.isConstructorDeclaration(node)) { + return ts6.getFirstConstructorWithBody(node.parent); + } + if (ts6.isFunctionDeclaration(node) || ts6.isMethodDeclaration(node)) { + var symbol = getSymbolOfCallHierarchyDeclaration(typeChecker, node); + if (symbol && symbol.valueDeclaration && ts6.isFunctionLikeDeclaration(symbol.valueDeclaration) && symbol.valueDeclaration.body) { + return symbol.valueDeclaration; + } + return void 0; + } + return node; + } + function findAllInitialDeclarations(typeChecker, node) { + var symbol = getSymbolOfCallHierarchyDeclaration(typeChecker, node); + var declarations; + if (symbol && symbol.declarations) { + var indices = ts6.indicesOf(symbol.declarations); + var keys_2 = ts6.map(symbol.declarations, function(decl2) { + return { file: decl2.getSourceFile().fileName, pos: decl2.pos }; + }); + indices.sort(function(a, b) { + return ts6.compareStringsCaseSensitive(keys_2[a].file, keys_2[b].file) || keys_2[a].pos - keys_2[b].pos; + }); + var sortedDeclarations = ts6.map(indices, function(i) { + return symbol.declarations[i]; + }); + var lastDecl = void 0; + for (var _i = 0, sortedDeclarations_1 = sortedDeclarations; _i < sortedDeclarations_1.length; _i++) { + var decl = sortedDeclarations_1[_i]; + if (isValidCallHierarchyDeclaration(decl)) { + if (!lastDecl || lastDecl.parent !== decl.parent || lastDecl.end !== decl.pos) { + declarations = ts6.append(declarations, decl); + } + lastDecl = decl; + } + } + } + return declarations; + } + function findImplementationOrAllInitialDeclarations(typeChecker, node) { + var _a, _b, _c; + if (ts6.isClassStaticBlockDeclaration(node)) { + return node; + } + if (ts6.isFunctionLikeDeclaration(node)) { + return (_b = (_a = findImplementation(typeChecker, node)) !== null && _a !== void 0 ? _a : findAllInitialDeclarations(typeChecker, node)) !== null && _b !== void 0 ? _b : node; + } + return (_c = findAllInitialDeclarations(typeChecker, node)) !== null && _c !== void 0 ? _c : node; + } + function resolveCallHierarchyDeclaration(program, location) { + var typeChecker = program.getTypeChecker(); + var followingSymbol = false; + while (true) { + if (isValidCallHierarchyDeclaration(location)) { + return findImplementationOrAllInitialDeclarations(typeChecker, location); + } + if (isPossibleCallHierarchyDeclaration(location)) { + var ancestor = ts6.findAncestor(location, isValidCallHierarchyDeclaration); + return ancestor && findImplementationOrAllInitialDeclarations(typeChecker, ancestor); + } + if (ts6.isDeclarationName(location)) { + if (isValidCallHierarchyDeclaration(location.parent)) { + return findImplementationOrAllInitialDeclarations(typeChecker, location.parent); + } + if (isPossibleCallHierarchyDeclaration(location.parent)) { + var ancestor = ts6.findAncestor(location.parent, isValidCallHierarchyDeclaration); + return ancestor && findImplementationOrAllInitialDeclarations(typeChecker, ancestor); + } + if (ts6.isVariableDeclaration(location.parent) && location.parent.initializer && isConstNamedExpression(location.parent.initializer)) { + return location.parent.initializer; + } + return void 0; + } + if (ts6.isConstructorDeclaration(location)) { + if (isValidCallHierarchyDeclaration(location.parent)) { + return location.parent; + } + return void 0; + } + if (location.kind === 124 && ts6.isClassStaticBlockDeclaration(location.parent)) { + location = location.parent; + continue; + } + if (ts6.isVariableDeclaration(location) && location.initializer && isConstNamedExpression(location.initializer)) { + return location.initializer; + } + if (!followingSymbol) { + var symbol = typeChecker.getSymbolAtLocation(location); + if (symbol) { + if (symbol.flags & 2097152) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + if (symbol.valueDeclaration) { + followingSymbol = true; + location = symbol.valueDeclaration; + continue; + } + } + } + return void 0; + } + } + CallHierarchy2.resolveCallHierarchyDeclaration = resolveCallHierarchyDeclaration; + function createCallHierarchyItem(program, node) { + var sourceFile = node.getSourceFile(); + var name = getCallHierarchyItemName(program, node); + var containerName = getCallHierarchItemContainerName(node); + var kind = ts6.getNodeKind(node); + var kindModifiers = ts6.getNodeModifiers(node); + var span = ts6.createTextSpanFromBounds(ts6.skipTrivia( + sourceFile.text, + node.getFullStart(), + /*stopAfterLineBreak*/ + false, + /*stopAtComments*/ + true + ), node.getEnd()); + var selectionSpan = ts6.createTextSpanFromBounds(name.pos, name.end); + return { file: sourceFile.fileName, kind, kindModifiers, name: name.text, containerName, span, selectionSpan }; + } + CallHierarchy2.createCallHierarchyItem = createCallHierarchyItem; + function isDefined(x) { + return x !== void 0; + } + function convertEntryToCallSite(entry) { + if (entry.kind === 1) { + var node = entry.node; + if (ts6.isCallOrNewExpressionTarget( + node, + /*includeElementAccess*/ + true, + /*skipPastOuterExpressions*/ + true + ) || ts6.isTaggedTemplateTag( + node, + /*includeElementAccess*/ + true, + /*skipPastOuterExpressions*/ + true + ) || ts6.isDecoratorTarget( + node, + /*includeElementAccess*/ + true, + /*skipPastOuterExpressions*/ + true + ) || ts6.isJsxOpeningLikeElementTagName( + node, + /*includeElementAccess*/ + true, + /*skipPastOuterExpressions*/ + true + ) || ts6.isRightSideOfPropertyAccess(node) || ts6.isArgumentExpressionOfElementAccess(node)) { + var sourceFile = node.getSourceFile(); + var ancestor = ts6.findAncestor(node, isValidCallHierarchyDeclaration) || sourceFile; + return { declaration: ancestor, range: ts6.createTextRangeFromNode(node, sourceFile) }; + } + } + } + function getCallSiteGroupKey(entry) { + return ts6.getNodeId(entry.declaration); + } + function createCallHierarchyIncomingCall(from, fromSpans) { + return { from, fromSpans }; + } + function convertCallSiteGroupToIncomingCall(program, entries) { + return createCallHierarchyIncomingCall(createCallHierarchyItem(program, entries[0].declaration), ts6.map(entries, function(entry) { + return ts6.createTextSpanFromRange(entry.range); + })); + } + function getIncomingCalls(program, declaration, cancellationToken) { + if (ts6.isSourceFile(declaration) || ts6.isModuleDeclaration(declaration) || ts6.isClassStaticBlockDeclaration(declaration)) { + return []; + } + var location = getCallHierarchyDeclarationReferenceNode(declaration); + var calls = ts6.filter(ts6.FindAllReferences.findReferenceOrRenameEntries( + program, + cancellationToken, + program.getSourceFiles(), + location, + /*position*/ + 0, + { + use: 1 + /* FindAllReferences.FindReferencesUse.References */ + }, + convertEntryToCallSite + ), isDefined); + return calls ? ts6.group(calls, getCallSiteGroupKey, function(entries) { + return convertCallSiteGroupToIncomingCall(program, entries); + }) : []; + } + CallHierarchy2.getIncomingCalls = getIncomingCalls; + function createCallSiteCollector(program, callSites) { + function recordCallSite(node) { + var target = ts6.isTaggedTemplateExpression(node) ? node.tag : ts6.isJsxOpeningLikeElement(node) ? node.tagName : ts6.isAccessExpression(node) ? node : ts6.isClassStaticBlockDeclaration(node) ? node : node.expression; + var declaration = resolveCallHierarchyDeclaration(program, target); + if (declaration) { + var range2 = ts6.createTextRangeFromNode(target, node.getSourceFile()); + if (ts6.isArray(declaration)) { + for (var _i = 0, declaration_1 = declaration; _i < declaration_1.length; _i++) { + var decl = declaration_1[_i]; + callSites.push({ declaration: decl, range: range2 }); + } + } else { + callSites.push({ declaration, range: range2 }); + } + } + } + function collect(node) { + if (!node) + return; + if (node.flags & 16777216) { + return; + } + if (isValidCallHierarchyDeclaration(node)) { + if (ts6.isClassLike(node)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.name && ts6.isComputedPropertyName(member.name)) { + collect(member.name.expression); + } + } + } + return; + } + switch (node.kind) { + case 79: + case 268: + case 269: + case 275: + case 261: + case 262: + return; + case 172: + recordCallSite(node); + return; + case 213: + case 231: + collect(node.expression); + return; + case 257: + case 166: + collect(node.name); + collect(node.initializer); + return; + case 210: + recordCallSite(node); + collect(node.expression); + ts6.forEach(node.arguments, collect); + return; + case 211: + recordCallSite(node); + collect(node.expression); + ts6.forEach(node.arguments, collect); + return; + case 212: + recordCallSite(node); + collect(node.tag); + collect(node.template); + return; + case 283: + case 282: + recordCallSite(node); + collect(node.tagName); + collect(node.attributes); + return; + case 167: + recordCallSite(node); + collect(node.expression); + return; + case 208: + case 209: + recordCallSite(node); + ts6.forEachChild(node, collect); + break; + case 235: + collect(node.expression); + return; + } + if (ts6.isPartOfTypeNode(node)) { + return; + } + ts6.forEachChild(node, collect); + } + return collect; + } + function collectCallSitesOfSourceFile(node, collect) { + ts6.forEach(node.statements, collect); + } + function collectCallSitesOfModuleDeclaration(node, collect) { + if (!ts6.hasSyntacticModifier( + node, + 2 + /* ModifierFlags.Ambient */ + ) && node.body && ts6.isModuleBlock(node.body)) { + ts6.forEach(node.body.statements, collect); + } + } + function collectCallSitesOfFunctionLikeDeclaration(typeChecker, node, collect) { + var implementation = findImplementation(typeChecker, node); + if (implementation) { + ts6.forEach(implementation.parameters, collect); + collect(implementation.body); + } + } + function collectCallSitesOfClassStaticBlockDeclaration(node, collect) { + collect(node.body); + } + function collectCallSitesOfClassLikeDeclaration(node, collect) { + ts6.forEach(node.modifiers, collect); + var heritage = ts6.getClassExtendsHeritageElement(node); + if (heritage) { + collect(heritage.expression); + } + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (ts6.canHaveModifiers(member)) { + ts6.forEach(member.modifiers, collect); + } + if (ts6.isPropertyDeclaration(member)) { + collect(member.initializer); + } else if (ts6.isConstructorDeclaration(member) && member.body) { + ts6.forEach(member.parameters, collect); + collect(member.body); + } else if (ts6.isClassStaticBlockDeclaration(member)) { + collect(member); + } + } + } + function collectCallSites(program, node) { + var callSites = []; + var collect = createCallSiteCollector(program, callSites); + switch (node.kind) { + case 308: + collectCallSitesOfSourceFile(node, collect); + break; + case 264: + collectCallSitesOfModuleDeclaration(node, collect); + break; + case 259: + case 215: + case 216: + case 171: + case 174: + case 175: + collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); + break; + case 260: + case 228: + collectCallSitesOfClassLikeDeclaration(node, collect); + break; + case 172: + collectCallSitesOfClassStaticBlockDeclaration(node, collect); + break; + default: + ts6.Debug.assertNever(node); + } + return callSites; + } + function createCallHierarchyOutgoingCall(to, fromSpans) { + return { to, fromSpans }; + } + function convertCallSiteGroupToOutgoingCall(program, entries) { + return createCallHierarchyOutgoingCall(createCallHierarchyItem(program, entries[0].declaration), ts6.map(entries, function(entry) { + return ts6.createTextSpanFromRange(entry.range); + })); + } + function getOutgoingCalls(program, declaration) { + if (declaration.flags & 16777216 || ts6.isMethodSignature(declaration)) { + return []; + } + return ts6.group(collectCallSites(program, declaration), getCallSiteGroupKey, function(entries) { + return convertCallSiteGroupToOutgoingCall(program, entries); + }); + } + CallHierarchy2.getOutgoingCalls = getOutgoingCalls; + })(CallHierarchy = ts6.CallHierarchy || (ts6.CallHierarchy = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function getEditsForFileRename(program, oldFileOrDirPath, newFileOrDirPath, host, formatContext, preferences, sourceMapper) { + var useCaseSensitiveFileNames = ts6.hostUsesCaseSensitiveFileNames(host); + var getCanonicalFileName = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + var oldToNew = getPathUpdater(oldFileOrDirPath, newFileOrDirPath, getCanonicalFileName, sourceMapper); + var newToOld = getPathUpdater(newFileOrDirPath, oldFileOrDirPath, getCanonicalFileName, sourceMapper); + return ts6.textChanges.ChangeTracker.with({ host, formatContext, preferences }, function(changeTracker) { + updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, host.getCurrentDirectory(), useCaseSensitiveFileNames); + updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName); + }); + } + ts6.getEditsForFileRename = getEditsForFileRename; + function getPathUpdater(oldFileOrDirPath, newFileOrDirPath, getCanonicalFileName, sourceMapper) { + var canonicalOldPath = getCanonicalFileName(oldFileOrDirPath); + return function(path) { + var originalPath = sourceMapper && sourceMapper.tryGetSourcePosition({ fileName: path, pos: 0 }); + var updatedPath = getUpdatedPath(originalPath ? originalPath.fileName : path); + return originalPath ? updatedPath === void 0 ? void 0 : makeCorrespondingRelativeChange(originalPath.fileName, updatedPath, path, getCanonicalFileName) : updatedPath; + }; + function getUpdatedPath(pathToUpdate) { + if (getCanonicalFileName(pathToUpdate) === canonicalOldPath) + return newFileOrDirPath; + var suffix = ts6.tryRemoveDirectoryPrefix(pathToUpdate, canonicalOldPath, getCanonicalFileName); + return suffix === void 0 ? void 0 : newFileOrDirPath + "/" + suffix; + } + } + ts6.getPathUpdater = getPathUpdater; + function makeCorrespondingRelativeChange(a0, b0, a1, getCanonicalFileName) { + var rel = ts6.getRelativePathFromFile(a0, b0, getCanonicalFileName); + return combinePathsSafe(ts6.getDirectoryPath(a1), rel); + } + function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, currentDirectory, useCaseSensitiveFileNames) { + var configFile = program.getCompilerOptions().configFile; + if (!configFile) + return; + var configDir = ts6.getDirectoryPath(configFile.fileName); + var jsonObjectLiteral = ts6.getTsConfigObjectLiteralExpression(configFile); + if (!jsonObjectLiteral) + return; + forEachProperty(jsonObjectLiteral, function(property, propertyName) { + switch (propertyName) { + case "files": + case "include": + case "exclude": { + var foundExactMatch = updatePaths(property); + if (foundExactMatch || propertyName !== "include" || !ts6.isArrayLiteralExpression(property.initializer)) + return; + var includes = ts6.mapDefined(property.initializer.elements, function(e) { + return ts6.isStringLiteral(e) ? e.text : void 0; + }); + if (includes.length === 0) + return; + var matchers = ts6.getFileMatcherPatterns( + configDir, + /*excludes*/ + [], + includes, + useCaseSensitiveFileNames, + currentDirectory + ); + if (ts6.getRegexFromPattern(ts6.Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(oldFileOrDirPath) && !ts6.getRegexFromPattern(ts6.Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(newFileOrDirPath)) { + changeTracker.insertNodeAfter(configFile, ts6.last(property.initializer.elements), ts6.factory.createStringLiteral(relativePath(newFileOrDirPath))); + } + return; + } + case "compilerOptions": + forEachProperty(property.initializer, function(property2, propertyName2) { + var option = ts6.getOptionFromName(propertyName2); + if (option && (option.isFilePath || option.type === "list" && option.element.isFilePath)) { + updatePaths(property2); + } else if (propertyName2 === "paths") { + forEachProperty(property2.initializer, function(pathsProperty) { + if (!ts6.isArrayLiteralExpression(pathsProperty.initializer)) + return; + for (var _i = 0, _a = pathsProperty.initializer.elements; _i < _a.length; _i++) { + var e = _a[_i]; + tryUpdateString(e); + } + }); + } + }); + return; + } + }); + function updatePaths(property) { + var elements = ts6.isArrayLiteralExpression(property.initializer) ? property.initializer.elements : [property.initializer]; + var foundExactMatch = false; + for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { + var element = elements_1[_i]; + foundExactMatch = tryUpdateString(element) || foundExactMatch; + } + return foundExactMatch; + } + function tryUpdateString(element) { + if (!ts6.isStringLiteral(element)) + return false; + var elementFileName = combinePathsSafe(configDir, element.text); + var updated = oldToNew(elementFileName); + if (updated !== void 0) { + changeTracker.replaceRangeWithText(configFile, createStringRange(element, configFile), relativePath(updated)); + return true; + } + return false; + } + function relativePath(path) { + return ts6.getRelativePathFromDirectory( + configDir, + path, + /*ignoreCase*/ + !useCaseSensitiveFileNames + ); + } + } + function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) { + var allFiles = program.getSourceFiles(); + var _loop_4 = function(sourceFile2) { + var newFromOld = oldToNew(sourceFile2.fileName); + var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile2.fileName; + var newImportFromDirectory = ts6.getDirectoryPath(newImportFromPath); + var oldFromNew = newToOld(sourceFile2.fileName); + var oldImportFromPath = oldFromNew || sourceFile2.fileName; + var oldImportFromDirectory = ts6.getDirectoryPath(oldImportFromPath); + var importingSourceFileMoved = newFromOld !== void 0 || oldFromNew !== void 0; + updateImportsWorker(sourceFile2, changeTracker, function(referenceText) { + if (!ts6.pathIsRelative(referenceText)) + return void 0; + var oldAbsolute = combinePathsSafe(oldImportFromDirectory, referenceText); + var newAbsolute = oldToNew(oldAbsolute); + return newAbsolute === void 0 ? void 0 : ts6.ensurePathIsNonModuleName(ts6.getRelativePathFromDirectory(newImportFromDirectory, newAbsolute, getCanonicalFileName)); + }, function(importLiteral) { + var importedModuleSymbol = program.getTypeChecker().getSymbolAtLocation(importLiteral); + if ((importedModuleSymbol === null || importedModuleSymbol === void 0 ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some(function(d) { + return ts6.isAmbientModule(d); + })) + return void 0; + var toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, ts6.resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile2, program, host, oldToNew); + return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && ts6.pathIsRelative(importLiteral.text)) ? ts6.moduleSpecifiers.updateModuleSpecifier(program.getCompilerOptions(), sourceFile2, getCanonicalFileName(newImportFromPath), toImport.newFileName, ts6.createModuleSpecifierResolutionHost(program, host), importLiteral.text) : void 0; + }); + }; + for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) { + var sourceFile = allFiles_1[_i]; + _loop_4(sourceFile); + } + } + function combineNormal(pathA, pathB) { + return ts6.normalizePath(ts6.combinePaths(pathA, pathB)); + } + function combinePathsSafe(pathA, pathB) { + return ts6.ensurePathIsNonModuleName(combineNormal(pathA, pathB)); + } + function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) { + if (importedModuleSymbol) { + var oldFileName = ts6.find(importedModuleSymbol.declarations, ts6.isSourceFile).fileName; + var newFileName = oldToNew(oldFileName); + return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true }; + } else { + var mode = ts6.getModeForUsageLocation(importingSourceFile, importLiteral); + var resolved = host.resolveModuleNames ? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode) : program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode); + return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles()); + } + } + function getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, sourceFiles) { + if (!resolved) + return void 0; + if (resolved.resolvedModule) { + var result_3 = tryChange(resolved.resolvedModule.resolvedFileName); + if (result_3) + return result_3; + } + var result = ts6.forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJsonExisting) || ts6.pathIsRelative(importLiteral.text) && ts6.forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJson); + if (result) + return result; + return resolved.resolvedModule && { newFileName: resolved.resolvedModule.resolvedFileName, updated: false }; + function tryChangeWithIgnoringPackageJsonExisting(oldFileName) { + var newFileName = oldToNew(oldFileName); + return newFileName && ts6.find(sourceFiles, function(src) { + return src.fileName === newFileName; + }) ? tryChangeWithIgnoringPackageJson(oldFileName) : void 0; + } + function tryChangeWithIgnoringPackageJson(oldFileName) { + return !ts6.endsWith(oldFileName, "/package.json") ? tryChange(oldFileName) : void 0; + } + function tryChange(oldFileName) { + var newFileName = oldToNew(oldFileName); + return newFileName && { newFileName, updated: true }; + } + } + function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport) { + for (var _i = 0, _a = sourceFile.referencedFiles || ts6.emptyArray; _i < _a.length; _i++) { + var ref = _a[_i]; + var updated = updateRef(ref.fileName); + if (updated !== void 0 && updated !== sourceFile.text.slice(ref.pos, ref.end)) + changeTracker.replaceRangeWithText(sourceFile, ref, updated); + } + for (var _b = 0, _c = sourceFile.imports; _b < _c.length; _b++) { + var importStringLiteral = _c[_b]; + var updated = updateImport(importStringLiteral); + if (updated !== void 0 && updated !== importStringLiteral.text) + changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated); + } + } + function createStringRange(node, sourceFile) { + return ts6.createRange(node.getStart(sourceFile) + 1, node.end - 1); + } + function forEachProperty(objectLiteral, cb) { + if (!ts6.isObjectLiteralExpression(objectLiteral)) + return; + for (var _i = 0, _a = objectLiteral.properties; _i < _a.length; _i++) { + var property = _a[_i]; + if (ts6.isPropertyAssignment(property) && ts6.isStringLiteral(property.name)) { + cb(property, property.name.text); + } + } + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var GoToDefinition; + (function(GoToDefinition2) { + function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) { + var _a; + var _b; + var resolvedRef = getReferenceAtPosition(sourceFile, position, program); + var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts6.emptyArray; + if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) { + return fileReferenceDefinition; + } + var node = ts6.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return void 0; + } + var parent = node.parent; + var typeChecker = program.getTypeChecker(); + if (node.kind === 161 || ts6.isIdentifier(node) && ts6.isJSDocOverrideTag(parent) && parent.tagName === node) { + return getDefinitionFromOverriddenMember(typeChecker, node) || ts6.emptyArray; + } + if (ts6.isJumpStatementTarget(node)) { + var label = ts6.getTargetLabel(node.parent, node.text); + return label ? [createDefinitionInfoFromName( + typeChecker, + label, + "label", + node.text, + /*containerName*/ + void 0 + )] : void 0; + } + if (node.kind === 105) { + var functionDeclaration = ts6.findAncestor(node.parent, function(n) { + return ts6.isClassStaticBlockDeclaration(n) ? "quit" : ts6.isFunctionLikeDeclaration(n); + }); + return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0; + } + if (ts6.isStaticModifier(node) && ts6.isClassStaticBlockDeclaration(node.parent)) { + var classDecl = node.parent.parent; + var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution; + var staticBlocks = ts6.filter(classDecl.members, ts6.isClassStaticBlockDeclaration); + var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : ""; + var sourceFile_1 = node.getSourceFile(); + return ts6.map(staticBlocks, function(staticBlock) { + var pos = ts6.moveRangePastModifiers(staticBlock).pos; + pos = ts6.skipTrivia(sourceFile_1.text, pos); + return createDefinitionInfoFromName( + typeChecker, + staticBlock, + "constructor", + "static {}", + containerName_1, + /*unverified*/ + false, + failedAliasResolution_1, + { start: pos, length: "static".length } + ); + }); + } + var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution; + var fallbackNode = node; + if (searchOtherFilesOnly && failedAliasResolution) { + var importDeclaration = ts6.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts6.emptyArray, true), function(n) { + return ts6.findAncestor(n, ts6.isAnyImportOrBareOrAccessedRequire); + }); + var moduleSpecifier = importDeclaration && ts6.tryGetModuleSpecifierFromDeclaration(importDeclaration); + if (moduleSpecifier) { + _a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution; + fallbackNode = moduleSpecifier; + } + } + if (!symbol && ts6.isModuleSpecifierLike(fallbackNode)) { + var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts6.getModeForUsageLocation(sourceFile, fallbackNode)); + if (ref) { + return [{ + name: fallbackNode.text, + fileName: ref.resolvedFileName, + containerName: void 0, + containerKind: void 0, + kind: "script", + textSpan: ts6.createTextSpan(0, 0), + failedAliasResolution, + isAmbient: ts6.isDeclarationFileName(ref.resolvedFileName), + unverified: fallbackNode !== node + }]; + } + } + if (!symbol) { + return ts6.concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker)); + } + if (searchOtherFilesOnly && ts6.every(symbol.declarations, function(d) { + return d.getSourceFile().fileName === sourceFile.fileName; + })) + return void 0; + var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); + if (calledDeclaration && !(ts6.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) { + var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution); + if (typeChecker.getRootSymbols(symbol).some(function(s) { + return symbolMatchesSignature(s, calledDeclaration); + })) { + return [sigInfo]; + } else { + var defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || ts6.emptyArray; + return node.kind === 106 ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false); + } + } + if (node.parent.kind === 300) { + var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function(decl) { + return createDefinitionInfo( + decl, + typeChecker, + shorthandSymbol_1, + node, + /*unverified*/ + false, + failedAliasResolution + ); + }) : ts6.emptyArray; + return ts6.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts6.emptyArray); + } + if (ts6.isPropertyName(node) && ts6.isBindingElement(parent) && ts6.isObjectBindingPattern(parent.parent) && node === (parent.propertyName || parent.name)) { + var name_3 = ts6.getNameFromPropertyName(node); + var type = typeChecker.getTypeAtLocation(parent.parent); + return name_3 === void 0 ? ts6.emptyArray : ts6.flatMap(type.isUnion() ? type.types : [type], function(t) { + var prop = t.getProperty(name_3); + return prop && getDefinitionFromSymbol(typeChecker, prop, node); + }); + } + return ts6.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution)); + } + GoToDefinition2.getDefinitionAtPosition = getDefinitionAtPosition; + function symbolMatchesSignature(s, calledDeclaration) { + return s === calledDeclaration.symbol || s === calledDeclaration.symbol.parent || ts6.isAssignmentExpression(calledDeclaration.parent) || !ts6.isCallLikeExpression(calledDeclaration.parent) && s === calledDeclaration.parent.symbol; + } + function getDefinitionFromObjectLiteralElement(typeChecker, node) { + var element = ts6.getContainingObjectLiteralElement(node); + if (element) { + var contextualType = element && typeChecker.getContextualType(element.parent); + if (contextualType) { + return ts6.flatMap(ts6.getPropertySymbolsFromContextualType( + element, + typeChecker, + contextualType, + /*unionSymbolOk*/ + false + ), function(propertySymbol) { + return getDefinitionFromSymbol(typeChecker, propertySymbol, node); + }); + } + } + } + function getDefinitionFromOverriddenMember(typeChecker, node) { + var classElement = ts6.findAncestor(node, ts6.isClassElement); + if (!(classElement && classElement.name)) + return; + var baseDeclaration = ts6.findAncestor(classElement, ts6.isClassLike); + if (!baseDeclaration) + return; + var baseTypeNode = ts6.getEffectiveBaseTypeNode(baseDeclaration); + if (!baseTypeNode) + return; + var expression = ts6.skipParentheses(baseTypeNode.expression); + var base = ts6.isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression); + if (!base) + return; + var name = ts6.unescapeLeadingUnderscores(ts6.getTextOfPropertyName(classElement.name)); + var symbol = ts6.hasStaticModifier(classElement) ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbol(base), name) : typeChecker.getPropertyOfType(typeChecker.getDeclaredTypeOfSymbol(base), name); + if (!symbol) + return; + return getDefinitionFromSymbol(typeChecker, symbol, node); + } + function getReferenceAtPosition(sourceFile, position, program) { + var _a, _b; + var referencePath = findReferenceInPosition(sourceFile.referencedFiles, position); + if (referencePath) { + var file = program.getSourceFileFromReference(sourceFile, referencePath); + return file && { reference: referencePath, fileName: file.fileName, file, unverified: false }; + } + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var reference = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat); + var file = reference && program.getSourceFile(reference.resolvedFileName); + return file && { reference: typeReferenceDirective, fileName: file.fileName, file, unverified: false }; + } + var libReferenceDirective = findReferenceInPosition(sourceFile.libReferenceDirectives, position); + if (libReferenceDirective) { + var file = program.getLibFileFromReference(libReferenceDirective); + return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false }; + } + if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) { + var node = ts6.getTouchingToken(sourceFile, position); + if (ts6.isModuleSpecifierLike(node) && ts6.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts6.getModeForUsageLocation(sourceFile, node))) { + var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts6.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName; + var fileName = verifiedFileName || ts6.resolvePath(ts6.getDirectoryPath(sourceFile.fileName), node.text); + return { + file: program.getSourceFile(fileName), + fileName, + reference: { + pos: node.getStart(), + end: node.getEnd(), + fileName: node.text + }, + unverified: !verifiedFileName + }; + } + } + return void 0; + } + GoToDefinition2.getReferenceAtPosition = getReferenceAtPosition; + function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) { + var node = ts6.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return void 0; + } + if (ts6.isImportMeta(node.parent) && node.parent.name === node) { + return definitionFromType( + typeChecker.getTypeAtLocation(node.parent), + typeChecker, + node.parent, + /*failedAliasResolution*/ + false + ); + } + var _a = getSymbol( + node, + typeChecker, + /*stopAtAlias*/ + false + ), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution; + if (!symbol) + return void 0; + var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node); + var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker); + var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution); + var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution); + return typeDefinitions.length ? typeDefinitions : !(symbol.flags & 111551) && symbol.flags & 788968 ? getDefinitionFromSymbol(typeChecker, ts6.skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0; + } + GoToDefinition2.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition; + function definitionFromType(type, checker, node, failedAliasResolution) { + return ts6.flatMap(type.isUnion() && !(type.flags & 32) ? type.types : [type], function(t) { + return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution); + }); + } + function tryGetReturnTypeOfFunction(symbol, type, checker) { + if (type.symbol === symbol || // At `const f = () => {}`, the symbol is `f` and the type symbol is at `() => {}` + symbol.valueDeclaration && type.symbol && ts6.isVariableDeclaration(symbol.valueDeclaration) && symbol.valueDeclaration.initializer === type.symbol.valueDeclaration) { + var sigs = type.getCallSignatures(); + if (sigs.length === 1) + return checker.getReturnTypeOfSignature(ts6.first(sigs)); + } + return void 0; + } + function getDefinitionAndBoundSpan(program, sourceFile, position) { + var definitions = getDefinitionAtPosition(program, sourceFile, position); + if (!definitions || definitions.length === 0) { + return void 0; + } + var comment = findReferenceInPosition(sourceFile.referencedFiles, position) || findReferenceInPosition(sourceFile.typeReferenceDirectives, position) || findReferenceInPosition(sourceFile.libReferenceDirectives, position); + if (comment) { + return { definitions, textSpan: ts6.createTextSpanFromRange(comment) }; + } + var node = ts6.getTouchingPropertyName(sourceFile, position); + var textSpan = ts6.createTextSpan(node.getStart(), node.getWidth()); + return { definitions, textSpan }; + } + GoToDefinition2.getDefinitionAndBoundSpan = getDefinitionAndBoundSpan; + function getDefinitionInfoForIndexSignatures(node, checker) { + return ts6.mapDefined(checker.getIndexInfosAtLocation(node), function(info) { + return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); + }); + } + function getSymbol(node, checker, stopAtAlias) { + var symbol = checker.getSymbolAtLocation(node); + var failedAliasResolution = false; + if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) { + var aliased = checker.getAliasedSymbol(symbol); + if (aliased.declarations) { + return { symbol: aliased }; + } else { + failedAliasResolution = true; + } + } + return { symbol, failedAliasResolution }; + } + function shouldSkipAlias(node, declaration) { + if (node.kind !== 79) { + return false; + } + if (node.parent === declaration) { + return true; + } + if (declaration.kind === 271) { + return false; + } + return true; + } + function isExpandoDeclaration(node) { + if (!ts6.isAssignmentDeclaration(node)) + return false; + var containingAssignment = ts6.findAncestor(node, function(p) { + if (ts6.isAssignmentExpression(p)) + return true; + if (!ts6.isAssignmentDeclaration(p)) + return "quit"; + return false; + }); + return !!containingAssignment && ts6.getAssignmentDeclarationKind(containingAssignment) === 5; + } + function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) { + var filteredDeclarations = ts6.filter(symbol.declarations, function(d) { + return d !== excludeDeclaration; + }); + var withoutExpandos = ts6.filter(filteredDeclarations, function(d) { + return !isExpandoDeclaration(d); + }); + var results = ts6.some(withoutExpandos) ? withoutExpandos : filteredDeclarations; + return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts6.map(results, function(declaration) { + return createDefinitionInfo( + declaration, + typeChecker, + symbol, + node, + /*unverified*/ + false, + failedAliasResolution + ); + }); + function getConstructSignatureDefinition() { + if (symbol.flags & 32 && !(symbol.flags & (16 | 3)) && (ts6.isNewExpressionTarget(node) || node.kind === 135)) { + var cls = ts6.find(filteredDeclarations, ts6.isClassLike) || ts6.Debug.fail("Expected declaration to have at least one class-like declaration"); + return getSignatureDefinition( + cls.members, + /*selectConstructors*/ + true + ); + } + } + function getCallSignatureDefinition() { + return ts6.isCallOrNewExpressionTarget(node) || ts6.isNameOfFunctionDeclaration(node) ? getSignatureDefinition( + filteredDeclarations, + /*selectConstructors*/ + false + ) : void 0; + } + function getSignatureDefinition(signatureDeclarations, selectConstructors) { + if (!signatureDeclarations) { + return void 0; + } + var declarations = signatureDeclarations.filter(selectConstructors ? ts6.isConstructorDeclaration : ts6.isFunctionLike); + var declarationsWithBody = declarations.filter(function(d) { + return !!d.body; + }); + return declarations.length ? declarationsWithBody.length !== 0 ? declarationsWithBody.map(function(x) { + return createDefinitionInfo(x, typeChecker, symbol, node); + }) : [createDefinitionInfo( + ts6.last(declarations), + typeChecker, + symbol, + node, + /*unverified*/ + false, + failedAliasResolution + )] : void 0; + } + } + function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) { + var symbolName = checker.symbolToString(symbol); + var symbolKind = ts6.SymbolDisplay.getSymbolKind(checker, symbol, node); + var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : ""; + return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution); + } + GoToDefinition2.createDefinitionInfo = createDefinitionInfo; + function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, unverified, failedAliasResolution, textSpan) { + var sourceFile = declaration.getSourceFile(); + if (!textSpan) { + var name = ts6.getNameOfDeclaration(declaration) || declaration; + textSpan = ts6.createTextSpanFromNode(name, sourceFile); + } + return __assign(__assign({ + fileName: sourceFile.fileName, + textSpan, + kind: symbolKind, + name: symbolName, + containerKind: void 0, + // TODO: GH#18217 + containerName + }, ts6.FindAllReferences.toContextSpan(textSpan, sourceFile, ts6.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration), isAmbient: !!(declaration.flags & 16777216), unverified, failedAliasResolution }); + } + function isDefinitionVisible(checker, declaration) { + if (checker.isDeclarationVisible(declaration)) + return true; + if (!declaration.parent) + return false; + if (ts6.hasInitializer(declaration.parent) && declaration.parent.initializer === declaration) + return isDefinitionVisible(checker, declaration.parent); + switch (declaration.kind) { + case 169: + case 174: + case 175: + case 171: + if (ts6.hasEffectiveModifier( + declaration, + 8 + /* ModifierFlags.Private */ + )) + return false; + case 173: + case 299: + case 300: + case 207: + case 228: + case 216: + case 215: + return isDefinitionVisible(checker, declaration.parent); + default: + return false; + } + } + function createDefinitionFromSignatureDeclaration(typeChecker, decl, failedAliasResolution) { + return createDefinitionInfo( + decl, + typeChecker, + decl.symbol, + decl, + /*unverified*/ + false, + failedAliasResolution + ); + } + function findReferenceInPosition(refs, pos) { + return ts6.find(refs, function(ref) { + return ts6.textRangeContainsPositionInclusive(ref, pos); + }); + } + GoToDefinition2.findReferenceInPosition = findReferenceInPosition; + function getDefinitionInfoForFileReference(name, targetFileName, unverified) { + return { + fileName: targetFileName, + textSpan: ts6.createTextSpanFromBounds(0, 0), + kind: "script", + name, + containerName: void 0, + containerKind: void 0, + unverified + }; + } + function getAncestorCallLikeExpression(node) { + var target = ts6.findAncestor(node, function(n) { + return !ts6.isRightSideOfPropertyAccess(n); + }); + var callLike = target === null || target === void 0 ? void 0 : target.parent; + return callLike && ts6.isCallLikeExpression(callLike) && ts6.getInvokedExpression(callLike) === target ? callLike : void 0; + } + function tryGetSignatureDeclaration(typeChecker, node) { + var callLike = getAncestorCallLikeExpression(node); + var signature = callLike && typeChecker.getResolvedSignature(callLike); + return ts6.tryCast(signature && signature.declaration, function(d) { + return ts6.isFunctionLike(d) && !ts6.isFunctionTypeNode(d); + }); + } + function isConstructorLike(node) { + switch (node.kind) { + case 173: + case 182: + case 177: + return true; + default: + return false; + } + } + })(GoToDefinition = ts6.GoToDefinition || (ts6.GoToDefinition = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var JsDoc; + (function(JsDoc2) { + var jsDocTagNames = [ + "abstract", + "access", + "alias", + "argument", + "async", + "augments", + "author", + "borrows", + "callback", + "class", + "classdesc", + "constant", + "constructor", + "constructs", + "copyright", + "default", + "deprecated", + "description", + "emits", + "enum", + "event", + "example", + "exports", + "extends", + "external", + "field", + "file", + "fileoverview", + "fires", + "function", + "generator", + "global", + "hideconstructor", + "host", + "ignore", + "implements", + "inheritdoc", + "inner", + "instance", + "interface", + "kind", + "lends", + "license", + "link", + "listens", + "member", + "memberof", + "method", + "mixes", + "module", + "name", + "namespace", + "override", + "package", + "param", + "private", + "property", + "protected", + "public", + "readonly", + "requires", + "returns", + "see", + "since", + "static", + "summary", + "template", + "this", + "throws", + "todo", + "tutorial", + "type", + "typedef", + "var", + "variation", + "version", + "virtual", + "yields" + ]; + var jsDocTagNameCompletionEntries; + var jsDocTagCompletionEntries; + function getJsDocCommentsFromDeclarations(declarations, checker) { + var parts = []; + ts6.forEachUnique(declarations, function(declaration) { + for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { + var jsdoc = _a[_i]; + var inheritDoc = ts6.isJSDoc(jsdoc) && jsdoc.tags && ts6.find(jsdoc.tags, function(t) { + return t.kind === 330 && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); + }); + if (jsdoc.comment === void 0 && !inheritDoc || ts6.isJSDoc(jsdoc) && declaration.kind !== 348 && declaration.kind !== 341 && jsdoc.tags && jsdoc.tags.some(function(t) { + return t.kind === 348 || t.kind === 341; + }) && !jsdoc.tags.some(function(t) { + return t.kind === 343 || t.kind === 344; + })) { + continue; + } + var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; + if (inheritDoc && inheritDoc.comment) { + newparts = newparts.concat(getDisplayPartsFromComment(inheritDoc.comment, checker)); + } + if (!ts6.contains(parts, newparts, isIdenticalListOfDisplayParts)) { + parts.push(newparts); + } + } + }); + return ts6.flatten(ts6.intersperse(parts, [ts6.lineBreakPart()])); + } + JsDoc2.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; + function isIdenticalListOfDisplayParts(parts1, parts2) { + return ts6.arraysEqual(parts1, parts2, function(p1, p2) { + return p1.kind === p2.kind && p1.text === p2.text; + }); + } + function getCommentHavingNodes(declaration) { + switch (declaration.kind) { + case 343: + case 350: + return [declaration]; + case 341: + case 348: + return [declaration, declaration.parent]; + default: + return ts6.getJSDocCommentsAndTags(declaration); + } + } + function getJsDocTagsFromDeclarations(declarations, checker) { + var infos = []; + ts6.forEachUnique(declarations, function(declaration) { + var tags = ts6.getJSDocTags(declaration); + if (tags.some(function(t) { + return t.kind === 348 || t.kind === 341; + }) && !tags.some(function(t) { + return t.kind === 343 || t.kind === 344; + })) { + return; + } + for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { + var tag = tags_1[_i]; + infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) }); + } + }); + return infos; + } + JsDoc2.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations; + function getDisplayPartsFromComment(comment, checker) { + if (typeof comment === "string") { + return [ts6.textPart(comment)]; + } + return ts6.flatMap(comment, function(node) { + return node.kind === 324 ? [ts6.textPart(node.text)] : ts6.buildLinkParts(node, checker); + }); + } + function getCommentDisplayParts(tag, checker) { + var comment = tag.comment, kind = tag.kind; + var namePart = getTagNameDisplayPart(kind); + switch (kind) { + case 332: + return withNode(tag.class); + case 331: + return withNode(tag.class); + case 347: + var templateTag = tag; + var displayParts_3 = []; + if (templateTag.constraint) { + displayParts_3.push(ts6.textPart(templateTag.constraint.getText())); + } + if (ts6.length(templateTag.typeParameters)) { + if (ts6.length(displayParts_3)) { + displayParts_3.push(ts6.spacePart()); + } + var lastTypeParameter_1 = templateTag.typeParameters[templateTag.typeParameters.length - 1]; + ts6.forEach(templateTag.typeParameters, function(tp) { + displayParts_3.push(namePart(tp.getText())); + if (lastTypeParameter_1 !== tp) { + displayParts_3.push.apply(displayParts_3, [ts6.punctuationPart( + 27 + /* SyntaxKind.CommaToken */ + ), ts6.spacePart()]); + } + }); + } + if (comment) { + displayParts_3.push.apply(displayParts_3, __spreadArray([ts6.spacePart()], getDisplayPartsFromComment(comment, checker), true)); + } + return displayParts_3; + case 346: + return withNode(tag.typeExpression); + case 348: + case 341: + case 350: + case 343: + case 349: + var name = tag.name; + return name ? withNode(name) : comment === void 0 ? void 0 : getDisplayPartsFromComment(comment, checker); + default: + return comment === void 0 ? void 0 : getDisplayPartsFromComment(comment, checker); + } + function withNode(node) { + return addComment2(node.getText()); + } + function addComment2(s) { + if (comment) { + if (s.match(/^https?$/)) { + return __spreadArray([ts6.textPart(s)], getDisplayPartsFromComment(comment, checker), true); + } else { + return __spreadArray([namePart(s), ts6.spacePart()], getDisplayPartsFromComment(comment, checker), true); + } + } else { + return [ts6.textPart(s)]; + } + } + } + function getTagNameDisplayPart(kind) { + switch (kind) { + case 343: + return ts6.parameterNamePart; + case 350: + return ts6.propertyNamePart; + case 347: + return ts6.typeParameterNamePart; + case 348: + case 341: + return ts6.typeAliasNamePart; + default: + return ts6.textPart; + } + } + function getJSDocTagNameCompletions() { + return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts6.map(jsDocTagNames, function(tagName) { + return { + name: tagName, + kind: "keyword", + kindModifiers: "", + sortText: ts6.Completions.SortText.LocationPriority + }; + })); + } + JsDoc2.getJSDocTagNameCompletions = getJSDocTagNameCompletions; + JsDoc2.getJSDocTagNameCompletionDetails = getJSDocTagCompletionDetails; + function getJSDocTagCompletions() { + return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts6.map(jsDocTagNames, function(tagName) { + return { + name: "@".concat(tagName), + kind: "keyword", + kindModifiers: "", + sortText: ts6.Completions.SortText.LocationPriority + }; + })); + } + JsDoc2.getJSDocTagCompletions = getJSDocTagCompletions; + function getJSDocTagCompletionDetails(name) { + return { + name, + kind: "", + kindModifiers: "", + displayParts: [ts6.textPart(name)], + documentation: ts6.emptyArray, + tags: void 0, + codeActions: void 0 + }; + } + JsDoc2.getJSDocTagCompletionDetails = getJSDocTagCompletionDetails; + function getJSDocParameterNameCompletions(tag) { + if (!ts6.isIdentifier(tag.name)) { + return ts6.emptyArray; + } + var nameThusFar = tag.name.text; + var jsdoc = tag.parent; + var fn = jsdoc.parent; + if (!ts6.isFunctionLike(fn)) + return []; + return ts6.mapDefined(fn.parameters, function(param) { + if (!ts6.isIdentifier(param.name)) + return void 0; + var name = param.name.text; + if (jsdoc.tags.some(function(t) { + return t !== tag && ts6.isJSDocParameterTag(t) && ts6.isIdentifier(t.name) && t.name.escapedText === name; + }) || nameThusFar !== void 0 && !ts6.startsWith(name, nameThusFar)) { + return void 0; + } + return { name, kind: "parameter", kindModifiers: "", sortText: ts6.Completions.SortText.LocationPriority }; + }); + } + JsDoc2.getJSDocParameterNameCompletions = getJSDocParameterNameCompletions; + function getJSDocParameterNameCompletionDetails(name) { + return { + name, + kind: "parameter", + kindModifiers: "", + displayParts: [ts6.textPart(name)], + documentation: ts6.emptyArray, + tags: void 0, + codeActions: void 0 + }; + } + JsDoc2.getJSDocParameterNameCompletionDetails = getJSDocParameterNameCompletionDetails; + function getDocCommentTemplateAtPosition(newLine, sourceFile, position, options) { + var tokenAtPos = ts6.getTokenAtPosition(sourceFile, position); + var existingDocComment = ts6.findAncestor(tokenAtPos, ts6.isJSDoc); + if (existingDocComment && (existingDocComment.comment !== void 0 || ts6.length(existingDocComment.tags))) { + return void 0; + } + var tokenStart = tokenAtPos.getStart(sourceFile); + if (!existingDocComment && tokenStart < position) { + return void 0; + } + var commentOwnerInfo = getCommentOwnerInfo(tokenAtPos, options); + if (!commentOwnerInfo) { + return void 0; + } + var commentOwner = commentOwnerInfo.commentOwner, parameters = commentOwnerInfo.parameters, hasReturn2 = commentOwnerInfo.hasReturn; + var commentOwnerJsDoc = ts6.hasJSDocNodes(commentOwner) && commentOwner.jsDoc ? commentOwner.jsDoc : void 0; + var lastJsDoc = ts6.lastOrUndefined(commentOwnerJsDoc); + if (commentOwner.getStart(sourceFile) < position || lastJsDoc && existingDocComment && lastJsDoc !== existingDocComment) { + return void 0; + } + var indentationStr = getIndentationStringAtPosition(sourceFile, position); + var isJavaScriptFile = ts6.hasJSFileExtension(sourceFile.fileName); + var tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : ""); + var openComment = "/**"; + var closeComment = " */"; + var hasTag = (commentOwnerJsDoc || []).some(function(jsDoc) { + return !!jsDoc.tags; + }); + if (tags && !hasTag) { + var preamble = openComment + newLine + indentationStr + " * "; + var endLine = tokenStart === position ? newLine + indentationStr : ""; + var result = preamble + newLine + tags + indentationStr + closeComment + endLine; + return { newText: result, caretOffset: preamble.length }; + } + return { newText: openComment + closeComment, caretOffset: 3 }; + } + JsDoc2.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition; + function getIndentationStringAtPosition(sourceFile, position) { + var text = sourceFile.text; + var lineStart = ts6.getLineStartPositionForPosition(position, sourceFile); + var pos = lineStart; + for (; pos <= position && ts6.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) + ; + return text.slice(lineStart, pos); + } + function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) { + return parameters.map(function(_a, i) { + var name = _a.name, dotDotDotToken = _a.dotDotDotToken; + var paramName = name.kind === 79 ? name.text : "param" + i; + var type = isJavaScriptFile ? dotDotDotToken ? "{...any} " : "{any} " : ""; + return "".concat(indentationStr, " * @param ").concat(type).concat(paramName).concat(newLine); + }).join(""); + } + function returnsDocComment(indentationStr, newLine) { + return "".concat(indentationStr, " * @returns").concat(newLine); + } + function getCommentOwnerInfo(tokenAtPos, options) { + return ts6.forEachAncestor(tokenAtPos, function(n) { + return getCommentOwnerInfoWorker(n, options); + }); + } + function getCommentOwnerInfoWorker(commentOwner, options) { + switch (commentOwner.kind) { + case 259: + case 215: + case 171: + case 173: + case 170: + case 216: + var host = commentOwner; + return { commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; + case 299: + return getCommentOwnerInfoWorker(commentOwner.initializer, options); + case 260: + case 261: + case 263: + case 302: + case 262: + return { commentOwner }; + case 168: { + var host_1 = commentOwner; + return host_1.type && ts6.isFunctionTypeNode(host_1.type) ? { commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) } : { commentOwner }; + } + case 240: { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : void 0; + return host_2 ? { commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) } : { commentOwner }; + } + case 308: + return "quit"; + case 264: + return commentOwner.parent.kind === 264 ? void 0 : { commentOwner }; + case 241: + return getCommentOwnerInfoWorker(commentOwner.expression, options); + case 223: { + var be = commentOwner; + if (ts6.getAssignmentDeclarationKind(be) === 0) { + return "quit"; + } + return ts6.isFunctionLike(be.right) ? { commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner }; + } + case 169: + var init = commentOwner.initializer; + if (init && (ts6.isFunctionExpression(init) || ts6.isArrowFunction(init))) { + return { commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; + } + } + } + function hasReturn(node, options) { + return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) && (ts6.isFunctionTypeNode(node) || ts6.isArrowFunction(node) && ts6.isExpression(node.body) || ts6.isFunctionLikeDeclaration(node) && node.body && ts6.isBlock(node.body) && !!ts6.forEachReturnStatement(node.body, function(n) { + return n; + })); + } + function getRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 214) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 215: + case 216: + return rightHandSide; + case 228: + return ts6.find(rightHandSide.members, ts6.isConstructorDeclaration); + } + } + })(JsDoc = ts6.JsDoc || (ts6.JsDoc = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var NavigateTo; + (function(NavigateTo2) { + function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { + var patternMatcher = ts6.createPatternMatcher(searchValue); + if (!patternMatcher) + return ts6.emptyArray; + var rawItems = []; + var _loop_5 = function(sourceFile2) { + cancellationToken.throwIfCancellationRequested(); + if (excludeDtsFiles && sourceFile2.isDeclarationFile) { + return "continue"; + } + sourceFile2.getNamedDeclarations().forEach(function(declarations, name) { + getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile2.fileName, rawItems); + }); + }; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; + _loop_5(sourceFile); + } + rawItems.sort(compareNavigateToItems); + return (maxResultCount === void 0 ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem); + } + NavigateTo2.getNavigateToItems = getNavigateToItems; + function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, rawItems) { + var match = patternMatcher.getMatchForLastSegmentOfPattern(name); + if (!match) { + return; + } + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; + if (!shouldKeepItem(declaration, checker)) + continue; + if (patternMatcher.patternContainsDots) { + var fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name); + if (fullMatch) { + rawItems.push({ name, fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration }); + } + } else { + rawItems.push({ name, fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration }); + } + } + } + function shouldKeepItem(declaration, checker) { + switch (declaration.kind) { + case 270: + case 273: + case 268: + var importer = checker.getSymbolAtLocation(declaration.name); + var imported = checker.getAliasedSymbol(importer); + return importer.escapedName !== imported.escapedName; + default: + return true; + } + } + function tryAddSingleDeclarationName(declaration, containers) { + var name = ts6.getNameOfDeclaration(declaration); + return !!name && (pushLiteral(name, containers) || name.kind === 164 && tryAddComputedPropertyName(name.expression, containers)); + } + function tryAddComputedPropertyName(expression, containers) { + return pushLiteral(expression, containers) || ts6.isPropertyAccessExpression(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); + } + function pushLiteral(node, containers) { + return ts6.isPropertyNameLiteral(node) && (containers.push(ts6.getTextOfIdentifierOrLiteral(node)), true); + } + function getContainers(declaration) { + var containers = []; + var name = ts6.getNameOfDeclaration(declaration); + if (name && name.kind === 164 && !tryAddComputedPropertyName(name.expression, containers)) { + return ts6.emptyArray; + } + containers.shift(); + var container = ts6.getContainerNode(declaration); + while (container) { + if (!tryAddSingleDeclarationName(container, containers)) { + return ts6.emptyArray; + } + container = ts6.getContainerNode(container); + } + return containers.reverse(); + } + function compareNavigateToItems(i1, i2) { + return ts6.compareValues(i1.matchKind, i2.matchKind) || ts6.compareStringsCaseSensitiveUI(i1.name, i2.name); + } + function createNavigateToItem(rawItem) { + var declaration = rawItem.declaration; + var container = ts6.getContainerNode(declaration); + var containerName = container && ts6.getNameOfDeclaration(container); + return { + name: rawItem.name, + kind: ts6.getNodeKind(declaration), + kindModifiers: ts6.getNodeModifiers(declaration), + matchKind: ts6.PatternMatchKind[rawItem.matchKind], + isCaseSensitive: rawItem.isCaseSensitive, + fileName: rawItem.fileName, + textSpan: ts6.createTextSpanFromNode(declaration), + // TODO(jfreeman): What should be the containerName when the container has a computed name? + containerName: containerName ? containerName.text : "", + containerKind: containerName ? ts6.getNodeKind(container) : "" + }; + } + })(NavigateTo = ts6.NavigateTo || (ts6.NavigateTo = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var NavigationBar; + (function(NavigationBar2) { + var _a; + var whiteSpaceRegex = /\s+/g; + var maxLength = 150; + var curCancellationToken; + var curSourceFile; + var parentsStack = []; + var parent; + var trackedEs5ClassesStack = []; + var trackedEs5Classes; + var emptyChildItemArray = []; + function getNavigationBarItems(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; + curSourceFile = sourceFile; + try { + return ts6.map(primaryNavBarMenuItems(rootNavigationBarNode(sourceFile)), convertToPrimaryNavBarMenuItem); + } finally { + reset(); + } + } + NavigationBar2.getNavigationBarItems = getNavigationBarItems; + function getNavigationTree(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; + curSourceFile = sourceFile; + try { + return convertToTree(rootNavigationBarNode(sourceFile)); + } finally { + reset(); + } + } + NavigationBar2.getNavigationTree = getNavigationTree; + function reset() { + curSourceFile = void 0; + curCancellationToken = void 0; + parentsStack = []; + parent = void 0; + emptyChildItemArray = []; + } + function nodeText(node) { + return cleanText(node.getText(curSourceFile)); + } + function navigationBarNodeKind(n) { + return n.node.kind; + } + function pushChild(parent2, child) { + if (parent2.children) { + parent2.children.push(child); + } else { + parent2.children = [child]; + } + } + function rootNavigationBarNode(sourceFile) { + ts6.Debug.assert(!parentsStack.length); + var root = { node: sourceFile, name: void 0, additionalNodes: void 0, parent: void 0, children: void 0, indent: 0 }; + parent = root; + for (var _i = 0, _a2 = sourceFile.statements; _i < _a2.length; _i++) { + var statement = _a2[_i]; + addChildrenRecursively(statement); + } + endNode(); + ts6.Debug.assert(!parent && !parentsStack.length); + return root; + } + function addLeafNode(node, name) { + pushChild(parent, emptyNavigationBarNode(node, name)); + } + function emptyNavigationBarNode(node, name) { + return { + node, + name: name || (ts6.isDeclaration(node) || ts6.isExpression(node) ? ts6.getNameOfDeclaration(node) : void 0), + additionalNodes: void 0, + parent, + children: void 0, + indent: parent.indent + 1 + }; + } + function addTrackedEs5Class(name) { + if (!trackedEs5Classes) { + trackedEs5Classes = new ts6.Map(); + } + trackedEs5Classes.set(name, true); + } + function endNestedNodes(depth) { + for (var i = 0; i < depth; i++) + endNode(); + } + function startNestedNodes(targetNode, entityName) { + var names = []; + while (!ts6.isPropertyNameLiteral(entityName)) { + var name = ts6.getNameOrArgument(entityName); + var nameText = ts6.getElementOrPropertyAccessName(entityName); + entityName = entityName.expression; + if (nameText === "prototype" || ts6.isPrivateIdentifier(name)) + continue; + names.push(name); + } + names.push(entityName); + for (var i = names.length - 1; i > 0; i--) { + var name = names[i]; + startNode(targetNode, name); + } + return [names.length - 1, names[0]]; + } + function startNode(node, name) { + var navNode = emptyNavigationBarNode(node, name); + pushChild(parent, navNode); + parentsStack.push(parent); + trackedEs5ClassesStack.push(trackedEs5Classes); + trackedEs5Classes = void 0; + parent = navNode; + } + function endNode() { + if (parent.children) { + mergeChildren(parent.children, parent); + sortChildren(parent.children); + } + parent = parentsStack.pop(); + trackedEs5Classes = trackedEs5ClassesStack.pop(); + } + function addNodeWithRecursiveChild(node, child, name) { + startNode(node, name); + addChildrenRecursively(child); + endNode(); + } + function addNodeWithRecursiveInitializer(node) { + if (node.initializer && isFunctionOrClassExpression(node.initializer)) { + startNode(node); + ts6.forEachChild(node.initializer, addChildrenRecursively); + endNode(); + } else { + addNodeWithRecursiveChild(node, node.initializer); + } + } + function hasNavigationBarName(node) { + return !ts6.hasDynamicName(node) || node.kind !== 223 && ts6.isPropertyAccessExpression(node.name.expression) && ts6.isIdentifier(node.name.expression.expression) && ts6.idText(node.name.expression.expression) === "Symbol"; + } + function addChildrenRecursively(node) { + var _a2; + curCancellationToken.throwIfCancellationRequested(); + if (!node || ts6.isToken(node)) { + return; + } + switch (node.kind) { + case 173: + var ctr = node; + addNodeWithRecursiveChild(ctr, ctr.body); + for (var _i = 0, _b = ctr.parameters; _i < _b.length; _i++) { + var param = _b[_i]; + if (ts6.isParameterPropertyDeclaration(param, ctr)) { + addLeafNode(param); + } + } + break; + case 171: + case 174: + case 175: + case 170: + if (hasNavigationBarName(node)) { + addNodeWithRecursiveChild(node, node.body); + } + break; + case 169: + if (hasNavigationBarName(node)) { + addNodeWithRecursiveInitializer(node); + } + break; + case 168: + if (hasNavigationBarName(node)) { + addLeafNode(node); + } + break; + case 270: + var importClause = node; + if (importClause.name) { + addLeafNode(importClause.name); + } + var namedBindings = importClause.namedBindings; + if (namedBindings) { + if (namedBindings.kind === 271) { + addLeafNode(namedBindings); + } else { + for (var _c = 0, _d = namedBindings.elements; _c < _d.length; _c++) { + var element = _d[_c]; + addLeafNode(element); + } + } + } + break; + case 300: + addNodeWithRecursiveChild(node, node.name); + break; + case 301: + var expression = node.expression; + ts6.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); + break; + case 205: + case 299: + case 257: { + var child = node; + if (ts6.isBindingPattern(child.name)) { + addChildrenRecursively(child.name); + } else { + addNodeWithRecursiveInitializer(child); + } + break; + } + case 259: + var nameNode = node.name; + if (nameNode && ts6.isIdentifier(nameNode)) { + addTrackedEs5Class(nameNode.text); + } + addNodeWithRecursiveChild(node, node.body); + break; + case 216: + case 215: + addNodeWithRecursiveChild(node, node.body); + break; + case 263: + startNode(node); + for (var _e = 0, _f = node.members; _e < _f.length; _e++) { + var member = _f[_e]; + if (!isComputedProperty(member)) { + addLeafNode(member); + } + } + endNode(); + break; + case 260: + case 228: + case 261: + startNode(node); + for (var _g = 0, _h = node.members; _g < _h.length; _g++) { + var member = _h[_g]; + addChildrenRecursively(member); + } + endNode(); + break; + case 264: + addNodeWithRecursiveChild(node, getInteriorModule(node).body); + break; + case 274: { + var expression_1 = node.expression; + var child = ts6.isObjectLiteralExpression(expression_1) || ts6.isCallExpression(expression_1) ? expression_1 : ts6.isArrowFunction(expression_1) || ts6.isFunctionExpression(expression_1) ? expression_1.body : void 0; + if (child) { + startNode(node); + addChildrenRecursively(child); + endNode(); + } else { + addLeafNode(node); + } + break; + } + case 278: + case 268: + case 178: + case 176: + case 177: + case 262: + addLeafNode(node); + break; + case 210: + case 223: { + var special = ts6.getAssignmentDeclarationKind(node); + switch (special) { + case 1: + case 2: + addNodeWithRecursiveChild(node, node.right); + return; + case 6: + case 3: { + var binaryExpression = node; + var assignmentTarget = binaryExpression.left; + var prototypeAccess = special === 3 ? assignmentTarget.expression : assignmentTarget; + var depth = 0; + var className = void 0; + if (ts6.isIdentifier(prototypeAccess.expression)) { + addTrackedEs5Class(prototypeAccess.expression.text); + className = prototypeAccess.expression; + } else { + _a2 = startNestedNodes(binaryExpression, prototypeAccess.expression), depth = _a2[0], className = _a2[1]; + } + if (special === 6) { + if (ts6.isObjectLiteralExpression(binaryExpression.right)) { + if (binaryExpression.right.properties.length > 0) { + startNode(binaryExpression, className); + ts6.forEachChild(binaryExpression.right, addChildrenRecursively); + endNode(); + } + } + } else if (ts6.isFunctionExpression(binaryExpression.right) || ts6.isArrowFunction(binaryExpression.right)) { + addNodeWithRecursiveChild(node, binaryExpression.right, className); + } else { + startNode(binaryExpression, className); + addNodeWithRecursiveChild(node, binaryExpression.right, assignmentTarget.name); + endNode(); + } + endNestedNodes(depth); + return; + } + case 7: + case 9: { + var defineCall = node; + var className = special === 7 ? defineCall.arguments[0] : defineCall.arguments[0].expression; + var memberName = defineCall.arguments[1]; + var _j = startNestedNodes(node, className), depth = _j[0], classNameIdentifier = _j[1]; + startNode(node, classNameIdentifier); + startNode(node, ts6.setTextRange(ts6.factory.createIdentifier(memberName.text), memberName)); + addChildrenRecursively(node.arguments[2]); + endNode(); + endNode(); + endNestedNodes(depth); + return; + } + case 5: { + var binaryExpression = node; + var assignmentTarget = binaryExpression.left; + var targetFunction = assignmentTarget.expression; + if (ts6.isIdentifier(targetFunction) && ts6.getElementOrPropertyAccessName(assignmentTarget) !== "prototype" && trackedEs5Classes && trackedEs5Classes.has(targetFunction.text)) { + if (ts6.isFunctionExpression(binaryExpression.right) || ts6.isArrowFunction(binaryExpression.right)) { + addNodeWithRecursiveChild(node, binaryExpression.right, targetFunction); + } else if (ts6.isBindableStaticAccessExpression(assignmentTarget)) { + startNode(binaryExpression, targetFunction); + addNodeWithRecursiveChild(binaryExpression.left, binaryExpression.right, ts6.getNameOrArgument(assignmentTarget)); + endNode(); + } + return; + } + break; + } + case 4: + case 0: + case 8: + break; + default: + ts6.Debug.assertNever(special); + } + } + default: + if (ts6.hasJSDocNodes(node)) { + ts6.forEach(node.jsDoc, function(jsDoc) { + ts6.forEach(jsDoc.tags, function(tag) { + if (ts6.isJSDocTypeAlias(tag)) { + addLeafNode(tag); + } + }); + }); + } + ts6.forEachChild(node, addChildrenRecursively); + } + } + function mergeChildren(children, node) { + var nameToItems = new ts6.Map(); + ts6.filterMutate(children, function(child, index) { + var declName = child.name || ts6.getNameOfDeclaration(child.node); + var name = declName && nodeText(declName); + if (!name) { + return true; + } + var itemsWithSameName = nameToItems.get(name); + if (!itemsWithSameName) { + nameToItems.set(name, child); + return true; + } + if (itemsWithSameName instanceof Array) { + for (var _i = 0, itemsWithSameName_1 = itemsWithSameName; _i < itemsWithSameName_1.length; _i++) { + var itemWithSameName = itemsWithSameName_1[_i]; + if (tryMerge(itemWithSameName, child, index, node)) { + return false; + } + } + itemsWithSameName.push(child); + return true; + } else { + var itemWithSameName = itemsWithSameName; + if (tryMerge(itemWithSameName, child, index, node)) { + return false; + } + nameToItems.set(name, [itemWithSameName, child]); + return true; + } + }); + } + var isEs5ClassMember = (_a = {}, _a[ + 5 + /* AssignmentDeclarationKind.Property */ + ] = true, _a[ + 3 + /* AssignmentDeclarationKind.PrototypeProperty */ + ] = true, _a[ + 7 + /* AssignmentDeclarationKind.ObjectDefinePropertyValue */ + ] = true, _a[ + 9 + /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ + ] = true, _a[ + 0 + /* AssignmentDeclarationKind.None */ + ] = false, _a[ + 1 + /* AssignmentDeclarationKind.ExportsProperty */ + ] = false, _a[ + 2 + /* AssignmentDeclarationKind.ModuleExports */ + ] = false, _a[ + 8 + /* AssignmentDeclarationKind.ObjectDefinePropertyExports */ + ] = false, _a[ + 6 + /* AssignmentDeclarationKind.Prototype */ + ] = true, _a[ + 4 + /* AssignmentDeclarationKind.ThisProperty */ + ] = false, _a); + function tryMergeEs5Class(a, b, bIndex, parent2) { + function isPossibleConstructor(node) { + return ts6.isFunctionExpression(node) || ts6.isFunctionDeclaration(node) || ts6.isVariableDeclaration(node); + } + var bAssignmentDeclarationKind = ts6.isBinaryExpression(b.node) || ts6.isCallExpression(b.node) ? ts6.getAssignmentDeclarationKind(b.node) : 0; + var aAssignmentDeclarationKind = ts6.isBinaryExpression(a.node) || ts6.isCallExpression(a.node) ? ts6.getAssignmentDeclarationKind(a.node) : 0; + if (isEs5ClassMember[bAssignmentDeclarationKind] && isEs5ClassMember[aAssignmentDeclarationKind] || isPossibleConstructor(a.node) && isEs5ClassMember[bAssignmentDeclarationKind] || isPossibleConstructor(b.node) && isEs5ClassMember[aAssignmentDeclarationKind] || ts6.isClassDeclaration(a.node) && isSynthesized(a.node) && isEs5ClassMember[bAssignmentDeclarationKind] || ts6.isClassDeclaration(b.node) && isEs5ClassMember[aAssignmentDeclarationKind] || ts6.isClassDeclaration(a.node) && isSynthesized(a.node) && isPossibleConstructor(b.node) || ts6.isClassDeclaration(b.node) && isPossibleConstructor(a.node) && isSynthesized(a.node)) { + var lastANode = a.additionalNodes && ts6.lastOrUndefined(a.additionalNodes) || a.node; + if (!ts6.isClassDeclaration(a.node) && !ts6.isClassDeclaration(b.node) || isPossibleConstructor(a.node) || isPossibleConstructor(b.node)) { + var ctorFunction = isPossibleConstructor(a.node) ? a.node : isPossibleConstructor(b.node) ? b.node : void 0; + if (ctorFunction !== void 0) { + var ctorNode = ts6.setTextRange(ts6.factory.createConstructorDeclaration( + /* modifiers */ + void 0, + [], + /* body */ + void 0 + ), ctorFunction); + var ctor = emptyNavigationBarNode(ctorNode); + ctor.indent = a.indent + 1; + ctor.children = a.node === ctorFunction ? a.children : b.children; + a.children = a.node === ctorFunction ? ts6.concatenate([ctor], b.children || [b]) : ts6.concatenate(a.children || [__assign({}, a)], [ctor]); + } else { + if (a.children || b.children) { + a.children = ts6.concatenate(a.children || [__assign({}, a)], b.children || [b]); + if (a.children) { + mergeChildren(a.children, a); + sortChildren(a.children); + } + } + } + lastANode = a.node = ts6.setTextRange(ts6.factory.createClassDeclaration( + /* modifiers */ + void 0, + a.name || ts6.factory.createIdentifier("__class__"), + /* typeParameters */ + void 0, + /* heritageClauses */ + void 0, + [] + ), a.node); + } else { + a.children = ts6.concatenate(a.children, b.children); + if (a.children) { + mergeChildren(a.children, a); + } + } + var bNode = b.node; + if (parent2.children[bIndex - 1].node.end === lastANode.end) { + ts6.setTextRange(lastANode, { pos: lastANode.pos, end: bNode.end }); + } else { + if (!a.additionalNodes) + a.additionalNodes = []; + a.additionalNodes.push(ts6.setTextRange(ts6.factory.createClassDeclaration( + /* modifiers */ + void 0, + a.name || ts6.factory.createIdentifier("__class__"), + /* typeParameters */ + void 0, + /* heritageClauses */ + void 0, + [] + ), b.node)); + } + return true; + } + return bAssignmentDeclarationKind === 0 ? false : true; + } + function tryMerge(a, b, bIndex, parent2) { + if (tryMergeEs5Class(a, b, bIndex, parent2)) { + return true; + } + if (shouldReallyMerge(a.node, b.node, parent2)) { + merge(a, b); + return true; + } + return false; + } + function shouldReallyMerge(a, b, parent2) { + if (a.kind !== b.kind || a.parent !== b.parent && !(isOwnChild(a, parent2) && isOwnChild(b, parent2))) { + return false; + } + switch (a.kind) { + case 169: + case 171: + case 174: + case 175: + return ts6.isStatic(a) === ts6.isStatic(b); + case 264: + return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); + default: + return true; + } + } + function isSynthesized(node) { + return !!(node.flags & 8); + } + function isOwnChild(n, parent2) { + var par = ts6.isModuleBlock(n.parent) ? n.parent.parent : n.parent; + return par === parent2.node || ts6.contains(parent2.additionalNodes, par); + } + function areSameModule(a, b) { + if (!a.body || !b.body) { + return a.body === b.body; + } + return a.body.kind === b.body.kind && (a.body.kind !== 264 || areSameModule(a.body, b.body)); + } + function merge(target, source) { + var _a2; + target.additionalNodes = target.additionalNodes || []; + target.additionalNodes.push(source.node); + if (source.additionalNodes) { + (_a2 = target.additionalNodes).push.apply(_a2, source.additionalNodes); + } + target.children = ts6.concatenate(target.children, source.children); + if (target.children) { + mergeChildren(target.children, target); + sortChildren(target.children); + } + } + function sortChildren(children) { + children.sort(compareChildren); + } + function compareChildren(child1, child2) { + return ts6.compareStringsCaseSensitiveUI(tryGetName(child1.node), tryGetName(child2.node)) || ts6.compareValues(navigationBarNodeKind(child1), navigationBarNodeKind(child2)); + } + function tryGetName(node) { + if (node.kind === 264) { + return getModuleName(node); + } + var declName = ts6.getNameOfDeclaration(node); + if (declName && ts6.isPropertyName(declName)) { + var propertyName = ts6.getPropertyNameForPropertyNameNode(declName); + return propertyName && ts6.unescapeLeadingUnderscores(propertyName); + } + switch (node.kind) { + case 215: + case 216: + case 228: + return getFunctionOrClassName(node); + default: + return void 0; + } + } + function getItemName(node, name) { + if (node.kind === 264) { + return cleanText(getModuleName(node)); + } + if (name) { + var text = ts6.isIdentifier(name) ? name.text : ts6.isElementAccessExpression(name) ? "[".concat(nodeText(name.argumentExpression), "]") : nodeText(name); + if (text.length > 0) { + return cleanText(text); + } + } + switch (node.kind) { + case 308: + var sourceFile = node; + return ts6.isExternalModule(sourceFile) ? '"'.concat(ts6.escapeString(ts6.getBaseFileName(ts6.removeFileExtension(ts6.normalizePath(sourceFile.fileName)))), '"') : ""; + case 274: + return ts6.isExportAssignment(node) && node.isExportEquals ? "export=" : "default"; + case 216: + case 259: + case 215: + case 260: + case 228: + if (ts6.getSyntacticModifierFlags(node) & 1024) { + return "default"; + } + return getFunctionOrClassName(node); + case 173: + return "constructor"; + case 177: + return "new()"; + case 176: + return "()"; + case 178: + return "[]"; + default: + return ""; + } + } + function primaryNavBarMenuItems(root) { + var primaryNavBarMenuItems2 = []; + function recur(item) { + if (shouldAppearInPrimaryNavBarMenu(item)) { + primaryNavBarMenuItems2.push(item); + if (item.children) { + for (var _i = 0, _a2 = item.children; _i < _a2.length; _i++) { + var child = _a2[_i]; + recur(child); + } + } + } + } + recur(root); + return primaryNavBarMenuItems2; + function shouldAppearInPrimaryNavBarMenu(item) { + if (item.children) { + return true; + } + switch (navigationBarNodeKind(item)) { + case 260: + case 228: + case 263: + case 261: + case 264: + case 308: + case 262: + case 348: + case 341: + return true; + case 216: + case 259: + case 215: + return isTopLevelFunctionDeclaration(item); + default: + return false; + } + function isTopLevelFunctionDeclaration(item2) { + if (!item2.node.body) { + return false; + } + switch (navigationBarNodeKind(item2.parent)) { + case 265: + case 308: + case 171: + case 173: + return true; + default: + return false; + } + } + } + } + function convertToTree(n) { + return { + text: getItemName(n.node, n.name), + kind: ts6.getNodeKind(n.node), + kindModifiers: getModifiers(n.node), + spans: getSpans(n), + nameSpan: n.name && getNodeSpan(n.name), + childItems: ts6.map(n.children, convertToTree) + }; + } + function convertToPrimaryNavBarMenuItem(n) { + return { + text: getItemName(n.node, n.name), + kind: ts6.getNodeKind(n.node), + kindModifiers: getModifiers(n.node), + spans: getSpans(n), + childItems: ts6.map(n.children, convertToSecondaryNavBarMenuItem) || emptyChildItemArray, + indent: n.indent, + bolded: false, + grayed: false + }; + function convertToSecondaryNavBarMenuItem(n2) { + return { + text: getItemName(n2.node, n2.name), + kind: ts6.getNodeKind(n2.node), + kindModifiers: ts6.getNodeModifiers(n2.node), + spans: getSpans(n2), + childItems: emptyChildItemArray, + indent: 0, + bolded: false, + grayed: false + }; + } + } + function getSpans(n) { + var spans = [getNodeSpan(n.node)]; + if (n.additionalNodes) { + for (var _i = 0, _a2 = n.additionalNodes; _i < _a2.length; _i++) { + var node = _a2[_i]; + spans.push(getNodeSpan(node)); + } + } + return spans; + } + function getModuleName(moduleDeclaration) { + if (ts6.isAmbientModule(moduleDeclaration)) { + return ts6.getTextOfNode(moduleDeclaration.name); + } + return getFullyQualifiedModuleName(moduleDeclaration); + } + function getFullyQualifiedModuleName(moduleDeclaration) { + var result = [ts6.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264) { + moduleDeclaration = moduleDeclaration.body; + result.push(ts6.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); + } + return result.join("."); + } + function getInteriorModule(decl) { + return decl.body && ts6.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; + } + function isComputedProperty(member) { + return !member.name || member.name.kind === 164; + } + function getNodeSpan(node) { + return node.kind === 308 ? ts6.createTextSpanFromRange(node) : ts6.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 257) { + node = node.parent; + } + return ts6.getNodeModifiers(node); + } + function getFunctionOrClassName(node) { + var parent2 = node.parent; + if (node.name && ts6.getFullWidth(node.name) > 0) { + return cleanText(ts6.declarationNameToString(node.name)); + } else if (ts6.isVariableDeclaration(parent2)) { + return cleanText(ts6.declarationNameToString(parent2.name)); + } else if (ts6.isBinaryExpression(parent2) && parent2.operatorToken.kind === 63) { + return nodeText(parent2.left).replace(whiteSpaceRegex, ""); + } else if (ts6.isPropertyAssignment(parent2)) { + return nodeText(parent2.name); + } else if (ts6.getSyntacticModifierFlags(node) & 1024) { + return "default"; + } else if (ts6.isClassLike(node)) { + return ""; + } else if (ts6.isCallExpression(parent2)) { + var name = getCalledExpressionName(parent2.expression); + if (name !== void 0) { + name = cleanText(name); + if (name.length > maxLength) { + return "".concat(name, " callback"); + } + var args = cleanText(ts6.mapDefined(parent2.arguments, function(a) { + return ts6.isStringLiteralLike(a) ? a.getText(curSourceFile) : void 0; + }).join(", ")); + return "".concat(name, "(").concat(args, ") callback"); + } + } + return ""; + } + function getCalledExpressionName(expr) { + if (ts6.isIdentifier(expr)) { + return expr.text; + } else if (ts6.isPropertyAccessExpression(expr)) { + var left = getCalledExpressionName(expr.expression); + var right = expr.name.text; + return left === void 0 ? right : "".concat(left, ".").concat(right); + } else { + return void 0; + } + } + function isFunctionOrClassExpression(node) { + switch (node.kind) { + case 216: + case 215: + case 228: + return true; + default: + return false; + } + } + function cleanText(text) { + text = text.length > maxLength ? text.substring(0, maxLength) + "..." : text; + return text.replace(/\\?(\r?\n|\r|\u2028|\u2029)/g, ""); + } + })(NavigationBar = ts6.NavigationBar || (ts6.NavigationBar = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var OrganizeImports; + (function(OrganizeImports2) { + function organizeImports(sourceFile, formatContext, host, program, preferences, mode) { + var changeTracker = ts6.textChanges.ChangeTracker.fromContext({ host, formatContext, preferences }); + var shouldSort = mode === "SortAndCombine" || mode === "All"; + var shouldCombine = shouldSort; + var shouldRemove = mode === "RemoveUnused" || mode === "All"; + var maybeRemove = shouldRemove ? removeUnusedImports : ts6.identity; + var maybeCoalesce = shouldCombine ? coalesceImports : ts6.identity; + var processImportsOfSameModuleSpecifier = function(importGroup) { + var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program)); + return shouldSort ? ts6.stableSort(processedDeclarations, function(s1, s2) { + return compareImportsOrRequireStatements(s1, s2); + }) : processedDeclarations; + }; + var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts6.isImportDeclaration)); + topLevelImportGroupDecls.forEach(function(importGroupDecl) { + return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); + }); + if (mode !== "RemoveUnused") { + var topLevelExportDecls = sourceFile.statements.filter(ts6.isExportDeclaration); + organizeImportsWorker(topLevelExportDecls, coalesceExports); + } + for (var _i = 0, _a = sourceFile.statements.filter(ts6.isAmbientModule); _i < _a.length; _i++) { + var ambientModule = _a[_i]; + if (!ambientModule.body) + continue; + var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts6.isImportDeclaration)); + ambientModuleImportGroupDecls.forEach(function(importGroupDecl) { + return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); + }); + if (mode !== "RemoveUnused") { + var ambientModuleExportDecls = ambientModule.body.statements.filter(ts6.isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + } + } + return changeTracker.getChanges(); + function organizeImportsWorker(oldImportDecls, coalesce) { + if (ts6.length(oldImportDecls) === 0) { + return; + } + ts6.suppressLeadingTrivia(oldImportDecls[0]); + var oldImportGroups = shouldCombine ? ts6.group(oldImportDecls, function(importDecl) { + return getExternalModuleName(importDecl.moduleSpecifier); + }) : [oldImportDecls]; + var sortedImportGroups = shouldSort ? ts6.stableSort(oldImportGroups, function(group1, group2) { + return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); + }) : oldImportGroups; + var newImportDecls = ts6.flatMap(sortedImportGroups, function(importGroup) { + return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup; + }); + if (newImportDecls.length === 0) { + changeTracker.deleteNodes( + sourceFile, + oldImportDecls, + { + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Include + }, + /*hasTrailingComment*/ + true + ); + } else { + var replaceOptions = { + leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.Exclude, + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Include, + suffix: ts6.getNewLineOrDefaultFromHost(host, formatContext.options) + }; + changeTracker.replaceNodeWithNodes(sourceFile, oldImportDecls[0], newImportDecls, replaceOptions); + var hasTrailingComment = changeTracker.nodeHasTrailingComment(sourceFile, oldImportDecls[0], replaceOptions); + changeTracker.deleteNodes(sourceFile, oldImportDecls.slice(1), { + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Include + }, hasTrailingComment); + } + } + } + OrganizeImports2.organizeImports = organizeImports; + function groupImportsByNewlineContiguous(sourceFile, importDecls) { + var scanner = ts6.createScanner( + sourceFile.languageVersion, + /*skipTrivia*/ + false, + sourceFile.languageVariant + ); + var groupImports = []; + var groupIndex = 0; + for (var _i = 0, importDecls_1 = importDecls; _i < importDecls_1.length; _i++) { + var topLevelImportDecl = importDecls_1[_i]; + if (isNewGroup(sourceFile, topLevelImportDecl, scanner)) { + groupIndex++; + } + if (!groupImports[groupIndex]) { + groupImports[groupIndex] = []; + } + groupImports[groupIndex].push(topLevelImportDecl); + } + return groupImports; + } + function isNewGroup(sourceFile, topLevelImportDecl, scanner) { + var startPos = topLevelImportDecl.getFullStart(); + var endPos = topLevelImportDecl.getStart(); + scanner.setText(sourceFile.text, startPos, endPos - startPos); + var numberOfNewLines = 0; + while (scanner.getTokenPos() < endPos) { + var tokenKind = scanner.scan(); + if (tokenKind === 4) { + numberOfNewLines++; + if (numberOfNewLines >= 2) { + return true; + } + } + } + return false; + } + function removeUnusedImports(oldImports, sourceFile, program) { + var typeChecker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); + var jsxNamespace = typeChecker.getJsxNamespace(sourceFile); + var jsxFragmentFactory = typeChecker.getJsxFragmentFactory(sourceFile); + var jsxElementsPresent = !!(sourceFile.transformFlags & 2); + var usedImports = []; + for (var _i = 0, oldImports_1 = oldImports; _i < oldImports_1.length; _i++) { + var importDecl = oldImports_1[_i]; + var importClause = importDecl.importClause, moduleSpecifier = importDecl.moduleSpecifier; + if (!importClause) { + usedImports.push(importDecl); + continue; + } + var name = importClause.name, namedBindings = importClause.namedBindings; + if (name && !isDeclarationUsed(name)) { + name = void 0; + } + if (namedBindings) { + if (ts6.isNamespaceImport(namedBindings)) { + if (!isDeclarationUsed(namedBindings.name)) { + namedBindings = void 0; + } + } else { + var newElements = namedBindings.elements.filter(function(e) { + return isDeclarationUsed(e.name); + }); + if (newElements.length < namedBindings.elements.length) { + namedBindings = newElements.length ? ts6.factory.updateNamedImports(namedBindings, newElements) : void 0; + } + } + } + if (name || namedBindings) { + usedImports.push(updateImportDeclarationAndClause(importDecl, name, namedBindings)); + } else if (hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier)) { + if (sourceFile.isDeclarationFile) { + usedImports.push(ts6.factory.createImportDeclaration( + importDecl.modifiers, + /*importClause*/ + void 0, + moduleSpecifier, + /*assertClause*/ + void 0 + )); + } else { + usedImports.push(importDecl); + } + } + } + return usedImports; + function isDeclarationUsed(identifier) { + return jsxElementsPresent && (identifier.text === jsxNamespace || jsxFragmentFactory && identifier.text === jsxFragmentFactory) && ts6.jsxModeNeedsExplicitImport(compilerOptions.jsx) || ts6.FindAllReferences.Core.isSymbolReferencedInFile(identifier, typeChecker, sourceFile); + } + } + function hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier) { + var moduleSpecifierText = ts6.isStringLiteral(moduleSpecifier) && moduleSpecifier.text; + return ts6.isString(moduleSpecifierText) && ts6.some(sourceFile.moduleAugmentations, function(moduleName) { + return ts6.isStringLiteral(moduleName) && moduleName.text === moduleSpecifierText; + }); + } + function getExternalModuleName(specifier) { + return specifier !== void 0 && ts6.isStringLiteralLike(specifier) ? specifier.text : void 0; + } + function coalesceImports(importGroup) { + var _a; + if (importGroup.length === 0) { + return importGroup; + } + var _b = getCategorizedImports(importGroup), importWithoutClause = _b.importWithoutClause, typeOnlyImports = _b.typeOnlyImports, regularImports = _b.regularImports; + var coalescedImports = []; + if (importWithoutClause) { + coalescedImports.push(importWithoutClause); + } + for (var _i = 0, _c = [regularImports, typeOnlyImports]; _i < _c.length; _i++) { + var group_2 = _c[_i]; + var isTypeOnly = group_2 === typeOnlyImports; + var defaultImports = group_2.defaultImports, namespaceImports = group_2.namespaceImports, namedImports = group_2.namedImports; + if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) { + var defaultImport = defaultImports[0]; + coalescedImports.push(updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)); + continue; + } + var sortedNamespaceImports = ts6.stableSort(namespaceImports, function(i1, i2) { + return compareIdentifiers(i1.importClause.namedBindings.name, i2.importClause.namedBindings.name); + }); + for (var _d = 0, sortedNamespaceImports_1 = sortedNamespaceImports; _d < sortedNamespaceImports_1.length; _d++) { + var namespaceImport = sortedNamespaceImports_1[_d]; + coalescedImports.push(updateImportDeclarationAndClause( + namespaceImport, + /*name*/ + void 0, + namespaceImport.importClause.namedBindings + )); + } + if (defaultImports.length === 0 && namedImports.length === 0) { + continue; + } + var newDefaultImport = void 0; + var newImportSpecifiers = []; + if (defaultImports.length === 1) { + newDefaultImport = defaultImports[0].importClause.name; + } else { + for (var _e = 0, defaultImports_1 = defaultImports; _e < defaultImports_1.length; _e++) { + var defaultImport = defaultImports_1[_e]; + newImportSpecifiers.push(ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + ts6.factory.createIdentifier("default"), + defaultImport.importClause.name + )); + } + } + newImportSpecifiers.push.apply(newImportSpecifiers, getNewImportSpecifiers(namedImports)); + var sortedImportSpecifiers = sortSpecifiers(newImportSpecifiers); + var importDecl = defaultImports.length > 0 ? defaultImports[0] : namedImports[0]; + var newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : ts6.factory.createNamedImports(ts6.emptyArray) : namedImports.length === 0 ? ts6.factory.createNamedImports(sortedImportSpecifiers) : ts6.factory.updateNamedImports(namedImports[0].importClause.namedBindings, sortedImportSpecifiers); + if (isTypeOnly && newDefaultImport && newNamedImports) { + coalescedImports.push(updateImportDeclarationAndClause( + importDecl, + newDefaultImport, + /*namedBindings*/ + void 0 + )); + coalescedImports.push(updateImportDeclarationAndClause( + (_a = namedImports[0]) !== null && _a !== void 0 ? _a : importDecl, + /*name*/ + void 0, + newNamedImports + )); + } else { + coalescedImports.push(updateImportDeclarationAndClause(importDecl, newDefaultImport, newNamedImports)); + } + } + return coalescedImports; + } + OrganizeImports2.coalesceImports = coalesceImports; + function getCategorizedImports(importGroup) { + var importWithoutClause; + var typeOnlyImports = { defaultImports: [], namespaceImports: [], namedImports: [] }; + var regularImports = { defaultImports: [], namespaceImports: [], namedImports: [] }; + for (var _i = 0, importGroup_1 = importGroup; _i < importGroup_1.length; _i++) { + var importDeclaration = importGroup_1[_i]; + if (importDeclaration.importClause === void 0) { + importWithoutClause = importWithoutClause || importDeclaration; + continue; + } + var group_3 = importDeclaration.importClause.isTypeOnly ? typeOnlyImports : regularImports; + var _a = importDeclaration.importClause, name = _a.name, namedBindings = _a.namedBindings; + if (name) { + group_3.defaultImports.push(importDeclaration); + } + if (namedBindings) { + if (ts6.isNamespaceImport(namedBindings)) { + group_3.namespaceImports.push(importDeclaration); + } else { + group_3.namedImports.push(importDeclaration); + } + } + } + return { + importWithoutClause, + typeOnlyImports, + regularImports + }; + } + function coalesceExports(exportGroup) { + if (exportGroup.length === 0) { + return exportGroup; + } + var _a = getCategorizedExports(exportGroup), exportWithoutClause = _a.exportWithoutClause, namedExports = _a.namedExports, typeOnlyExports = _a.typeOnlyExports; + var coalescedExports = []; + if (exportWithoutClause) { + coalescedExports.push(exportWithoutClause); + } + for (var _i = 0, _b = [namedExports, typeOnlyExports]; _i < _b.length; _i++) { + var exportGroup_1 = _b[_i]; + if (exportGroup_1.length === 0) { + continue; + } + var newExportSpecifiers = []; + newExportSpecifiers.push.apply(newExportSpecifiers, ts6.flatMap(exportGroup_1, function(i) { + return i.exportClause && ts6.isNamedExports(i.exportClause) ? i.exportClause.elements : ts6.emptyArray; + })); + var sortedExportSpecifiers = sortSpecifiers(newExportSpecifiers); + var exportDecl = exportGroup_1[0]; + coalescedExports.push(ts6.factory.updateExportDeclaration(exportDecl, exportDecl.modifiers, exportDecl.isTypeOnly, exportDecl.exportClause && (ts6.isNamedExports(exportDecl.exportClause) ? ts6.factory.updateNamedExports(exportDecl.exportClause, sortedExportSpecifiers) : ts6.factory.updateNamespaceExport(exportDecl.exportClause, exportDecl.exportClause.name)), exportDecl.moduleSpecifier, exportDecl.assertClause)); + } + return coalescedExports; + function getCategorizedExports(exportGroup2) { + var exportWithoutClause2; + var namedExports2 = []; + var typeOnlyExports2 = []; + for (var _i2 = 0, exportGroup_2 = exportGroup2; _i2 < exportGroup_2.length; _i2++) { + var exportDeclaration = exportGroup_2[_i2]; + if (exportDeclaration.exportClause === void 0) { + exportWithoutClause2 = exportWithoutClause2 || exportDeclaration; + } else if (exportDeclaration.isTypeOnly) { + typeOnlyExports2.push(exportDeclaration); + } else { + namedExports2.push(exportDeclaration); + } + } + return { + exportWithoutClause: exportWithoutClause2, + namedExports: namedExports2, + typeOnlyExports: typeOnlyExports2 + }; + } + } + OrganizeImports2.coalesceExports = coalesceExports; + function updateImportDeclarationAndClause(importDeclaration, name, namedBindings) { + return ts6.factory.updateImportDeclaration( + importDeclaration, + importDeclaration.modifiers, + ts6.factory.updateImportClause(importDeclaration.importClause, importDeclaration.importClause.isTypeOnly, name, namedBindings), + // TODO: GH#18217 + importDeclaration.moduleSpecifier, + importDeclaration.assertClause + ); + } + function sortSpecifiers(specifiers) { + return ts6.stableSort(specifiers, compareImportOrExportSpecifiers); + } + function compareImportOrExportSpecifiers(s1, s2) { + return ts6.compareBooleans(s1.isTypeOnly, s2.isTypeOnly) || compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) || compareIdentifiers(s1.name, s2.name); + } + OrganizeImports2.compareImportOrExportSpecifiers = compareImportOrExportSpecifiers; + function compareModuleSpecifiers(m1, m2) { + var name1 = m1 === void 0 ? void 0 : getExternalModuleName(m1); + var name2 = m2 === void 0 ? void 0 : getExternalModuleName(m2); + return ts6.compareBooleans(name1 === void 0, name2 === void 0) || ts6.compareBooleans(ts6.isExternalModuleNameRelative(name1), ts6.isExternalModuleNameRelative(name2)) || ts6.compareStringsCaseInsensitive(name1, name2); + } + OrganizeImports2.compareModuleSpecifiers = compareModuleSpecifiers; + function compareIdentifiers(s1, s2) { + return ts6.compareStringsCaseInsensitive(s1.text, s2.text); + } + function getModuleSpecifierExpression(declaration) { + var _a; + switch (declaration.kind) { + case 268: + return (_a = ts6.tryCast(declaration.moduleReference, ts6.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; + case 269: + return declaration.moduleSpecifier; + case 240: + return declaration.declarationList.declarations[0].initializer.arguments[0]; + } + } + function importsAreSorted(imports) { + return ts6.arrayIsSorted(imports, compareImportsOrRequireStatements); + } + OrganizeImports2.importsAreSorted = importsAreSorted; + function importSpecifiersAreSorted(imports) { + return ts6.arrayIsSorted(imports, compareImportOrExportSpecifiers); + } + OrganizeImports2.importSpecifiersAreSorted = importSpecifiersAreSorted; + function getImportDeclarationInsertionIndex(sortedImports, newImport) { + var index = ts6.binarySearch(sortedImports, newImport, ts6.identity, compareImportsOrRequireStatements); + return index < 0 ? ~index : index; + } + OrganizeImports2.getImportDeclarationInsertionIndex = getImportDeclarationInsertionIndex; + function getImportSpecifierInsertionIndex(sortedImports, newImport) { + var index = ts6.binarySearch(sortedImports, newImport, ts6.identity, compareImportOrExportSpecifiers); + return index < 0 ? ~index : index; + } + OrganizeImports2.getImportSpecifierInsertionIndex = getImportSpecifierInsertionIndex; + function compareImportsOrRequireStatements(s1, s2) { + return compareModuleSpecifiers(getModuleSpecifierExpression(s1), getModuleSpecifierExpression(s2)) || compareImportKind(s1, s2); + } + OrganizeImports2.compareImportsOrRequireStatements = compareImportsOrRequireStatements; + function compareImportKind(s1, s2) { + return ts6.compareValues(getImportKindOrder(s1), getImportKindOrder(s2)); + } + function getImportKindOrder(s1) { + var _a; + switch (s1.kind) { + case 269: + if (!s1.importClause) + return 0; + if (s1.importClause.isTypeOnly) + return 1; + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271) + return 2; + if (s1.importClause.name) + return 3; + return 4; + case 268: + return 5; + case 240: + return 6; + } + } + function getNewImportSpecifiers(namedImports) { + return ts6.flatMap(namedImports, function(namedImport) { + return ts6.map(tryGetNamedBindingElements(namedImport), function(importSpecifier) { + return importSpecifier.name && importSpecifier.propertyName && importSpecifier.name.escapedText === importSpecifier.propertyName.escapedText ? ts6.factory.updateImportSpecifier( + importSpecifier, + importSpecifier.isTypeOnly, + /*propertyName*/ + void 0, + importSpecifier.name + ) : importSpecifier; + }); + }); + } + function tryGetNamedBindingElements(namedImport) { + var _a; + return ((_a = namedImport.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings) && ts6.isNamedImports(namedImport.importClause.namedBindings) ? namedImport.importClause.namedBindings.elements : void 0; + } + })(OrganizeImports = ts6.OrganizeImports || (ts6.OrganizeImports = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var OutliningElementsCollector; + (function(OutliningElementsCollector2) { + function collectElements(sourceFile, cancellationToken) { + var res = []; + addNodeOutliningSpans(sourceFile, cancellationToken, res); + addRegionOutliningSpans(sourceFile, res); + return res.sort(function(span1, span2) { + return span1.textSpan.start - span2.textSpan.start; + }); + } + OutliningElementsCollector2.collectElements = collectElements; + function addNodeOutliningSpans(sourceFile, cancellationToken, out) { + var depthRemaining = 40; + var current = 0; + var statements = __spreadArray(__spreadArray([], sourceFile.statements, true), [sourceFile.endOfFileToken], false); + var n = statements.length; + while (current < n) { + while (current < n && !ts6.isAnyImportSyntax(statements[current])) { + visitNonImportNode(statements[current]); + current++; + } + if (current === n) + break; + var firstImport = current; + while (current < n && ts6.isAnyImportSyntax(statements[current])) { + addOutliningForLeadingCommentsForNode(statements[current], sourceFile, cancellationToken, out); + current++; + } + var lastImport = current - 1; + if (lastImport !== firstImport) { + out.push(createOutliningSpanFromBounds( + ts6.findChildOfKind(statements[firstImport], 100, sourceFile).getStart(sourceFile), + statements[lastImport].getEnd(), + "imports" + /* OutliningSpanKind.Imports */ + )); + } + } + function visitNonImportNode(n2) { + var _a; + if (depthRemaining === 0) + return; + cancellationToken.throwIfCancellationRequested(); + if (ts6.isDeclaration(n2) || ts6.isVariableStatement(n2) || ts6.isReturnStatement(n2) || ts6.isCallOrNewExpression(n2) || n2.kind === 1) { + addOutliningForLeadingCommentsForNode(n2, sourceFile, cancellationToken, out); + } + if (ts6.isFunctionLike(n2) && ts6.isBinaryExpression(n2.parent) && ts6.isPropertyAccessExpression(n2.parent.left)) { + addOutliningForLeadingCommentsForNode(n2.parent.left, sourceFile, cancellationToken, out); + } + if (ts6.isBlock(n2) || ts6.isModuleBlock(n2)) { + addOutliningForLeadingCommentsForPos(n2.statements.end, sourceFile, cancellationToken, out); + } + if (ts6.isClassLike(n2) || ts6.isInterfaceDeclaration(n2)) { + addOutliningForLeadingCommentsForPos(n2.members.end, sourceFile, cancellationToken, out); + } + var span = getOutliningSpanForNode(n2, sourceFile); + if (span) + out.push(span); + depthRemaining--; + if (ts6.isCallExpression(n2)) { + depthRemaining++; + visitNonImportNode(n2.expression); + depthRemaining--; + n2.arguments.forEach(visitNonImportNode); + (_a = n2.typeArguments) === null || _a === void 0 ? void 0 : _a.forEach(visitNonImportNode); + } else if (ts6.isIfStatement(n2) && n2.elseStatement && ts6.isIfStatement(n2.elseStatement)) { + visitNonImportNode(n2.expression); + visitNonImportNode(n2.thenStatement); + depthRemaining++; + visitNonImportNode(n2.elseStatement); + depthRemaining--; + } else { + n2.forEachChild(visitNonImportNode); + } + depthRemaining++; + } + } + function addRegionOutliningSpans(sourceFile, out) { + var regions = []; + var lineStarts = sourceFile.getLineStarts(); + for (var _i = 0, lineStarts_1 = lineStarts; _i < lineStarts_1.length; _i++) { + var currentLineStart = lineStarts_1[_i]; + var lineEnd = sourceFile.getLineEndOfPosition(currentLineStart); + var lineText = sourceFile.text.substring(currentLineStart, lineEnd); + var result = isRegionDelimiter(lineText); + if (!result || ts6.isInComment(sourceFile, currentLineStart)) { + continue; + } + if (!result[1]) { + var span = ts6.createTextSpanFromBounds(sourceFile.text.indexOf("//", currentLineStart), lineEnd); + regions.push(createOutliningSpan( + span, + "region", + span, + /*autoCollapse*/ + false, + result[2] || "#region" + )); + } else { + var region = regions.pop(); + if (region) { + region.textSpan.length = lineEnd - region.textSpan.start; + region.hintSpan.length = lineEnd - region.textSpan.start; + out.push(region); + } + } + } + } + var regionDelimiterRegExp = /^#(end)?region(?:\s+(.*))?(?:\r)?$/; + function isRegionDelimiter(lineText) { + lineText = ts6.trimStringStart(lineText); + if (!ts6.startsWith(lineText, "//")) { + return null; + } + lineText = ts6.trimString(lineText.slice(2)); + return regionDelimiterRegExp.exec(lineText); + } + function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken, out) { + var comments = ts6.getLeadingCommentRanges(sourceFile.text, pos); + if (!comments) + return; + var firstSingleLineCommentStart = -1; + var lastSingleLineCommentEnd = -1; + var singleLineCommentCount = 0; + var sourceText = sourceFile.getFullText(); + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var _a = comments_1[_i], kind = _a.kind, pos_1 = _a.pos, end = _a.end; + cancellationToken.throwIfCancellationRequested(); + switch (kind) { + case 2: + var commentText = sourceText.slice(pos_1, end); + if (isRegionDelimiter(commentText)) { + combineAndAddMultipleSingleLineComments(); + singleLineCommentCount = 0; + break; + } + if (singleLineCommentCount === 0) { + firstSingleLineCommentStart = pos_1; + } + lastSingleLineCommentEnd = end; + singleLineCommentCount++; + break; + case 3: + combineAndAddMultipleSingleLineComments(); + out.push(createOutliningSpanFromBounds( + pos_1, + end, + "comment" + /* OutliningSpanKind.Comment */ + )); + singleLineCommentCount = 0; + break; + default: + ts6.Debug.assertNever(kind); + } + } + combineAndAddMultipleSingleLineComments(); + function combineAndAddMultipleSingleLineComments() { + if (singleLineCommentCount > 1) { + out.push(createOutliningSpanFromBounds( + firstSingleLineCommentStart, + lastSingleLineCommentEnd, + "comment" + /* OutliningSpanKind.Comment */ + )); + } + } + } + function addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out) { + if (ts6.isJsxText(n)) + return; + addOutliningForLeadingCommentsForPos(n.pos, sourceFile, cancellationToken, out); + } + function createOutliningSpanFromBounds(pos, end, kind) { + return createOutliningSpan(ts6.createTextSpanFromBounds(pos, end), kind); + } + function getOutliningSpanForNode(n, sourceFile) { + switch (n.kind) { + case 238: + if (ts6.isFunctionLike(n.parent)) { + return functionSpan(n.parent, n, sourceFile); + } + switch (n.parent.kind) { + case 243: + case 246: + case 247: + case 245: + case 242: + case 244: + case 251: + case 295: + return spanForNode(n.parent); + case 255: + var tryStatement = n.parent; + if (tryStatement.tryBlock === n) { + return spanForNode(n.parent); + } else if (tryStatement.finallyBlock === n) { + var node = ts6.findChildOfKind(tryStatement, 96, sourceFile); + if (node) + return spanForNode(node); + } + default: + return createOutliningSpan( + ts6.createTextSpanFromNode(n, sourceFile), + "code" + /* OutliningSpanKind.Code */ + ); + } + case 265: + return spanForNode(n.parent); + case 260: + case 228: + case 261: + case 263: + case 266: + case 184: + case 203: + return spanForNode(n); + case 186: + return spanForNode( + n, + /*autoCollapse*/ + false, + /*useFullStart*/ + !ts6.isTupleTypeNode(n.parent), + 22 + /* SyntaxKind.OpenBracketToken */ + ); + case 292: + case 293: + return spanForNodeArray(n.statements); + case 207: + return spanForObjectOrArrayLiteral(n); + case 206: + return spanForObjectOrArrayLiteral( + n, + 22 + /* SyntaxKind.OpenBracketToken */ + ); + case 281: + return spanForJSXElement(n); + case 285: + return spanForJSXFragment(n); + case 282: + case 283: + return spanForJSXAttributes(n.attributes); + case 225: + case 14: + return spanForTemplateLiteral(n); + case 204: + return spanForNode( + n, + /*autoCollapse*/ + false, + /*useFullStart*/ + !ts6.isBindingElement(n.parent), + 22 + /* SyntaxKind.OpenBracketToken */ + ); + case 216: + return spanForArrowFunction(n); + case 210: + return spanForCallExpression(n); + case 214: + return spanForParenthesizedExpression(n); + } + function spanForCallExpression(node2) { + if (!node2.arguments.length) { + return void 0; + } + var openToken = ts6.findChildOfKind(node2, 20, sourceFile); + var closeToken = ts6.findChildOfKind(node2, 21, sourceFile); + if (!openToken || !closeToken || ts6.positionsAreOnSameLine(openToken.pos, closeToken.pos, sourceFile)) { + return void 0; + } + return spanBetweenTokens( + openToken, + closeToken, + node2, + sourceFile, + /*autoCollapse*/ + false, + /*useFullStart*/ + true + ); + } + function spanForArrowFunction(node2) { + if (ts6.isBlock(node2.body) || ts6.isParenthesizedExpression(node2.body) || ts6.positionsAreOnSameLine(node2.body.getFullStart(), node2.body.getEnd(), sourceFile)) { + return void 0; + } + var textSpan = ts6.createTextSpanFromBounds(node2.body.getFullStart(), node2.body.getEnd()); + return createOutliningSpan(textSpan, "code", ts6.createTextSpanFromNode(node2)); + } + function spanForJSXElement(node2) { + var textSpan = ts6.createTextSpanFromBounds(node2.openingElement.getStart(sourceFile), node2.closingElement.getEnd()); + var tagName = node2.openingElement.tagName.getText(sourceFile); + var bannerText = "<" + tagName + ">..."; + return createOutliningSpan( + textSpan, + "code", + textSpan, + /*autoCollapse*/ + false, + bannerText + ); + } + function spanForJSXFragment(node2) { + var textSpan = ts6.createTextSpanFromBounds(node2.openingFragment.getStart(sourceFile), node2.closingFragment.getEnd()); + var bannerText = "<>..."; + return createOutliningSpan( + textSpan, + "code", + textSpan, + /*autoCollapse*/ + false, + bannerText + ); + } + function spanForJSXAttributes(node2) { + if (node2.properties.length === 0) { + return void 0; + } + return createOutliningSpanFromBounds( + node2.getStart(sourceFile), + node2.getEnd(), + "code" + /* OutliningSpanKind.Code */ + ); + } + function spanForTemplateLiteral(node2) { + if (node2.kind === 14 && node2.text.length === 0) { + return void 0; + } + return createOutliningSpanFromBounds( + node2.getStart(sourceFile), + node2.getEnd(), + "code" + /* OutliningSpanKind.Code */ + ); + } + function spanForObjectOrArrayLiteral(node2, open) { + if (open === void 0) { + open = 18; + } + return spanForNode( + node2, + /*autoCollapse*/ + false, + /*useFullStart*/ + !ts6.isArrayLiteralExpression(node2.parent) && !ts6.isCallExpression(node2.parent), + open + ); + } + function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) { + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (useFullStart === void 0) { + useFullStart = true; + } + if (open === void 0) { + open = 18; + } + if (close === void 0) { + close = open === 18 ? 19 : 23; + } + var openToken = ts6.findChildOfKind(n, open, sourceFile); + var closeToken = ts6.findChildOfKind(n, close, sourceFile); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart); + } + function spanForNodeArray(nodeArray) { + return nodeArray.length ? createOutliningSpan( + ts6.createTextSpanFromRange(nodeArray), + "code" + /* OutliningSpanKind.Code */ + ) : void 0; + } + function spanForParenthesizedExpression(node2) { + if (ts6.positionsAreOnSameLine(node2.getStart(), node2.getEnd(), sourceFile)) + return void 0; + var textSpan = ts6.createTextSpanFromBounds(node2.getStart(), node2.getEnd()); + return createOutliningSpan(textSpan, "code", ts6.createTextSpanFromNode(node2)); + } + } + function functionSpan(node, body, sourceFile) { + var openToken = tryGetFunctionOpenToken(node, body, sourceFile); + var closeToken = ts6.findChildOfKind(body, 19, sourceFile); + return openToken && closeToken && spanBetweenTokens( + openToken, + closeToken, + node, + sourceFile, + /*autoCollapse*/ + node.kind !== 216 + /* SyntaxKind.ArrowFunction */ + ); + } + function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (useFullStart === void 0) { + useFullStart = true; + } + var textSpan = ts6.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd()); + return createOutliningSpan(textSpan, "code", ts6.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse); + } + function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) { + if (hintSpan === void 0) { + hintSpan = textSpan; + } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (bannerText === void 0) { + bannerText = "..."; + } + return { textSpan, kind, hintSpan, bannerText, autoCollapse }; + } + function tryGetFunctionOpenToken(node, body, sourceFile) { + if (ts6.isNodeArrayMultiLine(node.parameters, sourceFile)) { + var openParenToken = ts6.findChildOfKind(node, 20, sourceFile); + if (openParenToken) { + return openParenToken; + } + } + return ts6.findChildOfKind(body, 18, sourceFile); + } + })(OutliningElementsCollector = ts6.OutliningElementsCollector || (ts6.OutliningElementsCollector = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var PatternMatchKind; + (function(PatternMatchKind2) { + PatternMatchKind2[PatternMatchKind2["exact"] = 0] = "exact"; + PatternMatchKind2[PatternMatchKind2["prefix"] = 1] = "prefix"; + PatternMatchKind2[PatternMatchKind2["substring"] = 2] = "substring"; + PatternMatchKind2[PatternMatchKind2["camelCase"] = 3] = "camelCase"; + })(PatternMatchKind = ts6.PatternMatchKind || (ts6.PatternMatchKind = {})); + function createPatternMatch(kind, isCaseSensitive) { + return { + kind, + isCaseSensitive + }; + } + function createPatternMatcher(pattern) { + var stringToWordSpans = new ts6.Map(); + var dotSeparatedSegments = pattern.trim().split(".").map(function(p) { + return createSegment(p.trim()); + }); + if (dotSeparatedSegments.some(function(segment) { + return !segment.subWordTextChunks.length; + })) + return void 0; + return { + getFullMatch: function(containers, candidate) { + return getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans); + }, + getMatchForLastSegmentOfPattern: function(candidate) { + return matchSegment(candidate, ts6.last(dotSeparatedSegments), stringToWordSpans); + }, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + } + ts6.createPatternMatcher = createPatternMatcher; + function getFullMatch(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { + var candidateMatch = matchSegment(candidate, ts6.last(dotSeparatedSegments), stringToWordSpans); + if (!candidateMatch) { + return void 0; + } + if (dotSeparatedSegments.length - 1 > candidateContainers.length) { + return void 0; + } + var bestMatch; + for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { + bestMatch = betterMatch(bestMatch, matchSegment(candidateContainers[j], dotSeparatedSegments[i], stringToWordSpans)); + } + return bestMatch; + } + function getWordSpans(word, stringToWordSpans) { + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); + } + return spans; + } + function matchTextChunk(candidate, chunk, stringToWordSpans) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + return createPatternMatch( + chunk.text.length === candidate.length ? PatternMatchKind.exact : PatternMatchKind.prefix, + /*isCaseSensitive:*/ + ts6.startsWith(candidate, chunk.text) + ); + } + if (chunk.isLowerCase) { + if (index === -1) + return void 0; + var wordSpans = getWordSpans(candidate, stringToWordSpans); + for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { + var span = wordSpans_1[_i]; + if (partStartsWith( + candidate, + span, + chunk.text, + /*ignoreCase:*/ + true + )) { + return createPatternMatch( + PatternMatchKind.substring, + /*isCaseSensitive:*/ + partStartsWith( + candidate, + span, + chunk.text, + /*ignoreCase:*/ + false + ) + ); + } + } + if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch( + PatternMatchKind.substring, + /*isCaseSensitive:*/ + false + ); + } + } else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch( + PatternMatchKind.substring, + /*isCaseSensitive:*/ + true + ); + } + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate, stringToWordSpans); + var isCaseSensitive = tryCamelCaseMatch( + candidate, + candidateParts, + chunk, + /*ignoreCase:*/ + false + ) ? true : tryCamelCaseMatch( + candidate, + candidateParts, + chunk, + /*ignoreCase:*/ + true + ) ? false : void 0; + if (isCaseSensitive !== void 0) { + return createPatternMatch(PatternMatchKind.camelCase, isCaseSensitive); + } + } + } + } + function matchSegment(candidate, segment, stringToWordSpans) { + if (every(segment.totalTextChunk.text, function(ch) { + return ch !== 32 && ch !== 42; + })) { + var match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans); + if (match) + return match; + } + var subWordTextChunks = segment.subWordTextChunks; + var bestMatch; + for (var _i = 0, subWordTextChunks_1 = subWordTextChunks; _i < subWordTextChunks_1.length; _i++) { + var subWordTextChunk = subWordTextChunks_1[_i]; + bestMatch = betterMatch(bestMatch, matchTextChunk(candidate, subWordTextChunk, stringToWordSpans)); + } + return bestMatch; + } + function betterMatch(a, b) { + return ts6.min([a, b], compareMatches); + } + function compareMatches(a, b) { + return a === void 0 ? 1 : b === void 0 ? -1 : ts6.compareValues(a.kind, b.kind) || ts6.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + if (patternSpan === void 0) { + patternSpan = { start: 0, length: pattern.length }; + } + return patternSpan.length <= candidateSpan.length && everyInRange(0, patternSpan.length, function(i) { + return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); + }); + } + function equalChars(ch1, ch2, ignoreCase) { + return ignoreCase ? toLowerCase(ch1) === toLowerCase(ch2) : ch1 === ch2; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch; + var contiguous; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + return true; + } else if (currentCandidate === candidateParts.length) { + return false; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === void 0 ? currentCandidate : firstMatch; + contiguous = contiguous === void 0 ? true : contiguous; + candidatePart = ts6.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== void 0) { + contiguous = false; + } + currentCandidate++; + } + } + function createSegment(text) { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + }; + } + function isUpperCaseLetter(ch) { + if (ch >= 65 && ch <= 90) { + return true; + } + if (ch < 127 || !ts6.isUnicodeIdentifierStart( + ch, + 99 + /* ScriptTarget.Latest */ + )) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + function isLowerCaseLetter(ch) { + if (ch >= 97 && ch <= 122) { + return true; + } + if (ch < 127 || !ts6.isUnicodeIdentifierStart( + ch, + 99 + /* ScriptTarget.Latest */ + )) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + function indexOfIgnoringCase(str, value) { + var n = str.length - value.length; + var _loop_6 = function(start2) { + if (every(value, function(valueChar, i) { + return toLowerCase(str.charCodeAt(i + start2)) === valueChar; + })) { + return { value: start2 }; + } + }; + for (var start = 0; start <= n; start++) { + var state_3 = _loop_6(start); + if (typeof state_3 === "object") + return state_3.value; + } + return -1; + } + function toLowerCase(ch) { + if (ch >= 65 && ch <= 90) { + return 97 + (ch - 65); + } + if (ch < 127) { + return ch; + } + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isWordChar(ch) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36; + } + function breakPatternIntoTextChunks(pattern) { + var result = []; + var wordStart = 0; + var wordLength = 0; + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength === 0) { + wordStart = i; + } + wordLength++; + } else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + return result; + } + function createTextChunk(text) { + var textLowerCase = text.toLowerCase(); + return { + text, + textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + }; + } + function breakIntoCharacterSpans(identifier) { + return breakIntoSpans( + identifier, + /*word:*/ + false + ); + } + ts6.breakIntoCharacterSpans = breakIntoCharacterSpans; + function breakIntoWordSpans(identifier) { + return breakIntoSpans( + identifier, + /*word:*/ + true + ); + } + ts6.breakIntoWordSpans = breakIntoWordSpans; + function breakIntoSpans(identifier, word) { + var result = []; + var wordStart = 0; + for (var i = 1; i < identifier.length; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = word && transitionFromUpperToLower(identifier, i, wordStart); + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit !== currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(ts6.createTextSpan(wordStart, i - wordStart)); + } + wordStart = i; + } + } + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(ts6.createTextSpan(wordStart, identifier.length - wordStart)); + } + return result; + } + function charIsPunctuation(ch) { + switch (ch) { + case 33: + case 34: + case 35: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 63: + case 64: + case 91: + case 92: + case 93: + case 95: + case 123: + case 125: + return true; + } + return false; + } + function isAllPunctuation(identifier, start, end) { + return every(identifier, function(ch) { + return charIsPunctuation(ch) && ch !== 95; + }, start, end); + } + function transitionFromUpperToLower(identifier, index, wordStart) { + return index !== wordStart && index + 1 < identifier.length && isUpperCaseLetter(identifier.charCodeAt(index)) && isLowerCaseLetter(identifier.charCodeAt(index + 1)) && every(identifier, isUpperCaseLetter, wordStart, index); + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + return currentIsUpper && (!word || !lastIsUpper); + } + function everyInRange(start, end, pred) { + for (var i = start; i < end; i++) { + if (!pred(i)) { + return false; + } + } + return true; + } + function every(s, pred, start, end) { + if (start === void 0) { + start = 0; + } + if (end === void 0) { + end = s.length; + } + return everyInRange(start, end, function(i) { + return pred(s.charCodeAt(i), i); + }); + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { + if (readImportFiles === void 0) { + readImportFiles = true; + } + if (detectJavaScriptImports === void 0) { + detectJavaScriptImports = false; + } + var pragmaContext = { + languageVersion: 1, + pragmas: void 0, + checkJsDirective: void 0, + referencedFiles: [], + typeReferenceDirectives: [], + libReferenceDirectives: [], + amdDependencies: [], + hasNoDefaultLib: void 0, + moduleName: void 0 + }; + var importedFiles = []; + var ambientExternalModules; + var lastToken; + var currentToken; + var braceNesting = 0; + var externalModule = false; + function nextToken() { + lastToken = currentToken; + currentToken = ts6.scanner.scan(); + if (currentToken === 18) { + braceNesting++; + } else if (currentToken === 19) { + braceNesting--; + } + return currentToken; + } + function getFileReference() { + var fileName = ts6.scanner.getTokenValue(); + var pos = ts6.scanner.getTokenPos(); + return { fileName, pos, end: pos + fileName.length }; + } + function recordAmbientExternalModule() { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); + } + function recordModuleName() { + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } + } + function tryConsumeDeclare() { + var token = ts6.scanner.getToken(); + if (token === 136) { + token = nextToken(); + if (token === 142) { + token = nextToken(); + if (token === 10) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + function tryConsumeImport() { + if (lastToken === 24) { + return false; + } + var token = ts6.scanner.getToken(); + if (token === 100) { + token = nextToken(); + if (token === 20) { + token = nextToken(); + if (token === 10 || token === 14) { + recordModuleName(); + return true; + } + } else if (token === 10) { + recordModuleName(); + return true; + } else { + if (token === 154) { + var skipTypeKeyword = ts6.scanner.lookAhead(function() { + var token2 = ts6.scanner.scan(); + return token2 !== 158 && (token2 === 41 || token2 === 18 || token2 === 79 || ts6.isKeyword(token2)); + }); + if (skipTypeKeyword) { + token = nextToken(); + } + } + if (token === 79 || ts6.isKeyword(token)) { + token = nextToken(); + if (token === 158) { + token = nextToken(); + if (token === 10) { + recordModuleName(); + return true; + } + } else if (token === 63) { + if (tryConsumeRequireCall( + /*skipCurrentToken*/ + true + )) { + return true; + } + } else if (token === 27) { + token = nextToken(); + } else { + return true; + } + } + if (token === 18) { + token = nextToken(); + while (token !== 19 && token !== 1) { + token = nextToken(); + } + if (token === 19) { + token = nextToken(); + if (token === 158) { + token = nextToken(); + if (token === 10) { + recordModuleName(); + } + } + } + } else if (token === 41) { + token = nextToken(); + if (token === 128) { + token = nextToken(); + if (token === 79 || ts6.isKeyword(token)) { + token = nextToken(); + if (token === 158) { + token = nextToken(); + if (token === 10) { + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = ts6.scanner.getToken(); + if (token === 93) { + markAsExternalModuleIfTopLevel(); + token = nextToken(); + if (token === 154) { + var skipTypeKeyword = ts6.scanner.lookAhead(function() { + var token2 = ts6.scanner.scan(); + return token2 === 41 || token2 === 18; + }); + if (skipTypeKeyword) { + token = nextToken(); + } + } + if (token === 18) { + token = nextToken(); + while (token !== 19 && token !== 1) { + token = nextToken(); + } + if (token === 19) { + token = nextToken(); + if (token === 158) { + token = nextToken(); + if (token === 10) { + recordModuleName(); + } + } + } + } else if (token === 41) { + token = nextToken(); + if (token === 158) { + token = nextToken(); + if (token === 10) { + recordModuleName(); + } + } + } else if (token === 100) { + token = nextToken(); + if (token === 154) { + var skipTypeKeyword = ts6.scanner.lookAhead(function() { + var token2 = ts6.scanner.scan(); + return token2 === 79 || ts6.isKeyword(token2); + }); + if (skipTypeKeyword) { + token = nextToken(); + } + } + if (token === 79 || ts6.isKeyword(token)) { + token = nextToken(); + if (token === 63) { + if (tryConsumeRequireCall( + /*skipCurrentToken*/ + true + )) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { + if (allowTemplateLiterals === void 0) { + allowTemplateLiterals = false; + } + var token = skipCurrentToken ? nextToken() : ts6.scanner.getToken(); + if (token === 147) { + token = nextToken(); + if (token === 20) { + token = nextToken(); + if (token === 10 || allowTemplateLiterals && token === 14) { + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = ts6.scanner.getToken(); + if (token === 79 && ts6.scanner.getTokenValue() === "define") { + token = nextToken(); + if (token !== 20) { + return true; + } + token = nextToken(); + if (token === 10 || token === 14) { + token = nextToken(); + if (token === 27) { + token = nextToken(); + } else { + return true; + } + } + if (token !== 22) { + return true; + } + token = nextToken(); + while (token !== 23 && token !== 1) { + if (token === 10 || token === 14) { + recordModuleName(); + } + token = nextToken(); + } + return true; + } + return false; + } + function processImports() { + ts6.scanner.setText(sourceText); + nextToken(); + while (true) { + if (ts6.scanner.getToken() === 1) { + break; + } + if (ts6.scanner.getToken() === 15) { + var stack2 = [ts6.scanner.getToken()]; + loop: + while (ts6.length(stack2)) { + var token = ts6.scanner.scan(); + switch (token) { + case 1: + break loop; + case 100: + tryConsumeImport(); + break; + case 15: + stack2.push(token); + break; + case 18: + if (ts6.length(stack2)) { + stack2.push(token); + } + break; + case 19: + if (ts6.length(stack2)) { + if (ts6.lastOrUndefined(stack2) === 15) { + if (ts6.scanner.reScanTemplateToken( + /* isTaggedTemplate */ + false + ) === 17) { + stack2.pop(); + } + } else { + stack2.pop(); + } + } + break; + } + } + nextToken(); + } + if (tryConsumeDeclare() || tryConsumeImport() || tryConsumeExport() || detectJavaScriptImports && (tryConsumeRequireCall( + /*skipCurrentToken*/ + false, + /*allowTemplateLiterals*/ + true + ) || tryConsumeDefine())) { + continue; + } else { + nextToken(); + } + } + ts6.scanner.setText(void 0); + } + if (readImportFiles) { + processImports(); + } + ts6.processCommentPragmas(pragmaContext, sourceText); + ts6.processPragmasIntoFields(pragmaContext, ts6.noop); + if (externalModule) { + if (ambientExternalModules) { + for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { + var decl = ambientExternalModules_1[_i]; + importedFiles.push(decl.ref); + } + } + return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: void 0 }; + } else { + var ambientModuleNames = void 0; + if (ambientExternalModules) { + for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { + var decl = ambientExternalModules_2[_a]; + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } + } + ts6.preProcessFile = preProcessFile; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var Rename; + (function(Rename2) { + function getRenameInfo(program, sourceFile, position, preferences) { + var node = ts6.getAdjustedRenameLocation(ts6.getTouchingPropertyName(sourceFile, position)); + if (nodeIsEligibleForRename(node)) { + var renameInfo = getRenameInfoForNode(node, program.getTypeChecker(), sourceFile, program, preferences); + if (renameInfo) { + return renameInfo; + } + } + return getRenameInfoError(ts6.Diagnostics.You_cannot_rename_this_element); + } + Rename2.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, program, preferences) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol) { + if (ts6.isStringLiteralLike(node)) { + var type = ts6.getContextualTypeFromParentOrAncestorTypeNode(node, typeChecker); + if (type && (type.flags & 128 || type.flags & 1048576 && ts6.every(type.types, function(type2) { + return !!(type2.flags & 128); + }))) { + return getRenameInfoSuccess(node.text, node.text, "string", "", node, sourceFile); + } + } else if (ts6.isLabelName(node)) { + var name = ts6.getTextOfNode(node); + return getRenameInfoSuccess(name, name, "label", "", node, sourceFile); + } + return void 0; + } + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) + return; + if (declarations.some(function(declaration) { + return isDefinedInLibraryFile(program, declaration); + })) { + return getRenameInfoError(ts6.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + if (ts6.isIdentifier(node) && node.originalKeywordKind === 88 && symbol.parent && symbol.parent.flags & 1536) { + return void 0; + } + if (ts6.isStringLiteralLike(node) && ts6.tryGetImportFromModuleSpecifier(node)) { + return preferences.allowRenameOfImportPath ? getRenameInfoForModule(node, sourceFile, symbol) : void 0; + } + var wouldRenameNodeModules = wouldRenameInOtherNodeModules(sourceFile, symbol, typeChecker, preferences); + if (wouldRenameNodeModules) { + return getRenameInfoError(wouldRenameNodeModules); + } + var kind = ts6.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + var specifierName = ts6.isImportOrExportSpecifierName(node) || ts6.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 ? ts6.stripQuotes(ts6.getTextOfIdentifierOrLiteral(node)) : void 0; + var displayName = specifierName || typeChecker.symbolToString(symbol); + var fullDisplayName = specifierName || typeChecker.getFullyQualifiedName(symbol); + return getRenameInfoSuccess(displayName, fullDisplayName, kind, ts6.SymbolDisplay.getSymbolModifiers(typeChecker, symbol), node, sourceFile); + } + function isDefinedInLibraryFile(program, declaration) { + var sourceFile = declaration.getSourceFile(); + return program.isSourceFileDefaultLibrary(sourceFile) && ts6.fileExtensionIs( + sourceFile.fileName, + ".d.ts" + /* Extension.Dts */ + ); + } + function wouldRenameInOtherNodeModules(originalFile, symbol, checker, preferences) { + if (!preferences.providePrefixAndSuffixTextForRename && symbol.flags & 2097152) { + var importSpecifier = symbol.declarations && ts6.find(symbol.declarations, function(decl) { + return ts6.isImportSpecifier(decl); + }); + if (importSpecifier && !importSpecifier.propertyName) { + symbol = checker.getAliasedSymbol(symbol); + } + } + var declarations = symbol.declarations; + if (!declarations) { + return void 0; + } + var originalPackage = getPackagePathComponents(originalFile.path); + if (originalPackage === void 0) { + if (ts6.some(declarations, function(declaration2) { + return ts6.isInsideNodeModules(declaration2.getSourceFile().path); + })) { + return ts6.Diagnostics.You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder; + } else { + return void 0; + } + } + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; + var declPackage = getPackagePathComponents(declaration.getSourceFile().path); + if (declPackage) { + var length_2 = Math.min(originalPackage.length, declPackage.length); + for (var i = 0; i <= length_2; i++) { + if (ts6.compareStringsCaseSensitive(originalPackage[i], declPackage[i]) !== 0) { + return ts6.Diagnostics.You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder; + } + } + } + } + return void 0; + } + function getPackagePathComponents(filePath) { + var components = ts6.getPathComponents(filePath); + var nodeModulesIdx = components.lastIndexOf("node_modules"); + if (nodeModulesIdx === -1) { + return void 0; + } + return components.slice(0, nodeModulesIdx + 2); + } + function getRenameInfoForModule(node, sourceFile, moduleSymbol) { + if (!ts6.isExternalModuleNameRelative(node.text)) { + return getRenameInfoError(ts6.Diagnostics.You_cannot_rename_a_module_via_a_global_import); + } + var moduleSourceFile = moduleSymbol.declarations && ts6.find(moduleSymbol.declarations, ts6.isSourceFile); + if (!moduleSourceFile) + return void 0; + var withoutIndex = ts6.endsWith(node.text, "/index") || ts6.endsWith(node.text, "/index.js") ? void 0 : ts6.tryRemoveSuffix(ts6.removeFileExtension(moduleSourceFile.fileName), "/index"); + var name = withoutIndex === void 0 ? moduleSourceFile.fileName : withoutIndex; + var kind = withoutIndex === void 0 ? "module" : "directory"; + var indexAfterLastSlash = node.text.lastIndexOf("/") + 1; + var triggerSpan = ts6.createTextSpan(node.getStart(sourceFile) + 1 + indexAfterLastSlash, node.text.length - indexAfterLastSlash); + return { + canRename: true, + fileToRename: name, + kind, + displayName: name, + fullDisplayName: name, + kindModifiers: "", + triggerSpan + }; + } + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + fileToRename: void 0, + kind, + displayName, + fullDisplayName, + kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { canRename: false, localizedErrorMessage: ts6.getLocaleSpecificMessage(diagnostic) }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (ts6.isStringLiteralLike(node)) { + start += 1; + width -= 2; + } + return ts6.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + switch (node.kind) { + case 79: + case 80: + case 10: + case 14: + case 108: + return true; + case 8: + return ts6.isLiteralNameOfPropertyDeclarationOrIndexAccess(node); + default: + return false; + } + } + Rename2.nodeIsEligibleForRename = nodeIsEligibleForRename; + })(Rename = ts6.Rename || (ts6.Rename = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var SmartSelectionRange; + (function(SmartSelectionRange2) { + function getSmartSelectionRange(pos, sourceFile) { + var _a, _b; + var selectionRange = { + textSpan: ts6.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) + }; + var parentNode = sourceFile; + outer: + while (true) { + var children = getSelectionChildren(parentNode); + if (!children.length) + break; + for (var i = 0; i < children.length; i++) { + var prevNode = children[i - 1]; + var node = children[i]; + var nextNode = children[i + 1]; + if (ts6.getTokenPosOfNode( + node, + sourceFile, + /*includeJsDoc*/ + true + ) > pos) { + break outer; + } + var comment = ts6.singleOrUndefined(ts6.getTrailingCommentRanges(sourceFile.text, node.end)); + if (comment && comment.kind === 2) { + pushSelectionCommentRange(comment.pos, comment.end); + } + if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts6.isFunctionBody(node) && ts6.isFunctionLikeDeclaration(parentNode) && !ts6.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } + if (ts6.isBlock(node) || ts6.isTemplateSpan(node) || ts6.isTemplateHead(node) || ts6.isTemplateTail(node) || prevNode && ts6.isTemplateHead(prevNode) || ts6.isVariableDeclarationList(node) && ts6.isVariableStatement(parentNode) || ts6.isSyntaxList(node) && ts6.isVariableDeclarationList(parentNode) || ts6.isVariableDeclaration(node) && ts6.isSyntaxList(parentNode) && children.length === 1 || ts6.isJSDocTypeExpression(node) || ts6.isJSDocSignature(node) || ts6.isJSDocTypeLiteral(node)) { + parentNode = node; + break; + } + if (ts6.isTemplateSpan(parentNode) && nextNode && ts6.isTemplateMiddleOrTemplateTail(nextNode)) { + var start_1 = node.getFullStart() - "${".length; + var end_2 = nextNode.getStart() + "}".length; + pushSelectionRange(start_1, end_2); + } + var isBetweenMultiLineBookends = ts6.isSyntaxList(node) && isListOpener(prevNode) && isListCloser(nextNode) && !ts6.positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); + var start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart(); + var end = isBetweenMultiLineBookends ? nextNode.getStart() : getEndPos(sourceFile, node); + if (ts6.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) { + pushSelectionRange(ts6.first(node.jsDoc).getStart(), end); + } + if (ts6.isSyntaxList(node)) { + var firstChild = node.getChildren()[0]; + if (firstChild && ts6.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) { + start = Math.min(start, ts6.first(firstChild.jsDoc).getStart()); + } + } + pushSelectionRange(start, end); + if (ts6.isStringLiteral(node) || ts6.isTemplateLiteral(node)) { + pushSelectionRange(start + 1, end - 1); + } + parentNode = node; + break; + } + if (i === children.length - 1) { + break outer; + } + } + } + return selectionRange; + function pushSelectionRange(start2, end2) { + if (start2 !== end2) { + var textSpan = ts6.createTextSpanFromBounds(start2, end2); + if (!selectionRange || // Skip ranges that are identical to the parent + !ts6.textSpansEqual(textSpan, selectionRange.textSpan) && // Skip ranges that don’t contain the original position + ts6.textSpanIntersectsWithPosition(textSpan, pos)) { + selectionRange = __assign({ textSpan }, selectionRange && { parent: selectionRange }); + } + } + } + function pushSelectionCommentRange(start2, end2) { + pushSelectionRange(start2, end2); + var pos2 = start2; + while (sourceFile.text.charCodeAt(pos2) === 47) { + pos2++; + } + pushSelectionRange(pos2, end2); + } + } + SmartSelectionRange2.getSmartSelectionRange = getSmartSelectionRange; + function positionShouldSnapToNode(sourceFile, pos, node) { + ts6.Debug.assert(node.pos <= pos); + if (pos < node.end) { + return true; + } + var nodeEnd = node.getEnd(); + if (nodeEnd === pos) { + return ts6.getTouchingPropertyName(sourceFile, pos).pos < node.end; + } + return false; + } + var isImport = ts6.or(ts6.isImportDeclaration, ts6.isImportEqualsDeclaration); + function getSelectionChildren(node) { + var _a; + if (ts6.isSourceFile(node)) { + return groupChildren(node.getChildAt(0).getChildren(), isImport); + } + if (ts6.isMappedTypeNode(node)) { + var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1); + var closeBraceToken = ts6.Debug.checkDefined(children.pop()); + ts6.Debug.assertEqual( + openBraceToken.kind, + 18 + /* SyntaxKind.OpenBraceToken */ + ); + ts6.Debug.assertEqual( + closeBraceToken.kind, + 19 + /* SyntaxKind.CloseBraceToken */ + ); + var groupedWithPlusMinusTokens = groupChildren(children, function(child) { + return child === node.readonlyToken || child.kind === 146 || child === node.questionToken || child.kind === 57; + }); + var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function(_a2) { + var kind = _a2.kind; + return kind === 22 || kind === 165 || kind === 23; + }); + return [ + openBraceToken, + // Pivot on `:` + createSyntaxList(splitChildren(groupedWithBrackets, function(_a2) { + var kind = _a2.kind; + return kind === 58; + })), + closeBraceToken + ]; + } + if (ts6.isPropertySignature(node)) { + var children = groupChildren(node.getChildren(), function(child) { + return child === node.name || ts6.contains(node.modifiers, child); + }); + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 ? children[0] : void 0; + var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; + var splittedChildren = splitChildren(withJSDocSeparated, function(_a2) { + var kind = _a2.kind; + return kind === 58; + }); + return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren; + } + if (ts6.isParameter(node)) { + var groupedDotDotDotAndName_1 = groupChildren(node.getChildren(), function(child) { + return child === node.dotDotDotToken || child === node.name; + }); + var groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName_1, function(child) { + return child === groupedDotDotDotAndName_1[0] || child === node.questionToken; + }); + return splitChildren(groupedWithQuestionToken, function(_a2) { + var kind = _a2.kind; + return kind === 63; + }); + } + if (ts6.isBindingElement(node)) { + return splitChildren(node.getChildren(), function(_a2) { + var kind = _a2.kind; + return kind === 63; + }); + } + return node.getChildren(); + } + function groupChildren(children, groupOn) { + var result = []; + var group; + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + if (groupOn(child)) { + group = group || []; + group.push(child); + } else { + if (group) { + result.push(createSyntaxList(group)); + group = void 0; + } + result.push(child); + } + } + if (group) { + result.push(createSyntaxList(group)); + } + return result; + } + function splitChildren(children, pivotOn, separateTrailingSemicolon) { + if (separateTrailingSemicolon === void 0) { + separateTrailingSemicolon = true; + } + if (children.length < 2) { + return children; + } + var splitTokenIndex = ts6.findIndex(children, pivotOn); + if (splitTokenIndex === -1) { + return children; + } + var leftChildren = children.slice(0, splitTokenIndex); + var splitToken = children[splitTokenIndex]; + var lastToken = ts6.last(children); + var separateLastToken = separateTrailingSemicolon && lastToken.kind === 26; + var rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : void 0); + var result = ts6.compact([ + leftChildren.length ? createSyntaxList(leftChildren) : void 0, + splitToken, + rightChildren.length ? createSyntaxList(rightChildren) : void 0 + ]); + return separateLastToken ? result.concat(lastToken) : result; + } + function createSyntaxList(children) { + ts6.Debug.assertGreaterThanOrEqual(children.length, 1); + return ts6.setTextRangePosEnd(ts6.parseNodeFactory.createSyntaxList(children), children[0].pos, ts6.last(children).end); + } + function isListOpener(token) { + var kind = token && token.kind; + return kind === 18 || kind === 22 || kind === 20 || kind === 283; + } + function isListCloser(token) { + var kind = token && token.kind; + return kind === 19 || kind === 23 || kind === 21 || kind === 284; + } + function getEndPos(sourceFile, node) { + switch (node.kind) { + case 343: + case 341: + case 350: + case 348: + case 345: + return sourceFile.getLineEndOfPosition(node.getStart()); + default: + return node.getEnd(); + } + } + })(SmartSelectionRange = ts6.SmartSelectionRange || (ts6.SmartSelectionRange = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var SignatureHelp; + (function(SignatureHelp2) { + var InvocationKind; + (function(InvocationKind2) { + InvocationKind2[InvocationKind2["Call"] = 0] = "Call"; + InvocationKind2[InvocationKind2["TypeArgs"] = 1] = "TypeArgs"; + InvocationKind2[InvocationKind2["Contextual"] = 2] = "Contextual"; + })(InvocationKind || (InvocationKind = {})); + function getSignatureHelpItems(program, sourceFile, position, triggerReason, cancellationToken) { + var typeChecker = program.getTypeChecker(); + var startingToken = ts6.findTokenOnLeftOfPosition(sourceFile, position); + if (!startingToken) { + return void 0; + } + var onlyUseSyntacticOwners = !!triggerReason && triggerReason.kind === "characterTyped"; + if (onlyUseSyntacticOwners && (ts6.isInString(sourceFile, position, startingToken) || ts6.isInComment(sourceFile, position))) { + return void 0; + } + var isManuallyInvoked = !!triggerReason && triggerReason.kind === "invoked"; + var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile, typeChecker, isManuallyInvoked); + if (!argumentInfo) + return void 0; + cancellationToken.throwIfCancellationRequested(); + var candidateInfo = getCandidateOrTypeInfo(argumentInfo, typeChecker, sourceFile, startingToken, onlyUseSyntacticOwners); + cancellationToken.throwIfCancellationRequested(); + if (!candidateInfo) { + return ts6.isSourceFileJS(sourceFile) ? createJSSignatureHelpItems(argumentInfo, program, cancellationToken) : void 0; + } + return typeChecker.runWithCancellationToken(cancellationToken, function(typeChecker2) { + return candidateInfo.kind === 0 ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2); + }); + } + SignatureHelp2.getSignatureHelpItems = getSignatureHelpItems; + var CandidateOrTypeKind; + (function(CandidateOrTypeKind2) { + CandidateOrTypeKind2[CandidateOrTypeKind2["Candidate"] = 0] = "Candidate"; + CandidateOrTypeKind2[CandidateOrTypeKind2["Type"] = 1] = "Type"; + })(CandidateOrTypeKind || (CandidateOrTypeKind = {})); + function getCandidateOrTypeInfo(_a, checker, sourceFile, startingToken, onlyUseSyntacticOwners) { + var invocation = _a.invocation, argumentCount = _a.argumentCount; + switch (invocation.kind) { + case 0: { + if (onlyUseSyntacticOwners && !isSyntacticOwner(startingToken, invocation.node, sourceFile)) { + return void 0; + } + var candidates = []; + var resolvedSignature = checker.getResolvedSignatureForSignatureHelp(invocation.node, candidates, argumentCount); + return candidates.length === 0 ? void 0 : { kind: 0, candidates, resolvedSignature }; + } + case 1: { + var called = invocation.called; + if (onlyUseSyntacticOwners && !containsPrecedingToken(startingToken, sourceFile, ts6.isIdentifier(called) ? called.parent : called)) { + return void 0; + } + var candidates = ts6.getPossibleGenericSignatures(called, argumentCount, checker); + if (candidates.length !== 0) + return { kind: 0, candidates, resolvedSignature: ts6.first(candidates) }; + var symbol = checker.getSymbolAtLocation(called); + return symbol && { kind: 1, symbol }; + } + case 2: + return { kind: 0, candidates: [invocation.signature], resolvedSignature: invocation.signature }; + default: + return ts6.Debug.assertNever(invocation); + } + } + function isSyntacticOwner(startingToken, node, sourceFile) { + if (!ts6.isCallOrNewExpression(node)) + return false; + var invocationChildren = node.getChildren(sourceFile); + switch (startingToken.kind) { + case 20: + return ts6.contains(invocationChildren, startingToken); + case 27: { + var containingList = ts6.findContainingList(startingToken); + return !!containingList && ts6.contains(invocationChildren, containingList); + } + case 29: + return containsPrecedingToken(startingToken, sourceFile, node.expression); + default: + return false; + } + } + function createJSSignatureHelpItems(argumentInfo, program, cancellationToken) { + if (argumentInfo.invocation.kind === 2) + return void 0; + var expression = getExpressionFromInvocation(argumentInfo.invocation); + var name = ts6.isPropertyAccessExpression(expression) ? expression.name.text : void 0; + var typeChecker = program.getTypeChecker(); + return name === void 0 ? void 0 : ts6.firstDefined(program.getSourceFiles(), function(sourceFile) { + return ts6.firstDefined(sourceFile.getNamedDeclarations().get(name), function(declaration) { + var type = declaration.symbol && typeChecker.getTypeOfSymbolAtLocation(declaration.symbol, declaration); + var callSignatures = type && type.getCallSignatures(); + if (callSignatures && callSignatures.length) { + return typeChecker.runWithCancellationToken(cancellationToken, function(typeChecker2) { + return createSignatureHelpItems( + callSignatures, + callSignatures[0], + argumentInfo, + sourceFile, + typeChecker2, + /*useFullPrefix*/ + true + ); + }); + } + }); + }); + } + function containsPrecedingToken(startingToken, sourceFile, container) { + var pos = startingToken.getFullStart(); + var currentParent = startingToken.parent; + while (currentParent) { + var precedingToken = ts6.findPrecedingToken( + pos, + sourceFile, + currentParent, + /*excludeJsdoc*/ + true + ); + if (precedingToken) { + return ts6.rangeContainsRange(container, precedingToken); + } + currentParent = currentParent.parent; + } + return ts6.Debug.fail("Could not find preceding token"); + } + function getArgumentInfoForCompletions(node, position, sourceFile) { + var info = getImmediatelyContainingArgumentInfo(node, position, sourceFile); + return !info || info.isTypeParameterList || info.invocation.kind !== 0 ? void 0 : { invocation: info.invocation.node, argumentCount: info.argumentCount, argumentIndex: info.argumentIndex }; + } + SignatureHelp2.getArgumentInfoForCompletions = getArgumentInfoForCompletions; + function getArgumentOrParameterListInfo(node, position, sourceFile) { + var info = getArgumentOrParameterListAndIndex(node, sourceFile); + if (!info) + return void 0; + var list = info.list, argumentIndex = info.argumentIndex; + var argumentCount = getArgumentCount( + list, + /*ignoreTrailingComma*/ + ts6.isInString(sourceFile, position, node) + ); + if (argumentIndex !== 0) { + ts6.Debug.assertLessThan(argumentIndex, argumentCount); + } + var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); + return { list, argumentIndex, argumentCount, argumentsSpan }; + } + function getArgumentOrParameterListAndIndex(node, sourceFile) { + if (node.kind === 29 || node.kind === 20) { + return { list: getChildListThatStartsWithOpenerToken(node.parent, node, sourceFile), argumentIndex: 0 }; + } else { + var list = ts6.findContainingList(node); + return list && { list, argumentIndex: getArgumentIndex(list, node) }; + } + } + function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { + var parent = node.parent; + if (ts6.isCallOrNewExpression(parent)) { + var invocation = parent; + var info = getArgumentOrParameterListInfo(node, position, sourceFile); + if (!info) + return void 0; + var list = info.list, argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; + var isTypeParameterList = !!parent.typeArguments && parent.typeArguments.pos === list.pos; + return { isTypeParameterList, invocation: { kind: 0, node: invocation }, argumentsSpan, argumentIndex, argumentCount }; + } else if (ts6.isNoSubstitutionTemplateLiteral(node) && ts6.isTaggedTemplateExpression(parent)) { + if (ts6.isInsideTemplateLiteral(node, position, sourceFile)) { + return getArgumentListInfoForTemplate( + parent, + /*argumentIndex*/ + 0, + sourceFile + ); + } + return void 0; + } else if (ts6.isTemplateHead(node) && parent.parent.kind === 212) { + var templateExpression = parent; + var tagExpression = templateExpression.parent; + ts6.Debug.assert( + templateExpression.kind === 225 + /* SyntaxKind.TemplateExpression */ + ); + var argumentIndex = ts6.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); + } else if (ts6.isTemplateSpan(parent) && ts6.isTaggedTemplateExpression(parent.parent.parent)) { + var templateSpan = parent; + var tagExpression = parent.parent.parent; + if (ts6.isTemplateTail(node) && !ts6.isInsideTemplateLiteral(node, position, sourceFile)) { + return void 0; + } + var spanIndex = templateSpan.parent.templateSpans.indexOf(templateSpan); + var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position, sourceFile); + return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); + } else if (ts6.isJsxOpeningLikeElement(parent)) { + var attributeSpanStart = parent.attributes.pos; + var attributeSpanEnd = ts6.skipTrivia( + sourceFile.text, + parent.attributes.end, + /*stopAfterLineBreak*/ + false + ); + return { + isTypeParameterList: false, + invocation: { kind: 0, node: parent }, + argumentsSpan: ts6.createTextSpan(attributeSpanStart, attributeSpanEnd - attributeSpanStart), + argumentIndex: 0, + argumentCount: 1 + }; + } else { + var typeArgInfo = ts6.getPossibleTypeArgumentsInfo(node, sourceFile); + if (typeArgInfo) { + var called = typeArgInfo.called, nTypeArguments = typeArgInfo.nTypeArguments; + var invocation = { kind: 1, called }; + var argumentsSpan = ts6.createTextSpanFromBounds(called.getStart(sourceFile), node.end); + return { isTypeParameterList: true, invocation, argumentsSpan, argumentIndex: nTypeArguments, argumentCount: nTypeArguments + 1 }; + } + return void 0; + } + } + function getImmediatelyContainingArgumentOrContextualParameterInfo(node, position, sourceFile, checker) { + return tryGetParameterInfo(node, position, sourceFile, checker) || getImmediatelyContainingArgumentInfo(node, position, sourceFile); + } + function getHighestBinary(b) { + return ts6.isBinaryExpression(b.parent) ? getHighestBinary(b.parent) : b; + } + function countBinaryExpressionParameters(b) { + return ts6.isBinaryExpression(b.left) ? countBinaryExpressionParameters(b.left) + 1 : 2; + } + function tryGetParameterInfo(startingToken, position, sourceFile, checker) { + var info = getContextualSignatureLocationInfo(startingToken, sourceFile, position, checker); + if (!info) + return void 0; + var contextualType = info.contextualType, argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; + var nonNullableContextualType = contextualType.getNonNullableType(); + var symbol = nonNullableContextualType.symbol; + if (symbol === void 0) + return void 0; + var signature = ts6.lastOrUndefined(nonNullableContextualType.getCallSignatures()); + if (signature === void 0) + return void 0; + var invocation = { kind: 2, signature, node: startingToken, symbol: chooseBetterSymbol(symbol) }; + return { isTypeParameterList: false, invocation, argumentsSpan, argumentIndex, argumentCount }; + } + function getContextualSignatureLocationInfo(startingToken, sourceFile, position, checker) { + if (startingToken.kind !== 20 && startingToken.kind !== 27) + return void 0; + var parent = startingToken.parent; + switch (parent.kind) { + case 214: + case 171: + case 215: + case 216: + var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); + if (!info) + return void 0; + var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; + var contextualType = ts6.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); + return contextualType && { contextualType, argumentIndex, argumentCount, argumentsSpan }; + case 223: { + var highestBinary = getHighestBinary(parent); + var contextualType_1 = checker.getContextualType(highestBinary); + var argumentIndex_1 = startingToken.kind === 20 ? 0 : countBinaryExpressionParameters(parent) - 1; + var argumentCount_1 = countBinaryExpressionParameters(highestBinary); + return contextualType_1 && { contextualType: contextualType_1, argumentIndex: argumentIndex_1, argumentCount: argumentCount_1, argumentsSpan: ts6.createTextSpanFromNode(parent) }; + } + default: + return void 0; + } + } + function chooseBetterSymbol(s) { + return s.name === "__type" ? ts6.firstDefined(s.declarations, function(d) { + return ts6.isFunctionTypeNode(d) ? d.parent.symbol : void 0; + }) || s : s; + } + function getArgumentIndex(argumentsList, node) { + var argumentIndex = 0; + for (var _i = 0, _a = argumentsList.getChildren(); _i < _a.length; _i++) { + var child = _a[_i]; + if (child === node) { + break; + } + if (child.kind !== 27) { + argumentIndex++; + } + } + return argumentIndex; + } + function getArgumentCount(argumentsList, ignoreTrailingComma) { + var listChildren = argumentsList.getChildren(); + var argumentCount = ts6.countWhere(listChildren, function(arg) { + return arg.kind !== 27; + }); + if (!ignoreTrailingComma && listChildren.length > 0 && ts6.last(listChildren).kind === 27) { + argumentCount++; + } + return argumentCount; + } + function getArgumentIndexForTemplatePiece(spanIndex, node, position, sourceFile) { + ts6.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); + if (ts6.isTemplateLiteralToken(node)) { + if (ts6.isInsideTemplateLiteral(node, position, sourceFile)) { + return 0; + } + return spanIndex + 2; + } + return spanIndex + 1; + } + function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) { + var argumentCount = ts6.isNoSubstitutionTemplateLiteral(tagExpression.template) ? 1 : tagExpression.template.templateSpans.length + 1; + if (argumentIndex !== 0) { + ts6.Debug.assertLessThan(argumentIndex, argumentCount); + } + return { + isTypeParameterList: false, + invocation: { kind: 0, node: tagExpression }, + argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile), + argumentIndex, + argumentCount + }; + } + function getApplicableSpanForArguments(argumentsList, sourceFile) { + var applicableSpanStart = argumentsList.getFullStart(); + var applicableSpanEnd = ts6.skipTrivia( + sourceFile.text, + argumentsList.getEnd(), + /*stopAfterLineBreak*/ + false + ); + return ts6.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getApplicableSpanForTaggedTemplate(taggedTemplate, sourceFile) { + var template = taggedTemplate.template; + var applicableSpanStart = template.getStart(); + var applicableSpanEnd = template.getEnd(); + if (template.kind === 225) { + var lastSpan = ts6.last(template.templateSpans); + if (lastSpan.literal.getFullWidth() === 0) { + applicableSpanEnd = ts6.skipTrivia( + sourceFile.text, + applicableSpanEnd, + /*stopAfterLineBreak*/ + false + ); + } + } + return ts6.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) { + var _loop_7 = function(n2) { + ts6.Debug.assert(ts6.rangeContainsRange(n2.parent, n2), "Not a subspan", function() { + return "Child: ".concat(ts6.Debug.formatSyntaxKind(n2.kind), ", parent: ").concat(ts6.Debug.formatSyntaxKind(n2.parent.kind)); + }); + var argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n2, position, sourceFile, checker); + if (argumentInfo) { + return { value: argumentInfo }; + } + }; + for (var n = node; !ts6.isSourceFile(n) && (isManuallyInvoked || !ts6.isBlock(n)); n = n.parent) { + var state_4 = _loop_7(n); + if (typeof state_4 === "object") + return state_4.value; + } + return void 0; + } + function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) { + var children = parent.getChildren(sourceFile); + var indexOfOpenerToken = children.indexOf(openerToken); + ts6.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); + return children[indexOfOpenerToken + 1]; + } + function getExpressionFromInvocation(invocation) { + return invocation.kind === 0 ? ts6.getInvokedExpression(invocation.node) : invocation.called; + } + function getEnclosingDeclarationFromInvocation(invocation) { + return invocation.kind === 0 ? invocation.node : invocation.kind === 1 ? invocation.called : invocation.node; + } + var signatureHelpNodeBuilderFlags = 8192 | 70221824 | 16384; + function createSignatureHelpItems(candidates, resolvedSignature, _a, sourceFile, typeChecker, useFullPrefix) { + var _b; + var isTypeParameterList = _a.isTypeParameterList, argumentCount = _a.argumentCount, applicableSpan = _a.argumentsSpan, invocation = _a.invocation, argumentIndex = _a.argumentIndex; + var enclosingDeclaration = getEnclosingDeclarationFromInvocation(invocation); + var callTargetSymbol = invocation.kind === 2 ? invocation.symbol : typeChecker.getSymbolAtLocation(getExpressionFromInvocation(invocation)) || useFullPrefix && ((_b = resolvedSignature.declaration) === null || _b === void 0 ? void 0 : _b.symbol); + var callTargetDisplayParts = callTargetSymbol ? ts6.symbolToDisplayParts( + typeChecker, + callTargetSymbol, + useFullPrefix ? sourceFile : void 0, + /*meaning*/ + void 0 + ) : ts6.emptyArray; + var items = ts6.map(candidates, function(candidateSignature) { + return getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile); + }); + if (argumentIndex !== 0) { + ts6.Debug.assertLessThan(argumentIndex, argumentCount); + } + var selectedItemIndex = 0; + var itemsSeen = 0; + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (candidates[i] === resolvedSignature) { + selectedItemIndex = itemsSeen; + if (item.length > 1) { + var count = 0; + for (var _i = 0, item_1 = item; _i < item_1.length; _i++) { + var i_1 = item_1[_i]; + if (i_1.isVariadic || i_1.parameters.length >= argumentCount) { + selectedItemIndex = itemsSeen + count; + break; + } + count++; + } + } + } + itemsSeen += item.length; + } + ts6.Debug.assert(selectedItemIndex !== -1); + var help = { items: ts6.flatMapToMutable(items, ts6.identity), applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; + var selected = help.items[selectedItemIndex]; + if (selected.isVariadic) { + var firstRest = ts6.findIndex(selected.parameters, function(p) { + return !!p.isRest; + }); + if (-1 < firstRest && firstRest < selected.parameters.length - 1) { + help.argumentIndex = selected.parameters.length; + } else { + help.argumentIndex = Math.min(help.argumentIndex, selected.parameters.length - 1); + } + } + return help; + } + function createTypeHelpItems(symbol, _a, sourceFile, checker) { + var argumentCount = _a.argumentCount, applicableSpan = _a.argumentsSpan, invocation = _a.invocation, argumentIndex = _a.argumentIndex; + var typeParameters = checker.getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + if (!typeParameters) + return void 0; + var items = [getTypeHelpItem(symbol, typeParameters, checker, getEnclosingDeclarationFromInvocation(invocation), sourceFile)]; + return { items, applicableSpan, selectedItemIndex: 0, argumentIndex, argumentCount }; + } + function getTypeHelpItem(symbol, typeParameters, checker, enclosingDeclaration, sourceFile) { + var typeSymbolDisplay = ts6.symbolToDisplayParts(checker, symbol); + var printer = ts6.createPrinter({ removeComments: true }); + var parameters = typeParameters.map(function(t) { + return createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer); + }); + var documentation = symbol.getDocumentationComment(checker); + var tags = symbol.getJsDocTags(checker); + var prefixDisplayParts = __spreadArray(__spreadArray([], typeSymbolDisplay, true), [ts6.punctuationPart( + 29 + /* SyntaxKind.LessThanToken */ + )], false); + return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [ts6.punctuationPart( + 31 + /* SyntaxKind.GreaterThanToken */ + )], separatorDisplayParts, parameters, documentation, tags }; + } + var separatorDisplayParts = [ts6.punctuationPart( + 27 + /* SyntaxKind.CommaToken */ + ), ts6.spacePart()]; + function getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, checker, enclosingDeclaration, sourceFile) { + var infos = (isTypeParameterList ? itemInfoForTypeParameters : itemInfoForParameters)(candidateSignature, checker, enclosingDeclaration, sourceFile); + return ts6.map(infos, function(_a) { + var isVariadic = _a.isVariadic, parameters = _a.parameters, prefix2 = _a.prefix, suffix = _a.suffix; + var prefixDisplayParts = __spreadArray(__spreadArray([], callTargetDisplayParts, true), prefix2, true); + var suffixDisplayParts = __spreadArray(__spreadArray([], suffix, true), returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker), true); + var documentation = candidateSignature.getDocumentationComment(checker); + var tags = candidateSignature.getJsDocTags(); + return { isVariadic, prefixDisplayParts, suffixDisplayParts, separatorDisplayParts, parameters, documentation, tags }; + }); + } + function returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, checker) { + return ts6.mapToDisplayParts(function(writer) { + writer.writePunctuation(":"); + writer.writeSpace(" "); + var predicate = checker.getTypePredicateOfSignature(candidateSignature); + if (predicate) { + checker.writeTypePredicate( + predicate, + enclosingDeclaration, + /*flags*/ + void 0, + writer + ); + } else { + checker.writeType( + checker.getReturnTypeOfSignature(candidateSignature), + enclosingDeclaration, + /*flags*/ + void 0, + writer + ); + } + }); + } + function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) { + var typeParameters = (candidateSignature.target || candidateSignature).typeParameters; + var printer = ts6.createPrinter({ removeComments: true }); + var parameters = (typeParameters || ts6.emptyArray).map(function(t) { + return createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer); + }); + var thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)] : []; + return checker.getExpandedParameters(candidateSignature).map(function(paramList) { + var params = ts6.factory.createNodeArray(__spreadArray(__spreadArray([], thisParameter, true), ts6.map(paramList, function(param) { + return checker.symbolToParameterDeclaration(param, enclosingDeclaration, signatureHelpNodeBuilderFlags); + }), true)); + var parameterParts = ts6.mapToDisplayParts(function(writer) { + printer.writeList(2576, params, sourceFile, writer); + }); + return { isVariadic: false, parameters, prefix: [ts6.punctuationPart( + 29 + /* SyntaxKind.LessThanToken */ + )], suffix: __spreadArray([ts6.punctuationPart( + 31 + /* SyntaxKind.GreaterThanToken */ + )], parameterParts, true) }; + }); + } + function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) { + var printer = ts6.createPrinter({ removeComments: true }); + var typeParameterParts = ts6.mapToDisplayParts(function(writer) { + if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) { + var args = ts6.factory.createNodeArray(candidateSignature.typeParameters.map(function(p) { + return checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags); + })); + printer.writeList(53776, args, sourceFile, writer); + } + }); + var lists = checker.getExpandedParameters(candidateSignature); + var isVariadic = !checker.hasEffectiveRestParameter(candidateSignature) ? function(_) { + return false; + } : lists.length === 1 ? function(_) { + return true; + } : function(pList) { + return !!(pList.length && pList[pList.length - 1].checkFlags & 32768); + }; + return lists.map(function(parameterList) { + return { + isVariadic: isVariadic(parameterList), + parameters: parameterList.map(function(p) { + return createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer); + }), + prefix: __spreadArray(__spreadArray([], typeParameterParts, true), [ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + )], false), + suffix: [ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )] + }; + }); + } + function createSignatureHelpParameterForParameter(parameter, checker, enclosingDeclaration, sourceFile, printer) { + var displayParts = ts6.mapToDisplayParts(function(writer) { + var param = checker.symbolToParameterDeclaration(parameter, enclosingDeclaration, signatureHelpNodeBuilderFlags); + printer.writeNode(4, param, sourceFile, writer); + }); + var isOptional = checker.isOptionalParameter(parameter.valueDeclaration); + var isRest = !!(parameter.checkFlags & 32768); + return { name: parameter.name, documentation: parameter.getDocumentationComment(checker), displayParts, isOptional, isRest }; + } + function createSignatureHelpParameterForTypeParameter(typeParameter, checker, enclosingDeclaration, sourceFile, printer) { + var displayParts = ts6.mapToDisplayParts(function(writer) { + var param = checker.typeParameterToDeclaration(typeParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags); + printer.writeNode(4, param, sourceFile, writer); + }); + return { name: typeParameter.symbol.name, documentation: typeParameter.symbol.getDocumentationComment(checker), displayParts, isOptional: false, isRest: false }; + } + })(SignatureHelp = ts6.SignatureHelp || (ts6.SignatureHelp = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var InlayHints; + (function(InlayHints2) { + var maxHintsLength = 30; + var leadingParameterNameCommentRegexFactory = function(name) { + return new RegExp("^\\s?/\\*\\*?\\s?".concat(name, "\\s?\\*\\/\\s?$")); + }; + function shouldShowParameterNameHints(preferences) { + return preferences.includeInlayParameterNameHints === "literals" || preferences.includeInlayParameterNameHints === "all"; + } + function shouldShowLiteralParameterNameHintsOnly(preferences) { + return preferences.includeInlayParameterNameHints === "literals"; + } + function provideInlayHints(context) { + var file = context.file, program = context.program, span = context.span, cancellationToken = context.cancellationToken, preferences = context.preferences; + var sourceFileText = file.text; + var compilerOptions = program.getCompilerOptions(); + var checker = program.getTypeChecker(); + var result = []; + visitor(file); + return result; + function visitor(node) { + if (!node || node.getFullWidth() === 0) { + return; + } + switch (node.kind) { + case 264: + case 260: + case 261: + case 259: + case 228: + case 215: + case 171: + case 216: + cancellationToken.throwIfCancellationRequested(); + } + if (!ts6.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { + return; + } + if (ts6.isTypeNode(node) && !ts6.isExpressionWithTypeArguments(node)) { + return; + } + if (preferences.includeInlayVariableTypeHints && ts6.isVariableDeclaration(node)) { + visitVariableLikeDeclaration(node); + } else if (preferences.includeInlayPropertyDeclarationTypeHints && ts6.isPropertyDeclaration(node)) { + visitVariableLikeDeclaration(node); + } else if (preferences.includeInlayEnumMemberValueHints && ts6.isEnumMember(node)) { + visitEnumMember(node); + } else if (shouldShowParameterNameHints(preferences) && (ts6.isCallExpression(node) || ts6.isNewExpression(node))) { + visitCallOrNewExpression(node); + } else { + if (preferences.includeInlayFunctionParameterTypeHints && ts6.isFunctionLikeDeclaration(node) && ts6.hasContextSensitiveParameters(node)) { + visitFunctionLikeForParameterType(node); + } + if (preferences.includeInlayFunctionLikeReturnTypeHints && isSignatureSupportingReturnAnnotation(node)) { + visitFunctionDeclarationLikeForReturnType(node); + } + } + return ts6.forEachChild(node, visitor); + } + function isSignatureSupportingReturnAnnotation(node) { + return ts6.isArrowFunction(node) || ts6.isFunctionExpression(node) || ts6.isFunctionDeclaration(node) || ts6.isMethodDeclaration(node) || ts6.isGetAccessorDeclaration(node); + } + function addParameterHints(text, position, isFirstVariadicArgument) { + result.push({ + text: "".concat(isFirstVariadicArgument ? "..." : "").concat(truncation(text, maxHintsLength), ":"), + position, + kind: "Parameter", + whitespaceAfter: true + }); + } + function addTypeHints(text, position) { + result.push({ + text: ": ".concat(truncation(text, maxHintsLength)), + position, + kind: "Type", + whitespaceBefore: true + }); + } + function addEnumMemberValueHints(text, position) { + result.push({ + text: "= ".concat(truncation(text, maxHintsLength)), + position, + kind: "Enum", + whitespaceBefore: true + }); + } + function visitEnumMember(member) { + if (member.initializer) { + return; + } + var enumValue = checker.getConstantValue(member); + if (enumValue !== void 0) { + addEnumMemberValueHints(enumValue.toString(), member.end); + } + } + function isModuleReferenceType(type) { + return type.symbol && type.symbol.flags & 1536; + } + function visitVariableLikeDeclaration(decl) { + if (!decl.initializer || ts6.isBindingPattern(decl.name) || ts6.isVariableDeclaration(decl) && !isHintableDeclaration(decl)) { + return; + } + var effectiveTypeAnnotation = ts6.getEffectiveTypeAnnotationNode(decl); + if (effectiveTypeAnnotation) { + return; + } + var declarationType = checker.getTypeAtLocation(decl); + if (isModuleReferenceType(declarationType)) { + return; + } + var typeDisplayString = printTypeInSingleLine(declarationType); + if (typeDisplayString) { + var isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && ts6.equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString); + if (isVariableNameMatchesType) { + return; + } + addTypeHints(typeDisplayString, decl.name.end); + } + } + function visitCallOrNewExpression(expr) { + var args = expr.arguments; + if (!args || !args.length) { + return; + } + var candidates = []; + var signature = checker.getResolvedSignatureForSignatureHelp(expr, candidates); + if (!signature || !candidates.length) { + return; + } + for (var i = 0; i < args.length; ++i) { + var originalArg = args[i]; + var arg = ts6.skipParentheses(originalArg); + if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) { + continue; + } + var identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i); + if (identifierNameInfo) { + var parameterName = identifierNameInfo[0], isFirstVariadicArgument = identifierNameInfo[1]; + var isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName); + if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) { + continue; + } + var name = ts6.unescapeLeadingUnderscores(parameterName); + if (leadingCommentsContainsParameterName(arg, name)) { + continue; + } + addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument); + } + } + } + function identifierOrAccessExpressionPostfixMatchesParameterName(expr, parameterName) { + if (ts6.isIdentifier(expr)) { + return expr.text === parameterName; + } + if (ts6.isPropertyAccessExpression(expr)) { + return expr.name.text === parameterName; + } + return false; + } + function leadingCommentsContainsParameterName(node, name) { + if (!ts6.isIdentifierText(name, compilerOptions.target, ts6.getLanguageVariant(file.scriptKind))) { + return false; + } + var ranges = ts6.getLeadingCommentRanges(sourceFileText, node.pos); + if (!(ranges === null || ranges === void 0 ? void 0 : ranges.length)) { + return false; + } + var regex = leadingParameterNameCommentRegexFactory(name); + return ts6.some(ranges, function(range2) { + return regex.test(sourceFileText.substring(range2.pos, range2.end)); + }); + } + function isHintableLiteral(node) { + switch (node.kind) { + case 221: { + var operand = node.operand; + return ts6.isLiteralExpression(operand) || ts6.isIdentifier(operand) && ts6.isInfinityOrNaNString(operand.escapedText); + } + case 110: + case 95: + case 104: + case 14: + case 225: + return true; + case 79: { + var name = node.escapedText; + return isUndefined(name) || ts6.isInfinityOrNaNString(name); + } + } + return ts6.isLiteralExpression(node); + } + function visitFunctionDeclarationLikeForReturnType(decl) { + if (ts6.isArrowFunction(decl)) { + if (!ts6.findChildOfKind(decl, 20, file)) { + return; + } + } + var effectiveTypeAnnotation = ts6.getEffectiveReturnTypeNode(decl); + if (effectiveTypeAnnotation || !decl.body) { + return; + } + var signature = checker.getSignatureFromDeclaration(decl); + if (!signature) { + return; + } + var returnType = checker.getReturnTypeOfSignature(signature); + if (isModuleReferenceType(returnType)) { + return; + } + var typeDisplayString = printTypeInSingleLine(returnType); + if (!typeDisplayString) { + return; + } + addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl)); + } + function getTypeAnnotationPosition(decl) { + var closeParenToken = ts6.findChildOfKind(decl, 21, file); + if (closeParenToken) { + return closeParenToken.end; + } + return decl.parameters.end; + } + function visitFunctionLikeForParameterType(node) { + var signature = checker.getSignatureFromDeclaration(node); + if (!signature) { + return; + } + for (var i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) { + var param = node.parameters[i]; + if (!isHintableDeclaration(param)) { + continue; + } + var effectiveTypeAnnotation = ts6.getEffectiveTypeAnnotationNode(param); + if (effectiveTypeAnnotation) { + continue; + } + var typeDisplayString = getParameterDeclarationTypeDisplayString(signature.parameters[i]); + if (!typeDisplayString) { + continue; + } + addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end); + } + } + function getParameterDeclarationTypeDisplayString(symbol) { + var valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || !ts6.isParameter(valueDeclaration)) { + return void 0; + } + var signatureParamType = checker.getTypeOfSymbolAtLocation(symbol, valueDeclaration); + if (isModuleReferenceType(signatureParamType)) { + return void 0; + } + return printTypeInSingleLine(signatureParamType); + } + function truncation(text, maxLength) { + if (text.length > maxLength) { + return text.substr(0, maxLength - "...".length) + "..."; + } + return text; + } + function printTypeInSingleLine(type) { + var flags = 70221824 | 1048576 | 16384; + var options = { removeComments: true }; + var printer = ts6.createPrinter(options); + return ts6.usingSingleLineStringWriter(function(writer) { + var typeNode = checker.typeToTypeNode( + type, + /*enclosingDeclaration*/ + void 0, + flags, + writer + ); + ts6.Debug.assertIsDefined(typeNode, "should always get typenode"); + printer.writeNode( + 4, + typeNode, + /*sourceFile*/ + file, + writer + ); + }); + } + function isUndefined(name) { + return name === "undefined"; + } + function isHintableDeclaration(node) { + if ((ts6.isParameterDeclaration(node) || ts6.isVariableDeclaration(node) && ts6.isVarConst(node)) && node.initializer) { + var initializer = ts6.skipParentheses(node.initializer); + return !(isHintableLiteral(initializer) || ts6.isNewExpression(initializer) || ts6.isObjectLiteralExpression(initializer) || ts6.isAssertionExpression(initializer)); + } + return true; + } + } + InlayHints2.provideInlayHints = provideInlayHints; + })(InlayHints = ts6.InlayHints || (ts6.InlayHints = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; + function getSourceMapper(host) { + var getCanonicalFileName = ts6.createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + var currentDirectory = host.getCurrentDirectory(); + var sourceFileLike = new ts6.Map(); + var documentPositionMappers = new ts6.Map(); + return { tryGetSourcePosition, tryGetGeneratedPosition, toLineColumnOffset, clearCache }; + function toPath(fileName) { + return ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + } + function getDocumentPositionMapper2(generatedFileName, sourceFileName) { + var path = toPath(generatedFileName); + var value = documentPositionMappers.get(path); + if (value) + return value; + var mapper; + if (host.getDocumentPositionMapper) { + mapper = host.getDocumentPositionMapper(generatedFileName, sourceFileName); + } else if (host.readFile) { + var file = getSourceFileLike(generatedFileName); + mapper = file && ts6.getDocumentPositionMapper({ getSourceFileLike, getCanonicalFileName, log: function(s) { + return host.log(s); + } }, generatedFileName, ts6.getLineInfo(file.text, ts6.getLineStarts(file)), function(f) { + return !host.fileExists || host.fileExists(f) ? host.readFile(f) : void 0; + }); + } + documentPositionMappers.set(path, mapper || ts6.identitySourceMapConsumer); + return mapper || ts6.identitySourceMapConsumer; + } + function tryGetSourcePosition(info) { + if (!ts6.isDeclarationFileName(info.fileName)) + return void 0; + var file = getSourceFile(info.fileName); + if (!file) + return void 0; + var newLoc = getDocumentPositionMapper2(info.fileName).getSourcePosition(info); + return !newLoc || newLoc === info ? void 0 : tryGetSourcePosition(newLoc) || newLoc; + } + function tryGetGeneratedPosition(info) { + if (ts6.isDeclarationFileName(info.fileName)) + return void 0; + var sourceFile = getSourceFile(info.fileName); + if (!sourceFile) + return void 0; + var program = host.getProgram(); + if (program.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) { + return void 0; + } + var options = program.getCompilerOptions(); + var outPath = ts6.outFile(options); + var declarationPath = outPath ? ts6.removeFileExtension(outPath) + ".d.ts" : ts6.getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), currentDirectory, program.getCommonSourceDirectory(), getCanonicalFileName); + if (declarationPath === void 0) + return void 0; + var newLoc = getDocumentPositionMapper2(declarationPath, info.fileName).getGeneratedPosition(info); + return newLoc === info ? void 0 : newLoc; + } + function getSourceFile(fileName) { + var program = host.getProgram(); + if (!program) + return void 0; + var path = toPath(fileName); + var file = program.getSourceFileByPath(path); + return file && file.resolvedPath === path ? file : void 0; + } + function getOrCreateSourceFileLike(fileName) { + var path = toPath(fileName); + var fileFromCache = sourceFileLike.get(path); + if (fileFromCache !== void 0) + return fileFromCache ? fileFromCache : void 0; + if (!host.readFile || host.fileExists && !host.fileExists(path)) { + sourceFileLike.set(path, false); + return void 0; + } + var text = host.readFile(path); + var file = text ? createSourceFileLike(text) : false; + sourceFileLike.set(path, file); + return file ? file : void 0; + } + function getSourceFileLike(fileName) { + return !host.getSourceFileLike ? getSourceFile(fileName) || getOrCreateSourceFileLike(fileName) : host.getSourceFileLike(fileName); + } + function toLineColumnOffset(fileName, position) { + var file = getSourceFileLike(fileName); + return file.getLineAndCharacterOfPosition(position); + } + function clearCache() { + sourceFileLike.clear(); + documentPositionMappers.clear(); + } + } + ts6.getSourceMapper = getSourceMapper; + function getDocumentPositionMapper(host, generatedFileName, generatedFileLineInfo, readMapFile) { + var mapFileName = ts6.tryGetSourceMappingURL(generatedFileLineInfo); + if (mapFileName) { + var match = base64UrlRegExp.exec(mapFileName); + if (match) { + if (match[1]) { + var base64Object = match[1]; + return convertDocumentToSourceMapper(host, ts6.base64decode(ts6.sys, base64Object), generatedFileName); + } + mapFileName = void 0; + } + } + var possibleMapLocations = []; + if (mapFileName) { + possibleMapLocations.push(mapFileName); + } + possibleMapLocations.push(generatedFileName + ".map"); + var originalMapFileName = mapFileName && ts6.getNormalizedAbsolutePath(mapFileName, ts6.getDirectoryPath(generatedFileName)); + for (var _i = 0, possibleMapLocations_1 = possibleMapLocations; _i < possibleMapLocations_1.length; _i++) { + var location = possibleMapLocations_1[_i]; + var mapFileName_1 = ts6.getNormalizedAbsolutePath(location, ts6.getDirectoryPath(generatedFileName)); + var mapFileContents = readMapFile(mapFileName_1, originalMapFileName); + if (ts6.isString(mapFileContents)) { + return convertDocumentToSourceMapper(host, mapFileContents, mapFileName_1); + } + if (mapFileContents !== void 0) { + return mapFileContents || void 0; + } + } + return void 0; + } + ts6.getDocumentPositionMapper = getDocumentPositionMapper; + function convertDocumentToSourceMapper(host, contents, mapFileName) { + var map = ts6.tryParseRawSourceMap(contents); + if (!map || !map.sources || !map.file || !map.mappings) { + return void 0; + } + if (map.sourcesContent && map.sourcesContent.some(ts6.isString)) + return void 0; + return ts6.createDocumentPositionMapper(host, map, mapFileName); + } + function createSourceFileLike(text, lineMap) { + return { + text, + lineMap, + getLineAndCharacterOfPosition: function(pos) { + return ts6.computeLineAndCharacterOfPosition(ts6.getLineStarts(this), pos); + } + }; + } + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var visitedNestedConvertibleFunctions = new ts6.Map(); + function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) { + program.getSemanticDiagnostics(sourceFile, cancellationToken); + var diags = []; + var checker = program.getTypeChecker(); + var isCommonJSFile = sourceFile.impliedNodeFormat === ts6.ModuleKind.CommonJS || ts6.fileExtensionIsOneOf(sourceFile.fileName, [ + ".cts", + ".cjs" + /* Extension.Cjs */ + ]); + if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (ts6.programContainsEsModules(program) || ts6.compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) { + diags.push(ts6.createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), ts6.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module)); + } + var isJsFile = ts6.isSourceFileJS(sourceFile); + visitedNestedConvertibleFunctions.clear(); + check(sourceFile); + if (ts6.getAllowSyntheticDefaultImports(program.getCompilerOptions())) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + var importNode = ts6.importFromModuleSpecifier(moduleSpecifier); + var name = importNameForConvertToDefaultImport(importNode); + if (!name) + continue; + var module_1 = ts6.getResolvedModule(sourceFile, moduleSpecifier.text, ts6.getModeForUsageLocation(sourceFile, moduleSpecifier)); + var resolvedFile = module_1 && program.getSourceFile(module_1.resolvedFileName); + if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && ts6.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) { + diags.push(ts6.createDiagnosticForNode(name, ts6.Diagnostics.Import_may_be_converted_to_a_default_import)); + } + } + } + ts6.addRange(diags, sourceFile.bindSuggestionDiagnostics); + ts6.addRange(diags, program.getSuggestionDiagnostics(sourceFile, cancellationToken)); + return diags.sort(function(d1, d2) { + return d1.start - d2.start; + }); + function check(node) { + if (isJsFile) { + if (canBeConvertedToClass(node, checker)) { + diags.push(ts6.createDiagnosticForNode(ts6.isVariableDeclaration(node.parent) ? node.parent.name : node, ts6.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)); + } + } else { + if (ts6.isVariableStatement(node) && node.parent === sourceFile && node.declarationList.flags & 2 && node.declarationList.declarations.length === 1) { + var init = node.declarationList.declarations[0].initializer; + if (init && ts6.isRequireCall( + init, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + diags.push(ts6.createDiagnosticForNode(init, ts6.Diagnostics.require_call_may_be_converted_to_an_import)); + } + } + if (ts6.codefix.parameterShouldGetTypeFromJSDoc(node)) { + diags.push(ts6.createDiagnosticForNode(node.name || node, ts6.Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types)); + } + } + if (canBeConvertedToAsync(node)) { + addConvertToAsyncFunctionDiagnostics(node, checker, diags); + } + node.forEachChild(check); + } + } + ts6.computeSuggestionDiagnostics = computeSuggestionDiagnostics; + function containsTopLevelCommonjs(sourceFile) { + return sourceFile.statements.some(function(statement) { + switch (statement.kind) { + case 240: + return statement.declarationList.declarations.some(function(decl) { + return !!decl.initializer && ts6.isRequireCall( + propertyAccessLeftHandSide(decl.initializer), + /*checkArgumentIsStringLiteralLike*/ + true + ); + }); + case 241: { + var expression = statement.expression; + if (!ts6.isBinaryExpression(expression)) + return ts6.isRequireCall( + expression, + /*checkArgumentIsStringLiteralLike*/ + true + ); + var kind = ts6.getAssignmentDeclarationKind(expression); + return kind === 1 || kind === 2; + } + default: + return false; + } + }); + } + function propertyAccessLeftHandSide(node) { + return ts6.isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node; + } + function importNameForConvertToDefaultImport(node) { + switch (node.kind) { + case 269: + var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 && ts6.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : void 0; + case 268: + return node.name; + default: + return void 0; + } + } + function addConvertToAsyncFunctionDiagnostics(node, checker, diags) { + if (isConvertibleFunction(node, checker) && !visitedNestedConvertibleFunctions.has(getKeyFromNode(node))) { + diags.push(ts6.createDiagnosticForNode(!node.name && ts6.isVariableDeclaration(node.parent) && ts6.isIdentifier(node.parent.name) ? node.parent.name : node, ts6.Diagnostics.This_may_be_converted_to_an_async_function)); + } + } + function isConvertibleFunction(node, checker) { + return !ts6.isAsyncFunction(node) && node.body && ts6.isBlock(node.body) && hasReturnStatementWithPromiseHandler(node.body, checker) && returnsPromise(node, checker); + } + function returnsPromise(node, checker) { + var signature = checker.getSignatureFromDeclaration(node); + var returnType = signature ? checker.getReturnTypeOfSignature(signature) : void 0; + return !!returnType && !!checker.getPromisedTypeOfPromise(returnType); + } + ts6.returnsPromise = returnsPromise; + function getErrorNodeFromCommonJsIndicator(commonJsModuleIndicator) { + return ts6.isBinaryExpression(commonJsModuleIndicator) ? commonJsModuleIndicator.left : commonJsModuleIndicator; + } + function hasReturnStatementWithPromiseHandler(body, checker) { + return !!ts6.forEachReturnStatement(body, function(statement) { + return isReturnStatementWithFixablePromiseHandler(statement, checker); + }); + } + function isReturnStatementWithFixablePromiseHandler(node, checker) { + return ts6.isReturnStatement(node) && !!node.expression && isFixablePromiseHandler(node.expression, checker); + } + ts6.isReturnStatementWithFixablePromiseHandler = isReturnStatementWithFixablePromiseHandler; + function isFixablePromiseHandler(node, checker) { + if (!isPromiseHandler(node) || !hasSupportedNumberOfArguments(node) || !node.arguments.every(function(arg) { + return isFixablePromiseArgument(arg, checker); + })) { + return false; + } + var currentNode = node.expression.expression; + while (isPromiseHandler(currentNode) || ts6.isPropertyAccessExpression(currentNode)) { + if (ts6.isCallExpression(currentNode)) { + if (!hasSupportedNumberOfArguments(currentNode) || !currentNode.arguments.every(function(arg) { + return isFixablePromiseArgument(arg, checker); + })) { + return false; + } + currentNode = currentNode.expression.expression; + } else { + currentNode = currentNode.expression; + } + } + return true; + } + ts6.isFixablePromiseHandler = isFixablePromiseHandler; + function isPromiseHandler(node) { + return ts6.isCallExpression(node) && (ts6.hasPropertyAccessExpressionWithName(node, "then") || ts6.hasPropertyAccessExpressionWithName(node, "catch") || ts6.hasPropertyAccessExpressionWithName(node, "finally")); + } + function hasSupportedNumberOfArguments(node) { + var name = node.expression.name.text; + var maxArguments = name === "then" ? 2 : name === "catch" ? 1 : name === "finally" ? 1 : 0; + if (node.arguments.length > maxArguments) + return false; + if (node.arguments.length < maxArguments) + return true; + return maxArguments === 1 || ts6.some(node.arguments, function(arg) { + return arg.kind === 104 || ts6.isIdentifier(arg) && arg.text === "undefined"; + }); + } + function isFixablePromiseArgument(arg, checker) { + switch (arg.kind) { + case 259: + case 215: + var functionFlags = ts6.getFunctionFlags(arg); + if (functionFlags & 1) { + return false; + } + case 216: + visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); + case 104: + return true; + case 79: + case 208: { + var symbol = checker.getSymbolAtLocation(arg); + if (!symbol) { + return false; + } + return checker.isUndefinedSymbol(symbol) || ts6.some(ts6.skipAlias(symbol, checker).declarations, function(d) { + return ts6.isFunctionLike(d) || ts6.hasInitializer(d) && !!d.initializer && ts6.isFunctionLike(d.initializer); + }); + } + default: + return false; + } + } + function getKeyFromNode(exp) { + return "".concat(exp.pos.toString(), ":").concat(exp.end.toString()); + } + function canBeConvertedToClass(node, checker) { + var _a, _b, _c, _d; + if (node.kind === 215) { + if (ts6.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { + return true; + } + var symbol = checker.getSymbolOfExpando( + node, + /*allowDeclaration*/ + false + ); + return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); + } + if (node.kind === 259) { + return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); + } + return false; + } + function canBeConvertedToAsync(node) { + switch (node.kind) { + case 259: + case 171: + case 215: + case 216: + return true; + default: + return false; + } + } + ts6.canBeConvertedToAsync = canBeConvertedToAsync; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var SymbolDisplay; + (function(SymbolDisplay2) { + var symbolDisplayNodeBuilderFlags = 8192 | 70221824 | 16384; + function getSymbolKind(typeChecker, symbol, location) { + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); + if (result !== "") { + return result; + } + var flags = ts6.getCombinedLocalAndExportSymbolFlags(symbol); + if (flags & 32) { + return ts6.getDeclarationOfKind( + symbol, + 228 + /* SyntaxKind.ClassExpression */ + ) ? "local class" : "class"; + } + if (flags & 384) + return "enum"; + if (flags & 524288) + return "type"; + if (flags & 64) + return "interface"; + if (flags & 262144) + return "type parameter"; + if (flags & 8) + return "enum member"; + if (flags & 2097152) + return "alias"; + if (flags & 1536) + return "module"; + return result; + } + SymbolDisplay2.getSymbolKind = getSymbolKind; + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { + var roots = typeChecker.getRootSymbols(symbol); + if (roots.length === 1 && ts6.first(roots).flags & 8192 && typeChecker.getTypeOfSymbolAtLocation(symbol, location).getNonNullableType().getCallSignatures().length !== 0) { + return "method"; + } + if (typeChecker.isUndefinedSymbol(symbol)) { + return "var"; + } + if (typeChecker.isArgumentsSymbol(symbol)) { + return "local var"; + } + if (location.kind === 108 && ts6.isExpression(location) || ts6.isThisInTypeQuery(location)) { + return "parameter"; + } + var flags = ts6.getCombinedLocalAndExportSymbolFlags(symbol); + if (flags & 3) { + if (ts6.isFirstDeclarationOfSymbolParameter(symbol)) { + return "parameter"; + } else if (symbol.valueDeclaration && ts6.isVarConst(symbol.valueDeclaration)) { + return "const"; + } else if (ts6.forEach(symbol.declarations, ts6.isLet)) { + return "let"; + } + return isLocalVariableOrFunction(symbol) ? "local var" : "var"; + } + if (flags & 16) + return isLocalVariableOrFunction(symbol) ? "local function" : "function"; + if (flags & 32768) + return "getter"; + if (flags & 65536) + return "setter"; + if (flags & 8192) + return "method"; + if (flags & 16384) + return "constructor"; + if (flags & 131072) + return "index"; + if (flags & 4) { + if (flags & 33554432 && symbol.checkFlags & 6) { + var unionPropertyKind = ts6.forEach(typeChecker.getRootSymbols(symbol), function(rootSymbol) { + var rootSymbolFlags = rootSymbol.getFlags(); + if (rootSymbolFlags & (98308 | 3)) { + return "property"; + } + }); + if (!unionPropertyKind) { + var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return "method"; + } + return "property"; + } + return unionPropertyKind; + } + return "property"; + } + return ""; + } + function getNormalizedSymbolModifiers(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var _a = symbol.declarations, declaration = _a[0], declarations = _a.slice(1); + var excludeFlags = ts6.length(declarations) && ts6.isDeprecatedDeclaration(declaration) && ts6.some(declarations, function(d) { + return !ts6.isDeprecatedDeclaration(d); + }) ? 8192 : 0; + var modifiers = ts6.getNodeModifiers(declaration, excludeFlags); + if (modifiers) { + return modifiers.split(","); + } + } + return []; + } + function getSymbolModifiers(typeChecker, symbol) { + if (!symbol) { + return ""; + } + var modifiers = new ts6.Set(getNormalizedSymbolModifiers(symbol)); + if (symbol.flags & 2097152) { + var resolvedSymbol = typeChecker.getAliasedSymbol(symbol); + if (resolvedSymbol !== symbol) { + ts6.forEach(getNormalizedSymbolModifiers(resolvedSymbol), function(modifier) { + modifiers.add(modifier); + }); + } + } + if (symbol.flags & 16777216) { + modifiers.add( + "optional" + /* ScriptElementKindModifier.optionalModifier */ + ); + } + return modifiers.size > 0 ? ts6.arrayFrom(modifiers.values()).join(",") : ""; + } + SymbolDisplay2.getSymbolModifiers = getSymbolModifiers; + function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning, alias) { + var _a; + if (semanticMeaning === void 0) { + semanticMeaning = ts6.getMeaningFromLocation(location); + } + var displayParts = []; + var documentation = []; + var tags = []; + var symbolFlags = ts6.getCombinedLocalAndExportSymbolFlags(symbol); + var symbolKind = semanticMeaning & 1 ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : ""; + var hasAddedSymbolInfo = false; + var isThisExpression = location.kind === 108 && ts6.isInExpressionContext(location) || ts6.isThisInTypeQuery(location); + var type; + var printer; + var documentationFromAlias; + var tagsFromAlias; + var hasMultipleSignatures = false; + if (location.kind === 108 && !isThisExpression) { + return { displayParts: [ts6.keywordPart( + 108 + /* SyntaxKind.ThisKeyword */ + )], documentation: [], symbolKind: "primitive type", tags: void 0 }; + } + if (symbolKind !== "" || symbolFlags & 32 || symbolFlags & 2097152) { + if (symbolKind === "getter" || symbolKind === "setter") { + var declaration = ts6.find(symbol.declarations, function(declaration2) { + return declaration2.name === location; + }); + if (declaration) { + switch (declaration.kind) { + case 174: + symbolKind = "getter"; + break; + case 175: + symbolKind = "setter"; + break; + case 169: + symbolKind = "accessor"; + break; + default: + ts6.Debug.assertNever(declaration); + } + } else { + symbolKind = "property"; + } + } + var signature = void 0; + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (location.parent && location.parent.kind === 208) { + var right = location.parent.name; + if (right === location || right && right.getFullWidth() === 0) { + location = location.parent; + } + } + var callExpressionLike = void 0; + if (ts6.isCallOrNewExpression(location)) { + callExpressionLike = location; + } else if (ts6.isCallExpressionTarget(location) || ts6.isNewExpressionTarget(location)) { + callExpressionLike = location.parent; + } else if (location.parent && (ts6.isJsxOpeningLikeElement(location.parent) || ts6.isTaggedTemplateExpression(location.parent)) && ts6.isFunctionLike(symbol.valueDeclaration)) { + callExpressionLike = location.parent; + } + if (callExpressionLike) { + signature = typeChecker.getResolvedSignature(callExpressionLike); + var useConstructSignatures = callExpressionLike.kind === 211 || ts6.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + if (signature && !ts6.contains(allSignatures, signature.target) && !ts6.contains(allSignatures, signature)) { + signature = allSignatures.length ? allSignatures[0] : void 0; + } + if (signature) { + if (useConstructSignatures && symbolFlags & 32) { + symbolKind = "constructor"; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } else if (symbolFlags & 2097152) { + symbolKind = "alias"; + pushSymbolKind(symbolKind); + displayParts.push(ts6.spacePart()); + if (useConstructSignatures) { + if (signature.flags & 4) { + displayParts.push(ts6.keywordPart( + 126 + /* SyntaxKind.AbstractKeyword */ + )); + displayParts.push(ts6.spacePart()); + } + displayParts.push(ts6.keywordPart( + 103 + /* SyntaxKind.NewKeyword */ + )); + displayParts.push(ts6.spacePart()); + } + addFullSymbolName(symbol); + } else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + switch (symbolKind) { + case "JSX attribute": + case "property": + case "var": + case "const": + case "let": + case "parameter": + case "local var": + displayParts.push(ts6.punctuationPart( + 58 + /* SyntaxKind.ColonToken */ + )); + displayParts.push(ts6.spacePart()); + if (!(ts6.getObjectFlags(type) & 16) && type.symbol) { + ts6.addRange(displayParts, ts6.symbolToDisplayParts( + typeChecker, + type.symbol, + enclosingDeclaration, + /*meaning*/ + void 0, + 4 | 1 + /* SymbolFormatFlags.WriteTypeParametersOrArguments */ + )); + displayParts.push(ts6.lineBreakPart()); + } + if (useConstructSignatures) { + if (signature.flags & 4) { + displayParts.push(ts6.keywordPart( + 126 + /* SyntaxKind.AbstractKeyword */ + )); + displayParts.push(ts6.spacePart()); + } + displayParts.push(ts6.keywordPart( + 103 + /* SyntaxKind.NewKeyword */ + )); + displayParts.push(ts6.spacePart()); + } + addSignatureDisplayParts( + signature, + allSignatures, + 262144 + /* TypeFormatFlags.WriteArrowStyleSignature */ + ); + break; + default: + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + hasMultipleSignatures = allSignatures.length > 1; + } + } else if (ts6.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304) || // name of function declaration + location.kind === 135 && location.parent.kind === 173) { + var functionDeclaration_1 = location.parent; + var locationIsSymbolDeclaration = symbol.declarations && ts6.find(symbol.declarations, function(declaration2) { + return declaration2 === (location.kind === 135 ? functionDeclaration_1.parent : functionDeclaration_1); + }); + if (locationIsSymbolDeclaration) { + var allSignatures = functionDeclaration_1.kind === 173 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { + signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); + } else { + signature = allSignatures[0]; + } + if (functionDeclaration_1.kind === 173) { + symbolKind = "constructor"; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } else { + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + } + if (signature) { + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + hasMultipleSignatures = allSignatures.length > 1; + } + } + } + if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { + addAliasPrefixIfNecessary(); + if (ts6.getDeclarationOfKind( + symbol, + 228 + /* SyntaxKind.ClassExpression */ + )) { + pushSymbolKind( + "local class" + /* ScriptElementKind.localClassElement */ + ); + } else { + displayParts.push(ts6.keywordPart( + 84 + /* SyntaxKind.ClassKeyword */ + )); + } + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 64 && semanticMeaning & 2) { + prefixNextMeaning(); + displayParts.push(ts6.keywordPart( + 118 + /* SyntaxKind.InterfaceKeyword */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 524288 && semanticMeaning & 2) { + prefixNextMeaning(); + displayParts.push(ts6.keywordPart( + 154 + /* SyntaxKind.TypeKeyword */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.operatorPart( + 63 + /* SyntaxKind.EqualsToken */ + )); + displayParts.push(ts6.spacePart()); + ts6.addRange(displayParts, ts6.typeToDisplayParts( + typeChecker, + ts6.isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), + enclosingDeclaration, + 8388608 + /* TypeFormatFlags.InTypeAlias */ + )); + } + if (symbolFlags & 384) { + prefixNextMeaning(); + if (ts6.some(symbol.declarations, function(d) { + return ts6.isEnumDeclaration(d) && ts6.isEnumConst(d); + })) { + displayParts.push(ts6.keywordPart( + 85 + /* SyntaxKind.ConstKeyword */ + )); + displayParts.push(ts6.spacePart()); + } + displayParts.push(ts6.keywordPart( + 92 + /* SyntaxKind.EnumKeyword */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 1536 && !isThisExpression) { + prefixNextMeaning(); + var declaration = ts6.getDeclarationOfKind( + symbol, + 264 + /* SyntaxKind.ModuleDeclaration */ + ); + var isNamespace = declaration && declaration.name && declaration.name.kind === 79; + displayParts.push(ts6.keywordPart( + isNamespace ? 143 : 142 + /* SyntaxKind.ModuleKeyword */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 262144 && semanticMeaning & 2) { + prefixNextMeaning(); + displayParts.push(ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + )); + displayParts.push(ts6.textPart("type parameter")); + displayParts.push(ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + if (symbol.parent) { + addInPrefix(); + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } else { + var decl = ts6.getDeclarationOfKind( + symbol, + 165 + /* SyntaxKind.TypeParameter */ + ); + if (decl === void 0) + return ts6.Debug.fail(); + var declaration = decl.parent; + if (declaration) { + if (ts6.isFunctionLikeKind(declaration.kind)) { + addInPrefix(); + var signature = typeChecker.getSignatureFromDeclaration(declaration); + if (declaration.kind === 177) { + displayParts.push(ts6.keywordPart( + 103 + /* SyntaxKind.NewKeyword */ + )); + displayParts.push(ts6.spacePart()); + } else if (declaration.kind !== 176 && declaration.name) { + addFullSymbolName(declaration.symbol); + } + ts6.addRange(displayParts, ts6.signatureToDisplayParts( + typeChecker, + signature, + sourceFile, + 32 + /* TypeFormatFlags.WriteTypeArgumentsOfSignature */ + )); + } else if (declaration.kind === 262) { + addInPrefix(); + displayParts.push(ts6.keywordPart( + 154 + /* SyntaxKind.TypeKeyword */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(declaration.symbol); + writeTypeParametersOfSymbol(declaration.symbol, sourceFile); + } + } + } + } + if (symbolFlags & 8) { + symbolKind = "enum member"; + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302) { + var constantValue = typeChecker.getConstantValue(declaration); + if (constantValue !== void 0) { + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.operatorPart( + 63 + /* SyntaxKind.EqualsToken */ + )); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.displayPart(ts6.getTextOfConstantValue(constantValue), typeof constantValue === "number" ? ts6.SymbolDisplayPartKind.numericLiteral : ts6.SymbolDisplayPartKind.stringLiteral)); + } + } + } + if (symbol.flags & 2097152) { + prefixNextMeaning(); + if (!hasAddedSymbolInfo) { + var resolvedSymbol = typeChecker.getAliasedSymbol(symbol); + if (resolvedSymbol !== symbol && resolvedSymbol.declarations && resolvedSymbol.declarations.length > 0) { + var resolvedNode = resolvedSymbol.declarations[0]; + var declarationName = ts6.getNameOfDeclaration(resolvedNode); + if (declarationName) { + var isExternalModuleDeclaration = ts6.isModuleWithStringLiteralName(resolvedNode) && ts6.hasSyntacticModifier( + resolvedNode, + 2 + /* ModifierFlags.Ambient */ + ); + var shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration; + var resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, resolvedSymbol, ts6.getSourceFileOfNode(resolvedNode), resolvedNode, declarationName, semanticMeaning, shouldUseAliasName ? symbol : resolvedSymbol); + displayParts.push.apply(displayParts, resolvedInfo.displayParts); + displayParts.push(ts6.lineBreakPart()); + documentationFromAlias = resolvedInfo.documentation; + tagsFromAlias = resolvedInfo.tags; + } else { + documentationFromAlias = resolvedSymbol.getContextualDocumentationComment(resolvedNode, typeChecker); + tagsFromAlias = resolvedSymbol.getJsDocTags(typeChecker); + } + } + } + if (symbol.declarations) { + switch (symbol.declarations[0].kind) { + case 267: + displayParts.push(ts6.keywordPart( + 93 + /* SyntaxKind.ExportKeyword */ + )); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.keywordPart( + 143 + /* SyntaxKind.NamespaceKeyword */ + )); + break; + case 274: + displayParts.push(ts6.keywordPart( + 93 + /* SyntaxKind.ExportKeyword */ + )); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.keywordPart( + symbol.declarations[0].isExportEquals ? 63 : 88 + /* SyntaxKind.DefaultKeyword */ + )); + break; + case 278: + displayParts.push(ts6.keywordPart( + 93 + /* SyntaxKind.ExportKeyword */ + )); + break; + default: + displayParts.push(ts6.keywordPart( + 100 + /* SyntaxKind.ImportKeyword */ + )); + } + } + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol); + ts6.forEach(symbol.declarations, function(declaration2) { + if (declaration2.kind === 268) { + var importEqualsDeclaration = declaration2; + if (ts6.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.operatorPart( + 63 + /* SyntaxKind.EqualsToken */ + )); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.keywordPart( + 147 + /* SyntaxKind.RequireKeyword */ + )); + displayParts.push(ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + )); + displayParts.push(ts6.displayPart(ts6.getTextOfNode(ts6.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts6.SymbolDisplayPartKind.stringLiteral)); + displayParts.push(ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } else { + var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); + if (internalAliasSymbol) { + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.operatorPart( + 63 + /* SyntaxKind.EqualsToken */ + )); + displayParts.push(ts6.spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== "") { + if (type) { + if (isThisExpression) { + prefixNextMeaning(); + displayParts.push(ts6.keywordPart( + 108 + /* SyntaxKind.ThisKeyword */ + )); + } else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + if (symbolKind === "property" || symbolKind === "accessor" || symbolKind === "getter" || symbolKind === "setter" || symbolKind === "JSX attribute" || symbolFlags & 3 || symbolKind === "local var" || symbolKind === "index" || isThisExpression) { + displayParts.push(ts6.punctuationPart( + 58 + /* SyntaxKind.ColonToken */ + )); + displayParts.push(ts6.spacePart()); + if (type.symbol && type.symbol.flags & 262144 && symbolKind !== "index") { + var typeParameterParts = ts6.mapToDisplayParts(function(writer) { + var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); + getPrinter().writeNode(4, param, ts6.getSourceFileOfNode(ts6.getParseTreeNode(enclosingDeclaration)), writer); + }); + ts6.addRange(displayParts, typeParameterParts); + } else { + ts6.addRange(displayParts, ts6.typeToDisplayParts(typeChecker, type, enclosingDeclaration)); + } + if (symbol.target && symbol.target.tupleLabelDeclaration) { + var labelDecl = symbol.target.tupleLabelDeclaration; + ts6.Debug.assertNode(labelDecl.name, ts6.isIdentifier); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + )); + displayParts.push(ts6.textPart(ts6.idText(labelDecl.name))); + displayParts.push(ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } + } else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === "method") { + var allSignatures = type.getNonNullableType().getCallSignatures(); + if (allSignatures.length) { + addSignatureDisplayParts(allSignatures[0], allSignatures); + hasMultipleSignatures = allSignatures.length > 1; + } + } + } + } else { + symbolKind = getSymbolKind(typeChecker, symbol, location); + } + } + if (documentation.length === 0 && !hasMultipleSignatures) { + documentation = symbol.getContextualDocumentationComment(enclosingDeclaration, typeChecker); + } + if (documentation.length === 0 && symbolFlags & 4) { + if (symbol.parent && symbol.declarations && ts6.forEach(symbol.parent.declarations, function(declaration2) { + return declaration2.kind === 308; + })) { + for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { + var declaration = _b[_i]; + if (!declaration.parent || declaration.parent.kind !== 223) { + continue; + } + var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); + if (!rhsSymbol) { + continue; + } + documentation = rhsSymbol.getDocumentationComment(typeChecker); + tags = rhsSymbol.getJsDocTags(typeChecker); + if (documentation.length > 0) { + break; + } + } + } + } + if (documentation.length === 0 && ts6.isIdentifier(location) && symbol.valueDeclaration && ts6.isBindingElement(symbol.valueDeclaration)) { + var declaration = symbol.valueDeclaration; + var parent = declaration.parent; + if (ts6.isIdentifier(declaration.name) && ts6.isObjectBindingPattern(parent)) { + var name_4 = ts6.getTextOfIdentifierOrLiteral(declaration.name); + var objectType = typeChecker.getTypeAtLocation(parent); + documentation = ts6.firstDefined(objectType.isUnion() ? objectType.types : [objectType], function(t) { + var prop = t.getProperty(name_4); + return prop ? prop.getDocumentationComment(typeChecker) : void 0; + }) || ts6.emptyArray; + } + } + if (tags.length === 0 && !hasMultipleSignatures) { + tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker); + } + if (documentation.length === 0 && documentationFromAlias) { + documentation = documentationFromAlias; + } + if (tags.length === 0 && tagsFromAlias) { + tags = tagsFromAlias; + } + return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags }; + function getPrinter() { + if (!printer) { + printer = ts6.createPrinter({ removeComments: true }); + } + return printer; + } + function prefixNextMeaning() { + if (displayParts.length) { + displayParts.push(ts6.lineBreakPart()); + } + addAliasPrefixIfNecessary(); + } + function addAliasPrefixIfNecessary() { + if (alias) { + pushSymbolKind( + "alias" + /* ScriptElementKind.alias */ + ); + displayParts.push(ts6.spacePart()); + } + } + function addInPrefix() { + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.keywordPart( + 101 + /* SyntaxKind.InKeyword */ + )); + displayParts.push(ts6.spacePart()); + } + function addFullSymbolName(symbolToDisplay, enclosingDeclaration2) { + var indexInfos; + if (alias && symbolToDisplay === symbol) { + symbolToDisplay = alias; + } + if (symbolKind === "index") { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts6.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts6.punctuationPart( + 22 + /* SyntaxKind.OpenBracketToken */ + )); + indexInfos.forEach(function(info, i) { + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts6.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts6.spacePart()); + fullSymbolDisplayParts.push(ts6.punctuationPart( + 51 + /* SyntaxKind.BarToken */ + )); + fullSymbolDisplayParts.push(ts6.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts6.punctuationPart( + 23 + /* SyntaxKind.CloseBracketToken */ + )); + } else { + fullSymbolDisplayParts = ts6.symbolToDisplayParts( + typeChecker, + symbolToDisplay, + enclosingDeclaration2 || sourceFile, + /*meaning*/ + void 0, + 1 | 2 | 4 + /* SymbolFormatFlags.AllowAnyNodeKind */ + ); + } + ts6.addRange(displayParts, fullSymbolDisplayParts); + if (symbol.flags & 16777216) { + displayParts.push(ts6.punctuationPart( + 57 + /* SyntaxKind.QuestionToken */ + )); + } + } + function addPrefixForAnyFunctionOrVar(symbol2, symbolKind2) { + prefixNextMeaning(); + if (symbolKind2) { + pushSymbolKind(symbolKind2); + if (symbol2 && !ts6.some(symbol2.declarations, function(d) { + return ts6.isArrowFunction(d) || (ts6.isFunctionExpression(d) || ts6.isClassExpression(d)) && !d.name; + })) { + displayParts.push(ts6.spacePart()); + addFullSymbolName(symbol2); + } + } + } + function pushSymbolKind(symbolKind2) { + switch (symbolKind2) { + case "var": + case "function": + case "let": + case "const": + case "constructor": + displayParts.push(ts6.textOrKeywordPart(symbolKind2)); + return; + default: + displayParts.push(ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + )); + displayParts.push(ts6.textOrKeywordPart(symbolKind2)); + displayParts.push(ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )); + return; + } + } + function addSignatureDisplayParts(signature2, allSignatures2, flags) { + if (flags === void 0) { + flags = 0; + } + ts6.addRange(displayParts, ts6.signatureToDisplayParts( + typeChecker, + signature2, + enclosingDeclaration, + flags | 32 + /* TypeFormatFlags.WriteTypeArgumentsOfSignature */ + )); + if (allSignatures2.length > 1) { + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.punctuationPart( + 20 + /* SyntaxKind.OpenParenToken */ + )); + displayParts.push(ts6.operatorPart( + 39 + /* SyntaxKind.PlusToken */ + )); + displayParts.push(ts6.displayPart((allSignatures2.length - 1).toString(), ts6.SymbolDisplayPartKind.numericLiteral)); + displayParts.push(ts6.spacePart()); + displayParts.push(ts6.textPart(allSignatures2.length === 2 ? "overload" : "overloads")); + displayParts.push(ts6.punctuationPart( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } + documentation = signature2.getDocumentationComment(typeChecker); + tags = signature2.getJsDocTags(); + if (allSignatures2.length > 1 && documentation.length === 0 && tags.length === 0) { + documentation = allSignatures2[0].getDocumentationComment(typeChecker); + tags = allSignatures2[0].getJsDocTags().filter(function(tag) { + return tag.name !== "deprecated"; + }); + } + } + function writeTypeParametersOfSymbol(symbol2, enclosingDeclaration2) { + var typeParameterParts2 = ts6.mapToDisplayParts(function(writer) { + var params = typeChecker.symbolToTypeParameterDeclarations(symbol2, enclosingDeclaration2, symbolDisplayNodeBuilderFlags); + getPrinter().writeList(53776, params, ts6.getSourceFileOfNode(ts6.getParseTreeNode(enclosingDeclaration2)), writer); + }); + ts6.addRange(displayParts, typeParameterParts2); + } + } + SymbolDisplay2.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind; + function isLocalVariableOrFunction(symbol) { + if (symbol.parent) { + return false; + } + return ts6.forEach(symbol.declarations, function(declaration) { + if (declaration.kind === 215) { + return true; + } + if (declaration.kind !== 257 && declaration.kind !== 259) { + return false; + } + for (var parent = declaration.parent; !ts6.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 308 || parent.kind === 265) { + return false; + } + } + return true; + }); + } + })(SymbolDisplay = ts6.SymbolDisplay || (ts6.SymbolDisplay = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transpileModule(input, transpileOptions) { + var diagnostics = []; + var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {}; + var defaultOptions = ts6.getDefaultCompilerOptions(); + for (var key in defaultOptions) { + if (ts6.hasProperty(defaultOptions, key) && options[key] === void 0) { + options[key] = defaultOptions[key]; + } + } + for (var _i = 0, transpileOptionValueCompilerOptions_1 = ts6.transpileOptionValueCompilerOptions; _i < transpileOptionValueCompilerOptions_1.length; _i++) { + var option = transpileOptionValueCompilerOptions_1[_i]; + options[option.name] = option.transpileOptionValue; + } + options.suppressOutputPathCheck = true; + options.allowNonTsExtensions = true; + var newLine = ts6.getNewLineCharacter(options); + var compilerHost = { + getSourceFile: function(fileName) { + return fileName === ts6.normalizePath(inputFileName) ? sourceFile : void 0; + }, + writeFile: function(name, text) { + if (ts6.fileExtensionIs(name, ".map")) { + ts6.Debug.assertEqual(sourceMapText, void 0, "Unexpected multiple source map outputs, file:", name); + sourceMapText = text; + } else { + ts6.Debug.assertEqual(outputText, void 0, "Unexpected multiple outputs, file:", name); + outputText = text; + } + }, + getDefaultLibFileName: function() { + return "lib.d.ts"; + }, + useCaseSensitiveFileNames: function() { + return false; + }, + getCanonicalFileName: function(fileName) { + return fileName; + }, + getCurrentDirectory: function() { + return ""; + }, + getNewLine: function() { + return newLine; + }, + fileExists: function(fileName) { + return fileName === inputFileName; + }, + readFile: function() { + return ""; + }, + directoryExists: function() { + return true; + }, + getDirectories: function() { + return []; + } + }; + var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); + var sourceFile = ts6.createSourceFile(inputFileName, input, { + languageVersion: ts6.getEmitScriptTarget(options), + impliedNodeFormat: ts6.getImpliedNodeFormatForFile( + ts6.toPath(inputFileName, "", compilerHost.getCanonicalFileName), + /*cache*/ + void 0, + compilerHost, + options + ), + setExternalModuleIndicator: ts6.getSetExternalModuleIndicator(options) + }); + if (transpileOptions.moduleName) { + sourceFile.moduleName = transpileOptions.moduleName; + } + if (transpileOptions.renamedDependencies) { + sourceFile.renamedDependencies = new ts6.Map(ts6.getEntries(transpileOptions.renamedDependencies)); + } + var outputText; + var sourceMapText; + var program = ts6.createProgram([inputFileName], options, compilerHost); + if (transpileOptions.reportDiagnostics) { + ts6.addRange( + /*to*/ + diagnostics, + /*from*/ + program.getSyntacticDiagnostics(sourceFile) + ); + ts6.addRange( + /*to*/ + diagnostics, + /*from*/ + program.getOptionsDiagnostics() + ); + } + program.emit( + /*targetSourceFile*/ + void 0, + /*writeFile*/ + void 0, + /*cancellationToken*/ + void 0, + /*emitOnlyDtsFiles*/ + void 0, + transpileOptions.transformers + ); + if (outputText === void 0) + return ts6.Debug.fail("Output generation failed"); + return { outputText, diagnostics, sourceMapText }; + } + ts6.transpileModule = transpileModule; + function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { + var output = transpileModule(input, { compilerOptions, fileName, reportDiagnostics: !!diagnostics, moduleName }); + ts6.addRange(diagnostics, output.diagnostics); + return output.outputText; + } + ts6.transpile = transpile; + var commandLineOptionsStringToEnum; + function fixupCompilerOptions(options, diagnostics) { + commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts6.filter(ts6.optionDeclarations, function(o) { + return typeof o.type === "object" && !ts6.forEachEntry(o.type, function(v) { + return typeof v !== "number"; + }); + }); + options = ts6.cloneCompilerOptions(options); + var _loop_8 = function(opt2) { + if (!ts6.hasProperty(options, opt2.name)) { + return "continue"; + } + var value = options[opt2.name]; + if (ts6.isString(value)) { + options[opt2.name] = ts6.parseCustomTypeOption(opt2, value, diagnostics); + } else { + if (!ts6.forEachEntry(opt2.type, function(v) { + return v === value; + })) { + diagnostics.push(ts6.createCompilerDiagnosticForInvalidCustomType(opt2)); + } + } + }; + for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { + var opt = commandLineOptionsStringToEnum_1[_i]; + _loop_8(opt); + } + return options; + } + ts6.fixupCompilerOptions = fixupCompilerOptions; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + var FormattingRequestKind; + (function(FormattingRequestKind2) { + FormattingRequestKind2[FormattingRequestKind2["FormatDocument"] = 0] = "FormatDocument"; + FormattingRequestKind2[FormattingRequestKind2["FormatSelection"] = 1] = "FormatSelection"; + FormattingRequestKind2[FormattingRequestKind2["FormatOnEnter"] = 2] = "FormatOnEnter"; + FormattingRequestKind2[FormattingRequestKind2["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; + FormattingRequestKind2[FormattingRequestKind2["FormatOnOpeningCurlyBrace"] = 4] = "FormatOnOpeningCurlyBrace"; + FormattingRequestKind2[FormattingRequestKind2["FormatOnClosingCurlyBrace"] = 5] = "FormatOnClosingCurlyBrace"; + })(FormattingRequestKind = formatting2.FormattingRequestKind || (formatting2.FormattingRequestKind = {})); + var FormattingContext = ( + /** @class */ + function() { + function FormattingContext2(sourceFile, formattingRequestKind, options) { + this.sourceFile = sourceFile; + this.formattingRequestKind = formattingRequestKind; + this.options = options; + } + FormattingContext2.prototype.updateContext = function(currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { + this.currentTokenSpan = ts6.Debug.checkDefined(currentRange); + this.currentTokenParent = ts6.Debug.checkDefined(currentTokenParent); + this.nextTokenSpan = ts6.Debug.checkDefined(nextRange); + this.nextTokenParent = ts6.Debug.checkDefined(nextTokenParent); + this.contextNode = ts6.Debug.checkDefined(commonParent); + this.contextNodeAllOnSameLine = void 0; + this.nextNodeAllOnSameLine = void 0; + this.tokensAreOnSameLine = void 0; + this.contextNodeBlockIsOnOneLine = void 0; + this.nextNodeBlockIsOnOneLine = void 0; + }; + FormattingContext2.prototype.ContextNodeAllOnSameLine = function() { + if (this.contextNodeAllOnSameLine === void 0) { + this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); + } + return this.contextNodeAllOnSameLine; + }; + FormattingContext2.prototype.NextNodeAllOnSameLine = function() { + if (this.nextNodeAllOnSameLine === void 0) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeAllOnSameLine; + }; + FormattingContext2.prototype.TokensAreOnSameLine = function() { + if (this.tokensAreOnSameLine === void 0) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + this.tokensAreOnSameLine = startLine === endLine; + } + return this.tokensAreOnSameLine; + }; + FormattingContext2.prototype.ContextNodeBlockIsOnOneLine = function() { + if (this.contextNodeBlockIsOnOneLine === void 0) { + this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); + } + return this.contextNodeBlockIsOnOneLine; + }; + FormattingContext2.prototype.NextNodeBlockIsOnOneLine = function() { + if (this.nextNodeBlockIsOnOneLine === void 0) { + this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeBlockIsOnOneLine; + }; + FormattingContext2.prototype.NodeIsOnOneLine = function(node) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; + return startLine === endLine; + }; + FormattingContext2.prototype.BlockIsOnOneLine = function(node) { + var openBrace = ts6.findChildOfKind(node, 18, this.sourceFile); + var closeBrace = ts6.findChildOfKind(node, 19, this.sourceFile); + if (openBrace && closeBrace) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + return startLine === endLine; + } + return false; + }; + return FormattingContext2; + }() + ); + formatting2.FormattingContext = FormattingContext; + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + var standardScanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false, + 0 + /* LanguageVariant.Standard */ + ); + var jsxScanner = ts6.createScanner( + 99, + /*skipTrivia*/ + false, + 1 + /* LanguageVariant.JSX */ + ); + var ScanAction; + (function(ScanAction2) { + ScanAction2[ScanAction2["Scan"] = 0] = "Scan"; + ScanAction2[ScanAction2["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; + ScanAction2[ScanAction2["RescanSlashToken"] = 2] = "RescanSlashToken"; + ScanAction2[ScanAction2["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + ScanAction2[ScanAction2["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; + ScanAction2[ScanAction2["RescanJsxText"] = 5] = "RescanJsxText"; + ScanAction2[ScanAction2["RescanJsxAttributeValue"] = 6] = "RescanJsxAttributeValue"; + })(ScanAction || (ScanAction = {})); + function getFormattingScanner(text, languageVariant, startPos, endPos, cb) { + var scanner = languageVariant === 1 ? jsxScanner : standardScanner; + scanner.setText(text); + scanner.setTextPos(startPos); + var wasNewLine = true; + var leadingTrivia; + var trailingTrivia; + var savedPos; + var lastScanAction; + var lastTokenInfo; + var res = cb({ + advance, + readTokenInfo, + readEOFTokenRange, + isOnToken, + isOnEOF, + getCurrentLeadingTrivia: function() { + return leadingTrivia; + }, + lastTrailingTriviaWasNewLine: function() { + return wasNewLine; + }, + skipToEndOf, + skipToStartOf, + getStartPos: function() { + var _a; + return (_a = lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.pos) !== null && _a !== void 0 ? _a : scanner.getTokenPos(); + } + }); + lastTokenInfo = void 0; + scanner.setText(void 0); + return res; + function advance() { + lastTokenInfo = void 0; + var isStarted = scanner.getStartPos() !== startPos; + if (isStarted) { + wasNewLine = !!trailingTrivia && ts6.last(trailingTrivia).kind === 4; + } else { + scanner.scan(); + } + leadingTrivia = void 0; + trailingTrivia = void 0; + var pos = scanner.getStartPos(); + while (pos < endPos) { + var t = scanner.getToken(); + if (!ts6.isTrivia(t)) { + break; + } + scanner.scan(); + var item = { + pos, + end: scanner.getStartPos(), + kind: t + }; + pos = scanner.getStartPos(); + leadingTrivia = ts6.append(leadingTrivia, item); + } + savedPos = scanner.getStartPos(); + } + function shouldRescanGreaterThanToken(node) { + switch (node.kind) { + case 33: + case 71: + case 72: + case 49: + case 48: + return true; + } + return false; + } + function shouldRescanJsxIdentifier(node) { + if (node.parent) { + switch (node.parent.kind) { + case 288: + case 283: + case 284: + case 282: + return ts6.isKeyword(node.kind) || node.kind === 79; + } + } + return false; + } + function shouldRescanJsxText(node) { + return ts6.isJsxText(node) || ts6.isJsxElement(node) && (lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.kind) === 11; + } + function shouldRescanSlashToken(container) { + return container.kind === 13; + } + function shouldRescanTemplateToken(container) { + return container.kind === 16 || container.kind === 17; + } + function shouldRescanJsxAttributeValue(node) { + return node.parent && ts6.isJsxAttribute(node.parent) && node.parent.initializer === node; + } + function startsWithSlashToken(t) { + return t === 43 || t === 68; + } + function readTokenInfo(n) { + ts6.Debug.assert(isOnToken()); + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : shouldRescanJsxIdentifier(n) ? 4 : shouldRescanJsxText(n) ? 5 : shouldRescanJsxAttributeValue(n) ? 6 : 0; + if (lastTokenInfo && expectedScanAction === lastScanAction) { + return fixTokenKind(lastTokenInfo, n); + } + if (scanner.getStartPos() !== savedPos) { + ts6.Debug.assert(lastTokenInfo !== void 0); + scanner.setTextPos(savedPos); + scanner.scan(); + } + var currentToken = getNextToken(n, expectedScanAction); + var token = formatting2.createTextRangeWithKind(scanner.getStartPos(), scanner.getTextPos(), currentToken); + if (trailingTrivia) { + trailingTrivia = void 0; + } + while (scanner.getStartPos() < endPos) { + currentToken = scanner.scan(); + if (!ts6.isTrivia(currentToken)) { + break; + } + var trivia = formatting2.createTextRangeWithKind(scanner.getStartPos(), scanner.getTextPos(), currentToken); + if (!trailingTrivia) { + trailingTrivia = []; + } + trailingTrivia.push(trivia); + if (currentToken === 4) { + scanner.scan(); + break; + } + } + lastTokenInfo = { leadingTrivia, trailingTrivia, token }; + return fixTokenKind(lastTokenInfo, n); + } + function getNextToken(n, expectedScanAction) { + var token = scanner.getToken(); + lastScanAction = 0; + switch (expectedScanAction) { + case 1: + if (token === 31) { + lastScanAction = 1; + var newToken = scanner.reScanGreaterToken(); + ts6.Debug.assert(n.kind === newToken); + return newToken; + } + break; + case 2: + if (startsWithSlashToken(token)) { + lastScanAction = 2; + var newToken = scanner.reScanSlashToken(); + ts6.Debug.assert(n.kind === newToken); + return newToken; + } + break; + case 3: + if (token === 19) { + lastScanAction = 3; + return scanner.reScanTemplateToken( + /* isTaggedTemplate */ + false + ); + } + break; + case 4: + lastScanAction = 4; + return scanner.scanJsxIdentifier(); + case 5: + lastScanAction = 5; + return scanner.reScanJsxToken( + /* allowMultilineJsxText */ + false + ); + case 6: + lastScanAction = 6; + return scanner.reScanJsxAttributeValue(); + case 0: + break; + default: + ts6.Debug.assertNever(expectedScanAction); + } + return token; + } + function readEOFTokenRange() { + ts6.Debug.assert(isOnEOF()); + return formatting2.createTextRangeWithKind( + scanner.getStartPos(), + scanner.getTextPos(), + 1 + /* SyntaxKind.EndOfFileToken */ + ); + } + function isOnToken() { + var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(); + return current !== 1 && !ts6.isTrivia(current); + } + function isOnEOF() { + var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(); + return current === 1; + } + function fixTokenKind(tokenInfo, container) { + if (ts6.isToken(container) && tokenInfo.token.kind !== container.kind) { + tokenInfo.token.kind = container.kind; + } + return tokenInfo; + } + function skipToEndOf(node) { + scanner.setTextPos(node.end); + savedPos = scanner.getStartPos(); + lastScanAction = void 0; + lastTokenInfo = void 0; + wasNewLine = false; + leadingTrivia = void 0; + trailingTrivia = void 0; + } + function skipToStartOf(node) { + scanner.setTextPos(node.pos); + savedPos = scanner.getStartPos(); + lastScanAction = void 0; + lastTokenInfo = void 0; + wasNewLine = false; + leadingTrivia = void 0; + trailingTrivia = void 0; + } + } + formatting2.getFormattingScanner = getFormattingScanner; + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + formatting2.anyContext = ts6.emptyArray; + var RuleAction; + (function(RuleAction2) { + RuleAction2[RuleAction2["StopProcessingSpaceActions"] = 1] = "StopProcessingSpaceActions"; + RuleAction2[RuleAction2["StopProcessingTokenActions"] = 2] = "StopProcessingTokenActions"; + RuleAction2[RuleAction2["InsertSpace"] = 4] = "InsertSpace"; + RuleAction2[RuleAction2["InsertNewLine"] = 8] = "InsertNewLine"; + RuleAction2[RuleAction2["DeleteSpace"] = 16] = "DeleteSpace"; + RuleAction2[RuleAction2["DeleteToken"] = 32] = "DeleteToken"; + RuleAction2[RuleAction2["InsertTrailingSemicolon"] = 64] = "InsertTrailingSemicolon"; + RuleAction2[RuleAction2["StopAction"] = 3] = "StopAction"; + RuleAction2[RuleAction2["ModifySpaceAction"] = 28] = "ModifySpaceAction"; + RuleAction2[RuleAction2["ModifyTokenAction"] = 96] = "ModifyTokenAction"; + })(RuleAction = formatting2.RuleAction || (formatting2.RuleAction = {})); + var RuleFlags; + (function(RuleFlags2) { + RuleFlags2[RuleFlags2["None"] = 0] = "None"; + RuleFlags2[RuleFlags2["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; + })(RuleFlags = formatting2.RuleFlags || (formatting2.RuleFlags = {})); + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + function getAllRules() { + var allTokens = []; + for (var token = 0; token <= 162; token++) { + if (token !== 1) { + allTokens.push(token); + } + } + function anyTokenExcept() { + var tokens = []; + for (var _i = 0; _i < arguments.length; _i++) { + tokens[_i] = arguments[_i]; + } + return { tokens: allTokens.filter(function(t) { + return !tokens.some(function(t2) { + return t2 === t; + }); + }), isSpecific: false }; + } + var anyToken = { tokens: allTokens, isSpecific: false }; + var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [ + 3 + /* SyntaxKind.MultiLineCommentTrivia */ + ], false)); + var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [ + 1 + /* SyntaxKind.EndOfFileToken */ + ], false)); + var keywords = tokenRangeFromRange( + 81, + 162 + /* SyntaxKind.LastKeyword */ + ); + var binaryOperators = tokenRangeFromRange( + 29, + 78 + /* SyntaxKind.LastBinaryOperator */ + ); + var binaryKeywordOperators = [ + 101, + 102, + 162, + 128, + 140 + /* SyntaxKind.IsKeyword */ + ]; + var unaryPrefixOperators = [ + 45, + 46, + 54, + 53 + /* SyntaxKind.ExclamationToken */ + ]; + var unaryPrefixExpressions = [ + 8, + 9, + 79, + 20, + 22, + 18, + 108, + 103 + /* SyntaxKind.NewKeyword */ + ]; + var unaryPreincrementExpressions = [ + 79, + 20, + 108, + 103 + /* SyntaxKind.NewKeyword */ + ]; + var unaryPostincrementExpressions = [ + 79, + 21, + 23, + 103 + /* SyntaxKind.NewKeyword */ + ]; + var unaryPredecrementExpressions = [ + 79, + 20, + 108, + 103 + /* SyntaxKind.NewKeyword */ + ]; + var unaryPostdecrementExpressions = [ + 79, + 21, + 23, + 103 + /* SyntaxKind.NewKeyword */ + ]; + var comments = [ + 2, + 3 + /* SyntaxKind.MultiLineCommentTrivia */ + ]; + var typeNames = __spreadArray([ + 79 + /* SyntaxKind.Identifier */ + ], ts6.typeKeywords, true); + var functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments; + var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([ + 79, + 3, + 84, + 93, + 100 + /* SyntaxKind.ImportKeyword */ + ]); + var controlOpenBraceLeftTokenRange = tokenRangeFrom([ + 21, + 3, + 90, + 111, + 96, + 91 + /* SyntaxKind.ElseKeyword */ + ]); + var highPriorityCommonRules = [ + // Leave comments alone + rule( + "IgnoreBeforeComment", + anyToken, + comments, + formatting2.anyContext, + 1 + /* RuleAction.StopProcessingSpaceActions */ + ), + rule( + "IgnoreAfterLineComment", + 2, + anyToken, + formatting2.anyContext, + 1 + /* RuleAction.StopProcessingSpaceActions */ + ), + rule( + "NotSpaceBeforeColon", + anyToken, + 58, + [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceAfterColon", + 58, + anyToken, + [isNonJsxSameLineTokenContext, isNotBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeQuestionMark", + anyToken, + 57, + [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // insert space after '?' only when it is used in conditional operator + rule( + "SpaceAfterQuestionMarkInConditionalOperator", + 57, + anyToken, + [isNonJsxSameLineTokenContext, isConditionalOperatorContext], + 4 + /* RuleAction.InsertSpace */ + ), + // in other cases there should be no space between '?' and next token + rule( + "NoSpaceAfterQuestionMark", + 57, + anyToken, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeDot", + anyToken, + [ + 24, + 28 + /* SyntaxKind.QuestionDotToken */ + ], + [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterDot", + [ + 24, + 28 + /* SyntaxKind.QuestionDotToken */ + ], + anyToken, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBetweenImportParenInImportType", + 100, + 20, + [isNonJsxSameLineTokenContext, isImportTypeContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Special handling of unary operators. + // Prefix operators generally shouldn't have a space between + // them and their target unary expression. + rule( + "NoSpaceAfterUnaryPrefixOperator", + unaryPrefixOperators, + unaryPrefixExpressions, + [isNonJsxSameLineTokenContext, isNotBinaryOpContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterUnaryPreincrementOperator", + 45, + unaryPreincrementExpressions, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterUnaryPredecrementOperator", + 46, + unaryPredecrementExpressions, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeUnaryPostincrementOperator", + unaryPostincrementExpressions, + 45, + [isNonJsxSameLineTokenContext, isNotStatementConditionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeUnaryPostdecrementOperator", + unaryPostdecrementExpressions, + 46, + [isNonJsxSameLineTokenContext, isNotStatementConditionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // More unary operator special-casing. + // DevDiv 181814: Be careful when removing leading whitespace + // around unary operators. Examples: + // 1 - -2 --X--> 1--2 + // a + ++b --X--> a+++b + rule( + "SpaceAfterPostincrementWhenFollowedByAdd", + 45, + 39, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterAddWhenFollowedByUnaryPlus", + 39, + 39, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterAddWhenFollowedByPreincrement", + 39, + 45, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterPostdecrementWhenFollowedBySubtract", + 46, + 40, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterSubtractWhenFollowedByUnaryMinus", + 40, + 40, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterSubtractWhenFollowedByPredecrement", + 40, + 46, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterCloseBrace", + 19, + [ + 27, + 26 + /* SyntaxKind.SemicolonToken */ + ], + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // For functions and control block place } on a new line [multi-line rule] + rule( + "NewLineBeforeCloseBraceInBlockContext", + anyTokenIncludingMultilineComments, + 19, + [isMultilineBlockContext], + 8 + /* RuleAction.InsertNewLine */ + ), + // Space/new line after }. + rule( + "SpaceAfterCloseBrace", + 19, + anyTokenExcept( + 21 + /* SyntaxKind.CloseParenToken */ + ), + [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied + // Also should not apply to }) + rule( + "SpaceBetweenCloseBraceAndElse", + 19, + 91, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBetweenCloseBraceAndWhile", + 19, + 115, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenEmptyBraceBrackets", + 18, + 19, + [isNonJsxSameLineTokenContext, isObjectContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];' + rule( + "SpaceAfterConditionalClosingParen", + 21, + 22, + [isControlDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenFunctionKeywordAndStar", + 98, + 41, + [isFunctionDeclarationOrFunctionExpressionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceAfterStarInGeneratorDeclaration", + 41, + 79, + [isFunctionDeclarationOrFunctionExpressionContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterFunctionInFuncDecl", + 98, + anyToken, + [isFunctionDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Insert new line after { and before } in multi-line contexts. + rule( + "NewLineAfterOpenBraceInBlockContext", + 18, + anyToken, + [isMultilineBlockContext], + 8 + /* RuleAction.InsertNewLine */ + ), + // For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token. + // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: + // get x() {} + // set x(val) {} + rule( + "SpaceAfterGetSetInMember", + [ + 137, + 151 + /* SyntaxKind.SetKeyword */ + ], + 79, + [isFunctionDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenYieldKeywordAndStar", + 125, + 41, + [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceBetweenYieldOrYieldStarAndOperand", + [ + 125, + 41 + /* SyntaxKind.AsteriskToken */ + ], + anyToken, + [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenReturnAndSemicolon", + 105, + 26, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceAfterCertainKeywords", + [ + 113, + 109, + 103, + 89, + 105, + 112, + 133 + /* SyntaxKind.AwaitKeyword */ + ], + anyToken, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterLetConstInVariableDeclaration", + [ + 119, + 85 + /* SyntaxKind.ConstKeyword */ + ], + anyToken, + [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeOpenParenInFuncCall", + anyToken, + 20, + [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], + 16 + /* RuleAction.DeleteSpace */ + ), + // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. + rule( + "SpaceBeforeBinaryKeywordOperator", + anyToken, + binaryKeywordOperators, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterBinaryKeywordOperator", + binaryKeywordOperators, + anyToken, + [isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterVoidOperator", + 114, + anyToken, + [isNonJsxSameLineTokenContext, isVoidOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Async-await + rule( + "SpaceBetweenAsyncAndOpenParen", + 132, + 20, + [isArrowFunctionContext, isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBetweenAsyncAndFunctionKeyword", + 132, + [ + 98, + 79 + /* SyntaxKind.Identifier */ + ], + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Template string + rule( + "NoSpaceBetweenTagAndTemplateString", + [ + 79, + 21 + /* SyntaxKind.CloseParenToken */ + ], + [ + 14, + 15 + /* SyntaxKind.TemplateHead */ + ], + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // JSX opening elements + rule( + "SpaceBeforeJsxAttribute", + anyToken, + 79, + [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBeforeSlashInJsxOpeningElement", + anyToken, + 43, + [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", + 43, + 31, + [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeEqualInJsxAttribute", + anyToken, + 63, + [isJsxAttributeContext, isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterEqualInJsxAttribute", + 63, + anyToken, + [isJsxAttributeContext, isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // TypeScript-specific rules + // Use of module as a function call. e.g.: import m2 = module("m2"); + rule( + "NoSpaceAfterModuleImport", + [ + 142, + 147 + /* SyntaxKind.RequireKeyword */ + ], + 20, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Add a space around certain TypeScript keywords + rule( + "SpaceAfterCertainTypeScriptKeywords", + [ + 126, + 127, + 84, + 136, + 88, + 92, + 93, + 94, + 137, + 117, + 100, + 118, + 142, + 143, + 121, + 123, + 122, + 146, + 151, + 124, + 154, + 158, + 141, + 138 + ], + anyToken, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBeforeCertainTypeScriptKeywords", + anyToken, + [ + 94, + 117, + 158 + /* SyntaxKind.FromKeyword */ + ], + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { + rule( + "SpaceAfterModuleName", + 10, + 18, + [isModuleDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Lambda expressions + rule( + "SpaceBeforeArrow", + anyToken, + 38, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterArrow", + 38, + anyToken, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Optional parameters and let args + rule( + "NoSpaceAfterEllipsis", + 25, + 79, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterOptionalParameters", + 57, + [ + 21, + 27 + /* SyntaxKind.CommaToken */ + ], + [isNonJsxSameLineTokenContext, isNotBinaryOpContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Remove spaces in empty interface literals. e.g.: x: {} + rule( + "NoSpaceBetweenEmptyInterfaceBraceBrackets", + 18, + 19, + [isNonJsxSameLineTokenContext, isObjectTypeContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // generics and type assertions + rule( + "NoSpaceBeforeOpenAngularBracket", + typeNames, + 29, + [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBetweenCloseParenAndAngularBracket", + 21, + 29, + [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterOpenAngularBracket", + 29, + anyToken, + [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeCloseAngularBracket", + anyToken, + 31, + [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterCloseAngularBracket", + 31, + [ + 20, + 22, + 31, + 27 + /* SyntaxKind.CommaToken */ + ], + [ + isNonJsxSameLineTokenContext, + isTypeArgumentOrParameterOrAssertionContext, + isNotFunctionDeclContext + /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/ + ], + 16 + /* RuleAction.DeleteSpace */ + ), + // decorators + rule( + "SpaceBeforeAt", + [ + 21, + 79 + /* SyntaxKind.Identifier */ + ], + 59, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterAt", + 59, + anyToken, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after @ in decorator + rule( + "SpaceAfterDecorator", + anyToken, + [ + 126, + 79, + 93, + 88, + 84, + 124, + 123, + 121, + 122, + 137, + 151, + 22, + 41 + ], + [isEndOfDecoratorContextOnSameLine], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeNonNullAssertionOperator", + anyToken, + 53, + [isNonJsxSameLineTokenContext, isNonNullAssertionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterNewKeywordOnConstructorSignature", + 103, + 20, + [isNonJsxSameLineTokenContext, isConstructorSignatureContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceLessThanAndNonJSXTypeAnnotation", + 29, + 29, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ) + ]; + var userConfigurableRules = [ + // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + rule( + "SpaceAfterConstructor", + 135, + 20, + [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterConstructor", + 135, + 20, + [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceAfterComma", + 27, + anyToken, + [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterComma", + 27, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after function keyword for anonymous functions + rule( + "SpaceAfterAnonymousFunctionKeyword", + [ + 98, + 41 + /* SyntaxKind.AsteriskToken */ + ], + 20, + [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterAnonymousFunctionKeyword", + [ + 98, + 41 + /* SyntaxKind.AsteriskToken */ + ], + 20, + [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after keywords in control flow statements + rule( + "SpaceAfterKeywordInControl", + keywords, + 20, + [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterKeywordInControl", + keywords, + 20, + [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after opening and before closing nonempty parenthesis + rule( + "SpaceAfterOpenParen", + 20, + anyToken, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBeforeCloseParen", + anyToken, + 21, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBetweenOpenParens", + 20, + 20, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenParens", + 20, + 21, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterOpenParen", + 20, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeCloseParen", + anyToken, + 21, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after opening and before closing nonempty brackets + rule( + "SpaceAfterOpenBracket", + 22, + anyToken, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBeforeCloseBracket", + anyToken, + 23, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenBrackets", + 22, + 23, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterOpenBracket", + 22, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeCloseBracket", + anyToken, + 23, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. + rule( + "SpaceAfterOpenBrace", + 18, + anyToken, + [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBeforeCloseBrace", + anyToken, + 19, + [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenEmptyBraceBrackets", + 18, + 19, + [isNonJsxSameLineTokenContext, isObjectContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterOpenBrace", + 18, + anyToken, + [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeCloseBrace", + anyToken, + 19, + [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert a space after opening and before closing empty brace brackets + rule( + "SpaceBetweenEmptyBraceBrackets", + 18, + 19, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces")], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBetweenEmptyBraceBrackets", + 18, + 19, + [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after opening and before closing template string braces + rule( + "SpaceAfterTemplateHeadAndMiddle", + [ + 15, + 16 + /* SyntaxKind.TemplateMiddle */ + ], + anyToken, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxTextContext], + 4, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + rule( + "SpaceBeforeTemplateMiddleAndTail", + anyToken, + [ + 16, + 17 + /* SyntaxKind.TemplateTail */ + ], + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterTemplateHeadAndMiddle", + [ + 15, + 16 + /* SyntaxKind.TemplateMiddle */ + ], + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxTextContext], + 16, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + rule( + "NoSpaceBeforeTemplateMiddleAndTail", + anyToken, + [ + 16, + 17 + /* SyntaxKind.TemplateTail */ + ], + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // No space after { and before } in JSX expression + rule( + "SpaceAfterOpenBraceInJsxExpression", + 18, + anyToken, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceBeforeCloseBraceInJsxExpression", + anyToken, + 19, + [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterOpenBraceInJsxExpression", + 18, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceBeforeCloseBraceInJsxExpression", + anyToken, + 19, + [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space after semicolon in for statement + rule( + "SpaceAfterSemicolonInFor", + 26, + anyToken, + [isOptionEnabled("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterSemicolonInFor", + 26, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Insert space before and after binary operators + rule( + "SpaceBeforeBinaryOperator", + anyToken, + binaryOperators, + [isOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "SpaceAfterBinaryOperator", + binaryOperators, + anyToken, + [isOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeBinaryOperator", + anyToken, + binaryOperators, + [isOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterBinaryOperator", + binaryOperators, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceBeforeOpenParenInFuncDecl", + anyToken, + 20, + [isOptionEnabled("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeOpenParenInFuncDecl", + anyToken, + 20, + [isOptionDisabledOrUndefined("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // Open Brace braces after control block + rule( + "NewLineBeforeOpenBraceInControl", + controlOpenBraceLeftTokenRange, + 18, + [isOptionEnabled("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isBeforeMultilineBlockContext], + 8, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + // Open Brace braces after function + // TypeScript: Function can have return types, which can be made of tons of different token kinds + rule( + "NewLineBeforeOpenBraceInFunction", + functionOpenBraceLeftTokenRange, + 18, + [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeMultilineBlockContext], + 8, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + // Open Brace braces after TypeScript module/class/interface + rule( + "NewLineBeforeOpenBraceInTypeScriptDeclWithBlock", + typeScriptOpenBraceLeftTokenRange, + 18, + [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isBeforeMultilineBlockContext], + 8, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + rule( + "SpaceAfterTypeAssertion", + 31, + anyToken, + [isOptionEnabled("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceAfterTypeAssertion", + 31, + anyToken, + [isOptionDisabledOrUndefined("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceBeforeTypeAnnotation", + anyToken, + [ + 57, + 58 + /* SyntaxKind.ColonToken */ + ], + [isOptionEnabled("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], + 4 + /* RuleAction.InsertSpace */ + ), + rule( + "NoSpaceBeforeTypeAnnotation", + anyToken, + [ + 57, + 58 + /* SyntaxKind.ColonToken */ + ], + [isOptionDisabledOrUndefined("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoOptionalSemicolon", + 26, + anyTokenIncludingEOF, + [optionEquals("semicolons", ts6.SemicolonPreference.Remove), isSemicolonDeletionContext], + 32 + /* RuleAction.DeleteToken */ + ), + rule( + "OptionalSemicolon", + anyToken, + anyTokenIncludingEOF, + [optionEquals("semicolons", ts6.SemicolonPreference.Insert), isSemicolonInsertionContext], + 64 + /* RuleAction.InsertTrailingSemicolon */ + ) + ]; + var lowPriorityCommonRules = [ + // Space after keyword but not before ; or : or ? + rule( + "NoSpaceBeforeSemicolon", + anyToken, + 26, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceBeforeOpenBraceInControl", + controlOpenBraceLeftTokenRange, + 18, + [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], + 4, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + rule( + "SpaceBeforeOpenBraceInFunction", + functionOpenBraceLeftTokenRange, + 18, + [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], + 4, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + rule( + "SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", + typeScriptOpenBraceLeftTokenRange, + 18, + [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], + 4, + 1 + /* RuleFlags.CanDeleteNewLines */ + ), + rule( + "NoSpaceBeforeComma", + anyToken, + 27, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + // No space before and after indexer `x[]` + rule( + "NoSpaceBeforeOpenBracket", + anyTokenExcept( + 132, + 82 + /* SyntaxKind.CaseKeyword */ + ), + 22, + [isNonJsxSameLineTokenContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "NoSpaceAfterCloseBracket", + 23, + anyToken, + [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], + 16 + /* RuleAction.DeleteSpace */ + ), + rule( + "SpaceAfterSemicolon", + 26, + anyToken, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Remove extra space between for and await + rule( + "SpaceBetweenForAndAwaitKeyword", + 97, + 133, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ), + // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. + // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] + rule( + "SpaceBetweenStatements", + [ + 21, + 90, + 91, + 82 + /* SyntaxKind.CaseKeyword */ + ], + anyToken, + [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], + 4 + /* RuleAction.InsertSpace */ + ), + // This low-pri rule takes care of "try {", "catch {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. + rule( + "SpaceAfterTryCatchFinally", + [ + 111, + 83, + 96 + /* SyntaxKind.FinallyKeyword */ + ], + 18, + [isNonJsxSameLineTokenContext], + 4 + /* RuleAction.InsertSpace */ + ) + ]; + return __spreadArray(__spreadArray(__spreadArray([], highPriorityCommonRules, true), userConfigurableRules, true), lowPriorityCommonRules, true); + } + formatting2.getAllRules = getAllRules; + function rule(debugName, left, right, context, action, flags) { + if (flags === void 0) { + flags = 0; + } + return { leftTokenRange: toTokenRange(left), rightTokenRange: toTokenRange(right), rule: { debugName, context, action, flags } }; + } + function tokenRangeFrom(tokens) { + return { tokens, isSpecific: true }; + } + function toTokenRange(arg) { + return typeof arg === "number" ? tokenRangeFrom([arg]) : ts6.isArray(arg) ? tokenRangeFrom(arg) : arg; + } + function tokenRangeFromRange(from, to, except) { + if (except === void 0) { + except = []; + } + var tokens = []; + for (var token = from; token <= to; token++) { + if (!ts6.contains(except, token)) { + tokens.push(token); + } + } + return tokenRangeFrom(tokens); + } + function optionEquals(optionName, optionValue) { + return function(context) { + return context.options && context.options[optionName] === optionValue; + }; + } + function isOptionEnabled(optionName) { + return function(context) { + return context.options && ts6.hasProperty(context.options, optionName) && !!context.options[optionName]; + }; + } + function isOptionDisabled(optionName) { + return function(context) { + return context.options && ts6.hasProperty(context.options, optionName) && !context.options[optionName]; + }; + } + function isOptionDisabledOrUndefined(optionName) { + return function(context) { + return !context.options || !ts6.hasProperty(context.options, optionName) || !context.options[optionName]; + }; + } + function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { + return function(context) { + return !context.options || !ts6.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); + }; + } + function isOptionEnabledOrUndefined(optionName) { + return function(context) { + return !context.options || !ts6.hasProperty(context.options, optionName) || !!context.options[optionName]; + }; + } + function isForContext(context) { + return context.contextNode.kind === 245; + } + function isNotForContext(context) { + return !isForContext(context); + } + function isBinaryOpContext(context) { + switch (context.contextNode.kind) { + case 223: + return context.contextNode.operatorToken.kind !== 27; + case 224: + case 191: + case 231: + case 278: + case 273: + case 179: + case 189: + case 190: + case 235: + return true; + case 205: + case 262: + case 268: + case 274: + case 257: + case 166: + case 302: + case 169: + case 168: + return context.currentTokenSpan.kind === 63 || context.nextTokenSpan.kind === 63; + case 246: + case 165: + return context.currentTokenSpan.kind === 101 || context.nextTokenSpan.kind === 101 || context.currentTokenSpan.kind === 63 || context.nextTokenSpan.kind === 63; + case 247: + return context.currentTokenSpan.kind === 162 || context.nextTokenSpan.kind === 162; + } + return false; + } + function isNotBinaryOpContext(context) { + return !isBinaryOpContext(context); + } + function isNotTypeAnnotationContext(context) { + return !isTypeAnnotationContext(context); + } + function isTypeAnnotationContext(context) { + var contextKind = context.contextNode.kind; + return contextKind === 169 || contextKind === 168 || contextKind === 166 || contextKind === 257 || ts6.isFunctionLikeKind(contextKind); + } + function isConditionalOperatorContext(context) { + return context.contextNode.kind === 224 || context.contextNode.kind === 191; + } + function isSameLineTokenOrBeforeBlockContext(context) { + return context.TokensAreOnSameLine() || isBeforeBlockContext(context); + } + function isBraceWrappedContext(context) { + return context.contextNode.kind === 203 || context.contextNode.kind === 197 || isSingleLineBlockContext(context); + } + function isBeforeMultilineBlockContext(context) { + return isBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + } + function isMultilineBlockContext(context) { + return isBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + } + function isSingleLineBlockContext(context) { + return isBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + } + function isBlockContext(context) { + return nodeIsBlockContext(context.contextNode); + } + function isBeforeBlockContext(context) { + return nodeIsBlockContext(context.nextTokenParent); + } + function nodeIsBlockContext(node) { + if (nodeIsTypeScriptDeclWithBlockContext(node)) { + return true; + } + switch (node.kind) { + case 238: + case 266: + case 207: + case 265: + return true; + } + return false; + } + function isFunctionDeclContext(context) { + switch (context.contextNode.kind) { + case 259: + case 171: + case 170: + case 174: + case 175: + case 176: + case 215: + case 173: + case 216: + case 261: + return true; + } + return false; + } + function isNotFunctionDeclContext(context) { + return !isFunctionDeclContext(context); + } + function isFunctionDeclarationOrFunctionExpressionContext(context) { + return context.contextNode.kind === 259 || context.contextNode.kind === 215; + } + function isTypeScriptDeclWithBlockContext(context) { + return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); + } + function nodeIsTypeScriptDeclWithBlockContext(node) { + switch (node.kind) { + case 260: + case 228: + case 261: + case 263: + case 184: + case 264: + case 275: + case 276: + case 269: + case 272: + return true; + } + return false; + } + function isAfterCodeBlockContext(context) { + switch (context.currentTokenParent.kind) { + case 260: + case 264: + case 263: + case 295: + case 265: + case 252: + return true; + case 238: { + var blockParent = context.currentTokenParent.parent; + if (!blockParent || blockParent.kind !== 216 && blockParent.kind !== 215) { + return true; + } + } + } + return false; + } + function isControlDeclContext(context) { + switch (context.contextNode.kind) { + case 242: + case 252: + case 245: + case 246: + case 247: + case 244: + case 255: + case 243: + case 251: + case 295: + return true; + default: + return false; + } + } + function isObjectContext(context) { + return context.contextNode.kind === 207; + } + function isFunctionCallContext(context) { + return context.contextNode.kind === 210; + } + function isNewContext(context) { + return context.contextNode.kind === 211; + } + function isFunctionCallOrNewContext(context) { + return isFunctionCallContext(context) || isNewContext(context); + } + function isPreviousTokenNotComma(context) { + return context.currentTokenSpan.kind !== 27; + } + function isNextTokenNotCloseBracket(context) { + return context.nextTokenSpan.kind !== 23; + } + function isNextTokenNotCloseParen(context) { + return context.nextTokenSpan.kind !== 21; + } + function isArrowFunctionContext(context) { + return context.contextNode.kind === 216; + } + function isImportTypeContext(context) { + return context.contextNode.kind === 202; + } + function isNonJsxSameLineTokenContext(context) { + return context.TokensAreOnSameLine() && context.contextNode.kind !== 11; + } + function isNonJsxTextContext(context) { + return context.contextNode.kind !== 11; + } + function isNonJsxElementOrFragmentContext(context) { + return context.contextNode.kind !== 281 && context.contextNode.kind !== 285; + } + function isJsxExpressionContext(context) { + return context.contextNode.kind === 291 || context.contextNode.kind === 290; + } + function isNextTokenParentJsxAttribute(context) { + return context.nextTokenParent.kind === 288; + } + function isJsxAttributeContext(context) { + return context.contextNode.kind === 288; + } + function isJsxSelfClosingElementContext(context) { + return context.contextNode.kind === 282; + } + function isNotBeforeBlockInFunctionDeclarationContext(context) { + return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); + } + function isEndOfDecoratorContextOnSameLine(context) { + return context.TokensAreOnSameLine() && ts6.hasDecorators(context.contextNode) && nodeIsInDecoratorContext(context.currentTokenParent) && !nodeIsInDecoratorContext(context.nextTokenParent); + } + function nodeIsInDecoratorContext(node) { + while (node && ts6.isExpression(node)) { + node = node.parent; + } + return node && node.kind === 167; + } + function isStartOfVariableDeclarationList(context) { + return context.currentTokenParent.kind === 258 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + } + function isNotFormatOnEnter(context) { + return context.formattingRequestKind !== 2; + } + function isModuleDeclContext(context) { + return context.contextNode.kind === 264; + } + function isObjectTypeContext(context) { + return context.contextNode.kind === 184; + } + function isConstructorSignatureContext(context) { + return context.contextNode.kind === 177; + } + function isTypeArgumentOrParameterOrAssertion(token, parent) { + if (token.kind !== 29 && token.kind !== 31) { + return false; + } + switch (parent.kind) { + case 180: + case 213: + case 262: + case 260: + case 228: + case 261: + case 259: + case 215: + case 216: + case 171: + case 170: + case 176: + case 177: + case 210: + case 211: + case 230: + return true; + default: + return false; + } + } + function isTypeArgumentOrParameterOrAssertionContext(context) { + return isTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); + } + function isTypeAssertionContext(context) { + return context.contextNode.kind === 213; + } + function isVoidOpContext(context) { + return context.currentTokenSpan.kind === 114 && context.currentTokenParent.kind === 219; + } + function isYieldOrYieldStarWithOperand(context) { + return context.contextNode.kind === 226 && context.contextNode.expression !== void 0; + } + function isNonNullAssertionContext(context) { + return context.contextNode.kind === 232; + } + function isNotStatementConditionContext(context) { + return !isStatementConditionContext(context); + } + function isStatementConditionContext(context) { + switch (context.contextNode.kind) { + case 242: + case 245: + case 246: + case 247: + case 243: + case 244: + return true; + default: + return false; + } + } + function isSemicolonDeletionContext(context) { + var nextTokenKind = context.nextTokenSpan.kind; + var nextTokenStart = context.nextTokenSpan.pos; + if (ts6.isTrivia(nextTokenKind)) { + var nextRealToken = context.nextTokenParent === context.currentTokenParent ? ts6.findNextToken(context.currentTokenParent, ts6.findAncestor(context.currentTokenParent, function(a) { + return !a.parent; + }), context.sourceFile) : context.nextTokenParent.getFirstToken(context.sourceFile); + if (!nextRealToken) { + return true; + } + nextTokenKind = nextRealToken.kind; + nextTokenStart = nextRealToken.getStart(context.sourceFile); + } + var startLine = context.sourceFile.getLineAndCharacterOfPosition(context.currentTokenSpan.pos).line; + var endLine = context.sourceFile.getLineAndCharacterOfPosition(nextTokenStart).line; + if (startLine === endLine) { + return nextTokenKind === 19 || nextTokenKind === 1; + } + if (nextTokenKind === 237 || nextTokenKind === 26) { + return false; + } + if (context.contextNode.kind === 261 || context.contextNode.kind === 262) { + return !ts6.isPropertySignature(context.currentTokenParent) || !!context.currentTokenParent.type || nextTokenKind !== 20; + } + if (ts6.isPropertyDeclaration(context.currentTokenParent)) { + return !context.currentTokenParent.initializer; + } + return context.currentTokenParent.kind !== 245 && context.currentTokenParent.kind !== 239 && context.currentTokenParent.kind !== 237 && nextTokenKind !== 22 && nextTokenKind !== 20 && nextTokenKind !== 39 && nextTokenKind !== 40 && nextTokenKind !== 43 && nextTokenKind !== 13 && nextTokenKind !== 27 && nextTokenKind !== 225 && nextTokenKind !== 15 && nextTokenKind !== 14 && nextTokenKind !== 24; + } + function isSemicolonInsertionContext(context) { + return ts6.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); + } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts6.isPropertyAccessExpression(context.contextNode) || !ts6.isNumericLiteral(context.contextNode.expression) || context.contextNode.expression.getText().indexOf(".") !== -1; + } + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + function getFormatContext(options, host) { + return { options, getRules: getRulesMap(), host }; + } + formatting2.getFormatContext = getFormatContext; + var rulesMapCache; + function getRulesMap() { + if (rulesMapCache === void 0) { + rulesMapCache = createRulesMap(formatting2.getAllRules()); + } + return rulesMapCache; + } + function getRuleActionExclusion(ruleAction) { + var mask2 = 0; + if (ruleAction & 1) { + mask2 |= 28; + } + if (ruleAction & 2) { + mask2 |= 96; + } + if (ruleAction & 28) { + mask2 |= 28; + } + if (ruleAction & 96) { + mask2 |= 96; + } + return mask2; + } + function createRulesMap(rules) { + var map = buildMap(rules); + return function(context) { + var bucket = map[getRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind)]; + if (bucket) { + var rules_1 = []; + var ruleActionMask = 0; + for (var _i = 0, bucket_1 = bucket; _i < bucket_1.length; _i++) { + var rule = bucket_1[_i]; + var acceptRuleActions = ~getRuleActionExclusion(ruleActionMask); + if (rule.action & acceptRuleActions && ts6.every(rule.context, function(c) { + return c(context); + })) { + rules_1.push(rule); + ruleActionMask |= rule.action; + } + } + if (rules_1.length) { + return rules_1; + } + } + }; + } + function buildMap(rules) { + var map = new Array(mapRowLength * mapRowLength); + var rulesBucketConstructionStateList = new Array(map.length); + for (var _i = 0, rules_2 = rules; _i < rules_2.length; _i++) { + var rule = rules_2[_i]; + var specificRule = rule.leftTokenRange.isSpecific && rule.rightTokenRange.isSpecific; + for (var _a = 0, _b = rule.leftTokenRange.tokens; _a < _b.length; _a++) { + var left = _b[_a]; + for (var _c = 0, _d = rule.rightTokenRange.tokens; _c < _d.length; _c++) { + var right = _d[_c]; + var index = getRuleBucketIndex(left, right); + var rulesBucket = map[index]; + if (rulesBucket === void 0) { + rulesBucket = map[index] = []; + } + addRule(rulesBucket, rule.rule, specificRule, rulesBucketConstructionStateList, index); + } + } + } + return map; + } + function getRuleBucketIndex(row, column) { + ts6.Debug.assert(row <= 162 && column <= 162, "Must compute formatting context from tokens"); + return row * mapRowLength + column; + } + var maskBitSize = 5; + var mask = 31; + var mapRowLength = 162 + 1; + var RulesPosition; + (function(RulesPosition2) { + RulesPosition2[RulesPosition2["StopRulesSpecific"] = 0] = "StopRulesSpecific"; + RulesPosition2[RulesPosition2["StopRulesAny"] = maskBitSize * 1] = "StopRulesAny"; + RulesPosition2[RulesPosition2["ContextRulesSpecific"] = maskBitSize * 2] = "ContextRulesSpecific"; + RulesPosition2[RulesPosition2["ContextRulesAny"] = maskBitSize * 3] = "ContextRulesAny"; + RulesPosition2[RulesPosition2["NoContextRulesSpecific"] = maskBitSize * 4] = "NoContextRulesSpecific"; + RulesPosition2[RulesPosition2["NoContextRulesAny"] = maskBitSize * 5] = "NoContextRulesAny"; + })(RulesPosition || (RulesPosition = {})); + function addRule(rules, rule, specificTokens, constructionState, rulesBucketIndex) { + var position = rule.action & 3 ? specificTokens ? RulesPosition.StopRulesSpecific : RulesPosition.StopRulesAny : rule.context !== formatting2.anyContext ? specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny : specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + var state = constructionState[rulesBucketIndex] || 0; + rules.splice(getInsertionIndex(state, position), 0, rule); + constructionState[rulesBucketIndex] = increaseInsertionIndex(state, position); + } + function getInsertionIndex(indexBitmap, maskPosition) { + var index = 0; + for (var pos = 0; pos <= maskPosition; pos += maskBitSize) { + index += indexBitmap & mask; + indexBitmap >>= maskBitSize; + } + return index; + } + function increaseInsertionIndex(indexBitmap, maskPosition) { + var value = (indexBitmap >> maskPosition & mask) + 1; + ts6.Debug.assert((value & mask) === value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); + return indexBitmap & ~(mask << maskPosition) | value << maskPosition; + } + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + function createTextRangeWithKind(pos, end, kind) { + var textRangeWithKind = { pos, end, kind }; + if (ts6.Debug.isDebugging) { + Object.defineProperty(textRangeWithKind, "__debugKind", { + get: function() { + return ts6.Debug.formatSyntaxKind(kind); + } + }); + } + return textRangeWithKind; + } + formatting2.createTextRangeWithKind = createTextRangeWithKind; + var Constants; + (function(Constants2) { + Constants2[Constants2["Unknown"] = -1] = "Unknown"; + })(Constants || (Constants = {})); + function formatOnEnter(position, sourceFile, formatContext) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { + return []; + } + var endOfFormatSpan = ts6.getEndLinePosition(line, sourceFile); + while (ts6.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } + if (ts6.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } + var span = { + // get start position for the previous line + pos: ts6.getStartPositionOfLine(line - 1, sourceFile), + // end value is exclusive so add 1 to the result + end: endOfFormatSpan + 1 + }; + return formatSpan( + span, + sourceFile, + formatContext, + 2 + /* FormattingRequestKind.FormatOnEnter */ + ); + } + formatting2.formatOnEnter = formatOnEnter; + function formatOnSemicolon(position, sourceFile, formatContext) { + var semicolon = findImmediatelyPrecedingTokenOfKind(position, 26, sourceFile); + return formatNodeLines( + findOutermostNodeWithinListLevel(semicolon), + sourceFile, + formatContext, + 3 + /* FormattingRequestKind.FormatOnSemicolon */ + ); + } + formatting2.formatOnSemicolon = formatOnSemicolon; + function formatOnOpeningCurly(position, sourceFile, formatContext) { + var openingCurly = findImmediatelyPrecedingTokenOfKind(position, 18, sourceFile); + if (!openingCurly) { + return []; + } + var curlyBraceRange = openingCurly.parent; + var outermostNode = findOutermostNodeWithinListLevel(curlyBraceRange); + var textRange = { + pos: ts6.getLineStartPositionForPosition(outermostNode.getStart(sourceFile), sourceFile), + end: position + }; + return formatSpan( + textRange, + sourceFile, + formatContext, + 4 + /* FormattingRequestKind.FormatOnOpeningCurlyBrace */ + ); + } + formatting2.formatOnOpeningCurly = formatOnOpeningCurly; + function formatOnClosingCurly(position, sourceFile, formatContext) { + var precedingToken = findImmediatelyPrecedingTokenOfKind(position, 19, sourceFile); + return formatNodeLines( + findOutermostNodeWithinListLevel(precedingToken), + sourceFile, + formatContext, + 5 + /* FormattingRequestKind.FormatOnClosingCurlyBrace */ + ); + } + formatting2.formatOnClosingCurly = formatOnClosingCurly; + function formatDocument(sourceFile, formatContext) { + var span = { + pos: 0, + end: sourceFile.text.length + }; + return formatSpan( + span, + sourceFile, + formatContext, + 0 + /* FormattingRequestKind.FormatDocument */ + ); + } + formatting2.formatDocument = formatDocument; + function formatSelection(start, end, sourceFile, formatContext) { + var span = { + pos: ts6.getLineStartPositionForPosition(start, sourceFile), + end + }; + return formatSpan( + span, + sourceFile, + formatContext, + 1 + /* FormattingRequestKind.FormatSelection */ + ); + } + formatting2.formatSelection = formatSelection; + function findImmediatelyPrecedingTokenOfKind(end, expectedTokenKind, sourceFile) { + var precedingToken = ts6.findPrecedingToken(end, sourceFile); + return precedingToken && precedingToken.kind === expectedTokenKind && end === precedingToken.getEnd() ? precedingToken : void 0; + } + function findOutermostNodeWithinListLevel(node) { + var current = node; + while (current && current.parent && current.parent.end === node.end && !isListElement(current.parent, current)) { + current = current.parent; + } + return current; + } + function isListElement(parent, node) { + switch (parent.kind) { + case 260: + case 261: + return ts6.rangeContainsRange(parent.members, node); + case 264: + var body = parent.body; + return !!body && body.kind === 265 && ts6.rangeContainsRange(body.statements, node); + case 308: + case 238: + case 265: + return ts6.rangeContainsRange(parent.statements, node); + case 295: + return ts6.rangeContainsRange(parent.block.statements, node); + } + return false; + } + function findEnclosingNode(range2, sourceFile) { + return find(sourceFile); + function find(n) { + var candidate = ts6.forEachChild(n, function(c) { + return ts6.startEndContainsRange(c.getStart(sourceFile), c.end, range2) && c; + }); + if (candidate) { + var result = find(candidate); + if (result) { + return result; + } + } + return n; + } + } + function prepareRangeContainsErrorFunction(errors2, originalRange) { + if (!errors2.length) { + return rangeHasNoErrors; + } + var sorted = errors2.filter(function(d) { + return ts6.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); + }).sort(function(e1, e2) { + return e1.start - e2.start; + }); + if (!sorted.length) { + return rangeHasNoErrors; + } + var index = 0; + return function(r) { + while (true) { + if (index >= sorted.length) { + return false; + } + var error = sorted[index]; + if (r.end <= error.start) { + return false; + } + if (ts6.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + return true; + } + index++; + } + }; + function rangeHasNoErrors() { + return false; + } + } + function getScanStartPosition(enclosingNode, originalRange, sourceFile) { + var start = enclosingNode.getStart(sourceFile); + if (start === originalRange.pos && enclosingNode.end === originalRange.end) { + return start; + } + var precedingToken = ts6.findPrecedingToken(originalRange.pos, sourceFile); + if (!precedingToken) { + return enclosingNode.pos; + } + if (precedingToken.end >= originalRange.pos) { + return enclosingNode.pos; + } + return precedingToken.end; + } + function getOwnOrInheritedDelta(n, options, sourceFile) { + var previousLine = -1; + var child; + while (n) { + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + if (previousLine !== -1 && line !== previousLine) { + break; + } + if (formatting2.SmartIndenter.shouldIndentChildNode(options, n, child, sourceFile)) { + return options.indentSize; + } + previousLine = line; + child = n; + n = n.parent; + } + return 0; + } + function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) { + var range2 = { pos: node.pos, end: node.end }; + return formatting2.getFormattingScanner(sourceFileLike.text, languageVariant, range2.pos, range2.end, function(scanner) { + return formatSpanWorker( + range2, + node, + initialIndentation, + delta, + scanner, + formatContext, + 1, + function(_) { + return false; + }, + // assume that node does not have any errors + sourceFileLike + ); + }); + } + formatting2.formatNodeGivenIndentation = formatNodeGivenIndentation; + function formatNodeLines(node, sourceFile, formatContext, requestKind) { + if (!node) { + return []; + } + var span = { + pos: ts6.getLineStartPositionForPosition(node.getStart(sourceFile), sourceFile), + end: node.end + }; + return formatSpan(span, sourceFile, formatContext, requestKind); + } + function formatSpan(originalRange, sourceFile, formatContext, requestKind) { + var enclosingNode = findEnclosingNode(originalRange, sourceFile); + return formatting2.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end, function(scanner) { + return formatSpanWorker(originalRange, enclosingNode, formatting2.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options), getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile), scanner, formatContext, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); + }); + } + function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, _a, requestKind, rangeContainsError, sourceFile) { + var _b; + var options = _a.options, getRules = _a.getRules, host = _a.host; + var formattingContext = new formatting2.FormattingContext(sourceFile, requestKind, options); + var previousRangeTriviaEnd; + var previousRange; + var previousParent; + var previousRangeStartLine; + var lastIndentedLine; + var indentationOnLastIndentedLine = -1; + var edits = []; + formattingScanner.advance(); + if (formattingScanner.isOnToken()) { + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + var undecoratedStartLine = startLine; + if (ts6.hasDecorators(enclosingNode)) { + undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts6.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line; + } + processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); + } + if (!formattingScanner.isOnToken()) { + var indentation = formatting2.SmartIndenter.nodeWillIndentChild( + options, + enclosingNode, + /*child*/ + void 0, + sourceFile, + /*indentByDefault*/ + false + ) ? initialIndentation + options.indentSize : initialIndentation; + var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (leadingTrivia) { + indentTriviaItems( + leadingTrivia, + indentation, + /*indentNextTokenOrTrivia*/ + false, + function(item) { + return processRange( + item, + sourceFile.getLineAndCharacterOfPosition(item.pos), + enclosingNode, + enclosingNode, + /*dynamicIndentation*/ + void 0 + ); + } + ); + if (options.trimTrailingWhitespace !== false) { + trimTrailingWhitespacesForRemainingRange(leadingTrivia); + } + } + } + if (previousRange && formattingScanner.getStartPos() >= originalRange.end) { + var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() : formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token : void 0; + if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) { + var parent = ((_b = ts6.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent; + processPair( + tokenInfo, + sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, + parent, + previousRange, + previousRangeStartLine, + previousParent, + parent, + /*dynamicIndentation*/ + void 0 + ); + } + } + return edits; + function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range2, inheritedIndentation) { + if (ts6.rangeOverlapsWithStartEnd(range2, startPos, endPos) || ts6.rangeContainsStartEnd(range2, startPos, endPos)) { + if (inheritedIndentation !== -1) { + return inheritedIndentation; + } + } else { + var startLine2 = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = ts6.getLineStartPositionForPosition(startPos, sourceFile); + var column = formatting2.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + if (startLine2 !== parentStartLine || startPos === column) { + var baseIndentSize = formatting2.SmartIndenter.getBaseIndentation(options); + return baseIndentSize > column ? baseIndentSize : column; + } + } + return -1; + } + function computeIndentation(node, startLine2, inheritedIndentation, parent2, parentDynamicIndentation, effectiveParentStartLine) { + var delta2 = formatting2.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; + if (effectiveParentStartLine === startLine2) { + return { + indentation: startLine2 === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(), + delta: Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta2) + }; + } else if (inheritedIndentation === -1) { + if (node.kind === 20 && startLine2 === lastIndentedLine) { + return { indentation: indentationOnLastIndentedLine, delta: parentDynamicIndentation.getDelta(node) }; + } else if (formatting2.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent2, node, startLine2, sourceFile) || formatting2.SmartIndenter.childIsUnindentedBranchOfConditionalExpression(parent2, node, startLine2, sourceFile) || formatting2.SmartIndenter.argumentStartsOnSameLineAsPreviousArgument(parent2, node, startLine2, sourceFile)) { + return { indentation: parentDynamicIndentation.getIndentation(), delta: delta2 }; + } else { + return { indentation: parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node), delta: delta2 }; + } + } else { + return { indentation: inheritedIndentation, delta: delta2 }; + } + } + function getFirstNonDecoratorTokenOfNode(node) { + if (ts6.canHaveModifiers(node)) { + var modifier = ts6.find(node.modifiers, ts6.isModifier, ts6.findIndex(node.modifiers, ts6.isDecorator)); + if (modifier) + return modifier.kind; + } + switch (node.kind) { + case 260: + return 84; + case 261: + return 118; + case 259: + return 98; + case 263: + return 263; + case 174: + return 137; + case 175: + return 151; + case 171: + if (node.asteriskToken) { + return 41; + } + case 169: + case 166: + var name = ts6.getNameOfDeclaration(node); + if (name) { + return name.kind; + } + } + } + function getDynamicIndentation(node, nodeStartLine, indentation2, delta2) { + return { + getIndentationForComment: function(kind, tokenIndentation, container) { + switch (kind) { + case 19: + case 23: + case 21: + return indentation2 + getDelta(container); + } + return tokenIndentation !== -1 ? tokenIndentation : indentation2; + }, + // if list end token is LessThanToken '>' then its delta should be explicitly suppressed + // so that LessThanToken as a binary operator can still be indented. + // foo.then + // < + // number, + // string, + // >(); + // vs + // var a = xValue + // > yValue; + getIndentationForToken: function(line, kind, container, suppressDelta) { + return !suppressDelta && shouldAddDelta(line, kind, container) ? indentation2 + getDelta(container) : indentation2; + }, + getIndentation: function() { + return indentation2; + }, + getDelta, + recomputeIndentation: function(lineAdded, parent2) { + if (formatting2.SmartIndenter.shouldIndentChildNode(options, parent2, node, sourceFile)) { + indentation2 += lineAdded ? options.indentSize : -options.indentSize; + delta2 = formatting2.SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize : 0; + } + } + }; + function shouldAddDelta(line, kind, container) { + switch (kind) { + case 18: + case 19: + case 21: + case 91: + case 115: + case 59: + return false; + case 43: + case 31: + switch (container.kind) { + case 283: + case 284: + case 282: + return false; + } + break; + case 22: + case 23: + if (container.kind !== 197) { + return false; + } + break; + } + return nodeStartLine !== line && !(ts6.hasDecorators(node) && kind === getFirstNonDecoratorTokenOfNode(node)); + } + function getDelta(child) { + return formatting2.SmartIndenter.nodeWillIndentChild( + options, + node, + child, + sourceFile, + /*indentByDefault*/ + true + ) ? delta2 : 0; + } + } + function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation2, delta2) { + if (!ts6.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { + return; + } + var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation2, delta2); + var childContextNode = contextNode; + ts6.forEachChild(node, function(child) { + processChildNode( + child, + /*inheritedIndentation*/ + -1, + node, + nodeDynamicIndentation, + nodeStartLine, + undecoratedNodeStartLine, + /*isListItem*/ + false + ); + }, function(nodes) { + processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); + }); + while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + var tokenInfo2 = formattingScanner.readTokenInfo(node); + if (tokenInfo2.token.end > Math.min(node.end, originalRange.end)) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo2, node, nodeDynamicIndentation, node); + } + function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { + ts6.Debug.assert(!ts6.nodeIsSynthesized(child)); + if (ts6.nodeIsMissing(child)) { + return inheritedIndentation; + } + var childStartPos = child.getStart(sourceFile); + var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line; + var undecoratedChildStartLine = childStartLine; + if (ts6.hasDecorators(child)) { + undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(ts6.getNonDecoratorTokenPosOfNode(child, sourceFile)).line; + } + var childIndentationAmount = -1; + if (isListItem && ts6.rangeContainsRange(originalRange, parent2)) { + childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); + if (childIndentationAmount !== -1) { + inheritedIndentation = childIndentationAmount; + } + } + if (!ts6.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { + if (child.end < originalRange.pos) { + formattingScanner.skipToEndOf(child); + } + return inheritedIndentation; + } + if (child.getFullWidth() === 0) { + return inheritedIndentation; + } + while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + var tokenInfo3 = formattingScanner.readTokenInfo(node); + if (tokenInfo3.token.end > originalRange.end) { + return inheritedIndentation; + } + if (tokenInfo3.token.end > childStartPos) { + if (tokenInfo3.token.pos > childStartPos) { + formattingScanner.skipToStartOf(child); + } + break; + } + consumeTokenAndAdvanceScanner(tokenInfo3, node, parentDynamicIndentation, node); + } + if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) { + return inheritedIndentation; + } + if (ts6.isToken(child)) { + var tokenInfo3 = formattingScanner.readTokenInfo(child); + if (child.kind !== 11) { + ts6.Debug.assert(tokenInfo3.token.end === child.end, "Token end is child end"); + consumeTokenAndAdvanceScanner(tokenInfo3, node, parentDynamicIndentation, child); + return inheritedIndentation; + } + } + var effectiveParentStartLine = child.kind === 167 ? childStartLine : undecoratedParentStartLine; + var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); + processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); + childContextNode = node; + if (isFirstListItem && parent2.kind === 206 && inheritedIndentation === -1) { + inheritedIndentation = childIndentation.indentation; + } + return inheritedIndentation; + } + function processChildNodes(nodes, parent2, parentStartLine, parentDynamicIndentation) { + ts6.Debug.assert(ts6.isNodeArray(nodes)); + ts6.Debug.assert(!ts6.nodeIsSynthesized(nodes)); + var listStartToken = getOpenTokenForList(parent2, nodes); + var listDynamicIndentation = parentDynamicIndentation; + var startLine2 = parentStartLine; + if (!ts6.rangeOverlapsWithStartEnd(originalRange, nodes.pos, nodes.end)) { + if (nodes.end < originalRange.pos) { + formattingScanner.skipToEndOf(nodes); + } + return; + } + if (listStartToken !== 0) { + while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + var tokenInfo3 = formattingScanner.readTokenInfo(parent2); + if (tokenInfo3.token.end > nodes.pos) { + break; + } else if (tokenInfo3.token.kind === listStartToken) { + startLine2 = sourceFile.getLineAndCharacterOfPosition(tokenInfo3.token.pos).line; + consumeTokenAndAdvanceScanner(tokenInfo3, parent2, parentDynamicIndentation, parent2); + var indentationOnListStartToken = void 0; + if (indentationOnLastIndentedLine !== -1) { + indentationOnListStartToken = indentationOnLastIndentedLine; + } else { + var startLinePosition = ts6.getLineStartPositionForPosition(tokenInfo3.token.pos, sourceFile); + indentationOnListStartToken = formatting2.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, tokenInfo3.token.pos, sourceFile, options); + } + listDynamicIndentation = getDynamicIndentation(parent2, parentStartLine, indentationOnListStartToken, options.indentSize); + } else { + consumeTokenAndAdvanceScanner(tokenInfo3, parent2, parentDynamicIndentation, parent2); + } + } + } + var inheritedIndentation = -1; + for (var i = 0; i < nodes.length; i++) { + var child = nodes[i]; + inheritedIndentation = processChildNode( + child, + inheritedIndentation, + node, + listDynamicIndentation, + startLine2, + startLine2, + /*isListItem*/ + true, + /*isFirstListItem*/ + i === 0 + ); + } + var listEndToken = getCloseTokenForOpenToken(listStartToken); + if (listEndToken !== 0 && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + var tokenInfo3 = formattingScanner.readTokenInfo(parent2); + if (tokenInfo3.token.kind === 27) { + consumeTokenAndAdvanceScanner(tokenInfo3, parent2, listDynamicIndentation, parent2); + tokenInfo3 = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent2) : void 0; + } + if (tokenInfo3 && tokenInfo3.token.kind === listEndToken && ts6.rangeContainsRange(parent2, tokenInfo3.token)) { + consumeTokenAndAdvanceScanner( + tokenInfo3, + parent2, + listDynamicIndentation, + parent2, + /*isListEndToken*/ + true + ); + } + } + } + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent2, dynamicIndentation, container, isListEndToken) { + ts6.Debug.assert(ts6.rangeContainsRange(parent2, currentTokenInfo.token)); + var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + var indentToken = false; + if (currentTokenInfo.leadingTrivia) { + processTrivia(currentTokenInfo.leadingTrivia, parent2, childContextNode, dynamicIndentation); + } + var lineAction = 0; + var isTokenInRange = ts6.rangeContainsRange(originalRange, currentTokenInfo.token); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); + if (isTokenInRange) { + var rangeHasError = rangeContainsError(currentTokenInfo.token); + var savePreviousRange = previousRange; + lineAction = processRange(currentTokenInfo.token, tokenStart, parent2, childContextNode, dynamicIndentation); + if (!rangeHasError) { + if (lineAction === 0) { + var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line; + indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine; + } else { + indentToken = lineAction === 1; + } + } + } + if (currentTokenInfo.trailingTrivia) { + previousRangeTriviaEnd = ts6.last(currentTokenInfo.trailingTrivia).end; + processTrivia(currentTokenInfo.trailingTrivia, parent2, childContextNode, dynamicIndentation); + } + if (indentToken) { + var tokenIndentation = isTokenInRange && !rangeContainsError(currentTokenInfo.token) ? dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : -1; + var indentNextTokenOrTrivia = true; + if (currentTokenInfo.leadingTrivia) { + var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); + indentNextTokenOrTrivia = indentTriviaItems(currentTokenInfo.leadingTrivia, commentIndentation_1, indentNextTokenOrTrivia, function(item) { + return insertIndentation( + item.pos, + commentIndentation_1, + /*lineAdded*/ + false + ); + }); + } + if (tokenIndentation !== -1 && indentNextTokenOrTrivia) { + insertIndentation( + currentTokenInfo.token.pos, + tokenIndentation, + lineAction === 1 + /* LineAction.LineAdded */ + ); + lastIndentedLine = tokenStart.line; + indentationOnLastIndentedLine = tokenIndentation; + } + } + formattingScanner.advance(); + childContextNode = parent2; + } + } + function indentTriviaItems(trivia, commentIndentation, indentNextTokenOrTrivia, indentSingleLine) { + for (var _i = 0, trivia_1 = trivia; _i < trivia_1.length; _i++) { + var triviaItem = trivia_1[_i]; + var triviaInRange = ts6.rangeContainsRange(originalRange, triviaItem); + switch (triviaItem.kind) { + case 3: + if (triviaInRange) { + indentMultilineComment( + triviaItem, + commentIndentation, + /*firstLineIsIndented*/ + !indentNextTokenOrTrivia + ); + } + indentNextTokenOrTrivia = false; + break; + case 2: + if (indentNextTokenOrTrivia && triviaInRange) { + indentSingleLine(triviaItem); + } + indentNextTokenOrTrivia = false; + break; + case 4: + indentNextTokenOrTrivia = true; + break; + } + } + return indentNextTokenOrTrivia; + } + function processTrivia(trivia, parent2, contextNode, dynamicIndentation) { + for (var _i = 0, trivia_2 = trivia; _i < trivia_2.length; _i++) { + var triviaItem = trivia_2[_i]; + if (ts6.isComment(triviaItem.kind) && ts6.rangeContainsRange(originalRange, triviaItem)) { + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); + processRange(triviaItem, triviaItemStart, parent2, contextNode, dynamicIndentation); + } + } + } + function processRange(range2, rangeStart, parent2, contextNode, dynamicIndentation) { + var rangeHasError = rangeContainsError(range2); + var lineAction = 0; + if (!rangeHasError) { + if (!previousRange) { + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); + trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); + } else { + lineAction = processPair(range2, rangeStart.line, parent2, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + } + } + previousRange = range2; + previousRangeTriviaEnd = range2.end; + previousParent = parent2; + previousRangeStartLine = rangeStart.line; + return lineAction; + } + function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent2, contextNode, dynamicIndentation) { + formattingContext.updateContext(previousItem, previousParent2, currentItem, currentParent, contextNode); + var rules = getRules(formattingContext); + var trimTrailingWhitespaces = formattingContext.options.trimTrailingWhitespace !== false; + var lineAction = 0; + if (rules) { + ts6.forEachRight(rules, function(rule) { + lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); + if (dynamicIndentation) { + switch (lineAction) { + case 2: + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation( + /*lineAddedByFormatting*/ + false, + contextNode + ); + } + break; + case 1: + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation( + /*lineAddedByFormatting*/ + true, + contextNode + ); + } + break; + default: + ts6.Debug.assert( + lineAction === 0 + /* LineAction.None */ + ); + } + } + trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & 16) && rule.flags !== 1; + }); + } else { + trimTrailingWhitespaces = trimTrailingWhitespaces && currentItem.kind !== 1; + } + if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) { + trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem); + } + return lineAction; + } + function insertIndentation(pos, indentation2, lineAdded) { + var indentationString = getIndentationString(indentation2, options); + if (lineAdded) { + recordReplace(pos, 0, indentationString); + } else { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + var startLinePosition = ts6.getStartPositionOfLine(tokenStart.line, sourceFile); + if (indentation2 !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) { + recordReplace(startLinePosition, tokenStart.character, indentationString); + } + } + } + function characterToColumn(startLinePosition, characterInLine) { + var column = 0; + for (var i = 0; i < characterInLine; i++) { + if (sourceFile.text.charCodeAt(startLinePosition + i) === 9) { + column += options.tabSize - column % options.tabSize; + } else { + column++; + } + } + return column; + } + function indentationIsDifferent(indentationString, startLinePosition) { + return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); + } + function indentMultilineComment(commentRange, indentation2, firstLineIsIndented, indentFinalLine) { + if (indentFinalLine === void 0) { + indentFinalLine = true; + } + var startLine2 = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; + if (startLine2 === endLine) { + if (!firstLineIsIndented) { + insertIndentation( + commentRange.pos, + indentation2, + /*lineAdded*/ + false + ); + } + return; + } + var parts = []; + var startPos = commentRange.pos; + for (var line = startLine2; line < endLine; line++) { + var endOfLine = ts6.getEndLinePosition(line, sourceFile); + parts.push({ pos: startPos, end: endOfLine }); + startPos = ts6.getStartPositionOfLine(line + 1, sourceFile); + } + if (indentFinalLine) { + parts.push({ pos: startPos, end: commentRange.end }); + } + if (parts.length === 0) + return; + var startLinePos = ts6.getStartPositionOfLine(startLine2, sourceFile); + var nonWhitespaceColumnInFirstPart = formatting2.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); + var startIndex = 0; + if (firstLineIsIndented) { + startIndex = 1; + startLine2++; + } + var delta2 = indentation2 - nonWhitespaceColumnInFirstPart.column; + for (var i = startIndex; i < parts.length; i++, startLine2++) { + var startLinePos_1 = ts6.getStartPositionOfLine(startLine2, sourceFile); + var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting2.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var newIndentation = nonWhitespaceCharacterAndColumn.column + delta2; + if (newIndentation > 0) { + var indentationString = getIndentationString(newIndentation, options); + recordReplace(startLinePos_1, nonWhitespaceCharacterAndColumn.character, indentationString); + } else { + recordDelete(startLinePos_1, nonWhitespaceCharacterAndColumn.character); + } + } + } + function trimTrailingWhitespacesForLines(line1, line2, range2) { + for (var line = line1; line < line2; line++) { + var lineStartPosition = ts6.getStartPositionOfLine(line, sourceFile); + var lineEndPosition = ts6.getEndLinePosition(line, sourceFile); + if (range2 && (ts6.isComment(range2.kind) || ts6.isStringOrRegularExpressionOrTemplateLiteral(range2.kind)) && range2.pos <= lineEndPosition && range2.end > lineEndPosition) { + continue; + } + var whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition); + if (whitespaceStart !== -1) { + ts6.Debug.assert(whitespaceStart === lineStartPosition || !ts6.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1))); + recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart); + } + } + } + function getTrailingWhitespaceStartPosition(start, end) { + var pos = end; + while (pos >= start && ts6.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== end) { + return pos + 1; + } + return -1; + } + function trimTrailingWhitespacesForRemainingRange(trivias) { + var startPos = previousRange ? previousRange.end : originalRange.pos; + for (var _i = 0, trivias_1 = trivias; _i < trivias_1.length; _i++) { + var trivia = trivias_1[_i]; + if (ts6.isComment(trivia.kind)) { + if (startPos < trivia.pos) { + trimTrailingWitespacesForPositions(startPos, trivia.pos - 1, previousRange); + } + startPos = trivia.end + 1; + } + } + if (startPos < originalRange.end) { + trimTrailingWitespacesForPositions(startPos, originalRange.end, previousRange); + } + } + function trimTrailingWitespacesForPositions(startPos, endPos, previousRange2) { + var startLine2 = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(endPos).line; + trimTrailingWhitespacesForLines(startLine2, endLine + 1, previousRange2); + } + function recordDelete(start, len) { + if (len) { + edits.push(ts6.createTextChangeFromStartLength(start, len, "")); + } + } + function recordReplace(start, len, newText) { + if (len || newText) { + edits.push(ts6.createTextChangeFromStartLength(start, len, newText)); + } + } + function recordInsert(start, text) { + if (text) { + edits.push(ts6.createTextChangeFromStartLength(start, 0, text)); + } + } + function applyRuleEdits(rule, previousRange2, previousStartLine, currentRange, currentStartLine) { + var onLaterLine = currentStartLine !== previousStartLine; + switch (rule.action) { + case 1: + return 0; + case 16: + if (previousRange2.end !== currentRange.pos) { + recordDelete(previousRange2.end, currentRange.pos - previousRange2.end); + return onLaterLine ? 2 : 0; + } + break; + case 32: + recordDelete(previousRange2.pos, previousRange2.end - previousRange2.pos); + break; + case 8: + if (rule.flags !== 1 && previousStartLine !== currentStartLine) { + return 0; + } + var lineDelta = currentStartLine - previousStartLine; + if (lineDelta !== 1) { + recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, ts6.getNewLineOrDefaultFromHost(host, options)); + return onLaterLine ? 0 : 1; + } + break; + case 4: + if (rule.flags !== 1 && previousStartLine !== currentStartLine) { + return 0; + } + var posDelta = currentRange.pos - previousRange2.end; + if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange2.end) !== 32) { + recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, " "); + return onLaterLine ? 2 : 0; + } + break; + case 64: + recordInsert(previousRange2.end, ";"); + } + return 0; + } + } + var LineAction; + (function(LineAction2) { + LineAction2[LineAction2["None"] = 0] = "None"; + LineAction2[LineAction2["LineAdded"] = 1] = "LineAdded"; + LineAction2[LineAction2["LineRemoved"] = 2] = "LineRemoved"; + })(LineAction || (LineAction = {})); + function getRangeOfEnclosingComment(sourceFile, position, precedingToken, tokenAtPosition) { + if (tokenAtPosition === void 0) { + tokenAtPosition = ts6.getTokenAtPosition(sourceFile, position); + } + var jsdoc = ts6.findAncestor(tokenAtPosition, ts6.isJSDoc); + if (jsdoc) + tokenAtPosition = jsdoc.parent; + var tokenStart = tokenAtPosition.getStart(sourceFile); + if (tokenStart <= position && position < tokenAtPosition.getEnd()) { + return void 0; + } + precedingToken = precedingToken === null ? void 0 : precedingToken === void 0 ? ts6.findPrecedingToken(position, sourceFile) : precedingToken; + var trailingRangesOfPreviousToken = precedingToken && ts6.getTrailingCommentRanges(sourceFile.text, precedingToken.end); + var leadingCommentRangesOfNextToken = ts6.getLeadingCommentRangesOfNode(tokenAtPosition, sourceFile); + var commentRanges = ts6.concatenate(trailingRangesOfPreviousToken, leadingCommentRangesOfNextToken); + return commentRanges && ts6.find(commentRanges, function(range2) { + return ts6.rangeContainsPositionExclusive(range2, position) || // The end marker of a single-line comment does not include the newline character. + // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position): + // + // // asdf ^\n + // + // But for closed multi-line comments, we don't want to be inside the comment in the following case: + // + // /* asdf */^ + // + // However, unterminated multi-line comments *do* contain their end. + // + // Internally, we represent the end of the comment at the newline and closing '/', respectively. + // + position === range2.end && (range2.kind === 2 || position === sourceFile.getFullWidth()); + }); + } + formatting2.getRangeOfEnclosingComment = getRangeOfEnclosingComment; + function getOpenTokenForList(node, list) { + switch (node.kind) { + case 173: + case 259: + case 215: + case 171: + case 170: + case 216: + case 176: + case 177: + case 181: + case 182: + case 174: + case 175: + if (node.typeParameters === list) { + return 29; + } else if (node.parameters === list) { + return 20; + } + break; + case 210: + case 211: + if (node.typeArguments === list) { + return 29; + } else if (node.arguments === list) { + return 20; + } + break; + case 260: + case 228: + case 261: + case 262: + if (node.typeParameters === list) { + return 29; + } + break; + case 180: + case 212: + case 183: + case 230: + case 202: + if (node.typeArguments === list) { + return 29; + } + break; + case 184: + return 18; + } + return 0; + } + function getCloseTokenForOpenToken(kind) { + switch (kind) { + case 20: + return 21; + case 29: + return 31; + case 18: + return 19; + } + return 0; + } + var internedSizes; + var internedTabsIndentation; + var internedSpacesIndentation; + function getIndentationString(indentation, options) { + var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize); + if (resetInternedStrings) { + internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize }; + internedTabsIndentation = internedSpacesIndentation = void 0; + } + if (!options.convertTabsToSpaces) { + var tabs = Math.floor(indentation / options.tabSize); + var spaces = indentation - tabs * options.tabSize; + var tabString = void 0; + if (!internedTabsIndentation) { + internedTabsIndentation = []; + } + if (internedTabsIndentation[tabs] === void 0) { + internedTabsIndentation[tabs] = tabString = ts6.repeatString(" ", tabs); + } else { + tabString = internedTabsIndentation[tabs]; + } + return spaces ? tabString + ts6.repeatString(" ", spaces) : tabString; + } else { + var spacesString = void 0; + var quotient = Math.floor(indentation / options.indentSize); + var remainder = indentation % options.indentSize; + if (!internedSpacesIndentation) { + internedSpacesIndentation = []; + } + if (internedSpacesIndentation[quotient] === void 0) { + spacesString = ts6.repeatString(" ", options.indentSize * quotient); + internedSpacesIndentation[quotient] = spacesString; + } else { + spacesString = internedSpacesIndentation[quotient]; + } + return remainder ? spacesString + ts6.repeatString(" ", remainder) : spacesString; + } + } + formatting2.getIndentationString = getIndentationString; + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var formatting; + (function(formatting2) { + var SmartIndenter; + (function(SmartIndenter2) { + var Value3; + (function(Value4) { + Value4[Value4["Unknown"] = -1] = "Unknown"; + })(Value3 || (Value3 = {})); + function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { + if (assumeNewLineBeforeCloseBrace === void 0) { + assumeNewLineBeforeCloseBrace = false; + } + if (position > sourceFile.text.length) { + return getBaseIndentation(options); + } + if (options.indentStyle === ts6.IndentStyle.None) { + return 0; + } + var precedingToken = ts6.findPrecedingToken( + position, + sourceFile, + /*startNode*/ + void 0, + /*excludeJsdoc*/ + true + ); + var enclosingCommentRange = formatting2.getRangeOfEnclosingComment(sourceFile, position, precedingToken || null); + if (enclosingCommentRange && enclosingCommentRange.kind === 3) { + return getCommentIndent(sourceFile, position, options, enclosingCommentRange); + } + if (!precedingToken) { + return getBaseIndentation(options); + } + var precedingTokenIsLiteral = ts6.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); + if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && position < precedingToken.end) { + return 0; + } + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + var currentToken = ts6.getTokenAtPosition(sourceFile, position); + var isObjectLiteral = currentToken.kind === 18 && currentToken.parent.kind === 207; + if (options.indentStyle === ts6.IndentStyle.Block || isObjectLiteral) { + return getBlockIndent(sourceFile, position, options); + } + if (precedingToken.kind === 27 && precedingToken.parent.kind !== 223) { + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + var containerList = getListByPosition(position, precedingToken.parent, sourceFile); + if (containerList && !ts6.rangeContainsRange(containerList, precedingToken)) { + var useTheSameBaseIndentation = [ + 215, + 216 + /* SyntaxKind.ArrowFunction */ + ].indexOf(currentToken.parent.kind) !== -1; + var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; + return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; + } + return getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options); + } + SmartIndenter2.getIndentation = getIndentation; + function getCommentIndent(sourceFile, position, options, enclosingCommentRange) { + var previousLine = ts6.getLineAndCharacterOfPosition(sourceFile, position).line - 1; + var commentStartLine = ts6.getLineAndCharacterOfPosition(sourceFile, enclosingCommentRange.pos).line; + ts6.Debug.assert(commentStartLine >= 0); + if (previousLine <= commentStartLine) { + return findFirstNonWhitespaceColumn(ts6.getStartPositionOfLine(commentStartLine, sourceFile), position, sourceFile, options); + } + var startPositionOfLine = ts6.getStartPositionOfLine(previousLine, sourceFile); + var _a = findFirstNonWhitespaceCharacterAndColumn(startPositionOfLine, position, sourceFile, options), column = _a.column, character = _a.character; + if (column === 0) { + return column; + } + var firstNonWhitespaceCharacterCode = sourceFile.text.charCodeAt(startPositionOfLine + character); + return firstNonWhitespaceCharacterCode === 42 ? column - 1 : column; + } + function getBlockIndent(sourceFile, position, options) { + var current = position; + while (current > 0) { + var char = sourceFile.text.charCodeAt(current); + if (!ts6.isWhiteSpaceLike(char)) { + break; + } + current--; + } + var lineStart = ts6.getLineStartPositionForPosition(current, sourceFile); + return findFirstNonWhitespaceColumn(lineStart, current, sourceFile, options); + } + function getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options) { + var previous; + var current = precedingToken; + while (current) { + if (ts6.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode( + options, + current, + previous, + sourceFile, + /*isNextChild*/ + true + )) { + var currentStart = getStartLineAndCharacterForNode(current, sourceFile); + var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); + var indentationDelta = nextTokenKind !== 0 ? assumeNewLineBeforeCloseBrace && nextTokenKind === 2 ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0; + return getIndentationForNodeWorker( + current, + currentStart, + /*ignoreActualIndentationRange*/ + void 0, + indentationDelta, + sourceFile, + /*isNextChild*/ + true, + options + ); + } + var actualIndentation = getActualIndentationForListItem( + current, + sourceFile, + options, + /*listIndentsChild*/ + true + ); + if (actualIndentation !== -1) { + return actualIndentation; + } + previous = current; + current = current.parent; + } + return getBaseIndentation(options); + } + function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + return getIndentationForNodeWorker( + n, + start, + ignoreActualIndentationRange, + /*indentationDelta*/ + 0, + sourceFile, + /*isNextChild*/ + false, + options + ); + } + SmartIndenter2.getIndentationForNode = getIndentationForNode; + function getBaseIndentation(options) { + return options.baseIndentSize || 0; + } + SmartIndenter2.getBaseIndentation = getBaseIndentation; + function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, isNextChild, options) { + var _a; + var parent = current.parent; + while (parent) { + var useActualIndentation = true; + if (ignoreActualIndentationRange) { + var start = current.getStart(sourceFile); + useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; + } + var containingListOrParentStart = getContainingListOrParentStart(parent, current, sourceFile); + var parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + if (useActualIndentation) { + var firstListChild = (_a = getContainingList(current, sourceFile)) === null || _a === void 0 ? void 0 : _a[0]; + var listIndentsChild = !!firstListChild && getStartLineAndCharacterForNode(firstListChild, sourceFile).line > containingListOrParentStart.line; + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options, listIndentsChild); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + if (shouldIndentChildNode(options, parent, current, sourceFile, isNextChild) && !parentAndChildShareLine) { + indentationDelta += options.indentSize; + } + var useTrueStart = isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, current, currentStart.line, sourceFile); + current = parent; + parent = current.parent; + currentStart = useTrueStart ? sourceFile.getLineAndCharacterOfPosition(current.getStart(sourceFile)) : containingListOrParentStart; + } + return indentationDelta + getBaseIndentation(options); + } + function getContainingListOrParentStart(parent, child, sourceFile) { + var containingList = getContainingList(child, sourceFile); + var startPos = containingList ? containingList.pos : parent.getStart(sourceFile); + return sourceFile.getLineAndCharacterOfPosition(startPos); + } + function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { + var commaItemInfo = ts6.findListItemInfo(commaToken); + if (commaItemInfo && commaItemInfo.listItemIndex > 0) { + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } else { + return -1; + } + } + function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { + var useActualIndentation = (ts6.isDeclaration(current) || ts6.isStatementButNotDeclaration(current)) && (parent.kind === 308 || !parentAndChildShareLine); + if (!useActualIndentation) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + var NextTokenKind; + (function(NextTokenKind2) { + NextTokenKind2[NextTokenKind2["Unknown"] = 0] = "Unknown"; + NextTokenKind2[NextTokenKind2["OpenBrace"] = 1] = "OpenBrace"; + NextTokenKind2[NextTokenKind2["CloseBrace"] = 2] = "CloseBrace"; + })(NextTokenKind || (NextTokenKind = {})); + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { + var nextToken = ts6.findNextToken(precedingToken, current, sourceFile); + if (!nextToken) { + return 0; + } + if (nextToken.kind === 18) { + return 1; + } else if (nextToken.kind === 19) { + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine ? 2 : 0; + } + return 0; + } + function getStartLineAndCharacterForNode(n, sourceFile) { + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + } + function isArgumentAndStartLineOverlapsExpressionBeingCalled(parent, child, childStartLine, sourceFile) { + if (!(ts6.isCallExpression(parent) && ts6.contains(parent.arguments, child))) { + return false; + } + var expressionOfCallExpressionEnd = parent.expression.getEnd(); + var expressionOfCallExpressionEndLine = ts6.getLineAndCharacterOfPosition(sourceFile, expressionOfCallExpressionEnd).line; + return expressionOfCallExpressionEndLine === childStartLine; + } + SmartIndenter2.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; + function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { + if (parent.kind === 242 && parent.elseStatement === child) { + var elseKeyword = ts6.findChildOfKind(parent, 91, sourceFile); + ts6.Debug.assert(elseKeyword !== void 0); + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + return false; + } + SmartIndenter2.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function childIsUnindentedBranchOfConditionalExpression(parent, child, childStartLine, sourceFile) { + if (ts6.isConditionalExpression(parent) && (child === parent.whenTrue || child === parent.whenFalse)) { + var conditionEndLine = ts6.getLineAndCharacterOfPosition(sourceFile, parent.condition.end).line; + if (child === parent.whenTrue) { + return childStartLine === conditionEndLine; + } else { + var trueStartLine = getStartLineAndCharacterForNode(parent.whenTrue, sourceFile).line; + var trueEndLine = ts6.getLineAndCharacterOfPosition(sourceFile, parent.whenTrue.end).line; + return conditionEndLine === trueStartLine && trueEndLine === childStartLine; + } + } + return false; + } + SmartIndenter2.childIsUnindentedBranchOfConditionalExpression = childIsUnindentedBranchOfConditionalExpression; + function argumentStartsOnSameLineAsPreviousArgument(parent, child, childStartLine, sourceFile) { + if (ts6.isCallOrNewExpression(parent)) { + if (!parent.arguments) + return false; + var currentNode = ts6.find(parent.arguments, function(arg) { + return arg.pos === child.pos; + }); + if (!currentNode) + return false; + var currentIndex = parent.arguments.indexOf(currentNode); + if (currentIndex === 0) + return false; + var previousNode = parent.arguments[currentIndex - 1]; + var lineOfPreviousNode = ts6.getLineAndCharacterOfPosition(sourceFile, previousNode.getEnd()).line; + if (childStartLine === lineOfPreviousNode) { + return true; + } + } + return false; + } + SmartIndenter2.argumentStartsOnSameLineAsPreviousArgument = argumentStartsOnSameLineAsPreviousArgument; + function getContainingList(node, sourceFile) { + return node.parent && getListByRange(node.getStart(sourceFile), node.getEnd(), node.parent, sourceFile); + } + SmartIndenter2.getContainingList = getContainingList; + function getListByPosition(pos, node, sourceFile) { + return node && getListByRange(pos, pos, node, sourceFile); + } + function getListByRange(start, end, node, sourceFile) { + switch (node.kind) { + case 180: + return getList(node.typeArguments); + case 207: + return getList(node.properties); + case 206: + return getList(node.elements); + case 184: + return getList(node.members); + case 259: + case 215: + case 216: + case 171: + case 170: + case 176: + case 173: + case 182: + case 177: + return getList(node.typeParameters) || getList(node.parameters); + case 174: + return getList(node.parameters); + case 260: + case 228: + case 261: + case 262: + case 347: + return getList(node.typeParameters); + case 211: + case 210: + return getList(node.typeArguments) || getList(node.arguments); + case 258: + return getList(node.declarations); + case 272: + case 276: + return getList(node.elements); + case 203: + case 204: + return getList(node.elements); + } + function getList(list) { + return list && ts6.rangeContainsStartEnd(getVisualListRange(node, list, sourceFile), start, end) ? list : void 0; + } + } + function getVisualListRange(node, list, sourceFile) { + var children = node.getChildren(sourceFile); + for (var i = 1; i < children.length - 1; i++) { + if (children[i].pos === list.pos && children[i].end === list.end) { + return { pos: children[i - 1].end, end: children[i + 1].getStart(sourceFile) }; + } + } + return list; + } + function getActualIndentationForListStartLine(list, sourceFile, options) { + if (!list) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); + } + function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { + if (node.parent && node.parent.kind === 258) { + return -1; + } + var containingList = getContainingList(node, sourceFile); + if (containingList) { + var index = containingList.indexOf(node); + if (index !== -1) { + var result = deriveActualIndentationFromList(containingList, index, sourceFile, options); + if (result !== -1) { + return result; + } + } + return getActualIndentationForListStartLine(containingList, sourceFile, options) + (listIndentsChild ? options.indentSize : 0); + } + return -1; + } + function deriveActualIndentationFromList(list, index, sourceFile, options) { + ts6.Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; i--) { + if (list[i].kind === 27) { + continue; + } + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); + return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); + } + function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) { + var character = 0; + var column = 0; + for (var pos = startPos; pos < endPos; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts6.isWhiteSpaceSingleLine(ch)) { + break; + } + if (ch === 9) { + column += options.tabSize + column % options.tabSize; + } else { + column++; + } + character++; + } + return { column, character }; + } + SmartIndenter2.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { + return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column; + } + SmartIndenter2.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { + var childKind = child ? child.kind : 0; + switch (parent.kind) { + case 241: + case 260: + case 228: + case 261: + case 263: + case 262: + case 206: + case 238: + case 265: + case 207: + case 184: + case 197: + case 186: + case 266: + case 293: + case 292: + case 214: + case 208: + case 210: + case 211: + case 240: + case 274: + case 250: + case 224: + case 204: + case 203: + case 283: + case 286: + case 282: + case 291: + case 170: + case 176: + case 177: + case 166: + case 181: + case 182: + case 193: + case 212: + case 220: + case 276: + case 272: + case 278: + case 273: + case 169: + return true; + case 257: + case 299: + case 223: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207) { + return rangeIsOnOneLine(sourceFile, child); + } + if (parent.kind === 223 && sourceFile && child && childKind === 281) { + var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts6.skipTrivia(sourceFile.text, parent.pos)).line; + var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts6.skipTrivia(sourceFile.text, child.pos)).line; + return parentStartLine !== childStartLine; + } + if (parent.kind !== 223) { + return true; + } + break; + case 243: + case 244: + case 246: + case 247: + case 245: + case 242: + case 259: + case 215: + case 171: + case 173: + case 174: + case 175: + return childKind !== 238; + case 216: + if (sourceFile && childKind === 214) { + return rangeIsOnOneLine(sourceFile, child); + } + return childKind !== 238; + case 275: + return childKind !== 276; + case 269: + return childKind !== 270 || !!child.namedBindings && child.namedBindings.kind !== 272; + case 281: + return childKind !== 284; + case 285: + return childKind !== 287; + case 190: + case 189: + if (childKind === 184 || childKind === 186) { + return false; + } + break; + } + return indentByDefault; + } + SmartIndenter2.nodeWillIndentChild = nodeWillIndentChild; + function isControlFlowEndingStatement(kind, parent) { + switch (kind) { + case 250: + case 254: + case 248: + case 249: + return parent.kind !== 238; + default: + return false; + } + } + function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { + if (isNextChild === void 0) { + isNextChild = false; + } + return nodeWillIndentChild( + settings, + parent, + child, + sourceFile, + /*indentByDefault*/ + false + ) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); + } + SmartIndenter2.shouldIndentChildNode = shouldIndentChildNode; + function rangeIsOnOneLine(sourceFile, range2) { + var rangeStart = ts6.skipTrivia(sourceFile.text, range2.pos); + var startLine = sourceFile.getLineAndCharacterOfPosition(rangeStart).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(range2.end).line; + return startLine === endLine; + } + })(SmartIndenter = formatting2.SmartIndenter || (formatting2.SmartIndenter = {})); + })(formatting = ts6.formatting || (ts6.formatting = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var textChanges; + (function(textChanges_3) { + function getPos(n) { + var result = n.__pos; + ts6.Debug.assert(typeof result === "number"); + return result; + } + function setPos(n, pos) { + ts6.Debug.assert(typeof pos === "number"); + n.__pos = pos; + } + function getEnd(n) { + var result = n.__end; + ts6.Debug.assert(typeof result === "number"); + return result; + } + function setEnd(n, end) { + ts6.Debug.assert(typeof end === "number"); + n.__end = end; + } + var LeadingTriviaOption; + (function(LeadingTriviaOption2) { + LeadingTriviaOption2[LeadingTriviaOption2["Exclude"] = 0] = "Exclude"; + LeadingTriviaOption2[LeadingTriviaOption2["IncludeAll"] = 1] = "IncludeAll"; + LeadingTriviaOption2[LeadingTriviaOption2["JSDoc"] = 2] = "JSDoc"; + LeadingTriviaOption2[LeadingTriviaOption2["StartLine"] = 3] = "StartLine"; + })(LeadingTriviaOption = textChanges_3.LeadingTriviaOption || (textChanges_3.LeadingTriviaOption = {})); + var TrailingTriviaOption; + (function(TrailingTriviaOption2) { + TrailingTriviaOption2[TrailingTriviaOption2["Exclude"] = 0] = "Exclude"; + TrailingTriviaOption2[TrailingTriviaOption2["ExcludeWhitespace"] = 1] = "ExcludeWhitespace"; + TrailingTriviaOption2[TrailingTriviaOption2["Include"] = 2] = "Include"; + })(TrailingTriviaOption = textChanges_3.TrailingTriviaOption || (textChanges_3.TrailingTriviaOption = {})); + function skipWhitespacesAndLineBreaks(text, start) { + return ts6.skipTrivia( + text, + start, + /*stopAfterLineBreak*/ + false, + /*stopAtComments*/ + true + ); + } + function hasCommentsBeforeLineBreak(text, start) { + var i = start; + while (i < text.length) { + var ch = text.charCodeAt(i); + if (ts6.isWhiteSpaceSingleLine(ch)) { + i++; + continue; + } + return ch === 47; + } + return false; + } + var useNonAdjustedPositions = { + leadingTriviaOption: LeadingTriviaOption.Exclude, + trailingTriviaOption: TrailingTriviaOption.Exclude + }; + var ChangeKind; + (function(ChangeKind2) { + ChangeKind2[ChangeKind2["Remove"] = 0] = "Remove"; + ChangeKind2[ChangeKind2["ReplaceWithSingleNode"] = 1] = "ReplaceWithSingleNode"; + ChangeKind2[ChangeKind2["ReplaceWithMultipleNodes"] = 2] = "ReplaceWithMultipleNodes"; + ChangeKind2[ChangeKind2["Text"] = 3] = "Text"; + })(ChangeKind || (ChangeKind = {})); + function getAdjustedRange(sourceFile, startNode, endNode, options) { + return { pos: getAdjustedStartPosition(sourceFile, startNode, options), end: getAdjustedEndPosition(sourceFile, endNode, options) }; + } + function getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment) { + var _a, _b; + if (hasTrailingComment === void 0) { + hasTrailingComment = false; + } + var leadingTriviaOption = options.leadingTriviaOption; + if (leadingTriviaOption === LeadingTriviaOption.Exclude) { + return node.getStart(sourceFile); + } + if (leadingTriviaOption === LeadingTriviaOption.StartLine) { + var startPos = node.getStart(sourceFile); + var pos = ts6.getLineStartPositionForPosition(startPos, sourceFile); + return ts6.rangeContainsPosition(node, pos) ? pos : startPos; + } + if (leadingTriviaOption === LeadingTriviaOption.JSDoc) { + var JSDocComments = ts6.getJSDocCommentRanges(node, sourceFile.text); + if (JSDocComments === null || JSDocComments === void 0 ? void 0 : JSDocComments.length) { + return ts6.getLineStartPositionForPosition(JSDocComments[0].pos, sourceFile); + } + } + var fullStart = node.getFullStart(); + var start = node.getStart(sourceFile); + if (fullStart === start) { + return start; + } + var fullStartLine = ts6.getLineStartPositionForPosition(fullStart, sourceFile); + var startLine = ts6.getLineStartPositionForPosition(start, sourceFile); + if (startLine === fullStartLine) { + return leadingTriviaOption === LeadingTriviaOption.IncludeAll ? fullStart : start; + } + if (hasTrailingComment) { + var comment = ((_a = ts6.getLeadingCommentRanges(sourceFile.text, fullStart)) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = ts6.getTrailingCommentRanges(sourceFile.text, fullStart)) === null || _b === void 0 ? void 0 : _b[0]); + if (comment) { + return ts6.skipTrivia( + sourceFile.text, + comment.end, + /*stopAfterLineBreak*/ + true, + /*stopAtComments*/ + true + ); + } + } + var nextLineStart = fullStart > 0 ? 1 : 0; + var adjustedStartPosition = ts6.getStartPositionOfLine(ts6.getLineOfLocalPosition(sourceFile, fullStartLine) + nextLineStart, sourceFile); + adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition); + return ts6.getStartPositionOfLine(ts6.getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile); + } + function getEndPositionOfMultilineTrailingComment(sourceFile, node, options) { + var end = node.end; + var trailingTriviaOption = options.trailingTriviaOption; + if (trailingTriviaOption === TrailingTriviaOption.Include) { + var comments = ts6.getTrailingCommentRanges(sourceFile.text, end); + if (comments) { + var nodeEndLine = ts6.getLineOfLocalPosition(sourceFile, node.end); + for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { + var comment = comments_2[_i]; + if (comment.kind === 2 || ts6.getLineOfLocalPosition(sourceFile, comment.pos) > nodeEndLine) { + break; + } + var commentEndLine = ts6.getLineOfLocalPosition(sourceFile, comment.end); + if (commentEndLine > nodeEndLine) { + return ts6.skipTrivia( + sourceFile.text, + comment.end, + /*stopAfterLineBreak*/ + true, + /*stopAtComments*/ + true + ); + } + } + } + } + return void 0; + } + function getAdjustedEndPosition(sourceFile, node, options) { + var _a; + var end = node.end; + var trailingTriviaOption = options.trailingTriviaOption; + if (trailingTriviaOption === TrailingTriviaOption.Exclude) { + return end; + } + if (trailingTriviaOption === TrailingTriviaOption.ExcludeWhitespace) { + var comments = ts6.concatenate(ts6.getTrailingCommentRanges(sourceFile.text, end), ts6.getLeadingCommentRanges(sourceFile.text, end)); + var realEnd = (_a = comments === null || comments === void 0 ? void 0 : comments[comments.length - 1]) === null || _a === void 0 ? void 0 : _a.end; + if (realEnd) { + return realEnd; + } + return end; + } + var multilineEndPosition = getEndPositionOfMultilineTrailingComment(sourceFile, node, options); + if (multilineEndPosition) { + return multilineEndPosition; + } + var newEnd = ts6.skipTrivia( + sourceFile.text, + end, + /*stopAfterLineBreak*/ + true + ); + return newEnd !== end && (trailingTriviaOption === TrailingTriviaOption.Include || ts6.isLineBreak(sourceFile.text.charCodeAt(newEnd - 1))) ? newEnd : end; + } + function isSeparator(node, candidate) { + return !!candidate && !!node.parent && (candidate.kind === 27 || candidate.kind === 26 && node.parent.kind === 207); + } + function isThisTypeAnnotatable(containingFunction) { + return ts6.isFunctionExpression(containingFunction) || ts6.isFunctionDeclaration(containingFunction); + } + textChanges_3.isThisTypeAnnotatable = isThisTypeAnnotatable; + var ChangeTracker = ( + /** @class */ + function() { + function ChangeTracker2(newLineCharacter, formatContext) { + this.newLineCharacter = newLineCharacter; + this.formatContext = formatContext; + this.changes = []; + this.newFiles = []; + this.classesWithNodesInsertedAtStart = new ts6.Map(); + this.deletedNodes = []; + } + ChangeTracker2.fromContext = function(context) { + return new ChangeTracker2(ts6.getNewLineOrDefaultFromHost(context.host, context.formatContext.options), context.formatContext); + }; + ChangeTracker2.with = function(context, cb) { + var tracker = ChangeTracker2.fromContext(context); + cb(tracker); + return tracker.getChanges(); + }; + ChangeTracker2.prototype.pushRaw = function(sourceFile, change) { + ts6.Debug.assertEqual(sourceFile.fileName, change.fileName); + for (var _i = 0, _a = change.textChanges; _i < _a.length; _i++) { + var c = _a[_i]; + this.changes.push({ + kind: ChangeKind.Text, + sourceFile, + text: c.newText, + range: ts6.createTextRangeFromSpan(c.span) + }); + } + }; + ChangeTracker2.prototype.deleteRange = function(sourceFile, range2) { + this.changes.push({ kind: ChangeKind.Remove, sourceFile, range: range2 }); + }; + ChangeTracker2.prototype.delete = function(sourceFile, node) { + this.deletedNodes.push({ sourceFile, node }); + }; + ChangeTracker2.prototype.deleteNode = function(sourceFile, node, options) { + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } + this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options)); + }; + ChangeTracker2.prototype.deleteNodes = function(sourceFile, nodes, options, hasTrailingComment) { + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var node = nodes_1[_i]; + var pos = getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment); + var end = getAdjustedEndPosition(sourceFile, node, options); + this.deleteRange(sourceFile, { pos, end }); + hasTrailingComment = !!getEndPositionOfMultilineTrailingComment(sourceFile, node, options); + } + }; + ChangeTracker2.prototype.deleteModifier = function(sourceFile, modifier) { + this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts6.skipTrivia( + sourceFile.text, + modifier.end, + /*stopAfterLineBreak*/ + true + ) }); + }; + ChangeTracker2.prototype.deleteNodeRange = function(sourceFile, startNode, endNode, options) { + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + }; + ChangeTracker2.prototype.deleteNodeRangeExcludingEnd = function(sourceFile, startNode, afterEndNode, options) { + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options); + var endPosition = afterEndNode === void 0 ? sourceFile.text.length : getAdjustedStartPosition(sourceFile, afterEndNode, options); + this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + }; + ChangeTracker2.prototype.replaceRange = function(sourceFile, range2, newNode, options) { + if (options === void 0) { + options = {}; + } + this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile, range: range2, options, node: newNode }); + }; + ChangeTracker2.prototype.replaceNode = function(sourceFile, oldNode, newNode, options) { + if (options === void 0) { + options = useNonAdjustedPositions; + } + this.replaceRange(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNode, options); + }; + ChangeTracker2.prototype.replaceNodeRange = function(sourceFile, startNode, endNode, newNode, options) { + if (options === void 0) { + options = useNonAdjustedPositions; + } + this.replaceRange(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNode, options); + }; + ChangeTracker2.prototype.replaceRangeWithNodes = function(sourceFile, range2, newNodes, options) { + if (options === void 0) { + options = {}; + } + this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile, range: range2, options, nodes: newNodes }); + }; + ChangeTracker2.prototype.replaceNodeWithNodes = function(sourceFile, oldNode, newNodes, options) { + if (options === void 0) { + options = useNonAdjustedPositions; + } + this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNodes, options); + }; + ChangeTracker2.prototype.replaceNodeWithText = function(sourceFile, oldNode, text) { + this.replaceRangeWithText(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, useNonAdjustedPositions), text); + }; + ChangeTracker2.prototype.replaceNodeRangeWithNodes = function(sourceFile, startNode, endNode, newNodes, options) { + if (options === void 0) { + options = useNonAdjustedPositions; + } + this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options); + }; + ChangeTracker2.prototype.nodeHasTrailingComment = function(sourceFile, oldNode, configurableEnd) { + if (configurableEnd === void 0) { + configurableEnd = useNonAdjustedPositions; + } + return !!getEndPositionOfMultilineTrailingComment(sourceFile, oldNode, configurableEnd); + }; + ChangeTracker2.prototype.nextCommaToken = function(sourceFile, node) { + var next = ts6.findNextToken(node, node.parent, sourceFile); + return next && next.kind === 27 ? next : void 0; + }; + ChangeTracker2.prototype.replacePropertyAssignment = function(sourceFile, oldNode, newNode) { + var suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : "," + this.newLineCharacter; + this.replaceNode(sourceFile, oldNode, newNode, { suffix }); + }; + ChangeTracker2.prototype.insertNodeAt = function(sourceFile, pos, newNode, options) { + if (options === void 0) { + options = {}; + } + this.replaceRange(sourceFile, ts6.createRange(pos), newNode, options); + }; + ChangeTracker2.prototype.insertNodesAt = function(sourceFile, pos, newNodes, options) { + if (options === void 0) { + options = {}; + } + this.replaceRangeWithNodes(sourceFile, ts6.createRange(pos), newNodes, options); + }; + ChangeTracker2.prototype.insertNodeAtTopOfFile = function(sourceFile, newNode, blankLineBetween) { + this.insertAtTopOfFile(sourceFile, newNode, blankLineBetween); + }; + ChangeTracker2.prototype.insertNodesAtTopOfFile = function(sourceFile, newNodes, blankLineBetween) { + this.insertAtTopOfFile(sourceFile, newNodes, blankLineBetween); + }; + ChangeTracker2.prototype.insertAtTopOfFile = function(sourceFile, insert, blankLineBetween) { + var pos = getInsertionPositionAtSourceFileTop(sourceFile); + var options = { + prefix: pos === 0 ? void 0 : this.newLineCharacter, + suffix: (ts6.isLineBreak(sourceFile.text.charCodeAt(pos)) ? "" : this.newLineCharacter) + (blankLineBetween ? this.newLineCharacter : "") + }; + if (ts6.isArray(insert)) { + this.insertNodesAt(sourceFile, pos, insert, options); + } else { + this.insertNodeAt(sourceFile, pos, insert, options); + } + }; + ChangeTracker2.prototype.insertFirstParameter = function(sourceFile, parameters, newParam) { + var p0 = ts6.firstOrUndefined(parameters); + if (p0) { + this.insertNodeBefore(sourceFile, p0, newParam); + } else { + this.insertNodeAt(sourceFile, parameters.pos, newParam); + } + }; + ChangeTracker2.prototype.insertNodeBefore = function(sourceFile, before, newNode, blankLineBetween, options) { + if (blankLineBetween === void 0) { + blankLineBetween = false; + } + if (options === void 0) { + options = {}; + } + this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween)); + }; + ChangeTracker2.prototype.insertModifierAt = function(sourceFile, pos, modifier, options) { + if (options === void 0) { + options = {}; + } + this.insertNodeAt(sourceFile, pos, ts6.factory.createToken(modifier), options); + }; + ChangeTracker2.prototype.insertModifierBefore = function(sourceFile, modifier, before) { + return this.insertModifierAt(sourceFile, before.getStart(sourceFile), modifier, { suffix: " " }); + }; + ChangeTracker2.prototype.insertCommentBeforeLine = function(sourceFile, lineNumber, position, commentText) { + var lineStartPosition = ts6.getStartPositionOfLine(lineNumber, sourceFile); + var startPosition = ts6.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition); + var insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition); + var token = ts6.getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position); + var indent = sourceFile.text.slice(lineStartPosition, startPosition); + var text = "".concat(insertAtLineStart ? "" : this.newLineCharacter, "//").concat(commentText).concat(this.newLineCharacter).concat(indent); + this.insertText(sourceFile, token.getStart(sourceFile), text); + }; + ChangeTracker2.prototype.insertJsdocCommentBefore = function(sourceFile, node, tag) { + var fnStart = node.getStart(sourceFile); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsdoc = _a[_i]; + this.deleteRange(sourceFile, { + pos: ts6.getLineStartPositionForPosition(jsdoc.getStart(sourceFile), sourceFile), + end: getAdjustedEndPosition( + sourceFile, + jsdoc, + /*options*/ + {} + ) + }); + } + } + var startPosition = ts6.getPrecedingNonSpaceCharacterPosition(sourceFile.text, fnStart - 1); + var indent = sourceFile.text.slice(startPosition, fnStart); + this.insertNodeAt(sourceFile, fnStart, tag, { suffix: this.newLineCharacter + indent }); + }; + ChangeTracker2.prototype.createJSDocText = function(sourceFile, node) { + var comments = ts6.flatMap(node.jsDoc, function(jsDoc2) { + return ts6.isString(jsDoc2.comment) ? ts6.factory.createJSDocText(jsDoc2.comment) : jsDoc2.comment; + }); + var jsDoc = ts6.singleOrUndefined(node.jsDoc); + return jsDoc && ts6.positionsAreOnSameLine(jsDoc.pos, jsDoc.end, sourceFile) && ts6.length(comments) === 0 ? void 0 : ts6.factory.createNodeArray(ts6.intersperse(comments, ts6.factory.createJSDocText("\n"))); + }; + ChangeTracker2.prototype.replaceJSDocComment = function(sourceFile, node, tags) { + this.insertJsdocCommentBefore(sourceFile, updateJSDocHost(node), ts6.factory.createJSDocComment(this.createJSDocText(sourceFile, node), ts6.factory.createNodeArray(tags))); + }; + ChangeTracker2.prototype.addJSDocTags = function(sourceFile, parent, newTags) { + var oldTags = ts6.flatMapToMutable(parent.jsDoc, function(j) { + return j.tags; + }); + var unmergedNewTags = newTags.filter(function(newTag) { + return !oldTags.some(function(tag, i) { + var merged = tryMergeJsdocTags(tag, newTag); + if (merged) + oldTags[i] = merged; + return !!merged; + }); + }); + this.replaceJSDocComment(sourceFile, parent, __spreadArray(__spreadArray([], oldTags, true), unmergedNewTags, true)); + }; + ChangeTracker2.prototype.filterJSDocTags = function(sourceFile, parent, predicate) { + this.replaceJSDocComment(sourceFile, parent, ts6.filter(ts6.flatMapToMutable(parent.jsDoc, function(j) { + return j.tags; + }), predicate)); + }; + ChangeTracker2.prototype.replaceRangeWithText = function(sourceFile, range2, text) { + this.changes.push({ kind: ChangeKind.Text, sourceFile, range: range2, text }); + }; + ChangeTracker2.prototype.insertText = function(sourceFile, pos, text) { + this.replaceRangeWithText(sourceFile, ts6.createRange(pos), text); + }; + ChangeTracker2.prototype.tryInsertTypeAnnotation = function(sourceFile, node, type) { + var _a; + var endNode; + if (ts6.isFunctionLike(node)) { + endNode = ts6.findChildOfKind(node, 21, sourceFile); + if (!endNode) { + if (!ts6.isArrowFunction(node)) + return false; + endNode = ts6.first(node.parameters); + } + } else { + endNode = (_a = node.kind === 257 ? node.exclamationToken : node.questionToken) !== null && _a !== void 0 ? _a : node.name; + } + this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); + return true; + }; + ChangeTracker2.prototype.tryInsertThisTypeAnnotation = function(sourceFile, node, type) { + var start = ts6.findChildOfKind(node, 20, sourceFile).getStart(sourceFile) + 1; + var suffix = node.parameters.length ? ", " : ""; + this.insertNodeAt(sourceFile, start, type, { prefix: "this: ", suffix }); + }; + ChangeTracker2.prototype.insertTypeParameters = function(sourceFile, node, typeParameters) { + var start = (ts6.findChildOfKind(node, 20, sourceFile) || ts6.first(node.parameters)).getStart(sourceFile); + this.insertNodesAt(sourceFile, start, typeParameters, { prefix: "<", suffix: ">", joiner: ", " }); + }; + ChangeTracker2.prototype.getOptionsForInsertNodeBefore = function(before, inserted, blankLineBetween) { + if (ts6.isStatement(before) || ts6.isClassElement(before)) { + return { suffix: blankLineBetween ? this.newLineCharacter + this.newLineCharacter : this.newLineCharacter }; + } else if (ts6.isVariableDeclaration(before)) { + return { suffix: ", " }; + } else if (ts6.isParameter(before)) { + return ts6.isParameter(inserted) ? { suffix: ", " } : {}; + } else if (ts6.isStringLiteral(before) && ts6.isImportDeclaration(before.parent) || ts6.isNamedImports(before)) { + return { suffix: ", " }; + } else if (ts6.isImportSpecifier(before)) { + return { suffix: "," + (blankLineBetween ? this.newLineCharacter : " ") }; + } + return ts6.Debug.failBadSyntaxKind(before); + }; + ChangeTracker2.prototype.insertNodeAtConstructorStart = function(sourceFile, ctr, newStatement) { + var firstStatement = ts6.firstOrUndefined(ctr.body.statements); + if (!firstStatement || !ctr.body.multiLine) { + this.replaceConstructorBody(sourceFile, ctr, __spreadArray([newStatement], ctr.body.statements, true)); + } else { + this.insertNodeBefore(sourceFile, firstStatement, newStatement); + } + }; + ChangeTracker2.prototype.insertNodeAtConstructorStartAfterSuperCall = function(sourceFile, ctr, newStatement) { + var superCallStatement = ts6.find(ctr.body.statements, function(stmt) { + return ts6.isExpressionStatement(stmt) && ts6.isSuperCall(stmt.expression); + }); + if (!superCallStatement || !ctr.body.multiLine) { + this.replaceConstructorBody(sourceFile, ctr, __spreadArray(__spreadArray([], ctr.body.statements, true), [newStatement], false)); + } else { + this.insertNodeAfter(sourceFile, superCallStatement, newStatement); + } + }; + ChangeTracker2.prototype.insertNodeAtConstructorEnd = function(sourceFile, ctr, newStatement) { + var lastStatement = ts6.lastOrUndefined(ctr.body.statements); + if (!lastStatement || !ctr.body.multiLine) { + this.replaceConstructorBody(sourceFile, ctr, __spreadArray(__spreadArray([], ctr.body.statements, true), [newStatement], false)); + } else { + this.insertNodeAfter(sourceFile, lastStatement, newStatement); + } + }; + ChangeTracker2.prototype.replaceConstructorBody = function(sourceFile, ctr, statements) { + this.replaceNode(sourceFile, ctr.body, ts6.factory.createBlock( + statements, + /*multiLine*/ + true + )); + }; + ChangeTracker2.prototype.insertNodeAtEndOfScope = function(sourceFile, scope, newNode) { + var pos = getAdjustedStartPosition(sourceFile, scope.getLastToken(), {}); + this.insertNodeAt(sourceFile, pos, newNode, { + prefix: ts6.isLineBreak(sourceFile.text.charCodeAt(scope.getLastToken().pos)) ? this.newLineCharacter : this.newLineCharacter + this.newLineCharacter, + suffix: this.newLineCharacter + }); + }; + ChangeTracker2.prototype.insertMemberAtStart = function(sourceFile, node, newElement) { + this.insertNodeAtStartWorker(sourceFile, node, newElement); + }; + ChangeTracker2.prototype.insertNodeAtObjectStart = function(sourceFile, obj, newElement) { + this.insertNodeAtStartWorker(sourceFile, obj, newElement); + }; + ChangeTracker2.prototype.insertNodeAtStartWorker = function(sourceFile, node, newElement) { + var _a; + var indentation = (_a = this.guessIndentationFromExistingMembers(sourceFile, node)) !== null && _a !== void 0 ? _a : this.computeIndentationForNewMember(sourceFile, node); + this.insertNodeAt(sourceFile, getMembersOrProperties(node).pos, newElement, this.getInsertNodeAtStartInsertOptions(sourceFile, node, indentation)); + }; + ChangeTracker2.prototype.guessIndentationFromExistingMembers = function(sourceFile, node) { + var indentation; + var lastRange = node; + for (var _i = 0, _a = getMembersOrProperties(node); _i < _a.length; _i++) { + var member = _a[_i]; + if (ts6.rangeStartPositionsAreOnSameLine(lastRange, member, sourceFile)) { + return void 0; + } + var memberStart = member.getStart(sourceFile); + var memberIndentation = ts6.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts6.getLineStartPositionForPosition(memberStart, sourceFile), memberStart, sourceFile, this.formatContext.options); + if (indentation === void 0) { + indentation = memberIndentation; + } else if (memberIndentation !== indentation) { + return void 0; + } + lastRange = member; + } + return indentation; + }; + ChangeTracker2.prototype.computeIndentationForNewMember = function(sourceFile, node) { + var _a; + var nodeStart = node.getStart(sourceFile); + return ts6.formatting.SmartIndenter.findFirstNonWhitespaceColumn(ts6.getLineStartPositionForPosition(nodeStart, sourceFile), nodeStart, sourceFile, this.formatContext.options) + ((_a = this.formatContext.options.indentSize) !== null && _a !== void 0 ? _a : 4); + }; + ChangeTracker2.prototype.getInsertNodeAtStartInsertOptions = function(sourceFile, node, indentation) { + var members = getMembersOrProperties(node); + var isEmpty = members.length === 0; + var isFirstInsertion = ts6.addToSeen(this.classesWithNodesInsertedAtStart, ts6.getNodeId(node), { node, sourceFile }); + var insertTrailingComma = ts6.isObjectLiteralExpression(node) && (!ts6.isJsonSourceFile(sourceFile) || !isEmpty); + var insertLeadingComma = ts6.isObjectLiteralExpression(node) && ts6.isJsonSourceFile(sourceFile) && isEmpty && !isFirstInsertion; + return { + indentation, + prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter, + suffix: insertTrailingComma ? "," : ts6.isInterfaceDeclaration(node) && isEmpty ? ";" : "" + }; + }; + ChangeTracker2.prototype.insertNodeAfterComma = function(sourceFile, after, newNode) { + var endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode); + this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)); + }; + ChangeTracker2.prototype.insertNodeAfter = function(sourceFile, after, newNode) { + var endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode); + this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)); + }; + ChangeTracker2.prototype.insertNodeAtEndOfList = function(sourceFile, list, newNode) { + this.insertNodeAt(sourceFile, list.end, newNode, { prefix: ", " }); + }; + ChangeTracker2.prototype.insertNodesAfter = function(sourceFile, after, newNodes) { + var endPosition = this.insertNodeAfterWorker(sourceFile, after, ts6.first(newNodes)); + this.insertNodesAt(sourceFile, endPosition, newNodes, this.getInsertNodeAfterOptions(sourceFile, after)); + }; + ChangeTracker2.prototype.insertNodeAfterWorker = function(sourceFile, after, newNode) { + if (needSemicolonBetween(after, newNode)) { + if (sourceFile.text.charCodeAt(after.end - 1) !== 59) { + this.replaceRange(sourceFile, ts6.createRange(after.end), ts6.factory.createToken( + 26 + /* SyntaxKind.SemicolonToken */ + )); + } + } + var endPosition = getAdjustedEndPosition(sourceFile, after, {}); + return endPosition; + }; + ChangeTracker2.prototype.getInsertNodeAfterOptions = function(sourceFile, after) { + var options = this.getInsertNodeAfterOptionsWorker(after); + return __assign(__assign({}, options), { prefix: after.end === sourceFile.end && ts6.isStatement(after) ? options.prefix ? "\n".concat(options.prefix) : "\n" : options.prefix }); + }; + ChangeTracker2.prototype.getInsertNodeAfterOptionsWorker = function(node) { + switch (node.kind) { + case 260: + case 264: + return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; + case 257: + case 10: + case 79: + return { prefix: ", " }; + case 299: + return { suffix: "," + this.newLineCharacter }; + case 93: + return { prefix: " " }; + case 166: + return {}; + default: + ts6.Debug.assert(ts6.isStatement(node) || ts6.isClassOrTypeElement(node)); + return { suffix: this.newLineCharacter }; + } + }; + ChangeTracker2.prototype.insertName = function(sourceFile, node, name) { + ts6.Debug.assert(!node.name); + if (node.kind === 216) { + var arrow = ts6.findChildOfKind(node, 38, sourceFile); + var lparen = ts6.findChildOfKind(node, 20, sourceFile); + if (lparen) { + this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts6.factory.createToken( + 98 + /* SyntaxKind.FunctionKeyword */ + ), ts6.factory.createIdentifier(name)], { joiner: " " }); + deleteNode(this, sourceFile, arrow); + } else { + this.insertText(sourceFile, ts6.first(node.parameters).getStart(sourceFile), "function ".concat(name, "(")); + this.replaceRange(sourceFile, arrow, ts6.factory.createToken( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } + if (node.body.kind !== 238) { + this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts6.factory.createToken( + 18 + /* SyntaxKind.OpenBraceToken */ + ), ts6.factory.createToken( + 105 + /* SyntaxKind.ReturnKeyword */ + )], { joiner: " ", suffix: " " }); + this.insertNodesAt(sourceFile, node.body.end, [ts6.factory.createToken( + 26 + /* SyntaxKind.SemicolonToken */ + ), ts6.factory.createToken( + 19 + /* SyntaxKind.CloseBraceToken */ + )], { joiner: " " }); + } + } else { + var pos = ts6.findChildOfKind(node, node.kind === 215 ? 98 : 84, sourceFile).end; + this.insertNodeAt(sourceFile, pos, ts6.factory.createIdentifier(name), { prefix: " " }); + } + }; + ChangeTracker2.prototype.insertExportModifier = function(sourceFile, node) { + this.insertText(sourceFile, node.getStart(sourceFile), "export "); + }; + ChangeTracker2.prototype.insertImportSpecifierAtIndex = function(sourceFile, importSpecifier, namedImports, index) { + var prevSpecifier = namedImports.elements[index - 1]; + if (prevSpecifier) { + this.insertNodeInListAfter(sourceFile, prevSpecifier, importSpecifier); + } else { + this.insertNodeBefore(sourceFile, namedImports.elements[0], importSpecifier, !ts6.positionsAreOnSameLine(namedImports.elements[0].getStart(), namedImports.parent.parent.getStart(), sourceFile)); + } + }; + ChangeTracker2.prototype.insertNodeInListAfter = function(sourceFile, after, newNode, containingList) { + if (containingList === void 0) { + containingList = ts6.formatting.SmartIndenter.getContainingList(after, sourceFile); + } + if (!containingList) { + ts6.Debug.fail("node is not a list element"); + return; + } + var index = ts6.indexOfNode(containingList, after); + if (index < 0) { + return; + } + var end = after.getEnd(); + if (index !== containingList.length - 1) { + var nextToken = ts6.getTokenAtPosition(sourceFile, after.end); + if (nextToken && isSeparator(after, nextToken)) { + var nextNode = containingList[index + 1]; + var startPos = skipWhitespacesAndLineBreaks(sourceFile.text, nextNode.getFullStart()); + var suffix = "".concat(ts6.tokenToString(nextToken.kind)).concat(sourceFile.text.substring(nextToken.end, startPos)); + this.insertNodesAt(sourceFile, startPos, [newNode], { suffix }); + } + } else { + var afterStart = after.getStart(sourceFile); + var afterStartLinePosition = ts6.getLineStartPositionForPosition(afterStart, sourceFile); + var separator = void 0; + var multilineList = false; + if (containingList.length === 1) { + separator = 27; + } else { + var tokenBeforeInsertPosition = ts6.findPrecedingToken(after.pos, sourceFile); + separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 27; + var afterMinusOneStartLinePosition = ts6.getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); + multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; + } + if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { + multilineList = true; + } + if (multilineList) { + this.replaceRange(sourceFile, ts6.createRange(end), ts6.factory.createToken(separator)); + var indentation = ts6.formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.formatContext.options); + var insertPos = ts6.skipTrivia( + sourceFile.text, + end, + /*stopAfterLineBreak*/ + true, + /*stopAtComments*/ + false + ); + while (insertPos !== end && ts6.isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { + insertPos--; + } + this.replaceRange(sourceFile, ts6.createRange(insertPos), newNode, { indentation, prefix: this.newLineCharacter }); + } else { + this.replaceRange(sourceFile, ts6.createRange(end), newNode, { prefix: "".concat(ts6.tokenToString(separator), " ") }); + } + } + }; + ChangeTracker2.prototype.parenthesizeExpression = function(sourceFile, expression) { + this.replaceRange(sourceFile, ts6.rangeOfNode(expression), ts6.factory.createParenthesizedExpression(expression)); + }; + ChangeTracker2.prototype.finishClassesWithNodesInsertedAtStart = function() { + var _this = this; + this.classesWithNodesInsertedAtStart.forEach(function(_a) { + var node = _a.node, sourceFile = _a.sourceFile; + var _b = getClassOrObjectBraceEnds(node, sourceFile), openBraceEnd = _b[0], closeBraceEnd = _b[1]; + if (openBraceEnd !== void 0 && closeBraceEnd !== void 0) { + var isEmpty = getMembersOrProperties(node).length === 0; + var isSingleLine = ts6.positionsAreOnSameLine(openBraceEnd, closeBraceEnd, sourceFile); + if (isEmpty && isSingleLine && openBraceEnd !== closeBraceEnd - 1) { + _this.deleteRange(sourceFile, ts6.createRange(openBraceEnd, closeBraceEnd - 1)); + } + if (isSingleLine) { + _this.insertText(sourceFile, closeBraceEnd - 1, _this.newLineCharacter); + } + } + }); + }; + ChangeTracker2.prototype.finishDeleteDeclarations = function() { + var _this = this; + var deletedNodesInLists = new ts6.Set(); + var _loop_9 = function(sourceFile2, node2) { + if (!this_1.deletedNodes.some(function(d) { + return d.sourceFile === sourceFile2 && ts6.rangeContainsRangeExclusive(d.node, node2); + })) { + if (ts6.isArray(node2)) { + this_1.deleteRange(sourceFile2, ts6.rangeOfTypeParameters(sourceFile2, node2)); + } else { + deleteDeclaration.deleteDeclaration(this_1, deletedNodesInLists, sourceFile2, node2); + } + } + }; + var this_1 = this; + for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) { + var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node; + _loop_9(sourceFile, node); + } + deletedNodesInLists.forEach(function(node2) { + var sourceFile2 = node2.getSourceFile(); + var list = ts6.formatting.SmartIndenter.getContainingList(node2, sourceFile2); + if (node2 !== ts6.last(list)) + return; + var lastNonDeletedIndex = ts6.findLastIndex(list, function(n) { + return !deletedNodesInLists.has(n); + }, list.length - 2); + if (lastNonDeletedIndex !== -1) { + _this.deleteRange(sourceFile2, { pos: list[lastNonDeletedIndex].end, end: startPositionToDeleteNodeInList(sourceFile2, list[lastNonDeletedIndex + 1]) }); + } + }); + }; + ChangeTracker2.prototype.getChanges = function(validate) { + this.finishDeleteDeclarations(); + this.finishClassesWithNodesInsertedAtStart(); + var changes = changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate); + for (var _i = 0, _a = this.newFiles; _i < _a.length; _i++) { + var _b = _a[_i], oldFile = _b.oldFile, fileName = _b.fileName, statements = _b.statements; + changes.push(changesToText.newFileChanges(oldFile, fileName, statements, this.newLineCharacter, this.formatContext)); + } + return changes; + }; + ChangeTracker2.prototype.createNewFile = function(oldFile, fileName, statements) { + this.newFiles.push({ oldFile, fileName, statements }); + }; + return ChangeTracker2; + }() + ); + textChanges_3.ChangeTracker = ChangeTracker; + function updateJSDocHost(parent) { + if (parent.kind !== 216) { + return parent; + } + var jsDocNode = parent.parent.kind === 169 ? parent.parent : parent.parent.parent; + jsDocNode.jsDoc = parent.jsDoc; + jsDocNode.jsDocCache = parent.jsDocCache; + return jsDocNode; + } + function tryMergeJsdocTags(oldTag, newTag) { + if (oldTag.kind !== newTag.kind) { + return void 0; + } + switch (oldTag.kind) { + case 343: { + var oldParam = oldTag; + var newParam = newTag; + return ts6.isIdentifier(oldParam.name) && ts6.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts6.factory.createJSDocParameterTag( + /*tagName*/ + void 0, + newParam.name, + /*isBracketed*/ + false, + newParam.typeExpression, + newParam.isNameFirst, + oldParam.comment + ) : void 0; + } + case 344: + return ts6.factory.createJSDocReturnTag( + /*tagName*/ + void 0, + newTag.typeExpression, + oldTag.comment + ); + case 346: + return ts6.factory.createJSDocTypeTag( + /*tagName*/ + void 0, + newTag.typeExpression, + oldTag.comment + ); + } + } + function startPositionToDeleteNodeInList(sourceFile, node) { + return ts6.skipTrivia( + sourceFile.text, + getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), + /*stopAfterLineBreak*/ + false, + /*stopAtComments*/ + true + ); + } + function endPositionToDeleteNodeInList(sourceFile, node, prevNode, nextNode) { + var end = startPositionToDeleteNodeInList(sourceFile, nextNode); + if (prevNode === void 0 || ts6.positionsAreOnSameLine(getAdjustedEndPosition(sourceFile, node, {}), end, sourceFile)) { + return end; + } + var token = ts6.findPrecedingToken(nextNode.getStart(sourceFile), sourceFile); + if (isSeparator(node, token)) { + var prevToken = ts6.findPrecedingToken(node.getStart(sourceFile), sourceFile); + if (isSeparator(prevNode, prevToken)) { + var pos = ts6.skipTrivia( + sourceFile.text, + token.getEnd(), + /*stopAfterLineBreak*/ + true, + /*stopAtComments*/ + true + ); + if (ts6.positionsAreOnSameLine(prevToken.getStart(sourceFile), token.getStart(sourceFile), sourceFile)) { + return ts6.isLineBreak(sourceFile.text.charCodeAt(pos - 1)) ? pos - 1 : pos; + } + if (ts6.isLineBreak(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + return end; + } + function getClassOrObjectBraceEnds(cls, sourceFile) { + var open = ts6.findChildOfKind(cls, 18, sourceFile); + var close = ts6.findChildOfKind(cls, 19, sourceFile); + return [open === null || open === void 0 ? void 0 : open.end, close === null || close === void 0 ? void 0 : close.end]; + } + function getMembersOrProperties(node) { + return ts6.isObjectLiteralExpression(node) ? node.properties : node.members; + } + function getNewFileText(statements, scriptKind, newLineCharacter, formatContext) { + return changesToText.newFileChangesWorker( + /*oldFile*/ + void 0, + scriptKind, + statements, + newLineCharacter, + formatContext + ); + } + textChanges_3.getNewFileText = getNewFileText; + var changesToText; + (function(changesToText2) { + function getTextChangesFromChanges(changes, newLineCharacter, formatContext, validate) { + return ts6.mapDefined(ts6.group(changes, function(c) { + return c.sourceFile.path; + }), function(changesInFile) { + var sourceFile = changesInFile[0].sourceFile; + var normalized = ts6.stableSort(changesInFile, function(a, b) { + return a.range.pos - b.range.pos || a.range.end - b.range.end; + }); + var _loop_10 = function(i2) { + ts6.Debug.assert(normalized[i2].range.end <= normalized[i2 + 1].range.pos, "Changes overlap", function() { + return "".concat(JSON.stringify(normalized[i2].range), " and ").concat(JSON.stringify(normalized[i2 + 1].range)); + }); + }; + for (var i = 0; i < normalized.length - 1; i++) { + _loop_10(i); + } + var textChanges2 = ts6.mapDefined(normalized, function(c) { + var span = ts6.createTextSpanFromRange(c.range); + var newText = computeNewText(c, sourceFile, newLineCharacter, formatContext, validate); + if (span.length === newText.length && ts6.stringContainsAt(sourceFile.text, newText, span.start)) { + return void 0; + } + return ts6.createTextChange(span, newText); + }); + return textChanges2.length > 0 ? { fileName: sourceFile.fileName, textChanges: textChanges2 } : void 0; + }); + } + changesToText2.getTextChangesFromChanges = getTextChangesFromChanges; + function newFileChanges(oldFile, fileName, statements, newLineCharacter, formatContext) { + var text = newFileChangesWorker(oldFile, ts6.getScriptKindFromFileName(fileName), statements, newLineCharacter, formatContext); + return { fileName, textChanges: [ts6.createTextChange(ts6.createTextSpan(0, 0), text)], isNewFile: true }; + } + changesToText2.newFileChanges = newFileChanges; + function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) { + var nonFormattedText = statements.map(function(s) { + return s === 4 ? "" : getNonformattedText(s, oldFile, newLineCharacter).text; + }).join(newLineCharacter); + var sourceFile = ts6.createSourceFile( + "any file name", + nonFormattedText, + 99, + /*setParentNodes*/ + true, + scriptKind + ); + var changes = ts6.formatting.formatDocument(sourceFile, formatContext); + return applyChanges(nonFormattedText, changes) + newLineCharacter; + } + changesToText2.newFileChangesWorker = newFileChangesWorker; + function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) { + var _a; + if (change.kind === ChangeKind.Remove) { + return ""; + } + if (change.kind === ChangeKind.Text) { + return change.text; + } + var _b = change.options, options = _b === void 0 ? {} : _b, pos = change.range.pos; + var format = function(n) { + return getFormattedTextOfNode(n, sourceFile, pos, options, newLineCharacter, formatContext, validate); + }; + var text = change.kind === ChangeKind.ReplaceWithMultipleNodes ? change.nodes.map(function(n) { + return ts6.removeSuffix(format(n), newLineCharacter); + }).join(((_a = change.options) === null || _a === void 0 ? void 0 : _a.joiner) || newLineCharacter) : format(change.node); + var noIndent = options.indentation !== void 0 || ts6.getLineStartPositionForPosition(pos, sourceFile) === pos ? text : text.replace(/^\s+/, ""); + return (options.prefix || "") + noIndent + (!options.suffix || ts6.endsWith(noIndent, options.suffix) ? "" : options.suffix); + } + function getFormattedTextOfNode(nodeIn, sourceFile, pos, _a, newLineCharacter, formatContext, validate) { + var indentation = _a.indentation, prefix2 = _a.prefix, delta = _a.delta; + var _b = getNonformattedText(nodeIn, sourceFile, newLineCharacter), node = _b.node, text = _b.text; + if (validate) + validate(node, text); + var formatOptions = ts6.getFormatCodeSettingsForWriting(formatContext, sourceFile); + var initialIndentation = indentation !== void 0 ? indentation : ts6.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix2 === newLineCharacter || ts6.getLineStartPositionForPosition(pos, sourceFile) === pos); + if (delta === void 0) { + delta = ts6.formatting.SmartIndenter.shouldIndentChildNode(formatOptions, nodeIn) ? formatOptions.indentSize || 0 : 0; + } + var file = { + text, + getLineAndCharacterOfPosition: function(pos2) { + return ts6.getLineAndCharacterOfPosition(this, pos2); + } + }; + var changes = ts6.formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, __assign(__assign({}, formatContext), { options: formatOptions })); + return applyChanges(text, changes); + } + function getNonformattedText(node, sourceFile, newLineCharacter) { + var writer = createWriter(newLineCharacter); + var newLine = ts6.getNewLineKind(newLineCharacter); + ts6.createPrinter({ + newLine, + neverAsciiEscape: true, + preserveSourceNewlines: true, + terminateUnterminatedLiterals: true + }, writer).writeNode(4, node, sourceFile, writer); + return { text: writer.getText(), node: assignPositionsToNode(node) }; + } + changesToText2.getNonformattedText = getNonformattedText; + })(changesToText || (changesToText = {})); + function applyChanges(text, changes) { + for (var i = changes.length - 1; i >= 0; i--) { + var _a = changes[i], span = _a.span, newText = _a.newText; + text = "".concat(text.substring(0, span.start)).concat(newText).concat(text.substring(ts6.textSpanEnd(span))); + } + return text; + } + textChanges_3.applyChanges = applyChanges; + function isTrivia(s) { + return ts6.skipTrivia(s, 0) === s.length; + } + var textChangesTransformationContext = __assign(__assign({}, ts6.nullTransformationContext), { factory: ts6.createNodeFactory(ts6.nullTransformationContext.factory.flags | 1, ts6.nullTransformationContext.factory.baseFactory) }); + function assignPositionsToNode(node) { + var visited = ts6.visitEachChild(node, assignPositionsToNode, textChangesTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); + var newNode = ts6.nodeIsSynthesized(visited) ? visited : Object.create(visited); + ts6.setTextRangePosEnd(newNode, getPos(node), getEnd(node)); + return newNode; + } + textChanges_3.assignPositionsToNode = assignPositionsToNode; + function assignPositionsToNodeArray(nodes, visitor, test, start, count) { + var visited = ts6.visitNodes(nodes, visitor, test, start, count); + if (!visited) { + return visited; + } + var nodeArray = visited === nodes ? ts6.factory.createNodeArray(visited.slice(0)) : visited; + ts6.setTextRangePosEnd(nodeArray, getPos(nodes), getEnd(nodes)); + return nodeArray; + } + function createWriter(newLine) { + var lastNonTriviaPosition = 0; + var writer = ts6.createTextWriter(newLine); + var onBeforeEmitNode = function(node) { + if (node) { + setPos(node, lastNonTriviaPosition); + } + }; + var onAfterEmitNode = function(node) { + if (node) { + setEnd(node, lastNonTriviaPosition); + } + }; + var onBeforeEmitNodeArray = function(nodes) { + if (nodes) { + setPos(nodes, lastNonTriviaPosition); + } + }; + var onAfterEmitNodeArray = function(nodes) { + if (nodes) { + setEnd(nodes, lastNonTriviaPosition); + } + }; + var onBeforeEmitToken = function(node) { + if (node) { + setPos(node, lastNonTriviaPosition); + } + }; + var onAfterEmitToken = function(node) { + if (node) { + setEnd(node, lastNonTriviaPosition); + } + }; + function setLastNonTriviaPosition(s, force) { + if (force || !isTrivia(s)) { + lastNonTriviaPosition = writer.getTextPos(); + var i = 0; + while (ts6.isWhiteSpaceLike(s.charCodeAt(s.length - i - 1))) { + i++; + } + lastNonTriviaPosition -= i; + } + } + function write(s) { + writer.write(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeComment(s) { + writer.writeComment(s); + } + function writeKeyword(s) { + writer.writeKeyword(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeOperator(s) { + writer.writeOperator(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writePunctuation(s) { + writer.writePunctuation(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeTrailingSemicolon(s) { + writer.writeTrailingSemicolon(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeParameter(s) { + writer.writeParameter(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeProperty(s) { + writer.writeProperty(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeSpace(s) { + writer.writeSpace(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeStringLiteral(s) { + writer.writeStringLiteral(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeSymbol(s, sym) { + writer.writeSymbol(s, sym); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeLine(force) { + writer.writeLine(force); + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } + function getText() { + return writer.getText(); + } + function rawWrite(s) { + writer.rawWrite(s); + setLastNonTriviaPosition( + s, + /*force*/ + false + ); + } + function writeLiteral(s) { + writer.writeLiteral(s); + setLastNonTriviaPosition( + s, + /*force*/ + true + ); + } + function getTextPos() { + return writer.getTextPos(); + } + function getLine() { + return writer.getLine(); + } + function getColumn() { + return writer.getColumn(); + } + function getIndent() { + return writer.getIndent(); + } + function isAtStartOfLine() { + return writer.isAtStartOfLine(); + } + function clear() { + writer.clear(); + lastNonTriviaPosition = 0; + } + return { + onBeforeEmitNode, + onAfterEmitNode, + onBeforeEmitNodeArray, + onAfterEmitNodeArray, + onBeforeEmitToken, + onAfterEmitToken, + write, + writeComment, + writeKeyword, + writeOperator, + writePunctuation, + writeTrailingSemicolon, + writeParameter, + writeProperty, + writeSpace, + writeStringLiteral, + writeSymbol, + writeLine, + increaseIndent, + decreaseIndent, + getText, + rawWrite, + writeLiteral, + getTextPos, + getLine, + getColumn, + getIndent, + isAtStartOfLine, + hasTrailingComment: function() { + return writer.hasTrailingComment(); + }, + hasTrailingWhitespace: function() { + return writer.hasTrailingWhitespace(); + }, + clear + }; + } + textChanges_3.createWriter = createWriter; + function getInsertionPositionAtSourceFileTop(sourceFile) { + var lastPrologue; + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + if (ts6.isPrologueDirective(node)) { + lastPrologue = node; + } else { + break; + } + } + var position = 0; + var text = sourceFile.text; + if (lastPrologue) { + position = lastPrologue.end; + advancePastLineBreak(); + return position; + } + var shebang = ts6.getShebang(text); + if (shebang !== void 0) { + position = shebang.length; + advancePastLineBreak(); + } + var ranges = ts6.getLeadingCommentRanges(text, position); + if (!ranges) + return position; + var lastComment; + var firstNodeLine; + for (var _b = 0, ranges_1 = ranges; _b < ranges_1.length; _b++) { + var range2 = ranges_1[_b]; + if (range2.kind === 3) { + if (ts6.isPinnedComment(text, range2.pos)) { + lastComment = { range: range2, pinnedOrTripleSlash: true }; + continue; + } + } else if (ts6.isRecognizedTripleSlashComment(text, range2.pos, range2.end)) { + lastComment = { range: range2, pinnedOrTripleSlash: true }; + continue; + } + if (lastComment) { + if (lastComment.pinnedOrTripleSlash) + break; + var commentLine = sourceFile.getLineAndCharacterOfPosition(range2.pos).line; + var lastCommentEndLine = sourceFile.getLineAndCharacterOfPosition(lastComment.range.end).line; + if (commentLine >= lastCommentEndLine + 2) + break; + } + if (sourceFile.statements.length) { + if (firstNodeLine === void 0) + firstNodeLine = sourceFile.getLineAndCharacterOfPosition(sourceFile.statements[0].getStart()).line; + var commentEndLine = sourceFile.getLineAndCharacterOfPosition(range2.end).line; + if (firstNodeLine < commentEndLine + 2) + break; + } + lastComment = { range: range2, pinnedOrTripleSlash: false }; + } + if (lastComment) { + position = lastComment.range.end; + advancePastLineBreak(); + } + return position; + function advancePastLineBreak() { + if (position < text.length) { + var charCode = text.charCodeAt(position); + if (ts6.isLineBreak(charCode)) { + position++; + if (position < text.length && charCode === 13 && text.charCodeAt(position) === 10) { + position++; + } + } + } + } + } + function isValidLocationToAddComment(sourceFile, position) { + return !ts6.isInComment(sourceFile, position) && !ts6.isInString(sourceFile, position) && !ts6.isInTemplateString(sourceFile, position) && !ts6.isInJSXText(sourceFile, position); + } + textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; + function needSemicolonBetween(a, b) { + return (ts6.isPropertySignature(a) || ts6.isPropertyDeclaration(a)) && ts6.isClassOrTypeElement(b) && b.name.kind === 164 || ts6.isStatementButNotDeclaration(a) && ts6.isStatementButNotDeclaration(b); + } + var deleteDeclaration; + (function(deleteDeclaration_1) { + function deleteDeclaration2(changes, deletedNodesInLists, sourceFile, node) { + switch (node.kind) { + case 166: { + var oldFunction = node.parent; + if (ts6.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && !ts6.findChildOfKind(oldFunction, 20, sourceFile)) { + changes.replaceNodeWithText(sourceFile, node, "()"); + } else { + deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); + } + break; + } + case 269: + case 268: + var isFirstImport = sourceFile.imports.length && node === ts6.first(sourceFile.imports).parent || node === ts6.find(sourceFile.statements, ts6.isAnyImportSyntax); + deleteNode(changes, sourceFile, node, { + leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts6.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine + }); + break; + case 205: + var pattern = node.parent; + var preserveComma = pattern.kind === 204 && node !== ts6.last(pattern.elements); + if (preserveComma) { + deleteNode(changes, sourceFile, node); + } else { + deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); + } + break; + case 257: + deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); + break; + case 165: + deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); + break; + case 273: + var namedImports = node.parent; + if (namedImports.elements.length === 1) { + deleteImportBinding(changes, sourceFile, namedImports); + } else { + deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); + } + break; + case 271: + deleteImportBinding(changes, sourceFile, node); + break; + case 26: + deleteNode(changes, sourceFile, node, { trailingTriviaOption: TrailingTriviaOption.Exclude }); + break; + case 98: + deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); + break; + case 260: + case 259: + deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts6.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); + break; + default: + if (!node.parent) { + deleteNode(changes, sourceFile, node); + } else if (ts6.isImportClause(node.parent) && node.parent.name === node) { + deleteDefaultImport(changes, sourceFile, node.parent); + } else if (ts6.isCallExpression(node.parent) && ts6.contains(node.parent.arguments, node)) { + deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); + } else { + deleteNode(changes, sourceFile, node); + } + } + } + deleteDeclaration_1.deleteDeclaration = deleteDeclaration2; + function deleteDefaultImport(changes, sourceFile, importClause) { + if (!importClause.namedBindings) { + deleteNode(changes, sourceFile, importClause.parent); + } else { + var start = importClause.name.getStart(sourceFile); + var nextToken = ts6.getTokenAtPosition(sourceFile, importClause.name.end); + if (nextToken && nextToken.kind === 27) { + var end = ts6.skipTrivia( + sourceFile.text, + nextToken.end, + /*stopAfterLineBreaks*/ + false, + /*stopAtComments*/ + true + ); + changes.deleteRange(sourceFile, { pos: start, end }); + } else { + deleteNode(changes, sourceFile, importClause.name); + } + } + } + function deleteImportBinding(changes, sourceFile, node) { + if (node.parent.name) { + var previousToken = ts6.Debug.checkDefined(ts6.getTokenAtPosition(sourceFile, node.pos - 1)); + changes.deleteRange(sourceFile, { pos: previousToken.getStart(sourceFile), end: node.end }); + } else { + var importDecl = ts6.getAncestor( + node, + 269 + /* SyntaxKind.ImportDeclaration */ + ); + deleteNode(changes, sourceFile, importDecl); + } + } + function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { + var parent = node.parent; + if (parent.kind === 295) { + changes.deleteNodeRange(sourceFile, ts6.findChildOfKind(parent, 20, sourceFile), ts6.findChildOfKind(parent, 21, sourceFile)); + return; + } + if (parent.declarations.length !== 1) { + deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); + return; + } + var gp = parent.parent; + switch (gp.kind) { + case 247: + case 246: + changes.replaceNode(sourceFile, node, ts6.factory.createObjectLiteralExpression()); + break; + case 245: + deleteNode(changes, sourceFile, parent); + break; + case 240: + deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts6.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); + break; + default: + ts6.Debug.assertNever(gp); + } + } + })(deleteDeclaration || (deleteDeclaration = {})); + function deleteNode(changes, sourceFile, node, options) { + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } + var startPosition = getAdjustedStartPosition(sourceFile, node, options); + var endPosition = getAdjustedEndPosition(sourceFile, node, options); + changes.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + } + textChanges_3.deleteNode = deleteNode; + function deleteNodeInList(changes, deletedNodesInLists, sourceFile, node) { + var containingList = ts6.Debug.checkDefined(ts6.formatting.SmartIndenter.getContainingList(node, sourceFile)); + var index = ts6.indexOfNode(containingList, node); + ts6.Debug.assert(index !== -1); + if (containingList.length === 1) { + deleteNode(changes, sourceFile, node); + return; + } + ts6.Debug.assert(!deletedNodesInLists.has(node), "Deleting a node twice"); + deletedNodesInLists.add(node); + changes.deleteRange(sourceFile, { + pos: startPositionToDeleteNodeInList(sourceFile, node), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : endPositionToDeleteNodeInList(sourceFile, node, containingList[index - 1], containingList[index + 1]) + }); + } + })(textChanges = ts6.textChanges || (ts6.textChanges = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodeToFixes = ts6.createMultiMap(); + var fixIdToRegistration = new ts6.Map(); + function createCodeFixActionWithoutFixAll(fixName, changes, description) { + return createCodeFixActionWorker( + fixName, + ts6.diagnosticToString(description), + changes, + /*fixId*/ + void 0, + /*fixAllDescription*/ + void 0 + ); + } + codefix2.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll; + function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) { + return createCodeFixActionWorker(fixName, ts6.diagnosticToString(description), changes, fixId, ts6.diagnosticToString(fixAllDescription), command); + } + codefix2.createCodeFixAction = createCodeFixAction; + function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) { + return createCodeFixActionWorker(fixName, ts6.diagnosticToString(description), changes, fixId, fixAllDescription && ts6.diagnosticToString(fixAllDescription), command); + } + codefix2.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll; + function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) { + return { fixName, description, changes, fixId, fixAllDescription, commands: command ? [command] : void 0 }; + } + function registerCodeFix(reg) { + for (var _i = 0, _a = reg.errorCodes; _i < _a.length; _i++) { + var error = _a[_i]; + errorCodeToFixes.add(String(error), reg); + } + if (reg.fixIds) { + for (var _b = 0, _c = reg.fixIds; _b < _c.length; _b++) { + var fixId = _c[_b]; + ts6.Debug.assert(!fixIdToRegistration.has(fixId)); + fixIdToRegistration.set(fixId, reg); + } + } + } + codefix2.registerCodeFix = registerCodeFix; + function getSupportedErrorCodes() { + return ts6.arrayFrom(errorCodeToFixes.keys()); + } + codefix2.getSupportedErrorCodes = getSupportedErrorCodes; + function removeFixIdIfFixAllUnavailable(registration, diagnostics) { + var errorCodes = registration.errorCodes; + var maybeFixableDiagnostics = 0; + for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { + var diag = diagnostics_1[_i]; + if (ts6.contains(errorCodes, diag.code)) + maybeFixableDiagnostics++; + if (maybeFixableDiagnostics > 1) + break; + } + var fixAllUnavailable = maybeFixableDiagnostics < 2; + return function(_a) { + var fixId = _a.fixId, fixAllDescription = _a.fixAllDescription, action = __rest(_a, ["fixId", "fixAllDescription"]); + return fixAllUnavailable ? action : __assign(__assign({}, action), { fixId, fixAllDescription }); + }; + } + function getFixes(context) { + var diagnostics = getDiagnostics(context); + var registrations = errorCodeToFixes.get(String(context.errorCode)); + return ts6.flatMap(registrations, function(f) { + return ts6.map(f.getCodeActions(context), removeFixIdIfFixAllUnavailable(f, diagnostics)); + }); + } + codefix2.getFixes = getFixes; + function getAllFixes(context) { + return fixIdToRegistration.get(ts6.cast(context.fixId, ts6.isString)).getAllCodeActions(context); + } + codefix2.getAllFixes = getAllFixes; + function createCombinedCodeActions(changes, commands) { + return { changes, commands }; + } + codefix2.createCombinedCodeActions = createCombinedCodeActions; + function createFileTextChanges(fileName, textChanges) { + return { fileName, textChanges }; + } + codefix2.createFileTextChanges = createFileTextChanges; + function codeFixAll(context, errorCodes, use) { + var commands = []; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return eachDiagnostic(context, errorCodes, function(diag) { + return use(t, diag, commands); + }); + }); + return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands); + } + codefix2.codeFixAll = codeFixAll; + function eachDiagnostic(context, errorCodes, cb) { + for (var _i = 0, _a = getDiagnostics(context); _i < _a.length; _i++) { + var diag = _a[_i]; + if (ts6.contains(errorCodes, diag.code)) { + cb(diag); + } + } + } + codefix2.eachDiagnostic = eachDiagnostic; + function getDiagnostics(_a) { + var program = _a.program, sourceFile = _a.sourceFile, cancellationToken = _a.cancellationToken; + return __spreadArray(__spreadArray(__spreadArray([], program.getSemanticDiagnostics(sourceFile, cancellationToken), true), program.getSyntacticDiagnostics(sourceFile, cancellationToken), true), ts6.computeSuggestionDiagnostics(sourceFile, program, cancellationToken), true); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor_1) { + var refactors = new ts6.Map(); + function registerRefactor(name, refactor2) { + refactors.set(name, refactor2); + } + refactor_1.registerRefactor = registerRefactor; + function getApplicableRefactors(context) { + return ts6.arrayFrom(ts6.flatMapIterator(refactors.values(), function(refactor2) { + var _a; + return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor2.kinds) === null || _a === void 0 ? void 0 : _a.some(function(kind) { + return refactor_1.refactorKindBeginsWith(kind, context.kind); + })) ? void 0 : refactor2.getAvailableActions(context); + })); + } + refactor_1.getApplicableRefactors = getApplicableRefactors; + function getEditsForRefactor(context, refactorName, actionName) { + var refactor2 = refactors.get(refactorName); + return refactor2 && refactor2.getEditsForAction(context, actionName); + } + refactor_1.getEditsForRefactor = getEditsForRefactor; + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addConvertToUnknownForNonOverlappingTypes"; + var errorCodes = [ts6.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) { + var assertion = getAssertion(context.sourceFile, context.span.start); + if (assertion === void 0) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, assertion); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_unknown_conversion_for_non_overlapping_types, fixId, ts6.Diagnostics.Add_unknown_to_all_conversions_of_non_overlapping_types)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var assertion = getAssertion(diag.file, diag.start); + if (assertion) { + makeChange(changes, diag.file, assertion); + } + }); + } + }); + function makeChange(changeTracker, sourceFile, assertion) { + var replacement = ts6.isAsExpression(assertion) ? ts6.factory.createAsExpression(assertion.expression, ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + )) : ts6.factory.createTypeAssertion(ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + ), assertion.expression); + changeTracker.replaceNode(sourceFile, assertion.expression, replacement); + } + function getAssertion(sourceFile, pos) { + if (ts6.isInJSFile(sourceFile)) + return void 0; + return ts6.findAncestor(ts6.getTokenAtPosition(sourceFile, pos), function(n) { + return ts6.isAsExpression(n) || ts6.isTypeAssertionExpression(n); + }); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + codefix2.registerCodeFix({ + errorCodes: [ + ts6.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code, + ts6.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code + ], + getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) { + var sourceFile = context.sourceFile; + var changes = ts6.textChanges.ChangeTracker.with(context, function(changes2) { + var exportDeclaration = ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([]), + /*moduleSpecifier*/ + void 0 + ); + changes2.insertNodeAtEndOfScope(sourceFile, sourceFile, exportDeclaration); + }); + return [codefix2.createCodeFixActionWithoutFixAll("addEmptyExportDeclaration", changes, ts6.Diagnostics.Add_export_to_make_this_file_into_a_module)]; + } + }); + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingAsync"; + var errorCodes = [ + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code, + ts6.Diagnostics.Type_0_is_not_comparable_to_type_1.code + ]; + codefix2.registerCodeFix({ + fixIds: [fixId], + errorCodes, + getCodeActions: function getCodeActionsToAddMissingAsync(context) { + var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span; + var diagnostic = ts6.find(program.getTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode)); + var directSpan = diagnostic && diagnostic.relatedInformation && ts6.find(diagnostic.relatedInformation, function(r) { + return r.code === ts6.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code; + }); + var decl = getFixableErrorSpanDeclaration(sourceFile, directSpan); + if (!decl) { + return; + } + var trackChanges = function(cb) { + return ts6.textChanges.ChangeTracker.with(context, cb); + }; + return [getFix(context, decl, trackChanges)]; + }, + getAllCodeActions: function(context) { + var sourceFile = context.sourceFile; + var fixedDeclarations = new ts6.Set(); + return codefix2.codeFixAll(context, errorCodes, function(t, diagnostic) { + var span = diagnostic.relatedInformation && ts6.find(diagnostic.relatedInformation, function(r) { + return r.code === ts6.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code; + }); + var decl = getFixableErrorSpanDeclaration(sourceFile, span); + if (!decl) { + return; + } + var trackChanges = function(cb) { + return cb(t), []; + }; + return getFix(context, decl, trackChanges, fixedDeclarations); + }); + } + }); + function getFix(context, decl, trackChanges, fixedDeclarations) { + var changes = trackChanges(function(t) { + return makeChange(t, context.sourceFile, decl, fixedDeclarations); + }); + return codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts6.Diagnostics.Add_all_missing_async_modifiers); + } + function makeChange(changeTracker, sourceFile, insertionSite, fixedDeclarations) { + if (fixedDeclarations) { + if (fixedDeclarations.has(ts6.getNodeId(insertionSite))) { + return; + } + } + fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts6.getNodeId(insertionSite)); + var cloneWithModifier = ts6.factory.updateModifiers(ts6.getSynthesizedDeepClone( + insertionSite, + /*includeTrivia*/ + true + ), ts6.factory.createNodeArray(ts6.factory.createModifiersFromModifierFlags( + ts6.getSyntacticModifierFlags(insertionSite) | 512 + /* ModifierFlags.Async */ + ))); + changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); + } + function getFixableErrorSpanDeclaration(sourceFile, span) { + if (!span) + return void 0; + var token = ts6.getTokenAtPosition(sourceFile, span.start); + var decl = ts6.findAncestor(token, function(node) { + if (node.getStart(sourceFile) < span.start || node.getEnd() > ts6.textSpanEnd(span)) { + return "quit"; + } + return (ts6.isArrowFunction(node) || ts6.isMethodDeclaration(node) || ts6.isFunctionExpression(node) || ts6.isFunctionDeclaration(node)) && ts6.textSpansEqual(span, ts6.createTextSpanFromNode(node, sourceFile)); + }); + return decl; + } + function getIsMatchingAsyncError(span, errorCode) { + return function(_a) { + var start = _a.start, length = _a.length, relatedInformation = _a.relatedInformation, code = _a.code; + return ts6.isNumber(start) && ts6.isNumber(length) && ts6.textSpansEqual({ start, length }, span) && code === errorCode && !!relatedInformation && ts6.some(relatedInformation, function(related) { + return related.code === ts6.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code; + }); + }; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingAwait"; + var propertyAccessCode = ts6.Diagnostics.Property_0_does_not_exist_on_type_1.code; + var callableConstructableErrorCodes = [ + ts6.Diagnostics.This_expression_is_not_callable.code, + ts6.Diagnostics.This_expression_is_not_constructable.code + ]; + var errorCodes = __spreadArray([ + ts6.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type.code, + ts6.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, + ts6.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, + ts6.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, + ts6.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, + ts6.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, + ts6.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, + ts6.Diagnostics.Type_0_is_not_an_array_type.code, + ts6.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, + ts6.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code, + ts6.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code, + ts6.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code, + ts6.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code, + ts6.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator.code, + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, + propertyAccessCode + ], callableConstructableErrorCodes, true); + codefix2.registerCodeFix({ + fixIds: [fixId], + errorCodes, + getCodeActions: function getCodeActionsToAddMissingAwait(context) { + var sourceFile = context.sourceFile, errorCode = context.errorCode, span = context.span, cancellationToken = context.cancellationToken, program = context.program; + var expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program); + if (!expression) { + return; + } + var checker = context.program.getTypeChecker(); + var trackChanges = function(cb) { + return ts6.textChanges.ChangeTracker.with(context, cb); + }; + return ts6.compact([ + getDeclarationSiteFix(context, expression, errorCode, checker, trackChanges), + getUseSiteFix(context, expression, errorCode, checker, trackChanges) + ]); + }, + getAllCodeActions: function(context) { + var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken; + var checker = context.program.getTypeChecker(); + var fixedDeclarations = new ts6.Set(); + return codefix2.codeFixAll(context, errorCodes, function(t, diagnostic) { + var expression = getAwaitErrorSpanExpression(sourceFile, diagnostic.code, diagnostic, cancellationToken, program); + if (!expression) { + return; + } + var trackChanges = function(cb) { + return cb(t), []; + }; + return getDeclarationSiteFix(context, expression, diagnostic.code, checker, trackChanges, fixedDeclarations) || getUseSiteFix(context, expression, diagnostic.code, checker, trackChanges, fixedDeclarations); + }); + } + }); + function getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program) { + var expression = ts6.getFixableErrorSpanExpression(sourceFile, span); + return expression && isMissingAwaitError(sourceFile, errorCode, span, cancellationToken, program) && isInsideAwaitableBody(expression) ? expression : void 0; + } + function getDeclarationSiteFix(context, expression, errorCode, checker, trackChanges, fixedDeclarations) { + var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken; + var awaitableInitializers = findAwaitableInitializers(expression, sourceFile, cancellationToken, program, checker); + if (awaitableInitializers) { + var initializerChanges = trackChanges(function(t) { + ts6.forEach(awaitableInitializers.initializers, function(_a) { + var expression2 = _a.expression; + return makeChange(t, errorCode, sourceFile, checker, expression2, fixedDeclarations); + }); + if (fixedDeclarations && awaitableInitializers.needsSecondPassForFixAll) { + makeChange(t, errorCode, sourceFile, checker, expression, fixedDeclarations); + } + }); + return codefix2.createCodeFixActionWithoutFixAll("addMissingAwaitToInitializer", initializerChanges, awaitableInitializers.initializers.length === 1 ? [ts6.Diagnostics.Add_await_to_initializer_for_0, awaitableInitializers.initializers[0].declarationSymbol.name] : ts6.Diagnostics.Add_await_to_initializers); + } + } + function getUseSiteFix(context, expression, errorCode, checker, trackChanges, fixedDeclarations) { + var changes = trackChanges(function(t) { + return makeChange(t, errorCode, context.sourceFile, checker, expression, fixedDeclarations); + }); + return codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_await, fixId, ts6.Diagnostics.Fix_all_expressions_possibly_missing_await); + } + function isMissingAwaitError(sourceFile, errorCode, span, cancellationToken, program) { + var checker = program.getTypeChecker(); + var diagnostics = checker.getDiagnostics(sourceFile, cancellationToken); + return ts6.some(diagnostics, function(_a) { + var start = _a.start, length = _a.length, relatedInformation = _a.relatedInformation, code = _a.code; + return ts6.isNumber(start) && ts6.isNumber(length) && ts6.textSpansEqual({ start, length }, span) && code === errorCode && !!relatedInformation && ts6.some(relatedInformation, function(related) { + return related.code === ts6.Diagnostics.Did_you_forget_to_use_await.code; + }); + }); + } + function findAwaitableInitializers(expression, sourceFile, cancellationToken, program, checker) { + var identifiers = getIdentifiersFromErrorSpanExpression(expression, checker); + if (!identifiers) { + return; + } + var isCompleteFix = identifiers.isCompleteFix; + var initializers; + var _loop_11 = function(identifier2) { + var symbol = checker.getSymbolAtLocation(identifier2); + if (!symbol) { + return "continue"; + } + var declaration = ts6.tryCast(symbol.valueDeclaration, ts6.isVariableDeclaration); + var variableName = declaration && ts6.tryCast(declaration.name, ts6.isIdentifier); + var variableStatement = ts6.getAncestor( + declaration, + 240 + /* SyntaxKind.VariableStatement */ + ); + if (!declaration || !variableStatement || declaration.type || !declaration.initializer || variableStatement.getSourceFile() !== sourceFile || ts6.hasSyntacticModifier( + variableStatement, + 1 + /* ModifierFlags.Export */ + ) || !variableName || !isInsideAwaitableBody(declaration.initializer)) { + isCompleteFix = false; + return "continue"; + } + var diagnostics = program.getSemanticDiagnostics(sourceFile, cancellationToken); + var isUsedElsewhere = ts6.FindAllReferences.Core.eachSymbolReferenceInFile(variableName, checker, sourceFile, function(reference) { + return identifier2 !== reference && !symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, checker); + }); + if (isUsedElsewhere) { + isCompleteFix = false; + return "continue"; + } + (initializers || (initializers = [])).push({ + expression: declaration.initializer, + declarationSymbol: symbol + }); + }; + for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) { + var identifier = _a[_i]; + _loop_11(identifier); + } + return initializers && { + initializers, + needsSecondPassForFixAll: !isCompleteFix + }; + } + function getIdentifiersFromErrorSpanExpression(expression, checker) { + if (ts6.isPropertyAccessExpression(expression.parent) && ts6.isIdentifier(expression.parent.expression)) { + return { identifiers: [expression.parent.expression], isCompleteFix: true }; + } + if (ts6.isIdentifier(expression)) { + return { identifiers: [expression], isCompleteFix: true }; + } + if (ts6.isBinaryExpression(expression)) { + var sides = void 0; + var isCompleteFix = true; + for (var _i = 0, _a = [expression.left, expression.right]; _i < _a.length; _i++) { + var side = _a[_i]; + var type = checker.getTypeAtLocation(side); + if (checker.getPromisedTypeOfPromise(type)) { + if (!ts6.isIdentifier(side)) { + isCompleteFix = false; + continue; + } + (sides || (sides = [])).push(side); + } + } + return sides && { identifiers: sides, isCompleteFix }; + } + } + function symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, checker) { + var errorNode = ts6.isPropertyAccessExpression(reference.parent) ? reference.parent.name : ts6.isBinaryExpression(reference.parent) ? reference.parent : reference; + var diagnostic = ts6.find(diagnostics, function(diagnostic2) { + return diagnostic2.start === errorNode.getStart(sourceFile) && diagnostic2.start + diagnostic2.length === errorNode.getEnd(); + }); + return diagnostic && ts6.contains(errorCodes, diagnostic.code) || // A Promise is usually not correct in a binary expression (it’s not valid + // in an arithmetic expression and an equality comparison seems unusual), + // but if the other side of the binary expression has an error, the side + // is typed `any` which will squash the error that would identify this + // Promise as an invalid operand. So if the whole binary expression is + // typed `any` as a result, there is a strong likelihood that this Promise + // is accidentally missing `await`. + checker.getTypeAtLocation(errorNode).flags & 1; + } + function isInsideAwaitableBody(node) { + return node.kind & 32768 || !!ts6.findAncestor(node, function(ancestor) { + return ancestor.parent && ts6.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || ts6.isBlock(ancestor) && (ancestor.parent.kind === 259 || ancestor.parent.kind === 215 || ancestor.parent.kind === 216 || ancestor.parent.kind === 171); + }); + } + function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { + if (ts6.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { + var exprType = checker.getTypeAtLocation(insertionSite); + var asyncIter = checker.getAsyncIterableType(); + if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { + var forOf = insertionSite.parent; + changeTracker.replaceNode(sourceFile, forOf, ts6.factory.updateForOfStatement(forOf, ts6.factory.createToken( + 133 + /* SyntaxKind.AwaitKeyword */ + ), forOf.initializer, forOf.expression, forOf.statement)); + return; + } + } + if (ts6.isBinaryExpression(insertionSite)) { + for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) { + var side = _a[_i]; + if (fixedDeclarations && ts6.isIdentifier(side)) { + var symbol = checker.getSymbolAtLocation(side); + if (symbol && fixedDeclarations.has(ts6.getSymbolId(symbol))) { + continue; + } + } + var type = checker.getTypeAtLocation(side); + var newNode = checker.getPromisedTypeOfPromise(type) ? ts6.factory.createAwaitExpression(side) : side; + changeTracker.replaceNode(sourceFile, side, newNode); + } + } else if (errorCode === propertyAccessCode && ts6.isPropertyAccessExpression(insertionSite.parent)) { + if (fixedDeclarations && ts6.isIdentifier(insertionSite.parent.expression)) { + var symbol = checker.getSymbolAtLocation(insertionSite.parent.expression); + if (symbol && fixedDeclarations.has(ts6.getSymbolId(symbol))) { + return; + } + } + changeTracker.replaceNode(sourceFile, insertionSite.parent.expression, ts6.factory.createParenthesizedExpression(ts6.factory.createAwaitExpression(insertionSite.parent.expression))); + insertLeadingSemicolonIfNeeded(changeTracker, insertionSite.parent.expression, sourceFile); + } else if (ts6.contains(callableConstructableErrorCodes, errorCode) && ts6.isCallOrNewExpression(insertionSite.parent)) { + if (fixedDeclarations && ts6.isIdentifier(insertionSite)) { + var symbol = checker.getSymbolAtLocation(insertionSite); + if (symbol && fixedDeclarations.has(ts6.getSymbolId(symbol))) { + return; + } + } + changeTracker.replaceNode(sourceFile, insertionSite, ts6.factory.createParenthesizedExpression(ts6.factory.createAwaitExpression(insertionSite))); + insertLeadingSemicolonIfNeeded(changeTracker, insertionSite, sourceFile); + } else { + if (fixedDeclarations && ts6.isVariableDeclaration(insertionSite.parent) && ts6.isIdentifier(insertionSite.parent.name)) { + var symbol = checker.getSymbolAtLocation(insertionSite.parent.name); + if (symbol && !ts6.tryAddToSet(fixedDeclarations, ts6.getSymbolId(symbol))) { + return; + } + } + changeTracker.replaceNode(sourceFile, insertionSite, ts6.factory.createAwaitExpression(insertionSite)); + } + } + function insertLeadingSemicolonIfNeeded(changeTracker, beforeNode, sourceFile) { + var precedingToken = ts6.findPrecedingToken(beforeNode.pos, sourceFile); + if (precedingToken && ts6.positionIsASICandidate(precedingToken.end, precedingToken.parent, sourceFile)) { + changeTracker.insertText(sourceFile, beforeNode.getStart(sourceFile), ";"); + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingConst"; + var errorCodes = [ + ts6.Diagnostics.Cannot_find_name_0.code, + ts6.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToAddMissingConst(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span.start, context.program); + }); + if (changes.length > 0) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_const_to_unresolved_variable, fixId, ts6.Diagnostics.Add_const_to_all_unresolved_variables)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var fixedNodes = new ts6.Set(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag.start, context.program, fixedNodes); + }); + } + }); + function makeChange(changeTracker, sourceFile, pos, program, fixedNodes) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + var forInitializer = ts6.findAncestor(token, function(node) { + return ts6.isForInOrOfStatement(node.parent) ? node.parent.initializer === node : isPossiblyPartOfDestructuring(node) ? false : "quit"; + }); + if (forInitializer) + return applyChange(changeTracker, forInitializer, sourceFile, fixedNodes); + var parent = token.parent; + if (ts6.isBinaryExpression(parent) && parent.operatorToken.kind === 63 && ts6.isExpressionStatement(parent.parent)) { + return applyChange(changeTracker, token, sourceFile, fixedNodes); + } + if (ts6.isArrayLiteralExpression(parent)) { + var checker_1 = program.getTypeChecker(); + if (!ts6.every(parent.elements, function(element) { + return arrayElementCouldBeVariableDeclaration(element, checker_1); + })) { + return; + } + return applyChange(changeTracker, parent, sourceFile, fixedNodes); + } + var commaExpression = ts6.findAncestor(token, function(node) { + return ts6.isExpressionStatement(node.parent) ? true : isPossiblyPartOfCommaSeperatedInitializer(node) ? false : "quit"; + }); + if (commaExpression) { + var checker = program.getTypeChecker(); + if (!expressionCouldBeVariableDeclaration(commaExpression, checker)) { + return; + } + return applyChange(changeTracker, commaExpression, sourceFile, fixedNodes); + } + } + function applyChange(changeTracker, initializer, sourceFile, fixedNodes) { + if (!fixedNodes || ts6.tryAddToSet(fixedNodes, initializer)) { + changeTracker.insertModifierBefore(sourceFile, 85, initializer); + } + } + function isPossiblyPartOfDestructuring(node) { + switch (node.kind) { + case 79: + case 206: + case 207: + case 299: + case 300: + return true; + default: + return false; + } + } + function arrayElementCouldBeVariableDeclaration(expression, checker) { + var identifier = ts6.isIdentifier(expression) ? expression : ts6.isAssignmentExpression( + expression, + /*excludeCompoundAssignment*/ + true + ) && ts6.isIdentifier(expression.left) ? expression.left : void 0; + return !!identifier && !checker.getSymbolAtLocation(identifier); + } + function isPossiblyPartOfCommaSeperatedInitializer(node) { + switch (node.kind) { + case 79: + case 223: + case 27: + return true; + default: + return false; + } + } + function expressionCouldBeVariableDeclaration(expression, checker) { + if (!ts6.isBinaryExpression(expression)) { + return false; + } + if (expression.operatorToken.kind === 27) { + return ts6.every([expression.left, expression.right], function(expression2) { + return expressionCouldBeVariableDeclaration(expression2, checker); + }); + } + return expression.operatorToken.kind === 63 && ts6.isIdentifier(expression.left) && !checker.getSymbolAtLocation(expression.left); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingDeclareProperty"; + var errorCodes = [ + ts6.Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span.start); + }); + if (changes.length > 0) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Prefix_with_declare, fixId, ts6.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var fixedNodes = new ts6.Set(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag.start, fixedNodes); + }); + } + }); + function makeChange(changeTracker, sourceFile, pos, fixedNodes) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (!ts6.isIdentifier(token)) { + return; + } + var declaration = token.parent; + if (declaration.kind === 169 && (!fixedNodes || ts6.tryAddToSet(fixedNodes, declaration))) { + changeTracker.insertModifierBefore(sourceFile, 136, declaration); + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingInvocationForDecorator"; + var errorCodes = [ts6.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span.start); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Call_decorator_expression, fixId, ts6.Diagnostics.Add_to_all_uncalled_decorators)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag.start); + }); + } + }); + function makeChange(changeTracker, sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + var decorator = ts6.findAncestor(token, ts6.isDecorator); + ts6.Debug.assert(!!decorator, "Expected position to be owned by a decorator."); + var replacement = ts6.factory.createCallExpression( + decorator.expression, + /*typeArguments*/ + void 0, + /*argumentsArray*/ + void 0 + ); + changeTracker.replaceNode(sourceFile, decorator.expression, replacement); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addNameToNamelessParameter"; + var errorCodes = [ts6.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span.start); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_parameter_name, fixId, ts6.Diagnostics.Add_names_to_all_parameters_without_names)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag.start); + }); + } + }); + function makeChange(changeTracker, sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + var param = token.parent; + if (!ts6.isParameter(param)) { + return ts6.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts6.Debug.formatSyntaxKind(token.kind)); + } + var i = param.parent.parameters.indexOf(param); + ts6.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one."); + ts6.Debug.assert(i > -1, "Parameter not found in parent parameter list."); + var typeNode = ts6.factory.createTypeReferenceNode( + param.name, + /*typeArguments*/ + void 0 + ); + var replacement = ts6.factory.createParameterDeclaration(param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, param.dotDotDotToken ? ts6.factory.createArrayTypeNode(typeNode) : typeNode, param.initializer); + changeTracker.replaceNode(sourceFile, param, replacement); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var addOptionalPropertyUndefined = "addOptionalPropertyUndefined"; + var errorCodes = [ + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code, + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var typeChecker = context.program.getTypeChecker(); + var toAdd = getPropertiesToAdd(context.sourceFile, context.span, typeChecker); + if (!toAdd.length) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addUndefinedToOptionalProperty(t, toAdd); + }); + return [codefix2.createCodeFixActionWithoutFixAll(addOptionalPropertyUndefined, changes, ts6.Diagnostics.Add_undefined_to_optional_property_type)]; + }, + fixIds: [addOptionalPropertyUndefined] + }); + function getPropertiesToAdd(file, span, checker) { + var _a, _b; + var sourceTarget = getSourceTarget(ts6.getFixableErrorSpanExpression(file, span), checker); + if (!sourceTarget) { + return ts6.emptyArray; + } + var sourceNode = sourceTarget.source, targetNode = sourceTarget.target; + var target = shouldUseParentTypeOfProperty(sourceNode, targetNode, checker) ? checker.getTypeAtLocation(targetNode.expression) : checker.getTypeAtLocation(targetNode); + if ((_b = (_a = target.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b.some(function(d) { + return ts6.getSourceFileOfNode(d).fileName.match(/\.d\.ts$/); + })) { + return ts6.emptyArray; + } + return checker.getExactOptionalProperties(target); + } + function shouldUseParentTypeOfProperty(sourceNode, targetNode, checker) { + return ts6.isPropertyAccessExpression(targetNode) && !!checker.getExactOptionalProperties(checker.getTypeAtLocation(targetNode.expression)).length && checker.getTypeAtLocation(sourceNode) === checker.getUndefinedType(); + } + function getSourceTarget(errorNode, checker) { + var _a; + if (!errorNode) { + return void 0; + } else if (ts6.isBinaryExpression(errorNode.parent) && errorNode.parent.operatorToken.kind === 63) { + return { source: errorNode.parent.right, target: errorNode.parent.left }; + } else if (ts6.isVariableDeclaration(errorNode.parent) && errorNode.parent.initializer) { + return { source: errorNode.parent.initializer, target: errorNode.parent.name }; + } else if (ts6.isCallExpression(errorNode.parent)) { + var n = checker.getSymbolAtLocation(errorNode.parent.expression); + if (!(n === null || n === void 0 ? void 0 : n.valueDeclaration) || !ts6.isFunctionLikeKind(n.valueDeclaration.kind)) + return void 0; + if (!ts6.isExpression(errorNode)) + return void 0; + var i = errorNode.parent.arguments.indexOf(errorNode); + if (i === -1) + return void 0; + var name = n.valueDeclaration.parameters[i].name; + if (ts6.isIdentifier(name)) + return { source: errorNode, target: name }; + } else if (ts6.isPropertyAssignment(errorNode.parent) && ts6.isIdentifier(errorNode.parent.name) || ts6.isShorthandPropertyAssignment(errorNode.parent)) { + var parentTarget = getSourceTarget(errorNode.parent.parent, checker); + if (!parentTarget) + return void 0; + var prop = checker.getPropertyOfType(checker.getTypeAtLocation(parentTarget.target), errorNode.parent.name.text); + var declaration = (_a = prop === null || prop === void 0 ? void 0 : prop.declarations) === null || _a === void 0 ? void 0 : _a[0]; + if (!declaration) + return void 0; + return { + source: ts6.isPropertyAssignment(errorNode.parent) ? errorNode.parent.initializer : errorNode.parent.name, + target: declaration + }; + } + return void 0; + } + function addUndefinedToOptionalProperty(changes, toAdd) { + for (var _i = 0, toAdd_1 = toAdd; _i < toAdd_1.length; _i++) { + var add = toAdd_1[_i]; + var d = add.valueDeclaration; + if (d && (ts6.isPropertySignature(d) || ts6.isPropertyDeclaration(d)) && d.type) { + var t = ts6.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 ? d.type.types : [d.type], true), [ + ts6.factory.createTypeReferenceNode("undefined") + ], false)); + changes.replaceNode(d.getSourceFile(), d.type, t); + } + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "annotateWithTypeFromJSDoc"; + var errorCodes = [ts6.Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var decl = getDeclaration(context.sourceFile, context.span.start); + if (!decl) + return; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, decl); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Annotate_with_type_from_JSDoc, fixId, ts6.Diagnostics.Annotate_everything_with_types_from_JSDoc)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var decl = getDeclaration(diag.file, diag.start); + if (decl) + doChange(changes, diag.file, decl); + }); + } + }); + function getDeclaration(file, pos) { + var name = ts6.getTokenAtPosition(file, pos); + return ts6.tryCast(ts6.isParameter(name.parent) ? name.parent.parent : name.parent, parameterShouldGetTypeFromJSDoc); + } + function parameterShouldGetTypeFromJSDoc(node) { + return isDeclarationWithType(node) && hasUsableJSDoc(node); + } + codefix2.parameterShouldGetTypeFromJSDoc = parameterShouldGetTypeFromJSDoc; + function hasUsableJSDoc(decl) { + return ts6.isFunctionLikeDeclaration(decl) ? decl.parameters.some(hasUsableJSDoc) || !decl.type && !!ts6.getJSDocReturnType(decl) : !decl.type && !!ts6.getJSDocType(decl); + } + function doChange(changes, sourceFile, decl) { + if (ts6.isFunctionLikeDeclaration(decl) && (ts6.getJSDocReturnType(decl) || decl.parameters.some(function(p) { + return !!ts6.getJSDocType(p); + }))) { + if (!decl.typeParameters) { + var typeParameters = ts6.getJSDocTypeParameterDeclarations(decl); + if (typeParameters.length) + changes.insertTypeParameters(sourceFile, decl, typeParameters); + } + var needParens = ts6.isArrowFunction(decl) && !ts6.findChildOfKind(decl, 20, sourceFile); + if (needParens) + changes.insertNodeBefore(sourceFile, ts6.first(decl.parameters), ts6.factory.createToken( + 20 + /* SyntaxKind.OpenParenToken */ + )); + for (var _i = 0, _a = decl.parameters; _i < _a.length; _i++) { + var param = _a[_i]; + if (!param.type) { + var paramType = ts6.getJSDocType(param); + if (paramType) + changes.tryInsertTypeAnnotation(sourceFile, param, transformJSDocType(paramType)); + } + } + if (needParens) + changes.insertNodeAfter(sourceFile, ts6.last(decl.parameters), ts6.factory.createToken( + 21 + /* SyntaxKind.CloseParenToken */ + )); + if (!decl.type) { + var returnType = ts6.getJSDocReturnType(decl); + if (returnType) + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(returnType)); + } + } else { + var jsdocType = ts6.Debug.checkDefined(ts6.getJSDocType(decl), "A JSDocType for this declaration should exist"); + ts6.Debug.assert(!decl.type, "The JSDocType decl should have a type"); + changes.tryInsertTypeAnnotation(sourceFile, decl, transformJSDocType(jsdocType)); + } + } + function isDeclarationWithType(node) { + return ts6.isFunctionLikeDeclaration(node) || node.kind === 257 || node.kind === 168 || node.kind === 169; + } + function transformJSDocType(node) { + switch (node.kind) { + case 315: + case 316: + return ts6.factory.createTypeReferenceNode("any", ts6.emptyArray); + case 319: + return transformJSDocOptionalType(node); + case 318: + return transformJSDocType(node.type); + case 317: + return transformJSDocNullableType(node); + case 321: + return transformJSDocVariadicType(node); + case 320: + return transformJSDocFunctionType(node); + case 180: + return transformJSDocTypeReference(node); + default: + var visited = ts6.visitEachChild(node, transformJSDocType, ts6.nullTransformationContext); + ts6.setEmitFlags( + visited, + 1 + /* EmitFlags.SingleLine */ + ); + return visited; + } + } + function transformJSDocOptionalType(node) { + return ts6.factory.createUnionTypeNode([ts6.visitNode(node.type, transformJSDocType), ts6.factory.createTypeReferenceNode("undefined", ts6.emptyArray)]); + } + function transformJSDocNullableType(node) { + return ts6.factory.createUnionTypeNode([ts6.visitNode(node.type, transformJSDocType), ts6.factory.createTypeReferenceNode("null", ts6.emptyArray)]); + } + function transformJSDocVariadicType(node) { + return ts6.factory.createArrayTypeNode(ts6.visitNode(node.type, transformJSDocType)); + } + function transformJSDocFunctionType(node) { + var _a; + return ts6.factory.createFunctionTypeNode(ts6.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + )); + } + function transformJSDocParameter(node) { + var index = node.parent.parameters.indexOf(node); + var isRest = node.type.kind === 321 && index === node.parent.parameters.length - 1; + var name = node.name || (isRest ? "rest" : "arg" + index); + var dotdotdot = isRest ? ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ) : node.dotDotDotToken; + return ts6.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts6.visitNode(node.type, transformJSDocType), node.initializer); + } + function transformJSDocTypeReference(node) { + var name = node.typeName; + var args = node.typeArguments; + if (ts6.isIdentifier(node.typeName)) { + if (ts6.isJSDocIndexSignature(node)) { + return transformJSDocIndexSignature(node); + } + var text = node.typeName.text; + switch (node.typeName.text) { + case "String": + case "Boolean": + case "Object": + case "Number": + text = text.toLowerCase(); + break; + case "array": + case "date": + case "promise": + text = text[0].toUpperCase() + text.slice(1); + break; + } + name = ts6.factory.createIdentifier(text); + if ((text === "Array" || text === "Promise") && !node.typeArguments) { + args = ts6.factory.createNodeArray([ts6.factory.createTypeReferenceNode("any", ts6.emptyArray)]); + } else { + args = ts6.visitNodes(node.typeArguments, transformJSDocType); + } + } + return ts6.factory.createTypeReferenceNode(name, args); + } + function transformJSDocIndexSignature(node) { + var index = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + node.typeArguments[0].kind === 148 ? "n" : "s", + /*questionToken*/ + void 0, + ts6.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 ? "number" : "string", []), + /*initializer*/ + void 0 + ); + var indexSignature = ts6.factory.createTypeLiteralNode([ts6.factory.createIndexSignature( + /*modifiers*/ + void 0, + [index], + node.typeArguments[1] + )]); + ts6.setEmitFlags( + indexSignature, + 1 + /* EmitFlags.SingleLine */ + ); + return indexSignature; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "convertFunctionToEs6Class"; + var errorCodes = [ts6.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_function_to_an_ES2015_class, fixId, ts6.Diagnostics.Convert_all_constructor_functions_to_classes)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, err) { + return doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()); + }); + } + }); + function doChange(changes, sourceFile, position, checker, preferences, compilerOptions) { + var ctorSymbol = checker.getSymbolAtLocation(ts6.getTokenAtPosition(sourceFile, position)); + if (!ctorSymbol || !ctorSymbol.valueDeclaration || !(ctorSymbol.flags & (16 | 3))) { + return void 0; + } + var ctorDeclaration = ctorSymbol.valueDeclaration; + if (ts6.isFunctionDeclaration(ctorDeclaration) || ts6.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); + } else if (ts6.isVariableDeclaration(ctorDeclaration)) { + var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); + if (!classDeclaration) { + return void 0; + } + var ancestor = ctorDeclaration.parent.parent; + if (ts6.isVariableDeclarationList(ctorDeclaration.parent) && ctorDeclaration.parent.declarations.length > 1) { + changes.delete(sourceFile, ctorDeclaration); + changes.insertNodeAfter(sourceFile, ancestor, classDeclaration); + } else { + changes.replaceNode(sourceFile, ancestor, classDeclaration); + } + } + function createClassElementsFromSymbol(symbol) { + var memberElements = []; + if (symbol.exports) { + symbol.exports.forEach(function(member) { + if (member.name === "prototype" && member.declarations) { + var firstDeclaration = member.declarations[0]; + if (member.declarations.length === 1 && ts6.isPropertyAccessExpression(firstDeclaration) && ts6.isBinaryExpression(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 63 && ts6.isObjectLiteralExpression(firstDeclaration.parent.right)) { + var prototypes = firstDeclaration.parent.right; + createClassElement( + prototypes.symbol, + /** modifiers */ + void 0, + memberElements + ); + } + } else { + createClassElement(member, [ts6.factory.createToken( + 124 + /* SyntaxKind.StaticKeyword */ + )], memberElements); + } + }); + } + if (symbol.members) { + symbol.members.forEach(function(member, key) { + var _a, _b, _c, _d; + if (key === "constructor" && member.valueDeclaration) { + var prototypeAssignment = (_d = (_c = (_b = (_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.get("prototype")) === null || _b === void 0 ? void 0 : _b.declarations) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.parent; + if (prototypeAssignment && ts6.isBinaryExpression(prototypeAssignment) && ts6.isObjectLiteralExpression(prototypeAssignment.right) && ts6.some(prototypeAssignment.right.properties, isConstructorAssignment)) { + } else { + changes.delete(sourceFile, member.valueDeclaration.parent); + } + return; + } + createClassElement( + member, + /*modifiers*/ + void 0, + memberElements + ); + }); + } + return memberElements; + function shouldConvertDeclaration(_target, source) { + if (ts6.isAccessExpression(_target)) { + if (ts6.isPropertyAccessExpression(_target) && isConstructorAssignment(_target)) + return true; + return ts6.isFunctionLike(source); + } else { + return ts6.every(_target.properties, function(property) { + if (ts6.isMethodDeclaration(property) || ts6.isGetOrSetAccessorDeclaration(property)) + return true; + if (ts6.isPropertyAssignment(property) && ts6.isFunctionExpression(property.initializer) && !!property.name) + return true; + if (isConstructorAssignment(property)) + return true; + return false; + }); + } + } + function createClassElement(symbol2, modifiers, members) { + if (!(symbol2.flags & 8192) && !(symbol2.flags & 4096)) { + return; + } + var memberDeclaration = symbol2.valueDeclaration; + var assignmentBinaryExpression = memberDeclaration.parent; + var assignmentExpr = assignmentBinaryExpression.right; + if (!shouldConvertDeclaration(memberDeclaration, assignmentExpr)) { + return; + } + if (ts6.some(members, function(m) { + var name2 = ts6.getNameOfDeclaration(m); + if (name2 && ts6.isIdentifier(name2) && ts6.idText(name2) === ts6.symbolName(symbol2)) { + return true; + } + return false; + })) { + return; + } + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 ? assignmentBinaryExpression.parent : assignmentBinaryExpression; + changes.delete(sourceFile, nodeToDelete); + if (!assignmentExpr) { + members.push(ts6.factory.createPropertyDeclaration( + modifiers, + symbol2.name, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + )); + return; + } + if (ts6.isAccessExpression(memberDeclaration) && (ts6.isFunctionExpression(assignmentExpr) || ts6.isArrowFunction(assignmentExpr))) { + var quotePreference = ts6.getQuotePreference(sourceFile, preferences); + var name = tryGetPropertyName(memberDeclaration, compilerOptions, quotePreference); + if (name) { + createFunctionLikeExpressionMember(members, assignmentExpr, name); + } + return; + } else if (ts6.isObjectLiteralExpression(assignmentExpr)) { + ts6.forEach(assignmentExpr.properties, function(property) { + if (ts6.isMethodDeclaration(property) || ts6.isGetOrSetAccessorDeclaration(property)) { + members.push(property); + } + if (ts6.isPropertyAssignment(property) && ts6.isFunctionExpression(property.initializer)) { + createFunctionLikeExpressionMember(members, property.initializer, property.name); + } + if (isConstructorAssignment(property)) + return; + return; + }); + return; + } else { + if (ts6.isSourceFileJS(sourceFile)) + return; + if (!ts6.isPropertyAccessExpression(memberDeclaration)) + return; + var prop = ts6.factory.createPropertyDeclaration( + modifiers, + memberDeclaration.name, + /*questionToken*/ + void 0, + /*type*/ + void 0, + assignmentExpr + ); + ts6.copyLeadingComments(assignmentBinaryExpression.parent, prop, sourceFile); + members.push(prop); + return; + } + function createFunctionLikeExpressionMember(members2, expression, name2) { + if (ts6.isFunctionExpression(expression)) + return createFunctionExpressionMember(members2, expression, name2); + else + return createArrowFunctionExpressionMember(members2, expression, name2); + } + function createFunctionExpressionMember(members2, functionExpression, name2) { + var fullModifiers = ts6.concatenate(modifiers, getModifierKindFromSource( + functionExpression, + 132 + /* SyntaxKind.AsyncKeyword */ + )); + var method = ts6.factory.createMethodDeclaration( + fullModifiers, + /*asteriskToken*/ + void 0, + name2, + /*questionToken*/ + void 0, + /*typeParameters*/ + void 0, + functionExpression.parameters, + /*type*/ + void 0, + functionExpression.body + ); + ts6.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); + members2.push(method); + return; + } + function createArrowFunctionExpressionMember(members2, arrowFunction, name2) { + var arrowFunctionBody = arrowFunction.body; + var bodyBlock; + if (arrowFunctionBody.kind === 238) { + bodyBlock = arrowFunctionBody; + } else { + bodyBlock = ts6.factory.createBlock([ts6.factory.createReturnStatement(arrowFunctionBody)]); + } + var fullModifiers = ts6.concatenate(modifiers, getModifierKindFromSource( + arrowFunction, + 132 + /* SyntaxKind.AsyncKeyword */ + )); + var method = ts6.factory.createMethodDeclaration( + fullModifiers, + /*asteriskToken*/ + void 0, + name2, + /*questionToken*/ + void 0, + /*typeParameters*/ + void 0, + arrowFunction.parameters, + /*type*/ + void 0, + bodyBlock + ); + ts6.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); + members2.push(method); + } + } + } + function createClassFromVariableDeclaration(node) { + var initializer = node.initializer; + if (!initializer || !ts6.isFunctionExpression(initializer) || !ts6.isIdentifier(node.name)) { + return void 0; + } + var memberElements = createClassElementsFromSymbol(node.symbol); + if (initializer.body) { + memberElements.unshift(ts6.factory.createConstructorDeclaration( + /*modifiers*/ + void 0, + initializer.parameters, + initializer.body + )); + } + var modifiers = getModifierKindFromSource( + node.parent.parent, + 93 + /* SyntaxKind.ExportKeyword */ + ); + var cls = ts6.factory.createClassDeclaration( + modifiers, + node.name, + /*typeParameters*/ + void 0, + /*heritageClauses*/ + void 0, + memberElements + ); + return cls; + } + function createClassFromFunction(node) { + var memberElements = createClassElementsFromSymbol(ctorSymbol); + if (node.body) { + memberElements.unshift(ts6.factory.createConstructorDeclaration( + /*modifiers*/ + void 0, + node.parameters, + node.body + )); + } + var modifiers = getModifierKindFromSource( + node, + 93 + /* SyntaxKind.ExportKeyword */ + ); + var cls = ts6.factory.createClassDeclaration( + modifiers, + node.name, + /*typeParameters*/ + void 0, + /*heritageClauses*/ + void 0, + memberElements + ); + return cls; + } + } + function getModifierKindFromSource(source, kind) { + return ts6.canHaveModifiers(source) ? ts6.filter(source.modifiers, function(modifier) { + return modifier.kind === kind; + }) : void 0; + } + function isConstructorAssignment(x) { + if (!x.name) + return false; + if (ts6.isIdentifier(x.name) && x.name.text === "constructor") + return true; + return false; + } + function tryGetPropertyName(node, compilerOptions, quotePreference) { + if (ts6.isPropertyAccessExpression(node)) { + return node.name; + } + var propName = node.argumentExpression; + if (ts6.isNumericLiteral(propName)) { + return propName; + } + if (ts6.isStringLiteralLike(propName)) { + return ts6.isIdentifierText(propName.text, ts6.getEmitScriptTarget(compilerOptions)) ? ts6.factory.createIdentifier(propName.text) : ts6.isNoSubstitutionTemplateLiteral(propName) ? ts6.factory.createStringLiteral( + propName.text, + quotePreference === 0 + /* QuotePreference.Single */ + ) : propName; + } + return void 0; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "convertToAsyncFunction"; + var errorCodes = [ts6.Diagnostics.This_may_be_converted_to_an_async_function.code]; + var codeActionSucceeded = true; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + codeActionSucceeded = true; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return convertToAsyncFunction(t, context.sourceFile, context.span.start, context.program.getTypeChecker()); + }); + return codeActionSucceeded ? [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_to_async_function, fixId, ts6.Diagnostics.Convert_all_to_async_functions)] : []; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, err) { + return convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker()); + }); + } + }); + var SynthBindingNameKind; + (function(SynthBindingNameKind2) { + SynthBindingNameKind2[SynthBindingNameKind2["Identifier"] = 0] = "Identifier"; + SynthBindingNameKind2[SynthBindingNameKind2["BindingPattern"] = 1] = "BindingPattern"; + })(SynthBindingNameKind || (SynthBindingNameKind = {})); + function convertToAsyncFunction(changes, sourceFile, position, checker) { + var tokenAtPosition = ts6.getTokenAtPosition(sourceFile, position); + var functionToConvert; + if (ts6.isIdentifier(tokenAtPosition) && ts6.isVariableDeclaration(tokenAtPosition.parent) && tokenAtPosition.parent.initializer && ts6.isFunctionLikeDeclaration(tokenAtPosition.parent.initializer)) { + functionToConvert = tokenAtPosition.parent.initializer; + } else { + functionToConvert = ts6.tryCast(ts6.getContainingFunction(ts6.getTokenAtPosition(sourceFile, position)), ts6.canBeConvertedToAsync); + } + if (!functionToConvert) { + return; + } + var synthNamesMap = new ts6.Map(); + var isInJavascript = ts6.isInJSFile(functionToConvert); + var setOfExpressionsToReturn = getAllPromiseExpressionsToReturn(functionToConvert, checker); + var functionToConvertRenamed = renameCollidingVarNames(functionToConvert, checker, synthNamesMap); + if (!ts6.returnsPromise(functionToConvertRenamed, checker)) { + return; + } + var returnStatements = functionToConvertRenamed.body && ts6.isBlock(functionToConvertRenamed.body) ? getReturnStatementsWithPromiseHandlers(functionToConvertRenamed.body, checker) : ts6.emptyArray; + var transformer = { checker, synthNamesMap, setOfExpressionsToReturn, isInJSFile: isInJavascript }; + if (!returnStatements.length) { + return; + } + var pos = ts6.skipTrivia(sourceFile.text, ts6.moveRangePastModifiers(functionToConvert).pos); + changes.insertModifierAt(sourceFile, pos, 132, { suffix: " " }); + var _loop_12 = function(returnStatement2) { + ts6.forEachChild(returnStatement2, function visit(node) { + if (ts6.isCallExpression(node)) { + var newNodes = transformExpression( + node, + node, + transformer, + /*hasContinuation*/ + false + ); + if (hasFailed()) { + return true; + } + changes.replaceNodeWithNodes(sourceFile, returnStatement2, newNodes); + } else if (!ts6.isFunctionLike(node)) { + ts6.forEachChild(node, visit); + if (hasFailed()) { + return true; + } + } + }); + if (hasFailed()) { + return { value: void 0 }; + } + }; + for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) { + var returnStatement = returnStatements_1[_i]; + var state_5 = _loop_12(returnStatement); + if (typeof state_5 === "object") + return state_5.value; + } + } + function getReturnStatementsWithPromiseHandlers(body, checker) { + var res = []; + ts6.forEachReturnStatement(body, function(ret) { + if (ts6.isReturnStatementWithFixablePromiseHandler(ret, checker)) + res.push(ret); + }); + return res; + } + function getAllPromiseExpressionsToReturn(func, checker) { + if (!func.body) { + return new ts6.Set(); + } + var setOfExpressionsToReturn = new ts6.Set(); + ts6.forEachChild(func.body, function visit(node) { + if (isPromiseReturningCallExpression(node, checker, "then")) { + setOfExpressionsToReturn.add(ts6.getNodeId(node)); + ts6.forEach(node.arguments, visit); + } else if (isPromiseReturningCallExpression(node, checker, "catch") || isPromiseReturningCallExpression(node, checker, "finally")) { + setOfExpressionsToReturn.add(ts6.getNodeId(node)); + ts6.forEachChild(node, visit); + } else if (isPromiseTypedExpression(node, checker)) { + setOfExpressionsToReturn.add(ts6.getNodeId(node)); + } else { + ts6.forEachChild(node, visit); + } + }); + return setOfExpressionsToReturn; + } + function isPromiseReturningCallExpression(node, checker, name) { + if (!ts6.isCallExpression(node)) + return false; + var isExpressionOfName = ts6.hasPropertyAccessExpressionWithName(node, name); + var nodeType = isExpressionOfName && checker.getTypeAtLocation(node); + return !!(nodeType && checker.getPromisedTypeOfPromise(nodeType)); + } + function isReferenceToType(type, target) { + return (ts6.getObjectFlags(type) & 4) !== 0 && type.target === target; + } + function getExplicitPromisedTypeOfPromiseReturningCallExpression(node, callback, checker) { + if (node.expression.name.escapedText === "finally") { + return void 0; + } + var promiseType = checker.getTypeAtLocation(node.expression.expression); + if (isReferenceToType(promiseType, checker.getPromiseType()) || isReferenceToType(promiseType, checker.getPromiseLikeType())) { + if (node.expression.name.escapedText === "then") { + if (callback === ts6.elementAt(node.arguments, 0)) { + return ts6.elementAt(node.typeArguments, 0); + } else if (callback === ts6.elementAt(node.arguments, 1)) { + return ts6.elementAt(node.typeArguments, 1); + } + } else { + return ts6.elementAt(node.typeArguments, 0); + } + } + } + function isPromiseTypedExpression(node, checker) { + if (!ts6.isExpression(node)) + return false; + return !!checker.getPromisedTypeOfPromise(checker.getTypeAtLocation(node)); + } + function renameCollidingVarNames(nodeToRename, checker, synthNamesMap) { + var identsToRenameMap = new ts6.Map(); + var collidingSymbolMap = ts6.createMultiMap(); + ts6.forEachChild(nodeToRename, function visit(node) { + if (!ts6.isIdentifier(node)) { + ts6.forEachChild(node, visit); + return; + } + var symbol = checker.getSymbolAtLocation(node); + if (symbol) { + var type = checker.getTypeAtLocation(node); + var lastCallSignature = getLastCallSignature(type, checker); + var symbolIdString = ts6.getSymbolId(symbol).toString(); + if (lastCallSignature && !ts6.isParameter(node.parent) && !ts6.isFunctionLikeDeclaration(node.parent) && !synthNamesMap.has(symbolIdString)) { + var firstParameter = ts6.firstOrUndefined(lastCallSignature.parameters); + var ident = (firstParameter === null || firstParameter === void 0 ? void 0 : firstParameter.valueDeclaration) && ts6.isParameter(firstParameter.valueDeclaration) && ts6.tryCast(firstParameter.valueDeclaration.name, ts6.isIdentifier) || ts6.factory.createUniqueName( + "result", + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ); + var synthName = getNewNameIfConflict(ident, collidingSymbolMap); + synthNamesMap.set(symbolIdString, synthName); + collidingSymbolMap.add(ident.text, symbol); + } else if (node.parent && (ts6.isParameter(node.parent) || ts6.isVariableDeclaration(node.parent) || ts6.isBindingElement(node.parent))) { + var originalName = node.text; + var collidingSymbols = collidingSymbolMap.get(originalName); + if (collidingSymbols && collidingSymbols.some(function(prevSymbol) { + return prevSymbol !== symbol; + })) { + var newName = getNewNameIfConflict(node, collidingSymbolMap); + identsToRenameMap.set(symbolIdString, newName.identifier); + synthNamesMap.set(symbolIdString, newName); + collidingSymbolMap.add(originalName, symbol); + } else { + var identifier = ts6.getSynthesizedDeepClone(node); + synthNamesMap.set(symbolIdString, createSynthIdentifier(identifier)); + collidingSymbolMap.add(originalName, symbol); + } + } + } + }); + return ts6.getSynthesizedDeepCloneWithReplacements( + nodeToRename, + /*includeTrivia*/ + true, + function(original) { + if (ts6.isBindingElement(original) && ts6.isIdentifier(original.name) && ts6.isObjectBindingPattern(original.parent)) { + var symbol = checker.getSymbolAtLocation(original.name); + var renameInfo = symbol && identsToRenameMap.get(String(ts6.getSymbolId(symbol))); + if (renameInfo && renameInfo.text !== (original.name || original.propertyName).getText()) { + return ts6.factory.createBindingElement(original.dotDotDotToken, original.propertyName || original.name, renameInfo, original.initializer); + } + } else if (ts6.isIdentifier(original)) { + var symbol = checker.getSymbolAtLocation(original); + var renameInfo = symbol && identsToRenameMap.get(String(ts6.getSymbolId(symbol))); + if (renameInfo) { + return ts6.factory.createIdentifier(renameInfo.text); + } + } + } + ); + } + function getNewNameIfConflict(name, originalNames) { + var numVarsSameName = (originalNames.get(name.text) || ts6.emptyArray).length; + var identifier = numVarsSameName === 0 ? name : ts6.factory.createIdentifier(name.text + "_" + numVarsSameName); + return createSynthIdentifier(identifier); + } + function hasFailed() { + return !codeActionSucceeded; + } + function silentFail() { + codeActionSucceeded = false; + return ts6.emptyArray; + } + function transformExpression(returnContextNode, node, transformer, hasContinuation, continuationArgName) { + if (isPromiseReturningCallExpression(node, transformer.checker, "then")) { + return transformThen(node, ts6.elementAt(node.arguments, 0), ts6.elementAt(node.arguments, 1), transformer, hasContinuation, continuationArgName); + } + if (isPromiseReturningCallExpression(node, transformer.checker, "catch")) { + return transformCatch(node, ts6.elementAt(node.arguments, 0), transformer, hasContinuation, continuationArgName); + } + if (isPromiseReturningCallExpression(node, transformer.checker, "finally")) { + return transformFinally(node, ts6.elementAt(node.arguments, 0), transformer, hasContinuation, continuationArgName); + } + if (ts6.isPropertyAccessExpression(node)) { + return transformExpression(returnContextNode, node.expression, transformer, hasContinuation, continuationArgName); + } + var nodeType = transformer.checker.getTypeAtLocation(node); + if (nodeType && transformer.checker.getPromisedTypeOfPromise(nodeType)) { + ts6.Debug.assertNode(ts6.getOriginalNode(node).parent, ts6.isPropertyAccessExpression); + return transformPromiseExpressionOfPropertyAccess(returnContextNode, node, transformer, hasContinuation, continuationArgName); + } + return silentFail(); + } + function isNullOrUndefined(_a, node) { + var checker = _a.checker; + if (node.kind === 104) + return true; + if (ts6.isIdentifier(node) && !ts6.isGeneratedIdentifier(node) && ts6.idText(node) === "undefined") { + var symbol = checker.getSymbolAtLocation(node); + return !symbol || checker.isUndefinedSymbol(symbol); + } + return false; + } + function createUniqueSynthName(prevArgName) { + var renamedPrevArg = ts6.factory.createUniqueName( + prevArgName.identifier.text, + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ); + return createSynthIdentifier(renamedPrevArg); + } + function getPossibleNameForVarDecl(node, transformer, continuationArgName) { + var possibleNameForVarDecl; + if (continuationArgName && !shouldReturn(node, transformer)) { + if (isSynthIdentifier(continuationArgName)) { + possibleNameForVarDecl = continuationArgName; + transformer.synthNamesMap.forEach(function(val, key) { + if (val.identifier.text === continuationArgName.identifier.text) { + var newSynthName = createUniqueSynthName(continuationArgName); + transformer.synthNamesMap.set(key, newSynthName); + } + }); + } else { + possibleNameForVarDecl = createSynthIdentifier(ts6.factory.createUniqueName( + "result", + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ), continuationArgName.types); + } + declareSynthIdentifier(possibleNameForVarDecl); + } + return possibleNameForVarDecl; + } + function finishCatchOrFinallyTransform(node, transformer, tryStatement, possibleNameForVarDecl, continuationArgName) { + var statements = []; + var varDeclIdentifier; + if (possibleNameForVarDecl && !shouldReturn(node, transformer)) { + varDeclIdentifier = ts6.getSynthesizedDeepClone(declareSynthIdentifier(possibleNameForVarDecl)); + var typeArray = possibleNameForVarDecl.types; + var unionType = transformer.checker.getUnionType( + typeArray, + 2 + /* UnionReduction.Subtype */ + ); + var unionTypeNode = transformer.isInJSFile ? void 0 : transformer.checker.typeToTypeNode( + unionType, + /*enclosingDeclaration*/ + void 0, + /*flags*/ + void 0 + ); + var varDecl = [ts6.factory.createVariableDeclaration( + varDeclIdentifier, + /*exclamationToken*/ + void 0, + unionTypeNode + )]; + var varDeclList = ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + varDecl, + 1 + /* NodeFlags.Let */ + ) + ); + statements.push(varDeclList); + } + statements.push(tryStatement); + if (continuationArgName && varDeclIdentifier && isSynthBindingPattern(continuationArgName)) { + statements.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ + ts6.factory.createVariableDeclaration( + ts6.getSynthesizedDeepClone(declareSynthBindingPattern(continuationArgName)), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + varDeclIdentifier + ) + ], + 2 + /* NodeFlags.Const */ + ) + )); + } + return statements; + } + function transformFinally(node, onFinally, transformer, hasContinuation, continuationArgName) { + if (!onFinally || isNullOrUndefined(transformer, onFinally)) { + return transformExpression( + /* returnContextNode */ + node, + node.expression.expression, + transformer, + hasContinuation, + continuationArgName + ); + } + var possibleNameForVarDecl = getPossibleNameForVarDecl(node, transformer, continuationArgName); + var inlinedLeftHandSide = transformExpression( + /*returnContextNode*/ + node, + node.expression.expression, + transformer, + /*hasContinuation*/ + true, + possibleNameForVarDecl + ); + if (hasFailed()) + return silentFail(); + var inlinedCallback = transformCallbackArgument( + onFinally, + hasContinuation, + /*continuationArgName*/ + void 0, + /*argName*/ + void 0, + node, + transformer + ); + if (hasFailed()) + return silentFail(); + var tryBlock = ts6.factory.createBlock(inlinedLeftHandSide); + var finallyBlock = ts6.factory.createBlock(inlinedCallback); + var tryStatement = ts6.factory.createTryStatement( + tryBlock, + /*catchClause*/ + void 0, + finallyBlock + ); + return finishCatchOrFinallyTransform(node, transformer, tryStatement, possibleNameForVarDecl, continuationArgName); + } + function transformCatch(node, onRejected, transformer, hasContinuation, continuationArgName) { + if (!onRejected || isNullOrUndefined(transformer, onRejected)) { + return transformExpression( + /* returnContextNode */ + node, + node.expression.expression, + transformer, + hasContinuation, + continuationArgName + ); + } + var inputArgName = getArgBindingName(onRejected, transformer); + var possibleNameForVarDecl = getPossibleNameForVarDecl(node, transformer, continuationArgName); + var inlinedLeftHandSide = transformExpression( + /*returnContextNode*/ + node, + node.expression.expression, + transformer, + /*hasContinuation*/ + true, + possibleNameForVarDecl + ); + if (hasFailed()) + return silentFail(); + var inlinedCallback = transformCallbackArgument(onRejected, hasContinuation, possibleNameForVarDecl, inputArgName, node, transformer); + if (hasFailed()) + return silentFail(); + var tryBlock = ts6.factory.createBlock(inlinedLeftHandSide); + var catchClause = ts6.factory.createCatchClause(inputArgName && ts6.getSynthesizedDeepClone(declareSynthBindingName(inputArgName)), ts6.factory.createBlock(inlinedCallback)); + var tryStatement = ts6.factory.createTryStatement( + tryBlock, + catchClause, + /*finallyBlock*/ + void 0 + ); + return finishCatchOrFinallyTransform(node, transformer, tryStatement, possibleNameForVarDecl, continuationArgName); + } + function transformThen(node, onFulfilled, onRejected, transformer, hasContinuation, continuationArgName) { + if (!onFulfilled || isNullOrUndefined(transformer, onFulfilled)) { + return transformCatch(node, onRejected, transformer, hasContinuation, continuationArgName); + } + if (onRejected && !isNullOrUndefined(transformer, onRejected)) { + return silentFail(); + } + var inputArgName = getArgBindingName(onFulfilled, transformer); + var inlinedLeftHandSide = transformExpression( + node.expression.expression, + node.expression.expression, + transformer, + /*hasContinuation*/ + true, + inputArgName + ); + if (hasFailed()) + return silentFail(); + var inlinedCallback = transformCallbackArgument(onFulfilled, hasContinuation, continuationArgName, inputArgName, node, transformer); + if (hasFailed()) + return silentFail(); + return ts6.concatenate(inlinedLeftHandSide, inlinedCallback); + } + function transformPromiseExpressionOfPropertyAccess(returnContextNode, node, transformer, hasContinuation, continuationArgName) { + if (shouldReturn(returnContextNode, transformer)) { + var returnValue = ts6.getSynthesizedDeepClone(node); + if (hasContinuation) { + returnValue = ts6.factory.createAwaitExpression(returnValue); + } + return [ts6.factory.createReturnStatement(returnValue)]; + } + return createVariableOrAssignmentOrExpressionStatement( + continuationArgName, + ts6.factory.createAwaitExpression(node), + /*typeAnnotation*/ + void 0 + ); + } + function createVariableOrAssignmentOrExpressionStatement(variableName, rightHandSide, typeAnnotation) { + if (!variableName || isEmptyBindingName(variableName)) { + return [ts6.factory.createExpressionStatement(rightHandSide)]; + } + if (isSynthIdentifier(variableName) && variableName.hasBeenDeclared) { + return [ts6.factory.createExpressionStatement(ts6.factory.createAssignment(ts6.getSynthesizedDeepClone(referenceSynthIdentifier(variableName)), rightHandSide))]; + } + return [ + ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ + ts6.factory.createVariableDeclaration( + ts6.getSynthesizedDeepClone(declareSynthBindingName(variableName)), + /*exclamationToken*/ + void 0, + typeAnnotation, + rightHandSide + ) + ], + 2 + /* NodeFlags.Const */ + ) + ) + ]; + } + function maybeAnnotateAndReturn(expressionToReturn, typeAnnotation) { + if (typeAnnotation && expressionToReturn) { + var name = ts6.factory.createUniqueName( + "result", + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ); + return __spreadArray(__spreadArray([], createVariableOrAssignmentOrExpressionStatement(createSynthIdentifier(name), expressionToReturn, typeAnnotation), true), [ + ts6.factory.createReturnStatement(name) + ], false); + } + return [ts6.factory.createReturnStatement(expressionToReturn)]; + } + function transformCallbackArgument(func, hasContinuation, continuationArgName, inputArgName, parent, transformer) { + var _a; + switch (func.kind) { + case 104: + break; + case 208: + case 79: + if (!inputArgName) { + break; + } + var synthCall = ts6.factory.createCallExpression( + ts6.getSynthesizedDeepClone(func), + /*typeArguments*/ + void 0, + isSynthIdentifier(inputArgName) ? [referenceSynthIdentifier(inputArgName)] : [] + ); + if (shouldReturn(parent, transformer)) { + return maybeAnnotateAndReturn(synthCall, getExplicitPromisedTypeOfPromiseReturningCallExpression(parent, func, transformer.checker)); + } + var type = transformer.checker.getTypeAtLocation(func); + var callSignatures = transformer.checker.getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + if (!callSignatures.length) { + return silentFail(); + } + var returnType = callSignatures[0].getReturnType(); + var varDeclOrAssignment = createVariableOrAssignmentOrExpressionStatement(continuationArgName, ts6.factory.createAwaitExpression(synthCall), getExplicitPromisedTypeOfPromiseReturningCallExpression(parent, func, transformer.checker)); + if (continuationArgName) { + continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); + } + return varDeclOrAssignment; + case 215: + case 216: { + var funcBody = func.body; + var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); + if (ts6.isBlock(funcBody)) { + var refactoredStmts = []; + var seenReturnStatement = false; + for (var _i = 0, _b = funcBody.statements; _i < _b.length; _i++) { + var statement = _b[_i]; + if (ts6.isReturnStatement(statement)) { + seenReturnStatement = true; + if (ts6.isReturnStatementWithFixablePromiseHandler(statement, transformer.checker)) { + refactoredStmts = refactoredStmts.concat(transformReturnStatementWithFixablePromiseHandler(transformer, statement, hasContinuation, continuationArgName)); + } else { + var possiblyAwaitedRightHandSide = returnType_1 && statement.expression ? getPossiblyAwaitedRightHandSide(transformer.checker, returnType_1, statement.expression) : statement.expression; + refactoredStmts.push.apply(refactoredStmts, maybeAnnotateAndReturn(possiblyAwaitedRightHandSide, getExplicitPromisedTypeOfPromiseReturningCallExpression(parent, func, transformer.checker))); + } + } else if (hasContinuation && ts6.forEachReturnStatement(statement, ts6.returnTrue)) { + return silentFail(); + } else { + refactoredStmts.push(statement); + } + } + return shouldReturn(parent, transformer) ? refactoredStmts.map(function(s) { + return ts6.getSynthesizedDeepClone(s); + }) : removeReturns(refactoredStmts, continuationArgName, transformer, seenReturnStatement); + } else { + var inlinedStatements = ts6.isFixablePromiseHandler(funcBody, transformer.checker) ? transformReturnStatementWithFixablePromiseHandler(transformer, ts6.factory.createReturnStatement(funcBody), hasContinuation, continuationArgName) : ts6.emptyArray; + if (inlinedStatements.length > 0) { + return inlinedStatements; + } + if (returnType_1) { + var possiblyAwaitedRightHandSide = getPossiblyAwaitedRightHandSide(transformer.checker, returnType_1, funcBody); + if (!shouldReturn(parent, transformer)) { + var transformedStatement = createVariableOrAssignmentOrExpressionStatement( + continuationArgName, + possiblyAwaitedRightHandSide, + /*typeAnnotation*/ + void 0 + ); + if (continuationArgName) { + continuationArgName.types.push(transformer.checker.getAwaitedType(returnType_1) || returnType_1); + } + return transformedStatement; + } else { + return maybeAnnotateAndReturn(possiblyAwaitedRightHandSide, getExplicitPromisedTypeOfPromiseReturningCallExpression(parent, func, transformer.checker)); + } + } else { + return silentFail(); + } + } + } + default: + return silentFail(); + } + return ts6.emptyArray; + } + function getPossiblyAwaitedRightHandSide(checker, type, expr) { + var rightHandSide = ts6.getSynthesizedDeepClone(expr); + return !!checker.getPromisedTypeOfPromise(type) ? ts6.factory.createAwaitExpression(rightHandSide) : rightHandSide; + } + function getLastCallSignature(type, checker) { + var callSignatures = checker.getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + return ts6.lastOrUndefined(callSignatures); + } + function removeReturns(stmts, prevArgName, transformer, seenReturnStatement) { + var ret = []; + for (var _i = 0, stmts_1 = stmts; _i < stmts_1.length; _i++) { + var stmt = stmts_1[_i]; + if (ts6.isReturnStatement(stmt)) { + if (stmt.expression) { + var possiblyAwaitedExpression = isPromiseTypedExpression(stmt.expression, transformer.checker) ? ts6.factory.createAwaitExpression(stmt.expression) : stmt.expression; + if (prevArgName === void 0) { + ret.push(ts6.factory.createExpressionStatement(possiblyAwaitedExpression)); + } else if (isSynthIdentifier(prevArgName) && prevArgName.hasBeenDeclared) { + ret.push(ts6.factory.createExpressionStatement(ts6.factory.createAssignment(referenceSynthIdentifier(prevArgName), possiblyAwaitedExpression))); + } else { + ret.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ts6.factory.createVariableDeclaration( + declareSynthBindingName(prevArgName), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + possiblyAwaitedExpression + )], + 2 + /* NodeFlags.Const */ + ) + )); + } + } + } else { + ret.push(ts6.getSynthesizedDeepClone(stmt)); + } + } + if (!seenReturnStatement && prevArgName !== void 0) { + ret.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ts6.factory.createVariableDeclaration( + declareSynthBindingName(prevArgName), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.factory.createIdentifier("undefined") + )], + 2 + /* NodeFlags.Const */ + ) + )); + } + return ret; + } + function transformReturnStatementWithFixablePromiseHandler(transformer, innerRetStmt, hasContinuation, continuationArgName) { + var innerCbBody = []; + ts6.forEachChild(innerRetStmt, function visit(node) { + if (ts6.isCallExpression(node)) { + var temp = transformExpression(node, node, transformer, hasContinuation, continuationArgName); + innerCbBody = innerCbBody.concat(temp); + if (innerCbBody.length > 0) { + return; + } + } else if (!ts6.isFunctionLike(node)) { + ts6.forEachChild(node, visit); + } + }); + return innerCbBody; + } + function getArgBindingName(funcNode, transformer) { + var types = []; + var name; + if (ts6.isFunctionLikeDeclaration(funcNode)) { + if (funcNode.parameters.length > 0) { + var param = funcNode.parameters[0].name; + name = getMappedBindingNameOrDefault(param); + } + } else if (ts6.isIdentifier(funcNode)) { + name = getMapEntryOrDefault(funcNode); + } else if (ts6.isPropertyAccessExpression(funcNode) && ts6.isIdentifier(funcNode.name)) { + name = getMapEntryOrDefault(funcNode.name); + } + if (!name || "identifier" in name && name.identifier.text === "undefined") { + return void 0; + } + return name; + function getMappedBindingNameOrDefault(bindingName) { + if (ts6.isIdentifier(bindingName)) + return getMapEntryOrDefault(bindingName); + var elements = ts6.flatMap(bindingName.elements, function(element) { + if (ts6.isOmittedExpression(element)) + return []; + return [getMappedBindingNameOrDefault(element.name)]; + }); + return createSynthBindingPattern(bindingName, elements); + } + function getMapEntryOrDefault(identifier) { + var originalNode = getOriginalNode(identifier); + var symbol = getSymbol(originalNode); + if (!symbol) { + return createSynthIdentifier(identifier, types); + } + var mapEntry = transformer.synthNamesMap.get(ts6.getSymbolId(symbol).toString()); + return mapEntry || createSynthIdentifier(identifier, types); + } + function getSymbol(node) { + return node.symbol ? node.symbol : transformer.checker.getSymbolAtLocation(node); + } + function getOriginalNode(node) { + return node.original ? node.original : node; + } + } + function isEmptyBindingName(bindingName) { + if (!bindingName) { + return true; + } + if (isSynthIdentifier(bindingName)) { + return !bindingName.identifier.text; + } + return ts6.every(bindingName.elements, isEmptyBindingName); + } + function createSynthIdentifier(identifier, types) { + if (types === void 0) { + types = []; + } + return { kind: 0, identifier, types, hasBeenDeclared: false, hasBeenReferenced: false }; + } + function createSynthBindingPattern(bindingPattern, elements, types) { + if (elements === void 0) { + elements = ts6.emptyArray; + } + if (types === void 0) { + types = []; + } + return { kind: 1, bindingPattern, elements, types }; + } + function referenceSynthIdentifier(synthId) { + synthId.hasBeenReferenced = true; + return synthId.identifier; + } + function declareSynthBindingName(synthName) { + return isSynthIdentifier(synthName) ? declareSynthIdentifier(synthName) : declareSynthBindingPattern(synthName); + } + function declareSynthBindingPattern(synthPattern) { + for (var _i = 0, _a = synthPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + declareSynthBindingName(element); + } + return synthPattern.bindingPattern; + } + function declareSynthIdentifier(synthId) { + synthId.hasBeenDeclared = true; + return synthId.identifier; + } + function isSynthIdentifier(bindingName) { + return bindingName.kind === 0; + } + function isSynthBindingPattern(bindingName) { + return bindingName.kind === 1; + } + function shouldReturn(expression, transformer) { + return !!expression.original && transformer.setOfExpressionsToReturn.has(ts6.getNodeId(expression.original)); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + codefix2.registerCodeFix({ + errorCodes: [ts6.Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code], + getCodeActions: function(context) { + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences; + var changes = ts6.textChanges.ChangeTracker.with(context, function(changes2) { + var moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, ts6.getEmitScriptTarget(program.getCompilerOptions()), ts6.getQuotePreference(sourceFile, preferences)); + if (moduleExportsChangedToDefault) { + for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { + var importingFile = _a[_i]; + fixImportOfModuleExports(importingFile, sourceFile, changes2, ts6.getQuotePreference(importingFile, preferences)); + } + } + }); + return [codefix2.createCodeFixActionWithoutFixAll("convertToEsModule", changes, ts6.Diagnostics.Convert_to_ES_module)]; + } + }); + function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) { + for (var _i = 0, _a = importingFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + var imported = ts6.getResolvedModule(importingFile, moduleSpecifier.text, ts6.getModeForUsageLocation(importingFile, moduleSpecifier)); + if (!imported || imported.resolvedFileName !== exportingFile.fileName) { + continue; + } + var importNode = ts6.importFromModuleSpecifier(moduleSpecifier); + switch (importNode.kind) { + case 268: + changes.replaceNode(importingFile, importNode, ts6.makeImport( + importNode.name, + /*namedImports*/ + void 0, + moduleSpecifier, + quotePreference + )); + break; + case 210: + if (ts6.isRequireCall( + importNode, + /*checkArgumentIsStringLiteralLike*/ + false + )) { + changes.replaceNode(importingFile, importNode, ts6.factory.createPropertyAccessExpression(ts6.getSynthesizedDeepClone(importNode), "default")); + } + break; + } + } + } + function convertFileToEsModule(sourceFile, checker, changes, target, quotePreference) { + var identifiers = { original: collectFreeIdentifiers(sourceFile), additional: new ts6.Set() }; + var exports2 = collectExportRenames(sourceFile, checker, identifiers); + convertExportsAccesses(sourceFile, exports2, changes); + var moduleExportsChangedToDefault = false; + var useSitesToUnqualify; + for (var _i = 0, _a = ts6.filter(sourceFile.statements, ts6.isVariableStatement); _i < _a.length; _i++) { + var statement = _a[_i]; + var newUseSites = convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); + if (newUseSites) { + ts6.copyEntries(newUseSites, useSitesToUnqualify !== null && useSitesToUnqualify !== void 0 ? useSitesToUnqualify : useSitesToUnqualify = new ts6.Map()); + } + } + for (var _b = 0, _c = ts6.filter(sourceFile.statements, function(s) { + return !ts6.isVariableStatement(s); + }); _b < _c.length; _b++) { + var statement = _c[_b]; + var moduleExportsChanged = convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports2, useSitesToUnqualify, quotePreference); + moduleExportsChangedToDefault = moduleExportsChangedToDefault || moduleExportsChanged; + } + useSitesToUnqualify === null || useSitesToUnqualify === void 0 ? void 0 : useSitesToUnqualify.forEach(function(replacement, original) { + changes.replaceNode(sourceFile, original, replacement); + }); + return moduleExportsChangedToDefault; + } + function collectExportRenames(sourceFile, checker, identifiers) { + var res = new ts6.Map(); + forEachExportReference(sourceFile, function(node) { + var _a = node.name, text = _a.text, originalKeywordKind = _a.originalKeywordKind; + if (!res.has(text) && (originalKeywordKind !== void 0 && ts6.isNonContextualKeyword(originalKeywordKind) || checker.resolveName( + text, + node, + 111551, + /*excludeGlobals*/ + true + ))) { + res.set(text, makeUniqueName("_".concat(text), identifiers)); + } + }); + return res; + } + function convertExportsAccesses(sourceFile, exports2, changes) { + forEachExportReference(sourceFile, function(node, isAssignmentLhs) { + if (isAssignmentLhs) { + return; + } + var text = node.name.text; + changes.replaceNode(sourceFile, node, ts6.factory.createIdentifier(exports2.get(text) || text)); + }); + } + function forEachExportReference(sourceFile, cb) { + sourceFile.forEachChild(function recur(node) { + if (ts6.isPropertyAccessExpression(node) && ts6.isExportsOrModuleExportsOrAlias(sourceFile, node.expression) && ts6.isIdentifier(node.name)) { + var parent = node.parent; + cb( + node, + ts6.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 63 + /* SyntaxKind.EqualsToken */ + ); + } + node.forEachChild(recur); + }); + } + function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports2, useSitesToUnqualify, quotePreference) { + switch (statement.kind) { + case 240: + convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); + return false; + case 241: { + var expression = statement.expression; + switch (expression.kind) { + case 210: { + if (ts6.isRequireCall( + expression, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + changes.replaceNode(sourceFile, statement, ts6.makeImport( + /*name*/ + void 0, + /*namedImports*/ + void 0, + expression.arguments[0], + quotePreference + )); + } + return false; + } + case 223: { + var operatorToken = expression.operatorToken; + return operatorToken.kind === 63 && convertAssignment(sourceFile, checker, expression, changes, exports2, useSitesToUnqualify); + } + } + } + default: + return false; + } + } + function convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference) { + var declarationList = statement.declarationList; + var foundImport = false; + var converted = ts6.map(declarationList.declarations, function(decl) { + var name = decl.name, initializer = decl.initializer; + if (initializer) { + if (ts6.isExportsOrModuleExportsOrAlias(sourceFile, initializer)) { + foundImport = true; + return convertedImports([]); + } else if (ts6.isRequireCall( + initializer, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + foundImport = true; + return convertSingleImport(name, initializer.arguments[0], checker, identifiers, target, quotePreference); + } else if (ts6.isPropertyAccessExpression(initializer) && ts6.isRequireCall( + initializer.expression, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + foundImport = true; + return convertPropertyAccessImport(name, initializer.name.text, initializer.expression.arguments[0], identifiers, quotePreference); + } + } + return convertedImports([ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList([decl], declarationList.flags) + )]); + }); + if (foundImport) { + changes.replaceNodeWithNodes(sourceFile, statement, ts6.flatMap(converted, function(c) { + return c.newImports; + })); + var combinedUseSites_1; + ts6.forEach(converted, function(c) { + if (c.useSitesToUnqualify) { + ts6.copyEntries(c.useSitesToUnqualify, combinedUseSites_1 !== null && combinedUseSites_1 !== void 0 ? combinedUseSites_1 : combinedUseSites_1 = new ts6.Map()); + } + }); + return combinedUseSites_1; + } + } + function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { + switch (name.kind) { + case 203: + case 204: { + var tmp = makeUniqueName(propertyName, identifiers); + return convertedImports([ + makeSingleImport(tmp, propertyName, moduleSpecifier, quotePreference), + makeConst( + /*modifiers*/ + void 0, + name, + ts6.factory.createIdentifier(tmp) + ) + ]); + } + case 79: + return convertedImports([makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]); + default: + return ts6.Debug.assertNever(name, "Convert to ES module got invalid syntax form ".concat(name.kind)); + } + } + function convertAssignment(sourceFile, checker, assignment, changes, exports2, useSitesToUnqualify) { + var left = assignment.left, right = assignment.right; + if (!ts6.isPropertyAccessExpression(left)) { + return false; + } + if (ts6.isExportsOrModuleExportsOrAlias(sourceFile, left)) { + if (ts6.isExportsOrModuleExportsOrAlias(sourceFile, right)) { + changes.delete(sourceFile, assignment.parent); + } else { + var replacement = ts6.isObjectLiteralExpression(right) ? tryChangeModuleExportsObject(right, useSitesToUnqualify) : ts6.isRequireCall( + right, + /*checkArgumentIsStringLiteralLike*/ + true + ) ? convertReExportAll(right.arguments[0], checker) : void 0; + if (replacement) { + changes.replaceNodeWithNodes(sourceFile, assignment.parent, replacement[0]); + return replacement[1]; + } else { + changes.replaceRangeWithText(sourceFile, ts6.createRange(left.getStart(sourceFile), right.pos), "export default"); + return true; + } + } + } else if (ts6.isExportsOrModuleExportsOrAlias(sourceFile, left.expression)) { + convertNamedExport(sourceFile, assignment, changes, exports2); + } + return false; + } + function tryChangeModuleExportsObject(object, useSitesToUnqualify) { + var statements = ts6.mapAllOrFail(object.properties, function(prop) { + switch (prop.kind) { + case 174: + case 175: + case 300: + case 301: + return void 0; + case 299: + return !ts6.isIdentifier(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); + case 171: + return !ts6.isIdentifier(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [ts6.factory.createToken( + 93 + /* SyntaxKind.ExportKeyword */ + )], prop, useSitesToUnqualify); + default: + ts6.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); + } + }); + return statements && [statements, false]; + } + function convertNamedExport(sourceFile, assignment, changes, exports2) { + var text = assignment.left.name.text; + var rename = exports2.get(text); + if (rename !== void 0) { + var newNodes = [ + makeConst( + /*modifiers*/ + void 0, + rename, + assignment.right + ), + makeExportDeclaration([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + rename, + text + )]) + ]; + changes.replaceNodeWithNodes(sourceFile, assignment.parent, newNodes); + } else { + convertExportsPropertyAssignment(assignment, sourceFile, changes); + } + } + function convertReExportAll(reExported, checker) { + var moduleSpecifier = reExported.text; + var moduleSymbol = checker.getSymbolAtLocation(reExported); + var exports2 = moduleSymbol ? moduleSymbol.exports : ts6.emptyMap; + return exports2.has( + "export=" + /* InternalSymbolName.ExportEquals */ + ) ? [[reExportDefault(moduleSpecifier)], true] : !exports2.has( + "default" + /* InternalSymbolName.Default */ + ) ? [[reExportStar(moduleSpecifier)], false] : ( + // If there's some non-default export, must include both `export *` and `export default`. + exports2.size > 1 ? [[reExportStar(moduleSpecifier), reExportDefault(moduleSpecifier)], true] : [[reExportDefault(moduleSpecifier)], true] + ); + } + function reExportStar(moduleSpecifier) { + return makeExportDeclaration( + /*exportClause*/ + void 0, + moduleSpecifier + ); + } + function reExportDefault(moduleSpecifier) { + return makeExportDeclaration([ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + /*propertyName*/ + void 0, + "default" + )], moduleSpecifier); + } + function convertExportsPropertyAssignment(_a, sourceFile, changes) { + var left = _a.left, right = _a.right, parent = _a.parent; + var name = left.name.text; + if ((ts6.isFunctionExpression(right) || ts6.isArrowFunction(right) || ts6.isClassExpression(right)) && (!right.name || right.name.text === name)) { + changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts6.factory.createToken( + 93 + /* SyntaxKind.ExportKeyword */ + ), { suffix: " " }); + if (!right.name) + changes.insertName(sourceFile, right, name); + var semi = ts6.findChildOfKind(parent, 26, sourceFile); + if (semi) + changes.delete(sourceFile, semi); + } else { + changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts6.findChildOfKind(left, 24, sourceFile), [ts6.factory.createToken( + 93 + /* SyntaxKind.ExportKeyword */ + ), ts6.factory.createToken( + 85 + /* SyntaxKind.ConstKeyword */ + )], { joiner: " ", suffix: " " }); + } + } + function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { + var modifiers = [ts6.factory.createToken( + 93 + /* SyntaxKind.ExportKeyword */ + )]; + switch (exported.kind) { + case 215: { + var expressionName = exported.name; + if (expressionName && expressionName.text !== name) { + return exportConst(); + } + } + case 216: + return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); + case 228: + return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); + default: + return exportConst(); + } + function exportConst() { + return makeConst(modifiers, ts6.factory.createIdentifier(name), replaceImportUseSites(exported, useSitesToUnqualify)); + } + } + function replaceImportUseSites(nodeOrNodes, useSitesToUnqualify) { + if (!useSitesToUnqualify || !ts6.some(ts6.arrayFrom(useSitesToUnqualify.keys()), function(original) { + return ts6.rangeContainsRange(nodeOrNodes, original); + })) { + return nodeOrNodes; + } + return ts6.isArray(nodeOrNodes) ? ts6.getSynthesizedDeepClonesWithReplacements( + nodeOrNodes, + /*includeTrivia*/ + true, + replaceNode + ) : ts6.getSynthesizedDeepCloneWithReplacements( + nodeOrNodes, + /*includeTrivia*/ + true, + replaceNode + ); + function replaceNode(original) { + if (original.kind === 208) { + var replacement = useSitesToUnqualify.get(original); + useSitesToUnqualify.delete(original); + return replacement; + } + } + } + function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { + switch (name.kind) { + case 203: { + var importSpecifiers = ts6.mapAllOrFail(name.elements, function(e) { + return e.dotDotDotToken || e.initializer || e.propertyName && !ts6.isIdentifier(e.propertyName) || !ts6.isIdentifier(e.name) ? void 0 : makeImportSpecifier(e.propertyName && e.propertyName.text, e.name.text); + }); + if (importSpecifiers) { + return convertedImports([ts6.makeImport( + /*name*/ + void 0, + importSpecifiers, + moduleSpecifier, + quotePreference + )]); + } + } + case 204: { + var tmp = makeUniqueName(codefix2.moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers); + return convertedImports([ + ts6.makeImport( + ts6.factory.createIdentifier(tmp), + /*namedImports*/ + void 0, + moduleSpecifier, + quotePreference + ), + makeConst( + /*modifiers*/ + void 0, + ts6.getSynthesizedDeepClone(name), + ts6.factory.createIdentifier(tmp) + ) + ]); + } + case 79: + return convertSingleIdentifierImport(name, moduleSpecifier, checker, identifiers, quotePreference); + default: + return ts6.Debug.assertNever(name, "Convert to ES module got invalid name kind ".concat(name.kind)); + } + } + function convertSingleIdentifierImport(name, moduleSpecifier, checker, identifiers, quotePreference) { + var nameSymbol = checker.getSymbolAtLocation(name); + var namedBindingsNames = new ts6.Map(); + var needDefaultImport = false; + var useSitesToUnqualify; + for (var _i = 0, _a = identifiers.original.get(name.text); _i < _a.length; _i++) { + var use = _a[_i]; + if (checker.getSymbolAtLocation(use) !== nameSymbol || use === name) { + continue; + } + var parent = use.parent; + if (ts6.isPropertyAccessExpression(parent)) { + var propertyName = parent.name.text; + if (propertyName === "default") { + needDefaultImport = true; + var importDefaultName = use.getText(); + (useSitesToUnqualify !== null && useSitesToUnqualify !== void 0 ? useSitesToUnqualify : useSitesToUnqualify = new ts6.Map()).set(parent, ts6.factory.createIdentifier(importDefaultName)); + } else { + ts6.Debug.assert(parent.expression === use, "Didn't expect expression === use"); + var idName2 = namedBindingsNames.get(propertyName); + if (idName2 === void 0) { + idName2 = makeUniqueName(propertyName, identifiers); + namedBindingsNames.set(propertyName, idName2); + } + (useSitesToUnqualify !== null && useSitesToUnqualify !== void 0 ? useSitesToUnqualify : useSitesToUnqualify = new ts6.Map()).set(parent, ts6.factory.createIdentifier(idName2)); + } + } else { + needDefaultImport = true; + } + } + var namedBindings = namedBindingsNames.size === 0 ? void 0 : ts6.arrayFrom(ts6.mapIterator(namedBindingsNames.entries(), function(_a2) { + var propertyName2 = _a2[0], idName3 = _a2[1]; + return ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + propertyName2 === idName3 ? void 0 : ts6.factory.createIdentifier(propertyName2), + ts6.factory.createIdentifier(idName3) + ); + })); + if (!namedBindings) { + needDefaultImport = true; + } + return convertedImports([ts6.makeImport(needDefaultImport ? ts6.getSynthesizedDeepClone(name) : void 0, namedBindings, moduleSpecifier, quotePreference)], useSitesToUnqualify); + } + function makeUniqueName(name, identifiers) { + while (identifiers.original.has(name) || identifiers.additional.has(name)) { + name = "_".concat(name); + } + identifiers.additional.add(name); + return name; + } + function collectFreeIdentifiers(file) { + var map = ts6.createMultiMap(); + forEachFreeIdentifier(file, function(id) { + return map.add(id.text, id); + }); + return map; + } + function forEachFreeIdentifier(node, cb) { + if (ts6.isIdentifier(node) && isFreeIdentifier(node)) + cb(node); + node.forEachChild(function(child) { + return forEachFreeIdentifier(child, cb); + }); + } + function isFreeIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 208: + return parent.name !== node; + case 205: + return parent.propertyName !== node; + case 273: + return parent.propertyName !== node; + default: + return true; + } + } + function functionExpressionToDeclaration(name, additionalModifiers, fn, useSitesToUnqualify) { + return ts6.factory.createFunctionDeclaration(ts6.concatenate(additionalModifiers, ts6.getSynthesizedDeepClones(fn.modifiers)), ts6.getSynthesizedDeepClone(fn.asteriskToken), name, ts6.getSynthesizedDeepClones(fn.typeParameters), ts6.getSynthesizedDeepClones(fn.parameters), ts6.getSynthesizedDeepClone(fn.type), ts6.factory.converters.convertToFunctionBlock(replaceImportUseSites(fn.body, useSitesToUnqualify))); + } + function classExpressionToDeclaration(name, additionalModifiers, cls, useSitesToUnqualify) { + return ts6.factory.createClassDeclaration(ts6.concatenate(additionalModifiers, ts6.getSynthesizedDeepClones(cls.modifiers)), name, ts6.getSynthesizedDeepClones(cls.typeParameters), ts6.getSynthesizedDeepClones(cls.heritageClauses), replaceImportUseSites(cls.members, useSitesToUnqualify)); + } + function makeSingleImport(localName, propertyName, moduleSpecifier, quotePreference) { + return propertyName === "default" ? ts6.makeImport( + ts6.factory.createIdentifier(localName), + /*namedImports*/ + void 0, + moduleSpecifier, + quotePreference + ) : ts6.makeImport( + /*name*/ + void 0, + [makeImportSpecifier(propertyName, localName)], + moduleSpecifier, + quotePreference + ); + } + function makeImportSpecifier(propertyName, name) { + return ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + propertyName !== void 0 && propertyName !== name ? ts6.factory.createIdentifier(propertyName) : void 0, + ts6.factory.createIdentifier(name) + ); + } + function makeConst(modifiers, name, init) { + return ts6.factory.createVariableStatement(modifiers, ts6.factory.createVariableDeclarationList( + [ts6.factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + init + )], + 2 + /* NodeFlags.Const */ + )); + } + function makeExportDeclaration(exportSpecifiers, moduleSpecifier) { + return ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + exportSpecifiers && ts6.factory.createNamedExports(exportSpecifiers), + moduleSpecifier === void 0 ? void 0 : ts6.factory.createStringLiteral(moduleSpecifier) + ); + } + function convertedImports(newImports, useSitesToUnqualify) { + return { + newImports, + useSitesToUnqualify + }; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "correctQualifiedNameToIndexedAccessType"; + var errorCodes = [ts6.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var qualifiedName = getQualifiedName(context.sourceFile, context.span.start); + if (!qualifiedName) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, qualifiedName); + }); + var newText = "".concat(qualifiedName.left.text, '["').concat(qualifiedName.right.text, '"]'); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, ts6.Diagnostics.Rewrite_all_as_indexed_access_types)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var q = getQualifiedName(diag.file, diag.start); + if (q) { + doChange(changes, diag.file, q); + } + }); + } + }); + function getQualifiedName(sourceFile, pos) { + var qualifiedName = ts6.findAncestor(ts6.getTokenAtPosition(sourceFile, pos), ts6.isQualifiedName); + ts6.Debug.assert(!!qualifiedName, "Expected position to be owned by a qualified name."); + return ts6.isIdentifier(qualifiedName.left) ? qualifiedName : void 0; + } + function doChange(changeTracker, sourceFile, qualifiedName) { + var rightText = qualifiedName.right.text; + var replacement = ts6.factory.createIndexedAccessTypeNode(ts6.factory.createTypeReferenceNode( + qualifiedName.left, + /*typeArguments*/ + void 0 + ), ts6.factory.createLiteralTypeNode(ts6.factory.createStringLiteral(rightText))); + changeTracker.replaceNode(sourceFile, qualifiedName, replacement); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodes = [ts6.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type.code]; + var fixId = "convertToTypeOnlyExport"; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context); + }); + if (changes.length) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_to_type_only_export, fixId, ts6.Diagnostics.Convert_all_re_exported_types_to_type_only_exports)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) { + var fixedExportDeclarations = new ts6.Map(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile); + if (exportSpecifier && ts6.addToSeen(fixedExportDeclarations, ts6.getNodeId(exportSpecifier.parent.parent))) { + fixSingleExportDeclaration(changes, exportSpecifier, context); + } + }); + } + }); + function getExportSpecifierForDiagnosticSpan(span, sourceFile) { + return ts6.tryCast(ts6.getTokenAtPosition(sourceFile, span.start).parent, ts6.isExportSpecifier); + } + function fixSingleExportDeclaration(changes, exportSpecifier, context) { + if (!exportSpecifier) { + return; + } + var exportClause = exportSpecifier.parent; + var exportDeclaration = exportClause.parent; + var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); + if (typeExportSpecifiers.length === exportClause.elements.length) { + changes.insertModifierBefore(context.sourceFile, 154, exportClause); + } else { + var valueExportDeclaration = ts6.factory.updateExportDeclaration( + exportDeclaration, + exportDeclaration.modifiers, + /*isTypeOnly*/ + false, + ts6.factory.updateNamedExports(exportClause, ts6.filter(exportClause.elements, function(e) { + return !ts6.contains(typeExportSpecifiers, e); + })), + exportDeclaration.moduleSpecifier, + /*assertClause*/ + void 0 + ); + var typeExportDeclaration = ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + true, + ts6.factory.createNamedExports(typeExportSpecifiers), + exportDeclaration.moduleSpecifier, + /*assertClause*/ + void 0 + ); + changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration, { + leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.IncludeAll, + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Exclude + }); + changes.insertNodeAfter(context.sourceFile, exportDeclaration, typeExportDeclaration); + } + } + function getTypeExportSpecifiers(originExportSpecifier, context) { + var exportClause = originExportSpecifier.parent; + if (exportClause.elements.length === 1) { + return exportClause.elements; + } + var diagnostics = ts6.getDiagnosticsWithinSpan(ts6.createTextSpanFromNode(exportClause), context.program.getSemanticDiagnostics(context.sourceFile, context.cancellationToken)); + return ts6.filter(exportClause.elements, function(element) { + var _a; + return element === originExportSpecifier || ((_a = ts6.findDiagnosticForNode(element, diagnostics)) === null || _a === void 0 ? void 0 : _a.code) === errorCodes[0]; + }); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodes = [ts6.Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code]; + var fixId = "convertToTypeOnlyImport"; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + var importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile); + fixSingleImportDeclaration(t, importDeclaration, context); + }); + if (changes.length) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_to_type_only_import, fixId, ts6.Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var importDeclaration = getImportDeclarationForDiagnosticSpan(diag, context.sourceFile); + fixSingleImportDeclaration(changes, importDeclaration, context); + }); + } + }); + function getImportDeclarationForDiagnosticSpan(span, sourceFile) { + return ts6.tryCast(ts6.getTokenAtPosition(sourceFile, span.start).parent, ts6.isImportDeclaration); + } + function fixSingleImportDeclaration(changes, importDeclaration, context) { + if (!(importDeclaration === null || importDeclaration === void 0 ? void 0 : importDeclaration.importClause)) { + return; + } + var importClause = importDeclaration.importClause; + changes.insertText(context.sourceFile, importDeclaration.getStart() + "import".length, " type"); + if (importClause.name && importClause.namedBindings) { + changes.deleteNodeRangeExcludingEnd(context.sourceFile, importClause.name, importDeclaration.importClause.namedBindings); + changes.insertNodeBefore(context.sourceFile, importDeclaration, ts6.factory.updateImportDeclaration( + importDeclaration, + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + true, + importClause.name, + /*namedBindings*/ + void 0 + ), + importDeclaration.moduleSpecifier, + /*assertClause*/ + void 0 + )); + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "convertLiteralTypeToMappedType"; + var errorCodes = [ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) { + var sourceFile = context.sourceFile, span = context.span; + var info = getInfo(sourceFile, span.start); + if (!info) { + return void 0; + } + var name = info.name, constraint = info.constraint; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, info); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId, ts6.Diagnostics.Convert_all_type_literals_to_mapped_type)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) { + doChange(changes, diag.file, info); + } + }); + } + }); + function getInfo(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (ts6.isIdentifier(token)) { + var propertySignature = ts6.cast(token.parent.parent, ts6.isPropertySignature); + var propertyName = token.getText(sourceFile); + return { + container: ts6.cast(propertySignature.parent, ts6.isTypeLiteralNode), + typeNode: propertySignature.type, + constraint: propertyName, + name: propertyName === "K" ? "P" : "K" + }; + } + return void 0; + } + function doChange(changes, sourceFile, _a) { + var container = _a.container, typeNode = _a.typeNode, constraint = _a.constraint, name = _a.name; + changes.replaceNode(sourceFile, container, ts6.factory.createMappedTypeNode( + /*readonlyToken*/ + void 0, + ts6.factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + name, + ts6.factory.createTypeReferenceNode(constraint) + ), + /*nameType*/ + void 0, + /*questionToken*/ + void 0, + typeNode, + /*members*/ + void 0 + )); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodes = [ + ts6.Diagnostics.Class_0_incorrectly_implements_interface_1.code, + ts6.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code + ]; + var fixId = "fixClassIncorrectlyImplementsInterface"; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var classDeclaration = getClass(sourceFile, span.start); + return ts6.mapDefined(ts6.getEffectiveImplementsTypeNodes(classDeclaration), function(implementedTypeNode) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences); + }); + return changes.length === 0 ? void 0 : codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId, ts6.Diagnostics.Implement_all_unimplemented_interfaces); + }); + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var seenClassDeclarations = new ts6.Map(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var classDeclaration = getClass(diag.file, diag.start); + if (ts6.addToSeen(seenClassDeclarations, ts6.getNodeId(classDeclaration))) { + for (var _i = 0, _a = ts6.getEffectiveImplementsTypeNodes(classDeclaration); _i < _a.length; _i++) { + var implementedTypeNode = _a[_i]; + addMissingDeclarations(context, implementedTypeNode, diag.file, classDeclaration, changes, context.preferences); + } + } + }); + } + }); + function getClass(sourceFile, pos) { + return ts6.Debug.checkDefined(ts6.getContainingClass(ts6.getTokenAtPosition(sourceFile, pos)), "There should be a containing class"); + } + function symbolPointsToNonPrivateMember(symbol) { + return !symbol.valueDeclaration || !(ts6.getEffectiveModifierFlags(symbol.valueDeclaration) & 8); + } + function addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, changeTracker, preferences) { + var checker = context.program.getTypeChecker(); + var maybeHeritageClauseSymbol = getHeritageClauseSymbolTable(classDeclaration, checker); + var implementedType = checker.getTypeAtLocation(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(ts6.and(symbolPointsToNonPrivateMember, function(symbol) { + return !maybeHeritageClauseSymbol.has(symbol.escapedName); + })); + var classType = checker.getTypeAtLocation(classDeclaration); + var constructor = ts6.find(classDeclaration.members, function(m) { + return ts6.isConstructorDeclaration(m); + }); + if (!classType.getNumberIndexType()) { + createMissingIndexSignatureDeclaration( + implementedType, + 1 + /* IndexKind.Number */ + ); + } + if (!classType.getStringIndexType()) { + createMissingIndexSignatureDeclaration( + implementedType, + 0 + /* IndexKind.String */ + ); + } + var importAdder = codefix2.createImportAdder(sourceFile, context.program, preferences, context.host); + codefix2.createMissingMemberNodes(classDeclaration, nonPrivateAndNotExistedInHeritageClauseMembers, sourceFile, context, preferences, importAdder, function(member) { + return insertInterfaceMemberNode(sourceFile, classDeclaration, member); + }); + importAdder.writeFixes(changeTracker); + function createMissingIndexSignatureDeclaration(type, kind) { + var indexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (indexInfoOfKind) { + insertInterfaceMemberNode(sourceFile, classDeclaration, checker.indexInfoToIndexSignatureDeclaration( + indexInfoOfKind, + classDeclaration, + /*flags*/ + void 0, + codefix2.getNoopSymbolTrackerWithResolver(context) + )); + } + } + function insertInterfaceMemberNode(sourceFile2, cls, newElement) { + if (constructor) { + changeTracker.insertNodeAfter(sourceFile2, constructor, newElement); + } else { + changeTracker.insertMemberAtStart(sourceFile2, cls, newElement); + } + } + } + function getHeritageClauseSymbolTable(classDeclaration, checker) { + var heritageClauseNode = ts6.getEffectiveBaseTypeNode(classDeclaration); + if (!heritageClauseNode) + return ts6.createSymbolTable(); + var heritageClauseType = checker.getTypeAtLocation(heritageClauseNode); + var heritageClauseTypeSymbols = checker.getPropertiesOfType(heritageClauseType); + return ts6.createSymbolTable(heritageClauseTypeSymbols.filter(symbolPointsToNonPrivateMember)); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + codefix2.importFixName = "import"; + var importFixId = "fixMissingImport"; + var errorCodes = [ + ts6.Diagnostics.Cannot_find_name_0.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code, + ts6.Diagnostics.Cannot_find_namespace_0.code, + ts6.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code, + ts6.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code, + ts6.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code, + ts6.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getFixInfos( + context, + errorCode, + span.start, + /*useAutoImportProvider*/ + true + ); + if (!info) + return void 0; + var quotePreference = ts6.getQuotePreference(sourceFile, preferences); + return info.map(function(_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix( + context, + sourceFile, + symbolName, + fix, + /*includeSymbolNameInDescription*/ + symbolName !== errorIdentifierText, + quotePreference, + program.getCompilerOptions() + ); + }); + }, + fixIds: [importFixId], + getAllCodeActions: function(context) { + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker( + sourceFile, + program, + /*useAutoImportProvider*/ + true, + preferences, + host, + cancellationToken + ); + codefix2.eachDiagnostic(context, errorCodes, function(diag) { + return importAdder.addImportFromDiagnostic(diag, context); + }); + return codefix2.createCombinedCodeActions(ts6.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); + } + }); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker( + sourceFile, + program, + /*useAutoImportProvider*/ + false, + preferences, + host, + cancellationToken + ); + } + codefix2.createImportAdder = createImportAdder; + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { + var compilerOptions = program.getCompilerOptions(); + var addToNamespace = []; + var importType = []; + var addToExisting = new ts6.Map(); + var newImports = new ts6.Map(); + return { addImportFromDiagnostic, addImportFromExportedSymbol, writeFixes, hasFixes }; + function addImportFromDiagnostic(diagnostic, context) { + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) + return; + addImport(ts6.first(info)); + } + function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { + var moduleSymbol = ts6.Debug.checkDefined(exportedSymbol.parent); + var symbolName = ts6.getNameForExportedSymbol(exportedSymbol, ts6.getEmitScriptTarget(compilerOptions)); + var checker = program.getTypeChecker(); + var symbol = checker.getMergedSymbol(ts6.skipAlias(exportedSymbol, checker)); + var exportInfo = getAllExportInfoForSymbol( + sourceFile, + symbol, + symbolName, + /*isJsxTagName*/ + false, + program, + host, + preferences, + cancellationToken + ); + var useRequire = shouldUseRequire(sourceFile, program); + var fix = getImportFixForSymbol( + sourceFile, + ts6.Debug.checkDefined(exportInfo), + moduleSymbol, + program, + /*useNamespaceInfo*/ + void 0, + !!isValidTypeOnlyUseSite, + useRequire, + host, + preferences + ); + if (fix) { + addImport({ fix, symbolName, errorIdentifierText: void 0 }); + } + } + function addImport(info) { + var _a, _b; + var fix = info.fix, symbolName = info.symbolName; + switch (fix.kind) { + case 0: + addToNamespace.push(fix); + break; + case 1: + importType.push(fix); + break; + case 2: { + var importClauseOrBindingPattern = fix.importClauseOrBindingPattern, importKind = fix.importKind, addAsTypeOnly = fix.addAsTypeOnly; + var key = String(ts6.getNodeId(importClauseOrBindingPattern)); + var entry = addToExisting.get(key); + if (!entry) { + addToExisting.set(key, entry = { importClauseOrBindingPattern, defaultImport: void 0, namedImports: new ts6.Map() }); + } + if (importKind === 0) { + var prevValue = entry === null || entry === void 0 ? void 0 : entry.namedImports.get(symbolName); + entry.namedImports.set(symbolName, reduceAddAsTypeOnlyValues(prevValue, addAsTypeOnly)); + } else { + ts6.Debug.assert(entry.defaultImport === void 0 || entry.defaultImport.name === symbolName, "(Add to Existing) Default import should be missing or match symbolName"); + entry.defaultImport = { + name: symbolName, + addAsTypeOnly: reduceAddAsTypeOnlyValues((_a = entry.defaultImport) === null || _a === void 0 ? void 0 : _a.addAsTypeOnly, addAsTypeOnly) + }; + } + break; + } + case 3: { + var moduleSpecifier = fix.moduleSpecifier, importKind = fix.importKind, useRequire = fix.useRequire, addAsTypeOnly = fix.addAsTypeOnly; + var entry = getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly); + ts6.Debug.assert(entry.useRequire === useRequire, "(Add new) Tried to add an `import` and a `require` for the same module"); + switch (importKind) { + case 1: + ts6.Debug.assert(entry.defaultImport === void 0 || entry.defaultImport.name === symbolName, "(Add new) Default import should be missing or match symbolName"); + entry.defaultImport = { name: symbolName, addAsTypeOnly: reduceAddAsTypeOnlyValues((_b = entry.defaultImport) === null || _b === void 0 ? void 0 : _b.addAsTypeOnly, addAsTypeOnly) }; + break; + case 0: + var prevValue = (entry.namedImports || (entry.namedImports = new ts6.Map())).get(symbolName); + entry.namedImports.set(symbolName, reduceAddAsTypeOnlyValues(prevValue, addAsTypeOnly)); + break; + case 3: + case 2: + ts6.Debug.assert(entry.namespaceLikeImport === void 0 || entry.namespaceLikeImport.name === symbolName, "Namespacelike import shoudl be missing or match symbolName"); + entry.namespaceLikeImport = { importKind, name: symbolName, addAsTypeOnly }; + break; + } + break; + } + case 4: + break; + default: + ts6.Debug.assertNever(fix, "fix wasn't never - got kind ".concat(fix.kind)); + } + function reduceAddAsTypeOnlyValues(prevValue2, newValue) { + return Math.max(prevValue2 !== null && prevValue2 !== void 0 ? prevValue2 : 0, newValue); + } + function getNewImportEntry(moduleSpecifier2, importKind2, useRequire2, addAsTypeOnly2) { + var typeOnlyKey = newImportsKey( + moduleSpecifier2, + /*topLevelTypeOnly*/ + true + ); + var nonTypeOnlyKey = newImportsKey( + moduleSpecifier2, + /*topLevelTypeOnly*/ + false + ); + var typeOnlyEntry = newImports.get(typeOnlyKey); + var nonTypeOnlyEntry = newImports.get(nonTypeOnlyKey); + var newEntry = { + defaultImport: void 0, + namedImports: void 0, + namespaceLikeImport: void 0, + useRequire: useRequire2 + }; + if (importKind2 === 1 && addAsTypeOnly2 === 2) { + if (typeOnlyEntry) + return typeOnlyEntry; + newImports.set(typeOnlyKey, newEntry); + return newEntry; + } + if (addAsTypeOnly2 === 1 && (typeOnlyEntry || nonTypeOnlyEntry)) { + return typeOnlyEntry || nonTypeOnlyEntry; + } + if (nonTypeOnlyEntry) { + return nonTypeOnlyEntry; + } + newImports.set(nonTypeOnlyKey, newEntry); + return newEntry; + } + function newImportsKey(moduleSpecifier2, topLevelTypeOnly) { + return "".concat(topLevelTypeOnly ? 1 : 0, "|").concat(moduleSpecifier2); + } + } + function writeFixes(changeTracker) { + var quotePreference = ts6.getQuotePreference(sourceFile, preferences); + for (var _i = 0, addToNamespace_1 = addToNamespace; _i < addToNamespace_1.length; _i++) { + var fix = addToNamespace_1[_i]; + addNamespaceQualifier(changeTracker, sourceFile, fix); + } + for (var _a = 0, importType_1 = importType; _a < importType_1.length; _a++) { + var fix = importType_1[_a]; + addImportType(changeTracker, sourceFile, fix, quotePreference); + } + addToExisting.forEach(function(_a2) { + var importClauseOrBindingPattern = _a2.importClauseOrBindingPattern, defaultImport = _a2.defaultImport, namedImports = _a2.namedImports; + doAddExistingFix(changeTracker, sourceFile, importClauseOrBindingPattern, defaultImport, ts6.arrayFrom(namedImports.entries(), function(_a3) { + var name = _a3[0], addAsTypeOnly = _a3[1]; + return { addAsTypeOnly, name }; + }), compilerOptions); + }); + var newDeclarations; + newImports.forEach(function(_a2, key) { + var useRequire = _a2.useRequire, defaultImport = _a2.defaultImport, namedImports = _a2.namedImports, namespaceLikeImport = _a2.namespaceLikeImport; + var moduleSpecifier = key.slice(2); + var getDeclarations = useRequire ? getNewRequires : getNewImports; + var declarations = getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports && ts6.arrayFrom(namedImports.entries(), function(_a3) { + var name = _a3[0], addAsTypeOnly = _a3[1]; + return { addAsTypeOnly, name }; + }), namespaceLikeImport); + newDeclarations = ts6.combine(newDeclarations, declarations); + }); + if (newDeclarations) { + ts6.insertImports( + changeTracker, + sourceFile, + newDeclarations, + /*blankLineBetween*/ + true + ); + } + } + function hasFixes() { + return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0; + } + } + function createImportSpecifierResolver(importingFile, program, host, preferences) { + var packageJsonImportFilter = ts6.createPackageJsonImportFilter(importingFile, preferences, host); + var importMap = createExistingImportMap(program.getTypeChecker(), importingFile, program.getCompilerOptions()); + return { getModuleSpecifierForBestExportInfo }; + function getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, fromCacheOnly) { + var _a = getImportFixes( + exportInfo, + { symbolName, position }, + isValidTypeOnlyUseSite, + /*useRequire*/ + false, + program, + importingFile, + host, + preferences, + importMap, + fromCacheOnly + ), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount; + var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter, host); + return result && __assign(__assign({}, result), { computedWithoutCacheCount }); + } + } + codefix2.createImportSpecifierResolver = createImportSpecifierResolver; + var ImportFixKind; + (function(ImportFixKind2) { + ImportFixKind2[ImportFixKind2["UseNamespace"] = 0] = "UseNamespace"; + ImportFixKind2[ImportFixKind2["JsdocTypeImport"] = 1] = "JsdocTypeImport"; + ImportFixKind2[ImportFixKind2["AddToExisting"] = 2] = "AddToExisting"; + ImportFixKind2[ImportFixKind2["AddNew"] = 3] = "AddNew"; + ImportFixKind2[ImportFixKind2["PromoteTypeOnly"] = 4] = "PromoteTypeOnly"; + })(ImportFixKind || (ImportFixKind = {})); + var AddAsTypeOnly; + (function(AddAsTypeOnly2) { + AddAsTypeOnly2[AddAsTypeOnly2["Allowed"] = 1] = "Allowed"; + AddAsTypeOnly2[AddAsTypeOnly2["Required"] = 2] = "Required"; + AddAsTypeOnly2[AddAsTypeOnly2["NotAllowed"] = 4] = "NotAllowed"; + })(AddAsTypeOnly || (AddAsTypeOnly = {})); + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { + var compilerOptions = program.getCompilerOptions(); + var exportInfos = ts6.pathIsBareSpecifier(ts6.stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts6.Debug.assertIsDefined(exportInfos); + var useRequire = shouldUseRequire(sourceFile, program); + var isValidTypeOnlyUseSite = ts6.isValidTypeOnlyAliasUseSite(ts6.getTokenAtPosition(sourceFile, position)); + var fix = ts6.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName, position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); + return { + moduleSpecifier: fix.moduleSpecifier, + codeAction: codeFixActionToCodeAction(codeActionForFix( + { host, formatContext, preferences }, + sourceFile, + symbolName, + fix, + /*includeSymbolNameInDescription*/ + false, + ts6.getQuotePreference(sourceFile, preferences), + compilerOptions + )) + }; + } + codefix2.getImportCompletionAction = getImportCompletionAction; + function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { + var compilerOptions = program.getCompilerOptions(); + var symbolName = ts6.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); + var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); + var includeSymbolNameInDescription = symbolName !== symbolToken.text; + return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1, compilerOptions)); + } + codefix2.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction; + function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, host, preferences) { + ts6.Debug.assert(exportInfos.some(function(info) { + return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; + }), "Some exportInfo should match the specified moduleSymbol"); + var packageJsonImportFilter = ts6.createPackageJsonImportFilter(sourceFile, preferences, host); + return getBestFix(getImportFixes(exportInfos, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host); + } + function codeFixActionToCodeAction(_a) { + var description = _a.description, changes = _a.changes, commands = _a.commands; + return { description, changes, commands }; + } + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts6.getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, function(name) { + return name === symbolName; + }, function(info) { + if (ts6.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { + var _a, _b; + var compilerOptions = program.getCompilerOptions(); + var mainProgramInfo = getInfoWithChecker( + program.getTypeChecker(), + /*isFromPackageJson*/ + false + ); + if (mainProgramInfo) { + return mainProgramInfo; + } + var autoImportProvider = (_b = (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getTypeChecker(); + return ts6.Debug.checkDefined(autoImportProvider && getInfoWithChecker( + autoImportProvider, + /*isFromPackageJson*/ + true + ), "Could not find symbol in specified module for code actions"); + function getInfoWithChecker(checker, isFromPackageJson) { + var defaultInfo = ts6.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); + if (defaultInfo && ts6.skipAlias(defaultInfo.symbol, checker) === symbol) { + return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: ts6.skipAlias(symbol, checker).flags, isFromPackageJson }; + } + var named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol); + if (named && ts6.skipAlias(named, checker) === symbol) { + return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0, targetFlags: ts6.skipAlias(symbol, checker).flags, isFromPackageJson }; + } + } + } + function getImportFixes(exportInfos, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { + if (importMap === void 0) { + importMap = createExistingImportMap(program.getTypeChecker(), sourceFile, program.getCompilerOptions()); + } + var checker = program.getTypeChecker(); + var existingImports = ts6.flatMap(exportInfos, importMap.getImportsForExportInfo); + var useNamespace = useNamespaceInfo && tryUseExistingNamespaceImport(existingImports, useNamespaceInfo.symbolName, useNamespaceInfo.position, checker); + var addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions()); + if (addToExisting) { + return { + computedWithoutCacheCount: 0, + fixes: __spreadArray(__spreadArray([], useNamespace ? [useNamespace] : ts6.emptyArray, true), [addToExisting], false) + }; + } + var _a = getFixesForAddImport(exportInfos, existingImports, program, sourceFile, useNamespaceInfo === null || useNamespaceInfo === void 0 ? void 0 : useNamespaceInfo.position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly), fixes = _a.fixes, _b = _a.computedWithoutCacheCount, computedWithoutCacheCount = _b === void 0 ? 0 : _b; + return { + computedWithoutCacheCount, + fixes: __spreadArray(__spreadArray([], useNamespace ? [useNamespace] : ts6.emptyArray, true), fixes, true) + }; + } + function tryUseExistingNamespaceImport(existingImports, symbolName, position, checker) { + return ts6.firstDefined(existingImports, function(_a) { + var _b; + var declaration = _a.declaration; + var namespacePrefix = getNamespaceLikeImportText(declaration); + var moduleSpecifier = (_b = ts6.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text; + if (namespacePrefix && moduleSpecifier) { + var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker); + if (moduleSymbol && moduleSymbol.exports.has(ts6.escapeLeadingUnderscores(symbolName))) { + return { kind: 0, namespacePrefix, position, moduleSpecifier }; + } + } + }); + } + function getTargetModuleFromNamespaceLikeImport(declaration, checker) { + var _a; + switch (declaration.kind) { + case 257: + return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); + case 268: + return checker.getAliasedSymbol(declaration.symbol); + case 269: + var namespaceImport = ts6.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts6.isNamespaceImport); + return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); + default: + return ts6.Debug.assertNever(declaration); + } + } + function getNamespaceLikeImportText(declaration) { + var _a, _b, _c; + switch (declaration.kind) { + case 257: + return (_a = ts6.tryCast(declaration.name, ts6.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; + case 268: + return declaration.name.text; + case 269: + return (_c = ts6.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts6.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; + default: + return ts6.Debug.assertNever(declaration); + } + } + function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, symbol, targetFlags, checker, compilerOptions) { + if (!isValidTypeOnlyUseSite) { + return 4; + } + if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2) { + return 2; + } + if (compilerOptions.isolatedModules && compilerOptions.preserveValueImports && (!(targetFlags & 111551) || !!checker.getTypeOnlyAliasDeclaration(symbol))) { + return 2; + } + return 1; + } + function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { + return ts6.firstDefined(existingImports, function(_a) { + var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; + if (importKind === 3 || importKind === 2 || declaration.kind === 268) { + return void 0; + } + if (declaration.kind === 257) { + return (importKind === 0 || importKind === 1) && declaration.name.kind === 203 ? { + kind: 2, + importClauseOrBindingPattern: declaration.name, + importKind, + moduleSpecifier: declaration.initializer.arguments[0].text, + addAsTypeOnly: 4 + /* AddAsTypeOnly.NotAllowed */ + } : void 0; + } + var importClause = declaration.importClause; + if (!importClause || !ts6.isStringLiteralLike(declaration.moduleSpecifier)) + return void 0; + var name = importClause.name, namedBindings = importClause.namedBindings; + if (importClause.isTypeOnly && !(importKind === 0 && namedBindings)) + return void 0; + var addAsTypeOnly = getAddAsTypeOnly( + isValidTypeOnlyUseSite, + /*isForNewImportDeclaration*/ + false, + symbol, + targetFlags, + checker, + compilerOptions + ); + if (importKind === 1 && (name || // Cannot add a default import to a declaration that already has one + addAsTypeOnly === 2 && namedBindings)) + return void 0; + if (importKind === 0 && (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271) + return void 0; + return { + kind: 2, + importClauseOrBindingPattern: importClause, + importKind, + moduleSpecifier: declaration.moduleSpecifier.text, + addAsTypeOnly + }; + }); + } + function createExistingImportMap(checker, importingFile, compilerOptions) { + var importMap; + for (var _i = 0, _a = importingFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + var i = ts6.importFromModuleSpecifier(moduleSpecifier); + if (ts6.isVariableDeclarationInitializedToRequire(i.parent)) { + var moduleSymbol = checker.resolveExternalModuleName(moduleSpecifier); + if (moduleSymbol) { + (importMap || (importMap = ts6.createMultiMap())).add(ts6.getSymbolId(moduleSymbol), i.parent); + } + } else if (i.kind === 269 || i.kind === 268) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol) { + (importMap || (importMap = ts6.createMultiMap())).add(ts6.getSymbolId(moduleSymbol), i); + } + } + } + return { + getImportsForExportInfo: function(_a2) { + var moduleSymbol2 = _a2.moduleSymbol, exportKind = _a2.exportKind, targetFlags = _a2.targetFlags, symbol = _a2.symbol; + if (!(targetFlags & 111551) && ts6.isSourceFileJS(importingFile)) + return ts6.emptyArray; + var matchingDeclarations = importMap === null || importMap === void 0 ? void 0 : importMap.get(ts6.getSymbolId(moduleSymbol2)); + if (!matchingDeclarations) + return ts6.emptyArray; + var importKind = getImportKind(importingFile, exportKind, compilerOptions); + return matchingDeclarations.map(function(declaration) { + return { declaration, importKind, symbol, targetFlags }; + }); + } + }; + } + function shouldUseRequire(sourceFile, program) { + if (!ts6.isSourceFileJS(sourceFile)) { + return false; + } + if (sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator) + return true; + if (sourceFile.externalModuleIndicator && !sourceFile.commonJsModuleIndicator) + return false; + var compilerOptions = program.getCompilerOptions(); + if (compilerOptions.configFile) { + return ts6.getEmitModuleKind(compilerOptions) < ts6.ModuleKind.ES2015; + } + for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { + var otherFile = _a[_i]; + if (otherFile === sourceFile || !ts6.isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) + continue; + if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) + return true; + if (otherFile.externalModuleIndicator && !otherFile.commonJsModuleIndicator) + return false; + } + return true; + } + function createGetChecker(program, host) { + return ts6.memoizeOne(function(isFromPackageJson) { + return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); + }); + } + function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { + var isJs = ts6.isSourceFileJS(sourceFile); + var compilerOptions = program.getCompilerOptions(); + var moduleSpecifierResolutionHost = ts6.createModuleSpecifierResolutionHost(program, host); + var getChecker = createGetChecker(program, host); + var rejectNodeModulesRelativePaths = ts6.moduleResolutionUsesNodeModules(ts6.getEmitModuleResolutionKind(compilerOptions)); + var getModuleSpecifiers = fromCacheOnly ? function(moduleSymbol) { + return { moduleSpecifiers: ts6.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }; + } : function(moduleSymbol, checker) { + return ts6.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences); + }; + var computedWithoutCacheCount = 0; + var fixes = ts6.flatMap(exportInfo, function(exportInfo2, i) { + var checker = getChecker(exportInfo2.isFromPackageJson); + var _a = getModuleSpecifiers(exportInfo2.moduleSymbol, checker), computedWithoutCache = _a.computedWithoutCache, moduleSpecifiers = _a.moduleSpecifiers; + var importedSymbolHasValueMeaning = !!(exportInfo2.targetFlags & 111551); + var addAsTypeOnly = getAddAsTypeOnly( + isValidTypeOnlyUseSite, + /*isForNewImportDeclaration*/ + true, + exportInfo2.symbol, + exportInfo2.targetFlags, + checker, + compilerOptions + ); + computedWithoutCacheCount += computedWithoutCache ? 1 : 0; + return ts6.mapDefined(moduleSpecifiers, function(moduleSpecifier) { + return rejectNodeModulesRelativePaths && ts6.pathContainsNodeModules(moduleSpecifier) ? void 0 : ( + // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types. + !importedSymbolHasValueMeaning && isJs && position !== void 0 ? { kind: 1, moduleSpecifier, position, exportInfo: exportInfo2, isReExport: i > 0 } : { + kind: 3, + moduleSpecifier, + importKind: getImportKind(sourceFile, exportInfo2.exportKind, compilerOptions), + useRequire, + addAsTypeOnly, + exportInfo: exportInfo2, + isReExport: i > 0 + } + ); + }); + }); + return { computedWithoutCacheCount, fixes }; + } + function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly) { + var existingDeclaration = ts6.firstDefined(existingImports, function(info) { + return newImportInfoFromExistingSpecifier(info, isValidTypeOnlyUseSite, useRequire, program.getTypeChecker(), program.getCompilerOptions()); + }); + return existingDeclaration ? { fixes: [existingDeclaration] } : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences, fromCacheOnly); + } + function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) { + var _b; + var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; + var moduleSpecifier = (_b = ts6.tryGetModuleSpecifierFromDeclaration(declaration)) === null || _b === void 0 ? void 0 : _b.text; + if (moduleSpecifier) { + var addAsTypeOnly = useRequire ? 4 : getAddAsTypeOnly( + isValidTypeOnlyUseSite, + /*isForNewImportDeclaration*/ + true, + symbol, + targetFlags, + checker, + compilerOptions + ); + return { kind: 3, moduleSpecifier, importKind, addAsTypeOnly, useRequire }; + } + } + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { + var symbolToken = ts6.getTokenAtPosition(context.sourceFile, pos); + var info; + if (errorCode === ts6.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + info = getFixesInfoForUMDImport(context, symbolToken); + } else if (!ts6.isIdentifier(symbolToken)) { + return void 0; + } else if (errorCode === ts6.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { + var symbolName_1 = ts6.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); + var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); + return fix && [{ fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; + } else { + info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); + } + var packageJsonImportFilter = ts6.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); + } + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { + var _toPath = function(fileName) { + return ts6.toPath(fileName, host.getCurrentDirectory(), ts6.hostGetCanonicalFileName(host)); + }; + return ts6.sort(fixes, function(a, b) { + return ts6.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || ts6.compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); + } + function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { + if (!ts6.some(fixes)) + return; + if (fixes[0].kind === 0 || fixes[0].kind === 2) { + return fixes[0]; + } + return fixes.reduce(function(best, fix) { + return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, function(fileName) { + return ts6.toPath(fileName, host.getCurrentDirectory(), ts6.hostGetCanonicalFileName(host)); + }) === -1 ? fix : best; + }); + } + function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath) { + if (a.kind !== 0 && b.kind !== 0) { + return ts6.compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier)) || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program) || ts6.compareBooleans(isFixPossiblyReExportingImportingFile(a, importingFile, program.getCompilerOptions(), toPath), isFixPossiblyReExportingImportingFile(b, importingFile, program.getCompilerOptions(), toPath)) || ts6.compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier); + } + return 0; + } + function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath) { + var _a; + if (fix.isReExport && ((_a = fix.exportInfo) === null || _a === void 0 ? void 0 : _a.moduleFileName) && ts6.getEmitModuleResolutionKind(compilerOptions) === ts6.ModuleResolutionKind.NodeJs && isIndexFileName(fix.exportInfo.moduleFileName)) { + var reExportDir = toPath(ts6.getDirectoryPath(fix.exportInfo.moduleFileName)); + return ts6.startsWith(importingFile.path, reExportDir); + } + return false; + } + function isIndexFileName(fileName) { + return ts6.getBaseFileName( + fileName, + [".js", ".jsx", ".d.ts", ".ts", ".tsx"], + /*ignoreCase*/ + true + ) === "index"; + } + function compareNodeCoreModuleSpecifiers(a, b, importingFile, program) { + if (ts6.startsWith(a, "node:") && !ts6.startsWith(b, "node:")) + return ts6.shouldUseUriStyleNodeCoreModules(importingFile, program) ? -1 : 1; + if (ts6.startsWith(b, "node:") && !ts6.startsWith(a, "node:")) + return ts6.shouldUseUriStyleNodeCoreModules(importingFile, program) ? 1 : -1; + return 0; + } + function getFixesInfoForUMDImport(_a, token) { + var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; + var checker = program.getTypeChecker(); + var umdSymbol = getUmdSymbol(token, checker); + if (!umdSymbol) + return void 0; + var symbol = checker.getAliasedSymbol(umdSymbol); + var symbolName = umdSymbol.name; + var exportInfo = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: void 0, exportKind: 3, targetFlags: symbol.flags, isFromPackageJson: false }]; + var useRequire = shouldUseRequire(sourceFile, program); + var position = ts6.isIdentifier(token) ? token.getStart(sourceFile) : void 0; + var fixes = getImportFixes( + exportInfo, + position ? { position, symbolName } : void 0, + /*isValidTypeOnlyUseSite*/ + false, + useRequire, + program, + sourceFile, + host, + preferences + ).fixes; + return fixes.map(function(fix) { + var _a2; + return { fix, symbolName, errorIdentifierText: (_a2 = ts6.tryCast(token, ts6.isIdentifier)) === null || _a2 === void 0 ? void 0 : _a2.text }; + }); + } + function getUmdSymbol(token, checker) { + var umdSymbol = ts6.isIdentifier(token) ? checker.getSymbolAtLocation(token) : void 0; + if (ts6.isUMDExportSymbol(umdSymbol)) + return umdSymbol; + var parent = token.parent; + return ts6.isJsxOpeningLikeElement(parent) && parent.tagName === token || ts6.isJsxOpeningFragment(parent) ? ts6.tryCast(checker.resolveName( + checker.getJsxNamespace(parent), + ts6.isJsxOpeningLikeElement(parent) ? token : parent, + 111551, + /*excludeGlobals*/ + false + ), ts6.isUMDExportSymbol) : void 0; + } + function getImportKind(importingFile, exportKind, compilerOptions, forceImportKeyword) { + switch (exportKind) { + case 0: + return 0; + case 1: + return 1; + case 2: + return getExportEqualsImportKind(importingFile, compilerOptions, !!forceImportKeyword); + case 3: + return getUmdImportKind(importingFile, compilerOptions, !!forceImportKeyword); + default: + return ts6.Debug.assertNever(exportKind); + } + } + codefix2.getImportKind = getImportKind; + function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) { + if (ts6.getAllowSyntheticDefaultImports(compilerOptions)) { + return 1; + } + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + switch (moduleKind) { + case ts6.ModuleKind.AMD: + case ts6.ModuleKind.CommonJS: + case ts6.ModuleKind.UMD: + if (ts6.isInJSFile(importingFile)) { + return ts6.isExternalModule(importingFile) || forceImportKeyword ? 2 : 3; + } + return 3; + case ts6.ModuleKind.System: + case ts6.ModuleKind.ES2015: + case ts6.ModuleKind.ES2020: + case ts6.ModuleKind.ES2022: + case ts6.ModuleKind.ESNext: + case ts6.ModuleKind.None: + return 2; + case ts6.ModuleKind.Node16: + case ts6.ModuleKind.NodeNext: + return importingFile.impliedNodeFormat === ts6.ModuleKind.ESNext ? 2 : 3; + default: + return ts6.Debug.assertNever(moduleKind, "Unexpected moduleKind ".concat(moduleKind)); + } + } + function getFixesInfoForNonUMDImport(_a, symbolToken, useAutoImportProvider) { + var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; + var checker = program.getTypeChecker(); + var compilerOptions = program.getCompilerOptions(); + return ts6.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function(symbolName) { + if (symbolName === "default") { + return void 0; + } + var isValidTypeOnlyUseSite = ts6.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts6.isJSXTagName(symbolToken), ts6.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts6.arrayFrom(ts6.flatMapIterator(exportInfo.entries(), function(_a2) { + var _ = _a2[0], exportInfos = _a2[1]; + return getImportFixes(exportInfos, { symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function(fix) { + return { fix, symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }; + }); + }); + } + function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { + var checker = program.getTypeChecker(); + var symbol = checker.resolveName( + symbolName, + symbolToken, + 111551, + /*excludeGlobals*/ + true + ); + if (!symbol) + return void 0; + var typeOnlyAliasDeclaration = checker.getTypeOnlyAliasDeclaration(symbol); + if (!typeOnlyAliasDeclaration || ts6.getSourceFileOfNode(typeOnlyAliasDeclaration) !== sourceFile) + return void 0; + return { kind: 4, typeOnlyAliasDeclaration }; + } + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { + var parent = symbolToken.parent; + if ((ts6.isJsxOpeningLikeElement(parent) || ts6.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts6.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { + var jsxNamespace = checker.getJsxNamespace(sourceFile); + if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { + var needsComponentNameFix = !ts6.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName( + symbolToken.text, + symbolToken, + 111551, + /*excludeGlobals*/ + false + ); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; + } + } + return [symbolToken.text]; + } + function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { + if (ts6.isIntrinsicJsxName(symbolToken.text)) + return true; + var namespaceSymbol = checker.resolveName( + jsxNamespace, + symbolToken, + 111551, + /*excludeGlobals*/ + true + ); + return !namespaceSymbol || ts6.some(namespaceSymbol.declarations, ts6.isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551); + } + function getExportInfos(symbolName, isJsxTagName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) { + var _a; + var originalSymbolToExportInfos = ts6.createMultiMap(); + var packageJsonFilter = ts6.createPackageJsonImportFilter(fromFile, preferences, host); + var moduleSpecifierCache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host); + var getModuleSpecifierResolutionHost = ts6.memoizeOne(function(isFromPackageJson) { + return ts6.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); + }); + function addSymbol(moduleSymbol, toFile, exportedSymbol, exportKind, program2, isFromPackageJson) { + var moduleSpecifierResolutionHost = getModuleSpecifierResolutionHost(isFromPackageJson); + if (toFile && ts6.isImportableFile(program2, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || !toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost)) { + var checker = program2.getTypeChecker(); + originalSymbolToExportInfos.add(ts6.getUniqueSymbolId(exportedSymbol, checker).toString(), { symbol: exportedSymbol, moduleSymbol, moduleFileName: toFile === null || toFile === void 0 ? void 0 : toFile.fileName, exportKind, targetFlags: ts6.skipAlias(exportedSymbol, checker).flags, isFromPackageJson }); + } + } + ts6.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function(moduleSymbol, sourceFile, program2, isFromPackageJson) { + var checker = program2.getTypeChecker(); + cancellationToken.throwIfCancellationRequested(); + var compilerOptions = program2.getCompilerOptions(); + var defaultInfo = ts6.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); + if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts6.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) { + addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson); + } + var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName, moduleSymbol); + if (exportSymbolWithIdenticalName && symbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { + addSymbol(moduleSymbol, sourceFile, exportSymbolWithIdenticalName, 0, program2, isFromPackageJson); + } + }); + return originalSymbolToExportInfos; + } + function getExportEqualsImportKind(importingFile, compilerOptions, forceImportKeyword) { + var allowSyntheticDefaults = ts6.getAllowSyntheticDefaultImports(compilerOptions); + var isJS = ts6.isInJSFile(importingFile); + if (!isJS && ts6.getEmitModuleKind(compilerOptions) >= ts6.ModuleKind.ES2015) { + return allowSyntheticDefaults ? 1 : 2; + } + if (isJS) { + return ts6.isExternalModule(importingFile) || forceImportKeyword ? allowSyntheticDefaults ? 1 : 2 : 3; + } + for (var _i = 0, _a = importingFile.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (ts6.isImportEqualsDeclaration(statement) && !ts6.nodeIsMissing(statement.moduleReference)) { + return 3; + } + } + return allowSyntheticDefaults ? 1 : 3; + } + function codeActionForFix(context, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions) { + var diag; + var changes = ts6.textChanges.ChangeTracker.with(context, function(tracker) { + diag = codeActionForFixWorker(tracker, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions); + }); + return codefix2.createCodeFixAction(codefix2.importFixName, changes, diag, importFixId, ts6.Diagnostics.Add_all_missing_imports); + } + function codeActionForFixWorker(changes, sourceFile, symbolName, fix, includeSymbolNameInDescription, quotePreference, compilerOptions) { + switch (fix.kind) { + case 0: + addNamespaceQualifier(changes, sourceFile, fix); + return [ts6.Diagnostics.Change_0_to_1, symbolName, "".concat(fix.namespacePrefix, ".").concat(symbolName)]; + case 1: + addImportType(changes, sourceFile, fix, quotePreference); + return [ts6.Diagnostics.Change_0_to_1, symbolName, getImportTypePrefix(fix.moduleSpecifier, quotePreference) + symbolName]; + case 2: { + var importClauseOrBindingPattern = fix.importClauseOrBindingPattern, importKind = fix.importKind, addAsTypeOnly = fix.addAsTypeOnly, moduleSpecifier = fix.moduleSpecifier; + doAddExistingFix(changes, sourceFile, importClauseOrBindingPattern, importKind === 1 ? { name: symbolName, addAsTypeOnly } : void 0, importKind === 0 ? [{ name: symbolName, addAsTypeOnly }] : ts6.emptyArray, compilerOptions); + var moduleSpecifierWithoutQuotes = ts6.stripQuotes(moduleSpecifier); + return includeSymbolNameInDescription ? [ts6.Diagnostics.Import_0_from_1, symbolName, moduleSpecifierWithoutQuotes] : [ts6.Diagnostics.Update_import_from_0, moduleSpecifierWithoutQuotes]; + } + case 3: { + var importKind = fix.importKind, moduleSpecifier = fix.moduleSpecifier, addAsTypeOnly = fix.addAsTypeOnly, useRequire = fix.useRequire; + var getDeclarations = useRequire ? getNewRequires : getNewImports; + var defaultImport = importKind === 1 ? { name: symbolName, addAsTypeOnly } : void 0; + var namedImports = importKind === 0 ? [{ name: symbolName, addAsTypeOnly }] : void 0; + var namespaceLikeImport = importKind === 2 || importKind === 3 ? { importKind, name: symbolName, addAsTypeOnly } : void 0; + ts6.insertImports( + changes, + sourceFile, + getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), + /*blankLineBetween*/ + true + ); + return includeSymbolNameInDescription ? [ts6.Diagnostics.Import_0_from_1, symbolName, moduleSpecifier] : [ts6.Diagnostics.Add_import_from_0, moduleSpecifier]; + } + case 4: { + var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; + var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); + return promotedDeclaration.kind === 273 ? [ts6.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts6.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; + } + default: + return ts6.Debug.assertNever(fix, "Unexpected fix kind ".concat(fix.kind)); + } + } + function getModuleSpecifierText(promotedDeclaration) { + var _a, _b; + return promotedDeclaration.kind === 268 ? ((_b = ts6.tryCast((_a = ts6.tryCast(promotedDeclaration.moduleReference, ts6.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts6.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts6.cast(promotedDeclaration.parent.moduleSpecifier, ts6.isStringLiteral).text; + } + function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile) { + var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; + switch (aliasDeclaration.kind) { + case 273: + if (aliasDeclaration.isTypeOnly) { + if (aliasDeclaration.parent.elements.length > 1 && ts6.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { + changes.delete(sourceFile, aliasDeclaration); + var newSpecifier = ts6.factory.updateImportSpecifier( + aliasDeclaration, + /*isTypeOnly*/ + false, + aliasDeclaration.propertyName, + aliasDeclaration.name + ); + var insertionIndex = ts6.OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier); + changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex); + } else { + changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken()); + } + return aliasDeclaration; + } else { + ts6.Debug.assert(aliasDeclaration.parent.parent.isTypeOnly); + promoteImportClause(aliasDeclaration.parent.parent); + return aliasDeclaration.parent.parent; + } + case 270: + promoteImportClause(aliasDeclaration); + return aliasDeclaration; + case 271: + promoteImportClause(aliasDeclaration.parent); + return aliasDeclaration.parent; + case 268: + changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); + return aliasDeclaration; + default: + ts6.Debug.failBadSyntaxKind(aliasDeclaration); + } + function promoteImportClause(importClause) { + changes.delete(sourceFile, ts6.getTypeKeywordOfTypeOnlyImport(importClause, sourceFile)); + if (convertExistingToTypeOnly) { + var namedImports = ts6.tryCast(importClause.namedBindings, ts6.isNamedImports); + if (namedImports && namedImports.elements.length > 1) { + if (ts6.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && aliasDeclaration.kind === 273 && namedImports.elements.indexOf(aliasDeclaration) !== 0) { + changes.delete(sourceFile, aliasDeclaration); + changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0); + } + for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element !== aliasDeclaration && !element.isTypeOnly) { + changes.insertModifierBefore(sourceFile, 154, element); + } + } + } + } + } + } + function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { + var _a; + if (clause.kind === 203) { + if (defaultImport) { + addElementToBindingPattern(clause, defaultImport.name, "default"); + } + for (var _i = 0, namedImports_1 = namedImports; _i < namedImports_1.length; _i++) { + var specifier = namedImports_1[_i]; + addElementToBindingPattern( + clause, + specifier.name, + /*propertyName*/ + void 0 + ); + } + return; + } + var promoteFromTypeOnly2 = clause.isTypeOnly && ts6.some(__spreadArray([defaultImport], namedImports, true), function(i) { + return (i === null || i === void 0 ? void 0 : i.addAsTypeOnly) === 4; + }); + var existingSpecifiers = clause.namedBindings && ((_a = ts6.tryCast(clause.namedBindings, ts6.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements); + var convertExistingToTypeOnly = promoteFromTypeOnly2 && compilerOptions.preserveValueImports && compilerOptions.isolatedModules; + if (defaultImport) { + ts6.Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one"); + changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), ts6.factory.createIdentifier(defaultImport.name), { suffix: ", " }); + } + if (namedImports.length) { + var newSpecifiers = ts6.stableSort(namedImports.map(function(namedImport) { + return ts6.factory.createImportSpecifier( + (!clause.isTypeOnly || promoteFromTypeOnly2) && needsTypeOnly(namedImport), + /*propertyName*/ + void 0, + ts6.factory.createIdentifier(namedImport.name) + ); + }), ts6.OrganizeImports.compareImportOrExportSpecifiers); + if ((existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) && ts6.OrganizeImports.importSpecifiersAreSorted(existingSpecifiers)) { + for (var _b = 0, newSpecifiers_1 = newSpecifiers; _b < newSpecifiers_1.length; _b++) { + var spec = newSpecifiers_1[_b]; + var insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly ? 0 : ts6.OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec); + changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex); + } + } else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) { + for (var _c = 0, newSpecifiers_2 = newSpecifiers; _c < newSpecifiers_2.length; _c++) { + var spec = newSpecifiers_2[_c]; + changes.insertNodeInListAfter(sourceFile, ts6.last(existingSpecifiers), spec, existingSpecifiers); + } + } else { + if (newSpecifiers.length) { + var namedImports_2 = ts6.factory.createNamedImports(newSpecifiers); + if (clause.namedBindings) { + changes.replaceNode(sourceFile, clause.namedBindings, namedImports_2); + } else { + changes.insertNodeAfter(sourceFile, ts6.Debug.checkDefined(clause.name, "Import clause must have either named imports or a default import"), namedImports_2); + } + } + } + } + if (promoteFromTypeOnly2) { + changes.delete(sourceFile, ts6.getTypeKeywordOfTypeOnlyImport(clause, sourceFile)); + if (convertExistingToTypeOnly && existingSpecifiers) { + for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { + var specifier = existingSpecifiers_1[_d]; + changes.insertModifierBefore(sourceFile, 154, specifier); + } + } + } + function addElementToBindingPattern(bindingPattern, name, propertyName) { + var element = ts6.factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + propertyName, + name + ); + if (bindingPattern.elements.length) { + changes.insertNodeInListAfter(sourceFile, ts6.last(bindingPattern.elements), element); + } else { + changes.replaceNode(sourceFile, bindingPattern, ts6.factory.createObjectBindingPattern([element])); + } + } + } + function addNamespaceQualifier(changes, sourceFile, _a) { + var namespacePrefix = _a.namespacePrefix, position = _a.position; + changes.insertText(sourceFile, position, namespacePrefix + "."); + } + function addImportType(changes, sourceFile, _a, quotePreference) { + var moduleSpecifier = _a.moduleSpecifier, position = _a.position; + changes.insertText(sourceFile, position, getImportTypePrefix(moduleSpecifier, quotePreference)); + } + function getImportTypePrefix(moduleSpecifier, quotePreference) { + var quote = ts6.getQuoteFromPreference(quotePreference); + return "import(".concat(quote).concat(moduleSpecifier).concat(quote, ")."); + } + function needsTypeOnly(_a) { + var addAsTypeOnly = _a.addAsTypeOnly; + return addAsTypeOnly === 2; + } + function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) { + var quotedModuleSpecifier = ts6.makeStringLiteral(moduleSpecifier, quotePreference); + var statements; + if (defaultImport !== void 0 || (namedImports === null || namedImports === void 0 ? void 0 : namedImports.length)) { + var topLevelTypeOnly_1 = (!defaultImport || needsTypeOnly(defaultImport)) && ts6.every(namedImports, needsTypeOnly); + statements = ts6.combine(statements, ts6.makeImport(defaultImport && ts6.factory.createIdentifier(defaultImport.name), namedImports === null || namedImports === void 0 ? void 0 : namedImports.map(function(_a) { + var addAsTypeOnly = _a.addAsTypeOnly, name = _a.name; + return ts6.factory.createImportSpecifier( + !topLevelTypeOnly_1 && addAsTypeOnly === 2, + /*propertyName*/ + void 0, + ts6.factory.createIdentifier(name) + ); + }), moduleSpecifier, quotePreference, topLevelTypeOnly_1)); + } + if (namespaceLikeImport) { + var declaration = namespaceLikeImport.importKind === 3 ? ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + needsTypeOnly(namespaceLikeImport), + ts6.factory.createIdentifier(namespaceLikeImport.name), + ts6.factory.createExternalModuleReference(quotedModuleSpecifier) + ) : ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + needsTypeOnly(namespaceLikeImport), + /*name*/ + void 0, + ts6.factory.createNamespaceImport(ts6.factory.createIdentifier(namespaceLikeImport.name)) + ), + quotedModuleSpecifier, + /*assertClause*/ + void 0 + ); + statements = ts6.combine(statements, declaration); + } + return ts6.Debug.checkDefined(statements); + } + function getNewRequires(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) { + var quotedModuleSpecifier = ts6.makeStringLiteral(moduleSpecifier, quotePreference); + var statements; + if (defaultImport || (namedImports === null || namedImports === void 0 ? void 0 : namedImports.length)) { + var bindingElements = (namedImports === null || namedImports === void 0 ? void 0 : namedImports.map(function(_a) { + var name = _a.name; + return ts6.factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + name + ); + })) || []; + if (defaultImport) { + bindingElements.unshift(ts6.factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + "default", + defaultImport.name + )); + } + var declaration = createConstEqualsRequireDeclaration(ts6.factory.createObjectBindingPattern(bindingElements), quotedModuleSpecifier); + statements = ts6.combine(statements, declaration); + } + if (namespaceLikeImport) { + var declaration = createConstEqualsRequireDeclaration(namespaceLikeImport.name, quotedModuleSpecifier); + statements = ts6.combine(statements, declaration); + } + return ts6.Debug.checkDefined(statements); + } + function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) { + return ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ + ts6.factory.createVariableDeclaration( + typeof name === "string" ? ts6.factory.createIdentifier(name) : name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + ts6.factory.createCallExpression( + ts6.factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + [quotedModuleSpecifier] + ) + ) + ], + 2 + /* NodeFlags.Const */ + ) + ); + } + function symbolHasMeaning(_a, meaning) { + var declarations = _a.declarations; + return ts6.some(declarations, function(decl) { + return !!(ts6.getMeaningFromDeclaration(decl) & meaning); + }); + } + function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) { + return moduleSpecifierToValidIdentifier(ts6.removeFileExtension(ts6.stripQuotes(moduleSymbol.name)), target, forceCapitalize); + } + codefix2.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier; + function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) { + var baseName = ts6.getBaseFileName(ts6.removeSuffix(moduleSpecifier, "/index")); + var res = ""; + var lastCharWasValid = true; + var firstCharCode = baseName.charCodeAt(0); + if (ts6.isIdentifierStart(firstCharCode, target)) { + res += String.fromCharCode(firstCharCode); + if (forceCapitalize) { + res = res.toUpperCase(); + } + } else { + lastCharWasValid = false; + } + for (var i = 1; i < baseName.length; i++) { + var ch = baseName.charCodeAt(i); + var isValid = ts6.isIdentifierPart(ch, target); + if (isValid) { + var char = String.fromCharCode(ch); + if (!lastCharWasValid) { + char = char.toUpperCase(); + } + res += char; + } + lastCharWasValid = isValid; + } + return !ts6.isStringANonContextualKeyword(res) ? res || "_" : "_".concat(res); + } + codefix2.moduleSpecifierToValidIdentifier = moduleSpecifierToValidIdentifier; + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingConstraint"; + var errorCodes = [ + // We want errors this could be attached to: + // Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint + ts6.Diagnostics.Type_0_is_not_comparable_to_type_1.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code, + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code, + ts6.Diagnostics.Property_0_is_incompatible_with_index_signature.code, + ts6.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code, + ts6.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program, preferences = context.preferences, host = context.host; + var info = getInfo(program, sourceFile, span); + if (info === void 0) + return; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addMissingConstraint(t, program, preferences, host, sourceFile, info); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_extends_constraint, fixId, ts6.Diagnostics.Add_extends_constraint_to_all_type_parameters)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var program = context.program, preferences = context.preferences, host = context.host; + var seen = new ts6.Map(); + return codefix2.createCombinedCodeActions(ts6.textChanges.ChangeTracker.with(context, function(changes) { + codefix2.eachDiagnostic(context, errorCodes, function(diag) { + var info = getInfo(program, diag.file, ts6.createTextSpan(diag.start, diag.length)); + if (info) { + if (ts6.addToSeen(seen, ts6.getNodeId(info.declaration))) { + return addMissingConstraint(changes, program, preferences, host, diag.file, info); + } + } + return void 0; + }); + })); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts6.find(program.getSemanticDiagnostics(sourceFile), function(diag2) { + return diag2.start === span.start && diag2.length === span.length; + }); + if (diag === void 0 || diag.relatedInformation === void 0) + return; + var related = ts6.find(diag.relatedInformation, function(related2) { + return related2.code === ts6.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; + }); + if (related === void 0 || related.file === void 0 || related.start === void 0 || related.length === void 0) + return; + var declaration = codefix2.findAncestorMatchingSpan(related.file, ts6.createTextSpan(related.start, related.length)); + if (declaration === void 0) + return; + if (ts6.isIdentifier(declaration) && ts6.isTypeParameterDeclaration(declaration.parent)) { + declaration = declaration.parent; + } + if (ts6.isTypeParameterDeclaration(declaration)) { + if (ts6.isMappedTypeNode(declaration.parent)) + return; + var token = ts6.getTokenAtPosition(sourceFile, span.start); + var checker = program.getTypeChecker(); + var constraint = tryGetConstraintType(checker, token) || tryGetConstraintFromDiagnosticMessage(related.messageText); + return { constraint, declaration, token }; + } + return void 0; + } + function addMissingConstraint(changes, program, preferences, host, sourceFile, info) { + var declaration = info.declaration, constraint = info.constraint; + var checker = program.getTypeChecker(); + if (ts6.isString(constraint)) { + changes.insertText(sourceFile, declaration.name.end, " extends ".concat(constraint)); + } else { + var scriptTarget = ts6.getEmitScriptTarget(program.getCompilerOptions()); + var tracker = codefix2.getNoopSymbolTrackerWithResolver({ program, host }); + var importAdder = codefix2.createImportAdder(sourceFile, program, preferences, host); + var typeNode = codefix2.typeToAutoImportableTypeNode( + checker, + importAdder, + constraint, + /*contextNode*/ + void 0, + scriptTarget, + /*flags*/ + void 0, + tracker + ); + if (typeNode) { + changes.replaceNode(sourceFile, declaration, ts6.factory.updateTypeParameterDeclaration( + declaration, + /*modifiers*/ + void 0, + declaration.name, + typeNode, + declaration.default + )); + importAdder.writeFixes(changes); + } + } + } + function tryGetConstraintFromDiagnosticMessage(messageText) { + var _a = ts6.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; + return constraint; + } + function tryGetConstraintType(checker, node) { + if (ts6.isTypeNode(node.parent)) { + return checker.getTypeArgumentConstraint(node.parent); + } + var contextualType = ts6.isExpression(node) ? checker.getContextualType(node) : void 0; + return contextualType || checker.getTypeAtLocation(node); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var _a; + var fixName = "fixOverrideModifier"; + var fixAddOverrideId = "fixAddOverrideModifier"; + var fixRemoveOverrideId = "fixRemoveOverrideModifier"; + var errorCodes = [ + ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, + ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, + ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code, + ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code, + ts6.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code, + ts6.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code, + ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code, + ts6.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code, + ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code + ]; + var errorCodeFixIdMap = (_a = {}, // case #1: + _a[ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code] = { + descriptions: ts6.Diagnostics.Add_override_modifier, + fixId: fixAddOverrideId, + fixAllDescriptions: ts6.Diagnostics.Add_all_missing_override_modifiers + }, _a[ts6.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code] = { + descriptions: ts6.Diagnostics.Add_override_modifier, + fixId: fixAddOverrideId, + fixAllDescriptions: ts6.Diagnostics.Add_all_missing_override_modifiers + }, // case #2: + _a[ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code] = { + descriptions: ts6.Diagnostics.Remove_override_modifier, + fixId: fixRemoveOverrideId, + fixAllDescriptions: ts6.Diagnostics.Remove_all_unnecessary_override_modifiers + }, _a[ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code] = { + descriptions: ts6.Diagnostics.Remove_override_modifier, + fixId: fixRemoveOverrideId, + fixAllDescriptions: ts6.Diagnostics.Remove_override_modifier + }, // case #3: + _a[ts6.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code] = { + descriptions: ts6.Diagnostics.Add_override_modifier, + fixId: fixAddOverrideId, + fixAllDescriptions: ts6.Diagnostics.Add_all_missing_override_modifiers + }, _a[ts6.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code] = { + descriptions: ts6.Diagnostics.Add_override_modifier, + fixId: fixAddOverrideId, + fixAllDescriptions: ts6.Diagnostics.Add_all_missing_override_modifiers + }, // case #4: + _a[ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code] = { + descriptions: ts6.Diagnostics.Add_override_modifier, + fixId: fixAddOverrideId, + fixAllDescriptions: ts6.Diagnostics.Remove_all_unnecessary_override_modifiers + }, // case #5: + _a[ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code] = { + descriptions: ts6.Diagnostics.Remove_override_modifier, + fixId: fixRemoveOverrideId, + fixAllDescriptions: ts6.Diagnostics.Remove_all_unnecessary_override_modifiers + }, _a[ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code] = { + descriptions: ts6.Diagnostics.Remove_override_modifier, + fixId: fixRemoveOverrideId, + fixAllDescriptions: ts6.Diagnostics.Remove_all_unnecessary_override_modifiers + }, _a); + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) { + var errorCode = context.errorCode, span = context.span; + var info = errorCodeFixIdMap[errorCode]; + if (!info) + return ts6.emptyArray; + var descriptions = info.descriptions, fixId = info.fixId, fixAllDescriptions = info.fixAllDescriptions; + var changes = ts6.textChanges.ChangeTracker.with(context, function(changes2) { + return dispatchChanges(changes2, context, errorCode, span.start); + }); + return [ + codefix2.createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions) + ]; + }, + fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var code = diag.code, start = diag.start; + var info = errorCodeFixIdMap[code]; + if (!info || info.fixId !== context.fixId) { + return; + } + dispatchChanges(changes, context, code, start); + }); + } + }); + function dispatchChanges(changeTracker, context, errorCode, pos) { + switch (errorCode) { + case ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code: + case ts6.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code: + case ts6.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code: + case ts6.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code: + case ts6.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code: + return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); + case ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: + case ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code: + case ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: + case ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code: + return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); + default: + ts6.Debug.fail("Unexpected error code: " + errorCode); + } + } + function doAddOverrideModifierChange(changeTracker, sourceFile, pos) { + var classElement = findContainerClassElementLike(sourceFile, pos); + if (ts6.isSourceFileJS(sourceFile)) { + changeTracker.addJSDocTags(sourceFile, classElement, [ts6.factory.createJSDocOverrideTag(ts6.factory.createIdentifier("override"))]); + return; + } + var modifiers = classElement.modifiers || ts6.emptyArray; + var staticModifier = ts6.find(modifiers, ts6.isStaticModifier); + var abstractModifier = ts6.find(modifiers, ts6.isAbstractModifier); + var accessibilityModifier = ts6.find(modifiers, function(m) { + return ts6.isAccessibilityModifier(m.kind); + }); + var lastDecorator = ts6.findLast(modifiers, ts6.isDecorator); + var modifierPos = abstractModifier ? abstractModifier.end : staticModifier ? staticModifier.end : accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts6.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); + var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; + changeTracker.insertModifierAt(sourceFile, modifierPos, 161, options); + } + function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { + var classElement = findContainerClassElementLike(sourceFile, pos); + if (ts6.isSourceFileJS(sourceFile)) { + changeTracker.filterJSDocTags(sourceFile, classElement, ts6.not(ts6.isJSDocOverrideTag)); + return; + } + var overrideModifier = ts6.find(classElement.modifiers, ts6.isOverrideModifier); + ts6.Debug.assertIsDefined(overrideModifier); + changeTracker.deleteModifier(sourceFile, overrideModifier); + } + function isClassElementLikeHasJSDoc(node) { + switch (node.kind) { + case 173: + case 169: + case 171: + case 174: + case 175: + return true; + case 166: + return ts6.isParameterPropertyDeclaration(node, node.parent); + default: + return false; + } + } + function findContainerClassElementLike(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + var classElement = ts6.findAncestor(token, function(node) { + if (ts6.isClassLike(node)) + return "quit"; + return isClassElementLikeHasJSDoc(node); + }); + ts6.Debug.assert(classElement && isClassElementLikeHasJSDoc(classElement)); + return classElement; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixNoPropertyAccessFromIndexSignature"; + var errorCodes = [ + ts6.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span, preferences = context.preferences; + var property = getPropertyAccessExpression(sourceFile, span.start); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, property, preferences); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Use_element_access_for_0, property.name.text], fixId, ts6.Diagnostics.Use_element_access_for_all_undeclared_properties)]; + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return doChange(changes, diag.file, getPropertyAccessExpression(diag.file, diag.start), context.preferences); + }); + } + }); + function doChange(changes, sourceFile, node, preferences) { + var quotePreference = ts6.getQuotePreference(sourceFile, preferences); + var argumentsExpression = ts6.factory.createStringLiteral( + node.name.text, + quotePreference === 0 + /* QuotePreference.Single */ + ); + changes.replaceNode(sourceFile, node, ts6.isPropertyAccessChain(node) ? ts6.factory.createElementAccessChain(node.expression, node.questionDotToken, argumentsExpression) : ts6.factory.createElementAccessExpression(node.expression, argumentsExpression)); + } + function getPropertyAccessExpression(sourceFile, pos) { + return ts6.cast(ts6.getTokenAtPosition(sourceFile, pos).parent, ts6.isPropertyAccessExpression); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixImplicitThis"; + var errorCodes = [ts6.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToFixImplicitThis(context) { + var sourceFile = context.sourceFile, program = context.program, span = context.span; + var diagnostic; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + diagnostic = doChange(t, sourceFile, span.start, program.getTypeChecker()); + }); + return diagnostic ? [codefix2.createCodeFixAction(fixId, changes, diagnostic, fixId, ts6.Diagnostics.Fix_all_implicit_this_errors)] : ts6.emptyArray; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + doChange(changes, diag.file, diag.start, context.program.getTypeChecker()); + }); + } + }); + function doChange(changes, sourceFile, pos, checker) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (!ts6.isThis(token)) + return void 0; + var fn = ts6.getThisContainer( + token, + /*includeArrowFunctions*/ + false + ); + if (!ts6.isFunctionDeclaration(fn) && !ts6.isFunctionExpression(fn)) + return void 0; + if (!ts6.isSourceFile(ts6.getThisContainer( + fn, + /*includeArrowFunctions*/ + false + ))) { + var fnKeyword = ts6.Debug.checkDefined(ts6.findChildOfKind(fn, 98, sourceFile)); + var name = fn.name; + var body = ts6.Debug.checkDefined(fn.body); + if (ts6.isFunctionExpression(fn)) { + if (name && ts6.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) { + return void 0; + } + changes.delete(sourceFile, fnKeyword); + if (name) { + changes.delete(sourceFile, name); + } + changes.insertText(sourceFile, body.pos, " =>"); + return [ts6.Diagnostics.Convert_function_expression_0_to_arrow_function, name ? name.text : ts6.ANONYMOUS]; + } else { + changes.replaceNode(sourceFile, fnKeyword, ts6.factory.createToken( + 85 + /* SyntaxKind.ConstKeyword */ + )); + changes.insertText(sourceFile, name.end, " = "); + changes.insertText(sourceFile, body.pos, " =>"); + return [ts6.Diagnostics.Convert_function_declaration_0_to_arrow_function, name.text]; + } + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixImportNonExportedMember"; + var errorCodes = [ + ts6.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === void 0) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, program, info); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts6.Diagnostics.Export_all_referenced_locals)]; + }, + getAllCodeActions: function(context) { + var program = context.program; + return codefix2.createCombinedCodeActions(ts6.textChanges.ChangeTracker.with(context, function(changes) { + var exports2 = new ts6.Map(); + codefix2.eachDiagnostic(context, errorCodes, function(diag) { + var info = getInfo(diag.file, diag.start, program); + if (info === void 0) + return void 0; + var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile; + if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === void 0 && ts6.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } else { + var moduleExports = exports2.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] }; + if (exportName.isTypeOnly) { + moduleExports.typeOnlyExports.push(exportName); + } else { + moduleExports.exports.push(exportName); + } + exports2.set(moduleSourceFile, moduleExports); + } + }); + exports2.forEach(function(moduleExports, moduleSourceFile) { + var exportDeclaration = tryGetExportDeclaration( + moduleSourceFile, + /*isTypeOnly*/ + true + ); + if (exportDeclaration && exportDeclaration.isTypeOnly) { + doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration); + doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration( + moduleSourceFile, + /*isTypeOnly*/ + false + )); + } else { + doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration); + } + }); + })); + } + }); + function getInfo(sourceFile, pos, program) { + var _a; + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (ts6.isIdentifier(token)) { + var importDeclaration = ts6.findAncestor(token, ts6.isImportDeclaration); + if (importDeclaration === void 0) + return void 0; + var moduleSpecifier = ts6.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0; + if (moduleSpecifier === void 0) + return void 0; + var resolvedModule = ts6.getResolvedModule( + sourceFile, + moduleSpecifier, + /*mode*/ + void 0 + ); + if (resolvedModule === void 0) + return void 0; + var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); + if (moduleSourceFile === void 0 || ts6.isSourceFileFromLibrary(program, moduleSourceFile)) + return void 0; + var moduleSymbol = moduleSourceFile.symbol; + var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals; + if (locals === void 0) + return void 0; + var localSymbol = locals.get(token.escapedText); + if (localSymbol === void 0) + return void 0; + var node = getNodeOfSymbol(localSymbol); + if (node === void 0) + return void 0; + var exportName = { node: token, isTypeOnly: ts6.isTypeDeclaration(node) }; + return { exportName, node, moduleSourceFile, moduleSpecifier }; + } + return void 0; + } + function doChange(changes, program, _a) { + var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile; + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); + if (exportDeclaration) { + updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); + } else if (ts6.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } else { + createExport(changes, program, moduleSourceFile, [exportName]); + } + } + function doChanges(changes, program, sourceFile, moduleExports, node) { + if (ts6.length(moduleExports)) { + if (node) { + updateExport(changes, program, sourceFile, node, moduleExports); + } else { + createExport(changes, program, sourceFile, moduleExports); + } + } + } + function tryGetExportDeclaration(sourceFile, isTypeOnly) { + var predicate = function(node) { + return ts6.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + }; + return ts6.findLast(sourceFile.statements, predicate); + } + function updateExport(changes, program, sourceFile, node, names) { + var namedExports = node.exportClause && ts6.isNamedExports(node.exportClause) ? node.exportClause.elements : ts6.factory.createNodeArray([]); + var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts6.find(namedExports, function(e) { + return e.isTypeOnly; + })); + changes.replaceNode(sourceFile, node, ts6.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts6.factory.createNamedExports(ts6.factory.createNodeArray( + __spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), + /*hasTrailingComma*/ + namedExports.hasTrailingComma + )), node.moduleSpecifier, node.assertClause)); + } + function createExport(changes, program, sourceFile, names) { + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports(createExportSpecifiers( + names, + /*allowTypeModifier*/ + !!program.getCompilerOptions().isolatedModules + )), + /*moduleSpecifier*/ + void 0, + /*assertClause*/ + void 0 + )); + } + function createExportSpecifiers(names, allowTypeModifier) { + return ts6.factory.createNodeArray(ts6.map(names, function(n) { + return ts6.factory.createExportSpecifier( + allowTypeModifier && n.isTypeOnly, + /*propertyName*/ + void 0, + n.node + ); + })); + } + function getNodeOfSymbol(symbol) { + if (symbol.valueDeclaration === void 0) { + return ts6.firstOrUndefined(symbol.declarations); + } + var declaration = symbol.valueDeclaration; + var variableStatement = ts6.isVariableDeclaration(declaration) ? ts6.tryCast(declaration.parent.parent, ts6.isVariableStatement) : void 0; + return variableStatement && ts6.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixIncorrectNamedTupleSyntax"; + var errorCodes = [ + ts6.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code, + ts6.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) { + var sourceFile = context.sourceFile, span = context.span; + var namedTupleMember = getNamedTupleMember(sourceFile, span.start); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, namedTupleMember); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId, ts6.Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; + }, + fixIds: [fixId] + }); + function getNamedTupleMember(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + return ts6.findAncestor(token, function(t) { + return t.kind === 199; + }); + } + function doChange(changes, sourceFile, namedTupleMember) { + if (!namedTupleMember) { + return; + } + var unwrappedType = namedTupleMember.type; + var sawOptional = false; + var sawRest = false; + while (unwrappedType.kind === 187 || unwrappedType.kind === 188 || unwrappedType.kind === 193) { + if (unwrappedType.kind === 187) { + sawOptional = true; + } else if (unwrappedType.kind === 188) { + sawRest = true; + } + unwrappedType = unwrappedType.type; + } + var updated = ts6.factory.updateNamedTupleMember(namedTupleMember, namedTupleMember.dotDotDotToken || (sawRest ? ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ) : void 0), namedTupleMember.name, namedTupleMember.questionToken || (sawOptional ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0), unwrappedType); + if (updated === namedTupleMember) { + return; + } + changes.replaceNode(sourceFile, namedTupleMember, updated); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixSpelling"; + var errorCodes = [ + ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, + ts6.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, + ts6.Diagnostics.Could_not_find_name_0_Did_you_mean_1.code, + ts6.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code, + ts6.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code, + ts6.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code, + ts6.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code, + // for JSX class components + ts6.Diagnostics.No_overload_matches_this_call.code, + // for JSX FC + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, errorCode = context.errorCode; + var info = getInfo(sourceFile, context.span.start, context, errorCode); + if (!info) + return void 0; + var node = info.node, suggestedSymbol = info.suggestedSymbol; + var target = ts6.getEmitScriptTarget(context.host.getCompilationSettings()); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, node, suggestedSymbol, target); + }); + return [codefix2.createCodeFixAction("spelling", changes, [ts6.Diagnostics.Change_spelling_to_0, ts6.symbolName(suggestedSymbol)], fixId, ts6.Diagnostics.Fix_all_detected_spelling_errors)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start, context, diag.code); + var target = ts6.getEmitScriptTarget(context.host.getCompilationSettings()); + if (info) + doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + }); + } + }); + function getInfo(sourceFile, pos, context, errorCode) { + var node = ts6.getTokenAtPosition(sourceFile, pos); + var parent = node.parent; + if ((errorCode === ts6.Diagnostics.No_overload_matches_this_call.code || errorCode === ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code) && !ts6.isJsxAttribute(parent)) + return void 0; + var checker = context.program.getTypeChecker(); + var suggestedSymbol; + if (ts6.isPropertyAccessExpression(parent) && parent.name === node) { + ts6.Debug.assert(ts6.isMemberName(node), "Expected an identifier for spelling (property access)"); + var containingType = checker.getTypeAtLocation(parent.expression); + if (parent.flags & 32) { + containingType = checker.getNonNullableType(containingType); + } + suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, containingType); + } else if (ts6.isBinaryExpression(parent) && parent.operatorToken.kind === 101 && parent.left === node && ts6.isPrivateIdentifier(node)) { + var receiverType = checker.getTypeAtLocation(parent.right); + suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, receiverType); + } else if (ts6.isQualifiedName(parent) && parent.right === node) { + var symbol = checker.getSymbolAtLocation(parent.left); + if (symbol && symbol.flags & 1536) { + suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(parent.right, symbol); + } + } else if (ts6.isImportSpecifier(parent) && parent.name === node) { + ts6.Debug.assertNode(node, ts6.isIdentifier, "Expected an identifier for spelling (import)"); + var importDeclaration = ts6.findAncestor(node, ts6.isImportDeclaration); + var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); + if (resolvedSourceFile && resolvedSourceFile.symbol) { + suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol); + } + } else if (ts6.isJsxAttribute(parent) && parent.name === node) { + ts6.Debug.assertNode(node, ts6.isIdentifier, "Expected an identifier for JSX attribute"); + var tag = ts6.findAncestor(node, ts6.isJsxOpeningLikeElement); + var props = checker.getContextualTypeForArgumentAtIndex(tag, 0); + suggestedSymbol = checker.getSuggestedSymbolForNonexistentJSXAttribute(node, props); + } else if (ts6.hasSyntacticModifier( + parent, + 16384 + /* ModifierFlags.Override */ + ) && ts6.isClassElement(parent) && parent.name === node) { + var baseDeclaration = ts6.findAncestor(node, ts6.isClassLike); + var baseTypeNode = baseDeclaration ? ts6.getEffectiveBaseTypeNode(baseDeclaration) : void 0; + var baseType = baseTypeNode ? checker.getTypeAtLocation(baseTypeNode) : void 0; + if (baseType) { + suggestedSymbol = checker.getSuggestedSymbolForNonexistentClassMember(ts6.getTextOfNode(node), baseType); + } + } else { + var meaning = ts6.getMeaningFromLocation(node); + var name = ts6.getTextOfNode(node); + ts6.Debug.assert(name !== void 0, "name should be defined"); + suggestedSymbol = checker.getSuggestedSymbolForNonexistentSymbol(node, name, convertSemanticMeaningToSymbolFlags(meaning)); + } + return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol }; + } + function doChange(changes, sourceFile, node, suggestedSymbol, target) { + var suggestion = ts6.symbolName(suggestedSymbol); + if (!ts6.isIdentifierText(suggestion, target) && ts6.isPropertyAccessExpression(node.parent)) { + var valDecl = suggestedSymbol.valueDeclaration; + if (valDecl && ts6.isNamedDeclaration(valDecl) && ts6.isPrivateIdentifier(valDecl.name)) { + changes.replaceNode(sourceFile, node, ts6.factory.createIdentifier(suggestion)); + } else { + changes.replaceNode(sourceFile, node.parent, ts6.factory.createElementAccessExpression(node.parent.expression, ts6.factory.createStringLiteral(suggestion))); + } + } else { + changes.replaceNode(sourceFile, node, ts6.factory.createIdentifier(suggestion)); + } + } + function convertSemanticMeaningToSymbolFlags(meaning) { + var flags = 0; + if (meaning & 4) { + flags |= 1920; + } + if (meaning & 2) { + flags |= 788968; + } + if (meaning & 1) { + flags |= 111551; + } + return flags; + } + function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) { + if (!importDeclaration || !ts6.isStringLiteralLike(importDeclaration.moduleSpecifier)) + return void 0; + var resolvedModule = ts6.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, ts6.getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier)); + if (!resolvedModule) + return void 0; + return context.program.getSourceFile(resolvedModule.resolvedFileName); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "returnValueCorrect"; + var fixIdAddReturnStatement = "fixAddReturnStatement"; + var fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody"; + var fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen"; + var errorCodes = [ + ts6.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code, + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code + ]; + var ProblemKind; + (function(ProblemKind2) { + ProblemKind2[ProblemKind2["MissingReturnStatement"] = 0] = "MissingReturnStatement"; + ProblemKind2[ProblemKind2["MissingParentheses"] = 1] = "MissingParentheses"; + })(ProblemKind || (ProblemKind = {})); + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen], + getCodeActions: function getCodeActionsToCorrectReturnValue(context) { + var program = context.program, sourceFile = context.sourceFile, start = context.span.start, errorCode = context.errorCode; + var info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode); + if (!info) + return void 0; + if (info.kind === ProblemKind.MissingReturnStatement) { + return ts6.append([getActionForfixAddReturnStatement(context, info.expression, info.statement)], ts6.isArrowFunction(info.declaration) ? getActionForFixRemoveBracesFromArrowFunctionBody(context, info.declaration, info.expression, info.commentSource) : void 0); + } else { + return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)]; + } + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(context.program.getTypeChecker(), diag.file, diag.start, diag.code); + if (!info) + return void 0; + switch (context.fixId) { + case fixIdAddReturnStatement: + addReturnStatement(changes, diag.file, info.expression, info.statement); + break; + case fixRemoveBracesFromArrowFunctionBody: + if (!ts6.isArrowFunction(info.declaration)) + return void 0; + removeBlockBodyBrace( + changes, + diag.file, + info.declaration, + info.expression, + info.commentSource, + /* withParen */ + false + ); + break; + case fixIdWrapTheBlockWithParen: + if (!ts6.isArrowFunction(info.declaration)) + return void 0; + wrapBlockWithParen(changes, diag.file, info.declaration, info.expression); + break; + default: + ts6.Debug.fail(JSON.stringify(context.fixId)); + } + }); + } + }); + function createObjectTypeFromLabeledExpression(checker, label, expression) { + var member = checker.createSymbol(4, label.escapedText); + member.type = checker.getTypeAtLocation(expression); + var members = ts6.createSymbolTable([member]); + return checker.createAnonymousType( + /*symbol*/ + void 0, + members, + [], + [], + [] + ); + } + function getFixInfo(checker, declaration, expectType, isFunctionType) { + if (!declaration.body || !ts6.isBlock(declaration.body) || ts6.length(declaration.body.statements) !== 1) + return void 0; + var firstStatement = ts6.first(declaration.body.statements); + if (ts6.isExpressionStatement(firstStatement) && checkFixedAssignableTo(checker, declaration, checker.getTypeAtLocation(firstStatement.expression), expectType, isFunctionType)) { + return { + declaration, + kind: ProblemKind.MissingReturnStatement, + expression: firstStatement.expression, + statement: firstStatement, + commentSource: firstStatement.expression + }; + } else if (ts6.isLabeledStatement(firstStatement) && ts6.isExpressionStatement(firstStatement.statement)) { + var node = ts6.factory.createObjectLiteralExpression([ts6.factory.createPropertyAssignment(firstStatement.label, firstStatement.statement.expression)]); + var nodeType = createObjectTypeFromLabeledExpression(checker, firstStatement.label, firstStatement.statement.expression); + if (checkFixedAssignableTo(checker, declaration, nodeType, expectType, isFunctionType)) { + return ts6.isArrowFunction(declaration) ? { + declaration, + kind: ProblemKind.MissingParentheses, + expression: node, + statement: firstStatement, + commentSource: firstStatement.statement.expression + } : { + declaration, + kind: ProblemKind.MissingReturnStatement, + expression: node, + statement: firstStatement, + commentSource: firstStatement.statement.expression + }; + } + } else if (ts6.isBlock(firstStatement) && ts6.length(firstStatement.statements) === 1) { + var firstBlockStatement = ts6.first(firstStatement.statements); + if (ts6.isLabeledStatement(firstBlockStatement) && ts6.isExpressionStatement(firstBlockStatement.statement)) { + var node = ts6.factory.createObjectLiteralExpression([ts6.factory.createPropertyAssignment(firstBlockStatement.label, firstBlockStatement.statement.expression)]); + var nodeType = createObjectTypeFromLabeledExpression(checker, firstBlockStatement.label, firstBlockStatement.statement.expression); + if (checkFixedAssignableTo(checker, declaration, nodeType, expectType, isFunctionType)) { + return { + declaration, + kind: ProblemKind.MissingReturnStatement, + expression: node, + statement: firstStatement, + commentSource: firstBlockStatement + }; + } + } + } + return void 0; + } + function checkFixedAssignableTo(checker, declaration, exprType, type, isFunctionType) { + if (isFunctionType) { + var sig = checker.getSignatureFromDeclaration(declaration); + if (sig) { + if (ts6.hasSyntacticModifier( + declaration, + 512 + /* ModifierFlags.Async */ + )) { + exprType = checker.createPromiseType(exprType); + } + var newSig = checker.createSignature( + declaration, + sig.typeParameters, + sig.thisParameter, + sig.parameters, + exprType, + /*typePredicate*/ + void 0, + sig.minArgumentCount, + sig.flags + ); + exprType = checker.createAnonymousType( + /*symbol*/ + void 0, + ts6.createSymbolTable(), + [newSig], + [], + [] + ); + } else { + exprType = checker.getAnyType(); + } + } + return checker.isTypeAssignableTo(exprType, type); + } + function getInfo(checker, sourceFile, position, errorCode) { + var node = ts6.getTokenAtPosition(sourceFile, position); + if (!node.parent) + return void 0; + var declaration = ts6.findAncestor(node.parent, ts6.isFunctionLikeDeclaration); + switch (errorCode) { + case ts6.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code: + if (!declaration || !declaration.body || !declaration.type || !ts6.rangeContainsRange(declaration.type, node)) + return void 0; + return getFixInfo( + checker, + declaration, + checker.getTypeFromTypeNode(declaration.type), + /* isFunctionType */ + false + ); + case ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code: + if (!declaration || !ts6.isCallExpression(declaration.parent) || !declaration.body) + return void 0; + var pos = declaration.parent.arguments.indexOf(declaration); + var type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos); + if (!type) + return void 0; + return getFixInfo( + checker, + declaration, + type, + /* isFunctionType */ + true + ); + case ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code: + if (!ts6.isDeclarationName(node) || !ts6.isVariableLike(node.parent) && !ts6.isJsxAttribute(node.parent)) + return void 0; + var initializer = getVariableLikeInitializer(node.parent); + if (!initializer || !ts6.isFunctionLikeDeclaration(initializer) || !initializer.body) + return void 0; + return getFixInfo( + checker, + initializer, + checker.getTypeAtLocation(node.parent), + /* isFunctionType */ + true + ); + } + return void 0; + } + function getVariableLikeInitializer(declaration) { + switch (declaration.kind) { + case 257: + case 166: + case 205: + case 169: + case 299: + return declaration.initializer; + case 288: + return declaration.initializer && (ts6.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : void 0); + case 300: + case 168: + case 302: + case 350: + case 343: + return void 0; + } + } + function addReturnStatement(changes, sourceFile, expression, statement) { + ts6.suppressLeadingAndTrailingTrivia(expression); + var probablyNeedSemi = ts6.probablyUsesSemicolons(sourceFile); + changes.replaceNode(sourceFile, statement, ts6.factory.createReturnStatement(expression), { + leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.Exclude, + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Exclude, + suffix: probablyNeedSemi ? ";" : void 0 + }); + } + function removeBlockBodyBrace(changes, sourceFile, declaration, expression, commentSource, withParen) { + var newBody = withParen || ts6.needsParentheses(expression) ? ts6.factory.createParenthesizedExpression(expression) : expression; + ts6.suppressLeadingAndTrailingTrivia(commentSource); + ts6.copyComments(commentSource, newBody); + changes.replaceNode(sourceFile, declaration.body, newBody); + } + function wrapBlockWithParen(changes, sourceFile, declaration, expression) { + changes.replaceNode(sourceFile, declaration.body, ts6.factory.createParenthesizedExpression(expression)); + } + function getActionForfixAddReturnStatement(context, expression, statement) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addReturnStatement(t, context.sourceFile, expression, statement); + }); + return codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, ts6.Diagnostics.Add_all_missing_return_statement); + } + function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return removeBlockBodyBrace( + t, + context.sourceFile, + declaration, + expression, + commentSource, + /* withParen */ + false + ); + }); + return codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, ts6.Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues); + } + function getActionForfixWrapTheBlockWithParen(context, declaration, expression) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return wrapBlockWithParen(t, context.sourceFile, declaration, expression); + }); + return codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, ts6.Diagnostics.Wrap_all_object_literal_with_parentheses); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixMissingMember = "fixMissingMember"; + var fixMissingProperties = "fixMissingProperties"; + var fixMissingAttributes = "fixMissingAttributes"; + var fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration"; + var errorCodes = [ + ts6.Diagnostics.Property_0_does_not_exist_on_type_1.code, + ts6.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, + ts6.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code, + ts6.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code, + ts6.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code, + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, + ts6.Diagnostics.Cannot_find_name_0.code + ]; + var InfoKind; + (function(InfoKind2) { + InfoKind2[InfoKind2["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind2[InfoKind2["Enum"] = 1] = "Enum"; + InfoKind2[InfoKind2["Function"] = 2] = "Function"; + InfoKind2[InfoKind2["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind2[InfoKind2["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind2[InfoKind2["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var typeChecker = context.program.getTypeChecker(); + var info = getInfo(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program); + if (!info) { + return void 0; + } + if (info.kind === InfoKind.ObjectLiteral) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addObjectLiteralProperties(t, context, info); + }); + return [codefix2.createCodeFixAction(fixMissingProperties, changes, ts6.Diagnostics.Add_missing_properties, fixMissingProperties, ts6.Diagnostics.Add_all_missing_properties)]; + } + if (info.kind === InfoKind.JsxAttributes) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addJsxAttributes(t, context, info); + }); + return [codefix2.createCodeFixAction(fixMissingAttributes, changes, ts6.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts6.Diagnostics.Add_all_missing_attributes)]; + } + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addFunctionDeclaration(t, context, info); + }); + return [codefix2.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts6.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts6.Diagnostics.Add_all_missing_function_declarations)]; + } + if (info.kind === InfoKind.Enum) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); + }); + return [codefix2.createCodeFixAction(fixMissingMember, changes, [ts6.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts6.Diagnostics.Add_all_missing_members)]; + } + return ts6.concatenate(getActionsForMissingMethodDeclaration(context, info), getActionsForMissingMemberDeclaration(context, info)); + }, + fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes], + getAllCodeActions: function(context) { + var program = context.program, fixId = context.fixId; + var checker = program.getTypeChecker(); + var seen = new ts6.Map(); + var typeDeclToMembers = new ts6.Map(); + return codefix2.createCombinedCodeActions(ts6.textChanges.ChangeTracker.with(context, function(changes) { + codefix2.eachDiagnostic(context, errorCodes, function(diag) { + var info = getInfo(diag.file, diag.start, diag.code, checker, context.program); + if (!info || !ts6.addToSeen(seen, ts6.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { + return; + } + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { + addFunctionDeclaration(changes, context, info); + } else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { + addObjectLiteralProperties(changes, context, info); + } else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { + addJsxAttributes(changes, context, info); + } else { + if (info.kind === InfoKind.Enum) { + addEnumMemberDeclaration(changes, checker, info); + } + if (info.kind === InfoKind.TypeLikeDeclaration) { + var parentDeclaration = info.parentDeclaration, token_1 = info.token; + var infos = ts6.getOrUpdate(typeDeclToMembers, parentDeclaration, function() { + return []; + }); + if (!infos.some(function(i) { + return i.token.text === token_1.text; + })) { + infos.push(info); + } + } + } + }); + typeDeclToMembers.forEach(function(infos, declaration) { + var supers = ts6.isTypeLiteralNode(declaration) ? void 0 : codefix2.getAllSupers(declaration, checker); + var _loop_13 = function(info2) { + if (supers === null || supers === void 0 ? void 0 : supers.some(function(superClassOrInterface) { + var superInfos = typeDeclToMembers.get(superClassOrInterface); + return !!superInfos && superInfos.some(function(_a) { + var token2 = _a.token; + return token2.text === info2.token.text; + }); + })) + return "continue"; + var parentDeclaration = info2.parentDeclaration, declSourceFile = info2.declSourceFile, modifierFlags = info2.modifierFlags, token = info2.token, call = info2.call, isJSFile = info2.isJSFile; + if (call && !ts6.isPrivateIdentifier(token)) { + addMethodDeclaration(context, changes, call, token, modifierFlags & 32, parentDeclaration, declSourceFile); + } else { + if (isJSFile && !ts6.isInterfaceDeclaration(parentDeclaration) && !ts6.isTypeLiteralNode(parentDeclaration)) { + addMissingMemberInJs(changes, declSourceFile, parentDeclaration, token, !!(modifierFlags & 32)); + } else { + var typeNode = getTypeNode(checker, parentDeclaration, token); + addPropertyDeclaration( + changes, + declSourceFile, + parentDeclaration, + token.text, + typeNode, + modifierFlags & 32 + /* ModifierFlags.Static */ + ); + } + } + }; + for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) { + var info = infos_1[_i]; + _loop_13(info); + } + }); + })); + } + }); + function getInfo(sourceFile, tokenPos, errorCode, checker, program) { + var token = ts6.getTokenAtPosition(sourceFile, tokenPos); + var parent = token.parent; + if (errorCode === ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) { + if (!(token.kind === 18 && ts6.isObjectLiteralExpression(parent) && ts6.isCallExpression(parent.parent))) + return void 0; + var argIndex = ts6.findIndex(parent.parent.arguments, function(arg) { + return arg === parent; + }); + if (argIndex < 0) + return void 0; + var signature = checker.getResolvedSignature(parent.parent); + if (!(signature && signature.declaration && signature.parameters[argIndex])) + return void 0; + var param = signature.parameters[argIndex].valueDeclaration; + if (!(param && ts6.isParameter(param) && ts6.isIdentifier(param.name))) + return void 0; + var properties = ts6.arrayFrom(checker.getUnmatchedProperties( + checker.getTypeAtLocation(parent), + checker.getParameterType(signature, argIndex), + /* requireOptionalProperties */ + false, + /* matchDiscriminantProperties */ + false + )); + if (!ts6.length(properties)) + return void 0; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties, parentDeclaration: parent }; + } + if (!ts6.isMemberName(token)) + return void 0; + if (ts6.isIdentifier(token) && ts6.hasInitializer(parent) && parent.initializer && ts6.isObjectLiteralExpression(parent.initializer)) { + var properties = ts6.arrayFrom(checker.getUnmatchedProperties( + checker.getTypeAtLocation(parent.initializer), + checker.getTypeAtLocation(token), + /* requireOptionalProperties */ + false, + /* matchDiscriminantProperties */ + false + )); + if (!ts6.length(properties)) + return void 0; + return { kind: InfoKind.ObjectLiteral, token, properties, parentDeclaration: parent.initializer }; + } + if (ts6.isIdentifier(token) && ts6.isJsxOpeningLikeElement(token.parent)) { + var target = ts6.getEmitScriptTarget(program.getCompilerOptions()); + var attributes = getUnmatchedAttributes(checker, target, token.parent); + if (!ts6.length(attributes)) + return void 0; + return { kind: InfoKind.JsxAttributes, token, attributes, parentDeclaration: token.parent }; + } + if (ts6.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts6.getObjectFlags(type) & 16) { + var signature = ts6.firstOrUndefined(checker.getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + )); + if (signature === void 0) + return void 0; + return { kind: InfoKind.Signature, token, signature, sourceFile, parentDeclaration: findScope(token) }; + } + if (ts6.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token, call: parent, sourceFile, modifierFlags: 0, parentDeclaration: findScope(token) }; + } + } + if (!ts6.isPropertyAccessExpression(parent)) + return void 0; + var leftExpressionType = ts6.skipConstraint(checker.getTypeAtLocation(parent.expression)); + var symbol = leftExpressionType.symbol; + if (!symbol || !symbol.declarations) + return void 0; + if (ts6.isIdentifier(token) && ts6.isCallExpression(parent.parent)) { + var moduleDeclaration = ts6.find(symbol.declarations, ts6.isModuleDeclaration); + var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); + if (moduleDeclaration && moduleDeclarationSourceFile && !ts6.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { + return { kind: InfoKind.Function, token, call: parent.parent, sourceFile, modifierFlags: 1, parentDeclaration: moduleDeclaration }; + } + var moduleSourceFile = ts6.find(symbol.declarations, ts6.isSourceFile); + if (sourceFile.commonJsModuleIndicator) + return void 0; + if (moduleSourceFile && !ts6.isSourceFileFromLibrary(program, moduleSourceFile)) { + return { kind: InfoKind.Function, token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1, parentDeclaration: moduleSourceFile }; + } + } + var classDeclaration = ts6.find(symbol.declarations, ts6.isClassLike); + if (!classDeclaration && ts6.isPrivateIdentifier(token)) + return void 0; + var declaration = classDeclaration || ts6.find(symbol.declarations, function(d) { + return ts6.isInterfaceDeclaration(d) || ts6.isTypeLiteralNode(d); + }); + if (declaration && !ts6.isSourceFileFromLibrary(program, declaration.getSourceFile())) { + var makeStatic = !ts6.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); + if (makeStatic && (ts6.isPrivateIdentifier(token) || ts6.isInterfaceDeclaration(declaration))) + return void 0; + var declSourceFile = declaration.getSourceFile(); + var modifierFlags = ts6.isTypeLiteralNode(declaration) ? 0 : (makeStatic ? 32 : 0) | (ts6.startsWithUnderscore(token.text) ? 8 : 0); + var isJSFile = ts6.isSourceFileJS(declSourceFile); + var call = ts6.tryCast(parent.parent, ts6.isCallExpression); + return { kind: InfoKind.TypeLikeDeclaration, token, call, modifierFlags, parentDeclaration: declaration, declSourceFile, isJSFile }; + } + var enumDeclaration = ts6.find(symbol.declarations, ts6.isEnumDeclaration); + if (enumDeclaration && !(leftExpressionType.flags & 1056) && !ts6.isPrivateIdentifier(token) && !ts6.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + return { kind: InfoKind.Enum, token, parentDeclaration: enumDeclaration }; + } + return void 0; + } + function getActionsForMissingMemberDeclaration(context, info) { + return info.isJSFile ? ts6.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); + } + function createActionForAddMissingMemberInJavascriptFile(context, _a) { + var parentDeclaration = _a.parentDeclaration, declSourceFile = _a.declSourceFile, modifierFlags = _a.modifierFlags, token = _a.token; + if (ts6.isInterfaceDeclaration(parentDeclaration) || ts6.isTypeLiteralNode(parentDeclaration)) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addMissingMemberInJs(t, declSourceFile, parentDeclaration, token, !!(modifierFlags & 32)); + }); + if (changes.length === 0) { + return void 0; + } + var diagnostic = modifierFlags & 32 ? ts6.Diagnostics.Initialize_static_property_0 : ts6.isPrivateIdentifier(token) ? ts6.Diagnostics.Declare_a_private_field_named_0 : ts6.Diagnostics.Initialize_property_0_in_the_constructor; + return codefix2.createCodeFixAction(fixMissingMember, changes, [diagnostic, token.text], fixMissingMember, ts6.Diagnostics.Add_all_missing_members); + } + function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { + var tokenName = token.text; + if (makeStatic) { + if (classDeclaration.kind === 228) { + return; + } + var className = classDeclaration.name.getText(); + var staticInitialization = initializePropertyToUndefined(ts6.factory.createIdentifier(className), tokenName); + changeTracker.insertNodeAfter(sourceFile, classDeclaration, staticInitialization); + } else if (ts6.isPrivateIdentifier(token)) { + var property = ts6.factory.createPropertyDeclaration( + /*modifiers*/ + void 0, + tokenName, + /*questionToken*/ + void 0, + /*type*/ + void 0, + /*initializer*/ + void 0 + ); + var lastProp = getNodeToInsertPropertyAfter(classDeclaration); + if (lastProp) { + changeTracker.insertNodeAfter(sourceFile, lastProp, property); + } else { + changeTracker.insertMemberAtStart(sourceFile, classDeclaration, property); + } + } else { + var classConstructor = ts6.getFirstConstructorWithBody(classDeclaration); + if (!classConstructor) { + return; + } + var propertyInitialization = initializePropertyToUndefined(ts6.factory.createThis(), tokenName); + changeTracker.insertNodeAtConstructorEnd(sourceFile, classConstructor, propertyInitialization); + } + } + function initializePropertyToUndefined(obj, propertyName) { + return ts6.factory.createExpressionStatement(ts6.factory.createAssignment(ts6.factory.createPropertyAccessExpression(obj, propertyName), createUndefined())); + } + function createActionsForAddMissingMemberInTypeScriptFile(context, _a) { + var parentDeclaration = _a.parentDeclaration, declSourceFile = _a.declSourceFile, modifierFlags = _a.modifierFlags, token = _a.token; + var memberName = token.text; + var isStatic = modifierFlags & 32; + var typeNode = getTypeNode(context.program.getTypeChecker(), parentDeclaration, token); + var addPropertyDeclarationChanges = function(modifierFlags2) { + return ts6.textChanges.ChangeTracker.with(context, function(t) { + return addPropertyDeclaration(t, declSourceFile, parentDeclaration, memberName, typeNode, modifierFlags2); + }); + }; + var actions = [codefix2.createCodeFixAction(fixMissingMember, addPropertyDeclarationChanges( + modifierFlags & 32 + /* ModifierFlags.Static */ + ), [isStatic ? ts6.Diagnostics.Declare_static_property_0 : ts6.Diagnostics.Declare_property_0, memberName], fixMissingMember, ts6.Diagnostics.Add_all_missing_members)]; + if (isStatic || ts6.isPrivateIdentifier(token)) { + return actions; + } + if (modifierFlags & 8) { + actions.unshift(codefix2.createCodeFixActionWithoutFixAll(fixMissingMember, addPropertyDeclarationChanges( + 8 + /* ModifierFlags.Private */ + ), [ts6.Diagnostics.Declare_private_property_0, memberName])); + } + actions.push(createAddIndexSignatureAction(context, declSourceFile, parentDeclaration, token.text, typeNode)); + return actions; + } + function getTypeNode(checker, node, token) { + var typeNode; + if (token.parent.parent.kind === 223) { + var binaryExpression = token.parent.parent; + var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; + var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); + typeNode = checker.typeToTypeNode( + widenedType, + node, + 1 + /* NodeBuilderFlags.NoTruncation */ + ); + } else { + var contextualType = checker.getContextualType(token.parent); + typeNode = contextualType ? checker.typeToTypeNode( + contextualType, + /*enclosingDeclaration*/ + void 0, + 1 + /* NodeBuilderFlags.NoTruncation */ + ) : void 0; + } + return typeNode || ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + ); + } + function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { + var modifiers = modifierFlags ? ts6.factory.createNodeArray(ts6.factory.createModifiersFromModifierFlags(modifierFlags)) : void 0; + var property = ts6.isClassLike(node) ? ts6.factory.createPropertyDeclaration( + modifiers, + tokenName, + /*questionToken*/ + void 0, + typeNode, + /*initializer*/ + void 0 + ) : ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + tokenName, + /*questionToken*/ + void 0, + typeNode + ); + var lastProp = getNodeToInsertPropertyAfter(node); + if (lastProp) { + changeTracker.insertNodeAfter(sourceFile, lastProp, property); + } else { + changeTracker.insertMemberAtStart(sourceFile, node, property); + } + } + function getNodeToInsertPropertyAfter(node) { + var res; + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (!ts6.isPropertyDeclaration(member)) + break; + res = member; + } + return res; + } + function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { + var stringTypeNode = ts6.factory.createKeywordTypeNode( + 152 + /* SyntaxKind.StringKeyword */ + ); + var indexingParameter = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "x", + /*questionToken*/ + void 0, + stringTypeNode, + /*initializer*/ + void 0 + ); + var indexSignature = ts6.factory.createIndexSignature( + /*modifiers*/ + void 0, + [indexingParameter], + typeNode + ); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.insertMemberAtStart(sourceFile, node, indexSignature); + }); + return codefix2.createCodeFixActionWithoutFixAll(fixMissingMember, changes, [ts6.Diagnostics.Add_index_signature_for_property_0, tokenName]); + } + function getActionsForMissingMethodDeclaration(context, info) { + var parentDeclaration = info.parentDeclaration, declSourceFile = info.declSourceFile, modifierFlags = info.modifierFlags, token = info.token, call = info.call; + if (call === void 0) { + return void 0; + } + if (ts6.isPrivateIdentifier(token)) { + return void 0; + } + var methodName = token.text; + var addMethodDeclarationChanges = function(modifierFlags2) { + return ts6.textChanges.ChangeTracker.with(context, function(t) { + return addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile); + }); + }; + var actions = [codefix2.createCodeFixAction(fixMissingMember, addMethodDeclarationChanges( + modifierFlags & 32 + /* ModifierFlags.Static */ + ), [modifierFlags & 32 ? ts6.Diagnostics.Declare_static_method_0 : ts6.Diagnostics.Declare_method_0, methodName], fixMissingMember, ts6.Diagnostics.Add_all_missing_members)]; + if (modifierFlags & 8) { + actions.unshift(codefix2.createCodeFixActionWithoutFixAll(fixMissingMember, addMethodDeclarationChanges( + 8 + /* ModifierFlags.Private */ + ), [ts6.Diagnostics.Declare_private_method_0, methodName])); + } + return actions; + } + function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { + var importAdder = codefix2.createImportAdder(sourceFile, context.program, context.preferences, context.host); + var kind = ts6.isClassLike(parentDeclaration) ? 171 : 170; + var signatureDeclaration = codefix2.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); + var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); + if (containingMethodDeclaration) { + changes.insertNodeAfter(sourceFile, containingMethodDeclaration, signatureDeclaration); + } else { + changes.insertMemberAtStart(sourceFile, parentDeclaration, signatureDeclaration); + } + importAdder.writeFixes(changes); + } + function addEnumMemberDeclaration(changes, checker, _a) { + var token = _a.token, parentDeclaration = _a.parentDeclaration; + var hasStringInitializer = ts6.some(parentDeclaration.members, function(member) { + var type = checker.getTypeAtLocation(member); + return !!(type && type.flags & 402653316); + }); + var enumMember = ts6.factory.createEnumMember(token, hasStringInitializer ? ts6.factory.createStringLiteral(token.text) : void 0); + changes.replaceNode(parentDeclaration.getSourceFile(), parentDeclaration, ts6.factory.updateEnumDeclaration(parentDeclaration, parentDeclaration.modifiers, parentDeclaration.name, ts6.concatenate(parentDeclaration.members, ts6.singleElementArray(enumMember))), { + leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.IncludeAll, + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Exclude + }); + } + function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts6.getQuotePreference(context.sourceFile, context.preferences); + var importAdder = codefix2.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); + var functionDeclaration = info.kind === InfoKind.Function ? codefix2.createSignatureDeclarationFromCallExpression(259, context, importAdder, info.call, ts6.idText(info.token), info.modifierFlags, info.parentDeclaration) : codefix2.createSignatureDeclarationFromSignature( + 259, + context, + quotePreference, + info.signature, + codefix2.createStubbedBody(ts6.Diagnostics.Function_not_implemented.message, quotePreference), + info.token, + /*modifiers*/ + void 0, + /*optional*/ + void 0, + /*enclosingDeclaration*/ + void 0, + importAdder + ); + if (functionDeclaration === void 0) { + ts6.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts6.isReturnStatement(info.parentDeclaration) ? changes.insertNodeBefore( + info.sourceFile, + info.parentDeclaration, + functionDeclaration, + /*blankLineBetween*/ + true + ) : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + importAdder.writeFixes(changes); + } + function addJsxAttributes(changes, context, info) { + var importAdder = codefix2.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); + var quotePreference = ts6.getQuotePreference(context.sourceFile, context.preferences); + var checker = context.program.getTypeChecker(); + var jsxAttributesNode = info.parentDeclaration.attributes; + var hasSpreadAttribute = ts6.some(jsxAttributesNode.properties, ts6.isJsxSpreadAttribute); + var attrs = ts6.map(info.attributes, function(attr) { + var value = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(attr), info.parentDeclaration); + var name = ts6.factory.createIdentifier(attr.name); + var jsxAttribute = ts6.factory.createJsxAttribute(name, ts6.factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + value + )); + ts6.setParent(name, jsxAttribute); + return jsxAttribute; + }); + var jsxAttributes = ts6.factory.createJsxAttributes(hasSpreadAttribute ? __spreadArray(__spreadArray([], attrs, true), jsxAttributesNode.properties, true) : __spreadArray(__spreadArray([], jsxAttributesNode.properties, true), attrs, true)); + var options = { prefix: jsxAttributesNode.pos === jsxAttributesNode.end ? " " : void 0 }; + changes.replaceNode(context.sourceFile, jsxAttributesNode, jsxAttributes, options); + importAdder.writeFixes(changes); + } + function addObjectLiteralProperties(changes, context, info) { + var importAdder = codefix2.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); + var quotePreference = ts6.getQuotePreference(context.sourceFile, context.preferences); + var target = ts6.getEmitScriptTarget(context.program.getCompilerOptions()); + var checker = context.program.getTypeChecker(); + var props = ts6.map(info.properties, function(prop) { + var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration); + return ts6.factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer); + }); + var options = { + leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.Exclude, + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Exclude, + indentation: info.indentation + }; + changes.replaceNode(context.sourceFile, info.parentDeclaration, ts6.factory.createObjectLiteralExpression( + __spreadArray(__spreadArray([], info.parentDeclaration.properties, true), props, true), + /*multiLine*/ + true + ), options); + importAdder.writeFixes(changes); + } + function tryGetValueFromType(context, checker, importAdder, quotePreference, type, enclosingDeclaration) { + if (type.flags & 3) { + return createUndefined(); + } + if (type.flags & (4 | 134217728)) { + return ts6.factory.createStringLiteral( + "", + /* isSingleQuote */ + quotePreference === 0 + /* QuotePreference.Single */ + ); + } + if (type.flags & 8) { + return ts6.factory.createNumericLiteral(0); + } + if (type.flags & 64) { + return ts6.factory.createBigIntLiteral("0n"); + } + if (type.flags & 16) { + return ts6.factory.createFalse(); + } + if (type.flags & 1056) { + var enumMember = type.symbol.exports ? ts6.firstOrUndefined(ts6.arrayFrom(type.symbol.exports.values())) : type.symbol; + var name = checker.symbolToExpression( + type.symbol.parent ? type.symbol.parent : type.symbol, + 111551, + /*enclosingDeclaration*/ + void 0, + /*flags*/ + void 0 + ); + return enumMember === void 0 || name === void 0 ? ts6.factory.createNumericLiteral(0) : ts6.factory.createPropertyAccessExpression(name, checker.symbolToString(enumMember)); + } + if (type.flags & 256) { + return ts6.factory.createNumericLiteral(type.value); + } + if (type.flags & 2048) { + return ts6.factory.createBigIntLiteral(type.value); + } + if (type.flags & 128) { + return ts6.factory.createStringLiteral( + type.value, + /* isSingleQuote */ + quotePreference === 0 + /* QuotePreference.Single */ + ); + } + if (type.flags & 512) { + return type === checker.getFalseType() || type === checker.getFalseType( + /*fresh*/ + true + ) ? ts6.factory.createFalse() : ts6.factory.createTrue(); + } + if (type.flags & 65536) { + return ts6.factory.createNull(); + } + if (type.flags & 1048576) { + var expression = ts6.firstDefined(type.types, function(t) { + return tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration); + }); + return expression !== null && expression !== void 0 ? expression : createUndefined(); + } + if (checker.isArrayLikeType(type)) { + return ts6.factory.createArrayLiteralExpression(); + } + if (isObjectLiteralType(type)) { + var props = ts6.map(checker.getPropertiesOfType(type), function(prop) { + var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined(); + return ts6.factory.createPropertyAssignment(prop.name, initializer); + }); + return ts6.factory.createObjectLiteralExpression( + props, + /*multiLine*/ + true + ); + } + if (ts6.getObjectFlags(type) & 16) { + var decl = ts6.find(type.symbol.declarations || ts6.emptyArray, ts6.or(ts6.isFunctionTypeNode, ts6.isMethodSignature, ts6.isMethodDeclaration)); + if (decl === void 0) + return createUndefined(); + var signature = checker.getSignaturesOfType( + type, + 0 + /* SignatureKind.Call */ + ); + if (signature === void 0) + return createUndefined(); + var func = codefix2.createSignatureDeclarationFromSignature( + 215, + context, + quotePreference, + signature[0], + codefix2.createStubbedBody(ts6.Diagnostics.Function_not_implemented.message, quotePreference), + /*name*/ + void 0, + /*modifiers*/ + void 0, + /*optional*/ + void 0, + /*enclosingDeclaration*/ + enclosingDeclaration, + importAdder + ); + return func !== null && func !== void 0 ? func : createUndefined(); + } + if (ts6.getObjectFlags(type) & 1) { + var classDeclaration = ts6.getClassLikeDeclarationOfSymbol(type.symbol); + if (classDeclaration === void 0 || ts6.hasAbstractModifier(classDeclaration)) + return createUndefined(); + var constructorDeclaration = ts6.getFirstConstructorWithBody(classDeclaration); + if (constructorDeclaration && ts6.length(constructorDeclaration.parameters)) + return createUndefined(); + return ts6.factory.createNewExpression( + ts6.factory.createIdentifier(type.symbol.name), + /*typeArguments*/ + void 0, + /*argumentsArray*/ + void 0 + ); + } + return createUndefined(); + } + function createUndefined() { + return ts6.factory.createIdentifier("undefined"); + } + function isObjectLiteralType(type) { + return type.flags & 524288 && (ts6.getObjectFlags(type) & 128 || type.symbol && ts6.tryCast(ts6.singleOrUndefined(type.symbol.declarations), ts6.isTypeLiteralNode)); + } + function getUnmatchedAttributes(checker, target, source) { + var attrsType = checker.getContextualType(source.attributes); + if (attrsType === void 0) + return ts6.emptyArray; + var targetProps = attrsType.getProperties(); + if (!ts6.length(targetProps)) + return ts6.emptyArray; + var seenNames = new ts6.Set(); + for (var _i = 0, _a = source.attributes.properties; _i < _a.length; _i++) { + var sourceProp = _a[_i]; + if (ts6.isJsxAttribute(sourceProp)) { + seenNames.add(sourceProp.name.escapedText); + } + if (ts6.isJsxSpreadAttribute(sourceProp)) { + var type = checker.getTypeAtLocation(sourceProp.expression); + for (var _b = 0, _c = type.getProperties(); _b < _c.length; _b++) { + var prop = _c[_b]; + seenNames.add(prop.escapedName); + } + } + } + return ts6.filter(targetProps, function(targetProp) { + return ts6.isIdentifierText( + targetProp.name, + target, + 1 + /* LanguageVariant.JSX */ + ) && !(targetProp.flags & 16777216 || ts6.getCheckFlags(targetProp) & 48 || seenNames.has(targetProp.escapedName)); + }); + } + function tryGetContainingMethodDeclaration(node, callExpression) { + if (ts6.isTypeLiteralNode(node)) { + return void 0; + } + var declaration = ts6.findAncestor(callExpression, function(n) { + return ts6.isMethodDeclaration(n) || ts6.isConstructorDeclaration(n); + }); + return declaration && declaration.parent === node ? declaration : void 0; + } + function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { + if (ts6.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode( + symbol, + 111551, + /*enclosingDeclaration*/ + void 0, + 1073741824 + /* NodeBuilderFlags.WriteComputedProps */ + ); + if (prop && ts6.isComputedPropertyName(prop)) + return prop; + } + return ts6.createPropertyNameNodeForIdentifierOrLiteral( + symbol.name, + target, + quotePreference === 0 + /* QuotePreference.Single */ + ); + } + function findScope(node) { + if (ts6.findAncestor(node, ts6.isJsxExpression)) { + var returnStatement = ts6.findAncestor(node.parent, ts6.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts6.getSourceFileOfNode(node); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "addMissingNewOperator"; + var errorCodes = [ts6.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addMissingNewOperator(t, sourceFile, span); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_missing_new_operator_to_call, fixId, ts6.Diagnostics.Add_missing_new_operator_to_all_calls)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return addMissingNewOperator(changes, context.sourceFile, diag); + }); + } + }); + function addMissingNewOperator(changes, sourceFile, span) { + var call = ts6.cast(findAncestorMatchingSpan(sourceFile, span), ts6.isCallExpression); + var newExpression = ts6.factory.createNewExpression(call.expression, call.typeArguments, call.arguments); + changes.replaceNode(sourceFile, call, newExpression); + } + function findAncestorMatchingSpan(sourceFile, span) { + var token = ts6.getTokenAtPosition(sourceFile, span.start); + var end = ts6.textSpanEnd(span); + while (token.end < end) { + token = token.parent; + } + return token; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixName = "fixCannotFindModule"; + var fixIdInstallTypesPackage = "installTypesPackage"; + var errorCodeCannotFindModule = ts6.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code; + var errorCodes = [ + errorCodeCannotFindModule, + ts6.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToFixNotFoundModule(context) { + var host = context.host, sourceFile = context.sourceFile, start = context.span.start; + var packageName = tryGetImportedPackageName(sourceFile, start); + if (packageName === void 0) + return void 0; + var typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode); + return typesPackageName === void 0 ? [] : [codefix2.createCodeFixAction( + fixName, + /*changes*/ + [], + [ts6.Diagnostics.Install_0, typesPackageName], + fixIdInstallTypesPackage, + ts6.Diagnostics.Install_all_missing_types_packages, + getInstallCommand(sourceFile.fileName, typesPackageName) + )]; + }, + fixIds: [fixIdInstallTypesPackage], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(_changes, diag, commands) { + var packageName = tryGetImportedPackageName(diag.file, diag.start); + if (packageName === void 0) + return void 0; + switch (context.fixId) { + case fixIdInstallTypesPackage: { + var pkg = getTypesPackageNameToInstall(packageName, context.host, diag.code); + if (pkg) { + commands.push(getInstallCommand(diag.file.fileName, pkg)); + } + break; + } + default: + ts6.Debug.fail("Bad fixId: ".concat(context.fixId)); + } + }); + } + }); + function getInstallCommand(fileName, packageName) { + return { type: "install package", file: fileName, packageName }; + } + function tryGetImportedPackageName(sourceFile, pos) { + var moduleSpecifierText = ts6.tryCast(ts6.getTokenAtPosition(sourceFile, pos), ts6.isStringLiteral); + if (!moduleSpecifierText) + return void 0; + var moduleName = moduleSpecifierText.text; + var packageName = ts6.parsePackageName(moduleName).packageName; + return ts6.isExternalModuleNameRelative(packageName) ? void 0 : packageName; + } + function getTypesPackageNameToInstall(packageName, host, diagCode) { + var _a; + return diagCode === errorCodeCannotFindModule ? ts6.JsTyping.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a = host.isKnownTypesPackageName) === null || _a === void 0 ? void 0 : _a.call(host, packageName)) ? ts6.getTypesPackageName(packageName) : void 0; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodes = [ + ts6.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code, + ts6.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code + ]; + var fixId = "fixClassDoesntImplementInheritedAbstractMember"; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) { + var sourceFile = context.sourceFile, span = context.span; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addMissingMembers(getClass(sourceFile, span.start), sourceFile, context, t, context.preferences); + }); + return changes.length === 0 ? void 0 : [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Implement_inherited_abstract_class, fixId, ts6.Diagnostics.Implement_all_inherited_abstract_classes)]; + }, + fixIds: [fixId], + getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) { + var seenClassDeclarations = new ts6.Map(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var classDeclaration = getClass(diag.file, diag.start); + if (ts6.addToSeen(seenClassDeclarations, ts6.getNodeId(classDeclaration))) { + addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences); + } + }); + } + }); + function getClass(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + return ts6.cast(token.parent, ts6.isClassLike); + } + function addMissingMembers(classDeclaration, sourceFile, context, changeTracker, preferences) { + var extendsNode = ts6.getEffectiveBaseTypeNode(classDeclaration); + var checker = context.program.getTypeChecker(); + var instantiatedExtendsType = checker.getTypeAtLocation(extendsNode); + var abstractAndNonPrivateExtendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType).filter(symbolPointsToNonPrivateAndAbstractMember); + var importAdder = codefix2.createImportAdder(sourceFile, context.program, preferences, context.host); + codefix2.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, sourceFile, context, preferences, importAdder, function(member) { + return changeTracker.insertMemberAtStart(sourceFile, classDeclaration, member); + }); + importAdder.writeFixes(changeTracker); + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var flags = ts6.getSyntacticModifierFlags(ts6.first(symbol.getDeclarations())); + return !(flags & 8) && !!(flags & 256); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "classSuperMustPrecedeThisAccess"; + var errorCodes = [ts6.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var nodes = getNodes(sourceFile, span.start); + if (!nodes) + return void 0; + var constructor = nodes.constructor, superCall = nodes.superCall; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, constructor, superCall); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId, ts6.Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var sourceFile = context.sourceFile; + var seenClasses = new ts6.Map(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var nodes = getNodes(diag.file, diag.start); + if (!nodes) + return; + var constructor = nodes.constructor, superCall = nodes.superCall; + if (ts6.addToSeen(seenClasses, ts6.getNodeId(constructor.parent))) { + doChange(changes, sourceFile, constructor, superCall); + } + }); + } + }); + function doChange(changes, sourceFile, constructor, superCall) { + changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall); + changes.delete(sourceFile, superCall); + } + function getNodes(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (token.kind !== 108) + return void 0; + var constructor = ts6.getContainingFunction(token); + var superCall = findSuperCall(constructor.body); + return superCall && !superCall.expression.arguments.some(function(arg) { + return ts6.isPropertyAccessExpression(arg) && arg.expression === token; + }) ? { constructor, superCall } : void 0; + } + function findSuperCall(n) { + return ts6.isExpressionStatement(n) && ts6.isSuperCall(n.expression) ? n : ts6.isFunctionLike(n) ? void 0 : ts6.forEachChild(n, findSuperCall); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "constructorForDerivedNeedSuperCall"; + var errorCodes = [ts6.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var ctr = getNode(sourceFile, span.start); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, ctr); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_missing_super_call, fixId, ts6.Diagnostics.Add_all_missing_super_calls)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return doChange(changes, context.sourceFile, getNode(diag.file, diag.start)); + }); + } + }); + function getNode(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + ts6.Debug.assert(ts6.isConstructorDeclaration(token.parent), "token should be at the constructor declaration"); + return token.parent; + } + function doChange(changes, sourceFile, ctr) { + var superCall = ts6.factory.createExpressionStatement(ts6.factory.createCallExpression( + ts6.factory.createSuper(), + /*typeArguments*/ + void 0, + /*argumentsArray*/ + ts6.emptyArray + )); + changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "enableExperimentalDecorators"; + var errorCodes = [ + ts6.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === void 0) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(changeTracker) { + return doChange(changeTracker, configFile); + }); + return [codefix2.createCodeFixActionWithoutFixAll(fixId, changes, ts6.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === void 0) { + return void 0; + } + doChange(changes, configFile); + }); + } + }); + function doChange(changeTracker, configFile) { + codefix2.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts6.factory.createTrue()); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixID = "fixEnableJsxFlag"; + var errorCodes = [ts6.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === void 0) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(changeTracker) { + return doChange(changeTracker, configFile); + }); + return [ + codefix2.createCodeFixActionWithoutFixAll(fixID, changes, ts6.Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) + ]; + }, + fixIds: [fixID], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === void 0) { + return void 0; + } + doChange(changes, configFile); + }); + } + }); + function doChange(changeTracker, configFile) { + codefix2.setJsonCompilerOptionValue(changeTracker, configFile, "jsx", ts6.factory.createStringLiteral("react")); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts6.Diagnostics.This_condition_will_always_return_0.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === void 0) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, arg, expression); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Use_0, suggestion], fixId, ts6.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(context.program, diag.file, ts6.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts6.find(program.getSemanticDiagnostics(sourceFile), function(diag2) { + return diag2.start === span.start && diag2.length === span.length; + }); + if (diag === void 0 || diag.relatedInformation === void 0) + return; + var related = ts6.find(diag.relatedInformation, function(related2) { + return related2.code === ts6.Diagnostics.Did_you_mean_0.code; + }); + if (related === void 0 || related.file === void 0 || related.start === void 0 || related.length === void 0) + return; + var token = codefix2.findAncestorMatchingSpan(related.file, ts6.createTextSpan(related.start, related.length)); + if (token === void 0) + return; + if (ts6.isExpression(token) && ts6.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return void 0; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts6.factory.createCallExpression( + ts6.factory.createPropertyAccessExpression(ts6.factory.createIdentifier("Number"), ts6.factory.createIdentifier("isNaN")), + /*typeArguments*/ + void 0, + [arg] + ); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 || operator === 35 ? ts6.factory.createPrefixUnaryExpression(53, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts6.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + codefix2.registerCodeFix({ + errorCodes: [ + ts6.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code, + ts6.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code + ], + getCodeActions: function getCodeActionsToFixModuleAndTarget(context) { + var compilerOptions = context.program.getCompilerOptions(); + var configFile = compilerOptions.configFile; + if (configFile === void 0) { + return void 0; + } + var codeFixes = []; + var moduleKind = ts6.getEmitModuleKind(compilerOptions); + var moduleOutOfRange = moduleKind >= ts6.ModuleKind.ES2015 && moduleKind < ts6.ModuleKind.ESNext; + if (moduleOutOfRange) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(changes2) { + codefix2.setJsonCompilerOptionValue(changes2, configFile, "module", ts6.factory.createStringLiteral("esnext")); + }); + codeFixes.push(codefix2.createCodeFixActionWithoutFixAll("fixModuleOption", changes, [ts6.Diagnostics.Set_the_module_option_in_your_configuration_file_to_0, "esnext"])); + } + var target = ts6.getEmitScriptTarget(compilerOptions); + var targetOutOfRange = target < 4 || target > 99; + if (targetOutOfRange) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(tracker) { + var configObject = ts6.getTsConfigObjectLiteralExpression(configFile); + if (!configObject) + return; + var options = [["target", ts6.factory.createStringLiteral("es2017")]]; + if (moduleKind === ts6.ModuleKind.CommonJS) { + options.push(["module", ts6.factory.createStringLiteral("commonjs")]); + } + codefix2.setJsonCompilerOptionValues(tracker, configFile, options); + }); + codeFixes.push(codefix2.createCodeFixActionWithoutFixAll("fixTargetOption", changes, [ts6.Diagnostics.Set_the_target_option_in_your_configuration_file_to_0, "es2017"])); + } + return codeFixes.length ? codeFixes : void 0; + } + }); + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixPropertyAssignment"; + var errorCodes = [ + ts6.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var property = getProperty(sourceFile, span.start); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, property); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Change_0_to_1, "=", ":"], fixId, [ts6.Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return doChange(changes, diag.file, getProperty(diag.file, diag.start)); + }); + } + }); + function doChange(changes, sourceFile, node) { + changes.replaceNode(sourceFile, node, ts6.factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer)); + } + function getProperty(sourceFile, pos) { + return ts6.cast(ts6.getTokenAtPosition(sourceFile, pos).parent, ts6.isShorthandPropertyAssignment); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "extendsInterfaceBecomesImplements"; + var errorCodes = [ts6.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile; + var nodes = getNodes(sourceFile, context.span.start); + if (!nodes) + return void 0; + var extendsToken = nodes.extendsToken, heritageClauses = nodes.heritageClauses; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChanges(t, sourceFile, extendsToken, heritageClauses); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Change_extends_to_implements, fixId, ts6.Diagnostics.Change_all_extended_interfaces_to_implements)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var nodes = getNodes(diag.file, diag.start); + if (nodes) + doChanges(changes, diag.file, nodes.extendsToken, nodes.heritageClauses); + }); + } + }); + function getNodes(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + var heritageClauses = ts6.getContainingClass(token).heritageClauses; + var extendsToken = heritageClauses[0].getFirstToken(); + return extendsToken.kind === 94 ? { extendsToken, heritageClauses } : void 0; + } + function doChanges(changes, sourceFile, extendsToken, heritageClauses) { + changes.replaceNode(sourceFile, extendsToken, ts6.factory.createToken( + 117 + /* SyntaxKind.ImplementsKeyword */ + )); + if (heritageClauses.length === 2 && heritageClauses[0].token === 94 && heritageClauses[1].token === 117) { + var implementsToken = heritageClauses[1].getFirstToken(); + var implementsFullStart = implementsToken.getFullStart(); + changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts6.factory.createToken( + 27 + /* SyntaxKind.CommaToken */ + )); + var text = sourceFile.text; + var end = implementsToken.end; + while (end < text.length && ts6.isWhiteSpaceSingleLine(text.charCodeAt(end))) { + end++; + } + changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end }); + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "forgottenThisPropertyAccess"; + var didYouMeanStaticMemberCode = ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; + var errorCodes = [ + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, + ts6.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code, + didYouMeanStaticMemberCode + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile; + var info = getInfo(sourceFile, context.span.start, context.errorCode); + if (!info) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, info); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId, ts6.Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start, diag.code); + if (info) + doChange(changes, context.sourceFile, info); + }); + } + }); + function getInfo(sourceFile, pos, diagCode) { + var node = ts6.getTokenAtPosition(sourceFile, pos); + if (ts6.isIdentifier(node) || ts6.isPrivateIdentifier(node)) { + return { node, className: diagCode === didYouMeanStaticMemberCode ? ts6.getContainingClass(node).name.text : void 0 }; + } + } + function doChange(changes, sourceFile, _a) { + var node = _a.node, className = _a.className; + ts6.suppressLeadingAndTrailingTrivia(node); + changes.replaceNode(sourceFile, node, ts6.factory.createPropertyAccessExpression(className ? ts6.factory.createIdentifier(className) : ts6.factory.createThis(), node)); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixIdExpression = "fixInvalidJsxCharacters_expression"; + var fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity"; + var errorCodes = [ + ts6.Diagnostics.Unexpected_token_Did_you_mean_or_gt.code, + ts6.Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixIdExpression, fixIdHtmlEntity], + getCodeActions: function(context) { + var sourceFile = context.sourceFile, preferences = context.preferences, span = context.span; + var changeToExpression = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange( + t, + preferences, + sourceFile, + span.start, + /* useHtmlEntity */ + false + ); + }); + var changeToHtmlEntity = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange( + t, + preferences, + sourceFile, + span.start, + /* useHtmlEntity */ + true + ); + }); + return [ + codefix2.createCodeFixAction(fixIdExpression, changeToExpression, ts6.Diagnostics.Wrap_invalid_character_in_an_expression_container, fixIdExpression, ts6.Diagnostics.Wrap_all_invalid_characters_in_an_expression_container), + codefix2.createCodeFixAction(fixIdHtmlEntity, changeToHtmlEntity, ts6.Diagnostics.Convert_invalid_character_to_its_html_entity_code, fixIdHtmlEntity, ts6.Diagnostics.Convert_all_invalid_characters_to_HTML_entity_code) + ]; + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diagnostic) { + return doChange(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity); + }); + } + }); + var htmlEntity = { + ">": ">", + "}": "}" + }; + function isValidCharacter(character) { + return ts6.hasProperty(htmlEntity, character); + } + function doChange(changes, preferences, sourceFile, start, useHtmlEntity) { + var character = sourceFile.getText()[start]; + if (!isValidCharacter(character)) { + return; + } + var replacement = useHtmlEntity ? htmlEntity[character] : "{".concat(ts6.quote(sourceFile, preferences, character), "}"); + changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var deleteUnmatchedParameter = "deleteUnmatchedParameter"; + var renameUnmatchedParameter = "renameUnmatchedParameter"; + var errorCodes = [ + ts6.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code + ]; + codefix2.registerCodeFix({ + fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter], + errorCodes, + getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) { + var sourceFile = context.sourceFile, span = context.span; + var actions = []; + var info = getInfo(sourceFile, span.start); + if (info) { + ts6.append(actions, getDeleteAction(context, info)); + ts6.append(actions, getRenameAction(context, info)); + return actions; + } + return void 0; + }, + getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) { + var tagsToSignature = new ts6.Map(); + return codefix2.createCombinedCodeActions(ts6.textChanges.ChangeTracker.with(context, function(changes) { + codefix2.eachDiagnostic(context, errorCodes, function(_a) { + var file = _a.file, start = _a.start; + var info = getInfo(file, start); + if (info) { + tagsToSignature.set(info.signature, ts6.append(tagsToSignature.get(info.signature), info.jsDocParameterTag)); + } + }); + tagsToSignature.forEach(function(tags, signature) { + if (context.fixId === deleteUnmatchedParameter) { + var tagsSet_1 = new ts6.Set(tags); + changes.filterJSDocTags(signature.getSourceFile(), signature, function(t) { + return !tagsSet_1.has(t); + }); + } + }); + })); + } + }); + function getDeleteAction(context, _a) { + var name = _a.name, signature = _a.signature, jsDocParameterTag = _a.jsDocParameterTag; + var changes = ts6.textChanges.ChangeTracker.with(context, function(changeTracker) { + return changeTracker.filterJSDocTags(context.sourceFile, signature, function(t) { + return t !== jsDocParameterTag; + }); + }); + return codefix2.createCodeFixAction(deleteUnmatchedParameter, changes, [ts6.Diagnostics.Delete_unused_param_tag_0, name.getText(context.sourceFile)], deleteUnmatchedParameter, ts6.Diagnostics.Delete_all_unused_param_tags); + } + function getRenameAction(context, _a) { + var name = _a.name, signature = _a.signature, jsDocParameterTag = _a.jsDocParameterTag; + if (!ts6.length(signature.parameters)) + return void 0; + var sourceFile = context.sourceFile; + var tags = ts6.getJSDocTags(signature); + var names = new ts6.Set(); + for (var _i = 0, tags_2 = tags; _i < tags_2.length; _i++) { + var tag = tags_2[_i]; + if (ts6.isJSDocParameterTag(tag) && ts6.isIdentifier(tag.name)) { + names.add(tag.name.escapedText); + } + } + var parameterName = ts6.firstDefined(signature.parameters, function(p) { + return ts6.isIdentifier(p.name) && !names.has(p.name.escapedText) ? p.name.getText(sourceFile) : void 0; + }); + if (parameterName === void 0) + return void 0; + var newJSDocParameterTag = ts6.factory.updateJSDocParameterTag(jsDocParameterTag, jsDocParameterTag.tagName, ts6.factory.createIdentifier(parameterName), jsDocParameterTag.isBracketed, jsDocParameterTag.typeExpression, jsDocParameterTag.isNameFirst, jsDocParameterTag.comment); + var changes = ts6.textChanges.ChangeTracker.with(context, function(changeTracker) { + return changeTracker.replaceJSDocComment(sourceFile, signature, ts6.map(tags, function(t) { + return t === jsDocParameterTag ? newJSDocParameterTag : t; + })); + }); + return codefix2.createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [ts6.Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]); + } + function getInfo(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (token.parent && ts6.isJSDocParameterTag(token.parent) && ts6.isIdentifier(token.parent.name)) { + var jsDocParameterTag = token.parent; + var signature = ts6.getHostSignatureFromJSDoc(jsDocParameterTag); + if (signature) { + return { signature, name: token.parent.name, jsDocParameterTag }; + } + } + return void 0; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixUnreferenceableDecoratorMetadata"; + var errorCodes = [ts6.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); + if (!importDeclaration) + return; + var namespaceChanges = ts6.textChanges.ChangeTracker.with(context, function(t) { + return importDeclaration.kind === 273 && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); + }); + var typeOnlyChanges = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); + }); + var actions; + if (namespaceChanges.length) { + actions = ts6.append(actions, codefix2.createCodeFixActionWithoutFixAll(fixId, namespaceChanges, ts6.Diagnostics.Convert_named_imports_to_namespace_import)); + } + if (typeOnlyChanges.length) { + actions = ts6.append(actions, codefix2.createCodeFixActionWithoutFixAll(fixId, typeOnlyChanges, ts6.Diagnostics.Convert_to_type_only_import)); + } + return actions; + }, + fixIds: [fixId] + }); + function getImportDeclaration(sourceFile, program, start) { + var identifier = ts6.tryCast(ts6.getTokenAtPosition(sourceFile, start), ts6.isIdentifier); + if (!identifier || identifier.parent.kind !== 180) + return; + var checker = program.getTypeChecker(); + var symbol = checker.getSymbolAtLocation(identifier); + return ts6.find((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts6.emptyArray, ts6.or(ts6.isImportClause, ts6.isImportSpecifier, ts6.isImportEqualsDeclaration)); + } + function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { + if (importDeclaration.kind === 268) { + changes.insertModifierBefore(sourceFile, 154, importDeclaration.name); + return; + } + var importClause = importDeclaration.kind === 270 ? importDeclaration : importDeclaration.parent.parent; + if (importClause.name && importClause.namedBindings) { + return; + } + var checker = program.getTypeChecker(); + var importsValue = !!ts6.forEachImportClauseDeclaration(importClause, function(decl) { + if (ts6.skipAlias(decl.symbol, checker).flags & 111551) + return true; + }); + if (importsValue) { + return; + } + changes.insertModifierBefore(sourceFile, 154, importClause); + } + function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { + ts6.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixName = "unusedIdentifier"; + var fixIdPrefix = "unusedIdentifier_prefix"; + var fixIdDelete = "unusedIdentifier_delete"; + var fixIdDeleteImports = "unusedIdentifier_deleteImports"; + var fixIdInfer = "unusedIdentifier_infer"; + var errorCodes = [ + ts6.Diagnostics._0_is_declared_but_its_value_is_never_read.code, + ts6.Diagnostics._0_is_declared_but_never_used.code, + ts6.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code, + ts6.Diagnostics.All_imports_in_import_declaration_are_unused.code, + ts6.Diagnostics.All_destructured_elements_are_unused.code, + ts6.Diagnostics.All_variables_are_unused.code, + ts6.Diagnostics.All_type_parameters_are_unused.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var errorCode = context.errorCode, sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken; + var checker = program.getTypeChecker(); + var sourceFiles = program.getSourceFiles(); + var token = ts6.getTokenAtPosition(sourceFile, context.span.start); + if (ts6.isJSDocTemplateTag(token)) { + return [createDeleteFix(ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.delete(sourceFile, token); + }), ts6.Diagnostics.Remove_template_tag)]; + } + if (token.kind === 29) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return deleteTypeParameters(t, sourceFile, token); + }); + return [createDeleteFix(changes, ts6.Diagnostics.Remove_type_parameters)]; + } + var importDecl = tryGetFullImport(token); + if (importDecl) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.delete(sourceFile, importDecl); + }); + return [codefix2.createCodeFixAction(fixName, changes, [ts6.Diagnostics.Remove_import_from_0, ts6.showModuleSpecifier(importDecl)], fixIdDeleteImports, ts6.Diagnostics.Delete_all_unused_imports)]; + } else if (isImport(token)) { + var deletion = ts6.textChanges.ChangeTracker.with(context, function(t) { + return tryDeleteDeclaration( + sourceFile, + token, + t, + checker, + sourceFiles, + program, + cancellationToken, + /*isFixAll*/ + false + ); + }); + if (deletion.length) { + return [codefix2.createCodeFixAction(fixName, deletion, [ts6.Diagnostics.Remove_unused_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDeleteImports, ts6.Diagnostics.Delete_all_unused_imports)]; + } + } + if (ts6.isObjectBindingPattern(token.parent) || ts6.isArrayBindingPattern(token.parent)) { + if (ts6.isParameter(token.parent.parent)) { + var elements = token.parent.elements; + var diagnostic = [ + elements.length > 1 ? ts6.Diagnostics.Remove_unused_declarations_for_Colon_0 : ts6.Diagnostics.Remove_unused_declaration_for_Colon_0, + ts6.map(elements, function(e) { + return e.getText(sourceFile); + }).join(", ") + ]; + return [ + createDeleteFix(ts6.textChanges.ChangeTracker.with(context, function(t) { + return deleteDestructuringElements(t, sourceFile, token.parent); + }), diagnostic) + ]; + } + return [ + createDeleteFix(ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.delete(sourceFile, token.parent.parent); + }), ts6.Diagnostics.Remove_unused_destructuring_declaration) + ]; + } + if (canDeleteEntireVariableStatement(sourceFile, token)) { + return [ + createDeleteFix(ts6.textChanges.ChangeTracker.with(context, function(t) { + return deleteEntireVariableStatement(t, sourceFile, token.parent); + }), ts6.Diagnostics.Remove_variable_statement) + ]; + } + var result = []; + if (token.kind === 138) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return changeInferToUnknown(t, sourceFile, token); + }); + var name = ts6.cast(token.parent, ts6.isInferTypeNode).typeParameter.name.text; + result.push(codefix2.createCodeFixAction(fixName, changes, [ts6.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts6.Diagnostics.Replace_all_unused_infer_with_unknown)); + } else { + var deletion = ts6.textChanges.ChangeTracker.with(context, function(t) { + return tryDeleteDeclaration( + sourceFile, + token, + t, + checker, + sourceFiles, + program, + cancellationToken, + /*isFixAll*/ + false + ); + }); + if (deletion.length) { + var name = ts6.isComputedPropertyName(token.parent) ? token.parent : token; + result.push(createDeleteFix(deletion, [ts6.Diagnostics.Remove_unused_declaration_for_Colon_0, name.getText(sourceFile)])); + } + } + var prefix2 = ts6.textChanges.ChangeTracker.with(context, function(t) { + return tryPrefixDeclaration(t, errorCode, sourceFile, token); + }); + if (prefix2.length) { + result.push(codefix2.createCodeFixAction(fixName, prefix2, [ts6.Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, ts6.Diagnostics.Prefix_all_unused_declarations_with_where_possible)); + } + return result; + }, + fixIds: [fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer], + getAllCodeActions: function(context) { + var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken; + var checker = program.getTypeChecker(); + var sourceFiles = program.getSourceFiles(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var token = ts6.getTokenAtPosition(sourceFile, diag.start); + switch (context.fixId) { + case fixIdPrefix: + tryPrefixDeclaration(changes, diag.code, sourceFile, token); + break; + case fixIdDeleteImports: { + var importDecl = tryGetFullImport(token); + if (importDecl) { + changes.delete(sourceFile, importDecl); + } else if (isImport(token)) { + tryDeleteDeclaration( + sourceFile, + token, + changes, + checker, + sourceFiles, + program, + cancellationToken, + /*isFixAll*/ + true + ); + } + break; + } + case fixIdDelete: { + if (token.kind === 138 || isImport(token)) { + break; + } else if (ts6.isJSDocTemplateTag(token)) { + changes.delete(sourceFile, token); + } else if (token.kind === 29) { + deleteTypeParameters(changes, sourceFile, token); + } else if (ts6.isObjectBindingPattern(token.parent)) { + if (token.parent.parent.initializer) { + break; + } else if (!ts6.isParameter(token.parent.parent) || isNotProvidedArguments(token.parent.parent, checker, sourceFiles)) { + changes.delete(sourceFile, token.parent.parent); + } + } else if (ts6.isArrayBindingPattern(token.parent.parent) && token.parent.parent.parent.initializer) { + break; + } else if (canDeleteEntireVariableStatement(sourceFile, token)) { + deleteEntireVariableStatement(changes, sourceFile, token.parent); + } else { + tryDeleteDeclaration( + sourceFile, + token, + changes, + checker, + sourceFiles, + program, + cancellationToken, + /*isFixAll*/ + true + ); + } + break; + } + case fixIdInfer: + if (token.kind === 138) { + changeInferToUnknown(changes, sourceFile, token); + } + break; + default: + ts6.Debug.fail(JSON.stringify(context.fixId)); + } + }); + } + }); + function changeInferToUnknown(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token.parent, ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + )); + } + function createDeleteFix(changes, diag) { + return codefix2.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts6.Diagnostics.Delete_all_unused_declarations); + } + function deleteTypeParameters(changes, sourceFile, token) { + changes.delete(sourceFile, ts6.Debug.checkDefined(ts6.cast(token.parent, ts6.isDeclarationWithTypeParameterChildren).typeParameters, "The type parameter to delete should exist")); + } + function isImport(token) { + return token.kind === 100 || token.kind === 79 && (token.parent.kind === 273 || token.parent.kind === 270); + } + function tryGetFullImport(token) { + return token.kind === 100 ? ts6.tryCast(token.parent, ts6.isImportDeclaration) : void 0; + } + function canDeleteEntireVariableStatement(sourceFile, token) { + return ts6.isVariableDeclarationList(token.parent) && ts6.first(token.parent.getChildren(sourceFile)) === token; + } + function deleteEntireVariableStatement(changes, sourceFile, node) { + changes.delete(sourceFile, node.parent.kind === 240 ? node.parent : node); + } + function deleteDestructuringElements(changes, sourceFile, node) { + ts6.forEach(node.elements, function(n) { + return changes.delete(sourceFile, n); + }); + } + function tryPrefixDeclaration(changes, errorCode, sourceFile, token) { + if (errorCode === ts6.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) + return; + if (token.kind === 138) { + token = ts6.cast(token.parent, ts6.isInferTypeNode).typeParameter.name; + } + if (ts6.isIdentifier(token) && canPrefix(token)) { + changes.replaceNode(sourceFile, token, ts6.factory.createIdentifier("_".concat(token.text))); + if (ts6.isParameter(token.parent)) { + ts6.getJSDocParameterTags(token.parent).forEach(function(tag) { + if (ts6.isIdentifier(tag.name)) { + changes.replaceNode(sourceFile, tag.name, ts6.factory.createIdentifier("_".concat(tag.name.text))); + } + }); + } + } + } + function canPrefix(token) { + switch (token.parent.kind) { + case 166: + case 165: + return true; + case 257: { + var varDecl = token.parent; + switch (varDecl.parent.parent.kind) { + case 247: + case 246: + return true; + } + } + } + return false; + } + function tryDeleteDeclaration(sourceFile, token, changes, checker, sourceFiles, program, cancellationToken, isFixAll) { + tryDeleteDeclarationWorker(token, changes, sourceFile, checker, sourceFiles, program, cancellationToken, isFixAll); + if (ts6.isIdentifier(token)) { + ts6.FindAllReferences.Core.eachSymbolReferenceInFile(token, checker, sourceFile, function(ref) { + if (ts6.isPropertyAccessExpression(ref.parent) && ref.parent.name === ref) + ref = ref.parent; + if (!isFixAll && mayDeleteExpression(ref)) { + changes.delete(sourceFile, ref.parent.parent); + } + }); + } + } + function tryDeleteDeclarationWorker(token, changes, sourceFile, checker, sourceFiles, program, cancellationToken, isFixAll) { + var parent = token.parent; + if (ts6.isParameter(parent)) { + tryDeleteParameter(changes, sourceFile, parent, checker, sourceFiles, program, cancellationToken, isFixAll); + } else if (!(isFixAll && ts6.isIdentifier(token) && ts6.FindAllReferences.Core.isSymbolReferencedInFile(token, checker, sourceFile))) { + var node = ts6.isImportClause(parent) ? token : ts6.isComputedPropertyName(parent) ? parent.parent : parent; + ts6.Debug.assert(node !== sourceFile, "should not delete whole source file"); + changes.delete(sourceFile, node); + } + } + function tryDeleteParameter(changes, sourceFile, parameter, checker, sourceFiles, program, cancellationToken, isFixAll) { + if (isFixAll === void 0) { + isFixAll = false; + } + if (mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll)) { + if (parameter.modifiers && parameter.modifiers.length > 0 && (!ts6.isIdentifier(parameter.name) || ts6.FindAllReferences.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { + for (var _i = 0, _a = parameter.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; + if (ts6.isModifier(modifier)) { + changes.deleteModifier(sourceFile, modifier); + } + } + } else if (!parameter.initializer && isNotProvidedArguments(parameter, checker, sourceFiles)) { + changes.delete(sourceFile, parameter); + } + } + } + function isNotProvidedArguments(parameter, checker, sourceFiles) { + var index = parameter.parent.parameters.indexOf(parameter); + return !ts6.FindAllReferences.Core.someSignatureUsage(parameter.parent, sourceFiles, checker, function(_, call) { + return !call || call.arguments.length > index; + }); + } + function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { + var parent = parameter.parent; + switch (parent.kind) { + case 171: + case 173: + var index = parent.parameters.indexOf(parameter); + var referent = ts6.isMethodDeclaration(parent) ? parent.name : parent; + var entries = ts6.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); + if (entries) { + for (var _i = 0, entries_2 = entries; _i < entries_2.length; _i++) { + var entry = entries_2[_i]; + for (var _a = 0, _b = entry.references; _a < _b.length; _a++) { + var reference = _b[_a]; + if (reference.kind === 1) { + var isSuperCall_1 = ts6.isSuperKeyword(reference.node) && ts6.isCallExpression(reference.node.parent) && reference.node.parent.arguments.length > index; + var isSuperMethodCall = ts6.isPropertyAccessExpression(reference.node.parent) && ts6.isSuperKeyword(reference.node.parent.expression) && ts6.isCallExpression(reference.node.parent.parent) && reference.node.parent.parent.arguments.length > index; + var isOverriddenMethod = (ts6.isMethodDeclaration(reference.node.parent) || ts6.isMethodSignature(reference.node.parent)) && reference.node.parent !== parameter.parent && reference.node.parent.parameters.length > index; + if (isSuperCall_1 || isSuperMethodCall || isOverriddenMethod) + return false; + } + } + } + } + return true; + case 259: { + if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { + return isLastParameter(parent, parameter, isFixAll); + } + return true; + } + case 215: + case 216: + return isLastParameter(parent, parameter, isFixAll); + case 175: + return false; + case 174: + return true; + default: + return ts6.Debug.failBadSyntaxKind(parent); + } + } + function isCallbackLike(checker, sourceFile, name) { + return !!ts6.FindAllReferences.Core.eachSymbolReferenceInFile(name, checker, sourceFile, function(reference) { + return ts6.isIdentifier(reference) && ts6.isCallExpression(reference.parent) && reference.parent.arguments.indexOf(reference) >= 0; + }); + } + function isLastParameter(func, parameter, isFixAll) { + var parameters = func.parameters; + var index = parameters.indexOf(parameter); + ts6.Debug.assert(index !== -1, "The parameter should already be in the list"); + return isFixAll ? parameters.slice(index + 1).every(function(p) { + return ts6.isIdentifier(p.name) && !p.symbol.isReferenced; + }) : index === parameters.length - 1; + } + function mayDeleteExpression(node) { + return (ts6.isBinaryExpression(node.parent) && node.parent.left === node || (ts6.isPostfixUnaryExpression(node.parent) || ts6.isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && ts6.isExpressionStatement(node.parent.parent); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixUnreachableCode"; + var errorCodes = [ts6.Diagnostics.Unreachable_code_detected.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken); + if (syntacticDiagnostics.length) + return; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Remove_unreachable_code, fixId, ts6.Diagnostics.Remove_all_unreachable_code)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return doChange(changes, diag.file, diag.start, diag.length, diag.code); + }); + } + }); + function doChange(changes, sourceFile, start, length, errorCode) { + var token = ts6.getTokenAtPosition(sourceFile, start); + var statement = ts6.findAncestor(token, ts6.isStatement); + if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) { + var logData = JSON.stringify({ + statementKind: ts6.Debug.formatSyntaxKind(statement.kind), + tokenKind: ts6.Debug.formatSyntaxKind(token.kind), + errorCode, + start, + length + }); + ts6.Debug.fail("Token and statement should start at the same point. " + logData); + } + var container = (ts6.isBlock(statement.parent) ? statement.parent : statement).parent; + if (!ts6.isBlock(statement.parent) || statement === ts6.first(statement.parent.statements)) { + switch (container.kind) { + case 242: + if (container.elseStatement) { + if (ts6.isBlock(statement.parent)) { + break; + } else { + changes.replaceNode(sourceFile, statement, ts6.factory.createBlock(ts6.emptyArray)); + } + return; + } + case 244: + case 245: + changes.delete(sourceFile, container); + return; + } + } + if (ts6.isBlock(statement.parent)) { + var end_3 = start + length; + var lastStatement = ts6.Debug.checkDefined(lastWhere(ts6.sliceAfter(statement.parent.statements, statement), function(s) { + return s.pos < end_3; + }), "Some statement should be last"); + changes.deleteNodeRange(sourceFile, statement, lastStatement); + } else { + changes.delete(sourceFile, statement); + } + } + function lastWhere(a, pred) { + var last; + for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { + var value = a_1[_i]; + if (!pred(value)) + break; + last = value; + } + return last; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixUnusedLabel"; + var errorCodes = [ts6.Diagnostics.Unused_label.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, context.span.start); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Remove_unused_label, fixId, ts6.Diagnostics.Remove_all_unused_labels)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return doChange(changes, diag.file, diag.start); + }); + } + }); + function doChange(changes, sourceFile, start) { + var token = ts6.getTokenAtPosition(sourceFile, start); + var labeledStatement = ts6.cast(token.parent, ts6.isLabeledStatement); + var pos = token.getStart(sourceFile); + var statementPos = labeledStatement.statement.getStart(sourceFile); + var end = ts6.positionsAreOnSameLine(pos, statementPos, sourceFile) ? statementPos : ts6.skipTrivia( + sourceFile.text, + ts6.findChildOfKind(labeledStatement, 58, sourceFile).end, + /*stopAfterLineBreak*/ + true + ); + changes.deleteRange(sourceFile, { pos, end }); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixIdPlain = "fixJSDocTypes_plain"; + var fixIdNullable = "fixJSDocTypes_nullable"; + var errorCodes = [ts6.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile; + var checker = context.program.getTypeChecker(); + var info = getInfo(sourceFile, context.span.start, checker); + if (!info) + return void 0; + var typeNode = info.typeNode, type = info.type; + var original = typeNode.getText(sourceFile); + var actions = [fix(type, fixIdPlain, ts6.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; + if (typeNode.kind === 317) { + actions.push(fix(checker.getNullableType( + type, + 32768 + /* TypeFlags.Undefined */ + ), fixIdNullable, ts6.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); + } + return actions; + function fix(type2, fixId, fixAllDescription) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, typeNode, type2, checker); + }); + return codefix2.createCodeFixAction("jdocTypes", changes, [ts6.Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId, fixAllDescription); + } + }, + fixIds: [fixIdPlain, fixIdNullable], + getAllCodeActions: function(context) { + var fixId = context.fixId, program = context.program, sourceFile = context.sourceFile; + var checker = program.getTypeChecker(); + return codefix2.codeFixAll(context, errorCodes, function(changes, err) { + var info = getInfo(err.file, err.start, checker); + if (!info) + return; + var typeNode = info.typeNode, type = info.type; + var fixedType = typeNode.kind === 317 && fixId === fixIdNullable ? checker.getNullableType( + type, + 32768 + /* TypeFlags.Undefined */ + ) : type; + doChange(changes, sourceFile, typeNode, fixedType, checker); + }); + } + }); + function doChange(changes, sourceFile, oldTypeNode, newType, checker) { + changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode( + newType, + /*enclosingDeclaration*/ + oldTypeNode, + /*flags*/ + void 0 + )); + } + function getInfo(sourceFile, pos, checker) { + var decl = ts6.findAncestor(ts6.getTokenAtPosition(sourceFile, pos), isTypeContainer); + var typeNode = decl && decl.type; + return typeNode && { typeNode, type: checker.getTypeFromTypeNode(typeNode) }; + } + function isTypeContainer(node) { + switch (node.kind) { + case 231: + case 176: + case 177: + case 259: + case 174: + case 178: + case 197: + case 171: + case 170: + case 166: + case 169: + case 168: + case 175: + case 262: + case 213: + case 257: + return true; + default: + return false; + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixMissingCallParentheses"; + var errorCodes = [ + ts6.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var callName = getCallName(sourceFile, span.start); + if (!callName) + return; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, callName); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_missing_call_parentheses, fixId, ts6.Diagnostics.Add_all_missing_call_parentheses)]; + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var callName = getCallName(diag.file, diag.start); + if (callName) + doChange(changes, diag.file, callName); + }); + } + }); + function doChange(changes, sourceFile, name) { + changes.replaceNodeWithText(sourceFile, name, "".concat(name.text, "()")); + } + function getCallName(sourceFile, start) { + var token = ts6.getTokenAtPosition(sourceFile, start); + if (ts6.isPropertyAccessExpression(token.parent)) { + var current = token.parent; + while (ts6.isPropertyAccessExpression(current.parent)) { + current = current.parent; + } + return current.name; + } + if (ts6.isIdentifier(token)) { + return token; + } + return void 0; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixAwaitInSyncFunction"; + var errorCodes = [ + ts6.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, + ts6.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, + ts6.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, span = context.span; + var nodes = getNodes(sourceFile, span.start); + if (!nodes) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, nodes); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts6.Diagnostics.Add_all_missing_async_modifiers)]; + }, + fixIds: [fixId], + getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) { + var seen = new ts6.Map(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var nodes = getNodes(diag.file, diag.start); + if (!nodes || !ts6.addToSeen(seen, ts6.getNodeId(nodes.insertBefore))) + return; + doChange(changes, context.sourceFile, nodes); + }); + } + }); + function getReturnType(expr) { + if (expr.type) { + return expr.type; + } + if (ts6.isVariableDeclaration(expr.parent) && expr.parent.type && ts6.isFunctionTypeNode(expr.parent.type)) { + return expr.parent.type.type; + } + } + function getNodes(sourceFile, start) { + var token = ts6.getTokenAtPosition(sourceFile, start); + var containingFunction = ts6.getContainingFunction(token); + if (!containingFunction) { + return; + } + var insertBefore; + switch (containingFunction.kind) { + case 171: + insertBefore = containingFunction.name; + break; + case 259: + case 215: + insertBefore = ts6.findChildOfKind(containingFunction, 98, sourceFile); + break; + case 216: + var kind = containingFunction.typeParameters ? 29 : 20; + insertBefore = ts6.findChildOfKind(containingFunction, kind, sourceFile) || ts6.first(containingFunction.parameters); + break; + default: + return; + } + return insertBefore && { + insertBefore, + returnType: getReturnType(containingFunction) + }; + } + function doChange(changes, sourceFile, _a) { + var insertBefore = _a.insertBefore, returnType = _a.returnType; + if (returnType) { + var entityName = ts6.getEntityNameFromTypeNode(returnType); + if (!entityName || entityName.kind !== 79 || entityName.text !== "Promise") { + changes.replaceNode(sourceFile, returnType, ts6.factory.createTypeReferenceNode("Promise", ts6.factory.createNodeArray([returnType]))); + } + } + changes.insertModifierBefore(sourceFile, 132, insertBefore); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodes = [ + ts6.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code, + ts6.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code + ]; + var fixId = "fixPropertyOverrideAccessor"; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var edits = doChange(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); + if (edits) { + return [codefix2.createCodeFixAction(fixId, edits, ts6.Diagnostics.Generate_get_and_set_accessors, fixId, ts6.Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var edits = doChange(diag.file, diag.start, diag.length, diag.code, context); + if (edits) { + for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) { + var edit = edits_2[_i]; + changes.pushRaw(context.sourceFile, edit); + } + } + }); + } + }); + function doChange(file, start, length, code, context) { + var startPosition; + var endPosition; + if (code === ts6.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) { + startPosition = start; + endPosition = start + length; + } else if (code === ts6.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code) { + var checker = context.program.getTypeChecker(); + var node = ts6.getTokenAtPosition(file, start).parent; + ts6.Debug.assert(ts6.isAccessor(node), "error span of fixPropertyOverrideAccessor should only be on an accessor"); + var containingClass = node.parent; + ts6.Debug.assert(ts6.isClassLike(containingClass), "erroneous accessors should only be inside classes"); + var base = ts6.singleOrUndefined(codefix2.getAllSupers(containingClass, checker)); + if (!base) + return []; + var name = ts6.unescapeLeadingUnderscores(ts6.getTextOfPropertyName(node.name)); + var baseProp = checker.getPropertyOfType(checker.getTypeAtLocation(base), name); + if (!baseProp || !baseProp.valueDeclaration) + return []; + startPosition = baseProp.valueDeclaration.pos; + endPosition = baseProp.valueDeclaration.end; + file = ts6.getSourceFileOfNode(baseProp.valueDeclaration); + } else { + ts6.Debug.fail("fixPropertyOverrideAccessor codefix got unexpected error code " + code); + } + return codefix2.generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, ts6.Diagnostics.Generate_get_and_set_accessors.message); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "inferFromUsage"; + var errorCodes = [ + // Variable declarations + ts6.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code, + // Variable uses + ts6.Diagnostics.Variable_0_implicitly_has_an_1_type.code, + // Parameter declarations + ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type.code, + ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code, + // Get Accessor declarations + ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code, + ts6.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code, + // Set Accessor declarations + ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code, + // Property declarations + ts6.Diagnostics.Member_0_implicitly_has_an_1_type.code, + //// Suggestions + // Variable declarations + ts6.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage.code, + // Variable uses + ts6.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code, + // Parameter declarations + ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code, + ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code, + // Get Accessor declarations + ts6.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage.code, + ts6.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage.code, + // Set Accessor declarations + ts6.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage.code, + // Property declarations + ts6.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code, + // Function expressions and declarations + ts6.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, program = context.program, start = context.span.start, errorCode = context.errorCode, cancellationToken = context.cancellationToken, host = context.host, preferences = context.preferences; + var token = ts6.getTokenAtPosition(sourceFile, start); + var declaration; + var changes = ts6.textChanges.ChangeTracker.with(context, function(changes2) { + declaration = doChange( + changes2, + sourceFile, + token, + errorCode, + program, + cancellationToken, + /*markSeen*/ + ts6.returnTrue, + host, + preferences + ); + }); + var name = declaration && ts6.getNameOfDeclaration(declaration); + return !name || changes.length === 0 ? void 0 : [codefix2.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts6.getTextOfNode(name)], fixId, ts6.Diagnostics.Infer_all_types_from_usage)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var sourceFile = context.sourceFile, program = context.program, cancellationToken = context.cancellationToken, host = context.host, preferences = context.preferences; + var markSeen = ts6.nodeSeenTracker(); + return codefix2.codeFixAll(context, errorCodes, function(changes, err) { + doChange(changes, sourceFile, ts6.getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); + }); + } + }); + function getDiagnostic(errorCode, token) { + switch (errorCode) { + case ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type.code: + case ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.isSetAccessorDeclaration(ts6.getContainingFunction(token)) ? ts6.Diagnostics.Infer_type_of_0_from_usage : ts6.Diagnostics.Infer_parameter_types_from_usage; + case ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code: + case ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Infer_parameter_types_from_usage; + case ts6.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code: + return ts6.Diagnostics.Infer_this_type_of_0_from_usage; + default: + return ts6.Diagnostics.Infer_type_of_0_from_usage; + } + } + function mapSuggestionDiagnostic(errorCode) { + switch (errorCode) { + case ts6.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code; + case ts6.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Variable_0_implicitly_has_an_1_type.code; + case ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type.code; + case ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code; + case ts6.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code; + case ts6.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code; + case ts6.Diagnostics.Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code; + case ts6.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage.code: + return ts6.Diagnostics.Member_0_implicitly_has_an_1_type.code; + } + return errorCode; + } + function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { + if (!ts6.isParameterPropertyModifier(token.kind) && token.kind !== 79 && token.kind !== 25 && token.kind !== 108) { + return void 0; + } + var parent = token.parent; + var importAdder = codefix2.createImportAdder(sourceFile, program, preferences, host); + errorCode = mapSuggestionDiagnostic(errorCode); + switch (errorCode) { + case ts6.Diagnostics.Member_0_implicitly_has_an_1_type.code: + case ts6.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code: + if (ts6.isVariableDeclaration(parent) && markSeen(parent) || ts6.isPropertyDeclaration(parent) || ts6.isPropertySignature(parent)) { + annotateVariableDeclaration(changes, importAdder, sourceFile, parent, program, host, cancellationToken); + importAdder.writeFixes(changes); + return parent; + } + if (ts6.isPropertyAccessExpression(parent)) { + var type = inferTypeForVariableFromUsage(parent.name, program, cancellationToken); + var typeNode = ts6.getTypeNodeIfAccessible(type, parent, program, host); + if (typeNode) { + var typeTag = ts6.factory.createJSDocTypeTag( + /*tagName*/ + void 0, + ts6.factory.createJSDocTypeExpression(typeNode), + /*comment*/ + void 0 + ); + changes.addJSDocTags(sourceFile, ts6.cast(parent.parent.parent, ts6.isExpressionStatement), [typeTag]); + } + importAdder.writeFixes(changes); + return parent; + } + return void 0; + case ts6.Diagnostics.Variable_0_implicitly_has_an_1_type.code: { + var symbol = program.getTypeChecker().getSymbolAtLocation(token); + if (symbol && symbol.valueDeclaration && ts6.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) { + annotateVariableDeclaration(changes, importAdder, ts6.getSourceFileOfNode(symbol.valueDeclaration), symbol.valueDeclaration, program, host, cancellationToken); + importAdder.writeFixes(changes); + return symbol.valueDeclaration; + } + return void 0; + } + } + var containingFunction = ts6.getContainingFunction(token); + if (containingFunction === void 0) { + return void 0; + } + var declaration; + switch (errorCode) { + case ts6.Diagnostics.Parameter_0_implicitly_has_an_1_type.code: + if (ts6.isSetAccessorDeclaration(containingFunction)) { + annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken); + declaration = containingFunction; + break; + } + case ts6.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type.code: + if (markSeen(containingFunction)) { + var param = ts6.cast(parent, ts6.isParameter); + annotateParameters(changes, importAdder, sourceFile, param, containingFunction, program, host, cancellationToken); + declaration = param; + } + break; + case ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation.code: + case ts6.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type.code: + if (ts6.isGetAccessorDeclaration(containingFunction) && ts6.isIdentifier(containingFunction.name)) { + annotate(changes, importAdder, sourceFile, containingFunction, inferTypeForVariableFromUsage(containingFunction.name, program, cancellationToken), program, host); + declaration = containingFunction; + } + break; + case ts6.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation.code: + if (ts6.isSetAccessorDeclaration(containingFunction)) { + annotateSetAccessor(changes, importAdder, sourceFile, containingFunction, program, host, cancellationToken); + declaration = containingFunction; + } + break; + case ts6.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code: + if (ts6.textChanges.isThisTypeAnnotatable(containingFunction) && markSeen(containingFunction)) { + annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken); + declaration = containingFunction; + } + break; + default: + return ts6.Debug.fail(String(errorCode)); + } + importAdder.writeFixes(changes); + return declaration; + } + function annotateVariableDeclaration(changes, importAdder, sourceFile, declaration, program, host, cancellationToken) { + if (ts6.isIdentifier(declaration.name)) { + annotate(changes, importAdder, sourceFile, declaration, inferTypeForVariableFromUsage(declaration.name, program, cancellationToken), program, host); + } + } + function annotateParameters(changes, importAdder, sourceFile, parameterDeclaration, containingFunction, program, host, cancellationToken) { + if (!ts6.isIdentifier(parameterDeclaration.name)) { + return; + } + var parameterInferences = inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken); + ts6.Debug.assert(containingFunction.parameters.length === parameterInferences.length, "Parameter count and inference count should match"); + if (ts6.isInJSFile(containingFunction)) { + annotateJSDocParameters(changes, sourceFile, parameterInferences, program, host); + } else { + var needParens = ts6.isArrowFunction(containingFunction) && !ts6.findChildOfKind(containingFunction, 20, sourceFile); + if (needParens) + changes.insertNodeBefore(sourceFile, ts6.first(containingFunction.parameters), ts6.factory.createToken( + 20 + /* SyntaxKind.OpenParenToken */ + )); + for (var _i = 0, parameterInferences_1 = parameterInferences; _i < parameterInferences_1.length; _i++) { + var _a = parameterInferences_1[_i], declaration = _a.declaration, type = _a.type; + if (declaration && !declaration.type && !declaration.initializer) { + annotate(changes, importAdder, sourceFile, declaration, type, program, host); + } + } + if (needParens) + changes.insertNodeAfter(sourceFile, ts6.last(containingFunction.parameters), ts6.factory.createToken( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } + } + function annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken) { + var references = getFunctionReferences(containingFunction, sourceFile, program, cancellationToken); + if (!references || !references.length) { + return; + } + var thisInference = inferTypeFromReferences(program, references, cancellationToken).thisParameter(); + var typeNode = ts6.getTypeNodeIfAccessible(thisInference, containingFunction, program, host); + if (!typeNode) { + return; + } + if (ts6.isInJSFile(containingFunction)) { + annotateJSDocThis(changes, sourceFile, containingFunction, typeNode); + } else { + changes.tryInsertThisTypeAnnotation(sourceFile, containingFunction, typeNode); + } + } + function annotateJSDocThis(changes, sourceFile, containingFunction, typeNode) { + changes.addJSDocTags(sourceFile, containingFunction, [ + ts6.factory.createJSDocThisTag( + /*tagName*/ + void 0, + ts6.factory.createJSDocTypeExpression(typeNode) + ) + ]); + } + function annotateSetAccessor(changes, importAdder, sourceFile, setAccessorDeclaration, program, host, cancellationToken) { + var param = ts6.firstOrUndefined(setAccessorDeclaration.parameters); + if (param && ts6.isIdentifier(setAccessorDeclaration.name) && ts6.isIdentifier(param.name)) { + var type = inferTypeForVariableFromUsage(setAccessorDeclaration.name, program, cancellationToken); + if (type === program.getTypeChecker().getAnyType()) { + type = inferTypeForVariableFromUsage(param.name, program, cancellationToken); + } + if (ts6.isInJSFile(setAccessorDeclaration)) { + annotateJSDocParameters(changes, sourceFile, [{ declaration: param, type }], program, host); + } else { + annotate(changes, importAdder, sourceFile, param, type, program, host); + } + } + } + function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { + var typeNode = ts6.getTypeNodeIfAccessible(type, declaration, program, host); + if (typeNode) { + if (ts6.isInJSFile(sourceFile) && declaration.kind !== 168) { + var parent = ts6.isVariableDeclaration(declaration) ? ts6.tryCast(declaration.parent.parent, ts6.isVariableStatement) : declaration; + if (!parent) { + return; + } + var typeExpression = ts6.factory.createJSDocTypeExpression(typeNode); + var typeTag = ts6.isGetAccessorDeclaration(declaration) ? ts6.factory.createJSDocReturnTag( + /*tagName*/ + void 0, + typeExpression, + /*comment*/ + void 0 + ) : ts6.factory.createJSDocTypeTag( + /*tagName*/ + void 0, + typeExpression, + /*comment*/ + void 0 + ); + changes.addJSDocTags(sourceFile, parent, [typeTag]); + } else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, ts6.getEmitScriptTarget(program.getCompilerOptions()))) { + changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode); + } + } + } + function tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, scriptTarget) { + var importableReference = codefix2.tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget); + if (importableReference && changes.tryInsertTypeAnnotation(sourceFile, declaration, importableReference.typeNode)) { + ts6.forEach(importableReference.symbols, function(s) { + return importAdder.addImportFromExportedSymbol( + s, + /*usageIsTypeOnly*/ + true + ); + }); + return true; + } + return false; + } + function annotateJSDocParameters(changes, sourceFile, parameterInferences, program, host) { + var signature = parameterInferences.length && parameterInferences[0].declaration.parent; + if (!signature) { + return; + } + var inferences = ts6.mapDefined(parameterInferences, function(inference) { + var param = inference.declaration; + if (param.initializer || ts6.getJSDocType(param) || !ts6.isIdentifier(param.name)) { + return; + } + var typeNode = inference.type && ts6.getTypeNodeIfAccessible(inference.type, param, program, host); + if (typeNode) { + var name = ts6.factory.cloneNode(param.name); + ts6.setEmitFlags( + name, + 1536 | 2048 + /* EmitFlags.NoNestedComments */ + ); + return { name: ts6.factory.cloneNode(param.name), param, isOptional: !!inference.isOptional, typeNode }; + } + }); + if (!inferences.length) { + return; + } + if (ts6.isArrowFunction(signature) || ts6.isFunctionExpression(signature)) { + var needParens = ts6.isArrowFunction(signature) && !ts6.findChildOfKind(signature, 20, sourceFile); + if (needParens) { + changes.insertNodeBefore(sourceFile, ts6.first(signature.parameters), ts6.factory.createToken( + 20 + /* SyntaxKind.OpenParenToken */ + )); + } + ts6.forEach(inferences, function(_a) { + var typeNode = _a.typeNode, param = _a.param; + var typeTag = ts6.factory.createJSDocTypeTag( + /*tagName*/ + void 0, + ts6.factory.createJSDocTypeExpression(typeNode) + ); + var jsDoc = ts6.factory.createJSDocComment( + /*comment*/ + void 0, + [typeTag] + ); + changes.insertNodeAt(sourceFile, param.getStart(sourceFile), jsDoc, { suffix: " " }); + }); + if (needParens) { + changes.insertNodeAfter(sourceFile, ts6.last(signature.parameters), ts6.factory.createToken( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } + } else { + var paramTags = ts6.map(inferences, function(_a) { + var name = _a.name, typeNode = _a.typeNode, isOptional = _a.isOptional; + return ts6.factory.createJSDocParameterTag( + /*tagName*/ + void 0, + name, + /*isBracketed*/ + !!isOptional, + ts6.factory.createJSDocTypeExpression(typeNode), + /* isNameFirst */ + false, + /*comment*/ + void 0 + ); + }); + changes.addJSDocTags(sourceFile, signature, paramTags); + } + } + function getReferences(token, program, cancellationToken) { + return ts6.mapDefined(ts6.FindAllReferences.getReferenceEntriesForNode(-1, token, program, program.getSourceFiles(), cancellationToken), function(entry) { + return entry.kind !== 0 ? ts6.tryCast(entry.node, ts6.isIdentifier) : void 0; + }); + } + function inferTypeForVariableFromUsage(token, program, cancellationToken) { + var references = getReferences(token, program, cancellationToken); + return inferTypeFromReferences(program, references, cancellationToken).single(); + } + function inferTypeForParametersFromUsage(func, sourceFile, program, cancellationToken) { + var references = getFunctionReferences(func, sourceFile, program, cancellationToken); + return references && inferTypeFromReferences(program, references, cancellationToken).parameters(func) || func.parameters.map(function(p) { + return { + declaration: p, + type: ts6.isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() + }; + }); + } + function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { + var searchToken; + switch (containingFunction.kind) { + case 173: + searchToken = ts6.findChildOfKind(containingFunction, 135, sourceFile); + break; + case 216: + case 215: + var parent = containingFunction.parent; + searchToken = (ts6.isVariableDeclaration(parent) || ts6.isPropertyDeclaration(parent)) && ts6.isIdentifier(parent.name) ? parent.name : containingFunction.name; + break; + case 259: + case 171: + case 170: + searchToken = containingFunction.name; + break; + } + if (!searchToken) { + return void 0; + } + return getReferences(searchToken, program, cancellationToken); + } + function inferTypeFromReferences(program, references, cancellationToken) { + var checker = program.getTypeChecker(); + var builtinConstructors = { + string: function() { + return checker.getStringType(); + }, + number: function() { + return checker.getNumberType(); + }, + Array: function(t) { + return checker.createArrayType(t); + }, + Promise: function(t) { + return checker.createPromiseType(t); + } + }; + var builtins = [ + checker.getStringType(), + checker.getNumberType(), + checker.createArrayType(checker.getAnyType()), + checker.createPromiseType(checker.getAnyType()) + ]; + return { + single, + parameters, + thisParameter + }; + function createEmptyUsage() { + return { + isNumber: void 0, + isString: void 0, + isNumberOrString: void 0, + candidateTypes: void 0, + properties: void 0, + calls: void 0, + constructs: void 0, + numberIndex: void 0, + stringIndex: void 0, + candidateThisTypes: void 0, + inferredTypes: void 0 + }; + } + function combineUsages(usages) { + var combinedProperties = new ts6.Map(); + for (var _i = 0, usages_1 = usages; _i < usages_1.length; _i++) { + var u = usages_1[_i]; + if (u.properties) { + u.properties.forEach(function(p, name) { + if (!combinedProperties.has(name)) { + combinedProperties.set(name, []); + } + combinedProperties.get(name).push(p); + }); + } + } + var properties = new ts6.Map(); + combinedProperties.forEach(function(ps, name) { + properties.set(name, combineUsages(ps)); + }); + return { + isNumber: usages.some(function(u2) { + return u2.isNumber; + }), + isString: usages.some(function(u2) { + return u2.isString; + }), + isNumberOrString: usages.some(function(u2) { + return u2.isNumberOrString; + }), + candidateTypes: ts6.flatMap(usages, function(u2) { + return u2.candidateTypes; + }), + properties, + calls: ts6.flatMap(usages, function(u2) { + return u2.calls; + }), + constructs: ts6.flatMap(usages, function(u2) { + return u2.constructs; + }), + numberIndex: ts6.forEach(usages, function(u2) { + return u2.numberIndex; + }), + stringIndex: ts6.forEach(usages, function(u2) { + return u2.stringIndex; + }), + candidateThisTypes: ts6.flatMap(usages, function(u2) { + return u2.candidateThisTypes; + }), + inferredTypes: void 0 + // clear type cache + }; + } + function single() { + return combineTypes(inferTypesFromReferencesSingle(references)); + } + function parameters(declaration) { + if (references.length === 0 || !declaration.parameters) { + return void 0; + } + var usage = createEmptyUsage(); + for (var _i = 0, references_3 = references; _i < references_3.length; _i++) { + var reference = references_3[_i]; + cancellationToken.throwIfCancellationRequested(); + calculateUsageOfNode(reference, usage); + } + var calls = __spreadArray(__spreadArray([], usage.constructs || [], true), usage.calls || [], true); + return declaration.parameters.map(function(parameter, parameterIndex) { + var types = []; + var isRest = ts6.isRestParameter(parameter); + var isOptional = false; + for (var _i2 = 0, calls_1 = calls; _i2 < calls_1.length; _i2++) { + var call = calls_1[_i2]; + if (call.argumentTypes.length <= parameterIndex) { + isOptional = ts6.isInJSFile(declaration); + types.push(checker.getUndefinedType()); + } else if (isRest) { + for (var i = parameterIndex; i < call.argumentTypes.length; i++) { + types.push(checker.getBaseTypeOfLiteralType(call.argumentTypes[i])); + } + } else { + types.push(checker.getBaseTypeOfLiteralType(call.argumentTypes[parameterIndex])); + } + } + if (ts6.isIdentifier(parameter.name)) { + var inferred = inferTypesFromReferencesSingle(getReferences(parameter.name, program, cancellationToken)); + types.push.apply(types, isRest ? ts6.mapDefined(inferred, checker.getElementTypeOfArrayType) : inferred); + } + var type = combineTypes(types); + return { + type: isRest ? checker.createArrayType(type) : type, + isOptional: isOptional && !isRest, + declaration: parameter + }; + }); + } + function thisParameter() { + var usage = createEmptyUsage(); + for (var _i = 0, references_4 = references; _i < references_4.length; _i++) { + var reference = references_4[_i]; + cancellationToken.throwIfCancellationRequested(); + calculateUsageOfNode(reference, usage); + } + return combineTypes(usage.candidateThisTypes || ts6.emptyArray); + } + function inferTypesFromReferencesSingle(references2) { + var usage = createEmptyUsage(); + for (var _i = 0, references_5 = references2; _i < references_5.length; _i++) { + var reference = references_5[_i]; + cancellationToken.throwIfCancellationRequested(); + calculateUsageOfNode(reference, usage); + } + return inferTypes(usage); + } + function calculateUsageOfNode(node, usage) { + while (ts6.isRightSideOfQualifiedNameOrPropertyAccess(node)) { + node = node.parent; + } + switch (node.parent.kind) { + case 241: + inferTypeFromExpressionStatement(node, usage); + break; + case 222: + usage.isNumber = true; + break; + case 221: + inferTypeFromPrefixUnaryExpression(node.parent, usage); + break; + case 223: + inferTypeFromBinaryExpression(node, node.parent, usage); + break; + case 292: + case 293: + inferTypeFromSwitchStatementLabel(node.parent, usage); + break; + case 210: + case 211: + if (node.parent.expression === node) { + inferTypeFromCallExpression(node.parent, usage); + } else { + inferTypeFromContextualType(node, usage); + } + break; + case 208: + inferTypeFromPropertyAccessExpression(node.parent, usage); + break; + case 209: + inferTypeFromPropertyElementExpression(node.parent, node, usage); + break; + case 299: + case 300: + inferTypeFromPropertyAssignment(node.parent, usage); + break; + case 169: + inferTypeFromPropertyDeclaration(node.parent, usage); + break; + case 257: { + var _a = node.parent, name = _a.name, initializer = _a.initializer; + if (node === name) { + if (initializer) { + addCandidateType(usage, checker.getTypeAtLocation(initializer)); + } + break; + } + } + default: + return inferTypeFromContextualType(node, usage); + } + } + function inferTypeFromContextualType(node, usage) { + if (ts6.isExpressionNode(node)) { + addCandidateType(usage, checker.getContextualType(node)); + } + } + function inferTypeFromExpressionStatement(node, usage) { + addCandidateType(usage, ts6.isCallExpression(node) ? checker.getVoidType() : checker.getAnyType()); + } + function inferTypeFromPrefixUnaryExpression(node, usage) { + switch (node.operator) { + case 45: + case 46: + case 40: + case 54: + usage.isNumber = true; + break; + case 39: + usage.isNumberOrString = true; + break; + } + } + function inferTypeFromBinaryExpression(node, parent, usage) { + switch (parent.operatorToken.kind) { + case 42: + case 41: + case 43: + case 44: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 65: + case 67: + case 66: + case 68: + case 69: + case 73: + case 74: + case 78: + case 70: + case 72: + case 71: + case 40: + case 29: + case 32: + case 31: + case 33: + var operandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left); + if (operandType.flags & 1056) { + addCandidateType(usage, operandType); + } else { + usage.isNumber = true; + } + break; + case 64: + case 39: + var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left); + if (otherOperandType.flags & 1056) { + addCandidateType(usage, otherOperandType); + } else if (otherOperandType.flags & 296) { + usage.isNumber = true; + } else if (otherOperandType.flags & 402653316) { + usage.isString = true; + } else if (otherOperandType.flags & 1) { + } else { + usage.isNumberOrString = true; + } + break; + case 63: + case 34: + case 36: + case 37: + case 35: + addCandidateType(usage, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left)); + break; + case 101: + if (node === parent.left) { + usage.isString = true; + } + break; + case 56: + case 60: + if (node === parent.left && (node.parent.parent.kind === 257 || ts6.isAssignmentExpression( + node.parent.parent, + /*excludeCompoundAssignment*/ + true + ))) { + addCandidateType(usage, checker.getTypeAtLocation(parent.right)); + } + break; + case 55: + case 27: + case 102: + break; + } + } + function inferTypeFromSwitchStatementLabel(parent, usage) { + addCandidateType(usage, checker.getTypeAtLocation(parent.parent.parent.expression)); + } + function inferTypeFromCallExpression(parent, usage) { + var call = { + argumentTypes: [], + return_: createEmptyUsage() + }; + if (parent.arguments) { + for (var _i = 0, _a = parent.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + call.argumentTypes.push(checker.getTypeAtLocation(argument)); + } + } + calculateUsageOfNode(parent, call.return_); + if (parent.kind === 210) { + (usage.calls || (usage.calls = [])).push(call); + } else { + (usage.constructs || (usage.constructs = [])).push(call); + } + } + function inferTypeFromPropertyAccessExpression(parent, usage) { + var name = ts6.escapeLeadingUnderscores(parent.name.text); + if (!usage.properties) { + usage.properties = new ts6.Map(); + } + var propertyUsage = usage.properties.get(name) || createEmptyUsage(); + calculateUsageOfNode(parent, propertyUsage); + usage.properties.set(name, propertyUsage); + } + function inferTypeFromPropertyElementExpression(parent, node, usage) { + if (node === parent.argumentExpression) { + usage.isNumberOrString = true; + return; + } else { + var indexType = checker.getTypeAtLocation(parent.argumentExpression); + var indexUsage = createEmptyUsage(); + calculateUsageOfNode(parent, indexUsage); + if (indexType.flags & 296) { + usage.numberIndex = indexUsage; + } else { + usage.stringIndex = indexUsage; + } + } + } + function inferTypeFromPropertyAssignment(assignment, usage) { + var nodeWithRealType = ts6.isVariableDeclaration(assignment.parent.parent) ? assignment.parent.parent : assignment.parent; + addCandidateThisType(usage, checker.getTypeAtLocation(nodeWithRealType)); + } + function inferTypeFromPropertyDeclaration(declaration, usage) { + addCandidateThisType(usage, checker.getTypeAtLocation(declaration.parent)); + } + function removeLowPriorityInferences(inferences, priorities) { + var toRemove = []; + for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) { + var i = inferences_1[_i]; + for (var _a = 0, priorities_1 = priorities; _a < priorities_1.length; _a++) { + var _b = priorities_1[_a], high = _b.high, low = _b.low; + if (high(i)) { + ts6.Debug.assert(!low(i), "Priority can't have both low and high"); + toRemove.push(low); + } + } + } + return inferences.filter(function(i2) { + return toRemove.every(function(f) { + return !f(i2); + }); + }); + } + function combineFromUsage(usage) { + return combineTypes(inferTypes(usage)); + } + function combineTypes(inferences) { + if (!inferences.length) + return checker.getAnyType(); + var stringNumber = checker.getUnionType([checker.getStringType(), checker.getNumberType()]); + var priorities = [ + { + high: function(t) { + return t === checker.getStringType() || t === checker.getNumberType(); + }, + low: function(t) { + return t === stringNumber; + } + }, + { + high: function(t) { + return !(t.flags & (1 | 16384)); + }, + low: function(t) { + return !!(t.flags & (1 | 16384)); + } + }, + { + high: function(t) { + return !(t.flags & (98304 | 1 | 16384)) && !(ts6.getObjectFlags(t) & 16); + }, + low: function(t) { + return !!(ts6.getObjectFlags(t) & 16); + } + } + ]; + var good = removeLowPriorityInferences(inferences, priorities); + var anons = good.filter(function(i) { + return ts6.getObjectFlags(i) & 16; + }); + if (anons.length) { + good = good.filter(function(i) { + return !(ts6.getObjectFlags(i) & 16); + }); + good.push(combineAnonymousTypes(anons)); + } + return checker.getWidenedType(checker.getUnionType( + good.map(checker.getBaseTypeOfLiteralType), + 2 + /* UnionReduction.Subtype */ + )); + } + function combineAnonymousTypes(anons) { + if (anons.length === 1) { + return anons[0]; + } + var calls = []; + var constructs = []; + var stringIndices = []; + var numberIndices = []; + var stringIndexReadonly = false; + var numberIndexReadonly = false; + var props = ts6.createMultiMap(); + for (var _i = 0, anons_1 = anons; _i < anons_1.length; _i++) { + var anon = anons_1[_i]; + for (var _a = 0, _b = checker.getPropertiesOfType(anon); _a < _b.length; _a++) { + var p = _b[_a]; + props.add(p.name, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType()); + } + calls.push.apply(calls, checker.getSignaturesOfType( + anon, + 0 + /* SignatureKind.Call */ + )); + constructs.push.apply(constructs, checker.getSignaturesOfType( + anon, + 1 + /* SignatureKind.Construct */ + )); + var stringIndexInfo = checker.getIndexInfoOfType( + anon, + 0 + /* IndexKind.String */ + ); + if (stringIndexInfo) { + stringIndices.push(stringIndexInfo.type); + stringIndexReadonly = stringIndexReadonly || stringIndexInfo.isReadonly; + } + var numberIndexInfo = checker.getIndexInfoOfType( + anon, + 1 + /* IndexKind.Number */ + ); + if (numberIndexInfo) { + numberIndices.push(numberIndexInfo.type); + numberIndexReadonly = numberIndexReadonly || numberIndexInfo.isReadonly; + } + } + var members = ts6.mapEntries(props, function(name, types) { + var isOptional = types.length < anons.length ? 16777216 : 0; + var s = checker.createSymbol(4 | isOptional, name); + s.type = checker.getUnionType(types); + return [name, s]; + }); + var indexInfos = []; + if (stringIndices.length) + indexInfos.push(checker.createIndexInfo(checker.getStringType(), checker.getUnionType(stringIndices), stringIndexReadonly)); + if (numberIndices.length) + indexInfos.push(checker.createIndexInfo(checker.getNumberType(), checker.getUnionType(numberIndices), numberIndexReadonly)); + return checker.createAnonymousType(anons[0].symbol, members, calls, constructs, indexInfos); + } + function inferTypes(usage) { + var _a, _b, _c; + var types = []; + if (usage.isNumber) { + types.push(checker.getNumberType()); + } + if (usage.isString) { + types.push(checker.getStringType()); + } + if (usage.isNumberOrString) { + types.push(checker.getUnionType([checker.getStringType(), checker.getNumberType()])); + } + if (usage.numberIndex) { + types.push(checker.createArrayType(combineFromUsage(usage.numberIndex))); + } + if (((_a = usage.properties) === null || _a === void 0 ? void 0 : _a.size) || ((_b = usage.constructs) === null || _b === void 0 ? void 0 : _b.length) || usage.stringIndex) { + types.push(inferStructuralType(usage)); + } + var candidateTypes = (usage.candidateTypes || []).map(function(t) { + return checker.getBaseTypeOfLiteralType(t); + }); + var callsType = ((_c = usage.calls) === null || _c === void 0 ? void 0 : _c.length) ? inferStructuralType(usage) : void 0; + if (callsType && candidateTypes) { + types.push(checker.getUnionType( + __spreadArray([callsType], candidateTypes, true), + 2 + /* UnionReduction.Subtype */ + )); + } else { + if (callsType) { + types.push(callsType); + } + if (ts6.length(candidateTypes)) { + types.push.apply(types, candidateTypes); + } + } + types.push.apply(types, inferNamedTypesFromProperties(usage)); + return types; + } + function inferStructuralType(usage) { + var members = new ts6.Map(); + if (usage.properties) { + usage.properties.forEach(function(u, name) { + var symbol = checker.createSymbol(4, name); + symbol.type = combineFromUsage(u); + members.set(name, symbol); + }); + } + var callSignatures = usage.calls ? [getSignatureFromCalls(usage.calls)] : []; + var constructSignatures = usage.constructs ? [getSignatureFromCalls(usage.constructs)] : []; + var indexInfos = usage.stringIndex ? [checker.createIndexInfo( + checker.getStringType(), + combineFromUsage(usage.stringIndex), + /*isReadonly*/ + false + )] : []; + return checker.createAnonymousType( + /*symbol*/ + void 0, + members, + callSignatures, + constructSignatures, + indexInfos + ); + } + function inferNamedTypesFromProperties(usage) { + if (!usage.properties || !usage.properties.size) + return []; + var types = builtins.filter(function(t) { + return allPropertiesAreAssignableToUsage(t, usage); + }); + if (0 < types.length && types.length < 3) { + return types.map(function(t) { + return inferInstantiationFromUsage(t, usage); + }); + } + return []; + } + function allPropertiesAreAssignableToUsage(type, usage) { + if (!usage.properties) + return false; + return !ts6.forEachEntry(usage.properties, function(propUsage, name) { + var source = checker.getTypeOfPropertyOfType(type, name); + if (!source) { + return true; + } + if (propUsage.calls) { + var sigs = checker.getSignaturesOfType( + source, + 0 + /* SignatureKind.Call */ + ); + return !sigs.length || !checker.isTypeAssignableTo(source, getFunctionFromCalls(propUsage.calls)); + } else { + return !checker.isTypeAssignableTo(source, combineFromUsage(propUsage)); + } + }); + } + function inferInstantiationFromUsage(type, usage) { + if (!(ts6.getObjectFlags(type) & 4) || !usage.properties) { + return type; + } + var generic = type.target; + var singleTypeParameter = ts6.singleOrUndefined(generic.typeParameters); + if (!singleTypeParameter) + return type; + var types = []; + usage.properties.forEach(function(propUsage, name) { + var genericPropertyType = checker.getTypeOfPropertyOfType(generic, name); + ts6.Debug.assert(!!genericPropertyType, "generic should have all the properties of its reference."); + types.push.apply(types, inferTypeParameters(genericPropertyType, combineFromUsage(propUsage), singleTypeParameter)); + }); + return builtinConstructors[type.symbol.escapedName](combineTypes(types)); + } + function inferTypeParameters(genericType, usageType, typeParameter) { + if (genericType === typeParameter) { + return [usageType]; + } else if (genericType.flags & 3145728) { + return ts6.flatMap(genericType.types, function(t) { + return inferTypeParameters(t, usageType, typeParameter); + }); + } else if (ts6.getObjectFlags(genericType) & 4 && ts6.getObjectFlags(usageType) & 4) { + var genericArgs = checker.getTypeArguments(genericType); + var usageArgs = checker.getTypeArguments(usageType); + var types = []; + if (genericArgs && usageArgs) { + for (var i = 0; i < genericArgs.length; i++) { + if (usageArgs[i]) { + types.push.apply(types, inferTypeParameters(genericArgs[i], usageArgs[i], typeParameter)); + } + } + } + return types; + } + var genericSigs = checker.getSignaturesOfType( + genericType, + 0 + /* SignatureKind.Call */ + ); + var usageSigs = checker.getSignaturesOfType( + usageType, + 0 + /* SignatureKind.Call */ + ); + if (genericSigs.length === 1 && usageSigs.length === 1) { + return inferFromSignatures(genericSigs[0], usageSigs[0], typeParameter); + } + return []; + } + function inferFromSignatures(genericSig, usageSig, typeParameter) { + var types = []; + for (var i = 0; i < genericSig.parameters.length; i++) { + var genericParam = genericSig.parameters[i]; + var usageParam = usageSig.parameters[i]; + var isRest = genericSig.declaration && ts6.isRestParameter(genericSig.declaration.parameters[i]); + if (!usageParam) { + break; + } + var genericParamType = genericParam.valueDeclaration ? checker.getTypeOfSymbolAtLocation(genericParam, genericParam.valueDeclaration) : checker.getAnyType(); + var elementType = isRest && checker.getElementTypeOfArrayType(genericParamType); + if (elementType) { + genericParamType = elementType; + } + var targetType = usageParam.type || (usageParam.valueDeclaration ? checker.getTypeOfSymbolAtLocation(usageParam, usageParam.valueDeclaration) : checker.getAnyType()); + types.push.apply(types, inferTypeParameters(genericParamType, targetType, typeParameter)); + } + var genericReturn = checker.getReturnTypeOfSignature(genericSig); + var usageReturn = checker.getReturnTypeOfSignature(usageSig); + types.push.apply(types, inferTypeParameters(genericReturn, usageReturn, typeParameter)); + return types; + } + function getFunctionFromCalls(calls) { + return checker.createAnonymousType( + /*symbol*/ + void 0, + ts6.createSymbolTable(), + [getSignatureFromCalls(calls)], + ts6.emptyArray, + ts6.emptyArray + ); + } + function getSignatureFromCalls(calls) { + var parameters2 = []; + var length = Math.max.apply(Math, calls.map(function(c) { + return c.argumentTypes.length; + })); + var _loop_14 = function(i2) { + var symbol = checker.createSymbol(1, ts6.escapeLeadingUnderscores("arg".concat(i2))); + symbol.type = combineTypes(calls.map(function(call) { + return call.argumentTypes[i2] || checker.getUndefinedType(); + })); + if (calls.some(function(call) { + return call.argumentTypes[i2] === void 0; + })) { + symbol.flags |= 16777216; + } + parameters2.push(symbol); + }; + for (var i = 0; i < length; i++) { + _loop_14(i); + } + var returnType = combineFromUsage(combineUsages(calls.map(function(call) { + return call.return_; + }))); + return checker.createSignature( + /*declaration*/ + void 0, + /*typeParameters*/ + void 0, + /*thisParameter*/ + void 0, + parameters2, + returnType, + /*typePredicate*/ + void 0, + length, + 0 + /* SignatureFlags.None */ + ); + } + function addCandidateType(usage, type) { + if (type && !(type.flags & 1) && !(type.flags & 131072)) { + (usage.candidateTypes || (usage.candidateTypes = [])).push(type); + } + } + function addCandidateThisType(usage, type) { + if (type && !(type.flags & 1) && !(type.flags & 131072)) { + (usage.candidateThisTypes || (usage.candidateThisTypes = [])).push(type); + } + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixReturnTypeInAsyncFunction"; + var errorCodes = [ + ts6.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) { + var sourceFile = context.sourceFile, program = context.program, span = context.span; + var checker = program.getTypeChecker(); + var info = getInfo(sourceFile, program.getTypeChecker(), span.start); + if (!info) { + return void 0; + } + var returnTypeNode = info.returnTypeNode, returnType = info.returnType, promisedTypeNode = info.promisedTypeNode, promisedType = info.promisedType; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, returnTypeNode, promisedTypeNode); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ + ts6.Diagnostics.Replace_0_with_Promise_1, + checker.typeToString(returnType), + checker.typeToString(promisedType) + ], fixId, ts6.Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)]; + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, context.program.getTypeChecker(), diag.start); + if (info) { + doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode); + } + }); + } + }); + function getInfo(sourceFile, checker, pos) { + if (ts6.isInJSFile(sourceFile)) { + return void 0; + } + var token = ts6.getTokenAtPosition(sourceFile, pos); + var func = ts6.findAncestor(token, ts6.isFunctionLikeDeclaration); + var returnTypeNode = func === null || func === void 0 ? void 0 : func.type; + if (!returnTypeNode) { + return void 0; + } + var returnType = checker.getTypeFromTypeNode(returnTypeNode); + var promisedType = checker.getAwaitedType(returnType) || checker.getVoidType(); + var promisedTypeNode = checker.typeToTypeNode( + promisedType, + /*enclosingDeclaration*/ + returnTypeNode, + /*flags*/ + void 0 + ); + if (promisedTypeNode) { + return { returnTypeNode, returnType, promisedTypeNode, promisedType }; + } + } + function doChange(changes, sourceFile, returnTypeNode, promisedTypeNode) { + changes.replaceNode(sourceFile, returnTypeNode, ts6.factory.createTypeReferenceNode("Promise", [promisedTypeNode])); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixName = "disableJsDiagnostics"; + var fixId = "disableJsDiagnostics"; + var errorCodes = ts6.mapDefined(Object.keys(ts6.Diagnostics), function(key) { + var diag = ts6.Diagnostics[key]; + return diag.category === ts6.DiagnosticCategory.Error ? diag.code : void 0; + }); + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) { + var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext; + if (!ts6.isInJSFile(sourceFile) || !ts6.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { + return void 0; + } + var newLineCharacter = sourceFile.checkJsDirective ? "" : ts6.getNewLineOrDefaultFromHost(host, formatContext.options); + var fixes = [ + // fixId unnecessary because adding `// @ts-nocheck` even once will ignore every error in the file. + codefix2.createCodeFixActionWithoutFixAll(fixName, [codefix2.createFileTextChanges(sourceFile.fileName, [ + ts6.createTextChange(sourceFile.checkJsDirective ? ts6.createTextSpanFromBounds(sourceFile.checkJsDirective.pos, sourceFile.checkJsDirective.end) : ts6.createTextSpan(0, 0), "// @ts-nocheck".concat(newLineCharacter)) + ])], ts6.Diagnostics.Disable_checking_for_this_file) + ]; + if (ts6.textChanges.isValidLocationToAddComment(sourceFile, span.start)) { + fixes.unshift(codefix2.createCodeFixAction(fixName, ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, sourceFile, span.start); + }), ts6.Diagnostics.Ignore_this_error_message, fixId, ts6.Diagnostics.Add_ts_ignore_to_all_error_messages)); + } + return fixes; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + var seenLines = new ts6.Set(); + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + if (ts6.textChanges.isValidLocationToAddComment(diag.file, diag.start)) { + makeChange(changes, diag.file, diag.start, seenLines); + } + }); + } + }); + function makeChange(changes, sourceFile, position, seenLines) { + var lineNumber = ts6.getLineAndCharacterOfPosition(sourceFile, position).line; + if (!seenLines || ts6.tryAddToSet(seenLines, lineNumber)) { + changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore"); + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, sourceFile, context, preferences, importAdder, addClassElement) { + var classMembers = classDeclaration.symbol.members; + for (var _i = 0, possiblyMissingSymbols_1 = possiblyMissingSymbols; _i < possiblyMissingSymbols_1.length; _i++) { + var symbol = possiblyMissingSymbols_1[_i]; + if (!classMembers.has(symbol.escapedName)) { + addNewNodeForMemberSymbol( + symbol, + classDeclaration, + sourceFile, + context, + preferences, + importAdder, + addClassElement, + /* body */ + void 0 + ); + } + } + } + codefix2.createMissingMemberNodes = createMissingMemberNodes; + function getNoopSymbolTrackerWithResolver(context) { + return { + trackSymbol: function() { + return false; + }, + moduleResolverHost: ts6.getModuleSpecifierResolverHost(context.program, context.host) + }; + } + codefix2.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver; + var PreserveOptionalFlags; + (function(PreserveOptionalFlags2) { + PreserveOptionalFlags2[PreserveOptionalFlags2["Method"] = 1] = "Method"; + PreserveOptionalFlags2[PreserveOptionalFlags2["Property"] = 2] = "Property"; + PreserveOptionalFlags2[PreserveOptionalFlags2["All"] = 3] = "All"; + })(PreserveOptionalFlags = codefix2.PreserveOptionalFlags || (codefix2.PreserveOptionalFlags = {})); + function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; + if (preserveOptional === void 0) { + preserveOptional = 3; + } + if (isAmbient === void 0) { + isAmbient = false; + } + var declarations = symbol.getDeclarations(); + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; + var checker = context.program.getTypeChecker(); + var scriptTarget = ts6.getEmitScriptTarget(context.program.getCompilerOptions()); + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168; + var declarationName = ts6.getSynthesizedDeepClone( + ts6.getNameOfDeclaration(declaration), + /*includeTrivia*/ + false + ); + var effectiveModifierFlags = declaration ? ts6.getEffectiveModifierFlags(declaration) : 0; + var modifierFlags = effectiveModifierFlags & 4 ? 4 : effectiveModifierFlags & 16 ? 16 : 0; + if (declaration && ts6.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128; + } + var modifiers = modifierFlags ? ts6.factory.createNodeArray(ts6.factory.createModifiersFromModifierFlags(modifierFlags)) : void 0; + var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); + var optional = !!(symbol.flags & 16777216); + var ambient = !!(enclosingDeclaration.flags & 16777216) || isAmbient; + var quotePreference = ts6.getQuotePreference(sourceFile, preferences); + switch (kind) { + case 168: + case 169: + var flags = quotePreference === 0 ? 268435456 : void 0; + var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); + if (importAdder) { + var importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget); + if (importableReference) { + typeNode = importableReference.typeNode; + importSymbols(importAdder, importableReference.symbols); + } + } + addClassElement(ts6.factory.createPropertyDeclaration( + modifiers, + declaration ? createName(declarationName) : symbol.getName(), + optional && preserveOptional & 2 ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + typeNode, + /*initializer*/ + void 0 + )); + break; + case 174: + case 175: { + ts6.Debug.assertIsDefined(declarations); + var typeNode_1 = checker.typeToTypeNode( + type, + enclosingDeclaration, + /*flags*/ + void 0, + getNoopSymbolTrackerWithResolver(context) + ); + var allAccessors = ts6.getAllAccessorDeclarations(declarations, declaration); + var orderedAccessors = allAccessors.secondAccessor ? [allAccessors.firstAccessor, allAccessors.secondAccessor] : [allAccessors.firstAccessor]; + if (importAdder) { + var importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode_1, scriptTarget); + if (importableReference) { + typeNode_1 = importableReference.typeNode; + importSymbols(importAdder, importableReference.symbols); + } + } + for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { + var accessor = orderedAccessors_1[_i]; + if (ts6.isGetAccessorDeclaration(accessor)) { + addClassElement(ts6.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts6.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); + } else { + ts6.Debug.assertNode(accessor, ts6.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); + var parameter = ts6.getSetAccessorValueParameter(accessor); + var parameterName = parameter && ts6.isIdentifier(parameter.name) ? ts6.idText(parameter.name) : void 0; + addClassElement(ts6.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters( + 1, + [parameterName], + [createTypeNode(typeNode_1)], + 1, + /*inJs*/ + false + ), createBody(body, quotePreference, ambient))); + } + } + break; + } + case 170: + case 171: + ts6.Debug.assertIsDefined(declarations); + var signatures = type.isUnion() ? ts6.flatMap(type.types, function(t) { + return t.getCallSignatures(); + }) : type.getCallSignatures(); + if (!ts6.some(signatures)) { + break; + } + if (declarations.length === 1) { + ts6.Debug.assert(signatures.length === 1, "One declaration implies one signature"); + var signature = signatures[0]; + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); + break; + } + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); + } + if (!ambient) { + if (declarations.length > signatures.length) { + var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); + } else { + ts6.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1), modifiers, quotePreference, body)); + } + } + break; + } + function outputMethod(quotePreference2, signature2, modifiers2, name, body2) { + var method = createSignatureDeclarationFromSignature(171, context, quotePreference2, signature2, body2, name, modifiers2, optional && !!(preserveOptional & 1), enclosingDeclaration, importAdder); + if (method) + addClassElement(method); + } + function createName(node) { + return ts6.getSynthesizedDeepClone( + node, + /*includeTrivia*/ + false + ); + } + function createBody(block, quotePreference2, ambient2) { + return ambient2 ? void 0 : ts6.getSynthesizedDeepClone( + block, + /*includeTrivia*/ + false + ) || createStubbedMethodBody(quotePreference2); + } + function createTypeNode(typeNode2) { + return ts6.getSynthesizedDeepClone( + typeNode2, + /*includeTrivia*/ + false + ); + } + } + codefix2.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; + function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { + var program = context.program; + var checker = program.getTypeChecker(); + var scriptTarget = ts6.getEmitScriptTarget(program.getCompilerOptions()); + var flags = 1 | 256 | 524288 | (quotePreference === 0 ? 268435456 : 0); + var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); + if (!signatureDeclaration) { + return void 0; + } + var typeParameters = signatureDeclaration.typeParameters; + var parameters = signatureDeclaration.parameters; + var type = signatureDeclaration.type; + if (importAdder) { + if (typeParameters) { + var newTypeParameters = ts6.sameMap(typeParameters, function(typeParameterDecl) { + var constraint = typeParameterDecl.constraint; + var defaultType = typeParameterDecl.default; + if (constraint) { + var importableReference2 = tryGetAutoImportableReferenceFromTypeNode(constraint, scriptTarget); + if (importableReference2) { + constraint = importableReference2.typeNode; + importSymbols(importAdder, importableReference2.symbols); + } + } + if (defaultType) { + var importableReference2 = tryGetAutoImportableReferenceFromTypeNode(defaultType, scriptTarget); + if (importableReference2) { + defaultType = importableReference2.typeNode; + importSymbols(importAdder, importableReference2.symbols); + } + } + return ts6.factory.updateTypeParameterDeclaration(typeParameterDecl, typeParameterDecl.modifiers, typeParameterDecl.name, constraint, defaultType); + }); + if (typeParameters !== newTypeParameters) { + typeParameters = ts6.setTextRange(ts6.factory.createNodeArray(newTypeParameters, typeParameters.hasTrailingComma), typeParameters); + } + } + var newParameters = ts6.sameMap(parameters, function(parameterDecl) { + var importableReference2 = tryGetAutoImportableReferenceFromTypeNode(parameterDecl.type, scriptTarget); + var type2 = parameterDecl.type; + if (importableReference2) { + type2 = importableReference2.typeNode; + importSymbols(importAdder, importableReference2.symbols); + } + return ts6.factory.updateParameterDeclaration(parameterDecl, parameterDecl.modifiers, parameterDecl.dotDotDotToken, parameterDecl.name, parameterDecl.questionToken, type2, parameterDecl.initializer); + }); + if (parameters !== newParameters) { + parameters = ts6.setTextRange(ts6.factory.createNodeArray(newParameters, parameters.hasTrailingComma), parameters); + } + if (type) { + var importableReference = tryGetAutoImportableReferenceFromTypeNode(type, scriptTarget); + if (importableReference) { + type = importableReference.typeNode; + importSymbols(importAdder, importableReference.symbols); + } + } + } + var questionToken = optional ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0; + var asteriskToken = signatureDeclaration.asteriskToken; + if (ts6.isFunctionExpression(signatureDeclaration)) { + return ts6.factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts6.tryCast(name, ts6.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } + if (ts6.isArrowFunction(signatureDeclaration)) { + return ts6.factory.updateArrowFunction(signatureDeclaration, modifiers, typeParameters, parameters, type, signatureDeclaration.equalsGreaterThanToken, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } + if (ts6.isMethodDeclaration(signatureDeclaration)) { + return ts6.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts6.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); + } + if (ts6.isFunctionDeclaration(signatureDeclaration)) { + return ts6.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts6.tryCast(name, ts6.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } + return void 0; + } + codefix2.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; + function createSignatureDeclarationFromCallExpression(kind, context, importAdder, call, name, modifierFlags, contextNode) { + var quotePreference = ts6.getQuotePreference(context.sourceFile, context.preferences); + var scriptTarget = ts6.getEmitScriptTarget(context.program.getCompilerOptions()); + var tracker = getNoopSymbolTrackerWithResolver(context); + var checker = context.program.getTypeChecker(); + var isJs = ts6.isInJSFile(contextNode); + var typeArguments = call.typeArguments, args = call.arguments, parent = call.parent; + var contextualType = isJs ? void 0 : checker.getContextualType(call); + var names = ts6.map(args, function(arg) { + return ts6.isIdentifier(arg) ? arg.text : ts6.isPropertyAccessExpression(arg) && ts6.isIdentifier(arg.name) ? arg.name.text : void 0; + }); + var instanceTypes = isJs ? [] : ts6.map(args, function(arg) { + return checker.getTypeAtLocation(arg); + }); + var _a = getArgumentTypesAndTypeParameters( + checker, + importAdder, + instanceTypes, + contextNode, + scriptTarget, + /*flags*/ + void 0, + tracker + ), argumentTypeNodes = _a.argumentTypeNodes, argumentTypeParameters = _a.argumentTypeParameters; + var modifiers = modifierFlags ? ts6.factory.createNodeArray(ts6.factory.createModifiersFromModifierFlags(modifierFlags)) : void 0; + var asteriskToken = ts6.isYieldExpression(parent) ? ts6.factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ) : void 0; + var typeParameters = isJs ? void 0 : createTypeParametersForArguments(checker, argumentTypeParameters, typeArguments); + var parameters = createDummyParameters( + args.length, + names, + argumentTypeNodes, + /*minArgumentCount*/ + void 0, + isJs + ); + var type = isJs || contextualType === void 0 ? void 0 : checker.typeToTypeNode( + contextualType, + contextNode, + /*flags*/ + void 0, + tracker + ); + switch (kind) { + case 171: + return ts6.factory.createMethodDeclaration( + modifiers, + asteriskToken, + name, + /*questionToken*/ + void 0, + typeParameters, + parameters, + type, + createStubbedMethodBody(quotePreference) + ); + case 170: + return ts6.factory.createMethodSignature( + modifiers, + name, + /*questionToken*/ + void 0, + typeParameters, + parameters, + type === void 0 ? ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + ) : type + ); + case 259: + return ts6.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts6.Diagnostics.Function_not_implemented.message, quotePreference)); + default: + ts6.Debug.fail("Unexpected kind"); + } + } + codefix2.createSignatureDeclarationFromCallExpression = createSignatureDeclarationFromCallExpression; + function createTypeParametersForArguments(checker, argumentTypeParameters, typeArguments) { + var usedNames = new ts6.Set(argumentTypeParameters.map(function(pair) { + return pair[0]; + })); + var constraintsByName = new ts6.Map(argumentTypeParameters); + if (typeArguments) { + var typeArgumentsWithNewTypes = typeArguments.filter(function(typeArgument) { + return !argumentTypeParameters.some(function(pair) { + var _a; + return checker.getTypeAtLocation(typeArgument) === ((_a = pair[1]) === null || _a === void 0 ? void 0 : _a.argumentType); + }); + }); + var targetSize = usedNames.size + typeArgumentsWithNewTypes.length; + for (var i = 0; usedNames.size < targetSize; i += 1) { + usedNames.add(createTypeParameterName(i)); + } + } + return ts6.map(ts6.arrayFrom(usedNames.values()), function(usedName) { + var _a; + return ts6.factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + usedName, + (_a = constraintsByName.get(usedName)) === null || _a === void 0 ? void 0 : _a.constraint + ); + }); + } + function createTypeParameterName(index) { + return 84 + index <= 90 ? String.fromCharCode(84 + index) : "T".concat(index); + } + function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) { + var typeNode = checker.typeToTypeNode(type, contextNode, flags, tracker); + if (typeNode && ts6.isImportTypeNode(typeNode)) { + var importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget); + if (importableReference) { + importSymbols(importAdder, importableReference.symbols); + typeNode = importableReference.typeNode; + } + } + return ts6.getSynthesizedDeepClone(typeNode); + } + codefix2.typeToAutoImportableTypeNode = typeToAutoImportableTypeNode; + function typeContainsTypeParameter(type) { + if (type.isUnionOrIntersection()) { + return type.types.some(typeContainsTypeParameter); + } + return type.flags & 262144; + } + function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, tracker) { + var argumentTypeNodes = []; + var argumentTypeParameters = new ts6.Map(); + for (var i = 0; i < instanceTypes.length; i += 1) { + var instanceType = instanceTypes[i]; + if (instanceType.isUnionOrIntersection() && instanceType.types.some(typeContainsTypeParameter)) { + var synthesizedTypeParameterName = createTypeParameterName(i); + argumentTypeNodes.push(ts6.factory.createTypeReferenceNode(synthesizedTypeParameterName)); + argumentTypeParameters.set(synthesizedTypeParameterName, void 0); + continue; + } + var widenedInstanceType = checker.getBaseTypeOfLiteralType(instanceType); + var argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, tracker); + if (!argumentTypeNode) { + continue; + } + argumentTypeNodes.push(argumentTypeNode); + var argumentTypeParameter = getFirstTypeParameterName(instanceType); + var instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, tracker) : void 0; + if (argumentTypeParameter) { + argumentTypeParameters.set(argumentTypeParameter, { argumentType: instanceType, constraint: instanceTypeConstraint }); + } + } + return { argumentTypeNodes, argumentTypeParameters: ts6.arrayFrom(argumentTypeParameters.entries()) }; + } + codefix2.getArgumentTypesAndTypeParameters = getArgumentTypesAndTypeParameters; + function isAnonymousObjectConstraintType(type) { + return type.flags & 524288 && type.objectFlags === 16; + } + function getFirstTypeParameterName(type) { + var _a; + if (type.flags & (1048576 | 2097152)) { + for (var _i = 0, _b = type.types; _i < _b.length; _i++) { + var subType = _b[_i]; + var subTypeName = getFirstTypeParameterName(subType); + if (subTypeName) { + return subTypeName; + } + } + } + return type.flags & 262144 ? (_a = type.getSymbol()) === null || _a === void 0 ? void 0 : _a.getName() : void 0; + } + function createDummyParameters(argCount, names, types, minArgumentCount, inJs) { + var parameters = []; + var parameterNameCounts = new ts6.Map(); + for (var i = 0; i < argCount; i++) { + var parameterName = (names === null || names === void 0 ? void 0 : names[i]) || "arg".concat(i); + var parameterNameCount = parameterNameCounts.get(parameterName); + parameterNameCounts.set(parameterName, (parameterNameCount || 0) + 1); + var newParameter = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + parameterName + (parameterNameCount || ""), + /*questionToken*/ + minArgumentCount !== void 0 && i >= minArgumentCount ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + /*type*/ + inJs ? void 0 : (types === null || types === void 0 ? void 0 : types[i]) || ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + ), + /*initializer*/ + void 0 + ); + parameters.push(newParameter); + } + return parameters; + } + function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body) { + var maxArgsSignature = signatures[0]; + var minArgumentCount = signatures[0].minArgumentCount; + var someSigHasRestParameter = false; + for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { + var sig = signatures_2[_i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + if (ts6.signatureHasRestParameter(sig)) { + someSigHasRestParameter = true; + } + if (sig.parameters.length >= maxArgsSignature.parameters.length && (!ts6.signatureHasRestParameter(sig) || ts6.signatureHasRestParameter(maxArgsSignature))) { + maxArgsSignature = sig; + } + } + var maxNonRestArgs = maxArgsSignature.parameters.length - (ts6.signatureHasRestParameter(maxArgsSignature) ? 1 : 0); + var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function(symbol) { + return symbol.name; + }); + var parameters = createDummyParameters( + maxNonRestArgs, + maxArgsParameterSymbolNames, + /* types */ + void 0, + minArgumentCount, + /*inJs*/ + false + ); + if (someSigHasRestParameter) { + var restParameter = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ), + maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", + /*questionToken*/ + maxNonRestArgs >= minArgumentCount ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + ts6.factory.createArrayTypeNode(ts6.factory.createKeywordTypeNode( + 157 + /* SyntaxKind.UnknownKeyword */ + )), + /*initializer*/ + void 0 + ); + parameters.push(restParameter); + } + return createStubbedMethod( + modifiers, + name, + optional, + /*typeParameters*/ + void 0, + parameters, + getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), + quotePreference, + body + ); + } + function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) { + if (ts6.length(signatures)) { + var type = checker.getUnionType(ts6.map(signatures, checker.getReturnTypeOfSignature)); + return checker.typeToTypeNode( + type, + enclosingDeclaration, + /*flags*/ + void 0, + getNoopSymbolTrackerWithResolver(context) + ); + } + } + function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) { + return ts6.factory.createMethodDeclaration( + modifiers, + /*asteriskToken*/ + void 0, + name, + optional ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : void 0, + typeParameters, + parameters, + returnType, + body || createStubbedMethodBody(quotePreference) + ); + } + function createStubbedMethodBody(quotePreference) { + return createStubbedBody(ts6.Diagnostics.Method_not_implemented.message, quotePreference); + } + function createStubbedBody(text, quotePreference) { + return ts6.factory.createBlock( + [ts6.factory.createThrowStatement(ts6.factory.createNewExpression( + ts6.factory.createIdentifier("Error"), + /*typeArguments*/ + void 0, + // TODO Handle auto quote preference. + [ts6.factory.createStringLiteral( + text, + /*isSingleQuote*/ + quotePreference === 0 + /* QuotePreference.Single */ + )] + ))], + /*multiline*/ + true + ); + } + codefix2.createStubbedBody = createStubbedBody; + function setJsonCompilerOptionValues(changeTracker, configFile, options) { + var tsconfigObjectLiteral = ts6.getTsConfigObjectLiteralExpression(configFile); + if (!tsconfigObjectLiteral) + return void 0; + var compilerOptionsProperty = findJsonProperty(tsconfigObjectLiteral, "compilerOptions"); + if (compilerOptionsProperty === void 0) { + changeTracker.insertNodeAtObjectStart(configFile, tsconfigObjectLiteral, createJsonPropertyAssignment("compilerOptions", ts6.factory.createObjectLiteralExpression( + options.map(function(_a2) { + var optionName2 = _a2[0], optionValue2 = _a2[1]; + return createJsonPropertyAssignment(optionName2, optionValue2); + }), + /*multiLine*/ + true + ))); + return; + } + var compilerOptions = compilerOptionsProperty.initializer; + if (!ts6.isObjectLiteralExpression(compilerOptions)) { + return; + } + for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { + var _a = options_1[_i], optionName = _a[0], optionValue = _a[1]; + var optionProperty = findJsonProperty(compilerOptions, optionName); + if (optionProperty === void 0) { + changeTracker.insertNodeAtObjectStart(configFile, compilerOptions, createJsonPropertyAssignment(optionName, optionValue)); + } else { + changeTracker.replaceNode(configFile, optionProperty.initializer, optionValue); + } + } + } + codefix2.setJsonCompilerOptionValues = setJsonCompilerOptionValues; + function setJsonCompilerOptionValue(changeTracker, configFile, optionName, optionValue) { + setJsonCompilerOptionValues(changeTracker, configFile, [[optionName, optionValue]]); + } + codefix2.setJsonCompilerOptionValue = setJsonCompilerOptionValue; + function createJsonPropertyAssignment(name, initializer) { + return ts6.factory.createPropertyAssignment(ts6.factory.createStringLiteral(name), initializer); + } + codefix2.createJsonPropertyAssignment = createJsonPropertyAssignment; + function findJsonProperty(obj, name) { + return ts6.find(obj.properties, function(p) { + return ts6.isPropertyAssignment(p) && !!p.name && ts6.isStringLiteral(p.name) && p.name.text === name; + }); + } + codefix2.findJsonProperty = findJsonProperty; + function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget) { + var symbols; + var typeNode = ts6.visitNode(importTypeNode, visit); + if (symbols && typeNode) { + return { typeNode, symbols }; + } + function visit(node) { + var _a; + if (ts6.isLiteralImportTypeNode(node) && node.qualifier) { + var firstIdentifier = ts6.getFirstIdentifier(node.qualifier); + var name = ts6.getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget); + var qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, ts6.factory.createIdentifier(name)) : node.qualifier; + symbols = ts6.append(symbols, firstIdentifier.symbol); + var typeArguments = (_a = node.typeArguments) === null || _a === void 0 ? void 0 : _a.map(visit); + return ts6.factory.createTypeReferenceNode(qualifier, typeArguments); + } + return ts6.visitEachChild(node, visit, ts6.nullTransformationContext); + } + } + codefix2.tryGetAutoImportableReferenceFromTypeNode = tryGetAutoImportableReferenceFromTypeNode; + function replaceFirstIdentifierOfEntityName(name, newIdentifier) { + if (name.kind === 79) { + return newIdentifier; + } + return ts6.factory.createQualifiedName(replaceFirstIdentifierOfEntityName(name.left, newIdentifier), name.right); + } + function importSymbols(importAdder, symbols) { + symbols.forEach(function(s) { + return importAdder.addImportFromExportedSymbol( + s, + /*isValidTypeOnlyUseSite*/ + true + ); + }); + } + codefix2.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts6.textSpanEnd(span); + var token = ts6.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix2.findAncestorMatchingSpan = findAncestorMatchingSpan; + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + function generateAccessorFromProperty(file, program, start, end, context, _actionName) { + var fieldInfo = getAccessorConvertiblePropertyAtPosition(file, program, start, end); + if (!fieldInfo || ts6.refactor.isRefactorErrorInfo(fieldInfo)) + return void 0; + var changeTracker = ts6.textChanges.ChangeTracker.fromContext(context); + var isStatic = fieldInfo.isStatic, isReadonly = fieldInfo.isReadonly, fieldName = fieldInfo.fieldName, accessorName = fieldInfo.accessorName, originalName = fieldInfo.originalName, type = fieldInfo.type, container = fieldInfo.container, declaration = fieldInfo.declaration; + ts6.suppressLeadingAndTrailingTrivia(fieldName); + ts6.suppressLeadingAndTrailingTrivia(accessorName); + ts6.suppressLeadingAndTrailingTrivia(declaration); + ts6.suppressLeadingAndTrailingTrivia(container); + var accessorModifiers; + var fieldModifiers; + if (ts6.isClassLike(container)) { + var modifierFlags = ts6.getEffectiveModifierFlags(declaration); + if (ts6.isSourceFileJS(file)) { + var modifiers = ts6.factory.createModifiersFromModifierFlags(modifierFlags); + accessorModifiers = modifiers; + fieldModifiers = modifiers; + } else { + accessorModifiers = ts6.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts6.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); + } + if (ts6.canHaveDecorators(declaration)) { + fieldModifiers = ts6.concatenate(ts6.getDecorators(declaration), fieldModifiers); + } + } + updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, fieldModifiers); + var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); + ts6.suppressLeadingAndTrailingTrivia(getAccessor); + insertAccessor(changeTracker, file, getAccessor, declaration, container); + if (isReadonly) { + var constructor = ts6.getFirstConstructorWithBody(container); + if (constructor) { + updateReadonlyPropertyInitializerStatementConstructor(changeTracker, file, constructor, fieldName.text, originalName); + } + } else { + var setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); + ts6.suppressLeadingAndTrailingTrivia(setAccessor); + insertAccessor(changeTracker, file, setAccessor, declaration, container); + } + return changeTracker.getChanges(); + } + codefix2.generateAccessorFromProperty = generateAccessorFromProperty; + function isConvertibleName(name) { + return ts6.isIdentifier(name) || ts6.isStringLiteral(name); + } + function isAcceptedDeclaration(node) { + return ts6.isParameterPropertyDeclaration(node, node.parent) || ts6.isPropertyDeclaration(node) || ts6.isPropertyAssignment(node); + } + function createPropertyName(name, originalName) { + return ts6.isIdentifier(originalName) ? ts6.factory.createIdentifier(name) : ts6.factory.createStringLiteral(name); + } + function createAccessorAccessExpression(fieldName, isStatic, container) { + var leftHead = isStatic ? container.name : ts6.factory.createThis(); + return ts6.isIdentifier(fieldName) ? ts6.factory.createPropertyAccessExpression(leftHead, fieldName) : ts6.factory.createElementAccessExpression(leftHead, ts6.factory.createStringLiteralFromNode(fieldName)); + } + function prepareModifierFlagsForAccessor(modifierFlags) { + modifierFlags &= ~64; + modifierFlags &= ~8; + if (!(modifierFlags & 16)) { + modifierFlags |= 4; + } + return modifierFlags; + } + function prepareModifierFlagsForField(modifierFlags) { + modifierFlags &= ~4; + modifierFlags &= ~16; + modifierFlags |= 8; + return modifierFlags; + } + function getAccessorConvertiblePropertyAtPosition(file, program, start, end, considerEmptySpans) { + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } + var node = ts6.getTokenAtPosition(file, start); + var cursorRequest = start === end && considerEmptySpans; + var declaration = ts6.findAncestor(node.parent, isAcceptedDeclaration); + var meaning = 28 | 32 | 64; + if (!declaration || !(ts6.nodeOverlapsWithStartEnd(declaration.name, file, start, end) || cursorRequest)) { + return { + error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_property_for_which_to_generate_accessor) + }; + } + if (!isConvertibleName(declaration.name)) { + return { + error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Name_is_not_valid) + }; + } + if ((ts6.getEffectiveModifierFlags(declaration) & 126975 | meaning) !== meaning) { + return { + error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Can_only_convert_property_with_modifier) + }; + } + var name = declaration.name.text; + var startWithUnderscore = ts6.startsWithUnderscore(name); + var fieldName = createPropertyName(startWithUnderscore ? name : ts6.getUniqueName("_".concat(name), file), declaration.name); + var accessorName = createPropertyName(startWithUnderscore ? ts6.getUniqueName(name.substring(1), file) : name, declaration.name); + return { + isStatic: ts6.hasStaticModifier(declaration), + isReadonly: ts6.hasEffectiveReadonlyModifier(declaration), + type: getDeclarationType(declaration, program), + container: declaration.kind === 166 ? declaration.parent.parent : declaration.parent, + originalName: declaration.name.text, + declaration, + fieldName, + accessorName, + renameAccessor: startWithUnderscore + }; + } + codefix2.getAccessorConvertiblePropertyAtPosition = getAccessorConvertiblePropertyAtPosition; + function generateGetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) { + return ts6.factory.createGetAccessorDeclaration( + modifiers, + accessorName, + /*parameters*/ + void 0, + // TODO: GH#18217 + type, + ts6.factory.createBlock( + [ + ts6.factory.createReturnStatement(createAccessorAccessExpression(fieldName, isStatic, container)) + ], + /*multiLine*/ + true + ) + ); + } + function generateSetAccessor(fieldName, accessorName, type, modifiers, isStatic, container) { + return ts6.factory.createSetAccessorDeclaration(modifiers, accessorName, [ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + ts6.factory.createIdentifier("value"), + /*questionToken*/ + void 0, + type + )], ts6.factory.createBlock( + [ + ts6.factory.createExpressionStatement(ts6.factory.createAssignment(createAccessorAccessExpression(fieldName, isStatic, container), ts6.factory.createIdentifier("value"))) + ], + /*multiLine*/ + true + )); + } + function updatePropertyDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) { + var property = ts6.factory.updatePropertyDeclaration(declaration, modifiers, fieldName, declaration.questionToken || declaration.exclamationToken, type, declaration.initializer); + changeTracker.replaceNode(file, declaration, property); + } + function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) { + var assignment = ts6.factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer); + changeTracker.replacePropertyAssignment(file, declaration, assignment); + } + function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) { + if (ts6.isPropertyDeclaration(declaration)) { + updatePropertyDeclaration(changeTracker, file, declaration, type, fieldName, modifiers); + } else if (ts6.isPropertyAssignment(declaration)) { + updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName); + } else { + changeTracker.replaceNode(file, declaration, ts6.factory.updateParameterDeclaration(declaration, modifiers, declaration.dotDotDotToken, ts6.cast(fieldName, ts6.isIdentifier), declaration.questionToken, declaration.type, declaration.initializer)); + } + } + function insertAccessor(changeTracker, file, accessor, declaration, container) { + ts6.isParameterPropertyDeclaration(declaration, declaration.parent) ? changeTracker.insertMemberAtStart(file, container, accessor) : ts6.isPropertyAssignment(declaration) ? changeTracker.insertNodeAfterComma(file, declaration, accessor) : changeTracker.insertNodeAfter(file, declaration, accessor); + } + function updateReadonlyPropertyInitializerStatementConstructor(changeTracker, file, constructor, fieldName, originalName) { + if (!constructor.body) + return; + constructor.body.forEachChild(function recur(node) { + if (ts6.isElementAccessExpression(node) && node.expression.kind === 108 && ts6.isStringLiteral(node.argumentExpression) && node.argumentExpression.text === originalName && ts6.isWriteAccess(node)) { + changeTracker.replaceNode(file, node.argumentExpression, ts6.factory.createStringLiteral(fieldName)); + } + if (ts6.isPropertyAccessExpression(node) && node.expression.kind === 108 && node.name.text === originalName && ts6.isWriteAccess(node)) { + changeTracker.replaceNode(file, node.name, ts6.factory.createIdentifier(fieldName)); + } + if (!ts6.isFunctionLike(node) && !ts6.isClassLike(node)) { + node.forEachChild(recur); + } + }); + } + function getDeclarationType(declaration, program) { + var typeNode = ts6.getTypeAnnotationNode(declaration); + if (ts6.isPropertyDeclaration(declaration) && typeNode && declaration.questionToken) { + var typeChecker = program.getTypeChecker(); + var type = typeChecker.getTypeFromTypeNode(typeNode); + if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { + var types = ts6.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; + return ts6.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts6.factory.createKeywordTypeNode( + 155 + /* SyntaxKind.UndefinedKeyword */ + )], false)); + } + } + return typeNode; + } + function getAllSupers(decl, checker) { + var res = []; + while (decl) { + var superElement = ts6.getClassExtendsHeritageElement(decl); + var superSymbol = superElement && checker.getSymbolAtLocation(superElement.expression); + if (!superSymbol) + break; + var symbol = superSymbol.flags & 2097152 ? checker.getAliasedSymbol(superSymbol) : superSymbol; + var superDecl = symbol.declarations && ts6.find(symbol.declarations, ts6.isClassLike); + if (!superDecl) + break; + res.push(superDecl); + decl = superDecl; + } + return res; + } + codefix2.getAllSupers = getAllSupers; + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixName = "invalidImportSyntax"; + function getCodeFixesForImportDeclaration(context, node) { + var sourceFile = ts6.getSourceFileOfNode(node); + var namespace = ts6.getNamespaceDeclarationNode(node); + var opts = context.program.getCompilerOptions(); + var variations = []; + variations.push(createAction(context, sourceFile, node, ts6.makeImport( + namespace.name, + /*namedImports*/ + void 0, + node.moduleSpecifier, + ts6.getQuotePreference(sourceFile, context.preferences) + ))); + if (ts6.getEmitModuleKind(opts) === ts6.ModuleKind.CommonJS) { + variations.push(createAction(context, sourceFile, node, ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + namespace.name, + ts6.factory.createExternalModuleReference(node.moduleSpecifier) + ))); + } + return variations; + } + function createAction(context, sourceFile, node, replacement) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.replaceNode(sourceFile, node, replacement); + }); + return codefix2.createCodeFixActionWithoutFixAll(fixName, changes, [ts6.Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]); + } + codefix2.registerCodeFix({ + errorCodes: [ + ts6.Diagnostics.This_expression_is_not_callable.code, + ts6.Diagnostics.This_expression_is_not_constructable.code + ], + getCodeActions: getActionsForUsageOfInvalidImport + }); + function getActionsForUsageOfInvalidImport(context) { + var sourceFile = context.sourceFile; + var targetKind = ts6.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 : 211; + var node = ts6.findAncestor(ts6.getTokenAtPosition(sourceFile, context.span.start), function(a) { + return a.kind === targetKind; + }); + if (!node) { + return []; + } + var expr = node.expression; + return getImportCodeFixesForExpression(context, expr); + } + codefix2.registerCodeFix({ + errorCodes: [ + // The following error codes cover pretty much all assignability errors that could involve an expression + ts6.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, + ts6.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1.code, + ts6.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated.code, + ts6.Diagnostics.Type_predicate_0_is_not_assignable_to_1.code, + ts6.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3.code, + ts6.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3.code, + ts6.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2.code, + ts6.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code, + ts6.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property.code, + ts6.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1.code + ], + getCodeActions: getActionsForInvalidImportLocation + }); + function getActionsForInvalidImportLocation(context) { + var sourceFile = context.sourceFile; + var node = ts6.findAncestor(ts6.getTokenAtPosition(sourceFile, context.span.start), function(a) { + return a.getStart() === context.span.start && a.getEnd() === context.span.start + context.span.length; + }); + if (!node) { + return []; + } + return getImportCodeFixesForExpression(context, node); + } + function getImportCodeFixesForExpression(context, expr) { + var type = context.program.getTypeChecker().getTypeAtLocation(expr); + if (!(type.symbol && type.symbol.originatingImport)) { + return []; + } + var fixes = []; + var relatedImport = type.symbol.originatingImport; + if (!ts6.isImportCall(relatedImport)) { + ts6.addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport)); + } + if (ts6.isExpression(expr) && !(ts6.isNamedDeclaration(expr.parent) && expr.parent.name === expr)) { + var sourceFile_2 = context.sourceFile; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.replaceNode(sourceFile_2, expr, ts6.factory.createPropertyAccessExpression(expr, "default"), {}); + }); + fixes.push(codefix2.createCodeFixActionWithoutFixAll(fixName, changes, ts6.Diagnostics.Use_synthetic_default_member)); + } + return fixes; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixName = "strictClassInitialization"; + var fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions"; + var fixIdAddUndefinedType = "addMissingPropertyUndefinedType"; + var fixIdAddInitializer = "addMissingPropertyInitializer"; + var errorCodes = [ts6.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) { + var info = getInfo(context.sourceFile, context.span.start); + if (!info) + return; + var result = []; + ts6.append(result, getActionForAddMissingUndefinedType(context, info)); + ts6.append(result, getActionForAddMissingDefiniteAssignmentAssertion(context, info)); + ts6.append(result, getActionForAddMissingInitializer(context, info)); + return result; + }, + fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start); + if (!info) + return; + switch (context.fixId) { + case fixIdAddDefiniteAssignmentAssertions: + addDefiniteAssignmentAssertion(changes, diag.file, info.prop); + break; + case fixIdAddUndefinedType: + addUndefinedType(changes, diag.file, info); + break; + case fixIdAddInitializer: + var checker = context.program.getTypeChecker(); + var initializer = getInitializer(checker, info.prop); + if (!initializer) + return; + addInitializer(changes, diag.file, info.prop, initializer); + break; + default: + ts6.Debug.fail(JSON.stringify(context.fixId)); + } + }); + } + }); + function getInfo(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + if (ts6.isIdentifier(token) && ts6.isPropertyDeclaration(token.parent)) { + var type = ts6.getEffectiveTypeAnnotationNode(token.parent); + if (type) { + return { type, prop: token.parent, isJs: ts6.isInJSFile(token.parent) }; + } + } + return void 0; + } + function getActionForAddMissingDefiniteAssignmentAssertion(context, info) { + if (info.isJs) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addDefiniteAssignmentAssertion(t, context.sourceFile, info.prop); + }); + return codefix2.createCodeFixAction(fixName, changes, [ts6.Diagnostics.Add_definite_assignment_assertion_to_property_0, info.prop.getText()], fixIdAddDefiniteAssignmentAssertions, ts6.Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties); + } + function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) { + ts6.suppressLeadingAndTrailingTrivia(propertyDeclaration); + var property = ts6.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.modifiers, propertyDeclaration.name, ts6.factory.createToken( + 53 + /* SyntaxKind.ExclamationToken */ + ), propertyDeclaration.type, propertyDeclaration.initializer); + changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property); + } + function getActionForAddMissingUndefinedType(context, info) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addUndefinedType(t, context.sourceFile, info); + }); + return codefix2.createCodeFixAction(fixName, changes, [ts6.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts6.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); + } + function addUndefinedType(changeTracker, sourceFile, info) { + var undefinedTypeNode = ts6.factory.createKeywordTypeNode( + 155 + /* SyntaxKind.UndefinedKeyword */ + ); + var types = ts6.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; + var unionTypeNode = ts6.factory.createUnionTypeNode(types); + if (info.isJs) { + changeTracker.addJSDocTags(sourceFile, info.prop, [ts6.factory.createJSDocTypeTag( + /*tagName*/ + void 0, + ts6.factory.createJSDocTypeExpression(unionTypeNode) + )]); + } else { + changeTracker.replaceNode(sourceFile, info.type, unionTypeNode); + } + } + function getActionForAddMissingInitializer(context, info) { + if (info.isJs) + return void 0; + var checker = context.program.getTypeChecker(); + var initializer = getInitializer(checker, info.prop); + if (!initializer) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return addInitializer(t, context.sourceFile, info.prop, initializer); + }); + return codefix2.createCodeFixAction(fixName, changes, [ts6.Diagnostics.Add_initializer_to_property_0, info.prop.name.getText()], fixIdAddInitializer, ts6.Diagnostics.Add_initializers_to_all_uninitialized_properties); + } + function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer) { + ts6.suppressLeadingAndTrailingTrivia(propertyDeclaration); + var property = ts6.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.modifiers, propertyDeclaration.name, propertyDeclaration.questionToken, propertyDeclaration.type, initializer); + changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property); + } + function getInitializer(checker, propertyDeclaration) { + return getDefaultValueFromType(checker, checker.getTypeFromTypeNode(propertyDeclaration.type)); + } + function getDefaultValueFromType(checker, type) { + if (type.flags & 512) { + return type === checker.getFalseType() || type === checker.getFalseType( + /*fresh*/ + true + ) ? ts6.factory.createFalse() : ts6.factory.createTrue(); + } else if (type.isStringLiteral()) { + return ts6.factory.createStringLiteral(type.value); + } else if (type.isNumberLiteral()) { + return ts6.factory.createNumericLiteral(type.value); + } else if (type.flags & 2048) { + return ts6.factory.createBigIntLiteral(type.value); + } else if (type.isUnion()) { + return ts6.firstDefined(type.types, function(t) { + return getDefaultValueFromType(checker, t); + }); + } else if (type.isClass()) { + var classDeclaration = ts6.getClassLikeDeclarationOfSymbol(type.symbol); + if (!classDeclaration || ts6.hasSyntacticModifier( + classDeclaration, + 256 + /* ModifierFlags.Abstract */ + )) + return void 0; + var constructorDeclaration = ts6.getFirstConstructorWithBody(classDeclaration); + if (constructorDeclaration && constructorDeclaration.parameters.length) + return void 0; + return ts6.factory.createNewExpression( + ts6.factory.createIdentifier(type.symbol.name), + /*typeArguments*/ + void 0, + /*argumentsArray*/ + void 0 + ); + } else if (checker.isArrayLikeType(type)) { + return ts6.factory.createArrayLiteralExpression(); + } + return void 0; + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "requireInTs"; + var errorCodes = [ts6.Diagnostics.require_call_may_be_converted_to_an_import.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var info = getInfo(context.sourceFile, context.program, context.span.start); + if (!info) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, context.sourceFile, info); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_require_to_import, fixId, ts6.Diagnostics.Convert_all_require_to_import)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, context.program, diag.start); + if (info) { + doChange(changes, context.sourceFile, info); + } + }); + } + }); + function doChange(changes, sourceFile, info) { + var allowSyntheticDefaults = info.allowSyntheticDefaults, defaultImportName = info.defaultImportName, namedImports = info.namedImports, statement = info.statement, required = info.required; + changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + defaultImportName, + ts6.factory.createExternalModuleReference(required) + ) : ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + defaultImportName, + namedImports + ), + required, + /*assertClause*/ + void 0 + )); + } + function getInfo(sourceFile, program, pos) { + var parent = ts6.getTokenAtPosition(sourceFile, pos).parent; + if (!ts6.isRequireCall( + parent, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + throw ts6.Debug.failBadSyntaxKind(parent); + } + var decl = ts6.cast(parent.parent, ts6.isVariableDeclaration); + var defaultImportName = ts6.tryCast(decl.name, ts6.isIdentifier); + var namedImports = ts6.isObjectBindingPattern(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0; + if (defaultImportName || namedImports) { + return { + allowSyntheticDefaults: ts6.getAllowSyntheticDefaultImports(program.getCompilerOptions()), + defaultImportName, + namedImports, + statement: ts6.cast(decl.parent.parent, ts6.isVariableStatement), + required: ts6.first(parent.arguments) + }; + } + } + function tryCreateNamedImportsFromObjectBindingPattern(node) { + var importSpecifiers = []; + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts6.isIdentifier(element.name) || element.initializer) { + return void 0; + } + importSpecifiers.push(ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + ts6.tryCast(element.propertyName, ts6.isIdentifier), + element.name + )); + } + if (importSpecifiers.length) { + return ts6.factory.createNamedImports(importSpecifiers); + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "useDefaultImport"; + var errorCodes = [ts6.Diagnostics.Import_may_be_converted_to_a_default_import.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile, start = context.span.start; + var info = getInfo(sourceFile, start); + if (!info) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, info, context.preferences); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_to_default_import, fixId, ts6.Diagnostics.Convert_all_to_default_imports)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) + doChange(changes, diag.file, info, context.preferences); + }); + } + }); + function getInfo(sourceFile, pos) { + var name = ts6.getTokenAtPosition(sourceFile, pos); + if (!ts6.isIdentifier(name)) + return void 0; + var parent = name.parent; + if (ts6.isImportEqualsDeclaration(parent) && ts6.isExternalModuleReference(parent.moduleReference)) { + return { importNode: parent, name, moduleSpecifier: parent.moduleReference.expression }; + } else if (ts6.isNamespaceImport(parent)) { + var importNode = parent.parent.parent; + return { importNode, name, moduleSpecifier: importNode.moduleSpecifier }; + } + } + function doChange(changes, sourceFile, info, preferences) { + changes.replaceNode(sourceFile, info.importNode, ts6.makeImport( + info.name, + /*namedImports*/ + void 0, + info.moduleSpecifier, + ts6.getQuotePreference(sourceFile, preferences) + )); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "useBigintLiteral"; + var errorCodes = [ + ts6.Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToUseBigintLiteral(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span); + }); + if (changes.length > 0) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, ts6.Diagnostics.Convert_all_to_bigint_numeric_literals)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag); + }); + } + }); + function makeChange(changeTracker, sourceFile, span) { + var numericLiteral = ts6.tryCast(ts6.getTokenAtPosition(sourceFile, span.start), ts6.isNumericLiteral); + if (!numericLiteral) { + return; + } + var newText = numericLiteral.getText(sourceFile) + "n"; + changeTracker.replaceNode(sourceFile, numericLiteral, ts6.factory.createBigIntLiteral(newText)); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof"; + var fixId = fixIdAddMissingTypeof; + var errorCodes = [ts6.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToAddMissingTypeof(context) { + var sourceFile = context.sourceFile, span = context.span; + var importType = getImportTypeNode(sourceFile, span.start); + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, importType); + }); + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Add_missing_typeof, fixId, ts6.Diagnostics.Add_missing_typeof)]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start)); + }); + } + }); + function getImportTypeNode(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + ts6.Debug.assert(token.kind === 100, "This token should be an ImportKeyword"); + ts6.Debug.assert(token.parent.kind === 202, "Token parent should be an ImportType"); + return token.parent; + } + function doChange(changes, sourceFile, importType) { + var newTypeNode = ts6.factory.updateImportTypeNode( + importType, + importType.argument, + importType.assertions, + importType.qualifier, + importType.typeArguments, + /* isTypeOf */ + true + ); + changes.replaceNode(sourceFile, importType, newTypeNode); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixID = "wrapJsxInFragment"; + var errorCodes = [ts6.Diagnostics.JSX_expressions_must_have_one_parent_element.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToWrapJsxInFragment(context) { + var sourceFile = context.sourceFile, span = context.span; + var node = findNodeToFix(sourceFile, span.start); + if (!node) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, node); + }); + return [codefix2.createCodeFixAction(fixID, changes, ts6.Diagnostics.Wrap_in_JSX_fragment, fixID, ts6.Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; + }, + fixIds: [fixID], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var node = findNodeToFix(context.sourceFile, diag.start); + if (!node) + return void 0; + doChange(changes, context.sourceFile, node); + }); + } + }); + function findNodeToFix(sourceFile, pos) { + var lessThanToken = ts6.getTokenAtPosition(sourceFile, pos); + var firstJsxElementOrOpenElement = lessThanToken.parent; + var binaryExpr = firstJsxElementOrOpenElement.parent; + if (!ts6.isBinaryExpression(binaryExpr)) { + binaryExpr = binaryExpr.parent; + if (!ts6.isBinaryExpression(binaryExpr)) + return void 0; + } + if (!ts6.nodeIsMissing(binaryExpr.operatorToken)) + return void 0; + return binaryExpr; + } + function doChange(changeTracker, sf, node) { + var jsx = flattenInvalidBinaryExpr(node); + if (jsx) + changeTracker.replaceNode(sf, node, ts6.factory.createJsxFragment(ts6.factory.createJsxOpeningFragment(), jsx, ts6.factory.createJsxJsxClosingFragment())); + } + function flattenInvalidBinaryExpr(node) { + var children = []; + var current = node; + while (true) { + if (ts6.isBinaryExpression(current) && ts6.nodeIsMissing(current.operatorToken) && current.operatorToken.kind === 27) { + children.push(current.left); + if (ts6.isJsxChild(current.right)) { + children.push(current.right); + return children; + } else if (ts6.isBinaryExpression(current.right)) { + current = current.right; + continue; + } else + return void 0; + } else + return void 0; + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixConvertToMappedObjectType"; + var errorCodes = [ts6.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) { + var sourceFile = context.sourceFile, span = context.span; + var info = getInfo(sourceFile, span.start); + if (!info) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, info); + }); + var name = ts6.idText(info.container.name); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Convert_0_to_mapped_object_type, name], fixId, [ts6.Diagnostics.Convert_0_to_mapped_object_type, name])]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) + doChange(changes, diag.file, info); + }); + } + }); + function getInfo(sourceFile, pos) { + var token = ts6.getTokenAtPosition(sourceFile, pos); + var indexSignature = ts6.tryCast(token.parent.parent, ts6.isIndexSignatureDeclaration); + if (!indexSignature) + return void 0; + var container = ts6.isInterfaceDeclaration(indexSignature.parent) ? indexSignature.parent : ts6.tryCast(indexSignature.parent.parent, ts6.isTypeAliasDeclaration); + if (!container) + return void 0; + return { indexSignature, container }; + } + function createTypeAliasFromInterface(declaration, type) { + return ts6.factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type); + } + function doChange(changes, sourceFile, _a) { + var indexSignature = _a.indexSignature, container = _a.container; + var members = ts6.isInterfaceDeclaration(container) ? container.members : container.type.members; + var otherMembers = members.filter(function(member) { + return !ts6.isIndexSignatureDeclaration(member); + }); + var parameter = ts6.first(indexSignature.parameters); + var mappedTypeParameter = ts6.factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + ts6.cast(parameter.name, ts6.isIdentifier), + parameter.type + ); + var mappedIntersectionType = ts6.factory.createMappedTypeNode( + ts6.hasEffectiveReadonlyModifier(indexSignature) ? ts6.factory.createModifier( + 146 + /* SyntaxKind.ReadonlyKeyword */ + ) : void 0, + mappedTypeParameter, + /*nameType*/ + void 0, + indexSignature.questionToken, + indexSignature.type, + /*members*/ + void 0 + ); + var intersectionType = ts6.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts6.getAllSuperTypeNodes(container), true), [ + mappedIntersectionType + ], false), otherMembers.length ? [ts6.factory.createTypeLiteralNode(otherMembers)] : ts6.emptyArray, true)); + changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType)); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "removeAccidentalCallParentheses"; + var errorCodes = [ + ts6.Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var callExpression = ts6.findAncestor(ts6.getTokenAtPosition(context.sourceFile, context.span.start), ts6.isCallExpression); + if (!callExpression) { + return void 0; + } + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end }); + }); + return [codefix2.createCodeFixActionWithoutFixAll(fixId, changes, ts6.Diagnostics.Remove_parentheses)]; + }, + fixIds: [fixId] + }); + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "removeUnnecessaryAwait"; + var errorCodes = [ + ts6.Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code + ]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span); + }); + if (changes.length > 0) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Remove_unnecessary_await, fixId, ts6.Diagnostics.Remove_all_unnecessary_uses_of_await)]; + } + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag); + }); + } + }); + function makeChange(changeTracker, sourceFile, span) { + var awaitKeyword = ts6.tryCast(ts6.getTokenAtPosition(sourceFile, span.start), function(node) { + return node.kind === 133; + }); + var awaitExpression = awaitKeyword && ts6.tryCast(awaitKeyword.parent, ts6.isAwaitExpression); + if (!awaitExpression) { + return; + } + var expressionToReplace = awaitExpression; + var hasSurroundingParens = ts6.isParenthesizedExpression(awaitExpression.parent); + if (hasSurroundingParens) { + var leftMostExpression = ts6.getLeftmostExpression( + awaitExpression.expression, + /*stopAtCallExpressions*/ + false + ); + if (ts6.isIdentifier(leftMostExpression)) { + var precedingToken = ts6.findPrecedingToken(awaitExpression.parent.pos, sourceFile); + if (precedingToken && precedingToken.kind !== 103) { + expressionToReplace = awaitExpression.parent; + } + } + } + changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var errorCodes = [ts6.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code]; + var fixId = "splitTypeOnlyImport"; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return splitTypeOnlyImport(t, getImportDeclaration(context.sourceFile, context.span), context); + }); + if (changes.length) { + return [codefix2.createCodeFixAction(fixId, changes, ts6.Diagnostics.Split_into_two_separate_import_declarations, fixId, ts6.Diagnostics.Split_all_invalid_type_only_imports)]; + } + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, error) { + splitTypeOnlyImport(changes, getImportDeclaration(context.sourceFile, error), context); + }); + } + }); + function getImportDeclaration(sourceFile, span) { + return ts6.findAncestor(ts6.getTokenAtPosition(sourceFile, span.start), ts6.isImportDeclaration); + } + function splitTypeOnlyImport(changes, importDeclaration, context) { + if (!importDeclaration) { + return; + } + var importClause = ts6.Debug.checkDefined(importDeclaration.importClause); + changes.replaceNode(context.sourceFile, importDeclaration, ts6.factory.updateImportDeclaration(importDeclaration, importDeclaration.modifiers, ts6.factory.updateImportClause( + importClause, + importClause.isTypeOnly, + importClause.name, + /*namedBindings*/ + void 0 + ), importDeclaration.moduleSpecifier, importDeclaration.assertClause)); + changes.insertNodeAfter(context.sourceFile, importDeclaration, ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.updateImportClause( + importClause, + importClause.isTypeOnly, + /*name*/ + void 0, + importClause.namedBindings + ), + importDeclaration.moduleSpecifier, + importDeclaration.assertClause + )); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixConvertConstToLet"; + var errorCodes = [ts6.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function getCodeActionsToConvertConstToLet(context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === void 0) + return; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, info.token); + }); + return [codefix2.createCodeFixActionMaybeFixAll(fixId, changes, ts6.Diagnostics.Convert_const_to_let, fixId, ts6.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function(context) { + var program = context.program; + var seen = new ts6.Map(); + return codefix2.createCombinedCodeActions(ts6.textChanges.ChangeTracker.with(context, function(changes) { + codefix2.eachDiagnostic(context, errorCodes, function(diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts6.addToSeen(seen, ts6.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return void 0; + }); + })); + }, + fixIds: [fixId] + }); + function getInfo(sourceFile, pos, program) { + var _a; + var checker = program.getTypeChecker(); + var symbol = checker.getSymbolAtLocation(ts6.getTokenAtPosition(sourceFile, pos)); + if (symbol === void 0) + return; + var declaration = ts6.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts6.isVariableDeclarationList); + if (declaration === void 0) + return; + var constToken = ts6.findChildOfKind(declaration, 85, sourceFile); + if (constToken === void 0) + return; + return { symbol, token: constToken }; + } + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts6.factory.createToken( + 119 + /* SyntaxKind.LetKeyword */ + )); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixId = "fixExpectedComma"; + var expectedErrorCode = ts6.Diagnostics._0_expected.code; + var errorCodes = [expectedErrorCode]; + codefix2.registerCodeFix({ + errorCodes, + getCodeActions: function(context) { + var sourceFile = context.sourceFile; + var info = getInfo(sourceFile, context.span.start, context.errorCode); + if (!info) + return void 0; + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(t, sourceFile, info); + }); + return [codefix2.createCodeFixAction(fixId, changes, [ts6.Diagnostics.Change_0_to_1, ";", ","], fixId, [ts6.Diagnostics.Change_0_to_1, ";", ","])]; + }, + fixIds: [fixId], + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + var info = getInfo(diag.file, diag.start, diag.code); + if (info) + doChange(changes, context.sourceFile, info); + }); + } + }); + function getInfo(sourceFile, pos, _) { + var node = ts6.getTokenAtPosition(sourceFile, pos); + return node.kind === 26 && node.parent && (ts6.isObjectLiteralExpression(node.parent) || ts6.isArrayLiteralExpression(node.parent)) ? { node } : void 0; + } + function doChange(changes, sourceFile, _a) { + var node = _a.node; + var newNode = ts6.factory.createToken( + 27 + /* SyntaxKind.CommaToken */ + ); + changes.replaceNode(sourceFile, node, newNode); + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var codefix; + (function(codefix2) { + var fixName = "addVoidToPromise"; + var fixId = "addVoidToPromise"; + var errorCodes = [ + ts6.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code, + ts6.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code + ]; + codefix2.registerCodeFix({ + errorCodes, + fixIds: [fixId], + getCodeActions: function(context) { + var changes = ts6.textChanges.ChangeTracker.with(context, function(t) { + return makeChange(t, context.sourceFile, context.span, context.program); + }); + if (changes.length > 0) { + return [codefix2.createCodeFixAction(fixName, changes, ts6.Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId, ts6.Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)]; + } + }, + getAllCodeActions: function(context) { + return codefix2.codeFixAll(context, errorCodes, function(changes, diag) { + return makeChange(changes, diag.file, diag, context.program, new ts6.Set()); + }); + } + }); + function makeChange(changes, sourceFile, span, program, seen) { + var node = ts6.getTokenAtPosition(sourceFile, span.start); + if (!ts6.isIdentifier(node) || !ts6.isCallExpression(node.parent) || node.parent.expression !== node || node.parent.arguments.length !== 0) + return; + var checker = program.getTypeChecker(); + var symbol = checker.getSymbolAtLocation(node); + var decl = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration; + if (!decl || !ts6.isParameter(decl) || !ts6.isNewExpression(decl.parent.parent)) + return; + if (seen === null || seen === void 0 ? void 0 : seen.has(decl)) + return; + seen === null || seen === void 0 ? void 0 : seen.add(decl); + var typeArguments = getEffectiveTypeArguments(decl.parent.parent); + if (ts6.some(typeArguments)) { + var typeArgument = typeArguments[0]; + var needsParens = !ts6.isUnionTypeNode(typeArgument) && !ts6.isParenthesizedTypeNode(typeArgument) && ts6.isParenthesizedTypeNode(ts6.factory.createUnionTypeNode([typeArgument, ts6.factory.createKeywordTypeNode( + 114 + /* SyntaxKind.VoidKeyword */ + )]).types[0]); + if (needsParens) { + changes.insertText(sourceFile, typeArgument.pos, "("); + } + changes.insertText(sourceFile, typeArgument.end, needsParens ? ") | void" : " | void"); + } else { + var signature = checker.getResolvedSignature(node.parent); + var parameter = signature === null || signature === void 0 ? void 0 : signature.parameters[0]; + var parameterType = parameter && checker.getTypeOfSymbolAtLocation(parameter, decl.parent.parent); + if (ts6.isInJSFile(decl)) { + if (!parameterType || parameterType.flags & 3) { + changes.insertText(sourceFile, decl.parent.parent.end, ")"); + changes.insertText(sourceFile, ts6.skipTrivia(sourceFile.text, decl.parent.parent.pos), "/** @type {Promise} */("); + } + } else { + if (!parameterType || parameterType.flags & 2) { + changes.insertText(sourceFile, decl.parent.parent.expression.end, ""); + } + } + } + } + function getEffectiveTypeArguments(node) { + var _a; + if (ts6.isInJSFile(node)) { + if (ts6.isParenthesizedExpression(node.parent)) { + var jsDocType = (_a = ts6.getJSDocTypeTag(node.parent)) === null || _a === void 0 ? void 0 : _a.typeExpression.type; + if (jsDocType && ts6.isTypeReferenceNode(jsDocType) && ts6.isIdentifier(jsDocType.typeName) && ts6.idText(jsDocType.typeName) === "Promise") { + return jsDocType.typeArguments; + } + } + } else { + return node.typeArguments; + } + } + })(codefix = ts6.codefix || (ts6.codefix = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var refactorName = "Convert export"; + var defaultToNamedAction = { + name: "Convert default export to named export", + description: ts6.Diagnostics.Convert_default_export_to_named_export.message, + kind: "refactor.rewrite.export.named" + }; + var namedToDefaultAction = { + name: "Convert named export to default export", + description: ts6.Diagnostics.Convert_named_export_to_default_export.message, + kind: "refactor.rewrite.export.default" + }; + refactor2.registerRefactor(refactorName, { + kinds: [ + defaultToNamedAction.kind, + namedToDefaultAction.kind + ], + getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndDefaultExports(context) { + var info = getInfo(context, context.triggerReason === "invoked"); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + var action = info.wasDefault ? defaultToNamedAction : namedToDefaultAction; + return [{ name: refactorName, description: action.description, actions: [action] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [ + { name: refactorName, description: ts6.Diagnostics.Convert_default_export_to_named_export.message, actions: [ + __assign(__assign({}, defaultToNamedAction), { notApplicableReason: info.error }), + __assign(__assign({}, namedToDefaultAction), { notApplicableReason: info.error }) + ] } + ]; + } + return ts6.emptyArray; + }, + getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndDefaultExports(context, actionName) { + ts6.Debug.assert(actionName === defaultToNamedAction.name || actionName === namedToDefaultAction.name, "Unexpected action name"); + var info = getInfo(context); + ts6.Debug.assert(info && !refactor2.isRefactorErrorInfo(info), "Expected applicable refactor info"); + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(context.file, context.program, info, t, context.cancellationToken); + }); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + }); + function getInfo(context, considerPartialSpans) { + if (considerPartialSpans === void 0) { + considerPartialSpans = true; + } + var file = context.file, program = context.program; + var span = ts6.getRefactorContextSpan(context); + var token = ts6.getTokenAtPosition(file, span.start); + var exportNode = !!(token.parent && ts6.getSyntacticModifierFlags(token.parent) & 1) && considerPartialSpans ? token.parent : ts6.getParentNodeInSpan(token, file, span); + if (!exportNode || !ts6.isSourceFile(exportNode.parent) && !(ts6.isModuleBlock(exportNode.parent) && ts6.isAmbientModule(exportNode.parent.parent))) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_export_statement) }; + } + var checker = program.getTypeChecker(); + var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); + var flags = ts6.getSyntacticModifierFlags(exportNode) || (ts6.isExportAssignment(exportNode) && !exportNode.isExportEquals ? 1025 : 0); + var wasDefault = !!(flags & 1024); + if (!(flags & 1) || !wasDefault && exportingModuleSymbol.exports.has( + "default" + /* InternalSymbolName.Default */ + )) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.This_file_already_has_a_default_export) }; + } + var noSymbolError = function(id) { + return ts6.isIdentifier(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Can_only_convert_named_export) }; + }; + switch (exportNode.kind) { + case 259: + case 260: + case 261: + case 263: + case 262: + case 264: { + var node = exportNode; + if (!node.name) + return void 0; + return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault, exportingModuleSymbol }; + } + case 240: { + var vs = exportNode; + if (!(vs.declarationList.flags & 2) || vs.declarationList.declarations.length !== 1) { + return void 0; + } + var decl = ts6.first(vs.declarationList.declarations); + if (!decl.initializer) + return void 0; + ts6.Debug.assert(!wasDefault, "Can't have a default flag here"); + return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault, exportingModuleSymbol }; + } + case 274: { + var node = exportNode; + if (node.isExportEquals) + return void 0; + return noSymbolError(node.expression) || { exportNode: node, exportName: node.expression, wasDefault, exportingModuleSymbol }; + } + default: + return void 0; + } + } + function doChange(exportingSourceFile, program, info, changes, cancellationToken) { + changeExport(exportingSourceFile, info, changes, program.getTypeChecker()); + changeImports(program, info, changes, cancellationToken); + } + function changeExport(exportingSourceFile, _a, changes, checker) { + var wasDefault = _a.wasDefault, exportNode = _a.exportNode, exportName = _a.exportName; + if (wasDefault) { + if (ts6.isExportAssignment(exportNode) && !exportNode.isExportEquals) { + var exp = exportNode.expression; + var spec = makeExportSpecifier(exp.text, exp.text); + changes.replaceNode(exportingSourceFile, exportNode, ts6.factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + ts6.factory.createNamedExports([spec]) + )); + } else { + changes.delete(exportingSourceFile, ts6.Debug.checkDefined(ts6.findModifier( + exportNode, + 88 + /* SyntaxKind.DefaultKeyword */ + ), "Should find a default keyword in modifier list")); + } + } else { + var exportKeyword = ts6.Debug.checkDefined(ts6.findModifier( + exportNode, + 93 + /* SyntaxKind.ExportKeyword */ + ), "Should find an export keyword in modifier list"); + switch (exportNode.kind) { + case 259: + case 260: + case 261: + changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts6.factory.createToken( + 88 + /* SyntaxKind.DefaultKeyword */ + )); + break; + case 240: + var decl = ts6.first(exportNode.declarationList.declarations); + if (!ts6.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { + changes.replaceNode(exportingSourceFile, exportNode, ts6.factory.createExportDefault(ts6.Debug.checkDefined(decl.initializer, "Initializer was previously known to be present"))); + break; + } + case 263: + case 262: + case 264: + changes.deleteModifier(exportingSourceFile, exportKeyword); + changes.insertNodeAfter(exportingSourceFile, exportNode, ts6.factory.createExportDefault(ts6.factory.createIdentifier(exportName.text))); + break; + default: + ts6.Debug.fail("Unexpected exportNode kind ".concat(exportNode.kind)); + } + } + } + function changeImports(program, _a, changes, cancellationToken) { + var wasDefault = _a.wasDefault, exportName = _a.exportName, exportingModuleSymbol = _a.exportingModuleSymbol; + var checker = program.getTypeChecker(); + var exportSymbol = ts6.Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol"); + ts6.FindAllReferences.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, function(ref) { + if (exportName === ref) + return; + var importingSourceFile = ref.getSourceFile(); + if (wasDefault) { + changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text); + } else { + changeNamedToDefaultImport(importingSourceFile, ref, changes); + } + }); + } + function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { + var parent = ref.parent; + switch (parent.kind) { + case 208: + changes.replaceNode(importingSourceFile, ref, ts6.factory.createIdentifier(exportName)); + break; + case 273: + case 278: { + var spec = parent; + changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); + break; + } + case 270: { + var clause = parent; + ts6.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); + var spec = makeImportSpecifier(exportName, ref.text); + var namedBindings = clause.namedBindings; + if (!namedBindings) { + changes.replaceNode(importingSourceFile, ref, ts6.factory.createNamedImports([spec])); + } else if (namedBindings.kind === 271) { + changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); + var quotePreference = ts6.isStringLiteral(clause.parent.moduleSpecifier) ? ts6.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1; + var newImport = ts6.makeImport( + /*default*/ + void 0, + [makeImportSpecifier(exportName, ref.text)], + clause.parent.moduleSpecifier, + quotePreference + ); + changes.insertNodeAfter(importingSourceFile, clause.parent, newImport); + } else { + changes.delete(importingSourceFile, ref); + changes.insertNodeAtEndOfList(importingSourceFile, namedBindings.elements, spec); + } + break; + } + case 202: + var importTypeNode = parent; + changes.replaceNode(importingSourceFile, parent, ts6.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts6.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); + break; + default: + ts6.Debug.failBadSyntaxKind(parent); + } + } + function changeNamedToDefaultImport(importingSourceFile, ref, changes) { + var parent = ref.parent; + switch (parent.kind) { + case 208: + changes.replaceNode(importingSourceFile, ref, ts6.factory.createIdentifier("default")); + break; + case 273: { + var defaultImport = ts6.factory.createIdentifier(parent.name.text); + if (parent.parent.elements.length === 1) { + changes.replaceNode(importingSourceFile, parent.parent, defaultImport); + } else { + changes.delete(importingSourceFile, parent); + changes.insertNodeBefore(importingSourceFile, parent.parent, defaultImport); + } + break; + } + case 278: { + changes.replaceNode(importingSourceFile, parent, makeExportSpecifier("default", parent.name.text)); + break; + } + default: + ts6.Debug.assertNever(parent, "Unexpected parent kind ".concat(parent.kind)); + } + } + function makeImportSpecifier(propertyName, name) { + return ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + propertyName === name ? void 0 : ts6.factory.createIdentifier(propertyName), + ts6.factory.createIdentifier(name) + ); + } + function makeExportSpecifier(propertyName, name) { + return ts6.factory.createExportSpecifier( + /*isTypeOnly*/ + false, + propertyName === name ? void 0 : ts6.factory.createIdentifier(propertyName), + ts6.factory.createIdentifier(name) + ); + } + function getExportingModuleSymbol(node, checker) { + var parent = node.parent; + if (ts6.isSourceFile(parent)) { + return parent.symbol; + } + var symbol = parent.parent.symbol; + if (symbol.valueDeclaration && ts6.isExternalModuleAugmentation(symbol.valueDeclaration)) { + return checker.getMergedSymbol(symbol); + } + return symbol; + } + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var _a; + var refactorName = "Convert import"; + var actions = (_a = {}, _a[ + 0 + /* ImportKind.Named */ + ] = { + name: "Convert namespace import to named imports", + description: ts6.Diagnostics.Convert_namespace_import_to_named_imports.message, + kind: "refactor.rewrite.import.named" + }, _a[ + 2 + /* ImportKind.Namespace */ + ] = { + name: "Convert named imports to namespace import", + description: ts6.Diagnostics.Convert_named_imports_to_namespace_import.message, + kind: "refactor.rewrite.import.namespace" + }, _a[ + 1 + /* ImportKind.Default */ + ] = { + name: "Convert named imports to default import", + description: ts6.Diagnostics.Convert_named_imports_to_default_import.message, + kind: "refactor.rewrite.import.default" + }, _a); + refactor2.registerRefactor(refactorName, { + kinds: ts6.getOwnValues(actions).map(function(a) { + return a.kind; + }), + getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndNamespacedImports(context) { + var info = getImportConversionInfo(context, context.triggerReason === "invoked"); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + var action = actions[info.convertTo]; + return [{ name: refactorName, description: action.description, actions: [action] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return ts6.getOwnValues(actions).map(function(action2) { + return { + name: refactorName, + description: action2.description, + actions: [__assign(__assign({}, action2), { notApplicableReason: info.error })] + }; + }); + } + return ts6.emptyArray; + }, + getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndNamespacedImports(context, actionName) { + ts6.Debug.assert(ts6.some(ts6.getOwnValues(actions), function(action) { + return action.name === actionName; + }), "Unexpected action name"); + var info = getImportConversionInfo(context); + ts6.Debug.assert(info && !refactor2.isRefactorErrorInfo(info), "Expected applicable refactor info"); + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(context.file, context.program, t, info); + }); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + }); + function getImportConversionInfo(context, considerPartialSpans) { + if (considerPartialSpans === void 0) { + considerPartialSpans = true; + } + var file = context.file; + var span = ts6.getRefactorContextSpan(context); + var token = ts6.getTokenAtPosition(file, span.start); + var importDecl = considerPartialSpans ? ts6.findAncestor(token, ts6.isImportDeclaration) : ts6.getParentNodeInSpan(token, file, span); + if (!importDecl || !ts6.isImportDeclaration(importDecl)) + return { error: "Selection is not an import declaration." }; + var end = span.start + span.length; + var nextToken = ts6.findNextToken(importDecl, importDecl.parent, file); + if (nextToken && end > nextToken.getStart()) + return void 0; + var importClause = importDecl.importClause; + if (!importClause) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_import_clause) }; + } + if (!importClause.namedBindings) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; + } + if (importClause.namedBindings.kind === 271) { + return { convertTo: 0, import: importClause.namedBindings }; + } + var shouldUseDefault = getShouldUseDefault(context.program, importClause); + return shouldUseDefault ? { convertTo: 1, import: importClause.namedBindings } : { convertTo: 2, import: importClause.namedBindings }; + } + function getShouldUseDefault(program, importClause) { + return ts6.getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker()); + } + function doChange(sourceFile, program, changes, info) { + var checker = program.getTypeChecker(); + if (info.convertTo === 0) { + doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, ts6.getAllowSyntheticDefaultImports(program.getCompilerOptions())); + } else { + doChangeNamedToNamespaceOrDefault( + sourceFile, + program, + changes, + info.import, + info.convertTo === 1 + /* ImportKind.Default */ + ); + } + } + function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allowSyntheticDefaultImports) { + var usedAsNamespaceOrDefault = false; + var nodesToReplace = []; + var conflictingNames = new ts6.Map(); + ts6.FindAllReferences.Core.eachSymbolReferenceInFile(toConvert.name, checker, sourceFile, function(id) { + if (!ts6.isPropertyAccessOrQualifiedName(id.parent)) { + usedAsNamespaceOrDefault = true; + } else { + var exportName2 = getRightOfPropertyAccessOrQualifiedName(id.parent).text; + if (checker.resolveName( + exportName2, + id, + 67108863, + /*excludeGlobals*/ + true + )) { + conflictingNames.set(exportName2, true); + } + ts6.Debug.assert(getLeftOfPropertyAccessOrQualifiedName(id.parent) === id, "Parent expression should match id"); + nodesToReplace.push(id.parent); + } + }); + var exportNameToImportName = new ts6.Map(); + for (var _i = 0, nodesToReplace_1 = nodesToReplace; _i < nodesToReplace_1.length; _i++) { + var propertyAccessOrQualifiedName = nodesToReplace_1[_i]; + var exportName = getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName).text; + var importName = exportNameToImportName.get(exportName); + if (importName === void 0) { + exportNameToImportName.set(exportName, importName = conflictingNames.has(exportName) ? ts6.getUniqueName(exportName, sourceFile) : exportName); + } + changes.replaceNode(sourceFile, propertyAccessOrQualifiedName, ts6.factory.createIdentifier(importName)); + } + var importSpecifiers = []; + exportNameToImportName.forEach(function(name, propertyName) { + importSpecifiers.push(ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + name === propertyName ? void 0 : ts6.factory.createIdentifier(propertyName), + ts6.factory.createIdentifier(name) + )); + }); + var importDecl = toConvert.parent.parent; + if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports) { + changes.insertNodeAfter(sourceFile, importDecl, updateImport( + importDecl, + /*defaultImportName*/ + void 0, + importSpecifiers + )); + } else { + changes.replaceNode(sourceFile, importDecl, updateImport(importDecl, usedAsNamespaceOrDefault ? ts6.factory.createIdentifier(toConvert.name.text) : void 0, importSpecifiers)); + } + } + function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { + return ts6.isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; + } + function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { + return ts6.isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; + } + function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault) { + if (shouldUseDefault === void 0) { + shouldUseDefault = getShouldUseDefault(program, toConvert.parent); + } + var checker = program.getTypeChecker(); + var importDecl = toConvert.parent.parent; + var moduleSpecifier = importDecl.moduleSpecifier; + var toConvertSymbols = new ts6.Set(); + toConvert.elements.forEach(function(namedImport) { + var symbol = checker.getSymbolAtLocation(namedImport.name); + if (symbol) { + toConvertSymbols.add(symbol); + } + }); + var preferredName = moduleSpecifier && ts6.isStringLiteral(moduleSpecifier) ? ts6.codefix.moduleSpecifierToValidIdentifier( + moduleSpecifier.text, + 99 + /* ScriptTarget.ESNext */ + ) : "module"; + function hasNamespaceNameConflict(namedImport) { + return !!ts6.FindAllReferences.Core.eachSymbolReferenceInFile(namedImport.name, checker, sourceFile, function(id) { + var symbol = checker.resolveName( + preferredName, + id, + 67108863, + /*excludeGlobals*/ + true + ); + if (symbol) { + if (toConvertSymbols.has(symbol)) { + return ts6.isExportSpecifier(id.parent); + } + return true; + } + return false; + }); + } + var namespaceNameConflicts = toConvert.elements.some(hasNamespaceNameConflict); + var namespaceImportName = namespaceNameConflicts ? ts6.getUniqueName(preferredName, sourceFile) : preferredName; + var neededNamedImports = new ts6.Set(); + var _loop_15 = function(element2) { + var propertyName = (element2.propertyName || element2.name).text; + ts6.FindAllReferences.Core.eachSymbolReferenceInFile(element2.name, checker, sourceFile, function(id) { + var access = ts6.factory.createPropertyAccessExpression(ts6.factory.createIdentifier(namespaceImportName), propertyName); + if (ts6.isShorthandPropertyAssignment(id.parent)) { + changes.replaceNode(sourceFile, id.parent, ts6.factory.createPropertyAssignment(id.text, access)); + } else if (ts6.isExportSpecifier(id.parent)) { + neededNamedImports.add(element2); + } else { + changes.replaceNode(sourceFile, id, access); + } + }); + }; + for (var _i = 0, _a2 = toConvert.elements; _i < _a2.length; _i++) { + var element = _a2[_i]; + _loop_15(element); + } + changes.replaceNode(sourceFile, toConvert, shouldUseDefault ? ts6.factory.createIdentifier(namespaceImportName) : ts6.factory.createNamespaceImport(ts6.factory.createIdentifier(namespaceImportName))); + if (neededNamedImports.size) { + var newNamedImports = ts6.arrayFrom(neededNamedImports.values()).map(function(element2) { + return ts6.factory.createImportSpecifier(element2.isTypeOnly, element2.propertyName && ts6.factory.createIdentifier(element2.propertyName.text), ts6.factory.createIdentifier(element2.name.text)); + }); + changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport( + importDecl, + /*defaultImportName*/ + void 0, + newNamedImports + )); + } + } + refactor2.doChangeNamedToNamespaceOrDefault = doChangeNamedToNamespaceOrDefault; + function isExportEqualsModule(moduleSpecifier, checker) { + var externalModule = checker.resolveExternalModuleName(moduleSpecifier); + if (!externalModule) + return false; + var exportEquals = checker.resolveExternalModuleSymbol(externalModule); + return externalModule !== exportEquals; + } + function updateImport(old, defaultImportName, elements) { + return ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + defaultImportName, + elements && elements.length ? ts6.factory.createNamedImports(elements) : void 0 + ), + old.moduleSpecifier, + /*assertClause*/ + void 0 + ); + } + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var convertToOptionalChainExpression; + (function(convertToOptionalChainExpression2) { + var refactorName = "Convert to optional chain expression"; + var convertToOptionalChainExpressionMessage = ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_to_optional_chain_expression); + var toOptionalChainAction = { + name: refactorName, + description: convertToOptionalChainExpressionMessage, + kind: "refactor.rewrite.expression.optionalChain" + }; + refactor2.registerRefactor(refactorName, { + kinds: [toOptionalChainAction.kind], + getEditsForAction: getRefactorEditsToConvertToOptionalChain, + getAvailableActions: getRefactorActionsToConvertToOptionalChain + }); + function getRefactorActionsToConvertToOptionalChain(context) { + var info = getInfo(context, context.triggerReason === "invoked"); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + return [{ + name: refactorName, + description: convertToOptionalChainExpressionMessage, + actions: [toOptionalChainAction] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName, + description: convertToOptionalChainExpressionMessage, + actions: [__assign(__assign({}, toOptionalChainAction), { notApplicableReason: info.error })] + }]; + } + return ts6.emptyArray; + } + function getRefactorEditsToConvertToOptionalChain(context, actionName) { + var info = getInfo(context); + ts6.Debug.assert(info && !refactor2.isRefactorErrorInfo(info), "Expected applicable refactor info"); + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(context.file, context.program.getTypeChecker(), t, info, actionName); + }); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + function isValidExpression(node) { + return ts6.isBinaryExpression(node) || ts6.isConditionalExpression(node); + } + function isValidStatement(node) { + return ts6.isExpressionStatement(node) || ts6.isReturnStatement(node) || ts6.isVariableStatement(node); + } + function isValidExpressionOrStatement(node) { + return isValidExpression(node) || isValidStatement(node); + } + function getInfo(context, considerEmptySpans) { + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } + var file = context.file, program = context.program; + var span = ts6.getRefactorContextSpan(context); + var forEmptySpan = span.length === 0; + if (forEmptySpan && !considerEmptySpans) + return void 0; + var startToken = ts6.getTokenAtPosition(file, span.start); + var endToken = ts6.findTokenOnLeftOfPosition(file, span.start + span.length); + var adjustedSpan = ts6.createTextSpanFromBounds(startToken.pos, endToken && endToken.end >= startToken.pos ? endToken.getEnd() : startToken.getEnd()); + var parent = forEmptySpan ? getValidParentNodeOfEmptySpan(startToken) : getValidParentNodeContainingSpan(startToken, adjustedSpan); + var expression = parent && isValidExpressionOrStatement(parent) ? getExpression(parent) : void 0; + if (!expression) + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_convertible_access_expression) }; + var checker = program.getTypeChecker(); + return ts6.isConditionalExpression(expression) ? getConditionalInfo(expression, checker) : getBinaryInfo(expression); + } + function getConditionalInfo(expression, checker) { + var condition = expression.condition; + var finalExpression = getFinalExpressionInChain(expression.whenTrue); + if (!finalExpression || checker.isNullableType(checker.getTypeAtLocation(finalExpression))) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_convertible_access_expression) }; + } + if ((ts6.isPropertyAccessExpression(condition) || ts6.isIdentifier(condition)) && getMatchingStart(condition, finalExpression.expression)) { + return { finalExpression, occurrences: [condition], expression }; + } else if (ts6.isBinaryExpression(condition)) { + var occurrences = getOccurrencesInExpression(finalExpression.expression, condition); + return occurrences ? { finalExpression, occurrences, expression } : { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_matching_access_expressions) }; + } + } + function getBinaryInfo(expression) { + if (expression.operatorToken.kind !== 55) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Can_only_convert_logical_AND_access_chains) }; + } + var finalExpression = getFinalExpressionInChain(expression.right); + if (!finalExpression) + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_convertible_access_expression) }; + var occurrences = getOccurrencesInExpression(finalExpression.expression, expression.left); + return occurrences ? { finalExpression, occurrences, expression } : { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_matching_access_expressions) }; + } + function getOccurrencesInExpression(matchTo, expression) { + var occurrences = []; + while (ts6.isBinaryExpression(expression) && expression.operatorToken.kind === 55) { + var match = getMatchingStart(ts6.skipParentheses(matchTo), ts6.skipParentheses(expression.right)); + if (!match) { + break; + } + occurrences.push(match); + matchTo = match; + expression = expression.left; + } + var finalMatch = getMatchingStart(matchTo, expression); + if (finalMatch) { + occurrences.push(finalMatch); + } + return occurrences.length > 0 ? occurrences : void 0; + } + function getMatchingStart(chain, subchain) { + if (!ts6.isIdentifier(subchain) && !ts6.isPropertyAccessExpression(subchain) && !ts6.isElementAccessExpression(subchain)) { + return void 0; + } + return chainStartsWith(chain, subchain) ? subchain : void 0; + } + function chainStartsWith(chain, subchain) { + while (ts6.isCallExpression(chain) || ts6.isPropertyAccessExpression(chain) || ts6.isElementAccessExpression(chain)) { + if (getTextOfChainNode(chain) === getTextOfChainNode(subchain)) + break; + chain = chain.expression; + } + while (ts6.isPropertyAccessExpression(chain) && ts6.isPropertyAccessExpression(subchain) || ts6.isElementAccessExpression(chain) && ts6.isElementAccessExpression(subchain)) { + if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain)) + return false; + chain = chain.expression; + subchain = subchain.expression; + } + return ts6.isIdentifier(chain) && ts6.isIdentifier(subchain) && chain.getText() === subchain.getText(); + } + function getTextOfChainNode(node) { + if (ts6.isIdentifier(node) || ts6.isStringOrNumericLiteralLike(node)) { + return node.getText(); + } + if (ts6.isPropertyAccessExpression(node)) { + return getTextOfChainNode(node.name); + } + if (ts6.isElementAccessExpression(node)) { + return getTextOfChainNode(node.argumentExpression); + } + return void 0; + } + function getValidParentNodeContainingSpan(node, span) { + while (node.parent) { + if (isValidExpressionOrStatement(node) && span.length !== 0 && node.end >= span.start + span.length) { + return node; + } + node = node.parent; + } + return void 0; + } + function getValidParentNodeOfEmptySpan(node) { + while (node.parent) { + if (isValidExpressionOrStatement(node) && !isValidExpressionOrStatement(node.parent)) { + return node; + } + node = node.parent; + } + return void 0; + } + function getExpression(node) { + if (isValidExpression(node)) { + return node; + } + if (ts6.isVariableStatement(node)) { + var variable = ts6.getSingleVariableOfVariableStatement(node); + var initializer = variable === null || variable === void 0 ? void 0 : variable.initializer; + return initializer && isValidExpression(initializer) ? initializer : void 0; + } + return node.expression && isValidExpression(node.expression) ? node.expression : void 0; + } + function getFinalExpressionInChain(node) { + node = ts6.skipParentheses(node); + if (ts6.isBinaryExpression(node)) { + return getFinalExpressionInChain(node.left); + } else if ((ts6.isPropertyAccessExpression(node) || ts6.isElementAccessExpression(node) || ts6.isCallExpression(node)) && !ts6.isOptionalChain(node)) { + return node; + } + return void 0; + } + function convertOccurrences(checker, toConvert, occurrences) { + if (ts6.isPropertyAccessExpression(toConvert) || ts6.isElementAccessExpression(toConvert) || ts6.isCallExpression(toConvert)) { + var chain = convertOccurrences(checker, toConvert.expression, occurrences); + var lastOccurrence = occurrences.length > 0 ? occurrences[occurrences.length - 1] : void 0; + var isOccurrence = (lastOccurrence === null || lastOccurrence === void 0 ? void 0 : lastOccurrence.getText()) === toConvert.expression.getText(); + if (isOccurrence) + occurrences.pop(); + if (ts6.isCallExpression(toConvert)) { + return isOccurrence ? ts6.factory.createCallChain(chain, ts6.factory.createToken( + 28 + /* SyntaxKind.QuestionDotToken */ + ), toConvert.typeArguments, toConvert.arguments) : ts6.factory.createCallChain(chain, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments); + } else if (ts6.isPropertyAccessExpression(toConvert)) { + return isOccurrence ? ts6.factory.createPropertyAccessChain(chain, ts6.factory.createToken( + 28 + /* SyntaxKind.QuestionDotToken */ + ), toConvert.name) : ts6.factory.createPropertyAccessChain(chain, toConvert.questionDotToken, toConvert.name); + } else if (ts6.isElementAccessExpression(toConvert)) { + return isOccurrence ? ts6.factory.createElementAccessChain(chain, ts6.factory.createToken( + 28 + /* SyntaxKind.QuestionDotToken */ + ), toConvert.argumentExpression) : ts6.factory.createElementAccessChain(chain, toConvert.questionDotToken, toConvert.argumentExpression); + } + } + return toConvert; + } + function doChange(sourceFile, checker, changes, info, _actionName) { + var finalExpression = info.finalExpression, occurrences = info.occurrences, expression = info.expression; + var firstOccurrence = occurrences[occurrences.length - 1]; + var convertedChain = convertOccurrences(checker, finalExpression, occurrences); + if (convertedChain && (ts6.isPropertyAccessExpression(convertedChain) || ts6.isElementAccessExpression(convertedChain) || ts6.isCallExpression(convertedChain))) { + if (ts6.isBinaryExpression(expression)) { + changes.replaceNodeRange(sourceFile, firstOccurrence, finalExpression, convertedChain); + } else if (ts6.isConditionalExpression(expression)) { + changes.replaceNode(sourceFile, expression, ts6.factory.createBinaryExpression(convertedChain, ts6.factory.createToken( + 60 + /* SyntaxKind.QuestionQuestionToken */ + ), expression.whenFalse)); + } + } + } + })(convertToOptionalChainExpression = refactor2.convertToOptionalChainExpression || (refactor2.convertToOptionalChainExpression = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var addOrRemoveBracesToArrowFunction; + (function(addOrRemoveBracesToArrowFunction2) { + var refactorName = "Convert overload list to single signature"; + var refactorDescription = ts6.Diagnostics.Convert_overload_list_to_single_signature.message; + var functionOverloadAction = { + name: refactorName, + description: refactorDescription, + kind: "refactor.rewrite.function.overloadList" + }; + refactor2.registerRefactor(refactorName, { + kinds: [functionOverloadAction.kind], + getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature, + getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature + }); + function getRefactorActionsToConvertOverloadsToOneSignature(context) { + var file = context.file, startPosition = context.startPosition, program = context.program; + var info = getConvertableOverloadListAtPosition(file, startPosition, program); + if (!info) + return ts6.emptyArray; + return [{ + name: refactorName, + description: refactorDescription, + actions: [functionOverloadAction] + }]; + } + function getRefactorEditsToConvertOverloadsToOneSignature(context) { + var file = context.file, startPosition = context.startPosition, program = context.program; + var signatureDecls = getConvertableOverloadListAtPosition(file, startPosition, program); + if (!signatureDecls) + return void 0; + var checker = program.getTypeChecker(); + var lastDeclaration = signatureDecls[signatureDecls.length - 1]; + var updated = lastDeclaration; + switch (lastDeclaration.kind) { + case 170: { + updated = ts6.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); + break; + } + case 171: { + updated = ts6.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); + break; + } + case 176: { + updated = ts6.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); + break; + } + case 173: { + updated = ts6.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); + break; + } + case 177: { + updated = ts6.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); + break; + } + case 259: { + updated = ts6.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); + break; + } + default: + return ts6.Debug.failBadSyntaxKind(lastDeclaration, "Unhandled signature kind in overload list conversion refactoring"); + } + if (updated === lastDeclaration) { + return; + } + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + t.replaceNodeRange(file, signatureDecls[0], signatureDecls[signatureDecls.length - 1], updated); + }); + return { renameFilename: void 0, renameLocation: void 0, edits }; + function getNewParametersForCombinedSignature(signatureDeclarations) { + var lastSig = signatureDeclarations[signatureDeclarations.length - 1]; + if (ts6.isFunctionLikeDeclaration(lastSig) && lastSig.body) { + signatureDeclarations = signatureDeclarations.slice(0, signatureDeclarations.length - 1); + } + return ts6.factory.createNodeArray([ + ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createToken( + 25 + /* SyntaxKind.DotDotDotToken */ + ), + "args", + /*questionToken*/ + void 0, + ts6.factory.createUnionTypeNode(ts6.map(signatureDeclarations, convertSignatureParametersToTuple)) + ) + ]); + } + function convertSignatureParametersToTuple(decl) { + var members = ts6.map(decl.parameters, convertParameterToNamedTupleMember); + return ts6.setEmitFlags( + ts6.factory.createTupleTypeNode(members), + ts6.some(members, function(m) { + return !!ts6.length(ts6.getSyntheticLeadingComments(m)); + }) ? 0 : 1 + /* EmitFlags.SingleLine */ + ); + } + function convertParameterToNamedTupleMember(p) { + ts6.Debug.assert(ts6.isIdentifier(p.name)); + var result = ts6.setTextRange(ts6.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts6.factory.createKeywordTypeNode( + 131 + /* SyntaxKind.AnyKeyword */ + )), p); + var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); + if (parameterDocComment) { + var newComment = ts6.displayPartsToString(parameterDocComment); + if (newComment.length) { + ts6.setSyntheticLeadingComments(result, [{ + text: "*\n".concat(newComment.split("\n").map(function(c) { + return " * ".concat(c); + }).join("\n"), "\n "), + kind: 3, + pos: -1, + end: -1, + hasTrailingNewLine: true, + hasLeadingNewline: true + }]); + } + } + return result; + } + } + function isConvertableSignatureDeclaration(d) { + switch (d.kind) { + case 170: + case 171: + case 176: + case 173: + case 177: + case 259: + return true; + } + return false; + } + function getConvertableOverloadListAtPosition(file, startPosition, program) { + var node = ts6.getTokenAtPosition(file, startPosition); + var containingDecl = ts6.findAncestor(node, isConvertableSignatureDeclaration); + if (!containingDecl) { + return; + } + if (ts6.isFunctionLikeDeclaration(containingDecl) && containingDecl.body && ts6.rangeContainsPosition(containingDecl.body, startPosition)) { + return; + } + var checker = program.getTypeChecker(); + var signatureSymbol = containingDecl.symbol; + if (!signatureSymbol) { + return; + } + var decls = signatureSymbol.declarations; + if (ts6.length(decls) <= 1) { + return; + } + if (!ts6.every(decls, function(d) { + return ts6.getSourceFileOfNode(d) === file; + })) { + return; + } + if (!isConvertableSignatureDeclaration(decls[0])) { + return; + } + var kindOne = decls[0].kind; + if (!ts6.every(decls, function(d) { + return d.kind === kindOne; + })) { + return; + } + var signatureDecls = decls; + if (ts6.some(signatureDecls, function(d) { + return !!d.typeParameters || ts6.some(d.parameters, function(p) { + return !!p.modifiers || !ts6.isIdentifier(p.name); + }); + })) { + return; + } + var signatures = ts6.mapDefined(signatureDecls, function(d) { + return checker.getSignatureFromDeclaration(d); + }); + if (ts6.length(signatures) !== ts6.length(decls)) { + return; + } + var returnOne = checker.getReturnTypeOfSignature(signatures[0]); + if (!ts6.every(signatures, function(s) { + return checker.getReturnTypeOfSignature(s) === returnOne; + })) { + return; + } + return signatureDecls; + } + })(addOrRemoveBracesToArrowFunction = refactor2.addOrRemoveBracesToArrowFunction || (refactor2.addOrRemoveBracesToArrowFunction = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var extractSymbol; + (function(extractSymbol2) { + var refactorName = "Extract Symbol"; + var extractConstantAction = { + name: "Extract Constant", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_constant), + kind: "refactor.extract.constant" + }; + var extractFunctionAction = { + name: "Extract Function", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_function), + kind: "refactor.extract.function" + }; + refactor2.registerRefactor(refactorName, { + kinds: [ + extractConstantAction.kind, + extractFunctionAction.kind + ], + getEditsForAction: getRefactorEditsToExtractSymbol, + getAvailableActions: getRefactorActionsToExtractSymbol + }); + function getRefactorActionsToExtractSymbol(context) { + var requestedRefactor = context.kind; + var rangeToExtract = getRangeToExtract(context.file, ts6.getRefactorContextSpan(context), context.triggerReason === "invoked"); + var targetRange = rangeToExtract.targetRange; + if (targetRange === void 0) { + if (!rangeToExtract.errors || rangeToExtract.errors.length === 0 || !context.preferences.provideRefactorNotApplicableReason) { + return ts6.emptyArray; + } + var errors2 = []; + if (refactor2.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + errors2.push({ + name: refactorName, + description: extractFunctionAction.description, + actions: [__assign(__assign({}, extractFunctionAction), { notApplicableReason: getStringError(rangeToExtract.errors) })] + }); + } + if (refactor2.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + errors2.push({ + name: refactorName, + description: extractConstantAction.description, + actions: [__assign(__assign({}, extractConstantAction), { notApplicableReason: getStringError(rangeToExtract.errors) })] + }); + } + return errors2; + } + var extractions = getPossibleExtractions(targetRange, context); + if (extractions === void 0) { + return ts6.emptyArray; + } + var functionActions = []; + var usedFunctionNames = new ts6.Map(); + var innermostErrorFunctionAction; + var constantActions = []; + var usedConstantNames = new ts6.Map(); + var innermostErrorConstantAction; + var i = 0; + for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { + var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; + if (refactor2.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + var description = functionExtraction.description; + if (functionExtraction.errors.length === 0) { + if (!usedFunctionNames.has(description)) { + usedFunctionNames.set(description, true); + functionActions.push({ + description, + name: "function_scope_".concat(i), + kind: extractFunctionAction.kind + }); + } + } else if (!innermostErrorFunctionAction) { + innermostErrorFunctionAction = { + description, + name: "function_scope_".concat(i), + notApplicableReason: getStringError(functionExtraction.errors), + kind: extractFunctionAction.kind + }; + } + } + if (refactor2.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + var description = constantExtraction.description; + if (constantExtraction.errors.length === 0) { + if (!usedConstantNames.has(description)) { + usedConstantNames.set(description, true); + constantActions.push({ + description, + name: "constant_scope_".concat(i), + kind: extractConstantAction.kind + }); + } + } else if (!innermostErrorConstantAction) { + innermostErrorConstantAction = { + description, + name: "constant_scope_".concat(i), + notApplicableReason: getStringError(constantExtraction.errors), + kind: extractConstantAction.kind + }; + } + } + i++; + } + var infos = []; + if (functionActions.length) { + infos.push({ + name: refactorName, + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_function), + actions: functionActions + }); + } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) { + infos.push({ + name: refactorName, + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_function), + actions: [innermostErrorFunctionAction] + }); + } + if (constantActions.length) { + infos.push({ + name: refactorName, + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_constant), + actions: constantActions + }); + } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { + infos.push({ + name: refactorName, + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_constant), + actions: [innermostErrorConstantAction] + }); + } + return infos.length ? infos : ts6.emptyArray; + function getStringError(errors3) { + var error = errors3[0].messageText; + if (typeof error !== "string") { + error = error.messageText; + } + return error; + } + } + extractSymbol2.getRefactorActionsToExtractSymbol = getRefactorActionsToExtractSymbol; + function getRefactorEditsToExtractSymbol(context, actionName) { + var rangeToExtract = getRangeToExtract(context.file, ts6.getRefactorContextSpan(context)); + var targetRange = rangeToExtract.targetRange; + var parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName); + if (parsedFunctionIndexMatch) { + var index = +parsedFunctionIndexMatch[1]; + ts6.Debug.assert(isFinite(index), "Expected to parse a finite number from the function scope index"); + return getFunctionExtractionAtIndex(targetRange, context, index); + } + var parsedConstantIndexMatch = /^constant_scope_(\d+)$/.exec(actionName); + if (parsedConstantIndexMatch) { + var index = +parsedConstantIndexMatch[1]; + ts6.Debug.assert(isFinite(index), "Expected to parse a finite number from the constant scope index"); + return getConstantExtractionAtIndex(targetRange, context, index); + } + ts6.Debug.fail("Unrecognized action name"); + } + extractSymbol2.getRefactorEditsToExtractSymbol = getRefactorEditsToExtractSymbol; + var Messages; + (function(Messages2) { + function createMessage(message) { + return { message, code: 0, category: ts6.DiagnosticCategory.Message, key: message }; + } + Messages2.cannotExtractRange = createMessage("Cannot extract range."); + Messages2.cannotExtractImport = createMessage("Cannot extract import statement."); + Messages2.cannotExtractSuper = createMessage("Cannot extract super call."); + Messages2.cannotExtractJSDoc = createMessage("Cannot extract JSDoc."); + Messages2.cannotExtractEmpty = createMessage("Cannot extract empty range."); + Messages2.expressionExpected = createMessage("expression expected."); + Messages2.uselessConstantType = createMessage("No reason to extract constant of type."); + Messages2.statementOrExpressionExpected = createMessage("Statement or expression expected."); + Messages2.cannotExtractRangeContainingConditionalBreakOrContinueStatements = createMessage("Cannot extract range containing conditional break or continue statements."); + Messages2.cannotExtractRangeContainingConditionalReturnStatement = createMessage("Cannot extract range containing conditional return statement."); + Messages2.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange = createMessage("Cannot extract range containing labeled break or continue with target outside of the range."); + Messages2.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators = createMessage("Cannot extract range containing writes to references located outside of the target range in generators."); + Messages2.typeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope."); + Messages2.functionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope."); + Messages2.cannotExtractIdentifier = createMessage("Select more than a single identifier."); + Messages2.cannotExtractExportedEntity = createMessage("Cannot extract exported declaration"); + Messages2.cannotWriteInExpression = createMessage("Cannot write back side-effects when extracting an expression"); + Messages2.cannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor"); + Messages2.cannotExtractAmbientBlock = createMessage("Cannot extract code from ambient contexts"); + Messages2.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes"); + Messages2.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS"); + Messages2.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block"); + Messages2.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method"); + })(Messages = extractSymbol2.Messages || (extractSymbol2.Messages = {})); + var RangeFacts; + (function(RangeFacts2) { + RangeFacts2[RangeFacts2["None"] = 0] = "None"; + RangeFacts2[RangeFacts2["HasReturn"] = 1] = "HasReturn"; + RangeFacts2[RangeFacts2["IsGenerator"] = 2] = "IsGenerator"; + RangeFacts2[RangeFacts2["IsAsyncFunction"] = 4] = "IsAsyncFunction"; + RangeFacts2[RangeFacts2["UsesThis"] = 8] = "UsesThis"; + RangeFacts2[RangeFacts2["UsesThisInFunction"] = 16] = "UsesThisInFunction"; + RangeFacts2[RangeFacts2["InStaticRegion"] = 32] = "InStaticRegion"; + })(RangeFacts || (RangeFacts = {})); + function getRangeToExtract(sourceFile, span, invoked) { + if (invoked === void 0) { + invoked = true; + } + var length = span.length; + if (length === 0 && !invoked) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractEmpty)] }; + } + var cursorRequest = length === 0 && invoked; + var startToken = ts6.findFirstNonJsxWhitespaceToken(sourceFile, span.start); + var endToken = ts6.findTokenOnLeftOfPosition(sourceFile, ts6.textSpanEnd(span)); + var adjustedSpan = startToken && endToken && invoked ? getAdjustedSpanFromNodes(startToken, endToken, sourceFile) : span; + var start = cursorRequest ? getExtractableParent(startToken) : ts6.getParentNodeInSpan(startToken, sourceFile, adjustedSpan); + var end = cursorRequest ? start : ts6.getParentNodeInSpan(endToken, sourceFile, adjustedSpan); + var rangeFacts = RangeFacts.None; + var thisNode; + if (!start || !end) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; + } + if (start.flags & 8388608) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] }; + } + if (start.parent !== end.parent) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; + } + if (start !== end) { + if (!isBlockLike(start.parent)) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; + } + var statements = []; + for (var _i = 0, _a = start.parent.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (statement === start || statements.length) { + var errors_1 = checkNode(statement); + if (errors_1) { + return { errors: errors_1 }; + } + statements.push(statement); + } + if (statement === end) { + break; + } + } + if (!statements.length) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; + } + return { targetRange: { range: statements, facts: rangeFacts, thisNode } }; + } + if (ts6.isReturnStatement(start) && !start.expression) { + return { errors: [ts6.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; + } + var node = refineNode(start); + var errors2 = checkRootNode(node) || checkNode(node); + if (errors2) { + return { errors: errors2 }; + } + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode } }; + function refineNode(node2) { + if (ts6.isReturnStatement(node2)) { + if (node2.expression) { + return node2.expression; + } + } else if (ts6.isVariableStatement(node2) || ts6.isVariableDeclarationList(node2)) { + var declarations = ts6.isVariableStatement(node2) ? node2.declarationList.declarations : node2.declarations; + var numInitializers = 0; + var lastInitializer = void 0; + for (var _i2 = 0, declarations_5 = declarations; _i2 < declarations_5.length; _i2++) { + var declaration = declarations_5[_i2]; + if (declaration.initializer) { + numInitializers++; + lastInitializer = declaration.initializer; + } + } + if (numInitializers === 1) { + return lastInitializer; + } + } else if (ts6.isVariableDeclaration(node2)) { + if (node2.initializer) { + return node2.initializer; + } + } + return node2; + } + function checkRootNode(node2) { + if (ts6.isIdentifier(ts6.isExpressionStatement(node2) ? node2.expression : node2)) { + return [ts6.createDiagnosticForNode(node2, Messages.cannotExtractIdentifier)]; + } + return void 0; + } + function checkForStaticContext(nodeToCheck, containingClass) { + var current = nodeToCheck; + while (current !== containingClass) { + if (current.kind === 169) { + if (ts6.isStatic(current)) { + rangeFacts |= RangeFacts.InStaticRegion; + } + break; + } else if (current.kind === 166) { + var ctorOrMethod = ts6.getContainingFunction(current); + if (ctorOrMethod.kind === 173) { + rangeFacts |= RangeFacts.InStaticRegion; + } + break; + } else if (current.kind === 171) { + if (ts6.isStatic(current)) { + rangeFacts |= RangeFacts.InStaticRegion; + } + } + current = current.parent; + } + } + function checkNode(nodeToCheck) { + var PermittedJumps; + (function(PermittedJumps2) { + PermittedJumps2[PermittedJumps2["None"] = 0] = "None"; + PermittedJumps2[PermittedJumps2["Break"] = 1] = "Break"; + PermittedJumps2[PermittedJumps2["Continue"] = 2] = "Continue"; + PermittedJumps2[PermittedJumps2["Return"] = 4] = "Return"; + })(PermittedJumps || (PermittedJumps = {})); + ts6.Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)"); + ts6.Debug.assert(!ts6.positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)"); + if (!ts6.isStatement(nodeToCheck) && !(ts6.isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) { + return [ts6.createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)]; + } + if (nodeToCheck.flags & 16777216) { + return [ts6.createDiagnosticForNode(nodeToCheck, Messages.cannotExtractAmbientBlock)]; + } + var containingClass = ts6.getContainingClass(nodeToCheck); + if (containingClass) { + checkForStaticContext(nodeToCheck, containingClass); + } + var errors3; + var permittedJumps = 4; + var seenLabels; + visit(nodeToCheck); + if (rangeFacts & RangeFacts.UsesThis) { + var container = ts6.getThisContainer( + nodeToCheck, + /** includeArrowFunctions */ + false + ); + if (container.kind === 259 || container.kind === 171 && container.parent.kind === 207 || container.kind === 215) { + rangeFacts |= RangeFacts.UsesThisInFunction; + } + } + return errors3; + function visit(node2) { + if (errors3) { + return true; + } + if (ts6.isDeclaration(node2)) { + var declaringNode = node2.kind === 257 ? node2.parent.parent : node2; + if (ts6.hasSyntacticModifier( + declaringNode, + 1 + /* ModifierFlags.Export */ + )) { + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); + return true; + } + } + switch (node2.kind) { + case 269: + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractImport)); + return true; + case 274: + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); + return true; + case 106: + if (node2.parent.kind === 210) { + var containingClass_1 = ts6.getContainingClass(node2); + if (containingClass_1 === void 0 || containingClass_1.pos < span.start || containingClass_1.end >= span.start + span.length) { + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractSuper)); + return true; + } + } else { + rangeFacts |= RangeFacts.UsesThis; + thisNode = node2; + } + break; + case 216: + ts6.forEachChild(node2, function check(n) { + if (ts6.isThis(n)) { + rangeFacts |= RangeFacts.UsesThis; + thisNode = node2; + } else if (ts6.isClassLike(n) || ts6.isFunctionLike(n) && !ts6.isArrowFunction(n)) { + return false; + } else { + ts6.forEachChild(n, check); + } + }); + case 260: + case 259: + if (ts6.isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) { + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope)); + } + case 228: + case 215: + case 171: + case 173: + case 174: + case 175: + return false; + } + var savedPermittedJumps = permittedJumps; + switch (node2.kind) { + case 242: + permittedJumps &= ~4; + break; + case 255: + permittedJumps = 0; + break; + case 238: + if (node2.parent && node2.parent.kind === 255 && node2.parent.finallyBlock === node2) { + permittedJumps = 4; + } + break; + case 293: + case 292: + permittedJumps |= 1; + break; + default: + if (ts6.isIterationStatement( + node2, + /*lookInLabeledStatements*/ + false + )) { + permittedJumps |= 1 | 2; + } + break; + } + switch (node2.kind) { + case 194: + case 108: + rangeFacts |= RangeFacts.UsesThis; + thisNode = node2; + break; + case 253: { + var label = node2.label; + (seenLabels || (seenLabels = [])).push(label.escapedText); + ts6.forEachChild(node2, visit); + seenLabels.pop(); + break; + } + case 249: + case 248: { + var label = node2.label; + if (label) { + if (!ts6.contains(seenLabels, label.escapedText)) { + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)); + } + } else { + if (!(permittedJumps & (node2.kind === 249 ? 1 : 2))) { + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); + } + } + break; + } + case 220: + rangeFacts |= RangeFacts.IsAsyncFunction; + break; + case 226: + rangeFacts |= RangeFacts.IsGenerator; + break; + case 250: + if (permittedJumps & 4) { + rangeFacts |= RangeFacts.HasReturn; + } else { + (errors3 || (errors3 = [])).push(ts6.createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalReturnStatement)); + } + break; + default: + ts6.forEachChild(node2, visit); + break; + } + permittedJumps = savedPermittedJumps; + } + } + } + extractSymbol2.getRangeToExtract = getRangeToExtract; + function getAdjustedSpanFromNodes(startNode, endNode, sourceFile) { + var start = startNode.getStart(sourceFile); + var end = endNode.getEnd(); + if (sourceFile.text.charCodeAt(end) === 59) { + end++; + } + return { start, length: end - start }; + } + function getStatementOrExpressionRange(node) { + if (ts6.isStatement(node)) { + return [node]; + } + if (ts6.isExpressionNode(node)) { + return ts6.isExpressionStatement(node.parent) ? [node.parent] : node; + } + if (isStringLiteralJsxAttribute(node)) { + return node; + } + return void 0; + } + function isScope(node) { + return ts6.isArrowFunction(node) ? ts6.isFunctionBody(node.body) : ts6.isFunctionLikeDeclaration(node) || ts6.isSourceFile(node) || ts6.isModuleBlock(node) || ts6.isClassLike(node); + } + function collectEnclosingScopes(range2) { + var current = isReadonlyArray(range2.range) ? ts6.first(range2.range) : range2.range; + if (range2.facts & RangeFacts.UsesThis && !(range2.facts & RangeFacts.UsesThisInFunction)) { + var containingClass = ts6.getContainingClass(current); + if (containingClass) { + var containingFunction = ts6.findAncestor(current, ts6.isFunctionLikeDeclaration); + return containingFunction ? [containingFunction, containingClass] : [containingClass]; + } + } + var scopes = []; + while (true) { + current = current.parent; + if (current.kind === 166) { + current = ts6.findAncestor(current, function(parent) { + return ts6.isFunctionLikeDeclaration(parent); + }).parent; + } + if (isScope(current)) { + scopes.push(current); + if (current.kind === 308) { + return scopes; + } + } + } + } + function getFunctionExtractionAtIndex(targetRange, context, requestedChangesIndex) { + var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, target = _b.target, usagesPerScope = _b.usagesPerScope, functionErrorsPerScope = _b.functionErrorsPerScope, exposedVariableDeclarations = _b.exposedVariableDeclarations; + ts6.Debug.assert(!functionErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); + context.cancellationToken.throwIfCancellationRequested(); + return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context); + } + function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) { + var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, target = _b.target, usagesPerScope = _b.usagesPerScope, constantErrorsPerScope = _b.constantErrorsPerScope, exposedVariableDeclarations = _b.exposedVariableDeclarations; + ts6.Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); + ts6.Debug.assert(exposedVariableDeclarations.length === 0, "Extract constant accepted a range containing a variable declaration?"); + context.cancellationToken.throwIfCancellationRequested(); + var expression = ts6.isExpression(target) ? target : target.statements[0].expression; + return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context); + } + function getPossibleExtractions(targetRange, context) { + var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, functionErrorsPerScope = _b.functionErrorsPerScope, constantErrorsPerScope = _b.constantErrorsPerScope; + var extractions = scopes.map(function(scope, i) { + var functionDescriptionPart = getDescriptionForFunctionInScope(scope); + var constantDescriptionPart = getDescriptionForConstantInScope(scope); + var scopeDescription = ts6.isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : ts6.isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope); + var functionDescription; + var constantDescription; + if (scopeDescription === 1) { + functionDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]); + constantDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"]); + } else if (scopeDescription === 0) { + functionDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]); + constantDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"]); + } else { + functionDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_1), [functionDescriptionPart, scopeDescription]); + constantDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_1), [constantDescriptionPart, scopeDescription]); + } + if (i === 0 && !ts6.isClassLike(scope)) { + constantDescription = ts6.formatStringFromArgs(ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_0_in_enclosing_scope), [constantDescriptionPart]); + } + return { + functionExtraction: { + description: functionDescription, + errors: functionErrorsPerScope[i] + }, + constantExtraction: { + description: constantDescription, + errors: constantErrorsPerScope[i] + } + }; + }); + return extractions; + } + function getPossibleExtractionsWorker(targetRange, context) { + var sourceFile = context.file; + var scopes = collectEnclosingScopes(targetRange); + var enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile); + var readsAndWrites = collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, context.program.getTypeChecker(), context.cancellationToken); + return { scopes, readsAndWrites }; + } + function getDescriptionForFunctionInScope(scope) { + return ts6.isFunctionLikeDeclaration(scope) ? "inner function" : ts6.isClassLike(scope) ? "method" : "function"; + } + function getDescriptionForConstantInScope(scope) { + return ts6.isClassLike(scope) ? "readonly field" : "constant"; + } + function getDescriptionForFunctionLikeDeclaration(scope) { + switch (scope.kind) { + case 173: + return "constructor"; + case 215: + case 259: + return scope.name ? "function '".concat(scope.name.text, "'") : ts6.ANONYMOUS; + case 216: + return "arrow function"; + case 171: + return "method '".concat(scope.name.getText(), "'"); + case 174: + return "'get ".concat(scope.name.getText(), "'"); + case 175: + return "'set ".concat(scope.name.getText(), "'"); + default: + throw ts6.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); + } + } + function getDescriptionForClassLikeDeclaration(scope) { + return scope.kind === 260 ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; + } + function getDescriptionForModuleLikeDeclaration(scope) { + return scope.kind === 265 ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 : 1; + } + var SpecialScope; + (function(SpecialScope2) { + SpecialScope2[SpecialScope2["Module"] = 0] = "Module"; + SpecialScope2[SpecialScope2["Global"] = 1] = "Global"; + })(SpecialScope || (SpecialScope = {})); + function extractFunctionInScope(node, scope, _a, exposedVariableDeclarations, range2, context) { + var usagesInScope = _a.usages, typeParameterUsages = _a.typeParameterUsages, substitutions = _a.substitutions; + var checker = context.program.getTypeChecker(); + var scriptTarget = ts6.getEmitScriptTarget(context.program.getCompilerOptions()); + var importAdder = ts6.codefix.createImportAdder(context.file, context.program, context.preferences, context.host); + var file = scope.getSourceFile(); + var functionNameText = ts6.getUniqueName(ts6.isClassLike(scope) ? "newMethod" : "newFunction", file); + var isJS = ts6.isInJSFile(scope); + var functionName = ts6.factory.createIdentifier(functionNameText); + var returnType; + var parameters = []; + var callArguments = []; + var writes; + usagesInScope.forEach(function(usage, name) { + var typeNode; + if (!isJS) { + var type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node); + type = checker.getBaseTypeOfLiteralType(type); + typeNode = ts6.codefix.typeToAutoImportableTypeNode( + checker, + importAdder, + type, + scope, + scriptTarget, + 1 + /* NodeBuilderFlags.NoTruncation */ + ); + } + var paramDecl = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + name, + /*questionToken*/ + void 0, + typeNode + ); + parameters.push(paramDecl); + if (usage.usage === 2) { + (writes || (writes = [])).push(usage); + } + callArguments.push(ts6.factory.createIdentifier(name)); + }); + var typeParametersAndDeclarations = ts6.arrayFrom(typeParameterUsages.values()).map(function(type) { + return { type, declaration: getFirstDeclaration(type) }; + }); + var sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder); + var typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map(function(t) { + return t.declaration; + }); + var callTypeArguments = typeParameters !== void 0 ? typeParameters.map(function(decl) { + return ts6.factory.createTypeReferenceNode( + decl.name, + /*typeArguments*/ + void 0 + ); + }) : void 0; + if (ts6.isExpression(node) && !isJS) { + var contextualType = checker.getContextualType(node); + returnType = checker.typeToTypeNode( + contextualType, + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ); + } + var _b = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range2.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty; + ts6.suppressLeadingAndTrailingTrivia(body); + var newFunction; + var callThis = !!(range2.facts & RangeFacts.UsesThisInFunction); + if (ts6.isClassLike(scope)) { + var modifiers = isJS ? [] : [ts6.factory.createModifier( + 121 + /* SyntaxKind.PrivateKeyword */ + )]; + if (range2.facts & RangeFacts.InStaticRegion) { + modifiers.push(ts6.factory.createModifier( + 124 + /* SyntaxKind.StaticKeyword */ + )); + } + if (range2.facts & RangeFacts.IsAsyncFunction) { + modifiers.push(ts6.factory.createModifier( + 132 + /* SyntaxKind.AsyncKeyword */ + )); + } + newFunction = ts6.factory.createMethodDeclaration( + modifiers.length ? modifiers : void 0, + range2.facts & RangeFacts.IsGenerator ? ts6.factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ) : void 0, + functionName, + /*questionToken*/ + void 0, + typeParameters, + parameters, + returnType, + body + ); + } else { + if (callThis) { + parameters.unshift(ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + "this", + /*questionToken*/ + void 0, + checker.typeToTypeNode( + checker.getTypeAtLocation(range2.thisNode), + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ), + /*initializer*/ + void 0 + )); + } + newFunction = ts6.factory.createFunctionDeclaration(range2.facts & RangeFacts.IsAsyncFunction ? [ts6.factory.createToken( + 132 + /* SyntaxKind.AsyncKeyword */ + )] : void 0, range2.facts & RangeFacts.IsGenerator ? ts6.factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ) : void 0, functionName, typeParameters, parameters, returnType, body); + } + var changeTracker = ts6.textChanges.ChangeTracker.fromContext(context); + var minInsertionPos = (isReadonlyArray(range2.range) ? ts6.last(range2.range) : range2.range).end; + var nodeToInsertBefore = getNodeToInsertFunctionBefore(minInsertionPos, scope); + if (nodeToInsertBefore) { + changeTracker.insertNodeBefore( + context.file, + nodeToInsertBefore, + newFunction, + /*blankLineBetween*/ + true + ); + } else { + changeTracker.insertNodeAtEndOfScope(context.file, scope, newFunction); + } + importAdder.writeFixes(changeTracker); + var newNodes = []; + var called = getCalledExpression(scope, range2, functionNameText); + if (callThis) { + callArguments.unshift(ts6.factory.createIdentifier("this")); + } + var call = ts6.factory.createCallExpression( + callThis ? ts6.factory.createPropertyAccessExpression(called, "call") : called, + callTypeArguments, + // Note that no attempt is made to take advantage of type argument inference + callArguments + ); + if (range2.facts & RangeFacts.IsGenerator) { + call = ts6.factory.createYieldExpression(ts6.factory.createToken( + 41 + /* SyntaxKind.AsteriskToken */ + ), call); + } + if (range2.facts & RangeFacts.IsAsyncFunction) { + call = ts6.factory.createAwaitExpression(call); + } + if (isInJSXContent(node)) { + call = ts6.factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + call + ); + } + if (exposedVariableDeclarations.length && !writes) { + ts6.Debug.assert(!returnValueProperty, "Expected no returnValueProperty"); + ts6.Debug.assert(!(range2.facts & RangeFacts.HasReturn), "Expected RangeFacts.HasReturn flag to be unset"); + if (exposedVariableDeclarations.length === 1) { + var variableDeclaration = exposedVariableDeclarations[0]; + newNodes.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ts6.factory.createVariableDeclaration( + ts6.getSynthesizedDeepClone(variableDeclaration.name), + /*exclamationToken*/ + void 0, + /*type*/ + ts6.getSynthesizedDeepClone(variableDeclaration.type), + /*initializer*/ + call + )], + // TODO (acasey): test binding patterns + variableDeclaration.parent.flags + ) + )); + } else { + var bindingElements = []; + var typeElements = []; + var commonNodeFlags = exposedVariableDeclarations[0].parent.flags; + var sawExplicitType = false; + for (var _i = 0, exposedVariableDeclarations_1 = exposedVariableDeclarations; _i < exposedVariableDeclarations_1.length; _i++) { + var variableDeclaration = exposedVariableDeclarations_1[_i]; + bindingElements.push(ts6.factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + /*name*/ + ts6.getSynthesizedDeepClone(variableDeclaration.name) + )); + var variableType = checker.typeToTypeNode( + checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)), + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ); + typeElements.push(ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + /*name*/ + variableDeclaration.symbol.name, + /*questionToken*/ + void 0, + /*type*/ + variableType + )); + sawExplicitType = sawExplicitType || variableDeclaration.type !== void 0; + commonNodeFlags = commonNodeFlags & variableDeclaration.parent.flags; + } + var typeLiteral = sawExplicitType ? ts6.factory.createTypeLiteralNode(typeElements) : void 0; + if (typeLiteral) { + ts6.setEmitFlags( + typeLiteral, + 1 + /* EmitFlags.SingleLine */ + ); + } + newNodes.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList([ts6.factory.createVariableDeclaration( + ts6.factory.createObjectBindingPattern(bindingElements), + /*exclamationToken*/ + void 0, + /*type*/ + typeLiteral, + /*initializer*/ + call + )], commonNodeFlags) + )); + } + } else if (exposedVariableDeclarations.length || writes) { + if (exposedVariableDeclarations.length) { + for (var _c = 0, exposedVariableDeclarations_2 = exposedVariableDeclarations; _c < exposedVariableDeclarations_2.length; _c++) { + var variableDeclaration = exposedVariableDeclarations_2[_c]; + var flags = variableDeclaration.parent.flags; + if (flags & 2) { + flags = flags & ~2 | 1; + } + newNodes.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList([ts6.factory.createVariableDeclaration( + variableDeclaration.symbol.name, + /*exclamationToken*/ + void 0, + getTypeDeepCloneUnionUndefined(variableDeclaration.type) + )], flags) + )); + } + } + if (returnValueProperty) { + newNodes.push(ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [ts6.factory.createVariableDeclaration( + returnValueProperty, + /*exclamationToken*/ + void 0, + getTypeDeepCloneUnionUndefined(returnType) + )], + 1 + /* NodeFlags.Let */ + ) + )); + } + var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); + if (returnValueProperty) { + assignments.unshift(ts6.factory.createShorthandPropertyAssignment(returnValueProperty)); + } + if (assignments.length === 1) { + ts6.Debug.assert(!returnValueProperty, "Shouldn't have returnValueProperty here"); + newNodes.push(ts6.factory.createExpressionStatement(ts6.factory.createAssignment(assignments[0].name, call))); + if (range2.facts & RangeFacts.HasReturn) { + newNodes.push(ts6.factory.createReturnStatement()); + } + } else { + newNodes.push(ts6.factory.createExpressionStatement(ts6.factory.createAssignment(ts6.factory.createObjectLiteralExpression(assignments), call))); + if (returnValueProperty) { + newNodes.push(ts6.factory.createReturnStatement(ts6.factory.createIdentifier(returnValueProperty))); + } + } + } else { + if (range2.facts & RangeFacts.HasReturn) { + newNodes.push(ts6.factory.createReturnStatement(call)); + } else if (isReadonlyArray(range2.range)) { + newNodes.push(ts6.factory.createExpressionStatement(call)); + } else { + newNodes.push(call); + } + } + if (isReadonlyArray(range2.range)) { + changeTracker.replaceNodeRangeWithNodes(context.file, ts6.first(range2.range), ts6.last(range2.range), newNodes); + } else { + changeTracker.replaceNodeWithNodes(context.file, range2.range, newNodes); + } + var edits = changeTracker.getChanges(); + var renameRange = isReadonlyArray(range2.range) ? ts6.first(range2.range) : range2.range; + var renameFilename = renameRange.getSourceFile().fileName; + var renameLocation = ts6.getRenameLocation( + edits, + renameFilename, + functionNameText, + /*isDeclaredBeforeUse*/ + false + ); + return { renameFilename, renameLocation, edits }; + function getTypeDeepCloneUnionUndefined(typeNode) { + if (typeNode === void 0) { + return void 0; + } + var clone = ts6.getSynthesizedDeepClone(typeNode); + var withoutParens = clone; + while (ts6.isParenthesizedTypeNode(withoutParens)) { + withoutParens = withoutParens.type; + } + return ts6.isUnionTypeNode(withoutParens) && ts6.find(withoutParens.types, function(t) { + return t.kind === 155; + }) ? clone : ts6.factory.createUnionTypeNode([clone, ts6.factory.createKeywordTypeNode( + 155 + /* SyntaxKind.UndefinedKeyword */ + )]); + } + } + function extractConstantInScope(node, scope, _a, rangeFacts, context) { + var _b; + var substitutions = _a.substitutions; + var checker = context.program.getTypeChecker(); + var file = scope.getSourceFile(); + var localNameText = ts6.isPropertyAccessExpression(node) && !ts6.isClassLike(scope) && !checker.resolveName( + node.name.text, + node, + 111551, + /*excludeGlobals*/ + false + ) && !ts6.isPrivateIdentifier(node.name) && !ts6.isKeyword(node.name.originalKeywordKind) ? node.name.text : ts6.getUniqueName(ts6.isClassLike(scope) ? "newProperty" : "newLocal", file); + var isJS = ts6.isInJSFile(scope); + var variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode( + checker.getContextualType(node), + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ); + var initializer = transformConstantInitializer(ts6.skipParentheses(node), substitutions); + _b = transformFunctionInitializerAndType(variableType, initializer), variableType = _b.variableType, initializer = _b.initializer; + ts6.suppressLeadingAndTrailingTrivia(initializer); + var changeTracker = ts6.textChanges.ChangeTracker.fromContext(context); + if (ts6.isClassLike(scope)) { + ts6.Debug.assert(!isJS, "Cannot extract to a JS class"); + var modifiers = []; + modifiers.push(ts6.factory.createModifier( + 121 + /* SyntaxKind.PrivateKeyword */ + )); + if (rangeFacts & RangeFacts.InStaticRegion) { + modifiers.push(ts6.factory.createModifier( + 124 + /* SyntaxKind.StaticKeyword */ + )); + } + modifiers.push(ts6.factory.createModifier( + 146 + /* SyntaxKind.ReadonlyKeyword */ + )); + var newVariable = ts6.factory.createPropertyDeclaration( + modifiers, + localNameText, + /*questionToken*/ + void 0, + variableType, + initializer + ); + var localReference = ts6.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion ? ts6.factory.createIdentifier(scope.name.getText()) : ts6.factory.createThis(), ts6.factory.createIdentifier(localNameText)); + if (isInJSXContent(node)) { + localReference = ts6.factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + localReference + ); + } + var maxInsertionPos = node.pos; + var nodeToInsertBefore = getNodeToInsertPropertyBefore(maxInsertionPos, scope); + changeTracker.insertNodeBefore( + context.file, + nodeToInsertBefore, + newVariable, + /*blankLineBetween*/ + true + ); + changeTracker.replaceNode(context.file, node, localReference); + } else { + var newVariableDeclaration = ts6.factory.createVariableDeclaration( + localNameText, + /*exclamationToken*/ + void 0, + variableType, + initializer + ); + var oldVariableDeclaration = getContainingVariableDeclarationIfInList(node, scope); + if (oldVariableDeclaration) { + changeTracker.insertNodeBefore(context.file, oldVariableDeclaration, newVariableDeclaration); + var localReference = ts6.factory.createIdentifier(localNameText); + changeTracker.replaceNode(context.file, node, localReference); + } else if (node.parent.kind === 241 && scope === ts6.findAncestor(node, isScope)) { + var newVariableStatement = ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [newVariableDeclaration], + 2 + /* NodeFlags.Const */ + ) + ); + changeTracker.replaceNode(context.file, node.parent, newVariableStatement); + } else { + var newVariableStatement = ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList( + [newVariableDeclaration], + 2 + /* NodeFlags.Const */ + ) + ); + var nodeToInsertBefore = getNodeToInsertConstantBefore(node, scope); + if (nodeToInsertBefore.pos === 0) { + changeTracker.insertNodeAtTopOfFile( + context.file, + newVariableStatement, + /*blankLineBetween*/ + false + ); + } else { + changeTracker.insertNodeBefore( + context.file, + nodeToInsertBefore, + newVariableStatement, + /*blankLineBetween*/ + false + ); + } + if (node.parent.kind === 241) { + changeTracker.delete(context.file, node.parent); + } else { + var localReference = ts6.factory.createIdentifier(localNameText); + if (isInJSXContent(node)) { + localReference = ts6.factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + localReference + ); + } + changeTracker.replaceNode(context.file, node, localReference); + } + } + } + var edits = changeTracker.getChanges(); + var renameFilename = node.getSourceFile().fileName; + var renameLocation = ts6.getRenameLocation( + edits, + renameFilename, + localNameText, + /*isDeclaredBeforeUse*/ + true + ); + return { renameFilename, renameLocation, edits }; + function transformFunctionInitializerAndType(variableType2, initializer2) { + if (variableType2 === void 0) + return { variableType: variableType2, initializer: initializer2 }; + if (!ts6.isFunctionExpression(initializer2) && !ts6.isArrowFunction(initializer2) || !!initializer2.typeParameters) + return { variableType: variableType2, initializer: initializer2 }; + var functionType = checker.getTypeAtLocation(node); + var functionSignature = ts6.singleOrUndefined(checker.getSignaturesOfType( + functionType, + 0 + /* SignatureKind.Call */ + )); + if (!functionSignature) + return { variableType: variableType2, initializer: initializer2 }; + if (!!functionSignature.getTypeParameters()) + return { variableType: variableType2, initializer: initializer2 }; + var parameters = []; + var hasAny = false; + for (var _i = 0, _a2 = initializer2.parameters; _i < _a2.length; _i++) { + var p = _a2[_i]; + if (p.type) { + parameters.push(p); + } else { + var paramType = checker.getTypeAtLocation(p); + if (paramType === checker.getAnyType()) + hasAny = true; + parameters.push(ts6.factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode( + paramType, + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ), p.initializer)); + } + } + if (hasAny) + return { variableType: variableType2, initializer: initializer2 }; + variableType2 = void 0; + if (ts6.isArrowFunction(initializer2)) { + initializer2 = ts6.factory.updateArrowFunction(initializer2, ts6.canHaveModifiers(node) ? ts6.getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode( + functionSignature.getReturnType(), + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ), initializer2.equalsGreaterThanToken, initializer2.body); + } else { + if (functionSignature && !!functionSignature.thisParameter) { + var firstParameter = ts6.firstOrUndefined(parameters); + if (!firstParameter || ts6.isIdentifier(firstParameter.name) && firstParameter.name.escapedText !== "this") { + var thisType = checker.getTypeOfSymbolAtLocation(functionSignature.thisParameter, node); + parameters.splice(0, 0, ts6.factory.createParameterDeclaration( + /* modifiers */ + void 0, + /* dotDotDotToken */ + void 0, + "this", + /* questionToken */ + void 0, + checker.typeToTypeNode( + thisType, + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ) + )); + } + } + initializer2 = ts6.factory.updateFunctionExpression(initializer2, ts6.canHaveModifiers(node) ? ts6.getModifiers(node) : void 0, initializer2.asteriskToken, initializer2.name, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode( + functionSignature.getReturnType(), + scope, + 1 + /* NodeBuilderFlags.NoTruncation */ + ), initializer2.body); + } + return { variableType: variableType2, initializer: initializer2 }; + } + } + function getContainingVariableDeclarationIfInList(node, scope) { + var prevNode; + while (node !== void 0 && node !== scope) { + if (ts6.isVariableDeclaration(node) && node.initializer === prevNode && ts6.isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1) { + return node; + } + prevNode = node; + node = node.parent; + } + } + function getFirstDeclaration(type) { + var firstDeclaration; + var symbol = type.symbol; + if (symbol && symbol.declarations) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) { + firstDeclaration = declaration; + } + } + } + return firstDeclaration; + } + function compareTypesByDeclarationOrder(_a, _b) { + var type1 = _a.type, declaration1 = _a.declaration; + var type2 = _b.type, declaration2 = _b.declaration; + return ts6.compareProperties(declaration1, declaration2, "pos", ts6.compareValues) || ts6.compareStringsCaseSensitive(type1.symbol ? type1.symbol.getName() : "", type2.symbol ? type2.symbol.getName() : "") || ts6.compareValues(type1.id, type2.id); + } + function getCalledExpression(scope, range2, functionNameText) { + var functionReference = ts6.factory.createIdentifier(functionNameText); + if (ts6.isClassLike(scope)) { + var lhs = range2.facts & RangeFacts.InStaticRegion ? ts6.factory.createIdentifier(scope.name.text) : ts6.factory.createThis(); + return ts6.factory.createPropertyAccessExpression(lhs, functionReference); + } else { + return functionReference; + } + } + function transformFunctionBody(body, exposedVariableDeclarations, writes, substitutions, hasReturn) { + var hasWritesOrVariableDeclarations = writes !== void 0 || exposedVariableDeclarations.length > 0; + if (ts6.isBlock(body) && !hasWritesOrVariableDeclarations && substitutions.size === 0) { + return { body: ts6.factory.createBlock( + body.statements, + /*multLine*/ + true + ), returnValueProperty: void 0 }; + } + var returnValueProperty; + var ignoreReturns = false; + var statements = ts6.factory.createNodeArray(ts6.isBlock(body) ? body.statements.slice(0) : [ts6.isStatement(body) ? body : ts6.factory.createReturnStatement(ts6.skipParentheses(body))]); + if (hasWritesOrVariableDeclarations || substitutions.size) { + var rewrittenStatements = ts6.visitNodes(statements, visitor).slice(); + if (hasWritesOrVariableDeclarations && !hasReturn && ts6.isStatement(body)) { + var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); + if (assignments.length === 1) { + rewrittenStatements.push(ts6.factory.createReturnStatement(assignments[0].name)); + } else { + rewrittenStatements.push(ts6.factory.createReturnStatement(ts6.factory.createObjectLiteralExpression(assignments))); + } + } + return { body: ts6.factory.createBlock( + rewrittenStatements, + /*multiLine*/ + true + ), returnValueProperty }; + } else { + return { body: ts6.factory.createBlock( + statements, + /*multiLine*/ + true + ), returnValueProperty: void 0 }; + } + function visitor(node) { + if (!ignoreReturns && ts6.isReturnStatement(node) && hasWritesOrVariableDeclarations) { + var assignments2 = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); + if (node.expression) { + if (!returnValueProperty) { + returnValueProperty = "__return"; + } + assignments2.unshift(ts6.factory.createPropertyAssignment(returnValueProperty, ts6.visitNode(node.expression, visitor))); + } + if (assignments2.length === 1) { + return ts6.factory.createReturnStatement(assignments2[0].name); + } else { + return ts6.factory.createReturnStatement(ts6.factory.createObjectLiteralExpression(assignments2)); + } + } else { + var oldIgnoreReturns = ignoreReturns; + ignoreReturns = ignoreReturns || ts6.isFunctionLikeDeclaration(node) || ts6.isClassLike(node); + var substitution = substitutions.get(ts6.getNodeId(node).toString()); + var result = substitution ? ts6.getSynthesizedDeepClone(substitution) : ts6.visitEachChild(node, visitor, ts6.nullTransformationContext); + ignoreReturns = oldIgnoreReturns; + return result; + } + } + } + function transformConstantInitializer(initializer, substitutions) { + return substitutions.size ? visitor(initializer) : initializer; + function visitor(node) { + var substitution = substitutions.get(ts6.getNodeId(node).toString()); + return substitution ? ts6.getSynthesizedDeepClone(substitution) : ts6.visitEachChild(node, visitor, ts6.nullTransformationContext); + } + } + function getStatementsOrClassElements(scope) { + if (ts6.isFunctionLikeDeclaration(scope)) { + var body = scope.body; + if (ts6.isBlock(body)) { + return body.statements; + } + } else if (ts6.isModuleBlock(scope) || ts6.isSourceFile(scope)) { + return scope.statements; + } else if (ts6.isClassLike(scope)) { + return scope.members; + } else { + ts6.assertType(scope); + } + return ts6.emptyArray; + } + function getNodeToInsertFunctionBefore(minPos, scope) { + return ts6.find(getStatementsOrClassElements(scope), function(child) { + return child.pos >= minPos && ts6.isFunctionLikeDeclaration(child) && !ts6.isConstructorDeclaration(child); + }); + } + function getNodeToInsertPropertyBefore(maxPos, scope) { + var members = scope.members; + ts6.Debug.assert(members.length > 0, "Found no members"); + var prevMember; + var allProperties = true; + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var member = members_1[_i]; + if (member.pos > maxPos) { + return prevMember || members[0]; + } + if (allProperties && !ts6.isPropertyDeclaration(member)) { + if (prevMember !== void 0) { + return member; + } + allProperties = false; + } + prevMember = member; + } + if (prevMember === void 0) + return ts6.Debug.fail(); + return prevMember; + } + function getNodeToInsertConstantBefore(node, scope) { + ts6.Debug.assert(!ts6.isClassLike(scope)); + var prevScope; + for (var curr = node; curr !== scope; curr = curr.parent) { + if (isScope(curr)) { + prevScope = curr; + } + } + for (var curr = (prevScope || node).parent; ; curr = curr.parent) { + if (isBlockLike(curr)) { + var prevStatement = void 0; + for (var _i = 0, _a = curr.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (statement.pos > node.pos) { + break; + } + prevStatement = statement; + } + if (!prevStatement && ts6.isCaseClause(curr)) { + ts6.Debug.assert(ts6.isSwitchStatement(curr.parent.parent), "Grandparent isn't a switch statement"); + return curr.parent.parent; + } + return ts6.Debug.checkDefined(prevStatement, "prevStatement failed to get set"); + } + ts6.Debug.assert(curr !== scope, "Didn't encounter a block-like before encountering scope"); + } + } + function getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes) { + var variableAssignments = ts6.map(exposedVariableDeclarations, function(v) { + return ts6.factory.createShorthandPropertyAssignment(v.symbol.name); + }); + var writeAssignments = ts6.map(writes, function(w) { + return ts6.factory.createShorthandPropertyAssignment(w.symbol.name); + }); + return variableAssignments === void 0 ? writeAssignments : writeAssignments === void 0 ? variableAssignments : variableAssignments.concat(writeAssignments); + } + function isReadonlyArray(v) { + return ts6.isArray(v); + } + function getEnclosingTextRange(targetRange, sourceFile) { + return isReadonlyArray(targetRange.range) ? { pos: ts6.first(targetRange.range).getStart(sourceFile), end: ts6.last(targetRange.range).getEnd() } : targetRange.range; + } + var Usage; + (function(Usage2) { + Usage2[Usage2["Read"] = 1] = "Read"; + Usage2[Usage2["Write"] = 2] = "Write"; + })(Usage || (Usage = {})); + function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, checker, cancellationToken) { + var allTypeParameterUsages = new ts6.Map(); + var usagesPerScope = []; + var substitutionsPerScope = []; + var functionErrorsPerScope = []; + var constantErrorsPerScope = []; + var visibleDeclarationsInExtractedRange = []; + var exposedVariableSymbolSet = new ts6.Map(); + var exposedVariableDeclarations = []; + var firstExposedNonVariableDeclaration; + var expression = !isReadonlyArray(targetRange.range) ? targetRange.range : targetRange.range.length === 1 && ts6.isExpressionStatement(targetRange.range[0]) ? targetRange.range[0].expression : void 0; + var expressionDiagnostic; + if (expression === void 0) { + var statements = targetRange.range; + var start = ts6.first(statements).getStart(); + var end = ts6.last(statements).end; + expressionDiagnostic = ts6.createFileDiagnostic(sourceFile, start, end - start, Messages.expressionExpected); + } else if (checker.getTypeAtLocation(expression).flags & (16384 | 131072)) { + expressionDiagnostic = ts6.createDiagnosticForNode(expression, Messages.uselessConstantType); + } + for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) { + var scope = scopes_1[_i]; + usagesPerScope.push({ usages: new ts6.Map(), typeParameterUsages: new ts6.Map(), substitutions: new ts6.Map() }); + substitutionsPerScope.push(new ts6.Map()); + functionErrorsPerScope.push([]); + var constantErrors = []; + if (expressionDiagnostic) { + constantErrors.push(expressionDiagnostic); + } + if (ts6.isClassLike(scope) && ts6.isInJSFile(scope)) { + constantErrors.push(ts6.createDiagnosticForNode(scope, Messages.cannotExtractToJSClass)); + } + if (ts6.isArrowFunction(scope) && !ts6.isBlock(scope.body)) { + constantErrors.push(ts6.createDiagnosticForNode(scope, Messages.cannotExtractToExpressionArrowFunction)); + } + constantErrorsPerScope.push(constantErrors); + } + var seenUsages = new ts6.Map(); + var target = isReadonlyArray(targetRange.range) ? ts6.factory.createBlock(targetRange.range) : targetRange.range; + var unmodifiedNode = isReadonlyArray(targetRange.range) ? ts6.first(targetRange.range) : targetRange.range; + var inGenericContext = isInGenericContext(unmodifiedNode); + collectUsages(target); + if (inGenericContext && !isReadonlyArray(targetRange.range) && !ts6.isJsxAttribute(targetRange.range)) { + var contextualType = checker.getContextualType(targetRange.range); + recordTypeParameterUsages(contextualType); + } + if (allTypeParameterUsages.size > 0) { + var seenTypeParameterUsages = new ts6.Map(); + var i_2 = 0; + for (var curr = unmodifiedNode; curr !== void 0 && i_2 < scopes.length; curr = curr.parent) { + if (curr === scopes[i_2]) { + seenTypeParameterUsages.forEach(function(typeParameter2, id) { + usagesPerScope[i_2].typeParameterUsages.set(id, typeParameter2); + }); + i_2++; + } + if (ts6.isDeclarationWithTypeParameters(curr)) { + for (var _a = 0, _b = ts6.getEffectiveTypeParameterDeclarations(curr); _a < _b.length; _a++) { + var typeParameterDecl = _b[_a]; + var typeParameter = checker.getTypeAtLocation(typeParameterDecl); + if (allTypeParameterUsages.has(typeParameter.id.toString())) { + seenTypeParameterUsages.set(typeParameter.id.toString(), typeParameter); + } + } + } + } + ts6.Debug.assert(i_2 === scopes.length, "Should have iterated all scopes"); + } + if (visibleDeclarationsInExtractedRange.length) { + var containingLexicalScopeOfExtraction = ts6.isBlockScope(scopes[0], scopes[0].parent) ? scopes[0] : ts6.getEnclosingBlockScopeContainer(scopes[0]); + ts6.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); + } + var _loop_16 = function(i2) { + var scopeUsages = usagesPerScope[i2]; + if (i2 > 0 && (scopeUsages.usages.size > 0 || scopeUsages.typeParameterUsages.size > 0)) { + var errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range; + constantErrorsPerScope[i2].push(ts6.createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes)); + } + if (targetRange.facts & RangeFacts.UsesThisInFunction && ts6.isClassLike(scopes[i2])) { + functionErrorsPerScope[i2].push(ts6.createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod)); + } + var hasWrite = false; + var readonlyClassPropertyWrite; + usagesPerScope[i2].usages.forEach(function(value) { + if (value.usage === 2) { + hasWrite = true; + if (value.symbol.flags & 106500 && value.symbol.valueDeclaration && ts6.hasEffectiveModifier( + value.symbol.valueDeclaration, + 64 + /* ModifierFlags.Readonly */ + )) { + readonlyClassPropertyWrite = value.symbol.valueDeclaration; + } + } + }); + ts6.Debug.assert(isReadonlyArray(targetRange.range) || exposedVariableDeclarations.length === 0, "No variable declarations expected if something was extracted"); + if (hasWrite && !isReadonlyArray(targetRange.range)) { + var diag = ts6.createDiagnosticForNode(targetRange.range, Messages.cannotWriteInExpression); + functionErrorsPerScope[i2].push(diag); + constantErrorsPerScope[i2].push(diag); + } else if (readonlyClassPropertyWrite && i2 > 0) { + var diag = ts6.createDiagnosticForNode(readonlyClassPropertyWrite, Messages.cannotExtractReadonlyPropertyInitializerOutsideConstructor); + functionErrorsPerScope[i2].push(diag); + constantErrorsPerScope[i2].push(diag); + } else if (firstExposedNonVariableDeclaration) { + var diag = ts6.createDiagnosticForNode(firstExposedNonVariableDeclaration, Messages.cannotExtractExportedEntity); + functionErrorsPerScope[i2].push(diag); + constantErrorsPerScope[i2].push(diag); + } + }; + for (var i = 0; i < scopes.length; i++) { + _loop_16(i); + } + return { target, usagesPerScope, functionErrorsPerScope, constantErrorsPerScope, exposedVariableDeclarations }; + function isInGenericContext(node) { + return !!ts6.findAncestor(node, function(n) { + return ts6.isDeclarationWithTypeParameters(n) && ts6.getEffectiveTypeParameterDeclarations(n).length !== 0; + }); + } + function recordTypeParameterUsages(type) { + var symbolWalker = checker.getSymbolWalker(function() { + return cancellationToken.throwIfCancellationRequested(), true; + }); + var visitedTypes = symbolWalker.walkType(type).visitedTypes; + for (var _i2 = 0, visitedTypes_1 = visitedTypes; _i2 < visitedTypes_1.length; _i2++) { + var visitedType = visitedTypes_1[_i2]; + if (visitedType.isTypeParameter()) { + allTypeParameterUsages.set(visitedType.id.toString(), visitedType); + } + } + } + function collectUsages(node, valueUsage) { + if (valueUsage === void 0) { + valueUsage = 1; + } + if (inGenericContext) { + var type = checker.getTypeAtLocation(node); + recordTypeParameterUsages(type); + } + if (ts6.isDeclaration(node) && node.symbol) { + visibleDeclarationsInExtractedRange.push(node); + } + if (ts6.isAssignmentExpression(node)) { + collectUsages( + node.left, + 2 + /* Usage.Write */ + ); + collectUsages(node.right); + } else if (ts6.isUnaryExpressionWithWrite(node)) { + collectUsages( + node.operand, + 2 + /* Usage.Write */ + ); + } else if (ts6.isPropertyAccessExpression(node) || ts6.isElementAccessExpression(node)) { + ts6.forEachChild(node, collectUsages); + } else if (ts6.isIdentifier(node)) { + if (!node.parent) { + return; + } + if (ts6.isQualifiedName(node.parent) && node !== node.parent.left) { + return; + } + if (ts6.isPropertyAccessExpression(node.parent) && node !== node.parent.expression) { + return; + } + recordUsage( + node, + valueUsage, + /*isTypeNode*/ + ts6.isPartOfTypeNode(node) + ); + } else { + ts6.forEachChild(node, collectUsages); + } + } + function recordUsage(n, usage, isTypeNode) { + var symbolId = recordUsagebySymbol(n, usage, isTypeNode); + if (symbolId) { + for (var i2 = 0; i2 < scopes.length; i2++) { + var substitution = substitutionsPerScope[i2].get(symbolId); + if (substitution) { + usagesPerScope[i2].substitutions.set(ts6.getNodeId(n).toString(), substitution); + } + } + } + } + function recordUsagebySymbol(identifier, usage, isTypeName) { + var symbol = getSymbolReferencedByIdentifier(identifier); + if (!symbol) { + return void 0; + } + var symbolId = ts6.getSymbolId(symbol).toString(); + var lastUsage = seenUsages.get(symbolId); + if (lastUsage && lastUsage >= usage) { + return symbolId; + } + seenUsages.set(symbolId, usage); + if (lastUsage) { + for (var _i2 = 0, usagesPerScope_1 = usagesPerScope; _i2 < usagesPerScope_1.length; _i2++) { + var perScope = usagesPerScope_1[_i2]; + var prevEntry = perScope.usages.get(identifier.text); + if (prevEntry) { + perScope.usages.set(identifier.text, { usage, symbol, node: identifier }); + } + } + return symbolId; + } + var decls = symbol.getDeclarations(); + var declInFile = decls && ts6.find(decls, function(d) { + return d.getSourceFile() === sourceFile; + }); + if (!declInFile) { + return void 0; + } + if (ts6.rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) { + return void 0; + } + if (targetRange.facts & RangeFacts.IsGenerator && usage === 2) { + var diag = ts6.createDiagnosticForNode(identifier, Messages.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators); + for (var _a2 = 0, functionErrorsPerScope_1 = functionErrorsPerScope; _a2 < functionErrorsPerScope_1.length; _a2++) { + var errors2 = functionErrorsPerScope_1[_a2]; + errors2.push(diag); + } + for (var _b2 = 0, constantErrorsPerScope_1 = constantErrorsPerScope; _b2 < constantErrorsPerScope_1.length; _b2++) { + var errors2 = constantErrorsPerScope_1[_b2]; + errors2.push(diag); + } + } + for (var i2 = 0; i2 < scopes.length; i2++) { + var scope2 = scopes[i2]; + var resolvedSymbol = checker.resolveName( + symbol.name, + scope2, + symbol.flags, + /*excludeGlobals*/ + false + ); + if (resolvedSymbol === symbol) { + continue; + } + if (!substitutionsPerScope[i2].has(symbolId)) { + var substitution = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.exportSymbol || symbol, scope2, isTypeName); + if (substitution) { + substitutionsPerScope[i2].set(symbolId, substitution); + } else if (isTypeName) { + if (!(symbol.flags & 262144)) { + var diag = ts6.createDiagnosticForNode(identifier, Messages.typeWillNotBeVisibleInTheNewScope); + functionErrorsPerScope[i2].push(diag); + constantErrorsPerScope[i2].push(diag); + } + } else { + usagesPerScope[i2].usages.set(identifier.text, { usage, symbol, node: identifier }); + } + } + } + return symbolId; + } + function checkForUsedDeclarations(node) { + if (node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.indexOf(node) >= 0) { + return; + } + var sym = ts6.isIdentifier(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); + if (sym) { + var decl = ts6.find(visibleDeclarationsInExtractedRange, function(d) { + return d.symbol === sym; + }); + if (decl) { + if (ts6.isVariableDeclaration(decl)) { + var idString = decl.symbol.id.toString(); + if (!exposedVariableSymbolSet.has(idString)) { + exposedVariableDeclarations.push(decl); + exposedVariableSymbolSet.set(idString, true); + } + } else { + firstExposedNonVariableDeclaration = firstExposedNonVariableDeclaration || decl; + } + } + } + ts6.forEachChild(node, checkForUsedDeclarations); + } + function getSymbolReferencedByIdentifier(identifier) { + return identifier.parent && ts6.isShorthandPropertyAssignment(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier); + } + function tryReplaceWithQualifiedNameOrPropertyAccess(symbol, scopeDecl, isTypeNode) { + if (!symbol) { + return void 0; + } + var decls = symbol.getDeclarations(); + if (decls && decls.some(function(d) { + return d.parent === scopeDecl; + })) { + return ts6.factory.createIdentifier(symbol.name); + } + var prefix2 = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.parent, scopeDecl, isTypeNode); + if (prefix2 === void 0) { + return void 0; + } + return isTypeNode ? ts6.factory.createQualifiedName(prefix2, ts6.factory.createIdentifier(symbol.name)) : ts6.factory.createPropertyAccessExpression(prefix2, symbol.name); + } + } + function getExtractableParent(node) { + return ts6.findAncestor(node, function(node2) { + return node2.parent && isExtractableExpression(node2) && !ts6.isBinaryExpression(node2.parent); + }); + } + function isExtractableExpression(node) { + var parent = node.parent; + switch (parent.kind) { + case 302: + return false; + } + switch (node.kind) { + case 10: + return parent.kind !== 269 && parent.kind !== 273; + case 227: + case 203: + case 205: + return false; + case 79: + return parent.kind !== 205 && parent.kind !== 273 && parent.kind !== 278; + } + return true; + } + function isBlockLike(node) { + switch (node.kind) { + case 238: + case 308: + case 265: + case 292: + return true; + default: + return false; + } + } + function isInJSXContent(node) { + return isStringLiteralJsxAttribute(node) || (ts6.isJsxElement(node) || ts6.isJsxSelfClosingElement(node) || ts6.isJsxFragment(node)) && (ts6.isJsxElement(node.parent) || ts6.isJsxFragment(node.parent)); + } + function isStringLiteralJsxAttribute(node) { + return ts6.isStringLiteral(node) && node.parent && ts6.isJsxAttribute(node.parent); + } + })(extractSymbol = refactor2.extractSymbol || (refactor2.extractSymbol = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var refactorName = "Extract type"; + var extractToTypeAliasAction = { + name: "Extract to type alias", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_type_alias), + kind: "refactor.extract.type" + }; + var extractToInterfaceAction = { + name: "Extract to interface", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_interface), + kind: "refactor.extract.interface" + }; + var extractToTypeDefAction = { + name: "Extract to typedef", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_to_typedef), + kind: "refactor.extract.typedef" + }; + refactor2.registerRefactor(refactorName, { + kinds: [ + extractToTypeAliasAction.kind, + extractToInterfaceAction.kind, + extractToTypeDefAction.kind + ], + getAvailableActions: function getRefactorActionsToExtractType(context) { + var info = getRangeToExtract(context, context.triggerReason === "invoked"); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + return [{ + name: refactorName, + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_type), + actions: info.isJS ? [extractToTypeDefAction] : ts6.append([extractToTypeAliasAction], info.typeElements && extractToInterfaceAction) + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName, + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Extract_type), + actions: [ + __assign(__assign({}, extractToTypeDefAction), { notApplicableReason: info.error }), + __assign(__assign({}, extractToTypeAliasAction), { notApplicableReason: info.error }), + __assign(__assign({}, extractToInterfaceAction), { notApplicableReason: info.error }) + ] + }]; + } + return ts6.emptyArray; + }, + getEditsForAction: function getRefactorEditsToExtractType(context, actionName) { + var file = context.file; + var info = getRangeToExtract(context); + ts6.Debug.assert(info && !refactor2.isRefactorErrorInfo(info), "Expected to find a range to extract"); + var name = ts6.getUniqueName("NewType", file); + var edits = ts6.textChanges.ChangeTracker.with(context, function(changes) { + switch (actionName) { + case extractToTypeAliasAction.name: + ts6.Debug.assert(!info.isJS, "Invalid actionName/JS combo"); + return doTypeAliasChange(changes, file, name, info); + case extractToTypeDefAction.name: + ts6.Debug.assert(info.isJS, "Invalid actionName/JS combo"); + return doTypedefChange(changes, file, name, info); + case extractToInterfaceAction.name: + ts6.Debug.assert(!info.isJS && !!info.typeElements, "Invalid actionName/JS combo"); + return doInterfaceChange(changes, file, name, info); + default: + ts6.Debug.fail("Unexpected action name"); + } + }); + var renameFilename = file.fileName; + var renameLocation = ts6.getRenameLocation( + edits, + renameFilename, + name, + /*preferLastLocation*/ + false + ); + return { edits, renameFilename, renameLocation }; + } + }); + function getRangeToExtract(context, considerEmptySpans) { + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } + var file = context.file, startPosition = context.startPosition; + var isJS = ts6.isSourceFileJS(file); + var current = ts6.getTokenAtPosition(file, startPosition); + var range2 = ts6.createTextRangeFromSpan(ts6.getRefactorContextSpan(context)); + var cursorRequest = range2.pos === range2.end && considerEmptySpans; + var selection = ts6.findAncestor(current, function(node) { + return node.parent && ts6.isTypeNode(node) && !rangeContainsSkipTrivia(range2, node.parent, file) && (cursorRequest || ts6.nodeOverlapsWithStartEnd(current, file, range2.pos, range2.end)); + }); + if (!selection || !ts6.isTypeNode(selection)) + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Selection_is_not_a_valid_type_node) }; + var checker = context.program.getTypeChecker(); + var firstStatement = ts6.Debug.checkDefined(ts6.findAncestor(selection, ts6.isStatement), "Should find a statement"); + var typeParameters = collectTypeParameters(checker, selection, firstStatement, file); + if (!typeParameters) + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.No_type_could_be_extracted_from_this_type_node) }; + var typeElements = flattenTypeLiteralNodeReference(checker, selection); + return { isJS, selection, firstStatement, typeParameters, typeElements }; + } + function flattenTypeLiteralNodeReference(checker, node) { + if (!node) + return void 0; + if (ts6.isIntersectionTypeNode(node)) { + var result = []; + var seen_1 = new ts6.Map(); + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var type = _a[_i]; + var flattenedTypeMembers = flattenTypeLiteralNodeReference(checker, type); + if (!flattenedTypeMembers || !flattenedTypeMembers.every(function(type2) { + return type2.name && ts6.addToSeen(seen_1, ts6.getNameFromPropertyName(type2.name)); + })) { + return void 0; + } + ts6.addRange(result, flattenedTypeMembers); + } + return result; + } else if (ts6.isParenthesizedTypeNode(node)) { + return flattenTypeLiteralNodeReference(checker, node.type); + } else if (ts6.isTypeLiteralNode(node)) { + return node.members; + } + return void 0; + } + function rangeContainsSkipTrivia(r1, node, file) { + return ts6.rangeContainsStartEnd(r1, ts6.skipTrivia(file.text, node.pos), node.end); + } + function collectTypeParameters(checker, selection, statement, file) { + var result = []; + return visitor(selection) ? void 0 : result; + function visitor(node) { + if (ts6.isTypeReferenceNode(node)) { + if (ts6.isIdentifier(node.typeName)) { + var typeName = node.typeName; + var symbol = checker.resolveName( + typeName.text, + typeName, + 262144, + /* excludeGlobals */ + true + ); + for (var _i = 0, _a = (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts6.emptyArray; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts6.isTypeParameterDeclaration(decl) && decl.getSourceFile() === file) { + if (decl.name.escapedText === typeName.escapedText && rangeContainsSkipTrivia(decl, selection, file)) { + return true; + } + if (rangeContainsSkipTrivia(statement, decl, file) && !rangeContainsSkipTrivia(selection, decl, file)) { + ts6.pushIfUnique(result, decl); + break; + } + } + } + } + } else if (ts6.isInferTypeNode(node)) { + var conditionalTypeNode = ts6.findAncestor(node, function(n) { + return ts6.isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file); + }); + if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) { + return true; + } + } else if (ts6.isTypePredicateNode(node) || ts6.isThisTypeNode(node)) { + var functionLikeNode = ts6.findAncestor(node.parent, ts6.isFunctionLike); + if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) { + return true; + } + } else if (ts6.isTypeQueryNode(node)) { + if (ts6.isIdentifier(node.exprName)) { + var symbol = checker.resolveName( + node.exprName.text, + node.exprName, + 111551, + /* excludeGlobals */ + false + ); + if ((symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) { + return true; + } + } else { + if (ts6.isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) { + return true; + } + } + } + if (file && ts6.isTupleTypeNode(node) && ts6.getLineAndCharacterOfPosition(file, node.pos).line === ts6.getLineAndCharacterOfPosition(file, node.end).line) { + ts6.setEmitFlags( + node, + 1 + /* EmitFlags.SingleLine */ + ); + } + return ts6.forEachChild(node, visitor); + } + } + function doTypeAliasChange(changes, file, name, info) { + var firstStatement = info.firstStatement, selection = info.selection, typeParameters = info.typeParameters; + var newTypeNode = ts6.factory.createTypeAliasDeclaration( + /* modifiers */ + void 0, + name, + typeParameters.map(function(id) { + return ts6.factory.updateTypeParameterDeclaration( + id, + id.modifiers, + id.name, + id.constraint, + /* defaultType */ + void 0 + ); + }), + selection + ); + changes.insertNodeBefore( + file, + firstStatement, + ts6.ignoreSourceNewlines(newTypeNode), + /* blankLineBetween */ + true + ); + changes.replaceNode(file, selection, ts6.factory.createTypeReferenceNode(name, typeParameters.map(function(id) { + return ts6.factory.createTypeReferenceNode( + id.name, + /* typeArguments */ + void 0 + ); + })), { leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.Exclude, trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.ExcludeWhitespace }); + } + function doInterfaceChange(changes, file, name, info) { + var _a; + var firstStatement = info.firstStatement, selection = info.selection, typeParameters = info.typeParameters, typeElements = info.typeElements; + var newTypeNode = ts6.factory.createInterfaceDeclaration( + /* modifiers */ + void 0, + name, + typeParameters, + /* heritageClauses */ + void 0, + typeElements + ); + ts6.setTextRange(newTypeNode, (_a = typeElements[0]) === null || _a === void 0 ? void 0 : _a.parent); + changes.insertNodeBefore( + file, + firstStatement, + ts6.ignoreSourceNewlines(newTypeNode), + /* blankLineBetween */ + true + ); + changes.replaceNode(file, selection, ts6.factory.createTypeReferenceNode(name, typeParameters.map(function(id) { + return ts6.factory.createTypeReferenceNode( + id.name, + /* typeArguments */ + void 0 + ); + })), { leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.Exclude, trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.ExcludeWhitespace }); + } + function doTypedefChange(changes, file, name, info) { + var firstStatement = info.firstStatement, selection = info.selection, typeParameters = info.typeParameters; + ts6.setEmitFlags( + selection, + 1536 | 2048 + /* EmitFlags.NoNestedComments */ + ); + var node = ts6.factory.createJSDocTypedefTag(ts6.factory.createIdentifier("typedef"), ts6.factory.createJSDocTypeExpression(selection), ts6.factory.createIdentifier(name)); + var templates = []; + ts6.forEach(typeParameters, function(typeParameter) { + var constraint = ts6.getEffectiveConstraintOfTypeParameter(typeParameter); + var parameter = ts6.factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + typeParameter.name + ); + var template = ts6.factory.createJSDocTemplateTag(ts6.factory.createIdentifier("template"), constraint && ts6.cast(constraint, ts6.isJSDocTypeExpression), [parameter]); + templates.push(template); + }); + changes.insertNodeBefore( + file, + firstStatement, + ts6.factory.createJSDocComment( + /* comment */ + void 0, + ts6.factory.createNodeArray(ts6.concatenate(templates, [node])) + ), + /* blankLineBetween */ + true + ); + changes.replaceNode(file, selection, ts6.factory.createTypeReferenceNode(name, typeParameters.map(function(id) { + return ts6.factory.createTypeReferenceNode( + id.name, + /* typeArguments */ + void 0 + ); + }))); + } + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var generateGetAccessorAndSetAccessor; + (function(generateGetAccessorAndSetAccessor2) { + var actionName = "Generate 'get' and 'set' accessors"; + var actionDescription = ts6.Diagnostics.Generate_get_and_set_accessors.message; + var generateGetSetAction = { + name: actionName, + description: actionDescription, + kind: "refactor.rewrite.property.generateAccessors" + }; + refactor2.registerRefactor(actionName, { + kinds: [generateGetSetAction.kind], + getEditsForAction: function getRefactorActionsToGenerateGetAndSetAccessors(context, actionName2) { + if (!context.endPosition) + return void 0; + var info = ts6.codefix.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition); + ts6.Debug.assert(info && !refactor2.isRefactorErrorInfo(info), "Expected applicable refactor info"); + var edits = ts6.codefix.generateAccessorFromProperty(context.file, context.program, context.startPosition, context.endPosition, context, actionName2); + if (!edits) + return void 0; + var renameFilename = context.file.fileName; + var nameNeedRename = info.renameAccessor ? info.accessorName : info.fieldName; + var renameLocationOffset = ts6.isIdentifier(nameNeedRename) ? 0 : -1; + var renameLocation = renameLocationOffset + ts6.getRenameLocation( + edits, + renameFilename, + nameNeedRename.text, + /*preferLastLocation*/ + ts6.isParameter(info.declaration) + ); + return { renameFilename, renameLocation, edits }; + }, + getAvailableActions: function(context) { + if (!context.endPosition) + return ts6.emptyArray; + var info = ts6.codefix.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition, context.triggerReason === "invoked"); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + return [{ + name: actionName, + description: actionDescription, + actions: [generateGetSetAction] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: actionName, + description: actionDescription, + actions: [__assign(__assign({}, generateGetSetAction), { notApplicableReason: info.error })] + }]; + } + return ts6.emptyArray; + } + }); + })(generateGetAccessorAndSetAccessor = refactor2.generateGetAccessorAndSetAccessor || (refactor2.generateGetAccessorAndSetAccessor = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + function isRefactorErrorInfo(info) { + return info.error !== void 0; + } + refactor2.isRefactorErrorInfo = isRefactorErrorInfo; + function refactorKindBeginsWith(known, requested) { + if (!requested) + return true; + return known.substr(0, requested.length) === requested; + } + refactor2.refactorKindBeginsWith = refactorKindBeginsWith; + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var refactorName = "Move to a new file"; + var description = ts6.getLocaleSpecificMessage(ts6.Diagnostics.Move_to_a_new_file); + var moveToNewFileAction = { + name: refactorName, + description, + kind: "refactor.move.newFile" + }; + refactor2.registerRefactor(refactorName, { + kinds: [moveToNewFileAction.kind], + getAvailableActions: function getRefactorActionsToMoveToNewFile(context) { + var statements = getStatementsToMove(context); + if (context.preferences.allowTextChangesInNewFiles && statements) { + return [{ name: refactorName, description, actions: [moveToNewFileAction] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName, + description, + actions: [__assign(__assign({}, moveToNewFileAction), { notApplicableReason: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Selection_is_not_a_valid_statement_or_statements) })] + }]; + } + return ts6.emptyArray; + }, + getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName) { + ts6.Debug.assert(actionName === refactorName, "Wrong refactor invoked"); + var statements = ts6.Debug.checkDefined(getStatementsToMove(context)); + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(context.file, context.program, statements, t, context.host, context.preferences); + }); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + }); + function getRangeToMove(context) { + var file = context.file; + var range2 = ts6.createTextRangeFromSpan(ts6.getRefactorContextSpan(context)); + var statements = file.statements; + var startNodeIndex = ts6.findIndex(statements, function(s) { + return s.end > range2.pos; + }); + if (startNodeIndex === -1) + return void 0; + var startStatement = statements[startNodeIndex]; + if (ts6.isNamedDeclaration(startStatement) && startStatement.name && ts6.rangeContainsRange(startStatement.name, range2)) { + return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] }; + } + if (range2.pos > startStatement.getStart(file)) + return void 0; + var afterEndNodeIndex = ts6.findIndex(statements, function(s) { + return s.end > range2.end; + }, startNodeIndex); + if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range2.end)) + return void 0; + return { + toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex), + afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] + }; + } + function doChange(oldFile, program, toMove, changes, host, preferences) { + var checker = program.getTypeChecker(); + var usage = getUsageInfo(oldFile, toMove.all, checker); + var currentDirectory = ts6.getDirectoryPath(oldFile.fileName); + var extension = ts6.extensionFromPath(oldFile.fileName); + var newModuleName = makeUniqueModuleName(getNewModuleName(usage.oldFileImportsFromNewFile, usage.movedSymbols), extension, currentDirectory, host); + var newFileNameWithExtension = newModuleName + extension; + changes.createNewFile(oldFile, ts6.combinePaths(currentDirectory, newFileNameWithExtension), getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences)); + addNewFileToTsconfig(program, changes, oldFile.fileName, newFileNameWithExtension, ts6.hostGetCanonicalFileName(host)); + } + function getStatementsToMove(context) { + var rangeToMove = getRangeToMove(context); + if (rangeToMove === void 0) + return void 0; + var all = []; + var ranges = []; + var toMove = rangeToMove.toMove, afterLast = rangeToMove.afterLast; + ts6.getRangesWhere(toMove, isAllowedStatementToMove, function(start, afterEndIndex) { + for (var i = start; i < afterEndIndex; i++) + all.push(toMove[i]); + ranges.push({ first: toMove[start], afterLast }); + }); + return all.length === 0 ? void 0 : { all, ranges }; + } + function isAllowedStatementToMove(statement) { + return !isPureImport(statement) && !ts6.isPrologueDirective(statement); + } + function isPureImport(node) { + switch (node.kind) { + case 269: + return true; + case 268: + return !ts6.hasSyntacticModifier( + node, + 1 + /* ModifierFlags.Export */ + ); + case 240: + return node.declarationList.declarations.every(function(d) { + return !!d.initializer && ts6.isRequireCall( + d.initializer, + /*checkArgumentIsStringLiteralLike*/ + true + ); + }); + default: + return false; + } + } + function addNewFileToTsconfig(program, changes, oldFileName, newFileNameWithExtension, getCanonicalFileName) { + var cfg = program.getCompilerOptions().configFile; + if (!cfg) + return; + var newFileAbsolutePath = ts6.normalizePath(ts6.combinePaths(oldFileName, "..", newFileNameWithExtension)); + var newFilePath = ts6.getRelativePathFromFile(cfg.fileName, newFileAbsolutePath, getCanonicalFileName); + var cfgObject = cfg.statements[0] && ts6.tryCast(cfg.statements[0].expression, ts6.isObjectLiteralExpression); + var filesProp = cfgObject && ts6.find(cfgObject.properties, function(prop) { + return ts6.isPropertyAssignment(prop) && ts6.isStringLiteral(prop.name) && prop.name.text === "files"; + }); + if (filesProp && ts6.isArrayLiteralExpression(filesProp.initializer)) { + changes.insertNodeInListAfter(cfg, ts6.last(filesProp.initializer.elements), ts6.factory.createStringLiteral(newFilePath), filesProp.initializer.elements); + } + } + function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { + var checker = program.getTypeChecker(); + var prologueDirectives = ts6.takeWhile(oldFile.statements, ts6.isPrologueDirective); + if (oldFile.externalModuleIndicator === void 0 && oldFile.commonJsModuleIndicator === void 0 && usage.oldImportsNeededByNewFile.size() === 0) { + deleteMovedStatements(oldFile, toMove.ranges, changes); + return __spreadArray(__spreadArray([], prologueDirectives, true), toMove.all, true); + } + var useEsModuleSyntax = !!oldFile.externalModuleIndicator; + var quotePreference = ts6.getQuotePreference(oldFile, preferences); + var importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEsModuleSyntax, quotePreference); + if (importsFromNewFile) { + ts6.insertImports( + changes, + oldFile, + importsFromNewFile, + /*blankLineBetween*/ + true + ); + } + deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker); + deleteMovedStatements(oldFile, toMove.ranges, changes); + updateImportsInOtherFiles(changes, program, oldFile, usage.movedSymbols, newModuleName); + var imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEsModuleSyntax, quotePreference); + var body = addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEsModuleSyntax); + if (imports.length && body.length) { + return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], prologueDirectives, true), imports, true), [ + 4 + /* SyntaxKind.NewLineTrivia */ + ], false), body, true); + } + return __spreadArray(__spreadArray(__spreadArray([], prologueDirectives, true), imports, true), body, true); + } + function deleteMovedStatements(sourceFile, moved, changes) { + for (var _i = 0, moved_1 = moved; _i < moved_1.length; _i++) { + var _a = moved_1[_i], first_1 = _a.first, afterLast = _a.afterLast; + changes.deleteNodeRangeExcludingEnd(sourceFile, first_1, afterLast); + } + } + function deleteUnusedOldImports(oldFile, toMove, changes, toDelete, checker) { + for (var _i = 0, _a = oldFile.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (ts6.contains(toMove, statement)) + continue; + forEachImportInStatement(statement, function(i) { + return deleteUnusedImports(oldFile, i, changes, function(name) { + return toDelete.has(checker.getSymbolAtLocation(name)); + }); + }); + } + } + function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) { + var checker = program.getTypeChecker(); + var _loop_17 = function(sourceFile2) { + if (sourceFile2 === oldFile) + return "continue"; + var _loop_18 = function(statement2) { + forEachImportInStatement(statement2, function(importNode) { + if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol) + return; + var shouldMove = function(name) { + var symbol = ts6.isBindingElement(name.parent) ? ts6.getPropertySymbolFromBindingElement(checker, name.parent) : ts6.skipAlias(checker.getSymbolAtLocation(name), checker); + return !!symbol && movedSymbols.has(symbol); + }; + deleteUnusedImports(sourceFile2, importNode, changes, shouldMove); + var newModuleSpecifier = ts6.combinePaths(ts6.getDirectoryPath(moduleSpecifierFromImport(importNode).text), newModuleName); + var newImportDeclaration = filterImport(importNode, ts6.factory.createStringLiteral(newModuleSpecifier), shouldMove); + if (newImportDeclaration) + changes.insertNodeAfter(sourceFile2, statement2, newImportDeclaration); + var ns = getNamespaceLikeImport(importNode); + if (ns) + updateNamespaceLikeImport(changes, sourceFile2, checker, movedSymbols, newModuleName, newModuleSpecifier, ns, importNode); + }); + }; + for (var _b = 0, _c = sourceFile2.statements; _b < _c.length; _b++) { + var statement = _c[_b]; + _loop_18(statement); + } + }; + for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { + var sourceFile = _a[_i]; + _loop_17(sourceFile); + } + } + function getNamespaceLikeImport(node) { + switch (node.kind) { + case 269: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 ? node.importClause.namedBindings.name : void 0; + case 268: + return node.name; + case 257: + return ts6.tryCast(node.name, ts6.isIdentifier); + default: + return ts6.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); + } + } + function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) { + var preferredNewNamespaceName = ts6.codefix.moduleSpecifierToValidIdentifier( + newModuleName, + 99 + /* ScriptTarget.ESNext */ + ); + var needUniqueName = false; + var toChange = []; + ts6.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function(ref2) { + if (!ts6.isPropertyAccessExpression(ref2.parent)) + return; + needUniqueName = needUniqueName || !!checker.resolveName( + preferredNewNamespaceName, + ref2, + 67108863, + /*excludeGlobals*/ + true + ); + if (movedSymbols.has(checker.getSymbolAtLocation(ref2.parent.name))) { + toChange.push(ref2); + } + }); + if (toChange.length) { + var newNamespaceName = needUniqueName ? ts6.getUniqueName(preferredNewNamespaceName, sourceFile) : preferredNewNamespaceName; + for (var _i = 0, toChange_1 = toChange; _i < toChange_1.length; _i++) { + var ref = toChange_1[_i]; + changes.replaceNode(sourceFile, ref, ts6.factory.createIdentifier(newNamespaceName)); + } + changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, newModuleName, newModuleSpecifier)); + } + } + function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier) { + var newNamespaceId = ts6.factory.createIdentifier(newNamespaceName); + var newModuleString = ts6.factory.createStringLiteral(newModuleSpecifier); + switch (node.kind) { + case 269: + return ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + /*name*/ + void 0, + ts6.factory.createNamespaceImport(newNamespaceId) + ), + newModuleString, + /*assertClause*/ + void 0 + ); + case 268: + return ts6.factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + newNamespaceId, + ts6.factory.createExternalModuleReference(newModuleString) + ); + case 257: + return ts6.factory.createVariableDeclaration( + newNamespaceId, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + createRequireCall(newModuleString) + ); + default: + return ts6.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); + } + } + function moduleSpecifierFromImport(i) { + return i.kind === 269 ? i.moduleSpecifier : i.kind === 268 ? i.moduleReference.expression : i.initializer.arguments[0]; + } + function forEachImportInStatement(statement, cb) { + if (ts6.isImportDeclaration(statement)) { + if (ts6.isStringLiteral(statement.moduleSpecifier)) + cb(statement); + } else if (ts6.isImportEqualsDeclaration(statement)) { + if (ts6.isExternalModuleReference(statement.moduleReference) && ts6.isStringLiteralLike(statement.moduleReference.expression)) { + cb(statement); + } + } else if (ts6.isVariableStatement(statement)) { + for (var _i = 0, _a = statement.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.initializer && ts6.isRequireCall( + decl.initializer, + /*checkArgumentIsStringLiteralLike*/ + true + )) { + cb(decl); + } + } + } + } + function createOldFileImportsFromNewFile(newFileNeedExport, newFileNameWithExtension, useEs6Imports, quotePreference) { + var defaultImport; + var imports = []; + newFileNeedExport.forEach(function(symbol) { + if (symbol.escapedName === "default") { + defaultImport = ts6.factory.createIdentifier(ts6.symbolNameNoDefault(symbol)); + } else { + imports.push(symbol.name); + } + }); + return makeImportOrRequire(defaultImport, imports, newFileNameWithExtension, useEs6Imports, quotePreference); + } + function makeImportOrRequire(defaultImport, imports, path, useEs6Imports, quotePreference) { + path = ts6.ensurePathIsNonModuleName(path); + if (useEs6Imports) { + var specifiers = imports.map(function(i) { + return ts6.factory.createImportSpecifier( + /*isTypeOnly*/ + false, + /*propertyName*/ + void 0, + ts6.factory.createIdentifier(i) + ); + }); + return ts6.makeImportIfNecessary(defaultImport, specifiers, path, quotePreference); + } else { + ts6.Debug.assert(!defaultImport, "No default import should exist"); + var bindingElements = imports.map(function(i) { + return ts6.factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + i + ); + }); + return bindingElements.length ? makeVariableStatement( + ts6.factory.createObjectBindingPattern(bindingElements), + /*type*/ + void 0, + createRequireCall(ts6.factory.createStringLiteral(path)) + ) : void 0; + } + } + function makeVariableStatement(name, type, initializer, flags) { + if (flags === void 0) { + flags = 2; + } + return ts6.factory.createVariableStatement( + /*modifiers*/ + void 0, + ts6.factory.createVariableDeclarationList([ts6.factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + type, + initializer + )], flags) + ); + } + function createRequireCall(moduleSpecifier) { + return ts6.factory.createCallExpression( + ts6.factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + [moduleSpecifier] + ); + } + function addExports(sourceFile, toMove, needExport, useEs6Exports) { + return ts6.flatMap(toMove, function(statement) { + if (isTopLevelDeclarationStatement(statement) && !isExported(sourceFile, statement, useEs6Exports) && forEachTopLevelDeclaration(statement, function(d) { + return needExport.has(ts6.Debug.checkDefined(d.symbol)); + })) { + var exports2 = addExport(statement, useEs6Exports); + if (exports2) + return exports2; + } + return statement; + }); + } + function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { + switch (importDecl.kind) { + case 269: + deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); + break; + case 268: + if (isUnused(importDecl.name)) { + changes.delete(sourceFile, importDecl); + } + break; + case 257: + deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); + break; + default: + ts6.Debug.assertNever(importDecl, "Unexpected import decl kind ".concat(importDecl.kind)); + } + } + function deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused) { + if (!importDecl.importClause) + return; + var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; + var defaultUnused = !name || isUnused(name); + var namedBindingsUnused = !namedBindings || (namedBindings.kind === 271 ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function(e) { + return isUnused(e.name); + })); + if (defaultUnused && namedBindingsUnused) { + changes.delete(sourceFile, importDecl); + } else { + if (name && defaultUnused) { + changes.delete(sourceFile, name); + } + if (namedBindings) { + if (namedBindingsUnused) { + changes.replaceNode(sourceFile, importDecl.importClause, ts6.factory.updateImportClause( + importDecl.importClause, + importDecl.importClause.isTypeOnly, + name, + /*namedBindings*/ + void 0 + )); + } else if (namedBindings.kind === 272) { + for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (isUnused(element.name)) + changes.delete(sourceFile, element); + } + } + } + } + } + function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) { + var name = varDecl.name; + switch (name.kind) { + case 79: + if (isUnused(name)) { + if (varDecl.initializer && ts6.isRequireCall( + varDecl.initializer, + /*requireStringLiteralLikeArgument*/ + true + )) { + changes.delete(sourceFile, ts6.isVariableDeclarationList(varDecl.parent) && ts6.length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl); + } else { + changes.delete(sourceFile, name); + } + } + break; + case 204: + break; + case 203: + if (name.elements.every(function(e) { + return ts6.isIdentifier(e.name) && isUnused(e.name); + })) { + changes.delete(sourceFile, ts6.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); + } else { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (ts6.isIdentifier(element.name) && isUnused(element.name)) { + changes.delete(sourceFile, element.name); + } + } + } + break; + } + } + function getNewFileImportsAndAddExportInOldFile(oldFile, importsToCopy, newFileImportsFromOldFile, changes, checker, useEsModuleSyntax, quotePreference) { + var copiedOldImports = []; + for (var _i = 0, _a = oldFile.statements; _i < _a.length; _i++) { + var oldStatement = _a[_i]; + forEachImportInStatement(oldStatement, function(i) { + ts6.append(copiedOldImports, filterImport(i, moduleSpecifierFromImport(i), function(name) { + return importsToCopy.has(checker.getSymbolAtLocation(name)); + })); + }); + } + var oldFileDefault; + var oldFileNamedImports = []; + var markSeenTop = ts6.nodeSeenTracker(); + newFileImportsFromOldFile.forEach(function(symbol) { + if (!symbol.declarations) { + return; + } + for (var _i2 = 0, _a2 = symbol.declarations; _i2 < _a2.length; _i2++) { + var decl = _a2[_i2]; + if (!isTopLevelDeclaration(decl)) + continue; + var name = nameOfTopLevelDeclaration(decl); + if (!name) + continue; + var top = getTopLevelDeclarationStatement(decl); + if (markSeenTop(top)) { + addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); + } + if (ts6.hasSyntacticModifier( + decl, + 1024 + /* ModifierFlags.Default */ + )) { + oldFileDefault = name; + } else { + oldFileNamedImports.push(name.text); + } + } + }); + ts6.append(copiedOldImports, makeImportOrRequire(oldFileDefault, oldFileNamedImports, ts6.removeFileExtension(ts6.getBaseFileName(oldFile.fileName)), useEsModuleSyntax, quotePreference)); + return copiedOldImports; + } + function makeUniqueModuleName(moduleName, extension, inDirectory, host) { + var newModuleName = moduleName; + for (var i = 1; ; i++) { + var name = ts6.combinePaths(inDirectory, newModuleName + extension); + if (!host.fileExists(name)) + return newModuleName; + newModuleName = "".concat(moduleName, ".").concat(i); + } + } + function getNewModuleName(importsFromNewFile, movedSymbols) { + return importsFromNewFile.forEachEntry(ts6.symbolNameNoDefault) || movedSymbols.forEachEntry(ts6.symbolNameNoDefault) || "newFile"; + } + function getUsageInfo(oldFile, toMove, checker) { + var movedSymbols = new SymbolSet(); + var oldImportsNeededByNewFile = new SymbolSet(); + var newFileImportsFromOldFile = new SymbolSet(); + var containsJsx = ts6.find(toMove, function(statement2) { + return !!(statement2.transformFlags & 2); + }); + var jsxNamespaceSymbol = getJsxNamespaceSymbol(containsJsx); + if (jsxNamespaceSymbol) { + oldImportsNeededByNewFile.add(jsxNamespaceSymbol); + } + for (var _i = 0, toMove_1 = toMove; _i < toMove_1.length; _i++) { + var statement = toMove_1[_i]; + forEachTopLevelDeclaration(statement, function(decl) { + movedSymbols.add(ts6.Debug.checkDefined(ts6.isExpressionStatement(decl) ? checker.getSymbolAtLocation(decl.expression.left) : decl.symbol, "Need a symbol here")); + }); + } + for (var _a = 0, toMove_2 = toMove; _a < toMove_2.length; _a++) { + var statement = toMove_2[_a]; + forEachReference(statement, checker, function(symbol) { + if (!symbol.declarations) + return; + for (var _i2 = 0, _a2 = symbol.declarations; _i2 < _a2.length; _i2++) { + var decl = _a2[_i2]; + if (isInImport(decl)) { + oldImportsNeededByNewFile.add(symbol); + } else if (isTopLevelDeclaration(decl) && sourceFileOfTopLevelDeclaration(decl) === oldFile && !movedSymbols.has(symbol)) { + newFileImportsFromOldFile.add(symbol); + } + } + }); + } + var unusedImportsFromOldFile = oldImportsNeededByNewFile.clone(); + var oldFileImportsFromNewFile = new SymbolSet(); + for (var _b = 0, _c = oldFile.statements; _b < _c.length; _b++) { + var statement = _c[_b]; + if (ts6.contains(toMove, statement)) + continue; + if (jsxNamespaceSymbol && !!(statement.transformFlags & 2)) { + unusedImportsFromOldFile.delete(jsxNamespaceSymbol); + } + forEachReference(statement, checker, function(symbol) { + if (movedSymbols.has(symbol)) + oldFileImportsFromNewFile.add(symbol); + unusedImportsFromOldFile.delete(symbol); + }); + } + return { movedSymbols, newFileImportsFromOldFile, oldFileImportsFromNewFile, oldImportsNeededByNewFile, unusedImportsFromOldFile }; + function getJsxNamespaceSymbol(containsJsx2) { + if (containsJsx2 === void 0) { + return void 0; + } + var jsxNamespace = checker.getJsxNamespace(containsJsx2); + var jsxNamespaceSymbol2 = checker.resolveName( + jsxNamespace, + containsJsx2, + 1920, + /*excludeGlobals*/ + true + ); + return !!jsxNamespaceSymbol2 && ts6.some(jsxNamespaceSymbol2.declarations, isInImport) ? jsxNamespaceSymbol2 : void 0; + } + } + function isInImport(decl) { + switch (decl.kind) { + case 268: + case 273: + case 270: + case 271: + return true; + case 257: + return isVariableDeclarationInImport(decl); + case 205: + return ts6.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); + default: + return false; + } + } + function isVariableDeclarationInImport(decl) { + return ts6.isSourceFile(decl.parent.parent.parent) && !!decl.initializer && ts6.isRequireCall( + decl.initializer, + /*checkArgumentIsStringLiteralLike*/ + true + ); + } + function filterImport(i, moduleSpecifier, keep) { + switch (i.kind) { + case 269: { + var clause = i.importClause; + if (!clause) + return void 0; + var defaultImport = clause.name && keep(clause.name) ? clause.name : void 0; + var namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); + return defaultImport || namedBindings ? ts6.factory.createImportDeclaration( + /*modifiers*/ + void 0, + ts6.factory.createImportClause( + /*isTypeOnly*/ + false, + defaultImport, + namedBindings + ), + moduleSpecifier, + /*assertClause*/ + void 0 + ) : void 0; + } + case 268: + return keep(i.name) ? i : void 0; + case 257: { + var name = filterBindingName(i.name, keep); + return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : void 0; + } + default: + return ts6.Debug.assertNever(i, "Unexpected import kind ".concat(i.kind)); + } + } + function filterNamedBindings(namedBindings, keep) { + if (namedBindings.kind === 271) { + return keep(namedBindings.name) ? namedBindings : void 0; + } else { + var newElements = namedBindings.elements.filter(function(e) { + return keep(e.name); + }); + return newElements.length ? ts6.factory.createNamedImports(newElements) : void 0; + } + } + function filterBindingName(name, keep) { + switch (name.kind) { + case 79: + return keep(name) ? name : void 0; + case 204: + return name; + case 203: { + var newElements = name.elements.filter(function(prop) { + return prop.propertyName || !ts6.isIdentifier(prop.name) || keep(prop.name); + }); + return newElements.length ? ts6.factory.createObjectBindingPattern(newElements) : void 0; + } + } + } + function forEachReference(node, checker, onReference) { + node.forEachChild(function cb(node2) { + if (ts6.isIdentifier(node2) && !ts6.isDeclarationName(node2)) { + var sym = checker.getSymbolAtLocation(node2); + if (sym) + onReference(sym); + } else { + node2.forEachChild(cb); + } + }); + } + var SymbolSet = ( + /** @class */ + function() { + function SymbolSet2() { + this.map = new ts6.Map(); + } + SymbolSet2.prototype.add = function(symbol) { + this.map.set(String(ts6.getSymbolId(symbol)), symbol); + }; + SymbolSet2.prototype.has = function(symbol) { + return this.map.has(String(ts6.getSymbolId(symbol))); + }; + SymbolSet2.prototype.delete = function(symbol) { + this.map.delete(String(ts6.getSymbolId(symbol))); + }; + SymbolSet2.prototype.forEach = function(cb) { + this.map.forEach(cb); + }; + SymbolSet2.prototype.forEachEntry = function(cb) { + return ts6.forEachEntry(this.map, cb); + }; + SymbolSet2.prototype.clone = function() { + var clone = new SymbolSet2(); + ts6.copyEntries(this.map, clone.map); + return clone; + }; + SymbolSet2.prototype.size = function() { + return this.map.size; + }; + return SymbolSet2; + }() + ); + function isTopLevelDeclaration(node) { + return isNonVariableTopLevelDeclaration(node) && ts6.isSourceFile(node.parent) || ts6.isVariableDeclaration(node) && ts6.isSourceFile(node.parent.parent.parent); + } + function sourceFileOfTopLevelDeclaration(node) { + return ts6.isVariableDeclaration(node) ? node.parent.parent.parent : node.parent; + } + function isTopLevelDeclarationStatement(node) { + ts6.Debug.assert(ts6.isSourceFile(node.parent), "Node parent should be a SourceFile"); + return isNonVariableTopLevelDeclaration(node) || ts6.isVariableStatement(node); + } + function isNonVariableTopLevelDeclaration(node) { + switch (node.kind) { + case 259: + case 260: + case 264: + case 263: + case 262: + case 261: + case 268: + return true; + default: + return false; + } + } + function forEachTopLevelDeclaration(statement, cb) { + switch (statement.kind) { + case 259: + case 260: + case 264: + case 263: + case 262: + case 261: + case 268: + return cb(statement); + case 240: + return ts6.firstDefined(statement.declarationList.declarations, function(decl) { + return forEachTopLevelDeclarationInBindingName(decl.name, cb); + }); + case 241: { + var expression = statement.expression; + return ts6.isBinaryExpression(expression) && ts6.getAssignmentDeclarationKind(expression) === 1 ? cb(statement) : void 0; + } + } + } + function forEachTopLevelDeclarationInBindingName(name, cb) { + switch (name.kind) { + case 79: + return cb(ts6.cast(name.parent, function(x) { + return ts6.isVariableDeclaration(x) || ts6.isBindingElement(x); + })); + case 204: + case 203: + return ts6.firstDefined(name.elements, function(em) { + return ts6.isOmittedExpression(em) ? void 0 : forEachTopLevelDeclarationInBindingName(em.name, cb); + }); + default: + return ts6.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); + } + } + function nameOfTopLevelDeclaration(d) { + return ts6.isExpressionStatement(d) ? ts6.tryCast(d.expression.left.name, ts6.isIdentifier) : ts6.tryCast(d.name, ts6.isIdentifier); + } + function getTopLevelDeclarationStatement(d) { + switch (d.kind) { + case 257: + return d.parent.parent; + case 205: + return getTopLevelDeclarationStatement(ts6.cast(d.parent.parent, function(p) { + return ts6.isVariableDeclaration(p) || ts6.isBindingElement(p); + })); + default: + return d; + } + } + function addExportToChanges(sourceFile, decl, name, changes, useEs6Exports) { + if (isExported(sourceFile, decl, useEs6Exports, name)) + return; + if (useEs6Exports) { + if (!ts6.isExpressionStatement(decl)) + changes.insertExportModifier(sourceFile, decl); + } else { + var names = getNamesToExportInCommonJS(decl); + if (names.length !== 0) + changes.insertNodesAfter(sourceFile, decl, names.map(createExportAssignment)); + } + } + function isExported(sourceFile, decl, useEs6Exports, name) { + var _a; + if (useEs6Exports) { + return !ts6.isExpressionStatement(decl) && ts6.hasSyntacticModifier( + decl, + 1 + /* ModifierFlags.Export */ + ) || !!(name && ((_a = sourceFile.symbol.exports) === null || _a === void 0 ? void 0 : _a.has(name.escapedText))); + } + return !!sourceFile.symbol && !!sourceFile.symbol.exports && getNamesToExportInCommonJS(decl).some(function(name2) { + return sourceFile.symbol.exports.has(ts6.escapeLeadingUnderscores(name2)); + }); + } + function addExport(decl, useEs6Exports) { + return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); + } + function addEs6Export(d) { + var modifiers = ts6.canHaveModifiers(d) ? ts6.concatenate([ts6.factory.createModifier( + 93 + /* SyntaxKind.ExportKeyword */ + )], ts6.getModifiers(d)) : void 0; + switch (d.kind) { + case 259: + return ts6.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); + case 260: + var decorators = ts6.canHaveDecorators(d) ? ts6.getDecorators(d) : void 0; + return ts6.factory.updateClassDeclaration(d, ts6.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); + case 240: + return ts6.factory.updateVariableStatement(d, modifiers, d.declarationList); + case 264: + return ts6.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); + case 263: + return ts6.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); + case 262: + return ts6.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); + case 261: + return ts6.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); + case 268: + return ts6.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); + case 241: + return ts6.Debug.fail(); + default: + return ts6.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); + } + } + function addCommonjsExport(decl) { + return __spreadArray([decl], getNamesToExportInCommonJS(decl).map(createExportAssignment), true); + } + function getNamesToExportInCommonJS(decl) { + switch (decl.kind) { + case 259: + case 260: + return [decl.name.text]; + case 240: + return ts6.mapDefined(decl.declarationList.declarations, function(d) { + return ts6.isIdentifier(d.name) ? d.name.text : void 0; + }); + case 264: + case 263: + case 262: + case 261: + case 268: + return ts6.emptyArray; + case 241: + return ts6.Debug.fail("Can't export an ExpressionStatement"); + default: + return ts6.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); + } + } + function createExportAssignment(name) { + return ts6.factory.createExpressionStatement(ts6.factory.createBinaryExpression(ts6.factory.createPropertyAccessExpression(ts6.factory.createIdentifier("exports"), ts6.factory.createIdentifier(name)), 63, ts6.factory.createIdentifier(name))); + } + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var addOrRemoveBracesToArrowFunction; + (function(addOrRemoveBracesToArrowFunction2) { + var refactorName = "Add or remove braces in an arrow function"; + var refactorDescription = ts6.Diagnostics.Add_or_remove_braces_in_an_arrow_function.message; + var addBracesAction = { + name: "Add braces to arrow function", + description: ts6.Diagnostics.Add_braces_to_arrow_function.message, + kind: "refactor.rewrite.arrow.braces.add" + }; + var removeBracesAction = { + name: "Remove braces from arrow function", + description: ts6.Diagnostics.Remove_braces_from_arrow_function.message, + kind: "refactor.rewrite.arrow.braces.remove" + }; + refactor2.registerRefactor(refactorName, { + kinds: [removeBracesAction.kind], + getEditsForAction: getRefactorEditsToRemoveFunctionBraces, + getAvailableActions: getRefactorActionsToRemoveFunctionBraces + }); + function getRefactorActionsToRemoveFunctionBraces(context) { + var file = context.file, startPosition = context.startPosition, triggerReason = context.triggerReason; + var info = getConvertibleArrowFunctionAtPosition(file, startPosition, triggerReason === "invoked"); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + return [{ + name: refactorName, + description: refactorDescription, + actions: [ + info.addBraces ? addBracesAction : removeBracesAction + ] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName, + description: refactorDescription, + actions: [ + __assign(__assign({}, addBracesAction), { notApplicableReason: info.error }), + __assign(__assign({}, removeBracesAction), { notApplicableReason: info.error }) + ] + }]; + } + return ts6.emptyArray; + } + function getRefactorEditsToRemoveFunctionBraces(context, actionName) { + var file = context.file, startPosition = context.startPosition; + var info = getConvertibleArrowFunctionAtPosition(file, startPosition); + ts6.Debug.assert(info && !refactor2.isRefactorErrorInfo(info), "Expected applicable refactor info"); + var expression = info.expression, returnStatement = info.returnStatement, func = info.func; + var body; + if (actionName === addBracesAction.name) { + var returnStatement_1 = ts6.factory.createReturnStatement(expression); + body = ts6.factory.createBlock( + [returnStatement_1], + /* multiLine */ + true + ); + ts6.copyLeadingComments( + expression, + returnStatement_1, + file, + 3, + /* hasTrailingNewLine */ + true + ); + } else if (actionName === removeBracesAction.name && returnStatement) { + var actualExpression = expression || ts6.factory.createVoidZero(); + body = ts6.needsParentheses(actualExpression) ? ts6.factory.createParenthesizedExpression(actualExpression) : actualExpression; + ts6.copyTrailingAsLeadingComments( + returnStatement, + body, + file, + 3, + /* hasTrailingNewLine */ + false + ); + ts6.copyLeadingComments( + returnStatement, + body, + file, + 3, + /* hasTrailingNewLine */ + false + ); + ts6.copyTrailingComments( + returnStatement, + body, + file, + 3, + /* hasTrailingNewLine */ + false + ); + } else { + ts6.Debug.fail("invalid action"); + } + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + t.replaceNode(file, func.body, body); + }); + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunctionBodies, kind) { + if (considerFunctionBodies === void 0) { + considerFunctionBodies = true; + } + var node = ts6.getTokenAtPosition(file, startPosition); + var func = ts6.getContainingFunction(node); + if (!func) { + return { + error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_find_a_containing_arrow_function) + }; + } + if (!ts6.isArrowFunction(func)) { + return { + error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Containing_function_is_not_an_arrow_function) + }; + } + if (!ts6.rangeContainsRange(func, node) || ts6.rangeContainsRange(func.body, node) && !considerFunctionBodies) { + return void 0; + } + if (refactor2.refactorKindBeginsWith(addBracesAction.kind, kind) && ts6.isExpression(func.body)) { + return { func, addBraces: true, expression: func.body }; + } else if (refactor2.refactorKindBeginsWith(removeBracesAction.kind, kind) && ts6.isBlock(func.body) && func.body.statements.length === 1) { + var firstStatement = ts6.first(func.body.statements); + if (ts6.isReturnStatement(firstStatement)) { + return { func, addBraces: false, expression: firstStatement.expression, returnStatement: firstStatement }; + } + } + return void 0; + } + })(addOrRemoveBracesToArrowFunction = refactor2.addOrRemoveBracesToArrowFunction || (refactor2.addOrRemoveBracesToArrowFunction = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var convertParamsToDestructuredObject; + (function(convertParamsToDestructuredObject2) { + var refactorName = "Convert parameters to destructured object"; + var minimumParameterLength = 1; + var refactorDescription = ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_parameters_to_destructured_object); + var toDestructuredAction = { + name: refactorName, + description: refactorDescription, + kind: "refactor.rewrite.parameters.toDestructured" + }; + refactor2.registerRefactor(refactorName, { + kinds: [toDestructuredAction.kind], + getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject, + getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject + }); + function getRefactorActionsToConvertParametersToDestructuredObject(context) { + var file = context.file, startPosition = context.startPosition; + var isJSFile = ts6.isSourceFileJS(file); + if (isJSFile) + return ts6.emptyArray; + var functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, context.program.getTypeChecker()); + if (!functionDeclaration) + return ts6.emptyArray; + return [{ + name: refactorName, + description: refactorDescription, + actions: [toDestructuredAction] + }]; + } + function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName) { + ts6.Debug.assert(actionName === refactorName, "Unexpected action name"); + var file = context.file, startPosition = context.startPosition, program = context.program, cancellationToken = context.cancellationToken, host = context.host; + var functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker()); + if (!functionDeclaration || !cancellationToken) + return void 0; + var groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); + if (groupedReferences.valid) { + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(file, program, host, t, functionDeclaration, groupedReferences); + }); + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + return { edits: [] }; + } + function doChange(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { + var signature = groupedReferences.signature; + var newFunctionDeclarationParams = ts6.map(createNewParameters(functionDeclaration, program, host), function(param) { + return ts6.getSynthesizedDeepClone(param); + }); + if (signature) { + var newSignatureParams = ts6.map(createNewParameters(signature, program, host), function(param) { + return ts6.getSynthesizedDeepClone(param); + }); + replaceParameters(signature, newSignatureParams); + } + replaceParameters(functionDeclaration, newFunctionDeclarationParams); + var functionCalls = ts6.sortAndDeduplicate( + groupedReferences.functionCalls, + /*comparer*/ + function(a, b) { + return ts6.compareValues(a.pos, b.pos); + } + ); + for (var _i = 0, functionCalls_1 = functionCalls; _i < functionCalls_1.length; _i++) { + var call = functionCalls_1[_i]; + if (call.arguments && call.arguments.length) { + var newArgument = ts6.getSynthesizedDeepClone( + createNewArgument(functionDeclaration, call.arguments), + /*includeTrivia*/ + true + ); + changes.replaceNodeRange(ts6.getSourceFileOfNode(call), ts6.first(call.arguments), ts6.last(call.arguments), newArgument, { leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.IncludeAll, trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Include }); + } + } + function replaceParameters(declarationOrSignature, parameterDeclarations) { + changes.replaceNodeRangeWithNodes(sourceFile, ts6.first(declarationOrSignature.parameters), ts6.last(declarationOrSignature.parameters), parameterDeclarations, { + joiner: ", ", + // indentation is set to 0 because otherwise the object parameter will be indented if there is a `this` parameter + indentation: 0, + leadingTriviaOption: ts6.textChanges.LeadingTriviaOption.IncludeAll, + trailingTriviaOption: ts6.textChanges.TrailingTriviaOption.Include + }); + } + } + function getGroupedReferences(functionDeclaration, program, cancellationToken) { + var functionNames = getFunctionNames(functionDeclaration); + var classNames = ts6.isConstructorDeclaration(functionDeclaration) ? getClassNames(functionDeclaration) : []; + var names = ts6.deduplicate(__spreadArray(__spreadArray([], functionNames, true), classNames, true), ts6.equateValues); + var checker = program.getTypeChecker(); + var references = ts6.flatMap( + names, + /*mapfn*/ + function(name) { + return ts6.FindAllReferences.getReferenceEntriesForNode(-1, name, program, program.getSourceFiles(), cancellationToken); + } + ); + var groupedReferences = groupReferences(references); + if (!ts6.every( + groupedReferences.declarations, + /*callback*/ + function(decl) { + return ts6.contains(names, decl); + } + )) { + groupedReferences.valid = false; + } + return groupedReferences; + function groupReferences(referenceEntries) { + var classReferences = { accessExpressions: [], typeUsages: [] }; + var groupedReferences2 = { functionCalls: [], declarations: [], classReferences, valid: true }; + var functionSymbols = ts6.map(functionNames, getSymbolTargetAtLocation); + var classSymbols = ts6.map(classNames, getSymbolTargetAtLocation); + var isConstructor = ts6.isConstructorDeclaration(functionDeclaration); + var contextualSymbols = ts6.map(functionNames, function(name) { + return getSymbolForContextualType(name, checker); + }); + for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) { + var entry = referenceEntries_1[_i]; + if (entry.kind === 0) { + groupedReferences2.valid = false; + continue; + } + if (ts6.contains(contextualSymbols, getSymbolTargetAtLocation(entry.node))) { + if (isValidMethodSignature(entry.node.parent)) { + groupedReferences2.signature = entry.node.parent; + continue; + } + var call = entryToFunctionCall(entry); + if (call) { + groupedReferences2.functionCalls.push(call); + continue; + } + } + var contextualSymbol = getSymbolForContextualType(entry.node, checker); + if (contextualSymbol && ts6.contains(contextualSymbols, contextualSymbol)) { + var decl = entryToDeclaration(entry); + if (decl) { + groupedReferences2.declarations.push(decl); + continue; + } + } + if (ts6.contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || ts6.isNewExpressionTarget(entry.node)) { + var importOrExportReference = entryToImportOrExport(entry); + if (importOrExportReference) { + continue; + } + var decl = entryToDeclaration(entry); + if (decl) { + groupedReferences2.declarations.push(decl); + continue; + } + var call = entryToFunctionCall(entry); + if (call) { + groupedReferences2.functionCalls.push(call); + continue; + } + } + if (isConstructor && ts6.contains(classSymbols, getSymbolTargetAtLocation(entry.node))) { + var importOrExportReference = entryToImportOrExport(entry); + if (importOrExportReference) { + continue; + } + var decl = entryToDeclaration(entry); + if (decl) { + groupedReferences2.declarations.push(decl); + continue; + } + var accessExpression = entryToAccessExpression(entry); + if (accessExpression) { + classReferences.accessExpressions.push(accessExpression); + continue; + } + if (ts6.isClassDeclaration(functionDeclaration.parent)) { + var type = entryToType(entry); + if (type) { + classReferences.typeUsages.push(type); + continue; + } + } + } + groupedReferences2.valid = false; + } + return groupedReferences2; + } + function getSymbolTargetAtLocation(node) { + var symbol = checker.getSymbolAtLocation(node); + return symbol && ts6.getSymbolTarget(symbol, checker); + } + } + function getSymbolForContextualType(node, checker) { + var element = ts6.getContainingObjectLiteralElement(node); + if (element) { + var contextualType = checker.getContextualTypeForObjectLiteralElement(element); + var symbol = contextualType === null || contextualType === void 0 ? void 0 : contextualType.getSymbol(); + if (symbol && !(ts6.getCheckFlags(symbol) & 6)) { + return symbol; + } + } + } + function entryToImportOrExport(entry) { + var node = entry.node; + if (ts6.isImportSpecifier(node.parent) || ts6.isImportClause(node.parent) || ts6.isImportEqualsDeclaration(node.parent) || ts6.isNamespaceImport(node.parent)) { + return node; + } + if (ts6.isExportSpecifier(node.parent) || ts6.isExportAssignment(node.parent)) { + return node; + } + return void 0; + } + function entryToDeclaration(entry) { + if (ts6.isDeclaration(entry.node.parent)) { + return entry.node; + } + return void 0; + } + function entryToFunctionCall(entry) { + if (entry.node.parent) { + var functionReference = entry.node; + var parent = functionReference.parent; + switch (parent.kind) { + case 210: + case 211: + var callOrNewExpression = ts6.tryCast(parent, ts6.isCallOrNewExpression); + if (callOrNewExpression && callOrNewExpression.expression === functionReference) { + return callOrNewExpression; + } + break; + case 208: + var propertyAccessExpression = ts6.tryCast(parent, ts6.isPropertyAccessExpression); + if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { + var callOrNewExpression_1 = ts6.tryCast(propertyAccessExpression.parent, ts6.isCallOrNewExpression); + if (callOrNewExpression_1 && callOrNewExpression_1.expression === propertyAccessExpression) { + return callOrNewExpression_1; + } + } + break; + case 209: + var elementAccessExpression = ts6.tryCast(parent, ts6.isElementAccessExpression); + if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { + var callOrNewExpression_2 = ts6.tryCast(elementAccessExpression.parent, ts6.isCallOrNewExpression); + if (callOrNewExpression_2 && callOrNewExpression_2.expression === elementAccessExpression) { + return callOrNewExpression_2; + } + } + break; + } + } + return void 0; + } + function entryToAccessExpression(entry) { + if (entry.node.parent) { + var reference = entry.node; + var parent = reference.parent; + switch (parent.kind) { + case 208: + var propertyAccessExpression = ts6.tryCast(parent, ts6.isPropertyAccessExpression); + if (propertyAccessExpression && propertyAccessExpression.expression === reference) { + return propertyAccessExpression; + } + break; + case 209: + var elementAccessExpression = ts6.tryCast(parent, ts6.isElementAccessExpression); + if (elementAccessExpression && elementAccessExpression.expression === reference) { + return elementAccessExpression; + } + break; + } + } + return void 0; + } + function entryToType(entry) { + var reference = entry.node; + if (ts6.getMeaningFromLocation(reference) === 2 || ts6.isExpressionWithTypeArgumentsInClassExtendsClause(reference.parent)) { + return reference; + } + return void 0; + } + function getFunctionDeclarationAtPosition(file, startPosition, checker) { + var node = ts6.getTouchingToken(file, startPosition); + var functionDeclaration = ts6.getContainingFunctionDeclaration(node); + if (isTopLevelJSDoc(node)) + return void 0; + if (functionDeclaration && isValidFunctionDeclaration(functionDeclaration, checker) && ts6.rangeContainsRange(functionDeclaration, node) && !(functionDeclaration.body && ts6.rangeContainsRange(functionDeclaration.body, node))) + return functionDeclaration; + return void 0; + } + function isTopLevelJSDoc(node) { + var containingJSDoc = ts6.findAncestor(node, ts6.isJSDocNode); + if (containingJSDoc) { + var containingNonJSDoc = ts6.findAncestor(containingJSDoc, function(n) { + return !ts6.isJSDocNode(n); + }); + return !!containingNonJSDoc && ts6.isFunctionLikeDeclaration(containingNonJSDoc); + } + return false; + } + function isValidMethodSignature(node) { + return ts6.isMethodSignature(node) && (ts6.isInterfaceDeclaration(node.parent) || ts6.isTypeLiteralNode(node.parent)); + } + function isValidFunctionDeclaration(functionDeclaration, checker) { + var _a; + if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) + return false; + switch (functionDeclaration.kind) { + case 259: + return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); + case 171: + if (ts6.isObjectLiteralExpression(functionDeclaration.parent)) { + var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); + return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); + } + return isSingleImplementation(functionDeclaration, checker); + case 173: + if (ts6.isClassDeclaration(functionDeclaration.parent)) { + return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); + } else { + return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); + } + case 215: + case 216: + return isValidVariableDeclaration(functionDeclaration.parent); + } + return false; + } + function isSingleImplementation(functionDeclaration, checker) { + return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration); + } + function hasNameOrDefault(functionOrClassDeclaration) { + if (!functionOrClassDeclaration.name) { + var defaultKeyword = ts6.findModifier( + functionOrClassDeclaration, + 88 + /* SyntaxKind.DefaultKeyword */ + ); + return !!defaultKeyword; + } + return true; + } + function isValidParameterNodeArray(parameters, checker) { + return getRefactorableParametersLength(parameters) >= minimumParameterLength && ts6.every( + parameters, + /*callback*/ + function(paramDecl) { + return isValidParameterDeclaration(paramDecl, checker); + } + ); + } + function isValidParameterDeclaration(parameterDeclaration, checker) { + if (ts6.isRestParameter(parameterDeclaration)) { + var type = checker.getTypeAtLocation(parameterDeclaration); + if (!checker.isArrayType(type) && !checker.isTupleType(type)) + return false; + } + return !parameterDeclaration.modifiers && ts6.isIdentifier(parameterDeclaration.name); + } + function isValidVariableDeclaration(node) { + return ts6.isVariableDeclaration(node) && ts6.isVarConst(node) && ts6.isIdentifier(node.name) && !node.type; + } + function hasThisParameter(parameters) { + return parameters.length > 0 && ts6.isThis(parameters[0].name); + } + function getRefactorableParametersLength(parameters) { + if (hasThisParameter(parameters)) { + return parameters.length - 1; + } + return parameters.length; + } + function getRefactorableParameters(parameters) { + if (hasThisParameter(parameters)) { + parameters = ts6.factory.createNodeArray(parameters.slice(1), parameters.hasTrailingComma); + } + return parameters; + } + function createPropertyOrShorthandAssignment(name, initializer) { + if (ts6.isIdentifier(initializer) && ts6.getTextOfIdentifierOrLiteral(initializer) === name) { + return ts6.factory.createShorthandPropertyAssignment(name); + } + return ts6.factory.createPropertyAssignment(name, initializer); + } + function createNewArgument(functionDeclaration, functionArguments) { + var parameters = getRefactorableParameters(functionDeclaration.parameters); + var hasRestParameter = ts6.isRestParameter(ts6.last(parameters)); + var nonRestArguments = hasRestParameter ? functionArguments.slice(0, parameters.length - 1) : functionArguments; + var properties = ts6.map(nonRestArguments, function(arg, i) { + var parameterName = getParameterName(parameters[i]); + var property = createPropertyOrShorthandAssignment(parameterName, arg); + ts6.suppressLeadingAndTrailingTrivia(property.name); + if (ts6.isPropertyAssignment(property)) + ts6.suppressLeadingAndTrailingTrivia(property.initializer); + ts6.copyComments(arg, property); + return property; + }); + if (hasRestParameter && functionArguments.length >= parameters.length) { + var restArguments = functionArguments.slice(parameters.length - 1); + var restProperty = ts6.factory.createPropertyAssignment(getParameterName(ts6.last(parameters)), ts6.factory.createArrayLiteralExpression(restArguments)); + properties.push(restProperty); + } + var objectLiteral = ts6.factory.createObjectLiteralExpression( + properties, + /*multiLine*/ + false + ); + return objectLiteral; + } + function createNewParameters(functionDeclaration, program, host) { + var checker = program.getTypeChecker(); + var refactorableParameters = getRefactorableParameters(functionDeclaration.parameters); + var bindingElements = ts6.map(refactorableParameters, createBindingElementFromParameterDeclaration); + var objectParameterName = ts6.factory.createObjectBindingPattern(bindingElements); + var objectParameterType = createParameterTypeNode(refactorableParameters); + var objectInitializer; + if (ts6.every(refactorableParameters, isOptionalParameter)) { + objectInitializer = ts6.factory.createObjectLiteralExpression(); + } + var objectParameter = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + objectParameterName, + /*questionToken*/ + void 0, + objectParameterType, + objectInitializer + ); + if (hasThisParameter(functionDeclaration.parameters)) { + var thisParameter = functionDeclaration.parameters[0]; + var newThisParameter = ts6.factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + thisParameter.name, + /*questionToken*/ + void 0, + thisParameter.type + ); + ts6.suppressLeadingAndTrailingTrivia(newThisParameter.name); + ts6.copyComments(thisParameter.name, newThisParameter.name); + if (thisParameter.type) { + ts6.suppressLeadingAndTrailingTrivia(newThisParameter.type); + ts6.copyComments(thisParameter.type, newThisParameter.type); + } + return ts6.factory.createNodeArray([newThisParameter, objectParameter]); + } + return ts6.factory.createNodeArray([objectParameter]); + function createBindingElementFromParameterDeclaration(parameterDeclaration) { + var element = ts6.factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + getParameterName(parameterDeclaration), + ts6.isRestParameter(parameterDeclaration) && isOptionalParameter(parameterDeclaration) ? ts6.factory.createArrayLiteralExpression() : parameterDeclaration.initializer + ); + ts6.suppressLeadingAndTrailingTrivia(element); + if (parameterDeclaration.initializer && element.initializer) { + ts6.copyComments(parameterDeclaration.initializer, element.initializer); + } + return element; + } + function createParameterTypeNode(parameters) { + var members = ts6.map(parameters, createPropertySignatureFromParameterDeclaration); + var typeNode = ts6.addEmitFlags( + ts6.factory.createTypeLiteralNode(members), + 1 + /* EmitFlags.SingleLine */ + ); + return typeNode; + } + function createPropertySignatureFromParameterDeclaration(parameterDeclaration) { + var parameterType = parameterDeclaration.type; + if (!parameterType && (parameterDeclaration.initializer || ts6.isRestParameter(parameterDeclaration))) { + parameterType = getTypeNode(parameterDeclaration); + } + var propertySignature = ts6.factory.createPropertySignature( + /*modifiers*/ + void 0, + getParameterName(parameterDeclaration), + isOptionalParameter(parameterDeclaration) ? ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ) : parameterDeclaration.questionToken, + parameterType + ); + ts6.suppressLeadingAndTrailingTrivia(propertySignature); + ts6.copyComments(parameterDeclaration.name, propertySignature.name); + if (parameterDeclaration.type && propertySignature.type) { + ts6.copyComments(parameterDeclaration.type, propertySignature.type); + } + return propertySignature; + } + function getTypeNode(node) { + var type = checker.getTypeAtLocation(node); + return ts6.getTypeNodeIfAccessible(type, node, program, host); + } + function isOptionalParameter(parameterDeclaration) { + if (ts6.isRestParameter(parameterDeclaration)) { + var type = checker.getTypeAtLocation(parameterDeclaration); + return !checker.isTupleType(type); + } + return checker.isOptionalParameter(parameterDeclaration); + } + } + function getParameterName(paramDeclaration) { + return ts6.getTextOfIdentifierOrLiteral(paramDeclaration.name); + } + function getClassNames(constructorDeclaration) { + switch (constructorDeclaration.parent.kind) { + case 260: + var classDeclaration = constructorDeclaration.parent; + if (classDeclaration.name) + return [classDeclaration.name]; + var defaultModifier = ts6.Debug.checkDefined(ts6.findModifier( + classDeclaration, + 88 + /* SyntaxKind.DefaultKeyword */ + ), "Nameless class declaration should be a default export"); + return [defaultModifier]; + case 228: + var classExpression = constructorDeclaration.parent; + var variableDeclaration = constructorDeclaration.parent.parent; + var className = classExpression.name; + if (className) + return [className, variableDeclaration.name]; + return [variableDeclaration.name]; + } + } + function getFunctionNames(functionDeclaration) { + switch (functionDeclaration.kind) { + case 259: + if (functionDeclaration.name) + return [functionDeclaration.name]; + var defaultModifier = ts6.Debug.checkDefined(ts6.findModifier( + functionDeclaration, + 88 + /* SyntaxKind.DefaultKeyword */ + ), "Nameless function declaration should be a default export"); + return [defaultModifier]; + case 171: + return [functionDeclaration.name]; + case 173: + var ctrKeyword = ts6.Debug.checkDefined(ts6.findChildOfKind(functionDeclaration, 135, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228) { + var variableDeclaration = functionDeclaration.parent.parent; + return [variableDeclaration.name, ctrKeyword]; + } + return [ctrKeyword]; + case 216: + return [functionDeclaration.parent.name]; + case 215: + if (functionDeclaration.name) + return [functionDeclaration.name, functionDeclaration.parent.name]; + return [functionDeclaration.parent.name]; + default: + return ts6.Debug.assertNever(functionDeclaration, "Unexpected function declaration kind ".concat(functionDeclaration.kind)); + } + } + })(convertParamsToDestructuredObject = refactor2.convertParamsToDestructuredObject || (refactor2.convertParamsToDestructuredObject = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var convertStringOrTemplateLiteral; + (function(convertStringOrTemplateLiteral2) { + var refactorName = "Convert to template string"; + var refactorDescription = ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_to_template_string); + var convertStringAction = { + name: refactorName, + description: refactorDescription, + kind: "refactor.rewrite.string" + }; + refactor2.registerRefactor(refactorName, { + kinds: [convertStringAction.kind], + getEditsForAction: getRefactorEditsToConvertToTemplateString, + getAvailableActions: getRefactorActionsToConvertToTemplateString + }); + function getRefactorActionsToConvertToTemplateString(context) { + var file = context.file, startPosition = context.startPosition; + var node = getNodeOrParentOfParentheses(file, startPosition); + var maybeBinary = getParentBinaryExpression(node); + var refactorInfo = { name: refactorName, description: refactorDescription, actions: [] }; + if (ts6.isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) { + refactorInfo.actions.push(convertStringAction); + return [refactorInfo]; + } else if (context.preferences.provideRefactorNotApplicableReason) { + refactorInfo.actions.push(__assign(__assign({}, convertStringAction), { notApplicableReason: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Can_only_convert_string_concatenation) })); + return [refactorInfo]; + } + return ts6.emptyArray; + } + function getNodeOrParentOfParentheses(file, startPosition) { + var node = ts6.getTokenAtPosition(file, startPosition); + var nestedBinary = getParentBinaryExpression(node); + var isNonStringBinary = !treeToArray(nestedBinary).isValidConcatenation; + if (isNonStringBinary && ts6.isParenthesizedExpression(nestedBinary.parent) && ts6.isBinaryExpression(nestedBinary.parent.parent)) { + return nestedBinary.parent.parent; + } + return node; + } + function getRefactorEditsToConvertToTemplateString(context, actionName) { + var file = context.file, startPosition = context.startPosition; + var node = getNodeOrParentOfParentheses(file, startPosition); + switch (actionName) { + case refactorDescription: + return { edits: getEditsForToTemplateLiteral(context, node) }; + default: + return ts6.Debug.fail("invalid action"); + } + } + function getEditsForToTemplateLiteral(context, node) { + var maybeBinary = getParentBinaryExpression(node); + var file = context.file; + var templateLiteral = nodesToTemplate(treeToArray(maybeBinary), file); + var trailingCommentRanges = ts6.getTrailingCommentRanges(file.text, maybeBinary.end); + if (trailingCommentRanges) { + var lastComment = trailingCommentRanges[trailingCommentRanges.length - 1]; + var trailingRange_1 = { pos: trailingCommentRanges[0].pos, end: lastComment.end }; + return ts6.textChanges.ChangeTracker.with(context, function(t) { + t.deleteRange(file, trailingRange_1); + t.replaceNode(file, maybeBinary, templateLiteral); + }); + } else { + return ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.replaceNode(file, maybeBinary, templateLiteral); + }); + } + } + function isNotEqualsOperator(node) { + return node.operatorToken.kind !== 63; + } + function getParentBinaryExpression(expr) { + var container = ts6.findAncestor(expr.parent, function(n) { + switch (n.kind) { + case 208: + case 209: + return false; + case 225: + case 223: + return !(ts6.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); + default: + return "quit"; + } + }); + return container || expr; + } + function treeToArray(current) { + var loop = function(current2) { + if (!ts6.isBinaryExpression(current2)) { + return { + nodes: [current2], + operators: [], + validOperators: true, + hasString: ts6.isStringLiteral(current2) || ts6.isNoSubstitutionTemplateLiteral(current2) + }; + } + var _a2 = loop(current2.left), nodes2 = _a2.nodes, operators2 = _a2.operators, leftHasString = _a2.hasString, leftOperatorValid = _a2.validOperators; + if (!(leftHasString || ts6.isStringLiteral(current2.right) || ts6.isTemplateExpression(current2.right))) { + return { nodes: [current2], operators: [], hasString: false, validOperators: true }; + } + var currentOperatorValid = current2.operatorToken.kind === 39; + var validOperators2 = leftOperatorValid && currentOperatorValid; + nodes2.push(current2.right); + operators2.push(current2.operatorToken); + return { nodes: nodes2, operators: operators2, hasString: true, validOperators: validOperators2 }; + }; + var _a = loop(current), nodes = _a.nodes, operators = _a.operators, validOperators = _a.validOperators, hasString = _a.hasString; + return { nodes, operators, isValidConcatenation: validOperators && hasString }; + } + var copyTrailingOperatorComments = function(operators, file) { + return function(index, targetNode) { + if (index < operators.length) { + ts6.copyTrailingComments( + operators[index], + targetNode, + file, + 3, + /* hasTrailingNewLine */ + false + ); + } + }; + }; + var copyCommentFromMultiNode = function(nodes, file, copyOperatorComments) { + return function(indexes, targetNode) { + while (indexes.length > 0) { + var index = indexes.shift(); + ts6.copyTrailingComments( + nodes[index], + targetNode, + file, + 3, + /* hasTrailingNewLine */ + false + ); + copyOperatorComments(index, targetNode); + } + }; + }; + function escapeRawStringForTemplate(s) { + return s.replace(/\\.|[$`]/g, function(m) { + return m[0] === "\\" ? m : "\\" + m; + }); + } + function getRawTextOfTemplate(node) { + var rightShaving = ts6.isTemplateHead(node) || ts6.isTemplateMiddle(node) ? -2 : -1; + return ts6.getTextOfNode(node).slice(1, rightShaving); + } + function concatConsecutiveString(index, nodes) { + var indexes = []; + var text = "", rawText = ""; + while (index < nodes.length) { + var node = nodes[index]; + if (ts6.isStringLiteralLike(node)) { + text += node.text; + rawText += escapeRawStringForTemplate(ts6.getTextOfNode(node).slice(1, -1)); + indexes.push(index); + index++; + } else if (ts6.isTemplateExpression(node)) { + text += node.head.text; + rawText += getRawTextOfTemplate(node.head); + break; + } else { + break; + } + } + return [index, text, rawText, indexes]; + } + function nodesToTemplate(_a, file) { + var nodes = _a.nodes, operators = _a.operators; + var copyOperatorComments = copyTrailingOperatorComments(operators, file); + var copyCommentFromStringLiterals = copyCommentFromMultiNode(nodes, file, copyOperatorComments); + var _b = concatConsecutiveString(0, nodes), begin = _b[0], headText = _b[1], rawHeadText = _b[2], headIndexes = _b[3]; + if (begin === nodes.length) { + var noSubstitutionTemplateLiteral = ts6.factory.createNoSubstitutionTemplateLiteral(headText, rawHeadText); + copyCommentFromStringLiterals(headIndexes, noSubstitutionTemplateLiteral); + return noSubstitutionTemplateLiteral; + } + var templateSpans = []; + var templateHead = ts6.factory.createTemplateHead(headText, rawHeadText); + copyCommentFromStringLiterals(headIndexes, templateHead); + var _loop_19 = function(i2) { + var currentNode = getExpressionFromParenthesesOrExpression(nodes[i2]); + copyOperatorComments(i2, currentNode); + var _c = concatConsecutiveString(i2 + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3]; + i2 = newIndex - 1; + var isLast = i2 === nodes.length - 1; + if (ts6.isTemplateExpression(currentNode)) { + var spans = ts6.map(currentNode.templateSpans, function(span, index) { + copyExpressionComments(span); + var isLastSpan = index === currentNode.templateSpans.length - 1; + var text = span.literal.text + (isLastSpan ? subsequentText : ""); + var rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : ""); + return ts6.factory.createTemplateSpan(span.expression, isLast && isLastSpan ? ts6.factory.createTemplateTail(text, rawText) : ts6.factory.createTemplateMiddle(text, rawText)); + }); + templateSpans.push.apply(templateSpans, spans); + } else { + var templatePart = isLast ? ts6.factory.createTemplateTail(subsequentText, rawSubsequentText) : ts6.factory.createTemplateMiddle(subsequentText, rawSubsequentText); + copyCommentFromStringLiterals(stringIndexes, templatePart); + templateSpans.push(ts6.factory.createTemplateSpan(currentNode, templatePart)); + } + out_i_1 = i2; + }; + var out_i_1; + for (var i = begin; i < nodes.length; i++) { + _loop_19(i); + i = out_i_1; + } + return ts6.factory.createTemplateExpression(templateHead, templateSpans); + } + function copyExpressionComments(node) { + var file = node.getSourceFile(); + ts6.copyTrailingComments( + node, + node.expression, + file, + 3, + /* hasTrailingNewLine */ + false + ); + ts6.copyTrailingAsLeadingComments( + node.expression, + node.expression, + file, + 3, + /* hasTrailingNewLine */ + false + ); + } + function getExpressionFromParenthesesOrExpression(node) { + if (ts6.isParenthesizedExpression(node)) { + copyExpressionComments(node); + node = node.expression; + } + return node; + } + })(convertStringOrTemplateLiteral = refactor2.convertStringOrTemplateLiteral || (refactor2.convertStringOrTemplateLiteral = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var convertArrowFunctionOrFunctionExpression; + (function(convertArrowFunctionOrFunctionExpression2) { + var refactorName = "Convert arrow function or function expression"; + var refactorDescription = ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_arrow_function_or_function_expression); + var toAnonymousFunctionAction = { + name: "Convert to anonymous function", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_to_anonymous_function), + kind: "refactor.rewrite.function.anonymous" + }; + var toNamedFunctionAction = { + name: "Convert to named function", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_to_named_function), + kind: "refactor.rewrite.function.named" + }; + var toArrowFunctionAction = { + name: "Convert to arrow function", + description: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Convert_to_arrow_function), + kind: "refactor.rewrite.function.arrow" + }; + refactor2.registerRefactor(refactorName, { + kinds: [ + toAnonymousFunctionAction.kind, + toNamedFunctionAction.kind, + toArrowFunctionAction.kind + ], + getEditsForAction: getRefactorEditsToConvertFunctionExpressions, + getAvailableActions: getRefactorActionsToConvertFunctionExpressions + }); + function getRefactorActionsToConvertFunctionExpressions(context) { + var file = context.file, startPosition = context.startPosition, program = context.program, kind = context.kind; + var info = getFunctionInfo(file, startPosition, program); + if (!info) + return ts6.emptyArray; + var selectedVariableDeclaration = info.selectedVariableDeclaration, func = info.func; + var possibleActions = []; + var errors2 = []; + if (refactor2.refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) { + var error = selectedVariableDeclaration || ts6.isArrowFunction(func) && ts6.isVariableDeclaration(func.parent) ? void 0 : ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_convert_to_named_function); + if (error) { + errors2.push(__assign(__assign({}, toNamedFunctionAction), { notApplicableReason: error })); + } else { + possibleActions.push(toNamedFunctionAction); + } + } + if (refactor2.refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) { + var error = !selectedVariableDeclaration && ts6.isArrowFunction(func) ? void 0 : ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_convert_to_anonymous_function); + if (error) { + errors2.push(__assign(__assign({}, toAnonymousFunctionAction), { notApplicableReason: error })); + } else { + possibleActions.push(toAnonymousFunctionAction); + } + } + if (refactor2.refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) { + var error = ts6.isFunctionExpression(func) ? void 0 : ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_convert_to_arrow_function); + if (error) { + errors2.push(__assign(__assign({}, toArrowFunctionAction), { notApplicableReason: error })); + } else { + possibleActions.push(toArrowFunctionAction); + } + } + return [{ + name: refactorName, + description: refactorDescription, + actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors2 : possibleActions + }]; + } + function getRefactorEditsToConvertFunctionExpressions(context, actionName) { + var file = context.file, startPosition = context.startPosition, program = context.program; + var info = getFunctionInfo(file, startPosition, program); + if (!info) + return void 0; + var func = info.func; + var edits = []; + switch (actionName) { + case toAnonymousFunctionAction.name: + edits.push.apply(edits, getEditInfoForConvertToAnonymousFunction(context, func)); + break; + case toNamedFunctionAction.name: + var variableInfo = getVariableInfo(func); + if (!variableInfo) + return void 0; + edits.push.apply(edits, getEditInfoForConvertToNamedFunction(context, func, variableInfo)); + break; + case toArrowFunctionAction.name: + if (!ts6.isFunctionExpression(func)) + return void 0; + edits.push.apply(edits, getEditInfoForConvertToArrowFunction(context, func)); + break; + default: + return ts6.Debug.fail("invalid action"); + } + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + function containingThis(node) { + var containsThis = false; + node.forEachChild(function checkThis(child) { + if (ts6.isThis(child)) { + containsThis = true; + return; + } + if (!ts6.isClassLike(child) && !ts6.isFunctionDeclaration(child) && !ts6.isFunctionExpression(child)) { + ts6.forEachChild(child, checkThis); + } + }); + return containsThis; + } + function getFunctionInfo(file, startPosition, program) { + var token = ts6.getTokenAtPosition(file, startPosition); + var typeChecker = program.getTypeChecker(); + var func = tryGetFunctionFromVariableDeclaration(file, typeChecker, token.parent); + if (func && !containingThis(func.body) && !typeChecker.containsArgumentsReference(func)) { + return { selectedVariableDeclaration: true, func }; + } + var maybeFunc = ts6.getContainingFunction(token); + if (maybeFunc && (ts6.isFunctionExpression(maybeFunc) || ts6.isArrowFunction(maybeFunc)) && !ts6.rangeContainsRange(maybeFunc.body, token) && !containingThis(maybeFunc.body) && !typeChecker.containsArgumentsReference(maybeFunc)) { + if (ts6.isFunctionExpression(maybeFunc) && isFunctionReferencedInFile(file, typeChecker, maybeFunc)) + return void 0; + return { selectedVariableDeclaration: false, func: maybeFunc }; + } + return void 0; + } + function isSingleVariableDeclaration(parent) { + return ts6.isVariableDeclaration(parent) || ts6.isVariableDeclarationList(parent) && parent.declarations.length === 1; + } + function tryGetFunctionFromVariableDeclaration(sourceFile, typeChecker, parent) { + if (!isSingleVariableDeclaration(parent)) { + return void 0; + } + var variableDeclaration = ts6.isVariableDeclaration(parent) ? parent : ts6.first(parent.declarations); + var initializer = variableDeclaration.initializer; + if (initializer && (ts6.isArrowFunction(initializer) || ts6.isFunctionExpression(initializer) && !isFunctionReferencedInFile(sourceFile, typeChecker, initializer))) { + return initializer; + } + return void 0; + } + function convertToBlock(body) { + if (ts6.isExpression(body)) { + var returnStatement = ts6.factory.createReturnStatement(body); + var file = body.getSourceFile(); + ts6.suppressLeadingAndTrailingTrivia(returnStatement); + ts6.copyTrailingAsLeadingComments( + body, + returnStatement, + file, + /* commentKind */ + void 0, + /* hasTrailingNewLine */ + true + ); + return ts6.factory.createBlock( + [returnStatement], + /* multiLine */ + true + ); + } else { + return body; + } + } + function getVariableInfo(func) { + var variableDeclaration = func.parent; + if (!ts6.isVariableDeclaration(variableDeclaration) || !ts6.isVariableDeclarationInVariableStatement(variableDeclaration)) + return void 0; + var variableDeclarationList = variableDeclaration.parent; + var statement = variableDeclarationList.parent; + if (!ts6.isVariableDeclarationList(variableDeclarationList) || !ts6.isVariableStatement(statement) || !ts6.isIdentifier(variableDeclaration.name)) + return void 0; + return { variableDeclaration, variableDeclarationList, statement, name: variableDeclaration.name }; + } + function getEditInfoForConvertToAnonymousFunction(context, func) { + var file = context.file; + var body = convertToBlock(func.body); + var newNode = ts6.factory.createFunctionExpression( + func.modifiers, + func.asteriskToken, + /* name */ + void 0, + func.typeParameters, + func.parameters, + func.type, + body + ); + return ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.replaceNode(file, func, newNode); + }); + } + function getEditInfoForConvertToNamedFunction(context, func, variableInfo) { + var file = context.file; + var body = convertToBlock(func.body); + var variableDeclaration = variableInfo.variableDeclaration, variableDeclarationList = variableInfo.variableDeclarationList, statement = variableInfo.statement, name = variableInfo.name; + ts6.suppressLeadingTrivia(statement); + var modifiersFlags = ts6.getCombinedModifierFlags(variableDeclaration) & 1 | ts6.getEffectiveModifierFlags(func); + var modifiers = ts6.factory.createModifiersFromModifierFlags(modifiersFlags); + var newNode = ts6.factory.createFunctionDeclaration(ts6.length(modifiers) ? modifiers : void 0, func.asteriskToken, name, func.typeParameters, func.parameters, func.type, body); + if (variableDeclarationList.declarations.length === 1) { + return ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.replaceNode(file, statement, newNode); + }); + } else { + return ts6.textChanges.ChangeTracker.with(context, function(t) { + t.delete(file, variableDeclaration); + t.insertNodeAfter(file, statement, newNode); + }); + } + } + function getEditInfoForConvertToArrowFunction(context, func) { + var file = context.file; + var statements = func.body.statements; + var head = statements[0]; + var body; + if (canBeConvertedToExpression(func.body, head)) { + body = head.expression; + ts6.suppressLeadingAndTrailingTrivia(body); + ts6.copyComments(head, body); + } else { + body = func.body; + } + var newNode = ts6.factory.createArrowFunction(func.modifiers, func.typeParameters, func.parameters, func.type, ts6.factory.createToken( + 38 + /* SyntaxKind.EqualsGreaterThanToken */ + ), body); + return ts6.textChanges.ChangeTracker.with(context, function(t) { + return t.replaceNode(file, func, newNode); + }); + } + function canBeConvertedToExpression(body, head) { + return body.statements.length === 1 && (ts6.isReturnStatement(head) && !!head.expression); + } + function isFunctionReferencedInFile(sourceFile, typeChecker, node) { + return !!node.name && ts6.FindAllReferences.Core.isSymbolReferencedInFile(node.name, typeChecker, sourceFile); + } + })(convertArrowFunctionOrFunctionExpression = refactor2.convertArrowFunctionOrFunctionExpression || (refactor2.convertArrowFunctionOrFunctionExpression = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var refactor; + (function(refactor2) { + var inferFunctionReturnType; + (function(inferFunctionReturnType2) { + var refactorName = "Infer function return type"; + var refactorDescription = ts6.Diagnostics.Infer_function_return_type.message; + var inferReturnTypeAction = { + name: refactorName, + description: refactorDescription, + kind: "refactor.rewrite.function.returnType" + }; + refactor2.registerRefactor(refactorName, { + kinds: [inferReturnTypeAction.kind], + getEditsForAction: getRefactorEditsToInferReturnType, + getAvailableActions: getRefactorActionsToInferReturnType + }); + function getRefactorEditsToInferReturnType(context) { + var info = getInfo(context); + if (info && !refactor2.isRefactorErrorInfo(info)) { + var edits = ts6.textChanges.ChangeTracker.with(context, function(t) { + return doChange(context.file, t, info.declaration, info.returnTypeNode); + }); + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + return void 0; + } + function getRefactorActionsToInferReturnType(context) { + var info = getInfo(context); + if (!info) + return ts6.emptyArray; + if (!refactor2.isRefactorErrorInfo(info)) { + return [{ + name: refactorName, + description: refactorDescription, + actions: [inferReturnTypeAction] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName, + description: refactorDescription, + actions: [__assign(__assign({}, inferReturnTypeAction), { notApplicableReason: info.error })] + }]; + } + return ts6.emptyArray; + } + function doChange(sourceFile, changes, declaration, typeNode) { + var closeParen = ts6.findChildOfKind(declaration, 21, sourceFile); + var needParens = ts6.isArrowFunction(declaration) && closeParen === void 0; + var endNode = needParens ? ts6.first(declaration.parameters) : closeParen; + if (endNode) { + if (needParens) { + changes.insertNodeBefore(sourceFile, endNode, ts6.factory.createToken( + 20 + /* SyntaxKind.OpenParenToken */ + )); + changes.insertNodeAfter(sourceFile, endNode, ts6.factory.createToken( + 21 + /* SyntaxKind.CloseParenToken */ + )); + } + changes.insertNodeAt(sourceFile, endNode.end, typeNode, { prefix: ": " }); + } + } + function getInfo(context) { + if (ts6.isInJSFile(context.file) || !refactor2.refactorKindBeginsWith(inferReturnTypeAction.kind, context.kind)) + return; + var token = ts6.getTokenAtPosition(context.file, context.startPosition); + var declaration = ts6.findAncestor(token, function(n) { + return ts6.isBlock(n) || n.parent && ts6.isArrowFunction(n.parent) && (n.kind === 38 || n.parent.body === n) ? "quit" : isConvertibleDeclaration(n); + }); + if (!declaration || !declaration.body || declaration.type) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Return_type_must_be_inferred_from_a_function) }; + } + var typeChecker = context.program.getTypeChecker(); + var returnType = tryGetReturnType(typeChecker, declaration); + if (!returnType) { + return { error: ts6.getLocaleSpecificMessage(ts6.Diagnostics.Could_not_determine_function_return_type) }; + } + var returnTypeNode = typeChecker.typeToTypeNode( + returnType, + declaration, + 1 + /* NodeBuilderFlags.NoTruncation */ + ); + if (returnTypeNode) { + return { declaration, returnTypeNode }; + } + } + function isConvertibleDeclaration(node) { + switch (node.kind) { + case 259: + case 215: + case 216: + case 171: + return true; + default: + return false; + } + } + function tryGetReturnType(typeChecker, node) { + if (typeChecker.isImplementationOfOverload(node)) { + var signatures = typeChecker.getTypeAtLocation(node).getCallSignatures(); + if (signatures.length > 1) { + return typeChecker.getUnionType(ts6.mapDefined(signatures, function(s) { + return s.getReturnType(); + })); + } + } + var signature = typeChecker.getSignatureFromDeclaration(node); + if (signature) { + return typeChecker.getReturnTypeOfSignature(signature); + } + } + })(inferFunctionReturnType = refactor2.inferFunctionReturnType || (refactor2.inferFunctionReturnType = {})); + })(refactor = ts6.refactor || (ts6.refactor = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.servicesVersion = "0.8"; + function createNode(kind, pos, end, parent) { + var node = ts6.isNodeKind(kind) ? new NodeObject(kind, pos, end) : kind === 79 ? new IdentifierObject(79, pos, end) : kind === 80 ? new PrivateIdentifierObject(80, pos, end) : new TokenObject(kind, pos, end); + node.parent = parent; + node.flags = parent.flags & 50720768; + return node; + } + var NodeObject = ( + /** @class */ + function() { + function NodeObject2(kind, pos, end) { + this.pos = pos; + this.end = end; + this.flags = 0; + this.modifierFlagsCache = 0; + this.transformFlags = 0; + this.parent = void 0; + this.kind = kind; + } + NodeObject2.prototype.assertHasRealPosition = function(message) { + ts6.Debug.assert(!ts6.positionIsSynthesized(this.pos) && !ts6.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); + }; + NodeObject2.prototype.getSourceFile = function() { + return ts6.getSourceFileOfNode(this); + }; + NodeObject2.prototype.getStart = function(sourceFile, includeJsDocComment) { + this.assertHasRealPosition(); + return ts6.getTokenPosOfNode(this, sourceFile, includeJsDocComment); + }; + NodeObject2.prototype.getFullStart = function() { + this.assertHasRealPosition(); + return this.pos; + }; + NodeObject2.prototype.getEnd = function() { + this.assertHasRealPosition(); + return this.end; + }; + NodeObject2.prototype.getWidth = function(sourceFile) { + this.assertHasRealPosition(); + return this.getEnd() - this.getStart(sourceFile); + }; + NodeObject2.prototype.getFullWidth = function() { + this.assertHasRealPosition(); + return this.end - this.pos; + }; + NodeObject2.prototype.getLeadingTriviaWidth = function(sourceFile) { + this.assertHasRealPosition(); + return this.getStart(sourceFile) - this.pos; + }; + NodeObject2.prototype.getFullText = function(sourceFile) { + this.assertHasRealPosition(); + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + }; + NodeObject2.prototype.getText = function(sourceFile) { + this.assertHasRealPosition(); + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + }; + NodeObject2.prototype.getChildCount = function(sourceFile) { + return this.getChildren(sourceFile).length; + }; + NodeObject2.prototype.getChildAt = function(index, sourceFile) { + return this.getChildren(sourceFile)[index]; + }; + NodeObject2.prototype.getChildren = function(sourceFile) { + this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); + return this._children || (this._children = createChildren(this, sourceFile)); + }; + NodeObject2.prototype.getFirstToken = function(sourceFile) { + this.assertHasRealPosition(); + var children = this.getChildren(sourceFile); + if (!children.length) { + return void 0; + } + var child = ts6.find(children, function(kid) { + return kid.kind < 312 || kid.kind > 350; + }); + return child.kind < 163 ? child : child.getFirstToken(sourceFile); + }; + NodeObject2.prototype.getLastToken = function(sourceFile) { + this.assertHasRealPosition(); + var children = this.getChildren(sourceFile); + var child = ts6.lastOrUndefined(children); + if (!child) { + return void 0; + } + return child.kind < 163 ? child : child.getLastToken(sourceFile); + }; + NodeObject2.prototype.forEachChild = function(cbNode, cbNodeArray) { + return ts6.forEachChild(this, cbNode, cbNodeArray); + }; + return NodeObject2; + }() + ); + function createChildren(node, sourceFile) { + if (!ts6.isNodeKind(node.kind)) { + return ts6.emptyArray; + } + var children = []; + if (ts6.isJSDocCommentContainingNode(node)) { + node.forEachChild(function(child) { + children.push(child); + }); + return children; + } + ts6.scanner.setText((sourceFile || node.getSourceFile()).text); + var pos = node.pos; + var processNode = function(child) { + addSyntheticNodes(children, pos, child.pos, node); + children.push(child); + pos = child.end; + }; + var processNodes = function(nodes) { + addSyntheticNodes(children, pos, nodes.pos, node); + children.push(createSyntaxList(nodes, node)); + pos = nodes.end; + }; + ts6.forEach(node.jsDoc, processNode); + pos = node.pos; + node.forEachChild(processNode, processNodes); + addSyntheticNodes(children, pos, node.end, node); + ts6.scanner.setText(void 0); + return children; + } + function addSyntheticNodes(nodes, pos, end, parent) { + ts6.scanner.setTextPos(pos); + while (pos < end) { + var token = ts6.scanner.scan(); + var textPos = ts6.scanner.getTextPos(); + if (textPos <= end) { + if (token === 79) { + ts6.Debug.fail("Did not expect ".concat(ts6.Debug.formatSyntaxKind(parent.kind), " to have an Identifier in its trivia")); + } + nodes.push(createNode(token, pos, textPos, parent)); + } + pos = textPos; + if (token === 1) { + break; + } + } + } + function createSyntaxList(nodes, parent) { + var list = createNode(351, nodes.pos, nodes.end, parent); + list._children = []; + var pos = nodes.pos; + for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { + var node = nodes_2[_i]; + addSyntheticNodes(list._children, pos, node.pos, parent); + list._children.push(node); + pos = node.end; + } + addSyntheticNodes(list._children, pos, nodes.end, parent); + return list; + } + var TokenOrIdentifierObject = ( + /** @class */ + function() { + function TokenOrIdentifierObject2(pos, end) { + this.pos = pos; + this.end = end; + this.flags = 0; + this.modifierFlagsCache = 0; + this.transformFlags = 0; + this.parent = void 0; + } + TokenOrIdentifierObject2.prototype.getSourceFile = function() { + return ts6.getSourceFileOfNode(this); + }; + TokenOrIdentifierObject2.prototype.getStart = function(sourceFile, includeJsDocComment) { + return ts6.getTokenPosOfNode(this, sourceFile, includeJsDocComment); + }; + TokenOrIdentifierObject2.prototype.getFullStart = function() { + return this.pos; + }; + TokenOrIdentifierObject2.prototype.getEnd = function() { + return this.end; + }; + TokenOrIdentifierObject2.prototype.getWidth = function(sourceFile) { + return this.getEnd() - this.getStart(sourceFile); + }; + TokenOrIdentifierObject2.prototype.getFullWidth = function() { + return this.end - this.pos; + }; + TokenOrIdentifierObject2.prototype.getLeadingTriviaWidth = function(sourceFile) { + return this.getStart(sourceFile) - this.pos; + }; + TokenOrIdentifierObject2.prototype.getFullText = function(sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + }; + TokenOrIdentifierObject2.prototype.getText = function(sourceFile) { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + }; + TokenOrIdentifierObject2.prototype.getChildCount = function() { + return this.getChildren().length; + }; + TokenOrIdentifierObject2.prototype.getChildAt = function(index) { + return this.getChildren()[index]; + }; + TokenOrIdentifierObject2.prototype.getChildren = function() { + return this.kind === 1 ? this.jsDoc || ts6.emptyArray : ts6.emptyArray; + }; + TokenOrIdentifierObject2.prototype.getFirstToken = function() { + return void 0; + }; + TokenOrIdentifierObject2.prototype.getLastToken = function() { + return void 0; + }; + TokenOrIdentifierObject2.prototype.forEachChild = function() { + return void 0; + }; + return TokenOrIdentifierObject2; + }() + ); + var SymbolObject = ( + /** @class */ + function() { + function SymbolObject2(flags, name) { + this.flags = flags; + this.escapedName = name; + } + SymbolObject2.prototype.getFlags = function() { + return this.flags; + }; + Object.defineProperty(SymbolObject2.prototype, "name", { + get: function() { + return ts6.symbolName(this); + }, + enumerable: false, + configurable: true + }); + SymbolObject2.prototype.getEscapedName = function() { + return this.escapedName; + }; + SymbolObject2.prototype.getName = function() { + return this.name; + }; + SymbolObject2.prototype.getDeclarations = function() { + return this.declarations; + }; + SymbolObject2.prototype.getDocumentationComment = function(checker) { + if (!this.documentationComment) { + this.documentationComment = ts6.emptyArray; + if (!this.declarations && this.target && this.target.tupleLabelDeclaration) { + var labelDecl = this.target.tupleLabelDeclaration; + this.documentationComment = getDocumentationComment([labelDecl], checker); + } else { + this.documentationComment = getDocumentationComment(this.declarations, checker); + } + } + return this.documentationComment; + }; + SymbolObject2.prototype.getContextualDocumentationComment = function(context, checker) { + if (context) { + if (ts6.isGetAccessor(context)) { + if (!this.contextualGetAccessorDocumentationComment) { + this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts6.filter(this.declarations, ts6.isGetAccessor), checker); + } + if (ts6.length(this.contextualGetAccessorDocumentationComment)) { + return this.contextualGetAccessorDocumentationComment; + } + } + if (ts6.isSetAccessor(context)) { + if (!this.contextualSetAccessorDocumentationComment) { + this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts6.filter(this.declarations, ts6.isSetAccessor), checker); + } + if (ts6.length(this.contextualSetAccessorDocumentationComment)) { + return this.contextualSetAccessorDocumentationComment; + } + } + } + return this.getDocumentationComment(checker); + }; + SymbolObject2.prototype.getJsDocTags = function(checker) { + if (this.tags === void 0) { + this.tags = getJsDocTagsOfDeclarations(this.declarations, checker); + } + return this.tags; + }; + SymbolObject2.prototype.getContextualJsDocTags = function(context, checker) { + if (context) { + if (ts6.isGetAccessor(context)) { + if (!this.contextualGetAccessorTags) { + this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts6.filter(this.declarations, ts6.isGetAccessor), checker); + } + if (ts6.length(this.contextualGetAccessorTags)) { + return this.contextualGetAccessorTags; + } + } + if (ts6.isSetAccessor(context)) { + if (!this.contextualSetAccessorTags) { + this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts6.filter(this.declarations, ts6.isSetAccessor), checker); + } + if (ts6.length(this.contextualSetAccessorTags)) { + return this.contextualSetAccessorTags; + } + } + } + return this.getJsDocTags(checker); + }; + return SymbolObject2; + }() + ); + var TokenObject = ( + /** @class */ + function(_super) { + __extends(TokenObject2, _super); + function TokenObject2(kind, pos, end) { + var _this = _super.call(this, pos, end) || this; + _this.kind = kind; + return _this; + } + return TokenObject2; + }(TokenOrIdentifierObject) + ); + var IdentifierObject = ( + /** @class */ + function(_super) { + __extends(IdentifierObject2, _super); + function IdentifierObject2(_kind, pos, end) { + var _this = _super.call(this, pos, end) || this; + _this.kind = 79; + return _this; + } + Object.defineProperty(IdentifierObject2.prototype, "text", { + get: function() { + return ts6.idText(this); + }, + enumerable: false, + configurable: true + }); + return IdentifierObject2; + }(TokenOrIdentifierObject) + ); + IdentifierObject.prototype.kind = 79; + var PrivateIdentifierObject = ( + /** @class */ + function(_super) { + __extends(PrivateIdentifierObject2, _super); + function PrivateIdentifierObject2(_kind, pos, end) { + return _super.call(this, pos, end) || this; + } + Object.defineProperty(PrivateIdentifierObject2.prototype, "text", { + get: function() { + return ts6.idText(this); + }, + enumerable: false, + configurable: true + }); + return PrivateIdentifierObject2; + }(TokenOrIdentifierObject) + ); + PrivateIdentifierObject.prototype.kind = 80; + var TypeObject = ( + /** @class */ + function() { + function TypeObject2(checker, flags) { + this.checker = checker; + this.flags = flags; + } + TypeObject2.prototype.getFlags = function() { + return this.flags; + }; + TypeObject2.prototype.getSymbol = function() { + return this.symbol; + }; + TypeObject2.prototype.getProperties = function() { + return this.checker.getPropertiesOfType(this); + }; + TypeObject2.prototype.getProperty = function(propertyName) { + return this.checker.getPropertyOfType(this, propertyName); + }; + TypeObject2.prototype.getApparentProperties = function() { + return this.checker.getAugmentedPropertiesOfType(this); + }; + TypeObject2.prototype.getCallSignatures = function() { + return this.checker.getSignaturesOfType( + this, + 0 + /* SignatureKind.Call */ + ); + }; + TypeObject2.prototype.getConstructSignatures = function() { + return this.checker.getSignaturesOfType( + this, + 1 + /* SignatureKind.Construct */ + ); + }; + TypeObject2.prototype.getStringIndexType = function() { + return this.checker.getIndexTypeOfType( + this, + 0 + /* IndexKind.String */ + ); + }; + TypeObject2.prototype.getNumberIndexType = function() { + return this.checker.getIndexTypeOfType( + this, + 1 + /* IndexKind.Number */ + ); + }; + TypeObject2.prototype.getBaseTypes = function() { + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : void 0; + }; + TypeObject2.prototype.isNullableType = function() { + return this.checker.isNullableType(this); + }; + TypeObject2.prototype.getNonNullableType = function() { + return this.checker.getNonNullableType(this); + }; + TypeObject2.prototype.getNonOptionalType = function() { + return this.checker.getNonOptionalType(this); + }; + TypeObject2.prototype.getConstraint = function() { + return this.checker.getBaseConstraintOfType(this); + }; + TypeObject2.prototype.getDefault = function() { + return this.checker.getDefaultFromTypeParameter(this); + }; + TypeObject2.prototype.isUnion = function() { + return !!(this.flags & 1048576); + }; + TypeObject2.prototype.isIntersection = function() { + return !!(this.flags & 2097152); + }; + TypeObject2.prototype.isUnionOrIntersection = function() { + return !!(this.flags & 3145728); + }; + TypeObject2.prototype.isLiteral = function() { + return !!(this.flags & 384); + }; + TypeObject2.prototype.isStringLiteral = function() { + return !!(this.flags & 128); + }; + TypeObject2.prototype.isNumberLiteral = function() { + return !!(this.flags & 256); + }; + TypeObject2.prototype.isTypeParameter = function() { + return !!(this.flags & 262144); + }; + TypeObject2.prototype.isClassOrInterface = function() { + return !!(ts6.getObjectFlags(this) & 3); + }; + TypeObject2.prototype.isClass = function() { + return !!(ts6.getObjectFlags(this) & 1); + }; + TypeObject2.prototype.isIndexType = function() { + return !!(this.flags & 4194304); + }; + Object.defineProperty(TypeObject2.prototype, "typeArguments", { + /** + * This polyfills `referenceType.typeArguments` for API consumers + */ + get: function() { + if (ts6.getObjectFlags(this) & 4) { + return this.checker.getTypeArguments(this); + } + return void 0; + }, + enumerable: false, + configurable: true + }); + return TypeObject2; + }() + ); + var SignatureObject = ( + /** @class */ + function() { + function SignatureObject2(checker, flags) { + this.checker = checker; + this.flags = flags; + } + SignatureObject2.prototype.getDeclaration = function() { + return this.declaration; + }; + SignatureObject2.prototype.getTypeParameters = function() { + return this.typeParameters; + }; + SignatureObject2.prototype.getParameters = function() { + return this.parameters; + }; + SignatureObject2.prototype.getReturnType = function() { + return this.checker.getReturnTypeOfSignature(this); + }; + SignatureObject2.prototype.getTypeParameterAtPosition = function(pos) { + var type = this.checker.getParameterType(this, pos); + if (type.isIndexType() && ts6.isThisTypeParameter(type.type)) { + var constraint = type.type.getConstraint(); + if (constraint) { + return this.checker.getIndexType(constraint); + } + } + return type; + }; + SignatureObject2.prototype.getDocumentationComment = function() { + return this.documentationComment || (this.documentationComment = getDocumentationComment(ts6.singleElementArray(this.declaration), this.checker)); + }; + SignatureObject2.prototype.getJsDocTags = function() { + return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts6.singleElementArray(this.declaration), this.checker)); + }; + return SignatureObject2; + }() + ); + function hasJSDocInheritDocTag(node) { + return ts6.getJSDocTags(node).some(function(tag) { + return tag.tagName.text === "inheritDoc" || tag.tagName.text === "inheritdoc"; + }); + } + function getJsDocTagsOfDeclarations(declarations, checker) { + if (!declarations) + return ts6.emptyArray; + var tags = ts6.JsDoc.getJsDocTagsFromDeclarations(declarations, checker); + if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) { + var seenSymbols_1 = new ts6.Set(); + var _loop_20 = function(declaration2) { + var inheritedTags = findBaseOfDeclaration(checker, declaration2, function(symbol) { + var _a; + if (!seenSymbols_1.has(symbol)) { + seenSymbols_1.add(symbol); + if (declaration2.kind === 174 || declaration2.kind === 175) { + return symbol.getContextualJsDocTags(declaration2, checker); + } + return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : void 0; + } + }); + if (inheritedTags) { + tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true); + } + }; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + _loop_20(declaration); + } + } + return tags; + } + function getDocumentationComment(declarations, checker) { + if (!declarations) + return ts6.emptyArray; + var doc = ts6.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker); + if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) { + var seenSymbols_2 = new ts6.Set(); + var _loop_21 = function(declaration2) { + var inheritedDocs = findBaseOfDeclaration(checker, declaration2, function(symbol) { + if (!seenSymbols_2.has(symbol)) { + seenSymbols_2.add(symbol); + if (declaration2.kind === 174 || declaration2.kind === 175) { + return symbol.getContextualDocumentationComment(declaration2, checker); + } + return symbol.getDocumentationComment(checker); + } + }); + if (inheritedDocs) + doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts6.lineBreakPart(), doc); + }; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + _loop_21(declaration); + } + } + return doc; + } + function findBaseOfDeclaration(checker, declaration, cb) { + var _a; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 ? declaration.parent.parent : declaration.parent; + if (!classOrInterfaceDeclaration) + return; + var isStaticMember = ts6.hasStaticModifier(declaration); + return ts6.firstDefined(ts6.getAllSuperTypeNodes(classOrInterfaceDeclaration), function(superTypeNode) { + var baseType = checker.getTypeAtLocation(superTypeNode); + var type = isStaticMember && baseType.symbol ? checker.getTypeOfSymbol(baseType.symbol) : baseType; + var symbol = checker.getPropertyOfType(type, declaration.symbol.name); + return symbol ? cb(symbol) : void 0; + }); + } + var SourceFileObject = ( + /** @class */ + function(_super) { + __extends(SourceFileObject2, _super); + function SourceFileObject2(kind, pos, end) { + var _this = _super.call(this, kind, pos, end) || this; + _this.kind = 308; + return _this; + } + SourceFileObject2.prototype.update = function(newText, textChangeRange) { + return ts6.updateSourceFile(this, newText, textChangeRange); + }; + SourceFileObject2.prototype.getLineAndCharacterOfPosition = function(position) { + return ts6.getLineAndCharacterOfPosition(this, position); + }; + SourceFileObject2.prototype.getLineStarts = function() { + return ts6.getLineStarts(this); + }; + SourceFileObject2.prototype.getPositionOfLineAndCharacter = function(line, character, allowEdits) { + return ts6.computePositionOfLineAndCharacter(ts6.getLineStarts(this), line, character, this.text, allowEdits); + }; + SourceFileObject2.prototype.getLineEndOfPosition = function(pos) { + var line = this.getLineAndCharacterOfPosition(pos).line; + var lineStarts = this.getLineStarts(); + var lastCharPos; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + var fullText = this.getFullText(); + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + }; + SourceFileObject2.prototype.getNamedDeclarations = function() { + if (!this.namedDeclarations) { + this.namedDeclarations = this.computeNamedDeclarations(); + } + return this.namedDeclarations; + }; + SourceFileObject2.prototype.computeNamedDeclarations = function() { + var result = ts6.createMultiMap(); + this.forEachChild(visit); + return result; + function addDeclaration(declaration) { + var name = getDeclarationName(declaration); + if (name) { + result.add(name, declaration); + } + } + function getDeclarations(name) { + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; + } + function getDeclarationName(declaration) { + var name = ts6.getNonAssignedNameOfDeclaration(declaration); + return name && (ts6.isComputedPropertyName(name) && ts6.isPropertyAccessExpression(name.expression) ? name.expression.name.text : ts6.isPropertyName(name) ? ts6.getNameFromPropertyName(name) : void 0); + } + function visit(node) { + switch (node.kind) { + case 259: + case 215: + case 171: + case 170: + var functionDeclaration = node; + var declarationName = getDeclarationName(functionDeclaration); + if (declarationName) { + var declarations = getDeclarations(declarationName); + var lastDeclaration = ts6.lastOrUndefined(declarations); + if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) { + if (functionDeclaration.body && !lastDeclaration.body) { + declarations[declarations.length - 1] = functionDeclaration; + } + } else { + declarations.push(functionDeclaration); + } + } + ts6.forEachChild(node, visit); + break; + case 260: + case 228: + case 261: + case 262: + case 263: + case 264: + case 268: + case 278: + case 273: + case 270: + case 271: + case 174: + case 175: + case 184: + addDeclaration(node); + ts6.forEachChild(node, visit); + break; + case 166: + if (!ts6.hasSyntacticModifier( + node, + 16476 + /* ModifierFlags.ParameterPropertyModifier */ + )) { + break; + } + case 257: + case 205: { + var decl = node; + if (ts6.isBindingPattern(decl.name)) { + ts6.forEachChild(decl.name, visit); + break; + } + if (decl.initializer) { + visit(decl.initializer); + } + } + case 302: + case 169: + case 168: + addDeclaration(node); + break; + case 275: + var exportDeclaration = node; + if (exportDeclaration.exportClause) { + if (ts6.isNamedExports(exportDeclaration.exportClause)) { + ts6.forEach(exportDeclaration.exportClause.elements, visit); + } else { + visit(exportDeclaration.exportClause.name); + } + } + break; + case 269: + var importClause = node.importClause; + if (importClause) { + if (importClause.name) { + addDeclaration(importClause.name); + } + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === 271) { + addDeclaration(importClause.namedBindings); + } else { + ts6.forEach(importClause.namedBindings.elements, visit); + } + } + } + break; + case 223: + if (ts6.getAssignmentDeclarationKind(node) !== 0) { + addDeclaration(node); + } + default: + ts6.forEachChild(node, visit); + } + } + }; + return SourceFileObject2; + }(NodeObject) + ); + var SourceMapSourceObject = ( + /** @class */ + function() { + function SourceMapSourceObject2(fileName, text, skipTrivia) { + this.fileName = fileName; + this.text = text; + this.skipTrivia = skipTrivia; + } + SourceMapSourceObject2.prototype.getLineAndCharacterOfPosition = function(pos) { + return ts6.getLineAndCharacterOfPosition(this, pos); + }; + return SourceMapSourceObject2; + }() + ); + function getServicesObjectAllocator() { + return { + getNodeConstructor: function() { + return NodeObject; + }, + getTokenConstructor: function() { + return TokenObject; + }, + getIdentifierConstructor: function() { + return IdentifierObject; + }, + getPrivateIdentifierConstructor: function() { + return PrivateIdentifierObject; + }, + getSourceFileConstructor: function() { + return SourceFileObject; + }, + getSymbolConstructor: function() { + return SymbolObject; + }, + getTypeConstructor: function() { + return TypeObject; + }, + getSignatureConstructor: function() { + return SignatureObject; + }, + getSourceMapSourceConstructor: function() { + return SourceMapSourceObject; + } + }; + } + function toEditorSettings(optionsAsMap) { + var allPropertiesAreCamelCased = true; + for (var key in optionsAsMap) { + if (ts6.hasProperty(optionsAsMap, key) && !isCamelCase(key)) { + allPropertiesAreCamelCased = false; + break; + } + } + if (allPropertiesAreCamelCased) { + return optionsAsMap; + } + var settings = {}; + for (var key in optionsAsMap) { + if (ts6.hasProperty(optionsAsMap, key)) { + var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1); + settings[newKey] = optionsAsMap[key]; + } + } + return settings; + } + ts6.toEditorSettings = toEditorSettings; + function isCamelCase(s) { + return !s.length || s.charAt(0) === s.charAt(0).toLowerCase(); + } + function displayPartsToString(displayParts) { + if (displayParts) { + return ts6.map(displayParts, function(displayPart) { + return displayPart.text; + }).join(""); + } + return ""; + } + ts6.displayPartsToString = displayPartsToString; + function getDefaultCompilerOptions() { + return { + target: 1, + jsx: 1 + /* JsxEmit.Preserve */ + }; + } + ts6.getDefaultCompilerOptions = getDefaultCompilerOptions; + function getSupportedCodeFixes() { + return ts6.codefix.getSupportedErrorCodes(); + } + ts6.getSupportedCodeFixes = getSupportedCodeFixes; + var SyntaxTreeCache = ( + /** @class */ + function() { + function SyntaxTreeCache2(host) { + this.host = host; + } + SyntaxTreeCache2.prototype.getCurrentSourceFile = function(fileName) { + var _a, _b, _c, _d, _e, _f, _g, _h; + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (!scriptSnapshot) { + throw new Error("Could not find file: '" + fileName + "'."); + } + var scriptKind = ts6.getScriptKind(fileName, this.host); + var version = this.host.getScriptVersion(fileName); + var sourceFile; + if (this.currentFileName !== fileName) { + var options = { + languageVersion: 99, + impliedNodeFormat: ts6.getImpliedNodeFormatForFile(ts6.toPath(fileName, this.host.getCurrentDirectory(), ((_c = (_b = (_a = this.host).getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.getCanonicalFileName) || ts6.hostGetCanonicalFileName(this.host)), (_h = (_g = (_f = (_e = (_d = this.host).getCompilerHost) === null || _e === void 0 ? void 0 : _e.call(_d)) === null || _f === void 0 ? void 0 : _f.getModuleResolutionCache) === null || _g === void 0 ? void 0 : _g.call(_f)) === null || _h === void 0 ? void 0 : _h.getPackageJsonInfoCache(), this.host, this.host.getCompilationSettings()), + setExternalModuleIndicator: ts6.getSetExternalModuleIndicator(this.host.getCompilationSettings()) + }; + sourceFile = createLanguageServiceSourceFile( + fileName, + scriptSnapshot, + options, + version, + /*setNodeParents*/ + true, + scriptKind + ); + } else if (this.currentFileVersion !== version) { + var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + } + if (sourceFile) { + this.currentFileVersion = version; + this.currentFileName = fileName; + this.currentFileScriptSnapshot = scriptSnapshot; + this.currentSourceFile = sourceFile; + } + return this.currentSourceFile; + }; + return SyntaxTreeCache2; + }() + ); + function setSourceFileFields(sourceFile, scriptSnapshot, version) { + sourceFile.version = version; + sourceFile.scriptSnapshot = scriptSnapshot; + } + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTargetOrOptions, version, setNodeParents, scriptKind) { + var sourceFile = ts6.createSourceFile(fileName, ts6.getSnapshotText(scriptSnapshot), scriptTargetOrOptions, setNodeParents, scriptKind); + setSourceFileFields(sourceFile, scriptSnapshot, version); + return sourceFile; + } + ts6.createLanguageServiceSourceFile = createLanguageServiceSourceFile; + function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { + if (textChangeRange) { + if (version !== sourceFile.version) { + var newText = void 0; + var prefix2 = textChangeRange.span.start !== 0 ? sourceFile.text.substr(0, textChangeRange.span.start) : ""; + var suffix = ts6.textSpanEnd(textChangeRange.span) !== sourceFile.text.length ? sourceFile.text.substr(ts6.textSpanEnd(textChangeRange.span)) : ""; + if (textChangeRange.newLength === 0) { + newText = prefix2 && suffix ? prefix2 + suffix : prefix2 || suffix; + } else { + var changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength); + newText = prefix2 && suffix ? prefix2 + changedText + suffix : prefix2 ? prefix2 + changedText : changedText + suffix; + } + var newSourceFile = ts6.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + setSourceFileFields(newSourceFile, scriptSnapshot, version); + newSourceFile.nameTable = void 0; + if (sourceFile !== newSourceFile && sourceFile.scriptSnapshot) { + if (sourceFile.scriptSnapshot.dispose) { + sourceFile.scriptSnapshot.dispose(); + } + sourceFile.scriptSnapshot = void 0; + } + return newSourceFile; + } + } + var options = { + languageVersion: sourceFile.languageVersion, + impliedNodeFormat: sourceFile.impliedNodeFormat, + setExternalModuleIndicator: sourceFile.setExternalModuleIndicator + }; + return createLanguageServiceSourceFile( + sourceFile.fileName, + scriptSnapshot, + options, + version, + /*setNodeParents*/ + true, + sourceFile.scriptKind + ); + } + ts6.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; + var NoopCancellationToken = { + isCancellationRequested: ts6.returnFalse, + throwIfCancellationRequested: ts6.noop + }; + var CancellationTokenObject = ( + /** @class */ + function() { + function CancellationTokenObject2(cancellationToken) { + this.cancellationToken = cancellationToken; + } + CancellationTokenObject2.prototype.isCancellationRequested = function() { + return this.cancellationToken.isCancellationRequested(); + }; + CancellationTokenObject2.prototype.throwIfCancellationRequested = function() { + if (this.isCancellationRequested()) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("session", "cancellationThrown", { kind: "CancellationTokenObject" }); + throw new ts6.OperationCanceledException(); + } + }; + return CancellationTokenObject2; + }() + ); + var ThrottledCancellationToken = ( + /** @class */ + function() { + function ThrottledCancellationToken2(hostCancellationToken, throttleWaitMilliseconds) { + if (throttleWaitMilliseconds === void 0) { + throttleWaitMilliseconds = 20; + } + this.hostCancellationToken = hostCancellationToken; + this.throttleWaitMilliseconds = throttleWaitMilliseconds; + this.lastCancellationCheckTime = 0; + } + ThrottledCancellationToken2.prototype.isCancellationRequested = function() { + var time = ts6.timestamp(); + var duration = Math.abs(time - this.lastCancellationCheckTime); + if (duration >= this.throttleWaitMilliseconds) { + this.lastCancellationCheckTime = time; + return this.hostCancellationToken.isCancellationRequested(); + } + return false; + }; + ThrottledCancellationToken2.prototype.throwIfCancellationRequested = function() { + if (this.isCancellationRequested()) { + ts6.tracing === null || ts6.tracing === void 0 ? void 0 : ts6.tracing.instant("session", "cancellationThrown", { kind: "ThrottledCancellationToken" }); + throw new ts6.OperationCanceledException(); + } + }; + return ThrottledCancellationToken2; + }() + ); + ts6.ThrottledCancellationToken = ThrottledCancellationToken; + var invalidOperationsInPartialSemanticMode = [ + "getSemanticDiagnostics", + "getSuggestionDiagnostics", + "getCompilerOptionsDiagnostics", + "getSemanticClassifications", + "getEncodedSemanticClassifications", + "getCodeFixesAtPosition", + "getCombinedCodeFix", + "applyCodeActionCommand", + "organizeImports", + "getEditsForFileRename", + "getEmitOutput", + "getApplicableRefactors", + "getEditsForRefactor", + "prepareCallHierarchy", + "provideCallHierarchyIncomingCalls", + "provideCallHierarchyOutgoingCalls", + "provideInlayHints" + ]; + var invalidOperationsInSyntacticMode = __spreadArray(__spreadArray([], invalidOperationsInPartialSemanticMode, true), [ + "getCompletionsAtPosition", + "getCompletionEntryDetails", + "getCompletionEntrySymbol", + "getSignatureHelpItems", + "getQuickInfoAtPosition", + "getDefinitionAtPosition", + "getDefinitionAndBoundSpan", + "getImplementationAtPosition", + "getTypeDefinitionAtPosition", + "getReferencesAtPosition", + "findReferences", + "getOccurrencesAtPosition", + "getDocumentHighlights", + "getNavigateToItems", + "getRenameInfo", + "findRenameLocations", + "getApplicableRefactors" + ], false); + function createLanguageService(host, documentRegistry, syntaxOnlyOrLanguageServiceMode) { + var _a; + var _b; + if (documentRegistry === void 0) { + documentRegistry = ts6.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + } + var languageServiceMode; + if (syntaxOnlyOrLanguageServiceMode === void 0) { + languageServiceMode = ts6.LanguageServiceMode.Semantic; + } else if (typeof syntaxOnlyOrLanguageServiceMode === "boolean") { + languageServiceMode = syntaxOnlyOrLanguageServiceMode ? ts6.LanguageServiceMode.Syntactic : ts6.LanguageServiceMode.Semantic; + } else { + languageServiceMode = syntaxOnlyOrLanguageServiceMode; + } + var syntaxTreeCache = new SyntaxTreeCache(host); + var program; + var lastProjectVersion; + var lastTypesRootVersion = 0; + var cancellationToken = host.getCancellationToken ? new CancellationTokenObject(host.getCancellationToken()) : NoopCancellationToken; + var currentDirectory = host.getCurrentDirectory(); + ts6.maybeSetLocalizedDiagnosticMessages((_b = host.getLocalizedDiagnosticMessages) === null || _b === void 0 ? void 0 : _b.bind(host)); + function log(message) { + if (host.log) { + host.log(message); + } + } + var useCaseSensitiveFileNames = ts6.hostUsesCaseSensitiveFileNames(host); + var getCanonicalFileName = ts6.createGetCanonicalFileName(useCaseSensitiveFileNames); + var sourceMapper = ts6.getSourceMapper({ + useCaseSensitiveFileNames: function() { + return useCaseSensitiveFileNames; + }, + getCurrentDirectory: function() { + return currentDirectory; + }, + getProgram, + fileExists: ts6.maybeBind(host, host.fileExists), + readFile: ts6.maybeBind(host, host.readFile), + getDocumentPositionMapper: ts6.maybeBind(host, host.getDocumentPositionMapper), + getSourceFileLike: ts6.maybeBind(host, host.getSourceFileLike), + log + }); + function getValidSourceFile(fileName) { + var sourceFile = program.getSourceFile(fileName); + if (!sourceFile) { + var error = new Error("Could not find source file: '".concat(fileName, "'.")); + error.ProgramFiles = program.getSourceFiles().map(function(f) { + return f.fileName; + }); + throw error; + } + return sourceFile; + } + function synchronizeHostData() { + var _a2, _b2, _c; + ts6.Debug.assert(languageServiceMode !== ts6.LanguageServiceMode.Syntactic); + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion && !((_a2 = host.hasChangedAutomaticTypeDirectiveNames) === null || _a2 === void 0 ? void 0 : _a2.call(host))) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } + var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0; + if (lastTypesRootVersion !== typeRootsVersion) { + log("TypeRoots version has changed; provide new program"); + program = void 0; + lastTypesRootVersion = typeRootsVersion; + } + var rootFileNames = host.getScriptFileNames().slice(); + var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts6.returnFalse; + var hasChangedAutomaticTypeDirectiveNames = ts6.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); + var projectReferences = (_b2 = host.getProjectReferences) === null || _b2 === void 0 ? void 0 : _b2.call(host); + var parsedCommandLines; + var compilerHost = { + getSourceFile: getOrCreateSourceFile, + getSourceFileByPath: getOrCreateSourceFileByPath, + getCancellationToken: function() { + return cancellationToken; + }, + getCanonicalFileName, + useCaseSensitiveFileNames: function() { + return useCaseSensitiveFileNames; + }, + getNewLine: function() { + return ts6.getNewLineCharacter(newSettings, function() { + return ts6.getNewLineOrDefaultFromHost(host); + }); + }, + getDefaultLibFileName: function(options2) { + return host.getDefaultLibFileName(options2); + }, + writeFile: ts6.noop, + getCurrentDirectory: function() { + return currentDirectory; + }, + fileExists: function(fileName) { + return host.fileExists(fileName); + }, + readFile: function(fileName) { + return host.readFile && host.readFile(fileName); + }, + getSymlinkCache: ts6.maybeBind(host, host.getSymlinkCache), + realpath: ts6.maybeBind(host, host.realpath), + directoryExists: function(directoryName) { + return ts6.directoryProbablyExists(directoryName, host); + }, + getDirectories: function(path) { + return host.getDirectories ? host.getDirectories(path) : []; + }, + readDirectory: function(path, extensions, exclude, include, depth) { + ts6.Debug.checkDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'"); + return host.readDirectory(path, extensions, exclude, include, depth); + }, + onReleaseOldSourceFile, + onReleaseParsedCommandLine, + hasInvalidatedResolutions, + hasChangedAutomaticTypeDirectiveNames, + trace: ts6.maybeBind(host, host.trace), + resolveModuleNames: ts6.maybeBind(host, host.resolveModuleNames), + getModuleResolutionCache: ts6.maybeBind(host, host.getModuleResolutionCache), + resolveTypeReferenceDirectives: ts6.maybeBind(host, host.resolveTypeReferenceDirectives), + useSourceOfProjectReferenceRedirect: ts6.maybeBind(host, host.useSourceOfProjectReferenceRedirect), + getParsedCommandLine + }; + var originalGetSourceFile = compilerHost.getSourceFile; + var getSourceFileWithCache = ts6.changeCompilerHostLikeToUseCache(compilerHost, function(fileName) { + return ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + }, function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false)); + }).getSourceFileWithCache; + compilerHost.getSourceFile = getSourceFileWithCache; + (_c = host.setCompilerHost) === null || _c === void 0 ? void 0 : _c.call(host, compilerHost); + var parseConfigHost = { + useCaseSensitiveFileNames, + fileExists: function(fileName) { + return compilerHost.fileExists(fileName); + }, + readFile: function(fileName) { + return compilerHost.readFile(fileName); + }, + readDirectory: function() { + var _a3; + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return (_a3 = compilerHost).readDirectory.apply(_a3, args); + }, + trace: compilerHost.trace, + getCurrentDirectory: compilerHost.getCurrentDirectory, + onUnRecoverableConfigFileDiagnostic: ts6.noop + }; + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); + if (ts6.isProgramUptoDate(program, rootFileNames, newSettings, function(_path, fileName) { + return host.getScriptVersion(fileName); + }, function(fileName) { + return compilerHost.fileExists(fileName); + }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + return; + } + var options = { + rootNames: rootFileNames, + options: newSettings, + host: compilerHost, + oldProgram: program, + projectReferences + }; + program = ts6.createProgram(options); + compilerHost = void 0; + parsedCommandLines = void 0; + sourceMapper.clearCache(); + program.getTypeChecker(); + return; + function getParsedCommandLine(fileName) { + var path = ts6.toPath(fileName, currentDirectory, getCanonicalFileName); + var existing = parsedCommandLines === null || parsedCommandLines === void 0 ? void 0 : parsedCommandLines.get(path); + if (existing !== void 0) + return existing || void 0; + var result = host.getParsedCommandLine ? host.getParsedCommandLine(fileName) : getParsedCommandLineOfConfigFileUsingSourceFile(fileName); + (parsedCommandLines || (parsedCommandLines = new ts6.Map())).set(path, result || false); + return result; + } + function getParsedCommandLineOfConfigFileUsingSourceFile(configFileName) { + var result = getOrCreateSourceFile( + configFileName, + 100 + /* ScriptTarget.JSON */ + ); + if (!result) + return void 0; + result.path = ts6.toPath(configFileName, currentDirectory, getCanonicalFileName); + result.resolvedPath = result.path; + result.originalFileName = result.fileName; + return ts6.parseJsonSourceFileConfigFileContent( + result, + parseConfigHost, + ts6.getNormalizedAbsolutePath(ts6.getDirectoryPath(configFileName), currentDirectory), + /*optionsToExtend*/ + void 0, + ts6.getNormalizedAbsolutePath(configFileName, currentDirectory) + ); + } + function onReleaseParsedCommandLine(configFileName, oldResolvedRef, oldOptions) { + var _a3; + if (host.getParsedCommandLine) { + (_a3 = host.onReleaseParsedCommandLine) === null || _a3 === void 0 ? void 0 : _a3.call(host, configFileName, oldResolvedRef, oldOptions); + } else if (oldResolvedRef) { + onReleaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions); + } + } + function onReleaseOldSourceFile(oldSourceFile, oldOptions) { + var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldOptions); + documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, oldSettingsKey, oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat); + } + function getOrCreateSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { + return getOrCreateSourceFileByPath(fileName, ts6.toPath(fileName, currentDirectory, getCanonicalFileName), languageVersionOrOptions, onError, shouldCreateNewSourceFile); + } + function getOrCreateSourceFileByPath(fileName, path, languageVersionOrOptions, _onError, shouldCreateNewSourceFile) { + ts6.Debug.assert(compilerHost, "getOrCreateSourceFileByPath called after typical CompilerHost lifetime, check the callstack something with a reference to an old host."); + var scriptSnapshot = host.getScriptSnapshot(fileName); + if (!scriptSnapshot) { + return void 0; + } + var scriptKind = ts6.getScriptKind(fileName, host); + var scriptVersion = host.getScriptVersion(fileName); + if (!shouldCreateNewSourceFile) { + var oldSourceFile = program && program.getSourceFileByPath(path); + if (oldSourceFile) { + if (scriptKind === oldSourceFile.scriptKind) { + return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions); + } else { + documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat); + } + } + } + return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions); + } + } + function getProgram() { + if (languageServiceMode === ts6.LanguageServiceMode.Syntactic) { + ts6.Debug.assert(program === void 0); + return void 0; + } + synchronizeHostData(); + return program; + } + function getAutoImportProvider() { + var _a2; + return (_a2 = host.getPackageJsonAutoImportProvider) === null || _a2 === void 0 ? void 0 : _a2.call(host); + } + function updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans) { + var checker = program.getTypeChecker(); + var symbol = getSymbolForProgram(); + if (!symbol) + return false; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var referencedSymbol = referencedSymbols_1[_i]; + for (var _a2 = 0, _b2 = referencedSymbol.references; _a2 < _b2.length; _a2++) { + var ref = _b2[_a2]; + var refNode = getNodeForSpan(ref); + ts6.Debug.assertIsDefined(refNode); + if (knownSymbolSpans.has(ref) || ts6.FindAllReferences.isDeclarationOfSymbol(refNode, symbol)) { + knownSymbolSpans.add(ref); + ref.isDefinition = true; + var mappedSpan = ts6.getMappedDocumentSpan(ref, sourceMapper, ts6.maybeBind(host, host.fileExists)); + if (mappedSpan) { + knownSymbolSpans.add(mappedSpan); + } + } else { + ref.isDefinition = false; + } + } + } + return true; + function getSymbolForProgram() { + for (var _i2 = 0, referencedSymbols_2 = referencedSymbols; _i2 < referencedSymbols_2.length; _i2++) { + var referencedSymbol2 = referencedSymbols_2[_i2]; + for (var _a3 = 0, _b3 = referencedSymbol2.references; _a3 < _b3.length; _a3++) { + var ref2 = _b3[_a3]; + if (knownSymbolSpans.has(ref2)) { + var refNode2 = getNodeForSpan(ref2); + ts6.Debug.assertIsDefined(refNode2); + return checker.getSymbolAtLocation(refNode2); + } + var mappedSpan2 = ts6.getMappedDocumentSpan(ref2, sourceMapper, ts6.maybeBind(host, host.fileExists)); + if (mappedSpan2 && knownSymbolSpans.has(mappedSpan2)) { + var refNode2 = getNodeForSpan(mappedSpan2); + if (refNode2) { + return checker.getSymbolAtLocation(refNode2); + } + } + } + } + return void 0; + } + function getNodeForSpan(docSpan) { + var sourceFile = program.getSourceFile(docSpan.fileName); + if (!sourceFile) + return void 0; + var rawNode = ts6.getTouchingPropertyName(sourceFile, docSpan.textSpan.start); + var adjustedNode = ts6.FindAllReferences.Core.getAdjustedNode(rawNode, { + use: 1 + /* FindAllReferences.FindReferencesUse.References */ + }); + return adjustedNode; + } + } + function cleanupSemanticCache() { + program = void 0; + } + function dispose() { + if (program) { + var key_1 = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()); + ts6.forEach(program.getSourceFiles(), function(f) { + return documentRegistry.releaseDocumentWithKey(f.resolvedPath, key_1, f.scriptKind, f.impliedNodeFormat); + }); + program = void 0; + } + host = void 0; + } + function getSyntacticDiagnostics(fileName) { + synchronizeHostData(); + return program.getSyntacticDiagnostics(getValidSourceFile(fileName), cancellationToken).slice(); + } + function getSemanticDiagnostics(fileName) { + synchronizeHostData(); + var targetSourceFile = getValidSourceFile(fileName); + var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); + if (!ts6.getEmitDeclarations(program.getCompilerOptions())) { + return semanticDiagnostics.slice(); + } + var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); + return __spreadArray(__spreadArray([], semanticDiagnostics, true), declarationDiagnostics, true); + } + function getSuggestionDiagnostics(fileName) { + synchronizeHostData(); + return ts6.computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken); + } + function getCompilerOptionsDiagnostics() { + synchronizeHostData(); + return __spreadArray(__spreadArray([], program.getOptionsDiagnostics(cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true); + } + function getCompletionsAtPosition(fileName, position, options, formattingSettings) { + if (options === void 0) { + options = ts6.emptyOptions; + } + var fullPreferences = __assign(__assign({}, ts6.identity(options)), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); + synchronizeHostData(); + return ts6.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences, options.triggerCharacter, options.triggerKind, cancellationToken, formattingSettings && ts6.formatting.getFormatContext(formattingSettings, host)); + } + function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences, data) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + return ts6.Completions.getCompletionEntryDetails( + program, + log, + getValidSourceFile(fileName), + position, + { name, source, data }, + host, + formattingOptions && ts6.formatting.getFormatContext(formattingOptions, host), + // TODO: GH#18217 + preferences, + cancellationToken + ); + } + function getCompletionEntrySymbol(fileName, position, name, source, preferences) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + return ts6.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences); + } + function getQuickInfoAtPosition(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var node = ts6.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return void 0; + } + var typeChecker = program.getTypeChecker(); + var nodeForQuickInfo = getNodeForQuickInfo(node); + var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker); + if (!symbol || typeChecker.isUnknownSymbol(symbol)) { + var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : void 0; + return type_2 && { + kind: "", + kindModifiers: "", + textSpan: ts6.createTextSpanFromNode(nodeForQuickInfo, sourceFile), + displayParts: typeChecker.runWithCancellationToken(cancellationToken, function(typeChecker2) { + return ts6.typeToDisplayParts(typeChecker2, type_2, ts6.getContainerNode(nodeForQuickInfo)); + }), + documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : void 0, + tags: type_2.symbol ? type_2.symbol.getJsDocTags(typeChecker) : void 0 + }; + } + var _a2 = typeChecker.runWithCancellationToken(cancellationToken, function(typeChecker2) { + return ts6.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker2, symbol, sourceFile, ts6.getContainerNode(nodeForQuickInfo), nodeForQuickInfo); + }), symbolKind = _a2.symbolKind, displayParts = _a2.displayParts, documentation = _a2.documentation, tags = _a2.tags; + return { + kind: symbolKind, + kindModifiers: ts6.SymbolDisplay.getSymbolModifiers(typeChecker, symbol), + textSpan: ts6.createTextSpanFromNode(nodeForQuickInfo, sourceFile), + displayParts, + documentation, + tags + }; + } + function getNodeForQuickInfo(node) { + if (ts6.isNewExpression(node.parent) && node.pos === node.parent.pos) { + return node.parent.expression; + } + if (ts6.isNamedTupleMember(node.parent) && node.pos === node.parent.pos) { + return node.parent; + } + if (ts6.isImportMeta(node.parent) && node.parent.name === node) { + return node.parent; + } + return node; + } + function shouldGetType(sourceFile, node, position) { + switch (node.kind) { + case 79: + return !ts6.isLabelName(node) && !ts6.isTagName(node) && !ts6.isConstTypeReference(node.parent); + case 208: + case 163: + return !ts6.isInComment(sourceFile, position); + case 108: + case 194: + case 106: + case 199: + return true; + case 233: + return ts6.isImportMeta(node); + default: + return false; + } + } + function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) { + synchronizeHostData(); + return ts6.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias); + } + function getDefinitionAndBoundSpan(fileName, position) { + synchronizeHostData(); + return ts6.GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position); + } + function getTypeDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + return ts6.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); + } + function getImplementationAtPosition(fileName, position) { + synchronizeHostData(); + return ts6.FindAllReferences.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } + function getOccurrencesAtPosition(fileName, position) { + return ts6.flatMap(getDocumentHighlights(fileName, position, [fileName]), function(entry) { + return entry.highlightSpans.map(function(highlightSpan) { + return __assign(__assign({ + fileName: entry.fileName, + textSpan: highlightSpan.textSpan, + isWriteAccess: highlightSpan.kind === "writtenReference" + /* HighlightSpanKind.writtenReference */ + }, highlightSpan.isInString && { isInString: true }), highlightSpan.contextSpan && { contextSpan: highlightSpan.contextSpan }); + }); + }); + } + function getDocumentHighlights(fileName, position, filesToSearch) { + var normalizedFileName = ts6.normalizePath(fileName); + ts6.Debug.assert(filesToSearch.some(function(f) { + return ts6.normalizePath(f) === normalizedFileName; + })); + synchronizeHostData(); + var sourceFilesToSearch = ts6.mapDefined(filesToSearch, function(fileName2) { + return program.getSourceFile(fileName2); + }); + var sourceFile = getValidSourceFile(fileName); + return ts6.DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch); + } + function findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var node = ts6.getAdjustedRenameLocation(ts6.getTouchingPropertyName(sourceFile, position)); + if (!ts6.Rename.nodeIsEligibleForRename(node)) + return void 0; + if (ts6.isIdentifier(node) && (ts6.isJsxOpeningElement(node.parent) || ts6.isJsxClosingElement(node.parent)) && ts6.isIntrinsicJsxName(node.escapedText)) { + var _a2 = node.parent.parent, openingElement = _a2.openingElement, closingElement = _a2.closingElement; + return [openingElement, closingElement].map(function(node2) { + var textSpan = ts6.createTextSpanFromNode(node2.tagName, sourceFile); + return __assign({ fileName: sourceFile.fileName, textSpan }, ts6.FindAllReferences.toContextSpan(textSpan, sourceFile, node2.parent)); + }); + } else { + return getReferencesWorker(node, position, { + findInStrings, + findInComments, + providePrefixAndSuffixTextForRename, + use: 2 + /* FindAllReferences.FindReferencesUse.Rename */ + }, function(entry, originalNode, checker) { + return ts6.FindAllReferences.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false); + }); + } + } + function getReferencesAtPosition(fileName, position) { + synchronizeHostData(); + return getReferencesWorker(ts6.getTouchingPropertyName(getValidSourceFile(fileName), position), position, { + use: 1 + /* FindAllReferences.FindReferencesUse.References */ + }, ts6.FindAllReferences.toReferenceEntry); + } + function getReferencesWorker(node, position, options, cb) { + synchronizeHostData(); + var sourceFiles = options && options.use === 2 ? program.getSourceFiles().filter(function(sourceFile) { + return !program.isSourceFileDefaultLibrary(sourceFile); + }) : program.getSourceFiles(); + return ts6.FindAllReferences.findReferenceOrRenameEntries(program, cancellationToken, sourceFiles, node, position, options, cb); + } + function findReferences(fileName, position) { + synchronizeHostData(); + return ts6.FindAllReferences.findReferencedSymbols(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } + function getFileReferences(fileName) { + synchronizeHostData(); + return ts6.FindAllReferences.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(ts6.FindAllReferences.toReferenceEntry); + } + function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { + if (excludeDtsFiles === void 0) { + excludeDtsFiles = false; + } + synchronizeHostData(); + var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); + return ts6.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles); + } + function getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var customTransformers = host.getCustomTransformers && host.getCustomTransformers(); + return ts6.getFileEmitOutput(program, sourceFile, !!emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit); + } + function getSignatureHelpItems(fileName, position, _a2) { + var _b2 = _a2 === void 0 ? ts6.emptyOptions : _a2, triggerReason = _b2.triggerReason; + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + return ts6.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, triggerReason, cancellationToken); + } + function getNonBoundSourceFile(fileName) { + return syntaxTreeCache.getCurrentSourceFile(fileName); + } + function getNameOrDottedNameSpan(fileName, startPos, _endPos) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var node = ts6.getTouchingPropertyName(sourceFile, startPos); + if (node === sourceFile) { + return void 0; + } + switch (node.kind) { + case 208: + case 163: + case 10: + case 95: + case 110: + case 104: + case 106: + case 108: + case 194: + case 79: + break; + default: + return void 0; + } + var nodeForStartPos = node; + while (true) { + if (ts6.isRightSideOfPropertyAccess(nodeForStartPos) || ts6.isRightSideOfQualifiedName(nodeForStartPos)) { + nodeForStartPos = nodeForStartPos.parent; + } else if (ts6.isNameOfModuleDeclaration(nodeForStartPos)) { + if (nodeForStartPos.parent.parent.kind === 264 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + nodeForStartPos = nodeForStartPos.parent.parent.name; + } else { + break; + } + } else { + break; + } + } + return ts6.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); + } + function getBreakpointStatementAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts6.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); + } + function getNavigationBarItems(fileName) { + return ts6.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); + } + function getNavigationTree(fileName) { + return ts6.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); + } + function getSemanticClassifications(fileName, span, format) { + synchronizeHostData(); + var responseFormat = format || "original"; + if (responseFormat === "2020") { + return ts6.classifier.v2020.getSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); + } else { + return ts6.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); + } + } + function getEncodedSemanticClassifications(fileName, span, format) { + synchronizeHostData(); + var responseFormat = format || "original"; + if (responseFormat === "original") { + return ts6.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); + } else { + return ts6.classifier.v2020.getEncodedSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); + } + } + function getSyntacticClassifications(fileName, span) { + return ts6.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); + } + function getEncodedSyntacticClassifications(fileName, span) { + return ts6.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); + } + function getOutliningSpans(fileName) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts6.OutliningElementsCollector.collectElements(sourceFile, cancellationToken); + } + var braceMatching = new ts6.Map(ts6.getEntries((_a = {}, _a[ + 18 + /* SyntaxKind.OpenBraceToken */ + ] = 19, _a[ + 20 + /* SyntaxKind.OpenParenToken */ + ] = 21, _a[ + 22 + /* SyntaxKind.OpenBracketToken */ + ] = 23, _a[ + 31 + /* SyntaxKind.GreaterThanToken */ + ] = 29, _a))); + braceMatching.forEach(function(value, key) { + return braceMatching.set(value.toString(), Number(key)); + }); + function getBraceMatchingAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var token = ts6.getTouchingToken(sourceFile, position); + var matchKind = token.getStart(sourceFile) === position ? braceMatching.get(token.kind.toString()) : void 0; + var match = matchKind && ts6.findChildOfKind(token.parent, matchKind, sourceFile); + return match ? [ts6.createTextSpanFromNode(token, sourceFile), ts6.createTextSpanFromNode(match, sourceFile)].sort(function(a, b) { + return a.start - b.start; + }) : ts6.emptyArray; + } + function getIndentationAtPosition(fileName, position, editorOptions) { + var start = ts6.timestamp(); + var settings = toEditorSettings(editorOptions); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + log("getIndentationAtPosition: getCurrentSourceFile: " + (ts6.timestamp() - start)); + start = ts6.timestamp(); + var result = ts6.formatting.SmartIndenter.getIndentation(position, sourceFile, settings); + log("getIndentationAtPosition: computeIndentation : " + (ts6.timestamp() - start)); + return result; + } + function getFormattingEditsForRange(fileName, start, end, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts6.formatting.formatSelection(start, end, sourceFile, ts6.formatting.getFormatContext(toEditorSettings(options), host)); + } + function getFormattingEditsForDocument(fileName, options) { + return ts6.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts6.formatting.getFormatContext(toEditorSettings(options), host)); + } + function getFormattingEditsAfterKeystroke(fileName, position, key, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var formatContext = ts6.formatting.getFormatContext(toEditorSettings(options), host); + if (!ts6.isInComment(sourceFile, position)) { + switch (key) { + case "{": + return ts6.formatting.formatOnOpeningCurly(position, sourceFile, formatContext); + case "}": + return ts6.formatting.formatOnClosingCurly(position, sourceFile, formatContext); + case ";": + return ts6.formatting.formatOnSemicolon(position, sourceFile, formatContext); + case "\n": + return ts6.formatting.formatOnEnter(position, sourceFile, formatContext); + } + } + return []; + } + function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions, preferences) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var span = ts6.createTextSpanFromBounds(start, end); + var formatContext = ts6.formatting.getFormatContext(formatOptions, host); + return ts6.flatMap(ts6.deduplicate(errorCodes, ts6.equateValues, ts6.compareValues), function(errorCode) { + cancellationToken.throwIfCancellationRequested(); + return ts6.codefix.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences }); + }); + } + function getCombinedCodeFix(scope, fixId, formatOptions, preferences) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + ts6.Debug.assert(scope.type === "file"); + var sourceFile = getValidSourceFile(scope.fileName); + var formatContext = ts6.formatting.getFormatContext(formatOptions, host); + return ts6.codefix.getAllFixes({ fixId, sourceFile, program, host, cancellationToken, formatContext, preferences }); + } + function organizeImports(args, formatOptions, preferences) { + var _a2; + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + ts6.Debug.assert(args.type === "file"); + var sourceFile = getValidSourceFile(args.fileName); + var formatContext = ts6.formatting.getFormatContext(formatOptions, host); + var mode = (_a2 = args.mode) !== null && _a2 !== void 0 ? _a2 : args.skipDestructiveCodeActions ? "SortAndCombine" : "All"; + return ts6.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); + } + function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + return ts6.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts6.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper); + } + function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) { + var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName; + return ts6.isArray(action) ? Promise.all(action.map(function(a) { + return applySingleCodeActionCommand(a); + })) : applySingleCodeActionCommand(action); + } + function applySingleCodeActionCommand(action) { + var getPath = function(path) { + return ts6.toPath(path, currentDirectory, getCanonicalFileName); + }; + ts6.Debug.assertEqual(action.type, "install package"); + return host.installPackage ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`"); + } + function getDocCommentTemplateAtPosition(fileName, position, options) { + return ts6.JsDoc.getDocCommentTemplateAtPosition(ts6.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position, options); + } + function isValidBraceCompletionAtPosition(fileName, position, openingBrace) { + if (openingBrace === 60) { + return false; + } + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (ts6.isInString(sourceFile, position)) { + return false; + } + if (ts6.isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === 123; + } + if (ts6.isInTemplateString(sourceFile, position)) { + return false; + } + switch (openingBrace) { + case 39: + case 34: + case 96: + return !ts6.isInComment(sourceFile, position); + } + return true; + } + function getJsxClosingTagAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var token = ts6.findPrecedingToken(position, sourceFile); + if (!token) + return void 0; + var element = token.kind === 31 && ts6.isJsxOpeningElement(token.parent) ? token.parent.parent : ts6.isJsxText(token) && ts6.isJsxElement(token.parent) ? token.parent : void 0; + if (element && isUnclosedTag(element)) { + return { newText: "") }; + } + var fragment = token.kind === 31 && ts6.isJsxOpeningFragment(token.parent) ? token.parent.parent : ts6.isJsxText(token) && ts6.isJsxFragment(token.parent) ? token.parent : void 0; + if (fragment && isUnclosedFragment(fragment)) { + return { newText: "" }; + } + } + function getLinesForRange(sourceFile, textRange) { + return { + lineStarts: sourceFile.getLineStarts(), + firstLine: sourceFile.getLineAndCharacterOfPosition(textRange.pos).line, + lastLine: sourceFile.getLineAndCharacterOfPosition(textRange.end).line + }; + } + function toggleLineComment(fileName, textRange, insertComment) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var textChanges = []; + var _a2 = getLinesForRange(sourceFile, textRange), lineStarts = _a2.lineStarts, firstLine = _a2.firstLine, lastLine = _a2.lastLine; + var isCommenting = insertComment || false; + var leftMostPosition = Number.MAX_VALUE; + var lineTextStarts = new ts6.Map(); + var firstNonWhitespaceCharacterRegex = new RegExp(/\S/); + var isJsx = ts6.isInsideJsxElement(sourceFile, lineStarts[firstLine]); + var openComment = isJsx ? "{/*" : "//"; + for (var i = firstLine; i <= lastLine; i++) { + var lineText = sourceFile.text.substring(lineStarts[i], sourceFile.getLineEndOfPosition(lineStarts[i])); + var regExec = firstNonWhitespaceCharacterRegex.exec(lineText); + if (regExec) { + leftMostPosition = Math.min(leftMostPosition, regExec.index); + lineTextStarts.set(i.toString(), regExec.index); + if (lineText.substr(regExec.index, openComment.length) !== openComment) { + isCommenting = insertComment === void 0 || insertComment; + } + } + } + for (var i = firstLine; i <= lastLine; i++) { + if (firstLine !== lastLine && lineStarts[i] === textRange.end) { + continue; + } + var lineTextStart = lineTextStarts.get(i.toString()); + if (lineTextStart !== void 0) { + if (isJsx) { + textChanges.push.apply(textChanges, toggleMultilineComment(fileName, { pos: lineStarts[i] + leftMostPosition, end: sourceFile.getLineEndOfPosition(lineStarts[i]) }, isCommenting, isJsx)); + } else if (isCommenting) { + textChanges.push({ + newText: openComment, + span: { + length: 0, + start: lineStarts[i] + leftMostPosition + } + }); + } else if (sourceFile.text.substr(lineStarts[i] + lineTextStart, openComment.length) === openComment) { + textChanges.push({ + newText: "", + span: { + length: openComment.length, + start: lineStarts[i] + lineTextStart + } + }); + } + } + } + return textChanges; + } + function toggleMultilineComment(fileName, textRange, insertComment, isInsideJsx) { + var _a2; + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var textChanges = []; + var text = sourceFile.text; + var hasComment = false; + var isCommenting = insertComment || false; + var positions = []; + var pos = textRange.pos; + var isJsx = isInsideJsx !== void 0 ? isInsideJsx : ts6.isInsideJsxElement(sourceFile, pos); + var openMultiline = isJsx ? "{/*" : "/*"; + var closeMultiline = isJsx ? "*/}" : "*/"; + var openMultilineRegex = isJsx ? "\\{\\/\\*" : "\\/\\*"; + var closeMultilineRegex = isJsx ? "\\*\\/\\}" : "\\*\\/"; + while (pos <= textRange.end) { + var offset = text.substr(pos, openMultiline.length) === openMultiline ? openMultiline.length : 0; + var commentRange = ts6.isInComment(sourceFile, pos + offset); + if (commentRange) { + if (isJsx) { + commentRange.pos--; + commentRange.end++; + } + positions.push(commentRange.pos); + if (commentRange.kind === 3) { + positions.push(commentRange.end); + } + hasComment = true; + pos = commentRange.end + 1; + } else { + var newPos = text.substring(pos, textRange.end).search("(".concat(openMultilineRegex, ")|(").concat(closeMultilineRegex, ")")); + isCommenting = insertComment !== void 0 ? insertComment : isCommenting || !ts6.isTextWhiteSpaceLike(text, pos, newPos === -1 ? textRange.end : pos + newPos); + pos = newPos === -1 ? textRange.end + 1 : pos + newPos + closeMultiline.length; + } + } + if (isCommenting || !hasComment) { + if (((_a2 = ts6.isInComment(sourceFile, textRange.pos)) === null || _a2 === void 0 ? void 0 : _a2.kind) !== 2) { + ts6.insertSorted(positions, textRange.pos, ts6.compareValues); + } + ts6.insertSorted(positions, textRange.end, ts6.compareValues); + var firstPos = positions[0]; + if (text.substr(firstPos, openMultiline.length) !== openMultiline) { + textChanges.push({ + newText: openMultiline, + span: { + length: 0, + start: firstPos + } + }); + } + for (var i = 1; i < positions.length - 1; i++) { + if (text.substr(positions[i] - closeMultiline.length, closeMultiline.length) !== closeMultiline) { + textChanges.push({ + newText: closeMultiline, + span: { + length: 0, + start: positions[i] + } + }); + } + if (text.substr(positions[i], openMultiline.length) !== openMultiline) { + textChanges.push({ + newText: openMultiline, + span: { + length: 0, + start: positions[i] + } + }); + } + } + if (textChanges.length % 2 !== 0) { + textChanges.push({ + newText: closeMultiline, + span: { + length: 0, + start: positions[positions.length - 1] + } + }); + } + } else { + for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { + var pos_2 = positions_1[_i]; + var from = pos_2 - closeMultiline.length > 0 ? pos_2 - closeMultiline.length : 0; + var offset = text.substr(from, closeMultiline.length) === closeMultiline ? closeMultiline.length : 0; + textChanges.push({ + newText: "", + span: { + length: openMultiline.length, + start: pos_2 - offset + } + }); + } + } + return textChanges; + } + function commentSelection(fileName, textRange) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var _a2 = getLinesForRange(sourceFile, textRange), firstLine = _a2.firstLine, lastLine = _a2.lastLine; + return firstLine === lastLine && textRange.pos !== textRange.end ? toggleMultilineComment( + fileName, + textRange, + /*insertComment*/ + true + ) : toggleLineComment( + fileName, + textRange, + /*insertComment*/ + true + ); + } + function uncommentSelection(fileName, textRange) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var textChanges = []; + var pos = textRange.pos; + var end = textRange.end; + if (pos === end) { + end += ts6.isInsideJsxElement(sourceFile, pos) ? 2 : 1; + } + for (var i = pos; i <= end; i++) { + var commentRange = ts6.isInComment(sourceFile, i); + if (commentRange) { + switch (commentRange.kind) { + case 2: + textChanges.push.apply(textChanges, toggleLineComment( + fileName, + { end: commentRange.end, pos: commentRange.pos + 1 }, + /*insertComment*/ + false + )); + break; + case 3: + textChanges.push.apply(textChanges, toggleMultilineComment( + fileName, + { end: commentRange.end, pos: commentRange.pos + 1 }, + /*insertComment*/ + false + )); + } + i = commentRange.end + 1; + } + } + return textChanges; + } + function isUnclosedTag(_a2) { + var openingElement = _a2.openingElement, closingElement = _a2.closingElement, parent = _a2.parent; + return !ts6.tagNamesAreEquivalent(openingElement.tagName, closingElement.tagName) || ts6.isJsxElement(parent) && ts6.tagNamesAreEquivalent(openingElement.tagName, parent.openingElement.tagName) && isUnclosedTag(parent); + } + function isUnclosedFragment(_a2) { + var closingFragment = _a2.closingFragment, parent = _a2.parent; + return !!(closingFragment.flags & 131072) || ts6.isJsxFragment(parent) && isUnclosedFragment(parent); + } + function getSpanOfEnclosingComment(fileName, position, onlyMultiLine) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var range2 = ts6.formatting.getRangeOfEnclosingComment(sourceFile, position); + return range2 && (!onlyMultiLine || range2.kind === 3) ? ts6.createTextSpanFromRange(range2) : void 0; + } + function getTodoComments(fileName, descriptors) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + cancellationToken.throwIfCancellationRequested(); + var fileContents = sourceFile.text; + var result = []; + if (descriptors.length > 0 && !isNodeModulesFile(sourceFile.fileName)) { + var regExp = getTodoCommentsRegExp(); + var matchArray = void 0; + while (matchArray = regExp.exec(fileContents)) { + cancellationToken.throwIfCancellationRequested(); + var firstDescriptorCaptureIndex = 3; + ts6.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); + var preamble = matchArray[1]; + var matchPosition = matchArray.index + preamble.length; + if (!ts6.isInComment(sourceFile, matchPosition)) { + continue; + } + var descriptor = void 0; + for (var i = 0; i < descriptors.length; i++) { + if (matchArray[i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[i]; + } + } + if (descriptor === void 0) + return ts6.Debug.fail(); + if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { + continue; + } + var message = matchArray[2]; + result.push({ descriptor, message, position: matchPosition }); + } + } + return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble2 = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts6.map(descriptors, function(d) { + return "(" + escapeRegExp(d.text) + ")"; + }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble2 + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function isLetterOrDigit(char) { + return char >= 97 && char <= 122 || char >= 65 && char <= 90 || char >= 48 && char <= 57; + } + function isNodeModulesFile(path) { + return ts6.stringContains(path, "/node_modules/"); + } + } + function getRenameInfo(fileName, position, preferences) { + synchronizeHostData(); + return ts6.Rename.getRenameInfo(program, getValidSourceFile(fileName), position, preferences || {}); + } + function getRefactorContext(file, positionOrRange, preferences, formatOptions, triggerReason, kind) { + var _a2 = typeof positionOrRange === "number" ? [positionOrRange, void 0] : [positionOrRange.pos, positionOrRange.end], startPosition = _a2[0], endPosition = _a2[1]; + return { + file, + startPosition, + endPosition, + program: getProgram(), + host, + formatContext: ts6.formatting.getFormatContext(formatOptions, host), + cancellationToken, + preferences, + triggerReason, + kind + }; + } + function getInlayHintsContext(file, span, preferences) { + return { + file, + program: getProgram(), + host, + span, + preferences, + cancellationToken + }; + } + function getSmartSelectionRange(fileName, position) { + return ts6.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); + } + function getApplicableRefactors(fileName, positionOrRange, preferences, triggerReason, kind) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + var file = getValidSourceFile(fileName); + return ts6.refactor.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, ts6.emptyOptions, triggerReason, kind)); + } + function getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + var file = getValidSourceFile(fileName); + return ts6.refactor.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName, actionName); + } + function toLineColumnOffset(fileName, position) { + if (position === 0) { + return { line: 0, character: 0 }; + } + return sourceMapper.toLineColumnOffset(fileName, position); + } + function prepareCallHierarchy(fileName, position) { + synchronizeHostData(); + var declarations = ts6.CallHierarchy.resolveCallHierarchyDeclaration(program, ts6.getTouchingPropertyName(getValidSourceFile(fileName), position)); + return declarations && ts6.mapOneOrMany(declarations, function(declaration) { + return ts6.CallHierarchy.createCallHierarchyItem(program, declaration); + }); + } + function provideCallHierarchyIncomingCalls(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var declaration = ts6.firstOrOnly(ts6.CallHierarchy.resolveCallHierarchyDeclaration(program, position === 0 ? sourceFile : ts6.getTouchingPropertyName(sourceFile, position))); + return declaration ? ts6.CallHierarchy.getIncomingCalls(program, declaration, cancellationToken) : []; + } + function provideCallHierarchyOutgoingCalls(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var declaration = ts6.firstOrOnly(ts6.CallHierarchy.resolveCallHierarchyDeclaration(program, position === 0 ? sourceFile : ts6.getTouchingPropertyName(sourceFile, position))); + return declaration ? ts6.CallHierarchy.getOutgoingCalls(program, declaration) : []; + } + function provideInlayHints(fileName, span, preferences) { + if (preferences === void 0) { + preferences = ts6.emptyOptions; + } + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + return ts6.InlayHints.provideInlayHints(getInlayHintsContext(sourceFile, span, preferences)); + } + var ls = { + dispose, + cleanupSemanticCache, + getSyntacticDiagnostics, + getSemanticDiagnostics, + getSuggestionDiagnostics, + getCompilerOptionsDiagnostics, + getSyntacticClassifications, + getSemanticClassifications, + getEncodedSyntacticClassifications, + getEncodedSemanticClassifications, + getCompletionsAtPosition, + getCompletionEntryDetails, + getCompletionEntrySymbol, + getSignatureHelpItems, + getQuickInfoAtPosition, + getDefinitionAtPosition, + getDefinitionAndBoundSpan, + getImplementationAtPosition, + getTypeDefinitionAtPosition, + getReferencesAtPosition, + findReferences, + getFileReferences, + getOccurrencesAtPosition, + getDocumentHighlights, + getNameOrDottedNameSpan, + getBreakpointStatementAtPosition, + getNavigateToItems, + getRenameInfo, + getSmartSelectionRange, + findRenameLocations, + getNavigationBarItems, + getNavigationTree, + getOutliningSpans, + getTodoComments, + getBraceMatchingAtPosition, + getIndentationAtPosition, + getFormattingEditsForRange, + getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke, + getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPosition, + getJsxClosingTagAtPosition, + getSpanOfEnclosingComment, + getCodeFixesAtPosition, + getCombinedCodeFix, + applyCodeActionCommand, + organizeImports, + getEditsForFileRename, + getEmitOutput, + getNonBoundSourceFile, + getProgram, + getCurrentProgram: function() { + return program; + }, + getAutoImportProvider, + updateIsDefinitionOfReferencedSymbols, + getApplicableRefactors, + getEditsForRefactor, + toLineColumnOffset, + getSourceMapper: function() { + return sourceMapper; + }, + clearSourceMapperCache: function() { + return sourceMapper.clearCache(); + }, + prepareCallHierarchy, + provideCallHierarchyIncomingCalls, + provideCallHierarchyOutgoingCalls, + toggleLineComment, + toggleMultilineComment, + commentSelection, + uncommentSelection, + provideInlayHints + }; + switch (languageServiceMode) { + case ts6.LanguageServiceMode.Semantic: + break; + case ts6.LanguageServiceMode.PartialSemantic: + invalidOperationsInPartialSemanticMode.forEach(function(key) { + return ls[key] = function() { + throw new Error("LanguageService Operation: ".concat(key, " not allowed in LanguageServiceMode.PartialSemantic")); + }; + }); + break; + case ts6.LanguageServiceMode.Syntactic: + invalidOperationsInSyntacticMode.forEach(function(key) { + return ls[key] = function() { + throw new Error("LanguageService Operation: ".concat(key, " not allowed in LanguageServiceMode.Syntactic")); + }; + }); + break; + default: + ts6.Debug.assertNever(languageServiceMode); + } + return ls; + } + ts6.createLanguageService = createLanguageService; + function getNameTable(sourceFile) { + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile); + } + return sourceFile.nameTable; + } + ts6.getNameTable = getNameTable; + function initializeNameTable(sourceFile) { + var nameTable = sourceFile.nameTable = new ts6.Map(); + sourceFile.forEachChild(function walk(node) { + if (ts6.isIdentifier(node) && !ts6.isTagName(node) && node.escapedText || ts6.isStringOrNumericLiteralLike(node) && literalIsName(node)) { + var text = ts6.getEscapedTextOfIdentifierOrLiteral(node); + nameTable.set(text, nameTable.get(text) === void 0 ? node.pos : -1); + } else if (ts6.isPrivateIdentifier(node)) { + var text = node.escapedText; + nameTable.set(text, nameTable.get(text) === void 0 ? node.pos : -1); + } + ts6.forEachChild(node, walk); + if (ts6.hasJSDocNodes(node)) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts6.forEachChild(jsDoc, walk); + } + } + }); + } + function literalIsName(node) { + return ts6.isDeclarationName(node) || node.parent.kind === 280 || isArgumentOfElementAccessExpression(node) || ts6.isLiteralComputedPropertyDeclarationName(node); + } + function getContainingObjectLiteralElement(node) { + var element = getContainingObjectLiteralElementWorker(node); + return element && (ts6.isObjectLiteralExpression(element.parent) || ts6.isJsxAttributes(element.parent)) ? element : void 0; + } + ts6.getContainingObjectLiteralElement = getContainingObjectLiteralElement; + function getContainingObjectLiteralElementWorker(node) { + switch (node.kind) { + case 10: + case 14: + case 8: + if (node.parent.kind === 164) { + return ts6.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0; + } + case 79: + return ts6.isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 207 || node.parent.parent.kind === 289) && node.parent.name === node ? node.parent : void 0; + } + return void 0; + } + function getSymbolAtLocationForQuickInfo(node, checker) { + var object = getContainingObjectLiteralElement(node); + if (object) { + var contextualType = checker.getContextualType(object.parent); + var properties = contextualType && getPropertySymbolsFromContextualType( + object, + checker, + contextualType, + /*unionSymbolOk*/ + false + ); + if (properties && properties.length === 1) { + return ts6.first(properties); + } + } + return checker.getSymbolAtLocation(node); + } + function getPropertySymbolsFromContextualType(node, checker, contextualType, unionSymbolOk) { + var name = ts6.getNameFromPropertyName(node.name); + if (!name) + return ts6.emptyArray; + if (!contextualType.isUnion()) { + var symbol = contextualType.getProperty(name); + return symbol ? [symbol] : ts6.emptyArray; + } + var discriminatedPropertySymbols = ts6.mapDefined(contextualType.types, function(t) { + return (ts6.isObjectLiteralExpression(node.parent) || ts6.isJsxAttributes(node.parent)) && checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent) ? void 0 : t.getProperty(name); + }); + if (unionSymbolOk && (discriminatedPropertySymbols.length === 0 || discriminatedPropertySymbols.length === contextualType.types.length)) { + var symbol = contextualType.getProperty(name); + if (symbol) + return [symbol]; + } + if (discriminatedPropertySymbols.length === 0) { + return ts6.mapDefined(contextualType.types, function(t) { + return t.getProperty(name); + }); + } + return discriminatedPropertySymbols; + } + ts6.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; + function isArgumentOfElementAccessExpression(node) { + return node && node.parent && node.parent.kind === 209 && node.parent.argumentExpression === node; + } + function getDefaultLibFilePath(options) { + if (typeof __dirname !== "undefined") { + return ts6.combinePaths(__dirname, ts6.getDefaultLibFileName(options)); + } + throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); + } + ts6.getDefaultLibFilePath = getDefaultLibFilePath; + ts6.setObjectAllocator(getServicesObjectAllocator()); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var BreakpointResolver; + (function(BreakpointResolver2) { + function spanInSourceFileAtLocation(sourceFile, position) { + if (sourceFile.isDeclarationFile) { + return void 0; + } + var tokenAtLocation = ts6.getTokenAtPosition(sourceFile, position); + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) { + var preceding = ts6.findPrecedingToken(tokenAtLocation.pos, sourceFile); + if (!preceding || sourceFile.getLineAndCharacterOfPosition(preceding.getEnd()).line !== lineOfPosition) { + return void 0; + } + tokenAtLocation = preceding; + } + if (tokenAtLocation.flags & 16777216) { + return void 0; + } + return spanInNode(tokenAtLocation); + function textSpan(startNode, endNode) { + var lastDecorator = ts6.canHaveDecorators(startNode) ? ts6.findLast(startNode.modifiers, ts6.isDecorator) : void 0; + var start = lastDecorator ? ts6.skipTrivia(sourceFile.text, lastDecorator.end) : startNode.getStart(sourceFile); + return ts6.createTextSpanFromBounds(start, (endNode || startNode).getEnd()); + } + function textSpanEndingAtNextToken(startNode, previousTokenToFindNextEndToken) { + return textSpan(startNode, ts6.findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent, sourceFile)); + } + function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) { + return spanInNode(node); + } + return spanInNode(otherwiseOnNode); + } + function spanInNodeArray(nodeArray, node, match) { + if (nodeArray) { + var index = nodeArray.indexOf(node); + if (index >= 0) { + var start = index; + var end = index + 1; + while (start > 0 && match(nodeArray[start - 1])) + start--; + while (end < nodeArray.length && match(nodeArray[end])) + end++; + return ts6.createTextSpanFromBounds(ts6.skipTrivia(sourceFile.text, nodeArray[start].pos), nodeArray[end - 1].end); + } + } + return textSpan(node); + } + function spanInPreviousNode(node) { + return spanInNode(ts6.findPrecedingToken(node.pos, sourceFile)); + } + function spanInNextNode(node) { + return spanInNode(ts6.findNextToken(node, node.parent, sourceFile)); + } + function spanInNode(node) { + if (node) { + var parent = node.parent; + switch (node.kind) { + case 240: + return spanInVariableDeclaration(node.declarationList.declarations[0]); + case 257: + case 169: + case 168: + return spanInVariableDeclaration(node); + case 166: + return spanInParameterDeclaration(node); + case 259: + case 171: + case 170: + case 174: + case 175: + case 173: + case 215: + case 216: + return spanInFunctionDeclaration(node); + case 238: + if (ts6.isFunctionBlock(node)) { + return spanInFunctionBlock(node); + } + case 265: + return spanInBlock(node); + case 295: + return spanInBlock(node.block); + case 241: + return textSpan(node.expression); + case 250: + return textSpan(node.getChildAt(0), node.expression); + case 244: + return textSpanEndingAtNextToken(node, node.expression); + case 243: + return spanInNode(node.statement); + case 256: + return textSpan(node.getChildAt(0)); + case 242: + return textSpanEndingAtNextToken(node, node.expression); + case 253: + return spanInNode(node.statement); + case 249: + case 248: + return textSpan(node.getChildAt(0), node.label); + case 245: + return spanInForStatement(node); + case 246: + return textSpanEndingAtNextToken(node, node.expression); + case 247: + return spanInInitializerOfForLike(node); + case 252: + return textSpanEndingAtNextToken(node, node.expression); + case 292: + case 293: + return spanInNode(node.statements[0]); + case 255: + return spanInBlock(node.tryBlock); + case 254: + return textSpan(node, node.expression); + case 274: + return textSpan(node, node.expression); + case 268: + return textSpan(node, node.moduleReference); + case 269: + return textSpan(node, node.moduleSpecifier); + case 275: + return textSpan(node, node.moduleSpecifier); + case 264: + if (ts6.getModuleInstanceState(node) !== 1) { + return void 0; + } + case 260: + case 263: + case 302: + case 205: + return textSpan(node); + case 251: + return spanInNode(node.statement); + case 167: + return spanInNodeArray(parent.modifiers, node, ts6.isDecorator); + case 203: + case 204: + return spanInBindingPattern(node); + case 261: + case 262: + return void 0; + case 26: + case 1: + return spanInNodeIfStartsOnSameLine(ts6.findPrecedingToken(node.pos, sourceFile)); + case 27: + return spanInPreviousNode(node); + case 18: + return spanInOpenBraceToken(node); + case 19: + return spanInCloseBraceToken(node); + case 23: + return spanInCloseBracketToken(node); + case 20: + return spanInOpenParenToken(node); + case 21: + return spanInCloseParenToken(node); + case 58: + return spanInColonToken(node); + case 31: + case 29: + return spanInGreaterThanOrLessThanToken(node); + case 115: + return spanInWhileKeyword(node); + case 91: + case 83: + case 96: + return spanInNextNode(node); + case 162: + return spanInOfKeyword(node); + default: + if (ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); + } + if ((node.kind === 79 || node.kind === 227 || node.kind === 299 || node.kind === 300) && ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { + return textSpan(node); + } + if (node.kind === 223) { + var _a = node, left = _a.left, operatorToken = _a.operatorToken; + if (ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) { + return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left); + } + if (operatorToken.kind === 63 && ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + return textSpan(node); + } + if (operatorToken.kind === 27) { + return spanInNode(left); + } + } + if (ts6.isExpressionNode(node)) { + switch (parent.kind) { + case 243: + return spanInPreviousNode(node); + case 167: + return spanInNode(node.parent); + case 245: + case 247: + return textSpan(node); + case 223: + if (node.parent.operatorToken.kind === 27) { + return textSpan(node); + } + break; + case 216: + if (node.parent.body === node) { + return textSpan(node); + } + break; + } + } + switch (node.parent.kind) { + case 299: + if (node.parent.name === node && !ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { + return spanInNode(node.parent.initializer); + } + break; + case 213: + if (node.parent.type === node) { + return spanInNextNode(node.parent.type); + } + break; + case 257: + case 166: { + var _b = node.parent, initializer = _b.initializer, type = _b.type; + if (initializer === node || type === node || ts6.isAssignmentOperator(node.kind)) { + return spanInPreviousNode(node); + } + break; + } + case 223: { + var left = node.parent.left; + if (ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { + return spanInPreviousNode(node); + } + break; + } + default: + if (ts6.isFunctionLike(node.parent) && node.parent.type === node) { + return spanInPreviousNode(node); + } + } + return spanInNode(node.parent); + } + } + function textSpanFromVariableDeclaration(variableDeclaration) { + if (ts6.isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] === variableDeclaration) { + return textSpan(ts6.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } else { + return textSpan(variableDeclaration); + } + } + function spanInVariableDeclaration(variableDeclaration) { + if (variableDeclaration.parent.parent.kind === 246) { + return spanInNode(variableDeclaration.parent.parent); + } + var parent2 = variableDeclaration.parent; + if (ts6.isBindingPattern(variableDeclaration.name)) { + return spanInBindingPattern(variableDeclaration.name); + } + if (ts6.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || ts6.hasSyntacticModifier( + variableDeclaration, + 1 + /* ModifierFlags.Export */ + ) || parent2.parent.kind === 247) { + return textSpanFromVariableDeclaration(variableDeclaration); + } + if (ts6.isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] !== variableDeclaration) { + return spanInNode(ts6.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); + } + } + function canHaveSpanInParameterDeclaration(parameter) { + return !!parameter.initializer || parameter.dotDotDotToken !== void 0 || ts6.hasSyntacticModifier( + parameter, + 4 | 8 + /* ModifierFlags.Private */ + ); + } + function spanInParameterDeclaration(parameter) { + if (ts6.isBindingPattern(parameter.name)) { + return spanInBindingPattern(parameter.name); + } else if (canHaveSpanInParameterDeclaration(parameter)) { + return textSpan(parameter); + } else { + var functionDeclaration = parameter.parent; + var indexOfParameter = functionDeclaration.parameters.indexOf(parameter); + ts6.Debug.assert(indexOfParameter !== -1); + if (indexOfParameter !== 0) { + return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); + } else { + return spanInNode(functionDeclaration.body); + } + } + } + function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { + return ts6.hasSyntacticModifier( + functionDeclaration, + 1 + /* ModifierFlags.Export */ + ) || functionDeclaration.parent.kind === 260 && functionDeclaration.kind !== 173; + } + function spanInFunctionDeclaration(functionDeclaration) { + if (!functionDeclaration.body) { + return void 0; + } + if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) { + return textSpan(functionDeclaration); + } + return spanInNode(functionDeclaration.body); + } + function spanInFunctionBlock(block) { + var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { + return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + } + return spanInNode(nodeForSpanInBlock); + } + function spanInBlock(block) { + switch (block.parent.kind) { + case 264: + if (ts6.getModuleInstanceState(block.parent) !== 1) { + return void 0; + } + case 244: + case 242: + case 246: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 245: + case 247: + return spanInNodeIfStartsOnSameLine(ts6.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); + } + return spanInNode(block.statements[0]); + } + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 258) { + var variableDeclarationList = forLikeStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } else { + return spanInNode(forLikeStatement.initializer); + } + } + function spanInForStatement(forStatement) { + if (forStatement.initializer) { + return spanInInitializerOfForLike(forStatement); + } + if (forStatement.condition) { + return textSpan(forStatement.condition); + } + if (forStatement.incrementor) { + return textSpan(forStatement.incrementor); + } + } + function spanInBindingPattern(bindingPattern) { + var firstBindingElement = ts6.forEach(bindingPattern.elements, function(element) { + return element.kind !== 229 ? element : void 0; + }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + if (bindingPattern.parent.kind === 205) { + return textSpan(bindingPattern.parent); + } + return textSpanFromVariableDeclaration(bindingPattern.parent); + } + function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node2) { + ts6.Debug.assert( + node2.kind !== 204 && node2.kind !== 203 + /* SyntaxKind.ObjectBindingPattern */ + ); + var elements = node2.kind === 206 ? node2.elements : node2.properties; + var firstBindingElement = ts6.forEach(elements, function(element) { + return element.kind !== 229 ? element : void 0; + }); + if (firstBindingElement) { + return spanInNode(firstBindingElement); + } + return textSpan(node2.parent.kind === 223 ? node2.parent : node2); + } + function spanInOpenBraceToken(node2) { + switch (node2.parent.kind) { + case 263: + var enumDeclaration = node2.parent; + return spanInNodeIfStartsOnSameLine(ts6.findPrecedingToken(node2.pos, sourceFile, node2.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); + case 260: + var classDeclaration = node2.parent; + return spanInNodeIfStartsOnSameLine(ts6.findPrecedingToken(node2.pos, sourceFile, node2.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); + case 266: + return spanInNodeIfStartsOnSameLine(node2.parent.parent, node2.parent.clauses[0]); + } + return spanInNode(node2.parent); + } + function spanInCloseBraceToken(node2) { + switch (node2.parent.kind) { + case 265: + if (ts6.getModuleInstanceState(node2.parent.parent) !== 1) { + return void 0; + } + case 263: + case 260: + return textSpan(node2); + case 238: + if (ts6.isFunctionBlock(node2.parent)) { + return textSpan(node2); + } + case 295: + return spanInNode(ts6.lastOrUndefined(node2.parent.statements)); + case 266: + var caseBlock = node2.parent; + var lastClause = ts6.lastOrUndefined(caseBlock.clauses); + if (lastClause) { + return spanInNode(ts6.lastOrUndefined(lastClause.statements)); + } + return void 0; + case 203: + var bindingPattern = node2.parent; + return spanInNode(ts6.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(node2.parent)) { + var objectLiteral = node2.parent; + return textSpan(ts6.lastOrUndefined(objectLiteral.properties) || objectLiteral); + } + return spanInNode(node2.parent); + } + } + function spanInCloseBracketToken(node2) { + switch (node2.parent.kind) { + case 204: + var bindingPattern = node2.parent; + return textSpan(ts6.lastOrUndefined(bindingPattern.elements) || bindingPattern); + default: + if (ts6.isArrayLiteralOrObjectLiteralDestructuringPattern(node2.parent)) { + var arrayLiteral = node2.parent; + return textSpan(ts6.lastOrUndefined(arrayLiteral.elements) || arrayLiteral); + } + return spanInNode(node2.parent); + } + } + function spanInOpenParenToken(node2) { + if (node2.parent.kind === 243 || // Go to while keyword and do action instead + node2.parent.kind === 210 || node2.parent.kind === 211) { + return spanInPreviousNode(node2); + } + if (node2.parent.kind === 214) { + return spanInNextNode(node2); + } + return spanInNode(node2.parent); + } + function spanInCloseParenToken(node2) { + switch (node2.parent.kind) { + case 215: + case 259: + case 216: + case 171: + case 170: + case 174: + case 175: + case 173: + case 244: + case 243: + case 245: + case 247: + case 210: + case 211: + case 214: + return spanInPreviousNode(node2); + default: + return spanInNode(node2.parent); + } + } + function spanInColonToken(node2) { + if (ts6.isFunctionLike(node2.parent) || node2.parent.kind === 299 || node2.parent.kind === 166) { + return spanInPreviousNode(node2); + } + return spanInNode(node2.parent); + } + function spanInGreaterThanOrLessThanToken(node2) { + if (node2.parent.kind === 213) { + return spanInNextNode(node2); + } + return spanInNode(node2.parent); + } + function spanInWhileKeyword(node2) { + if (node2.parent.kind === 243) { + return textSpanEndingAtNextToken(node2, node2.parent.expression); + } + return spanInNode(node2.parent); + } + function spanInOfKeyword(node2) { + if (node2.parent.kind === 247) { + return spanInNextNode(node2); + } + return spanInNode(node2.parent); + } + } + } + BreakpointResolver2.spanInSourceFileAtLocation = spanInSourceFileAtLocation; + })(BreakpointResolver = ts6.BreakpointResolver || (ts6.BreakpointResolver = {})); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function transform(source, transformers, compilerOptions) { + var diagnostics = []; + compilerOptions = ts6.fixupCompilerOptions(compilerOptions, diagnostics); + var nodes = ts6.isArray(source) ? source : [source]; + var result = ts6.transformNodes( + /*resolver*/ + void 0, + /*emitHost*/ + void 0, + ts6.factory, + compilerOptions, + nodes, + transformers, + /*allowDtsFiles*/ + true + ); + result.diagnostics = ts6.concatenate(result.diagnostics, diagnostics); + return result; + } + ts6.transform = transform; + })(ts5 || (ts5 = {})); + var debugObjectHost = function() { + return this; + }(); + var ts5; + (function(ts6) { + function logInternalError(logger, err) { + if (logger) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } + } + var ScriptSnapshotShimAdapter = ( + /** @class */ + function() { + function ScriptSnapshotShimAdapter2(scriptSnapshotShim) { + this.scriptSnapshotShim = scriptSnapshotShim; + } + ScriptSnapshotShimAdapter2.prototype.getText = function(start, end) { + return this.scriptSnapshotShim.getText(start, end); + }; + ScriptSnapshotShimAdapter2.prototype.getLength = function() { + return this.scriptSnapshotShim.getLength(); + }; + ScriptSnapshotShimAdapter2.prototype.getChangeRange = function(oldSnapshot) { + var oldSnapshotShim = oldSnapshot; + var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + if (encoded === null) { + return null; + } + var decoded = JSON.parse(encoded); + return ts6.createTextChangeRange(ts6.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + }; + ScriptSnapshotShimAdapter2.prototype.dispose = function() { + if ("dispose" in this.scriptSnapshotShim) { + this.scriptSnapshotShim.dispose(); + } + }; + return ScriptSnapshotShimAdapter2; + }() + ); + var LanguageServiceShimHostAdapter = ( + /** @class */ + function() { + function LanguageServiceShimHostAdapter2(shimHost) { + var _this = this; + this.shimHost = shimHost; + this.loggingEnabled = false; + this.tracingEnabled = false; + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = function(moduleNames, containingFile) { + var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); + return ts6.map(moduleNames, function(name) { + var result = ts6.getProperty(resolutionsInFile, name); + return result ? { resolvedFileName: result, extension: ts6.extensionFromPath(result), isExternalLibraryImport: false } : void 0; + }); + }; + } + if ("directoryExists" in this.shimHost) { + this.directoryExists = function(directoryName) { + return _this.shimHost.directoryExists(directoryName); + }; + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function(typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts6.map(typeDirectiveNames, function(name) { + return ts6.getProperty(typeDirectivesForFile, ts6.isString(name) ? name : name.fileName.toLowerCase()); + }); + }; + } + } + LanguageServiceShimHostAdapter2.prototype.log = function(s) { + if (this.loggingEnabled) { + this.shimHost.log(s); + } + }; + LanguageServiceShimHostAdapter2.prototype.trace = function(s) { + if (this.tracingEnabled) { + this.shimHost.trace(s); + } + }; + LanguageServiceShimHostAdapter2.prototype.error = function(s) { + this.shimHost.error(s); + }; + LanguageServiceShimHostAdapter2.prototype.getProjectVersion = function() { + if (!this.shimHost.getProjectVersion) { + return void 0; + } + return this.shimHost.getProjectVersion(); + }; + LanguageServiceShimHostAdapter2.prototype.getTypeRootsVersion = function() { + if (!this.shimHost.getTypeRootsVersion) { + return 0; + } + return this.shimHost.getTypeRootsVersion(); + }; + LanguageServiceShimHostAdapter2.prototype.useCaseSensitiveFileNames = function() { + return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + }; + LanguageServiceShimHostAdapter2.prototype.getCompilationSettings = function() { + var settingsJson = this.shimHost.getCompilationSettings(); + if (settingsJson === null || settingsJson === "") { + throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); + } + var compilerOptions = JSON.parse(settingsJson); + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; + }; + LanguageServiceShimHostAdapter2.prototype.getScriptFileNames = function() { + var encoded = this.shimHost.getScriptFileNames(); + return JSON.parse(encoded); + }; + LanguageServiceShimHostAdapter2.prototype.getScriptSnapshot = function(fileName) { + var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); + }; + LanguageServiceShimHostAdapter2.prototype.getScriptKind = function(fileName) { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } else { + return 0; + } + }; + LanguageServiceShimHostAdapter2.prototype.getScriptVersion = function(fileName) { + return this.shimHost.getScriptVersion(fileName); + }; + LanguageServiceShimHostAdapter2.prototype.getLocalizedDiagnosticMessages = function() { + var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { + return null; + } + try { + return JSON.parse(diagnosticMessagesJson); + } catch (e) { + this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); + return null; + } + }; + LanguageServiceShimHostAdapter2.prototype.getCancellationToken = function() { + var hostCancellationToken = this.shimHost.getCancellationToken(); + return new ts6.ThrottledCancellationToken(hostCancellationToken); + }; + LanguageServiceShimHostAdapter2.prototype.getCurrentDirectory = function() { + return this.shimHost.getCurrentDirectory(); + }; + LanguageServiceShimHostAdapter2.prototype.getDirectories = function(path) { + return JSON.parse(this.shimHost.getDirectories(path)); + }; + LanguageServiceShimHostAdapter2.prototype.getDefaultLibFileName = function(options) { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + }; + LanguageServiceShimHostAdapter2.prototype.readDirectory = function(path, extensions, exclude, include, depth) { + var pattern = ts6.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); + }; + LanguageServiceShimHostAdapter2.prototype.readFile = function(path, encoding) { + return this.shimHost.readFile(path, encoding); + }; + LanguageServiceShimHostAdapter2.prototype.fileExists = function(path) { + return this.shimHost.fileExists(path); + }; + return LanguageServiceShimHostAdapter2; + }() + ); + ts6.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; + var CoreServicesShimHostAdapter = ( + /** @class */ + function() { + function CoreServicesShimHostAdapter2(shimHost) { + var _this = this; + this.shimHost = shimHost; + this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + if ("directoryExists" in this.shimHost) { + this.directoryExists = function(directoryName) { + return _this.shimHost.directoryExists(directoryName); + }; + } else { + this.directoryExists = void 0; + } + if ("realpath" in this.shimHost) { + this.realpath = function(path) { + return _this.shimHost.realpath(path); + }; + } else { + this.realpath = void 0; + } + } + CoreServicesShimHostAdapter2.prototype.readDirectory = function(rootDir, extensions, exclude, include, depth) { + var pattern = ts6.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); + }; + CoreServicesShimHostAdapter2.prototype.fileExists = function(fileName) { + return this.shimHost.fileExists(fileName); + }; + CoreServicesShimHostAdapter2.prototype.readFile = function(fileName) { + return this.shimHost.readFile(fileName); + }; + CoreServicesShimHostAdapter2.prototype.getDirectories = function(path) { + return JSON.parse(this.shimHost.getDirectories(path)); + }; + return CoreServicesShimHostAdapter2; + }() + ); + ts6.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action, logPerformance) { + var start; + if (logPerformance) { + logger.log(actionDescription); + start = ts6.timestamp(); + } + var result = action(); + if (logPerformance) { + var end = ts6.timestamp(); + logger.log("".concat(actionDescription, " completed in ").concat(end - start, " msec")); + if (ts6.isString(result)) { + var str = result; + if (str.length > 128) { + str = str.substring(0, 128) + "..."; + } + logger.log(" result.length=".concat(str.length, ", result='").concat(JSON.stringify(str), "'")); + } + } + return result; + } + function forwardJSONCall(logger, actionDescription, action, logPerformance) { + return forwardCall( + logger, + actionDescription, + /*returnJson*/ + true, + action, + logPerformance + ); + } + function forwardCall(logger, actionDescription, returnJson, action, logPerformance) { + try { + var result = simpleForwardCall(logger, actionDescription, action, logPerformance); + return returnJson ? JSON.stringify({ result }) : result; + } catch (err) { + if (err instanceof ts6.OperationCanceledException) { + return JSON.stringify({ canceled: true }); + } + logInternalError(logger, err); + err.description = actionDescription; + return JSON.stringify({ error: err }); + } + } + var ShimBase = ( + /** @class */ + function() { + function ShimBase2(factory) { + this.factory = factory; + factory.registerShim(this); + } + ShimBase2.prototype.dispose = function(_dummy) { + this.factory.unregisterShim(this); + }; + return ShimBase2; + }() + ); + function realizeDiagnostics(diagnostics, newLine) { + return diagnostics.map(function(d) { + return realizeDiagnostic(d, newLine); + }); + } + ts6.realizeDiagnostics = realizeDiagnostics; + function realizeDiagnostic(diagnostic, newLine) { + return { + message: ts6.flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start, + length: diagnostic.length, + category: ts6.diagnosticCategoryName(diagnostic), + code: diagnostic.code, + reportsUnnecessary: diagnostic.reportsUnnecessary, + reportsDeprecated: diagnostic.reportsDeprecated + }; + } + var LanguageServiceShimObject = ( + /** @class */ + function(_super) { + __extends(LanguageServiceShimObject2, _super); + function LanguageServiceShimObject2(factory, host, languageService) { + var _this = _super.call(this, factory) || this; + _this.host = host; + _this.languageService = languageService; + _this.logPerformance = false; + _this.logger = _this.host; + return _this; + } + LanguageServiceShimObject2.prototype.forwardJSONCall = function(actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); + }; + LanguageServiceShimObject2.prototype.dispose = function(dummy) { + this.logger.log("dispose()"); + this.languageService.dispose(); + this.languageService = null; + if (debugObjectHost && debugObjectHost.CollectGarbage) { + debugObjectHost.CollectGarbage(); + this.logger.log("CollectGarbage()"); + } + this.logger = null; + _super.prototype.dispose.call(this, dummy); + }; + LanguageServiceShimObject2.prototype.refresh = function(throwOnError) { + this.forwardJSONCall( + "refresh(".concat(throwOnError, ")"), + function() { + return null; + } + // eslint-disable-line no-null/no-null + ); + }; + LanguageServiceShimObject2.prototype.cleanupSemanticCache = function() { + var _this = this; + this.forwardJSONCall("cleanupSemanticCache()", function() { + _this.languageService.cleanupSemanticCache(); + return null; + }); + }; + LanguageServiceShimObject2.prototype.realizeDiagnostics = function(diagnostics) { + var newLine = ts6.getNewLineOrDefaultFromHost(this.host); + return realizeDiagnostics(diagnostics, newLine); + }; + LanguageServiceShimObject2.prototype.getSyntacticClassifications = function(fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('".concat(fileName, "', ").concat(start, ", ").concat(length, ")"), function() { + return _this.languageService.getSyntacticClassifications(fileName, ts6.createTextSpan(start, length)); + }); + }; + LanguageServiceShimObject2.prototype.getSemanticClassifications = function(fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('".concat(fileName, "', ").concat(start, ", ").concat(length, ")"), function() { + return _this.languageService.getSemanticClassifications(fileName, ts6.createTextSpan(start, length)); + }); + }; + LanguageServiceShimObject2.prototype.getEncodedSyntacticClassifications = function(fileName, start, length) { + var _this = this; + return this.forwardJSONCall( + "getEncodedSyntacticClassifications('".concat(fileName, "', ").concat(start, ", ").concat(length, ")"), + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + function() { + return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts6.createTextSpan(start, length))); + } + ); + }; + LanguageServiceShimObject2.prototype.getEncodedSemanticClassifications = function(fileName, start, length) { + var _this = this; + return this.forwardJSONCall( + "getEncodedSemanticClassifications('".concat(fileName, "', ").concat(start, ", ").concat(length, ")"), + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + function() { + return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts6.createTextSpan(start, length))); + } + ); + }; + LanguageServiceShimObject2.prototype.getSyntacticDiagnostics = function(fileName) { + var _this = this; + return this.forwardJSONCall("getSyntacticDiagnostics('".concat(fileName, "')"), function() { + var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject2.prototype.getSemanticDiagnostics = function(fileName) { + var _this = this; + return this.forwardJSONCall("getSemanticDiagnostics('".concat(fileName, "')"), function() { + var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject2.prototype.getSuggestionDiagnostics = function(fileName) { + var _this = this; + return this.forwardJSONCall("getSuggestionDiagnostics('".concat(fileName, "')"), function() { + return _this.realizeDiagnostics(_this.languageService.getSuggestionDiagnostics(fileName)); + }); + }; + LanguageServiceShimObject2.prototype.getCompilerOptionsDiagnostics = function() { + var _this = this; + return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function() { + var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject2.prototype.getQuickInfoAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getQuickInfoAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getQuickInfoAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getNameOrDottedNameSpan = function(fileName, startPos, endPos) { + var _this = this; + return this.forwardJSONCall("getNameOrDottedNameSpan('".concat(fileName, "', ").concat(startPos, ", ").concat(endPos, ")"), function() { + return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); + }); + }; + LanguageServiceShimObject2.prototype.getBreakpointStatementAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getBreakpointStatementAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getBreakpointStatementAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getSignatureHelpItems = function(fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getSignatureHelpItems('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getSignatureHelpItems(fileName, position, options); + }); + }; + LanguageServiceShimObject2.prototype.getDefinitionAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getDefinitionAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getDefinitionAndBoundSpan = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAndBoundSpan('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getDefinitionAndBoundSpan(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getTypeDefinitionAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getTypeDefinitionAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getTypeDefinitionAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getImplementationAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getImplementationAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getImplementationAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getRenameInfo = function(fileName, position, preferences) { + var _this = this; + return this.forwardJSONCall("getRenameInfo('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getRenameInfo(fileName, position, preferences); + }); + }; + LanguageServiceShimObject2.prototype.getSmartSelectionRange = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getSmartSelectionRange('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getSmartSelectionRange(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.findRenameLocations = function(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) { + var _this = this; + return this.forwardJSONCall("findRenameLocations('".concat(fileName, "', ").concat(position, ", ").concat(findInStrings, ", ").concat(findInComments, ", ").concat(providePrefixAndSuffixTextForRename, ")"), function() { + return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename); + }); + }; + LanguageServiceShimObject2.prototype.getBraceMatchingAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getBraceMatchingAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getBraceMatchingAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.isValidBraceCompletionAtPosition = function(fileName, position, openingBrace) { + var _this = this; + return this.forwardJSONCall("isValidBraceCompletionAtPosition('".concat(fileName, "', ").concat(position, ", ").concat(openingBrace, ")"), function() { + return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); + }); + }; + LanguageServiceShimObject2.prototype.getSpanOfEnclosingComment = function(fileName, position, onlyMultiLine) { + var _this = this; + return this.forwardJSONCall("getSpanOfEnclosingComment('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getSpanOfEnclosingComment(fileName, position, onlyMultiLine); + }); + }; + LanguageServiceShimObject2.prototype.getIndentationAtPosition = function(fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getIndentationAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + var localOptions = JSON.parse(options); + return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); + }); + }; + LanguageServiceShimObject2.prototype.getReferencesAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getReferencesAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getReferencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.findReferences = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("findReferences('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.findReferences(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getFileReferences = function(fileName) { + var _this = this; + return this.forwardJSONCall("getFileReferences('".concat(fileName, ")"), function() { + return _this.languageService.getFileReferences(fileName); + }); + }; + LanguageServiceShimObject2.prototype.getOccurrencesAtPosition = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("getOccurrencesAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getOccurrencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.getDocumentHighlights = function(fileName, position, filesToSearch) { + var _this = this; + return this.forwardJSONCall("getDocumentHighlights('".concat(fileName, "', ").concat(position, ")"), function() { + var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var normalizedName = ts6.toFileNameLowerCase(ts6.normalizeSlashes(fileName)); + return ts6.filter(results, function(r) { + return ts6.toFileNameLowerCase(ts6.normalizeSlashes(r.fileName)) === normalizedName; + }); + }); + }; + LanguageServiceShimObject2.prototype.getCompletionsAtPosition = function(fileName, position, preferences, formattingSettings) { + var _this = this; + return this.forwardJSONCall("getCompletionsAtPosition('".concat(fileName, "', ").concat(position, ", ").concat(preferences, ", ").concat(formattingSettings, ")"), function() { + return _this.languageService.getCompletionsAtPosition(fileName, position, preferences, formattingSettings); + }); + }; + LanguageServiceShimObject2.prototype.getCompletionEntryDetails = function(fileName, position, entryName, formatOptions, source, preferences, data) { + var _this = this; + return this.forwardJSONCall("getCompletionEntryDetails('".concat(fileName, "', ").concat(position, ", '").concat(entryName, "')"), function() { + var localOptions = formatOptions === void 0 ? void 0 : JSON.parse(formatOptions); + return _this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source, preferences, data); + }); + }; + LanguageServiceShimObject2.prototype.getFormattingEditsForRange = function(fileName, start, end, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForRange('".concat(fileName, "', ").concat(start, ", ").concat(end, ")"), function() { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); + }); + }; + LanguageServiceShimObject2.prototype.getFormattingEditsForDocument = function(fileName, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForDocument('".concat(fileName, "')"), function() { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); + }); + }; + LanguageServiceShimObject2.prototype.getFormattingEditsAfterKeystroke = function(fileName, position, key, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsAfterKeystroke('".concat(fileName, "', ").concat(position, ", '").concat(key, "')"), function() { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); + }); + }; + LanguageServiceShimObject2.prototype.getDocCommentTemplateAtPosition = function(fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getDocCommentTemplateAtPosition('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.getDocCommentTemplateAtPosition(fileName, position, options); + }); + }; + LanguageServiceShimObject2.prototype.getNavigateToItems = function(searchValue, maxResultCount, fileName) { + var _this = this; + return this.forwardJSONCall("getNavigateToItems('".concat(searchValue, "', ").concat(maxResultCount, ", ").concat(fileName, ")"), function() { + return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); + }); + }; + LanguageServiceShimObject2.prototype.getNavigationBarItems = function(fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationBarItems('".concat(fileName, "')"), function() { + return _this.languageService.getNavigationBarItems(fileName); + }); + }; + LanguageServiceShimObject2.prototype.getNavigationTree = function(fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationTree('".concat(fileName, "')"), function() { + return _this.languageService.getNavigationTree(fileName); + }); + }; + LanguageServiceShimObject2.prototype.getOutliningSpans = function(fileName) { + var _this = this; + return this.forwardJSONCall("getOutliningSpans('".concat(fileName, "')"), function() { + return _this.languageService.getOutliningSpans(fileName); + }); + }; + LanguageServiceShimObject2.prototype.getTodoComments = function(fileName, descriptors) { + var _this = this; + return this.forwardJSONCall("getTodoComments('".concat(fileName, "')"), function() { + return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); + }); + }; + LanguageServiceShimObject2.prototype.prepareCallHierarchy = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("prepareCallHierarchy('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.prepareCallHierarchy(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.provideCallHierarchyIncomingCalls = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("provideCallHierarchyIncomingCalls('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.provideCallHierarchyIncomingCalls(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.provideCallHierarchyOutgoingCalls = function(fileName, position) { + var _this = this; + return this.forwardJSONCall("provideCallHierarchyOutgoingCalls('".concat(fileName, "', ").concat(position, ")"), function() { + return _this.languageService.provideCallHierarchyOutgoingCalls(fileName, position); + }); + }; + LanguageServiceShimObject2.prototype.provideInlayHints = function(fileName, span, preference) { + var _this = this; + return this.forwardJSONCall("provideInlayHints('".concat(fileName, "', '").concat(JSON.stringify(span), "', ").concat(JSON.stringify(preference), ")"), function() { + return _this.languageService.provideInlayHints(fileName, span, preference); + }); + }; + LanguageServiceShimObject2.prototype.getEmitOutput = function(fileName) { + var _this = this; + return this.forwardJSONCall("getEmitOutput('".concat(fileName, "')"), function() { + var _a = _this.languageService.getEmitOutput(fileName), diagnostics = _a.diagnostics, rest = __rest(_a, ["diagnostics"]); + return __assign(__assign({}, rest), { diagnostics: _this.realizeDiagnostics(diagnostics) }); + }); + }; + LanguageServiceShimObject2.prototype.getEmitOutputObject = function(fileName) { + var _this = this; + return forwardCall( + this.logger, + "getEmitOutput('".concat(fileName, "')"), + /*returnJson*/ + false, + function() { + return _this.languageService.getEmitOutput(fileName); + }, + this.logPerformance + ); + }; + LanguageServiceShimObject2.prototype.toggleLineComment = function(fileName, textRange) { + var _this = this; + return this.forwardJSONCall("toggleLineComment('".concat(fileName, "', '").concat(JSON.stringify(textRange), "')"), function() { + return _this.languageService.toggleLineComment(fileName, textRange); + }); + }; + LanguageServiceShimObject2.prototype.toggleMultilineComment = function(fileName, textRange) { + var _this = this; + return this.forwardJSONCall("toggleMultilineComment('".concat(fileName, "', '").concat(JSON.stringify(textRange), "')"), function() { + return _this.languageService.toggleMultilineComment(fileName, textRange); + }); + }; + LanguageServiceShimObject2.prototype.commentSelection = function(fileName, textRange) { + var _this = this; + return this.forwardJSONCall("commentSelection('".concat(fileName, "', '").concat(JSON.stringify(textRange), "')"), function() { + return _this.languageService.commentSelection(fileName, textRange); + }); + }; + LanguageServiceShimObject2.prototype.uncommentSelection = function(fileName, textRange) { + var _this = this; + return this.forwardJSONCall("uncommentSelection('".concat(fileName, "', '").concat(JSON.stringify(textRange), "')"), function() { + return _this.languageService.uncommentSelection(fileName, textRange); + }); + }; + return LanguageServiceShimObject2; + }(ShimBase) + ); + function convertClassifications(classifications) { + return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; + } + var ClassifierShimObject = ( + /** @class */ + function(_super) { + __extends(ClassifierShimObject2, _super); + function ClassifierShimObject2(factory, logger) { + var _this = _super.call(this, factory) || this; + _this.logger = logger; + _this.logPerformance = false; + _this.classifier = ts6.createClassifier(); + return _this; + } + ClassifierShimObject2.prototype.getEncodedLexicalClassifications = function(text, lexState, syntacticClassifierAbsent) { + var _this = this; + if (syntacticClassifierAbsent === void 0) { + syntacticClassifierAbsent = false; + } + return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function() { + return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); + }, this.logPerformance); + }; + ClassifierShimObject2.prototype.getClassificationsForLine = function(text, lexState, classifyKeywordsInGenerics) { + if (classifyKeywordsInGenerics === void 0) { + classifyKeywordsInGenerics = false; + } + var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + var result = ""; + for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { + var item = _a[_i]; + result += item.length + "\n"; + result += item.classification + "\n"; + } + result += classification.finalLexState; + return result; + }; + return ClassifierShimObject2; + }(ShimBase) + ); + var CoreServicesShimObject = ( + /** @class */ + function(_super) { + __extends(CoreServicesShimObject2, _super); + function CoreServicesShimObject2(factory, logger, host) { + var _this = _super.call(this, factory) || this; + _this.logger = logger; + _this.host = host; + _this.logPerformance = false; + return _this; + } + CoreServicesShimObject2.prototype.forwardJSONCall = function(actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); + }; + CoreServicesShimObject2.prototype.resolveModuleName = function(fileName, moduleName, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveModuleName('".concat(fileName, "')"), function() { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts6.resolveModuleName(moduleName, ts6.normalizeSlashes(fileName), compilerOptions, _this.host); + var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : void 0; + if (result.resolvedModule && result.resolvedModule.extension !== ".ts" && result.resolvedModule.extension !== ".tsx" && result.resolvedModule.extension !== ".d.ts") { + resolvedFileName = void 0; + } + return { + resolvedFileName, + failedLookupLocations: result.failedLookupLocations, + affectingLocations: result.affectingLocations + }; + }); + }; + CoreServicesShimObject2.prototype.resolveTypeReferenceDirective = function(fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(".concat(fileName, ")"), function() { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts6.resolveTypeReferenceDirective(typeReferenceDirective, ts6.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : void 0, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; + CoreServicesShimObject2.prototype.getPreProcessedFileInfo = function(fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getPreProcessedFileInfo('".concat(fileName, "')"), function() { + var result = ts6.preProcessFile( + ts6.getSnapshotText(sourceTextSnapshot), + /* readImportFiles */ + true, + /* detectJavaScriptImports */ + true + ); + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), + ambientExternalModules: result.ambientExternalModules, + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives), + libReferenceDirectives: _this.convertFileReferences(result.libReferenceDirectives) + }; + }); + }; + CoreServicesShimObject2.prototype.getAutomaticTypeDirectiveNames = function(compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("getAutomaticTypeDirectiveNames('".concat(compilerOptionsJson, "')"), function() { + var compilerOptions = JSON.parse(compilerOptionsJson); + return ts6.getAutomaticTypeDirectiveNames(compilerOptions, _this.host); + }); + }; + CoreServicesShimObject2.prototype.convertFileReferences = function(refs) { + if (!refs) { + return void 0; + } + var result = []; + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; + result.push({ + path: ts6.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; + CoreServicesShimObject2.prototype.getTSConfigFileInfo = function(fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getTSConfigFileInfo('".concat(fileName, "')"), function() { + var result = ts6.parseJsonText(fileName, ts6.getSnapshotText(sourceTextSnapshot)); + var normalizedFileName = ts6.normalizeSlashes(fileName); + var configFile = ts6.parseJsonSourceFileConfigFileContent( + result, + _this.host, + ts6.getDirectoryPath(normalizedFileName), + /*existingOptions*/ + {}, + normalizedFileName + ); + return { + options: configFile.options, + typeAcquisition: configFile.typeAcquisition, + files: configFile.fileNames, + raw: configFile.raw, + errors: realizeDiagnostics(__spreadArray(__spreadArray([], result.parseDiagnostics, true), configFile.errors, true), "\r\n") + }; + }); + }; + CoreServicesShimObject2.prototype.getDefaultCompilationSettings = function() { + return this.forwardJSONCall("getDefaultCompilationSettings()", function() { + return ts6.getDefaultCompilerOptions(); + }); + }; + CoreServicesShimObject2.prototype.discoverTypings = function(discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts6.createGetCanonicalFileName( + /*useCaseSensitivefileNames:*/ + false + ); + return this.forwardJSONCall("discoverTypings()", function() { + var info = JSON.parse(discoverTypingsJson); + if (_this.safeList === void 0) { + _this.safeList = ts6.JsTyping.loadSafeList(_this.host, ts6.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName)); + } + return ts6.JsTyping.discoverTypings(_this.host, function(msg) { + return _this.logger.log(msg); + }, info.fileNames, ts6.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), _this.safeList, info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports, info.typesRegistry, ts6.emptyOptions); + }); + }; + return CoreServicesShimObject2; + }(ShimBase) + ); + var TypeScriptServicesFactory = ( + /** @class */ + function() { + function TypeScriptServicesFactory2() { + this._shims = []; + } + TypeScriptServicesFactory2.prototype.getServicesVersion = function() { + return ts6.servicesVersion; + }; + TypeScriptServicesFactory2.prototype.createLanguageServiceShim = function(host) { + try { + if (this.documentRegistry === void 0) { + this.documentRegistry = ts6.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + } + var hostAdapter = new LanguageServiceShimHostAdapter(host); + var languageService = ts6.createLanguageService( + hostAdapter, + this.documentRegistry, + /*syntaxOnly*/ + false + ); + return new LanguageServiceShimObject(this, host, languageService); + } catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory2.prototype.createClassifierShim = function(logger) { + try { + return new ClassifierShimObject(this, logger); + } catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory2.prototype.createCoreServicesShim = function(host) { + try { + var adapter = new CoreServicesShimHostAdapter(host); + return new CoreServicesShimObject(this, host, adapter); + } catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory2.prototype.close = function() { + ts6.clear(this._shims); + this.documentRegistry = void 0; + }; + TypeScriptServicesFactory2.prototype.registerShim = function(shim) { + this._shims.push(shim); + }; + TypeScriptServicesFactory2.prototype.unregisterShim = function(shim) { + for (var i = 0; i < this._shims.length; i++) { + if (this._shims[i] === shim) { + delete this._shims[i]; + return; + } + } + throw new Error("Invalid operation"); + }; + return TypeScriptServicesFactory2; + }() + ); + ts6.TypeScriptServicesFactory = TypeScriptServicesFactory; + })(ts5 || (ts5 = {})); + (function() { + if (typeof globalThis === "object") + return; + try { + Object.defineProperty(Object.prototype, "__magic__", { + get: function() { + return this; + }, + configurable: true + }); + __magic__.globalThis = __magic__; + if (typeof globalThis === "undefined") { + window.globalThis = window; + } + delete Object.prototype.__magic__; + } catch (error) { + window.globalThis = window; + } + })(); + if (typeof process === "undefined" || process.browser) { + globalThis.TypeScript = globalThis.TypeScript || {}; + globalThis.TypeScript.Services = globalThis.TypeScript.Services || {}; + globalThis.TypeScript.Services.TypeScriptServicesFactory = ts5.TypeScriptServicesFactory; + globalThis.toolsVersion = ts5.versionMajorMinor; + } + if (typeof module !== "undefined" && module.exports) { + module.exports = ts5; + } + var ts5; + (function(ts6) { + function createOverload(name, overloads, binder, deprecations) { + Object.defineProperty(call, "name", __assign(__assign({}, Object.getOwnPropertyDescriptor(call, "name")), { value: name })); + if (deprecations) { + for (var _i = 0, _a = Object.keys(deprecations); _i < _a.length; _i++) { + var key = _a[_i]; + var index = +key; + if (!isNaN(index) && ts6.hasProperty(overloads, "".concat(index))) { + overloads[index] = ts6.Debug.deprecate(overloads[index], __assign(__assign({}, deprecations[index]), { name })); + } + } + } + var bind = createBinder(overloads, binder); + return call; + function call() { + var args = []; + for (var _i2 = 0; _i2 < arguments.length; _i2++) { + args[_i2] = arguments[_i2]; + } + var index2 = bind(args); + var fn = index2 !== void 0 ? overloads[index2] : void 0; + if (typeof fn === "function") { + return fn.apply(void 0, args); + } + throw new TypeError("Invalid arguments"); + } + } + ts6.createOverload = createOverload; + function createBinder(overloads, binder) { + return function(args) { + for (var i = 0; ts6.hasProperty(overloads, "".concat(i)) && ts6.hasProperty(binder, "".concat(i)); i++) { + var fn = binder[i]; + if (fn(args)) { + return i; + } + } + }; + } + function buildOverload(name) { + return { + overload: function(overloads) { + return { + bind: function(binder) { + return { + finish: function() { + return createOverload(name, overloads, binder); + }, + deprecate: function(deprecations) { + return { + finish: function() { + return createOverload(name, overloads, binder, deprecations); + } + }; + } + }; + } + }; + } + }; + } + ts6.buildOverload = buildOverload; + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var factoryDeprecation = { since: "4.0", warnAfter: "4.1", message: "Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead." }; + ts6.createNodeArray = ts6.Debug.deprecate(ts6.factory.createNodeArray, factoryDeprecation); + ts6.createNumericLiteral = ts6.Debug.deprecate(ts6.factory.createNumericLiteral, factoryDeprecation); + ts6.createBigIntLiteral = ts6.Debug.deprecate(ts6.factory.createBigIntLiteral, factoryDeprecation); + ts6.createStringLiteral = ts6.Debug.deprecate(ts6.factory.createStringLiteral, factoryDeprecation); + ts6.createStringLiteralFromNode = ts6.Debug.deprecate(ts6.factory.createStringLiteralFromNode, factoryDeprecation); + ts6.createRegularExpressionLiteral = ts6.Debug.deprecate(ts6.factory.createRegularExpressionLiteral, factoryDeprecation); + ts6.createLoopVariable = ts6.Debug.deprecate(ts6.factory.createLoopVariable, factoryDeprecation); + ts6.createUniqueName = ts6.Debug.deprecate(ts6.factory.createUniqueName, factoryDeprecation); + ts6.createPrivateIdentifier = ts6.Debug.deprecate(ts6.factory.createPrivateIdentifier, factoryDeprecation); + ts6.createSuper = ts6.Debug.deprecate(ts6.factory.createSuper, factoryDeprecation); + ts6.createThis = ts6.Debug.deprecate(ts6.factory.createThis, factoryDeprecation); + ts6.createNull = ts6.Debug.deprecate(ts6.factory.createNull, factoryDeprecation); + ts6.createTrue = ts6.Debug.deprecate(ts6.factory.createTrue, factoryDeprecation); + ts6.createFalse = ts6.Debug.deprecate(ts6.factory.createFalse, factoryDeprecation); + ts6.createModifier = ts6.Debug.deprecate(ts6.factory.createModifier, factoryDeprecation); + ts6.createModifiersFromModifierFlags = ts6.Debug.deprecate(ts6.factory.createModifiersFromModifierFlags, factoryDeprecation); + ts6.createQualifiedName = ts6.Debug.deprecate(ts6.factory.createQualifiedName, factoryDeprecation); + ts6.updateQualifiedName = ts6.Debug.deprecate(ts6.factory.updateQualifiedName, factoryDeprecation); + ts6.createComputedPropertyName = ts6.Debug.deprecate(ts6.factory.createComputedPropertyName, factoryDeprecation); + ts6.updateComputedPropertyName = ts6.Debug.deprecate(ts6.factory.updateComputedPropertyName, factoryDeprecation); + ts6.createTypeParameterDeclaration = ts6.Debug.deprecate(ts6.factory.createTypeParameterDeclaration, factoryDeprecation); + ts6.updateTypeParameterDeclaration = ts6.Debug.deprecate(ts6.factory.updateTypeParameterDeclaration, factoryDeprecation); + ts6.createParameter = ts6.Debug.deprecate(ts6.factory.createParameterDeclaration, factoryDeprecation); + ts6.updateParameter = ts6.Debug.deprecate(ts6.factory.updateParameterDeclaration, factoryDeprecation); + ts6.createDecorator = ts6.Debug.deprecate(ts6.factory.createDecorator, factoryDeprecation); + ts6.updateDecorator = ts6.Debug.deprecate(ts6.factory.updateDecorator, factoryDeprecation); + ts6.createProperty = ts6.Debug.deprecate(ts6.factory.createPropertyDeclaration, factoryDeprecation); + ts6.updateProperty = ts6.Debug.deprecate(ts6.factory.updatePropertyDeclaration, factoryDeprecation); + ts6.createMethod = ts6.Debug.deprecate(ts6.factory.createMethodDeclaration, factoryDeprecation); + ts6.updateMethod = ts6.Debug.deprecate(ts6.factory.updateMethodDeclaration, factoryDeprecation); + ts6.createConstructor = ts6.Debug.deprecate(ts6.factory.createConstructorDeclaration, factoryDeprecation); + ts6.updateConstructor = ts6.Debug.deprecate(ts6.factory.updateConstructorDeclaration, factoryDeprecation); + ts6.createGetAccessor = ts6.Debug.deprecate(ts6.factory.createGetAccessorDeclaration, factoryDeprecation); + ts6.updateGetAccessor = ts6.Debug.deprecate(ts6.factory.updateGetAccessorDeclaration, factoryDeprecation); + ts6.createSetAccessor = ts6.Debug.deprecate(ts6.factory.createSetAccessorDeclaration, factoryDeprecation); + ts6.updateSetAccessor = ts6.Debug.deprecate(ts6.factory.updateSetAccessorDeclaration, factoryDeprecation); + ts6.createCallSignature = ts6.Debug.deprecate(ts6.factory.createCallSignature, factoryDeprecation); + ts6.updateCallSignature = ts6.Debug.deprecate(ts6.factory.updateCallSignature, factoryDeprecation); + ts6.createConstructSignature = ts6.Debug.deprecate(ts6.factory.createConstructSignature, factoryDeprecation); + ts6.updateConstructSignature = ts6.Debug.deprecate(ts6.factory.updateConstructSignature, factoryDeprecation); + ts6.updateIndexSignature = ts6.Debug.deprecate(ts6.factory.updateIndexSignature, factoryDeprecation); + ts6.createKeywordTypeNode = ts6.Debug.deprecate(ts6.factory.createKeywordTypeNode, factoryDeprecation); + ts6.createTypePredicateNodeWithModifier = ts6.Debug.deprecate(ts6.factory.createTypePredicateNode, factoryDeprecation); + ts6.updateTypePredicateNodeWithModifier = ts6.Debug.deprecate(ts6.factory.updateTypePredicateNode, factoryDeprecation); + ts6.createTypeReferenceNode = ts6.Debug.deprecate(ts6.factory.createTypeReferenceNode, factoryDeprecation); + ts6.updateTypeReferenceNode = ts6.Debug.deprecate(ts6.factory.updateTypeReferenceNode, factoryDeprecation); + ts6.createFunctionTypeNode = ts6.Debug.deprecate(ts6.factory.createFunctionTypeNode, factoryDeprecation); + ts6.updateFunctionTypeNode = ts6.Debug.deprecate(ts6.factory.updateFunctionTypeNode, factoryDeprecation); + ts6.createConstructorTypeNode = ts6.Debug.deprecate(function(typeParameters, parameters, type) { + return ts6.factory.createConstructorTypeNode( + /*modifiers*/ + void 0, + typeParameters, + parameters, + type + ); + }, factoryDeprecation); + ts6.updateConstructorTypeNode = ts6.Debug.deprecate(function(node, typeParameters, parameters, type) { + return ts6.factory.updateConstructorTypeNode(node, node.modifiers, typeParameters, parameters, type); + }, factoryDeprecation); + ts6.createTypeQueryNode = ts6.Debug.deprecate(ts6.factory.createTypeQueryNode, factoryDeprecation); + ts6.updateTypeQueryNode = ts6.Debug.deprecate(ts6.factory.updateTypeQueryNode, factoryDeprecation); + ts6.createTypeLiteralNode = ts6.Debug.deprecate(ts6.factory.createTypeLiteralNode, factoryDeprecation); + ts6.updateTypeLiteralNode = ts6.Debug.deprecate(ts6.factory.updateTypeLiteralNode, factoryDeprecation); + ts6.createArrayTypeNode = ts6.Debug.deprecate(ts6.factory.createArrayTypeNode, factoryDeprecation); + ts6.updateArrayTypeNode = ts6.Debug.deprecate(ts6.factory.updateArrayTypeNode, factoryDeprecation); + ts6.createTupleTypeNode = ts6.Debug.deprecate(ts6.factory.createTupleTypeNode, factoryDeprecation); + ts6.updateTupleTypeNode = ts6.Debug.deprecate(ts6.factory.updateTupleTypeNode, factoryDeprecation); + ts6.createOptionalTypeNode = ts6.Debug.deprecate(ts6.factory.createOptionalTypeNode, factoryDeprecation); + ts6.updateOptionalTypeNode = ts6.Debug.deprecate(ts6.factory.updateOptionalTypeNode, factoryDeprecation); + ts6.createRestTypeNode = ts6.Debug.deprecate(ts6.factory.createRestTypeNode, factoryDeprecation); + ts6.updateRestTypeNode = ts6.Debug.deprecate(ts6.factory.updateRestTypeNode, factoryDeprecation); + ts6.createUnionTypeNode = ts6.Debug.deprecate(ts6.factory.createUnionTypeNode, factoryDeprecation); + ts6.updateUnionTypeNode = ts6.Debug.deprecate(ts6.factory.updateUnionTypeNode, factoryDeprecation); + ts6.createIntersectionTypeNode = ts6.Debug.deprecate(ts6.factory.createIntersectionTypeNode, factoryDeprecation); + ts6.updateIntersectionTypeNode = ts6.Debug.deprecate(ts6.factory.updateIntersectionTypeNode, factoryDeprecation); + ts6.createConditionalTypeNode = ts6.Debug.deprecate(ts6.factory.createConditionalTypeNode, factoryDeprecation); + ts6.updateConditionalTypeNode = ts6.Debug.deprecate(ts6.factory.updateConditionalTypeNode, factoryDeprecation); + ts6.createInferTypeNode = ts6.Debug.deprecate(ts6.factory.createInferTypeNode, factoryDeprecation); + ts6.updateInferTypeNode = ts6.Debug.deprecate(ts6.factory.updateInferTypeNode, factoryDeprecation); + ts6.createImportTypeNode = ts6.Debug.deprecate(ts6.factory.createImportTypeNode, factoryDeprecation); + ts6.updateImportTypeNode = ts6.Debug.deprecate(ts6.factory.updateImportTypeNode, factoryDeprecation); + ts6.createParenthesizedType = ts6.Debug.deprecate(ts6.factory.createParenthesizedType, factoryDeprecation); + ts6.updateParenthesizedType = ts6.Debug.deprecate(ts6.factory.updateParenthesizedType, factoryDeprecation); + ts6.createThisTypeNode = ts6.Debug.deprecate(ts6.factory.createThisTypeNode, factoryDeprecation); + ts6.updateTypeOperatorNode = ts6.Debug.deprecate(ts6.factory.updateTypeOperatorNode, factoryDeprecation); + ts6.createIndexedAccessTypeNode = ts6.Debug.deprecate(ts6.factory.createIndexedAccessTypeNode, factoryDeprecation); + ts6.updateIndexedAccessTypeNode = ts6.Debug.deprecate(ts6.factory.updateIndexedAccessTypeNode, factoryDeprecation); + ts6.createMappedTypeNode = ts6.Debug.deprecate(ts6.factory.createMappedTypeNode, factoryDeprecation); + ts6.updateMappedTypeNode = ts6.Debug.deprecate(ts6.factory.updateMappedTypeNode, factoryDeprecation); + ts6.createLiteralTypeNode = ts6.Debug.deprecate(ts6.factory.createLiteralTypeNode, factoryDeprecation); + ts6.updateLiteralTypeNode = ts6.Debug.deprecate(ts6.factory.updateLiteralTypeNode, factoryDeprecation); + ts6.createObjectBindingPattern = ts6.Debug.deprecate(ts6.factory.createObjectBindingPattern, factoryDeprecation); + ts6.updateObjectBindingPattern = ts6.Debug.deprecate(ts6.factory.updateObjectBindingPattern, factoryDeprecation); + ts6.createArrayBindingPattern = ts6.Debug.deprecate(ts6.factory.createArrayBindingPattern, factoryDeprecation); + ts6.updateArrayBindingPattern = ts6.Debug.deprecate(ts6.factory.updateArrayBindingPattern, factoryDeprecation); + ts6.createBindingElement = ts6.Debug.deprecate(ts6.factory.createBindingElement, factoryDeprecation); + ts6.updateBindingElement = ts6.Debug.deprecate(ts6.factory.updateBindingElement, factoryDeprecation); + ts6.createArrayLiteral = ts6.Debug.deprecate(ts6.factory.createArrayLiteralExpression, factoryDeprecation); + ts6.updateArrayLiteral = ts6.Debug.deprecate(ts6.factory.updateArrayLiteralExpression, factoryDeprecation); + ts6.createObjectLiteral = ts6.Debug.deprecate(ts6.factory.createObjectLiteralExpression, factoryDeprecation); + ts6.updateObjectLiteral = ts6.Debug.deprecate(ts6.factory.updateObjectLiteralExpression, factoryDeprecation); + ts6.createPropertyAccess = ts6.Debug.deprecate(ts6.factory.createPropertyAccessExpression, factoryDeprecation); + ts6.updatePropertyAccess = ts6.Debug.deprecate(ts6.factory.updatePropertyAccessExpression, factoryDeprecation); + ts6.createPropertyAccessChain = ts6.Debug.deprecate(ts6.factory.createPropertyAccessChain, factoryDeprecation); + ts6.updatePropertyAccessChain = ts6.Debug.deprecate(ts6.factory.updatePropertyAccessChain, factoryDeprecation); + ts6.createElementAccess = ts6.Debug.deprecate(ts6.factory.createElementAccessExpression, factoryDeprecation); + ts6.updateElementAccess = ts6.Debug.deprecate(ts6.factory.updateElementAccessExpression, factoryDeprecation); + ts6.createElementAccessChain = ts6.Debug.deprecate(ts6.factory.createElementAccessChain, factoryDeprecation); + ts6.updateElementAccessChain = ts6.Debug.deprecate(ts6.factory.updateElementAccessChain, factoryDeprecation); + ts6.createCall = ts6.Debug.deprecate(ts6.factory.createCallExpression, factoryDeprecation); + ts6.updateCall = ts6.Debug.deprecate(ts6.factory.updateCallExpression, factoryDeprecation); + ts6.createCallChain = ts6.Debug.deprecate(ts6.factory.createCallChain, factoryDeprecation); + ts6.updateCallChain = ts6.Debug.deprecate(ts6.factory.updateCallChain, factoryDeprecation); + ts6.createNew = ts6.Debug.deprecate(ts6.factory.createNewExpression, factoryDeprecation); + ts6.updateNew = ts6.Debug.deprecate(ts6.factory.updateNewExpression, factoryDeprecation); + ts6.createTypeAssertion = ts6.Debug.deprecate(ts6.factory.createTypeAssertion, factoryDeprecation); + ts6.updateTypeAssertion = ts6.Debug.deprecate(ts6.factory.updateTypeAssertion, factoryDeprecation); + ts6.createParen = ts6.Debug.deprecate(ts6.factory.createParenthesizedExpression, factoryDeprecation); + ts6.updateParen = ts6.Debug.deprecate(ts6.factory.updateParenthesizedExpression, factoryDeprecation); + ts6.createFunctionExpression = ts6.Debug.deprecate(ts6.factory.createFunctionExpression, factoryDeprecation); + ts6.updateFunctionExpression = ts6.Debug.deprecate(ts6.factory.updateFunctionExpression, factoryDeprecation); + ts6.createDelete = ts6.Debug.deprecate(ts6.factory.createDeleteExpression, factoryDeprecation); + ts6.updateDelete = ts6.Debug.deprecate(ts6.factory.updateDeleteExpression, factoryDeprecation); + ts6.createTypeOf = ts6.Debug.deprecate(ts6.factory.createTypeOfExpression, factoryDeprecation); + ts6.updateTypeOf = ts6.Debug.deprecate(ts6.factory.updateTypeOfExpression, factoryDeprecation); + ts6.createVoid = ts6.Debug.deprecate(ts6.factory.createVoidExpression, factoryDeprecation); + ts6.updateVoid = ts6.Debug.deprecate(ts6.factory.updateVoidExpression, factoryDeprecation); + ts6.createAwait = ts6.Debug.deprecate(ts6.factory.createAwaitExpression, factoryDeprecation); + ts6.updateAwait = ts6.Debug.deprecate(ts6.factory.updateAwaitExpression, factoryDeprecation); + ts6.createPrefix = ts6.Debug.deprecate(ts6.factory.createPrefixUnaryExpression, factoryDeprecation); + ts6.updatePrefix = ts6.Debug.deprecate(ts6.factory.updatePrefixUnaryExpression, factoryDeprecation); + ts6.createPostfix = ts6.Debug.deprecate(ts6.factory.createPostfixUnaryExpression, factoryDeprecation); + ts6.updatePostfix = ts6.Debug.deprecate(ts6.factory.updatePostfixUnaryExpression, factoryDeprecation); + ts6.createBinary = ts6.Debug.deprecate(ts6.factory.createBinaryExpression, factoryDeprecation); + ts6.updateConditional = ts6.Debug.deprecate(ts6.factory.updateConditionalExpression, factoryDeprecation); + ts6.createTemplateExpression = ts6.Debug.deprecate(ts6.factory.createTemplateExpression, factoryDeprecation); + ts6.updateTemplateExpression = ts6.Debug.deprecate(ts6.factory.updateTemplateExpression, factoryDeprecation); + ts6.createTemplateHead = ts6.Debug.deprecate(ts6.factory.createTemplateHead, factoryDeprecation); + ts6.createTemplateMiddle = ts6.Debug.deprecate(ts6.factory.createTemplateMiddle, factoryDeprecation); + ts6.createTemplateTail = ts6.Debug.deprecate(ts6.factory.createTemplateTail, factoryDeprecation); + ts6.createNoSubstitutionTemplateLiteral = ts6.Debug.deprecate(ts6.factory.createNoSubstitutionTemplateLiteral, factoryDeprecation); + ts6.updateYield = ts6.Debug.deprecate(ts6.factory.updateYieldExpression, factoryDeprecation); + ts6.createSpread = ts6.Debug.deprecate(ts6.factory.createSpreadElement, factoryDeprecation); + ts6.updateSpread = ts6.Debug.deprecate(ts6.factory.updateSpreadElement, factoryDeprecation); + ts6.createOmittedExpression = ts6.Debug.deprecate(ts6.factory.createOmittedExpression, factoryDeprecation); + ts6.createAsExpression = ts6.Debug.deprecate(ts6.factory.createAsExpression, factoryDeprecation); + ts6.updateAsExpression = ts6.Debug.deprecate(ts6.factory.updateAsExpression, factoryDeprecation); + ts6.createNonNullExpression = ts6.Debug.deprecate(ts6.factory.createNonNullExpression, factoryDeprecation); + ts6.updateNonNullExpression = ts6.Debug.deprecate(ts6.factory.updateNonNullExpression, factoryDeprecation); + ts6.createNonNullChain = ts6.Debug.deprecate(ts6.factory.createNonNullChain, factoryDeprecation); + ts6.updateNonNullChain = ts6.Debug.deprecate(ts6.factory.updateNonNullChain, factoryDeprecation); + ts6.createMetaProperty = ts6.Debug.deprecate(ts6.factory.createMetaProperty, factoryDeprecation); + ts6.updateMetaProperty = ts6.Debug.deprecate(ts6.factory.updateMetaProperty, factoryDeprecation); + ts6.createTemplateSpan = ts6.Debug.deprecate(ts6.factory.createTemplateSpan, factoryDeprecation); + ts6.updateTemplateSpan = ts6.Debug.deprecate(ts6.factory.updateTemplateSpan, factoryDeprecation); + ts6.createSemicolonClassElement = ts6.Debug.deprecate(ts6.factory.createSemicolonClassElement, factoryDeprecation); + ts6.createBlock = ts6.Debug.deprecate(ts6.factory.createBlock, factoryDeprecation); + ts6.updateBlock = ts6.Debug.deprecate(ts6.factory.updateBlock, factoryDeprecation); + ts6.createVariableStatement = ts6.Debug.deprecate(ts6.factory.createVariableStatement, factoryDeprecation); + ts6.updateVariableStatement = ts6.Debug.deprecate(ts6.factory.updateVariableStatement, factoryDeprecation); + ts6.createEmptyStatement = ts6.Debug.deprecate(ts6.factory.createEmptyStatement, factoryDeprecation); + ts6.createExpressionStatement = ts6.Debug.deprecate(ts6.factory.createExpressionStatement, factoryDeprecation); + ts6.updateExpressionStatement = ts6.Debug.deprecate(ts6.factory.updateExpressionStatement, factoryDeprecation); + ts6.createStatement = ts6.Debug.deprecate(ts6.factory.createExpressionStatement, factoryDeprecation); + ts6.updateStatement = ts6.Debug.deprecate(ts6.factory.updateExpressionStatement, factoryDeprecation); + ts6.createIf = ts6.Debug.deprecate(ts6.factory.createIfStatement, factoryDeprecation); + ts6.updateIf = ts6.Debug.deprecate(ts6.factory.updateIfStatement, factoryDeprecation); + ts6.createDo = ts6.Debug.deprecate(ts6.factory.createDoStatement, factoryDeprecation); + ts6.updateDo = ts6.Debug.deprecate(ts6.factory.updateDoStatement, factoryDeprecation); + ts6.createWhile = ts6.Debug.deprecate(ts6.factory.createWhileStatement, factoryDeprecation); + ts6.updateWhile = ts6.Debug.deprecate(ts6.factory.updateWhileStatement, factoryDeprecation); + ts6.createFor = ts6.Debug.deprecate(ts6.factory.createForStatement, factoryDeprecation); + ts6.updateFor = ts6.Debug.deprecate(ts6.factory.updateForStatement, factoryDeprecation); + ts6.createForIn = ts6.Debug.deprecate(ts6.factory.createForInStatement, factoryDeprecation); + ts6.updateForIn = ts6.Debug.deprecate(ts6.factory.updateForInStatement, factoryDeprecation); + ts6.createForOf = ts6.Debug.deprecate(ts6.factory.createForOfStatement, factoryDeprecation); + ts6.updateForOf = ts6.Debug.deprecate(ts6.factory.updateForOfStatement, factoryDeprecation); + ts6.createContinue = ts6.Debug.deprecate(ts6.factory.createContinueStatement, factoryDeprecation); + ts6.updateContinue = ts6.Debug.deprecate(ts6.factory.updateContinueStatement, factoryDeprecation); + ts6.createBreak = ts6.Debug.deprecate(ts6.factory.createBreakStatement, factoryDeprecation); + ts6.updateBreak = ts6.Debug.deprecate(ts6.factory.updateBreakStatement, factoryDeprecation); + ts6.createReturn = ts6.Debug.deprecate(ts6.factory.createReturnStatement, factoryDeprecation); + ts6.updateReturn = ts6.Debug.deprecate(ts6.factory.updateReturnStatement, factoryDeprecation); + ts6.createWith = ts6.Debug.deprecate(ts6.factory.createWithStatement, factoryDeprecation); + ts6.updateWith = ts6.Debug.deprecate(ts6.factory.updateWithStatement, factoryDeprecation); + ts6.createSwitch = ts6.Debug.deprecate(ts6.factory.createSwitchStatement, factoryDeprecation); + ts6.updateSwitch = ts6.Debug.deprecate(ts6.factory.updateSwitchStatement, factoryDeprecation); + ts6.createLabel = ts6.Debug.deprecate(ts6.factory.createLabeledStatement, factoryDeprecation); + ts6.updateLabel = ts6.Debug.deprecate(ts6.factory.updateLabeledStatement, factoryDeprecation); + ts6.createThrow = ts6.Debug.deprecate(ts6.factory.createThrowStatement, factoryDeprecation); + ts6.updateThrow = ts6.Debug.deprecate(ts6.factory.updateThrowStatement, factoryDeprecation); + ts6.createTry = ts6.Debug.deprecate(ts6.factory.createTryStatement, factoryDeprecation); + ts6.updateTry = ts6.Debug.deprecate(ts6.factory.updateTryStatement, factoryDeprecation); + ts6.createDebuggerStatement = ts6.Debug.deprecate(ts6.factory.createDebuggerStatement, factoryDeprecation); + ts6.createVariableDeclarationList = ts6.Debug.deprecate(ts6.factory.createVariableDeclarationList, factoryDeprecation); + ts6.updateVariableDeclarationList = ts6.Debug.deprecate(ts6.factory.updateVariableDeclarationList, factoryDeprecation); + ts6.createFunctionDeclaration = ts6.Debug.deprecate(ts6.factory.createFunctionDeclaration, factoryDeprecation); + ts6.updateFunctionDeclaration = ts6.Debug.deprecate(ts6.factory.updateFunctionDeclaration, factoryDeprecation); + ts6.createClassDeclaration = ts6.Debug.deprecate(ts6.factory.createClassDeclaration, factoryDeprecation); + ts6.updateClassDeclaration = ts6.Debug.deprecate(ts6.factory.updateClassDeclaration, factoryDeprecation); + ts6.createInterfaceDeclaration = ts6.Debug.deprecate(ts6.factory.createInterfaceDeclaration, factoryDeprecation); + ts6.updateInterfaceDeclaration = ts6.Debug.deprecate(ts6.factory.updateInterfaceDeclaration, factoryDeprecation); + ts6.createTypeAliasDeclaration = ts6.Debug.deprecate(ts6.factory.createTypeAliasDeclaration, factoryDeprecation); + ts6.updateTypeAliasDeclaration = ts6.Debug.deprecate(ts6.factory.updateTypeAliasDeclaration, factoryDeprecation); + ts6.createEnumDeclaration = ts6.Debug.deprecate(ts6.factory.createEnumDeclaration, factoryDeprecation); + ts6.updateEnumDeclaration = ts6.Debug.deprecate(ts6.factory.updateEnumDeclaration, factoryDeprecation); + ts6.createModuleDeclaration = ts6.Debug.deprecate(ts6.factory.createModuleDeclaration, factoryDeprecation); + ts6.updateModuleDeclaration = ts6.Debug.deprecate(ts6.factory.updateModuleDeclaration, factoryDeprecation); + ts6.createModuleBlock = ts6.Debug.deprecate(ts6.factory.createModuleBlock, factoryDeprecation); + ts6.updateModuleBlock = ts6.Debug.deprecate(ts6.factory.updateModuleBlock, factoryDeprecation); + ts6.createCaseBlock = ts6.Debug.deprecate(ts6.factory.createCaseBlock, factoryDeprecation); + ts6.updateCaseBlock = ts6.Debug.deprecate(ts6.factory.updateCaseBlock, factoryDeprecation); + ts6.createNamespaceExportDeclaration = ts6.Debug.deprecate(ts6.factory.createNamespaceExportDeclaration, factoryDeprecation); + ts6.updateNamespaceExportDeclaration = ts6.Debug.deprecate(ts6.factory.updateNamespaceExportDeclaration, factoryDeprecation); + ts6.createImportEqualsDeclaration = ts6.Debug.deprecate(ts6.factory.createImportEqualsDeclaration, factoryDeprecation); + ts6.updateImportEqualsDeclaration = ts6.Debug.deprecate(ts6.factory.updateImportEqualsDeclaration, factoryDeprecation); + ts6.createImportDeclaration = ts6.Debug.deprecate(ts6.factory.createImportDeclaration, factoryDeprecation); + ts6.updateImportDeclaration = ts6.Debug.deprecate(ts6.factory.updateImportDeclaration, factoryDeprecation); + ts6.createNamespaceImport = ts6.Debug.deprecate(ts6.factory.createNamespaceImport, factoryDeprecation); + ts6.updateNamespaceImport = ts6.Debug.deprecate(ts6.factory.updateNamespaceImport, factoryDeprecation); + ts6.createNamedImports = ts6.Debug.deprecate(ts6.factory.createNamedImports, factoryDeprecation); + ts6.updateNamedImports = ts6.Debug.deprecate(ts6.factory.updateNamedImports, factoryDeprecation); + ts6.createImportSpecifier = ts6.Debug.deprecate(ts6.factory.createImportSpecifier, factoryDeprecation); + ts6.updateImportSpecifier = ts6.Debug.deprecate(ts6.factory.updateImportSpecifier, factoryDeprecation); + ts6.createExportAssignment = ts6.Debug.deprecate(ts6.factory.createExportAssignment, factoryDeprecation); + ts6.updateExportAssignment = ts6.Debug.deprecate(ts6.factory.updateExportAssignment, factoryDeprecation); + ts6.createNamedExports = ts6.Debug.deprecate(ts6.factory.createNamedExports, factoryDeprecation); + ts6.updateNamedExports = ts6.Debug.deprecate(ts6.factory.updateNamedExports, factoryDeprecation); + ts6.createExportSpecifier = ts6.Debug.deprecate(ts6.factory.createExportSpecifier, factoryDeprecation); + ts6.updateExportSpecifier = ts6.Debug.deprecate(ts6.factory.updateExportSpecifier, factoryDeprecation); + ts6.createExternalModuleReference = ts6.Debug.deprecate(ts6.factory.createExternalModuleReference, factoryDeprecation); + ts6.updateExternalModuleReference = ts6.Debug.deprecate(ts6.factory.updateExternalModuleReference, factoryDeprecation); + ts6.createJSDocTypeExpression = ts6.Debug.deprecate(ts6.factory.createJSDocTypeExpression, factoryDeprecation); + ts6.createJSDocTypeTag = ts6.Debug.deprecate(ts6.factory.createJSDocTypeTag, factoryDeprecation); + ts6.createJSDocReturnTag = ts6.Debug.deprecate(ts6.factory.createJSDocReturnTag, factoryDeprecation); + ts6.createJSDocThisTag = ts6.Debug.deprecate(ts6.factory.createJSDocThisTag, factoryDeprecation); + ts6.createJSDocComment = ts6.Debug.deprecate(ts6.factory.createJSDocComment, factoryDeprecation); + ts6.createJSDocParameterTag = ts6.Debug.deprecate(ts6.factory.createJSDocParameterTag, factoryDeprecation); + ts6.createJSDocClassTag = ts6.Debug.deprecate(ts6.factory.createJSDocClassTag, factoryDeprecation); + ts6.createJSDocAugmentsTag = ts6.Debug.deprecate(ts6.factory.createJSDocAugmentsTag, factoryDeprecation); + ts6.createJSDocEnumTag = ts6.Debug.deprecate(ts6.factory.createJSDocEnumTag, factoryDeprecation); + ts6.createJSDocTemplateTag = ts6.Debug.deprecate(ts6.factory.createJSDocTemplateTag, factoryDeprecation); + ts6.createJSDocTypedefTag = ts6.Debug.deprecate(ts6.factory.createJSDocTypedefTag, factoryDeprecation); + ts6.createJSDocCallbackTag = ts6.Debug.deprecate(ts6.factory.createJSDocCallbackTag, factoryDeprecation); + ts6.createJSDocSignature = ts6.Debug.deprecate(ts6.factory.createJSDocSignature, factoryDeprecation); + ts6.createJSDocPropertyTag = ts6.Debug.deprecate(ts6.factory.createJSDocPropertyTag, factoryDeprecation); + ts6.createJSDocTypeLiteral = ts6.Debug.deprecate(ts6.factory.createJSDocTypeLiteral, factoryDeprecation); + ts6.createJSDocImplementsTag = ts6.Debug.deprecate(ts6.factory.createJSDocImplementsTag, factoryDeprecation); + ts6.createJSDocAuthorTag = ts6.Debug.deprecate(ts6.factory.createJSDocAuthorTag, factoryDeprecation); + ts6.createJSDocPublicTag = ts6.Debug.deprecate(ts6.factory.createJSDocPublicTag, factoryDeprecation); + ts6.createJSDocPrivateTag = ts6.Debug.deprecate(ts6.factory.createJSDocPrivateTag, factoryDeprecation); + ts6.createJSDocProtectedTag = ts6.Debug.deprecate(ts6.factory.createJSDocProtectedTag, factoryDeprecation); + ts6.createJSDocReadonlyTag = ts6.Debug.deprecate(ts6.factory.createJSDocReadonlyTag, factoryDeprecation); + ts6.createJSDocTag = ts6.Debug.deprecate(ts6.factory.createJSDocUnknownTag, factoryDeprecation); + ts6.createJsxElement = ts6.Debug.deprecate(ts6.factory.createJsxElement, factoryDeprecation); + ts6.updateJsxElement = ts6.Debug.deprecate(ts6.factory.updateJsxElement, factoryDeprecation); + ts6.createJsxSelfClosingElement = ts6.Debug.deprecate(ts6.factory.createJsxSelfClosingElement, factoryDeprecation); + ts6.updateJsxSelfClosingElement = ts6.Debug.deprecate(ts6.factory.updateJsxSelfClosingElement, factoryDeprecation); + ts6.createJsxOpeningElement = ts6.Debug.deprecate(ts6.factory.createJsxOpeningElement, factoryDeprecation); + ts6.updateJsxOpeningElement = ts6.Debug.deprecate(ts6.factory.updateJsxOpeningElement, factoryDeprecation); + ts6.createJsxClosingElement = ts6.Debug.deprecate(ts6.factory.createJsxClosingElement, factoryDeprecation); + ts6.updateJsxClosingElement = ts6.Debug.deprecate(ts6.factory.updateJsxClosingElement, factoryDeprecation); + ts6.createJsxFragment = ts6.Debug.deprecate(ts6.factory.createJsxFragment, factoryDeprecation); + ts6.createJsxText = ts6.Debug.deprecate(ts6.factory.createJsxText, factoryDeprecation); + ts6.updateJsxText = ts6.Debug.deprecate(ts6.factory.updateJsxText, factoryDeprecation); + ts6.createJsxOpeningFragment = ts6.Debug.deprecate(ts6.factory.createJsxOpeningFragment, factoryDeprecation); + ts6.createJsxJsxClosingFragment = ts6.Debug.deprecate(ts6.factory.createJsxJsxClosingFragment, factoryDeprecation); + ts6.updateJsxFragment = ts6.Debug.deprecate(ts6.factory.updateJsxFragment, factoryDeprecation); + ts6.createJsxAttribute = ts6.Debug.deprecate(ts6.factory.createJsxAttribute, factoryDeprecation); + ts6.updateJsxAttribute = ts6.Debug.deprecate(ts6.factory.updateJsxAttribute, factoryDeprecation); + ts6.createJsxAttributes = ts6.Debug.deprecate(ts6.factory.createJsxAttributes, factoryDeprecation); + ts6.updateJsxAttributes = ts6.Debug.deprecate(ts6.factory.updateJsxAttributes, factoryDeprecation); + ts6.createJsxSpreadAttribute = ts6.Debug.deprecate(ts6.factory.createJsxSpreadAttribute, factoryDeprecation); + ts6.updateJsxSpreadAttribute = ts6.Debug.deprecate(ts6.factory.updateJsxSpreadAttribute, factoryDeprecation); + ts6.createJsxExpression = ts6.Debug.deprecate(ts6.factory.createJsxExpression, factoryDeprecation); + ts6.updateJsxExpression = ts6.Debug.deprecate(ts6.factory.updateJsxExpression, factoryDeprecation); + ts6.createCaseClause = ts6.Debug.deprecate(ts6.factory.createCaseClause, factoryDeprecation); + ts6.updateCaseClause = ts6.Debug.deprecate(ts6.factory.updateCaseClause, factoryDeprecation); + ts6.createDefaultClause = ts6.Debug.deprecate(ts6.factory.createDefaultClause, factoryDeprecation); + ts6.updateDefaultClause = ts6.Debug.deprecate(ts6.factory.updateDefaultClause, factoryDeprecation); + ts6.createHeritageClause = ts6.Debug.deprecate(ts6.factory.createHeritageClause, factoryDeprecation); + ts6.updateHeritageClause = ts6.Debug.deprecate(ts6.factory.updateHeritageClause, factoryDeprecation); + ts6.createCatchClause = ts6.Debug.deprecate(ts6.factory.createCatchClause, factoryDeprecation); + ts6.updateCatchClause = ts6.Debug.deprecate(ts6.factory.updateCatchClause, factoryDeprecation); + ts6.createPropertyAssignment = ts6.Debug.deprecate(ts6.factory.createPropertyAssignment, factoryDeprecation); + ts6.updatePropertyAssignment = ts6.Debug.deprecate(ts6.factory.updatePropertyAssignment, factoryDeprecation); + ts6.createShorthandPropertyAssignment = ts6.Debug.deprecate(ts6.factory.createShorthandPropertyAssignment, factoryDeprecation); + ts6.updateShorthandPropertyAssignment = ts6.Debug.deprecate(ts6.factory.updateShorthandPropertyAssignment, factoryDeprecation); + ts6.createSpreadAssignment = ts6.Debug.deprecate(ts6.factory.createSpreadAssignment, factoryDeprecation); + ts6.updateSpreadAssignment = ts6.Debug.deprecate(ts6.factory.updateSpreadAssignment, factoryDeprecation); + ts6.createEnumMember = ts6.Debug.deprecate(ts6.factory.createEnumMember, factoryDeprecation); + ts6.updateEnumMember = ts6.Debug.deprecate(ts6.factory.updateEnumMember, factoryDeprecation); + ts6.updateSourceFileNode = ts6.Debug.deprecate(ts6.factory.updateSourceFile, factoryDeprecation); + ts6.createNotEmittedStatement = ts6.Debug.deprecate(ts6.factory.createNotEmittedStatement, factoryDeprecation); + ts6.createPartiallyEmittedExpression = ts6.Debug.deprecate(ts6.factory.createPartiallyEmittedExpression, factoryDeprecation); + ts6.updatePartiallyEmittedExpression = ts6.Debug.deprecate(ts6.factory.updatePartiallyEmittedExpression, factoryDeprecation); + ts6.createCommaList = ts6.Debug.deprecate(ts6.factory.createCommaListExpression, factoryDeprecation); + ts6.updateCommaList = ts6.Debug.deprecate(ts6.factory.updateCommaListExpression, factoryDeprecation); + ts6.createBundle = ts6.Debug.deprecate(ts6.factory.createBundle, factoryDeprecation); + ts6.updateBundle = ts6.Debug.deprecate(ts6.factory.updateBundle, factoryDeprecation); + ts6.createImmediatelyInvokedFunctionExpression = ts6.Debug.deprecate(ts6.factory.createImmediatelyInvokedFunctionExpression, factoryDeprecation); + ts6.createImmediatelyInvokedArrowFunction = ts6.Debug.deprecate(ts6.factory.createImmediatelyInvokedArrowFunction, factoryDeprecation); + ts6.createVoidZero = ts6.Debug.deprecate(ts6.factory.createVoidZero, factoryDeprecation); + ts6.createExportDefault = ts6.Debug.deprecate(ts6.factory.createExportDefault, factoryDeprecation); + ts6.createExternalModuleExport = ts6.Debug.deprecate(ts6.factory.createExternalModuleExport, factoryDeprecation); + ts6.createNamespaceExport = ts6.Debug.deprecate(ts6.factory.createNamespaceExport, factoryDeprecation); + ts6.updateNamespaceExport = ts6.Debug.deprecate(ts6.factory.updateNamespaceExport, factoryDeprecation); + ts6.createToken = ts6.Debug.deprecate(function createToken(kind) { + return ts6.factory.createToken(kind); + }, factoryDeprecation); + ts6.createIdentifier = ts6.Debug.deprecate(function createIdentifier(text) { + return ts6.factory.createIdentifier( + text, + /*typeArguments*/ + void 0, + /*originalKeywordKind*/ + void 0 + ); + }, factoryDeprecation); + ts6.createTempVariable = ts6.Debug.deprecate(function createTempVariable(recordTempVariable) { + return ts6.factory.createTempVariable( + recordTempVariable, + /*reserveInNestedScopes*/ + void 0 + ); + }, factoryDeprecation); + ts6.getGeneratedNameForNode = ts6.Debug.deprecate(function getGeneratedNameForNode(node) { + return ts6.factory.getGeneratedNameForNode( + node, + /*flags*/ + void 0 + ); + }, factoryDeprecation); + ts6.createOptimisticUniqueName = ts6.Debug.deprecate(function createOptimisticUniqueName(text) { + return ts6.factory.createUniqueName( + text, + 16 + /* GeneratedIdentifierFlags.Optimistic */ + ); + }, factoryDeprecation); + ts6.createFileLevelUniqueName = ts6.Debug.deprecate(function createFileLevelUniqueName(text) { + return ts6.factory.createUniqueName( + text, + 16 | 32 + /* GeneratedIdentifierFlags.FileLevel */ + ); + }, factoryDeprecation); + ts6.createIndexSignature = ts6.Debug.deprecate(function createIndexSignature(decorators, modifiers, parameters, type) { + return ts6.factory.createIndexSignature(decorators, modifiers, parameters, type); + }, factoryDeprecation); + ts6.createTypePredicateNode = ts6.Debug.deprecate(function createTypePredicateNode(parameterName, type) { + return ts6.factory.createTypePredicateNode( + /*assertsModifier*/ + void 0, + parameterName, + type + ); + }, factoryDeprecation); + ts6.updateTypePredicateNode = ts6.Debug.deprecate(function updateTypePredicateNode(node, parameterName, type) { + return ts6.factory.updateTypePredicateNode( + node, + /*assertsModifier*/ + void 0, + parameterName, + type + ); + }, factoryDeprecation); + ts6.createLiteral = ts6.Debug.deprecate(function createLiteral(value) { + if (typeof value === "number") { + return ts6.factory.createNumericLiteral(value); + } + if (typeof value === "object" && "base10Value" in value) { + return ts6.factory.createBigIntLiteral(value); + } + if (typeof value === "boolean") { + return value ? ts6.factory.createTrue() : ts6.factory.createFalse(); + } + if (typeof value === "string") { + return ts6.factory.createStringLiteral( + value, + /*isSingleQuote*/ + void 0 + ); + } + return ts6.factory.createStringLiteralFromNode(value); + }, { since: "4.0", warnAfter: "4.1", message: "Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead." }); + ts6.createMethodSignature = ts6.Debug.deprecate(function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + return ts6.factory.createMethodSignature( + /*modifiers*/ + void 0, + name, + questionToken, + typeParameters, + parameters, + type + ); + }, factoryDeprecation); + ts6.updateMethodSignature = ts6.Debug.deprecate(function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return ts6.factory.updateMethodSignature(node, node.modifiers, name, questionToken, typeParameters, parameters, type); + }, factoryDeprecation); + ts6.createTypeOperatorNode = ts6.Debug.deprecate(function createTypeOperatorNode(operatorOrType, type) { + var operator; + if (type) { + operator = operatorOrType; + } else { + type = operatorOrType; + operator = 141; + } + return ts6.factory.createTypeOperatorNode(operator, type); + }, factoryDeprecation); + ts6.createTaggedTemplate = ts6.Debug.deprecate(function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) { + var typeArguments; + if (template) { + typeArguments = typeArgumentsOrTemplate; + } else { + template = typeArgumentsOrTemplate; + } + return ts6.factory.createTaggedTemplateExpression(tag, typeArguments, template); + }, factoryDeprecation); + ts6.updateTaggedTemplate = ts6.Debug.deprecate(function updateTaggedTemplate(node, tag, typeArgumentsOrTemplate, template) { + var typeArguments; + if (template) { + typeArguments = typeArgumentsOrTemplate; + } else { + template = typeArgumentsOrTemplate; + } + return ts6.factory.updateTaggedTemplateExpression(node, tag, typeArguments, template); + }, factoryDeprecation); + ts6.updateBinary = ts6.Debug.deprecate(function updateBinary(node, left, right, operator) { + if (operator === void 0) { + operator = node.operatorToken; + } + if (typeof operator === "number") { + operator = operator === node.operatorToken.kind ? node.operatorToken : ts6.factory.createToken(operator); + } + return ts6.factory.updateBinaryExpression(node, left, operator, right); + }, factoryDeprecation); + ts6.createConditional = ts6.Debug.deprecate(function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + return arguments.length === 5 ? ts6.factory.createConditionalExpression(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) : arguments.length === 3 ? ts6.factory.createConditionalExpression(condition, ts6.factory.createToken( + 57 + /* SyntaxKind.QuestionToken */ + ), questionTokenOrWhenTrue, ts6.factory.createToken( + 58 + /* SyntaxKind.ColonToken */ + ), whenTrueOrWhenFalse) : ts6.Debug.fail("Argument count mismatch"); + }, factoryDeprecation); + ts6.createYield = ts6.Debug.deprecate(function createYield(asteriskTokenOrExpression, expression) { + var asteriskToken; + if (expression) { + asteriskToken = asteriskTokenOrExpression; + } else { + expression = asteriskTokenOrExpression; + } + return ts6.factory.createYieldExpression(asteriskToken, expression); + }, factoryDeprecation); + ts6.createClassExpression = ts6.Debug.deprecate(function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + return ts6.factory.createClassExpression( + /*decorators*/ + void 0, + modifiers, + name, + typeParameters, + heritageClauses, + members + ); + }, factoryDeprecation); + ts6.updateClassExpression = ts6.Debug.deprecate(function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { + return ts6.factory.updateClassExpression( + node, + /*decorators*/ + void 0, + modifiers, + name, + typeParameters, + heritageClauses, + members + ); + }, factoryDeprecation); + ts6.createPropertySignature = ts6.Debug.deprecate(function createPropertySignature(modifiers, name, questionToken, type, initializer) { + var node = ts6.factory.createPropertySignature(modifiers, name, questionToken, type); + node.initializer = initializer; + return node; + }, factoryDeprecation); + ts6.updatePropertySignature = ts6.Debug.deprecate(function updatePropertySignature(node, modifiers, name, questionToken, type, initializer) { + var updated = ts6.factory.updatePropertySignature(node, modifiers, name, questionToken, type); + if (node.initializer !== initializer) { + if (updated === node) { + updated = ts6.factory.cloneNode(node); + } + updated.initializer = initializer; + } + return updated; + }, factoryDeprecation); + ts6.createExpressionWithTypeArguments = ts6.Debug.deprecate(function createExpressionWithTypeArguments(typeArguments, expression) { + return ts6.factory.createExpressionWithTypeArguments(expression, typeArguments); + }, factoryDeprecation); + ts6.updateExpressionWithTypeArguments = ts6.Debug.deprecate(function updateExpressionWithTypeArguments(node, typeArguments, expression) { + return ts6.factory.updateExpressionWithTypeArguments(node, expression, typeArguments); + }, factoryDeprecation); + ts6.createArrowFunction = ts6.Debug.deprecate(function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanTokenOrBody, body) { + return arguments.length === 6 ? ts6.factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanTokenOrBody, body) : arguments.length === 5 ? ts6.factory.createArrowFunction( + modifiers, + typeParameters, + parameters, + type, + /*equalsGreaterThanToken*/ + void 0, + equalsGreaterThanTokenOrBody + ) : ts6.Debug.fail("Argument count mismatch"); + }, factoryDeprecation); + ts6.updateArrowFunction = ts6.Debug.deprecate(function updateArrowFunction(node, modifiers, typeParameters, parameters, type, equalsGreaterThanTokenOrBody, body) { + return arguments.length === 7 ? ts6.factory.updateArrowFunction(node, modifiers, typeParameters, parameters, type, equalsGreaterThanTokenOrBody, body) : arguments.length === 6 ? ts6.factory.updateArrowFunction(node, modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, equalsGreaterThanTokenOrBody) : ts6.Debug.fail("Argument count mismatch"); + }, factoryDeprecation); + ts6.createVariableDeclaration = ts6.Debug.deprecate(function createVariableDeclaration(name, exclamationTokenOrType, typeOrInitializer, initializer) { + return arguments.length === 4 ? ts6.factory.createVariableDeclaration(name, exclamationTokenOrType, typeOrInitializer, initializer) : arguments.length >= 1 && arguments.length <= 3 ? ts6.factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + exclamationTokenOrType, + typeOrInitializer + ) : ts6.Debug.fail("Argument count mismatch"); + }, factoryDeprecation); + ts6.updateVariableDeclaration = ts6.Debug.deprecate(function updateVariableDeclaration(node, name, exclamationTokenOrType, typeOrInitializer, initializer) { + return arguments.length === 5 ? ts6.factory.updateVariableDeclaration(node, name, exclamationTokenOrType, typeOrInitializer, initializer) : arguments.length === 4 ? ts6.factory.updateVariableDeclaration(node, name, node.exclamationToken, exclamationTokenOrType, typeOrInitializer) : ts6.Debug.fail("Argument count mismatch"); + }, factoryDeprecation); + ts6.createImportClause = ts6.Debug.deprecate(function createImportClause(name, namedBindings, isTypeOnly) { + if (isTypeOnly === void 0) { + isTypeOnly = false; + } + return ts6.factory.createImportClause(isTypeOnly, name, namedBindings); + }, factoryDeprecation); + ts6.updateImportClause = ts6.Debug.deprecate(function updateImportClause(node, name, namedBindings, isTypeOnly) { + return ts6.factory.updateImportClause(node, isTypeOnly, name, namedBindings); + }, factoryDeprecation); + ts6.createExportDeclaration = ts6.Debug.deprecate(function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, isTypeOnly) { + if (isTypeOnly === void 0) { + isTypeOnly = false; + } + return ts6.factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier); + }, factoryDeprecation); + ts6.updateExportDeclaration = ts6.Debug.deprecate(function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier, isTypeOnly) { + return ts6.factory.updateExportDeclaration(node, decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, node.assertClause); + }, factoryDeprecation); + ts6.createJSDocParamTag = ts6.Debug.deprecate(function createJSDocParamTag(name, isBracketed, typeExpression, comment) { + return ts6.factory.createJSDocParameterTag( + /*tagName*/ + void 0, + name, + isBracketed, + typeExpression, + /*isNameFirst*/ + false, + comment ? ts6.factory.createNodeArray([ts6.factory.createJSDocText(comment)]) : void 0 + ); + }, factoryDeprecation); + ts6.createComma = ts6.Debug.deprecate(function createComma(left, right) { + return ts6.factory.createComma(left, right); + }, factoryDeprecation); + ts6.createLessThan = ts6.Debug.deprecate(function createLessThan(left, right) { + return ts6.factory.createLessThan(left, right); + }, factoryDeprecation); + ts6.createAssignment = ts6.Debug.deprecate(function createAssignment(left, right) { + return ts6.factory.createAssignment(left, right); + }, factoryDeprecation); + ts6.createStrictEquality = ts6.Debug.deprecate(function createStrictEquality(left, right) { + return ts6.factory.createStrictEquality(left, right); + }, factoryDeprecation); + ts6.createStrictInequality = ts6.Debug.deprecate(function createStrictInequality(left, right) { + return ts6.factory.createStrictInequality(left, right); + }, factoryDeprecation); + ts6.createAdd = ts6.Debug.deprecate(function createAdd(left, right) { + return ts6.factory.createAdd(left, right); + }, factoryDeprecation); + ts6.createSubtract = ts6.Debug.deprecate(function createSubtract(left, right) { + return ts6.factory.createSubtract(left, right); + }, factoryDeprecation); + ts6.createLogicalAnd = ts6.Debug.deprecate(function createLogicalAnd(left, right) { + return ts6.factory.createLogicalAnd(left, right); + }, factoryDeprecation); + ts6.createLogicalOr = ts6.Debug.deprecate(function createLogicalOr(left, right) { + return ts6.factory.createLogicalOr(left, right); + }, factoryDeprecation); + ts6.createPostfixIncrement = ts6.Debug.deprecate(function createPostfixIncrement(operand) { + return ts6.factory.createPostfixIncrement(operand); + }, factoryDeprecation); + ts6.createLogicalNot = ts6.Debug.deprecate(function createLogicalNot(operand) { + return ts6.factory.createLogicalNot(operand); + }, factoryDeprecation); + ts6.createNode = ts6.Debug.deprecate(function createNode(kind, pos, end) { + if (pos === void 0) { + pos = 0; + } + if (end === void 0) { + end = 0; + } + return ts6.setTextRangePosEnd(kind === 308 ? ts6.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 ? ts6.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 ? ts6.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts6.isNodeKind(kind) ? ts6.parseBaseNodeFactory.createBaseTokenNode(kind) : ts6.parseBaseNodeFactory.createBaseNode(kind), pos, end); + }, { since: "4.0", warnAfter: "4.1", message: "Use an appropriate `factory` method instead." }); + ts6.getMutableClone = ts6.Debug.deprecate(function getMutableClone(node) { + var clone = ts6.factory.cloneNode(node); + ts6.setTextRange(clone, node); + ts6.setParent(clone, node.parent); + return clone; + }, { since: "4.0", warnAfter: "4.1", message: "Use an appropriate `factory.update...` method instead, use `setCommentRange` or `setSourceMapRange`, and avoid setting `parent`." }); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.isTypeAssertion = ts6.Debug.deprecate(function isTypeAssertion(node) { + return node.kind === 213; + }, { + since: "4.0", + warnAfter: "4.1", + message: "Use `isTypeAssertionExpression` instead." + }); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + ts6.isIdentifierOrPrivateIdentifier = ts6.Debug.deprecate(function isIdentifierOrPrivateIdentifier(node) { + return ts6.isMemberName(node); + }, { + since: "4.2", + warnAfter: "4.3", + message: "Use `isMemberName` instead." + }); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function patchNodeFactory(factory) { + var createConstructorTypeNode = factory.createConstructorTypeNode, updateConstructorTypeNode = factory.updateConstructorTypeNode; + factory.createConstructorTypeNode = ts6.buildOverload("createConstructorTypeNode").overload({ + 0: function(modifiers, typeParameters, parameters, type) { + return createConstructorTypeNode(modifiers, typeParameters, parameters, type); + }, + 1: function(typeParameters, parameters, type) { + return createConstructorTypeNode( + /*modifiers*/ + void 0, + typeParameters, + parameters, + type + ); + } + }).bind({ + 0: function(args) { + return args.length === 4; + }, + 1: function(args) { + return args.length === 3; + } + }).deprecate({ + 1: { since: "4.2", warnAfter: "4.3", message: "Use the overload that accepts 'modifiers'" } + }).finish(); + factory.updateConstructorTypeNode = ts6.buildOverload("updateConstructorTypeNode").overload({ + 0: function(node, modifiers, typeParameters, parameters, type) { + return updateConstructorTypeNode(node, modifiers, typeParameters, parameters, type); + }, + 1: function(node, typeParameters, parameters, type) { + return updateConstructorTypeNode(node, node.modifiers, typeParameters, parameters, type); + } + }).bind({ + 0: function(args) { + return args.length === 5; + }, + 1: function(args) { + return args.length === 4; + } + }).deprecate({ + 1: { since: "4.2", warnAfter: "4.3", message: "Use the overload that accepts 'modifiers'" } + }).finish(); + } + var prevCreateNodeFactory = ts6.createNodeFactory; + ts6.createNodeFactory = function(flags, baseFactory) { + var factory = prevCreateNodeFactory(flags, baseFactory); + patchNodeFactory(factory); + return factory; + }; + patchNodeFactory(ts6.factory); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function patchNodeFactory(factory) { + var createImportTypeNode = factory.createImportTypeNode, updateImportTypeNode = factory.updateImportTypeNode; + factory.createImportTypeNode = ts6.buildOverload("createImportTypeNode").overload({ + 0: function(argument, assertions, qualifier, typeArguments, isTypeOf) { + return createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf); + }, + 1: function(argument, qualifier, typeArguments, isTypeOf) { + return createImportTypeNode( + argument, + /*assertions*/ + void 0, + qualifier, + typeArguments, + isTypeOf + ); + } + }).bind({ + 0: function(_a) { + var assertions = _a[1], qualifier = _a[2], typeArguments = _a[3], isTypeOf = _a[4]; + return (assertions === void 0 || ts6.isImportTypeAssertionContainer(assertions)) && (qualifier === void 0 || !ts6.isArray(qualifier)) && (typeArguments === void 0 || ts6.isArray(typeArguments)) && (isTypeOf === void 0 || typeof isTypeOf === "boolean"); + }, + 1: function(_a) { + var qualifier = _a[1], typeArguments = _a[2], isTypeOf = _a[3], other = _a[4]; + return other === void 0 && (qualifier === void 0 || ts6.isEntityName(qualifier)) && (typeArguments === void 0 || ts6.isArray(typeArguments)) && (isTypeOf === void 0 || typeof isTypeOf === "boolean"); + } + }).deprecate({ + 1: { since: "4.6", warnAfter: "4.7", message: "Use the overload that accepts 'assertions'" } + }).finish(); + factory.updateImportTypeNode = ts6.buildOverload("updateImportTypeNode").overload({ + 0: function(node, argument, assertions, qualifier, typeArguments, isTypeOf) { + return updateImportTypeNode(node, argument, assertions, qualifier, typeArguments, isTypeOf); + }, + 1: function(node, argument, qualifier, typeArguments, isTypeOf) { + return updateImportTypeNode(node, argument, node.assertions, qualifier, typeArguments, isTypeOf); + } + }).bind({ + 0: function(_a) { + var assertions = _a[2], qualifier = _a[3], typeArguments = _a[4], isTypeOf = _a[5]; + return (assertions === void 0 || ts6.isImportTypeAssertionContainer(assertions)) && (qualifier === void 0 || !ts6.isArray(qualifier)) && (typeArguments === void 0 || ts6.isArray(typeArguments)) && (isTypeOf === void 0 || typeof isTypeOf === "boolean"); + }, + 1: function(_a) { + var qualifier = _a[2], typeArguments = _a[3], isTypeOf = _a[4], other = _a[5]; + return other === void 0 && (qualifier === void 0 || ts6.isEntityName(qualifier)) && (typeArguments === void 0 || ts6.isArray(typeArguments)) && (isTypeOf === void 0 || typeof isTypeOf === "boolean"); + } + }).deprecate({ + 1: { since: "4.6", warnAfter: "4.7", message: "Use the overload that accepts 'assertions'" } + }).finish(); + } + var prevCreateNodeFactory = ts6.createNodeFactory; + ts6.createNodeFactory = function(flags, baseFactory) { + var factory = prevCreateNodeFactory(flags, baseFactory); + patchNodeFactory(factory); + return factory; + }; + patchNodeFactory(ts6.factory); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + function patchNodeFactory(factory) { + var createTypeParameterDeclaration = factory.createTypeParameterDeclaration, updateTypeParameterDeclaration = factory.updateTypeParameterDeclaration; + factory.createTypeParameterDeclaration = ts6.buildOverload("createTypeParameterDeclaration").overload({ + 0: function(modifiers, name, constraint, defaultType) { + return createTypeParameterDeclaration(modifiers, name, constraint, defaultType); + }, + 1: function(name, constraint, defaultType) { + return createTypeParameterDeclaration( + /*modifiers*/ + void 0, + name, + constraint, + defaultType + ); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0]; + return modifiers === void 0 || ts6.isArray(modifiers); + }, + 1: function(_a) { + var name = _a[0]; + return name !== void 0 && !ts6.isArray(name); + } + }).deprecate({ + 1: { since: "4.7", warnAfter: "4.8", message: "Use the overload that accepts 'modifiers'" } + }).finish(); + factory.updateTypeParameterDeclaration = ts6.buildOverload("updateTypeParameterDeclaration").overload({ + 0: function(node, modifiers, name, constraint, defaultType) { + return updateTypeParameterDeclaration(node, modifiers, name, constraint, defaultType); + }, + 1: function(node, name, constraint, defaultType) { + return updateTypeParameterDeclaration(node, node.modifiers, name, constraint, defaultType); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1]; + return modifiers === void 0 || ts6.isArray(modifiers); + }, + 1: function(_a) { + var name = _a[1]; + return name !== void 0 && !ts6.isArray(name); + } + }).deprecate({ + 1: { since: "4.7", warnAfter: "4.8", message: "Use the overload that accepts 'modifiers'" } + }).finish(); + } + var prevCreateNodeFactory = ts6.createNodeFactory; + ts6.createNodeFactory = function(flags, baseFactory) { + var factory = prevCreateNodeFactory(flags, baseFactory); + patchNodeFactory(factory); + return factory; + }; + patchNodeFactory(ts6.factory); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters." }; + function patchNodeFactory(factory) { + var createParameterDeclaration = factory.createParameterDeclaration, updateParameterDeclaration = factory.updateParameterDeclaration, createPropertyDeclaration = factory.createPropertyDeclaration, updatePropertyDeclaration = factory.updatePropertyDeclaration, createMethodDeclaration = factory.createMethodDeclaration, updateMethodDeclaration = factory.updateMethodDeclaration, createConstructorDeclaration = factory.createConstructorDeclaration, updateConstructorDeclaration = factory.updateConstructorDeclaration, createGetAccessorDeclaration = factory.createGetAccessorDeclaration, updateGetAccessorDeclaration = factory.updateGetAccessorDeclaration, createSetAccessorDeclaration = factory.createSetAccessorDeclaration, updateSetAccessorDeclaration = factory.updateSetAccessorDeclaration, createIndexSignature = factory.createIndexSignature, updateIndexSignature = factory.updateIndexSignature, createClassStaticBlockDeclaration = factory.createClassStaticBlockDeclaration, updateClassStaticBlockDeclaration = factory.updateClassStaticBlockDeclaration, createClassExpression = factory.createClassExpression, updateClassExpression = factory.updateClassExpression, createFunctionDeclaration = factory.createFunctionDeclaration, updateFunctionDeclaration = factory.updateFunctionDeclaration, createClassDeclaration = factory.createClassDeclaration, updateClassDeclaration = factory.updateClassDeclaration, createInterfaceDeclaration = factory.createInterfaceDeclaration, updateInterfaceDeclaration = factory.updateInterfaceDeclaration, createTypeAliasDeclaration = factory.createTypeAliasDeclaration, updateTypeAliasDeclaration = factory.updateTypeAliasDeclaration, createEnumDeclaration = factory.createEnumDeclaration, updateEnumDeclaration = factory.updateEnumDeclaration, createModuleDeclaration = factory.createModuleDeclaration, updateModuleDeclaration = factory.updateModuleDeclaration, createImportEqualsDeclaration = factory.createImportEqualsDeclaration, updateImportEqualsDeclaration = factory.updateImportEqualsDeclaration, createImportDeclaration = factory.createImportDeclaration, updateImportDeclaration = factory.updateImportDeclaration, createExportAssignment = factory.createExportAssignment, updateExportAssignment = factory.updateExportAssignment, createExportDeclaration = factory.createExportDeclaration, updateExportDeclaration = factory.updateExportDeclaration; + factory.createParameterDeclaration = ts6.buildOverload("createParameterDeclaration").overload({ + 0: function(modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer); + }, + 1: function(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return createParameterDeclaration(ts6.concatenate(decorators, modifiers), dotDotDotToken, name, questionToken, type, initializer); + } + }).bind({ + 0: function(_a) { + var dotDotDotToken = _a[1], name = _a[2], questionToken = _a[3], type = _a[4], initializer = _a[5], other = _a[6]; + return other === void 0 && (dotDotDotToken === void 0 || !ts6.isArray(dotDotDotToken)) && (name === void 0 || typeof name === "string" || ts6.isBindingName(name)) && (questionToken === void 0 || typeof questionToken === "object" && ts6.isQuestionToken(questionToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + }, + 1: function(_a) { + var modifiers = _a[1], dotDotDotToken = _a[2], name = _a[3], questionToken = _a[4], type = _a[5], initializer = _a[6]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (dotDotDotToken === void 0 || typeof dotDotDotToken === "object" && ts6.isDotDotDotToken(dotDotDotToken)) && (name === void 0 || typeof name === "string" || ts6.isBindingName(name)) && (questionToken === void 0 || ts6.isQuestionToken(questionToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.updateParameterDeclaration = ts6.buildOverload("updateParameterDeclaration").overload({ + 0: function(node, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return updateParameterDeclaration(node, modifiers, dotDotDotToken, name, questionToken, type, initializer); + }, + 1: function(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return updateParameterDeclaration(node, ts6.concatenate(decorators, modifiers), dotDotDotToken, name, questionToken, type, initializer); + } + }).bind({ + 0: function(_a) { + var dotDotDotToken = _a[2], name = _a[3], questionToken = _a[4], type = _a[5], initializer = _a[6], other = _a[7]; + return other === void 0 && (dotDotDotToken === void 0 || !ts6.isArray(dotDotDotToken)) && (name === void 0 || typeof name === "string" || ts6.isBindingName(name)) && (questionToken === void 0 || typeof questionToken === "object" && ts6.isQuestionToken(questionToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + }, + 1: function(_a) { + var modifiers = _a[2], dotDotDotToken = _a[3], name = _a[4], questionToken = _a[5], type = _a[6], initializer = _a[7]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (dotDotDotToken === void 0 || typeof dotDotDotToken === "object" && ts6.isDotDotDotToken(dotDotDotToken)) && (name === void 0 || typeof name === "string" || ts6.isBindingName(name)) && (questionToken === void 0 || ts6.isQuestionToken(questionToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.createPropertyDeclaration = ts6.buildOverload("createPropertyDeclaration").overload({ + 0: function(modifiers, name, questionOrExclamationToken, type, initializer) { + return createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer); + }, + 1: function(decorators, modifiers, name, questionOrExclamationToken, type, initializer) { + return createPropertyDeclaration(ts6.concatenate(decorators, modifiers), name, questionOrExclamationToken, type, initializer); + } + }).bind({ + 0: function(_a) { + var name = _a[1], questionOrExclamationToken = _a[2], type = _a[3], initializer = _a[4], other = _a[5]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (questionOrExclamationToken === void 0 || typeof questionOrExclamationToken === "object" && ts6.isQuestionOrExclamationToken(questionOrExclamationToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + }, + 1: function(_a) { + var modifiers = _a[1], name = _a[2], questionOrExclamationToken = _a[3], type = _a[4], initializer = _a[5]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || typeof name === "string" || ts6.isPropertyName(name)) && (questionOrExclamationToken === void 0 || ts6.isQuestionOrExclamationToken(questionOrExclamationToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.updatePropertyDeclaration = ts6.buildOverload("updatePropertyDeclaration").overload({ + 0: function(node, modifiers, name, questionOrExclamationToken, type, initializer) { + return updatePropertyDeclaration(node, modifiers, name, questionOrExclamationToken, type, initializer); + }, + 1: function(node, decorators, modifiers, name, questionOrExclamationToken, type, initializer) { + return updatePropertyDeclaration(node, ts6.concatenate(decorators, modifiers), name, questionOrExclamationToken, type, initializer); + } + }).bind({ + 0: function(_a) { + var name = _a[2], questionOrExclamationToken = _a[3], type = _a[4], initializer = _a[5], other = _a[6]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (questionOrExclamationToken === void 0 || typeof questionOrExclamationToken === "object" && ts6.isQuestionOrExclamationToken(questionOrExclamationToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + }, + 1: function(_a) { + var modifiers = _a[2], name = _a[3], questionOrExclamationToken = _a[4], type = _a[5], initializer = _a[6]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || typeof name === "string" || ts6.isPropertyName(name)) && (questionOrExclamationToken === void 0 || ts6.isQuestionOrExclamationToken(questionOrExclamationToken)) && (type === void 0 || ts6.isTypeNode(type)) && (initializer === void 0 || ts6.isExpression(initializer)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.createMethodDeclaration = ts6.buildOverload("createMethodDeclaration").overload({ + 0: function(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body); + }, + 1: function(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return createMethodDeclaration(ts6.concatenate(decorators, modifiers), asteriskToken, name, questionToken, typeParameters, parameters, type, body); + } + }).bind({ + 0: function(_a) { + var asteriskToken = _a[1], name = _a[2], questionToken = _a[3], typeParameters = _a[4], parameters = _a[5], type = _a[6], body = _a[7], other = _a[8]; + return other === void 0 && (asteriskToken === void 0 || !ts6.isArray(asteriskToken)) && (name === void 0 || typeof name === "string" || ts6.isPropertyName(name)) && (questionToken === void 0 || typeof questionToken === "object" && ts6.isQuestionToken(questionToken)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (parameters === void 0 || !ts6.some(parameters, ts6.isTypeParameterDeclaration)) && (type === void 0 || !ts6.isArray(type)) && (body === void 0 || ts6.isBlock(body)); + }, + 1: function(_a) { + var modifiers = _a[1], asteriskToken = _a[2], name = _a[3], questionToken = _a[4], typeParameters = _a[5], parameters = _a[6], type = _a[7], body = _a[8]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (asteriskToken === void 0 || typeof asteriskToken === "object" && ts6.isAsteriskToken(asteriskToken)) && (name === void 0 || typeof name === "string" || ts6.isPropertyName(name)) && (questionToken === void 0 || !ts6.isArray(questionToken)) && (typeParameters === void 0 || !ts6.some(typeParameters, ts6.isParameter)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.updateMethodDeclaration = ts6.buildOverload("updateMethodDeclaration").overload({ + 0: function(node, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return updateMethodDeclaration(node, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body); + }, + 1: function(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return updateMethodDeclaration(node, ts6.concatenate(decorators, modifiers), asteriskToken, name, questionToken, typeParameters, parameters, type, body); + } + }).bind({ + 0: function(_a) { + var asteriskToken = _a[2], name = _a[3], questionToken = _a[4], typeParameters = _a[5], parameters = _a[6], type = _a[7], body = _a[8], other = _a[9]; + return other === void 0 && (asteriskToken === void 0 || !ts6.isArray(asteriskToken)) && (name === void 0 || typeof name === "string" || ts6.isPropertyName(name)) && (questionToken === void 0 || typeof questionToken === "object" && ts6.isQuestionToken(questionToken)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (parameters === void 0 || !ts6.some(parameters, ts6.isTypeParameterDeclaration)) && (type === void 0 || !ts6.isArray(type)) && (body === void 0 || ts6.isBlock(body)); + }, + 1: function(_a) { + var modifiers = _a[2], asteriskToken = _a[3], name = _a[4], questionToken = _a[5], typeParameters = _a[6], parameters = _a[7], type = _a[8], body = _a[9]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (asteriskToken === void 0 || typeof asteriskToken === "object" && ts6.isAsteriskToken(asteriskToken)) && (name === void 0 || typeof name === "string" || ts6.isPropertyName(name)) && (questionToken === void 0 || !ts6.isArray(questionToken)) && (typeParameters === void 0 || !ts6.some(typeParameters, ts6.isParameter)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.createConstructorDeclaration = ts6.buildOverload("createConstructorDeclaration").overload({ + 0: function(modifiers, parameters, body) { + return createConstructorDeclaration(modifiers, parameters, body); + }, + 1: function(_decorators, modifiers, parameters, body) { + return createConstructorDeclaration(modifiers, parameters, body); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], parameters = _a[1], body = _a[2], other = _a[3]; + return other === void 0 && (modifiers === void 0 || !ts6.some(modifiers, ts6.isDecorator)) && (parameters === void 0 || !ts6.some(parameters, ts6.isModifier)) && (body === void 0 || !ts6.isArray(body)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], parameters = _a[2], body = _a[3]; + return (decorators === void 0 || !ts6.some(decorators, ts6.isModifier)) && (modifiers === void 0 || !ts6.some(modifiers, ts6.isParameter)) && (parameters === void 0 || ts6.isArray(parameters)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateConstructorDeclaration = ts6.buildOverload("updateConstructorDeclaration").overload({ + 0: function(node, modifiers, parameters, body) { + return updateConstructorDeclaration(node, modifiers, parameters, body); + }, + 1: function(node, _decorators, modifiers, parameters, body) { + return updateConstructorDeclaration(node, modifiers, parameters, body); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], parameters = _a[2], body = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || !ts6.some(modifiers, ts6.isDecorator)) && (parameters === void 0 || !ts6.some(parameters, ts6.isModifier)) && (body === void 0 || !ts6.isArray(body)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], parameters = _a[3], body = _a[4]; + return (decorators === void 0 || !ts6.some(decorators, ts6.isModifier)) && (modifiers === void 0 || !ts6.some(modifiers, ts6.isParameter)) && (parameters === void 0 || ts6.isArray(parameters)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createGetAccessorDeclaration = ts6.buildOverload("createGetAccessorDeclaration").overload({ + 0: function(modifiers, name, parameters, type, body) { + return createGetAccessorDeclaration(modifiers, name, parameters, type, body); + }, + 1: function(decorators, modifiers, name, parameters, type, body) { + return createGetAccessorDeclaration(ts6.concatenate(decorators, modifiers), name, parameters, type, body); + } + }).bind({ + 0: function(_a) { + var name = _a[1], parameters = _a[2], type = _a[3], body = _a[4], other = _a[5]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || !ts6.isArray(type)) && (body === void 0 || ts6.isBlock(body)); + }, + 1: function(_a) { + var modifiers = _a[1], name = _a[2], parameters = _a[3], type = _a[4], body = _a[5]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.updateGetAccessorDeclaration = ts6.buildOverload("updateGetAccessorDeclaration").overload({ + 0: function(node, modifiers, name, parameters, type, body) { + return updateGetAccessorDeclaration(node, modifiers, name, parameters, type, body); + }, + 1: function(node, decorators, modifiers, name, parameters, type, body) { + return updateGetAccessorDeclaration(node, ts6.concatenate(decorators, modifiers), name, parameters, type, body); + } + }).bind({ + 0: function(_a) { + var name = _a[2], parameters = _a[3], type = _a[4], body = _a[5], other = _a[6]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || !ts6.isArray(type)) && (body === void 0 || ts6.isBlock(body)); + }, + 1: function(_a) { + var modifiers = _a[2], name = _a[3], parameters = _a[4], type = _a[5], body = _a[6]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.createSetAccessorDeclaration = ts6.buildOverload("createSetAccessorDeclaration").overload({ + 0: function(modifiers, name, parameters, body) { + return createSetAccessorDeclaration(modifiers, name, parameters, body); + }, + 1: function(decorators, modifiers, name, parameters, body) { + return createSetAccessorDeclaration(ts6.concatenate(decorators, modifiers), name, parameters, body); + } + }).bind({ + 0: function(_a) { + var name = _a[1], parameters = _a[2], body = _a[3], other = _a[4]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (body === void 0 || !ts6.isArray(body)); + }, + 1: function(_a) { + var modifiers = _a[1], name = _a[2], parameters = _a[3], body = _a[4]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.updateSetAccessorDeclaration = ts6.buildOverload("updateSetAccessorDeclaration").overload({ + 0: function(node, modifiers, name, parameters, body) { + return updateSetAccessorDeclaration(node, modifiers, name, parameters, body); + }, + 1: function(node, decorators, modifiers, name, parameters, body) { + return updateSetAccessorDeclaration(node, ts6.concatenate(decorators, modifiers), name, parameters, body); + } + }).bind({ + 0: function(_a) { + var name = _a[2], parameters = _a[3], body = _a[4], other = _a[5]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (body === void 0 || !ts6.isArray(body)); + }, + 1: function(_a) { + var modifiers = _a[2], name = _a[3], parameters = _a[4], body = _a[5]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (parameters === void 0 || ts6.isArray(parameters)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.createIndexSignature = ts6.buildOverload("createIndexSignature").overload({ + 0: function(modifiers, parameters, type) { + return createIndexSignature(modifiers, parameters, type); + }, + 1: function(_decorators, modifiers, parameters, type) { + return createIndexSignature(modifiers, parameters, type); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], parameters = _a[1], type = _a[2], other = _a[3]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (parameters === void 0 || ts6.every(parameters, ts6.isParameter)) && (type === void 0 || !ts6.isArray(type)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], parameters = _a[2], type = _a[3]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateIndexSignature = ts6.buildOverload("updateIndexSignature").overload({ + 0: function(node, modifiers, parameters, type) { + return updateIndexSignature(node, modifiers, parameters, type); + }, + 1: function(node, _decorators, modifiers, parameters, type) { + return updateIndexSignature(node, modifiers, parameters, type); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], parameters = _a[2], type = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (parameters === void 0 || ts6.every(parameters, ts6.isParameter)) && (type === void 0 || !ts6.isArray(type)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], parameters = _a[3], type = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createClassStaticBlockDeclaration = ts6.buildOverload("createClassStaticBlockDeclaration").overload({ + 0: function(body) { + return createClassStaticBlockDeclaration(body); + }, + 1: function(_decorators, _modifiers, body) { + return createClassStaticBlockDeclaration(body); + } + }).bind({ + 0: function(_a) { + var body = _a[0], other1 = _a[1], other2 = _a[2]; + return other1 === void 0 && other2 === void 0 && (body === void 0 || !ts6.isArray(body)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], body = _a[2]; + return (decorators === void 0 || ts6.isArray(decorators)) && (modifiers === void 0 || ts6.isArray(decorators)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS_AND_MODIFIERS + }).finish(); + factory.updateClassStaticBlockDeclaration = ts6.buildOverload("updateClassStaticBlockDeclaration").overload({ + 0: function(node, body) { + return updateClassStaticBlockDeclaration(node, body); + }, + 1: function(node, _decorators, _modifiers, body) { + return updateClassStaticBlockDeclaration(node, body); + } + }).bind({ + 0: function(_a) { + var body = _a[1], other1 = _a[2], other2 = _a[3]; + return other1 === void 0 && other2 === void 0 && (body === void 0 || !ts6.isArray(body)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], body = _a[3]; + return (decorators === void 0 || ts6.isArray(decorators)) && (modifiers === void 0 || ts6.isArray(decorators)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS_AND_MODIFIERS + }).finish(); + factory.createClassExpression = ts6.buildOverload("createClassExpression").overload({ + 0: function(modifiers, name, typeParameters, heritageClauses, members) { + return createClassExpression(modifiers, name, typeParameters, heritageClauses, members); + }, + 1: function(decorators, modifiers, name, typeParameters, heritageClauses, members) { + return createClassExpression(ts6.concatenate(decorators, modifiers), name, typeParameters, heritageClauses, members); + } + }).bind({ + 0: function(_a) { + var name = _a[1], typeParameters = _a[2], heritageClauses = _a[3], members = _a[4], other = _a[5]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isClassElement)); + }, + 1: function(_a) { + var modifiers = _a[1], name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.isArray(members)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateClassExpression = ts6.buildOverload("updateClassExpression").overload({ + 0: function(node, modifiers, name, typeParameters, heritageClauses, members) { + return updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members); + }, + 1: function(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { + return updateClassExpression(node, ts6.concatenate(decorators, modifiers), name, typeParameters, heritageClauses, members); + } + }).bind({ + 0: function(_a) { + var name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5], other = _a[6]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isClassElement)); + }, + 1: function(_a) { + var modifiers = _a[2], name = _a[3], typeParameters = _a[4], heritageClauses = _a[5], members = _a[6]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.isArray(members)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createFunctionDeclaration = ts6.buildOverload("createFunctionDeclaration").overload({ + 0: function(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); + }, + 1: function(_decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); + } + }).bind({ + 0: function(_a) { + var asteriskToken = _a[1], name = _a[2], typeParameters = _a[3], parameters = _a[4], type = _a[5], body = _a[6], other = _a[7]; + return other === void 0 && (asteriskToken === void 0 || !ts6.isArray(asteriskToken)) && (name === void 0 || typeof name === "string" || ts6.isIdentifier(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (parameters === void 0 || ts6.every(parameters, ts6.isParameter)) && (type === void 0 || !ts6.isArray(type)) && (body === void 0 || ts6.isBlock(body)); + }, + 1: function(_a) { + var modifiers = _a[1], asteriskToken = _a[2], name = _a[3], typeParameters = _a[4], parameters = _a[5], type = _a[6], body = _a[7]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (asteriskToken === void 0 || typeof asteriskToken !== "string" && ts6.isAsteriskToken(asteriskToken)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateFunctionDeclaration = ts6.buildOverload("updateFunctionDeclaration").overload({ + 0: function(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return updateFunctionDeclaration(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body); + }, + 1: function(node, _decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return updateFunctionDeclaration(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body); + } + }).bind({ + 0: function(_a) { + var asteriskToken = _a[2], name = _a[3], typeParameters = _a[4], parameters = _a[5], type = _a[6], body = _a[7], other = _a[8]; + return other === void 0 && (asteriskToken === void 0 || !ts6.isArray(asteriskToken)) && (name === void 0 || ts6.isIdentifier(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (parameters === void 0 || ts6.every(parameters, ts6.isParameter)) && (type === void 0 || !ts6.isArray(type)) && (body === void 0 || ts6.isBlock(body)); + }, + 1: function(_a) { + var modifiers = _a[2], asteriskToken = _a[3], name = _a[4], typeParameters = _a[5], parameters = _a[6], type = _a[7], body = _a[8]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (asteriskToken === void 0 || typeof asteriskToken !== "string" && ts6.isAsteriskToken(asteriskToken)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (parameters === void 0 || ts6.isArray(parameters)) && (type === void 0 || ts6.isTypeNode(type)) && (body === void 0 || ts6.isBlock(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createClassDeclaration = ts6.buildOverload("createClassDeclaration").overload({ + 0: function(modifiers, name, typeParameters, heritageClauses, members) { + return createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members); + }, + 1: function(decorators, modifiers, name, typeParameters, heritageClauses, members) { + return createClassDeclaration(ts6.concatenate(decorators, modifiers), name, typeParameters, heritageClauses, members); + } + }).bind({ + 0: function(_a) { + var name = _a[1], typeParameters = _a[2], heritageClauses = _a[3], members = _a[4], other = _a[5]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isClassElement)); + }, + 1: function() { + return true; + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.updateClassDeclaration = ts6.buildOverload("updateClassDeclaration").overload({ + 0: function(node, modifiers, name, typeParameters, heritageClauses, members) { + return updateClassDeclaration(node, modifiers, name, typeParameters, heritageClauses, members); + }, + 1: function(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { + return updateClassDeclaration(node, ts6.concatenate(decorators, modifiers), name, typeParameters, heritageClauses, members); + } + }).bind({ + 0: function(_a) { + var name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5], other = _a[6]; + return other === void 0 && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isClassElement)); + }, + 1: function(_a) { + var modifiers = _a[2], name = _a[3], typeParameters = _a[4], heritageClauses = _a[5], members = _a[6]; + return (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.isArray(members)); + } + }).deprecate({ + 1: MUST_MERGE + }).finish(); + factory.createInterfaceDeclaration = ts6.buildOverload("createInterfaceDeclaration").overload({ + 0: function(modifiers, name, typeParameters, heritageClauses, members) { + return createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); + }, + 1: function(_decorators, modifiers, name, typeParameters, heritageClauses, members) { + return createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], name = _a[1], typeParameters = _a[2], heritageClauses = _a[3], members = _a[4], other = _a[5]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isTypeElement)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isTypeElement)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateInterfaceDeclaration = ts6.buildOverload("updateInterfaceDeclaration").overload({ + 0: function(node, modifiers, name, typeParameters, heritageClauses, members) { + return updateInterfaceDeclaration(node, modifiers, name, typeParameters, heritageClauses, members); + }, + 1: function(node, _decorators, modifiers, name, typeParameters, heritageClauses, members) { + return updateInterfaceDeclaration(node, modifiers, name, typeParameters, heritageClauses, members); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], name = _a[2], typeParameters = _a[3], heritageClauses = _a[4], members = _a[5], other = _a[6]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isTypeElement)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], name = _a[3], typeParameters = _a[4], heritageClauses = _a[5], members = _a[6]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.every(typeParameters, ts6.isTypeParameterDeclaration)) && (heritageClauses === void 0 || ts6.every(heritageClauses, ts6.isHeritageClause)) && (members === void 0 || ts6.every(members, ts6.isTypeElement)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createTypeAliasDeclaration = ts6.buildOverload("createTypeAliasDeclaration").overload({ + 0: function(modifiers, name, typeParameters, type) { + return createTypeAliasDeclaration(modifiers, name, typeParameters, type); + }, + 1: function(_decorators, modifiers, name, typeParameters, type) { + return createTypeAliasDeclaration(modifiers, name, typeParameters, type); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], name = _a[1], typeParameters = _a[2], type = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (type === void 0 || !ts6.isArray(type)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], name = _a[2], typeParameters = _a[3], type = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (type === void 0 || ts6.isTypeNode(type)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateTypeAliasDeclaration = ts6.buildOverload("updateTypeAliasDeclaration").overload({ + 0: function(node, modifiers, name, typeParameters, type) { + return updateTypeAliasDeclaration(node, modifiers, name, typeParameters, type); + }, + 1: function(node, _decorators, modifiers, name, typeParameters, type) { + return updateTypeAliasDeclaration(node, modifiers, name, typeParameters, type); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], name = _a[2], typeParameters = _a[3], type = _a[4], other = _a[5]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (type === void 0 || !ts6.isArray(type)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], name = _a[3], typeParameters = _a[4], type = _a[5]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (typeParameters === void 0 || ts6.isArray(typeParameters)) && (type === void 0 || ts6.isTypeNode(type)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createEnumDeclaration = ts6.buildOverload("createEnumDeclaration").overload({ + 0: function(modifiers, name, members) { + return createEnumDeclaration(modifiers, name, members); + }, + 1: function(_decorators, modifiers, name, members) { + return createEnumDeclaration(modifiers, name, members); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], name = _a[1], members = _a[2], other = _a[3]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (members === void 0 || ts6.isArray(members)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], name = _a[2], members = _a[3]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (members === void 0 || ts6.isArray(members)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateEnumDeclaration = ts6.buildOverload("updateEnumDeclaration").overload({ + 0: function(node, modifiers, name, members) { + return updateEnumDeclaration(node, modifiers, name, members); + }, + 1: function(node, _decorators, modifiers, name, members) { + return updateEnumDeclaration(node, modifiers, name, members); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], name = _a[2], members = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (members === void 0 || ts6.isArray(members)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], name = _a[3], members = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name === void 0 || !ts6.isArray(name)) && (members === void 0 || ts6.isArray(members)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createModuleDeclaration = ts6.buildOverload("createModuleDeclaration").overload({ + 0: function(modifiers, name, body, flags) { + return createModuleDeclaration(modifiers, name, body, flags); + }, + 1: function(_decorators, modifiers, name, body, flags) { + return createModuleDeclaration(modifiers, name, body, flags); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], name = _a[1], body = _a[2], flags = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name !== void 0 && !ts6.isArray(name)) && (body === void 0 || ts6.isModuleBody(body)) && (flags === void 0 || typeof flags === "number"); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], name = _a[2], body = _a[3], flags = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name !== void 0 && ts6.isModuleName(name)) && (body === void 0 || typeof body === "object") && (flags === void 0 || typeof flags === "number"); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateModuleDeclaration = ts6.buildOverload("updateModuleDeclaration").overload({ + 0: function(node, modifiers, name, body) { + return updateModuleDeclaration(node, modifiers, name, body); + }, + 1: function(node, _decorators, modifiers, name, body) { + return updateModuleDeclaration(node, modifiers, name, body); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], name = _a[2], body = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (name === void 0 || !ts6.isArray(name)) && (body === void 0 || ts6.isModuleBody(body)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], name = _a[3], body = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (name !== void 0 && ts6.isModuleName(name)) && (body === void 0 || ts6.isModuleBody(body)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createImportEqualsDeclaration = ts6.buildOverload("createImportEqualsDeclaration").overload({ + 0: function(modifiers, isTypeOnly, name, moduleReference) { + return createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference); + }, + 1: function(_decorators, modifiers, isTypeOnly, name, moduleReference) { + return createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], isTypeOnly = _a[1], name = _a[2], moduleReference = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (isTypeOnly === void 0 || typeof isTypeOnly === "boolean") && typeof name !== "boolean" && typeof moduleReference !== "string"; + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], isTypeOnly = _a[2], name = _a[3], moduleReference = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (isTypeOnly === void 0 || typeof isTypeOnly === "boolean") && (typeof name === "string" || ts6.isIdentifier(name)) && (moduleReference !== void 0 && ts6.isModuleReference(moduleReference)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateImportEqualsDeclaration = ts6.buildOverload("updateImportEqualsDeclaration").overload({ + 0: function(node, modifiers, isTypeOnly, name, moduleReference) { + return updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference); + }, + 1: function(node, _decorators, modifiers, isTypeOnly, name, moduleReference) { + return updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], isTypeOnly = _a[2], name = _a[3], moduleReference = _a[4], other = _a[5]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (isTypeOnly === void 0 || typeof isTypeOnly === "boolean") && typeof name !== "boolean" && typeof moduleReference !== "string"; + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], isTypeOnly = _a[3], name = _a[4], moduleReference = _a[5]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (isTypeOnly === void 0 || typeof isTypeOnly === "boolean") && (typeof name === "string" || ts6.isIdentifier(name)) && (moduleReference !== void 0 && ts6.isModuleReference(moduleReference)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createImportDeclaration = ts6.buildOverload("createImportDeclaration").overload({ + 0: function(modifiers, importClause, moduleSpecifier, assertClause) { + return createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); + }, + 1: function(_decorators, modifiers, importClause, moduleSpecifier, assertClause) { + return createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], importClause = _a[1], moduleSpecifier = _a[2], assertClause = _a[3], other = _a[4]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (importClause === void 0 || !ts6.isArray(importClause)) && (moduleSpecifier !== void 0 && ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], importClause = _a[2], moduleSpecifier = _a[3], assertClause = _a[4]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (importClause === void 0 || ts6.isImportClause(importClause)) && (moduleSpecifier !== void 0 && ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateImportDeclaration = ts6.buildOverload("updateImportDeclaration").overload({ + 0: function(node, modifiers, importClause, moduleSpecifier, assertClause) { + return updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, assertClause); + }, + 1: function(node, _decorators, modifiers, importClause, moduleSpecifier, assertClause) { + return updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, assertClause); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], importClause = _a[2], moduleSpecifier = _a[3], assertClause = _a[4], other = _a[5]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (importClause === void 0 || !ts6.isArray(importClause)) && (moduleSpecifier === void 0 || ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], importClause = _a[3], moduleSpecifier = _a[4], assertClause = _a[5]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (importClause === void 0 || ts6.isImportClause(importClause)) && (moduleSpecifier !== void 0 && ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createExportAssignment = ts6.buildOverload("createExportAssignment").overload({ + 0: function(modifiers, isExportEquals, expression) { + return createExportAssignment(modifiers, isExportEquals, expression); + }, + 1: function(_decorators, modifiers, isExportEquals, expression) { + return createExportAssignment(modifiers, isExportEquals, expression); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], isExportEquals = _a[1], expression = _a[2], other = _a[3]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (isExportEquals === void 0 || typeof isExportEquals === "boolean") && typeof expression === "object"; + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], isExportEquals = _a[2], expression = _a[3]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (isExportEquals === void 0 || typeof isExportEquals === "boolean") && (expression !== void 0 && ts6.isExpression(expression)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateExportAssignment = ts6.buildOverload("updateExportAssignment").overload({ + 0: function(node, modifiers, expression) { + return updateExportAssignment(node, modifiers, expression); + }, + 1: function(node, _decorators, modifiers, expression) { + return updateExportAssignment(node, modifiers, expression); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], expression = _a[2], other = _a[3]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && (expression !== void 0 && !ts6.isArray(expression)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], expression = _a[3]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && (expression !== void 0 && ts6.isExpression(expression)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.createExportDeclaration = ts6.buildOverload("createExportDeclaration").overload({ + 0: function(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { + return createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); + }, + 1: function(_decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { + return createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[0], isTypeOnly = _a[1], exportClause = _a[2], moduleSpecifier = _a[3], assertClause = _a[4], other = _a[5]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && typeof isTypeOnly === "boolean" && typeof exportClause !== "boolean" && (moduleSpecifier === void 0 || ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + }, + 1: function(_a) { + var decorators = _a[0], modifiers = _a[1], isTypeOnly = _a[2], exportClause = _a[3], moduleSpecifier = _a[4], assertClause = _a[5]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && typeof isTypeOnly === "boolean" && (exportClause === void 0 || ts6.isNamedExportBindings(exportClause)) && (moduleSpecifier === void 0 || ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + factory.updateExportDeclaration = ts6.buildOverload("updateExportDeclaration").overload({ + 0: function(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { + return updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); + }, + 1: function(node, _decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { + return updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); + } + }).bind({ + 0: function(_a) { + var modifiers = _a[1], isTypeOnly = _a[2], exportClause = _a[3], moduleSpecifier = _a[4], assertClause = _a[5], other = _a[6]; + return other === void 0 && (modifiers === void 0 || ts6.every(modifiers, ts6.isModifier)) && typeof isTypeOnly === "boolean" && typeof exportClause !== "boolean" && (moduleSpecifier === void 0 || ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + }, + 1: function(_a) { + var decorators = _a[1], modifiers = _a[2], isTypeOnly = _a[3], exportClause = _a[4], moduleSpecifier = _a[5], assertClause = _a[6]; + return (decorators === void 0 || ts6.every(decorators, ts6.isDecorator)) && (modifiers === void 0 || ts6.isArray(modifiers)) && typeof isTypeOnly === "boolean" && (exportClause === void 0 || ts6.isNamedExportBindings(exportClause)) && (moduleSpecifier === void 0 || ts6.isExpression(moduleSpecifier)) && (assertClause === void 0 || ts6.isAssertClause(assertClause)); + } + }).deprecate({ + 1: DISALLOW_DECORATORS + }).finish(); + } + var prevCreateNodeFactory = ts6.createNodeFactory; + ts6.createNodeFactory = function(flags, baseFactory) { + var factory = prevCreateNodeFactory(flags, baseFactory); + patchNodeFactory(factory); + return factory; + }; + patchNodeFactory(ts6.factory); + })(ts5 || (ts5 = {})); + var ts5; + (function(ts6) { + if (typeof console !== "undefined") { + ts6.Debug.loggingHost = { + log: function(level, s) { + switch (level) { + case ts6.LogLevel.Error: + return console.error(s); + case ts6.LogLevel.Warning: + return console.warn(s); + case ts6.LogLevel.Info: + return console.log(s); + case ts6.LogLevel.Verbose: + return console.log(s); + } + } + }; + } + })(ts5 || (ts5 = {})); + } + }); + + // interop/built/devicescript-interop.mjs + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __commonJS2 = (cb, mod) => function __require2() { + return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var require_dist = __commonJS2({ + "node_modules/json5/dist/index.js"(exports, module) { + (function(global2, factory) { + typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.JSON5 = factory(); + })(exports, function() { + "use strict"; + function createCommonjsModule(fn, module2) { + return module2 = { exports: {} }, fn(module2, module2.exports), module2.exports; + } + var _global = createCommonjsModule(function(module2) { + var global2 = module2.exports = typeof window != "undefined" && window.Math == Math ? window : typeof self != "undefined" && self.Math == Math ? self : Function("return this")(); + if (typeof __g == "number") { + __g = global2; + } + }); + var _core = createCommonjsModule(function(module2) { + var core = module2.exports = { version: "2.6.5" }; + if (typeof __e == "number") { + __e = core; + } + }); + var _core_1 = _core.version; + var _isObject = function(it) { + return typeof it === "object" ? it !== null : typeof it === "function"; + }; + var _anObject = function(it) { + if (!_isObject(it)) { + throw TypeError(it + " is not an object!"); + } + return it; + }; + var _fails = function(exec) { + try { + return !!exec(); + } catch (e) { + return true; + } + }; + var _descriptors = !_fails(function() { + return Object.defineProperty({}, "a", { get: function() { + return 7; + } }).a != 7; + }); + var document2 = _global.document; + var is = _isObject(document2) && _isObject(document2.createElement); + var _domCreate = function(it) { + return is ? document2.createElement(it) : {}; + }; + var _ie8DomDefine = !_descriptors && !_fails(function() { + return Object.defineProperty(_domCreate("div"), "a", { get: function() { + return 7; + } }).a != 7; + }); + var _toPrimitive = function(it, S) { + if (!_isObject(it)) { + return it; + } + var fn, val; + if (S && typeof (fn = it.toString) == "function" && !_isObject(val = fn.call(it))) { + return val; + } + if (typeof (fn = it.valueOf) == "function" && !_isObject(val = fn.call(it))) { + return val; + } + if (!S && typeof (fn = it.toString) == "function" && !_isObject(val = fn.call(it))) { + return val; + } + throw TypeError("Can't convert object to primitive value"); + }; + var dP = Object.defineProperty; + var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { + _anObject(O); + P = _toPrimitive(P, true); + _anObject(Attributes); + if (_ie8DomDefine) { + try { + return dP(O, P, Attributes); + } catch (e) { + } + } + if ("get" in Attributes || "set" in Attributes) { + throw TypeError("Accessors not supported!"); + } + if ("value" in Attributes) { + O[P] = Attributes.value; + } + return O; + }; + var _objectDp = { + f + }; + var _propertyDesc = function(bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value + }; + }; + var _hide = _descriptors ? function(object, key2, value) { + return _objectDp.f(object, key2, _propertyDesc(1, value)); + } : function(object, key2, value) { + object[key2] = value; + return object; + }; + var hasOwnProperty = {}.hasOwnProperty; + var _has = function(it, key2) { + return hasOwnProperty.call(it, key2); + }; + var id = 0; + var px = Math.random(); + var _uid = function(key2) { + return "Symbol(".concat(key2 === void 0 ? "" : key2, ")_", (++id + px).toString(36)); + }; + var _library = false; + var _shared = createCommonjsModule(function(module2) { + var SHARED = "__core-js_shared__"; + var store = _global[SHARED] || (_global[SHARED] = {}); + (module2.exports = function(key2, value) { + return store[key2] || (store[key2] = value !== void 0 ? value : {}); + })("versions", []).push({ + version: _core.version, + mode: _library ? "pure" : "global", + copyright: "\xA9 2019 Denis Pushkarev (zloirock.ru)" + }); + }); + var _functionToString = _shared("native-function-to-string", Function.toString); + var _redefine = createCommonjsModule(function(module2) { + var SRC = _uid("src"); + var TO_STRING = "toString"; + var TPL = ("" + _functionToString).split(TO_STRING); + _core.inspectSource = function(it) { + return _functionToString.call(it); + }; + (module2.exports = function(O, key2, val, safe) { + var isFunction = typeof val == "function"; + if (isFunction) { + _has(val, "name") || _hide(val, "name", key2); + } + if (O[key2] === val) { + return; + } + if (isFunction) { + _has(val, SRC) || _hide(val, SRC, O[key2] ? "" + O[key2] : TPL.join(String(key2))); + } + if (O === _global) { + O[key2] = val; + } else if (!safe) { + delete O[key2]; + _hide(O, key2, val); + } else if (O[key2]) { + O[key2] = val; + } else { + _hide(O, key2, val); + } + })(Function.prototype, TO_STRING, function toString() { + return typeof this == "function" && this[SRC] || _functionToString.call(this); + }); + }); + var _aFunction = function(it) { + if (typeof it != "function") { + throw TypeError(it + " is not a function!"); + } + return it; + }; + var _ctx = function(fn, that, length) { + _aFunction(fn); + if (that === void 0) { + return fn; + } + switch (length) { + case 1: + return function(a) { + return fn.call(that, a); + }; + case 2: + return function(a, b) { + return fn.call(that, a, b); + }; + case 3: + return function(a, b, c2) { + return fn.call(that, a, b, c2); + }; + } + return function() { + return fn.apply(that, arguments); + }; + }; + var PROTOTYPE = "prototype"; + var $export = function(type, name, source2) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; + var exports2 = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); + var expProto = exports2[PROTOTYPE] || (exports2[PROTOTYPE] = {}); + var key2, own, out, exp; + if (IS_GLOBAL) { + source2 = name; + } + for (key2 in source2) { + own = !IS_FORCED && target && target[key2] !== void 0; + out = (own ? target : source2)[key2]; + exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == "function" ? _ctx(Function.call, out) : out; + if (target) { + _redefine(target, key2, out, type & $export.U); + } + if (exports2[key2] != out) { + _hide(exports2, key2, exp); + } + if (IS_PROTO && expProto[key2] != out) { + expProto[key2] = out; + } + } + }; + _global.core = _core; + $export.F = 1; + $export.G = 2; + $export.S = 4; + $export.P = 8; + $export.B = 16; + $export.W = 32; + $export.U = 64; + $export.R = 128; + var _export = $export; + var ceil = Math.ceil; + var floor = Math.floor; + var _toInteger = function(it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + }; + var _defined = function(it) { + if (it == void 0) { + throw TypeError("Can't call method on " + it); + } + return it; + }; + var _stringAt = function(TO_STRING) { + return function(that, pos2) { + var s = String(_defined(that)); + var i = _toInteger(pos2); + var l = s.length; + var a, b; + if (i < 0 || i >= l) { + return TO_STRING ? "" : void 0; + } + a = s.charCodeAt(i); + return a < 55296 || a > 56319 || i + 1 === l || (b = s.charCodeAt(i + 1)) < 56320 || b > 57343 ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 55296 << 10) + (b - 56320) + 65536; + }; + }; + var $at = _stringAt(false); + _export(_export.P, "String", { + // 21.1.3.3 String.prototype.codePointAt(pos) + codePointAt: function codePointAt2(pos2) { + return $at(this, pos2); + } + }); + var codePointAt = _core.String.codePointAt; + var max = Math.max; + var min = Math.min; + var _toAbsoluteIndex = function(index, length) { + index = _toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }; + var fromCharCode = String.fromCharCode; + var $fromCodePoint = String.fromCodePoint; + _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), "String", { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint2(x) { + var arguments$1 = arguments; + var res = []; + var aLen = arguments.length; + var i = 0; + var code; + while (aLen > i) { + code = +arguments$1[i++]; + if (_toAbsoluteIndex(code, 1114111) !== code) { + throw RangeError(code + " is not a valid code point"); + } + res.push( + code < 65536 ? fromCharCode(code) : fromCharCode(((code -= 65536) >> 10) + 55296, code % 1024 + 56320) + ); + } + return res.join(""); + } + }); + var fromCodePoint = _core.String.fromCodePoint; + var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/; + var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/; + var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/; + var unicode = { + Space_Separator, + ID_Start, + ID_Continue + }; + var util = { + isSpaceSeparator: function isSpaceSeparator(c2) { + return typeof c2 === "string" && unicode.Space_Separator.test(c2); + }, + isIdStartChar: function isIdStartChar(c2) { + return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 === "$" || c2 === "_" || unicode.ID_Start.test(c2)); + }, + isIdContinueChar: function isIdContinueChar(c2) { + return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 >= "0" && c2 <= "9" || c2 === "$" || c2 === "_" || c2 === "\u200C" || c2 === "\u200D" || unicode.ID_Continue.test(c2)); + }, + isDigit: function isDigit(c2) { + return typeof c2 === "string" && /[0-9]/.test(c2); + }, + isHexDigit: function isHexDigit(c2) { + return typeof c2 === "string" && /[0-9A-Fa-f]/.test(c2); + } + }; + var source; + var parseState; + var stack2; + var pos; + var line; + var column; + var token; + var key; + var root; + var parse2 = function parse3(text, reviver) { + source = String(text); + parseState = "start"; + stack2 = []; + pos = 0; + line = 1; + column = 0; + token = void 0; + key = void 0; + root = void 0; + do { + token = lex(); + parseStates[parseState](); + } while (token.type !== "eof"); + if (typeof reviver === "function") { + return internalize({ "": root }, "", reviver); + } + return root; + }; + function internalize(holder, name, reviver) { + var value = holder[name]; + if (value != null && typeof value === "object") { + if (Array.isArray(value)) { + for (var i = 0; i < value.length; i++) { + var key2 = String(i); + var replacement = internalize(value, key2, reviver); + if (replacement === void 0) { + delete value[key2]; + } else { + Object.defineProperty(value, key2, { + value: replacement, + writable: true, + enumerable: true, + configurable: true + }); + } + } + } else { + for (var key$1 in value) { + var replacement$1 = internalize(value, key$1, reviver); + if (replacement$1 === void 0) { + delete value[key$1]; + } else { + Object.defineProperty(value, key$1, { + value: replacement$1, + writable: true, + enumerable: true, + configurable: true + }); + } + } + } + } + return reviver.call(holder, name, value); + } + var lexState; + var buffer; + var doubleQuote; + var sign; + var c; + function lex() { + lexState = "default"; + buffer = ""; + doubleQuote = false; + sign = 1; + for (; ; ) { + c = peek(); + var token2 = lexStates[lexState](); + if (token2) { + return token2; + } + } + } + function peek() { + if (source[pos]) { + return String.fromCodePoint(source.codePointAt(pos)); + } + } + function read() { + var c2 = peek(); + if (c2 === "\n") { + line++; + column = 0; + } else if (c2) { + column += c2.length; + } else { + column++; + } + if (c2) { + pos += c2.length; + } + return c2; + } + var lexStates = { + default: function default$1() { + switch (c) { + case " ": + case "\v": + case "\f": + case " ": + case "\xA0": + case "\uFEFF": + case "\n": + case "\r": + case "\u2028": + case "\u2029": + read(); + return; + case "/": + read(); + lexState = "comment"; + return; + case void 0: + read(); + return newToken("eof"); + } + if (util.isSpaceSeparator(c)) { + read(); + return; + } + return lexStates[parseState](); + }, + comment: function comment() { + switch (c) { + case "*": + read(); + lexState = "multiLineComment"; + return; + case "/": + read(); + lexState = "singleLineComment"; + return; + } + throw invalidChar(read()); + }, + multiLineComment: function multiLineComment() { + switch (c) { + case "*": + read(); + lexState = "multiLineCommentAsterisk"; + return; + case void 0: + throw invalidChar(read()); + } + read(); + }, + multiLineCommentAsterisk: function multiLineCommentAsterisk() { + switch (c) { + case "*": + read(); + return; + case "/": + read(); + lexState = "default"; + return; + case void 0: + throw invalidChar(read()); + } + read(); + lexState = "multiLineComment"; + }, + singleLineComment: function singleLineComment() { + switch (c) { + case "\n": + case "\r": + case "\u2028": + case "\u2029": + read(); + lexState = "default"; + return; + case void 0: + read(); + return newToken("eof"); + } + read(); + }, + value: function value() { + switch (c) { + case "{": + case "[": + return newToken("punctuator", read()); + case "n": + read(); + literal2("ull"); + return newToken("null", null); + case "t": + read(); + literal2("rue"); + return newToken("boolean", true); + case "f": + read(); + literal2("alse"); + return newToken("boolean", false); + case "-": + case "+": + if (read() === "-") { + sign = -1; + } + lexState = "sign"; + return; + case ".": + buffer = read(); + lexState = "decimalPointLeading"; + return; + case "0": + buffer = read(); + lexState = "zero"; + return; + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + buffer = read(); + lexState = "decimalInteger"; + return; + case "I": + read(); + literal2("nfinity"); + return newToken("numeric", Infinity); + case "N": + read(); + literal2("aN"); + return newToken("numeric", NaN); + case '"': + case "'": + doubleQuote = read() === '"'; + buffer = ""; + lexState = "string"; + return; + } + throw invalidChar(read()); + }, + identifierNameStartEscape: function identifierNameStartEscape() { + if (c !== "u") { + throw invalidChar(read()); + } + read(); + var u = unicodeEscape(); + switch (u) { + case "$": + case "_": + break; + default: + if (!util.isIdStartChar(u)) { + throw invalidIdentifier(); + } + break; + } + buffer += u; + lexState = "identifierName"; + }, + identifierName: function identifierName() { + switch (c) { + case "$": + case "_": + case "\u200C": + case "\u200D": + buffer += read(); + return; + case "\\": + read(); + lexState = "identifierNameEscape"; + return; + } + if (util.isIdContinueChar(c)) { + buffer += read(); + return; + } + return newToken("identifier", buffer); + }, + identifierNameEscape: function identifierNameEscape() { + if (c !== "u") { + throw invalidChar(read()); + } + read(); + var u = unicodeEscape(); + switch (u) { + case "$": + case "_": + case "\u200C": + case "\u200D": + break; + default: + if (!util.isIdContinueChar(u)) { + throw invalidIdentifier(); + } + break; + } + buffer += u; + lexState = "identifierName"; + }, + sign: function sign$1() { + switch (c) { + case ".": + buffer = read(); + lexState = "decimalPointLeading"; + return; + case "0": + buffer = read(); + lexState = "zero"; + return; + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + buffer = read(); + lexState = "decimalInteger"; + return; + case "I": + read(); + literal2("nfinity"); + return newToken("numeric", sign * Infinity); + case "N": + read(); + literal2("aN"); + return newToken("numeric", NaN); + } + throw invalidChar(read()); + }, + zero: function zero() { + switch (c) { + case ".": + buffer += read(); + lexState = "decimalPoint"; + return; + case "e": + case "E": + buffer += read(); + lexState = "decimalExponent"; + return; + case "x": + case "X": + buffer += read(); + lexState = "hexadecimal"; + return; + } + return newToken("numeric", sign * 0); + }, + decimalInteger: function decimalInteger() { + switch (c) { + case ".": + buffer += read(); + lexState = "decimalPoint"; + return; + case "e": + case "E": + buffer += read(); + lexState = "decimalExponent"; + return; + } + if (util.isDigit(c)) { + buffer += read(); + return; + } + return newToken("numeric", sign * Number(buffer)); + }, + decimalPointLeading: function decimalPointLeading() { + if (util.isDigit(c)) { + buffer += read(); + lexState = "decimalFraction"; + return; + } + throw invalidChar(read()); + }, + decimalPoint: function decimalPoint() { + switch (c) { + case "e": + case "E": + buffer += read(); + lexState = "decimalExponent"; + return; + } + if (util.isDigit(c)) { + buffer += read(); + lexState = "decimalFraction"; + return; + } + return newToken("numeric", sign * Number(buffer)); + }, + decimalFraction: function decimalFraction() { + switch (c) { + case "e": + case "E": + buffer += read(); + lexState = "decimalExponent"; + return; + } + if (util.isDigit(c)) { + buffer += read(); + return; + } + return newToken("numeric", sign * Number(buffer)); + }, + decimalExponent: function decimalExponent() { + switch (c) { + case "+": + case "-": + buffer += read(); + lexState = "decimalExponentSign"; + return; + } + if (util.isDigit(c)) { + buffer += read(); + lexState = "decimalExponentInteger"; + return; + } + throw invalidChar(read()); + }, + decimalExponentSign: function decimalExponentSign() { + if (util.isDigit(c)) { + buffer += read(); + lexState = "decimalExponentInteger"; + return; + } + throw invalidChar(read()); + }, + decimalExponentInteger: function decimalExponentInteger() { + if (util.isDigit(c)) { + buffer += read(); + return; + } + return newToken("numeric", sign * Number(buffer)); + }, + hexadecimal: function hexadecimal() { + if (util.isHexDigit(c)) { + buffer += read(); + lexState = "hexadecimalInteger"; + return; + } + throw invalidChar(read()); + }, + hexadecimalInteger: function hexadecimalInteger() { + if (util.isHexDigit(c)) { + buffer += read(); + return; + } + return newToken("numeric", sign * Number(buffer)); + }, + string: function string() { + switch (c) { + case "\\": + read(); + buffer += escape(); + return; + case '"': + if (doubleQuote) { + read(); + return newToken("string", buffer); + } + buffer += read(); + return; + case "'": + if (!doubleQuote) { + read(); + return newToken("string", buffer); + } + buffer += read(); + return; + case "\n": + case "\r": + throw invalidChar(read()); + case "\u2028": + case "\u2029": + separatorChar(c); + break; + case void 0: + throw invalidChar(read()); + } + buffer += read(); + }, + start: function start() { + switch (c) { + case "{": + case "[": + return newToken("punctuator", read()); + } + lexState = "value"; + }, + beforePropertyName: function beforePropertyName() { + switch (c) { + case "$": + case "_": + buffer = read(); + lexState = "identifierName"; + return; + case "\\": + read(); + lexState = "identifierNameStartEscape"; + return; + case "}": + return newToken("punctuator", read()); + case '"': + case "'": + doubleQuote = read() === '"'; + lexState = "string"; + return; + } + if (util.isIdStartChar(c)) { + buffer += read(); + lexState = "identifierName"; + return; + } + throw invalidChar(read()); + }, + afterPropertyName: function afterPropertyName() { + if (c === ":") { + return newToken("punctuator", read()); + } + throw invalidChar(read()); + }, + beforePropertyValue: function beforePropertyValue() { + lexState = "value"; + }, + afterPropertyValue: function afterPropertyValue() { + switch (c) { + case ",": + case "}": + return newToken("punctuator", read()); + } + throw invalidChar(read()); + }, + beforeArrayValue: function beforeArrayValue() { + if (c === "]") { + return newToken("punctuator", read()); + } + lexState = "value"; + }, + afterArrayValue: function afterArrayValue() { + switch (c) { + case ",": + case "]": + return newToken("punctuator", read()); + } + throw invalidChar(read()); + }, + end: function end() { + throw invalidChar(read()); + } + }; + function newToken(type, value) { + return { + type, + value, + line, + column + }; + } + function literal2(s) { + for (var i = 0, list = s; i < list.length; i += 1) { + var c2 = list[i]; + var p = peek(); + if (p !== c2) { + throw invalidChar(read()); + } + read(); + } + } + function escape() { + var c2 = peek(); + switch (c2) { + case "b": + read(); + return "\b"; + case "f": + read(); + return "\f"; + case "n": + read(); + return "\n"; + case "r": + read(); + return "\r"; + case "t": + read(); + return " "; + case "v": + read(); + return "\v"; + case "0": + read(); + if (util.isDigit(peek())) { + throw invalidChar(read()); + } + return "\0"; + case "x": + read(); + return hexEscape(); + case "u": + read(); + return unicodeEscape(); + case "\n": + case "\u2028": + case "\u2029": + read(); + return ""; + case "\r": + read(); + if (peek() === "\n") { + read(); + } + return ""; + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + throw invalidChar(read()); + case void 0: + throw invalidChar(read()); + } + return read(); + } + function hexEscape() { + var buffer2 = ""; + var c2 = peek(); + if (!util.isHexDigit(c2)) { + throw invalidChar(read()); + } + buffer2 += read(); + c2 = peek(); + if (!util.isHexDigit(c2)) { + throw invalidChar(read()); + } + buffer2 += read(); + return String.fromCodePoint(parseInt(buffer2, 16)); + } + function unicodeEscape() { + var buffer2 = ""; + var count = 4; + while (count-- > 0) { + var c2 = peek(); + if (!util.isHexDigit(c2)) { + throw invalidChar(read()); + } + buffer2 += read(); + } + return String.fromCodePoint(parseInt(buffer2, 16)); + } + var parseStates = { + start: function start() { + if (token.type === "eof") { + throw invalidEOF(); + } + push(); + }, + beforePropertyName: function beforePropertyName() { + switch (token.type) { + case "identifier": + case "string": + key = token.value; + parseState = "afterPropertyName"; + return; + case "punctuator": + pop(); + return; + case "eof": + throw invalidEOF(); + } + }, + afterPropertyName: function afterPropertyName() { + if (token.type === "eof") { + throw invalidEOF(); + } + parseState = "beforePropertyValue"; + }, + beforePropertyValue: function beforePropertyValue() { + if (token.type === "eof") { + throw invalidEOF(); + } + push(); + }, + beforeArrayValue: function beforeArrayValue() { + if (token.type === "eof") { + throw invalidEOF(); + } + if (token.type === "punctuator" && token.value === "]") { + pop(); + return; + } + push(); + }, + afterPropertyValue: function afterPropertyValue() { + if (token.type === "eof") { + throw invalidEOF(); + } + switch (token.value) { + case ",": + parseState = "beforePropertyName"; + return; + case "}": + pop(); + } + }, + afterArrayValue: function afterArrayValue() { + if (token.type === "eof") { + throw invalidEOF(); + } + switch (token.value) { + case ",": + parseState = "beforeArrayValue"; + return; + case "]": + pop(); + } + }, + end: function end() { + } + }; + function push() { + var value; + switch (token.type) { + case "punctuator": + switch (token.value) { + case "{": + value = {}; + break; + case "[": + value = []; + break; + } + break; + case "null": + case "boolean": + case "numeric": + case "string": + value = token.value; + break; + } + if (root === void 0) { + root = value; + } else { + var parent = stack2[stack2.length - 1]; + if (Array.isArray(parent)) { + parent.push(value); + } else { + Object.defineProperty(parent, key, { + value, + writable: true, + enumerable: true, + configurable: true + }); + } + } + if (value !== null && typeof value === "object") { + stack2.push(value); + if (Array.isArray(value)) { + parseState = "beforeArrayValue"; + } else { + parseState = "beforePropertyName"; + } + } else { + var current = stack2[stack2.length - 1]; + if (current == null) { + parseState = "end"; + } else if (Array.isArray(current)) { + parseState = "afterArrayValue"; + } else { + parseState = "afterPropertyValue"; + } + } + } + function pop() { + stack2.pop(); + var current = stack2[stack2.length - 1]; + if (current == null) { + parseState = "end"; + } else if (Array.isArray(current)) { + parseState = "afterArrayValue"; + } else { + parseState = "afterPropertyValue"; + } + } + function invalidChar(c2) { + if (c2 === void 0) { + return syntaxError("JSON5: invalid end of input at " + line + ":" + column); + } + return syntaxError("JSON5: invalid character '" + formatChar(c2) + "' at " + line + ":" + column); + } + function invalidEOF() { + return syntaxError("JSON5: invalid end of input at " + line + ":" + column); + } + function invalidIdentifier() { + column -= 5; + return syntaxError("JSON5: invalid identifier character at " + line + ":" + column); + } + function separatorChar(c2) { + console.warn("JSON5: '" + formatChar(c2) + "' in strings is not valid ECMAScript; consider escaping"); + } + function formatChar(c2) { + var replacements = { + "'": "\\'", + '"': '\\"', + "\\": "\\\\", + "\b": "\\b", + "\f": "\\f", + "\n": "\\n", + "\r": "\\r", + " ": "\\t", + "\v": "\\v", + "\0": "\\0", + "\u2028": "\\u2028", + "\u2029": "\\u2029" + }; + if (replacements[c2]) { + return replacements[c2]; + } + if (c2 < " ") { + var hexString = c2.charCodeAt(0).toString(16); + return "\\x" + ("00" + hexString).substring(hexString.length); + } + return c2; + } + function syntaxError(message) { + var err = new SyntaxError(message); + err.lineNumber = line; + err.columnNumber = column; + return err; + } + var stringify = function stringify2(value, replacer, space) { + var stack22 = []; + var indent = ""; + var propertyList; + var replacerFunc; + var gap = ""; + var quote; + if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) { + space = replacer.space; + quote = replacer.quote; + replacer = replacer.replacer; + } + if (typeof replacer === "function") { + replacerFunc = replacer; + } else if (Array.isArray(replacer)) { + propertyList = []; + for (var i = 0, list = replacer; i < list.length; i += 1) { + var v = list[i]; + var item = void 0; + if (typeof v === "string") { + item = v; + } else if (typeof v === "number" || v instanceof String || v instanceof Number) { + item = String(v); + } + if (item !== void 0 && propertyList.indexOf(item) < 0) { + propertyList.push(item); + } + } + } + if (space instanceof Number) { + space = Number(space); + } else if (space instanceof String) { + space = String(space); + } + if (typeof space === "number") { + if (space > 0) { + space = Math.min(10, Math.floor(space)); + gap = " ".substr(0, space); + } + } else if (typeof space === "string") { + gap = space.substr(0, 10); + } + return serializeProperty("", { "": value }); + function serializeProperty(key2, holder) { + var value2 = holder[key2]; + if (value2 != null) { + if (typeof value2.toJSON5 === "function") { + value2 = value2.toJSON5(key2); + } else if (typeof value2.toJSON === "function") { + value2 = value2.toJSON(key2); + } + } + if (replacerFunc) { + value2 = replacerFunc.call(holder, key2, value2); + } + if (value2 instanceof Number) { + value2 = Number(value2); + } else if (value2 instanceof String) { + value2 = String(value2); + } else if (value2 instanceof Boolean) { + value2 = value2.valueOf(); + } + switch (value2) { + case null: + return "null"; + case true: + return "true"; + case false: + return "false"; + } + if (typeof value2 === "string") { + return quoteString(value2, false); + } + if (typeof value2 === "number") { + return String(value2); + } + if (typeof value2 === "object") { + return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2); + } + return void 0; + } + function quoteString(value2) { + var quotes = { + "'": 0.1, + '"': 0.2 + }; + var replacements = { + "'": "\\'", + '"': '\\"', + "\\": "\\\\", + "\b": "\\b", + "\f": "\\f", + "\n": "\\n", + "\r": "\\r", + " ": "\\t", + "\v": "\\v", + "\0": "\\0", + "\u2028": "\\u2028", + "\u2029": "\\u2029" + }; + var product = ""; + for (var i2 = 0; i2 < value2.length; i2++) { + var c2 = value2[i2]; + switch (c2) { + case "'": + case '"': + quotes[c2]++; + product += c2; + continue; + case "\0": + if (util.isDigit(value2[i2 + 1])) { + product += "\\x00"; + continue; + } + } + if (replacements[c2]) { + product += replacements[c2]; + continue; + } + if (c2 < " ") { + var hexString = c2.charCodeAt(0).toString(16); + product += "\\x" + ("00" + hexString).substring(hexString.length); + continue; + } + product += c2; + } + var quoteChar = quote || Object.keys(quotes).reduce(function(a, b) { + return quotes[a] < quotes[b] ? a : b; + }); + product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]); + return quoteChar + product + quoteChar; + } + function serializeObject(value2) { + if (stack22.indexOf(value2) >= 0) { + throw TypeError("Converting circular structure to JSON5"); + } + stack22.push(value2); + var stepback = indent; + indent = indent + gap; + var keys = propertyList || Object.keys(value2); + var partial = []; + for (var i2 = 0, list2 = keys; i2 < list2.length; i2 += 1) { + var key2 = list2[i2]; + var propertyString = serializeProperty(key2, value2); + if (propertyString !== void 0) { + var member = serializeKey(key2) + ":"; + if (gap !== "") { + member += " "; + } + member += propertyString; + partial.push(member); + } + } + var final; + if (partial.length === 0) { + final = "{}"; + } else { + var properties; + if (gap === "") { + properties = partial.join(","); + final = "{" + properties + "}"; + } else { + var separator = ",\n" + indent; + properties = partial.join(separator); + final = "{\n" + indent + properties + ",\n" + stepback + "}"; + } + } + stack22.pop(); + indent = stepback; + return final; + } + function serializeKey(key2) { + if (key2.length === 0) { + return quoteString(key2, true); + } + var firstChar = String.fromCodePoint(key2.codePointAt(0)); + if (!util.isIdStartChar(firstChar)) { + return quoteString(key2, true); + } + for (var i2 = firstChar.length; i2 < key2.length; i2++) { + if (!util.isIdContinueChar(String.fromCodePoint(key2.codePointAt(i2)))) { + return quoteString(key2, true); + } + } + return key2; + } + function serializeArray(value2) { + if (stack22.indexOf(value2) >= 0) { + throw TypeError("Converting circular structure to JSON5"); + } + stack22.push(value2); + var stepback = indent; + indent = indent + gap; + var partial = []; + for (var i2 = 0; i2 < value2.length; i2++) { + var propertyString = serializeProperty(String(i2), value2); + partial.push(propertyString !== void 0 ? propertyString : "null"); + } + var final; + if (partial.length === 0) { + final = "[]"; + } else { + if (gap === "") { + var properties = partial.join(","); + final = "[" + properties + "]"; + } else { + var separator = ",\n" + indent; + var properties$1 = partial.join(separator); + final = "[\n" + indent + properties$1 + ",\n" + stepback + "]"; + } + } + stack22.pop(); + indent = stepback; + return final; + } + }; + var JSON5 = { + parse: parse2, + stringify + }; + var lib = JSON5; + var es5 = lib; + return es5; + }); + } + }); + function parseAnyInt(s) { + if (s === null || s === void 0) + return void 0; + if (typeof s == "number") + return s; + s = s.replace(/_/g, ""); + let m = 1; + if (s[0] == "-") { + s = s.slice(1); + m = -1; + } else if (s[0] == "+") + s = s.slice(1); + if (/^0o[0-7]+$/i.test(s)) + return m * parseInt(s.slice(2), 8); + if (/^0x[0-9a-f]+$/i.test(s)) + return m * parseInt(s.slice(2), 16); + if (/^[0-9]+$/i.test(s)) + return m * parseInt(s.slice(2), 16); + return void 0; + } + function normalizeDeviceConfig(board, options) { + const { ignoreFirmwareUrl, ignoreId } = options || {}; + const { + $schema, + id, + devName, + productId, + $description, + archId, + url, + $fwUrl, + ...rest + } = board; + const res = { + $schema, + id, + devName, + productId, + $description, + archId, + url, + $fwUrl, + ...rest + }; + if (ignoreId) + delete res.id; + if (ignoreFirmwareUrl) + delete res.$fwUrl; + return res; + } + function architectureFamily(archId) { + for (const a of ["esp32", "rp2040"]) + if (archId.startsWith(a)) + return a; + return archId; + } + var errors = { + "loopback rx ovf": "loopback-rx-ovf", + "can't connect, no HF2 nor JDUSB": "no-hf2", + "esptool cannot connect": "esptool-cannot-connect", + "I2C device not found or malfunctioning": "i2c-device-not-found-or-malfunctioning", + "Unable to locate Node.JS v16+.": "terminal-nodemissing", + "Install @devicescript/cli package": "terminal-notinstalled", + 'missing "devicescript" section': "missing-devicescript-section" + }; + var srcMapEntrySize = 3; + function emptyDebugInfo() { + return { + sizes: { + header: 0, + floats: 0, + strings: 0, + roles: 0, + align: 0 + }, + localConfig: { + hwInfo: {} + }, + functions: [], + globals: [], + specs: [], + srcmap: [], + sources: [], + binary: { hex: "" } + }; + } + function strcmp(a, b) { + if (a == b) + return 0; + if (a < b) + return -1; + else + return 1; + } + var errorsRx = new RegExp(Object.keys(errors).join("|"), "gi"); + function parseStackFrame(dbgInfo, line) { + const resolver = dbgInfo ? SrcMapResolver.from(dbgInfo) : void 0; + const frames = []; + function expand(pcStr, fnName, fnIdxStr) { + let pc = parseInt(pcStr); + if (pc) + pc--; + const fnidx = parseInt(fnIdxStr); + const fn = dbgInfo == null ? void 0 : dbgInfo.functions[fnidx]; + let pcInfo = `as F${fnIdxStr}_pc${pcStr}`; + if (!fn) { + if (fnName == "inline") + fnName = `inline_F${fnIdxStr}`; + return `at ${fnName} [${pcInfo}] ()`; + } + pc += fn.startpc; + if (fnName && fnName != fn.name) + pcInfo += "_mismatch_" + fn.name; + const srcpos = resolver.resolvePc(pc); + const posstr = resolver.posToString(srcpos[0]); + frames.push({ + srcpos, + fn + }); + return `at ${fnName} [${pcInfo}] \x1B[36m(${posstr})\x1B[0m`; + } + const markedLine = line.replace( + /\bpc=(\d+) \@ (\w*)_F(\d+)/g, + (_, pc, fnName, fnIdx) => expand(pc, fnName, fnIdx) + ).replace( + /at\s+(\w*)_F(\d+)\s+\(pc:(\d+)\)/g, + (_, fnName, fnIdx, pc) => expand(pc, fnName, fnIdx) + ).replace(errorsRx, (name) => { + const id = errors[name]; + return `${name} (https://microsoft.github.io/devicescript/developer/errors/#${id})`; + }); + return { markedLine, frames }; + } + function findSmaller(arr, v) { + let l = 0; + let r = arr.length - 1; + while (l <= r) { + const m = l + r >> 1; + if (arr[m] < v) + l = m + 1; + else + r = m - 1; + } + r--; + if (r < 0) + r = 0; + while (r < arr.length && v >= arr[r]) + r++; + return r - 1; + } + var SrcMapResolver = class { + constructor(dbg) { + this.dbg = dbg; + dbg.sources.forEach((s, idx) => { + s.index = idx; + }); + } + static from(dbg) { + if (!dbg._resolverCache) { + Object.defineProperty(dbg, "_resolverCache", { + value: new SrcMapResolver(dbg), + enumerable: false + }); + } + return dbg._resolverCache; + } + initPos() { + if (this.fileCache) + return; + this.fileCache = []; + let off = 0; + this.fileOff = new Uint32Array( + this.dbg.sources.map((src) => { + const lineoff = [0]; + const text = src.text; + for (let pos = 0; pos < text.length; ++pos) { + if (text.charCodeAt(pos) == 10) + lineoff.push(pos + 1); + } + this.fileCache.push(new Uint32Array(lineoff)); + const o = off; + off += src.length; + return o; + }) + ); + } + resolvePos(pos) { + this.initPos(); + const srcIdx = findSmaller(this.fileOff, pos); + const c = this.fileCache[srcIdx]; + if (c) { + pos -= this.fileOff[srcIdx]; + const lineIdx = findSmaller(c, pos); + if (0 <= lineIdx && lineIdx < c.length) + return { + fileOff: this.fileOff[srcIdx], + lineOff: c[lineIdx], + filepos: pos, + line: lineIdx + 1, + col: pos - c[lineIdx] + 1, + src: this.dbg.sources[srcIdx] + }; + } + return null; + } + locationToPos(srcIdx, line, column) { + this.initPos(); + const s = this.dbg.sources[srcIdx]; + return this.fileOff[srcIdx] + this.fileCache[srcIdx][line - 1] + column - 1; + } + posToString(pos) { + const t = this.resolvePos(pos); + if (t) + return `${t.src.path}:${t.line}:${t.col}`; + return `(pos=${pos})`; + } + initPc() { + if (this.pcOff) + return; + const srcmap = this.dbg.srcmap; + const pcs = []; + this.pcPos = []; + let prevPc = 0; + let prevPos = 0; + for (let i = 0; i < srcmap.length; i += srcMapEntrySize) { + let pos = srcmap[i]; + const len = srcmap[i + 1]; + let pc = srcmap[i + 2]; + if (pc < 0 || len < 0) + throw new Error("invalid srcmap entry"); + pc += prevPc; + pos += prevPos; + pcs.push(pc); + this.pcPos.push({ + pos, + end: pos + len, + pc + }); + prevPc = pc; + prevPos = pos; + } + this.pcOff = new Uint32Array(pcs); + } + filePos(srcIdx) { + this.initPos(); + const s = this.dbg.sources[srcIdx]; + return s ? [this.fileOff[srcIdx], s.length] : void 0; + } + srcMapForPos(loc) { + this.initPc(); + return filterOverlapping(this.pcPos, loc); + } + resolvePc(pc) { + this.initPc(); + let idx = findSmaller(this.pcOff, pc); + if (idx < 0) + idx = 0; + const e = this.pcPos[idx]; + return [e.pos, e.end - e.pos]; + } + }; + function srcLocOverlaps(a, b) { + if (a[0] <= b[0]) + return b[0] <= a[0] + a[1]; + else + return a[0] <= b[0] + b[1]; + } + function filterOverlapping(arr, loc) { + if (!loc) + return []; + return arr.filter((e) => srcLocOverlaps(loc, [e.pos, e.end - e.pos])); + } + function toTable(header, rows) { + var _a; + rows = rows.slice(); + rows.unshift(header); + const maxlen = []; + const isnum = []; + for (const row of rows) { + for (let i = 0; i < row.length; ++i) { + maxlen[i] = Math.min( + Math.max((_a = maxlen[i]) != null ? _a : 2, toStr(row[i]).length), + 30 + ); + isnum[i] || (isnum[i] = typeof row[i] == "number"); + } + } + let hd = true; + let res = ""; + for (const row of rows) { + for (let i = 0; i < maxlen.length; ++i) { + let w = toStr(row[i]); + const missing = maxlen[i] - w.length; + if (missing > 0) { + const pref = " ".repeat(missing); + if (isnum[i]) + w = pref + w; + else + w = w + pref; + } + res += w; + if (i != maxlen.length - 1) + res += " | "; + } + res += "\n"; + if (hd) { + hd = false; + for (let i = 0; i < maxlen.length; ++i) { + let w = isnum[i] ? "-".repeat(maxlen[i] - 1) + ":" : "-".repeat(maxlen[i]); + res += w; + if (i != maxlen.length - 1) + res += " | "; + } + res += "\n"; + } + } + return res.replace(/\s+\n/gm, "\n"); + function toStr(n) { + return (n != null ? n : "") + ""; + } + } + function computeSizes(dbg) { + const funs = dbg.functions.slice(); + funs.sort((a, b) => a.size - b.size || strcmp(a.name, b.name)); + let ftotal = 0; + for (const f of funs) { + ftotal += f.size; + } + let dtotal = 0; + for (const v of Object.values(dbg.sizes)) + dtotal += v; + const loc = SrcMapResolver.from(dbg); + return "## Data\n\n" + toTable( + ["Size", "Name"], + Object.keys(dbg.sizes).map((k) => [dbg.sizes[k], k]).concat([[dtotal, "Data TOTAL"]]) + ) + "\n## Functions\n\n" + toTable( + ["Size", "Name", "Users"], + funs.map((f) => [f.size, "`" + f.name + "`", locs2str(f.users)]).concat([ + [ftotal, "Function TOTAL"], + [dtotal + ftotal, "TOTAL"] + ]) + ); + function loc2str(l) { + return loc.posToString(l[0]); + } + function locs2str(ls) { + const maxlen = 10; + let r = ls.slice(0, maxlen).map(loc2str).join(", "); + if (ls.length > maxlen) + r += "..."; + return r; + } + } + var CONST_SYSTEM_ANNOUNCE_INTERVAL = 500; + var SystemReadingThreshold = /* @__PURE__ */ ((SystemReadingThreshold2) => { + SystemReadingThreshold2[SystemReadingThreshold2["Neutral"] = 1] = "Neutral"; + SystemReadingThreshold2[SystemReadingThreshold2["Inactive"] = 2] = "Inactive"; + SystemReadingThreshold2[SystemReadingThreshold2["Active"] = 3] = "Active"; + return SystemReadingThreshold2; + })(SystemReadingThreshold || {}); + var SystemStatusCodes = /* @__PURE__ */ ((SystemStatusCodes2) => { + SystemStatusCodes2[SystemStatusCodes2["Ready"] = 0] = "Ready"; + SystemStatusCodes2[SystemStatusCodes2["Initializing"] = 1] = "Initializing"; + SystemStatusCodes2[SystemStatusCodes2["Calibrating"] = 2] = "Calibrating"; + SystemStatusCodes2[SystemStatusCodes2["Sleeping"] = 3] = "Sleeping"; + SystemStatusCodes2[SystemStatusCodes2["WaitingForInput"] = 4] = "WaitingForInput"; + SystemStatusCodes2[SystemStatusCodes2["CalibrationNeeded"] = 100] = "CalibrationNeeded"; + return SystemStatusCodes2; + })(SystemStatusCodes || {}); + var SystemCmd = /* @__PURE__ */ ((SystemCmd22) => { + SystemCmd22[SystemCmd22["Announce"] = 0] = "Announce"; + SystemCmd22[SystemCmd22["GetRegister"] = 4096] = "GetRegister"; + SystemCmd22[SystemCmd22["SetRegister"] = 8192] = "SetRegister"; + SystemCmd22[SystemCmd22["Calibrate"] = 2] = "Calibrate"; + SystemCmd22[SystemCmd22["CommandNotImplemented"] = 3] = "CommandNotImplemented"; + return SystemCmd22; + })(SystemCmd || {}); + var SystemCmdPack; + ((SystemCmdPack22) => { + SystemCmdPack22.CommandNotImplemented = "u16 u16"; + })(SystemCmdPack || (SystemCmdPack = {})); + var SystemReg = /* @__PURE__ */ ((SystemReg22) => { + SystemReg22[SystemReg22["Intensity"] = 1] = "Intensity"; + SystemReg22[SystemReg22["Value"] = 2] = "Value"; + SystemReg22[SystemReg22["MinValue"] = 272] = "MinValue"; + SystemReg22[SystemReg22["MaxValue"] = 273] = "MaxValue"; + SystemReg22[SystemReg22["MaxPower"] = 7] = "MaxPower"; + SystemReg22[SystemReg22["StreamingSamples"] = 3] = "StreamingSamples"; + SystemReg22[SystemReg22["StreamingInterval"] = 4] = "StreamingInterval"; + SystemReg22[SystemReg22["Reading"] = 257] = "Reading"; + SystemReg22[SystemReg22["ReadingRange"] = 8] = "ReadingRange"; + SystemReg22[SystemReg22["SupportedRanges"] = 266] = "SupportedRanges"; + SystemReg22[SystemReg22["MinReading"] = 260] = "MinReading"; + SystemReg22[SystemReg22["MaxReading"] = 261] = "MaxReading"; + SystemReg22[SystemReg22["ReadingError"] = 262] = "ReadingError"; + SystemReg22[SystemReg22["ReadingResolution"] = 264] = "ReadingResolution"; + SystemReg22[SystemReg22["InactiveThreshold"] = 5] = "InactiveThreshold"; + SystemReg22[SystemReg22["ActiveThreshold"] = 6] = "ActiveThreshold"; + SystemReg22[SystemReg22["StreamingPreferredInterval"] = 258] = "StreamingPreferredInterval"; + SystemReg22[SystemReg22["Variant"] = 263] = "Variant"; + SystemReg22[SystemReg22["ClientVariant"] = 9] = "ClientVariant"; + SystemReg22[SystemReg22["StatusCode"] = 259] = "StatusCode"; + SystemReg22[SystemReg22["InstanceName"] = 265] = "InstanceName"; + return SystemReg22; + })(SystemReg || {}); + var SystemRegPack; + ((SystemRegPack22) => { + SystemRegPack22.Intensity = "u32"; + SystemRegPack22.Value = "i32"; + SystemRegPack22.MinValue = "i32"; + SystemRegPack22.MaxValue = "i32"; + SystemRegPack22.MaxPower = "u16"; + SystemRegPack22.StreamingSamples = "u8"; + SystemRegPack22.StreamingInterval = "u32"; + SystemRegPack22.Reading = "i32"; + SystemRegPack22.ReadingRange = "u32"; + SystemRegPack22.SupportedRanges = "r: u32"; + SystemRegPack22.MinReading = "i32"; + SystemRegPack22.MaxReading = "i32"; + SystemRegPack22.ReadingError = "u32"; + SystemRegPack22.ReadingResolution = "u32"; + SystemRegPack22.InactiveThreshold = "i32"; + SystemRegPack22.ActiveThreshold = "i32"; + SystemRegPack22.StreamingPreferredInterval = "u32"; + SystemRegPack22.Variant = "u32"; + SystemRegPack22.ClientVariant = "s"; + SystemRegPack22.StatusCode = "u16 u16"; + SystemRegPack22.InstanceName = "s"; + })(SystemRegPack || (SystemRegPack = {})); + var SystemEvent = /* @__PURE__ */ ((SystemEvent2) => { + SystemEvent2[SystemEvent2["Active"] = 1] = "Active"; + SystemEvent2[SystemEvent2["Inactive"] = 2] = "Inactive"; + SystemEvent2[SystemEvent2["Change"] = 3] = "Change"; + SystemEvent2[SystemEvent2["StatusCodeChanged"] = 4] = "StatusCodeChanged"; + SystemEvent2[SystemEvent2["Neutral"] = 7] = "Neutral"; + return SystemEvent2; + })(SystemEvent || {}); + var SystemEventPack; + ((SystemEventPack22) => { + SystemEventPack22.StatusCodeChanged = "u16 u16"; + })(SystemEventPack || (SystemEventPack = {})); + var BaseCmd = /* @__PURE__ */ ((BaseCmd2) => { + BaseCmd2[BaseCmd2["CommandNotImplemented"] = 3] = "CommandNotImplemented"; + return BaseCmd2; + })(BaseCmd || {}); + var BaseCmdPack; + ((BaseCmdPack22) => { + BaseCmdPack22.CommandNotImplemented = "u16 u16"; + })(BaseCmdPack || (BaseCmdPack = {})); + var BaseReg = /* @__PURE__ */ ((BaseReg2) => { + BaseReg2[BaseReg2["InstanceName"] = 265] = "InstanceName"; + BaseReg2[BaseReg2["StatusCode"] = 259] = "StatusCode"; + BaseReg2[BaseReg2["ClientVariant"] = 9] = "ClientVariant"; + return BaseReg2; + })(BaseReg || {}); + var BaseRegPack; + ((BaseRegPack22) => { + BaseRegPack22.InstanceName = "s"; + BaseRegPack22.StatusCode = "u16 u16"; + BaseRegPack22.ClientVariant = "s"; + })(BaseRegPack || (BaseRegPack = {})); + var BaseEvent = /* @__PURE__ */ ((BaseEvent2) => { + BaseEvent2[BaseEvent2["StatusCodeChanged"] = 4] = "StatusCodeChanged"; + return BaseEvent2; + })(BaseEvent || {}); + var BaseEventPack; + ((BaseEventPack22) => { + BaseEventPack22.StatusCodeChanged = "u16 u16"; + })(BaseEventPack || (BaseEventPack = {})); + var SensorReg = /* @__PURE__ */ ((SensorReg2) => { + SensorReg2[SensorReg2["StreamingSamples"] = 3] = "StreamingSamples"; + SensorReg2[SensorReg2["StreamingInterval"] = 4] = "StreamingInterval"; + SensorReg2[SensorReg2["StreamingPreferredInterval"] = 258] = "StreamingPreferredInterval"; + return SensorReg2; + })(SensorReg || {}); + var SensorRegPack; + ((SensorRegPack22) => { + SensorRegPack22.StreamingSamples = "u8"; + SensorRegPack22.StreamingInterval = "u32"; + SensorRegPack22.StreamingPreferredInterval = "u32"; + })(SensorRegPack || (SensorRegPack = {})); + var SRV_ACCELEROMETER = 521405449; + var AccelerometerReg = /* @__PURE__ */ ((AccelerometerReg2) => { + AccelerometerReg2[AccelerometerReg2["Forces"] = 257] = "Forces"; + AccelerometerReg2[AccelerometerReg2["ForcesError"] = 262] = "ForcesError"; + AccelerometerReg2[AccelerometerReg2["MaxForce"] = 8] = "MaxForce"; + AccelerometerReg2[AccelerometerReg2["MaxForcesSupported"] = 266] = "MaxForcesSupported"; + return AccelerometerReg2; + })(AccelerometerReg || {}); + var AccelerometerRegPack; + ((AccelerometerRegPack22) => { + AccelerometerRegPack22.Forces = "i12.20 i12.20 i12.20"; + AccelerometerRegPack22.ForcesError = "u12.20"; + AccelerometerRegPack22.MaxForce = "u12.20"; + AccelerometerRegPack22.MaxForcesSupported = "r: u12.20"; + })(AccelerometerRegPack || (AccelerometerRegPack = {})); + var AccelerometerEvent = /* @__PURE__ */ ((AccelerometerEvent2) => { + AccelerometerEvent2[AccelerometerEvent2["TiltUp"] = 129] = "TiltUp"; + AccelerometerEvent2[AccelerometerEvent2["TiltDown"] = 130] = "TiltDown"; + AccelerometerEvent2[AccelerometerEvent2["TiltLeft"] = 131] = "TiltLeft"; + AccelerometerEvent2[AccelerometerEvent2["TiltRight"] = 132] = "TiltRight"; + AccelerometerEvent2[AccelerometerEvent2["FaceUp"] = 133] = "FaceUp"; + AccelerometerEvent2[AccelerometerEvent2["FaceDown"] = 134] = "FaceDown"; + AccelerometerEvent2[AccelerometerEvent2["Freefall"] = 135] = "Freefall"; + AccelerometerEvent2[AccelerometerEvent2["Shake"] = 139] = "Shake"; + AccelerometerEvent2[AccelerometerEvent2["Force2g"] = 140] = "Force2g"; + AccelerometerEvent2[AccelerometerEvent2["Force3g"] = 136] = "Force3g"; + AccelerometerEvent2[AccelerometerEvent2["Force6g"] = 137] = "Force6g"; + AccelerometerEvent2[AccelerometerEvent2["Force8g"] = 138] = "Force8g"; + return AccelerometerEvent2; + })(AccelerometerEvent || {}); + var SRV_ACIDITY = 513243333; + var AcidityReg = /* @__PURE__ */ ((AcidityReg2) => { + AcidityReg2[AcidityReg2["Acidity"] = 257] = "Acidity"; + AcidityReg2[AcidityReg2["AcidityError"] = 262] = "AcidityError"; + AcidityReg2[AcidityReg2["MinAcidity"] = 260] = "MinAcidity"; + AcidityReg2[AcidityReg2["MaxHumidity"] = 261] = "MaxHumidity"; + return AcidityReg2; + })(AcidityReg || {}); + var AcidityRegPack; + ((AcidityRegPack22) => { + AcidityRegPack22.Acidity = "u4.12"; + AcidityRegPack22.AcidityError = "u4.12"; + AcidityRegPack22.MinAcidity = "u4.12"; + AcidityRegPack22.MaxHumidity = "u4.12"; + })(AcidityRegPack || (AcidityRegPack = {})); + var SRV_AIR_PRESSURE = 504462570; + var AirPressureReg = /* @__PURE__ */ ((AirPressureReg2) => { + AirPressureReg2[AirPressureReg2["Pressure"] = 257] = "Pressure"; + AirPressureReg2[AirPressureReg2["PressureError"] = 262] = "PressureError"; + AirPressureReg2[AirPressureReg2["MinPressure"] = 260] = "MinPressure"; + AirPressureReg2[AirPressureReg2["MaxPressure"] = 261] = "MaxPressure"; + return AirPressureReg2; + })(AirPressureReg || {}); + var AirPressureRegPack; + ((AirPressureRegPack22) => { + AirPressureRegPack22.Pressure = "u22.10"; + AirPressureRegPack22.PressureError = "u22.10"; + AirPressureRegPack22.MinPressure = "u22.10"; + AirPressureRegPack22.MaxPressure = "u22.10"; + })(AirPressureRegPack || (AirPressureRegPack = {})); + var SRV_AIR_QUALITY_INDEX = 346844886; + var AirQualityIndexReg = /* @__PURE__ */ ((AirQualityIndexReg2) => { + AirQualityIndexReg2[AirQualityIndexReg2["AqiIndex"] = 257] = "AqiIndex"; + AirQualityIndexReg2[AirQualityIndexReg2["AqiIndexError"] = 262] = "AqiIndexError"; + AirQualityIndexReg2[AirQualityIndexReg2["MinAqiIndex"] = 260] = "MinAqiIndex"; + AirQualityIndexReg2[AirQualityIndexReg2["MaxAqiIndex"] = 261] = "MaxAqiIndex"; + return AirQualityIndexReg2; + })(AirQualityIndexReg || {}); + var AirQualityIndexRegPack; + ((AirQualityIndexRegPack22) => { + AirQualityIndexRegPack22.AqiIndex = "u16.16"; + AirQualityIndexRegPack22.AqiIndexError = "u16.16"; + AirQualityIndexRegPack22.MinAqiIndex = "u16.16"; + AirQualityIndexRegPack22.MaxAqiIndex = "u16.16"; + })(AirQualityIndexRegPack || (AirQualityIndexRegPack = {})); + var SRV_ARCADE_GAMEPAD = 501915758; + var ArcadeGamepadButton = /* @__PURE__ */ ((ArcadeGamepadButton2) => { + ArcadeGamepadButton2[ArcadeGamepadButton2["Left"] = 1] = "Left"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Up"] = 2] = "Up"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Right"] = 3] = "Right"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Down"] = 4] = "Down"; + ArcadeGamepadButton2[ArcadeGamepadButton2["A"] = 5] = "A"; + ArcadeGamepadButton2[ArcadeGamepadButton2["B"] = 6] = "B"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Menu"] = 7] = "Menu"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Select"] = 8] = "Select"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Reset"] = 9] = "Reset"; + ArcadeGamepadButton2[ArcadeGamepadButton2["Exit"] = 10] = "Exit"; + return ArcadeGamepadButton2; + })(ArcadeGamepadButton || {}); + var ArcadeGamepadReg = /* @__PURE__ */ ((ArcadeGamepadReg2) => { + ArcadeGamepadReg2[ArcadeGamepadReg2["Buttons"] = 257] = "Buttons"; + ArcadeGamepadReg2[ArcadeGamepadReg2["AvailableButtons"] = 384] = "AvailableButtons"; + return ArcadeGamepadReg2; + })(ArcadeGamepadReg || {}); + var ArcadeGamepadRegPack; + ((ArcadeGamepadRegPack22) => { + ArcadeGamepadRegPack22.Buttons = "r: u8 u0.8"; + ArcadeGamepadRegPack22.AvailableButtons = "r: u8"; + })(ArcadeGamepadRegPack || (ArcadeGamepadRegPack = {})); + var ArcadeGamepadEvent = /* @__PURE__ */ ((ArcadeGamepadEvent2) => { + ArcadeGamepadEvent2[ArcadeGamepadEvent2["Down"] = 1] = "Down"; + ArcadeGamepadEvent2[ArcadeGamepadEvent2["Up"] = 2] = "Up"; + return ArcadeGamepadEvent2; + })(ArcadeGamepadEvent || {}); + var ArcadeGamepadEventPack; + ((ArcadeGamepadEventPack22) => { + ArcadeGamepadEventPack22.Down = "u8"; + ArcadeGamepadEventPack22.Up = "u8"; + })(ArcadeGamepadEventPack || (ArcadeGamepadEventPack = {})); + var SRV_ARCADE_SOUND = 533083654; + var ArcadeSoundCmd = /* @__PURE__ */ ((ArcadeSoundCmd2) => { + ArcadeSoundCmd2[ArcadeSoundCmd2["Play"] = 128] = "Play"; + return ArcadeSoundCmd2; + })(ArcadeSoundCmd || {}); + var ArcadeSoundCmdPack; + ((ArcadeSoundCmdPack22) => { + ArcadeSoundCmdPack22.Play = "b"; + })(ArcadeSoundCmdPack || (ArcadeSoundCmdPack = {})); + var ArcadeSoundReg = /* @__PURE__ */ ((ArcadeSoundReg2) => { + ArcadeSoundReg2[ArcadeSoundReg2["SampleRate"] = 128] = "SampleRate"; + ArcadeSoundReg2[ArcadeSoundReg2["BufferSize"] = 384] = "BufferSize"; + ArcadeSoundReg2[ArcadeSoundReg2["BufferPending"] = 385] = "BufferPending"; + return ArcadeSoundReg2; + })(ArcadeSoundReg || {}); + var ArcadeSoundRegPack; + ((ArcadeSoundRegPack22) => { + ArcadeSoundRegPack22.SampleRate = "u22.10"; + ArcadeSoundRegPack22.BufferSize = "u32"; + ArcadeSoundRegPack22.BufferPending = "u32"; + })(ArcadeSoundRegPack || (ArcadeSoundRegPack = {})); + var SRV_BARCODE_READER = 477339244; + var BarcodeReaderFormat = /* @__PURE__ */ ((BarcodeReaderFormat2) => { + BarcodeReaderFormat2[BarcodeReaderFormat2["Aztec"] = 1] = "Aztec"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Code128"] = 2] = "Code128"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Code39"] = 3] = "Code39"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Code93"] = 4] = "Code93"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Codabar"] = 5] = "Codabar"; + BarcodeReaderFormat2[BarcodeReaderFormat2["DataMatrix"] = 6] = "DataMatrix"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Ean13"] = 8] = "Ean13"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Ean8"] = 9] = "Ean8"; + BarcodeReaderFormat2[BarcodeReaderFormat2["ITF"] = 10] = "ITF"; + BarcodeReaderFormat2[BarcodeReaderFormat2["Pdf417"] = 11] = "Pdf417"; + BarcodeReaderFormat2[BarcodeReaderFormat2["QrCode"] = 12] = "QrCode"; + BarcodeReaderFormat2[BarcodeReaderFormat2["UpcA"] = 13] = "UpcA"; + BarcodeReaderFormat2[BarcodeReaderFormat2["UpcE"] = 14] = "UpcE"; + return BarcodeReaderFormat2; + })(BarcodeReaderFormat || {}); + var BarcodeReaderReg = /* @__PURE__ */ ((BarcodeReaderReg2) => { + BarcodeReaderReg2[BarcodeReaderReg2["Enabled"] = 1] = "Enabled"; + BarcodeReaderReg2[BarcodeReaderReg2["Formats"] = 384] = "Formats"; + return BarcodeReaderReg2; + })(BarcodeReaderReg || {}); + var BarcodeReaderRegPack; + ((BarcodeReaderRegPack22) => { + BarcodeReaderRegPack22.Enabled = "u8"; + BarcodeReaderRegPack22.Formats = "r: u8"; + })(BarcodeReaderRegPack || (BarcodeReaderRegPack = {})); + var BarcodeReaderEvent = /* @__PURE__ */ ((BarcodeReaderEvent2) => { + BarcodeReaderEvent2[BarcodeReaderEvent2["Detect"] = 1] = "Detect"; + return BarcodeReaderEvent2; + })(BarcodeReaderEvent || {}); + var BarcodeReaderEventPack; + ((BarcodeReaderEventPack22) => { + BarcodeReaderEventPack22.Detect = "u8 s"; + })(BarcodeReaderEventPack || (BarcodeReaderEventPack = {})); + var SRV_BIT_RADIO = 449414863; + var BitRadioReg = /* @__PURE__ */ ((BitRadioReg2) => { + BitRadioReg2[BitRadioReg2["Enabled"] = 1] = "Enabled"; + BitRadioReg2[BitRadioReg2["Group"] = 128] = "Group"; + BitRadioReg2[BitRadioReg2["TransmissionPower"] = 129] = "TransmissionPower"; + BitRadioReg2[BitRadioReg2["FrequencyBand"] = 130] = "FrequencyBand"; + return BitRadioReg2; + })(BitRadioReg || {}); + var BitRadioRegPack; + ((BitRadioRegPack22) => { + BitRadioRegPack22.Enabled = "u8"; + BitRadioRegPack22.Group = "u8"; + BitRadioRegPack22.TransmissionPower = "u8"; + BitRadioRegPack22.FrequencyBand = "u8"; + })(BitRadioRegPack || (BitRadioRegPack = {})); + var BitRadioCmd = /* @__PURE__ */ ((BitRadioCmd2) => { + BitRadioCmd2[BitRadioCmd2["SendString"] = 128] = "SendString"; + BitRadioCmd2[BitRadioCmd2["SendNumber"] = 129] = "SendNumber"; + BitRadioCmd2[BitRadioCmd2["SendValue"] = 130] = "SendValue"; + BitRadioCmd2[BitRadioCmd2["SendBuffer"] = 131] = "SendBuffer"; + BitRadioCmd2[BitRadioCmd2["StringReceived"] = 144] = "StringReceived"; + BitRadioCmd2[BitRadioCmd2["NumberReceived"] = 145] = "NumberReceived"; + BitRadioCmd2[BitRadioCmd2["BufferReceived"] = 146] = "BufferReceived"; + return BitRadioCmd2; + })(BitRadioCmd || {}); + var BitRadioCmdPack; + ((BitRadioCmdPack22) => { + BitRadioCmdPack22.SendString = "s"; + BitRadioCmdPack22.SendNumber = "f64"; + BitRadioCmdPack22.SendValue = "f64 s"; + BitRadioCmdPack22.SendBuffer = "b"; + BitRadioCmdPack22.StringReceived = "u32 u32 i8 b[1] s"; + BitRadioCmdPack22.NumberReceived = "u32 u32 i8 b[3] f64 s"; + BitRadioCmdPack22.BufferReceived = "u32 u32 i8 b[1] b"; + })(BitRadioCmdPack || (BitRadioCmdPack = {})); + var SRV_BOOTLOADER = 536516936; + var BootloaderError = /* @__PURE__ */ ((BootloaderError2) => { + BootloaderError2[BootloaderError2["NoError"] = 0] = "NoError"; + BootloaderError2[BootloaderError2["PacketTooSmall"] = 1] = "PacketTooSmall"; + BootloaderError2[BootloaderError2["OutOfFlashableRange"] = 2] = "OutOfFlashableRange"; + BootloaderError2[BootloaderError2["InvalidPageOffset"] = 3] = "InvalidPageOffset"; + BootloaderError2[BootloaderError2["NotPageAligned"] = 4] = "NotPageAligned"; + return BootloaderError2; + })(BootloaderError || {}); + var BootloaderCmd = /* @__PURE__ */ ((BootloaderCmd2) => { + BootloaderCmd2[BootloaderCmd2["Info"] = 0] = "Info"; + BootloaderCmd2[BootloaderCmd2["SetSession"] = 129] = "SetSession"; + BootloaderCmd2[BootloaderCmd2["PageData"] = 128] = "PageData"; + return BootloaderCmd2; + })(BootloaderCmd || {}); + var BootloaderCmdPack; + ((BootloaderCmdPack22) => { + BootloaderCmdPack22.InfoReport = "u32 u32 u32 u32"; + BootloaderCmdPack22.SetSession = "u32"; + BootloaderCmdPack22.SetSessionReport = "u32"; + BootloaderCmdPack22.PageData = "u32 u16 u8 u8 u32 u32 u32 u32 u32 b[208]"; + BootloaderCmdPack22.PageDataReport = "u32 u32 u32"; + })(BootloaderCmdPack || (BootloaderCmdPack = {})); + var SRV_BRAILLE_DISPLAY = 331331532; + var BrailleDisplayReg = /* @__PURE__ */ ((BrailleDisplayReg2) => { + BrailleDisplayReg2[BrailleDisplayReg2["Enabled"] = 1] = "Enabled"; + BrailleDisplayReg2[BrailleDisplayReg2["Patterns"] = 2] = "Patterns"; + BrailleDisplayReg2[BrailleDisplayReg2["Length"] = 385] = "Length"; + return BrailleDisplayReg2; + })(BrailleDisplayReg || {}); + var BrailleDisplayRegPack; + ((BrailleDisplayRegPack22) => { + BrailleDisplayRegPack22.Enabled = "u8"; + BrailleDisplayRegPack22.Patterns = "s"; + BrailleDisplayRegPack22.Length = "u8"; + })(BrailleDisplayRegPack || (BrailleDisplayRegPack = {})); + var SRV_BRIDGE = 535147631; + var BridgeReg = /* @__PURE__ */ ((BridgeReg2) => { + BridgeReg2[BridgeReg2["Enabled"] = 1] = "Enabled"; + return BridgeReg2; + })(BridgeReg || {}); + var BridgeRegPack; + ((BridgeRegPack22) => { + BridgeRegPack22.Enabled = "u8"; + })(BridgeRegPack || (BridgeRegPack = {})); + var SRV_BUTTON = 343122531; + var ButtonReg = /* @__PURE__ */ ((ButtonReg2) => { + ButtonReg2[ButtonReg2["Pressure"] = 257] = "Pressure"; + ButtonReg2[ButtonReg2["Analog"] = 384] = "Analog"; + ButtonReg2[ButtonReg2["Pressed"] = 385] = "Pressed"; + return ButtonReg2; + })(ButtonReg || {}); + var ButtonRegPack; + ((ButtonRegPack22) => { + ButtonRegPack22.Pressure = "u0.16"; + ButtonRegPack22.Analog = "u8"; + ButtonRegPack22.Pressed = "u8"; + })(ButtonRegPack || (ButtonRegPack = {})); + var ButtonEvent = /* @__PURE__ */ ((ButtonEvent2) => { + ButtonEvent2[ButtonEvent2["Down"] = 1] = "Down"; + ButtonEvent2[ButtonEvent2["Up"] = 2] = "Up"; + ButtonEvent2[ButtonEvent2["Hold"] = 129] = "Hold"; + return ButtonEvent2; + })(ButtonEvent || {}); + var ButtonEventPack; + ((ButtonEventPack22) => { + ButtonEventPack22.Up = "u32"; + ButtonEventPack22.Hold = "u32"; + })(ButtonEventPack || (ButtonEventPack = {})); + var SRV_BUZZER = 458731991; + var BuzzerReg = /* @__PURE__ */ ((BuzzerReg2) => { + BuzzerReg2[BuzzerReg2["Volume"] = 1] = "Volume"; + return BuzzerReg2; + })(BuzzerReg || {}); + var BuzzerRegPack; + ((BuzzerRegPack22) => { + BuzzerRegPack22.Volume = "u0.8"; + })(BuzzerRegPack || (BuzzerRegPack = {})); + var BuzzerCmd = /* @__PURE__ */ ((BuzzerCmd2) => { + BuzzerCmd2[BuzzerCmd2["PlayTone"] = 128] = "PlayTone"; + BuzzerCmd2[BuzzerCmd2["PlayNote"] = 129] = "PlayNote"; + return BuzzerCmd2; + })(BuzzerCmd || {}); + var BuzzerCmdPack; + ((BuzzerCmdPack22) => { + BuzzerCmdPack22.PlayTone = "u16 u16 u16"; + BuzzerCmdPack22.PlayNote = "u16 u0.16 u16"; + })(BuzzerCmdPack || (BuzzerCmdPack = {})); + var SRV_CAPACITIVE_BUTTON = 677752265; + var CapacitiveButtonReg = /* @__PURE__ */ ((CapacitiveButtonReg2) => { + CapacitiveButtonReg2[CapacitiveButtonReg2["Threshold"] = 6] = "Threshold"; + return CapacitiveButtonReg2; + })(CapacitiveButtonReg || {}); + var CapacitiveButtonRegPack; + ((CapacitiveButtonRegPack22) => { + CapacitiveButtonRegPack22.Threshold = "u0.16"; + })(CapacitiveButtonRegPack || (CapacitiveButtonRegPack = {})); + var CapacitiveButtonCmd = /* @__PURE__ */ ((CapacitiveButtonCmd2) => { + CapacitiveButtonCmd2[CapacitiveButtonCmd2["Calibrate"] = 2] = "Calibrate"; + return CapacitiveButtonCmd2; + })(CapacitiveButtonCmd || {}); + var SRV_CHARACTER_SCREEN = 523748714; + var CharacterScreenVariant = /* @__PURE__ */ ((CharacterScreenVariant2) => { + CharacterScreenVariant2[CharacterScreenVariant2["LCD"] = 1] = "LCD"; + CharacterScreenVariant2[CharacterScreenVariant2["OLED"] = 2] = "OLED"; + CharacterScreenVariant2[CharacterScreenVariant2["Braille"] = 3] = "Braille"; + return CharacterScreenVariant2; + })(CharacterScreenVariant || {}); + var CharacterScreenTextDirection = /* @__PURE__ */ ((CharacterScreenTextDirection2) => { + CharacterScreenTextDirection2[CharacterScreenTextDirection2["LeftToRight"] = 1] = "LeftToRight"; + CharacterScreenTextDirection2[CharacterScreenTextDirection2["RightToLeft"] = 2] = "RightToLeft"; + return CharacterScreenTextDirection2; + })(CharacterScreenTextDirection || {}); + var CharacterScreenReg = /* @__PURE__ */ ((CharacterScreenReg2) => { + CharacterScreenReg2[CharacterScreenReg2["Message"] = 2] = "Message"; + CharacterScreenReg2[CharacterScreenReg2["Brightness"] = 1] = "Brightness"; + CharacterScreenReg2[CharacterScreenReg2["Variant"] = 263] = "Variant"; + CharacterScreenReg2[CharacterScreenReg2["TextDirection"] = 130] = "TextDirection"; + CharacterScreenReg2[CharacterScreenReg2["Rows"] = 384] = "Rows"; + CharacterScreenReg2[CharacterScreenReg2["Columns"] = 385] = "Columns"; + return CharacterScreenReg2; + })(CharacterScreenReg || {}); + var CharacterScreenRegPack; + ((CharacterScreenRegPack22) => { + CharacterScreenRegPack22.Message = "s"; + CharacterScreenRegPack22.Brightness = "u0.16"; + CharacterScreenRegPack22.Variant = "u8"; + CharacterScreenRegPack22.TextDirection = "u8"; + CharacterScreenRegPack22.Rows = "u8"; + CharacterScreenRegPack22.Columns = "u8"; + })(CharacterScreenRegPack || (CharacterScreenRegPack = {})); + var SRV_CLOUD_ADAPTER = 341864092; + var CloudAdapterCmd = /* @__PURE__ */ ((CloudAdapterCmd2) => { + CloudAdapterCmd2[CloudAdapterCmd2["UploadJson"] = 128] = "UploadJson"; + CloudAdapterCmd2[CloudAdapterCmd2["UploadBinary"] = 129] = "UploadBinary"; + return CloudAdapterCmd2; + })(CloudAdapterCmd || {}); + var CloudAdapterCmdPack; + ((CloudAdapterCmdPack22) => { + CloudAdapterCmdPack22.UploadJson = "z s"; + CloudAdapterCmdPack22.UploadBinary = "z b"; + })(CloudAdapterCmdPack || (CloudAdapterCmdPack = {})); + var CloudAdapterReg = /* @__PURE__ */ ((CloudAdapterReg2) => { + CloudAdapterReg2[CloudAdapterReg2["Connected"] = 384] = "Connected"; + CloudAdapterReg2[CloudAdapterReg2["ConnectionName"] = 385] = "ConnectionName"; + return CloudAdapterReg2; + })(CloudAdapterReg || {}); + var CloudAdapterRegPack; + ((CloudAdapterRegPack22) => { + CloudAdapterRegPack22.Connected = "u8"; + CloudAdapterRegPack22.ConnectionName = "s"; + })(CloudAdapterRegPack || (CloudAdapterRegPack = {})); + var CloudAdapterEvent = /* @__PURE__ */ ((CloudAdapterEvent2) => { + CloudAdapterEvent2[CloudAdapterEvent2["OnJson"] = 128] = "OnJson"; + CloudAdapterEvent2[CloudAdapterEvent2["OnBinary"] = 129] = "OnBinary"; + CloudAdapterEvent2[CloudAdapterEvent2["Change"] = 3] = "Change"; + return CloudAdapterEvent2; + })(CloudAdapterEvent || {}); + var CloudAdapterEventPack; + ((CloudAdapterEventPack22) => { + CloudAdapterEventPack22.OnJson = "z s"; + CloudAdapterEventPack22.OnBinary = "z b"; + })(CloudAdapterEventPack || (CloudAdapterEventPack = {})); + var SRV_CLOUD_CONFIGURATION = 342028028; + var CloudConfigurationConnectionStatus = /* @__PURE__ */ ((CloudConfigurationConnectionStatus2) => { + CloudConfigurationConnectionStatus2[CloudConfigurationConnectionStatus2["Connected"] = 1] = "Connected"; + CloudConfigurationConnectionStatus2[CloudConfigurationConnectionStatus2["Disconnected"] = 2] = "Disconnected"; + CloudConfigurationConnectionStatus2[CloudConfigurationConnectionStatus2["Connecting"] = 3] = "Connecting"; + CloudConfigurationConnectionStatus2[CloudConfigurationConnectionStatus2["Disconnecting"] = 4] = "Disconnecting"; + return CloudConfigurationConnectionStatus2; + })(CloudConfigurationConnectionStatus || {}); + var CloudConfigurationReg = /* @__PURE__ */ ((CloudConfigurationReg2) => { + CloudConfigurationReg2[CloudConfigurationReg2["ServerName"] = 384] = "ServerName"; + CloudConfigurationReg2[CloudConfigurationReg2["CloudDeviceId"] = 385] = "CloudDeviceId"; + CloudConfigurationReg2[CloudConfigurationReg2["CloudType"] = 387] = "CloudType"; + CloudConfigurationReg2[CloudConfigurationReg2["ConnectionStatus"] = 386] = "ConnectionStatus"; + CloudConfigurationReg2[CloudConfigurationReg2["PushPeriod"] = 128] = "PushPeriod"; + CloudConfigurationReg2[CloudConfigurationReg2["PushWatchdogPeriod"] = 129] = "PushWatchdogPeriod"; + return CloudConfigurationReg2; + })(CloudConfigurationReg || {}); + var CloudConfigurationRegPack; + ((CloudConfigurationRegPack22) => { + CloudConfigurationRegPack22.ServerName = "s"; + CloudConfigurationRegPack22.CloudDeviceId = "s"; + CloudConfigurationRegPack22.CloudType = "s"; + CloudConfigurationRegPack22.ConnectionStatus = "u16"; + CloudConfigurationRegPack22.PushPeriod = "u32"; + CloudConfigurationRegPack22.PushWatchdogPeriod = "u32"; + })(CloudConfigurationRegPack || (CloudConfigurationRegPack = {})); + var CloudConfigurationCmd = /* @__PURE__ */ ((CloudConfigurationCmd2) => { + CloudConfigurationCmd2[CloudConfigurationCmd2["Connect"] = 129] = "Connect"; + CloudConfigurationCmd2[CloudConfigurationCmd2["Disconnect"] = 130] = "Disconnect"; + CloudConfigurationCmd2[CloudConfigurationCmd2["SetConnectionString"] = 134] = "SetConnectionString"; + return CloudConfigurationCmd2; + })(CloudConfigurationCmd || {}); + var CloudConfigurationCmdPack; + ((CloudConfigurationCmdPack22) => { + CloudConfigurationCmdPack22.SetConnectionString = "s"; + })(CloudConfigurationCmdPack || (CloudConfigurationCmdPack = {})); + var CloudConfigurationEvent = /* @__PURE__ */ ((CloudConfigurationEvent2) => { + CloudConfigurationEvent2[CloudConfigurationEvent2["ConnectionStatusChange"] = 3] = "ConnectionStatusChange"; + CloudConfigurationEvent2[CloudConfigurationEvent2["MessageSent"] = 128] = "MessageSent"; + return CloudConfigurationEvent2; + })(CloudConfigurationEvent || {}); + var CloudConfigurationEventPack; + ((CloudConfigurationEventPack22) => { + CloudConfigurationEventPack22.ConnectionStatusChange = "u16"; + })(CloudConfigurationEventPack || (CloudConfigurationEventPack = {})); + var SRV_CODAL_MESSAGE_BUS = 304085021; + var CodalMessageBusCmd = /* @__PURE__ */ ((CodalMessageBusCmd2) => { + CodalMessageBusCmd2[CodalMessageBusCmd2["Send"] = 128] = "Send"; + return CodalMessageBusCmd2; + })(CodalMessageBusCmd || {}); + var CodalMessageBusCmdPack; + ((CodalMessageBusCmdPack22) => { + CodalMessageBusCmdPack22.Send = "u16 u16"; + })(CodalMessageBusCmdPack || (CodalMessageBusCmdPack = {})); + var CodalMessageBusEvent = /* @__PURE__ */ ((CodalMessageBusEvent2) => { + CodalMessageBusEvent2[CodalMessageBusEvent2["Message"] = 128] = "Message"; + return CodalMessageBusEvent2; + })(CodalMessageBusEvent || {}); + var CodalMessageBusEventPack; + ((CodalMessageBusEventPack22) => { + CodalMessageBusEventPack22.Message = "u16 u16"; + })(CodalMessageBusEventPack || (CodalMessageBusEventPack = {})); + var SRV_COLOR = 372299111; + var ColorReg = /* @__PURE__ */ ((ColorReg2) => { + ColorReg2[ColorReg2["Color"] = 257] = "Color"; + return ColorReg2; + })(ColorReg || {}); + var ColorRegPack; + ((ColorRegPack22) => { + ColorRegPack22.Color = "u0.16 u0.16 u0.16"; + })(ColorRegPack || (ColorRegPack = {})); + var SRV_COMPASS = 364362175; + var CompassReg = /* @__PURE__ */ ((CompassReg2) => { + CompassReg2[CompassReg2["Heading"] = 257] = "Heading"; + CompassReg2[CompassReg2["Enabled"] = 1] = "Enabled"; + CompassReg2[CompassReg2["HeadingError"] = 262] = "HeadingError"; + return CompassReg2; + })(CompassReg || {}); + var CompassRegPack; + ((CompassRegPack22) => { + CompassRegPack22.Heading = "u16.16"; + CompassRegPack22.Enabled = "u8"; + CompassRegPack22.HeadingError = "u16.16"; + })(CompassRegPack || (CompassRegPack = {})); + var CompassCmd = /* @__PURE__ */ ((CompassCmd2) => { + CompassCmd2[CompassCmd2["Calibrate"] = 2] = "Calibrate"; + return CompassCmd2; + })(CompassCmd || {}); + var SRV_CONTROL = 0; + var ControlAnnounceFlags = /* @__PURE__ */ ((ControlAnnounceFlags2) => { + ControlAnnounceFlags2[ControlAnnounceFlags2["RestartCounterSteady"] = 15] = "RestartCounterSteady"; + ControlAnnounceFlags2[ControlAnnounceFlags2["RestartCounter1"] = 1] = "RestartCounter1"; + ControlAnnounceFlags2[ControlAnnounceFlags2["RestartCounter2"] = 2] = "RestartCounter2"; + ControlAnnounceFlags2[ControlAnnounceFlags2["RestartCounter4"] = 4] = "RestartCounter4"; + ControlAnnounceFlags2[ControlAnnounceFlags2["RestartCounter8"] = 8] = "RestartCounter8"; + ControlAnnounceFlags2[ControlAnnounceFlags2["StatusLightNone"] = 0] = "StatusLightNone"; + ControlAnnounceFlags2[ControlAnnounceFlags2["StatusLightMono"] = 16] = "StatusLightMono"; + ControlAnnounceFlags2[ControlAnnounceFlags2["StatusLightRgbNoFade"] = 32] = "StatusLightRgbNoFade"; + ControlAnnounceFlags2[ControlAnnounceFlags2["StatusLightRgbFade"] = 48] = "StatusLightRgbFade"; + ControlAnnounceFlags2[ControlAnnounceFlags2["SupportsACK"] = 256] = "SupportsACK"; + ControlAnnounceFlags2[ControlAnnounceFlags2["SupportsBroadcast"] = 512] = "SupportsBroadcast"; + ControlAnnounceFlags2[ControlAnnounceFlags2["SupportsFrames"] = 1024] = "SupportsFrames"; + ControlAnnounceFlags2[ControlAnnounceFlags2["IsClient"] = 2048] = "IsClient"; + ControlAnnounceFlags2[ControlAnnounceFlags2["SupportsReliableCommands"] = 4096] = "SupportsReliableCommands"; + return ControlAnnounceFlags2; + })(ControlAnnounceFlags || {}); + var ControlCmd = /* @__PURE__ */ ((ControlCmd2) => { + ControlCmd2[ControlCmd2["Services"] = 0] = "Services"; + ControlCmd2[ControlCmd2["Noop"] = 128] = "Noop"; + ControlCmd2[ControlCmd2["Identify"] = 129] = "Identify"; + ControlCmd2[ControlCmd2["Reset"] = 130] = "Reset"; + ControlCmd2[ControlCmd2["FloodPing"] = 131] = "FloodPing"; + ControlCmd2[ControlCmd2["SetStatusLight"] = 132] = "SetStatusLight"; + ControlCmd2[ControlCmd2["Proxy"] = 133] = "Proxy"; + ControlCmd2[ControlCmd2["ReliableCommands"] = 134] = "ReliableCommands"; + ControlCmd2[ControlCmd2["Standby"] = 135] = "Standby"; + return ControlCmd2; + })(ControlCmd || {}); + var ControlCmdPack; + ((ControlCmdPack22) => { + ControlCmdPack22.ServicesReport = "u16 u8 u8 r: u32"; + ControlCmdPack22.FloodPing = "u32 u32 u8"; + ControlCmdPack22.FloodPingReport = "u32 b"; + ControlCmdPack22.SetStatusLight = "u8 u8 u8 u8"; + ControlCmdPack22.ReliableCommands = "u32"; + ControlCmdPack22.ReliableCommandsReport = "b[12]"; + ControlCmdPack22.Standby = "u32"; + })(ControlCmdPack || (ControlCmdPack = {})); + var ControlPipe = /* @__PURE__ */ ((ControlPipe2) => { + })(ControlPipe || {}); + var ControlPipePack; + ((ControlPipePack22) => { + ControlPipePack22.WrappedCommand = "u8 u8 u16 b"; + })(ControlPipePack || (ControlPipePack = {})); + var ControlReg = /* @__PURE__ */ ((ControlReg2) => { + ControlReg2[ControlReg2["ResetIn"] = 128] = "ResetIn"; + ControlReg2[ControlReg2["DeviceDescription"] = 384] = "DeviceDescription"; + ControlReg2[ControlReg2["ProductIdentifier"] = 385] = "ProductIdentifier"; + ControlReg2[ControlReg2["BootloaderProductIdentifier"] = 388] = "BootloaderProductIdentifier"; + ControlReg2[ControlReg2["FirmwareVersion"] = 389] = "FirmwareVersion"; + ControlReg2[ControlReg2["McuTemperature"] = 386] = "McuTemperature"; + ControlReg2[ControlReg2["Uptime"] = 390] = "Uptime"; + return ControlReg2; + })(ControlReg || {}); + var ControlRegPack; + ((ControlRegPack22) => { + ControlRegPack22.ResetIn = "u32"; + ControlRegPack22.DeviceDescription = "s"; + ControlRegPack22.ProductIdentifier = "u32"; + ControlRegPack22.BootloaderProductIdentifier = "u32"; + ControlRegPack22.FirmwareVersion = "s"; + ControlRegPack22.McuTemperature = "i16"; + ControlRegPack22.Uptime = "u64"; + })(ControlRegPack || (ControlRegPack = {})); + var SRV_DASHBOARD = 468029703; + var SRV_DC_CURRENT_MEASUREMENT = 420661422; + var DcCurrentMeasurementReg = /* @__PURE__ */ ((DcCurrentMeasurementReg2) => { + DcCurrentMeasurementReg2[DcCurrentMeasurementReg2["MeasurementName"] = 386] = "MeasurementName"; + DcCurrentMeasurementReg2[DcCurrentMeasurementReg2["Measurement"] = 257] = "Measurement"; + DcCurrentMeasurementReg2[DcCurrentMeasurementReg2["MeasurementError"] = 262] = "MeasurementError"; + DcCurrentMeasurementReg2[DcCurrentMeasurementReg2["MinMeasurement"] = 260] = "MinMeasurement"; + DcCurrentMeasurementReg2[DcCurrentMeasurementReg2["MaxMeasurement"] = 261] = "MaxMeasurement"; + return DcCurrentMeasurementReg2; + })(DcCurrentMeasurementReg || {}); + var DcCurrentMeasurementRegPack; + ((DcCurrentMeasurementRegPack22) => { + DcCurrentMeasurementRegPack22.MeasurementName = "s"; + DcCurrentMeasurementRegPack22.Measurement = "f64"; + DcCurrentMeasurementRegPack22.MeasurementError = "f64"; + DcCurrentMeasurementRegPack22.MinMeasurement = "f64"; + DcCurrentMeasurementRegPack22.MaxMeasurement = "f64"; + })(DcCurrentMeasurementRegPack || (DcCurrentMeasurementRegPack = {})); + var SRV_DC_VOLTAGE_MEASUREMENT = 372485145; + var DcVoltageMeasurementVoltageMeasurementType = /* @__PURE__ */ ((DcVoltageMeasurementVoltageMeasurementType2) => { + DcVoltageMeasurementVoltageMeasurementType2[DcVoltageMeasurementVoltageMeasurementType2["Absolute"] = 0] = "Absolute"; + DcVoltageMeasurementVoltageMeasurementType2[DcVoltageMeasurementVoltageMeasurementType2["Differential"] = 1] = "Differential"; + return DcVoltageMeasurementVoltageMeasurementType2; + })(DcVoltageMeasurementVoltageMeasurementType || {}); + var DcVoltageMeasurementReg = /* @__PURE__ */ ((DcVoltageMeasurementReg2) => { + DcVoltageMeasurementReg2[DcVoltageMeasurementReg2["MeasurementType"] = 385] = "MeasurementType"; + DcVoltageMeasurementReg2[DcVoltageMeasurementReg2["MeasurementName"] = 386] = "MeasurementName"; + DcVoltageMeasurementReg2[DcVoltageMeasurementReg2["Measurement"] = 257] = "Measurement"; + DcVoltageMeasurementReg2[DcVoltageMeasurementReg2["MeasurementError"] = 262] = "MeasurementError"; + DcVoltageMeasurementReg2[DcVoltageMeasurementReg2["MinMeasurement"] = 260] = "MinMeasurement"; + DcVoltageMeasurementReg2[DcVoltageMeasurementReg2["MaxMeasurement"] = 261] = "MaxMeasurement"; + return DcVoltageMeasurementReg2; + })(DcVoltageMeasurementReg || {}); + var DcVoltageMeasurementRegPack; + ((DcVoltageMeasurementRegPack22) => { + DcVoltageMeasurementRegPack22.MeasurementType = "u8"; + DcVoltageMeasurementRegPack22.MeasurementName = "s"; + DcVoltageMeasurementRegPack22.Measurement = "f64"; + DcVoltageMeasurementRegPack22.MeasurementError = "f64"; + DcVoltageMeasurementRegPack22.MinMeasurement = "f64"; + DcVoltageMeasurementRegPack22.MaxMeasurement = "f64"; + })(DcVoltageMeasurementRegPack || (DcVoltageMeasurementRegPack = {})); + var SRV_DEVICE_SCRIPT_CONDITION = 295074157; + var DeviceScriptConditionCmd = /* @__PURE__ */ ((DeviceScriptConditionCmd2) => { + DeviceScriptConditionCmd2[DeviceScriptConditionCmd2["Signal"] = 128] = "Signal"; + return DeviceScriptConditionCmd2; + })(DeviceScriptConditionCmd || {}); + var DeviceScriptConditionEvent = /* @__PURE__ */ ((DeviceScriptConditionEvent2) => { + DeviceScriptConditionEvent2[DeviceScriptConditionEvent2["Signalled"] = 3] = "Signalled"; + return DeviceScriptConditionEvent2; + })(DeviceScriptConditionEvent || {}); + var SRV_DEVS_DBG = 358308672; + var DevsDbgValueTag = /* @__PURE__ */ ((DevsDbgValueTag2) => { + DevsDbgValueTag2[DevsDbgValueTag2["Number"] = 1] = "Number"; + DevsDbgValueTag2[DevsDbgValueTag2["Special"] = 2] = "Special"; + DevsDbgValueTag2[DevsDbgValueTag2["Fiber"] = 3] = "Fiber"; + DevsDbgValueTag2[DevsDbgValueTag2["BuiltinObject"] = 5] = "BuiltinObject"; + DevsDbgValueTag2[DevsDbgValueTag2["Exotic"] = 6] = "Exotic"; + DevsDbgValueTag2[DevsDbgValueTag2["Unhandled"] = 7] = "Unhandled"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgBuffer"] = 32] = "ImgBuffer"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgStringBuiltin"] = 33] = "ImgStringBuiltin"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgStringAscii"] = 34] = "ImgStringAscii"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgStringUTF8"] = 35] = "ImgStringUTF8"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgRole"] = 48] = "ImgRole"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgFunction"] = 49] = "ImgFunction"; + DevsDbgValueTag2[DevsDbgValueTag2["ImgRoleMember"] = 50] = "ImgRoleMember"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjArray"] = 81] = "ObjArray"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjMap"] = 82] = "ObjMap"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjBuffer"] = 83] = "ObjBuffer"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjString"] = 84] = "ObjString"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjStackFrame"] = 85] = "ObjStackFrame"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjPacket"] = 86] = "ObjPacket"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjBoundFunction"] = 87] = "ObjBoundFunction"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjOpaque"] = 88] = "ObjOpaque"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjAny"] = 80] = "ObjAny"; + DevsDbgValueTag2[DevsDbgValueTag2["ObjMask"] = 240] = "ObjMask"; + DevsDbgValueTag2[DevsDbgValueTag2["User1"] = 241] = "User1"; + DevsDbgValueTag2[DevsDbgValueTag2["User2"] = 242] = "User2"; + DevsDbgValueTag2[DevsDbgValueTag2["User3"] = 243] = "User3"; + DevsDbgValueTag2[DevsDbgValueTag2["User4"] = 244] = "User4"; + return DevsDbgValueTag2; + })(DevsDbgValueTag || {}); + var DevsDbgValueSpecial = /* @__PURE__ */ ((DevsDbgValueSpecial2) => { + DevsDbgValueSpecial2[DevsDbgValueSpecial2["Undefined"] = 0] = "Undefined"; + DevsDbgValueSpecial2[DevsDbgValueSpecial2["True"] = 1] = "True"; + DevsDbgValueSpecial2[DevsDbgValueSpecial2["False"] = 2] = "False"; + DevsDbgValueSpecial2[DevsDbgValueSpecial2["Null"] = 3] = "Null"; + DevsDbgValueSpecial2[DevsDbgValueSpecial2["Globals"] = 100] = "Globals"; + DevsDbgValueSpecial2[DevsDbgValueSpecial2["CurrentException"] = 101] = "CurrentException"; + return DevsDbgValueSpecial2; + })(DevsDbgValueSpecial || {}); + var DevsDbgFunIdx = /* @__PURE__ */ ((DevsDbgFunIdx2) => { + DevsDbgFunIdx2[DevsDbgFunIdx2["None"] = 0] = "None"; + DevsDbgFunIdx2[DevsDbgFunIdx2["Main"] = 49999] = "Main"; + DevsDbgFunIdx2[DevsDbgFunIdx2["FirstBuiltIn"] = 5e4] = "FirstBuiltIn"; + return DevsDbgFunIdx2; + })(DevsDbgFunIdx || {}); + var DevsDbgFiberHandle = /* @__PURE__ */ ((DevsDbgFiberHandle2) => { + DevsDbgFiberHandle2[DevsDbgFiberHandle2["None"] = 0] = "None"; + return DevsDbgFiberHandle2; + })(DevsDbgFiberHandle || {}); + var DevsDbgProgramCounter = /* @__PURE__ */ ((DevsDbgProgramCounter2) => { + })(DevsDbgProgramCounter || {}); + var DevsDbgObjStackFrame = /* @__PURE__ */ ((DevsDbgObjStackFrame2) => { + DevsDbgObjStackFrame2[DevsDbgObjStackFrame2["Null"] = 0] = "Null"; + return DevsDbgObjStackFrame2; + })(DevsDbgObjStackFrame || {}); + var DevsDbgString = /* @__PURE__ */ ((DevsDbgString2) => { + DevsDbgString2[DevsDbgString2["StaticIndicatorMask"] = 2147483649] = "StaticIndicatorMask"; + DevsDbgString2[DevsDbgString2["StaticTagMask"] = 2130706432] = "StaticTagMask"; + DevsDbgString2[DevsDbgString2["StaticIndexMask"] = 16777214] = "StaticIndexMask"; + DevsDbgString2[DevsDbgString2["Unhandled"] = 0] = "Unhandled"; + return DevsDbgString2; + })(DevsDbgString || {}); + var DevsDbgStepFlags = /* @__PURE__ */ ((DevsDbgStepFlags2) => { + DevsDbgStepFlags2[DevsDbgStepFlags2["StepOut"] = 1] = "StepOut"; + DevsDbgStepFlags2[DevsDbgStepFlags2["StepIn"] = 2] = "StepIn"; + DevsDbgStepFlags2[DevsDbgStepFlags2["Throw"] = 4] = "Throw"; + return DevsDbgStepFlags2; + })(DevsDbgStepFlags || {}); + var DevsDbgSuspensionType = /* @__PURE__ */ ((DevsDbgSuspensionType2) => { + DevsDbgSuspensionType2[DevsDbgSuspensionType2["None"] = 0] = "None"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["Breakpoint"] = 1] = "Breakpoint"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["UnhandledException"] = 2] = "UnhandledException"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["HandledException"] = 3] = "HandledException"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["Halt"] = 4] = "Halt"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["Panic"] = 5] = "Panic"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["Restart"] = 6] = "Restart"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["DebuggerStmt"] = 7] = "DebuggerStmt"; + DevsDbgSuspensionType2[DevsDbgSuspensionType2["Step"] = 8] = "Step"; + return DevsDbgSuspensionType2; + })(DevsDbgSuspensionType || {}); + var DevsDbgCmd = /* @__PURE__ */ ((DevsDbgCmd2) => { + DevsDbgCmd2[DevsDbgCmd2["ReadFibers"] = 128] = "ReadFibers"; + DevsDbgCmd2[DevsDbgCmd2["ReadStack"] = 129] = "ReadStack"; + DevsDbgCmd2[DevsDbgCmd2["ReadIndexedValues"] = 130] = "ReadIndexedValues"; + DevsDbgCmd2[DevsDbgCmd2["ReadNamedValues"] = 131] = "ReadNamedValues"; + DevsDbgCmd2[DevsDbgCmd2["ReadValue"] = 132] = "ReadValue"; + DevsDbgCmd2[DevsDbgCmd2["ReadBytes"] = 133] = "ReadBytes"; + DevsDbgCmd2[DevsDbgCmd2["SetBreakpoints"] = 144] = "SetBreakpoints"; + DevsDbgCmd2[DevsDbgCmd2["ClearBreakpoints"] = 145] = "ClearBreakpoints"; + DevsDbgCmd2[DevsDbgCmd2["ClearAllBreakpoints"] = 146] = "ClearAllBreakpoints"; + DevsDbgCmd2[DevsDbgCmd2["Resume"] = 147] = "Resume"; + DevsDbgCmd2[DevsDbgCmd2["Halt"] = 148] = "Halt"; + DevsDbgCmd2[DevsDbgCmd2["RestartAndHalt"] = 149] = "RestartAndHalt"; + DevsDbgCmd2[DevsDbgCmd2["Step"] = 150] = "Step"; + return DevsDbgCmd2; + })(DevsDbgCmd || {}); + var DevsDbgCmdPack; + ((DevsDbgCmdPack22) => { + DevsDbgCmdPack22.ReadFibers = "b[12]"; + DevsDbgCmdPack22.ReadStack = "b[12] u32"; + DevsDbgCmdPack22.ReadIndexedValues = "b[12] u32 u8 u8 u16 u16"; + DevsDbgCmdPack22.ReadNamedValues = "b[12] u32 u8"; + DevsDbgCmdPack22.ReadValue = "u32 u8"; + DevsDbgCmdPack22.ReadValueReport = "u32 u32 u16 u8"; + DevsDbgCmdPack22.ReadBytes = "b[12] u32 u8 u8 u16 u16"; + DevsDbgCmdPack22.SetBreakpoints = "r: u32"; + DevsDbgCmdPack22.ClearBreakpoints = "r: u32"; + DevsDbgCmdPack22.Step = "u32 u16 u16 r: u32"; + })(DevsDbgCmdPack || (DevsDbgCmdPack = {})); + var DevsDbgPipe = /* @__PURE__ */ ((DevsDbgPipe2) => { + })(DevsDbgPipe || {}); + var DevsDbgPipePack; + ((DevsDbgPipePack22) => { + DevsDbgPipePack22.Fiber = "u32 u16 u16"; + DevsDbgPipePack22.Stackframe = "u32 u32 u32 u16 u16"; + DevsDbgPipePack22.Value = "u32 u32 u16 u8"; + DevsDbgPipePack22.KeyValue = "u32 u32 u32 u16 u8"; + DevsDbgPipePack22.BytesValue = "b"; + })(DevsDbgPipePack || (DevsDbgPipePack = {})); + var DevsDbgReg = /* @__PURE__ */ ((DevsDbgReg2) => { + DevsDbgReg2[DevsDbgReg2["Enabled"] = 1] = "Enabled"; + DevsDbgReg2[DevsDbgReg2["BreakAtUnhandledExn"] = 128] = "BreakAtUnhandledExn"; + DevsDbgReg2[DevsDbgReg2["BreakAtHandledExn"] = 129] = "BreakAtHandledExn"; + DevsDbgReg2[DevsDbgReg2["IsSuspended"] = 384] = "IsSuspended"; + return DevsDbgReg2; + })(DevsDbgReg || {}); + var DevsDbgRegPack; + ((DevsDbgRegPack22) => { + DevsDbgRegPack22.Enabled = "u8"; + DevsDbgRegPack22.BreakAtUnhandledExn = "u8"; + DevsDbgRegPack22.BreakAtHandledExn = "u8"; + DevsDbgRegPack22.IsSuspended = "u8"; + })(DevsDbgRegPack || (DevsDbgRegPack = {})); + var DevsDbgEvent = /* @__PURE__ */ ((DevsDbgEvent2) => { + DevsDbgEvent2[DevsDbgEvent2["Suspended"] = 128] = "Suspended"; + return DevsDbgEvent2; + })(DevsDbgEvent || {}); + var DevsDbgEventPack; + ((DevsDbgEventPack22) => { + DevsDbgEventPack22.Suspended = "u32 u8"; + })(DevsDbgEventPack || (DevsDbgEventPack = {})); + var SRV_DEVICE_SCRIPT_MANAGER = 288680491; + var DeviceScriptManagerCmd = /* @__PURE__ */ ((DeviceScriptManagerCmd2) => { + DeviceScriptManagerCmd2[DeviceScriptManagerCmd2["DeployBytecode"] = 128] = "DeployBytecode"; + DeviceScriptManagerCmd2[DeviceScriptManagerCmd2["ReadBytecode"] = 129] = "ReadBytecode"; + return DeviceScriptManagerCmd2; + })(DeviceScriptManagerCmd || {}); + var DeviceScriptManagerCmdPack; + ((DeviceScriptManagerCmdPack22) => { + DeviceScriptManagerCmdPack22.DeployBytecode = "u32"; + DeviceScriptManagerCmdPack22.DeployBytecodeReport = "u16"; + DeviceScriptManagerCmdPack22.ReadBytecode = "b[12]"; + })(DeviceScriptManagerCmdPack || (DeviceScriptManagerCmdPack = {})); + var DeviceScriptManagerPipe = /* @__PURE__ */ ((DeviceScriptManagerPipe2) => { + })(DeviceScriptManagerPipe || {}); + var DeviceScriptManagerPipePack; + ((DeviceScriptManagerPipePack22) => { + DeviceScriptManagerPipePack22.Bytecode = "b"; + })(DeviceScriptManagerPipePack || (DeviceScriptManagerPipePack = {})); + var DeviceScriptManagerReg = /* @__PURE__ */ ((DeviceScriptManagerReg2) => { + DeviceScriptManagerReg2[DeviceScriptManagerReg2["Running"] = 128] = "Running"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["Autostart"] = 129] = "Autostart"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["ProgramSize"] = 384] = "ProgramSize"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["ProgramHash"] = 385] = "ProgramHash"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["ProgramSha256"] = 386] = "ProgramSha256"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["RuntimeVersion"] = 387] = "RuntimeVersion"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["ProgramName"] = 388] = "ProgramName"; + DeviceScriptManagerReg2[DeviceScriptManagerReg2["ProgramVersion"] = 389] = "ProgramVersion"; + return DeviceScriptManagerReg2; + })(DeviceScriptManagerReg || {}); + var DeviceScriptManagerRegPack; + ((DeviceScriptManagerRegPack22) => { + DeviceScriptManagerRegPack22.Running = "u8"; + DeviceScriptManagerRegPack22.Autostart = "u8"; + DeviceScriptManagerRegPack22.ProgramSize = "u32"; + DeviceScriptManagerRegPack22.ProgramHash = "u32"; + DeviceScriptManagerRegPack22.ProgramSha256 = "b[32]"; + DeviceScriptManagerRegPack22.RuntimeVersion = "u16 u8 u8"; + DeviceScriptManagerRegPack22.ProgramName = "s"; + DeviceScriptManagerRegPack22.ProgramVersion = "s"; + })(DeviceScriptManagerRegPack || (DeviceScriptManagerRegPack = {})); + var DeviceScriptManagerEvent = /* @__PURE__ */ ((DeviceScriptManagerEvent2) => { + DeviceScriptManagerEvent2[DeviceScriptManagerEvent2["ProgramPanic"] = 128] = "ProgramPanic"; + DeviceScriptManagerEvent2[DeviceScriptManagerEvent2["ProgramChange"] = 3] = "ProgramChange"; + return DeviceScriptManagerEvent2; + })(DeviceScriptManagerEvent || {}); + var DeviceScriptManagerEventPack; + ((DeviceScriptManagerEventPack22) => { + DeviceScriptManagerEventPack22.ProgramPanic = "u32 u32"; + })(DeviceScriptManagerEventPack || (DeviceScriptManagerEventPack = {})); + var SRV_DISTANCE = 337275786; + var DistanceVariant = /* @__PURE__ */ ((DistanceVariant2) => { + DistanceVariant2[DistanceVariant2["Ultrasonic"] = 1] = "Ultrasonic"; + DistanceVariant2[DistanceVariant2["Infrared"] = 2] = "Infrared"; + DistanceVariant2[DistanceVariant2["LiDAR"] = 3] = "LiDAR"; + DistanceVariant2[DistanceVariant2["Laser"] = 4] = "Laser"; + return DistanceVariant2; + })(DistanceVariant || {}); + var DistanceReg = /* @__PURE__ */ ((DistanceReg2) => { + DistanceReg2[DistanceReg2["Distance"] = 257] = "Distance"; + DistanceReg2[DistanceReg2["DistanceError"] = 262] = "DistanceError"; + DistanceReg2[DistanceReg2["MinRange"] = 260] = "MinRange"; + DistanceReg2[DistanceReg2["MaxRange"] = 261] = "MaxRange"; + DistanceReg2[DistanceReg2["Variant"] = 263] = "Variant"; + return DistanceReg2; + })(DistanceReg || {}); + var DistanceRegPack; + ((DistanceRegPack22) => { + DistanceRegPack22.Distance = "u16.16"; + DistanceRegPack22.DistanceError = "u16.16"; + DistanceRegPack22.MinRange = "u16.16"; + DistanceRegPack22.MaxRange = "u16.16"; + DistanceRegPack22.Variant = "u8"; + })(DistanceRegPack || (DistanceRegPack = {})); + var SRV_DMX = 298814469; + var DmxReg = /* @__PURE__ */ ((DmxReg2) => { + DmxReg2[DmxReg2["Enabled"] = 1] = "Enabled"; + return DmxReg2; + })(DmxReg || {}); + var DmxRegPack; + ((DmxRegPack22) => { + DmxRegPack22.Enabled = "u8"; + })(DmxRegPack || (DmxRegPack = {})); + var DmxCmd = /* @__PURE__ */ ((DmxCmd2) => { + DmxCmd2[DmxCmd2["Send"] = 128] = "Send"; + return DmxCmd2; + })(DmxCmd || {}); + var DmxCmdPack; + ((DmxCmdPack22) => { + DmxCmdPack22.Send = "b"; + })(DmxCmdPack || (DmxCmdPack = {})); + var SRV_DOT_MATRIX = 286070091; + var DotMatrixVariant = /* @__PURE__ */ ((DotMatrixVariant2) => { + DotMatrixVariant2[DotMatrixVariant2["LED"] = 1] = "LED"; + DotMatrixVariant2[DotMatrixVariant2["Braille"] = 2] = "Braille"; + return DotMatrixVariant2; + })(DotMatrixVariant || {}); + var DotMatrixReg = /* @__PURE__ */ ((DotMatrixReg2) => { + DotMatrixReg2[DotMatrixReg2["Dots"] = 2] = "Dots"; + DotMatrixReg2[DotMatrixReg2["Brightness"] = 1] = "Brightness"; + DotMatrixReg2[DotMatrixReg2["Rows"] = 385] = "Rows"; + DotMatrixReg2[DotMatrixReg2["Columns"] = 386] = "Columns"; + DotMatrixReg2[DotMatrixReg2["Variant"] = 263] = "Variant"; + return DotMatrixReg2; + })(DotMatrixReg || {}); + var DotMatrixRegPack; + ((DotMatrixRegPack22) => { + DotMatrixRegPack22.Dots = "b"; + DotMatrixRegPack22.Brightness = "u0.8"; + DotMatrixRegPack22.Rows = "u16"; + DotMatrixRegPack22.Columns = "u16"; + DotMatrixRegPack22.Variant = "u8"; + })(DotMatrixRegPack || (DotMatrixRegPack = {})); + var SRV_DUAL_MOTORS = 355063095; + var DualMotorsReg = /* @__PURE__ */ ((DualMotorsReg2) => { + DualMotorsReg2[DualMotorsReg2["Speed"] = 2] = "Speed"; + DualMotorsReg2[DualMotorsReg2["Enabled"] = 1] = "Enabled"; + DualMotorsReg2[DualMotorsReg2["LoadTorque"] = 384] = "LoadTorque"; + DualMotorsReg2[DualMotorsReg2["LoadRotationSpeed"] = 385] = "LoadRotationSpeed"; + DualMotorsReg2[DualMotorsReg2["Reversible"] = 386] = "Reversible"; + return DualMotorsReg2; + })(DualMotorsReg || {}); + var DualMotorsRegPack; + ((DualMotorsRegPack22) => { + DualMotorsRegPack22.Speed = "i1.15 i1.15"; + DualMotorsRegPack22.Enabled = "u8"; + DualMotorsRegPack22.LoadTorque = "u16.16"; + DualMotorsRegPack22.LoadRotationSpeed = "u16.16"; + DualMotorsRegPack22.Reversible = "u8"; + })(DualMotorsRegPack || (DualMotorsRegPack = {})); + var SRV_E_CO2 = 379362758; + var ECO2Variant = /* @__PURE__ */ ((ECO2Variant2) => { + ECO2Variant2[ECO2Variant2["VOC"] = 1] = "VOC"; + ECO2Variant2[ECO2Variant2["NDIR"] = 2] = "NDIR"; + return ECO2Variant2; + })(ECO2Variant || {}); + var ECO2Reg = /* @__PURE__ */ ((ECO2Reg2) => { + ECO2Reg2[ECO2Reg2["ECO2"] = 257] = "ECO2"; + ECO2Reg2[ECO2Reg2["ECO2Error"] = 262] = "ECO2Error"; + ECO2Reg2[ECO2Reg2["MinECO2"] = 260] = "MinECO2"; + ECO2Reg2[ECO2Reg2["MaxECO2"] = 261] = "MaxECO2"; + ECO2Reg2[ECO2Reg2["Variant"] = 263] = "Variant"; + return ECO2Reg2; + })(ECO2Reg || {}); + var ECO2RegPack; + ((ECO2RegPack22) => { + ECO2RegPack22.ECO2 = "u22.10"; + ECO2RegPack22.ECO2Error = "u22.10"; + ECO2RegPack22.MinECO2 = "u22.10"; + ECO2RegPack22.MaxECO2 = "u22.10"; + ECO2RegPack22.Variant = "u8"; + })(ECO2RegPack || (ECO2RegPack = {})); + var SRV_FLEX = 524797638; + var FlexReg = /* @__PURE__ */ ((FlexReg2) => { + FlexReg2[FlexReg2["Bending"] = 257] = "Bending"; + FlexReg2[FlexReg2["Length"] = 384] = "Length"; + return FlexReg2; + })(FlexReg || {}); + var FlexRegPack; + ((FlexRegPack22) => { + FlexRegPack22.Bending = "i1.15"; + FlexRegPack22.Length = "u16"; + })(FlexRegPack || (FlexRegPack = {})); + var SRV_GAMEPAD = 277836886; + var GamepadButtons = /* @__PURE__ */ ((GamepadButtons2) => { + GamepadButtons2[GamepadButtons2["Left"] = 1] = "Left"; + GamepadButtons2[GamepadButtons2["Up"] = 2] = "Up"; + GamepadButtons2[GamepadButtons2["Right"] = 4] = "Right"; + GamepadButtons2[GamepadButtons2["Down"] = 8] = "Down"; + GamepadButtons2[GamepadButtons2["A"] = 16] = "A"; + GamepadButtons2[GamepadButtons2["B"] = 32] = "B"; + GamepadButtons2[GamepadButtons2["Menu"] = 64] = "Menu"; + GamepadButtons2[GamepadButtons2["Select"] = 128] = "Select"; + GamepadButtons2[GamepadButtons2["Reset"] = 256] = "Reset"; + GamepadButtons2[GamepadButtons2["Exit"] = 512] = "Exit"; + GamepadButtons2[GamepadButtons2["X"] = 1024] = "X"; + GamepadButtons2[GamepadButtons2["Y"] = 2048] = "Y"; + return GamepadButtons2; + })(GamepadButtons || {}); + var GamepadVariant = /* @__PURE__ */ ((GamepadVariant2) => { + GamepadVariant2[GamepadVariant2["Thumb"] = 1] = "Thumb"; + GamepadVariant2[GamepadVariant2["ArcadeBall"] = 2] = "ArcadeBall"; + GamepadVariant2[GamepadVariant2["ArcadeStick"] = 3] = "ArcadeStick"; + GamepadVariant2[GamepadVariant2["Gamepad"] = 4] = "Gamepad"; + return GamepadVariant2; + })(GamepadVariant || {}); + var GamepadReg = /* @__PURE__ */ ((GamepadReg2) => { + GamepadReg2[GamepadReg2["Direction"] = 257] = "Direction"; + GamepadReg2[GamepadReg2["Variant"] = 263] = "Variant"; + GamepadReg2[GamepadReg2["ButtonsAvailable"] = 384] = "ButtonsAvailable"; + return GamepadReg2; + })(GamepadReg || {}); + var GamepadRegPack; + ((GamepadRegPack22) => { + GamepadRegPack22.Direction = "u32 i1.15 i1.15"; + GamepadRegPack22.Variant = "u8"; + GamepadRegPack22.ButtonsAvailable = "u32"; + })(GamepadRegPack || (GamepadRegPack = {})); + var GamepadEvent = /* @__PURE__ */ ((GamepadEvent2) => { + GamepadEvent2[GamepadEvent2["ButtonsChanged"] = 3] = "ButtonsChanged"; + return GamepadEvent2; + })(GamepadEvent || {}); + var GamepadEventPack; + ((GamepadEventPack22) => { + GamepadEventPack22.ButtonsChanged = "u32"; + })(GamepadEventPack || (GamepadEventPack = {})); + var SRV_GPIO = 282614377; + var GPIOMode = /* @__PURE__ */ ((GPIOMode2) => { + GPIOMode2[GPIOMode2["Off"] = 0] = "Off"; + GPIOMode2[GPIOMode2["OffPullUp"] = 16] = "OffPullUp"; + GPIOMode2[GPIOMode2["OffPullDown"] = 32] = "OffPullDown"; + GPIOMode2[GPIOMode2["Input"] = 1] = "Input"; + GPIOMode2[GPIOMode2["InputPullUp"] = 17] = "InputPullUp"; + GPIOMode2[GPIOMode2["InputPullDown"] = 33] = "InputPullDown"; + GPIOMode2[GPIOMode2["Output"] = 2] = "Output"; + GPIOMode2[GPIOMode2["OutputHigh"] = 18] = "OutputHigh"; + GPIOMode2[GPIOMode2["OutputLow"] = 34] = "OutputLow"; + GPIOMode2[GPIOMode2["AnalogIn"] = 3] = "AnalogIn"; + GPIOMode2[GPIOMode2["Alternative"] = 4] = "Alternative"; + GPIOMode2[GPIOMode2["BaseModeMask"] = 15] = "BaseModeMask"; + return GPIOMode2; + })(GPIOMode || {}); + var GPIOCapabilities = /* @__PURE__ */ ((GPIOCapabilities2) => { + GPIOCapabilities2[GPIOCapabilities2["PullUp"] = 1] = "PullUp"; + GPIOCapabilities2[GPIOCapabilities2["PullDown"] = 2] = "PullDown"; + GPIOCapabilities2[GPIOCapabilities2["Input"] = 4] = "Input"; + GPIOCapabilities2[GPIOCapabilities2["Output"] = 8] = "Output"; + GPIOCapabilities2[GPIOCapabilities2["Analog"] = 16] = "Analog"; + return GPIOCapabilities2; + })(GPIOCapabilities || {}); + var GPIOReg = /* @__PURE__ */ ((GPIOReg2) => { + GPIOReg2[GPIOReg2["State"] = 257] = "State"; + GPIOReg2[GPIOReg2["NumPins"] = 384] = "NumPins"; + return GPIOReg2; + })(GPIOReg || {}); + var GPIORegPack; + ((GPIORegPack22) => { + GPIORegPack22.State = "b"; + GPIORegPack22.NumPins = "u8"; + })(GPIORegPack || (GPIORegPack = {})); + var GPIOCmd = /* @__PURE__ */ ((GPIOCmd2) => { + GPIOCmd2[GPIOCmd2["Configure"] = 128] = "Configure"; + GPIOCmd2[GPIOCmd2["PinInfo"] = 129] = "PinInfo"; + GPIOCmd2[GPIOCmd2["PinByLabel"] = 131] = "PinByLabel"; + GPIOCmd2[GPIOCmd2["PinByHwPin"] = 132] = "PinByHwPin"; + return GPIOCmd2; + })(GPIOCmd || {}); + var GPIOCmdPack; + ((GPIOCmdPack22) => { + GPIOCmdPack22.Configure = "r: u8 u8"; + GPIOCmdPack22.PinInfo = "u8"; + GPIOCmdPack22.PinInfoReport = "u8 u8 u16 u8 s"; + GPIOCmdPack22.PinByLabel = "s"; + GPIOCmdPack22.PinByLabelReport = "u8 u8 u16 u8 s"; + GPIOCmdPack22.PinByHwPin = "u8"; + GPIOCmdPack22.PinByHwPinReport = "u8 u8 u16 u8 s"; + })(GPIOCmdPack || (GPIOCmdPack = {})); + var SRV_GYROSCOPE = 505087730; + var GyroscopeReg = /* @__PURE__ */ ((GyroscopeReg2) => { + GyroscopeReg2[GyroscopeReg2["RotationRates"] = 257] = "RotationRates"; + GyroscopeReg2[GyroscopeReg2["RotationRatesError"] = 262] = "RotationRatesError"; + GyroscopeReg2[GyroscopeReg2["MaxRate"] = 8] = "MaxRate"; + GyroscopeReg2[GyroscopeReg2["MaxRatesSupported"] = 266] = "MaxRatesSupported"; + return GyroscopeReg2; + })(GyroscopeReg || {}); + var GyroscopeRegPack; + ((GyroscopeRegPack22) => { + GyroscopeRegPack22.RotationRates = "i12.20 i12.20 i12.20"; + GyroscopeRegPack22.RotationRatesError = "u12.20"; + GyroscopeRegPack22.MaxRate = "u12.20"; + GyroscopeRegPack22.MaxRatesSupported = "r: u12.20"; + })(GyroscopeRegPack || (GyroscopeRegPack = {})); + var SRV_HEART_RATE = 376204740; + var HeartRateVariant = /* @__PURE__ */ ((HeartRateVariant2) => { + HeartRateVariant2[HeartRateVariant2["Finger"] = 1] = "Finger"; + HeartRateVariant2[HeartRateVariant2["Chest"] = 2] = "Chest"; + HeartRateVariant2[HeartRateVariant2["Wrist"] = 3] = "Wrist"; + HeartRateVariant2[HeartRateVariant2["Pump"] = 4] = "Pump"; + HeartRateVariant2[HeartRateVariant2["WebCam"] = 5] = "WebCam"; + return HeartRateVariant2; + })(HeartRateVariant || {}); + var HeartRateReg = /* @__PURE__ */ ((HeartRateReg2) => { + HeartRateReg2[HeartRateReg2["HeartRate"] = 257] = "HeartRate"; + HeartRateReg2[HeartRateReg2["HeartRateError"] = 262] = "HeartRateError"; + HeartRateReg2[HeartRateReg2["Variant"] = 263] = "Variant"; + return HeartRateReg2; + })(HeartRateReg || {}); + var HeartRateRegPack; + ((HeartRateRegPack22) => { + HeartRateRegPack22.HeartRate = "u16.16"; + HeartRateRegPack22.HeartRateError = "u16.16"; + HeartRateRegPack22.Variant = "u8"; + })(HeartRateRegPack || (HeartRateRegPack = {})); + var SRV_HID_JOYSTICK = 437330261; + var HidJoystickReg = /* @__PURE__ */ ((HidJoystickReg2) => { + HidJoystickReg2[HidJoystickReg2["ButtonCount"] = 384] = "ButtonCount"; + HidJoystickReg2[HidJoystickReg2["ButtonsAnalog"] = 385] = "ButtonsAnalog"; + HidJoystickReg2[HidJoystickReg2["AxisCount"] = 386] = "AxisCount"; + return HidJoystickReg2; + })(HidJoystickReg || {}); + var HidJoystickRegPack; + ((HidJoystickRegPack22) => { + HidJoystickRegPack22.ButtonCount = "u8"; + HidJoystickRegPack22.ButtonsAnalog = "u32"; + HidJoystickRegPack22.AxisCount = "u8"; + })(HidJoystickRegPack || (HidJoystickRegPack = {})); + var HidJoystickCmd = /* @__PURE__ */ ((HidJoystickCmd2) => { + HidJoystickCmd2[HidJoystickCmd2["SetButtons"] = 128] = "SetButtons"; + HidJoystickCmd2[HidJoystickCmd2["SetAxis"] = 129] = "SetAxis"; + return HidJoystickCmd2; + })(HidJoystickCmd || {}); + var HidJoystickCmdPack; + ((HidJoystickCmdPack22) => { + HidJoystickCmdPack22.SetButtons = "r: u0.8"; + HidJoystickCmdPack22.SetAxis = "r: i1.15"; + })(HidJoystickCmdPack || (HidJoystickCmdPack = {})); + var SRV_HID_KEYBOARD = 414210922; + var HidKeyboardSelector = /* @__PURE__ */ ((HidKeyboardSelector2) => { + HidKeyboardSelector2[HidKeyboardSelector2["None"] = 0] = "None"; + HidKeyboardSelector2[HidKeyboardSelector2["ErrorRollOver"] = 1] = "ErrorRollOver"; + HidKeyboardSelector2[HidKeyboardSelector2["PostFail"] = 2] = "PostFail"; + HidKeyboardSelector2[HidKeyboardSelector2["ErrorUndefined"] = 3] = "ErrorUndefined"; + HidKeyboardSelector2[HidKeyboardSelector2["A"] = 4] = "A"; + HidKeyboardSelector2[HidKeyboardSelector2["B"] = 5] = "B"; + HidKeyboardSelector2[HidKeyboardSelector2["C"] = 6] = "C"; + HidKeyboardSelector2[HidKeyboardSelector2["D"] = 7] = "D"; + HidKeyboardSelector2[HidKeyboardSelector2["E"] = 8] = "E"; + HidKeyboardSelector2[HidKeyboardSelector2["F"] = 9] = "F"; + HidKeyboardSelector2[HidKeyboardSelector2["G"] = 10] = "G"; + HidKeyboardSelector2[HidKeyboardSelector2["H"] = 11] = "H"; + HidKeyboardSelector2[HidKeyboardSelector2["I"] = 12] = "I"; + HidKeyboardSelector2[HidKeyboardSelector2["J"] = 13] = "J"; + HidKeyboardSelector2[HidKeyboardSelector2["K"] = 14] = "K"; + HidKeyboardSelector2[HidKeyboardSelector2["L"] = 15] = "L"; + HidKeyboardSelector2[HidKeyboardSelector2["M"] = 16] = "M"; + HidKeyboardSelector2[HidKeyboardSelector2["N"] = 17] = "N"; + HidKeyboardSelector2[HidKeyboardSelector2["O"] = 18] = "O"; + HidKeyboardSelector2[HidKeyboardSelector2["P"] = 19] = "P"; + HidKeyboardSelector2[HidKeyboardSelector2["Q"] = 20] = "Q"; + HidKeyboardSelector2[HidKeyboardSelector2["R"] = 21] = "R"; + HidKeyboardSelector2[HidKeyboardSelector2["S"] = 22] = "S"; + HidKeyboardSelector2[HidKeyboardSelector2["T"] = 23] = "T"; + HidKeyboardSelector2[HidKeyboardSelector2["U"] = 24] = "U"; + HidKeyboardSelector2[HidKeyboardSelector2["V"] = 25] = "V"; + HidKeyboardSelector2[HidKeyboardSelector2["W"] = 26] = "W"; + HidKeyboardSelector2[HidKeyboardSelector2["X"] = 27] = "X"; + HidKeyboardSelector2[HidKeyboardSelector2["Y"] = 28] = "Y"; + HidKeyboardSelector2[HidKeyboardSelector2["Z"] = 29] = "Z"; + HidKeyboardSelector2[HidKeyboardSelector2["_1"] = 30] = "_1"; + HidKeyboardSelector2[HidKeyboardSelector2["_2"] = 31] = "_2"; + HidKeyboardSelector2[HidKeyboardSelector2["_3"] = 32] = "_3"; + HidKeyboardSelector2[HidKeyboardSelector2["_4"] = 33] = "_4"; + HidKeyboardSelector2[HidKeyboardSelector2["_5"] = 34] = "_5"; + HidKeyboardSelector2[HidKeyboardSelector2["_6"] = 35] = "_6"; + HidKeyboardSelector2[HidKeyboardSelector2["_7"] = 36] = "_7"; + HidKeyboardSelector2[HidKeyboardSelector2["_8"] = 37] = "_8"; + HidKeyboardSelector2[HidKeyboardSelector2["_9"] = 38] = "_9"; + HidKeyboardSelector2[HidKeyboardSelector2["_0"] = 39] = "_0"; + HidKeyboardSelector2[HidKeyboardSelector2["Return"] = 40] = "Return"; + HidKeyboardSelector2[HidKeyboardSelector2["Escape"] = 41] = "Escape"; + HidKeyboardSelector2[HidKeyboardSelector2["Backspace"] = 42] = "Backspace"; + HidKeyboardSelector2[HidKeyboardSelector2["Tab"] = 43] = "Tab"; + HidKeyboardSelector2[HidKeyboardSelector2["Spacebar"] = 44] = "Spacebar"; + HidKeyboardSelector2[HidKeyboardSelector2["Minus"] = 45] = "Minus"; + HidKeyboardSelector2[HidKeyboardSelector2["Equals"] = 46] = "Equals"; + HidKeyboardSelector2[HidKeyboardSelector2["LeftSquareBracket"] = 47] = "LeftSquareBracket"; + HidKeyboardSelector2[HidKeyboardSelector2["RightSquareBracket"] = 48] = "RightSquareBracket"; + HidKeyboardSelector2[HidKeyboardSelector2["Backslash"] = 49] = "Backslash"; + HidKeyboardSelector2[HidKeyboardSelector2["NonUsHash"] = 50] = "NonUsHash"; + HidKeyboardSelector2[HidKeyboardSelector2["Semicolon"] = 51] = "Semicolon"; + HidKeyboardSelector2[HidKeyboardSelector2["Quote"] = 52] = "Quote"; + HidKeyboardSelector2[HidKeyboardSelector2["GraveAccent"] = 53] = "GraveAccent"; + HidKeyboardSelector2[HidKeyboardSelector2["Comma"] = 54] = "Comma"; + HidKeyboardSelector2[HidKeyboardSelector2["Period"] = 55] = "Period"; + HidKeyboardSelector2[HidKeyboardSelector2["Slash"] = 56] = "Slash"; + HidKeyboardSelector2[HidKeyboardSelector2["CapsLock"] = 57] = "CapsLock"; + HidKeyboardSelector2[HidKeyboardSelector2["F1"] = 58] = "F1"; + HidKeyboardSelector2[HidKeyboardSelector2["F2"] = 59] = "F2"; + HidKeyboardSelector2[HidKeyboardSelector2["F3"] = 60] = "F3"; + HidKeyboardSelector2[HidKeyboardSelector2["F4"] = 61] = "F4"; + HidKeyboardSelector2[HidKeyboardSelector2["F5"] = 62] = "F5"; + HidKeyboardSelector2[HidKeyboardSelector2["F6"] = 63] = "F6"; + HidKeyboardSelector2[HidKeyboardSelector2["F7"] = 64] = "F7"; + HidKeyboardSelector2[HidKeyboardSelector2["F8"] = 65] = "F8"; + HidKeyboardSelector2[HidKeyboardSelector2["F9"] = 66] = "F9"; + HidKeyboardSelector2[HidKeyboardSelector2["F10"] = 67] = "F10"; + HidKeyboardSelector2[HidKeyboardSelector2["F11"] = 68] = "F11"; + HidKeyboardSelector2[HidKeyboardSelector2["F12"] = 69] = "F12"; + HidKeyboardSelector2[HidKeyboardSelector2["PrintScreen"] = 70] = "PrintScreen"; + HidKeyboardSelector2[HidKeyboardSelector2["ScrollLock"] = 71] = "ScrollLock"; + HidKeyboardSelector2[HidKeyboardSelector2["Pause"] = 72] = "Pause"; + HidKeyboardSelector2[HidKeyboardSelector2["Insert"] = 73] = "Insert"; + HidKeyboardSelector2[HidKeyboardSelector2["Home"] = 74] = "Home"; + HidKeyboardSelector2[HidKeyboardSelector2["PageUp"] = 75] = "PageUp"; + HidKeyboardSelector2[HidKeyboardSelector2["Delete"] = 76] = "Delete"; + HidKeyboardSelector2[HidKeyboardSelector2["End"] = 77] = "End"; + HidKeyboardSelector2[HidKeyboardSelector2["PageDown"] = 78] = "PageDown"; + HidKeyboardSelector2[HidKeyboardSelector2["RightArrow"] = 79] = "RightArrow"; + HidKeyboardSelector2[HidKeyboardSelector2["LeftArrow"] = 80] = "LeftArrow"; + HidKeyboardSelector2[HidKeyboardSelector2["DownArrow"] = 81] = "DownArrow"; + HidKeyboardSelector2[HidKeyboardSelector2["UpArrow"] = 82] = "UpArrow"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadNumLock"] = 83] = "KeypadNumLock"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadDivide"] = 84] = "KeypadDivide"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadMultiply"] = 85] = "KeypadMultiply"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadAdd"] = 86] = "KeypadAdd"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadSubtrace"] = 87] = "KeypadSubtrace"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadReturn"] = 88] = "KeypadReturn"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad1"] = 89] = "Keypad1"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad2"] = 90] = "Keypad2"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad3"] = 91] = "Keypad3"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad4"] = 92] = "Keypad4"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad5"] = 93] = "Keypad5"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad6"] = 94] = "Keypad6"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad7"] = 95] = "Keypad7"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad8"] = 96] = "Keypad8"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad9"] = 97] = "Keypad9"; + HidKeyboardSelector2[HidKeyboardSelector2["Keypad0"] = 98] = "Keypad0"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadDecimalPoint"] = 99] = "KeypadDecimalPoint"; + HidKeyboardSelector2[HidKeyboardSelector2["NonUsBackslash"] = 100] = "NonUsBackslash"; + HidKeyboardSelector2[HidKeyboardSelector2["Application"] = 101] = "Application"; + HidKeyboardSelector2[HidKeyboardSelector2["Power"] = 102] = "Power"; + HidKeyboardSelector2[HidKeyboardSelector2["KeypadEquals"] = 103] = "KeypadEquals"; + HidKeyboardSelector2[HidKeyboardSelector2["F13"] = 104] = "F13"; + HidKeyboardSelector2[HidKeyboardSelector2["F14"] = 105] = "F14"; + HidKeyboardSelector2[HidKeyboardSelector2["F15"] = 106] = "F15"; + HidKeyboardSelector2[HidKeyboardSelector2["F16"] = 107] = "F16"; + HidKeyboardSelector2[HidKeyboardSelector2["F17"] = 108] = "F17"; + HidKeyboardSelector2[HidKeyboardSelector2["F18"] = 109] = "F18"; + HidKeyboardSelector2[HidKeyboardSelector2["F19"] = 110] = "F19"; + HidKeyboardSelector2[HidKeyboardSelector2["F20"] = 111] = "F20"; + HidKeyboardSelector2[HidKeyboardSelector2["F21"] = 112] = "F21"; + HidKeyboardSelector2[HidKeyboardSelector2["F22"] = 113] = "F22"; + HidKeyboardSelector2[HidKeyboardSelector2["F23"] = 114] = "F23"; + HidKeyboardSelector2[HidKeyboardSelector2["F24"] = 115] = "F24"; + HidKeyboardSelector2[HidKeyboardSelector2["Execute"] = 116] = "Execute"; + HidKeyboardSelector2[HidKeyboardSelector2["Help"] = 117] = "Help"; + HidKeyboardSelector2[HidKeyboardSelector2["Menu"] = 118] = "Menu"; + HidKeyboardSelector2[HidKeyboardSelector2["Select"] = 119] = "Select"; + HidKeyboardSelector2[HidKeyboardSelector2["Stop"] = 120] = "Stop"; + HidKeyboardSelector2[HidKeyboardSelector2["Again"] = 121] = "Again"; + HidKeyboardSelector2[HidKeyboardSelector2["Undo"] = 122] = "Undo"; + HidKeyboardSelector2[HidKeyboardSelector2["Cut"] = 123] = "Cut"; + HidKeyboardSelector2[HidKeyboardSelector2["Copy"] = 124] = "Copy"; + HidKeyboardSelector2[HidKeyboardSelector2["Paste"] = 125] = "Paste"; + HidKeyboardSelector2[HidKeyboardSelector2["Find"] = 126] = "Find"; + HidKeyboardSelector2[HidKeyboardSelector2["Mute"] = 127] = "Mute"; + HidKeyboardSelector2[HidKeyboardSelector2["VolumeUp"] = 128] = "VolumeUp"; + HidKeyboardSelector2[HidKeyboardSelector2["VolumeDown"] = 129] = "VolumeDown"; + return HidKeyboardSelector2; + })(HidKeyboardSelector || {}); + var HidKeyboardModifiers = /* @__PURE__ */ ((HidKeyboardModifiers2) => { + HidKeyboardModifiers2[HidKeyboardModifiers2["None"] = 0] = "None"; + HidKeyboardModifiers2[HidKeyboardModifiers2["LeftControl"] = 1] = "LeftControl"; + HidKeyboardModifiers2[HidKeyboardModifiers2["LeftShift"] = 2] = "LeftShift"; + HidKeyboardModifiers2[HidKeyboardModifiers2["LeftAlt"] = 4] = "LeftAlt"; + HidKeyboardModifiers2[HidKeyboardModifiers2["LeftGUI"] = 8] = "LeftGUI"; + HidKeyboardModifiers2[HidKeyboardModifiers2["RightControl"] = 16] = "RightControl"; + HidKeyboardModifiers2[HidKeyboardModifiers2["RightShift"] = 32] = "RightShift"; + HidKeyboardModifiers2[HidKeyboardModifiers2["RightAlt"] = 64] = "RightAlt"; + HidKeyboardModifiers2[HidKeyboardModifiers2["RightGUI"] = 128] = "RightGUI"; + return HidKeyboardModifiers2; + })(HidKeyboardModifiers || {}); + var HidKeyboardAction = /* @__PURE__ */ ((HidKeyboardAction2) => { + HidKeyboardAction2[HidKeyboardAction2["Press"] = 0] = "Press"; + HidKeyboardAction2[HidKeyboardAction2["Up"] = 1] = "Up"; + HidKeyboardAction2[HidKeyboardAction2["Down"] = 2] = "Down"; + return HidKeyboardAction2; + })(HidKeyboardAction || {}); + var HidKeyboardCmd = /* @__PURE__ */ ((HidKeyboardCmd2) => { + HidKeyboardCmd2[HidKeyboardCmd2["Key"] = 128] = "Key"; + HidKeyboardCmd2[HidKeyboardCmd2["Clear"] = 129] = "Clear"; + return HidKeyboardCmd2; + })(HidKeyboardCmd || {}); + var HidKeyboardCmdPack; + ((HidKeyboardCmdPack22) => { + HidKeyboardCmdPack22.Key = "r: u16 u8 u8"; + })(HidKeyboardCmdPack || (HidKeyboardCmdPack = {})); + var SRV_HID_MOUSE = 411425820; + var HidMouseButton = /* @__PURE__ */ ((HidMouseButton2) => { + HidMouseButton2[HidMouseButton2["Left"] = 1] = "Left"; + HidMouseButton2[HidMouseButton2["Right"] = 2] = "Right"; + HidMouseButton2[HidMouseButton2["Middle"] = 4] = "Middle"; + return HidMouseButton2; + })(HidMouseButton || {}); + var HidMouseButtonEvent = /* @__PURE__ */ ((HidMouseButtonEvent2) => { + HidMouseButtonEvent2[HidMouseButtonEvent2["Up"] = 1] = "Up"; + HidMouseButtonEvent2[HidMouseButtonEvent2["Down"] = 2] = "Down"; + HidMouseButtonEvent2[HidMouseButtonEvent2["Click"] = 3] = "Click"; + HidMouseButtonEvent2[HidMouseButtonEvent2["DoubleClick"] = 4] = "DoubleClick"; + return HidMouseButtonEvent2; + })(HidMouseButtonEvent || {}); + var HidMouseCmd = /* @__PURE__ */ ((HidMouseCmd2) => { + HidMouseCmd2[HidMouseCmd2["SetButton"] = 128] = "SetButton"; + HidMouseCmd2[HidMouseCmd2["Move"] = 129] = "Move"; + HidMouseCmd2[HidMouseCmd2["Wheel"] = 130] = "Wheel"; + return HidMouseCmd2; + })(HidMouseCmd || {}); + var HidMouseCmdPack; + ((HidMouseCmdPack22) => { + HidMouseCmdPack22.SetButton = "u16 u8"; + HidMouseCmdPack22.Move = "i16 i16 u16"; + HidMouseCmdPack22.Wheel = "i16 u16"; + })(HidMouseCmdPack || (HidMouseCmdPack = {})); + var SRV_HUMIDITY = 382210232; + var HumidityReg = /* @__PURE__ */ ((HumidityReg2) => { + HumidityReg2[HumidityReg2["Humidity"] = 257] = "Humidity"; + HumidityReg2[HumidityReg2["HumidityError"] = 262] = "HumidityError"; + HumidityReg2[HumidityReg2["MinHumidity"] = 260] = "MinHumidity"; + HumidityReg2[HumidityReg2["MaxHumidity"] = 261] = "MaxHumidity"; + return HumidityReg2; + })(HumidityReg || {}); + var HumidityRegPack; + ((HumidityRegPack22) => { + HumidityRegPack22.Humidity = "u22.10"; + HumidityRegPack22.HumidityError = "u22.10"; + HumidityRegPack22.MinHumidity = "u22.10"; + HumidityRegPack22.MaxHumidity = "u22.10"; + })(HumidityRegPack || (HumidityRegPack = {})); + var SRV_I2C = 471386691; + var I2CStatus = /* @__PURE__ */ ((I2CStatus2) => { + I2CStatus2[I2CStatus2["OK"] = 0] = "OK"; + I2CStatus2[I2CStatus2["NAckAddr"] = 1] = "NAckAddr"; + I2CStatus2[I2CStatus2["NAckData"] = 2] = "NAckData"; + I2CStatus2[I2CStatus2["NoI2C"] = 3] = "NoI2C"; + return I2CStatus2; + })(I2CStatus || {}); + var I2CReg = /* @__PURE__ */ ((I2CReg2) => { + I2CReg2[I2CReg2["Ok"] = 384] = "Ok"; + return I2CReg2; + })(I2CReg || {}); + var I2CRegPack; + ((I2CRegPack22) => { + I2CRegPack22.Ok = "u8"; + })(I2CRegPack || (I2CRegPack = {})); + var I2CCmd = /* @__PURE__ */ ((I2CCmd2) => { + I2CCmd2[I2CCmd2["Transaction"] = 128] = "Transaction"; + return I2CCmd2; + })(I2CCmd || {}); + var I2CCmdPack; + ((I2CCmdPack22) => { + I2CCmdPack22.Transaction = "u8 u8 b"; + I2CCmdPack22.TransactionReport = "u8 b"; + })(I2CCmdPack || (I2CCmdPack = {})); + var SRV_ILLUMINANCE = 510577394; + var IlluminanceReg = /* @__PURE__ */ ((IlluminanceReg2) => { + IlluminanceReg2[IlluminanceReg2["Illuminance"] = 257] = "Illuminance"; + IlluminanceReg2[IlluminanceReg2["IlluminanceError"] = 262] = "IlluminanceError"; + return IlluminanceReg2; + })(IlluminanceReg || {}); + var IlluminanceRegPack; + ((IlluminanceRegPack22) => { + IlluminanceRegPack22.Illuminance = "u22.10"; + IlluminanceRegPack22.IlluminanceError = "u22.10"; + })(IlluminanceRegPack || (IlluminanceRegPack = {})); + var SRV_INDEXED_SCREEN = 385496805; + var IndexedScreenCmd = /* @__PURE__ */ ((IndexedScreenCmd2) => { + IndexedScreenCmd2[IndexedScreenCmd2["StartUpdate"] = 129] = "StartUpdate"; + IndexedScreenCmd2[IndexedScreenCmd2["SetPixels"] = 131] = "SetPixels"; + return IndexedScreenCmd2; + })(IndexedScreenCmd || {}); + var IndexedScreenCmdPack; + ((IndexedScreenCmdPack22) => { + IndexedScreenCmdPack22.StartUpdate = "u16 u16 u16 u16"; + IndexedScreenCmdPack22.SetPixels = "b"; + })(IndexedScreenCmdPack || (IndexedScreenCmdPack = {})); + var IndexedScreenReg = /* @__PURE__ */ ((IndexedScreenReg2) => { + IndexedScreenReg2[IndexedScreenReg2["Brightness"] = 1] = "Brightness"; + IndexedScreenReg2[IndexedScreenReg2["Palette"] = 128] = "Palette"; + IndexedScreenReg2[IndexedScreenReg2["BitsPerPixel"] = 384] = "BitsPerPixel"; + IndexedScreenReg2[IndexedScreenReg2["Width"] = 385] = "Width"; + IndexedScreenReg2[IndexedScreenReg2["Height"] = 386] = "Height"; + IndexedScreenReg2[IndexedScreenReg2["WidthMajor"] = 129] = "WidthMajor"; + IndexedScreenReg2[IndexedScreenReg2["UpSampling"] = 130] = "UpSampling"; + IndexedScreenReg2[IndexedScreenReg2["Rotation"] = 131] = "Rotation"; + return IndexedScreenReg2; + })(IndexedScreenReg || {}); + var IndexedScreenRegPack; + ((IndexedScreenRegPack22) => { + IndexedScreenRegPack22.Brightness = "u0.8"; + IndexedScreenRegPack22.Palette = "b"; + IndexedScreenRegPack22.BitsPerPixel = "u8"; + IndexedScreenRegPack22.Width = "u16"; + IndexedScreenRegPack22.Height = "u16"; + IndexedScreenRegPack22.WidthMajor = "u8"; + IndexedScreenRegPack22.UpSampling = "u8"; + IndexedScreenRegPack22.Rotation = "u16"; + })(IndexedScreenRegPack || (IndexedScreenRegPack = {})); + var SRV_INFRASTRUCTURE = 504728043; + var SRV_LED = 369743088; + var CONST_LED_MAX_PIXELS_LENGTH = 64; + var LedVariant = /* @__PURE__ */ ((LedVariant2) => { + LedVariant2[LedVariant2["Strip"] = 1] = "Strip"; + LedVariant2[LedVariant2["Ring"] = 2] = "Ring"; + LedVariant2[LedVariant2["Stick"] = 3] = "Stick"; + LedVariant2[LedVariant2["Jewel"] = 4] = "Jewel"; + LedVariant2[LedVariant2["Matrix"] = 5] = "Matrix"; + return LedVariant2; + })(LedVariant || {}); + var LedReg = /* @__PURE__ */ ((LedReg2) => { + LedReg2[LedReg2["Pixels"] = 2] = "Pixels"; + LedReg2[LedReg2["Brightness"] = 1] = "Brightness"; + LedReg2[LedReg2["ActualBrightness"] = 384] = "ActualBrightness"; + LedReg2[LedReg2["NumPixels"] = 386] = "NumPixels"; + LedReg2[LedReg2["NumColumns"] = 387] = "NumColumns"; + LedReg2[LedReg2["MaxPower"] = 7] = "MaxPower"; + LedReg2[LedReg2["LedsPerPixel"] = 388] = "LedsPerPixel"; + LedReg2[LedReg2["WaveLength"] = 389] = "WaveLength"; + LedReg2[LedReg2["LuminousIntensity"] = 390] = "LuminousIntensity"; + LedReg2[LedReg2["Variant"] = 263] = "Variant"; + return LedReg2; + })(LedReg || {}); + var LedRegPack; + ((LedRegPack22) => { + LedRegPack22.Pixels = "b"; + LedRegPack22.Brightness = "u0.8"; + LedRegPack22.ActualBrightness = "u0.8"; + LedRegPack22.NumPixels = "u16"; + LedRegPack22.NumColumns = "u16"; + LedRegPack22.MaxPower = "u16"; + LedRegPack22.LedsPerPixel = "u16"; + LedRegPack22.WaveLength = "u16"; + LedRegPack22.LuminousIntensity = "u16"; + LedRegPack22.Variant = "u8"; + })(LedRegPack || (LedRegPack = {})); + var SRV_LED_SINGLE = 506480888; + var LedSingleVariant = /* @__PURE__ */ ((LedSingleVariant2) => { + LedSingleVariant2[LedSingleVariant2["ThroughHole"] = 1] = "ThroughHole"; + LedSingleVariant2[LedSingleVariant2["SMD"] = 2] = "SMD"; + LedSingleVariant2[LedSingleVariant2["Power"] = 3] = "Power"; + LedSingleVariant2[LedSingleVariant2["Bead"] = 4] = "Bead"; + return LedSingleVariant2; + })(LedSingleVariant || {}); + var LedSingleCmd = /* @__PURE__ */ ((LedSingleCmd2) => { + LedSingleCmd2[LedSingleCmd2["Animate"] = 128] = "Animate"; + return LedSingleCmd2; + })(LedSingleCmd || {}); + var LedSingleCmdPack; + ((LedSingleCmdPack22) => { + LedSingleCmdPack22.Animate = "u8 u8 u8 u8"; + })(LedSingleCmdPack || (LedSingleCmdPack = {})); + var LedSingleReg = /* @__PURE__ */ ((LedSingleReg2) => { + LedSingleReg2[LedSingleReg2["Color"] = 384] = "Color"; + LedSingleReg2[LedSingleReg2["MaxPower"] = 7] = "MaxPower"; + LedSingleReg2[LedSingleReg2["LedCount"] = 387] = "LedCount"; + LedSingleReg2[LedSingleReg2["WaveLength"] = 385] = "WaveLength"; + LedSingleReg2[LedSingleReg2["LuminousIntensity"] = 386] = "LuminousIntensity"; + LedSingleReg2[LedSingleReg2["Variant"] = 263] = "Variant"; + return LedSingleReg2; + })(LedSingleReg || {}); + var LedSingleRegPack; + ((LedSingleRegPack22) => { + LedSingleRegPack22.Color = "u8 u8 u8"; + LedSingleRegPack22.MaxPower = "u16"; + LedSingleRegPack22.LedCount = "u16"; + LedSingleRegPack22.WaveLength = "u16"; + LedSingleRegPack22.LuminousIntensity = "u16"; + LedSingleRegPack22.Variant = "u8"; + })(LedSingleRegPack || (LedSingleRegPack = {})); + var SRV_LED_STRIP = 309264608; + var LedStripLightType = /* @__PURE__ */ ((LedStripLightType2) => { + LedStripLightType2[LedStripLightType2["WS2812B_GRB"] = 0] = "WS2812B_GRB"; + LedStripLightType2[LedStripLightType2["APA102"] = 16] = "APA102"; + LedStripLightType2[LedStripLightType2["SK9822"] = 17] = "SK9822"; + return LedStripLightType2; + })(LedStripLightType || {}); + var LedStripVariant = /* @__PURE__ */ ((LedStripVariant2) => { + LedStripVariant2[LedStripVariant2["Strip"] = 1] = "Strip"; + LedStripVariant2[LedStripVariant2["Ring"] = 2] = "Ring"; + LedStripVariant2[LedStripVariant2["Stick"] = 3] = "Stick"; + LedStripVariant2[LedStripVariant2["Jewel"] = 4] = "Jewel"; + LedStripVariant2[LedStripVariant2["Matrix"] = 5] = "Matrix"; + return LedStripVariant2; + })(LedStripVariant || {}); + var LedStripReg = /* @__PURE__ */ ((LedStripReg2) => { + LedStripReg2[LedStripReg2["Brightness"] = 1] = "Brightness"; + LedStripReg2[LedStripReg2["ActualBrightness"] = 384] = "ActualBrightness"; + LedStripReg2[LedStripReg2["LightType"] = 128] = "LightType"; + LedStripReg2[LedStripReg2["NumPixels"] = 129] = "NumPixels"; + LedStripReg2[LedStripReg2["NumColumns"] = 131] = "NumColumns"; + LedStripReg2[LedStripReg2["MaxPower"] = 7] = "MaxPower"; + LedStripReg2[LedStripReg2["MaxPixels"] = 385] = "MaxPixels"; + LedStripReg2[LedStripReg2["NumRepeats"] = 130] = "NumRepeats"; + LedStripReg2[LedStripReg2["Variant"] = 263] = "Variant"; + return LedStripReg2; + })(LedStripReg || {}); + var LedStripRegPack; + ((LedStripRegPack22) => { + LedStripRegPack22.Brightness = "u0.8"; + LedStripRegPack22.ActualBrightness = "u0.8"; + LedStripRegPack22.LightType = "u8"; + LedStripRegPack22.NumPixels = "u16"; + LedStripRegPack22.NumColumns = "u16"; + LedStripRegPack22.MaxPower = "u16"; + LedStripRegPack22.MaxPixels = "u16"; + LedStripRegPack22.NumRepeats = "u16"; + LedStripRegPack22.Variant = "u8"; + })(LedStripRegPack || (LedStripRegPack = {})); + var LedStripCmd = /* @__PURE__ */ ((LedStripCmd2) => { + LedStripCmd2[LedStripCmd2["Run"] = 129] = "Run"; + return LedStripCmd2; + })(LedStripCmd || {}); + var LedStripCmdPack; + ((LedStripCmdPack22) => { + LedStripCmdPack22.Run = "b"; + })(LedStripCmdPack || (LedStripCmdPack = {})); + var SRV_LIGHT_BULB = 480970060; + var LightBulbReg = /* @__PURE__ */ ((LightBulbReg2) => { + LightBulbReg2[LightBulbReg2["Brightness"] = 1] = "Brightness"; + LightBulbReg2[LightBulbReg2["Dimmable"] = 384] = "Dimmable"; + return LightBulbReg2; + })(LightBulbReg || {}); + var LightBulbRegPack; + ((LightBulbRegPack22) => { + LightBulbRegPack22.Brightness = "u0.16"; + LightBulbRegPack22.Dimmable = "u8"; + })(LightBulbRegPack || (LightBulbRegPack = {})); + var SRV_LIGHT_LEVEL = 400333340; + var LightLevelVariant = /* @__PURE__ */ ((LightLevelVariant2) => { + LightLevelVariant2[LightLevelVariant2["PhotoResistor"] = 1] = "PhotoResistor"; + LightLevelVariant2[LightLevelVariant2["ReverseBiasedLED"] = 2] = "ReverseBiasedLED"; + return LightLevelVariant2; + })(LightLevelVariant || {}); + var LightLevelReg = /* @__PURE__ */ ((LightLevelReg2) => { + LightLevelReg2[LightLevelReg2["LightLevel"] = 257] = "LightLevel"; + LightLevelReg2[LightLevelReg2["LightLevelError"] = 262] = "LightLevelError"; + LightLevelReg2[LightLevelReg2["Variant"] = 263] = "Variant"; + return LightLevelReg2; + })(LightLevelReg || {}); + var LightLevelRegPack; + ((LightLevelRegPack22) => { + LightLevelRegPack22.LightLevel = "u0.16"; + LightLevelRegPack22.LightLevelError = "u0.16"; + LightLevelRegPack22.Variant = "u8"; + })(LightLevelRegPack || (LightLevelRegPack = {})); + var SRV_LOGGER = 316415946; + var LoggerPriority = /* @__PURE__ */ ((LoggerPriority2) => { + LoggerPriority2[LoggerPriority2["Debug"] = 0] = "Debug"; + LoggerPriority2[LoggerPriority2["Log"] = 1] = "Log"; + LoggerPriority2[LoggerPriority2["Warning"] = 2] = "Warning"; + LoggerPriority2[LoggerPriority2["Error"] = 3] = "Error"; + LoggerPriority2[LoggerPriority2["Silent"] = 4] = "Silent"; + return LoggerPriority2; + })(LoggerPriority || {}); + var LoggerReg = /* @__PURE__ */ ((LoggerReg2) => { + LoggerReg2[LoggerReg2["MinPriority"] = 128] = "MinPriority"; + return LoggerReg2; + })(LoggerReg || {}); + var LoggerRegPack; + ((LoggerRegPack22) => { + LoggerRegPack22.MinPriority = "u8"; + })(LoggerRegPack || (LoggerRegPack = {})); + var LoggerCmd = /* @__PURE__ */ ((LoggerCmd2) => { + LoggerCmd2[LoggerCmd2["Debug"] = 128] = "Debug"; + LoggerCmd2[LoggerCmd2["Log"] = 129] = "Log"; + LoggerCmd2[LoggerCmd2["Warn"] = 130] = "Warn"; + LoggerCmd2[LoggerCmd2["Error"] = 131] = "Error"; + return LoggerCmd2; + })(LoggerCmd || {}); + var LoggerCmdPack; + ((LoggerCmdPack22) => { + LoggerCmdPack22.Debug = "s"; + LoggerCmdPack22.Log = "s"; + LoggerCmdPack22.Warn = "s"; + LoggerCmdPack22.Error = "s"; + })(LoggerCmdPack || (LoggerCmdPack = {})); + var SRV_MAGNETIC_FIELD_LEVEL = 318642191; + var MagneticFieldLevelVariant = /* @__PURE__ */ ((MagneticFieldLevelVariant2) => { + MagneticFieldLevelVariant2[MagneticFieldLevelVariant2["AnalogNS"] = 1] = "AnalogNS"; + MagneticFieldLevelVariant2[MagneticFieldLevelVariant2["AnalogN"] = 2] = "AnalogN"; + MagneticFieldLevelVariant2[MagneticFieldLevelVariant2["AnalogS"] = 3] = "AnalogS"; + MagneticFieldLevelVariant2[MagneticFieldLevelVariant2["DigitalNS"] = 4] = "DigitalNS"; + MagneticFieldLevelVariant2[MagneticFieldLevelVariant2["DigitalN"] = 5] = "DigitalN"; + MagneticFieldLevelVariant2[MagneticFieldLevelVariant2["DigitalS"] = 6] = "DigitalS"; + return MagneticFieldLevelVariant2; + })(MagneticFieldLevelVariant || {}); + var MagneticFieldLevelReg = /* @__PURE__ */ ((MagneticFieldLevelReg2) => { + MagneticFieldLevelReg2[MagneticFieldLevelReg2["Strength"] = 257] = "Strength"; + MagneticFieldLevelReg2[MagneticFieldLevelReg2["Detected"] = 385] = "Detected"; + MagneticFieldLevelReg2[MagneticFieldLevelReg2["Variant"] = 263] = "Variant"; + return MagneticFieldLevelReg2; + })(MagneticFieldLevelReg || {}); + var MagneticFieldLevelRegPack; + ((MagneticFieldLevelRegPack22) => { + MagneticFieldLevelRegPack22.Strength = "i1.15"; + MagneticFieldLevelRegPack22.Detected = "u8"; + MagneticFieldLevelRegPack22.Variant = "u8"; + })(MagneticFieldLevelRegPack || (MagneticFieldLevelRegPack = {})); + var MagneticFieldLevelEvent = /* @__PURE__ */ ((MagneticFieldLevelEvent2) => { + MagneticFieldLevelEvent2[MagneticFieldLevelEvent2["Active"] = 1] = "Active"; + MagneticFieldLevelEvent2[MagneticFieldLevelEvent2["Inactive"] = 2] = "Inactive"; + return MagneticFieldLevelEvent2; + })(MagneticFieldLevelEvent || {}); + var SRV_MAGNETOMETER = 318935176; + var MagnetometerReg = /* @__PURE__ */ ((MagnetometerReg2) => { + MagnetometerReg2[MagnetometerReg2["Forces"] = 257] = "Forces"; + MagnetometerReg2[MagnetometerReg2["ForcesError"] = 262] = "ForcesError"; + return MagnetometerReg2; + })(MagnetometerReg || {}); + var MagnetometerRegPack; + ((MagnetometerRegPack22) => { + MagnetometerRegPack22.Forces = "i32 i32 i32"; + MagnetometerRegPack22.ForcesError = "i32"; + })(MagnetometerRegPack || (MagnetometerRegPack = {})); + var MagnetometerCmd = /* @__PURE__ */ ((MagnetometerCmd2) => { + MagnetometerCmd2[MagnetometerCmd2["Calibrate"] = 2] = "Calibrate"; + return MagnetometerCmd2; + })(MagnetometerCmd || {}); + var SRV_MATRIX_KEYPAD = 319172040; + var MatrixKeypadVariant = /* @__PURE__ */ ((MatrixKeypadVariant2) => { + MatrixKeypadVariant2[MatrixKeypadVariant2["Membrane"] = 1] = "Membrane"; + MatrixKeypadVariant2[MatrixKeypadVariant2["Keyboard"] = 2] = "Keyboard"; + MatrixKeypadVariant2[MatrixKeypadVariant2["Elastomer"] = 3] = "Elastomer"; + MatrixKeypadVariant2[MatrixKeypadVariant2["ElastomerLEDPixel"] = 4] = "ElastomerLEDPixel"; + return MatrixKeypadVariant2; + })(MatrixKeypadVariant || {}); + var MatrixKeypadReg = /* @__PURE__ */ ((MatrixKeypadReg2) => { + MatrixKeypadReg2[MatrixKeypadReg2["Pressed"] = 257] = "Pressed"; + MatrixKeypadReg2[MatrixKeypadReg2["Rows"] = 384] = "Rows"; + MatrixKeypadReg2[MatrixKeypadReg2["Columns"] = 385] = "Columns"; + MatrixKeypadReg2[MatrixKeypadReg2["Labels"] = 386] = "Labels"; + MatrixKeypadReg2[MatrixKeypadReg2["Variant"] = 263] = "Variant"; + return MatrixKeypadReg2; + })(MatrixKeypadReg || {}); + var MatrixKeypadRegPack; + ((MatrixKeypadRegPack22) => { + MatrixKeypadRegPack22.Pressed = "r: u8"; + MatrixKeypadRegPack22.Rows = "u8"; + MatrixKeypadRegPack22.Columns = "u8"; + MatrixKeypadRegPack22.Labels = "r: z"; + MatrixKeypadRegPack22.Variant = "u8"; + })(MatrixKeypadRegPack || (MatrixKeypadRegPack = {})); + var MatrixKeypadEvent = /* @__PURE__ */ ((MatrixKeypadEvent2) => { + MatrixKeypadEvent2[MatrixKeypadEvent2["Down"] = 1] = "Down"; + MatrixKeypadEvent2[MatrixKeypadEvent2["Up"] = 2] = "Up"; + MatrixKeypadEvent2[MatrixKeypadEvent2["Click"] = 128] = "Click"; + MatrixKeypadEvent2[MatrixKeypadEvent2["LongClick"] = 129] = "LongClick"; + return MatrixKeypadEvent2; + })(MatrixKeypadEvent || {}); + var MatrixKeypadEventPack; + ((MatrixKeypadEventPack22) => { + MatrixKeypadEventPack22.Down = "u8"; + MatrixKeypadEventPack22.Up = "u8"; + MatrixKeypadEventPack22.Click = "u8"; + MatrixKeypadEventPack22.LongClick = "u8"; + })(MatrixKeypadEventPack || (MatrixKeypadEventPack = {})); + var SRV_MICROPHONE = 289254534; + var MicrophoneCmd = /* @__PURE__ */ ((MicrophoneCmd2) => { + MicrophoneCmd2[MicrophoneCmd2["Sample"] = 129] = "Sample"; + return MicrophoneCmd2; + })(MicrophoneCmd || {}); + var MicrophoneCmdPack; + ((MicrophoneCmdPack22) => { + MicrophoneCmdPack22.Sample = "b[12] u32"; + })(MicrophoneCmdPack || (MicrophoneCmdPack = {})); + var MicrophoneReg = /* @__PURE__ */ ((MicrophoneReg2) => { + MicrophoneReg2[MicrophoneReg2["SamplingPeriod"] = 128] = "SamplingPeriod"; + return MicrophoneReg2; + })(MicrophoneReg || {}); + var MicrophoneRegPack; + ((MicrophoneRegPack22) => { + MicrophoneRegPack22.SamplingPeriod = "u32"; + })(MicrophoneRegPack || (MicrophoneRegPack = {})); + var SRV_MIDI_OUTPUT = 444894423; + var MidiOutputReg = /* @__PURE__ */ ((MidiOutputReg2) => { + MidiOutputReg2[MidiOutputReg2["Enabled"] = 1] = "Enabled"; + return MidiOutputReg2; + })(MidiOutputReg || {}); + var MidiOutputRegPack; + ((MidiOutputRegPack22) => { + MidiOutputRegPack22.Enabled = "u8"; + })(MidiOutputRegPack || (MidiOutputRegPack = {})); + var MidiOutputCmd = /* @__PURE__ */ ((MidiOutputCmd2) => { + MidiOutputCmd2[MidiOutputCmd2["Clear"] = 128] = "Clear"; + MidiOutputCmd2[MidiOutputCmd2["Send"] = 129] = "Send"; + return MidiOutputCmd2; + })(MidiOutputCmd || {}); + var MidiOutputCmdPack; + ((MidiOutputCmdPack22) => { + MidiOutputCmdPack22.Send = "b"; + })(MidiOutputCmdPack || (MidiOutputCmdPack = {})); + var SRV_MODEL_RUNNER = 336566904; + var ModelRunnerModelFormat = /* @__PURE__ */ ((ModelRunnerModelFormat2) => { + ModelRunnerModelFormat2[ModelRunnerModelFormat2["TFLite"] = 860636756] = "TFLite"; + ModelRunnerModelFormat2[ModelRunnerModelFormat2["ML4F"] = 809963362] = "ML4F"; + ModelRunnerModelFormat2[ModelRunnerModelFormat2["EdgeImpulseCompiled"] = 810961221] = "EdgeImpulseCompiled"; + return ModelRunnerModelFormat2; + })(ModelRunnerModelFormat || {}); + var ModelRunnerCmd = /* @__PURE__ */ ((ModelRunnerCmd2) => { + ModelRunnerCmd2[ModelRunnerCmd2["SetModel"] = 128] = "SetModel"; + ModelRunnerCmd2[ModelRunnerCmd2["Predict"] = 129] = "Predict"; + return ModelRunnerCmd2; + })(ModelRunnerCmd || {}); + var ModelRunnerCmdPack; + ((ModelRunnerCmdPack22) => { + ModelRunnerCmdPack22.SetModel = "u32"; + ModelRunnerCmdPack22.SetModelReport = "u16"; + ModelRunnerCmdPack22.Predict = "b[12]"; + ModelRunnerCmdPack22.PredictReport = "u16"; + })(ModelRunnerCmdPack || (ModelRunnerCmdPack = {})); + var ModelRunnerReg = /* @__PURE__ */ ((ModelRunnerReg2) => { + ModelRunnerReg2[ModelRunnerReg2["AutoInvokeEvery"] = 128] = "AutoInvokeEvery"; + ModelRunnerReg2[ModelRunnerReg2["Outputs"] = 257] = "Outputs"; + ModelRunnerReg2[ModelRunnerReg2["InputShape"] = 384] = "InputShape"; + ModelRunnerReg2[ModelRunnerReg2["OutputShape"] = 385] = "OutputShape"; + ModelRunnerReg2[ModelRunnerReg2["LastRunTime"] = 386] = "LastRunTime"; + ModelRunnerReg2[ModelRunnerReg2["AllocatedArenaSize"] = 387] = "AllocatedArenaSize"; + ModelRunnerReg2[ModelRunnerReg2["ModelSize"] = 388] = "ModelSize"; + ModelRunnerReg2[ModelRunnerReg2["LastError"] = 389] = "LastError"; + ModelRunnerReg2[ModelRunnerReg2["Format"] = 390] = "Format"; + ModelRunnerReg2[ModelRunnerReg2["FormatVersion"] = 391] = "FormatVersion"; + ModelRunnerReg2[ModelRunnerReg2["Parallel"] = 392] = "Parallel"; + return ModelRunnerReg2; + })(ModelRunnerReg || {}); + var ModelRunnerRegPack; + ((ModelRunnerRegPack22) => { + ModelRunnerRegPack22.AutoInvokeEvery = "u16"; + ModelRunnerRegPack22.Outputs = "r: f32"; + ModelRunnerRegPack22.InputShape = "r: u16"; + ModelRunnerRegPack22.OutputShape = "r: u16"; + ModelRunnerRegPack22.LastRunTime = "u32"; + ModelRunnerRegPack22.AllocatedArenaSize = "u32"; + ModelRunnerRegPack22.ModelSize = "u32"; + ModelRunnerRegPack22.LastError = "s"; + ModelRunnerRegPack22.Format = "u32"; + ModelRunnerRegPack22.FormatVersion = "u32"; + ModelRunnerRegPack22.Parallel = "u8"; + })(ModelRunnerRegPack || (ModelRunnerRegPack = {})); + var SRV_MOTION = 293185353; + var MotionVariant = /* @__PURE__ */ ((MotionVariant2) => { + MotionVariant2[MotionVariant2["PIR"] = 1] = "PIR"; + return MotionVariant2; + })(MotionVariant || {}); + var MotionReg = /* @__PURE__ */ ((MotionReg2) => { + MotionReg2[MotionReg2["Moving"] = 257] = "Moving"; + MotionReg2[MotionReg2["MaxDistance"] = 384] = "MaxDistance"; + MotionReg2[MotionReg2["Angle"] = 385] = "Angle"; + MotionReg2[MotionReg2["Variant"] = 263] = "Variant"; + return MotionReg2; + })(MotionReg || {}); + var MotionRegPack; + ((MotionRegPack22) => { + MotionRegPack22.Moving = "u8"; + MotionRegPack22.MaxDistance = "u16.16"; + MotionRegPack22.Angle = "u16"; + MotionRegPack22.Variant = "u8"; + })(MotionRegPack || (MotionRegPack = {})); + var MotionEvent = /* @__PURE__ */ ((MotionEvent2) => { + MotionEvent2[MotionEvent2["Movement"] = 1] = "Movement"; + return MotionEvent2; + })(MotionEvent || {}); + var SRV_MOTOR = 385895640; + var MotorReg = /* @__PURE__ */ ((MotorReg2) => { + MotorReg2[MotorReg2["Speed"] = 2] = "Speed"; + MotorReg2[MotorReg2["Enabled"] = 1] = "Enabled"; + MotorReg2[MotorReg2["LoadTorque"] = 384] = "LoadTorque"; + MotorReg2[MotorReg2["LoadRotationSpeed"] = 385] = "LoadRotationSpeed"; + MotorReg2[MotorReg2["Reversible"] = 386] = "Reversible"; + return MotorReg2; + })(MotorReg || {}); + var MotorRegPack; + ((MotorRegPack22) => { + MotorRegPack22.Speed = "i1.15"; + MotorRegPack22.Enabled = "u8"; + MotorRegPack22.LoadTorque = "u16.16"; + MotorRegPack22.LoadRotationSpeed = "u16.16"; + MotorRegPack22.Reversible = "u8"; + })(MotorRegPack || (MotorRegPack = {})); + var SRV_MULTITOUCH = 487664309; + var MultitouchReg = /* @__PURE__ */ ((MultitouchReg2) => { + MultitouchReg2[MultitouchReg2["Capacity"] = 257] = "Capacity"; + return MultitouchReg2; + })(MultitouchReg || {}); + var MultitouchRegPack; + ((MultitouchRegPack22) => { + MultitouchRegPack22.Capacity = "r: i16"; + })(MultitouchRegPack || (MultitouchRegPack = {})); + var MultitouchEvent = /* @__PURE__ */ ((MultitouchEvent2) => { + MultitouchEvent2[MultitouchEvent2["Touch"] = 1] = "Touch"; + MultitouchEvent2[MultitouchEvent2["Release"] = 2] = "Release"; + MultitouchEvent2[MultitouchEvent2["Tap"] = 128] = "Tap"; + MultitouchEvent2[MultitouchEvent2["LongPress"] = 129] = "LongPress"; + MultitouchEvent2[MultitouchEvent2["SwipePos"] = 144] = "SwipePos"; + MultitouchEvent2[MultitouchEvent2["SwipeNeg"] = 145] = "SwipeNeg"; + return MultitouchEvent2; + })(MultitouchEvent || {}); + var MultitouchEventPack; + ((MultitouchEventPack22) => { + MultitouchEventPack22.Touch = "u8"; + MultitouchEventPack22.Release = "u8"; + MultitouchEventPack22.Tap = "u8"; + MultitouchEventPack22.LongPress = "u8"; + MultitouchEventPack22.SwipePos = "u16 u8 u8"; + MultitouchEventPack22.SwipeNeg = "u16 u8 u8"; + })(MultitouchEventPack || (MultitouchEventPack = {})); + var SRV_PLANAR_POSITION = 499351381; + var PlanarPositionVariant = /* @__PURE__ */ ((PlanarPositionVariant2) => { + PlanarPositionVariant2[PlanarPositionVariant2["OpticalMousePosition"] = 1] = "OpticalMousePosition"; + return PlanarPositionVariant2; + })(PlanarPositionVariant || {}); + var PlanarPositionReg = /* @__PURE__ */ ((PlanarPositionReg2) => { + PlanarPositionReg2[PlanarPositionReg2["Position"] = 257] = "Position"; + PlanarPositionReg2[PlanarPositionReg2["Variant"] = 263] = "Variant"; + return PlanarPositionReg2; + })(PlanarPositionReg || {}); + var PlanarPositionRegPack; + ((PlanarPositionRegPack22) => { + PlanarPositionRegPack22.Position = "i22.10 i22.10"; + PlanarPositionRegPack22.Variant = "u8"; + })(PlanarPositionRegPack || (PlanarPositionRegPack = {})); + var SRV_POTENTIOMETER = 522667846; + var PotentiometerVariant = /* @__PURE__ */ ((PotentiometerVariant2) => { + PotentiometerVariant2[PotentiometerVariant2["Slider"] = 1] = "Slider"; + PotentiometerVariant2[PotentiometerVariant2["Rotary"] = 2] = "Rotary"; + return PotentiometerVariant2; + })(PotentiometerVariant || {}); + var PotentiometerReg = /* @__PURE__ */ ((PotentiometerReg2) => { + PotentiometerReg2[PotentiometerReg2["Position"] = 257] = "Position"; + PotentiometerReg2[PotentiometerReg2["Variant"] = 263] = "Variant"; + return PotentiometerReg2; + })(PotentiometerReg || {}); + var PotentiometerRegPack; + ((PotentiometerRegPack22) => { + PotentiometerRegPack22.Position = "u0.16"; + PotentiometerRegPack22.Variant = "u8"; + })(PotentiometerRegPack || (PotentiometerRegPack = {})); + var SRV_POWER = 530893146; + var PowerPowerStatus = /* @__PURE__ */ ((PowerPowerStatus2) => { + PowerPowerStatus2[PowerPowerStatus2["Disallowed"] = 0] = "Disallowed"; + PowerPowerStatus2[PowerPowerStatus2["Powering"] = 1] = "Powering"; + PowerPowerStatus2[PowerPowerStatus2["Overload"] = 2] = "Overload"; + PowerPowerStatus2[PowerPowerStatus2["Overprovision"] = 3] = "Overprovision"; + return PowerPowerStatus2; + })(PowerPowerStatus || {}); + var PowerReg = /* @__PURE__ */ ((PowerReg2) => { + PowerReg2[PowerReg2["Allowed"] = 1] = "Allowed"; + PowerReg2[PowerReg2["MaxPower"] = 7] = "MaxPower"; + PowerReg2[PowerReg2["PowerStatus"] = 385] = "PowerStatus"; + PowerReg2[PowerReg2["CurrentDraw"] = 257] = "CurrentDraw"; + PowerReg2[PowerReg2["BatteryVoltage"] = 384] = "BatteryVoltage"; + PowerReg2[PowerReg2["BatteryCharge"] = 386] = "BatteryCharge"; + PowerReg2[PowerReg2["BatteryCapacity"] = 387] = "BatteryCapacity"; + PowerReg2[PowerReg2["KeepOnPulseDuration"] = 128] = "KeepOnPulseDuration"; + PowerReg2[PowerReg2["KeepOnPulsePeriod"] = 129] = "KeepOnPulsePeriod"; + return PowerReg2; + })(PowerReg || {}); + var PowerRegPack; + ((PowerRegPack22) => { + PowerRegPack22.Allowed = "u8"; + PowerRegPack22.MaxPower = "u16"; + PowerRegPack22.PowerStatus = "u8"; + PowerRegPack22.CurrentDraw = "u16"; + PowerRegPack22.BatteryVoltage = "u16"; + PowerRegPack22.BatteryCharge = "u0.16"; + PowerRegPack22.BatteryCapacity = "u32"; + PowerRegPack22.KeepOnPulseDuration = "u16"; + PowerRegPack22.KeepOnPulsePeriod = "u16"; + })(PowerRegPack || (PowerRegPack = {})); + var PowerCmd = /* @__PURE__ */ ((PowerCmd2) => { + PowerCmd2[PowerCmd2["Shutdown"] = 128] = "Shutdown"; + return PowerCmd2; + })(PowerCmd || {}); + var PowerEvent = /* @__PURE__ */ ((PowerEvent2) => { + PowerEvent2[PowerEvent2["PowerStatusChanged"] = 3] = "PowerStatusChanged"; + return PowerEvent2; + })(PowerEvent || {}); + var PowerEventPack; + ((PowerEventPack22) => { + PowerEventPack22.PowerStatusChanged = "u8"; + })(PowerEventPack || (PowerEventPack = {})); + var SRV_POWER_SUPPLY = 524302175; + var PowerSupplyReg = /* @__PURE__ */ ((PowerSupplyReg2) => { + PowerSupplyReg2[PowerSupplyReg2["Enabled"] = 1] = "Enabled"; + PowerSupplyReg2[PowerSupplyReg2["OutputVoltage"] = 2] = "OutputVoltage"; + PowerSupplyReg2[PowerSupplyReg2["MinimumVoltage"] = 272] = "MinimumVoltage"; + PowerSupplyReg2[PowerSupplyReg2["MaximumVoltage"] = 273] = "MaximumVoltage"; + return PowerSupplyReg2; + })(PowerSupplyReg || {}); + var PowerSupplyRegPack; + ((PowerSupplyRegPack22) => { + PowerSupplyRegPack22.Enabled = "u8"; + PowerSupplyRegPack22.OutputVoltage = "f64"; + PowerSupplyRegPack22.MinimumVoltage = "f64"; + PowerSupplyRegPack22.MaximumVoltage = "f64"; + })(PowerSupplyRegPack || (PowerSupplyRegPack = {})); + var SRV_PRESSURE_BUTTON = 672612547; + var PressureButtonReg = /* @__PURE__ */ ((PressureButtonReg2) => { + PressureButtonReg2[PressureButtonReg2["Threshold"] = 6] = "Threshold"; + return PressureButtonReg2; + })(PressureButtonReg || {}); + var PressureButtonRegPack; + ((PressureButtonRegPack22) => { + PressureButtonRegPack22.Threshold = "u0.16"; + })(PressureButtonRegPack || (PressureButtonRegPack = {})); + var SRV_PROTO_TEST = 382158442; + var ProtoTestReg = /* @__PURE__ */ ((ProtoTestReg2) => { + ProtoTestReg2[ProtoTestReg2["RwBool"] = 129] = "RwBool"; + ProtoTestReg2[ProtoTestReg2["RoBool"] = 385] = "RoBool"; + ProtoTestReg2[ProtoTestReg2["RwU32"] = 130] = "RwU32"; + ProtoTestReg2[ProtoTestReg2["RoU32"] = 386] = "RoU32"; + ProtoTestReg2[ProtoTestReg2["RwI32"] = 131] = "RwI32"; + ProtoTestReg2[ProtoTestReg2["RoI32"] = 387] = "RoI32"; + ProtoTestReg2[ProtoTestReg2["RwString"] = 132] = "RwString"; + ProtoTestReg2[ProtoTestReg2["RoString"] = 388] = "RoString"; + ProtoTestReg2[ProtoTestReg2["RwBytes"] = 133] = "RwBytes"; + ProtoTestReg2[ProtoTestReg2["RoBytes"] = 389] = "RoBytes"; + ProtoTestReg2[ProtoTestReg2["RwI8U8U16I32"] = 134] = "RwI8U8U16I32"; + ProtoTestReg2[ProtoTestReg2["RoI8U8U16I32"] = 390] = "RoI8U8U16I32"; + ProtoTestReg2[ProtoTestReg2["RwU8String"] = 135] = "RwU8String"; + ProtoTestReg2[ProtoTestReg2["RoU8String"] = 391] = "RoU8String"; + return ProtoTestReg2; + })(ProtoTestReg || {}); + var ProtoTestRegPack; + ((ProtoTestRegPack22) => { + ProtoTestRegPack22.RwBool = "u8"; + ProtoTestRegPack22.RoBool = "u8"; + ProtoTestRegPack22.RwU32 = "u32"; + ProtoTestRegPack22.RoU32 = "u32"; + ProtoTestRegPack22.RwI32 = "i32"; + ProtoTestRegPack22.RoI32 = "i32"; + ProtoTestRegPack22.RwString = "s"; + ProtoTestRegPack22.RoString = "s"; + ProtoTestRegPack22.RwBytes = "b"; + ProtoTestRegPack22.RoBytes = "b"; + ProtoTestRegPack22.RwI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestRegPack22.RoI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestRegPack22.RwU8String = "u8 s"; + ProtoTestRegPack22.RoU8String = "u8 s"; + })(ProtoTestRegPack || (ProtoTestRegPack = {})); + var ProtoTestEvent = /* @__PURE__ */ ((ProtoTestEvent2) => { + ProtoTestEvent2[ProtoTestEvent2["EBool"] = 129] = "EBool"; + ProtoTestEvent2[ProtoTestEvent2["EU32"] = 130] = "EU32"; + ProtoTestEvent2[ProtoTestEvent2["EI32"] = 131] = "EI32"; + ProtoTestEvent2[ProtoTestEvent2["EString"] = 132] = "EString"; + ProtoTestEvent2[ProtoTestEvent2["EBytes"] = 133] = "EBytes"; + ProtoTestEvent2[ProtoTestEvent2["EI8U8U16I32"] = 134] = "EI8U8U16I32"; + ProtoTestEvent2[ProtoTestEvent2["EU8String"] = 135] = "EU8String"; + return ProtoTestEvent2; + })(ProtoTestEvent || {}); + var ProtoTestEventPack; + ((ProtoTestEventPack22) => { + ProtoTestEventPack22.EBool = "u8"; + ProtoTestEventPack22.EU32 = "u32"; + ProtoTestEventPack22.EI32 = "i32"; + ProtoTestEventPack22.EString = "s"; + ProtoTestEventPack22.EBytes = "b"; + ProtoTestEventPack22.EI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestEventPack22.EU8String = "u8 s"; + })(ProtoTestEventPack || (ProtoTestEventPack = {})); + var ProtoTestCmd = /* @__PURE__ */ ((ProtoTestCmd2) => { + ProtoTestCmd2[ProtoTestCmd2["CBool"] = 129] = "CBool"; + ProtoTestCmd2[ProtoTestCmd2["CU32"] = 130] = "CU32"; + ProtoTestCmd2[ProtoTestCmd2["CI32"] = 131] = "CI32"; + ProtoTestCmd2[ProtoTestCmd2["CString"] = 132] = "CString"; + ProtoTestCmd2[ProtoTestCmd2["CBytes"] = 133] = "CBytes"; + ProtoTestCmd2[ProtoTestCmd2["CI8U8U16I32"] = 134] = "CI8U8U16I32"; + ProtoTestCmd2[ProtoTestCmd2["CU8String"] = 135] = "CU8String"; + ProtoTestCmd2[ProtoTestCmd2["CReportPipe"] = 144] = "CReportPipe"; + return ProtoTestCmd2; + })(ProtoTestCmd || {}); + var ProtoTestCmdPack; + ((ProtoTestCmdPack22) => { + ProtoTestCmdPack22.CBool = "u8"; + ProtoTestCmdPack22.CU32 = "u32"; + ProtoTestCmdPack22.CI32 = "i32"; + ProtoTestCmdPack22.CString = "s"; + ProtoTestCmdPack22.CBytes = "b"; + ProtoTestCmdPack22.CI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestCmdPack22.CU8String = "u8 s"; + ProtoTestCmdPack22.CReportPipe = "b[12]"; + })(ProtoTestCmdPack || (ProtoTestCmdPack = {})); + var ProtoTestPipe = /* @__PURE__ */ ((ProtoTestPipe2) => { + })(ProtoTestPipe || {}); + var ProtoTestPipePack; + ((ProtoTestPipePack22) => { + ProtoTestPipePack22.PBytes = "u8"; + })(ProtoTestPipePack || (ProtoTestPipePack = {})); + var SRV_PROXY = 384932169; + var SRV_PULSE_OXIMETER = 280710838; + var PulseOximeterReg = /* @__PURE__ */ ((PulseOximeterReg2) => { + PulseOximeterReg2[PulseOximeterReg2["Oxygen"] = 257] = "Oxygen"; + PulseOximeterReg2[PulseOximeterReg2["OxygenError"] = 262] = "OxygenError"; + return PulseOximeterReg2; + })(PulseOximeterReg || {}); + var PulseOximeterRegPack; + ((PulseOximeterRegPack22) => { + PulseOximeterRegPack22.Oxygen = "u8.8"; + PulseOximeterRegPack22.OxygenError = "u8.8"; + })(PulseOximeterRegPack || (PulseOximeterRegPack = {})); + var SRV_RAIN_GAUGE = 326323349; + var RainGaugeReg = /* @__PURE__ */ ((RainGaugeReg2) => { + RainGaugeReg2[RainGaugeReg2["Precipitation"] = 257] = "Precipitation"; + RainGaugeReg2[RainGaugeReg2["PrecipitationPrecision"] = 264] = "PrecipitationPrecision"; + return RainGaugeReg2; + })(RainGaugeReg || {}); + var RainGaugeRegPack; + ((RainGaugeRegPack22) => { + RainGaugeRegPack22.Precipitation = "u16.16"; + RainGaugeRegPack22.PrecipitationPrecision = "u16.16"; + })(RainGaugeRegPack || (RainGaugeRegPack = {})); + var SRV_REAL_TIME_CLOCK = 445323816; + var RealTimeClockVariant = /* @__PURE__ */ ((RealTimeClockVariant2) => { + RealTimeClockVariant2[RealTimeClockVariant2["Computer"] = 1] = "Computer"; + RealTimeClockVariant2[RealTimeClockVariant2["Crystal"] = 2] = "Crystal"; + RealTimeClockVariant2[RealTimeClockVariant2["Cuckoo"] = 3] = "Cuckoo"; + return RealTimeClockVariant2; + })(RealTimeClockVariant || {}); + var RealTimeClockReg = /* @__PURE__ */ ((RealTimeClockReg2) => { + RealTimeClockReg2[RealTimeClockReg2["LocalTime"] = 257] = "LocalTime"; + RealTimeClockReg2[RealTimeClockReg2["Drift"] = 384] = "Drift"; + RealTimeClockReg2[RealTimeClockReg2["Precision"] = 385] = "Precision"; + RealTimeClockReg2[RealTimeClockReg2["Variant"] = 263] = "Variant"; + return RealTimeClockReg2; + })(RealTimeClockReg || {}); + var RealTimeClockRegPack; + ((RealTimeClockRegPack22) => { + RealTimeClockRegPack22.LocalTime = "u16 u8 u8 u8 u8 u8 u8"; + RealTimeClockRegPack22.Drift = "u16.16"; + RealTimeClockRegPack22.Precision = "u16.16"; + RealTimeClockRegPack22.Variant = "u8"; + })(RealTimeClockRegPack || (RealTimeClockRegPack = {})); + var RealTimeClockCmd = /* @__PURE__ */ ((RealTimeClockCmd2) => { + RealTimeClockCmd2[RealTimeClockCmd2["SetTime"] = 128] = "SetTime"; + return RealTimeClockCmd2; + })(RealTimeClockCmd || {}); + var RealTimeClockCmdPack; + ((RealTimeClockCmdPack22) => { + RealTimeClockCmdPack22.SetTime = "u16 u8 u8 u8 u8 u8 u8"; + })(RealTimeClockCmdPack || (RealTimeClockCmdPack = {})); + var SRV_REFLECTED_LIGHT = 309087410; + var ReflectedLightVariant = /* @__PURE__ */ ((ReflectedLightVariant2) => { + ReflectedLightVariant2[ReflectedLightVariant2["InfraredDigital"] = 1] = "InfraredDigital"; + ReflectedLightVariant2[ReflectedLightVariant2["InfraredAnalog"] = 2] = "InfraredAnalog"; + return ReflectedLightVariant2; + })(ReflectedLightVariant || {}); + var ReflectedLightReg = /* @__PURE__ */ ((ReflectedLightReg2) => { + ReflectedLightReg2[ReflectedLightReg2["Brightness"] = 257] = "Brightness"; + ReflectedLightReg2[ReflectedLightReg2["Variant"] = 263] = "Variant"; + return ReflectedLightReg2; + })(ReflectedLightReg || {}); + var ReflectedLightRegPack; + ((ReflectedLightRegPack22) => { + ReflectedLightRegPack22.Brightness = "u0.16"; + ReflectedLightRegPack22.Variant = "u8"; + })(ReflectedLightRegPack || (ReflectedLightRegPack = {})); + var SRV_RELAY = 406840918; + var RelayVariant = /* @__PURE__ */ ((RelayVariant2) => { + RelayVariant2[RelayVariant2["Electromechanical"] = 1] = "Electromechanical"; + RelayVariant2[RelayVariant2["SolidState"] = 2] = "SolidState"; + RelayVariant2[RelayVariant2["Reed"] = 3] = "Reed"; + return RelayVariant2; + })(RelayVariant || {}); + var RelayReg = /* @__PURE__ */ ((RelayReg2) => { + RelayReg2[RelayReg2["Active"] = 1] = "Active"; + RelayReg2[RelayReg2["Variant"] = 263] = "Variant"; + RelayReg2[RelayReg2["MaxSwitchingCurrent"] = 384] = "MaxSwitchingCurrent"; + return RelayReg2; + })(RelayReg || {}); + var RelayRegPack; + ((RelayRegPack22) => { + RelayRegPack22.Active = "u8"; + RelayRegPack22.Variant = "u8"; + RelayRegPack22.MaxSwitchingCurrent = "u32"; + })(RelayRegPack || (RelayRegPack = {})); + var SRV_RNG = 394916002; + var RngVariant = /* @__PURE__ */ ((RngVariant2) => { + RngVariant2[RngVariant2["Quantum"] = 1] = "Quantum"; + RngVariant2[RngVariant2["ADCNoise"] = 2] = "ADCNoise"; + RngVariant2[RngVariant2["WebCrypto"] = 3] = "WebCrypto"; + return RngVariant2; + })(RngVariant || {}); + var RngReg = /* @__PURE__ */ ((RngReg2) => { + RngReg2[RngReg2["Random"] = 384] = "Random"; + RngReg2[RngReg2["Variant"] = 263] = "Variant"; + return RngReg2; + })(RngReg || {}); + var RngRegPack; + ((RngRegPack22) => { + RngRegPack22.Random = "b"; + RngRegPack22.Variant = "u8"; + })(RngRegPack || (RngRegPack = {})); + var SRV_ROLE_MANAGER = 508264038; + var RoleManagerReg = /* @__PURE__ */ ((RoleManagerReg2) => { + RoleManagerReg2[RoleManagerReg2["AutoBind"] = 128] = "AutoBind"; + RoleManagerReg2[RoleManagerReg2["AllRolesAllocated"] = 385] = "AllRolesAllocated"; + return RoleManagerReg2; + })(RoleManagerReg || {}); + var RoleManagerRegPack; + ((RoleManagerRegPack22) => { + RoleManagerRegPack22.AutoBind = "u8"; + RoleManagerRegPack22.AllRolesAllocated = "u8"; + })(RoleManagerRegPack || (RoleManagerRegPack = {})); + var RoleManagerCmd = /* @__PURE__ */ ((RoleManagerCmd2) => { + RoleManagerCmd2[RoleManagerCmd2["SetRole"] = 129] = "SetRole"; + RoleManagerCmd2[RoleManagerCmd2["ClearAllRoles"] = 132] = "ClearAllRoles"; + RoleManagerCmd2[RoleManagerCmd2["ListRoles"] = 131] = "ListRoles"; + return RoleManagerCmd2; + })(RoleManagerCmd || {}); + var RoleManagerCmdPack; + ((RoleManagerCmdPack22) => { + RoleManagerCmdPack22.SetRole = "b[8] u8 s"; + RoleManagerCmdPack22.ListRoles = "b[12]"; + })(RoleManagerCmdPack || (RoleManagerCmdPack = {})); + var RoleManagerPipe = /* @__PURE__ */ ((RoleManagerPipe2) => { + })(RoleManagerPipe || {}); + var RoleManagerPipePack; + ((RoleManagerPipePack22) => { + RoleManagerPipePack22.Roles = "b[8] u32 u8 s"; + })(RoleManagerPipePack || (RoleManagerPipePack = {})); + var RoleManagerEvent = /* @__PURE__ */ ((RoleManagerEvent2) => { + RoleManagerEvent2[RoleManagerEvent2["Change"] = 3] = "Change"; + return RoleManagerEvent2; + })(RoleManagerEvent || {}); + var SRV_ROS = 354743340; + var RosCmd = /* @__PURE__ */ ((RosCmd2) => { + RosCmd2[RosCmd2["PublishMessage"] = 129] = "PublishMessage"; + RosCmd2[RosCmd2["SubscribeMessage"] = 130] = "SubscribeMessage"; + RosCmd2[RosCmd2["Message"] = 131] = "Message"; + return RosCmd2; + })(RosCmd || {}); + var RosCmdPack; + ((RosCmdPack22) => { + RosCmdPack22.PublishMessage = "z z s"; + RosCmdPack22.SubscribeMessage = "z s"; + RosCmdPack22.Message = "z z s"; + })(RosCmdPack || (RosCmdPack = {})); + var SRV_ROTARY_ENCODER = 284830153; + var RotaryEncoderReg = /* @__PURE__ */ ((RotaryEncoderReg2) => { + RotaryEncoderReg2[RotaryEncoderReg2["Position"] = 257] = "Position"; + RotaryEncoderReg2[RotaryEncoderReg2["ClicksPerTurn"] = 384] = "ClicksPerTurn"; + RotaryEncoderReg2[RotaryEncoderReg2["Clicker"] = 385] = "Clicker"; + return RotaryEncoderReg2; + })(RotaryEncoderReg || {}); + var RotaryEncoderRegPack; + ((RotaryEncoderRegPack22) => { + RotaryEncoderRegPack22.Position = "i32"; + RotaryEncoderRegPack22.ClicksPerTurn = "u16"; + RotaryEncoderRegPack22.Clicker = "u8"; + })(RotaryEncoderRegPack || (RotaryEncoderRegPack = {})); + var SRV_ROVER = 435474539; + var RoverReg = /* @__PURE__ */ ((RoverReg2) => { + RoverReg2[RoverReg2["Kinematics"] = 257] = "Kinematics"; + return RoverReg2; + })(RoverReg || {}); + var RoverRegPack; + ((RoverRegPack22) => { + RoverRegPack22.Kinematics = "i16.16 i16.16 i16.16 i16.16 i16.16"; + })(RoverRegPack || (RoverRegPack = {})); + var SRV_SAT_NAV = 433938742; + var SatNavReg = /* @__PURE__ */ ((SatNavReg2) => { + SatNavReg2[SatNavReg2["Position"] = 257] = "Position"; + SatNavReg2[SatNavReg2["Enabled"] = 1] = "Enabled"; + return SatNavReg2; + })(SatNavReg || {}); + var SatNavRegPack; + ((SatNavRegPack22) => { + SatNavRegPack22.Position = "u64 i9.23 i9.23 u16.16 i26.6 u16.16"; + SatNavRegPack22.Enabled = "u8"; + })(SatNavRegPack || (SatNavRegPack = {})); + var SatNavEvent = /* @__PURE__ */ ((SatNavEvent2) => { + SatNavEvent2[SatNavEvent2["Inactive"] = 2] = "Inactive"; + return SatNavEvent2; + })(SatNavEvent || {}); + var SRV_SENSOR_AGGREGATOR = 496034245; + var SensorAggregatorSampleType = /* @__PURE__ */ ((SensorAggregatorSampleType2) => { + SensorAggregatorSampleType2[SensorAggregatorSampleType2["U8"] = 8] = "U8"; + SensorAggregatorSampleType2[SensorAggregatorSampleType2["I8"] = 136] = "I8"; + SensorAggregatorSampleType2[SensorAggregatorSampleType2["U16"] = 16] = "U16"; + SensorAggregatorSampleType2[SensorAggregatorSampleType2["I16"] = 144] = "I16"; + SensorAggregatorSampleType2[SensorAggregatorSampleType2["U32"] = 32] = "U32"; + SensorAggregatorSampleType2[SensorAggregatorSampleType2["I32"] = 160] = "I32"; + return SensorAggregatorSampleType2; + })(SensorAggregatorSampleType || {}); + var SensorAggregatorReg = /* @__PURE__ */ ((SensorAggregatorReg2) => { + SensorAggregatorReg2[SensorAggregatorReg2["Inputs"] = 128] = "Inputs"; + SensorAggregatorReg2[SensorAggregatorReg2["NumSamples"] = 384] = "NumSamples"; + SensorAggregatorReg2[SensorAggregatorReg2["SampleSize"] = 385] = "SampleSize"; + SensorAggregatorReg2[SensorAggregatorReg2["StreamingSamples"] = 129] = "StreamingSamples"; + SensorAggregatorReg2[SensorAggregatorReg2["CurrentSample"] = 257] = "CurrentSample"; + return SensorAggregatorReg2; + })(SensorAggregatorReg || {}); + var SensorAggregatorRegPack; + ((SensorAggregatorRegPack22) => { + SensorAggregatorRegPack22.Inputs = "u16 u16 u32 r: b[8] u32 u8 u8 u8 i8"; + SensorAggregatorRegPack22.NumSamples = "u32"; + SensorAggregatorRegPack22.SampleSize = "u8"; + SensorAggregatorRegPack22.StreamingSamples = "u32"; + SensorAggregatorRegPack22.CurrentSample = "b"; + })(SensorAggregatorRegPack || (SensorAggregatorRegPack = {})); + var SRV_SERIAL = 297461188; + var SerialParityType = /* @__PURE__ */ ((SerialParityType2) => { + SerialParityType2[SerialParityType2["None"] = 0] = "None"; + SerialParityType2[SerialParityType2["Even"] = 1] = "Even"; + SerialParityType2[SerialParityType2["Odd"] = 2] = "Odd"; + return SerialParityType2; + })(SerialParityType || {}); + var SerialReg = /* @__PURE__ */ ((SerialReg2) => { + SerialReg2[SerialReg2["Connected"] = 1] = "Connected"; + SerialReg2[SerialReg2["ConnectionName"] = 385] = "ConnectionName"; + SerialReg2[SerialReg2["BaudRate"] = 128] = "BaudRate"; + SerialReg2[SerialReg2["DataBits"] = 129] = "DataBits"; + SerialReg2[SerialReg2["StopBits"] = 130] = "StopBits"; + SerialReg2[SerialReg2["ParityMode"] = 131] = "ParityMode"; + SerialReg2[SerialReg2["BufferSize"] = 132] = "BufferSize"; + return SerialReg2; + })(SerialReg || {}); + var SerialRegPack; + ((SerialRegPack22) => { + SerialRegPack22.Connected = "u8"; + SerialRegPack22.ConnectionName = "s"; + SerialRegPack22.BaudRate = "u32"; + SerialRegPack22.DataBits = "u8"; + SerialRegPack22.StopBits = "u8"; + SerialRegPack22.ParityMode = "u8"; + SerialRegPack22.BufferSize = "u8"; + })(SerialRegPack || (SerialRegPack = {})); + var SerialCmd = /* @__PURE__ */ ((SerialCmd2) => { + SerialCmd2[SerialCmd2["Send"] = 128] = "Send"; + SerialCmd2[SerialCmd2["Received"] = 128] = "Received"; + return SerialCmd2; + })(SerialCmd || {}); + var SerialCmdPack; + ((SerialCmdPack22) => { + SerialCmdPack22.Send = "b"; + SerialCmdPack22.Received = "b"; + })(SerialCmdPack || (SerialCmdPack = {})); + var SRV_SERVO = 318542083; + var ServoReg = /* @__PURE__ */ ((ServoReg2) => { + ServoReg2[ServoReg2["Angle"] = 2] = "Angle"; + ServoReg2[ServoReg2["Enabled"] = 1] = "Enabled"; + ServoReg2[ServoReg2["Offset"] = 129] = "Offset"; + ServoReg2[ServoReg2["MinAngle"] = 272] = "MinAngle"; + ServoReg2[ServoReg2["MinPulse"] = 131] = "MinPulse"; + ServoReg2[ServoReg2["MaxAngle"] = 273] = "MaxAngle"; + ServoReg2[ServoReg2["MaxPulse"] = 133] = "MaxPulse"; + ServoReg2[ServoReg2["StallTorque"] = 384] = "StallTorque"; + ServoReg2[ServoReg2["ResponseSpeed"] = 385] = "ResponseSpeed"; + ServoReg2[ServoReg2["ActualAngle"] = 257] = "ActualAngle"; + return ServoReg2; + })(ServoReg || {}); + var ServoRegPack; + ((ServoRegPack22) => { + ServoRegPack22.Angle = "i16.16"; + ServoRegPack22.Enabled = "u8"; + ServoRegPack22.Offset = "i16.16"; + ServoRegPack22.MinAngle = "i16.16"; + ServoRegPack22.MinPulse = "u16"; + ServoRegPack22.MaxAngle = "i16.16"; + ServoRegPack22.MaxPulse = "u16"; + ServoRegPack22.StallTorque = "u16.16"; + ServoRegPack22.ResponseSpeed = "u16.16"; + ServoRegPack22.ActualAngle = "i16.16"; + })(ServoRegPack || (ServoRegPack = {})); + var SRV_SETTINGS = 285727818; + var SettingsCmd = /* @__PURE__ */ ((SettingsCmd2) => { + SettingsCmd2[SettingsCmd2["Get"] = 128] = "Get"; + SettingsCmd2[SettingsCmd2["Set"] = 129] = "Set"; + SettingsCmd2[SettingsCmd2["Delete"] = 132] = "Delete"; + SettingsCmd2[SettingsCmd2["ListKeys"] = 130] = "ListKeys"; + SettingsCmd2[SettingsCmd2["List"] = 131] = "List"; + SettingsCmd2[SettingsCmd2["Clear"] = 133] = "Clear"; + return SettingsCmd2; + })(SettingsCmd || {}); + var SettingsCmdPack; + ((SettingsCmdPack22) => { + SettingsCmdPack22.Get = "s"; + SettingsCmdPack22.GetReport = "z b"; + SettingsCmdPack22.Set = "z b"; + SettingsCmdPack22.Delete = "s"; + SettingsCmdPack22.ListKeys = "b[12]"; + SettingsCmdPack22.List = "b[12]"; + })(SettingsCmdPack || (SettingsCmdPack = {})); + var SettingsPipe = /* @__PURE__ */ ((SettingsPipe2) => { + })(SettingsPipe || {}); + var SettingsPipePack; + ((SettingsPipePack22) => { + SettingsPipePack22.ListedKey = "s"; + SettingsPipePack22.ListedEntry = "z b"; + })(SettingsPipePack || (SettingsPipePack = {})); + var SettingsEvent = /* @__PURE__ */ ((SettingsEvent2) => { + SettingsEvent2[SettingsEvent2["Change"] = 3] = "Change"; + return SettingsEvent2; + })(SettingsEvent || {}); + var SRV_SEVEN_SEGMENT_DISPLAY = 425810167; + var SevenSegmentDisplayReg = /* @__PURE__ */ ((SevenSegmentDisplayReg2) => { + SevenSegmentDisplayReg2[SevenSegmentDisplayReg2["Digits"] = 2] = "Digits"; + SevenSegmentDisplayReg2[SevenSegmentDisplayReg2["Brightness"] = 1] = "Brightness"; + SevenSegmentDisplayReg2[SevenSegmentDisplayReg2["DoubleDots"] = 128] = "DoubleDots"; + SevenSegmentDisplayReg2[SevenSegmentDisplayReg2["DigitCount"] = 384] = "DigitCount"; + SevenSegmentDisplayReg2[SevenSegmentDisplayReg2["DecimalPoint"] = 385] = "DecimalPoint"; + return SevenSegmentDisplayReg2; + })(SevenSegmentDisplayReg || {}); + var SevenSegmentDisplayRegPack; + ((SevenSegmentDisplayRegPack22) => { + SevenSegmentDisplayRegPack22.Digits = "b"; + SevenSegmentDisplayRegPack22.Brightness = "u0.16"; + SevenSegmentDisplayRegPack22.DoubleDots = "u8"; + SevenSegmentDisplayRegPack22.DigitCount = "u8"; + SevenSegmentDisplayRegPack22.DecimalPoint = "u8"; + })(SevenSegmentDisplayRegPack || (SevenSegmentDisplayRegPack = {})); + var SevenSegmentDisplayCmd = /* @__PURE__ */ ((SevenSegmentDisplayCmd2) => { + SevenSegmentDisplayCmd2[SevenSegmentDisplayCmd2["SetNumber"] = 128] = "SetNumber"; + return SevenSegmentDisplayCmd2; + })(SevenSegmentDisplayCmd || {}); + var SevenSegmentDisplayCmdPack; + ((SevenSegmentDisplayCmdPack22) => { + SevenSegmentDisplayCmdPack22.SetNumber = "f64"; + })(SevenSegmentDisplayCmdPack || (SevenSegmentDisplayCmdPack = {})); + var SRV_SOIL_MOISTURE = 491430835; + var SoilMoistureVariant = /* @__PURE__ */ ((SoilMoistureVariant2) => { + SoilMoistureVariant2[SoilMoistureVariant2["Resistive"] = 1] = "Resistive"; + SoilMoistureVariant2[SoilMoistureVariant2["Capacitive"] = 2] = "Capacitive"; + return SoilMoistureVariant2; + })(SoilMoistureVariant || {}); + var SoilMoistureReg = /* @__PURE__ */ ((SoilMoistureReg2) => { + SoilMoistureReg2[SoilMoistureReg2["Moisture"] = 257] = "Moisture"; + SoilMoistureReg2[SoilMoistureReg2["MoistureError"] = 262] = "MoistureError"; + SoilMoistureReg2[SoilMoistureReg2["Variant"] = 263] = "Variant"; + return SoilMoistureReg2; + })(SoilMoistureReg || {}); + var SoilMoistureRegPack; + ((SoilMoistureRegPack22) => { + SoilMoistureRegPack22.Moisture = "u0.16"; + SoilMoistureRegPack22.MoistureError = "u0.16"; + SoilMoistureRegPack22.Variant = "u8"; + })(SoilMoistureRegPack || (SoilMoistureRegPack = {})); + var SRV_SOLENOID = 387392458; + var SolenoidVariant = /* @__PURE__ */ ((SolenoidVariant2) => { + SolenoidVariant2[SolenoidVariant2["PushPull"] = 1] = "PushPull"; + SolenoidVariant2[SolenoidVariant2["Valve"] = 2] = "Valve"; + SolenoidVariant2[SolenoidVariant2["Latch"] = 3] = "Latch"; + return SolenoidVariant2; + })(SolenoidVariant || {}); + var SolenoidReg = /* @__PURE__ */ ((SolenoidReg2) => { + SolenoidReg2[SolenoidReg2["Pulled"] = 1] = "Pulled"; + SolenoidReg2[SolenoidReg2["Variant"] = 263] = "Variant"; + return SolenoidReg2; + })(SolenoidReg || {}); + var SolenoidRegPack; + ((SolenoidRegPack22) => { + SolenoidRegPack22.Pulled = "u8"; + SolenoidRegPack22.Variant = "u8"; + })(SolenoidRegPack || (SolenoidRegPack = {})); + var SRV_SOUND_LEVEL = 346888797; + var SoundLevelReg = /* @__PURE__ */ ((SoundLevelReg2) => { + SoundLevelReg2[SoundLevelReg2["SoundLevel"] = 257] = "SoundLevel"; + SoundLevelReg2[SoundLevelReg2["Enabled"] = 1] = "Enabled"; + SoundLevelReg2[SoundLevelReg2["LoudThreshold"] = 6] = "LoudThreshold"; + SoundLevelReg2[SoundLevelReg2["QuietThreshold"] = 5] = "QuietThreshold"; + return SoundLevelReg2; + })(SoundLevelReg || {}); + var SoundLevelRegPack; + ((SoundLevelRegPack22) => { + SoundLevelRegPack22.SoundLevel = "u0.16"; + SoundLevelRegPack22.Enabled = "u8"; + SoundLevelRegPack22.LoudThreshold = "u0.16"; + SoundLevelRegPack22.QuietThreshold = "u0.16"; + })(SoundLevelRegPack || (SoundLevelRegPack = {})); + var SoundLevelEvent = /* @__PURE__ */ ((SoundLevelEvent2) => { + SoundLevelEvent2[SoundLevelEvent2["Loud"] = 1] = "Loud"; + SoundLevelEvent2[SoundLevelEvent2["Quiet"] = 2] = "Quiet"; + return SoundLevelEvent2; + })(SoundLevelEvent || {}); + var SRV_SOUND_PLAYER = 335795e3; + var SoundPlayerReg = /* @__PURE__ */ ((SoundPlayerReg2) => { + SoundPlayerReg2[SoundPlayerReg2["Volume"] = 1] = "Volume"; + return SoundPlayerReg2; + })(SoundPlayerReg || {}); + var SoundPlayerRegPack; + ((SoundPlayerRegPack22) => { + SoundPlayerRegPack22.Volume = "u0.16"; + })(SoundPlayerRegPack || (SoundPlayerRegPack = {})); + var SoundPlayerCmd = /* @__PURE__ */ ((SoundPlayerCmd2) => { + SoundPlayerCmd2[SoundPlayerCmd2["Play"] = 128] = "Play"; + SoundPlayerCmd2[SoundPlayerCmd2["Cancel"] = 129] = "Cancel"; + SoundPlayerCmd2[SoundPlayerCmd2["ListSounds"] = 130] = "ListSounds"; + return SoundPlayerCmd2; + })(SoundPlayerCmd || {}); + var SoundPlayerCmdPack; + ((SoundPlayerCmdPack22) => { + SoundPlayerCmdPack22.Play = "s"; + SoundPlayerCmdPack22.ListSounds = "b[12]"; + })(SoundPlayerCmdPack || (SoundPlayerCmdPack = {})); + var SoundPlayerPipe = /* @__PURE__ */ ((SoundPlayerPipe2) => { + })(SoundPlayerPipe || {}); + var SoundPlayerPipePack; + ((SoundPlayerPipePack22) => { + SoundPlayerPipePack22.ListSoundsPipe = "u32 s"; + })(SoundPlayerPipePack || (SoundPlayerPipePack = {})); + var SRV_SOUND_RECORDER_WITH_PLAYBACK = 460504912; + var SoundRecorderWithPlaybackStatus = /* @__PURE__ */ ((SoundRecorderWithPlaybackStatus2) => { + SoundRecorderWithPlaybackStatus2[SoundRecorderWithPlaybackStatus2["Idle"] = 0] = "Idle"; + SoundRecorderWithPlaybackStatus2[SoundRecorderWithPlaybackStatus2["Recording"] = 1] = "Recording"; + SoundRecorderWithPlaybackStatus2[SoundRecorderWithPlaybackStatus2["Playing"] = 2] = "Playing"; + return SoundRecorderWithPlaybackStatus2; + })(SoundRecorderWithPlaybackStatus || {}); + var SoundRecorderWithPlaybackCmd = /* @__PURE__ */ ((SoundRecorderWithPlaybackCmd2) => { + SoundRecorderWithPlaybackCmd2[SoundRecorderWithPlaybackCmd2["Play"] = 128] = "Play"; + SoundRecorderWithPlaybackCmd2[SoundRecorderWithPlaybackCmd2["Record"] = 129] = "Record"; + SoundRecorderWithPlaybackCmd2[SoundRecorderWithPlaybackCmd2["Cancel"] = 130] = "Cancel"; + return SoundRecorderWithPlaybackCmd2; + })(SoundRecorderWithPlaybackCmd || {}); + var SoundRecorderWithPlaybackCmdPack; + ((SoundRecorderWithPlaybackCmdPack22) => { + SoundRecorderWithPlaybackCmdPack22.Record = "u16"; + })(SoundRecorderWithPlaybackCmdPack || (SoundRecorderWithPlaybackCmdPack = {})); + var SoundRecorderWithPlaybackReg = /* @__PURE__ */ ((SoundRecorderWithPlaybackReg2) => { + SoundRecorderWithPlaybackReg2[SoundRecorderWithPlaybackReg2["Status"] = 384] = "Status"; + SoundRecorderWithPlaybackReg2[SoundRecorderWithPlaybackReg2["Time"] = 385] = "Time"; + SoundRecorderWithPlaybackReg2[SoundRecorderWithPlaybackReg2["Volume"] = 1] = "Volume"; + return SoundRecorderWithPlaybackReg2; + })(SoundRecorderWithPlaybackReg || {}); + var SoundRecorderWithPlaybackRegPack; + ((SoundRecorderWithPlaybackRegPack22) => { + SoundRecorderWithPlaybackRegPack22.Status = "u8"; + SoundRecorderWithPlaybackRegPack22.Time = "u16"; + SoundRecorderWithPlaybackRegPack22.Volume = "u0.8"; + })(SoundRecorderWithPlaybackRegPack || (SoundRecorderWithPlaybackRegPack = {})); + var SRV_SOUND_SPECTRUM = 360365086; + var SoundSpectrumReg = /* @__PURE__ */ ((SoundSpectrumReg2) => { + SoundSpectrumReg2[SoundSpectrumReg2["FrequencyBins"] = 257] = "FrequencyBins"; + SoundSpectrumReg2[SoundSpectrumReg2["Enabled"] = 1] = "Enabled"; + SoundSpectrumReg2[SoundSpectrumReg2["FftPow2Size"] = 128] = "FftPow2Size"; + SoundSpectrumReg2[SoundSpectrumReg2["MinDecibels"] = 129] = "MinDecibels"; + SoundSpectrumReg2[SoundSpectrumReg2["MaxDecibels"] = 130] = "MaxDecibels"; + SoundSpectrumReg2[SoundSpectrumReg2["SmoothingTimeConstant"] = 131] = "SmoothingTimeConstant"; + return SoundSpectrumReg2; + })(SoundSpectrumReg || {}); + var SoundSpectrumRegPack; + ((SoundSpectrumRegPack22) => { + SoundSpectrumRegPack22.FrequencyBins = "b"; + SoundSpectrumRegPack22.Enabled = "u8"; + SoundSpectrumRegPack22.FftPow2Size = "u8"; + SoundSpectrumRegPack22.MinDecibels = "i16"; + SoundSpectrumRegPack22.MaxDecibels = "i16"; + SoundSpectrumRegPack22.SmoothingTimeConstant = "u0.8"; + })(SoundSpectrumRegPack || (SoundSpectrumRegPack = {})); + var SRV_SPEECH_SYNTHESIS = 302307733; + var SpeechSynthesisReg = /* @__PURE__ */ ((SpeechSynthesisReg2) => { + SpeechSynthesisReg2[SpeechSynthesisReg2["Enabled"] = 1] = "Enabled"; + SpeechSynthesisReg2[SpeechSynthesisReg2["Lang"] = 128] = "Lang"; + SpeechSynthesisReg2[SpeechSynthesisReg2["Volume"] = 129] = "Volume"; + SpeechSynthesisReg2[SpeechSynthesisReg2["Pitch"] = 130] = "Pitch"; + SpeechSynthesisReg2[SpeechSynthesisReg2["Rate"] = 131] = "Rate"; + return SpeechSynthesisReg2; + })(SpeechSynthesisReg || {}); + var SpeechSynthesisRegPack; + ((SpeechSynthesisRegPack22) => { + SpeechSynthesisRegPack22.Enabled = "u8"; + SpeechSynthesisRegPack22.Lang = "s"; + SpeechSynthesisRegPack22.Volume = "u0.8"; + SpeechSynthesisRegPack22.Pitch = "u16.16"; + SpeechSynthesisRegPack22.Rate = "u16.16"; + })(SpeechSynthesisRegPack || (SpeechSynthesisRegPack = {})); + var SpeechSynthesisCmd = /* @__PURE__ */ ((SpeechSynthesisCmd2) => { + SpeechSynthesisCmd2[SpeechSynthesisCmd2["Speak"] = 128] = "Speak"; + SpeechSynthesisCmd2[SpeechSynthesisCmd2["Cancel"] = 129] = "Cancel"; + return SpeechSynthesisCmd2; + })(SpeechSynthesisCmd || {}); + var SpeechSynthesisCmdPack; + ((SpeechSynthesisCmdPack22) => { + SpeechSynthesisCmdPack22.Speak = "s"; + })(SpeechSynthesisCmdPack || (SpeechSynthesisCmdPack = {})); + var SRV_SWITCH = 450008066; + var SwitchVariant = /* @__PURE__ */ ((SwitchVariant2) => { + SwitchVariant2[SwitchVariant2["Slide"] = 1] = "Slide"; + SwitchVariant2[SwitchVariant2["Tilt"] = 2] = "Tilt"; + SwitchVariant2[SwitchVariant2["PushButton"] = 3] = "PushButton"; + SwitchVariant2[SwitchVariant2["Tactile"] = 4] = "Tactile"; + SwitchVariant2[SwitchVariant2["Toggle"] = 5] = "Toggle"; + SwitchVariant2[SwitchVariant2["Proximity"] = 6] = "Proximity"; + SwitchVariant2[SwitchVariant2["Magnetic"] = 7] = "Magnetic"; + SwitchVariant2[SwitchVariant2["FootButton"] = 8] = "FootButton"; + return SwitchVariant2; + })(SwitchVariant || {}); + var SwitchReg = /* @__PURE__ */ ((SwitchReg2) => { + SwitchReg2[SwitchReg2["Active"] = 257] = "Active"; + SwitchReg2[SwitchReg2["Variant"] = 263] = "Variant"; + return SwitchReg2; + })(SwitchReg || {}); + var SwitchRegPack; + ((SwitchRegPack22) => { + SwitchRegPack22.Active = "u8"; + SwitchRegPack22.Variant = "u8"; + })(SwitchRegPack || (SwitchRegPack = {})); + var SwitchEvent = /* @__PURE__ */ ((SwitchEvent2) => { + SwitchEvent2[SwitchEvent2["On"] = 1] = "On"; + SwitchEvent2[SwitchEvent2["Off"] = 2] = "Off"; + return SwitchEvent2; + })(SwitchEvent || {}); + var SRV_TCP = 457422603; + var TcpTcpError = /* @__PURE__ */ ((TcpTcpError2) => { + TcpTcpError2[TcpTcpError2["InvalidCommand"] = 1] = "InvalidCommand"; + TcpTcpError2[TcpTcpError2["InvalidCommandPayload"] = 2] = "InvalidCommandPayload"; + return TcpTcpError2; + })(TcpTcpError || {}); + var TcpCmd = /* @__PURE__ */ ((TcpCmd2) => { + TcpCmd2[TcpCmd2["Open"] = 128] = "Open"; + return TcpCmd2; + })(TcpCmd || {}); + var TcpCmdPack; + ((TcpCmdPack22) => { + TcpCmdPack22.Open = "b[12]"; + TcpCmdPack22.OpenReport = "u16"; + })(TcpCmdPack || (TcpCmdPack = {})); + var TcpPipeCmd = /* @__PURE__ */ ((TcpPipeCmd2) => { + TcpPipeCmd2[TcpPipeCmd2["OpenSsl"] = 1] = "OpenSsl"; + TcpPipeCmd2[TcpPipeCmd2["Error"] = 0] = "Error"; + return TcpPipeCmd2; + })(TcpPipeCmd || {}); + var TcpPipeCmdPack; + ((TcpPipeCmdPack22) => { + TcpPipeCmdPack22.OpenSsl = "u16 s"; + TcpPipeCmdPack22.Error = "i32"; + })(TcpPipeCmdPack || (TcpPipeCmdPack = {})); + var TcpPipe = /* @__PURE__ */ ((TcpPipe2) => { + })(TcpPipe || {}); + var TcpPipePack; + ((TcpPipePack22) => { + TcpPipePack22.Outdata = "b"; + TcpPipePack22.Indata = "b"; + })(TcpPipePack || (TcpPipePack = {})); + var SRV_TEMPERATURE = 337754823; + var TemperatureVariant = /* @__PURE__ */ ((TemperatureVariant2) => { + TemperatureVariant2[TemperatureVariant2["Outdoor"] = 1] = "Outdoor"; + TemperatureVariant2[TemperatureVariant2["Indoor"] = 2] = "Indoor"; + TemperatureVariant2[TemperatureVariant2["Body"] = 3] = "Body"; + return TemperatureVariant2; + })(TemperatureVariant || {}); + var TemperatureReg = /* @__PURE__ */ ((TemperatureReg2) => { + TemperatureReg2[TemperatureReg2["Temperature"] = 257] = "Temperature"; + TemperatureReg2[TemperatureReg2["MinTemperature"] = 260] = "MinTemperature"; + TemperatureReg2[TemperatureReg2["MaxTemperature"] = 261] = "MaxTemperature"; + TemperatureReg2[TemperatureReg2["TemperatureError"] = 262] = "TemperatureError"; + TemperatureReg2[TemperatureReg2["Variant"] = 263] = "Variant"; + return TemperatureReg2; + })(TemperatureReg || {}); + var TemperatureRegPack; + ((TemperatureRegPack22) => { + TemperatureRegPack22.Temperature = "i22.10"; + TemperatureRegPack22.MinTemperature = "i22.10"; + TemperatureRegPack22.MaxTemperature = "i22.10"; + TemperatureRegPack22.TemperatureError = "u22.10"; + TemperatureRegPack22.Variant = "u8"; + })(TemperatureRegPack || (TemperatureRegPack = {})); + var SRV_TIMESERIES_AGGREGATOR = 294829516; + var TimeseriesAggregatorCmd = /* @__PURE__ */ ((TimeseriesAggregatorCmd2) => { + TimeseriesAggregatorCmd2[TimeseriesAggregatorCmd2["Clear"] = 128] = "Clear"; + TimeseriesAggregatorCmd2[TimeseriesAggregatorCmd2["Update"] = 131] = "Update"; + TimeseriesAggregatorCmd2[TimeseriesAggregatorCmd2["SetWindow"] = 132] = "SetWindow"; + TimeseriesAggregatorCmd2[TimeseriesAggregatorCmd2["SetUpload"] = 133] = "SetUpload"; + TimeseriesAggregatorCmd2[TimeseriesAggregatorCmd2["Stored"] = 144] = "Stored"; + return TimeseriesAggregatorCmd2; + })(TimeseriesAggregatorCmd || {}); + var TimeseriesAggregatorCmdPack; + ((TimeseriesAggregatorCmdPack22) => { + TimeseriesAggregatorCmdPack22.Update = "f64 s"; + TimeseriesAggregatorCmdPack22.SetWindow = "u32 s"; + TimeseriesAggregatorCmdPack22.SetUpload = "u8 s"; + TimeseriesAggregatorCmdPack22.Stored = "u32 b[4] f64 f64 f64 u32 u32 s"; + })(TimeseriesAggregatorCmdPack || (TimeseriesAggregatorCmdPack = {})); + var TimeseriesAggregatorReg = /* @__PURE__ */ ((TimeseriesAggregatorReg2) => { + TimeseriesAggregatorReg2[TimeseriesAggregatorReg2["Now"] = 384] = "Now"; + TimeseriesAggregatorReg2[TimeseriesAggregatorReg2["FastStart"] = 128] = "FastStart"; + TimeseriesAggregatorReg2[TimeseriesAggregatorReg2["DefaultWindow"] = 129] = "DefaultWindow"; + TimeseriesAggregatorReg2[TimeseriesAggregatorReg2["DefaultUpload"] = 130] = "DefaultUpload"; + TimeseriesAggregatorReg2[TimeseriesAggregatorReg2["UploadUnlabelled"] = 131] = "UploadUnlabelled"; + TimeseriesAggregatorReg2[TimeseriesAggregatorReg2["SensorWatchdogPeriod"] = 132] = "SensorWatchdogPeriod"; + return TimeseriesAggregatorReg2; + })(TimeseriesAggregatorReg || {}); + var TimeseriesAggregatorRegPack; + ((TimeseriesAggregatorRegPack22) => { + TimeseriesAggregatorRegPack22.Now = "u32"; + TimeseriesAggregatorRegPack22.FastStart = "u8"; + TimeseriesAggregatorRegPack22.DefaultWindow = "u32"; + TimeseriesAggregatorRegPack22.DefaultUpload = "u8"; + TimeseriesAggregatorRegPack22.UploadUnlabelled = "u8"; + TimeseriesAggregatorRegPack22.SensorWatchdogPeriod = "u32"; + })(TimeseriesAggregatorRegPack || (TimeseriesAggregatorRegPack = {})); + var SRV_TRAFFIC_LIGHT = 365137307; + var TrafficLightReg = /* @__PURE__ */ ((TrafficLightReg2) => { + TrafficLightReg2[TrafficLightReg2["Red"] = 128] = "Red"; + TrafficLightReg2[TrafficLightReg2["Yellow"] = 129] = "Yellow"; + TrafficLightReg2[TrafficLightReg2["Green"] = 130] = "Green"; + return TrafficLightReg2; + })(TrafficLightReg || {}); + var TrafficLightRegPack; + ((TrafficLightRegPack22) => { + TrafficLightRegPack22.Red = "u8"; + TrafficLightRegPack22.Yellow = "u8"; + TrafficLightRegPack22.Green = "u8"; + })(TrafficLightRegPack || (TrafficLightRegPack = {})); + var SRV_TVOC = 312849815; + var TvocReg = /* @__PURE__ */ ((TvocReg2) => { + TvocReg2[TvocReg2["TVOC"] = 257] = "TVOC"; + TvocReg2[TvocReg2["TVOCError"] = 262] = "TVOCError"; + TvocReg2[TvocReg2["MinTVOC"] = 260] = "MinTVOC"; + TvocReg2[TvocReg2["MaxTVOC"] = 261] = "MaxTVOC"; + return TvocReg2; + })(TvocReg || {}); + var TvocRegPack; + ((TvocRegPack22) => { + TvocRegPack22.TVOC = "u22.10"; + TvocRegPack22.TVOCError = "u22.10"; + TvocRegPack22.MinTVOC = "u22.10"; + TvocRegPack22.MaxTVOC = "u22.10"; + })(TvocRegPack || (TvocRegPack = {})); + var SRV_UNIQUE_BRAIN = 272387813; + var SRV_USB_BRIDGE = 418781770; + var UsbBridgeQByte = /* @__PURE__ */ ((UsbBridgeQByte2) => { + UsbBridgeQByte2[UsbBridgeQByte2["Magic"] = 254] = "Magic"; + UsbBridgeQByte2[UsbBridgeQByte2["LiteralMagic"] = 248] = "LiteralMagic"; + UsbBridgeQByte2[UsbBridgeQByte2["Reserved"] = 249] = "Reserved"; + UsbBridgeQByte2[UsbBridgeQByte2["SerialGap"] = 250] = "SerialGap"; + UsbBridgeQByte2[UsbBridgeQByte2["FrameGap"] = 251] = "FrameGap"; + UsbBridgeQByte2[UsbBridgeQByte2["FrameStart"] = 252] = "FrameStart"; + UsbBridgeQByte2[UsbBridgeQByte2["FrameEnd"] = 253] = "FrameEnd"; + return UsbBridgeQByte2; + })(UsbBridgeQByte || {}); + var UsbBridgeCmd = /* @__PURE__ */ ((UsbBridgeCmd2) => { + UsbBridgeCmd2[UsbBridgeCmd2["DisablePackets"] = 128] = "DisablePackets"; + UsbBridgeCmd2[UsbBridgeCmd2["EnablePackets"] = 129] = "EnablePackets"; + UsbBridgeCmd2[UsbBridgeCmd2["DisableLog"] = 130] = "DisableLog"; + UsbBridgeCmd2[UsbBridgeCmd2["EnableLog"] = 131] = "EnableLog"; + return UsbBridgeCmd2; + })(UsbBridgeCmd || {}); + var SRV_UV_INDEX = 527306128; + var UvIndexVariant = /* @__PURE__ */ ((UvIndexVariant2) => { + UvIndexVariant2[UvIndexVariant2["UVA_UVB"] = 1] = "UVA_UVB"; + UvIndexVariant2[UvIndexVariant2["Visible_IR"] = 2] = "Visible_IR"; + return UvIndexVariant2; + })(UvIndexVariant || {}); + var UvIndexReg = /* @__PURE__ */ ((UvIndexReg2) => { + UvIndexReg2[UvIndexReg2["UvIndex"] = 257] = "UvIndex"; + UvIndexReg2[UvIndexReg2["UvIndexError"] = 262] = "UvIndexError"; + UvIndexReg2[UvIndexReg2["Variant"] = 263] = "Variant"; + return UvIndexReg2; + })(UvIndexReg || {}); + var UvIndexRegPack; + ((UvIndexRegPack22) => { + UvIndexRegPack22.UvIndex = "u16.16"; + UvIndexRegPack22.UvIndexError = "u16.16"; + UvIndexRegPack22.Variant = "u8"; + })(UvIndexRegPack || (UvIndexRegPack = {})); + var SRV_VERIFIED_TELEMETRY = 563381279; + var VerifiedTelemetryStatus = /* @__PURE__ */ ((VerifiedTelemetryStatus2) => { + VerifiedTelemetryStatus2[VerifiedTelemetryStatus2["Unknown"] = 0] = "Unknown"; + VerifiedTelemetryStatus2[VerifiedTelemetryStatus2["Working"] = 1] = "Working"; + VerifiedTelemetryStatus2[VerifiedTelemetryStatus2["Faulty"] = 2] = "Faulty"; + return VerifiedTelemetryStatus2; + })(VerifiedTelemetryStatus || {}); + var VerifiedTelemetryFingerprintType = /* @__PURE__ */ ((VerifiedTelemetryFingerprintType2) => { + VerifiedTelemetryFingerprintType2[VerifiedTelemetryFingerprintType2["FallCurve"] = 1] = "FallCurve"; + VerifiedTelemetryFingerprintType2[VerifiedTelemetryFingerprintType2["CurrentSense"] = 2] = "CurrentSense"; + VerifiedTelemetryFingerprintType2[VerifiedTelemetryFingerprintType2["Custom"] = 3] = "Custom"; + return VerifiedTelemetryFingerprintType2; + })(VerifiedTelemetryFingerprintType || {}); + var VerifiedTelemetryReg = /* @__PURE__ */ ((VerifiedTelemetryReg2) => { + VerifiedTelemetryReg2[VerifiedTelemetryReg2["TelemetryStatus"] = 384] = "TelemetryStatus"; + VerifiedTelemetryReg2[VerifiedTelemetryReg2["TelemetryStatusInterval"] = 128] = "TelemetryStatusInterval"; + VerifiedTelemetryReg2[VerifiedTelemetryReg2["FingerprintType"] = 385] = "FingerprintType"; + VerifiedTelemetryReg2[VerifiedTelemetryReg2["FingerprintTemplate"] = 386] = "FingerprintTemplate"; + return VerifiedTelemetryReg2; + })(VerifiedTelemetryReg || {}); + var VerifiedTelemetryRegPack; + ((VerifiedTelemetryRegPack22) => { + VerifiedTelemetryRegPack22.TelemetryStatus = "u8"; + VerifiedTelemetryRegPack22.TelemetryStatusInterval = "u32"; + VerifiedTelemetryRegPack22.FingerprintType = "u8"; + VerifiedTelemetryRegPack22.FingerprintTemplate = "u16 b"; + })(VerifiedTelemetryRegPack || (VerifiedTelemetryRegPack = {})); + var VerifiedTelemetryCmd = /* @__PURE__ */ ((VerifiedTelemetryCmd2) => { + VerifiedTelemetryCmd2[VerifiedTelemetryCmd2["ResetFingerprintTemplate"] = 128] = "ResetFingerprintTemplate"; + VerifiedTelemetryCmd2[VerifiedTelemetryCmd2["RetrainFingerprintTemplate"] = 129] = "RetrainFingerprintTemplate"; + return VerifiedTelemetryCmd2; + })(VerifiedTelemetryCmd || {}); + var VerifiedTelemetryEvent = /* @__PURE__ */ ((VerifiedTelemetryEvent2) => { + VerifiedTelemetryEvent2[VerifiedTelemetryEvent2["TelemetryStatusChange"] = 3] = "TelemetryStatusChange"; + VerifiedTelemetryEvent2[VerifiedTelemetryEvent2["FingerprintTemplateChange"] = 128] = "FingerprintTemplateChange"; + return VerifiedTelemetryEvent2; + })(VerifiedTelemetryEvent || {}); + var VerifiedTelemetryEventPack; + ((VerifiedTelemetryEventPack22) => { + VerifiedTelemetryEventPack22.TelemetryStatusChange = "u8"; + })(VerifiedTelemetryEventPack || (VerifiedTelemetryEventPack = {})); + var SRV_VIBRATION_MOTOR = 406832290; + var VibrationMotorCmd = /* @__PURE__ */ ((VibrationMotorCmd2) => { + VibrationMotorCmd2[VibrationMotorCmd2["Vibrate"] = 128] = "Vibrate"; + return VibrationMotorCmd2; + })(VibrationMotorCmd || {}); + var VibrationMotorCmdPack; + ((VibrationMotorCmdPack22) => { + VibrationMotorCmdPack22.Vibrate = "r: u8 u0.8"; + })(VibrationMotorCmdPack || (VibrationMotorCmdPack = {})); + var VibrationMotorReg = /* @__PURE__ */ ((VibrationMotorReg2) => { + VibrationMotorReg2[VibrationMotorReg2["MaxVibrations"] = 384] = "MaxVibrations"; + return VibrationMotorReg2; + })(VibrationMotorReg || {}); + var VibrationMotorRegPack; + ((VibrationMotorRegPack22) => { + VibrationMotorRegPack22.MaxVibrations = "u8"; + })(VibrationMotorRegPack || (VibrationMotorRegPack = {})); + var SRV_WATER_LEVEL = 343630573; + var WaterLevelVariant = /* @__PURE__ */ ((WaterLevelVariant2) => { + WaterLevelVariant2[WaterLevelVariant2["Resistive"] = 1] = "Resistive"; + WaterLevelVariant2[WaterLevelVariant2["ContactPhotoElectric"] = 2] = "ContactPhotoElectric"; + WaterLevelVariant2[WaterLevelVariant2["NonContactPhotoElectric"] = 3] = "NonContactPhotoElectric"; + return WaterLevelVariant2; + })(WaterLevelVariant || {}); + var WaterLevelReg = /* @__PURE__ */ ((WaterLevelReg2) => { + WaterLevelReg2[WaterLevelReg2["Level"] = 257] = "Level"; + WaterLevelReg2[WaterLevelReg2["LevelError"] = 262] = "LevelError"; + WaterLevelReg2[WaterLevelReg2["Variant"] = 263] = "Variant"; + return WaterLevelReg2; + })(WaterLevelReg || {}); + var WaterLevelRegPack; + ((WaterLevelRegPack22) => { + WaterLevelRegPack22.Level = "u0.16"; + WaterLevelRegPack22.LevelError = "u0.16"; + WaterLevelRegPack22.Variant = "u8"; + })(WaterLevelRegPack || (WaterLevelRegPack = {})); + var SRV_WEIGHT_SCALE = 525160512; + var WeightScaleVariant = /* @__PURE__ */ ((WeightScaleVariant2) => { + WeightScaleVariant2[WeightScaleVariant2["Body"] = 1] = "Body"; + WeightScaleVariant2[WeightScaleVariant2["Food"] = 2] = "Food"; + WeightScaleVariant2[WeightScaleVariant2["Jewelry"] = 3] = "Jewelry"; + return WeightScaleVariant2; + })(WeightScaleVariant || {}); + var WeightScaleReg = /* @__PURE__ */ ((WeightScaleReg2) => { + WeightScaleReg2[WeightScaleReg2["Weight"] = 257] = "Weight"; + WeightScaleReg2[WeightScaleReg2["WeightError"] = 262] = "WeightError"; + WeightScaleReg2[WeightScaleReg2["ZeroOffset"] = 128] = "ZeroOffset"; + WeightScaleReg2[WeightScaleReg2["Gain"] = 129] = "Gain"; + WeightScaleReg2[WeightScaleReg2["MaxWeight"] = 261] = "MaxWeight"; + WeightScaleReg2[WeightScaleReg2["MinWeight"] = 260] = "MinWeight"; + WeightScaleReg2[WeightScaleReg2["WeightResolution"] = 264] = "WeightResolution"; + WeightScaleReg2[WeightScaleReg2["Variant"] = 263] = "Variant"; + return WeightScaleReg2; + })(WeightScaleReg || {}); + var WeightScaleRegPack; + ((WeightScaleRegPack22) => { + WeightScaleRegPack22.Weight = "u16.16"; + WeightScaleRegPack22.WeightError = "u16.16"; + WeightScaleRegPack22.ZeroOffset = "u16.16"; + WeightScaleRegPack22.Gain = "u16.16"; + WeightScaleRegPack22.MaxWeight = "u16.16"; + WeightScaleRegPack22.MinWeight = "u16.16"; + WeightScaleRegPack22.WeightResolution = "u16.16"; + WeightScaleRegPack22.Variant = "u8"; + })(WeightScaleRegPack || (WeightScaleRegPack = {})); + var WeightScaleCmd = /* @__PURE__ */ ((WeightScaleCmd2) => { + WeightScaleCmd2[WeightScaleCmd2["CalibrateZeroOffset"] = 128] = "CalibrateZeroOffset"; + WeightScaleCmd2[WeightScaleCmd2["CalibrateGain"] = 129] = "CalibrateGain"; + return WeightScaleCmd2; + })(WeightScaleCmd || {}); + var WeightScaleCmdPack; + ((WeightScaleCmdPack22) => { + WeightScaleCmdPack22.CalibrateGain = "u22.10"; + })(WeightScaleCmdPack || (WeightScaleCmdPack = {})); + var SRV_WIFI = 413852154; + var WifiAPFlags = /* @__PURE__ */ ((WifiAPFlags2) => { + WifiAPFlags2[WifiAPFlags2["HasPassword"] = 1] = "HasPassword"; + WifiAPFlags2[WifiAPFlags2["WPS"] = 2] = "WPS"; + WifiAPFlags2[WifiAPFlags2["HasSecondaryChannelAbove"] = 4] = "HasSecondaryChannelAbove"; + WifiAPFlags2[WifiAPFlags2["HasSecondaryChannelBelow"] = 8] = "HasSecondaryChannelBelow"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_11B"] = 256] = "IEEE_802_11B"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_11A"] = 512] = "IEEE_802_11A"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_11G"] = 1024] = "IEEE_802_11G"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_11N"] = 2048] = "IEEE_802_11N"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_11AC"] = 4096] = "IEEE_802_11AC"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_11AX"] = 8192] = "IEEE_802_11AX"; + WifiAPFlags2[WifiAPFlags2["IEEE_802_LongRange"] = 32768] = "IEEE_802_LongRange"; + return WifiAPFlags2; + })(WifiAPFlags || {}); + var WifiCmd = /* @__PURE__ */ ((WifiCmd2) => { + WifiCmd2[WifiCmd2["LastScanResults"] = 128] = "LastScanResults"; + WifiCmd2[WifiCmd2["AddNetwork"] = 129] = "AddNetwork"; + WifiCmd2[WifiCmd2["Reconnect"] = 130] = "Reconnect"; + WifiCmd2[WifiCmd2["ForgetNetwork"] = 131] = "ForgetNetwork"; + WifiCmd2[WifiCmd2["ForgetAllNetworks"] = 132] = "ForgetAllNetworks"; + WifiCmd2[WifiCmd2["SetNetworkPriority"] = 133] = "SetNetworkPriority"; + WifiCmd2[WifiCmd2["Scan"] = 134] = "Scan"; + WifiCmd2[WifiCmd2["ListKnownNetworks"] = 135] = "ListKnownNetworks"; + return WifiCmd2; + })(WifiCmd || {}); + var WifiCmdPack; + ((WifiCmdPack22) => { + WifiCmdPack22.LastScanResults = "b[12]"; + WifiCmdPack22.AddNetwork = "z z"; + WifiCmdPack22.ForgetNetwork = "s"; + WifiCmdPack22.SetNetworkPriority = "i16 s"; + WifiCmdPack22.ListKnownNetworks = "b[12]"; + })(WifiCmdPack || (WifiCmdPack = {})); + var WifiPipe = /* @__PURE__ */ ((WifiPipe2) => { + })(WifiPipe || {}); + var WifiPipePack; + ((WifiPipePack22) => { + WifiPipePack22.Results = "u32 u32 i8 u8 b[6] s[33]"; + WifiPipePack22.NetworkResults = "i16 i16 s"; + })(WifiPipePack || (WifiPipePack = {})); + var WifiReg = /* @__PURE__ */ ((WifiReg2) => { + WifiReg2[WifiReg2["Rssi"] = 257] = "Rssi"; + WifiReg2[WifiReg2["Enabled"] = 1] = "Enabled"; + WifiReg2[WifiReg2["IpAddress"] = 385] = "IpAddress"; + WifiReg2[WifiReg2["Eui48"] = 386] = "Eui48"; + WifiReg2[WifiReg2["Ssid"] = 387] = "Ssid"; + return WifiReg2; + })(WifiReg || {}); + var WifiRegPack; + ((WifiRegPack22) => { + WifiRegPack22.Rssi = "i8"; + WifiRegPack22.Enabled = "u8"; + WifiRegPack22.IpAddress = "b[16]"; + WifiRegPack22.Eui48 = "b[6]"; + WifiRegPack22.Ssid = "s[32]"; + })(WifiRegPack || (WifiRegPack = {})); + var WifiEvent = /* @__PURE__ */ ((WifiEvent2) => { + WifiEvent2[WifiEvent2["GotIp"] = 1] = "GotIp"; + WifiEvent2[WifiEvent2["LostIp"] = 2] = "LostIp"; + WifiEvent2[WifiEvent2["ScanComplete"] = 128] = "ScanComplete"; + WifiEvent2[WifiEvent2["NetworksChanged"] = 129] = "NetworksChanged"; + WifiEvent2[WifiEvent2["ConnectionFailed"] = 130] = "ConnectionFailed"; + return WifiEvent2; + })(WifiEvent || {}); + var WifiEventPack; + ((WifiEventPack22) => { + WifiEventPack22.ScanComplete = "u16 u16"; + WifiEventPack22.ConnectionFailed = "s"; + })(WifiEventPack || (WifiEventPack = {})); + var SRV_WIND_DIRECTION = 409725227; + var WindDirectionReg = /* @__PURE__ */ ((WindDirectionReg2) => { + WindDirectionReg2[WindDirectionReg2["WindDirection"] = 257] = "WindDirection"; + WindDirectionReg2[WindDirectionReg2["WindDirectionError"] = 262] = "WindDirectionError"; + return WindDirectionReg2; + })(WindDirectionReg || {}); + var WindDirectionRegPack; + ((WindDirectionRegPack22) => { + WindDirectionRegPack22.WindDirection = "u16"; + WindDirectionRegPack22.WindDirectionError = "u16"; + })(WindDirectionRegPack || (WindDirectionRegPack = {})); + var SRV_WIND_SPEED = 458824639; + var WindSpeedReg = /* @__PURE__ */ ((WindSpeedReg2) => { + WindSpeedReg2[WindSpeedReg2["WindSpeed"] = 257] = "WindSpeed"; + WindSpeedReg2[WindSpeedReg2["WindSpeedError"] = 262] = "WindSpeedError"; + WindSpeedReg2[WindSpeedReg2["MaxWindSpeed"] = 261] = "MaxWindSpeed"; + return WindSpeedReg2; + })(WindSpeedReg || {}); + var WindSpeedRegPack; + ((WindSpeedRegPack22) => { + WindSpeedRegPack22.WindSpeed = "u16.16"; + WindSpeedRegPack22.WindSpeedError = "u16.16"; + WindSpeedRegPack22.MaxWindSpeed = "u16.16"; + })(WindSpeedRegPack || (WindSpeedRegPack = {})); + var SRV_WSSK = 330775038; + var WsskStreamingType = /* @__PURE__ */ ((WsskStreamingType2) => { + WsskStreamingType2[WsskStreamingType2["Jacdac"] = 1] = "Jacdac"; + WsskStreamingType2[WsskStreamingType2["Dmesg"] = 2] = "Dmesg"; + WsskStreamingType2[WsskStreamingType2["Exceptions"] = 256] = "Exceptions"; + WsskStreamingType2[WsskStreamingType2["TemporaryMask"] = 255] = "TemporaryMask"; + WsskStreamingType2[WsskStreamingType2["PermamentMask"] = 65280] = "PermamentMask"; + WsskStreamingType2[WsskStreamingType2["DefaultMask"] = 256] = "DefaultMask"; + return WsskStreamingType2; + })(WsskStreamingType || {}); + var WsskDataType = /* @__PURE__ */ ((WsskDataType2) => { + WsskDataType2[WsskDataType2["Binary"] = 1] = "Binary"; + WsskDataType2[WsskDataType2["JSON"] = 2] = "JSON"; + return WsskDataType2; + })(WsskDataType || {}); + var WsskCmd = /* @__PURE__ */ ((WsskCmd2) => { + WsskCmd2[WsskCmd2["Error"] = 255] = "Error"; + WsskCmd2[WsskCmd2["SetStreaming"] = 144] = "SetStreaming"; + WsskCmd2[WsskCmd2["PingDevice"] = 145] = "PingDevice"; + WsskCmd2[WsskCmd2["PingCloud"] = 146] = "PingCloud"; + WsskCmd2[WsskCmd2["GetHash"] = 147] = "GetHash"; + WsskCmd2[WsskCmd2["DeployStart"] = 148] = "DeployStart"; + WsskCmd2[WsskCmd2["DeployWrite"] = 149] = "DeployWrite"; + WsskCmd2[WsskCmd2["DeployFinish"] = 150] = "DeployFinish"; + WsskCmd2[WsskCmd2["C2d"] = 151] = "C2d"; + WsskCmd2[WsskCmd2["D2c"] = 152] = "D2c"; + WsskCmd2[WsskCmd2["JacdacPacket"] = 153] = "JacdacPacket"; + WsskCmd2[WsskCmd2["Dmesg"] = 154] = "Dmesg"; + WsskCmd2[WsskCmd2["ExceptionReport"] = 155] = "ExceptionReport"; + return WsskCmd2; + })(WsskCmd || {}); + var WsskCmdPack; + ((WsskCmdPack22) => { + WsskCmdPack22.Error = "s"; + WsskCmdPack22.SetStreaming = "u16"; + WsskCmdPack22.PingDevice = "b"; + WsskCmdPack22.PingDeviceReport = "b"; + WsskCmdPack22.PingCloud = "b"; + WsskCmdPack22.PingCloudReport = "b"; + WsskCmdPack22.GetHashReport = "b[32]"; + WsskCmdPack22.DeployStart = "u32"; + WsskCmdPack22.DeployWrite = "b"; + WsskCmdPack22.C2d = "u8 z b"; + WsskCmdPack22.D2c = "u8 z b"; + WsskCmdPack22.JacdacPacket = "b"; + WsskCmdPack22.JacdacPacketReport = "b"; + WsskCmdPack22.Dmesg = "b"; + WsskCmdPack22.ExceptionReport = "b"; + })(WsskCmdPack || (WsskCmdPack = {})); + var import_json5 = __toESM2(require_dist()); + function parseJSON5(text, options) { + try { + const res = (0, import_json5.parse)(text); + return res; + } catch (e) { + if (options == null ? void 0 : options.errorAsDefaultValue) + return options == null ? void 0 : options.defaultValue; + throw e; + } + } + function JSON5TryParse(text, defaultValue) { + if (text === void 0) + return void 0; + if (text === null) + return null; + return parseJSON5(text, { defaultValue, errorAsDefaultValue: true }); + } + var IMAGE_MIN_LENGTH = 100; + function read32(buf, pos) { + return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; + } + function checkMagic(img) { + return read32(img, 0) === 1400268100 && read32(img, 4) === 4046024202; + } + var MIN_NODE_VERSION = 16; + var MARKETPLACE_EXTENSION_ID = "devicescript.devicescript-vscode"; + + // compiler/src/bytecode.ts + var Op = /* @__PURE__ */ ((Op3) => { + Op3[Op3["STMT1_CALL0"] = 2] = "STMT1_CALL0"; + Op3[Op3["STMT2_CALL1"] = 3] = "STMT2_CALL1"; + Op3[Op3["STMT3_CALL2"] = 4] = "STMT3_CALL2"; + Op3[Op3["STMT4_CALL3"] = 5] = "STMT4_CALL3"; + Op3[Op3["STMT5_CALL4"] = 6] = "STMT5_CALL4"; + Op3[Op3["STMT6_CALL5"] = 7] = "STMT6_CALL5"; + Op3[Op3["STMT7_CALL6"] = 8] = "STMT7_CALL6"; + Op3[Op3["STMT8_CALL7"] = 9] = "STMT8_CALL7"; + Op3[Op3["STMT9_CALL8"] = 10] = "STMT9_CALL8"; + Op3[Op3["STMT2_CALL_ARRAY"] = 79] = "STMT2_CALL_ARRAY"; + Op3[Op3["STMT1_RETURN"] = 12] = "STMT1_RETURN"; + Op3[Op3["STMTx_JMP"] = 13] = "STMTx_JMP"; + Op3[Op3["STMTx1_JMP_Z"] = 14] = "STMTx1_JMP_Z"; + Op3[Op3["STMTx_JMP_RET_VAL_Z"] = 78] = "STMTx_JMP_RET_VAL_Z"; + Op3[Op3["STMTx_TRY"] = 80] = "STMTx_TRY"; + Op3[Op3["STMTx_END_TRY"] = 81] = "STMTx_END_TRY"; + Op3[Op3["STMT0_CATCH"] = 82] = "STMT0_CATCH"; + Op3[Op3["STMT0_FINALLY"] = 83] = "STMT0_FINALLY"; + Op3[Op3["STMT1_THROW"] = 84] = "STMT1_THROW"; + Op3[Op3["STMT1_RE_THROW"] = 85] = "STMT1_RE_THROW"; + Op3[Op3["STMTx1_THROW_JMP"] = 86] = "STMTx1_THROW_JMP"; + Op3[Op3["STMT0_DEBUGGER"] = 87] = "STMT0_DEBUGGER"; + Op3[Op3["STMTx1_STORE_LOCAL"] = 17] = "STMTx1_STORE_LOCAL"; + Op3[Op3["STMTx1_STORE_GLOBAL"] = 18] = "STMTx1_STORE_GLOBAL"; + Op3[Op3["STMT4_STORE_BUFFER"] = 19] = "STMT4_STORE_BUFFER"; + Op3[Op3["EXPRx_LOAD_LOCAL"] = 21] = "EXPRx_LOAD_LOCAL"; + Op3[Op3["EXPRx_LOAD_GLOBAL"] = 22] = "EXPRx_LOAD_GLOBAL"; + Op3[Op3["STMTx2_STORE_CLOSURE"] = 73] = "STMTx2_STORE_CLOSURE"; + Op3[Op3["EXPRx1_LOAD_CLOSURE"] = 74] = "EXPRx1_LOAD_CLOSURE"; + Op3[Op3["EXPRx_MAKE_CLOSURE"] = 75] = "EXPRx_MAKE_CLOSURE"; + Op3[Op3["STMT1_STORE_RET_VAL"] = 93] = "STMT1_STORE_RET_VAL"; + Op3[Op3["EXPR2_INDEX"] = 24] = "EXPR2_INDEX"; + Op3[Op3["STMT3_INDEX_SET"] = 25] = "STMT3_INDEX_SET"; + Op3[Op3["STMT2_INDEX_DELETE"] = 11] = "STMT2_INDEX_DELETE"; + Op3[Op3["EXPRx1_BUILTIN_FIELD"] = 26] = "EXPRx1_BUILTIN_FIELD"; + Op3[Op3["EXPRx1_ASCII_FIELD"] = 27] = "EXPRx1_ASCII_FIELD"; + Op3[Op3["EXPRx1_UTF8_FIELD"] = 28] = "EXPRx1_UTF8_FIELD"; + Op3[Op3["EXPRx_MATH_FIELD"] = 29] = "EXPRx_MATH_FIELD"; + Op3[Op3["EXPRx_DS_FIELD"] = 30] = "EXPRx_DS_FIELD"; + Op3[Op3["EXPRx_OBJECT_FIELD"] = 16] = "EXPRx_OBJECT_FIELD"; + Op3[Op3["EXPR1_NEW"] = 88] = "EXPR1_NEW"; + Op3[Op3["EXPR2_BIND"] = 15] = "EXPR2_BIND"; + Op3[Op3["STMT0_ALLOC_MAP"] = 31] = "STMT0_ALLOC_MAP"; + Op3[Op3["STMT1_ALLOC_ARRAY"] = 32] = "STMT1_ALLOC_ARRAY"; + Op3[Op3["STMT1_ALLOC_BUFFER"] = 33] = "STMT1_ALLOC_BUFFER"; + Op3[Op3["EXPRx_STATIC_SPEC_PROTO"] = 34] = "EXPRx_STATIC_SPEC_PROTO"; + Op3[Op3["EXPRx_STATIC_BUFFER"] = 35] = "EXPRx_STATIC_BUFFER"; + Op3[Op3["EXPRx_STATIC_BUILTIN_STRING"] = 36] = "EXPRx_STATIC_BUILTIN_STRING"; + Op3[Op3["EXPRx_STATIC_ASCII_STRING"] = 37] = "EXPRx_STATIC_ASCII_STRING"; + Op3[Op3["EXPRx_STATIC_UTF8_STRING"] = 38] = "EXPRx_STATIC_UTF8_STRING"; + Op3[Op3["EXPRx_STATIC_FUNCTION"] = 39] = "EXPRx_STATIC_FUNCTION"; + Op3[Op3["EXPRx_STATIC_SPEC"] = 94] = "EXPRx_STATIC_SPEC"; + Op3[Op3["EXPRx_LITERAL"] = 40] = "EXPRx_LITERAL"; + Op3[Op3["EXPRx_LITERAL_F64"] = 41] = "EXPRx_LITERAL_F64"; + Op3[Op3["EXPRx_BUILTIN_OBJECT"] = 1] = "EXPRx_BUILTIN_OBJECT"; + Op3[Op3["STMT0_REMOVED_42"] = 42] = "STMT0_REMOVED_42"; + Op3[Op3["EXPR3_LOAD_BUFFER"] = 43] = "EXPR3_LOAD_BUFFER"; + Op3[Op3["EXPR0_RET_VAL"] = 44] = "EXPR0_RET_VAL"; + Op3[Op3["EXPR1_TYPEOF"] = 45] = "EXPR1_TYPEOF"; + Op3[Op3["EXPR1_TYPEOF_STR"] = 76] = "EXPR1_TYPEOF_STR"; + Op3[Op3["EXPR0_UNDEFINED"] = 46] = "EXPR0_UNDEFINED"; + Op3[Op3["EXPR0_NULL"] = 90] = "EXPR0_NULL"; + Op3[Op3["EXPR1_IS_UNDEFINED"] = 47] = "EXPR1_IS_UNDEFINED"; + Op3[Op3["EXPR2_INSTANCE_OF"] = 89] = "EXPR2_INSTANCE_OF"; + Op3[Op3["EXPR1_IS_NULLISH"] = 72] = "EXPR1_IS_NULLISH"; + Op3[Op3["EXPR0_TRUE"] = 48] = "EXPR0_TRUE"; + Op3[Op3["EXPR0_FALSE"] = 49] = "EXPR0_FALSE"; + Op3[Op3["EXPR1_TO_BOOL"] = 50] = "EXPR1_TO_BOOL"; + Op3[Op3["EXPR0_NAN"] = 51] = "EXPR0_NAN"; + Op3[Op3["EXPR0_INF"] = 20] = "EXPR0_INF"; + Op3[Op3["EXPR1_ABS"] = 52] = "EXPR1_ABS"; + Op3[Op3["EXPR1_BIT_NOT"] = 53] = "EXPR1_BIT_NOT"; + Op3[Op3["EXPR1_IS_NAN"] = 54] = "EXPR1_IS_NAN"; + Op3[Op3["EXPR1_NEG"] = 55] = "EXPR1_NEG"; + Op3[Op3["EXPR1_UPLUS"] = 23] = "EXPR1_UPLUS"; + Op3[Op3["EXPR1_NOT"] = 56] = "EXPR1_NOT"; + Op3[Op3["EXPR1_TO_INT"] = 57] = "EXPR1_TO_INT"; + Op3[Op3["EXPR2_ADD"] = 58] = "EXPR2_ADD"; + Op3[Op3["EXPR2_SUB"] = 59] = "EXPR2_SUB"; + Op3[Op3["EXPR2_MUL"] = 60] = "EXPR2_MUL"; + Op3[Op3["EXPR2_DIV"] = 61] = "EXPR2_DIV"; + Op3[Op3["EXPR2_BIT_AND"] = 62] = "EXPR2_BIT_AND"; + Op3[Op3["EXPR2_BIT_OR"] = 63] = "EXPR2_BIT_OR"; + Op3[Op3["EXPR2_BIT_XOR"] = 64] = "EXPR2_BIT_XOR"; + Op3[Op3["EXPR2_SHIFT_LEFT"] = 65] = "EXPR2_SHIFT_LEFT"; + Op3[Op3["EXPR2_SHIFT_RIGHT"] = 66] = "EXPR2_SHIFT_RIGHT"; + Op3[Op3["EXPR2_SHIFT_RIGHT_UNSIGNED"] = 67] = "EXPR2_SHIFT_RIGHT_UNSIGNED"; + Op3[Op3["EXPR2_EQ"] = 68] = "EXPR2_EQ"; + Op3[Op3["EXPR2_LE"] = 69] = "EXPR2_LE"; + Op3[Op3["EXPR2_LT"] = 70] = "EXPR2_LT"; + Op3[Op3["EXPR2_NE"] = 71] = "EXPR2_NE"; + Op3[Op3["EXPR2_APPROX_EQ"] = 91] = "EXPR2_APPROX_EQ"; + Op3[Op3["EXPR2_APPROX_NE"] = 92] = "EXPR2_APPROX_NE"; + Op3[Op3["STMT0_REMOVED_77"] = 77] = "STMT0_REMOVED_77"; + Op3[Op3["OP_PAST_LAST"] = 95] = "OP_PAST_LAST"; + return Op3; + })(Op || {}); + var OP_PROPS = "\x7F`Qp1B`11@ A!!!``````````\0A@A@@A@AAAAAABBBBBBBBBBBBBBA2! A00pQQqAB@BB`"; + var OP_TYPES = "\x7F\b \b\f\b\b\f"; + var BinFmt = /* @__PURE__ */ ((BinFmt2) => { + BinFmt2[BinFmt2["IMG_VERSION_MAJOR"] = 2] = "IMG_VERSION_MAJOR"; + BinFmt2[BinFmt2["IMG_VERSION_MINOR"] = 15] = "IMG_VERSION_MINOR"; + BinFmt2[BinFmt2["IMG_VERSION_PATCH"] = 6] = "IMG_VERSION_PATCH"; + BinFmt2[BinFmt2["IMG_VERSION"] = 34537478] = "IMG_VERSION"; + BinFmt2[BinFmt2["MAGIC0"] = 1400268100] = "MAGIC0"; + BinFmt2[BinFmt2["MAGIC1"] = 4046024202] = "MAGIC1"; + BinFmt2[BinFmt2["NUM_IMG_SECTIONS"] = 10] = "NUM_IMG_SECTIONS"; + BinFmt2[BinFmt2["FIX_HEADER_SIZE"] = 32] = "FIX_HEADER_SIZE"; + BinFmt2[BinFmt2["SECTION_HEADER_SIZE"] = 8] = "SECTION_HEADER_SIZE"; + BinFmt2[BinFmt2["FUNCTION_HEADER_SIZE"] = 16] = "FUNCTION_HEADER_SIZE"; + BinFmt2[BinFmt2["ASCII_HEADER_SIZE"] = 2] = "ASCII_HEADER_SIZE"; + BinFmt2[BinFmt2["UTF8_HEADER_SIZE"] = 4] = "UTF8_HEADER_SIZE"; + BinFmt2[BinFmt2["UTF8_TABLE_SHIFT"] = 4] = "UTF8_TABLE_SHIFT"; + BinFmt2[BinFmt2["BINARY_SIZE_ALIGN"] = 32] = "BINARY_SIZE_ALIGN"; + BinFmt2[BinFmt2["MAX_STACK_DEPTH"] = 16] = "MAX_STACK_DEPTH"; + BinFmt2[BinFmt2["MAX_CALL_DEPTH"] = 100] = "MAX_CALL_DEPTH"; + BinFmt2[BinFmt2["DIRECT_CONST_OP"] = 128] = "DIRECT_CONST_OP"; + BinFmt2[BinFmt2["DIRECT_CONST_OFFSET"] = 16] = "DIRECT_CONST_OFFSET"; + BinFmt2[BinFmt2["FIRST_MULTIBYTE_INT"] = 248] = "FIRST_MULTIBYTE_INT"; + BinFmt2[BinFmt2["FIRST_NON_OPCODE"] = 65536] = "FIRST_NON_OPCODE"; + BinFmt2[BinFmt2["FIRST_BUILTIN_FUNCTION"] = 5e4] = "FIRST_BUILTIN_FUNCTION"; + BinFmt2[BinFmt2["MAX_ARGS_SHORT_CALL"] = 8] = "MAX_ARGS_SHORT_CALL"; + BinFmt2[BinFmt2["SERVICE_SPEC_HEADER_SIZE"] = 16] = "SERVICE_SPEC_HEADER_SIZE"; + BinFmt2[BinFmt2["SERVICE_SPEC_PACKET_SIZE"] = 8] = "SERVICE_SPEC_PACKET_SIZE"; + BinFmt2[BinFmt2["SERVICE_SPEC_FIELD_SIZE"] = 4] = "SERVICE_SPEC_FIELD_SIZE"; + BinFmt2[BinFmt2["ROLE_BITS"] = 15] = "ROLE_BITS"; + return BinFmt2; + })(BinFmt || {}); + var StrIdx = /* @__PURE__ */ ((StrIdx2) => { + StrIdx2[StrIdx2["BUFFER"] = 0] = "BUFFER"; + StrIdx2[StrIdx2["BUILTIN"] = 1] = "BUILTIN"; + StrIdx2[StrIdx2["ASCII"] = 2] = "ASCII"; + StrIdx2[StrIdx2["UTF8"] = 3] = "UTF8"; + StrIdx2[StrIdx2["_SHIFT"] = 14] = "_SHIFT"; + return StrIdx2; + })(StrIdx || {}); + var OpCall = /* @__PURE__ */ ((OpCall2) => { + OpCall2[OpCall2["__MAX"] = 4] = "__MAX"; + OpCall2[OpCall2["SYNC"] = 0] = "SYNC"; + OpCall2[OpCall2["BG"] = 1] = "BG"; + OpCall2[OpCall2["BG_MAX1"] = 2] = "BG_MAX1"; + OpCall2[OpCall2["BG_MAX1_PEND1"] = 3] = "BG_MAX1_PEND1"; + OpCall2[OpCall2["BG_MAX1_REPLACE"] = 4] = "BG_MAX1_REPLACE"; + return OpCall2; + })(OpCall || {}); + var BytecodeFlag = /* @__PURE__ */ ((BytecodeFlag2) => { + BytecodeFlag2[BytecodeFlag2["NUM_ARGS_MASK"] = 15] = "NUM_ARGS_MASK"; + BytecodeFlag2[BytecodeFlag2["IS_STMT"] = 16] = "IS_STMT"; + BytecodeFlag2[BytecodeFlag2["TAKES_NUMBER"] = 32] = "TAKES_NUMBER"; + BytecodeFlag2[BytecodeFlag2["IS_STATELESS"] = 64] = "IS_STATELESS"; + BytecodeFlag2[BytecodeFlag2["IS_FINAL_STMT"] = 64] = "IS_FINAL_STMT"; + return BytecodeFlag2; + })(BytecodeFlag || {}); + var FunctionFlag = /* @__PURE__ */ ((FunctionFlag3) => { + FunctionFlag3[FunctionFlag3["NEEDS_THIS"] = 1] = "NEEDS_THIS"; + FunctionFlag3[FunctionFlag3["IS_CTOR"] = 2] = "IS_CTOR"; + FunctionFlag3[FunctionFlag3["HAS_REST_ARG"] = 4] = "HAS_REST_ARG"; + return FunctionFlag3; + })(FunctionFlag || {}); + var NumFmt = /* @__PURE__ */ ((NumFmt3) => { + NumFmt3[NumFmt3["__MAX"] = 12] = "__MAX"; + NumFmt3[NumFmt3["U8"] = 0] = "U8"; + NumFmt3[NumFmt3["U16"] = 1] = "U16"; + NumFmt3[NumFmt3["U32"] = 2] = "U32"; + NumFmt3[NumFmt3["U64"] = 3] = "U64"; + NumFmt3[NumFmt3["I8"] = 4] = "I8"; + NumFmt3[NumFmt3["I16"] = 5] = "I16"; + NumFmt3[NumFmt3["I32"] = 6] = "I32"; + NumFmt3[NumFmt3["I64"] = 7] = "I64"; + NumFmt3[NumFmt3["F8"] = 8] = "F8"; + NumFmt3[NumFmt3["F16"] = 9] = "F16"; + NumFmt3[NumFmt3["F32"] = 10] = "F32"; + NumFmt3[NumFmt3["F64"] = 11] = "F64"; + NumFmt3[NumFmt3["SPECIAL"] = 12] = "SPECIAL"; + return NumFmt3; + })(NumFmt || {}); + var NumFmtSpecial = /* @__PURE__ */ ((NumFmtSpecial2) => { + NumFmtSpecial2[NumFmtSpecial2["__MAX"] = 6] = "__MAX"; + NumFmtSpecial2[NumFmtSpecial2["EMPTY"] = 0] = "EMPTY"; + NumFmtSpecial2[NumFmtSpecial2["BYTES"] = 1] = "BYTES"; + NumFmtSpecial2[NumFmtSpecial2["STRING"] = 2] = "STRING"; + NumFmtSpecial2[NumFmtSpecial2["STRING0"] = 3] = "STRING0"; + NumFmtSpecial2[NumFmtSpecial2["BOOL"] = 4] = "BOOL"; + NumFmtSpecial2[NumFmtSpecial2["PIPE"] = 5] = "PIPE"; + NumFmtSpecial2[NumFmtSpecial2["PIPE_PORT"] = 6] = "PIPE_PORT"; + return NumFmtSpecial2; + })(NumFmtSpecial || {}); + var PacketSpecCode = /* @__PURE__ */ ((PacketSpecCode2) => { + PacketSpecCode2[PacketSpecCode2["REGISTER"] = 4096] = "REGISTER"; + PacketSpecCode2[PacketSpecCode2["EVENT"] = 32768] = "EVENT"; + PacketSpecCode2[PacketSpecCode2["COMMAND"] = 0] = "COMMAND"; + PacketSpecCode2[PacketSpecCode2["REPORT"] = 8192] = "REPORT"; + PacketSpecCode2[PacketSpecCode2["MASK"] = 61440] = "MASK"; + return PacketSpecCode2; + })(PacketSpecCode || {}); + var ServiceSpecFlag = /* @__PURE__ */ ((ServiceSpecFlag2) => { + ServiceSpecFlag2[ServiceSpecFlag2["DERIVE_MASK"] = 15] = "DERIVE_MASK"; + ServiceSpecFlag2[ServiceSpecFlag2["DERIVE_BASE"] = 0] = "DERIVE_BASE"; + ServiceSpecFlag2[ServiceSpecFlag2["DERIVE_SENSOR"] = 1] = "DERIVE_SENSOR"; + ServiceSpecFlag2[ServiceSpecFlag2["DERIVE_LAST"] = 1] = "DERIVE_LAST"; + return ServiceSpecFlag2; + })(ServiceSpecFlag || {}); + var PacketSpecFlag = /* @__PURE__ */ ((PacketSpecFlag2) => { + PacketSpecFlag2[PacketSpecFlag2["__MAX"] = 1] = "__MAX"; + PacketSpecFlag2[PacketSpecFlag2["MULTI_FIELD"] = 1] = "MULTI_FIELD"; + return PacketSpecFlag2; + })(PacketSpecFlag || {}); + var FieldSpecFlag = /* @__PURE__ */ ((FieldSpecFlag2) => { + FieldSpecFlag2[FieldSpecFlag2["__MAX"] = 2] = "__MAX"; + FieldSpecFlag2[FieldSpecFlag2["IS_BYTES"] = 1] = "IS_BYTES"; + FieldSpecFlag2[FieldSpecFlag2["STARTS_REPEATS"] = 2] = "STARTS_REPEATS"; + return FieldSpecFlag2; + })(FieldSpecFlag || {}); + var ObjectType = /* @__PURE__ */ ((ObjectType3) => { + ObjectType3[ObjectType3["__MAX"] = 15] = "__MAX"; + ObjectType3[ObjectType3["UNDEFINED"] = 0] = "UNDEFINED"; + ObjectType3[ObjectType3["NUMBER"] = 1] = "NUMBER"; + ObjectType3[ObjectType3["MAP"] = 2] = "MAP"; + ObjectType3[ObjectType3["ARRAY"] = 3] = "ARRAY"; + ObjectType3[ObjectType3["BUFFER"] = 4] = "BUFFER"; + ObjectType3[ObjectType3["ROLE"] = 5] = "ROLE"; + ObjectType3[ObjectType3["BOOL"] = 6] = "BOOL"; + ObjectType3[ObjectType3["FIBER"] = 7] = "FIBER"; + ObjectType3[ObjectType3["FUNCTION"] = 8] = "FUNCTION"; + ObjectType3[ObjectType3["STRING"] = 9] = "STRING"; + ObjectType3[ObjectType3["PACKET"] = 10] = "PACKET"; + ObjectType3[ObjectType3["EXOTIC"] = 11] = "EXOTIC"; + ObjectType3[ObjectType3["NULL"] = 12] = "NULL"; + ObjectType3[ObjectType3["IMAGE"] = 13] = "IMAGE"; + ObjectType3[ObjectType3["ANY"] = 14] = "ANY"; + ObjectType3[ObjectType3["VOID"] = 15] = "VOID"; + return ObjectType3; + })(ObjectType || {}); + var BuiltInObject = /* @__PURE__ */ ((BuiltInObject2) => { + BuiltInObject2[BuiltInObject2["__MAX"] = 43] = "__MAX"; + BuiltInObject2[BuiltInObject2["MATH"] = 0] = "MATH"; + BuiltInObject2[BuiltInObject2["OBJECT"] = 1] = "OBJECT"; + BuiltInObject2[BuiltInObject2["OBJECT_PROTOTYPE"] = 2] = "OBJECT_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["ARRAY"] = 3] = "ARRAY"; + BuiltInObject2[BuiltInObject2["ARRAY_PROTOTYPE"] = 4] = "ARRAY_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["BUFFER"] = 5] = "BUFFER"; + BuiltInObject2[BuiltInObject2["BUFFER_PROTOTYPE"] = 6] = "BUFFER_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["STRING"] = 7] = "STRING"; + BuiltInObject2[BuiltInObject2["STRING_PROTOTYPE"] = 8] = "STRING_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["NUMBER"] = 9] = "NUMBER"; + BuiltInObject2[BuiltInObject2["NUMBER_PROTOTYPE"] = 10] = "NUMBER_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSFIBER"] = 11] = "DSFIBER"; + BuiltInObject2[BuiltInObject2["DSFIBER_PROTOTYPE"] = 12] = "DSFIBER_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSROLE"] = 13] = "DSROLE"; + BuiltInObject2[BuiltInObject2["DSROLE_PROTOTYPE"] = 14] = "DSROLE_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["FUNCTION"] = 15] = "FUNCTION"; + BuiltInObject2[BuiltInObject2["FUNCTION_PROTOTYPE"] = 16] = "FUNCTION_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["BOOLEAN"] = 17] = "BOOLEAN"; + BuiltInObject2[BuiltInObject2["BOOLEAN_PROTOTYPE"] = 18] = "BOOLEAN_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSPACKET"] = 19] = "DSPACKET"; + BuiltInObject2[BuiltInObject2["DSPACKET_PROTOTYPE"] = 20] = "DSPACKET_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DEVICESCRIPT"] = 21] = "DEVICESCRIPT"; + BuiltInObject2[BuiltInObject2["DSPACKETINFO_PROTOTYPE"] = 22] = "DSPACKETINFO_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSREGISTER_PROTOTYPE"] = 23] = "DSREGISTER_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSCOMMAND_PROTOTYPE"] = 24] = "DSCOMMAND_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSEVENT_PROTOTYPE"] = 25] = "DSEVENT_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSREPORT_PROTOTYPE"] = 26] = "DSREPORT_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["ERROR"] = 27] = "ERROR"; + BuiltInObject2[BuiltInObject2["ERROR_PROTOTYPE"] = 28] = "ERROR_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["TYPEERROR"] = 29] = "TYPEERROR"; + BuiltInObject2[BuiltInObject2["TYPEERROR_PROTOTYPE"] = 30] = "TYPEERROR_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["RANGEERROR"] = 31] = "RANGEERROR"; + BuiltInObject2[BuiltInObject2["RANGEERROR_PROTOTYPE"] = 32] = "RANGEERROR_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["SYNTAXERROR"] = 33] = "SYNTAXERROR"; + BuiltInObject2[BuiltInObject2["SYNTAXERROR_PROTOTYPE"] = 34] = "SYNTAXERROR_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["JSON"] = 35] = "JSON"; + BuiltInObject2[BuiltInObject2["DSSERVICESPEC"] = 36] = "DSSERVICESPEC"; + BuiltInObject2[BuiltInObject2["DSSERVICESPEC_PROTOTYPE"] = 37] = "DSSERVICESPEC_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["DSPACKETSPEC"] = 38] = "DSPACKETSPEC"; + BuiltInObject2[BuiltInObject2["DSPACKETSPEC_PROTOTYPE"] = 39] = "DSPACKETSPEC_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["IMAGE"] = 40] = "IMAGE"; + BuiltInObject2[BuiltInObject2["IMAGE_PROTOTYPE"] = 41] = "IMAGE_PROTOTYPE"; + BuiltInObject2[BuiltInObject2["GPIO"] = 42] = "GPIO"; + BuiltInObject2[BuiltInObject2["GPIO_PROTOTYPE"] = 43] = "GPIO_PROTOTYPE"; + return BuiltInObject2; + })(BuiltInObject || {}); + var BuiltInString = /* @__PURE__ */ ((BuiltInString3) => { + BuiltInString3[BuiltInString3["__MAX"] = 225] = "__MAX"; + BuiltInString3[BuiltInString3["_EMPTY"] = 0] = "_EMPTY"; + BuiltInString3[BuiltInString3["MINFINITY"] = 1] = "MINFINITY"; + BuiltInString3[BuiltInString3["DEVICESCRIPT"] = 2] = "DEVICESCRIPT"; + BuiltInString3[BuiltInString3["E"] = 3] = "E"; + BuiltInString3[BuiltInString3["INFINITY"] = 4] = "INFINITY"; + BuiltInString3[BuiltInString3["LN10"] = 5] = "LN10"; + BuiltInString3[BuiltInString3["LN2"] = 6] = "LN2"; + BuiltInString3[BuiltInString3["LOG10E"] = 7] = "LOG10E"; + BuiltInString3[BuiltInString3["LOG2E"] = 8] = "LOG2E"; + BuiltInString3[BuiltInString3["NAN"] = 9] = "NAN"; + BuiltInString3[BuiltInString3["PI"] = 10] = "PI"; + BuiltInString3[BuiltInString3["SQRT1_2"] = 11] = "SQRT1_2"; + BuiltInString3[BuiltInString3["SQRT2"] = 12] = "SQRT2"; + BuiltInString3[BuiltInString3["ABS"] = 13] = "ABS"; + BuiltInString3[BuiltInString3["ALLOC"] = 14] = "ALLOC"; + BuiltInString3[BuiltInString3["ARRAY"] = 15] = "ARRAY"; + BuiltInString3[BuiltInString3["BLITAT"] = 16] = "BLITAT"; + BuiltInString3[BuiltInString3["BOOLEAN"] = 17] = "BOOLEAN"; + BuiltInString3[BuiltInString3["BUFFER"] = 18] = "BUFFER"; + BuiltInString3[BuiltInString3["CBRT"] = 19] = "CBRT"; + BuiltInString3[BuiltInString3["CEIL"] = 20] = "CEIL"; + BuiltInString3[BuiltInString3["CHARCODEAT"] = 21] = "CHARCODEAT"; + BuiltInString3[BuiltInString3["CLAMP"] = 22] = "CLAMP"; + BuiltInString3[BuiltInString3["EXP"] = 23] = "EXP"; + BuiltInString3[BuiltInString3["FALSE"] = 24] = "FALSE"; + BuiltInString3[BuiltInString3["FILLAT"] = 25] = "FILLAT"; + BuiltInString3[BuiltInString3["FLOOR"] = 26] = "FLOOR"; + BuiltInString3[BuiltInString3["FOREACH"] = 27] = "FOREACH"; + BuiltInString3[BuiltInString3["FUNCTION"] = 28] = "FUNCTION"; + BuiltInString3[BuiltInString3["GETAT"] = 29] = "GETAT"; + BuiltInString3[BuiltInString3["IDIV"] = 30] = "IDIV"; + BuiltInString3[BuiltInString3["IMUL"] = 31] = "IMUL"; + BuiltInString3[BuiltInString3["ISBOUND"] = 32] = "ISBOUND"; + BuiltInString3[BuiltInString3["JOIN"] = 33] = "JOIN"; + BuiltInString3[BuiltInString3["LENGTH"] = 34] = "LENGTH"; + BuiltInString3[BuiltInString3["LOG"] = 35] = "LOG"; + BuiltInString3[BuiltInString3["LOG10"] = 36] = "LOG10"; + BuiltInString3[BuiltInString3["LOG2"] = 37] = "LOG2"; + BuiltInString3[BuiltInString3["MAP"] = 38] = "MAP"; + BuiltInString3[BuiltInString3["MAX"] = 39] = "MAX"; + BuiltInString3[BuiltInString3["MIN"] = 40] = "MIN"; + BuiltInString3[BuiltInString3["NEXT"] = 41] = "NEXT"; + BuiltInString3[BuiltInString3["NULL"] = 42] = "NULL"; + BuiltInString3[BuiltInString3["NUMBER"] = 43] = "NUMBER"; + BuiltInString3[BuiltInString3["ONCHANGE"] = 44] = "ONCHANGE"; + BuiltInString3[BuiltInString3["ONCONNECTED"] = 45] = "ONCONNECTED"; + BuiltInString3[BuiltInString3["ONDISCONNECTED"] = 46] = "ONDISCONNECTED"; + BuiltInString3[BuiltInString3["PACKET"] = 47] = "PACKET"; + BuiltInString3[BuiltInString3["_PANIC"] = 48] = "_PANIC"; + BuiltInString3[BuiltInString3["POP"] = 49] = "POP"; + BuiltInString3[BuiltInString3["POW"] = 50] = "POW"; + BuiltInString3[BuiltInString3["PREV"] = 51] = "PREV"; + BuiltInString3[BuiltInString3["PROTOTYPE"] = 52] = "PROTOTYPE"; + BuiltInString3[BuiltInString3["PUSH"] = 53] = "PUSH"; + BuiltInString3[BuiltInString3["RANDOM"] = 54] = "RANDOM"; + BuiltInString3[BuiltInString3["RANDOMINT"] = 55] = "RANDOMINT"; + BuiltInString3[BuiltInString3["READ"] = 56] = "READ"; + BuiltInString3[BuiltInString3["RESTART"] = 57] = "RESTART"; + BuiltInString3[BuiltInString3["ROUND"] = 58] = "ROUND"; + BuiltInString3[BuiltInString3["SETAT"] = 59] = "SETAT"; + BuiltInString3[BuiltInString3["SETLENGTH"] = 60] = "SETLENGTH"; + BuiltInString3[BuiltInString3["SHIFT"] = 61] = "SHIFT"; + BuiltInString3[BuiltInString3["SIGNAL"] = 62] = "SIGNAL"; + BuiltInString3[BuiltInString3["SLICE"] = 63] = "SLICE"; + BuiltInString3[BuiltInString3["SPLICE"] = 64] = "SPLICE"; + BuiltInString3[BuiltInString3["SQRT"] = 65] = "SQRT"; + BuiltInString3[BuiltInString3["STRING"] = 66] = "STRING"; + BuiltInString3[BuiltInString3["SUBSCRIBE"] = 67] = "SUBSCRIBE"; + BuiltInString3[BuiltInString3["TOSTRING"] = 68] = "TOSTRING"; + BuiltInString3[BuiltInString3["TRUE"] = 69] = "TRUE"; + BuiltInString3[BuiltInString3["UNDEFINED"] = 70] = "UNDEFINED"; + BuiltInString3[BuiltInString3["UNSHIFT"] = 71] = "UNSHIFT"; + BuiltInString3[BuiltInString3["WAIT"] = 72] = "WAIT"; + BuiltInString3[BuiltInString3["WRITE"] = 73] = "WRITE"; + BuiltInString3[BuiltInString3["SLEEP"] = 74] = "SLEEP"; + BuiltInString3[BuiltInString3["IMOD"] = 75] = "IMOD"; + BuiltInString3[BuiltInString3["FORMAT"] = 76] = "FORMAT"; + BuiltInString3[BuiltInString3["INSERT"] = 77] = "INSERT"; + BuiltInString3[BuiltInString3["START"] = 78] = "START"; + BuiltInString3[BuiltInString3["CLOUD"] = 79] = "CLOUD"; + BuiltInString3[BuiltInString3["MAIN"] = 80] = "MAIN"; + BuiltInString3[BuiltInString3["CHARAT"] = 81] = "CHARAT"; + BuiltInString3[BuiltInString3["OBJECT"] = 82] = "OBJECT"; + BuiltInString3[BuiltInString3["PARSEINT"] = 83] = "PARSEINT"; + BuiltInString3[BuiltInString3["PARSEFLOAT"] = 84] = "PARSEFLOAT"; + BuiltInString3[BuiltInString3["ASSIGN"] = 85] = "ASSIGN"; + BuiltInString3[BuiltInString3["KEYS"] = 86] = "KEYS"; + BuiltInString3[BuiltInString3["VALUES"] = 87] = "VALUES"; + BuiltInString3[BuiltInString3["__FUNC__"] = 88] = "__FUNC__"; + BuiltInString3[BuiltInString3["ROLE"] = 89] = "ROLE"; + BuiltInString3[BuiltInString3["DEVICEIDENTIFIER"] = 90] = "DEVICEIDENTIFIER"; + BuiltInString3[BuiltInString3["SHORTID"] = 91] = "SHORTID"; + BuiltInString3[BuiltInString3["SERVICEINDEX"] = 92] = "SERVICEINDEX"; + BuiltInString3[BuiltInString3["SERVICECOMMAND"] = 93] = "SERVICECOMMAND"; + BuiltInString3[BuiltInString3["PAYLOAD"] = 94] = "PAYLOAD"; + BuiltInString3[BuiltInString3["DECODE"] = 95] = "DECODE"; + BuiltInString3[BuiltInString3["ENCODE"] = 96] = "ENCODE"; + BuiltInString3[BuiltInString3["_ONPACKET"] = 97] = "_ONPACKET"; + BuiltInString3[BuiltInString3["CODE"] = 98] = "CODE"; + BuiltInString3[BuiltInString3["NAME"] = 99] = "NAME"; + BuiltInString3[BuiltInString3["ISEVENT"] = 100] = "ISEVENT"; + BuiltInString3[BuiltInString3["EVENTCODE"] = 101] = "EVENTCODE"; + BuiltInString3[BuiltInString3["ISREGSET"] = 102] = "ISREGSET"; + BuiltInString3[BuiltInString3["ISREGGET"] = 103] = "ISREGGET"; + BuiltInString3[BuiltInString3["REGCODE"] = 104] = "REGCODE"; + BuiltInString3[BuiltInString3["FLAGS"] = 105] = "FLAGS"; + BuiltInString3[BuiltInString3["ISREPORT"] = 106] = "ISREPORT"; + BuiltInString3[BuiltInString3["ISCOMMAND"] = 107] = "ISCOMMAND"; + BuiltInString3[BuiltInString3["ISARRAY"] = 108] = "ISARRAY"; + BuiltInString3[BuiltInString3["INLINE"] = 109] = "INLINE"; + BuiltInString3[BuiltInString3["ASSERT"] = 110] = "ASSERT"; + BuiltInString3[BuiltInString3["PUSHRANGE"] = 111] = "PUSHRANGE"; + BuiltInString3[BuiltInString3["SENDCOMMAND"] = 112] = "SENDCOMMAND"; + BuiltInString3[BuiltInString3["__STACK__"] = 113] = "__STACK__"; + BuiltInString3[BuiltInString3["ERROR"] = 114] = "ERROR"; + BuiltInString3[BuiltInString3["TYPEERROR"] = 115] = "TYPEERROR"; + BuiltInString3[BuiltInString3["RANGEERROR"] = 116] = "RANGEERROR"; + BuiltInString3[BuiltInString3["STACK"] = 117] = "STACK"; + BuiltInString3[BuiltInString3["MESSAGE"] = 118] = "MESSAGE"; + BuiltInString3[BuiltInString3["CAUSE"] = 119] = "CAUSE"; + BuiltInString3[BuiltInString3["__NEW__"] = 120] = "__NEW__"; + BuiltInString3[BuiltInString3["SETPROTOTYPEOF"] = 121] = "SETPROTOTYPEOF"; + BuiltInString3[BuiltInString3["GETPROTOTYPEOF"] = 122] = "GETPROTOTYPEOF"; + BuiltInString3[BuiltInString3["CONSTRUCTOR"] = 123] = "CONSTRUCTOR"; + BuiltInString3[BuiltInString3["__PROTO__"] = 124] = "__PROTO__"; + BuiltInString3[BuiltInString3["_LOGREPR"] = 125] = "_LOGREPR"; + BuiltInString3[BuiltInString3["PRINT"] = 126] = "PRINT"; + BuiltInString3[BuiltInString3["EVERYMS"] = 127] = "EVERYMS"; + BuiltInString3[BuiltInString3["SETINTERVAL"] = 128] = "SETINTERVAL"; + BuiltInString3[BuiltInString3["SETTIMEOUT"] = 129] = "SETTIMEOUT"; + BuiltInString3[BuiltInString3["CLEARINTERVAL"] = 130] = "CLEARINTERVAL"; + BuiltInString3[BuiltInString3["CLEARTIMEOUT"] = 131] = "CLEARTIMEOUT"; + BuiltInString3[BuiltInString3["SYNTAXERROR"] = 132] = "SYNTAXERROR"; + BuiltInString3[BuiltInString3["JSON"] = 133] = "JSON"; + BuiltInString3[BuiltInString3["PARSE"] = 134] = "PARSE"; + BuiltInString3[BuiltInString3["STRINGIFY"] = 135] = "STRINGIFY"; + BuiltInString3[BuiltInString3["_DCFGSTRING"] = 136] = "_DCFGSTRING"; + BuiltInString3[BuiltInString3["ISSIMULATOR"] = 137] = "ISSIMULATOR"; + BuiltInString3[BuiltInString3["_ROLE"] = 138] = "_ROLE"; + BuiltInString3[BuiltInString3["FIBER"] = 139] = "FIBER"; + BuiltInString3[BuiltInString3["SUSPEND"] = 140] = "SUSPEND"; + BuiltInString3[BuiltInString3["RESUME"] = 141] = "RESUME"; + BuiltInString3[BuiltInString3["TERMINATE"] = 142] = "TERMINATE"; + BuiltInString3[BuiltInString3["SELF"] = 143] = "SELF"; + BuiltInString3[BuiltInString3["CURRENT"] = 144] = "CURRENT"; + BuiltInString3[BuiltInString3["ID"] = 145] = "ID"; + BuiltInString3[BuiltInString3["_COMMANDRESPONSE"] = 146] = "_COMMANDRESPONSE"; + BuiltInString3[BuiltInString3["ISACTION"] = 147] = "ISACTION"; + BuiltInString3[BuiltInString3["MILLIS"] = 148] = "MILLIS"; + BuiltInString3[BuiltInString3["FROM"] = 149] = "FROM"; + BuiltInString3[BuiltInString3["HEX"] = 150] = "HEX"; + BuiltInString3[BuiltInString3["UTF8"] = 151] = "UTF8"; + BuiltInString3[BuiltInString3["UTF_8"] = 152] = "UTF_8"; + BuiltInString3[BuiltInString3["SUSPENDED"] = 153] = "SUSPENDED"; + BuiltInString3[BuiltInString3["REBOOT"] = 154] = "REBOOT"; + BuiltInString3[BuiltInString3["SERVER"] = 155] = "SERVER"; + BuiltInString3[BuiltInString3["SPEC"] = 156] = "SPEC"; + BuiltInString3[BuiltInString3["SERVICESPEC"] = 157] = "SERVICESPEC"; + BuiltInString3[BuiltInString3["CLASSIDENTIFIER"] = 158] = "CLASSIDENTIFIER"; + BuiltInString3[BuiltInString3["LOOKUP"] = 159] = "LOOKUP"; + BuiltInString3[BuiltInString3["PACKETSPEC"] = 160] = "PACKETSPEC"; + BuiltInString3[BuiltInString3["PARENT"] = 161] = "PARENT"; + BuiltInString3[BuiltInString3["RESPONSE"] = 162] = "RESPONSE"; + BuiltInString3[BuiltInString3["SERVERINTERFACE"] = 163] = "SERVERINTERFACE"; + BuiltInString3[BuiltInString3["_ONSERVERPACKET"] = 164] = "_ONSERVERPACKET"; + BuiltInString3[BuiltInString3["_SERVERSEND"] = 165] = "_SERVERSEND"; + BuiltInString3[BuiltInString3["NOTIMPLEMENTED"] = 166] = "NOTIMPLEMENTED"; + BuiltInString3[BuiltInString3["DELAY"] = 167] = "DELAY"; + BuiltInString3[BuiltInString3["FROMCHARCODE"] = 168] = "FROMCHARCODE"; + BuiltInString3[BuiltInString3["_ALLOCROLE"] = 169] = "_ALLOCROLE"; + BuiltInString3[BuiltInString3["SPICONFIGURE"] = 170] = "SPICONFIGURE"; + BuiltInString3[BuiltInString3["SPIXFER"] = 171] = "SPIXFER"; + BuiltInString3[BuiltInString3["_SOCKETOPEN"] = 172] = "_SOCKETOPEN"; + BuiltInString3[BuiltInString3["_SOCKETCLOSE"] = 173] = "_SOCKETCLOSE"; + BuiltInString3[BuiltInString3["_SOCKETWRITE"] = 174] = "_SOCKETWRITE"; + BuiltInString3[BuiltInString3["_SOCKETONEVENT"] = 175] = "_SOCKETONEVENT"; + BuiltInString3[BuiltInString3["OPEN"] = 176] = "OPEN"; + BuiltInString3[BuiltInString3["CLOSE"] = 177] = "CLOSE"; + BuiltInString3[BuiltInString3["ERROR_"] = 178] = "ERROR_"; + BuiltInString3[BuiltInString3["DATA"] = 179] = "DATA"; + BuiltInString3[BuiltInString3["TOUPPERCASE"] = 180] = "TOUPPERCASE"; + BuiltInString3[BuiltInString3["TOLOWERCASE"] = 181] = "TOLOWERCASE"; + BuiltInString3[BuiltInString3["INDEXOF"] = 182] = "INDEXOF"; + BuiltInString3[BuiltInString3["BYTELENGTH"] = 183] = "BYTELENGTH"; + BuiltInString3[BuiltInString3["IMAGE"] = 184] = "IMAGE"; + BuiltInString3[BuiltInString3["WIDTH"] = 185] = "WIDTH"; + BuiltInString3[BuiltInString3["HEIGHT"] = 186] = "HEIGHT"; + BuiltInString3[BuiltInString3["BPP"] = 187] = "BPP"; + BuiltInString3[BuiltInString3["GET"] = 188] = "GET"; + BuiltInString3[BuiltInString3["CLONE"] = 189] = "CLONE"; + BuiltInString3[BuiltInString3["SET"] = 190] = "SET"; + BuiltInString3[BuiltInString3["FILL"] = 191] = "FILL"; + BuiltInString3[BuiltInString3["FLIPX"] = 192] = "FLIPX"; + BuiltInString3[BuiltInString3["FLIPY"] = 193] = "FLIPY"; + BuiltInString3[BuiltInString3["TRANSPOSED"] = 194] = "TRANSPOSED"; + BuiltInString3[BuiltInString3["DRAWIMAGE"] = 195] = "DRAWIMAGE"; + BuiltInString3[BuiltInString3["DRAWTRANSPARENTIMAGE"] = 196] = "DRAWTRANSPARENTIMAGE"; + BuiltInString3[BuiltInString3["OVERLAPSWITH"] = 197] = "OVERLAPSWITH"; + BuiltInString3[BuiltInString3["FILLRECT"] = 198] = "FILLRECT"; + BuiltInString3[BuiltInString3["DRAWLINE"] = 199] = "DRAWLINE"; + BuiltInString3[BuiltInString3["EQUALS"] = 200] = "EQUALS"; + BuiltInString3[BuiltInString3["ISREADONLY"] = 201] = "ISREADONLY"; + BuiltInString3[BuiltInString3["FILLCIRCLE"] = 202] = "FILLCIRCLE"; + BuiltInString3[BuiltInString3["BLITROW"] = 203] = "BLITROW"; + BuiltInString3[BuiltInString3["BLIT"] = 204] = "BLIT"; + BuiltInString3[BuiltInString3["_I2CTRANSACTION"] = 205] = "_I2CTRANSACTION"; + BuiltInString3[BuiltInString3["_TWINMESSAGE"] = 206] = "_TWINMESSAGE"; + BuiltInString3[BuiltInString3["SPISENDIMAGE"] = 207] = "SPISENDIMAGE"; + BuiltInString3[BuiltInString3["GPIO"] = 208] = "GPIO"; + BuiltInString3[BuiltInString3["LABEL"] = 209] = "LABEL"; + BuiltInString3[BuiltInString3["MODE"] = 210] = "MODE"; + BuiltInString3[BuiltInString3["CAPABILITIES"] = 211] = "CAPABILITIES"; + BuiltInString3[BuiltInString3["VALUE"] = 212] = "VALUE"; + BuiltInString3[BuiltInString3["SETMODE"] = 213] = "SETMODE"; + BuiltInString3[BuiltInString3["FILLRANDOM"] = 214] = "FILLRANDOM"; + BuiltInString3[BuiltInString3["ENCRYPT"] = 215] = "ENCRYPT"; + BuiltInString3[BuiltInString3["DECRYPT"] = 216] = "DECRYPT"; + BuiltInString3[BuiltInString3["DIGEST"] = 217] = "DIGEST"; + BuiltInString3[BuiltInString3["LEDSTRIPSEND"] = 218] = "LEDSTRIPSEND"; + BuiltInString3[BuiltInString3["ROTATE"] = 219] = "ROTATE"; + BuiltInString3[BuiltInString3["REGISTER"] = 220] = "REGISTER"; + BuiltInString3[BuiltInString3["EVENT"] = 221] = "EVENT"; + BuiltInString3[BuiltInString3["ACTION"] = 222] = "ACTION"; + BuiltInString3[BuiltInString3["REPORT"] = 223] = "REPORT"; + BuiltInString3[BuiltInString3["TYPE"] = 224] = "TYPE"; + BuiltInString3[BuiltInString3["BYCODE"] = 225] = "BYCODE"; + return BuiltInString3; + })(BuiltInString || {}); + var OP_PRINT_FMTS = [ + null, + "%O", + "CALL %e()", + "CALL %e(%e)", + "CALL %e(%e, %e)", + "CALL %e(%e, %e, %e)", + "CALL %e(%e, %e, %e, %e)", + "CALL %e(%e, %e, %e, %e, %e)", + "CALL %e(%e, %e, %e, %e, %e, %e)", + "CALL %e(%e, %e, %e, %e, %e, %e, %e)", + "CALL %e(%e, %e, %e, %e, %e, %e, %e, %e)", + "delete %e[%e]", + "RETURN %e", + "JMP %j", + "JMP %j IF NOT %e", + "%e.bind(%e)", + "Object.%I", + "%L := %e", + "%G := %e", + "STORE_BUFFER %e %n offset=%e %e", + "inf()", + "%L", + "%G", + "+%e", + "%e[%e]", + "%e[%e] := %e", + "{swap}%e.%I", + "{swap}%e.%A", + "{swap}%e.%U", + "Math.%I", + "ds.%I", + "ALLOC_MAP ", + "ALLOC_ARRAY initial_size=%e", + "ALLOC_BUFFER size=%e", + "%S.prototype", + "%B", + "%I", + "%A", + "%U", + "%F", + "%e", + "%D", + "REMOVED_42 ", + "load_buffer(%e, %n, offset=%e)", + "ret_val()", + "typeof(%e)", + "undefined", + "is_undefined(%e)", + "true()", + "false()", + "!!%e", + "nan()", + "abs(%e)", + "~%e", + "is_nan(%e)", + "-%e", + "!%e", + "to_int(%e)", + "(%e + %e)", + "(%e - %e)", + "(%e * %e)", + "(%e / %e)", + "(%e & %e)", + "(%e | %e)", + "(%e ^ %e)", + "(%e << %e)", + "(%e >> %e)", + "(%e >>> %e)", + "(%e === %e)", + "(%e <= %e)", + "(%e < %e)", + "(%e !== %e)", + "is_nullish(%e)", + "STORE_CLOSURE local_clo_idx=%e levels=%e %e", + "load_closure(local_clo_idx=%e, levels=%e)", + "CLOSURE(%F)", + "typeof_str(%e)", + "REMOVED_77 ", + "JMP %j IF ret_val is nullish", + "CALL %e(...%e)", + "TRY %j", + "END_TRY %j", + "CATCH ", + "FINALLY ", + "THROW %e", + "RE_THROW %e", + "THROW_JMP %j level=%e", + "DEBUGGER ", + "(new %e)", + "instance_of(obj=%e, cls=%e)", + "null", + "(%e == %e)", + "(%e != %e)", + "ret_val := %e", + "%S" + ]; + var OBJECT_TYPE = [ + "undefined", + "number", + "map", + "array", + "buffer", + "role", + "bool", + "fiber", + "function", + "string", + "packet", + "exotic", + "null", + "image", + "any", + "void" + ]; + var BUILTIN_STRING__VAL = [ + "", + "-Infinity", + "DeviceScript", + "E", + "Infinity", + "LN10", + "LN2", + "LOG10E", + "LOG2E", + "NaN", + "PI", + "SQRT1_2", + "SQRT2", + "abs", + "alloc", + "array", + "blitAt", + "boolean", + "buffer", + "cbrt", + "ceil", + "charCodeAt", + "clamp", + "exp", + "false", + "fillAt", + "floor", + "forEach", + "function", + "getAt", + "idiv", + "imul", + "isBound", + "join", + "length", + "log", + "log10", + "log2", + "map", + "max", + "min", + "next", + "null", + "number", + "onChange", + "onConnected", + "onDisconnected", + "packet", + "_panic", + "pop", + "pow", + "prev", + "prototype", + "push", + "random", + "randomInt", + "read", + "restart", + "round", + "setAt", + "setLength", + "shift", + "signal", + "slice", + "splice", + "sqrt", + "string", + "subscribe", + "toString", + "true", + "undefined", + "unshift", + "wait", + "write", + "sleep", + "imod", + "format", + "insert", + "start", + "cloud", + "main", + "charAt", + "object", + "parseInt", + "parseFloat", + "assign", + "keys", + "values", + "__func__", + "role", + "deviceIdentifier", + "shortId", + "serviceIndex", + "serviceCommand", + "payload", + "decode", + "encode", + "_onPacket", + "code", + "name", + "isEvent", + "eventCode", + "isRegSet", + "isRegGet", + "regCode", + "flags", + "isReport", + "isCommand", + "isArray", + "inline", + "assert", + "pushRange", + "sendCommand", + "__stack__", + "Error", + "TypeError", + "RangeError", + "stack", + "message", + "cause", + "__new__", + "setPrototypeOf", + "getPrototypeOf", + "constructor", + "__proto__", + "_logRepr", + "print", + "everyMs", + "setInterval", + "setTimeout", + "clearInterval", + "clearTimeout", + "SyntaxError", + "JSON", + "parse", + "stringify", + "_dcfgString", + "isSimulator", + "Role", + "Fiber", + "suspend", + "resume", + "terminate", + "self", + "current", + "id", + "_commandResponse", + "isAction", + "millis", + "from", + "hex", + "utf8", + "utf-8", + "suspended", + "reboot", + "server", + "spec", + "ServiceSpec", + "classIdentifier", + "lookup", + "PacketSpec", + "parent", + "response", + "ServerInterface", + "_onServerPacket", + "_serverSend", + "notImplemented", + "delay", + "fromCharCode", + "_allocRole", + "spiConfigure", + "spiXfer", + "_socketOpen", + "_socketClose", + "_socketWrite", + "_socketOnEvent", + "open", + "close", + "error", + "data", + "toUpperCase", + "toLowerCase", + "indexOf", + "byteLength", + "Image", + "width", + "height", + "bpp", + "get", + "clone", + "set", + "fill", + "flipX", + "flipY", + "transposed", + "drawImage", + "drawTransparentImage", + "overlapsWith", + "fillRect", + "drawLine", + "equals", + "isReadOnly", + "fillCircle", + "blitRow", + "blit", + "_i2cTransaction", + "_twinMessage", + "spiSendImage", + "gpio", + "label", + "mode", + "capabilities", + "value", + "setMode", + "fillRandom", + "encrypt", + "decrypt", + "digest", + "ledStripSend", + "rotate", + "register", + "event", + "action", + "report", + "type", + "byCode" + ]; + var BUILTIN_OBJECT__VAL = [ + "Math", + "Object", + "Object_prototype", + "Array", + "Array_prototype", + "Buffer", + "Buffer_prototype", + "String", + "String_prototype", + "Number", + "Number_prototype", + "DsFiber", + "DsFiber_prototype", + "DsRole", + "DsRole_prototype", + "Function", + "Function_prototype", + "Boolean", + "Boolean_prototype", + "DsPacket", + "DsPacket_prototype", + "DeviceScript", + "DsPacketInfo_prototype", + "DsRegister_prototype", + "DsCommand_prototype", + "DsEvent_prototype", + "DsReport_prototype", + "Error", + "Error_prototype", + "TypeError", + "TypeError_prototype", + "RangeError", + "RangeError_prototype", + "SyntaxError", + "SyntaxError_prototype", + "JSON", + "DsServiceSpec", + "DsServiceSpec_prototype", + "DsPacketSpec", + "DsPacketSpec_prototype", + "Image", + "Image_prototype", + "GPIO", + "GPIO_prototype" + ]; + + // compiler/src/format.ts + function opTakesNumber(op) { + return !!(OP_PROPS.charCodeAt(op) & 32 /* TAKES_NUMBER */); + } + function opNumRealArgs(op) { + return OP_PROPS.charCodeAt(op) & 15 /* NUM_ARGS_MASK */; + } + function opNumArgs(op) { + let n = opNumRealArgs(op); + if (opTakesNumber(op)) + n++; + return n; + } + function opType(op) { + return OP_TYPES.charCodeAt(op); + } + function opIsStmt(op) { + return !!(OP_PROPS.charCodeAt(op) & 16 /* IS_STMT */); + } + function exprIsStateful(op) { + return opIsStmt(op) || !(OP_PROPS.charCodeAt(op) & 64 /* IS_STATELESS */); + } + function stmtIsFinal(op) { + return opIsStmt(op) && OP_PROPS.charCodeAt(op) & 64 /* IS_FINAL_STMT */; + } + function bitSize(fmt) { + return 8 << (fmt & 3); + } + function numfmtToString(v) { + var _a; + const fmt = v & 15; + const bitsz = bitSize(fmt); + const letter = ["u", "i", "f", "x"][fmt >> 2]; + if (letter == "x") { + const idx = v >> 4 | (v & 3) << 4; + return (_a = NumFmtSpecial[idx]) != null ? _a : "Spec." + idx; + } + const shift = v >> 4; + if (shift) + return letter + (bitsz - shift) + "." + shift; + else + return letter + bitsz; + } + function parseImgVersion(v) { + return { + major: v >> 24 & 255, + minor: v >> 16 & 255, + patch: v >> 0 & 65535 + }; + } + function runtimeVersion() { + const v = parseImgVersion(34537478 /* IMG_VERSION */); + return `v${v.major}.${v.minor}.${v.patch}`; + } + + // compiler/src/compiler.ts + var ts3 = __toESM(require_typescript()); + var import_typescript2 = __toESM(require_typescript()); + + // jacdac-ts/dist/jacdac.mjs + var SystemCmd2 = /* @__PURE__ */ ((SystemCmd22) => { + SystemCmd22[SystemCmd22["Announce"] = 0] = "Announce"; + SystemCmd22[SystemCmd22["GetRegister"] = 4096] = "GetRegister"; + SystemCmd22[SystemCmd22["SetRegister"] = 8192] = "SetRegister"; + SystemCmd22[SystemCmd22["Calibrate"] = 2] = "Calibrate"; + SystemCmd22[SystemCmd22["CommandNotImplemented"] = 3] = "CommandNotImplemented"; + return SystemCmd22; + })(SystemCmd2 || {}); + var SystemCmdPack2; + ((SystemCmdPack22) => { + SystemCmdPack22.CommandNotImplemented = "u16 u16"; + })(SystemCmdPack2 || (SystemCmdPack2 = {})); + var SystemReg2 = /* @__PURE__ */ ((SystemReg22) => { + SystemReg22[SystemReg22["Intensity"] = 1] = "Intensity"; + SystemReg22[SystemReg22["Value"] = 2] = "Value"; + SystemReg22[SystemReg22["MinValue"] = 272] = "MinValue"; + SystemReg22[SystemReg22["MaxValue"] = 273] = "MaxValue"; + SystemReg22[SystemReg22["MaxPower"] = 7] = "MaxPower"; + SystemReg22[SystemReg22["StreamingSamples"] = 3] = "StreamingSamples"; + SystemReg22[SystemReg22["StreamingInterval"] = 4] = "StreamingInterval"; + SystemReg22[SystemReg22["Reading"] = 257] = "Reading"; + SystemReg22[SystemReg22["ReadingRange"] = 8] = "ReadingRange"; + SystemReg22[SystemReg22["SupportedRanges"] = 266] = "SupportedRanges"; + SystemReg22[SystemReg22["MinReading"] = 260] = "MinReading"; + SystemReg22[SystemReg22["MaxReading"] = 261] = "MaxReading"; + SystemReg22[SystemReg22["ReadingError"] = 262] = "ReadingError"; + SystemReg22[SystemReg22["ReadingResolution"] = 264] = "ReadingResolution"; + SystemReg22[SystemReg22["InactiveThreshold"] = 5] = "InactiveThreshold"; + SystemReg22[SystemReg22["ActiveThreshold"] = 6] = "ActiveThreshold"; + SystemReg22[SystemReg22["StreamingPreferredInterval"] = 258] = "StreamingPreferredInterval"; + SystemReg22[SystemReg22["Variant"] = 263] = "Variant"; + SystemReg22[SystemReg22["ClientVariant"] = 9] = "ClientVariant"; + SystemReg22[SystemReg22["StatusCode"] = 259] = "StatusCode"; + SystemReg22[SystemReg22["InstanceName"] = 265] = "InstanceName"; + return SystemReg22; + })(SystemReg2 || {}); + var SystemRegPack2; + ((SystemRegPack22) => { + SystemRegPack22.Intensity = "u32"; + SystemRegPack22.Value = "i32"; + SystemRegPack22.MinValue = "i32"; + SystemRegPack22.MaxValue = "i32"; + SystemRegPack22.MaxPower = "u16"; + SystemRegPack22.StreamingSamples = "u8"; + SystemRegPack22.StreamingInterval = "u32"; + SystemRegPack22.Reading = "i32"; + SystemRegPack22.ReadingRange = "u32"; + SystemRegPack22.SupportedRanges = "r: u32"; + SystemRegPack22.MinReading = "i32"; + SystemRegPack22.MaxReading = "i32"; + SystemRegPack22.ReadingError = "u32"; + SystemRegPack22.ReadingResolution = "u32"; + SystemRegPack22.InactiveThreshold = "i32"; + SystemRegPack22.ActiveThreshold = "i32"; + SystemRegPack22.StreamingPreferredInterval = "u32"; + SystemRegPack22.Variant = "u32"; + SystemRegPack22.ClientVariant = "s"; + SystemRegPack22.StatusCode = "u16 u16"; + SystemRegPack22.InstanceName = "s"; + })(SystemRegPack2 || (SystemRegPack2 = {})); + var SystemEventPack2; + ((SystemEventPack22) => { + SystemEventPack22.StatusCodeChanged = "u16 u16"; + })(SystemEventPack2 || (SystemEventPack2 = {})); + var BaseCmdPack2; + ((BaseCmdPack22) => { + BaseCmdPack22.CommandNotImplemented = "u16 u16"; + })(BaseCmdPack2 || (BaseCmdPack2 = {})); + var BaseRegPack2; + ((BaseRegPack22) => { + BaseRegPack22.InstanceName = "s"; + BaseRegPack22.StatusCode = "u16 u16"; + BaseRegPack22.ClientVariant = "s"; + })(BaseRegPack2 || (BaseRegPack2 = {})); + var BaseEventPack2; + ((BaseEventPack22) => { + BaseEventPack22.StatusCodeChanged = "u16 u16"; + })(BaseEventPack2 || (BaseEventPack2 = {})); + var SensorRegPack2; + ((SensorRegPack22) => { + SensorRegPack22.StreamingSamples = "u8"; + SensorRegPack22.StreamingInterval = "u32"; + SensorRegPack22.StreamingPreferredInterval = "u32"; + })(SensorRegPack2 || (SensorRegPack2 = {})); + var AccelerometerRegPack2; + ((AccelerometerRegPack22) => { + AccelerometerRegPack22.Forces = "i12.20 i12.20 i12.20"; + AccelerometerRegPack22.ForcesError = "u12.20"; + AccelerometerRegPack22.MaxForce = "u12.20"; + AccelerometerRegPack22.MaxForcesSupported = "r: u12.20"; + })(AccelerometerRegPack2 || (AccelerometerRegPack2 = {})); + var AcidityRegPack2; + ((AcidityRegPack22) => { + AcidityRegPack22.Acidity = "u4.12"; + AcidityRegPack22.AcidityError = "u4.12"; + AcidityRegPack22.MinAcidity = "u4.12"; + AcidityRegPack22.MaxHumidity = "u4.12"; + })(AcidityRegPack2 || (AcidityRegPack2 = {})); + var AirPressureRegPack2; + ((AirPressureRegPack22) => { + AirPressureRegPack22.Pressure = "u22.10"; + AirPressureRegPack22.PressureError = "u22.10"; + AirPressureRegPack22.MinPressure = "u22.10"; + AirPressureRegPack22.MaxPressure = "u22.10"; + })(AirPressureRegPack2 || (AirPressureRegPack2 = {})); + var AirQualityIndexRegPack2; + ((AirQualityIndexRegPack22) => { + AirQualityIndexRegPack22.AqiIndex = "u16.16"; + AirQualityIndexRegPack22.AqiIndexError = "u16.16"; + AirQualityIndexRegPack22.MinAqiIndex = "u16.16"; + AirQualityIndexRegPack22.MaxAqiIndex = "u16.16"; + })(AirQualityIndexRegPack2 || (AirQualityIndexRegPack2 = {})); + var ArcadeGamepadRegPack2; + ((ArcadeGamepadRegPack22) => { + ArcadeGamepadRegPack22.Buttons = "r: u8 u0.8"; + ArcadeGamepadRegPack22.AvailableButtons = "r: u8"; + })(ArcadeGamepadRegPack2 || (ArcadeGamepadRegPack2 = {})); + var ArcadeGamepadEventPack2; + ((ArcadeGamepadEventPack22) => { + ArcadeGamepadEventPack22.Down = "u8"; + ArcadeGamepadEventPack22.Up = "u8"; + })(ArcadeGamepadEventPack2 || (ArcadeGamepadEventPack2 = {})); + var ArcadeSoundCmdPack2; + ((ArcadeSoundCmdPack22) => { + ArcadeSoundCmdPack22.Play = "b"; + })(ArcadeSoundCmdPack2 || (ArcadeSoundCmdPack2 = {})); + var ArcadeSoundRegPack2; + ((ArcadeSoundRegPack22) => { + ArcadeSoundRegPack22.SampleRate = "u22.10"; + ArcadeSoundRegPack22.BufferSize = "u32"; + ArcadeSoundRegPack22.BufferPending = "u32"; + })(ArcadeSoundRegPack2 || (ArcadeSoundRegPack2 = {})); + var BarcodeReaderRegPack2; + ((BarcodeReaderRegPack22) => { + BarcodeReaderRegPack22.Enabled = "u8"; + BarcodeReaderRegPack22.Formats = "r: u8"; + })(BarcodeReaderRegPack2 || (BarcodeReaderRegPack2 = {})); + var BarcodeReaderEventPack2; + ((BarcodeReaderEventPack22) => { + BarcodeReaderEventPack22.Detect = "u8 s"; + })(BarcodeReaderEventPack2 || (BarcodeReaderEventPack2 = {})); + var BitRadioRegPack2; + ((BitRadioRegPack22) => { + BitRadioRegPack22.Enabled = "u8"; + BitRadioRegPack22.Group = "u8"; + BitRadioRegPack22.TransmissionPower = "u8"; + BitRadioRegPack22.FrequencyBand = "u8"; + })(BitRadioRegPack2 || (BitRadioRegPack2 = {})); + var BitRadioCmdPack2; + ((BitRadioCmdPack22) => { + BitRadioCmdPack22.SendString = "s"; + BitRadioCmdPack22.SendNumber = "f64"; + BitRadioCmdPack22.SendValue = "f64 s"; + BitRadioCmdPack22.SendBuffer = "b"; + BitRadioCmdPack22.StringReceived = "u32 u32 i8 b[1] s"; + BitRadioCmdPack22.NumberReceived = "u32 u32 i8 b[3] f64 s"; + BitRadioCmdPack22.BufferReceived = "u32 u32 i8 b[1] b"; + })(BitRadioCmdPack2 || (BitRadioCmdPack2 = {})); + var SRV_BOOTLOADER2 = 536516936; + var BootloaderCmdPack2; + ((BootloaderCmdPack22) => { + BootloaderCmdPack22.InfoReport = "u32 u32 u32 u32"; + BootloaderCmdPack22.SetSession = "u32"; + BootloaderCmdPack22.SetSessionReport = "u32"; + BootloaderCmdPack22.PageData = "u32 u16 u8 u8 u32 u32 u32 u32 u32 b[208]"; + BootloaderCmdPack22.PageDataReport = "u32 u32 u32"; + })(BootloaderCmdPack2 || (BootloaderCmdPack2 = {})); + var BrailleDisplayRegPack2; + ((BrailleDisplayRegPack22) => { + BrailleDisplayRegPack22.Enabled = "u8"; + BrailleDisplayRegPack22.Patterns = "s"; + BrailleDisplayRegPack22.Length = "u8"; + })(BrailleDisplayRegPack2 || (BrailleDisplayRegPack2 = {})); + var SRV_BRIDGE2 = 535147631; + var BridgeRegPack2; + ((BridgeRegPack22) => { + BridgeRegPack22.Enabled = "u8"; + })(BridgeRegPack2 || (BridgeRegPack2 = {})); + var SRV_BUTTON2 = 343122531; + var ButtonRegPack2; + ((ButtonRegPack22) => { + ButtonRegPack22.Pressure = "u0.16"; + ButtonRegPack22.Analog = "u8"; + ButtonRegPack22.Pressed = "u8"; + })(ButtonRegPack2 || (ButtonRegPack2 = {})); + var ButtonEventPack2; + ((ButtonEventPack22) => { + ButtonEventPack22.Up = "u32"; + ButtonEventPack22.Hold = "u32"; + })(ButtonEventPack2 || (ButtonEventPack2 = {})); + var SRV_BUZZER2 = 458731991; + var BuzzerRegPack2; + ((BuzzerRegPack22) => { + BuzzerRegPack22.Volume = "u0.8"; + })(BuzzerRegPack2 || (BuzzerRegPack2 = {})); + var BuzzerCmdPack2; + ((BuzzerCmdPack22) => { + BuzzerCmdPack22.PlayTone = "u16 u16 u16"; + BuzzerCmdPack22.PlayNote = "u16 u0.16 u16"; + })(BuzzerCmdPack2 || (BuzzerCmdPack2 = {})); + var CapacitiveButtonRegPack2; + ((CapacitiveButtonRegPack22) => { + CapacitiveButtonRegPack22.Threshold = "u0.16"; + })(CapacitiveButtonRegPack2 || (CapacitiveButtonRegPack2 = {})); + var CharacterScreenRegPack2; + ((CharacterScreenRegPack22) => { + CharacterScreenRegPack22.Message = "s"; + CharacterScreenRegPack22.Brightness = "u0.16"; + CharacterScreenRegPack22.Variant = "u8"; + CharacterScreenRegPack22.TextDirection = "u8"; + CharacterScreenRegPack22.Rows = "u8"; + CharacterScreenRegPack22.Columns = "u8"; + })(CharacterScreenRegPack2 || (CharacterScreenRegPack2 = {})); + var SRV_CLOUD_ADAPTER2 = 341864092; + var CloudAdapterCmdPack2; + ((CloudAdapterCmdPack22) => { + CloudAdapterCmdPack22.UploadJson = "z s"; + CloudAdapterCmdPack22.UploadBinary = "z b"; + })(CloudAdapterCmdPack2 || (CloudAdapterCmdPack2 = {})); + var CloudAdapterRegPack2; + ((CloudAdapterRegPack22) => { + CloudAdapterRegPack22.Connected = "u8"; + CloudAdapterRegPack22.ConnectionName = "s"; + })(CloudAdapterRegPack2 || (CloudAdapterRegPack2 = {})); + var CloudAdapterEventPack2; + ((CloudAdapterEventPack22) => { + CloudAdapterEventPack22.OnJson = "z s"; + CloudAdapterEventPack22.OnBinary = "z b"; + })(CloudAdapterEventPack2 || (CloudAdapterEventPack2 = {})); + var SRV_CLOUD_CONFIGURATION2 = 342028028; + var CloudConfigurationRegPack2; + ((CloudConfigurationRegPack22) => { + CloudConfigurationRegPack22.ServerName = "s"; + CloudConfigurationRegPack22.CloudDeviceId = "s"; + CloudConfigurationRegPack22.CloudType = "s"; + CloudConfigurationRegPack22.ConnectionStatus = "u16"; + CloudConfigurationRegPack22.PushPeriod = "u32"; + CloudConfigurationRegPack22.PushWatchdogPeriod = "u32"; + })(CloudConfigurationRegPack2 || (CloudConfigurationRegPack2 = {})); + var CloudConfigurationCmdPack2; + ((CloudConfigurationCmdPack22) => { + CloudConfigurationCmdPack22.SetConnectionString = "s"; + })(CloudConfigurationCmdPack2 || (CloudConfigurationCmdPack2 = {})); + var CloudConfigurationEventPack2; + ((CloudConfigurationEventPack22) => { + CloudConfigurationEventPack22.ConnectionStatusChange = "u16"; + })(CloudConfigurationEventPack2 || (CloudConfigurationEventPack2 = {})); + var SRV_CODAL_MESSAGE_BUS2 = 304085021; + var CodalMessageBusCmdPack2; + ((CodalMessageBusCmdPack22) => { + CodalMessageBusCmdPack22.Send = "u16 u16"; + })(CodalMessageBusCmdPack2 || (CodalMessageBusCmdPack2 = {})); + var CodalMessageBusEventPack2; + ((CodalMessageBusEventPack22) => { + CodalMessageBusEventPack22.Message = "u16 u16"; + })(CodalMessageBusEventPack2 || (CodalMessageBusEventPack2 = {})); + var ColorRegPack2; + ((ColorRegPack22) => { + ColorRegPack22.Color = "u0.16 u0.16 u0.16"; + })(ColorRegPack2 || (ColorRegPack2 = {})); + var CompassRegPack2; + ((CompassRegPack22) => { + CompassRegPack22.Heading = "u16.16"; + CompassRegPack22.Enabled = "u8"; + CompassRegPack22.HeadingError = "u16.16"; + })(CompassRegPack2 || (CompassRegPack2 = {})); + var SRV_CONTROL2 = 0; + var ControlCmdPack2; + ((ControlCmdPack22) => { + ControlCmdPack22.ServicesReport = "u16 u8 u8 r: u32"; + ControlCmdPack22.FloodPing = "u32 u32 u8"; + ControlCmdPack22.FloodPingReport = "u32 b"; + ControlCmdPack22.SetStatusLight = "u8 u8 u8 u8"; + ControlCmdPack22.ReliableCommands = "u32"; + ControlCmdPack22.ReliableCommandsReport = "b[12]"; + ControlCmdPack22.Standby = "u32"; + })(ControlCmdPack2 || (ControlCmdPack2 = {})); + var ControlPipePack2; + ((ControlPipePack22) => { + ControlPipePack22.WrappedCommand = "u8 u8 u16 b"; + })(ControlPipePack2 || (ControlPipePack2 = {})); + var ControlRegPack2; + ((ControlRegPack22) => { + ControlRegPack22.ResetIn = "u32"; + ControlRegPack22.DeviceDescription = "s"; + ControlRegPack22.ProductIdentifier = "u32"; + ControlRegPack22.BootloaderProductIdentifier = "u32"; + ControlRegPack22.FirmwareVersion = "s"; + ControlRegPack22.McuTemperature = "i16"; + ControlRegPack22.Uptime = "u64"; + })(ControlRegPack2 || (ControlRegPack2 = {})); + var SRV_DASHBOARD2 = 468029703; + var DcCurrentMeasurementRegPack2; + ((DcCurrentMeasurementRegPack22) => { + DcCurrentMeasurementRegPack22.MeasurementName = "s"; + DcCurrentMeasurementRegPack22.Measurement = "f64"; + DcCurrentMeasurementRegPack22.MeasurementError = "f64"; + DcCurrentMeasurementRegPack22.MinMeasurement = "f64"; + DcCurrentMeasurementRegPack22.MaxMeasurement = "f64"; + })(DcCurrentMeasurementRegPack2 || (DcCurrentMeasurementRegPack2 = {})); + var DcVoltageMeasurementRegPack2; + ((DcVoltageMeasurementRegPack22) => { + DcVoltageMeasurementRegPack22.MeasurementType = "u8"; + DcVoltageMeasurementRegPack22.MeasurementName = "s"; + DcVoltageMeasurementRegPack22.Measurement = "f64"; + DcVoltageMeasurementRegPack22.MeasurementError = "f64"; + DcVoltageMeasurementRegPack22.MinMeasurement = "f64"; + DcVoltageMeasurementRegPack22.MaxMeasurement = "f64"; + })(DcVoltageMeasurementRegPack2 || (DcVoltageMeasurementRegPack2 = {})); + var SRV_DEVICE_SCRIPT_CONDITION2 = 295074157; + var SRV_DEVS_DBG2 = 358308672; + var DevsDbgCmdPack2; + ((DevsDbgCmdPack22) => { + DevsDbgCmdPack22.ReadFibers = "b[12]"; + DevsDbgCmdPack22.ReadStack = "b[12] u32"; + DevsDbgCmdPack22.ReadIndexedValues = "b[12] u32 u8 u8 u16 u16"; + DevsDbgCmdPack22.ReadNamedValues = "b[12] u32 u8"; + DevsDbgCmdPack22.ReadValue = "u32 u8"; + DevsDbgCmdPack22.ReadValueReport = "u32 u32 u16 u8"; + DevsDbgCmdPack22.ReadBytes = "b[12] u32 u8 u8 u16 u16"; + DevsDbgCmdPack22.SetBreakpoints = "r: u32"; + DevsDbgCmdPack22.ClearBreakpoints = "r: u32"; + DevsDbgCmdPack22.Step = "u32 u16 u16 r: u32"; + })(DevsDbgCmdPack2 || (DevsDbgCmdPack2 = {})); + var DevsDbgPipePack2; + ((DevsDbgPipePack22) => { + DevsDbgPipePack22.Fiber = "u32 u16 u16"; + DevsDbgPipePack22.Stackframe = "u32 u32 u32 u16 u16"; + DevsDbgPipePack22.Value = "u32 u32 u16 u8"; + DevsDbgPipePack22.KeyValue = "u32 u32 u32 u16 u8"; + DevsDbgPipePack22.BytesValue = "b"; + })(DevsDbgPipePack2 || (DevsDbgPipePack2 = {})); + var DevsDbgRegPack2; + ((DevsDbgRegPack22) => { + DevsDbgRegPack22.Enabled = "u8"; + DevsDbgRegPack22.BreakAtUnhandledExn = "u8"; + DevsDbgRegPack22.BreakAtHandledExn = "u8"; + DevsDbgRegPack22.IsSuspended = "u8"; + })(DevsDbgRegPack2 || (DevsDbgRegPack2 = {})); + var DevsDbgEventPack2; + ((DevsDbgEventPack22) => { + DevsDbgEventPack22.Suspended = "u32 u8"; + })(DevsDbgEventPack2 || (DevsDbgEventPack2 = {})); + var SRV_DEVICE_SCRIPT_MANAGER2 = 288680491; + var DeviceScriptManagerCmdPack2; + ((DeviceScriptManagerCmdPack22) => { + DeviceScriptManagerCmdPack22.DeployBytecode = "u32"; + DeviceScriptManagerCmdPack22.DeployBytecodeReport = "u16"; + DeviceScriptManagerCmdPack22.ReadBytecode = "b[12]"; + })(DeviceScriptManagerCmdPack2 || (DeviceScriptManagerCmdPack2 = {})); + var DeviceScriptManagerPipePack2; + ((DeviceScriptManagerPipePack22) => { + DeviceScriptManagerPipePack22.Bytecode = "b"; + })(DeviceScriptManagerPipePack2 || (DeviceScriptManagerPipePack2 = {})); + var DeviceScriptManagerRegPack2; + ((DeviceScriptManagerRegPack22) => { + DeviceScriptManagerRegPack22.Running = "u8"; + DeviceScriptManagerRegPack22.Autostart = "u8"; + DeviceScriptManagerRegPack22.ProgramSize = "u32"; + DeviceScriptManagerRegPack22.ProgramHash = "u32"; + DeviceScriptManagerRegPack22.ProgramSha256 = "b[32]"; + DeviceScriptManagerRegPack22.RuntimeVersion = "u16 u8 u8"; + DeviceScriptManagerRegPack22.ProgramName = "s"; + DeviceScriptManagerRegPack22.ProgramVersion = "s"; + })(DeviceScriptManagerRegPack2 || (DeviceScriptManagerRegPack2 = {})); + var DeviceScriptManagerEventPack2; + ((DeviceScriptManagerEventPack22) => { + DeviceScriptManagerEventPack22.ProgramPanic = "u32 u32"; + })(DeviceScriptManagerEventPack2 || (DeviceScriptManagerEventPack2 = {})); + var DistanceRegPack2; + ((DistanceRegPack22) => { + DistanceRegPack22.Distance = "u16.16"; + DistanceRegPack22.DistanceError = "u16.16"; + DistanceRegPack22.MinRange = "u16.16"; + DistanceRegPack22.MaxRange = "u16.16"; + DistanceRegPack22.Variant = "u8"; + })(DistanceRegPack2 || (DistanceRegPack2 = {})); + var DmxRegPack2; + ((DmxRegPack22) => { + DmxRegPack22.Enabled = "u8"; + })(DmxRegPack2 || (DmxRegPack2 = {})); + var DmxCmdPack2; + ((DmxCmdPack22) => { + DmxCmdPack22.Send = "b"; + })(DmxCmdPack2 || (DmxCmdPack2 = {})); + var DotMatrixRegPack2; + ((DotMatrixRegPack22) => { + DotMatrixRegPack22.Dots = "b"; + DotMatrixRegPack22.Brightness = "u0.8"; + DotMatrixRegPack22.Rows = "u16"; + DotMatrixRegPack22.Columns = "u16"; + DotMatrixRegPack22.Variant = "u8"; + })(DotMatrixRegPack2 || (DotMatrixRegPack2 = {})); + var DualMotorsRegPack2; + ((DualMotorsRegPack22) => { + DualMotorsRegPack22.Speed = "i1.15 i1.15"; + DualMotorsRegPack22.Enabled = "u8"; + DualMotorsRegPack22.LoadTorque = "u16.16"; + DualMotorsRegPack22.LoadRotationSpeed = "u16.16"; + DualMotorsRegPack22.Reversible = "u8"; + })(DualMotorsRegPack2 || (DualMotorsRegPack2 = {})); + var ECO2RegPack2; + ((ECO2RegPack22) => { + ECO2RegPack22.ECO2 = "u22.10"; + ECO2RegPack22.ECO2Error = "u22.10"; + ECO2RegPack22.MinECO2 = "u22.10"; + ECO2RegPack22.MaxECO2 = "u22.10"; + ECO2RegPack22.Variant = "u8"; + })(ECO2RegPack2 || (ECO2RegPack2 = {})); + var FlexRegPack2; + ((FlexRegPack22) => { + FlexRegPack22.Bending = "i1.15"; + FlexRegPack22.Length = "u16"; + })(FlexRegPack2 || (FlexRegPack2 = {})); + var GamepadRegPack2; + ((GamepadRegPack22) => { + GamepadRegPack22.Direction = "u32 i1.15 i1.15"; + GamepadRegPack22.Variant = "u8"; + GamepadRegPack22.ButtonsAvailable = "u32"; + })(GamepadRegPack2 || (GamepadRegPack2 = {})); + var GamepadEventPack2; + ((GamepadEventPack22) => { + GamepadEventPack22.ButtonsChanged = "u32"; + })(GamepadEventPack2 || (GamepadEventPack2 = {})); + var SRV_GPIO2 = 282614377; + var GPIORegPack2; + ((GPIORegPack22) => { + GPIORegPack22.State = "b"; + GPIORegPack22.NumPins = "u8"; + })(GPIORegPack2 || (GPIORegPack2 = {})); + var GPIOCmdPack2; + ((GPIOCmdPack22) => { + GPIOCmdPack22.Configure = "r: u8 u8"; + GPIOCmdPack22.PinInfo = "u8"; + GPIOCmdPack22.PinInfoReport = "u8 u8 u16 u8 s"; + GPIOCmdPack22.PinByLabel = "s"; + GPIOCmdPack22.PinByLabelReport = "u8 u8 u16 u8 s"; + GPIOCmdPack22.PinByHwPin = "u8"; + GPIOCmdPack22.PinByHwPinReport = "u8 u8 u16 u8 s"; + })(GPIOCmdPack2 || (GPIOCmdPack2 = {})); + var GyroscopeRegPack2; + ((GyroscopeRegPack22) => { + GyroscopeRegPack22.RotationRates = "i12.20 i12.20 i12.20"; + GyroscopeRegPack22.RotationRatesError = "u12.20"; + GyroscopeRegPack22.MaxRate = "u12.20"; + GyroscopeRegPack22.MaxRatesSupported = "r: u12.20"; + })(GyroscopeRegPack2 || (GyroscopeRegPack2 = {})); + var HeartRateRegPack2; + ((HeartRateRegPack22) => { + HeartRateRegPack22.HeartRate = "u16.16"; + HeartRateRegPack22.HeartRateError = "u16.16"; + HeartRateRegPack22.Variant = "u8"; + })(HeartRateRegPack2 || (HeartRateRegPack2 = {})); + var HidJoystickRegPack2; + ((HidJoystickRegPack22) => { + HidJoystickRegPack22.ButtonCount = "u8"; + HidJoystickRegPack22.ButtonsAnalog = "u32"; + HidJoystickRegPack22.AxisCount = "u8"; + })(HidJoystickRegPack2 || (HidJoystickRegPack2 = {})); + var HidJoystickCmdPack2; + ((HidJoystickCmdPack22) => { + HidJoystickCmdPack22.SetButtons = "r: u0.8"; + HidJoystickCmdPack22.SetAxis = "r: i1.15"; + })(HidJoystickCmdPack2 || (HidJoystickCmdPack2 = {})); + var HidKeyboardCmdPack2; + ((HidKeyboardCmdPack22) => { + HidKeyboardCmdPack22.Key = "r: u16 u8 u8"; + })(HidKeyboardCmdPack2 || (HidKeyboardCmdPack2 = {})); + var HidMouseCmdPack2; + ((HidMouseCmdPack22) => { + HidMouseCmdPack22.SetButton = "u16 u8"; + HidMouseCmdPack22.Move = "i16 i16 u16"; + HidMouseCmdPack22.Wheel = "i16 u16"; + })(HidMouseCmdPack2 || (HidMouseCmdPack2 = {})); + var HumidityRegPack2; + ((HumidityRegPack22) => { + HumidityRegPack22.Humidity = "u22.10"; + HumidityRegPack22.HumidityError = "u22.10"; + HumidityRegPack22.MinHumidity = "u22.10"; + HumidityRegPack22.MaxHumidity = "u22.10"; + })(HumidityRegPack2 || (HumidityRegPack2 = {})); + var SRV_I2C2 = 471386691; + var I2CRegPack2; + ((I2CRegPack22) => { + I2CRegPack22.Ok = "u8"; + })(I2CRegPack2 || (I2CRegPack2 = {})); + var I2CCmdPack2; + ((I2CCmdPack22) => { + I2CCmdPack22.Transaction = "u8 u8 b"; + I2CCmdPack22.TransactionReport = "u8 b"; + })(I2CCmdPack2 || (I2CCmdPack2 = {})); + var IlluminanceRegPack2; + ((IlluminanceRegPack22) => { + IlluminanceRegPack22.Illuminance = "u22.10"; + IlluminanceRegPack22.IlluminanceError = "u22.10"; + })(IlluminanceRegPack2 || (IlluminanceRegPack2 = {})); + var IndexedScreenCmdPack2; + ((IndexedScreenCmdPack22) => { + IndexedScreenCmdPack22.StartUpdate = "u16 u16 u16 u16"; + IndexedScreenCmdPack22.SetPixels = "b"; + })(IndexedScreenCmdPack2 || (IndexedScreenCmdPack2 = {})); + var IndexedScreenRegPack2; + ((IndexedScreenRegPack22) => { + IndexedScreenRegPack22.Brightness = "u0.8"; + IndexedScreenRegPack22.Palette = "b"; + IndexedScreenRegPack22.BitsPerPixel = "u8"; + IndexedScreenRegPack22.Width = "u16"; + IndexedScreenRegPack22.Height = "u16"; + IndexedScreenRegPack22.WidthMajor = "u8"; + IndexedScreenRegPack22.UpSampling = "u8"; + IndexedScreenRegPack22.Rotation = "u16"; + })(IndexedScreenRegPack2 || (IndexedScreenRegPack2 = {})); + var SRV_INFRASTRUCTURE2 = 504728043; + var LedRegPack2; + ((LedRegPack22) => { + LedRegPack22.Pixels = "b"; + LedRegPack22.Brightness = "u0.8"; + LedRegPack22.ActualBrightness = "u0.8"; + LedRegPack22.NumPixels = "u16"; + LedRegPack22.NumColumns = "u16"; + LedRegPack22.MaxPower = "u16"; + LedRegPack22.LedsPerPixel = "u16"; + LedRegPack22.WaveLength = "u16"; + LedRegPack22.LuminousIntensity = "u16"; + LedRegPack22.Variant = "u8"; + })(LedRegPack2 || (LedRegPack2 = {})); + var LedSingleCmdPack2; + ((LedSingleCmdPack22) => { + LedSingleCmdPack22.Animate = "u8 u8 u8 u8"; + })(LedSingleCmdPack2 || (LedSingleCmdPack2 = {})); + var LedSingleRegPack2; + ((LedSingleRegPack22) => { + LedSingleRegPack22.Color = "u8 u8 u8"; + LedSingleRegPack22.MaxPower = "u16"; + LedSingleRegPack22.LedCount = "u16"; + LedSingleRegPack22.WaveLength = "u16"; + LedSingleRegPack22.LuminousIntensity = "u16"; + LedSingleRegPack22.Variant = "u8"; + })(LedSingleRegPack2 || (LedSingleRegPack2 = {})); + var LedStripRegPack2; + ((LedStripRegPack22) => { + LedStripRegPack22.Brightness = "u0.8"; + LedStripRegPack22.ActualBrightness = "u0.8"; + LedStripRegPack22.LightType = "u8"; + LedStripRegPack22.NumPixels = "u16"; + LedStripRegPack22.NumColumns = "u16"; + LedStripRegPack22.MaxPower = "u16"; + LedStripRegPack22.MaxPixels = "u16"; + LedStripRegPack22.NumRepeats = "u16"; + LedStripRegPack22.Variant = "u8"; + })(LedStripRegPack2 || (LedStripRegPack2 = {})); + var LedStripCmdPack2; + ((LedStripCmdPack22) => { + LedStripCmdPack22.Run = "b"; + })(LedStripCmdPack2 || (LedStripCmdPack2 = {})); + var LightBulbRegPack2; + ((LightBulbRegPack22) => { + LightBulbRegPack22.Brightness = "u0.16"; + LightBulbRegPack22.Dimmable = "u8"; + })(LightBulbRegPack2 || (LightBulbRegPack2 = {})); + var LightLevelRegPack2; + ((LightLevelRegPack22) => { + LightLevelRegPack22.LightLevel = "u0.16"; + LightLevelRegPack22.LightLevelError = "u0.16"; + LightLevelRegPack22.Variant = "u8"; + })(LightLevelRegPack2 || (LightLevelRegPack2 = {})); + var SRV_LOGGER2 = 316415946; + var LoggerRegPack2; + ((LoggerRegPack22) => { + LoggerRegPack22.MinPriority = "u8"; + })(LoggerRegPack2 || (LoggerRegPack2 = {})); + var LoggerCmdPack2; + ((LoggerCmdPack22) => { + LoggerCmdPack22.Debug = "s"; + LoggerCmdPack22.Log = "s"; + LoggerCmdPack22.Warn = "s"; + LoggerCmdPack22.Error = "s"; + })(LoggerCmdPack2 || (LoggerCmdPack2 = {})); + var SRV_MAGNETIC_FIELD_LEVEL2 = 318642191; + var MagneticFieldLevelRegPack2; + ((MagneticFieldLevelRegPack22) => { + MagneticFieldLevelRegPack22.Strength = "i1.15"; + MagneticFieldLevelRegPack22.Detected = "u8"; + MagneticFieldLevelRegPack22.Variant = "u8"; + })(MagneticFieldLevelRegPack2 || (MagneticFieldLevelRegPack2 = {})); + var MagnetometerRegPack2; + ((MagnetometerRegPack22) => { + MagnetometerRegPack22.Forces = "i32 i32 i32"; + MagnetometerRegPack22.ForcesError = "i32"; + })(MagnetometerRegPack2 || (MagnetometerRegPack2 = {})); + var MatrixKeypadRegPack2; + ((MatrixKeypadRegPack22) => { + MatrixKeypadRegPack22.Pressed = "r: u8"; + MatrixKeypadRegPack22.Rows = "u8"; + MatrixKeypadRegPack22.Columns = "u8"; + MatrixKeypadRegPack22.Labels = "r: z"; + MatrixKeypadRegPack22.Variant = "u8"; + })(MatrixKeypadRegPack2 || (MatrixKeypadRegPack2 = {})); + var MatrixKeypadEventPack2; + ((MatrixKeypadEventPack22) => { + MatrixKeypadEventPack22.Down = "u8"; + MatrixKeypadEventPack22.Up = "u8"; + MatrixKeypadEventPack22.Click = "u8"; + MatrixKeypadEventPack22.LongClick = "u8"; + })(MatrixKeypadEventPack2 || (MatrixKeypadEventPack2 = {})); + var MicrophoneCmdPack2; + ((MicrophoneCmdPack22) => { + MicrophoneCmdPack22.Sample = "b[12] u32"; + })(MicrophoneCmdPack2 || (MicrophoneCmdPack2 = {})); + var MicrophoneRegPack2; + ((MicrophoneRegPack22) => { + MicrophoneRegPack22.SamplingPeriod = "u32"; + })(MicrophoneRegPack2 || (MicrophoneRegPack2 = {})); + var MidiOutputRegPack2; + ((MidiOutputRegPack22) => { + MidiOutputRegPack22.Enabled = "u8"; + })(MidiOutputRegPack2 || (MidiOutputRegPack2 = {})); + var MidiOutputCmdPack2; + ((MidiOutputCmdPack22) => { + MidiOutputCmdPack22.Send = "b"; + })(MidiOutputCmdPack2 || (MidiOutputCmdPack2 = {})); + var ModelRunnerCmdPack2; + ((ModelRunnerCmdPack22) => { + ModelRunnerCmdPack22.SetModel = "u32"; + ModelRunnerCmdPack22.SetModelReport = "u16"; + ModelRunnerCmdPack22.Predict = "b[12]"; + ModelRunnerCmdPack22.PredictReport = "u16"; + })(ModelRunnerCmdPack2 || (ModelRunnerCmdPack2 = {})); + var ModelRunnerRegPack2; + ((ModelRunnerRegPack22) => { + ModelRunnerRegPack22.AutoInvokeEvery = "u16"; + ModelRunnerRegPack22.Outputs = "r: f32"; + ModelRunnerRegPack22.InputShape = "r: u16"; + ModelRunnerRegPack22.OutputShape = "r: u16"; + ModelRunnerRegPack22.LastRunTime = "u32"; + ModelRunnerRegPack22.AllocatedArenaSize = "u32"; + ModelRunnerRegPack22.ModelSize = "u32"; + ModelRunnerRegPack22.LastError = "s"; + ModelRunnerRegPack22.Format = "u32"; + ModelRunnerRegPack22.FormatVersion = "u32"; + ModelRunnerRegPack22.Parallel = "u8"; + })(ModelRunnerRegPack2 || (ModelRunnerRegPack2 = {})); + var MotionRegPack2; + ((MotionRegPack22) => { + MotionRegPack22.Moving = "u8"; + MotionRegPack22.MaxDistance = "u16.16"; + MotionRegPack22.Angle = "u16"; + MotionRegPack22.Variant = "u8"; + })(MotionRegPack2 || (MotionRegPack2 = {})); + var MotorRegPack2; + ((MotorRegPack22) => { + MotorRegPack22.Speed = "i1.15"; + MotorRegPack22.Enabled = "u8"; + MotorRegPack22.LoadTorque = "u16.16"; + MotorRegPack22.LoadRotationSpeed = "u16.16"; + MotorRegPack22.Reversible = "u8"; + })(MotorRegPack2 || (MotorRegPack2 = {})); + var MultitouchRegPack2; + ((MultitouchRegPack22) => { + MultitouchRegPack22.Capacity = "r: i16"; + })(MultitouchRegPack2 || (MultitouchRegPack2 = {})); + var MultitouchEventPack2; + ((MultitouchEventPack22) => { + MultitouchEventPack22.Touch = "u8"; + MultitouchEventPack22.Release = "u8"; + MultitouchEventPack22.Tap = "u8"; + MultitouchEventPack22.LongPress = "u8"; + MultitouchEventPack22.SwipePos = "u16 u8 u8"; + MultitouchEventPack22.SwipeNeg = "u16 u8 u8"; + })(MultitouchEventPack2 || (MultitouchEventPack2 = {})); + var PlanarPositionRegPack2; + ((PlanarPositionRegPack22) => { + PlanarPositionRegPack22.Position = "i22.10 i22.10"; + PlanarPositionRegPack22.Variant = "u8"; + })(PlanarPositionRegPack2 || (PlanarPositionRegPack2 = {})); + var PotentiometerRegPack2; + ((PotentiometerRegPack22) => { + PotentiometerRegPack22.Position = "u0.16"; + PotentiometerRegPack22.Variant = "u8"; + })(PotentiometerRegPack2 || (PotentiometerRegPack2 = {})); + var PowerRegPack2; + ((PowerRegPack22) => { + PowerRegPack22.Allowed = "u8"; + PowerRegPack22.MaxPower = "u16"; + PowerRegPack22.PowerStatus = "u8"; + PowerRegPack22.CurrentDraw = "u16"; + PowerRegPack22.BatteryVoltage = "u16"; + PowerRegPack22.BatteryCharge = "u0.16"; + PowerRegPack22.BatteryCapacity = "u32"; + PowerRegPack22.KeepOnPulseDuration = "u16"; + PowerRegPack22.KeepOnPulsePeriod = "u16"; + })(PowerRegPack2 || (PowerRegPack2 = {})); + var PowerEventPack2; + ((PowerEventPack22) => { + PowerEventPack22.PowerStatusChanged = "u8"; + })(PowerEventPack2 || (PowerEventPack2 = {})); + var PowerSupplyRegPack2; + ((PowerSupplyRegPack22) => { + PowerSupplyRegPack22.Enabled = "u8"; + PowerSupplyRegPack22.OutputVoltage = "f64"; + PowerSupplyRegPack22.MinimumVoltage = "f64"; + PowerSupplyRegPack22.MaximumVoltage = "f64"; + })(PowerSupplyRegPack2 || (PowerSupplyRegPack2 = {})); + var PressureButtonRegPack2; + ((PressureButtonRegPack22) => { + PressureButtonRegPack22.Threshold = "u0.16"; + })(PressureButtonRegPack2 || (PressureButtonRegPack2 = {})); + var SRV_PROTO_TEST2 = 382158442; + var ProtoTestRegPack2; + ((ProtoTestRegPack22) => { + ProtoTestRegPack22.RwBool = "u8"; + ProtoTestRegPack22.RoBool = "u8"; + ProtoTestRegPack22.RwU32 = "u32"; + ProtoTestRegPack22.RoU32 = "u32"; + ProtoTestRegPack22.RwI32 = "i32"; + ProtoTestRegPack22.RoI32 = "i32"; + ProtoTestRegPack22.RwString = "s"; + ProtoTestRegPack22.RoString = "s"; + ProtoTestRegPack22.RwBytes = "b"; + ProtoTestRegPack22.RoBytes = "b"; + ProtoTestRegPack22.RwI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestRegPack22.RoI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestRegPack22.RwU8String = "u8 s"; + ProtoTestRegPack22.RoU8String = "u8 s"; + })(ProtoTestRegPack2 || (ProtoTestRegPack2 = {})); + var ProtoTestEventPack2; + ((ProtoTestEventPack22) => { + ProtoTestEventPack22.EBool = "u8"; + ProtoTestEventPack22.EU32 = "u32"; + ProtoTestEventPack22.EI32 = "i32"; + ProtoTestEventPack22.EString = "s"; + ProtoTestEventPack22.EBytes = "b"; + ProtoTestEventPack22.EI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestEventPack22.EU8String = "u8 s"; + })(ProtoTestEventPack2 || (ProtoTestEventPack2 = {})); + var ProtoTestCmdPack2; + ((ProtoTestCmdPack22) => { + ProtoTestCmdPack22.CBool = "u8"; + ProtoTestCmdPack22.CU32 = "u32"; + ProtoTestCmdPack22.CI32 = "i32"; + ProtoTestCmdPack22.CString = "s"; + ProtoTestCmdPack22.CBytes = "b"; + ProtoTestCmdPack22.CI8U8U16I32 = "i8 u8 u16 i32"; + ProtoTestCmdPack22.CU8String = "u8 s"; + ProtoTestCmdPack22.CReportPipe = "b[12]"; + })(ProtoTestCmdPack2 || (ProtoTestCmdPack2 = {})); + var ProtoTestPipePack2; + ((ProtoTestPipePack22) => { + ProtoTestPipePack22.PBytes = "u8"; + })(ProtoTestPipePack2 || (ProtoTestPipePack2 = {})); + var SRV_PROXY2 = 384932169; + var PulseOximeterRegPack2; + ((PulseOximeterRegPack22) => { + PulseOximeterRegPack22.Oxygen = "u8.8"; + PulseOximeterRegPack22.OxygenError = "u8.8"; + })(PulseOximeterRegPack2 || (PulseOximeterRegPack2 = {})); + var RainGaugeRegPack2; + ((RainGaugeRegPack22) => { + RainGaugeRegPack22.Precipitation = "u16.16"; + RainGaugeRegPack22.PrecipitationPrecision = "u16.16"; + })(RainGaugeRegPack2 || (RainGaugeRegPack2 = {})); + var RealTimeClockRegPack2; + ((RealTimeClockRegPack22) => { + RealTimeClockRegPack22.LocalTime = "u16 u8 u8 u8 u8 u8 u8"; + RealTimeClockRegPack22.Drift = "u16.16"; + RealTimeClockRegPack22.Precision = "u16.16"; + RealTimeClockRegPack22.Variant = "u8"; + })(RealTimeClockRegPack2 || (RealTimeClockRegPack2 = {})); + var RealTimeClockCmdPack2; + ((RealTimeClockCmdPack22) => { + RealTimeClockCmdPack22.SetTime = "u16 u8 u8 u8 u8 u8 u8"; + })(RealTimeClockCmdPack2 || (RealTimeClockCmdPack2 = {})); + var ReflectedLightRegPack2; + ((ReflectedLightRegPack22) => { + ReflectedLightRegPack22.Brightness = "u0.16"; + ReflectedLightRegPack22.Variant = "u8"; + })(ReflectedLightRegPack2 || (ReflectedLightRegPack2 = {})); + var RelayRegPack2; + ((RelayRegPack22) => { + RelayRegPack22.Active = "u8"; + RelayRegPack22.Variant = "u8"; + RelayRegPack22.MaxSwitchingCurrent = "u32"; + })(RelayRegPack2 || (RelayRegPack2 = {})); + var RngRegPack2; + ((RngRegPack22) => { + RngRegPack22.Random = "b"; + RngRegPack22.Variant = "u8"; + })(RngRegPack2 || (RngRegPack2 = {})); + var SRV_ROLE_MANAGER2 = 508264038; + var RoleManagerRegPack2; + ((RoleManagerRegPack22) => { + RoleManagerRegPack22.AutoBind = "u8"; + RoleManagerRegPack22.AllRolesAllocated = "u8"; + })(RoleManagerRegPack2 || (RoleManagerRegPack2 = {})); + var RoleManagerCmdPack2; + ((RoleManagerCmdPack22) => { + RoleManagerCmdPack22.SetRole = "b[8] u8 s"; + RoleManagerCmdPack22.ListRoles = "b[12]"; + })(RoleManagerCmdPack2 || (RoleManagerCmdPack2 = {})); + var RoleManagerPipePack2; + ((RoleManagerPipePack22) => { + RoleManagerPipePack22.Roles = "b[8] u32 u8 s"; + })(RoleManagerPipePack2 || (RoleManagerPipePack2 = {})); + var SRV_ROS2 = 354743340; + var RosCmdPack2; + ((RosCmdPack22) => { + RosCmdPack22.PublishMessage = "z z s"; + RosCmdPack22.SubscribeMessage = "z s"; + RosCmdPack22.Message = "z z s"; + })(RosCmdPack2 || (RosCmdPack2 = {})); + var RotaryEncoderRegPack2; + ((RotaryEncoderRegPack22) => { + RotaryEncoderRegPack22.Position = "i32"; + RotaryEncoderRegPack22.ClicksPerTurn = "u16"; + RotaryEncoderRegPack22.Clicker = "u8"; + })(RotaryEncoderRegPack2 || (RotaryEncoderRegPack2 = {})); + var RoverRegPack2; + ((RoverRegPack22) => { + RoverRegPack22.Kinematics = "i16.16 i16.16 i16.16 i16.16 i16.16"; + })(RoverRegPack2 || (RoverRegPack2 = {})); + var SatNavRegPack2; + ((SatNavRegPack22) => { + SatNavRegPack22.Position = "u64 i9.23 i9.23 u16.16 i26.6 u16.16"; + SatNavRegPack22.Enabled = "u8"; + })(SatNavRegPack2 || (SatNavRegPack2 = {})); + var SensorAggregatorRegPack2; + ((SensorAggregatorRegPack22) => { + SensorAggregatorRegPack22.Inputs = "u16 u16 u32 r: b[8] u32 u8 u8 u8 i8"; + SensorAggregatorRegPack22.NumSamples = "u32"; + SensorAggregatorRegPack22.SampleSize = "u8"; + SensorAggregatorRegPack22.StreamingSamples = "u32"; + SensorAggregatorRegPack22.CurrentSample = "b"; + })(SensorAggregatorRegPack2 || (SensorAggregatorRegPack2 = {})); + var SerialRegPack2; + ((SerialRegPack22) => { + SerialRegPack22.Connected = "u8"; + SerialRegPack22.ConnectionName = "s"; + SerialRegPack22.BaudRate = "u32"; + SerialRegPack22.DataBits = "u8"; + SerialRegPack22.StopBits = "u8"; + SerialRegPack22.ParityMode = "u8"; + SerialRegPack22.BufferSize = "u8"; + })(SerialRegPack2 || (SerialRegPack2 = {})); + var SerialCmdPack2; + ((SerialCmdPack22) => { + SerialCmdPack22.Send = "b"; + SerialCmdPack22.Received = "b"; + })(SerialCmdPack2 || (SerialCmdPack2 = {})); + var ServoRegPack2; + ((ServoRegPack22) => { + ServoRegPack22.Angle = "i16.16"; + ServoRegPack22.Enabled = "u8"; + ServoRegPack22.Offset = "i16.16"; + ServoRegPack22.MinAngle = "i16.16"; + ServoRegPack22.MinPulse = "u16"; + ServoRegPack22.MaxAngle = "i16.16"; + ServoRegPack22.MaxPulse = "u16"; + ServoRegPack22.StallTorque = "u16.16"; + ServoRegPack22.ResponseSpeed = "u16.16"; + ServoRegPack22.ActualAngle = "i16.16"; + })(ServoRegPack2 || (ServoRegPack2 = {})); + var SRV_SETTINGS2 = 285727818; + var SettingsCmdPack2; + ((SettingsCmdPack22) => { + SettingsCmdPack22.Get = "s"; + SettingsCmdPack22.GetReport = "z b"; + SettingsCmdPack22.Set = "z b"; + SettingsCmdPack22.Delete = "s"; + SettingsCmdPack22.ListKeys = "b[12]"; + SettingsCmdPack22.List = "b[12]"; + })(SettingsCmdPack2 || (SettingsCmdPack2 = {})); + var SettingsPipePack2; + ((SettingsPipePack22) => { + SettingsPipePack22.ListedKey = "s"; + SettingsPipePack22.ListedEntry = "z b"; + })(SettingsPipePack2 || (SettingsPipePack2 = {})); + var SevenSegmentDisplayRegPack2; + ((SevenSegmentDisplayRegPack22) => { + SevenSegmentDisplayRegPack22.Digits = "b"; + SevenSegmentDisplayRegPack22.Brightness = "u0.16"; + SevenSegmentDisplayRegPack22.DoubleDots = "u8"; + SevenSegmentDisplayRegPack22.DigitCount = "u8"; + SevenSegmentDisplayRegPack22.DecimalPoint = "u8"; + })(SevenSegmentDisplayRegPack2 || (SevenSegmentDisplayRegPack2 = {})); + var SevenSegmentDisplayCmdPack2; + ((SevenSegmentDisplayCmdPack22) => { + SevenSegmentDisplayCmdPack22.SetNumber = "f64"; + })(SevenSegmentDisplayCmdPack2 || (SevenSegmentDisplayCmdPack2 = {})); + var SoilMoistureRegPack2; + ((SoilMoistureRegPack22) => { + SoilMoistureRegPack22.Moisture = "u0.16"; + SoilMoistureRegPack22.MoistureError = "u0.16"; + SoilMoistureRegPack22.Variant = "u8"; + })(SoilMoistureRegPack2 || (SoilMoistureRegPack2 = {})); + var SolenoidRegPack2; + ((SolenoidRegPack22) => { + SolenoidRegPack22.Pulled = "u8"; + SolenoidRegPack22.Variant = "u8"; + })(SolenoidRegPack2 || (SolenoidRegPack2 = {})); + var SoundLevelRegPack2; + ((SoundLevelRegPack22) => { + SoundLevelRegPack22.SoundLevel = "u0.16"; + SoundLevelRegPack22.Enabled = "u8"; + SoundLevelRegPack22.LoudThreshold = "u0.16"; + SoundLevelRegPack22.QuietThreshold = "u0.16"; + })(SoundLevelRegPack2 || (SoundLevelRegPack2 = {})); + var SoundPlayerRegPack2; + ((SoundPlayerRegPack22) => { + SoundPlayerRegPack22.Volume = "u0.16"; + })(SoundPlayerRegPack2 || (SoundPlayerRegPack2 = {})); + var SoundPlayerCmdPack2; + ((SoundPlayerCmdPack22) => { + SoundPlayerCmdPack22.Play = "s"; + SoundPlayerCmdPack22.ListSounds = "b[12]"; + })(SoundPlayerCmdPack2 || (SoundPlayerCmdPack2 = {})); + var SoundPlayerPipePack2; + ((SoundPlayerPipePack22) => { + SoundPlayerPipePack22.ListSoundsPipe = "u32 s"; + })(SoundPlayerPipePack2 || (SoundPlayerPipePack2 = {})); + var SoundRecorderWithPlaybackCmdPack2; + ((SoundRecorderWithPlaybackCmdPack22) => { + SoundRecorderWithPlaybackCmdPack22.Record = "u16"; + })(SoundRecorderWithPlaybackCmdPack2 || (SoundRecorderWithPlaybackCmdPack2 = {})); + var SoundRecorderWithPlaybackRegPack2; + ((SoundRecorderWithPlaybackRegPack22) => { + SoundRecorderWithPlaybackRegPack22.Status = "u8"; + SoundRecorderWithPlaybackRegPack22.Time = "u16"; + SoundRecorderWithPlaybackRegPack22.Volume = "u0.8"; + })(SoundRecorderWithPlaybackRegPack2 || (SoundRecorderWithPlaybackRegPack2 = {})); + var SoundSpectrumRegPack2; + ((SoundSpectrumRegPack22) => { + SoundSpectrumRegPack22.FrequencyBins = "b"; + SoundSpectrumRegPack22.Enabled = "u8"; + SoundSpectrumRegPack22.FftPow2Size = "u8"; + SoundSpectrumRegPack22.MinDecibels = "i16"; + SoundSpectrumRegPack22.MaxDecibels = "i16"; + SoundSpectrumRegPack22.SmoothingTimeConstant = "u0.8"; + })(SoundSpectrumRegPack2 || (SoundSpectrumRegPack2 = {})); + var SpeechSynthesisRegPack2; + ((SpeechSynthesisRegPack22) => { + SpeechSynthesisRegPack22.Enabled = "u8"; + SpeechSynthesisRegPack22.Lang = "s"; + SpeechSynthesisRegPack22.Volume = "u0.8"; + SpeechSynthesisRegPack22.Pitch = "u16.16"; + SpeechSynthesisRegPack22.Rate = "u16.16"; + })(SpeechSynthesisRegPack2 || (SpeechSynthesisRegPack2 = {})); + var SpeechSynthesisCmdPack2; + ((SpeechSynthesisCmdPack22) => { + SpeechSynthesisCmdPack22.Speak = "s"; + })(SpeechSynthesisCmdPack2 || (SpeechSynthesisCmdPack2 = {})); + var SwitchRegPack2; + ((SwitchRegPack22) => { + SwitchRegPack22.Active = "u8"; + SwitchRegPack22.Variant = "u8"; + })(SwitchRegPack2 || (SwitchRegPack2 = {})); + var SRV_TCP2 = 457422603; + var TcpCmdPack2; + ((TcpCmdPack22) => { + TcpCmdPack22.Open = "b[12]"; + TcpCmdPack22.OpenReport = "u16"; + })(TcpCmdPack2 || (TcpCmdPack2 = {})); + var TcpPipeCmdPack2; + ((TcpPipeCmdPack22) => { + TcpPipeCmdPack22.OpenSsl = "u16 s"; + TcpPipeCmdPack22.Error = "i32"; + })(TcpPipeCmdPack2 || (TcpPipeCmdPack2 = {})); + var TcpPipePack2; + ((TcpPipePack22) => { + TcpPipePack22.Outdata = "b"; + TcpPipePack22.Indata = "b"; + })(TcpPipePack2 || (TcpPipePack2 = {})); + var TemperatureRegPack2; + ((TemperatureRegPack22) => { + TemperatureRegPack22.Temperature = "i22.10"; + TemperatureRegPack22.MinTemperature = "i22.10"; + TemperatureRegPack22.MaxTemperature = "i22.10"; + TemperatureRegPack22.TemperatureError = "u22.10"; + TemperatureRegPack22.Variant = "u8"; + })(TemperatureRegPack2 || (TemperatureRegPack2 = {})); + var TimeseriesAggregatorCmdPack2; + ((TimeseriesAggregatorCmdPack22) => { + TimeseriesAggregatorCmdPack22.Update = "f64 s"; + TimeseriesAggregatorCmdPack22.SetWindow = "u32 s"; + TimeseriesAggregatorCmdPack22.SetUpload = "u8 s"; + TimeseriesAggregatorCmdPack22.Stored = "u32 b[4] f64 f64 f64 u32 u32 s"; + })(TimeseriesAggregatorCmdPack2 || (TimeseriesAggregatorCmdPack2 = {})); + var TimeseriesAggregatorRegPack2; + ((TimeseriesAggregatorRegPack22) => { + TimeseriesAggregatorRegPack22.Now = "u32"; + TimeseriesAggregatorRegPack22.FastStart = "u8"; + TimeseriesAggregatorRegPack22.DefaultWindow = "u32"; + TimeseriesAggregatorRegPack22.DefaultUpload = "u8"; + TimeseriesAggregatorRegPack22.UploadUnlabelled = "u8"; + TimeseriesAggregatorRegPack22.SensorWatchdogPeriod = "u32"; + })(TimeseriesAggregatorRegPack2 || (TimeseriesAggregatorRegPack2 = {})); + var TrafficLightRegPack2; + ((TrafficLightRegPack22) => { + TrafficLightRegPack22.Red = "u8"; + TrafficLightRegPack22.Yellow = "u8"; + TrafficLightRegPack22.Green = "u8"; + })(TrafficLightRegPack2 || (TrafficLightRegPack2 = {})); + var TvocRegPack2; + ((TvocRegPack22) => { + TvocRegPack22.TVOC = "u22.10"; + TvocRegPack22.TVOCError = "u22.10"; + TvocRegPack22.MinTVOC = "u22.10"; + TvocRegPack22.MaxTVOC = "u22.10"; + })(TvocRegPack2 || (TvocRegPack2 = {})); + var SRV_UNIQUE_BRAIN2 = 272387813; + var UvIndexRegPack2; + ((UvIndexRegPack22) => { + UvIndexRegPack22.UvIndex = "u16.16"; + UvIndexRegPack22.UvIndexError = "u16.16"; + UvIndexRegPack22.Variant = "u8"; + })(UvIndexRegPack2 || (UvIndexRegPack2 = {})); + var VerifiedTelemetryRegPack2; + ((VerifiedTelemetryRegPack22) => { + VerifiedTelemetryRegPack22.TelemetryStatus = "u8"; + VerifiedTelemetryRegPack22.TelemetryStatusInterval = "u32"; + VerifiedTelemetryRegPack22.FingerprintType = "u8"; + VerifiedTelemetryRegPack22.FingerprintTemplate = "u16 b"; + })(VerifiedTelemetryRegPack2 || (VerifiedTelemetryRegPack2 = {})); + var VerifiedTelemetryEventPack2; + ((VerifiedTelemetryEventPack22) => { + VerifiedTelemetryEventPack22.TelemetryStatusChange = "u8"; + })(VerifiedTelemetryEventPack2 || (VerifiedTelemetryEventPack2 = {})); + var SRV_VIBRATION_MOTOR2 = 406832290; + var VibrationMotorCmdPack2; + ((VibrationMotorCmdPack22) => { + VibrationMotorCmdPack22.Vibrate = "r: u8 u0.8"; + })(VibrationMotorCmdPack2 || (VibrationMotorCmdPack2 = {})); + var VibrationMotorRegPack2; + ((VibrationMotorRegPack22) => { + VibrationMotorRegPack22.MaxVibrations = "u8"; + })(VibrationMotorRegPack2 || (VibrationMotorRegPack2 = {})); + var WaterLevelRegPack2; + ((WaterLevelRegPack22) => { + WaterLevelRegPack22.Level = "u0.16"; + WaterLevelRegPack22.LevelError = "u0.16"; + WaterLevelRegPack22.Variant = "u8"; + })(WaterLevelRegPack2 || (WaterLevelRegPack2 = {})); + var WeightScaleRegPack2; + ((WeightScaleRegPack22) => { + WeightScaleRegPack22.Weight = "u16.16"; + WeightScaleRegPack22.WeightError = "u16.16"; + WeightScaleRegPack22.ZeroOffset = "u16.16"; + WeightScaleRegPack22.Gain = "u16.16"; + WeightScaleRegPack22.MaxWeight = "u16.16"; + WeightScaleRegPack22.MinWeight = "u16.16"; + WeightScaleRegPack22.WeightResolution = "u16.16"; + WeightScaleRegPack22.Variant = "u8"; + })(WeightScaleRegPack2 || (WeightScaleRegPack2 = {})); + var WeightScaleCmdPack2; + ((WeightScaleCmdPack22) => { + WeightScaleCmdPack22.CalibrateGain = "u22.10"; + })(WeightScaleCmdPack2 || (WeightScaleCmdPack2 = {})); + var SRV_WIFI2 = 413852154; + var WifiCmdPack2; + ((WifiCmdPack22) => { + WifiCmdPack22.LastScanResults = "b[12]"; + WifiCmdPack22.AddNetwork = "z z"; + WifiCmdPack22.ForgetNetwork = "s"; + WifiCmdPack22.SetNetworkPriority = "i16 s"; + WifiCmdPack22.ListKnownNetworks = "b[12]"; + })(WifiCmdPack2 || (WifiCmdPack2 = {})); + var WifiPipePack2; + ((WifiPipePack22) => { + WifiPipePack22.Results = "u32 u32 i8 u8 b[6] s[33]"; + WifiPipePack22.NetworkResults = "i16 i16 s"; + })(WifiPipePack2 || (WifiPipePack2 = {})); + var WifiRegPack2; + ((WifiRegPack22) => { + WifiRegPack22.Rssi = "i8"; + WifiRegPack22.Enabled = "u8"; + WifiRegPack22.IpAddress = "b[16]"; + WifiRegPack22.Eui48 = "b[6]"; + WifiRegPack22.Ssid = "s[32]"; + })(WifiRegPack2 || (WifiRegPack2 = {})); + var WifiEventPack2; + ((WifiEventPack22) => { + WifiEventPack22.ScanComplete = "u16 u16"; + WifiEventPack22.ConnectionFailed = "s"; + })(WifiEventPack2 || (WifiEventPack2 = {})); + var WindDirectionRegPack2; + ((WindDirectionRegPack22) => { + WindDirectionRegPack22.WindDirection = "u16"; + WindDirectionRegPack22.WindDirectionError = "u16"; + })(WindDirectionRegPack2 || (WindDirectionRegPack2 = {})); + var WindSpeedRegPack2; + ((WindSpeedRegPack22) => { + WindSpeedRegPack22.WindSpeed = "u16.16"; + WindSpeedRegPack22.WindSpeedError = "u16.16"; + WindSpeedRegPack22.MaxWindSpeed = "u16.16"; + })(WindSpeedRegPack2 || (WindSpeedRegPack2 = {})); + var SRV_WSSK2 = 330775038; + var WsskCmdPack2; + ((WsskCmdPack22) => { + WsskCmdPack22.Error = "s"; + WsskCmdPack22.SetStreaming = "u16"; + WsskCmdPack22.PingDevice = "b"; + WsskCmdPack22.PingDeviceReport = "b"; + WsskCmdPack22.PingCloud = "b"; + WsskCmdPack22.PingCloudReport = "b"; + WsskCmdPack22.GetHashReport = "b[32]"; + WsskCmdPack22.DeployStart = "u32"; + WsskCmdPack22.DeployWrite = "b"; + WsskCmdPack22.C2d = "u8 z b"; + WsskCmdPack22.D2c = "u8 z b"; + WsskCmdPack22.JacdacPacket = "b"; + WsskCmdPack22.JacdacPacketReport = "b"; + WsskCmdPack22.Dmesg = "b"; + WsskCmdPack22.ExceptionReport = "b"; + })(WsskCmdPack2 || (WsskCmdPack2 = {})); + var CMD_GET_REG = 4096; + var CMD_SET_REG = 8192; + var CMD_EVENT_MASK = 32768; + var CMD_EVENT_CODE_MASK = 255; + var CMD_EVENT_COUNTER_POS = 8; + var CMD_EVENT_COUNTER_MASK = 127; + var CMD_TOP_MASK = 61440; + var CMD_REG_MASK = 4095; + var PIPE_PORT_SHIFT = 7; + var PIPE_COUNTER_MASK = 31; + var PIPE_CLOSE_MASK = 32; + var PIPE_METADATA_MASK = 64; + var JD_SERIAL_HEADER_SIZE = 16; + var JD_SERIAL_MAX_PAYLOAD_SIZE = 236; + var JD_SERVICE_INDEX_MASK = 63; + var JD_SERVICE_INDEX_INV_MASK = 192; + var JD_SERVICE_INDEX_CRC_ACK = 63; + var JD_SERVICE_INDEX_PIPE = 62; + var JD_SERVICE_INDEX_MAX_NORMAL = 48; + var JD_SERVICE_INDEX_CTRL = 0; + var JD_SERVICE_INDEX_BROADCAST = 61; + var JD_FRAME_FLAG_COMMAND = 1; + var JD_FRAME_FLAG_ACK_REQUESTED = 2; + var JD_FRAME_FLAG_IDENTIFIER_IS_SERVICE_CLASS = 4; + var JD_DEVICE_IDENTIFIER_BROADCAST_HIGH_MARK = 2863311530; + var NEW_LISTENER = "newListener"; + var REMOVE_LISTENER = "removeListener"; + var CHANGE = "change"; + var EVENT = "event"; + var REFRESH = "refresh"; + var READING_SENT = "readingSent"; + var DEVICE_CHANGE = "deviceChange"; + var PACKET_SEND = "packetSend"; + var PACKET_RECEIVE = "packetReceive"; + var PACKET_INVALID_DATA = "packetInvalidData"; + var PACKET_DATA_NORMALIZE = "packetDataNormalize"; + var FRAME_PROCESS_LARGE = "frameProcessLarge"; + var REPORT_RECEIVE = "reportReceive"; + var REPORT_UPDATE = "reportUpdate"; + var ERROR = "error"; + var STREAMING_DEFAULT_INTERVAL = 50; + var REGISTER_PRE_GET = "registerPreGet"; + var JACDAC_ERROR = "JacdacError"; + var DOCS_ROOT = "https://microsoft.github.io/jacdac-docs/"; + var secondaryUnitConverters = { + ms: { name: "millisecond", unit: "s", scale: 1 / 1e3, offset: 0 }, + min: { name: "minute", unit: "s", scale: 60, offset: 0 }, + h: { name: "hour", unit: "s", scale: 3600, offset: 0 }, + MHz: { name: "megahertz", unit: "Hz", scale: 1e6, offset: 0 }, + kW: { name: "kilowatt", unit: "W", scale: 1e3, offset: 0 }, + kVA: { name: "kilovolt-ampere", unit: "VA", scale: 1e3, offset: 0 }, + kvar: { name: "kilovar", unit: "var", scale: 1e3, offset: 0 }, + Ah: { name: "ampere-hour", unit: "C", scale: 3600, offset: 0 }, + Wh: { name: "watt-hour", unit: "J", scale: 3600, offset: 0 }, + kWh: { name: "kilowatt-hour", unit: "J", scale: 36e5, offset: 0 }, + varh: { name: "var-hour", unit: "vars", scale: 3600, offset: 0 }, + kvarh: { name: "kilovar-hour", unit: "vars", scale: 36e5, offset: 0 }, + kVAh: { + name: "kilovolt-ampere-hour", + unit: "VAs", + scale: 36e5, + offset: 0 + }, + "Wh/km": { + name: "watt-hour per kilometer", + unit: "J/m", + scale: 3.6, + offset: 0 + }, + KiB: { name: "kibibyte", unit: "B", scale: 1024, offset: 0 }, + GB: { name: "gigabyte", unit: "B", scale: 1e9, offset: 0 }, + "Mbit/s": { + name: "megabit per second", + unit: "bit/s", + scale: 1e6, + offset: 0 + }, + "B/s": { name: "byte per second", unit: "bit/s", scale: 8, offset: 0 }, + "MB/s": { + name: "megabyte per second", + unit: "bit/s", + scale: 8e6, + offset: 0 + }, + mV: { name: "millivolt", unit: "V", scale: 1 / 1e3, offset: 0 }, + mA: { name: "milliampere", unit: "A", scale: 1 / 1e3, offset: 0 }, + dBm: { name: "decibel (milliwatt)", unit: "dBW", scale: 1, offset: -30 }, + "ug/m3": { + name: "microgram per cubic meter", + unit: "kg/m3", + scale: 1e-9, + offset: 0 + }, + "mm/h": { + name: "millimeter per hour", + unit: "m/s", + scale: 1 / 36e5, + offset: 0 + }, + "m/h": { name: "meter per hour", unit: "m/s", scale: 1 / 3600, offset: 0 }, + "cm/s": { + name: "centimeter per seconds", + unit: "m/s", + scale: 1 / 100, + offset: 0 + }, + ppm: { name: "parts per million", unit: "/", scale: 1e-6, offset: 0 }, + ppb: { name: "parts per billion", unit: "/", scale: 1e-9, offset: 0 }, + "/100": { name: "percent", unit: "/", scale: 1 / 100, offset: 0 }, + "%": { name: "percent", unit: "/", scale: 1 / 100, offset: 0 }, + "/1000": { name: "permille", unit: "/", scale: 1 / 1e3, offset: 0 }, + hPa: { name: "hectopascal", unit: "Pa", scale: 100, offset: 0 }, + mm: { name: "millimeter", unit: "m", scale: 1 / 1e3, offset: 0 }, + cm: { name: "centimeter", unit: "m", scale: 1 / 100, offset: 0 }, + km: { name: "kilometer", unit: "m", scale: 1e3, offset: 0 }, + "km/h": { + name: "kilometer per hour", + unit: "m/s", + scale: 1 / 3.6, + offset: 0 + }, + "8ms": { name: "8 milliseconds", unit: "s", scale: 8 / 1e3, offset: 0 }, + nm: { name: "nanometer", unit: "m", scale: 1e-9, offset: 0 }, + nT: { name: "nano Tesla", unit: "T", scale: 1e-9, offset: 0 }, + // compat with previous Jacdac versions + frac: { name: "ratio", unit: "/", scale: 1, offset: 0 }, + us: { name: "micro seconds", unit: "s", scale: 1e-6, offset: 0 }, + mWh: { name: "micro watt-hour", unit: "J", scale: 36e-4, offset: 0 }, + g: { name: "earth gravity", unit: "m/s2", scale: 9.80665, offset: 0 }, + "#": { name: "count", unit: "#", scale: 1, offset: 0 }, + AudHz: { name: "Audible Frequency", unit: "Hz", scale: 1, offset: 0 } + }; + function cStorage(tp) { + if (tp == 0 || [1, 2, 4, 8].indexOf(Math.abs(tp)) < 0) + return "bytes"; + if (tp < 0) + return `int${-tp * 8}_t`; + else + return `uint${tp * 8}_t`; + } + function isRegister(k) { + return k == "ro" || k == "rw" || k == "const"; + } + function unitPref(f) { + if (!f.unit) + return ""; + else + return prettyUnit(f.unit) + " "; + } + function prettyUnit(u) { + switch (u) { + case "us": + return "\u03BCs"; + case "C": + return "\xB0C"; + case "/": + return "ratio"; + default: + return u; + } + } + function addComment(pkt) { + let comment = ""; + let typeInfo = ""; + let needsStruct = false; + if (pkt.fields.length == 0) { + if (pkt.kind != "event") + typeInfo = "No args"; + } else if (pkt.fields.length == 1 && !pkt.fields[0].startRepeats) { + const f0 = pkt.fields[0]; + typeInfo = cStorage(f0.storage); + if (!f0.isSimpleType) + typeInfo = f0.type + " (" + typeInfo + ")"; + typeInfo = unitPref(f0) + typeInfo; + if (f0.name != "_") + typeInfo = f0.name + " " + typeInfo; + } else { + needsStruct = true; + } + if (pkt.fields.length == 1) { + if (isRegister(pkt.kind)) { + let info = ""; + if (pkt.kind == "ro") + info = "Read-only"; + else if (pkt.kind == "const") + info = "Constant"; + else + info = "Read-write"; + if (typeInfo) + typeInfo = info + " " + typeInfo; + else + typeInfo = info; + } else if (typeInfo) { + typeInfo = "Argument: " + typeInfo; + } + } + if (pkt.kind == "report" && pkt.secondary) { + comment += "Report: " + typeInfo + "\n"; + } else { + if (pkt.description) { + let desc = pkt.description.replace(/\n\n[^]*/, ""); + if (typeInfo) + desc = typeInfo + ". " + desc; + comment = desc + "\n" + comment; + } + } + return { + comment, + needsStruct + }; + } + function wrapComment(lang, comment) { + if (lang === "cs") + return "\n/// \n/// " + comment.replace(/\n+$/, "").replace(/\n/g, "\n/// ") + "\n/// \n"; + else + return "\n/**\n * " + comment.replace(/\n+$/, "").replace(/\n/g, "\n * ") + "\n */\n"; + } + var JDError = class extends Error { + constructor(message, options) { + super(message); + this.name = JACDAC_ERROR; + this.code = options == null ? void 0 : options.code; + this.cancel = !!(options == null ? void 0 : options.cancel); + } + }; + function throwError(msg, options) { + const e = new JDError(msg, options); + throw e; + } + var Flags = class { + }; + Flags.diagnostics = false; + Flags.trace = false; + Flags.webUSB = true; + Flags.webSerial = true; + Flags.webBluetooth = false; + Flags.developerMode = false; + function bufferEq(a, b, offset = 0) { + if (a == b) + return true; + if (!a || !b || a.length != b.length) + return false; + for (let i = offset; i < a.length; ++i) { + if (a[i] != b[i]) + return false; + } + return true; + } + function hash(buf, bits) { + bits |= 0; + if (bits < 1) + return 0; + const h = fnv1(buf); + if (bits >= 32) + return h >>> 0; + else + return ((h ^ h >>> bits) & (1 << bits) - 1) >>> 0; + } + function idiv(a, b) { + return (a | 0) / (b | 0) | 0; + } + function fnv1(data) { + let h = 2166136261; + for (let i = 0; i < data.length; ++i) { + h = Math.imul(h, 16777619) ^ data[i]; + } + return h; + } + function crc(p) { + let crc2 = 65535; + for (let i = 0; i < p.length; ++i) { + const data = p[i]; + let x = crc2 >> 8 ^ data; + x ^= x >> 4; + crc2 = crc2 << 8 ^ x << 12 ^ x << 5 ^ x; + crc2 &= 65535; + } + return crc2; + } + function ALIGN(n) { + return n + 3 & ~3; + } + function stringToUint8Array(input) { + const len = input.length; + const res = new Uint8Array(len); + for (let i = 0; i < len; ++i) + res[i] = input.charCodeAt(i) & 255; + return res; + } + function uint8ArrayToString(input) { + const len = input.length; + let res = ""; + for (let i = 0; i < len; ++i) + res += String.fromCharCode(input[i]); + return res; + } + function fromUTF8(binstr) { + if (!binstr) + return ""; + let escaped = ""; + for (let i = 0; i < binstr.length; ++i) { + const k = binstr.charCodeAt(i) & 255; + if (k == 37 || k > 127) { + escaped += "%" + k.toString(16); + } else { + escaped += binstr.charAt(i); + } + } + return decodeURIComponent(escaped); + } + function toUTF8(str, cesu8) { + let res = ""; + if (!str) + return res; + for (let i = 0; i < str.length; ++i) { + let code = str.charCodeAt(i); + if (code <= 127) + res += str.charAt(i); + else if (code <= 2047) { + res += String.fromCharCode(192 | code >> 6, 128 | code & 63); + } else { + if (!cesu8 && 55296 <= code && code <= 56319) { + const next = str.charCodeAt(++i); + if (!isNaN(next)) + code = 65536 + (code - 55296 << 10) + (next - 56320); + } + if (code <= 65535) + res += String.fromCharCode( + 224 | code >> 12, + 128 | code >> 6 & 63, + 128 | code & 63 + ); + else + res += String.fromCharCode( + 240 | code >> 18, + 128 | code >> 12 & 63, + 128 | code >> 6 & 63, + 128 | code & 63 + ); + } + } + return res; + } + function toFullHex(n) { + return "0x" + n.map((id) => ("000000000" + id.toString(16)).slice(-8)).join(""); + } + function toHex2(bytes2, sep) { + if (!bytes2) + return void 0; + let r = ""; + for (let i = 0; i < bytes2.length; ++i) { + if (sep && i > 0) + r += sep; + r += ("0" + bytes2[i].toString(16)).slice(-2); + } + return r; + } + function fromHex(hex) { + const r = new Uint8Array(hex.length >> 1); + for (let i = 0; i < hex.length; i += 2) + r[i >> 1] = parseInt(hex.slice(i, i + 2), 16); + return r; + } + function isSet(v) { + return v !== null && v !== void 0; + } + function toArray(a) { + if (!a) + return void 0; + const r = new Array(a.length); + for (let i = 0; i < a.length; ++i) + r[i] = a[i]; + return r; + } + function hexNum(n) { + if (isNaN(n)) + return void 0; + if (n < 0) + return "-" + hexNum(-n); + return "0x" + n.toString(16); + } + function write32(buf, pos, v) { + buf[pos + 0] = v >> 0 & 255; + buf[pos + 1] = v >> 8 & 255; + buf[pos + 2] = v >> 16 & 255; + buf[pos + 3] = v >> 24 & 255; + } + function write16(buf, pos, v) { + buf[pos + 0] = v >> 0 & 255; + buf[pos + 1] = v >> 8 & 255; + } + function read322(buf, pos) { + return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; + } + function read16(buf, pos) { + return buf[pos] | buf[pos + 1] << 8; + } + function bufferToString(buf) { + return fromUTF8(uint8ArrayToString(buf)); + } + function stringToBuffer(str) { + return stringToUint8Array(toUTF8(str)); + } + function bufferConcat(a, b) { + const r = new Uint8Array(a.length + b.length); + r.set(a, 0); + r.set(b, a.length); + return r; + } + function JSONTryParse(src, defaultValue) { + if (src === void 0) + return void 0; + if (src === null) + return null; + try { + return JSON.parse(src); + } catch (e) { + return defaultValue; + } + } + function roundWithPrecision(x, digits, round = Math.round) { + digits = digits | 0; + if (digits <= 0) + return round(x); + if (x == 0) + return 0; + let r = 0; + while (r == 0 && digits < 21) { + const d = Math.pow(10, digits++); + r = round(x * d + Number.EPSILON) / d; + } + return r; + } + function unique(values2) { + return Array.from(new Set(values2).values()); + } + function pick(...values2) { + return values2 == null ? void 0 : values2.find((x) => x !== void 0); + } + function cryptoRandomUint32(length) { + const crypto = (typeof self !== "undefined" ? self.crypto : void 0) || (typeof globalThis !== "undefined" ? globalThis.crypto : void 0); + if (!crypto) + return void 0; + const vals = new Uint32Array(length); + crypto.getRandomValues(vals); + return vals; + } + function anyRandomUint32(length) { + let r = cryptoRandomUint32(length); + if (!r) { + r = new Uint32Array(length); + for (let i = 0; i < r.length; ++i) + r[i] = Math.random() * 4294967296 >>> 0; + } + return r; + } + function fmtInfoCore(fmt) { + switch (fmt) { + case 1: + return -1; + case 2: + return 1; + case 3: + return -2; + case 4: + return 2; + case 5: + return -4; + case 11: + return 4; + case 19: + return -8; + case 17: + return 8; + case 6: + return -10; + case 7: + return 10; + case 8: + return -20; + case 9: + return 20; + case 10: + return -40; + case 12: + return 40; + case 20: + return -80; + case 18: + return 80; + case 13: + return 4; + case 15: + return 40; + case 14: + return 8; + case 16: + return 80; + default: + throw new Error("unknown format"); + } + } + function fmtInfo(fmt) { + let size = fmtInfoCore(fmt); + let signed = false; + if (size < 0) { + signed = true; + size = -size; + } + let swap = false; + if (size >= 10) { + swap = true; + size /= 10; + } + let isFloat = false; + switch (fmt) { + case 13: + case 15: + case 14: + case 16: + isFloat = true; + break; + } + return { size, signed, swap, isFloat }; + } + function sizeOfNumberFormat(format) { + switch (format) { + case 1: + case 2: + case 6: + case 7: + return 1; + case 3: + case 4: + case 8: + case 9: + return 2; + case 5: + case 10: + case 12: + case 11: + case 15: + case 13: + return 4; + case 18: + case 20: + case 17: + case 19: + case 16: + case 14: + return 8; + } + return 0; + } + function getNumber(buf, fmt, offset) { + switch (fmt) { + case 7: + case 2: + return buf[offset]; + case 6: + case 1: + return buf[offset] << 24 >> 24; + case 4: + return read16(buf, offset); + case 3: + return read16(buf, offset) << 16 >> 16; + case 11: + return read322(buf, offset); + case 5: + return read322(buf, offset) >> 0; + case 17: + return read322(buf, offset) + read322(buf, offset + 4) * 4294967296; + case 19: + return read322(buf, offset) + (read322(buf, offset + 4) >> 0) * 4294967296; + default: { + const inf = fmtInfo(fmt); + if (inf.isFloat) { + const arr = new Uint8Array(inf.size); + for (let i = 0; i < inf.size; ++i) { + arr[i] = buf[offset + i]; + } + if (inf.swap) + arr.reverse(); + if (inf.size == 4) + return new Float32Array(arr.buffer)[0]; + else + return new Float64Array(arr.buffer)[0]; + } + throw new Error("unsupported fmt:" + fmt); + } + } + } + function setNumber(buf, fmt, offset, r) { + const inf = fmtInfo(fmt); + if (inf.isFloat) { + const arr = new Uint8Array(inf.size); + if (inf.size == 4) + new Float32Array(arr.buffer)[0] = r; + else + new Float64Array(arr.buffer)[0] = r; + if (inf.swap) + arr.reverse(); + for (let i = 0; i < inf.size; ++i) { + buf[offset + i] = arr[i]; + } + return; + } + if (fmt == 17 || fmt == 19) { + setNumber(buf, 11, offset, r >>> 0); + setNumber(buf, 11, offset + 4, r / 4294967296); + return; + } + for (let i = 0; i < inf.size; ++i) { + const off = !inf.swap ? offset + i : offset + inf.size - i - 1; + buf[off] = r & 255; + r >>= 8; + } + } + var services_default = [{ name: "Common registers and commands", status: "experimental", shortId: "_system", camelName: "system", shortName: "system", extends: [], notes: { short: "This file describes common register and command codes.\n\nThese are defined in ranges separate from the per-service ones.\nNo service actually derives from this file, but services can include packets\ndefined here.\nTheir code is listed as say `@ intensity` and not `@ 0x01` (the spectool enforces that).", commands: "Command codes are subdivided as follows:\n\n- Commands `0x000-0x07f` - common to all services\n- Commands `0x080-0xeff` - defined per-service\n- Commands `0xf00-0xfff` - reserved for implementation\n\nCommands follow.", registers: "Register codes are subdivided as follows:\n\n- Registers `0x001-0x07f` - r/w common to all services\n- Registers `0x080-0x0ff` - r/w defined per-service\n- Registers `0x100-0x17f` - r/o common to all services\n- Registers `0x180-0x1ff` - r/o defined per-service\n- Registers `0x200-0xeff` - custom, defined per-service\n- Registers `0xf00-0xfff` - reserved for implementation, should not be seen on the wire\n\nThe types listed are typical. Check spec for particular service for exact type,\nand a service-specific name for a register (eg. `value` could be `pulse_length`).\nAll registers default to `0` unless otherwise indicated.", events: "Events codes are 8-bit and are subdivided as follows:\n\n- Events `0x00-0x7f` - common to all services\n- Events `0x80-0xff` - defined per-service" }, classIdentifier: 536870897, enums: { ReadingThreshold: { name: "ReadingThreshold", storage: 1, members: { Neutral: 1, Inactive: 2, Active: 3 } }, StatusCodes: { name: "StatusCodes", storage: 2, members: { Ready: 0, Initializing: 1, Calibrating: 2, Sleeping: 3, WaitingForInput: 4, CalibrationNeeded: 100 } } }, constants: { announce_interval: { value: 500, hex: false } }, packets: [{ kind: "command", name: "announce", identifier: 0, description: "Enumeration data for control service; service-specific advertisement data otherwise.\nControl broadcasts it automatically every `announce_interval`ms, but other service have to be queried to provide it.", fields: [], hasReport: true }, { kind: "report", name: "announce", identifier: 0, description: "Enumeration data for control service; service-specific advertisement data otherwise.\nControl broadcasts it automatically every `announce_interval`ms, but other service have to be queried to provide it.", fields: [], secondary: true }, { kind: "command", name: "get_register", identifier: 4096, description: "Registers number `N` is fetched by issuing command `0x1000 | N`.\nThe report format is the same as the format of the register.", fields: [], hasReport: true }, { kind: "report", name: "get_register", identifier: 4096, description: "Registers number `N` is fetched by issuing command `0x1000 | N`.\nThe report format is the same as the format of the register.", fields: [], secondary: true }, { kind: "command", name: "set_register", identifier: 8192, description: "Registers number `N` is set by issuing command `0x2000 | N`, with the format\nthe same as the format of the register.", fields: [] }, { kind: "command", name: "calibrate", identifier: 2, description: "Request to calibrate a sensor. The report indicates the calibration is done.", fields: [], hasReport: true }, { kind: "report", name: "calibrate", identifier: 2, description: "Request to calibrate a sensor. The report indicates the calibration is done.", fields: [], secondary: true }, { kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }, { kind: "rw", name: "intensity", identifier: 1, description: "This is either binary on/off (0 or non-zero), or can be gradual (eg. brightness of an RGB LED strip).", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "value", identifier: 2, description: "The primary value of actuator (eg. servo pulse length, or motor duty cycle).", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "min_value", identifier: 272, description: "The lowest value that can be reported for the value register.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "max_value", identifier: 273, description: "The highest value that can be reported for the value register.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the service, in mA.", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 500, typicalMax: 500, typicalMin: 0 }], packFormat: "u16" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100 }], packFormat: "u32" }, { kind: "ro", name: "reading", identifier: 257, description: "Read-only value of the sensor, also reported in streaming.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], volatile: true, packFormat: "i32" }, { kind: "rw", name: "reading_range", identifier: 8, description: "For sensors that support it, sets the range (sometimes also described `min`/`max_reading`).\nTypically only a small set of values is supported.\nSetting it to `X` will select the smallest possible range that is at least `X`,\nor if it doesn't exist, the largest supported range.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "supported_ranges", identifier: 266, description: "Lists the values supported as `reading_range`.", fields: [{ name: "range", type: "u32", storage: 4, isSimpleType: true, startRepeats: true }], packFormat: "r: u32" }, { kind: "const", name: "min_reading", identifier: 260, description: "The lowest value that can be reported by the sensor.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "max_reading", identifier: 261, description: "The highest value that can be reported by the sensor.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "ro", name: "reading_error", identifier: 262, description: "The real value of whatever is measured is between `reading - reading_error` and `reading + reading_error`. It should be computed from the internal state of the sensor. This register is often, but not always `const`. If the register value is modified,\nsend a report in the same frame of the `reading` report.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], volatile: true, packFormat: "u32" }, { kind: "const", name: "reading_resolution", identifier: 264, description: "Smallest, yet distinguishable change in reading.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "inactive_threshold", identifier: 5, description: "Threshold when reading data gets inactive and triggers a `inactive`.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "rw", name: "active_threshold", identifier: 6, description: "Thresholds when reading data gets active and triggers a `active` event.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "variant", identifier: 263, description: "The hardware variant of the service.\nFor services which support this, there's an enum defining the meaning.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. `code` is a standardized value from\nthe Jacdac status/error codes. `vendor_code` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet.", fields: [{ name: "code", type: "StatusCodes", storage: 2 }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16 u16" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "event", name: "active", identifier: 1, description: "Notifies that the service has been activated (eg. button pressed, network connected, etc.)", fields: [] }, { kind: "event", name: "inactive", identifier: 2, description: "Notifies that the service has been dis-activated.", fields: [] }, { kind: "event", name: "change", identifier: 3, description: "Notifies that the some state of the service changed.", fields: [] }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "StatusCodes", storage: 2 }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }, { kind: "event", name: "neutral", identifier: 7, description: "Notifies that the threshold is back between `low` and `high`.", fields: [] }], tags: [] }, { name: "Base service", status: "stable", shortId: "_base", camelName: "base", shortName: "base", extends: [], notes: { short: "Base class for all services." }, classIdentifier: 536870899, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16" }], tags: [] }, { name: "Sensor", status: "stable", shortId: "_sensor", camelName: "sensor", shortName: "sensor", extends: ["_base"], notes: { short: "Base class for sensors." }, classIdentifier: 536870898, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32" }], tags: [] }, { name: "Accelerometer", status: "stable", shortId: "accelerometer", camelName: "accelerometer", shortName: "accelerometer", extends: ["_base", "_sensor"], notes: { short: "A 3-axis accelerometer.", long: "## Orientation\n\nAn accelerometer module should translate acceleration values as follows:\n\n| Orientation | X value (g) | Y value (g) | Z value (g) |\n|----------------------- |------------- |------------- |------------- |\n| Module lying flat | 0 | 0 | -1 |\n| Module on left edge | -1 | 0 | 0 |\n| Module on bottom edge | 0 | 1 | 0 |\n\nWe recommend an orientation marking on the PCB so that users can mount modules without having to experiment with the device. Left/bottom can be determined by assuming text on silk runs left-to-right.", events: "All events are debounced." }, classIdentifier: 521405449, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "forces", identifier: 257, description: "Indicates the current forces acting on accelerometer.", fields: [{ name: "x", unit: "g", shift: 20, type: "i12.20", storage: -4 }, { name: "y", unit: "g", shift: 20, type: "i12.20", storage: -4 }, { name: "z", unit: "g", shift: 20, type: "i12.20", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i12.20 i12.20 i12.20" }, { kind: "ro", name: "forces_error", identifier: 262, description: "Error on the reading value.", fields: [{ name: "_", unit: "g", shift: 20, type: "u12.20", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u12.20" }, { kind: "rw", name: "max_force", identifier: 8, description: 'Configures the range forces detected.\nThe value will be "rounded up" to one of `max_forces_supported`.', fields: [{ name: "_", unit: "g", shift: 20, type: "u12.20", storage: 4 }], optional: true, identifierName: "reading_range", packFormat: "u12.20" }, { kind: "const", name: "max_forces_supported", identifier: 266, description: "Lists values supported for writing `max_force`.", fields: [{ name: "max_force", unit: "g", shift: 20, type: "u12.20", storage: 4, startRepeats: true }], optional: true, identifierName: "supported_ranges", packFormat: "r: u12.20" }, { kind: "event", name: "tilt_up", identifier: 129, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "tilt_down", identifier: 130, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "tilt_left", identifier: 131, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "tilt_right", identifier: 132, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "face_up", identifier: 133, description: "Emitted when accelerometer is laying flat in the given direction.", fields: [] }, { kind: "event", name: "face_down", identifier: 134, description: "Emitted when accelerometer is laying flat in the given direction.", fields: [] }, { kind: "event", name: "freefall", identifier: 135, description: "Emitted when total force acting on accelerometer is much less than 1g.", fields: [] }, { kind: "event", name: "shake", identifier: 139, description: "Emitted when forces change violently a few times.", fields: [] }, { kind: "event", name: "force_2g", identifier: 140, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }, { kind: "event", name: "force_3g", identifier: 136, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }, { kind: "event", name: "force_6g", identifier: 137, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }, { kind: "event", name: "force_8g", identifier: 138, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }], tags: ["C"], group: "Movement" }, { name: "Acidity", status: "experimental", shortId: "acidity", camelName: "acidity", shortName: "acidity", extends: ["_base", "_sensor"], notes: { short: "A sensor measuring water acidity, commonly called pH." }, classIdentifier: 513243333, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "acidity", identifier: 257, description: "The acidity, pH, of water.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2, absoluteMin: 0, absoluteMax: 15, typicalMin: 2.5, typicalMax: 10.5 }], volatile: true, identifierName: "reading", preferredInterval: 5e3, packFormat: "u4.12" }, { kind: "ro", name: "acidity_error", identifier: 262, description: "Error on the acidity reading.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u4.12" }, { kind: "const", name: "min_acidity", identifier: 260, description: "Lowest acidity that can be reported.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2 }], optional: true, identifierName: "min_reading", packFormat: "u4.12" }, { kind: "const", name: "max_humidity", identifier: 261, description: "Highest acidity that can be reported.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2 }], optional: true, identifierName: "max_reading", packFormat: "u4.12" }], tags: ["C", "8bit"], group: "Environment" }, { name: "Air Pressure", status: "rc", shortId: "airpressure", camelName: "airPressure", shortName: "airPressure", extends: ["_base", "_sensor"], notes: { short: "A sensor measuring air pressure of outside environment.", registers: "Default streaming interval is 1s." }, classIdentifier: 504462570, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "pressure", identifier: 257, description: "The air pressure.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4, typicalMin: 150, typicalMax: 1150 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u22.10" }, { kind: "ro", name: "pressure_error", identifier: 262, description: "The real pressure is between `pressure - pressure_error` and `pressure + pressure_error`.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_pressure", identifier: 260, description: "Lowest air pressure that can be reported.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4 }], optional: true, identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_pressure", identifier: 261, description: "Highest air pressure that can be reported.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u22.10" }], tags: ["8bit"], group: "Environment" }, { name: "Air Quality Index", status: "experimental", shortId: "airqualityindex", camelName: "airQualityIndex", shortName: "airQualityIndex", extends: ["_base", "_sensor"], notes: { short: "The Air Quality Index is a measure of how clean or polluted air is. From min, good quality, to high, low quality.\nThe range of AQI may vary between countries (https://en.wikipedia.org/wiki/Air_quality_index)." }, classIdentifier: 346844886, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "aqi_index", identifier: 257, description: "Air quality index, typically refreshed every second.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4, typicalMax: 500, typicalMin: 0 }], volatile: true, identifierName: "reading", preferredInterval: 6e4, packFormat: "u16.16" }, { kind: "ro", name: "aqi_index_error", identifier: 262, description: "Error on the AQI measure.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "min_aqi_index", identifier: 260, description: "Minimum AQI reading, representing a good air quality. Typically 0.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4 }], identifierName: "min_reading", packFormat: "u16.16" }, { kind: "const", name: "max_aqi_index", identifier: 261, description: "Maximum AQI reading, representing a very poor air quality.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4 }], identifierName: "max_reading", packFormat: "u16.16" }], tags: [], group: "Environment" }, { name: "Arcade Gamepad", status: "deprecated", shortId: "arcadegamepad", camelName: "arcadeGamepad", shortName: "arcadeGamepad", extends: ["_base", "_sensor"], notes: { short: "This service is deprecated in favor of `gamepad` (although it is currently used by the micro:bit Arcade smart shield).\nA gamepad with direction and action buttons for one player.\nIf a device has multiple controllers, it should have multiple gamepad services, using consecutive service identifiers." }, classIdentifier: 501915758, enums: { Button: { name: "Button", storage: 1, members: { Left: 1, Up: 2, Right: 3, Down: 4, A: 5, B: 6, Menu: 7, Select: 8, Reset: 9, Exit: 10 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "buttons", identifier: 257, description: "Indicates which buttons are currently active (pressed).\n`pressure` should be `0xff` for digital buttons, and proportional for analog ones.", fields: [{ name: "button", type: "Button", storage: 1, startRepeats: true }, { name: "pressure", unit: "/", shift: 8, type: "u0.8", storage: 1 }], volatile: true, identifierName: "reading", packFormat: "r: u8 u0.8" }, { kind: "const", name: "available_buttons", identifier: 384, description: "Indicates number of players supported and which buttons are present on the controller.", fields: [{ name: "button", type: "Button", storage: 1, startRepeats: true }], packFormat: "r: u8" }, { kind: "event", name: "down", identifier: 1, description: "Emitted when button goes from inactive to active.", fields: [{ name: "button", type: "Button", storage: 1 }], identifierName: "active", packFormat: "u8" }, { kind: "event", name: "up", identifier: 2, description: "Emitted when button goes from active to inactive.", fields: [{ name: "button", type: "Button", storage: 1 }], identifierName: "inactive", packFormat: "u8" }], tags: [], group: "Button" }, { name: "Arcade Sound", status: "experimental", shortId: "arcadesound", camelName: "arcadeSound", shortName: "arcadeSound", extends: ["_base"], notes: { short: "A sound playing device.\n\nThis is typically run over an SPI connection, not regular single-wire Jacdac." }, classIdentifier: 533083654, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "play", identifier: 128, description: "Play samples, which are single channel, signed 16-bit little endian values.", fields: [{ name: "samples", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "rw", name: "sample_rate", identifier: 128, description: "Get or set playback sample rate (in samples per second).\nIf you set it, read it back, as the value may be rounded up or down.", fields: [{ name: "_", unit: "Hz", shift: 10, type: "u22.10", storage: 4, defaultValue: 44100 }], packFormat: "u22.10" }, { kind: "const", name: "buffer_size", identifier: 384, description: "The size of the internal audio buffer.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "buffer_pending", identifier: 385, description: "How much data is still left in the buffer to play.\nClients should not send more data than `buffer_size - buffer_pending`,\nbut can keep the `buffer_pending` as low as they want to ensure low latency\nof audio playback.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: ["SPI"] }, { name: "Barcode reader", status: "experimental", shortId: "barcodereader", camelName: "barcodeReader", shortName: "barcodeReader", extends: ["_base"], notes: { short: "A device that reads various barcodes, like QR codes. For the web, see [BarcodeDetector](https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector)." }, classIdentifier: 477339244, enums: { Format: { name: "Format", storage: 1, members: { Aztec: 1, Code128: 2, Code39: 3, Code93: 4, Codabar: 5, DataMatrix: 6, Ean13: 8, Ean8: 9, ITF: 10, Pdf417: 11, QrCode: 12, UpcA: 13, UpcE: 14 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns on or off the detection of barcodes.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "formats", identifier: 384, description: "Reports the list of supported barcode formats, as documented in https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API.", fields: [{ name: "format", type: "Format", storage: 1, startRepeats: true }], optional: true, packFormat: "r: u8" }, { kind: "event", name: "detect", identifier: 1, description: "Raised when a bar code is detected and decoded. If the reader detects multiple codes, it will issue multiple events.\nIn case of numeric barcodes, the `data` field should contain the ASCII (which is the same as UTF8 in that case) representation of the number.", fields: [{ name: "format", type: "Format", storage: 1 }, { name: "data", type: "string", storage: 0 }], identifierName: "active", packFormat: "u8 s" }], tags: [] }, { name: "bit:radio", status: "stable", shortId: "bitradio", camelName: "bitRadio", shortName: "bitRadio", extends: ["_base"], notes: { short: "Support for sending and receiving packets using the [Bit Radio protocol](https://github.com/microsoft/pxt-common-packages/blob/master/libs/radio/docs/reference/radio.md), typically used between micro:bit devices." }, classIdentifier: 449414863, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns on/off the radio antenna.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "group", identifier: 128, description: "Group used to filter packets", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "rw", name: "transmission_power", identifier: 129, description: "Antenna power to increase or decrease range.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 6, absoluteMin: 1, absoluteMax: 7 }], packFormat: "u8" }, { kind: "rw", name: "frequency_band", identifier: 130, description: "Change the transmission and reception band of the radio to the given channel.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 7, absoluteMax: 83, absoluteMin: 0 }], packFormat: "u8" }, { kind: "command", name: "send_string", identifier: 128, description: "Sends a string payload as a radio message, maximum 18 characters.", fields: [{ name: "message", type: "string", storage: 0 }], unique: true, packFormat: "s" }, { kind: "command", name: "send_number", identifier: 129, description: "Sends a double precision number payload as a radio message", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }], unique: true, packFormat: "f64" }, { kind: "command", name: "send_value", identifier: 130, description: "Sends a double precision number and a name payload as a radio message", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }, { name: "name", type: "string", storage: 0 }], unique: true, packFormat: "f64 s" }, { kind: "command", name: "send_buffer", identifier: 131, description: "Sends a payload of bytes as a radio message", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }, { kind: "report", name: "string_received", identifier: 144, description: "Raised when a string packet is received", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "device_serial_number", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true }, { name: "padding", type: "u8[1]", storage: 1 }, { name: "message", type: "string", storage: 0 }], packFormat: "u32 u32 i8 b[1] s" }, { kind: "report", name: "number_received", identifier: 145, description: "Raised when a number packet is received", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "device_serial_number", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true }, { name: "padding", type: "u8[3]", storage: 3 }, { name: "value", isFloat: true, type: "f64", storage: 8 }, { name: "name", type: "string", storage: 0 }], packed: true, packFormat: "u32 u32 i8 b[3] f64 s" }, { kind: "report", name: "buffer_received", identifier: 146, description: "Raised when a buffer packet is received", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "device_serial_number", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true }, { name: "padding", type: "u8[1]", storage: 1 }, { name: "data", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u32 u32 i8 b[1] b" }], tags: [] }, { name: "Bootloader", status: "stable", shortId: "bootloader", camelName: "bootloader", shortName: "bootloader", extends: ["_base"], notes: { short: "Allows flashing (reprogramming) devices over Jacdac.\n\nThis is typically implemented by having a separate _bootloader_ mode, as opposed to _application_ mode\non the module to be flashed.\nThe bootloader mode is entered on every device reset, for about 300ms.\nThe bootloader will generally not announce itself, until it gets some command.\nOnce it gets the command, it will stay in application mode.\n\nTypically, you ask the module (in application mode) to reset, while sending broadcast\n`info` commands to all bootloaders every 100ms or so.\nAlternatively, you ask the the user to disconnect and re-connect the module, while\nbroadcasting `info` commands.\nThe second method works even if the application is damaged (eg., due to an aborted flash).\n\nWhen device is in bootloader mode, the device ID may change compared to application mode,\nby flipping the first bit in the first byte of the device identifier." }, classIdentifier: 536516936, enums: { Error: { name: "Error", storage: 4, members: { NoError: 0, PacketTooSmall: 1, OutOfFlashableRange: 2, InvalidPageOffset: 3, NotPageAligned: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "info", identifier: 0, description: 'The `service_class` is always `0x1ffa9948`. The `product_identifier` identifies the kind of firmware\nthat "fits" this device.', fields: [], identifierName: "announce", hasReport: true }, { kind: "report", name: "info", identifier: 0, description: 'The `service_class` is always `0x1ffa9948`. The `product_identifier` identifies the kind of firmware\nthat "fits" this device.', fields: [{ name: "service_class", type: "u32", storage: 4, isSimpleType: true }, { name: "page_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }, { name: "flashable_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }, { name: "product_identifier", type: "u32", storage: 4, isSimpleType: true }], secondary: true, packFormat: "u32 u32 u32 u32" }, { kind: "command", name: "set_session", identifier: 129, description: "The flashing server should generate a random id, and use this command to set it.", fields: [{ name: "session_id", type: "u32", storage: 4, isSimpleType: true }], hasReport: true, packFormat: "u32" }, { kind: "report", name: "set_session", identifier: 129, description: "The flashing server should generate a random id, and use this command to set it.", fields: [{ name: "session_id", type: "u32", storage: 4, isSimpleType: true }], secondary: true, packFormat: "u32" }, { kind: "command", name: "page_data", identifier: 128, description: "Use to send flashing data. A physical page is split into `chunk_max + 1` chunks, where `chunk_no = 0 ... chunk_max`.\nEach chunk is stored at `page_address + page_offset`. `page_address` has to be equal in all chunks,\nand is included in response.\nOnly the last chunk causes writing to flash and elicits response.\n\nErrors not listed are also possible. Errors larger than `0xffff` indicate de-synchronization on chunk numbers.\n\nWhile this command is technically `unique`, the bootloader client will retry failed pages.\nBootloaders typically will not support reliable commands delivered over pipes.", fields: [{ name: "page_address", type: "u32", storage: 4, isSimpleType: true }, { name: "page_offset", type: "u16", storage: 2, isSimpleType: true }, { name: "chunk_no", type: "u8", storage: 1, isSimpleType: true }, { name: "chunk_max", type: "u8", storage: 1, isSimpleType: true }, { name: "session_id", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved0", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved1", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved2", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved3", type: "u32", storage: 4, isSimpleType: true }, { name: "page_data", type: "bytes", storage: 208, isSimpleType: true, maxBytes: 208 }], unique: true, hasReport: true, packFormat: "u32 u16 u8 u8 u32 u32 u32 u32 u32 b[208]" }, { kind: "report", name: "page_data", identifier: 128, description: "Use to send flashing data. A physical page is split into `chunk_max + 1` chunks, where `chunk_no = 0 ... chunk_max`.\nEach chunk is stored at `page_address + page_offset`. `page_address` has to be equal in all chunks,\nand is included in response.\nOnly the last chunk causes writing to flash and elicits response.\n\nErrors not listed are also possible. Errors larger than `0xffff` indicate de-synchronization on chunk numbers.\n\nWhile this command is technically `unique`, the bootloader client will retry failed pages.\nBootloaders typically will not support reliable commands delivered over pipes.", fields: [{ name: "session_id", type: "u32", storage: 4, isSimpleType: true }, { name: "page_error", type: "Error", storage: 4 }, { name: "page_address", type: "u32", storage: 4, isSimpleType: true }], secondary: true, packFormat: "u32 u32 u32" }], tags: ["C", "management"] }, { name: "Braille display", status: "stable", shortId: "brailledisplay", camelName: "brailleDisplay", shortName: "brailleDisplay", extends: ["_base"], notes: { short: "A Braille pattern display module. This module display [unicode braille patterns](https://www.unicode.org/charts/PDF/U2800.pdf), country specific encoding have to be implemented by the clients." }, classIdentifier: 331331532, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines if the braille display is active.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "patterns", identifier: 2, description: "Braille patterns to show. Must be unicode characters between `0x2800` and `0x28ff`.", fields: [{ name: "_", type: "string", storage: 0 }], lowLevel: true, identifierName: "value", packFormat: "s" }, { kind: "const", name: "length", identifier: 385, description: "Gets the number of patterns that can be displayed.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }], tags: [], group: "Display" }, { name: "Bridge", status: "rc", shortId: "bridge", camelName: "bridge", shortName: "bridge", extends: ["_base"], notes: { short: "Indicates that the device acts as a bridge to the Jacdac bus." }, classIdentifier: 535147631, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Enables or disables the bridge.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }], tags: ["infrastructure"] }, { name: "Button", status: "stable", shortId: "button", camelName: "button", shortName: "button", extends: ["_base", "_sensor"], notes: { short: "A push-button, which returns to inactive position when not operated anymore." }, classIdentifier: 343122531, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "pressure", identifier: 257, description: "Indicates the pressure state of the button, where `0` is open.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "const", name: "analog", identifier: 384, description: "Indicates if the button provides analog `pressure` readings.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "ro", name: "pressed", identifier: 385, description: "Determines if the button is pressed currently.\n\nIf the event `down` or `hold` is observed, `pressed` becomes true; if `up` is observed, `pressed` becomes false.\nThe client should initialize `pressed` to false.", fields: [{ name: "_", type: "bool", storage: 1 }], client: true, volatile: true, packFormat: "u8" }, { kind: "event", name: "down", identifier: 1, description: "Emitted when button goes from inactive to active.", fields: [], identifierName: "active" }, { kind: "event", name: "up", identifier: 2, description: "Emitted when button goes from active to inactive. The 'time' parameter\nrecords the amount of time between the down and up events.", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], identifierName: "inactive", packFormat: "u32" }, { kind: "event", name: "hold", identifier: 129, description: "Emitted when the press time is greater than 500ms, and then at least every 500ms\nas long as the button remains pressed. The 'time' parameter records the the amount of time\nthat the button has been held (since the down event).", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: ["C", "8bit", "padauk", "input"], group: "Button" }, { name: "Buzzer", status: "rc", shortId: "buzzer", camelName: "buzzer", shortName: "buzzer", extends: ["_base"], notes: { short: "A simple buzzer." }, classIdentifier: 458731991, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "volume", identifier: 1, description: "The volume (duty cycle) of the buzzer.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 1 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "command", name: "play_tone", identifier: 128, description: "Play a PWM tone with given period and duty for given duration.\nThe duty is scaled down with `volume` register.\nTo play tone at frequency `F` Hz and volume `V` (in `0..1`) you will want\nto send `P = 1000000 / F` and `D = P * V / 2`.", fields: [{ name: "period", unit: "us", type: "u16", storage: 2, isSimpleType: true }, { name: "duty", unit: "us", type: "u16", storage: 2, isSimpleType: true }, { name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], lowLevel: true, packFormat: "u16 u16 u16" }, { kind: "command", name: "play_note", identifier: 129, description: "Play a note at the given frequency and volume.", fields: [{ name: "frequency", unit: "AudHz", type: "u16", storage: 2, isSimpleType: true }, { name: "volume", unit: "/", shift: 16, type: "u0.16", storage: 2 }, { name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], client: true, packFormat: "u16 u0.16 u16" }], tags: ["C", "8bit"], group: "Sound" }, { name: "Capacitive Button", status: "rc", shortId: "capacitivebutton", camelName: "capacitiveButton", shortName: "capacitiveButton", extends: ["_base"], notes: { short: "A configuration service for a capacitive push-button." }, classIdentifier: 677752265, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "threshold", identifier: 6, description: "Indicates the threshold for ``up`` events.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "active_threshold", packFormat: "u0.16" }, { kind: "command", name: "calibrate", identifier: 2, description: "Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button. \nThe report indicates the calibration is done.", fields: [], identifierName: "calibrate", hasReport: true }, { kind: "report", name: "calibrate", identifier: 2, description: "Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button. \nThe report indicates the calibration is done.", fields: [], secondary: true }], tags: ["8bit"], group: "Button" }, { name: "Character Screen", status: "rc", shortId: "characterscreen", camelName: "characterScreen", shortName: "characterScreen", extends: ["_base"], notes: { short: "A screen that displays characters, typically a LCD/OLED character screen." }, classIdentifier: 523748714, enums: { Variant: { name: "Variant", storage: 1, members: { LCD: 1, OLED: 2, Braille: 3 } }, TextDirection: { name: "TextDirection", storage: 1, members: { LeftToRight: 1, RightToLeft: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "message", identifier: 2, description: "Text to show. Use `\\n` to break lines.", fields: [{ name: "_", type: "string", storage: 0 }], identifierName: "value", packFormat: "s" }, { kind: "rw", name: "brightness", identifier: 1, description: "Brightness of the screen. `0` means off.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], optional: true, identifierName: "intensity", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of character LED screen.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "rw", name: "text_direction", identifier: 130, description: "Specifies the RTL or LTR direction of the text.", fields: [{ name: "_", type: "TextDirection", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "const", name: "rows", identifier: 384, description: "Gets the number of rows.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "columns", identifier: 385, description: "Gets the number of columns.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }], tags: [], group: "Display" }, { name: "Cloud Adapter", status: "experimental", shortId: "cloudadapter", camelName: "cloudAdapter", shortName: "cloudAdapter", extends: ["_base"], notes: { short: "Supports cloud connections to upload and download data.\nNote that `f64` values following a label are not necessarily aligned." }, classIdentifier: 341864092, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "upload_json", identifier: 128, description: "Upload a JSON-encoded message to the cloud.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "json", type: "string", storage: 0 }], packFormat: "z s" }, { kind: "command", name: "upload_binary", identifier: 129, description: "Upload a binary message to the cloud.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "z b" }, { kind: "ro", name: "connected", identifier: 384, description: "Indicate whether we're currently connected to the cloud server.\nWhen offline, `upload` commands are queued.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "connection_name", identifier: 385, description: 'User-friendly name of the connection, typically includes name of the server\nand/or type of cloud service (`"something.cloud.net (Provider IoT)"`).', fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "event", name: "on_json", identifier: 128, description: "Emitted when cloud send us a JSON message.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "json", type: "string", storage: 0 }], packFormat: "z s" }, { kind: "event", name: "on_binary", identifier: 129, description: "Emitted when cloud send us a binary message.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "z b" }, { kind: "event", name: "change", identifier: 3, description: "Emitted when we connect or disconnect from the cloud.", fields: [], identifierName: "change" }], tags: ["infrastructure", "devicescript"], group: "Iot", restricted: true }, { name: "Cloud Configuration", status: "rc", shortId: "cloudconfiguration", camelName: "cloudConfiguration", shortName: "cloudConfiguration", extends: ["_base"], notes: { short: "Connection and diagnostics information about the cloud connection." }, classIdentifier: 342028028, enums: { ConnectionStatus: { name: "ConnectionStatus", storage: 2, members: { Connected: 1, Disconnected: 2, Connecting: 3, Disconnecting: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "server_name", identifier: 384, description: "Something like `my-iot-hub.azure-devices.net` if available.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "ro", name: "cloud_device_id", identifier: 385, description: "Device identifier for the device in the cloud if available.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "const", name: "cloud_type", identifier: 387, description: "Cloud provider identifier.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "ro", name: "connection_status", identifier: 386, description: "Indicates the status of connection. A message beyond the [0..3] range represents an HTTP error code.", fields: [{ name: "_", type: "ConnectionStatus", storage: 2 }], packFormat: "u16" }, { kind: "rw", name: "push_period", identifier: 128, description: "How often to push data to the cloud.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 5e3 }], packFormat: "u32" }, { kind: "rw", name: "push_watchdog_period", identifier: 129, description: "If no message is published within given period, the device resets.\nThis can be due to connectivity problems or due to the device having nothing to publish.\nForced to be at least `2 * flush_period`.\nSet to `0` to disable (default).", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "command", name: "connect", identifier: 129, description: "Starts a connection to the cloud service", fields: [], restricted: true }, { kind: "command", name: "disconnect", identifier: 130, description: "Starts disconnecting from the cloud service", fields: [], restricted: true }, { kind: "command", name: "set_connection_string", identifier: 134, description: "Restricted command to override the existing connection string to cloud.", fields: [{ name: "connection_string", type: "string", storage: 0 }], restricted: true, packFormat: "s" }, { kind: "event", name: "connection_status_change", identifier: 3, description: "Raised when the connection status changes", fields: [{ name: "connection_status", type: "ConnectionStatus", storage: 2 }], identifierName: "change", packFormat: "u16" }, { kind: "event", name: "message_sent", identifier: 128, description: "Raised when a message has been sent to the hub.", fields: [] }], tags: ["management"], group: "Iot" }, { name: "CODAL Message Bus", status: "experimental", shortId: "codalmessagebus", camelName: "codalMessageBus", shortName: "codalMessageBus", extends: ["_base"], notes: { short: "A service that uses the [CODAL message bus](https://lancaster-university.github.io/microbit-docs/ubit/messageBus/) to send and receive small messages.\n\nYou can find known values for `source` in [CODAL repository](https://github.com/lancaster-university/codal-core/blob/master/inc/core/CodalComponent.h)\nIn MakeCode, you can listen for custom `source`, `value` values using [control.onEvent](https://makecode.microbit.org/reference/control/on-event]." }, classIdentifier: 304085021, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "send", identifier: 128, description: "Send a message on the CODAL bus. If `source` is `0`, it is treated as wildcard.", fields: [{ name: "source", type: "u16", storage: 2, isSimpleType: true }, { name: "value", type: "u16", storage: 2, isSimpleType: true }], unique: true, packFormat: "u16 u16" }, { kind: "event", name: "message", identifier: 128, description: "Raised by the server is triggered by the server. The filtering logic of which event to send over Jacdac is up to the server implementation.", fields: [{ name: "source", type: "u16", storage: 2, isSimpleType: true }, { name: "value", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }], tags: [] }, { name: "Color", status: "experimental", shortId: "color", camelName: "color", shortName: "color", extends: ["_base", "_sensor"], notes: { short: "Senses RGB colors" }, classIdentifier: 372299111, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "color", identifier: 257, description: "Detected color in the RGB color space.", fields: [{ name: "red", unit: "/", shift: 16, type: "u0.16", storage: 2 }, { name: "green", unit: "/", shift: 16, type: "u0.16", storage: 2 }, { name: "blue", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16 u0.16 u0.16" }], tags: ["8bit"], group: "Environment" }, { name: "Compass", status: "rc", shortId: "compass", camelName: "compass", shortName: "compass", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures the heading." }, classIdentifier: 364362175, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "heading", identifier: 257, description: "The heading with respect to the magnetic north.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "u16.16", storage: 4, absoluteMin: 0, absoluteMax: 359 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn on or off the sensor. Turning on the sensor may start a calibration sequence.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "ro", name: "heading_error", identifier: 262, description: "Error on the heading reading", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "command", name: "calibrate", identifier: 2, description: "Starts a calibration sequence for the compass.", fields: [], identifierName: "calibrate" }], tags: [] }, { name: "Control", status: "stable", shortId: "control", camelName: "control", shortName: "control", extends: ["_base"], notes: { short: "Control service is always service index `0`.\nIt handles actions common to all services on a device.\n\nNote: some of the optional features (including `flood_ping`, `mcu_temperature`, and all string registers)\nare not implemented in `8bit` version." }, classIdentifier: 0, enums: { AnnounceFlags: { name: "AnnounceFlags", storage: 2, isFlags: true, members: { RestartCounterSteady: 15, RestartCounter1: 1, RestartCounter2: 2, RestartCounter4: 4, RestartCounter8: 8, StatusLightNone: 0, StatusLightMono: 16, StatusLightRgbNoFade: 32, StatusLightRgbFade: 48, SupportsACK: 256, SupportsBroadcast: 512, SupportsFrames: 1024, IsClient: 2048, SupportsReliableCommands: 4096 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "services", identifier: 0, description: "The `restart_counter` is computed from the `flags & RestartCounterSteady`, starts at `0x1` and increments by one until it reaches `0xf`, then it stays at `0xf`.\nIf this number ever goes down, it indicates that the device restarted.\n`service_class` indicates class identifier for each service index (service index `0` is always control, so it's\nskipped in this enumeration).\n`packet_count` indicates the number of reports sent by the current device since last announce,\nincluding the current announce packet (it is always 0 if this feature is not supported).\nThe command form can be used to induce report, which is otherwise broadcast every 500ms.", fields: [], identifierName: "announce", hasReport: true }, { kind: "report", name: "services", identifier: 0, description: "The `restart_counter` is computed from the `flags & RestartCounterSteady`, starts at `0x1` and increments by one until it reaches `0xf`, then it stays at `0xf`.\nIf this number ever goes down, it indicates that the device restarted.\n`service_class` indicates class identifier for each service index (service index `0` is always control, so it's\nskipped in this enumeration).\n`packet_count` indicates the number of reports sent by the current device since last announce,\nincluding the current announce packet (it is always 0 if this feature is not supported).\nThe command form can be used to induce report, which is otherwise broadcast every 500ms.", fields: [{ name: "flags", type: "AnnounceFlags", storage: 2 }, { name: "packet_count", type: "u8", storage: 1, isSimpleType: true }, { name: "reserved", type: "u8", storage: 1, isSimpleType: true }, { name: "service_class", type: "u32", storage: 4, isSimpleType: true, startRepeats: true }], secondary: true, packFormat: "u16 u8 u8 r: u32" }, { kind: "command", name: "noop", identifier: 128, description: "Do nothing. Always ignored. Can be used to test ACKs.", fields: [] }, { kind: "command", name: "identify", identifier: 129, description: "Blink the status LED (262ms on, 262ms off, four times, with the blue LED) or otherwise draw user's attention to device with no status light.\nFor devices with status light (this can be discovered in the announce flags), the client should\nsend the sequence of status light command to generate the identify animation.", fields: [], optional: true }, { kind: "command", name: "reset", identifier: 130, description: "Reset device. ACK may or may not be sent.", fields: [], optional: true }, { kind: "command", name: "flood_ping", identifier: 131, description: "The device will respond `num_responses` times, as fast as it can, setting the `counter` field in the report\nto `start_counter`, then `start_counter + 1`, ..., and finally `start_counter + num_responses - 1`.\nThe `dummy_payload` is `size` bytes long and contains bytes `0, 1, 2, ...`.", fields: [{ name: "num_responses", type: "u32", storage: 4, isSimpleType: true }, { name: "start_counter", type: "u32", storage: 4, isSimpleType: true }, { name: "size", unit: "B", type: "u8", storage: 1, isSimpleType: true }], unique: true, optional: true, hasReport: true, packFormat: "u32 u32 u8" }, { kind: "report", name: "flood_ping", identifier: 131, description: "The device will respond `num_responses` times, as fast as it can, setting the `counter` field in the report\nto `start_counter`, then `start_counter + 1`, ..., and finally `start_counter + num_responses - 1`.\nThe `dummy_payload` is `size` bytes long and contains bytes `0, 1, 2, ...`.", fields: [{ name: "counter", type: "u32", storage: 4, isSimpleType: true }, { name: "dummy_payload", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "u32 b" }, { kind: "command", name: "set_status_light", identifier: 132, description: "Initiates a color transition of the status light from its current color to the one specified.\nThe transition will complete in about `512 / speed` frames\n(each frame is currently 100ms, so speed of `51` is about 1 second and `26` 0.5 second).\nAs a special case, if speed is `0` the transition is immediate.\nIf MCU is not capable of executing transitions, it can consider `speed` to be always `0`.\nIf a monochrome LEDs is fitted, the average value of `red`, `green`, `blue` is used.\nIf intensity of a monochrome LED cannot be controlled, any value larger than `0` should be considered\non, and `0` (for all three channels) should be considered off.", fields: [{ name: "to_red", type: "u8", storage: 1, isSimpleType: true }, { name: "to_green", type: "u8", storage: 1, isSimpleType: true }, { name: "to_blue", type: "u8", storage: 1, isSimpleType: true }, { name: "speed", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8 u8 u8 u8" }, { kind: "command", name: "proxy", identifier: 133, description: "Force client device into proxy mode.", fields: [], optional: true }, { kind: "command", name: "reliable_commands", identifier: 134, description: "This opens a pipe to the device to provide an alternative, reliable transport of actions\n(and possibly other commands).\nThe commands are wrapped as pipe data packets.\nMultiple invocations of this command with the same `seed` are dropped\n(and thus the command is not `unique`); otherwise `seed` carries no meaning\nand should be set to a random value by the client.\nNote that while the commands sends this way are delivered exactly once, the\nresponses might get lost.", fields: [{ name: "seed", type: "u32", storage: 4, isSimpleType: true }], optional: true, hasReport: true, packFormat: "u32" }, { kind: "report", name: "reliable_commands", identifier: 134, description: "This opens a pipe to the device to provide an alternative, reliable transport of actions\n(and possibly other commands).\nThe commands are wrapped as pipe data packets.\nMultiple invocations of this command with the same `seed` are dropped\n(and thus the command is not `unique`); otherwise `seed` carries no meaning\nand should be set to a random value by the client.\nNote that while the commands sends this way are delivered exactly once, the\nresponses might get lost.", fields: [{ name: "commands", type: "pipe", storage: 12 }], secondary: true, pipeType: "reliable_commands", packFormat: "b[12]" }, { kind: "pipe_command", name: "wrapped_command", identifier: 0, description: "This opens a pipe to the device to provide an alternative, reliable transport of actions\n(and possibly other commands).\nThe commands are wrapped as pipe data packets.\nMultiple invocations of this command with the same `seed` are dropped\n(and thus the command is not `unique`); otherwise `seed` carries no meaning\nand should be set to a random value by the client.\nNote that while the commands sends this way are delivered exactly once, the\nresponses might get lost.", fields: [{ name: "service_size", type: "u8", storage: 1, isSimpleType: true }, { name: "service_index", type: "u8", storage: 1, isSimpleType: true }, { name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "reliable_commands", packFormat: "u8 u8 u16 b" }, { kind: "command", name: "standby", identifier: 135, description: "Attempt to put devices into lowest power sleep mode for a specified time - most likely involving a full reset on wake-up.", fields: [{ name: "duration", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }, { kind: "rw", name: "reset_in", identifier: 128, description: "When set to value other than `0`, it asks the device to reset after specified number of microseconds.\nThis is typically used to implement watchdog functionality, where a brain device sets `reset_in` to\nsay 1.6s every 0.5s.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, packFormat: "u32" }, { kind: "const", name: "device_description", identifier: 384, description: "Identifies the type of hardware (eg., ACME Corp. Servo X-42 Rev C)", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "const", name: "product_identifier", identifier: 385, description: "A numeric code for the string above; used to identify firmware images and devices.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true, absoluteMin: 805306368, absoluteMax: 1073741823 }], optional: true, packFormat: "u32" }, { kind: "const", name: "bootloader_product_identifier", identifier: 388, description: "Typically the same as `product_identifier` unless device was flashed by hand; the bootloader will respond to that code.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true, absoluteMin: 805306368, absoluteMax: 1073741823 }], optional: true, packFormat: "u32" }, { kind: "const", name: "firmware_version", identifier: 389, description: "A string describing firmware version; typically semver.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "ro", name: "mcu_temperature", identifier: 386, description: "MCU temperature in degrees Celsius (approximate).", fields: [{ name: "_", unit: "\xB0C", type: "i16", storage: -2, isSimpleType: true, typicalMin: -10, typicalMax: 150 }], volatile: true, optional: true, preferredInterval: 6e4, packFormat: "i16" }, { kind: "ro", name: "uptime", identifier: 390, description: "Number of microseconds since boot.", fields: [{ name: "_", unit: "us", type: "u64", storage: 8, isSimpleType: true }], volatile: true, optional: true, preferredInterval: 6e4, packFormat: "u64" }], tags: ["C", "8bit"] }, { name: "Dashboard", status: "stable", shortId: "dashboard", camelName: "dashboard", shortName: "dashboard", extends: ["_base"], notes: { short: "Device that interacts, configure or inspects with the services on the bus. While a dashboard is on the bus, heuristics like device reset should be disabled." }, classIdentifier: 468029703, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "DC Current Measurement", status: "experimental", shortId: "dccurrentmeasurement", camelName: "dcCurrentMeasurement", shortName: "dcCurrentMeasurement", extends: ["_base", "_sensor"], notes: { short: "A service that reports a current measurement." }, classIdentifier: 420661422, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "measurement_name", identifier: 386, description: "A string containing the net name that is being measured e.g. `POWER_DUT` or a reference e.g. `DIFF_DEV1_DEV2`. These constants can be used to identify a measurement from client code.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "measurement", identifier: 257, description: "The current measurement.", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], volatile: true, identifierName: "reading", packFormat: "f64" }, { kind: "ro", name: "measurement_error", identifier: 262, description: "Absolute error on the reading value.", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "f64" }, { kind: "const", name: "min_measurement", identifier: 260, description: "Minimum measurable current", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "min_reading", packFormat: "f64" }, { kind: "const", name: "max_measurement", identifier: 261, description: "Maximum measurable current", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "max_reading", packFormat: "f64" }], tags: [] }, { name: "DC Voltage Measurement", status: "experimental", shortId: "dcvoltagemeasurement", camelName: "dcVoltageMeasurement", shortName: "dcVoltageMeasurement", extends: ["_base", "_sensor"], notes: { short: "A service that reports a voltage measurement." }, classIdentifier: 372485145, enums: { VoltageMeasurementType: { name: "VoltageMeasurementType", storage: 1, members: { Absolute: 0, Differential: 1 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "measurement_type", identifier: 385, description: "The type of measurement that is taking place. Absolute results are measured with respect to ground, whereas differential results are measured against another signal that is not ground.", fields: [{ name: "_", type: "VoltageMeasurementType", storage: 1 }], packFormat: "u8" }, { kind: "const", name: "measurement_name", identifier: 386, description: "A string containing the net name that is being measured e.g. `POWER_DUT` or a reference e.g. `DIFF_DEV1_DEV2`. These constants can be used to identify a measurement from client code.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "measurement", identifier: 257, description: "The voltage measurement.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], volatile: true, identifierName: "reading", packFormat: "f64" }, { kind: "ro", name: "measurement_error", identifier: 262, description: "Absolute error on the reading value.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "f64" }, { kind: "const", name: "min_measurement", identifier: 260, description: "Minimum measurable current", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "min_reading", packFormat: "f64" }, { kind: "const", name: "max_measurement", identifier: 261, description: "Maximum measurable current", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "max_reading", packFormat: "f64" }], tags: [] }, { name: "DeviceScript Condition", status: "deprecated", shortId: "devicescriptcondition", camelName: "deviceScriptCondition", shortName: "deviceScriptCondition", extends: ["_base"], notes: { short: "Conditions are synthetic services used to synchronize threads of executions of a DeviceScript VM.\n**This is no longer used**." }, classIdentifier: 295074157, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "signal", identifier: 128, description: "Triggers a `signalled` event.", fields: [] }, { kind: "event", name: "signalled", identifier: 3, description: "Triggered by `signal` command.", fields: [], identifierName: "change" }], tags: ["infrastructure", "devicescript"], restricted: true }, { name: "DeviceScript Debugger", status: "experimental", shortId: "devicescriptdebugger", camelName: "devsDbg", shortName: "devsDbg", extends: ["_base"], notes: { short: "Allows for inspecting and affecting the state of a running DeviceScript program." }, classIdentifier: 358308672, enums: { ValueTag: { name: "ValueTag", storage: 1, members: { Number: 1, Special: 2, Fiber: 3, BuiltinObject: 5, Exotic: 6, Unhandled: 7, ImgBuffer: 32, ImgStringBuiltin: 33, ImgStringAscii: 34, ImgStringUTF8: 35, ImgRole: 48, ImgFunction: 49, ImgRoleMember: 50, ObjArray: 81, ObjMap: 82, ObjBuffer: 83, ObjString: 84, ObjStackFrame: 85, ObjPacket: 86, ObjBoundFunction: 87, ObjOpaque: 88, ObjAny: 80, ObjMask: 240, User1: 241, User2: 242, User3: 243, User4: 244 } }, ValueSpecial: { name: "ValueSpecial", storage: 1, members: { Undefined: 0, True: 1, False: 2, Null: 3, Globals: 100, CurrentException: 101 } }, FunIdx: { name: "FunIdx", storage: 2, isExtensible: true, members: { None: 0, Main: 49999, FirstBuiltIn: 5e4 } }, FiberHandle: { name: "FiberHandle", storage: 4, isExtensible: true, members: { None: 0 } }, ProgramCounter: { name: "ProgramCounter", storage: 4, isExtensible: true, members: {} }, ObjStackFrame: { name: "ObjStackFrame", storage: 4, isExtensible: true, members: { Null: 0 } }, String: { name: "String", storage: 4, isExtensible: true, members: { StaticIndicatorMask: 2147483649, StaticTagMask: 2130706432, StaticIndexMask: 16777214, Unhandled: 0 } }, StepFlags: { name: "StepFlags", storage: 2, isFlags: true, members: { StepOut: 1, StepIn: 2, Throw: 4 } }, SuspensionType: { name: "SuspensionType", storage: 1, members: { None: 0, Breakpoint: 1, UnhandledException: 2, HandledException: 3, Halt: 4, Panic: 5, Restart: 6, DebuggerStmt: 7, Step: 8 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "read_fibers", identifier: 128, description: "List the currently running fibers (threads).", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "read_fibers", packFormat: "b[12]" }, { kind: "pipe_report", name: "fiber", identifier: 0, description: "List the currently running fibers (threads).", fields: [{ name: "handle", type: "FiberHandle", storage: 4 }, { name: "initial_fn", type: "FunIdx", storage: 2 }, { name: "curr_fn", type: "FunIdx", storage: 2 }], pipeType: "read_fibers", packFormat: "u32 u16 u16" }, { kind: "command", name: "read_stack", identifier: 129, description: "List stack frames in a fiber.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "fiber_handle", type: "FiberHandle", storage: 4 }], pipeType: "read_stack", packFormat: "b[12] u32" }, { kind: "pipe_report", name: "stackframe", identifier: 0, description: "List stack frames in a fiber.", fields: [{ name: "self", type: "ObjStackFrame", storage: 4 }, { name: "pc", type: "ProgramCounter", storage: 4 }, { name: "closure", type: "ObjStackFrame", storage: 4 }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "reserved", type: "u16", storage: 2, isSimpleType: true }], pipeType: "read_stack", packFormat: "u32 u32 u32 u16 u16" }, { kind: "command", name: "read_indexed_values", identifier: 130, description: "Read variable slots in a stack frame, elements of an array, etc.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }, { name: "reserved", type: "u8", storage: 1, isSimpleType: true }, { name: "start", type: "u16", storage: 2, isSimpleType: true }, { name: "length", type: "u16", storage: 2, isSimpleType: true }], pipeType: "read_indexed_values", packFormat: "b[12] u32 u8 u8 u16 u16" }, { kind: "pipe_report", name: "value", identifier: 0, description: "Read variable slots in a stack frame, elements of an array, etc.", fields: [{ name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "v1", type: "u32", storage: 4, isSimpleType: true }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "tag", type: "ValueTag", storage: 1 }], pipeType: "read_indexed_values", packFormat: "u32 u32 u16 u8" }, { kind: "command", name: "read_named_values", identifier: 131, description: "Read variable slots in an object.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }], pipeType: "read_named_values", packFormat: "b[12] u32 u8" }, { kind: "pipe_report", name: "key_value", identifier: 0, description: "Read variable slots in an object.", fields: [{ name: "key", type: "String", storage: 4 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "v1", type: "u32", storage: 4, isSimpleType: true }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "tag", type: "ValueTag", storage: 1 }], pipeType: "read_named_values", packFormat: "u32 u32 u32 u16 u8" }, { kind: "command", name: "read_value", identifier: 132, description: "Read a specific value.", fields: [{ name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }], hasReport: true, packFormat: "u32 u8" }, { kind: "report", name: "read_value", identifier: 132, description: "Read a specific value.", fields: [{ name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "v1", type: "u32", storage: 4, isSimpleType: true }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "tag", type: "ValueTag", storage: 1 }], secondary: true, packFormat: "u32 u32 u16 u8" }, { kind: "command", name: "read_bytes", identifier: 133, description: "Read bytes of a string (UTF8) or buffer value.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }, { name: "reserved", type: "u8", storage: 1, isSimpleType: true }, { name: "start", type: "u16", storage: 2, isSimpleType: true }, { name: "length", type: "u16", storage: 2, isSimpleType: true }], pipeType: "read_bytes", packFormat: "b[12] u32 u8 u8 u16 u16" }, { kind: "pipe_report", name: "bytes_value", identifier: 0, description: "Read bytes of a string (UTF8) or buffer value.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "read_bytes", packFormat: "b" }, { kind: "command", name: "set_breakpoints", identifier: 144, description: "Set breakpoint(s) at a location(s).", fields: [{ name: "break_pc", type: "ProgramCounter", storage: 4, startRepeats: true }], packFormat: "r: u32" }, { kind: "command", name: "clear_breakpoints", identifier: 145, description: "Clear breakpoint(s) at a location(s).", fields: [{ name: "break_pc", type: "ProgramCounter", storage: 4, startRepeats: true }], packFormat: "r: u32" }, { kind: "command", name: "clear_all_breakpoints", identifier: 146, description: "Clear all breakpoints.", fields: [] }, { kind: "command", name: "resume", identifier: 147, description: "Resume program execution after a breakpoint was hit.", fields: [] }, { kind: "command", name: "halt", identifier: 148, description: "Try suspending current program. Client needs to wait for `suspended` event afterwards.", fields: [] }, { kind: "command", name: "restart_and_halt", identifier: 149, description: "Run the program from the beginning and halt on first instruction.", fields: [] }, { kind: "command", name: "step", identifier: 150, description: "Set breakpoints that only trigger in the specified stackframe and resume program.\nThe breakpoints are cleared automatically on next suspension (regardless of the reason).", fields: [{ name: "stackframe", type: "ObjStackFrame", storage: 4 }, { name: "flags", type: "StepFlags", storage: 2 }, { name: "reserved", type: "u16", storage: 2, isSimpleType: true }, { name: "break_pc", type: "ProgramCounter", storage: 4, startRepeats: true }], packFormat: "u32 u16 u16 r: u32" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn on/off the debugger interface.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "break_at_unhandled_exn", identifier: 128, description: "Wheather to place breakpoint at unhandled exception.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "break_at_handled_exn", identifier: 129, description: "Wheather to place breakpoint at handled exception.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "is_suspended", identifier: 384, description: "Indicates if the program is currently suspended.\nMost commands can only be executed when the program is suspended.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "event", name: "suspended", identifier: 128, description: "Emitted when the program hits a breakpoint or similar event in the specified fiber.", fields: [{ name: "fiber", type: "FiberHandle", storage: 4 }, { name: "type", type: "SuspensionType", storage: 1 }], packFormat: "u32 u8" }], tags: ["management", "devicescript"], restricted: true }, { name: "DeviceScript Manager", status: "experimental", shortId: "devicescriptmanager", camelName: "deviceScriptManager", shortName: "deviceScriptManager", extends: ["_base"], notes: { short: "Allows for deployment and control over DeviceScript virtual machine.\n\nPrograms start automatically after device restart or uploading of new program.\nYou can stop programs until next reset by setting the `running` and `autostart` registers to `false`.", events: "When program is running, `status_code == Ready`.\nWhen there is a valid program, but it is not running, `status_code == Sleeping`.\nWhen there is no valid program, `status_code == WaitingForInput`." }, classIdentifier: 288680491, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "deploy_bytecode", identifier: 128, description: "Open pipe for streaming in the bytecode of the program. The size of the bytecode has to be declared upfront.\nTo clear the program, use `bytecode_size == 0`.\nThe bytecode is streamed over regular pipe data packets.\nThe bytecode shall be fully written into flash upon closing the pipe.\nIf `autostart` is true, the program will start after being deployed.\nThe data payloads, including the last one, should have a size that is a multiple of 32 bytes.\nThus, the initial bytecode_size also needs to be a multiple of 32.", fields: [{ name: "bytecode_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }], unique: true, hasReport: true, packFormat: "u32" }, { kind: "report", name: "deploy_bytecode", identifier: 128, description: "Open pipe for streaming in the bytecode of the program. The size of the bytecode has to be declared upfront.\nTo clear the program, use `bytecode_size == 0`.\nThe bytecode is streamed over regular pipe data packets.\nThe bytecode shall be fully written into flash upon closing the pipe.\nIf `autostart` is true, the program will start after being deployed.\nThe data payloads, including the last one, should have a size that is a multiple of 32 bytes.\nThus, the initial bytecode_size also needs to be a multiple of 32.", fields: [{ name: "bytecode_port", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "deploy_bytecode", packFormat: "u16" }, { kind: "command", name: "read_bytecode", identifier: 129, description: "Get the current bytecode deployed on device.", fields: [{ name: "bytecode", type: "pipe", storage: 12 }], pipeType: "read_bytecode", packFormat: "b[12]" }, { kind: "pipe_report", name: "bytecode", identifier: 0, description: "Get the current bytecode deployed on device.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "read_bytecode", packFormat: "b" }, { kind: "rw", name: "running", identifier: 128, description: "Indicates if the program is currently running.\nTo restart the program, stop it (write `0`), read back the register to make sure it's stopped,\nstart it, and read back.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "autostart", identifier: 129, description: "Indicates wheather the program should be re-started upon `reboot()` or `panic()`.\nDefaults to `true`.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "program_size", identifier: 384, description: "The size of current program.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "program_hash", identifier: 385, description: "Return FNV1A hash of the current bytecode.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "program_sha256", identifier: 386, description: "Return 32-byte long SHA-256 hash of the current bytecode.", fields: [{ name: "_", type: "bytes", storage: 32, isSimpleType: true, maxBytes: 32 }], packFormat: "b[32]" }, { kind: "const", name: "runtime_version", identifier: 387, description: "Returns the runtime version number compatible with [Semver](https://semver.org/).\nWhen read as 32-bit little endian integer a version `7.15.500` would be `0x07_0F_01F4`.", fields: [{ name: "patch", type: "u16", storage: 2, isSimpleType: true }, { name: "minor", type: "u8", storage: 1, isSimpleType: true }, { name: "major", type: "u8", storage: 1, isSimpleType: true }], optional: true, packFormat: "u16 u8 u8" }, { kind: "ro", name: "program_name", identifier: 388, description: "The name of currently running program. The compiler takes is from `package.json`.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "program_version", identifier: 389, description: "The version number of currently running program. The compiler takes is from `package.json`\nand `git`.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "event", name: "program_panic", identifier: 128, description: "Emitted when the program calls `panic(panic_code)` or `reboot()` (`panic_code == 0` in that case).\nThe byte offset in byte code of the call is given in `program_counter`.\nThe program will restart immediately when `panic_code == 0` or in a few seconds otherwise.", fields: [{ name: "panic_code", type: "u32", storage: 4, isSimpleType: true }, { name: "program_counter", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32 u32" }, { kind: "event", name: "program_change", identifier: 3, description: "Emitted after bytecode of the program has changed.", fields: [], identifierName: "change" }], tags: ["management", "devicescript"], restricted: true }, { name: "Distance", status: "stable", shortId: "distance", camelName: "distance", shortName: "distance", extends: ["_base", "_sensor"], notes: { short: "A sensor that determines the distance of an object without any physical contact involved." }, classIdentifier: 337275786, enums: { Variant: { name: "Variant", storage: 1, members: { Ultrasonic: 1, Infrared: 2, LiDAR: 3, Laser: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "distance", identifier: 257, description: "Current distance from the object", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4, typicalMin: 0.02, typicalMax: 4 }], volatile: true, identifierName: "reading", packFormat: "u16.16" }, { kind: "ro", name: "distance_error", identifier: 262, description: "Absolute error on the reading value.", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "min_range", identifier: 260, description: "Minimum measurable distance", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "min_reading", packFormat: "u16.16" }, { kind: "const", name: "max_range", identifier: 261, description: "Maximum measurable distance", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "Determines the type of sensor used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"] }, { name: "DMX", status: "experimental", shortId: "dmx", camelName: "dmx", shortName: "dmx", extends: ["_base"], notes: { short: "A service that can send DMX512-A packets with limited size. This service is designed to allow tinkering with a few DMX devices, but only allows 235 channels. More about DMX at https://en.wikipedia.org/wiki/DMX512." }, classIdentifier: 298814469, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines if the DMX bridge is active.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "command", name: "send", identifier: 128, description: "Send a DMX packet, up to 236bytes long, including the start code.", fields: [{ name: "channels", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }], tags: [] }, { name: "Dot Matrix", status: "rc", shortId: "dotmatrix", camelName: "dotMatrix", shortName: "dotMatrix", extends: ["_base"], notes: { short: "A rectangular dot matrix display, made of monochrome LEDs or Braille pins." }, classIdentifier: 286070091, enums: { Variant: { name: "Variant", storage: 1, members: { LED: 1, Braille: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "dots", identifier: 2, description: "The state of the screen where dot on/off state is\nstored as a bit, column by column. The column should be byte aligned.\n\nFor example, if the display has no more than 8 rows in each column, then each byte contains bits corresponding\nto a single column. Least-significant bit is on top.\nIf display has 10 rows, then each column is represented by two bytes.\nThe top-most 8 rows sit in the first byte (with the least significant bit being on top),\nand the remainign 2 row sit in the second byte.\n\nThe following C expression can be used to check if a given `column, row` coordinate is set:\n`dots[column * column_size + (row >> 3)] & (1 << (row & 7))`, where\n`column_size` is `(number_of_rows + 7) >> 3` (note that if number of rows is 8 or less then `column_size` is `1`),\nand `dots` is of `uint8_t*` type.\n\nThe size of this register is `number_of_columns * column_size` bytes.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], identifierName: "value", packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Reads the general brightness of the display, brightness for LEDs. `0` when the screen is off.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], optional: true, identifierName: "intensity", packFormat: "u0.8" }, { kind: "const", name: "rows", identifier: 385, description: "Number of rows on the screen", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "columns", identifier: 386, description: "Number of columns on the screen", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of matrix used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [], group: "Display" }, { name: "Dual Motors", status: "experimental", shortId: "dualmotors", camelName: "dualMotors", shortName: "dualMotors", extends: ["_base"], notes: { short: "A synchronized pair of motors." }, classIdentifier: 355063095, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "speed", identifier: 2, description: "Relative speed of the motors. Use positive/negative values to run the motor forwards and backwards.\nA speed of ``0`` while ``enabled`` acts as brake.", fields: [{ name: "left", unit: "/", shift: 15, type: "i1.15", storage: -2 }, { name: "right", unit: "/", shift: 15, type: "i1.15", storage: -2 }], identifierName: "value", packFormat: "i1.15 i1.15" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn the power to the motors on/off.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "load_torque", identifier: 384, description: "Torque required to produce the rated power of an each electrical motor at load speed.", fields: [{ name: "_", unit: "kg/cm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "load_rotation_speed", identifier: 385, description: "Revolutions per minute of the motor under full load.", fields: [{ name: "_", unit: "rpm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "reversible", identifier: 386, description: "Indicates if the motors can run backwards.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: [], group: "Motor" }, { name: "Equivalent CO\u2082", status: "rc", shortId: "eco2", camelName: "eCO2", shortName: "eCO2", extends: ["_base", "_sensor"], notes: { short: "Measures equivalent CO\u2082 levels." }, classIdentifier: 379362758, enums: { Variant: { name: "Variant", storage: 1, members: { VOC: 1, NDIR: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "e_CO2", identifier: 257, description: "Equivalent CO\u2082 (eCO\u2082) readings.", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4, typicalMin: 400, typicalMax: 8192 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u22.10" }, { kind: "ro", name: "e_CO2_error", identifier: 262, description: "Error on the reading value.", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_e_CO2", identifier: 260, description: "Minimum measurable value", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4 }], identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_e_CO2", identifier: 261, description: "Minimum measurable value", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4 }], identifierName: "max_reading", packFormat: "u22.10" }, { kind: "const", name: "variant", identifier: 263, description: "Type of physical sensor and capabilities.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Flex", status: "rc", shortId: "flex", camelName: "flex", shortName: "flex", extends: ["_base", "_sensor"], notes: { short: "A bending or deflection sensor." }, classIdentifier: 524797638, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "bending", identifier: 257, description: "A measure of the bending.", fields: [{ name: "_", unit: "/", shift: 15, type: "i1.15", storage: -2 }], volatile: true, identifierName: "reading", packFormat: "i1.15" }, { kind: "const", name: "length", identifier: 384, description: "Length of the flex sensor", fields: [{ name: "_", unit: "mm", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }], tags: ["C", "8bit"], group: "Sensor" }, { name: "Gamepad", status: "rc", shortId: "gamepad", camelName: "gamepad", shortName: "gamepad", extends: ["_base", "_sensor"], notes: { short: "A two axis directional gamepad with optional buttons." }, classIdentifier: 277836886, enums: { Buttons: { name: "Buttons", storage: 4, isFlags: true, members: { Left: 1, Up: 2, Right: 4, Down: 8, A: 16, B: 32, Menu: 64, Select: 128, Reset: 256, Exit: 512, X: 1024, Y: 2048 } }, Variant: { name: "Variant", storage: 1, members: { Thumb: 1, ArcadeBall: 2, ArcadeStick: 3, Gamepad: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "direction", identifier: 257, description: 'If the gamepad is analog, the directional buttons should be "simulated", based on gamepad position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the gamepad is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the gamepad is `A`.', fields: [{ name: "buttons", type: "Buttons", storage: 4 }, { name: "x", unit: "/", shift: 15, type: "i1.15", storage: -2 }, { name: "y", unit: "/", shift: 15, type: "i1.15", storage: -2 }], volatile: true, identifierName: "reading", packFormat: "u32 i1.15 i1.15" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical gamepad.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "const", name: "buttons_available", identifier: 384, description: "Indicates a bitmask of the buttons that are mounted on the gamepad.\nIf the `Left`/`Up`/`Right`/`Down` buttons are marked as available here, the gamepad is digital.\nEven when marked as not available, they will still be simulated based on the analog gamepad.", fields: [{ name: "_", type: "Buttons", storage: 4 }], packFormat: "u32" }, { kind: "event", name: "buttons_changed", identifier: 3, description: "Emitted whenever the state of buttons changes.", fields: [{ name: "buttons", type: "Buttons", storage: 4 }], identifierName: "change", packFormat: "u32" }], tags: ["8bit", "padauk"], group: "Button" }, { name: "GPIO", status: "experimental", shortId: "gpio", camelName: "GPIO", shortName: "GPIO", extends: ["_base", "_sensor"], notes: { short: "Access to General Purpose Input/Output (GPIO) pins on a board.\nThe pins are indexed `0 ... num_pins-1`.\nThe indexing does not correspond to hardware pin names, nor labels on the board (see `get_pin_info` command for that),\nand should **not** be exposed to the user." }, classIdentifier: 282614377, enums: { Mode: { name: "Mode", storage: 1, members: { Off: 0, OffPullUp: 16, OffPullDown: 32, Input: 1, InputPullUp: 17, InputPullDown: 33, Output: 2, OutputHigh: 18, OutputLow: 34, AnalogIn: 3, Alternative: 4, BaseModeMask: 15 } }, Capabilities: { name: "Capabilities", storage: 2, isFlags: true, members: { PullUp: 1, PullDown: 2, Input: 4, Output: 8, Analog: 16 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "state", identifier: 257, description: "For every pin set to `Input*` the corresponding **bit** in `digital_values` will be `1` if and only if\nthe pin is high.\nFor other pins, the bit is `0`.\nThis is normally streamed at low-ish speed, but it's also automatically reported whenever\na digital input pin changes value (throttled to ~100Hz).\nThe analog values can be read with the `ADC` service.", fields: [{ name: "digital_values", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "b" }, { kind: "ro", name: "num_pins", identifier: 384, description: "Number of pins that can be operated through this service.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true, absoluteMax: 128, absoluteMin: 0 }], packFormat: "u8" }, { kind: "command", name: "configure", identifier: 128, description: "Configure (including setting the value) zero or more pins.\n`Alternative` settings means the pin is controlled by other service (SPI, I2C, UART, PWM, etc.).", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true, startRepeats: true }, { name: "mode", type: "Mode", storage: 1 }], packFormat: "r: u8 u8" }, { kind: "command", name: "pin_info", identifier: 129, description: "Report capabilities and name of a pin.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }], hasReport: true, packFormat: "u8" }, { kind: "report", name: "pin_info", identifier: 129, description: "Report capabilities and name of a pin.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }, { name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }, { name: "capabilities", type: "Capabilities", storage: 2 }, { name: "mode", type: "Mode", storage: 1 }, { name: "label", type: "string", storage: 0 }], secondary: true, packFormat: "u8 u8 u16 u8 s" }, { kind: "command", name: "pin_by_label", identifier: 131, description: "This responds with `pin_info` report.", fields: [{ name: "label", type: "string", storage: 0 }], hasReport: true, packFormat: "s" }, { kind: "report", name: "pin_by_label", identifier: 131, description: "This responds with `pin_info` report.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }, { name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }, { name: "capabilities", type: "Capabilities", storage: 2 }, { name: "mode", type: "Mode", storage: 1 }, { name: "label", type: "string", storage: 0 }], secondary: true, packFormat: "u8 u8 u16 u8 s" }, { kind: "command", name: "pin_by_hw_pin", identifier: 132, description: "This responds with `pin_info` report.", fields: [{ name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }], hasReport: true, packFormat: "u8" }, { kind: "report", name: "pin_by_hw_pin", identifier: 132, description: "This responds with `pin_info` report.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }, { name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }, { name: "capabilities", type: "Capabilities", storage: 2 }, { name: "mode", type: "Mode", storage: 1 }, { name: "label", type: "string", storage: 0 }], secondary: true, packFormat: "u8 u8 u16 u8 s" }], tags: ["io"] }, { name: "Gyroscope", status: "rc", shortId: "gyroscope", camelName: "gyroscope", shortName: "gyroscope", extends: ["_base", "_sensor"], notes: { short: "A 3-axis gyroscope." }, classIdentifier: 505087730, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "rotation_rates", identifier: 257, description: "Indicates the current rates acting on gyroscope.", fields: [{ name: "x", unit: "\xB0/s", shift: 20, type: "i12.20", storage: -4 }, { name: "y", unit: "\xB0/s", shift: 20, type: "i12.20", storage: -4 }, { name: "z", unit: "\xB0/s", shift: 20, type: "i12.20", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i12.20 i12.20 i12.20" }, { kind: "ro", name: "rotation_rates_error", identifier: 262, description: "Error on the reading value.", fields: [{ name: "_", unit: "\xB0/s", shift: 20, type: "u12.20", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u12.20" }, { kind: "rw", name: "max_rate", identifier: 8, description: 'Configures the range of rotation rates.\nThe value will be "rounded up" to one of `max_rates_supported`.', fields: [{ name: "_", unit: "\xB0/s", shift: 20, type: "u12.20", storage: 4 }], optional: true, identifierName: "reading_range", packFormat: "u12.20" }, { kind: "const", name: "max_rates_supported", identifier: 266, description: "Lists values supported for writing `max_rate`.", fields: [{ name: "max_rate", unit: "\xB0/s", shift: 20, type: "u12.20", storage: 4, startRepeats: true }], optional: true, identifierName: "supported_ranges", packFormat: "r: u12.20" }], tags: [], group: "Movement" }, { name: "Heart Rate", status: "experimental", shortId: "heartrate", camelName: "heartRate", shortName: "heartRate", extends: ["_base", "_sensor"], notes: { short: "A sensor approximating the heart rate. \n\n\n**Jacdac is NOT suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.**" }, classIdentifier: 376204740, enums: { Variant: { name: "Variant", storage: 1, members: { Finger: 1, Chest: 2, Wrist: 3, Pump: 4, WebCam: 5 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "heart_rate", identifier: 257, description: "The estimated heart rate.", fields: [{ name: "_", unit: "bpm", shift: 16, type: "u16.16", storage: 4, typicalMin: 30, typicalMax: 200 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16.16" }, { kind: "ro", name: "heart_rate_error", identifier: 262, description: "The estimated error on the reported sensor data.", fields: [{ name: "_", unit: "bpm", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Biometric" }, { name: "HID Joystick", status: "experimental", shortId: "hidjoystick", camelName: "hidJoystick", shortName: "hidJoystick", extends: ["_base"], notes: { short: "Controls a HID joystick." }, classIdentifier: 437330261, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "button_count", identifier: 384, description: "Number of button report supported", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "buttons_analog", identifier: 385, description: "A bitset that indicates which button is analog.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "axis_count", identifier: 386, description: "Number of analog input supported", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "command", name: "set_buttons", identifier: 128, description: "Sets the up/down button state, one byte per button, supports analog buttons. For digital buttons, use `0` for released, `1` for pressed.", fields: [{ name: "pressure", unit: "/", shift: 8, type: "u0.8", storage: 1, startRepeats: true }], unique: true, packFormat: "r: u0.8" }, { kind: "command", name: "set_axis", identifier: 129, description: "Sets the state of analog inputs.", fields: [{ name: "position", unit: "/", shift: 15, type: "i1.15", storage: -2, startRepeats: true }], unique: true, packFormat: "r: i1.15" }], tags: [] }, { name: "HID Keyboard", status: "stable", shortId: "hidkeyboard", camelName: "hidKeyboard", shortName: "hidKeyboard", extends: ["_base"], notes: { short: "Control a HID keyboard.\n\nThe codes for the key (selectors) is defined in the [HID Keyboard\nspecification](https://usb.org/sites/default/files/hut1_21.pdf), chapter 10 Keyboard/Keypad Page, page 81.\nModifiers are in page 87.\n\nThe device keeps tracks of the key state and is able to clear it all with the clear command." }, classIdentifier: 414210922, enums: { Selector: { name: "Selector", storage: 2, members: { None: 0, ErrorRollOver: 1, PostFail: 2, ErrorUndefined: 3, A: 4, B: 5, C: 6, D: 7, E: 8, F: 9, G: 10, H: 11, I: 12, J: 13, K: 14, L: 15, M: 16, N: 17, O: 18, P: 19, Q: 20, R: 21, S: 22, T: 23, U: 24, V: 25, W: 26, X: 27, Y: 28, Z: 29, _1: 30, _2: 31, _3: 32, _4: 33, _5: 34, _6: 35, _7: 36, _8: 37, _9: 38, _0: 39, Return: 40, Escape: 41, Backspace: 42, Tab: 43, Spacebar: 44, Minus: 45, Equals: 46, LeftSquareBracket: 47, RightSquareBracket: 48, Backslash: 49, NonUsHash: 50, Semicolon: 51, Quote: 52, GraveAccent: 53, Comma: 54, Period: 55, Slash: 56, CapsLock: 57, F1: 58, F2: 59, F3: 60, F4: 61, F5: 62, F6: 63, F7: 64, F8: 65, F9: 66, F10: 67, F11: 68, F12: 69, PrintScreen: 70, ScrollLock: 71, Pause: 72, Insert: 73, Home: 74, PageUp: 75, Delete: 76, End: 77, PageDown: 78, RightArrow: 79, LeftArrow: 80, DownArrow: 81, UpArrow: 82, KeypadNumLock: 83, KeypadDivide: 84, KeypadMultiply: 85, KeypadAdd: 86, KeypadSubtrace: 87, KeypadReturn: 88, Keypad1: 89, Keypad2: 90, Keypad3: 91, Keypad4: 92, Keypad5: 93, Keypad6: 94, Keypad7: 95, Keypad8: 96, Keypad9: 97, Keypad0: 98, KeypadDecimalPoint: 99, NonUsBackslash: 100, Application: 101, Power: 102, KeypadEquals: 103, F13: 104, F14: 105, F15: 106, F16: 107, F17: 108, F18: 109, F19: 110, F20: 111, F21: 112, F22: 113, F23: 114, F24: 115, Execute: 116, Help: 117, Menu: 118, Select: 119, Stop: 120, Again: 121, Undo: 122, Cut: 123, Copy: 124, Paste: 125, Find: 126, Mute: 127, VolumeUp: 128, VolumeDown: 129 } }, Modifiers: { name: "Modifiers", storage: 1, isFlags: true, members: { None: 0, LeftControl: 1, LeftShift: 2, LeftAlt: 4, LeftGUI: 8, RightControl: 16, RightShift: 32, RightAlt: 64, RightGUI: 128 } }, Action: { name: "Action", storage: 1, members: { Press: 0, Up: 1, Down: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "key", identifier: 128, description: "Presses a key or a sequence of keys down.", fields: [{ name: "selector", type: "Selector", storage: 2, startRepeats: true }, { name: "modifiers", type: "Modifiers", storage: 1 }, { name: "action", type: "Action", storage: 1 }], lowLevel: true, unique: true, packFormat: "r: u16 u8 u8" }, { kind: "command", name: "clear", identifier: 129, description: "Clears all pressed keys.", fields: [] }], tags: ["8bit"] }, { name: "HID Mouse", status: "stable", shortId: "hidmouse", camelName: "hidMouse", shortName: "hidMouse", extends: ["_base"], notes: { short: "Controls a HID mouse." }, classIdentifier: 411425820, enums: { Button: { name: "Button", storage: 2, isFlags: true, members: { Left: 1, Right: 2, Middle: 4 } }, ButtonEvent: { name: "ButtonEvent", storage: 1, members: { Up: 1, Down: 2, Click: 3, DoubleClick: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "set_button", identifier: 128, description: "Sets the up/down state of one or more buttons.\nA `Click` is the same as `Down` followed by `Up` after 100ms.\nA `DoubleClick` is two clicks with `150ms` gap between them (that is, `100ms` first click, `150ms` gap, `100ms` second click).", fields: [{ name: "buttons", type: "Button", storage: 2 }, { name: "ev", type: "ButtonEvent", storage: 1 }], unique: true, packFormat: "u16 u8" }, { kind: "command", name: "move", identifier: 129, description: "Moves the mouse by the distance specified.\nIf the time is positive, it specifies how long to make the move.", fields: [{ name: "dx", unit: "#", type: "i16", storage: -2, isSimpleType: true }, { name: "dy", unit: "#", type: "i16", storage: -2, isSimpleType: true }, { name: "time", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], unique: true, packFormat: "i16 i16 u16" }, { kind: "command", name: "wheel", identifier: 130, description: "Turns the wheel up or down. Positive if scrolling up.\nIf the time is positive, it specifies how long to make the move.", fields: [{ name: "dy", unit: "#", type: "i16", storage: -2, isSimpleType: true }, { name: "time", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], unique: true, packFormat: "i16 u16" }], tags: ["8bit"] }, { name: "Humidity", status: "stable", shortId: "humidity", camelName: "humidity", shortName: "humidity", extends: ["_base", "_sensor"], notes: { short: "A sensor measuring humidity of outside environment." }, classIdentifier: 382210232, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "humidity", identifier: 257, description: "The relative humidity in percentage of full water saturation.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], volatile: true, identifierName: "reading", preferredInterval: 5e3, packFormat: "u22.10" }, { kind: "ro", name: "humidity_error", identifier: 262, description: "The real humidity is between `humidity - humidity_error` and `humidity + humidity_error`.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_humidity", identifier: 260, description: "Lowest humidity that can be reported.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_humidity", identifier: 261, description: "Highest humidity that can be reported.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], identifierName: "max_reading", packFormat: "u22.10" }], tags: ["C", "8bit"], group: "Environment" }, { name: "I2C", status: "experimental", shortId: "i2c", camelName: "I2C", shortName: "I2C", extends: ["_base"], notes: { short: "Inter-Integrated Circuit (I2C, I\xB2C, IIC) serial communication bus lets you communicate with\nmany sensors and actuators." }, classIdentifier: 471386691, enums: { Status: { name: "Status", storage: 1, members: { OK: 0, NAckAddr: 1, NAckData: 2, NoI2C: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "ok", identifier: 384, description: "Indicates whether the I2C is working.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "command", name: "transaction", identifier: 128, description: "`address` is 7-bit.\n`num_read` can be 0 if nothing needs to be read.\nThe `write_buf` includes the register address if required (first one or two bytes).", fields: [{ name: "address", type: "u8", storage: 1, isSimpleType: true }, { name: "num_read", unit: "B", type: "u8", storage: 1, isSimpleType: true }, { name: "write_buf", type: "bytes", storage: 0, isSimpleType: true }], unique: true, hasReport: true, packFormat: "u8 u8 b" }, { kind: "report", name: "transaction", identifier: 128, description: "`address` is 7-bit.\n`num_read` can be 0 if nothing needs to be read.\nThe `write_buf` includes the register address if required (first one or two bytes).", fields: [{ name: "status", type: "Status", storage: 1 }, { name: "read_buf", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "u8 b" }], tags: ["io"] }, { name: "Illuminance", status: "rc", shortId: "illuminance", camelName: "illuminance", shortName: "illuminance", extends: ["_base", "_sensor"], notes: { short: "Detects the amount of light falling onto a given surface area.\n\nNote that this is different from _luminance_, the amount of light that passes through, emits from, or reflects off an object." }, classIdentifier: 510577394, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "illuminance", identifier: 257, description: "The amount of illuminance, as lumens per square metre.", fields: [{ name: "_", unit: "lux", shift: 10, type: "u22.10", storage: 4, typicalMax: 1e5, typicalMin: 0 }], volatile: true, identifierName: "reading", packFormat: "u22.10" }, { kind: "ro", name: "illuminance_error", identifier: 262, description: "Error on the reported sensor value.", fields: [{ name: "_", unit: "lux", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }], tags: ["8bit", "padauk"], group: "Environment" }, { name: "Indexed screen", status: "rc", shortId: "indexedscreen", camelName: "indexedScreen", shortName: "indexedScreen", extends: ["_base"], notes: { short: "A screen with indexed colors from a palette.\n\nThis is often run over an SPI connection or directly on the MCU, not regular single-wire Jacdac." }, classIdentifier: 385496805, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "start_update", identifier: 129, description: "Sets the update window for subsequent `set_pixels` commands.", fields: [{ name: "x", unit: "px", type: "u16", storage: 2, isSimpleType: true }, { name: "y", unit: "px", type: "u16", storage: 2, isSimpleType: true }, { name: "width", unit: "px", type: "u16", storage: 2, isSimpleType: true }, { name: "height", unit: "px", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16 u16 u16" }, { kind: "command", name: "set_pixels", identifier: 131, description: 'Set pixels in current window, according to current palette.\nEach "line" of data is aligned to a byte.', fields: [{ name: "pixels", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Set backlight brightness.\nIf set to `0` the display may go to sleep.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "rw", name: "palette", identifier: 128, description: "The current palette. The colors are `[r,g,b, padding]` 32bit color entries.\nThe color entry repeats `1 << bits_per_pixel` times.\nThis register may be write-only.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "const", name: "bits_per_pixel", identifier: 384, description: "Determines the number of palette entries.\nTypical values are 1 or 4.", fields: [{ name: "_", unit: "bit", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "width", identifier: 385, description: 'Screen width in "natural" orientation.', fields: [{ name: "_", unit: "px", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "height", identifier: 386, description: 'Screen height in "natural" orientation.', fields: [{ name: "_", unit: "px", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "rw", name: "width_major", identifier: 129, description: 'If true, consecutive pixels in the "width" direction are sent next to each other (this is typical for graphics cards).\nIf false, consecutive pixels in the "height" direction are sent next to each other.\nFor embedded screen controllers, this is typically true iff `width < height`\n(in other words, it\'s only true for portrait orientation screens).\nSome controllers may allow the user to change this (though the refresh order may not be optimal then).\nThis is independent of the `rotation` register.', fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "rw", name: "up_sampling", identifier: 130, description: "Every pixel sent over wire is represented by `up_sampling x up_sampling` square of physical pixels.\nSome displays may allow changing this (which will also result in changes to `width` and `height`).\nTypical values are 1 and 2.", fields: [{ name: "_", unit: "px", type: "u8", storage: 1, isSimpleType: true }], optional: true, packFormat: "u8" }, { kind: "rw", name: "rotation", identifier: 131, description: "Possible values are 0, 90, 180 and 270 only.\nWrite to this register do not affect `width` and `height` registers,\nand may be ignored by some screens.", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }], tags: ["SPI"] }, { name: "Infrastructure", status: "stable", shortId: "infrastructure", camelName: "infrastructure", shortName: "infrastructure", extends: ["_base"], notes: { short: "A service that tags a device as purely infrastructure device.\n\n\nA Jacdac user interface can hide any device that hosts this service." }, classIdentifier: 504728043, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "LED", status: "stable", shortId: "led", camelName: "led", shortName: "led", extends: ["_base"], notes: { short: "A controller for displays of individually controlled RGB LEDs.\n\nFor 64 or less LEDs, the service should support the pack the pixels in the pixels register.\nBeyond this size, the register should return an empty payload as the amount of data exceeds\nthe size of a packet. Typically services that use more than 64 LEDs\nwill run on the same MCU and will maintain the pixels buffer internally." }, classIdentifier: 369743088, enums: { Variant: { name: "Variant", storage: 1, members: { Strip: 1, Ring: 2, Stick: 3, Jewel: 4, Matrix: 5 } } }, constants: { max_pixels_length: { value: 64, hex: false } }, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "pixels", identifier: 2, description: "A buffer of 24bit RGB color entries for each LED, in R, G, B order.\nWhen writing, if the buffer is too short, the remaining pixels are set to `#000000`;\nIf the buffer is too long, the write may be ignored, or the additional pixels may be ignored.\nIf the number of pixels is greater than `max_pixels_length`, the read should return an empty payload.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], identifierName: "value", packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Set the luminosity of the strip.\nAt `0` the power to the strip is completely shut down.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 0.05 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "ro", name: "actual_brightness", identifier: 384, description: "This is the luminosity actually applied to the strip.\nMay be lower than `brightness` if power-limited by the `max_power` register.\nIt will rise slowly (few seconds) back to `brightness` is limits are no longer required.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], packFormat: "u0.8" }, { kind: "const", name: "num_pixels", identifier: 386, description: "Specifies the number of pixels in the strip.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "num_columns", identifier: 387, description: "If the LED pixel strip is a matrix, specifies the number of columns.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the light-strip (and controller).", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 200 }], optional: true, identifierName: "max_power", packFormat: "u16" }, { kind: "const", name: "leds_per_pixel", identifier: 388, description: "If known, specifies the number of LEDs in parallel on this device.\nThe actual number of LEDs is `num_pixels * leds_per_pixel`.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "const", name: "wave_length", identifier: 389, description: "If monochrome LED, specifies the wave length of the LED.\nRegister is missing for RGB LEDs.", fields: [{ name: "_", unit: "nm", type: "u16", storage: 2, isSimpleType: true, typicalMin: 365, typicalMax: 885 }], optional: true, packFormat: "u16" }, { kind: "const", name: "luminous_intensity", identifier: 390, description: "The luminous intensity of all the LEDs, at full brightness, in micro candella.", fields: [{ name: "_", unit: "mcd", type: "u16", storage: 2, isSimpleType: true, typicalMin: 10, typicalMax: 5e3 }], optional: true, packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the shape of the light strip.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [], group: "Light" }, { name: "LED Single", status: "deprecated", shortId: "ledsingle", camelName: "ledSingle", shortName: "ledSingle", extends: ["_base"], notes: { short: "A controller for 1 or more monochrome or RGB LEDs connected in parallel." }, classIdentifier: 506480888, enums: { Variant: { name: "Variant", storage: 1, members: { ThroughHole: 1, SMD: 2, Power: 3, Bead: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "animate", identifier: 128, description: "This has the same semantics as `set_status_light` in the control service.", fields: [{ name: "to_red", type: "u8", storage: 1, isSimpleType: true }, { name: "to_green", type: "u8", storage: 1, isSimpleType: true }, { name: "to_blue", type: "u8", storage: 1, isSimpleType: true }, { name: "speed", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8 u8 u8 u8" }, { kind: "ro", name: "color", identifier: 384, description: "The current color of the LED.", fields: [{ name: "red", type: "u8", storage: 1, isSimpleType: true }, { name: "green", type: "u8", storage: 1, isSimpleType: true }, { name: "blue", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8 u8 u8" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the light-strip (and controller).", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 100 }], optional: true, identifierName: "max_power", packFormat: "u16" }, { kind: "const", name: "led_count", identifier: 387, description: "If known, specifies the number of LEDs in parallel on this device.", fields: [{ name: "_", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "const", name: "wave_length", identifier: 385, description: "If monochrome LED, specifies the wave length of the LED.", fields: [{ name: "_", unit: "nm", type: "u16", storage: 2, isSimpleType: true, typicalMin: 365, typicalMax: 885 }], optional: true, packFormat: "u16" }, { kind: "const", name: "luminous_intensity", identifier: 386, description: "The luminous intensity of the LED, at full value, in micro candella.", fields: [{ name: "_", unit: "mcd", type: "u16", storage: 2, isSimpleType: true, typicalMin: 10, typicalMax: 5e3 }], optional: true, packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "The physical type of LED.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit", "padauk"], group: "Light" }, { name: "LED Strip", status: "stable", shortId: "ledstrip", camelName: "ledStrip", shortName: "ledStrip", extends: ["_base"], notes: { short: "A controller for strips of individually controlled RGB LEDs.", long: "## Light programs\n\nWith 1 mbit Jacdac, we can transmit under 2k of data per animation frame (at 20fps).\nIf transmitting raw data that would be around 500 pixels, which is not enough for many\ninstallations and it would completely clog the network.\n\nThus, light service defines a domain-specific language for describing light animations\nand efficiently transmitting them over wire. For short LED displays, less than 64 LEDs, \nyou can also use the [LED service](/services/led).\n\nLight commands are not Jacdac commands.\nLight commands are efficiently encoded as sequences of bytes and typically sent as payload\nof `run` command.\n\nDefinitions:\n\n- `P` - position in the strip\n- `R` - number of repetitions of the command\n- `N` - number of pixels affected by the command\n- `C` - single color designation\n- `C+` - sequence of color designations\n\nUpdate modes:\n\n- `0` - replace\n- `1` - add RGB\n- `2` - subtract RGB\n- `3` - multiply RGB (by c/128); each pixel value will change by at least 1\n\nProgram commands:\n\n- `0xD0: setall C+` - set all pixels in current range to given color pattern\n- `0xD1: fade C+` - set pixels in current range to colors between colors in sequence\n- `0xD2: fadehsv C+` - similar to `fade()`, but colors are specified and faded in HSV\n- `0xD3: rotfwd K` - rotate (shift) pixels by `K` positions away from the connector\n- `0xD4: rotback K` - same, but towards the connector\n- `0xD5: show M=50` - send buffer to strip and wait `M` milliseconds\n- `0xD6: range P=0 N=length W=1 S=0` - range from pixel `P`, `N` pixels long (currently unsupported: every `W` pixels skip `S` pixels)\n- `0xD7: mode K=0` - set update mode\n- `0xD8: tmpmode K=0` - set update mode for next command only\n- `0xCF: setone P C` - set one pixel at `P` (in current range) to given color\n- `mult V` - macro to multiply current range by given value (float)\n\nA number `k` is encoded as follows:\n\n- `0 <= k < 128` -> `k`\n- `128 <= k < 16383` -> `0x80 | (k >> 8), k & 0xff`\n- bigger and negative numbers are not supported\n\nThus, bytes `0xC0-0xFF` are free to use for commands.\n\nFormats:\n\n- `0xC1, R, G, B` - single color parameter\n- `0xC2, R0, G0, B0, R1, G1, B1` - two color parameter\n- `0xC3, R0, G0, B0, R1, G1, B1, R2, G2, B2` - three color parameter\n- `0xC0, N, R0, G0, B0, ..., R(N-1), G(N-1), B(N-1)` - `N` color parameter\n- `0xCF, , R, G, B` - `set1` special format\n\nCommands are encoded as command byte, followed by parameters in the order\nfrom the command definition.\n\nThe `setone()` command has irregular encoding to save space - it is byte `0xCF` followed by encoded\nnumber, and followed by 3 bytes of color." }, classIdentifier: 309264608, enums: { LightType: { name: "LightType", storage: 1, members: { WS2812B_GRB: 0, APA102: 16, SK9822: 17 } }, Variant: { name: "Variant", storage: 1, members: { Strip: 1, Ring: 2, Stick: 3, Jewel: 4, Matrix: 5 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "brightness", identifier: 1, description: "Set the luminosity of the strip.\nAt `0` the power to the strip is completely shut down.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 0.05 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "ro", name: "actual_brightness", identifier: 384, description: "This is the luminosity actually applied to the strip.\nMay be lower than `brightness` if power-limited by the `max_power` register.\nIt will rise slowly (few seconds) back to `brightness` is limits are no longer required.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], packFormat: "u0.8" }, { kind: "rw", name: "light_type", identifier: 128, description: "Specifies the type of light strip connected to controller.\nControllers which are sold with lights should default to the correct type\nand could not allow change.", fields: [{ name: "_", type: "LightType", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "num_pixels", identifier: 129, description: "Specifies the number of pixels in the strip.\nControllers which are sold with lights should default to the correct length\nand could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true, defaultValue: 15 }], packFormat: "u16" }, { kind: "rw", name: "num_columns", identifier: 131, description: "If the LED pixel strip is a matrix, specifies the number of columns. Otherwise, a square shape is assumed. Controllers which are sold with lights should default to the correct length\nand could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the light-strip (and controller).", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 200 }], identifierName: "max_power", packFormat: "u16" }, { kind: "const", name: "max_pixels", identifier: 385, description: "The maximum supported number of pixels.\nAll writes to `num_pixels` are clamped to `max_pixels`.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "rw", name: "num_repeats", identifier: 130, description: "How many times to repeat the program passed in `run` command.\nShould be set before the `run` command.\nSetting to `0` means to repeat forever.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true, defaultValue: 1 }], packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the shape of the light strip.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "command", name: "run", identifier: 129, description: 'Run the given light "program". See service description for details.', fields: [{ name: "program", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }], tags: ["C"], group: "Light" }, { name: "Light bulb", status: "rc", shortId: "lightbulb", camelName: "lightBulb", shortName: "lightBulb", extends: ["_base"], notes: { short: "A light bulb controller." }, classIdentifier: 480970060, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "brightness", identifier: 1, description: "Indicates the brightness of the light bulb. Zero means completely off and 0xffff means completely on.\nFor non-dimmable lights, the value should be clamp to 0xffff for any non-zero value.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "intensity", packFormat: "u0.16" }, { kind: "const", name: "dimmable", identifier: 384, description: "Indicates if the light supports dimming.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: [], group: "Light" }, { name: "Light level", status: "stable", shortId: "lightlevel", camelName: "lightLevel", shortName: "lightLevel", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures luminosity level." }, classIdentifier: 400333340, enums: { Variant: { name: "Variant", storage: 1, members: { PhotoResistor: 1, ReverseBiasedLED: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "light_level", identifier: 257, description: "Detect light level", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "ro", name: "light_level_error", identifier: 262, description: "Absolute estimated error of the reading value", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit", "padauk", "input"], group: "Environment" }, { name: "Logger", status: "stable", shortId: "logger", camelName: "logger", shortName: "logger", extends: ["_base"], notes: { short: "A service which can report messages to the bus." }, classIdentifier: 316415946, enums: { Priority: { name: "Priority", storage: 1, members: { Debug: 0, Log: 1, Warning: 2, Error: 3, Silent: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "min_priority", identifier: 128, description: "Messages with level lower than this won't be emitted. The default setting may vary.\nLoggers should revert this to their default setting if the register has not been\nupdated in 3000ms, and also keep the lowest setting they have seen in the last 1500ms.\nThus, clients should write this register every 1000ms and ignore messages which are\ntoo verbose for them.", fields: [{ name: "_", type: "Priority", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "report", name: "debug", identifier: 128, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "report", name: "log", identifier: 129, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "report", name: "warn", identifier: 130, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "report", name: "error", identifier: 131, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }], tags: ["infrastructure", "C"] }, { name: "Magnetic field level", status: "stable", shortId: "magneticfieldlevel", camelName: "magneticFieldLevel", shortName: "magneticFieldLevel", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures strength and polarity of magnetic field." }, classIdentifier: 318642191, enums: { Variant: { name: "Variant", storage: 1, members: { AnalogNS: 1, AnalogN: 2, AnalogS: 3, DigitalNS: 4, DigitalN: 5, DigitalS: 6 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "strength", identifier: 257, description: "Indicates the strength of magnetic field between -1 and 1.\nWhen no magnet is present the value should be around 0.\nFor analog sensors,\nwhen the north pole of the magnet is on top of the module\nand closer than south pole, then the value should be positive.\nFor digital sensors,\nthe value should either `0` or `1`, regardless of polarity.", fields: [{ name: "_", unit: "/", shift: 15, type: "i1.15", storage: -2 }], volatile: true, identifierName: "reading", packFormat: "i1.15" }, { kind: "ro", name: "detected", identifier: 385, description: "Determines if the magnetic field is present.\nIf the event `active` is observed, `detected` is true; if `inactive` is observed, `detected` is false.", fields: [{ name: "_", type: "bool", storage: 1 }], client: true, packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Determines which magnetic poles the sensor can detected,\nand whether or not it can measure their strength or just presence.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "active", identifier: 1, description: "Emitted when strong-enough magnetic field is detected.", fields: [], identifierName: "active" }, { kind: "event", name: "inactive", identifier: 2, description: "Emitted when strong-enough magnetic field is no longer detected.", fields: [], identifierName: "inactive" }], tags: ["8bit", "padauk", "input"], group: "Environment" }, { name: "Magnetometer", status: "rc", shortId: "magnetomer", camelName: "magnetometer", shortName: "magnetometer", extends: ["_base", "_sensor"], notes: { short: "A 3-axis magnetometer." }, classIdentifier: 318935176, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "forces", identifier: 257, description: "Indicates the current magnetic field on magnetometer.\nFor reference: `1 mgauss` is `100 nT` (and `1 gauss` is `100 000 nT`).", fields: [{ name: "x", unit: "nT", type: "i32", storage: -4, isSimpleType: true }, { name: "y", unit: "nT", type: "i32", storage: -4, isSimpleType: true }, { name: "z", unit: "nT", type: "i32", storage: -4, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "i32 i32 i32" }, { kind: "ro", name: "forces_error", identifier: 262, description: "Absolute estimated error on the readings.", fields: [{ name: "_", unit: "nT", type: "i32", storage: -4, isSimpleType: true }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "i32" }, { kind: "command", name: "calibrate", identifier: 2, description: "Forces a calibration sequence where the user/device\nmight have to rotate to be calibrated.", fields: [], identifierName: "calibrate" }], tags: [] }, { name: "Matrix Keypad", status: "experimental", shortId: "matrixkeypad", camelName: "matrixKeypad", shortName: "matrixKeypad", extends: ["_base", "_sensor"], notes: { short: "A matrix of buttons connected as a keypad" }, classIdentifier: 319172040, enums: { Variant: { name: "Variant", storage: 1, members: { Membrane: 1, Keyboard: 2, Elastomer: 3, ElastomerLEDPixel: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "pressed", identifier: 257, description: "The coordinate of the button currently pressed. Keys are zero-indexed from left to right, top to bottom:\n``row = index / columns``, ``column = index % columns``.", fields: [{ name: "index", type: "u8", storage: 1, isSimpleType: true, startRepeats: true }], volatile: true, identifierName: "reading", packFormat: "r: u8" }, { kind: "const", name: "rows", identifier: 384, description: "Number of rows in the matrix", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "columns", identifier: 385, description: "Number of columns in the matrix", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "labels", identifier: 386, description: "The characters printed on the keys if any, in indexing sequence.", fields: [{ name: "label", type: "string0", storage: 0, startRepeats: true }], optional: true, packFormat: "r: z" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical keypad. If the variant is ``ElastomerLEDPixel``\nand the next service on the device is a ``LEDPixel`` service, it is considered\nas the service controlling the LED pixel on the keypad.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "down", identifier: 1, description: "Emitted when a key, at the given index, goes from inactive (`pressed == 0`) to active.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], identifierName: "active", packFormat: "u8" }, { kind: "event", name: "up", identifier: 2, description: "Emitted when a key, at the given index, goes from active (`pressed == 1`) to inactive.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], identifierName: "inactive", packFormat: "u8" }, { kind: "event", name: "click", identifier: 128, description: "Emitted together with `up` when the press time was not longer than 500ms.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "event", name: "long_click", identifier: 129, description: "Emitted together with `up` when the press time was more than 500ms.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }], tags: [], group: "Button" }, { name: "Microphone", status: "experimental", shortId: "microphone", camelName: "microphone", shortName: "microphone", extends: ["_base"], notes: { short: "A single-channel microphone." }, classIdentifier: 289254534, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "sample", identifier: 129, description: "The samples will be streamed back over the `samples` pipe.\nIf `num_samples` is `0`, streaming will only stop when the pipe is closed.\nOtherwise the specified number of samples is streamed.\nSamples are sent as `i16`.", fields: [{ name: "samples", type: "pipe", storage: 12 }, { name: "num_samples", type: "u32", storage: 4, isSimpleType: true }], pipeType: "sample", packFormat: "b[12] u32" }, { kind: "rw", name: "sampling_period", identifier: 128, description: "Get or set microphone sampling period.\nSampling rate is `1_000_000 / sampling_period Hz`.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: [], group: "Sound" }, { name: "MIDI output", status: "experimental", shortId: "midioutput", camelName: "midiOutput", shortName: "midiOutput", extends: ["_base"], notes: { short: "A MIDI output device." }, classIdentifier: 444894423, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Opens or closes the port to the MIDI device", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "command", name: "clear", identifier: 128, description: "Clears any pending send data that has not yet been sent from the MIDIOutput's queue.", fields: [] }, { kind: "command", name: "send", identifier: 129, description: "Enqueues the message to be sent to the corresponding MIDI port", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }], tags: [], group: "Sound" }, { name: "Model Runner", status: "experimental", shortId: "modelrunner", camelName: "modelRunner", shortName: "modelRunner", extends: ["_base"], notes: { short: "Runs machine learning models.\n\nOnly models with a single input tensor and a single output tensor are supported at the moment.\nInput is provided by Sensor Aggregator service on the same device.\nMultiple instances of this service may be present, if more than one model format is supported by a device." }, classIdentifier: 336566904, enums: { ModelFormat: { name: "ModelFormat", storage: 4, members: { TFLite: 860636756, ML4F: 809963362, EdgeImpulseCompiled: 810961221 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "set_model", identifier: 128, description: "Open pipe for streaming in the model. The size of the model has to be declared upfront.\nThe model is streamed over regular pipe data packets.\nThe format supported by this instance of the service is specified in `format` register.\nWhen the pipe is closed, the model is written all into flash, and the device running the service may reset.", fields: [{ name: "model_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }], unique: true, hasReport: true, packFormat: "u32" }, { kind: "report", name: "set_model", identifier: 128, description: "Open pipe for streaming in the model. The size of the model has to be declared upfront.\nThe model is streamed over regular pipe data packets.\nThe format supported by this instance of the service is specified in `format` register.\nWhen the pipe is closed, the model is written all into flash, and the device running the service may reset.", fields: [{ name: "model_port", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "set_model", packFormat: "u16" }, { kind: "command", name: "predict", identifier: 129, description: "Open channel that can be used to manually invoke the model. When enough data is sent over the `inputs` pipe, the model is invoked,\nand results are send over the `outputs` pipe.", fields: [{ name: "outputs", type: "pipe", storage: 12 }], pipeType: "predict", hasReport: true, packFormat: "b[12]" }, { kind: "report", name: "predict", identifier: 129, description: "Open channel that can be used to manually invoke the model. When enough data is sent over the `inputs` pipe, the model is invoked,\nand results are send over the `outputs` pipe.", fields: [{ name: "inputs", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "predict", packFormat: "u16" }, { kind: "rw", name: "auto_invoke_every", identifier: 128, description: "When register contains `N > 0`, run the model automatically every time new `N` samples are collected.\nModel may be run less often if it takes longer to run than `N * sampling_interval`.\nThe `outputs` register will stream its value after each run.\nThis register is not stored in flash.", fields: [{ name: "_", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "ro", name: "outputs", identifier: 257, description: "Results of last model invocation as `float32` array.", fields: [{ name: "output", isFloat: true, type: "f32", storage: 4, startRepeats: true }], volatile: true, identifierName: "reading", packFormat: "r: f32" }, { kind: "ro", name: "input_shape", identifier: 384, description: "The shape of the input tensor.", fields: [{ name: "dimension", type: "u16", storage: 2, isSimpleType: true, startRepeats: true }], packFormat: "r: u16" }, { kind: "ro", name: "output_shape", identifier: 385, description: "The shape of the output tensor.", fields: [{ name: "dimension", type: "u16", storage: 2, isSimpleType: true, startRepeats: true }], packFormat: "r: u16" }, { kind: "ro", name: "last_run_time", identifier: 386, description: "The time consumed in last model execution.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "allocated_arena_size", identifier: 387, description: "Number of RAM bytes allocated for model execution.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "model_size", identifier: 388, description: "The size of the model in bytes.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "last_error", identifier: 389, description: "Textual description of last error when running or loading model (if any).", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "const", name: "format", identifier: 390, description: "The type of ML models supported by this service.\n`TFLite` is flatbuffer `.tflite` file.\n`ML4F` is compiled machine code model for Cortex-M4F.\nThe format is typically present as first or second little endian word of model file.", fields: [{ name: "_", type: "ModelFormat", storage: 4 }], packFormat: "u32" }, { kind: "const", name: "format_version", identifier: 391, description: "A version number for the format.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "parallel", identifier: 392, description: "If present and true this service can run models independently of other\ninstances of this service on the device.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: [] }, { name: "Motion", status: "experimental", shortId: "motion", camelName: "motion", shortName: "motion", extends: ["_base", "_sensor"], notes: { short: "A sensor, typically PIR, that detects object motion within a certain range" }, classIdentifier: 293185353, enums: { Variant: { name: "Variant", storage: 1, members: { PIR: 1 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "moving", identifier: 257, description: "Reports is movement is currently detected by the sensor.", fields: [{ name: "_", type: "bool", storage: 1 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u8" }, { kind: "const", name: "max_distance", identifier: 384, description: "Maximum distance where objects can be detected.", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "angle", identifier: 385, description: "Opening of the field of view", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Type of physical sensor", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "movement", identifier: 1, description: "A movement was detected.", fields: [], identifierName: "active" }], tags: ["8bit"], group: "Movement" }, { name: "Motor", status: "rc", shortId: "motor", camelName: "motor", shortName: "motor", extends: ["_base"], notes: { short: "A DC motor." }, classIdentifier: 385895640, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "speed", identifier: 2, description: "Relative speed of the motor. Use positive/negative values to run the motor forwards and backwards.\nPositive is recommended to be clockwise rotation and negative counterclockwise. A speed of ``0`` \nwhile ``enabled`` acts as brake.", fields: [{ name: "_", unit: "/", shift: 15, type: "i1.15", storage: -2 }], identifierName: "value", packFormat: "i1.15" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn the power to the motor on/off.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "load_torque", identifier: 384, description: "Torque required to produce the rated power of an electrical motor at load speed.", fields: [{ name: "_", unit: "kg/cm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "load_rotation_speed", identifier: 385, description: "Revolutions per minute of the motor under full load.", fields: [{ name: "_", unit: "rpm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "reversible", identifier: 386, description: "Indicates if the motor can run backwards.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: ["C", "8bit"] }, { name: "Multitouch", status: "experimental", shortId: "multitouch", camelName: "multitouch", shortName: "multitouch", extends: ["_base", "_sensor"], notes: { short: "A capacitive touch sensor with multiple inputs.", events: "Most events include the channel number of the input." }, classIdentifier: 487664309, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "capacity", identifier: 257, description: "Capacitance of channels. The capacitance is continuously calibrated, and a value of `0` indicates\nno touch, wheres a value of around `100` or more indicates touch.\nIt's best to ignore this (unless debugging), and use events.\n\nDigital sensors will use `0` or `0xffff` on each channel.", fields: [{ name: "capacitance", type: "i16", storage: -2, isSimpleType: true, startRepeats: true }], volatile: true, identifierName: "reading", packFormat: "r: i16" }, { kind: "event", name: "touch", identifier: 1, description: "Emitted when an input is touched.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], identifierName: "active", packFormat: "u8" }, { kind: "event", name: "release", identifier: 2, description: "Emitted when an input is no longer touched.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], identifierName: "inactive", packFormat: "u8" }, { kind: "event", name: "tap", identifier: 128, description: "Emitted when an input is briefly touched. TODO Not implemented.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "event", name: "long_press", identifier: 129, description: "Emitted when an input is touched for longer than 500ms. TODO Not implemented.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "event", name: "swipe_pos", identifier: 144, description: "Emitted when input channels are successively touched in order of increasing channel numbers.", fields: [{ name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }, { name: "start_channel", type: "u8", storage: 1, isSimpleType: true }, { name: "end_channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u16 u8 u8" }, { kind: "event", name: "swipe_neg", identifier: 145, description: "Emitted when input channels are successively touched in order of decreasing channel numbers.", fields: [{ name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }, { name: "start_channel", type: "u8", storage: 1, isSimpleType: true }, { name: "end_channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u16 u8 u8" }], tags: [], group: "Button" }, { name: "Planar position", status: "experimental", shortId: "planarposition", camelName: "planarPosition", shortName: "planarPosition", extends: ["_base", "_sensor"], notes: { short: "A sensor that repors 2D position, typically an optical mouse tracking sensor.\n\nThe sensor starts at an arbitrary origin (0,0) and reports the distance from that origin.\n\nThe `streaming_interval` is respected when the position is changing. When the position is not changing, the streaming interval may be throttled to `500ms`." }, classIdentifier: 499351381, enums: { Variant: { name: "Variant", storage: 1, members: { OpticalMousePosition: 1 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: "The current position of the sensor.", fields: [{ name: "x", unit: "mm", shift: 10, type: "i22.10", storage: -4 }, { name: "y", unit: "mm", shift: 10, type: "i22.10", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i22.10 i22.10" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [], group: "Movement" }, { name: "Potentiometer", status: "stable", shortId: "potentiometer", camelName: "potentiometer", shortName: "potentiometer", extends: ["_base", "_sensor"], notes: { short: "A slider or rotary potentiometer." }, classIdentifier: 522667846, enums: { Variant: { name: "Variant", storage: 1, members: { Slider: 1, Rotary: 2, Hall: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: "The relative position of the slider.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the physical layout of the potentiometer.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["C", "8bit", "input"], group: "Slider" }, { name: "Power", status: "experimental", shortId: "power", camelName: "power", shortName: "power", extends: ["_base"], notes: { short: "A power-provider service.", long: "## Power negotiation protocol\n\nThe purpose of the power negotiation is to ensure that there is no more than [Iout_hc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) delivered to the power rail.\nThis is realized by limiting the number of enabled power provider services to one.\n\nNote, that it's also possible to have low-current power providers,\nwhich are limited to [Iout_lc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) and do not run a power provider service.\nThese are **not** accounted for in the power negotiation protocol.\n\nPower providers can have multiple _channels_, typically multiple Jacdac ports on the provider.\nEach channel can be limited to [Iout_hc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) separately.\nIn normal operation, the data lines of each channels are connected together.\nThe ground lines are always connected together.\nMulti-channel power providers are also called _powered hubs_.\n\nWhile channels have separate current limits, there's nothing to prevent the user\nfrom joining two or more channels outside of the provider using a passive hub.\nThis would allow more than [Iout_hc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) of current to be drawn, resulting in cables or components\ngetting hot and/or malfunctioning.\nThus, the power negotiation protocol seeks to detect situations where\nmultiple channels of power provider(s) are bridged together\nand shut down all but one of the channels involved.\n\nThe protocol is built around the power providers periodically sending specially crafted\n`shutdown` commands in broadcast mode.\nNote that this is unusual - services typically only send reports.\n\nThe `shutdown` commands can be reliably identified based on their first half (more details below).\nWhen a power provider starts receiving a `shutdown` command, it needs to take\nsteps to identify which of its channels the command is coming from.\nThis is typically realized with analog switches between the data lines of channels.\nThe delivery of power over the channel which received the `shutdown` command is then shut down.\nNote that in the case of a single-channel provider, any received `shutdown` command will cause a shut down.\n\nA multi-channel provider needs to also identify when a `shutdown` command it sent from one channel\nis received on any of its other channels and shut down one of the channels involved.\n\nIt is also possible to build a _data bridge_ device, with two or more ports.\nIt passes through all data except for `shutdown` commands,\nbut **does not** connect the power lines.\n\n### Protocol details\n\nThe `shutdown` commands follow a very narrow format:\n* they need to be the only packet in the frame (and thus we can also call them `shutdown` frames)\n* the second word of `device_id` needs to be set to `0xAA_AA_AA_AA` (alternating 0 and 1)\n* the service index is set to `0x3d`\n* the CRC is therefore fixed\n* therefore, the packet can be recognized by reading the first 8 bytes (total length is 16 bytes)\n\nThe exact byte structure of `shutdown` command is:\n`15 59 04 05 5A C9 A4 1F AA AA AA AA 00 3D 80 00`\n\nThere is one power service per channel.\nA multi-channel power provider can be implemented as one device with multiple services (typically with one MCU),\nor many devices with one service each (typically multiple MCUs).\nThe first option is preferred as it fixes the order of channels,\nbut the second option may be cheaper to implement.\n\nAfter queuing a `shutdown` command, the service enters a grace period\nuntil the report has been sent on the wire.\nDuring the grace period incoming `shutdown` commands are ignored.\n\n* Upon reset, a power service enables itself, and then only after 0-300ms (random)\n sends the first `shutdown` command\n* Every enabled power service emits `shutdown` commands every 400-600ms (random; first few packets can be even sent more often)\n* If an enabled power service sees a `shutdown` command from somebody else,\n it disables itself (unless in grace period)\n* If a disabled power service sees no `shutdown` command for more than ~1200ms, it enables itself\n (this is when the previous power source is unplugged or otherwise malfunctions)\n* If a power service has been disabled for around 10s, it enables itself.\n\nAdditionally:\n* While the `allowed` register is set to `0`, the service will not enable itself (nor send `shutdown` commands)\n* When a current overdraw is detected, the service stop providing power and enters `Overload` state for around 2 seconds,\n while still sending `shutdown` commands.\n\n### Client notes\n\nIf a client hears a `shutdown` command it just means it's on a branch of the\nnetwork with a (high) power provider.\nAs clients (brains) typically do not consume much current (as opposed to, say, servos),\nthe `shutdown` commands are typically irrelevant to them.\n\nFor power monitoring, the `power_status_changed` event (and possibly `power_status` register)\ncan be used.\nIn particular, user interfaces may alert the user to `Overload` status.\nThe `Overprovision` status is generally considered normal (eg. when two multi-channel power providers are linked together).\n\n### Server implementation notes\n\n#### A dedicated MCU per channel\n\nEvery channel has:\n* a cheap 8-bit MCU (e.g. PMS150C, PFS122),\n* a current limiter with FAULT output and ENABLE input, and\n* an analog switch.\n\nThe MCU here needs at least 4 pins per channel.\nIt is connected to data line of the channel, the control input of the switch, and to the current limiter's FAULT and ENABLE pins.\n\nThe switch connects the data line of the channel (JD_DATA_CHx) with the internal shared data bus, common to all channels (JD_DATA_COM).\nBoth the switch and the limiter are controlled by the MCU.\nA latching circuit is not needed for the limiter because the MCU will detect an overcurrent fault and shut it down immediately. \n\nDuring reception, after the beginning of `shutdown` frame is detected,\nthe switch is opened for a brief period.\nIf the `shutdown` frame is received correctly, it means it was on MCU's channel.\n\nIn the case of only one power delivery channel that's controlled by a dedicated MCU, the analog switch is not necessary. \n\n#### A shared MCU for multiple channels\n\nEvery channel has:\n* a current limiter with FAULT output and ENABLE input, \n* an analog switch, and\n* a wiggle-detection line connecting the MCU to data line of the channel\n\nThe MCU again needs at least 4 pins per channel.\nSwitches and limiters are set up like in the configuration above.\nThe Jacdac data line of the MCU is connected to internal data bus.\n\nWhile a Jacdac packet is being received, the MCU keeps checking if it is a \nbeginning of the `shutdown` frame.\nIf that is the case, it opens all switches and checks which one(s) of the channel\ndata lines wiggle (via the wiggle lines; this can be done with EXTI latches).\nThe one(s) that wiggle received the `shutdown` frame and need to be disabled.\n\nAlso, while sending the `shutdown` frames itself, it needs to be done separately\nfor each channel, with all the other switches open.\nIf during that operation we detect wiggle on other channels, then we have detected\na loop, and the respective channels needs to be disabled.\n\n#### A brain-integrated power supply\n\nHere, there's only one channel of power and we don't have hard real time requirements,\nso user-programmable brain can control it.\nThere is no need for analog switch or wiggle-detection line,\nbut a current limiter with a latching circuit is needed.\n\nThere is nothing special to do during reception of `shutdown` packet.\nWhen it is received, the current limiter should just be disabled.\n\nIdeally, exception/hard-fault handlers on the MCU should also disable the current limiter.\nSimilarly, the limiter should be disabled while the MCU is in bootloader mode,\nor otherwise unaware of the power negotiation protocol. \n\n### Rationale for the grace period\n\nConsider the following scenario:\n\n* device A queues `shutdown` command for sending\n* A receives external `shutdown` packet from B (thus disabling A)\n* the A `shutdown` command is sent from the queue (thus eventually disabling B)\n\nTo avoid that, we make sure that at the precise instant when `shutdown` command is sent,\nthe power is enabled (and thus will stay enabled until another `shutdown` command arrives).\nThis could be achieved by inspecting the enable bit, aftering acquiring the line\nand before starting UART transmission, however that would require breaking abstraction layers.\nSo instead, we never disable the service, while the `shutdown` packet is queued.\nThis may lead to delays in disabling power services, but these should be limited due to the\nrandom nature of the `shutdown` packet spacing.\n\n### Rationale for timings\n\nThe initial 0-300ms delay is set to spread out the `shutdown` periods of power services,\nto minimize collisions.\nThe `shutdown` periods are randomized 400-600ms, instead of a fixed 500ms used for regular\nservices, for the same reason.\n\nThe 1200ms period is set so that droping two `shutdown` packets in a row\nfrom the current provider will not cause power switch, while missing 3 will.\n\nThe 50-60s power switch period is arbitrary, but chosen to limit amount of switching between supplies,\nwhile keeping it short enough for user to notice any problems such switching may cause." }, classIdentifier: 530893146, enums: { PowerStatus: { name: "PowerStatus", storage: 1, members: { Disallowed: 0, Powering: 1, Overload: 2, Overprovision: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "allowed", identifier: 1, description: "Can be used to completely disable the service.\nWhen allowed, the service may still not be providing power, see \n`power_status` for the actual current state.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power provided by the service. The actual maximum limit will depend on hardware.\nThis field may be read-only in some implementations - you should read it back after setting.", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 900, typicalMax: 900, typicalMin: 0 }], optional: true, identifierName: "max_power", packFormat: "u16" }, { kind: "ro", name: "power_status", identifier: 385, description: "Indicates whether the power provider is currently providing power (`Powering` state), and if not, why not.\n`Overprovision` means there was another power provider, and we stopped not to overprovision the bus.", fields: [{ name: "_", type: "PowerStatus", storage: 1 }], volatile: true, packFormat: "u8" }, { kind: "ro", name: "current_draw", identifier: 257, description: "Present current draw from the bus.", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true }], volatile: true, optional: true, identifierName: "reading", packFormat: "u16" }, { kind: "ro", name: "battery_voltage", identifier: 384, description: "Voltage on input.", fields: [{ name: "_", unit: "mV", type: "u16", storage: 2, isSimpleType: true, typicalMin: 4500, typicalMax: 5500 }], volatile: true, optional: true, packFormat: "u16" }, { kind: "ro", name: "battery_charge", identifier: 386, description: "Fraction of charge in the battery.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, packFormat: "u0.16" }, { kind: "const", name: "battery_capacity", identifier: 387, description: "Energy that can be delivered to the bus when battery is fully charged.\nThis excludes conversion overheads if any.", fields: [{ name: "_", unit: "mWh", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }, { kind: "rw", name: "keep_on_pulse_duration", identifier: 128, description: "Many USB power packs need current to be drawn from time to time to prevent shutdown.\nThis regulates how often and for how long such current is drawn.\nTypically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%.", fields: [{ name: "_", unit: "ms", type: "u16", storage: 2, isSimpleType: true, defaultValue: 600 }], optional: true, packFormat: "u16" }, { kind: "rw", name: "keep_on_pulse_period", identifier: 129, description: "Many USB power packs need current to be drawn from time to time to prevent shutdown.\nThis regulates how often and for how long such current is drawn.\nTypically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%.", fields: [{ name: "_", unit: "ms", type: "u16", storage: 2, isSimpleType: true, defaultValue: 2e4 }], optional: true, packFormat: "u16" }, { kind: "command", name: "shutdown", identifier: 128, description: "Sent by the power service periodically, as broadcast.", fields: [] }, { kind: "event", name: "power_status_changed", identifier: 3, description: "Emitted whenever `power_status` changes.", fields: [{ name: "power_status", type: "PowerStatus", storage: 1 }], identifierName: "change", packFormat: "u8" }], tags: [] }, { name: "Power supply", status: "experimental", shortId: "powersupply", camelName: "powerSupply", shortName: "powerSupply", extends: ["_base"], notes: { short: "A power supply with a fixed or variable voltage range" }, classIdentifier: 524302175, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns the power supply on with `true`, off with `false`.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "output_voltage", identifier: 2, description: "The current output voltage of the power supply. Values provided must be in the range `minimum_voltage` to `maximum_voltage`", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], identifierName: "value", packFormat: "f64" }, { kind: "const", name: "minimum_voltage", identifier: 272, description: "The minimum output voltage of the power supply. For fixed power supplies, `minimum_voltage` should be equal to `maximum_voltage`.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], identifierName: "min_value", packFormat: "f64" }, { kind: "const", name: "maximum_voltage", identifier: 273, description: "The maximum output voltage of the power supply. For fixed power supplies, `minimum_voltage` should be equal to `maximum_voltage`.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], identifierName: "max_value", packFormat: "f64" }], tags: [] }, { name: "Pressure Button", status: "rc", shortId: "pressurebutton", camelName: "pressureButton", shortName: "pressureButton", extends: ["_base"], notes: { short: "A pressure sensitive push-button." }, classIdentifier: 672612547, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "threshold", identifier: 6, description: "Indicates the threshold for ``up`` events.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "active_threshold", packFormat: "u0.16" }], tags: ["8bit"], group: "Button" }, { name: "Protocol Test", status: "experimental", shortId: "prototest", camelName: "protoTest", shortName: "protoTest", extends: ["_base"], notes: { short: "This is test service to validate the protocol packet transmissions between the browser and a MCU.\nUse this page if you are porting Jacdac to a new platform.", long: "### Test procedure\n\nFor each ``rw`` registers, set a random value ``x``\n * read ``rw`` and check value is equal to ``x``\n * read ``ro`` and check value is equal to ``x``\n * listen to ``e`` event and check that data is equal to ``x``\n * call ``c`` command with new random value ``y``\n * read ``rw`` and check value is equal to ``y``\n * do all the above steps with acks\n\nFor each ``rw`` registers, there shall also\nbe an ``event`` and a ``command``. The event\nshould get raised when the value changes;\nand the command should set the value.", registers: "Every ``rw`` register has a corresponding ``ro`` regisrer\nand a corresponding ``set_...`` command to also set the value." }, classIdentifier: 382158442, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "rw_bool", identifier: 129, description: "A read write bool register.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "ro_bool", identifier: 385, description: "A read only bool register. Mirrors rw_bool.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "rw_u32", identifier: 130, description: "A read write u32 register.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "ro_u32", identifier: 386, description: "A read only u32 register.. Mirrors rw_u32.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "rw_i32", identifier: 131, description: "A read write i32 register.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "ro", name: "ro_i32", identifier: 387, description: "A read only i32 register.. Mirrors rw_i32.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "rw", name: "rw_string", identifier: 132, description: "A read write string register.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "ro_string", identifier: 388, description: "A read only string register. Mirrors rw_string.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "rw", name: "rw_bytes", identifier: 133, description: "A read write string register.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "ro", name: "ro_bytes", identifier: 389, description: "A read only string register. Mirrors ro_bytes.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "rw", name: "rw_i8_u8_u16_i32", identifier: 134, description: "A read write i8, u8, u16, i32 register.", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "ro", name: "ro_i8_u8_u16_i32", identifier: 390, description: "A read only i8, u8, u16, i32 register.. Mirrors rw_i8_u8_u16_i32.", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "rw", name: "rw_u8_string", identifier: 135, description: "A read write u8, string register.", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "ro", name: "ro_u8_string", identifier: 391, description: "A read only u8, string register.. Mirrors rw_u8_string.", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "event", name: "e_bool", identifier: 129, description: "An event raised when rw_bool is modified", fields: [{ name: "bo", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "event", name: "e_u32", identifier: 130, description: "An event raised when rw_u32 is modified", fields: [{ name: "u32", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "event", name: "e_i32", identifier: 131, description: "An event raised when rw_i32 is modified", fields: [{ name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "event", name: "e_string", identifier: 132, description: "An event raised when rw_string is modified", fields: [{ name: "str", type: "string", storage: 0 }], packFormat: "s" }, { kind: "event", name: "e_bytes", identifier: 133, description: "An event raised when rw_bytes is modified", fields: [{ name: "bytes", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "event", name: "e_i8_u8_u16_i32", identifier: 134, description: "An event raised when rw_i8_u8_u16_i32 is modified", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "event", name: "e_u8_string", identifier: 135, description: "An event raised when rw_u8_string is modified", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "command", name: "c_bool", identifier: 129, description: "A command to set rw_bool.", fields: [{ name: "bo", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "command", name: "c_u32", identifier: 130, description: "A command to set rw_u32.", fields: [{ name: "u32", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "command", name: "c_i32", identifier: 131, description: "A command to set rw_i32.", fields: [{ name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "command", name: "c_string", identifier: 132, description: "A command to set rw_string.", fields: [{ name: "str", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "c_bytes", identifier: 133, description: "A command to set rw_string.", fields: [{ name: "bytes", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "command", name: "c_i8_u8_u16_i32", identifier: 134, description: "A command to set rw_bytes.", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "command", name: "c_u8_string", identifier: 135, description: "A command to set rw_u8_string.", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "command", name: "c_report_pipe", identifier: 144, description: "A command to read the content of rw_bytes, byte per byte, as a pipe.", fields: [{ name: "p_bytes", type: "pipe", storage: 12 }], pipeType: "c_report_pipe", packFormat: "b[12]" }, { kind: "pipe_report", name: "p_bytes", identifier: 0, description: "A command to read the content of rw_bytes, byte per byte, as a pipe.", fields: [{ name: "byte", type: "u8", storage: 1, isSimpleType: true }], pipeType: "c_report_pipe", packFormat: "u8" }], tags: ["infrastructure"] }, { name: "Proxy", status: "stable", shortId: "proxy", camelName: "proxy", shortName: "proxy", extends: ["_base"], notes: { short: "A service that tags a device as a packet proxy.\nA device in proxy mode will proxy Jacdac packets and typically has its core logic halted." }, classIdentifier: 384932169, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "Pulse Oximeter", status: "experimental", shortId: "pulseoximeter", camelName: "pulseOximeter", shortName: "pulseOximeter", extends: ["_base", "_sensor"], notes: { short: "A sensor approximating the oxygen level.\n\n**Jacdac is not suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.**" }, classIdentifier: 280710838, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "oxygen", identifier: 257, description: "The estimated oxygen level in blood.", fields: [{ name: "_", unit: "%", shift: 8, type: "u8.8", storage: 2, typicalMin: 80, typicalMax: 100 }], volatile: true, identifierName: "reading", packFormat: "u8.8" }, { kind: "ro", name: "oxygen_error", identifier: 262, description: "The estimated error on the reported sensor data.", fields: [{ name: "_", unit: "%", shift: 8, type: "u8.8", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u8.8" }], tags: ["8bit"], group: "Biometric" }, { name: "Rain gauge", status: "rc", shortId: "raingauge", camelName: "rainGauge", shortName: "rainGauge", extends: ["_base", "_sensor"], notes: { short: "Measures the amount of liquid precipitation over an area in a predefined period of time." }, classIdentifier: 326323349, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "precipitation", identifier: 257, description: "Total precipitation recorded so far.", fields: [{ name: "_", unit: "mm", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", preferredInterval: 6e4, packFormat: "u16.16" }, { kind: "const", name: "precipitation_precision", identifier: 264, description: "Typically the amount of rain needed for tipping the bucket.", fields: [{ name: "_", unit: "mm", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "reading_resolution", packFormat: "u16.16" }], tags: ["8bit"], group: "Environment" }, { name: "Real time clock", status: "rc", shortId: "realtimeclock", camelName: "realTimeClock", shortName: "realTimeClock", extends: ["_base", "_sensor"], notes: { short: "Real time clock to support collecting data with precise time stamps." }, classIdentifier: 445323816, enums: { Variant: { name: "Variant", storage: 1, members: { Computer: 1, Crystal: 2, Cuckoo: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "local_time", identifier: 257, description: "Current time in 24h representation.\n\n- `day_of_month` is day of the month, starting at `1`\n- `day_of_week` is day of the week, starting at `1` as monday. Default streaming period is 1 second.", fields: [{ name: "year", type: "u16", storage: 2, isSimpleType: true }, { name: "month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 12 }, { name: "day_of_month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 31 }, { name: "day_of_week", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 7 }, { name: "hour", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 23 }, { name: "min", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 59 }, { name: "sec", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 60 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16 u8 u8 u8 u8 u8 u8" }, { kind: "ro", name: "drift", identifier: 384, description: "Time drift since the last call to the `set_time` command.", fields: [{ name: "_", unit: "s", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, packFormat: "u16.16" }, { kind: "const", name: "precision", identifier: 385, description: "Error on the clock, in parts per million of seconds.", fields: [{ name: "_", unit: "ppm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical clock used by the sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "command", name: "set_time", identifier: 128, description: "Sets the current time and resets the error.", fields: [{ name: "year", type: "u16", storage: 2, isSimpleType: true }, { name: "month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 12 }, { name: "day_of_month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 31 }, { name: "day_of_week", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 7 }, { name: "hour", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 23 }, { name: "min", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 59 }, { name: "sec", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 60 }], packFormat: "u16 u8 u8 u8 u8 u8 u8" }], tags: ["8bit"] }, { name: "Reflected light", status: "rc", shortId: "reflectedlight", camelName: "reflectedLight", shortName: "reflectedLight", extends: ["_base", "_sensor"], notes: { short: "A sensor that detects light and dark surfaces, commonly used for line following robots." }, classIdentifier: 309087410, enums: { Variant: { name: "Variant", storage: 1, members: { InfraredDigital: 1, InfraredAnalog: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "brightness", identifier: 257, description: "Reports the reflected brightness. It may be a digital value or, for some sensor, analog value.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Type of physical sensor used", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Relay", status: "stable", shortId: "relay", camelName: "relay", shortName: "relay", extends: ["_base"], notes: { short: "A switching relay.\n\nThe contacts should be labelled `NO` (normally open), `COM` (common), and `NC` (normally closed).\nWhen relay is energized it connects `NO` and `COM`.\nWhen relay is not energized it connects `NC` and `COM`.\nSome relays may be missing `NO` or `NC` contacts.\nWhen relay module is not powered, or is in bootloader mode, it is not energized (connects `NC` and `COM`)." }, classIdentifier: 406840918, enums: { Variant: { name: "Variant", storage: 1, members: { Electromechanical: 1, SolidState: 2, Reed: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "active", identifier: 1, description: "Indicates whether the relay circuit is currently energized or not.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of relay used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "const", name: "max_switching_current", identifier: 384, description: "Maximum switching current for a resistive load.", fields: [{ name: "_", unit: "mA", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }], tags: ["8bit"] }, { name: "Random Number Generator", status: "rc", shortId: "rng", camelName: "rng", shortName: "rng", extends: ["_base"], notes: { short: "Generates random numbers using entropy sourced from physical processes.\n\nThis typically uses a cryptographical pseudo-random number generator (for example [Fortuna]()),\nwhich is periodically re-seeded with entropy coming from some hardware source." }, classIdentifier: 394916002, enums: { Variant: { name: "Variant", storage: 1, members: { Quantum: 1, ADCNoise: 2, WebCrypto: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "random", identifier: 384, description: "A register that returns a 64 bytes random buffer on every request.\nThis never blocks for a long time. If you need additional random bytes, keep querying the register.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, packFormat: "b" }, { kind: "const", name: "variant", identifier: 263, description: "The type of algorithm/technique used to generate the number.\n`Quantum` refers to dedicated hardware device generating random noise due to quantum effects.\n`ADCNoise` is the noise from quick readings of analog-digital converter, which reads temperature of the MCU or some floating pin.\n`WebCrypto` refers is used in simulators, where the source of randomness comes from an advanced operating system.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [] }, { name: "Role Manager", status: "experimental", shortId: "rolemanager", camelName: "roleManager", shortName: "roleManager", extends: ["_base"], notes: { short: "Assign roles to services on the Jacdac bus.", long: "## Role allocation\n\nInternally, the role manager stores a mapping from role name to `(device_id, service_idx)`.\nUsers refer to services by using role names (eg., they instantiate an accelerometer client with a given role name).\nEach client has a role, and roles are unique to clients\n(ie., one should not have both a gyro and accelerometer service with role `left_leg`).\n\nThe simplest recommended automatic role assignment algorithm is as follows:\n\n```text\nroles.sort(strcmp() on UTF-8 representation of role name)\ndevices.sort(by device identifier (lexicographic on 8 byte string))\nmove self device to beginning of devices list\nfor every role\n if role is not assigned\n for every device\n for every service on device\n if serviceClass matches role\n if service is not assigned to any role\n assign service to role\n```\n\nDue to sorting, role names sharing a prefix will tend to be co-located on the single device.\nFor example, one can have roles `left_leg_acc`, `left_leg_gyro`, `right_leg_acc`, `right_leg_gyro`,\nand assuming combined gyro+accelerometer sensors, the pairs will tend to be allocated to a single leg,\nhowever the legs may be reversed.\nIn such a case the user can swap the physical sensors (note that left leg will always be assigned to\nsensor with smaller device identifier).\nAlternatively, the user can manually modify assignment using `set_role` command." }, classIdentifier: 508264038, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "auto_bind", identifier: 128, description: 'Normally, if some roles are unfilled, and there are idle services that can fulfill them,\nthe brain device will assign roles (bind) automatically.\nSuch automatic assignment happens every second or so, and is trying to be smart about\nco-locating roles that share "host" (part before first slash),\nas well as reasonably stable assignments.\nOnce user start assigning roles manually using this service, auto-binding should be disabled to avoid confusion.', fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "ro", name: "all_roles_allocated", identifier: 385, description: "Indicates if all required roles have been allocated to devices.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "command", name: "set_role", identifier: 129, description: "Set role. Can set to empty to remove role binding.", fields: [{ name: "device_id", type: "devid", storage: 8 }, { name: "service_idx", type: "u8", storage: 1, isSimpleType: true }, { name: "role", type: "string", storage: 0 }], packFormat: "b[8] u8 s" }, { kind: "command", name: "clear_all_roles", identifier: 132, description: "Remove all role bindings.", fields: [] }, { kind: "command", name: "list_roles", identifier: 131, description: "List all roles and bindings required by the current program. `device_id` and `service_idx` are `0` if role is unbound.", fields: [{ name: "roles", type: "pipe", storage: 12 }], pipeType: "list_roles", packFormat: "b[12]" }, { kind: "pipe_report", name: "roles", identifier: 0, description: "List all roles and bindings required by the current program. `device_id` and `service_idx` are `0` if role is unbound.", fields: [{ name: "device_id", type: "devid", storage: 8 }, { name: "service_class", type: "u32", storage: 4, isSimpleType: true }, { name: "service_idx", type: "u8", storage: 1, isSimpleType: true }, { name: "role", type: "string", storage: 0 }], pipeType: "list_roles", packFormat: "b[8] u32 u8 s" }, { kind: "event", name: "change", identifier: 3, description: "Notifies that role bindings have changed.", fields: [], identifierName: "change" }], tags: ["infrastructure"] }, { name: "ROS", status: "experimental", shortId: "ros", camelName: "ros", shortName: "ros", extends: ["_base"], notes: { short: "A ROS (Robot Operating System https://www.ros.org/) controller that can act as a broker for messages." }, classIdentifier: 354743340, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "publish_message", identifier: 129, description: "Publishes a JSON-encoded message to the given topic.", fields: [{ name: "node", type: "string0", storage: 0 }, { name: "topic", type: "string0", storage: 0 }, { name: "message", type: "string", storage: 0 }], packFormat: "z z s" }, { kind: "command", name: "subscribe_message", identifier: 130, description: "Subscribes to a message topic. Subscribed topics will emit message reports.", fields: [{ name: "node", type: "string0", storage: 0 }, { name: "topic", type: "string", storage: 0 }], packFormat: "z s" }, { kind: "report", name: "message", identifier: 131, description: "A message published on the bus. Message is JSON encoded.", fields: [{ name: "node", type: "string0", storage: 0 }, { name: "topic", type: "string0", storage: 0 }, { name: "message", type: "string", storage: 0 }], packFormat: "z z s" }], tags: ["robotics"] }, { name: "Rotary encoder", status: "stable", shortId: "rotaryencoder", camelName: "rotaryEncoder", shortName: "rotaryEncoder", extends: ["_base", "_sensor"], notes: { short: "An incremental rotary encoder - converts angular motion of a shaft to digital signal." }, classIdentifier: 284830153, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: 'Upon device reset starts at `0` (regardless of the shaft position).\nIncreases by `1` for a clockwise "click", by `-1` for counter-clockwise.', fields: [{ name: "_", unit: "#", type: "i32", storage: -4, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "i32" }, { kind: "const", name: "clicks_per_turn", identifier: 384, description: "This specifies by how much `position` changes when the crank does 360 degree turn. Typically 12 or 24.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "clicker", identifier: 385, description: "The encoder is combined with a clicker. If this is the case, the clicker button service\nshould follow this service in the service list of the device.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: ["C", "8bit", "input"], group: "Slider" }, { name: "Rover", status: "experimental", shortId: "rover", camelName: "rover", shortName: "rover", extends: ["_base", "_sensor"], notes: { short: "A roving robot." }, classIdentifier: 435474539, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "kinematics", identifier: 257, description: "The current position and orientation of the robot.", fields: [{ name: "x", unit: "cm", shift: 16, type: "i16.16", storage: -4 }, { name: "y", unit: "cm", shift: 16, type: "i16.16", storage: -4 }, { name: "vx", unit: "cm/s", shift: 16, type: "i16.16", storage: -4 }, { name: "vy", unit: "cm/s", shift: 16, type: "i16.16", storage: -4 }, { name: "heading", unit: "\xB0", shift: 16, type: "i16.16", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i16.16 i16.16 i16.16 i16.16 i16.16" }], tags: [] }, { name: "Satellite Navigation System", status: "experimental", shortId: "satelittenavigationsystem", camelName: "satNav", shortName: "satNav", extends: ["_base", "_sensor"], notes: { short: "A satellite-based navigation system like GPS, Gallileo, ..." }, classIdentifier: 433938742, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: "Reported coordinates, geometric altitude and time of position. Altitude accuracy is 0 if not available.", fields: [{ name: "timestamp", unit: "ms", type: "u64", storage: 8, isSimpleType: true }, { name: "latitude", unit: "lat", shift: 23, type: "i9.23", storage: -4, absoluteMin: -90, absoluteMax: 90 }, { name: "longitude", unit: "lon", shift: 23, type: "i9.23", storage: -4, absoluteMin: -180, absoluteMax: 180 }, { name: "accuracy", unit: "m", shift: 16, type: "u16.16", storage: 4 }, { name: "altitude", unit: "m", shift: 6, type: "i26.6", storage: -4 }, { name: "altitudeAccuracy", unit: "m", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", packFormat: "u64 i9.23 i9.23 u16.16 i26.6 u16.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Enables or disables the GPS module", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "event", name: "inactive", identifier: 2, description: "The module is disabled or lost connection with satellites.", fields: [], identifierName: "inactive" }], tags: [] }, { name: "Sensor Aggregator", status: "experimental", shortId: "sensoraggregator", camelName: "sensorAggregator", shortName: "sensorAggregator", extends: ["_base"], notes: { short: "Aggregate data from multiple sensors into a single stream\n(often used as input to machine learning models on the same device, see model runner service)." }, classIdentifier: 496034245, enums: { SampleType: { name: "SampleType", storage: 1, members: { U8: 8, I8: 136, U16: 16, I16: 144, U32: 32, I32: 160 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "inputs", identifier: 128, description: "Set automatic input collection.\nThese settings are stored in flash.", fields: [{ name: "sampling_interval", unit: "ms", type: "u16", storage: 2, isSimpleType: true }, { name: "samples_in_window", type: "u16", storage: 2, isSimpleType: true }, { name: "reserved", type: "u32", storage: 4, isSimpleType: true }, { name: "device_id", type: "devid", storage: 8, startRepeats: true }, { name: "service_class", type: "u32", storage: 4, isSimpleType: true }, { name: "service_num", type: "u8", storage: 1, isSimpleType: true }, { name: "sample_size", unit: "B", type: "u8", storage: 1, isSimpleType: true }, { name: "sample_type", type: "SampleType", storage: 1 }, { name: "sample_shift", type: "i8", storage: -1, isSimpleType: true }], packFormat: "u16 u16 u32 r: b[8] u32 u8 u8 u8 i8" }, { kind: "ro", name: "num_samples", identifier: 384, description: "Number of input samples collected so far.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "sample_size", identifier: 385, description: "Size of a single sample.", fields: [{ name: "_", unit: "B", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "rw", name: "streaming_samples", identifier: 129, description: "When set to `N`, will stream `N` samples as `current_sample` reading.", fields: [{ name: "_", unit: "#", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "current_sample", identifier: 257, description: "Last collected sample.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "b" }], tags: [] }, { name: "Serial", status: "experimental", shortId: "serial", camelName: "serial", shortName: "serial", extends: ["_base"], notes: { short: "An asynchronous serial communication service capable of sending and receiving buffers of data.\nSettings default to 115200 baud 8N1." }, classIdentifier: 297461188, enums: { ParityType: { name: "ParityType", storage: 1, members: { None: 0, Even: 1, Odd: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "connected", identifier: 1, description: "Indicates if the serial connection is active.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "ro", name: "connection_name", identifier: 385, description: "User-friendly name of the connection.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "rw", name: "baud_rate", identifier: 128, description: "A positive, non-zero value indicating the baud rate at which serial communication is be established.", fields: [{ name: "_", unit: "baud", type: "u32", storage: 4, isSimpleType: true, defaultValue: 115200 }], packFormat: "u32" }, { kind: "rw", name: "data_bits", identifier: 129, description: "The number of data bits per frame. Either 7 or 8.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 8, absoluteMin: 7, absoluteMax: 8 }], packFormat: "u8" }, { kind: "rw", name: "stop_bits", identifier: 130, description: "The number of stop bits at the end of a frame. Either 1 or 2.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true, defaultValue: 1, absoluteMin: 1, absoluteMax: 2 }], packFormat: "u8" }, { kind: "rw", name: "parity_mode", identifier: 131, description: "The parity mode.", fields: [{ name: "_", type: "ParityType", storage: 1, defaultValue: 0 }], packFormat: "u8" }, { kind: "rw", name: "buffer_size", identifier: 132, description: "A positive, non-zero value indicating the size of the read and write buffers that should be created.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "command", name: "send", identifier: 128, description: "Send a buffer of data over the serial transport.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }, { kind: "report", name: "received", identifier: 128, description: "Raised when a buffer of data is received.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }], tags: ["io"] }, { name: "Servo", status: "stable", shortId: "servo", camelName: "servo", shortName: "servo", extends: ["_base"], notes: { short: "Servo is a small motor with arm that can be pointing at a specific direction.\nTypically a servo angle is between 0\xB0 and 180\xB0 where 90\xB0 is the middle resting position.\n\nThe `min_pulse/max_pulse` may be read-only if the servo is permanently affixed to its Jacdac controller." }, classIdentifier: 318542083, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "angle", identifier: 2, description: "Specifies the angle of the arm (request).", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4, typicalMin: 0, typicalMax: 180 }], identifierName: "value", packFormat: "i16.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn the power to the servo on/off.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "offset", identifier: 129, description: "Correction applied to the angle to account for the servo arm drift.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4 }], packFormat: "i16.16" }, { kind: "const", name: "min_angle", identifier: 272, description: "Lowest angle that can be set, typiclly 0 \xB0.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4, defaultValue: 0 }], identifierName: "min_value", packFormat: "i16.16" }, { kind: "rw", name: "min_pulse", identifier: 131, description: "The length of pulse corresponding to lowest angle.", fields: [{ name: "_", unit: "us", type: "u16", storage: 2, isSimpleType: true, defaultValue: 500 }], optional: true, packFormat: "u16" }, { kind: "const", name: "max_angle", identifier: 273, description: "Highest angle that can be set, typically 180\xB0.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4, defaultValue: 180 }], identifierName: "max_value", packFormat: "i16.16" }, { kind: "rw", name: "max_pulse", identifier: 133, description: "The length of pulse corresponding to highest angle.", fields: [{ name: "_", unit: "us", type: "u16", storage: 2, isSimpleType: true, defaultValue: 2500 }], optional: true, packFormat: "u16" }, { kind: "const", name: "stall_torque", identifier: 384, description: "The servo motor will stop rotating when it is trying to move a ``stall_torque`` weight at a radial distance of ``1.0`` cm.", fields: [{ name: "_", unit: "kg/cm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "response_speed", identifier: 385, description: "Time to move 60\xB0.", fields: [{ name: "_", unit: "s/60\xB0", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "ro", name: "actual_angle", identifier: 257, description: "The current physical position of the arm, if the device has a way to sense the position.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4 }], volatile: true, optional: true, identifierName: "reading", packFormat: "i16.16" }], tags: ["C"] }, { name: "Settings", status: "experimental", shortId: "settings", camelName: "settings", shortName: "settings", extends: ["_base"], notes: { short: "Non-volatile key-value storage interface for storing settings.", long: "## Secrets\n\nEntries with keys starting with `$` are considered secret.\nThey can be written normally, but they read as a single `0` byte,\nunless they are empty, in which case the value returned is also empty.\nThese are typically used by other services on the same device." }, classIdentifier: 285727818, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "get", identifier: 128, description: "Get the value of given setting. If no such entry exists, the value returned is empty.", fields: [{ name: "key", type: "string", storage: 0 }], hasReport: true, packFormat: "s" }, { kind: "report", name: "get", identifier: 128, description: "Get the value of given setting. If no such entry exists, the value returned is empty.", fields: [{ name: "key", type: "string0", storage: 0 }, { name: "value", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "z b" }, { kind: "command", name: "set", identifier: 129, description: "Set the value of a given setting.", fields: [{ name: "key", type: "string0", storage: 0 }, { name: "value", type: "bytes", storage: 0, isSimpleType: true }], restricted: true, packFormat: "z b" }, { kind: "command", name: "delete", identifier: 132, description: "Delete a given setting.", fields: [{ name: "key", type: "string", storage: 0 }], restricted: true, packFormat: "s" }, { kind: "command", name: "list_keys", identifier: 130, description: "Return keys of all settings.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "list_keys", packFormat: "b[12]" }, { kind: "pipe_report", name: "listed_key", identifier: 0, description: "Return keys of all settings.", fields: [{ name: "key", type: "string", storage: 0 }], pipeType: "list_keys", packFormat: "s" }, { kind: "command", name: "list", identifier: 131, description: "Return keys and values of all settings.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "list", packFormat: "b[12]" }, { kind: "pipe_report", name: "listed_entry", identifier: 0, description: "Return keys and values of all settings.", fields: [{ name: "key", type: "string0", storage: 0 }, { name: "value", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "list", packFormat: "z b" }, { kind: "command", name: "clear", identifier: 133, description: "Clears all keys.", fields: [], restricted: true }, { kind: "event", name: "change", identifier: 3, description: "Notifies that some setting have been modified.", fields: [], identifierName: "change" }], tags: [] }, { name: "7-segment display", status: "rc", shortId: "sevensegmentdisplay", camelName: "sevenSegmentDisplay", shortName: "sevenSegmentDisplay", extends: ["_base"], notes: { short: "A 7-segment numeric display, with one or more digits." }, classIdentifier: 425810167, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "digits", identifier: 2, description: "Each byte encodes the display status of a digit using,\nwhere lowest bit 0 encodes segment `A`, bit 1 encodes segments `B`, ..., bit 6 encodes segments `G`, and bit 7 encodes the decimal point (if present).\nIf incoming `digits` data is smaller than `digit_count`, the remaining digits will be cleared.\nThus, sending an empty `digits` payload clears the screen.\n\n```text\nGFEDCBA DP\n - A -\n F B\n | |\n - G -\n | |\n E C _\n | | |DP|\n - D - -\n```", fields: [{ name: "_", encoding: "bitset", type: "bytes", storage: 0, isSimpleType: true }], lowLevel: true, identifierName: "value", packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Controls the brightness of the LEDs. `0` means off.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], optional: true, identifierName: "intensity", packFormat: "u0.16" }, { kind: "rw", name: "double_dots", identifier: 128, description: "Turn on or off the column LEDs (separating minutes from hours, etc.) in of the segment.\nIf the column LEDs is not supported, the value remains false.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "const", name: "digit_count", identifier: 384, description: "The number of digits available on the display.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "decimal_point", identifier: 385, description: "True if decimal points are available (on all digits).", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "command", name: "set_number", identifier: 128, description: "Shows the number on the screen using the decimal dot if available.", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }], client: true, packFormat: "f64" }], tags: ["8bit"], group: "Display" }, { name: "Soil moisture", status: "stable", shortId: "soilmoisture", camelName: "soilMoisture", shortName: "soilMoisture", extends: ["_base", "_sensor"], notes: { short: "A soil moisture sensor." }, classIdentifier: 491430835, enums: { Variant: { name: "Variant", storage: 1, members: { Resistive: 1, Capacitive: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "moisture", identifier: 257, description: "Indicates the wetness of the soil, from `dry` to `wet`.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u0.16" }, { kind: "ro", name: "moisture_error", identifier: 262, description: "The error on the moisture reading.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Describe the type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Solenoid", status: "rc", shortId: "solenoid", camelName: "solenoid", shortName: "solenoid", extends: ["_base"], notes: { short: "A push-pull solenoid is a type of relay that pulls a coil when activated." }, classIdentifier: 387392458, enums: { Variant: { name: "Variant", storage: 1, members: { PushPull: 1, Valve: 2, Latch: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "pulled", identifier: 1, description: "Indicates whether the solenoid is energized and pulled (on) or pushed (off).", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of solenoid used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"] }, { name: "Sound level", status: "rc", shortId: "soundlevel", camelName: "soundLevel", shortName: "soundLevel", extends: ["_base", "_sensor"], notes: { short: "A sound level detector sensor, gives a relative indication of the sound level." }, classIdentifier: 346888797, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "sound_level", identifier: 257, description: "The sound level detected by the microphone", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn on or off the microphone.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "loud_threshold", identifier: 6, description: "Set level at which the `loud` event is generated.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "active_threshold", packFormat: "u0.16" }, { kind: "rw", name: "quiet_threshold", identifier: 5, description: "Set level at which the `quiet` event is generated.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "inactive_threshold", packFormat: "u0.16" }, { kind: "event", name: "loud", identifier: 1, description: "Generated when a loud sound is detected.", fields: [], identifierName: "active" }, { kind: "event", name: "quiet", identifier: 2, description: "Generated low level of sound is detected.", fields: [], identifierName: "inactive" }], tags: ["8bit"], group: "Sound" }, { name: "Sound player", status: "rc", shortId: "soundplayer", camelName: "soundPlayer", shortName: "soundPlayer", extends: ["_base"], notes: { short: "A device that can play various sounds stored locally. This service is typically paired with a ``storage`` service for storing sounds." }, classIdentifier: 335795e3, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "volume", identifier: 1, description: "Global volume of the output. ``0`` means completely off. This volume is mixed with each play volumes.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], optional: true, identifierName: "intensity", packFormat: "u0.16" }, { kind: "command", name: "play", identifier: 128, description: "Starts playing a sound.", fields: [{ name: "name", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "cancel", identifier: 129, description: "Cancel any sound playing.", fields: [] }, { kind: "command", name: "list_sounds", identifier: 130, description: "Returns the list of sounds available to play.", fields: [{ name: "sounds_port", type: "pipe", storage: 12 }], pipeType: "list_sounds", packFormat: "b[12]" }, { kind: "pipe_report", name: "list_sounds_pipe", identifier: 0, description: "Returns the list of sounds available to play.", fields: [{ name: "duration", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "name", type: "string", storage: 0 }], pipeType: "list_sounds", packFormat: "u32 s" }], tags: [], group: "Sound" }, { name: "Sound Recorder with Playback", status: "experimental", shortId: "soundrecorderwithplayback", camelName: "soundRecorderWithPlayback", shortName: "soundRecorderWithPlayback", extends: ["_base"], notes: { short: "A record and replay module. You can record a few seconds of audio and play it back." }, classIdentifier: 460504912, enums: { Status: { name: "Status", storage: 1, members: { Idle: 0, Recording: 1, Playing: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "play", identifier: 128, description: "Replay recorded audio.", fields: [] }, { kind: "command", name: "record", identifier: 129, description: "Record audio for N milliseconds.", fields: [{ name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "command", name: "cancel", identifier: 130, description: "Cancel record, the `time` register will be updated by already cached data.", fields: [] }, { kind: "ro", name: "status", identifier: 384, description: "Indicate the current status", fields: [{ name: "_", type: "Status", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "time", identifier: 385, description: "Milliseconds of audio recorded.", fields: [{ name: "_", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "rw", name: "volume", identifier: 1, description: "Playback volume control", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], optional: true, identifierName: "intensity", packFormat: "u0.8" }], tags: ["8bit", "padauk"], group: "Sound" }, { name: "Sound Spectrum", status: "experimental", shortId: "soundspectrum", camelName: "soundSpectrum", shortName: "soundSpectrum", extends: ["_base", "_sensor"], notes: { short: "A microphone that analyzes the sound specturm" }, classIdentifier: 360365086, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "frequency_bins", identifier: 257, description: "The computed frequency data.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "b" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns on/off the micropohone.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "fft_pow2_size", identifier: 128, description: "The power of 2 used as the size of the FFT to be used to determine the frequency domain.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 5, absoluteMin: 2, absoluteMax: 7 }], packFormat: "u8" }, { kind: "rw", name: "min_decibels", identifier: 129, description: "The minimum power value in the scaling range for the FFT analysis data", fields: [{ name: "_", unit: "dB", type: "i16", storage: -2, isSimpleType: true }], packFormat: "i16" }, { kind: "rw", name: "max_decibels", identifier: 130, description: "The maximum power value in the scaling range for the FFT analysis data", fields: [{ name: "_", unit: "dB", type: "i16", storage: -2, isSimpleType: true }], packFormat: "i16" }, { kind: "rw", name: "smoothing_time_constant", identifier: 131, description: 'The averaging constant with the last analysis frame.\nIf `0` is set, there is no averaging done, whereas a value of `1` means "overlap the previous and current buffer quite a lot while computing the value".', fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 0.8 }], packFormat: "u0.8" }], tags: [], group: "Sound" }, { name: "Speech synthesis", status: "rc", shortId: "speechsynthesis", camelName: "speechSynthesis", shortName: "speechSynthesis", extends: ["_base"], notes: { short: "A speech synthesizer" }, classIdentifier: 302307733, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines if the speech engine is in a non-paused state.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "lang", identifier: 128, description: "Language used for utterances as defined in https://www.ietf.org/rfc/bcp/bcp47.txt.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "rw", name: "volume", identifier: 129, description: "Volume for utterances.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 1 }], optional: true, packFormat: "u0.8" }, { kind: "rw", name: "pitch", identifier: 130, description: "Pitch for utterances", fields: [{ name: "_", shift: 16, type: "u16.16", storage: 4, defaultValue: 1, absoluteMax: 2, absoluteMin: 0 }], optional: true, packFormat: "u16.16" }, { kind: "rw", name: "rate", identifier: 131, description: "Rate for utterances", fields: [{ name: "_", shift: 16, type: "u16.16", storage: 4, defaultValue: 1, absoluteMin: 0.1, absoluteMax: 10 }], optional: true, packFormat: "u16.16" }, { kind: "command", name: "speak", identifier: 128, description: "Adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.", fields: [{ name: "text", type: "string", storage: 0 }], unique: true, packFormat: "s" }, { kind: "command", name: "cancel", identifier: 129, description: "Cancels current utterance and all utterances from the utterance queue.", fields: [] }], tags: [] }, { name: "Switch", status: "rc", shortId: "switch", camelName: "switch", shortName: "switch", extends: ["_base", "_sensor"], notes: { short: "A switch, which keeps its position." }, classIdentifier: 450008066, enums: { Variant: { name: "Variant", storage: 1, members: { Slide: 1, Tilt: 2, PushButton: 3, Tactile: 4, Toggle: 5, Proximity: 6, Magnetic: 7, FootButton: 8 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "active", identifier: 257, description: "Indicates whether the switch is currently active (on).", fields: [{ name: "_", type: "bool", storage: 1 }], volatile: true, identifierName: "reading", packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of switch used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "on", identifier: 1, description: "Emitted when switch goes from `off` to `on`.", fields: [], identifierName: "active" }, { kind: "event", name: "off", identifier: 2, description: "Emitted when switch goes from `on` to `off`.", fields: [], identifierName: "inactive" }], tags: ["8bit", "input"], group: "Button" }, { name: "TCP", status: "experimental", shortId: "tcp", camelName: "tcp", shortName: "tcp", extends: ["_base"], notes: { short: "Data transfer over TCP/IP and TLS stream sockets.", commands: "## Pipes" }, classIdentifier: 457422603, enums: { TcpError: { name: "TcpError", storage: -4, members: { InvalidCommand: 1, InvalidCommandPayload: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "open", identifier: 128, description: "Open pair of pipes between network peripheral and a controlling device. In/outbound refers to direction from/to internet.", fields: [{ name: "inbound", type: "pipe", storage: 12 }], pipeType: "open", hasReport: true, packFormat: "b[12]" }, { kind: "report", name: "open", identifier: 128, description: "Open pair of pipes between network peripheral and a controlling device. In/outbound refers to direction from/to internet.", fields: [{ name: "outbound_port", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "open", packFormat: "u16" }, { kind: "meta_pipe_command", name: "open_ssl", identifier: 1, description: "Open an SSL connection to a given host:port pair. Can be issued only once on given pipe.\nAfter the connection is established, an empty data report is sent.\nConnection is closed by closing the pipe.", fields: [{ name: "tcp_port", type: "u16", storage: 2, isSimpleType: true }, { name: "hostname", type: "string", storage: 0 }], pipeType: "open", packFormat: "u16 s" }, { kind: "pipe_command", name: "outdata", identifier: 0, description: "Bytes to be sent directly over an established TCP or SSL connection.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "open", packFormat: "b" }, { kind: "pipe_report", name: "indata", identifier: 0, description: "Bytes read directly from directly over an established TCP or SSL connection.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "open", packFormat: "b" }, { kind: "meta_pipe_report", name: "error", identifier: 0, description: "Reported when an error is encountered. Negative error codes come directly from the SSL implementation.", fields: [{ name: "error", type: "TcpError", storage: -4 }], pipeType: "open", packFormat: "i32" }], tags: [] }, { name: "Temperature", status: "stable", shortId: "temperature", camelName: "temperature", shortName: "temperature", extends: ["_base", "_sensor"], notes: { short: "A thermometer measuring outside or inside environment." }, classIdentifier: 337754823, enums: { Variant: { name: "Variant", storage: 1, members: { Outdoor: 1, Indoor: 2, Body: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "temperature", identifier: 257, description: "The temperature.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "i22.10", storage: -4 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "i22.10" }, { kind: "const", name: "min_temperature", identifier: 260, description: "Lowest temperature that can be reported.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "i22.10", storage: -4 }], identifierName: "min_reading", packFormat: "i22.10" }, { kind: "const", name: "max_temperature", identifier: 261, description: "Highest temperature that can be reported.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "i22.10", storage: -4 }], identifierName: "max_reading", packFormat: "i22.10" }, { kind: "ro", name: "temperature_error", identifier: 262, description: "The real temperature is between `temperature - temperature_error` and `temperature + temperature_error`.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the type of thermometer.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["C", "8bit"], group: "Environment" }, { name: "Timeseries Aggregator", status: "experimental", shortId: "timeseriesaggregator", camelName: "timeseriesAggregator", shortName: "timeseriesAggregator", extends: ["_base"], notes: { short: "Supports aggregating timeseries data (especially sensor readings)\nand sending them to a cloud/storage service.\nUsed in DeviceScript.\n\nNote that `f64` values are not necessarily aligned." }, classIdentifier: 294829516, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "clear", identifier: 128, description: "Remove all pending timeseries.", fields: [] }, { kind: "command", name: "update", identifier: 131, description: "Add a data point to a timeseries.", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }, { name: "label", type: "string", storage: 0 }], packFormat: "f64 s" }, { kind: "command", name: "set_window", identifier: 132, description: "Set aggregation window.\nSetting to `0` will restore default.", fields: [{ name: "duration", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "label", type: "string", storage: 0 }], packFormat: "u32 s" }, { kind: "command", name: "set_upload", identifier: 133, description: "Set whether or not the timeseries will be uploaded to the cloud.\nThe `stored` reports are generated regardless.", fields: [{ name: "upload", type: "bool", storage: 1 }, { name: "label", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "report", name: "stored", identifier: 144, description: 'Indicates that the average, minimum and maximum value of a given\ntimeseries are as indicated.\nIt also says how many samples were collected, and the collection period.\nTimestamps are given using device\'s internal clock, which will wrap around.\nTypically, `end_time` can be assumed to be "now".\n`end_time - start_time == window`', fields: [{ name: "num_samples", unit: "#", type: "u32", storage: 4, isSimpleType: true }, { name: "padding", type: "u8[4]", storage: 4 }, { name: "avg", isFloat: true, type: "f64", storage: 8 }, { name: "min", isFloat: true, type: "f64", storage: 8 }, { name: "max", isFloat: true, type: "f64", storage: 8 }, { name: "start_time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "end_time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "label", type: "string", storage: 0 }], packFormat: "u32 b[4] f64 f64 f64 u32 u32 s" }, { kind: "ro", name: "now", identifier: 384, description: "This can queried to establish local time on the device.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], volatile: true, packFormat: "u32" }, { kind: "rw", name: "fast_start", identifier: 128, description: "When `true`, the windows will be shorter after service reset and gradually extend to requested length.\nThis is ensure valid data is being streamed in program development.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "rw", name: "default_window", identifier: 129, description: "Window for timeseries for which `set_window` was never called.\nNote that windows returned initially may be shorter if `fast_start` is enabled.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 6e4 }], packFormat: "u32" }, { kind: "rw", name: "default_upload", identifier: 130, description: "Whether labelled timeseries for which `set_upload` was never called should be automatically uploaded.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "rw", name: "upload_unlabelled", identifier: 131, description: "Whether automatically created timeseries not bound in role manager should be uploaded.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "rw", name: "sensor_watchdog_period", identifier: 132, description: "If no data is received from any sensor within given period, the device is rebooted.\nSet to `0` to disable (default).\nUpdating user-provided timeseries does not reset the watchdog.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: ["infrastructure", "devicescript"], group: "Iot", restricted: true }, { name: "Traffic Light", status: "rc", shortId: "trafficlight", camelName: "trafficLight", shortName: "trafficLight", extends: ["_base"], notes: { short: "Controls a mini traffic with a red, orange and green LED." }, classIdentifier: 365137307, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "red", identifier: 128, description: "The on/off state of the red light.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "yellow", identifier: 129, description: "The on/off state of the yellow light.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "green", identifier: 130, description: "The on/off state of the green light.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }], tags: ["8bit"] }, { name: "Total Volatile organic compound", status: "stable", shortId: "tvoc", camelName: "tvoc", shortName: "tvoc", extends: ["_base", "_sensor"], notes: { short: "Measures equivalent Total Volatile Organic Compound levels." }, classIdentifier: 312849815, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "TVOC", identifier: 257, description: "Total volatile organic compound readings in parts per billion.", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4, absoluteMin: 0, typicalMax: 1187, typicalMin: 0 }], volatile: true, identifierName: "reading", packFormat: "u22.10" }, { kind: "ro", name: "TVOC_error", identifier: 262, description: "Error on the reading data", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_TVOC", identifier: 260, description: "Minimum measurable value", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4 }], identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_TVOC", identifier: 261, description: "Minimum measurable value.", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4 }], identifierName: "max_reading", packFormat: "u22.10" }], tags: ["8bit"], group: "Environment" }, { name: "Unique Brain", status: "stable", shortId: "uniquebrain", camelName: "uniqueBrain", shortName: "uniqueBrain", extends: ["_base"], notes: { short: "The presence of this service indicates that this device is a client that controls sensors and actuators.\nIf a unique brain detects another younger unique brain (determined by reset counter in announce packets),\nthen the older brain should switch into proxy mode." }, classIdentifier: 272387813, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "USB Bridge", status: "rc", shortId: "usbbridge", camelName: "usbBridge", shortName: "usbBridge", extends: ["_base"], notes: { short: "This service is normally not announced or otherwise exposed on the serial bus.\nIt is used to communicate with a USB-Jacdac bridge at the USB layer.\nThe host sends broadcast packets to this service to control the link layer.\nThe device responds with broadcast reports (no-one else does that).\nThese packets are not forwarded to the UART Jacdac line.\n\nPackets are sent over USB Serial (CDC).\nThe host shall set the CDC to 1Mbaud 8N1\n(even though in some cases the USB interface is connected directly to the MCU and line settings are\nignored).\n\nThe CDC line carries both Jacdac frames and serial logging output.\nJacdac frames have valid CRC and are framed by delimeter characters and possibly fragmented.\n\n`0xFE` is used as a framing byte.\nNote that bytes `0xF8`-`0xFF` are always invalid UTF-8.\n`0xFF` occurs relatively often in Jacdac packets, so is not used for framing.\n\nThe following sequences are supported:\n\n* `0xFE 0xF8` - literal 0xFE\n* `0xFE 0xF9` - reserved; ignore\n* `0xFE 0xFA` - indicates that some serial logs were dropped at this point\n* `0xFE 0xFB` - indicates that some Jacdac frames were dropped at this point\n* `0xFE 0xFC` - Jacdac frame start\n* `0xFE 0xFD` - Jacdac frame end\n\n0xFE followed by any other byte:\n* in serial, should be treated as literal 0xFE (and the byte as itself, unless it's 0xFE)\n* in frame data, should terminate the current frame fragment,\n and ideally have all data (incl. fragment start) in the current frame fragment treated as serial" }, classIdentifier: 418781770, enums: { QByte: { name: "QByte", storage: 1, members: { Magic: 254, LiteralMagic: 248, Reserved: 249, SerialGap: 250, FrameGap: 251, FrameStart: 252, FrameEnd: 253 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "disable_packets", identifier: 128, description: "Disables forwarding of Jacdac packets.", fields: [], hasReport: true }, { kind: "report", name: "disable_packets", identifier: 128, description: "Disables forwarding of Jacdac packets.", fields: [], secondary: true }, { kind: "command", name: "enable_packets", identifier: 129, description: "Enables forwarding of Jacdac packets.", fields: [], hasReport: true }, { kind: "report", name: "enable_packets", identifier: 129, description: "Enables forwarding of Jacdac packets.", fields: [], secondary: true }, { kind: "command", name: "disable_log", identifier: 130, description: "Disables forwarding of serial log messages.", fields: [], hasReport: true }, { kind: "report", name: "disable_log", identifier: 130, description: "Disables forwarding of serial log messages.", fields: [], secondary: true }, { kind: "command", name: "enable_log", identifier: 131, description: "Enables forwarding of serial log messages.", fields: [], hasReport: true }, { kind: "report", name: "enable_log", identifier: 131, description: "Enables forwarding of serial log messages.", fields: [], secondary: true }], tags: ["infrastructure"] }, { name: "UV index", status: "stable", shortId: "uvindex", camelName: "uvIndex", shortName: "uvIndex", extends: ["_base", "_sensor"], notes: { short: "The UV Index is a measure of the intensity of ultraviolet (UV) rays from the Sun." }, classIdentifier: 527306128, enums: { Variant: { name: "Variant", storage: 1, members: { UVA_UVB: 1, Visible_IR: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "uv_index", identifier: 257, description: "Ultraviolet index, typically refreshed every second.", fields: [{ name: "_", unit: "uv", shift: 16, type: "u16.16", storage: 4, typicalMax: 11, typicalMin: 0 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16.16" }, { kind: "ro", name: "uv_index_error", identifier: 262, description: "Error on the UV measure.", fields: [{ name: "_", unit: "uv", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor and capabilities.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Verified Telemetry", status: "deprecated", shortId: "verifiedtelemetrysensor", camelName: "verifiedTelemetry", shortName: "verifiedTelemetry", extends: ["_base"], notes: { short: "A mixin service that exposes verified telemetry information for a sensor (see https://github.com/Azure/Verified-Telemetry/tree/main/PnPModel)." }, classIdentifier: 563381279, enums: { Status: { name: "Status", storage: 1, members: { Unknown: 0, Working: 1, Faulty: 2 } }, FingerprintType: { name: "FingerprintType", storage: 1, members: { FallCurve: 1, CurrentSense: 2, Custom: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "telemetry_status", identifier: 384, description: "Reads the telemetry working status, where ``true`` is working and ``false`` is faulty.", fields: [{ name: "_", type: "Status", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "telemetry_status_interval", identifier: 128, description: "Specifies the interval between computing the fingerprint information.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }, { kind: "const", name: "fingerprint_type", identifier: 385, description: "Type of the fingerprint.", fields: [{ name: "_", type: "FingerprintType", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "fingerprint_template", identifier: 386, description: "Template Fingerprint information of a working sensor.", fields: [{ name: "confidence", unit: "%", type: "u16", storage: 2, isSimpleType: true }, { name: "template", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u16 b" }, { kind: "command", name: "reset_fingerprint_template", identifier: 128, description: "This command will clear the template fingerprint of a sensor and collect a new template fingerprint of the attached sensor.", fields: [] }, { kind: "command", name: "retrain_fingerprint_template", identifier: 129, description: "This command will append a new template fingerprint to the `fingerprintTemplate`. Appending more fingerprints will increase the accuracy in detecting the telemetry status.", fields: [], unique: true }, { kind: "event", name: "telemetry_status_change", identifier: 3, description: "The telemetry status of the device was updated.", fields: [{ name: "telemetry_status", type: "Status", storage: 1 }], identifierName: "change", packFormat: "u8" }, { kind: "event", name: "fingerprint_template_change", identifier: 128, description: "The fingerprint template was updated", fields: [] }], tags: [] }, { name: "Vibration motor", status: "stable", shortId: "vibrationmotor", camelName: "vibrationMotor", shortName: "vibrationMotor", extends: ["_base"], notes: { short: "A vibration motor." }, classIdentifier: 406832290, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "vibrate", identifier: 128, description: "Starts a sequence of vibration and pauses. To stop any existing vibration, send an empty payload.", fields: [{ name: "duration", unit: "8ms", type: "u8", storage: 1, isSimpleType: true, startRepeats: true }, { name: "intensity", unit: "/", shift: 8, type: "u0.8", storage: 1 }], packFormat: "r: u8 u0.8" }, { kind: "const", name: "max_vibrations", identifier: 384, description: "The maximum number of vibration sequences supported in a single packet.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], optional: true, packFormat: "u8" }], tags: [] }, { name: "Water level", status: "rc", shortId: "waterlevel", camelName: "waterLevel", shortName: "waterLevel", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures liquid/water level." }, classIdentifier: 343630573, enums: { Variant: { name: "Variant", storage: 1, members: { Resistive: 1, ContactPhotoElectric: 2, NonContactPhotoElectric: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "level", identifier: 257, description: "The reported water level.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "ro", name: "level_error", identifier: 262, description: "The error rage on the current reading", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"] }, { name: "Weight Scale", status: "rc", shortId: "weightscale", camelName: "weightScale", shortName: "weightScale", extends: ["_base", "_sensor"], notes: { short: "A weight measuring sensor." }, classIdentifier: 525160512, enums: { Variant: { name: "Variant", storage: 1, members: { Body: 1, Food: 2, Jewelry: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "weight", identifier: 257, description: "The reported weight.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", packFormat: "u16.16" }, { kind: "ro", name: "weight_error", identifier: 262, description: "The estimate error on the reported reading.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "rw", name: "zero_offset", identifier: 128, description: "Calibrated zero offset error on the scale, i.e. the measured weight when nothing is on the scale.\nYou do not need to subtract that from the reading, it has already been done.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "rw", name: "gain", identifier: 129, description: "Calibrated gain on the weight scale error.", fields: [{ name: "_", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "max_weight", identifier: 261, description: "Maximum supported weight on the scale.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u16.16" }, { kind: "const", name: "min_weight", identifier: 260, description: "Minimum recommend weight on the scale.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "min_reading", packFormat: "u16.16" }, { kind: "const", name: "weight_resolution", identifier: 264, description: "Smallest, yet distinguishable change in reading.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "reading_resolution", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical scale", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "command", name: "calibrate_zero_offset", identifier: 128, description: "Call this command when there is nothing on the scale. If supported, the module should save the calibration data.", fields: [] }, { kind: "command", name: "calibrate_gain", identifier: 129, description: "Call this command with the weight of the thing on the scale.", fields: [{ name: "weight", unit: "g", shift: 10, type: "u22.10", storage: 4 }], packFormat: "u22.10" }], tags: ["8bit"] }, { name: "WIFI", status: "rc", shortId: "wifi", camelName: "wifi", shortName: "wifi", extends: ["_base"], notes: { short: "Discovery and connection to WiFi networks. Separate TCP service can be used for data transfer.", long: "## Connection\n\nThe device controlled by this service is meant to connect automatically, once configured.\nTo that end, it keeps a list of known WiFi networks, with priorities and passwords.\nIt will connect to the available network with numerically highest priority,\nbreaking ties in priority by signal strength (typically all known networks have priority of `0`).\nIf the connection fails (due to wrong password, radio failure, or other problem)\nan `connection_failed` event is emitted, and the device will try to connect to the next eligible network.\nWhen networks are exhausted, the scan is performed again and the connection process restarts.\n\nUpdating networks (setting password, priorties, forgetting) does not trigger an automatic reconnect.\n\n## Captive portals\n\nIf the Wifi is not able to join an AP because it needs to receive a password, it may decide to enter a mode\nwhere it waits for user input. Typical example of this mode would be a captive portal or waiting for a BLE interaction.\nIn that situation, the `status_code` should set to `WaitingForInput`." }, classIdentifier: 413852154, enums: { APFlags: { name: "APFlags", storage: 4, isFlags: true, members: { HasPassword: 1, WPS: 2, HasSecondaryChannelAbove: 4, HasSecondaryChannelBelow: 8, IEEE_802_11B: 256, IEEE_802_11A: 512, IEEE_802_11G: 1024, IEEE_802_11N: 2048, IEEE_802_11AC: 4096, IEEE_802_11AX: 8192, IEEE_802_LongRange: 32768 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "last_scan_results", identifier: 128, description: "Return list of WiFi network from the last scan.\nScans are performed periodically while not connected (in particular, on startup and after current connection drops),\nas well as upon `reconnect` and `scan` commands.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "last_scan_results", packFormat: "b[12]" }, { kind: "pipe_report", name: "results", identifier: 0, description: "Return list of WiFi network from the last scan.\nScans are performed periodically while not connected (in particular, on startup and after current connection drops),\nas well as upon `reconnect` and `scan` commands.", fields: [{ name: "flags", type: "APFlags", storage: 4 }, { name: "reserved", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true, typicalMin: -100, typicalMax: -20 }, { name: "channel", type: "u8", storage: 1, isSimpleType: true, typicalMin: 1, typicalMax: 13 }, { name: "bssid", type: "u8[6]", storage: 6 }, { name: "ssid", type: "string", storage: 33, maxBytes: 33 }], pipeType: "last_scan_results", packFormat: "u32 u32 i8 u8 b[6] s[33]" }, { kind: "command", name: "add_network", identifier: 129, description: "Automatically connect to named network if available. Also set password if network is not open.", fields: [{ name: "ssid", type: "string0", storage: 0 }, { name: "password", type: "string0", storage: 0, isOptional: true }], packFormat: "z z" }, { kind: "command", name: "reconnect", identifier: 130, description: "Enable the WiFi (if disabled), initiate a scan, wait for results, disconnect from current WiFi network if any,\nand then reconnect (using regular algorithm, see `set_network_priority`).", fields: [] }, { kind: "command", name: "forget_network", identifier: 131, description: "Prevent from automatically connecting to named network in future.\nForgetting a network resets its priority to `0`.", fields: [{ name: "ssid", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "forget_all_networks", identifier: 132, description: "Clear the list of known networks.", fields: [] }, { kind: "command", name: "set_network_priority", identifier: 133, description: "Set connection priority for a network.\nBy default, all known networks have priority of `0`.", fields: [{ name: "priority", type: "i16", storage: -2, isSimpleType: true }, { name: "ssid", type: "string", storage: 0 }], packFormat: "i16 s" }, { kind: "command", name: "scan", identifier: 134, description: "Initiate search for WiFi networks. Generates `scan_complete` event.", fields: [] }, { kind: "command", name: "list_known_networks", identifier: 135, description: "Return list of known WiFi networks.\n`flags` is currently always 0.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "list_known_networks", packFormat: "b[12]" }, { kind: "pipe_report", name: "network_results", identifier: 0, description: "Return list of known WiFi networks.\n`flags` is currently always 0.", fields: [{ name: "priority", type: "i16", storage: -2, isSimpleType: true }, { name: "flags", type: "i16", storage: -2, isSimpleType: true }, { name: "ssid", type: "string", storage: 0 }], pipeType: "list_known_networks", packFormat: "i16 i16 s" }, { kind: "ro", name: "rssi", identifier: 257, description: "Current signal strength. Returns -128 when not connected.", fields: [{ name: "_", unit: "dB", type: "i8", storage: -1, isSimpleType: true, typicalMin: -128, typicalMax: -20 }], volatile: true, identifierName: "reading", preferredInterval: 15e3, packFormat: "i8" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines whether the WiFi radio is enabled. It starts enabled upon reset.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "ro", name: "ip_address", identifier: 385, description: "0, 4 or 16 byte buffer with the IPv4 or IPv6 address assigned to device if any.", fields: [{ name: "_", type: "bytes", storage: 16, isSimpleType: true, maxBytes: 16 }], packFormat: "b[16]" }, { kind: "const", name: "eui_48", identifier: 386, description: 'The 6-byte MAC address of the device. If a device does MAC address randomization it will have to "restart".', fields: [{ name: "_", type: "bytes", storage: 6, isSimpleType: true, maxBytes: 6 }], packFormat: "b[6]" }, { kind: "ro", name: "ssid", identifier: 387, description: "SSID of the access-point to which device is currently connected.\nEmpty string if not connected.", fields: [{ name: "_", type: "string", storage: 32, maxBytes: 32 }], packFormat: "s[32]" }, { kind: "event", name: "got_ip", identifier: 1, description: "Emitted upon successful join and IP address assignment.", fields: [], identifierName: "active" }, { kind: "event", name: "lost_ip", identifier: 2, description: "Emitted when disconnected from network.", fields: [], identifierName: "inactive" }, { kind: "event", name: "scan_complete", identifier: 128, description: "A WiFi network scan has completed. Results can be read with the `last_scan_results` command.\nThe event indicates how many networks where found, and how many are considered\nas candidates for connection.", fields: [{ name: "num_networks", type: "u16", storage: 2, isSimpleType: true }, { name: "num_known_networks", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }, { kind: "event", name: "networks_changed", identifier: 129, description: "Emitted whenever the list of known networks is updated.", fields: [] }, { kind: "event", name: "connection_failed", identifier: 130, description: "Emitted when when a network was detected in scan, the device tried to connect to it\nand failed.\nThis may be because of wrong password or other random failure.", fields: [{ name: "ssid", type: "string", storage: 0 }], packFormat: "s" }], tags: [], group: "Iot" }, { name: "Wind direction", status: "rc", shortId: "winddirection", camelName: "windDirection", shortName: "windDirection", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures wind direction." }, classIdentifier: 409725227, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "wind_direction", identifier: 257, description: "The direction of the wind.", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true, absoluteMin: 0, absoluteMax: 359 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16" }, { kind: "ro", name: "wind_direction_error", identifier: 262, description: "Error on the wind direction reading", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16" }], tags: ["8bit"], group: "Environment" }, { name: "Wind speed", status: "rc", shortId: "windspeed", camelName: "windSpeed", shortName: "windSpeed", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures wind speed." }, classIdentifier: 458824639, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "wind_speed", identifier: 257, description: "The velocity of the wind.", fields: [{ name: "_", unit: "m/s", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", preferredInterval: 6e4, packFormat: "u16.16" }, { kind: "ro", name: "wind_speed_error", identifier: 262, description: "Error on the reading", fields: [{ name: "_", unit: "m/s", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "max_wind_speed", identifier: 261, description: "Maximum speed that can be measured by the sensor.", fields: [{ name: "_", unit: "m/s", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u16.16" }], tags: ["8bit"], group: "Environment" }, { name: "WSSK", status: "experimental", shortId: "wssk", camelName: "wssk", shortName: "wssk", extends: ["_base"], notes: { short: "Defines a binary protocol for IoT devices to talk to DeviceScript gateway over encrypted websockets.\nThis is not used as a regular Jacdac service." }, classIdentifier: 330775038, enums: { StreamingType: { name: "StreamingType", storage: 2, members: { Jacdac: 1, Dmesg: 2, Exceptions: 256, TemporaryMask: 255, PermamentMask: 65280, DefaultMask: 256 } }, DataType: { name: "DataType", storage: 1, members: { Binary: 1, JSON: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "report", name: "error", identifier: 255, description: "Issued when a command fails.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "set_streaming", identifier: 144, description: "Enable/disable forwarding of all Jacdac frames, exception reporting, and `dmesg` streaming.", fields: [{ name: "status", type: "StreamingType", storage: 2 }], packFormat: "u16" }, { kind: "command", name: "ping_device", identifier: 145, description: "Send from gateway when it wants to see if the device is alive.\nThe device currently only support 0-length payload.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "ping_device", identifier: 145, description: "Send from gateway when it wants to see if the device is alive.\nThe device currently only support 0-length payload.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "b" }, { kind: "command", name: "ping_cloud", identifier: 146, description: "Send from device to gateway to test connection.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "ping_cloud", identifier: 146, description: "Send from device to gateway to test connection.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "b" }, { kind: "command", name: "get_hash", identifier: 147, description: "Get SHA256 of the currently deployed program.", fields: [], hasReport: true }, { kind: "report", name: "get_hash", identifier: 147, description: "Get SHA256 of the currently deployed program.", fields: [{ name: "sha256", type: "u8[32]", storage: 32 }], secondary: true, packFormat: "b[32]" }, { kind: "command", name: "deploy_start", identifier: 148, description: "Start deployment of a new program.", fields: [{ name: "size", unit: "B", type: "u32", storage: 4, isSimpleType: true }], hasReport: true, packFormat: "u32" }, { kind: "report", name: "deploy_start", identifier: 148, description: "Start deployment of a new program.", fields: [], secondary: true }, { kind: "command", name: "deploy_write", identifier: 149, description: "Payload length must be multiple of 32 bytes.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "deploy_write", identifier: 149, description: "Payload length must be multiple of 32 bytes.", fields: [], secondary: true }, { kind: "command", name: "deploy_finish", identifier: 150, description: "Finish deployment.", fields: [], hasReport: true }, { kind: "report", name: "deploy_finish", identifier: 150, description: "Finish deployment.", fields: [], secondary: true }, { kind: "command", name: "c2d", identifier: 151, description: "Upload a labelled tuple of values to the cloud.\nThe tuple will be automatically tagged with timestamp and originating device.", fields: [{ name: "datatype", type: "DataType", storage: 1 }, { name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u8 z b" }, { kind: "report", name: "d2c", identifier: 152, description: "Upload a binary message to the cloud.", fields: [{ name: "datatype", type: "DataType", storage: 1 }, { name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u8 z b" }, { kind: "command", name: "jacdac_packet", identifier: 153, description: "Sent both ways.", fields: [{ name: "frame", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "jacdac_packet", identifier: 153, description: "Sent both ways.", fields: [{ name: "frame", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "b" }, { kind: "report", name: "dmesg", identifier: 154, description: "The `logs` field is string in UTF-8 encoding, however it can be split in the middle of UTF-8 code point.\nControlled via `dmesg_en`.", fields: [{ name: "logs", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "report", name: "exception_report", identifier: 155, description: "The format is the same as `dmesg` but this is sent on exceptions only and is controlled separately via `exception_en`.", fields: [{ name: "logs", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }], tags: ["infrastructure", "devicescript"], group: "Iot" }]; + var _serviceSpecifications = services_default; + var _serviceSpecificationMap = void 0; + function serviceSpecificationFromName(shortId) { + if (!shortId) + return void 0; + return _serviceSpecifications.find((s) => s.shortId === shortId); + } + function serviceSpecificationFromClassIdentifier(classIdentifier) { + if (isNaN(classIdentifier)) + return void 0; + let srv = _serviceSpecificationMap == null ? void 0 : _serviceSpecificationMap[classIdentifier]; + if (srv) + return srv; + srv = _serviceSpecifications.find( + (s) => s.classIdentifier === classIdentifier + ); + if (srv) { + if (!_serviceSpecificationMap) + _serviceSpecificationMap = {}; + _serviceSpecificationMap[classIdentifier] = srv; + } + return srv; + } + function isRegister2(pkt) { + return pkt && (pkt.kind == "const" || pkt.kind == "ro" || pkt.kind == "rw"); + } + function isIntegerType(tp) { + return /^[ui]\d+(\.|$)/.test(tp) || tp == "pipe_port" || tp == "bool"; + } + function numberFormatFromStorageType(tp) { + switch (tp) { + case -1: + return 1; + case 1: + return 2; + case -2: + return 3; + case 2: + return 4; + case -4: + return 5; + case 4: + return 11; + case -8: + return 19; + case 8: + return 17; + case 0: + return null; + default: + return null; + } + } + function numberFormatToStorageType(nf) { + switch (nf) { + case 1: + return -1; + case 2: + return 1; + case 3: + return -2; + case 4: + return 2; + case 5: + return -4; + case 11: + return 4; + case 19: + return -8; + case 17: + return 8; + default: + return null; + } + } + function scaleIntToFloat(v, info) { + if (!info.shift) + return v; + if (info.shift < 0) + return v * (1 << -info.shift); + else + return v / (1 << info.shift); + } + function storageTypeRange(tp) { + if (tp == 0) + throw new Error("no range for 0"); + if (tp < 0) { + const v = Math.pow(2, -tp * 8 - 1); + return [-v, v - 1]; + } else { + const v = Math.pow(2, tp * 8); + return [0, v - 1]; + } + } + function clampToStorage(v, tp) { + if (tp == null) + return v; + const [min, max] = storageTypeRange(tp); + if (isNaN(v)) + return 0; + if (v < min) + return min; + if (v > max) + return max; + return v; + } + var ch_b = 98; + var ch_i = 105; + var ch_r = 114; + var ch_s = 115; + var ch_u = 117; + var ch_x = 120; + var ch_z = 122; + var ch_colon = 58; + var ch_sq_open = 91; + var ch_sq_close = 93; + function numberFormatOfType(tp) { + switch (tp) { + case "u8": + return 2; + case "u16": + return 4; + case "u32": + return 11; + case "i8": + return 1; + case "i16": + return 3; + case "i32": + return 5; + case "f32": + return 13; + case "f64": + return 14; + case "i64": + return 19; + case "u64": + return 17; + default: + return null; + } + } + function bufferSlice(buf, start, end) { + return buf.slice(start, end); + } + var TokenParser = class { + constructor(fmt) { + this.fmt = fmt; + this.fp = 0; + } + parse() { + this.div = 1; + this.isArray = false; + const fmt = this.fmt; + while (this.fp < fmt.length) { + let endp = this.fp; + while (endp < fmt.length && fmt.charCodeAt(endp) != 32) + endp++; + let word = fmt.slice(this.fp, endp); + this.fp = endp + 1; + if (!word) + continue; + const dotIdx = word.indexOf("."); + let c0 = word.charCodeAt(0); + if ((c0 == ch_i || c0 == ch_u) && dotIdx >= 0) { + const sz0 = parseInt(word.slice(1, dotIdx)); + const sz1 = parseInt(word.slice(dotIdx + 1)); + word = word[0] + (sz0 + sz1); + this.div = 1 << sz1; + } + const c1 = word.charCodeAt(1); + if (c1 == ch_sq_open) { + this.size = parseInt(word.slice(2)); + } else { + this.size = -1; + } + if (word.charCodeAt(word.length - 1) == ch_sq_close && word.charCodeAt(word.length - 2) == ch_sq_open) { + word = word.slice(0, -2); + this.isArray = true; + } + this.nfmt = numberFormatOfType(word); + this.word = word; + if (this.nfmt == null) { + if (c0 == ch_r) { + if (c1 != ch_colon) + c0 = 0; + } else if (c0 == ch_s || c0 == ch_b || c0 == ch_x) { + if (word.length != 1 && this.size == -1) + c0 = 0; + } else if (c0 == ch_z) { + if (word.length != 1) + c0 = 0; + } else { + c0 = 0; + } + if (c0 == 0) + throw new Error(`invalid format: ${word}`); + this.c0 = c0; + } else { + this.size = sizeOfNumberFormat(this.nfmt); + this.c0 = -1; + } + return true; + } + return false; + } + }; + function jdunpackCore(buf, fmt, repeat) { + const repeatRes = repeat ? [] : null; + let res = []; + let off = 0; + let fp0 = 0; + const parser = new TokenParser(fmt); + if (repeat && buf.length == 0) + return []; + while (parser.parse()) { + if (parser.isArray && !repeat) { + res.push( + jdunpackCore( + bufferSlice(buf, off, buf.length), + fmt.slice(fp0), + 1 + ) + ); + return res; + } + fp0 = parser.fp; + let sz = parser.size; + const c0 = parser.c0; + if (c0 == ch_z) { + let endoff = off; + while (endoff < buf.length && buf[endoff] != 0) + endoff++; + sz = endoff - off; + } else if (sz < 0) { + sz = buf.length - off; + } + if (parser.nfmt !== null) { + let v = getNumber(buf, parser.nfmt, off); + if (parser.div != 1) + v /= parser.div; + res.push(v); + off += parser.size; + } else { + const subbuf = bufferSlice(buf, off, off + sz); + if (c0 == ch_z || c0 == ch_s) { + let zerop = 0; + while (zerop < subbuf.length && subbuf[zerop] != 0) + zerop++; + res.push(bufferToString(bufferSlice(subbuf, 0, zerop))); + } else if (c0 == ch_b) { + res.push(subbuf); + } else if (c0 == ch_x) { + } else if (c0 == ch_r) { + res.push(jdunpackCore(subbuf, fmt.slice(fp0), 2)); + break; + } else { + throw new Error(`whoops`); + } + off += subbuf.length; + if (c0 == ch_z) + off++; + } + if (repeat && parser.fp >= fmt.length) { + parser.fp = 0; + if (repeat == 2) { + repeatRes.push(res); + res = []; + } + if (off >= buf.length) + break; + } + } + if (repeat == 2) { + if (res.length) + repeatRes.push(res); + return repeatRes; + } else { + return res; + } + } + function jdunpack(buf, fmt) { + if (!buf || !fmt) + return void 0; + if (fmt === "b") + return [buf.slice(0)]; + let nf = numberFormatOfType(fmt); + if (nf !== null) { + let sz = sizeOfNumberFormat(nf); + if (buf.length === 4 && nf === 17) { + nf = 11; + sz = 4; + } + if (buf.length < sz) { + throw new Error( + `size mistmatch, expected ${fmt} (${sz} bytes), got ${buf.length}` + ); + } + return [getNumber(buf, nf, 0)]; + } + return jdunpackCore(buf, fmt, 0); + } + function jdpackCore(trg, fmt, data, off) { + let idx = 0; + const parser = new TokenParser(fmt); + while (parser.parse()) { + const c0 = parser.c0; + if (c0 == ch_x) { + off += parser.size; + continue; + } + const dataItem = data[idx++]; + if (c0 == ch_r && dataItem) { + const fmt0 = fmt.slice(parser.fp); + for (const velt of dataItem) { + off = jdpackCore(trg, fmt0, velt, off); + } + break; + } + let arr; + if (parser.isArray) + arr = dataItem; + else + arr = [dataItem]; + for (let v of arr) { + if (parser.nfmt !== null) { + if (typeof v != "number") + throw new Error(`expecting number, got ` + typeof v); + if (trg) { + v *= parser.div; + const st = numberFormatToStorageType( + parser.nfmt + ); + if (parser.div == 1 && (st == 4 || st == -4)) + v = 0 | Math.round(v); + else if (st != null) + v = clampToStorage(Math.round(v), st); + setNumber(trg, parser.nfmt, off, v); + } + off += parser.size; + } else { + let buf; + if (typeof v === "string") { + if (c0 == ch_z) + buf = stringToBuffer(v + "\0"); + else if (c0 == ch_s) + buf = stringToBuffer(v); + else + throw new Error(`unexpected string`); + } else if (v && typeof v === "object" && v.length != null) { + if (c0 == ch_b) + buf = v; + else + throw new Error(`unexpected buffer`); + } else { + throw new Error(`expecting string or buffer`); + } + let sz = parser.size; + if (sz >= 0) { + if (buf.length > sz) + buf = bufferSlice(buf, 0, sz); + } else { + sz = buf.length; + } + if (trg) + trg.set(buf, off); + off += sz; + } + } + } + if (data.length > idx) + throw new Error(`format '${fmt}' too short`); + return off; + } + function jdpack(fmt, data) { + var _a; + if (!fmt || !data) + return void 0; + if (fmt === "b") + return (_a = data[0]) == null ? void 0 : _a.slice(0); + const nf = numberFormatOfType(fmt); + if (nf !== null) { + const buf = new Uint8Array(sizeOfNumberFormat(nf)); + const st = numberFormatToStorageType(nf); + let v = data[0]; + if (st != null) { + if (st == 4 || st == -4) + v = Math.round(v) | 0; + else + v = clampToStorage(Math.round(v), st); + } + setNumber(buf, nf, 0, v); + return buf; + } + const len = jdpackCore(null, fmt, data, 0); + const res = new Uint8Array(len); + jdpackCore(res, fmt, data, 0); + return res; + } + function prettyUnit2(u) { + switch (u) { + case "us": + return "\u03BCs"; + case "C": + case "Cel": + return "\xB0C"; + case "K": + return "\xB0K"; + case "/": + case "#": + return ""; + default: + return u; + } + } + function prettyDuration(ms) { + let s = ms / 1e3; + if (s < 1) + return `${roundWithPrecision(s, 2)}s`; + if (s < 10) + return `${roundWithPrecision(s, 1)}s`; + if (s < 60) + return `${Math.floor(s)}s`; + let r = ""; + const d = Math.floor(s / (24 * 3600)); + if (d > 0) { + r += d + ":"; + s -= d * (24 * 3600); + } + const h = Math.floor(s / 3600); + if (h > 0) { + r += h + ":"; + s -= h * 3600; + } + const m = Math.floor(s / 60); + if (d > 0 || h > 0 || m > 0) { + r += m + ":"; + s -= m * 60; + } + r += Math.floor(s); + return r; + } + function prettyMicroDuration(us) { + if (us < 1e3) + return `${us}${prettyUnit2("us")}`; + else + return prettyDuration(us / 1e3); + } + function shortDeviceId(devid) { + const h = hash(fromHex(devid), 30); + return String.fromCharCode(65 + h % 26) + String.fromCharCode(65 + idiv(h, 26) % 26) + String.fromCharCode(48 + idiv(h, 26 * 26) % 10) + String.fromCharCode(48 + idiv(h, 26 * 26 * 10) % 10); + } + function toIP(buffer) { + if (!buffer) + return void 0; + if (buffer.length === 4) + return `${buffer[0]}.${buffer[1]}.${buffer[2]}.${buffer[3]}`; + else + return toHex2(buffer, "."); + } + function toMAC(buffer) { + const hex = toHex2(buffer, ":"); + return hex; + } + function toBits(buffer) { + let bitString = ""; + buffer.forEach((byte) => { + for (let i = 7; i >= 0; i--) { + bitString += byte >> i & 1; + } + }); + return bitString; + } + function decodeMember(service, pktInfo, member, pkt, offset) { + var _a; + if (!member) + return null; + if (pkt.data.length <= offset) + return null; + let numValue = void 0; + let scaledValue = void 0; + let value = void 0; + let humanValue = void 0; + let size = Math.abs(member.storage); + const enumInfo = service == null ? void 0 : service.enums[member.type]; + const isInt = isIntegerType(member.type) || !!enumInfo; + if ((service == null ? void 0 : service.classIdentifier) === SRV_WIFI2 && pktInfo.kind === "ro" && pktInfo.identifier === 385 && offset == 0) { + value = pkt.data; + humanValue = toIP(pkt.data); + } else if ((service == null ? void 0 : service.classIdentifier) === SRV_GPIO2 && pktInfo.kind === "ro" && pktInfo.identifier === 257 && offset == 0) { + value = pkt.data; + humanValue = toBits(pkt.data); + } else if ((service == null ? void 0 : service.classIdentifier) === SRV_DEVICE_SCRIPT_MANAGER2 && pktInfo.kind === "const" && pktInfo.identifier === 387 && offset == 0) { + value = pkt.data; + humanValue = (value == null ? void 0 : value.length) >= 2 ? `${value[2]}.${value[1]}.${value[0]}` : "?"; + } else if ((service == null ? void 0 : service.classIdentifier) === SRV_WIFI2 && pktInfo.kind === "const" && pktInfo.identifier === 386 && offset == 0) { + value = pkt.data; + humanValue = toMAC(pkt.data); + } else if (member.isFloat && (size == 4 || size == 8)) { + if (size == 4) + numValue = pkt.getNumber(13, offset); + else + numValue = pkt.getNumber(14, offset); + value = scaledValue = numValue; + if (Math.abs(value) < 10) + humanValue = value.toFixed(5); + else if (Math.abs(value) < 1e3) + humanValue = value.toFixed(3); + else if (Math.abs(value) < 1e5) + humanValue = value.toFixed(2); + else + humanValue = "" + value; + if (member.unit) + humanValue += prettyUnit2(member.unit); + } else if (!isInt) { + if (member.type == "string0") { + let ptr = offset; + while (ptr < pkt.data.length) { + if (!pkt.data[ptr++]) + break; + } + size = ptr - offset; + } + const buf = size ? pkt.data.slice(offset, offset + size) : pkt.data.slice(offset); + if (member.type == "string" || member.type == "string0") { + try { + value = fromUTF8(uint8ArrayToString(buf)); + } catch { + value = uint8ArrayToString(buf); + } + humanValue = JSON.stringify(value).replace(/\\u0000/g, "\\0"); + } else if (member.type == "pipe") { + value = buf; + const devid = toHex2(buf.slice(0, 8)); + const port = read16(buf, 8); + humanValue = "pipe to " + shortDeviceId(devid) + " port:" + port; + if ((_a = pkt == null ? void 0 : pkt.device) == null ? void 0 : _a.bus) { + const trg = pkt.device.bus.device(devid, true); + if (trg) + trg.port(port).pipeType = (service == null ? void 0 : service.shortId) + "." + pktInfo.pipeType + ".report"; + } + } else { + value = buf; + humanValue = hexDump(buf); + } + size = buf.length; + } else { + const fmt = numberFormatFromStorageType(member.storage); + numValue = pkt.getNumber(fmt, offset); + value = scaledValue = scaleIntToFloat(numValue, member); + if (pkt.device && member.type == "pipe_port") + pkt.device.port(value).pipeType = (service == null ? void 0 : service.shortId) + "." + pktInfo.pipeType + ".command"; + if (enumInfo) { + if (enumInfo.isFlags) { + humanValue = ""; + let curr = numValue; + for (const key of Object.keys(enumInfo.members)) { + const val = enumInfo.members[key]; + if ((curr & val) == val) { + if (humanValue) + humanValue += " | "; + humanValue += key; + curr &= ~val; + } + } + if (curr) { + if (humanValue) + humanValue += " | "; + humanValue += hexNum(curr); + } + } else { + humanValue = reverseLookup(enumInfo.members, numValue); + } + } else if (member.type == "bool") { + value = !!numValue; + humanValue = value ? "true" : "false"; + } else if (member.unit === "ms") + humanValue = prettyDuration(value); + else if (member.unit === "us") + humanValue = prettyMicroDuration(value); + else if (member.unit || scaledValue != numValue) { + let v = scaledValue; + if (member.unit) + v = roundWithPrecision(v, 3); + humanValue = "" + v; + if (member.unit) + humanValue += prettyUnit2(member.unit); + } else { + humanValue = scaledValue + ""; + if ((scaledValue | 0) == scaledValue && (!member.unit || scaledValue >= 15)) { + if (!member.unit) + humanValue = hexNum(scaledValue); + else + humanValue += " (" + hexNum(scaledValue) + ")"; + } else if (scaledValue && member.storage == 8) { + const did = toHex2(pkt.data.slice(offset, offset + 8)); + humanValue += ` (${did} / ${shortDeviceId(did)})`; + } + } + } + return { + value, + numValue, + scaledValue, + humanValue, + description: member.name + ":" + (!humanValue ? "?" : humanValue.indexOf("\n") >= 0 ? "\n" + humanValue.replace(/^/gm, " ") : " " + humanValue), + info: member, + size + }; + } + function decodeMembers(service, pktInfo, pkt, off = 0) { + const fields = pktInfo.fields.slice(0); + let startRep = fields.findIndex((f) => f.startRepeats); + let fidx = 0; + const res = []; + while (off < pkt.data.length) { + if (fidx >= fields.length && startRep >= 0) + fidx = startRep; + const member = fields[fidx++]; + if (!member) { + break; + } + const decoded = decodeMember(service, pktInfo, member, pkt, off); + if (decoded) { + off += decoded.size; + res.push(decoded); + } else { + break; + } + } + return res; + } + function wrapDecodedMembers(decoded) { + if (decoded.length == 0) + return " {}"; + else if (decoded.length == 1 && decoded[0].description.length < 60) + return " { " + decoded[0].description + " }"; + else + return " {\n" + decoded.map((d) => " " + d.description).join("\n") + "\n}"; + } + function syntheticPktInfo(kind, addr) { + return { + kind, + identifier: addr, + name: hexNum(addr), + description: "", + fields: [ + { + name: "_", + type: "bytes", + storage: 0 + } + ] + }; + } + function decodeRegister(service, pkt) { + const isSet2 = pkt.isRegisterSet; + const isGet = pkt.isRegisterGet; + if (!isSet2 && !isGet) + return null; + let error = ""; + const addr = pkt.serviceCommand & CMD_REG_MASK; + let regInfo = service == null ? void 0 : service.packets.find( + (p) => isRegister2(p) && p.identifier == addr + ); + if (!regInfo) { + regInfo = syntheticPktInfo("rw", addr); + error = `unable to decode register`; + } + const decoded = decodeMembers(service, regInfo, pkt); + if (regInfo.packFormat && pkt.data.length) { + try { + const recoded = toHex2( + jdpack( + regInfo.packFormat, + jdunpack(pkt.data, regInfo.packFormat) + ) + ); + if (recoded !== void 0 && recoded !== toHex2(pkt.data)) { + error = `invalid data packing, ${toHex2( + pkt.data + )} recoded to ${recoded}`; + } + } catch (e) { + error = `invalid data packing, ${e.message}`; + } + } + let description = ""; + if (decoded.length == 0) + description = regInfo.name; + else if (decoded.length == 1) + description = regInfo.name + ": " + decoded[0].humanValue; + else + description = wrapDecodedMembers(decoded); + if (isGet) + description = "GET " + description; + else + description = "SET " + description; + return { + service, + info: regInfo, + decoded, + description, + error + }; + } + function decodeEvent(service, pkt) { + if (pkt.isCommand || !pkt.isEvent) + return null; + const evCode = pkt.eventCode; + const evInfo = (service == null ? void 0 : service.packets.find( + (p) => p.kind == "event" && p.identifier == evCode + )) || syntheticPktInfo("event", evCode); + const decoded = decodeMembers(service, evInfo, pkt); + const description = `EVENT[${pkt.eventCounter}] ${evInfo.name}` + wrapDecodedMembers(decoded); + return { + service, + info: evInfo, + decoded, + description + }; + } + function decodeCommand(service, pkt) { + const kind = pkt.isCommand ? "command" : "report"; + const cmdInfo = (service == null ? void 0 : service.packets.find( + (p) => p.kind == kind && p.identifier == pkt.serviceCommand + )) || syntheticPktInfo(kind, pkt.serviceCommand); + const decoded = decodeMembers(service, cmdInfo, pkt); + const description = (pkt.isCommand ? "CMD " : "REPORT ") + cmdInfo.name + wrapDecodedMembers(decoded); + return { + service, + info: cmdInfo, + decoded, + description + }; + } + function decodeCRCack(service, pkt) { + if (!pkt.isReport || !pkt.isCRCAck) + return null; + return { + service, + info: syntheticPktInfo("report", pkt.serviceCommand), + decoded: [], + description: "CRC-ACK " + hexNum(pkt.serviceCommand) + }; + } + function decodePacket(service, pkt) { + const decoded = decodeCRCack(service, pkt) || decodeRegister(service, pkt) || decodeEvent(service, pkt) || decodeCommand(service, pkt); + return decoded; + } + function decodePipe(pkt) { + const cmd = pkt.serviceCommand; + const pinfo = pkt.device.port(cmd >> PIPE_PORT_SHIFT); + if (!pinfo.pipeType) + return null; + const [servId, pipeType, dir] = pinfo.pipeType.split(/\./); + const service = serviceSpecificationFromName(servId); + if (!service) + return null; + const meta = !!(cmd & PIPE_METADATA_MASK); + const candidates = service.packets.filter( + (p) => p.pipeType == pipeType && /pipe/.test(p.kind) && /meta/.test(p.kind) == meta && /command/.test(p.kind) == (dir == "command") + ).filter( + (p) => !meta || pkt.getNumber(4, 0) == p.identifier + ); + const cmdInfo = candidates[0]; + if (cmdInfo) { + const decoded = decodeMembers(service, cmdInfo, pkt, meta ? 4 : 0); + const description = cmdInfo.kind.toUpperCase() + " " + cmdInfo.name + wrapDecodedMembers(decoded); + return { + service, + info: cmdInfo, + decoded, + description + }; + } + return null; + } + function decodePacketData(pkt) { + try { + if (pkt.device && pkt.isPipe) { + const info = decodePipe(pkt); + if (info) + return info; + } + const serviceClass2 = pkt.serviceClass; + const service = serviceSpecificationFromClassIdentifier(serviceClass2); + return decodePacket(service, pkt); + } catch (error) { + console.error(error, { + error, + pkt, + data: toHex2(pkt.data) + }); + throw error; + } + } + function reverseLookup(map, n) { + for (const k of Object.keys(map)) { + if (map[k] == n) + return k; + } + return hexNum(n); + } + function serviceName(serviceClass2) { + if (!isSet(serviceClass2)) + return "?"; + const serv = serviceSpecificationFromClassIdentifier(serviceClass2); + return serv ? serv.name.toUpperCase() : "?"; + } + function commandName(n, serviceClass2) { + var _a, _b, _c, _d; + let pref = ""; + if ((n & CMD_TOP_MASK) == CMD_SET_REG) + pref = "SET["; + else if ((n & CMD_TOP_MASK) == CMD_GET_REG) + pref = "GET["; + if (pref) { + const reg = n & CMD_REG_MASK; + let regName = (_a = SystemReg2[reg]) == null ? void 0 : _a.toLowerCase(); + if (regName === void 0) { + const serviceSpec = serviceSpecificationFromClassIdentifier(serviceClass2); + regName = (_b = serviceSpec == null ? void 0 : serviceSpec.packets.find( + (pkt) => isRegister2(pkt) && pkt.identifier === reg + )) == null ? void 0 : _b.name; + } + return pref + (regName !== void 0 ? regName : `x${reg.toString(16)}`) + "]"; + } + let r = (_c = SystemCmd2[n]) == null ? void 0 : _c.toLowerCase(); + if (r === void 0) { + const serviceSpec = serviceSpecificationFromClassIdentifier(serviceClass2); + r = (_d = serviceSpec == null ? void 0 : serviceSpec.packets.find( + (pkt) => (pkt.kind === "command" || pkt.kind === "report") && pkt.identifier === n + )) == null ? void 0 : _d.name; + } + return r; + } + function toAscii(d) { + let r = ""; + for (let i = 0; i < d.length; ++i) { + const c = d[i]; + if (c < 32 || c >= 127) + r += "."; + else + r += String.fromCharCode(c); + } + return r; + } + function hexDump(d) { + const chunk = 32; + if (d.length <= chunk) + return toHex2(d) + "\xA0|\xA0" + toAscii(d); + const a = toArray(d); + let r = ""; + for (let i = 0; i < d.length; i += chunk) { + if (i + chunk >= d.length) { + let s = toHex2(a.slice(i)); + while (s.length < chunk * 2) + s += " "; + r += s + "\xA0|\xA0" + toAscii(a.slice(i)); + } else { + r += hexDump(a.slice(i, i + chunk)) + "\n"; + } + } + return r; + } + var { warn, debug } = console; + var _Packet = class { + constructor() { + this._meta = void 0; + this.key = _Packet._nextKey++; + } + static fromBinary(data, timestamp2) { + if (!data || data.length > 252) + return void 0; + const p = new _Packet(); + p._header = data.slice(0, JD_SERIAL_HEADER_SIZE); + p._data = data.slice( + JD_SERIAL_HEADER_SIZE, + JD_SERIAL_HEADER_SIZE + p.size + ); + p.sender = data._jacdac_sender; + p.timestamp = timestamp2 != null ? timestamp2 : data._jacdac_timestamp; + return p; + } + static from(service_command, data) { + const p = new _Packet(); + p._header = new Uint8Array(JD_SERIAL_HEADER_SIZE); + p.data = data; + p.serviceCommand = service_command; + return p; + } + static onlyHeader(service_command) { + return _Packet.from(service_command, new Uint8Array(0)); + } + toBuffer() { + const res = bufferConcat(this._header, this._data); + res[2] = this._data.length + 4; + write16(res, 0, crc(res.slice(2))); + res._jacdac_sender = this.sender; + res._jacdac_timestamp = this.timestamp; + return res; + } + get header() { + return this._header.slice(0); + } + get deviceIdentifier() { + return toHex2(this._header.slice(4, 4 + 8)); + } + set deviceIdentifier(id) { + if (id !== this.deviceIdentifier) { + const idb = fromHex(id); + if (idb.length != 8) + throwError("Invalid id"); + if (this.isMultiCommand) + throwError("Invalid multicast"); + this._header.set(idb, 4); + this._decoded = void 0; + this.device = void 0; + } + } + get frameFlags() { + return this._header[3]; + } + set frameFlags(v) { + this._header[3] = v; + } + get isMultiCommand() { + return !!(this.frameFlags & JD_FRAME_FLAG_IDENTIFIER_IS_SERVICE_CLASS); + } + get size() { + return this._header[12]; + } + get requiresAck() { + return this.frameFlags & JD_FRAME_FLAG_ACK_REQUESTED ? true : false; + } + set requiresAck(ack) { + if (ack != this.requiresAck) + this._header[3] ^= JD_FRAME_FLAG_ACK_REQUESTED; + this._decoded = void 0; + } + get serviceIndex() { + return this._header[13] & JD_SERVICE_INDEX_MASK; + } + set serviceIndex(value) { + if (value == null) + throw new Error("service_index not set"); + this._header[13] = this._header[13] & JD_SERVICE_INDEX_INV_MASK | value; + this._decoded = void 0; + } + get serviceClass() { + var _a; + if (this.isMultiCommand) + return read322(this._header, 4); + if (this.serviceIndex === 0) + return SRV_CONTROL2; + return (_a = this.device) == null ? void 0 : _a.serviceClassAt(this.serviceIndex); + } + get crc() { + return read16(this._header, 0); + } + get serviceCommand() { + return read16(this._header, 14); + } + set serviceCommand(cmd) { + write16(this._header, 14, cmd); + this._decoded = void 0; + } + get isRegisterSet() { + return this.serviceIndex <= JD_SERVICE_INDEX_MAX_NORMAL && this.serviceCommand >> 12 == CMD_SET_REG >> 12; + } + get isRegisterGet() { + return this.serviceIndex <= JD_SERVICE_INDEX_MAX_NORMAL && this.serviceCommand >> 12 == CMD_GET_REG >> 12; + } + // TODO rename to registerCode + get registerIdentifier() { + if (!this.isRegisterGet && !this.isRegisterSet) + return void 0; + return this.serviceCommand & CMD_REG_MASK; + } + get isEvent() { + return this.serviceIndex <= JD_SERVICE_INDEX_MAX_NORMAL && (this.serviceCommand & CMD_EVENT_MASK) !== 0; + } + get eventCode() { + return this.isEvent ? this.serviceCommand & CMD_EVENT_CODE_MASK : void 0; + } + get eventCounter() { + return this.isEvent ? this.serviceCommand >> CMD_EVENT_COUNTER_POS & CMD_EVENT_COUNTER_MASK : void 0; + } + get isCRCAck() { + return this.serviceIndex === JD_SERVICE_INDEX_CRC_ACK; + } + get isPipe() { + return this.serviceIndex === JD_SERVICE_INDEX_PIPE; + } + get pipePort() { + return this.isPipe && this.serviceCommand >> PIPE_PORT_SHIFT; + } + get pipeCount() { + return this.isPipe && this.serviceCommand & PIPE_COUNTER_MASK; + } + get data() { + return this._data; + } + set data(buf) { + if (buf.length > JD_SERIAL_MAX_PAYLOAD_SIZE) + throw Error( + `jacdac packet length too large, ${buf.length} > ${JD_SERIAL_MAX_PAYLOAD_SIZE} bytes` + ); + this._header[12] = buf.length; + this._data = buf; + this._decoded = void 0; + } + jdunpack(fmt) { + return this._data && fmt && jdunpack(this._data, fmt) || []; + } + get uintData() { + let buf = this._data; + if (buf.length == 0) + return void 0; + if (buf.length < 4) + buf = bufferConcat(buf, new Uint8Array(4)); + if (buf.length == 8) + return read322(buf, 0) + read322(buf, 4) * 4294967296; + return read322(buf, 0); + } + get stringData() { + return this._data && bufferToString(this._data); + } + get intData() { + let fmt; + switch (this._data.length) { + case 0: + return void 0; + case 1: + fmt = 1; + break; + case 2: + case 3: + fmt = 3; + break; + default: + fmt = 5; + break; + } + return this.getNumber(fmt, 0); + } + get isAnnounce() { + return this.serviceIndex == JD_SERVICE_INDEX_CTRL && this.isReport && this.serviceCommand == 0; + } + get isRepeatedAnnounce() { + var _a; + return this.isAnnounce && ((_a = this.device) == null ? void 0 : _a.lastServiceUpdate) < this.timestamp; + } + get decoded() { + if (!this._decoded) + this._decoded = decodePacketData(this); + return this._decoded; + } + get meta() { + if (!this._meta) + this._meta = {}; + return this._meta; + } + clone() { + const pkt = new _Packet(); + pkt._header = this._header.slice(); + pkt._data = this._data.slice(); + pkt.timestamp = this.timestamp; + return pkt; + } + cloneForDevice(deviceId, serviceIndex) { + const idb = fromHex(deviceId); + if (idb.length != 8) + throwError("Invalid id"); + if (!this.isMultiCommand) + throwError("Must be multi command"); + const pkt = _Packet.fromBinary(this.toBuffer(), this.timestamp); + pkt.frameFlags &= ~JD_FRAME_FLAG_IDENTIFIER_IS_SERVICE_CLASS; + pkt._header.set(idb, 4); + pkt._decoded = void 0; + pkt.sender = void 0; + pkt.serviceIndex = serviceIndex; + return pkt; + } + compress(stripped) { + if (stripped.length == 0) + return; + let sz = -4; + for (const s of stripped) { + sz += s.length; + } + const data = new Uint8Array(sz); + this._header.set(stripped[0], 12); + data.set(stripped[0].slice(4), 0); + sz = stripped[0].length - 4; + for (const s of stripped.slice(1)) { + data.set(s, sz); + sz += s.length; + } + this._data = data; + this._decoded = void 0; + } + withFrameStripped() { + return bufferConcat(this._header.slice(12, 12 + 4), this._data); + } + getNumber(fmt, offset) { + return getNumber(this._data, fmt, offset); + } + get isCommand() { + return !!(this.frameFlags & JD_FRAME_FLAG_COMMAND); + } + set isCommand(value) { + if (value) + this._header[3] |= JD_FRAME_FLAG_COMMAND; + else + this._header[3] &= ~JD_FRAME_FLAG_COMMAND; + this._decoded = void 0; + } + get isReport() { + return !this.isCommand; + } + assignDevice(bus) { + if (!this.isMultiCommand && !this.device) + this.device = bus.device(this.deviceIdentifier, false, this); + } + toString() { + let msg = `${shortDeviceId(this.deviceIdentifier)}/${this.serviceIndex}[${this.frameFlags}]: 0x${this.serviceCommand.toString(16)} sz=${this.size}`; + if (this.size < 20) + msg += ": " + toHex2(this.data); + else + msg += ": " + toHex2(this.data.slice(0, 20)) + "..."; + return msg; + } + sendCoreAsync(bus) { + const buf = this.toBuffer(); + this._header[0] = buf[0]; + this._header[1] = buf[1]; + this._header[2] = buf[2]; + this.assignDevice(bus); + return bus.sendPacketAsync(this); + } + sendReportAsync(dev) { + if (!dev) + return Promise.resolve(); + this.deviceIdentifier = dev.deviceId; + this.device = dev; + return this.sendCoreAsync(dev.bus); + } + sendCmdAsync(dev) { + if (!dev) + return Promise.resolve(); + this.deviceIdentifier = dev.deviceId; + this.device = dev; + this.isCommand = true; + return this.sendCoreAsync(dev.bus); + } + sendAsMultiCommandAsync(bus, service_class) { + this._header[3] |= JD_FRAME_FLAG_IDENTIFIER_IS_SERVICE_CLASS | JD_FRAME_FLAG_COMMAND; + write32(this._header, 4, service_class); + write32(this._header, 8, JD_DEVICE_IDENTIFIER_BROADCAST_HIGH_MARK); + this.serviceIndex = JD_SERVICE_INDEX_BROADCAST; + return this.sendCoreAsync(bus); + } + static fromFrame(frame, timestamp2, skipCrc = false) { + return frameToPackets(frame, timestamp2, skipCrc); + } + static jdpacked(service_command, fmt, nums) { + return _Packet.from(service_command, jdpack(fmt, nums)); + } + // helpers + get friendlyDeviceName() { + var _a; + if (this.isMultiCommand) + return "*"; + return ((_a = this.device) == null ? void 0 : _a.friendlyName) || shortDeviceId(this.deviceIdentifier); + } + get friendlyServiceName() { + let service_name; + if (this.isCRCAck) { + service_name = "CRC-ACK"; + } else if (this.isPipe) { + service_name = "PIPE"; + } else { + const sc = this.serviceClass; + if (sc === void 0) + return `(${this.serviceIndex})`; + else { + const serv_id = serviceName(sc); + service_name = `${serv_id === "?" ? hexNum(sc) : serv_id} (${this.serviceIndex})`; + } + } + return service_name; + } + get friendlyCommandName() { + const cmd = this.serviceCommand; + let cmdname; + if (this.isCRCAck) { + cmdname = hexNum(cmd); + } else if (this.isPipe) { + cmdname = `port:${cmd >> PIPE_PORT_SHIFT} cnt:${cmd & PIPE_COUNTER_MASK}`; + if (cmd & PIPE_METADATA_MASK) + cmdname += " meta"; + if (cmd & PIPE_CLOSE_MASK) + cmdname += " close"; + } else if (this.isEvent) { + const spec = serviceSpecificationFromClassIdentifier( + this.serviceClass + ); + const code = this.eventCode; + const pkt = spec == null ? void 0 : spec.packets.find( + (pkt2) => pkt2.kind === "event" && pkt2.identifier === code + ); + cmdname = pkt == null ? void 0 : pkt.name; + } else { + cmdname = commandName(cmd, this.serviceClass); + } + return cmdname; + } + }; + var Packet = _Packet; + Packet._nextKey = 1; + function frameToPackets(frame, timestamp2, skipCrc = false) { + if (timestamp2 === void 0) + timestamp2 = frame._jacdac_timestamp; + const size = frame.length < 12 ? 0 : frame[2]; + if (frame.length < size + 12) { + warn( + `${timestamp2 | 0}ms: got only ${frame.length} bytes; expecting ${size + 12}` + ); + return []; + } else if (size < 4) { + warn(`${timestamp2 | 0}ms: empty packet`); + return []; + } else { + if (frame.length != 12 + size) { + warn(`${timestamp2 | 0}ms: unexpected packet len: ${frame.length}`); + return []; + } + if (!skipCrc) { + const computed = crc(frame.slice(2, size + 12)); + const actual = read16(frame, 0); + if (actual != computed) { + warn( + `${timestamp2 | 0}ms: crc mismatch; sz=${size} got:${actual}, exp:${computed}, ${toHex2( + frame + )}` + ); + return []; + } + } + const res = []; + for (let ptr = 12; ptr < 12 + size; ) { + const psz = frame[ptr] + 4; + const sz = ALIGN(psz); + if (ptr + psz > 12 + size) { + warn( + `${timestamp2 | 0}ms: invalid frame compression, res len=${res.length}` + ); + break; + } + const pkt = bufferConcat( + frame.slice(0, 12), + frame.slice(ptr, ptr + psz) + ); + const p = Packet.fromBinary(pkt); + p.timestamp = timestamp2; + p.sender = frame._jacdac_sender; + res.push(p); + if (res.length > 1) + p.requiresAck = false; + ptr += sz; + } + return res; + } + } + function stack() { + return new Error().stack; + } + function normalizeEventNames(eventNames) { + if (!eventNames) + eventNames = []; + if (typeof eventNames === "string") + eventNames = [eventNames]; + return eventNames; + } + var nextNodeId = 0; + var JDEventSource = class { + /** + * @internal + */ + constructor() { + this.nodeId = nextNodeId++; + this.listeners = {}; + this.eventStats = {}; + this.newListenerStats = void 0; + } + /** + * Registers a handler for one or more events + * @param eventName name or names of the events to subscribe + * @param handler handler to register + * @returns current object instance + * @category JDOM + */ + on(eventName, handler) { + if (!handler) + return this; + normalizeEventNames(eventName).forEach( + (eventName2) => this.addListenerInternal(eventName2, handler, false) + ); + return this; + } + /** + * Unregisters a handler for one or more events + * @param eventName name or names of the events to subscribe + * @param handler handler to unregister + * @returns current object instance + * @category JDOM + */ + off(eventName, handler) { + normalizeEventNames(eventName).forEach( + (eventName2) => this.removeListenerInternal(eventName2, handler) + ); + return this; + } + /** + * Registers a handler for one or more events to run only once. + * @param eventName name or names of the events to subscribe + * @param handler handler to execute + * @returns current object instance + * @category JDOM + */ + once(eventName, handler) { + normalizeEventNames(eventName).forEach( + (eventName2) => this.addListenerInternal(eventName2, handler, true) + ); + return this; + } + /** + * Awaits an event with a timeout. Throws JacdacError with timeout if operation does not return. + * @param eventName + * @param timeout + */ + async awaitOnce(eventName, token) { + if (!eventName) + return; + const p = new Promise((resolve) => { + const handler = () => resolve == null ? void 0 : resolve(); + this.once(eventName, handler); + token == null ? void 0 : token.mount(() => this.off(eventName, handler)); + }); + return p; + } + addListenerInternal(eventName, handler, once) { + if (!eventName || !handler) { + return; + } + const eventListeners = this.listeners[eventName] || (this.listeners[eventName] = []); + const listener = eventListeners.find( + (listener2) => listener2.handler === handler + ); + if (listener) { + listener.once = !!once; + return; + } + eventListeners.push({ + handler, + once: !!once, + // debug only collection of trace for leak detection + stackTrace: Flags.diagnostics && stack() + }); + this.emit(NEW_LISTENER, eventName, handler); + if (Flags.diagnostics) { + if (!this.newListenerStats) + this.newListenerStats = {}; + this.newListenerStats[eventName] = (this.newListenerStats[eventName] || 0) + 1; + } + } + removeListenerInternal(eventName, handler) { + if (!eventName || !handler) + return; + const eventListeners = this.listeners[eventName]; + if (eventListeners) { + for (let i = 0; i < eventListeners.length; ++i) { + const listener = eventListeners[i]; + if (handler === listener.handler) { + eventListeners.splice(i, 1); + this.emit(REMOVE_LISTENER, eventName, handler); + return; + } + } + } + } + /** + * Synchronously calls each of the listeners registered for the event named eventName, + * in the order they were registered, passing the supplied arguments to each. + * @param eventName + * @param args + * @category JDOM + */ + emit(eventName, ...args) { + if (!eventName) + return false; + this.eventStats[eventName] = (this.eventStats[eventName] || 0) + 1; + const eventListeners = this.listeners[eventName]; + if (!eventListeners || eventListeners.length == 0) { + if (eventName == ERROR && Flags.diagnostics) + console.debug(args[0]); + return false; + } + for (let i = 0; i < eventListeners.length; ++i) { + const listener = eventListeners[i]; + const handler = listener.handler; + if (listener.once) { + eventListeners.splice(i, 1); + --i; + } + try { + handler.apply(null, args); + } catch (e) { + if (eventName !== ERROR) + this.emit(ERROR, e); + } + } + return true; + } + /** + * Gets the number of listeners for a given event + * @param eventName name of the event + * @returns number of registered handlers + * @category JDOM + */ + listenerCount(eventName) { + if (!eventName) + return 0; + const listeners = this.listeners[eventName]; + return (listeners == null ? void 0 : listeners.length) || 0; + } + /** + * Gets the list stack trace where an event was registered. Only enabled if ``Flags.debug`` is true. + * @param eventName name of the event + * @returns stack traces where a listener was added + * @category JDOM + */ + listenerStackTraces(eventName) { + const listeners = this.listeners[eventName]; + return listeners == null ? void 0 : listeners.map((listener) => listener.stackTrace); + } + /** + * Returns an array listing the events for which the emitter has registered listeners. + * @category JDOM + */ + eventNames() { + return Object.keys(this.listeners); + } + /** + * Creates an observable from the given event + * @param eventName + * @category JDOM + */ + observe(eventName) { + return new EventObservable(this, normalizeEventNames(eventName)); + } + /** + * Subscribes to an event and returns the unsubscription handler + * @param eventName + * @param next + * @category JDOM + */ + subscribe(eventName, next) { + const observer = this.observe(eventName); + return observer.subscribe({ next }).unsubscribe; + } + /** + * Gets a counter for the ``CHANGE`` event. + * @category JDOM + */ + get changeId() { + return this.eventStats[CHANGE] || 0; + } + }; + var EventObservable = class { + constructor(eventEmitter, eventNames) { + this.eventEmitter = eventEmitter; + this.eventNames = eventNames; + } + subscribe(observer) { + if (observer.next) + this.eventEmitter.on(this.eventNames, observer.next); + if (observer.error) + this.eventEmitter.on(ERROR, observer.error); + return { + unsubscribe: () => { + if (observer.next) + this.eventEmitter.off(this.eventNames, observer.next); + if (observer.error) + this.eventEmitter.off(ERROR, observer.error); + } + }; + } + }; + function defaultFieldPayload(specification) { + let r = void 0; + switch (specification.type) { + case "bool": + r = 0; + break; + case "i8": + case "i16": + case "i32": + case "u8": + case "u16": + case "u32": { + const min = pick( + specification.typicalMin, + specification.absoluteMin, + void 0 + ); + const max = pick( + specification.typicalMax, + specification.absoluteMax, + void 0 + ); + if (max !== void 0 && min !== void 0) + r = (max + min) / 2; + else + r = 0; + break; + } + case "bytes": { + r = new Uint8Array(0); + break; + } + case "string": + case "string0": { + r = ""; + break; + } + } + if (/^(u0|i1)\.\d+$/.test(specification.type)) + r = 0; + return r; + } + function defaultPayload(specification) { + const { fields } = specification; + const rs = fields.map(defaultFieldPayload); + return rs; + } + var JDRegisterServer = class extends JDEventSource { + constructor(service, identifier, defaultValue) { + var _a, _b; + super(); + this.service = service; + this.identifier = identifier; + this.skipBoundaryCheck = false; + this.skipErrorInjection = false; + this.allowLargeFrames = false; + const serviceSpecification = this.service.specification; + this.specification = serviceSpecification.packets.find( + (pkt) => isRegister2(pkt) && pkt.identifier === this.identifier + ); + let v = defaultValue; + if (!v && !this.specification.optional) + v = defaultPayload(this.specification); + if (v !== void 0 && !v.some((vi) => vi === void 0)) { + this.data = jdpack(this.packFormat, v); + } + this.resetData = (_a = this.data) == null ? void 0 : _a.slice(0); + this.skipBoundaryCheck = !((_b = this.specification) == null ? void 0 : _b.fields.some( + (field) => isSet(field.absoluteMin) || isSet(field.absoluteMax) + )); + } + get packFormat() { + return this.specification.packFormat; + } + values() { + return jdunpack(this.data, this.packFormat); + } + normalize(values2) { + var _a; + if (!this.skipBoundaryCheck) { + (_a = this.specification) == null ? void 0 : _a.fields.forEach((field, fieldi) => { + if (field.isSimpleType) { + let value = values2[fieldi]; + const min = field.absoluteMin; + if (min !== void 0) + value = Math.max(min, value); + const max = field.absoluteMax; + if (max !== void 0) + value = Math.min(max, value); + values2[fieldi] = value; + } + }); + } + this.emit(PACKET_DATA_NORMALIZE, values2); + } + shouldNormalize() { + return !this.skipBoundaryCheck || this.listenerCount(PACKET_DATA_NORMALIZE); + } + /** + * Sets the value on the register + * @param values values to set + * @param skipChangeEvent true to avoid emitting CHANGE + * @returns true if values changed; false otherwise + */ + setValues(values2, skipChangeEvent) { + if (this.readOnly) + return false; + if (this.shouldNormalize()) + this.normalize(values2); + if (this.valueProcessor) + values2 = this.valueProcessor(values2); + const d = jdpack(this.packFormat, values2); + if (!bufferEq(this.data, d)) { + this.data = d; + if (!skipChangeEvent) + this.emit(CHANGE); + return true; + } + return false; + } + reset() { + var _a; + this.data = (_a = this.resetData) == null ? void 0 : _a.slice(0); + } + async sendGetAsync() { + var _a; + this.emit(REGISTER_PRE_GET); + let d = this.data; + if (!d) + return; + if (this.allowLargeFrames && d.length > JD_SERIAL_MAX_PAYLOAD_SIZE) { + d = new Uint8Array(0); + } + const error = !this.skipErrorInjection && ((_a = this.errorRegister) == null ? void 0 : _a.values()[0]); + if (error && !isNaN(error)) { + const vs = this.values(); + for (let i = 0; i < vs.length; ++i) { + vs[i] += Math.random() * error; + } + d = jdpack(this.packFormat, vs); + } + await this.service.sendPacketAsync( + Packet.from(this.identifier | CMD_GET_REG, d) + ); + } + handlePacket(pkt) { + if (this.identifier !== pkt.registerIdentifier) + return false; + if (pkt.isRegisterGet) { + this.sendGetAsync(); + } else if (this.identifier >> 8 !== 1) { + let changed = false; + let d = pkt.data; + if (this.shouldNormalize() || this.valueProcessor) { + try { + let values2 = jdunpack(d, this.packFormat); + if (this.shouldNormalize()) + this.normalize(values2); + if (this.valueProcessor) + values2 = this.valueProcessor(values2); + d = jdpack(this.packFormat, values2); + } catch (e) { + this.emit(PACKET_INVALID_DATA, pkt); + } + } + if (!bufferEq(this.data, d)) { + this.data = d; + changed = true; + } + this.lastSetTime = this.service.timestamp; + this.emit(REPORT_RECEIVE); + if (changed) + this.emit(CHANGE); + } + return true; + } + }; + var CALIBRATION_DELAY = 5e3; + var JDServiceServer = class extends JDEventSource { + constructor(serviceClass2, options) { + super(); + this.serviceClass = serviceClass2; + this.serviceIndex = -1; + this._registers = []; + this.commands = {}; + this._locked = false; + const { + instanceName, + variant, + valueValues, + intensityValues, + intensityProcessor, + registerValues, + clientVariant, + isActive + } = options || {}; + this.specification = serviceSpecificationFromClassIdentifier( + this.serviceClass + ); + this.statusCode = this.addRegister( + 259, + [0, 0] + ); + if (valueValues) + this.addRegister(2, valueValues); + if (intensityValues) { + const intensity = this.addRegister( + 1, + intensityValues + ); + if (intensityProcessor) + intensity.valueProcessor = intensityProcessor; + if (isActive) + intensity.on(CHANGE, () => { + const ev = isActive(intensity.values()); + if (ev !== void 0) + this.sendEvent( + isActive(intensity.values()) ? 1 : 2 + /* Inactive */ + ); + }); + } + if (variant) + this.addRegister(263, [variant]); + if (clientVariant) + this.addRegister(9, [clientVariant]); + this.instanceName = this.addRegister(265, [ + instanceName || "" + ]); + registerValues == null ? void 0 : registerValues.forEach( + ({ code, values: values2 }) => this.addRegister(code, values2) + ); + this.statusCode.on( + CHANGE, + () => this.sendEvent(4, this.statusCode.data) + ); + if (this.specification.packets.find( + (pkt) => pkt.kind === "command" && pkt.identifier === 2 + /* Calibrate */ + )) { + this.addCommand( + 2, + this.handleCalibrate.bind(this) + ); + this.statusCode.setValues( + [100, 0], + true + ); + } + this.handleTwinPacket = this.handleTwinPacket.bind(this); + } + get device() { + return this._device; + } + set device(value) { + if (this._device !== value) { + this._device = value; + this.emit(DEVICE_CHANGE); + this.emit(CHANGE); + } + } + get twin() { + return this._twin; + } + set twin(service) { + if (service === this._twin) + return; + if (this._twin) { + this._twin.off(PACKET_RECEIVE, this.handleTwinPacket); + this._twin.off(PACKET_SEND, this.handleTwinPacket); + this._twinCleanup.forEach((tw) => tw()); + } + this._twin = service; + this._twinCleanup = service ? [] : void 0; + if (this._twin) { + this._twin.on(PACKET_RECEIVE, this.handleTwinPacket); + this._twin.on(PACKET_SEND, this.handleTwinPacket); + this._twin.registers().forEach((twinReg) => { + const reg = this.register(twinReg.code); + if (reg) { + reg == null ? void 0 : reg.setValues(twinReg.unpackedValue); + this._twinCleanup.push( + twinReg.subscribe( + REPORT_UPDATE, + () => reg.setValues(twinReg.unpackedValue) + ) + ); + } + }); + } + this.emit(CHANGE); + } + handleTwinPacket(pkt) { + this.handlePacket(pkt); + } + get registers() { + return this._registers.slice(0); + } + get timestamp() { + var _a, _b, _c; + const bus = ((_a = this.device) == null ? void 0 : _a.bus) || ((_c = (_b = this._twin) == null ? void 0 : _b.device) == null ? void 0 : _c.bus); + return bus == null ? void 0 : bus.timestamp; + } + register(code) { + return this._registers.find( + (reg) => reg.identifier === code + ); + } + addExistingRegister(reg) { + this._registers.push(reg); + return reg; + } + addRegister(identifier, defaultValue) { + let reg = this._registers.find( + (r) => r.identifier === identifier + ); + if (!reg && !this._locked) { + if (!this.specification.packets.find( + (pkt) => isRegister2(pkt) && pkt.identifier === identifier + )) + return void 0; + reg = new JDRegisterServer(this, identifier, defaultValue); + this._registers.push(reg); + } + return reg; + } + reset() { + this.registers.forEach((reg) => reg.reset()); + } + /** + * Locks the current set of registers + */ + lock() { + this._locked = true; + } + addCommand(identifier, handler) { + if (this._locked) + console.error(`adding command to locked service`); + this.commands[identifier] = handler; + } + async handlePacket(pkt) { + if (pkt.isRegisterGet || pkt.isRegisterSet) { + const rid = pkt.registerIdentifier; + let reg = this._registers.find((r) => r.identifier === rid); + if (!reg) { + reg = this.addRegister(rid); + } + reg == null ? void 0 : reg.handlePacket(pkt); + } else if (pkt.isCommand) { + const cmd = this.commands[pkt.serviceCommand]; + if (cmd) + cmd(pkt); + else if (cmd === void 0) + console.debug(`ignored command`, { pkt }); + } + } + async sendPacketAsync(pkt) { + if (this.twin) + return; + pkt.serviceIndex = this.serviceIndex; + await this.device.sendPacketAsync(pkt); + } + async sendEvent(eventCode, data) { + if (this.twin) + return; + const { device } = this; + if (!device) + return; + const { bus } = device; + if (!bus) + return; + const now = bus.timestamp; + const cmd = device.createEventCmd(eventCode); + const pkt = Packet.from(cmd, data || new Uint8Array(0)); + await this.sendPacketAsync(pkt); + device.delayedSend(pkt, now + 20); + device.delayedSend(pkt, now + 100); + } + async handleCalibrate() { + const [status] = this.statusCode.values(); + if (status !== 0) + return; + this.calibrate(); + } + processLargeFrame(command, data) { + this.emit(FRAME_PROCESS_LARGE, command, data); + } + async calibrate() { + this.statusCode.setValues([2, 0]); + await this.device.bus.delay(CALIBRATION_DELAY); + this.statusCode.setValues([0, 0]); + } + }; + var SensorServer = class extends JDServiceServer { + constructor(serviceClass2, options) { + super(serviceClass2, options); + this.serviceClass = serviceClass2; + this.lastStream = 0; + this.lastErrorReadingChanged = false; + const { + readingValues, + streamingInterval, + preferredStreamingInterval, + readingError + } = options || {}; + this.reading = this.addRegister( + 257, + readingValues + ); + this.streamingSamples = this.addRegister( + 3 + /* StreamingSamples */ + ); + this.streamingInterval = this.addRegister( + 4, + [ + streamingInterval || preferredStreamingInterval || this.reading.specification.preferredInterval || STREAMING_DEFAULT_INTERVAL + ] + ); + if (preferredStreamingInterval !== void 0) + this.preferredStreamingInterval = this.addRegister( + 258, + [preferredStreamingInterval] + ); + if (readingError !== void 0) { + this.readingError = this.addRegister( + 262, + readingError + ); + this.reading.errorRegister = this.readingError; + this.readingError.on( + CHANGE, + () => this.lastErrorReadingChanged = true + ); + } + this.on(REFRESH, this.refreshRegisters.bind(this)); + } + refreshRegisters() { + var _a, _b, _c, _d, _e; + const [samples] = this.streamingSamples.values(); + if (samples <= 0 || !this.reading.data) + return; + let interval = (_b = (_a = this.streamingInterval) == null ? void 0 : _a.values()) == null ? void 0 : _b[0]; + if (interval === void 0) + interval = (_d = (_c = this.preferredStreamingInterval) == null ? void 0 : _c.values()) == null ? void 0 : _d[0]; + if (interval === void 0) + interval = this.reading.specification.preferredInterval; + if (interval === void 0) + interval = STREAMING_DEFAULT_INTERVAL; + const now = this.device.bus.timestamp; + if (now - this.lastStream > interval) { + this.lastStream = now; + this.streamingSamples.setValues([samples - 1]); + this.reading.sendGetAsync(); + this.emit(READING_SENT); + if (this.lastErrorReadingChanged) { + (_e = this.readingError) == null ? void 0 : _e.sendGetAsync(); + this.lastErrorReadingChanged = false; + } + } + } + }; + var JDClient = class extends JDEventSource { + constructor() { + super(); + this.unsubscribers = []; + this.unmounted = false; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + log(msg, arg) { + if (arg) + console.debug(msg, arg); + else + console.debug(msg); + } + mount(unsubscribe) { + this.unmounted = false; + if (unsubscribe && this.unsubscribers.indexOf(unsubscribe) < 0) + this.unsubscribers.push(unsubscribe); + return unsubscribe; + } + unmount() { + const us = this.unsubscribers; + this.unsubscribers = []; + us.forEach((u) => u()); + this.unmounted = true; + } + }; + var OutPipe = class { + constructor(device, port, hosted) { + this.device = device; + this.port = port; + this.hosted = hosted; + this._count = 0; + } + static from(bus, pkt, hosted) { + const [idbuf, port] = pkt.jdunpack("b[8] u16"); + const id = toHex2(idbuf); + const dev = bus.device(id, false, pkt); + return new OutPipe(dev, port, hosted); + } + get count() { + return this._count; + } + get isOpen() { + return this.device != null; + } + send(buf) { + return this.sendData(buf, 0, false); + } + sendMeta(buf) { + return this.sendData(buf, PIPE_METADATA_MASK, false); + } + async respondForEach(items, converter) { + const n = items.length; + for (let i = 0; i < n; ++i) { + const item = items[i]; + const data = converter(item); + await this.send(data); + } + await this.close(); + } + async sendData(buf, flags, closing) { + if (!this.device) { + if (closing) + return; + else + throwError("sending data over closed pipe"); + } + const cmd = this.port << PIPE_PORT_SHIFT | flags | this._count & PIPE_COUNTER_MASK; + const pkt = Packet.from(cmd, buf); + pkt.serviceIndex = JD_SERVICE_INDEX_PIPE; + try { + await this.device.sendPktWithAck(pkt); + } catch (e) { + this.free(); + if (closing) + console.debug(e); + else + throw e; + } + this._count++; + } + free() { + this.device = null; + this.port = null; + } + async close() { + try { + await this.sendData(new Uint8Array(0), PIPE_CLOSE_MASK, true); + } finally { + this.free(); + } + } + async sendBytes(data) { + const chunkSize = 224; + for (let i = 0; i < data.length; i += chunkSize) { + await this.send(data.slice(i, i + chunkSize)); + } + } + static async sendBytes(service, cmd, data, onProgress) { + const { device } = service; + onProgress == null ? void 0 : onProgress(0); + const resp = await service.sendCmdAwaitResponseAsync( + Packet.jdpacked(cmd, "u32", [data.length]), + 3e3 + ); + onProgress == null ? void 0 : onProgress(0.05); + const [pipePort] = jdunpack(resp.data, "u16"); + if (!pipePort) + throw new Error("wrong port " + pipePort); + const pipe = new OutPipe(device, pipePort); + const chunkSize = 224; + for (let i = 0; i < data.length; i += chunkSize) { + await pipe.send(data.slice(i, i + chunkSize)); + onProgress == null ? void 0 : onProgress(0.05 + i / data.length * 0.9); + } + await pipe.close(); + onProgress == null ? void 0 : onProgress(1); + } + }; + var _ButtonServer = class extends SensorServer { + constructor(instanceName, analog) { + super(SRV_BUTTON2, { + instanceName, + readingValues: [_ButtonServer.INACTIVE_VALUE], + streamingInterval: 50 + }); + this.analog = this.addRegister(384, [!!analog]); + this.on(REFRESH, this.handleRefresh.bind(this)); + } + get threshold() { + return this._threshold; + } + set threshold(value) { + if (value !== this._threshold) { + this._threshold = value; + this.analog.setValues([!!this._threshold]); + this.emit(CHANGE); + } + } + isActive() { + var _a, _b; + const [v] = this.reading.values(); + const t = ((_b = (_a = this.threshold) == null ? void 0 : _a.values()) == null ? void 0 : _b[0]) || 0.5; + return v > t; + } + async handleRefresh() { + const now = this.device.bus.timestamp; + if (this.isActive()) { + if (this._downTime === void 0) { + this._downTime = now; + this._nextHold = this._downTime + _ButtonServer.HOLD_TIME; + await this.sendEvent( + 1 + /* Down */ + ); + } else if (now > this._nextHold) { + const time = now - this._downTime; + this._nextHold = this.device.bus.timestamp + _ButtonServer.HOLD_TIME; + await this.sendEvent( + 129, + jdpack("u32", [time]) + ); + } + } else { + if (this._downTime !== void 0) { + const time = now - this._downTime; + this._downTime = void 0; + this._nextHold = void 0; + await this.sendEvent( + 2, + jdpack("u32", [time]) + ); + } + } + } + async down() { + this.reading.setValues([_ButtonServer.ACTIVE_VALUE]); + } + async up() { + this.reading.setValues([_ButtonServer.INACTIVE_VALUE]); + } + }; + var ButtonServer = _ButtonServer; + ButtonServer.HOLD_TIME = 500; + ButtonServer.INACTIVE_VALUE = 0; + ButtonServer.ACTIVE_VALUE = 1; + var _BuzzerServer = class extends JDServiceServer { + constructor(options) { + super(SRV_BUZZER2, options); + this.volume = this.addRegister(1, [0.2]); + this.addCommand(128, this.handlePlayTone.bind(this)); + } + handlePlayTone(pkt) { + const [period, , duration] = jdunpack( + pkt.data, + "u16 u16 u16" + ); + const frequency = 1e6 / period; + const [volume] = this.volume.values(); + this.emit(_BuzzerServer.PLAY_TONE, { + frequency, + duration, + volume + }); + } + }; + var BuzzerServer = _BuzzerServer; + BuzzerServer.PLAY_TONE = "playTone"; + var GAMEPAD_DPAD_BUTTONS = 1 | 4 | 2 | 8; + var GAMEPAD_ARCADE_BUTTONS = GAMEPAD_DPAD_BUTTONS | 16 | 32 | 64 | 128 | 512; + var GAMEPAD_DPAD_A_BUTTONS = GAMEPAD_DPAD_BUTTONS | 16; + var GAMEPAD_DPAD_AB_BUTTONS = GAMEPAD_DPAD_A_BUTTONS | 32; + var GAMEPAD_DPAD_XY_BUTTONS = GAMEPAD_DPAD_BUTTONS | 1024 | 2048; + var GAMEPAD_GAMEPAD_EXTRA_BUTTONS = 32 | 128 | 64 | 256; + var selectors = { + a: 4, + b: 5, + c: 6, + d: 7, + e: 8, + f: 9, + g: 10, + h: 11, + i: 12, + j: 13, + k: 14, + l: 15, + m: 16, + n: 17, + o: 18, + p: 19, + q: 20, + r: 21, + s: 22, + t: 23, + u: 24, + v: 25, + w: 26, + x: 27, + y: 28, + z: 29, + "1": 30, + "2": 31, + "3": 32, + "4": 33, + "5": 34, + "6": 35, + "7": 36, + "8": 37, + "9": 38, + "0": 39, + "!": 30, + "@": 31, + "#": 32, + $: 33, + "%": 34, + "^": 35, + "&": 36, + "*": 37, + "(": 38, + ")": 39, + enter: 40, + escape: 41, + backspace: 42, + tab: 43, + space: 44, + " ": 44, + "-": 45, + _: 45, + "=": 46, + "+": 46, + "[": 47, + "{": 47, + "]": 48, + "}": 48, + "\\": 49, + "|": 49, + // non-US # + "~": 50, + ";": 51, + ":": 51, + "'": 52, + '"': 52, + "`": 53, + ",": 54, + //"<": 0x37, + ".": 55, + //">": 0x37, + "/": 56, + "?": 56, + capslock: 57, + f1: 58, + f2: 59, + f3: 60, + f4: 61, + f5: 62, + f6: 63, + f7: 64, + f8: 65, + f9: 66, + f10: 67, + f11: 68, + f12: 69, + printscreen: 70, + scrolllock: 71, + pause: 72, + insert: 73, + home: 74, + pageup: 75, + delete: 76, + end: 77, + pagedown: 78, + arrowright: 79, + arrowleft: 80, + arrowdown: 81, + arrowup: 82, + numlock: 83, + numpaddivide: 84, + numpadmultiply: 85, + numpadsubstract: 86, + numpadadd: 87, + numpadenter: 88, + numpad1: 89, + numpad2: 90, + numpad3: 91, + numpad4: 92, + numpad5: 93, + numpad6: 94, + numpad7: 95, + numpad8: 96, + numpad9: 97, + numpad0: 98, + numpaddecimal: 99, + numpadequal: 103, + f13: 104, + f14: 105, + f15: 106, + f16: 107, + f17: 108, + f18: 109, + f19: 110, + f20: 111, + f21: 112, + f22: 113, + f23: 114, + f24: 115, + execute: 116, + help: 117, + contextmenu: 118, + select: 119, + stop: 120, + again: 121, + undo: 122, + cut: 123, + copy: 124, + paste: 125, + find: 126, + mute: 127, + volumeup: 128, + volumedown: 129, + numpadcomma: 133 + }; + var reverseSelectors = Object.keys( + selectors + ).reduce( + (r, key) => { + if (!r[selectors[key]]) + r[selectors[key]] = key; + return r; + }, + {} + ); + var _VibrationMotorServer = class extends JDServiceServer { + constructor(options) { + super(SRV_VIBRATION_MOTOR2, options); + this._animationStep = -1; + const { maxVibrations = 10 } = options || {}; + this.maxVibrations = this.addRegister( + 384, + [maxVibrations] + ); + this.addCommand( + 128, + this.handleVibrate.bind(this) + ); + this.on(REFRESH, this.handleRefresh.bind(this)); + } + handleRefresh() { + if (!this._animation) + return; + const { start, pattern } = this._animation; + const now = this.device.bus.timestamp; + const elapsed = now - start; + let t = 0; + for (let i = 0; i < pattern.length; ++i) { + const [duration, speed] = pattern[i]; + const dt = duration << 3; + t += dt; + if (t - dt <= elapsed && t > elapsed) { + if (this._animationStep !== i) { + this._animationStep = i; + this.emit(_VibrationMotorServer.VIBRATE_PATTERN, { + duration, + speed + }); + } + break; + } + } + if (elapsed > t) { + this._animation = void 0; + this._animationStep = -1; + this.emit(_VibrationMotorServer.VIBRATE_PATTERN, { + duration: 0, + speed: 0 + }); + this.emit(CHANGE); + } + } + handleVibrate(pkt) { + const [pattern] = pkt.jdunpack("r: u8 u0.8"); + this._animation = { + start: this.device.bus.timestamp, + pattern + }; + this._animationStep = -1; + if (pattern.length) { + const [duration, speed] = pattern[0]; + this._animationStep = 0; + this.emit(_VibrationMotorServer.VIBRATE_PATTERN, { + duration, + speed + }); + } + this.emit(CHANGE); + } + }; + var VibrationMotorServer = _VibrationMotorServer; + VibrationMotorServer.VIBRATE_PATTERN = "vibratePattern"; + var _MagneticFieldLevelServer = class extends SensorServer { + constructor(options) { + super(SRV_MAGNETIC_FIELD_LEVEL2, { + ...options, + readingValues: [0] + }); + this._state = 1; + this.reading.on(CHANGE, this.update.bind(this)); + } + active() { + this.reading.setValues([1]); + } + inactive() { + this.reading.setValues([0]); + } + get variant() { + const reg = this.register( + 263 + /* Variant */ + ); + const [v] = reg.values(); + return v; + } + update() { + const [strength] = this.reading.values(); + if (Math.abs(strength) >= _MagneticFieldLevelServer.ACTIVE_THRESHOLD) { + this.setState( + 3 + /* Active */ + ); + } else if (Math.abs(strength) <= _MagneticFieldLevelServer.INACTIVE_THRESHOLD) { + this.setState( + 2 + /* Inactive */ + ); + } else + this.setState( + 1 + /* Neutral */ + ); + } + setState(state) { + if (state === this._state) + return; + const variant = this.variant; + this._state = state; + switch (state) { + case 3: + this.sendEvent( + 1 + /* Active */ + ); + break; + case 2: + this.sendEvent( + 2 + /* Inactive */ + ); + break; + } + } + }; + var MagneticFieldLevelServer = _MagneticFieldLevelServer; + MagneticFieldLevelServer.ACTIVE_THRESHOLD = 0.3; + MagneticFieldLevelServer.INACTIVE_THRESHOLD = 0.1; + var SG90_STALL_TORQUE = 1.8; + var SG90_RESPONSE_SPEED = 0.12; + var microServo360Options = { + stallTorque: SG90_STALL_TORQUE, + // kg/cm + responseSpeed: SG90_RESPONSE_SPEED * 2, + // s/60deg + minAngle: 0, + maxAngle: 360 + }; + var soundSpectrum = { + readingValues: [new Uint8Array(0)], + intensityValues: [false], + registerValues: [ + { + code: 128, + values: [5] + }, + { + code: 129, + values: [-100] + }, + { + code: 130, + values: [-30] + }, + { + code: 131, + values: [0.8] + } + ] + }; + var JDServiceClient = class extends JDClient { + constructor(service) { + super(); + this.service = service; + const statusCodeChanged = this.service.event( + 4 + /* StatusCodeChanged */ + ); + this.mount(statusCodeChanged == null ? void 0 : statusCodeChanged.subscribe(EVENT, () => this.emit(CHANGE))); + } + get device() { + return this.service.device; + } + get bus() { + return this.device.bus; + } + get statusCode() { + var _a; + const reg = this.service.register( + 259 + /* StatusCode */ + ); + return (_a = reg.unpackedValue) == null ? void 0 : _a[0]; + } + toString() { + return `client of ${this.service}`; + } + }; + var devices_default = [ + { + id: "yahboom-microbitledv10", + name: "Microbit-LED", + company: "Yahboom", + description: "The expansion board integrates 24 programmable RGB lights and microphones, and you can control the on-board RGB lights by the microphone.", + makeCodeRepo: [ + { + target: "microbit", + name: "yahboom-microbitledv10", + slug: "pelikhan/yahboom-microbit-led-jacdac" + } + ], + connector: "noConnector", + link: "https://category.yahboom.net/products/rgbledb", + storeLink: [ + "https://category.yahboom.net/products/rgbledb" + ], + services: [ + 369743088, + 346888797 + ], + productIdentifiers: [ + 978358865 + ], + version: "1.0", + status: "stable" + }, + { + id: "yahboom-tinybitv13", + name: "Tiny-Bit", + company: "Yahboom", + description: "Tiny:bit is a robotic car for the micro:bit education market. It is compact, easy to assemble, and easy to move in tight spaces. The Tiny:bit smart car is based on the micro:bit development board design and uses the online code programming of MakeCode Editor. Rich sensor applications allow Tiny:bit for easy interaction. The Tiny:bit smart car has a set of alligator clips on the rear that can be creative and expand.", + makeCodeRepo: [ + { + target: "microbit", + name: "yahboom-tinybitv13", + slug: "pelikhan/Tiny-bitLib/tree/master/jacdac" + } + ], + connector: "noConnector", + link: "https://category.yahboom.net/products/tinybit", + storeLink: [ + "https://category.yahboom.net/products/tinybit" + ], + services: [ + 355063095, + 369743088, + 369743088, + 309087410, + 309087410, + 337275786, + 346888797 + ], + productIdentifiers: [ + 878674793 + ], + version: "1.3", + status: "stable" + }, + { + id: "unexpected-maker-feathers2esp32s2v20", + name: "FeatherS2 ESP32-S2", + company: "Unexpected Maker", + description: "The full-featured ESP32-S2 based development board in a Feather format from Unexpected Maker. The FeatherS2 is a power house, fully souped up with 16 MB of Flash memory (for firmware and file storage) and 8 MB of QSPI-based external PSRAM so you can have massive storage buffers.", + repo: "https://github.com/microsoft/devicescript-esp32", + firmwareSource: "https://github.com/microsoft/devicescript-esp32/blob/main/boards/esp32s2/feather_s2.board.json", + connector: "noConnector", + link: "https://feathers2.io/", + storeLink: [ + "https://unexpectedmaker.com/shop/feathers2-esp32-s2" + ], + services: [ + 413852154, + 342028028, + 341864092, + 471386691, + 343122531, + 400333340 + ], + productIdentifiers: [ + 824637191 + ], + version: "2.0", + status: "stable" + }, + { + id: "stmicroelectronics-bl475eiot01adevicescriptv00", + name: "B-L475E-IOT01A DeviceScript", + company: "STMicroelectronics", + description: "B-L475E-IOT01A running Jacdac firmware accessing built-in sensors and DeviceScript. Built with AzureRTOS.", + firmwareSource: "https://github.com/RLeclair/jacdac-azure-rtos/tree/master/STMicroelectronics/B-L475E-IOT01A", + connector: "noConnector", + link: "https://github.com/RLeclair/jacdac-azure-rtos/tree/master/STMicroelectronics/B-L475E-IOT01A", + storeLink: [ + "https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html" + ], + services: [ + 337754823, + 521405449, + 505087730, + 382210232, + 504462570, + 288680491 + ], + productIdentifiers: [ + 954528034 + ], + version: "0.0", + status: "stable" + }, + { + id: "sparkfun-gamerbitv00", + name: "gamer:bit", + company: "Sparkfun", + description: 'The SparkFun gamer:bit is a fun-filled "carrier" board for the micro:bit that, when combined with the micro:bit, provides you with a fully functional game system. Designed in a similar form factor to the classic Nintendo NES controller, the gamer:bit is equipped with a four-direction "D-pad" on the left side of the board and two action buttons on the right side of the board. The two push buttons on the micro:bit in the center function as start and select.', + makeCodeRepo: [ + { + target: "microbit", + name: "sparkfun-gamerbitv00", + slug: "pelikhan/pxt-gamer-bit/tree/master/jacdac" + } + ], + connector: "noConnector", + link: "https://www.sparkfun.com/products/retired/14215", + storeLink: [ + "https://www.sparkfun.com/products/retired/14215" + ], + services: [ + 277836886 + ], + productIdentifiers: [ + 929407584 + ], + version: "0.0", + status: "stable" + }, + { + id: "seeed-studio-xiaoesp32c3v00", + name: "XIAO ESP32C3", + company: "Seeed Studio", + description: "A tiny dev-board with ESP32-C3 from Seeed.", + repo: "https://github.com/microsoft/devicescript-esp32", + firmwareSource: "https://github.com/microsoft/devicescript-esp32/blob/main/boards/esp32c3/seeed_xiao_esp32c3.board.json", + connector: "noConnector", + storeLink: [ + "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html" + ], + services: [ + 413852154, + 342028028, + 341864092, + 343122531 + ], + productIdentifiers: [ + 1056926545 + ], + version: "0.0", + status: "stable" + }, + { + id: "roger-wagner-makerbitv10", + name: "MakerBit", + company: "Roger Wagner", + description: "The MakerBit board provides simple and efficient connections to the features of the BBC micro:bit. Easily and quickly add lights and touch sensors to school projects, models and art installations. There are enough connecting wires and LEDs for one project. The MakerBit can control a maximum of 12 LEDs and 12 touch sensors in any one project.", + makeCodeRepo: [ + { + target: "microbit", + name: "roger-wagner-makerbitv10-motor", + slug: "1010Technologies/pxt-makerbit-motor/jacdac" + }, + { + target: "microbit", + name: "roger-wagner-makerbitv10-touch", + slug: "1010Technologies/pxt-makerbit-touch/jacdac" + }, + { + target: "microbit", + name: "roger-wagner-makerbitv10-lcd1602", + slug: "1010Technologies/pxt-makerbit-lcd1602/jacdac" + } + ], + connector: "noConnector", + link: "https://makerbit.com/", + storeLink: [ + "https://makerbit.com/" + ], + services: [ + 385895640, + 343122531, + 523748714 + ], + productIdentifiers: [ + 1018020097 + ], + version: "1.0", + status: "stable" + }, + { + id: "raspberry-pi-picov00", + name: "Pico", + company: "Raspberry Pi", + description: "Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces.", + repo: "https://github.com/microsoft/devicescript-pico", + firmwareSource: "https://github.com/microsoft/devicescript-pico/blob/main/boards/rp2040/pico.board.json", + connector: "noConnector", + link: "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html", + storeLink: [ + "https://www.raspberrypi.com/products/raspberry-pi-pico/" + ], + productIdentifiers: [ + 1064181516 + ], + version: "0.0", + status: "stable" + }, + { + id: "raspberry-pi-picowv00", + name: "Pico W", + company: "Raspberry Pi", + description: "Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces. Raspberry Pi Pico W adds on-board single-band 2.4GHz wireless interfaces (802.11n) using the Infineon CYW43439 while retaining the Pico form factor. ", + repo: "https://github.com/microsoft/devicescript-pico", + firmwareSource: "https://github.com/microsoft/devicescript-pico/blob/main/boards/rp2040w/pico_w.board.json", + connector: "noConnector", + link: "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html", + storeLink: [ + "https://www.raspberrypi.com/products/raspberry-pi-pico/" + ], + services: [ + 413852154, + 342028028, + 341864092, + 471386691, + 343122531, + 400333340 + ], + productIdentifiers: [ + 978399748 + ], + version: "0.0", + status: "stable" + }, + { + id: "microbit-educational-foundation-microbitv2", + name: "micro:bit V2", + company: "microbit Educational Foundation", + description: "The new micro:bit V2 has a built-in microphone and speaker to allow sound-sensing and sound-making without the need to attach another device. It also introduces capacitive touch sensing, a power-saving mode and more computing power for the classroom.", + connector: "noConnector", + link: "https://microsoft.github.io/jacdac-docs/clients/makecode/microbit-jukebox/", + storeLink: [ + "https://www.microbit.org/buy/" + ], + productIdentifiers: [ + 854992189, + 888455511, + 1035770297, + 1049819173 + ], + transport: { + type: "usb", + requestDescription: "BBC micro:bit CMSIS-DAP" + }, + firmwares: [ + { + name: "Micro:bit Jukebox", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/microbit-jukebox.hex", + productIdentifier: 888455511 + }, + { + name: "Micro:bit MicroCode", + url: "https://microsoft.github.io/microcode/assets/firmware.hex", + productIdentifier: 1049819173 + } + ], + bootloader: { + driveName: "MICROBIT", + firmwareFormat: "hex" + }, + status: "stable", + relatedDevices: [ + "kittenbot-jacdaptorformicrobitv2v10" + ] + }, + { + id: "kittenbot-accelerometerv10", + name: "Accelerometer", + company: "KittenBot", + description: "Accelerometer sensors are devices used to measure acceleration or motion.", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 521405449 + ], + productIdentifiers: [ + 1031216668 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_lr" + }, + { + id: "kittenbot-duckybotkitv10", + name: "DuckyBot Kit", + company: "KittenBot", + description: " Dive into the enchanting world of robotics with DuckyBot, a delightful cardboard robot shaped like a cheerful yellow duck. Engineered around the groundbreaking Jacdac Elite Module Suite, DuckyBot offers young learners a quirky and entertaining gateway into the vast realm of electronics and robotics, integrating seamlessly with Microbit and Makecode platforms.", + storeLink: [ + "https://www.kittenbot.cc/products/duckybot-crafting-coding-and-quacking-with-robotics" + ], + tags: [ + "kit", + "microbit" + ], + version: "1.0", + status: "stable", + devices: [ + "kittenbot-powerv10", + "kittenbot-hapticoutputv10", + "kittenbot-accelerometerv10", + "kittenbot-relayv10", + "kittenbot-envsensorv10", + "kittenbot-rgbstripv10", + "kittenbot-servov10", + "kittenbot-ultrasonicsensorv10", + "kittenbot-hubv10", + "kittenbot-jacdaptorformicrobitv2v10", + "microbit-educational-foundation-microbitv2" + ], + relatedDevices: [ + "microbit-educational-foundation-microbitv2" + ] + }, + { + id: "kittenbot-envsensorv10", + name: "Env Sensor", + company: "KittenBot", + description: "Env Sensor is a device used to measure both the temperature and humidity of the surrounding environment.", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 998683858 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_lr" + }, + { + id: "kittenbot-grapebitv10", + name: "Grape:bit", + company: "KittenBot", + description: "Grape:bit is a programming main control board mainly for the second to third grade information technology learning and institutional teaching. Its core is the ESP32, which has the characteristics of high performance, wireless communication, and graphical programming.", + repo: "https://github.com/KittenBot/devicescript-esp32/tree/grapebit", + firmwareSource: "https://github.com/KittenBot/devicescript-esp32/blob/grapebit/boards/esp32c3/kitten_grapebit_c3.board.json", + connector: "edgeLowCurrentProviderConsumer", + storeLink: [ + "https://www.kittenbot.cc/products/kittenbot-grapebit-20-pack" + ], + services: [ + 288680491, + 521405449, + 343122531, + 458731991, + 282614377, + 385895640 + ], + productIdentifiers: [ + 952937357 + ], + transport: { + type: "serial", + vendorId: 4292 + }, + firmwares: [ + { + name: "Grape:bit", + url: "https://github.com/KittenBot/devicescript-esp32/releases/latest", + productIdentifier: 952937357 + } + ], + version: "1.0", + status: "stable" + }, + { + id: "kittenbot-hapticoutputv10", + name: "Haptic Output", + company: "KittenBot", + description: "The Haptic Output module is essentially a vibration motor that can be used to provide haptic feedback in electronic devices.", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 406832290 + ], + productIdentifiers: [ + 837852806 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_lr" + }, + { + id: "kittenbot-hubv10", + name: "Hub", + company: "KittenBot", + description: "A passthrough cable hub.", + connector: "edgePassive", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + tags: [ + "hub" + ], + version: "1.0", + status: "stable" + }, + { + id: "kittenbot-jacdacdeveloperstoolelectronicmodulekitbv10", + name: "Jacdac Developer's-tool Electronic module Kit B", + company: "KittenBot", + description: "Dive deep into the forefront of electronic interfacing with the Jacdac Elite Module Suite. Built on the bedrock of Microsoft's avant-garde Jacdac protocol, this suite aggregates an array of meticulously crafted modules, setting the gold standard for next-gen electronic projects.\n\nIt Includes:\n\nJacdac-Power X1\nJacdac-Haptic Output X1\nJacdac-Accelerometer X1\nJacdac-Relay X1\nJacdac-Env Sensor X1\nJacdac-RGB Strip X1\nJacdac-Servo X1\nJacdac-Ultrasonic X1\nJacdac-Hub_B X1\nJacdac Cable 10 cm X2\nJacdac Cable 35 cm X2\nJacdac Cable 100 cm X1", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + tags: [ + "kit" + ], + version: "1.0", + status: "stable", + devices: [ + "kittenbot-powerv10", + "kittenbot-hapticoutputv10", + "kittenbot-accelerometerv10", + "kittenbot-relayv10", + "kittenbot-envsensorv10", + "kittenbot-rgbstripv10", + "kittenbot-servov10", + "kittenbot-ultrasonicsensorv10", + "kittenbot-hubv10" + ], + relatedDevices: [ + "kittenbot-jacdacstarterkitawithjacdaptorformicrobitv2v10", + "kittenbot-brainrp2040v10" + ] + }, + { + id: "kittenbot-jacdacstarterkitawithjacdaptorformicrobitv2v10", + name: "Jacdac Starter Kit A with Jacdaptor for micro:bit V2", + company: "KittenBot", + description: "A kit of Jacdac modules.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + tags: [ + "kit", + "microbit" + ], + version: "1.0", + status: "stable", + devices: [ + "kittenbot-keycapbuttonv10", + "kittenbot-lightsensorv10", + "kittenbot-magnetsensorv10", + "kittenbot-rotarybuttonv10", + "kittenbot-sliderv10", + "kittenbot-rgbringv10", + "kittenbot-hubv10", + "kittenbot-jacdaptorformicrobitv2v10" + ], + relatedDevices: [ + "microbit-educational-foundation-microbitv2", + "kittenbot-jacdacdeveloperstoolelectronicmodulekitbv10", + "kittenbot-brainrp2040v10" + ], + requiredDevices: [ + "microbit-educational-foundation-microbitv2" + ], + order: 1 + }, + { + id: "kittenbot-jacdaptorformicrobitv2v10", + name: "Jacdaptor for micro:bit V2", + company: "KittenBot", + connector: "edgeLowCurrentProviderConsumer", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + tags: [ + "adapter", + "microbit" + ], + version: "1.0", + status: "stable", + relatedDevices: [ + "microbit-educational-foundation-microbitv2" + ], + requiredDevices: [ + "microbit-educational-foundation-microbitv2" + ], + shape: "ec30_1x7_r7" + }, + { + id: "kittenbot-keycapbuttonv10", + name: "Keycap Button", + company: "KittenBot", + description: "A keycap keyboard button.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + services: [ + 343122531 + ], + productIdentifiers: [ + 926152985 + ], + version: "1.0", + status: "stable", + shape: "ec30_3x2_lr" + }, + { + id: "kittenbot-lightsensorv10", + name: "Light Sensor", + company: "KittenBot", + description: "A light level sensor.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + services: [ + 400333340 + ], + productIdentifiers: [ + 973683863, + 1017391393 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_lr" + }, + { + id: "kittenbot-magnetsensorv10", + name: "Magnet Sensor", + company: "KittenBot", + description: "A magnetic field sensor.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + services: [ + 318642191 + ], + productIdentifiers: [ + 881631743, + 1018441315 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_lr" + }, + { + id: "kittenbot-nanoscript2040v10", + name: "NanoScript 2040", + company: "KittenBot", + description: "Elevate your embedded projects with our cutting-edge development board, powered by Raspberry Pi's RP2040 and tailored for DeviceScript. Experience the unmatched synergy of TypeScript in the realm of microcontroller programming, where precision, efficiency, and modern development practices converge.", + connector: "edgeLowCurrentProviderConsumer", + storeLink: [ + "https://www.kittenbot.cc/products/devicescript-enhanced-development-board-with-rp2040" + ], + services: [ + 411425820, + 414210922, + 524302175 + ], + productIdentifiers: [ + 935525573 + ], + version: "1.0", + status: "stable", + shape: "ec30_3x2_r" + }, + { + id: "kittenbot-powerv10", + name: "Power", + company: "KittenBot", + description: "Power module is used to supply high-current JACDAC modules such as servo modules.It can also be used to supply power to the entire JACDAC electronic system.It has overcurrent protection and a maximum output current of 1A.", + connector: "edgeHighCurrentProvider", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 530893146 + ], + productIdentifiers: [ + 1015787249 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x4_l2" + }, + { + id: "kittenbot-relayv10", + name: "Relay", + company: "KittenBot", + description: "This relay module is designed for low voltage and low current applications. It's recommended to use a voltage of 5V and a current no greater than 1A.\nWhen using a relay module, it's important to be aware of electrical safety. It's recommended that you use the relay module under adult supervision, especially if you are not familiar with electrical circuits and how to use them safely.", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 406840918 + ], + productIdentifiers: [ + 830413461 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_l" + }, + { + id: "kittenbot-rgbringv10", + name: "RGB Ring", + company: "KittenBot", + description: "A ring of 8 colored programmable LEDs.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + services: [ + 369743088 + ], + productIdentifiers: [ + 924243657 + ], + version: "1.0", + status: "stable", + shape: "ec30_3x3_l" + }, + { + id: "kittenbot-rgbstripv10", + name: "RGB Strip", + company: "KittenBot", + description: "RGB Strip module is used to drive WS2812 LED strips. If you're driving a large number of LEDs, such as more than 10, it's recommended to provide additional power to the LED strip to ensure stable and reliable operation.", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 309264608 + ], + productIdentifiers: [ + 1033734884 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x2_l" + }, + { + id: "kittenbot-rotarybuttonv10", + name: "Rotary Button", + company: "KittenBot", + description: "A rotary encoder and button.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + services: [ + 284830153, + 343122531 + ], + productIdentifiers: [ + 984959466 + ], + version: "1.0", + status: "stable", + shape: "ec30_3x2_lr" + }, + { + id: "kittenbot-servov10", + name: "Servo", + company: "KittenBot", + description: "Servo module is used to drive standard 3-wire analog servos. It has two output channels and can operate in two different current output modes: 500mA and 1A.", + connector: "edgeLowCurrentProvider", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 318542083 + ], + productIdentifiers: [ + 918447378 + ], + version: "1.0", + status: "stable", + shape: "ec30_2x3_l" + }, + { + id: "kittenbot-sliderv10", + name: "Slider", + company: "KittenBot", + description: "A slider.", + storeLink: [ + "https://www.amazon.com/KittenBot-Jacdac-Starter-Jacdaptor-Micro/dp/B0BQ6WMBPZ", + "https://www.kittenbot.cc/collections/frontpage/products/kittenbot-jacdac-kit-for-micro-bit", + "https://www.aliexpress.com/item/3256804237465484.html", + "https://www.pakronics.com.au/products/kittenbot-jacdac-kit-a-with-adaptor-for-micro-bit-v2-pakr-a0410" + ], + services: [ + 522667846 + ], + productIdentifiers: [ + 1054684252 + ], + version: "1.0", + status: "stable", + shape: "ec30_5x2_lr" + }, + { + id: "kittenbot-ultrasonicsensorv10", + name: "Ultrasonic Sensor", + company: "KittenBot", + description: "The Ultrasonic Distance Measurement module has a detection range of approximately 3.5 meters.", + storeLink: [ + "https://www.kittenbot.cc/products/jacdac-kit-b-elite-module-suite-redefining-electronic-interfacing" + ], + services: [ + 337275786 + ], + productIdentifiers: [ + 983895657 + ], + version: "1.0", + status: "stable", + shape: "ec30_5x2_lr" + }, + { + id: "kitronik-accessbitv11", + name: "ACCESS:bit", + company: "Kitronik", + description: "The ACCESS:bit is a bolt-on/clip-on board for the BBC microbit that simulates an access barrier.", + makeCodeRepo: [ + { + target: "microbit", + name: "kitronik-accessbitv11", + slug: "pelikhan/pxt-kitronik-accessbit/jacdac" + } + ], + connector: "noConnector", + link: "https://kitronik.co.uk/products/5646-accessbit-for-bbc-microbit", + storeLink: [ + "https://kitronik.co.uk/products/5646-accessbit-for-bbc-microbit" + ], + services: [ + 318542083 + ], + productIdentifiers: [ + 1053651806 + ], + version: "1.1", + status: "stable" + }, + { + id: "kitronik-airqualityboardv10", + name: "Air Quality Board", + company: "Kitronik", + description: "The Kitronik Air Quality Board provides a complete air monitoring and reporting solution for the BBC micro:bit . The wealth of onboard sensors and connection points allow you to collect extensive air quality data that can be stored in onboard memory and displayed on the OLED screen or transferred to a computer for analysis.", + makeCodeRepo: [ + { + target: "microbit", + name: "kitronik-airqualityboardv10", + slug: "pelikhan/pxt-kitronik-air-quality/jacdac/" + } + ], + connector: "edgeIndependent", + link: "https://kitronik.co.uk/products/5674-kitronik-air-quality-board-for-bbc-micro-bit", + storeLink: [ + "https://kitronik.co.uk/products/5674-kitronik-air-quality-board-for-bbc-micro-bit" + ], + services: [ + 337754823, + 504462570, + 382210232, + 379362758, + 445323816, + 523748714 + ], + productIdentifiers: [ + 854008423 + ], + version: "1.0", + status: "stable" + }, + { + id: "kitronik-gamezip64v12", + name: "Game Zip 64", + company: "Kitronik", + makeCodeRepo: [ + { + target: "microbit", + name: "kitronik-gamezip64v12", + slug: "pelikhan/pxt-kitronik-zip-64/jacdac" + } + ], + connector: "noConnector", + link: "https://kitronik.co.uk/products/5626-game-zip-64-for-the-bbc-microbit", + storeLink: [ + "https://kitronik.co.uk/products/5626-game-zip-64-for-the-bbc-microbit" + ], + services: [ + 277836886, + 369743088, + 406832290 + ], + productIdentifiers: [ + 888103518 + ], + version: "1.2", + status: "stable" + }, + { + id: "kitronik-servolitev10", + name: "SERVO:LITE", + company: "Kitronik", + description: "The Servo:Lite board for the BBC micro:bit is a simple board that allows you to easily connect and control low power servo motors (servo's must be capable of operating at 3.3V) using the BBC micro:bit. It is connected to the micro:bit using five bolts. Connect two servos in standard configuration and it can drive up to 3 servos if the addressable 'ZIP' LEDs aren\u2019t needed.", + makeCodeRepo: [ + { + target: "microbit", + name: "kitronik-servolitev10", + slug: "pelikhan/pxt-kitronik-servo-lite/jacdac" + } + ], + connector: "noConnector", + link: "https://kitronik.co.uk/products/5623-servolite-board-for-move-mini", + storeLink: [ + "https://kitronik.co.uk/products/5623-servolite-board-for-move-mini" + ], + services: [ + 369743088, + 318542083, + 318542083 + ], + productIdentifiers: [ + 995306847 + ], + version: "1.0", + status: "stable" + }, + { + id: "kitronik-stopbitv10", + name: "STOP:bit", + company: "Kitronik", + description: "The STOP:bit for the BBC micro:bit is the ultimate upgrade for traffic light/pedestrian crossing projects.", + makeCodeRepo: [ + { + target: "microbit", + name: "kitronik-stopbit-jacdac", + slug: "pelikhan/pxt-kitronik-stopbit/jacdac" + } + ], + connector: "noConnector", + link: "https://kitronik.co.uk/products/5642-stopbit-traffic-light-for-bbc-microbit", + storeLink: [ + "https://kitronik.co.uk/products/5642-stopbit-traffic-light-for-bbc-microbit" + ], + services: [ + 365137307 + ], + productIdentifiers: [ + 1058995861 + ], + version: "1.0", + status: "stable" + }, + { + id: "keystudio-relaybreakoutboardv10", + name: "Relay Breakout Board", + company: "Keystudio", + description: "Keyestudio relay breakout board for micro:bit has integrated a 4-way 5V relay module, fully compatible with micro:bit development board.\nIt can work only need to insert micro:bit into keyestudio relay shield, then input DC5V voltage on the relay VIN/GND port, pretty simple and convenient.", + makeCodeRepo: [ + { + target: "microbit", + name: "keystudio-relaybreakoutboardv10", + slug: "pelikhan/keystudio-relay-breakout-jacdac" + } + ], + connector: "noConnector", + link: "https://www.keyestudio.com/products/keyestudio-relay-breakout-board-for-bbc-microbit", + storeLink: [ + "https://www.keyestudio.com/products/keyestudio-relay-breakout-board-for-bbc-microbit" + ], + services: [ + 406840918, + 406840918, + 406840918, + 406840918 + ], + productIdentifiers: [ + 901245225 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-breakoutboardrelaypumpv10", + name: "Breakout Board + Relay + Pump", + company: "Forward Education", + description: "A micro:bit carrier board", + makeCodeRepo: [ + { + target: "microbit", + name: "forward-education-breakoutboardrelaypumpv10", + slug: "climate-action-kits/pxt-fwd-edu/fwd-breakout" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 406840918, + 318542083 + ], + productIdentifiers: [ + 873600795, + 943529908 + ], + tags: [ + "adapter", + "microbit" + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-climateactionkitv10", + name: "Climate Action Kit", + company: "Forward Education", + description: "Purpose-driven STEM education for a brighter future. \xA0Explore climate action with our STEM kit and online lessons.", + makeCodeRepo: [ + { + target: "microbit", + name: "pxt-fwd-edu", + slug: "climate-action-kits/pxt-fwd-edu/" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + tags: [ + "kit", + "microbit" + ], + version: "1.0", + status: "stable", + devices: [ + "forward-education-linesensorv10", + "forward-education-breakoutboardrelaypumpv10", + "forward-education-ledlightsv10", + "forward-education-touchsensorv10", + "forward-education-dialbuttonv10", + "forward-education-sonarsensorv10", + "forward-education-solarsensorv10", + "forward-education-moisturesensorv10" + ], + relatedDevices: [ + "microbit-educational-foundation-microbitv2" + ], + requiredDevices: [ + "forward-education-breakoutboardrelaypumpv10", + "microbit-educational-foundation-microbitv2" + ] + }, + { + id: "forward-education-dialbuttonv10", + name: "Dial Button", + company: "Forward Education", + description: "Dial Button is a rotary encoder and button compatible with the jacdac framework and part of the Climate Action Kit by Forward Education\n", + makeCodeRepo: [ + { + target: "microbit", + name: "forward-education-dialbuttonv10", + slug: "climate-action-kits/pxt-fwd-edu/fwd-dial" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 343122531, + 284830153 + ], + productIdentifiers: [ + 932148851 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-ledlightsv10", + name: "LED Lights", + company: "Forward Education", + description: "LED Lights is a ws2812 LED ring compatible with the jacdac framework and part of the Climate Action Kit by Forward Education\n", + makeCodeRepo: [ + { + target: "microbit", + name: "fwd-edu-led", + slug: "climate-action-kits/pxt-fwd-edu/fwd-led" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 369743088 + ], + productIdentifiers: [ + 1054009247 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-linesensorv10", + name: "Line Sensor", + company: "Forward Education", + description: "Line Sensor is a multi-reflected light sensor compatible with the jacdac framework and part of the Climate Action Kit by Forward Education\n", + makeCodeRepo: [ + { + target: "microbit", + name: "fwd-edu-line", + slug: "climate-action-kits/pxt-fwd-edu/fwd-line" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 309087410, + 309087410, + 309087410 + ], + productIdentifiers: [ + 1000568338 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-moisturesensorv10", + name: "Moisture Sensor", + company: "Forward Education", + description: "Moisture Sensor is a capacitive soil moisture sensor compatible with the jacdac framework and part of the Climate Action Kit by Forward Education\n", + makeCodeRepo: [ + { + target: "microbit", + name: "fwd-edu-moisture", + slug: "climate-action-kits/pxt-fwd-edu/fwd-moisture" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 491430835 + ], + productIdentifiers: [ + 870361737 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-solarsensorv10", + name: "Solar Sensor", + company: "Forward Education", + description: "Solar Sensor is a photoresistor sensor compatible with the jacdac framework and part of the Climate Action Kit by Forward Education", + makeCodeRepo: [ + { + target: "microbit", + name: "fwd-edu-solar", + slug: "climate-action-kits/pxt-fwd-edu/fwd-solar" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 400333340 + ], + productIdentifiers: [ + 1005257879 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-sonarsensorv10", + name: "Sonar Sensor", + company: "Forward Education", + description: "Sonar Sensor is an ultrasonic/radar sensor compatible with the jacdac framework and part of the Climate Action Kit by Forward Education\n", + makeCodeRepo: [ + { + target: "microbit", + name: "fwd-edu-sonar", + slug: "climate-action-kits/pxt-fwd-edu/fwd-sonar" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 337275786 + ], + productIdentifiers: [ + 926591985 + ], + version: "1.0", + status: "stable" + }, + { + id: "forward-education-touchsensorv10", + name: "Touch Sensor", + company: "Forward Education", + description: "Touch Sensor is a capacitive touch sensor compatible with the jacdac framework and part of the Climate Action Kit by Forward Education\n", + makeCodeRepo: [ + { + target: "microbit", + name: "fwd-edu-touch", + slug: "climate-action-kits/pxt-fwd-edu/fwd-touch" + } + ], + link: "https://forwardedu.com", + storeLink: [ + "https://forwardedu.com" + ], + services: [ + 343122531 + ], + productIdentifiers: [ + 1064434129 + ], + version: "1.0", + status: "stable" + }, + { + id: "espressif-esp32c3rustdevkitv12a", + name: "ESP32-C3-RUST-DevKit", + company: "Espressif", + description: "This board is based on the ESP32-C3, and includes sensors, LEDs, buttons, a battery charger, and USB type-C connector.", + repo: "https://github.com/microsoft/devicescript-esp32", + firmwareSource: "https://github.com/microsoft/devicescript-esp32/blob/main/boards/esp32c3/esp32c3_rust_devkit.board.json", + hardwareDesign: "https://github.com/esp-rs/esp-rust-board", + connector: "noConnector", + link: "https://github.com/esp-rs/esp-rust-board", + storeLink: [ + "https://github.com/esp-rs/esp-rust-board" + ], + services: [ + 413852154, + 342028028, + 341864092, + 337754823, + 382210232, + 471386691, + 343122531 + ], + productIdentifiers: [ + 871537753 + ], + version: "1.2a", + status: "stable" + }, + { + id: "espressif-esp32devkitcdevicescriptv40", + name: "ESP32-DevKitC DeviceScript", + company: "Espressif", + description: "This will also work with NodeMCU etc.", + firmwareSource: "https://github.com/microsoft/devicescript-esp32", + connector: "noConnector", + link: "https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html", + storeLink: [ + "https://www.espressif.com/en/products/devkits/esp32-devkitc" + ], + services: [ + 341864092, + 342028028, + 413852154, + 288680491 + ], + productIdentifiers: [ + 1011907077 + ], + transport: { + type: "serial", + vendorId: 4292 + }, + firmwares: [ + { + name: "DeviceScript + Cloud Connector", + url: "https://github.com/microsoft/devicescript-esp32/releases/latest", + productIdentifier: 1011907077 + } + ], + version: "4.0", + bootloader: { + sequence: "boot-power", + firmwareFormat: "bin", + firmwareUploader: "https://adafruit.github.io/Adafruit_WebSerial_ESPTool/" + }, + status: "stable" + }, + { + id: "adafruit-qtpyesp32c3wifidevboardv10", + name: "QT Py ESP32-C3 WiFi Dev Board", + company: "Adafruit", + description: "The ESP32-C3 integrates a rich set of peripherals, ranging from UART, I2C, I2S, remote control peripheral, LED PWM controller, general DMA controller, TWAI controller, USB Serial/JTAG controller, temperature sensor, and ADC. It also includes SPI, Dual SPI, and Quad SPI interfaces.", + firmwareSource: "https://github.com/microsoft/devicescript-esp32", + connector: "noConnector", + link: "https://www.adafruit.com/product/5405", + storeLink: [ + "https://www.adafruit.com/product/5405" + ], + services: [ + 341864092, + 342028028, + 413852154, + 288680491 + ], + productIdentifiers: [ + 866451573, + 915657739 + ], + firmwares: [ + { + name: "DeviceScript + Cloud Connector", + url: "https://github.com/microsoft/devicescript-esp32/releases/latest", + productIdentifier: 915657739 + } + ], + version: "1.0", + bootloader: { + sequence: "boot-power", + firmwareFormat: "bin", + firmwareUploader: "https://adafruit.github.io/Adafruit_WebSerial_ESPTool/" + }, + status: "stable" + }, + { + id: "01space-esp32c3fh4rgbv10", + name: "ESP32-C3FH4-RGB", + company: "01Space", + description: "Small ESP32-C3 board with 5x5 LED color matrix", + connector: "noConnector", + link: "https://github.com/01Space/ESP32-C3FH4-RGB", + storeLink: [ + "https://usa.banggood.com/ESP32-C3-Development-Board-RISC-V-WiFi-Bluetooth-IoT-Development-Board-Compatible-with-Python-p-1914005.html?imageAb=2&akmClientCountry=America&a=1694552315.7453&akmClientCountry=America&cur_warehouse=CN" + ], + services: [ + 288680491, + 369743088, + 343122531 + ], + productIdentifiers: [ + 982550620 + ], + version: "1.0", + status: "stable" + }, + { + id: "seeed-studio-xiaoesp32c3withmsr218base218v46", + name: "XIAO ESP32C3 with MSR218 base", + company: "Seeed Studio", + description: "XIAO ESP32C3 + Prototype Carrier board for Xiao, Jacdac, Grove, Qwiic, Stemma QT, Analog.", + repo: "https://github.com/microsoft/devicescript-esp32", + firmwareSource: "https://github.com/microsoft/devicescript-esp32/blob/main/boards/esp32c3/seeed_xiao_esp32c3.board.json", + connector: "edgeHighCurrentProvider", + services: [ + 282614377, + 413852154, + 342028028, + 341864092, + 471386691 + ], + productIdentifiers: [ + 917915687 + ], + version: "4.6", + designIdentifier: "218", + shape: "ec30_4x3_l2" + }, + { + id: "milador-jmpressuresensorv10", + name: "JM Pressure Sensor v1.0", + company: "Milador", + description: "JM Pressure Sensor v1.0", + repo: "https://github.com/milador/jacdac-milador-modules", + firmwareSource: "https://github.com/milador/jacdac-milador-modules", + hardwareDesign: "https://github.com/milador/Jacdac-Pressure-Sensor/tree/develop/Hardware/PCB", + link: "https://github.com/milador/Jacdac-Pressure-Sensor/", + services: [ + 504462570, + 337754823 + ], + productIdentifiers: [ + 962878031 + ] + }, + { + id: "milador-pressuresensorv11", + name: "Pressure Sensor", + company: "Milador", + description: "A Jacdac Pressure Sensor Module based on LPS33HW Absolute digital Pressure Sensor.", + repo: "https://github.com/milador/jacdac-milador-modules", + hardwareDesign: "https://github.com/milador/Jacdac-Pressure-Sensor/tree/develop/Hardware/PCB", + link: "https://github.com/milador/Jacdac-Pressure-Sensor", + services: [ + 504462570, + 337754823 + ], + productIdentifiers: [ + 867414479 + ], + version: "1.1", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-cableextender38v10", + name: "CableExtender", + company: "Microsoft Research", + description: "Cable extender", + connector: "edgePassive", + productIdentifiers: [ + 928595161 + ], + version: "1.0", + designIdentifier: "38", + status: "experimental" + }, + { + id: "microsoft-research-cableextender38v11", + name: "CableExtender", + company: "Microsoft Research", + description: "Cable extender", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/altium/hub-designs/JacdacCableExtender%2038-1.1", + connector: "edgePassive", + productIdentifiers: [ + 943041789 + ], + version: "1.1", + designIdentifier: "38" + }, + { + id: "microsoft-research-co2209v43", + name: "CO2", + company: "Microsoft Research", + description: "Measures real CO2 concentration using SCD40 sensor (plus temperature and humidity)", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 382210232, + 379362758 + ], + productIdentifiers: [ + 1008301288 + ], + version: "4.3", + designIdentifier: "209", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-developerrgb117v10", + name: "Developer RGB", + company: "Microsoft Research", + description: "Developer module with 10-pin header and RGB LED", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/developer-rgb-117/profile/developer-rgb-117-v1.0.c", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/altium/module-designs/JacdacDevRgbEc30%20117-1.0", + services: [ + 506480888 + ], + productIdentifiers: [ + 851267569 + ], + version: "1.0", + designIdentifier: "117", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-devicescriptsimulatorv10", + name: "DeviceScript Simulator", + company: "Microsoft Research", + description: "A virtual DeviceScript Manager simulator.", + firmwareSource: "https://github.com/microsoft/devicescript", + connector: "noConnector", + services: [ + 358308672 + ], + productIdentifiers: [ + 1072018543, + 288680491 + ], + version: "1.0" + }, + { + id: "microsoft-research-hub114v10", + name: "Hub", + company: "Microsoft Research", + description: "Passive hub with 6 ports", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/altium/hub-designs/JacdacEc30Hub10x40%20114-1.0", + connector: "edgePassive", + version: "1.0", + designIdentifier: "114", + shape: "ec30_2x4_lr" + }, + { + id: "microsoft-research-jacdacjoystick440344v03", + name: "JacdacJoystick 44-0.3", + company: "Microsoft Research", + firmwareSource: "https://github.com/microsoft/jacdac-padauk/tree/main/jm-joystick-44-0.2", + link: "https://github.com/microsoft/jacdac-padauk", + services: [ + 277836886 + ], + productIdentifiers: [ + 832285283 + ], + version: "0.3", + designIdentifier: "44", + status: "experimental" + }, + { + id: "microsoft-research-jacdacmicrobitshieldlp29v03", + name: "JacDacMicroBitShieldLP", + company: "Microsoft Research", + connector: "edgeLowCurrentProvider", + productIdentifiers: [ + 1009620586 + ], + version: "0.3", + designIdentifier: "29", + status: "experimental" + }, + { + id: "microsoft-research-jacdacmotiondetection54v01", + name: "JacdacMotionDetection ", + company: "Microsoft Research", + link: "https://github.com/microsoft/jacdac-padauk", + services: [ + 293185353 + ], + productIdentifiers: [ + 1030407429 + ], + version: "0.1", + designIdentifier: "54", + status: "experimental" + }, + { + id: "microsoft-research-jacdacpinheaders45v02", + name: "JacdacPinHeaders ", + company: "Microsoft Research", + productIdentifiers: [ + 970939382 + ], + version: "0.2", + designIdentifier: "45", + status: "experimental" + }, + { + id: "microsoft-research-jacdactouchtest35v10", + name: "JacdacTouchTest", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 677752265 + ], + productIdentifiers: [ + 933677864 + ], + version: "1.0", + designIdentifier: "35", + status: "experimental" + }, + { + id: "microsoft-research-jacdactouchtestelectrode36v10", + name: "JacdacTouchTestElectrode", + company: "Microsoft Research", + services: [ + 677752265 + ], + productIdentifiers: [ + 1026187559 + ], + version: "1.0", + designIdentifier: "36", + status: "experimental" + }, + { + id: "microsoft-research-jm3slider85v40", + name: "JM-3-Slider", + company: "Microsoft Research", + description: "Triple slider", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0/profile/slider-85.c", + services: [ + 522667846, + 522667846, + 522667846 + ], + productIdentifiers: [ + 905702802 + ], + version: "4.0", + designIdentifier: "85", + shape: "ec30_6x3_lr" + }, + { + id: "microsoft-research-jmaccelerometer30v10", + name: "JM Accelerometer", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-accelerometer-30-1.0/profile/accelerometer.c", + services: [ + 521405449 + ], + productIdentifiers: [ + 952491663 + ], + version: "1.0", + designIdentifier: "30" + }, + { + id: "microsoft-research-jmaccessswitchinput34v13", + name: "JM Access Switch Input", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-access-switch-input-34-1.3/profile/xac.c", + services: [ + 343122531, + 522667846, + 277836886 + ], + productIdentifiers: [ + 964964313 + ], + version: "1.3", + designIdentifier: "34" + }, + { + id: "microsoft-research-jmaccessswitchoutputv11", + name: "JM Access Switch Output", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-access-switch-output-1.1/profile/relay.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 406840918 + ], + productIdentifiers: [ + 942325999 + ], + version: "1.1" + }, + { + id: "microsoft-research-jmambientlight55v01", + name: "JM Ambient Light", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-padauk/tree/main/jm-ambient-lightsensor-55-0.1", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 400333340 + ], + productIdentifiers: [ + 896864987 + ], + version: "0.1", + designIdentifier: "55" + }, + { + id: "microsoft-research-jmanalogjoystick44v02", + name: "JM Analog Joystick", + company: "Microsoft Research", + firmwareSource: "https://github.com/microsoft/jacdac-padauk/tree/main/jm-joystick-44-0.2", + link: "https://github.com/microsoft/jacdac-padauk", + services: [ + 277836886 + ], + productIdentifiers: [ + 976429228 + ], + version: "0.2", + designIdentifier: "44" + }, + { + id: "microsoft-research-jmbase86v41", + name: "JM Base", + company: "Microsoft Research", + description: "A breadboard like PCB to screw mount Jacdac modules.", + connector: "edgePassive", + tags: [ + "ec30", + "hub" + ], + version: "4.1", + designIdentifier: "86" + }, + { + id: "microsoft-research-jmbrainesp3248v03", + name: "JM Brain ESP32", + company: "Microsoft Research", + connector: "edgeHighCurrentProvider", + services: [ + 342028028, + 341864092 + ], + productIdentifiers: [ + 917230668, + 983264687, + 1067560617, + 1038170507, + 816040071 + ], + transport: { + type: "serial", + vendorId: 12346 + }, + firmwares: [ + { + name: "Azure IoT Hub Uploader", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/uploader-esp32s2.uf2", + productIdentifier: 1067560617 + }, + { + name: "DeviceScript Brain + Azure IoT Hub Cloud Adapter", + url: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2.uf2", + productIdentifier: 1038170507 + }, + { + name: "Azure IoT Hub Cloud Adapter", + url: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-nojacs.uf2", + productIdentifier: 816040071 + } + ], + version: "0.3", + designIdentifier: "48", + bootloader: { + sequence: "reset-boot", + driveName: "IOT-BOOT", + firmwareFormat: "uf2", + ledAnimation: "blue-glow" + } + }, + { + id: "microsoft-research-jmbrainf441v02", + name: "JM Brain F4", + company: "Microsoft Research", + connector: "edgeHighCurrentProvider", + link: "https://github.com/microsoft/pxt-jacdac", + services: [ + 414210922, + 411425820 + ], + productIdentifiers: [ + 1003209864, + 970267564, + 819577746, + 1009312972 + ], + transport: { + type: "usb" + }, + firmwares: [ + { + name: "HID Keyboard + Mouse", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/hid-servers-f4.uf2", + productIdentifier: 819577746 + }, + { + name: "HID Joystick", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/hid-joystick-f4.uf2", + productIdentifier: 1009312972 + } + ], + version: "0.2", + designIdentifier: "41", + bootloader: { + sequence: "reset", + driveName: "JACDACF4", + firmwareFormat: "uf2", + ledAnimation: "blue-glow" + } + }, + { + id: "microsoft-research-jmbrainrp204059v01", + name: "JM Brain RP2040", + company: "Microsoft Research", + connector: "edgeHighCurrentProvider", + link: "https://github.com/microsoft/pxt-jacdac", + services: [ + 414210922, + 411425820 + ], + productIdentifiers: [ + 884301483, + 999933064, + 883764657, + 983850333 + ], + transport: { + type: "usb" + }, + tags: [ + "adapter" + ], + firmwares: [ + { + name: "HID Keyboard + Mouse", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/hid-servers-rp2040.uf2", + productIdentifier: 883764657 + }, + { + name: "HID Joystick", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/hid-joystick-rp2040.uf2", + productIdentifier: 983850333 + } + ], + version: "0.1", + designIdentifier: "59", + bootloader: { + sequence: "reset-boot", + driveName: "RPI-RP2", + firmwareFormat: "uf2" + } + }, + { + id: "microsoft-research-jmbutton10v13", + name: "JM Button", + company: "Microsoft Research", + link: "https://github.com/microsoft/jacdac-padauk", + services: [ + 343122531 + ], + productIdentifiers: [ + 896566497 + ], + version: "1.3", + designIdentifier: "10" + }, + { + id: "microsoft-research-jmbutton40v02", + name: "JM Button", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-button-40-0.2/profile/button.c", + services: [ + 343122531 + ], + productIdentifiers: [ + 946173966 + ], + version: "0.2", + designIdentifier: "40" + }, + { + id: "microsoft-research-jmbuttonterminal62v01", + name: "JM Button Terminal", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 343122531 + ], + productIdentifiers: [ + 1047530059 + ], + version: "0.1", + designIdentifier: "62" + }, + { + id: "microsoft-research-jmbuzzer89", + name: "JM-Buzzer", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0/profile/buzzer-89.c", + services: [ + 458731991 + ], + productIdentifiers: [ + 1073013851 + ], + designIdentifier: "89", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-jmcapacitivesoilmoisturev33", + name: "JM Capacitive Soil Moisture", + company: "Microsoft Research", + description: "JM Capacitive Soil Moisture v3.3", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.3/profile/soilmoisture.c", + services: [ + 491430835 + ], + productIdentifiers: [ + 959462330 + ], + version: "3.3" + }, + { + id: "microsoft-research-jmclickairquality4v32", + name: "JM-Click Airquality4", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.2/profile/airquality4click.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 379362758, + 312849815 + ], + productIdentifiers: [ + 878106432 + ], + version: "3.2" + }, + { + id: "microsoft-research-jmclickcolorv32", + name: "JM-Click Color", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.2/profile/colorclick.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 372299111 + ], + productIdentifiers: [ + 1020991645 + ], + version: "3.2" + }, + { + id: "microsoft-research-jmco2tvoctemphumsgp30sht3066v37", + name: "JM CO2/TVOC/Temp/Hum SGP30+SHT30", + company: "Microsoft Research", + description: "JM CO2/TVOC/Temp/Hum SGP30+SHT30 66 v3.7", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.6/profile/co2.c", + services: [ + 379362758, + 312849815, + 337754823, + 382210232 + ], + productIdentifiers: [ + 912293656 + ], + version: "3.7", + designIdentifier: "66" + }, + { + id: "microsoft-research-jmdualkey69v37", + name: "JM Dual Key", + company: "Microsoft Research", + description: "JM 2Key 69 v3.7", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.6/profile/key2.c", + services: [ + 343122531, + 343122531 + ], + productIdentifiers: [ + 958599316 + ], + version: "3.7", + designIdentifier: "69" + }, + { + id: "microsoft-research-jmenvironment204v42", + name: "JM-Environment", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 382210232, + 379362758, + 312849815 + ], + productIdentifiers: [ + 842012177 + ], + version: "4.2", + designIdentifier: "204", + shape: "ec30_2x2_l" + }, + { + id: "microsoft-research-jmflexv10", + name: "JM Flex", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-flex-sensor-1.0/profile/flex.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 524797638 + ], + productIdentifiers: [ + 840841542 + ], + version: "1.0" + }, + { + id: "microsoft-research-jmgamepadv20", + name: "JM GamePad", + company: "Microsoft Research", + description: "Lets you convert a plastic d-pad controller, so that it can be connected to a Jacdac network.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/dpad.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 501915758 + ], + productIdentifiers: [ + 919754666 + ], + version: "2.0" + }, + { + id: "microsoft-research-jmhallmagneticswitch81v40", + name: "JM-Hall (magnetic switch)", + company: "Microsoft Research", + description: "JM-Hall (magnetic switch) 81 v4.0", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0/profile/hall-81.c", + services: [ + 450008066 + ], + productIdentifiers: [ + 920333141 + ], + version: "4.0", + designIdentifier: "81", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-jmhapticmach101v10", + name: "JM Haptic MACH-1.0", + company: "Microsoft Research", + description: "JM Haptic MACH-1.0", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-haptic-1.0/profile/haptic.c", + services: [ + 406832290 + ], + productIdentifiers: [ + 1022649261 + ], + version: "1.0", + designIdentifier: "1" + }, + { + id: "microsoft-research-jmhub39v03", + name: "JM Hub", + company: "Microsoft Research", + productIdentifiers: [ + 917230668 + ], + version: "0.3", + designIdentifier: "39", + status: "experimental" + }, + { + id: "microsoft-research-jmjacscriptstarbrainv33", + name: "JM Jacscript Star-Brain", + company: "Microsoft Research", + description: "A Jacscript brain", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/star-brain/profile/devicescript.c", + services: [ + 288680491 + ], + productIdentifiers: [ + 1025500463 + ], + transport: { + type: "serial", + vendorId: 6790 + }, + version: "3.3" + }, + { + id: "microsoft-research-jmkeyboardkey46v12", + name: "JM Keyboard Key", + company: "Microsoft Research", + link: "https://github.com/microsoft/jacdac-padauk", + services: [ + 343122531 + ], + productIdentifiers: [ + 876567534 + ], + version: "1.2", + designIdentifier: "46" + }, + { + id: "microsoft-research-jmkeyv3768v37", + name: "JM Key v3.7", + company: "Microsoft Research", + description: "JM Key 68 v3.7", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.6/profile/key.c", + services: [ + 343122531 + ], + productIdentifiers: [ + 948311172 + ], + version: "3.7", + designIdentifier: "68" + }, + { + id: "microsoft-research-jmmatrix87v40", + name: "JM-Matrix", + company: "Microsoft Research", + description: "5x5 LED dot matrix", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0matrix/profile/matrix-87.c", + services: [ + 286070091 + ], + productIdentifiers: [ + 896568761 + ], + version: "4.0", + designIdentifier: "87", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-jmmicrobitshieldlp29v05", + name: "JM MicroBit Shield LP", + company: "Microsoft Research", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/deprecated_form_factor/altium_deprecated/reference-designs/JacdacMicroBitShieldLP%2029-0.6", + connector: "edgeLowCurrentProvider", + productIdentifiers: [ + 974031363 + ], + tags: [ + "adapter", + "microbit" + ], + version: "0.5", + designIdentifier: "29" + }, + { + id: "microsoft-research-jmmoduletester91v01", + name: "JM Module Tester", + company: "Microsoft Research", + description: "A module that controls the Jacdac bus voltage and measures the bus current consumption.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-module-tester-91-0.1/board.h", + services: [ + 524302175, + 420661422, + 372485145, + 406840918, + 506480888 + ], + productIdentifiers: [ + 1031963291 + ], + version: "0.1", + designIdentifier: "91", + shape: "ec30_5x2_lr" + }, + { + id: "microsoft-research-jmmotionpirv3874v38", + name: "JM Motion PIR v3.8", + company: "Microsoft Research", + description: "JM Motion PIR 74 v3.8", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.3/profile/pir.c", + link: "https://aka.ms/aaaaad", + services: [ + 293185353 + ], + productIdentifiers: [ + 1060186023 + ], + version: "3.8", + designIdentifier: "74", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-jmpinheader45v02", + name: "JM Pin Header", + company: "Microsoft Research", + description: "A regulated passive adapter from Jacdac to pin headers.", + link: "https://github.com/microsoft/jacdac-msr-modules", + productIdentifiers: [ + 994328823 + ], + version: "0.2", + designIdentifier: "45" + }, + { + id: "microsoft-research-jmpressurev3872v38", + name: "JM Pressure v3.8", + company: "Microsoft Research", + description: "JM Pressure MPL3115A2 72 v3.8", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.6/profile/barometer2.c", + link: "https://aka.ms/aaaabb", + services: [ + 504462570, + 337754823 + ], + productIdentifiers: [ + 869351851 + ], + version: "3.8", + designIdentifier: "72", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-jmrelaymach01v10", + name: "JM Relay MACH-0.1", + company: "Microsoft Research", + description: "JM Relay MACH-0.1", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-relay-1.0/profile/relay.c", + services: [ + 406840918 + ], + productIdentifiers: [ + 900132124 + ], + version: "1.0" + }, + { + id: "microsoft-research-jmrgb883v40", + name: "JM RGB-8", + company: "Microsoft Research", + description: "Circular 8 programmable LED display.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0/profile/rgb-83.c", + services: [ + 369743088 + ], + productIdentifiers: [ + 1050545633 + ], + version: "4.0", + designIdentifier: "83", + shape: "ec30_3x3_lr" + }, + { + id: "microsoft-research-jmrgbledbar58v01", + name: "JM RGB LED Bar", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-rgb-led-bar-58-0.1/profile/npx.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 1046525691 + ], + version: "0.1", + designIdentifier: "58" + }, + { + id: "microsoft-research-jmrgbledgeneric60v01", + name: "JM RGB LED Generic", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-rgb-led-generic-60-0.1/profile/npx.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 967723905 + ], + version: "0.1", + designIdentifier: "60" + }, + { + id: "microsoft-research-jmrgbledring37v21", + name: "JM RGB LED Ring", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-rgb-led-ring-37-2.1/profile/npx.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 807926135 + ], + version: "2.1", + designIdentifier: "37" + }, + { + id: "microsoft-research-jmrgbring67v37", + name: "JM RGB-Ring", + company: "Microsoft Research", + description: "JM RGB-Ring 67 v3.7", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 946180442 + ], + version: "3.7", + designIdentifier: "67" + }, + { + id: "microsoft-research-jmrotarybtn82v40", + name: "JM Rotary + Btn", + company: "Microsoft Research", + description: "Rotary encoder with button in the standard shape.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0rot/profile/rotary-82.c", + services: [ + 284830153, + 343122531 + ], + productIdentifiers: [ + 1045398971 + ], + version: "4.0", + designIdentifier: "82", + shape: "ec30_2x2_l" + }, + { + id: "microsoft-research-jmrotarycontrolbuttonv11", + name: "JM Rotary Control + Button", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-rotary-control-26-1.1/profile/rotary_ctrl.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 284830153, + 343122531 + ], + productIdentifiers: [ + 829647613 + ], + version: "1.1" + }, + { + id: "microsoft-research-jmsht30temperaturehumidity64v36", + name: "JM SHT30 Temperature/Humidity", + company: "Microsoft Research", + description: "JM SHT30 64 v3.6", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.6/profile/env30.c", + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 819953075 + ], + version: "3.6", + designIdentifier: "64" + }, + { + id: "microsoft-research-jmsinglergbled42v01", + name: "JM Single RGB LED", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 506480888 + ], + productIdentifiers: [ + 917828732 + ], + version: "0.1", + designIdentifier: "42" + }, + { + id: "microsoft-research-jmslider49v11", + name: "JM Slider", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-slider-49-1.1/profile/slider.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 522667846 + ], + productIdentifiers: [ + 966423091 + ], + version: "1.1", + designIdentifier: "49" + }, + { + id: "microsoft-research-jmsoiltemperatureds18b20v33", + name: "JM Soil Temperature DS18B20", + company: "Microsoft Research", + description: "JM Soil Temperature DS18B20 v3.3", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.3one/profile/soiltemp.c", + services: [ + 337754823 + ], + productIdentifiers: [ + 1039295899 + ], + version: "3.3" + }, + { + id: "microsoft-research-jmspeechsynthesis61v33", + name: "JM Speech Synthesis", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.3/profile/ttsclick.c", + services: [ + 302307733 + ], + productIdentifiers: [ + 934541191 + ], + version: "3.3", + designIdentifier: "61" + }, + { + id: "microsoft-research-jmspibridgev37", + name: "JM SPI bridge", + company: "Microsoft Research", + description: "JM SPI bridge v3.7", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-spi-bridge-v3.7/profile/bridge.c", + services: [ + 535147631, + 530893146 + ], + productIdentifiers: [ + 882232420 + ], + tags: [ + "adapter", + "pi" + ], + version: "3.7" + }, + { + id: "microsoft-research-jmtemperaturehumidity18v11", + name: "JM Temperature + Humidity", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-temp-humidity-18-1.1/profile/env3.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 827772887 + ], + version: "1.1", + designIdentifier: "18" + }, + { + id: "microsoft-research-jmtemperaturehumidity202v41", + name: "JM-Temperature/Humidity", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v4.0/profile/temphum-202.c", + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 891386792 + ], + version: "4.1", + designIdentifier: "202", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-jmthermocouplemax667573v3873v38", + name: "JM Thermocouple MAX6675 73 v3.8", + company: "Microsoft Research", + description: "JM Thermocouple MAX6675 v3.8", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-c/blob/main/drivers/max6675.c", + link: "https://aka.ms/aaaabc", + services: [ + 337754823 + ], + productIdentifiers: [ + 1047456763 + ], + version: "3.8", + designIdentifier: "73" + }, + { + id: "microsoft-research-jmuviilluminance65v3665v36", + name: "JM UVI/Illuminance 65 v3.6", + company: "Microsoft Research", + description: "JM UVI/Illuminance 65 v3.6", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v3.6/profile/uv.c", + services: [ + 510577394, + 527306128 + ], + productIdentifiers: [ + 1021617002 + ], + version: "3.6", + designIdentifier: "65" + }, + { + id: "microsoft-research-makeaccessible2021kitv10", + name: "MakeAccessible 2021 Kit", + company: "Microsoft Research", + description: "A kit for the Microsoft MakeAccessible hackathon.", + link: "https://www.microsoft.com/en-us/research/project/project-makeaccessible/", + tags: [ + "kit" + ], + version: "1.0", + devices: [ + "microbit-educational-foundation-microbitv2", + "microsoft-research-jmaccelerometer30v10", + "microsoft-research-jmaccessswitchinput34v13", + "microsoft-research-jmaccessswitchoutputv11", + "microsoft-research-jmambientlight55v01", + "microsoft-research-jmanalogjoystick44v02", + "microsoft-research-jmbrainf441v02", + "microsoft-research-jmbrainrp204059v01", + "microsoft-research-jmbutton10v13", + "microsoft-research-jmbutton40v02", + "microsoft-research-jmbuttonterminal62v01", + "microsoft-research-jmclickairquality4v32", + "microsoft-research-jmclickcolorv32", + "microsoft-research-jmflexv10", + "microsoft-research-jmkeyboardkey46v10", + "microsoft-research-jmkeyboardkey46v11", + "microsoft-research-jmrgbledbar10v01", + "microsoft-research-jmrgbledgeneric60v01", + "microsoft-research-jmrgbledring37v20", + "microsoft-research-jmrgbledring37v21", + "microsoft-research-jmrotarycontrolbuttonv10", + "microsoft-research-jmrotarycontrolbuttonv11", + "microsoft-research-jmsinglergb-led42v01", + "microsoft-research-jmslider49v11", + "microsoft-research-jmtemphumidity18v11" + ] + }, + { + id: "microsoft-research-mikrobuscarrierboard53v01", + name: "MikrobusCarrierBoard", + company: "Microsoft Research", + productIdentifiers: [ + 961789360 + ], + version: "0.1", + designIdentifier: "53", + status: "experimental" + }, + { + id: "microsoft-research-motionpir210v43", + name: "Motion (PIR)", + company: "Microsoft Research", + description: "Detects motion using infra-red", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 293185353 + ], + productIdentifiers: [ + 927235767 + ], + version: "4.3", + designIdentifier: "210", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-pressure211v43", + name: "Pressure", + company: "Microsoft Research", + description: "Measures atmospheric pressure", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 504462570 + ], + productIdentifiers: [ + 816579443 + ], + version: "4.3", + designIdentifier: "211", + shape: "ec30_2x2_lr" + }, + { + id: "microsoft-research-rp2040devicescript59v01", + name: "RP2040 DeviceScript", + company: "Microsoft Research", + description: "RP2040 brain running DeviceScript and related services", + firmwareSource: "https://github.com/microsoft/devicescript-pico", + connector: "edgeHighCurrentProvider", + link: "https://github.com/microsoft/devicescript-pico", + services: [ + 530893146, + 414210922, + 411425820, + 437330261 + ], + productIdentifiers: [ + 900102307 + ], + transport: { + type: "serial", + vendorId: 11914 + }, + version: "0.1", + designIdentifier: "59" + }, + { + id: "microsoft-research-tact115v11", + name: "Tact", + company: "Microsoft Research", + description: "Tact style push switch.", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/altium/module-designs/JacdacTactEc30%20115-1.1", + services: [ + 343122531 + ], + productIdentifiers: [ + 1059364193 + ], + version: "1.1", + designIdentifier: "115", + shape: "ec30_1x2_l" + }, + { + id: "microsoft-research-temprh116v10", + name: "Temp & RH", + company: "Microsoft Research", + description: "Temperature and relative humidity sensor module.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/temp-rh-116/profile/temp-rh-116-v1.0.c", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/altium/module-designs/JacdacTempRhEc30%20116-1.0", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 819808106 + ], + version: "1.0", + designIdentifier: "116", + shape: "ec30_2x2_l" + }, + { + id: "microsoft-research-temprh116v11", + name: "Temp & RH", + company: "Microsoft Research", + description: "Temperature and relative humidity sensor module.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/temp-rh-116/profile/temp-rh-116-v1.1.c", + hardwareDesign: "https://github.com/microsoft/jacdac-ddk/tree/main/electronics/altium/module-designs/JacdacTempRhEc30%20116-1.1", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 1066966718 + ], + version: "1.1", + designIdentifier: "116", + shape: "ec30_2x2_l" + }, + { + id: "microsoft-research-uviilluminance205v42", + name: "UVI/Illuminance", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 510577394, + 527306128 + ], + productIdentifiers: [ + 928306999 + ], + version: "4.2", + designIdentifier: "205", + shape: "ec30_2x2_lr" + }, + { + id: "espressif-esp32s3devkitmv10", + name: "ESP32-S3 DevKitM", + company: "Espressif", + description: "An ESP32-S3 dev-board with RGB LED and all pins", + repo: "https://github.com/microsoft/devicescript-esp32", + firmwareSource: "https://github.com/microsoft/devicescript-esp32/blob/main/boards/esp32s3/esp32s3_devkit_m.board.json", + connector: "noConnector", + link: "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html", + services: [ + 413852154, + 342028028, + 341864092 + ], + productIdentifiers: [ + 896848503 + ], + version: "1.0" + }, + { + id: "microsoft-research-jmaccelerometer30v02", + name: "JM Accelerometer", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 521405449 + ], + productIdentifiers: [ + 872001670 + ], + version: "0.2", + designIdentifier: "30", + status: "deprecated" + }, + { + id: "microsoft-research-jmaccelerometerv20", + name: "JM Accelerometer v2.0", + company: "Microsoft Research", + description: "A 3-axis accelerometer. 16G range.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0i/profile/acc.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 521405449 + ], + productIdentifiers: [ + 1020174761 + ], + status: "deprecated" + }, + { + id: "microsoft-research-jmarcadebtnv20", + name: "JM ArcadeBtn v2.0", + company: "Microsoft Research", + description: "Lets you connect a single arcade button with an LED.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/btnled.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 343122531 + ], + productIdentifiers: [ + 886919574 + ], + status: "deprecated" + }, + { + id: "microsoft-research-jmarcadecontrolsv20", + name: "JM Arcade Controls v2.0", + company: "Microsoft Research", + description: "Lets you connect arcade buttons and joystick to a Jacdac network.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/arcade.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 501915758 + ], + productIdentifiers: [ + 954450524 + ], + status: "deprecated" + }, + { + id: "microsoft-research-jmbrainesp3248v02", + name: "JM Brain ESP32", + company: "Microsoft Research", + connector: "edgeHighCurrentProvider", + services: [ + 342028028 + ], + productIdentifiers: [ + 1067560617 + ], + transport: { + type: "serial", + vendorId: 12346 + }, + firmwares: [ + { + name: "IoT Uploader", + url: "https://github.com/microsoft/pxt-jacdac/releases/latest/download/uploader-esp32s2.uf2", + productIdentifier: 1067560617 + } + ], + version: "0.2", + designIdentifier: "48", + status: "deprecated" + }, + { + id: "microsoft-research-jmbuzzerv20", + name: "JM Buzzer v2.0", + company: "Microsoft Research", + description: "A simple buzzer.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/snd.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 458731991 + ], + productIdentifiers: [ + 854957595 + ], + status: "deprecated" + }, + { + id: "microsoft-research-jmcrankbuttonv20", + name: "JM Crank + Button", + company: "Microsoft Research", + description: "A rotary encoder with a push button.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/crank-btn.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 284830153, + 343122531 + ], + productIdentifiers: [ + 813927310 + ], + version: "2.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmcrankv20", + name: "JM Crank", + company: "Microsoft Research", + description: "A rotary encoder without a push button.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/crank.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 284830153 + ], + productIdentifiers: [ + 866678795 + ], + version: "2.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmkeyboardkey46v10", + name: "JM Keyboard Key", + company: "Microsoft Research", + link: "https://github.com/microsoft/jacdac-padauk", + services: [ + 343122531 + ], + productIdentifiers: [ + 1067229774 + ], + version: "1.0", + designIdentifier: "46", + status: "deprecated" + }, + { + id: "microsoft-research-jmkeyboardkey46v11", + name: "JM Keyboard Key", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 343122531 + ], + productIdentifiers: [ + 911541523 + ], + version: "1.1", + designIdentifier: "46", + status: "deprecated" + }, + { + id: "microsoft-research-jmmachinelearning", + name: "JM Machine Learning", + company: "Microsoft Research", + description: "Lets you run machine learning models on data coming from Jacdac network.", + repo: "https://github.com/microsoft/pxt-tensorflow", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 336566904, + 496034245 + ], + status: "deprecated" + }, + { + id: "microsoft-research-jmmotorv21", + name: "JM Motor", + company: "Microsoft Research", + description: "Lets you control a single DC motor (up to 5V; yellow plastic ones work well).", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.1/profile/motor.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 385895640 + ], + productIdentifiers: [ + 809626198 + ], + version: "2.1", + status: "deprecated" + }, + { + id: "microsoft-research-jmpinheader45v01", + name: "JM Pin Header", + company: "Microsoft Research", + description: "A unregulated passive adapter from Jacdac to pin headers.", + link: "https://github.com/microsoft/jacdac-msr-modules", + productIdentifiers: [ + 939230090 + ], + version: "0.1", + designIdentifier: "45", + status: "deprecated" + }, + { + id: "microsoft-research-jmpower", + name: "JM Power", + company: "Microsoft Research", + description: "Lets you supply power to Jacdac network from a MicroUSB connection (eg. a USB battery pack).", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 530893146 + ], + productIdentifiers: [ + 815885628 + ], + status: "deprecated" + }, + { + id: "microsoft-research-jmprotov20", + name: "JM Proto", + company: "Microsoft Research", + description: "A prototype multi-function board.\n* ``0x3f9bc26a`` JM Touch-Proto v2.0", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0p/profile/proto.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + productIdentifiers: [ + 1052138004 + ], + version: "2.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmpwmnpxv20", + name: "JM PWM (npx)", + company: "Microsoft Research", + description: "A light-strip controller. Supports WS2812B, APA102, and SK9822.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 895762065 + ], + version: "2.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmpwmnpxv21", + name: "JM PWM (npx)", + company: "Microsoft Research", + description: "A light-strip controller with MicroUSB connector for power. Supports WS2812B, APA102, and SK9822.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 1013705700 + ], + version: "2.1", + status: "deprecated" + }, + { + id: "microsoft-research-jmpwmservov20", + name: "JM PWM (Servo)", + company: "Microsoft Research", + description: "A controller for a 5V servo.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/servo.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 318542083 + ], + productIdentifiers: [ + 816890446 + ], + version: "2.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmpwmservov21", + name: "JM PWM (Servo)", + company: "Microsoft Research", + description: "A controller for a 5V servo, with MicroUSB connector for power.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.1/profile/servo.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 318542083 + ], + productIdentifiers: [ + 986140247 + ], + version: "2.1", + status: "deprecated" + }, + { + id: "microsoft-research-jmrgbledring37v20", + name: "JM RGB LED Ring", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-rgb-led-ring-37-2.0/profile/npx.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 309264608 + ], + productIdentifiers: [ + 892295887 + ], + version: "2.0", + designIdentifier: "37", + status: "deprecated" + }, + { + id: "microsoft-research-jmrotarycontrolbuttonv10", + name: "JM Rotary Control + Button", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-rotary-control-26-1.0/profile/rotary_ctrl.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 284830153, + 343122531 + ], + productIdentifiers: [ + 1060754715 + ], + version: "1.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmslider49v10", + name: "JM Slider", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-slider-49-1.0/profile/slider.c#", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 522667846 + ], + productIdentifiers: [ + 981005156 + ], + version: "1.0", + designIdentifier: "49", + status: "deprecated" + }, + { + id: "microsoft-research-jmsliderv20", + name: "JM Slider", + company: "Microsoft Research", + description: "A linear potentiometer (slider).", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0/profile/slider.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 522667846 + ], + productIdentifiers: [ + 1043615261 + ], + version: "2.0", + status: "deprecated" + }, + { + id: "microsoft-research-jmtemperaturehumidity18v10a", + name: "JM Temperature + Humidity", + company: "Microsoft Research", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-temp-humidity-18-1.0A/profile/env3.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 337754823, + 382210232 + ], + productIdentifiers: [ + 899442616 + ], + version: "1.0A", + designIdentifier: "18", + status: "deprecated" + }, + { + id: "microsoft-research-jmtouchprotov20", + name: "JM Touch-Proto", + company: "Microsoft Research", + description: "A multi-touch sensor based on proto board.", + repo: "https://github.com/microsoft/jacdac-msr-modules", + firmwareSource: "https://github.com/microsoft/jacdac-msr-modules/blob/main/targets/jm-v2.0p/profile/multitouch.c", + link: "https://github.com/microsoft/jacdac-msr-modules", + services: [ + 416636459 + ], + productIdentifiers: [ + 1067172458 + ], + version: "2.0", + status: "deprecated" + } + ]; + function looksRandom(n) { + const s = n.toString(16); + const h = "0123456789abcdef"; + for (let i = 0; i < h.length; ++i) { + const hh = h[i]; + if (s.indexOf(hh + hh + hh) >= 0) + return false; + } + if (/f00d|dead|deaf|beef/.test(s)) + return false; + return true; + } + var DeviceCatalog = class extends JDEventSource { + constructor(options) { + super(); + this._specifications = devices_default; + this.options = options || {}; + } + /** + * Update specifications list and emit `change` event. + * @param specifications + */ + update(specifications) { + if (JSON.stringify(this._specifications) !== JSON.stringify(specifications)) { + this._specifications = specifications.slice(0); + this.emit(CHANGE); + } + } + /** + * Query device specifications + * @param options + * @returns + */ + specifications(options) { + const { includeDeprecated, includeExperimental, transport } = options || {}; + let r = this._specifications.slice(0); + if (!includeDeprecated) + r = r.filter((d) => d.status !== "deprecated"); + if (!includeExperimental) + r = r.filter((d) => d.status !== "experimental" && !!d.storeLink); + if (transport) + r = r.filter((d) => { + var _a; + return ((_a = d.transport) == null ? void 0 : _a.type) === transport; + }); + return r; + } + /** + * Query device specification from a product identifier + * @param productIdentifier + * @returns + */ + specificationFromProductIdentifier(productIdentifier) { + if (isNaN(productIdentifier)) + return void 0; + const spec = this._specifications.find( + (spec2) => { + var _a; + return ((_a = spec2.productIdentifiers) == null ? void 0 : _a.indexOf(productIdentifier)) > -1; + } + ); + return spec; + } + specificationFromIdentifier(id) { + if (id === void 0) + return void 0; + const spec = this._specifications.find((spec2) => spec2.id === id); + return spec; + } + /** + * Gets the list of devices that use this service class + * @param serviceClass + * @category Specification + */ + specificationsForService(serviceClass2, options) { + if (isNaN(serviceClass2)) + return void 0; + return this.specifications(options).filter( + (spec) => { + var _a; + return ((_a = spec.services) == null ? void 0 : _a.indexOf(serviceClass2)) > -1; + } + ); + } + /** + * Gets the list of vendor ids for a given transport + * @param type + * @returns + */ + vendorIds(type) { + const ids = this._specifications.filter((spec) => { + var _a; + return ((_a = spec.transport) == null ? void 0 : _a.type) === type; + }).map((spec) => spec.transport.vendorId); + if (type === "serial") { + const { serialVendorIds } = this.options; + if (serialVendorIds) + serialVendorIds.forEach((id) => ids.push(id)); + } + return unique(ids.filter((v) => !isNaN(v))); + } + /** + * Checks if a vendor id match the transport + * @param type + * @param id + * @returns + */ + matchVendorId(type, id) { + if (isNaN(id)) + return false; + if (Flags.developerMode) + return true; + const ids = this.vendorIds(type); + return ids.indexOf(id) > -1; + } + /** + * Generates a unique firmware identifier + * @returns + */ + uniqueFirmwareId(decimal) { + const genFirmwareId = () => { + const n = anyRandomUint32(1); + if (n === void 0) + return void 0; + return n[0] & 268435455 | 805306368; + }; + let id = genFirmwareId(); + while (id !== void 0 && (!looksRandom(id) || deviceCatalog.specificationFromProductIdentifier(id))) { + id = genFirmwareId(); + } + return id !== void 0 && (decimal ? id.toString() : toFullHex([id])); + } + /** + * Generate a unique service identifier + * @returns + */ + uniqueServiceId() { + const genServId = () => { + const n = anyRandomUint32(1); + if (n === void 0) + return void 0; + return n[0] & 268435455 | 268435456; + }; + let id = genServId(); + while (id !== void 0 && (!looksRandom(id) || serviceSpecificationFromClassIdentifier(id))) { + id = genServId(); + } + return id !== void 0 && toFullHex([id]); + } + /** + * Generate a unique device identifier + * @returns + */ + uniqueDeviceId() { + const n = anyRandomUint32(2); + return n !== void 0 && toFullHex([n[0], n[1]]); + } + }; + function deviceCatalogImage(specification, size, docsRoot) { + const sz = size || "full"; + const root = docsRoot || DOCS_ROOT; + return specification && `${root}images/devices/${identifierToUrlPath( + specification.id + )}.${sz}.jpg`; + } + function identifierToUrlPath(id) { + if (!id) + return id; + const escape = (s) => s.replace(/[.:]/g, "").toLowerCase(); + const parts = id.split(/-/g); + if (parts.length === 1) + return id.replace(/[.:]/g, "").toLowerCase(); + return `${parts.slice(0, -1).map(escape).join("-")}/${escape( + parts[parts.length - 1] + )}`; + } + var deviceCatalog = new DeviceCatalog(); + var _DeviceScriptManagerClient = class extends JDServiceClient { + constructor(service) { + super(service); + const changeEvent = service.event( + 3 + /* ProgramChange */ + ); + this.mount(changeEvent.subscribe(EVENT, () => this.emit(CHANGE))); + this.mount( + changeEvent.subscribe( + EVENT, + () => this.emit(_DeviceScriptManagerClient.PROGRAM_CHANGE) + ) + ); + const panicEvent = service.event( + 128 + /* ProgramPanic */ + ); + this.mount( + panicEvent.subscribe( + EVENT, + (args) => this.emit( + _DeviceScriptManagerClient.PROGRAM_PANIC, + ...args || [] + ) + ) + ); + } + deployBytecode(bytecode, onProgress) { + return OutPipe.sendBytes( + this.service, + 128, + bytecode, + onProgress + ); + } + async setRunning(value) { + const reg = this.service.register( + 128 + /* Running */ + ); + await reg.sendSetAsync(jdpack("u8", [value ? 1 : 0])); + } + async setAutoStart(value) { + const reg = this.service.register( + 129 + /* Autostart */ + ); + await reg.sendSetAsync(jdpack("u8", [value ? 1 : 0])); + } + }; + var DeviceScriptManagerClient = _DeviceScriptManagerClient; + DeviceScriptManagerClient.PROGRAM_CHANGE = "programChange"; + DeviceScriptManagerClient.PROGRAM_PANIC = "programPanic"; + var _DeviceScriptManagerServer = class extends JDServiceServer { + constructor() { + super(SRV_DEVICE_SCRIPT_MANAGER2); + this._binary = new Uint8Array(0); + this.running = this.addRegister(128, [false]); + this.autoStart = this.addRegister(129, [ + true + ]); + this.programSize = this.addRegister( + 384, + [this._binary.length] + ); + this.programHash = this.addRegister( + 385, + [fnv1(this._binary)] + ); + this.addCommand( + 128, + this.handleDeployBytecode.bind(this) + ); + this.addCommand( + 129, + this.handleReadBytecode.bind(this) + ); + } + get binary() { + return this._binary; + } + get debugInfo() { + return this._debugInfo; + } + setBytecode(binary, debugInfo) { + binary = binary || new Uint8Array(0); + const [hash2] = this.programHash.values(); + const valueHash = fnv1(binary); + if (hash2 !== valueHash) { + this._binary = binary; + this._debugInfo = debugInfo; + this.programSize.setValues([binary.length]); + this.programHash.setValues([valueHash]); + this.emit(_DeviceScriptManagerServer.PROGRAM_CHANGE); + this.emit(CHANGE); + this.sendEvent( + 3 + /* ProgramChange */ + ); + } + } + handleDeployBytecode(pkt) { + console.debug(`devicescript server: deploy`, { pkt }); + } + async handleReadBytecode(pkt) { + const pipe = OutPipe.from(this.device.bus, pkt, true); + await pipe.sendBytes(this._binary); + await pipe.close(); + } + }; + var DeviceScriptManagerServer = _DeviceScriptManagerServer; + DeviceScriptManagerServer.PROGRAM_CHANGE = "programChange"; + + // compiler/src/dotenv.ts + function stringToSettingValue(s) { + var _a; + if (!(s == null ? void 0 : s.length)) + return void 0; + const v = (_a = JSONTryParse(s, void 0)) != null ? _a : s; + const jv = JSON.stringify(v); + const encoded = stringToBuffer(jv); + return encoded; + } + function parseToSettings(source, secret) { + const res = {}; + source == null ? void 0 : source.split(/\r?\n/g).filter((line) => !/\s*#/.test(line)).map((line) => /(?[^=]+)\s*=(?[^#]*)#?/.exec(line)).filter((line) => !!line).forEach(({ groups }) => { + const { key, value } = groups; + delete res[key]; + res[secret ? `${key}` : key] = stringToSettingValue(value); + }); + return res; + } + + // compiler/src/jdutil.ts + function memcpy(trg, trgOff, src, srcOff, len) { + if (srcOff === void 0) + srcOff = 0; + if (len === void 0) + len = src.length - srcOff; + for (let i = 0; i < len; ++i) + trg[trgOff + i] = src[srcOff + i]; + } + function bufferEq2(a, b, offset = 0) { + if (a == b) + return true; + if (!a || !b || a.length != b.length) + return false; + for (let i = offset; i < a.length; ++i) { + if (a[i] != b[i]) + return false; + } + return true; + } + function fnv1a(data) { + let h = 2166136261; + for (let i = 0; i < data.length; ++i) { + h = Math.imul(h ^ data[i], 16777619); + } + return h; + } + function stringToUint8Array2(input) { + const len = input.length; + const res = new Uint8Array(len); + for (let i = 0; i < len; ++i) + res[i] = input.charCodeAt(i) & 255; + return res; + } + function uint8ArrayToString2(input) { + const len = input.length; + let res = ""; + for (let i = 0; i < len; ++i) + res += String.fromCharCode(input[i]); + return res; + } + function fromUTF82(binstr) { + if (!binstr) + return ""; + let escaped = ""; + for (let i = 0; i < binstr.length; ++i) { + const k = binstr.charCodeAt(i) & 255; + if (k == 37 || k > 127) { + escaped += "%" + k.toString(16); + } else { + escaped += binstr.charAt(i); + } + } + return decodeURIComponent(escaped); + } + function toUTF82(str, cesu8) { + let res = ""; + if (!str) + return res; + for (let i = 0; i < str.length; ++i) { + let code = str.charCodeAt(i); + if (code <= 127) + res += str.charAt(i); + else if (code <= 2047) { + res += String.fromCharCode(192 | code >> 6, 128 | code & 63); + } else { + if (!cesu8 && 55296 <= code && code <= 56319) { + const next = str.charCodeAt(++i); + if (!isNaN(next)) + code = 65536 + (code - 55296 << 10) + (next - 56320); + } + if (code <= 65535) + res += String.fromCharCode( + 224 | code >> 12, + 128 | code >> 6 & 63, + 128 | code & 63 + ); + else + res += String.fromCharCode( + 240 | code >> 18, + 128 | code >> 12 & 63, + 128 | code >> 6 & 63, + 128 | code & 63 + ); + } + } + return res; + } + function toHex(bytes2, sep) { + if (!bytes2) + return void 0; + let r = ""; + for (let i = 0; i < bytes2.length; ++i) { + if (sep && i > 0) + r += sep; + r += ("0" + bytes2[i].toString(16)).slice(-2); + } + return r; + } + function fromHex2(hex) { + const r = new Uint8Array(hex.length >> 1); + for (let i = 0; i < hex.length; i += 2) + r[i >> 1] = parseInt(hex.slice(i, i + 2), 16); + return r; + } + function write322(buf, pos, v) { + buf[pos + 0] = v >> 0 & 255; + buf[pos + 1] = v >> 8 & 255; + buf[pos + 2] = v >> 16 & 255; + buf[pos + 3] = v >> 24 & 255; + } + function write162(buf, pos, v) { + buf[pos + 0] = v >> 0 & 255; + buf[pos + 1] = v >> 8 & 255; + } + function read323(buf, pos) { + return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; + } + function read162(buf, pos) { + return buf[pos] | buf[pos + 1] << 8; + } + function encodeU32LE(words) { + const r = new Uint8Array(words.length * 4); + for (let i = 0; i < words.length; ++i) + write322(r, i * 4, words[i]); + return r; + } + function encodeU16LE(words) { + const r = new Uint8Array(words.length * 2); + for (let i = 0; i < words.length; ++i) + write162(r, i * 2, words[i]); + return r; + } + function decodeU32LE(buf) { + const res = []; + for (let i = 0; i < buf.length; i += 4) + res.push(read323(buf, i)); + return res; + } + function stringToBuffer2(str) { + return stringToUint8Array2(toUTF82(str)); + } + function bufferConcat2(a, b) { + const r = new Uint8Array(a.length + b.length); + r.set(a, 0); + r.set(b, a.length); + return r; + } + function bufferConcatMany(bufs) { + let sz = 0; + for (const buf of bufs) + sz += buf.length; + const r = new Uint8Array(sz); + sz = 0; + for (const buf of bufs) { + r.set(buf, sz); + sz += buf.length; + } + return r; + } + function arrayConcatMany(arrs) { + if (!arrs) + return void 0; + arrs = arrs.filter((a) => !!(a == null ? void 0 : a.length)); + let sz = 0; + for (const buf of arrs) + sz += buf.length; + const r = new Array(sz); + sz = 0; + for (const arr of arrs) { + for (let i = 0; i < arr.length; ++i) + r[i + sz] = arr[i]; + sz += arr.length; + } + return r; + } + function assert(cond, msg = "Assertion failed", debugData) { + if (!cond) { + if (debugData) + console.debug(`assertion filed ${msg}`, debugData); + debugger; + throw new Error(msg); + } + } + function roundWithPrecision2(x, digits, round = Math.round) { + digits = digits | 0; + if (digits <= 0) + return round(x); + if (x == 0) + return 0; + let r = 0; + while (r == 0 && digits < 21) { + const d = Math.pow(10, digits++); + r = round(x * d + Number.EPSILON) / d; + } + return r; + } + function prettySize(b) { + b = b | 0; + if (b === 0) + return "0kb"; + else if (b < 100) + return b + "b"; + else if (b < 1e3) + return roundWithPrecision2(b / 1e3, 2) + "kb"; + else if (b < 1e6) + return roundWithPrecision2(b / 1e3, 1) + "kb"; + else + return roundWithPrecision2(b / 1e6, 1) + "mb"; + } + function ellipseFirstSentence(text) { + if (!text) + return text; + const i = text.indexOf("."); + if (i < 0) + return text; + else + return text.slice(0, i + 1); + } + function range(end) { + return Array(end).fill(0).map((_, i) => i); + } + + // compiler/src/util.ts + function oops(msg) { + debugger; + throw new Error(msg); + } + function assert2(cond, msg = "") { + if (!cond) + oops("assertion failed" + (msg ? ": " + msg : "")); + } + function assertRange(min, v, max, desc = "value") { + if (min <= v && v <= max) + return; + oops(`${desc}=${v} out of range [${min}, ${max}]`); + } + function strlen(s) { + return toUTF82(s).length; + } + function snakify(s) { + const up = s.toUpperCase(); + const lo = s.toLowerCase(); + if (s == up || s == lo) + return s; + if (s.lastIndexOf("_") > 0) + return s; + const isUpper = (i2) => s[i2] != lo[i2]; + const isLower = (i2) => s[i2] != up[i2]; + let r = ""; + let i = 0; + while (i < s.length) { + let upperMode = isUpper(i); + let j = i; + while (j < s.length) { + if (upperMode && isLower(j)) { + if (j - i > 2) { + j--; + break; + } else { + upperMode = false; + } + } + if (!upperMode && isUpper(j)) { + break; + } + j++; + } + if (r) + r += "_"; + r += s.slice(i, j); + i = j; + } + if (r.toUpperCase() === r) { + return r; + } + return r.toLowerCase(); + } + function camelize(name) { + if (!name) + return name; + return name[0].toLowerCase() + name.slice(1).replace(/\s+/g, "_").replace(/_([a-z0-9])/gi, (_, l) => l.toUpperCase()); + } + function upperFirst(name) { + return name[0].toUpperCase() + name.slice(1); + } + function lowerFirst(r) { + if (/[a-z]/.test(r)) + return r[0].toLowerCase() + r.slice(1); + else + return r; + } + function upperCamel(name) { + name = camelize(name); + if (!(name == null ? void 0 : name.length)) + return name; + return upperFirst(name); + } + function addUnique(arr, v) { + let idx = arr.indexOf(v); + if (idx < 0) { + idx = arr.length; + arr.push(v); + } + return idx; + } + function numSetBits(n) { + let r = 0; + for (let i = 0; i < 32; ++i) + if (n & 1 << i) + r++; + return r; + } + function TODO(msg = "") { + throw new Error("TODO: " + msg); + } + if (typeof global != "undefined") { + ; + global.watchProp = function watch(obj, prop) { + const key = "__" + prop + "__"; + obj[key] = obj[prop]; + Object.defineProperty(obj, prop, { + get: () => obj[key], + set: (v) => { + debugger; + obj[key] = v; + } + }); + }; + } + + // compiler/src/dcfg.ts + var DCFG_MAGIC0 = 1195787076; + var DCFG_MAGIC1 = 3400833802; + var DCFG_KEYSIZE = 15; + var DCFG_TYPE_BITS = 2; + var DCFG_TYPE_MASK = (1 << DCFG_TYPE_BITS) - 1; + var DCFG_SIZE_BITS = 16 - DCFG_TYPE_BITS; + var DCFG_HASH_BITS = 16; + var DCFG_HASH_JUMP_BITS = 5; + var DCFG_HASH_JUMP_ENTRIES = 1 << DCFG_HASH_JUMP_BITS; + var DCFG_HASH_SHIFT = DCFG_HASH_BITS - DCFG_HASH_JUMP_BITS; + var DCFG_TYPE_U32 = 0; + var DCFG_TYPE_I32 = 1; + var DCFG_TYPE_STRING = 2; + var DCFG_TYPE_BLOB = 3; + var DCFG_TYPE_INVALID = 255; + var DCFG_HEADER_HASH_JUMP_OFFSET = 6 * 4; + var DCFG_HEADER_SIZE = DCFG_HEADER_HASH_JUMP_OFFSET + 2 * DCFG_HASH_JUMP_ENTRIES; + var DCFG_ENTRY_SIZE = DCFG_KEYSIZE + 1 + 2 * 4; + var entoff = DCFG_KEYSIZE + 1; + function entrySize(e, off = 0) { + return read162(e, off + entoff + 2) >> DCFG_TYPE_BITS; + } + function entryType(e, off = 0) { + return read162(e, off + entoff + 2) & DCFG_TYPE_MASK; + } + function entryHash(e, off = 0) { + return read162(e, off + entoff); + } + function entryValue(e, off = 0) { + return read323(e, off + entoff + 4); + } + function keyhash(key) { + if (typeof key == "string") + key = stringToUint8Array2(key); + const h = fnv1a(key); + return h >>> 16 ^ h & 65535; + } + function serializeDcfg(entries, noVerify = false, noHash = false) { + const numEntries = Object.keys(entries).length; + if (numEntries > 61440) + throw new Error("dcfg: too many entries"); + let dataOff = DCFG_HEADER_SIZE + (numEntries + 1) * DCFG_ENTRY_SIZE; + let dataEntries = []; + const binEntries = Object.keys(entries).map(mkEntry); + binEntries.sort((a, b) => entryHash(a) - entryHash(b)); + const hd = new Uint8Array(DCFG_HEADER_SIZE); + write322(hd, 0, DCFG_MAGIC0); + write322(hd, 4, DCFG_MAGIC1); + write322(hd, 8, dataOff); + write162(hd, 12, numEntries); + const finalEntry = new Uint8Array(DCFG_ENTRY_SIZE); + finalEntry.fill(255); + finalEntry[0] = 0; + binEntries.push(finalEntry); + for (let i = 0; i < DCFG_HASH_JUMP_ENTRIES; ++i) { + const idx = binEntries.findIndex( + (e) => entryHash(e) >> DCFG_HASH_SHIFT >= i + ); + write162(hd, DCFG_HEADER_HASH_JUMP_OFFSET + 2 * i, idx); + } + if (!noHash) { + const tmp = {}; + Object.entries(entries).forEach(([k, v]) => { + if (k.startsWith("@")) + return; + tmp[k] = v; + }); + if (Object.keys(tmp).length == 0) { + write322(hd, 16, 1); + write322(hd, 20, 0); + } else { + const filtered = serializeDcfg(tmp, true, true); + write322(hd, 16, fnv1a(filtered)); + write322(hd, 20, fnv1a(filtered.slice(4))); + } + } + const res = bufferConcatMany([hd, ...binEntries, ...dataEntries]); + assert(res.length == dataOff); + if (!noVerify) { + const decoded = decodeDcfg(res); + if (decoded.errors.length == 0) { + for (const k of Object.keys(entries)) { + if (entries[k] != decoded.settings[k]) + decoded.errors.push(`mismatch at ${k}`); + } + for (const k of Object.keys(decoded.settings)) { + if (entries[k] != decoded.settings[k]) + decoded.errors.push(`mismatch at ${k}`); + } + } + if (decoded.errors.length) + throw new Error(decoded.errors.join("\n")); + } + return res; + function pushBuffer(b) { + b = bufferConcat2(b, new Uint8Array(1)); + dataOff += b.length; + dataEntries.push(b); + return b.length - 1; + } + function mkEntry(k) { + const v = entries[k]; + const kb = stringToUint8Array2(k); + if (kb.length > DCFG_KEYSIZE) + throw new Error(`dcfg key too long: '${k}' (limit ${DCFG_KEYSIZE})`); + let value = 0; + let type = 0; + let size = 0; + if (typeof v == "string") { + value = dataOff; + size = pushBuffer(stringToBuffer2(v)); + type = DCFG_TYPE_STRING; + } else if (v instanceof Uint8Array) { + value = dataOff; + size = pushBuffer(v); + type = DCFG_TYPE_BLOB; + } else if (typeof v == "number") { + if ((v | 0) == v) { + value = v; + type = DCFG_TYPE_I32; + } else if (v >>> 0 == v) { + value = v; + type = DCFG_TYPE_U32; + } else { + throw new Error(`dcfg number has to be i32 or u32: ${k}=${v}`); + } + } else { + throw new Error(`invalid dcfg value: ${k}=${v}`); + } + if (size >= 1 << DCFG_SIZE_BITS) + throw new Error( + `value for '${k}' too big (${size} bytes, max ${1 << DCFG_SIZE_BITS})` + ); + const e = new Uint8Array(DCFG_ENTRY_SIZE); + e.set(kb); + write162(e, entoff, keyhash(kb)); + write162(e, entoff + 2, type | size << DCFG_TYPE_BITS); + write322(e, entoff + 4, value); + return e; + } + } + function findDcfgOffsets(buf) { + const idx = []; + for (let i = 0; i < buf.length - 32; i += 4) { + if (read323(buf, i) == DCFG_MAGIC0 && read323(buf, i + 4) == DCFG_MAGIC1) + idx.push(i); + } + return idx; + } + function getEntry(buf, key) { + const kb = stringToUint8Array2(key); + if (kb.length > DCFG_KEYSIZE) + return null; + const hash2 = keyhash(kb); + const hidx = hash2 >> DCFG_HASH_SHIFT; + let idx = read162(buf, DCFG_HEADER_HASH_JUMP_OFFSET + 2 * hidx); + const num = read162(buf, 12); + const kb0 = [...kb, 0]; + while (idx < num) { + const eoff = DCFG_HEADER_SIZE + idx * DCFG_ENTRY_SIZE; + if (!(entryHash(buf, eoff) <= hash2)) + break; + if (entryHash(buf, eoff) == hash2 && bufferEq2(buf.slice(eoff, eoff + kb0.length), kb0)) + return buf.slice(eoff, eoff + DCFG_ENTRY_SIZE); + idx++; + } + return null; + } + function decodeDcfg(buf) { + const res = { + errors: [], + hash: toHex2(buf.slice(16, 24)), + settings: {} + }; + if (!buf || buf.length < DCFG_HEADER_SIZE) + return error("too small buffer"); + if (read323(buf, 0) != DCFG_MAGIC0 || read323(buf, 4) != DCFG_MAGIC1) + return error("bad magic"); + const totalBytes = read323(buf, 8); + if (buf.length < totalBytes) + return error( + `buffer declared ${totalBytes} bytes but only ${buf.length} long` + ); + buf = new Uint8Array(buf.slice(0, totalBytes)); + const numEntries = read162(buf, 12); + { + const eoff = DCFG_HEADER_SIZE + numEntries * DCFG_ENTRY_SIZE; + const doff = eoff + entoff; + if (entryHash(buf, eoff) != 65535 || read162(buf, doff + 2) != 65535) + error("final entry hash non 0xffff hash/size/type"); + } + const hash_jump = buf.slice( + DCFG_HEADER_HASH_JUMP_OFFSET, + DCFG_HEADER_HASH_JUMP_OFFSET + DCFG_HASH_JUMP_ENTRIES * 2 + ); + const hashAt = (idx) => entryHash(buf, DCFG_HEADER_SIZE + idx * DCFG_ENTRY_SIZE) >> DCFG_HASH_SHIFT; + for (let i = 0; i < DCFG_HASH_JUMP_ENTRIES; ++i) { + let idx = read162(hash_jump, i * 2); + if (idx > numEntries) + error(`hash jump idx out of range`); + else if (hashAt(idx) < i) + error(`hash jump too large at ${i}`); + else if (idx > 0 && hashAt(idx - 1) >= i) + error(`hash jump too small at ${i}`); + } + const dataPtrMin = DCFG_HEADER_SIZE + (numEntries + 1) * DCFG_ENTRY_SIZE; + let prevHash = 0; + for (let i = 0; i < numEntries; ++i) { + const eoff = DCFG_HEADER_SIZE + i * DCFG_ENTRY_SIZE; + let ep = eoff; + while (buf[ep]) + ep++; + const keylen = ep - eoff; + if (keylen > DCFG_KEYSIZE) { + error(`no NUL termination in key #${i}`); + continue; + } + const kb = buf.slice(eoff, ep); + const key = uint8ArrayToString2(kb); + const ent = buf.slice(eoff, eoff + DCFG_ENTRY_SIZE); + { + const ent2 = getEntry(buf, key); + if (!ent2 || !bufferEq2(ent2, ent)) + error(`invalid lookup at '${key}'`); + } + const hash2 = entryHash(ent); + const type = entryType(ent); + const size = entrySize(ent); + const value = entryValue(ent); + let realValue; + if (!(prevHash <= hash2)) + error(`hash not in order at '${key}'`); + prevHash = hash2; + if (keyhash(kb) != hash2) + error(`invalid hash at key '${key}'`); + switch (type) { + case DCFG_TYPE_I32: + if (size != 0) + error(`invalid size ${size} for i32 entry '${key}'`); + realValue = value | 0; + break; + case DCFG_TYPE_U32: + if (size != 0) + error(`invalid size ${size} for u32 entry '${key}'`); + realValue = value >>> 0; + break; + case DCFG_TYPE_BLOB: + case DCFG_TYPE_STRING: + if (value < dataPtrMin || value + size >= buf.length) { + error(`string offset out of range ${value} at '${key}'`); + continue; + } else { + if (buf[value + size] != 0) + error(`string not NUL terminated '${key}'`); + realValue = buf.slice(value, value + size); + if (type == DCFG_TYPE_STRING) { + realValue = fromUTF82(uint8ArrayToString2(realValue)); + if (realValue.includes("\0")) + error(`NUL character in string at '${key}'`); + } + } + break; + default: + error(`invalid entry type ${type} at '${key}'`); + continue; + } + res.settings[key] = realValue; + } + return res; + function error(msg) { + res.errors.push(msg); + return res; + } + } + function decompileDcfg(settings) { + const res = {}; + const dot = ".".charCodeAt(0); + for (const key of Object.keys(settings)) { + let prevI = 0; + let obj = res; + for (let i = 0; i < key.length; ++i) { + const c = key.charCodeAt(i); + const isArrayElt = c >= 128; + const isObjSep = c == dot; + if (isArrayElt || isObjSep) { + let pref = key.slice(prevI, i); + prevI = i + 1; + if (pref == "") + pref = "services"; + if (obj[pref] === void 0) + obj[pref] = isArrayElt ? [] : {}; + obj = obj[pref]; + if (isArrayElt != Array.isArray(obj)) + throw new Error(`obj/array mismatch at ${key}`); + if (isArrayElt) { + const aidx = c - 128; + if (i == key.length - 1) { + obj[aidx] = settings[key]; + prevI = -1; + } else { + if (obj[aidx] === void 0) + obj[aidx] = {}; + obj = obj[aidx]; + } + } + } + } + if (prevI != -1) + obj[key.slice(prevI)] = settings[key]; + } + return res; + } + function jsonToDcfg(obj, interpretStrings = false) { + const res = {}; + const flattenObj = (val, key) => { + if (typeof val == "boolean") + val = val ? 1 : 0; + if (typeof val == "string") { + if (interpretStrings) { + const tmp = parseAnyInt(val); + if (tmp != void 0) + val = tmp; + else if (/^hex:[0-9a-f ]+$/.test(val)) { + val = fromHex2(val.slice(4).replace(/ /g, "")); + } + } + res[key] = val; + } else if (typeof val == "number") { + if ((val | 0) != val && val >>> 0 != val) + throw new Error("non u32/i32 number"); + res[key] = val; + } else if (Array.isArray(val)) { + for (let i = 0; i < val.length; ++i) { + if (val[i] != null) + flattenObj(val[i], key + String.fromCharCode(128 + i)); + } + } else if (typeof val == "object") { + for (const subkey of Object.keys(val)) { + if (subkey.startsWith("$")) + continue; + if (subkey.startsWith("#")) + continue; + let suff = !key && subkey == "services" ? "" : subkey; + if (suff.length && key.length && key.charCodeAt(key.length - 1) < 128) + suff = "." + suff; + flattenObj(val[subkey], key + suff); + } + } else { + throw new Error(`invalid value ${key}: ${val}`); + } + }; + flattenObj(obj, ""); + return res; + } + async function expandDcfgJSON(fn, readFile) { + return await expand(fn); + async function expand(fn2) { + const mainJson = await readJSON(fn2); + if (mainJson["$include"]) { + const prev = await expand(mainJson["$include"]); + delete mainJson["$include"]; + for (const serv of ["$services", "services"]) { + if (Array.isArray(mainJson[serv]) && Array.isArray(prev[serv])) { + for (const p of prev[serv]) { + const ex = mainJson[serv].findIndex( + (e) => e.service == p.service + ); + if (ex >= 0) { + Object.assign(p, mainJson[serv][ex]); + mainJson[serv][ex] = p; + } else { + mainJson[serv].push(p); + } + } + delete prev[serv]; + } + } + for (const k of Object.keys(prev)) { + if (mainJson[k] === void 0) + mainJson[k] = prev[k]; + } + } + return mainJson; + } + async function readJSON(fn2) { + const input = await readFile(fn2); + try { + const r = JSON.parse(input); + if (!r || typeof r != "object" || Array.isArray(r)) + throw new Error("expecting JSON object"); + return r; + } catch (e) { + throw new Error(`${fn2}: JSON parsing: ${e.message}`); + } + } + } + + // compiler/src/magic.ts + var IMAGE_MIN_LENGTH2 = 100; + function read324(buf, pos) { + return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; + } + function checkMagic2(img) { + return read324(img, 0) === 1400268100 /* MAGIC0 */ && read324(img, 4) === 4046024202 /* MAGIC1 */; + } + + // compiler/src/disassemble.ts + var OpTree = class { + constructor(opcode) { + this.opcode = opcode; + this.args = void 0; + this.intArg = void 0; + } + }; + var OpStmt = class extends OpTree { + }; + var ImgFunction = class { + constructor(parent, index, bytecode, name) { + this.parent = parent; + this.index = index; + this.bytecode = bytecode; + this.name = name; + } + get numLocals() { + return this.numSlots - this.numArgs; + } + disassemble(verbose = false) { + const tpMap = { + B: 0 /* BUFFER */, + U: 3 /* UTF8 */, + A: 2 /* ASCII */, + I: 1 /* BUILTIN */ + }; + const resolver = { + verboseDisasm: verbose, + describeCell: (ff, idx) => { + var _a, _b, _c; + switch (ff) { + case "B": + case "U": + case "A": + case "I": + return this.parent.describeString(tpMap[ff], idx); + case "O": + return BUILTIN_OBJECT__VAL[idx] || "???"; + case "F": + return ((_c = (_b = (_a = this.parent.functions) == null ? void 0 : _a[idx]) == null ? void 0 : _b.name) != null ? _c : "") + "_F" + idx; + case "L": + if (this.flags & 1 /* NEEDS_THIS */) { + if (idx == 0) + return "this"; + idx--; + } + if (idx < this.numArgs) + return "par" + idx; + idx -= this.numArgs; + return "loc" + idx; + case "G": + return ""; + case "S": + return "serviceSpec" + idx; + case "D": + return this.parent.floatTable[idx] + ""; + } + } + }; + const txtArgs = range(this.numArgs).map((i) => "par" + i); + let pref = "proc"; + if (this.flags & 1 /* NEEDS_THIS */) { + txtArgs.pop(); + txtArgs.unshift("this"); + pref = "method"; + } + if (this.flags & 2 /* IS_CTOR */) { + pref = "ctor"; + } + const fullname = `${pref} ${this.name}_F${this.index}`; + let r = `${fullname}(${txtArgs.join(", ")}): @${this.imgOffset} +`; + if (this.numLocals) + r += ` locals: ${range(this.numLocals).map((i) => "loc" + i)} +`; + const stmts = this.parseBytecode(); + const srcmap = this.parent.srcmap; + let prevPos = ""; + for (const stmt of stmts) { + let res = stringifyInstr(stmt, resolver); + const pos = srcmap && stmt.srcPos ? srcmap.posToString(stmt.srcPos).replace(/.*\//, "") : ""; + if (pos && pos != prevPos) { + res = "// " + pos + "\n" + res; + prevPos = pos; + } + if (verbose) { + res += " // " + toHex(this.bytecode.slice(stmt.pc, stmt.pcEnd)); + } + r += res + "\n"; + } + return r; + } + toStmts() { + if (!this.stmtsCache) + this.stmtsCache = this.parseBytecode(true); + return this.stmtsCache; + } + stmtByGlobalPc(pc) { + pc -= this.imgOffset; + if (pc < 0 || pc > this.bytecode.length) + throw new Error("pc out of range"); + const stmts = this.toStmts(); + for (let i = 0; i < stmts.length; ++i) { + const s = stmts[i]; + if (s.pc <= pc && pc < s.pcEnd) + return s; + } + throw new Error("pc not found?"); + } + findZoneExits(start, inZone) { + const stmts = this.toStmts(); + const exits = []; + assert(stmts[start.index] === start); + assert(inZone(start)); + const visited = []; + find(start.index); + return exits; + function find(idx) { + while (!visited[idx]) { + visited[idx] = true; + const s = stmts[idx]; + const zone = inZone(s); + if (zone) { + if (s.jmpTrg) { + if (stmtIsFinal(s.opcode)) { + idx = s.jmpTrg.index; + } else if (s.opcode == 80 /* STMTx_TRY */) { + idx++; + } else if (s.opcode == 14 /* STMTx1_JMP_Z */) { + find(idx + 1); + idx = s.jmpTrg.index; + } else { + throw new Error("unknown jump: " + Op[s.opcode]); + } + } else { + if (stmtIsFinal(s.opcode)) + break; + idx++; + } + } else { + exits.push(s); + break; + } + } + } + } + parseBytecode(throwOnError = false) { + const stmts = parseBytecode(this.bytecode, throwOnError); + const srcmap = this.parent.srcmap; + if (srcmap) + for (const stmt of stmts) { + if (!stmt.error) { + const [pos, len] = srcmap.resolvePc( + this.imgOffset + stmt.pc + ); + stmt.srcPos = pos; + stmt.srcLen = len; + } + } + return stmts; + } + }; + function parseBytecode(bytecode, throwOnError = false) { + let pc = 0; + let stmtStart = 0; + let jmpoff = 0; + const getbyte = () => { + return bytecode[pc++]; + }; + const stmts = []; + const byPc = []; + let bend = bytecode.length - 1; + while (bytecode[bend] === 0) + bend--; + bend++; + bend = Math.max(bytecode.length - 4, bend); + while (pc < bend) { + try { + stmtStart = pc; + jmpoff = NaN; + const op = decodeOp(); + const stmt = new OpStmt(op.opcode); + stmt.pc = stmtStart; + stmt.pcEnd = pc; + stmt.intArg = op.intArg; + stmt.args = op.args; + if (opJumps(stmt.opcode)) { + const trg = jmpoff + stmt.intArg; + if (!(0 <= trg && trg < bytecode.length)) { + error(`invalid jmp target: ${jmpoff} + ${stmt.intArg}`); + } + stmt.intArg = trg; + } + stmt.index = stmts.length; + stmts.push(stmt); + byPc[stmt.pc] = stmt; + } catch (e) { + if (throwOnError) { + throw e; + } else { + const stmt = new OpStmt(87 /* STMT0_DEBUGGER */); + stmt.error = e.message; + if (stmtStart == pc) + pc++; + stmt.pc = stmtStart; + stmt.pcEnd = pc; + stmts.push(stmt); + } + } + } + for (const stmt of stmts) { + try { + if (opJumps(stmt.opcode)) { + const trg = byPc[stmt.intArg]; + if (!trg) + error(`can't find jump target ${stmt.intArg}`); + stmt.jmpTrg = trg; + } + } catch (e) { + if (throwOnError) + throw e; + else + stmt.error = e.message; + } + } + return stmts; + function opJumps(op) { + var _a; + return ((_a = OP_PRINT_FMTS[op]) != null ? _a : "").includes("%j"); + } + function decodeOp() { + const stack2 = []; + for (; ; ) { + const op = getbyte(); + if (op == 0 && pc - stmtStart == 1) + return new OpTree(87 /* STMT0_DEBUGGER */); + const e = new OpTree(op); + if (opTakesNumber(op)) { + jmpoff = pc - 1; + e.intArg = decodeInt(); + } + let n = opNumRealArgs(op); + if (n) { + if (stack2.length < n) + error("stack underflow"); + e.args = stack2.slice(stack2.length - n); + while (n--) + stack2.pop(); + } + stack2.push(e); + if (opIsStmt(op)) + break; + } + if (stack2.length != 1) + error(`bad stack ${stack2.length}`); + return stack2[0]; + } + function currStmt() { + return toHex(bytecode.slice(stmtStart, pc)); + } + function error(msg) { + throw new Error("Op-decode: " + msg + "; " + currStmt()); + } + function decodeInt() { + const v = getbyte(); + if (v < 248 /* FIRST_MULTIBYTE_INT */) + return v; + let r = 0; + const n = !!(v & 4); + const len = (v & 3) + 1; + for (let i = 0; i < len; ++i) { + const v2 = getbyte(); + r = r << 8; + r |= v2; + } + return n ? -r : r; + } + } + function stringifyInstr(stmt, resolver) { + if (stmt.error) + return `???oops: ${stmt.error}`; + let res = " " + stringifyExpr(resolver, stmt); + const pc = stmt.pc; + if (pc !== void 0) + res = (pc > 9999 ? pc : (" " + pc).slice(-4)) + ": " + res; + return res; + } + function stringifyExpr(resolver, t) { + var _a; + const op = t.opcode; + if (op >= 128 /* DIRECT_CONST_OP */) + return "" + (op - 128 /* DIRECT_CONST_OP */ - 16 /* DIRECT_CONST_OFFSET */); + let fmt = OP_PRINT_FMTS[op]; + if (!fmt) + return `???oops op${op}`; + let ptr = 0; + let beg = 0; + let r = ""; + const args = (t.args || []).map((e) => stringifyExpr(resolver, e)); + if (t.intArg != void 0) + args.unshift(t.intArg + ""); + t.intArg = void 0; + if (fmt.startsWith("{swap}")) { + args.reverse(); + fmt = fmt.slice(6); + } + while (ptr < fmt.length) { + if (fmt.charCodeAt(ptr) != 37) { + ptr++; + continue; + } + r += fmt.slice(beg, ptr); + ptr++; + beg = ptr + 1; + let e = (_a = args.shift()) != null ? _a : "???oops"; + const eNum = isNumber(e) ? +e : null; + const ff = fmt[ptr]; + switch (ff) { + case "e": + break; + case "n": + e = numfmt(e); + break; + case "o": + e = callop(e); + break; + case "j": + e = eNum + ""; + break; + default: + e = "{" + ff + e + "}"; + if (eNum != null && resolver) { + const pref = resolver.describeCell(ff, eNum); + if (pref) { + if (resolver.verboseDisasm) + e = pref + e; + else + e = pref; + } + } + break; + } + r += e; + ptr++; + } + r += fmt.slice(beg); + return r; + } + function isNumber(s) { + return /^-?\d+$/.test(s); + } + function numfmt(vv) { + if (!isNumber(vv)) + return vv; + return numfmtToString(+vv); + } + function callop(op) { + if (isNumber(op)) + switch (+op) { + case 0 /* SYNC */: + return ""; + case 1 /* BG */: + return " bg"; + case 2 /* BG_MAX1 */: + return " bg (max1)"; + case 3 /* BG_MAX1_PEND1 */: + return " bg (max1 pend1)"; + } + else + return ` callop=${op}`; + } + var Image = class { + constructor(input) { + this.errors = []; + this.sizeInfo = ""; + if (typeof input == "string") { + this.dbg = JSON.parse(input); + } else if (input instanceof Uint8Array) { + if (input[0] == 123) { + this.dbg = JSON.parse(fromUTF82(uint8ArrayToString2(input))); + } else { + this.devsBinary = input; + } + } else { + this.dbg = input; + } + if (!this.devsBinary && this.dbg) + this.devsBinary = fromHex2(this.dbg.binary.hex); + if (this.dbg) + this.srcmap = SrcMapResolver.from(this.dbg); + this.load(); + } + error(msg) { + this.errors.push(msg); + } + stringTable(tp) { + switch (tp) { + case 0 /* BUFFER */: + return this.bufferTable; + case 2 /* ASCII */: + return this.asciiTable; + case 3 /* UTF8 */: + return this.utf8Table; + case 1 /* BUILTIN */: + return this.bultinTable; + } + return void 0; + } + describeString(tp, idx, detail = false) { + const v = this.getString(tp, idx); + if (v === void 0) + return void 0; + let r = ""; + if (v instanceof Uint8Array) + r = toHex(v); + else + r = JSON.stringify(v); + if (detail && tp == 3 /* UTF8 */) { + r = `${r} (${this.utf8TableInfo[idx]})`; + } + return r; + } + getString(tp, idx) { + var _a; + return (_a = this.stringTable(tp)) == null ? void 0 : _a[idx]; + } + load() { + const img = this.devsBinary; + const error = (m) => this.error(m); + if (!img || img.length < IMAGE_MIN_LENGTH2) { + this.error(`img too small`); + return; + } + if (!checkMagic2(img)) { + this.error(`invalid magic`); + return; + } + const v = parseImgVersion(read323(img, 8)); + if (v.major != 2 /* IMG_VERSION_MAJOR */ || v.minor > 15 /* IMG_VERSION_MINOR */) { + this.error( + `invalid version ${read323(img, 8).toString( + 16 + )} (exp: ${34537478 /* IMG_VERSION */.toString(16)})` + ); + return; + } + this.numGlobals = read162(img, 12); + this.numSpecs = read162(img, 14); + const [ + funDesc, + funData, + floatData, + roleData, + asciiDesc, + utf8Desc, + bufferDesc, + strData, + specData, + dcfgData + ] = range(10 /* NUM_IMG_SECTIONS */).map( + (i) => decodeSection( + img, + 32 /* FIX_HEADER_SIZE */ + i * 8 /* SECTION_HEADER_SIZE */ + ) + ); + this.sizeInfo = `// fun: ${funDesc.length}+${funData.length}, float: ${floatData.length}, strings: A:${asciiDesc.length}+U:${utf8Desc.length}+B:${bufferDesc.length}+D:${strData.length} specs: ${specData.length}, dcfg: ${dcfgData.length} +`; + this.specData = specData; + this.dcfgData = dcfgData; + const floatArr = new Float64Array(floatData.buffer).slice(); + const intFloatArr = new Int32Array(floatData.buffer); + for (let idx = 0; idx < floatArr.length; ++idx) { + if (intFloatArr[idx * 2 + 1] == -1) + floatArr[idx] = intFloatArr[idx * 2]; + } + this.floatTable = floatArr; + this.asciiTable = range( + asciiDesc.length / 2 /* ASCII_HEADER_SIZE */ + ).map((idx) => getString2(2 /* ASCII */, idx)); + this.utf8Table = range(utf8Desc.length / 4 /* UTF8_HEADER_SIZE */).map( + (idx) => getString2(3 /* UTF8 */, idx) + ); + this.utf8TableInfo = range( + utf8Desc.length / 4 /* UTF8_HEADER_SIZE */ + ).map((idx) => { + const r = utf8Info(idx); + return `${r.size} bytes ${r.len} codepoints`; + }); + this.bufferTable = range( + bufferDesc.length / 8 /* SECTION_HEADER_SIZE */ + ).map((idx) => getStringBuf(0 /* BUFFER */, idx)); + this.bultinTable = BUILTIN_STRING__VAL.slice(); + this.functions = range( + funDesc.length / 16 /* FUNCTION_HEADER_SIZE */ + ).map((idx) => { + var _a; + const off = idx * 16 /* FUNCTION_HEADER_SIZE */; + const name = getString1(read162(funDesc, off + 12)); + const body = decodeSection(funDesc, off, img); + const fn = new ImgFunction(this, idx, body, name); + fn.numArgs = funDesc[off + 10]; + fn.flags = funDesc[off + 11]; + fn.numSlots = read162(funDesc, off + 8); + fn.imgOffset = read323(funDesc, off); + fn.dbg = (_a = this.dbg) == null ? void 0 : _a.functions[idx]; + return fn; + }); + return; + function getString1(idx) { + const tp = idx >> 14 /* _SHIFT */; + idx &= (1 << 14 /* _SHIFT */) - 1; + return getString2(tp, idx); + } + function getString2(tp, idx) { + const buf = getStringBuf(tp, idx); + if (tp == 0 /* BUFFER */) + return toHex(buf); + else + return fromUTF82(uint8ArrayToString2(buf)); + } + function utf8Info(idx) { + idx *= 4 /* UTF8_HEADER_SIZE */; + assert(4 /* UTF8_HEADER_SIZE */ == 4); + const none = { + size: 0, + len: 0, + buf: new Uint8Array(0) + }; + if (idx + 4 > utf8Desc.length) { + error("utf8 index out of range"); + return none; + } + const start = read323(utf8Desc, idx); + if (start >= strData.length) { + error("utf8 start out of range"); + return none; + } + const size = read162(strData, start); + const len = read162(strData, start + 2); + const jmpent = len >> 4 /* UTF8_TABLE_SHIFT */; + const datastart = start + (2 + jmpent) * 2; + return { + size, + len, + buf: strData.slice(datastart, datastart + size) + }; + } + function getStringBuf(tp, idx) { + if (tp == 1 /* BUILTIN */) { + return stringToUint8Array2(BUILTIN_STRING__VAL[idx]); + } else if (tp == 2 /* ASCII */) { + idx *= 2 /* ASCII_HEADER_SIZE */; + if (idx + 2 > asciiDesc.length) { + error("ascii index out of range"); + return new Uint8Array(0); + } + const start = read162(asciiDesc, idx); + if (start >= strData.length) { + error("ascii start out of range"); + return new Uint8Array(0); + } + for (let i = start; i < strData.length; ++i) { + if (strData[i] === 0) + return strData.slice(start, i); + } + error("missing NUL"); + return new Uint8Array(0); + } else if (tp == 3 /* UTF8 */) { + return utf8Info(idx).buf; + } else if (tp == 0 /* BUFFER */) { + return decodeSection( + bufferDesc, + idx * 8 /* SECTION_HEADER_SIZE */, + strData + ); + } else { + assert(false); + } + } + function decodeSection(buf, off, img2) { + if (off < 0 || off + 8 /* SECTION_HEADER_SIZE */ > buf.length) { + error(`section header out of range ${off}`); + return new Uint8Array(0); + } + if (off & 3) + error(`unaligned section: ${off}`); + const start = read323(buf, off); + const len = read323(buf, off + 4); + if (!img2) + img2 = buf; + if (start + len > img2.length) { + error(`section bounds out of range at ${off}: ${start}+${len}`); + return new Uint8Array(0); + } + return new Uint8Array(img2.slice(start, start + len)); + } + } + disassemble(verbose = false) { + const img = this; + let r = `// img size ${this.devsBinary.length} +// ${this.numGlobals} globals, ${this.functions.length} functions +` + this.sizeInfo; + for (const fn of this.functions) + r += "\n" + fn.disassemble(verbose); + printStrings("ASCII", 2 /* ASCII */); + printStrings("UTF8", 3 /* UTF8 */); + printStrings("buffer", 0 /* BUFFER */); + r += ` +Doubles: +`; + for (let i = 0; i < this.floatTable.length; ++i) { + r += (" " + i).slice(-4) + ": " + this.floatTable[i] + "\n"; + } + if (this.dcfgData.length == 0) { + r += "\nDCFG: None\n\n"; + } else { + const settings = decodeDcfg(this.dcfgData); + r += settings.errors.map((e) => `; DCFG-error: ${e} +`).join("\n"); + const json = decompileDcfg(settings.settings); + if (Array.isArray(json.services) && json.services.slice(0, 64).every((s) => s == null)) + json.services = json.services.slice(64); + r += ` +DCFG: h=${settings.hash} sz=${this.dcfgData.length} ` + JSON.stringify(json, null, 4) + "\n\n"; + } + const specData = this.specData; + for (let i = 0; i < this.numSpecs; i++) { + const sz = 16 /* SERVICE_SPEC_HEADER_SIZE */; + const servSpec = specData.slice(i * sz, i * sz + sz); + const flags = read162(servSpec, 2); + const cls = read323(servSpec, 4).toString(16); + const numPackets = read162(servSpec, 8); + const pkts_offset = read162(servSpec, 10) * 4; + const name = getString1(read162(servSpec, 0)); + r += `SPEC ${name} 0x${cls} (f=${flags}) +`; + for (let j = 0; j < numPackets; ++j) { + const off = pkts_offset + j * 8 /* SERVICE_SPEC_PACKET_SIZE */; + const pktSpec = specData.slice( + off, + off + 8 /* SERVICE_SPEC_PACKET_SIZE */ + ); + const pname = getString1(read162(pktSpec, 0)); + const code = read162(pktSpec, 2); + const flags2 = read162(pktSpec, 4); + const numfmtOrOffset = read162(pktSpec, 6); + const isOffset = !!(flags2 & 1 /* MULTI_FIELD */); + const numfmt2 = isOffset ? "{...}" : numfmtToString(numfmtOrOffset); + const codeType = code & 61440 /* MASK */; + const tpName = PacketSpecCode[codeType]; + const shortCode = (code & ~61440 /* MASK */).toString(16); + r += ` ${tpName} ${pname} : ${numfmt2} @ 0x${shortCode} (f=${flags2}) +`; + if (isOffset) { + let ptr = numfmtOrOffset << 2; + while (ptr < specData.length) { + if (read323(specData, ptr) == 0) + break; + const fname = getString1(read162(specData, ptr)); + const flags3 = specData[ptr + 3]; + const fmt = flags3 & 1 /* IS_BYTES */ ? `bytes[${specData[ptr + 2]}]` : numfmtToString(specData[ptr + 2]); + r += ` ${fname} : ${fmt} (f=${flags3}) +`; + ptr += 4 /* SERVICE_SPEC_FIELD_SIZE */; + } + } + } + r += "\n"; + } + return r; + function printStrings(lbl, tp) { + r += ` +Strings ${lbl}: +`; + const num = img.stringTable(tp).length; + for (let i = 0; i < num; ++i) { + r += (" " + i).slice(-4) + ": " + img.describeString(tp, i, true) + "\n"; + } + } + function getString1(idx) { + const tp = idx >> 14 /* _SHIFT */; + idx &= (1 << 14 /* _SHIFT */) - 1; + return img.getString(tp, idx) + ""; + } + } + }; + function disassemble(data, verbose = false) { + const img = new Image(data); + for (const err of img.errors) + console.error("DevS disasm error: " + err); + return img.disassemble(verbose); + } + + // compiler/src/opwriter.ts + var Label = class { + constructor(name) { + this.name = name; + this.offset = -1; + } + }; + var VF_MAX_STACK_MASK = 255; + var VF_USES_STATE = 256; + var VF_HAS_PARENT = 512; + var VF_IS_LITERAL = 1024; + var VF_IS_MEMREF = 2048; + var VF_IS_STRING = 4096; + var VF_IS_WRITTEN = 8192; + var Value = class { + constructor() { + } + get maxstack() { + return (this.flags & VF_MAX_STACK_MASK) + 1; + } + get usesState() { + return !!(this.flags & VF_USES_STATE); + } + get hasParent() { + return !!(this.flags & VF_HAS_PARENT); + } + get isLiteral() { + return !!(this.flags & VF_IS_LITERAL); + } + get isMemRef() { + return !!(this.flags & VF_IS_MEMREF); + } + adopt() { + assert(!(this.flags & VF_HAS_PARENT)); + this.flags |= VF_HAS_PARENT; + } + ignore() { + var _a; + this.adopt(); + (_a = this._cachedValue) == null ? void 0 : _a._decr(); + } + assumeStateless() { + assert(this.usesState); + this.flags &= ~VF_USES_STATE; + } + _set(src) { + if (!this._userdata) + this._userdata = src._userdata; + this.op = src.op; + this.flags = src.flags; + this.args = src.args; + this.numValue = src.numValue; + this._cachedValue = src._cachedValue; + } + get staticIdx() { + assert(this.args.length == 1); + assert(this.args[0].isLiteral); + return this.args[0].numValue; + } + toString() { + var _a; + return `[op=${Op[this.op]} a=${(_a = this.args) == null ? void 0 : _a.length}]`; + } + clone() { + const r = new Value(); + r._set(this); + if (r.args) + r.args = r.args.map((a) => a.clone()); + return r; + } + }; + var CachedValue = class { + constructor(parent, index) { + this.parent = parent; + this.index = index; + this.numRefs = 1; + this._longTerm = false; + } + get packedIndex() { + return packVarIndex(3 /* Cached */, this.index); + } + get isCached() { + return true; + } + emit() { + assert(this.numRefs > 0); + const r = new Value(); + r.numValue = this.packedIndex; + r.op = 21 /* EXPRx_LOAD_LOCAL */; + r.flags = VF_IS_MEMREF; + r._cachedValue = this; + this.numRefs++; + return r; + } + store(v) { + assert(this.numRefs > 0); + this.parent.emitStmt( + 17 /* STMTx1_STORE_LOCAL */, + literal(this.packedIndex), + v + ); + } + finalEmit() { + const r = this.emit(); + this.free(); + return r; + } + _decr() { + if (this.numRefs <= 0) + oops(`cached ref=0`); + if (--this.numRefs == 0) { + assert(this.parent.cachedValues[this.index] == this); + this.parent.cachedValues[this.index] = null; + this.index = null; + } + } + free() { + this._decr(); + } + }; + var UnCachedValue = class extends CachedValue { + constructor(parent) { + super(parent, null); + } + get isCached() { + return false; + } + emit() { + return this.theValue.clone(); + } + store(v) { + assert(this.theValue === void 0); + this.theValue = v; + } + _decr() { + } + }; + function literal(v) { + const r = new Value(); + if (v == null) { + r.op = v === null ? 90 /* EXPR0_NULL */ : 46 /* EXPR0_UNDEFINED */; + r.args = []; + r.flags = 0; + } else if (typeof v == "boolean") { + r.op = v ? 48 /* EXPR0_TRUE */ : 49 /* EXPR0_FALSE */; + r.args = []; + r.flags = 0; + } else if (typeof v == "number") { + r.numValue = v; + r.op = 40 /* EXPRx_LITERAL */; + r.flags = VF_IS_LITERAL; + } else { + oops(`invalid literal: ${v}`); + } + return r; + } + function nonEmittable() { + const r = new Value(); + r.op = 65536 /* FIRST_NON_OPCODE */ + 256; + r.flags = 0; + return r; + } + var VAR_CACHED_OFF = 30; + var VAR_LOCAL_OFF = 100; + function packVarIndex(vk, idx) { + switch (vk) { + case 0 /* Global */: + return idx; + case 1 /* ThisParam */: + assert(idx == 0); + return idx; + case 2 /* Parameter */: + assert(idx < VAR_CACHED_OFF); + return idx; + case 3 /* Cached */: + idx += VAR_CACHED_OFF; + assert(idx < VAR_LOCAL_OFF); + return idx; + case 4 /* Local */: + idx += VAR_LOCAL_OFF; + assert(idx < 248 /* FIRST_MULTIBYTE_INT */); + return idx; + default: + oops("bad vk"); + } + } + var OpWriter = class { + constructor(prog, name) { + this.prog = prog; + this.name = name; + this.binPtr = 0; + this.labels = []; + this.bufferAllocated = false; + this.pendingStatefulValues = []; + this.localOffsets = []; + this.cachedValues = []; + this.funFlags = 0; + this.desc = new Uint8Array(16 /* FUNCTION_HEADER_SIZE */); + this.offsetInFuncs = -1; + this.offsetInImg = -1; + this.locStack = []; + this.srcmap = []; + this.lastReturnLocation = -1; + this.closureRefs = {}; + this.top = this.mkLabel("top"); + this.emitLabel(this.top); + this.binary = new Uint8Array(128); + this.nameIdx = this.prog.addString(this.name.replace(/_F\d+$/, "")); + } + assertCurrent() { + assert(this.prog.writer == this); + } + serialize() { + assert(this.locStack.length == 0); + return this.binary.slice(0, this.binPtr); + } + get size() { + return this.binPtr + this.desc.length; + } + finalizeDesc(off) { + assert(this.offsetInImg == -1); + this.offsetInImg = off; + for (let i = 0; i < this.srcmap.length; i += srcMapEntrySize) { + this.srcmap[i + 2] += off; + } + write322(this.desc, 0, off); + } + _forceFinStmt() { + } + recordLocation() { + const pos = this.locStack[this.locStack.length - 1]; + const pc = this.location(); + const l = this.srcmap.length; + if (l >= srcMapEntrySize && this.srcmap[l - 1] == pc) { + this.srcmap[l - 2] = pos[1]; + this.srcmap[l - 3] = pos[0]; + } else { + this.srcmap.push(pos[0], pos[1], pc); + } + } + locPush(pos) { + this.locStack.push(pos); + this.recordLocation(); + } + locPop() { + assert(this.locStack.length > 0); + this.locStack.pop(); + if (this.locStack.length) + this.recordLocation(); + } + allocTmpLocals(num) { + let run = 0; + let runStart = 0; + for (let i = 0; i < this.cachedValues.length; ++i) { + if (this.cachedValues[i] == null) + run++; + else { + run = 0; + runStart = i + 1; + } + if (run >= num) + break; + } + while (run < num) { + this.cachedValues.push(null); + run++; + } + for (let i = 0; i < num; ++i) { + assert(this.cachedValues[runStart + i] === null); + this.cachedValues[runStart + i] = new CachedValue( + this, + runStart + i + ); + } + return this.cachedValues.slice(runStart, runStart + num); + } + allocTmpLocal() { + return this.allocTmpLocals(1)[0]; + } + needsCache(v) { + let maxSize = 5; + return needsCacheRec(v); + function needsCacheRec(v2) { + if (v2.usesState || v2._cachedValue) + return true; + if (maxSize-- < 0) + return true; + return v2.args && v2.args.some(needsCacheRec); + } + } + cacheValue(v, longTerm = false) { + let t; + if (this.needsCache(v) || longTerm) { + t = this.allocTmpLocal(); + t._longTerm = longTerm; + } else { + t = new UnCachedValue(this); + } + t.store(v); + return t; + } + stmtEnd() { + this.assertNoTemps(); + } + freeBuf() { + assert(this.bufferAllocated, "freeBuf() already free"); + this.bufferAllocated = false; + } + emitString(s) { + const v = new Value(); + let idx = 0; + if (typeof s == "string") { + idx = this.prog.addString(s); + const tp = idx >> 14 /* _SHIFT */; + idx &= (1 << 14 /* _SHIFT */) - 1; + if (tp == 3 /* UTF8 */) + v.op = 38 /* EXPRx_STATIC_UTF8_STRING */; + else if (tp == 1 /* BUILTIN */) + v.op = 36 /* EXPRx_STATIC_BUILTIN_STRING */; + else if (tp == 2 /* ASCII */) + v.op = 37 /* EXPRx_STATIC_ASCII_STRING */; + else + assert(false); + v.strValue = s; + } else { + idx = this.prog.addBuffer(s); + v.op = 35 /* EXPRx_STATIC_BUFFER */; + } + v.args = [literal(idx)]; + v.flags = VF_IS_STRING; + return v; + } + getAssembly() { + let res = `proc ${this.name}: +`; + for (const stmt of parseBytecode(this.binary.slice(0, this.binPtr))) { + res += stringifyInstr(stmt, this.prog) + "\n"; + } + return res; + } + mkLabel(name) { + const l = new Label(name); + this.labels.push(l); + return l; + } + _setLabelOffset(l, off) { + l.offset = off; + if (l.uses) { + for (const u of l.uses) { + const v = l.offset - u; + assert(v >= 0); + assert(v <= 65535); + this.binary[u + 2] = v >> 8; + this.binary[u + 3] = v & 255; + } + l.uses = void 0; + } + } + emitLabel(l) { + assert(l.offset == -1); + this.lastReturnLocation = null; + this._setLabelOffset(l, this.location()); + } + emitIfAndPop(reg, thenBody, elseBody) { + if (elseBody) { + const endIf = this.mkLabel("endIf"); + const elseIf = this.mkLabel("elseIf"); + this.emitJumpIfFalse(elseIf, reg); + thenBody(); + this.emitJump(endIf); + this.emitLabel(elseIf); + elseBody(); + this.emitLabel(endIf); + } else { + const skipIf = this.mkLabel("skipIf"); + this.emitJumpIfFalse(skipIf, reg); + thenBody(); + this.emitLabel(skipIf); + } + } + emitJumpIfTrue(label, cond) { + return this.emitJumpIfFalse(label, this.emitExpr(56 /* EXPR1_NOT */, cond)); + } + emitJumpIfFalse(label, cond) { + return this._emitJump(label, cond); + } + emitJump(label) { + return this._emitJump(label); + } + emitJumpIfRetValNullish(label) { + return this._emitJump(label, void 0, 78 /* STMTx_JMP_RET_VAL_Z */); + } + emitTry(label) { + return this._emitJump(label, void 0, 80 /* STMTx_TRY */); + } + emitEndTry(label) { + return this._emitJump(label, void 0, 81 /* STMTx_END_TRY */); + } + emitThrowJmp(label, level) { + if (level == 0) + return this.emitJump(label); + return this._emitJump(label, literal(level), 86 /* STMTx1_THROW_JMP */); + } + _emitJump(label, cond, op) { + cond == null ? void 0 : cond.adopt(); + this.spillAllStateful(); + if (cond) + this.writeValue(cond); + const off0 = this.location(); + if (!op) + op = cond ? 14 /* STMTx1_JMP_Z */ : 13 /* STMTx_JMP */; + this.writeByte(op); + if (label.offset != -1) { + this.writeInt(label.offset - off0); + } else { + if (!label.uses) + label.uses = []; + label.uses.push(off0); + this.writeInt(4096); + } + } + oops(msg) { + try { + console.log(this.getAssembly()); + } catch { + } + oops(msg); + } + assertNoTemps(really = false) { + if (this.prog.hasErrors) + return; + for (const c of this.cachedValues) { + if (c !== null && (really || !c._longTerm)) { + this.oops(`_L${c.packedIndex} still has ${c.numRefs} refs`); + } + } + for (const e of this.pendingStatefulValues) { + if (e.usesState && !e.hasParent) + this.oops("pending stateful values"); + } + } + patchLabels(numLocals, numargs, tryDepth) { + for (const l of this.labels) { + if (l.uses) + this.oops(`label ${l.name} not resolved`); + } + this.assertNoTemps(true); + while (this.location() & 3) + this.writeByte(0); + const cachedLen = this.cachedValues.length; + const numSlots = numargs + numLocals + cachedLen; + const mapVarOffset = (v) => { + assert(this.cachedValues.length == cachedLen); + if (v < VAR_CACHED_OFF) { + assert(v < numargs); + } else if (v < VAR_LOCAL_OFF) { + v -= VAR_CACHED_OFF; + assert(v < cachedLen); + v += numargs; + } else { + v -= VAR_LOCAL_OFF; + assert(v < numLocals); + v += numargs + cachedLen; + assert(v < numSlots); + } + assert(v < 248 /* FIRST_MULTIBYTE_INT */); + return v; + }; + for (const off of this.localOffsets) { + this.binary[off] = mapVarOffset(this.binary[off]); + } + this.localOffsets = []; + const buf = this.desc; + write322(buf, 4, this.location()); + write162(buf, 8, numSlots); + buf[10] = numargs; + buf[11] = this.funFlags; + write162(buf, 12, this.nameIdx); + assert(tryDepth <= 255); + buf[14] = tryDepth; + return mapVarOffset; + } + numSlots() { + assert(read323(this.desc, 4) != 0); + return read162(this.desc, 8); + } + spillValue(v) { + const l = this.allocTmpLocal(); + l.store(v); + v._set(l.emit()); + l.free(); + } + spillAllStateful() { + for (const e of this.pendingStatefulValues) { + if (e.usesState && !e.hasParent) + this.spillValue(e); + } + this.pendingStatefulValues = []; + } + emitMemRef(op, idx) { + const r = new Value(); + r.numValue = idx; + r.op = op; + r.flags = VF_IS_MEMREF | VF_USES_STATE; + this.pendingStatefulValues.push(r); + return r; + } + emitExpr(op, ...args) { + assert( + opNumArgs(op) == args.length, + `op ${op} exp ${opNumArgs(op)} got ${args.length}` + ); + assert(!opIsStmt(op), `op ${op} is stmt not expr`); + let stack2 = 0; + let maxStack = 1; + let usesState = exprIsStateful(op); + for (const a of args) { + if (stack2 + a.maxstack >= 16 /* MAX_STACK_DEPTH */) + this.spillValue(a); + maxStack = Math.max(maxStack, stack2 + a.maxstack); + stack2++; + if (a.usesState) + usesState = true; + assert(!(a.flags & VF_HAS_PARENT)); + a.flags |= VF_HAS_PARENT; + } + const r = new Value(); + r.args = args; + r.op = op; + r.flags = maxStack - 1; + if (usesState) { + r.flags |= VF_USES_STATE; + this.pendingStatefulValues.push(r); + } + return r; + } + location() { + return this.binPtr; + } + writeByte(v) { + assert(0 <= v && v <= 255 && (v | 0) == v); + if (this.binPtr >= this.binary.length) { + const copy = new Uint8Array(this.binary.length * 2); + copy.set(this.binary); + this.binary = copy; + } + this.binary[this.binPtr++] = v; + } + writeInt(v) { + assert((v | 0) == v); + if (0 <= v && v < 248 /* FIRST_MULTIBYTE_INT */) + this.writeByte(v); + else { + let b = 248 /* FIRST_MULTIBYTE_INT */; + if (v < 0) { + b |= 4; + v = -v; + } + let hddone = false; + for (let shift = 3; shift >= 0; shift--) { + const q = v >> 8 * shift & 255; + if (q && !hddone) { + this.writeByte(b | shift); + hddone = true; + } + if (hddone) + this.writeByte(q); + } + } + } + saveLocalIdx(nval) { + assert(nval < 248 /* FIRST_MULTIBYTE_INT */); + this.localOffsets.push(this.location()); + } + writeArgs(op, args) { + let i = 0; + if (opTakesNumber(op)) + i = 1; + while (i < args.length) { + this.writeValue(args[i]); + i++; + } + this.writeByte(op); + if (opTakesNumber(op)) { + assert(args[0].isLiteral, `exp literal for op=${Op[op]} ${args[0]}`); + const nval = args[0].numValue; + if (op == 17 /* STMTx1_STORE_LOCAL */) + this.saveLocalIdx(nval); + this.writeInt(nval); + } + } + writeValue(v) { + assert(!(v.flags & VF_IS_WRITTEN)); + v.flags |= VF_IS_WRITTEN; + if (v.isLiteral) { + const q = v.numValue; + if ((q | 0) == q) { + const qq = q + 16 /* DIRECT_CONST_OFFSET */ + 128 /* DIRECT_CONST_OP */; + if (128 /* DIRECT_CONST_OP */ <= qq && qq <= 255) + this.writeByte(qq); + else { + this.writeByte(40 /* EXPRx_LITERAL */); + this.writeInt(q); + } + } else if (isNaN(q)) { + this.writeByte(51 /* EXPR0_NAN */); + } else if (q == Infinity) { + this.writeByte(20 /* EXPR0_INF */); + } else if (q == -Infinity) { + this.writeByte(20 /* EXPR0_INF */); + this.writeByte(55 /* EXPR1_NEG */); + } else { + const idx = this.prog.addFloat(q); + this.writeByte(41 /* EXPRx_LITERAL_F64 */); + this.writeInt(idx); + } + } else if (v.isMemRef) { + assert(opTakesNumber(v.op)); + this.writeByte(v.op); + if (v.op == 21 /* EXPRx_LOAD_LOCAL */) + this.saveLocalIdx(v.numValue); + this.writeInt(v.numValue); + if (v._cachedValue) + v._cachedValue._decr(); + } else if (v.op >= 256) { + oops("this value cannot be emitted: 0x" + v.op.toString(16)); + } else { + if (v.op == 75 /* EXPRx_MAKE_CLOSURE */) { + const key = v.args[0].numValue + ""; + let l = this.closureRefs[key]; + if (!l) + l = this.closureRefs[key] = []; + l.push(this.binPtr); + } + this.writeArgs(v.op, v.args); + } + } + makeFunctionsStatic(isStatic) { + for (const key of Object.keys(this.closureRefs)) { + if (!isStatic(+key)) + continue; + for (const idx of this.closureRefs[key]) { + assert(this.binary[idx] == 75 /* EXPRx_MAKE_CLOSURE */); + this.binary[idx] = 39 /* EXPRx_STATIC_FUNCTION */; + } + } + } + emitStmt(op, ...args) { + assert(opNumArgs(op) == args.length); + assert(opIsStmt(op)); + for (const a of args) + a.adopt(); + this.spillAllStateful(); + this.writeArgs(op, args); + if (op == 12 /* STMT1_RETURN */) + this.lastReturnLocation = this.location(); + } + justHadReturn() { + return this.location() == this.lastReturnLocation; + } + emitCall(fn, ...args) { + assert(args.length <= 8 /* MAX_ARGS_SHORT_CALL */); + this.emitStmt(2 /* STMT1_CALL0 */ + args.length, fn, ...args); + this.prog.onCall(); + } + emitBuiltInObject(obj) { + return this.emitExpr(1 /* EXPRx_BUILTIN_OBJECT */, literal(obj)); + } + emitIndex(obj, field) { + if (obj.op == 1 /* EXPRx_BUILTIN_OBJECT */ && field.op == 36 /* EXPRx_STATIC_BUILTIN_STRING */) + return this.staticBuiltIn(obj.staticIdx, field.staticIdx); + let op = 24 /* EXPR2_INDEX */; + switch (field.op) { + case 36 /* EXPRx_STATIC_BUILTIN_STRING */: + op = 26 /* EXPRx1_BUILTIN_FIELD */; + break; + case 37 /* EXPRx_STATIC_ASCII_STRING */: + op = 27 /* EXPRx1_ASCII_FIELD */; + break; + case 38 /* EXPRx_STATIC_UTF8_STRING */: + op = 28 /* EXPRx1_UTF8_FIELD */; + break; + default: + return this.emitExpr(24 /* EXPR2_INDEX */, obj, field); + } + return this.emitExpr(op, literal(field.staticIdx), obj); + } + builtInMember(obj, name) { + return this.emitExpr(26 /* EXPRx1_BUILTIN_FIELD */, literal(name), obj); + } + staticBuiltIn(obj, name) { + if (obj == 0 /* MATH */) + return this.mathMember(name); + else if (obj == 21 /* DEVICESCRIPT */) + return this.dsMember(name); + else if (obj == 1 /* OBJECT */) + return this.objectMember(name); + return this.emitExpr( + 26 /* EXPRx1_BUILTIN_FIELD */, + literal(name), + this.emitBuiltInObject(obj) + ); + } + dsMember(name) { + return this.emitExpr(30 /* EXPRx_DS_FIELD */, literal(name)); + } + mathMember(name) { + return this.emitExpr(29 /* EXPRx_MATH_FIELD */, literal(name)); + } + objectMember(name) { + return this.emitExpr(16 /* EXPRx_OBJECT_FIELD */, literal(name)); + } + }; + var SectionWriter = class { + constructor(size = -1) { + this.size = size; + this.offset = -1; + this.currSize = 0; + this.data = []; + this.desc = new Uint8Array(8 /* SECTION_HEADER_SIZE */); + } + finalize(off) { + assert(this.offset == -1 || this.offset == off); + this.offset = off; + if (this.size == -1) + this.size = this.currSize; + assert(this.size == this.currSize); + assert((this.offset & 3) == 0); + assert((this.size & 3) == 0); + write322(this.desc, 0, this.offset); + write322(this.desc, 4, this.size); + } + align() { + while (this.currSize & 3) + this.append(new Uint8Array([0])); + } + append(buf) { + this.data.push(buf); + this.currSize += buf.length; + if (this.size >= 0) + assertRange(0, this.currSize, this.size); + } + }; + function bufferFmt(mem) { + let fmt = 0 /* U8 */; + let sz = mem.storage; + if (sz < 0) { + fmt = 4 /* I8 */; + sz = -sz; + } else if (mem.isFloat) { + fmt = 8; + } + switch (sz) { + case 1: + break; + case 2: + fmt |= 1 /* U16 */; + break; + case 4: + fmt |= 2 /* U32 */; + break; + case 8: + fmt |= 3 /* U64 */; + break; + default: + oops("unhandled format: " + mem.storage + " for " + mem.name); + } + const shift = mem.shift || 0; + assertRange(0, shift, bitSize(fmt)); + return fmt | shift << 4; + } + + // compiler/src/tsiface.ts + var ts = __toESM(require_typescript()); + function trace(...args) { + console.debug("\x1B[32mTRACE:", ...args, "\x1B[0m"); + } + var TsHost = class { + constructor(host, prelude2, checkModule) { + this.host = host; + this.prelude = prelude2; + this.checkModule = checkModule; + this.fileCache = {}; + } + getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile) { + let text = this.readFile(fileName); + if (text == null) { + onError("File not found: " + fileName); + text = ""; + } + const setParentNodes = true; + return ts.createSourceFile( + fileName, + text, + languageVersion, + setParentNodes + ); + } + writeFile(fileName, text, writeByteOrderMark, onError) { + this.host.write(fileName, text); + } + realpath(path) { + return this.host.resolvePath(path); + } + getDefaultLibFileName(options) { + return "corelib.d.ts"; + } + getDefaultLibLocation() { + return "."; + } + getCurrentDirectory() { + return this.host.resolvePath("."); + } + getCanonicalFileName(fileName) { + return fileName; + } + useCaseSensitiveFileNames() { + return true; + } + getNewLine() { + return "\n"; + } + fileExists(fileName) { + return this.readFile(fileName) != void 0; + } + readFile(fileName) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i; + let text = ""; + if (this.fileCache.hasOwnProperty(fileName)) { + text = this.fileCache[fileName]; + } else { + if (this.prelude.hasOwnProperty(fileName)) { + text = this.prelude[fileName]; + } else { + try { + text = this.host.read(fileName); + if ((_c = (_b = (_a = this.host).getFlags) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.traceFiles) + trace(`read file: ${fileName} (size: ${text.length})`); + if (fileName.replace(/.*[\/\\]/, "") == "package.json") { + if (!this.checkModule(fileName.slice(0, -12), text)) { + if ((_f = (_e = (_d = this.host).getFlags) == null ? void 0 : _e.call(_d)) == null ? void 0 : _f.traceFiles) + trace(`invalid module at ${fileName}`); + text = null; + } + } + } catch (e) { + if ((_i = (_h = (_g = this.host).getFlags) == null ? void 0 : _h.call(_g)) == null ? void 0 : _i.traceAllFiles) + trace("file missing: " + fileName); + text = null; + } + this.fileCache[fileName] = text; + } + } + if (text == null) + return void 0; + return text; + } + trace(s) { + console.log(s); + } + usedFiles() { + return Object.entries(this.fileCache).map(([fn, text]) => text == null ? null : fn).filter(Boolean); + } + }; + function getProgramDiagnostics(program) { + let diagnostics = program.getConfigFileParsingDiagnostics(); + addDiags(() => program.getOptionsDiagnostics()); + addDiags(() => program.getSyntacticDiagnostics()); + addDiags(() => program.getGlobalDiagnostics()); + addDiags(() => program.getSemanticDiagnostics()); + return diagnostics.slice(0); + function addDiags(f) { + if (!diagnostics.some((d) => d.category == ts.DiagnosticCategory.Error)) + diagnostics = diagnostics.concat(f()); + } + } + function buildAST(mainFn, dsHost, prelude2, checkModule) { + const host = new TsHost(dsHost, prelude2, checkModule); + const options = { + allowJs: false, + allowUnreachableCode: true, + allowUnusedLabels: true, + alwaysStrict: false, + checkJs: false, + declaration: false, + experimentalDecorators: true, + forceConsistentCasingInFileNames: true, + // lib: string[]; + module: ts.ModuleKind.ES2022, + moduleResolution: ts.ModuleResolutionKind.NodeJs, + newLine: ts.NewLineKind.LineFeed, + noEmit: true, + noFallthroughCasesInSwitch: true, + noImplicitAny: true, + noImplicitReturns: true, + noImplicitThis: true, + // noStrictGenericChecks: true, + noPropertyAccessFromIndexSignature: true, + // noLib: true, + noImplicitOverride: true, + // skipLibCheck: true, + // skipDefaultLibCheck: true, + sourceMap: false, + strict: true, + // strictFunctionTypes: false, + // strictBindCallApply: false, + strictNullChecks: false, + // strictPropertyInitialization: false, + // suppressExcessPropertyErrors: true, + // suppressImplicitAnyIndexErrors: true, + target: ts.ScriptTarget.ES2022, + useUnknownInCatchVariables: true, + typeRoots: [], + types: [], + noDtsResolution: true, + jsx: ts.JsxEmit.Preserve + // types?: string[]; + }; + const rootNames = Object.keys(prelude2).filter( + (fn) => fn.includes("@devicescript/core/src/") && fn.endsWith(".d.ts") + ); + rootNames.push(mainFn); + const program = ts.createProgram({ + rootNames, + options, + host + }); + return { program, usedFiles: () => host.usedFiles() }; + } + var diagHost = { + getCurrentDirectory: () => ".", + getCanonicalFileName: (fn) => fn, + getNewLine: () => "\n" + }; + function mkDiag(filename, messageText, category = ts.DiagnosticCategory.Error) { + return { + category, + code: 9997, + file: { + text: "", + fileName: filename + }, + start: 1, + length: 100, + messageText + }; + } + function formatDiagnostics2(diagnostics, basic = false) { + const diag = basic ? ts.formatDiagnostics(diagnostics, diagHost) : ts.formatDiagnosticsWithColorAndContext(diagnostics, diagHost); + return diag.trim(); + } + + // runtime/jacdac-c/jacdac/dist/services.json + var services_default2 = [{ name: "Common registers and commands", status: "experimental", shortId: "_system", camelName: "system", shortName: "system", extends: [], notes: { short: "This file describes common register and command codes.\n\nThese are defined in ranges separate from the per-service ones.\nNo service actually derives from this file, but services can include packets\ndefined here.\nTheir code is listed as say `@ intensity` and not `@ 0x01` (the spectool enforces that).", commands: "Command codes are subdivided as follows:\n\n- Commands `0x000-0x07f` - common to all services\n- Commands `0x080-0xeff` - defined per-service\n- Commands `0xf00-0xfff` - reserved for implementation\n\nCommands follow.", registers: "Register codes are subdivided as follows:\n\n- Registers `0x001-0x07f` - r/w common to all services\n- Registers `0x080-0x0ff` - r/w defined per-service\n- Registers `0x100-0x17f` - r/o common to all services\n- Registers `0x180-0x1ff` - r/o defined per-service\n- Registers `0x200-0xeff` - custom, defined per-service\n- Registers `0xf00-0xfff` - reserved for implementation, should not be seen on the wire\n\nThe types listed are typical. Check spec for particular service for exact type,\nand a service-specific name for a register (eg. `value` could be `pulse_length`).\nAll registers default to `0` unless otherwise indicated.", events: "Events codes are 8-bit and are subdivided as follows:\n\n- Events `0x00-0x7f` - common to all services\n- Events `0x80-0xff` - defined per-service" }, classIdentifier: 536870897, enums: { ReadingThreshold: { name: "ReadingThreshold", storage: 1, members: { Neutral: 1, Inactive: 2, Active: 3 } }, StatusCodes: { name: "StatusCodes", storage: 2, members: { Ready: 0, Initializing: 1, Calibrating: 2, Sleeping: 3, WaitingForInput: 4, CalibrationNeeded: 100 } } }, constants: { announce_interval: { value: 500, hex: false } }, packets: [{ kind: "command", name: "announce", identifier: 0, description: "Enumeration data for control service; service-specific advertisement data otherwise.\nControl broadcasts it automatically every `announce_interval`ms, but other service have to be queried to provide it.", fields: [], hasReport: true }, { kind: "report", name: "announce", identifier: 0, description: "Enumeration data for control service; service-specific advertisement data otherwise.\nControl broadcasts it automatically every `announce_interval`ms, but other service have to be queried to provide it.", fields: [], secondary: true }, { kind: "command", name: "get_register", identifier: 4096, description: "Registers number `N` is fetched by issuing command `0x1000 | N`.\nThe report format is the same as the format of the register.", fields: [], hasReport: true }, { kind: "report", name: "get_register", identifier: 4096, description: "Registers number `N` is fetched by issuing command `0x1000 | N`.\nThe report format is the same as the format of the register.", fields: [], secondary: true }, { kind: "command", name: "set_register", identifier: 8192, description: "Registers number `N` is set by issuing command `0x2000 | N`, with the format\nthe same as the format of the register.", fields: [] }, { kind: "command", name: "calibrate", identifier: 2, description: "Request to calibrate a sensor. The report indicates the calibration is done.", fields: [], hasReport: true }, { kind: "report", name: "calibrate", identifier: 2, description: "Request to calibrate a sensor. The report indicates the calibration is done.", fields: [], secondary: true }, { kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }, { kind: "rw", name: "intensity", identifier: 1, description: "This is either binary on/off (0 or non-zero), or can be gradual (eg. brightness of an RGB LED strip).", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "value", identifier: 2, description: "The primary value of actuator (eg. servo pulse length, or motor duty cycle).", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "min_value", identifier: 272, description: "The lowest value that can be reported for the value register.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "max_value", identifier: 273, description: "The highest value that can be reported for the value register.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the service, in mA.", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 500, typicalMax: 500, typicalMin: 0 }], packFormat: "u16" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100 }], packFormat: "u32" }, { kind: "ro", name: "reading", identifier: 257, description: "Read-only value of the sensor, also reported in streaming.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], volatile: true, packFormat: "i32" }, { kind: "rw", name: "reading_range", identifier: 8, description: "For sensors that support it, sets the range (sometimes also described `min`/`max_reading`).\nTypically only a small set of values is supported.\nSetting it to `X` will select the smallest possible range that is at least `X`,\nor if it doesn't exist, the largest supported range.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "supported_ranges", identifier: 266, description: "Lists the values supported as `reading_range`.", fields: [{ name: "range", type: "u32", storage: 4, isSimpleType: true, startRepeats: true }], packFormat: "r: u32" }, { kind: "const", name: "min_reading", identifier: 260, description: "The lowest value that can be reported by the sensor.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "max_reading", identifier: 261, description: "The highest value that can be reported by the sensor.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "ro", name: "reading_error", identifier: 262, description: "The real value of whatever is measured is between `reading - reading_error` and `reading + reading_error`. It should be computed from the internal state of the sensor. This register is often, but not always `const`. If the register value is modified,\nsend a report in the same frame of the `reading` report.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], volatile: true, packFormat: "u32" }, { kind: "const", name: "reading_resolution", identifier: 264, description: "Smallest, yet distinguishable change in reading.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "inactive_threshold", identifier: 5, description: "Threshold when reading data gets inactive and triggers a `inactive`.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "rw", name: "active_threshold", identifier: 6, description: "Thresholds when reading data gets active and triggers a `active` event.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "variant", identifier: 263, description: "The hardware variant of the service.\nFor services which support this, there's an enum defining the meaning.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. `code` is a standardized value from\nthe Jacdac status/error codes. `vendor_code` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet.", fields: [{ name: "code", type: "StatusCodes", storage: 2 }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16 u16" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "event", name: "active", identifier: 1, description: "Notifies that the service has been activated (eg. button pressed, network connected, etc.)", fields: [] }, { kind: "event", name: "inactive", identifier: 2, description: "Notifies that the service has been dis-activated.", fields: [] }, { kind: "event", name: "change", identifier: 3, description: "Notifies that the some state of the service changed.", fields: [] }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "StatusCodes", storage: 2 }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }, { kind: "event", name: "neutral", identifier: 7, description: "Notifies that the threshold is back between `low` and `high`.", fields: [] }], tags: [] }, { name: "Base service", status: "stable", shortId: "_base", camelName: "base", shortName: "base", extends: [], notes: { short: "Base class for all services." }, classIdentifier: 536870899, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16" }], tags: [] }, { name: "Sensor", status: "stable", shortId: "_sensor", camelName: "sensor", shortName: "sensor", extends: ["_base"], notes: { short: "Base class for sensors." }, classIdentifier: 536870898, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32" }], tags: [] }, { name: "Accelerometer", status: "stable", shortId: "accelerometer", camelName: "accelerometer", shortName: "accelerometer", extends: ["_base", "_sensor"], notes: { short: "A 3-axis accelerometer.", long: "## Orientation\n\nAn accelerometer module should translate acceleration values as follows:\n\n| Orientation | X value (g) | Y value (g) | Z value (g) |\n|----------------------- |------------- |------------- |------------- |\n| Module lying flat | 0 | 0 | -1 |\n| Module on left edge | -1 | 0 | 0 |\n| Module on bottom edge | 0 | 1 | 0 |\n\nWe recommend an orientation marking on the PCB so that users can mount modules without having to experiment with the device. Left/bottom can be determined by assuming text on silk runs left-to-right.", events: "All events are debounced." }, classIdentifier: 521405449, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "forces", identifier: 257, description: "Indicates the current forces acting on accelerometer.", fields: [{ name: "x", unit: "g", shift: 20, type: "i12.20", storage: -4 }, { name: "y", unit: "g", shift: 20, type: "i12.20", storage: -4 }, { name: "z", unit: "g", shift: 20, type: "i12.20", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i12.20 i12.20 i12.20" }, { kind: "ro", name: "forces_error", identifier: 262, description: "Error on the reading value.", fields: [{ name: "_", unit: "g", shift: 20, type: "u12.20", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u12.20" }, { kind: "rw", name: "max_force", identifier: 8, description: 'Configures the range forces detected.\nThe value will be "rounded up" to one of `max_forces_supported`.', fields: [{ name: "_", unit: "g", shift: 20, type: "u12.20", storage: 4 }], optional: true, identifierName: "reading_range", packFormat: "u12.20" }, { kind: "const", name: "max_forces_supported", identifier: 266, description: "Lists values supported for writing `max_force`.", fields: [{ name: "max_force", unit: "g", shift: 20, type: "u12.20", storage: 4, startRepeats: true }], optional: true, identifierName: "supported_ranges", packFormat: "r: u12.20" }, { kind: "event", name: "tilt_up", identifier: 129, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "tilt_down", identifier: 130, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "tilt_left", identifier: 131, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "tilt_right", identifier: 132, description: "Emitted when accelerometer is tilted in the given direction.", fields: [] }, { kind: "event", name: "face_up", identifier: 133, description: "Emitted when accelerometer is laying flat in the given direction.", fields: [] }, { kind: "event", name: "face_down", identifier: 134, description: "Emitted when accelerometer is laying flat in the given direction.", fields: [] }, { kind: "event", name: "freefall", identifier: 135, description: "Emitted when total force acting on accelerometer is much less than 1g.", fields: [] }, { kind: "event", name: "shake", identifier: 139, description: "Emitted when forces change violently a few times.", fields: [] }, { kind: "event", name: "force_2g", identifier: 140, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }, { kind: "event", name: "force_3g", identifier: 136, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }, { kind: "event", name: "force_6g", identifier: 137, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }, { kind: "event", name: "force_8g", identifier: 138, description: "Emitted when force in any direction exceeds given threshold.", fields: [] }], tags: ["C"], group: "Movement" }, { name: "Acidity", status: "experimental", shortId: "acidity", camelName: "acidity", shortName: "acidity", extends: ["_base", "_sensor"], notes: { short: "A sensor measuring water acidity, commonly called pH." }, classIdentifier: 513243333, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "acidity", identifier: 257, description: "The acidity, pH, of water.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2, absoluteMin: 0, absoluteMax: 15, typicalMin: 2.5, typicalMax: 10.5 }], volatile: true, identifierName: "reading", preferredInterval: 5e3, packFormat: "u4.12" }, { kind: "ro", name: "acidity_error", identifier: 262, description: "Error on the acidity reading.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u4.12" }, { kind: "const", name: "min_acidity", identifier: 260, description: "Lowest acidity that can be reported.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2 }], optional: true, identifierName: "min_reading", packFormat: "u4.12" }, { kind: "const", name: "max_humidity", identifier: 261, description: "Highest acidity that can be reported.", fields: [{ name: "_", unit: "pH", shift: 12, type: "u4.12", storage: 2 }], optional: true, identifierName: "max_reading", packFormat: "u4.12" }], tags: ["C", "8bit"], group: "Environment" }, { name: "Air Pressure", status: "rc", shortId: "airpressure", camelName: "airPressure", shortName: "airPressure", extends: ["_base", "_sensor"], notes: { short: "A sensor measuring air pressure of outside environment.", registers: "Default streaming interval is 1s." }, classIdentifier: 504462570, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "pressure", identifier: 257, description: "The air pressure.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4, typicalMin: 150, typicalMax: 1150 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u22.10" }, { kind: "ro", name: "pressure_error", identifier: 262, description: "The real pressure is between `pressure - pressure_error` and `pressure + pressure_error`.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_pressure", identifier: 260, description: "Lowest air pressure that can be reported.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4 }], optional: true, identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_pressure", identifier: 261, description: "Highest air pressure that can be reported.", fields: [{ name: "_", unit: "hPa", shift: 10, type: "u22.10", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u22.10" }], tags: ["8bit"], group: "Environment" }, { name: "Air Quality Index", status: "experimental", shortId: "airqualityindex", camelName: "airQualityIndex", shortName: "airQualityIndex", extends: ["_base", "_sensor"], notes: { short: "The Air Quality Index is a measure of how clean or polluted air is. From min, good quality, to high, low quality.\nThe range of AQI may vary between countries (https://en.wikipedia.org/wiki/Air_quality_index)." }, classIdentifier: 346844886, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "aqi_index", identifier: 257, description: "Air quality index, typically refreshed every second.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4, typicalMax: 500, typicalMin: 0 }], volatile: true, identifierName: "reading", preferredInterval: 6e4, packFormat: "u16.16" }, { kind: "ro", name: "aqi_index_error", identifier: 262, description: "Error on the AQI measure.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "min_aqi_index", identifier: 260, description: "Minimum AQI reading, representing a good air quality. Typically 0.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4 }], identifierName: "min_reading", packFormat: "u16.16" }, { kind: "const", name: "max_aqi_index", identifier: 261, description: "Maximum AQI reading, representing a very poor air quality.", fields: [{ name: "_", unit: "AQI", shift: 16, type: "u16.16", storage: 4 }], identifierName: "max_reading", packFormat: "u16.16" }], tags: [], group: "Environment" }, { name: "Arcade Gamepad", status: "deprecated", shortId: "arcadegamepad", camelName: "arcadeGamepad", shortName: "arcadeGamepad", extends: ["_base", "_sensor"], notes: { short: "This service is deprecated in favor of `gamepad` (although it is currently used by the micro:bit Arcade smart shield).\nA gamepad with direction and action buttons for one player.\nIf a device has multiple controllers, it should have multiple gamepad services, using consecutive service identifiers." }, classIdentifier: 501915758, enums: { Button: { name: "Button", storage: 1, members: { Left: 1, Up: 2, Right: 3, Down: 4, A: 5, B: 6, Menu: 7, Select: 8, Reset: 9, Exit: 10 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "buttons", identifier: 257, description: "Indicates which buttons are currently active (pressed).\n`pressure` should be `0xff` for digital buttons, and proportional for analog ones.", fields: [{ name: "button", type: "Button", storage: 1, startRepeats: true }, { name: "pressure", unit: "/", shift: 8, type: "u0.8", storage: 1 }], volatile: true, identifierName: "reading", packFormat: "r: u8 u0.8" }, { kind: "const", name: "available_buttons", identifier: 384, description: "Indicates number of players supported and which buttons are present on the controller.", fields: [{ name: "button", type: "Button", storage: 1, startRepeats: true }], packFormat: "r: u8" }, { kind: "event", name: "down", identifier: 1, description: "Emitted when button goes from inactive to active.", fields: [{ name: "button", type: "Button", storage: 1 }], identifierName: "active", packFormat: "u8" }, { kind: "event", name: "up", identifier: 2, description: "Emitted when button goes from active to inactive.", fields: [{ name: "button", type: "Button", storage: 1 }], identifierName: "inactive", packFormat: "u8" }], tags: [], group: "Button" }, { name: "Arcade Sound", status: "experimental", shortId: "arcadesound", camelName: "arcadeSound", shortName: "arcadeSound", extends: ["_base"], notes: { short: "A sound playing device.\n\nThis is typically run over an SPI connection, not regular single-wire Jacdac." }, classIdentifier: 533083654, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "play", identifier: 128, description: "Play samples, which are single channel, signed 16-bit little endian values.", fields: [{ name: "samples", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "rw", name: "sample_rate", identifier: 128, description: "Get or set playback sample rate (in samples per second).\nIf you set it, read it back, as the value may be rounded up or down.", fields: [{ name: "_", unit: "Hz", shift: 10, type: "u22.10", storage: 4, defaultValue: 44100 }], packFormat: "u22.10" }, { kind: "const", name: "buffer_size", identifier: 384, description: "The size of the internal audio buffer.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "buffer_pending", identifier: 385, description: "How much data is still left in the buffer to play.\nClients should not send more data than `buffer_size - buffer_pending`,\nbut can keep the `buffer_pending` as low as they want to ensure low latency\nof audio playback.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: ["SPI"] }, { name: "Barcode reader", status: "experimental", shortId: "barcodereader", camelName: "barcodeReader", shortName: "barcodeReader", extends: ["_base"], notes: { short: "A device that reads various barcodes, like QR codes. For the web, see [BarcodeDetector](https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector)." }, classIdentifier: 477339244, enums: { Format: { name: "Format", storage: 1, members: { Aztec: 1, Code128: 2, Code39: 3, Code93: 4, Codabar: 5, DataMatrix: 6, Ean13: 8, Ean8: 9, ITF: 10, Pdf417: 11, QrCode: 12, UpcA: 13, UpcE: 14 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns on or off the detection of barcodes.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "formats", identifier: 384, description: "Reports the list of supported barcode formats, as documented in https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API.", fields: [{ name: "format", type: "Format", storage: 1, startRepeats: true }], optional: true, packFormat: "r: u8" }, { kind: "event", name: "detect", identifier: 1, description: "Raised when a bar code is detected and decoded. If the reader detects multiple codes, it will issue multiple events.\nIn case of numeric barcodes, the `data` field should contain the ASCII (which is the same as UTF8 in that case) representation of the number.", fields: [{ name: "format", type: "Format", storage: 1 }, { name: "data", type: "string", storage: 0 }], identifierName: "active", packFormat: "u8 s" }], tags: [] }, { name: "bit:radio", status: "stable", shortId: "bitradio", camelName: "bitRadio", shortName: "bitRadio", extends: ["_base"], notes: { short: "Support for sending and receiving packets using the [Bit Radio protocol](https://github.com/microsoft/pxt-common-packages/blob/master/libs/radio/docs/reference/radio.md), typically used between micro:bit devices." }, classIdentifier: 449414863, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns on/off the radio antenna.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "group", identifier: 128, description: "Group used to filter packets", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "rw", name: "transmission_power", identifier: 129, description: "Antenna power to increase or decrease range.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 6, absoluteMin: 1, absoluteMax: 7 }], packFormat: "u8" }, { kind: "rw", name: "frequency_band", identifier: 130, description: "Change the transmission and reception band of the radio to the given channel.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 7, absoluteMax: 83, absoluteMin: 0 }], packFormat: "u8" }, { kind: "command", name: "send_string", identifier: 128, description: "Sends a string payload as a radio message, maximum 18 characters.", fields: [{ name: "message", type: "string", storage: 0 }], unique: true, packFormat: "s" }, { kind: "command", name: "send_number", identifier: 129, description: "Sends a double precision number payload as a radio message", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }], unique: true, packFormat: "f64" }, { kind: "command", name: "send_value", identifier: 130, description: "Sends a double precision number and a name payload as a radio message", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }, { name: "name", type: "string", storage: 0 }], unique: true, packFormat: "f64 s" }, { kind: "command", name: "send_buffer", identifier: 131, description: "Sends a payload of bytes as a radio message", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }, { kind: "report", name: "string_received", identifier: 144, description: "Raised when a string packet is received", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "device_serial_number", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true }, { name: "padding", type: "u8[1]", storage: 1 }, { name: "message", type: "string", storage: 0 }], packFormat: "u32 u32 i8 b[1] s" }, { kind: "report", name: "number_received", identifier: 145, description: "Raised when a number packet is received", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "device_serial_number", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true }, { name: "padding", type: "u8[3]", storage: 3 }, { name: "value", isFloat: true, type: "f64", storage: 8 }, { name: "name", type: "string", storage: 0 }], packed: true, packFormat: "u32 u32 i8 b[3] f64 s" }, { kind: "report", name: "buffer_received", identifier: 146, description: "Raised when a buffer packet is received", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "device_serial_number", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true }, { name: "padding", type: "u8[1]", storage: 1 }, { name: "data", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u32 u32 i8 b[1] b" }], tags: [] }, { name: "Bootloader", status: "stable", shortId: "bootloader", camelName: "bootloader", shortName: "bootloader", extends: ["_base"], notes: { short: "Allows flashing (reprogramming) devices over Jacdac.\n\nThis is typically implemented by having a separate _bootloader_ mode, as opposed to _application_ mode\non the module to be flashed.\nThe bootloader mode is entered on every device reset, for about 300ms.\nThe bootloader will generally not announce itself, until it gets some command.\nOnce it gets the command, it will stay in application mode.\n\nTypically, you ask the module (in application mode) to reset, while sending broadcast\n`info` commands to all bootloaders every 100ms or so.\nAlternatively, you ask the the user to disconnect and re-connect the module, while\nbroadcasting `info` commands.\nThe second method works even if the application is damaged (eg., due to an aborted flash).\n\nWhen device is in bootloader mode, the device ID may change compared to application mode,\nby flipping the first bit in the first byte of the device identifier." }, classIdentifier: 536516936, enums: { Error: { name: "Error", storage: 4, members: { NoError: 0, PacketTooSmall: 1, OutOfFlashableRange: 2, InvalidPageOffset: 3, NotPageAligned: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "info", identifier: 0, description: 'The `service_class` is always `0x1ffa9948`. The `product_identifier` identifies the kind of firmware\nthat "fits" this device.', fields: [], identifierName: "announce", hasReport: true }, { kind: "report", name: "info", identifier: 0, description: 'The `service_class` is always `0x1ffa9948`. The `product_identifier` identifies the kind of firmware\nthat "fits" this device.', fields: [{ name: "service_class", type: "u32", storage: 4, isSimpleType: true }, { name: "page_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }, { name: "flashable_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }, { name: "product_identifier", type: "u32", storage: 4, isSimpleType: true }], secondary: true, packFormat: "u32 u32 u32 u32" }, { kind: "command", name: "set_session", identifier: 129, description: "The flashing server should generate a random id, and use this command to set it.", fields: [{ name: "session_id", type: "u32", storage: 4, isSimpleType: true }], hasReport: true, packFormat: "u32" }, { kind: "report", name: "set_session", identifier: 129, description: "The flashing server should generate a random id, and use this command to set it.", fields: [{ name: "session_id", type: "u32", storage: 4, isSimpleType: true }], secondary: true, packFormat: "u32" }, { kind: "command", name: "page_data", identifier: 128, description: "Use to send flashing data. A physical page is split into `chunk_max + 1` chunks, where `chunk_no = 0 ... chunk_max`.\nEach chunk is stored at `page_address + page_offset`. `page_address` has to be equal in all chunks,\nand is included in response.\nOnly the last chunk causes writing to flash and elicits response.\n\nErrors not listed are also possible. Errors larger than `0xffff` indicate de-synchronization on chunk numbers.\n\nWhile this command is technically `unique`, the bootloader client will retry failed pages.\nBootloaders typically will not support reliable commands delivered over pipes.", fields: [{ name: "page_address", type: "u32", storage: 4, isSimpleType: true }, { name: "page_offset", type: "u16", storage: 2, isSimpleType: true }, { name: "chunk_no", type: "u8", storage: 1, isSimpleType: true }, { name: "chunk_max", type: "u8", storage: 1, isSimpleType: true }, { name: "session_id", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved0", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved1", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved2", type: "u32", storage: 4, isSimpleType: true }, { name: "reserved3", type: "u32", storage: 4, isSimpleType: true }, { name: "page_data", type: "bytes", storage: 208, isSimpleType: true, maxBytes: 208 }], unique: true, hasReport: true, packFormat: "u32 u16 u8 u8 u32 u32 u32 u32 u32 b[208]" }, { kind: "report", name: "page_data", identifier: 128, description: "Use to send flashing data. A physical page is split into `chunk_max + 1` chunks, where `chunk_no = 0 ... chunk_max`.\nEach chunk is stored at `page_address + page_offset`. `page_address` has to be equal in all chunks,\nand is included in response.\nOnly the last chunk causes writing to flash and elicits response.\n\nErrors not listed are also possible. Errors larger than `0xffff` indicate de-synchronization on chunk numbers.\n\nWhile this command is technically `unique`, the bootloader client will retry failed pages.\nBootloaders typically will not support reliable commands delivered over pipes.", fields: [{ name: "session_id", type: "u32", storage: 4, isSimpleType: true }, { name: "page_error", type: "Error", storage: 4 }, { name: "page_address", type: "u32", storage: 4, isSimpleType: true }], secondary: true, packFormat: "u32 u32 u32" }], tags: ["C", "management"] }, { name: "Braille display", status: "stable", shortId: "brailledisplay", camelName: "brailleDisplay", shortName: "brailleDisplay", extends: ["_base"], notes: { short: "A Braille pattern display module. This module display [unicode braille patterns](https://www.unicode.org/charts/PDF/U2800.pdf), country specific encoding have to be implemented by the clients." }, classIdentifier: 331331532, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines if the braille display is active.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "patterns", identifier: 2, description: "Braille patterns to show. Must be unicode characters between `0x2800` and `0x28ff`.", fields: [{ name: "_", type: "string", storage: 0 }], lowLevel: true, identifierName: "value", packFormat: "s" }, { kind: "const", name: "length", identifier: 385, description: "Gets the number of patterns that can be displayed.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }], tags: [], group: "Display" }, { name: "Bridge", status: "rc", shortId: "bridge", camelName: "bridge", shortName: "bridge", extends: ["_base"], notes: { short: "Indicates that the device acts as a bridge to the Jacdac bus." }, classIdentifier: 535147631, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Enables or disables the bridge.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }], tags: ["infrastructure"] }, { name: "Button", status: "stable", shortId: "button", camelName: "button", shortName: "button", extends: ["_base", "_sensor"], notes: { short: "A push-button, which returns to inactive position when not operated anymore." }, classIdentifier: 343122531, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "pressure", identifier: 257, description: "Indicates the pressure state of the button, where `0` is open.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "const", name: "analog", identifier: 384, description: "Indicates if the button provides analog `pressure` readings.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "ro", name: "pressed", identifier: 385, description: "Determines if the button is pressed currently.\n\nIf the event `down` or `hold` is observed, `pressed` becomes true; if `up` is observed, `pressed` becomes false.\nThe client should initialize `pressed` to false.", fields: [{ name: "_", type: "bool", storage: 1 }], client: true, volatile: true, packFormat: "u8" }, { kind: "event", name: "down", identifier: 1, description: "Emitted when button goes from inactive to active.", fields: [], identifierName: "active" }, { kind: "event", name: "up", identifier: 2, description: "Emitted when button goes from active to inactive. The 'time' parameter\nrecords the amount of time between the down and up events.", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], identifierName: "inactive", packFormat: "u32" }, { kind: "event", name: "hold", identifier: 129, description: "Emitted when the press time is greater than 500ms, and then at least every 500ms\nas long as the button remains pressed. The 'time' parameter records the the amount of time\nthat the button has been held (since the down event).", fields: [{ name: "time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: ["C", "8bit", "padauk", "input"], group: "Button" }, { name: "Buzzer", status: "rc", shortId: "buzzer", camelName: "buzzer", shortName: "buzzer", extends: ["_base"], notes: { short: "A simple buzzer." }, classIdentifier: 458731991, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "volume", identifier: 1, description: "The volume (duty cycle) of the buzzer.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 1 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "command", name: "play_tone", identifier: 128, description: "Play a PWM tone with given period and duty for given duration.\nThe duty is scaled down with `volume` register.\nTo play tone at frequency `F` Hz and volume `V` (in `0..1`) you will want\nto send `P = 1000000 / F` and `D = P * V / 2`.", fields: [{ name: "period", unit: "us", type: "u16", storage: 2, isSimpleType: true }, { name: "duty", unit: "us", type: "u16", storage: 2, isSimpleType: true }, { name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], lowLevel: true, packFormat: "u16 u16 u16" }, { kind: "command", name: "play_note", identifier: 129, description: "Play a note at the given frequency and volume.", fields: [{ name: "frequency", unit: "AudHz", type: "u16", storage: 2, isSimpleType: true }, { name: "volume", unit: "/", shift: 16, type: "u0.16", storage: 2 }, { name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], client: true, packFormat: "u16 u0.16 u16" }], tags: ["C", "8bit"], group: "Sound" }, { name: "Capacitive Button", status: "rc", shortId: "capacitivebutton", camelName: "capacitiveButton", shortName: "capacitiveButton", extends: ["_base"], notes: { short: "A configuration service for a capacitive push-button." }, classIdentifier: 677752265, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "threshold", identifier: 6, description: "Indicates the threshold for ``up`` events.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "active_threshold", packFormat: "u0.16" }, { kind: "command", name: "calibrate", identifier: 2, description: "Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button. \nThe report indicates the calibration is done.", fields: [], identifierName: "calibrate", hasReport: true }, { kind: "report", name: "calibrate", identifier: 2, description: "Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button. \nThe report indicates the calibration is done.", fields: [], secondary: true }], tags: ["8bit"], group: "Button" }, { name: "Character Screen", status: "rc", shortId: "characterscreen", camelName: "characterScreen", shortName: "characterScreen", extends: ["_base"], notes: { short: "A screen that displays characters, typically a LCD/OLED character screen." }, classIdentifier: 523748714, enums: { Variant: { name: "Variant", storage: 1, members: { LCD: 1, OLED: 2, Braille: 3 } }, TextDirection: { name: "TextDirection", storage: 1, members: { LeftToRight: 1, RightToLeft: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "message", identifier: 2, description: "Text to show. Use `\\n` to break lines.", fields: [{ name: "_", type: "string", storage: 0 }], identifierName: "value", packFormat: "s" }, { kind: "rw", name: "brightness", identifier: 1, description: "Brightness of the screen. `0` means off.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], optional: true, identifierName: "intensity", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of character LED screen.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "rw", name: "text_direction", identifier: 130, description: "Specifies the RTL or LTR direction of the text.", fields: [{ name: "_", type: "TextDirection", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "const", name: "rows", identifier: 384, description: "Gets the number of rows.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "columns", identifier: 385, description: "Gets the number of columns.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }], tags: [], group: "Display" }, { name: "Cloud Adapter", status: "experimental", shortId: "cloudadapter", camelName: "cloudAdapter", shortName: "cloudAdapter", extends: ["_base"], notes: { short: "Supports cloud connections to upload and download data.\nNote that `f64` values following a label are not necessarily aligned." }, classIdentifier: 341864092, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "upload_json", identifier: 128, description: "Upload a JSON-encoded message to the cloud.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "json", type: "string", storage: 0 }], packFormat: "z s" }, { kind: "command", name: "upload_binary", identifier: 129, description: "Upload a binary message to the cloud.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "z b" }, { kind: "ro", name: "connected", identifier: 384, description: "Indicate whether we're currently connected to the cloud server.\nWhen offline, `upload` commands are queued.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "connection_name", identifier: 385, description: 'User-friendly name of the connection, typically includes name of the server\nand/or type of cloud service (`"something.cloud.net (Provider IoT)"`).', fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "event", name: "on_json", identifier: 128, description: "Emitted when cloud send us a JSON message.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "json", type: "string", storage: 0 }], packFormat: "z s" }, { kind: "event", name: "on_binary", identifier: 129, description: "Emitted when cloud send us a binary message.", fields: [{ name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "z b" }, { kind: "event", name: "change", identifier: 3, description: "Emitted when we connect or disconnect from the cloud.", fields: [], identifierName: "change" }], tags: ["infrastructure", "devicescript"], group: "Iot", restricted: true }, { name: "Cloud Configuration", status: "rc", shortId: "cloudconfiguration", camelName: "cloudConfiguration", shortName: "cloudConfiguration", extends: ["_base"], notes: { short: "Connection and diagnostics information about the cloud connection." }, classIdentifier: 342028028, enums: { ConnectionStatus: { name: "ConnectionStatus", storage: 2, members: { Connected: 1, Disconnected: 2, Connecting: 3, Disconnecting: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "server_name", identifier: 384, description: "Something like `my-iot-hub.azure-devices.net` if available.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "ro", name: "cloud_device_id", identifier: 385, description: "Device identifier for the device in the cloud if available.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "const", name: "cloud_type", identifier: 387, description: "Cloud provider identifier.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "ro", name: "connection_status", identifier: 386, description: "Indicates the status of connection. A message beyond the [0..3] range represents an HTTP error code.", fields: [{ name: "_", type: "ConnectionStatus", storage: 2 }], packFormat: "u16" }, { kind: "rw", name: "push_period", identifier: 128, description: "How often to push data to the cloud.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 5e3 }], packFormat: "u32" }, { kind: "rw", name: "push_watchdog_period", identifier: 129, description: "If no message is published within given period, the device resets.\nThis can be due to connectivity problems or due to the device having nothing to publish.\nForced to be at least `2 * flush_period`.\nSet to `0` to disable (default).", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "command", name: "connect", identifier: 129, description: "Starts a connection to the cloud service", fields: [], restricted: true }, { kind: "command", name: "disconnect", identifier: 130, description: "Starts disconnecting from the cloud service", fields: [], restricted: true }, { kind: "command", name: "set_connection_string", identifier: 134, description: "Restricted command to override the existing connection string to cloud.", fields: [{ name: "connection_string", type: "string", storage: 0 }], restricted: true, packFormat: "s" }, { kind: "event", name: "connection_status_change", identifier: 3, description: "Raised when the connection status changes", fields: [{ name: "connection_status", type: "ConnectionStatus", storage: 2 }], identifierName: "change", packFormat: "u16" }, { kind: "event", name: "message_sent", identifier: 128, description: "Raised when a message has been sent to the hub.", fields: [] }], tags: ["management"], group: "Iot" }, { name: "CODAL Message Bus", status: "experimental", shortId: "codalmessagebus", camelName: "codalMessageBus", shortName: "codalMessageBus", extends: ["_base"], notes: { short: "A service that uses the [CODAL message bus](https://lancaster-university.github.io/microbit-docs/ubit/messageBus/) to send and receive small messages.\n\nYou can find known values for `source` in [CODAL repository](https://github.com/lancaster-university/codal-core/blob/master/inc/core/CodalComponent.h)\nIn MakeCode, you can listen for custom `source`, `value` values using [control.onEvent](https://makecode.microbit.org/reference/control/on-event]." }, classIdentifier: 304085021, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "send", identifier: 128, description: "Send a message on the CODAL bus. If `source` is `0`, it is treated as wildcard.", fields: [{ name: "source", type: "u16", storage: 2, isSimpleType: true }, { name: "value", type: "u16", storage: 2, isSimpleType: true }], unique: true, packFormat: "u16 u16" }, { kind: "event", name: "message", identifier: 128, description: "Raised by the server is triggered by the server. The filtering logic of which event to send over Jacdac is up to the server implementation.", fields: [{ name: "source", type: "u16", storage: 2, isSimpleType: true }, { name: "value", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }], tags: [] }, { name: "Color", status: "experimental", shortId: "color", camelName: "color", shortName: "color", extends: ["_base", "_sensor"], notes: { short: "Senses RGB colors" }, classIdentifier: 372299111, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "color", identifier: 257, description: "Detected color in the RGB color space.", fields: [{ name: "red", unit: "/", shift: 16, type: "u0.16", storage: 2 }, { name: "green", unit: "/", shift: 16, type: "u0.16", storage: 2 }, { name: "blue", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16 u0.16 u0.16" }], tags: ["8bit"], group: "Environment" }, { name: "Compass", status: "rc", shortId: "compass", camelName: "compass", shortName: "compass", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures the heading." }, classIdentifier: 364362175, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "heading", identifier: 257, description: "The heading with respect to the magnetic north.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "u16.16", storage: 4, absoluteMin: 0, absoluteMax: 359 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn on or off the sensor. Turning on the sensor may start a calibration sequence.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "ro", name: "heading_error", identifier: 262, description: "Error on the heading reading", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "command", name: "calibrate", identifier: 2, description: "Starts a calibration sequence for the compass.", fields: [], identifierName: "calibrate" }], tags: [] }, { name: "Control", status: "stable", shortId: "control", camelName: "control", shortName: "control", extends: ["_base"], notes: { short: "Control service is always service index `0`.\nIt handles actions common to all services on a device.\n\nNote: some of the optional features (including `flood_ping`, `mcu_temperature`, and all string registers)\nare not implemented in `8bit` version." }, classIdentifier: 0, enums: { AnnounceFlags: { name: "AnnounceFlags", storage: 2, isFlags: true, members: { RestartCounterSteady: 15, RestartCounter1: 1, RestartCounter2: 2, RestartCounter4: 4, RestartCounter8: 8, StatusLightNone: 0, StatusLightMono: 16, StatusLightRgbNoFade: 32, StatusLightRgbFade: 48, SupportsACK: 256, SupportsBroadcast: 512, SupportsFrames: 1024, IsClient: 2048, SupportsReliableCommands: 4096 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "services", identifier: 0, description: "The `restart_counter` is computed from the `flags & RestartCounterSteady`, starts at `0x1` and increments by one until it reaches `0xf`, then it stays at `0xf`.\nIf this number ever goes down, it indicates that the device restarted.\n`service_class` indicates class identifier for each service index (service index `0` is always control, so it's\nskipped in this enumeration).\n`packet_count` indicates the number of reports sent by the current device since last announce,\nincluding the current announce packet (it is always 0 if this feature is not supported).\nThe command form can be used to induce report, which is otherwise broadcast every 500ms.", fields: [], identifierName: "announce", hasReport: true }, { kind: "report", name: "services", identifier: 0, description: "The `restart_counter` is computed from the `flags & RestartCounterSteady`, starts at `0x1` and increments by one until it reaches `0xf`, then it stays at `0xf`.\nIf this number ever goes down, it indicates that the device restarted.\n`service_class` indicates class identifier for each service index (service index `0` is always control, so it's\nskipped in this enumeration).\n`packet_count` indicates the number of reports sent by the current device since last announce,\nincluding the current announce packet (it is always 0 if this feature is not supported).\nThe command form can be used to induce report, which is otherwise broadcast every 500ms.", fields: [{ name: "flags", type: "AnnounceFlags", storage: 2 }, { name: "packet_count", type: "u8", storage: 1, isSimpleType: true }, { name: "reserved", type: "u8", storage: 1, isSimpleType: true }, { name: "service_class", type: "u32", storage: 4, isSimpleType: true, startRepeats: true }], secondary: true, packFormat: "u16 u8 u8 r: u32" }, { kind: "command", name: "noop", identifier: 128, description: "Do nothing. Always ignored. Can be used to test ACKs.", fields: [] }, { kind: "command", name: "identify", identifier: 129, description: "Blink the status LED (262ms on, 262ms off, four times, with the blue LED) or otherwise draw user's attention to device with no status light.\nFor devices with status light (this can be discovered in the announce flags), the client should\nsend the sequence of status light command to generate the identify animation.", fields: [], optional: true }, { kind: "command", name: "reset", identifier: 130, description: "Reset device. ACK may or may not be sent.", fields: [], optional: true }, { kind: "command", name: "flood_ping", identifier: 131, description: "The device will respond `num_responses` times, as fast as it can, setting the `counter` field in the report\nto `start_counter`, then `start_counter + 1`, ..., and finally `start_counter + num_responses - 1`.\nThe `dummy_payload` is `size` bytes long and contains bytes `0, 1, 2, ...`.", fields: [{ name: "num_responses", type: "u32", storage: 4, isSimpleType: true }, { name: "start_counter", type: "u32", storage: 4, isSimpleType: true }, { name: "size", unit: "B", type: "u8", storage: 1, isSimpleType: true }], unique: true, optional: true, hasReport: true, packFormat: "u32 u32 u8" }, { kind: "report", name: "flood_ping", identifier: 131, description: "The device will respond `num_responses` times, as fast as it can, setting the `counter` field in the report\nto `start_counter`, then `start_counter + 1`, ..., and finally `start_counter + num_responses - 1`.\nThe `dummy_payload` is `size` bytes long and contains bytes `0, 1, 2, ...`.", fields: [{ name: "counter", type: "u32", storage: 4, isSimpleType: true }, { name: "dummy_payload", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "u32 b" }, { kind: "command", name: "set_status_light", identifier: 132, description: "Initiates a color transition of the status light from its current color to the one specified.\nThe transition will complete in about `512 / speed` frames\n(each frame is currently 100ms, so speed of `51` is about 1 second and `26` 0.5 second).\nAs a special case, if speed is `0` the transition is immediate.\nIf MCU is not capable of executing transitions, it can consider `speed` to be always `0`.\nIf a monochrome LEDs is fitted, the average value of `red`, `green`, `blue` is used.\nIf intensity of a monochrome LED cannot be controlled, any value larger than `0` should be considered\non, and `0` (for all three channels) should be considered off.", fields: [{ name: "to_red", type: "u8", storage: 1, isSimpleType: true }, { name: "to_green", type: "u8", storage: 1, isSimpleType: true }, { name: "to_blue", type: "u8", storage: 1, isSimpleType: true }, { name: "speed", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8 u8 u8 u8" }, { kind: "command", name: "proxy", identifier: 133, description: "Force client device into proxy mode.", fields: [], optional: true }, { kind: "command", name: "reliable_commands", identifier: 134, description: "This opens a pipe to the device to provide an alternative, reliable transport of actions\n(and possibly other commands).\nThe commands are wrapped as pipe data packets.\nMultiple invocations of this command with the same `seed` are dropped\n(and thus the command is not `unique`); otherwise `seed` carries no meaning\nand should be set to a random value by the client.\nNote that while the commands sends this way are delivered exactly once, the\nresponses might get lost.", fields: [{ name: "seed", type: "u32", storage: 4, isSimpleType: true }], optional: true, hasReport: true, packFormat: "u32" }, { kind: "report", name: "reliable_commands", identifier: 134, description: "This opens a pipe to the device to provide an alternative, reliable transport of actions\n(and possibly other commands).\nThe commands are wrapped as pipe data packets.\nMultiple invocations of this command with the same `seed` are dropped\n(and thus the command is not `unique`); otherwise `seed` carries no meaning\nand should be set to a random value by the client.\nNote that while the commands sends this way are delivered exactly once, the\nresponses might get lost.", fields: [{ name: "commands", type: "pipe", storage: 12 }], secondary: true, pipeType: "reliable_commands", packFormat: "b[12]" }, { kind: "pipe_command", name: "wrapped_command", identifier: 0, description: "This opens a pipe to the device to provide an alternative, reliable transport of actions\n(and possibly other commands).\nThe commands are wrapped as pipe data packets.\nMultiple invocations of this command with the same `seed` are dropped\n(and thus the command is not `unique`); otherwise `seed` carries no meaning\nand should be set to a random value by the client.\nNote that while the commands sends this way are delivered exactly once, the\nresponses might get lost.", fields: [{ name: "service_size", type: "u8", storage: 1, isSimpleType: true }, { name: "service_index", type: "u8", storage: 1, isSimpleType: true }, { name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "reliable_commands", packFormat: "u8 u8 u16 b" }, { kind: "command", name: "standby", identifier: 135, description: "Attempt to put devices into lowest power sleep mode for a specified time - most likely involving a full reset on wake-up.", fields: [{ name: "duration", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }, { kind: "rw", name: "reset_in", identifier: 128, description: "When set to value other than `0`, it asks the device to reset after specified number of microseconds.\nThis is typically used to implement watchdog functionality, where a brain device sets `reset_in` to\nsay 1.6s every 0.5s.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, packFormat: "u32" }, { kind: "const", name: "device_description", identifier: 384, description: "Identifies the type of hardware (eg., ACME Corp. Servo X-42 Rev C)", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "const", name: "product_identifier", identifier: 385, description: "A numeric code for the string above; used to identify firmware images and devices.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true, absoluteMin: 805306368, absoluteMax: 1073741823 }], optional: true, packFormat: "u32" }, { kind: "const", name: "bootloader_product_identifier", identifier: 388, description: "Typically the same as `product_identifier` unless device was flashed by hand; the bootloader will respond to that code.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true, absoluteMin: 805306368, absoluteMax: 1073741823 }], optional: true, packFormat: "u32" }, { kind: "const", name: "firmware_version", identifier: 389, description: "A string describing firmware version; typically semver.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "ro", name: "mcu_temperature", identifier: 386, description: "MCU temperature in degrees Celsius (approximate).", fields: [{ name: "_", unit: "\xB0C", type: "i16", storage: -2, isSimpleType: true, typicalMin: -10, typicalMax: 150 }], volatile: true, optional: true, preferredInterval: 6e4, packFormat: "i16" }, { kind: "ro", name: "uptime", identifier: 390, description: "Number of microseconds since boot.", fields: [{ name: "_", unit: "us", type: "u64", storage: 8, isSimpleType: true }], volatile: true, optional: true, preferredInterval: 6e4, packFormat: "u64" }], tags: ["C", "8bit"] }, { name: "Dashboard", status: "stable", shortId: "dashboard", camelName: "dashboard", shortName: "dashboard", extends: ["_base"], notes: { short: "Device that interacts, configure or inspects with the services on the bus. While a dashboard is on the bus, heuristics like device reset should be disabled." }, classIdentifier: 468029703, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "DC Current Measurement", status: "experimental", shortId: "dccurrentmeasurement", camelName: "dcCurrentMeasurement", shortName: "dcCurrentMeasurement", extends: ["_base", "_sensor"], notes: { short: "A service that reports a current measurement." }, classIdentifier: 420661422, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "measurement_name", identifier: 386, description: "A string containing the net name that is being measured e.g. `POWER_DUT` or a reference e.g. `DIFF_DEV1_DEV2`. These constants can be used to identify a measurement from client code.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "measurement", identifier: 257, description: "The current measurement.", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], volatile: true, identifierName: "reading", packFormat: "f64" }, { kind: "ro", name: "measurement_error", identifier: 262, description: "Absolute error on the reading value.", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "f64" }, { kind: "const", name: "min_measurement", identifier: 260, description: "Minimum measurable current", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "min_reading", packFormat: "f64" }, { kind: "const", name: "max_measurement", identifier: 261, description: "Maximum measurable current", fields: [{ name: "_", unit: "A", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "max_reading", packFormat: "f64" }], tags: [] }, { name: "DC Voltage Measurement", status: "experimental", shortId: "dcvoltagemeasurement", camelName: "dcVoltageMeasurement", shortName: "dcVoltageMeasurement", extends: ["_base", "_sensor"], notes: { short: "A service that reports a voltage measurement." }, classIdentifier: 372485145, enums: { VoltageMeasurementType: { name: "VoltageMeasurementType", storage: 1, members: { Absolute: 0, Differential: 1 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "measurement_type", identifier: 385, description: "The type of measurement that is taking place. Absolute results are measured with respect to ground, whereas differential results are measured against another signal that is not ground.", fields: [{ name: "_", type: "VoltageMeasurementType", storage: 1 }], packFormat: "u8" }, { kind: "const", name: "measurement_name", identifier: 386, description: "A string containing the net name that is being measured e.g. `POWER_DUT` or a reference e.g. `DIFF_DEV1_DEV2`. These constants can be used to identify a measurement from client code.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "measurement", identifier: 257, description: "The voltage measurement.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], volatile: true, identifierName: "reading", packFormat: "f64" }, { kind: "ro", name: "measurement_error", identifier: 262, description: "Absolute error on the reading value.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "f64" }, { kind: "const", name: "min_measurement", identifier: 260, description: "Minimum measurable current", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "min_reading", packFormat: "f64" }, { kind: "const", name: "max_measurement", identifier: 261, description: "Maximum measurable current", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], optional: true, identifierName: "max_reading", packFormat: "f64" }], tags: [] }, { name: "DeviceScript Condition", status: "deprecated", shortId: "devicescriptcondition", camelName: "deviceScriptCondition", shortName: "deviceScriptCondition", extends: ["_base"], notes: { short: "Conditions are synthetic services used to synchronize threads of executions of a DeviceScript VM.\n**This is no longer used**." }, classIdentifier: 295074157, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "signal", identifier: 128, description: "Triggers a `signalled` event.", fields: [] }, { kind: "event", name: "signalled", identifier: 3, description: "Triggered by `signal` command.", fields: [], identifierName: "change" }], tags: ["infrastructure", "devicescript"], restricted: true }, { name: "DeviceScript Debugger", status: "experimental", shortId: "devicescriptdebugger", camelName: "devsDbg", shortName: "devsDbg", extends: ["_base"], notes: { short: "Allows for inspecting and affecting the state of a running DeviceScript program." }, classIdentifier: 358308672, enums: { ValueTag: { name: "ValueTag", storage: 1, members: { Number: 1, Special: 2, Fiber: 3, BuiltinObject: 5, Exotic: 6, Unhandled: 7, ImgBuffer: 32, ImgStringBuiltin: 33, ImgStringAscii: 34, ImgStringUTF8: 35, ImgRole: 48, ImgFunction: 49, ImgRoleMember: 50, ObjArray: 81, ObjMap: 82, ObjBuffer: 83, ObjString: 84, ObjStackFrame: 85, ObjPacket: 86, ObjBoundFunction: 87, ObjOpaque: 88, ObjAny: 80, ObjMask: 240, User1: 241, User2: 242, User3: 243, User4: 244 } }, ValueSpecial: { name: "ValueSpecial", storage: 1, members: { Undefined: 0, True: 1, False: 2, Null: 3, Globals: 100, CurrentException: 101 } }, FunIdx: { name: "FunIdx", storage: 2, isExtensible: true, members: { None: 0, Main: 49999, FirstBuiltIn: 5e4 } }, FiberHandle: { name: "FiberHandle", storage: 4, isExtensible: true, members: { None: 0 } }, ProgramCounter: { name: "ProgramCounter", storage: 4, isExtensible: true, members: {} }, ObjStackFrame: { name: "ObjStackFrame", storage: 4, isExtensible: true, members: { Null: 0 } }, String: { name: "String", storage: 4, isExtensible: true, members: { StaticIndicatorMask: 2147483649, StaticTagMask: 2130706432, StaticIndexMask: 16777214, Unhandled: 0 } }, StepFlags: { name: "StepFlags", storage: 2, isFlags: true, members: { StepOut: 1, StepIn: 2, Throw: 4 } }, SuspensionType: { name: "SuspensionType", storage: 1, members: { None: 0, Breakpoint: 1, UnhandledException: 2, HandledException: 3, Halt: 4, Panic: 5, Restart: 6, DebuggerStmt: 7, Step: 8 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "read_fibers", identifier: 128, description: "List the currently running fibers (threads).", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "read_fibers", packFormat: "b[12]" }, { kind: "pipe_report", name: "fiber", identifier: 0, description: "List the currently running fibers (threads).", fields: [{ name: "handle", type: "FiberHandle", storage: 4 }, { name: "initial_fn", type: "FunIdx", storage: 2 }, { name: "curr_fn", type: "FunIdx", storage: 2 }], pipeType: "read_fibers", packFormat: "u32 u16 u16" }, { kind: "command", name: "read_stack", identifier: 129, description: "List stack frames in a fiber.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "fiber_handle", type: "FiberHandle", storage: 4 }], pipeType: "read_stack", packFormat: "b[12] u32" }, { kind: "pipe_report", name: "stackframe", identifier: 0, description: "List stack frames in a fiber.", fields: [{ name: "self", type: "ObjStackFrame", storage: 4 }, { name: "pc", type: "ProgramCounter", storage: 4 }, { name: "closure", type: "ObjStackFrame", storage: 4 }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "reserved", type: "u16", storage: 2, isSimpleType: true }], pipeType: "read_stack", packFormat: "u32 u32 u32 u16 u16" }, { kind: "command", name: "read_indexed_values", identifier: 130, description: "Read variable slots in a stack frame, elements of an array, etc.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }, { name: "reserved", type: "u8", storage: 1, isSimpleType: true }, { name: "start", type: "u16", storage: 2, isSimpleType: true }, { name: "length", type: "u16", storage: 2, isSimpleType: true }], pipeType: "read_indexed_values", packFormat: "b[12] u32 u8 u8 u16 u16" }, { kind: "pipe_report", name: "value", identifier: 0, description: "Read variable slots in a stack frame, elements of an array, etc.", fields: [{ name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "v1", type: "u32", storage: 4, isSimpleType: true }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "tag", type: "ValueTag", storage: 1 }], pipeType: "read_indexed_values", packFormat: "u32 u32 u16 u8" }, { kind: "command", name: "read_named_values", identifier: 131, description: "Read variable slots in an object.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }], pipeType: "read_named_values", packFormat: "b[12] u32 u8" }, { kind: "pipe_report", name: "key_value", identifier: 0, description: "Read variable slots in an object.", fields: [{ name: "key", type: "String", storage: 4 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "v1", type: "u32", storage: 4, isSimpleType: true }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "tag", type: "ValueTag", storage: 1 }], pipeType: "read_named_values", packFormat: "u32 u32 u32 u16 u8" }, { kind: "command", name: "read_value", identifier: 132, description: "Read a specific value.", fields: [{ name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }], hasReport: true, packFormat: "u32 u8" }, { kind: "report", name: "read_value", identifier: 132, description: "Read a specific value.", fields: [{ name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "v1", type: "u32", storage: 4, isSimpleType: true }, { name: "fn_idx", type: "FunIdx", storage: 2 }, { name: "tag", type: "ValueTag", storage: 1 }], secondary: true, packFormat: "u32 u32 u16 u8" }, { kind: "command", name: "read_bytes", identifier: 133, description: "Read bytes of a string (UTF8) or buffer value.", fields: [{ name: "results", type: "pipe", storage: 12 }, { name: "v0", type: "u32", storage: 4, isSimpleType: true }, { name: "tag", type: "ValueTag", storage: 1 }, { name: "reserved", type: "u8", storage: 1, isSimpleType: true }, { name: "start", type: "u16", storage: 2, isSimpleType: true }, { name: "length", type: "u16", storage: 2, isSimpleType: true }], pipeType: "read_bytes", packFormat: "b[12] u32 u8 u8 u16 u16" }, { kind: "pipe_report", name: "bytes_value", identifier: 0, description: "Read bytes of a string (UTF8) or buffer value.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "read_bytes", packFormat: "b" }, { kind: "command", name: "set_breakpoints", identifier: 144, description: "Set breakpoint(s) at a location(s).", fields: [{ name: "break_pc", type: "ProgramCounter", storage: 4, startRepeats: true }], packFormat: "r: u32" }, { kind: "command", name: "clear_breakpoints", identifier: 145, description: "Clear breakpoint(s) at a location(s).", fields: [{ name: "break_pc", type: "ProgramCounter", storage: 4, startRepeats: true }], packFormat: "r: u32" }, { kind: "command", name: "clear_all_breakpoints", identifier: 146, description: "Clear all breakpoints.", fields: [] }, { kind: "command", name: "resume", identifier: 147, description: "Resume program execution after a breakpoint was hit.", fields: [] }, { kind: "command", name: "halt", identifier: 148, description: "Try suspending current program. Client needs to wait for `suspended` event afterwards.", fields: [] }, { kind: "command", name: "restart_and_halt", identifier: 149, description: "Run the program from the beginning and halt on first instruction.", fields: [] }, { kind: "command", name: "step", identifier: 150, description: "Set breakpoints that only trigger in the specified stackframe and resume program.\nThe breakpoints are cleared automatically on next suspension (regardless of the reason).", fields: [{ name: "stackframe", type: "ObjStackFrame", storage: 4 }, { name: "flags", type: "StepFlags", storage: 2 }, { name: "reserved", type: "u16", storage: 2, isSimpleType: true }, { name: "break_pc", type: "ProgramCounter", storage: 4, startRepeats: true }], packFormat: "u32 u16 u16 r: u32" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn on/off the debugger interface.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "break_at_unhandled_exn", identifier: 128, description: "Wheather to place breakpoint at unhandled exception.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "break_at_handled_exn", identifier: 129, description: "Wheather to place breakpoint at handled exception.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "is_suspended", identifier: 384, description: "Indicates if the program is currently suspended.\nMost commands can only be executed when the program is suspended.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "event", name: "suspended", identifier: 128, description: "Emitted when the program hits a breakpoint or similar event in the specified fiber.", fields: [{ name: "fiber", type: "FiberHandle", storage: 4 }, { name: "type", type: "SuspensionType", storage: 1 }], packFormat: "u32 u8" }], tags: ["management", "devicescript"], restricted: true }, { name: "DeviceScript Manager", status: "experimental", shortId: "devicescriptmanager", camelName: "deviceScriptManager", shortName: "deviceScriptManager", extends: ["_base"], notes: { short: "Allows for deployment and control over DeviceScript virtual machine.\n\nPrograms start automatically after device restart or uploading of new program.\nYou can stop programs until next reset by setting the `running` and `autostart` registers to `false`.", events: "When program is running, `status_code == Ready`.\nWhen there is a valid program, but it is not running, `status_code == Sleeping`.\nWhen there is no valid program, `status_code == WaitingForInput`." }, classIdentifier: 288680491, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "deploy_bytecode", identifier: 128, description: "Open pipe for streaming in the bytecode of the program. The size of the bytecode has to be declared upfront.\nTo clear the program, use `bytecode_size == 0`.\nThe bytecode is streamed over regular pipe data packets.\nThe bytecode shall be fully written into flash upon closing the pipe.\nIf `autostart` is true, the program will start after being deployed.\nThe data payloads, including the last one, should have a size that is a multiple of 32 bytes.\nThus, the initial bytecode_size also needs to be a multiple of 32.", fields: [{ name: "bytecode_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }], unique: true, hasReport: true, packFormat: "u32" }, { kind: "report", name: "deploy_bytecode", identifier: 128, description: "Open pipe for streaming in the bytecode of the program. The size of the bytecode has to be declared upfront.\nTo clear the program, use `bytecode_size == 0`.\nThe bytecode is streamed over regular pipe data packets.\nThe bytecode shall be fully written into flash upon closing the pipe.\nIf `autostart` is true, the program will start after being deployed.\nThe data payloads, including the last one, should have a size that is a multiple of 32 bytes.\nThus, the initial bytecode_size also needs to be a multiple of 32.", fields: [{ name: "bytecode_port", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "deploy_bytecode", packFormat: "u16" }, { kind: "command", name: "read_bytecode", identifier: 129, description: "Get the current bytecode deployed on device.", fields: [{ name: "bytecode", type: "pipe", storage: 12 }], pipeType: "read_bytecode", packFormat: "b[12]" }, { kind: "pipe_report", name: "bytecode", identifier: 0, description: "Get the current bytecode deployed on device.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "read_bytecode", packFormat: "b" }, { kind: "rw", name: "running", identifier: 128, description: "Indicates if the program is currently running.\nTo restart the program, stop it (write `0`), read back the register to make sure it's stopped,\nstart it, and read back.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "autostart", identifier: 129, description: "Indicates wheather the program should be re-started upon `reboot()` or `panic()`.\nDefaults to `true`.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "program_size", identifier: 384, description: "The size of current program.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "program_hash", identifier: 385, description: "Return FNV1A hash of the current bytecode.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "program_sha256", identifier: 386, description: "Return 32-byte long SHA-256 hash of the current bytecode.", fields: [{ name: "_", type: "bytes", storage: 32, isSimpleType: true, maxBytes: 32 }], packFormat: "b[32]" }, { kind: "const", name: "runtime_version", identifier: 387, description: "Returns the runtime version number compatible with [Semver](https://semver.org/).\nWhen read as 32-bit little endian integer a version `7.15.500` would be `0x07_0F_01F4`.", fields: [{ name: "patch", type: "u16", storage: 2, isSimpleType: true }, { name: "minor", type: "u8", storage: 1, isSimpleType: true }, { name: "major", type: "u8", storage: 1, isSimpleType: true }], optional: true, packFormat: "u16 u8 u8" }, { kind: "ro", name: "program_name", identifier: 388, description: "The name of currently running program. The compiler takes is from `package.json`.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "program_version", identifier: 389, description: "The version number of currently running program. The compiler takes is from `package.json`\nand `git`.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "event", name: "program_panic", identifier: 128, description: "Emitted when the program calls `panic(panic_code)` or `reboot()` (`panic_code == 0` in that case).\nThe byte offset in byte code of the call is given in `program_counter`.\nThe program will restart immediately when `panic_code == 0` or in a few seconds otherwise.", fields: [{ name: "panic_code", type: "u32", storage: 4, isSimpleType: true }, { name: "program_counter", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32 u32" }, { kind: "event", name: "program_change", identifier: 3, description: "Emitted after bytecode of the program has changed.", fields: [], identifierName: "change" }], tags: ["management", "devicescript"], restricted: true }, { name: "Distance", status: "stable", shortId: "distance", camelName: "distance", shortName: "distance", extends: ["_base", "_sensor"], notes: { short: "A sensor that determines the distance of an object without any physical contact involved." }, classIdentifier: 337275786, enums: { Variant: { name: "Variant", storage: 1, members: { Ultrasonic: 1, Infrared: 2, LiDAR: 3, Laser: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "distance", identifier: 257, description: "Current distance from the object", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4, typicalMin: 0.02, typicalMax: 4 }], volatile: true, identifierName: "reading", packFormat: "u16.16" }, { kind: "ro", name: "distance_error", identifier: 262, description: "Absolute error on the reading value.", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "min_range", identifier: 260, description: "Minimum measurable distance", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "min_reading", packFormat: "u16.16" }, { kind: "const", name: "max_range", identifier: 261, description: "Maximum measurable distance", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "Determines the type of sensor used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"] }, { name: "DMX", status: "experimental", shortId: "dmx", camelName: "dmx", shortName: "dmx", extends: ["_base"], notes: { short: "A service that can send DMX512-A packets with limited size. This service is designed to allow tinkering with a few DMX devices, but only allows 235 channels. More about DMX at https://en.wikipedia.org/wiki/DMX512." }, classIdentifier: 298814469, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines if the DMX bridge is active.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "command", name: "send", identifier: 128, description: "Send a DMX packet, up to 236bytes long, including the start code.", fields: [{ name: "channels", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }], tags: [] }, { name: "Dot Matrix", status: "rc", shortId: "dotmatrix", camelName: "dotMatrix", shortName: "dotMatrix", extends: ["_base"], notes: { short: "A rectangular dot matrix display, made of monochrome LEDs or Braille pins." }, classIdentifier: 286070091, enums: { Variant: { name: "Variant", storage: 1, members: { LED: 1, Braille: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "dots", identifier: 2, description: "The state of the screen where dot on/off state is\nstored as a bit, column by column. The column should be byte aligned.\n\nFor example, if the display has no more than 8 rows in each column, then each byte contains bits corresponding\nto a single column. Least-significant bit is on top.\nIf display has 10 rows, then each column is represented by two bytes.\nThe top-most 8 rows sit in the first byte (with the least significant bit being on top),\nand the remainign 2 row sit in the second byte.\n\nThe following C expression can be used to check if a given `column, row` coordinate is set:\n`dots[column * column_size + (row >> 3)] & (1 << (row & 7))`, where\n`column_size` is `(number_of_rows + 7) >> 3` (note that if number of rows is 8 or less then `column_size` is `1`),\nand `dots` is of `uint8_t*` type.\n\nThe size of this register is `number_of_columns * column_size` bytes.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], identifierName: "value", packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Reads the general brightness of the display, brightness for LEDs. `0` when the screen is off.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], optional: true, identifierName: "intensity", packFormat: "u0.8" }, { kind: "const", name: "rows", identifier: 385, description: "Number of rows on the screen", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "columns", identifier: 386, description: "Number of columns on the screen", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of matrix used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [], group: "Display" }, { name: "Dual Motors", status: "experimental", shortId: "dualmotors", camelName: "dualMotors", shortName: "dualMotors", extends: ["_base"], notes: { short: "A synchronized pair of motors." }, classIdentifier: 355063095, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "speed", identifier: 2, description: "Relative speed of the motors. Use positive/negative values to run the motor forwards and backwards.\nA speed of ``0`` while ``enabled`` acts as brake.", fields: [{ name: "left", unit: "/", shift: 15, type: "i1.15", storage: -2 }, { name: "right", unit: "/", shift: 15, type: "i1.15", storage: -2 }], identifierName: "value", packFormat: "i1.15 i1.15" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn the power to the motors on/off.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "load_torque", identifier: 384, description: "Torque required to produce the rated power of an each electrical motor at load speed.", fields: [{ name: "_", unit: "kg/cm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "load_rotation_speed", identifier: 385, description: "Revolutions per minute of the motor under full load.", fields: [{ name: "_", unit: "rpm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "reversible", identifier: 386, description: "Indicates if the motors can run backwards.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: [], group: "Motor" }, { name: "Equivalent CO\u2082", status: "rc", shortId: "eco2", camelName: "eCO2", shortName: "eCO2", extends: ["_base", "_sensor"], notes: { short: "Measures equivalent CO\u2082 levels." }, classIdentifier: 379362758, enums: { Variant: { name: "Variant", storage: 1, members: { VOC: 1, NDIR: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "e_CO2", identifier: 257, description: "Equivalent CO\u2082 (eCO\u2082) readings.", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4, typicalMin: 400, typicalMax: 8192 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u22.10" }, { kind: "ro", name: "e_CO2_error", identifier: 262, description: "Error on the reading value.", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_e_CO2", identifier: 260, description: "Minimum measurable value", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4 }], identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_e_CO2", identifier: 261, description: "Minimum measurable value", fields: [{ name: "_", unit: "ppm", shift: 10, type: "u22.10", storage: 4 }], identifierName: "max_reading", packFormat: "u22.10" }, { kind: "const", name: "variant", identifier: 263, description: "Type of physical sensor and capabilities.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Flex", status: "rc", shortId: "flex", camelName: "flex", shortName: "flex", extends: ["_base", "_sensor"], notes: { short: "A bending or deflection sensor." }, classIdentifier: 524797638, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "bending", identifier: 257, description: "A measure of the bending.", fields: [{ name: "_", unit: "/", shift: 15, type: "i1.15", storage: -2 }], volatile: true, identifierName: "reading", packFormat: "i1.15" }, { kind: "const", name: "length", identifier: 384, description: "Length of the flex sensor", fields: [{ name: "_", unit: "mm", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }], tags: ["C", "8bit"], group: "Sensor" }, { name: "Gamepad", status: "rc", shortId: "gamepad", camelName: "gamepad", shortName: "gamepad", extends: ["_base", "_sensor"], notes: { short: "A two axis directional gamepad with optional buttons." }, classIdentifier: 277836886, enums: { Buttons: { name: "Buttons", storage: 4, isFlags: true, members: { Left: 1, Up: 2, Right: 4, Down: 8, A: 16, B: 32, Menu: 64, Select: 128, Reset: 256, Exit: 512, X: 1024, Y: 2048 } }, Variant: { name: "Variant", storage: 1, members: { Thumb: 1, ArcadeBall: 2, ArcadeStick: 3, Gamepad: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "direction", identifier: 257, description: 'If the gamepad is analog, the directional buttons should be "simulated", based on gamepad position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the gamepad is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the gamepad is `A`.', fields: [{ name: "buttons", type: "Buttons", storage: 4 }, { name: "x", unit: "/", shift: 15, type: "i1.15", storage: -2 }, { name: "y", unit: "/", shift: 15, type: "i1.15", storage: -2 }], volatile: true, identifierName: "reading", packFormat: "u32 i1.15 i1.15" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical gamepad.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "const", name: "buttons_available", identifier: 384, description: "Indicates a bitmask of the buttons that are mounted on the gamepad.\nIf the `Left`/`Up`/`Right`/`Down` buttons are marked as available here, the gamepad is digital.\nEven when marked as not available, they will still be simulated based on the analog gamepad.", fields: [{ name: "_", type: "Buttons", storage: 4 }], packFormat: "u32" }, { kind: "event", name: "buttons_changed", identifier: 3, description: "Emitted whenever the state of buttons changes.", fields: [{ name: "buttons", type: "Buttons", storage: 4 }], identifierName: "change", packFormat: "u32" }], tags: ["8bit", "padauk"], group: "Button" }, { name: "GPIO", status: "experimental", shortId: "gpio", camelName: "GPIO", shortName: "GPIO", extends: ["_base", "_sensor"], notes: { short: "Access to General Purpose Input/Output (GPIO) pins on a board.\nThe pins are indexed `0 ... num_pins-1`.\nThe indexing does not correspond to hardware pin names, nor labels on the board (see `get_pin_info` command for that),\nand should **not** be exposed to the user." }, classIdentifier: 282614377, enums: { Mode: { name: "Mode", storage: 1, members: { Off: 0, OffPullUp: 16, OffPullDown: 32, Input: 1, InputPullUp: 17, InputPullDown: 33, Output: 2, OutputHigh: 18, OutputLow: 34, AnalogIn: 3, Alternative: 4, BaseModeMask: 15 } }, Capabilities: { name: "Capabilities", storage: 2, isFlags: true, members: { PullUp: 1, PullDown: 2, Input: 4, Output: 8, Analog: 16 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "state", identifier: 257, description: "For every pin set to `Input*` the corresponding **bit** in `digital_values` will be `1` if and only if\nthe pin is high.\nFor other pins, the bit is `0`.\nThis is normally streamed at low-ish speed, but it's also automatically reported whenever\na digital input pin changes value (throttled to ~100Hz).\nThe analog values can be read with the `ADC` service.", fields: [{ name: "digital_values", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "b" }, { kind: "ro", name: "num_pins", identifier: 384, description: "Number of pins that can be operated through this service.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true, absoluteMax: 128, absoluteMin: 0 }], packFormat: "u8" }, { kind: "command", name: "configure", identifier: 128, description: "Configure (including setting the value) zero or more pins.\n`Alternative` settings means the pin is controlled by other service (SPI, I2C, UART, PWM, etc.).", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true, startRepeats: true }, { name: "mode", type: "Mode", storage: 1 }], packFormat: "r: u8 u8" }, { kind: "command", name: "pin_info", identifier: 129, description: "Report capabilities and name of a pin.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }], hasReport: true, packFormat: "u8" }, { kind: "report", name: "pin_info", identifier: 129, description: "Report capabilities and name of a pin.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }, { name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }, { name: "capabilities", type: "Capabilities", storage: 2 }, { name: "mode", type: "Mode", storage: 1 }, { name: "label", type: "string", storage: 0 }], secondary: true, packFormat: "u8 u8 u16 u8 s" }, { kind: "command", name: "pin_by_label", identifier: 131, description: "This responds with `pin_info` report.", fields: [{ name: "label", type: "string", storage: 0 }], hasReport: true, packFormat: "s" }, { kind: "report", name: "pin_by_label", identifier: 131, description: "This responds with `pin_info` report.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }, { name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }, { name: "capabilities", type: "Capabilities", storage: 2 }, { name: "mode", type: "Mode", storage: 1 }, { name: "label", type: "string", storage: 0 }], secondary: true, packFormat: "u8 u8 u16 u8 s" }, { kind: "command", name: "pin_by_hw_pin", identifier: 132, description: "This responds with `pin_info` report.", fields: [{ name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }], hasReport: true, packFormat: "u8" }, { kind: "report", name: "pin_by_hw_pin", identifier: 132, description: "This responds with `pin_info` report.", fields: [{ name: "pin", type: "u8", storage: 1, isSimpleType: true }, { name: "hw_pin", type: "u8", storage: 1, isSimpleType: true }, { name: "capabilities", type: "Capabilities", storage: 2 }, { name: "mode", type: "Mode", storage: 1 }, { name: "label", type: "string", storage: 0 }], secondary: true, packFormat: "u8 u8 u16 u8 s" }], tags: ["io"] }, { name: "Gyroscope", status: "rc", shortId: "gyroscope", camelName: "gyroscope", shortName: "gyroscope", extends: ["_base", "_sensor"], notes: { short: "A 3-axis gyroscope." }, classIdentifier: 505087730, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "rotation_rates", identifier: 257, description: "Indicates the current rates acting on gyroscope.", fields: [{ name: "x", unit: "\xB0/s", shift: 20, type: "i12.20", storage: -4 }, { name: "y", unit: "\xB0/s", shift: 20, type: "i12.20", storage: -4 }, { name: "z", unit: "\xB0/s", shift: 20, type: "i12.20", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i12.20 i12.20 i12.20" }, { kind: "ro", name: "rotation_rates_error", identifier: 262, description: "Error on the reading value.", fields: [{ name: "_", unit: "\xB0/s", shift: 20, type: "u12.20", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u12.20" }, { kind: "rw", name: "max_rate", identifier: 8, description: 'Configures the range of rotation rates.\nThe value will be "rounded up" to one of `max_rates_supported`.', fields: [{ name: "_", unit: "\xB0/s", shift: 20, type: "u12.20", storage: 4 }], optional: true, identifierName: "reading_range", packFormat: "u12.20" }, { kind: "const", name: "max_rates_supported", identifier: 266, description: "Lists values supported for writing `max_rate`.", fields: [{ name: "max_rate", unit: "\xB0/s", shift: 20, type: "u12.20", storage: 4, startRepeats: true }], optional: true, identifierName: "supported_ranges", packFormat: "r: u12.20" }], tags: [], group: "Movement" }, { name: "Heart Rate", status: "experimental", shortId: "heartrate", camelName: "heartRate", shortName: "heartRate", extends: ["_base", "_sensor"], notes: { short: "A sensor approximating the heart rate. \n\n\n**Jacdac is NOT suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.**" }, classIdentifier: 376204740, enums: { Variant: { name: "Variant", storage: 1, members: { Finger: 1, Chest: 2, Wrist: 3, Pump: 4, WebCam: 5 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "heart_rate", identifier: 257, description: "The estimated heart rate.", fields: [{ name: "_", unit: "bpm", shift: 16, type: "u16.16", storage: 4, typicalMin: 30, typicalMax: 200 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16.16" }, { kind: "ro", name: "heart_rate_error", identifier: 262, description: "The estimated error on the reported sensor data.", fields: [{ name: "_", unit: "bpm", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Biometric" }, { name: "HID Joystick", status: "experimental", shortId: "hidjoystick", camelName: "hidJoystick", shortName: "hidJoystick", extends: ["_base"], notes: { short: "Controls a HID joystick." }, classIdentifier: 437330261, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "button_count", identifier: 384, description: "Number of button report supported", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "buttons_analog", identifier: 385, description: "A bitset that indicates which button is analog.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "axis_count", identifier: 386, description: "Number of analog input supported", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "command", name: "set_buttons", identifier: 128, description: "Sets the up/down button state, one byte per button, supports analog buttons. For digital buttons, use `0` for released, `1` for pressed.", fields: [{ name: "pressure", unit: "/", shift: 8, type: "u0.8", storage: 1, startRepeats: true }], unique: true, packFormat: "r: u0.8" }, { kind: "command", name: "set_axis", identifier: 129, description: "Sets the state of analog inputs.", fields: [{ name: "position", unit: "/", shift: 15, type: "i1.15", storage: -2, startRepeats: true }], unique: true, packFormat: "r: i1.15" }], tags: [] }, { name: "HID Keyboard", status: "stable", shortId: "hidkeyboard", camelName: "hidKeyboard", shortName: "hidKeyboard", extends: ["_base"], notes: { short: "Control a HID keyboard.\n\nThe codes for the key (selectors) is defined in the [HID Keyboard\nspecification](https://usb.org/sites/default/files/hut1_21.pdf), chapter 10 Keyboard/Keypad Page, page 81.\nModifiers are in page 87.\n\nThe device keeps tracks of the key state and is able to clear it all with the clear command." }, classIdentifier: 414210922, enums: { Selector: { name: "Selector", storage: 2, members: { None: 0, ErrorRollOver: 1, PostFail: 2, ErrorUndefined: 3, A: 4, B: 5, C: 6, D: 7, E: 8, F: 9, G: 10, H: 11, I: 12, J: 13, K: 14, L: 15, M: 16, N: 17, O: 18, P: 19, Q: 20, R: 21, S: 22, T: 23, U: 24, V: 25, W: 26, X: 27, Y: 28, Z: 29, _1: 30, _2: 31, _3: 32, _4: 33, _5: 34, _6: 35, _7: 36, _8: 37, _9: 38, _0: 39, Return: 40, Escape: 41, Backspace: 42, Tab: 43, Spacebar: 44, Minus: 45, Equals: 46, LeftSquareBracket: 47, RightSquareBracket: 48, Backslash: 49, NonUsHash: 50, Semicolon: 51, Quote: 52, GraveAccent: 53, Comma: 54, Period: 55, Slash: 56, CapsLock: 57, F1: 58, F2: 59, F3: 60, F4: 61, F5: 62, F6: 63, F7: 64, F8: 65, F9: 66, F10: 67, F11: 68, F12: 69, PrintScreen: 70, ScrollLock: 71, Pause: 72, Insert: 73, Home: 74, PageUp: 75, Delete: 76, End: 77, PageDown: 78, RightArrow: 79, LeftArrow: 80, DownArrow: 81, UpArrow: 82, KeypadNumLock: 83, KeypadDivide: 84, KeypadMultiply: 85, KeypadAdd: 86, KeypadSubtrace: 87, KeypadReturn: 88, Keypad1: 89, Keypad2: 90, Keypad3: 91, Keypad4: 92, Keypad5: 93, Keypad6: 94, Keypad7: 95, Keypad8: 96, Keypad9: 97, Keypad0: 98, KeypadDecimalPoint: 99, NonUsBackslash: 100, Application: 101, Power: 102, KeypadEquals: 103, F13: 104, F14: 105, F15: 106, F16: 107, F17: 108, F18: 109, F19: 110, F20: 111, F21: 112, F22: 113, F23: 114, F24: 115, Execute: 116, Help: 117, Menu: 118, Select: 119, Stop: 120, Again: 121, Undo: 122, Cut: 123, Copy: 124, Paste: 125, Find: 126, Mute: 127, VolumeUp: 128, VolumeDown: 129 } }, Modifiers: { name: "Modifiers", storage: 1, isFlags: true, members: { None: 0, LeftControl: 1, LeftShift: 2, LeftAlt: 4, LeftGUI: 8, RightControl: 16, RightShift: 32, RightAlt: 64, RightGUI: 128 } }, Action: { name: "Action", storage: 1, members: { Press: 0, Up: 1, Down: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "key", identifier: 128, description: "Presses a key or a sequence of keys down.", fields: [{ name: "selector", type: "Selector", storage: 2, startRepeats: true }, { name: "modifiers", type: "Modifiers", storage: 1 }, { name: "action", type: "Action", storage: 1 }], lowLevel: true, unique: true, packFormat: "r: u16 u8 u8" }, { kind: "command", name: "clear", identifier: 129, description: "Clears all pressed keys.", fields: [] }], tags: ["8bit"] }, { name: "HID Mouse", status: "stable", shortId: "hidmouse", camelName: "hidMouse", shortName: "hidMouse", extends: ["_base"], notes: { short: "Controls a HID mouse." }, classIdentifier: 411425820, enums: { Button: { name: "Button", storage: 2, isFlags: true, members: { Left: 1, Right: 2, Middle: 4 } }, ButtonEvent: { name: "ButtonEvent", storage: 1, members: { Up: 1, Down: 2, Click: 3, DoubleClick: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "set_button", identifier: 128, description: "Sets the up/down state of one or more buttons.\nA `Click` is the same as `Down` followed by `Up` after 100ms.\nA `DoubleClick` is two clicks with `150ms` gap between them (that is, `100ms` first click, `150ms` gap, `100ms` second click).", fields: [{ name: "buttons", type: "Button", storage: 2 }, { name: "ev", type: "ButtonEvent", storage: 1 }], unique: true, packFormat: "u16 u8" }, { kind: "command", name: "move", identifier: 129, description: "Moves the mouse by the distance specified.\nIf the time is positive, it specifies how long to make the move.", fields: [{ name: "dx", unit: "#", type: "i16", storage: -2, isSimpleType: true }, { name: "dy", unit: "#", type: "i16", storage: -2, isSimpleType: true }, { name: "time", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], unique: true, packFormat: "i16 i16 u16" }, { kind: "command", name: "wheel", identifier: 130, description: "Turns the wheel up or down. Positive if scrolling up.\nIf the time is positive, it specifies how long to make the move.", fields: [{ name: "dy", unit: "#", type: "i16", storage: -2, isSimpleType: true }, { name: "time", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], unique: true, packFormat: "i16 u16" }], tags: ["8bit"] }, { name: "Humidity", status: "stable", shortId: "humidity", camelName: "humidity", shortName: "humidity", extends: ["_base", "_sensor"], notes: { short: "A sensor measuring humidity of outside environment." }, classIdentifier: 382210232, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "humidity", identifier: 257, description: "The relative humidity in percentage of full water saturation.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], volatile: true, identifierName: "reading", preferredInterval: 5e3, packFormat: "u22.10" }, { kind: "ro", name: "humidity_error", identifier: 262, description: "The real humidity is between `humidity - humidity_error` and `humidity + humidity_error`.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_humidity", identifier: 260, description: "Lowest humidity that can be reported.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_humidity", identifier: 261, description: "Highest humidity that can be reported.", fields: [{ name: "_", unit: "%RH", shift: 10, type: "u22.10", storage: 4 }], identifierName: "max_reading", packFormat: "u22.10" }], tags: ["C", "8bit"], group: "Environment" }, { name: "I2C", status: "experimental", shortId: "i2c", camelName: "I2C", shortName: "I2C", extends: ["_base"], notes: { short: "Inter-Integrated Circuit (I2C, I\xB2C, IIC) serial communication bus lets you communicate with\nmany sensors and actuators." }, classIdentifier: 471386691, enums: { Status: { name: "Status", storage: 1, members: { OK: 0, NAckAddr: 1, NAckData: 2, NoI2C: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "ok", identifier: 384, description: "Indicates whether the I2C is working.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "command", name: "transaction", identifier: 128, description: "`address` is 7-bit.\n`num_read` can be 0 if nothing needs to be read.\nThe `write_buf` includes the register address if required (first one or two bytes).", fields: [{ name: "address", type: "u8", storage: 1, isSimpleType: true }, { name: "num_read", unit: "B", type: "u8", storage: 1, isSimpleType: true }, { name: "write_buf", type: "bytes", storage: 0, isSimpleType: true }], unique: true, hasReport: true, packFormat: "u8 u8 b" }, { kind: "report", name: "transaction", identifier: 128, description: "`address` is 7-bit.\n`num_read` can be 0 if nothing needs to be read.\nThe `write_buf` includes the register address if required (first one or two bytes).", fields: [{ name: "status", type: "Status", storage: 1 }, { name: "read_buf", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "u8 b" }], tags: ["io"] }, { name: "Illuminance", status: "rc", shortId: "illuminance", camelName: "illuminance", shortName: "illuminance", extends: ["_base", "_sensor"], notes: { short: "Detects the amount of light falling onto a given surface area.\n\nNote that this is different from _luminance_, the amount of light that passes through, emits from, or reflects off an object." }, classIdentifier: 510577394, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "illuminance", identifier: 257, description: "The amount of illuminance, as lumens per square metre.", fields: [{ name: "_", unit: "lux", shift: 10, type: "u22.10", storage: 4, typicalMax: 1e5, typicalMin: 0 }], volatile: true, identifierName: "reading", packFormat: "u22.10" }, { kind: "ro", name: "illuminance_error", identifier: 262, description: "Error on the reported sensor value.", fields: [{ name: "_", unit: "lux", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }], tags: ["8bit", "padauk"], group: "Environment" }, { name: "Indexed screen", status: "rc", shortId: "indexedscreen", camelName: "indexedScreen", shortName: "indexedScreen", extends: ["_base"], notes: { short: "A screen with indexed colors from a palette.\n\nThis is often run over an SPI connection or directly on the MCU, not regular single-wire Jacdac." }, classIdentifier: 385496805, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "start_update", identifier: 129, description: "Sets the update window for subsequent `set_pixels` commands.", fields: [{ name: "x", unit: "px", type: "u16", storage: 2, isSimpleType: true }, { name: "y", unit: "px", type: "u16", storage: 2, isSimpleType: true }, { name: "width", unit: "px", type: "u16", storage: 2, isSimpleType: true }, { name: "height", unit: "px", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16 u16 u16" }, { kind: "command", name: "set_pixels", identifier: 131, description: 'Set pixels in current window, according to current palette.\nEach "line" of data is aligned to a byte.', fields: [{ name: "pixels", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Set backlight brightness.\nIf set to `0` the display may go to sleep.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "rw", name: "palette", identifier: 128, description: "The current palette. The colors are `[r,g,b, padding]` 32bit color entries.\nThe color entry repeats `1 << bits_per_pixel` times.\nThis register may be write-only.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "const", name: "bits_per_pixel", identifier: 384, description: "Determines the number of palette entries.\nTypical values are 1 or 4.", fields: [{ name: "_", unit: "bit", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "width", identifier: 385, description: 'Screen width in "natural" orientation.', fields: [{ name: "_", unit: "px", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "height", identifier: 386, description: 'Screen height in "natural" orientation.', fields: [{ name: "_", unit: "px", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "rw", name: "width_major", identifier: 129, description: 'If true, consecutive pixels in the "width" direction are sent next to each other (this is typical for graphics cards).\nIf false, consecutive pixels in the "height" direction are sent next to each other.\nFor embedded screen controllers, this is typically true iff `width < height`\n(in other words, it\'s only true for portrait orientation screens).\nSome controllers may allow the user to change this (though the refresh order may not be optimal then).\nThis is independent of the `rotation` register.', fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "rw", name: "up_sampling", identifier: 130, description: "Every pixel sent over wire is represented by `up_sampling x up_sampling` square of physical pixels.\nSome displays may allow changing this (which will also result in changes to `width` and `height`).\nTypical values are 1 and 2.", fields: [{ name: "_", unit: "px", type: "u8", storage: 1, isSimpleType: true }], optional: true, packFormat: "u8" }, { kind: "rw", name: "rotation", identifier: 131, description: "Possible values are 0, 90, 180 and 270 only.\nWrite to this register do not affect `width` and `height` registers,\nand may be ignored by some screens.", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }], tags: ["SPI"] }, { name: "Infrastructure", status: "stable", shortId: "infrastructure", camelName: "infrastructure", shortName: "infrastructure", extends: ["_base"], notes: { short: "A service that tags a device as purely infrastructure device.\n\n\nA Jacdac user interface can hide any device that hosts this service." }, classIdentifier: 504728043, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "LED", status: "stable", shortId: "led", camelName: "led", shortName: "led", extends: ["_base"], notes: { short: "A controller for displays of individually controlled RGB LEDs.\n\nFor 64 or less LEDs, the service should support the pack the pixels in the pixels register.\nBeyond this size, the register should return an empty payload as the amount of data exceeds\nthe size of a packet. Typically services that use more than 64 LEDs\nwill run on the same MCU and will maintain the pixels buffer internally." }, classIdentifier: 369743088, enums: { Variant: { name: "Variant", storage: 1, members: { Strip: 1, Ring: 2, Stick: 3, Jewel: 4, Matrix: 5 } } }, constants: { max_pixels_length: { value: 64, hex: false } }, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "pixels", identifier: 2, description: "A buffer of 24bit RGB color entries for each LED, in R, G, B order.\nWhen writing, if the buffer is too short, the remaining pixels are set to `#000000`;\nIf the buffer is too long, the write may be ignored, or the additional pixels may be ignored.\nIf the number of pixels is greater than `max_pixels_length`, the read should return an empty payload.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], identifierName: "value", packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Set the luminosity of the strip.\nAt `0` the power to the strip is completely shut down.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 0.05 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "ro", name: "actual_brightness", identifier: 384, description: "This is the luminosity actually applied to the strip.\nMay be lower than `brightness` if power-limited by the `max_power` register.\nIt will rise slowly (few seconds) back to `brightness` is limits are no longer required.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], packFormat: "u0.8" }, { kind: "const", name: "num_pixels", identifier: 386, description: "Specifies the number of pixels in the strip.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "num_columns", identifier: 387, description: "If the LED pixel strip is a matrix, specifies the number of columns.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the light-strip (and controller).", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 200 }], optional: true, identifierName: "max_power", packFormat: "u16" }, { kind: "const", name: "leds_per_pixel", identifier: 388, description: "If known, specifies the number of LEDs in parallel on this device.\nThe actual number of LEDs is `num_pixels * leds_per_pixel`.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "const", name: "wave_length", identifier: 389, description: "If monochrome LED, specifies the wave length of the LED.\nRegister is missing for RGB LEDs.", fields: [{ name: "_", unit: "nm", type: "u16", storage: 2, isSimpleType: true, typicalMin: 365, typicalMax: 885 }], optional: true, packFormat: "u16" }, { kind: "const", name: "luminous_intensity", identifier: 390, description: "The luminous intensity of all the LEDs, at full brightness, in micro candella.", fields: [{ name: "_", unit: "mcd", type: "u16", storage: 2, isSimpleType: true, typicalMin: 10, typicalMax: 5e3 }], optional: true, packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the shape of the light strip.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [], group: "Light" }, { name: "LED Single", status: "deprecated", shortId: "ledsingle", camelName: "ledSingle", shortName: "ledSingle", extends: ["_base"], notes: { short: "A controller for 1 or more monochrome or RGB LEDs connected in parallel." }, classIdentifier: 506480888, enums: { Variant: { name: "Variant", storage: 1, members: { ThroughHole: 1, SMD: 2, Power: 3, Bead: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "animate", identifier: 128, description: "This has the same semantics as `set_status_light` in the control service.", fields: [{ name: "to_red", type: "u8", storage: 1, isSimpleType: true }, { name: "to_green", type: "u8", storage: 1, isSimpleType: true }, { name: "to_blue", type: "u8", storage: 1, isSimpleType: true }, { name: "speed", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8 u8 u8 u8" }, { kind: "ro", name: "color", identifier: 384, description: "The current color of the LED.", fields: [{ name: "red", type: "u8", storage: 1, isSimpleType: true }, { name: "green", type: "u8", storage: 1, isSimpleType: true }, { name: "blue", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8 u8 u8" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the light-strip (and controller).", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 100 }], optional: true, identifierName: "max_power", packFormat: "u16" }, { kind: "const", name: "led_count", identifier: 387, description: "If known, specifies the number of LEDs in parallel on this device.", fields: [{ name: "_", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "const", name: "wave_length", identifier: 385, description: "If monochrome LED, specifies the wave length of the LED.", fields: [{ name: "_", unit: "nm", type: "u16", storage: 2, isSimpleType: true, typicalMin: 365, typicalMax: 885 }], optional: true, packFormat: "u16" }, { kind: "const", name: "luminous_intensity", identifier: 386, description: "The luminous intensity of the LED, at full value, in micro candella.", fields: [{ name: "_", unit: "mcd", type: "u16", storage: 2, isSimpleType: true, typicalMin: 10, typicalMax: 5e3 }], optional: true, packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "The physical type of LED.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit", "padauk"], group: "Light" }, { name: "LED Strip", status: "stable", shortId: "ledstrip", camelName: "ledStrip", shortName: "ledStrip", extends: ["_base"], notes: { short: "A controller for strips of individually controlled RGB LEDs.", long: "## Light programs\n\nWith 1 mbit Jacdac, we can transmit under 2k of data per animation frame (at 20fps).\nIf transmitting raw data that would be around 500 pixels, which is not enough for many\ninstallations and it would completely clog the network.\n\nThus, light service defines a domain-specific language for describing light animations\nand efficiently transmitting them over wire. For short LED displays, less than 64 LEDs, \nyou can also use the [LED service](/services/led).\n\nLight commands are not Jacdac commands.\nLight commands are efficiently encoded as sequences of bytes and typically sent as payload\nof `run` command.\n\nDefinitions:\n\n- `P` - position in the strip\n- `R` - number of repetitions of the command\n- `N` - number of pixels affected by the command\n- `C` - single color designation\n- `C+` - sequence of color designations\n\nUpdate modes:\n\n- `0` - replace\n- `1` - add RGB\n- `2` - subtract RGB\n- `3` - multiply RGB (by c/128); each pixel value will change by at least 1\n\nProgram commands:\n\n- `0xD0: setall C+` - set all pixels in current range to given color pattern\n- `0xD1: fade C+` - set pixels in current range to colors between colors in sequence\n- `0xD2: fadehsv C+` - similar to `fade()`, but colors are specified and faded in HSV\n- `0xD3: rotfwd K` - rotate (shift) pixels by `K` positions away from the connector\n- `0xD4: rotback K` - same, but towards the connector\n- `0xD5: show M=50` - send buffer to strip and wait `M` milliseconds\n- `0xD6: range P=0 N=length W=1 S=0` - range from pixel `P`, `N` pixels long (currently unsupported: every `W` pixels skip `S` pixels)\n- `0xD7: mode K=0` - set update mode\n- `0xD8: tmpmode K=0` - set update mode for next command only\n- `0xCF: setone P C` - set one pixel at `P` (in current range) to given color\n- `mult V` - macro to multiply current range by given value (float)\n\nA number `k` is encoded as follows:\n\n- `0 <= k < 128` -> `k`\n- `128 <= k < 16383` -> `0x80 | (k >> 8), k & 0xff`\n- bigger and negative numbers are not supported\n\nThus, bytes `0xC0-0xFF` are free to use for commands.\n\nFormats:\n\n- `0xC1, R, G, B` - single color parameter\n- `0xC2, R0, G0, B0, R1, G1, B1` - two color parameter\n- `0xC3, R0, G0, B0, R1, G1, B1, R2, G2, B2` - three color parameter\n- `0xC0, N, R0, G0, B0, ..., R(N-1), G(N-1), B(N-1)` - `N` color parameter\n- `0xCF, , R, G, B` - `set1` special format\n\nCommands are encoded as command byte, followed by parameters in the order\nfrom the command definition.\n\nThe `setone()` command has irregular encoding to save space - it is byte `0xCF` followed by encoded\nnumber, and followed by 3 bytes of color." }, classIdentifier: 309264608, enums: { LightType: { name: "LightType", storage: 1, members: { WS2812B_GRB: 0, APA102: 16, SK9822: 17 } }, Variant: { name: "Variant", storage: 1, members: { Strip: 1, Ring: 2, Stick: 3, Jewel: 4, Matrix: 5 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "brightness", identifier: 1, description: "Set the luminosity of the strip.\nAt `0` the power to the strip is completely shut down.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 0.05 }], identifierName: "intensity", packFormat: "u0.8" }, { kind: "ro", name: "actual_brightness", identifier: 384, description: "This is the luminosity actually applied to the strip.\nMay be lower than `brightness` if power-limited by the `max_power` register.\nIt will rise slowly (few seconds) back to `brightness` is limits are no longer required.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], packFormat: "u0.8" }, { kind: "rw", name: "light_type", identifier: 128, description: "Specifies the type of light strip connected to controller.\nControllers which are sold with lights should default to the correct type\nand could not allow change.", fields: [{ name: "_", type: "LightType", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "num_pixels", identifier: 129, description: "Specifies the number of pixels in the strip.\nControllers which are sold with lights should default to the correct length\nand could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true, defaultValue: 15 }], packFormat: "u16" }, { kind: "rw", name: "num_columns", identifier: 131, description: "If the LED pixel strip is a matrix, specifies the number of columns. Otherwise, a square shape is assumed. Controllers which are sold with lights should default to the correct length\nand could not allow change. Increasing length at runtime leads to ineffective use of memory and may lead to controller reboot.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power drawn by the light-strip (and controller).", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 200 }], identifierName: "max_power", packFormat: "u16" }, { kind: "const", name: "max_pixels", identifier: 385, description: "The maximum supported number of pixels.\nAll writes to `num_pixels` are clamped to `max_pixels`.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "rw", name: "num_repeats", identifier: 130, description: "How many times to repeat the program passed in `run` command.\nShould be set before the `run` command.\nSetting to `0` means to repeat forever.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true, defaultValue: 1 }], packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the shape of the light strip.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "command", name: "run", identifier: 129, description: 'Run the given light "program". See service description for details.', fields: [{ name: "program", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }], tags: ["C"], group: "Light" }, { name: "Light bulb", status: "rc", shortId: "lightbulb", camelName: "lightBulb", shortName: "lightBulb", extends: ["_base"], notes: { short: "A light bulb controller." }, classIdentifier: 480970060, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "brightness", identifier: 1, description: "Indicates the brightness of the light bulb. Zero means completely off and 0xffff means completely on.\nFor non-dimmable lights, the value should be clamp to 0xffff for any non-zero value.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "intensity", packFormat: "u0.16" }, { kind: "const", name: "dimmable", identifier: 384, description: "Indicates if the light supports dimming.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: [], group: "Light" }, { name: "Light level", status: "stable", shortId: "lightlevel", camelName: "lightLevel", shortName: "lightLevel", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures luminosity level." }, classIdentifier: 400333340, enums: { Variant: { name: "Variant", storage: 1, members: { PhotoResistor: 1, ReverseBiasedLED: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "light_level", identifier: 257, description: "Detect light level", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "ro", name: "light_level_error", identifier: 262, description: "Absolute estimated error of the reading value", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit", "padauk", "input"], group: "Environment" }, { name: "Logger", status: "stable", shortId: "logger", camelName: "logger", shortName: "logger", extends: ["_base"], notes: { short: "A service which can report messages to the bus." }, classIdentifier: 316415946, enums: { Priority: { name: "Priority", storage: 1, members: { Debug: 0, Log: 1, Warning: 2, Error: 3, Silent: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "min_priority", identifier: 128, description: "Messages with level lower than this won't be emitted. The default setting may vary.\nLoggers should revert this to their default setting if the register has not been\nupdated in 3000ms, and also keep the lowest setting they have seen in the last 1500ms.\nThus, clients should write this register every 1000ms and ignore messages which are\ntoo verbose for them.", fields: [{ name: "_", type: "Priority", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "report", name: "debug", identifier: 128, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "report", name: "log", identifier: 129, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "report", name: "warn", identifier: 130, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "report", name: "error", identifier: 131, description: "Report a message.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }], tags: ["infrastructure", "C"] }, { name: "Magnetic field level", status: "stable", shortId: "magneticfieldlevel", camelName: "magneticFieldLevel", shortName: "magneticFieldLevel", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures strength and polarity of magnetic field." }, classIdentifier: 318642191, enums: { Variant: { name: "Variant", storage: 1, members: { AnalogNS: 1, AnalogN: 2, AnalogS: 3, DigitalNS: 4, DigitalN: 5, DigitalS: 6 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "strength", identifier: 257, description: "Indicates the strength of magnetic field between -1 and 1.\nWhen no magnet is present the value should be around 0.\nFor analog sensors,\nwhen the north pole of the magnet is on top of the module\nand closer than south pole, then the value should be positive.\nFor digital sensors,\nthe value should either `0` or `1`, regardless of polarity.", fields: [{ name: "_", unit: "/", shift: 15, type: "i1.15", storage: -2 }], volatile: true, identifierName: "reading", packFormat: "i1.15" }, { kind: "ro", name: "detected", identifier: 385, description: "Determines if the magnetic field is present.\nIf the event `active` is observed, `detected` is true; if `inactive` is observed, `detected` is false.", fields: [{ name: "_", type: "bool", storage: 1 }], client: true, packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Determines which magnetic poles the sensor can detected,\nand whether or not it can measure their strength or just presence.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "active", identifier: 1, description: "Emitted when strong-enough magnetic field is detected.", fields: [], identifierName: "active" }, { kind: "event", name: "inactive", identifier: 2, description: "Emitted when strong-enough magnetic field is no longer detected.", fields: [], identifierName: "inactive" }], tags: ["8bit", "padauk", "input"], group: "Environment" }, { name: "Magnetometer", status: "rc", shortId: "magnetomer", camelName: "magnetometer", shortName: "magnetometer", extends: ["_base", "_sensor"], notes: { short: "A 3-axis magnetometer." }, classIdentifier: 318935176, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "forces", identifier: 257, description: "Indicates the current magnetic field on magnetometer.\nFor reference: `1 mgauss` is `100 nT` (and `1 gauss` is `100 000 nT`).", fields: [{ name: "x", unit: "nT", type: "i32", storage: -4, isSimpleType: true }, { name: "y", unit: "nT", type: "i32", storage: -4, isSimpleType: true }, { name: "z", unit: "nT", type: "i32", storage: -4, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "i32 i32 i32" }, { kind: "ro", name: "forces_error", identifier: 262, description: "Absolute estimated error on the readings.", fields: [{ name: "_", unit: "nT", type: "i32", storage: -4, isSimpleType: true }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "i32" }, { kind: "command", name: "calibrate", identifier: 2, description: "Forces a calibration sequence where the user/device\nmight have to rotate to be calibrated.", fields: [], identifierName: "calibrate" }], tags: [] }, { name: "Matrix Keypad", status: "experimental", shortId: "matrixkeypad", camelName: "matrixKeypad", shortName: "matrixKeypad", extends: ["_base", "_sensor"], notes: { short: "A matrix of buttons connected as a keypad" }, classIdentifier: 319172040, enums: { Variant: { name: "Variant", storage: 1, members: { Membrane: 1, Keyboard: 2, Elastomer: 3, ElastomerLEDPixel: 4 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "pressed", identifier: 257, description: "The coordinate of the button currently pressed. Keys are zero-indexed from left to right, top to bottom:\n``row = index / columns``, ``column = index % columns``.", fields: [{ name: "index", type: "u8", storage: 1, isSimpleType: true, startRepeats: true }], volatile: true, identifierName: "reading", packFormat: "r: u8" }, { kind: "const", name: "rows", identifier: 384, description: "Number of rows in the matrix", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "columns", identifier: 385, description: "Number of columns in the matrix", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "labels", identifier: 386, description: "The characters printed on the keys if any, in indexing sequence.", fields: [{ name: "label", type: "string0", storage: 0, startRepeats: true }], optional: true, packFormat: "r: z" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical keypad. If the variant is ``ElastomerLEDPixel``\nand the next service on the device is a ``LEDPixel`` service, it is considered\nas the service controlling the LED pixel on the keypad.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "down", identifier: 1, description: "Emitted when a key, at the given index, goes from inactive (`pressed == 0`) to active.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], identifierName: "active", packFormat: "u8" }, { kind: "event", name: "up", identifier: 2, description: "Emitted when a key, at the given index, goes from active (`pressed == 1`) to inactive.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], identifierName: "inactive", packFormat: "u8" }, { kind: "event", name: "click", identifier: 128, description: "Emitted together with `up` when the press time was not longer than 500ms.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "event", name: "long_click", identifier: 129, description: "Emitted together with `up` when the press time was more than 500ms.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }], tags: [], group: "Button" }, { name: "Microphone", status: "experimental", shortId: "microphone", camelName: "microphone", shortName: "microphone", extends: ["_base"], notes: { short: "A single-channel microphone." }, classIdentifier: 289254534, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "sample", identifier: 129, description: "The samples will be streamed back over the `samples` pipe.\nIf `num_samples` is `0`, streaming will only stop when the pipe is closed.\nOtherwise the specified number of samples is streamed.\nSamples are sent as `i16`.", fields: [{ name: "samples", type: "pipe", storage: 12 }, { name: "num_samples", type: "u32", storage: 4, isSimpleType: true }], pipeType: "sample", packFormat: "b[12] u32" }, { kind: "rw", name: "sampling_period", identifier: 128, description: "Get or set microphone sampling period.\nSampling rate is `1_000_000 / sampling_period Hz`.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: [], group: "Sound" }, { name: "MIDI output", status: "experimental", shortId: "midioutput", camelName: "midiOutput", shortName: "midiOutput", extends: ["_base"], notes: { short: "A MIDI output device." }, classIdentifier: 444894423, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Opens or closes the port to the MIDI device", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "command", name: "clear", identifier: 128, description: "Clears any pending send data that has not yet been sent from the MIDIOutput's queue.", fields: [] }, { kind: "command", name: "send", identifier: 129, description: "Enqueues the message to be sent to the corresponding MIDI port", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }], tags: [], group: "Sound" }, { name: "Model Runner", status: "experimental", shortId: "modelrunner", camelName: "modelRunner", shortName: "modelRunner", extends: ["_base"], notes: { short: "Runs machine learning models.\n\nOnly models with a single input tensor and a single output tensor are supported at the moment.\nInput is provided by Sensor Aggregator service on the same device.\nMultiple instances of this service may be present, if more than one model format is supported by a device." }, classIdentifier: 336566904, enums: { ModelFormat: { name: "ModelFormat", storage: 4, members: { TFLite: 860636756, ML4F: 809963362, EdgeImpulseCompiled: 810961221 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "set_model", identifier: 128, description: "Open pipe for streaming in the model. The size of the model has to be declared upfront.\nThe model is streamed over regular pipe data packets.\nThe format supported by this instance of the service is specified in `format` register.\nWhen the pipe is closed, the model is written all into flash, and the device running the service may reset.", fields: [{ name: "model_size", unit: "B", type: "u32", storage: 4, isSimpleType: true }], unique: true, hasReport: true, packFormat: "u32" }, { kind: "report", name: "set_model", identifier: 128, description: "Open pipe for streaming in the model. The size of the model has to be declared upfront.\nThe model is streamed over regular pipe data packets.\nThe format supported by this instance of the service is specified in `format` register.\nWhen the pipe is closed, the model is written all into flash, and the device running the service may reset.", fields: [{ name: "model_port", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "set_model", packFormat: "u16" }, { kind: "command", name: "predict", identifier: 129, description: "Open channel that can be used to manually invoke the model. When enough data is sent over the `inputs` pipe, the model is invoked,\nand results are send over the `outputs` pipe.", fields: [{ name: "outputs", type: "pipe", storage: 12 }], pipeType: "predict", hasReport: true, packFormat: "b[12]" }, { kind: "report", name: "predict", identifier: 129, description: "Open channel that can be used to manually invoke the model. When enough data is sent over the `inputs` pipe, the model is invoked,\nand results are send over the `outputs` pipe.", fields: [{ name: "inputs", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "predict", packFormat: "u16" }, { kind: "rw", name: "auto_invoke_every", identifier: 128, description: "When register contains `N > 0`, run the model automatically every time new `N` samples are collected.\nModel may be run less often if it takes longer to run than `N * sampling_interval`.\nThe `outputs` register will stream its value after each run.\nThis register is not stored in flash.", fields: [{ name: "_", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "ro", name: "outputs", identifier: 257, description: "Results of last model invocation as `float32` array.", fields: [{ name: "output", isFloat: true, type: "f32", storage: 4, startRepeats: true }], volatile: true, identifierName: "reading", packFormat: "r: f32" }, { kind: "ro", name: "input_shape", identifier: 384, description: "The shape of the input tensor.", fields: [{ name: "dimension", type: "u16", storage: 2, isSimpleType: true, startRepeats: true }], packFormat: "r: u16" }, { kind: "ro", name: "output_shape", identifier: 385, description: "The shape of the output tensor.", fields: [{ name: "dimension", type: "u16", storage: 2, isSimpleType: true, startRepeats: true }], packFormat: "r: u16" }, { kind: "ro", name: "last_run_time", identifier: 386, description: "The time consumed in last model execution.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "allocated_arena_size", identifier: 387, description: "Number of RAM bytes allocated for model execution.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "model_size", identifier: 388, description: "The size of the model in bytes.", fields: [{ name: "_", unit: "B", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "last_error", identifier: 389, description: "Textual description of last error when running or loading model (if any).", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "const", name: "format", identifier: 390, description: "The type of ML models supported by this service.\n`TFLite` is flatbuffer `.tflite` file.\n`ML4F` is compiled machine code model for Cortex-M4F.\nThe format is typically present as first or second little endian word of model file.", fields: [{ name: "_", type: "ModelFormat", storage: 4 }], packFormat: "u32" }, { kind: "const", name: "format_version", identifier: 391, description: "A version number for the format.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "const", name: "parallel", identifier: 392, description: "If present and true this service can run models independently of other\ninstances of this service on the device.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: [] }, { name: "Motion", status: "experimental", shortId: "motion", camelName: "motion", shortName: "motion", extends: ["_base", "_sensor"], notes: { short: "A sensor, typically PIR, that detects object motion within a certain range" }, classIdentifier: 293185353, enums: { Variant: { name: "Variant", storage: 1, members: { PIR: 1 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "moving", identifier: 257, description: "Reports is movement is currently detected by the sensor.", fields: [{ name: "_", type: "bool", storage: 1 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u8" }, { kind: "const", name: "max_distance", identifier: 384, description: "Maximum distance where objects can be detected.", fields: [{ name: "_", unit: "m", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "angle", identifier: 385, description: "Opening of the field of view", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true }], optional: true, packFormat: "u16" }, { kind: "const", name: "variant", identifier: 263, description: "Type of physical sensor", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "movement", identifier: 1, description: "A movement was detected.", fields: [], identifierName: "active" }], tags: ["8bit"], group: "Movement" }, { name: "Motor", status: "rc", shortId: "motor", camelName: "motor", shortName: "motor", extends: ["_base"], notes: { short: "A DC motor." }, classIdentifier: 385895640, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "speed", identifier: 2, description: "Relative speed of the motor. Use positive/negative values to run the motor forwards and backwards.\nPositive is recommended to be clockwise rotation and negative counterclockwise. A speed of ``0`` \nwhile ``enabled`` acts as brake.", fields: [{ name: "_", unit: "/", shift: 15, type: "i1.15", storage: -2 }], identifierName: "value", packFormat: "i1.15" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn the power to the motor on/off.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "load_torque", identifier: 384, description: "Torque required to produce the rated power of an electrical motor at load speed.", fields: [{ name: "_", unit: "kg/cm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "load_rotation_speed", identifier: 385, description: "Revolutions per minute of the motor under full load.", fields: [{ name: "_", unit: "rpm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "reversible", identifier: 386, description: "Indicates if the motor can run backwards.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: ["C", "8bit"] }, { name: "Multitouch", status: "experimental", shortId: "multitouch", camelName: "multitouch", shortName: "multitouch", extends: ["_base", "_sensor"], notes: { short: "A capacitive touch sensor with multiple inputs.", events: "Most events include the channel number of the input." }, classIdentifier: 487664309, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "capacity", identifier: 257, description: "Capacitance of channels. The capacitance is continuously calibrated, and a value of `0` indicates\nno touch, wheres a value of around `100` or more indicates touch.\nIt's best to ignore this (unless debugging), and use events.\n\nDigital sensors will use `0` or `0xffff` on each channel.", fields: [{ name: "capacitance", type: "i16", storage: -2, isSimpleType: true, startRepeats: true }], volatile: true, identifierName: "reading", packFormat: "r: i16" }, { kind: "event", name: "touch", identifier: 1, description: "Emitted when an input is touched.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], identifierName: "active", packFormat: "u8" }, { kind: "event", name: "release", identifier: 2, description: "Emitted when an input is no longer touched.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], identifierName: "inactive", packFormat: "u8" }, { kind: "event", name: "tap", identifier: 128, description: "Emitted when an input is briefly touched. TODO Not implemented.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "event", name: "long_press", identifier: 129, description: "Emitted when an input is touched for longer than 500ms. TODO Not implemented.", fields: [{ name: "channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "event", name: "swipe_pos", identifier: 144, description: "Emitted when input channels are successively touched in order of increasing channel numbers.", fields: [{ name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }, { name: "start_channel", type: "u8", storage: 1, isSimpleType: true }, { name: "end_channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u16 u8 u8" }, { kind: "event", name: "swipe_neg", identifier: 145, description: "Emitted when input channels are successively touched in order of decreasing channel numbers.", fields: [{ name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }, { name: "start_channel", type: "u8", storage: 1, isSimpleType: true }, { name: "end_channel", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u16 u8 u8" }], tags: [], group: "Button" }, { name: "Planar position", status: "experimental", shortId: "planarposition", camelName: "planarPosition", shortName: "planarPosition", extends: ["_base", "_sensor"], notes: { short: "A sensor that repors 2D position, typically an optical mouse tracking sensor.\n\nThe sensor starts at an arbitrary origin (0,0) and reports the distance from that origin.\n\nThe `streaming_interval` is respected when the position is changing. When the position is not changing, the streaming interval may be throttled to `500ms`." }, classIdentifier: 499351381, enums: { Variant: { name: "Variant", storage: 1, members: { OpticalMousePosition: 1 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: "The current position of the sensor.", fields: [{ name: "x", unit: "mm", shift: 10, type: "i22.10", storage: -4 }, { name: "y", unit: "mm", shift: 10, type: "i22.10", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i22.10 i22.10" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [], group: "Movement" }, { name: "Potentiometer", status: "stable", shortId: "potentiometer", camelName: "potentiometer", shortName: "potentiometer", extends: ["_base", "_sensor"], notes: { short: "A slider or rotary potentiometer." }, classIdentifier: 522667846, enums: { Variant: { name: "Variant", storage: 1, members: { Slider: 1, Rotary: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: "The relative position of the slider.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the physical layout of the potentiometer.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["C", "8bit", "input"], group: "Slider" }, { name: "Power", status: "experimental", shortId: "power", camelName: "power", shortName: "power", extends: ["_base"], notes: { short: "A power-provider service.", long: "## Power negotiation protocol\n\nThe purpose of the power negotiation is to ensure that there is no more than [Iout_hc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) delivered to the power rail.\nThis is realized by limiting the number of enabled power provider services to one.\n\nNote, that it's also possible to have low-current power providers,\nwhich are limited to [Iout_lc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) and do not run a power provider service.\nThese are **not** accounted for in the power negotiation protocol.\n\nPower providers can have multiple _channels_, typically multiple Jacdac ports on the provider.\nEach channel can be limited to [Iout_hc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) separately.\nIn normal operation, the data lines of each channels are connected together.\nThe ground lines are always connected together.\nMulti-channel power providers are also called _powered hubs_.\n\nWhile channels have separate current limits, there's nothing to prevent the user\nfrom joining two or more channels outside of the provider using a passive hub.\nThis would allow more than [Iout_hc(max)](https://microsoft.github.io/jacdac-docs/reference/electrical-spec/#power-providers) of current to be drawn, resulting in cables or components\ngetting hot and/or malfunctioning.\nThus, the power negotiation protocol seeks to detect situations where\nmultiple channels of power provider(s) are bridged together\nand shut down all but one of the channels involved.\n\nThe protocol is built around the power providers periodically sending specially crafted\n`shutdown` commands in broadcast mode.\nNote that this is unusual - services typically only send reports.\n\nThe `shutdown` commands can be reliably identified based on their first half (more details below).\nWhen a power provider starts receiving a `shutdown` command, it needs to take\nsteps to identify which of its channels the command is coming from.\nThis is typically realized with analog switches between the data lines of channels.\nThe delivery of power over the channel which received the `shutdown` command is then shut down.\nNote that in the case of a single-channel provider, any received `shutdown` command will cause a shut down.\n\nA multi-channel provider needs to also identify when a `shutdown` command it sent from one channel\nis received on any of its other channels and shut down one of the channels involved.\n\nIt is also possible to build a _data bridge_ device, with two or more ports.\nIt passes through all data except for `shutdown` commands,\nbut **does not** connect the power lines.\n\n### Protocol details\n\nThe `shutdown` commands follow a very narrow format:\n* they need to be the only packet in the frame (and thus we can also call them `shutdown` frames)\n* the second word of `device_id` needs to be set to `0xAA_AA_AA_AA` (alternating 0 and 1)\n* the service index is set to `0x3d`\n* the CRC is therefore fixed\n* therefore, the packet can be recognized by reading the first 8 bytes (total length is 16 bytes)\n\nThe exact byte structure of `shutdown` command is:\n`15 59 04 05 5A C9 A4 1F AA AA AA AA 00 3D 80 00`\n\nThere is one power service per channel.\nA multi-channel power provider can be implemented as one device with multiple services (typically with one MCU),\nor many devices with one service each (typically multiple MCUs).\nThe first option is preferred as it fixes the order of channels,\nbut the second option may be cheaper to implement.\n\nAfter queuing a `shutdown` command, the service enters a grace period\nuntil the report has been sent on the wire.\nDuring the grace period incoming `shutdown` commands are ignored.\n\n* Upon reset, a power service enables itself, and then only after 0-300ms (random)\n sends the first `shutdown` command\n* Every enabled power service emits `shutdown` commands every 400-600ms (random; first few packets can be even sent more often)\n* If an enabled power service sees a `shutdown` command from somebody else,\n it disables itself (unless in grace period)\n* If a disabled power service sees no `shutdown` command for more than ~1200ms, it enables itself\n (this is when the previous power source is unplugged or otherwise malfunctions)\n* If a power service has been disabled for around 10s, it enables itself.\n\nAdditionally:\n* While the `allowed` register is set to `0`, the service will not enable itself (nor send `shutdown` commands)\n* When a current overdraw is detected, the service stop providing power and enters `Overload` state for around 2 seconds,\n while still sending `shutdown` commands.\n\n### Client notes\n\nIf a client hears a `shutdown` command it just means it's on a branch of the\nnetwork with a (high) power provider.\nAs clients (brains) typically do not consume much current (as opposed to, say, servos),\nthe `shutdown` commands are typically irrelevant to them.\n\nFor power monitoring, the `power_status_changed` event (and possibly `power_status` register)\ncan be used.\nIn particular, user interfaces may alert the user to `Overload` status.\nThe `Overprovision` status is generally considered normal (eg. when two multi-channel power providers are linked together).\n\n### Server implementation notes\n\n#### A dedicated MCU per channel\n\nEvery channel has:\n* a cheap 8-bit MCU (e.g. PMS150C, PFS122),\n* a current limiter with FAULT output and ENABLE input, and\n* an analog switch.\n\nThe MCU here needs at least 4 pins per channel.\nIt is connected to data line of the channel, the control input of the switch, and to the current limiter's FAULT and ENABLE pins.\n\nThe switch connects the data line of the channel (JD_DATA_CHx) with the internal shared data bus, common to all channels (JD_DATA_COM).\nBoth the switch and the limiter are controlled by the MCU.\nA latching circuit is not needed for the limiter because the MCU will detect an overcurrent fault and shut it down immediately. \n\nDuring reception, after the beginning of `shutdown` frame is detected,\nthe switch is opened for a brief period.\nIf the `shutdown` frame is received correctly, it means it was on MCU's channel.\n\nIn the case of only one power delivery channel that's controlled by a dedicated MCU, the analog switch is not necessary. \n\n#### A shared MCU for multiple channels\n\nEvery channel has:\n* a current limiter with FAULT output and ENABLE input, \n* an analog switch, and\n* a wiggle-detection line connecting the MCU to data line of the channel\n\nThe MCU again needs at least 4 pins per channel.\nSwitches and limiters are set up like in the configuration above.\nThe Jacdac data line of the MCU is connected to internal data bus.\n\nWhile a Jacdac packet is being received, the MCU keeps checking if it is a \nbeginning of the `shutdown` frame.\nIf that is the case, it opens all switches and checks which one(s) of the channel\ndata lines wiggle (via the wiggle lines; this can be done with EXTI latches).\nThe one(s) that wiggle received the `shutdown` frame and need to be disabled.\n\nAlso, while sending the `shutdown` frames itself, it needs to be done separately\nfor each channel, with all the other switches open.\nIf during that operation we detect wiggle on other channels, then we have detected\na loop, and the respective channels needs to be disabled.\n\n#### A brain-integrated power supply\n\nHere, there's only one channel of power and we don't have hard real time requirements,\nso user-programmable brain can control it.\nThere is no need for analog switch or wiggle-detection line,\nbut a current limiter with a latching circuit is needed.\n\nThere is nothing special to do during reception of `shutdown` packet.\nWhen it is received, the current limiter should just be disabled.\n\nIdeally, exception/hard-fault handlers on the MCU should also disable the current limiter.\nSimilarly, the limiter should be disabled while the MCU is in bootloader mode,\nor otherwise unaware of the power negotiation protocol. \n\n### Rationale for the grace period\n\nConsider the following scenario:\n\n* device A queues `shutdown` command for sending\n* A receives external `shutdown` packet from B (thus disabling A)\n* the A `shutdown` command is sent from the queue (thus eventually disabling B)\n\nTo avoid that, we make sure that at the precise instant when `shutdown` command is sent,\nthe power is enabled (and thus will stay enabled until another `shutdown` command arrives).\nThis could be achieved by inspecting the enable bit, aftering acquiring the line\nand before starting UART transmission, however that would require breaking abstraction layers.\nSo instead, we never disable the service, while the `shutdown` packet is queued.\nThis may lead to delays in disabling power services, but these should be limited due to the\nrandom nature of the `shutdown` packet spacing.\n\n### Rationale for timings\n\nThe initial 0-300ms delay is set to spread out the `shutdown` periods of power services,\nto minimize collisions.\nThe `shutdown` periods are randomized 400-600ms, instead of a fixed 500ms used for regular\nservices, for the same reason.\n\nThe 1200ms period is set so that droping two `shutdown` packets in a row\nfrom the current provider will not cause power switch, while missing 3 will.\n\nThe 50-60s power switch period is arbitrary, but chosen to limit amount of switching between supplies,\nwhile keeping it short enough for user to notice any problems such switching may cause." }, classIdentifier: 530893146, enums: { PowerStatus: { name: "PowerStatus", storage: 1, members: { Disallowed: 0, Powering: 1, Overload: 2, Overprovision: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "allowed", identifier: 1, description: "Can be used to completely disable the service.\nWhen allowed, the service may still not be providing power, see \n`power_status` for the actual current state.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "max_power", identifier: 7, description: "Limit the power provided by the service. The actual maximum limit will depend on hardware.\nThis field may be read-only in some implementations - you should read it back after setting.", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true, defaultValue: 900, typicalMax: 900, typicalMin: 0 }], optional: true, identifierName: "max_power", packFormat: "u16" }, { kind: "ro", name: "power_status", identifier: 385, description: "Indicates whether the power provider is currently providing power (`Powering` state), and if not, why not.\n`Overprovision` means there was another power provider, and we stopped not to overprovision the bus.", fields: [{ name: "_", type: "PowerStatus", storage: 1 }], volatile: true, packFormat: "u8" }, { kind: "ro", name: "current_draw", identifier: 257, description: "Present current draw from the bus.", fields: [{ name: "_", unit: "mA", type: "u16", storage: 2, isSimpleType: true }], volatile: true, optional: true, identifierName: "reading", packFormat: "u16" }, { kind: "ro", name: "battery_voltage", identifier: 384, description: "Voltage on input.", fields: [{ name: "_", unit: "mV", type: "u16", storage: 2, isSimpleType: true, typicalMin: 4500, typicalMax: 5500 }], volatile: true, optional: true, packFormat: "u16" }, { kind: "ro", name: "battery_charge", identifier: 386, description: "Fraction of charge in the battery.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, packFormat: "u0.16" }, { kind: "const", name: "battery_capacity", identifier: 387, description: "Energy that can be delivered to the bus when battery is fully charged.\nThis excludes conversion overheads if any.", fields: [{ name: "_", unit: "mWh", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }, { kind: "rw", name: "keep_on_pulse_duration", identifier: 128, description: "Many USB power packs need current to be drawn from time to time to prevent shutdown.\nThis regulates how often and for how long such current is drawn.\nTypically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%.", fields: [{ name: "_", unit: "ms", type: "u16", storage: 2, isSimpleType: true, defaultValue: 600 }], optional: true, packFormat: "u16" }, { kind: "rw", name: "keep_on_pulse_period", identifier: 129, description: "Many USB power packs need current to be drawn from time to time to prevent shutdown.\nThis regulates how often and for how long such current is drawn.\nTypically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%.", fields: [{ name: "_", unit: "ms", type: "u16", storage: 2, isSimpleType: true, defaultValue: 2e4 }], optional: true, packFormat: "u16" }, { kind: "command", name: "shutdown", identifier: 128, description: "Sent by the power service periodically, as broadcast.", fields: [] }, { kind: "event", name: "power_status_changed", identifier: 3, description: "Emitted whenever `power_status` changes.", fields: [{ name: "power_status", type: "PowerStatus", storage: 1 }], identifierName: "change", packFormat: "u8" }], tags: [] }, { name: "Power supply", status: "experimental", shortId: "powersupply", camelName: "powerSupply", shortName: "powerSupply", extends: ["_base"], notes: { short: "A power supply with a fixed or variable voltage range" }, classIdentifier: 524302175, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns the power supply on with `true`, off with `false`.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "output_voltage", identifier: 2, description: "The current output voltage of the power supply. Values provided must be in the range `minimum_voltage` to `maximum_voltage`", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], identifierName: "value", packFormat: "f64" }, { kind: "const", name: "minimum_voltage", identifier: 272, description: "The minimum output voltage of the power supply. For fixed power supplies, `minimum_voltage` should be equal to `maximum_voltage`.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], identifierName: "min_value", packFormat: "f64" }, { kind: "const", name: "maximum_voltage", identifier: 273, description: "The maximum output voltage of the power supply. For fixed power supplies, `minimum_voltage` should be equal to `maximum_voltage`.", fields: [{ name: "_", unit: "V", isFloat: true, type: "f64", storage: 8 }], identifierName: "max_value", packFormat: "f64" }], tags: [] }, { name: "Pressure Button", status: "rc", shortId: "pressurebutton", camelName: "pressureButton", shortName: "pressureButton", extends: ["_base"], notes: { short: "A pressure sensitive push-button." }, classIdentifier: 672612547, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "threshold", identifier: 6, description: "Indicates the threshold for ``up`` events.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "active_threshold", packFormat: "u0.16" }], tags: ["8bit"], group: "Button" }, { name: "Protocol Test", status: "experimental", shortId: "prototest", camelName: "protoTest", shortName: "protoTest", extends: ["_base"], notes: { short: "This is test service to validate the protocol packet transmissions between the browser and a MCU.\nUse this page if you are porting Jacdac to a new platform.", long: "### Test procedure\n\nFor each ``rw`` registers, set a random value ``x``\n * read ``rw`` and check value is equal to ``x``\n * read ``ro`` and check value is equal to ``x``\n * listen to ``e`` event and check that data is equal to ``x``\n * call ``c`` command with new random value ``y``\n * read ``rw`` and check value is equal to ``y``\n * do all the above steps with acks\n\nFor each ``rw`` registers, there shall also\nbe an ``event`` and a ``command``. The event\nshould get raised when the value changes;\nand the command should set the value.", registers: "Every ``rw`` register has a corresponding ``ro`` regisrer\nand a corresponding ``set_...`` command to also set the value." }, classIdentifier: 382158442, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "rw_bool", identifier: 129, description: "A read write bool register.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "ro_bool", identifier: 385, description: "A read only bool register. Mirrors rw_bool.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "rw_u32", identifier: 130, description: "A read write u32 register.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "ro_u32", identifier: 386, description: "A read only u32 register.. Mirrors rw_u32.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "rw", name: "rw_i32", identifier: 131, description: "A read write i32 register.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "ro", name: "ro_i32", identifier: 387, description: "A read only i32 register.. Mirrors rw_i32.", fields: [{ name: "_", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "rw", name: "rw_string", identifier: 132, description: "A read write string register.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "ro", name: "ro_string", identifier: 388, description: "A read only string register. Mirrors rw_string.", fields: [{ name: "_", type: "string", storage: 0 }], packFormat: "s" }, { kind: "rw", name: "rw_bytes", identifier: 133, description: "A read write string register.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "ro", name: "ro_bytes", identifier: 389, description: "A read only string register. Mirrors ro_bytes.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "rw", name: "rw_i8_u8_u16_i32", identifier: 134, description: "A read write i8, u8, u16, i32 register.", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "ro", name: "ro_i8_u8_u16_i32", identifier: 390, description: "A read only i8, u8, u16, i32 register.. Mirrors rw_i8_u8_u16_i32.", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "rw", name: "rw_u8_string", identifier: 135, description: "A read write u8, string register.", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "ro", name: "ro_u8_string", identifier: 391, description: "A read only u8, string register.. Mirrors rw_u8_string.", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "event", name: "e_bool", identifier: 129, description: "An event raised when rw_bool is modified", fields: [{ name: "bo", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "event", name: "e_u32", identifier: 130, description: "An event raised when rw_u32 is modified", fields: [{ name: "u32", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "event", name: "e_i32", identifier: 131, description: "An event raised when rw_i32 is modified", fields: [{ name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "event", name: "e_string", identifier: 132, description: "An event raised when rw_string is modified", fields: [{ name: "str", type: "string", storage: 0 }], packFormat: "s" }, { kind: "event", name: "e_bytes", identifier: 133, description: "An event raised when rw_bytes is modified", fields: [{ name: "bytes", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "event", name: "e_i8_u8_u16_i32", identifier: 134, description: "An event raised when rw_i8_u8_u16_i32 is modified", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "event", name: "e_u8_string", identifier: 135, description: "An event raised when rw_u8_string is modified", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "command", name: "c_bool", identifier: 129, description: "A command to set rw_bool.", fields: [{ name: "bo", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "command", name: "c_u32", identifier: 130, description: "A command to set rw_u32.", fields: [{ name: "u32", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "command", name: "c_i32", identifier: 131, description: "A command to set rw_i32.", fields: [{ name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i32" }, { kind: "command", name: "c_string", identifier: 132, description: "A command to set rw_string.", fields: [{ name: "str", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "c_bytes", identifier: 133, description: "A command to set rw_string.", fields: [{ name: "bytes", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "command", name: "c_i8_u8_u16_i32", identifier: 134, description: "A command to set rw_bytes.", fields: [{ name: "i8", type: "i8", storage: -1, isSimpleType: true }, { name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "u16", type: "u16", storage: 2, isSimpleType: true }, { name: "i32", type: "i32", storage: -4, isSimpleType: true }], packFormat: "i8 u8 u16 i32" }, { kind: "command", name: "c_u8_string", identifier: 135, description: "A command to set rw_u8_string.", fields: [{ name: "u8", type: "u8", storage: 1, isSimpleType: true }, { name: "str", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "command", name: "c_report_pipe", identifier: 144, description: "A command to read the content of rw_bytes, byte per byte, as a pipe.", fields: [{ name: "p_bytes", type: "pipe", storage: 12 }], pipeType: "c_report_pipe", packFormat: "b[12]" }, { kind: "pipe_report", name: "p_bytes", identifier: 0, description: "A command to read the content of rw_bytes, byte per byte, as a pipe.", fields: [{ name: "byte", type: "u8", storage: 1, isSimpleType: true }], pipeType: "c_report_pipe", packFormat: "u8" }], tags: ["infrastructure"] }, { name: "Proxy", status: "stable", shortId: "proxy", camelName: "proxy", shortName: "proxy", extends: ["_base"], notes: { short: "A service that tags a device as a packet proxy.\nA device in proxy mode will proxy Jacdac packets and typically has its core logic halted." }, classIdentifier: 384932169, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "Pulse Oximeter", status: "experimental", shortId: "pulseoximeter", camelName: "pulseOximeter", shortName: "pulseOximeter", extends: ["_base", "_sensor"], notes: { short: "A sensor approximating the oxygen level.\n\n**Jacdac is not suitable for medical devices and should NOT be used in any kind of device to diagnose or treat any medical conditions.**" }, classIdentifier: 280710838, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "oxygen", identifier: 257, description: "The estimated oxygen level in blood.", fields: [{ name: "_", unit: "%", shift: 8, type: "u8.8", storage: 2, typicalMin: 80, typicalMax: 100 }], volatile: true, identifierName: "reading", packFormat: "u8.8" }, { kind: "ro", name: "oxygen_error", identifier: 262, description: "The estimated error on the reported sensor data.", fields: [{ name: "_", unit: "%", shift: 8, type: "u8.8", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u8.8" }], tags: ["8bit"], group: "Biometric" }, { name: "Rain gauge", status: "rc", shortId: "raingauge", camelName: "rainGauge", shortName: "rainGauge", extends: ["_base", "_sensor"], notes: { short: "Measures the amount of liquid precipitation over an area in a predefined period of time." }, classIdentifier: 326323349, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "precipitation", identifier: 257, description: "Total precipitation recorded so far.", fields: [{ name: "_", unit: "mm", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", preferredInterval: 6e4, packFormat: "u16.16" }, { kind: "const", name: "precipitation_precision", identifier: 264, description: "Typically the amount of rain needed for tipping the bucket.", fields: [{ name: "_", unit: "mm", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "reading_resolution", packFormat: "u16.16" }], tags: ["8bit"], group: "Environment" }, { name: "Real time clock", status: "rc", shortId: "realtimeclock", camelName: "realTimeClock", shortName: "realTimeClock", extends: ["_base", "_sensor"], notes: { short: "Real time clock to support collecting data with precise time stamps." }, classIdentifier: 445323816, enums: { Variant: { name: "Variant", storage: 1, members: { Computer: 1, Crystal: 2, Cuckoo: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "local_time", identifier: 257, description: "Current time in 24h representation.\n\n- `day_of_month` is day of the month, starting at `1`\n- `day_of_week` is day of the week, starting at `1` as monday. Default streaming period is 1 second.", fields: [{ name: "year", type: "u16", storage: 2, isSimpleType: true }, { name: "month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 12 }, { name: "day_of_month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 31 }, { name: "day_of_week", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 7 }, { name: "hour", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 23 }, { name: "min", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 59 }, { name: "sec", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 60 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16 u8 u8 u8 u8 u8 u8" }, { kind: "ro", name: "drift", identifier: 384, description: "Time drift since the last call to the `set_time` command.", fields: [{ name: "_", unit: "s", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, packFormat: "u16.16" }, { kind: "const", name: "precision", identifier: 385, description: "Error on the clock, in parts per million of seconds.", fields: [{ name: "_", unit: "ppm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical clock used by the sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "command", name: "set_time", identifier: 128, description: "Sets the current time and resets the error.", fields: [{ name: "year", type: "u16", storage: 2, isSimpleType: true }, { name: "month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 12 }, { name: "day_of_month", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 31 }, { name: "day_of_week", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 1, absoluteMax: 7 }, { name: "hour", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 23 }, { name: "min", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 59 }, { name: "sec", type: "u8", storage: 1, isSimpleType: true, absoluteMin: 0, absoluteMax: 60 }], packFormat: "u16 u8 u8 u8 u8 u8 u8" }], tags: ["8bit"] }, { name: "Reflected light", status: "rc", shortId: "reflectedlight", camelName: "reflectedLight", shortName: "reflectedLight", extends: ["_base", "_sensor"], notes: { short: "A sensor that detects light and dark surfaces, commonly used for line following robots." }, classIdentifier: 309087410, enums: { Variant: { name: "Variant", storage: 1, members: { InfraredDigital: 1, InfraredAnalog: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "brightness", identifier: 257, description: "Reports the reflected brightness. It may be a digital value or, for some sensor, analog value.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Type of physical sensor used", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Relay", status: "stable", shortId: "relay", camelName: "relay", shortName: "relay", extends: ["_base"], notes: { short: "A switching relay.\n\nThe contacts should be labelled `NO` (normally open), `COM` (common), and `NC` (normally closed).\nWhen relay is energized it connects `NO` and `COM`.\nWhen relay is not energized it connects `NC` and `COM`.\nSome relays may be missing `NO` or `NC` contacts.\nWhen relay module is not powered, or is in bootloader mode, it is not energized (connects `NC` and `COM`)." }, classIdentifier: 406840918, enums: { Variant: { name: "Variant", storage: 1, members: { Electromechanical: 1, SolidState: 2, Reed: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "active", identifier: 1, description: "Indicates whether the relay circuit is currently energized or not.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of relay used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "const", name: "max_switching_current", identifier: 384, description: "Maximum switching current for a resistive load.", fields: [{ name: "_", unit: "mA", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }], tags: ["8bit"] }, { name: "Random Number Generator", status: "rc", shortId: "rng", camelName: "rng", shortName: "rng", extends: ["_base"], notes: { short: "Generates random numbers using entropy sourced from physical processes.\n\nThis typically uses a cryptographical pseudo-random number generator (for example [Fortuna]()),\nwhich is periodically re-seeded with entropy coming from some hardware source." }, classIdentifier: 394916002, enums: { Variant: { name: "Variant", storage: 1, members: { Quantum: 1, ADCNoise: 2, WebCrypto: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "random", identifier: 384, description: "A register that returns a 64 bytes random buffer on every request.\nThis never blocks for a long time. If you need additional random bytes, keep querying the register.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, packFormat: "b" }, { kind: "const", name: "variant", identifier: 263, description: "The type of algorithm/technique used to generate the number.\n`Quantum` refers to dedicated hardware device generating random noise due to quantum effects.\n`ADCNoise` is the noise from quick readings of analog-digital converter, which reads temperature of the MCU or some floating pin.\n`WebCrypto` refers is used in simulators, where the source of randomness comes from an advanced operating system.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: [] }, { name: "Role Manager", status: "experimental", shortId: "rolemanager", camelName: "roleManager", shortName: "roleManager", extends: ["_base"], notes: { short: "Assign roles to services on the Jacdac bus.", long: "## Role allocation\n\nInternally, the role manager stores a mapping from role name to `(device_id, service_idx)`.\nUsers refer to services by using role names (eg., they instantiate an accelerometer client with a given role name).\nEach client has a role, and roles are unique to clients\n(ie., one should not have both a gyro and accelerometer service with role `left_leg`).\n\nThe simplest recommended automatic role assignment algorithm is as follows:\n\n```text\nroles.sort(strcmp() on UTF-8 representation of role name)\ndevices.sort(by device identifier (lexicographic on 8 byte string))\nmove self device to beginning of devices list\nfor every role\n if role is not assigned\n for every device\n for every service on device\n if serviceClass matches role\n if service is not assigned to any role\n assign service to role\n```\n\nDue to sorting, role names sharing a prefix will tend to be co-located on the single device.\nFor example, one can have roles `left_leg_acc`, `left_leg_gyro`, `right_leg_acc`, `right_leg_gyro`,\nand assuming combined gyro+accelerometer sensors, the pairs will tend to be allocated to a single leg,\nhowever the legs may be reversed.\nIn such a case the user can swap the physical sensors (note that left leg will always be assigned to\nsensor with smaller device identifier).\nAlternatively, the user can manually modify assignment using `set_role` command." }, classIdentifier: 508264038, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "auto_bind", identifier: 128, description: 'Normally, if some roles are unfilled, and there are idle services that can fulfill them,\nthe brain device will assign roles (bind) automatically.\nSuch automatic assignment happens every second or so, and is trying to be smart about\nco-locating roles that share "host" (part before first slash),\nas well as reasonably stable assignments.\nOnce user start assigning roles manually using this service, auto-binding should be disabled to avoid confusion.', fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "ro", name: "all_roles_allocated", identifier: 385, description: "Indicates if all required roles have been allocated to devices.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "command", name: "set_role", identifier: 129, description: "Set role. Can set to empty to remove role binding.", fields: [{ name: "device_id", type: "devid", storage: 8 }, { name: "service_idx", type: "u8", storage: 1, isSimpleType: true }, { name: "role", type: "string", storage: 0 }], packFormat: "b[8] u8 s" }, { kind: "command", name: "clear_all_roles", identifier: 132, description: "Remove all role bindings.", fields: [] }, { kind: "command", name: "list_roles", identifier: 131, description: "List all roles and bindings required by the current program. `device_id` and `service_idx` are `0` if role is unbound.", fields: [{ name: "roles", type: "pipe", storage: 12 }], pipeType: "list_roles", packFormat: "b[12]" }, { kind: "pipe_report", name: "roles", identifier: 0, description: "List all roles and bindings required by the current program. `device_id` and `service_idx` are `0` if role is unbound.", fields: [{ name: "device_id", type: "devid", storage: 8 }, { name: "service_class", type: "u32", storage: 4, isSimpleType: true }, { name: "service_idx", type: "u8", storage: 1, isSimpleType: true }, { name: "role", type: "string", storage: 0 }], pipeType: "list_roles", packFormat: "b[8] u32 u8 s" }, { kind: "event", name: "change", identifier: 3, description: "Notifies that role bindings have changed.", fields: [], identifierName: "change" }], tags: ["infrastructure"] }, { name: "ROS", status: "experimental", shortId: "ros", camelName: "ros", shortName: "ros", extends: ["_base"], notes: { short: "A ROS (Robot Operating System https://www.ros.org/) controller that can act as a broker for messages." }, classIdentifier: 354743340, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "publish_message", identifier: 129, description: "Publishes a JSON-encoded message to the given topic.", fields: [{ name: "node", type: "string0", storage: 0 }, { name: "topic", type: "string0", storage: 0 }, { name: "message", type: "string", storage: 0 }], packFormat: "z z s" }, { kind: "command", name: "subscribe_message", identifier: 130, description: "Subscribes to a message topic. Subscribed topics will emit message reports.", fields: [{ name: "node", type: "string0", storage: 0 }, { name: "topic", type: "string", storage: 0 }], packFormat: "z s" }, { kind: "report", name: "message", identifier: 131, description: "A message published on the bus. Message is JSON encoded.", fields: [{ name: "node", type: "string0", storage: 0 }, { name: "topic", type: "string0", storage: 0 }, { name: "message", type: "string", storage: 0 }], packFormat: "z z s" }], tags: ["robotics"] }, { name: "Rotary encoder", status: "stable", shortId: "rotaryencoder", camelName: "rotaryEncoder", shortName: "rotaryEncoder", extends: ["_base", "_sensor"], notes: { short: "An incremental rotary encoder - converts angular motion of a shaft to digital signal." }, classIdentifier: 284830153, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: 'Upon device reset starts at `0` (regardless of the shaft position).\nIncreases by `1` for a clockwise "click", by `-1` for counter-clockwise.', fields: [{ name: "_", unit: "#", type: "i32", storage: -4, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "i32" }, { kind: "const", name: "clicks_per_turn", identifier: 384, description: "This specifies by how much `position` changes when the crank does 360 degree turn. Typically 12 or 24.", fields: [{ name: "_", unit: "#", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "const", name: "clicker", identifier: 385, description: "The encoder is combined with a clicker. If this is the case, the clicker button service\nshould follow this service in the service list of the device.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }], tags: ["C", "8bit", "input"], group: "Slider" }, { name: "Rover", status: "experimental", shortId: "rover", camelName: "rover", shortName: "rover", extends: ["_base", "_sensor"], notes: { short: "A roving robot." }, classIdentifier: 435474539, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "kinematics", identifier: 257, description: "The current position and orientation of the robot.", fields: [{ name: "x", unit: "cm", shift: 16, type: "i16.16", storage: -4 }, { name: "y", unit: "cm", shift: 16, type: "i16.16", storage: -4 }, { name: "vx", unit: "cm/s", shift: 16, type: "i16.16", storage: -4 }, { name: "vy", unit: "cm/s", shift: 16, type: "i16.16", storage: -4 }, { name: "heading", unit: "\xB0", shift: 16, type: "i16.16", storage: -4 }], volatile: true, identifierName: "reading", packFormat: "i16.16 i16.16 i16.16 i16.16 i16.16" }], tags: [] }, { name: "Satellite Navigation System", status: "experimental", shortId: "satelittenavigationsystem", camelName: "satNav", shortName: "satNav", extends: ["_base", "_sensor"], notes: { short: "A satellite-based navigation system like GPS, Gallileo, ..." }, classIdentifier: 433938742, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "position", identifier: 257, description: "Reported coordinates, geometric altitude and time of position. Altitude accuracy is 0 if not available.", fields: [{ name: "timestamp", unit: "ms", type: "u64", storage: 8, isSimpleType: true }, { name: "latitude", unit: "lat", shift: 23, type: "i9.23", storage: -4, absoluteMin: -90, absoluteMax: 90 }, { name: "longitude", unit: "lon", shift: 23, type: "i9.23", storage: -4, absoluteMin: -180, absoluteMax: 180 }, { name: "accuracy", unit: "m", shift: 16, type: "u16.16", storage: 4 }, { name: "altitude", unit: "m", shift: 6, type: "i26.6", storage: -4 }, { name: "altitudeAccuracy", unit: "m", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", packFormat: "u64 i9.23 i9.23 u16.16 i26.6 u16.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Enables or disables the GPS module", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "event", name: "inactive", identifier: 2, description: "The module is disabled or lost connection with satellites.", fields: [], identifierName: "inactive" }], tags: [] }, { name: "Sensor Aggregator", status: "experimental", shortId: "sensoraggregator", camelName: "sensorAggregator", shortName: "sensorAggregator", extends: ["_base"], notes: { short: "Aggregate data from multiple sensors into a single stream\n(often used as input to machine learning models on the same device, see model runner service)." }, classIdentifier: 496034245, enums: { SampleType: { name: "SampleType", storage: 1, members: { U8: 8, I8: 136, U16: 16, I16: 144, U32: 32, I32: 160 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "inputs", identifier: 128, description: "Set automatic input collection.\nThese settings are stored in flash.", fields: [{ name: "sampling_interval", unit: "ms", type: "u16", storage: 2, isSimpleType: true }, { name: "samples_in_window", type: "u16", storage: 2, isSimpleType: true }, { name: "reserved", type: "u32", storage: 4, isSimpleType: true }, { name: "device_id", type: "devid", storage: 8, startRepeats: true }, { name: "service_class", type: "u32", storage: 4, isSimpleType: true }, { name: "service_num", type: "u8", storage: 1, isSimpleType: true }, { name: "sample_size", unit: "B", type: "u8", storage: 1, isSimpleType: true }, { name: "sample_type", type: "SampleType", storage: 1 }, { name: "sample_shift", type: "i8", storage: -1, isSimpleType: true }], packFormat: "u16 u16 u32 r: b[8] u32 u8 u8 u8 i8" }, { kind: "ro", name: "num_samples", identifier: 384, description: "Number of input samples collected so far.", fields: [{ name: "_", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "sample_size", identifier: 385, description: "Size of a single sample.", fields: [{ name: "_", unit: "B", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "rw", name: "streaming_samples", identifier: 129, description: "When set to `N`, will stream `N` samples as `current_sample` reading.", fields: [{ name: "_", unit: "#", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }, { kind: "ro", name: "current_sample", identifier: 257, description: "Last collected sample.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "b" }], tags: [] }, { name: "Serial", status: "experimental", shortId: "serial", camelName: "serial", shortName: "serial", extends: ["_base"], notes: { short: "An asynchronous serial communication service capable of sending and receiving buffers of data.\nSettings default to 115200 baud 8N1." }, classIdentifier: 297461188, enums: { ParityType: { name: "ParityType", storage: 1, members: { None: 0, Even: 1, Odd: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "connected", identifier: 1, description: "Indicates if the serial connection is active.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "ro", name: "connection_name", identifier: 385, description: "User-friendly name of the connection.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "rw", name: "baud_rate", identifier: 128, description: "A positive, non-zero value indicating the baud rate at which serial communication is be established.", fields: [{ name: "_", unit: "baud", type: "u32", storage: 4, isSimpleType: true, defaultValue: 115200 }], packFormat: "u32" }, { kind: "rw", name: "data_bits", identifier: 129, description: "The number of data bits per frame. Either 7 or 8.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 8, absoluteMin: 7, absoluteMax: 8 }], packFormat: "u8" }, { kind: "rw", name: "stop_bits", identifier: 130, description: "The number of stop bits at the end of a frame. Either 1 or 2.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true, defaultValue: 1, absoluteMin: 1, absoluteMax: 2 }], packFormat: "u8" }, { kind: "rw", name: "parity_mode", identifier: 131, description: "The parity mode.", fields: [{ name: "_", type: "ParityType", storage: 1, defaultValue: 0 }], packFormat: "u8" }, { kind: "rw", name: "buffer_size", identifier: 132, description: "A positive, non-zero value indicating the size of the read and write buffers that should be created.", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "command", name: "send", identifier: 128, description: "Send a buffer of data over the serial transport.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], unique: true, packFormat: "b" }, { kind: "report", name: "received", identifier: 128, description: "Raised when a buffer of data is received.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }], tags: ["io"] }, { name: "Servo", status: "stable", shortId: "servo", camelName: "servo", shortName: "servo", extends: ["_base"], notes: { short: "Servo is a small motor with arm that can be pointing at a specific direction.\nTypically a servo angle is between 0\xB0 and 180\xB0 where 90\xB0 is the middle resting position.\n\nThe `min_pulse/max_pulse` may be read-only if the servo is permanently affixed to its Jacdac controller." }, classIdentifier: 318542083, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "angle", identifier: 2, description: "Specifies the angle of the arm (request).", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4, typicalMin: 0, typicalMax: 180 }], identifierName: "value", packFormat: "i16.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn the power to the servo on/off.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "offset", identifier: 129, description: "Correction applied to the angle to account for the servo arm drift.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4 }], packFormat: "i16.16" }, { kind: "const", name: "min_angle", identifier: 272, description: "Lowest angle that can be set, typiclly 0 \xB0.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4, defaultValue: 0 }], identifierName: "min_value", packFormat: "i16.16" }, { kind: "rw", name: "min_pulse", identifier: 131, description: "The length of pulse corresponding to lowest angle.", fields: [{ name: "_", unit: "us", type: "u16", storage: 2, isSimpleType: true, defaultValue: 500 }], optional: true, packFormat: "u16" }, { kind: "const", name: "max_angle", identifier: 273, description: "Highest angle that can be set, typically 180\xB0.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4, defaultValue: 180 }], identifierName: "max_value", packFormat: "i16.16" }, { kind: "rw", name: "max_pulse", identifier: 133, description: "The length of pulse corresponding to highest angle.", fields: [{ name: "_", unit: "us", type: "u16", storage: 2, isSimpleType: true, defaultValue: 2500 }], optional: true, packFormat: "u16" }, { kind: "const", name: "stall_torque", identifier: 384, description: "The servo motor will stop rotating when it is trying to move a ``stall_torque`` weight at a radial distance of ``1.0`` cm.", fields: [{ name: "_", unit: "kg/cm", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "response_speed", identifier: 385, description: "Time to move 60\xB0.", fields: [{ name: "_", unit: "s/60\xB0", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "ro", name: "actual_angle", identifier: 257, description: "The current physical position of the arm, if the device has a way to sense the position.", fields: [{ name: "_", unit: "\xB0", shift: 16, type: "i16.16", storage: -4 }], volatile: true, optional: true, identifierName: "reading", packFormat: "i16.16" }], tags: ["C"] }, { name: "Settings", status: "experimental", shortId: "settings", camelName: "settings", shortName: "settings", extends: ["_base"], notes: { short: "Non-volatile key-value storage interface for storing settings.", long: "## Secrets\n\nEntries with keys starting with `$` are considered secret.\nThey can be written normally, but they read as a single `0` byte,\nunless they are empty, in which case the value returned is also empty.\nThese are typically used by other services on the same device." }, classIdentifier: 285727818, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "get", identifier: 128, description: "Get the value of given setting. If no such entry exists, the value returned is empty.", fields: [{ name: "key", type: "string", storage: 0 }], hasReport: true, packFormat: "s" }, { kind: "report", name: "get", identifier: 128, description: "Get the value of given setting. If no such entry exists, the value returned is empty.", fields: [{ name: "key", type: "string0", storage: 0 }, { name: "value", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "z b" }, { kind: "command", name: "set", identifier: 129, description: "Set the value of a given setting.", fields: [{ name: "key", type: "string0", storage: 0 }, { name: "value", type: "bytes", storage: 0, isSimpleType: true }], restricted: true, packFormat: "z b" }, { kind: "command", name: "delete", identifier: 132, description: "Delete a given setting.", fields: [{ name: "key", type: "string", storage: 0 }], restricted: true, packFormat: "s" }, { kind: "command", name: "list_keys", identifier: 130, description: "Return keys of all settings.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "list_keys", packFormat: "b[12]" }, { kind: "pipe_report", name: "listed_key", identifier: 0, description: "Return keys of all settings.", fields: [{ name: "key", type: "string", storage: 0 }], pipeType: "list_keys", packFormat: "s" }, { kind: "command", name: "list", identifier: 131, description: "Return keys and values of all settings.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "list", packFormat: "b[12]" }, { kind: "pipe_report", name: "listed_entry", identifier: 0, description: "Return keys and values of all settings.", fields: [{ name: "key", type: "string0", storage: 0 }, { name: "value", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "list", packFormat: "z b" }, { kind: "command", name: "clear", identifier: 133, description: "Clears all keys.", fields: [], restricted: true }, { kind: "event", name: "change", identifier: 3, description: "Notifies that some setting have been modified.", fields: [], identifierName: "change" }], tags: [] }, { name: "7-segment display", status: "rc", shortId: "sevensegmentdisplay", camelName: "sevenSegmentDisplay", shortName: "sevenSegmentDisplay", extends: ["_base"], notes: { short: "A 7-segment numeric display, with one or more digits." }, classIdentifier: 425810167, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "digits", identifier: 2, description: "Each byte encodes the display status of a digit using,\nwhere lowest bit 0 encodes segment `A`, bit 1 encodes segments `B`, ..., bit 6 encodes segments `G`, and bit 7 encodes the decimal point (if present).\nIf incoming `digits` data is smaller than `digit_count`, the remaining digits will be cleared.\nThus, sending an empty `digits` payload clears the screen.\n\n```text\nGFEDCBA DP\n - A -\n F B\n | |\n - G -\n | |\n E C _\n | | |DP|\n - D - -\n```", fields: [{ name: "_", encoding: "bitset", type: "bytes", storage: 0, isSimpleType: true }], lowLevel: true, identifierName: "value", packFormat: "b" }, { kind: "rw", name: "brightness", identifier: 1, description: "Controls the brightness of the LEDs. `0` means off.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], optional: true, identifierName: "intensity", packFormat: "u0.16" }, { kind: "rw", name: "double_dots", identifier: 128, description: "Turn on or off the column LEDs (separating minutes from hours, etc.) in of the segment.\nIf the column LEDs is not supported, the value remains false.", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "const", name: "digit_count", identifier: 384, description: "The number of digits available on the display.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], packFormat: "u8" }, { kind: "const", name: "decimal_point", identifier: 385, description: "True if decimal points are available (on all digits).", fields: [{ name: "_", type: "bool", storage: 1 }], optional: true, packFormat: "u8" }, { kind: "command", name: "set_number", identifier: 128, description: "Shows the number on the screen using the decimal dot if available.", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }], client: true, packFormat: "f64" }], tags: ["8bit"], group: "Display" }, { name: "Soil moisture", status: "stable", shortId: "soilmoisture", camelName: "soilMoisture", shortName: "soilMoisture", extends: ["_base", "_sensor"], notes: { short: "A soil moisture sensor." }, classIdentifier: 491430835, enums: { Variant: { name: "Variant", storage: 1, members: { Resistive: 1, Capacitive: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "moisture", identifier: 257, description: "Indicates the wetness of the soil, from `dry` to `wet`.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u0.16" }, { kind: "ro", name: "moisture_error", identifier: 262, description: "The error on the moisture reading.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "Describe the type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Solenoid", status: "rc", shortId: "solenoid", camelName: "solenoid", shortName: "solenoid", extends: ["_base"], notes: { short: "A push-pull solenoid is a type of relay that pulls a coil when activated." }, classIdentifier: 387392458, enums: { Variant: { name: "Variant", storage: 1, members: { PushPull: 1, Valve: 2, Latch: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "pulled", identifier: 1, description: "Indicates whether the solenoid is energized and pulled (on) or pushed (off).", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of solenoid used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"] }, { name: "Sound level", status: "rc", shortId: "soundlevel", camelName: "soundLevel", shortName: "soundLevel", extends: ["_base", "_sensor"], notes: { short: "A sound level detector sensor, gives a relative indication of the sound level." }, classIdentifier: 346888797, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "sound_level", identifier: 257, description: "The sound level detected by the microphone", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turn on or off the microphone.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "loud_threshold", identifier: 6, description: "Set level at which the `loud` event is generated.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "active_threshold", packFormat: "u0.16" }, { kind: "rw", name: "quiet_threshold", identifier: 5, description: "Set level at which the `quiet` event is generated.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], identifierName: "inactive_threshold", packFormat: "u0.16" }, { kind: "event", name: "loud", identifier: 1, description: "Generated when a loud sound is detected.", fields: [], identifierName: "active" }, { kind: "event", name: "quiet", identifier: 2, description: "Generated low level of sound is detected.", fields: [], identifierName: "inactive" }], tags: ["8bit"], group: "Sound" }, { name: "Sound player", status: "rc", shortId: "soundplayer", camelName: "soundPlayer", shortName: "soundPlayer", extends: ["_base"], notes: { short: "A device that can play various sounds stored locally. This service is typically paired with a ``storage`` service for storing sounds." }, classIdentifier: 335795e3, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "volume", identifier: 1, description: "Global volume of the output. ``0`` means completely off. This volume is mixed with each play volumes.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], optional: true, identifierName: "intensity", packFormat: "u0.16" }, { kind: "command", name: "play", identifier: 128, description: "Starts playing a sound.", fields: [{ name: "name", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "cancel", identifier: 129, description: "Cancel any sound playing.", fields: [] }, { kind: "command", name: "list_sounds", identifier: 130, description: "Returns the list of sounds available to play.", fields: [{ name: "sounds_port", type: "pipe", storage: 12 }], pipeType: "list_sounds", packFormat: "b[12]" }, { kind: "pipe_report", name: "list_sounds_pipe", identifier: 0, description: "Returns the list of sounds available to play.", fields: [{ name: "duration", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "name", type: "string", storage: 0 }], pipeType: "list_sounds", packFormat: "u32 s" }], tags: [], group: "Sound" }, { name: "Sound Recorder with Playback", status: "experimental", shortId: "soundrecorderwithplayback", camelName: "soundRecorderWithPlayback", shortName: "soundRecorderWithPlayback", extends: ["_base"], notes: { short: "A record and replay module. You can record a few seconds of audio and play it back." }, classIdentifier: 460504912, enums: { Status: { name: "Status", storage: 1, members: { Idle: 0, Recording: 1, Playing: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "play", identifier: 128, description: "Replay recorded audio.", fields: [] }, { kind: "command", name: "record", identifier: 129, description: "Record audio for N milliseconds.", fields: [{ name: "duration", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "command", name: "cancel", identifier: 130, description: "Cancel record, the `time` register will be updated by already cached data.", fields: [] }, { kind: "ro", name: "status", identifier: 384, description: "Indicate the current status", fields: [{ name: "_", type: "Status", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "time", identifier: 385, description: "Milliseconds of audio recorded.", fields: [{ name: "_", unit: "ms", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16" }, { kind: "rw", name: "volume", identifier: 1, description: "Playback volume control", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1 }], optional: true, identifierName: "intensity", packFormat: "u0.8" }], tags: ["8bit", "padauk"], group: "Sound" }, { name: "Sound Spectrum", status: "experimental", shortId: "soundspectrum", camelName: "soundSpectrum", shortName: "soundSpectrum", extends: ["_base", "_sensor"], notes: { short: "A microphone that analyzes the sound specturm" }, classIdentifier: 360365086, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "frequency_bins", identifier: 257, description: "The computed frequency data.", fields: [{ name: "_", type: "bytes", storage: 0, isSimpleType: true }], volatile: true, identifierName: "reading", packFormat: "b" }, { kind: "rw", name: "enabled", identifier: 1, description: "Turns on/off the micropohone.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "fft_pow2_size", identifier: 128, description: "The power of 2 used as the size of the FFT to be used to determine the frequency domain.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true, defaultValue: 5, absoluteMin: 2, absoluteMax: 7 }], packFormat: "u8" }, { kind: "rw", name: "min_decibels", identifier: 129, description: "The minimum power value in the scaling range for the FFT analysis data", fields: [{ name: "_", unit: "dB", type: "i16", storage: -2, isSimpleType: true }], packFormat: "i16" }, { kind: "rw", name: "max_decibels", identifier: 130, description: "The maximum power value in the scaling range for the FFT analysis data", fields: [{ name: "_", unit: "dB", type: "i16", storage: -2, isSimpleType: true }], packFormat: "i16" }, { kind: "rw", name: "smoothing_time_constant", identifier: 131, description: 'The averaging constant with the last analysis frame.\nIf `0` is set, there is no averaging done, whereas a value of `1` means "overlap the previous and current buffer quite a lot while computing the value".', fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 0.8 }], packFormat: "u0.8" }], tags: [], group: "Sound" }, { name: "Speech synthesis", status: "rc", shortId: "speechsynthesis", camelName: "speechSynthesis", shortName: "speechSynthesis", extends: ["_base"], notes: { short: "A speech synthesizer" }, classIdentifier: 302307733, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines if the speech engine is in a non-paused state.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "rw", name: "lang", identifier: 128, description: "Language used for utterances as defined in https://www.ietf.org/rfc/bcp/bcp47.txt.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, packFormat: "s" }, { kind: "rw", name: "volume", identifier: 129, description: "Volume for utterances.", fields: [{ name: "_", unit: "/", shift: 8, type: "u0.8", storage: 1, defaultValue: 1 }], optional: true, packFormat: "u0.8" }, { kind: "rw", name: "pitch", identifier: 130, description: "Pitch for utterances", fields: [{ name: "_", shift: 16, type: "u16.16", storage: 4, defaultValue: 1, absoluteMax: 2, absoluteMin: 0 }], optional: true, packFormat: "u16.16" }, { kind: "rw", name: "rate", identifier: 131, description: "Rate for utterances", fields: [{ name: "_", shift: 16, type: "u16.16", storage: 4, defaultValue: 1, absoluteMin: 0.1, absoluteMax: 10 }], optional: true, packFormat: "u16.16" }, { kind: "command", name: "speak", identifier: 128, description: "Adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.", fields: [{ name: "text", type: "string", storage: 0 }], unique: true, packFormat: "s" }, { kind: "command", name: "cancel", identifier: 129, description: "Cancels current utterance and all utterances from the utterance queue.", fields: [] }], tags: [] }, { name: "Switch", status: "rc", shortId: "switch", camelName: "switch", shortName: "switch", extends: ["_base", "_sensor"], notes: { short: "A switch, which keeps its position." }, classIdentifier: 450008066, enums: { Variant: { name: "Variant", storage: 1, members: { Slide: 1, Tilt: 2, PushButton: 3, Tactile: 4, Toggle: 5, Proximity: 6, Magnetic: 7, FootButton: 8 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "active", identifier: 257, description: "Indicates whether the switch is currently active (on).", fields: [{ name: "_", type: "bool", storage: 1 }], volatile: true, identifierName: "reading", packFormat: "u8" }, { kind: "const", name: "variant", identifier: 263, description: "Describes the type of switch used.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "event", name: "on", identifier: 1, description: "Emitted when switch goes from `off` to `on`.", fields: [], identifierName: "active" }, { kind: "event", name: "off", identifier: 2, description: "Emitted when switch goes from `on` to `off`.", fields: [], identifierName: "inactive" }], tags: ["8bit", "input"], group: "Button" }, { name: "TCP", status: "experimental", shortId: "tcp", camelName: "tcp", shortName: "tcp", extends: ["_base"], notes: { short: "Data transfer over TCP/IP and TLS stream sockets.", commands: "## Pipes" }, classIdentifier: 457422603, enums: { TcpError: { name: "TcpError", storage: -4, members: { InvalidCommand: 1, InvalidCommandPayload: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "open", identifier: 128, description: "Open pair of pipes between network peripheral and a controlling device. In/outbound refers to direction from/to internet.", fields: [{ name: "inbound", type: "pipe", storage: 12 }], pipeType: "open", hasReport: true, packFormat: "b[12]" }, { kind: "report", name: "open", identifier: 128, description: "Open pair of pipes between network peripheral and a controlling device. In/outbound refers to direction from/to internet.", fields: [{ name: "outbound_port", type: "pipe_port", storage: 2 }], secondary: true, pipeType: "open", packFormat: "u16" }, { kind: "meta_pipe_command", name: "open_ssl", identifier: 1, description: "Open an SSL connection to a given host:port pair. Can be issued only once on given pipe.\nAfter the connection is established, an empty data report is sent.\nConnection is closed by closing the pipe.", fields: [{ name: "tcp_port", type: "u16", storage: 2, isSimpleType: true }, { name: "hostname", type: "string", storage: 0 }], pipeType: "open", packFormat: "u16 s" }, { kind: "pipe_command", name: "outdata", identifier: 0, description: "Bytes to be sent directly over an established TCP or SSL connection.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "open", packFormat: "b" }, { kind: "pipe_report", name: "indata", identifier: 0, description: "Bytes read directly from directly over an established TCP or SSL connection.", fields: [{ name: "data", type: "bytes", storage: 0, isSimpleType: true }], pipeType: "open", packFormat: "b" }, { kind: "meta_pipe_report", name: "error", identifier: 0, description: "Reported when an error is encountered. Negative error codes come directly from the SSL implementation.", fields: [{ name: "error", type: "TcpError", storage: -4 }], pipeType: "open", packFormat: "i32" }], tags: [] }, { name: "Temperature", status: "stable", shortId: "temperature", camelName: "temperature", shortName: "temperature", extends: ["_base", "_sensor"], notes: { short: "A thermometer measuring outside or inside environment." }, classIdentifier: 337754823, enums: { Variant: { name: "Variant", storage: 1, members: { Outdoor: 1, Indoor: 2, Body: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "temperature", identifier: 257, description: "The temperature.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "i22.10", storage: -4 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "i22.10" }, { kind: "const", name: "min_temperature", identifier: 260, description: "Lowest temperature that can be reported.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "i22.10", storage: -4 }], identifierName: "min_reading", packFormat: "i22.10" }, { kind: "const", name: "max_temperature", identifier: 261, description: "Highest temperature that can be reported.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "i22.10", storage: -4 }], identifierName: "max_reading", packFormat: "i22.10" }, { kind: "ro", name: "temperature_error", identifier: 262, description: "The real temperature is between `temperature - temperature_error` and `temperature + temperature_error`.", fields: [{ name: "_", unit: "\xB0C", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "variant", identifier: 263, description: "Specifies the type of thermometer.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["C", "8bit"], group: "Environment" }, { name: "Timeseries Aggregator", status: "experimental", shortId: "timeseriesaggregator", camelName: "timeseriesAggregator", shortName: "timeseriesAggregator", extends: ["_base"], notes: { short: "Supports aggregating timeseries data (especially sensor readings)\nand sending them to a cloud/storage service.\nUsed in DeviceScript.\n\nNote that `f64` values are not necessarily aligned." }, classIdentifier: 294829516, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "clear", identifier: 128, description: "Remove all pending timeseries.", fields: [] }, { kind: "command", name: "update", identifier: 131, description: "Add a data point to a timeseries.", fields: [{ name: "value", isFloat: true, type: "f64", storage: 8 }, { name: "label", type: "string", storage: 0 }], packFormat: "f64 s" }, { kind: "command", name: "set_window", identifier: 132, description: "Set aggregation window.\nSetting to `0` will restore default.", fields: [{ name: "duration", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "label", type: "string", storage: 0 }], packFormat: "u32 s" }, { kind: "command", name: "set_upload", identifier: 133, description: "Set whether or not the timeseries will be uploaded to the cloud.\nThe `stored` reports are generated regardless.", fields: [{ name: "upload", type: "bool", storage: 1 }, { name: "label", type: "string", storage: 0 }], packFormat: "u8 s" }, { kind: "report", name: "stored", identifier: 144, description: 'Indicates that the average, minimum and maximum value of a given\ntimeseries are as indicated.\nIt also says how many samples were collected, and the collection period.\nTimestamps are given using device\'s internal clock, which will wrap around.\nTypically, `end_time` can be assumed to be "now".\n`end_time - start_time == window`', fields: [{ name: "num_samples", unit: "#", type: "u32", storage: 4, isSimpleType: true }, { name: "padding", type: "u8[4]", storage: 4 }, { name: "avg", isFloat: true, type: "f64", storage: 8 }, { name: "min", isFloat: true, type: "f64", storage: 8 }, { name: "max", isFloat: true, type: "f64", storage: 8 }, { name: "start_time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "end_time", unit: "ms", type: "u32", storage: 4, isSimpleType: true }, { name: "label", type: "string", storage: 0 }], packFormat: "u32 b[4] f64 f64 f64 u32 u32 s" }, { kind: "ro", name: "now", identifier: 384, description: "This can queried to establish local time on the device.", fields: [{ name: "_", unit: "us", type: "u32", storage: 4, isSimpleType: true }], volatile: true, packFormat: "u32" }, { kind: "rw", name: "fast_start", identifier: 128, description: "When `true`, the windows will be shorter after service reset and gradually extend to requested length.\nThis is ensure valid data is being streamed in program development.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "rw", name: "default_window", identifier: 129, description: "Window for timeseries for which `set_window` was never called.\nNote that windows returned initially may be shorter if `fast_start` is enabled.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 6e4 }], packFormat: "u32" }, { kind: "rw", name: "default_upload", identifier: 130, description: "Whether labelled timeseries for which `set_upload` was never called should be automatically uploaded.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "rw", name: "upload_unlabelled", identifier: 131, description: "Whether automatically created timeseries not bound in role manager should be uploaded.", fields: [{ name: "_", type: "bool", storage: 1, defaultValue: 1 }], packFormat: "u8" }, { kind: "rw", name: "sensor_watchdog_period", identifier: 132, description: "If no data is received from any sensor within given period, the device is rebooted.\nSet to `0` to disable (default).\nUpdating user-provided timeseries does not reset the watchdog.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], packFormat: "u32" }], tags: ["infrastructure", "devicescript"], group: "Iot", restricted: true }, { name: "Traffic Light", status: "rc", shortId: "trafficlight", camelName: "trafficLight", shortName: "trafficLight", extends: ["_base"], notes: { short: "Controls a mini traffic with a red, orange and green LED." }, classIdentifier: 365137307, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "red", identifier: 128, description: "The on/off state of the red light.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "yellow", identifier: 129, description: "The on/off state of the yellow light.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "green", identifier: 130, description: "The on/off state of the green light.", fields: [{ name: "_", type: "bool", storage: 1 }], packFormat: "u8" }], tags: ["8bit"] }, { name: "Total Volatile organic compound", status: "stable", shortId: "tvoc", camelName: "tvoc", shortName: "tvoc", extends: ["_base", "_sensor"], notes: { short: "Measures equivalent Total Volatile Organic Compound levels." }, classIdentifier: 312849815, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "TVOC", identifier: 257, description: "Total volatile organic compound readings in parts per billion.", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4, absoluteMin: 0, typicalMax: 1187, typicalMin: 0 }], volatile: true, identifierName: "reading", packFormat: "u22.10" }, { kind: "ro", name: "TVOC_error", identifier: 262, description: "Error on the reading data", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u22.10" }, { kind: "const", name: "min_TVOC", identifier: 260, description: "Minimum measurable value", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4 }], identifierName: "min_reading", packFormat: "u22.10" }, { kind: "const", name: "max_TVOC", identifier: 261, description: "Minimum measurable value.", fields: [{ name: "_", unit: "ppb", shift: 10, type: "u22.10", storage: 4 }], identifierName: "max_reading", packFormat: "u22.10" }], tags: ["8bit"], group: "Environment" }, { name: "Unique Brain", status: "stable", shortId: "uniquebrain", camelName: "uniqueBrain", shortName: "uniqueBrain", extends: ["_base"], notes: { short: "The presence of this service indicates that this device is a client that controls sensors and actuators.\nIf a unique brain detects another younger unique brain (determined by reset counter in announce packets),\nthen the older brain should switch into proxy mode." }, classIdentifier: 272387813, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }], tags: ["infrastructure"] }, { name: "USB Bridge", status: "rc", shortId: "usbbridge", camelName: "usbBridge", shortName: "usbBridge", extends: ["_base"], notes: { short: "This service is normally not announced or otherwise exposed on the serial bus.\nIt is used to communicate with a USB-Jacdac bridge at the USB layer.\nThe host sends broadcast packets to this service to control the link layer.\nThe device responds with broadcast reports (no-one else does that).\nThese packets are not forwarded to the UART Jacdac line.\n\nPackets are sent over USB Serial (CDC).\nThe host shall set the CDC to 1Mbaud 8N1\n(even though in some cases the USB interface is connected directly to the MCU and line settings are\nignored).\n\nThe CDC line carries both Jacdac frames and serial logging output.\nJacdac frames have valid CRC and are framed by delimeter characters and possibly fragmented.\n\n`0xFE` is used as a framing byte.\nNote that bytes `0xF8`-`0xFF` are always invalid UTF-8.\n`0xFF` occurs relatively often in Jacdac packets, so is not used for framing.\n\nThe following sequences are supported:\n\n* `0xFE 0xF8` - literal 0xFE\n* `0xFE 0xF9` - reserved; ignore\n* `0xFE 0xFA` - indicates that some serial logs were dropped at this point\n* `0xFE 0xFB` - indicates that some Jacdac frames were dropped at this point\n* `0xFE 0xFC` - Jacdac frame start\n* `0xFE 0xFD` - Jacdac frame end\n\n0xFE followed by any other byte:\n* in serial, should be treated as literal 0xFE (and the byte as itself, unless it's 0xFE)\n* in frame data, should terminate the current frame fragment,\n and ideally have all data (incl. fragment start) in the current frame fragment treated as serial" }, classIdentifier: 418781770, enums: { QByte: { name: "QByte", storage: 1, members: { Magic: 254, LiteralMagic: 248, Reserved: 249, SerialGap: 250, FrameGap: 251, FrameStart: 252, FrameEnd: 253 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "disable_packets", identifier: 128, description: "Disables forwarding of Jacdac packets.", fields: [], hasReport: true }, { kind: "report", name: "disable_packets", identifier: 128, description: "Disables forwarding of Jacdac packets.", fields: [], secondary: true }, { kind: "command", name: "enable_packets", identifier: 129, description: "Enables forwarding of Jacdac packets.", fields: [], hasReport: true }, { kind: "report", name: "enable_packets", identifier: 129, description: "Enables forwarding of Jacdac packets.", fields: [], secondary: true }, { kind: "command", name: "disable_log", identifier: 130, description: "Disables forwarding of serial log messages.", fields: [], hasReport: true }, { kind: "report", name: "disable_log", identifier: 130, description: "Disables forwarding of serial log messages.", fields: [], secondary: true }, { kind: "command", name: "enable_log", identifier: 131, description: "Enables forwarding of serial log messages.", fields: [], hasReport: true }, { kind: "report", name: "enable_log", identifier: 131, description: "Enables forwarding of serial log messages.", fields: [], secondary: true }], tags: ["infrastructure"] }, { name: "UV index", status: "stable", shortId: "uvindex", camelName: "uvIndex", shortName: "uvIndex", extends: ["_base", "_sensor"], notes: { short: "The UV Index is a measure of the intensity of ultraviolet (UV) rays from the Sun." }, classIdentifier: 527306128, enums: { Variant: { name: "Variant", storage: 1, members: { UVA_UVB: 1, Visible_IR: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "uv_index", identifier: 257, description: "Ultraviolet index, typically refreshed every second.", fields: [{ name: "_", unit: "uv", shift: 16, type: "u16.16", storage: 4, typicalMax: 11, typicalMin: 0 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16.16" }, { kind: "ro", name: "uv_index_error", identifier: 262, description: "Error on the UV measure.", fields: [{ name: "_", unit: "uv", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor and capabilities.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"], group: "Environment" }, { name: "Verified Telemetry", status: "deprecated", shortId: "verifiedtelemetrysensor", camelName: "verifiedTelemetry", shortName: "verifiedTelemetry", extends: ["_base"], notes: { short: "A mixin service that exposes verified telemetry information for a sensor (see https://github.com/Azure/Verified-Telemetry/tree/main/PnPModel)." }, classIdentifier: 563381279, enums: { Status: { name: "Status", storage: 1, members: { Unknown: 0, Working: 1, Faulty: 2 } }, FingerprintType: { name: "FingerprintType", storage: 1, members: { FallCurve: 1, CurrentSense: 2, Custom: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "ro", name: "telemetry_status", identifier: 384, description: "Reads the telemetry working status, where ``true`` is working and ``false`` is faulty.", fields: [{ name: "_", type: "Status", storage: 1 }], packFormat: "u8" }, { kind: "rw", name: "telemetry_status_interval", identifier: 128, description: "Specifies the interval between computing the fingerprint information.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], optional: true, packFormat: "u32" }, { kind: "const", name: "fingerprint_type", identifier: 385, description: "Type of the fingerprint.", fields: [{ name: "_", type: "FingerprintType", storage: 1 }], packFormat: "u8" }, { kind: "ro", name: "fingerprint_template", identifier: 386, description: "Template Fingerprint information of a working sensor.", fields: [{ name: "confidence", unit: "%", type: "u16", storage: 2, isSimpleType: true }, { name: "template", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u16 b" }, { kind: "command", name: "reset_fingerprint_template", identifier: 128, description: "This command will clear the template fingerprint of a sensor and collect a new template fingerprint of the attached sensor.", fields: [] }, { kind: "command", name: "retrain_fingerprint_template", identifier: 129, description: "This command will append a new template fingerprint to the `fingerprintTemplate`. Appending more fingerprints will increase the accuracy in detecting the telemetry status.", fields: [], unique: true }, { kind: "event", name: "telemetry_status_change", identifier: 3, description: "The telemetry status of the device was updated.", fields: [{ name: "telemetry_status", type: "Status", storage: 1 }], identifierName: "change", packFormat: "u8" }, { kind: "event", name: "fingerprint_template_change", identifier: 128, description: "The fingerprint template was updated", fields: [] }], tags: [] }, { name: "Vibration motor", status: "stable", shortId: "vibrationmotor", camelName: "vibrationMotor", shortName: "vibrationMotor", extends: ["_base"], notes: { short: "A vibration motor." }, classIdentifier: 406832290, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "vibrate", identifier: 128, description: "Starts a sequence of vibration and pauses. To stop any existing vibration, send an empty payload.", fields: [{ name: "duration", unit: "8ms", type: "u8", storage: 1, isSimpleType: true, startRepeats: true }, { name: "intensity", unit: "/", shift: 8, type: "u0.8", storage: 1 }], packFormat: "r: u8 u0.8" }, { kind: "const", name: "max_vibrations", identifier: 384, description: "The maximum number of vibration sequences supported in a single packet.", fields: [{ name: "_", type: "u8", storage: 1, isSimpleType: true }], optional: true, packFormat: "u8" }], tags: [] }, { name: "Water level", status: "rc", shortId: "waterlevel", camelName: "waterLevel", shortName: "waterLevel", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures liquid/water level." }, classIdentifier: 343630573, enums: { Variant: { name: "Variant", storage: 1, members: { Resistive: 1, ContactPhotoElectric: 2, NonContactPhotoElectric: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "level", identifier: 257, description: "The reported water level.", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, identifierName: "reading", packFormat: "u0.16" }, { kind: "ro", name: "level_error", identifier: 262, description: "The error rage on the current reading", fields: [{ name: "_", unit: "/", shift: 16, type: "u0.16", storage: 2 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u0.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical sensor.", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }], tags: ["8bit"] }, { name: "Weight Scale", status: "rc", shortId: "weightscale", camelName: "weightScale", shortName: "weightScale", extends: ["_base", "_sensor"], notes: { short: "A weight measuring sensor." }, classIdentifier: 525160512, enums: { Variant: { name: "Variant", storage: 1, members: { Body: 1, Food: 2, Jewelry: 3 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "weight", identifier: 257, description: "The reported weight.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", packFormat: "u16.16" }, { kind: "ro", name: "weight_error", identifier: 262, description: "The estimate error on the reported reading.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "rw", name: "zero_offset", identifier: 128, description: "Calibrated zero offset error on the scale, i.e. the measured weight when nothing is on the scale.\nYou do not need to subtract that from the reading, it has already been done.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "rw", name: "gain", identifier: 129, description: "Calibrated gain on the weight scale error.", fields: [{ name: "_", shift: 16, type: "u16.16", storage: 4 }], optional: true, packFormat: "u16.16" }, { kind: "const", name: "max_weight", identifier: 261, description: "Maximum supported weight on the scale.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u16.16" }, { kind: "const", name: "min_weight", identifier: 260, description: "Minimum recommend weight on the scale.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "min_reading", packFormat: "u16.16" }, { kind: "const", name: "weight_resolution", identifier: 264, description: "Smallest, yet distinguishable change in reading.", fields: [{ name: "_", unit: "kg", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "reading_resolution", packFormat: "u16.16" }, { kind: "const", name: "variant", identifier: 263, description: "The type of physical scale", fields: [{ name: "_", type: "Variant", storage: 1 }], optional: true, identifierName: "variant", packFormat: "u8" }, { kind: "command", name: "calibrate_zero_offset", identifier: 128, description: "Call this command when there is nothing on the scale. If supported, the module should save the calibration data.", fields: [] }, { kind: "command", name: "calibrate_gain", identifier: 129, description: "Call this command with the weight of the thing on the scale.", fields: [{ name: "weight", unit: "g", shift: 10, type: "u22.10", storage: 4 }], packFormat: "u22.10" }], tags: ["8bit"] }, { name: "WIFI", status: "rc", shortId: "wifi", camelName: "wifi", shortName: "wifi", extends: ["_base"], notes: { short: "Discovery and connection to WiFi networks. Separate TCP service can be used for data transfer.", long: "## Connection\n\nThe device controlled by this service is meant to connect automatically, once configured.\nTo that end, it keeps a list of known WiFi networks, with priorities and passwords.\nIt will connect to the available network with numerically highest priority,\nbreaking ties in priority by signal strength (typically all known networks have priority of `0`).\nIf the connection fails (due to wrong password, radio failure, or other problem)\nan `connection_failed` event is emitted, and the device will try to connect to the next eligible network.\nWhen networks are exhausted, the scan is performed again and the connection process restarts.\n\nUpdating networks (setting password, priorties, forgetting) does not trigger an automatic reconnect.\n\n## Captive portals\n\nIf the Wifi is not able to join an AP because it needs to receive a password, it may decide to enter a mode\nwhere it waits for user input. Typical example of this mode would be a captive portal or waiting for a BLE interaction.\nIn that situation, the `status_code` should set to `WaitingForInput`." }, classIdentifier: 413852154, enums: { APFlags: { name: "APFlags", storage: 4, isFlags: true, members: { HasPassword: 1, WPS: 2, HasSecondaryChannelAbove: 4, HasSecondaryChannelBelow: 8, IEEE_802_11B: 256, IEEE_802_11A: 512, IEEE_802_11G: 1024, IEEE_802_11N: 2048, IEEE_802_11AC: 4096, IEEE_802_11AX: 8192, IEEE_802_LongRange: 32768 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "command", name: "last_scan_results", identifier: 128, description: "Return list of WiFi network from the last scan.\nScans are performed periodically while not connected (in particular, on startup and after current connection drops),\nas well as upon `reconnect` and `scan` commands.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "last_scan_results", packFormat: "b[12]" }, { kind: "pipe_report", name: "results", identifier: 0, description: "Return list of WiFi network from the last scan.\nScans are performed periodically while not connected (in particular, on startup and after current connection drops),\nas well as upon `reconnect` and `scan` commands.", fields: [{ name: "flags", type: "APFlags", storage: 4 }, { name: "reserved", type: "u32", storage: 4, isSimpleType: true }, { name: "rssi", unit: "dB", type: "i8", storage: -1, isSimpleType: true, typicalMin: -100, typicalMax: -20 }, { name: "channel", type: "u8", storage: 1, isSimpleType: true, typicalMin: 1, typicalMax: 13 }, { name: "bssid", type: "u8[6]", storage: 6 }, { name: "ssid", type: "string", storage: 33, maxBytes: 33 }], pipeType: "last_scan_results", packFormat: "u32 u32 i8 u8 b[6] s[33]" }, { kind: "command", name: "add_network", identifier: 129, description: "Automatically connect to named network if available. Also set password if network is not open.", fields: [{ name: "ssid", type: "string0", storage: 0 }, { name: "password", type: "string0", storage: 0, isOptional: true }], packFormat: "z z" }, { kind: "command", name: "reconnect", identifier: 130, description: "Enable the WiFi (if disabled), initiate a scan, wait for results, disconnect from current WiFi network if any,\nand then reconnect (using regular algorithm, see `set_network_priority`).", fields: [] }, { kind: "command", name: "forget_network", identifier: 131, description: "Prevent from automatically connecting to named network in future.\nForgetting a network resets its priority to `0`.", fields: [{ name: "ssid", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "forget_all_networks", identifier: 132, description: "Clear the list of known networks.", fields: [] }, { kind: "command", name: "set_network_priority", identifier: 133, description: "Set connection priority for a network.\nBy default, all known networks have priority of `0`.", fields: [{ name: "priority", type: "i16", storage: -2, isSimpleType: true }, { name: "ssid", type: "string", storage: 0 }], packFormat: "i16 s" }, { kind: "command", name: "scan", identifier: 134, description: "Initiate search for WiFi networks. Generates `scan_complete` event.", fields: [] }, { kind: "command", name: "list_known_networks", identifier: 135, description: "Return list of known WiFi networks.\n`flags` is currently always 0.", fields: [{ name: "results", type: "pipe", storage: 12 }], pipeType: "list_known_networks", packFormat: "b[12]" }, { kind: "pipe_report", name: "network_results", identifier: 0, description: "Return list of known WiFi networks.\n`flags` is currently always 0.", fields: [{ name: "priority", type: "i16", storage: -2, isSimpleType: true }, { name: "flags", type: "i16", storage: -2, isSimpleType: true }, { name: "ssid", type: "string", storage: 0 }], pipeType: "list_known_networks", packFormat: "i16 i16 s" }, { kind: "ro", name: "rssi", identifier: 257, description: "Current signal strength. Returns -128 when not connected.", fields: [{ name: "_", unit: "dB", type: "i8", storage: -1, isSimpleType: true, typicalMin: -128, typicalMax: -20 }], volatile: true, identifierName: "reading", preferredInterval: 15e3, packFormat: "i8" }, { kind: "rw", name: "enabled", identifier: 1, description: "Determines whether the WiFi radio is enabled. It starts enabled upon reset.", fields: [{ name: "_", type: "bool", storage: 1 }], identifierName: "intensity", packFormat: "u8" }, { kind: "ro", name: "ip_address", identifier: 385, description: "0, 4 or 16 byte buffer with the IPv4 or IPv6 address assigned to device if any.", fields: [{ name: "_", type: "bytes", storage: 16, isSimpleType: true, maxBytes: 16 }], packFormat: "b[16]" }, { kind: "const", name: "eui_48", identifier: 386, description: 'The 6-byte MAC address of the device. If a device does MAC address randomization it will have to "restart".', fields: [{ name: "_", type: "bytes", storage: 6, isSimpleType: true, maxBytes: 6 }], packFormat: "b[6]" }, { kind: "ro", name: "ssid", identifier: 387, description: "SSID of the access-point to which device is currently connected.\nEmpty string if not connected.", fields: [{ name: "_", type: "string", storage: 32, maxBytes: 32 }], packFormat: "s[32]" }, { kind: "event", name: "got_ip", identifier: 1, description: "Emitted upon successful join and IP address assignment.", fields: [], identifierName: "active" }, { kind: "event", name: "lost_ip", identifier: 2, description: "Emitted when disconnected from network.", fields: [], identifierName: "inactive" }, { kind: "event", name: "scan_complete", identifier: 128, description: "A WiFi network scan has completed. Results can be read with the `last_scan_results` command.\nThe event indicates how many networks where found, and how many are considered\nas candidates for connection.", fields: [{ name: "num_networks", type: "u16", storage: 2, isSimpleType: true }, { name: "num_known_networks", type: "u16", storage: 2, isSimpleType: true }], packFormat: "u16 u16" }, { kind: "event", name: "networks_changed", identifier: 129, description: "Emitted whenever the list of known networks is updated.", fields: [] }, { kind: "event", name: "connection_failed", identifier: 130, description: "Emitted when when a network was detected in scan, the device tried to connect to it\nand failed.\nThis may be because of wrong password or other random failure.", fields: [{ name: "ssid", type: "string", storage: 0 }], packFormat: "s" }], tags: [], group: "Iot" }, { name: "Wind direction", status: "rc", shortId: "winddirection", camelName: "windDirection", shortName: "windDirection", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures wind direction." }, classIdentifier: 409725227, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "wind_direction", identifier: 257, description: "The direction of the wind.", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true, absoluteMin: 0, absoluteMax: 359 }], volatile: true, identifierName: "reading", preferredInterval: 1e3, packFormat: "u16" }, { kind: "ro", name: "wind_direction_error", identifier: 262, description: "Error on the wind direction reading", fields: [{ name: "_", unit: "\xB0", type: "u16", storage: 2, isSimpleType: true }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16" }], tags: ["8bit"], group: "Environment" }, { name: "Wind speed", status: "rc", shortId: "windspeed", camelName: "windSpeed", shortName: "windSpeed", extends: ["_base", "_sensor"], notes: { short: "A sensor that measures wind speed." }, classIdentifier: 458824639, enums: {}, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "streaming_samples", identifier: 3, description: "Asks device to stream a given number of samples\n(clients will typically write `255` to this register every second or so, while streaming is required).", fields: [{ name: "_", unit: "#", type: "u8", storage: 1, isSimpleType: true }], internal: true, identifierName: "streaming_samples", packFormat: "u8", derived: "_sensor" }, { kind: "rw", name: "streaming_interval", identifier: 4, description: "Period between packets of data when streaming in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true, defaultValue: 100, typicalMin: 1, typicalMax: 6e4 }], identifierName: "streaming_interval", packFormat: "u32", derived: "_sensor" }, { kind: "const", name: "streaming_preferred_interval", identifier: 258, description: "Preferred default streaming interval for sensor in milliseconds.", fields: [{ name: "_", unit: "ms", type: "u32", storage: 4, isSimpleType: true }], internal: true, optional: true, identifierName: "streaming_preferred_interval", packFormat: "u32", derived: "_sensor" }, { kind: "ro", name: "wind_speed", identifier: 257, description: "The velocity of the wind.", fields: [{ name: "_", unit: "m/s", shift: 16, type: "u16.16", storage: 4 }], volatile: true, identifierName: "reading", preferredInterval: 6e4, packFormat: "u16.16" }, { kind: "ro", name: "wind_speed_error", identifier: 262, description: "Error on the reading", fields: [{ name: "_", unit: "m/s", shift: 16, type: "u16.16", storage: 4 }], volatile: true, optional: true, identifierName: "reading_error", packFormat: "u16.16" }, { kind: "const", name: "max_wind_speed", identifier: 261, description: "Maximum speed that can be measured by the sensor.", fields: [{ name: "_", unit: "m/s", shift: 16, type: "u16.16", storage: 4 }], optional: true, identifierName: "max_reading", packFormat: "u16.16" }], tags: ["8bit"], group: "Environment" }, { name: "WSSK", status: "experimental", shortId: "wssk", camelName: "wssk", shortName: "wssk", extends: ["_base"], notes: { short: "Defines a binary protocol for IoT devices to talk to DeviceScript gateway over encrypted websockets.\nThis is not used as a regular Jacdac service." }, classIdentifier: 330775038, enums: { StreamingType: { name: "StreamingType", storage: 2, members: { Jacdac: 1, Dmesg: 2, Exceptions: 256, TemporaryMask: 255, PermamentMask: 65280, DefaultMask: 256 } }, DataType: { name: "DataType", storage: 1, members: { Binary: 1, JSON: 2 } } }, constants: {}, packets: [{ kind: "report", name: "command_not_implemented", identifier: 3, description: "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.", fields: [{ name: "service_command", type: "u16", storage: 2, isSimpleType: true }, { name: "packet_crc", type: "u16", storage: 2, isSimpleType: true }], identifierName: "command_not_implemented", packFormat: "u16 u16", derived: "_base" }, { kind: "const", name: "instance_name", identifier: 265, description: "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "instance_name", packFormat: "s", derived: "_base" }, { kind: "ro", name: "status_code", identifier: 259, description: "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code", packFormat: "u16 u16", derived: "_base" }, { kind: "rw", name: "client_variant", identifier: 9, description: "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.", fields: [{ name: "_", type: "string", storage: 0 }], optional: true, identifierName: "client_variant", packFormat: "s", derived: "_base" }, { kind: "event", name: "status_code_changed", identifier: 4, description: "Notifies that the status code of the service changed.", fields: [{ name: "code", type: "u16", storage: 2, isSimpleType: true }, { name: "vendor_code", type: "u16", storage: 2, isSimpleType: true }], optional: true, identifierName: "status_code_changed", packFormat: "u16 u16", derived: "_base" }, { kind: "report", name: "error", identifier: 255, description: "Issued when a command fails.", fields: [{ name: "message", type: "string", storage: 0 }], packFormat: "s" }, { kind: "command", name: "set_streaming", identifier: 144, description: "Enable/disable forwarding of all Jacdac frames, exception reporting, and `dmesg` streaming.", fields: [{ name: "status", type: "StreamingType", storage: 2 }], packFormat: "u16" }, { kind: "command", name: "ping_device", identifier: 145, description: "Send from gateway when it wants to see if the device is alive.\nThe device currently only support 0-length payload.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "ping_device", identifier: 145, description: "Send from gateway when it wants to see if the device is alive.\nThe device currently only support 0-length payload.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "b" }, { kind: "command", name: "ping_cloud", identifier: 146, description: "Send from device to gateway to test connection.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "ping_cloud", identifier: 146, description: "Send from device to gateway to test connection.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "b" }, { kind: "command", name: "get_hash", identifier: 147, description: "Get SHA256 of the currently deployed program.", fields: [], hasReport: true }, { kind: "report", name: "get_hash", identifier: 147, description: "Get SHA256 of the currently deployed program.", fields: [{ name: "sha256", type: "u8[32]", storage: 32 }], secondary: true, packFormat: "b[32]" }, { kind: "command", name: "deploy_start", identifier: 148, description: "Start deployment of a new program.", fields: [{ name: "size", unit: "B", type: "u32", storage: 4, isSimpleType: true }], hasReport: true, packFormat: "u32" }, { kind: "report", name: "deploy_start", identifier: 148, description: "Start deployment of a new program.", fields: [], secondary: true }, { kind: "command", name: "deploy_write", identifier: 149, description: "Payload length must be multiple of 32 bytes.", fields: [{ name: "payload", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "deploy_write", identifier: 149, description: "Payload length must be multiple of 32 bytes.", fields: [], secondary: true }, { kind: "command", name: "deploy_finish", identifier: 150, description: "Finish deployment.", fields: [], hasReport: true }, { kind: "report", name: "deploy_finish", identifier: 150, description: "Finish deployment.", fields: [], secondary: true }, { kind: "command", name: "c2d", identifier: 151, description: "Upload a labelled tuple of values to the cloud.\nThe tuple will be automatically tagged with timestamp and originating device.", fields: [{ name: "datatype", type: "DataType", storage: 1 }, { name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u8 z b" }, { kind: "report", name: "d2c", identifier: 152, description: "Upload a binary message to the cloud.", fields: [{ name: "datatype", type: "DataType", storage: 1 }, { name: "topic", type: "string0", storage: 0 }, { name: "payload", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "u8 z b" }, { kind: "command", name: "jacdac_packet", identifier: 153, description: "Sent both ways.", fields: [{ name: "frame", type: "bytes", storage: 0, isSimpleType: true }], hasReport: true, packFormat: "b" }, { kind: "report", name: "jacdac_packet", identifier: 153, description: "Sent both ways.", fields: [{ name: "frame", type: "bytes", storage: 0, isSimpleType: true }], secondary: true, packFormat: "b" }, { kind: "report", name: "dmesg", identifier: 154, description: "The `logs` field is string in UTF-8 encoding, however it can be split in the middle of UTF-8 code point.\nControlled via `dmesg_en`.", fields: [{ name: "logs", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }, { kind: "report", name: "exception_report", identifier: 155, description: "The format is the same as `dmesg` but this is sent on exceptions only and is controlled separately via `exception_en`.", fields: [{ name: "logs", type: "bytes", storage: 0, isSimpleType: true }], packFormat: "b" }], tags: ["infrastructure", "devicescript"], group: "Iot" }]; + + // compiler/src/boards.json + var boards_default = { + archs: { + esp32: { + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32archconfig.schema.json", + bareUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32-esp32_bare-0x1000.bin", + binFlashOffset: "0x1000", + binGenericFlashOffset: "0x10000", + dcfgOffset: "0x9000", + flashPageSize: 4096, + fstorOffset: "0x1c0000", + fstorPages: 64, + id: "esp32", + name: "ESP32", + pins: { + analogIn: "32-39", + analogOut: "25,26", + boot: "0,2,5,12,15", + bootUart: "1,3", + debug: "12-15", + flash: "6-11", + input: "io,34,35,36,37,38,39", + io: "boot,4,13,14,18,19,21,22,23,25,26,27,32,33", + psram: "16,17", + touch: "0,2,4,12-15,27,32,33" + }, + repoUrl: "https://github.com/microsoft/devicescript-esp32" + }, + esp32c3: { + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32archconfig.schema.json", + bareUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_bare-0x0.bin", + binFlashOffset: 0, + binGenericFlashOffset: "0x10000", + dcfgOffset: "0x9000", + flashPageSize: 4096, + fstorOffset: "0x1c0000", + fstorPages: 64, + id: "esp32c3", + name: "ESP32-C3", + pins: { + analogIn: "0-4", + boot: "2,8,9", + bootUart: "20,21", + debug: "4-7", + flash: "11-17", + io: "0-10,bootUart", + usb: "18,19" + }, + repoUrl: "https://github.com/microsoft/devicescript-esp32" + }, + esp32s2: { + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32archconfig.schema.json", + bareUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-esp32s2_bare-0x1000.bin", + binFlashOffset: "0x1000", + binGenericFlashOffset: "0x10000", + dcfgOffset: "0x9000", + flashPageSize: 4096, + fstorOffset: "0x1c0000", + fstorPages: 64, + id: "esp32s2", + name: "ESP32-S2", + pins: { + analogIn: "1-10", + analogOut: "17,18", + boot: "0,45,46", + debug: "39-42", + flash: "26-32", + input: "io,46", + io: "0-18,21,33-45", + usb: "19,20" + }, + repoUrl: "https://github.com/microsoft/devicescript-esp32" + }, + esp32s3: { + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32archconfig.schema.json", + bareUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s3-esp32s3_bare-0x0.bin", + binFlashOffset: "0x0", + binGenericFlashOffset: "0x10000", + dcfgOffset: "0x9000", + flashPageSize: 4096, + fstorOffset: "0x1c0000", + fstorPages: 64, + id: "esp32s3", + name: "ESP32-S3", + pins: { + analogIn: "1-10", + analogOut: "17,18", + boot: "0,45,46", + debug: "39-42", + flash: "26-32,35-37", + input: "io", + io: "0-18,21,33-48", + usb: "19,20" + }, + repoUrl: "https://github.com/microsoft/devicescript-esp32" + }, + rp2040: { + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040archconfig.schema.json", + bareUrl: "https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-msr124.uf2", + dcfgOffset: "0x100dc000", + flashPageSize: 4096, + fstorOffset: "0x100e0000", + fstorPages: 32, + id: "rp2040", + name: "RP2040", + pins: { + analogIn: "26-29", + io: "0-29" + }, + repoUrl: "https://github.com/microsoft/devicescript-pico", + uf2Align: 4096 + }, + rp2040w: { + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040archconfig.schema.json", + bareUrl: "https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040w-pico_w.uf2", + dcfgOffset: "0x100dc000", + flashPageSize: 4096, + fstorOffset: "0x100e0000", + fstorPages: 32, + id: "rp2040w", + name: "RP2040 + CYW43 WiFi", + pins: { + analogIn: "26-28", + io: "0-22,analogIn", + wifi: "23,24,25,29" + }, + repoUrl: "https://github.com/microsoft/devicescript-pico", + uf2Align: 4096 + } + }, + boards: { + adafruit_feather_esp32_s2: { + $description: "A S2 Feather from Adafruit. (untested)", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-adafruit_feather_esp32_s2-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s2", + devName: "Adafruit Feather ESP32-S2", + i2c: { + $connector: "Qwiic", + pinSCL: "SCL", + pinSDA: "SDA" + }, + id: "adafruit_feather_esp32_s2", + led: { + pin: 33, + type: 1 + }, + log: { + pinTX: 43 + }, + pins: { + A0: 18, + A1: 17, + A2: 16, + A3: 15, + A4_D24: 14, + A5_D25: 8, + D10: 10, + D11: 11, + D12: 12, + D13: 13, + D5: 5, + D6: 6, + D9: 9, + LED_PWR: 21, + MISO: 37, + MOSI: 35, + PWR: 7, + RX_D0: 38, + SCK: 36, + SCL: 4, + SDA: 3, + TX_D1: 39 + }, + productId: "0x3c2ed99e", + sPin: { + LED_PWR: 1, + PWR: 1 + }, + url: "https://www.adafruit.com/product/5000" + }, + adafruit_qt_py_c3: { + $description: "A tiny ESP32-C3 board.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-adafruit_qt_py_c3-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonBOOT", + pin: 9, + service: "button" + } + ], + archId: "esp32c3", + devName: "Adafruit QT Py ESP32-C3 WiFi", + i2c: { + $connector: "Qwiic", + pinSCL: "SCL_D5", + pinSDA: "SDA_D4" + }, + id: "adafruit_qt_py_c3", + led: { + pin: 2, + type: 1 + }, + log: { + pinTX: "TX_D6" + }, + pins: { + A0_D0: 4, + A1_D1: 3, + A2_D2: 1, + A3_D3: 0, + MISO_D9: 8, + MOSI_D10: 7, + RX_D7: 20, + SCK_D8: 10, + SCL_D5: 6, + SDA_D4: 5, + TX_D6: 21 + }, + productId: "0x3693d40b", + url: "https://www.adafruit.com/product/5405" + }, + esp32_bare: { + $description: "Bare ESP32 without any default functions for pins.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32-esp32_bare-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32", + devName: "Espressif ESP32 (bare)", + id: "esp32_bare", + pins: { + P13: 13, + P14: 14, + P18: 18, + P19: 19, + P21: 21, + P22: 22, + P23: 23, + P25: 25, + P26: 26, + P27: 27, + P32: 32, + P33: 33, + P34: 34, + P35: 35, + P36: 36, + P39: 39, + P4: 4 + }, + productId: "0x3ff6ffeb", + url: "https://www.espressif.com/en/products/socs/esp32" + }, + esp32_c3fh4_rgb: { + $description: "A tiny ESP32-C3 board with 5x5 LED array.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32_c3fh4_rgb-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonBOOT", + pin: 9, + service: "button" + } + ], + archId: "esp32c3", + devName: "ESP32-C3FH4-RGB", + i2c: { + $connector: "Qwiic", + pinSCL: 1, + pinSDA: 0 + }, + id: "esp32_c3fh4_rgb", + led: { + isMono: true, + pin: 10 + }, + log: { + pinTX: 21 + }, + pins: { + LEDS: 8, + P2: 2, + P20: 20, + P3: 3, + P4: 4, + P5: 5, + P6: 6, + P7: 7 + }, + productId: "0x3a90885c", + url: "https://github.com/01Space/ESP32-C3FH4-RGB" + }, + esp32_devkit_c: { + $description: "There are currently issues with serial chip on these, best avoid. ESP32-DevKitC development board. This will also work with DOIT DevkitV1, NodeMCU ESP32, ... (search for 'esp32 devkit'). Some of these boards do not have the LED.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32-esp32_devkit_c-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonIO0", + pin: 0, + service: "button" + } + ], + archId: "esp32", + devName: "Espressif ESP32-DevKitC", + id: "esp32_devkit_c", + led: { + pin: 2 + }, + pins: { + P13: 13, + P14: 14, + P18: 18, + P19: 19, + P21: 21, + P22: 22, + P23: 23, + P25: 25, + P26: 26, + P27: 27, + P32: 32, + P33: 33, + P34: 34, + P35: 35, + P4: 4, + VN: 39, + VP: 36 + }, + productId: "0x3c507a05", + url: "https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html" + }, + esp32c3_bare: { + $description: "A bare ESP32-C3 board without any pin functions.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_bare-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonBOOT", + pin: "P9", + service: "button" + } + ], + archId: "esp32c3", + devName: "Espressif ESP32-C3 (bare)", + id: "esp32c3_bare", + log: { + pinTX: "P21" + }, + pins: { + P0: 0, + P1: 1, + P10: 10, + P2: 2, + P20: 20, + P21: 21, + P3: 3, + P4: 4, + P5: 5, + P6: 6, + P7: 7, + P8: 8, + P9: 9 + }, + productId: "0x3a1d89be", + url: "https://www.espressif.com/en/products/socs/esp32-c3" + }, + esp32c3_rust_devkit: { + $description: "A ESP32-C3 dev-board from Espressif with IMU and Temp/Humidity sensor, originally for ESP32 Rust port.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_rust_devkit-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonBOOT", + pin: "P9", + service: "button" + } + ], + archId: "esp32c3", + devName: "Espressif ESP32-C3-RUST-DevKit", + i2c: { + $connector: "Header", + pinSCL: 8, + pinSDA: 10 + }, + id: "esp32c3_rust_devkit", + led: { + pin: 2, + type: 1 + }, + log: { + pinTX: "P21" + }, + pins: { + LED: 7, + P0: 0, + P1: 1, + P20: 20, + P21: 21, + P3: 3, + P4: 4, + P5: 5, + P6: 6, + P9: 9 + }, + productId: "0x33f29c59", + url: "https://github.com/esp-rs/esp-rust-board" + }, + esp32s2_bare: { + $description: "A bare ESP32-S2 board without any pin functions.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-esp32s2_bare-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s2", + devName: "Espressif ESP32-S2 (bare)", + id: "esp32s2_bare", + log: { + pinTX: "P43" + }, + pins: { + P0: 0, + P1: 1, + P10: 10, + P11: 11, + P12: 12, + P13: 13, + P14: 14, + P15: 15, + P16: 16, + P17: 17, + P18: 18, + P2: 2, + P21: 21, + P3: 3, + P33: 33, + P34: 34, + P35: 35, + P36: 36, + P37: 37, + P38: 38, + P39: 39, + P4: 4, + P40: 40, + P41: 41, + P42: 42, + P43: 43, + P44: 44, + P45: 45, + P46: 46, + P5: 5, + P6: 6, + P7: 7, + P8: 8, + P9: 9 + }, + productId: "0x3f140dcc", + url: "https://www.espressif.com/en/products/socs/esp32-s2" + }, + esp32s3_bare: { + $description: "A bare ESP32-S3 board without any pin functions.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s3-esp32s3_bare-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s3", + devName: "Espressif ESP32-S3 (bare)", + id: "esp32s3_bare", + log: { + pinTX: "P43" + }, + pins: { + "#P35": 35, + "#P36": 36, + "#P37": 37, + P0: 0, + P1: 1, + P10: 10, + P11: 11, + P12: 12, + P13: 13, + P14: 14, + P15: 15, + P16: 16, + P17: 17, + P18: 18, + P2: 2, + P21: 21, + P3: 3, + P33: 33, + P34: 34, + P38: 38, + P39: 39, + P4: 4, + P40: 40, + P41: 41, + P42: 42, + P43: 43, + P44: 44, + P45: 45, + P46: 46, + P47: 47, + P48: 48, + P5: 5, + P6: 6, + P7: 7, + P8: 8, + P9: 9 + }, + productId: "0x3e121501", + url: "https://www.espressif.com/en/products/socs/esp32-s3" + }, + esp32s3_devkit_m: { + $description: "ESP32-S3 DevKitM development board. Should also work for DevKitC.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s3-esp32s3_devkit_m-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s3", + devName: "Espressif ESP32-S3 DevKitM", + id: "esp32s3_devkit_m", + led: { + pin: "P48", + type: 1 + }, + log: { + pinTX: "P43" + }, + pins: { + P0: 0, + P1: 1, + P10: 10, + P11: 11, + P12: 12, + P13: 13, + P14: 14, + P15: 15, + P16: 16, + P17: 17, + P18: 18, + P2: 2, + P21: 21, + P3: 3, + P33: 33, + P34: 34, + P38: 38, + P39: 39, + P4: 4, + P40: 40, + P41: 41, + P42: 42, + P43: 43, + P45: 45, + P46: 46, + P47: 47, + P48: 48, + P5: 5, + P6: 6, + P7: 7, + P8: 8, + P9: 9 + }, + productId: "0x3574d277", + url: "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html" + }, + feather_s2: { + $description: "ESP32-S2 based development board in a Feather format.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-feather_s2-0x1000.bin", + $pins: { + P1: "D9", + P10: "D12", + P11: "D13", + P12: "A3", + P14: "A2", + P17: "A0", + P18: "A1", + P3: "D10", + P33: "D5", + P38: "D6", + P5: "A5_D25", + P6: "A4_D24", + P7: "D11", + SDI: "MISO", + SDO: "MOSI" + }, + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonBOOT", + pin: 0, + service: "button" + }, + { + name: "ambientLight", + pin: 4, + service: "analog:lightLevel" + } + ], + archId: "esp32s2", + devName: "Unexpected Maker FeatherS2 ESP32-S2", + i2c: { + $connector: "Qwiic", + pinSCL: "SCL", + pinSDA: "SDA" + }, + id: "feather_s2", + led: { + pin: 40, + pinCLK: 45, + type: 2 + }, + log: { + pinTX: "TX_D1" + }, + pins: { + A0: 17, + A1: 18, + A2: 14, + A3: 12, + A4_D24: 6, + A5_D25: 5, + D10: 3, + D11: 7, + D12: 10, + D13: 11, + D5: 33, + D6: 38, + D9: 1, + LED0: 13, + LED_PWR: 21, + MISO: 37, + MOSI: 35, + RX_D0: 44, + SCK: 36, + SCL: 9, + SDA: 8, + TX_D1: 43 + }, + productId: "0x3126f707", + sPin: { + LED_PWR: 1 + }, + url: "https://unexpectedmaker.com/shop/feathers2-esp32-s2" + }, + msr124: { + $description: "Prototype board", + $fwUrl: "https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-msr124.uf2", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json", + archId: "rp2040", + devName: "MSR RP2040 Brain 124 v0.1", + id: "msr124", + jacdac: { + $connector: "Jacdac", + pin: 9 + }, + led: { + rgb: [ + { + mult: 250, + pin: 16 + }, + { + mult: 60, + pin: 14 + }, + { + mult: 150, + pin: 15 + } + ] + }, + log: { + baud: 115200, + pinTX: 0 + }, + pins: { + "@HILIM": 18, + P1: 1, + P10: 10, + P2: 2, + P24: 24, + P25: 25, + P26: 26, + P27: 27, + P28: 28, + P29: 29, + P3: 3, + P4: 4, + P5: 5, + P6: 6, + P7: 7 + }, + productId: "0x3875e80d", + sPin: { + "#": "enable high power limiter mode", + "@HILIM": 0 + }, + services: [ + { + faultIgnoreMs: 1e3, + mode: 3, + name: "power", + pinEn: 22, + pinFault: 12, + pinLedPulse: 13, + pinPulse: 8, + pinUsbDetect: 11, + service: "power" + } + ] + }, + msr207_v42: { + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-msr207_v42-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s2", + devName: "MSR JM Brain S2-mini 207 v4.2", + id: "msr207_v42", + jacdac: { + $connector: "Jacdac", + pin: 17 + }, + led: { + rgb: [ + { + mult: 250, + pin: 8 + }, + { + mult: 60, + pin: 7 + }, + { + mult: 150, + pin: 6 + } + ] + }, + log: { + pinTX: 43 + }, + pins: { + P33: 33, + P34: 34 + }, + productId: "0x322e0e64", + sd: { + pinCS: 38, + pinMISO: 37, + pinMOSI: 35, + pinSCK: 36 + }, + services: [ + { + faultIgnoreMs: 100, + mode: 0, + name: "power", + pinEn: 2, + pinFault: 13, + service: "power" + } + ] + }, + msr207_v43: { + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-msr207_v43-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s2", + devName: "MSR JM Brain S2-mini 207 v4.3", + id: "msr207_v43", + jacdac: { + $connector: "Jacdac", + pin: 17 + }, + led: { + rgb: [ + { + mult: 250, + pin: 8 + }, + { + mult: 60, + pin: 7 + }, + { + mult: 150, + pin: 6 + } + ] + }, + log: { + pinTX: 43 + }, + pins: { + P33: 33, + P34: 34 + }, + productId: "0x322e0e64", + sd: { + pinCS: 38, + pinMISO: 37, + pinMOSI: 35, + pinSCK: 36 + }, + services: [ + { + faultIgnoreMs: 100, + mode: 1, + name: "power", + pinEn: 2, + pinFault: 13, + service: "power" + } + ] + }, + msr48: { + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32s2-msr48-0x1000.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + archId: "esp32s2", + devName: "MSR JacdacIoT 48 v0.2", + i2c: { + $connector: "Qwiic", + pinSCL: 10, + pinSDA: 9 + }, + id: "msr48", + jacdac: { + $connector: "Jacdac", + pin: 17 + }, + led: { + rgb: [ + { + mult: 250, + pin: 8 + }, + { + mult: 60, + pin: 7 + }, + { + mult: 150, + pin: 6 + } + ] + }, + log: { + pinTX: 43 + }, + pins: { + P33: 33, + P34: 34, + P35: 35, + P36: 36, + RX: 38, + TX: 37 + }, + productId: "0x3de1398b", + services: [ + { + faultIgnoreMs: 100, + mode: 0, + name: "power", + pinEn: 2, + pinFault: 13, + service: "power" + } + ] + }, + msr59: { + $description: "Prototype board", + $fwUrl: "https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-msr59.uf2", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json", + archId: "rp2040", + devName: "MSR Brain RP2040 59 v0.1", + id: "msr59", + jacdac: { + $connector: "Jacdac", + pin: 9 + }, + led: { + rgb: [ + { + mult: 250, + pin: 11 + }, + { + mult: 60, + pin: 13 + }, + { + mult: 150, + pin: 15 + } + ] + }, + log: { + baud: 115200, + pinTX: 2 + }, + pins: { + P26: 26, + P27: 27, + P3: 3, + P4: 4, + P5: 5, + P6: 6 + }, + productId: "0x35a678a3", + services: [ + { + faultIgnoreMs: 100, + mode: 2, + name: "power", + pinEn: 19, + pinFault: 25, + service: "power" + } + ] + }, + pico: { + $description: "RP2040 board from Raspberry Pi.", + $fwUrl: "https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040-pico.uf2", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json", + archId: "rp2040", + devName: "Raspberry Pi Pico", + id: "pico", + led: { + "#": "type=100 - special handling for Pico LED", + pin: 25, + type: 100 + }, + pins: { + GP0: 0, + GP1: 1, + GP10: 10, + GP11: 11, + GP12: 12, + GP13: 13, + GP14: 14, + GP15: 15, + GP16: 16, + GP17: 17, + GP18: 18, + GP19: 19, + GP2: 2, + GP20: 20, + GP21: 21, + GP22: 22, + GP26: 26, + GP27: 27, + GP28: 28, + GP3: 3, + GP4: 4, + GP5: 5, + GP6: 6, + GP7: 7, + GP8: 8, + GP9: 9 + }, + productId: "0x3f6e1f0c", + url: "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html" + }, + pico_w: { + $description: "RP2040 board from Raspberry Pi with a WiFi chip.", + $fwUrl: "https://github.com/microsoft/devicescript-pico/releases/latest/download/devicescript-rp2040w-pico_w.uf2", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json", + archId: "rp2040w", + devName: "Raspberry Pi Pico W", + id: "pico_w", + led: { + "#": "type=100 - special handling for Pico LED", + pin: 25, + type: 100 + }, + pins: { + GP0: 0, + GP1: 1, + GP10: 10, + GP11: 11, + GP12: 12, + GP13: 13, + GP14: 14, + GP15: 15, + GP16: 16, + GP17: 17, + GP18: 18, + GP19: 19, + GP2: 2, + GP20: 20, + GP21: 21, + GP22: 22, + GP26: 26, + GP27: 27, + GP28: 28, + GP3: 3, + GP4: 4, + GP5: 5, + GP6: 6, + GP7: 7, + GP8: 8, + GP9: 9 + }, + productId: "0x3a513204", + url: "https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html" + }, + seeed_xiao_esp32c3: { + $description: "A tiny ESP32-C3 board.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-seeed_xiao_esp32c3-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [ + { + name: "buttonBOOT", + pin: "MISO_D9", + service: "button" + } + ], + archId: "esp32c3", + devName: "Seeed Studio XIAO ESP32C3", + id: "seeed_xiao_esp32c3", + log: { + pinTX: "TX_D6" + }, + pins: { + A0_D0: 2, + A1_D1: 3, + A2_D2: 4, + A3_D3: 5, + MISO_D9: 9, + MOSI_D10: 10, + RX_D7: 20, + SCK_D8: 8, + SCL_D5: 7, + SDA_D4: 6, + TX_D6: 21 + }, + productId: "0x3eff6b51", + url: "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html" + }, + seeed_xiao_esp32c3_msr218: { + $description: "A tiny ESP32-C3 board mounted on base with Jacdac, Qwiic and Grove connectors.", + $fwUrl: "https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-seeed_xiao_esp32c3_msr218-0x0.bin", + $schema: "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", + $services: [], + archId: "esp32c3", + devName: "Seeed Studio XIAO ESP32C3 with MSR218 base", + i2c: { + $connector: "Qwiic", + pinSCL: "SCL", + pinSDA: "SDA" + }, + id: "seeed_xiao_esp32c3_msr218", + jacdac: { + $connector: "Jacdac", + pin: "JD" + }, + led: { + pin: "LED", + type: 1 + }, + log: { + pinTX: "TX" + }, + pins: { + A0: 2, + A1: 3, + A2: 4, + D9: 9, + JD: 5, + LED: 10, + LED_PWR: 8, + RX: 20, + SCL: 7, + SDA: 6, + TX: 21 + }, + productId: "0x36b64827", + sPin: { + LED_PWR: 1 + }, + url: "https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html" + } + } + }; + + // compiler/src/embedspecs.ts + var jacdacDefaultSpecifications = services_default2; + var boardSpecifications = boards_default; + + // compiler/src/prelude.ts + var prelude = { + "cloud/package.json": `{ + "name": "@devicescript/cloud", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/cloud" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "cloud/src/appinsights.ts": `import { cloud } from "./client" +import { publishMessage } from "./messages" + +const EVENT_TOPIC = "tev" +const METRIC_TOPIC = "tme" + +export interface TrackEventOptions { + properties?: Record + measurements?: Record +} + +export interface TrackMetricOptions { + value: number + min?: number + max?: number + variance?: number + count?: number + properties?: Record +} + +/** + * Tracks an event in the application analytics + */ +export async function trackEvent( + name: string, + options?: TrackEventOptions +): Promise { + const { properties: p, measurements: m } = options || {} + await publishMessage(EVENT_TOPIC, { + n: name, + p, + m, + }) +} + +/** + * A metric accumulator + */ +export class Metric { + private sum = 0 + private count = 0 + private min: number = undefined + private max: number = undefined + + private mean = 0 + private M2 = 0 + + /** + * Don't upload when count is 0 + */ + skipEmpty = true + + /** + * Creates a new named metric + * @param name + */ + constructor(readonly name: string, value?: number | number[]) { + this.add(value) + } + + /** + * Aggregate values in metric. Timestamp are not maintained + * @param value + */ + add(value: number | number[]) { + if (typeof value === "number") this.addOne(value) + else if (Array.isArray(value)) for (const v of value) this.addOne(v) + } + + private addOne(v: number) { + if (isNaN(v)) return + this.sum += v + this.count++ + this.min = this.min === undefined ? v : Math.min(this.min, v) + this.max = this.max === undefined ? v : Math.max(this.max, v) + + const delta = v - this.mean + this.mean += delta / this.count + this.M2 += delta * (v - this.mean) + } + + variance(): number { + return this.M2 / (this.count - 1) + } + + asString() { + return "" + this.mean + } + + /** + * Upload current aggregated values and reset + */ + async upload() { + // no data + if (this.skipEmpty && this.count === 0) return + + // not bound + if (!cloud.isBound) return + + // not connected to cloud, don't send + const connected = await cloud.connected.read() + if (!connected) return + + // ready to send + const value = this.mean + const variance = this.variance() + const payload = { + value, + count: this.count, + min: this.min, + max: this.max, + variance, + } + this.sum = 0 + this.count = 0 + this.min = undefined + this.max = undefined + this.mean = 0 + this.M2 = 0 + await trackMetric(this.name, payload) + } +} + +/** + * Creates a new metric accumulator + * @param name name of the metric + * @param value optional value or array of value + */ +export function createMetric(name: string, value?: number | number[]) { + return new Metric(name, value) +} + +/** + * Uploads a metric in the application analytics. It is recommended to use \`createMetric\` to accumulate data. + * @param name + * @param options + */ +export async function trackMetric( + name: string, + options: TrackMetricOptions +): Promise { + const { + value: v, + min: mi, + max: ma, + count: c, + variance: a, + properties: p, + } = options || {} + await publishMessage(METRIC_TOPIC, { + n: name, + v, + mi, + ma, + c, + a, + p, + }) +} + +/** + * Track error in the cloud + * @param error + */ +export function trackException(error: Error) { + if (error) error.print() +} +`, + "cloud/src/client.ts": `import * as ds from "@devicescript/core" + +/** + * The cloud adapter client + */ +export const cloud = new ds.CloudAdapter() +`, + "cloud/src/env.ts": `import { subscribeMessage, publishMessage } from "./messages" +import { cloud } from "./client" +import { readSetting, writeSetting } from "@devicescript/settings" +import { ObservableValue, register } from "@devicescript/observables" + +const ENV_TOPIC = "env" +let _env: ObservableValue + +/** + * Gets an observable environment register that may get updated by the cloud. + * @param defaultValues default values if no cloud values are available + * @returns environment + */ +export async function environment( + defaultValues?: T +): Promise> { + if (_env) return _env + + const old = await readSetting(ENV_TOPIC, defaultValues || {}) + _env = register(old || {}) + + // receive env messages + subscribeMessage(ENV_TOPIC, async (newValue: any) => { + console.log(\`cloud: received env\`) + console.debug(newValue) + await writeSetting(ENV_TOPIC, newValue) + await _env.emit(newValue) + }) + // query env when cloud restarts + cloud.connected.subscribe(async curr => { + if (curr) { + await publishMessage(ENV_TOPIC, {}) + } + }) + if (await cloud.connected.read()) { + await publishMessage(ENV_TOPIC, {}) + } + return _env +} +`, + "cloud/src/index.ts": `export * from "./appinsights" +export * from "./messages" +export * from "./client" +export * from "./env" +`, + "cloud/src/main.ts": `import * as ds from "@devicescript/core" +import { + createMetric, + environment, + trackEvent, + trackException, + trackMetric, + publishMessage, +} from "." +import { describe, test } from "@devicescript/test" + +console.log("start test") +await trackEvent("cloud.test.start") +await trackMetric("start", { value: ds.millis() }) + +describe("trackEvent", () => { + test("call", async () => { + await trackEvent("test.cloud") + }) + test("properties", async () => { + await trackEvent("test.props", { properties: { a: "a" } }) + }) + test("measurements", async () => { + await trackEvent("test.mes", { measurements: { a: 1 } }) + }) +}) +describe("trackMetric", () => { + test("ctor", async () => { + const m = createMetric("test.metric", 1) + await m.upload() + }) + test("value", async () => { + const m = createMetric("test.metric") + m.add(1) + await m.upload() + }) + test("array", async () => { + const m = createMetric("test.metric.array") + m.add([1, 2, 3]) + await m.upload() + }) +}) +describe("trackException", () => { + test("throw", () => { + try { + throw new Error("ouch") + } catch (e) { + trackException(e as Error) + } + }) +}) +describe("trackMetric", () => { + test("value", async () => { + await trackMetric("test.metric", { value: 1 }) + }) + test("min", async () => { + await trackMetric("test.min", { value: 1, min: 2 }) + }) + test("max", async () => { + await trackMetric("test.max", { value: 1, max: 3 }) + }) + test("stddev", async () => { + await trackMetric("test.stddev", { value: 1, variance: 4 }) + }) + test("count", async () => { + await trackMetric("test.count", { value: 1, count: 5 }) + }) +}) +describe("metric", () => { + test("upload.array", async () => { + const m = createMetric("test.metric") + m.add([0, 1, 2]) + await m.upload() + }) + test("upload.array", async () => { + const m = createMetric("test.metric.array") + m.add(1) + m.add(2) + await m.upload() + }) +}) +describe("upload message", () => { + test("upload", async () => { + await publishMessage("cloud/tests", { + t: ds.millis(), + }) + }) + test("upload2", async () => { + await publishMessage("cloud/tests", { + t: ds.millis(), + }) + await publishMessage("cloud/tests", { + t: ds.millis(), + }) + }) +}) +describe("environment", () => { + test("env", async () => { + const env = await environment() + await ds.delay(1500) + const value = await env.read() + console.log(value) + }) +}) + +await trackMetric("end", { value: ds.millis() }) +`, + "cloud/src/messages.ts": `import * as ds from "@devicescript/core" +import { cloud } from "./client" + +/** + * Uploads a message to the cloud + */ +export async function publishMessage(topicName: string, payload: any) { + // reduce payload size + if (typeof payload === "object") + Object.keys(payload) + .filter(k => payload[k] === undefined) + .forEach(k => delete payload[k]) + await cloud.uploadJson(topicName, JSON.stringify(payload)) +} + +/** + * Subscribes to the incoming cloud message. Does not support wildcards (yet). + * @param next called on every message + * @returns unsubscribe handler + */ +export function subscribeMessage( + topicName: "*" | string, + next: (curr: TMessage, topic: string) => ds.AsyncVoid +) { + return cloud.onJson.subscribe(async (arg: string[]) => { + const [topic, json] = arg + if (topicName === "*" || topic === topicName) { + const payload = JSON.parse(json) as TMessage + await next(payload, topic) + } + }) +} +`, + "core/package.json": `{ + "name": "@devicescript/core", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/core" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "core/src/array.ts": `Array.prototype.at = function (index) { + if (index < 0) { + const length = this.length + return this[length + index]; + } + return this[index]; + +} + +Array.prototype.map = function (f) { + const res: any[] = [] + const length = this.length + for (let i = 0; i < length; ++i) { + res.push(f(this[i], i, this)) + } + return res +} + +Array.prototype.forEach = function (f) { + const length = this.length + for (let i = 0; i < length; ++i) { + f(this[i], i, this) + } +} + +Array.prototype.find = function (f) { + const length = this.length + for (let i = 0; i < length; ++i) { + if (f(this[i], i, this)) return this[i] + } + return undefined +} + +Array.prototype.findIndex = function (f) { + const length = this.length + for (let i = 0; i < length; ++i) { + if (f(this[i], i, this)) return i + } + return -1 +} + +Array.prototype.findLast = function (f) { + const length = this.length; + for (let i = length - 1; i >= 0; i--) { + if (f(this[i], i, this)) return this[i] + } + return undefined; +} + +Array.prototype.findLastIndex = function (f) { + const length = this.length + for (let i = length - 1; i >= 0; i--) { + if (f(this[i], i, this)) return i + } + return -1 +} + +Array.prototype.with = function (index: number, value: T): T[] { + if (isNaN(index) || typeof index !== "number") { + throw new TypeError("Index must be a number") + } + + if (index < -this.length || index >= this.length) { + throw new RangeError("Index out of bounds") + } + + if (index < 0) { + index = this.length + index + } + + const newArray = [...this] + newArray[index] = value + + return newArray +} + +Array.prototype.filter = function (f) { + const res: any[] = [] + const length = this.length + for (let i = 0; i < length; ++i) { + if (f(this[i], i, this)) res.push(this[i]) + } + return res +} + +Array.prototype.every = function (f) { + const length = this.length + for (let i = 0; i < length; ++i) { + if (!f(this[i], i, this)) return false + } + return true +} + +Array.prototype.fill = function (value, start, end) { + const length = this.length + let startIndex = start ?? 0 + if (startIndex < -length) { + startIndex = 0 + } + + if (startIndex < 0) { + startIndex = startIndex + length + } + + let endIndex = end ?? length + if (endIndex >= length ) { + endIndex = length + } + + if (endIndex < 0) { + endIndex = endIndex + length + } + + if (endIndex < -length) { + endIndex = 0 + } + + for (let i = startIndex; i < endIndex; ++i) { + + this[i] = value; + } + + return this; +} + +Array.prototype.some = function (f) { + const length = this.length + for (let i = 0; i < length; ++i) { + if (f(this[i], i, this)) return true + } + return false +} + +Array.prototype.includes = function (el, fromIndex) { + const length = this.length + const start = fromIndex || 0 + for (let i = start; i < length; ++i) { + if (el === this[i]) return true + } + return false +} + +Array.prototype.pop = function () { + const length = this.length - 1 + if (length < 0) return undefined + const r = this[length] + this.insert(length, -1) + return r +} + +Array.prototype.shift = function () { + if (this.length === 0) return undefined + const r = this[0] + this.insert(0, -1) + return r +} + +Array.prototype.unshift = function (...elts: any[]) { + this.insert(0, elts.length) + for (let i = 0; i < elts.length; ++i) this[i] = elts[i] + return this.length +} + +Array.prototype.indexOf = function (elt, from) { + const length = this.length + if (from == undefined) from = 0 + while (from < length) { + if (this[from] === elt) return from + from++ + } + return -1 +} + +Array.prototype.lastIndexOf = function (elt, from) { + if (from == undefined) from = this.length - 1 + while (from >= 0) { + if (this[from] === elt) return from + from-- + } + return -1 +} + +Array.prototype.reduce = function (callbackfn: any, initialValue: any) { + const len = this.length + for (let i = 0; i < len; ++i) { + initialValue = callbackfn(initialValue, this[i], i) + } + return initialValue +} + +Array.prototype.sort = function (compareFn?: (a: T, b: T) => number) { + if (!compareFn) { + compareFn = (a: any, b: any) => { + a = a + "" + b = b + "" + if (a < b) return -1 + else if (a > b) return 1 + else return 0 + } + } + + for (let i = 1; i < this.length; i++) { + const current = this[i] + let j = i - 1 + while (j >= 0 && compareFn(this[j], current) > 0) { + this[j + 1] = this[j] + j-- + } + this[j + 1] = current + } + + return this +} + +Buffer.prototype.set = function (other: Buffer, trgOff?: number) { + if (!trgOff) trgOff = 0 + this.blitAt(trgOff, other, 0, other.length) +} + +Buffer.prototype.concat = function (other: Buffer) { + const r = Buffer.alloc(this.length + other.length) + r.set(this) + r.set(other, this.length) + return r +} + +Buffer.prototype.slice = function (start?: number, end?: number) { + if (end === undefined) end = this.length + if (start === undefined) start = 0 + const len = end - start + if (len <= 0 || start >= this.length) return Buffer.alloc(0) + const r = Buffer.alloc(len) + r.blitAt(0, this, start, len) + return r +} + +Buffer.concat = function (...buffers: Buffer[]) { + let size = 0 + for (const b of buffers) { + size += b.length + } + const r = Buffer.alloc(size) + size = 0 + for (const b of buffers) { + r.blitAt(size, b, 0, b.length) + size += b.length + } + return r +} + +Buffer.prototype.lastIndexOf = function (byte, startOffset, endOffset) { + if (endOffset == undefined) endOffset = this.length + return this.indexOf(byte, startOffset, -endOffset) +} +`, + "core/src/buffer.ts": `import * as ds from "@devicescript/core" + +declare module "@devicescript/core" { + interface Buffer { + /** + * Reads the bit at the given bit index. + * @param bitindex + */ + getBit(bitindex: number): boolean + /** + * Sets the bit at the given index + * @param bitindex + * @param on + */ + setBit(bitindex: number, on: boolean): void + + /** + * Reads an unsigned, low-endian 16-bit integer at the specified offset. + */ + readUInt16LE(offset: number): number + + /** + * Reads an unsigned, big-endian 16-bit integer at the specified offset. + */ + readUInt16BE(offset: number): number + + /** + * Reads an unsigned, low-endian 32-bit integer at the specified offset. + */ + readUInt32LE(offset: number): number + + /** + * Reads an unsigned, big-endian 32-bit integer at the specified offset. + */ + readUInt32BE(offset: number): number + } +} + +ds.Buffer.prototype.getBit = function getBit(bitindex: number) { + // find bit to flip + const byte = this[bitindex >> 3] + const bit = bitindex % 8 + const on = 1 === ((byte >> bit) & 1) + return on +} + +ds.Buffer.prototype.setBit = function setBit(bitindex: number, on: boolean) { + const i = bitindex >> 3 + // find bit to flip + let byte = this[i] + const bit = bitindex % 8 + // flip bit + if (on) { + byte |= 1 << bit + } else { + byte &= ~(1 << bit) + } + // save + this[i] = byte +} + +ds.Buffer.prototype.readUInt16LE = function readUInt16LE(offset: number) { + return this.getAt(offset, "u16") +} + +ds.Buffer.prototype.readUInt16BE = function readUInt16BE(offset: number) { + if (offset < 0 || offset + 2 > this.length) return 0 + return (this[offset] << 8) | this[offset + 1] +} + +ds.Buffer.prototype.readUInt32LE = function readUInt32LE(offset: number) { + return this.getAt(offset, "u32") +} + +ds.Buffer.prototype.readUInt32BE = function readUInt32BE(offset: number) { + if (offset < 0 || offset + 4 > this.length) return 0 + return ( + (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3] + ) +} +`, + "core/src/button.ts": `import * as ds from "@devicescript/core" + +ds.Button.prototype.pressed = function pressed() { + let reg: ds.ClientRegister = (this as any).__pressed + if (!reg) { + reg = ds.clientRegister(false) + ;(this as any).__pressed = reg + this.down.subscribe(() => reg.emit(true)) + this.hold.subscribe(() => reg.emit(true)) + this.up.subscribe(() => reg.emit(false)) + } + return reg +} +`, + "core/src/buzzer.ts": `import * as ds from "@devicescript/core" + +ds.Buzzer.prototype.playNote = async function (frequency, volume, duration) { + const p = 1000000 / frequency + volume = Math.constrain(volume, 0, 1) + await this.playTone(p, p * volume * 0.5, duration) +} +`, + "core/src/corelib.d.ts": `/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +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 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +// Adapted from TypeScript's lib.es5.d.ts + +/// + +declare var NaN: number +declare var Infinity: number + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function +} + +interface ObjectConstructor { + (): any + (value?: any): Object + new (value?: any): Object + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U + + /** + * Returns the names of the enumerable string properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: {}): string[] + + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: { [s: string]: T } | T[]): T[] + + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: {}): any[] + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + // getPrototypeOf(o: any): any + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: object | null): any +} + +declare var Object: ObjectConstructor + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string +} +interface CallableFunction extends Function {} +interface NewableFunction extends Function {} + +interface IArguments { + [index: number]: any + length: number + callee: Function +} + +interface String { + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string + + /** Returns the length of a String object. */ + readonly length: number + + /** Returns the length in bytes of UTF8 encoding of a String object. */ + readonly byteLength: number + + [Symbol.iterator](): IterableIterator + readonly [index: number]: string + + /** + * Returns the position of the first occurrence of a substring. + * When \`endPosition < position\` the search if performed in reverse. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + * @param endPosition \`position <= return_value < endPosition || return_value == -1\` (and \`endPosition < 0\` has special meaning) + */ + indexOf( + searchString: string, + position?: number, + endPosition?: number + ): number + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition \u2013 length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean + + /** Converts all the alphabetic characters in a string to lowercase. Currently ASCII-only. */ + toLowerCase(): string + + /** Converts all the alphabetic characters in a string to uppercase. Currently ASCII-only. */ + toUpperCase(): string + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[] +} + +interface StringConstructor { + readonly prototype: String + /** + * Construct a new string from given 21-bit Unicode code-points. + */ + fromCharCode(...codes: number[]): string +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor + +interface Boolean {} +interface Number {} + +interface RegExp {} +interface IterableIterator {} + +interface SymbolConstructor { + readonly iterator: unique symbol +} +declare var Symbol: SymbolConstructor + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest index in the array. + */ + length: number + [n: number]: T + [Symbol.iterator](): IterableIterator + + /** + * Returns the item located at the specified index. + * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. + */ + at(index: number): T | undefined + + /** + * Insert \`count\` \`undefined\` elements at \`index\`. + * If \`count\` is negative, remove elements. + */ + insert(index: number, count: number): void + + /** + * Appends new elements to the end of an array, and returns the new length of the array. + * @param items New elements to add to the array. + */ + push(...items: T[]): number + + /** + * Appends new elements to the end of an array, and returns the new length of the array. + * @param items New elements to add to the array. + */ + pushRange(items: T[]): number + + /** + * Removes the last element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + pop(): T | undefined + + /** + * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number + + /** + * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number + + /** + * Returns a copy of a section of an array. + * For both start and end, a negative index can be used to indicate an offset from the end of the array. + * For example, -2 refers to the second to last element of the array. + * @param start The beginning index of the specified portion of the array. + * If start is undefined, then the slice begins at index 0. + * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. + * If end is undefined, then the slice extends to the end of the array. + */ + slice(start?: number, end?: number): T[] + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + */ + every(predicate: (value: T, index: number, array: T[]) => unknown): boolean + + /** + * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + */ + some(predicate: (value: T, index: number, array: T[]) => unknown): boolean + + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void): void + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U): U[] + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + */ + filter(predicate: (value: T, index: number, array: T[]) => unknown): T[] + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + */ + find(predicate: (value: T, index: number, array: T[]) => unknown): T + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + */ + findIndex(predicate: (value: T, index: number, obj: T[]) => unknown): number + + /** + * Returns the value of the last element in the array where predicate is true, and undefined + * otherwise. + * @param predicate findLast calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, findLast + * immediately returns that element value. Otherwise, findLast returns undefined. + */ + findLast( + predicate: (value: T, index: number, array: T[]) => unknown + ): T | undefined + + /** + * Returns the index of the last element in the array where predicate is true, and -1 + * otherwise. + * @param predicate findLastIndex calls predicate once for each element of the array, in descending + * order, until it finds one where predicate returns true. If such an element is found, + * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + */ + findLastIndex( + predicate: (value: T, index: number, array: T[]) => unknown + ): number + + /** + * Returns a new array with the element at the given index replaced with the given value. + * @param index The zero-based index at which to change the array, converted to an integer. + * If index is negative, index + array.length is used. + * @param value Any value to be assigned to the given index. + * @returns A new array with the element at the specified index replaced with the given value. + * @throws {RangeError} If index is out of bounds (index >= array.length or index < -array.length). + */ + with(index: number, value: T): T[] + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce( + callbackfn: ( + previousValue: T, + currentValue: T, + currentIndex: number, + array: T[] + ) => T, + initialValue?: T + ): T + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: T[] + ) => U, + initialValue: U + ): U + + /** + * Removes the first element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + shift(): T | undefined + + /** + * Inserts new elements at the start of an array, and returns the new length of the array. + * @param items Elements to insert at the start of the array. + */ + unshift(...items: T[]): number + + /** + * Adds all the elements of an array into a string, separated by the specified separator string. + * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string + + /** + * Sorts an array in place using insertion sort -> O(n^2) complexity. + * This method mutates the array and returns a reference to the same array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive + * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. + * \`\`\`ts + * [11,2,22,1].sort((a, b) => a - b) + * \`\`\` + */ + sort(compareFn?: (a: T, b: T) => number): this +} + +interface ArrayConstructor { + new (arrayLength?: number): any[] + new (arrayLength: number): T[] + new (...items: T[]): T[] + + (arrayLength?: number): any[] + (...items: T[]): T[] + + (arrayLength: number): T[] + isArray(arg: any): arg is any[] + readonly prototype: any[] +} + +declare var Array: ArrayConstructor + +declare namespace console { + /** + * Same as \`console.log\`. + */ + function info(...args: any[]): void + + /** + * Print out message at INFO logging level (prefix: \`> \`). + */ + function log(...args: any[]): void + + /** + * Print out message at DEBUG logging level (prefix: \`? \`). + */ + function debug(...args: any[]): void + + /** + * Print out message at WARNING logging level (prefix: \`* \`). + */ + function warn(...args: any[]): void + + /** + * Print out message at ERROR logging level (prefix: \`! \`). + */ + function error(...args: any[]): void + + /** + * Print out an object with timestamp for data analysis (prefix: \`# \${ms} \`). + */ + function data(object: {}): void +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number + /** The natural logarithm of 10. */ + readonly LN10: number + /** The natural logarithm of 2. */ + readonly LN2: number + /** The base-2 logarithm of e. */ + readonly LOG2E: number + /** The base-10 logarithm of e. */ + readonly LOG10E: number + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number + /** The square root of 2. */ + readonly SQRT2: number + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number + /** + * Returns the smallest integer greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number + /** + * Returns the greatest integer less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number + /** Returns a pseudorandom number between 0 and 1. */ + random(): number + /** + * Returns a supplied numeric expression rounded to the nearest integer. + * @param x The value to be rounded to the nearest integer. + */ + round(x: number): number + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number + + // ES2015: + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number + + /** + * Maps value from the [\`originalMin\`, \`originalMax\`] interval to the [\`newMin\`, \`newMax\`] interval. + * @param value Value to map + * @param originalMin Original interval minimum + * @param originalMax Original interval maximum + * @param newMin New interval minimum + * @param newMax New interval maximum + * @returns mapped value + */ + map( + value: number, + originalMin: number, + originalMax: number, + newMin: number, + newMax: number + ): number + + /** + * Constrains a number to be within a range. + * @param value value to constrain + * @param min minimum limit + * @param max maximum limit + * @returns constrained value + */ + constrain(value: number, min: number, max: number): number +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math + +interface TemplateStringsArray {} + +interface Error { + /** + * "Error", "TypeError" etc. + */ + name: string + /** + * Reason for error. + */ + message: string + /** + * Logs the exception message and stack. + */ + print(): void + + // stack not impl. yet + // stack?: string + + /** + * Binary-encoded stack-dump. + */ + __stack__: Buffer +} + +interface ErrorConstructor { + new (message?: string): Error + (message?: string): Error + readonly prototype: Error +} +declare var Error: ErrorConstructor + +interface RangeError extends Error {} +interface RangeErrorConstructor extends ErrorConstructor { + new (message?: string): RangeError + (message?: string): RangeError + readonly prototype: RangeError +} +declare var RangeError: RangeErrorConstructor + +interface TypeError extends Error {} +interface TypeErrorConstructor extends ErrorConstructor { + new (message?: string): TypeError + (message?: string): TypeError + readonly prototype: TypeError +} +declare var TypeError: TypeErrorConstructor + +interface SyntaxError extends Error {} +interface SyntaxErrorConstructor extends ErrorConstructor { + new (message?: string): SyntaxError + (message?: string): SyntaxError + readonly prototype: SyntaxError +} +declare var SyntaxError: SyntaxErrorConstructor + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + */ + parse(text: string): any + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Replacer is not supported. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: null, space?: number): string +} +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON + +/** + * Value returned from async functions, needs to be awaited. + */ +interface Promise { + _useAwaitPlease(): void +} + +interface PromiseLike { + _useAwaitPlease(): void +} + +interface PromiseConstructor { + /** + * Do not use. + */ + new (): Promise +} + +declare var Promise: PromiseConstructor + +/** + * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to \`never\`. This emulates the behavior of \`await\`. + */ +type Awaited = T extends null | undefined + ? T // special case for \`null | undefined\` when not in \`--strictNullChecks\` mode + : T extends object & { then(onfulfilled: infer F, ...args: infer _): any } // \`await\` only unwraps object types with a callable \`then\`. Non-object types are not unwrapped + ? F extends (value: infer V, ...args: infer _) => any // if the argument to \`then\` is callable, extracts the first argument + ? Awaited // recursively unwrap the value + : never // the argument to \`then\` was not callable + : T // non-object or non-thenable + +// utility types + +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P] +} + +/** + * Make all properties in T required + */ +type Required = { + [P in keyof T]-?: T[P] +} + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P] +} + +/** + * From T, pick a set of properties whose keys are in the union K + */ +type Pick = { + [P in K]: T[P] +} + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T +} + +/** + * Exclude from T those types that are assignable to U + */ +type Exclude = T extends U ? never : T + +/** + * Extract from T those types that are assignable to U + */ +type Extract = T extends U ? T : never + +/** + * Construct a type with the properties of T except for those in type K. + */ +type Omit = Pick> + +/** + * Exclude null and undefined from T + */ +type NonNullable = T & {} + +/** + * Obtain the parameters of a function type in a tuple + */ +type Parameters any> = T extends ( + ...args: infer P +) => any + ? P + : never + +/** + * Obtain the parameters of a constructor function type in a tuple + */ +type ConstructorParameters any> = + T extends abstract new (...args: infer P) => any ? P : never + +/** + * Obtain the return type of a function type + */ +type ReturnType any> = T extends ( + ...args: any +) => infer R + ? R + : any + +/** + * Obtain the return type of a constructor function type + */ +type InstanceType any> = + T extends abstract new (...args: any) => infer R ? R : any + +/** + * Convert string literal type to uppercase + */ +type Uppercase = intrinsic + +/** + * Convert string literal type to lowercase + */ +type Lowercase = intrinsic + +/** + * Convert first character of string literal type to uppercase + */ +type Capitalize = intrinsic + +/** + * Convert first character of string literal type to lowercase + */ +type Uncapitalize = intrinsic +`, + "core/src/devicescript-core.d.ts": `/// + +declare module "@devicescript/core" { + export type AsyncValue = T | Promise + export type AsyncVoid = AsyncValue + export type AsyncBoolean = AsyncValue + export type Callback = () => AsyncVoid + export type Unsubscribe = () => void + export type Handler = (v: T) => AsyncVoid + export type PktHandler = Handler + + /** + * Generic interface for subscribing to events. + */ + export interface Subscriber { + subscribe(f: Handler): Unsubscribe + } + + /** + * Generic interface for event emitters. Use \`ds.emitter()\` to create one. + */ + export interface Emitter extends Subscriber { + emit(v: T): void + } + + /** + * A register like structure. Use \`ds.clientRegister()\` to create one. + */ + export interface ClientRegister { + /** + * Reads the current value + */ + read(): Promise + + /** + * Subscribe a change handler to value changes + * @param next + * @return unsubscribe + */ + subscribe(next: (v: T) => AsyncVoid): Unsubscribe + + /** + * Sends the new value to subscriptions + * @param newValue + */ + emit(newValue: T): void + } + + /** + * A base class for service clients + */ + // TODO: rename to serviceclient? + export class Role { + /** + * @internal + * @deprecated internal field for runtime support + */ + readonly isBound: boolean + + readonly spec: ServiceSpec + + /** + * Emitted whenever a report is received. + */ + report(): Subscriber + + /** + * Gets the state of the binding with a jacdac server + */ + binding(): ClientRegister + + /** + * @internal + */ + sendCommand(serviceCommand: number, payload?: Buffer): Promise + + /** + * @internal + * @deprecated internal field for runtime support + */ + _onPacket(pkt: Packet): Promise + } + + export class Packet { + readonly role: Role + + readonly spec: PacketSpec + + /** + * 16 character lowercase hex-encoding of 8 byte device identifier. + */ + readonly deviceIdentifier: string + + /** + * 4 character hash of \`deviceIdentifier\` + */ + readonly shortId: string + + readonly serviceIndex: number + readonly serviceCommand: number + readonly payload: Buffer + + decode(): any + + /** + * Frame flags. + */ + readonly flags: number + + /** + * Check whether is \`command\` flag on frame is cleared + */ + readonly isReport: boolean + + /** + * Check whether is \`command\` flag on frame is set + */ + readonly isCommand: boolean + + /** + * Check if report and it is an event + */ + readonly isEvent: boolean + + /** + * \`undefined\` if not \`isEvent\` + */ + readonly eventCode: number + + /** + * Is it register set command. + */ + readonly isRegSet: boolean + + /** + * Is it register get command or report. + */ + readonly isRegGet: boolean + + /** + * \`undefined\` is neither \`isRegSet\` nor \`isRegGet\` + */ + readonly regCode: number + + /** + * True for plain \`command\`/\`report\` (not register and not event) + */ + readonly isAction: boolean + + notImplemented(): Packet + } + + export class Fiber { + /** + * Unique number identifying the fiber. + */ + readonly id: number + + /** + * Check if fiber is currently suspended. + */ + readonly suspended: boolean + + /** + * If the fiber is currently suspended, mark it for resumption, passing the specified value. + * Otherwise, throw a \`RangeError\`. + */ + resume(v: any): void + + /** + * Stop given fiber (which can be current fiber). + */ + terminate(): void + + /** + * Get reference to the current fiber. + */ + static self(): Fiber + } + + global { + interface Function { + /** + * Start function in background passing given arguments. + */ + start(...args: any[]): Fiber + } + } + + export class ServiceSpec { + readonly name: string + readonly classIdentifier: number + assign(packet: Packet): void + lookup(name: string): PacketSpec + byCode(code: number): PacketSpec + } + + export class PacketSpec { + readonly parent: ServiceSpec + readonly name: string + readonly code: number + readonly response?: PacketSpec + readonly type: "action" | "register" | "report" | "event" + encode(v: T): Packet + } + + export type EventSpec = PacketSpec & { type: "event" } + export type RegisterSpec = PacketSpec & { type: "register" } + export type ActionSpec = PacketSpec & { type: "action" } + export type ReportSpec = PacketSpec & { type: "report" } + + export interface ServerInterface { + serviceIndex: number + debug?: boolean + readonly spec: ServiceSpec + _send(pkt: Packet): Promise + } + + /** + * A base class for registers, events. + */ + export class PacketInfo { + readonly name: string + readonly code: number + readonly role: Role + } + + /** + * A base class for register clients. + */ + // TODO: support for "isImplemented?" + export class Register extends PacketInfo { + /** + * Gets the current value of the register as a number. + * @returns a promise that returns the value (blocks until the read is complete). + */ + read(): Promise + + /** + * Sets the current value of the register. + * @param value value to assign to the register + * @returns a promise until the write is complete (blocks until a server is bound). + */ + write(value: T): Promise + + /** + * Registers a callback to execute when a register value is received + * @param handler callback to execute + */ + subscribe(handler: (curr: T) => AsyncVoid): Unsubscribe + } + + export class Event extends PacketInfo { + /** + * Blocks the current thread under the event is received. + */ + wait(timeout?: number): Promise + /** + * Registers a callback to execute when an event is received + * @param next callback to execute + */ + subscribe(next: (curr: T) => AsyncVoid): Unsubscribe + } + + /** + * Format string. Best use backtick templates instead. + */ + export function format(fmt: string, ...args: number[]): string + + /** + * Wait for specified number of milliseconds. + * @alias delay + */ + export function sleep(milliseconds: number): Promise + + /** + * Wait for specified number of milliseconds. + * @alias sleep + */ + export function delay(ms: number): Promise + + /** + * Wait for resumption from other fiber. If the timeout expires, \`undefined\` is returned, + * otherwise the value passed from the resuming fiber. + * Timeout defaults to infinity. + */ + export function suspend(milliseconds?: number): Promise + + /** + * Create a new generic emitter. + */ + export function emitter(): Emitter + + /** + * Create a new client register, using the given initial value. + */ + export function clientRegister(value: T): ClientRegister + + /** + * Wait for a given emitter to be activated. + * Returns \`undefined\` when \`timeout\` expires (defaults to Infinity). + */ + export function wait(l: Subscriber, timeout?: number): Promise + + /** + * Restart current script. + */ + export function restart(): never + + /** + * Reboot the device. + */ + export function reboot(): never + + /** + * Best use \`throw new Error(...)\` instead. + * @internal + * @deprecated internal field for runtime support + */ + export function _panic(code: number): never + + /** + * Mark method as used but do not call it. + */ + export function keep(method: any): void + + /** + * Print out internal representation of a given value, possibly prefixed by label. + * @internal + * @deprecated internal field for runtime support + */ + export function _logRepr(v: any, label?: string): void + + /** + * Identity function, used to prevent constant folding. + * @internal + * @deprecated internal field for runtime support + */ + export function _id(a: T): T + + /** + * Allocate a new service client. + * @internal + * @deprecated Use \`new ds.ServiceName()\` + */ + export function _allocRole(cls: number, name?: string): Role + + /** + * Return number of milliseconds since device boot or program start. + * Note that it only changes upon \`await\`. + */ + export function millis(): number + + /** + * Get value of a device configuration setting (typically from .board.json file). + */ + export function _dcfgString( + id: "archId" | "url" | "devName" | "@name" | "@version" + ): string + + /** + * Send message to the twin in the dashboard. + */ + export function _twinMessage( + topic: string, + data: string | Buffer + ): Promise + + /** + * Return hex-encoded device 64 bit device identifier of the current device or its server counterpart + */ + export function deviceIdentifier(which: "self" | "server"): string + + /** + * Throw an exception if the condition is not met. + */ + export function assert(cond: boolean, msg?: string): void + + /** + * Check if running inside a simulator. + */ + export function isSimulator(): boolean + + /* + * Print out message. Used by console.log, etc. + */ + // don't expose for now as we may want to change it + // export function print(prefixCharCode: number, msg: string): void + + /** + * Wait for action response on the role. + * @param role the role + * @param action name of the action + * @param sendActionCommand should send the command + * @returns the first matching packet + */ + export function actionReport( + role: T, + action: string & keyof T, + sendActionCommand: Callback, + filter?: (p: Packet) => boolean + ): Promise + + export { Buffer } + + global { + /** + * Compiles hex-encoded data as a buffer in flash + * @param lits hex-encoded string literal + * @param args + */ + function hex(lits: any, ...args: any[]): Buffer + + class Buffer { + private constructor() + + static alloc(size: number): Buffer + + static from( + data: string, + encoding?: undefined | "utf-8" | "utf8" | "hex" + ): Buffer + static from(data: Buffer | number[]): Buffer + + static concat(...buffers: Buffer[]): Buffer + + /** + * Gets the length in bytes of the buffer + */ + readonly length: number + setLength(len: number): void + getAt(offset: number, format: string): number + setAt(offset: number, format: string, value: number): void + blitAt( + offset: number, + src: Buffer | string, + srcOffset: number, + len: number + ): void + fillAt(offset: number, length: number, value: number): void + /** + * Return index of specified byte in buffer or -1 if not found. + * @param byte + * @param startOffset defaults to 0 + * @param endOffset defaults to buffer length (\`endOffset < 0\` has special meaning) + */ + indexOf( + byte: number, + startOffset?: number, + endOffset?: number + ): number + lastIndexOf( + byte: number, + startOffset?: number, + endOffset?: number + ): number + [idx: number]: number + + toString(encoding?: "hex" | "utf-8" | "utf8"): string + + set(from: Buffer, targetOffset?: number): void + concat(other: Buffer): Buffer + slice(from?: number, to?: number): Buffer + + /** + * Rotate buffer left in place. + * @param offset number of bytes to shift; use negative value to shift right + * @param from start offset in buffer. Default is 0. + * @param to end offset in buffer. Defaults to buffer length. + */ + rotate(shift: number, from?: number, to?: number): void + } + + /** + * Converts a string to an integer. + * @param string A string to convert into a number. + */ + function parseInt(string: string): number + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + function parseFloat(string: string): number + } + + // + // Timeouts + // + + export { + setTimeout, + setInterval, + clearTimeout, + clearInterval, + updateInterval, + } + global { + /** + * Schedule a function to be called after specified number of milliseconds. + */ + function setTimeout( + callback: () => void | Promise, + ms: number + ): number + + /** + * Cancel previously scheduled function. + * @param id value returned from setTimeout() + */ + function clearTimeout(id: number): void + + /** + * Schedule a function to be called periodically, every \`ms\` milliseconds. + */ + function setInterval( + callback: () => void | Promise, + ms: number + ): number + + /** + * Cancel previously scheduled periodic callback. + * @param id value returned from setInterval() + */ + function clearInterval(id: number): void + + /** + * Update period on an existing interval. + * @param id value returned from setInterval() + * @param ms new period + */ + function updateInterval(id: number, ms: number): void + } + + // + // Pins + // + + /** + * Digital pin value, 0 or 1. + */ + export type DigitalValue = 0 | 1 + /** + * Digital high value + */ + export const HIGH = 1 + /** + * Digital low value + */ + export const LOW = 0 + + export interface PinBase { + _pinBrand: unknown + + /** + * Hardware pin number + */ + gpio: number + } + + /** + * Represents pin capable of digital output. + */ + export interface InputPin extends PinBase { + _inputPinBrand: unknown + } + + /** + * Represents pin capable of digital input. + */ + export interface OutputPin extends PinBase { + _outputPinBrand: unknown + } + + /** + * Represents pin capable of digital input and output. + */ + export type IOPin = InputPin & OutputPin + + /** + * Represents pin capable of analog input (ADC). + */ + export interface AnalogInPin extends PinBase { + _analogInPinBranch: unknown + } + + /** + * Represents pin capable of analog output (DAC, not PWM). + */ + export interface AnalogOutPin extends PinBase { + _analogOutPinBranch: unknown + } + + /** + * Unspecified type of pin. + */ + export type Pin = InputPin | OutputPin | AnalogInPin | AnalogOutPin + + /** + * Direct access to pin by hardware id. Best to use \`pins.name\` instead. + * + * @param hwPinIndex hardware pin number + */ + export function gpio(hwPinIndex: number): IOPin & AnalogInPin & AnalogOutPin +} +`, + "core/src/devicescript-lib.d.ts": `declare interface Math { + /** + * Returns the result of signed 32-bit integer division of two numbers. + */ + idiv(x: number, y: number): number + + /** + * Return an integer between 0 and \`max\` inclusive + * @param max upper bound + */ + randomInt(max: number): number +} +`, + "core/src/devicescript-servers.d.ts": `// auto-generated! do not edit here +declare module "@devicescript/servers" { + type integer = number + /** + * Hardware pin number or label. + * Naming convention - fields with \`Pin\` type start with \`pin*\` + */ + + + + + + type HexInt = integer + +export interface DeviceScriptConfig extends DeviceHardwareInfo { + /** + * Don't start internal cloud adapter service (including the WiFi adapter) and instead use one running + * on the computer connected via USB. + */ + devNetwork?: boolean +} + +export type UserHardwareInfo = Partial< + Exclude +> + + import * as ds from "@devicescript/core" + import { Pin, InputPin, OutputPin, IOPin, AnalogInPin, AnalogOutPin } from "@devicescript/core" + + /** + * Start on-board server for RotaryEncoder, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/rotaryencoder Documentation} + */ + function startRotaryEncoder(cfg: RotaryEncoderConfig): ds.RotaryEncoder + + /** + * Start on-board server for Button, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/button Documentation} + */ + function startButton(cfg: ButtonConfig): ds.Button + + /** + * Start on-board server for Switch, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/switch Documentation} + */ + function startSwitch(cfg: SwitchConfig): ds.Switch + + /** + * Start on-board server for Flex, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/flex Documentation} + */ + function startFlex(cfg: FlexConfig): ds.Flex + + /** + * Start on-board server for Relay, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/relay Documentation} + */ + function startRelay(cfg: RelayConfig): ds.Relay + + /** + * Start on-board server for Power, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/power Documentation} + */ + function startPower(cfg: PowerConfig): ds.Power + + /** + * Start on-board server for Motion, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/motion Documentation} + */ + function startMotion(cfg: MotionConfig): ds.Motion + + /** + * Start on-board server for Motor, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/motor Documentation} + */ + function startMotor(cfg: MotorConfig): ds.Motor + + /** + * Start on-board server for LightBulb, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/lightbulb Documentation} + */ + function startLightBulb(cfg: LightBulbConfig): ds.LightBulb + + /** + * Start on-board server for Buzzer, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/buzzer Documentation} + */ + function startBuzzer(cfg: BuzzerConfig): ds.Buzzer + + /** + * Start on-board server for Servo, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/servo Documentation} + */ + function startServo(cfg: ServoConfig): ds.Servo + + /** + * Start on-board server for LightLevel, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/lightlevel Documentation} + */ + function startLightLevel(cfg: LightLevelConfig): ds.LightLevel + + /** + * Start on-board server for ReflectedLight, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/reflectedlight Documentation} + */ + function startReflectedLight(cfg: ReflectedLightConfig): ds.ReflectedLight + + /** + * Start on-board server for WaterLevel, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/waterlevel Documentation} + */ + function startWaterLevel(cfg: WaterLevelConfig): ds.WaterLevel + + /** + * Start on-board server for SoundLevel, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/soundlevel Documentation} + */ + function startSoundLevel(cfg: SoundLevelConfig): ds.SoundLevel + + /** + * Start on-board server for SoilMoisture, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/soilmoisture Documentation} + */ + function startSoilMoisture(cfg: SoilMoistureConfig): ds.SoilMoisture + + /** + * Start on-board server for Potentiometer, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/potentiometer Documentation} + */ + function startPotentiometer(cfg: PotentiometerConfig): ds.Potentiometer + + /** + * Start on-board server for Accelerometer, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/accelerometer Documentation} + */ + function startAccelerometer(cfg: AccelerometerConfig): ds.Accelerometer + + /** + * Start on-board server for HidJoystick, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/hidjoystick Documentation} + */ + function startHidJoystick(cfg: HidJoystickConfig): ds.HidJoystick + + /** + * Start on-board server for HidKeyboard, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/hidkeyboard Documentation} + */ + function startHidKeyboard(cfg: HidKeyboardConfig): ds.HidKeyboard + + /** + * Start on-board server for HidMouse, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/hidmouse Documentation} + */ + function startHidMouse(cfg: HidMouseConfig): ds.HidMouse + + /** + * Start on-board server for Gamepad, and returns the client for it. + * @returns client for the on-board server + * @see {@link https://microsoft.github.io/devicescript/api/clients/gamepad Documentation} + */ + function startGamepad(cfg: GamepadConfig): ds.Gamepad + + + /** + * Configure C runtime. + */ + export function configureHardware(cfg: UserHardwareInfo): void + + + type ServiceConfig = + | RotaryEncoderConfig + | ButtonConfig + | SwitchConfig + | FlexConfig + | RelayConfig + | PowerConfig + | MotionConfig + | MotorConfig + | LightBulbConfig + | BuzzerConfig + | ServoConfig + | LightLevelConfig + | ReflectedLightConfig + | WaterLevelConfig + | SoundLevelConfig + | SoilMoistureConfig + | PotentiometerConfig + | AccelerometerConfig + | HidJoystickConfig + | HidKeyboardConfig + | HidMouseConfig + | GamepadConfig + + interface DeviceHardwareInfo { + /** + * Name of the device. + * + * @examples ["Acme Corp. SuperIoT v1.3"] + */ + devName: string + + /** + * Identifier for a particular firmware running on a particular device, typically given as a hex number starting with 0x3. + * + * @examples ["0x379ea214"] + */ + productId: HexInt + + jacdac?: JacdacConfig + + led?: LedConfig + + log?: LogConfig + + i2c?: I2CConfig + + /** + * Enable legacy auto-scan for I2C devices. + */ + scanI2C?: boolean + + pins?: PinLabels + + /** + * Initial values for pins. + */ + sPin?: Record + } + + interface JsonComment { + /** + * All fields starting with '#' arg ignored + */ + "#"?: string + } + + interface JacdacConfig extends JsonComment { + $connector?: "Jacdac" | "Header" + pin: IOPin + } + + interface I2CConfig extends JsonComment { + pinSDA: IOPin + pinSCL: OutputPin + + /** + * How I2C devices are attached. + */ + $connector?: "Qwiic" | "Grove" | "Header" + + /** + * Hardware instance index. + */ + inst?: integer + + /** + * How fast to run the I2C, typically either 100 or 400. + * + * @default 100 + */ + kHz?: integer + } + + interface LogConfig extends JsonComment { + /** + * Where to send logs. + * On ESP32 boards this has to be the same a bootloader UART TX pin. + * On other boards, this has to be TX-capable pin. + */ + pinTX: OutputPin + + /** + * Speed to use. + * + * @default 115200 + */ + baud?: integer + } + + interface LedConfig extends JsonComment { + /** + * If a single mono LED, or programmable RGB LED. + */ + pin?: OutputPin + + /** + * Clock pin, if any. + */ + pinCLK?: OutputPin + + /** + * RGB LED driven by PWM. + * + * @minItems 3 + * @maxItems 3 + */ + rgb?: LedChannel[] + + /** + * Applies to all LED channels/pins. + */ + activeHigh?: boolean + + /** + * Defaults to \`true\` if \`pin\` is set and \`type\` is 0. + * Otherwise \`false\`. + */ + isMono?: boolean + + /** + * 0 - use \`pin\` or \`rgb\` as regular pins + * 1 - use \`pin\` as WS2812B (supported only on some boards) + * 2 - use \`pin\` as APA102 DATA, and \`pinCLK\` as CLOCK + * 3 - use \`pin\` as SK9822 DATA, and \`pinCLK\` as CLOCK + * Other options (in range 100+) are also possible on some boards. + * + * @default 0 + */ + type?: number + } + + interface LedChannel extends JsonComment { + pin: OutputPin + /** + * Multiplier to compensate for different LED strengths. + * @minimum 0 + * @maximum 255 + */ + mult?: integer + } + + /** + * Typical pin labels, others are allowed. + * Pin labels starting with '@' are hidden to the user. + */ + interface PinLabels extends JsonComment { + TX?: integer + RX?: integer + VP?: integer + VN?: integer + BOOT?: integer + PWR?: integer + LED_PWR?: integer + LED?: integer + LED0?: integer + LED1?: integer + LED2?: integer + LED3?: integer + + CS?: integer + + A0?: integer + A1?: integer + A2?: integer + A3?: integer + A4?: integer + A5?: integer + A6?: integer + A7?: integer + A8?: integer + A9?: integer + A10?: integer + A11?: integer + A12?: integer + A13?: integer + A14?: integer + A15?: integer + + D0?: integer + D1?: integer + D2?: integer + D3?: integer + D4?: integer + D5?: integer + D6?: integer + D7?: integer + D8?: integer + D9?: integer + D10?: integer + D11?: integer + D12?: integer + D13?: integer + D14?: integer + D15?: integer + + P0?: integer + P1?: integer + P2?: integer + P3?: integer + P4?: integer + P5?: integer + P6?: integer + P7?: integer + P8?: integer + P9?: integer + P10?: integer + P11?: integer + P12?: integer + P13?: integer + P14?: integer + P15?: integer + P16?: integer + P17?: integer + P18?: integer + P19?: integer + P20?: integer + P21?: integer + P22?: integer + P23?: integer + P24?: integer + P25?: integer + P26?: integer + P27?: integer + P28?: integer + P29?: integer + P30?: integer + P31?: integer + P32?: integer + P33?: integer + P34?: integer + P35?: integer + P36?: integer + P37?: integer + P38?: integer + P39?: integer + P40?: integer + P41?: integer + P42?: integer + P43?: integer + P44?: integer + P45?: integer + P46?: integer + P47?: integer + P48?: integer + P49?: integer + P50?: integer + P51?: integer + P52?: integer + P53?: integer + P54?: integer + P55?: integer + P56?: integer + P57?: integer + P58?: integer + P59?: integer + P60?: integer + P61?: integer + P62?: integer + P63?: integer + + GP0?: integer + GP1?: integer + GP2?: integer + GP3?: integer + GP4?: integer + GP5?: integer + GP6?: integer + GP7?: integer + GP8?: integer + GP9?: integer + GP10?: integer + GP11?: integer + GP12?: integer + GP13?: integer + GP14?: integer + GP15?: integer + GP16?: integer + GP17?: integer + GP18?: integer + GP19?: integer + GP20?: integer + GP21?: integer + GP22?: integer + GP23?: integer + GP24?: integer + GP25?: integer + GP26?: integer + GP27?: integer + GP28?: integer + GP29?: integer + GP30?: integer + GP31?: integer + GP32?: integer + GP33?: integer + GP34?: integer + GP35?: integer + GP36?: integer + GP37?: integer + GP38?: integer + GP39?: integer + GP40?: integer + GP41?: integer + GP42?: integer + GP43?: integer + GP44?: integer + GP45?: integer + GP46?: integer + GP47?: integer + GP48?: integer + GP49?: integer + GP50?: integer + GP51?: integer + GP52?: integer + GP53?: integer + GP54?: integer + GP55?: integer + GP56?: integer + GP57?: integer + GP58?: integer + GP59?: integer + GP60?: integer + GP61?: integer + GP62?: integer + GP63?: integer + + // RP2040 + GP26_A0?: integer + GP27_A1?: integer + GP28_A2?: integer + + // Xiao/QT-Py pinout + A0_D0?: integer + A1_D1?: integer + A2_D2?: integer + A3_D3?: integer + SDA_D4?: integer + SCL_D5?: integer + TX_D6?: integer + RX_D7?: integer + SCK_D8?: integer + MISO_D9?: integer + MOSI_D10?: integer + + // Feather pin names (in addition to A0, A1, ..., D10, ...) + A4_D24?: integer + A5_D25?: integer + RX_D0?: integer + TX_D1?: integer + SDA?: integer + SCL?: integer + MISO?: integer + MOSI?: integer + SCK?: integer + } + + interface BaseServiceConfig extends JsonComment { + service?: string + + /** + * Instance/role name to be assigned to service. + * @examples ["buttonA", "activityLed"] + */ + name?: string + + /** + * Service variant (see service definition for possible values). + */ + variant?: integer + } + + interface RotaryEncoderConfig extends BaseServiceConfig { + service?: "rotaryEncoder" + pin0: InputPin + pin1: InputPin + /** + * How many clicks for full 360 turn. + * @default 12 + */ + clicksPerTurn?: integer + /** + * Encoder supports "half-clicks". + */ + dense?: boolean + /** + * Invert direction. + */ + inverted?: boolean + } + + interface ButtonConfig extends BaseServiceConfig { + service?: "button" + pin: InputPin + /** + * This pin is set high when the button is pressed. + */ + pinBacklight?: OutputPin + /** + * Button is normally active-low and pulled high. + * This makes it active-high and pulled low. + */ + activeHigh?: boolean + } + + interface SwitchConfig extends BaseServiceConfig { + service?: "switch" + pin: InputPin + } + + interface FlexConfig extends BaseServiceConfig { + service?: "flex" + pinL: OutputPin + pinM: AnalogInPin + pinH: OutputPin + } + + interface RelayConfig extends BaseServiceConfig { + service?: "relay" + + /** + * The driving pin. + */ + pin: OutputPin + + /** + * When set, the relay is considered 'active' when \`pin\` is low. + */ + activeLow?: boolean + + /** + * Active-high pin that indicates the actual state of the relay. + */ + pinFeedback?: InputPin + + /** + * This pin will be driven when relay is active. + */ + pinLed?: OutputPin + + /** + * Which way to drive the \`pinLed\` + */ + ledActiveLow?: boolean + + /** + * Whether to activate the relay upon boot. + */ + initalActive?: boolean + + /** + * Maximum switching current in mA. + */ + maxCurrent?: integer + } + + interface LightBulbConfig extends BaseServiceConfig { + service?: "lightBulb" + + /** + * The driving pin. + */ + pin: OutputPin + + /** + * When set, the relay is considered 'active' when \`pin\` is low. + */ + activeLow?: boolean + + /** + * When set, the pin will be operated with PWM at a few kHz. + */ + dimmable?: boolean + } + + interface BuzzerConfig extends BaseServiceConfig { + service?: "buzzer" + + /** + * The driving pin. + */ + pin: OutputPin + + /** + * When set, the \`pin\` will be set to \`1\` when no sound is playing + * (because power flows through speaker when \`pin\` is set to \`0\`). + * When unset, the \`pin\` will be set to \`0\` when no sound is playing. + */ + activeLow?: boolean + } + + interface MotorConfig extends BaseServiceConfig { + service?: "motor" + + /** + * The channel 1 pin. + */ + pin1: OutputPin + + /** + * The channel 2 pin. + */ + pin2?: OutputPin + + /** + * The enable (NSLEEP) pin if any, active high. + */ + pinEnable?: OutputPin + } + + interface ServoConfig extends BaseServiceConfig { + service?: "servo" + + /** + * The driving (PWM) pin. + */ + pin: OutputPin + + /** + * The pin to set low when servo is used. Floating otherwise. + */ + powerPin?: OutputPin + + /** + * When set, the min/maxAngle/Pulse can't be changed by the user. + */ + fixed?: boolean + + /** + * Minimum angle supported by the servo in degrees. + * Always minAngle < maxAngle + * + * @default -90 + */ + minAngle?: number + + /** + * Pulse value to use to reach minAngle in us. + * Typically minPulse > maxPulse + * + * @default 2500 + */ + minPulse?: number + + /** + * Maximum angle supported by the servo in degrees. + * Always minAngle < maxAngle + * + * @default 90 + */ + maxAngle?: number + + /** + * Pulse value to use to reach maxAngle in us. + * Typically minPulse > maxPulse + * + * @default 600 + */ + maxPulse?: number + } + + interface MotionConfig extends BaseServiceConfig { + service?: "motion" + + /** + * The input pin. + */ + pin: InputPin + + /** + * When set, the sensor is considered 'active' when \`pin\` is low. + */ + activeLow?: boolean + + /** + * Sensing angle in degrees. + * + * @default 120 + */ + angle?: number + + /** + * Maximum sensing distance in centimeters. + * + * @default 1200 + */ + minDistance?: number + } + + interface PowerConfig extends BaseServiceConfig { + service?: "power" + + /** + * Always active low. + */ + pinFault: InputPin + pinEn: OutputPin + /** + * Active-low pin for pulsing battery banks. + */ + pinPulse?: OutputPin + /** + * Operation mode of pinEn + * 0 - \`pinEn\` is active high + * 1 - \`pinEn\` is active low + * 2 - transistor-on-EN setup, where flt and en are connected at limiter + * 3 - EN should be pulsed at 50Hz (10ms on, 10ms off) to enable the limiter + */ + mode: integer + + /** + * How long (in milliseconds) to ignore the \`pinFault\` after enabling. + * + * @default 16 + */ + faultIgnoreMs: integer + + /** + * Additional power LED to pulse. + */ + pinLedPulse?: OutputPin + + /** + * Pin that is high when we are connected to USB or similar power source. + */ + pinUsbDetect?: InputPin + } + + interface AccelerometerConfig extends BaseServiceConfig { + service?: "accelerometer" + + /** + * Transform for X axis. Values of 1, 2, 3 will return the corresponding raw axis (indexed from 1). + * Values -1, -2, -3 will do likewise but will negate the axis. + * + * @default 1 + */ + trX?: integer + + /** + * Transform for Y axis. Values of 1, 2, 3 will return the corresponding raw axis (indexed from 1). + * Values -1, -2, -3 will do likewise but will negate the axis. + * + * @default 2 + */ + trY?: integer + + /** + * Transform for Z axis. Values of 1, 2, 3 will return the corresponding raw axis (indexed from 1). + * Values -1, -2, -3 will do likewise but will negate the axis. + * + * @default 3 + */ + trZ?: integer + } + + interface GamepadConfig extends BaseServiceConfig { + service?: "gamepad" + + // Digital + + /** + * Pin for button Left + */ + pinLeft?: InputPin + /** + * Pin for button Up + */ + pinUp?: InputPin + /** + * Pin for button Right + */ + pinRight?: InputPin + /** + * Pin for button Down + */ + pinDown?: InputPin + /** + * Pin for button A + */ + pinA?: InputPin + /** + * Pin for button B + */ + pinB?: InputPin + /** + * Pin for button Menu + */ + pinMenu?: InputPin + /** + * Pin for button Select + */ + pinSelect?: InputPin + /** + * Pin for button Reset + */ + pinReset?: InputPin + /** + * Pin for button Exit + */ + pinExit?: InputPin + /** + * Pin for button X + */ + pinX?: InputPin + /** + * Pin for button Y + */ + pinY?: InputPin + + /** + * Buttons are normally active-low and pulled high. + * This makes them active-high and pulled low. + */ + activeHigh?: boolean + + // Analog + /** + * When gamepad is analog, set this to horizontal pin. + */ + pinAX?: AnalogInPin + + /** + * When gamepad is analog, set this to vertical pin. + */ + pinAY?: AnalogInPin + + /** + * Pin to pull low before analog read and release afterwards. + */ + pinLow?: OutputPin + + /** + * Pin to pull high before analog read and release afterwards. + */ + pinHigh?: OutputPin + } + + interface AnalogConfig extends BaseServiceConfig { + /** + * Pin to analog read. + */ + pin: AnalogInPin + + /** + * Pin to pull low before analog read and release afterwards. + */ + pinLow?: OutputPin + + /** + * Pin to pull high before analog read and release afterwards. + */ + pinHigh?: OutputPin + + /** + * Reading is \`offset + (raw_reading * scale) / 1024\` + * + * @default 0 + */ + offset?: integer + + /** + * Reading is \`offset + (raw_reading * scale) / 1024\` + * + * @default 1024 + */ + scale?: integer + + /** + * Interval in milliseconds between samplings of the sensor. + * + * @default 9 + */ + samplingItv?: integer + + /** + * How many milliseconds to wait after setting \`pinLow\`/\`pinHigh\` before sampling. + * + * @default 0 + */ + samplingDelay?: integer + + /** + * Default interval in milliseconds between streaming samples. + * + * @default 100 + */ + streamingItv?: integer + } + + interface LightLevelConfig extends AnalogConfig { + service?: "analog:lightLevel" + } + + interface ReflectedLightConfig extends AnalogConfig { + service?: "analog:reflectedLight" + } + + interface WaterLevelConfig extends AnalogConfig { + service?: "analog:waterLevel" + } + + interface SoundLevelConfig extends AnalogConfig { + service?: "analog:soundLevel" + } + + interface SoilMoistureConfig extends AnalogConfig { + service?: "analog:soilMoisture" + } + + interface PotentiometerConfig extends AnalogConfig { + service?: "analog:potentiometer" + } + + interface HidMouseConfig extends BaseServiceConfig { + service?: "hidMouse" + } + interface HidKeyboardConfig extends BaseServiceConfig { + service?: "hidKeyboard" + } + interface HidJoystickConfig extends BaseServiceConfig { + service?: "hidJoystick" + } +} +`, + "core/src/events.ts": `// This file has classes dealing with emitting and listening for events, including client registers. + +import * as ds from "@devicescript/core" + +function noop() {} + +type Fn = (v: T) => void + +enum Wrapper { + Idle = 0, + StartPending = 1, + Running = 2, +} + +function handlerWrapper(handler: ds.Handler) { + let state = Wrapper.Idle + let value: T + + async function emit() { + try { + while (state === Wrapper.StartPending) { + state = Wrapper.Running + await handler(value) + } + } finally { + state = Wrapper.Idle + } + } + + return (v: T) => { + value = v + if (state === Wrapper.Idle) emit.start() + state = Wrapper.StartPending + } +} + +// TODO move to C? +class Emitter implements ds.Emitter { + handlers: Fn[] + + subscribe(f: ds.Handler): ds.Unsubscribe { + if (!this.handlers) this.handlers = [] + const h = handlerWrapper(f) + this.handlers.push(h) + const self = this + return () => { + const i = self.handlers.indexOf(h) + if (i >= 0) self.handlers.insert(i, -1) + } + } + emit(v: T) { + if (!this.handlers?.length) return + for (const h of this.handlers) h(v) + } +} + +class ClientRegister implements ds.ClientRegister { + private value: T + private emitter: ds.Emitter + + constructor(value: T) { + this.value = value + } + + async read() { + return this.value + } + + subscribe(handler: ds.Handler): ds.Unsubscribe { + if (!this.emitter) this.emitter = ds.emitter() + return this.emitter.subscribe(handler) + } + + emit(newValue: T) { + if (this.value !== newValue) { + this.value = newValue + this.emitter?.emit(this.value) + } + } +} + +;(ds as typeof ds).clientRegister = function (v) { + return new ClientRegister(v) +} +;(ds as typeof ds).wait = async function wait( + l: ds.Subscriber, + timeout?: number +) { + const fib = ds.Fiber.self() + let unsub = l.subscribe(v => { + unsub() + unsub = noop + if (fib.suspended) fib.resume(v) + }) + const r = await ds.suspend(timeout) + unsub() + unsub = noop + return r +} +;(ds as typeof ds).emitter = function () { + return new Emitter() +} +`, + "core/src/gamepad.ts": `import * as ds from "@devicescript/core" + +declare module "@devicescript/core" { + interface Gamepad { + /** + * The thumbstick position register if any + */ + axes(): ds.ClientRegister<{ x: number; y: number }> + + /** + * Button (or combo) register + */ + button(value: ds.GamepadButtons): ds.ClientRegister + } +} + +ds.Gamepad.prototype.axes = function axes() { + let r = (this as any).__axes as ds.ClientRegister<{ x: number; y: number }> + if (!r) { + ;(this as any).__axes = r = ds.clientRegister<{ x: number; y: number }>( + { x: 0, y: 0 } + ) + this.reading.subscribe(rv => r.emit({ x: rv[1], y: rv[2] })) + } + return r +} + +ds.Gamepad.prototype.button = function button(value: ds.GamepadButtons) { + const key = \`__\${value}\` + let r = (this as any)[key] as ds.ClientRegister + if (!r) { + ;(this as any)[key] = r = ds.clientRegister(false) + this.reading.subscribe(rv => r.emit((rv[0] & value) === value)) + } + return r +} +`, + "core/src/index.ts": `// for some reason symbols cannot be exported normally from the 'core' library +// they are only exported via the ambient declarations +// we import the modules, as they assign to various prototypes +import "./utils" +import "./buffer" +import "./timeouts" +import "./array" +import "./string" +import "./events" +import "./jacdac" +import "./lightbulb" +import "./rotaryencoder" +import "./button" +import "./magneticfieldlevel" +import "./buzzer" +import "./ledstrip" +import "./gamepad" +`, + "core/src/jacdac.ts": `// This file has DS-side implementation of generic Jacdac clients + +import * as ds from "@devicescript/core" + +export const JD_SERIAL_MAX_PAYLOAD_SIZE = 236 + +ds.Role.prototype.binding = function binding(this: RoleData) { + if (!this._binding) { + this._binding = ds.clientRegister(false) + } + return this._binding +} + +ds.Role.prototype.report = function report(this: RoleData) { + if (!this._report) { + this._report = ds.emitter() + } + return this._report +} + +interface RoleData extends ds.Role { + _binding: ds.ClientRegister + _changeHandlers: Record> + _eventHandlers: Record> + _reportHandlers: Record + _report: ds.Emitter +} + +ds.Role.prototype._onPacket = async function (this: RoleData, pkt: ds.Packet) { + // + // If you halted the program and ended up here, it may be difficult to step in. + // Best to set breakpoints elsewhere. + // + const changeHandlers = this._changeHandlers + if (!pkt || pkt.serviceCommand === 0) { + const conn = this.isBound + this._binding?.emit(conn) + if (conn && changeHandlers) { + const regs = Object.keys(changeHandlers) + for (let i = 0; i < regs.length; ++i) { + const rg = regs[i] + if (rg === "reading") { + const b = Buffer.alloc(1) + b[0] = 199 + await this.sendCommand(0x2003, b) + } else { + // refresh + // TODO don't refresh const registers + await this.sendCommand(this.spec.lookup(rg).code) + } + } + } + } + if (!pkt || !pkt.spec) return + + if (pkt.isReport) { + this._report?.emit(pkt) + + if (pkt.isRegGet && changeHandlers) { + const handlers = changeHandlers[pkt.spec.name] + handlers?.emit(pkt.decode()) + } + + if (pkt.isAction && this._reportHandlers) { + const key = pkt.spec.name + const fib = this._reportHandlers[key] + if (fib) { + delete this._reportHandlers[key] + fib.resume(pkt) + } + } + + if (pkt.isEvent && this._eventHandlers) { + const hh = this._eventHandlers[pkt.spec.name] + hh?.emit(pkt.decode()) + } + } +} + +function subscribe( + emitterSet: Record>, + name: string, + handler: ds.Handler +) { + if (!emitterSet[name]) emitterSet[name] = ds.emitter() + return emitterSet[name].subscribe(handler) +} + +ds.Register.prototype.subscribe = function ( + this: ds.Register, + handler: (v: T) => void +) { + const role = this.role as RoleData + if (!role._changeHandlers) role._changeHandlers = {} + return subscribe(role._changeHandlers, this.name, handler) +} + +ds.Event.prototype.subscribe = function ( + this: ds.Event, + handler: (v: T) => void +) { + const role = this.role as RoleData + if (!role._eventHandlers) role._eventHandlers = {} + return subscribe(role._eventHandlers, this.name, handler) +} + +ds.Event.prototype.wait = async function (timeout) { + return await ds.wait(this, timeout) +} +`, + "core/src/ledstrip.ts": `import * as ds from "@devicescript/core" + +declare module "@devicescript/core" { + interface LedStrip { + /** + * Runs an encoded program. + */ + runEncoded( + program: string, + ...args: (number | number[])[] + ): Promise + + /** + * Set all of the pixels on the strip to one RGB color. + * @param rgb RGB color of the LED + */ + setAll(rgb: number): Promise + } +} + +function cmdCode(cmd: string) { + switch (cmd) { + case "setall": + return 0xd0 + case "fade": + return 0xd1 + case "fadehsv": + return 0xd2 + case "rotfwd": + return 0xd3 + case "rotback": + return 0xd4 + case "show": + case "wait": + return 0xd5 + case "range": + return 0xd6 + case "mode": + return 0xd7 + case "tmpmode": + return 0xd8 + case "set1": + case "setone": + return 0xcf + case "mult": + return 0x100 + default: + return undefined + } +} + +function isWhiteSpace(code: number) { + return code === 32 || code === 13 || code === 10 || code === 9 +} + +/* + Syntax: the input is split at spaces. The following tokens are supported: + - a command name (see below) + - a decimal number (0-16383) + - a color, in HTML syntax '#ff0000' for red, etc + - a single '#' which will take color (24-bit number) from list of arguments; + the list of arguments has an array or colors it will encode all elements of the array + - a single '%' which takes a number (0-16383) from the list of arguments + + Commands: + - \`setall C+\` - set all pixels in current range to given color pattern + - \`fade C+\` - set pixels in current range to colors between colors in sequence + - \`fadehsv C+\` - similar to \`fade()\`, but colors are specified and faded in HSV + - \`rotfwd K\` - rotate (shift) pixels by \`K\` positions away from the connector + - \`rotback K\` - same, but towards the connector + - \`show M=50\` - send buffer to strip and wait \`M\` milliseconds + - \`range P=0 N=length W=1 S=0\` - range from pixel \`P\`, \`N\` pixels long (currently unsupported: every \`W\` pixels skip \`S\` pixels) + - \`mode K=0\` - set update mode + - \`tmpmode K=0\` - set update mode for next command only + - \`setone P C\` - set one pixel at \`P\` (in current range) to given color + - \`mult V\` - macro to multiply current range by given value (float) + + C+ means one or more colors + V is a floating point number + Other letters (K, M, N, P, W, S) represent integers, with their default values if omitted + + Examples: + ledStripEncode("setall #000000", []) - turn off all lights + ledStripEncode("setall #", [0]) - the same + ledStripEncode("fade # #", [0xff0000, 0x0000ff]) - set first pixel to red, last to blue, and interpolate the ones in between + ledStripEncode("fade #", [[0xff0000, 0x0000ff]]) - the same; note double [[]] + ledStripEncode("range 2 5 setall #ffffff", []) - set pixels 2-7 to white + ledStripEncode("range % % setall #", [2, 5, 0xffffff]) - the same +*/ +export function ledStripEncode(format: string, args: (number | number[])[]) { + const outarr: number[] = [] + let colors: number[] = [] + let pos = 0 + let currcmd = 0 + + function pushNumber(n: number) { + if (n === null || (n | 0) !== n || n < 0 || n >= 16383) + throw new RangeError("number out of range: " + n) + if (n < 128) outarr.push(n) + else { + outarr.push(0x80 | (n >> 8)) + outarr.push(n & 0xff) + } + } + + function flush() { + if (currcmd === 0xcf) { + if (colors.length !== 1) + throw new RangeError("setone requires 1 color") + } else { + if (colors.length === 0) return + if (colors.length <= 3) outarr.push(0xc0 | colors.length) + else { + outarr.push(0xc0) + outarr.push(colors.length) + } + } + for (let c of colors) { + outarr.push((c >> 16) & 0xff) + outarr.push((c >> 8) & 0xff) + outarr.push((c >> 0) & 0xff) + } + colors = [] + } + + function nextToken() { + while (isWhiteSpace(format.charCodeAt(pos))) pos++ + const beg = pos + while (pos < format.length && !isWhiteSpace(format.charCodeAt(pos))) + pos++ + return format.slice(beg, pos) + } + + while (pos < format.length) { + const token = nextToken() + const t0 = token.charCodeAt(0) + if (97 <= t0 && t0 <= 122) { + // a-z + flush() + currcmd = cmdCode(token) + if (currcmd === undefined) + throw new RangeError("Unknown light command: " + token) + if (currcmd === 0x100) { + const f = parseFloat(nextToken()) + if (isNaN(f) || f < 0 || f > 2) throw "expecting scale" + outarr.push(0xd8) // tmpmode + outarr.push(3) // mult + outarr.push(0xd0) // setall + const mm = Math.constrain(Math.round(128 * f), 0, 255) + outarr.push(0xc1) + outarr.push(mm) + outarr.push(mm) + outarr.push(mm) + } else { + outarr.push(currcmd) + } + } else if (48 <= t0 && t0 <= 57) { + // 0-9 + pushNumber(parseInt(token)) + } else if (t0 === 37) { + // % + if (args.length === 0) throw new RangeError("Out of args, %") + const v = args.shift() + if (typeof v !== "number") throw new RangeError("Expecting number") + pushNumber(v) + } else if (t0 === 35) { + // # + if (token.length === 1) { + if (args.length === 0) throw new RangeError("Out of args, #") + const v = args.shift() + if (typeof v === "number") colors.push(v) + else for (let vv of v) colors.push(vv) + } else { + if (token.length === 7) { + const b = Buffer.from("00" + token.slice(1), "hex") + colors.push(b.readUInt32BE(0)) + } else { + throw new RangeError("Invalid color: " + token) + } + } + } + } + flush() + + return Buffer.from(outarr) +} + +ds.LedStrip.prototype.runEncoded = async function ( + program: string, + ...args: (number | number[])[] +) { + const buf = ledStripEncode(program, args) + await this.run(buf) +} + +ds.LedStrip.prototype.setAll = async function setAll(rgb: number) { + await this.runEncoded("fade # wait 1", rgb) +} +`, + "core/src/lightbulb.ts": `import * as ds from "@devicescript/core" + +declare module "@devicescript/core" { + interface LightBulb { + /** + * Turns the light on at the given intensity. + * @param intensity if specified, the light will be turned on at this intensity (0-1] + */ + on(intensity?: number): Promise + + /** + * Turns the light off. + */ + off(): Promise + + /** + * Toggle light between off and full brightness + * @param lowerThreshold if specified, the light will be turned off if the current brightness is above this threshold + * @param intensity if specified, the light will be turned on at this intensity + * @see {@link https://microsoft.github.io/devicescript/api/clients/lightbulb/#cmd:toggle | Documentation} + */ + toggle(lowerThreshold?: number, intensity?: number): Promise + } +} + +ds.LightBulb.prototype.off = async function () { + await this.intensity.write(0) +} + +ds.LightBulb.prototype.on = async function (intensity?: number) { + const i = intensity === undefined ? 1 : intensity + await this.intensity.write(i) +} + +ds.LightBulb.prototype.toggle = async function ( + lowerThreshold?: number, + intensity?: number +) { + const value = await this.intensity.read() + const on = value > (lowerThreshold || 0) + const i = intensity === undefined ? 1 : intensity + await this.intensity.write(on ? 0 : i) +} +`, + "core/src/magneticfieldlevel.ts": `import * as ds from "@devicescript/core" + +ds.MagneticFieldLevel.prototype.detected = function () { + let reg: ds.ClientRegister = (this as any).__detected + if (!reg) { + reg = ds.clientRegister(false) + ;(this as any).__detected = reg + this.active.subscribe(() => reg.emit(true)) + this.inactive.subscribe(() => reg.emit(false)) + } + return reg +} +`, + "core/src/main.ts": ``, + "core/src/rotaryencoder.ts": `import * as ds from "@devicescript/core" + +declare module "@devicescript/core" { + interface RotaryEncoder { + /** + * Expose reading from the rotary encoder between 0-\`steps\` as number 0-1. + * The value of encoder is always clamped between 0 and \`steps\` (which defaults to one full turn). + */ + asPotentiometer(steps?: number): ClientRegister + } +} + +ds.RotaryEncoder.prototype.asPotentiometer = function (steps?: number) { + const self = this as ds.RotaryEncoder + const reg = ds.clientRegister(0) + async function init() { + if (!steps) steps = await self.clicksPerTurn.read() + let p0 = await self.reading.read() + self.reading.subscribe(v => { + const curr = Math.constrain(v - p0, 0, steps) + p0 = v - curr + reg.emit(curr / steps) + }) + } + init.start() + return reg +} +`, + "core/src/string.ts": `function isSpace(s: string) { + return ( + " \\t\\n\\r\\u000B\\u000C\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff".indexOf( + s + ) >= 0 + ) +} + +String.prototype.trim = function (this: string) { + let beg = 0 + while (beg < this.length) { + if (!isSpace(this[beg])) break + beg++ + } + let end = this.length - 1 + while (end >= beg) { + if (!isSpace(this[end])) break + end-- + } + return this.slice(beg, end + 1) +} + +String.prototype.lastIndexOf = function ( + this: string, + searchString: string, + position?: number +): number { + if (position === undefined) position = this.length + return this.indexOf(searchString, 0, -position) +} + +String.prototype.includes = function ( + this: string, + searchString: string, + position?: number +): boolean { + return this.indexOf(searchString, position) >= 0 +} + +String.prototype.endsWith = function ( + this: string, + searchString: string, + endPosition?: number +): boolean { + if (!(endPosition < this.length)) endPosition = this.length + return ( + this.indexOf( + searchString, + endPosition - searchString.length, + endPosition + ) >= 0 + ) +} + +String.prototype.startsWith = function ( + this: string, + searchString: string, + position?: number +): boolean { + if (!(position > 0)) position = 0 + return this.indexOf(searchString, position, position + 1) >= 0 +} + +String.prototype.split = function ( + this: string, + separator?: string, + limit?: number +): string[] { + const S = this + // https://www.ecma-international.org/ecma-262/6.0/#sec-string.prototype.split + const A: string[] = [] + let lim = 0 + if (limit === undefined) lim = (1 << 29) - 1 + // spec says 1 << 53, leaving it at 29 for constant folding + else if (limit < 0) lim = 0 + else lim = limit | 0 + const s = S.length + let p = 0 + const R = separator + if (lim === 0) return A + if (separator === undefined) { + A[0] = S + return A + } + if (s === 0) { + let z = splitMatch(S, 0, R) + if (z > -1) return A + A[0] = S + return A + } + let T: string + let q = p + while (q !== s) { + let e = splitMatch(S, q, R) + if (e < 0) q++ + else { + if (e === p) q++ + else { + T = S.slice(p, q) + A.push(T) + if (A.length === lim) return A + p = e + q = p + } + } + } + T = S.slice(p, q) + A.push(T) + return A +} + +function splitMatch(S: string, q: number, R: string): number { + return S.indexOf(R, q, q + 1) === q ? q + R.length : -1 +} +`, + "core/src/timeouts.ts": `import * as ds from "@devicescript/core" + +interface Timeout { + id: number + when: number + callback: ds.Callback + period?: number +} + +let timeouts: Timeout[] +let timeoutId: number +let timeoutWorkerId: ds.Fiber + +function insertTimeout(t: Timeout) { + for (let i = 0; i < timeouts.length + 1; ++i) { + if (i === timeouts.length || t.when < timeouts[i].when) { + timeouts.insert(i, 1) + timeouts[i] = t + // if we're inserting at the head, wake the worker + if (i === 0 && timeoutWorkerId.suspended) + timeoutWorkerId.resume(null) + return + } + } +} + +async function timeoutWorker() { + while (true) { + let n = ds.millis() + let d = 10000 + if (timeouts[0]) d = timeouts[0].when - n + if (d > 0) { + await ds.suspend(d) + // + // If you halted the program and ended up here, it may be difficult to step in. + // Best to set breakpoints elsewhere. + // + n = ds.millis() + } + while (timeouts.length > 0 && timeouts[0].when <= n) { + const t = timeouts.shift() + if (t.period < 0) { + // the timer is late + t.when = Infinity + timeouts.push(t) + continue + } + t.callback.start() + if (t.period !== undefined) { + t.when = Math.max(n + 1, t.when + t.period) + t.period = -t.period + insertTimeout(t) + } + } + } +} + +function addTimeout(cb: ds.Callback, ms: number): Timeout { + if (!timeouts) { + timeouts = [] + timeoutId = 1 + timeoutWorkerId = timeoutWorker.start() + } + if (!ms || ms < 1) ms = 1 + const when = ds.millis() + ms + const t: Timeout = { + id: timeoutId++, + when, + callback: cb, + } + insertTimeout(t) + return t +} + +function _clearTimeout(id: number) { + if (!timeouts || !id) return false + for (let i = 0; i < timeouts.length; ++i) { + if (timeouts[i].id === id) { + timeouts.insert(i, -1) + return true + } + } + return false +} + +;(ds as typeof ds).setInterval = function (cb, ms) { + const t = addTimeout(cb2, ms) + t.period = t.when - ds.millis() + return t.id + + async function cb2() { + while (true) { + await cb() + ds.assert(t.period < 0) + if (t.when === Infinity) { + // expired + if (_clearTimeout(t.id)) { + t.when = ds.millis() - t.period + insertTimeout(t) + } + } else { + // indicate we're done + t.period = -t.period + break + } + } + } +} +;(ds as typeof ds).updateInterval = function (id, ms) { + if (!timeouts || !id) return + for (let i = 0; i < timeouts.length; ++i) { + const t = timeouts[i] + if (t.id === id && t.period !== undefined) { + const d = ms - Math.abs(t.period) + if (d === 0) return // nothing to change + _clearTimeout(t.id) + t.period = Math.sign(t.period) * ms + t.when += d + insertTimeout(t) + break + } + } +} +;(ds as typeof ds).setTimeout = function (cb, ms) { + return addTimeout(cb, ms).id +} +;(ds as typeof ds).clearTimeout = _clearTimeout +;(ds as typeof ds).clearInterval = _clearTimeout +`, + "core/src/utils.ts": `import * as ds from "@devicescript/core" + +Math.sign = function sign(v) { + if (v > 0) return 1 + if (v < 0) return -1 + if (v === 0) return 0 + return NaN +} + +Math.sqrt = function sqrt(x) { + return Math.pow(x, 0.5) +} + +Math.cbrt = function cbrt(x) { + return Math.pow(x, 0.333333333333333333) +} + +Math.exp = function exp(x) { + return Math.pow(Math.E, x) +} + +Math.log10 = function log10(x) { + return Math.log(x) * 0.43429448190325176 +} + +Math.log2 = function log2(x) { + return Math.log(x) * 1.4426950408889634 +} + +Math.map = function map(x, inMin, inMax, outMin, outMax) { + const inRange = inMax - inMin + const outRange = outMax - outMin + return ((x - inMin) / inRange) * outRange + outMin +} +Math.constrain = function constrain(x, low, high) { + if (x < low) return low + else if (x > high) return high + else return x +} +;(ds as typeof ds).assert = function assert(cond: boolean, msg?: string): void { + if (!cond) + throw new Error("Assertion failed: " + (msg !== undefined ? msg : "")) +} +;(ds as typeof ds).isSimulator = function isSimulator(): boolean { + const a = ds._dcfgString("archId") + return a === "wasm" || a === "native" +} + +// TODO timeout +// TODO retry policy +;(ds as typeof ds).actionReport = async function actionResponse< + T extends ds.Role +>( + role: T, + meth: string & keyof T, + fn: ds.Callback, + filter?: (p: ds.Packet) => boolean +) { + const sp = role.spec.lookup(meth) + const fib = ds.Fiber.self() + const unsub = role.report().subscribe(pkt => { + if (pkt.serviceCommand === sp.code && (!filter || filter(pkt))) { + unsub() + fib.resume(pkt) + } + }) + await fn() + return await ds.suspend() +} + +/** + * @devsNative GPIO + */ +declare var GPIO: any +;(ds as typeof ds).gpio = (gpio: number) => { + for (const p of Object.values(GPIO)) { + if ((p as ds.PinBase).gpio === gpio) return p as any + } + throw new Error(\`pin \${gpio} not exposed; available: \${Object.keys(GPIO)}\`) +} +`, + "crypto/package.json": `{ + "name": "@devicescript/crypto", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/crypto" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "crypto/src/crypto.ts": `import * as ds from "@devicescript/core" + +export type SymmetricAlgorithm = "aes-256-ccm" +export type HashAlgorithm = "sha256" + +export type Binary = Buffer | string + +export interface CipherOptions { + /** + * Data to be encrypted or decrypted. + */ + data: Buffer + + /** + * Algorithm to use. + */ + algo: SymmetricAlgorithm + + /** + * Key, has to be of the right size for the algorithm. + * For AES256 key length is 256 bits, so 32 bytes. + * @see keySize() + */ + key: Buffer + + /** + * Nonce/initialization vector - use a random one for every message! + * For AES-CCM this is 13 bytes. + * @see ivSize() + */ + iv: Buffer + + /** + * For authenticated encryption, the length of the tag that is appended at the end of the cipher-text. + */ + tagLength: 0 | 4 | 8 | 16 +} + +/** + * Return the expected key buffer size for a given algorithm. + */ +export function keySize(algo: SymmetricAlgorithm) { + if (algo === "aes-256-ccm") return 32 + return undefined +} + +/** + * Return the expected IV (nonce) buffer size for a given algorithm. + */ +export function ivSize(algo: SymmetricAlgorithm) { + if (algo === "aes-256-ccm") return 13 + return undefined +} + +function expectBuffer(v: Buffer, lbl: string, len?: number) { + if (!(v instanceof Buffer)) + throw new TypeError(\`expecting \${lbl} buffer, got \${v}\`) + if (len !== undefined && v.length !== len) + throw new TypeError( + \`expecting \${lbl} buffer to be \${len}, not \${v.length}\` + ) +} + +function validateOptions(options: CipherOptions) { + const { algo } = options + if (algo !== "aes-256-ccm") + throw new TypeError(\`invalid symm algo: \${options.algo}\`) + expectBuffer(options.data, "data") + expectBuffer(options.key, "key", keySize(algo)) + expectBuffer(options.iv, "iv", ivSize(algo)) + switch (options.tagLength) { + case 0: + case 4: + case 8: + case 16: + break + default: + throw new TypeError(\`invalid tagLength \${options.tagLength}\`) + } +} + +/** + * Encrypt a plain text buffer. + */ +export function encrypt(options: CipherOptions): Buffer { + validateOptions(options) + return (options.data as any).encrypt( + options.algo, + options.key, + options.iv, + options.tagLength + ) +} + +/** + * Decrypt a cipher-text buffer. + */ +export function decrypt(options: CipherOptions): Buffer { + validateOptions(options) + return (options.data as any).encrypt( + options.algo, + options.key, + options.iv, + 0x1000 + options.tagLength + ) +} + +/** + * Fill buffer with cryptographically strong random values + */ +export function randomBuffer(size: number): Buffer { + const r = Buffer.alloc(size) + ;(r as any).fillRandom() + return r +} + +function validateHash(algo: HashAlgorithm) { + if (algo !== "sha256") throw new TypeError(\`invalid hash: \${algo}\`) +} + +/** + * Compute digest (hash) of the concatenation of the specified buffers. + */ +export function digest(algo: HashAlgorithm, ...data: Binary[]): Buffer { + validateHash(algo) + return (Buffer as any).digest(undefined, algo, data) +} + +/** + * Compute HMAC digest (authenticated hash) of the concatenation of the specified buffers. + */ +export function hmac( + key: Binary, + algo: HashAlgorithm, + ...data: Binary[] +): Buffer { + validateHash(algo) + if (typeof key !== "string") expectBuffer(key, "key") + return (Buffer as any).digest(key, algo, data) +} + +/** + * Generate a derived key using HKDF function from RFC 5869. + * + * @param key input key material of any length + * @param info typically describes type of key generated + * @param salt optional + * @returns 32 bytes of key + */ +export function sha256Hkdf(key: Binary, info: Binary = "", salt: Binary = "") { + const outkey = hmac(salt, "sha256", key) + return hmac(outkey, "sha256", info, hex\`01\`) +} + +const alphabet = \`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\` + +export function randomString(len: number) { + const r = randomBuffer(len) + for (let i = 0; i < r.length; ++i) r[i] = alphabet.charCodeAt(r[i] & 63) + return r.toString("utf-8") +} +`, + "crypto/src/index.ts": `export * from "./crypto" +`, + "crypto/src/main.ts": `import * as ds from "@devicescript/core" +import { describe, expect, test } from "@devicescript/test" +import { decrypt, digest, encrypt, hmac, sha256Hkdf } from "./crypto" + +function bufferEq(b: Buffer, expected: Buffer) { + ds.assert(b.length === expected.length) + ds.assert(b.toString("hex") === expected.toString("hex")) +} +function testHMAC(key: Buffer, msg: Buffer, expected: Buffer) { + const b = hmac(key, "sha256", msg) + bufferEq(b, expected) +} + +function expSHA(buf: Buffer | string, exp: Buffer) { + if (typeof buf === "string") buf = Buffer.from(buf) + bufferEq(digest("sha256", buf), exp) +} + +describe("aes-ccm", () => { + test("simple", () => { + const key = hex\`c0c1c2c3c4c5c6c7c8c9cacbcccdcecfc0c1c2c3c4c5c6c7c8c9cacbcccdcecf\` + const iv = hex\`00000003020100a0a1a2a3a4a5\` + const plain = hex\`616c61206d61206b6f74612c206b6f74206d6120616c652c20616e64206576657279 + 6f6e65206973206861707079\` + + const enc = encrypt({ + data: plain, + algo: \`aes-256-ccm\`, + key, + iv, + tagLength: 4, + }) + + bufferEq( + enc, + hex\`480408f5ae18ce68d46125c071b3de7427d1edec7207ea189248b911d2bb5eb67853a4a47e9e9570f884ccd460b853e034df\` + ) + + const dec = decrypt({ + data: enc, + algo: \`aes-256-ccm\`, + key, + iv, + tagLength: 4, + }) + + bufferEq(dec, plain) + }) +}) + +describe("sha256", () => { + test("simple", () => { + expSHA( + "abc", + hex\`ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad\` + ) + expSHA( + "", + hex\`e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855\` + ) + expSHA( + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + hex\`248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1\` + ) + expSHA( + "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", + hex\`cf5b16a7 78af8380 036ce59e 7b049237 0b249b11 e8f07a51 afac4503 7afee9d1\` + ) + }) + + test("hmac", () => { + testHMAC( + hex\`0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b\`, + hex\`4869205468657265\`, + hex\`b0344c61d8db38535ca8afceaf0bf12b 881dc200c9833da726e9376c2e32cff7\` + ) + testHMAC( + hex\`4a656665\`, + hex\`7768617420646f2079612077616e7420 666f72206e6f7468696e673f\`, + hex\`5bdcc146bf60754e6a042426089575c7 5a003f089d2739839dec58b964ec3843\` + ) + testHMAC( + hex\`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaa\`, + hex\`dddddddddddddddddddddddddddddddd dddddddddddddddddddddddddddddddd + dddddddddddddddddddddddddddddddd dddd\`, + hex\`773ea91e36800e46854db8ebd09181a7 2959098b3ef8c122d9635514ced565fe\` + ) + testHMAC( + hex\`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaa\`, + hex\`54657374205573696e67204c61726765 + 72205468616e20426c6f636b2d53697a + 65204b6579202d2048617368204b6579 + 204669727374\`, + hex\`60e431591ee0b67f0d8a26aacbf5b77f 8e0bc6213728c5140546040f0ee37f54 \` + ) + }) + + test("hkdf", () => { + const h = sha256Hkdf( + hex\`60e431591ee0b67f0d8a26aacbf5b77f 8e0bc6213728c5140546040f0ee37f54\`, + "Hello" + ) + bufferEq( + h, + hex\`765c02ce44dc89b569157316c33e8a296117c6c17efeec2e976e480825cfdcde\` + ) + }) +}) +`, + "drivers/package.json": `{ + "name": "@devicescript/drivers", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/drivers" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "drivers/src/accelerometer.ts": `import * as ds from "@devicescript/core" +import { + SensorServer, + SensorServerOptions, + startServer, +} from "@devicescript/server" +import { AccelerometerServerSpec } from "@devicescript/core" +import { AccelerometerConfig } from "@devicescript/servers" + +// shake/gesture detection based on +// https://github.com/lancaster-university/codal-core/blob/master/source/driver-models/Accelerometer.cpp + +/* +MakeCode accelerator position: +Laying flat: 0,0,-1000 +Standing on left edge: -1000,0,0 +Standing on bottom edge: 0,1000,0 +*/ + +const ACCELEROMETER_SHAKE_TOLERANCE = 0.4 + +const ACCELEROMETER_REST_TOLERANCE = 0.2 +const ACCELEROMETER_TILT_TOLERANCE = 0.2 +const ACCELEROMETER_FREEFALL_TOLERANCE = 0.4 +const ACCELEROMETER_SHAKE_COUNT_THRESHOLD = 4 +const ACCELEROMETER_GESTURE_DAMPING = 5 +const ACCELEROMETER_SHAKE_DAMPING = 10 +const ACCELEROMETER_SHAKE_RTX = 30 + +const ACCELEROMETER_REST_THRESHOLD = + ACCELEROMETER_REST_TOLERANCE * ACCELEROMETER_REST_TOLERANCE +const ACCELEROMETER_FREEFALL_THRESHOLD = + ACCELEROMETER_FREEFALL_TOLERANCE * ACCELEROMETER_FREEFALL_TOLERANCE + +export type Vector3D = [number, number, number] + +export interface AccelerometerDriver { + supportedRanges(): number[] + readingError?(): number + readingRange(): number + setReadingRange(value: number): Promise + // this is expected to be called at around 50Hz + subscribe(cb: (sample: Vector3D) => Promise): void +} + +export interface GyroscopeDriver { + gyroSupportedRanges(): number[] + gyroReadingError?(): number + gyroReadingRange(): number + gyroSetReadingRange(value: number): Promise + // this is expected to be called at around 50Hz + gyroSubscribe(cb: (sample: Vector3D) => Promise): void +} + +export interface Sensor3DOptions + extends Omit {} + +export type AccelerometerOptions = Sensor3DOptions +export type GyroscopeOptions = Sensor3DOptions + +class Sensor3D extends SensorServer { + protected lastSample: Vector3D + protected idxMap: [number, number, number] + + constructor( + spec: ds.ServiceSpec, + options: Sensor3DOptions & SensorServerOptions + ) { + super(spec, options) + if (options.trX) { + this.idxMap = [options.trX, options.trY, options.trZ] + } else { + this.idxMap = [1, 2, 3] + } + } + + protected async saveSample(s: Vector3D) { + this.lastSample = [0, 0, 0] + for (let i = 0; i < 3; ++i) { + const idx = this.idxMap[i] + let v = s[Math.abs(idx) - 1] + if (idx < 0) v = -v + this.lastSample[i] = v + } + } +} + +class AccelerometerServer extends Sensor3D implements AccelerometerServerSpec { + private shakeX = false + private shakeY = false + private shakeZ = false + private shakeShaken = false + private shakeCount = 0 + private shakeTimer = 0 + private impulseSigma = 0 + private forceEvents = 0 + private sigma = 0 + private currentGesture = 0 + private lastGesture = 0 + + constructor( + public driver: AccelerometerDriver, + options: AccelerometerOptions & SensorServerOptions + ) { + super(ds.Accelerometer.spec, options) + driver.subscribe(this.handleSample) + } + + private async handleSample(s: Vector3D) { + await this.saveSample(s) + await this.processEvents() + } + + private instantaneousPosture(force: number) { + let shakeDetected = false + + const [x, y, z] = this.lastSample + + // Test for shake events. + // We detect a shake by measuring zero crossings in each axis. In other words, if we see a + // strong acceleration to the left followed by a strong acceleration to the right, then we can + // infer a shake. Similarly, we can do this for each axis (left/right, up/down, in/out). + // + // If we see enough zero crossings in succession (ACCELEROMETER_SHAKE_COUNT_THRESHOLD), then we + // decide that the device has been shaken. + if ( + (x < -ACCELEROMETER_SHAKE_TOLERANCE && this.shakeX) || + (x > ACCELEROMETER_SHAKE_TOLERANCE && !this.shakeX) + ) { + shakeDetected = true + this.shakeX = !this.shakeX + } + + if ( + (y < -ACCELEROMETER_SHAKE_TOLERANCE && this.shakeY) || + (y > ACCELEROMETER_SHAKE_TOLERANCE && !this.shakeY) + ) { + shakeDetected = true + this.shakeY = !this.shakeY + } + + if ( + (z < -ACCELEROMETER_SHAKE_TOLERANCE && this.shakeZ) || + (z > ACCELEROMETER_SHAKE_TOLERANCE && !this.shakeZ) + ) { + shakeDetected = true + this.shakeZ = !this.shakeZ + } + + // If we detected a zero crossing in this sample period, count this. + if ( + shakeDetected && + this.shakeCount < ACCELEROMETER_SHAKE_COUNT_THRESHOLD + ) { + this.shakeCount++ + + if (this.shakeCount === 1) this.shakeTimer = 0 + + if (this.shakeCount === ACCELEROMETER_SHAKE_COUNT_THRESHOLD) { + this.shakeShaken = true + this.shakeTimer = 0 + return ds.AccelerometerCodes.EventShake + } + } + + // measure how long we have been detecting a SHAKE event. + if (this.shakeCount > 0) { + this.shakeTimer++ + + // If we've issued a SHAKE event already, and sufficient time has passed, allow another SHAKE + // event to be issued. + if ( + this.shakeShaken && + this.shakeTimer >= ACCELEROMETER_SHAKE_RTX + ) { + this.shakeShaken = false + this.shakeTimer = 0 + this.shakeCount = 0 + } + + // Decay our count of zero crossings over time. We don't want them to accumulate if the user + // performs slow moving motions. + else if ( + !this.shakeShaken && + this.shakeTimer >= ACCELEROMETER_SHAKE_DAMPING + ) { + this.shakeTimer = 0 + if (this.shakeCount > 0) this.shakeCount-- + } + } + + if (force < ACCELEROMETER_FREEFALL_THRESHOLD) + return ds.AccelerometerCodes.EventFreefall + + // Determine our posture. + if (x < -1 + ACCELEROMETER_TILT_TOLERANCE) + return ds.AccelerometerCodes.EventTiltLeft + + if (x > 1 - ACCELEROMETER_TILT_TOLERANCE) + return ds.AccelerometerCodes.EventTiltRight + + if (y < -1 + ACCELEROMETER_TILT_TOLERANCE) + return ds.AccelerometerCodes.EventTiltDown + + if (y > 1 - ACCELEROMETER_TILT_TOLERANCE) + return ds.AccelerometerCodes.EventTiltUp + + if (z < -1 + ACCELEROMETER_TILT_TOLERANCE) + return ds.AccelerometerCodes.EventFaceUp + + if (z > 1 - ACCELEROMETER_TILT_TOLERANCE) + return ds.AccelerometerCodes.EventFaceDown + + return 0 + } + + private async emitForceEvent(ev: number) { + if (this.forceEvents & (1 << ev)) return + this.forceEvents |= 1 << ev + await this.sendEventByCode(ev) + } + + private async sendEventByCode(ev: number) { + await this.sendEvent(ds.Accelerometer.spec.byCode(ev).encode(undefined)) + } + + private async processEvents() { + const [x, y, z] = this.lastSample + const force = x * x + y * y + z * z + + if (force > 2 * 2) { + this.impulseSigma = 0 + if (force > 2 * 2) + await this.emitForceEvent(ds.AccelerometerCodes.EventForce2g) + if (force > 3 * 3) + await this.emitForceEvent(ds.AccelerometerCodes.EventForce3g) + if (force > 6 * 6) + await this.emitForceEvent(ds.AccelerometerCodes.EventForce6g) + if (force > 8 * 8) + await this.emitForceEvent(ds.AccelerometerCodes.EventForce8g) + } + + if (this.impulseSigma < 5) this.impulseSigma++ + else this.forceEvents = 0 + + // Determine what it looks like we're doing based on the latest sample... + const gesture = this.instantaneousPosture(force) + + if (gesture === ds.AccelerometerCodes.EventShake) { + await this.sendEventByCode(ds.AccelerometerCodes.EventShake) + } else { + // Perform some low pass filtering to reduce jitter from any detected effects + if (gesture === this.currentGesture) { + if (this.sigma < ACCELEROMETER_GESTURE_DAMPING) this.sigma++ + } else { + this.currentGesture = gesture + this.sigma = 0 + } + + // If we've reached threshold, update our record and raise the relevant event... + if ( + this.currentGesture !== this.lastGesture && + this.sigma >= ACCELEROMETER_GESTURE_DAMPING + ) { + this.lastGesture = this.currentGesture + if (this.lastGesture) + await this.sendEventByCode(this.lastGesture) + } + } + } + + reading() { + return this.lastSample + } + readingError() { + return this.driver?.readingError() + } + readingRange?(): ds.AsyncValue { + return this.driver.readingRange() + } + async set_readingRange(value: number) { + await this.driver.setReadingRange(value) + } + supportedRanges() { + return this.driver.supportedRanges() + } +} + +class GyroscopeServer extends Sensor3D implements ds.GyroscopeServerSpec { + constructor( + public driver: GyroscopeDriver, + options: GyroscopeOptions & SensorServerOptions + ) { + super(ds.Gyroscope.spec, options) + driver.gyroSubscribe(this.saveSample) + } + reading() { + return this.lastSample + } + readingError() { + return this.driver?.gyroReadingError() + } + readingRange?(): ds.AsyncValue { + return this.driver.gyroReadingRange() + } + async set_readingRange(value: number) { + await this.driver.gyroSetReadingRange(value) + } + supportedRanges() { + return this.driver.gyroSupportedRanges() + } +} + +/** + * Start an accelerometer. See also startIMU(). + */ +export async function startAccelerometer( + driver: AccelerometerDriver, + options: AccelerometerOptions & SensorServerOptions +): Promise { + const server = new AccelerometerServer(driver, options) + const client = new ds.Accelerometer(startServer(server, options)) + return client +} + +/** + * Start a combined accelerometer+gyroscope. + */ +export async function startIMU( + driver: AccelerometerDriver & GyroscopeDriver, + options: AccelerometerOptions & GyroscopeOptions & SensorServerOptions +) { + const accelerometer = new ds.Accelerometer( + startServer(new AccelerometerServer(driver, options), options) + ) + const gyroscope = new ds.Accelerometer( + startServer(new GyroscopeServer(driver, options), options) + ) + return { accelerometer, gyroscope } +} +`, + "drivers/src/aht20.ts": `import * as ds from "@devicescript/core" +import { DriverError } from "./core" +import { startTemperatureHumidity } from "./servers" +import { I2CSensorDriver } from "./driver" +import { sleep } from "@devicescript/core" + +const AHT20_ADDRESS = 0x38 +const AHT20_BUSY = 0x80 +const AHT20_OK = 0x08 +const AHT20_READ_THROTTLE = 500 + +class AHT20Driver extends I2CSensorDriver<{ + humidity: number + temperature: number +}> { + constructor() { + super(AHT20_ADDRESS, { readCacheTime: AHT20_READ_THROTTLE }) + } + + private async status() { + return (await this.readBuf(1))[0] + } + + private async waitBusy() { + while ((await this.status()) & AHT20_BUSY) await ds.sleep(10) + } + + override async initDriver() { + await this.writeBuf(hex\`BA\`) // reset + await sleep(20) + await this.writeBuf(hex\`E10800\`) // calibrate + await this.waitBusy() + if (!((await this.status()) & AHT20_OK)) + throw new DriverError("can't init AHT20") + } + + override async readData() { + await this.writeBuf(hex\`AC3300\`) + await this.waitBusy() + const data = await this.readBuf(6) + + const h0 = (data[1] << 12) | (data[2] << 4) | (data[3] >> 4) + const humidity = h0 * (100 / 0x100000) + const t0 = ((data[3] & 0xf) << 16) | (data[4] << 8) | data[5] + const temperature = t0 * (200.0 / 0x100000) - 50 + + return { humidity, temperature } + } +} + +/** + * Start driver for AHT20 temperature/humidity sensor at I2C address \`0x38\`. + * @devsPart AHT20 + * @devsServices temperature, humidity + * @see {@link https://asairsensors.com/wp-content/uploads/2021/09/Data-Sheet-AHT20-Humidity-and-Temperature-Sensor-ASAIR-V1.0.03.pdf | Datasheet}. + * @throws DriverError + */ +export async function startAHT20(options?: { + temperatureName?: string + humidityName?: string + baseName?: string +}) { + const { temperatureName, humidityName, baseName } = options || {} + const driver = new AHT20Driver() + await driver.init() + return startTemperatureHumidity( + { + min: -40, + max: 85, + errorValue: 1.5, + reading: async () => (await driver.read()).temperature, + name: temperatureName, + baseName, + }, + { + errorValue: 4, + reading: async () => (await driver.read()).humidity, + name: humidityName, + baseName, + } + ) +} +`, + "drivers/src/bme680.ts": `import { + startAirQualityIndex, + startAirPressure, + startHumidity, + startTemperature, +} from "./servers" +import { delay } from "@devicescript/core" +import { DriverError } from "./core" +import { I2CSensorDriver } from "./driver" + +// based on https://github.com/adafruit/Adafruit_CircuitPython_BME680/blob/main/adafruit_bme680.py + +const BME680_THROTTLE = 100 + +const BME680_CHIPID = 0x61 + +const BME680_REG_CHIPID = 0xd0 +const BME680_REG_VARIANT = 0xf0 +const BME680_COEFF_ADDR1 = 0x89 +const BME680_COEFF_ADDR2 = 0xe1 +const BME680_RES_HEAT_0 = 0x5a +const BME680_GAS_WAIT_0 = 0x64 +const BME680_REG_SOFTRESET = 0xe0 +const BME680_REG_CTRL_GAS = 0x71 +const BME680_REG_CTRL_HUM = 0x72 +const BME680_REG_STATUS = 0x73 +const BME680_REG_CTRL_MEAS = 0x74 +const BME680_REG_CONFIG = 0x75 +const BME680_REG_MEAS_STATUS = 0x1d +const BME680_REG_PDATA = 0x1f +const BME680_REG_TDATA = 0x22 +const BME680_REG_HDATA = 0x25 + +const BME680_RUNGAS = 0x10 + +function read16(arr: Buffer, off = 0) { + return (arr[off] << 8) | arr[off + 1] +} + +function read24(arr: Buffer, off = 0) { + return (arr[off + 0] << 16) | read16(arr, off + 1) +} + +function unpack(fmt: string, buf: Buffer) { + let off = 0 + let res: number[] = [] + for (let i = 0; i < fmt.length; ++i) { + switch (fmt[i]) { + case "<": + break + case "h": + res.push(buf.getAt(off, "i16")) + off += 2 + break + case "H": + res.push(buf.getAt(off, "u16")) + off += 2 + break + case "B": + res.push(buf.getAt(off, "u8")) + off += 1 + break + case "b": + res.push(buf.getAt(off, "i8")) + off += 1 + break + default: + throw new Error("bad fmt " + fmt[i]) + } + } + return res +} + +class BME680Driver extends I2CSensorDriver<{ + humidity: number + temperature: number + pressure: number + gas: number +}> { + private chipVariant: number + private _pressure_oversample: number + private _temp_oversample: number + private _humidity_oversample: number + private _filter: number + + private _adc_pres: number + private _adc_temp: number + private _adc_hum: number + private _adc_gas: number + private _gas_range: number + private _t_fine: number + + private _pressure_calibration: Array + private _humidity_calibration: Array + private _temp_calibration: Array + private _gas_calibration: Array + + private _heat_range: number + private _heat_val: number + private _sw_err: number + + private _LOOKUP_TABLE_1: number[] + private _LOOKUP_TABLE_2: number[] + + constructor(addr: 0x77 | 0x76) { + super(addr, { readCacheTime: BME680_THROTTLE }) + } + + override async initDriver(): Promise { + await this.writeReg(BME680_REG_SOFTRESET, 0xb6) + await delay(5) + const id = await this.readReg(BME680_REG_CHIPID) + console.debug(\`BME680 id=\${id}\`) + if (id !== BME680_CHIPID) + throw new DriverError(\`BME680: wrong chip id (\${id})\`) + this.chipVariant = await this.readReg(BME680_REG_VARIANT) + await this.readCalibration() + + // set up heater + await this.writeReg(BME680_RES_HEAT_0, 0x73) + await this.writeReg(BME680_GAS_WAIT_0, 0x65) + + //Default oversampling and filter register values. + this._pressure_oversample = 0b011 + this._temp_oversample = 0b100 + this._humidity_oversample = 0b010 + this._filter = 0b010 + } + + private async readCalibration() { + const b0 = await this.readRegBuf(BME680_COEFF_ADDR1, 25) + const b1 = await this.readRegBuf(BME680_COEFF_ADDR2, 16) + const coeff = unpack( + " idx.map(i => coeff[i]) + + this._temp_calibration = getIdx([23, 0, 1]) + this._pressure_calibration = getIdx([3, 4, 5, 7, 8, 10, 9, 12, 13, 14]) + this._humidity_calibration = getIdx([17, 16, 18, 19, 20, 21, 22]) + this._gas_calibration = getIdx([25, 24, 26]) + + // flip around H1 & H2 + this._humidity_calibration[1] *= 16 + this._humidity_calibration[1] += this._humidity_calibration[0] % 16 + this._humidity_calibration[0] /= 16 + + this._heat_range = ((await this.readReg(0x02)) & 0x30) / 16 + this._heat_val = await this.readReg(0x00) + this._sw_err = ((await this.readReg(0x04)) & 0xf0) / 16 + } + + private async performReading() { + // Perform a single-shot reading from the sensor and fill internal data structure for calculations + + // set filter + await this.writeReg(BME680_REG_CONFIG, this._filter << 2) + // turn on temp oversample & pressure oversample + await this.writeReg( + BME680_REG_CTRL_MEAS, + (this._temp_oversample << 5) | (this._pressure_oversample << 2) + ) + // turn on humidity oversample + await this.writeReg(BME680_REG_CTRL_HUM, this._humidity_oversample) + // gas measurements enabled + if (this.chipVariant === 0x01) + await this.writeReg(BME680_REG_CTRL_GAS, BME680_RUNGAS << 1) + else await this.writeReg(BME680_REG_CTRL_GAS, BME680_RUNGAS) + let ctrl = await this.readReg(BME680_REG_CTRL_MEAS) + ctrl = (ctrl & 0xfc) | 0x01 // enable single shot! + await this.writeReg(BME680_REG_CTRL_MEAS, ctrl) + let new_data = false + let data: Buffer + while (!new_data) { + data = await this.readRegBuf(BME680_REG_MEAS_STATUS, 17) + new_data = (data[0] & 0x80) !== 0 + await delay(5) + } + + this._adc_pres = read24(data, 2) / 16 + this._adc_temp = read24(data, 5) / 16 + + this._adc_hum = read16(data, 8) + if (this.chipVariant === 0x01) { + this._adc_gas = read16(data, 15) >> 6 + this._gas_range = data[16] & 0x0f + } else { + this._adc_gas = read16(data, 13) >> 6 + this._gas_range = data[14] & 0x0f + } + + const var1 = this._adc_temp / 8 - this._temp_calibration[0] * 2 + const var2 = (var1 * this._temp_calibration[1]) / 2048 + let var3 = ((var1 / 2) * (var1 / 2)) / 4096 + var3 = (var3 * this._temp_calibration[2] * 16) / 16384 + this._t_fine = Math.floor(var2 + var3) + } + + private pressure() { + let var1 = this._t_fine / 2 - 64000 + let var2 = ((var1 / 4) * (var1 / 4)) / 2048 + var2 = (var2 * this._pressure_calibration[5]) / 4 + var2 = var2 + var1 * this._pressure_calibration[4] * 2 + var2 = var2 / 4 + this._pressure_calibration[3] * 65536 + var1 = + ((((var1 / 4) * (var1 / 4)) / 8192) * + (this._pressure_calibration[2] * 32)) / + 8 + + (this._pressure_calibration[1] * var1) / 2 + var1 = var1 / 262144 + var1 = ((32768 + var1) * this._pressure_calibration[0]) / 32768 + let calc_pres = 1048576 - this._adc_pres + calc_pres = (calc_pres - var2 / 4096) * 3125 + calc_pres = (calc_pres / var1) * 2 + var1 = + (this._pressure_calibration[8] * + (((calc_pres / 8) * (calc_pres / 8)) / 8192)) / + 4096 + var2 = ((calc_pres / 4) * this._pressure_calibration[7]) / 8192 + let var3 = + ((calc_pres / 256) ** 3 * this._pressure_calibration[9]) / 131072 + calc_pres += + (var1 + var2 + var3 + this._pressure_calibration[6] * 128) / 16 + return calc_pres / 100 + } + + private temperature() { + const calc_temp = (this._t_fine * 5 + 128) / 256 + return calc_temp / 100 + } + + private humidity() { + let temp_scaled = (this._t_fine * 5 + 128) / 256 + let var1 = + this._adc_hum - + this._humidity_calibration[0] * 16 - + (temp_scaled * this._humidity_calibration[2]) / 200 + let var2 = + (this._humidity_calibration[1] * + ((temp_scaled * this._humidity_calibration[3]) / 100 + + (temp_scaled * + ((temp_scaled * this._humidity_calibration[4]) / 100)) / + 64 / + 100 + + 16384)) / + 1024 + let var3 = var1 * var2 + let var4 = this._humidity_calibration[5] * 128 + var4 = (var4 + (temp_scaled * this._humidity_calibration[6]) / 100) / 16 + let var5 = ((var3 / 16384) * (var3 / 16384)) / 1024 + let var6 = (var4 * var5) / 2 + let calc_hum = (((var3 + var6) / 1024) * 1000) / 4096 + calc_hum /= 1000 // get back to RH + return Math.constrain(calc_hum, 0, 100) + } + + private fillTables() { + if (this._LOOKUP_TABLE_1) return + this._LOOKUP_TABLE_1 = [ + 2147483647.0, 2147483647.0, 2147483647.0, 2147483647.0, + 2147483647.0, 2126008810.0, 2147483647.0, 2130303777.0, + 2147483647.0, 2147483647.0, 2143188679.0, 2136746228.0, + 2147483647.0, 2126008810.0, 2147483647.0, 2147483647.0, + ] + this._LOOKUP_TABLE_2 = [ + 4096000000.0, 2048000000.0, 1024000000.0, 512000000.0, 255744255.0, + 127110228.0, 64000000.0, 32258064.0, 16016016.0, 8000000.0, + 4000000.0, 2000000.0, 1000000.0, 500000.0, 250000.0, 125000.0, + ] + } + + private gas() { + let calc_gas_res = 0 + if (this.chipVariant === 0x01) { + // taken from https://github.com/BoschSensortec/BME68x-Sensor-API + let var1 = 262144 >> this._gas_range + let var2 = this._adc_gas - 512 + var2 *= 3 + var2 = 4096 + var2 + calc_gas_res = (1000 * var1) / var2 + calc_gas_res = calc_gas_res * 100 + } else { + this.fillTables() + let var1 = + ((1340 + 5 * this._sw_err) * + this._LOOKUP_TABLE_1[this._gas_range]) / + 65536 + let var2 = this._adc_gas * 32768 - 16777216 + var1 + let var3 = (this._LOOKUP_TABLE_2[this._gas_range] * var1) / 512 + calc_gas_res = (var3 + var2 / 2) / var2 + } + return Math.floor(calc_gas_res) + } + + override async readData() { + await this.performReading() + const gas = this.gas() + const humidity = this.humidity() + const temperature = this.temperature() + const pressure = this.pressure() + const r = { + temperature, + humidity, + gas, + pressure, + } + // console.log(r) + return r + } +} + +/** + * Start driver for Bosch BME680 temperature/humidity/pressure/gas sensor at I2C \`0x76\` (default) or \`0x77\`. + * @see {@link https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf | Datasheet} + * @see {@link https://www.adafruit.com/product/3660 | Adafruit} + * @devsPart Bosch BME68 + * @devsServices temperature, humidity, airPressure, airQualityIndex + * @throws DriverError + */ +export async function startBME680(options?: { + address?: 0x77 | 0x76 + temperatureName?: string + humidityName?: string + pressureName?: string + airQualityIndexName?: string + baseName?: string +}) { + const { + baseName, + temperatureName, + humidityName, + pressureName, + airQualityIndexName, + address, + } = options || {} + const driver = new BME680Driver(address || 0x76) + await driver.init() + return { + temperature: startTemperature({ + min: -40, + max: 85, + errorValue: 1, + reading: async () => (await driver.read()).temperature, + name: temperatureName, + baseName, + }), + humidity: startHumidity({ + errorValue: 3, + reading: async () => (await driver.read()).humidity, + name: humidityName, + baseName, + }), + pressure: startAirPressure({ + min: 300, + max: 1100, + errorValue: 0.12, + reading: async () => (await driver.read()).pressure, + name: pressureName, + baseName, + }), + // TODO this is not really AQI + airQualityIndex: startAirQualityIndex({ + min: 1, + max: 100000, + reading: async () => (await driver.read()).gas, + name: airQualityIndexName, + baseName, + }), + } +} +`, + "drivers/src/characterscreen.ts": `import * as ds from "@devicescript/core" +import { Server, ServerOptions, startServer } from "@devicescript/server" +import { + AsyncVoid, + CharacterScreen, + CharacterScreenServerSpec, + assert, +} from "@devicescript/core" +import { Image, fontForText, Font, Display } from "@devicescript/graphics" + +class CharacterScreenServer + extends Server + implements CharacterScreenServerSpec +{ + private _message: string + + private readonly _image: Image + private readonly _font: Font + private readonly _render: () => AsyncVoid + private readonly _columns: number + private readonly _rows: number + /** + * Foreground color (palete index) + */ + color = 1 + // letter spacing + letterSpacing = 1 + // line spacing + lineSpacing = 1 + // outer margin + margin = 0 + + constructor( + options: { + display: Display + font: Font + } & CharacterScreenOptions & + ServerOptions + ) { + super(ds.CharacterScreen.spec, options) + this._image = options.display.image + this._font = options.font + this._render = options.display.show + this._columns = options.columns + this._rows = options.rows + + if (this._columns === undefined) + this._columns = Math.floor( + (this._image.width - 2 * this.margin) / + (this._font.charWidth + this.letterSpacing) + ) + if (this._rows === undefined) + this._rows = Math.floor( + (this._image.height - 2 * this.margin) / + (this._font.charHeight + this.lineSpacing) + ) + + if (this._rows === undefined || this._columns === undefined) + throw new Error("rows or columns is missing") + + this._message = "" + + // clear screen + if (this._image) this._image.fill(0) + } + + message() { + return this._message + } + + set_message(value: string) { + const old = this._message + this._message = value || "" + if (old !== this._message) this.refresh() + } + + columns() { + return this._columns + } + + rows() { + return this._rows + } + + private refresh() { + if (this._render) this.render.start() + } + + private async render() { + assert(!!this._render) + + // paint image + const img = this._image + const ctx = img.allocContext() + + const columns = this._columns + const rows = this._rows + const message = this._message + + const cw = this._font.charWidth + const ch = this._font.charHeight + const letterSpacing = this.letterSpacing + const lineSpacing = this.lineSpacing + const margin = this.margin + + ctx.font = this._font + ctx.fillColor = this.color + ctx.strokeColor = this.color + ctx.clear() + ctx.translate(margin, margin) + + let row = 0 + let column = 0 + for (const char of message) { + if (char === "\\n") { + ctx.translate(0, ch + lineSpacing) + row += 1 + column = 0 + } else { + if (column < columns) { + ctx.fillText(char, column * (cw + letterSpacing), 0) + } + column += 1 + } + if (row >= rows) break + } + + // flush buffer + await this._render() + } +} + +export interface CharacterScreenOptions { + columns?: number + rows?: number +} + +/** + * Starts a character screen server on a display. + */ +export async function startCharacterScreen( + display: Display, + options: CharacterScreenOptions & ServerOptions = {} +) { + const font = fontForText("") + + await display.init() + + const server = new CharacterScreenServer({ + display, + font, + ...options, + }) + + return new CharacterScreen(startServer(server, options)) +} +`, + "drivers/src/core.ts": `import * as ds from "@devicescript/core" +import { Image } from "@devicescript/graphics" + +export class DriverError extends Error { + constructor(message?: string) { + super(message) + this.name = "DriverError" + } +} + +export function throttle( + ms: number, + f: () => ds.AsyncValue +): () => ds.AsyncValue { + let last = 0 + let lastV: T = undefined + let reading = false + return async () => { + while (reading) await ds.sleep(10) + const n = ds.millis() + if (n - last < ms) return lastV + reading = true + try { + lastV = await f() + last = n + } finally { + reading = false + } + return lastV + } +} +`, + "drivers/src/dotmatrix.ts": `import * as ds from "@devicescript/core" +import { Server, ServerOptions, startServer } from "@devicescript/server" +import { + AsyncVoid, + DotMatrix, + DotMatrixServerSpec, + assert, +} from "@devicescript/core" +import { Image, Display } from "@devicescript/graphics" +import { JD_SERIAL_MAX_PAYLOAD_SIZE } from "@devicescript/core/src/jacdac" + +class DotMatrixServer extends Server implements DotMatrixServerSpec { + private _dots: Buffer + + private readonly _image: Image + private readonly _render: () => AsyncVoid + private readonly _columns: number + private readonly _rows: number + /** + * Foreground color (palete index) + */ + color = 1 + marginX = 0 + marginY = 0 + marginCell = 1 + cellWidth + + constructor( + options: { + display: Display + columns: number + rows: number + } & DotMatrixOptions & + ServerOptions + ) { + super(ds.DotMatrix.spec, options) + this._image = options.display.image + this._render = options.display.show + this._columns = options.columns + this._rows = options.rows + this.cellWidth = options.cellWidth + if (this.cellWidth === undefined) { + const cw = Math.floor( + Math.min( + this._image.width / this._columns, + this._image.height / this._rows + ) + ) + this.cellWidth = Math.max(1, cw - this.marginCell) + } + + const column_size = (this._rows + 7) >> 3 + if (this._columns * column_size > JD_SERIAL_MAX_PAYLOAD_SIZE) + throw new RangeError("too many dots to fit in a packet") + this._dots = Buffer.alloc(this._columns * column_size) + + this.marginX = + (this._image.width - + (this._columns * (this.cellWidth + this.marginCell) - + this.marginCell)) >> + 1 + this.marginY = + (this._image.height - + (this._rows * (this.cellWidth + this.marginCell) - + this.marginCell)) >> + 1 + + // clear screen + if (this._image) this._image.fill(0) + } + + dots() { + return this._dots + } + + set_dots(value: Buffer) { + this._dots = value + this.refresh() + } + + columns() { + return this._columns + } + + rows() { + return this._rows + } + + private refresh() { + if (this._render) this.render.start() + } + + private async render() { + assert(!!this._render) + + // paint image + const img = this._image + const ctx = img.allocContext() + + const columns = this._columns + const rows = this._rows + const dots = this._dots + const c = this.cellWidth + const m = this.marginCell + const cm = c + m + const column_size = (rows + 7) >> 3 + + ctx.fillColor = this.color + ctx.clear() + ctx.translate(this.marginX, this.marginY) + for (let row = 0; row < rows; row++) { + for (let column = 0; column < columns; column++) { + const v = + dots[column * column_size + (row >> 3)] & (1 << (row & 7)) + if (v) { + ctx.fillRect(column * cm, row * cm, c, c) + } + } + } + + // flush buffer + await this._render() + } +} + +export interface DotMatrixOptions { + columns: number + rows: number + cellWidth?: number +} + +/** + * Starts a dot matrix server on a display. + */ +export async function startDotMatrix( + display: Display, + options: DotMatrixOptions & ServerOptions +) { + const server = new DotMatrixServer({ + display, + ...options, + }) + + return new DotMatrix(startServer(server, options)) +} +`, + "drivers/src/driver.ts": `import { AsyncValue, isSimulator, millis, sleep } from "@devicescript/core" +import { i2c, I2C } from "@devicescript/i2c" +import { DriverError, throttle } from "./core" + +export interface I2CDriverOptions { + /** + * I2c client, default is \`i2c\` + */ + client?: I2C +} + +/** + * A helper class to implement I2C drivers + */ +export abstract class I2CDriver { + readonly devAddr: number + readonly client: I2C + + /** + * Instantiate a driver + * @param devAddr a 7 bit i2c address + * @param options + */ + constructor(devAddr: number, options?: I2CDriverOptions) { + const { client } = options || {} + + this.devAddr = devAddr + this.client = client || i2c + } + + /** + * Initializes the I2C device + * @throws DriverError + */ + async init(): Promise { + if (isSimulator()) return + try { + await this.initDriver() + } catch (e: any) { + if (e instanceof DriverError) throw e + throw new DriverError( + "I2C device not found or malfunctioning: " + e.message + ) + } + } + + /** + * Initializes the I2C device + * @throws I2CError + */ + protected abstract initDriver(): Promise + + /** + * Execute I2C transaction + * @param devAddr a 7 bit i2c address + * @param writeBuf the value to write + * @param numRead number of bytes to read afterwards + * @returns a buffer \`numRead\` bytes long + */ + async xfer(writeBuf: Buffer, numRead: number): Promise { + return await this.client.xfer(this.devAddr, writeBuf, numRead) + } + + /** + * Write a byte to a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @param byte the value to write + * @throws I2CError + */ + async writeReg(regAddr: number, byte: number): Promise { + return await this.client.writeReg(this.devAddr, regAddr, byte) + } + /** + * read a byte from a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @returns a byte + * @throws I2CError + */ + async readReg(regAddr: number): Promise { + return await this.client.readReg(this.devAddr, regAddr) + } + /** + * write a buffer to a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @param b a byte buffer + * @throws I2CError + */ + async writeRegBuf(regAddr: number, b: Buffer): Promise { + return await this.client.writeRegBuf(this.devAddr, regAddr, b) + } + /** + * read a buffer from a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @param size the number of bytes to request + * @returns a byte buffer + * @throws I2CError + */ + async readRegBuf(regAddr: number, size: number): Promise { + return await this.client.readRegBuf(this.devAddr, regAddr, size) + } + /** + * read a raw buffer + * @param devAddr a 7 bit i2c address + * @param size the number of bytes to request + * @returns a byte buffer + * @throws I2CError + */ + async readBuf(size: number): Promise { + return await this.client.readBuf(this.devAddr, size) + } + /** + * write a raw buffer + * @param devAddr a 7 bit i2c address + * @param b a byte buffer + * @throws I2CError + */ + async writeBuf(b: Buffer): Promise { + return await this.client.writeBuf(this.devAddr, b) + } +} + +export interface I2CSensorDriverOptions extends I2CDriverOptions { + /** + * Data read throttle time in milliseconds + */ + readCacheTime?: number +} + +/** + * A helper class to implement I2C sensor drivers + */ +export abstract class I2CSensorDriver extends I2CDriver { + _data: TData + _dataTime = 0 + _dataCacheTime: number + + /** + * Instantiate a driver + * @param devAddr a 7 bit i2c address + * @param options + */ + constructor(devAddr: number, options?: I2CSensorDriverOptions) { + super(devAddr, options) + const { readCacheTime } = options || {} + this._dataCacheTime = readCacheTime || 50 + } + + /** + * Throttled read of the sensor data + * @returns + */ + async read(): Promise { + if (isSimulator()) return {} as any + + // lock on reading data + while (this._dataTime === -1) await sleep(5) + + // cache hit + if (millis() - this._dataTime < this._dataCacheTime) return this._data + + // query sensor again, read data is throttled + this._dataTime = -1 + this._data = await this.readData() + this._dataTime = millis() + return this._data + } + + /** + * Perform the I2C transaction to read the sensor data + */ + protected abstract readData(): AsyncValue +} +`, + "drivers/src/esp32c3fh4rgb.ts": `import { pins, board } from "@dsboard/esp32_c3fh4_rgb" +import { Led, LedStripLightType, LedVariant } from "@devicescript/core" +import { startLed } from "@devicescript/drivers" +import { configureHardware } from "@devicescript/servers" + +/** + * Driver for the ESP32-C3FH4-RGB board + * + * @devsWhenUsed + */ +export class Esp32C3FH4RGB { + constructor() { + configureHardware({ + scanI2C: false, + }) + } + + /** + * Gets the pin mappings + */ + pins() { + return pins + } + + private _led: Led + /** + * Starts the LED service for the 5x5 matrix + * @returns + */ + async startLed(roleName?: string) { + return ( + this._led || + (this._led = await startLed({ + length: 25, + columns: 5, + intensity: 0.1, + variant: LedVariant.Matrix, + hwConfig: { + type: LedStripLightType.WS2812B_GRB, + pin: pins.LEDS, + }, + roleName, + })) + ) + } + + /** + * Start built-in ButtonBOOT + */ + startButtonBOOT(roleName?: string) { + return board.startButtonBOOT(roleName) + } +} +`, + "drivers/src/index.ts": `import { configureHardware } from "@devicescript/servers" + +export * from "./driver" +export * from "./core" +export * from "./shtc3" +export * from "./sht30" +export * from "./aht20" +export * from "./ltr390" +export * from "./bme680" +export * from "./ssd1306" +export * from "./characterscreen" +export * from "./indexedscreen" +export * from "./dotmatrix" +export * from "./st7735" +export * from "./uc8151" +export * from "./trafficlight" +export * from "./ledserver" +export * from "./accelerometer" + +export * from "./esp32c3fh4rgb" +export * from "./picobricks" +export * from "./xiaoexpansionboard" +export * from "./wavesharepicolcd114" +export * from "./pimoronipicobadger" + +configureHardware({ scanI2C: false }) +`, + "drivers/src/indexedscreen.ts": `import * as ds from "@devicescript/core" +import { Server, ServerOptions, startServer } from "@devicescript/server" +import { + IndexedScreen, + IndexedScreenServerSpec, + LightBulb, +} from "@devicescript/core" +import { Display, Image, Palette } from "@devicescript/graphics" + +export interface IndexedScreenOptions {} + +class IndexedScreenServer extends Server implements IndexedScreenServerSpec { + readonly display: Display + readonly brightness?: LightBulb + + constructor( + options: { + display: Display + brightness?: LightBulb + } & IndexedScreenOptions & + ServerOptions + ) { + super(ds.IndexedScreen.spec, options) + this.display = options.display + this.brightness = options.brightness + } + startUpdate( + x: number, + y: number, + width: number, + height: number + ): ds.AsyncValue { + // ignored + } + setPixels(pixels: ds.Buffer): ds.AsyncValue { + // ignored + } + async intensity(): Promise { + if (this.brightness) return await this.brightness.intensity.read() + else return 1 + } + async set_intensity(value: number) { + if (this.brightness) await this.brightness.intensity.write(value) + } + palette(): Buffer { + return this.display.palette.packed() + } + set_palette(value: Buffer): void { + this.display.palette.unpack(value) + } + bitsPerPixel(): ds.AsyncValue { + return this.display.image.bpp + } + width(): ds.AsyncValue { + return this.display.image.width + } + height(): ds.AsyncValue { + return this.display.image.height + } + widthMajor(): ds.AsyncValue { + return false + } + upSampling(): ds.AsyncValue { + return 1 + } + rotation(): ds.AsyncValue { + return 0 + } + + /** + * Renders the current image on the display. + * On the device simulator, sends the image to simulator dashboard. + */ + async show() { + await this.display.show() + if (ds.isSimulator()) { + const topic = \`jd/\${this.serviceIndex}/pixels\` + await ds._twinMessage(topic, this.display.image.buffer) + } + } +} + +/** + * A pseudo-client indexed screen client + */ +export interface IndexScreenClient { + palette: Palette + image: Image + show: () => Promise +} + +/** + * Starts an indexed color screen server on a display. + * Due to bandwidth limitation, simulation of the screen is only supported + * for the simulated device. + */ +export async function startIndexedScreen( + display: Display, + options: IndexedScreenOptions & ServerOptions = {} +): Promise { + await display.init() + const server = new IndexedScreenServer({ + display, + ...options, + }) + // start client that expose it on the bus + const client = new IndexedScreen(startServer(server, options)) + + return { + palette: display.palette, + image: display.image, + show: async () => await server.show(), + } +} +`, + "drivers/src/ledserver.ts": `import * as ds from "@devicescript/core" +import { PixelBuffer, fillFade } from "@devicescript/runtime" +import { Server, ServerOptions, startServer } from "@devicescript/server" +import { SPI } from "@devicescript/spi" + +export interface LedHwConfigWS2812B { + type: ds.LedStripLightType.WS2812B_GRB + + /** + * Pin where the strip is connected. + */ + pin: ds.OutputPin +} + +export interface LedHwConfigAPALike { + type: ds.LedStripLightType.APA102 | ds.LedStripLightType.SK9822 + + /** + * The SPI instance to use. + */ + spi: SPI + + /** + * D-pin. + */ + pinData: ds.OutputPin + + /** + * C-pin. + */ + pinClk: ds.OutputPin +} + +export type LedHwConfig = LedHwConfigWS2812B | LedHwConfigAPALike + +export interface LedServerOptions { + /** + * Number of LEDs + */ + length: number + + /** + * Brightness applied to pixels before being rendered. + * This allocate twice the memory if less than 1 as an additional buffer is needed to compute the color. + * @default 1 + */ + intensity?: number + /** + * Number of columns of a LED matrix + */ + columns?: number + ledsPerPixel?: number + /** + * For monochrome LEDs, the LED wavelength + */ + waveLength?: number + /** + * The luminous power of the LEDs, is it very bright? + */ + luminousIntensity?: number + /** + * The shape and topology of the LEDs + */ + variant?: ds.LedVariant + /** + * Specify the amount of gamma correction. Default is 2.8, set to 1 to cancel correction. + * @see {@link https://cdn-learn.adafruit.com/downloads/pdf/led-tricks-gamma-correction.pdf} + */ + gamma?: number + /** + * Maximum supported power for LED strip + */ + maxPower?: number + + /** + * Specifies the hardware configuration of the light strip. + */ + hwConfig: LedHwConfig +} + +class LedServer extends Server implements ds.LedServerSpec { + private _intensity: number + private _actualBrightness: number + private _columns: number + private _ledPerPixels: number + private _waveLength: number + private _luminousIntensity: number + private _variant: ds.LedVariant + private _gamma: number + private _maxPower: number + private _hwConfig: LedHwConfig + + readonly buffer: PixelBuffer + + constructor(options: LedServerOptions & ServerOptions) { + super(ds.Led.spec, options) + this.buffer = PixelBuffer.alloc(options.length) + this._intensity = options.intensity ?? 1 + this._columns = options.columns + this._ledPerPixels = options.ledsPerPixel + this._waveLength = options.waveLength + this._luminousIntensity = options.luminousIntensity + this._variant = options.variant + this._gamma = options.gamma + this._maxPower = options.maxPower + this._hwConfig = options.hwConfig + } + + pixels(): ds.Buffer { + if (this.buffer.length < 64) return this.buffer.buffer + else return Buffer.alloc(0) + } + set_pixels(value: ds.Buffer): void { + this.buffer.buffer.blitAt(0, value, 0, value.length) + } + intensity(): number { + return this._intensity + } + set_intensity(value: number): void { + this._intensity = Math.constrain(value, 0, 1) + } + actualBrightness(): number { + return this._actualBrightness ?? this._intensity + } + numPixels(): number { + return this.buffer.length + } + numColumns(): number { + return this._columns + } + ledsPerPixel(): number { + return this._ledPerPixels + } + waveLength(): number { + return this._waveLength || 0 + } + luminousIntensity(): number { + return this._luminousIntensity + } + variant(): ds.LedVariant { + return this._variant + } + maxPower(): number { + return this._maxPower + } + set_maxPower(value: number): void { + // ignore + } + + /** + * Display buffer on hardware + */ + async show(): Promise { + let b = this.render() + b = this.capPower(b) + + if (ds.isSimulator()) return + + const hw = this._hwConfig + if (hw.type === ds.LedStripLightType.WS2812B_GRB) { + if (b === this.buffer) b = b.allocClone() + const buf = b.buffer + const len = buf.length + for (let i = 0; i < len; i += 3) { + const r = buf[i] + const g = buf[i + 1] + buf[i] = g + buf[i + 1] = r + } + await ledStripSend(hw.pin, buf) + } else { + // 32+0.5*numPixels bits of zeroes at the end + const numPixels = b.length + const paddingWords = (32 + (numPixels >> 1) + 31) >> 5 + const txbuf = Buffer.alloc(4 * (1 + numPixels + paddingWords)) + let dst = 4 + let off = b.start * 3 + const buf = b.buffer + for (let i = 0; i < numPixels; ++i) { + // IBGR + txbuf[dst] = 0xff + txbuf[dst + 1] = buf[off + 2] + txbuf[dst + 2] = buf[off + 1] + txbuf[dst + 3] = buf[off] + dst += 4 + off += 3 + } + + hw.spi.configure({ + mosi: hw.pinData, + sck: hw.pinClk, + hz: + hw.type === ds.LedStripLightType.SK9822 + ? 30_000_000 + : 15_000_000, + }) + await hw.spi.write(txbuf) + } + } + + private render() { + let b = this.buffer + const brightness = this.actualBrightness() + + // apply fade if needed + if (brightness < 1) { + if (b === this.buffer) b = b.allocClone() + fillFade(b, this._intensity) + } + + // apply gamma + const g = this._gamma + if (g && g !== 1) { + if (b === this.buffer) b = b.allocClone() + b.correctGamma(this._gamma) + } + return b + } + + private capPower(b: PixelBuffer): PixelBuffer { + if (!(this._maxPower > 0)) return b + + const power = 0 // TODO + // if power maxed out, cap and recompute + if (power > this._maxPower) { + // compute 80% of max brightness + // gamma? + this._actualBrightness = + ((this._intensity * this._maxPower) / power) * 0.8 + this.render() + // power is not maxed, but residual brightness + } else if (this._actualBrightness) { + // update actualbrightness + const alpha = 0.1 + const threshold = 0.05 + // towards actual brightness + this._actualBrightness = + (1 - alpha) * this._actualBrightness + alpha * this._intensity + // when within 10% of brightness, clear flag + if (Math.abs(this._actualBrightness - this._intensity) < threshold) + this._actualBrightness = undefined + } + return b + } +} + +/** + * Starts a programmable LED server. + * Simulation is supported for up to 64 LEDs; otherwise only the simulator + * will reflect the state of LEDs. + * @param options + * @returns + */ +export async function startLed( + options: LedServerOptions & ServerOptions +): Promise { + const { length } = options + const server = new LedServer(options) + const client = new ds.Led(startServer(server, options)) + + ;(client as any)._buffer = server.buffer + client.show = async function () { + await server.show() + if (length <= 64) await client.pixels.write(server.buffer.buffer) + else if (ds.isSimulator()) { + // the simulator handles brightness separately + const topic = \`jd/\${server.serviceIndex}/leds\` + await ds._twinMessage(topic, server.buffer.buffer) + } + } + + return client +} + +type DsLedStrip = typeof ds & { + ledStripSend(pin: number, data: Buffer): Promise +} + +export async function ledStripSend(pin: ds.OutputPin, data: Buffer) { + await (ds as DsLedStrip).ledStripSend(pin.gpio, data) +} +`, + "drivers/src/ltr390.ts": `import * as ds from "@devicescript/core" +import { DriverError } from "./core" +import { I2CSensorDriver } from "./driver" +import { startSimpleServer } from "./servers" + +const LTR390UV_ADDR = 0x53 +const LTR390UV_MAIN_CTRL = 0x00 +const LTR390UV_MEAS_RATE = 0x04 +const LTR390UV_GAIN = 0x05 +const LTR390UV_PART_ID = 0x06 +const LTR390UV_MAIN_STATUS = 0x07 +const LTR390UV_ALSDATA = 0x0d +const LTR390UV_UVSDATA = 0x10 + +const LTR390UV_READ_THROTTLE = 300 + +class LTR390Driver extends I2CSensorDriver<{ + illuminance: number + uvindex: number +}> { + private gain: number + + constructor() { + super(LTR390UV_ADDR, { readCacheTime: LTR390UV_READ_THROTTLE }) + } + + private async readDataAt(addr: number) { + while (((await this.readReg(LTR390UV_MAIN_STATUS)) & 0x08) === 0) + await ds.sleep(5) + const data = await this.readRegBuf(addr, 3) + return data[0] | (data[1] << 8) | ((data[2] & 0xf) << 16) + } + + override async initDriver() { + const part = await this.readReg(LTR390UV_PART_ID) + console.debug(\`LTR390 part \${part}\`) + if (part >> 4 !== 0xb) throw new DriverError(\`can't find LTR390UV\`) + await this.writeReg(LTR390UV_MEAS_RATE, 0x22) // 18bit/100ms + this.gain = 3 + await this.writeReg(LTR390UV_GAIN, 0x01) + } + + override async readData() { + await this.writeReg(LTR390UV_MAIN_CTRL, 0x02) // ALS Mode, Enabled + const v = await this.readDataAt(LTR390UV_ALSDATA) + const illuminance = (v * 6) / (10 * this.gain) + + await this.writeReg(LTR390UV_MAIN_CTRL, 0x0a) // UV Mode, Enabled + const v2 = await this.readDataAt(LTR390UV_UVSDATA) + const uvindex = (v2 * 2) / this.gain + + await this.writeReg(LTR390UV_MAIN_CTRL, 0x00) // Disabled + + return { illuminance, uvindex } + } +} + +/** + * Start driver for LITEON LTR-390UV-01 UV/ambient light sensor at I2C address \`0x53\`. + * @devsPart LITEON LTR-390UV-01 + * @devsServices uvIndex, illuminance + * @see {@link https://optoelectronics.liteon.com/upload/download/DS86-2015-0004/LTR-390UV_Final_%20DS_V1%201.pdf | Datasheet} + * @throws DriverError + */ +export async function startLTR390(options?: { + uvIndexName?: string + illuminanceName?: string + baseName?: string +}) { + const { uvIndexName, illuminanceName, baseName } = options || {} + const driver = new LTR390Driver() + await driver.init() + const uvIndex = new ds.UvIndex( + startSimpleServer({ + ...options, + spec: ds.UvIndex.spec, + errorFraction: 0.1, + reading: async () => (await driver.read()).uvindex, + name: uvIndexName, + baseName, + }) + ) + const illuminance = new ds.Illuminance( + startSimpleServer({ + ...options, + spec: ds.Illuminance.spec, + errorFraction: 0.1, + reading: async () => (await driver.read()).illuminance, + name: illuminanceName, + baseName, + }) + ) + + return { uvIndex, illuminance } +} +`, + "drivers/src/main.ts": `import { describe, expect, test } from "@devicescript/test" + +describe("drivers", () => {}) +`, + "drivers/src/picobricks.ts": `import { LightLevelVariant, PotentiometerVariant } from "@devicescript/core" +import { + configureHardware, + startButton, + startBuzzer, + startLightBulb, + startLightLevel, + startMotor, + startPotentiometer, + startRelay, + startServo, +} from "@devicescript/servers" +import { pins } from "@dsboard/pico_w" +import { SSD1306Driver } from "@devicescript/drivers" + +/** + * Drivers for the {@link https://shop.robotistan.com/products/pico-bricks | Pico Bricks } shield for Raspberry Pi Pico ({@link https://github.com/Robotistan/PicoBricks/tree/main/Documents | datasheets}). + * + * @devsPart Pico Bricks for Raspberry Pi Pico + * @devsWhenUsed + */ +export class PicoBricks { + constructor() { + configureHardware({ + scanI2C: false, + i2c: { + pinSDA: pins.GP4, + pinSCL: pins.GP5, + }, + }) + } + /** + * Starts the driver for the BUTTON + * @returns a button service client + */ + startButton() { + // GP10 + return startButton({ + pin: pins.GP10, + activeHigh: true, + }) + } + + /** + * Starts the driver for the LED-BUTTON + * @returns lightbulb service client + */ + startLED() { + return startLightBulb({ + pin: pins.GP7, + }) + } + + /** + * Starts the driver for the RELAY + * @returns relay service client + */ + startRelay() { + return startRelay({ + pin: pins.GP12, + maxCurrent: 5000, + }) + } + + /** + * Starts a motor on MOTOR1 + * @returns + */ + startMotor1() { + return startMotor({ + pin1: pins.GP21, + }) + } + + /** + * Starts a motor on MOTOR2 + * @returns + */ + startMotor2() { + return startMotor({ + pin1: pins.GP22, + }) + } + + /** + * Starts a servo on SV1 + * @param id + * @returns + */ + startServo1() { + return startServo({ + pin: pins.GP21, + }) + } + + /** + * Starts a servo on SV2 + * @param id + * @returns + */ + startServo2() { + return startServo({ + pin: pins.GP22, + }) + } + + /** + * Starts the buzzer driver + * @returns buzzer client service + */ + startBuzzer() { + return startBuzzer({ + pin: pins.GP20, + }) + } + + /** + * Starts the light level sensor + * @returns light level service client + */ + startLightSensor() { + return startLightLevel({ + pin: pins.GP27, + variant: LightLevelVariant.PhotoResistor, + }) + } + + /** + * Start potentiometer driver + * @returns potentiometer service driver + */ + startPotentiometer() { + return startPotentiometer({ + pin: pins.GP26, + variant: PotentiometerVariant.Rotary, + }) + } + + /** + * Starts the OLED screen driver + * @returns + */ + async startOLED() { + const oled = new SSD1306Driver({ + devAddr: 0x3c, + width: 128, + height: 64, + }) + await oled.init() + return oled + } +} +`, + "drivers/src/pimoronipicobadger.ts": `import { UC8151Driver } from "@devicescript/drivers" +import { Image } from "@devicescript/graphics" +import { + configureHardware, + startGamepad, + startLightBulb, +} from "@devicescript/servers" +import { spi } from "@devicescript/spi" +import { pins } from "@dsboard/pico_w" + +/** + * Support for Badger 2040 W (Pico W Aboard) + * + * @url https://shop.pimoroni.com/products/badger-2040-w + * @devsPart Pimoroni Pico Badger + * @devsWhenUsed + */ +export class PimoroniBadger2040W { + // PCF85063A I2C:0x51, RTC-ALARM on GP8 + constructor() { + configureHardware({ + i2c: { + pinSDA: pins.GP4, + pinSCL: pins.GP5, + }, + log: { + pinTX: pins.GP0, + }, + }) + } + + startGamepad() { + return startGamepad({ + activeHigh: true, + pinA: pins.GP12, + pinB: pins.GP13, + pinDown: pins.GP11, + pinX: pins.GP14, // C + pinUp: pins.GP15, + }) + } + + startLED() { + return startLightBulb({ + pin: pins.GP22, + dimmable: true, + }) + } + + async startDisplay() { + spi.configure({ + miso: pins.GP16, + mosi: pins.GP19, + sck: pins.GP18, + hz: 8_000_000, + }) + + const d = new UC8151Driver(Image.alloc(296, 128, 1), { + cs: pins.GP17, + dc: pins.GP20, + reset: pins.GP21, + busy: pins.GP26, + + flip: false, + spi: spi, + }) + await d.init() + return d + } +} +`, + "drivers/src/servers.ts": `import * as ds from "@devicescript/core" +import { SensorServer, ServerOptions, startServer } from "@devicescript/server" + +class SimpleSensorServer extends SensorServer { + errorFraction: number + errorValue: number + min: number + max: number + name: string + + constructor(options: SimpleSensorOptions) { + super(options.spec) + Object.assign(this, options) + } + + async reading() { + return 0 + } + + async readingError() { + if (typeof this.errorFraction === "number") + return this.errorFraction * (await this.reading()) + else if (typeof this.errorValue === "number") return this.errorValue + else return undefined + } + + async instanceName() { + return this.name + } + + async minReading() { + return this.min + } + + async maxReading() { + return this.max + } +} + +export interface SimpleSensorBaseOptions { + reading(): ds.AsyncValue + minReading?(): ds.AsyncValue + maxReading?(): ds.AsyncValue + readingError?(): ds.AsyncValue + variant?(): () => number + errorFraction?: number + errorValue?: number + min?: number + max?: number + name?: string + baseName?: string + simOk?: boolean +} + +export interface SimpleSensorOptions extends SimpleSensorBaseOptions { + spec: ds.ServiceSpec +} + +let simRoles: any + +function simRole(pref: string) { + for (let i = 0; ; i++) { + const k = pref + "_" + i + if (!simRoles[k]) { + simRoles[k] = true + return k + } + } +} + +export function startSimpleServer( + options: SimpleSensorOptions & ServerOptions +) { + if (ds.isSimulator() && !options.simOk) { + if (!simRoles) simRoles = {} + let name = options.name + if (!name) { + if (options.baseName) + name = options.baseName + "_" + options.spec.name + else name = simRole(options.spec.name) + } else simRoles[name] = true + const keys: (keyof SimpleSensorOptions)[] = ["min", "max", "errorValue"] + let num = 0 + for (const key of keys) { + if (options[key] !== undefined) addkv(key, options[key]) + } + if (options.variant) addkv("variant", options.variant()) + console.debug(\`request sim: \${name}\`) + return name + + function addkv(key: string, value: any) { + name += (num === 0 ? "?" : "&") + key + "=" + value + num++ + } + } + return startServer(new SimpleSensorServer(options), options) +} + +export function startTemperature(options: SimpleSensorBaseOptions) { + return new ds.Temperature( + startSimpleServer({ + ...options, + spec: ds.Temperature.spec, + }) + ) +} + +export function startHumidity(options: SimpleSensorBaseOptions) { + if (options.min === undefined) options.min = 0 + if (options.max === undefined) options.max = 100 + return new ds.Humidity( + startSimpleServer({ + ...options, + spec: ds.Humidity.spec, + }) + ) +} + +export function startTemperatureHumidity( + topt: SimpleSensorBaseOptions, + hopt: SimpleSensorBaseOptions +) { + const temperature = startTemperature(topt) + const humidity = startHumidity(hopt) + return { temperature, humidity } +} + +export function startAirPressure(options: SimpleSensorBaseOptions) { + return new ds.AirPressure( + startSimpleServer({ + ...options, + spec: ds.AirPressure.spec, + }) + ) +} + +export function startAirQualityIndex(options: SimpleSensorBaseOptions) { + return new ds.AirQualityIndex( + startSimpleServer({ + ...options, + spec: ds.AirQualityIndex.spec, + }) + ) +} +`, + "drivers/src/sht.ts": `import * as ds from "@devicescript/core" +import { DriverError } from "./core" +import { I2CSensorDriver, I2CSensorDriverOptions } from "./driver" + +export abstract class SHTDriver extends I2CSensorDriver<{ + humidity: number + temperature: number +}> { + constructor(devAddress: number, options?: I2CSensorDriverOptions) { + super(devAddress, options) + } + + protected async readU16(regAddr: number, wait = 0) { + await this.sendCmd(regAddr) + if (wait) await ds.delay(wait) + const buf = await this.readBuf(3) + if (shtCRC8(buf, 2) !== buf[2]) throw new DriverError("SHT CRC error") + return (buf[0] << 8) | buf[1] + } + + protected async sendCmd(cmd: number) { + await this.writeBuf(shtCmd(cmd)) + } +} + +function shtCmd(cmd: number) { + return Buffer.from([cmd >> 8, cmd & 0xff]) +} + +function shtCRC8(b: Buffer, len?: number) { + if (len === undefined) len = b.length + let res = 0xff + for (let i = 0; i < len; ++i) { + res ^= b[i] + for (let j = 0; j < 8; ++j) + if (res & 0x80) res = (res << 1) ^ 0x31 + else res = res << 1 + res &= 0xff + } + return res +} +`, + "drivers/src/sht30.ts": `import { SHTDriver } from "./sht" +import { startTemperatureHumidity } from "./servers" +import { delay } from "@devicescript/core" + +const SHT30_MEASURE_HIGH_REP = 0x2400 // no clock stretching +//const SHT30_SOFTRESET = 0x30a2 +const SHT30_STATUS = 0xf32d +const STH30_THROTTLE = 500 + +class SHT30Driver extends SHTDriver { + constructor(devAddr: number) { + super(devAddr, { readCacheTime: STH30_THROTTLE }) + } + + override async readData() { + await this.sendCmd(SHT30_MEASURE_HIGH_REP) + await delay(20) // datasheet says 15.5ms + const data = await this.readBuf(6) + const temp = (data[0] << 8) | data[1] + const hum = (data[3] << 8) | data[4] + return { + temperature: (175 / 0x10000) * temp - 45, + humidity: (100 / 0x10000) * hum, + } + } + override async initDriver() { + const id = await this.readU16(SHT30_STATUS) + console.debug(\`SHT30 status=\${id}\`) + } +} + +/** + * Start driver for Sensirion SHT30 temperature/humidity sensor at I2C \`0x44\` or \`0x45\` (default is \`0x44\`) + * @devsPart Sensirion SHT30 + * @devsServices temperature, humidity + * @see {@link https://sensirion.com/products/catalog/SHT30-DIS-B/ | Datasheet} + * @throws DriverError + */ +export async function startSHT30(options?: { + address?: 0x44 | 0x45 + temperatureName?: string + humidityName?: string + baseName?: string +}) { + const { address, temperatureName, humidityName, baseName } = options || {} + const driver = new SHT30Driver(address || 0x44) + await driver.init() + return startTemperatureHumidity( + { + min: -40, + max: 125, + errorValue: 0.6, + reading: async () => (await driver.read()).temperature, + name: temperatureName, + baseName, + }, + { + errorValue: 4, + reading: async () => (await driver.read()).humidity, + name: humidityName, + baseName, + } + ) +} +`, + "drivers/src/shtc3.ts": `import { SHTDriver } from "./sht" +import { startTemperatureHumidity } from "./servers" +import { delay, sleep } from "@devicescript/core" +import { DriverError } from "./core" + +const SHTC3_ADDR = 0x70 +const SHTC3_MEASURE_NORMAL = 0x7866 +//const SHTC3_MEASURE_LOW_POWER = 0x609c +//const SHTC3_SOFTRESET = 0x805d +const SHTC3_ID = 0xefc8 +const SHTC3_SLEEP = 0xb098 +const SHTC3_WAKEUP = 0x3517 +const SHTC3_THROTTLE = 500 + +class SHTC3Driver extends SHTDriver { + constructor() { + super(SHTC3_ADDR, { readCacheTime: SHTC3_THROTTLE }) + } + + async wake() { + await this.sendCmd(SHTC3_WAKEUP) + await sleep(1) // really, 200us + } + + async sleep() { + await this.sendCmd(SHTC3_SLEEP) + } + + override async initDriver(): Promise { + await this.wake() + const id = await this.readU16(SHTC3_ID) + console.debug(\`SHTC3 id=\${id}\`) + await this.sendCmd(SHTC3_SLEEP) + } + + override async readData() { + await this.wake() + await this.sendCmd(SHTC3_MEASURE_NORMAL) + + await delay(20) // datasheet says 12.1ms + const data = await this.readBuf(6) + const temp = (data[0] << 8) | data[1] + const hum = (data[3] << 8) | data[4] + const temperature = (175 / 0x10000) * temp - 45 + const humidity = (100 / 0x10000) * hum + + await this.sleep() + + return { + temperature, + humidity, + } + } +} + +/** + * Start driver for Sensirion SHTC3 temperature/humidity sensor at I2C \`0x70\`. + * @devsPart Sensirion SHTC3 + * @devsServices temperature, humidity + * @see {@link https://sensirion.com/products/catalog/SHTC3/ | Datasheet} + * @throws DriverError + */ +export async function startSHTC3(options?: { + temperatureName?: string + humidityName?: string + baseName?: string +}) { + const { temperatureName, humidityName, baseName } = options || {} + const driver = new SHTC3Driver() + await driver.init() + return startTemperatureHumidity( + { + min: -40, + max: 125, + errorValue: 0.8, + reading: async () => (await driver.read()).temperature, + name: temperatureName, + baseName, + }, + { + errorValue: 3.5, + reading: async () => (await driver.read()).humidity, + name: humidityName, + baseName, + } + ) +} +`, + "drivers/src/ssd1306.ts": `import { Image, Display, Palette } from "@devicescript/graphics" +import { I2CDriver } from "./driver" +import { I2CDriverOptions } from "./driver" +import { isSimulator } from "@devicescript/core" + +// inspired by https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/blob/main/adafruit_ssd1306.py + +const DEFAULT_ADDRESS = 0x3d +const SET_CONTRAST = 0x81 +const SET_ENTIRE_ON = 0xa4 +const SET_NORM_INV = 0xa6 +const SET_DISP = 0xae +const SET_MEM_ADDR = 0x20 +const SET_COL_ADDR = 0x21 +const SET_PAGE_ADDR = 0x22 +const SET_DISP_START_LINE = 0x40 +const SET_SEG_REMAP = 0xa0 +const SET_MUX_RATIO = 0xa8 +const SET_IREF_SELECT = 0xad +const SET_COM_OUT_DIR = 0xc0 +const SET_DISP_OFFSET = 0xd3 +const SET_COM_PIN_CFG = 0xda +const SET_DISP_CLK_DIV = 0xd5 +const SET_PRECHARGE = 0xd9 +const SET_VCOM_DESEL = 0xdb +const SET_CHARGE_PUMP = 0x8d + +export interface SSD1306Options extends I2CDriverOptions { + devAddr?: 0x3d | 0x3c + externalVCC?: boolean + width: 128 | 96 | 64 + height: 64 | 48 | 32 | 16 +} + +/** + * Driver for SSD1306 OLED displays. + * + * @example + * const ssd = new SSD1306Driver({ width: 64, height: 48 }) + * await ssd.init() + * ssd.image.print("Hello world!", 3, 10) + * await ssd.show() + */ +export class SSD1306Driver extends I2CDriver implements Display { + externalVCC: boolean + palette: Palette + image: Image + + constructor(options: SSD1306Options) { + super(options.devAddr || DEFAULT_ADDRESS, options) + this.palette = Palette.monochrome() + const framebuffer = Buffer.alloc(options.width * (options.height >> 3)) + this.image = Image.alloc(options.width, options.height, 1, framebuffer) + if (options.externalVCC) this.externalVCC = true + } + + private async writeCmd(...cmds: number[]) { + if (isSimulator()) return + for (const cmd of cmds) await this.writeReg(0x80, cmd) + } + + async reInit() { + if (isSimulator()) return + await this.powerOff() + await this.writeCmd(SET_MEM_ADDR, 0x01) // Vertical + await this.rotate(true) + await this.writeCmd( + SET_DISP_START_LINE, + SET_MUX_RATIO, + this.image.height - 1, + SET_DISP_OFFSET, + 0x00 + ) + + await this.writeCmd( + SET_COM_PIN_CFG, + this.image.width > 2 * this.image.height ? 0x02 : 0x12, + SET_DISP_CLK_DIV, + 0x80 + ) + + await this.writeCmd( + SET_PRECHARGE, + this.externalVCC ? 0x22 : 0xf1, + SET_CHARGE_PUMP, + this.externalVCC ? 0x10 : 0x14, + SET_VCOM_DESEL, + 0x30 + ) + + await this.setContrast(0xff) + await this.invert(false) + await this.show() + + await this.writeCmd( + SET_ENTIRE_ON, + SET_IREF_SELECT, + 0x30, + SET_DISP | 0x01 + ) + } + + protected async initDriver() { + await this.reInit() + } + + async powerOff() { + await this.writeCmd(SET_DISP) + } + + async setContrast(contrast: number) { + await this.writeCmd(SET_CONTRAST, contrast) + } + + async invert(invert: boolean) { + await this.writeCmd(SET_NORM_INV | (invert ? 1 : 0)) + } + + async rotate(rotate: boolean) { + const r = rotate ? 1 : 0 + await this.writeCmd(SET_COM_OUT_DIR | (r << 3), SET_SEG_REMAP | r) + } + + async show() { + if (isSimulator()) return + + const { width, height } = this.image + let xStart = 0 + let xEnd = width - 1 + + // narrow displays use centered columns + const off = (128 - width) >> 1 + xStart += off + xEnd += off + + const pages = height >> 3 + + await this.writeCmd( + SET_COL_ADDR, + xStart, + xEnd, + SET_PAGE_ADDR, + 0, + pages - 1 + ) + const fb = this.image.buffer + await this.writeRegBuf(0x40, fb) + } +} +`, + "drivers/src/st7735.ts": `import { + GPIOMode, + OutputPin, + assert, + delay, + isSimulator, +} from "@devicescript/core" +import { SPI, spi } from "@devicescript/spi" +import { + Display, + Image, + SpiImageFlags, + spiSendImage, + Palette +} from "@devicescript/graphics" +import "@devicescript/gpio" + +const ST7735_NOP = 0x00 +const ST7735_SWRESET = 0x01 +const ST7735_RDDID = 0x04 +const ST7735_RDDST = 0x09 +const ST7735_SLPIN = 0x10 +const ST7735_SLPOUT = 0x11 +const ST7735_PTLON = 0x12 +const ST7735_NORON = 0x13 +const ST7735_INVOFF = 0x20 +const ST7735_INVON = 0x21 +const ST7735_DISPOFF = 0x28 +const ST7735_DISPON = 0x29 +const ST7735_CASET = 0x2a +const ST7735_RASET = 0x2b +const ST7735_RAMWR = 0x2c +const ST7735_RAMRD = 0x2e +const ST7735_PTLAR = 0x30 +const ST7735_COLMOD = 0x3a +const ST7735_MADCTL = 0x36 +const ST7735_FRMCTR1 = 0xb1 +const ST7735_FRMCTR2 = 0xb2 +const ST7735_FRMCTR3 = 0xb3 +const ST7735_INVCTR = 0xb4 +const ST7735_GMCTRP1 = 0xe0 +const ST7735_GMCTRN1 = 0xe1 +const MADCTL_MY = 0x80 +const MADCTL_MX = 0x40 +const MADCTL_MV = 0x20 +const MADCTL_ML = 0x10 +const MADCTL_RGB = 0x00 +const MADCTL_BGR = 0x08 +const MADCTL_MH = 0x04 + +export interface FourWireOptions { + /** + * SPI CS pin + */ + cs: OutputPin + + /** + * Pin for switching between command and data (D/C or RS). + */ + dc: OutputPin + + /** + * SPI bus instance to use + */ + spi?: SPI + + /** + * Pin for resetting the display. + */ + reset?: OutputPin +} + +export interface STLikeDisplayOptions extends FourWireOptions { + /** + * Flip the display 180 deg. + * Without flipping, the connector ribbon of the screen should be on the top or left. + */ + flip?: boolean + + /** + * FRMCTR1 display register setting. Three bytes encoded as big endian number. + * + * @default 0x00_06_03 + */ + frmctr1?: number + + /** + * X-offset of the matrix. + * + * @default 0 + */ + offX?: number + + /** + * Y-offset of the matrix. + * + * @default 0 + */ + offY?: number +} + +export class FourWireDriver { + constructor(public options: OPT) { } + + protected async sendSeq(seq: Buffer) { + let i = 0 + while (i < seq.length) { + const cmd = seq[i++] + const len = seq[i++] + const args: number[] = [] + for (let j = 0; j < (len & 0x7f); ++j) args.push(seq[i++]) + let delayMS = 0 + if (len & 0x80) { + delayMS = seq[i++] + if (delayMS === 0xff) delayMS = 500 + } + await this.sendCmd(cmd, ...args) + if (delayMS) await delay(delayMS) + } + } + + protected async cmdPrep(cmd: number) { + const { spi, cs, dc } = this.options + dc.write(0) + cs.write(0) + await spi.write(Buffer.from([cmd])) + dc.write(1) + } + + protected async cmdFinish() { + const { cs } = this.options + cs.write(1) + } + + protected async sendCmd(cmd: number, ...args: number[]) { + if (isSimulator()) return + const { spi, cs } = this.options + await this.cmdPrep(cmd) + if (args.length) await spi.write(Buffer.from(args)) + await this.cmdFinish() + } + + protected async initPins() { + if (isSimulator()) return + const { cs, dc, reset } = this.options + + if (reset) { + reset.setMode(GPIOMode.OutputLow) + await delay(20) + reset.setMode(GPIOMode.OutputHigh) + await delay(20) + } + + dc.setMode(GPIOMode.OutputHigh) + cs.setMode(GPIOMode.OutputHigh) + } +} + +export class STLikeDisplayDriver + extends FourWireDriver + implements Display { + public readonly palette: Palette + private rot = 0 + + constructor( + public image: Image, + options: STLikeDisplayOptions, + protected initSeq: Buffer + ) { + super(options) + assert(image.bpp === 4) + this.options = Object.assign({}, this.options) + if (this.options.frmctr1 == undefined) this.options.frmctr1 = 0x000603 + if (this.options.spi == undefined) this.options.spi = spi + + this.palette = Palette.arcade() + if (image.width > image.height) this.rot = 1 + if (this.options.flip) this.rot |= 2 + } + + private async setAddrWindow(x: number, y: number, w: number, h: number) { + w += x - 1 + h += y - 1 + await this.sendCmd(ST7735_RASET, 0, x, w >> 8, w & 0xff) + await this.sendCmd(ST7735_CASET, 0, y, h >> 8, h & 0xff) + } + + private async doInit() { + await this.initPins() + await this.sendSeq(this.initSeq) + + await this.sendCmd(ST7735_MADCTL, hex\`00 40 C0 80\`[this.rot]) + const frmctr1 = [ + this.options.frmctr1 >> 16, + (this.options.frmctr1 >> 8) & 0xff, + this.options.frmctr1 & 0xff, + ] + if (frmctr1[2] === 0xff) frmctr1.pop() + await this.sendCmd(ST7735_FRMCTR1, ...frmctr1) + + const offX = this.options.offX ?? 0 + const offY = this.options.offY ?? 0 + + if (this.rot & 1) + await this.setAddrWindow( + offX, + offY, + this.image.width, + this.image.height + ) + else + await this.setAddrWindow( + offY, + offX, + this.image.height, + this.image.width + ) + } + + async init() { + await this.doInit() + } + + async show() { + if (isSimulator()) return + + const { spi, cs } = this.options + await this.cmdPrep(ST7735_RAMWR) + + let flags = SpiImageFlags.MODE_565 + + if (this.rot & 1) flags |= SpiImageFlags.BY_COL + else flags |= SpiImageFlags.BY_ROW + + await spiSendImage({ + spi, + image: this.image, + palette: this.palette, + flags, + }) + + await this.cmdFinish() + } +} + +export interface ST7735Options extends STLikeDisplayOptions { } + +export class ST7735Driver extends STLikeDisplayDriver { + constructor(image: Image, options: ST7735Options) { + super( + image, + options, + hex\` +01 80 78 // SWRESET + 120ms +11 80 78 // SLPOUT + 120ms +20 00 // INVOFF +3A 01 05 // COLMOD 16bit +13 80 0A // NORON + 10ms +29 80 0A // DISPON + 10ms +\` + ) + } +} + +export interface ST7789Options extends STLikeDisplayOptions { } + +export class ST7789Driver extends STLikeDisplayDriver { + constructor(image: Image, options: ST7789Options) { + super( + image, + options, + hex\` +01 80 78 // SWRESET + 120ms +11 80 78 // SLPOUT + 120ms +21 00 // INVON +3A 01 55 // COLMOD 16bit 16bit +13 80 0A // NORON + 10ms +29 80 0A // DISPON + 10ms +\` + ) + } +} +`, + "drivers/src/trafficlight.ts": `import * as ds from "@devicescript/core" +import { AsyncValue, GPIOMode, OutputPin, TrafficLightServerSpec } from "@devicescript/core"; +import { Server, ServerOptions, startServer } from "@devicescript/server"; + +export interface TrafficLightOptions extends ServerOptions { + red: OutputPin, + yellow: OutputPin, + green: OutputPin +} + +class TrafficLightServer extends Server implements TrafficLightServerSpec { + private lights: { pin: OutputPin, state: boolean }[] = [] + + constructor(options: TrafficLightOptions) { + super(ds.TrafficLight.spec, options) + this.lights = [ + {pin: options.red, state: false}, + {pin: options.yellow, state: false}, + {pin: options.green, state: false} + ] + for(const light of this.lights) { + light.pin?.setMode(GPIOMode.Output) + light.pin?.write(light.state) + } + } + + private setState(index: number, value: boolean) { + this.lights[index].state = !!value + this.lights[index].pin?.write(this.lights[index].state) + } + + red(): AsyncValue { + return this.lights[0].state + } + set_red(value: boolean): AsyncValue { + return this.setState(0, value) + } + yellow(): AsyncValue { + return this.lights[1].state + } + set_yellow(value: boolean): AsyncValue { + return this.setState(1, value) + } + green(): AsyncValue { + return this.lights[2].state + } + set_green(value: boolean): AsyncValue { + return this.setState(2, value) + } +} + +/** + * Starts a traffic light driver over 3 output pins + */ +export async function startTrafficLight(options: TrafficLightOptions & ServerOptions) { + const server = new TrafficLightServer(options) + return new ds.TrafficLight(startServer(server, options)) +} +`, + "drivers/src/uc8151.ts": `// based on https://github.com/pimoroni/pimoroni-pico/blob/main/drivers/uc8151/uc8151.cpp +// by Pimoroni Ltd, MIT license + +import { GPIOMode, InputPin, LOW, delay, isSimulator } from "@devicescript/core" +import { FourWireDriver, FourWireOptions } from "./st7735" +import { + Display, + Image, + SpiImageFlags, + spiSendImage, + Palette +} from "@devicescript/graphics" +import { DriverError } from "./core" + +export interface UC8151Options extends FourWireOptions { + /** + * Pin is low when busy. + */ + busy?: InputPin + + /** + * Flip the display 180 deg. + * Without flipping, the connector ribbon of the screen should be on the top or left. + */ + flip?: boolean +} + +export class UC8151Driver + extends FourWireDriver + implements Display { + public readonly palette: Palette + private resflag: number + + constructor(public readonly image: Image, options: UC8151Options) { + super(options) + + const sm = Math.min(this.image.width, this.image.height) + const bg = Math.max(this.image.width, this.image.height) + if (sm === 96 && bg === 230) this.resflag = PSR_FLAGS.RES_96x230 + else if (sm === 96 && bg === 252) this.resflag = PSR_FLAGS.RES_96x252 + else if (sm === 128 && bg === 296) this.resflag = PSR_FLAGS.RES_128x296 + else if (sm === 160 && bg === 296) this.resflag = PSR_FLAGS.RES_160x296 + else + throw new DriverError( + \`unsupported resolution; \${sm}x\${bg}; supported: 96x230, 96x252, 128x296, 160x296\` + ) + this.resflag |= PSR_FLAGS.FORMAT_BW + + this.palette = Palette.monochrome() + } + + private isBusy() { + return this.options.busy?.value === LOW + } + + private async busyWait() { + while (this.isBusy()) await delay(1) + } + + private async fastLuts() { + await this.sendSeq(hex\` + 20 2c // LUT_VCOM + 00 04 04 07 00 01 00 0c 0c 00 00 02 00 04 04 07 00 02 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + 21 2a // LUT_WW + 54 04 04 07 00 01 60 0c 0c 00 00 02 a8 04 04 07 00 02 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + 22 2a // LUT_BW + 54 04 04 07 00 01 60 0c 0c 00 00 02 a8 04 04 07 00 02 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + 23 2a // LUT_WB + a8 04 04 07 00 01 60 0c 0c 00 00 02 54 04 04 07 00 02 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + 24 2a // LUT_BB + a8 04 04 07 00 01 60 0c 0c 00 00 02 54 04 04 07 00 02 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + 30 01 39 // PLL HZ_200 + \`) + await this.busyWait() + } + + async init() { + if (isSimulator()) return + + this.options.busy?.setMode(GPIOMode.InputPullUp) + await this.initPins() + + let psr_setting = + this.resflag | PSR_FLAGS.BOOSTER_ON | PSR_FLAGS.RESET_NONE + psr_setting |= PSR_FLAGS.LUT_REG + if (this.image.width < this.image.height) + psr_setting |= this.options.flip + ? PSR_FLAGS.SHIFT_RIGHT | PSR_FLAGS.SCAN_UP + : PSR_FLAGS.SHIFT_LEFT | PSR_FLAGS.SCAN_DOWN + else + psr_setting |= this.options.flip + ? PSR_FLAGS.SHIFT_LEFT | PSR_FLAGS.SCAN_UP + : PSR_FLAGS.SHIFT_RIGHT | PSR_FLAGS.SCAN_DOWN + await this.sendCmd(CMD.PSR, psr_setting) + await this.fastLuts() + + await this.sendCmd( + CMD.PWR, + PWR_FLAGS_1.VDS_INTERNAL | PWR_FLAGS_1.VDG_INTERNAL, + PWR_FLAGS_2.VCOM_VD | PWR_FLAGS_2.VGHL_16V, + 0b101011, + 0b101011, + 0b101011 + ) + await this.sendCmd(CMD.PON) + await this.busyWait() + + // booster soft start configuration + const bst = + BOOSTER_FLAGS.START_10MS | + BOOSTER_FLAGS.STRENGTH_3 | + BOOSTER_FLAGS.OFF_6_58US + await this.sendCmd(CMD.BTST, bst, bst, bst) + await this.sendCmd(CMD.PFS, PFS_FLAGS.FRAMES_1) + + await this.sendCmd( + CMD.TSE, + TSE_FLAGS.TEMP_INTERNAL | TSE_FLAGS.OFFSET_0 + ) + + await this.sendCmd(CMD.TCON, 0x22) // tcon setting + const inverted = false + const cdi = inverted ? 0b10_01_1100 : 0b01_00_1100 // vcom and data interval + await this.sendCmd(CMD.CDI, cdi) + await this.sendCmd(CMD.PLL, PLL_FLAGS.HZ_100) + await this.sendCmd(CMD.POF) + await this.busyWait() + } + + async show() { + if (isSimulator()) return + + await this.busyWait() + await this.sendCmd(CMD.PON) // turn on + await this.sendCmd(CMD.PTOU) // disable partial mode + + await this.cmdPrep(CMD.DTM2) + + let flags = + this.image.width < this.image.height + ? SpiImageFlags.MODE_MONO_REV | SpiImageFlags.BY_ROW + : SpiImageFlags.MODE_MONO_REV | SpiImageFlags.BY_COL + + await spiSendImage({ + spi: this.options.spi, + image: this.image, + palette: this.palette, + flags, + }) + + await this.sendCmd(CMD.DSP) // data stop + await this.sendCmd(CMD.DRF) // start display refresh + + await this.busyWait() + await this.sendCmd(CMD.POF) + } +} + +enum PSR_FLAGS { + RES_96x230 = 0b00000000, + RES_96x252 = 0b01000000, + RES_128x296 = 0b10000000, + RES_160x296 = 0b11000000, + + LUT_OTP = 0b00000000, + LUT_REG = 0b00100000, + + FORMAT_BWR = 0b00000000, + FORMAT_BW = 0b00010000, + + SCAN_DOWN = 0b00000000, + SCAN_UP = 0b00001000, + + SHIFT_LEFT = 0b00000000, + SHIFT_RIGHT = 0b00000100, + + BOOSTER_OFF = 0b00000000, + BOOSTER_ON = 0b00000010, + + RESET_SOFT = 0b00000000, + RESET_NONE = 0b00000001, +} + +enum PWR_FLAGS_1 { + VDS_EXTERNAL = 0b00000000, + VDS_INTERNAL = 0b00000010, + + VDG_EXTERNAL = 0b00000000, + VDG_INTERNAL = 0b00000001, +} + +enum PWR_FLAGS_2 { + VCOM_VD = 0b00000000, + VCOM_VG = 0b00000100, + + VGHL_16V = 0b00000000, + VGHL_15V = 0b00000001, + VGHL_14V = 0b00000010, + VGHL_13V = 0b00000011, +} + +enum BOOSTER_FLAGS { + START_10MS = 0b00000000, + START_20MS = 0b01000000, + START_30MS = 0b10000000, + START_40MS = 0b11000000, + + STRENGTH_1 = 0b00000000, + STRENGTH_2 = 0b00001000, + STRENGTH_3 = 0b00010000, + STRENGTH_4 = 0b00011000, + STRENGTH_5 = 0b00100000, + STRENGTH_6 = 0b00101000, + STRENGTH_7 = 0b00110000, + STRENGTH_8 = 0b00111000, + + OFF_0_27US = 0b00000000, + OFF_0_34US = 0b00000001, + OFF_0_40US = 0b00000010, + OFF_0_54US = 0b00000011, + OFF_0_80US = 0b00000100, + OFF_1_54US = 0b00000101, + OFF_3_34US = 0b00000110, + OFF_6_58US = 0b00000111, +} + +enum PFS_FLAGS { + FRAMES_1 = 0b00000000, + FRAMES_2 = 0b00010000, + FRAMES_3 = 0b00100000, + FRAMES_4 = 0b00110000, +} + +enum TSE_FLAGS { + TEMP_INTERNAL = 0b00000000, + TEMP_EXTERNAL = 0b10000000, + + OFFSET_0 = 0b00000000, + OFFSET_1 = 0b00000001, + OFFSET_2 = 0b00000010, + OFFSET_3 = 0b00000011, + OFFSET_4 = 0b00000100, + OFFSET_5 = 0b00000101, + OFFSET_6 = 0b00000110, + OFFSET_7 = 0b00000111, + + OFFSET_MIN_8 = 0b00001000, + OFFSET_MIN_7 = 0b00001001, + OFFSET_MIN_6 = 0b00001010, + OFFSET_MIN_5 = 0b00001011, + OFFSET_MIN_4 = 0b00001100, + OFFSET_MIN_3 = 0b00001101, + OFFSET_MIN_2 = 0b00001110, + OFFSET_MIN_1 = 0b00001111, +} + +enum PLL_FLAGS { + // other frequency options exist but there doesn't seem to be much + // point in including them - this is a fair range of options... + HZ_29 = 0b00111111, + HZ_33 = 0b00111110, + HZ_40 = 0b00111101, + HZ_50 = 0b00111100, + HZ_67 = 0b00111011, + HZ_100 = 0b00111010, + HZ_200 = 0b00111001, +} + +enum CMD { + PSR = 0x00, + PWR = 0x01, + POF = 0x02, + PFS = 0x03, + PON = 0x04, + PMES = 0x05, + BTST = 0x06, + DSLP = 0x07, + DTM1 = 0x10, + DSP = 0x11, + DRF = 0x12, + DTM2 = 0x13, + LUT_VCOM = 0x20, + LUT_WW = 0x21, + LUT_BW = 0x22, + LUT_WB = 0x23, + LUT_BB = 0x24, + PLL = 0x30, + TSC = 0x40, + TSE = 0x41, + TSR = 0x43, + TSW = 0x42, + CDI = 0x50, + LPD = 0x51, + TCON = 0x60, + TRES = 0x61, + REV = 0x70, + FLG = 0x71, + AMV = 0x80, + VV = 0x81, + VDCS = 0x82, + PTL = 0x90, + PTIN = 0x91, + PTOU = 0x92, + PGM = 0xa0, + APG = 0xa1, + ROTP = 0xa2, + CCSET = 0xe0, + PWS = 0xe3, + TSSET = 0xe5, +} +`, + "drivers/src/wavesharepicolcd114.ts": `import { startGamepad } from "@devicescript/servers" +import { spi } from "@devicescript/spi" +import { pins } from "@dsboard/pico_w" +import * as ds from "@devicescript/core" +import { ST7789Driver } from "@devicescript/drivers" +import { Image } from "@devicescript/graphics" + +/** + * Driver for WaveShare Pico-LCD-1.14 inch. + * + * @see https://www.waveshare.com/pico-lcd-1.14.htm + * @devsPart WaveShare Pico LCD114 for Raspberry Pi Pico + * @devsWhenUsed only start services which are used! + */ +export class WaveSharePicoLCD114 { + constructor() {} + + startGamepad() { + return startGamepad({ + pinA: pins.GP15, + pinB: pins.GP17, + pinDown: pins.GP18, + pinLeft: pins.GP16, + pinSelect: pins.GP3, // middle + pinRight: pins.GP20, + pinUp: pins.GP2, + }) + } + + async startDisplay() { + spi.configure({ + mosi: pins.GP11, + sck: pins.GP10, + hz: 8_000_000, + }) + + pins.GP13.setMode(ds.GPIOMode.OutputHigh) // BL + + const d = new ST7789Driver(Image.alloc(240, 136, 4), { + dc: pins.GP8, + cs: pins.GP9, + reset: pins.GP12, + // frmctr1: 0x0e_14_ff, + flip: false, + spi: spi, + offX: 40, + offY: 53, + }) + await d.init() + return d + } +} +`, + "drivers/src/xiaoexpansionboard.ts": `import { SSD1306Driver } from "@devicescript/drivers" +import { + configureHardware, + startButton, + startBuzzer, +} from "@devicescript/servers" +import { pins } from "@dsboard/seeed_xiao_esp32c3" + +/** + * + * Drivers for the {@link https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/ | Seeed Studio XIAO Expansion Board } for Raspberry Pi Pico. + * + * @devsPart Seeed Studio XIAO Expansion Board + * @devsWhenUsed + */ +export class XiaoExpansionBoard { + constructor() { + configureHardware({ + i2c: { + pinSCL: pins.SCL_D5, + pinSDA: pins.SDA_D4, + kHz: 400, + }, + }) + } + + /** + * Starts a server for the OLED display. + * @returns + */ + async startDisplay() { + const disp = new SSD1306Driver({ + devAddr: 0x3c, + width: 128, + height: 64, + }) + await disp.init() + return disp + } + + startBuzzer() { + return startBuzzer({ + pin: pins.A3_D3, + }) + } + + startButton() { + return startButton({ + pin: pins.A1_D1, + }) + } +} +`, + "gpio/package.json": `{ + "name": "@devicescript/gpio", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/gpio" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "gpio/src/digitalio.ts": `import "./pins" +import { + DigitalValue, + GPIOMode, + Handler, + InputPin, + OutputPin, + PinBase, + Unsubscribe, +} from "@devicescript/core" + +/** + * Set pin mode. + * @param pin + * @param mode + */ +export function pinMode(pin: PinBase, mode: GPIOMode) { + pin.setMode(mode) +} + +/** + * Write a HIGH or a LOW value to a digital pin. + * @param pin + * @param value HIGH or LOW, 1 or 0, true or false + * @throws RangeError pin is not an output pin or output mode + */ +export function digitalWrite( + pin: OutputPin, + value: DigitalValue | number | boolean +) { + pin.write(value) +} + +/** + * Reads a digital pin. + * @param pin + * @returns HIGH (1) or LOW (0) + * @throws RangeError pin is not an input pin or intput mode + */ +export function digitalRead(pin: InputPin): DigitalValue { + return pin.value as DigitalValue +} + +/** + * Subscribe to changes on a digital pin. + * @param pin + * @param handler + * @returns + */ +export function subscribeDigital( + pin: InputPin, + handler: Handler +): Unsubscribe { + return pin.subscribe(handler) +} +`, + "gpio/src/index.ts": `export * from "./pins" +export * from "./digitalio" +`, + "gpio/src/main.ts": `import { describe, expect, test } from "@devicescript/test" + +describe("gpio", () => {}) +`, + "gpio/src/pins.ts": `import * as ds from "@devicescript/core" + +// extend interfaces +declare module "@devicescript/core" { + export interface PinBase { + /** + * Configure pin mode. + * @param mode desired mode + */ + setMode(mode: GPIOMode): void + + mode: GPIOMode + } + + export interface InputPin extends PinBase, Subscriber { + /** + * Value of the pin. \`0 | 1\` for digital pins, \`0 ... 1\` for analog. + */ + value: DigitalValue | number + } + + export interface OutputPin extends PinBase { + write(v: DigitalValue | number | boolean): void + } +} + +/** + * @devsNative GPIO.prototype + */ +declare var GPIOproto: ds.IOPin + +GPIOproto.write = function (this: ds.OutputPin, v) { + if ((this.mode & ds.GPIOMode.BaseModeMask) !== ds.GPIOMode.Output) + throw new RangeError("pin not in output mode") + this.setMode(v ? ds.GPIOMode.OutputHigh : ds.GPIOMode.OutputLow) +} + +interface MyInputPin extends ds.InputPin { + _change: ds.Emitter + _lastDigital: ds.DigitalValue +} + +let changePins: MyInputPin[] +function changeHandler() { + for (const p of changePins) { + const v = p.value + if ((v === 0 || v === 1) && v !== p._lastDigital) { + p._lastDigital = v + p._change.emit(v) + } + } +} + +// TODO move this to C +GPIOproto.subscribe = function (this: MyInputPin, h) { + if (!this._change) { + this._change = ds.emitter() + if (!changePins) { + changePins = [] + setInterval(changeHandler, 100) + } + changePins.push(this) + } + return this._change.subscribe(h) +} +`, + "graphics/package.json": `{ + "name": "@devicescript/graphics", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/graphics" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "graphics/src/canvas.ts": `import { Font, Image } from "./image" +import { fontForText } from "./text" + +export type ImageTextBaseLine = "top" | "middle" | "bottom" +export type ImageTextAlign = "start" | "center" | "right" + +/** + * Partial implementation of CanvasRenderingContext2D + * { @link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D } + */ +export class ImageContext { + private states: { + font: Font + transformX: number + transformY: number + fillColor: number + strokeColor: number + textAlign: ImageTextAlign + textBaseline: ImageTextBaseLine + }[] = [] + private transformX: number + private transformY: number + + font: Font + fillColor: number + strokeColor: number + textAlign: ImageTextAlign + textBaseline: ImageTextBaseLine + + constructor(public readonly image: Image) { + this.font = fontForText("") + this.reset() + } + /** + * Resets the state of the canvas context + */ + reset() { + this.resetTransform() + this.fillColor = 1 + this.strokeColor = 1 + this.textAlign = "start" + this.textBaseline = "top" + } + + drawImage(image: Image, dx: number, dy: number): void { + const x = this.transformX + dx + const y = this.transformY + dy + this.image.drawTransparentImage(image, x, y) + } + clearRect(x: number, y: number, w: number, h: number): void { + this.fillRectC(x, y, w, h, 0) + } + fillRect(x: number, y: number, w: number, h: number): void { + this.fillRectC(x, y, w, h, this.fillColor) + } + private fillRectC(x: number, y: number, w: number, h: number, c: number) { + const tx = this.transformX + x + const ty = this.transformY + y + this.image.fillRect(tx, ty, w, h, c) + } + strokeRect(x: number, y: number, w: number, h: number): void { + this.image.drawRect( + this.transformX + x, + this.transformY + y, + w, + h, + this.strokeColor + ) + } + + restore(): void { + const state = this.states.pop() + if (state) { + this.font = state.font + this.fillColor = state.fillColor + this.strokeColor = state.strokeColor + this.transformX = state.transformX + this.transformY = state.transformY + this.textAlign = state.textAlign + } + } + + save(): void { + this.states.push({ + font: this.font, + fillColor: this.fillColor, + strokeColor: this.strokeColor, + transformX: this.transformX, + transformY: this.transformY, + textAlign: this.textAlign, + textBaseline: this.textBaseline, + }) + } + + fillText(text: string, x: number, y: number, maxWidth?: number): void { + this.printTextC(text, x, y, this.fillColor, maxWidth) + } + strokeText(text: string, x: number, y: number, maxWidth?: number): void { + this.printTextC(text, x, y, this.strokeColor, maxWidth) + } + private printTextC( + text: string, + x: number, + y: number, + c: number, + maxWidth?: number + ) { + if (!text) return + if (maxWidth !== undefined) { + const l = Math.floor(maxWidth / this.font.charWidth) + if (l < text.length) text = text.slice(0, l) + } + let tx = this.transformX + x + if (this.textAlign === "center") + tx -= (text.length * this.font.charWidth) / 2 + else if (this.textAlign === "right") + tx -= text.length * this.font.charWidth + let ty = this.transformY + y + if (this.textBaseline === "middle") ty -= this.font.charHeight / 2 + else if (this.textBaseline === "bottom") ty -= this.font.charHeight + this.image.print(text, tx, ty, c, this.font) + } + + resetTransform(): void { + this.transformX = 0 + this.transformY = 0 + } + translate(x: number, y: number): void { + this.transformX += x + this.transformY += y + } + + /** + * Clears the canvas + */ + clear() { + this.image.fill(0) + } + + /** + * Fills the canvas with the current fill color + */ + fill() { + this.image.fill(this.fillColor) + } + + /** + * Fill a circle + * @param cx center x coordinate + * @param cy center y coordinate + * @param r radius + */ + fillCircle(cx: number, cy: number, r: number) { + const x = this.transformX + cx + const y = this.transformY + cy + this.image.drawCircle(x, y, r, this.fillColor) + } + + /** + * Renders a circle outline + * @param cx x coordinate of the center + * @param cy y coordinate of the center + * @param r radius + */ + strokeCircle(cx: number, cy: number, r: number) { + const x = this.transformX + cx + const y = this.transformY + cy + this.image.drawCircle(x, y, r, this.strokeColor) + } + + /** + * Renders a line from (x1, y1) to (x2, y2) + * @param x1 coordinate of the first point + * @param y1 coordinate of the first point + * @param x2 coordinate of the second point + * @param y2 coordinate of the second point + */ + strokeLine(x1: number, y1: number, x2: number, y2: number) { + const tx1 = this.transformX + x1 + const ty1 = this.transformY + y1 + const tx2 = this.transformX + x2 + const ty2 = this.transformY + y2 + this.image.drawLine(tx1, ty1, tx2, ty2, this.strokeColor) + } +} +`, + "graphics/src/display.ts": `import { Image } from "./image" +import { Palette } from "./palette" + +/** + * A display driver + */ +export interface Display { + /** + * Color palette supported by the display + */ + palette: Palette + /** + * Buffered image rendered when show is called + */ + image: Image + /** + * Renders the image to hardware + */ + show(): Promise + /** + * Initializes the display. Should be callable multiple timews. + */ + init(): Promise +} +`, + "graphics/src/dotmatrix.ts": `import * as ds from "@devicescript/core" +import { Image } from "./image" + +declare module "@devicescript/core" { + interface DotMatrix { + /** + * Allocates an image of the dot matrix. + */ + allocImage(): Promise + /** + * Gets a 1bpp image of the dot matrix. + */ + readImage(): Promise + + /** + * Writes an image to the dots + * @param image + */ + writeImage(image: Image): Promise + } +} + +ds.DotMatrix.prototype.allocImage = async function () { + const columns = await this.columns.read() + const rows = await this.rows.read() + + if (isNaN(columns) || isNaN(rows)) return undefined + + const img = Image.alloc(columns, rows, 1) + return img +} + +ds.DotMatrix.prototype.readImage = async function () { + const img = await this.allocImage() + if (!img) return undefined + const data = await this.dots.read() + if (!data) return undefined + + const rows = img.height + const columns = img.width + const columns_size = rows <= 8 ? 1 : (rows + 7) >> 3 + for (let row = 0; row < rows; ++row) { + for (let col = 0; col < columns; ++col) { + const bit = ((col * columns_size + (row >> 3)) << 3) + (row % 8) + const dot = data.getBit(bit) + img.set(col, row, dot ? 1 : 0) + } + } + + return img +} + +ds.DotMatrix.prototype.writeImage = async function (image: Image) { + const data = await this.dots.read() + const columns = await this.columns.read() + const rows = await this.rows.read() + + if (!data || isNaN(columns) || isNaN(rows)) return + + const w = Math.min(image.width, columns) + const h = Math.min(image.height, rows) + const n = data.length + const columns_size = rows <= 8 ? 1 : (rows + 7) >> 3 + for (let row = 0; row < h; ++row) { + for (let col = 0; col < w; ++col) { + const dot = !!image.get(col, row) + const bit = ((col * columns_size + (row >> 3)) << 3) + (row % 8) + data.setBit(bit, dot) + } + } + + await this.dots.write(data) +} +`, + "graphics/src/image.ts": `import * as ds from "@devicescript/core" +import { ImageContext } from "./canvas" + +export type color = number + +/** + * Represents monochromatic or color 2D image. + * + * @devsNative Image + */ +export declare class Image { + private constructor() + + /** + * Get the width of the image + */ + width: number + + /** + * Get the height of the image + */ + height: number + + /** + * Bits-per-pixel, currently 1 or 4. + */ + bpp: number + + /** + * Get the underlying writable buffer. + * Allocates if needed. + */ + buffer: Buffer + + /** + * Return a copy of the current image + */ + clone(): Image + + /** + * Get a pixel color + */ + get(x: number, y: number): number + + /** + * Set pixel color + */ + set(x: number, y: number, c: color): void + + /** + * Fill entire image with a given color + */ + fill(c: color): void + + /** + * Flips (mirrors) pixels horizontally in the current image + */ + flipX(): void + + /** + * Flips (mirrors) pixels vertically in the current image + */ + flipY(): void + + /** + * Returns a transposed image (with X/Y swapped) + */ + transposed(): Image + + /** + * Draw given image on the current image + */ + drawImage(from: Image, x: number, y: number): void + + /** + * Draw given image with transparent background on the current image. + * If \`from\` is mono, paint it using color \`c\` (defaults to \`1\`). + */ + drawTransparentImage(from: Image, x: number, y: number, c?: color): void + + /** + * Check if the current image "collides" with another + */ + overlapsWith(other: Image, x: number, y: number): boolean + + /** + * Fill a rectangle + */ + fillRect(x: number, y: number, w: number, h: number, c: color): void + + /** + * Draw a line + */ + drawLine(x0: number, y0: number, x1: number, y1: number, c: color): void + + /** + * Returns true if the provided image is the same as this image, + * otherwise returns false. + */ + equals(other: Image): boolean + + /** + * Fills a circle + */ + fillCircle(cx: number, cy: number, r: number, c: color): void + + /** + * Scale and copy a row of pixels from a texture. + */ + blitRow( + from: Image, + dstX: number, + dstY: number, + fromX: number, + fromH: number + ): void + + /** + * Copy an image from a source rectangle to a destination rectangle, stretching or + * compressing to fit the dimensions of the destination rectangle, if necessary. + */ + blit( + xDst: number, + yDst: number, + wDst: number, + hDst: number, + src: Image, + xSrc: number, + ySrc: number, + wSrc: number, + hSrc: number, + transparent: boolean, + check: boolean + ): boolean + + /** + * Allocate a new image, backed by the buffer is specified (otherwise a new buffer is allocated) + * + * @param width in pixels + * @param height in pixels + * @param bpp bits per pixel + * @param init initial contents of the image + * @param offset byte offset in \`init\` + */ + static alloc( + width: number, + height: number, + bpp: 1 | 4, + init?: Buffer, + offset?: number + ): Image + + // + // Non-native methods + // + + /** + * Draw a circle + */ + drawCircle(cx: number, cy: number, r: number, c: color): void + + /** + * Draw an empty rectangle + */ + drawRect(x: number, y: number, w: number, h: number, c: color): void + + /** + * Returns an image rotated by -90, 0, 90, 180, 270 deg clockwise + */ + rotated(deg: number): Image + + /** + * Draw text on image with specified top-left position + */ + print(text: string, x: number, y: number, color?: number, font?: Font): void + + /** + * Draw text in the center of image at given \`y\` position. + */ + printCenter(text: string, y: number, color?: number, font?: Font): void + + /** + * Creates a new rendering context + */ + allocContext(): ImageContext +} + +export interface Font { + charWidth: number + charHeight: number + data: Buffer + multiplier?: number +} + +Image.prototype.drawCircle = function ( + cx: number, + cy: number, + r: number, + c: color +): void { + cx = cx | 0 + cy = cy | 0 + r = r | 0 + // short cuts + if (r < 0) return + + // Bresenham's algorithm + let x = 0 + let y = r + let d = 3 - 2 * r + + while (y >= x) { + this.set(cx + x, cy + y, c) + this.set(cx - x, cy + y, c) + this.set(cx + x, cy - y, c) + this.set(cx - x, cy - y, c) + this.set(cx + y, cy + x, c) + this.set(cx - y, cy + x, c) + this.set(cx + y, cy - x, c) + this.set(cx - y, cy - x, c) + x++ + if (d > 0) { + y-- + d += 4 * (x - y) + 10 + } else { + d += 4 * x + 6 + } + } +} + +Image.prototype.drawRect = function ( + x: number, + y: number, + w: number, + h: number, + c: color +): void { + if (w === 0 || h === 0) return + w-- + h-- + this.drawLine(x, y, x + w, y, c) + this.drawLine(x, y, x, y + h, c) + this.drawLine(x + w, y + h, x + w, y, c) + this.drawLine(x + w, y + h, x, y + h, c) +} + +Image.prototype.rotated = function (deg: number): Image { + if (deg === -90 || deg === 270) { + let r = this.transposed() + r.flipY() + return r + } else if (deg === 180 || deg === -180) { + let r = this.clone() + r.flipX() + r.flipY() + return r + } else if (deg === 90) { + let r = this.transposed() + r.flipX() + return r + } else { + return null + } +} + +Image.prototype.allocContext = function (): ImageContext { + return new ImageContext(this) +} + +/** + * Make an Image object from ASCII art + * @devsNative + */ +export function img(lits: any, ...args: any[]): Image { + return null +} +`, + "graphics/src/image_spi.ts": `import * as ds from "@devicescript/core" +import { SPI } from "@devicescript/spi" +import { Image } from "./image" +import { Palette } from "./palette" + +// sync with devs_objects.h +export enum SpiImageFlags { + MODE_MASK = 0x000f, + MODE_MONO = 0x0000, + MODE_565 = 0x0001, + MODE_MONO_REV = 0x0002, + ORDER_MASK = 0x10000, + BY_COL = 0x00000, + BY_ROW = 0x10000, +} + +type DsSpi = typeof ds & { + spiSendImage(image: Image, palette: Buffer, flags: number): Promise +} + +export interface SpiImageOptions { + /** + * The SPI instance to use. + */ + spi: SPI + + /** + * The image to send; height has to be even; only bpp==4 currently supported. + */ + image: Image + + /** + * Palette for the image + */ + palette: Palette + + /** + * Currently modes (in both BY_COL and BY_ROW modes): + * - MODE_565 with bpp=4 + * - MODE_MONO and MODE_MONO_REV with bpp=1 + */ + flags: SpiImageFlags +} + +/** + * Send the pixels of an image over SPI bus. + */ +export async function spiSendImage(options: SpiImageOptions) { + await (ds as DsSpi).spiSendImage( + options.image, + options.palette.buffer, + options.flags + ) +} +`, + "graphics/src/index.ts": `export * from "./image" +export * from "./text" +export * from "./dotmatrix" +export * from "./image_spi" +export * from "./display" +export * from "./canvas" +export * from "./palette" +`, + "graphics/src/main.ts": `import * as ds from "@devicescript/core" +import { describe, expect, test } from "@devicescript/test" +import { Image, font5, img, scaledFont } from "./index" + +function printImg(img: Image) { + console.log(img) + for (let y = 0; y < img.height; y++) { + let ln = "" + for (let x = 0; x < img.width; ++x) { + const c = img.get(x, y) + const p = c === 0 ? "." : c + ln += \`\${p} \` + } + console.log(ln) + } +} + +describe("graphics", () => { + test("pixels", () => { + const tst = img\` + . . . 4 . . . . . . + . 2 2 2 2 2 . . . . + . 2 7 7 . 2 . . . . + . 2 7 7 . 2 . . . . + . 2 . . . 2 . . . . + . 2 2 2 2 2 . . . . + . . . . . . . . . .\` + + const image = Image.alloc(10, 7, 4) + image.fill(18) + image.fillRect(0, 0, image.width, image.height, 0) + image.fillRect(1, 1, 3, 3, 7) + image.drawRect(1, 1, 5, 5, 2) + image.set(3, 0, 4) + ds.assert(tst.equals(tst)) + ds.assert(image.equals(image)) + ds.assert(image.equals(tst)) + ds.assert(tst.equals(image)) + printImg(image) + printImg(tst) + }) + + test("text", () => { + const image = Image.alloc(60, 15, 4) + image.print("Hello world", 0, 0) + image.print("Hello world", 0, 8, 2, font5()) + image.print("X", 30, 6, 3, scaledFont(font5(), 2)) + printImg(image) + const txtTst = img\` +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +. 1 . . 1 . . . . . . . . 1 1 . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . +. 1 . . 1 . . . . . . . . . 1 . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . +. 1 1 1 1 . . . 1 1 . . . . 1 . . . . . 1 . . . . . 1 1 . . . . . . . . 1 . . . 1 . . . 1 1 . . . 1 . 1 . . . . 1 . . . +. 1 . . 1 . . 1 . 1 1 . . . 1 . . . . . 1 . . . . 1 . . 1 . . . . . . . 1 . 1 . 1 . . 1 . . 1 . . 1 1 . 1 . . . 1 . . . +. 1 . . 1 . . 1 1 . . . . . 1 . . . . . 1 . . . . 1 . . 1 . . . . . . . 1 . 1 . 1 . . 1 . . 1 . . 1 . . . . . . 1 . . . +. 1 . . 1 . . . 1 1 1 . . 1 1 1 . . . 1 1 1 . . . . 1 1 . . 3 3 . . . . 3 3 . 1 . . . . 1 1 . . . 1 . . . . . 1 1 1 . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 . . . . 3 3 . . . . . . . . . . . . . . . . . . . . . . +2 . . 2 . . . 2 2 . . . . 2 . . . . . 2 . . . . . . . . . . 3 3 . . . . 3 3 . . . . . . . . . . . . . . . . . 2 . . . . +2 . . 2 . . 2 . . 2 . . . 2 . . . . . 2 . . . . . 2 2 . . . 3 3 . . . . 3 3 . . 2 . . 2 2 . . . . 2 2 2 . . . 2 . . . . +2 2 2 2 . . 2 2 2 . . . . 2 . . . . . 2 . . . . 2 . . 2 . . . . 3 3 3 3 2 . . . 2 . 2 . . 2 . . 2 . . . . . . 2 . . . . +2 . . 2 . . 2 . . . . . . 2 . . . . . 2 . . . . 2 . . 2 . . . . 3 3 3 3 2 . 2 . 2 . 2 . . 2 . . 2 . . . . . . 2 . . . . +2 . . 2 . . . 2 2 2 . . . . 2 2 . . . . 2 2 . . . 2 2 . . . 3 3 . . . . 3 3 . 2 2 . . 2 2 . . . 2 . . . . . . . 2 2 . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 . . . . 3 3 . . . . . . . . . . . . . . . . . . . . . . +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 . . . . 3 3 . . . . . . . . . . . . . . . . . . . . . . +\` + ds.assert(txtTst.equals(image)) + }) +}) +`, + "graphics/src/palette.ts": `export class Palette { + readonly buffer: Buffer + /** + * Number of colors in the palette + */ + readonly length: number + + /** + * Allocates a 4bpp palette similar to MakeCode Arcade + * @returns + */ + static arcade() { + return new Palette(hex\` + 000000 ffffff ff2121 ff93c4 ff8135 fff609 249ca3 78dc52 + 003fad 87f2ff 8e2ec4 a4839f 5c406c e5cdc4 91463d 000000 + \`) + } + + /** + * A better color palette for LED strips + * @returns + */ + static leds() { + return new Palette(hex\` + 000000 ffffff ff0000 00ff00 0000ff ffff00 ff00ff 00ffff + ffa500 adff2f 008080 800080 ffc0cb 4b0082 ffd8a8 e0e0ff + \`) + } + + /** + * Allocates a 1bpp monochrome palette + * @returns + */ + static monochrome() { + return new Palette(hex\`000000 ffffff\`) + } + + constructor(init: Buffer) { + this.buffer = init.slice(0) + this.buffer.set(init) + this.length = (this.buffer.length / 3) >> 0 + } + + /** + * Returns the 24bit RGB color at the given index. Supports negative indices like Array.at + * @param index + * @returns + */ + at(index: number) { + index = index >> 0 + if (index < 0) index += this.length + if (index < 0 || index >= this.length) return undefined + + return ( + (this.buffer[3 * index] << 16) | + (this.buffer[3 * index + 1] << 8) | + (this.buffer[3 * index + 2] << 0) + ) + } + + /** + * Sets a 24bit RGB color at the given index + * @param index + * @param color 24bit RGB color + */ + setAt(index: number, color: number) { + index = index >> 0 + if (index < 0) index += this.length + if (index < 0 || index >= this.length) return + + this.buffer[3 * index] = color >> 16 + this.buffer[3 * index + 1] = color >> 8 + this.buffer[3 * index + 2] = color >> 0 + } + + /** + * Packs palette for Jacdac packet + * @returns + */ + packed(): Buffer { + const res: Buffer = Buffer.alloc(this.length << 2) + for (let i = 0; i < this.length; ++i) { + res[i * 4] = this.buffer[i * 3] + res[i * 4 + 1] = this.buffer[i * 3 + 1] + res[i * 4 + 2] = this.buffer[i * 3 + 2] + } + return res + } + + /** + * Unpacks palette from Jacdac packet + * @param buffer + */ + unpack(buffer: Buffer) { + if (buffer.length >> 2 !== this.length) + throw new RangeError("incorrect number of colors") + for (let i = 0; i < this.length; ++i) { + this.buffer[i * 3] = buffer[i * 4] + this.buffer[i * 3 + 1] = buffer[i * 4 + 1] + this.buffer[i * 3 + 2] = buffer[i * 4 + 2] + } + } +} +`, + "graphics/src/text.ts": `import { Image, Font } from "./image" + +let _deflFont: Font +export function fontForText(text: string) { + if (!_deflFont) _deflFont = font8() + + /* + for (let i = 0; i < text.length; ++i) { + // this is quite approximate + if (text.charCodeAt(i) > 0x2000) return image.font12 + } + */ + + return _deflFont +} + +Image.prototype.printCenter = function ( + text: string, + y: number, + color?: number, + font?: Font +) { + if (!font) font = fontForText(text) + let w = text.length * font.charWidth + let x = (this.width - w) / 2 + this.print(text, x, y, color, font) +} + +Image.prototype.print = function ( + text: string, + x: number, + y: number, + color?: number, + font?: Font +) { + x |= 0 + y |= 0 + if (!font) font = fontForText(text) + if (color == null) color = 1 + let x0 = x + let cp = 0 + let mult = font.multiplier ? font.multiplier : 1 + let dataW = Math.idiv(font.charWidth, mult) + let dataH = Math.idiv(font.charHeight, mult) + let byteHeight = (dataH + 7) >> 3 + let charSize = byteHeight * dataW + let dataSize = 2 + charSize + let fontdata = font.data + let lastchar = Math.idiv(fontdata.length, dataSize) - 1 + let imgBuf: Buffer + let imgIcon: Image + if (mult === 1) { + imgBuf = Buffer.alloc(charSize) + imgIcon = Image.alloc(dataW, dataH, 1, imgBuf) + } + while (cp < text.length) { + let xOffset = 0, + yOffset = 0 + /* + if (offsets && cp < offsets.length) { + xOffset = offsets[cp].xOffset + yOffset = offsets[cp].yOffset + } + */ + + let ch = text.charCodeAt(cp++) + if (ch === 10) { + y += font.charHeight + 2 + x = x0 + } + + if (ch < 32) continue // skip control chars + + let l = 0 + let r = lastchar + let off = 0 // this should be a space (0x0020) + let guess = (ch - 32) * dataSize + if (fontdata.getAt(guess, "u16") === ch) off = guess + else { + while (l <= r) { + let m = l + ((r - l) >> 1) + let v = fontdata.getAt(m * dataSize, "u16") + if (v === ch) { + off = m * dataSize + break + } + if (v < ch) l = m + 1 + else r = m - 1 + } + } + + if (mult === 1) { + imgBuf.blitAt(0, fontdata, off + 2, charSize) + this.drawTransparentImage(imgIcon, x + xOffset, y + yOffset, color) + x += font.charWidth + } else { + off += 2 + for (let i = 0; i < dataW; ++i) { + let j = 0 + let mask = 0x01 + let c = fontdata[off++] + while (j < dataH) { + if (mask === 0x100) { + c = fontdata[off++] + mask = 0x01 + } + let n = 0 + while (c & mask) { + n++ + mask <<= 1 + } + if (n) { + this.fillRect( + x + xOffset * mult, + y + (j + yOffset) * mult, + mult, + mult * n, + color + ) + j += n + } else { + mask <<= 1 + j++ + } + } + x += mult + } + } + } +} + +export function font8(): Font { + return { + charWidth: 6, + charHeight: 8, + data: hex\` +2000000000000000 210000005e000000 2200000e000e0000 230028fe28fe2800 24004c92ff926400 250002651248a640 +26006c92926ca000 270000000e000000 280000007c820000 29000000827c0000 2a00543810385400 2b0010107c101000 +2c00000090700000 2d00101010101000 2e00000060600000 2f00006010080600 3000003c42423c00 310000447e400000 +3200004462524c00 330000424a4e3200 34003028247e2000 3500004e4a4a3200 3600003c4a4a3000 3700000262120e00 +380000344a4a3400 3900000c52523c00 3a0000006c6c0000 3b00000096760000 3c00102828444400 3d00282828282800 +3e00444428281000 3f00000259090600 40003c425a560800 4100781412147800 42007e4a4a4a3400 4300003c42422400 +4400007e42423c00 4500007e4a4a4200 4600007e0a0a0200 4700003c42523400 4800007e08087e00 490000427e420000 +4a002040423e0200 4b00007e08146200 4c00007e40404000 4d007e0418047e00 4e00007e04087e00 4f003c4242423c00 +5000007e12120c00 5100003c5262bc00 5200007e12126c00 530000244a522400 540002027e020200 5500003e40403e00 +5600001e70701e00 57007e2018207e00 5800422418244200 5900060870080600 5a000062524a4600 5b00007e42420000 +5c00000608106000 5d000042427e0000 5e00080402040800 5f00808080808000 6000000002040000 6100003048487800 +6200007e48483000 6300003048484800 6400003048487e00 6500003068585000 660000107c120400 67000018a4a47800 +6800007e08087000 690000487a400000 6a000040847d0000 6b00007e10284000 6c0000427e400000 6d00780830087000 +6e00007808087000 6f00003048483000 700000fc24241800 710000182424fc00 7200007810081000 7300005058682800 +740000083e482000 7500003840407800 7600001860601800 7700384030403800 7800004830304800 7900005ca0a07c00 +7a00004868584800 7b00000836410000 7c000000fe000000 7d00004136080000 7e00000804080400 a000000000000000 +a10000007a000000 a200003048fc4800 a30090fc92928400 a400542844285400 a5002a2c782c2a00 a6000000ee000000 +a7000094aaaa5200 a800000200020000 a9003e414955413e aa0000242a2e0000 ab00102854284400 ac00001010107000 +ad00001010101000 ae003e415d45413e af00000202020200 b000000814140800 b1008888be888800 b2000024322c0000 +b30000222a140000 b400000004020000 b50000f840207800 b6000c1e7e027e00 b700000010000000 b800000080400000 +b90000243e200000 ba0000242a240000 bb00442854281000 bc00025f70f84000 bd00021f90c8b000 be0011557af84000 +bf000030484d2000 c000601916186000 c100601816196000 c200601a151a6000 c300601a151a6100 c400601914196000 +c500601a151a6000 c6007c0a7e4a4200 c700001ea1611200 c800007c55564400 c900007c56554400 ca00007c56554600 +cb00007c55544500 cc0000457e440000 cd0000447e450000 ce0000467d460000 cf0000457c450000 d000087e4a423c00 +d100007e09127d00 d200003845463800 d300003846453800 d400003846453a00 d500003a45463900 d600003845443900 +d700442810284400 d80000fc724e3f00 d900003c41423c00 da00003c42413c00 db00003c42413e00 dc00003c41403d00 +dd00040872090400 de00007e24241800 df00007c025a2400 e0000030494a7800 e10000304a497800 e20000304a497a00 +e3000032494a7900 e40000304a487a00 e50000304a4d7a00 e600304878685000 e7000018a4642400 e8000030695a5000 +e90000306a595000 ea0000306a595200 eb0000306a585200 ec0000497a400000 ed0000487a410000 ee00004a79420000 +ef00004a78420000 f00000304a4b3d00 f100007a090a7100 f2000030494a3000 f30000304a493000 f40000304a493200 +f5000032494a3100 f60000304a483200 f700101054101000 f800007068583800 f900003841427800 fa00003842417800 +fb00003842417a00 fc00003842407a00 fd0000b84241f800 fe0000ff24241800 ff00005ca1a07d00 0001601915196000 +010100304a4a7a00 0201611a16196000 030100314a4a7900 04013c0a094abc00 050100182464bc00 0601003846452800 +070100304a494800 0801003846452a00 090100304a494a00 0a01003844452800 0b010030484a4800 0c01003845462900 +0d010030494a4900 0e01007c45463900 0f0100314a497e00 1001087e4a423c00 110130484c7e0400 1201007d55554500 +130100326a5a5200 1401007d56564500 150100316a5a5100 1601007c55544400 170100306a585000 1801003f65a52100 +1901001874ac2800 1a01007c55564500 1b010030695a5100 1c01003846553600 1d0100304a49f200 1e01003946563500 +1f0100314a4af100 2001003844553400 21010018a4a57800 2201001ea1691a00 23010018a6a57800 2401007812117a00 +25017e080a710200 2601047e147e0400 2701047e0c087000 28010002457e4500 29010002497a4100 2a0100457d450000 +2b01004a7a420000 2c0100014a7a4900 2d0100014a7a4100 2e0100217fa10000 2f0100247da00000 300100447d440000 +3101004878400000 32017e0022423e00 33013d0040847d00 34012040463d0600 350100800af90200 360100bf440a3100 +370100bf48142000 3801007810284800 3901007c40424100 3a0100467d400000 3b01003fa0602000 3c0100a17f200000 +3d01007c41424100 3e0100457e410000 3f01007e40484000 400100427e400800 4101107e48404000 420100527e480000 +4301007c0a117c00 440100780a097000 450100bf42043f00 460100bc44043800 4701007c09127d00 480100790a097000 +49010a0678087000 4a01003f02847f00 4b01003c04847800 4c01394545453900 4d0100324a4a3200 4e01394646463900 +4f0100314a4a3100 50013a4544463900 5101324948320100 52013c427e4a4200 5301304830685000 5401007c16354800 +5501007812091000 560100bf49093600 570100bc48040800 5801007d16354800 5901007912091000 5a01004856552400 +5b0100505a692800 5c01004856552600 5d0100505a692a00 5e010012a5691200 5f010028ac741400 6001004855562500 +61010050596a2900 62010101bf410100 630100049f641000 640104057e050400 650100083d4a2100 660102127e120200 +670100183e582000 6801003a41423900 6901003a41427900 6a01003d41413d00 6b01003a42427a00 6c01003942423900 +6d01003942427900 6e01003a45453a00 6f01003a45457a00 70013a41403a0100 71013a41407a0100 7201001f60a01f00 +7301001c60a03c00 7401782211227800 7501384231423800 7601081261120800 770100b84241fa00 7801040970090400 +79010064564d4400 7a0100486a594800 7b010064544d4400 7c010048685a4800 7d010064554e4500 7e010048695a4900 +7f0100087c020400 8f01003452523c00 920100887e090200 a0013c42423c0806 a101003048483008 af01003e403e0806 +b001003840781008 b501006a5a4a4e00 b601005878585800 d101003845463900 d2010030494a3100 e601003845563500 +e7010030494af100 fa0100742a750000 fb0100304c4a7d00 fc0178147e554400 fd0130487a695000 fe010078744e3d00 +ff0100706a593800 18020012a5691200 19020028ac741400 1a020101bf410100 1b0200049f641000 bb0200000c0a0000 +bc0200000a060000 bd020000060a0000 c602000201020000 c702000102010000 c902000202020000 d802000102020100 +d902000002000000 da02000205020000 db02000040800000 dc02000201020100 dd02020100020100 7403000002010000 +7503000080400000 7a030000c0800000 7e03000096760000 8403000003000000 8503020003000200 8603037c12127c00 +8703000010000000 880303007e4a4200 890303007e087e00 8a030300427e4200 8c03033c42423c00 8e0303000e700e00 +8f03035c62625c00 900302003b400200 9103781412147800 92037e4a4a4a3400 9303007e02020200 9403605846586000 +9503007e4a4a4200 96030062524a4600 9703007e08087e00 98033c4a4a4a3c00 990300427e420000 9a03007e08146200 +9b03601806186000 9c037e0418047e00 9d03007e04087e00 9e0300424a4a4200 9f033c4242423c00 a003007e02027e00 +a103007e12120c00 a30300665a424200 a40302027e020200 a503060870080600 a60318247e241800 a703422418244200 +a8030e107e100e00 a9035c6202625c00 aa0300457c450000 ab03040970090400 ac030030484a7900 ad030030685a5100 +ae0378100a09f000 af03003a41200000 b0033a4043403a00 b103003048487800 b20300fe25251a00 b3030c30c0300c00 +b403344a4a4a3000 b503003068585000 b603021aa6a24200 b7033c080404f800 b803003c4a4a3c00 b903003840200000 +ba03007820504800 bb03641212227c00 bc03fc2020103c00 bd03182040201800 be03112d2ba94100 bf03003048483000 +c003087808780800 c103f82424241800 c2031824a4a44800 c303304848582800 c403000838482800 c503384040403800 +c6031c20f8241800 c703c4281028c400 c8031c20fc201c00 c903304820483000 ca03000238422000 cb03384240423800 +cc0330484a493000 cd03384042413800 ce03304822493000 d0033c52525c2000 d10310344a3c0800 d203067804020400 +d303120a7c020400 d4030d7009040800 d5031824ff241800 d603384828483800 d70348302221d800 da031c2221a14200 +db031824a4a44200 dc037e1212020200 dd0300fc24240400 de033e2010087c00 df030c0ac9281800 e003700c621c7000 +e10301092516f800 e2039ea0bea07e00 e30398a0b8a07800 e4030c1214107e00 e503001028207800 e603be9088887000 +e70348544e443800 e803245252524c00 e903285454544800 ea0364524c526400 eb03086458640800 ec03385454542200 +ed03306848682400 ee03184a7e4a1800 ef031848ff0a0800 f003483020205800 f10378a4a4a49800 f203304848485000 +f303006080847d00 f4033c4a4a4a3c00 f503003058584800 0004007c55564400 0104007c55544500 020401013f857900 +0304007c06050400 04043c4a4a422400 050400244a522400 060400427e420000 070400457c450000 08042040423e0200 +09047c027e483000 0a047e087e483000 0b0402027e0a7200 0c04007c102a4500 0d047c2112087c00 0e040c5152523d00 +0f043f20e0203f00 1004781412147800 11047e4a4a4a3000 12047e4a4a4a3400 1304007e02020200 1404c07c427ec000 +1504007e4a4a4200 160476087e087600 170424424a4a3400 1804007e08047e00 1904007d120a7d00 1a04007e08146200 +1b04403c02027e00 1c047e0418047e00 1d04007e08087e00 1e043c4242423c00 1f047e0202027e00 2004007e12120c00 +2104003c42422400 220402027e020200 23040e5050503e00 240418247e241800 2504422418244200 26043f2020bf6000 +27040e1010107e00 28047e407e407e00 29043f203fa07f00 2a04027e48483000 2b047e4848307e00 2c04007e48483000 +2d0424424a4a3c00 2e047e183c423c00 2f04006c12127e00 3004304848784000 3104003c4a4a3100 3204007868502000 +3304007808080800 3404c0704878c000 3504306868500000 3604483078304800 3704004058683000 3804784020107800 +3904794222127900 3a04007820304800 3b04403008087800 3c04781020107800 3d04781010107800 3e04304848483000 +3f04780808087800 4004fc2424241800 4104304848485000 4204080878080800 43041ca0a0a07c00 44041824ff241800 +4504004830304800 46043c2020bc6000 4704182020207800 4804784078407800 49043c203ca07c00 4a04087850502000 +4b04785050207800 4c04007850502000 4d04485868300000 4e04783030483000 4f04502828780000 50040030696a5000 +51040032686a5000 5204023f0a887000 530400780a090800 5404003068584800 5504005058682800 560400487a400000 +5704004a78420000 5804004080847d00 5904700878502000 5a04781078502000 5b04047e14106000 5c04007822314800 +5d04784122107800 5e0418a1a2a27900 5f043c20e0203c00 6204027f4a483000 6304087e58502000 70040e107e100e00 +7104182078201800 72043c4a4a4a3c00 7304306858683000 7404001e70180c00 7504001860301000 9004007e02020300 +9104007808080c00 9204087e0a0a0200 9304207828080800 96043b043f043be0 970424183c1824c0 9a04003f040a31c0 +9b04003c101824c0 ae04060870080600 af040c10e0100c00 b004161870181600 b1042c30e0302c00 b20421120c1221c0 +b3040024181824c0 ba047e0808087000 bb04007e08087000 d804003452523c00 d904002868583000 e20400457d450000 +e304004a7a420000 e8043c4a4a4a3c00 e904003058583000 ee04003d41413d00 ef04003a42427a00 d005681020285000 +d105484848784000 d205004830600000 d305080808780800 d405680808087800 d505000008780000 d605080818680800 +d705087808087800 d805784050487800 d905000008180000 da0504040404fc00 db05484848483800 dc050e4848281800 +dd05087848487800 de05582010487000 df05000004fc0000 e005004040487800 e105000878483800 e205487840281800 +e305041c0404fc00 e405485848483800 e50504f820140800 e605485060685000 e705f40424241c00 e805080808087000 +e905785058403800 ea05487808087800 f005087800087800 f105081800087800 f205081800081800 f305000010080000 +f405100800100800 021e7c5455542800 031e007e48493000 0a1e007c45443800 0b1e003049487e00 1e1e007c15140400 +1f1e001079140800 401e7e0419047e00 411e780832087000 561e007c15140800 571e00fc25241800 601e004854552400 +611e0050586a2800 6a1e04047d040400 6b1e00083d482000 801e7c2112207c00 811e384132403800 821e7c2012217c00 +831e384032413800 841e7c2110217c00 851e384230423800 f21e040972080400 f31e00b84142f800 a3207e0a7a120a00 +a420a8fcaa828400 a720087e2a1c0800 ab200098a4a6bf02 ac20183c5a5a4200 af20627f22443800 9021103854101000 +912108047e040800 9221101054381000 932110207e201000 9421103810103810 95212844fe442800 +\`, + } +} + +export function font5(): Font { + return { + charWidth: 6, + charHeight: 5, + // source https://github.com/lancaster-university/microbit-dal/blob/master/source/core/MicroBitFont.cpp + data: hex\` +2000000000000000 2100001700000000 2200000300030000 23000a1f0a1f0a00 24000a17151d0a00 2500130904121900 +26000a15150a1000 2700000300000000 2800000e11000000 290000110e000000 2a00000a040a0000 2b0000040e040000 +2c00001008000000 2d00000404040000 2e00000800000000 2f00100804020100 30000e11110e0000 310000121f100000 +3200191515120000 33000911150b0000 34000c0a091f0800 3500171515150900 3600081416150800 3700110905030100 +38000a1515150a00 390002150d050200 3a00000a00000000 3b0000100a000000 3c0000040a110000 3d00000a0a0a0000 +3e0000110a040000 3f00020115050200 40000e1115090e00 41001e05051e0000 42001f15150a0000 43000e1111110000 +44001f11110e0000 45001f1515110000 46001f0505010000 47000e1111150c00 48001f04041f0000 4900111f11000000 +4a000911110f0100 4b001f040a110000 4c001f1010100000 4d001f0204021f00 4e001f0204081f00 4f000e11110e0000 +50001f0505020000 5100060919160000 52001f05050a1000 5300121515090000 540001011f010100 55000f10100f0000 +5600070810080700 57001f0804081f00 58001b04041b0000 590001021c020100 5a00191513110000 5b00001f11110000 +5c00010204081000 5d000011111f0000 5e00000201020000 5f00101010101000 6000000102000000 61000c12121e1000 +62001f1414080000 63000c1212120000 64000814141f0000 65000e1515120000 6600041e05010000 67000215150f0000 +68001f0404180000 6900001d00000000 6a000010100d0000 6b001f040a100000 6c00000f10100000 6d001e0204021e00 +6e001e02021c0000 6f000c12120c0000 70001e0a0a040000 7100040a0a1e0000 72001c0202020000 730010140a020000 +7400000f14141000 75000e10101e1000 7600060810080600 77001e1008101e00 7800120c0c120000 7900121408040200 +7a00121a16120000 7b0000041f110000 7c00001f00000000 7d00111f04000000 7e00000404080800 d3000c1213130c00 +f3000c12130d0000 04010e05051e1000 05010609191f0800 06010c1213131200 07010c1213130000 18010f0b1b190000 +19010e151d1a0000 41011f1412100000 4201100f14120000 43011f0205081f00 44011e03031c0000 5a0110140b030200 +5b0110140b030000 7901121a17130000 7a01121a17130000 7b01121b17120000 7c01121b17120000\`, + } +} + +export function scaledFont(f: Font, size: number): Font { + size |= 0 + if (size < 2) return f + return { + charWidth: f.charWidth * size, + charHeight: f.charHeight * size, + data: f.data, + multiplier: f.multiplier ? size * f.multiplier : size, + } +} +`, + "i2c/package.json": `{ + "name": "@devicescript/i2c", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/i2c" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "i2c/src/client.ts": `import { I2C } from "./i2c_impl"; + +/** + * The I2C adapter client + */ +export const i2c = new I2C() +`, + "i2c/src/i2c_impl.ts": `import * as ds from "@devicescript/core" + +export class I2CError extends Error { + readonly status: ds.I2CStatus + constructor(message: string, status: ds.I2CStatus) { + super(message) + this.name = "I2CError" + this.status = status + } +} + +type DsI2C = typeof ds & { + _i2cTransaction( + addr: number, + wrbuf: Buffer, + rdbuf?: Buffer + ): Promise +} + +export class I2C { + /** + * Execute I2C transaction + * @param devAddr a 7 bit i2c address + * @param writeBuf the value to write + * @param numRead number of bytes to read afterwards + * @returns a buffer \`numRead\` bytes long + */ + async xfer( + devAddr: number, + writeBuf: Buffer, + numRead?: number + ): Promise { + const rdbuf = numRead ? Buffer.alloc(numRead) : undefined + const rc = await (ds as DsI2C)._i2cTransaction(devAddr, writeBuf, rdbuf) + if (rc !== 0) + throw new I2CError( + \`I2C error \${rc} dev=\${devAddr}: write \${writeBuf}, read \${numRead} B\`, + rc + ) + return rdbuf || hex\`\` + } + + /** + * Write a byte to a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @param byte the value to write + * @throws I2CError + */ + async writeReg( + devAddr: number, + regAddr: number, + byte: number + ): Promise { + await this.xfer(devAddr, Buffer.from([regAddr, byte])) + } + + /** + * read a byte from a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @returns a byte + * @throws I2CError + */ + async readReg(devAddr: number, regAddr: number): Promise { + return (await this.xfer(devAddr, Buffer.from([regAddr]), 1))[0] + } + + /** + * write a buffer to a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @param b a byte buffer + * @throws I2CError + */ + async writeRegBuf( + devAddr: number, + regAddr: number, + b: Buffer + ): Promise { + const nb = Buffer.alloc(1 + b.length) + nb[0] = regAddr + nb.blitAt(1, b, 0, b.length) + await this.xfer(devAddr, nb) + } + + /** + * read a buffer from a register + * @param devAddr a 7 bit i2c address + * @param regAddr an 8 bit register address + * @param size the number of bytes to request + * @returns a byte buffer + * @throws I2CError + */ + async readRegBuf( + devAddr: number, + regAddr: number, + size: number + ): Promise { + return await this.xfer(devAddr, Buffer.from([regAddr]), size) + } + + /** + * read a raw buffer + * @param devAddr a 7 bit i2c address + * @param size the number of bytes to request + * @returns a byte buffer + * @throws I2CError + */ + async readBuf(devAddr: number, size: number): Promise { + return await this.xfer(devAddr, hex\`\`, size) + } + + /** + * write a raw buffer + * @param devAddr a 7 bit i2c address + * @param b a byte buffer + * @throws I2CError + */ + async writeBuf(devAddr: number, b: Buffer): Promise { + await this.xfer(devAddr, b) + } +} +`, + "i2c/src/index.ts": `export * from "./client" +export { I2CError, I2C } from "./i2c_impl" +`, + "i2c/src/main.ts": `import { describe, expect, test } from "@devicescript/test" + +describe("i2c", () => {}) +`, + "net/package.json": `{ + "name": "@devicescript/net", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/net" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions --test-timeout=10000", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "net/src/encfetch.ts": `import { + decrypt, + encrypt, + randomBuffer, + ivSize, + randomString, + sha256Hkdf, +} from "@devicescript/crypto" +import { fetch } from "./fetch" +import { URL } from "./url" + +const algo = "aes-256-ccm" +const tagLength = 8 + +export interface EncFetchOptions { + /** + * JSON object to send. + */ + data: any + + /** + * Where to send the request. This should be the same for all requests from this device as it's send unencrypted. + */ + url: string | URL + + /** + * A long-ish random string. + */ + password: string + + /** + * Additional headers. + */ + headers?: Record + + /** + * HTTP method (defaults to POST) + */ + method?: string +} + +/** + * Send an encrypted HTTP request. + * + * @param obj JSON object + * @returns JSON response + */ +export async function encryptedFetch(options: EncFetchOptions) { + // we add a random request ID - the server is supposed to ignore duplicate requests to prevent reply attacks + const rid = randomBuffer(8).toString("hex") + + const data = Buffer.from( + JSON.stringify({ + $rid: rid, + ...options.data, + }) + ) + + if (!options.password) throw new TypeError(\`password not specified\`) + + const salt = randomString(20) + const key = sha256Hkdf(options.password, "", salt) + const iv = Buffer.alloc(ivSize(algo)) // zero IV + const encrypted = encrypt({ + data, + algo, + key, + iv, + tagLength, + }) + + const resp = await fetch(options.url, { + method: options.method || "POST", + body: encrypted, + headers: { + "x-devs-enc-fetch-algo": \`\${algo}/tag=\${tagLength}\`, + "x-devs-enc-fetch-salt": salt, + "content-type": "application/x-devs-enc-fetch", + ...(options.headers || {}), + }, + }) + + if (!resp.ok) + throw new Error(\`invalid response \${resp.status} \${resp.statusText}\`) + + const serverSalt = resp.headers.get("x-devs-enc-fetch-info") + if (!serverSalt) + throw new Error(\`x-devs-enc-fetch-info missing in response\`) + + const data2 = await resp.buffer() + const key2 = sha256Hkdf(options.password, serverSalt, salt) + const respData = decrypt({ + data: data2, + algo, + key: key2, + iv, + tagLength, + }) + + return JSON.parse(respData.toString("utf-8")) +} +`, + "net/src/fetch.ts": `import { Socket, SocketProto, connect } from "./sockets" +import { URL } from "./url" + +/** + * Represents options for a fetch request. + */ +export interface FetchOptions { + method?: + | "GET" + | "HEAD" + | "POST" + | "PUT" + | "DELETE" + | "OPTIONS" + | "PATCH" + | string + headers?: Record | Headers + body?: string | Buffer +} + +/** + * Represents HTTP request or response headers. + * + * @devsWhenUsed + */ +export class Headers { + private data: Record = {} + constructor() {} + append(name: string, value: string): void { + name = name.toLowerCase() + if (this.has(name)) this.data[name] = this.data[name] + ", " + value + else this.data[name] = value + } + delete(name: string): void { + delete this.data[name.toLowerCase()] + } + get(name: string): string | null { + const r = this.data[name.toLowerCase()] + if (r === undefined) return null + return r + } + has(name: string): boolean { + return this.data[name.toLowerCase()] !== undefined + } + set(name: string, value: string): void { + this.data[name.toLowerCase()] = value + } + forEach( + callbackfn: (value: string, key: string, parent: Headers) => void + ): void { + for (const k of Object.keys(this.data)) { + callbackfn(this.data[k], k, this) + } + } + serialize() { + const req: string[] = [] + this.forEach((v, k) => { + req.push(\`\${k}: \${v}\`) + }) + req.push("") + return req.join("\\r\\n") + } +} + +/** + * Represents a HTTP response. + * + * @devsWhenUsed + */ +export class Response { + status: number + statusText: string + headers: Headers + ok: boolean + private _buffer: Buffer + + constructor(private socket: Socket) { + this.headers = new Headers() + } + + async buffer() { + if (this._buffer) return this._buffer + const explen = parseInt(this.headers.get("content-length")) + const buffers: Buffer[] = [] + let buflen = 0 + for (;;) { + const buf = await this.socket.recv() + if (!buf) break + buflen += buf.length + buffers.push(buf) + // note: explen can be NaN + if (buflen >= explen) break + } + await this.socket.close() + this._buffer = Buffer.concat(...buffers) + return this._buffer + } + + async text() { + return (await this.buffer()).toString("utf-8") + } + + async json() { + return JSON.parse(await this.text()) + } + + async close() { + await this.socket.close() + } +} + +/** + * Fetches a resource from the network. + * + * @param url - The URL to fetch. + * @param options - Optional fetch options. + * @returns A promise that resolves to a \`Response\` object. + * + * @throws {TypeError} If the URL is invalid or the request body is not a string or buffer. + */ +export async function fetch( + url: string | URL, + options?: FetchOptions +): Promise { + if (!options) options = {} + if (!options.method) options.method = "GET" + if (!options.headers) options.headers = new Headers() + if (!options.body) options.body = "" + + if (typeof url === "string") url = new URL(url) + + let proto: SocketProto = "tcp" + let port = 80 + + if (url.protocol === "https:") { + proto = "tls" + port = 443 + } else if (url.protocol !== "http:") { + throw new TypeError(\`invalid protocol: \${url.protocol}\`) + } + + if (url.username || url.password) + throw new TypeError(\`credentials in URL not supported: \${url.href()}\`) + + if (url.port) port = +url.port + if (!port) throw new TypeError(\`invalid port in url: \${url.href()}\`) + + let hd: Headers + if (options.headers instanceof Headers) { + hd = options.headers + } else { + hd = new Headers() + for (const k of Object.keys(options.headers)) { + hd.set(k, options.headers[k]) + } + } + + let bodyLen = 0 + if (typeof options.body === "string") bodyLen = options.body.byteLength + else if (options.body instanceof Buffer) bodyLen = options.body.length + else + throw new TypeError( + \`body has to be string or buffer; got \${options.body}\` + ) + + if (!hd.has("user-agent")) hd.set("user-agent", "DeviceScript fetch()") + if (!hd.has("accept")) hd.set("accept", "*/*") + hd.set("host", url.host()) + hd.set("connection", "close") + if (bodyLen) hd.set("content-length", bodyLen + "") + + const path = url.path() + const reqStr = \`\${options.method} \${path} HTTP/1.1\\r\\n\${hd.serialize()}\\r\\n\` + const s = await connect({ + host: url.hostname, + port, + proto, + }) + console.debug(\`req: \${reqStr}\`) + await s.send(reqStr) + if (bodyLen) await s.send(options.body) + + const resp = new Response(s) + + let status = await s.readLine() + if (status.startsWith("HTTP/1.1 ")) { + status = status.slice(9) + resp.status = parseInt(status) + const sp = status.indexOf(" ") + if (sp > 0) resp.statusText = status.slice(sp + 1) + else resp.statusText = "" + if (200 <= resp.status && resp.status <= 299) resp.ok = true + } else { + resp.status = 0 + resp.statusText = status + } + + console.debug(\`HTTP \${resp.status}: \${resp.statusText}\`) + + for (;;) { + const hd = await s.readLine() + if (hd === "") break + const colon = hd.indexOf(":") + if (colon > 0) { + const name = hd.slice(0, colon).trim() + const val = hd.slice(colon + 1).trim() + resp.headers.append(name, val) + } + } + + console.debug(resp.headers.serialize()) + return resp +} +`, + "net/src/index.ts": `export * from "./sockets" +export * from "./fetch" +export * from "./url" +export * from "./encfetch" +export * from "./mqtt" +`, + "net/src/main.ts": `import { describe, expect, test } from "@devicescript/test" +import { URL } from "./url" +import { assert, delay, emitter, wait } from "@devicescript/core" +import { fetch } from "./fetch" +import { MQTTConnectOptions, startMQTTClient } from "./mqtt" + +describe("net", () => { + test("URL", () => { + const u = new URL( + "https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash" + ) + assert(u.username === "user") + assert(u.password === "pass") + assert(u.hostname === "sub.example.com") + assert(u.port === "8080") + assert(u.pathname === "/p/a/t/h") + assert(u.search === "?query=string") + assert(u.hash === "#hash") + assert(u.protocol === "https:") + + assert(u.host() === "sub.example.com:8080") + + function checkURL(u: URL, exp: string) { + assert(u.href() === exp) + assert(new URL(exp).href() === exp) + } + + checkURL( + u, + "https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash" + ) + + u.password = "" + checkURL( + u, + "https://user@sub.example.com:8080/p/a/t/h?query=string#hash" + ) + + u.port = "" + checkURL(u, "https://user@sub.example.com/p/a/t/h?query=string#hash") + + u.hash = "" + checkURL(u, "https://user@sub.example.com/p/a/t/h?query=string") + + u.username = "" + checkURL(u, "https://sub.example.com/p/a/t/h?query=string") + + u.search = "" + checkURL(u, "https://sub.example.com/p/a/t/h") + + const u2 = new URL("https://foobar.com/foo#bar") + assert(u2.pathname === "/foo") + assert(u2.hash === "#bar") + }) + + /* + test("fetch test.json", async () => { + const res = await fetch( + "https://microsoft.github.io/devicescript/test.json" + ) + assert(res.ok) + assert(res.status === 200) + const json = await res.json() + console.log(json) + assert(json.data === "test") + })*/ + + test("fetch gthub status", async () => { + const res = await fetch("https://github.com/status.json") + console.log({ ok: res.ok, status: res.status }) + assert(res.ok) + assert(res.status === 200) + const json = await res.json() + console.log(json) + assert(!!json.status) + }) + + const testMqtt = async (opts: MQTTConnectOptions) => { + const mqtt = await startMQTTClient(opts) + let received = false + const recv = emitter() + const payload = Buffer.from("") + console.debug({ payload: payload.toString("hex") }) + const obs = await mqtt.subscribe("devs/tcp") + obs.subscribe(async msg => { + // console.log(msg) + if (msg.content.toString("hex") === payload.toString("hex")) { + received = true + recv.emit(undefined) + } + }) + await mqtt.publish("devs/tcp", payload) + await wait(recv, 15000) + await mqtt.stop() + + assert(received, "mqtt msg sent and received") + console.log(\`mqtt: ok\`) + } + + test("mqtt mosquitto 1883", async () => + await testMqtt({ + host: "test.mosquitto.org", + proto: "tcp", + port: 1883, + })) + test("mqtt mosquitto 1884", async () => + await testMqtt({ + host: "test.mosquitto.org", + proto: "tcp", + port: 1884, + username: "rw", + password: "readwrite", + })) + test("mqtt mosquitto 8886", async () => + await testMqtt({ + host: "test.mosquitto.org", + proto: "tls", + port: 8886, + })) + /* + test("mqtt eqmx tls", async () => + await testMqtt({ + host: "broker.emqx.io", + proto: "tls", + port: 8883, + })) + */ +}) +`, + "net/src/mqtt.ts": `/** + * + * MQTT communication layer. + * A port of https://github.com/rovale/micro-mqtt for MakeCode, ported to DeviceScript. + */ + +import { + AsyncVoid, + delay, + deviceIdentifier, + emitter, + wait, +} from "@devicescript/core" +import { Socket, SocketConnectOptions, connect } from "./sockets" +import { + Observable, + ObservableValue, + register, +} from "@devicescript/observables" + +/** + * Connect flags + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349229 + */ +const enum MQTTConnectFlags { + UserName = 1 << 7, + Password = 1 << 6, + WillRetain = 1 << 5, + WillQoS2 = 1 << 4, + WillQoS1 = 1 << 3, + Will = 1 << 2, + CleanSession = 1 << 1, +} + +/** + * Connect Return code + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349256 + */ +const enum MQTTConnectReturnCode { + Unknown = -1, + Accepted = 0, + UnacceptableProtocolVersion = 1, + IdentifierRejected = 2, + ServerUnavailable = 3, + BadUserNameOrPassword = 4, + NotAuthorized = 5, +} + +/** + * A message received by the MQTT client. + */ +export interface MQTTMessage { + /** + * The packet identifier of the message. + */ + pid?: number + /** + * The topic the message was published to. + */ + topic: string + /** + * The message payload. + */ + content: Buffer + /** + * The QoS of the message. + */ + qos: number + /** + * Whether the message was retained. + */ + retain: number +} + +/** + * MQTT Control Packet type + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc353481061 + */ +const enum MQTTControlPacketType { + Connect = 1, + ConnAck = 2, + Publish = 3, + PubAck = 4, + // PubRec = 5, + // PubRel = 6, + // PubComp = 7, + Subscribe = 8, + SubAck = 9, + Unsubscribe = 10, + UnsubAck = 11, + PingReq = 12, + PingResp = 13, + Disconnect = 14, +} + +/** + * Optimization, the TypeScript compiler replaces the constant enums. + */ +const enum Constants { + PingInterval = 40000, + WatchDogInterval = 50000, + DefaultQos = 0, + Uninitialized = -123, + FixedPackedId = 1, + KeepAlive = 60, +} + +/** + * The options used to connect to the MQTT broker. + */ +export interface MQTTConnectOptions extends SocketConnectOptions { + username?: string + password?: string + clientId?: string + /** + * Connection watchdog interval (ms). Default to 50s. + */ + watchdogInterval?: number + /** + * Ping packet interval (ms). Default to 40s. + */ + pingInterval?: number + /** + * Connection keep alive (seconds). Default to 60. + */ + keepAlive?: number + will?: MQTTConnectOptionsWill +} + +export interface MQTTConnectOptionsWill { + topic: string + message: string + qos?: number + retain?: boolean +} + +/** + * The specifics of the MQTT + */ +function strChr(codes: number[]): Buffer { + return Buffer.from(codes) +} + +/** + * Encode remaining length + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718023 + */ +function encodeRemainingLength(remainingLength: number): number[] { + let length: number = remainingLength + const encBytes: number[] = [] + while (length > 0) { + let encByte: number = length & 127 + length = length >> 7 + // if there are more data to encode, set the top bit of this byte + if (length > 0) { + encByte += 128 + } + encBytes.push(encByte) + } + return encBytes +} + +/** + * Connect flags + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349229 + */ +function createConnectFlags(options: MQTTConnectOptions): number { + const { username, password, will } = options + let flags: number = 0 + flags |= username ? MQTTConnectFlags.UserName : 0 + flags |= username && password ? MQTTConnectFlags.Password : 0 + flags |= MQTTConnectFlags.CleanSession + + if (will) { + flags |= MQTTConnectFlags.Will + flags |= (will.qos || 0) << 3 + flags |= will.retain ? MQTTConnectFlags.WillRetain : 0 + } + + return flags +} + +// Returns the MSB and LSB. +function getBytes(int16: number): number[] { + if (int16 < 0 || int16 > 65535) + throw new RangeError("bytes must be between 0 and 65535") + return [int16 >> 8, int16 & 255] +} + +/** + * Structure of UTF-8 encoded strings + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Figure_1.1_Structure + */ +function pack(s: string): Buffer { + const buf = Buffer.from(s) + return strChr(getBytes(buf.length)).concat(buf) +} + +/** + * Structure of an MQTT Control Packet + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc384800392 + */ +function createPacketHeader( + byte1: number, + variable: Buffer, + payloadSize: number +): Buffer { + const byte2: number[] = encodeRemainingLength(variable.length + payloadSize) + return strChr([byte1]).concat(strChr(byte2)).concat(variable) +} + +/** + * Structure of an MQTT Control Packet + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc384800392 + */ +function createPacket( + byte1: number, + variable: Buffer, + payload?: Buffer +): Buffer { + if (!payload) payload = Buffer.alloc(0) + return createPacketHeader(byte1, variable, payload.length).concat(payload) +} + +/** + * CONNECT - Client requests a connection to a Server + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718028 + */ +function createConnect(options: MQTTConnectOptions): Buffer { + const byte1: number = MQTTControlPacketType.Connect << 4 + + const protocolName = pack("MQTT") + const nums = Buffer.alloc(4) + nums[0] = 4 // protocol level + nums[1] = createConnectFlags(options) + nums[2] = 0 + nums[3] = options.keepAlive || Constants.KeepAlive + + let payload = pack(options.clientId || "") + + if (options.will) { + payload = payload.concat( + pack(options.will.topic).concat(pack(options.will.message)) + ) + } + + if (options.username) { + payload = payload.concat(pack(options.username)) + if (options.password) { + payload = payload.concat(pack(options.password)) + } + } + + return createPacket(byte1, protocolName.concat(nums), payload) +} + +/** PINGREQ - PING request + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc384800454 + */ +function createPingReq() { + return strChr([MQTTControlPacketType.PingReq << 4, 0]) +} + +/** + * PUBLISH - Publish message header - doesn't include "payload" + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc384800410 + */ +function createPublishHeader( + topic: string, + payloadSize: number, + qos: number, + retained: boolean +) { + let byte1: number = (MQTTControlPacketType.Publish << 4) | (qos << 1) + byte1 |= retained ? 1 : 0 + + const pid = strChr(getBytes(Constants.FixedPackedId)) + const variable = qos === 0 ? pack(topic) : pack(topic).concat(pid) + + return createPacketHeader(byte1, variable, payloadSize) +} + +function parsePublish(cmd: number, payload: Buffer): MQTTMessage { + const qos: number = (cmd & 0b00000110) >> 1 + + const topicLength = payload.readUInt16BE(0) + let variableLength: number = 2 + topicLength + if (qos > 0) { + variableLength += 2 + } + + const message: MQTTMessage = { + topic: payload.slice(2, 2 + topicLength).toString(), + content: payload.slice(variableLength), + qos: qos, + retain: cmd & 1, + } + + if (qos > 0) message.pid = payload.readUInt16BE(variableLength - 2) + + return message +} + +/** + * PUBACK - Publish acknowledgement + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc384800416 + */ +function createPubAck(pid: number) { + const byte1: number = MQTTControlPacketType.PubAck << 4 + + return createPacket(byte1, strChr(getBytes(pid))) +} + +/** + * SUBSCRIBE - Subscribe to topics + * http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc384800436 + */ +function createSubscribe(topic: string, qos: number): Buffer { + const byte1: number = (MQTTControlPacketType.Subscribe << 4) | 2 + const pid = strChr(getBytes(Constants.FixedPackedId)) + + return createPacket(byte1, pid, pack(topic).concat(strChr([qos]))) +} + +enum HandlerStatus { + Normal = 0, + Once = 1, + ToRemove = 2, +} + +class MQTTHandler { + public status: HandlerStatus + constructor( + public readonly header: Buffer, + public readonly topic: string, + public readonly obs: ObservableValue + ) { + this.status = HandlerStatus.Normal + } +} + +export enum MQTTState { + /** + * Opening socket + */ + Connecting = 0, + /** + * Socket opened, waiting for MQTT broker + */ + Open = 1, + /** + * MQTT broken acked connection packet + */ + Connected = 2, + /** + * The connection is in the process of closing + */ + Closing = 3, + /** + * Connection closed + */ + Closed = 4, + /** + * Sending packet + */ + Sending = 5, +} + +/** + * A MQTT client + * @devsWhenUsed + * Ported from {@link https://github.com/rovale/micro-mqtt micro-mqtt} + */ +export class MQTTClient { + private log(msg: string) { + console.log(\`mqtt: \${msg}\`) + } + + private trace(msg: string) { + console.debug(\`mqtt: \${msg}\`) + } + + public readonly opt: MQTTConnectOptions + + private socket?: Socket + private watchdogId: any + private pingId: any + + private buf: Buffer + public readyState = MQTTState.Closed + + /** + * Emitted when an error occurs. + */ + public readonly onerror = emitter() + /** + * Emitted when the connection is established. + */ + public readonly onconnect = emitter() + /** + * Emitted when the connection is closed. + */ + public readonly onclose = emitter() + /** + * Emitted when a message is received and not handled by any subscription. + */ + public readonly onunhandledmessage = emitter() + + private mqttHandlers: MQTTHandler[] = [] + + constructor(opt: MQTTConnectOptions) { + opt.proto = opt.proto || "tls" + if (!opt.port) opt.port = opt.proto === "tls" ? 8883 : 1883 + if (!opt.clientId) opt.clientId = \`devs_\${deviceIdentifier("self")}\` + if (opt.will) { + opt.will.qos = opt.will.qos || Constants.DefaultQos + opt.will.retain = opt.will.retain || false + } + this.opt = opt + } + + private static describe(code: MQTTConnectReturnCode): string { + let error: string = "Connection refused, " + switch (code) { + case MQTTConnectReturnCode.UnacceptableProtocolVersion: + error += "unacceptable protocol version." + break + case MQTTConnectReturnCode.IdentifierRejected: + error += "identifier rejected." + break + case MQTTConnectReturnCode.ServerUnavailable: + error += "server unavailable." + break + case MQTTConnectReturnCode.BadUserNameOrPassword: + error += "bad user name or password." + break + case MQTTConnectReturnCode.NotAuthorized: + error += "not authorized." + break + default: + error += \`unknown return code: \${code}.\` + } + + return error + } + + /** + * Close the current connection and socket + */ + private async close(): Promise { + if (this.readyState === MQTTState.Closed) return + + this.readyState = MQTTState.Closing + this.log("disconnect") + clearInterval(this.pingId) + this.pingId = undefined + const s = this.socket + if (s) { + this.socket = null + await s.close() + } + this.readyState = MQTTState.Closed + } + + /** + * Starts the MQTT client and watchdog + */ + public async start(): Promise { + if (this.running()) return + const self = this + // start watchdog + clearInterval(this.watchdogId) + this.watchdogId = setInterval(async () => { + if (self.readyState !== MQTTState.Connected) { + await self.close() + self.onerror.emit(new Error("No connection. Retrying.")) + await self.connect() + } + }, this.opt.watchdogInterval || Constants.WatchDogInterval) + await self.connect() + } + + /** + * Indicates if the MQTT client is started + * and running. + * @returns + */ + public running() { + return !!this.watchdogId + } + + /** + * Close connection and stop watchdog. + */ + public async stop() { + clearInterval(this.watchdogId) + this.watchdogId = undefined + await this.close() + } + + /** + * Attempts to connect to the MQTT broker + * @returns + */ + private async connect(): Promise { + if (this.readyState !== MQTTState.Closed) return + + const self = this + this.readyState = MQTTState.Connecting + this.log(\`socket connecting to \${this.opt.host}:\${this.opt.port}\`) + + try { + this.socket = await connect(this.opt) + this.socket.onmessage.subscribe(async () => { + const msg = await self.socket?.recv() + self.trace(\`recv \${msg.length}b \${msg.toString("hex")}\`) + await self.handleMessage(msg) + }) + this.socket.onerror.subscribe(err => { + self.log("error") + self.onerror.emit(err) + }) + this.socket.onclose.subscribe(() => { + self.log("Close.") + self.onclose.emit(undefined) + self.readyState = MQTTState.Closed + self.socket = null + }) + self.log(\`socket opened, connecting \${self.opt.clientId} to broker\`) + this.readyState = MQTTState.Open + await self.send(createConnect(self.opt)) + await wait(this.onconnect, self.opt.timeout) + } catch (e) { + this.onerror.emit(e as Error) + await this.close() + } + } + + private async canSend() { + let cnt = 0 + while (true) { + if (this.readyState === MQTTState.Connected) { + this.readyState = MQTTState.Sending + return true + } + if (cnt++ < 100 && this.readyState === MQTTState.Sending) + await delay(20) + else { + this.log("drop pk, still sending previous message") + return false + } + } + } + + private doneSending() { + if (this.readyState === MQTTState.Sending) + this.readyState = MQTTState.Connected + } + + /** + * Attempts to publish a message on the MQTT stack + * @param topic topic of the message + * @param message payload as string, object that will be JSON serialized or buffer + * @param qos + * @param retained + * @returns + */ + public async publish( + topic: string, + message?: string | object | Buffer, + qos: number = Constants.DefaultQos, + retained: boolean = false + ): Promise { + if (!(await this.canSend())) return false + const buf: Buffer = + typeof message === "string" + ? Buffer.from(message) + : message instanceof Buffer + ? message + : Buffer.from(JSON.stringify(message)) + message = null + const messageLen = buf ? buf.length : 0 + this.trace(\`publish: \${topic} \${messageLen}b\`) + await this.send(createPublishHeader(topic, messageLen, qos, retained)) + if (buf) await this.send(buf) + this.doneSending() + return true + } + + /** + * Subscribe to a MQTT topic and returns an observable + * @param topic + * @param handler optional handler to attach + * @param qos + * @returns observable for topic messages + */ + public async subscribe( + topic: string, + handler: (msg: MQTTMessage) => AsyncVoid = undefined, + qos: number = Constants.DefaultQos + ): Promise> { + this.log(\`subscribe: \${topic}\`) + const sub = createSubscribe(topic, qos) + if (topic[topic.length - 1] === "#") + topic = topic.slice(0, topic.length - 1) + const o = register() + if (handler) o.subscribe(handler) + const h = new MQTTHandler(sub, topic, o) + this.mqttHandlers.push(h) + await this.send1(sub) + return o + } + + private async send(data: Buffer): Promise { + if (this.socket) { + this.trace(\`send \${data.length}b \${data.toString("hex")}\`) + await this.socket.send(data) + } + } + + private async handleMessage(data: Buffer) { + if (this.buf) data = this.buf.concat(data) + this.buf = data + if (data.length < 2) return + let len = data[1] + let payloadOff = 2 + if (len & 0x80) { + if (data.length < 3) return + if (data[2] & 0x80) { + this.onerror.emit(new Error(\`too large packet.\`)) + this.buf = null + return + } + len = (data[2] << 7) | (len & 0x7f) + payloadOff++ + } + + const payloadEnd = payloadOff + len + if (data.length < payloadEnd) return // wait for the rest of data + + this.buf = null + + const cmd = data[0] + const controlPacketType: MQTTControlPacketType = cmd >> 4 + // this.emit('debug', \`Rcvd: \${controlPacketType}: '\${data}'.\`); + + const payload = data.slice(payloadOff, payloadEnd) + switch (controlPacketType) { + case MQTTControlPacketType.ConnAck: + const returnCode: number = payload[1] + if (returnCode === MQTTConnectReturnCode.Accepted) { + const self = this + this.log("MQTT connection accepted.") + this.readyState = MQTTState.Connected + this.onconnect.emit(undefined) + clearInterval(this.pingId) + this.pingId = setInterval( + async () => await self.ping(), + self.opt.pingInterval || Constants.PingInterval + ) + for (const sub of this.mqttHandlers) + await this.send1(sub.header) + } else { + const connectionError: string = + MQTTClient.describe(returnCode) + this.log("MQTT connection error: " + connectionError) + this.onerror.emit(new Error(connectionError)) + await this.close() + } + break + case MQTTControlPacketType.Publish: + const message: MQTTMessage = parsePublish(cmd, payload) + this.trace(\`incoming: \${message.topic}\`) + let handled = false + let cleanup = false + if (this.mqttHandlers.length) { + for (let h of this.mqttHandlers) + if ( + message.topic.slice(0, h.topic.length) === h.topic + ) { + await h.obs.emit(message) + handled = true + if (h.status === HandlerStatus.Once) { + h.status = HandlerStatus.ToRemove + cleanup = true + } + } + if (cleanup) + this.mqttHandlers = this.mqttHandlers.filter( + h => h.status !== HandlerStatus.ToRemove + ) + } + if (!handled) this.onunhandledmessage.emit(message) + if (message.qos > 0) { + const self = this + setTimeout(async () => { + await self.send1(createPubAck(message.pid || 0)) + }, 0) + } + break + case MQTTControlPacketType.PingResp: + this.trace("ping resp") + break + case MQTTControlPacketType.PubAck: + this.trace("pub ack") + break + case MQTTControlPacketType.SubAck: + this.trace("sub ack") + break + default: + this.onerror.emit( + new Error(\`unexpected packet type: \${controlPacketType}.\`) + ) + break + } + + if (data.length > payloadEnd) + await this.handleMessage(data.slice(payloadEnd)) + } + + private async send1(msg: Buffer) { + if (await this.canSend()) { + await this.send(msg) + this.doneSending() + return true + } + return false + } + + private async ping() { + await this.send1(createPingReq()) + //this.emit("debug", "Sent: Ping request.") + } +} + +/** + * Opens a MQTT client connection + * @param options connection options + * @returns connected MQTT client + */ +export async function startMQTTClient(options: MQTTConnectOptions) { + const mqtt = new MQTTClient(options) + await mqtt.start() + return mqtt +} +`, + "net/src/sockets.ts": `import * as ds from "@devicescript/core" + +type SocketEvent = "open" | "close" | "data" | "error" +type DsSockets = typeof ds & { + _socketOpen(host: string, port: number): number + _socketClose(): number + _socketWrite(buf: Buffer | string): number + _socketOnEvent(event: SocketEvent, arg?: Buffer | string): void +} + +let socket: Socket + +export type SocketProto = "tcp" | "tls" + +export interface SocketConnectOptions { + host: string + port: number + proto?: SocketProto + timeout?: number +} + +export class Socket { + private buffers: Buffer[] = [] + private lastError: Error + private closed: boolean + private emitter = ds.emitter() + + public readonly onopen = ds.emitter() + public readonly onclose = ds.emitter() + public readonly onerror = ds.emitter() + public readonly onmessage = ds.emitter() + + private constructor(public name: string) {} + + private error(msg: string): Error { + return new Error(\`socket \${this.name}: \${msg}\`) + } + + private check() { + if (this !== socket) throw this.error(\`old socket used\`) + } + + /** + * Attempt to close the current socket. + */ + async close() { + if (this === socket) { + const _r = (ds as DsSockets)._socketClose() + // ignore errors + socket = null + } + } + + /** + * Receive next bit of data from the socket. + * @param timeout in ms, defaults to Infinity + * @returns Buffer or \`undefined\` on timeout or \`null\` when socket is closed + */ + async recv(timeout?: number) { + for (;;) { + if (this.buffers.length) { + const r = this.buffers.shift() + return r + } + if (this.lastError) throw this.lastError + if (this.closed) return null + const v = await ds.wait(this.emitter, timeout) + if (v === undefined) return undefined + } + } + + async readLine(): Promise { + let bufs: Buffer[] = [] + for (;;) { + const b = await this.recv() + if (b == null) break + let nlPos = b.indexOf(10) + if (nlPos >= 0) { + const rest = b.slice(nlPos + 1) + if (rest.length) this.buffers.unshift(rest) + if (nlPos > 0 && b[nlPos - 1] === 13) nlPos-- + bufs.push(b.slice(0, nlPos)) + break + } + bufs.push(b) + } + if (bufs.length === 0) return null + const r = Buffer.concat(...bufs) + return r.toString("utf-8") + } + + /** + * Send given buffer over the socket. + * Throws when connection is closed or there is an error. + */ + async send(buf: Buffer | string) { + for (;;) { + this.check() + const r = (ds as DsSockets)._socketWrite(buf) + if (r === 0) break + if (r === -1) await ds.sleep(10) + throw this.error(\`send error \${r}\`) + } + } + + private finish(msg: string) { + if (msg !== null) this.lastError = this.error(msg) + this.closed = true + socket = null + this.emitter.emit(false) + } + + static _socketOnEvent(event: SocketEvent, arg?: Buffer | string) { + if (event !== "data") console.debug("socket", socket?.name, event, arg) + + if (!socket) return + + const s = socket + switch (event) { + case "open": + s.emitter.emit(true) + s.onopen.emit(undefined) + break + case "close": + s.finish(null) + s.onclose.emit(undefined) + break + case "error": + s.finish(arg + "") + s.onerror.emit(new Error(arg + "")) + break + case "data": + s.buffers.push(arg as Buffer) + s.emitter.emit(false) + s.onmessage.emit(undefined) + break + default: + console.warn("unknown event", event) + } + } + + static async _connect(options: SocketConnectOptions) { + let { host, port, proto } = options + if (!proto) proto = "tcp" + const port2 = proto === "tls" ? -port : port + ;(ds as DsSockets)._socketOnEvent = Socket._socketOnEvent + socket?.finish("terminated") + const sock = new Socket(\`\${proto}://\${host}:\${port}\`) + socket = sock + console.debug(\`connecting to \${socket.name}\`) + const r = (ds as DsSockets)._socketOpen(options.host, port2) + if (r !== 0) { + const e = sock.error(\`can't connect: \${r}\`) + socket = null + throw e + } + const v = await ds.wait(sock.emitter, options.timeout || 30000) + if (sock.lastError) throw sock.lastError + if (v === undefined) throw sock.error("Timeout") + ds.assert(!socket?.closed) + ds.assert(v === true) + return socket + } +} + +/** + * Create a new socket and connect it. + * Throws on error or timeout. + * @param options socket connection options + */ +export async function connect(options: SocketConnectOptions) { + return await Socket._connect(options) +} +`, + "net/src/url.ts": `function invalidURL(url: string): never { + throw new TypeError(\`invalid url: '\${url}'\`) +} + +function split2(str: string, ch: string): [string, string] { + const idx = str.indexOf(ch) + if (idx >= 0) { + return [str.slice(0, idx), str.slice(idx + 1)] + } else { + return [str, ""] + } +} + +export class URL { + protocol: string // 'https:', + username = "" // 'user' + password = "" // 'pass' + hostname: string // 'sub.example.com' + port: string // '8080' + pathname: string // '/p/a/t/h' + search = "" // '?query=string', + hash = "" // '#hash' + + // 'sub.example.com:8080' + host() { + if (this.port) return this.hostname + ":" + this.port + return this.hostname + } + + // '/p/a/t/h?query=string', + path() { + return this.pathname + this.search + } + + // 'https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash', + href() { + let cred = "" + if (this.password) cred = \`\${this.username}:\${this.password}@\` + else if (this.username) cred = \`\${this.username}@\` + return \`\${this.protocol}//\${cred}\${this.host()}\${this.pathname}\${ + this.search + }\${this.hash}\` + } + + constructor(input: string | URL) { + if (typeof input !== "string") input = input.href() + + let url = input + + { + const [schema, rest] = split2(input, ":") + if (!rest) invalidURL(input) + this.protocol = schema + ":" + url = rest + } + + { + let ptr = 0 + while (url[ptr] === "/") ptr++ + url = url.slice(ptr) + } + + { + let slash = url.indexOf("/") + let at = url.indexOf("@") + if (at >= 0 && (slash < 0 || at < slash)) { + const [user, pass] = split2(url.slice(0, at), ":") + url = url.slice(at + 1) + this.username = user + this.password = pass + } + } + + const [host, afterHost] = split2(url, "/") + + const [hostname, port] = split2(host, ":") + this.hostname = hostname + this.port = port + + if (afterHost.includes("?")) { + const [path, afterPath] = split2(afterHost, "?") + this.pathname = "/" + path + const [search, hash] = split2(afterPath, "#") + if (search) this.search = "?" + search + if (hash) this.hash = "#" + hash + } else { + const [path, hash] = split2(afterHost, "#") + this.pathname = "/" + path + if (hash) this.hash = "#" + hash + } + } +} +`, + "observables/package.json": `{ + "name": "@devicescript/observables", + "version": "2.15.6", + "main": "./src/index.ts", + "description": "DeviceScript package sample implementing the famous cow say rendering engine.", + "license": "MIT", + "keywords": [ + "devicescript", + "jacdac", + "iot", + "embedded" + ], + "author": "Microsoft", + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/observables" + }, + "private": true, + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "scripts": { + "setup": "devicescript init", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts -F allFunctions", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "publishConfig": { + "access": "public" + } +} +`, + "observables/src/aggregate.ts": `import { Observable, OperatorFunction } from "./observable" + +/** + * Applies an accumulator function over the source Observable, + * and returns the accumulated result when the source completes, + * given an optional seed value. + */ +export function reduce( + accumulator: (acc: A, value: T, index: number) => A, + seed?: A +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + let prev: A = seed + let index = 0 + return source.subscribe({ + error, + complete: async () => { + await next(prev) + await complete() + }, + next: async curr => { + prev = accumulator(prev, curr, index++) + }, + }) + }) + } +} +`, + "observables/src/creation.ts": `import { Observable } from "./observable" + +/** + * Converts an array into a sequence of values + * @param values + * @returns + */ +export function from(values: T[]) { + return new Observable(observer => { + const work = async () => { + const { next, complete } = observer + if (values) for (const value of values) await next(value) + await complete() + } + work.start() + }) +} + +/** + * Creates an Observable that emits sequential numbers every specified interval of time. + * @param millis milliseconds + */ +export function interval(millis: number): Observable { + return new Observable(observer => { + const { next } = observer + let count = 0 + const timer = setInterval(async () => { + await next(count++) + }, millis) + return () => { + clearInterval(timer) + } + }) +} + +/** + * Creates an observable that will wait for a specified time period before emitting the number 0. + * @param millis milliseconds + */ +export function timer(millis: number): Observable<0> { + return new Observable<0>(observer => { + const { next, complete } = observer + const timer = setTimeout(async () => { + await next(0) + await complete() + }, millis) + return () => { + clearTimeout(timer) + } + }) +} + +/** + * Checks a boolean at subscription time, and chooses between one of two observable sources + */ +export function iif( + condition: () => boolean, + trueResult: Observable, + falseResult: Observable +): Observable { + return new Observable(observer => { + const c = condition() + const obs = c ? trueResult : falseResult + return obs.subscribe(observer) + }) +} +`, + "observables/src/dsp.ts": `import { Observable, OperatorFunction } from "./observable" +import { scan } from "./transform" + +/** + * Exponentially weighted moving average + * @param gain The parameter decides how important the current observation is in the calculation of the EWMA. The higher the value of alpha, the more closely the EWMA tracks the original time series. + * @param seed starting value if any + * @returns + */ +export function ewma( + gain: number = 0.2, + seed: number = undefined +): OperatorFunction { + gain = Math.max(0, Math.min(1, gain)) + const onegain = 1 - gain + return scan( + (prev, curr) => + prev === undefined ? curr : prev * onegain + curr * gain, + seed + ) +} + +/** + * Finite impulse response filter + * @param coefficients array of filter coefficient + * @param gain optional gain, otherwise computed from the coefficients + */ +export class FIR { + private readonly values: number[] = [] + private k: number = 0 + + constructor( + private readonly coefficients: number[], + private readonly gain: number + ) { + if (this.gain === undefined) { + this.gain = 0 + const n = this.coefficients.length + for (let i = 0; i < n; ++i) this.gain += this.coefficients[i] + } + } + + /** + * Applies the value in the filter + * @param value new value + * @returns filtered value + */ + process(value: number) { + // initial with first value + const n = this.coefficients.length + if (this.values.length === 0) + for (let i = 0; i < n; ++i) this.values.push(value) + // update new value + let output = 0 + this.values[this.k] = value + for (let i = 0; i < n; ++i) { + const vi = (i + this.k) % n + output += this.coefficients[i] * this.values[vi] + } + this.k = (this.k + 1) % n + output = output / this.gain + return output + } +} + +/** + * Finite impulse response filter + * @param coefficients array of filter coefficient + * @param gain optional gain, otherwise computed from the coefficients + */ +export function fir( + coefficients: number[], + gain?: number +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + const filter = new FIR(coefficients, gain) + return source.subscribe({ + error, + complete, + next: async value => await next(filter.process(value)), + }) + }) + } +} + +/** + * Rolling average filter (FIR filtering with all coefficients set to 1) + * @param windowLength number of samples + * @returns + */ +export function rollingAverage( + windowLength: number +): OperatorFunction { + const coefficients = [] + for (let i = 0; i < windowLength; ++i) coefficients[i] = 1 + return fir(coefficients) +} + +/** + * Measures and thresholds stream into low/mid/high threshold levels. + * @param lowThreshold lower threshold + * @param highThreshold higher threshold + * @returns -1 if low, 0 if mid, 1 if high + */ +export function levelDetector( + lowThreshold: number, + highThreshold: number, + options?: { + // number of samples to make up a level detection window + windowSize?: number + } +): OperatorFunction { + const windowSize = Math.max(1, options?.windowSize || 1) + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + + let oldLevel: number = undefined + let windowPosition = 0 + let sigma = 0 + + return source.subscribe({ + error, + complete, + next: async value => { + sigma += value + windowPosition++ + + if (windowPosition >= windowSize) { + const levelValue = sigma / windowSize + sigma = 0 + windowPosition = 0 + + const level = + levelValue < lowThreshold + ? -1 + : levelValue > highThreshold + ? 1 + : 0 + if (level !== oldLevel) { + oldLevel = level + await next(level) + } + } + }, + }) + }) + } +} +`, + "observables/src/error.ts": `import { AsyncValue } from "@devicescript/core" +import { Observable, OperatorFunction, unusbscribe } from "./observable" + +/** + * It only listens to the error channel and ignores notifications. Handles errors from the source observable, and maps them to a new observable. + * The error may also be rethrown, or a new error can be thrown to emit an error from the result. + */ +export function catchError( + selector: (err: any, caught: Observable) => Observable +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { next, complete } = observer + + let unsub = source.subscribe({ + next, + error: async e => { + unsub = unusbscribe(unsub) + + // get follow-up observable + const errorSource = selector(e, source) + + // wire up error source to the output + unsub = await errorSource.subscribe(observer) + }, + complete, + }) + + return () => { + unusbscribe(unsub) + } + }) + } +} +`, + "observables/src/filter.ts": `import * as ds from "@devicescript/core" +import { + identity, + Observable, + OperatorFunction, + unusbscribe, +} from "./observable" + +/** + * An operator that filters values + * @param condition + * @returns + */ +export function filter( + condition: (value: T, index: number) => ds.AsyncBoolean +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { next, error, complete } = observer + let index = 0 + return source.subscribe({ + error, + complete, + next: async v => { + const c = await condition(v, index++) + if (c) await next(v) + }, + }) + }) + } +} + +/** + * Emits a notification from the source Observable + * only after a particular time span has passed without another source emission. + */ +export function debounceTime(duration: number): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + let timer: number + const unsub = source.subscribe({ + error, + complete, + next: value => { + // reset timer again + clearTimeout(timer) + timer = setTimeout(async () => { + // done waiting, pass it on + timer = undefined + await next(value) + }, duration) + }, + }) + + return () => { + unusbscribe(unsub) + clearTimeout(timer) + } + }) + } +} + +/** + * Emits a value from the source Observable, + * then ignores subsequent source values for duration milliseconds, then repeats this process. + */ +export function throttleTime(duration: number): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + let timer: number + const unsub = source.subscribe({ + error, + complete, + next: async value => { + // ignore while timer active + if (timer !== undefined) return + // start debounce timer + timer = setTimeout(async () => { + clearTimeout(timer) + timer = undefined + }, duration) + // pass value + await next(value) + }, + }) + + // clean up: stop timer + return () => { + unusbscribe(unsub) + clearTimeout(timer) + } + }) + } +} + +/** + * Ignores source values for duration milliseconds, + * then emits the most recent value from the source Observable, then repeats this process + */ +export function auditTime(duration: number): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + let timer: number + let lastValue: T = undefined + const unsub = source.subscribe({ + error, + complete, + next: async value => { + lastValue = value + // ignore while timer active + if (timer !== undefined) return + // start debounce timer + timer = setTimeout(async () => { + clearTimeout(timer) + timer = undefined + const lv = lastValue + lastValue = undefined + // pass last value + await next(lv) + }, duration) + }, + }) + + // clean up: stop timer + return () => { + unusbscribe(unsub) + clearTimeout(timer) + } + }) + } +} + +function equality(l: T, r: T) { + return l === r +} + +/** + * Returns a result Observable that emits all values pushed by the source observable + * if they are distinct in comparison to the last value the result observable emitted. + */ +export function distinctUntilChanged( + comparator?: (left: K, right: K) => boolean, + keySelector: (value: T) => K = identity as (value: T) => K +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + let lastKey: K + let hasFirst = false + const eq = comparator || equality + return source.subscribe({ + error, + complete, + next: async value => { + const key = keySelector(value) + if (!hasFirst || !eq(lastKey, key)) { + hasFirst = true + lastKey = key + await next(value) + } + }, + }) + }) + } +} + +/** + * Filters numerical data stream within change threshold + * @param value + * @returns + */ +export function threshold( + value: number, + keySelector: (value: T) => number = identity as (value: T) => number +): OperatorFunction { + return distinctUntilChanged( + (l, r) => Math.abs(l - r) < value, + keySelector + ) +} +`, + "observables/src/index.ts": `export * from "./observable" +export * from "./value" +export * from "./pipe" +export * from "./creation" +export * from "./transform" +export * from "./filter" +export * from "./aggregate" +export * from "./utility" +export * from "./join" +export * from "./dsp" +export * from "./error" +`, + "observables/src/join.ts": `import { interval } from "./creation" +import { + Observable, + Subscription, + unusbscribe, + wrapSubscriptions, +} from "./observable" + +/** + * Collects the latest values of observables when the closing observable emits. + * @param observables + * @param closingObservable + * @returns + */ +export function collect< + TObservables extends Record> +>( + observables: TObservables, + closingObservable: Observable, + options?: { + /** + * Clears the accumulated values after emitting + */ + clearValuesOnEmit?: boolean + } +): Observable>> { + const { clearValuesOnEmit } = options || {} + return new Observable>>( + observer => { + const { next, error, complete } = observer + + let values: Partial> = {} + const assign = (name: string) => (v: unknown) => { + values[name as keyof TObservables] = v + } + const unsubs: Subscription[] = [] + for (const name of Object.keys(observables)) { + const unsub = observables[name].subscribe({ + error, + next: assign(name), + }) + unsubs.push(unsub) + } + unsubs.push( + closingObservable.subscribe({ + error, + complete, + next: async () => { + const res = values + if (clearValuesOnEmit) values = {} + await next(res) + }, + }) + ) + return wrapSubscriptions(unsubs) + } + ) +} + +/** + * Collects the latest values of observables when the closing observable emits. + * @param observables + * @param closingObservable + * @returns + */ +export function collectTime< + TObservables extends Record> +>( + observables: TObservables, + duration: number, + options?: { + /** + * Clears the accumulated values after emitting + */ + clearValuesOnEmit?: boolean + } +): Observable>> { + return collect(observables, interval(duration), options) +} + +/** + * Returns an observable that mirrors the first source observable to emit an item. + */ +export function race(...sources: Observable[]) { + if (sources?.length === 1) return sources[0] + + return new Observable(observer => { + const { next, error, complete } = observer + + const unsubs: Subscription[] = [] + sources.forEach(src => { + const unsub = src.subscribe({ + error, + complete, + next: async value => { + // cancel all other sources + if (unsubs.length > 1) { + let j = 0 + while (j < unsubs.length) { + if (unsubs[j] !== unsub) { + unusbscribe(unsubs[j]) + unsubs.insert(j, -1) + } else j++ + } + } + // send next value + await next(value) + }, + }) + unsubs.push(unsub) + }) + return wrapSubscriptions(unsubs) + }) +} +`, + "observables/src/main.ts": `import * as ds from "@devicescript/core" +import { describe, test, expect } from "@devicescript/test" +import { reduce } from "./aggregate" +import { from, iif, interval } from "./creation" +import { ewma, fir, levelDetector, rollingAverage } from "./dsp" +import { catchError } from "./error" +import { threshold, filter, distinctUntilChanged } from "./filter" +import { collect, collectTime } from "./join" +import { Observable, Subscription, unusbscribe } from "./observable" +import { map, scan, switchMap, timestamp } from "./transform" +import { tap } from "./utility" +import { register } from "./value" +const btn = new ds.Button() +const temp = new ds.Temperature() + +async function emits(o: Observable, sequence: T[]) { + let s: Subscription + const values: T[] = [] + try { + s = o.subscribe(v => { + values.push(v) + }) + let retry = 0 + while (values.length !== sequence.length && retry++ < 10) + await ds.sleep(10) + console.log({ values, sequence }) + expect(values.length).toBe(sequence.length) + for (let i = 0; i < values.length; ++i) { + expect(values[i]).toBe(sequence[i]) + } + } finally { + unusbscribe(s) + } +} + +async function emitsR( + o: Observable, + sequence: R[], + converter: (v: T) => R +) { + let s: Subscription + const values: T[] = [] + try { + s = o.subscribe(v => { + values.push(v) + }) + let retry = 0 + while (values.length !== sequence.length && retry++ < 10) + await ds.sleep(10) + expect(values.length).toBe(sequence.length) + for (let i = 0; i < values.length; ++i) { + expect(converter(values[i])).toBe(sequence[i]) + } + } finally { + unusbscribe(s) + } +} + +describe("creation", () => { + test("of", async () => { + const obs = from([1, 2, 3, 4, 5]) + obs.subscribe(v => console.log(v)) + }) + test("interval", async () => { + let obs = interval(100) + obs = tap(v => console.log(\`interval \${v}\`))(obs) + // start + let count = 0 + let res: number[] = [] + const unsub = obs.subscribe(() => { + console.log(\`next \${count}\`) + res.push(count) + if (count++ === 2) unusbscribe(unsub) + }) + // wait till done? + await ds.sleep(1000) + expect(res.length).toBe(3) + }) + test("iif,true", async () => { + const obs = iif(() => true, from([0, 1, 2]), from([-1, 2])) + await emits(obs, [0, 1, 2]) + }) + test("iif,false", async () => { + const obs = iif(() => false, from([0, 1, 2]), from([-1, 2])) + await emits(obs, [-1, 2]) + }) +}) + +describe("filter", () => { + test("filter", async () => { + let obs = from([1, 2, 3]) + obs = filter(x => x > 2)(obs) + obs = tap(v => console.log(v))(obs) + await emits(obs, [3]) + }) + test("distinctUntilChanged", async () => { + let obs = from([1, 2, 2, 3, 3, 3, 3]) + obs = distinctUntilChanged((x, y) => x === y)(obs) + obs = tap(v => console.log(v))(obs) + await emits(obs, [1, 2, 3]) + }) + test("threshold", async () => { + let obs = from([1, 2, 3, 6, 5, 0]) + obs = threshold(2)(obs) + obs = tap(v => console.log(v))(obs) + await emits(obs, [1, 3, 6, 0]) + }) +}) + +describe("transform", () => { + test("map", async () => { + let obs = from([1, 2, 3]) + obs = map(x => x * x)(obs) + obs = tap(v => console.log(v))(obs) + await emits(obs, [1, 4, 9]) + }) + test("scan", async () => { + let obs = from([1, 2, 3]) + obs = scan((x, v) => x + v, 0)(obs) + obs = tap(v => console.log(v))(obs) + await emits(obs, [1, 3, 6]) + }) + test("timestamp", async () => { + let obs = from([1, 2, 3]) + obs = scan((x, v) => x + v, 0)(obs) + let obs2 = timestamp()(obs) + obs2 = tap<{ value: number; time: number; lastTime: number }>(v => + console.log(v) + )(obs2) + await emitsR( + obs2, + [1, 3, 6], + (v: { value: number; time: number; lastTime: number }) => v.value + ) + }) +}) + +describe("aggregate", () => { + test("reduce", async () => { + let obs = from([1, 2, 3]) + obs = reduce((p, x) => p + x, 0)(obs) + obs = tap(v => console.log(v))(obs) + await emits(obs, [6]) + }) +}) + +describe("join", () => { + test("collect", async () => { + let obs = collect( + { + a: from([0, 1, 2]), + b: from([4, 5, 6]), + }, + interval(50) + ) + const unsub = await obs.subscribe(({ a, b }) => + console.log(\`collect: a: \${a}, b: \${b}\`) + ) + await ds.sleep(100) + unsub.unsubscribe() + }) + test("collectTime", async () => { + let obs = collectTime( + { + a: from([0, 1, 2]), + b: from([4, 5, 6]), + }, + 50 + ) + const unsub = await obs.subscribe(({ a, b }) => + console.log(\`collecttime: a: \${a}, b: \${b}\`) + ) + await ds.sleep(100) + unsub.unsubscribe() + }) +}) + +describe("pipe", () => { + test("of filter", async () => { + const obs = from([1, 2, 3]).pipe( + filter(x => x > 2), + tap(v => console.log(v)) + ) + await emits(obs, [3]) + }) + test("of filter filter", async () => { + const obs = from([1, 2, 3, 4, 5]).pipe( + filter(x => x > 2), + tap(v => console.log(v)), + filter(x => x < 4), + tap(v => console.log(v)) + ) + await emits(obs, [3]) + }) +}) + +describe("dsp", () => { + test("emwa", async () => { + const a = [1, 2] + const obs = from(a).pipe(ewma()) + await emits(obs, [1, 1 * 0.8 + 2 * 0.2]) + }) + test("fir", async () => { + const a = [1, 2] + const obs = from(a).pipe(fir([1, 1])) + await emits(obs, [1, 1 / 2 + 2 / 2]) + }) + test("ravg", async () => { + const a = [1, 2] + const obs = from(a).pipe(rollingAverage(2)) + await emits(obs, [1, 1 / 2 + 2 / 2]) + }) + test("levelDetector", async () => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1] + const obs = from(a).pipe(levelDetector(2, 5)) + await emits(obs, [-1, 0, 1, -1]) + }) +}) + +describe("value", () => { + test("emit", async () => { + const obs = register(0) + const res: number[] = [] + await obs.subscribe(v => { + res.push(v) + }) + await obs.emit(1) + await obs.emit(2) + await obs.emit(3) + expect(res.length).toBe(3) + expect(res[0]).toBe(1) + expect(res[1]).toBe(2) + expect(res[2]).toBe(3) + }) +}) + +describe("error", () => { + test("subscribe", async () => { + const obs = new Observable(observer => { + throw Error("error") + }) + let error = 0 + await obs.subscribe({ + error: () => { + error++ + }, + }) + await ds.sleep(10) + expect(error).toBe(1) + }) + test("map", async () => { + const obs = from([0, 1, 2]).pipe( + map(v => { + throw new Error() + }) + ) + let error = 0 + await obs.subscribe({ + error: () => { + error++ + }, + }) + await ds.sleep(10) + expect(error).toBe(1) + }) + test("map,tap,filter", async () => { + const obs = from([0, 1, 2]).pipe( + filter(v => v > 1), + tap(v => console.log(v)), + map(v => { + throw new Error() + }) + ) + let error = 0 + await obs.subscribe({ + error: () => { + error++ + }, + }) + await ds.sleep(10) + expect(error).toBe(1) + }) + test("catchError,map", async () => { + const obs = from([0, 1, 2]).pipe( + map(() => { + throw new Error() + }), + catchError(e => { + return from([5]) + }) + ) + await ds.sleep(50) + await emits(obs, [5]) + }) + test("catchError", async () => { + const obs = from([0, 1, 2]).pipe( + map(() => { + throw new Error() + }), + catchError(e => { + return from([5]) + }) + ) + await ds.sleep(100) + await emits(obs, [5]) + }) + test("switchMap", async () => { + const obs = from([0, 1, 2]).pipe( + switchMap(v => from([v + 1, v + 1, v + 1])) + ) + await ds.sleep(100) + await emits(obs, [3, 3, 3]) + }) +}) +`, + "observables/src/observable.ts": `import * as ds from "@devicescript/core" +import { AsyncVoid } from "@devicescript/core" + +// https://github.com/keithamus/mini-observable +// + some rxjs + +export interface Subscription { + closed?: boolean + unsubscribe: () => void +} +export type UnaryFunction = (source: T) => R +export type ObserverStart = (subscription: Subscription) => void +/** + * Promise.then is not supported in DeviceScript, + * therefore we need to be able to avoid next + */ +export type ObserverNext = (value: T) => AsyncVoid +export type ObserverError = (error: Error) => AsyncVoid +export type ObserverComplete = () => AsyncVoid + +export interface SubscriptionObserver { + closed: boolean + error: ObserverError + complete: ObserverComplete + next: ObserverNext +} + +export interface OptionalObserver { + start?: ObserverStart + error?: ObserverError + complete?: ObserverComplete + next?: ObserverNext +} + +export type SloppyObserver = OptionalObserver | ObserverNext + +export type SubscriberFunction = ( + observer: SubscriptionObserver +) => Subscription | ds.Unsubscribe | void + +export class Observable { + constructor(private readonly subscriber: SubscriberFunction) {} + + subscribe(observer: SloppyObserver): Subscription { + const { subscriber } = this + let start: ObserverStart + let next: ObserverNext + let error: ObserverError + let complete: ObserverComplete + + if (typeof observer === "function") { + next = observer + } else { + start = observer.start + next = observer.next + error = observer.error + complete = observer.complete + } + let cleanup: () => void + let closed = false + const wrapClosedSync = + (fn: (value: any) => void): (() => void) => + (v?: any) => { + if (!closed && fn) fn(v) + } + const unsubscribeSync = wrapClosedSync(() => { + closed = true + if (cleanup) cleanup() + }) + + // next, complete async + const wrapClosedAsync = + (fn: (value: any) => AsyncVoid): (() => Promise) => + async (v?: any) => { + if (!closed && fn) await fn(v) + } + const wrapUnsubscribeAsync = + (fn: (value: any) => AsyncVoid): (() => Promise) => + async (v?: any) => { + unsubscribeSync() + if (fn) await fn(v) + } + const wrapTryAsync = + (fn: (value: T) => AsyncVoid): (() => Promise) => + async (v?: T) => { + try { + await fn(v) + } catch (e) { + await error(e as Error) + } + } + error = wrapClosedAsync(wrapUnsubscribeAsync(error)) + complete = wrapClosedAsync(wrapTryAsync(wrapUnsubscribeAsync(complete))) + next = wrapClosedAsync(wrapTryAsync(next)) + + let subscription: Subscription = { + closed, + unsubscribe: unsubscribeSync, + } + if (start) start(subscription) + if (closed) return subscription + const sub = () => { + const wrappedObserver: SubscriptionObserver = { + closed, + error, + complete, + next, + } + // might unwrap an async function + const c = subscriber(wrappedObserver) + if (c && typeof c === "function") cleanup = c + else if ( + c && + typeof c === "object" && + typeof c.unsubscribe === "function" + ) { + cleanup = c.unsubscribe + } + } + try { + sub() + } catch (e) { + error.start(e) + } + return subscription + } + + pipe(op1: OperatorFunction): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction, + op9: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction, + op9: OperatorFunction, + ...operations: OperatorFunction[] + ): Observable + pipe(...operations: OperatorFunction[]): Observable { + return operations.length ? pipeFromArray(operations)(this) : this + } +} + +/** + * Wraps an existing subscriptions into a single subscription + * @param subscription + * @param cleanup + */ +export function wrapSubscriptions(subscriptions: Subscription[]): Subscription { + const r = { + closed: false, + unsubscribe: () => { + r.closed = true + subscriptions.forEach(s => unusbscribe(s)) + }, + } + return r +} + +/** + * Safe wrapper to unsubscribe a subscription + * @param subscription + * @returns undefined value + */ +export function unusbscribe(subscription: Subscription): Subscription { + if (subscription && !subscription.closed && subscription.unsubscribe) { + subscription.unsubscribe() + } + return undefined +} + +export type OperatorFunction = ( + observable: Observable +) => Observable + +export function identity(x: T): T { + return x +} + +export function pipeFromArray( + fns: Array> +): UnaryFunction { + if (!fns || !fns.length) { + return identity as UnaryFunction + } + if (fns.length === 1) { + return fns[0] + } + return function piped(input: T): R { + return fns.reduce( + (prev: any, fn: UnaryFunction) => fn(prev), + input as any + ) + } +} +`, + "observables/src/pipe.ts": `import * as ds from "@devicescript/core" +import { Observable, OperatorFunction, pipeFromArray } from "./observable" + +declare module "@devicescript/core" { + interface Register { + pipe(op1: OperatorFunction): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction, + op9: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction, + op9: OperatorFunction, + ...operations: OperatorFunction[] + ): Observable + pipe(...operations: OperatorFunction[]): Observable + } +} + +ds.Register.prototype.pipe = function pipe( + ...operations: OperatorFunction[] +): Observable { + const _this = this + const obs = new Observable(observer => { + const { next } = observer + return _this.subscribe(async v => await next(v)) + }) + return operations.length ? pipeFromArray(operations)(obs) : obs +} + +declare module "@devicescript/core" { + interface Event { + pipe(op1: OperatorFunction): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction, + op9: OperatorFunction + ): Observable + pipe( + op1: OperatorFunction, + op2: OperatorFunction, + op3: OperatorFunction, + op4: OperatorFunction, + op5: OperatorFunction, + op6: OperatorFunction, + op7: OperatorFunction, + op8: OperatorFunction, + op9: OperatorFunction, + ...operations: OperatorFunction[] + ): Observable + pipe(...operations: OperatorFunction[]): Observable + } +} + +ds.Event.prototype.pipe = function pipe( + ...operations: OperatorFunction[] +): Observable { + const _this = this + const obs = new Observable(observer => { + const { next } = observer + return _this.subscribe(async v => await next(v)) + }) + return operations.length ? pipeFromArray(operations)(obs) : obs +} +`, + "observables/src/transform.ts": `import { AsyncValue, millis } from "@devicescript/core" +import { interval } from "./creation" +import { + Observable, + OperatorFunction, + Subscription, + wrapSubscriptions, +} from "./observable" + +/** + * An observable operator that contains streamed values. + * @param converter function to converts the observed value into a new value + * @returns observable operator to be used in pipe + */ +export function map( + converter: (value: T, index: number) => R | Promise +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { next, error, complete } = observer + let index = 0 + return source.subscribe({ + error, + complete, + next: async value => { + const r = await converter(value, index++) + await next(r) + }, + }) + }) + } +} + +/** + * Expands value with timestamp and last timestamp. + * @param converter + * @returns an observable operator to be used in pipe + */ +export function timestamp(): OperatorFunction< + T, + { + /** + * Observable value + */ + value: T + /** + * Current time in milliseconds + */ + time: number + /** + * Time of the last value in milliseconds + */ + lastTime: number + } +> { + let lastTime: number = undefined + return map(async value => { + const time = millis() + if (lastTime === undefined) lastTime = time + const res = { value, time, lastTime } + lastTime = time + return res + }) +} + +/** + * Applies an accumulator (or "reducer function") to each value from the source. + */ +export function scan( + accumulator: (acc: A, value: T, index: number) => A | Promise, + seed?: A +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { error, next, complete } = observer + let prev: A = seed + let index = 0 + return source.subscribe({ + error, + complete, + next: async curr => { + prev = await accumulator(prev, curr, index++) + await next(prev) + }, + }) + }) + } +} + +/** + * An observable operator that collects samples in an array. + * @param length + * @returns + */ +export function buffer( + closingObservable: Observable +): OperatorFunction { + return function operator(source: Observable) { + return new Observable(observer => { + const { next, error, complete } = observer + let buffer: T[] = [] + + const closingUnsub = closingObservable.subscribe(async () => { + const res = buffer + buffer = [] + await next(res) + }) + const srcUnsub = source.subscribe({ + error, + complete, + next: (value: T) => { + buffer.push(value) + }, + }) + return wrapSubscriptions([closingUnsub, srcUnsub]) + }) + } +} + +/** + * An observable operator that collects samples during a given duration + * @param length + * @returns + */ +export function bufferTime(duration: number): OperatorFunction { + return buffer(interval(duration)) +} + +/** + * Takes a source Observable and calls transform(T) for each emitted value. + * Immediately subscribe to any Observable coming from transform(T), + * but in addition to this, will unsubscribe() from any prior Observables - + * so that there is only ever one Observable subscribed at any one time. + * @param transform + * @returns + */ +export function switchMap( + transform: (item: T) => Observable +): OperatorFunction { + let remaining = 0 + return function operator(source: Observable) { + return new Observable(observer => { + const { next, error, complete } = observer + let oldSubscription: Subscription + const unsub = source.subscribe({ + error, + next: value => { + remaining += 1 + // cancel previous observable + if (oldSubscription) { + remaining -= 1 + oldSubscription.unsubscribe() + } + // register to next observable + oldSubscription = transform(value)?.subscribe({ + error, + next, + complete: async () => { + remaining -= 1 + if (remaining === 0) { + await complete() + if (unsub) unsub?.unsubscribe() + } + }, + }) + }, + }) + return wrapSubscriptions([unsub, oldSubscription]) + }) + } +} +`, + "observables/src/utility.ts": `import { + identity, + Observable, + OperatorFunction, + OptionalObserver, + SloppyObserver, +} from "./observable" + +/** + * Used to perform side-effects for notifications from the source observable + */ +export function tap(tapper: SloppyObserver): OperatorFunction { + if (tapper === undefined) return identity + + const tapops: OptionalObserver = + typeof tapper === "function" ? { next: tapper } : tapper + + return function operator(source: Observable) { + return new Observable(observer => { + const { next, error, complete } = observer + const { + start: tapStart, + next: tapNext, + error: tapError, + complete: tapComplete, + } = tapops + + return source.subscribe({ + start: sub => { + if (tapStart) tapStart(sub) + }, + next: async value => { + if (tapNext) await tapNext(value) + await next(value) + }, + error: async e => { + if (tapError) await tapError(e) + await error(e) + }, + complete: async () => { + if (tapComplete) await tapComplete() + await complete() + }, + } as OptionalObserver) + }) + } +} +`, + "observables/src/value.ts": `import * as ds from "@devicescript/core" +import { + Observable, + SubscriberFunction, + SubscriptionObserver, +} from "./observable" + +/** + * An observable client-side register + */ +export class ObservableValue extends Observable { + private _value: T + private _subscriptions: ((value: T) => ds.AsyncVoid)[] + + /** + * @internal + */ + constructor( + subscriber: SubscriberFunction, + subscriptions: ((value: T) => ds.AsyncVoid)[], + value: T + ) { + super(subscriber) + this._subscriptions = subscriptions + this._value = value + } + + /** + * reads the current register value + **/ + async read() { + return this._value + } + + /** + * Emit a value and notify subscriptions + * @param newValue updated value + */ + async emit(newValue: T): Promise { + this._value = newValue + for (let i = 0; i < this._subscriptions.length; ++i) { + const next = this._subscriptions[i] + await next(newValue) + } + } +} + +/** + * Creates an observable client-side register, that allows to emit new values. + * @param value + * @returns + */ +export function register(value?: T) { + const subscriptions: ((value: T) => ds.AsyncVoid)[] = [] + const subscriber = (observer: SubscriptionObserver) => { + const { next } = observer + subscriptions.push(next) + return () => { + const i = subscriptions.indexOf(next) + if (i > -1) subscriptions.insert(i, 1) + } + } + return new ObservableValue(subscriber, subscriptions, value) +} +`, + "ros/package.json": `{ + "name": "@devicescript/ros", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/ros" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "ros/src/index.ts": `import * as ds from "@devicescript/core" + +class MessageBroker { + private subscriptions: { + topic: string + handler: (msg: any) => ds.AsyncVoid + }[] = [] + + /** + * Subscribes a topic, handler pair + * @param topic + * @param handler + */ + subscribe(topic: string, handler: (msg: any) => ds.AsyncVoid) { + if ( + !this.subscriptions.find( + s => s.topic === topic && s.handler === handler + ) + ) + this.subscriptions.push({ topic, handler }) + } + + /** + * Emits a topic message to the correspoding handlers + **/ + async emit(topic: string, msg: any) { + const subs = this.subscriptions.filter(s => s.topic === topic) + for (const sub of subs) { + const handler = sub.handler + await handler(msg) + } + } +} + +const ros = new ds.Ros() +ros.report().subscribe(handleReport) +let nodeName = ds.deviceIdentifier("self") +let broker: MessageBroker = new MessageBroker() + +/** + * Configures the ROS node information. + * @param nodeName + */ +export async function rosConfigure(name: string) { + if (name === nodeName) return // same device + + nodeName = name || ds.deviceIdentifier("self") + broker = new MessageBroker() +} + +async function handleReport(pkt: ds.Packet) { + if (pkt.isReport && pkt.serviceCommand === ds.RosCodes.ReportMessage) { + const [topic, src] = pkt.decode() + const msg = JSON.parse(src) + await broker.emit(topic, msg) + } +} + +/** + * ROS message type + * TODO: code generate message signature + */ +export type RosMessage = + | boolean + | number + | { + id: string + foo: number + } + | any // escape hatch + +/** + * Subscribes to a ROS topi. + * @param topic ROS topic + * @param handler callback function + * @returns callback to unsubscribe + */ +export async function rosSubscribe( + topic: string, + handler: (msg: T) => ds.AsyncVoid +): Promise { + // notify ROS service to send messages + await ros.subscribeMessage(nodeName, topic) + // remember handler + broker.subscribe(topic, handler) +} + +/** + * Publishes a ROS message + * @param topic + * @param msg + * @returns + */ +export async function rosPublish(topic: string, msg: T) { + const src = JSON.stringify(msg) + // send to ROS service + await ros.publishMessage(nodeName, topic, src) +} +`, + "ros/src/main.ts": `import { describe, expect, test } from "@devicescript/test" +import { rosSubscribe, rosPublish, rosConfigure } from "./index" +import { delay } from "@devicescript/core" + +describe("ros", () => {}) + /* +describe("ros", () => { + test("configure", async () => { + await rosConfigure("mynode") + await delay(1000) + }) + test("subscribe", async () => { + await rosSubscribe("/foo", msg => { + console.log(msg) + }) + await delay(1000) + }) + test("publish", async () => { + await rosPublish("/foo", 42) + }) +}) +*/ +`, + "runtime/package.json": `{ + "name": "@devicescript/runtime", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/runtime" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "runtime/src/bargraph.ts": `import { Palette } from "@devicescript/graphics" +import { interpolateColor } from "./palette" +import { PixelBuffer } from "./pixelbuffer" + +/** + * Renders a bar graph of value (absolute value) on a pixel buffer + * @param pixels + * @param value + * @param high + * @param options + * @returns + */ +export function fillBarGraph( + pixels: PixelBuffer, + value: number, + high: number, + options?: { + /** + * Color used when the range is empty + */ + emptyRangeColor?: number + /** + * Color used when the value is 0 + */ + zeroColor?: number + /** + * Palette to interpolate color from + */ + palette?: Palette + } +) { + if (high <= 0) { + const emptyRangeColor = options?.emptyRangeColor + pixels.clear() + pixels.setAt(0, isNaN(emptyRangeColor) ? 0xffff00 : emptyRangeColor) + return + } + + value = Math.abs(value) + const n = pixels.length + const n1 = n - 1 + const palette = options?.palette + let v = Math.idiv(value * n, high) + if (v === 0) { + const zeroColor = options?.zeroColor + pixels.setAt(0, isNaN(zeroColor) ? 0x666600 : zeroColor) + for (let i = 1; i < n; ++i) pixels.setAt(i, 0) + } else { + for (let i = 0; i < n; ++i) { + if (i <= v) { + if (palette) { + const c = interpolateColor(palette, i / (n - 1)) + pixels.setAt(i, c) + } else { + const b = Math.idiv(i * 255, n1) + pixels.setRgbAt(i, b, 0, 255 - b) + } + } else pixels.setRgbAt(i, 0, 0, 0) + } + } +} +`, + "runtime/src/colors.ts": `/** + * Well known colors + */ +export const enum Colors { + Red = 0xff0000, + Orange = 0xff7f00, + Yellow = 0xffff00, + Green = 0x00ff00, + Blue = 0x0000ff, + Indigo = 0x4b0082, + Violet = 0x8a2be2, + Purple = 0xa033e5, + Pink = 0xff007f, + White = 0xffffff, + Black = 0x000000, +} + +/** + * Well known color hues + */ +export const enum ColorHues { + Red = 0, + Orange = 29, + Yellow = 43, + Green = 86, + Aqua = 125, + Blue = 170, + Purple = 191, + Magenta = 213, + Pink = 234, +} + +/** + * Blends two colors, left and right, using the alpha parameter. + */ +export type ColorInterpolator = (left: number, alpha: number, right: number) => number; + +/** + * Encodes an RGB color into a 24bit color number. + * @param r byte red + * @param g byte green + * @param b byte blue + * @returns 24 bit color number + */ +export function rgb(r: number, g: number, b: number) { + return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff) +} + +/** + * Convert an HSV (hue, saturation, value) color to RGB + * @param hue value of the hue channel between 0 and 255. eg: 255 + * @param sat value of the saturation channel between 0 and 255. eg: 255 + * @param val value of the value channel between 0 and 255. eg: 255 + */ +export function hsv(hue: number, sat: number = 255, val: number = 255): number { + let h = hue % 255 >> 0 + if (h < 0) h += 255 + // scale down to 0..192 + h = ((h * 192) / 255) >> 0 + + //reference: based on FastLED's hsv2rgb rainbow algorithm [https://github.com/FastLED/FastLED](MIT) + const invsat = 255 - sat + const brightness_floor = ((val * invsat) / 255) >> 0 + const color_amplitude = val - brightness_floor + const section = (h / 0x40) >> 0 // [0..2] + const offset = h % 0x40 >> 0 // [0..63] + + const rampup = offset + const rampdown = 0x40 - 1 - offset + + const rampup_amp_adj = ((rampup * color_amplitude) / (255 / 4)) >> 0 + const rampdown_amp_adj = ((rampdown * color_amplitude) / (255 / 4)) >> 0 + + const rampup_adj_with_floor = rampup_amp_adj + brightness_floor + const rampdown_adj_with_floor = rampdown_amp_adj + brightness_floor + + let r: number + let g: number + let b: number + if (section) { + if (section === 1) { + // section 1: 0x40..0x7F + r = brightness_floor + g = rampdown_adj_with_floor + b = rampup_adj_with_floor + } else { + // section 2; 0x80..0xBF + r = rampup_adj_with_floor + g = brightness_floor + b = rampdown_adj_with_floor + } + } else { + // section 0: 0x00..0x3F + r = rampdown_adj_with_floor + g = rampup_adj_with_floor + b = brightness_floor + } + return rgb(r, g, b) +} + +/** + * Fade the color by the brightness + * @param color color to fade + * @param alpha the amount of brightness to apply to the color between 0 and 1. + */ +export function fade(color: number, alpha: number): number { + alpha = Math.constrain(alpha * 0xff, 0, 0xff) + if (alpha < 0xff) { + let red = (color >> 16) & 0xff + let green = (color >> 8) & 0xff + let blue = color & 0xff + + red = (red * alpha) >> 8 + green = (green * alpha) >> 8 + blue = (blue * alpha) >> 8 + + color = rgb(red, green, blue) + } + return color +} + +function unpackR(rgb: number): number { + return (rgb >> 16) & 0xff +} +function unpackG(rgb: number): number { + return (rgb >> 8) & 0xff +} +function unpackB(rgb: number): number { + return (rgb >> 0) & 0xff +} + +/** + * Alpha blending of each color channel and returns a rgb 24bit color + * @param color + * @param alpha factor of blending, 0 for color, 1 for otherColor + * @param otherColor + * @returns + */ +export function blendRgb(color: number, alpha: number, otherColor: number) { + alpha = Math.constrain(alpha * 0xff, 0, 0xff) + const malpha = 0xff - alpha + const r = (unpackR(color) * malpha + unpackR(otherColor) * alpha) >> 8 + const g = (unpackG(color) * malpha + unpackG(otherColor) * alpha) >> 8 + const b = (unpackB(color) * malpha + unpackB(otherColor) * alpha) >> 8 + return rgb(r, g, b) +} +`, + "runtime/src/control.ts": `import { Control, isSimulator } from "@devicescript/core" + +let _ctrl: Control +/** + * Return the control service for the current device. + */ +export function currentControl(): Control { + if (!_ctrl) _ctrl = new Control("control[int:0]") + return _ctrl +} + +/** + * Attempt to put devices into lowest power sleep mode for a specified time, most likely involving a full reset on wake-up. + * @param duration - ms + */ +export async function standby(millis: number): Promise { + if (isNaN(millis) || millis < 0) return + + const ctrl = currentControl() + await ctrl.standby(millis) +} + +/** + * Sets the status light to the specified color, or brightness if monochrome LED. + * The color may be overriden by internal DeviceScript status updated. + * @param color RGB color + */ +export async function setStatusLight(color: number): Promise { + const ctrl = currentControl() + const r = (color >> 16) & 0xff + const g = (color >> 8) & 0xff + const b = color & 0xff + + await ctrl.setStatusLight(r, g, b, 0) +} + +/** + * Uptime in microseconds (us). + */ +export async function uptime() { + const ctrl = currentControl() + return await ctrl.uptime.read() +} + +/** + * Reads the onboard temperature sensor if any. + * @returns temperature in Celsius (\xB0C); undefined if sensor is not available. + */ +export async function mcuTemperature() { + if (isSimulator()) return 21 + else { + const ctrl = currentControl() + return await ctrl.mcuTemperature.read() + } +} +`, + "runtime/src/encodeURIComponent.ts": `export function encodeURIComponent(str: string) { + const hexDigits = "0123456789ABCDEF" + + function isAlphaNumeric(char: string) { + const code = char.charCodeAt(0) + return ( + (code >= 48 && code <= 57) || // 0-9 + (code >= 65 && code <= 90) || // A-Z + (code >= 97 && code <= 122) || // a-z + code === 45 || // - + code === 46 || // . + code === 95 || // _ + code === 126 // ~ + ) + } + + function convertToUTF8(char: string) { + let charCode = char.charCodeAt(0) + + // Single-byte characters (0-127) are represented as themselves + if (charCode < 128) { + return char + } + + // Multi-byte characters need to be converted to UTF-8 encoding + const bytes = [] + + // Calculate the number of bytes required for the character + let byteCount = 1 + if (charCode >= 2048) byteCount = 3 + else if (charCode >= 128) byteCount = 2 + + // Build the bytes array + for (let i = 0; i < byteCount; i++) { + bytes.push(128 | (charCode & 63)) + charCode >>= 6 + } + bytes.push((256 - (1 << (8 - byteCount))) | charCode) + + // Convert bytes to hexadecimal representation + const hexArray = [] + for (let i = bytes.length - 1; i >= 0; i--) { + const byte = bytes[i] + const hex1 = hexDigits.charAt((byte >> 4) & 0x0f) + const hex2 = hexDigits.charAt(byte & 0x0f) + hexArray.push(\`%\${hex1}\${hex2}\`) + } + + return hexArray.join("") + } + + // Encode each character in the string + const encodedChars = [] + for (let i = 0; i < str.length; i++) { + const char = str.charAt(i) + if (isAlphaNumeric(char)) { + encodedChars.push(char) + } else { + encodedChars.push(convertToUTF8(char)) + } + } + + return encodedChars.join("") +} +`, + "runtime/src/index.ts": `export * from "./colors" +export * from "./control" +export * from "./schedule" +export * from "./encodeURIComponent" +export * from "./valuedashboard" +export * from "./map" +export * from "./set" +export * from "./pixelbuffer" +export * from "./led" +export * from "./leddisplay" +export * from "./palette" +export * from "./bargraph" +export * from "./worker" +export * from "./number" +`, + "runtime/src/led.ts": `import * as ds from "@devicescript/core" +import { PixelBuffer, fillSolid } from "./pixelbuffer" + +interface LedWithBuffer { + _buffer: PixelBuffer +} + +declare module "@devicescript/core" { + interface Led { + /** + * Gets the pixel buffer to perform coloring operations. + * Call \`show\` to send the buffer to the LED strip. + */ + buffer(): Promise + + /** + * Sends the pixel buffer to the LED driver + */ + show(): Promise + + /** + * Sets all pixel color to the given color and renders the buffer + */ + showAll(c: number): Promise + } +} + +ds.Led.prototype.buffer = async function () { + let b = (this as any as LedWithBuffer)._buffer + if (!b) { + const n = await this.numPixels.read() + ;(this as any as LedWithBuffer)._buffer = b = PixelBuffer.alloc(n) + } + return b +} + +ds.Led.prototype.show = async function () { + const b = (this as any as LedWithBuffer)._buffer + if (b && b.length <= 64) await this.pixels.write(b.buffer) +} + +ds.Led.prototype.showAll = async function (c: number) { + const b = await this.buffer() + fillSolid(b, c) + await this.show() +} +`, + "runtime/src/leddisplay.ts": `import * as ds from "@devicescript/core" +import { Display, Image, Palette } from "@devicescript/graphics" + +/** + * Mounts a Display interface over a LED matrix to make it act as a screen. + * This function allocates one image. + * @param led + * @param palette + * @returns + */ +export async function startLedDisplay( + led: ds.Led, + palette?: Palette +): Promise { + if (!palette) { + const waveLength = await led.waveLength.read() + if (waveLength) palette = Palette.monochrome() + else palette = Palette.leds() + } + + const buffer = await led.buffer() + + const width = (await led.numColumns.read()) || 1 + const height = (buffer.length / width) | 0 + + const bpp = palette.length === 2 ? 1 : 4 + + const image = Image.alloc(width, height, bpp) + + const init = async () => {} + + const show = async () => { + for (let x = 0; x < width; ++x) { + for (let y = 0; y < height; ++y) { + const ci = image.get(x, y) + const c = palette.at(ci) + if (c !== undefined) buffer.setAt(y * width + x, c) + } + } + await led.show() + } + + return { + image, + palette, + init, + show, + } +} +`, + "runtime/src/main.ts": `import { describe, expect, test } from "@devicescript/test" +import { + encodeURIComponent, + rgb, + schedule, + setStatusLight, + uptime, + Map, + Set, + fillGradient, + fillBarGraph, + Number, + PixelBuffer, +} from "." +import { delay } from "@devicescript/core" + + +describe("rgb", () => { + test("0,0,0", () => { + expect(rgb(0, 0, 0)).toBe(0) + }) + test("ff,0,0", () => { + expect(rgb(0xff, 0, 0)).toBe(0xff0000) + }) + test("0,ff,0", () => { + expect(rgb(0, 0xff, 0)).toBe(0x00ff00) + }) + test("0,00,ff", () => { + expect(rgb(0, 0, 0xff)).toBe(0x0000ff) + }) +}) + +describe("pixelbuffer", () => { + test("setpixelcolor", () => { + const buf = PixelBuffer.alloc(3) + buf.setAt(1, 0x123456) + expect(buf.at(1)).toBe(0x123456) + }) + test("setpixelcolor negative", () => { + const buf = PixelBuffer.alloc(3) + buf.setAt(-1, 0x123456) + expect(buf.at(-1)).toBe(0x123456) + }) + test("setbargraph", () => { + const buf = PixelBuffer.alloc(4) + fillBarGraph(buf, 5, 10) + console.log(buf.buffer) + }) + test("gradient", () => { + const buf = PixelBuffer.alloc(4) + fillGradient(buf, 0xff0000, 0x00ff00) + console.log(buf.buffer) + }) + test("rotate", () => { + const buf = PixelBuffer.alloc(3) + buf.setAt(1, 0x123456) + console.log(buf) + buf.rotate(-1) + console.log(buf) + expect(buf.at(2)).toBe(0x123456) + buf.rotate(-1) + console.log(buf) + expect(buf.at(0)).toBe(0x123456) + buf.rotate(1) + console.log(buf) + expect(buf.at(2)).toBe(0x123456) + }) +}) + +describe("control", () => { + test("uptime", async () => { + console.log({ uptime: await uptime() }) + }) + test("setStatusLight", async () => { + await setStatusLight(0xff0000) + await delay(100) + await setStatusLight(0x00ff00) + }) +}) + +describe("schedule", () => { + test("timeout", async () => { + let called = 0 + schedule( + () => { + called++ + }, + { timeout: 50 } + ) + await delay(100) + console.log({ called }) + expect(called).toBe(1) + }) + test("interval", async () => { + let called = 0 + schedule( + () => { + called++ + }, + { interval: 40 } + ) + await delay(100) + console.log({ called }) + expect(called === 2).toBe(true) + }) + test("timeout+interval", async () => { + let called = 0 + schedule( + () => { + called++ + }, + { interval: 50, timeout: 20 } + ) + await delay(100) + console.log({ called }) + expect(called === 2).toBe(true) + }) +}) + +describe("encodeURIComponent tests", () => { + test("Basic Encoding Test", async () => { + let encoded = encodeURIComponent("Hello World") + expect(encoded === "Hello World").toBe(true) + }) + test("Encoding Already Encoded Characters", async () => { + let encoded = encodeURIComponent("Hello%20World") + expect(encoded === "Hello%20World").toBe(true) + }) + test("Encoding Slash", async () => { + let encoded = encodeURIComponent("/path/to/resource") + expect(encoded === "/path/to/resource").toBe(true) + }) + test("Encoding Non-ASCII Character", async () => { + let encoded = encodeURIComponent("\u{1F600}") + expect(encoded === "%E0%9F%98%80").toBe(true) + }) +}) + +describe("Test Es Map Class", () => { + function msg(m: string) { + console.log(m) + } + + test("map+methods", () => { + let map = new Map() + map.set("one", 1) + map.set("two", 2) + map.set("three", 3) + + msg("map test set") + expect(map.size() === 3).toBe(true) + + msg("map test get") + expect(map.get("one") === 1).toBe(true) + map.delete("two") + + msg("map test delete") + expect(map.size() === 2).toBe(true) + + map.clear() + + msg("map test clear") + expect(map.size() === 0).toBe(true) + }) + + test("map+constructor", () => { + const map = new Map([ + ["one", 1], + ["two", 2], + ["three", 3], + ]) + msg("map test constructor") + expect(map.size() === 3).toBe(true) + }) + msg("Map tests completed") +}) + +describe("Test Es Set Class", () => { + test("add", () => { + let elements = new Set() + expect(elements === elements.add(1)).toBe(true) + expect(elements.size === 1).toBe(true) + + expect(elements === elements.add(2)).toBe(true) + expect(elements.size === 2).toBe(true) + + expect(elements === elements.add(1)).toBe(true) + expect(elements === elements.add(2)).toBe(true) + + expect(elements === elements.add(3)).toBe(true) + expect(elements.size === 3).toBe(true) + }) + + test("clear", () => { + let elements = new Set() + ;[1, 3, 1, 4, 5, 3].forEach(element => { + elements.add(element) + }) + expect(elements.size === 4).toBe(true) + + elements.clear() + expect(elements.size === 0).toBe(true) + }) + + test("delete", () => { + let elements = new Set() + ;["a", "b", "e", "b", "d", "c", "a"].forEach(element => { + elements.add(element) + }) + + expect(elements.size === 5).toBe(true) + + expect(!elements.delete("f")).toBe(true) + expect(elements.size === 5).toBe(true) + + expect(elements.delete("a")).toBe(true) + expect(elements.size === 4).toBe(true) + + expect(!elements.delete("a")).toBe(true) + expect(elements.size === 4).toBe(true) + }) + + test("has", () => { + let elements = new Set() + ;["a", "d", "f", "d", "d", "a", "g"].forEach(element => { + elements.add(element) + }) + + expect(elements.has("g")).toBe(true) + expect(elements.has("d")).toBe(true) + expect(elements.has("f")).toBe(true) + expect(!elements.has("e")).toBe(true) + }) +}) + +describe("number", () => { + + test("isInteger", () => { + const check = (v: unknown) => expect(Number.isInteger(v)).toBe(true) + const checkNot = (v: unknown) => expect(Number.isInteger(v)).toBe(false) + + check(0); // true + check(1); // true + check(-100000); // true + check(99999999999999999999999); // true + + checkNot(0.1); // false + checkNot(Math.PI); // false + + checkNot(NaN); // false + checkNot(Infinity); // false + checkNot(-Infinity); // false + checkNot("10"); // false + checkNot(true); // false + checkNot(false); // false + checkNot([1]); // false + + check(5.0); // true + checkNot(5.000000000000001); // false + check(5.0000000000000001); // true, because of loss of precision + check(4500000000000000.1); // true, because of loss of precision + + }) +}) +`, + "runtime/src/map.ts": `/** + * Represents a collection of key-value pairs. + * @interface Map + * @template K The type of keys in the Map. + * @template V The type of values in the Map. + */ + +export class Map { + private keys: K[] = [] + private values: V[] = [] + + /** + * Creates a new Map object. + * @param entries An optional array or iterable containing key-value pairs to initialize the Map. + */ + constructor(entries?: Array | null) { + if (entries) { + for (let i = 0; i < entries.length; i++) { + const [key, value] = entries[i] + this.set(key, value) + } + } + } + + /** + * Gets the number of key-value pairs in the Map. + * @readonly + */ + size(): number { + return this.keys.length + } + /** + * Returns the iterator for the key-value pairs of the Map, in insertion order. + * @returns The iterator for the key-value pairs of the Map. + */ + + /** + * Sets the value for the specified key in the Map. + * @param key The key to set. + * @param value The value to set for the key. + * @returns The updated Map object. + */ + set(key: K, value: V): void { + const index = this.keys.indexOf(key) + if (index !== -1) { + this.values[index] = value + } else { + this.keys.push(key) + this.values.push(value) + } + } + + /** + * Gets the value associated with the specified key in the Map. + * @param key The key to retrieve the value for. + * @returns The value associated with the key, or undefined if the key doesn't exist in the Map. + */ + get(key: K): V | undefined { + const index = this.keys.indexOf(key) + return index !== -1 ? this.values[index] : undefined + } + + /** + * Checks if the specified key exists in the Map. + * @param key The key to check for existence. + * @returns A boolean indicating whether the key exists in the Map. + */ + has(key: K): boolean { + return this.keys.indexOf(key) !== -1 + } + + /** + * Deletes the specified key and its associated value from the Map. + * @param key The key to delete. + * @returns A boolean indicating whether the key was successfully deleted. + */ + delete(key: K): boolean { + const index = this.keys.indexOf(key) + if (index !== -1) { + this.keys.insert(index, -1) + this.values.insert(index, -1) + return true + } + return false + } + + /** + * Removes all key-value pairs from the Map. + */ + clear(): void { + this.keys = [] + this.values = [] + } + + /** + * Executes a provided function once for each key-value pair in the Map. + * @param callbackFn The function to execute for each key-value pair. + * @param thisArg The value to use as "this" when executing the callback function. + */ + forEach( + callbackFn: (value: V, key: K, map: Map) => void, + thisArg?: any + ): void { + for (let i = 0; i < this.keys.length; i++) { + callbackFn(this.values[i], this.keys[i], this) + } + } + + /** + * Returns an iterator for the keys of the Map, in insertion order. + * @returns An iterator for the keys of the Map. + */ + keysIterator(): IterableIterator { + return this.keys + } + + /** + * Returns an iterator for the values of the Map, in insertion order. + * @returns An iterator for the values of the Map. + */ + valuesIterator(): IterableIterator { + return this.values + } + + /** + * Returns an iterator for the key-value pairs of the Map, in insertion order. + * @returns An iterator for the key-value pairs of the Map. + */ + entries(): IterableIterator<[K, V]> { + const entries: [K, V][] = [] + for (let i = 0; i < this.keys.length; i++) { + entries.push([this.keys[i], this.values[i]]) + } + return entries + } +} +`, + "runtime/src/number.ts": `export class Number { + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + static isInteger(number: unknown): boolean { + if (typeof number !== "number" || isNaN(number) || number === Infinity || number === -Infinity) return false + return number === Math.round(number) + } +} +`, + "runtime/src/palette.ts": `import { Palette } from "@devicescript/graphics" +import { ColorInterpolator, blendRgb } from "./colors" +import { PixelBuffer, correctGammaChannel, fillMap } from "./pixelbuffer" + +/** + * Interpolates a normalize value \`[0, 1]\` in the palette. By default uses RGB linear interpolation. + * @param index + * @param interpolator + * @returns + */ +export function interpolateColor(palette: Palette, alpha: number, interpolator?: ColorInterpolator) { + const index = Math.constrain(alpha, 0, 1) * (palette.length - 1) + + const li = Math.floor(index) + const lc = palette.at(li) + if (li === index) return lc + + const ui = li + 1 + const uc = palette.at(ui) + const a = index - li + + const mixer = interpolator || blendRgb + + return mixer(lc, a, uc) +} + + +/** + * Applies gamma correction to the colors of the palette in place. + * @param gamma default 2.7 + */ +export function correctGamma(palette: Palette, gamma: number = 2.7) { + const buf = palette.buffer + const n = buf.length + + for (let i = 0; i < 0; ++i) { + const c = buf[i] + const o = correctGammaChannel(c, gamma) + buf[i] = o + } +} + +/** + * Fills a pixel buffer with the interpolated colors of a palette. + * @param interpolator color interpolation function. default is blendRgb + */ +export function fillPalette( + pixels: PixelBuffer, + palette: Palette, + options?: { + interpolator?: ColorInterpolator + reversed?: boolean + circular?: boolean + } +) { + const { interpolator } = options || {} + const mixer = interpolator || blendRgb + const render = (alpha: number) => interpolateColor(palette, alpha, mixer) + fillMap(pixels, render) +} +`, + "runtime/src/pixelbuffer.ts": `import * as ds from "@devicescript/core" +import { blendRgb, hsv, rgb } from "./colors" + +/** + * A buffer of RGB colors + */ +export class PixelBuffer { + /** + * Array of RGB colors + * @internal + */ + readonly buffer: ds.Buffer + /** + * Starting pixel index in the original buffer + */ + readonly start: number + /** + * Number of pixels in the buffer + */ + readonly length: number + + constructor(buffer: ds.Buffer, start: number, length: number) { + ds.assert(buffer.length >= (start + length) * 3, "buffer too small") + this.buffer = buffer + this.start = start + this.length = length + } + + /** + * Create a color buffer that allows you to manipulate a range of pixels + * @param numPixels number of pixels + */ + static alloc(numPixels: number): PixelBuffer { + if (numPixels <= 0) throw new RangeError("invalid number of pixels") + numPixels = numPixels | 0 + const buf = ds.Buffer.alloc(numPixels * 3) + return new PixelBuffer(buf, 0, numPixels) + } + + /** + * Set a pixel color in the buffer + * @param pixeloffset pixel offset. if negative starts from the end + * @param color RGB color + */ + setAt(pixeloffset: number, color: number) { + pixeloffset = pixeloffset | 0 + while (pixeloffset < 0) pixeloffset += this.length + const i = this.start + pixeloffset + if (i < this.start || i >= this.start + this.length) return + const bi = i * 3 + this.buffer[bi] = (color >> 16) & 0xff + this.buffer[bi + 1] = (color >> 8) & 0xff + this.buffer[bi + 2] = color & 0xff + } + + /** + * Setter for individual RGB colors. Does not check bounds and should be used with care. + * @param pixeloffset + * @param r + * @param g + * @param b + */ + setRgbAt(pixeloffset: number, r: number, g: number, b: number) { + const i = (this.start + (pixeloffset | 0)) * 3 + this.buffer[i] = r + this.buffer[i + 1] = g + this.buffer[i + 2] = b + } + + /** + * Reads the pixel color at the given offsret + * @param pixeloffset pixel offset. if negative starts from the end + * @returns + */ + at(pixeloffset: number): number { + pixeloffset = pixeloffset | 0 + while (pixeloffset < 0) pixeloffset += this.length + const i = this.start + pixeloffset + if (i < this.start || i >= this.start + this.length) return undefined + const bi = i * 3 + const r = this.buffer[bi] + const g = this.buffer[bi + 1] + const b = this.buffer[bi + 2] + return rgb(r, g, b) + } + + /** + * Apply a conversion function to all pixels + * @param converter + */ + apply(converter: (c: number, index: number) => number) { + const n = this.length + const buf = this.buffer + for (let i = 0; i < n; ++i) { + const bi = (this.start + i) * 3 + + const r = buf[bi] + const g = buf[bi + 1] + const b = buf[bi + 2] + const c = rgb(r, g, b) + + const cr = converter(c, i) + + buf[bi] = (cr >> 16) & 0xff + buf[bi + 1] = (cr >> 8) & 0xff + buf[bi + 2] = cr & 0xff + } + } + + /** + * Allocates a clone of the buffer view + * @returns + */ + allocClone() { + const res = new PixelBuffer( + this.buffer.slice(this.start * 3, (this.start + this.length) * 3), + 0, + this.length + ) + return res + } + + /** + * Clears the buffer to #000000 + */ + clear() { + this.buffer.fillAt(this.start * 3, this.length * 3, 0) + } + + /** + * Creates a range view over the color buffer + * @param start start index + * @param length length of the range + * @returns a view of the color buffer + */ + view(start: number, length?: number): PixelBuffer { + const rangeStart = this.start + (start << 0) + const rangeLength = Math.max( + 0, + length === undefined + ? this.length - start + : Math.min(length, this.length - start) + ) + return new PixelBuffer(this.buffer, rangeStart, rangeLength) + } + + /** + * Applies a inplace gamma correction to the pixel colors + * @param pixels + * @param gamma + */ + correctGamma(gamma: number = 2.7) { + const s = this.start * 3 + const e = (this.start + this.length) * 3 + const buf = this.buffer + + for (let i = s; i < e; ++i) { + const c = buf[i] + const o = correctGammaChannel(c, gamma) + buf[i] = o + } + } + + /** + * Rotates in place the colors by the given shift amount + * @param shift number of pixels to shift, use negative to shift right + */ + rotate(shift: number) { + shift = shift | 0 + this.buffer.rotate( + shift * 3, + this.start * 3, + (this.start + this.length) * 3 + ) + } +} + +/** + * Writes a gradient between the two colors. + * @param startColor + * @param endColor + */ +export function fillGradient( + pixels: PixelBuffer, + startColor: number, + endColor: number, + options?: { + reversed?: boolean + circular?: boolean + } +): void { + const render = (alpha: number) => blendRgb(startColor, alpha, endColor) + fillMap(pixels, render, options) +} + +/** + * Sets all the color in the buffer to the given color + * @param c 24bit rgb color + */ +export function fillSolid(pixels: PixelBuffer, c: number) { + const r = (c >> 16) & 0xff + const g = (c >> 8) & 0xff + const b = c & 0xff + const n = pixels.length + for (let i = 0; i < n; ++i) { + pixels.setRgbAt(i, r, g, b) + } +} + +/** + * Fades each color channels according to the brigthness value between 0 dark and 1 full brightness. + * @param alpha + */ +export function fillFade(pixels: PixelBuffer, alpha: number) { + alpha = Math.constrain(alpha * 0xff, 0, 0xff) + + const s = pixels.start * 3 + const e = (pixels.start + pixels.length) * 3 + const buf = pixels.buffer + + for (let i = s; i < e; ++i) { + buf[i] = (buf[i] * alpha) >> 8 + } +} + +/** + * Fills the buffer with colors of increasing Hue (or decreasing) + * @param pixels + * @param startHue start hue channel between 0 and 255. eg: 255 + * @param endHue end hue channel between 0 and 255. eg: 255 + * @returns + */ +export function fillRainbow( + pixels: PixelBuffer, + options?: { + startHue?: number + endHue?: number + reversed?: boolean + circular?: boolean + saturation?: number + brightness?: number + } +) { + let { startHue, endHue, saturation, brightness } = options || {} + startHue = startHue ?? 0 + endHue = endHue ?? 255 + saturation = saturation ?? 240 + brightness = brightness ?? 255 + const dh = endHue - startHue + const render = (alpha: number) => + hsv(startHue + alpha * dh, saturation, brightness) + fillMap(pixels, render, options) +} + +/** + * Applies a gamma correction to a single color channel ([0,0xff]) + * @param c + * @param gamma + * @returns + */ +export function correctGammaChannel(c: number, gamma: number) { + let o = + c <= 0 + ? 0 + : c >= 0xff + ? 0xff + : Math.round(Math.pow(c / 255.0, gamma) * 255.0) + if (c > 0 && o === 0) o = 1 + return 0 +} + +/** + * General purpose helper to create a color fill function. + * @param pixels + * @param render + * @param options + * @internal + * @returns + */ +export function fillMap( + pixels: PixelBuffer, + render: (alpha: number) => number, + options?: { reversed?: boolean; circular?: boolean } +) { + if (!pixels.length) return + if (options?.circular) fillCircular(pixels, render, options) + else fillLinear(pixels, render, options) +} + +function fillLinear( + pixels: PixelBuffer, + render: (alpha: number) => number, + options?: { reversed?: boolean } +) { + const n = pixels.length + const { reversed } = options || {} + for (let i = 0; i < n; ++i) { + let alpha = i / (n - 1) + if (i === n - 1) alpha = 1 + if (reversed) alpha = 1 - alpha + const c = render(alpha) + pixels.setAt(i, c) + } +} + +function fillCircular( + pixels: PixelBuffer, + render: (alpha: number) => number, + options?: { reversed?: boolean } +) { + const n = pixels.length + const n2 = n >> 1 + const { reversed } = options || {} + let c: number + for (let i = 0; i < n2; ++i) { + let alpha = (2 * i) / (n - 1) + if (reversed) alpha = 1 - alpha + const c = render(alpha) + pixels.setAt(i, c) + pixels.setAt(n - 1 - i, c) + } + if (n % 2 === 1) pixels.setAt(n2, c) +} +`, + "runtime/src/schedule.ts": `import { AsyncVoid, millis } from "@devicescript/core" + +/** + * Schedules a handler to be called at a later time. Executes timeout before interval if combined. + * If not specified, default to timeout 20ms and interval 60s. + * + * @param handler function to execute + * @param options options to configure the scheduling + * @returns clear timer function + */ +export function schedule( + handler: (props: { + /** + * Number of times the handler has been called. + */ + counter: number + /** + * Time in milliseconds since the first execution of the handler. + */ + elapsed: number + /** + * Time in milliseconds since the last execution of the handler. + */ + delta: number + }) => AsyncVoid, + options?: { + /** + * Time in milliseconds to wait before the first execution of the handler. + */ + timeout?: number + /** + * Time in milliseconds to wait before executing the handler in an internval. + */ + interval?: number + } +) { + let timerId: number + let intervalId: number + const unsub = () => { + if (timerId) clearTimeout(timerId) + if (intervalId) clearInterval(intervalId) + timerId = intervalId = undefined + } + + if (!handler) return unsub + + let start = millis() + let last = millis() + let counter = 0 + + const run = async () => { + const now = millis() + const props = { + counter: counter++, + elapsed: now - start, + delta: now - last, + } + last = now + await handler(props) + } + + let { interval, timeout } = options || {} + if (interval === undefined && timeout === undefined) { + timeout = 20 + interval = 60000 + } + if (timeout >= 0 && interval >= 0) { + timerId = setTimeout(async () => { + await run() + // check if cancelled or schedule + if (timerId !== undefined) intervalId = setInterval(run, interval) + }, 20) + } else if (timeout) { + timerId = setTimeout(run, timeout) + } else if (interval) { + intervalId = setInterval(run, interval) + } + return unsub +} +`, + "runtime/src/set.ts": `/** + * Represents a set of values. + * @interface Map + * @template T The type of elements in the Set. + */ +export class Set { + private elements: T[] = [] + + /** + * The number of (unique) elements in Set. + */ + public size: number; + + constructor(elements?: readonly T[] | null) { + if (elements) { + this.elements = elements + } + this.size = this.elements.length; + } + + /** + * Appends a new element with a specified value to the end of the Set. + */ + add(value: T): this { + if (!this.elements.includes(value)) { + this.elements.push(value) + this.size++; + } + return this + } + + clear(): void { + this.elements = [] + this.size = 0; + } + + /** + * Removes a specified value from the Set. + * @returns Returns true if an element in the Set existed and has been removed, or false if the element does not exist. + */ + delete(value: T): boolean { + if (this.elements.includes(value)) { + this.elements = this.elements.filter(e => e !== value) + this.size = this.elements.length; + return true; + } + return false; + } + + /** + * Executes a provided function once per each value in the Set object, in insertion order. + */ + forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void { + for (let i = 0; i < this.elements.length; i++) { + callbackfn(this.elements[i], this.elements[i], this) + } + } + + /** + * @returns a boolean indicating whether an element with the specified value exists in the Set or not. + */ + has(value: T): boolean { + return this.elements.includes(value) + } + + /** + * @returns an iterable of [v,v] pairs for every value \`v\` in the set. + */ + entries(): IterableIterator<[T, T]> { + return this.elements.map(e => [e, e]) + } + + /** + * @returns an iterable of values in the set. + */ + values(): IterableIterator { + return this.elements + } + + + /** + * @returns Despite its name, returns an iterable of the values in the set. + */ + keys(): IterableIterator { + return this.values() + } + + +} +`, + "runtime/src/valuedashboard.ts": `import { CharacterScreen } from "@devicescript/core" + +function roundWithPrecision( + x: number, + digits: number, + maxDigits: number +): number { + const EPSILON = 2.220446049250313e-16 + digits = digits | 0 + if (digits <= 0) return Math.round(x) + if (x === 0) return 0 + let r = 0 + while (r === 0 && digits < maxDigits) { + const d = Math.pow(10, digits++) + r = Math.round(x * d + EPSILON) / d + } + return r +} + +export interface ValueDomain { + /** + * Unit of measurement of the value + */ + unit?: string + /** + * Number of significant digits to display + */ + digits?: number + /** + * Prescaling before displaing + */ + scale?: number +} + +/** + * Renders a set of name, values on a character display. + */ +export class ValueDashboard> { + /** + * Map of name, values + */ + values: Partial> = {} + + /** + * Map of name to number domains + */ + readonly domains: T + + /** + * Line offset value + */ + public offset = 0 + + constructor(readonly screen: CharacterScreen, domains: T) { + this.domains = domains + } + + private renderNumber(name: string, value: number, maxDigits: number) { + const domain = this.domains[name] || {} + if (domain.scale) value = value * domain.scale + if (domain.digits !== undefined) + value = roundWithPrecision(value, domain.digits, maxDigits) + let r = value + "" + if (domain.unit) r += domain.unit + return r + } + + /** + * Renders the current values to the character display + */ + async show() { + const rows = await this.screen.rows.read() + const columns = await this.screen.columns.read() + + const names = Object.keys(this.domains) + let lines: string[] = [] + for (let i = 0; i < rows; ++i) { + const name = names[i + this.offset] + if (!name) break + const value = this.values[name] ?? "" + const sv = + typeof value === "string" + ? value + : typeof value === "number" + ? this.renderNumber(name, value, columns - 5) + : typeof value === "boolean" + ? value + ? "v" + : "x" + : value + "" + // start with name and trim as neede + let line = name.slice( + 0, + Math.min(name.length, Math.max(4, columns - sv.length - 1)) + ) + while (line.length + sv.length + 1 <= columns) line += " " + line += sv + lines.push(line) + } + const msg = lines.join("\\n") + await this.screen.message.write(msg) + } +} +`, + "runtime/src/worker.ts": `import * as ds from "@devicescript/core" + +interface WorkItem { + when: number + callback: () => Promise +} + +/** + * A SequentialWorker executes queued tasks sequentially, without interleaving, + * in given order (modulo specified delays). + */ +export class SequentialWorker { + private timeouts: WorkItem[] + private timeoutWorkerId: ds.Fiber + + /** + * Queue a task to be executed. + */ + queue(callback: () => Promise, delay = 0) { + if (!delay || delay < 0) delay = 0 + const when = ds.millis() + delay + const t: WorkItem = { + when, + callback, + } + + if (!this.timeouts) { + this.timeouts = [t] + this.timeoutWorkerId = this.timeoutWorker.start() + return + } + + for (let i = 0; i < this.timeouts.length + 1; ++i) { + if (i === this.timeouts.length || t.when < this.timeouts[i].when) { + this.timeouts.insert(i, 1) + this.timeouts[i] = t + // if we're inserting at the head, wake the worker + if (i === 0 && this.timeoutWorkerId.suspended) + this.timeoutWorkerId.resume(null) + return + } + } + + ds.assert(false) + } + + private async timeoutWorker() { + while (this.timeouts[0]) { + let n = ds.millis() + const d = this.timeouts[0].when - n + if (d > 0) { + await ds.suspend(d) + n = ds.millis() + } + while (this.timeouts.length > 0 && this.timeouts[0].when <= n) { + const t = this.timeouts.shift() + await t.callback() + n = ds.millis() + } + } + // we're about to exit, clean up + this.timeouts = null + this.timeoutWorkerId = null + } +} +`, + "server/package.json": `{ + "name": "@devicescript/server", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/server" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts -F allFunctions", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "server/src/index.ts": `export * from "./servercore" +export * from "./sensor" +`, + "server/src/main.ts": ``, + "server/src/sensor.ts": `import * as ds from "@devicescript/core" +import { Server, ServerOptions } from "./servercore" + +const minInterval = 100 +const maxInterval = 3600 * 1000 + +export interface SensorServerOptions extends ServerOptions { + interval?: number +} + +export class SensorServer extends Server implements ds.SensorServerSpec { + _preferredInterval: number + _streamingInterval: number + _streamingSamples = 0 + _interval: number + + constructor(spec: ds.ServiceSpec, options?: SensorServerOptions) { + super(spec, options) + const interval = options?.interval || 500 + this.set_streamingInterval(interval) + this._preferredInterval = this._streamingInterval + } + + private maybeStop() { + if (this._streamingSamples <= 0) { + this._streamingSamples = 0 + clearInterval(this._interval) + this._interval = 0 + } + } + private async sendSample() { + const v = await (this as any).reading() + const p = this.spec.lookup("reading").encode(v) + await this._send(p) + this._streamingSamples-- + this.maybeStop() + } + streamingSamples() { + return this._streamingSamples + } + async set_streamingSamples(value: number) { + this._streamingSamples = value + + if (this._streamingSamples > 0 && !this._interval) { + this._interval = setInterval( + this.sendSample, + this._streamingInterval + ) + await this.sendSample() + } else this.maybeStop() + } + streamingPreferredInterval() { + return this._preferredInterval + } + streamingInterval() { + return this._streamingInterval + } + set_streamingInterval(value: number) { + this._streamingInterval = Math.constrain( + value, + minInterval, + maxInterval + ) + if (this._interval) + updateInterval(this._interval, this._streamingInterval) + } +} +`, + "server/src/servercore.ts": `import * as ds from "@devicescript/core" +import { SequentialWorker } from "@devicescript/runtime" + +type DsServer = typeof ds & { + _onServerPacket(pkt: ds.Packet): Promise + _serverSend(serviceIndex: number, pkt: ds.Packet): Promise +} + +export interface ServerOptions { + roleName?: string +} + +let eventWorker: SequentialWorker + +export class Server implements ds.ServerInterface { + serviceIndex: number + debug: boolean + private readonly _instanceName: string + private _stateCode: number = undefined + + constructor( + public spec: ds.ServiceSpec, + options?: ServerOptions + ) {} + + async _send(pkt: ds.Packet) { + if (this.debug) console.debug("Out SRV", pkt, pkt.spec) + await (ds as DsServer)._serverSend(this.serviceIndex, pkt) + } + + statusCode(): ds.AsyncValue<[number, number]> { + const v = this._stateCode + return v !== undefined ? [(v & 0xffff) >> 16, v & 0xffff] : [0, 0] + } + + set_statusCode(code: number, vendorCode: number) { + this._stateCode = (code << 16) | (vendorCode & 0xffff) + } + + async sendEvent(pkt: ds.Packet) { + if (!eventWorker) eventWorker = new SequentialWorker() + const self = this + let prep = false + const sendp = async () => { + if (!prep) { + prep = true + // prep packet as an event: + await (ds as DsServer)._serverSend(0x100, pkt) + } + await self._send(pkt) + } + eventWorker.queue(sendp, 0) + eventWorker.queue(sendp, 20) + eventWorker.queue(sendp, 70) + } +} + +let servers: ds.ServerInterface[] +let restartCnt = 1 + +export class ControlServer extends Server implements ds.ControlServerSpec { + constructor() { + super(ds.Control.spec) + } + announce(): ds.AsyncValue { + if (restartCnt < ds.ControlAnnounceFlags.RestartCounterSteady) + restartCnt++ + + const flags = restartCnt | ds.ControlAnnounceFlags.SupportsACK + // | ds.ControlAnnounceFlags.SupportsBroadcast + // | ds.ControlAnnounceFlags.SupportsFrames + + const r = servers.map(s => s.spec.classIdentifier) + r.shift() // drop the ctrl service + const reserved = 0, + pktCount = 0 // not yet supported + r.unshift(flags, pktCount, reserved) + return r + } + noop() {} + + identify(): ds.AsyncValue { + // TODO? + } + reset(): ds.AsyncValue { + ds.reboot() + } + + setStatusLight( + to_red: number, + to_green: number, + to_blue: number, + speed: number + ) { + // TODO? + } + + deviceDescription() { + return "DeviceScript user-provided servers" + } + + productIdentifier() { + return 0x355724dd + } + + bootloaderProductIdentifier() { + return 0x355724dd + } + + firmwareVersion(): ds.AsyncValue { + return ds._dcfgString("@version") + } + + uptime() { + return ds.millis() * 1000 + } +} + +async function _onServerPacket(pkt: ds.Packet) { + if (pkt.isReport) return + if (!servers) return + // TODO b-cast packets + const server = servers[pkt.serviceIndex] + if (!server) return + + server.spec.assign(pkt) + if (server.debug) console.debug("In SRV", pkt, server.spec, pkt.spec) + const methods = server as unknown as Record< + string, + (v?: any) => Promise + > + + if (pkt.spec) { + if (pkt.isRegSet) { + const m = methods["set_" + pkt.spec.name] + if (m) { + await m(pkt.decode()) + return + } + } else { + const m = methods[pkt.spec.name] + if (m) { + if (pkt.isRegGet) { + const mr = await m() + if (mr !== undefined) { + // treat undefined as not implemented + const resp = pkt.spec.encode(mr) + await server._send(resp) + return + } + } else if (pkt.isAction) { + const v = await m(pkt.decode()) + if (pkt.spec.response) + await server._send(pkt.spec.response.encode(v)) + return + } else { + // what's this? + } + } + } + } + + await server._send(pkt.notImplemented()) +} + +function attachName(s: ds.BaseServerSpec, name: string) { + if (name) s.instanceName = () => name +} + +export function startServer(s: ds.ServerInterface, options?: ServerOptions) { + if (!servers) { + servers = [new ControlServer()] + ;(ds as DsServer)._onServerPacket = _onServerPacket + setInterval(async () => { + const iserv = servers[0] as ds.ControlServerSpec + const spec = ds.Control.spec.lookup("announce") + const pkt = spec.response.encode(await iserv.announce()) + await iserv._send(pkt) + }, 500) + } + if (s.spec.classIdentifier === 0) { + // allow overriding the control server + s.serviceIndex = 0 + servers[0] = s + } else { + s.serviceIndex = servers.length + servers.push(s) + } + let off = 0 + for (const o of servers) { + if (o === s) break + if (o.spec.classIdentifier === s.spec.classIdentifier) off++ + } + let roleName = options?.roleName + if (!roleName) roleName = s.spec.name + "_" + off + attachName(s, roleName) + return \`\${roleName}[app:\${off}]\` +} +`, + "settings/package.json": `{ + "name": "@devicescript/settings", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/settings" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts -F allFunctions", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "settings/src/api.ts": `import { actionReport } from "@devicescript/core" +import { settings } from "./client" + +const MAX_KEY_SIZE = 13 +/** + * Serializes a JSON object to a setting + * @param key name of the setting + * @param value object to serialize + */ +export async function writeSetting(key: string, value: any): Promise { + checkKey(key) + // TODO json -> buffer + const s = JSON.stringify(value) + const b = Buffer.from(s) + await settings.set(key, b) +} + +function checkKey(key: string) { + if (!key || !key.length) + throw new RangeError("key must be a non-empty string") + if (key.length > MAX_KEY_SIZE) + throw RangeError(\`key length must be <= \${MAX_KEY_SIZE}\`) +} + +/** + * Deserializes a JSON object from a setting + * @param key name of the setting + * @param missingValue default value if missing + * @param value object to serialize + */ +export async function readSetting( + key: string, + missingValue?: T +): Promise { + checkKey(key) + const pkt = await actionReport( + settings, + "get", + async () => await settings.get(key), + pkt => pkt.decode()[0] === key + ) + const [k, b] = pkt.decode() + if (!b || !b.length) return missingValue + + try { + const s = b.toString() + const o = JSON.parse(s) + return o + } catch (e) { + return missingValue + } +} + +/** + * Deletes the given key from the settings + * @param key name of the key + */ +export async function deleteSetting(key: string) { + checkKey(key) + await settings.delete(key) +} +`, + "settings/src/client.ts": `import * as ds from "@devicescript/core" + +/** + * The settings object. + */ +export const settings = new ds.Settings() +`, + "settings/src/index.ts": `export * from "./client" +export * from "./api" +`, + "settings/src/main.ts": `import { describe, expect, test } from "@devicescript/test" +import { deleteSetting, readSetting, writeSetting } from "./api" + +describe("json", () => { + const key = "test" + test("write,read", async () => { + const obj = { [Math.random() + ""]: Math.random() } + await writeSetting(key, obj) + const r = await readSetting(key) + + expect(JSON.stringify(r)).toBe(JSON.stringify(obj)) + }) + + test("delete", async () => { + const obj = { [Math.random() + ""]: Math.random() } + await writeSetting(key, obj) + await deleteSetting(key) + const r = await readSetting(key) + expect(r).toBe(undefined) + }) +}) +`, + "spi/package.json": `{ + "name": "@devicescript/spi", + "version": "2.15.6", + "private": true, + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/spi" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "watch:devicescript": "devicescript devtools src/main.ts", + "watch": "yarn watch:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "devicescript": { + "bundle": true, + "library": true + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "spi/src/index.ts": `export * from "./spi" +`, + "spi/src/main.ts": `import { describe, expect, test } from "@devicescript/test" + +describe("drivers", () => {}) +`, + "spi/src/spi.ts": `import * as ds from "@devicescript/core" + +/** + * SPI configuration options + */ +export interface SPIConfig { + /** + * MISO pin + */ + miso?: ds.InputPin + /** + * MOSI pin + */ + mosi?: ds.OutputPin + /** + * SCK pin + */ + sck?: ds.OutputPin + mode?: number + /** + * Clock speed in Hz + */ + hz?: number +} + +type DsSpi = typeof ds & { + spiConfigure( + miso: number, + mosi: number, + sck: number, + mode: number, + hz: number + ): void + spiXfer(tx: Buffer, rx: Buffer): Promise +} + +function pinNum(p: ds.Pin) { + return p ? p.gpio : -1 +} + +export class SPI { + /** + * Configure the SPI bus + * @param cfg a set of configuration options + */ + configure(cfg: SPIConfig) { + ;(ds as DsSpi).spiConfigure( + pinNum(cfg.miso), + pinNum(cfg.mosi), + pinNum(cfg.sck), + cfg.mode || 0, + cfg.hz || 1000000 + ) + } + + /** + * Write a buffer to the SPI bus + */ + async write(buf: Buffer) { + await (ds as DsSpi).spiXfer(buf, null) + } + + /** + * Reads a buffer from the SPI bus + */ + async read(numbytes: number) { + const r = Buffer.alloc(numbytes) + await (ds as DsSpi).spiXfer(null, r) + return r + } + + /** + * Transfers a buffer to and from the SPI bus + * @param buf buffer to send + * @returns buffer received of the same size + */ + async transfer(buf: Buffer) { + const r = Buffer.alloc(buf.length) + await (ds as DsSpi).spiXfer(buf, r) + return r + } +} + +/** + * The default SPI instance. + */ +export const spi = new SPI() +`, + "test/package.json": `{ + "name": "@devicescript/test", + "version": "2.15.6", + "dependencies": {}, + "devDependencies": { + "@devicescript/cli": "*" + }, + "scripts": { + "setup": "devicescript build", + "build:devicescript": "devicescript build src/main.ts -F allFunctions", + "build": "yarn build:devicescript", + "test:devicescript": "devicescript run src/main.ts --test --test-self-exit -F allFunctions", + "test": "yarn test:devicescript", + "watch:devicescript": "devicescript devtools", + "watch": "yarn watch:devicescript", + "start": "yarn watch" + }, + "main": "./src/index.ts", + "license": "MIT", + "private": true, + "devicescript": { + "bundle": true, + "library": true + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/devicescript.git", + "directory": "packages/test" + }, + "files": [ + "src/*.ts", + "devsconfig.json" + ], + "keywords": [ + "devicescript" + ], + "author": "Microsoft", + "publishConfig": { + "access": "public" + } +} +`, + "test/src/core.ts": `import * as ds from "@devicescript/core" + +export type SuiteFunction = () => void +export type Subscription = () => void +export type SubscriptionAsync = Subscription | Promise +export type TestFunction = () => ds.AsyncVoid | SubscriptionAsync +export enum TestState { + NotRun, + Running, + Passed, + Error, + Ignored, +} +export interface TestOptions { + skip?: boolean + expectedError?: boolean +} +export class AssertionError extends Error { + constructor(matcher: string, message: string) { + super() + this.name = "AssertionError" + this.message = \`\${matcher}: \${message}\` + } +} +export interface TestQuery { + testFilter?: (test: TestNode) => boolean + suiteFilter?: (suite: SuiteNode) => boolean +} +export type RunOptions = TestQuery & {} +export class SetupTeardownNode { + constructor(readonly callback: TestFunction) {} + + async run(runOptions: RunOptions) { + return await this.callback() + } +} +export class SuiteNode { + readonly children: SuiteNode[] = [] + readonly befores: SetupTeardownNode[] = [] + readonly afters: SetupTeardownNode[] = [] + readonly tests: TestNode[] = [] + + constructor(public name: string) {} + + testCount(query?: TestQuery): number { + const { testFilter, suiteFilter } = query || {} + return ( + this.tests.filter(test => !testFilter || testFilter(test)).length + + this.children + .filter(child => !suiteFilter || suiteFilter(child)) + .reduce((prev, curr) => prev + curr.testCount(query), 0) + ) + } + + async run(options: RunOptions) { + if (this.name) console.log(this.name) + const { suiteFilter, testFilter } = options + + const result = { + total: 0, + pass: 0, + error: 0, + } + + for (const child of this.children.filter( + child => !suiteFilter || suiteFilter(child) + )) { + const r = await child.run(options) + result.total += r.total + result.pass += r.pass + result.error += r.error + } + for (const test of this.tests.filter( + test => !testFilter || testFilter(test) + )) { + const cleanups = [] + try { + // before tests + for (const before of this.befores) { + const cleanup = await before.run(options) + if (cleanup) cleanups.push(cleanup) + } + + // actually run test + await test.run(options) + + // run afters + for (const after of this.afters) { + const cleanup = await after.run(options) + if (cleanup) cleanups.push(cleanup) + } + } finally { + // final cleanup + for (const cleanup of cleanups) { + await cleanup() + } + } + result.total++ + switch (test.state) { + case TestState.Passed: + result.pass++ + break + case TestState.Error: + result.error++ + break + } + } + + return result + } +} +export class TestNode { + state: TestState = TestState.NotRun + error: unknown + + constructor( + public readonly name: string, + public readonly body: TestFunction, + public readonly options: TestOptions + ) {} + + async run(runOptions: RunOptions) { + let { expectedError, skip } = this.options || {} + console.log(\` \${this.name}\`) + try { + this.state = TestState.Running + this.error = undefined + + if (skip) { + this.state = TestState.Ignored + return + } + + const unsubscribe = await this.body() + if (typeof unsubscribe === "function") await unsubscribe() + + if (expectedError) { + // the throw below should be logged as error, not as expectedError + expectedError = false + throw new AssertionError( + "expectedError", + "expected an error from test" + ) + } + this.state = TestState.Passed + } catch (error: any) { + if (expectedError) { + this.state = TestState.Passed + } else { + this.state = TestState.Error + this.error = error + if (error.print) error.print() + } + } + } +} + +export const root = new SuiteNode("") +export let autoRun = true +let autoRunTestTimer: number +const AUTORUN_TEST_DELAY = 10 +const stack: SuiteNode[] = [root] + +function currentSuite() { + const parent = stack[stack.length - 1] + return parent +} + +/** + * Starts a new test suite. + * + * A suite lets you organize your tests and benchmarks so reports are more clear. + * @param name test suite name + * @param body function that registers tests or more suites + */ +export function describe(name: string, body: SuiteFunction) { + // debounce autorun + clearTimeout(autoRunTestTimer) + + const node = new SuiteNode(name) + + const parent = currentSuite() + parent.children.push(node) + + try { + stack.push(node) + body() + } finally { + stack.pop() + } + + // autorun + if (autoRun) { + if (!autoRunTestTimer) console.log(\`preparing to run tests...\`) + autoRunTestTimer = setTimeout(async () => { + await runTests() + ds.restart() + }, AUTORUN_TEST_DELAY) + } +} + +/** + * Defines a set of related expectations. It receives the test name and a function that holds the expectations to test. + * @alias it + */ +export function test(name: string, body: TestFunction, options?: TestOptions) { + const parent = currentSuite() + parent.tests.push(new TestNode(name, body, options)) +} + +/** + * Register a callback to be called before each of the tests in the current context runs. + * If the function returns a promise, waits until the promise resolve before running the test. + */ +export function beforeEach(body: TestFunction) { + const parent = currentSuite() + parent.befores.push(new SetupTeardownNode(body)) +} + +/** + * Register a callback to be called after each of the tests in the current context runs. + * If the function returns a promise, waits until the promise resolve before running the test. + */ +export function afterEach(body: TestFunction) { + const parent = currentSuite() + parent.afters.push(new SetupTeardownNode(body)) +} + +export async function runTests(options: TestQuery = {}) { + const { ...query } = options + const testOptions = { + ...query, + } + console.log(\`running \${root.testCount()} tests\`) + const { total, pass, error } = await root.run(testOptions) + console.log(\`tests: \${total}, pass: \${pass}, error: \${error}\`) + + if (error) throw new Error("test errors") +} +`, + "test/src/expect.ts": `import { AssertionError } from "./core" + +export function expect(value: T) { + return new Expect(value, false) +} +export class Expect { + constructor(readonly value: T, private readonly _not: boolean) {} + + private check(condition: boolean) { + return this._not ? !condition : condition + } + + not() { + return new Expect(this.value, !this._not) + } + + toThrow() { + if (typeof this.value !== "function") + throw new AssertionError("toThrow", "Expected function") + try { + ;(this.value as any)() + } catch (e) { + return + } + throw new AssertionError("toThrow", "Expected to throw") + } + + toBe(other: T): void { + if (this.check(other !== this.value)) + throw new AssertionError( + "toBe", + \`Expected \${other}, got \${this.value}\` + ) + } +} +`, + "test/src/index.ts": `export { + describe, + test, + runTests, + autoRun, + beforeEach, + afterEach, +} from "./core" +export { expect } from "./expect" +`, + "test/src/main.ts": `import { afterEach, beforeEach, describe, expect, test } from "." + +describe("pass", function () { + test("console.log", () => { + console.log(\`hi\`) + }) + test("console.log async", async () => { + console.log(\`hi (async)\`) + }) +}) + +describe("error", function () { + test( + "throw", + () => { + throw new Error("expected fail") + }, + { expectedError: true } + ) + test( + "undefined", + () => { + const s: { f: () => void } = undefined + s.f() + }, + { expectedError: true } + ) +}) +describe("expect", function () { + test("toBe.pass", () => { + expect(1).toBe(1) + }) + test( + "toBe.error", + () => { + expect(1).toBe(0) + }, + { expectedError: true } + ) + test("toThrow", () => { + expect(() => { + throw new Error("boom") + }).toThrow() + }) +}) + +let beforeCounter = 0 +describe("beforeEach", function () { + beforeEach(() => { + beforeCounter++ + }) + test("increment", () => { + expect(beforeCounter).toBe(1) + }) + test("increment2", () => { + expect(beforeCounter).toBe(2) + }) +}) + +let afterCounter = 0 +describe("afterEach", function () { + afterEach(() => { + afterCounter++ + }) + test("increment", () => { + expect(afterCounter).toBe(0) + }) + test("increment2", () => { + expect(afterCounter).toBe(1) + }) +}) +` + }; + + // compiler/src/board.ts + function boardInfos(info) { + return Object.values(info.boards).map( + (b) => boardInfo(b, info.archs[b.archId]) + ); + } + function boardInfo(cfg, arch) { + var _a, _b, _c, _d, _e, _f, _g; + const features = []; + const conn = (c) => (c == null ? void 0 : c.$connector) ? ` using ${c.$connector} connector` : ``; + const resolvePin = (p) => { + return p; + }; + if (((_a = cfg.jacdac) == null ? void 0 : _a.pin) !== void 0) + features.push( + `Jacdac on pin ${resolvePin(cfg.jacdac.pin)}${conn(cfg.jacdac)}` + ); + if (((_b = cfg.i2c) == null ? void 0 : _b.pinSDA) !== void 0) { + features.push( + `I2C on ${resolvePin(cfg.i2c.pinSDA)}/${resolvePin( + cfg.i2c.pinSCL + )}${conn(cfg.i2c)}` + ); + } + if (cfg.led) { + const ledpin = resolvePin(cfg.led.pin); + const help = ` (use [setStatusLight](/developer/status-light) to control)`; + if (cfg.led.type === 1) + features.push(`WS2812B RGB LED on pin ${ledpin} ${help}`); + else if (cfg.led.type > 99) + features.push(`custom LED ${help}`); + else if (((_c = cfg.led.rgb) == null ? void 0 : _c.length) == 3) + features.push( + `RGB LED on pins ${cfg.led.rgb.map((l) => l.pin).join(", ")} ${help}` + ); + else if (ledpin !== void 0) + features.push(`LED on pin ${ledpin} ${help}`); + } + if (((_d = cfg.log) == null ? void 0 : _d.pinTX) !== void 0) + features.push( + `Serial logging on pin ${resolvePin(cfg.log.pinTX)} at ${cfg.log.baud || 115200} 8N1` + ); + const opt = (_e = cfg.$services) != null ? _e : []; + const auto = (_f = cfg.services) != null ? _f : []; + const services = auto.concat(opt).map((s) => { + let r = s.name; + if (s.service != s.name) + r += ` (${s.service})`; + if (auto.includes(s)) + r += ` (auto-start)`; + return r; + }); + const pi = pinsInfo(arch, cfg); + const b = { + name: cfg.devName, + arch: arch == null ? void 0 : arch.name, + description: cfg.$description, + urls: { + info: cfg.url, + firmware: cfg.$fwUrl + }, + features, + services, + pinInfo: pi.infos, + pinInfoText: pi.desc, + errors: pi.errors, + markdown: "" + }; + const lines = [`## ${b.name}`, b.description]; + const urlkeys = Object.keys(b.urls || {}).filter((k) => !!b.urls[k]); + if (urlkeys.length) + lines.push( + "Links: " + urlkeys.map((k) => `[${k}](${b.urls[k]})`).join(" ") + ); + lines.push(...b.features.map((f) => `* ${f}`)); + lines.push(...b.services.map((f) => `* Service: ${f}`)); + b.markdown = lines.filter((l) => !!l).join("\n"); + if ((_g = b.pinInfoText) == null ? void 0 : _g.trim()) + b.markdown += "\n\n```\n" + b.pinInfoText + "\n```\n"; + return b; + } + function deviceConfigToMarkdown(board, arch, spec) { + var _a; + const { devName, $description, url, $fwUrl, id: devId, archId } = board; + const { id } = spec || {}; + const boardJson = normalizeDeviceConfig(board, { ignoreFirmwareUrl: true }); + const info = boardInfo(board, arch); + if ((_a = info.errors) == null ? void 0 : _a.length) { + console.error(`errors in ${board.id}: +${info.errors.join("\n")}`); + } + const description = $description || (spec == null ? void 0 : spec.description); + const stores = unique([url, ...(spec == null ? void 0 : spec.storeLink) || []].filter((u) => !!u)); + const r = [ + `--- +description: ${devName} +--- +# ${devName} +`, + description ? ` +${description} +` : void 0, + id ? ` +![${devName} picture](${deviceCatalogImage(spec, "catalog")})` : void 0, + ` +## Features +`, + ...info.features.map((f) => `- ${f}`), + ...info.services.map((f) => `- Service: ${f}`), + !boardJson.i2c && ` +:::caution + +I2C pins are not [configured](/developer/board-configuration). + +::: +`, + ` +## Stores +`, + ...stores.map((url2) => `- [${url2}](${url2})`), + ` +## Pins +`, + `${renderPinout(info.pinInfoText)} + +`, + ` +## DeviceScript import +`, + ` +You must add this import statement to load +the pinout configuration for this device. + +In [Visual Studio Code](/getting-started/vscode), +click the **wand** icon on the file menu and +select "${devName}". +`, + `\`\`\`ts +import { pins, board } from "@dsboard/${devId}" +\`\`\``, + ` +{@import optional ./${devId.replace(/_/g, "-")}-examples.mdp}`, + ` +## Firmware update + +In Visual Studio Code, +select **DeviceScript: Flash Firmware...** from the command palette. + +Run this [command line](/api/cli) command and follow the instructions. + +\`\`\`bash +devicescript flash --board ${devId} +\`\`\` + +`, + $fwUrl ? `- [Firmware](${$fwUrl}) +` : void 0, + `## Configuration + +\`\`\`json title="${devId}.json" +${JSON.stringify(boardJson, null, 4)} +\`\`\` +` + ]; + return r.filter((s) => !!s).join("\n"); + function renderPinout(pinout) { + const pins = pinout.split(/\n/g).map((line) => line.split(/[:,]/g)); + return [ + `| pin name | hardware id | features |`, + `|:---------|:------------|---------:|`, + ...pins.map( + (pin) => `| **${pin[0]}** | ${pin[1]} | ${pin.slice(2).join(", ")} |` + ) + ].join("\n"); + } + } + function boardMarkdownFiles() { + const buildConfig = resolveBuildConfig(); + const { boards, archs } = buildConfig; + const catalog = new DeviceCatalog(); + const r = {}; + const boardsjson = {}; + Object.keys(boards).forEach((boardid) => { + const board = boards[boardid]; + const { archId, productId, devName, $description, url } = board; + if (!archId || archId === "wasm" || archId == "native") + return; + const spec = catalog.specificationFromProductIdentifier(parseAnyInt(productId)); + const aid = architectureFamily(archId); + const pa = `${aid}/${boardid.replace(/_/g, "-")}`; + r[`${pa}.mdx`] = deviceConfigToMarkdown( + board, + archs[board.archId], + spec + ); + const descr = ellipseFirstSentence($description) || ""; + const boardjson = board; + boardsjson[boardid] = boardjson; + const aidmd = `${aid}/boards.mdp`; + const img = deviceCatalogImage(spec, "preview"); + if (img && url) { + r[aidmd] = (r[aidmd] || "") + ` +`; + boardjson.img = deviceCatalogImage(spec, "catalog"); + } + }); + r[`boards.json`] = JSON.stringify(boardsjson, null, 2); + return r; + } + function expandPinFunctionInfo(info) { + if (!info) + return []; + const cached = info["#pinInfo"]; + if (cached) + return cached; + const expanded = {}; + const ainfo = info; + function expand(fun) { + var _a; + if (expanded[fun]) + return expanded[fun]; + expanded[fun] = []; + for (let e of ((_a = ainfo[fun]) != null ? _a : "").split(",")) { + e = e.trim(); + if (!e) + continue; + const m = /^(\d+)-(\d+)$/.exec(e); + if (m) { + let p = parseInt(m[1]); + let endp = parseInt(m[2]); + if (p <= endp) { + while (p <= endp) { + expanded[fun].push(p); + p++; + } + continue; + } + } + if (/^\d+$/.test(e)) { + expanded[fun].push(parseInt(e)); + continue; + } + if (ainfo[e] !== void 0) { + expanded[fun].push(...expand(e)); + continue; + } + throw new Error(`invalid pin range: ${fun}: ...${e}...`); + } + return expanded[fun]; + } + const res = []; + function set(p, fn) { + if (res[p] === void 0) + res[p] = []; + if (!res[p].includes(fn)) + res[p].push(fn); + } + for (const k of Object.keys(info)) { + if (k[0] == "#") + continue; + for (const p of expand(k)) + set(p, k); + } + for (const p of expand("io")) { + set(p, "input"); + set(p, "output"); + } + Object.defineProperty(info, "#pinInfo", { + value: res, + enumerable: false + }); + return res; + } + function pinFunctions(info, p, keepInputOutput = false) { + var _a; + const res = (_a = expandPinFunctionInfo(info)[p]) != null ? _a : []; + if (!keepInputOutput) { + if (res.includes("io")) + return res.filter((r) => r != "input" && r != "output"); + } + return res; + } + function pinHasFunction(info, p, fn) { + return pinFunctions(info, p, true).includes(fn); + } + function pinsInfo(arch, devcfg) { + var _a, _b; + const infos = []; + const errors2 = []; + function addPin(label, gpio) { + const name = `${label}=${gpio}`; + if (typeof gpio != "number") + return errors2.push(`invalid pin: ${name}`); + const functions = pinFunctions(arch == null ? void 0 : arch.pins, gpio); + if (functions.length == 0) + return errors2.push(`invalid pin: ${name} has no functions`); + const ex = infos.find((p) => p.gpio == gpio); + if (ex && ex.label[0] != "@") + return errors2.push( + `GPIO${gpio} marked as both ${ex.label} and ${label}` + ); + for (const fn of ["flash", "psram", "usb"]) { + if (functions.includes(fn)) + errors2.push(`${name} has '${fn}' function`); + } + infos.push({ + label, + commonLabel: label, + silkLabel: label, + functionLabel: label.includes(".") ? label : void 0, + gpio, + functions + }); + } + function addPinExt(label, refOrGpio) { + assert(label.includes(".")); + if (typeof refOrGpio == "string") { + const ex = infos.find((p) => p.commonLabel == refOrGpio); + if (!ex) + return errors2.push( + `${label} is set to ${refOrGpio} which wasn't found` + ); + ex.functionLabel = label; + ex.label = label; + return; + } + return addPin(label, refOrGpio); + } + for (const lbl of Object.keys((_a = devcfg == null ? void 0 : devcfg.pins) != null ? _a : {})) { + if (lbl.startsWith("#")) + continue; + const gpio = devcfg.pins[lbl]; + addPin(lbl, gpio); + } + function validateConfig(obj, path0) { + if (Array.isArray(obj)) { + obj.forEach((e, i) => { + var _a2; + const p = e.service ? `${path0}.${(_a2 = e.name) != null ? _a2 : e.service}[${i}]` : `${path0}[${i}]`; + validateConfig(e, p); + }); + } else if (obj && typeof obj == "object") + for (const k of Object.keys(obj)) { + if (k.startsWith("#")) + continue; + const path = (path0 ? path0 + "." : "") + k; + if (k != "pins" && k.startsWith("pin")) { + addPinExt(path, obj[k]); + } else { + validateConfig(obj[k], path); + } + } + } + for (const [silkLabel, commonLabel] of Object.entries((_b = devcfg.$pins) != null ? _b : {})) { + const ex = infos.find((i) => i.commonLabel == commonLabel); + if (ex) { + ex.label = silkLabel; + ex.silkLabel = silkLabel; + } + } + validateConfig(devcfg, ""); + const desc = infos.filter((p) => !p.label.startsWith("@")).map( + (p) => `${p.silkLabel}: GPIO${p.gpio}, ${p.functionLabel ? p.functionLabel + ", " : ""}${p.functions.join(", ")}` + ).join("\n"); + return { desc, infos, errors: errors2 }; + } + + // compiler/src/specgen.ts + var REGISTER_NUMBER = "Register"; + var REGISTER_BOOL = "Register"; + var REGISTER_STRING = "Register"; + var REGISTER_BUFFER = "Register"; + var REGISTER_ARRAY = "Register"; + function unresolveBuildConfig(cfg) { + if (!cfg) + cfg = {}; + const r = { + hwInfo: cfg.hwInfo, + addArchs: cfg.addArchs, + addBoards: cfg.addBoards, + addServices: cfg.addServices + }; + return JSON.parse(JSON.stringify(r)); + } + function resolveBuildConfig(local) { + var _a, _b, _c, _d, _e; + const r = { + hwInfo: Object.assign({}, (_a = local == null ? void 0 : local.hwInfo) != null ? _a : {}), + pkgJson: Object.assign({}, (_b = local == null ? void 0 : local.pkgJson) != null ? _b : {}), + addArchs: local == null ? void 0 : local.addArchs, + addBoards: local == null ? void 0 : local.addBoards, + addServices: local == null ? void 0 : local.addServices, + boards: Object.assign({}, boardSpecifications.boards), + archs: Object.assign({}, boardSpecifications.archs), + services: jacdacDefaultSpecifications.concat((_c = local == null ? void 0 : local.addServices) != null ? _c : []) + }; + for (const arch of (_d = local == null ? void 0 : local.addArchs) != null ? _d : []) + r.archs[arch.id] = arch; + for (const board of (_e = local == null ? void 0 : local.addBoards) != null ? _e : []) + r.boards[board.id] = board; + return r; + } + function isRegister3(k) { + return k == "ro" || k == "rw" || k == "const"; + } + function toHex3(n) { + if (n === void 0) + return ""; + if (n < 0) + return "-" + toHex3(n); + return "0x" + n.toString(16); + } + function noCtorSpec(info) { + return [].indexOf(info.classIdentifier) > -1; + } + function noClientMarkdownSpec(info) { + return [SRV_CONTROL2].indexOf(info.classIdentifier) > -1; + } + function ignoreSpec(info) { + return info.status === "deprecated" || [ + SRV_ROLE_MANAGER2, + SRV_LOGGER2, + SRV_BOOTLOADER2, + SRV_PROTO_TEST2, + SRV_INFRASTRUCTURE2, + SRV_PROXY2, + SRV_UNIQUE_BRAIN2, + SRV_DASHBOARD2, + SRV_BRIDGE2, + SRV_DEVICE_SCRIPT_CONDITION2, + SRV_DEVICE_SCRIPT_MANAGER2, + SRV_WSSK2, + SRV_CLOUD_CONFIGURATION2, + SRV_CODAL_MESSAGE_BUS2, + SRV_DEVS_DBG2, + SRV_TCP2, + SRV_GPIO2 + ].indexOf(info.classIdentifier) > -1; + } + var sysCache; + function pktName(pkt) { + if (!sysCache) { + sysCache = {}; + for (const pkt2 of jacdacDefaultSpecifications.find( + (s) => s.camelName == "system" + ).packets) { + if (["value", "active", "inactive"].includes(pkt2.name)) + continue; + sysCache[pkt2.kind + ":" + pkt2.identifier] = pkt2; + } + } + const sys = sysCache[pkt.kind + ":" + pkt.identifier]; + if (sys) { + if (sys.name == "intensity" && pkt.fields.length == 1 && pkt.fields[0].type == "bool") + return "enabled"; + return camelize(sys.name); + } + return camelize(pkt.name); + } + function specToDeviceScript(info) { + var _a; + let r = ""; + let srv = ""; + let lkp = ""; + for (const en of Object.values(info.enums)) { + const enPref = enumName(info, en.name); + r += `enum ${enPref} { // ${cStorage(en.storage)} +`; + for (const k of Object.keys(en.members)) { + r += " " + k + " = " + toHex3(en.members[k]) + ",\n"; + } + r += "}\n\n"; + } + if (ignoreSpec(info)) + return r; + const clname = upperCamel(info.camelName); + const isSensor = info.extends.includes("_sensor"); + const docUrl = info.catalog !== false ? `https://microsoft.github.io/devicescript/api/clients/${info.shortId}/` : void 0; + { + let cmt = (info.notes["short"] || info.name) + "\n\n"; + if (info.notes["long"]) + cmt += "@remarks\n\n" + info.notes["long"] + "\n\n"; + if (!info.status || info.status === "experimental") + cmt += "@experimental\n"; + if (info.group) + cmt += `@group ${info.group} +`; + if ((_a = info.tags) == null ? void 0 : _a.length) + cmt += `@category ${info.tags.join(", ")} +`; + if (docUrl) + cmt += `@see {@link ${docUrl} | Documentation}`; + r += wrapComment("devs", patchLinks(cmt)); + } + r += `class ${clname} extends ${isSensor ? "Sensor" : "Role"} { +`; + const ibase = info.shortId == "_base" ? "ServerInterface" : isSensor ? "SensorServerSpec" : "BaseServerSpec"; + srv += `interface ${clname}ServerSpec extends ${ibase} { +`; + lkp += `interface ${clname}LookupSpec extends ServiceSpec { +`; + if (noCtorSpec(info)) + r += wrapComment("devs", "This service cannot be accessed via role.") + " private constructor()\n"; + else + r += wrapComment("devs", "Create new service client.") + " constructor(roleName?: string)\n"; + if (info.shortId != "_sensor") + r += wrapComment("devs", `Static specification for ${info.name}`) + ` static spec: ${clname}LookupSpec +`; + let codes = wrapComment("devs", `Spec-code definitions for ${info.name}`) + `enum ${clname}Codes { +`; + let lastName = ""; + info.packets.forEach((pkt) => { + if (pkt.derived || pkt.pipeType) + return; + const cmt = addComment(pkt); + let kw = ""; + let tp = ""; + let sx = ""; + let argtp = packetType(info, pkt); + const client = !!pkt.client; + const nameOfPkt = pktName(pkt); + const opt = pkt.optional ? "?" : ""; + let enumPref = ""; + let enumMask = 0; + if (isRegister3(pkt.kind)) { + enumPref = "Reg"; + enumMask = 4096 /* REGISTER */; + if (client) { + tp = "ClientRegister"; + sx = "()"; + } else { + kw = "readonly "; + tp = "Register"; + const rettp = nameOfPkt == "instanceName" ? argtp : `AsyncValue<${argtp}>`; + srv += ` ${nameOfPkt}${opt}(): ${rettp} +`; + if (pkt.kind == "rw") { + const args = pktFields(info, pkt); + srv += ` set_${nameOfPkt}${opt}(${args}): AsyncValue +`; + } + lkp += ` lookup(name: "${nameOfPkt}"): RegisterSpec<${argtp}> +`; + } + } else if (pkt.kind == "event") { + enumPref = "Event"; + enumMask = 32768 /* EVENT */; + kw = "readonly "; + tp = "Event"; + lkp += ` lookup(name: "${nameOfPkt}"): EventSpec<${argtp}> +`; + } else if (pkt.kind == "command") { + enumPref = "Cmd"; + enumMask = 0 /* COMMAND */; + r += wrapComment( + "devs", + cmt.comment + pkt.fields.filter((f) => !!f).map((f) => { + var _a2; + return `@param ${f.name} - ${(_a2 = f.unit) != null ? _a2 : ""}`; + }).join("\n") + ); + r += ` ${commandSig(info, pkt).sig} +`; + srv += ` ${commandSig(info, pkt, true).sig} +`; + lkp += ` lookup(name: "${nameOfPkt}"): ActionSpec<${argtp}> +`; + lastName = nameOfPkt; + } else if (pkt.kind == "report") { + enumPref = "Report"; + enumMask = 8192 /* REPORT */; + if (lastName != nameOfPkt) + lkp += ` lookup(name: "${nameOfPkt}"): ReportSpec<${argtp}> +`; + } + if (enumPref) { + const id = upperFirst(pktName(pkt)); + const code = enumMask | pkt.identifier; + codes += ` ${enumPref}${id} = 0x${code.toString(16)}, +`; + } + if (tp) { + if (docUrl) + cmt.comment += `@see {@link ${docUrl}#${pkt.kind}:${pktName( + pkt + )} | Documentation}`; + r += wrapComment("devs", cmt.comment); + r += ` ${kw}${nameOfPkt}${sx}: ${tp}<${argtp}> +`; + } + }); + codes += "}\n\n"; + r += "}\n\n" + codes; + srv += "}\n"; + lkp += "}\n"; + r += srv; + r += lkp; + return r.replace(/ *$/gm, ""); + } + var pinFunToType = { + io: "IOPin", + input: "InputPin", + output: "OutputPin", + analogIn: "AnalogInPin", + analogOut: "AnalogOutPin" + }; + function boardFile(binfo, arch) { + var _a; + let r = ` +/** + * Pin mapping and built-in services for ${binfo.devName} + * + * ${binfo.$custom || !binfo.archId || !binfo.id ? "This is a custom board definition." : `@see {@link https://microsoft.github.io/devicescript/devices/${architectureFamily(binfo.archId)}/${binfo.id.replace(/_/g, "-")}/ Catalog}`} + * ${binfo.url ? `@see {@link ${binfo.url} Store}` : ``} +*/ +declare module "@dsboard/${binfo.id}" { +`; + r += ` import * as ds from "@devicescript/core" +`; + r += ` interface Board { +`; + for (const service of (_a = binfo.$services) != null ? _a : []) { + const serv = upperFirst(service.service.replace(/.*:/, "")); + const inst = service.name ? upperFirst(service.name) : serv; + r += wrapComment( + "devs", + `Start built-in ${inst} +@${TSDOC_START} ${JSON.stringify(service)}` + ); + r += ` start${inst}(roleName?: string): ds.${serv} +`; + } + r += ` } +`; + r += ` const board: Board +`; + r += ` interface BoardPins { +`; + const { infos } = pinsInfo(arch, binfo); + for (const pin of infos) { + if (pin.label.startsWith("@") || pin.functionLabel && !pin.functionLabel.startsWith("$services") || pin.functionLabel === pin.silkLabel) + continue; + const funs = pin.functions; + const types = funs.map((s) => pinFunToType[s]).filter((s) => !!s).map((s) => "ds." + s); + if (types.length == 0) + r += ` // ${pin.label} seems invalid +`; + else { + const cmn = pin.commonLabel != pin.silkLabel; + r += [ + `/**`, + ` * Pin ${pin.silkLabel} (GPIO${pin.gpio}, ${funs.join(", ")})`, + pin.functionLabel ? ` * @note can be also used as ${pin.functionLabel}` : void 0, + cmn ? ` * @${TSDOC_NATIVE} GPIO.${pin.commonLabel}` : void 0, + ` */`, + `${pin.silkLabel}: ${types.join(" & ")}` + ].filter(Boolean).map((l) => " " + l + "\n").join(""); + } + } + r += ` } +`; + r += ` /** +`; + r += ` * Pin definitions for ${binfo.devName} +`; + r += ` * +`; + r += ` * @${TSDOC_NATIVE} GPIO +`; + r += ` */ +`; + r += ` const pins: BoardPins +`; + r += `} +`; + return r; + } + function preludeFiles(config) { + if (!config) + config = resolveBuildConfig(); + const pref = "node_modules/@devicescript/"; + const r = {}; + for (const k of Object.keys(prelude)) { + r[pref + k] = prelude[k]; + } + const thespecs = config.services.map(specToDeviceScript).filter((n) => !!n).join("\n"); + const withmodule = `declare module "@devicescript/core" { + /** + * Version of the DeviceScript runtime corresponding to this declaration file. + */ + const RUNTIME_VERSION = "${runtimeVersion()}" +${thespecs} +} +`; + r[pref + "core/src/devicescript-spec.d.ts"] = withmodule; + r[pref + `core/src/devicescript-boards.d.ts`] = Object.values(config.boards).map((b) => boardFile(b, config.archs[b.archId])).join("\n"); + return r; + } + var serviceBuiltinPackages = { + [SRV_I2C2]: "i2c", + [SRV_SETTINGS2]: "settings", + [SRV_CLOUD_ADAPTER2]: "cloud", + [SRV_ROS2]: "ros", + [SRV_GPIO2]: "gpio" + }; + function serviceSpecificationToMarkdown(info) { + const { status, camelName } = info; + const reserved = { switch: "sw" }; + const clname = upperCamel(camelName); + const varname = reserved[camelName] || camelName; + const baseclass = info.extends.indexOf("_sensor") >= 0 ? "Sensor" : "Role"; + if (status === "deprecated") { + return `--- +pagination_prev: null +pagination_next: null +unlisted: true +--- + +# ${clname} + +The [${info.name} service](https://microsoft.github.io/jacdac-docs/services/${info.shortId}/) is deprecated and not supported in DeviceScript. + +`; + } + if (ignoreSpec(info) || noCtorSpec(info) || noClientMarkdownSpec(info)) { + return `--- +pagination_prev: null +pagination_next: null +unlisted: true +--- +# ${clname} + +The [${info.name} service](https://microsoft.github.io/jacdac-docs/services/${info.shortId}/) is used internally by the runtime +and is not directly programmable in DeviceScript. + +{@import optional ../clients-custom/${info.shortId}.mdp} +`; + } + const builtinPackage = serviceBuiltinPackages[info.classIdentifier]; + if (builtinPackage) { + return `--- +pagination_prev: null +pagination_next: null +description: DeviceScript client for ${info.name} service +--- +# ${clname} + +The [${info.name} service](https://microsoft.github.io/jacdac-docs/services/${info.shortId}/) is used internally by the +[\`@devicescript/${builtinPackage}\`](/developer/packages) package. + +{@import optional ../clients-custom/${info.shortId}.mdp} +`; + } + let r = [ + `--- +pagination_prev: null +pagination_next: null +description: DeviceScript client for ${info.name} service +--- +# ${clname} +`, + status !== "stable" && info.shortId[0] !== "_" ? ` +:::caution +This service is ${status} and may change in the future. +::: +` : void 0, + patchLinks(info.notes["short"]), + ` +{@import optional ../clients-custom/${info.shortId}-short.mdp} +`, + info.notes["long"] ? `## About + +${patchLinks(info.notes["long"])} +` : void 0, + ` +\`\`\`ts +import { ${clname} } from "@devicescript/core" + +const ${varname} = new ${clname}() +\`\`\` + `, + `{@import optional ../clients-custom/${info.shortId}-about.mdp}` + ]; + const cmds = info.packets.filter( + (pkt) => pkt.kind === "command" && !pkt.pipeType && !pkt.internal && !pkt.derived && !pkt.lowLevel + ); + if (cmds.length) + r.push("## Commands", ""); + cmds.forEach((pkt) => { + const { sig, name } = commandSig(info, pkt); + r.push( + `### ${name}`, + "", + pkt.description, + ` +\`\`\`ts skip no-run +${varname}.${sig} +\`\`\` +` + ); + }); + const regs = info.packets.filter((pkt) => isRegister3(pkt.kind)).filter((pkt) => !pkt.derived && !pkt.internal && !pkt.lowLevel); + if (regs == null ? void 0 : regs.length) { + r.push( + "## Registers", + "", + `{@import optional ../clients-custom/${info.shortId}-registers.mdp}`, + "" + ); + } + regs.forEach((pkt) => { + const cmt = addComment(pkt); + const nobuild = status === "stable" && !pkt.client ? "" : "skip"; + const pname = pktName(pkt); + const isConst = pkt.kind === "const"; + let tp = void 0; + if (cmt.needsStruct) { + tp = REGISTER_ARRAY; + } else { + if (pkt.fields.length == 1 && pkt.fields[0].type == "string") + tp = REGISTER_STRING; + else if (pkt.fields.length == 1 && pkt.fields[0].type == "bytes") + tp = REGISTER_BUFFER; + else if (pkt.fields[0].type == "bool") + tp = REGISTER_BOOL; + else + tp = REGISTER_NUMBER; + } + const isNumber2 = tp === REGISTER_NUMBER; + const isBoolean = tp === REGISTER_BOOL; + const isString = tp === REGISTER_STRING; + r.push( + `### ${pname} {#${pkt.kind}:${pktName(pkt)}} +`, + pkt.description, + "", + `- type: \`${tp}\` (packing format \`${pkt.packFormat}\`)`, + pkt.optional ? `- optional: this register may not be implemented` : void 0, + isConst ? `- constant: the register value will not change (until the next reset)` : void 0, + "", + !isNumber2 && !isBoolean && !isString ? void 0 : pkt.kind === "rw" ? `- read and write +\`\`\`ts ${nobuild} +import { ${clname} } from "@devicescript/core" + +const ${varname} = new ${clname}() +// ... +const value = await ${varname}.${pname}.read() +await ${varname}.${pname}.write(value) +\`\`\` +` : `- read only +\`\`\`ts ${nobuild} +import { ${clname} } from "@devicescript/core" + +const ${varname} = new ${clname}() +// ... +const value = await ${varname}.${pname}.read() +\`\`\` +`, + isConst ? void 0 : `- track incoming values +\`\`\`ts ${nobuild} +import { ${clname} } from "@devicescript/core" + +const ${varname} = new ${clname}() +// ... +${varname}.${pname}.subscribe(async (value) => { + ... +}) +\`\`\` +`, + ` +:::note + +\`write\` and \`read\` will block until a server is bound to the client. + +::: +` + ); + }); + const evts = info.packets.filter( + (pkt) => pkt.kind === "event" && !pkt.internal && !pkt.derived && !pkt.lowLevel + ); + if (evts.length) + r.push("## Events", ""); + evts.forEach((pkt) => { + const pname = pktName(pkt); + r.push( + `### ${pname}`, + "", + pkt.description, + ` +\`\`\`ts skip no-run +${varname}.${pname}.subscribe(() => { + +}) +\`\`\` +` + ); + }); + r.push(` +{@import optional ../clients-custom/${info.shortId}.mdp} +`); + return r.filter((s) => s !== void 0).join("\n"); + } + function enumName(info, n) { + return upperCamel(info.camelName) + upperCamel(n); + } + function patchLinks(n) { + return n == null ? void 0 : n.replace(/\]\(\/services\//g, "](/api/clients/"); + } + function packetType(info, pkt) { + const cmt = addComment(pkt); + if (cmt.needsStruct) { + const types = pkt.fields.map((f) => memType(info, f)); + const allSame = types.every((t) => t == types[0]); + if (pkt.fields.some((p) => p.startRepeats)) + return allSame ? types[0] + "[]" : "any[]"; + return `[${types.join(", ")}]`; + } + if (pkt.fields.length == 0) + return "void"; + assert(pkt.fields.length == 1); + return memType(info, pkt.fields[0]); + } + function pktFields(info, pkt) { + const earlyRepeats = pkt.fields.slice(0, pkt.fields.length - 1).some((f) => f.startRepeats); + const fields = pkt.fields.map((f) => { + const tp = memType(info, f); + if (f.startRepeats && !earlyRepeats) + return `...${f.name}: ${tp}[]`; + else + return `${f.name == "_" ? "value" : f.name}: ${tp}`; + }).join(", "); + return fields; + } + function commandSig(info, pkt, srv = false) { + const fields = pktFields(info, pkt); + let name = pktName(pkt); + const report = info.packets.find( + (p) => p.kind == "report" && p.identifier == pkt.identifier + ); + const retType = !report ? "void" : packetType(info, report); + if (srv && pkt.optional) + name += "?"; + const ret = srv ? `AsyncValue<${retType}>` : `Promise`; + const sig = `${name}(${fields}): ${ret}`; + return { + sig, + name + }; + } + function memType(info, f) { + switch (f.type) { + case "string": + case "string0": + return "string"; + case "bytes": + return "Buffer"; + case "bool": + return "boolean"; + case "f32": + case "f64": + return "number"; + case "devid": + return "Buffer"; + case "pipe_port": + case "pipe": + return "unknown"; + default: + if (/^[iu]\d+(\.\d+)?$/.test(f.type)) + return "number"; + if (/^u8\[\d+\]$/.test(f.type)) + return "Buffer"; + if (info.enums[f.type]) + return enumName(info, f.type); + oops(`unknown type ${f.type} in spec: ${info.name}`); + } + } + function clientsMarkdownFiles() { + const { services } = resolveBuildConfig(); + const r = {}; + services.forEach((spec) => { + const md = serviceSpecificationToMarkdown(spec); + if (md) + r[`${spec.shortId}.md`] = md; + }); + r["index.mdx"] = `--- +title: Clients +--- + +# Clients + +{@import optional ../clients-custom/index.mdp} +`; + return r; + } + + // compiler/src/constantfold.ts + var ts2 = __toESM(require_typescript()); + var import_typescript = __toESM(require_typescript()); + function unaryOpConst(tok, aa) { + if (!aa) + return null; + const a = aa.val; + switch (tok) { + case import_typescript.SyntaxKind.PlusToken: + return { val: +a }; + case import_typescript.SyntaxKind.MinusToken: + return { val: -a }; + case import_typescript.SyntaxKind.TildeToken: + return { val: ~a }; + case import_typescript.SyntaxKind.ExclamationToken: + return { val: !a }; + default: + return null; + } + } + function binaryOpConst(tok, aa, bb) { + if (!aa || !bb) + return null; + const a = aa.val; + const b = bb.val; + switch (tok) { + case import_typescript.SyntaxKind.PlusToken: + return { val: a + b }; + case import_typescript.SyntaxKind.MinusToken: + return { val: a - b }; + case import_typescript.SyntaxKind.SlashToken: + return { val: a / b }; + case import_typescript.SyntaxKind.PercentToken: + return { val: a % b }; + case import_typescript.SyntaxKind.AsteriskToken: + return { val: a * b }; + case import_typescript.SyntaxKind.AsteriskAsteriskToken: + return { val: a ** b }; + case import_typescript.SyntaxKind.AmpersandToken: + return { val: a & b }; + case import_typescript.SyntaxKind.BarToken: + return { val: a | b }; + case import_typescript.SyntaxKind.CaretToken: + return { val: a ^ b }; + case import_typescript.SyntaxKind.LessThanLessThanToken: + return { val: a << b }; + case import_typescript.SyntaxKind.GreaterThanGreaterThanToken: + return { val: a >> b }; + case import_typescript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + return { val: a >>> b }; + case import_typescript.SyntaxKind.LessThanEqualsToken: + return { val: a <= b }; + case import_typescript.SyntaxKind.LessThanToken: + return { val: a < b }; + case import_typescript.SyntaxKind.GreaterThanEqualsToken: + return { val: a >= b }; + case import_typescript.SyntaxKind.GreaterThanToken: + return { val: a > b }; + case import_typescript.SyntaxKind.EqualsEqualsToken: + return { val: a == b }; + case import_typescript.SyntaxKind.EqualsEqualsEqualsToken: + return { val: a === b }; + case import_typescript.SyntaxKind.ExclamationEqualsEqualsToken: + return { val: a !== b }; + case import_typescript.SyntaxKind.ExclamationEqualsToken: + return { val: a != b }; + case import_typescript.SyntaxKind.BarBarToken: + return { val: a || b }; + case import_typescript.SyntaxKind.AmpersandAmpersandToken: + return { val: a && b }; + default: + return null; + } + } + function constantFold(fallback, e0) { + return constantFoldMem(e0); + function constantFoldMem(expr) { + if (!expr) + return null; + const ee = expr; + if (ee.__ds_folded === void 0) { + ee.__ds_folded = null; + const res = constantFoldCore(expr); + ee.__ds_folded = res; + } + return ee.__ds_folded; + } + function constantFoldCore(expr) { + if (!expr) + return null; + if (isTemplateOrStringLiteral(expr)) { + return { val: expr.text }; + } else if (ts2.isPrefixUnaryExpression(expr)) { + const inner = constantFoldMem(expr.operand); + return unaryOpConst(expr.operator, inner); + } else if (ts2.isBinaryExpression(expr)) { + const left = constantFoldMem(expr.left); + if (!left) + return null; + const right = constantFoldMem(expr.right); + if (!right) + return null; + return binaryOpConst(expr.operatorToken.kind, left, right); + } else if (ts2.isNumericLiteral(expr)) { + const v = parseFloat(expr.text); + if (isNaN(v)) + return null; + return { val: v }; + } else if (ts2.isAsExpression(expr)) { + return constantFoldMem(expr.expression); + } + switch (expr.kind) { + case import_typescript.SyntaxKind.NullKeyword: + return { val: null }; + case import_typescript.SyntaxKind.TrueKeyword: + return { val: true }; + case import_typescript.SyntaxKind.FalseKeyword: + return { val: false }; + case import_typescript.SyntaxKind.UndefinedKeyword: + return { val: void 0 }; + default: + return fallback(expr); + } + } + } + function isTemplateOrStringLiteral(node) { + switch (node.kind) { + case import_typescript.SyntaxKind.JsxText: + case import_typescript.SyntaxKind.TemplateHead: + case import_typescript.SyntaxKind.TemplateMiddle: + case import_typescript.SyntaxKind.TemplateTail: + case import_typescript.SyntaxKind.StringLiteral: + case import_typescript.SyntaxKind.NoSubstitutionTemplateLiteral: + return true; + default: + return false; + } + } + + // compiler/src/compiler.ts + var JD_SERIAL_HEADER_SIZE2 = 16; + var JD_SERIAL_MAX_PAYLOAD_SIZE2 = 236; + var CMD_GET_REG2 = 4096; + var CMD_SET_REG2 = 8192; + var DEVS_FILE_PREFIX = "bytecode"; + var DEVS_BYTECODE_FILE = `${DEVS_FILE_PREFIX}.devs`; + var DEVS_LIB_FILE = `${DEVS_FILE_PREFIX}-lib.json`; + var DEVS_DBG_FILE = `${DEVS_FILE_PREFIX}-dbg.json`; + var DEVS_SIZES_FILE = `${DEVS_FILE_PREFIX}-sizes.md`; + var TSDOC_PART = "devsPart"; + var TSDOC_SERVICES = "devsServices"; + var TSDOC_START = "devsStart"; + var TSDOC_WHEN_USED = "devsWhenUsed"; + var TSDOC_NATIVE = "devsNative"; + var TSDOC_TAGS = [ + TSDOC_PART, + TSDOC_SERVICES, + TSDOC_START, + TSDOC_WHEN_USED, + TSDOC_NATIVE + ]; + var coreModule = "@devicescript/core"; + var globalFunctions = [ + "parseInt", + "parseFloat", + "setTimeout", + "clearTimeout", + "setInterval", + "clearInterval", + "updateInterval" + ]; + var builtInObjByName = { + "#ds.": 21 /* DEVICESCRIPT */, + "#ArrayConstructor.prototype": 4 /* ARRAY_PROTOTYPE */ + }; + BUILTIN_OBJECT__VAL.forEach((n, i) => { + n = n.replace(/_prototype$/, ".prototype"); + if (n.indexOf("_") < 0 && i != 21 /* DEVICESCRIPT */) + builtInObjByName["#" + n.replace(/^Ds/, "ds.")] = i; + }); + var Cell = class { + constructor(definition, scope, _name) { + this.definition = definition; + this._name = _name; + this._index = scope.length; + scope.push(this); + } + emit(wr) { + oops("on value() on generic Cell"); + } + canStore() { + return false; + } + getName() { + if (!this._name) { + if (ts3.isIdentifier(this.definition)) + this._name = idName(this.definition); + else + this._name = idName(this.definition.name); + } + return this._name; + } + }; + var Variable = class extends Cell { + constructor(definition, vkind, scopeOrProc, name) { + super( + definition, + scopeOrProc instanceof Procedure ? vkind == 4 /* Local */ ? scopeOrProc.locals : scopeOrProc.params : scopeOrProc, + name + ); + this.vkind = vkind; + if (scopeOrProc instanceof Procedure) + this.parentProc = scopeOrProc; + } + emitViaClosure(wr, lev) { + if (lev == 0) + return this.emit(wr); + const r = wr.emitExpr( + 74 /* EXPRx1_LOAD_CLOSURE */, + literal(this.getClosureIndex()), + literal(lev) + ); + return r; + } + get packedIndex() { + return packVarIndex(this.vkind, this._index); + } + getClosureIndex() { + assert2(this.vkind != 0 /* Global */); + return this.parentProc.mapVarOffset(this.packedIndex); + } + assertDirect(wr) { + if (this.parentProc) { + assert2(wr.prog.proc == this.parentProc); + } + } + emit(wr) { + this.assertDirect(wr); + let r; + if (this.vkind == 0 /* Global */) + r = wr.emitMemRef(22 /* EXPRx_LOAD_GLOBAL */, this.packedIndex); + else + r = wr.emitMemRef(21 /* EXPRx_LOAD_LOCAL */, this.packedIndex); + return r; + } + canStore() { + return true; + } + store(wr, src, lev) { + if (lev == 0) { + this.assertDirect(wr); + if (this.vkind == 0 /* Global */) + wr.emitStmt( + 18 /* STMTx1_STORE_GLOBAL */, + literal(this.packedIndex), + src + ); + else + wr.emitStmt( + 17 /* STMTx1_STORE_LOCAL */, + literal(this.packedIndex), + src + ); + } else { + wr.emitStmt( + 73 /* STMTx2_STORE_CLOSURE */, + literal(this.getClosureIndex()), + literal(lev), + src + ); + } + } + toString() { + return `var ${this.getName()}`; + } + debugInfo() { + return { + name: this.getName(), + type: vkindToDbg(this.vkind) + }; + } + }; + function vkindToDbg(vkind) { + switch (vkind) { + case 0 /* Global */: + return "glb"; + case 1 /* ThisParam */: + case 2 /* Parameter */: + return "arg"; + case 3 /* Cached */: + return "tmp"; + case 4 /* Local */: + return "loc"; + default: + return "tmp"; + } + } + var FunctionDecl = class extends Cell { + constructor(definition, scope) { + super(definition, scope); + } + emit(wr) { + const prog = wr.prog; + if (this.builtinName) { + const res = prog.emitBuiltInConstByName(this.builtinName); + if (!res) + throwError2( + this.definition, + `can't emit builtin ${this.builtinName}` + ); + return res; + } + return prog.getFunctionProc(this).reference(wr); + } + toString() { + return `function ${this.getName()}`; + } + }; + function idName(pat) { + if (pat && ts3.isIdentifier(pat)) + return pat.text; + else + return null; + } + function unit() { + return nonEmittable(); + } + function undef() { + return literal(void 0); + } + var Procedure = class { + constructor(parent, name, sourceNode, isMethod) { + this.parent = parent; + this.name = name; + this.sourceNode = sourceNode; + this.isMethod = isMethod; + this.params = []; + this.locals = []; + this.users = []; + this.skipAccounting = false; + this.nestedProcs = []; + this.usesClosure = false; + this.hasRest = false; + this.loopStack = []; + this.maxTryBlocks = 0; + this.constVars = {}; + if (!this.sourceNode) + this.sourceNode = parent.lastNode; + this.index = this.parent.procs.length; + this.writer = new OpWriter(parent, `${this.name}_F${this.index}`); + this.parent.procs.push(this); + if (ts3.isMethodDeclaration(this.sourceNode) || ts3.isClassDeclaration(this.sourceNode)) + this.isMethod = true; + } + get numargs() { + return this.params.length; + } + toString() { + return this.writer.getAssembly(); + } + get usesThis() { + const p = this.params[0]; + return (p == null ? void 0 : p.vkind) == 1 /* ThisParam */; + } + finalize() { + if (this.mapVarOffset) + return false; + if (this.usesThis) + this.writer.funFlags |= 1 /* NEEDS_THIS */; + if (this.hasRest) + this.writer.funFlags |= 4 /* HAS_REST_ARG */; + this.mapVarOffset = this.writer.patchLabels( + this.locals.length, + this.numargs, + this.maxTryBlocks + ); + return true; + } + args() { + return this.params.slice(); + } + useFrom(node) { + if (this.users.indexOf(node) >= 0) + return; + this.users.push(node); + } + debugInfo() { + this.writer._forceFinStmt(); + const slots = []; + for (const v of this.params.concat(this.locals)) { + slots[v.getClosureIndex()] = v.debugInfo(); + } + const numslots = this.writer.numSlots(); + for (let i = 0; i < numslots; ++i) { + if (!slots[i]) + slots[i] = { + name: `_tmp${i}`, + type: "tmp" + }; + } + return { + name: this.name, + location: this.sourceNode ? this.parent.getSrcLocation(this.sourceNode) : void 0, + startpc: this.writer.offsetInImg, + size: this.writer.size, + users: this.users.map((u) => this.parent.getSrcLocation(u)), + slots, + constVars: this.constVars + }; + } + addNestedProc(proc) { + this.nestedProcs.push(proc); + proc.parentProc = this; + } + dotPrototype(wr) { + return wr.builtInMember(this.reference(wr), 52 /* PROTOTYPE */); + } + reference(wr) { + return wr.emitExpr(39 /* EXPRx_STATIC_FUNCTION */, literal(this.index)); + } + referenceAsClosure(wr) { + return wr.emitExpr(75 /* EXPRx_MAKE_CLOSURE */, literal(this.index)); + } + callMe(wr, args, op = 0 /* SYNC */) { + const fn = this.reference(wr); + if (op == 0 /* SYNC */) + wr.emitCall(fn, ...args); + else + wr.emitCall( + wr.builtInMember(fn, 78 /* START */), + literal(op), + ...args + ); + } + pushTryBlock(stmt) { + this.loopStack.push({ tryBlock: stmt }); + this.maxTryBlocks = Math.max( + this.maxTryBlocks, + this.loopStack.filter((b) => !!b.tryBlock).length + ); + } + }; + var mathConst = { + E: Math.E, + PI: Math.PI, + LN10: Math.LN10, + LN2: Math.LN2, + LOG2E: Math.LOG2E, + LOG10E: Math.LOG10E, + SQRT1_2: Math.SQRT1_2, + SQRT2: Math.SQRT2 + }; + function throwError2(expr, msg) { + const err = new Error(msg); + err.sourceNode = expr; + throw err; + } + var compileFlagHelp = { + library: "generate library (in .json format)", + allFunctions: "compile-in all `function ...() { }` top-level declarations, used or not", + allPrototypes: "compile-in all `object.method = function ...` assignments, used or not", + traceBuiltin: "trace unresolved built-in functions", + traceProto: "trace tree-shaking of prototypes", + traceFiles: "trace successful file accesses", + traceAllFiles: "trace all file accesses", + testHarness: "add an implicit ds.restart() at the end" + }; + function getSymTags(sym, pref = "devs") { + var _a, _b; + const tags = {}; + for (const tag of (_a = sym == null ? void 0 : sym.getJsDocTags()) != null ? _a : []) { + if (tag.name.startsWith(pref)) { + const v = (_b = tag.text) == null ? void 0 : _b.map((t) => t.text).filter((s) => !!(s == null ? void 0 : s.trim())).join(" "); + tags[tag.name] = v != null ? v : ""; + } + } + return tags; + } + var Program = class { + constructor(mainFileName, host) { + this.mainFileName = mainFileName; + this.host = host; + this.usedSpecs = []; + this.functions = []; + this.globals = []; + this.procs = []; + this.floatLiterals = []; + this.asciiLiterals = []; + this.utf8Literals = []; + this.bufferLiterals = []; + this.protoDefinitions = []; + this.usedMethods = {}; + this.numErrors = 0; + this.flags = {}; + this.srcFiles = []; + this.diagnostics = []; + this.startServices = []; + this.hwCfg = {}; + this.currChain = []; + this.retValRefs = 0; + var _a, _b; + this.flags = (_b = (_a = host.getFlags) == null ? void 0 : _a.call(host)) != null ? _b : {}; + this.isLibrary = this.flags.library || false; + this.serviceSpecs = {}; + const cfg = host.getConfig(); + for (const sp of cfg.services) { + this.serviceSpecs[sp.camelName] = sp; + } + this.sysSpec = this.serviceSpecs["system"]; + this.prelude = preludeFiles(cfg); + } + get hasErrors() { + return this.numErrors > 0; + } + addString(str) { + let isAscii = true; + for (let i = 0; i < str.length; ++i) + if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 0) { + isAscii = false; + break; + } + let idx = BUILTIN_STRING__VAL.indexOf(str); + if (idx >= 0) + return idx | 1 /* BUILTIN */ << 14 /* _SHIFT */; + if (isAscii && str.length < 50) { + idx = addUnique(this.asciiLiterals, str); + return idx | 2 /* ASCII */ << 14 /* _SHIFT */; + } else + return addUnique(this.utf8Literals, str) | 3 /* UTF8 */ << 14 /* _SHIFT */; + } + useSpec(spec) { + let idx = this.usedSpecs.findIndex( + (s) => s.classIdentifier == spec.classIdentifier + ); + if (idx >= 0) + return idx; + if (this.usedSpecs.length == 0) { + this.usedSpecs.push( + this.serviceSpecs["base"], + this.serviceSpecs["sensor"] + ); + } + idx = this.usedSpecs.length; + this.usedSpecs.push(spec); + return idx; + } + addBuffer(buf) { + for (let i = 0; i < this.bufferLiterals.length; ++i) { + const ss = this.bufferLiterals[i]; + if (bufferEq2(buf, ss)) + return i; + } + this.bufferLiterals.push(buf); + return this.bufferLiterals.length - 1; + } + addFloat(f) { + return addUnique(this.floatLiterals, f); + } + relativePath(p) { + var _a, _b, _c; + return p ? (_c = (_b = (_a = this.host).relativePath) == null ? void 0 : _b.call(_a, p)) != null ? _c : p : p; + } + getSrcLocation(node) { + const sf = node.getSourceFile(); + if (sf.__ds_srcidx === void 0) { + const path = this.relativePath(sf.fileName); + let idx = this.srcFiles.findIndex((s) => s.path == path); + if (idx < 0) { + idx = this.srcFiles.length; + this.srcFiles.push({ + path, + length: sf.text.length, + text: sf.text + }); + } + sf.__ds_srcidx = idx; + let off = 0; + for (let i = 0; i < idx; ++i) + off += this.srcFiles[i].length; + sf.__ds_srcoffset = off; + } + let pos = node.getStart(sf, false); + const endp = node.getEnd(); + return [pos + sf.__ds_srcoffset, endp - pos]; + } + sanitizeDiagnostic(d) { + var _a; + const related = (d2) => { + var _a2; + return { + category: d2.category, + code: d2.code, + file: void 0, + filename: this.relativePath((_a2 = d2.file) == null ? void 0 : _a2.fileName), + start: d2.start, + length: d2.length, + messageText: d2.messageText + }; + }; + return { + ...related(d), + filename: d.filename, + line: d.line, + column: d.column, + endLine: d.endLine, + endColumn: d.endColumn, + formatted: d.formatted, + relatedInformation: (_a = d.relatedInformation) == null ? void 0 : _a.map(related) + }; + } + printDiag(diag) { + var _a, _b; + if (diag.category == ts3.DiagnosticCategory.Error) + this.numErrors++; + let origFn; + if (diag.file) { + origFn = diag.file.fileName; + diag.file.fileName = this.relativePath(diag.file.fileName); + } + try { + const jdiag = { + ...diag, + filename: this.mainFileName, + line: 1, + column: 1, + endLine: 1, + endColumn: 1, + formatted: formatDiagnostics2( + [diag], + (_b = (_a = this.host).isBasicOutput) == null ? void 0 : _b.call(_a) + ) + }; + if (diag.file && diag.file.getLineAndCharacterOfPosition) { + const st = diag.file.getLineAndCharacterOfPosition(diag.start); + const en = diag.file.getLineAndCharacterOfPosition( + diag.start + diag.length + ); + jdiag.line = st.line + 1; + jdiag.column = st.character + 1; + jdiag.endLine = en.line + 1; + jdiag.endColumn = en.character + 1; + jdiag.filename = this.relativePath(diag.file.fileName); + } + this.diagnostics.push(this.sanitizeDiagnostic(jdiag)); + if (this.host.error) + this.host.error(jdiag); + else + console.error(jdiag.formatted); + } finally { + if (diag.file) + diag.file.fileName = origFn; + } + } + reportError(node, messageText, category = ts3.DiagnosticCategory.Error) { + const diag = { + category, + messageText, + code: 9999, + file: node.getSourceFile(), + start: node.getStart(), + length: node.getWidth() + }; + this.printDiag(diag); + return unit(); + } + describeCell(ff, idx) { + var _a, _b; + switch (ff) { + case "B": + return toHex(this.bufferLiterals[idx]); + case "U": + return JSON.stringify(this.utf8Literals[idx]); + case "A": + return JSON.stringify(this.asciiLiterals[idx]); + case "I": + return JSON.stringify(BUILTIN_STRING__VAL[idx]); + case "O": + return BUILTIN_OBJECT__VAL[idx] || "???"; + case "L": + return ""; + case "G": + return (_a = this.globals[idx]) == null ? void 0 : _a.getName(); + case "D": + return this.floatLiterals[idx] + ""; + case "F": + return (_b = this.procs[idx]) == null ? void 0 : _b.name; + } + } + constantFold(e) { + return constantFold((e2) => { + const sym = this.getSymAtLocation(e2, true); + if (!sym) + return null; + const decl = sym.valueDeclaration; + if (decl) { + if (decl.__ds_const_val) + return decl.__ds_const_val; + if (ts3.isEnumMember(decl)) + return decl.__ds_const_val = { + val: this.checker.getConstantValue(decl) + }; + } + const nodeName = this.symName(sym); + switch (nodeName) { + case "#NaN": + return { val: NaN }; + case "#Infinity": + return { val: Infinity }; + case "undefined": + return { val: void 0 }; + } + return null; + }, e); + } + withProcedure(proc, f) { + assert2(!!proc); + const prevProc = this.proc; + const prevAcc = this.accountingProc; + try { + this.proc = proc; + if (!proc.skipAccounting) + this.accountingProc = proc; + this.writer = proc.writer; + this.withLocation(proc.sourceNode, f); + } finally { + this.proc = prevProc; + if (prevProc) + this.writer = prevProc.writer; + this.accountingProc = prevAcc; + } + } + forceName(pat) { + const r = idName(pat); + if (!r) + throwError2(pat, "only simple identifiers supported"); + return r; + } + lookupRoleSpec(expr, serv) { + const r = this.serviceSpecs.hasOwnProperty(serv) ? this.serviceSpecs[serv] : void 0; + if (!r) + throwError2(expr, "no such service: " + serv); + return r; + } + stripTypeCast(node) { + while (ts3.isParenthesizedExpression(node) || ts3.isAsExpression(node) || ts3.isTypeAssertionExpression(node)) + node = node.expression; + return node; + } + toLiteralJSONObj(node) { + const obj = this.toLiteralJSON(node); + if (!obj || typeof obj != "object") + throwError2(node, `expecting { ... }`); + return obj; + } + toLiteralJSON(node) { + node = this.stripTypeCast(node); + const folded = this.constantFold(node); + if (folded && folded.val !== void 0) + return folded.val; + if (ts3.isArrayLiteralExpression(node)) + return node.elements.map((e) => this.toLiteralJSON(e)); + if (ts3.isObjectLiteralExpression(node)) { + const json = {}; + for (const prop of node.properties) { + if (!ts3.isPropertyAssignment(prop)) + throwError2( + prop, + `only simple property assignments supported` + ); + const id = this.forceName(prop.name); + const val = this.toLiteralJSON(prop.initializer); + if (val === void 0) + throwError2( + prop.initializer, + `only literals supported currently` + ); + json[id] = val; + } + return json; + } + if (ts3.isPropertyAccessExpression(node)) { + const tags = getSymTags(this.getSymAtLocation(node.expression)); + if (tags[TSDOC_NATIVE] == "GPIO") { + const t2 = getSymTags(this.getSymAtLocation(node)); + if (t2[TSDOC_NATIVE]) + return t2[TSDOC_NATIVE].replace(/^GPIO\./, ""); + const lbl = this.forceName(node.name); + return lbl; + } + } + if (ts3.isCallExpression(node)) { + const nam = this.nodeName(node.expression); + if (nam == "#ds.gpio") + return this.toLiteralJSON(node.arguments[0]); + } + throwError2(node, `expecting JSON literal here`); + } + startServer(expr, cfg) { + const servName = (s) => s.replace(/.*:/, ""); + const spec = this.lookupRoleSpec(expr, servName(cfg.service)); + this.useSpec(spec); + const off = this.startServices.filter( + (s) => servName(s.service) == servName(cfg.service) + ).length; + this.startServices.push(cfg); + if (this.isIgnored(expr)) + return unit(); + else { + let name = cfg.name || servName(cfg.service) + "_" + off; + name += `[int:${off}]`; + return this.allocRole(spec, this.writer.emitString(name)); + } + } + checkHwConfig(expr) { + const serversPref = '#"@devicescript/servers".'; + const startServerPref = serversPref + "start"; + if (!expr || !ts3.isCallExpression(expr)) + return void 0; + const sym = this.getSymAtLocation(this.stripTypeCast(expr.expression)); + const nn = this.symName(sym); + if (!nn) + return void 0; + const tags = getSymTags(sym); + const dsstart = tags[TSDOC_START]; + if (dsstart) { + let sinfo; + try { + sinfo = JSON.parse(dsstart); + } catch { + } + if (sinfo) { + const arg = expr.arguments[0]; + if (arg) { + this.requireArgs(expr, 1); + const str = this.toLiteralJSON(arg); + if (typeof str != "string") + throwError2(expr, "expecting string literal here"); + sinfo.name = str; + } + return this.startServer(expr, sinfo); + } else + throwError2(expr, `invalid @${TSDOC_START} tag`); + } + if (nn.startsWith(startServerPref)) { + this.requireArgs(expr, 1); + const specName = this.serviceNameFromClassName( + nn.slice(startServerPref.length) + ); + let startName = specName; + const sig = this.checker.getResolvedSignature(expr); + const serv = this.checker.getTypeOfSymbolAtLocation(sig.parameters[0], expr).getProperty("service"); + if (serv) { + const tp2 = this.checker.getTypeOfSymbolAtLocation(serv, expr); + if (tp2.isStringLiteral()) + startName = tp2.value; + } + const arg = expr.arguments[0]; + const obj = this.toLiteralJSONObj(arg); + obj.service = startName; + return this.startServer(expr, obj); + } else if (nn == serversPref + "configureHardware") { + this.requireArgs(expr, 1); + const arg = expr.arguments[0]; + const obj = this.toLiteralJSONObj(arg); + Object.assign(this.hwCfg, jsonToDcfg(obj)); + return unit(); + } + return void 0; + } + emitStore(trg, src) { + assert2(trg instanceof Variable); + trg.store(this.writer, src, this.getClosureLevel(trg)); + } + emitLoad(node, cell) { + assert2(cell instanceof Variable); + const lev = this.getClosureLevel(cell); + if (lev && this.isInLoop(cell.definition)) + throwError2( + node, + "closure references to loop variables are currently broken; please use .forEach() or similar" + ); + return cell.emitViaClosure(this.writer, lev); + } + skipInit(decl) { + if (this.isTopLevel(decl) && idName(decl.name)) { + const cell = this.getCellAtLocation(decl); + return !(cell instanceof Variable); + } + if (decl.__ds_const_val) + return true; + return false; + } + getPropName(pn) { + if (ts3.isIdentifier(pn) || ts3.isStringLiteral(pn)) + return pn.text; + throwError2(pn, "unsupported property name"); + } + assignToId(id, init) { + this.emitStore(this.getVarAtLocation(id), init); + } + cloneObj(obj) { + const wr = this.writer; + wr.emitStmt(31 /* STMT0_ALLOC_MAP */); + wr.emitCall(wr.objectMember(85 /* ASSIGN */), this.retVal(), obj); + return this.retVal(); + } + assignToBindingElement(bindingElt, obj, usedFields) { + var _a; + const wr = this.writer; + const bindingName = bindingElt.name; + if (bindingElt.dotDotDotToken) { + const spr = wr.cacheValue(this.cloneObj(obj.emit())); + for (const pn of usedFields) + wr.emitStmt( + 11 /* STMT2_INDEX_DELETE */, + spr.emit(), + wr.emitString(pn) + ); + if (!ts3.isIdentifier(bindingName)) + throwError2(bindingName, "unsupported spread"); + this.assignToId(bindingName, spr.finalEmit()); + return; + } + const pname = this.getPropName( + (_a = bindingElt.propertyName) != null ? _a : bindingElt.name + ); + usedFields.push(pname); + const val = wr.emitIndex(obj.emit(), wr.emitString(pname)); + this.finishBindingAssignment(bindingElt, val); + } + finishBindingAssignment(bindingElt, val) { + const bindingName = bindingElt.name; + if (bindingElt.initializer) + throwError2( + bindingElt, + "default values in bindings not supported yet" + ); + if (ts3.isIdentifier(bindingName)) { + this.assignToId(bindingName, val); + } else if (ts3.isObjectBindingPattern(bindingName)) { + const obj2 = this.writer.cacheValue(val); + const used = []; + for (const elt of bindingName.elements) { + this.assignToBindingElement(elt, obj2, used); + } + obj2.free(); + } else { + throwError2(bindingName, "invalid binding elt"); + } + } + assignToArrayBindingElement(bindingElt, obj, index) { + if (ts3.isOmittedExpression(bindingElt)) + return; + const wr = this.writer; + const bindingName = bindingElt.name; + if (bindingElt.dotDotDotToken) { + const spl = wr.emitIndex(obj.emit(), wr.emitString("slice")); + wr.emitCall(spl, literal(index)); + if (!ts3.isIdentifier(bindingName)) + throwError2(bindingName, "unsupported spread"); + this.assignToId(bindingName, this.retVal()); + return; + } + const val = wr.emitIndex(obj.emit(), literal(index)); + this.finishBindingAssignment(bindingElt, val); + } + isLoop(node) { + switch (node.kind) { + case import_typescript2.SyntaxKind.WhileStatement: + case import_typescript2.SyntaxKind.DoStatement: + case import_typescript2.SyntaxKind.ForStatement: + case import_typescript2.SyntaxKind.ForOfStatement: + case import_typescript2.SyntaxKind.ForInStatement: + return true; + default: + return false; + } + } + isFundecl(node) { + switch (node.kind) { + case import_typescript2.SyntaxKind.FunctionDeclaration: + case import_typescript2.SyntaxKind.FunctionExpression: + case import_typescript2.SyntaxKind.ArrowFunction: + return true; + default: + return false; + } + } + isInLoop(node) { + while (node) { + if (this.isLoop(node)) + return true; + node = node.parent; + if (node && this.isFundecl(node)) + return false; + } + return false; + } + emitVariableDeclarationList(decls) { + var _a; + if ((decls.flags & ts3.NodeFlags.BlockScoped) == 0 && !((_a = decls.parent.modifiers) == null ? void 0 : _a.some((m) => m.kind == import_typescript2.SyntaxKind.DeclareKeyword))) + throwError2(decls, `'var' not allowed`); + for (const decl of decls.declarations) { + this.assignVariableCells(decl); + if (this.skipInit(decl)) + continue; + let init = null; + if (decl.initializer) + init = this.emitExpr(decl.initializer); + else if (this.isInLoop(decl)) + init = literal(void 0); + if (!init) + continue; + if (ts3.isIdentifier(decl.name)) { + this.assignToId(decl.name, init); + } else { + this.destructDefinition(decl, init); + } + } + } + emitVariableStatement(decls) { + this.emitVariableDeclarationList(decls.declarationList); + } + valueIsAlwaysFalse(v) { + if (v.isLiteral) + return v.numValue == 0; + return v.op == 49 /* EXPR0_FALSE */ || v.op == 90 /* EXPR0_NULL */; + } + valueIsAlwaysTrue(v) { + if (v.isLiteral) + return v.numValue != 0 && !isNaN(v.numValue); + return v.op == 48 /* EXPR0_TRUE */; + } + emitIfStatement(stmt) { + const cond = this.emitExpr(stmt.expression); + if (this.valueIsAlwaysFalse(cond)) { + if (stmt.elseStatement) + this.emitStmt(stmt.elseStatement); + } else if (this.valueIsAlwaysTrue(cond)) { + this.emitStmt(stmt.thenStatement); + } else { + this.writer.emitIfAndPop( + cond, + () => this.emitStmt(stmt.thenStatement), + stmt.elseStatement ? () => this.emitStmt(stmt.elseStatement) : null + ); + } + } + emitForStatement(stmt) { + const wr = this.writer; + const loop = this.mkLoopLabels(stmt); + if (stmt.initializer) { + if (ts3.isVariableDeclarationList(stmt.initializer)) + this.emitVariableDeclarationList(stmt.initializer); + else { + this.emitIgnoredExpression(stmt.initializer); + } + } + wr.emitLabel(loop.topLbl); + if (stmt.condition) { + const cond = this.emitExpr(stmt.condition); + wr.emitJumpIfFalse(loop.breakLbl, cond); + } + try { + this.proc.loopStack.push(loop); + this.emitStmt(stmt.statement); + wr.emitLabel(loop.continueLbl); + if (stmt.incrementor) + this.emitIgnoredExpression(stmt.incrementor); + } finally { + this.proc.loopStack.pop(); + } + wr.emitJump(loop.topLbl); + wr.emitLabel(loop.breakLbl); + } + /* + try { BODY } + catch (e) { CATCH } + finally { FINALLY } + + ==> + try l_finally + try l_catch + BODY + end_try l_after + + l_catch: + catch() + e := retval() + CATCH + l_after: + l_finally: + finally() + tmp := retval() + FINALLY + re_throw tmp + */ + emitTryCatchStatement(stmt) { + if (!stmt.catchClause) + return this.emitBlock(stmt.tryBlock); + const wr = this.writer; + const after = wr.mkLabel("aftertry"); + const catchLbl = wr.mkLabel("catch"); + wr.emitTry(catchLbl); + this.proc.pushTryBlock(stmt); + try { + this.emitBlock(stmt.tryBlock); + } finally { + this.proc.loopStack.pop(); + wr.emitEndTry(after); + } + wr.emitLabel(catchLbl); + wr.emitStmt(82 /* STMT0_CATCH */); + const decl = stmt.catchClause.variableDeclaration; + if (decl) { + this.assignVariableCells(decl); + this.emitStore(this.getVarAtLocation(decl), this.retVal()); + } + this.emitBlock(stmt.catchClause.block); + wr.emitLabel(after); + } + emitTryStatement(stmt) { + if (!stmt.finallyBlock) + return this.emitTryCatchStatement(stmt); + const wr = this.writer; + const finallyLbl = wr.mkLabel("finally"); + wr.emitTry(finallyLbl); + this.proc.pushTryBlock(stmt); + try { + this.emitTryCatchStatement(stmt); + } finally { + this.proc.loopStack.pop(); + } + wr.emitLabel(finallyLbl); + wr.emitStmt(83 /* STMT0_FINALLY */); + const exn = wr.cacheValue(this.retVal(), true); + this.emitBlock(stmt.finallyBlock); + wr.emitStmt(85 /* STMT1_RE_THROW */, exn.finalEmit()); + } + emitThrowStatement(stmt) { + const wr = this.writer; + wr.emitStmt(84 /* STMT1_THROW */, this.emitExpr(stmt.expression)); + } + emitSwitchStatement(stmt) { + const wr = this.writer; + const expr = wr.cacheValue(this.emitExpr(stmt.expression), true); + let deflLbl; + const labels = stmt.caseBlock.clauses.map((cl) => { + const lbl = wr.mkLabel("sw"); + if (ts3.isDefaultClause(cl)) { + deflLbl = lbl; + } else { + const clexpr = this.emitExpr(cl.expression); + wr.emitJumpIfFalse( + lbl, + wr.emitExpr(71 /* EXPR2_NE */, expr.emit(), clexpr) + ); + } + return lbl; + }); + expr.free(); + const loop = { + breakLbl: wr.mkLabel("swBrk") + }; + if (deflLbl) + wr.emitJump(deflLbl); + else + wr.emitJump(loop.breakLbl); + try { + this.proc.loopStack.push(loop); + stmt.caseBlock.clauses.forEach((cl, idx) => { + wr.emitLabel(labels[idx]); + for (const s of cl.statements) + this.emitStmt(s); + }); + } finally { + this.proc.loopStack.pop(); + } + wr.emitLabel(loop.breakLbl); + } + emitBlock(stmt) { + let hadFun = false; + let stmts = stmt.statements.slice(); + for (const s of stmts) { + this.assignCellsToStmt(s); + if (ts3.isFunctionDeclaration(s)) + hadFun = true; + } + if (hadFun) { + stmts = stmts.filter(ts3.isFunctionDeclaration).concat(stmts.filter((s) => !ts3.isFunctionDeclaration(s))); + } + for (const s of stmts) + this.emitStmt(s); + } + emitBreakContStatement(stmt) { + const sym = stmt.label ? this.getSymAtLocation(stmt.label) : null; + let numTry = 0; + const wr = this.writer; + for (let i = this.proc.loopStack.length - 1; i >= 0; i--) { + const loop = this.proc.loopStack[i]; + if (loop.tryBlock) { + numTry++; + continue; + } + if (sym && sym != loop.labelSym) + continue; + const lbl = stmt.kind == import_typescript2.SyntaxKind.ContinueStatement ? loop.continueLbl : loop.breakLbl; + if (!lbl) + continue; + if (numTry) + wr.emitThrowJmp(lbl, numTry); + else + wr.emitJump(lbl); + return; + } + throwError2(stmt, "loop not found"); + } + mkLoopLabels(stmt) { + const wr = this.writer; + const res = { + topLbl: wr.mkLabel("top"), + continueLbl: wr.mkLabel("continue"), + breakLbl: wr.mkLabel("break") + }; + if (ts3.isLabeledStatement(stmt.parent)) { + res.labelSym = this.getSymAtLocation(stmt.parent.label); + } + return res; + } + emitForInOrOfStatement(stmt) { + const wr = this.writer; + const loop = this.mkLoopLabels(stmt); + if (stmt.awaitModifier || !stmt.initializer || !ts3.isVariableDeclarationList(stmt.initializer) || stmt.initializer.declarations.length != 1) + throwError2(stmt, "only for (let/const x in/of ...) supported"); + const decl = stmt.initializer.declarations[0]; + let collExpr = this.emitExpr(stmt.expression); + if (stmt.kind == import_typescript2.SyntaxKind.ForInStatement) { + wr.emitCall(wr.objectMember(86 /* KEYS */), collExpr); + collExpr = this.retVal(); + } + const coll = wr.cacheValue(collExpr, true); + const idx = wr.cacheValue(literal(0), true); + this.emitVariableDeclarationList(stmt.initializer); + const elt = this.getVarAtLocation(decl); + wr.emitLabel(loop.topLbl); + const cond = wr.emitExpr( + 70 /* EXPR2_LT */, + idx.emit(), + wr.emitIndex(coll.emit(), wr.emitString("length")) + ); + wr.emitJumpIfFalse(loop.breakLbl, cond); + try { + const collVal = coll.emit(); + const idxVal = idx.emit(); + this.emitStore(elt, wr.emitIndex(collVal, idxVal)); + this.proc.loopStack.push(loop); + this.emitStmt(stmt.statement); + wr.emitLabel(loop.continueLbl); + idx.store(wr.emitExpr(58 /* EXPR2_ADD */, idx.emit(), literal(1))); + } finally { + this.proc.loopStack.pop(); + coll.free(); + idx.free(); + } + wr.emitJump(loop.topLbl); + wr.emitLabel(loop.breakLbl); + } + emitWhileStatement(stmt) { + const wr = this.writer; + const loop = this.mkLoopLabels(stmt); + wr.emitLabel(loop.continueLbl); + wr.emitLabel(loop.topLbl); + const cond = this.emitExpr(stmt.expression); + wr.emitJumpIfFalse(loop.breakLbl, cond); + try { + this.proc.loopStack.push(loop); + this.emitStmt(stmt.statement); + } finally { + this.proc.loopStack.pop(); + } + wr.emitJump(loop.continueLbl); + wr.emitLabel(loop.breakLbl); + } + emitEnumDeclaration(stmt) { + } + finishRetVal() { + const wr = this.writer; + if (this.proc.returnValueLabel) { + wr.emitLabel(this.proc.returnValueLabel); + wr.emitStmt(12 /* STMT1_RETURN */, this.proc.returnValue.finalEmit()); + } + if (this.proc.returnNoValueLabel) { + wr.emitLabel(this.proc.returnNoValueLabel); + wr.emitStmt(12 /* STMT1_RETURN */, literal(void 0)); + } + } + emitReturnStatement(stmt) { + const wr = this.writer; + const numTry = this.proc.loopStack.filter((l) => !!l.tryBlock).length; + if (stmt.expression) { + if (wr.ret) + oops("return with value not supported here"); + const expr = this.emitExpr(stmt.expression); + if (numTry) { + if (!this.proc.returnValue) { + this.proc.returnValue = wr.cacheValue(expr, true); + this.proc.returnValueLabel = wr.mkLabel("retVal"); + } else + this.proc.returnValue.store(expr); + wr.emitThrowJmp(this.proc.returnValueLabel, numTry); + } else { + wr.emitStmt(12 /* STMT1_RETURN */, expr); + } + } else { + if (wr.ret) { + this.writer.emitThrowJmp(this.writer.ret, numTry); + } else { + if (numTry) { + if (!this.proc.returnNoValueLabel) + this.proc.returnNoValueLabel = wr.mkLabel("retNoVal"); + wr.emitThrowJmp(this.proc.returnNoValueLabel, numTry); + } else { + wr.emitStmt(12 /* STMT1_RETURN */, literal(void 0)); + } + } + } + } + serviceNameFromClassName(r) { + return lowerFirst(r); + } + specFromTypeName(expr, nm, optional = false) { + if (!nm) + nm = this.nodeName(expr); + if (nm && nm.startsWith("#ds.")) { + let r = this.serviceNameFromClassName(nm.slice(4)); + return this.lookupRoleSpec(expr, r); + } else { + if (optional) + return null; + throwError2(expr, `type name not understood: ${nm}`); + } + } + emitCtorAssignments(cls, ctor) { + var _a; + assert2(this.proc.usesThis); + this.proc.writer.funFlags |= 2 /* IS_CTOR */ | 1 /* NEEDS_THIS */; + for (const mem of cls.members) { + if (!ts3.isPropertyDeclaration(mem)) + continue; + if (this.isStatic(mem)) + continue; + const id = this.forceName(mem.name); + if (mem.initializer) + this.withLocation(mem, (wr) => { + wr.emitStmt( + 25 /* STMT3_INDEX_SET */, + this.emitThisExpression(mem), + wr.emitString(id), + this.emitExpr(mem.initializer) + ); + }); + } + for (const param of (_a = ctor == null ? void 0 : ctor.parameters) != null ? _a : []) { + if (ts3.isParameterPropertyDeclaration(param, ctor)) { + this.withLocation(param, (wr) => { + wr.emitStmt( + 25 /* STMT3_INDEX_SET */, + this.emitThisExpression(param), + wr.emitString(this.forceName(param.name)), + this.getVarAtLocation(param).emit(wr) + ); + }); + } + } + } + emitCtor(cls, proc) { + const ctor = cls.members.find(ts3.isConstructorDeclaration); + if (ctor) + return this.emitFunction(ctor, proc); + else { + try { + const fdecl = this.getCellAtLocation(cls); + assert2(fdecl instanceof FunctionDecl); + this.withProcedure(proc, (wr) => { + this.addParameter(proc, "this"); + const params = range(fdecl.numCtorArgs).map( + (i) => this.addParameter(proc, "a" + i) + ); + if (fdecl.baseCtor) { + wr.emitCall( + wr.emitExpr( + 15 /* EXPR2_BIND */, + fdecl.baseCtor.emit(wr), + this.emitThisExpression(cls) + ), + ...params.map((p) => p.emit(wr)) + ); + } else { + assert2(params.length == 0); + } + this.emitCtorAssignments(cls); + wr.emitStmt(12 /* STMT1_RETURN */, literal(void 0)); + this.finishRetVal(); + this.finalizeProc(proc); + }); + } catch (e) { + this.handleException(cls, e); + } + return proc; + } + } + isLeafCtor(stmt) { + if (!ts3.isConstructorDeclaration(stmt)) + return false; + const decl = this.getCellAtLocation(stmt.parent); + return decl.baseCtor == null; + } + emitFunction(stmt, proc) { + try { + this.withProcedure(proc, () => { + this.emitParameters(stmt, proc); + if (this.isLeafCtor(stmt)) + this.emitCtorAssignments(stmt.parent, stmt); + this.emitFunctionBody(stmt, proc); + }); + } catch (e) { + this.handleException(stmt, e); + } + return proc; + } + emitNested(proc) { + for (const p of proc.nestedProcs) { + if (p.sourceNode && (ts3.isFunctionDeclaration(p.sourceNode) || ts3.isFunctionExpression(p.sourceNode) || ts3.isArrowFunction(p.sourceNode))) + this.emitFunction(p.sourceNode, p); + else + oops("bad sourceNode"); + } + } + finalizeProc(proc) { + try { + if (!proc.finalize()) + return; + } catch (e) { + this.handleException(proc.sourceNode, e); + return; + } + this.emitNested(proc); + } + emitFunctionBody(stmt, proc) { + if (!stmt.body) { + const wr = this.writer; + wr.emitCall(wr.dsMember(166 /* NOTIMPLEMENTED */)); + } else if (ts3.isBlock(stmt.body)) { + this.emitStmt(stmt.body); + if (!this.writer.justHadReturn()) + this.writer.emitStmt(12 /* STMT1_RETURN */, literal(void 0)); + } else { + this.writer.emitStmt(12 /* STMT1_RETURN */, this.emitExpr(stmt.body)); + } + this.finishRetVal(); + this.finalizeProc(proc); + } + addParameter(proc, id) { + const v = new Variable( + typeof id == "string" ? null : id, + 2 /* Parameter */, + proc + ); + if (typeof id == "string") + v._name = id; + else + this.assignCell(id, v); + if (v.getName() == "this") + v.vkind = 1 /* ThisParam */; + return v; + } + withLocation(node, f) { + const wr = this.writer; + if (!node) + return f(wr); + wr.locPush(this.getSrcLocation(node)); + try { + f(wr); + } finally { + wr.locPop(); + } + } + emitParameters(stmt, proc) { + var _a; + if (proc.isMethod && idName((_a = stmt.parameters[0]) == null ? void 0 : _a.name) != "this") + this.addParameter(proc, "this"); + const destructParams = []; + for (const paramdef of stmt.parameters) { + assert2(!proc.hasRest); + if (paramdef.kind != import_typescript2.SyntaxKind.Parameter) + throwError2( + paramdef, + "only simple identifiers supported as parameters" + ); + if (paramdef.dotDotDotToken) + proc.hasRest = true; + if (ts3.isObjectBindingPattern(paramdef.name)) { + const paramVar = this.addParameter(proc, "obj"); + destructParams.push({ paramdef, paramVar }); + } else { + this.forceName(paramdef.name); + this.addParameter(proc, paramdef); + } + } + for (const paramdef of stmt.parameters) { + if (paramdef.initializer) { + this.withLocation(paramdef, (wr) => { + const v = this.getVarAtLocation(paramdef); + wr.emitIfAndPop( + wr.emitExpr(47 /* EXPR1_IS_UNDEFINED */, v.emit(wr)), + () => { + this.emitStore( + v, + this.emitExpr(paramdef.initializer) + ); + } + ); + }); + } + } + for (const { paramdef, paramVar } of destructParams) { + this.withLocation(paramdef, (wr) => { + this.assignVariableCells(paramdef); + const val = paramVar.emit(wr); + val.assumeStateless(); + this.destructDefinition(paramdef, val); + }); + } + } + destructDefinition(decl, init) { + const obj = this.writer.cacheValue(init); + if (ts3.isObjectBindingPattern(decl.name)) { + const used = []; + for (const elt of decl.name.elements) + this.assignToBindingElement(elt, obj, used); + } else if (ts3.isArrayBindingPattern(decl.name)) { + let idx = 0; + for (const elt of decl.name.elements) { + this.assignToArrayBindingElement(elt, obj, idx++); + } + } else { + throwError2(decl, "unsupported destructuring"); + } + obj.free(); + } + getFunctionProc(fundecl) { + if (fundecl.proc) + return fundecl.proc; + const stmt = fundecl.definition; + fundecl.proc = new Procedure(this, fundecl.getName(), stmt); + if (ts3.isClassDeclaration(stmt)) + return this.emitCtor(stmt, fundecl.proc); + else if (ts3.isVariableDeclaration(stmt)) + oops(`function is builtin ${fundecl.builtinName}`); + else + return this.emitFunction(stmt, fundecl.proc); + } + emitFunctionDeclaration(stmt) { + const fundecl = this.functions.find( + (f) => f.definition === stmt + ); + if (stmt.asteriskToken || stmt.modifiers && !stmt.modifiers.every(modifierOK)) + throwError2(stmt, "modifier not supported"); + if (!this.isTopLevel(stmt)) { + this.emitStore( + this.getVarAtLocation(stmt), + this.emitFunctionExpr(stmt) + ); + return; + } + assert2(!!fundecl || !!this.numErrors); + if (fundecl) { + if (this.flags.allFunctions || this.isLibrary && this.inMainFile(stmt)) + this.getFunctionProc(fundecl); + } + function modifierOK(mod) { + switch (mod.kind) { + case import_typescript2.SyntaxKind.AsyncKeyword: + case import_typescript2.SyntaxKind.ExportKeyword: + return true; + default: + return false; + } + } + } + methodNames(sym) { + const name = this.symName(sym); + const names = [name]; + for (const baseSym of this.getBaseSyms(sym)) { + names.push(this.symName(baseSym)); + } + return names; + } + emitClassDeclaration(stmt) { + var _a; + const fdecl = this.getCellAtLocation(stmt); + assert2(fdecl instanceof FunctionDecl); + const classTags = getSymTags(this.getSymAtLocation(stmt)); + const whenUsed = classTags[TSDOC_WHEN_USED] !== void 0; + let numCtorArgs = null; + for (const mem of stmt.members) { + switch (mem.kind) { + case import_typescript2.SyntaxKind.PropertyDeclaration: + case import_typescript2.SyntaxKind.MethodDeclaration: + case import_typescript2.SyntaxKind.Constructor: + case import_typescript2.SyntaxKind.SemicolonClassElement: + break; + default: + throwError2(mem, "unsupported class member"); + } + if (ts3.isMethodDeclaration(mem) && mem.body) { + const sym = this.getSymAtLocation(mem); + const tags = getSymTags(sym); + if (tags.hasOwnProperty(TSDOC_NATIVE)) + continue; + const info = { + className: this.nodeName(stmt), + methodName: this.forceName(mem.name), + names: this.methodNames(sym), + methodDecl: mem + }; + if (info.methodName == "toString") + this.toStringError(mem); + this.protoDefinitions.push(info); + if (whenUsed || tags[TSDOC_WHEN_USED] !== void 0) { + } else { + this.markMethodUsed(info.names[0]); + } + } else if (ts3.isConstructorDeclaration(mem)) { + numCtorArgs = mem.parameters.length; + } else if (ts3.isPropertyDeclaration(mem) && this.isStatic(mem)) { + if (mem.initializer) + throwError2( + mem, + "initializers on static members are not supported (yet)" + ); + } + } + let baseDecl; + if (stmt.heritageClauses) { + for (const cls of stmt.heritageClauses) { + if (cls.token == import_typescript2.SyntaxKind.ImplementsKeyword) + continue; + if (cls.token == import_typescript2.SyntaxKind.ExtendsKeyword) { + const tps = cls.types.slice().map((e) => this.checker.getTypeAtLocation(e)); + if (tps.length != 1) + throwError2(cls, "only single extends supported"); + baseDecl = this.symCell(tps[0].symbol); + if (!(baseDecl instanceof FunctionDecl)) + throwError2(cls, "invalid extends"); + } + } + } + assert2(baseDecl == null || baseDecl.numCtorArgs != null); + fdecl.numCtorArgs = (_a = numCtorArgs != null ? numCtorArgs : baseDecl == null ? void 0 : baseDecl.numCtorArgs) != null ? _a : 0; + fdecl.baseCtor = baseDecl; + } + isTopLevel(node) { + return !!node._devsIsTopLevel; + } + symSetCell(sym, cell) { + const s = sym; + assert2(!s.__ds_cell || s.__ds_cell == cell || this.numErrors > 0); + s.__ds_cell = cell; + } + assignCell(node, cell) { + const sym = this.checker.getSymbolAtLocation(node.name); + assert2(!!sym); + this.symSetCell(sym, cell); + return cell; + } + isStatic(meth) { + var _a; + return (_a = meth.modifiers) == null ? void 0 : _a.some((m) => m.kind == import_typescript2.SyntaxKind.StaticKeyword); + } + emitMethod(meth) { + const proc = new Procedure(this, this.forceName(meth.name), meth); + this.emitFunction(meth, proc); + this.withLocation(meth, (wr) => { + const ctor = this.ctorProc(meth.parent); + wr.emitStmt( + 25 /* STMT3_INDEX_SET */, + this.isStatic(meth) ? ctor.reference(wr) : ctor.dotPrototype(wr), + wr.emitString(this.forceName(meth.name)), + proc.reference(wr) + ); + }); + } + ctorProc(cls) { + const ctordecl = this.getCellAtLocation(cls); + assert2(ctordecl instanceof FunctionDecl); + return ctordecl.proc; + } + emitProtoAssigns() { + const needsEmit = (p) => { + if (p.emitted) + return false; + if (p.methodDecl && this.ctorProc(p.methodDecl.parent) == null) + return false; + if (this.flags.allPrototypes) + return true; + if (this.usedMethods["*" + p.methodName]) + return true; + if (p.names.some((n) => this.usedMethods[n])) + return true; + return false; + }; + this.withProcedure(this.protoProc, () => { + for (; ; ) { + let numemit = 0; + for (const p of this.protoDefinitions) { + if (needsEmit(p)) { + p.emitted = true; + numemit++; + if (this.flags.traceProto) + trace("EMIT upd", p.names[0]); + if (p.methodDecl) + this.emitMethod(p.methodDecl); + else + this.withLocation( + p.protoUpdate, + () => this.emitAssignmentExpression( + p.protoUpdate, + true + ) + ); + } + } + this.emitNested(this.protoProc); + this.protoProc.nestedProcs = []; + if (numemit == 0) + break; + } + for (const fdecl of this.functions) { + if (fdecl.baseCtor && fdecl.proc) { + this.withLocation(fdecl.definition, (wr) => { + wr.emitCall( + wr.objectMember(121 /* SETPROTOTYPEOF */), + fdecl.proc.dotPrototype(wr), + fdecl.baseCtor.builtinName ? this.emitBuiltInConstByName( + fdecl.baseCtor.builtinName + ".prototype" + ) : fdecl.baseCtor.proc.dotPrototype(wr) + ); + }); + } + } + this.writer.emitStmt(12 /* STMT1_RETURN */, literal(void 0)); + this.finalizeProc(this.protoProc); + }); + if (this.flags.traceProto) { + for (const p of this.protoDefinitions) { + if (!p.emitted) + trace("skip upd", p.names[0]); + } + } + } + emitProgram(prog) { + this.lastNode = this.mainFile; + this.mainProc = new Procedure(this, "main", this.mainFile); + this.protoProc = new Procedure(this, "prototype", this.mainFile); + const stmts = [].concat( + ...prog.getSourceFiles().map((file) => file.isDeclarationFile ? [] : file.statements) + ); + stmts.forEach(markTopLevel); + for (const s of stmts) { + this.assignCellsToStmt(s); + } + this.withProcedure(this.mainProc, (wr) => { + this.protoProc.callMe(wr, []); + for (const s of stmts) + this.emitStmt(s); + if (this.flags.testHarness) + wr.emitCall(wr.dsMember(57 /* RESTART */)); + wr.emitStmt(12 /* STMT1_RETURN */, literal(0)); + this.finalizeProc(this.mainProc); + if (this.usedSpecs.length > 0) + this.markMethodUsed("#ds.Role._onPacket"); + this.emitProtoAssigns(); + }); + function markTopLevel(node) { + ; + node._devsIsTopLevel = true; + if (ts3.isExpressionStatement(node)) + markTopLevel(node.expression); + else if (ts3.isVariableStatement(node)) + node.declarationList.declarations.forEach(markTopLevel); + else if (ts3.isVariableDeclaration(node) && !ts3.isIdentifier(node.name)) + node.name.elements.forEach(markTopLevel); + } + } + assignCellsToStmt(stmt) { + try { + if (ts3.isVariableStatement(stmt)) { + for (const decl of stmt.declarationList.declarations) + try { + this.assignVariableCells(decl); + } catch (e) { + this.handleException(decl, e); + } + } else if (ts3.isFunctionDeclaration(stmt)) { + if (this.getCellAtLocation(stmt)) + return; + this.forceName(stmt.name); + if (this.isTopLevel(stmt)) + this.assignCell( + stmt, + new FunctionDecl(stmt, this.functions) + ); + else + this.assignCell( + stmt, + new Variable(stmt, 4 /* Local */, this.proc) + ); + } else if (ts3.isClassDeclaration(stmt)) { + if (this.getCellAtLocation(stmt)) + return; + if (!stmt.name) + throwError2(stmt, "classes need names"); + if (!this.isTopLevel(stmt)) + throwError2(stmt, "only top-level classes supported"); + this.forceName(stmt.name); + this.assignCell(stmt, new FunctionDecl(stmt, this.functions)); + } + } catch (e) { + this.handleException(stmt, e); + } + } + assignVariableCells(decl) { + const topLevel = this.isTopLevel(decl); + const doAssign = (decl2) => { + var _a; + if (ts3.isIdentifier(decl2.name)) { + if (this.getCellAtLocation(decl2)) + return; + const d0 = decl2; + if (d0.__ds_const_val) + return; + if (ts3.isVariableDeclaration(decl2) && decl2.initializer && ts3.getCombinedNodeFlags(decl2) & ts3.NodeFlags.Const) { + const folded = this.constantFold(decl2.initializer); + if (folded) { + d0.__ds_const_val = folded; + let val = folded.val; + if (val === null) { + } else if (JSON.stringify(val) != "null" && (typeof val == "string" || typeof val == "boolean" || typeof val == "number")) { + } else { + val = { special: "" + val }; + } + const proc = (_a = this.proc) != null ? _a : this.mainProc; + proc.constVars[idName(decl2.name)] = val; + return; + } + } + this.assignCell( + decl2, + new Variable( + decl2, + topLevel ? 0 /* Global */ : 4 /* Local */, + topLevel ? this.globals : this.proc + ) + ); + } else if (ts3.isObjectBindingPattern(decl2.name)) { + for (const elt of decl2.name.elements) { + doAssign(elt); + } + } else if (ts3.isArrayBindingPattern(decl2.name)) { + for (const elt of decl2.name.elements) { + if (!ts3.isOmittedExpression(elt)) + doAssign(elt); + } + } else { + throwError2(decl2, "unsupported binding"); + } + }; + doAssign(decl); + } + ignore(val) { + val.ignore(); + } + isForIgnored(expr) { + if (expr.parent) { + if (ts3.isForStatement(expr.parent)) + return expr == expr.parent.initializer || expr == expr.parent.incrementor; + } + return false; + } + realParent(expr) { + if (!(expr == null ? void 0 : expr.parent)) + return void 0; + if (ts3.isParenthesizedExpression(expr.parent) || ts3.isAsExpression(expr.parent) || ts3.isTypeAssertionExpression(expr.parent)) + return this.realParent(expr.parent); + return expr.parent; + } + isIgnored(expr) { + const p = this.realParent(expr); + return p && (ts3.isExpressionStatement(p) || this.isForIgnored(expr)); + } + emitIgnoredExpression(expr) { + this.ignore(this.emitExpr(expr)); + this.writer.assertNoTemps(); + } + emitExpressionStatement(stmt) { + this.emitIgnoredExpression(stmt.expression); + } + requireArgs(expr, num) { + if (num == 0 && !expr.arguments) + return; + if (expr.arguments.length != num) + throwError2( + expr.position || expr, + `${num} arguments required; got ${expr.arguments.length}` + ); + } + parseFormat(expr) { + const str = this.stringLiteral(expr) || ""; + const m = /^([uif])(\d+)(\.\d+)?$/.exec(str.trim()); + if (!m) + throwError2( + expr, + `format descriptor ("u32", "i22.10", etc) expected` + ); + let sz = parseInt(m[2]); + let shift = 0; + if (m[3]) { + shift = parseInt(m[3].slice(1)); + sz += shift; + } + let r; + switch (sz) { + case 8: + r = 0 /* U8 */; + break; + case 16: + r = 1 /* U16 */; + break; + case 32: + r = 2 /* U32 */; + break; + case 64: + r = 3 /* U64 */; + break; + default: + throwError2( + expr, + `total format size is not one of 8, 16, 32, 64 bits` + ); + } + switch (m[1]) { + case "u": + break; + case "i": + r += 4 /* I8 */; + break; + case "f": + if (shift) + throwError2(expr, `shifts not supported for floats`); + r += 8 /* F8 */; + break; + default: + assert2(false); + } + if (r == 8 /* F8 */ || r == 9 /* F16 */) + throwError2(expr, `f8 and f16 are not supported`); + return r | shift << 4; + } + onCall() { + if (this.retValRefs != 0) + this.retValError(this.retValExpr); + } + emitGenericCall(args, fn) { + const wr = this.writer; + if (args.some(ts3.isSpreadElement)) { + wr.emitStmt(79 /* STMT2_CALL_ARRAY */, fn, this.emitArray(args)); + this.onCall(); + } else { + wr.emitCall(fn, ...this.emitArgs(args)); + } + return this.retVal(); + } + emitMathCall(id, ...args) { + const wr = this.writer; + wr.emitCall(wr.mathMember(id), ...args); + return this.retVal(); + } + stringLiteral(expr) { + if (isTemplateOrStringLiteral(expr)) + return expr.text; + return void 0; + } + decodeImage(node, s) { + const matrix = []; + let line = []; + let width = 0; + s += "\n"; + for (let i = 0; i < s.length; ++i) { + let c = s[i]; + switch (c) { + case " ": + case " ": + break; + case "\n": + if (line.length > 0) { + matrix.push(line); + width = Math.max(line.length, width); + line = []; + } + break; + case ".": + line.push(0); + break; + case "#": + line.push(1); + break; + default: + let n = -1; + if (/[0-9]/.test(c)) + n = +c; + else if (/[a-z]/i.test(c)) + n = c.toLowerCase().charCodeAt(0) - "a".charCodeAt(0) + 10; + if (n < 0 || n >= 16) + throwError2( + node, + `invalid character ${JSON.stringify( + c + )} in img\`...\` literal` + ); + line.push(n); + break; + } + } + const bpp = 4; + const height = matrix.length; + const buf = f4EncodeImg(width, height, bpp, (x, y) => matrix[y][x] || 0); + const wr = this.writer; + const alloc = wr.builtInMember( + wr.emitBuiltInObject(40 /* IMAGE */), + 14 /* ALLOC */ + ); + wr.emitCall( + alloc, + literal(width), + literal(height), + literal(bpp), + wr.emitString(buf) + ); + return this.retVal(); + function f4EncodeImg(w, h, bpp2, getPix) { + const r = []; + let ptr = 0; + let curr = 0; + let shift = 0; + const pushBits = (n) => { + curr |= n << shift; + if (shift == 8 - bpp2) { + r.push(curr); + ptr++; + curr = 0; + shift = 0; + } else { + shift += bpp2; + } + }; + for (let i = 0; i < w; ++i) { + for (let j = 0; j < h; ++j) + pushBits(getPix(i, j)); + while (shift != 0) + pushBits(0); + if (bpp2 > 1) { + while (ptr & 3) + pushBits(0); + } + } + return new Uint8Array(r); + } + } + decodeHexLiteral(expr) { + const text = expr.template.text; + const hexbuf = text.replace(/\/\/.*$/gm, "").replace(/\s+/g, "").toLowerCase(); + const m = /[^0-9a-f]/.exec(hexbuf); + if (m) + throwError2(expr, `invalid character in hex: ${m[0]}`); + if (hexbuf.length & 1) + throwError2(expr, "non-even hex length"); + return this.writer.emitString(fromHex2(hexbuf)); + } + bufferLiteral(expr) { + if (expr && ts3.isTaggedTemplateExpression(expr)) { + const tp = idName(expr.tag); + if (tp !== "hex" && tp !== "img") + return void 0; + if (!ts3.isNoSubstitutionTemplateLiteral(expr.template)) + throwError2( + expr, + `\${}-expressions not supported in ${tp} literals` + ); + if (tp == "img") + return this.decodeImage(expr, expr.template.text); + return this.decodeHexLiteral(expr); + } + return void 0; + } + bufferSize(v) { + var _a, _b; + const idx = (_b = (_a = v.args) == null ? void 0 : _a[0]) == null ? void 0 : _b.numValue; + if (idx !== void 0) + switch (v.op) { + case 35 /* EXPRx_STATIC_BUFFER */: + return this.bufferLiterals[idx].length; + case 37 /* EXPRx_STATIC_ASCII_STRING */: + return this.asciiLiterals[idx].length; + case 38 /* EXPRx_STATIC_UTF8_STRING */: + return strlen(this.utf8Literals[idx]); + case 36 /* EXPRx_STATIC_BUILTIN_STRING */: + return BUILTIN_STRING__VAL[idx].length; + } + return void 0; + } + emitStringOrBuffer(expr) { + const stringLiteral = this.stringLiteral(expr); + const wr = this.writer; + if (stringLiteral != void 0) { + return wr.emitString(stringLiteral); + } else { + const buf = this.bufferLiteral(expr); + if (buf) + return buf; + else + throwError2(expr, "expecting a string literal here"); + } + } + emitArgs(args) { + return args.map((arg) => this.emitExpr(arg)); + } + isStringLike(expr) { + return !!(this.checker.getTypeAtLocation(expr).getFlags() & ts3.TypeFlags.StringLike); + } + flattenPlus(arg) { + if (!this.isStringLike(arg)) + return [arg]; + if (ts3.isBinaryExpression(arg) && arg.operatorToken.kind == import_typescript2.SyntaxKind.PlusToken) { + return this.flattenPlus(arg.left).concat( + this.flattenPlus(arg.right) + ); + } else if (ts3.isTemplateExpression(arg)) { + const r = []; + if (arg.head.text) + r.push(arg.head); + for (const span of arg.templateSpans) { + r.push(span.expression); + if (span.literal.text) + r.push(span.literal); + } + return r; + } else { + return [arg]; + } + } + compileFormat(args) { + let fmt = ""; + const fmtArgs = []; + const strval = (n) => { + if (n <= 9) + return "" + n; + return String.fromCharCode(97 + n - 9); + }; + const pushArg = (arg) => { + const str = this.stringLiteral(arg); + if (str) { + fmt += str.replace(/\{/g, "{{"); + } else { + fmt += `{${strval(fmtArgs.length)}}`; + fmtArgs.push(arg); + } + }; + for (const arg of args) { + if (fmt && !/[=:]$/.test(fmt)) + fmt += " "; + const flat = this.flattenPlus(arg); + if (ts3.isTemplateExpression(arg) || flat.some((f) => this.stringLiteral(f) != null)) { + flat.forEach(pushArg); + } else { + pushArg(arg); + } + } + const wr = this.writer; + wr.emitCall( + wr.dsMember(76 /* FORMAT */), + wr.emitString(fmt), + ...this.emitArgs(fmtArgs) + ); + return this.retVal(); + } + retVal() { + return this.writer.emitExpr(44 /* EXPR0_RET_VAL */); + } + symName(sym) { + var _a; + if (!sym) + return null; + if (sym.flags & ts3.SymbolFlags.Alias) + sym = this.checker.getAliasedSymbol(sym); + let r = this.checker.getFullyQualifiedName(sym); + if (r && r.startsWith(`"${coreModule}"`)) + return "#ds." + r.slice(coreModule.length + 3); + else { + const d = (_a = sym.getDeclarations()) == null ? void 0 : _a[0]; + if (d && this.prelude.hasOwnProperty(d.getSourceFile().fileName)) { + r = r.replace(/^global\./, ""); + if (ts3.isSourceFile(d.parent) || ts3.isModuleBlock(d.parent) || ts3.isClassDeclaration(d.parent) && ts3.isModuleBlock(d.parent.parent) || ts3.isInterfaceDeclaration(d.parent) && ts3.isSourceFile(d.parent.parent) || ts3.isVariableDeclarationList(d.parent) && ts3.isSourceFile(d.parent.parent.parent)) { + if (globalFunctions.includes(r)) + return "#ds." + r; + return "#" + r; + } + if (this.flags.traceBuiltin) + trace("not-builtin", import_typescript2.SyntaxKind[d.parent.kind], d.parent.kind, r); + return r; + } + } + return r; + } + nodeName(node) { + node = this.stripTypeCast(node); + switch (node.kind) { + case import_typescript2.SyntaxKind.NumberKeyword: + return "#number"; + case import_typescript2.SyntaxKind.BooleanKeyword: + return "#boolean"; + } + return this.symName(this.getSymAtLocation(node)); + } + emitBuiltInCall(expr, funName) { + const wr = this.writer; + const obj = expr.callexpr.expression; + switch (funName) { + case "isNaN": { + this.requireArgs(expr, 1); + return wr.emitExpr( + 54 /* EXPR1_IS_NAN */, + this.emitExpr(expr.arguments[0]) + ); + } + case "ds._id": + this.requireArgs(expr, 1); + return this.emitExpr(expr.arguments[0]); + case "console.data": + case "console.info": + case "console.debug": + case "console.warn": + case "console.error": + case "console.log": { + const levels = { + log: ">", + info: ">", + error: "!", + warn: "*", + debug: "?", + data: "#" + }; + wr.emitCall( + wr.dsMember(126 /* PRINT */), + literal(levels[funName.slice(8)].charCodeAt(0)), + this.compileFormat(expr.arguments) + ); + return undef(); + } + case "Buffer.getAt": { + this.requireArgs(expr, 2); + const fmt = this.parseFormat(expr.arguments[1]); + return wr.emitExpr( + 43 /* EXPR3_LOAD_BUFFER */, + this.emitExpr(obj), + literal(fmt), + this.emitExpr(expr.arguments[0]) + ); + } + case "Buffer.setAt": { + this.requireArgs(expr, 3); + const fmt = this.parseFormat(expr.arguments[1]); + const off = this.emitExpr(expr.arguments[0]); + const val = this.emitExpr(expr.arguments[2]); + wr.emitStmt( + 19 /* STMT4_STORE_BUFFER */, + this.emitExpr(obj), + literal(fmt), + off, + val + ); + return undef(); + } + case "ds.keep": { + this.requireArgs(expr, 1); + this.ignore(this.emitExpr(expr.arguments[0])); + return undef(); + } + default: + return null; + } + } + emitCallExpression(expr) { + var _a; + return (_a = this.checkHwConfig(expr)) != null ? _a : this.emitCallLike({ + position: expr, + callexpr: expr.expression, + arguments: expr.arguments.slice() + }); + } + checkAsyncFun(formal, arg) { + const actual = this.checker.getTypeAtLocation(arg); + const formalSigs = formal.getCallSignatures(); + const actualSigs = actual.getCallSignatures(); + if (actualSigs[0] && this.isPromise(actualSigs[0].getReturnType()) && formalSigs[0] && !this.isPromise(formalSigs[0].getReturnType())) { + const actstr = this.checker.typeToString(actual); + const formstr = this.checker.typeToString(formal); + this.reportError( + arg, + `async function of type '${actstr}' not allowed here; need '${formstr}'` + ); + } + } + emitCallLike(call) { + var _a; + const sig = this.checker.getResolvedSignature(call.position); + for (let i = 0; i < call.arguments.length; ++i) { + if (!sig.parameters[i]) + continue; + const formal = this.checker.getTypeOfSymbolAtLocation( + sig.parameters[i], + call.position + ); + this.checkAsyncFun(formal, call.arguments[i]); + } + const callName = this.nodeName(call.callexpr); + const builtInName = callName && callName.startsWith("#") ? callName.slice(1) : null; + if (builtInName) { + const builtIn = this.emitBuiltInCall(call, builtInName); + if (builtIn) + return builtIn; + } + if (callName == "#Array.push" && call.arguments.some(ts3.isSpreadElement)) { + const lim = 16 /* MAX_STACK_DEPTH */ - 1; + throwError2( + call.position, + `...args has a length limit of ${lim} elements; better use Array.pushRange()` + ); + } + if (call.callexpr.kind == import_typescript2.SyntaxKind.SuperKeyword) { + const wr = this.writer; + const baseCls = this.getSymAtLocation(call.callexpr); + const baseDecl = this.symCell(baseCls); + assert2(baseDecl instanceof FunctionDecl); + const bound = wr.emitExpr( + 15 /* EXPR2_BIND */, + baseDecl.emit(wr), + this.emitThisExpression(call.callexpr) + ); + this.ignore(this.emitGenericCall(call.arguments, bound)); + for (let node = call.callexpr; node; node = node.parent) { + if (ts3.isConstructorDeclaration(node)) { + this.emitCtorAssignments(node.parent, node); + return unit(); + } + } + assert2(false); + } + const fn = (_a = call.compiledCallExpr) != null ? _a : this.emitExpr(call.callexpr); + return this.emitGenericCall(call.arguments, fn); + } + getSymAtLocation(node, shorthand = false) { + var _a; + if (shorthand && ((_a = node == null ? void 0 : node.parent) == null ? void 0 : _a.kind) == import_typescript2.SyntaxKind.ShorthandPropertyAssignment) + return this.checker.getShorthandAssignmentValueSymbol(node.parent); + let sym = this.checker.getSymbolAtLocation(node); + if ((sym == null ? void 0 : sym.flags) & ts3.SymbolFlags.Alias) + sym = this.checker.getAliasedSymbol(sym); + if (!sym) { + const decl = node; + if (decl.name) + sym = this.checker.getSymbolAtLocation(decl.name); + } + return sym; + } + symCell(sym) { + const cell = sym == null ? void 0 : sym.__ds_cell; + if (!cell && (sym == null ? void 0 : sym.valueDeclaration)) { + const name = this.symName(sym); + const decl = sym.valueDeclaration; + if (ts3.isParameter(decl)) { + const s2 = this.getSymAtLocation(decl.name); + if (s2 !== sym) + return this.symCell(s2); + } + if (name[0] == "#" && ts3.isVariableDeclaration(decl) && builtInObjByName.hasOwnProperty(name)) { + const tp = this.checker.getTypeOfSymbolAtLocation(sym, decl); + const sigs = tp.getCallSignatures(); + if (sigs.length > 0) { + const fn = new FunctionDecl( + sym.valueDeclaration, + [] + ); + fn.builtinName = name; + fn.numCtorArgs = sigs[0].getParameters().length; + this.symSetCell(sym, fn); + if (this.symName(tp.symbol) == name + "Constructor") { + this.symSetCell(tp.symbol, fn); + if (this.flags.traceBuiltin) + trace( + "traceBuiltin: ctor ", + name, + this.symName(tp.symbol) + ); + } else { + if (this.flags.traceBuiltin) + trace("traceBuiltin: ctor ", name); + } + return fn; + } + } + } + return cell; + } + getCellAtLocation(node) { + return this.symCell(this.getSymAtLocation(node, true)); + } + getVarAtLocation(node) { + const v = this.getCellAtLocation(node); + if (!v) + throwError2(node, "variable not assigned yet"); + if (!(v instanceof Variable)) + throwError2(node, "expecting variable"); + return v; + } + getClosureLevel(variable) { + if (variable.vkind == 0 /* Global */) + return 0; + assert2(!!variable.parentProc); + let lev = 0; + let ptr = this.proc; + while (ptr && ptr != variable.parentProc) { + lev++; + ptr = ptr.parentProc; + } + assert2(ptr != null); + if (lev > 0) + this.proc.usesClosure = true; + return lev; + } + emitIdentifier(expr) { + const r = this.emitBuiltInConst(expr); + if (r) + return r; + const cell = this.getCellAtLocation(expr); + if (!cell) + throwError2(expr, "unknown name: " + idName(expr)); + if (cell instanceof Variable) + return this.emitLoad(expr, cell); + return cell.emit(this.writer); + } + emitThisExpression(expr) { + const p0 = this.proc.params[0]; + if (p0 && p0.vkind == 1 /* ThisParam */) { + const r = p0.emit(this.writer); + r.assumeStateless(); + return r; + } + throwError2(expr, "'this' cannot be used here: " + this.proc.name); + } + emitElementAccessExpression(expr) { + const val = this.emitExpr(expr.expression); + const idx = this.emitExpr(expr.argumentExpression); + return this.writer.emitExpr(24 /* EXPR2_INDEX */, val, idx); + } + isRoleClass(sym) { + if (!sym.valueDeclaration || sym.valueDeclaration.kind != import_typescript2.SyntaxKind.ClassDeclaration) + return false; + const tps = this.getBaseTypes( + this.checker.getDeclaredTypeOfSymbol(sym) + ).map((tp) => this.symName(tp.getSymbol())); + return tps.includes("#ds.Sensor") || tps.includes("#ds.Role"); + } + emitBuiltInConst(expr) { + const tags = getSymTags(this.getSymAtLocation(expr)); + const nat = tags[TSDOC_NATIVE]; + const wr = this.writer; + if (nat) { + if (nat.startsWith("GPIO.")) { + return wr.emitIndex( + wr.emitBuiltInObject(42 /* GPIO */), + wr.emitString(nat.slice(5)) + ); + } + const id = builtInObjByName["#" + nat]; + if (id === void 0) { + this.reportError( + expr, + "allowed names: " + Object.keys(builtInObjByName).map((s) => s.slice(1)).join(", "), + ts3.DiagnosticCategory.Message + ); + throwError2(expr, `invalid @${TSDOC_NATIVE} tag '${nat}'`); + } + return wr.emitBuiltInObject(id); + } + return this.emitBuiltInConstByName(this.nodeName(expr)); + } + isBuiltInObj(nodeName) { + return builtInObjByName.hasOwnProperty(nodeName); + } + dsMember(memName) { + this.markMethodUsed("#ds." + memName); + const idx = BUILTIN_STRING__VAL.indexOf(memName); + const wr = this.writer; + if (idx >= 0) { + return wr.dsMember(idx); + } else { + return wr.emitIndex( + this.writer.emitBuiltInObject(21 /* DEVICESCRIPT */), + wr.emitString(memName) + ); + } + } + emitBuiltInConstByName(nodeName) { + if (!nodeName) + return null; + if (builtInObjByName.hasOwnProperty(nodeName)) + return this.writer.emitBuiltInObject(builtInObjByName[nodeName]); + if (this.flags.traceBuiltin) + trace("traceBuiltin:", nodeName); + if (nodeName.startsWith("#ds.")) { + const bn = nodeName.slice(4); + if (!bn.includes(".")) + return this.dsMember(bn); + } + return null; + } + banOptional(expr) { + if (ts3.isOptionalChain(expr)) + throwError2(expr, "?. not supported here"); + } + flattenChain(chain) { + const links = [chain]; + while (!chain.questionDotToken) { + chain = chain.expression; + links.unshift(chain); + } + return { expression: chain.expression, chain: links }; + } + emitPropertyAccessExpression(expr) { + const r = this.emitBuiltInConst(expr); + if (r) + return r; + const nsName = this.nodeName(expr.expression); + if (nsName == "#Math") { + const id = idName(expr.name); + if (mathConst.hasOwnProperty(id)) + return literal(mathConst[id]); + } + const propName = idName(expr.name); + if (propName == "prototype" || propName == "spec") { + const sym = this.checker.getSymbolAtLocation(expr.expression); + if (this.isRoleClass(sym)) { + this.banOptional(expr); + const spec = this.specFromTypeName(expr.expression); + const idx2 = this.useSpec(spec); + return this.writer.emitExpr( + propName == "spec" ? 94 /* EXPRx_STATIC_SPEC */ : 34 /* EXPRx_STATIC_SPEC_PROTO */, + literal(idx2) + ); + } + } + const { obj, idx } = this.tryEmitIndex(expr); + return this.writer.emitIndex(obj, idx); + } + emitTemplateExpression(node) { + return this.compileFormat([node]); + } + isInterfaceType(tp) { + return !!(tp.getFlags() & ts3.TypeFlags.Object && tp.objectFlags & ts3.ObjectFlags.ClassOrInterface); + } + getBaseTypes(clsTp) { + if (this.isInterfaceType(clsTp)) + return this.checker.getBaseTypes(clsTp); + return []; + } + getBaseSyms(sym) { + const res = []; + const decl = sym == null ? void 0 : sym.valueDeclaration; + if (!decl) + return res; + const addSym = (baseSym) => { + if (baseSym && !res.includes(baseSym)) + res.push(baseSym, ...this.getBaseSyms(baseSym)); + }; + const clsSym = this.getSymAtLocation(decl.parent); + if (!clsSym) + return []; + const clsTp = this.checker.getDeclaredTypeOfSymbol(clsSym); + for (const baseTp of this.getBaseTypes(clsTp)) { + const baseSym = this.checker.getPropertyOfType( + baseTp, + sym.getName() + ); + addSym(baseSym); + } + const cls = clsSym.valueDeclaration; + if (cls && (ts3.isClassLike(cls) || ts3.isInterfaceDeclaration(cls))) { + if (cls.heritageClauses) { + for (const h of cls.heritageClauses) { + if (h.token == import_typescript2.SyntaxKind.ImplementsKeyword) { + for (const tpExpr of h.types) { + const tp = this.checker.getTypeAtLocation(tpExpr); + const baseSym = this.checker.getPropertyOfType( + tp, + sym.getName() + ); + addSym(baseSym); + } + } + } + } + } + if (this.flags.traceProto && res.length > 0) { + trace( + "BASE: " + this.symName(sym) + " => " + res.map((s) => this.symName(s)).join(", ") + ); + } + return res; + } + isAllPropertyAccess(expr) { + return ts3.isIdentifier(expr) || ts3.isPropertyAccessExpression(expr) && this.isAllPropertyAccess(expr.expression); + } + isFunctionValue(expr) { + if (ts3.isFunctionExpression(expr) || ts3.isArrowFunction(expr)) + return true; + if (ts3.isIdentifier(expr) && this.checker.getTypeAtLocation(expr).getCallSignatures().length > 0) + return true; + return false; + } + isPrototypeLike(expr) { + if (!ts3.isPropertyAccessExpression(expr)) + return false; + if (ts3.isPropertyAccessExpression(expr.expression) && idName(expr.expression.name) == "prototype") + return true; + if (this.isBuiltInObj(this.nodeName(expr.expression))) + return true; + const nat = getSymTags(this.getSymAtLocation(expr.expression))[TSDOC_NATIVE]; + if (nat && nat.endsWith(".prototype")) + return true; + return false; + } + emitPrototypeUpdate(expr) { + if (!this.isPrototypeLike(expr.left)) + return null; + if (!this.isFunctionValue(expr.right)) + return null; + if (!this.isTopLevel(expr.parent)) + return null; + const sym = this.getSymAtLocation(expr.left); + const decl = sym == null ? void 0 : sym.valueDeclaration; + if (decl) { + this.protoDefinitions.push({ + methodName: idName(expr.left.name), + className: this.nodeName(decl.parent), + names: this.methodNames(sym), + protoUpdate: expr + }); + return unit(); + } else { + throwError2(expr, "can't determine symbol of prototype update"); + } + } + emitAssignmentTarget(trg) { + const wr = this.writer; + const r = this.tryEmitIndex(trg); + if (r) { + const obj = wr.cacheValue(r.obj); + const idx = wr.cacheValue(r.idx); + return { + read: () => wr.emitIndex(obj.emit(), idx.emit()), + write: (src) => wr.emitStmt( + 25 /* STMT3_INDEX_SET */, + obj.emit(), + idx.emit(), + src + ), + free: () => { + obj.free(); + idx.free(); + } + }; + } + if (ts3.isIdentifier(trg)) { + const variable = this.getVarAtLocation(trg); + return { + read: () => this.emitLoad(trg, variable), + write: (src) => this.emitStore(variable, src), + free: () => { + } + }; + } + throwError2(trg, "unsupported assignment target"); + } + toStringError(node) { + this.reportError( + node, + `in DeviceScript the .toString() method is not called implicitly; please use a different method name`, + ts3.DiagnosticCategory.Warning + ); + } + emitAssignmentExpression(expr, noProto = false) { + const res = noProto ? null : this.emitPrototypeUpdate(expr); + if (res) + return res; + const wr = this.writer; + let left = expr.left; + const r = this.tryEmitIndex(left); + const src = this.emitExpr(expr.right); + if (r) { + if (r.idx.strValue === "toString") + this.toStringError(expr); + if (noProto && r.obj.op == 94 /* EXPRx_STATIC_SPEC */) { + assert2(this.flags.allPrototypes); + this.ignore(r.obj); + this.ignore(r.idx); + this.ignore(src); + return unit(); + } else { + return this.emitAssignResult(expr, src, (src2) => { + wr.emitStmt(25 /* STMT3_INDEX_SET */, r.obj, r.idx, src2); + }); + } + } + if (ts3.isArrayLiteralExpression(left)) { + throwError2(expr, "todo array assignment"); + } else if (ts3.isIdentifier(left)) { + return this.emitAssignResult(expr, src, (src2) => { + const v = this.getVarAtLocation(left); + this.emitStore(v, src2); + }); + } + throwError2(expr, "unhandled assignment"); + } + isNullOrUndefined(expr) { + const v = this.constantFold(expr); + if (v && v.val == null) + return true; + return false; + } + emitJsxElement(expr, openingElement, children) { + var _a; + const wr = this.writer; + let fn; + if (!openingElement) + fn = wr.emitString(""); + else { + const tag = idName(openingElement.tagName); + if (tag && tag[0].toLowerCase() == tag[0]) + fn = wr.emitString(tag); + else + fn = this.emitExpr(openingElement.tagName); + } + wr.emitStmt(31 /* STMT0_ALLOC_MAP */); + const opts = wr.cacheValue(this.retVal()); + for (const attr of (_a = openingElement == null ? void 0 : openingElement.attributes.properties) != null ? _a : []) { + if (ts3.isJsxSpreadAttribute(attr)) { + wr.emitCall( + wr.objectMember(85 /* ASSIGN */), + opts.emit(), + this.emitExpr(attr.expression) + ); + } else { + const fld = this.forceName(attr.name); + const init = attr.initializer ? this.emitExpr(attr.initializer) : literal(true); + wr.emitStmt( + 25 /* STMT3_INDEX_SET */, + opts.emit(), + wr.emitString(fld), + init + ); + } + } + const semanticChildren = !children ? [] : children.filter((i) => { + switch (i.kind) { + case import_typescript2.SyntaxKind.JsxExpression: + return !!i.expression; + case import_typescript2.SyntaxKind.JsxText: + return !i.containsOnlyTriviaWhiteSpaces; + default: + return true; + } + }); + const singleChild = semanticChildren.length == 1 && !(ts3.isJsxExpression(semanticChildren[0]) && semanticChildren[0].dotDotDotToken); + if (semanticChildren.length > 0) { + const children2 = singleChild ? this.emitExpr(semanticChildren[0]) : this.emitArray(semanticChildren); + wr.emitStmt( + 25 /* STMT3_INDEX_SET */, + opts.emit(), + wr.emitString("children"), + children2 + ); + } + this.markMethodUsed("#ds._jsx"); + const jsxFn = wr.emitIndex( + wr.emitBuiltInObject(21 /* DEVICESCRIPT */), + wr.emitString("_jsx") + ); + wr.emitCall(jsxFn, fn, opts.finalEmit()); + return this.retVal(); + } + emitBinaryExpression(expr) { + const simpleOps = { + [import_typescript2.SyntaxKind.PlusToken]: 58 /* EXPR2_ADD */, + [import_typescript2.SyntaxKind.MinusToken]: 59 /* EXPR2_SUB */, + [import_typescript2.SyntaxKind.SlashToken]: 61 /* EXPR2_DIV */, + [import_typescript2.SyntaxKind.AsteriskToken]: 60 /* EXPR2_MUL */, + [import_typescript2.SyntaxKind.LessThanToken]: 70 /* EXPR2_LT */, + [import_typescript2.SyntaxKind.BarToken]: 63 /* EXPR2_BIT_OR */, + [import_typescript2.SyntaxKind.AmpersandToken]: 62 /* EXPR2_BIT_AND */, + [import_typescript2.SyntaxKind.CaretToken]: 64 /* EXPR2_BIT_XOR */, + [import_typescript2.SyntaxKind.LessThanLessThanToken]: 65 /* EXPR2_SHIFT_LEFT */, + [import_typescript2.SyntaxKind.GreaterThanGreaterThanToken]: 66 /* EXPR2_SHIFT_RIGHT */, + [import_typescript2.SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: 67 /* EXPR2_SHIFT_RIGHT_UNSIGNED */, + [import_typescript2.SyntaxKind.LessThanEqualsToken]: 69 /* EXPR2_LE */, + [import_typescript2.SyntaxKind.EqualsEqualsToken]: 91 /* EXPR2_APPROX_EQ */, + [import_typescript2.SyntaxKind.EqualsEqualsEqualsToken]: 68 /* EXPR2_EQ */, + [import_typescript2.SyntaxKind.ExclamationEqualsToken]: 92 /* EXPR2_APPROX_NE */, + [import_typescript2.SyntaxKind.ExclamationEqualsEqualsToken]: 71 /* EXPR2_NE */, + [import_typescript2.SyntaxKind.InstanceOfKeyword]: 89 /* EXPR2_INSTANCE_OF */ + }; + function stripEquals(k) { + switch (k) { + case import_typescript2.SyntaxKind.PlusEqualsToken: + return import_typescript2.SyntaxKind.PlusToken; + case import_typescript2.SyntaxKind.MinusEqualsToken: + return import_typescript2.SyntaxKind.MinusToken; + case import_typescript2.SyntaxKind.AsteriskEqualsToken: + return import_typescript2.SyntaxKind.AsteriskToken; + case import_typescript2.SyntaxKind.AsteriskAsteriskEqualsToken: + return import_typescript2.SyntaxKind.AsteriskAsteriskToken; + case import_typescript2.SyntaxKind.SlashEqualsToken: + return import_typescript2.SyntaxKind.SlashToken; + case import_typescript2.SyntaxKind.PercentEqualsToken: + return import_typescript2.SyntaxKind.PercentToken; + case import_typescript2.SyntaxKind.LessThanLessThanEqualsToken: + return import_typescript2.SyntaxKind.LessThanLessThanToken; + case import_typescript2.SyntaxKind.GreaterThanGreaterThanEqualsToken: + return import_typescript2.SyntaxKind.GreaterThanGreaterThanToken; + case import_typescript2.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + return import_typescript2.SyntaxKind.GreaterThanGreaterThanGreaterThanToken; + case import_typescript2.SyntaxKind.AmpersandEqualsToken: + return import_typescript2.SyntaxKind.AmpersandToken; + case import_typescript2.SyntaxKind.BarEqualsToken: + return import_typescript2.SyntaxKind.BarToken; + case import_typescript2.SyntaxKind.CaretEqualsToken: + return import_typescript2.SyntaxKind.CaretToken; + default: + return null; + } + } + let op = expr.operatorToken.kind; + if (op == import_typescript2.SyntaxKind.EqualsToken) + return this.emitAssignmentExpression(expr); + if ((op == import_typescript2.SyntaxKind.EqualsEqualsToken || op == import_typescript2.SyntaxKind.ExclamationEqualsToken) && !this.isNullOrUndefined(expr.left) && !this.isNullOrUndefined(expr.right)) { + this.reportError( + expr, + `please use ${op == import_typescript2.SyntaxKind.EqualsEqualsToken ? "===" : "!=="}` + ); + } + if (op == import_typescript2.SyntaxKind.CommaToken) { + this.ignore(this.emitExpr(expr.left)); + return this.emitExpr(expr.right); + } + let swap = false; + if (op == import_typescript2.SyntaxKind.GreaterThanToken) { + op = import_typescript2.SyntaxKind.LessThanToken; + swap = true; + } + if (op == import_typescript2.SyntaxKind.GreaterThanEqualsToken) { + op = import_typescript2.SyntaxKind.LessThanEqualsToken; + swap = true; + } + const wr = this.writer; + if (op == import_typescript2.SyntaxKind.AmpersandAmpersandToken || op == import_typescript2.SyntaxKind.BarBarToken || op == import_typescript2.SyntaxKind.QuestionQuestionToken) { + const a2 = this.emitExpr(expr.left); + const tmp = wr.cacheValue(a2, true); + let tst; + if (op == import_typescript2.SyntaxKind.QuestionQuestionToken) + tst = wr.emitExpr(72 /* EXPR1_IS_NULLISH */, tmp.emit()); + else if (op == import_typescript2.SyntaxKind.BarBarToken) + tst = wr.emitExpr(56 /* EXPR1_NOT */, tmp.emit()); + else + tst = wr.emitExpr(50 /* EXPR1_TO_BOOL */, tmp.emit()); + const skipB = wr.mkLabel("lazyB"); + wr.emitJumpIfFalse(skipB, tst); + tmp.store(this.emitExpr(expr.right)); + wr.emitLabel(skipB); + return tmp.finalEmit(); + } + const emitBin = (op2, a2, b2) => { + if (op2 == import_typescript2.SyntaxKind.AsteriskAsteriskToken) + return this.emitMathCall(50 /* POW */, a2, b2); + if (op2 == import_typescript2.SyntaxKind.PercentToken) + return this.emitMathCall(75 /* IMOD */, a2, b2); + const op22 = simpleOps[op2]; + if (op22 === void 0) + throwError2(expr, "unhandled operator"); + const res = wr.emitExpr(op22, a2, b2); + return res; + }; + if (stripEquals(op) != null) { + op = stripEquals(op); + const t = this.emitAssignmentTarget(expr.left); + const other = this.emitExpr(expr.right); + let r = emitBin(op, t.read(), other); + return this.emitAssignResult(expr, r, (r2) => { + t.write(r2); + t.free(); + }); + } + let a = this.emitExpr(expr.left); + let b = this.emitExpr(expr.right); + if (swap) + [a, b] = [b, a]; + return emitBin(op, a, b); + } + mapPostfixOp(k) { + if (k == import_typescript2.SyntaxKind.PlusPlusToken) + return 58 /* EXPR2_ADD */; + if (k == import_typescript2.SyntaxKind.MinusMinusToken) + return 59 /* EXPR2_SUB */; + return null; + } + emitUnaryExpression(expr) { + const wr = this.writer; + const simpleOps = { + [import_typescript2.SyntaxKind.ExclamationToken]: 56 /* EXPR1_NOT */, + [import_typescript2.SyntaxKind.MinusToken]: 55 /* EXPR1_NEG */, + [import_typescript2.SyntaxKind.PlusToken]: 23 /* EXPR1_UPLUS */, + [import_typescript2.SyntaxKind.TildeToken]: 53 /* EXPR1_BIT_NOT */ + }; + let arg = expr.operand; + const updateOp = this.mapPostfixOp(expr.operator); + if (updateOp) { + const t = this.emitAssignmentTarget(expr.operand); + t.write(wr.emitExpr(updateOp, t.read(), literal(1))); + const r = t.read(); + t.free(); + return r; + } + let op = simpleOps[expr.operator]; + if (op === void 0) + throwError2(expr, "unhandled operator"); + if (expr.operator == import_typescript2.SyntaxKind.ExclamationToken && ts3.isPrefixUnaryExpression(arg) && arg.operator == import_typescript2.SyntaxKind.ExclamationToken) { + op = 50 /* EXPR1_TO_BOOL */; + arg = arg.operand; + } + return wr.emitExpr(op, this.emitExpr(arg)); + } + emitArray(elements) { + const wr = this.writer; + const sz = elements.length; + const spreadInner = (e) => { + if (ts3.isSpreadElement(e)) + return e.expression; + if (ts3.isJsxExpression(e) && e.dotDotDotToken) + return e.expression; + return void 0; + }; + const numSpread = elements.filter( + (e) => spreadInner(e) != void 0 + ).length; + const allocSz = 34537478 /* IMG_VERSION */ >= 34537472 ? sz - numSpread : 0; + wr.emitStmt(32 /* STMT1_ALLOC_ARRAY */, literal(allocSz)); + const chunk = 8; + if (elements.length == 0) + return this.retVal(); + const arr = wr.cacheValue(this.retVal()); + let curr = []; + const flushCurr = () => { + if (!curr.length) + return; + wr.emitCall( + wr.emitIndex(arr.emit(), wr.emitString("push")), + ...curr + ); + curr = []; + }; + for (const elt of elements) { + const spr = spreadInner(elt); + if (spr) { + flushCurr(); + wr.emitCall( + wr.emitIndex(arr.emit(), wr.emitString("pushRange")), + this.emitExpr(spr) + ); + } else { + curr.push(this.emitExpr(elt)); + } + if (curr.length >= chunk) + flushCurr(); + } + flushCurr(); + return arr.finalEmit(); + } + emitArrayExpression(expr) { + return this.emitArray(expr.elements); + } + markMethodUsed(meth) { + assert2(!!meth); + if (!this.usedMethods[meth]) { + if (this.flags.traceProto) + trace(`use: ${meth}`); + this.usedMethods[meth] = true; + } + } + tryEmitIndex(expr) { + const wr = this.writer; + if (ts3.isElementAccessExpression(expr) || ts3.isPropertyAccessExpression(expr)) { + const obj = this.emitExpr(expr.expression); + let idx; + if (ts3.isPropertyAccessExpression(expr)) { + idx = wr.emitString(this.forceName(expr.name)); + const sym = this.getSymAtLocation(expr); + const decl = sym == null ? void 0 : sym.valueDeclaration; + const symName = this.symName(sym); + if (symName && symName[0] == "#" || decl && decl.parent && ts3.isClassLike(decl.parent)) { + this.markMethodUsed(symName); + } else { + this.markMethodUsed("*" + idName(expr.name)); + } + } else { + idx = this.emitExpr(expr.argumentExpression); + if (idx.strValue != void 0) + this.markMethodUsed("*" + idx.strValue); + } + return { obj, idx }; + } + return null; + } + emitDeleteExpression(expr) { + const wr = this.writer; + const r = this.tryEmitIndex(expr.expression); + if (!r) + throwError2(expr, "unsupported delete"); + wr.emitStmt(11 /* STMT2_INDEX_DELETE */, r.obj, r.idx); + return this.retVal(); + } + allocRole(spec, name) { + const wr = this.writer; + this.useSpec(spec); + wr.emitCall( + wr.dsMember(169 /* _ALLOCROLE */), + literal(spec.classIdentifier), + ...name ? [name] : [] + ); + return this.retVal(); + } + emitNewExpression(expr) { + var _a; + const wr = this.writer; + const spec = this.specFromTypeName( + expr.expression, + this.nodeName(expr.expression), + true + ); + if (spec) { + if ((_a = expr.arguments) == null ? void 0 : _a[0]) + return this.allocRole(spec, this.emitExpr(expr.arguments[0])); + else + return this.allocRole(spec); + } + const desc = { + position: expr, + callexpr: expr.expression, + arguments: expr.arguments ? expr.arguments.slice() : [] + }; + desc.compiledCallExpr = wr.emitExpr( + 88 /* EXPR1_NEW */, + this.emitExpr(desc.callexpr) + ); + return this.emitCallLike(desc); + } + emitAssignResult(expr, src, f) { + if (this.isIgnored(expr)) { + f(src); + return unit(); + } else { + const wr = this.writer; + const cached = wr.cacheValue(src); + f(cached.emit()); + return cached.finalEmit(); + } + } + emitPostfixUnaryExpression(expr) { + const wr = this.writer; + const t = this.emitAssignmentTarget(expr.operand); + const op = this.mapPostfixOp(expr.operator); + assert2(op != null); + return this.emitAssignResult(expr, t.read(), (src) => { + t.write(wr.emitExpr(op, src, literal(1))); + t.free(); + }); + } + emitConditionalExpression(expr) { + const wr = this.writer; + const cond = this.emitExpr(expr.condition); + if (this.valueIsAlwaysFalse(cond)) { + return this.emitExpr(expr.whenFalse); + } else if (this.valueIsAlwaysTrue(cond)) { + return this.emitExpr(expr.whenTrue); + } else { + const lblElse = wr.mkLabel("condElse"); + const lblEnd = wr.mkLabel("condEnd"); + wr.emitJumpIfFalse(lblElse, cond); + const tmp = wr.cacheValue(this.emitExpr(expr.whenTrue), true); + wr.emitJump(lblEnd); + wr.emitLabel(lblElse); + tmp.store(this.emitExpr(expr.whenFalse)); + wr.emitLabel(lblEnd); + return tmp.finalEmit(); + } + } + isAssignment(expr) { + return expr && ts3.isBinaryExpression(expr) && expr.operatorToken.kind == import_typescript2.SyntaxKind.EqualsToken; + } + isProtoRef(expr) { + return expr && ts3.isPropertyAccessExpression(expr) && idName(expr.name) == "prototype"; + } + emitFunctionExpr(expr) { + const wr = this.writer; + let n = expr.name ? idName(expr.name) : null; + let isMethod = false; + if (this.isAssignment(expr.parent)) { + if (ts3.isPropertyAccessExpression(expr.parent.left)) { + const methName = expr.parent.left.name; + if (this.isProtoRef(expr.parent.left.expression)) + isMethod = true; + if (!n) + n = idName(methName); + } + } + if (!n) + n = "inline"; + const proc = new Procedure(this, n, expr, isMethod); + this.proc.addNestedProc(proc); + if (this.proc.parentProc) + this.proc.usesClosure = true; + return proc.referenceAsClosure(wr); + } + emitObjectExpression(expr) { + const wr = this.writer; + wr.emitStmt(31 /* STMT0_ALLOC_MAP */); + const ret = this.retVal(); + if (expr.properties.length == 0) + return ret; + const arr = wr.cacheValue(ret); + for (const p of expr.properties) { + let expr2; + if (ts3.isPropertyAssignment(p)) { + expr2 = p.initializer; + } else if (ts3.isShorthandPropertyAssignment(p) && !p.objectAssignmentInitializer) { + expr2 = p.name; + } else if (ts3.isSpreadAssignment(p) && !p.name) { + wr.emitCall( + wr.objectMember(85 /* ASSIGN */), + arr.emit(), + this.emitExpr(p.expression) + ); + continue; + } else { + throwError2(p, `unsupported initializer ${import_typescript2.SyntaxKind[p.kind]}`); + } + let fld; + if (ts3.isComputedPropertyName(p.name)) { + fld = this.emitExpr(p.name.expression); + } else if (ts3.isNumericLiteral(p.name) || ts3.isStringLiteral(p.name)) { + fld = this.emitExpr(p.name); + } else { + fld = wr.emitString(this.forceName(p.name)); + } + const init = this.emitExpr(expr2); + wr.emitStmt(25 /* STMT3_INDEX_SET */, arr.emit(), fld, init); + } + return arr.finalEmit(); + } + isPromise(tp) { + if (!tp) + return false; + if (tp.flags & ts3.TypeFlags.Object) + return this.symName(tp.symbol) == "#Promise"; + if (tp.isUnionOrIntersection()) + return tp.types.some((t) => this.isPromise(t)); + return false; + } + emitTypeConversion(expr) { + this.checkAsyncFun( + this.checker.getTypeAtLocation(expr), + expr.expression + ); + return this.emitExpr(expr.expression); + } + retValError(expr) { + throwError2(expr, `invalid ?. expression nesting`); + } + emitChain(expr) { + const tmp = this.flattenChain(expr); + const wr = this.writer; + const chainLen = this.currChain.length; + this.currChain.push(...tmp.chain, tmp.expression); + const obj = this.emitExpr(tmp.expression); + if (this.retValRefs != 0) + this.retValError(expr); + this.retValExpr = tmp.expression; + this.retValRefs = 1; + wr.emitStmt(93 /* STMT1_STORE_RET_VAL */, obj); + const lbl = wr.mkLabel("opt"); + wr.emitJumpIfRetValNullish(lbl); + wr.emitStmt(93 /* STMT1_STORE_RET_VAL */, this.emitExpr(expr)); + if (this.retValRefs != 0) + this.retValError(expr); + wr.emitLabel(lbl); + this.currChain = this.currChain.slice(0, chainLen); + return this.retVal(); + } + emitExpr(expr) { + if (ts3.isOptionalChain(expr) && expr.kind != import_typescript2.SyntaxKind.NonNullExpression && !this.currChain.includes(expr)) + return this.emitChain(expr); + if (expr === this.retValExpr) { + if (this.retValRefs != 1) + this.retValError(expr); + this.retValRefs = 0; + return this.retVal(); + } + const folded = this.constantFold(expr); + if (folded) { + if (false) + this.reportError( + expr, + `folded -> ${folded.val}`, + ts3.DiagnosticCategory.Warning + ); + if (typeof folded.val == "string") + return this.writer.emitString(folded.val); + else + return literal(folded.val); + } + const tp = this.checker.getTypeAtLocation(expr); + if (this.isPromise(tp) && !ts3.isAwaitExpression(expr.parent)) + this.reportError(expr, "'await' missing"); + switch (expr.kind) { + case import_typescript2.SyntaxKind.AwaitExpression: + return this.emitExpr(expr.expression); + case import_typescript2.SyntaxKind.AsExpression: + case import_typescript2.SyntaxKind.TypeAssertionExpression: + return this.emitTypeConversion(expr); + case import_typescript2.SyntaxKind.CallExpression: + return this.emitCallExpression(expr); + case import_typescript2.SyntaxKind.Identifier: + return this.emitIdentifier(expr); + case import_typescript2.SyntaxKind.ThisKeyword: + return this.emitThisExpression(expr); + case import_typescript2.SyntaxKind.ElementAccessExpression: + return this.emitElementAccessExpression( + expr + ); + case import_typescript2.SyntaxKind.PropertyAccessExpression: + return this.emitPropertyAccessExpression( + expr + ); + case import_typescript2.SyntaxKind.TemplateExpression: + return this.emitTemplateExpression( + expr + ); + case import_typescript2.SyntaxKind.BinaryExpression: + return this.emitBinaryExpression(expr); + case import_typescript2.SyntaxKind.PrefixUnaryExpression: + return this.emitUnaryExpression( + expr + ); + case import_typescript2.SyntaxKind.TaggedTemplateExpression: + return this.emitStringOrBuffer( + expr + ); + case import_typescript2.SyntaxKind.ArrayLiteralExpression: + return this.emitArrayExpression( + expr + ); + case import_typescript2.SyntaxKind.ObjectLiteralExpression: + return this.emitObjectExpression( + expr + ); + case import_typescript2.SyntaxKind.ParenthesizedExpression: + return this.emitExpr( + expr.expression + ); + case import_typescript2.SyntaxKind.ArrowFunction: + return this.emitFunctionExpr(expr); + case import_typescript2.SyntaxKind.FunctionExpression: + return this.emitFunctionExpr(expr); + case import_typescript2.SyntaxKind.DeleteExpression: + return this.emitDeleteExpression(expr); + case import_typescript2.SyntaxKind.NewExpression: + return this.emitNewExpression(expr); + case import_typescript2.SyntaxKind.TypeOfExpression: + return this.writer.emitExpr( + 76 /* EXPR1_TYPEOF_STR */, + this.emitExpr(expr.expression) + ); + case import_typescript2.SyntaxKind.PostfixUnaryExpression: + return this.emitPostfixUnaryExpression( + expr + ); + case import_typescript2.SyntaxKind.ConditionalExpression: + return this.emitConditionalExpression( + expr + ); + case import_typescript2.SyntaxKind.JsxElement: + return this.emitJsxElement( + expr, + expr.openingElement, + expr.children + ); + case import_typescript2.SyntaxKind.JsxSelfClosingElement: + return this.emitJsxElement( + expr, + expr + ); + case import_typescript2.SyntaxKind.JsxFragment: + return this.emitJsxElement( + expr, + null, + expr.children + ); + case import_typescript2.SyntaxKind.JsxExpression: + assert2(!expr.dotDotDotToken); + return this.emitExpr(expr.expression); + default: + return throwError2(expr, "unhandled expr: " + import_typescript2.SyntaxKind[expr.kind]); + } + } + handleException(stmt, e) { + if (e.terminateEmit) + throw e; + if (!stmt) + stmt = this.lastNode; + if (e.sourceNode !== void 0) { + const node = e.sourceNode || stmt; + this.reportError(node, e.message); + } else { + debugger; + if (this.numErrors > 0) { + this.reportError( + stmt, + `confused by previous errors, bailing out (${e.message})` + ); + } else { + this.reportError(stmt, "Internal error: " + e.message); + console.error(e.stack); + } + e.terminateEmit = true; + throw e; + } + } + emitStmt(stmt) { + const wr = this.writer; + this.lastNode = stmt; + this.assignCellsToStmt(stmt); + wr.locPush(this.getSrcLocation(stmt)); + try { + switch (stmt.kind) { + case import_typescript2.SyntaxKind.ExpressionStatement: + return this.emitExpressionStatement( + stmt + ); + case import_typescript2.SyntaxKind.VariableStatement: + return this.emitVariableStatement( + stmt + ); + case import_typescript2.SyntaxKind.IfStatement: + return this.emitIfStatement(stmt); + case import_typescript2.SyntaxKind.WhileStatement: + return this.emitWhileStatement(stmt); + case import_typescript2.SyntaxKind.ForStatement: + return this.emitForStatement(stmt); + case import_typescript2.SyntaxKind.ForOfStatement: + case import_typescript2.SyntaxKind.ForInStatement: + return this.emitForInOrOfStatement( + stmt + ); + case import_typescript2.SyntaxKind.ContinueStatement: + case import_typescript2.SyntaxKind.BreakStatement: + return this.emitBreakContStatement( + stmt + ); + case import_typescript2.SyntaxKind.SwitchStatement: + return this.emitSwitchStatement(stmt); + case import_typescript2.SyntaxKind.Block: + return this.emitBlock(stmt); + case import_typescript2.SyntaxKind.TryStatement: + return this.emitTryStatement(stmt); + case import_typescript2.SyntaxKind.ThrowStatement: + return this.emitThrowStatement(stmt); + case import_typescript2.SyntaxKind.ReturnStatement: + return this.emitReturnStatement(stmt); + case import_typescript2.SyntaxKind.FunctionDeclaration: + return this.emitFunctionDeclaration( + stmt + ); + case import_typescript2.SyntaxKind.ClassDeclaration: + return this.emitClassDeclaration( + stmt + ); + case import_typescript2.SyntaxKind.DebuggerStatement: + return this.writer.emitStmt(87 /* STMT0_DEBUGGER */); + case import_typescript2.SyntaxKind.EnumDeclaration: + return this.emitEnumDeclaration(stmt); + case import_typescript2.SyntaxKind.TypeAliasDeclaration: + case import_typescript2.SyntaxKind.ExportDeclaration: + case import_typescript2.SyntaxKind.InterfaceDeclaration: + case import_typescript2.SyntaxKind.ModuleDeclaration: + case import_typescript2.SyntaxKind.EmptyStatement: + return; + case import_typescript2.SyntaxKind.ImportDeclaration: + return; + default: + throwError2(stmt, `unhandled stmt type: ${import_typescript2.SyntaxKind[stmt.kind]}`); + } + } catch (e) { + this.handleException(stmt, e); + } finally { + wr.stmtEnd(); + wr.locPop(); + } + } + assertLittleEndian() { + const test = new Uint16Array([53314]); + assert2(toHex(new Uint8Array(test.buffer)) == "42d0"); + } + specialFieldFmt(f) { + switch (f.type) { + case "string": + return 2 /* STRING */; + case "bool": + return 4 /* BOOL */; + case "string0": + return 3 /* STRING0 */; + case "bytes": + return 1 /* BYTES */; + case "pipe": + return 5 /* PIPE */; + case "pipe_port": + return 6 /* PIPE_PORT */; + default: + return void 0; + } + } + fieldFmt(f) { + const special = f ? this.specialFieldFmt(f) : 0 /* EMPTY */; + if (special != void 0) { + return 12 /* SPECIAL */ | (special & 15) << 4 | special >> 4 & 3; + } else { + return bufferFmt(f); + } + } + serializeStartServices() { + var _a; + const bcfg = this.host.getConfig(); + const jcfg = (_a = bcfg == null ? void 0 : bcfg.hwInfo) != null ? _a : {}; + for (const s of this.startServices) { + if (!s.name) + s.name = s.service; + } + const cfg = jsonToDcfg({ + ...jcfg, + services: new Array(64).concat(this.startServices) + }); + Object.assign(cfg, this.hwCfg); + const bin = serializeDcfg(cfg); + const writer = new SectionWriter(); + if (this.startServices.length || Object.keys(jcfg).length) { + writer.append(bin); + writer.align(); + } + return writer; + } + serializeSpecs() { + const usedSpecs = this.usedSpecs.slice(); + const numSpecs = usedSpecs.length; + const specWriter = new SectionWriter(); + const later = usedSpecs.map((spec) => { + const specDesc = new Uint8Array(16 /* SERVICE_SPEC_HEADER_SIZE */); + specWriter.append(specDesc); + let flags = 0; + if (spec.extends.indexOf("_sensor") >= 0) + flags |= 1 /* DERIVE_SENSOR */; + const name = upperCamel(spec.camelName); + write162(specDesc, 0, this.addString(name)); + write322(specDesc, 4, spec.classIdentifier); + write162(specDesc, 2, flags); + const pkts = spec.packets; + function isBytes(f) { + return f.storage && /u8\[/.test(f.type); + } + return () => { + const multifields = pkts.map((pkt) => { + if (pkt.fields.length == 0 || pkt.fields.length == 1 && !pkt.fields[0].startRepeats && !isBytes(pkt.fields[0])) + return -1; + else { + const r = specWriter.currSize >> 2; + for (const f of pkt.fields) { + let flags2 = 0; + let numfmt2 = 0; + if (isBytes(f)) { + flags2 |= 1 /* IS_BYTES */; + numfmt2 = f.storage; + } else { + numfmt2 = this.fieldFmt(f); + } + if (f.startRepeats) + flags2 |= 2 /* STARTS_REPEATS */; + specWriter.append( + encodeU16LE([ + this.addString(camelize(f.name)), + numfmt2 | flags2 << 8 + ]) + ); + } + specWriter.append(encodeU16LE([0, 0])); + assert2(4 == 4 /* SERVICE_SPEC_FIELD_SIZE */); + return r; + } + }); + const startoff = specWriter.currSize; + let idx = -1; + for (const pkt of pkts) { + idx++; + let code = pkt.identifier; + let flags2 = 0; + if (pkt.derived) + continue; + if (isRegister4(pkt)) + code |= 4096 /* REGISTER */; + else if (pkt.kind == "event") + code |= 32768 /* EVENT */; + else if (pkt.kind == "command") + code |= 0 /* COMMAND */; + else if (pkt.kind == "report") + code |= 8192 /* REPORT */; + else if (pkt.kind.includes("pipe")) + continue; + else + oops(`unknown pkt kind ${pkt.kind}`); + let numfmt2 = multifields[idx]; + if (numfmt2 == -1) + numfmt2 = this.fieldFmt(pkt.fields[0]); + else + flags2 |= 1 /* MULTI_FIELD */; + const pktDesc = encodeU16LE([ + this.addString(pktName(pkt)), + code, + flags2, + numfmt2 + ]); + assert2( + pktDesc.length == 8 /* SERVICE_SPEC_PACKET_SIZE */, + "sz" + ); + specWriter.append(pktDesc); + } + write162(specDesc, 10, startoff >> 2); + const nument = (specWriter.currSize - startoff) / 8 /* SERVICE_SPEC_PACKET_SIZE */; + write162(specDesc, 8, nument); + }; + }); + later.forEach((f) => f()); + specWriter.align(); + return { + numSpecs, + specWriter + }; + function isRegister4(pi) { + return pi.kind == "ro" || pi.kind == "rw" || pi.kind == "const"; + } + } + serialize() { + this.assertLittleEndian(); + const fixHeader = new SectionWriter(32 /* FIX_HEADER_SIZE */); + const sectDescs = new SectionWriter(); + const sections = [fixHeader, sectDescs]; + const hd = new Uint8Array(32 /* FIX_HEADER_SIZE */); + hd.set( + encodeU32LE([ + 1400268100 /* MAGIC0 */, + 4046024202 /* MAGIC1 */, + 34537478 /* IMG_VERSION */, + this.globals.length + ]) + ); + fixHeader.append(hd); + const funDesc = new SectionWriter(); + const funData = new SectionWriter(); + const floatData = new SectionWriter(); + const roleData = new SectionWriter(); + const asciiDesc = new SectionWriter(); + const utf8Desc = new SectionWriter(); + const bufferDesc = new SectionWriter(); + const strData = new SectionWriter(); + const { specWriter, numSpecs } = this.serializeSpecs(); + const dcfgWriter = this.serializeStartServices(); + write162(hd, 14, numSpecs); + const writers = [ + funDesc, + funData, + floatData, + roleData, + asciiDesc, + utf8Desc, + bufferDesc, + strData, + specWriter, + dcfgWriter + ]; + assert2(10 /* NUM_IMG_SECTIONS */ == writers.length); + for (const s of writers) { + sectDescs.append(s.desc); + sections.push(s); + } + funDesc.size = 16 /* FUNCTION_HEADER_SIZE */ * this.procs.length; + for (const proc of this.procs) { + funDesc.append(proc.writer.desc); + proc.writer.offsetInFuncs = funData.currSize; + funData.append(proc.writer.serialize()); + } + const floatBuf = new Float64Array(this.floatLiterals).buffer; + const nanboxedU32 = new Uint32Array(floatBuf); + for (let i = 0; i < this.floatLiterals.length; ++i) { + const f = this.floatLiterals[i]; + if ((f | 0) == f) { + nanboxedU32[i * 2] = f; + nanboxedU32[i * 2 + 1] = -1; + } + } + floatData.append(new Uint8Array(floatBuf)); + function addLits(lst, dst) { + lst.forEach((str) => { + const buf = typeof str == "string" ? stringToUint8Array2(toUTF82(str) + "\0") : str; + let desc = new Uint8Array(8 /* SECTION_HEADER_SIZE */); + const size = typeof str == "string" ? buf.length - 1 : buf.length; + if (dst != asciiDesc) + strData.align(); + write322(desc, 0, strData.currSize); + write322(desc, 4, size); + assert2(size <= 61440); + if (dst == utf8Desc) { + let isCont = function(c) { + return (c & 192) == 128; + }; + let len = 0; + const mask2 = (1 << 4 /* UTF8_TABLE_SHIFT */) - 1; + const jmps = [size, 0]; + for (let i = 0; i < size; ++i) { + len++; + while (isCont(buf[i + 1])) + i++; + if (len && (len - 1 & mask2) == mask2) + jmps.push(i + 1); + } + assert2((len >> 4 /* UTF8_TABLE_SHIFT */) + 2 == jmps.length); + jmps[1] = len; + const tmp = new Uint8Array(jmps.length * 2); + jmps.forEach((v, i) => write162(tmp, i * 2, v)); + strData.append(tmp); + desc = desc.slice(0, 4 /* UTF8_HEADER_SIZE */); + } + strData.append(buf); + if (dst == asciiDesc) { + assert2(desc[2] == 0); + assert2(desc[3] == 0); + desc = desc.slice(0, 2 /* ASCII_HEADER_SIZE */); + } + dst.append(desc); + return desc; + }); + } + addLits(this.asciiLiterals, asciiDesc); + addLits(this.utf8Literals, utf8Desc); + addLits(this.bufferLiterals, bufferDesc); + asciiDesc.align(); + strData.append(new Uint8Array(1)); + strData.align(); + let off = 0; + for (const s of sections) { + s.finalize(off); + off += s.size; + } + const mask = 32 /* BINARY_SIZE_ALIGN */ - 1; + off = off + mask & ~mask; + const outp = new Uint8Array(off); + for (const proc of this.procs) { + proc.writer.finalizeDesc(funData.offset + proc.writer.offsetInFuncs); + } + off = 0; + for (const s of sections) { + for (const d of s.data) { + outp.set(d, off); + off += d.length; + } + } + const left = outp.length - off; + assert2(0 <= left && left < 32 /* BINARY_SIZE_ALIGN */); + const srcmap = arrayConcatMany(this.procs.map((p) => p.writer.srcmap)); + let prevPC = 0; + let prevPos = 0; + for (let i = 0; i < srcmap.length; i += srcMapEntrySize) { + const pos = srcmap[i]; + const pc = srcmap[i + 2]; + srcmap[i] = pos - prevPos; + srcmap[i + 2] = pc - prevPC; + prevPC = pc; + prevPos = pos; + } + const dbg = { + sizes: { + header: fixHeader.size + sectDescs.size, + floats: floatData.size, + strings: strData.size + asciiDesc.size + utf8Desc.size + bufferDesc.size, + roles: roleData.size, + align: left + }, + localConfig: unresolveBuildConfig(this.host.getConfig()), + specs: this.usedSpecs.map((s) => ({ + name: s.name, + classIdentifier: s.classIdentifier + })), + functions: this.procs.map((p) => p.debugInfo()), + globals: this.globals.map((r) => r.debugInfo()), + srcmap, + sources: this.srcFiles.slice(), + binary: { hex: toHex(outp) } + }; + return { binary: outp, dbg }; + } + getAssembly() { + return this.procs.map((p) => p.toString()).join("\n"); + } + inMainFile(node) { + return node.getSourceFile() == this.mainFile; + } + emitLibrary() { + if (!this.isLibrary) + return; + const q = (b) => { + if (typeof b == "string") + return "s:" + b; + else + return "h:" + toHex(b); + }; + const cleanDesc = (desc) => { + desc = new Uint8Array(desc); + write322(desc, 0, 0); + return desc; + }; + const lib = { + procs: this.procs.map((p) => ({ + name: p.name, + desc: q(cleanDesc(p.writer.desc)), + body: q(p.writer.serialize()) + })), + buffer: this.bufferLiterals.map(q), + ascii: this.asciiLiterals.map(q), + utf8: this.utf8Literals.map(q), + floats: this.floatLiterals.slice() + }; + this.host.write(DEVS_LIB_FILE, JSON.stringify(lib, null, 1)); + } + readFile(fileName) { + try { + return this.host.read(fileName); + } catch (e) { + return void 0; + } + } + readSettings() { + try { + const MAX_SETTING_NAME_LENGTH = 14; + const envDefaults = parseToSettings( + this.readFile("./.env.defaults"), + false + ); + const d = Object.keys(envDefaults).find( + (k) => k.length > MAX_SETTING_NAME_LENGTH + ); + if (d) + this.printDiag( + mkDiag( + "./.env.defaults", + `setting name '${d}' too long (max ${MAX_SETTING_NAME_LENGTH} chars)` + ) + ); + const envLocal = parseToSettings( + this.readFile("./.env.local"), + true + ); + const l = Object.keys(envDefaults).find( + (k) => k.length > MAX_SETTING_NAME_LENGTH + ); + if (l) + this.printDiag( + mkDiag( + "./.env.local", + `setting name '${d}' too long (max ${MAX_SETTING_NAME_LENGTH - 1} chars)` + ) + ); + const settings = { ...envDefaults, ...envLocal }; + return settings; + } catch (e) { + return void 0; + } + } + emit() { + var _a; + assert2(!this.tree); + const settings = this.readSettings(); + const ast = buildAST( + this.mainFileName, + this.host, + this.prelude, + (modulePath, pkgJSON) => { + var _a2; + const fn = modulePath + "package.json"; + try { + const pkg = JSON.parse(pkgJSON); + if ((_a2 = pkg == null ? void 0 : pkg.devicescript) == null ? void 0 : _a2.library) + return true; + this.printDiag( + mkDiag( + fn, + `missing "devicescript" section; please use 'devs add npm' on your package` + ) + ); + return false; + } catch { + this.printDiag(mkDiag(fn, "invalid package.json")); + return false; + } + } + ); + this.tree = ast.program; + this.checker = this.tree.getTypeChecker(); + getProgramDiagnostics(this.tree).forEach((d) => this.printDiag(d)); + const files = this.tree.getSourceFiles(); + this.mainFile = files[files.length - 1]; + try { + this.emitProgram(this.tree); + } catch (e) { + if (!e.terminateEmit) + throw e; + } + let binary; + let dbg; + if (this.numErrors == 0) { + for (const p of this.procs) { + if (!p.mapVarOffset) + oops(`proc ${p.name} not finalized`); + } + const staticProcs = {}; + for (const p of this.procs) { + if (!p.usesClosure) + staticProcs[p.index + ""] = true; + } + const funIsStatic = (idx) => staticProcs[idx + ""] == true; + for (const p of this.procs) { + p.writer.makeFunctionsStatic(funIsStatic); + } + ; + ({ binary, dbg } = this.serialize()); + this.host.write(DEVS_DBG_FILE, JSON.stringify(dbg)); + this.host.write(DEVS_SIZES_FILE, computeSizes(dbg)); + this.host.write(DEVS_BYTECODE_FILE, binary); + try { + (_a = this.host) == null ? void 0 : _a.verifyBytecode(binary, dbg); + } catch (e) { + this.reportError(this.mainFile, e.message); + } + } + if (this.numErrors == 0) + this.emitLibrary(); + return { + success: this.numErrors == 0, + binary, + dbg, + usedFiles: ast.usedFiles(), + diagnostics: this.diagnostics, + config: this.host.getConfig(), + settings + }; + } + }; + function compile(code, opts = {}) { + const { + files = {}, + mainFileName = "src/main.ts", + log = (msg) => console.debug(msg), + verifyBytecode = () => { + }, + config, + errors: errors2 = [] + } = opts; + const cfg = resolveBuildConfig(config); + const host = { + write: (filename, contents) => { + files[filename] = contents; + }, + read: (filename) => { + if (filename == mainFileName) + return code; + return files[filename]; + }, + resolvePath: (path) => path, + log, + error: (err) => errors2.push(err), + getConfig: () => cfg, + verifyBytecode, + getFlags: () => { + var _a; + return (_a = opts.flags) != null ? _a : {}; + } + }; + const p = new Program(mainFileName, host); + return p.emit(); + } + function compileWithHost(mainFileName, host) { + const p = new Program(mainFileName, host); + return p.emit(); + } + function testCompiler(mainFileName, host) { + const code = host.read(mainFileName); + const lines = code.split(/\r?\n/).map((s) => { + const m = /\/\/\s*!\s*(.*)/.exec(s); + if (m) + return m[1]; + else + return null; + }); + const numerr = lines.filter((s) => !!s).length; + let numExtra = 0; + const myhost = Object.assign({}, host); + myhost.write = () => { + }; + myhost.log = () => { + }; + myhost.error = (err) => { + let isOK = false; + if (err.file) { + const { line } = ts3.getLineAndCharacterOfPosition( + err.file, + err.start + ); + const exp = lines[line]; + const text = ts3.flattenDiagnosticMessageText(err.messageText, "\n"); + if (exp != null && text.indexOf(exp) >= 0) { + lines[line] = ""; + isOK = true; + } + } + if (!isOK) { + numExtra++; + console.error(formatDiagnostics2([err])); + } + }; + const p = new Program(mainFileName, myhost); + const r = p.emit(); + let missingErrs = 0; + for (let i = 0; i < lines.length; ++i) { + if (lines[i]) { + const msg = "missing error: " + lines[i]; + console.error(`${mainFileName}(${i + 1},${1}): ${msg}`); + missingErrs++; + } + } + if (missingErrs) + throw new Error("some errors were not reported"); + if (numExtra) + throw new Error("extra errors reported"); + if (numerr && r.success) + throw new Error("unexpected success"); + if (r.success) { + const cont = p.getAssembly(); + if (cont.indexOf("???oops") >= 0) { + console.error(cont); + throw new Error("bad disassembly"); + } + } + } + + // compiler/src/logparser.ts + var JD_LSTORE_MAGIC0 = 172770378; + var JD_LSTORE_MAGIC1 = 3050406942; + var JD_LSTORE_VERSION = 5; + var SECTOR_SHIFT = 9; + var SECTOR_SIZE = 1 << SECTOR_SHIFT; + function getString(buf) { + let end = buf.indexOf(0); + if (end < 0) + end = buf.length; + return fromUTF82(uint8ArrayToString2(buf.slice(0, end))); + } + function parseDevInfo(buf) { + return { + deviceIdentifier: toHex(buf.slice(0, 8)), + firmwareName: getString(buf.slice(8, 8 + 64)), + firmwareVersion: getString(buf.slice(8 + 64, 8 + 64 + 32)) + }; + } + var JD_LSTORE_TYPE_DEVINFO = 1; + var JD_LSTORE_TYPE_DMESG = 2; + var JD_LSTORE_TYPE_LOG = 3; + var JD_LSTORE_TYPE_JD_FRAME = 4; + var JD_LSTORE_TYPE_PANIC_LOG = 5; + var DEVS_TRACE_EV_NOW = 64; + var DEVS_TRACE_EV_INIT = 65; + var DEVS_TRACE_EV_SERVICE_PACKET = 66; + var DEVS_TRACE_EV_NON_SERVICE_PACKET = 67; + var DEVS_TRACE_EV_BROADCAST_PACKET = 68; + var DEVS_TRACE_EV_ROLE_CHANGED = 69; + var DEVS_TRACE_EV_FIBER_RUN = 70; + var DEVS_TRACE_EV_FIBER_YIELD = 71; + var typeLookup = { + [JD_LSTORE_TYPE_DEVINFO]: "devinfo", + [JD_LSTORE_TYPE_DMESG]: "dmesg", + [JD_LSTORE_TYPE_LOG]: "log", + [JD_LSTORE_TYPE_PANIC_LOG]: "panic_log", + [JD_LSTORE_TYPE_JD_FRAME]: "frame", + [DEVS_TRACE_EV_NOW]: "NOW", + [DEVS_TRACE_EV_INIT]: "INIT", + [DEVS_TRACE_EV_SERVICE_PACKET]: "PKT", + [DEVS_TRACE_EV_NON_SERVICE_PACKET]: "PKT[?]", + [DEVS_TRACE_EV_BROADCAST_PACKET]: "PKT[*]", + [DEVS_TRACE_EV_ROLE_CHANGED]: "ROLE", + [DEVS_TRACE_EV_FIBER_RUN]: "FIBER_RUN", + [DEVS_TRACE_EV_FIBER_YIELD]: "FIBER_YIELD" + }; + var GenerationInfo = class { + constructor(parent, index) { + this.parent = parent; + this.index = index; + } + get numBlocks() { + return this.lastBlock - this.firstBlock + 1; + } + toString() { + return `gen ${this.index}, ${bytes( + this.numBlocks * this.parent.blockSize + )}`; + } + async dump() { + return { + generation: this.index, + size: this.numBlocks * this.parent.blockSize + }; + } + async blockEvents(blockIdx, r = []) { + if (this.firstBlock <= blockIdx && blockIdx <= this.lastBlock) { + const bl = await this.parent._readBlock(blockIdx); + parseBlock(bl, r); + } + return r; + } + async devInfo() { + for (const ev of await this.blockEvents(this.firstBlock)) { + if (ev.type == JD_LSTORE_TYPE_DEVINFO) + return ev.decoded; + } + return void 0; + } + async readEvents(maxBlocks = 4294967295) { + const startIdx = Math.max(this.firstBlock, this.lastBlock - maxBlocks); + const events = []; + for (let i = startIdx; i <= this.lastBlock; ++i) { + this.blockEvents(i, events); + } + return events; + } + async computeStats() { + let dataSize = 0; + let utilizedSize = 0; + let numEvents = 0; + for (let i = this.firstBlock; i <= this.lastBlock; ++i) { + const bl = await this.parent._readBlock(i); + if (!bl.generation) { + console.log("bad block " + i); + continue; + } + const r = []; + const st = {}; + parseBlock(bl, r, st); + numEvents += r.length; + dataSize += bl.data.length; + utilizedSize += st.endptr; + } + return { + dataSize, + utilizedSize, + numEvents, + avgEventSize: utilizedSize / numEvents, + utilization: utilizedSize / dataSize + }; + } + async forEachEvent(cb) { + if (!cb) + cb = (ev) => { + console.log(ev.human); + return Promise.resolve(); + }; + for (let i = this.firstBlock; i <= this.lastBlock; ++i) { + for (const ev of await this.blockEvents(i)) { + await cb(ev); + } + } + } + }; + var LogInfo = class { + constructor(readfn) { + this.readfn = readfn; + this.generations = []; + } + async generation(gen) { + if (this.firstGeneration <= gen && gen <= this.lastGeneration) { + let g = this.generations[gen]; + if (!g) { + this.generations[gen] = g = new GenerationInfo(this, gen); + g.firstBlock = await this.findLastBlock((b) => b.generation < gen) + 1; + g.lastBlock = await this.findLastBlock((b) => b.generation <= gen); + } + return g; + } else { + return void 0; + } + } + async dump() { + const r = { + deviceInfo: this.deviceInfo, + purpuse: this.purpose, + comment: this.comment, + size: this.dataBlocks * this.blockSize, + generations: [] + }; + for (let i = this.firstGeneration; i <= this.lastGeneration; ++i) { + const g = await this.generation(i); + r.generations.push(await g.dump()); + } + return r; + } + async _load() { + const hd = await this.readfn(0, SECTOR_SIZE); + const [ + magic0, + magic1, + version, + sector_size, + sectors_per_block, + header_blocks, + num_blocks, + num_rewrites, + hd_block_magic0, + hd_block_magic1 + ] = decodeU32LE(hd); + if (magic0 != JD_LSTORE_MAGIC0 || magic1 != JD_LSTORE_MAGIC1) + oops2("bad magic"); + if (version != JD_LSTORE_VERSION) + oops2("bad version"); + if (sector_size != SECTOR_SIZE) + oops2("bad sector size"); + this.blockSize = sector_size * sectors_per_block; + const file_size = num_blocks * this.blockSize; + if (file_size >= 4 * 1024 * 1024 * 1024) + oops2("file too big (over 4GB)"); + this.dataBlocks = num_blocks - header_blocks; + this.block0Idx = 0; + this._readBlock = async (off) => { + off += this.block0Idx; + off %= this.dataBlocks; + if (off < 0) + off += this.dataBlocks; + const buf = await this.readfn( + (header_blocks + off) * this.blockSize, + this.blockSize + ); + const [block_magic0, _generation, timestamp_lo, timestamp_hi] = decodeU32LE(buf.slice(0, 4 * 4)); + const [block_magic1, _crc32] = decodeU32LE(buf.slice(-2 * 4)); + let timestamp = timestamp_lo + timestamp_hi * 4294967296; + let generation = _generation; + if (block_magic0 != hd_block_magic0 || block_magic1 != hd_block_magic1 || crc32(buf.slice(0, -4)) != _crc32) { + timestamp = 0; + generation = 0; + } + return { + generation, + timestamp, + data: buf.slice(4 * 4, -2 * 4) + }; + }; + function block_le(a, b) { + return a.generation < b.generation || a.generation == b.generation && a.timestamp <= b.timestamp; + } + const bl0 = await this._readBlock(0); + const lastBl = await this.findLastBlock((b) => block_le(bl0, b)); + if (lastBl < 0) + oops2("empty file"); + this.block0Idx = lastBl + 1; + const devInfoOff = 16 * 4; + const afterDevInfo = devInfoOff + 8 + 64 + 64; + this.deviceInfo = parseDevInfo(hd.slice(devInfoOff, afterDevInfo)); + this.purpose = getString(hd.slice(afterDevInfo, afterDevInfo + 32)); + this.comment = getString( + hd.slice(afterDevInfo + 32, afterDevInfo + 32 + 64) + ); + this.firstGeneration = (await this._readBlock(0)).generation; + if (this.firstGeneration == 0) + this.firstGeneration = 1; + this.lastGeneration = (await this._readBlock(-1)).generation; + function oops2(msg) { + throw new Error("failed to parse LSTOR log: " + msg); + } + } + async findLastBlock(cond) { + let l = 0; + let r = this.dataBlocks - 1; + if (!cond(await this._readBlock(l))) + return -1; + while (l < r) { + let m = (l + r >> 1) + 1; + const b = await this._readBlock(m); + if (cond(b)) { + l = m; + } else { + r = m - 1; + } + } + return l; + } + }; + function parseBlock(b, r = [], statsRes) { + let ptr = 0; + while (ptr < b.data.length - 1) { + const tp = b.data[ptr]; + const sz = b.data[ptr + 1]; + const tdelta = read162(b.data, ptr + 2); + if (tp == 0 && sz == 0) + break; + const endp = ptr + 4 + sz; + const ev = { + generation: b.generation, + timestamp: b.timestamp + tdelta, + type: tp, + payload: b.data.slice(ptr + 4, endp) + }; + if (!statsRes) + decodeEvent2(ev); + r.push(ev); + ptr = endp; + } + if (statsRes) + statsRes.endptr = ptr; + return r; + } + function decodeEvent2(ev) { + const tp = typeLookup[ev.type] || "tp:0x" + ev.type.toString(16); + const ts5 = (ev.timestamp / 1e3).toFixed(3); + const pref = ts5 + " " + tp + " "; + switch (ev.type) { + case JD_LSTORE_TYPE_DEVINFO: + ev.decoded = parseDevInfo(ev.payload); + ev.human = pref + JSON.stringify(ev.decoded); + break; + case JD_LSTORE_TYPE_DMESG: + case JD_LSTORE_TYPE_LOG: + case JD_LSTORE_TYPE_PANIC_LOG: + ev.decoded = uint8ArrayToString2(ev.payload); + try { + ev.decoded = fromUTF82(ev.decoded); + } catch { + } + ev.human = prefix(pref, ev.decoded.replace(/\x1B\[[0-9;]+m/g, "")); + break; + case DEVS_TRACE_EV_BROADCAST_PACKET: + case DEVS_TRACE_EV_SERVICE_PACKET: + case DEVS_TRACE_EV_NON_SERVICE_PACKET: + ev.decoded = toHex(ev.payload); + ev.human = ts5 + " " + ev.decoded; + break; + case DEVS_TRACE_EV_NOW: + ev.decoded = read323(ev.payload, 0); + ev.human = pref + ev.decoded; + break; + default: + ev.human = pref + toHex(ev.payload); + break; + } + } + function prefix(pref, lines) { + while (lines[lines.length - 1] == "\n") + lines = lines.slice(0, -1); + lines = pref + lines; + if (lines.indexOf("\n") >= 0) + lines = lines.replace(/\n/g, "\n" + pref); + return lines; + } + function bytes(num) { + const K = 1024; + const M = K * K; + const G = K * K * K; + if (num < 2 * K) + return num + " B"; + else if (num < M) + return (num >>> 10) + " kB"; + else if (num < 100 * M) + return (num / M).toFixed(1) + " MB"; + else if (num < G) + return Math.round(num / M) + " MB"; + else + return (num / G).toFixed(1) + " GB"; + } + async function parseLog(readfn) { + const logInfo = new LogInfo(readfn); + await logInfo._load(); + return logInfo; + } + function parseLogFile(f) { + return parseLog( + (off, size) => f.slice(off, off + size).arrayBuffer().then((buf) => new Uint8Array(buf)) + ); + } + var crc32_lookup = [ + 0, + 1996959894, + 3993919788, + 2567524794, + 124634137, + 1886057615, + 3915621685, + 2657392035, + 249268274, + 2044508324, + 3772115230, + 2547177864, + 162941995, + 2125561021, + 3887607047, + 2428444049, + 498536548, + 1789927666, + 4089016648, + 2227061214, + 450548861, + 1843258603, + 4107580753, + 2211677639, + 325883990, + 1684777152, + 4251122042, + 2321926636, + 335633487, + 1661365465, + 4195302755, + 2366115317, + 997073096, + 1281953886, + 3579855332, + 2724688242, + 1006888145, + 1258607687, + 3524101629, + 2768942443, + 901097722, + 1119000684, + 3686517206, + 2898065728, + 853044451, + 1172266101, + 3705015759, + 2882616665, + 651767980, + 1373503546, + 3369554304, + 3218104598, + 565507253, + 1454621731, + 3485111705, + 3099436303, + 671266974, + 1594198024, + 3322730930, + 2970347812, + 795835527, + 1483230225, + 3244367275, + 3060149565, + 1994146192, + 31158534, + 2563907772, + 4023717930, + 1907459465, + 112637215, + 2680153253, + 3904427059, + 2013776290, + 251722036, + 2517215374, + 3775830040, + 2137656763, + 141376813, + 2439277719, + 3865271297, + 1802195444, + 476864866, + 2238001368, + 4066508878, + 1812370925, + 453092731, + 2181625025, + 4111451223, + 1706088902, + 314042704, + 2344532202, + 4240017532, + 1658658271, + 366619977, + 2362670323, + 4224994405, + 1303535960, + 984961486, + 2747007092, + 3569037538, + 1256170817, + 1037604311, + 2765210733, + 3554079995, + 1131014506, + 879679996, + 2909243462, + 3663771856, + 1141124467, + 855842277, + 2852801631, + 3708648649, + 1342533948, + 654459306, + 3188396048, + 3373015174, + 1466479909, + 544179635, + 3110523913, + 3462522015, + 1591671054, + 702138776, + 2966460450, + 3352799412, + 1504918807, + 783551873, + 3082640443, + 3233442989, + 3988292384, + 2596254646, + 62317068, + 1957810842, + 3939845945, + 2647816111, + 81470997, + 1943803523, + 3814918930, + 2489596804, + 225274430, + 2053790376, + 3826175755, + 2466906013, + 167816743, + 2097651377, + 4027552580, + 2265490386, + 503444072, + 1762050814, + 4150417245, + 2154129355, + 426522225, + 1852507879, + 4275313526, + 2312317920, + 282753626, + 1742555852, + 4189708143, + 2394877945, + 397917763, + 1622183637, + 3604390888, + 2714866558, + 953729732, + 1340076626, + 3518719985, + 2797360999, + 1068828381, + 1219638859, + 3624741850, + 2936675148, + 906185462, + 1090812512, + 3747672003, + 2825379669, + 829329135, + 1181335161, + 3412177804, + 3160834842, + 628085408, + 1382605366, + 3423369109, + 3138078467, + 570562233, + 1426400815, + 3317316542, + 2998733608, + 733239954, + 1555261956, + 3268935591, + 3050360625, + 752459403, + 1541320221, + 2607071920, + 3965973030, + 1969922972, + 40735498, + 2617837225, + 3943577151, + 1913087877, + 83908371, + 2512341634, + 3803740692, + 2075208622, + 213261112, + 2463272603, + 3855990285, + 2094854071, + 198958881, + 2262029012, + 4057260610, + 1759359992, + 534414190, + 2176718541, + 4139329115, + 1873836001, + 414664567, + 2282248934, + 4279200368, + 1711684554, + 285281116, + 2405801727, + 4167216745, + 1634467795, + 376229701, + 2685067896, + 3608007406, + 1308918612, + 956543938, + 2808555105, + 3495958263, + 1231636301, + 1047427035, + 2932959818, + 3654703836, + 1088359270, + 936918e3, + 2847714899, + 3736837829, + 1202900863, + 817233897, + 3183342108, + 3401237130, + 1404277552, + 615818150, + 3134207493, + 3453421203, + 1423857449, + 601450431, + 3009837614, + 3294710456, + 1567103746, + 711928724, + 3020668471, + 3272380065, + 1510334235, + 755167117 + ]; + function crc32(data) { + let crc2 = 0; + crc2 = ~crc2; + for (let i = 0; i < data.length; ++i) + crc2 = crc32_lookup[(crc2 ^ data[i]) & 255] ^ crc2 >>> 8; + return ~crc2 >>> 0; + } + + // compiler/src/uf2.ts + var UF2_MAGIC_START0 = 171066965; + var UF2_MAGIC_START1 = 2656915799; + var UF2_MAGIC_END = 179400496; + var UF2_FLAG_NONE = 0; + var UF2_FLAG_NOFLASH = 1; + var UF2_FLAG_FILE = 4096; + var UF2_FLAG_FAMILY_ID_PRESENT = 8192; + function parseUF2Block(block) { + let wordAt = (k) => { + return block[k] + (block[k + 1] << 8) + (block[k + 2] << 16) + (block[k + 3] << 24) >>> 0; + }; + if (!block || block.length != 512 || wordAt(0) != UF2_MAGIC_START0 || wordAt(4) != UF2_MAGIC_START1 || wordAt(block.length - 4) != UF2_MAGIC_END) + return null; + let flags = wordAt(8); + let payloadSize = wordAt(16); + if (payloadSize > 476) + payloadSize = 256; + let filename = null; + let familyId = 0; + let fileSize = 0; + if (flags & UF2_FLAG_FILE) { + let fnbuf = block.slice(32 + payloadSize); + let len = fnbuf.indexOf(0); + if (len >= 0) { + fnbuf = fnbuf.slice(0, len); + } + filename = fromUTF82(uint8ArrayToString2(fnbuf)); + fileSize = wordAt(28); + } + if (flags & UF2_FLAG_FAMILY_ID_PRESENT) { + familyId = wordAt(28); + } + return { + flags, + targetAddr: wordAt(12), + payloadSize, + blockNo: wordAt(20), + numBlocks: wordAt(24), + fileSize, + familyId, + data: block.slice(32, 32 + payloadSize), + filename, + origData: block + }; + } + function parseUF2File(blocks) { + let r = []; + for (let i = 0; i < blocks.length; i += 512) { + let b = parseUF2Block(blocks.slice(i, i + 512)); + if (b) + r.push(b); + } + return r; + } + function uf2ToBin(blocks, endAddr = void 0) { + if (blocks.length < 512) + return null; + let curraddr = -1; + let appstartaddr = -1; + let bufs = []; + for (let i = 0; i < blocks.length; ++i) { + let ptr = i * 512; + let bl = parseUF2Block(blocks.slice(ptr, ptr + 512)); + if (!bl) + continue; + if (endAddr && bl.targetAddr + 256 > endAddr) + break; + if (curraddr == -1) { + curraddr = bl.targetAddr; + appstartaddr = curraddr; + } + let padding = bl.targetAddr - curraddr; + if (padding < 0 || padding % 4 || padding > 1024 * 1024) + continue; + if (padding > 0) + bufs.push(new Uint8Array(padding)); + bufs.push(blocks.slice(ptr + 32, ptr + 32 + bl.payloadSize)); + curraddr = bl.targetAddr + bl.payloadSize; + } + let len = 0; + for (let b of bufs) + len += b.length; + if (len == 0) + return null; + let r = new Uint8Array(len); + let dst = 0; + for (let b of bufs) { + for (let i = 0; i < b.length; ++i) + r[dst++] = b[i]; + } + return { + buf: r, + start: appstartaddr + }; + } + function hasAddr(b, a) { + if (!b) + return false; + return b.targetAddr <= a && a < b.targetAddr + b.payloadSize; + } + function readBytesFromUF2(blocks, addr, length) { + let res = new Uint8Array(length); + let bl; + for (let i = 0; i < length; ++i, ++addr) { + if (!hasAddr(bl, addr)) + bl = blocks.filter((b) => hasAddr(b, addr))[0]; + if (bl) + res[i] = bl.data[addr - bl.targetAddr]; + } + return res; + } + function setWord(block, ptr, v) { + block[ptr] = v & 255; + block[ptr + 1] = v >> 8 & 255; + block[ptr + 2] = v >> 16 & 255; + block[ptr + 3] = v >> 24 & 255; + } + var UF2File = class { + constructor(familyId) { + this.currBlock = null; + this.currPtr = -1; + this.blocks = []; + this.ptrs = []; + this.filesize = 0; + this.familyId = 0; + this.familyId = typeof familyId == "string" ? parseInt(familyId) : familyId; + } + static concat(fs) { + for (let f of fs) { + f.finalize(); + f.filename = null; + } + let r = new UF2File(); + r.blocks = arrayConcatMany(fs.map((f) => f.blocks)); + for (let f of fs) { + f.blocks = []; + } + return r; + } + static isUF2(uf2) { + return parseUF2Block(uf2.slice(0, 512)) != null; + } + static fromFile(uf2) { + const blocks = parseUF2File(uf2); + const r = new UF2File(blocks[0].familyId); + r.fromBlocks = blocks; + r.blocks = blocks.map((b) => new Uint8Array(b.origData)); + r.ptrs = blocks.map((b) => b.targetAddr >> 8); + r.filename = blocks[0].filename; + return r; + } + finalize() { + for (let i = 0; i < this.blocks.length; ++i) { + setWord(this.blocks[i], 20, i); + setWord(this.blocks[i], 24, this.blocks.length); + if (this.filename) + setWord(this.blocks[i], 28, this.filesize); + } + } + serialize() { + this.finalize(); + return bufferConcatMany(this.blocks); + } + readBytes(addr, length) { + let needAddr = addr >> 8; + let bl; + if (needAddr == this.currPtr) + bl = this.currBlock; + else { + for (let i = 0; i < this.ptrs.length; ++i) { + if (this.ptrs[i] == needAddr) { + bl = this.blocks[i]; + break; + } + } + if (bl) { + this.currPtr = needAddr; + this.currBlock = bl; + } + } + if (!bl) + return null; + let res = new Uint8Array(length); + let toRead = Math.min(length, 256 - (addr & 255)); + memcpy(res, 0, bl, (addr & 255) + 32, toRead); + let leftOver = length - toRead; + if (leftOver > 0) { + let le = this.readBytes(addr + toRead, leftOver); + memcpy(res, toRead, le); + } + return res; + } + writeBytes(addr, bytes2, flags = 0) { + let currBlock = this.currBlock; + let needAddr = addr >> 8; + let thisChunk = 256 - (addr & 255); + if (bytes2.length > thisChunk) { + let b = new Uint8Array(bytes2); + this.writeBytes(addr, b.slice(0, thisChunk)); + while (thisChunk < bytes2.length) { + let nextOff = Math.min(thisChunk + 256, bytes2.length); + this.writeBytes(addr + thisChunk, b.slice(thisChunk, nextOff)); + thisChunk = nextOff; + } + return; + } + if (needAddr != this.currPtr) { + let i = 0; + currBlock = null; + for (let i2 = 0; i2 < this.ptrs.length; ++i2) { + if (this.ptrs[i2] == needAddr) { + currBlock = this.blocks[i2]; + break; + } + } + if (!currBlock) { + currBlock = new Uint8Array(512); + if (this.filename) + flags |= UF2_FLAG_FILE; + else if (this.familyId) + flags |= UF2_FLAG_FAMILY_ID_PRESENT; + setWord(currBlock, 0, UF2_MAGIC_START0); + setWord(currBlock, 4, UF2_MAGIC_START1); + setWord(currBlock, 8, flags); + setWord(currBlock, 12, needAddr << 8); + setWord(currBlock, 16, 256); + setWord(currBlock, 20, this.blocks.length); + setWord(currBlock, 28, this.familyId); + setWord(currBlock, 512 - 4, UF2_MAGIC_END); + for (let i2 = 32; i2 < 32 + 256; ++i2) + currBlock[i2] = 255; + if (this.filename) { + memcpy(currBlock, 32 + 256, stringToBuffer2(this.filename)); + } + this.blocks.push(currBlock); + this.ptrs.push(needAddr); + } + this.currPtr = needAddr; + this.currBlock = currBlock; + } + let p = (addr & 255) + 32; + for (let i = 0; i < bytes2.length; ++i) + currBlock[p + i] = bytes2[i]; + this.filesize = Math.max(this.filesize, bytes2.length + addr); + } + writeHex(hex) { + let upperAddr = "0000"; + for (let i = 0; i < hex.length; ++i) { + let m = /:02000004(....)/.exec(hex[i]); + if (m) { + upperAddr = m[1]; + } + m = /^:..(....)00(.*)[0-9A-F][0-9A-F]$/.exec(hex[i]); + if (m) { + let newAddr = parseInt(upperAddr + m[1], 16); + let hh = m[2]; + let arr = []; + for (let j = 0; j < hh.length; j += 2) { + arr.push(parseInt(hh[j] + hh[j + 1], 16)); + } + this.writeBytes(newAddr, arr); + } + } + } + }; + + // compiler/src/serverinfo.ts + var ts4 = __toESM(require_typescript()); + function serverInfo(host) { + const { program } = buildAST( + "node_modules/@devicescript/drivers/src/index.ts", + host, + preludeFiles(host.getConfig()), + () => true + ); + const checker = program.getTypeChecker(); + const info = { servers: [] }; + for (const file of program.getSourceFiles()) { + for (const stmt of file.statements) { + if (ts4.isModuleDeclaration(stmt) && ts4.isStringLiteral(stmt.name) && stmt.name.text == "@devicescript/servers") { + if (stmt.body && ts4.isModuleBlock(stmt.body)) { + stmt.body.statements.forEach(serverStmt); + } + } else if (ts4.isFunctionDeclaration(stmt) && ts4.isIdentifier(stmt.name) && stmt.name.text.startsWith("start")) { + customServer(stmt); + } else if (ts4.isClassDeclaration(stmt) && ts4.isIdentifier(stmt.name)) { + customDriver(stmt); + } + } + } + return info; + function extractDetails(stmt) { + return stmt.getFullText().replace(/\s*\/\*\*\s+(\*\s*)*/, "").replace(/\n[^]*/, ""); + } + function customDriver(stmt) { + var _a; + const sym = checker.getSymbolAtLocation(stmt.name); + const tags = getSymTags(sym, ""); + if (!tags[TSDOC_PART]) + return; + const snippet = `const shield = new ${sym.name}() +`; + const detail = extractDetails(stmt); + info.servers.push({ + label: (_a = tags[TSDOC_PART]) != null ? _a : sym.name.slice("start".length), + detail, + startName: sym.name, + imports: { + [sym.name]: "@devicescript/drivers" + }, + snippet + }); + } + function customServer(stmt) { + var _a, _b, _c, _d, _e, _f; + const sym = checker.getSymbolAtLocation(stmt.name); + const tags = getSymTags(sym, ""); + if (!tags[TSDOC_PART]) + return; + const serv = ((_a = tags == null ? void 0 : tags[TSDOC_SERVICES]) != null ? _a : "").split(/[,;\s]+/).filter(Boolean).map((servName) => { + const spec = host.getConfig().services.find( + (s) => s.camelName.toLowerCase() == servName.toLowerCase() + ); + if (!spec) + oops2(`no service ${servName}`); + return spec; + }); + const detail = extractDetails(stmt); + let tp = (_c = (_b = checker.getTypeAtLocation(stmt.name).getCallSignatures()) == null ? void 0 : _b[0]) == null ? void 0 : _c.getReturnType(); + if (!tp) + oops2(`unknown return type for ${sym.name}`); + let isAwait = ""; + if (((_d = tp.getSymbol()) == null ? void 0 : _d.name) === "Promise") { + isAwait = "await "; + tp = (_e = tp.typeArguments) == null ? void 0 : _e[0]; + } + let varName = sym.name.slice("start".length).toLowerCase(); + if (!tp.isClass()) { + varName = "{ " + tp.getProperties().map((p) => p.name).join(", ") + " }"; + } + const snippet = `const ${varName} = ${isAwait}${sym.name}() +`; + info.servers.push({ + label: (_f = tags[TSDOC_PART]) != null ? _f : sym.name.slice("start".length), + detail, + startName: sym.name, + classIdentifiers: serv.length ? serv.map((s) => s.classIdentifier) : void 0, + imports: { + [sym.name]: "@devicescript/drivers" + }, + snippet + }); + } + function serverStmt(stmt) { + var _a, _b; + if (!ts4.isFunctionDeclaration(stmt)) + return; + const n = (_a = stmt.name) == null ? void 0 : _a.text; + if (!n || !n.startsWith("start")) + return; + const servName = n.slice(5); + if (servName == "Power") + return; + const spec = host.getConfig().services.find((s) => upperCamel(s.camelName) == servName); + if (!spec) + oops2(`no service ${servName}`); + let snippet = `const ${camelize(servName)} = ${n}({ +`; + const argTp = checker.getTypeAtLocation(stmt.parameters[0]); + let idx = 1; + for (const prop of argTp.getProperties()) { + if (prop.flags & ts4.SymbolFlags.Optional) + continue; + const init = prop.name.startsWith("pin") ? `pins.\${${idx++}}` : `\${${idx++}}`; + snippet += ` ${prop.name}: ${init}, +`; + } + snippet += "})\n"; + info.servers.push({ + label: spec.name, + detail: ((_b = spec.notes["short"]) != null ? _b : "").replace(/\n[^]*/, ""), + startName: n, + classIdentifiers: [spec.classIdentifier], + imports: { + [n]: "@devicescript/servers" + }, + snippet + }); + } + function oops2(msg) { + throw new Error("server-info.json generation problem: " + msg); + } + } + + // compiler/src/devicescript.ts + if (typeof globalThis !== "undefined") + globalThis.deviceScript = { compile }; +})(); +/*! Bundled license information: + +typescript/lib/typescript.js: + (*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + 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 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** *) +*/ +//# sourceMappingURL=devicescript-compiler.js.map diff --git a/dist/devicescript-vm.js b/dist/devicescript-vm.js new file mode 100644 index 00000000000..fafedc10cf1 --- /dev/null +++ b/dist/devicescript-vm.js @@ -0,0 +1,2234 @@ + +var Module = (() => { + var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; + if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; + return ( +function(moduleArg = {}) { + +// include: shell.js +// The Module object: Our interface to the outside world. We import +// and export values on it. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(Module) { ..generated code.. } +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to check if Module already exists (e.g. case 3 above). +// Substitution will be replaced with actual code on later stage of the build, +// this way Closure Compiler will not mangle it (e.g. case 4. above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module = moduleArg; + +// Set up the promise that indicates the Module is initialized +var readyPromiseResolve, readyPromiseReject; +Module['ready'] = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; +}); +["_malloc","_free","_memory","_em_flash_size","_em_flash_save","_em_flash_load","___indirect_function_table","_jd_em_set_device_id_2x_i32","_jd_em_set_device_id_string","_jd_em_init","_jd_em_process","_jd_em_frame_received","_jd_em_devs_deploy","_jd_em_devs_verify","_jd_em_devs_client_deploy","_jd_em_devs_enable_gc_stress","_em_send_frame","__devs_panic_handler","_em_send_large_frame","_em_deploy_handler","_em_time_now","_em_jd_crypto_get_random","_em_print_dmesg","_jd_em_tcpsock_on_event","__jd_tcpsock_new","__jd_tcpsock_write","__jd_tcpsock_close","__jd_tcpsock_is_available","_fflush","___start_em_js","___stop_em_js","onRuntimeInitialized"].forEach((prop) => { + if (!Object.getOwnPropertyDescriptor(Module['ready'], prop)) { + Object.defineProperty(Module['ready'], prop, { + get: () => abort('You are getting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'), + set: () => abort('You are setting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'), + }); + } +}); + +// --pre-jses are emitted after the Module integration code, so that they can +// refer to Module (if they choose; they can also define Module) +// devs_timeout === undefined - program is not running +// devs_timeout === null - the C code is executing, program running +// devs_timeout is number - we're waiting for timeout, program running +var devs_timeout = undefined; +function copyToHeap(buf, fn) { + const ptr = Module._malloc(buf.length); + Module.HEAPU8.set(buf, ptr); + const r = fn(ptr); + Module._free(ptr); + return r; +} +function bufferConcat(a, b) { + const r = new Uint8Array(a.length + b.length); + r.set(a, 0); + r.set(b, a.length); + return r; +} +var Exts; +(function (Exts) { + /** + * Debug output and stack traces are sent here. + */ + Exts.dmesg = (s) => console.debug(" " + s); + /** + * Logging function + */ + Exts.log = console.log; + /** + * Error logging function + */ + Exts.error = console.error; + /** + * Callback to invoke when a packet needs to be handled by the virtual machine + * TODO: frame or packet? + * @param pkt a Jacdac frame + */ + function handlePacket(pkt) { + if (devs_timeout) { + try { + copyToHeap(pkt, Module._jd_em_frame_received); + } + catch (_a) { } + clearDevsTimeout(); + process(); + } + } + Exts.handlePacket = handlePacket; + /** + * Starts a packet transport over a TCP socket in a node.js application + * @param require module resolution function, requires "net" package + * @param host socket url host + * @param port socket port + */ + function setupNodeTcpSocketTransport(require, host, port) { + return new Promise((resolve, reject) => { + const net = require("net"); + let sock = null; + const send = (data) => { + let buf; + if (data.length >= 0xff) { + buf = new Uint8Array(3 + data.length); + buf[0] = 0xff; + buf[1] = data.length & 0xff; + buf[2] = data.length >> 8; + buf.set(data, 3); + } + else { + buf = new Uint8Array(1 + data.length); + buf[0] = data.length; + buf.set(data, 1); + } + if (sock) + sock.write(buf); + }; + const disconnect = (err) => { + Module.log("disconnect", err === null || err === void 0 ? void 0 : err.message); + if (sock) + try { + sock.end(); + } + catch (_a) { + } + finally { + sock = undefined; + } + if (resolve) { + resolve = null; + reject(new Error(`can't connect to ${host}:${port}`)); + } + }; + const close = () => disconnect(undefined); + Module["sendPacket"] = send; + sock = net.createConnection(port, host, () => { + Module.log(`connected to ${host}:${port}`); + const f = resolve; + if (f) { + resolve = null; + reject = null; + f({ close }); + } + }); + sock.on("error", disconnect); + sock.on("end", disconnect); + sock.setNoDelay(); + let acc = null; + sock.on("data", (buf) => { + if (acc) { + buf = bufferConcat(acc, buf); + acc = null; + } + else { + buf = new Uint8Array(buf); + } + while (buf) { + const endp = buf[0] + 1; + if (buf.length >= endp) { + const pkt = buf.slice(1, endp); + if (buf.length > endp) + buf = buf.slice(endp); + else + buf = null; + Module.handlePacket(pkt); + } + else { + acc = buf; + buf = null; + } + } + }); + }); + } + Exts.setupNodeTcpSocketTransport = setupNodeTcpSocketTransport; + /** + * Starts a packet transport over a WebSocket using arraybuffer binary type. + * @param url socket url + * @param port socket port + */ + function setupWebsocketTransport(url, protocols) { + return new Promise((resolve, reject) => { + let sock = new WebSocket(url, protocols); + if (sock.binaryType != "arraybuffer") + sock.binaryType = "arraybuffer"; + const send = (data) => { + if (sock && sock.readyState == WebSocket.OPEN) { + sock.send(data); + return 0; + } + else { + return -1; + } + }; + const disconnect = (err) => { + Module.log("disconnect", err === null || err === void 0 ? void 0 : err.message); + if (sock) + try { + sock.close(); + } + catch (_a) { + } + finally { + sock = undefined; + } + if (resolve) { + resolve = null; + reject(new Error(`can't connect to ${url}; ${err === null || err === void 0 ? void 0 : err.message}`)); + } + }; + const close = () => disconnect(undefined); + Module["sendPacket"] = send; + sock.onopen = () => { + Module.log(`connected to ${url}`); + const f = resolve; + if (f) { + resolve = null; + reject = null; + f({ close }); + } + }; + sock.onerror = disconnect; + sock.onclose = disconnect; + sock.onmessage = ev => { + const data = ev.data; + if (typeof data == "string") { + Module.error("got string msg"); + return; + } + else { + const pkt = new Uint8Array(ev.data); + Module.handlePacket(pkt); + } + }; + }); + } + Exts.setupWebsocketTransport = setupWebsocketTransport; + /** + * Utility that converts a base64-encoded buffer into a Uint8Array + * TODO: nobody is using this? + * @param s + * @returns + */ + function b64ToBin(s) { + s = atob(s); + const r = new Uint8Array(s.length); + for (let i = 0; i < s.length; ++i) + r[i] = s.charCodeAt(i); + return r; + } + Exts.b64ToBin = b64ToBin; + /** + * Deploys a DeviceScript bytecode to the virtual machine + * @param binary + * @returns error code, 0 if deployment is successful + */ + function devsDeploy(binary) { + return copyToHeap(binary, ptr => Module._jd_em_devs_deploy(ptr, binary.length)); + } + Exts.devsDeploy = devsDeploy; + /** + * Verifies the format and version of the bytecode + * @param binary DeviceScript bytecode + * @returns error code, 0 if verification is successful + */ + function devsVerify(binary) { + return copyToHeap(binary, ptr => Module._jd_em_devs_verify(ptr, binary.length)); + } + Exts.devsVerify = devsVerify; + /** + * Deploys to the first virtual machine on Jacdac stack (experimental) + * @internal + * @alpha + * @param binary + * @returns error code, 0 if deployment is successful + */ + function devsClientDeploy(binary) { + // this will call exit(0) when done + const ptr = Module._malloc(binary.length); + Module.HEAPU8.set(binary, ptr); + return Module._jd_em_devs_client_deploy(ptr, binary.length); + } + Exts.devsClientDeploy = devsClientDeploy; + /** + * Initalises the virtual machine data structure. + */ + function devsInit() { + Module._jd_em_init(); + } + Exts.devsInit = devsInit; + /** + * Enables/disables GC stress testing. + */ + function devsGcStress(en) { + Module._jd_em_devs_enable_gc_stress(en ? 1 : 0); + } + Exts.devsGcStress = devsGcStress; + /** + * Clear settings. + */ + function devsClearFlash() { + if (Module.flashSave) + Module.flashSave(new Uint8Array([0, 0, 0, 0])); + } + Exts.devsClearFlash = devsClearFlash; + function process() { + devs_timeout = null; + try { + const us = Module._jd_em_process(); + devs_timeout = setTimeout(process, us / 1000); + } + catch (e) { + Module.error(e); + devsStop(); + } + } + function clearDevsTimeout() { + if (devs_timeout) + clearInterval(devs_timeout); + devs_timeout = undefined; + } + /** + * Initializes and start the virtual machine (calls init). + */ + function devsStart() { + if (devs_timeout) + return; + Module.devsInit(); + devs_timeout = setTimeout(process, 10); + } + Exts.devsStart = devsStart; + /** + * Stops the virtual machine + */ + function devsStop() { + clearDevsTimeout(); + } + Exts.devsStop = devsStop; + /** + * Indicates if the virtual machine is running + * @returns true if the virtual machine is started. + */ + function devsIsRunning() { + return devs_timeout !== undefined; + } + Exts.devsIsRunning = devsIsRunning; + /** + * Specifices the virtual macine device id. + * @remarks + * + * Must be called before `devsStart`. + * + * @param id0 a hex-encoded device id string or the first 32bit of the device id + * @param id1 the second 32 bits of the device id, undefined if id0 is a string + */ + function devsSetDeviceId(id0, id1) { + if (devsIsRunning()) + throw new Error("cannot change deviceid while running"); + Module.devsInit(); + if (typeof id0 == "string") { + if (id1 !== undefined) + throw new Error("invalid arguments"); + const s = allocateUTF8(id0); + Module._jd_em_set_device_id_string(s); + Module._free(s); + } + else if (typeof id0 == "number" && typeof id1 == "number") { + Module._jd_em_set_device_id_2x_i32(id0, id1); + } + else { + throw new Error("invalid arguments"); + } + } + Exts.devsSetDeviceId = devsSetDeviceId; + let currSock; + function sockClose() { + if (!currSock) + return -10; + currSock.end(); + currSock = null; + return 0; + } + Exts.sockClose = sockClose; + function sockWrite(data, len) { + if (!currSock) + return -10; + const buf = Module.HEAPU8.slice(data, data + len); + currSock.write(buf); + return 0; + } + Exts.sockWrite = sockWrite; + function sockIsAvailable() { + try { + require("node:tls"); + return true; + } + catch (_a) { + return false; + } + } + Exts.sockIsAvailable = sockIsAvailable; + function sockOpen(hostptr, port) { + const host = UTF8ToString(hostptr, 256); + const JD_CONN_EV_OPEN = 0x01; + const JD_CONN_EV_CLOSE = 0x02; + const JD_CONN_EV_ERROR = 0x03; + const JD_CONN_EV_MESSAGE = 0x04; + const isTLS = port < 0; + if (isTLS) + port = -port; + const name = `${isTLS ? "tls" : "tcp"}://${host}:${port}`; + currSock === null || currSock === void 0 ? void 0 : currSock.end(); + currSock = null; + const sock = isTLS + ? require("tls").connect({ + host, + port, + }) + : require("net").createConnection({ host, port }); + currSock = sock; + currSock.once("connect", () => { + if (sock === currSock) + cb(JD_CONN_EV_OPEN); + }); + currSock.on("data", (buf) => { + if (sock === currSock) + cb(JD_CONN_EV_MESSAGE, buf); + }); + currSock.on("error", (err) => { + if (sock === currSock) { + cb(JD_CONN_EV_ERROR, `${name}: ${err.message}`); + currSock = null; + } + }); + currSock.on("close", (hadError) => { + if (sock === currSock) { + cb(JD_CONN_EV_CLOSE); + currSock = null; + } + }); + function cb(tp, arg) { + let len = arg ? arg.length : 0; + let ptr = 0; + if (typeof arg === "string") { + len = lengthBytesUTF8(arg); + ptr = allocateUTF8(arg); + } + else if (arg) { + ptr = Module._malloc(len); + Module.HEAPU8.set(arg, ptr); + } + Module._jd_em_tcpsock_on_event(tp, ptr, len); + if (ptr) + Module._free(ptr); + } + } + Exts.sockOpen = sockOpen; +})(Exts || (Exts = {})); +for (const kn of Object.keys(Exts)) { + ; + Module[kn] = Exts[kn]; +} +function factory() { + return null; +} +//# sourceMappingURL=wasmpre.js.map + + +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = Object.assign({}, Module); + +var arguments_ = []; +var thisProgram = './this.program'; +var quit_ = (status, toThrow) => { + throw toThrow; +}; + +// Determine the runtime environment we are in. You can customize this by +// setting the ENVIRONMENT setting at compile time (see settings.js). + +// Attempt to auto-detect the environment +var ENVIRONMENT_IS_WEB = typeof window == 'object'; +var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; +// N.b. Electron.js environment is simultaneously a NODE-environment, but +// also a web environment. +var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string'; +var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + +if (Module['ENVIRONMENT']) { + throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)'); +} + +// `/` should be present at the end if `scriptDirectory` is not empty +var scriptDirectory = ''; +function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; +} + +// Hooks that are implemented differently in different runtime environments. +var read_, + readAsync, + readBinary, + setWindowTitle; + +if (ENVIRONMENT_IS_NODE) { + if (typeof process == 'undefined' || !process.release || process.release.name !== 'node') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)'); + + var nodeVersion = process.versions.node; + var numericVersion = nodeVersion.split('.').slice(0, 3); + numericVersion = (numericVersion[0] * 10000) + (numericVersion[1] * 100) + (numericVersion[2].split('-')[0] * 1); + var minVersion = 160000; + if (numericVersion < 160000) { + throw new Error('This emscripten-generated code requires node v16.0.0 (detected v' + nodeVersion + ')'); + } + + // `require()` is no-op in an ESM module, use `createRequire()` to construct + // the require()` function. This is only necessary for multi-environment + // builds, `-sENVIRONMENT=node` emits a static import declaration instead. + // TODO: Swap all `require()`'s with `import()`'s? + // These modules will usually be used on Node.js. Load them eagerly to avoid + // the complexity of lazy-loading. + var fs = require('fs'); + var nodePath = require('path'); + + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = nodePath.dirname(scriptDirectory) + '/'; + } else { + scriptDirectory = __dirname + '/'; + } + +// include: node_shell_read.js +read_ = (filename, binary) => { + // We need to re-wrap `file://` strings to URLs. Normalizing isn't + // necessary in that case, the path should already be absolute. + filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename); + return fs.readFileSync(filename, binary ? undefined : 'utf8'); +}; + +readBinary = (filename) => { + var ret = read_(filename, true); + if (!ret.buffer) { + ret = new Uint8Array(ret); + } + assert(ret.buffer); + return ret; +}; + +readAsync = (filename, onload, onerror, binary = true) => { + // See the comment in the `read_` function. + filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename); + fs.readFile(filename, binary ? undefined : 'utf8', (err, data) => { + if (err) onerror(err); + else onload(binary ? data.buffer : data); + }); +}; +// end include: node_shell_read.js + if (!Module['thisProgram'] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, '/'); + } + + arguments_ = process.argv.slice(2); + + // MODULARIZE will export the module in the proper place outside, we don't need to export here + + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; + + Module['inspect'] = () => '[Emscripten Module object]'; + +} else +if (ENVIRONMENT_IS_SHELL) { + + if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof importScripts == 'function') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)'); + + if (typeof read != 'undefined') { + read_ = read; + } + + readBinary = (f) => { + if (typeof readbuffer == 'function') { + return new Uint8Array(readbuffer(f)); + } + let data = read(f, 'binary'); + assert(typeof data == 'object'); + return data; + }; + + readAsync = (f, onload, onerror) => { + setTimeout(() => onload(readBinary(f))); + }; + + if (typeof clearTimeout == 'undefined') { + globalThis.clearTimeout = (id) => {}; + } + + if (typeof setTimeout == 'undefined') { + // spidermonkey lacks setTimeout but we use it above in readAsync. + globalThis.setTimeout = (f) => (typeof f == 'function') ? f() : abort(); + } + + if (typeof scriptArgs != 'undefined') { + arguments_ = scriptArgs; + } else if (typeof arguments != 'undefined') { + arguments_ = arguments; + } + + if (typeof quit == 'function') { + quit_ = (status, toThrow) => { + // Unlike node which has process.exitCode, d8 has no such mechanism. So we + // have no way to set the exit code and then let the program exit with + // that code when it naturally stops running (say, when all setTimeouts + // have completed). For that reason, we must call `quit` - the only way to + // set the exit code - but quit also halts immediately. To increase + // consistency with node (and the web) we schedule the actual quit call + // using a setTimeout to give the current stack and any exception handlers + // a chance to run. This enables features such as addOnPostRun (which + // expected to be able to run code after main returns). + setTimeout(() => { + if (!(toThrow instanceof ExitStatus)) { + let toLog = toThrow; + if (toThrow && typeof toThrow == 'object' && toThrow.stack) { + toLog = [toThrow, toThrow.stack]; + } + err(`exiting due to exception: ${toLog}`); + } + quit(status); + }); + throw toThrow; + }; + } + + if (typeof print != 'undefined') { + // Prefer to use print/printErr where they exist, as they usually work better. + if (typeof console == 'undefined') console = /** @type{!Console} */({}); + console.log = /** @type{!function(this:Console, ...*): undefined} */ (print); + console.warn = console.error = /** @type{!function(this:Console, ...*): undefined} */ (typeof printErr != 'undefined' ? printErr : print); + } + +} else + +// Note that this includes Node.js workers when relevant (pthreads is enabled). +// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and +// ENVIRONMENT_IS_NODE. +if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { // web + scriptDirectory = document.currentScript.src; + } + // When MODULARIZE, this JS may be executed later, after document.currentScript + // is gone, so we saved it, and we use it here instead of any other info. + if (_scriptDir) { + scriptDirectory = _scriptDir; + } + // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them. + // otherwise, slice off the final part of the url to find the script directory. + // if scriptDirectory does not contain a slash, lastIndexOf will return -1, + // and scriptDirectory will correctly be replaced with an empty string. + // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #), + // they are removed because they could contain a slash. + if (scriptDirectory.indexOf('blob:') !== 0) { + scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf('/')+1); + } else { + scriptDirectory = ''; + } + + if (!(typeof window == 'object' || typeof importScripts == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)'); + + // Differentiate the Web Worker from the Node Worker case, as reading must + // be done differently. + { +// include: web_or_worker_shell_read.js +read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(null); + return xhr.responseText; + } + + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response)); + }; + } + + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'arraybuffer'; + xhr.onload = () => { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0 + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + } + +// end include: web_or_worker_shell_read.js + } + + setWindowTitle = (title) => document.title = title; +} else +{ + throw new Error('environment detection error'); +} + +var out = Module['print'] || console.log.bind(console); +var err = Module['printErr'] || console.error.bind(console); + +// Merge back in the overrides +Object.assign(Module, moduleOverrides); +// Free the object hierarchy contained in the overrides, this lets the GC +// reclaim data used e.g. in memoryInitializerRequest, which is a large typed array. +moduleOverrides = null; +checkIncomingModuleAPI(); + +// Emit code to handle expected values on the Module object. This applies Module.x +// to the proper local x. This has two benefits: first, we only emit it if it is +// expected to arrive, and second, by using a local everywhere else that can be +// minified. + +if (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_'); + +if (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram'); + +if (Module['quit']) quit_ = Module['quit'];legacyModuleProp('quit', 'quit_'); + +// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message +// Assertions on removed incoming Module JS APIs. +assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['read'] == 'undefined', 'Module.read option was removed (modify read_ in JS)'); +assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)'); +assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)'); +assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify setWindowTitle in JS)'); +assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY'); +legacyModuleProp('asm', 'wasmExports'); +legacyModuleProp('read', 'read_'); +legacyModuleProp('readAsync', 'readAsync'); +legacyModuleProp('readBinary', 'readBinary'); +legacyModuleProp('setWindowTitle', 'setWindowTitle'); +var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js'; +var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js'; +var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js'; +var FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js'; +var ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js'; +var JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js'; +var OPFS = 'OPFS is no longer included by default; build with -lopfs.js'; + +var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js'; + +assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable."); + + +// end include: shell.js +// include: preamble.js +// === Preamble library stuff === + +// Documentation for the public APIs defined in this file must be updated in: +// site/source/docs/api_reference/preamble.js.rst +// A prebuilt local version of the documentation is available at: +// site/build/text/docs/api_reference/preamble.js.txt +// You can also build docs locally as HTML or other formats in site/ +// An online HTML version (which may be of a different version of Emscripten) +// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html + +var wasmBinary; +if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary'); +var noExitRuntime = Module['noExitRuntime'] || true;legacyModuleProp('noExitRuntime', 'noExitRuntime'); + +if (typeof WebAssembly != 'object') { + abort('no native wasm support detected'); +} + +// Wasm globals + +var wasmMemory; + +//======================================== +// Runtime essentials +//======================================== + +// whether we are quitting the application. no code should run after this. +// set in exit() and abort() +var ABORT = false; + +// set by exit() and abort(). Passed to 'onExit' handler. +// NOTE: This is also used as the process return code code in shell environments +// but only when noExitRuntime is false. +var EXITSTATUS; + +/** @type {function(*, string=)} */ +function assert(condition, text) { + if (!condition) { + abort('Assertion failed' + (text ? ': ' + text : '')); + } +} + +// We used to include malloc/free by default in the past. Show a helpful error in +// builds with assertions. + +// Memory management + +var HEAP, +/** @type {!Int8Array} */ + HEAP8, +/** @type {!Uint8Array} */ + HEAPU8, +/** @type {!Int16Array} */ + HEAP16, +/** @type {!Uint16Array} */ + HEAPU16, +/** @type {!Int32Array} */ + HEAP32, +/** @type {!Uint32Array} */ + HEAPU32, +/** @type {!Float32Array} */ + HEAPF32, +/** @type {!Float64Array} */ + HEAPF64; + +function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); +} + +assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time') + +assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, + 'JS engine does not provide full typed array support'); + +// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY +assert(!Module['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally'); +assert(!Module['INITIAL_MEMORY'], 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically'); + +// include: runtime_init_table.js +// In regular non-RELOCATABLE mode the table is exported +// from the wasm module and this will be assigned once +// the exports are available. +var wasmTable; +// end include: runtime_init_table.js +// include: runtime_stack_check.js +// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. +function writeStackCookie() { + var max = _emscripten_stack_get_end(); + assert((max & 3) == 0); + // If the stack ends at address zero we write our cookies 4 bytes into the + // stack. This prevents interference with SAFE_HEAP and ASAN which also + // monitor writes to address zero. + if (max == 0) { + max += 4; + } + // The stack grow downwards towards _emscripten_stack_get_end. + // We write cookies to the final two words in the stack and detect if they are + // ever overwritten. + HEAPU32[((max)>>2)] = 0x02135467; + HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE; + // Also test the global address 0 for integrity. + HEAPU32[((0)>>2)] = 1668509029; +} + +function checkStackCookie() { + if (ABORT) return; + var max = _emscripten_stack_get_end(); + // See writeStackCookie(). + if (max == 0) { + max += 4; + } + var cookie1 = HEAPU32[((max)>>2)]; + var cookie2 = HEAPU32[(((max)+(4))>>2)]; + if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) { + abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`); + } + // Also test the global address 0 for integrity. + if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) { + abort('Runtime error: The application has corrupted its heap memory area (address zero)!'); + } +} +// end include: runtime_stack_check.js +// include: runtime_assertions.js +// Endianness check +(function() { + var h16 = new Int16Array(1); + var h8 = new Int8Array(h16.buffer); + h16[0] = 0x6373; + if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)'; +})(); + +// end include: runtime_assertions.js +var __ATPRERUN__ = []; // functions called before the runtime is initialized +var __ATINIT__ = []; // functions called during startup +var __ATEXIT__ = []; // functions called during shutdown +var __ATPOSTRUN__ = []; // functions called after the main() is called + +var runtimeInitialized = false; + +var runtimeKeepaliveCounter = 0; + +function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; +} + +function preRun() { + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} + +function initRuntime() { + assert(!runtimeInitialized); + runtimeInitialized = true; + + checkStackCookie(); + + + callRuntimeCallbacks(__ATINIT__); +} + +function postRun() { + checkStackCookie(); + + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } + } + + callRuntimeCallbacks(__ATPOSTRUN__); +} + +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} + +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} + +function addOnExit(cb) { +} + +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} + +// include: runtime_math.js +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc + +assert(Math.imul, 'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); +assert(Math.fround, 'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); +assert(Math.clz32, 'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); +assert(Math.trunc, 'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill'); +// end include: runtime_math.js +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// Module.preRun (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; +var runDependencyWatcher = null; +var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled +var runDependencyTracking = {}; + +function getUniqueRunDependency(id) { + var orig = id; + while (1) { + if (!runDependencyTracking[id]) return id; + id = orig + Math.random(); + } +} + +function addRunDependency(id) { + runDependencies++; + + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + if (runDependencyWatcher === null && typeof setInterval != 'undefined') { + // Check for missing dependencies every few seconds + runDependencyWatcher = setInterval(() => { + if (ABORT) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + return; + } + var shown = false; + for (var dep in runDependencyTracking) { + if (!shown) { + shown = true; + err('still waiting on run dependencies:'); + } + err(`dependency: ${dep}`); + } + if (shown) { + err('(end of list)'); + } + }, 10000); + } + } else { + err('warning: run dependency added without ID'); + } +} + +function removeRunDependency(id) { + runDependencies--; + + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + err('warning: run dependency removed without ID'); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); // can add another dependenciesFulfilled + } + } +} + +/** @param {string|number=} what */ +function abort(what) { + if (Module['onAbort']) { + Module['onAbort'](what); + } + + what = 'Aborted(' + what + ')'; + // TODO(sbc): Should we remove printing and leave it up to whoever + // catches the exception? + err(what); + + ABORT = true; + EXITSTATUS = 1; + + // Use a wasm runtime error, because a JS error might be seen as a foreign + // exception, which means we'd run destructors on it. We need the error to + // simply make the program stop. + // FIXME This approach does not work in Wasm EH because it currently does not assume + // all RuntimeErrors are from traps; it decides whether a RuntimeError is from + // a trap or not based on a hidden field within the object. So at the moment + // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that + // allows this in the wasm spec. + + // Suppress closure compiler warning here. Closure compiler's builtin extern + // defintion for WebAssembly.RuntimeError claims it takes no arguments even + // though it can. + // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed. + /** @suppress {checkTypes} */ + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + // Throw the error whether or not MODULARIZE is set because abort is used + // in code paths apart from instantiation where an exception is expected + // to be thrown when abort is called. + throw e; +} + +// include: memoryprofiler.js +// end include: memoryprofiler.js +// show errors on likely calls to FS when it was not included +var FS = { + error() { + abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM'); + }, + init() { FS.error() }, + createDataFile() { FS.error() }, + createPreloadedFile() { FS.error() }, + createLazyFile() { FS.error() }, + open() { FS.error() }, + mkdev() { FS.error() }, + registerDevice() { FS.error() }, + analyzePath() { FS.error() }, + + ErrnoError() { FS.error() }, +}; +Module['FS_createDataFile'] = FS.createDataFile; +Module['FS_createPreloadedFile'] = FS.createPreloadedFile; + +// include: URIUtils.js +// Prefix of data URIs emitted by SINGLE_FILE and related options. +var dataURIPrefix = 'data:application/octet-stream;base64,'; + +// Indicates whether filename is a base64 data URI. +function isDataURI(filename) { + // Prefix of data URIs emitted by SINGLE_FILE and related options. + return filename.startsWith(dataURIPrefix); +} + +// Indicates whether filename is delivered via file protocol (as opposed to http/https) +function isFileURI(filename) { + return filename.startsWith('file://'); +} +// end include: URIUtils.js +function createExportWrapper(name) { + return function() { + assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`); + var f = wasmExports[name]; + assert(f, `exported native function \`${name}\` not found`); + return f.apply(null, arguments); + }; +} + +// include: runtime_exceptions.js +// end include: runtime_exceptions.js +var wasmBinaryFile; + wasmBinaryFile = 'data:application/octet-stream;base64,AGFzbQEAAAABtQIwYAF/AGADf39/AGACf38AYAJ/fwF/YAF/AX9gBH9/f38AYAN/f38Bf2AAAGAAAX9gBH9/f38Bf2ABfAF8YAV/f39/fwBgBX9/f39/AX9gBX9+fn5+AGAGf39/f39/AGAAAX5gAn9/AXxgA39+fwF+YAd/f39/f39/AGACf3wAYAJ/fgBgAX4Bf2ABfAF/YAF/AXxgBH9+fn8AYAJ8fAF8YAJ8fwF8YAR+fn5+AX9gAAF8YAF/AX5gCX9/f39/f39/fwBgCH9/f39/f39/AX9gBn9/f39/fwF/YAN/f3wAYAN/fH8AYAF8AX5gAn98AXxgAn5/AXxgA3x8fwF8YAN8fn4BfGABfABgAn5+AX9gA39+fgBgAn9/AX5gAn99AGACfn4BfGAEf39+fwF+YAR/fn9/AX8C/AMVA2Vudg1lbV9mbGFzaF9zYXZlAAIDZW52DWVtX2ZsYXNoX3NpemUACANlbnYNZW1fZmxhc2hfbG9hZAACA2VudgVhYm9ydAAHA2VudhNlbV9zZW5kX2xhcmdlX2ZyYW1lAAIDZW52E19kZXZzX3BhbmljX2hhbmRsZXIAAANlbnYRZW1fZGVwbG95X2hhbmRsZXIAAANlbnYXZW1famRfY3J5cHRvX2dldF9yYW5kb20AAgNlbnYNZW1fc2VuZF9mcmFtZQAAA2VudgRleGl0AAADZW52C2VtX3RpbWVfbm93ABwDZW52DmVtX3ByaW50X2RtZXNnAAADZW52D19qZF90Y3Bzb2NrX25ldwADA2VudhFfamRfdGNwc29ja193cml0ZQADA2VudhFfamRfdGNwc29ja19jbG9zZQAIA2VudhhfamRfdGNwc29ja19pc19hdmFpbGFibGUACBZ3YXNpX3NuYXBzaG90X3ByZXZpZXcxCGZkX2Nsb3NlAAQDZW52FWVtc2NyaXB0ZW5fbWVtY3B5X2JpZwABFndhc2lfc25hcHNob3RfcHJldmlldzEIZmRfd3JpdGUACQNlbnYWZW1zY3JpcHRlbl9yZXNpemVfaGVhcAAEFndhc2lfc25hcHNob3RfcHJldmlldzEHZmRfc2VlawAMA/cG9QYHCAEABwcHAAAHBAAIBwcdAgAAAgMCAAcIBAMDAwAPBw8ABwcDBQIHBwMDBwgBAgcHBA4LDAYCBQMFAAACAgACAQEAAAAAAgEFBgYBAAcFBQAAAQAHBAMEAgICCAMHBQcGAgICAgADAwYAAAABBAABAgYABgYDAgIDAgIDBAMGAwMJBQYCCAACBgEBAAAAAAAAAAAAAQAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAQAAAAAAAQEABwEBAQABAQEBAAABBQAAEgAAAAkABgAAAAEMAAAAEgMODgAAAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAADAQEBAQEBAQEBAQEBAQEBBgEDAAABAQEBAQALAAICAAEBAQABAQABAQAAAAABAAABAQAAAAAAAAIABQICBQsAAQABAQEEAQ8GAAIAAAAGAAAIBAMJCwICCwIDAAUJAwEFBgMFCQUFBgUBAQEDAwYDAwMDAwMFBQUJDAYFAwMDBgMDAwMFBgUFBQUFBQEGAwMQEwICAgQBAwEBAgADCQkBAgkEAwEDAwIEBwIAAgIAHh8DBAMGAgUFBQEBBQULAQMCAgEACwUFBQEFBQEFBgMDBAQDDBMCAgUQAwMDAwYGAwMDBAQGBgYGAQMAAwMEAgADAAIGAAQEAwYGBQEBAgICAgICAgICAgICAgEBAgICAQEBAQECAQEBAQECAgIBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQIBAQECAgICAgICAgICAQEBAQECAQIEBAEOIAICAAAHCQMGAQIAAAcJCQEDBwECAAACBQAHCQgABAQEAAACBwAUAwcHAQIBABUDCQcAAAQAAgcAAAIHBAcEBAMDBAMGAwIIBgYGBAcGBwMDAgYIAAYAAAQhAQMQAwMACQcDBgQDBAAEAwMDAwQEBgYAAAAEBAcHBwcEBwcHCAgIBwQEAw8IAwAEAQAJAQMDAQMFBAwiCQkUAwMEAwMDBwcFBwQIAAQEBwkIAAcIFgQGBgYEAAQZIxEGBAQEBgkEBAAAFwoKChYKEQYIByQKFxcKGRYVFQolJicoCgMDAwQGAwMDAwMEFAQEGg0YKQ0qBQ4SKwUQBAgEBAANGBsbDRMsAgIICBgNDRoNLQAIBwgICAgABAguDC8EBwFwAZcClwIFBgEBgAKAAgaHARR/AUHglwYLfwFBAAt/AUEAC38BQQALfwBB6O8BC38AQbjwAQt/AEGn8QELfwBB8fIBC38AQe3zAQt/AEHp9AELfwBB1fUBC38AQaX2AQt/AEHG9gELfwBBy/gBC38AQcH5AQt/AEGR+gELfwBB3foBC38AQYb7AQt/AEHo7wELfwBBtfsBCwfHByoGbWVtb3J5AgARX193YXNtX2NhbGxfY3RvcnMAFQZtYWxsb2MA6gYWX19lbV9qc19fZW1fZmxhc2hfc2l6ZQMEFl9fZW1fanNfX2VtX2ZsYXNoX3NhdmUDBRZfX2VtX2pzX19lbV9mbGFzaF9sb2FkAwYZX19pbmRpcmVjdF9mdW5jdGlvbl90YWJsZQEAEF9fZXJybm9fbG9jYXRpb24AngYEZnJlZQDrBhpqZF9lbV9zZXRfZGV2aWNlX2lkXzJ4X2kzMgAqGmpkX2VtX3NldF9kZXZpY2VfaWRfc3RyaW5nACsKamRfZW1faW5pdAAsDWpkX2VtX3Byb2Nlc3MALRRqZF9lbV9mcmFtZV9yZWNlaXZlZAAuEWpkX2VtX2RldnNfZGVwbG95AC8RamRfZW1fZGV2c192ZXJpZnkAMBhqZF9lbV9kZXZzX2NsaWVudF9kZXBsb3kAMRtqZF9lbV9kZXZzX2VuYWJsZV9nY19zdHJlc3MAMhZfX2VtX2pzX19lbV9zZW5kX2ZyYW1lAwccX19lbV9qc19fX2RldnNfcGFuaWNfaGFuZGxlcgMIHF9fZW1fanNfX2VtX3NlbmRfbGFyZ2VfZnJhbWUDCRpfX2VtX2pzX19lbV9kZXBsb3lfaGFuZGxlcgMKFF9fZW1fanNfX2VtX3RpbWVfbm93AwsgX19lbV9qc19fZW1famRfY3J5cHRvX2dldF9yYW5kb20DDBdfX2VtX2pzX19lbV9wcmludF9kbWVzZwMNFmpkX2VtX3RjcHNvY2tfb25fZXZlbnQAQhhfX2VtX2pzX19famRfdGNwc29ja19uZXcDDhpfX2VtX2pzX19famRfdGNwc29ja193cml0ZQMPGl9fZW1fanNfX19qZF90Y3Bzb2NrX2Nsb3NlAxAhX19lbV9qc19fX2pkX3RjcHNvY2tfaXNfYXZhaWxhYmxlAxEGZmZsdXNoAKYGFWVtc2NyaXB0ZW5fc3RhY2tfaW5pdAD/BhllbXNjcmlwdGVuX3N0YWNrX2dldF9mcmVlAIAHGWVtc2NyaXB0ZW5fc3RhY2tfZ2V0X2Jhc2UAgQcYZW1zY3JpcHRlbl9zdGFja19nZXRfZW5kAIIHCXN0YWNrU2F2ZQCDBwxzdGFja1Jlc3RvcmUAhAcKc3RhY2tBbGxvYwCFBxxlbXNjcmlwdGVuX3N0YWNrX2dldF9jdXJyZW50AIYHDV9fc3RhcnRfZW1fanMDEgxfX3N0b3BfZW1fanMDEwxkeW5DYWxsX2ppamkAiAcJpwQBAEEBC5YCKTpTVGRZW25vc2VtsQLBAtEC8AL0AvkCnwGgAaEBogGjAaQBpQGmAacBqAGpAaoBqwGsAa0BrgGvAbABsQGzAbQBtQG2AbcBuAG5AboBuwG8Ab0BvgG/AcABwQHCAcMBxAHFAcYBxwHIAckBygHLAcwBzQHOAc8B0AHRAdIB0wHUAdUB1gHXAdoB2wHcAd0B3gHfAeAB4QHiAeMB5gHnAekB6gHrAe0B7wHwAfEB9AH1AfYB+wH8Af0B/gH/AYACgQKCAoMChAKFAoYChwKIAokCigKLAo0CjgKPApECkgKTApUClgKXApgCmQKaApsCnAKdAp4CnwKgAqECogKjAqUCpwKoAqkCqgKrAqwCrQKuArACswK0ArUCtgK3ArgCuQK6ArsCvAK9Ar4CvwLAAsICwwLEAsUCxgLHAsgCyQLKAssCzQKPBJAEkQSSBJMElASVBJYElwSYBJkEmgSbBJwEnQSeBJ8EoAShBKIEowSkBKUEpgSnBKgEqQSqBKsErAStBK4ErwSwBLEEsgSzBLQEtQS2BLcEuAS5BLoEuwS8BL0EvgS/BMAEwQTCBMMExATFBMYExwTIBMkEygTLBMwEzQTOBM8E0ATRBNIE0wTUBNUE1gTXBNgE2QTaBNsE3ATdBN4E3wTgBOEE4gTjBOQE5QTmBOcE6ATpBOoE6wSGBYgFjAWNBY8FjgWSBZQFpgWnBaoFqwWRBqsGqgapBgr11gz1BgUAEP8GCyUBAX8CQEEAKALA+wEiAA0AQcnWAEHmygBBGUG3IRCDBgALIAAL3AEBAn8CQAJAAkACQEEAKALA+wEiA0UNACABQQNxDQEgACADayIDQQBIDQIgAyACakEAKALE+wFLDQICQAJAIANBB3ENACACRQ0FQQAhAwwBC0Gn3gBB5soAQSJB6CgQgwYACwJAA0AgACADIgNqLQAAQf8BRw0BIANBAWoiBCEDIAQgAkYNBQwACwALQe8vQebKAEEkQegoEIMGAAtBydYAQebKAEEeQegoEIMGAAtBt94AQebKAEEgQegoEIMGAAtBkjFB5soAQSFB6CgQgwYACyAAIAEgAhChBhoLfQEBfwJAAkACQEEAKALA+wEiAUUNACAAIAFrIgFBAEgNASABQQAoAsT7AUGAYGpLDQEgAUH/H3ENAiAAQf8BQYAgEKMGGg8LQcnWAEHmygBBKUHTNBCDBgALQbPYAEHmygBBK0HTNBCDBgALQf/gAEHmygBBLEHTNBCDBgALRwEDf0HkxABBABA7QQAoAsD7ASEAQQAoAsT7ASEBAkADQCABQX9qIgJBAEgNASACIQEgACACai0AAEE3Rg0ACyAAIAIQAAsLKgECf0EAEAEiADYCxPsBQQAgABDqBiIBNgLA+wEgAUE3IAAQowYgABACCwUAEAMACwIACwIACwIACxwBAX8CQCAAEOoGIgENABADAAsgAUEAIAAQowYLBwAgABDrBgsEAEEACwoAQcj7ARCwBhoLCgBByPsBELEGGgthAgJ/AX4jAEEQayIBJAACQAJAIAAQ0AZBEEcNACABQQhqIAAQggZBCEcNACABKQMIIQMMAQsgACAAENAGIgIQ9QWtQiCGIABBAWogAkF/ahD1Ba2EIQMLIAFBEGokACADCwgAIAAgARAECwgAEDwgABAFCwYAIAAQBgsIACAAIAEQBwsIACABEAhBAAsTAEEAIACtQiCGIAGshDcDwO4BCw0AQQAgABAkNwPA7gELJwACQEEALQDk+wENAEEAQQE6AOT7ARBAQdDuAEEAEEMQkwYQ5wULC3ABAn8jAEEwayIAJAACQEEALQDk+wFBAUcNAEEAQQI6AOT7ASAAQStqEPYFEIkGIABBEGpBwO4BQQgQgQYgACAAQStqNgIEIAAgAEEQajYCAEGfGSAAEDsLEO0FEEVBACgC4JACIQEgAEEwaiQAIAELLQACQCAAQQJqIAAtAAJBCmoQ+AUgAC8BAEYNAEGc2QBBABA7QX4PCyAAEJQGCwgAIAAgARBxCwkAIAAgARD/AwsIACAAIAEQOQsVAAJAIABFDQBBARDjAg8LQQEQ5AILCQBBACkDwO4BCw4AQZMTQQAQO0EAEAkAC54BAgF8AX4CQEEAKQPo+wFCAFINAAJAAkAQCkQAAAAAAECPQKIiAEQAAAAAAADwQ2MgAEQAAAAAAAAAAGZxRQ0AIACxIQEMAQtCACEBC0EAIAFChX98NwPo+wELAkACQBAKRAAAAAAAQI9AoiIARAAAAAAAAPBDYyAARAAAAAAAAAAAZnFFDQAgALEhAQwBC0IAIQELIAFBACkD6PsBfQsGACAAEAsLAgALBgAQGhB0Cx0AQfD7ASABNgIEQQAgADYC8PsBQQJBABCcBUEAC80EAQF/IwBBEGsiBCQAAkACQAJAAkACQCABQX9qDhADAgQEBAQEBAQEBAQEBAQBAAsgAUEwRw0DQfD7AS0ADEUNAwJAAkBB8PsBKAIEQfD7ASgCCCICayIBQeABIAFB4AFIGyIBDQBB8PsBQRRqENUFIQIMAQtB8PsBQRRqQQAoAvD7ASACaiABENQFIQILIAINA0Hw+wFB8PsBKAIIIAFqNgIIIAENA0HRNUEAEDtB8PsBQYACOwEMQQAQJwwDCyACRQ0CQQAoAvD7AUUNAkHw+wEoAhAgAkcNAgJAIAMtAANBAXENACADLwEOQYABRw0AQbc1QQAQO0Hw+wFBFGogAxDPBQ0AQfD7AUEBOgAMC0Hw+wEtAAxFDQICQAJAQfD7ASgCBEHw+wEoAggiAmsiAUHgASABQeABSBsiAQ0AQfD7AUEUahDVBSECDAELQfD7AUEUakEAKALw+wEgAmogARDUBSECCyACDQJB8PsBQfD7ASgCCCABajYCCCABDQJB0TVBABA7QfD7AUGAAjsBDEEAECcMAgtB8PsBKAIQIgFFDQEgAUEAIAEtAARrQQxsakFcaiACRw0BQcbsAEETQQFBACgC4O0BEK8GGkHw+wFBADYCEAwBC0EAKALw+wFFDQBB8PsBKAIQDQAgAikDCBD2BVENAEHw+wEgAkGr1NOJARCgBSIBNgIQIAFFDQAgBEELaiACKQMIEIkGIAQgBEELajYCAEHsGiAEEDtB8PsBKAIQQYABQfD7AUEEakEEEKEFGgsgBEEQaiQAC08BAX8jAEEQayICJAAgAiABNgIMIAAgARC3BQJAQZD+AUHAAkGM/gEQugVFDQADQEGQ/gEQNkGQ/gFBwAJBjP4BELoFDQALCyACQRBqJAALLwACQEGQ/gFBwAJBjP4BELoFRQ0AA0BBkP4BEDZBkP4BQcACQYz+ARC6BQ0ACwsLMwAQRRA3AkBBkP4BQcACQYz+ARC6BUUNAANAQZD+ARA2QZD+AUHAAkGM/gEQugUNAAsLCwgAIAAgARAMCwgAIAAgARANCwUAEA4aCwQAEA8LCwAgACABIAIQ+gQLFwBBACAANgLUgAJBACABNgLQgAIQmQYLCwBBAEEBOgDYgAILNgEBfwJAQQAtANiAAkUNAANAQQBBADoA2IACAkAQmwYiAEUNACAAEJwGC0EALQDYgAINAAsLCyYBAX8CQEEAKALUgAIiAQ0AQX8PC0EAKALQgAIgACABKAIMEQMAC9ICAQJ/IwBBMGsiBiQAAkACQAJAAkAgAhDJBQ0AIAAgAUHMPEEAENsDDAELIAYgBCkDADcDGCABIAZBGGogBkEsahDyAyIHRQ0BAkBBASACQQNxdCADaiAGKAIsTQ0AAkAgBUUNACAGQSBqIAFB8TdBABDbAwsgAEIANwMADAELIAcgA2ohAwJAIAVFDQAgBiAEKQMANwMQIAEgBkEQahDwA0UNAyAGIAUpAwA3AyACQAJAIAYoAiRBf0cNACADIAIgBigCIBDLBQwBCyAGIAYpAyA3AwggAyACIAEgBkEIahDsAxDKBQsgAEIANwMADAELAkAgAkEHSw0AIAMgAhDMBSIBQYGAgIB4akECSQ0AIAAgARDpAwwBCyAAIAMgAhDNBRDoAwsgBkEwaiQADwtB6NYAQfbIAEEVQekiEIMGAAtB2uUAQfbIAEEhQekiEIMGAAvkAwECfyADKAIAIQUCQAJAAkACQAJAAkACQAJAAkACQCACQQR0QTBxIAJBBHZyQX8gAkEMcUEMRhtBAWoOCAEDBAcAAggICQsgBEEARyECAkAgBA0AQQAhBiACIQQMBgsgBS0AAA0EQQAhBiACIQQMBQsCQCACEMkFDQAgACABQcw8QQAQ2wMPCwJAQQEgAkEDcXQiASAETQ0AIABCADcDAA8LIAMgAygCACABajYCAAJAIAJBB0sNACAFIAIQzAUiBEGBgICAeGpBAkkNACAAIAQQ6QMPCyAAIAUgAhDNBRDoAw8LAkAgBA0AIABCADcDAA8LIAMgBUEBajYCACAAQZCLAUGYiwEgBS0AABspAwA3AwAPCyAAQgA3AwAPCwJAIAEgBSAEEJMBIgINACAAQgA3AwAPCyADIAMoAgAgBGo2AgAgACABQQggAhDrAw8LQQAhBgJAAkADQCAGQQFqIgIgBEYNASACIQYgBSACai0AAA0ACyACIQYMAQsgBCEGCyAGIQYgAiAESSEECyADIAUgBiICaiAEajYCACAAIAFBCCABIAUgAhCYARDrAw8LIAMgBSAEajYCACAAIAFBCCABIAUgBBCYARDrAw8LIAAgAUG8GBDcAw8LIAAgAUGeEhDcAwvsAwEDfyMAQcAAayIFJAAgAUEEdEEwcSABQQR2ckF/IAFBDHFBDEYbIgYhBwJAAkACQAJAAkACQCAGQQFqDggABQICAgEDAwQLAkAgARDJBQ0AIAVBOGogAEHMPEEAENsDQQAhBwwFCwJAQQEgAUEDcXQiByADTQ0AIAchBwwFCwJAIAQoAgRBf0cNACACIAEgBCgCABDLBSAHIQcMBQsgBSAEKQMANwMIIAIgASAAIAVBCGoQ7AMQygUgByEHDAQLAkAgAw0AQQEhBwwECyAFIAQpAwA3AxAgAkEAIAAgBUEQahDuA2s6AABBASEHDAMLIAUgBCkDADcDKCAAIAVBKGogBUE0ahDyAyIHIQECQAJAIAcNACAFIAQpAwA3AyAgBUE4aiAAIAVBIGoQzQMgBCAFKQM4NwMAIAUgBCkDADcDGCAAIAVBGGogBUE0ahDyAyIHIQEgBw0AQQAhAQwBCyABIQcCQCAFKAI0IANNDQAgBSADNgI0CyACIAcgBSgCNCIBEKEGIQcCQCAGQQNHDQAgASADTw0AIAcgAWpBADoAACAFIAFBAWo2AjQLIAUoAjQhAQsgASEHDAILIAVBOGogAEG8GBDcA0EAIQcMAQsgBUE4aiAAQZ4SENwDQQAhBwsgBUHAAGokACAHC5gBAQN/IwBBEGsiAyQAAkACQCABQe8ASw0AQb0pQQAQO0EAIQQMAQsgACABEP8DIQUgABD+A0EAIQQgBQ0AQdgIEB8iBCACLQAAOgCkAiAEIAQtAAZBCHI6AAYQvQMgACABEL4DIARB1gJqIgEQvwMgAyABNgIEIANBIDYCAEG8IyADEDsgBCAAEEsgBCEECyADQRBqJAAgBAvMAQAgACABNgLkAUEAQQAoAtyAAkEBaiIBNgLcgAIgACABNgKcAiAAEJoBNgKgAiAAIAAgACgC5AEvAQxBA3QQigE2AgAgACgCoAIgABCZASAAIAAQkQE2AtgBIAAgABCRATYC4AEgACAAEJEBNgLcAQJAAkAgAC8BCA0AIAAQgAEgABDfAiAAEOACIAAQ2AEgAC8BCA0AIAAQiQQNASAAQQE6AEMgAEKAgICAMDcDWCAAQQBBARB9GgsPC0Hd4gBByMYAQSZBpQkQgwYACyoBAX8CQCAALQAGQQhxDQAgACgCiAIgACgCgAIiBEYNACAAIAQ2AogCCwsZAAJAIAFFDQAgASAALwEKNgIACyAALwEIC8ADAQF/AkACQAJAIABFDQAgAC0ABiIEQQFxDQEgACAEQQFyOgAGAkAgAUEwRg0AIAAQgAELAkAgAC0ABiIEQRBxRQ0AIAAgBEEQczoABiAAKALsAUUNACAAQQE6AEgCQCAALQBFRQ0AIAAQ1wMLAkAgACgC7AEiBEUNACAEEH8LIABBADoASCAAEIMBCwJAAkACQAJAAkACQCABQXBqDjEAAgEFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQFBQUFBQUFBQUFBQUFBQUDBQsCQCAALQAGQQhxDQAgACgCiAIgACgCgAIiBEYNACAAIAQ2AogCCyAAIAIgAxDaAgwECyAALQAGQQhxDQMgACgCiAIgACgCgAIiA0YNAyAAIAM2AogCDAMLAkAgAC0ABkEIcQ0AIAAoAogCIAAoAoACIgRGDQAgACAENgKIAgsgAEEAIAMQ2gIMAgsgACADEN4CDAELIAAQgwELIAAQggEQxQUgAC0ABiIDQQFxRQ0CIAAgA0H+AXE6AAYgAUEwRw0AIAAQ3QILDwtBvt0AQcjGAEHRAEG2HxCDBgALQdfhAEHIxgBB1gBBrTIQgwYAC7cBAQJ/IAAQ4QIgABCDBAJAIAAtAAYiAUEBcQ0AIAAgAUEBcjoABiAAQfQEahCvAyAAEHogACgCoAIgACgCABCMAQJAIAAvAUxFDQBBACEBA0AgACgCoAIgACgC9AEgASIBQQJ0aigCABCMASABQQFqIgIhASACIAAvAUxJDQALCyAAKAKgAiAAKAL0ARCMASAAKAKgAhCbASAAQQBB2AgQowYaDwtBvt0AQcjGAEHRAEG2HxCDBgALEgACQCAARQ0AIAAQTyAAECALCz8BAX8jAEEQayICJAAgAEEAQR4QnQEaIABBf0EAEJ0BGiACIAE2AgBB8eQAIAIQOyAAQeTUAxB2IAJBEGokAAsNACAAKAKgAiABEIwBCwIAC3UBAX8CQAJAAkAgAS8BDiICQYB/ag4CAAECCyAAQQIgARBVDwsgAEEBIAEQVQ8LAkAgAkGAI0YNAAJAAkAgACgCCCgCDCIARQ0AIAEgABEEAEEASg0BCyABEN4FGgsPCyABIAAoAggoAgQRCABB/wFxENoFGgvUAQEDfyACLQAMIgNBAEchBAJAAkAgAw0AQQEhBSAEIQQMAQtBASEFIAQhBCACLQAQRQ0AQQAhBQJAAkADQCAFQQFqIgQgA0YNASAEIQUgAiAEakEQai0AAA0ACyAEIQUMAQsgAyEFCyAFQQFqIQUgBCADSSEECyAFIQUCQCAEDQBBjhVBABA7DwsCQCAAKAIIKAIEEQgARQ0AAkAgASACQRBqIgQgBCAFaiACLQAMIAVrIAAoAggoAgARCQBFDQBBtcAAQQAQO0HJABAcDwtBjAEQHAsLNQECf0EAKALggAIhA0GAASEEAkACQAJAIABBf2oOAgABAgtBgQEhBAsgAyAEIAEgAhCSBgsLGwEBf0Ho8AAQ5gUiASAANgIIQQAgATYC4IACCy4BAX8CQEEAKALggAIiAUUNACABKAIIIgFFDQAgASgCECIBRQ0AIAAgAREAAAsLwgEBBX8CQCAALQAKRQ0AIABBFGoiASECA0ACQAJAAkAgAC8BDiIDIAAvAQwiBEkNACACENUFGiAAQQA6AAogACgCEBAgDAELAkACQCABIAAoAhAgAC0ACyIFIANsaiAEIANrIgNByAEgA0HIAUkbQQEgBUEBRhsiAyAFbBDUBQ4CAAUBCyAAIAAvAQ4gA2o7AQ4MAgsgAC0ACkUNASABENUFGiAAQQA6AAogACgCEBAgCyAAQQA2AhALIAAtAAoNAAsLC20BA38CQEEAKALkgAIiAUUNAAJAEHAiAkUNACACIAEtAAZBAEcQggQgAkEAOgBJIAIgAS0ACEEAR0EBdCIDOgBJIAEtAAdFDQAgAiADQQFyOgBJCwJAIAEtAAYNACABQQA6AAkLIABBBhCGBAsLpBUCB38BfiMAQYABayICJAAgAhBwIgM2AlwgAiABNgJYIAIgADYCVAJAAkACQCADRQ0AIAAtAAkNAQsCQAJAAkAgAS8BDiIEQf9+ag4SAAAAAQMDAwMDAwMDAwMDAgICAwsCQCAALQAKRQ0AIABBFGoQ1QUaIABBADoACiAAKAIQECAgAEEANgIQCyAAQgA3AgwgAEEBOgALIABBFGogARDOBRogACABLQAOOgAKDAMLIAJB+ABqQQAoAqBxNgIAIAJBACkCmHE3A3AgAS0ADSAEIAJB8ABqQQwQmgYaDAELIANFDQELAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAS8BDkGAf2oOFwIDBAYHBQ0NDQ0NDQ0NDQ0AAQgKCQsMDQsgAS0ADEUNDyABQRBqIQVBACEAA0AgAyAFIAAiAGooAgBBABCHBBogAEEEaiIEIQAgBCABLQAMSQ0ADBALAAsgAS0ADEUNDiABQRBqIQVBACEAA0AgAyAFIAAiAGooAgAQhAQaIABBBGoiBCEAIAQgAS0ADEkNAAwPCwALQQAhAQJAIANFDQAgAygC8AEhAQsCQCABIgANAEEAIQUMDQtBACEBIAAhAANAIAFBAWoiASEFIAEhASAAKAIAIgQhACAEDQAMDQsAC0EAIQACQCADIAFBHGooAgAQfCIGRQ0AIAYoAighAAsCQCAAIgENAEEAIQUMCwsgASEBQQAhAANAIABBAWoiACEFIAEoAgwiBCEBIAAhACAEDQAMCwsACwJAIAEtACBB8AFxQdAARw0AIAFB0AA6ACALAkACQCABLQAgIgRBAkYNACAEQdAARw0BQQAhBAJAIAFBHGooAgAiBUUNACADIAUQnAEgBSEEC0EAIQUCQCAEIgNFDQAgAy0AA0EPcSEFC0EAIQQCQAJAAkACQCAFQX1qDgYBAwMDAwADCyADKAIQQQhqIQQMAQsgA0EIaiEECyAELwEAIQQLAkAgBEH//wNxIgQNAAJAIAAtAApFDQAgAEEUahDVBRogAEEAOgAKIAAoAhAQICAAQQA2AhALIABCADcCDCAAQQE6AAsgAEEUaiABEM4FGiAAIAEtAA46AAoMDgsCQAJAIAMNAEEAIQEMAQsgAy0AA0EPcSEBCwJAAkACQCABQX1qDgYAAgICAgECCyACQdQAaiAEIAMoAgwQXAwPCyACQdQAaiAEIANBGGoQXAwOC0HaywBBjQNB+zwQ/gUACyABQRxqKAIAQeQARw0AIAJB1ABqIAMoAuQBLwEMIAMoAgAQXAwMCwJAIAAtAApFDQAgAEEUahDVBRogAEEAOgAKIAAoAhAQICAAQQA2AhALIABCADcCDCAAQQE6AAsgAEEUaiABEM4FGiAAIAEtAA46AAoMCwsgAkHwAGogAyABLQAgIAFBHGooAgAQXSACQQA2AmAgAiACKQNwNwMgAkAgAyACQSBqEPMDIgRFDQAgBCgCAEGAgID4AHFBgICA2ABHDQAgAkHoAGogA0EIIAQoAhwQ6wMgAiACKQNoNwNwCyACIAIpA3A3AxgCQAJAIAMgAkEYahDvAw0AIAIgAikDcDcDEEEAIQQgAyACQRBqEMUDRQ0BCyACIAIpA3A3AwggAyACQQhqIAJB4ABqEPIDIQQLIAQhBQJAIAIoAmAiBCABQSJqLwEAIgNLDQACQCAALQAKRQ0AIABBFGoQ1QUaIABBADoACiAAKAIQECAgAEEANgIQCyAAQgA3AgwgAEEBOgALIABBFGogARDOBRogACABLQAOOgAKDAsLIAIgBCADayIANgJgIAIgACABQSRqLwEAIgEgACABSRsiATYCYCACQdQAakEBIAEQXiIBRQ0KIAEgBSADaiACKAJgEKEGGgwKCyACQfAAaiADIAEtACAgAUEcaigCABBdIAIgAikDcDcDMCACQdQAakEQIAMgAkEwakEAEF8iARBeIgBFDQkgAiACKQNwNwMoIAEgAyACQShqIAAQX0YNCUGR2gBB2ssAQZQEQYQ/EIMGAAsgAkHgAGogAyABQRRqLQAAIAEoAhAQXSACIAIpA2AiCTcDaCACIAk3AzggAyACQfAAaiACQThqEGAgAS0ADSABLwEOIAJB8ABqQQwQmgYaDAgLIAMQgwQMBwsgAEEBOgAGAkAQcCIBRQ0AIAEgAC0ABkEARxCCBCABQQA6AEkgASAALQAIQQBHQQF0IgQ6AEkgAC0AB0UNACABIARBAXI6AEkLAkAgAC0ABg0AIABBADoACQsgA0UNBkGqEkEAEDsgAxCFBAwGCyAAQQA6AAkgA0UNBUGVNkEAEDsgAxCBBBoMBQsgAEEBOgAGAkAQcCIDRQ0AIAMgAC0ABkEARxCCBCADQQA6AEkgAyAALQAIQQBHQQF0IgE6AEkgAC0AB0UNACADIAFBAXI6AEkLAkAgAC0ABg0AIABBADoACQsQaQwECwJAIANFDQACQAJAIAEoAhAiBA0AIAJCADcDcAwBCyACIAQ2AnAgAkEINgJ0IAMgBBCcAQsgAiACKQNwNwNIAkACQCADIAJByABqEPMDIgQNAEEAIQUMAQsgBCgCAEGAgID4AHFBgICAwABGIQULAkACQCAFIgcNACACIAEoAhA2AkBB9wogAkHAAGoQOwwBCyADQQFBAyABLQAMQXhqIgVBBEkbIgg6AAcCQCABQRRqLwEAIgZBAXFFDQAgAyAIQQhyOgAHCwJAIAZBAnFFDQAgAyADLQAHQQRyOgAHCyADIAQ2AqwCIAVBBEkNACAFQQJ2IgRBASAEQQFLGyEFIAFBGGohBkEAIQEDQCADIAYgASIBQQJ0aigCAEEBEIcEGiABQQFqIgQhASAEIAVHDQALCyAHRQ0EIABBADoACSADRQ0EQZU2QQAQOyADEIEEGgwECyAAQQA6AAkMAwsCQCAAIAFB+PAAEOAFIgNBgH9qQQJJDQAgA0EBRw0DCwJAEHAiA0UNACADIAAtAAZBAEcQggQgA0EAOgBJIAMgAC0ACEEAR0EBdCIBOgBJIAAtAAdFDQAgAyABQQFyOgBJCyAALQAGDQIgAEEAOgAJDAILIAJB1ABqQRAgBRBeIgdFDQECQAJAIAYNAEEAIQEMAQsgBigCKCEBCyABIgFFDQEgASEBQQAhAANAIAJB8ABqIANBCCABIgEQ6wMgByAAIgVBBHRqIgAgAigCcDYCACAAIAEvAQQ2AgRBACEEAkAgASgCCCIGRQ0AIAJB8ABqIANBCCAGEOsDIAIoAnAhBAsgACAENgIIIABBz4Z/IAEoAhAiBCADKADkASIGIAYoAiBqIgZrQQR2IAQgBkYbOwEMIAEoAgwiBCEBIAVBAWohACAEDQAMAgsACyACQdQAakEIIAUQXiIHRQ0AAkACQCADDQBBACEBDAELIAMoAvABIQELIAEiAUUNAEEAIQAgASEBA0AgByAAIgVBA3RqIgAgASIBKAIcNgIAIAAgAS8BFiIEQc+GfyAEGzsBBEEAIQQCQCABKAIoIgZFDQBBz4Z/IAYoAhAiBCADKADkASIGIAYoAiBqIgZrQQR2IAQgBkYbIQQLIAAgBDsBBiAFQQFqIQAgASgCACIEIQEgBA0ACwsgAkGAAWokAAucAgEFfyMAQRBrIgMkAAJAIAAoAgQiBC8BDkGCAUcNAAJAAkAgASAEQSJqLwEAIgVLDQACQCAAKAIAIgEtAApFDQAgAUEUahDVBRogAUEAOgAKIAEoAhAQICABQQA2AhALIAFCADcCDCABQQE6AAsgAUEUaiAAKAIEEM4FGiABIAAoAgQtAA46AAoMAQsgAEEMIAEgBWsiASAEQSRqLwEAIgQgASAESRsiBhBeIgdFDQAgBkUNACACIAVBA3RqIQVBACEBA0AgACgCCCEEIAMgBSABIgFBA3RqKQMANwMIIAQgByABQQxsaiADQQhqEGAgAUEBaiIEIQEgBCAGRw0ACwsgA0EQaiQADwtBtdMAQdrLAEHmAkHXFxCDBgAL4wQCA38BfiMAQRBrIgQkACADIQUCQAJAAkACQAJAAkACQAJAAkACQAJAAkBB0AAgAiACQfABcUHQAEYbIgJBf2oOUAABAgkDCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkEBAQECQkJCQkJCQkJCQkJBgUJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkHCQsgACADEOkDDAoLAkACQAJAAkAgAw4EAQIDAAoLIABBACkDsIsBNwMADAwLIABCADcDAAwLCyAAQQApA5CLATcDAAwKCyAAQQApA5iLATcDAAwJCyAAIAM2AgAgAEEBNgIEDAgLIAAgASADEKwDDAcLIAAgASACQWBqIAMQjgQMBgsCQEEAIAMgA0HPhgNGGyIDIAEoAOQBQSRqKAIAQQR2SQ0AAkAgA0HQhgNPDQAgAyEFDAULIANBAC8ByO4BQdCGA2pJDQAgAyEFDAQLIAAgAzYCACAAQQM2AgQMBQtBACEFAkAgAS8BTCADTQ0AIAEoAvQBIANBAnRqKAIAIQULAkAgBSIGDQAgAyEFDAMLAkACQCAGKAIMIgVFDQAgACABQQggBRDrAwwBCyAAIAM2AgAgAEECNgIECyADIQUgBkUNAgwECwJAIAMNACAAQgA3AwAMBAsgACADNgIAIABBCDYCBCABIAMQnAEMAwsgAyEFIANB5QBGDQELIAQgBTYCBCAEIAI2AgBBwAogBBA7IABCADcDAAwBCwJAIAEpADgiB0IAUg0AIAEoAuwBIgNFDQAgACADKQMgNwMADAELIAAgBzcDAAsgBEEQaiQAC9ABAQJ/AkACQCAAKAIAIgMtAAZFDQAgAiECIAMtAAkNAQtBACECCwJAIAIiAkHoB08NAAJAIAMtAApFDQAgA0EUahDVBRogA0EAOgAKIAMoAhAQICADQQA2AhALIANBADsBDiADIAI7AQwgAyABOgALQQAhBAJAIAJFDQAgAiABbBAfIQQLIAMgBCICNgIQAkAgAg0AIANBADsBDAsgA0EUaiAAKAIEEM4FGiADIAAoAgQtAA46AAogAygCEA8LQczbAEHaywBBMUGvxAAQgwYAC9YCAQJ/IwBBwABrIgMkACADIAI2AjwgAyABKQMANwMgQQAhAgJAIANBIGoQ9gMNACADIAEpAwA3AxgCQAJAIAAgA0EYahCVAyICDQAgAyABKQMANwMQIAAgA0EQahCUAyEBDAELAkAgACACEJYDIgENAEEAIQEMAQsCQCAAIAIQ9gINACABIQEMAQtBACABIAIoAgBBgICA+ABxQYCAgMgARhshAQsCQAJAIAEiBA0AQQAhAQwBCwJAIAMoAjwiAUUNACADIAFBEGo2AjwgA0EwakH8ABDJAyADQShqIAAgBBCtAyADIAMpAzA3AwggAyADKQMoNwMAIAAgASADQQhqIAMQYwtBASEBCyABIQECQCACDQAgASECDAELAkAgAygCPEUNACAAIAIgA0E8akEFEPECIAFqIQIMAQsgACACQQBBABDxAiABaiECCyADQcAAaiQAIAIL+AcBA38jAEHQAGsiAyQAIAFBCGpBADYCACABQgA3AgAgAyACKQMANwMwAkACQAJAAkACQAJAIAAgA0EwaiADQcgAaiADQcQAahCMAyIEQQBIDQACQCADKAJEIgVFDQAgAykDSFANACACKAIEIgBBgIDA/wdxDQMgAEEIcUUNAyABQdcAOgAKIAEgAigCADYCAAwCCwJAAkAgBUUNACADQThqIABBCCAFEOsDIAIgAykDODcDAAwBCyACIAMpA0g3AwALIAEgBEHPhn8gBBs7AQgLIAIoAgAhBAJAAkACQAJAAkBBECACKAIEIgVBD3EgBUGAgMD/B3EbDgkBBAQEAAQDBAIECyABIARB//8AcTYCACABIARBDnZBIGo6AAoMBAsgBEGgf2oiBUErSw0CIAEgBTYCACABQQU6AAoMAwsCQAJAIAQNAEEAIQUMAQsgBC0AA0EPcSEFCwJAIAVBfGoOBgACAgICAAILIAEgBDYCACABQdIAOgAKIAMgAikDADcDKCABIAAgA0EoakEAEF82AgQMAgsgASAENgIAIAFBMjoACgwBCyADIAIpAwA3AyACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgACADQSBqEPUDDg0BBAsFCQYDBwsICgIACwsgAUEDNgIAIAFBAjoACgwLCyABQQA2AgAgAUECOgAKDAoLIAFBBjoACiABIAIpAwA3AgAMCQsgAUECOgAKIAMgAikDADcDACABQQFBAiAAIAMQ7gMbNgIADAgLIAFBAToACiADIAIpAwA3AwggASAAIANBCGoQ7AM5AgAMBwsgAUHRADoACiACKAIAIQIgASAENgIAIAEgAi8BCEGAgICAeHI2AgQMBgsgASAENgIAIAFBMDoACiADIAIpAwA3AxAgASAAIANBEGpBABBfNgIEDAULIAEgBDYCACABQQM6AAoMBAsgAigCBCIFQYCAwP8HcQ0FIAVBD3FBCEcNBSADIAIpAwA3AxggACADQRhqEMUDRQ0FIAEgBDYCACABQdQAOgAKDAMLIAIoAgAiAkUNBSACKAIAQYCAgPgAcUGAgIAoRw0FIAEgBDYCACABQdMAOgAKIAEgAi8BBEGAgICAeHI2AgQMAgsgAigCACICRQ0FIAIoAgBBgICA+ABxQYCAgNgARw0FIAEgBDYCACABQdYAOgAKIAEgAigCHC8BBEGAgICAeHI2AgQMAQsgAUEHOgAKIAEgAikDADcCAAsgA0HQAGokAA8LQfPiAEHaywBBkwFB+zIQgwYAC0G84wBB2ssAQfQBQfsyEIMGAAtB+tQAQdrLAEH7AUH7MhCDBgALQZDTAEHaywBBhAJB+zIQgwYAC4QBAQR/IwBBEGsiASQAIAEgAC0ARjYCAEEAKALkgAIhAkHtwgAgARA7IAAoAuwBIgMhBAJAIAMNACAAKALwASEEC0EAIQMCQCAEIgRFDQAgBCgCHCEDCyABIAM2AgggASAALQBGOgAMIAJBAToACSACQYABIAFBCGpBCBCSBiABQRBqJAALEABBAEGI8QAQ5gU2AuSAAguHAgECfyMAQSBrIgQkACAEIAIpAwA3AwggACAEQRRqIARBCGoQYAJAAkACQAJAIAQtAB4iBUFfakEDSQ0AQQAhAiAFQdQARw0BIAQoAhQiBSECIAVBgYCAgHhxQYGAgIB4Rw0BQfrWAEHaywBBogJBvTIQgwYACyAFQRh0IgJBf0wNASAEKAIUQQF0IgVBgICACE8NAiACIAVyQYGAgIB4ciECCyABIAI2AgAgBCADKQMANwMAIAAgBEEUaiAEEGAgAUEMaiAEQRxqKAIANgAAIAEgBCkCFDcABCAEQSBqJAAPC0Hv3wBB2ssAQZwCQb0yEIMGAAtBsN8AQdrLAEGdAkG9MhCDBgALSQECfyMAQRBrIgQkACABKAIAIQUgBCACKQMANwMIIAQgAykDADcDACAAIAUgBEEIaiAEEGMgASABKAIAQRBqNgIAIARBEGokAAuSBAEFfyMAQRBrIgEkAAJAIAAoAjQiAkEASA0AAkACQCAAKAIYIgNFDQAgAygCAEHT+qrseEcNACADIQQgAygCCEGrlvGTe0YNAQtBACEECwJAAkAgBCIDDQBBACEEDAELIAMoAgQhBAsCQCACIAQiBEgNACAAQThqENUFGiAAQX82AjQMAQsCQAJAIABBOGoiBSADIAJqQYABaiAEQewBIARB7AFIGyICENQFDgIAAgELIAAgACgCNCACajYCNAwBCyAAQX82AjQgBRDVBRoLAkAgAEEMakGAgIAEEIAGRQ0AAkAgAC0ACCICQQFxDQAgAC0AB0UNAQsgACgCHA0AIAAgAkH+AXE6AAggABBmCwJAIAAoAhwiAkUNACACIAFBCGoQTSICRQ0AIAEgASgCCDYCBCABQQAgAiACQeDUA0YbNgIAIABBgAEgAUEIEJIGAkAgACgCHCIDRQ0AIAMQUCAAQQA2AhxB9ihBABA7C0EAIQMCQCAAKAIcIgQNAAJAAkAgACgCGCIDRQ0AIAMoAgBB0/qq7HhHDQAgAyEFIAMoAghBq5bxk3tGDQELQQAhBQsCQCAFIgVFDQBBAyEDIAUoAgQNAQtBBCEDCyABIAM2AgwgACAEQQBHOgAGIABBBCABQQxqQQQQkgYgAEEAKALg+wFBgIDAAEGAgMACIAJB4NQDRhtqNgIMCyABQRBqJAALzAMCBX8CfiMAQRBrIgEkAAJAAkAgACgCGCICRQ0AIAIoAgBB0/qq7HhHDQAgAiEDIAIoAghBq5bxk3tGDQELQQAhAwsCQAJAIAMiAkUNACACKAIEIgNFDQAgAkGAAWoiBCADEP8DDQACQAJAIAAoAhgiA0UNACADKAIAQdP6qux4Rw0AIAMhBSADKAIIQauW8ZN7Rg0BC0EAIQULAkAgBSIDRQ0AIANB7AFqKAIARQ0AIAMgA0HoAWooAgBqQYABaiIDEK0FDQACQCADKQMQIgZQDQAgACkDECIHUA0AIAcgBlENAEGU2ABBABA7CyAAIAMpAxA3AxALAkAgACkDEEIAUg0AIABCATcDEAsgACAEIAIoAgQQZwwBCwJAIAAoAhwiAkUNACACEFALIAEgAC0ABDoACyAAQcDxAEGgASABQQtqEEo2AhwLQQAhAgJAIAAoAhwiAw0AAkACQCAAKAIYIgJFDQAgAigCAEHT+qrseEcNACACIQQgAigCCEGrlvGTe0YNAQtBACEECwJAIAQiBEUNAEEDIQIgBCgCBA0BC0EEIQILIAEgAjYCDCAAIANBAEc6AAYgAEEEIAFBDGpBBBCSBiABQRBqJAALfgECfyMAQRBrIgMkAAJAIAAoAhwiBEUNACAEEFALIAMgAC0ABDoADyAAIAEgAiADQQ9qEEoiAjYCHAJAIAFBwPEARg0AIAJFDQBB5TZBABC0BSEBIANB6iZBABC0BTYCBCADIAE2AgBBzxkgAxA7IAAoAhwQWgsgA0EQaiQAC68BAQR/IwBBEGsiASQAAkAgACgCHCICRQ0AIAIQUCAAQQA2AhxB9ihBABA7C0EAIQICQCAAKAIcIgMNAAJAAkAgACgCGCICRQ0AIAIoAgBB0/qq7HhHDQAgAiEEIAIoAghBq5bxk3tGDQELQQAhBAsCQCAEIgRFDQBBAyECIAQoAgQNAQtBBCECCyABIAI2AgwgACADQQBHOgAGIABBBCABQQxqQQQQkgYgAUEQaiQAC9QBAQV/IwBBEGsiACQAAkBBACgC6IACIgEoAhwiAkUNACACEFAgAUEANgIcQfYoQQAQOwtBACECAkAgASgCHCIDDQACQAJAIAEoAhgiAkUNACACKAIAQdP6qux4Rw0AIAIhBCACKAIIQauW8ZN7Rg0BC0EAIQQLAkAgBCIERQ0AQQMhAiAEKAIEDQELQQQhAgsgACACNgIMIAEgA0EARzoABiABQQQgAEEMakEEEJIGIAFBACgC4PsBQYCQA2o2AgwgASABLQAIQQFyOgAIIABBEGokAAuzAwEFfyMAQZABayIBJAAgASAANgIAQQAoAuiAAiECQd/OACABEDtBfyEDAkAgAEEfcQ0AAkAgAigCHCIDRQ0AIAMQUCACQQA2AhxB9ihBABA7C0EAIQMCQCACKAIcIgQNAAJAAkAgAigCGCIDRQ0AIAMoAgBB0/qq7HhHDQAgAyEFIAMoAghBq5bxk3tGDQELQQAhBQsCQCAFIgVFDQBBAyEDIAUoAgQNAQtBBCEDCyABIAM2AgwgAiAEQQBHOgAGIAJBBCABQQxqQQQQkgYgAkHaLSAAQYABahDBBSIDNgIYAkAgAw0AQX4hAwwBCwJAIAANAEEAIQMMAQsgASAANgIQIAFB0/qq7Hg2AgwgAyABQQxqQQgQwwUaEMQFGiACQYABNgIgQQAhAAJAIAIoAhwiAw0AAkACQCACKAIYIgBFDQAgACgCAEHT+qrseEcNACAAIQQgACgCCEGrlvGTe0YNAQtBACEECwJAIAQiBEUNAEEDIQAgBCgCBA0BC0EEIQALIAEgADYCjAEgAiADQQBHOgAGIAJBBCABQYwBakEEEJIGQQAhAwsgAUGQAWokACADC/0DAQV/IwBBoAFrIgIkAAJAAkBBACgC6IACIgMoAiAiBA0AQX8hAwwBCyADKAIYIQUCQCAADQAgAkEcakEAQYABEKMGGiACQauW8ZN7NgIkIAIgBUGAAWogBSgCBBD1BTYCKAJAIAUoAgQiAUGAAWoiACADKAIgIgRGDQAgAiABNgIEIAIgACAEazYCAEHU6QAgAhA7QX8hAwwCCyAFQQhqIAJBHGpBCGpB+AAQwwUaEMQFGkHcJ0EAEDsCQCADKAIcIgFFDQAgARBQIANBADYCHEH2KEEAEDsLQQAhAQJAIAMoAhwiBQ0AAkACQCADKAIYIgFFDQAgASgCAEHT+qrseEcNACABIQAgASgCCEGrlvGTe0YNAQtBACEACwJAIAAiAEUNAEEDIQEgACgCBA0BC0EEIQELIAIgATYCnAEgAyAFQQBHOgAGIANBBCACQZwBakEEEJIGIANBA0EAQQAQkgYgA0EAKALg+wE2AgxBACEDDAELIAUoAgRBgAFqIQYCQAJAAkAgAUEfcQ0AIAFB/x9LDQAgBCABaiAGTQ0BCyACIAY2AhggAiAENgIUIAIgATYCEEGX6AAgAkEQahA7QQAhAUF/IQUMAQsgBSAEaiAAIAEQwwUaIAMoAiAgAWohAUEAIQULIAMgATYCICAFIQMLIAJBoAFqJAAgAwuHAQECfwJAAkBBACgC6IACKAIYIgFFDQAgASgCAEHT+qrseEcNACABIQIgASgCCEGrlvGTe0YNAQtBACECCwJAIAIiAUUNABC9AyABQYABaiABKAIEEL4DIAAQvwNBAA8LIABCADcAACAAQRhqQgA3AAAgAEEQakIANwAAIABBCGpCADcAAEF/C+UFAQJ/IwBBIGsiAiQAAkACQAJAAkACQAJAAkACQAJAAkAgAS8BDiIDQYBdag4GAQIDBAcFAAsCQAJAIANBgH9qDgIAAQcLIAEoAhAQag0JIAEgAEEkakEIQQkQxgVB//8DcRDbBRoMCQsgAEE4aiABEM4FDQggAEEANgI0DAgLAkACQCAAKAIYIgMNAEEAIQAMAQsCQCADKAIAQdP6qux4Rg0AQQAhAAwBC0EAIQAgAygCCEGrlvGTe0cNACADKAIEIQALIAEgABDcBRoMBwsCQAJAIAAoAhgiAw0AQQAhAAwBCwJAIAMoAgBB0/qq7HhGDQBBACEADAELQQAhACADKAIIQauW8ZN7Rw0AIAMoAgwhAAsgASAAENwFGgwGCwJAAkBBACgC6IACKAIYIgBFDQAgACgCAEHT+qrseEcNACAAIQMgACgCCEGrlvGTe0YNAQtBACEDCwJAAkAgAyIARQ0AEL0DIABBgAFqIAAoAgQQvgMgAhC/AwwBCyACQRhqQgA3AwAgAkEQakIANwMAIAJCADcDCCACQgA3AwALIAEtAA0gAS8BDiACQSAQmgYaDAULIAFBhoC8EBDcBRoMBAsgAUHqJkEAELQFIgBBye4AIAAbEN0FGgwDCyADQYMiRg0BCwJAIAEvAQ5BhCNHDQAgAUHlNkEAELQFIgBBye4AIAAbEN0FGgwCCwJAAkAgACABQaTxABDgBUGAf2oOAgABAwsCQCAALQAGIgFFDQACQCAAKAIcDQAgAEEAOgAGIAAQZgwECyABDQMLIAAoAhxFDQJBuTRBABA7IAAQaAwCCyAALQAHRQ0BIABBACgC4PsBNgIMDAELQQAhAwJAIAAoAhwNAAJAAkAgACgCGCIARQ0AIAAoAgBB0/qq7HhHDQAgACEDIAAoAghBq5bxk3tGDQELQQAhAwsCQCADIgBFDQBBAyEDIAAoAgQNAQtBBCEDCyABIAMQ3AUaCyACQSBqJAALwwEBB38jAEEQayICJAACQCAAQVxqQQAoAuiAAiIDRw0AAkACQCADKAIgIgRFDQACQAJAIAEtAAwiBUEfcUUgBCAFaiADKAIYIgYoAgRBgAFqIgdNcSIIDQAgAiAHNgIIIAIgBDYCBCACIAU2AgBBl+gAIAIQO0EAIQQMAQsgBiAEaiABQRBqIAUQwwUaIAMoAiAgBWohBAsgAyAENgIgIAgNAQsgABDIBQsgAkEQaiQADwtBtjNBxcgAQbECQdMfEIMGAAs0AAJAIABBXGpBACgC6IACRw0AAkAgAQ0AQQBBABBrGgsPC0G2M0HFyABBuQJB9B8QgwYACyABAn9BACEAAkBBACgC6IACIgFFDQAgASgCHCEACyAAC8MBAQN/QQAoAuiAAiECQX8hAwJAIAEQag0AAkAgAQ0AQX4PC0EAIQMCQAJAA0AgACADIgNqIAEgA2siBEGAASAEQYABSRsiBBBrDQEgBCADaiIEIQMgBCABTw0CDAALAAtBfQ8LQXwhA0EAQQAQaw0AAkACQCACKAIYIgNFDQAgAygCAEHT+qrseEcNACADIQEgAygCCEGrlvGTe0YNAQtBACEBCwJAIAEiAw0AQXsPCyADQYABaiADKAIEEP8DIQMLIAMLlwICA38CfkGw8QAQ5gUhAEHaLUEAEMAFIQEgAEF/NgI0IAAgATYCGCAAQQE6AAcgAEEAKALg+wFBmbPGAGo2AgwCQEHA8QBBoAEQ/wMNAEEKIAAQnAVBACAANgLogAICQAJAIAAoAhgiAUUNACABKAIAQdP6qux4Rw0AIAEhAiABKAIIQauW8ZN7Rg0BC0EAIQILAkAgAiIBRQ0AIAFB7AFqKAIARQ0AIAEgAUHoAWooAgBqQYABaiIBEK0FDQACQCABKQMQIgNQDQAgACkDECIEUA0AIAQgA1ENAEGU2ABBABA7CyAAIAEpAxA3AxALAkAgACkDEEIAUg0AIABCATcDEAsPC0Hv3gBBxcgAQdQDQdQSEIMGAAsZAAJAIAAoAhwiAEUNACAAIAEgAiADEE4LCzcAQQAQ2AEQlQUQchBiEKgFAkBBnypBABCyBUUNAEHxHkEAEDsPC0HVHkEAEDsQiwVBsJkBEFcLgwkCCH8BfiMAQcAAayIDJAACQAJAAkAgAUEBaiAAKAIsIgQtAENHDQAgAyAEKQNYIgs3AzggAyALNwMgAkACQCAEIANBIGogBEHYAGoiBSADQTRqEIwDIgZBf0oNACADIAMpAzg3AwggAyAEIANBCGoQuQM2AgAgA0EoaiAEQaQ/IAMQ2QNBfyEEDAELAkAgBkHQhgNIDQAgBkGw+XxqIgZBAC8ByO4BTg0DIAEhAQJAIAJFDQACQCACLwEIIgFBEEkNACADQShqIARB3ggQ3ANBfSEEDAMLIAQgAUEBajoAQyAEQeAAaiACKAIMIAFBA3QQoQYaIAEhAQsCQEGQ/wAgBkEDdGoiAi0AAiIHIAEiAU0NACAEIAFBA3RqQeAAakEAIAcgAWtBA3QQowYaCyACLQADIgFBAXENBCAAQgA3AyACQCABQQhxRQ0AIAMgBSkDADcDEAJAAkAgBCADQRBqEPMDIgANAEEAIQAMAQsgAC0AA0EPcSEACwJAIABBfGoOBgEAAAAAAQALIANBKGogBEEIIARBABCQARDrAyAEIAMpAyg3A1gLIARBkP8AIAZBA3RqKAIEEQAAQQAhBAwBCwJAIAAtABEiB0HlAEkNACAEQebUAxB2QX0hBAwBCyAAIAdBAWo6ABECQCAEQQggBCgA5AEiByAHKAIgaiAGQQR0aiIGLwEIQQN0IAYtAA5BAXRqQRhqEIkBIgcNAEF+IQQMAQsgByAGKAIAIgg7AQQgByADKAI0NgIIIAcgCCAGKAIEaiIJOwEGIAAoAighCCAHIAY2AhAgByAINgIMAkACQCAIRQ0AIAAgBzYCKCAAKAIsIgAtAEYNASAAIAc2AugBIAlB//8DcQ0BQYLcAEHJxwBBFUGiMxCDBgALIAAgBzYCKAsgB0EYaiEJIAYtAAohAAJAAkAgBi0AC0EBcQ0AIAAhACAJIQUMAQsgByAFKQMANwMYIABBf2ohACAHQSBqIQULIAUhCiAAIQUCQAJAIAJFDQAgAigCDCEHIAIvAQghAAwBCyAEQeAAaiEHIAEhAAsgACEAIAchAQJAAkAgBi0AC0EEcUUNACAKIAEgBUF/aiIFIAAgBSAASRsiB0EDdBChBiEKAkACQCACRQ0AIAQgAkEAQQAgB2sQ+AIaIAIhAAwBCwJAIAQgACAHayICEJIBIgBFDQAgACgCDCABIAdBA3RqIAJBA3QQoQYaCyAAIQALIANBKGogBEEIIAAQ6wMgCiAFQQN0aiADKQMoNwMADAELIAogASAFIAAgBSAASRtBA3QQoQYaCwJAIAYtAAtBAnFFDQAgCSkAAEIAUg0AIAMgAykDODcDGCADQShqIARBCCAEIAQgA0EYahCXAxCQARDrAyAJIAMpAyg3AwALAkAgBC0AR0UNACAEKAKsAiAIRw0AIAQtAAdBBHFFDQAgBEEIEIYEC0EAIQQLIANBwABqJAAgBA8LQZ7FAEHJxwBBH0HhJRCDBgALQfcWQcnHAEEuQeElEIMGAAtBoOoAQcnHAEE+QeElEIMGAAvYBAEIfyMAQSBrIgIkAAJAIAAvAQgNACABQeDUAyABGyEDAkACQCAAKALoASIEDQBBACEEDAELIAQvAQQhBAsgACAEIgQ7AQoCQAJAAkACQAJAAkACQCADQaCrfGoOBwABBQUCBAMFC0GIPUEAEDsMBQtBzyJBABA7DAQLQZMIQQAQOwwDC0GZDEEAEDsMAgtBvyVBABA7DAELIAIgAzYCECACIARB//8DcTYCFEHd6AAgAkEQahA7CyAAIAM7AQgCQAJAIANBoKt8ag4GAQAAAAABAAsgACgC6AEiBEUNACAEIQRBHiEFA0AgBSEGIAQiBCgCECEFIAAoAOQBIgcoAiAhCCACIAAoAOQBNgIYIAUgByAIamsiCEEEdSEFAkACQCAIQfHpMEkNAEHazgAhByAFQbD5fGoiCEEALwHI7gFPDQFBkP8AIAhBA3RqLwEAEIoEIQcMAQtBrtkAIQcgAigCGCIJQSRqKAIAQQR2IAVNDQAgCSAJKAIgaiAIai8BDCEHIAIgAigCGDYCDCACQQxqIAdBABCMBCIHQa7ZACAHGyEHCyAELwEEIQggBCgCECgCACEJIAIgBTYCBCACIAc2AgAgAiAIIAlrNgIIQavpACACEDsCQCAGQX9KDQBByOIAQQAQOwwCCyAEKAIMIgchBCAGQX9qIQUgBw0ACwsgAEEFOgBGIAEQJiADQeDUA0YNACAAEFgLAkAgACgC6AEiBEUNACAALQAGQQhxDQAgAiAELwEEOwEYIABBxwAgAkEYakECEEwLIABCADcD6AEgAkEgaiQACwkAIAAgATYCGAuFAQECfyMAQRBrIgIkAAJAAkAgAUF/Rw0AQQAhAQwBC0F/IAAoAiwoAoACIgMgAWoiASABIANJGyEBCyAAIAE2AhgCQCAAKAIsIgAoAugBIgFFDQAgAC0ABkEIcQ0AIAIgAS8BBDsBDiAAQccAIAJBDmpBAhBMCyAAQgA3A+gBIAJBEGokAAv2AgEEfyMAQRBrIgIkACAAKAIsIQMCQAJAAkACQCABKAIMRQ0AAkAgACkAIEIAUg0AIAEoAhAtAAtBAnFFDQAgACABKQMYNwMgCyAAIAEoAgwiBDYCKAJAIAMtAEYNACADIAQ2AugBIAQvAQZFDQMLIAAgAC0AEUF/ajoAESABQQA2AgwgAUEAOwEGDAELAkAgAC0AECIEQRBxRQ0AIAAgBEHvAXE6ABAgASABKAIQKAIAOwEEDAELAkAgAygC6AEiAUUNACADLQAGQQhxDQAgAiABLwEEOwEOIANBxwAgAkEOakECEEwLIANCADcD6AEgABDTAgJAAkAgACgCLCIFKALwASIBIABHDQAgBUHwAWohAQwBCyABIQMDQCADIgFFDQQgASgCACIEIQMgASEBIAQgAEcNAAsLIAEgACgCADYCACAFIAAQUgsgAkEQaiQADwtBgtwAQcnHAEEVQaIzEIMGAAtBv9YAQcnHAEHHAUGmIRCDBgALPwECfwJAIAAoAvABIgFFDQAgASEBA0AgACABIgEoAgA2AvABIAEQ0wIgACABEFIgACgC8AEiAiEBIAINAAsLC6EBAQN/IwBBEGsiAiQAAkACQCABQdCGA0kNAEHazgAhAyABQbD5fGoiAUEALwHI7gFPDQFBkP8AIAFBA3RqLwEAEIoEIQMMAQtBrtkAIQMgACgCACIEQSRqKAIAQQR2IAFNDQAgBCAEKAIgaiABQQR0ai8BDCEBIAIgACgCADYCDCACQQxqIAFBABCMBCIBQa7ZACABGyEDCyACQRBqJAAgAwssAQF/IABB8AFqIQICQANAIAIoAgAiAEUNASAAIQIgACgCHCABRw0ACwsgAAv6AgIEfwF+IwBBIGsiAyQAQQAhBAJAIAAvAQgNACADIAApA1giBzcDACADIAc3AwgCQAJAIAAgAyADQRBqIANBHGoQjAMiBUEATg0AQQAhBgwBCwJAIAVB0IYDSA0AIANBCGogAEGIJkEAENkDQQAhBgwBCwJAIAJBAUYNACAAQfABaiEGA0AgBigCACIERQ0BIAQhBiAFIAQvARZHDQALIARFDQAgBCEGAkACQAJAIAJBfmoOAwQAAgELIAQgBC0AEEEQcjoAECAEIQYMAwtByccAQasCQaYPEP4FAAsgBBB+C0EAIQYgAEE4EIoBIgJFDQAgAiAFOwEWIAIgADYCLCAAIAAoAowCQQFqIgQ2AowCIAIgBDYCHAJAAkAgACgC8AEiBA0AIABB8AFqIQYMAQsgBCEEA0AgBCIGKAIAIgUhBCAGIQYgBQ0ACwsgBiACNgIAIAIgAUEAEHUaIAIgACkDgAI+AhggAiEGCyAGIQQLIANBIGokACAEC84BAQV/IwBBEGsiASQAAkAgACgCLCICKALsASAARw0AAkAgAigC6AEiA0UNACACLQAGQQhxDQAgASADLwEEOwEOIAJBxwAgAUEOakECEEwLIAJCADcD6AELIAAQ0wICQAJAAkAgACgCLCIEKALwASICIABHDQAgBEHwAWohAgwBCyACIQMDQCADIgJFDQIgAigCACIFIQMgAiECIAUgAEcNAAsLIAIgACgCADYCACAEIAAQUiABQRBqJAAPC0G/1gBByccAQccBQaYhEIMGAAvhAQEEfyMAQRBrIgEkAAJAAkAgACgCLCICLQBGDQAQ6AUgAkEAKQOIkQI3A4ACIAAQ2QJFDQAgABDTAiAAQQA2AhggAEH//wM7ARIgAiAANgLsASAAKAIoIQMCQCAAKAIsIgQtAEYNACAEIAM2AugBIAMvAQZFDQILAkAgAi0ABkEIcQ0AIAEgAy8BBDsBDiACQcYAIAFBDmpBAhBMCwJAIAAoAjAiA0UNACAAKAI0IQQgAEIANwMwIAIgBCADEQIACyACEIgECyABQRBqJAAPC0GC3ABByccAQRVBojMQgwYACxIAEOgFIABBACkDiJECNwOAAgseACABIAJB5AAgAkHkAEsbQeDUA2oQdiAAQgA3AwALigECAX4EfxDoBSAAQQApA4iRAiIBNwOAAgJAIAAoAvABIgANAEGgjQYPCyABpyECIAAhA0HkACEAA0AgACEAAkACQCADIgMoAhgiBA0AIAAhAAwBCyAEIAJrIgRBACAEQQBKGyIEIAAgBCAASBshAAsgAygCACIEIQMgACIFIQAgBA0ACyAFQegHbAu6AgEGfyMAQRBrIgEkABDoBSAAQQApA4iRAjcDgAICQCAALQBGDQADQAJAAkAgACgC8AEiAg0AQQAhAwwBCyAAKQOAAqchBCACIQJBACEFA0AgBSEFAkAgAiICLQAQIgNBIHFFDQAgAiEDDAILAkAgA0EPcUEFRw0AIAIoAggtAABFDQAgAiEDDAILAkACQCACKAIYIgZBf2ogBEkNACAFIQMMAQsCQCAFRQ0AIAUhAyAFKAIYIAZNDQELIAIhAwsgAigCACIGIQIgAyIDIQUgAyEDIAYNAAsLIAMiAkUNASAAEN8CIAIQfyAALQBGRQ0ACwsCQCAAKAKYAkGAKGogACgCgAIiAk8NACAAIAI2ApgCIAAoApQCIgJFDQAgASACNgIAQY8/IAEQOyAAQQA2ApQCCyABQRBqJAAL+QEBA38CQAJAAkACQCACQYgBTQ0AIAEgASACakF8cUF8aiIDNgIEIAAgACgCDCACQQR2ajYCDCABQQA2AgAgACgCBCICRQ0BIAIhAgNAIAIiBCABTw0DIAQoAgAiBSECIAUNAAsgBCABNgIADAMLQdHZAEHvzQBB3ABBvSoQgwYACyAAIAE2AgQMAQtBrS1B780AQegAQb0qEIMGAAsgA0GBgID4BDYCACABIAEoAgQgAUEIaiIEayICQQJ1QYCAgAhyNgIIAkAgAkEETQ0AIAFBEGpBNyACQXhqEKMGGiAAIAQQhQEPC0Hn2gBB780AQdAAQc8qEIMGAAvqAgEEfyMAQdAAayICJAACQAJAAkACQCABRQ0AIAFBA3ENACAAKAIEIgBFDQMgAEUhAyAAIQQCQANAIAMhAwJAIAQiAEEIaiABSw0AIAAoAgQiBCABTQ0AIAEoAgAiBUH///8HcSIARQ0EIAEgAEECdGogBEsNBSAFQYCAgPgAcQ0CIAIgBTYCMEGpJCACQTBqEDsgAiABNgIkIAJB2yA2AiBBzSMgAkEgahA7Qe/NAEH4BUHwHBD+BQALIAAoAgAiAEUhAyAAIQQgAA0ADAULAAsgA0EBcQ0DIAJB0ABqJAAPCyACIAE2AkQgAkGJMzYCQEHNIyACQcAAahA7Qe/NAEH4BUHwHBD+BQALQefbAEHvzQBBiQJBhzEQgwYACyACIAE2AhQgAkGcMjYCEEHNIyACQRBqEDtB780AQfgFQfAcEP4FAAsgAiABNgIEIAJBySo2AgBBzSMgAhA7Qe/NAEH4BUHwHBD+BQAL4QQBCH8jAEEQayIDJAACQAJAIAJBgMADTQ0AQQAhBAwBCwJAAkACQAJAECENAAJAIAFBgAJPDQAgACAAKAIIQQFqIgQ2AggCQAJAIARBIEkNACAEQR9xDQELEB4LEOUCQQFxRQ0CIAAoAgQiBEUNAyAEIQQDQAJAIAQiBSgCCCIGQRh2IgRBzwBGDQAgBSgCBCEHIAQhBCAGIQYgBUEIaiEIAkACQAJAAkADQCAGIQkgBCEEIAgiCCAHTw0BAkAgBEEBRw0AIAlB////B3EiBkUNA0EAIQQgBkECdEF4aiIKRQ0AA0AgCCAEIgRqQQhqLQAAIgZBN0cNBSAEQQFqIgYhBCAGIApHDQALCyAJQf///wdxIgRFDQQgCCAEQQJ0aiIIKAIAIgZBGHYiCiEEIAYhBiAIIQggCkHPAEYNBQwACwALQd87Qe/NAEHiAkGuIxCDBgALQefbAEHvzQBBiQJBhzEQgwYACyADIAY2AgggAyAINgIAIAMgBEEEajYCBEHkCSADEDtB780AQeoCQa4jEP4FAAtB59sAQe/NAEGJAkGHMRCDBgALIAUoAgAiBiEEIAZFDQQMAAsAC0GLMEHvzQBBoQNB2ioQgwYAC0HX6wBB780AQZoDQdoqEIMGAAsgACgCECAAKAIMTQ0BCyAAEIcBCyAAIAAoAhAgAkEDakECdiIEQQIgBEECSxsiBGo2AhAgACABIAQQiAEiCCEGAkAgCA0AIAAQhwEgACABIAQQiAEhBgtBACEEIAYiBkUNACAGQQRqQQAgAkF8ahCjBhogBiEECyADQRBqJAAgBAujCgEKfwJAIAAoAhQiAUUNAAJAIAEoAuQBLwEMIgJFDQAgASgCACEDQQAhBANAAkAgAyAEIgRBA3RqIgUoAARBiIDA/wdxQQhHDQAgASAFKAAAQQoQngELIARBAWoiBSEEIAUgAkcNAAsLAkAgAS0AQyICRQ0AIAFB2ABqIQNBACEEA0ACQCADIAQiBEEDdGoiBSgABEGIgMD/B3FBCEcNACABIAUoAABBChCeAQsgBEEBaiIFIQQgBSACRw0ACwsCQCABLQBERQ0AQQAhBANAIAEgASgC+AEgBCIEQQJ0aigCAEEKEJ4BIARBAWoiBSEEIAUgAS0AREkNAAsLAkAgAS8BTEUNAEEAIQQDQAJAIAEoAvQBIAQiBUECdGooAgAiBEUNAAJAIAQoAARBiIDA/wdxQQhHDQAgASAEKAAAQQoQngELIAEgBCgCDEEKEJ4BCyAFQQFqIgUhBCAFIAEvAUxJDQALCwJAIAEtAEpFDQBBACEEA0ACQCABKAKoAiAEIgRBGGxqIgUoAARBiIDA/wdxQQhHDQAgASAFKAAAQQoQngELIARBAWoiBSEEIAUgAS0ASkkNAAsLIAEgASgC2AFBChCeASABIAEoAtwBQQoQngEgASABKALgAUEKEJ4BAkAgASgAPEGIgMD/B3FBCEcNACABIAEoADhBChCeAQsCQCABKAA0QYiAwP8HcUEIRw0AIAEgASgAMEEKEJ4BCyABKALwASIERQ0AIAQhBANAAkAgBCICKAAkQYiAwP8HcUEIRw0AIAEgAigAIEEKEJ4BCyACKAIoIgUhBAJAIAVFDQADQCABIAQiBEEKEJ4BIAQoAgwiBSEEIAUNAAsLIAIoAgAiBSEEIAUNAAsLIABBADYCECAAQQA2AgBBACEFQQAhBANAIAQhBiAFIQUCQAJAIAAoAgQiBA0AQQAhAyAFIQcMAQsgBCEEIAUhAUEAIQUDQCAEIghBCGohBCAFIQUgASEBAkACQAJAAkACQAJAA0AgASEDIAUhCQJAAkACQCAEIgQoAgAiB0GAgIB4cUGAgID4BEYiCg0AIAQgCCgCBE8NBAJAAkAgB0EASA0AIAdBgICAgAZxIgJBgICAgARHDQELIAYNBiAAKAIUIARBChCeAUEBIQUMAgsgBkUNACAHIQEgBCEFAkAgAg0AA0AgBSEFIAFB////B3EiAUUNCCAFIAFBAnRqIgUoAgAiAiEBIAUhBSACQYCAgIAGcUUNAAsLAkAgBSIFIARGDQAgBCAFIARrIgVBAnVBgICACHI2AgAgBUEETQ0IIARBCGpBNyAFQXhqEKMGGiAAIAQQhQEgA0EEaiAAIAMbIAQ2AgAgBEEANgIEIAkhBSAEIQEMAwsgBCAHQf////99cTYCAAsgCSEFCyADIQELIAEhASAFIQUgCg0GIAQoAgBB////B3EiAkUNBSAEIAJBAnRqIQQgBSEFIAEhAQwACwALQd87Qe/NAEGtAkH/IhCDBgALQf4iQe/NAEG1AkH/IhCDBgALQefbAEHvzQBBiQJBhzEQgwYAC0Hn2gBB780AQdAAQc8qEIMGAAtB59sAQe/NAEGJAkGHMRCDBgALIAUhAyABIQcgCCgCACICIQQgASEBIAUhBSACDQALCyAHIQUgAyEBAkACQCAGDQBBACEEIAENASAAKAIUIgRFDQAgBCgCrAIiAUUNACABQQNqLQAAQeAAcQ0AIARBADYCrAILQQEhBAsgBSEFIAQhBCAGRQ0ACwvWAwEJfwJAIAAoAgAiAw0AQQAPCyACQQJ0QXhqIQQgAUEYdCIFIAJyIQYgAUEBRyEHIAMhA0EAIQECQAJAAkACQAJAAkADQCABIQggCSEJIAMiASgCAEH///8HcSIDRQ0CIAkhCQJAIAMgAmsiCkEASCILDQACQAJAIApBA0gNACABIAY2AgACQCAHDQAgAkEBTQ0HIAFBCGpBNyAEEKMGGgsgACABEIUBIAEoAgBB////B3EiA0UNByABKAIEIQkgASADQQJ0aiIDIApBgICACHI2AgAgAyAJNgIEIApBAU0NCCADQQhqQTcgCkECdEF4ahCjBhogACADEIUBIAMhAwwBCyABIAMgBXI2AgACQCAHDQAgA0EBTQ0JIAFBCGpBNyADQQJ0QXhqEKMGGgsgACABEIUBIAEoAgQhAwsgCEEEaiAAIAgbIAM2AgAgASEJCyAJIQkgC0UNASABKAIEIgohAyAJIQkgASEBIAoNAAtBAA8LIAkPC0Hn2wBB780AQYkCQYcxEIMGAAtB59oAQe/NAEHQAEHPKhCDBgALQefbAEHvzQBBiQJBhzEQgwYAC0Hn2gBB780AQdAAQc8qEIMGAAtB59oAQe/NAEHQAEHPKhCDBgALHgACQCAAKAKgAiABIAIQhgEiAQ0AIAAgAhBRCyABCy4BAX8CQCAAKAKgAkHCACABQQRqIgIQhgEiAQ0AIAAgAhBRCyABQQRqQQAgARsLjwEBAX8CQAJAAkACQCABRQ0AIAFBA3ENASABQXxqIgEoAgAiAkGAgIB4cUGAgICQBEcNAiACQf///wdxIgJFDQMgASACQYCAgBByNgIAIAAgARCFAQsPC0Gm4QBB780AQdYDQYonEIMGAAtB5uoAQe/NAEHYA0GKJxCDBgALQefbAEHvzQBBiQJBhzEQgwYAC74BAQJ/AkACQAJAAkACQCABRQ0AIAFBA3ENASABQXxqIgIoAgAiA0GAgIB4cUGAgICQBEcNAiADQf///wdxIgNFDQMgAiADQYCAgAhyNgIAIANBAUYNBCABQQRqQTcgA0ECdEF4ahCjBhogACACEIUBCw8LQabhAEHvzQBB1gNBiicQgwYAC0Hm6gBB780AQdgDQYonEIMGAAtB59sAQe/NAEGJAkGHMRCDBgALQefaAEHvzQBB0ABBzyoQgwYAC2QBAn8CQCABKAIEIgJBgIDA/wdxRQ0AQQAPC0EAIQMCQAJAIAJBCHFFDQAgASgCACgCACIBQYCAgPAAcUUNASABQYCAgIAEcUEediEDCyADDwtB9tMAQe/NAEHuA0HXPhCDBgALeQEBfwJAAkACQCABKAIEIgJBgIDA/wdxDQAgAkEIcUUNACABKAIAIgIoAgAiAUGAgICABHENASABQYCAgPAAcUUNAiACIAFBgICAgARyNgIACw8LQYLeAEHvzQBB9wNBkCcQgwYAC0H20wBB780AQfgDQZAnEIMGAAt6AQF/AkACQAJAIAEoAgQiAkGAgMD/B3ENACACQQhxRQ0AIAEoAgAiAigCACIBQYCAgIAEcUUNASABQYCAgPAAcUUNAiACIAFB/////3txNgIACw8LQf7hAEHvzQBBgQRB/yYQgwYAC0H20wBB780AQYIEQf8mEIMGAAsqAQF/AkAgACgCoAJBBEEQEIYBIgINACAAQRAQUSACDwsgAiABNgIEIAILIAEBfwJAIAAoAqACQQpBEBCGASIBDQAgAEEQEFELIAEL7gIBBH8jAEEQayICJAACQAJAAkACQAJAAkAgAUGAwANLDQAgAUEDdCIDQYHAA0kNAQsgAkEIaiAAQQ8Q3wNBACEBDAELAkAgACgCoAJBwwBBEBCGASIEDQAgAEEQEFFBACEBDAELAkAgAUUNAAJAIAAoAqACQcIAIANBBHIiBRCGASIDDQAgACAFEFELIAQgA0EEakEAIAMbIgU2AgwCQCADDQAgBCAEKAIAQYCAgIAEczYCAEEAIQEMAgsgBUEDcQ0CIAVBfGoiAygCACIFQYCAgHhxQYCAgJAERw0DIAVB////B3EiBUUNBCAAKAKgAiEAIAMgBUGAgIAQcjYCACAAIAMQhQEgBCABOwEIIAQgATsBCgsgBCAEKAIAQYCAgIAEczYCACAEIQELIAJBEGokACABDwtBpuEAQe/NAEHWA0GKJxCDBgALQebqAEHvzQBB2ANBiicQgwYAC0Hn2wBB780AQYkCQYcxEIMGAAt4AQN/IwBBEGsiAyQAAkACQCACQYHAA0kNACADQQhqIABBEhDfA0EAIQIMAQsCQAJAIAAoAqACQQUgAkEMaiIEEIYBIgUNACAAIAQQUQwBCyAFIAI7AQQgAUUNACAFQQxqIAEgAhChBhoLIAUhAgsgA0EQaiQAIAILZgEDfyMAQRBrIgIkAAJAAkAgAUGBwANJDQAgAkEIaiAAQRIQ3wNBACEBDAELAkACQCAAKAKgAkEFIAFBDGoiAxCGASIEDQAgACADEFEMAQsgBCABOwEECyAEIQELIAJBEGokACABC2cBA38jAEEQayICJAACQAJAIAFBgcADSQ0AIAJBCGogAEHCABDfA0EAIQEMAQsCQAJAIAAoAqACQQYgAUEJaiIDEIYBIgQNACAAIAMQUQwBCyAEIAE7AQQLIAQhAQsgAkEQaiQAIAELrwMBA38jAEEQayIEJAACQAJAAkACQAJAIAJBMUsNACADIAJHDQACQAJAIAAoAqACQQYgAkEJaiIFEIYBIgMNACAAIAUQUQwBCyADIAI7AQQLIARBCGogAEEIIAMQ6wMgASAEKQMINwMAIANBBmpBACADGyECDAELAkACQCACQYHAA0kNACAEQQhqIABBwgAQ3wNBACECDAELIAIgA0kNAgJAAkAgACgCoAJBDCACIANBA3ZB/v///wFxakEJaiIGEIYBIgUNACAAIAYQUQwBCyAFIAI7AQQgBUEGaiADOwEACyAFIQILIARBCGogAEEIIAIiAhDrAyABIAQpAwg3AwACQCACDQBBACECDAELIAIgAkEGai8BAEEDdkH+P3FqQQhqIQILIAIhAgJAIAEoAARBiIDA/wdxQQhHDQAgASgAACIAKAIAIgFBgICAgARxDQIgAUGAgIDwAHFFDQMgACABQYCAgIAEcjYCAAsgBEEQaiQAIAIPC0GaLEHvzQBBzQRBlcQAEIMGAAtBgt4AQe/NAEH3A0GQJxCDBgALQfbTAEHvzQBB+ANBkCcQgwYAC/gCAQN/IwBBEGsiBCQAIAQgASkDADcDCAJAAkAgACAEQQhqEPMDIgUNAEEAIQYMAQsgBS0AA0EPcSEGCwJAAkACQAJAAkACQAJAAkACQCAGQXpqDgcAAgICAgIBAgsgBS8BBCACRw0DAkAgAkExSw0AIAIgA0YNAwtB7NcAQe/NAEHvBEHnLBCDBgALIAUvAQQgAkcNAyAFQQZqLwEAIANHDQQgACAFEOYDQX9KDQFBotwAQe/NAEH1BEHnLBCDBgALQe/NAEH3BEHnLBD+BQALAkAgASgABEGIgMD/B3FBCEcNACABKAAAIgEoAgAiBUGAgICABHFFDQQgBUGAgIDwAHFFDQUgASAFQf////97cTYCAAsgBEEQaiQADwtBwStB780AQe4EQecsEIMGAAtB9zFB780AQfIEQecsEIMGAAtB7itB780AQfMEQecsEIMGAAtB/uEAQe/NAEGBBEH/JhCDBgALQfbTAEHvzQBBggRB/yYQgwYAC7ACAQV/IwBBEGsiAyQAAkACQAJAIAEgAiADQQRqQQBBABDnAyIEIAJHDQAgAkExSw0AIAMoAgQgAkcNAAJAAkAgACgCoAJBBiACQQlqIgUQhgEiBA0AIAAgBRBRDAELIAQgAjsBBAsCQCAEDQAgBCECDAILIARBBmogASACEKEGGiAEIQIMAQsCQAJAIARBgcADSQ0AIANBCGogAEHCABDfA0EAIQQMAQsgBCADKAIEIgZJDQICQAJAIAAoAqACQQwgBCAGQQN2Qf7///8BcWpBCWoiBxCGASIFDQAgACAHEFEMAQsgBSAEOwEEIAVBBmogBjsBAAsgBSEECyABIAJBACAEIgRBBGpBAxDnAxogBCECCyADQRBqJAAgAg8LQZosQe/NAEHNBEGVxAAQgwYACwkAIAAgATYCFAsaAQF/QZiABBAfIgAgAEEYakGAgAQQhAEgAAsNACAAQQA2AgQgABAgCw0AIAAoAqACIAEQhQEL/AYBEX8jAEEgayIDJAAgAEHkAWohBCACIAFqIQUgAUF/RyEGQQAhAiAAKAKgAkEEaiEHQQAhCEEAIQlBACEKQQAhCwJAAkADQCAMIQAgCyENIAohDiAJIQ8gCCEQIAIhAgJAIAcoAgAiEQ0AIAIhEiAQIRAgDyEPIA4hDiANIQ0gACEADAILIAIhEiARQQhqIQIgECEQIA8hDyAOIQ4gDSENIAAhAANAIAAhCCANIQAgDiEOIA8hDyAQIRAgEiENAkACQAJAAkAgAiICKAIAIgdBGHYiEkHPAEYiE0UNACANIRJBBSEHDAELAkACQCACIBEoAgRPDQACQCAGDQAgB0H///8HcSIHRQ0CIA5BAWohCSAHQQJ0IQ4CQAJAIBJBAUcNACAOIA0gDiANShshEkEHIQcgDiAQaiEQIA8hDwwBCyANIRJBByEHIBAhECAOIA9qIQ8LIAkhDiAAIQ0MBAsCQCASQQhGDQAgDSESQQchBwwDCyAAQQFqIQkCQAJAIAAgAU4NACANIRJBByEHDAELAkAgACAFSA0AIA0hEkEBIQcgECEQIA8hDyAOIQ4gCSENIAkhAAwGCyACKAIQIRIgBCgCACIAKAIgIQcgAyAANgIcIANBHGogEiAAIAdqa0EEdSIAEHshEiACLwEEIQcgAigCECgCACEKIAMgADYCFCADIBI2AhAgAyAHIAprNgIYQcDpACADQRBqEDsgDSESQQAhBwsgECEQIA8hDyAOIQ4gCSENDAMLQd87Qe/NAEGiBkGfIxCDBgALQefbAEHvzQBBiQJBhzEQgwYACyAQIRAgDyEPIA4hDiAAIQ0LIAghAAsgACEAIA0hDSAOIQ4gDyEPIBAhECASIRICQAJAIAcOCAABAQEBAQEAAQsgAigCAEH///8HcSIHRQ0EIBIhEiACIAdBAnRqIQIgECEQIA8hDyAOIQ4gDSENIAAhAAwBCwsgEiECIBEhByAQIQggDyEJIA4hCiANIQsgACEMIBIhEiAQIRAgDyEPIA4hDiANIQ0gACEAIBMNAAsLIA0hDSAOIQ4gDyEPIBAhECASIRIgACECAkAgEQ0AAkAgAUF/Rw0AIAMgEjYCDCADIBA2AgggAyAPNgIEIAMgDjYCAEHb5gAgAxA7CyANIQILIANBIGokACACDwtB59sAQe/NAEGJAkGHMRCDBgAL0AcBCH8jAEEQayIDJAAgAkF/aiEEIAEhAQJAA0AgASIFRQ0BAkACQCAFKAIAIgFBgICAgAJxDQAgAUEYdkEPcSIGQQFGDQACQCACQQFKDQAgBSABQYCAgIB4cjYCAAwBCyAFIAFB/////wVxQYCAgIACcjYCAEEAIQcCQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAGQX5qDg4MAgEHDAQFAQEDDAAGDAYLIAAgBSgCECAEEJ4BIAUoAhQhBwwLCyAFIQcMCgsCQCAFKAIMIghFDQAgCEEDcQ0GIAhBfGoiBygCACIBQYCAgIAGcQ0HIAFBgICA+ABxQYCAgBBHDQggBS8BCCEJIAcgAUGAgICAAnI2AgBBACEBIAlFDQADQAJAIAggASIBQQN0aiIHKAAEQYiAwP8HcUEIRw0AIAAgBygAACAEEJ4BCyABQQFqIgchASAHIAlHDQALCyAFKAIEIQcMCQsgACAFKAIcIAQQngEgBSgCGCEHDAgLAkAgBSgADEGIgMD/B3FBCEcNACAAIAUoAAggBBCeAQtBACEHIAUoABRBiIDA/wdxQQhHDQcgACAFKAAQIAQQngFBACEHDAcLIAAgBSgCCCAEEJ4BIAUoAhAvAQgiCEUNBSAFQRhqIQlBACEBA0ACQCAJIAEiAUEDdGoiBygABEGIgMD/B3FBCEcNACAAIAcoAAAgBBCeAQsgAUEBaiIHIQEgByAIRw0AC0EAIQcMBgsgAyAFNgIEIAMgATYCAEGTJCADEDtB780AQcoBQewqEP4FAAsgBSgCCCEHDAQLQabhAEHvzQBBgwFB+RwQgwYAC0Gu4ABB780AQYUBQfkcEIMGAAtBpNQAQe/NAEGGAUH5HBCDBgALQQAhBwsCQCAHIgkNACAFIQFBACEGDAILAkACQAJAAkAgCSgCDCIHRQ0AIAdBA3ENASAHQXxqIgooAgAiAUGAgICABnENAiABQYCAgPgAcUGAgIAQRw0DIAkvAQghCCAKIAFBgICAgAJyNgIAIAhFDQAgCCAGQQpHdCIBQQEgAUEBSxshCEEAIQEDQAJAIAcgASIBQQN0aiIGKAAEQYiAwP8HcUEIRw0AIAAgBigAACAEEJ4BCyABQQFqIgYhASAGIAhHDQALCyAFIQFBACEGIAAgCSgCBBD2AkUNBCAJKAIEIQFBASEGDAQLQabhAEHvzQBBgwFB+RwQgwYAC0Gu4ABB780AQYUBQfkcEIMGAAtBpNQAQe/NAEGGAUH5HBCDBgALIAUhAUEAIQYLIAEhASAGDQALCyADQRBqJAALVAEBfyMAQRBrIgMkACADIAIpAwA3AwgCQAJAIAEgA0EIahD0Aw0AIAMgAikDADcDACAAIAFBDyADEN0DDAELIAAgAigCAC8BCBDpAwsgA0EQaiQAC4EBAgJ/AX4jAEEgayIBJAAgASAAKQNYIgM3AwggASADNwMYAkACQCAAIAFBCGoQ9ANFDQAgASgCGCECDAELIAEgASkDGDcDACABQRBqIABBDyABEN0DQQAhAgsCQCACIgJFDQAgACACIABBABCiAyAAQQEQogMQ+AIaCyABQSBqJAALOQIBfwF+IwBBEGsiASQAIAEgAEHgAGopAwAiAjcDACABIAI3AwggACAAIAEQ9AMQpwMgAUEQaiQAC7QCAgZ/AX4jAEEwayIBJAAgAC0AQyICQX9qIQNBACEEQQAhBQJAAkAgAkECSQ0AIAEgAEHgAGopAwA3AygCQAJAIANBAUcNACABIAEpAyg3AxggAUEYahDGA0UNAAJAIAEoAixBf0YNACABQSBqIABBhSxBABDbA0EAIgUhBCAFIQZBACEFDAILIAEgASkDKDcDEEEAIQRBASEGIAAgAUEQahDtAyEFDAELQQEhBEEBIQYgAyEFCyAEIQQgBSEFIAZFDQELIAQhBCAAIAUQkgEiBUUNACAAIAUQqAMgBEEBcyACQQJJcg0AQQAhBANAIAEgACAEIgRBAWoiAkEDdGpB2ABqKQMAIgc3AwggASAHNwMoIAAgBSAEIAFBCGoQnwMgAiEEIAIgA0cNAAsLIAFBMGokAAvUAQIFfwF+IwBBMGsiASQAIAEgACkDWCIGNwMYIAEgBjcDKAJAAkAgACABQRhqEPQDRQ0AIAEoAighAgwBCyABIAEpAyg3AxAgAUEgaiAAQQ8gAUEQahDdA0EAIQILAkAgAiIDRQ0AAkAgAC0AQ0ECSQ0AQQAhBANAIAMvAQghBSABIAAgBEEBaiICQQN0akHYAGopAwAiBjcDCCABIAY3AyggACADIAUgAUEIahCfAyACIQQgAiAALQBDQX9qSA0ACwsgACADLwEIEKYDCyABQTBqJAALiQICBX8BfiMAQcAAayIBJAAgASAAKQNYIgY3AyggASAGNwM4AkACQCAAIAFBKGoQ9ANFDQAgASgCOCECDAELIAEgASkDODcDICABQTBqIABBDyABQSBqEN0DQQAhAgsCQCACIgJFDQAgASAAQeAAaikDACIGNwMYIAEgBjcDOAJAIAAgAUEYahD0Aw0AIAEgASkDODcDECABQTBqIABBDyABQRBqEN0DDAELIAEgASkDODcDCAJAIAAgAUEIahDzAyIDLwEIIgRFDQAgACACIAIvAQgiBSAEEPgCDQAgAigCDCAFQQN0aiADKAIMIARBA3QQoQYaCyAAIAIvAQgQpgMLIAFBwABqJAALjgICBn8BfiMAQSBrIgEkACABIAApA1giBzcDCCABIAc3AxgCQAJAIAAgAUEIahD0A0UNACABKAIYIQIMAQsgASABKQMYNwMAIAFBEGogAEEPIAEQ3QNBACECCyACIgMvAQghAkEAIQQCQCAALQBDQX9qIgVFDQAgAEEAEKIDIQQLIAQiBEEfdSACcSAEaiIEQQAgBEEAShshBCACIQYCQCAFQQJJDQAgAEEBIAIQoQMhBgsCQCAAIAYiBkEfdSACcSAGaiIGIAIgBiACSBsiAiAEIAIgBCACSBsiBGsiBhCSASICRQ0AIAIoAgwgAygCDCAEQQN0aiAGQQN0EKEGGgsgACACEKgDIAFBIGokAAuxBwINfwF+IwBBgAFrIgEkACABIAApA1giDjcDWCABIA43A3gCQAJAIAAgAUHYAGoQ9ANFDQAgASgCeCECDAELIAEgASkDeDcDUCABQfAAaiAAQQ8gAUHQAGoQ3QNBACECCwJAIAIiA0UNACABIABB4ABqKQMAIg43A3gCQAJAIA5CAFINACABQQE2AmxBz+IAIQJBASEEDAELIAEgASkDeDcDSCABQfAAaiAAIAFByABqEM0DIAEgASkDcCIONwN4IAEgDjcDQCAAIAFBwABqIAFB7ABqEMgDIgJFDQEgASABKQN4NwM4IAAgAUE4ahDiAyEEIAEgASkDeDcDMCAAIAFBMGoQjgEgAiECIAQhBAsgBCEFIAIhBiADLwEIIgJBAEchBAJAAkAgAg0AIAQhB0EAIQRBACEIDAELIAQhCUEAIQpBACELQQAhDANAIAkhDSABIAMoAgwgCiICQQN0aikDADcDKCABQfAAaiAAIAFBKGoQzQMgASABKQNwNwMgIAVBACACGyALaiEEIAEoAmxBACACGyAMaiEIAkACQCAAIAFBIGogAUHoAGoQyAMiCQ0AIAghCiAEIQQMAQsgASABKQNwNwMYIAEoAmggCGohCiAAIAFBGGoQ4gMgBGohBAsgBCEIIAohBAJAIAlFDQAgAkEBaiICIAMvAQgiDUkiByEJIAIhCiAIIQsgBCEMIAchByAEIQQgCCEIIAIgDU8NAgwBCwsgDSEHIAQhBCAIIQgLIAghBSAEIQICQCAHQQFxDQAgACABQeAAaiACIAUQlgEiDUUNACADLwEIIgJBAEchBAJAAkAgAg0AIAQhDEEAIQQMAQsgBCEIQQAhCUEAIQoDQCAKIQQgCCEKIAEgAygCDCAJIgJBA3RqKQMANwMQIAFB8ABqIAAgAUEQahDNAwJAAkAgAg0AIAQhBAwBCyANIARqIAYgASgCbBChBhogASgCbCAEaiEECyAEIQQgASABKQNwNwMIAkACQCAAIAFBCGogAUHoAGoQyAMiCA0AIAQhBAwBCyANIARqIAggASgCaBChBhogASgCaCAEaiEECyAEIQQCQCAIRQ0AIAJBAWoiAiADLwEIIgtJIgwhCCACIQkgBCEKIAwhDCAEIQQgAiALTw0CDAELCyAKIQwgBCEECyAEIQIgDEEBcQ0AIAAgAUHgAGogAiAFEJcBIAAoAuwBIgJFDQAgAiABKQNgNwMgCyABIAEpA3g3AwAgACABEI8BCyABQYABaiQACxMAIAAgACAAQQAQogMQlAEQqAML3AQCBX8BfiMAQYABayIBJAAgASAAQeAAaikDADcDaCABIABB6ABqKQMAIgY3A2AgASAGNwNwQQAhAkEAIQMCQCABQeAAahD3Aw0AIAEgASkDcDcDWEEBIQJBASEDIAAgAUHYAGpBlgEQ+wMNACABIAEpA3A3A1ACQCAAIAFB0ABqQZcBEPsDDQAgASABKQNwNwNIIAAgAUHIAGpBmAEQ+wMNACABIAEpA3A3A0AgASAAIAFBwABqELkDNgIwIAFB+ABqIABB9BsgAUEwahDZA0EAIQJBfyEDDAELQQAhAkECIQMLIAIhBCABIAEpA2g3AyggACABQShqIAFB8ABqEPIDIQICQAJAAkAgA0EBag4CAgEACyABIAEpA2g3AyAgACABQSBqEMUDDQAgASABKQNoNwMYIAFB+ABqIABBwgAgAUEYahDdAwwBCwJAAkAgAkUNAAJAIARFDQAgAUEAIAIQggYiBDYCcEEAIQMgACAEEJQBIgRFDQIgBEEMaiACEIIGGiAEIQMMAgsgACACIAEoAnAQkwEhAwwBCyABIAEpA2g3AxACQCAAIAFBEGoQ9ANFDQAgASABKQNoNwMIAkAgACAAIAFBCGoQ8wMiAy8BCBCUASIFDQAgBSEDDAILAkAgAy8BCA0AIAUhAwwCC0EAIQIDQCABIAMoAgwgAiICQQN0aikDADcDACAFIAJqQQxqIAAgARDtAzoAACACQQFqIgQhAiAEIAMvAQhJDQALIAUhAwwBCyABQfgAaiAAQfUIQQAQ2QNBACEDCyAAIAMQqAMLIAFBgAFqJAALigECAX8BfiMAQTBrIgMkACADIAIpAwAiBDcDGCADIAQ3AyACQAJAAkAgASADQRhqEO8DDQAgAyADKQMgNwMQIANBKGogAUESIANBEGoQ3QMMAQsgAyADKQMgNwMIIAEgA0EIaiADQShqEPEDRQ0AIAAgAygCKBDpAwwBCyAAQgA3AwALIANBMGokAAv+AgIDfwF+IwBB8ABrIgEkACABIABB4ABqKQMANwNQIAEgACkDWCIENwNIIAEgBDcDYAJAAkAgACABQcgAahDvAw0AIAEgASkDYDcDQCABQegAaiAAQRIgAUHAAGoQ3QNBACECDAELIAEgASkDYDcDOCAAIAFBOGogAUHcAGoQ8QMhAgsCQCACIgJFDQAgASABKQNQNwMwAkAgACABQTBqQZYBEPsDRQ0AAkAgACABKAJcQQF0EJUBIgNFDQAgA0EGaiACIAEoAlwQgQYLIAAgAxCoAwwBCyABIAEpA1A3AygCQAJAIAFBKGoQ9wMNACABIAEpA1A3AyAgACABQSBqQZcBEPsDDQAgASABKQNQNwMYIAAgAUEYakGYARD7A0UNAQsgAUHoAGogACACIAEoAlwQzAMgACgC7AEiAEUNASAAIAEpA2g3AyAMAQsgASABKQNQNwMQIAEgACABQRBqELkDNgIAIAFB6ABqIABB9BsgARDZAwsgAUHwAGokAAvKAQIFfwF+IwBBMGsiASQAIAEgACkDWCIGNwMYIAEgBjcDIAJAAkAgACABQRhqEPADDQAgASABKQMgNwMQIAFBKGogAEGwICABQRBqEN4DQQAhAgwBCyABIAEpAyA3AwggACABQQhqIAFBKGoQ8QMhAgsCQCACIgNFDQAgAEEAEKIDIQIgAEEBEKIDIQQgAEECEKIDIQAgASgCKCIFIAJNDQAgASAFIAJrIgU2AiggAyACaiAAIAUgBCAFIARJGxCjBhoLIAFBMGokAAumAwIHfwF+IwBB4ABrIgEkACABIAApA1giCDcDOCABIAg3A1ACQAJAIAAgAUE4ahDwAw0AIAEgASkDUDcDMCABQdgAaiAAQbAgIAFBMGoQ3gNBACECDAELIAEgASkDUDcDKCAAIAFBKGogAUHMAGoQ8QMhAgsCQCACIgNFDQAgAEEAEKIDIQQgASAAQegAaikDACIINwMgIAEgCDcDQAJAAkAgACABQSBqEMUDRQ0AIAEgASkDQDcDACAAIAEgAUHYAGoQyAMhAgwBCyABIAEpA0AiCDcDUCABIAg3AxgCQAJAIAAgAUEYahDvAw0AIAEgASkDUDcDECABQdgAaiAAQRIgAUEQahDdA0EAIQIMAQsgASABKQNQNwMIIAAgAUEIaiABQdgAahDxAyECCyACIQILIAIiBUUNACAAQQIQogMhAiAAQQMQogMhACABKAJYIgYgAk0NACABIAYgAmsiBjYCWCABKAJMIgcgBE0NACABIAcgBGsiBzYCTCADIARqIAUgAmogByAGIAAgBiAASRsiACAHIABJGxChBhoLIAFB4ABqJAAL5QICCH8BfiMAQTBrIgEkACABIAApA1giCTcDECABIAk3AyACQAJAIAAgAUEQahDwAw0AIAEgASkDIDcDCCABQShqIABBsCAgAUEIahDeA0EAIQIMAQsgASABKQMgNwMAIAAgASABQRxqEPEDIQILAkAgAiIDRQ0AIABBABCiAyEEIABBAUEAEKEDIQIgAEECIAEoAhwQoQMhBQJAAkAgAkEASA0AIAUgASgCHEoNACAFIAJODQELIAFBKGogAEHaN0EAENsDDAELIAQgBSACayIAbyIEQR91IABxIARqIgBFDQAgBSACRg0AIAMgBWohBiADIAJqIgIgAGoiACEDIAIhBCAAIQADQCAEIgItAAAhBCACIAMiBS0AADoAACAFIAQ6AAAgACIAIAVBAWoiBSAFIAZGIgcbIgghAyACQQFqIgIhBCAAIAUgACACIABGGyAHGyEAIAIgCEcNAAsLIAFBMGokAAvYAgIIfwF+IwBBMGsiASQAIAEgACkDWCIJNwMYIAEgCTcDIAJAAkAgACABQRhqEO8DDQAgASABKQMgNwMQIAFBKGogAEESIAFBEGoQ3QNBACECDAELIAEgASkDIDcDCCAAIAFBCGogAUEoahDxAyECCwJAIAIiA0UNACAAQQAQogMhBCAAQQEQogMhAiAAQQIgASgCKBChAyIFIAVBH3UiBnMgBmsiByABKAIoIgYgByAGSBshCEEAIAIgBiACIAZIGyACQQBIGyEHAkACQCAFQQBODQAgCCEGA0ACQCAHIAYiAkgNAEF/IQgMAwsgAkF/aiICIQYgAiEIIAQgAyACai0AAEcNAAwCCwALAkAgByAITg0AIAchAgNAAkAgBCADIAIiAmotAABHDQAgAiEIDAMLIAJBAWoiBiECIAYgCEcNAAsLQX8hCAsgACAIEKYDCyABQTBqJAALiwECAX8BfiMAQTBrIgEkACABIAApA1giAjcDGCABIAI3AyACQAJAIAAgAUEYahDwAw0AIAEgASkDIDcDECABQShqIABBsCAgAUEQahDeA0EAIQAMAQsgASABKQMgNwMIIAAgAUEIaiABQShqEPEDIQALAkAgACIARQ0AIAAgASgCKBAoCyABQTBqJAALrwUCCX8BfiMAQYABayIBJAAgASICIAApA1giCjcDWCACIAo3A3ACQAJAIAAgAkHYAGoQ7wMNACACIAIpA3A3A1AgAkH4AGogAEESIAJB0ABqEN0DQQAhAwwBCyACIAIpA3A3A0ggACACQcgAaiACQewAahDxAyEDCyADIQQgAiAAQeAAaikDACIKNwNAIAIgCjcDeCAAIAJBwABqQQAQyAMhBSACIABB6ABqKQMAIgo3AzggAiAKNwNwAkACQCAAIAJBOGoQ7wMNACACIAIpA3A3AzAgAkH4AGogAEESIAJBMGoQ3QNBACEDDAELIAIgAikDcDcDKCAAIAJBKGogAkHoAGoQ8QMhAwsgAyEGIAIgAEHwAGopAwAiCjcDICACIAo3A3ACQAJAIAAgAkEgahDvAw0AIAIgAikDcDcDGCACQfgAaiAAQRIgAkEYahDdA0EAIQMMAQsgAiACKQNwNwMQIAAgAkEQaiACQeQAahDxAyEDCyADIQcgAEEDQX8QoQMhAwJAIAVB3CgQzwYNACAERQ0AIAIoAmhBIEcNACACKAJkQQ1HDQAgAyADQYBgaiADQYAgSBsiBUEQSw0AAkAgAigCbCIIIANBgCAgA2sgA0GAIEgbaiIJQX9KDQAgAiAINgIAIAIgBTYCBCACQfgAaiAAQYjkACACENoDDAELIAAgCRCUASIIRQ0AIAAgCBCoAwJAIANB/x9KDQAgAigCbCEAIAYgByAAIAhBDGogBCAAEKEGIgNqIAUgAyAAEPAEDAELIAEgBUEQakFwcWsiAyQAIAEhAQJAIAYgByADIAQgCWogBRChBiAFIAhBDGogBCAJEKEGIAkQ8QRFDQAgAkH4AGogAEGNLUEAENoDIAAoAuwBIgBFDQAgAEIANwMgCyABGgsgAkGAAWokAAu8AwIGfwF+IwBB4ABrIgEkACABIABB4ABqKQMAIgc3AzggASAHNwNQIAAgAUE4aiABQdwAahDyAyECIAEgAEHoAGopAwAiBzcDMCABIAc3A1AgACABQTBqQQAQyAMhAyABIABB8ABqKQMAIgc3AyggASAHNwNQAkACQCAAIAFBKGoQ9AMNACABIAEpA1A3AyAgAUHIAGogAEEPIAFBIGoQ3QMMAQsgASABKQNQNwMYIAAgAUEYahDzAyEEIANB9NkAEM8GDQACQAJAIAJFDQAgAiABKAJcEMADDAELEL0DCwJAIAQvAQhFDQBBACEDA0AgASAEKAIMIAMiBUEDdCIGaikDADcDEAJAAkAgACABQRBqIAFBxABqEPIDIgMNACABIAQoAgwgBmopAwA3AwggAUHIAGogAEESIAFBCGoQ3QMgAw0BDAQLIAEoAkQhBgJAIAINACADIAYQvgMgA0UNBAwBCyADIAYQwQMgA0UNAwsgBUEBaiIFIQMgBSAELwEISQ0ACwsgAEEgEJQBIgRFDQAgACAEEKgDIARBDGohAAJAIAJFDQAgABDCAwwBCyAAEL8DCyABQeAAaiQAC9kBAgF/AXwjAEEQayICJAAgAiABKQMANwMIAkACQCACQQhqEPcDRQ0AQX8hAQwBCwJAAkACQCABKAIEQQFqDgIAAQILIAEoAgAiAUEAIAFBAEobIQEMAgsgASgCAEHCAEcNAEF/IQEMAQsgAiABKQMANwMAQX8hASAAIAIQ7AMiA0QAAOD////vQWQNAEEAIQEgA0QAAAAAAAAAAGMNAAJAAkAgA0QAAAAAAADwQWMgA0QAAAAAAAAAAGZxRQ0AIAOrIQEMAQtBACEBCyABIQELIAJBEGokACABC/MBAwJ/AX4BfCMAQSBrIgEkACABIABB4ABqKQMAIgM3AxAgASADNwMYAkACQCABQRBqEPcDRQ0AQX8hAgwBCwJAAkACQCABKAIcQQFqDgIAAQILIAEoAhgiAkEAIAJBAEobIQIMAgsgASgCGEHCAEcNAEF/IQIMAQsgASABKQMYNwMIQX8hAiAAIAFBCGoQ7AMiBEQAAOD////vQWQNAEEAIQIgBEQAAAAAAAAAAGMNAAJAAkAgBEQAAAAAAADwQWMgBEQAAAAAAAAAAGZxRQ0AIASrIQIMAQtBACECCyACIQILIAAoAuwBIAIQeCABQSBqJAAL8wEDAn8BfgF8IwBBIGsiASQAIAEgAEHgAGopAwAiAzcDECABIAM3AxgCQAJAIAFBEGoQ9wNFDQBBfyECDAELAkACQAJAIAEoAhxBAWoOAgABAgsgASgCGCICQQAgAkEAShshAgwCCyABKAIYQcIARw0AQX8hAgwBCyABIAEpAxg3AwhBfyECIAAgAUEIahDsAyIERAAA4P///+9BZA0AQQAhAiAERAAAAAAAAAAAYw0AAkACQCAERAAAAAAAAPBBYyAERAAAAAAAAAAAZnFFDQAgBKshAgwBC0EAIQILIAIhAgsgACgC7AEgAhB4IAFBIGokAAtGAQF/AkAgAEEAEKIDIgFBkY7B1QBHDQBB6OsAQQAQO0GTyABBIUHvxAAQ/gUACyAAQd/UAyABIAFBoKt8akGhq3xJGxB2CwUAEDQACwgAIABBABB2C50CAgd/AX4jAEHwAGsiASQAAkAgAC0AQ0ECSQ0AIAEgAEHgAGopAwAiCDcDaCABIAg3AwggACABQQhqIAFB5ABqEMgDIgJFDQAgACACIAEoAmQgAUEgakHAACAAQegAaiIDIAAtAENBfmoiBCABQRxqEMQDIQUgASABKAIcQX9qIgY2AhwCQCAAIAFBEGogBUF/aiIHIAYQlgEiBkUNAAJAAkAgB0E+Sw0AIAYgAUEgaiAHEKEGGiAHIQIMAQsgACACIAEoAmQgBiAFIAMgBCABQRxqEMQDIQIgASABKAIcQX9qNgIcIAJBf2ohAgsgACABQRBqIAIgASgCHBCXAQsgACgC7AEiAEUNACAAIAEpAxA3AyALIAFB8ABqJAALbwICfwF+IwBBIGsiASQAIABBABCiAyECIAEgAEHoAGopAwAiAzcDGCABIAM3AwggAUEQaiAAIAFBCGoQzQMgASABKQMQIgM3AxggASADNwMAIABBPiACIAJB/35qQYB/SRvAIAEQ1gIgAUEgaiQACw4AIAAgAEEAEKQDEKUDCw8AIAAgAEEAEKQDnRClAwuAAgICfwF+IwBB8ABrIgEkACABIABB4ABqKQMANwNoIAEgAEHoAGopAwAiAzcDUCABIAM3A2ACQAJAIAFB0ABqEPYDRQ0AIAEgASkDaDcDECABIAAgAUEQahC5AzYCAEHnGiABEDsMAQsgASABKQNgNwNIIAFB2ABqIAAgAUHIAGoQzQMgASABKQNYIgM3A2AgASADNwNAIAAgAUHAAGoQjgEgASABKQNgNwM4IAAgAUE4akEAEMgDIQIgASABKQNoNwMwIAEgACABQTBqELkDNgIkIAEgAjYCIEGZGyABQSBqEDsgASABKQNgNwMYIAAgAUEYahCPAQsgAUHwAGokAAufAQICfwF+IwBBMGsiASQAIAEgAEHgAGopAwAiAzcDKCABIAM3AxAgAUEgaiAAIAFBEGoQzQMgASABKQMgIgM3AyggASADNwMIAkAgACABQQhqQQAQyAMiAkUNACACIAFBHGoQtAUiAkUNACABQSBqIABBCCAAIAIgASgCHBCYARDrAyAAKALsASIARQ0AIAAgASkDIDcDIAsgAUEwaiQACzsBAX8jAEEQayIBJAAgAUEIaiAAKQOAAroQ6AMCQCAAKALsASIARQ0AIAAgASkDCDcDIAsgAUEQaiQAC6gBAgF/AX4jAEEwayIBJAAgASAAQeAAaikDACICNwMoIAEgAjcDEAJAAkACQCAAIAFBEGpBjwEQ+wNFDQAQ9gUhAgwBCyABIAEpAyg3AwggACABQQhqQZsBEPsDRQ0BENsCIQILIAEgAjcDICABQQg2AgAgASABQSBqNgIEIAFBGGogAEHJIyABEMsDIAAoAuwBIgBFDQAgACABKQMYNwMgCyABQTBqJAAL0QICBH8BfiMAQSBrIgEkACAAQQAQogMhAiABIABB6ABqKQMAIgU3AwggASAFNwMYAkAgACABQQhqEJQCIgNFDQACQCACQYACRw0AQQBBAC0A7IACQQFqIgI6AOyAAgJAIAMvARAiBEGA/gNxQYCAAkYNACABIAApA2giBTcDGCABIAU3AwAgAUEQaiAAQd0BIAEQ3QMMAgsgAyACQf8AcUEIdCAEcjsBEAwBCwJAIAJBMUkNACABQRhqIABB3AAQ3wMMAQsgAyACOgAVAkAgAygCHC8BBCIEQe0BSQ0AIAFBGGogAEEvEN8DDAELIABBhQNqIAI6AAAgAEGGA2ogAy8BEDsBACAAQfwCaiADKQMINwIAIAMtABQhAiAAQYQDaiAEOgAAIABB+wJqIAI6AAAgAEGIA2ogAygCHEEMaiAEEKEGGiAAENUCCyABQSBqJAALsAICA38BfiMAQdAAayIBJAAgAEEAEKIDIQIgASAAQegAaikDACIENwNIAkACQCAEUA0AIAEgASkDSDcDOCAAIAFBOGoQxQMNACABIAEpA0g3AzAgAUHAAGogAEHCACABQTBqEN0DDAELAkAgAkUNACACQYCAgIB/cUGAgICAAUYNACABQcAAaiAAQdEWQQAQ2wMMAQsgASABKQNINwMoAkACQAJAIAAgAUEoaiACEOICIgNBA2oOAgEAAgsgASACNgIAIAFBwABqIABBngsgARDZAwwCCyABIAEpA0g3AyAgASAAIAFBIGpBABDIAzYCECABQcAAaiAAQeU9IAFBEGoQ2wMMAQsgA0EASA0AIAAoAuwBIgBFDQAgACADrUKAgICAIIQ3AyALIAFB0ABqJAALIwEBfyMAQRBrIgEkACABQQhqIABB/y1BABDaAyABQRBqJAAL6QECBH8BfiMAQSBrIgEkACABIABB4ABqKQMAIgU3AwggASAFNwMQIAAgAUEIaiABQRxqEMgDIQIgASAAQegAaikDACIFNwMAIAEgBTcDECAAIAEgAUEYahDyAyEDAkACQAJAIAJFDQAgAw0BCyABQRBqIABBic8AQQAQ2QMMAQsgACABKAIcIAEoAhhqQRFqEJQBIgRFDQAgACAEEKgDIARB/wE6AA4gBEEUahDbAjcAACABKAIcIQAgACAEQRxqIAIgABChBmpBAWogAyABKAIYEKEGGiAEQQxqIAQvAQQQJQsgAUEgaiQACyIBAX8jAEEQayIBJAAgAUEIaiAAQarZABDcAyABQRBqJAALIQEBfyMAQRBrIgEkACABQQhqIABB0jsQ3AMgAUEQaiQACyIBAX8jAEEQayIBJAAgAUEIaiAAQdrXABDcAyABQRBqJAALIgEBfyMAQRBrIgEkACABQQhqIABB2tcAENwDIAFBEGokAAsiAQF/IwBBEGsiASQAIAFBCGogAEHa1wAQ3AMgAUEQaiQAC3sCAn8BfiMAQRBrIgEkAAJAIAAQqQMiAkUNAAJAIAIoAgQNACACIABBHBDyAjYCBAsgASAAQeAAaikDACIDNwMIAkAgA0IAUg0AIAFBCGpB8gAQyQMLIAEgASkDCDcDACAAIAJB9gAgARDPAyAAIAIQqAMLIAFBEGokAAt7AgJ/AX4jAEEQayIBJAACQCAAEKkDIgJFDQACQCACKAIEDQAgAiAAQSAQ8gI2AgQLIAEgAEHgAGopAwAiAzcDCAJAIANCAFINACABQQhqQfQAEMkDCyABIAEpAwg3AwAgACACQfYAIAEQzwMgACACEKgDCyABQRBqJAALewICfwF+IwBBEGsiASQAAkAgABCpAyICRQ0AAkAgAigCBA0AIAIgAEEeEPICNgIECyABIABB4ABqKQMAIgM3AwgCQCADQgBSDQAgAUEIakHzABDJAwsgASABKQMINwMAIAAgAkH2ACABEM8DIAAgAhCoAwsgAUEQaiQAC3sCAn8BfiMAQRBrIgEkAAJAIAAQqQMiAkUNAAJAIAIoAgQNACACIABBIhDyAjYCBAsgASAAQeAAaikDACIDNwMIAkAgA0IAUg0AIAFBCGpBhAEQyQMLIAEgASkDCDcDACAAIAJB9gAgARDPAyAAIAIQqAMLIAFBEGokAAtiAQF/IwBBIGsiAyQAIAMgAikDADcDECADQRhqIAEgA0EQakH7ABCYAwJAAkAgAykDGEIAUg0AIABCADcDAAwBCyADIAMpAxg3AwggACABIANBCGpB4wAQmAMLIANBIGokAAs0AgF/AX4jAEEQayIBJAAgASAAKQNYIgI3AwAgASACNwMIIAAgARDVAyAAEFggAUEQaiQAC6YBAQF/IwBBIGsiAyQAIAMgAikDADcDEAJAAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEBRg0BCyADIAMpAxA3AwggA0EYaiABQYsBIANBCGoQ3QNBACEBDAELAkAgASADKAIQEHwiAg0AIANBGGogAUGMPkEAENsDCyACIQELAkACQCABIgFFDQAgACABKAIcEOkDDAELIABCADcDAAsgA0EgaiQAC6wBAQF/IwBBIGsiAyQAIAMgAikDADcDEAJAAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEBRg0BCyADIAMpAxA3AwggA0EYaiABQYsBIANBCGoQ3QNBACEBDAELAkAgASADKAIQEHwiAg0AIANBGGogAUGMPkEAENsDCyACIQELAkACQCABIgFFDQAgACABLQAQQQ9xQQRGEOoDDAELIABCADcDAAsgA0EgaiQAC8UBAQJ/IwBBIGsiASQAIAEgACkDWDcDEAJAAkACQCABKAIUIgJBgIDA/wdxDQAgAkEPcUEBRg0BCyABIAEpAxA3AwggAUEYaiAAQYsBIAFBCGoQ3QNBACECDAELAkAgACABKAIQEHwiAg0AIAFBGGogAEGMPkEAENsDCyACIQILAkAgAiICRQ0AAkAgAi0AEEEPcUEERg0AIAFBGGogAEH+P0EAENsDDAELIAIgAEHgAGopAwA3AyAgAkEBEHcLIAFBIGokAAuUAQECfyMAQSBrIgEkACABIAApA1g3AxACQAJAAkAgASgCFCICQYCAwP8HcQ0AIAJBD3FBAUYNAQsgASABKQMQNwMIIAFBGGogAEGLASABQQhqEN0DQQAhAAwBCwJAIAAgASgCEBB8IgINACABQRhqIABBjD5BABDbAwsgAiEACwJAIAAiAEUNACAAEH4LIAFBIGokAAtZAgN/AX4jAEEQayIBJAAgACgC7AEhAiABIABB4ABqKQMAIgQ3AwAgASAENwMIIAAgARCyASEDIAAoAuwBIAMQeCACIAItABBB8AFxQQRyOgAQIAFBEGokAAshAAJAIAAoAuwBIgBFDQAgACAANQIcQoCAgIAQhDcDIAsLYAECfyMAQRBrIgEkAAJAAkAgAC0AQyICDQAgAUEIaiAAQcgtQQAQ2wMMAQsgACACQX9qQQEQfSICRQ0AIAAoAuwBIgBFDQAgACACNQIcQoCAgIAQhDcDIAsgAUEQaiQAC98CAgN/AX4jAEHgAGsiAyQAIAMgAikDADcDOAJAAkACQCABIANBOGogA0HYAGogA0HUAGoQjAMiBEHPhgNLDQAgASgA5AEiBSAFKAIgaiAEQQR0ai0AC0ECcQ0BCyADIAIpAwA3AwAgACABQfolIAMQ3gMMAQsgACABIAEoAtgBIARB//8DcRD8AiAAKQMAQgBSDQAgA0HIAGogAUEIIAEgAUECEPICEJABEOsDIAAgAykDSCIGNwMAIAZQDQAgAyAAKQMANwMwIAEgA0EwahCOASADQcgAakH7ABDJAyADQQM2AkQgAyAENgJAIAMgACkDADcDKCADIAMpA0g3AyAgAyADKQNANwMYIAEgA0EoaiADQSBqIANBGGoQnQMgASgC2AEhAiADIAApAwA3AxAgASACIARB//8DcSADQRBqEPoCIAMgACkDADcDCCABIANBCGoQjwELIANB4ABqJAALwAEBAn8jAEEgayIDJAAgAyACKQMANwMIAkACQAJAIAEgA0EIaiADQRhqIANBFGoQjAMiBEF/Sg0AIAMgAikDADcDACAAIAFBHCADEN0DDAELAkAgBEHQhgNIDQAgBEGw+XxqIgFBAC8ByO4BTg0CIABBkP8AIAFBA3RqLwEAEMkDDAELIAAgASgA5AEiASABKAIgaiAEQQR0ai8BDDYCACAAQQQ2AgQLIANBIGokAA8LQfcWQbnJAEExQdI2EIMGAAvzCAEHfyMAQaABayIBJAACQAJAAkACQAJAIABFDQAgACgCqAINAhDZAQJAAkBBt+IAQQAQsQUiAg0AQQAhAwwBCyACIQJBACEEA0AgBCEDAkACQCACIgItAAVBwABHDQBBACEEDAELQQAhBCACELMFIgVB/wFGDQBBASEEIAVBPksNACAFQQN2QfCAAmotAAAgBUEHcXZBAXFFIQQLQbfiACACELEFIgUhAiADIARqIgMhBCADIQMgBQ0ACwsgASADIgI2AoABQa8XIAFBgAFqEDsgACAAIAJBGGwQigEiBDYCqAIgBEUNAiAAIAI6AEoMAQsQ2QELAkBBt+IAQQAQsQUiAkUNACACIQJBACEEA0AgBCEDIAIiAhCzBSEEIAEgAikCADcDkAEgASACQQhqKQIANwOYASABQfOgpfMGNgKQAQJAAkAgAUGQAWpBfxCyBSIFQQFLDQAgASAFNgJoIAEgBDYCZCABIAFBkAFqNgJgQanCACABQeAAahA7DAELIARBPksNACAEQQN2QfCAAmotAAAgBEEHcXZBAXFFDQAgASAENgJ0IAEgAkEFajYCcEH85wAgAUHwAGoQOwsCQAJAIAItAAVBwABHDQAgAyEEDAELAkAgAhCzBSIGQf8BRw0AIAMhBAwBCwJAIAZBPksNACAGQQN2QfCAAmotAAAgBkEHcXZBAXFFDQAgAyEEDAELAkAgAEUNACAAKAKoAiIGRQ0AIAMgAC0ASksNBSAGIANBGGxqIgYgBDoADSAGIAM6AAwgBiACQQVqIgc2AgggASAENgJYIAEgBzYCVCABIANB/wFxNgJQIAEgBTYCXEG/6AAgAUHQAGoQOyAGQQ87ARAgBkEAQRJBIiAFGyAFQX9GGzoADgsgA0EBaiEEC0G34gAgAhCxBSIDIQIgBCEEIAMNAAsLIABFDQACQAJAIABBKhDyAiIFDQBBACECDAELIAUtAANBD3EhAgsCQCACQXxqDgYAAwMDAwADCyAALQBKRQ0AQQAhAgNAIAAoAqgCIQQgAUGQAWogAEEIIAAgAEErEPICEJABEOsDIAQgAiIDQRhsaiICIAEpA5ABNwMAIAFBkAFqQdABEMkDIAFBiAFqIAItAA0Q6QMgASACKQMANwNIIAEgASkDkAE3A0AgASABKQOIATcDOCAAIAFByABqIAFBwABqIAFBOGoQnQMgAigCCCEEIAFBkAFqIABBCCAAIAQgBBDQBhCYARDrAyABIAEpA5ABNwMwIAAgAUEwahCOASABQYgBakHRARDJAyABIAIpAwA3AyggASABKQOIATcDICABIAEpA5ABNwMYIAAgAUEoaiABQSBqIAFBGGoQnQMgASABKQOQATcDECABIAIpAwA3AwggACAFIAFBEGogAUEIahD0AiABIAEpA5ABNwMAIAAgARCPASADQQFqIgQhAiAEIAAtAEpJDQALCyABQaABaiQADwtBmhdBjMkAQekAQYovEIMGAAtBm+YAQYzJAEGKAUGKLxCDBgALkwEBA39BAEIANwPwgAICQEHJ7gBBABCxBSIARQ0AIAAhAANAAkAgACIAQZsnENIGIgEgAE0NAAJAIAFBf2osAAAiAUEuRg0AIAFBf0oNAQsgABCzBSIBQT9LDQAgAUEDdkHwgAJqIgIgAi0AAEEBIAFBB3F0cjoAAAtBye4AIAAQsQUiASEAIAENAAsLQfA1QQAQOwv2AQIHfwF+IwBBIGsiAyQAIAMgAikDADcDEAJAAkAgAS0ASiIEDQAgBEEARyEFDAELAkAgASgCqAIiBikDACADKQMQIgpSDQBBASEFIAYhAgwBCyAEQRhsIAZqQWhqIQdBACEFAkADQAJAIAVBAWoiAiAERw0AIAchCAwCCyACIQUgBiACQRhsaiIJIQggCSkDACAKUg0ACwsgAiAESSEFIAghAgsgAiECAkAgBQ0AIAMgAykDEDcDCCADQRhqIAFB0AEgA0EIahDdA0EAIQILAkACQCACIgJFDQAgACACLQAOEOkDDAELIABCADcDAAsgA0EgaiQAC/YBAgd/AX4jAEEgayIDJAAgAyACKQMANwMQAkACQCABLQBKIgQNACAEQQBHIQUMAQsCQCABKAKoAiIGKQMAIAMpAxAiClINAEEBIQUgBiECDAELIARBGGwgBmpBaGohB0EAIQUCQANAAkAgBUEBaiICIARHDQAgByEIDAILIAIhBSAGIAJBGGxqIgkhCCAJKQMAIApSDQALCyACIARJIQUgCCECCyACIQICQCAFDQAgAyADKQMQNwMIIANBGGogAUHQASADQQhqEN0DQQAhAgsCQAJAIAIiAkUNACAAIAIvARAQ6QMMAQsgAEIANwMACyADQSBqJAALqAECBH8BfiMAQSBrIgMkACADIAIpAwA3AxACQAJAAkAgAS0ASiIEDQAgBEEARyECDAELIAEoAqgCIgUpAwAgAykDECIHUQ0BQQAhBgJAA0AgBkEBaiICIARGDQEgAiEGIAUgAkEYbGopAwAgB1INAAsLIAIgBEkhAgsgAg0AIAMgAykDEDcDCCADQRhqIAFB0AEgA0EIahDdAwsgAEIANwMAIANBIGokAAuLAgIIfwF+IwBBIGsiASQAIAEgACkDWCIJNwMQAkACQCAALQBKIgINACACQQBHIQMMAQsCQCAAKAKoAiIEKQMAIAlSDQBBASEDIAQhBQwBCyACQRhsIARqQWhqIQZBACEDAkADQAJAIANBAWoiBSACRw0AIAYhBwwCCyAFIQMgBCAFQRhsaiIIIQcgCCkDACAJUg0ACwsgBSACSSEDIAchBQsgBSEFAkAgAw0AIAEgASkDEDcDCCABQRhqIABB0AEgAUEIahDdA0EAIQULAkAgBUUNACAAQQBBfxChAxogASAAQeAAaikDACIJNwMYIAEgCTcDACABQRBqIABB0gEgARDdAwsgAUEgaiQAC4kBAgJ/AX4jAEEgayIDJAAgAyACKQMAIgU3AxACQAJAIAWnIgRFDQAgBCECIAQoAgBBgICA+ABxQYCAgOgARg0BCyADIAMpAxA3AwggA0EYaiABQbgBIANBCGoQ3QNBACECCwJAAkAgAiICDQBBACECDAELIAIvAQQhAgsgACACEOkDIANBIGokAAuJAQICfwF+IwBBIGsiAyQAIAMgAikDACIFNwMQAkACQCAFpyIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDoAEYNAQsgAyADKQMQNwMIIANBGGogAUG4ASADQQhqEN0DQQAhAgsCQAJAIAIiAg0AQQAhAgwBCyACLwEGIQILIAAgAhDpAyADQSBqJAALiQECAn8BfiMAQSBrIgMkACADIAIpAwAiBTcDEAJAAkAgBaciBEUNACAEIQIgBCgCAEGAgID4AHFBgICA6ABGDQELIAMgAykDEDcDCCADQRhqIAFBuAEgA0EIahDdA0EAIQILAkACQCACIgINAEEAIQIMAQsgAi0ACiECCyAAIAIQ6QMgA0EgaiQAC/wBAgN/AX4jAEEgayIDJAAgAyACKQMAIgY3AxACQAJAIAanIgRFDQAgBCECIAQoAgBBgICA+ABxQYCAgOgARg0BCyADIAMpAxA3AwggA0EYaiABQbgBIANBCGoQ3QNBACECCwJAAkAgAiICRQ0AIAItAAtFDQAgAiABIAIvAQQgAi8BCGwQlAEiBDYCEAJAIAQNAEEAIQIMAgsgAkEAOgALIAIoAgwhBSACIARBDGoiBDYCDCAFRQ0AIAQgBSACLwEEIAIvAQhsEKEGGgsgAiECCwJAAkAgAiICDQBBACECDAELIAIoAhAhAgsgACABQQggAhDrAyADQSBqJAAL7AQBCn8jAEHgAGsiASQAIABBABCiAyECIABBARCiAyEDIABBAhCiAyEEIAEgAEH4AGopAwA3A1ggAEEEEKIDIQUCQAJAAkACQAJAIAJBAUgNACADQQFIDQAgAyACbEGAwANKDQAgBEF/ag4EAQAAAgALIAEgAjYCACABIAM2AgQgASAENgIIIAFB0ABqIABB5cAAIAEQ2wMMAwsgA0EHakEDdiEGDAELIANBAnRBH2pBA3ZB/P///wFxIQYLIAEgASkDWDcDQCAGIgcgAmwhCEEAIQZBACEJAkAgAUHAAGoQ9wMNACABIAEpA1g3AzgCQCAAIAFBOGoQ7wMNACABIAEpA1g3AzAgAUHQAGogAEESIAFBMGoQ3QMMAgsgASABKQNYNwMoIAAgAUEoaiABQcwAahDxAyEGAkACQAJAIAVBAEgNACAIIAVqIAEoAkxNDQELIAEgBTYCECABQdAAaiAAQevBACABQRBqENsDQQAhBUEAIQkgBiEKDAELIAEgASkDWDcDICAGIAVqIQYCQAJAIAAgAUEgahDwAw0AQQEhBUEAIQkMAQsgASABKQNYNwMYQQEhBSAAIAFBGGoQ8wMhCQsgBiEKCyAJIQYgCiEJIAVFDQELIAkhCSAGIQYgAEENQRgQiQEiBUUNACAAIAUQqAMgBiEGIAkhCgJAIAkNAAJAIAAgCBCUASIJDQAgACgC7AEiAEUNAiAAQgA3AyAMAgsgCSEGIAlBDGohCgsgBSAGIgA2AhAgBSAKNgIMIAUgBDoACiAFIAc7AQggBSADOwEGIAUgAjsBBCAFIABFOgALCyABQeAAaiQAC0IBAX8jAEEgayIBJAAgACABQQRqQQMQ5AECQCABLQAcRQ0AIAEoAgQgASgCCCABKAIMIAEoAhAQ5QELIAFBIGokAAvIAwIGfwF+IwBBIGsiAyQAIAMgACkDWCIJNwMQIAJBH3UhBAJAAkAgCaciBUUNACAFIQYgBSgCAEGAgID4AHFBgICA6ABGDQELIAMgAykDEDcDCCADQRhqIABBuAEgA0EIahDdA0EAIQYLIAYhBiACIARzIQUCQAJAIAJBAEgNACAGRQ0AIAYtAAtFDQAgBiAAIAYvAQQgBi8BCGwQlAEiBzYCEAJAIAcNAEEAIQcMAgsgBkEAOgALIAYoAgwhCCAGIAdBDGoiBzYCDCAIRQ0AIAcgCCAGLwEEIAYvAQhsEKEGGgsgBiEHCyAFIARrIQYgASAHIgQ2AgACQCACRQ0AIAEgAEEAEKIDNgIECwJAIAZBAkkNACABIABBARCiAzYCCAsCQCAGQQNJDQAgASAAQQIQogM2AgwLAkAgBkEESQ0AIAEgAEEDEKIDNgIQCwJAIAZBBUkNACABIABBBBCiAzYCFAsCQAJAIAINAEEAIQIMAQtBACECIARFDQBBACECIAEoAgQiAEEASA0AAkAgASgCCCIGQQBODQBBACECDAELQQAhAiAAIAQvAQRODQAgBiAELwEGSCECCyABIAI6ABggA0EgaiQAC7wBAQR/IAAvAQghBCAAKAIMIQVBASEGAkACQAJAIAAtAApBf2oiBw4EAQAAAgALQb7NAEEWQZcwEP4FAAtBAyEGCyAFIAQgAWxqIAIgBnVqIQACQAJAAkACQCAHDgQBAwMAAwsgAC0AACEGAkAgAkEBcUUNACAGQQ9xIANBBHRyIQIMAgsgBkFwcSADQQ9xciECDAELIAAtAAAiBkEBIAJBB3EiAnRyIAZBfiACd3EgAxshAgsgACACOgAACwvtAgIHfwF+IwBBIGsiASQAIAEgACkDWCIINwMQAkACQCAIpyICRQ0AIAIhAyACKAIAQYCAgPgAcUGAgIDoAEYNAQsgASABKQMQNwMIIAFBGGogAEG4ASABQQhqEN0DQQAhAwsgAEEAEKIDIQIgAEEBEKIDIQQCQAJAIAMiBQ0AQQAhAwwBC0EAIQMgAkEASA0AAkAgBEEATg0AQQAhAwwBCwJAIAIgBS8BBEgNAEEAIQMMAQsCQCAEIAUvAQZIDQBBACEDDAELIAUvAQghBiAFKAIMIQdBASEDAkACQAJAIAUtAApBf2oiBQ4EAQAAAgALQb7NAEEWQZcwEP4FAAtBAyEDCyAHIAIgBmxqIAQgA3VqIQJBACEDAkACQCAFDgQBAgIAAgsgAi0AACEDAkAgBEEBcUUNACADQfABcUEEdiEDDAILIANBD3EhAwwBCyACLQAAIARBB3F2QQFxIQMLIAAgAxCmAyABQSBqJAALPwECfyMAQSBrIgEkACAAIAFBBGpBARDkASAAIAEoAgQiAkEAQQAgAi8BBCACLwEGIAEoAggQ6AEgAUEgaiQAC4kHAQh/AkAgAUUNACAERQ0AIAVFDQAgAS8BBCIHIAJMDQAgAS8BBiIIIANMDQAgBCACaiIEQQFIDQAgBSADaiIFQQFIDQACQAJAIAEtAApBAUcNAEEAIAZBAXFrQf8BcSEJDAELIAZBD3FBEWwhCQsgCSEJIAEvAQghCgJAAkAgAS0AC0UNACABIAAgCiAHbBCUASIANgIQAkAgAA0AQQAhAQwCCyABQQA6AAsgASgCDCELIAEgAEEMaiIANgIMIAtFDQAgACALIAEvAQQgAS8BCGwQoQYaCyABIQELIAEiDEUNACAFIAggBSAISBsiACADQQAgA0EAShsiASAIQX9qIAEgCEkbIgVrIQggBCAHIAQgB0gbIAJBACACQQBKGyIBIAdBf2ogASAHSRsiBGshAQJAIAwvAQYiAkEHcQ0AIAQNACAFDQAgASAMLwEEIgNHDQAgCCACRw0AIAwoAgwgCSADIApsEKMGGg8LIAwvAQghAyAMKAIMIQdBASECAkACQAJAIAwtAApBf2oOBAEAAAIAC0G+zQBBFkGXMBD+BQALQQMhAgsgAiELIAFBAUgNACAAIAVBf3NqIQJB8AFBDyAFQQFxGyENQQEgBUEHcXQhDiABIQEgByAEIANsaiAFIAt1aiEEA0AgBCELIAEhBwJAAkACQCAMLQAKQX9qDgQAAgIBAgtBACEBIA4hBCALIQUgAkEASA0BA0AgBSEFIAEhAQJAAkACQAJAIAQiBEGAAkYNACAFIQUgBCEDDAELIAVBAWohBCAIIAFrQQhODQEgBCEFQQEhAwsgBSIEIAQtAAAiACADIgVyIAAgBUF/c3EgBhs6AAAgBCEDIAVBAXQhBCABIQEMAQsgBCAJOgAAIAQhA0GAAiEEIAFBB2ohAQsgASIAQQFqIQEgBCEEIAMhBSAAIAJIDQAMAgsAC0EAIQEgDSEEIAshBSACQQBIDQADQCAFIQUgASEBAkACQAJAAkAgBCIDQYAeRg0AIAUhBCADIQUMAQsgBUEBaiEEIAggAWtBAk4NASAEIQRBDyEFCyAEIgQgBC0AACAFIgVBf3NxIAUgCXFyOgAAIAQhAyAFQQR0IQQgASEBDAELIAQgCToAACAEIQNBgB4hBCABQQFqIQELIAEiAEEBaiEBIAQhBCADIQUgACACSA0ACwsgB0F/aiEBIAsgCmohBCAHQQFKDQALCwtDAQF/IwBBIGsiASQAIAAgAUEEakEFEOQBIAAgASgCBCABKAIIIAEoAgwgASgCECABKAIUIAEoAhgQ6AEgAUEgaiQAC6oCAgV/AX4jAEEgayIBJAAgASAAKQNYIgY3AxACQAJAIAanIgJFDQAgAiEDIAIoAgBBgICA+ABxQYCAgOgARg0BCyABIAEpAxA3AwggAUEYaiAAQbgBIAFBCGoQ3QNBACEDCyADIQMgASAAQeAAaikDACIGNwMQAkACQCAGpyIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDoAEYNAQsgASABKQMQNwMAIAFBGGogAEG4ASABEN0DQQAhAgsgAiECAkACQCADDQBBACEEDAELAkAgAg0AQQAhBAwBCwJAIAMvAQQiBSACLwEERg0AQQAhBAwBC0EAIQQgAy8BBiACLwEGRw0AIAMoAgwgAigCDCADLwEIIAVsELsGRSEECyAAIAQQpwMgAUEgaiQAC6IBAgN/AX4jAEEgayIBJAAgASAAKQNYIgQ3AxACQAJAIASnIgJFDQAgAiEDIAIoAgBBgICA+ABxQYCAgOgARg0BCyABIAEpAxA3AwggAUEYaiAAQbgBIAFBCGoQ3QNBACEDCwJAIAMiA0UNACAAIAMvAQQgAy8BBiADLQAKEOwBIgBFDQAgACgCDCADKAIMIAAoAhAvAQQQoQYaCyABQSBqJAALyQEBAX8CQCAAQQ1BGBCJASIEDQBBAA8LIAAgBBCoAyAEIAM6AAogBCACOwEGIAQgATsBBAJAAkACQAJAIANBf2oOBAIBAQABCyACQQJ0QR9qQQN2Qfz///8BcSEDDAILQb7NAEEfQes5EP4FAAsgAkEHakEDdiEDCyAEIAMiAzsBCCAEIAAgA0H//wNxIAFB//8DcWwQlAEiAzYCEAJAIAMNAAJAIAAoAuwBIgQNAEEADwsgBEIANwMgQQAPCyAEIANBDGo2AgwgBAuMAwIIfwF+IwBBIGsiASQAIAEiAiAAKQNYIgk3AxACQAJAIAmnIgNFDQAgAyEEIAMoAgBBgICA+ABxQYCAgOgARg0BCyACIAIpAxA3AwggAkEYaiAAQbgBIAJBCGoQ3QNBACEECwJAAkAgBCIERQ0AIAQtAAtFDQAgBCAAIAQvAQQgBC8BCGwQlAEiADYCEAJAIAANAEEAIQQMAgsgBEEAOgALIAQoAgwhAyAEIABBDGoiADYCDCADRQ0AIAAgAyAELwEEIAQvAQhsEKEGGgsgBCEECwJAIAQiAEUNAAJAAkAgAC0ACkF/ag4EAQAAAQALQb7NAEEWQZcwEP4FAAsgAC8BBCEDIAEgAC8BCCIEQQ9qQfD/B3FrIgUkACABIQYCQCAEIANBf2psIgFBAUgNAEEAIARrIQcgACgCDCIDIQAgAyABaiEBA0AgBSAAIgAgBBChBiEDIAAgASIBIAQQoQYgBGoiCCEAIAEgAyAEEKEGIAdqIgMhASAIIANJDQALCyAGGgsgAkEgaiQAC00BA38gAC8BCCEDIAAoAgwhBEEBIQUCQAJAAkAgAC0ACkF/ag4EAQAAAgALQb7NAEEWQZcwEP4FAAtBAyEFCyAEIAMgAWxqIAIgBXVqC/wEAgh/AX4jAEEgayIBJAAgASAAKQNYIgk3AxACQAJAIAmnIgJFDQAgAiEDIAIoAgBBgICA+ABxQYCAgOgARg0BCyABIAEpAxA3AwggAUEYaiAAQbgBIAFBCGoQ3QNBACEDCwJAAkAgAyIDRQ0AIAMtAAtFDQAgAyAAIAMvAQQgAy8BCGwQlAEiADYCEAJAIAANAEEAIQMMAgsgA0EAOgALIAMoAgwhAiADIABBDGoiADYCDCACRQ0AIAAgAiADLwEEIAMvAQhsEKEGGgsgAyEDCwJAIAMiA0UNACADLwEERQ0AQQAhAANAIAAhBAJAIAMvAQYiAEECSQ0AIABBf2ohAkEAIQADQCAAIQAgAiECIAMvAQghBSADKAIMIQZBASEHAkACQAJAIAMtAApBf2oiCA4EAQAAAgALQb7NAEEWQZcwEP4FAAtBAyEHCyAGIAQgBWxqIgUgACAHdmohBkEAIQcCQAJAAkAgCA4EAQICAAILIAYtAAAhBwJAIABBAXFFDQAgB0HwAXFBBHYhBwwCCyAHQQ9xIQcMAQsgBi0AACAAQQdxdkEBcSEHCyAHIQZBASEHAkACQAJAIAgOBAEAAAIAC0G+zQBBFkGXMBD+BQALQQMhBwsgBSACIAd1aiEFQQAhBwJAAkACQCAIDgQBAgIAAgsgBS0AACEIAkAgAkEBcUUNACAIQfABcUEEdiEHDAILIAhBD3EhBwwBCyAFLQAAIAJBB3F2QQFxIQcLIAMgBCAAIAcQ5QEgAyAEIAIgBhDlASACQX9qIgghAiAAQQFqIgchACAHIAhIDQALCyAEQQFqIgIhACACIAMvAQRJDQALCyABQSBqJAALwQICCH8BfiMAQSBrIgEkACABIAApA1giCTcDEAJAAkAgCaciAkUNACACIQMgAigCAEGAgID4AHFBgICA6ABGDQELIAEgASkDEDcDCCABQRhqIABBuAEgAUEIahDdA0EAIQMLAkAgAyIDRQ0AIAAgAy8BBiADLwEEIAMtAAoQ7AEiBEUNACADLwEERQ0AQQAhAANAIAAhAAJAIAMvAQZFDQACQANAIAAhAAJAIAMtAApBf2oiBQ4EAAICAAILIAMvAQghBiADKAIMIQdBDyEIQQAhAgJAAkACQCAFDgQAAgIBAgtBASEICyAHIAAgBmxqLQAAIAhxIQILIARBACAAIAIQ5QEgAEEBaiEAIAMvAQZFDQIMAAsAC0G+zQBBFkGXMBD+BQALIABBAWoiAiEAIAIgAy8BBEgNAAsLIAFBIGokAAuJAQEGfyMAQRBrIgEkACAAIAFBAxDyAQJAIAEoAgAiAkUNACABKAIEIgNFDQAgASgCDCEEIAEoAgghBQJAAkAgAi0ACkEERw0AQX4hBiADLQAKQQRGDQELIAAgAiAFIAQgAy8BBCADLwEGQQAQ6AFBACEGCyACIAMgBSAEIAYQ8wEaCyABQRBqJAAL3QMCA38BfiMAQTBrIgMkAAJAAkAgAkEDag4HAQAAAAAAAQALQfvZAEG+zQBB8gFBoNoAEIMGAAsgACkDWCEGAkACQCACQX9KDQAgAyAGNwMgAkACQCAGpyIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDoAEYNAQsgAyADKQMgNwMQIANBKGogAEG4ASADQRBqEN0DQQAhAgsgAiECDAELIAMgBjcDIAJAAkAgBqciBEUNACAEIQIgBCgCAEGAgID4AHFBgICA6ABGDQELIAMgAykDIDcDGCADQShqIABBuAEgA0EYahDdA0EAIQILAkAgAiICRQ0AIAItAAtFDQAgAiAAIAIvAQQgAi8BCGwQlAEiBDYCEAJAIAQNAEEAIQIMAgsgAkEAOgALIAIoAgwhBSACIARBDGoiBDYCDCAFRQ0AIAQgBSACLwEEIAIvAQhsEKEGGgsgAiECCyABIAI2AgAgAyAAQeAAaikDACIGNwMgAkACQCAGpyIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDoAEYNAQsgAyADKQMgNwMIIANBKGogAEG4ASADQQhqEN0DQQAhAgsgASACNgIEIAEgAEEBEKIDNgIIIAEgAEECEKIDNgIMIANBMGokAAuZGQEVfwJAIAEvAQQiBSACakEBTg0AQQAPCwJAIAAvAQQiBiACSg0AQQAPCwJAIAEvAQYiByADaiIIQQFODQBBAA8LAkAgAC8BBiIJIANKDQBBAA8LAkACQCADQX9KDQAgCSAIIAkgCEgbIQcMAQsgCSADayIKIAcgCiAHSBshBwsgByELIAAoAgwhDCABKAIMIQ0gAC8BCCEOIAEvAQghDyABLQAKIRBBASEKAkACQAJAIAAtAAoiB0F/ag4EAQAAAgALQb7NAEEWQZcwEP4FAAtBAyEKCyAMIAMgCnUiCmohEQJAAkAgB0EERw0AIBBB/wFxQQRHDQBBACEBIAVFDQEgD0ECdiESIAlBeGohECAJIAggCSAISBsiAEF4aiETIANBAXEiFCEVIA9BBEkhFiAEQX5HIRcgAiEBQQAhAgNAIAIhGAJAIAEiGUEASA0AIBkgBk4NACARIBkgDmxqIQwgDSAYIBJsQQJ0aiEPAkACQCAEQQBIDQAgFEUNASASIQkgAyECIA8hCCAMIQEgFg0CA0AgASEBIAkhByAIIggoAgAiCUEPcSEKAkACQAJAIAIiAkEASCIMDQAgAiAQSg0AAkAgCkUNACABIAEtAABBD3EgCUEEdHI6AAALIAlBBHZBD3EiCiEJIAoNAQwCCwJAIAwNACAKRQ0AIAIgAE4NACABIAEtAABBD3EgCUEEdHI6AAALIAlBBHZBD3EiCUUNASACQX9IDQEgCSEJIAJBAWogAE4NAQsgASABLQABQfABcSAJcjoAAQsgB0F/aiIHIQkgAkEIaiECIAhBBGohCCABQQRqIQEgBw0ADAMLAAsCQCAXDQACQCAVRQ0AIBIhCSADIQEgDyEIIAwhAiAWDQMDQCACIQIgCSEHIAgiCCgCACEJAkACQAJAIAEiAUEASCIKDQAgASATSg0AIAJBADsAAiACIAlB8AFxQQR2OgABIAIgAi0AAEEPcSAJQQR0cjoAACACQQRqIQkMAQsCQCAKDQAgASAATg0AIAIgAi0AAEEPcSAJQQR0cjoAAAsCQCABQX9IDQAgAUEBaiAATg0AIAIgAi0AAUHwAXEgCUHwAXFBBHZyOgABCwJAIAFBfkgNACABQQJqIABODQAgAiACLQABQQ9xOgABCwJAIAFBfUgNACABQQNqIABODQAgAiACLQACQfABcToAAgsCQCABQXxIDQAgAUEEaiAATg0AIAIgAi0AAkEPcToAAgsCQCABQXtIDQAgAUEFaiAATg0AIAIgAi0AA0HwAXE6AAMLAkAgAUF6SA0AIAFBBmogAE4NACACIAItAANBD3E6AAMLIAJBBGohAgJAIAFBeU4NACACIQIMAgsgAiEJIAIhAiABQQdqIABODQELIAkiAiACLQAAQfABcToAACACIQILIAdBf2oiByEJIAFBCGohASAIQQRqIQggAiECIAcNAAwECwALIBIhCSADIQEgDyEIIAwhAiAWDQIDQCACIQIgCSEJIAgiCCgCACEHAkACQCABIgFBAEgiCg0AIAEgE0oNACACQQA6AAMgAkEAOwABIAIgBzoAAAwBCwJAIAoNACABIABODQAgAiACLQAAQfABcSAHQQ9xcjoAAAsCQCABQX9IDQAgAUEBaiAATg0AIAIgAi0AAEEPcSAHQfABcXI6AAALAkAgAUF+SA0AIAFBAmogAE4NACACIAItAAFB8AFxOgABCwJAIAFBfUgNACABQQNqIABODQAgAiACLQABQQ9xOgABCwJAIAFBfEgNACABQQRqIABODQAgAiACLQACQfABcToAAgsCQCABQXtIDQAgAUEFaiAATg0AIAIgAi0AAkEPcToAAgsCQCABQXpIDQAgAUEGaiAATg0AIAIgAi0AA0HwAXE6AAMLIAFBeUgNACABQQdqIABODQAgAiACLQADQQ9xOgADCyAJQX9qIgchCSABQQhqIQEgCEEEaiEIIAJBBGohAiAHDQAMAwsACyASIQggDCEJIA8hAiADIQcgEiEKIAwhDCAPIQ8gAyELAkAgFUUNAANAIAchASACIQIgCSEJIAgiCEUNAyACKAIAIgpBD3EhBwJAAkACQCABQQBIIgwNACABIBBKDQACQCAHRQ0AIAktAABBD00NACAJIQlBACEKIAEhAQwDCyAKQfABcUUNASAJLQABQQ9xRQ0BIAlBAWohCUEAIQogASEBDAILAkAgDA0AIAdFDQAgASAATg0AIAktAABBD00NACAJIQlBACEKIAEhAQwCCyAKQfABcUUNACABQX9IDQAgAUEBaiIHIABODQAgCS0AAUEPcUUNACAJQQFqIQlBACEKIAchAQwBCyAJQQRqIQlBASEKIAFBCGohAQsgCEF/aiEIIAkhCSACQQRqIQIgASEHQQEhASAKDQAMBgsACwNAIAshASAPIQIgDCEJIAoiCEUNAiACKAIAIgpBD3EhBwJAAkACQCABQQBIIgwNACABIBBKDQACQCAHRQ0AIAktAABBD3FFDQAgCSEJQQAhByABIQEMAwsgCkHwAXFFDQEgCS0AAEEQSQ0BIAkhCUEAIQcgASEBDAILAkAgDA0AIAdFDQAgASAATg0AIAktAABBD3FFDQAgCSEJQQAhByABIQEMAgsgCkHwAXFFDQAgAUF/SA0AIAFBAWoiCiAATg0AIAktAABBD00NACAJIQlBACEHIAohAQwBCyAJQQRqIQlBASEHIAFBCGohAQsgCEF/aiEKIAkhDCACQQRqIQ8gASELQQEhASAHDQAMBQsACyASIQkgAyECIA8hCCAMIQEgFg0AA0AgASEBIAkhByAIIgooAgAiCUEPcSEIAkACQAJAIAIiAkEASCIMDQAgAiAQSg0AAkAgCEUNACABIAEtAABB8AFxIAhyOgAACyAJQfABcQ0BDAILAkAgDA0AIAhFDQAgAiAATg0AIAEgAS0AAEHwAXEgCHI6AAALIAlB8AFxRQ0BIAJBf0gNASACQQFqIABODQELIAEgAS0AAEEPcSAJQfABcXI6AAALIAdBf2oiByEJIAJBCGohAiAKQQRqIQggAUEEaiEBIAcNAAsLIBlBAWohASAYQQFqIgkhAiAJIAVHDQALQQAPCwJAIAdBAUcNACAQQf8BcUEBRw0AQQEhAQJAAkACQCAHQX9qDgQBAAACAAtBvs0AQRZBlzAQ/gUAC0EDIQELIAEhAQJAIAUNAEEADwtBACAKayESIAwgCUF/aiABdWogEWshFiAIIANBB3EiEGoiFEF4aiEKIARBf0chGCACIQJBACEAA0AgACETAkAgAiILQQBIDQAgCyAGTg0AIBEgCyAObGoiASAWaiEZIAEgEmohByANIBMgD2xqIQIgASEBQQAhACADIQkCQANAIAAhCCABIQEgAiECIAkiCSAKTg0BIAItAAAgEHQhAAJAAkAgByABSw0AIAEgGUsNACAAIAhBCHZyIQwgAS0AACEEAkAgGA0AIAwgBHFFDQEgASEBIAghAEEAIQggCSEJDAILIAEgBCAMcjoAAAsgAUEBaiEBIAAhAEEBIQggCUEIaiEJCyACQQFqIQIgASEBIAAhACAJIQkgCA0AC0EBDwsgFCAJayIAQQFIDQAgByABSw0AIAEgGUsNACACLQAAIBB0IAhBCHZyQf8BQQggAGt2cSECIAEtAAAhAAJAIBgNACACIABxRQ0BQQEPCyABIAAgAnI6AAALIAtBAWohAiATQQFqIgkhAEEAIQEgCSAFRw0ADAILAAsCQCAHQQRGDQBBAA8LAkAgEEH/AXFBAUYNAEEADwsgESEJIA0hCAJAIANBf0oNACABQQBBACADaxDuASEBIAAoAgwhCSABIQgLIAghEyAJIRJBACEBIAVFDQBBAUEAIANrQQdxdEEBIANBAEgiARshESALQQAgA0EBcSABGyINaiEMIARBBHQhA0EAIQAgAiECA0AgACEYAkAgAiIZQQBIDQAgGSAGTg0AIAtBAUgNACANIQkgEyAYIA9saiICLQAAIQggESEHIBIgGSAObGohASACQQFqIQIDQCACIQAgASECIAghCiAJIQECQAJAIAciCEGAAkYNACAAIQkgCCEIIAohAAwBCyAAQQFqIQlBASEIIAAtAAAhAAsgCSEKAkAgACIAIAgiB3FFDQAgAiACLQAAQQ9BcCABQQFxIgkbcSADIAQgCRtyOgAACyABQQFqIhAhCSAAIQggB0EBdCEHIAIgAUEBcWohASAKIQIgECAMSA0ACwsgGEEBaiIJIQAgGUEBaiECQQAhASAJIAVHDQALCyABC6kBAgd/AX4jAEEgayIBJAAgACABQRBqQQMQ8gEgASgCHCECIAEoAhghAyABKAIUIQQgASgCECEFIABBAxCiAyEGAkAgBUUNACAERQ0AAkACQCAFLQAKQQJPDQBBACEHDAELQQAhByAELQAKQQFHDQAgASAAQfgAaikDACIINwMAIAEgCDcDCEEBIAYgARD3AxshBwsgBSAEIAMgAiAHEPMBGgsgAUEgaiQAC1wBBH8jAEEQayIBJAAgACABQX0Q8gECQAJAIAEoAgAiAg0AQQAhAwwBC0EAIQMgASgCBCIERQ0AIAIgBCABKAIIIAEoAgxBfxDzASEDCyAAIAMQpwMgAUEQaiQAC00BAn8jAEEgayIBJAAgACABQQRqQQUQ5AECQCABKAIEIgJFDQAgACACIAEoAgggASgCDCABKAIQIAEoAhQgASgCGBD3AQsgAUEgaiQAC94FAQR/IAIhAiADIQcgBCEIIAUhCQNAIAchAyACIQUgCCIEIQIgCSIKIQcgBSEIIAMhCSAEIAVIDQALIAQgBWshAgJAAkAgCiADRw0AAkAgBCAFRw0AIAVBAEgNAiADQQBIDQIgAS8BBCAFTA0CIAEvAQYgA0wNAiABIAUgAyAGEOUBDwsgACABIAUgAyACQQFqQQEgBhDoAQ8LIAogA2shBwJAIAQgBUcNAAJAIAdBAUgNACAAIAEgBSADQQEgB0EBaiAGEOgBDwsgACABIAUgCkEBQQEgB2sgBhDoAQ8LIARBAEgNACABLwEEIgggBUwNAAJAAkAgBUF/TA0AIAMhAyAFIQUMAQsgAyAHIAVsIAJtayEDQQAhBQsgBSEJIAMhBQJAAkAgCCAETA0AIAohCCAEIQQMAQsgCEF/aiIDIARrIAdsIAJtIApqIQggAyEECyAEIQogAS8BBiEDAkACQAJAIAUgCCIETg0AIARBAEgNAyAFIANODQMCQAJAIAVBf0wNACAFIQggCSEFDAELQQAhCCAJIAUgAmwgB21rIQULIAUhBSAIIQkCQCAEIANODQAgBCEIIAohBAwCCyADQX9qIgMhCCADIARrIAJsIAdtIApqIQQMAQsgBCADTg0CIAVBAEgNAgJAAkAgBEF/TA0AIAQhCCAKIQQMAQtBACEIIAogBCACbCAHbWshBAsgBCEEIAghCAJAIAUgA04NACAIIQggBCEEIAUhAyAJIQUMAgsgCCEIIAQhBCADQX9qIgohAyAKIAVrIAJsIAdtIAlqIQUMAQsgCSEDIAUhBQsgBSEFIAMhAyAEIQQgCCEIIAAgARD4ASIJRQ0AAkAgB0F/Sg0AAkAgAkEAIAdrTA0AIAkgBSADIAQgCCAGEPkBDwsgCSAEIAggBSADIAYQ+gEPCwJAIAcgAk4NACAJIAUgAyAEIAggBhD5AQ8LIAkgBSADIAQgCCAGEPoBCwtpAQF/AkAgAUUNACABLQALRQ0AIAEgACABLwEEIAEvAQhsEJQBIgA2AhACQCAADQBBAA8LIAFBADoACyABKAIMIQIgASAAQQxqIgA2AgwgAkUNACAAIAIgAS8BBCABLwEIbBChBhoLIAELjwEBBX8CQCADIAFIDQBBAUF/IAQgAmsiBkF/ShshB0EAIAMgAWsiCEEBdGshCSABIQQgAiECIAYgBkEfdSIBcyABa0EBdCIKIAhrIQYDQCAAIAQiASACIgIgBRDlASABQQFqIQQgB0EAIAYiBkEASiIIGyACaiECIAYgCmogCUEAIAgbaiEGIAEgA0cNAAsLC48BAQV/AkAgBCACSA0AQQFBfyADIAFrIgZBf0obIQdBACAEIAJrIghBAXRrIQkgAiEDIAEhASAGIAZBH3UiAnMgAmtBAXQiCiAIayEGA0AgACABIgEgAyICIAUQ5QEgAkEBaiEDIAdBACAGIgZBAEoiCBsgAWohASAGIApqIAlBACAIG2ohBiACIARHDQALCwv/AwENfyMAQRBrIgEkACAAIAFBAxDyAQJAIAEoAgAiAkUNACABKAIMIQMgASgCCCEEIAEoAgQhBSAAQQMQogMhBiAAQQQQogMhACAEQQBIDQAgBCACLwEETg0AIAIvAQZFDQACQAJAIAZBAE4NAEEAIQcMAQtBACEHIAYgAi8BBE4NACACLwEGQQBHIQcLIAdFDQAgAEEBSA0AIAItAAoiCEEERw0AIAUtAAoiCUEERw0AIAIvAQYhCiAFLwEEQRB0IABtIQcgAi8BCCELIAIoAgwhDEEBIQICQAJAAkAgCEF/ag4EAQAAAgALQb7NAEEWQZcwEP4FAAtBAyECCyACIQ0CQAJAIAlBf2oOBAEAAAEAC0G+zQBBFkGXMBD+BQALIANBACADQQBKGyICIAAgA2oiACAKIAAgCkgbIghODQAgBSgCDCAGIAUvAQhsaiEFIAIhBiAMIAQgC2xqIAIgDXZqIQIgA0EfdUEAIAMgB2xrcSEAA0AgBSAAIgBBEXVqLQAAIgRBBHYgBEEPcSAAQYCABHEbIQQgAiICLQAAIQMCQAJAIAYiBkEBcUUNACACIANBD3EgBEEEdHI6AAAgAkEBaiECDAELIAIgA0HwAXEgBHI6AAAgAiECCyAGQQFqIgQhBiACIQIgACAHaiEAIAQgCEcNAAsLIAFBEGokAAv4CQIefwF+IwBBIGsiASQAIAEgACkDWCIfNwMQAkACQCAfpyICRQ0AIAIhAyACKAIAQYCAgPgAcUGAgIDoAEYNAQsgASABKQMQNwMIIAFBGGogAEG4ASABQQhqEN0DQQAhAwsgAyECIABBABCiAyEEIABBARCiAyEFIABBAhCiAyEGIABBAxCiAyEHIAEgAEGAAWopAwAiHzcDEAJAAkAgH6ciCEUNACAIIQMgCCgCAEGAgID4AHFBgICA6ABGDQELIAEgASkDEDcDACABQRhqIABBuAEgARDdA0EAIQMLIAMhAyAAQQUQogMhCSAAQQYQogMhCiAAQQcQogMhCyAAQQgQogMhCAJAIAJFDQAgA0UNACAIQRB0IAdtIQwgC0EQdCAGbSENIABBCRCjAyEOIABBChCjAyEPIAIvAQYhECACLwEEIREgAy8BBiESIAMvAQQhEwJAAkAgD0UNACACIQIMAQsCQAJAIAItAAtFDQAgAiAAIAIvAQggEWwQlAEiFDYCEAJAIBQNAEEAIQIMAgsgAkEAOgALIAIoAgwhFSACIBRBDGoiFDYCDCAVRQ0AIBQgFSACLwEEIAIvAQhsEKEGGgsgAiECCyACIhQhAiAURQ0BCyACIRQCQCAFQR91IAVxIgIgAkEfdSICcyACayIVIAVqIhYgECAHIAVqIgIgECACSBsiF04NACAMIBVsIApBEHRqIgJBACACQQBKGyIFIBIgCCAKaiICIBIgAkgbQRB0IhhODQAgBEEfdSAEcSICIAJBH3UiAnMgAmsiAiAEaiIZIBEgBiAEaiIIIBEgCEgbIgpIIA0gAmwgCUEQdGoiAkEAIAJBAEobIhogEyALIAlqIgIgEyACSBtBEHQiCUhxIRsgDkEBcyETIBYhAiAFIQUDQCAFIRYgAiEQAkACQCAbRQ0AIBBBAXEhHCAQQQdxIR0gEEEBdSESIBBBA3UhHiAWQYCABHEhFSAWQRF1IQsgFkETdSERIBZBEHZBB3EhDiAaIQIgGSEFA0AgBSEIIAIhAiADLwEIIQcgAygCDCEEIAshBQJAAkACQCADLQAKQX9qIgYOBAEAAAIAC0G+zQBBFkGXMBD+BQALIBEhBQsgBCACQRB1IAdsaiAFaiEHQQAhBQJAAkACQCAGDgQBAgIAAgsgBy0AACEFAkAgFUUNACAFQfABcUEEdiEFDAILIAVBD3EhBQwBCyAHLQAAIA52QQFxIQULAkACQCAPIAUiBUEAR3FBAUcNACAULwEIIQcgFCgCDCEEIBIhBQJAAkACQCAULQAKQX9qIgYOBAEAAAIAC0G+zQBBFkGXMBD+BQALIB4hBQsgBCAIIAdsaiAFaiEHQQAhBQJAAkACQCAGDgQBAgIAAgsgBy0AACEFAkAgHEUNACAFQfABcUEEdiEFDAILIAVBD3EhBQwBCyAHLQAAIB12QQFxIQULAkAgBQ0AQQchBQwCCyAAQQEQpwNBASEFDAELAkAgEyAFQQBHckEBRw0AIBQgCCAQIAUQ5QELQQAhBQsgBSIFIQcCQCAFDggAAwMDAwMDAAMLIAhBAWoiBSAKTg0BIAIgDWoiCCECIAUhBSAIIAlIDQALC0EFIQcLAkAgBw4GAAMDAwMAAwsgEEEBaiICIBdODQEgAiECIBYgDGoiCCEFIAggGEgNAAsLIABBABCnAwsgAUEgaiQAC9ICAQ9/IwBBIGsiASQAIAAgAUEEakEEEOQBAkAgASgCBCICRQ0AIAEoAhAiA0EBSA0AIAEoAhQhBCABKAIMIQUgASgCCCEGQQEgA0EBdCIHayEIQQEhCUEBIQpBACELIANBf2ohDANAIAohDSAJIQMgACACIAwiCSAGaiAFIAsiCmsiC0EBIApBAXRBAXIiDCAEEOgBIAAgAiAKIAZqIAUgCWsiDkEBIAlBAXRBAXIiDyAEEOgBIAAgAiAGIAlrIAtBASAMIAQQ6AEgACACIAYgCmsgDkEBIA8gBBDoAQJAAkAgCCIIQQBKDQAgCSEMIApBAWohCyANIQogA0ECaiEJIAMhAwwBCyAJQX9qIQwgCiELIA1BAmoiDiEKIAMhCSAOIAdrIQMLIAMgCGohCCAJIQkgCiEKIAsiAyELIAwiDiEMIA4gA04NAAsLIAFBIGokAAvqAQICfwF+IwBB0ABrIgEkACABIABB4ABqKQMANwNIIAEgAEHoAGopAwAiAzcDKCABIAM3A0ACQCABQShqEPYDDQAgAUE4aiAAQZUeENwDCyABIAEpA0g3AyAgAUE4aiAAIAFBIGoQzQMgASABKQM4IgM3A0ggASADNwMYIAAgAUEYahCOASABIAEpA0g3AxACQCAAIAFBEGogAUE0ahDIAyICRQ0AIAFBOGogACACIAEoAjRBARDpAiAAKALsASICRQ0AIAIgASkDODcDIAsgASABKQNINwMIIAAgAUEIahCPASABQdAAaiQAC5IBAQJ/IwBBMGsiASQAIAEgAEHgAGopAwA3AyggASAAQegAaikDADcDICAAQQIQogMhAiABIAEpAyA3AxACQCABQRBqEPYDDQAgAUEYaiAAQeIgENwDCyABIAEpAyg3AwggAUEYaiAAIAFBCGogAkEBEOwCAkAgACgC7AEiAEUNACAAIAEpAxg3AyALIAFBMGokAAthAgF/AX4jAEEQayIBJAAgASAAQeAAaikDACICNwMIAkACQCABKAIMQX9HDQAgACgC7AEiAEUNASAAIAI3AyAMAQsgASABKQMINwMAIAAgACABEOwDmxClAwsgAUEQaiQAC2ECAX8BfiMAQRBrIgEkACABIABB4ABqKQMAIgI3AwgCQAJAIAEoAgxBf0cNACAAKALsASIARQ0BIAAgAjcDIAwBCyABIAEpAwg3AwAgACAAIAEQ7AOcEKUDCyABQRBqJAALYwIBfwF+IwBBEGsiASQAIAEgAEHgAGopAwAiAjcDCAJAAkAgASgCDEF/Rw0AIAAoAuwBIgBFDQEgACACNwMgDAELIAEgASkDCDcDACAAIAAgARDsAxDMBhClAwsgAUEQaiQAC8gBAwJ/AX4BfCMAQSBrIgEkACABIABB4ABqKQMAIgM3AxgCQAJAIAEoAhxBf0cNACADpyICQYCAgIB4Rg0AAkACQCACQQBIDQAgASABKQMYNwMQDAELIAFBEGpBACACaxDpAwsgACgC7AEiAEUNASAAIAEpAxA3AyAMAQsgASABKQMYNwMIAkAgACABQQhqEOwDIgREAAAAAAAAAABjRQ0AIAAgBJoQpQMMAQsgACgC7AEiAEUNACAAIAEpAxg3AyALIAFBIGokAAsVACAAEPcFuEQAAAAAAADwPaIQpQMLZAEFfwJAAkAgAEEAEKIDIgFBAUsNAEEBIQIMAQtBASEDA0AgA0EBdEEBciIEIQIgBCEDIAQgAUkNAAsLIAIhAgNAIAQQ9wUgAnEiBCAEIAFLIgMbIgUhBCADDQALIAAgBRCmAwsRACAAIABBABCkAxC3BhClAwsYACAAIABBABCkAyAAQQEQpAMQwwYQpQMLLgEDfyAAQQAQogMhAUEAIQICQCAAQQEQogMiA0UNACABIANtIQILIAAgAhCmAwsuAQN/IABBABCiAyEBQQAhAgJAIABBARCiAyIDRQ0AIAEgA28hAgsgACACEKYDCxYAIAAgAEEAEKIDIABBARCiA2wQpgMLCQAgAEEBEIwCC5EDAgR/AnwjAEEwayICJAAgAiAAQeAAaikDADcDKCACIABB6ABqKQMANwMgAkAgAigCLEF/Rw0AIAIoAiRBf0cNACACIAIpAyg3AxggACACQRhqEO0DIQMgAiACKQMgNwMQIAAgAkEQahDtAyEEAkACQAJAIAFFDQAgAkEoaiEFIAMgBE4NAQwCCyACQShqIQUgAyAESg0BCyACQSBqIQULIAUhBSAAKALsASIDRQ0AIAMgBSkDADcDIAsgAiACKQMoNwMIIAAgAkEIahDsAyEGIAIgAikDIDcDACAAIAIQ7AMhBwJAAkAgBr1C////////////AINCgICAgICAgPj/AFYNACAHvUL///////////8Ag0KBgICAgICA+P8AVA0BCyAAKALsASIFRQ0AIAVBACkDoIsBNwMgCwJAAkACQCABRQ0AIAJBKGohASAGIAdjRQ0BDAILIAJBKGohASAGIAdkDQELIAJBIGohAQsgASEBAkAgACgC7AEiAEUNACAAIAEpAwA3AyALIAJBMGokAAsJACAAQQAQjAILnQECA38BfiMAQTBrIgEkACABIABB4ABqKQMANwMoIAEgAEHoAGopAwAiBDcDGCABIAQ3AyACQCABQRhqEPYDDQAgASABKQMoNwMQIAAgAUEQahCSAyECIAEgASkDIDcDCCAAIAFBCGoQlQMiA0UNACACRQ0AIAAgAiADEPMCCwJAIAAoAuwBIgBFDQAgACABKQMoNwMgCyABQTBqJAALCQAgAEEBEJACC6EBAgN/AX4jAEEwayICJAAgAiAAQeAAaikDACIFNwMYIAIgBTcDKAJAIAAgAkEYahCVAyIDRQ0AIABBABCSASIERQ0AIAJBIGogAEEIIAQQ6wMgAiACKQMgNwMQIAAgAkEQahCOASAAIAMgBCABEPcCIAIgAikDIDcDCCAAIAJBCGoQjwEgACgC7AEiAEUNACAAIAIpAyA3AyALIAJBMGokAAsJACAAQQAQkAIL6gECA38BfiMAQcAAayIBJAAgASAAQeAAaikDACIENwM4IAEgAEHoAGopAwA3AzAgASAENwMgAkACQCAAIAFBIGoQ8wMiAg0AQQAhAwwBCyACLQADQQ9xIQMLAkACQAJAIANBfGoOBgEAAAAAAQALIAEgASkDODcDCCABQShqIABB0gAgAUEIahDdAwwBCyABIAEpAzA3AxgCQCAAIAFBGGoQlQMiAw0AIAEgASkDMDcDECABQShqIABBNCABQRBqEN0DDAELIAIgAzYCBCAAKALsASIARQ0AIAAgASkDODcDIAsgAUHAAGokAAtuAgJ/An4jAEEQayIBJAAgACkDWCEDIAEgAEHgAGopAwAiBDcDACABIAQ3AwggARD3AyECIAAoAuwBIQACQAJAAkAgAkUNACADIQQgAA0BDAILIABFDQEgASkDCCEECyAAIAQ3AyALIAFBEGokAAt1AQN/IwBBEGsiAiQAAkACQCABKAIEIgNBgIDA/wdxDQAgA0EPcUEIRw0AIAEoAgAiBEUNACAEIQMgBCgCAEGAgID4AHFBgICA2ABGDQELIAIgASkDADcDACACQQhqIABBLyACEN0DQQAhAwsgAkEQaiQAIAMLvgEBAn8jAEEgayIDJAAgAyACKQMANwMQAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEIRw0AIAMoAhAiBEUNACAEIQIgBCgCAEGAgID4AHFBgICA2ABGDQELIAMgAykDEDcDCCADQRhqIAFBLyADQQhqEN0DQQAhAgsCQAJAIAIiAg0AIABCADcDAAwBCwJAIAIvARIiAiABLwFMTw0AIAAgAjYCACAAQQI2AgQMAQsgAEIANwMACyADQSBqJAALsgEBAn8jAEEgayIDJAAgAyACKQMANwMQAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEIRw0AIAMoAhAiBEUNACAEIQIgBCgCAEGAgID4AHFBgICA2ABGDQELIAMgAykDEDcDCCADQRhqIAFBLyADQQhqEN0DQQAhAgsCQAJAIAIiAg0AIABCADcDAAwBCyADQQg2AgAgAyACQQhqNgIEIAAgAUHJIyADEMsDCyADQSBqJAALuAEBAn8jAEEgayIDJAAgAyACKQMANwMQAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEIRw0AIAMoAhAiBEUNACAEIQIgBCgCAEGAgID4AHFBgICA2ABGDQELIAMgAykDEDcDCCADQRhqIAFBLyADQQhqEN0DQQAhAgsCQAJAIAIiAg0AIABCADcDAAwBCyADQRhqIAIpAwgQiQYgAyADQRhqNgIAIAAgAUHQHCADEMsDCyADQSBqJAALnwEBAn8jAEEgayIDJAAgAyACKQMANwMQAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEIRw0AIAMoAhAiBEUNACAEIQIgBCgCAEGAgID4AHFBgICA2ABGDQELIAMgAykDEDcDCCADQRhqIAFBLyADQQhqEN0DQQAhAgsCQAJAIAIiAg0AIABCADcDAAwBCyAAIAItABUQ6QMLIANBIGokAAufAQECfyMAQSBrIgMkACADIAIpAwA3AxACQAJAIAMoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgAygCECIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDYAEYNAQsgAyADKQMQNwMIIANBGGogAUEvIANBCGoQ3QNBACECCwJAAkAgAiICDQAgAEIANwMADAELIAAgAi8BEBDpAwsgA0EgaiQAC58BAQJ/IwBBIGsiAyQAIAMgAikDADcDEAJAAkAgAygCFCICQYCAwP8HcQ0AIAJBD3FBCEcNACADKAIQIgRFDQAgBCECIAQoAgBBgICA+ABxQYCAgNgARg0BCyADIAMpAxA3AwggA0EYaiABQS8gA0EIahDdA0EAIQILAkACQCACIgINACAAQgA3AwAMAQsgACACLQAUEOkDCyADQSBqJAALogEBAn8jAEEgayIDJAAgAyACKQMANwMQAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEIRw0AIAMoAhAiBEUNACAEIQIgBCgCAEGAgID4AHFBgICA2ABGDQELIAMgAykDEDcDCCADQRhqIAFBLyADQQhqEN0DQQAhAgsCQAJAIAIiAg0AIABCADcDAAwBCyAAIAItABRBAXEQ6gMLIANBIGokAAujAQECfyMAQSBrIgMkACADIAIpAwA3AxACQAJAIAMoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgAygCECIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDYAEYNAQsgAyADKQMQNwMIIANBGGogAUEvIANBCGoQ3QNBACECCwJAAkAgAiICDQAgAEIANwMADAELIAAgAi0AFEEBcUUQ6gMLIANBIGokAAujAQECfyMAQSBrIgMkACADIAIpAwA3AxACQAJAIAMoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgAygCECIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDYAEYNAQsgAyADKQMQNwMIIANBGGogAUEvIANBCGoQ3QNBACECCwJAAkAgAiICDQAgAEIANwMADAELIAAgAUEIIAIoAhwQ6wMLIANBIGokAAvLAQECfyMAQSBrIgMkACADIAIpAwA3AxACQAJAIAMoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgAygCECIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDYAEYNAQsgAyADKQMQNwMIIANBGGogAUEvIANBCGoQ3QNBACECCwJAAkAgAiICDQAgAEIANwMADAELAkACQCACLQAUQQFxRQ0AQQAhAQwBC0EAIQEgAi0AFUEwSw0AIAIvARBBD3YhAQsgACABEOoDCyADQSBqJAALyQEBAn8jAEEgayIDJAAgAyACKQMANwMQAkACQCADKAIUIgJBgIDA/wdxDQAgAkEPcUEIRw0AIAMoAhAiBEUNACAEIQIgBCgCAEGAgID4AHFBgICA2ABGDQELIAMgAykDEDcDCCADQRhqIAFBLyADQQhqEN0DQQAhAgsCQAJAIAIiAg0AIABCADcDAAwBCwJAIAItABRBAXENACACLQAVQTBLDQAgAi4BEEF/Sg0AIAAgAi0AEBDpAwwBCyAAQgA3AwALIANBIGokAAupAQECfyMAQSBrIgMkACADIAIpAwA3AxACQAJAIAMoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgAygCECIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDYAEYNAQsgAyADKQMQNwMIIANBGGogAUEvIANBCGoQ3QNBACECCwJAAkAgAiICDQAgAEIANwMADAELIAAgAi8BEEGA4ANxQYDAAEYQ6gMLIANBIGokAAuoAQECfyMAQSBrIgMkACADIAIpAwA3AxACQAJAIAMoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgAygCECIERQ0AIAQhAiAEKAIAQYCAgPgAcUGAgIDYAEYNAQsgAyADKQMQNwMIIANBGGogAUEvIANBCGoQ3QNBACECCwJAAkAgAiICDQAgAEIANwMADAELIAAgAi8BEEGA4ANxQYAgRhDqAwsgA0EgaiQAC74BAQJ/IwBBIGsiAyQAIAMgAikDADcDEAJAAkAgAygCFCICQYCAwP8HcQ0AIAJBD3FBCEcNACADKAIQIgRFDQAgBCECIAQoAgBBgICA+ABxQYCAgNgARg0BCyADIAMpAxA3AwggA0EYaiABQS8gA0EIahDdA0EAIQILAkACQCACIgINACAAQgA3AwAMAQsCQCACLwEQIgJBDHZBf2pBAkkNACAAQgA3AwAMAQsgACACQf8fcRDpAwsgA0EgaiQAC6MBAQJ/IwBBIGsiAyQAIAMgAikDADcDEAJAAkAgAygCFCICQYCAwP8HcQ0AIAJBD3FBCEcNACADKAIQIgRFDQAgBCECIAQoAgBBgICA+ABxQYCAgNgARg0BCyADIAMpAxA3AwggA0EYaiABQS8gA0EIahDdA0EAIQILAkACQCACIgINACAAQgA3AwAMAQsgACACLwEQQYAgSRDqAwsgA0EgaiQAC/oBAQV/AkAgAkH//wNHDQBBAA8LIAEhAwNAIAUhBAJAIAMiBg0AQQAPCyAGLwEIIgVBAEchAQJAAkACQCAFDQAgASEDDAELQQAhAwJAAkACQCAAKADkASIHIAcoAmBqIAYvAQpBAnRqIgcvAQIgAkcNACABIQNBACEBDAELA0AgA0EBaiIBIAVGDQIgASEDIAcgAUEDdGovAQIgAkcNAAsgASAFSSEDIAEhAQsgAyEDIAcgAUEDdGohAQwCC0EAIQMLIAQhAQsgASEBAkACQCADIgdFDQAgBiEDDAELIAAgBhCIAyEDCyADIQMgASEFIAEhASAHRQ0ACyABC6MBAQJ/IwBBIGsiAyQAIAMgAikDADcDEAJAAkAgAygCFCICQYCAwP8HcQ0AIAJBD3FBCEcNACADKAIQIgRFDQAgBCECIAQoAgBBgICA+ABxQYCAgNgARg0BCyADIAMpAxA3AwggA0EYaiABQS8gA0EIahDdA0EAIQILAkACQCACIgINACAAQgA3AwAMAQsgACABIAEgAhCmAhD/AgsgA0EgaiQAC8QDAQZ/AkAgAQ0AQQAPCwJAIAAgAS8BEhCFAyICDQBBAA8LIAEuARAiA0GAYHEhBAJAAkACQCABLQAUQQFxRQ0AAkAgBA0AIAMhBAwDCwJAIARB//8DcSIBQYDAAEYNACABQYAgRw0CCyADQf8fcUGAIHIhBAwCCwJAIANBf0oNACADQf8BcUGAgH5yIQQMAgsCQCAERQ0AIARB//8DcUGAIEcNASADQf8fcUGAIHIhBAwCCyADQYDAAHIhBAwBC0H//wMhBAtBACEBAkAgBEH//wNxIgVB//8DRg0AIAIhBANAIAMhBgJAIAQiBw0AQQAPCyAHLwEIIgNBAEchAQJAAkACQCADDQAgASEEDAELQQAhBAJAAkACQCAAKADkASICIAIoAmBqIAcvAQpBAnRqIgIvAQIgBUcNACABIQRBACEBDAELA0AgBEEBaiIBIANGDQIgASEEIAIgAUEDdGovAQIgBUcNAAsgASADSSEEIAEhAQsgBCEEIAIgAUEDdGohAQwCC0EAIQQLIAYhAQsgASEBAkACQCAEIgJFDQAgByEEDAELIAAgBxCIAyEECyAEIQQgASEDIAEhASACRQ0ACwsgAQvBAQEDfyMAQSBrIgEkACABIAApA1g3AxACQAJAIAEoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgASgCECIDRQ0AIAMhAiADKAIAQYCAgPgAcUGAgIDYAEYNAQsgASABKQMQNwMIIAFBGGogAEEvIAFBCGoQ3QNBACECCwJAIAAgAiICEKYCIgNFDQAgAUEYaiAAIAMgAigCHCICQQxqIAIvAQQQrwIgACgC7AEiAEUNACAAIAEpAxg3AyALIAFBIGokAAvzAQICfwF+IwBBIGsiASQAIAEgACkDWDcDEAJAIAEoAhQiAkGAgMD/B3ENACACQQ9xQQhHDQAgASgCECICRQ0AIAIoAgBBgICA+ABxQYCAgNgARw0AIABB+AJqQQBB/AEQowYaIABBhgNqQQM7AQAgAikDCCEDIABBhANqQQQ6AAAgAEH8AmogAzcCACAAQYgDaiACLwEQOwEAIABBigNqIAIvARY7AQAgAUEYaiAAIAIvARIQ1wICQCAAKALsASIARQ0AIAAgASkDGDcDIAsgAUEgaiQADwsgASABKQMQNwMIIAFBGGogAEEvIAFBCGoQ3QMAC6EBAgF/AX4jAEEwayIDJAAgAyACKQMAIgQ3AxggAyAENwMQAkACQCABIANBEGogA0EsahCCAyICRQ0AIAMoAixB//8BRg0BCyADIAMpAxg3AwggA0EgaiABQZ0BIANBCGoQ3QMLAkACQCACDQAgAEIANwMADAELAkAgASACEIQDIgJBf0oNACAAQgA3AwAMAQsgACABIAIQ/QILIANBMGokAAuPAQIBfwF+IwBBMGsiAyQAIAMgAikDACIENwMYIAMgBDcDEAJAAkAgASADQRBqIANBLGoQggMiAkUNACADKAIsQf//AUYNAQsgAyADKQMYNwMIIANBIGogAUGdASADQQhqEN0DCwJAAkAgAg0AIABCADcDAAwBCyAAIAIvAQA2AgAgAEEENgIECyADQTBqJAALiAECAX8BfiMAQTBrIgMkACADIAIpAwAiBDcDGCADIAQ3AxACQAJAIAEgA0EQaiADQSxqEIIDIgJFDQAgAygCLEH//wFGDQELIAMgAykDGDcDCCADQSBqIAFBnQEgA0EIahDdAwsCQAJAIAINACAAQgA3AwAMAQsgACACLwECEOkDCyADQTBqJAAL+AECA38BfiMAQTBrIgMkACADIAIpAwAiBjcDGCADIAY3AxACQAJAIAEgA0EQaiADQSxqEIIDIgRFDQAgAygCLEH//wFGDQELIAMgAykDGDcDCCADQSBqIAFBnQEgA0EIahDdAwsCQAJAIAQNACAAQgA3AwAMAQsCQAJAIAQvAQJBgOADcSIFRQ0AIAVBgCBHDQEgACACKQMANwMADAILAkAgASAEEIQDIgJBf0oNACAAQgA3AwAMAgsgACABIAEgASgA5AEiBSAFKAJgaiACQQR0aiAELwECQf8fcUGAwAByEKQCEP8CDAELIABCADcDAAsgA0EwaiQAC+8BAgJ/AX4jAEEwayIDJAAgAyACKQMAIgU3AxggAyAFNwMQAkACQCABIANBEGogA0EsahCCAyICRQ0AIAMoAixB//8BRg0BCyADIAMpAxg3AwggA0EgaiABQZ0BIANBCGoQ3QMLAkACQCACDQAgAEIANwMADAELQQEhAUEAIQQCQAJAAkACQAJAIAIvAQJBDHYOCQEAAgQEBAQEAwQLQQAhAUHcASEEDAMLQQAhAUHeASEEDAILQQAhAUHfASEEDAELQQAhAUHdASEECyAEIQICQCABRQ0AIABCADcDAAwBCyAAIAIQyQMLIANBMGokAAuKAgIEfwF+IwBBMGsiASQAIAEgACkDWCIFNwMYIAEgBTcDEAJAAkAgACABQRBqIAFBLGoQggMiAkUNACABKAIsQf//AUYNAQsgASABKQMYNwMIIAFBIGogAEGdASABQQhqEN0DCwJAIAJFDQAgACACEIQDIgNBAEgNACAAQfgCakEAQfwBEKMGGiAAQYYDaiACLwECIgRB/x9xOwEAIABB/AJqENsCNwIAAkACQCAEQYDgA3EiBEGAgAJGDQAgBEGAIEcNAQsgACAALwGGAyAEcjsBhgMLIAAgAhCyAiABQSBqIAAgA0GAgAJqENcCIAAoAuwBIgBFDQAgACABKQMgNwMgCyABQTBqJAALowMBBH8jAEEwayIFJAAgBSADNgIsAkACQCACLQAEQQFxRQ0AAkAgAUEAEJIBIgYNACAAQgA3AwAMAgsgAyAEaiEHIAAgAUEIIAYQ6wMgBSAAKQMANwMYIAEgBUEYahCOAUEAIQMgASgA5AEiBCAEKAJgaiACLwEGQQJ0aiECA0AgAiECIAMhAwJAAkAgByAFKAIsIghrIgRBAE4NACADIQMgAiECQQIhBAwBCyAFQSBqIAEgAi0AAiAFQSxqIAQQSAJAAkACQCAFKQMgUA0AIAUgBSkDIDcDECABIAYgBUEQahCgAyAFKAIsIAhGDQAgAyEEAkAgAw0AIAItAANBHnRBH3UgAnEhBAsgBCEDIAJBBGohBAJAAkAgAi8BBEUNACAEIQIMAQsgAyECIAMNAEEAIQMgBCECDAILIAMhAyACIQJBACEEDAILIAMhAyACIQILQQIhBAsgAyEDIAIhAiAEIQQLIAMhAyACIQIgBEUNAAsgBSAAKQMANwMIIAEgBUEIahCPAQwBCyAAIAEgAi8BBiAFQSxqIAQQSAsgBUEwaiQAC90BAgN/AX4jAEHAAGsiASQAIAEgACkDWCIENwMoIAEgBDcDGCABIAQ3AzAgACABQRhqIAFBJGoQggMiAiEDAkAgAg0AIAEgASkDMDcDECABQThqIABBmiEgAUEQahDeA0EAIQMLAkACQCADIgMNACADIQMMAQsgAyEDIAEoAiRB//8BRw0AIAEgASkDKDcDCCABQThqIABBjSEgAUEIahDeA0EAIQMLAkAgAyIDRQ0AIAAoAuwBIQIgACABKAIkIAMvAQJB9ANBABDSAiACQQ0gAxCqAwsgAUHAAGokAAtHAQF/IwBBEGsiAiQAIAJBCGogACABIABBiANqIABBhANqLQAAEK8CAkAgACgC7AEiAEUNACAAIAIpAwg3AyALIAJBEGokAAvABAEKfyMAQTBrIgIkACAAQeAAaiEDAkACQCAALQBDQX9qIgRBAUYNACADIQMgBCEEDAELIAIgAykDADcDIAJAIAAgAkEgahD0Aw0AIAMhA0EBIQQMAQsgAiADKQMANwMYIAAgAkEYahDzAyIEKAIMIQMgBC8BCCEECyAEIQUgAyEGIABBiANqIQcCQAJAIAEtAARBAXFFDQAgByEDIAVFDQEgAEH0BGohCCAHIQRBACEJQQAhCiAAKADkASIDIAMoAmBqIAEvAQZBAnRqIQEDQCABIQMgCiEKIAkhCQJAAkAgCCAEIgRrIgFBAEgNACADLQACIQsgAiAGIAlBA3RqKQMANwMQIAAgCyAEIAEgAkEQahBJIgFFDQAgCiELAkAgCg0AIAMtAANBHnRBH3UgA3EhCwsgCyEKIAQgAWohBCADQQRqIQECQAJAAkAgAy8BBEUNACABIQMMAQsgCiEDIAoNACABIQFBACEKQQEhCwwBCyADIQEgCiEKQQAhCwsgBCEDDAELIAMhASAKIQpBASELIAQhAwsgAyEDIAohCiABIQECQCALRQ0AIAMhAwwDCyADIQQgCUEBaiILIQkgCiEKIAEhASADIQMgCyAFRw0ADAILAAsgByEDAkACQCAFDgICAQALIAIgBTYCACACQShqIABBy8EAIAIQ2wMgByEDDAELIAEvAQYhAyACIAYpAwA3AwggByAAIAMgB0HsASACQQhqEElqIQMLIABBhANqIAMgB2s6AAAgAkEwaiQAC9cBAgN/AX4jAEHAAGsiASQAIAEgACkDWCIENwMoIAEgBDcDGCABIAQ3AzAgACABQRhqIAFBJGoQggMiAiEDAkAgAg0AIAEgASkDMDcDECABQThqIABBmiEgAUEQahDeA0EAIQMLAkACQCADIgMNACADIQMMAQsgAyEDIAEoAiRB//8BRw0AIAEgASkDKDcDCCABQThqIABBjSEgAUEIahDeA0EAIQMLAkAgAyIDRQ0AIAAgAxCyAiAAIAEoAiQgAy8BAkH/H3FBgMAAchDUAgsgAUHAAGokAAuNAQIBfwF+IwBBMGsiAyQAIAMgAikDACIENwMQIAMgBDcDIAJAAkAgASADQRBqIANBHGoQggMNACADIAMpAyA3AwggA0EoaiABQZohIANBCGoQ3gMgAEIANwMADAELAkAgAygCHCIBQf//AUcNACAAQgA3AwAMAQsgACABNgIAIABBAjYCBAsgA0EwaiQAC4kBAgJ/AX4jAEEwayIDJAAgAyACKQMAIgU3AxAgAyAFNwMgIAEgA0EQaiADQRxqEIIDIgQhAgJAIAQNACADIAMpAyA3AwggA0EoaiABQZohIANBCGoQ3gNBACECCwJAAkAgAiIBDQAgAEIANwMADAELIAAgAS8BADYCACAAQQQ2AgQLIANBMGokAAuGAQICfwF+IwBBMGsiAyQAIAMgAikDACIFNwMQIAMgBTcDICABIANBEGogA0EcahCCAyIEIQICQCAEDQAgAyADKQMgNwMIIANBKGogAUGaISADQQhqEN4DQQAhAgsCQAJAIAIiAQ0AIABCADcDAAwBCyAAIAEvAQJB/x9xEOkDCyADQTBqJAALzgECA38BfiMAQcAAayIBJAAgASAAKQNYIgQ3AyggASAENwMYIAEgBDcDMCAAIAFBGGogAUEkahCCAyICIQMCQCACDQAgASABKQMwNwMQIAFBOGogAEGaISABQRBqEN4DQQAhAwsCQAJAIAMiAw0AIAMhAwwBCyADIQMgASgCJEH//wFHDQAgASABKQMoNwMIIAFBOGogAEGNISABQQhqEN4DQQAhAwsCQCADIgNFDQAgACADELICIAAgASgCJCADLwECENQCCyABQcAAaiQAC2QBAn8jAEEQayIDJAACQAJAAkAgAigCBCIEQYCAwP8HcQ0AIARBD3FBAkYNAQsgAyACKQMANwMIIAAgAUHZACADQQhqEN0DDAELIAAgASACKAIAEIYDQQBHEOoDCyADQRBqJAALYwECfyMAQRBrIgMkAAJAAkACQCACKAIEIgRBgIDA/wdxDQAgBEEPcUECRg0BCyADIAIpAwA3AwggACABQdkAIANBCGoQ3QMMAQsgACABIAEgAigCABCFAxD+AgsgA0EQaiQAC4kCAgV/AX4jAEEwayIBJAAgASAAKQNYNwMoAkACQAJAIAEoAiwiAkGAgMD/B3ENACACQQ9xQQJGDQELIAEgASkDKDcDECABQSBqIABB2QAgAUEQahDdA0H//wEhAgwBCyABKAIoIQILAkAgAiICQf//AUYNACAAQQAQogMhAyABIABB6ABqKQMAIgY3AyggASAGNwMIIAAgAUEIaiABQRxqEPIDIQQCQCADQYCABEkNACABQSBqIABB3QAQ3wMMAQsCQCABKAIcIgVB7QFJDQAgAUEgaiAAQd4AEN8DDAELIABBhANqIAU6AAAgAEGIA2ogBCAFEKEGGiAAIAIgAxDUAgsgAUEwaiQAC2kCAX8BfiMAQSBrIgMkACADIAIpAwAiBDcDCCADIAQ3AxACQAJAIAEgA0EIahCBAyICDQAgAyADKQMQNwMAIANBGGogAUGdASADEN0DIABCADcDAAwBCyAAIAIoAgQQ6QMLIANBIGokAAtwAgF/AX4jAEEgayIDJAAgAyACKQMAIgQ3AwggAyAENwMQAkACQCABIANBCGoQgQMiAg0AIAMgAykDEDcDACADQRhqIAFBnQEgAxDdAyAAQgA3AwAMAQsgACACLwEANgIAIABBBDYCBAsgA0EgaiQAC5gBAgJ/AX4jAEEwayIBJAAgASAAKQNYIgM3AxggASADNwMgAkACQCAAIAFBGGoQgQMiAg0AIAEgASkDIDcDCCABQShqIABBnQEgAUEIahDdAwwBCyABIABB4ABqKQMAIgM3AxAgASADNwMgIAFBKGogACACIAFBEGoQiQMgACgC7AEiAEUNACAAIAEpAyg3AyALIAFBMGokAAuKAQICfwF+IwBBIGsiASQAIAEgACkDWCIDNwMIIAEgAzcDEAJAAkAgACABQQhqEIEDIgINACABIAEpAxA3AwAgAUEYaiAAQZ0BIAEQ3QMMAQsgAUEYaiAAIAAgAiAAQQAQogNB//8DcRCkAhD/AiAAKALsASIARQ0AIAAgASkDGDcDIAsgAUEgaiQAC8EBAgJ/AX4jAEEwayIBJAAgASAAKQNYIgM3AxggASADNwMgAkACQAJAIAAgAUEYahCBAw0AIAEgASkDIDcDACABQShqIABBnQEgARDdAwwBCyABIABB4ABqKQMAIgM3AxAgASADNwMoIAAgAUEQahCUAiICRQ0AIAEgACkDWCIDNwMIIAEgAzcDKCAAIAFBCGoQgAMiAEF/TA0BIAIgAEGAgAJzOwESCyABQTBqJAAPC0GZ3ABBh84AQTFBwScQgwYAC/UBAgR/AX4jAEEQayIBJAAgASAAQeAAaikDACIFNwMAIAEgBTcDCCAAIAFBABDIAyECIABBARCiAyEDAkACQEGfKkEAELIFRQ0AIAFBCGogAEGuP0EAENsDDAELAkAQQQ0AIAFBCGogAEGpN0EAENsDDAELAkACQCACRQ0AIAMNAQsgAUEIaiAAQbc8QQAQ2QMMAQtBAEEONgKghQICQCAAKALsASIERQ0AIAQgACkDYDcDIAtBAEEBOgD4gAIgAiADED4hAkEAQQA6APiAAgJAIAJFDQBBAEEANgKghQIgAEF/EKYDCyAAQQAQpgMLIAFBEGokAAvxAgIDfwF+IwBBIGsiAyQAAkACQBBwIgRFDQAgBC8BCA0AIARBFRDyAiEFIANBEGpBrwEQyQMgAyADKQMQNwMIIANBGGogBCAFIANBCGoQjwMgAykDGFANAEIAIQZBsAEhBQJAAkACQAJAAkAgAEF/ag4EBAABAwILQQBBADYCoIUCQgAhBkGxASEFDAMLQQBBADYCoIUCEEACQCABDQBCACEGQbIBIQUMAwsgA0EQaiAEQQggBCABIAIQmAEQ6wMgAykDECEGQbIBIQUMAgtBgMcAQSxBjREQ/gUACyADQRBqIARBCCAEIAEgAhCTARDrAyADKQMQIQZBswEhBQsgBSEAIAYhBgJAQQAtAPiAAg0AIAQQiQQNAgsgBEEDOgBDIAQgAykDGDcDWCADQRBqIAAQyQMgBEHgAGogAykDEDcDACAEQegAaiAGNwMAIARBAkEBEH0aCyADQSBqJAAPC0Hd4gBBgMcAQTFBjREQgwYACy8BAX8CQAJAQQAoAqCFAg0AQX8hAQwBCxBAQQBBADYCoIUCQQAhAQsgACABEKYDC6YBAgN/AX4jAEEgayIBJAACQAJAQQAoAqCFAg0AIABBnH8QpgMMAQsgASAAQeAAaikDACIENwMIIAEgBDcDEAJAAkAgACABQQhqIAFBHGoQ8gMiAg0AQZt/IQIMAQsCQCAAKALsASIDRQ0AIAMgACkDYDcDIAtBAEEBOgD4gAIgAiABKAIcED8hAkEAQQA6APiAAiACIQILIAAgAhCmAwsgAUEgaiQAC0UBAX8jAEEQayIDJAAgAyACKQMANwMIAkACQCABIANBCGoQ4gMiAkF/Sg0AIABCADcDAAwBCyAAIAIQ6QMLIANBEGokAAtGAQF/IwBBEGsiAyQAIAMgAikDADcDAAJAAkAgASADIANBDGoQyANFDQAgACADKAIMEOkDDAELIABCADcDAAsgA0EQaiQAC4oBAgN/AX4jAEEgayIBJAAgASAAKQNYNwMYIABBABCiAyECIAEgASkDGDcDEAJAIAAgAUEQaiACEOEDIgJBf0oNACAAKALsASIDRQ0AIANBACkDoIsBNwMgCyABIAApA1giBDcDCCABIAQ3AxggACAAIAFBCGpBABDIAyACahDlAxCmAyABQSBqJAALWgECfyMAQSBrIgEkACABIAApA1g3AxAgAEEAEKIDIQIgASABKQMQNwMIIAFBGGogACABQQhqIAIQmwMCQCAAKALsASIARQ0AIAAgASkDGDcDIAsgAUEgaiQAC2wCA38BfiMAQSBrIgEkACAAQQAQogMhAiAAQQFB/////wcQoQMhAyABIAApA1giBDcDCCABIAQ3AxAgAUEYaiAAIAFBCGogAiADENEDAkAgACgC7AEiAEUNACAAIAEpAxg3AyALIAFBIGokAAuDAgEJfyMAQRBrIgEkAAJAAkACQAJAIAAtAEMiAkF/aiIDRQ0AIAJBAUsNAUEAIQQMAgsgAUEAEMkDIAAoAuwBIgVFDQIgBSABKQMANwMgDAILQQAhBUEAIQYDQCAAIAYiBhCiAyABQQxqEOMDIAVqIgUhBCAFIQUgBkEBaiIHIQYgByADRw0ACwsCQCAAIAEgBCIIIAMQlgEiCUUNAAJAIAJBAU0NAEEAIQVBACEGA0AgBSIHQQFqIgQhBSAAIAcQogMgCSAGIgZqEOMDIAZqIQYgBCADRw0ACwsgACABIAggAxCXAQsgACgC7AEiBUUNACAFIAEpAwA3AyALIAFBEGokAAu0AwIOfwF+IwBBwABrIgEkACABIAApA1giDzcDOCABIA83AxggACABQRhqIAFBNGoQyAMhAiABIABB4ABqKQMAIg83AyggASAPNwMQIAAgAUEQaiABQSRqEMgDIQMgASABKQM4NwMIIAAgAUEIahDiAyEEIABBARCiAyEFIABBAiAEEKEDIQYgASABKQM4NwMAIAAgASAFEOEDIQQCQAJAIAMNAEF/IQcMAQsCQCAEQQBODQBBfyEHDAELQX8hByAFIAYgBkEfdSIIcyAIayIJTg0AIAEoAjQhCiABKAIkIQsgBCEEQX8hCCAFIQUDQCAFIQUgCCEIAkAgCyAEIgRqIApNDQAgCCEHDAILAkAgAiAEaiADIAsQuwYiBw0AIAZBf0wNACAFIQcMAgsgCCAFIAcbIQwgCiAEQQFqIgggCiAIShsiDUF/aiEIIAVBAWohDiAEIQUCQANAAkAgBSIEIAhHDQAgDSEHDAILIARBAWoiBCEFIAQhByACIARqLQAAQcABcUGAAUYNAAsLIAchBCAMIQggDiEFIAwhByAOIAlHDQALCyAAIAcQpgMgAUHAAGokAAsJACAAQQEQzAIL4gECBX8BfiMAQTBrIgIkACACIAApA1giBzcDKCACIAc3AxACQCAAIAJBEGogAkEkahDIAyIDRQ0AIAJBGGogACADIAIoAiQQzAMgAiACKQMYNwMIIAAgAkEIaiACQSRqEMgDIgRFDQACQCACKAIkRQ0AQSBBYCABGyEFQb9/QZ9/IAEbIQZBACEDA0AgBCADIgNqIgEgAS0AACIBIAVBACABIAZqQf8BcUEaSRtqOgAAIANBAWoiASEDIAEgAigCJEkNAAsLIAAoAuwBIgNFDQAgAyACKQMYNwMgCyACQTBqJAALCQAgAEEAEMwCC6gEAQR/IwBBwABrIgQkACAEIAIpAwA3AxgCQAJAAkACQCABIARBGGoQ9QNBfnFBAkYNACAEIAIpAwA3AxAgACABIARBEGoQzQMMAQsgBCACKQMANwMgQX8hBQJAIANB5AAgAxsiA0EKSQ0AIARBPGpBADoAACAEQgA3AjQgBEEANgIsIAQgATYCKCAEIAQpAyA3AwggBCADQX1qNgIwIARBKGogBEEIahDPAiAEKAIsIgZBA2oiByADSw0CIAYhBQJAIAQtADxFDQAgBCAEKAI0QQNqNgI0IAchBQsgBCgCNCEGIAUhBQsgBiEGAkAgBSIFQX9HDQAgAEIANwMADAELIAEgACAFIAYQlgEiBUUNACAEIAIpAwA3AyAgBiECQX8hBgJAIANBCkkNACAEQQA6ADwgBCAFNgI4IARBADYCNCAEQQA2AiwgBCABNgIoIAQgBCkDIDcDACAEIANBfWo2AjAgBEEoaiAEEM8CIAQoAiwiAkEDaiIHIANLDQMCQCAELQA8IgNFDQAgBCAEKAI0QQNqNgI0CyAEKAI0IQYCQCADRQ0AIAQgAkEBaiIDNgIsIAUgAmpBLjoAACAEIAJBAmoiAjYCLCAFIANqQS46AAAgBCAHNgIsIAUgAmpBLjoAAAsgBiECIAQoAiwhBgsgASAAIAYgAhCXAQsgBEHAAGokAA8LQYsyQZvHAEGqAUH5JBCDBgALQYsyQZvHAEGqAUH5JBCDBgALyAQBBX8jAEHgAGsiAiQAAkAgAC0AFA0AIAAoAgAhAyACIAEpAwA3A1ACQCADIAJB0ABqEI0BRQ0AIABByNAAENACDAELIAIgASkDADcDSAJAIAMgAkHIAGoQ9QMiBEEJRw0AIAIgASkDADcDACAAIAMgAiACQdgAahDIAyACKAJYEOcCIgEQ0AIgARAgDAELAkACQCAEQX5xQQJHDQAgASgCBCIEQYCAwP8HcQ0BIARBD3FBBkcNAQsgAiABKQMANwMQIAJB2ABqIAMgAkEQahDNAyABIAIpA1g3AwAgAiABKQMANwMIIAAgAyACQQhqIAJB2ABqEMgDENACDAELIAIgASkDADcDQCADIAJBwABqEI4BIAIgASkDADcDOAJAAkAgAyACQThqEPQDRQ0AIAIgASkDADcDKCADIAJBKGoQ8wMhBCACQdsAOwBYIAAgAkHYAGoQ0AICQCAELwEIRQ0AQQAhBQNAIAIgBCgCDCAFIgVBA3RqKQMANwMgIAAgAkEgahDPAiAALQAUDQECQCAFIAQvAQhBf2pGDQAgAkEsOwBYIAAgAkHYAGoQ0AILIAVBAWoiBiEFIAYgBC8BCEkNAAsLIAJB3QA7AFggACACQdgAahDQAgwBCyACIAEpAwA3AzAgAyACQTBqEJUDIQQgAkH7ADsAWCAAIAJB2ABqENACAkAgBEUNACADIAQgAEEPEPECGgsgAkH9ADsAWCAAIAJB2ABqENACCyACIAEpAwA3AxggAyACQRhqEI8BCyACQeAAaiQAC4MCAQR/AkAgAC0AFA0AIAEQ0AYiAiEDAkAgAiAAKAIIIAAoAgRrIgRNDQAgAEEBOgAUAkAgBEEBTg0AIAQhAwwBCyAEIQMgASAEQX9qIgRqLAAAQX9KDQAgBCECA0ACQCABIAIiBGotAABBwAFxQYABRg0AIAQhAwwCCyAEQX9qIQJBACEDIARBAEoNAAsLAkAgAyIFRQ0AQQAhBANAAkAgASAEIgRqIgMtAABBwAFxQYABRg0AIAAgACgCDEEBajYCDAsCQCAAKAIQIgJFDQAgAiAAKAIEIARqaiADLQAAOgAACyAEQQFqIgMhBCADIAVHDQALCyAAIAAoAgQgBWo2AgQLC7gCAQZ/IwBBMGsiBCQAAkAgAS0AFA0AIAQgAikDADcDIAJAAkAgACAEQSBqEMUDRQ0AIAQgAikDADcDGCAAIARBGGogBEEsahDIAyEFIAQoAiwiBkUhAAJAAkAgBg0AIAAhBwwBCyAAIQhBACEJA0AgCCEHAkAgBSAJIgBqLQAAIghB3wFxQb9/akH/AXFBGkkNACAIQd8ARg0AIAchByAAQQBHIAhBUGpB/wFxQQpJcUUNAgsgAEEBaiIAIAZPIgchCCAAIQkgByEHIAAgBkcNAAsLIAdBAXFFDQAgASAFENACDAELIAQgAikDADcDECABIARBEGoQzwILIARBOjsALCABIARBLGoQ0AIgBCADKQMANwMIIAEgBEEIahDPAiAEQSw7ACwgASAEQSxqENACCyAEQTBqJAAL0QIBAn8CQAJAIAAvAQgNAAJAAkAgACABEIYDRQ0AIABB9ARqIgUgASACIAQQsgMiBkUNACAGKAIEQaD3NiADIANB34hJakHgiElJG2ogACgCgAJPDQEgBSAGEK4DCyAAKALsASIARQ0CIAAgAjsBFCAAIAE7ARIgAEEUOwEKIAAgBDsBCCAAIAAtABBB8AFxQQFyOgAQIABBABB4DwsgACABEIYDIQQgBSAGELADIQEgAEGAA2pCADcDACAAQgA3A/gCIABBhgNqIAEvAQI7AQAgAEGEA2ogAS0AFDoAACAAQYUDaiAELQAEOgAAIABB/AJqIARBACAELQAEa0EMbGpBZGopAwA3AgAgAUEIaiEEAkACQCABLQAUIgFBCk8NACAEIQQMAQsgBCgCACEECyAAQYgDaiAEIAEQoQYaCw8LQdzWAEHYzQBBLUGoHhCDBgALMwACQCAALQAQQQ5xQQJHDQAgACgCLCAAKAIIEFILIABCADcDCCAAIAAtABBB8AFxOgAQC6MCAQJ/AkACQCAALwEIDQACQCACQYBgcUGAwABHDQAgAEH0BGoiAyABIAJB/59/cUGAIHJBABCyAyIERQ0AIAMgBBCuAwsgACgC7AEiA0UNASADIAI7ARQgAyABOwESIABBhANqLQAAIQIgAyADLQAQQfABcUECcjoAECADIAAgAhCKASIBNgIIAkAgAUUNACADIAI6AAwgASAAQYgDaiACEKEGGgsCQCAAKAKQAkEAIAAoAoACIgJBnH9qIgEgASACSxsiAU8NACAAIAE2ApACCyAAIAAoApACQRRqIgQ2ApACQQAhAQJAIAQgAmsiAkEASA0AIAAgACgClAJBAWo2ApQCIAIhAQsgAyABEHgLDwtB3NYAQdjNAEHjAEGmPBCDBgAL+wEBBH8CQAJAIAAvAQgNACAAKALsASIBRQ0BIAFB//8BOwESIAEgAEGGA2ovAQA7ARQgAEGEA2otAAAhAiABIAEtABBB8AFxQQNyOgAQIAEgACACQRBqIgMQigEiAjYCCAJAIAJFDQAgASADOgAMIAIgAEH4AmogAxChBhoLAkAgACgCkAJBACAAKAKAAiICQZx/aiIDIAMgAksbIgNPDQAgACADNgKQAgsgACAAKAKQAkEUaiIENgKQAkEAIQMCQCAEIAJrIgJBAEgNACAAIAAoApQCQQFqNgKUAiACIQMLIAEgAxB4Cw8LQdzWAEHYzQBB9wBB4QwQgwYAC50CAgN/AX4jAEHQAGsiAyQAAkAgAC8BCA0AIAMgAikDADcDQAJAIAAgA0HAAGogA0HMAGoQyAMiAkEKEM0GRQ0AIAEhBCACEIwGIgUhAANAIAAiAiEAAkADQAJAAkAgACIALQAADgsDAQEBAQEBAQEBAAELIABBADoAACADIAI2AjQgAyAENgIwQeEaIANBMGoQOyAAQQFqIQAMAwsgAEEBaiEADAALAAsLAkAgAi0AAEUNACADIAI2AiQgAyABNgIgQeEaIANBIGoQOwsgBRAgDAELAkAgAUEjRw0AIAApA4ACIQYgAyACNgIEIAMgBj4CAEGyGSADEDsMAQsgAyACNgIUIAMgATYCEEHhGiADQRBqEDsLIANB0ABqJAALmAICA38BfiMAQSBrIgMkAAJAAkAgAUGFA2otAABB/wFHDQAgAEIANwMADAELAkAgAUELQSAQiQEiBA0AIABCADcDAAwBCyADQRhqIAFBCCAEEOsDIAMgAykDGDcDECABIANBEGoQjgEgBCABIAFBiANqIAFBhANqLQAAEJMBIgU2AhwCQAJAIAUNACADIAMpAxg3AwAgASADEI8BQgAhBgwBCyAEIAFB/AJqKQIANwMIIAQgAS0AhQM6ABUgBCABQYYDai8BADsBECABQfsCai0AACEFIAQgAjsBEiAEIAU6ABQgBCABLwH4AjsBFiADIAMpAxg3AwggASADQQhqEI8BIAMpAxghBgsgACAGNwMACyADQSBqJAALlwICAn8BfiMAQTBrIgMkACADIAE2AiAgA0ECNgIkIAMgAykDIDcDECADQShqIAAgA0EQakHhABCYAyADIAMpAyA3AwggAyADKQMoNwMAIANBGGogACADQQhqIAMQigMCQAJAIAMpAxgiBVANACAALwEIDQAgAC0ARg0AIAAQiQQNASAAIAU3A1ggAEECOgBDIABB4ABqIgRCADcDACADQShqIAAgARDXAiAEIAMpAyg3AwAgAEEBQQEQfRoLAkAgAkUNACAAKALwASICRQ0AIAIhAgNAAkAgAiICLwESIAFHDQAgAiAAKAKAAhB3CyACKAIAIgQhAiAEDQALCyADQTBqJAAPC0Hd4gBB2M0AQdUBQeIfEIMGAAvrCQIHfwF+IwBBEGsiASQAQQEhAgJAAkAgAC0AEEEPcSIDDgUBAAAAAQALAkACQAJAAkACQAJAIANBf2oOBQABAgQDBAsCQCAAKAIsIAAvARIQhgMNACAAQQAQdyAAIAAtABBB3wFxOgAQQQAhAgwGCyAAKAIsIQICQCAALQAQIgNBIHFFDQAgACADQd8BcToAECACQfQEaiIEIAAvARIgAC8BFCAALwEIELIDIgVFDQAgAiAALwESEIYDIQMgBCAFELADIQAgAkGAA2pCADcDACACQgA3A/gCIAJBhgNqIAAvAQI7AQAgAkGEA2ogAC0AFDoAACACQYUDaiADLQAEOgAAIAJB/AJqIANBACADLQAEa0EMbGpBZGopAwA3AgAgAEEIaiEDAkACQCAALQAUIgBBCk8NACADIQMMAQsgAygCACEDCyACQYgDaiADIAAQoQYaQQEhAgwGCyAAKAIYIAIoAoACSw0EIAFBADYCDEEAIQUCQCAALwEIIgNFDQAgAiADIAFBDGoQjQQhBQsgAC8BFCEGIAAvARIhBCABKAIMIQMgAkH7AmpBAToAACACQfoCaiADQQdqQfwBcToAACACIAQQhgMiB0EAIActAARrQQxsakFkaikDACEIIAJBhANqIAM6AAAgAkH8AmogCDcCACACIAQQhgMtAAQhBCACQYYDaiAGOwEAIAJBhQNqIAQ6AAACQCAFIgRFDQAgAkGIA2ogBCADEKEGGgsCQAJAIAJB+AJqEN8FIgNFDQACQCAAKAIsIgIoApACQQAgAigCgAIiBUGcf2oiBCAEIAVLGyIETw0AIAIgBDYCkAILIAIgAigCkAJBFGoiBjYCkAJBAyEEIAYgBWsiBUEDSA0BIAIgAigClAJBAWo2ApQCIAUhBAwBCwJAIAAvAQoiAkHnB0sNACAAIAJBAXQ7AQoLIAAvAQohBAsgACAEEHggA0UNBCADRSECDAULAkAgACgCLCAALwESEIYDDQAgAEEAEHdBACECDAULIAAoAgghBSAALwEUIQYgAC8BEiEEIAAtAAwhAyAAKAIsIgJB+wJqQQE6AAAgAkH6AmogA0EHakH8AXE6AAAgAiAEEIYDIgdBACAHLQAEa0EMbGpBZGopAwAhCCACQYQDaiADOgAAIAJB/AJqIAg3AgAgAiAEEIYDLQAEIQQgAkGGA2ogBjsBACACQYUDaiAEOgAAAkAgBUUNACACQYgDaiAFIAMQoQYaCwJAIAJB+AJqEN8FIgINACACRSECDAULAkAgACgCLCICKAKQAkEAIAIoAoACIgNBnH9qIgQgBCADSxsiBE8NACACIAQ2ApACCyACIAIoApACQRRqIgU2ApACQQMhBAJAIAUgA2siA0EDSA0AIAIgAigClAJBAWo2ApQCIAMhBAsgACAEEHhBACECDAQLIAAoAggQ3wUiAkUhAwJAIAINACADIQIMBAsCQCAAKAIsIgIoApACQQAgAigCgAIiBEGcf2oiBSAFIARLGyIFTw0AIAIgBTYCkAILIAIgAigCkAJBFGoiBjYCkAJBAyEFAkAgBiAEayIEQQNIDQAgAiACKAKUAkEBajYClAIgBCEFCyAAIAUQeCADIQIMAwsgACgCCC0AAEEARyECDAILQdjNAEGTA0GoJRD+BQALQQAhAgsgAUEQaiQAIAILkQYCB38BfiMAQSBrIgMkAAJAAkAgAC0ARg0AIABB+AJqIAIgAi0ADEEQahChBhoCQCAAQfsCai0AAEEBcUUNACAAQfwCaikCABDbAlINACAAQRUQ8gIhAiADQRhqQaQBEMkDIAMgAykDGDcDCCADQRBqIAAgAiADQQhqEI8DIAMpAxAiClANACAALwEIDQAgAC0ARg0AIAAQiQQNAiAAIAo3A1ggAEECOgBDIABB4ABqIgJCADcDACADQRhqIABB//8BENcCIAIgAykDGDcDACAAQQFBARB9GgsCQCAALwFMRQ0AIABB9ARqIgQhBUEAIQIDQAJAIAAgAiIGEIYDIgJFDQACQAJAIAAtAIUDIgcNACAALwGGA0UNAQsgAi0ABCAHRw0BCyACQQAgAi0ABGtBDGxqQWRqKQMAIAApAvwCUg0AIAAQgAECQCAALQD7AkEBcQ0AAkAgAC0AhQNBMEsNACAALwGGA0H/gQJxQYOAAkcNACAEIAYgACgCgAJB8LF/ahCzAwwBCyAAKALwASIIIQJBACEHAkAgCEUNAANAIAchBwJAAkAgAiICLQAQQQ9xQQFGDQAgByEHDAELAkAgAC8BhgMiCA0AIAchBwwBCwJAIAggAi8BFEYNACAHIQcMAQsCQCAAIAIvARIQhgMiCA0AIAchBwwBCwJAAkAgAC0AhQMiCQ0AIAAvAYYDRQ0BCyAILQAEIAlGDQAgByEHDAELAkAgCEEAIAgtAARrQQxsakFkaikDACAAKQL8AlENACAHIQcMAQsCQCAAIAIvARIgAi8BCBDcAiIIDQAgByEHDAELIAUgCBCwAxogAiACLQAQQSByOgAQIAdBAWohBwsgAigCACIIIQIgByIJIQcgCA0ACyAJQQBKDQELQQAhBwNAIAUgBiAALwGGAyAHELUDIgJFDQEgAiEHIAAgAi8BACACLwEWENwCRQ0ACwsgACAGQQAQ2AILIAZBAWoiBiECIAYgAC8BTEkNAAsLIAAQgwELIANBIGokAA8LQd3iAEHYzQBB1QFB4h8QgwYACxAAEPYFQvin7aj3tJKRW4UL0wIBBn8jAEEQayIDJAAgAEGIA2ohBCAAQYQDai0AACEFAkACQAJAAkAgAg0AIAUhBSAEIQQMAQsgACACIANBDGoQjQQhBgJAAkAgAygCDCIHIAAtAIQDTg0AIAQgB2otAAANACAGIAQgBxC7Bg0AIAdBAWohBwwBC0EAIQcLIAciB0UNASAFIAdrIQUgBCAHaiEECyAEIQcgBSEEAkACQCAAQfQEaiIIIAEgAEGGA2ovAQAgAhCyAyIFRQ0AAkAgBCAFLQAURw0AIAUhBQwCCyAIIAUQrgMLQQAhBQsgBSIGIQUCQCAGDQAgCCABIAAvAYYDIAQQsQMiASACOwEWIAEhBQsgBSICQQhqIQECQAJAIAItABRBCk8NACABIQEMAQsgASgCACEBCyABIAcgBBChBhogAiAAKQOAAj4CBCACIQAMAQtBACEACyADQRBqJAAgAAspAQF/AkAgAC0ABiIBQSBxRQ0AIAAgAUHfAXE6AAZB+zpBABA7EJoFCwu4AQEEfwJAIAAtAAYiAkEEcQ0AAkAgAkEIcQ0AIAEQkAUhAiAAQcUAIAEQkQUgAhBMCyAALwFMIgNFDQAgACgC9AEhBEEAIQIDQAJAIAQgAiICQQJ0aigCACIFRQ0AIAUoAgggAUcNACAAQfQEaiACELQDIABBkANqQn83AwAgAEGIA2pCfzcDACAAQYADakJ/NwMAIABCfzcD+AIgACACQQEQ2AIPCyACQQFqIgUhAiAFIANHDQALCwsrACAAQn83A/gCIABBkANqQn83AwAgAEGIA2pCfzcDACAAQYADakJ/NwMACygAQQAQ2wIQlwUgACAALQAGQQRyOgAGEJkFIAAgAC0ABkH7AXE6AAYLIAAgACAALQAGQQRyOgAGEJkFIAAgAC0ABkH7AXE6AAYLtgcCB38BfiMAQYABayIDJAACQAJAIAAgAhCDAyIEDQBBfiEEDAELAkAgASkDAEIAUg0AIAMgACAELwEAQQAQjQQiBTYCcCADQQA2AnQgA0H4AGogAEGMDSADQfAAahDLAyABIAMpA3giCjcDACADIAo3A3ggAC8BTEUNAEEAIQQDQCAEIQZBACEEAkADQAJAIAAoAvQBIAQiBEECdGooAgAiB0UNACADIAcpAwA3A2ggAyADKQN4NwNgIAAgA0HoAGogA0HgAGoQ+gMNAgsgBEEBaiIHIQQgByAALwFMSQ0ADAMLAAsgAyAFNgJQIAMgBkEBaiIENgJUIANB+ABqIABBjA0gA0HQAGoQywMgASADKQN4Igo3AwAgAyAKNwN4IAQhBCAALwFMDQALCyADIAEpAwA3A3gCQCAALwFMRQ0AQQAhBAJAA0ACQCAAKAL0ASAEIgRBAnRqKAIAIgdFDQAgAyAHKQMANwNIIAMgAykDeDcDQCAAIANByABqIANBwABqEPoDRQ0AIAQhBAwCCyAEQQFqIgchBCAHIAAvAUxJDQALQX8hBAsgBEEASA0AIAMgASkDADcDOCADIAAgA0E4akEAEMgDNgIwQekVIANBMGoQO0F9IQQMAQsgAyABKQMANwMoIAAgA0EoahCOASADIAEpAwA3AyACQAJAIAAgA0EgakEAEMgDIggNAEF/IQcMAQsCQCAAQRAQigEiCQ0AQX8hBwwBCwJAAkACQCAALwFMIgUNAEEAIQQMAQsCQAJAIAAoAvQBIgYoAgANACAFQQBHIQdBACEEDAELQQAhBwJAAkADQCAHQQFqIgQgBUYNASAEIQcgBiAEQQJ0aigCAEUNAgwACwALIAUhBAwCCyAEIAVJIQcgBCEECyAEIgYhBCAGIQYgBw0BCyAEIQQCQAJAIAAgBUEBdEECaiIHQQJ0EIoBIgUNACAAIAkQUkF/IQRBBSEFDAELIAUgACgC9AEgAC8BTEECdBChBiEFIAAgACgC9AEQUiAAIAc7AUwgACAFNgL0ASAEIQRBACEFCyAEIgQhBiAEIQcgBQ4GAAICAgIBAgsgBiEEIAkgCCACEJgFIgc2AggCQCAHDQAgACAJEFJBfyEHDAELIAkgASkDADcDACAAKAL0ASAEQQJ0aiAJNgIAIAAgAC0ABkEgcjoABiADIAQ2AhQgAyAINgIQQf3CACADQRBqEDsgBCEHCyADIAEpAwA3AwggACADQQhqEI8BIAchBAsgA0GAAWokACAECxMAQQBBACgC/IACIAByNgL8gAILFgBBAEEAKAL8gAIgAEF/c3E2AvyAAgsJAEEAKAL8gAILOAEBfwJAAkAgAC8BDkUNAAJAIAApAgQQ9gVSDQBBAA8LQQAhASAAKQIEENsCUQ0BC0EBIQELIAELHwEBfyAAIAEgACABQQBBABDoAhAfIgJBABDoAhogAgv2AwEJfyMAQRBrIgQkAEEAIQUCQCACRQ0AIAJBIjoAACACQQFqIQULIAUhAgJAAkAgAQ0AIAIhBUEDIQJBACEGDAELQQAhBUEAIQZBASEHIAIhAgNAIAIhAiAHIQggBiEGIAQgACAFIgdqLAAAIgU6AA8CQAJAAkACQAJAAkACQAJAIAVBd2oOGgIABQUBBQUFBQUFBQUFBQUFBQUFBQUFBQUEAwsgBEHuADoADwwDCyAEQfIAOgAPDAILIARB9AA6AA8MAQsgBUHcAEcNAQsgCEECaiEFAkACQCACDQBBACEJDAELIAJB3AA6AAAgAiAELQAPOgABIAJBAmohCQsgBSEKDAELAkAgBUEgSA0AAkACQCACDQBBACECDAELIAIgBToAACACQQFqIQILIAIhCSAIQQFqIQogBiAELQAPQcABcUGAAUZqIQIMAgsgCEEGaiEFAkAgAg0AQQAhCSAFIQoMAQsgAkHc6sGBAzYAACACQQRqIARBD2pBARCBBiACQQZqIQkgBSEKCyAGIQILIAdBAWoiCCEFIAIiCyEGIAoiDCEHIAkiCiECIAggAUcNAAsgCiEFIAxBAmohAiALIQYLIAYhBiACIQICQCAFIgVFDQAgBUEiOwAACwJAIANFDQAgAyACIAZrNgIACyAEQRBqJAAgAgvGAwIFfwF+IwBBMGsiBSQAAkAgAiADai0AAA0AIAVBADoALiAFQQA7ASwgBUEANgIoIAUgAzYCJCAFIAI2AiAgBSACNgIcIAUgATYCGCAFQRBqIAVBGGoQ6gICQCAFLQAuDQAgBSgCICEBIAUoAiQhBgNAIAIhByABIQICQAJAIAYiAw0AIAVB//8DOwEsIAIhAiADIQNBfyEBDAELIAUgAkEBaiIBNgIgIAUgA0F/aiIDNgIkIAUgAiwAACIGOwEsIAEhAiADIQMgBiEBCyADIQYgAiEIAkACQCABIglBd2oiAUEXSw0AIAchAkEBIQNBASABdEGTgIAEcQ0BCyAJIQJBACEDCyAIIQEgBiEGIAIiCCECIAMNAAsgCEF/Rg0AIAVBAToALgsCQAJAIAUtAC5FDQACQCAEDQBCACEKDAILAkAgBS4BLCICQX9HDQAgBUEIaiAFKAIYQaEOQQAQ4ANCACEKDAILIAUgAjYCACAFIAUoAhxBf3MgBSgCIGo2AgQgBUEIaiAFKAIYQcDCACAFEOADQgAhCgwBCyAFKQMQIQoLIAAgCjcDACAFQTBqJAAPC0GQ3QBBpckAQfICQd0zEIMGAAvJEgMJfwF+AXwjAEGAAWsiAiQAAkACQCABLQAWRQ0AIABCADcDAAwBCyABKAIMIQMDQCAFIQQCQAJAIAMiBQ0AIAFB//8DOwEUIAUhBUF/IQYMAQsgASAFQX9qIgU2AgwgASABKAIIIgZBAWo2AgggASAGLAAAIgY7ARQgBSEFIAYhBgsgBSEDAkACQCAGIgdBd2oiCEEXSw0AIAQhBUEBIQZBASAIdEGTgIAEcQ0BCyAHIQVBACEGCyADIQMgBSIEIQUgBg0ACwJAAkACQAJAAkACQAJAIARBIkYNAAJAIARB2wBGDQAgBEH7AEcNAiABKAIAIQkCQCAJIAlBAhDyAhCQASIKDQAgAEIANwMADAkLIAJB+ABqIAlBCCAKEOsDIAEtABZB/wFxIQgDQCAFIQZBfyEFAkAgCA0AAkAgASgCDCIFDQAgAUH//wM7ARRBfyEFDAELIAEgBUF/ajYCDCABIAEoAggiBUEBajYCCCABIAUsAAAiBTsBFCAFIQULAkACQCAFIgRBd2oiA0EXSw0AIAYhBUEBIQZBASADdEGTgIAEcQ0BCyAEIQVBACEGCyAFIgMhBSAGDQALAkAgA0F/Rg0AIANB/QBGDQQgASABKAIIQX9qNgIIIAEgASgCDEEBajYCDAsgAiACKQN4NwNAIAkgAkHAAGoQjgECQANAIAEtABYhCANAIAUhBgJAAkAgCEH/AXFFDQBBfyEFDAELAkAgASgCDCIFDQAgAUH//wM7ARRBfyEFDAELIAEgBUF/ajYCDCABIAEoAggiBUEBajYCCCABIAUsAAAiBTsBFCAFIQULAkACQCAFIgRBd2oiA0EXSw0AIAYhBUEBIQZBASADdEGTgIAEcQ0BCyAEIQVBACEGCyAFIgMhBSAGDQALIANBIkcNASACQfAAaiABEOsCAkACQCABLQAWRQ0AQQQhBQwBCyABKAIMIQMDQCAFIQQCQAJAIAMiBQ0AIAFB//8DOwEUIAUhBUF/IQYMAQsgASAFQX9qIgU2AgwgASABKAIIIgZBAWo2AgggASAGLAAAIgY7ARQgBSEFIAYhBgsgBSEDAkACQCAGIgdBd2oiCEEXSw0AIAQhBUEBIQZBASAIdEGTgIAEcQ0BCyAHIQVBACEGCyADIQMgBSIEIQUgBg0AC0EEIQUgBEE6Rw0AIAIgAikDcDcDOCAJIAJBOGoQjgEgAkHoAGogARDqAgJAIAEtABYNACACIAIpA2g3AzAgCSACQTBqEI4BIAIgAikDcDcDKCACIAIpA2g3AyAgCSAKIAJBKGogAkEgahD0AiACIAIpA2g3AxggCSACQRhqEI8BCyACIAIpA3A3AxAgCSACQRBqEI8BQQQhBQJAIAEtABYNACABKAIMIQMDQCAFIQQCQAJAIAMiBQ0AIAFB//8DOwEUIAUhBUF/IQYMAQsgASAFQX9qIgU2AgwgASABKAIIIgZBAWo2AgggASAGLAAAIgY7ARQgBSEFIAYhBgsgBSEDAkACQCAGIgdBd2oiCEEXSw0AIAQhBUEBIQZBASAIdEGTgIAEcQ0BCyAHIQVBACEGCyADIQMgBSIEIQUgBg0AC0EDQQJBBCAEQf0ARhsgBEEsRhshBQsgBSEFCyAFIgVBA0YNAAsCQCAFQX5qDgMACgEKCyACIAIpA3g3AwAgCSACEI8BIAIpA3ghCwwICyACIAIpA3g3AwggCSACQQhqEI8BIAFBAToAFkIAIQsMBwsCQCABKAIAIgdBABCSASIJDQAgAEIANwMADAgLIAJB+ABqIAdBCCAJEOsDIAEtABZB/wFxIQgDQCAFIQZBfyEFAkAgCA0AAkAgASgCDCIFDQAgAUH//wM7ARRBfyEFDAELIAEgBUF/ajYCDCABIAEoAggiBUEBajYCCCABIAUsAAAiBTsBFCAFIQULAkACQCAFIgRBd2oiA0EXSw0AIAYhBUEBIQZBASADdEGTgIAEcQ0BCyAEIQVBACEGCyAFIgMhBSAGDQALAkAgA0F/Rg0AIANB3QBGDQQgASABKAIIQX9qNgIIIAEgASgCDEEBajYCDAsgAiACKQN4NwNgIAcgAkHgAGoQjgEDQCACQfAAaiABEOoCQQQhBQJAIAEtABYNACACIAIpA3A3A1ggByAJIAJB2ABqEKADIAEtABYhCANAIAUhBgJAAkAgCEH/AXFFDQBBfyEFDAELAkAgASgCDCIFDQAgAUH//wM7ARRBfyEFDAELIAEgBUF/ajYCDCABIAEoAggiBUEBajYCCCABIAUsAAAiBTsBFCAFIQULAkACQCAFIgRBd2oiA0EXSw0AIAYhBUEBIQZBASADdEGTgIAEcQ0BCyAEIQVBACEGCyAFIgMhBSAGDQALQQNBAkEEIANB3QBGGyADQSxGGyEFCyAFIgVBA0YNAAsCQAJAIAVBfmoOAwAJAQkLIAIgAikDeDcDSCAHIAJByABqEI8BIAIpA3ghCwwGCyACIAIpA3g3A1AgByACQdAAahCPASABQQE6ABZCACELDAULIAAgARDrAgwGCwJAAkACQAJAIAEvARQiBUGaf2oODwIDAwMDAwMDAAMDAwMDAQMLAkAgASgCDCIGQQNJDQAgASgCCCIDQbQpQQMQuwYNACABIAZBfWo2AgwgASADQQNqNgIIIABBACkDsIsBNwMADAkLIAVBmn9qDg8BAgICAgICAgICAgICAgACCwJAIAEoAgwiBkEDSQ0AIAEoAggiA0G5MkEDELsGDQAgASAGQX1qNgIMIAEgA0EDajYCCCAAQQApA5CLATcDAAwICyAFQeYARw0BCyABKAIMIgVBBEkNACABKAIIIgYoAABB4djNqwZHDQAgASAFQXxqNgIMIAEgBkEEajYCCCAAQQApA5iLATcDAAwGCwJAAkAgBEEtRg0AIARBUGpBCUsNAQsgASgCCEF/aiACQfgAahDmBiEMAkAgAigCeCIFIAEoAggiBkF/akcNACABQQE6ABYgAEIANwMADAcLIAEoAgwgBiAFa2oiBkF/TA0DIAEgBTYCCCABIAY2AgwgACAMEOgDDAYLIAFBAToAFiAAQgA3AwAMBQsgAikDeCELDAMLIAIpA3ghCwwBC0GR3ABBpckAQeICQfAyEIMGAAsgACALNwMADAELIAAgCzcDAAsgAkGAAWokAAuNAQEDfyABQQA2AhAgASgCDCECIAEoAgghAwJAAkACQCABQQAQ7gIiBEEBag4CAAECCyABQQE6ABYgAEIANwMADwsgAEEAEMkDDwsgASACNgIMIAEgAzYCCAJAIAEoAgAiAiAAIAQgASgCEBCWASIDRQ0AIAFBADYCECACIAAgASADEO4CIAEoAhAQlwELC5gCAgN/AX4jAEHAAGsiBSQAIAUgAikDACIINwMYIAVBNGoiBkIANwIAIAUgCDcDECAFQgA3AiwgBSADQQBHIgc2AiggBSADNgIkIAUgATYCICAFQSBqIAVBEGoQ7QICQAJAAkAgBigCAA0AIAUoAiwiBkF/Rw0BCwJAIARFDQAgBUEgaiABQb/VAEEAENkDCyAAQgA3AwAMAQsgASAAIAYgBSgCOBCWASIGRQ0AIAUgAikDACIINwMYIAUgCDcDCCAFQgA3AjQgBSAGNgIwIAVBADYCLCAFIAc2AiggBSADNgIkIAUgATYCICAFQSBqIAVBCGoQ7QIgASAAQX8gBSgCLCAFKAI0GyAFKAI4EJcBCyAFQcAAaiQAC8AJAQl/IwBB8ABrIgIkACAAKAIAIQMgAiABKQMANwNYAkACQCADIAJB2ABqEI0BRQ0AIABBATYCFAwBCyAAKAIUDQACQAJAIAAoAhAiBA0AQQAhBAwBCyAEIAAoAgxqIQQLIAQhBCACIAEpAwA3A1ACQAJAAkACQCADIAJB0ABqEPUDDg0BAAMDAwMBAwMCAwMBAwsgASgCBEGPgMD/B3ENAAJAIAEoAgAiBUG+f2pBAkkNACAFQQJHDQELIAFBACkDsIsBNwMACyACIAEpAwA3A0AgAkHoAGogAyACQcAAahDNAyABIAIpA2g3AwAgAiABKQMANwM4IAMgAkE4aiACQegAahDIAyEBAkAgBEUNACAEIAEgAigCaBChBhoLIAAgACgCDCACKAJoIgFqNgIMIAAgASAAKAIYajYCGAwCCyACIAEpAwA3A0ggACADIAJByABqIAJB6ABqEMgDIAIoAmggBCACQeQAahDoAiAAKAIMakF/ajYCDCAAIAIoAmQgACgCGGpBf2o2AhgMAQsgAiABKQMANwMwIAMgAkEwahCOASACIAEpAwA3AygCQAJAAkAgAyACQShqEPQDRQ0AIAIgASkDADcDGCADIAJBGGoQ8wMhBgJAIAAoAhBFDQAgACgCECAAKAIMakHbADoAAAsgACAAKAIMQQFqNgIMIAAgACgCGEEBajYCGCAAIAAoAgggACgCBGo2AgggAEEYaiEHIABBDGohCAJAIAYvAQhFDQBBACEEA0AgBCEJAkAgACgCCEUNAAJAIAAoAhAiBEUNACAEIAgoAgBqQQo6AAALIAAgACgCDEEBajYCDCAAIAAoAhhBAWo2AhggACgCCEF/aiEKAkAgACgCEEUNAEEAIQQgCkUNAANAIAAoAhAgACgCDCAEIgRqakEgOgAAIARBAWoiBSEEIAUgCkcNAAsLIAggCCgCACAKajYCACAHIAcoAgAgCmo2AgALIAIgBigCDCAJQQN0aikDADcDECAAIAJBEGoQ7QIgACgCFA0BAkAgCSAGLwEIQX9qRg0AAkAgACgCEEUNACAAKAIQIAAoAgxqQSw6AAALIAggCCgCAEEBajYCACAHIAcoAgBBAWo2AgALIAlBAWoiBSEEIAUgBi8BCEkNAAsLIAAgACgCCCAAKAIEazYCCAJAIAYvAQhFDQAgABDvAgsgCCEKQd0AIQkgByEGIAghBCAHIQUgACgCEA0BDAILIAIgASkDADcDICADIAJBIGoQlQMhBAJAIAAoAhBFDQAgACgCECAAKAIMakH7ADoAAAsgACAAKAIMQQFqIgU2AgwgACAAKAIYQQFqNgIYAkAgBEUNACAAIAAoAgggACgCBGo2AgggAyAEIABBEBDxAhogACAAKAIIIAAoAgRrNgIIIAUgACgCDCIERg0AIAAgBEF/ajYCDCAAIAAoAhhBf2o2AhggABDvAgsgAEEMaiIEIQpB/QAhCSAAQRhqIgUhBiAEIQQgBSEFIAAoAhBFDQELIAAoAhAgACgCDGogCToAACAKIQQgBiEFCyAEIgAgACgCAEEBajYCACAFIgAgACgCAEEBajYCACACIAEpAwA3AwggAyACQQhqEI8BCyACQfAAaiQAC9AHAQp/IwBBEGsiAiQAIAEhAUEAIQNBACEEAkADQCAEIQQgAyEFIAEhA0F/IQECQCAALQAWIgYNAAJAIAAoAgwiAQ0AIABB//8DOwEUQX8hAQwBCyAAIAFBf2o2AgwgACAAKAIIIgFBAWo2AgggACABLAAAIgE7ARQgASEBCwJAAkAgASIBQX9GDQACQAJAIAFB3ABGDQAgASEHIAFBIkcNASADIQEgBSEIIAQhCUECIQoMAwsCQAJAIAZFDQBBfyEBDAELAkAgACgCDCIBDQAgAEH//wM7ARRBfyEBDAELIAAgAUF/ajYCDCAAIAAoAggiAUEBajYCCCAAIAEsAAAiATsBFCABIQELIAEiCyEHIAMhASAFIQggBCEJQQEhCgJAAkACQAJAAkACQCALQV5qDlQGCAgICAgICAgICAgIBggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBggICAgIAggICAMICAgICAgIBQgICAEIAAQIC0EJIQcMBQtBDSEHDAQLQQghBwwDC0EMIQcMAgtBACEBAkADQCABIQFBfyEIAkAgBg0AAkAgACgCDCIIDQAgAEH//wM7ARRBfyEIDAELIAAgCEF/ajYCDCAAIAAoAggiCEEBajYCCCAAIAgsAAAiCDsBFCAIIQgLQX8hCSAIIghBf0YNASACQQtqIAFqIAg6AAAgAUEBaiIIIQEgCEEERw0ACyACQQA6AA8gAkEJaiACQQtqEIIGIQEgAi0ACUEIdCACLQAKckF/IAFBAkYbIQkLIAkiCUF/Rg0CAkACQCAJQYB4cSIBQYC4A0YNAAJAIAFBgLADRg0AIAQhASAJIQQMAgsgAyEBIAUhCCAEIAkgBBshCUEBQQMgBBshCgwFCwJAIAQNACADIQEgBSEIQQAhCUEBIQoMBQtBACEBIARBCnQgCWpBgMiAZWohBAsgASEJIAQgAkEFahDjAyEEIAAgACgCEEEBajYCEAJAAkAgAw0AQQAhAQwBCyADIAJBBWogBBChBiAEaiEBCyABIQEgBCAFaiEIIAkhCUEDIQoMAwtBCiEHCyAHIQEgBA0AAkACQCADDQBBACEEDAELIAMgAToAACADQQFqIQQLIAQhBAJAIAFBwAFxQYABRg0AIAAgACgCEEEBajYCEAsgBCEBIAVBAWohCEEAIQlBACEKDAELIAMhASAFIQggBCEJQQEhCgsgASEBIAgiCCEDIAkiCSEEQX8hBQJAIAoOBAECAAECCwtBfyAIIAkbIQULIAJBEGokACAFC6QBAQN/AkAgACgCCEUNAAJAIAAoAhBFDQAgACgCECAAKAIMakEKOgAACyAAIAAoAgxBAWo2AgwgACAAKAIYQQFqNgIYIAAoAghBf2ohAQJAIAAoAhBFDQAgAUUNAEEAIQIDQCAAKAIQIAAoAgwgAiICampBIDoAACACQQFqIgMhAiADIAFHDQALCyAAIAAoAgwgAWo2AgwgACAAKAIYIAFqNgIYCwvFAwEDfyMAQSBrIgQkACAEIAIpAwA3AxgCQCAAIARBGGoQxQNFDQAgBCADKQMANwMQAkAgACAEQRBqEPUDIgBBC0sNAEEBIAB0QYEScQ0BCwJAIAEoAghFDQACQCABKAIQIgBFDQAgACABKAIMakEKOgAACyABIAEoAgxBAWo2AgwgASABKAIYQQFqNgIYIAEoAghBf2ohBQJAIAEoAhBFDQAgBUUNAEEAIQADQCABKAIQIAEoAgwgACIAampBIDoAACAAQQFqIgYhACAGIAVHDQALCyABIAEoAgwgBWo2AgwgASABKAIYIAVqNgIYCyAEIAIpAwA3AwggASAEQQhqEO0CAkAgASgCEEUNACABKAIQIAEoAgxqQTo6AAALIAEgASgCDEEBajYCDCABIAEoAhhBAWo2AhgCQCABKAIIRQ0AAkAgASgCEEUNACABKAIQIAEoAgxqQSA6AAALIAEgASgCDEEBajYCDCABIAEoAhhBAWo2AhgLIAQgAykDADcDACABIAQQ7QICQCABKAIQRQ0AIAEoAhAgASgCDGpBLDoAAAsgASABKAIMQQFqNgIMIAEgASgCGEEBajYCGAsgBEEgaiQAC8wEAQd/IwBBMGsiBCQAQQAhBSABIQECQANAIAUhBgJAIAEiByAAKADkASIFIAUoAmBqayAFLwEOQQR0Tw0AQQAhBQwCCwJAAkAgB0Gg+ABrQQxtQStLDQACQAJAIAcoAggiBS8BAA0AIAUhCAwBCyAFIQEDQCABIQUCQCADRQ0AIARBKGogBS8BABDJAyAFLwECIgEhCAJAAkAgAUErSw0AAkAgACAIEPICIghBoPgAa0EMbUErSw0AIARBADYCJCAEIAFB4ABqNgIgDAILIARBIGogAEEIIAgQ6wMMAQsgAUHPhgNNDQUgBCAINgIgIARBAzYCJAsgBCAEKQMoNwMIIAQgBCkDIDcDACAAIAIgBEEIaiAEIAMRBQALIAVBBGoiCCEBIAghCCAFLwEEDQALCyAIIAcoAghrQQJ1IQUMAwsCQAJAIAcNAEEAIQUMAQsgBy0AA0EPcSEFCwJAAkAgBUF8ag4GAQAAAAABAAtB7+kAQbLHAEHUAEHBHxCDBgALIAcvAQghCQJAIANFDQAgCUUNACAJQQF0IQogBygCDCEFQQAhAQNAIAQgBSABIgFBA3QiCGopAwA3AxggBCAFIAhBCHJqKQMANwMQIAAgAiAEQRhqIARBEGogAxEFACABQQJqIgghASAIIApJDQALCyAJIQUCQCAHDQAgBSEFDAMLIAUhBSAHKAIAQYCAgPgAcUGAgIDIAEcNAiAGIAlqIQUgBygCBCEBDAELC0Hl1QBBsscAQcAAQc4yEIMGAAsgBEEwaiQAIAYgBWoLnAICAX4DfwJAIAFBK0sNAAJAAkBCjv3+6v8/IAGtiCICp0EBcQ0AIAFB4PIAai0AACEDAkAgACgC+AENACAAQTAQigEhBCAAQQw6AEQgACAENgL4ASAEDQBBACEDDAELIANBf2oiBEEMTw0BIAAoAvgBIARBAnRqKAIAIgUhAyAFDQACQCAAQQlBEBCJASIDDQBBACEDDAELIAAoAvgBIARBAnRqIAM2AgAgA0Gg+AAgAUEMbGoiAEEAIAAoAggbNgIEIAMhAwsgAyEAAkAgAkIBg1ANACABQSxPDQJBoPgAIAFBDGxqIgFBACABKAIIGyEACyAADwtBn9UAQbLHAEGWAkHKFBCDBgALQeXRAEGyxwBB9QFBySQQgwYACw4AIAAgAiABQREQ8QIaC7gCAQN/IwBBIGsiBCQAIAQgAikDADcDEAJAAkACQCAAIAEgBEEQahD1AiIFRQ0AIAUgAykDADcDAAwBCyAEIAIpAwA3AwgCQCAAIARBCGoQxQMNACAEIAIpAwA3AwAgBEEYaiAAQcIAIAQQ3QMMAQsgAS8BCiIFIAEvAQgiBkkNAQJAIAUgBkcNACAAIAVBCmxBA3YiBUEEIAVBBEsbIgZBBHQQigEiBUUNASABIAY7AQoCQCABLwEIIgZFDQAgBSABKAIMIAZBBHQQoQYaCyABIAU2AgwgACgCoAIgBRCLAQsgASgCDCABLwEIQQR0aiACKQMANwMAIAEoAgwgAS8BCEEEdGpBCGogAykDADcDACABIAEvAQhBAWo7AQgLIARBIGokAA8LQdErQbLHAEGgAUHIExCDBgAL7AICCX8BfiMAQSBrIgMkACADIAIpAwA3AxBBACEEAkAgACADQRBqEMUDRQ0AIAEvAQgiBUEARyEEIAVBAXQhBiABKAIMIQcCQAJAIAUNACAEIQgMAQsgAigCACEJIAIpAwAhDCAEIQFBACEKA0AgASEIAkAgByAKIgRBA3RqIgEoAAAgCUcNACABKQMAIAxSDQAgCCEIIAcgBEEDdEEIcmohCwwCCyAEQQJqIgogBkkiBCEBIAohCiAEIQggBA0ACwsgCyEEIAhBAXENACADIAIpAwA3AwggACADQQhqIANBHGoQyAMhCAJAAkAgBQ0AQQAhBAwBC0EAIQQDQCADIAcgBCIEQQN0aikDADcDACAAIAMgA0EYahDIAyEBAkAgAygCGCADKAIcIgpHDQAgCCABIAoQuwYNACAHIARBA3RBCHJqIQQMAgsgBEECaiIBIQQgASAGSQ0AC0EAIQQLIAQhBAsgA0EgaiQAIAQLcQEBfwJAAkAgAUUNACABQaD4AGtBDG1BLEkNAEEAIQIgASAAKADkASIAIAAoAmBqayAALwEOQQR0SQ0BQQEhAgJAIAEtAANBD3FBfGoOBgIAAAAAAgALQe/pAEGyxwBB+QBBiyMQgwYAC0EAIQILIAILXwECfyMAQRBrIgQkACACLwEIIQUgBCACNgIMIAQgAzoACCAEIAU2AgQgACABQQBBABDxAiEDAkAgACACIAQoAgQgAxD4Ag0AIAAgASAEQQRqQRIQ8QIaCyAEQRBqJAAL6QIBBn8jAEEQayIEJAACQAJAIANBgThIDQAgBEEIaiAAQQ8Q3wNBfCEDDAELAkBBACABLwEIIgVrIAMgBSADaiIGQQBIGyIDRQ0AAkAgBkEAIAZBAEobIgZBgThJDQAgBEEIaiAAQQ8Q3wNBeiEDDAILAkAgBiABLwEKTQ0AAkAgACAGQQpsQQN2IgdBBCAHQQRLGyIIQQN0EIoBIgcNAEF7IQMMAwsCQCABKAIMIglFDQAgByAJIAEvAQhBA3QQoQYaCyABIAg7AQogASAHNgIMIAAoAqACIAcQiwELIAEvAQggBSACIAUgAkkbIgBrIQICQAJAIANBf0oNACABKAIMIABBA3RqIgAgACADQQN0ayACIANqQQN0EKIGGgwBCyABKAIMIABBA3QiAGoiBSADQQN0IgNqIAUgAkEDdBCiBhogASgCDCAAakEAIAMQowYaCyABIAY7AQgLQQAhAwsgBEEQaiQAIAMLNQECfyABKAIIKAIMIQQgASABKAIAIgVBAWo2AgAgBCAFQQN0aiACIAMgAS0ABBspAwA3AwAL4QIBBn8gAS8BCiEEAkACQCABLwEIIgUNAEEAIQYMAQsgASgCDCIHIARBA3RqIQhBACEGA0ACQCAIIAYiBkEBdGovAQAgAkcNACAHIAZBA3RqIQYMAgsgBkEBaiIJIQYgCSAFRw0AC0EAIQYLAkAgBiIGRQ0AIAYgAykDADcDAA8LAkAgBCAFSQ0AAkACQCAEIAVHDQAgACAEQQpsQQN2IgZBBCAGQQRLGyIJQQpsEIoBIgZFDQEgAS8BCiEFIAEgCTsBCgJAIAEvAQgiCEUNACAGIAEoAgwiBCAIQQN0EKEGIAlBA3RqIAQgBUEDdGogAS8BCEEBdBChBhoLIAEgBjYCDCAAKAKgAiAGEIsBCyABKAIMIAEvAQhBA3RqIAMpAwA3AwAgASgCDCABLwEKQQN0aiABLwEIQQF0aiACOwEAIAEgAS8BCEEBajsBCAsPC0HRK0GyxwBBuwFBtRMQgwYAC4ABAQJ/IwBBEGsiAyQAIAMgAikDADcDCAJAAkAgACABIANBCGoQ9QIiAg0AQX8hAQwBCyABIAEvAQgiAEF/ajsBCAJAIAAgAkF4aiIEIAEoAgxrQQN1QQF2QX9zaiIBRQ0AIAQgAkEIaiABQQR0EKIGGgtBACEBCyADQRBqJAAgAQuJAQIEfwF+AkACQCACLwEIIgQNAEEAIQIMAQsgAigCDCIFIAIvAQpBA3RqIQZBACECA0ACQCAGIAIiAkEBdGovAQAgA0cNACAFIAJBA3RqIQIMAgsgAkEBaiIHIQIgByAERw0AC0EAIQILAkACQCACIgINAEIAIQgMAQsgAikDACEICyAAIAg3AwALGAAgAEEGNgIEIAAgAkEPdEH//wFyNgIAC0sAAkAgAiABKADkASIBIAEoAmBqayICQQR1IAEvAQ5JDQBBkxhBsscAQbcCQf7FABCDBgALIABBBjYCBCAAIAJBC3RB//8BcjYCAAtYAAJAIAINACAAQgA3AwAPCwJAIAIgASgA5AEiASABKAJgamsiAkGAgAJPDQAgAEEGNgIEIAAgAkENdEH//wFyNgIADwtBzOoAQbLHAEHAAkHPxQAQgwYAC0kBAn8CQCABKAIEIgJBgIDA/wdxRQ0AQX8PC0F/IQMCQCACQQ9xQQZHDQAgASgCAEEPdiIBQX8gASAAKALkAS8BDkkbIQMLIAMLcgECfwJAAkAgASgCBCICQYCAwP8HcUUNAEF/IQMMAQtBfyEDIAJBD3FBBkcNACABKAIAQQ92IgFBfyABIAAoAuQBLwEOSRshAwtBACEBAkAgAyIDQQBIDQAgACgA5AEiASABKAJgaiADQQR0aiEBCyABC5oBAQF/AkAgAkUNACACQf//ATYCAAsCQCABKAIEIgNBgIDA/wdxRQ0AQQAPCwJAIANBD3FBBkYNAEEADwsCQAJAIAEoAgBBD3YgACgC5AEvAQ5PDQBBACEDIAAoAOQBDQELIAEoAgAhAQJAIAJFDQAgAiABQf//AXE2AgALIAAoAOQBIgIgAigCYGogAUENdkH8/x9xaiEDCyADC2gBBH8CQCAAKALkASIALwEOIgINAEEADwsgACAAKAJgaiEDQQAhBAJAA0AgAyAEIgVBBHRqIgQgACAEKAIEIgAgAUYbIQQgACABRg0BIAQhACAFQQFqIgUhBCAFIAJHDQALQQAPCyAEC94BAQh/IAAoAuQBIgAvAQ4iAkEARyEDAkACQCACDQAgAyEEDAELIAAgACgCYGohBSADIQZBACEHA0AgCCEIIAYhCQJAAkAgASAFIAUgByIDQQR0aiIHLwEKQQJ0amsiBEEASA0AQQAhBiADIQAgBCAHLwEIQQN0SA0BC0EBIQYgCCEACyAAIQACQCAGRQ0AIANBAWoiAyACSSIEIQYgACEIIAMhByAEIQQgACEAIAMgAkYNAgwBCwsgCSEEIAAhAAsgACEAAkAgBEEBcQ0AQbLHAEH7AkHiERD+BQALIAAL3AEBBH8CQAJAIAFBgIACSQ0AQQAhAiABQYCAfmoiAyAAKALkASIBLwEOTw0BIAEgASgCYGogA0EEdGoPC0EAIQICQCAALwFMIAFNDQAgACgC9AEgAUECdGooAgAhAgsCQCACIgENAEEADwtBACECIAAoAuQBIgAvAQ4iBEUNACABKAIIKAIIIQEgACAAKAJgaiEFQQAhAgJAA0AgBSACIgNBBHRqIgIgACACKAIEIgAgAUYbIQIgACABRg0BIAIhACADQQFqIgMhAiADIARHDQALQQAPCyACIQILIAILQAEBf0EAIQICQCAALwFMIAFNDQAgACgC9AEgAUECdGooAgAhAgtBACEAAkAgAiIBRQ0AIAEoAggoAhAhAAsgAAs8AQF/QQAhAgJAIAAvAUwgAU0NACAAKAL0ASABQQJ0aigCACECCwJAIAIiAA0AQa7ZAA8LIAAoAggoAgQLVwEBf0EAIQICQAJAIAEoAgRB8////wFGDQAgAS8BAkEPcSIBQQJPDQEgACgA5AEiAiACKAJgaiABQQR0aiECCyACDwtB2NIAQbLHAEGoA0HrxQAQgwYAC4wGAQt/IwBBIGsiBCQAIAFB5AFqIQUgAiECAkACQAJAAkACQAJAA0AgAiIGRQ0BIAYgBSgAACICIAIoAmBqIgdrIAIvAQ5BBHRPDQMgByAGLwEKQQJ0aiEIIAYvAQghCQJAAkAgAygCBCICQYCAwP8HcQ0AIAJBD3FBBEcNACAJQQBHIQICQAJAIAkNACACIQJBACEKDAELQQAhCiACIQIgCCELAkAgAygCACIMIAgvAQBGDQADQAJAIApBAWoiAiAJRw0AQQAhAkEAIQoMAwsgAiEKIAwgCCACQQN0aiILLwEARw0ACyACIAlJIQIgCyELCyACIQIgCyAHayIKQYCAAk8NByAAQQY2AgQgACAKQQ10Qf//AXI2AgAgAiECQQEhCgsgCiEKIAJFDQAgCiEJIAYhAgwBCyAEIAMpAwA3AxAgASAEQRBqIARBGGoQyAMhDQJAAkACQAJAAkAgBCgCGEUNACAJQQBHIgIhCkEAIQwgCQ0BIAIhAgwCCyAAQgA3AwBBASECIAYhCgwDCwNAIAohByAIIAwiDEEDdGoiDi8BACECIAQoAhghCiAEIAUoAgA2AgwgBEEMaiACIARBHGoQjAQhAgJAIAogBCgCHCILRw0AIAIgDSALELsGDQAgDiAFKAAAIgIgAigCYGprIgJBgIACTw0LIABBBjYCBCAAIAJBDXRB//8BcjYCACAHIQJBASEJDAMLIAxBAWoiAiAJSSILIQogAiEMIAIgCUcNAAsgCyECC0EJIQkLIAkhCQJAIAJBAXFFDQAgCSECIAYhCgwBC0EAIQJBACEKIAYoAgRB8////wFGDQAgBi8BAkEPcSIJQQJPDQhBACECIAUoAAAiCiAKKAJgaiAJQQR0aiEKCyACIQkgCiECCyACIQIgCUUNAAwCCwALIABCADcDAAsgBEEgaiQADwtBgOoAQbLHAEGuA0HtIRCDBgALQczqAEGyxwBBwAJBz8UAEIMGAAtBzOoAQbLHAEHAAkHPxQAQgwYAC0HY0gBBsscAQagDQevFABCDBgALyAYCBX8CfiMAQRBrIgQkAAJAAkACQAJAAkACQAJAAkACQAJAAkACQEEQIAMoAgQiBUEPcSIGIAVBgIDA/wdxIgcbIgVBfWoOBwMCAgACAgECCwJAIAIoAgQiCEGAgMD/B3ENACAIQQ9xQQJHDQACQAJAIAdFDQBBfyEIDAELQX8hCCAGQQZHDQAgAygCAEEPdiIHQX8gByABKALkAS8BDkkbIQgLQQAhBwJAIAgiBkEASA0AIAEoAOQBIgcgBygCYGogBkEEdGohBwsgBw0AIAIoAgAiAkGAgAJPDQUgAygCACEDIABBBjYCBCAAIANBgIB+cSACcjYCAAwECyAFQX1qDgcCAQEBAQEAAQsgAikDACEJIAMpAwAhCgJAIAFBB0EYEIkBIgMNACAAQgA3AwAMAwsgAyAKNwMQIAMgCTcDCCAAIAFBCCADEOsDDAILIAAgAykDADcDAAwBCyADKAIAIQdBACEFAkAgAygCBEGPgMD/B3FBA0cNAEEAIQUgB0Gw+XxqIgZBAEgNACAGQQAvAcjuAU4NA0EAIQVBkP8AIAZBA3RqIgYtAANBAXFFDQAgBiEFIAYtAAINBAsCQCAFIgVFDQAgBSgCBCEDIAQgAikDADcDCCAAIAEgBEEIaiADEQEADAELAkAgB0H//wNLDQACQAJAQRAgAigCBCIFQQ9xIAVBgIDA/wdxIgYbIggOCQAAAAAAAgACAQILIAYNBiACKAIAIgNBgICAgAFPDQcgBUHw/z9xDQggACADIAhBHHRyNgIAIAAgB0EEdEEFcjYCBAwCCyAFQfD/P3ENCCAAIAIoAgA2AgAgACAHQQR0QQpyNgIEDAELIAIpAwAhCSADKQMAIQoCQCABQQdBGBCJASIDDQAgAEIANwMADAELIAMgCjcDECADIAk3AwggACABQQggAxDrAwsgBEEQaiQADwtB8zZBsscAQZQEQaM7EIMGAAtB9xZBsscAQf8DQcvDABCDBgALQdHcAEGyxwBBggRBy8MAEIMGAAtB/iFBsscAQa8EQaM7EIMGAAtB5d0AQbLHAEGwBEGjOxCDBgALQZ3dAEGyxwBBsQRBozsQgwYAC0Gd3QBBsscAQbcEQaM7EIMGAAswAAJAIANBgIAESQ0AQZ0wQbLHAEHABEH3NBCDBgALIAAgASADQQR0QQlyIAIQ6wMLMgEBfyMAQRBrIgQkACAEIAEpAwA3AwggACAEQQhqIAIgA0EAEI0DIQEgBEEQaiQAIAELtgUCA38BfiMAQdAAayIFJAAgA0EANgIAIAJCADcDAAJAAkACQAJAIARBAkwNAEF/IQYMAQsgASgCACEHAkACQAJAAkACQAJAQRAgASgCBCIGQQ9xIAZBgIDA/wdxG0F9ag4IAAUBBQUEAwIFCyACQgA3AwAgByEGDAULIAIgB0Ecdq1CIIYgB0H/////AHGthDcDACAGQQR2Qf//A3EhBgwECyACIAetQoCAgICAAYQ3AwAgBkEEdkH//wNxIQYMAwsgAyAHNgIAIAZBBHZB//8DcSEGDAILAkAgBw0AQX8hBgwCC0F/IQYgBygCAEGAgID4AHFBgICAOEcNASAFIAcpAxA3AyggACAFQShqIAIgAyAEQQFqEI0DIQMgAiAHKQMINwMAIAMhBgwBCyAFIAEpAwA3AyBBfyEGIAVBIGoQ9gMNACAFIAEpAwA3AzggBUHAAGpB2AAQyQMgACAFKQNANwMwIAUgBSkDOCIINwMYIAUgCDcDSCAAIAVBGGpBABCOAyEGIABCADcDMCAFIAUpA0A3AxAgBUHIAGogACAGIAVBEGoQjwNBACEGAkAgBSgCTEGPgMD/B3FBA0cNAEEAIQYgBSgCSEGw+XxqIgdBAEgNACAHQQAvAcjuAU4NAkEAIQZBkP8AIAdBA3RqIgctAANBAXFFDQAgByEGIActAAINAwsCQAJAIAYiBkUNACAGKAIEIQYgBSAFKQM4NwMIIAVBMGogACAFQQhqIAYRAQAMAQsgBSAFKQNINwMwCwJAAkAgBSkDMFBFDQBBfyECDAELIAUgBSkDMDcDACAAIAUgAiADIARBAWoQjQMhAyACIAEpAwA3AwAgAyECCyACIQYLIAVB0ABqJAAgBg8LQfcWQbLHAEH/A0HLwwAQgwYAC0HR3ABBsscAQYIEQcvDABCDBgALqAwCCX8BfiMAQZABayIDJAAgAyABKQMANwNoAkACQAJAAkAgA0HoAGoQ9wNFDQAgAyABKQMAIgw3AzAgAyAMNwOAAUHvLUH3LSACQQFxGyEEIAAgA0EwahC5AxCMBiEBAkACQCAAKQAwQgBSDQAgAyAENgIAIAMgATYCBCADQYgBaiAAQa8aIAMQ2QMMAQsgAyAAQTBqKQMANwMoIAAgA0EoahC5AyECIAMgBDYCECADIAI2AhQgAyABNgIYIANBiAFqIABBvxogA0EQahDZAwsgARAgQQAhBAwBCwJAAkACQAJAQRAgASgCBCIEQQ9xIgUgBEGAgMD/B3EiBBtBfmoOBwECAgIAAgMCCyABKAIAIQYCQAJAIAEoAgRBj4DA/wdxQQZGDQBBASEBQQAhBwwBCwJAIAAoAuQBIghFDQBBASEBQQAhByAGQQ92IAgvAQ5JDQELIAZB//8BcUH//wFGIQEgCCAIKAJgaiAGQQ12Qfz/H3FqIQcLIAchBwJAAkAgAUUNAAJAIARFDQBBJyEBDAILAkAgBUEGRg0AQSchAQwCC0EnIQEgBkEPdiAAKALkAS8BDk8NAUElQScgACgA5AEbIQEMAQsgBy8BAiIBQYCgAk8NBUGHAiABQQx2IgF2QQFxRQ0FIAFBAnRBnPMAaigCACEBCyAAIAEgAhCTAyEEDAMLQQAhBAJAIAEoAgAiASAALwFMTw0AIAAoAvQBIAFBAnRqKAIAIQQLAkAgBCIFDQBBACEEDAMLIAUoAgwhBgJAIAJBAnFFDQAgBiEEDAMLIAYhBCAGDQJBACEEIAAgARCRAyIBRQ0CAkAgAkEBcQ0AIAEhBAwDCyAFIAAgARCQASIANgIMIAAhBAwCCyADIAEpAwA3A2ACQCAAIANB4ABqEPUDIgZBAkcNACABKAIEDQACQCABKAIAQaB/aiIHQStLDQAgACAHIAJBBHIQkwMhBAsgBCIEIQUgBCEEIAdBLEkNAgsgBSEJAkAgBkEIRw0AIAMgASkDACIMNwNYIAMgDDcDiAECQAJAAkAgACADQdgAaiADQYABaiADQfwAakEAEI0DIgpBAE4NACAJIQUMAQsCQAJAIAAoAtwBIgEvAQgiBQ0AQQAhAQwBCyABKAIMIgsgAS8BCkEDdGohByAKQf//A3EhCEEAIQEDQAJAIAcgASIBQQF0ai8BACAIRw0AIAsgAUEDdGohAQwCCyABQQFqIgQhASAEIAVHDQALQQAhAQsCQAJAIAEiAQ0AQgAhDAwBCyABKQMAIQwLIAMgDCIMNwOIAQJAIAJFDQAgDEIAUg0AIANB8ABqIABBCCAAQaD4AEHAAWpBAEGg+ABByAFqKAIAGxCQARDrAyADIAMpA3AiDDcDiAEgDFANACADIAMpA4gBNwNQIAAgA0HQAGoQjgEgACgC3AEhASADIAMpA4gBNwNIIAAgASAKQf//A3EgA0HIAGoQ+gIgAyADKQOIATcDQCAAIANBwABqEI8BCyAJIQECQCADKQOIASIMUA0AIAMgAykDiAE3AzggACADQThqEPMDIQELIAEiBCEFQQAhASAEIQQgDEIAUg0BC0EBIQEgBSEECyAEIQQgAUUNAgtBACEBAkAgBkENSg0AIAZBjPMAai0AACEBCyABIgFFDQMgACABIAIQkwMhBAwBCwJAAkAgASgCACIBDQBBACEFDAELIAEtAANBD3EhBQsgASEEAkACQAJAAkACQAJAAkACQCAFQX1qDgsBCAYDBAUIBQIDAAULIAFBFGohAUEpIQQMBgsgAUEEaiEBQQQhBAwFCyABQRhqIQFBFCEEDAQLIABBCCACEJMDIQQMBAsgAEEQIAIQkwMhBAwDC0GyxwBBzQZB0D8Q/gUACyABQQhqIQFBBiEECyAEIQUgASIGKAIAIgQhAQJAIAQNAEEAIQEgAkEBcUUNACAGIAAgACAFEPICEJABIgQ2AgAgBCEBIAQNAEEAIQQMAQsgASEBAkAgAkECcUUNACABIQQMAQsgASEEIAENACAAIAUQ8gIhBAsgA0GQAWokACAEDwtBsscAQe8FQdA/EP4FAAtBz+EAQbLHAEGoBkHQPxCDBgALggkCB38BfiMAQcAAayIEJABBoPgAQagBakEAQaD4AEGwAWooAgAbIQVBACEGIAIhAgJAAkACQAJAA0AgBiEHAkAgAiIIDQAgByEHDAILAkACQCAIQaD4AGtBDG1BK0sNACAEIAMpAwA3AzAgCCEGIAgoAgBBgICA+ABxQYCAgPgARw0EAkACQANAIAYiCUUNASAJKAIIIQYCQAJAAkACQCAEKAI0IgJBgIDA/wdxDQAgAkEPcUEERw0AIAQoAjAiAkGAgH9xQYCAAUcNACAGLwEAIgdFDQEgAkH//wBxIQogByECIAYhBgNAIAYhBgJAIAogAkH//wNxRw0AIAYvAQIiBiECAkAgBkErSw0AAkAgASACEPICIgJBoPgAa0EMbUErSw0AIARBADYCJCAEIAZB4ABqNgIgIAkhBkEADQgMCgsgBEEgaiABQQggAhDrAyAJIQZBAA0HDAkLIAZBz4YDTQ0OIAQgAjYCICAEQQM2AiQgCSEGQQANBgwICyAGLwEEIgchAiAGQQRqIQYgBw0ADAILAAsgBCAEKQMwNwMIIAEgBEEIaiAEQTxqEMgDIQogBCgCPCAKENAGRw0BIAYvAQAiByECIAYhBiAHRQ0AA0AgBiEGAkAgAkH//wNxEIoEIAoQzwYNACAGLwECIgYhAgJAIAZBK0sNAAJAIAEgAhDyAiICQaD4AGtBDG1BK0sNACAEQQA2AiQgBCAGQeAAajYCIAwGCyAEQSBqIAFBCCACEOsDDAULIAZBz4YDTQ0OIAQgAjYCICAEQQM2AiQMBAsgBi8BBCIHIQIgBkEEaiEGIAcNAAsLIAkoAgQhBkEBDQIMBAsgBEIANwMgCyAJIQZBAA0ADAILAAsgBEIANwMgCyAEIAQpAyA3AyggBEEoaiEGIAghAkEBIQoMAQsCQCAIIAEoAOQBIgYgBigCYGprIAYvAQ5BBHRPDQAgBCADKQMANwMQIARBMGogASAIIARBEGoQiQMgBCAEKQMwIgs3AygCQCALQgBRDQAgBEEoaiEGIAghAkEBIQoMAgsCQCABKAL4AQ0AIAFBMBCKASEGIAFBDDoARCABIAY2AvgBIAYNACAHIQZBACECQQAhCgwCCwJAIAEoAvgBKAIUIgJFDQAgByEGIAIhAkEAIQoMAgsCQCABQQlBEBCJASICDQAgByEGQQAhAkEAIQoMAgsgASgC+AEgAjYCFCACIAU2AgQgByEGIAIhAkEAIQoMAQsCQAJAIAgtAANBD3FBfGoOBgEAAAAAAQALQazmAEGyxwBBuwdBijsQgwYACyAEIAMpAwA3AxgCQCABIAggBEEYahD1AiIGRQ0AIAYhBiAIIQJBASEKDAELQQAhBiAIKAIEIQJBACEKCyAGIgchBiACIQIgByEHIApFDQALCwJAAkAgByIGDQBCACELDAELIAYpAwAhCwsgACALNwMAIARBwABqJAAPC0G/5gBBsscAQcsDQdshEIMGAAtB5dUAQbLHAEHAAEHOMhCDBgALQeXVAEGyxwBBwABBzjIQgwYAC9oCAgd/AX4jAEEwayICJAACQAJAIAAoAuABIgMvAQgiBA0AQQAhAwwBCyADKAIMIgUgAy8BCkEDdGohBiABQf//A3EhB0EAIQMDQAJAIAYgAyIDQQF0ai8BACAHRw0AIAUgA0EDdGohAwwCCyADQQFqIgghAyAIIARHDQALQQAhAwsCQAJAIAMiAw0AQgAhCQwBCyADKQMAIQkLIAIgCSIJNwMoAkACQCAJUA0AIAIgAikDKDcDGCAAIAJBGGoQ8wMhAwwBCwJAIABBCUEQEIkBIgMNAEEAIQMMAQsgAkEgaiAAQQggAxDrAyACIAIpAyA3AxAgACACQRBqEI4BIAMgACgA5AEiCCAIKAJgaiABQQR0ajYCBCAAKALgASEIIAIgAikDIDcDCCAAIAggAUH//wNxIAJBCGoQ+gIgAiACKQMgNwMAIAAgAhCPASADIQMLIAJBMGokACADC4UCAQZ/QQAhAgJAIAAvAUwgAU0NACAAKAL0ASABQQJ0aigCACECC0EAIQECQAJAIAIiAkUNAAJAAkAgACgC5AEiAy8BDiIEDQBBACEBDAELIAIoAggoAgghASADIAMoAmBqIQVBACEGAkADQCAFIAYiB0EEdGoiBiACIAYoAgQiBiABRhshAiAGIAFGDQEgAiECIAdBAWoiByEGIAcgBEcNAAtBACEBDAELIAIhAQsCQAJAIAEiAQ0AQX8hAgwBCyABIAMgAygCYGprQQR1IgEhAiABIARPDQILQQAhASACIgJBAEgNACAAIAIQkAMhAQsgAQ8LQZMYQbLHAEHmAkHSCRCDBgALZAEBfyMAQRBrIgIkACACIAEpAwA3AwgCQCAAIAJBCGpBARCOAyIBRQ0AAkAgAS0AA0EPcUF8ag4GAQAAAAABAAtB/+UAQbLHAEHhBkHFCxCDBgALIABCADcDMCACQRBqJAAgAQuwAwEBfyMAQeAAayIDJAACQAJAIAJBBnFBAkYNACAAIAEQ8gIhAQJAIAJBAXENACABIQIMAgsCQAJAIAJBBHFFDQACQCABQaD4AGtBDG1BK0sNAEHiFBCMBiECAkAgACkAMEIAUg0AIANB7y02AjAgAyACNgI0IANB2ABqIABBrxogA0EwahDZAyACIQIMAwsgAyAAQTBqKQMANwNQIAAgA0HQAGoQuQMhASADQe8tNgJAIAMgATYCRCADIAI2AkggA0HYAGogAEG/GiADQcAAahDZAyACIQIMAgsCQAJAIAENAEEAIQAMAQsgAS0AA0EPcSEACyABIQICQCAAQXxqDgYEAAAAAAQAC0GM5gBBsscAQZoFQeMkEIMGAAtBoTIQjAYhAgJAAkAgACkAMEIAUg0AIANB7y02AgAgAyACNgIEIANB2ABqIABBrxogAxDZAwwBCyADIABBMGopAwA3AyggACADQShqELkDIQEgA0HvLTYCECADIAE2AhQgAyACNgIYIANB2ABqIABBvxogA0EQahDZAwsgAiECCyACECALQQAhAgsgA0HgAGokACACCzUBAX8jAEEQayICJAAgAiABKQMANwMIIAAgAkEIakEAEI4DIQEgAEIANwMwIAJBEGokACABCzUBAX8jAEEQayICJAAgAiABKQMANwMIIAAgAkEIakECEI4DIQEgAEIANwMwIAJBEGokACABC6oCAQJ/AkACQCABQaD4AGtBDG1BK0sNACABKAIEIQIMAQsCQAJAIAEgACgA5AEiAiACKAJgamsgAi8BDkEEdE8NAAJAIAAoAvgBDQAgAEEwEIoBIQIgAEEMOgBEIAAgAjYC+AEgAg0AQQAhAgwDCyAAKAL4ASgCFCIDIQIgAw0CIABBCUEQEIkBIgINAUEAIQIMAgsCQAJAIAENAEEAIQAMAQsgAS0AA0EPcSEACwJAAkAgAEF8ag4GAQAAAAABAAtBlOcAQbLHAEH6BkGyJBCDBgALIAEoAgQPCyAAKAL4ASACNgIUIAJBoPgAQagBakEAQaD4AEGwAWooAgAbNgIEIAIhAgtBACACIgBBoPgAQRhqQQBBoPgAQSBqKAIAGyAAGyIAIAAgAUYbC6IBAgF/AX4jAEEgayICJAAgAiABKQMANwMIIAJBEGogACACQQhqQTQQmAMCQAJAIAIpAxBCAFINAEEAIQEgAC0ARQ0BIAJBGGogAEGWNUEAENkDQQAhAQwBCyACIAIpAxAiAzcDGCACIAM3AwAgACACQQIQjgMhASAAQgA3AzACQCABDQAgAkEYaiAAQaQ1QQAQ2QMLIAEhAQsgAkEgaiQAIAELrgICAn8BfiMAQTBrIgQkACAEQSBqIAMQyQMgASAEKQMgNwMwIAQgAikDACIGNwMYIAQgBjcDKCABIARBGGpBABCOAyEDIAFCADcDMCAEIAQpAyA3AxAgBEEoaiABIAMgBEEQahCPA0EAIQMCQAJAAkAgBCgCLEGPgMD/B3FBA0cNAEEAIQMgBCgCKEGw+XxqIgVBAEgNACAFQQAvAcjuAU4NAUEAIQNBkP8AIAVBA3RqIgUtAANBAXFFDQAgBSEDIAUtAAINAgsCQAJAIAMiA0UNACADKAIEIQMgBCACKQMANwMIIAAgASAEQQhqIAMRAQAMAQsgACAEKQMoNwMACyAEQTBqJAAPC0H3FkGyxwBB/wNBy8MAEIMGAAtB0dwAQbLHAEGCBEHLwwAQgwYAC+wBAgN/AX4jAEEgayIDJAACQAJAIAINAEEAIQQMAQsgAyABKQMANwMQQQAhBCADQRBqEPYDDQAgAyABKQMAIgY3AwggAyAGNwMYIAAgA0EIakEAEI4DIQQgAEIANwMwIAMgASkDACIGNwMAIAMgBjcDGCAAIANBAhCOAyEFIABCADcDMEEAIQECQCAERQ0AAkAgBCAFRg0AIAQhAQwBCyAAIAQQlgMhAQtBACEEIAEiAUUNACABIQEDQAJAIAEiASACRiIERQ0AIAQhBAwCCyAAIAEQlgMiBSEBIAQhBCAFDQALCyADQSBqJAAgBAuIAQICfwF+IwBBMGsiBCQAIAEgAykDADcDMCAEIAIpAwAiBjcDICAEIAY3AyggASAEQSBqQQAQjgMhBSABQgA3AzAgBCADKQMANwMYIARBKGogASAFIARBGGoQjwMgBCACKQMANwMQIAQgBCkDKDcDCCAAIAEgBEEQaiAEQQhqEIoDIARBMGokAAudAgECfyMAQTBrIgQkAAJAAkAgA0GBwANJDQAgAEIANwMADAELIAQgAikDADcDIAJAIAEgBEEgaiAEQSxqEPIDIgVFDQAgBCgCLCADTQ0AIAQgAikDADcDEAJAIAEgBEEQahDFA0UNACAEIAIpAwA3AwgCQCABIARBCGogAxDhAyIDQX9KDQAgAEIANwMADAMLIAUgA2ohAyAAIAFBCCABIAMgAxDkAxCYARDrAwwCCyAAIAUgA2otAAAQ6QMMAQsgBCACKQMANwMYAkAgASAEQRhqEPMDIgFFDQAgASgCAEGAgID4AHFBgICAGEcNACABLwEIIANNDQAgACABKAIMIANBA3RqKQMANwMADAELIABCADcDAAsgBEEwaiQAC74EAgF/An4jAEGwAWsiBCQAIAQgAykDADcDkAECQAJAIARBkAFqEMYDRQ0AIAQgAikDACIFNwOIASAEIAU3A6gBAkAgASAEQYgBahD0Aw0AIAQgBCkDqAE3A4ABIAEgBEGAAWoQ7wMNACAEIAQpA6gBNwN4IAEgBEH4AGoQxQNFDQELIAQgAykDADcDECABIARBEGoQ7QMhAyAEIAIpAwA3AwggACABIARBCGogAxCbAwwBCyAEIAMpAwA3A3ACQCABIARB8ABqEMUDRQ0AIAQgAykDACIGNwOgASAEIAIpAwAiBTcDmAEgASAGNwMwIAQgBTcDMCAEIAU3A6gBIAEgBEEwakEAEI4DIQMgAUIANwMwIAQgBCkDoAE3AyggBEGoAWogASADIARBKGoQjwMgBCAEKQOYATcDICAEIAQpA6gBNwMYIAAgASAEQSBqIARBGGoQigMMAQsgBCADKQMANwNoIARBqAFqIAEgBEHoAGoQzQMgAyAEKQOoATcDACAEIAMpAwA3A2AgASAEQeAAahCOASAEIAMpAwAiBjcDoAEgBCACKQMAIgU3A5gBIAEgBjcDMCAEIAU3A1ggBCAFNwOoASABIARB2ABqQQAQjgMhAiABQgA3AzAgBCAEKQOgATcDUCAEQagBaiABIAIgBEHQAGoQjwMgBCAEKQOYATcDSCAEIAQpA6gBNwNAIAAgASAEQcgAaiAEQcAAahCKAyAEIAMpAwA3AzggASAEQThqEI8BCyAEQbABaiQAC/IDAgF/AX4jAEGQAWsiBCQAIAQgAikDADcDgAECQAJAIARBgAFqEMYDRQ0AIAQgASkDACIFNwN4IAQgBTcDiAECQCAAIARB+ABqEPQDDQAgBCAEKQOIATcDcCAAIARB8ABqEO8DDQAgBCAEKQOIATcDaCAAIARB6ABqEMUDRQ0BCyAEIAIpAwA3AxggACAEQRhqEO0DIQIgBCABKQMANwMQIAQgAykDADcDCCAAIARBEGogAiAEQQhqEJ4DDAELIAAgAikDADcDMCAEIAEpAwAiBTcDYCAEIAU3A4gBAkAgACAEQeAAakEBEI4DIgFFDQACQAJAIAEtAANBD3FBfGoOBgEAAAAAAQALQf/lAEGyxwBB4QZBxQsQgwYACyAAQgA3AzAgAUUNASAEIAIpAwA3A1gCQCAAIARB2ABqEMUDRQ0AIAQgAikDADcDKCAEIAMpAwA3AyAgACABIARBKGogBEEgahD0AgwCCyAEIAIpAwA3A1AgBEGIAWogACAEQdAAahDNAyACIAQpA4gBNwMAIAQgAikDADcDSCAAIARByABqEI4BIAQgAikDADcDQCAEIAMpAwA3AzggACABIARBwABqIARBOGoQ9AIgBCACKQMANwMwIAAgBEEwahCPAQwBCyAAQgA3AzALIARBkAFqJAALtwMCBH8BfiMAQdAAayIEJAACQAJAIAJBgcADSQ0AIARByABqIABBDxDfAwwBCyAEIAEpAwA3AzgCQCAAIARBOGoQ8ANFDQAgBCABKQMANwMgIAAgBEEgaiAEQcQAahDxAyEBAkAgBCgCRCIFIAJNDQAgBCADKQMANwMIIAEgAmogACAEQQhqEO0DOgAADAILIAQgAjYCECAEIAU2AhQgBEHIAGogAEHUDSAEQRBqENsDDAELIAQgASkDADcDMAJAIAAgBEEwahDzAyIFRQ0AIAUoAgBBgICA+ABxQYCAgBhHDQACQCACQYE4SQ0AIARByABqIABBDxDfAwwCCyADKQMAIQggAkEBaiEBAkAgBS8BCiACSw0AIAAgAUEKbEEDdiIDQQQgA0EESxsiBkEDdBCKASIDRQ0CAkAgBSgCDCIHRQ0AIAMgByAFLwEIQQN0EKEGGgsgBSAGOwEKIAUgAzYCDCAAKAKgAiADEIsBCyAFKAIMIAJBA3RqIAg3AwAgBS8BCCACSw0BIAUgATsBCAwBCyAEIAEpAwA3AyggBEHIAGogAEEPIARBKGoQ3QMLIARB0ABqJAALvwEBBX8jAEEQayIEJAACQAJAIAJBgThJDQAgBEEIaiAAQQ8Q3wMMAQsgAkEBaiEFAkAgAS8BCiACSw0AIAAgBUEKbEEDdiIGQQQgBkEESxsiB0EDdBCKASIGRQ0BAkAgASgCDCIIRQ0AIAYgCCABLwEIQQN0EKEGGgsgASAHOwEKIAEgBjYCDCAAKAKgAiAGEIsBCyABKAIMIAJBA3RqIAMpAwA3AwAgAS8BCCACSw0AIAEgBTsBCAsgBEEQaiQAC/IBAgZ/AX4jAEEgayIDJAAgAyACKQMANwMQIAAgA0EQahCOAQJAAkAgAS8BCCIEQYE4SQ0AIANBGGogAEEPEN8DDAELIAIpAwAhCSAEQQFqIQUCQCABLwEKIARLDQAgACAFQQpsQQN2IgZBBCAGQQRLGyIHQQN0EIoBIgZFDQECQCABKAIMIghFDQAgBiAIIAEvAQhBA3QQoQYaCyABIAc7AQogASAGNgIMIAAoAqACIAYQiwELIAEoAgwgBEEDdGogCTcDACABLwEIIARLDQAgASAFOwEICyADIAIpAwA3AwggACADQQhqEI8BIANBIGokAAtcAgF/AX4jAEEgayIDJAAgAyABQQN0IABqQeAAaikDACIENwMQIAMgBDcDGCACIQECQCADQRBqEPcDDQAgAyADKQMYNwMIIAAgA0EIahDtAyEBCyADQSBqJAAgAQs+AgF/AX4jAEEQayICJAAgAiABQQN0IABqQeAAaikDACIDNwMAIAIgAzcDCCAAIAIQ7QMhACACQRBqJAAgAAs+AgF/AX4jAEEQayICJAAgAiABQQN0IABqQeAAaikDACIDNwMAIAIgAzcDCCAAIAIQ7gMhACACQRBqJAAgAAtAAwF/AX4BfCMAQRBrIgIkACACIAFBA3QgAGpB4ABqKQMAIgM3AwAgAiADNwMIIAAgAhDsAyEEIAJBEGokACAECzYBAX8jAEEQayICJAAgAkEIaiABEOgDAkAgACgC7AEiAEUNACAAIAIpAwg3AyALIAJBEGokAAs2AQF/IwBBEGsiAiQAIAJBCGogARDpAwJAIAAoAuwBIgFFDQAgASACKQMINwMgCyACQRBqJAALNgEBfyMAQRBrIgIkACACQQhqIAEQ6gMCQCAAKALsASIBRQ0AIAEgAikDCDcDIAsgAkEQaiQACzoBAX8jAEEQayICJAAgAkEIaiAAQQggARDrAwJAIAAoAuwBIgBFDQAgACACKQMINwMgCyACQRBqJAALegIDfwF+IwBBIGsiASQAIAEgACkDWCIENwMIIAEgBDcDGAJAAkAgACABQQhqEPMDIgINAEEAIQMMAQsgAi0AA0EPcSEDCyACIQICQAJAIANBfGoOBgEAAAAAAQALIAFBEGogAEGrPUEAENkDQQAhAgsgAUEgaiQAIAILLAEBfwJAIAAoAiwiAygC7AENACAAIAI2AjQgACABNgIwDwsgAyACIAERAgALPAEBfyMAQRBrIgIkACACIAEpAwA3AwggACACQQhqEPUDIQEgAkEQaiQAIAFBDklBvMAAIAFB//8AcXZxC00BAX8CQCACQSxJDQAgAEIANwMADwsCQCABIAIQ8gIiA0Gg+ABrQQxtQStLDQAgAEEANgIEIAAgAkHgAGo2AgAPCyAAIAFBCCADEOsDC4ACAQJ/IAIhAwNAAkAgAyICQaD4AGtBDG0iA0ErSw0AAkAgASADEPICIgJBoPgAa0EMbUErSw0AIABBADYCBCAAIANB4ABqNgIADwsgACABQQggAhDrAw8LAkAgAiABKADkASIDIAMoAmBqayADLwEOQQR0Tw0AIABCADcDAA8LAkACQCACDQBBACEDDAELIAItAANBD3EhAwsCQAJAIANBfGoOBgEAAAAAAQALQZTnAEGyxwBB2AlB2jIQgwYACwJAIAJFDQAgAigCAEGAgID4AHFBgICAyABHDQAgAigCBCIEIQMgBEGg+ABrQQxtQSxJDQELCyAAIAFBCCACEOsDCyQAAkAgAS0AFEEKSQ0AIAEoAggQIAsgAUEAOwECIAFBADoAFAtOAQN/QQAhAQNAIAAgASICQRhsaiIBQRRqIQMCQCABLQAUQQpJDQAgASgCCBAgCyADQQA6AAAgAUEAOwECIAJBAWoiAiEBIAJBFEcNAAsLywEBCH8jAEEgayECAkAgACAALwHgAyIDQRhsaiABRw0AIAEPCwJAIABBACADQQFqIANBEksbIgRBGGxqIgMgAUYNACACQQhqQRBqIgUgAUEQaiIGKQIANwMAIAJBCGpBCGoiByABQQhqIggpAgA3AwAgAiABKQIANwMIIAYgA0EQaiIJKQIANwIAIAggA0EIaiIGKQIANwIAIAEgAykCADcCACAJIAUpAwA3AgAgBiAHKQMANwIAIAMgAikDCDcCAAsgACAEOwHgAyADC8EDAQZ/IwBBIGsiBCQAAkAgAkUNAEEAIQUCQANAAkAgACAFIgVBGGxqLwECDQAgACAFQRhsaiEFDAILIAVBAWoiBiEFIAZBFEcNAAtBACEFCyAFIgYhBQJAIAYNACAAQQAgAC8B4AMiBUEBaiAFQRJLG0EYbCIGaiIFQRRqIQcCQCAFLQAUQQpJDQAgACAGaigCCBAgCyAHQQA6AAAgACAGakEAOwECIAUhBQsgBSIFQQA7ARYgBSACOwECIAUgATsBACAFIAM6ABQCQCADQQpJDQAgBSADEB82AggLAkACQCAAIAAvAeADIgZBGGxqIAVHDQAgBSEFDAELAkAgAEEAIAZBAWogBkESSxsiA0EYbGoiBiAFRg0AIARBCGpBEGoiAiAFQRBqIgEpAgA3AwAgBEEIakEIaiIHIAVBCGoiCCkCADcDACAEIAUpAgA3AwggASAGQRBqIgkpAgA3AgAgCCAGQQhqIgEpAgA3AgAgBSAGKQIANwIAIAkgAikDADcCACABIAcpAwA3AgAgBiAEKQMINwIACyAAIAM7AeADIAYhBQsgBEEgaiQAIAUPC0Hu2wBBps0AQSVB0MQAEIMGAAt5AQV/QQAhBAJAA0AgBiEFAkACQCAAIAQiB0EYbCIGaiIELwEAIAFHDQAgACAGaiIILwECIAJHDQBBACEGIAQhBCAILwEWIANGDQELQQEhBiAFIQQLIAQhBCAGRQ0BIAQhBiAHQQFqIgchBCAHQRRHDQALQQAPCyAEC0YBAn9BACEDA0ACQCAAIAMiA0EYbGoiBC8BACABRw0AIAQoAgQgAk0NACAEQQRqIAI2AgALIANBAWoiBCEDIARBFEcNAAsLWwEDf0EAIQIDQAJAIAAgAiIDQRhsaiICLwEAIAFHDQAgAkEUaiEEAkAgAi0AFEEKSQ0AIAIoAggQIAsgBEEAOgAAIAJBADsBAgsgA0EBaiIDIQIgA0EURw0ACwtVAQF/AkAgAkUNACADIAAgAxsiAyAAQeADaiIETw0AIAMhAwNAAkAgAyIDLwECIAJHDQAgAy8BACABRw0AIAMPCyADQRhqIgAhAyAAIARJDQALC0EAC10BA38jAEEgayIBJABBACECAkAgACABQSAQuwUiA0EASA0AIANBAWoQHyECAkACQCADQSBKDQAgAiABIAMQoQYaDAELIAAgAiADELsFGgsgAiECCyABQSBqJAAgAgskAQF/AkACQCABDQBBACECDAELIAEQ0AYhAgsgACABIAIQvgUL0AIBA38jAEHQAGsiAyQAIAMgAikDADcDSCADIAAgA0HIAGoQuQM2AkQgAyABNgJAQZsbIANBwABqEDsgAS0AACEBIAMgAikDADcDOAJAAkAgACADQThqEPMDIgINAEEAIQQMAQsgAi0AA0EPcSEECwJAAkAgBEF8ag4GAAEBAQEAAQsgAi8BCEUNAEEgIAEgAUEqRxsgASABQSFHGyABIAFBPkcbwCEEQQAhAQNAAkAgASIBQQtHDQAgAyAENgIAQcDiACADEDsMAgsgAyACKAIMIAFBBHQiBWopAwA3AzAgAyAAIANBMGoQuQM2AiQgAyAENgIgQbLZACADQSBqEDsgAyACKAIMIAVqQQhqKQMANwMYIAMgACADQRhqELkDNgIUIAMgBDYCEEHKHCADQRBqEDsgAUEBaiIFIQEgBSACLwEISQ0ACwsgA0HQAGokAAvmAwEDfyMAQeAAayICJAACQAJAAkBBECABKAIEIgNBD3EgA0GAgMD/B3EbIgNBCksNAEEBIAN0QagMcQ0BIANBCEcNACABKAIAIgNFDQAgAygCAEGAgID4AHFBgICAOEYNAQsgAiABKQMANwMIIAAgAkEIakEAEMgDIgQhAyAEDQEgAiABKQMANwMAIAAgAhC6AyEDDAELIAIgASkDADcDQCAAIAJBwABqIAJB2ABqIAJB1ABqEIwDIQMCQAJAIAIpA1hQRQ0AQQAhAQwBCyACIAIpA1g3AzgCQCAAIAJBOGoQugMiAUGAgQJGDQAgAiABNgIwQYCBAkHAAEHQHCACQTBqEIgGGgsCQEGAgQIQ0AYiAUEnSQ0AQQBBAC0Av2I6AIKBAkEAQQAvAL1iOwGAgQJBAiEBDAELIAFBgIECakEuOgAAIAFBAWohAQsgASEBAkACQCACKAJUIgQNACABIQEMAQsgAkHIAGogAEEIIAQQ6wMgAiACKAJINgIgIAFBgIECakHAACABa0HCCyACQSBqEIgGGkGAgQIQ0AYiAUGAgQJqQcAAOgAAIAFBAWohAQsgAiADNgIQIAEiAUGAgQJqQcAAIAFrQZbBACACQRBqEIgGGkGAgQIhAwsgAkHgAGokACADC9EGAQN/IwBBkAFrIgIkAAJAAkAgASgCBCIDQX9HDQAgAiABKAIANgIAQYCBAkHAAEHIwwAgAhCIBhpBgIECIQMMAQtBACEEAkACQAJAAkACQAJAAkACQAJAAkACQAJAQRAgA0EPcSABQQZqLwEAQfD/AXEbDhEBCgQCAwYFCwkIBwsLCwsLAAsLIAIgASkDADcDKCACIAAgAkEoahDsAzkDIEGAgQJBwABB6zAgAkEgahCIBhpBgIECIQMMCwtBsykhAwJAAkACQAJAAkACQAJAIAEoAgAiAQ5EAAEFEQYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgIGAwQGC0H6PiEDDBALQc00IQMMDwtBuDIhAwwOC0GKCCEDDA0LQYkIIQMMDAtBu9UAIQMMCwsCQCABQaB/aiIDQStLDQAgAiADNgIwQYCBAkHAAEGdwQAgAkEwahCIBhpBgIECIQMMCwtBliohAyABQYAISQ0KIAIgAUEPcTYCRCACIAFBgHhqQQR2NgJAQYCBAkHAAEGRDSACQcAAahCIBhpBgIECIQMMCgtBuyUhBAwIC0G/L0HcHCABKAIAQYCAAUkbIQQMBwtBjjchBAwGC0GBISEEDAULIAIgASgCADYCVCACIANBBHZB//8DcTYCUEGAgQJBwABBswogAkHQAGoQiAYaQYCBAiEDDAULIAIgASgCADYCZCACIANBBHZB//8DcTYCYEGAgQJBwABBhiQgAkHgAGoQiAYaQYCBAiEDDAQLIAIgASgCADYCdCACIANBBHZB//8DcTYCcEGAgQJBwABB+CMgAkHwAGoQiAYaQYCBAiEDDAMLAkACQCABKAIAIgENAEF/IQQMAQsgAS0AA0EPcUF/aiEEC0Gu2QAhAwJAIAQiBEEMSw0AIARBAnRByIgBaigCACEDCyACIAE2AoQBIAIgAzYCgAFBgIECQcAAQfIjIAJBgAFqEIgGGkGAgQIhAwwCC0HWzgAhBAsCQCAEIgMNAEGIMyEDDAELIAIgASgCADYCFCACIAM2AhBBgIECQcAAQe8NIAJBEGoQiAYaQYCBAiEDCyACQZABaiQAIAML4AUCFn8EfiMAQeAAayICQcAAakEYaiAAQRhqKQIAIhg3AwAgAkHAAGpBEGogAEEQaikCACIZNwMAIAIgACkCACIaNwNAIAIgAEEIaikCACIbNwNIIAEhA0EAIQQgAigCXCEFIBinIQYgAigCVCEBIBmnIQcgAigCTCEIIBunIQkgAigCRCEKIBqnIQsDQCAEIgxBBHQhDSADIQRBACEDIAchByABIQ4gBiEPIAUhECALIQsgCiERIAkhEiAIIRMDQCATIRMgEiEIIBEhCSALIQogECEQIA8hBSAOIQYgByEBIAMhAyAEIQQCQAJAIAwNACACIANBAnRqIAQoAAAiB0EYdCAHQYD+A3FBCHRyIAdBCHZBgP4DcSAHQRh2cnI2AgAgBEEEaiEHDAELIAIgA0ECdGoiDiACIANBAWpBD3FBAnRqKAIAIgdBGXcgB0EOd3MgB0EDdnMgDigCAGogAiADQQlqQQ9xQQJ0aigCAGogAiADQQ5qQQ9xQQJ0aigCACIHQQ93IAdBDXdzIAdBCnZzajYCACAEIQcLIAIgATYCVCACIAY2AlggAiAFNgJcIAIgEyABQRp3IAFBFXdzIAFBB3dzIAYgAXFqIBBqIAUgAUF/c3FqIAMgDXJBAnRBgIkBaigCAGogAiADQQJ0aigCAGoiBGoiFDYCUCACIAo2AkQgAiAJNgJIIAIgCDYCTCACIApBHncgCkETd3MgCkEKd3MgBGogCCAJcyAKcSAIIAlxc2oiFTYCQCAHIhYhBCADQQFqIhchAyAUIQcgASEOIAYhDyAFIRAgFSELIAohESAJIRIgCCETIBdBEEcNAAsgFiEDIAxBAWoiDiEEIAUhBSAGIQYgASEBIBQhByAIIQggCSEJIAohCiAVIQsgDkEERw0AC0EAIQEDQCAAIAEiAUECdCIKaiIDIAMoAgAgAkHAAGogCmooAgBqNgIAIAFBAWoiCiEBIApBCEcNAAsLtAIBBX8gACgCSCEBIAAoAkQiAkGAAToAACAAQdAAaiEDIAJBAWohAgJAAkAgAUF/aiIBQQdNDQAgASEBIAIhAgwBCyACQQAgARCjBhogAyAAQQRqIgIQuwNBwAAhASACIQILIAJBACABQXhqIgEQowYgAWoiBCAAKAJMIgFBA3Q6AAdBBiECIAFBBXYhBQNAIAQgAiIBaiAFIgU6AAAgAUF/aiECIAVBCHYhBSABDQALIAMgAEEEahC7AyAAKAIAIQJBACEBQQAhBQNAIAIgASIBaiADIAUiBEECdGoiBS0AAzoAACACIAFBAXJqIAUvAQI6AAAgAiABQQJyaiAFKAIAQQh2OgAAIAIgAUEDcmogBSgCADoAACABQQRqIQEgBEEBaiIEIQUgBEEIRw0ACyAAKAIAC5EBABAiAkBBAC0AwIECRQ0AQbvOAEEOQcshEP4FAAtBAEEBOgDAgQIQI0EAQquzj/yRo7Pw2wA3AqyCAkEAQv+kuYjFkdqCm383AqSCAkEAQvLmu+Ojp/2npX83ApyCAkEAQufMp9DW0Ouzu383ApSCAkEAQsAANwKMggJBAEHIgQI2AoiCAkEAQcCCAjYCxIECC/kBAQN/AkAgAUUNAEEAQQAoApCCAiABajYCkIICIAEhASAAIQADQCAAIQBBACgCjIICIQICQCABIgFBwABJDQAgAkHAAEcNAEGUggIgABC7AyABQUBqIgIhASAAQcAAaiEAIAINAQwCC0EAKAKIggIgACABIAIgASACSRsiAhChBhpBAEEAKAKMggIiAyACazYCjIICIAAgAmohACABIAJrIQQCQCADIAJHDQBBlIICQciBAhC7A0EAQcAANgKMggJBAEHIgQI2AoiCAiAEIQEgACEAIAQNAQwCC0EAQQAoAoiCAiACajYCiIICIAQhASAAIQAgBA0ACwsLTABBxIECELwDGiAAQRhqQQApA9iCAjcAACAAQRBqQQApA9CCAjcAACAAQQhqQQApA8iCAjcAACAAQQApA8CCAjcAAEEAQQA6AMCBAgvbBwEDf0EAQgA3A5iDAkEAQgA3A5CDAkEAQgA3A4iDAkEAQgA3A4CDAkEAQgA3A/iCAkEAQgA3A/CCAkEAQgA3A+iCAkEAQgA3A+CCAgJAAkACQAJAIAFBwQBJDQAQIkEALQDAgQINAkEAQQE6AMCBAhAjQQAgATYCkIICQQBBwAA2AoyCAkEAQciBAjYCiIICQQBBwIICNgLEgQJBAEKrs4/8kaOz8NsANwKsggJBAEL/pLmIxZHagpt/NwKkggJBAELy5rvjo6f9p6V/NwKcggJBAELnzKfQ1tDrs7t/NwKUggIgASECIAAhAQJAA0AgASEBQQAoAoyCAiEAAkAgAiICQcAASQ0AIABBwABHDQBBlIICIAEQuwMgAkFAaiIAIQIgAUHAAGohASAADQEMAgtBACgCiIICIAEgAiAAIAIgAEkbIgAQoQYaQQBBACgCjIICIgMgAGs2AoyCAiABIABqIQEgAiAAayEEAkAgAyAARw0AQZSCAkHIgQIQuwNBAEHAADYCjIICQQBByIECNgKIggIgBCECIAEhASAEDQEMAgtBAEEAKAKIggIgAGo2AoiCAiAEIQIgASEBIAQNAAsLQcSBAhC8AxpBAEEAKQPYggI3A/iCAkEAQQApA9CCAjcD8IICQQBBACkDyIICNwPoggJBAEEAKQPAggI3A+CCAkEAQQA6AMCBAkEAIQEMAQtB4IICIAAgARChBhpBACEBCwNAIAEiAUHgggJqIgIgAi0AAEE2czoAACABQQFqIgIhASACQcAARw0ADAILAAtBu84AQQ5ByyEQ/gUACxAiAkBBAC0AwIECDQBBAEEBOgDAgQIQI0EAQsCAgIDwzPmE6gA3ApCCAkEAQcAANgKMggJBAEHIgQI2AoiCAkEAQcCCAjYCxIECQQBBmZqD3wU2ArCCAkEAQozRldi5tfbBHzcCqIICQQBCuuq/qvrPlIfRADcCoIICQQBChd2e26vuvLc8NwKYggJBwAAhAkHgggIhAQJAA0AgASEBQQAoAoyCAiEAAkAgAiICQcAASQ0AIABBwABHDQBBlIICIAEQuwMgAkFAaiIAIQIgAUHAAGohASAADQEMAgtBACgCiIICIAEgAiAAIAIgAEkbIgAQoQYaQQBBACgCjIICIgMgAGs2AoyCAiABIABqIQEgAiAAayEEAkAgAyAARw0AQZSCAkHIgQIQuwNBAEHAADYCjIICQQBByIECNgKIggIgBCECIAEhASAEDQEMAgtBAEEAKAKIggIgAGo2AoiCAiAEIQIgASEBIAQNAAsLDwtBu84AQQ5ByyEQ/gUAC/kBAQN/AkAgAUUNAEEAQQAoApCCAiABajYCkIICIAEhASAAIQADQCAAIQBBACgCjIICIQICQCABIgFBwABJDQAgAkHAAEcNAEGUggIgABC7AyABQUBqIgIhASAAQcAAaiEAIAINAQwCC0EAKAKIggIgACABIAIgASACSRsiAhChBhpBAEEAKAKMggIiAyACazYCjIICIAAgAmohACABIAJrIQQCQCADIAJHDQBBlIICQciBAhC7A0EAQcAANgKMggJBAEHIgQI2AoiCAiAEIQEgACEAIAQNAQwCC0EAQQAoAoiCAiACajYCiIICIAQhASAAIQAgBA0ACwsL+gYBBX9BxIECELwDGiAAQRhqQQApA9iCAjcAACAAQRBqQQApA9CCAjcAACAAQQhqQQApA8iCAjcAACAAQQApA8CCAjcAAEEAQQA6AMCBAhAiAkBBAC0AwIECDQBBAEEBOgDAgQIQI0EAQquzj/yRo7Pw2wA3AqyCAkEAQv+kuYjFkdqCm383AqSCAkEAQvLmu+Ojp/2npX83ApyCAkEAQufMp9DW0Ouzu383ApSCAkEAQsAANwKMggJBAEHIgQI2AoiCAkEAQcCCAjYCxIECQQAhAQNAIAEiAUHgggJqIgIgAi0AAEHqAHM6AAAgAUEBaiICIQEgAkHAAEcNAAtBAEHAADYCkIICQcAAIQJB4IICIQECQANAIAEhAUEAKAKMggIhAwJAIAIiAkHAAEkNACADQcAARw0AQZSCAiABELsDIAJBQGoiAyECIAFBwABqIQEgAw0BDAILQQAoAoiCAiABIAIgAyACIANJGyIDEKEGGkEAQQAoAoyCAiIEIANrNgKMggIgASADaiEBIAIgA2shBQJAIAQgA0cNAEGUggJByIECELsDQQBBwAA2AoyCAkEAQciBAjYCiIICIAUhAiABIQEgBQ0BDAILQQBBACgCiIICIANqNgKIggIgBSECIAEhASAFDQALC0EAQQAoApCCAkEgajYCkIICQSAhAiAAIQECQANAIAEhAUEAKAKMggIhAwJAIAIiAkHAAEkNACADQcAARw0AQZSCAiABELsDIAJBQGoiAyECIAFBwABqIQEgAw0BDAILQQAoAoiCAiABIAIgAyACIANJGyIDEKEGGkEAQQAoAoyCAiIEIANrNgKMggIgASADaiEBIAIgA2shBQJAIAQgA0cNAEGUggJByIECELsDQQBBwAA2AoyCAkEAQciBAjYCiIICIAUhAiABIQEgBQ0BDAILQQBBACgCiIICIANqNgKIggIgBSECIAEhASAFDQALC0HEgQIQvAMaIABBGGpBACkD2IICNwAAIABBEGpBACkD0IICNwAAIABBCGpBACkDyIICNwAAIABBACkDwIICNwAAQQBCADcD4IICQQBCADcD6IICQQBCADcD8IICQQBCADcD+IICQQBCADcDgIMCQQBCADcDiIMCQQBCADcDkIMCQQBCADcDmIMCQQBBADoAwIECDwtBu84AQQ5ByyEQ/gUAC+0HAQF/IAAgARDAAwJAIANFDQBBAEEAKAKQggIgA2o2ApCCAiADIQMgAiEBA0AgASEBQQAoAoyCAiEAAkAgAyIDQcAASQ0AIABBwABHDQBBlIICIAEQuwMgA0FAaiIAIQMgAUHAAGohASAADQEMAgtBACgCiIICIAEgAyAAIAMgAEkbIgAQoQYaQQBBACgCjIICIgkgAGs2AoyCAiABIABqIQEgAyAAayECAkAgCSAARw0AQZSCAkHIgQIQuwNBAEHAADYCjIICQQBByIECNgKIggIgAiEDIAEhASACDQEMAgtBAEEAKAKIggIgAGo2AoiCAiACIQMgASEBIAINAAsLIAgQwgMgCEEgEMADAkAgBUUNAEEAQQAoApCCAiAFajYCkIICIAUhAyAEIQEDQCABIQFBACgCjIICIQACQCADIgNBwABJDQAgAEHAAEcNAEGUggIgARC7AyADQUBqIgAhAyABQcAAaiEBIAANAQwCC0EAKAKIggIgASADIAAgAyAASRsiABChBhpBAEEAKAKMggIiCSAAazYCjIICIAEgAGohASADIABrIQICQCAJIABHDQBBlIICQciBAhC7A0EAQcAANgKMggJBAEHIgQI2AoiCAiACIQMgASEBIAINAQwCC0EAQQAoAoiCAiAAajYCiIICIAIhAyABIQEgAg0ACwsCQCAHRQ0AQQBBACgCkIICIAdqNgKQggIgByEDIAYhAQNAIAEhAUEAKAKMggIhAAJAIAMiA0HAAEkNACAAQcAARw0AQZSCAiABELsDIANBQGoiACEDIAFBwABqIQEgAA0BDAILQQAoAoiCAiABIAMgACADIABJGyIAEKEGGkEAQQAoAoyCAiIJIABrNgKMggIgASAAaiEBIAMgAGshAgJAIAkgAEcNAEGUggJByIECELsDQQBBwAA2AoyCAkEAQciBAjYCiIICIAIhAyABIQEgAg0BDAILQQBBACgCiIICIABqNgKIggIgAiEDIAEhASACDQALC0EAQQAoApCCAkEBajYCkIICQQEhAUHI7gAhAwJAA0AgAyEDQQAoAoyCAiEAAkAgASIBQcAASQ0AIABBwABHDQBBlIICIAMQuwMgAUFAaiIAIQEgA0HAAGohAyAADQEMAgtBACgCiIICIAMgASAAIAEgAEkbIgAQoQYaQQBBACgCjIICIgkgAGs2AoyCAiADIABqIQMgASAAayECAkAgCSAARw0AQZSCAkHIgQIQuwNBAEHAADYCjIICQQBByIECNgKIggIgAiEBIAMhAyACDQEMAgtBAEEAKAKIggIgAGo2AoiCAiACIQEgAyEDIAINAAsLIAgQwgMLkwcCCX8BfiMAQYABayIIJABBACEJQQAhCkEAIQsDQCALIQwgCiEKQQAhCwJAIAkiCSACRg0AIAEgCWotAAAhCwsgCyELAkACQAJAAkACQCAJQQFqIg0gAk8iDg0AIAtB/wFxQfsARg0BCyAODQEgC0H/AXFB/QBHDQEgCyELIAlBAmogDSABIA1qLQAAQf0ARhshCQwCCyAJQQJqIQ4CQCABIA1qLQAAIglB+wBHDQAgCSELIA4hCQwCCwJAAkAgCUFQakH/AXFBCUsNACAJwEFQaiELDAELQX8hCyAJQSByIglBn39qQf8BcUEZSw0AIAnAQal/aiELCwJAIAsiDUEATg0AQSEhCyAOIQkMAgsgDiEJIA4hCwJAIA4gAk8NAANAAkAgASAJIglqLQAAQf0ARw0AIAkhCwwCCyAJQQFqIgshCSALIAJHDQALIAIhCwsCQAJAIA4gCyILSQ0AQX8hCQwBCwJAIAEgDmosAAAiDkFQaiIJQf8BcUEJSw0AIAkhCQwBC0F/IQkgDkEgciIOQZ9/akH/AXFBGUsNACAOQal/aiEJCyAJIQkgC0EBaiEPAkAgDSAGSA0AQT8hCyAPIQkMAgsgCCAFIA1BA3RqIgspAwAiETcDICAIIBE3A3ACQAJAIAhBIGoQxgNFDQAgCCALKQMANwMIIAhBMGogACAIQQhqEOwDQQcgCUEBaiAJQQBIGxCGBiAIIAhBMGoQ0AY2AnwgCEEwaiEODAELIAggCCkDcDcDGCAIQShqIAAgCEEYakEAEM4CIAggCCkDKDcDECAAIAhBEGogCEH8AGoQyAMhDgsgCCAIKAJ8IhBBf2oiCTYCfCAJIQ0gCiELIA4hDiAMIQkCQAJAIBANACAMIQsgCiEODAELA0AgCSEMIA0hCiAOIg4tAAAhCQJAIAsiCyAETw0AIAMgC2ogCToAAAsgCCAKQX9qIg02AnwgDSENIAtBAWoiECELIA5BAWohDiAMIAlBwAFxQYABR2oiDCEJIAoNAAsgDCELIBAhDgsgDyEKDAILIAshCyANIQkLIAkhDSALIQkCQCAKIARPDQAgAyAKaiAJOgAACyAMIAlBwAFxQYABR2ohCyAKQQFqIQ4gDSEKCyAKIg0hCSAOIg4hCiALIgwhCyANIAJNDQALAkAgBEUNACAEIANqQX9qQQA6AAALAkAgB0UNACAHIAw2AgALIAhBgAFqJAAgDgttAQJ/QQAhAgJAAkACQEEQIAEoAgQiA0EPcSADQYCAwP8HcRtBfGoOBQECAgIAAgsCQAJAIAEoAgAiAQ0AQQAhAQwBCyABLQADQQ9xIQELIAEiAUEGRiABQQxGcg8LIAEoAgBB//8ASyECCyACCxkAIAAoAgQiAEF/RiAAQYCAwP8HcUEAR3ILqwEBA38jAEEQayICJABBACEDAkACQAJAQRAgASgCBCIEQQ9xIARBgIDA/wdxG0F8ag4FAQICAgACC0EAIQMCQCABKAIAIgFFDQAgASgCAEGAgID4AHFBgICA4ABGIQMLIAFBBGpBACADGyEDDAELQQAhAyABKAIAIgFBgIADcUGAgANHDQAgAiAAKALkATYCDCACQQxqIAFB//8AcRCLBCEDCyACQRBqJAAgAwvaAQECf0EAIQMCQAJAAkBBECABKAIEIgRBD3EgBEGAgMD/B3EbQXxqDgUBAgICAAILAkAgASgCACIBDQBBAA8LAkAgASgCAEGAgID4AHFBgICAMEcNAAJAIAJFDQAgAiABLwEENgIACyABQQZqDwsCQCABDQBBAA8LQQAhAyABKAIAQYCAgPgAcUGAgIDgAEcNAQJAIAJFDQAgAiABLwEENgIACyABIAFBBmovAQBBA3ZB/j9xakEIag8LQQAhAyABKAIAIgFBgIABSQ0AIAAgASACEI0EIQMLIAMLFQAgAEEENgIEIAAgAUGAgAFyNgIAC6wBAQJ/IwBBEGsiBCQAIAQgAzYCDAJAIAJB+BgQ0gYNACAEIAQoAgwiAzYCCEEAQQAgAiAEQQRqIAMQhQYhAyAEIAQoAgRBf2oiBTYCBAJAIAEgACADQX9qIAUQlgEiBUUNACAFIAMgAiAEQQRqIAQoAggQhQYhAiAEIAQoAgRBf2oiAzYCBCABIAAgAkF/aiADEJcBCyAEQRBqJAAPC0GOywBBzABBwy8Q/gUACyYBAX8jAEEQayIEJAAgBCADNgIMIAAgASACIAMQygMgBEEQaiQACyUAAkAgASACIAMQmAEiAw0AIABCADcDAA8LIAAgAUEIIAMQ6wMLwwwCBH8BfiMAQeACayIDJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAQRAgAigCBCIEQQ9xIARBgIDA/wdxGyIFDhEDBAoFAQcLDAAGBwwMDAwMDQwLAkACQCACKAIAIgYNAEEAIQYMAQsgBi0AA0EPcSEGCyAGIgZBBkYgBkEMRnIhBgwBCyACKAIAQf//AEshBgsCQCAGRQ0AIAAgAikDADcDAAwMCyAFDhEAAQcCBgQICQUDBAkJCQkJCgkLAkACQAJAAkACQAJAAkACQCACKAIAIgIORAECBAAHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcDBwUGBwsgAEKqgIGAwAA3AwAMEQsgAELGgIGAwAA3AwAMEAsgAEKYgIGAwAA3AwAMDwsgAELFgIGAwAA3AwAMDgsgAEKJgIGAwAA3AwAMDQsgAEKEgIGAwAA3AwAMDAsgAEKBgIGAwAA3AwAMCwsCQCACQaB/aiIEQStLDQAgAyAENgIQIAAgAUGc0QAgA0EQahDLAwwLCwJAIAJBgAhJDQAgAyACNgIgIAAgAUHHzwAgA0EgahDLAwwLC0GOywBBnwFBqi4Q/gUACyADIAIoAgA2AjAgACABQdPPACADQTBqEMsDDAkLIAIoAgAhAiADIAEoAuQBNgJMIAMgA0HMAGogAhB7NgJAIAAgAUGB0AAgA0HAAGoQywMMCAsgAyABKALkATYCXCADIANB3ABqIARBBHZB//8DcRB7NgJQIAAgAUGQ0AAgA0HQAGoQywMMBwsgAyABKALkATYCZCADIANB5ABqIARBBHZB//8DcRB7NgJgIAAgAUGp0AAgA0HgAGoQywMMBgsCQAJAIAIoAgAiBA0AQQAhBQwBCyAELQADQQ9xIQULAkACQAJAAkACQAJAAkAgBUF9ag4LAAUCBgEGBQUDBgQGCyAAQo+AgYDAADcDAAwLCyAAQpyAgYDAADcDAAwKCyADIAIpAwA3A2ggACABIANB6ABqEM4DDAkLIAEgBC8BEhCHAyECIAQvARAhBSADIAQoAhwvAQQ2AnggAyAFNgJ0IAMgAjYCcCAAIAFBgtEAIANB8ABqEMsDDAgLIAQvAQQhAiAELwEGIQUgAyAELQAKNgKIASADIAU2AoQBIAMgAjYCgAEgACABQcHRACADQYABahDLAwwHCyAAQqaAgYDAADcDAAwGC0GOywBByQFBqi4Q/gUACyACKAIAQYCAAU8NBSADIAIpAwAiBzcDkAIgAyAHNwO4ASABIANBuAFqIANB3AJqEPIDIgRFDQYCQCADKALcAiICQSFJDQAgAyAENgKYASADQSA2ApQBIAMgAjYCkAEgACABQa3RACADQZABahDLAwwFCyADIAQ2AqgBIAMgAjYCpAEgAyACNgKgASAAIAFB09AAIANBoAFqEMsDDAQLIAMgASACKAIAEIcDNgLAASAAIAFBntAAIANBwAFqEMsDDAMLIAMgAikDADcDiAICQCABIANBiAJqEIEDIgRFDQAgBC8BACECIAMgASgC5AE2AoQCIAMgA0GEAmogAkEAEIwENgKAAiAAIAFBttAAIANBgAJqEMsDDAMLIAMgAikDADcD+AEgASADQfgBaiADQZACahCCAyECAkAgAygCkAIiBEH//wFHDQAgASACEIQDIQUgASgC5AEiBCAEKAJgaiAFQQR0ai8BACEFIAMgBDYC3AEgA0HcAWogBUEAEIwEIQQgAi8BACECIAMgASgC5AE2AtgBIAMgA0HYAWogAkEAEIwENgLUASADIAQ2AtABIAAgAUHtzwAgA0HQAWoQywMMAwsgASAEEIcDIQQgAi8BACECIAMgASgC5AE2AvQBIAMgA0H0AWogAkEAEIwENgLkASADIAQ2AuABIAAgAUHfzwAgA0HgAWoQywMMAgtBjssAQeEBQaouEP4FAAsgAyACKQMANwMIIANBkAJqIAEgA0EIahDsA0EHEIYGIAMgA0GQAmo2AgAgACABQdAcIAMQywMLIANB4AJqJAAPC0GJ4wBBjssAQcwBQaouEIMGAAtB6NYAQY7LAEH0AEGZLhCDBgALowEBAn8jAEEwayIDJAAgAyACKQMANwMgAkAgASADQSBqIANBLGoQ8gMiBEUNAAJAAkAgAygCLCICQSFJDQAgAyAENgIIIANBIDYCBCADIAI2AgAgACABQa3RACADEMsDDAELIAMgBDYCGCADIAI2AhQgAyACNgIQIAAgAUHT0AAgA0EQahDLAwsgA0EwaiQADwtB6NYAQY7LAEH0AEGZLhCDBgALywIBAn8jAEHQAGsiBCQAIAQgAykDADcDOCAAIARBOGoQjgEgBCADKQMANwNIAkACQAJAAkACQAJAQRAgBCgCTCIFQQ9xIAVBgIDA/wdxG0F8ag4FAQMDAwADCwJAAkAgBCgCSCIFDQBBACEFDAELIAUtAANBD3EhBQsgBSIFQQZGIAVBDEZyIQUMAQsgBCgCSEH//wBLIQULIAUNAQsgBCAEKQNINwMwIARBwABqIAAgBEEwahDNAyAEIAQpA0A3AyggACAEQShqEI4BIAQgBCkDSDcDICAAIARBIGoQjwEMAQsgBCAEKQNINwNACyADIAQpA0A3AwAgBCACQYCAAXI2AkggBEEENgJMIAQgBCkDSDcDGCAEIAMpAwA3AxAgACABIARBGGogBEEQahD0AiAEIAMpAwA3AwggACAEQQhqEI8BIARB0ABqJAAL+woCCH8CfiMAQZABayIEJAAgAykDACEMIAQgAikDACINNwNwIAEgBEHwAGoQjgECQAJAIA0gDFEiBQ0AIAQgAykDADcDaCABIARB6ABqEI4BIAQgAikDADcDiAECQAJAAkACQAJAAkBBECAEKAKMASIGQQ9xIAZBgIDA/wdxG0F8ag4FAQMDAwADCwJAAkAgBCgCiAEiBg0AQQAhBgwBCyAGLQADQQ9xIQYLIAYiBkEGRiAGQQxGciEGDAELIAQoAogBQf//AEshBgsgBg0BCyAEIAQpA4gBNwNgIARBgAFqIAEgBEHgAGoQzQMgBCAEKQOAATcDWCABIARB2ABqEI4BIAQgBCkDiAE3A1AgASAEQdAAahCPAQwBCyAEIAQpA4gBNwOAAQsgAiAEKQOAATcDACAEIAMpAwA3A4gBAkACQAJAAkACQAJAQRAgBCgCjAEiBkEPcSAGQYCAwP8HcRtBfGoOBQEDAwMAAwsCQAJAIAQoAogBIgYNAEEAIQYMAQsgBi0AA0EPcSEGCyAGIgZBBkYgBkEMRnIhBgwBCyAEKAKIAUH//wBLIQYLIAYNAQsgBCAEKQOIATcDSCAEQYABaiABIARByABqEM0DIAQgBCkDgAE3A0AgASAEQcAAahCOASAEIAQpA4gBNwM4IAEgBEE4ahCPAQwBCyAEIAQpA4gBNwOAAQsgAyAEKQOAATcDAAwBCyAEIAIpAwA3A4gBAkACQAJAAkACQAJAQRAgBCgCjAEiBkEPcSAGQYCAwP8HcRtBfGoOBQEDAwMAAwsCQAJAIAQoAogBIgYNAEEAIQYMAQsgBi0AA0EPcSEGCyAGIgZBBkYgBkEMRnIhBgwBCyAEKAKIAUH//wBLIQYLIAYNAQsgBCAEKQOIATcDMCAEQYABaiABIARBMGoQzQMgBCAEKQOAATcDKCABIARBKGoQjgEgBCAEKQOIATcDICABIARBIGoQjwEMAQsgBCAEKQOIATcDgAELIAIgBCkDgAEiDDcDACADIAw3AwALIAIoAgAhB0EAIQYCQAJAAkBBECACKAIEIghBD3EgCEGAgMD/B3EbQXxqDgUBAgICAAILQQAhBiAHRQ0BAkAgBygCAEGAgID4AHEiCEGAgIDgAEYNAEEAIQYgCEGAgIAwRw0CIAQgBy8BBDYCgAEgB0EGaiEGDAILIAQgBy8BBDYCgAEgByAHQQZqLwEAQQN2Qf4/cWpBCGohBgwBC0EAIQYgB0GAgAFJDQAgASAHIARBgAFqEI0EIQYLIAYhCCADKAIAIQdBACEGAkACQAJAQRAgAygCBCIJQQ9xIAlBgIDA/wdxG0F8ag4FAQICAgACCwJAIAcNAEEAIQYMAgsCQCAHKAIAQYCAgPgAcSIJQYCAgOAARg0AQQAhBiAJQYCAgDBHDQIgBCAHLwEENgJ8IAdBBmohBgwCCyAEIAcvAQQ2AnwgByAHQQZqLwEAQQN2Qf4/cWpBCGohBgwBC0EAIQYgB0GAgAFJDQAgASAHIARB/ABqEI0EIQYLIAYhBiAEIAIpAwA3AxggASAEQRhqEOIDIQcgBCADKQMANwMQIAEgBEEQahDiAyEJAkACQAJAIAhFDQAgBg0BCyAEQYgBaiABQf4AEIEBIABCADcDAAwBCwJAIAQoAoABIgoNACAAIAMpAwA3AwAMAQsCQCAEKAJ8IgsNACAAIAIpAwA3AwAMAQsgASAAIAsgCmoiCiAJIAdqIgcQlgEiCUUNACAJIAggBCgCgAEQoQYgBCgCgAFqIAYgBCgCfBChBhogASAAIAogBxCXAQsgBCACKQMANwMIIAEgBEEIahCPAQJAIAUNACAEIAMpAwA3AwAgASAEEI8BCyAEQZABaiQAC80DAQR/IwBBIGsiBSQAIAIoAgAhBkEAIQcCQAJAAkBBECACKAIEIghBD3EgCEGAgMD/B3EbQXxqDgUBAgICAAILAkAgBg0AQQAhBwwCCwJAIAYoAgBBgICA+ABxIghBgICA4ABGDQBBACEHIAhBgICAMEcNAiAFIAYvAQQ2AhwgBkEGaiEHDAILIAUgBi8BBDYCHCAGIAZBBmovAQBBA3ZB/j9xakEIaiEHDAELQQAhByAGQYCAAUkNACABIAYgBUEcahCNBCEHCwJAAkAgByIIDQAgAEIANwMADAELIAUgAikDADcDEAJAIAEgBUEQahDiAyIHIARqIgZBACAGQQBKGyAEIARBAEgbIgQgByAEIAdIGyIGIAcgA2oiBEEAIARBAEobIAMgA0EASBsiBCAHIAQgB0gbIgRrIgNBAEoNACAAQoCAgYDAADcDAAwBCwJAIAQNACADIAdHDQAgACACKQMANwMADAELIAUgAikDADcDCCABIAVBCGogBBDhAyEHIAUgAikDADcDACABIAUgBhDhAyECIAAgAUEIIAEgCCAFKAIcIgQgByAHQQBIGyIHaiAEIAIgAkEASBsgB2sQmAEQ6wMLIAVBIGokAAuTAQEEfyMAQRBrIgMkAAJAIAJFDQBBACEEAkAgACgCECIFLQAOIgZFDQAgACAFLwEIQQN0akEYaiEECyAEIQUCQCAGRQ0AQQAhAAJAA0AgBSAAIgBBAXRqIgQvAQBFDQEgAEEBaiIEIQAgBCAGRg0CDAALAAsgBCACOwEADAELIANBCGogAUH7ABCBAQsgA0EQaiQAC2IBA38CQCAAKAIQIgItAA4iAw0AQQAPCyAAIAIvAQhBA3RqQRhqIQQgAyEAA0ACQCAAIgBBAU4NAEEADwsgAEF/aiICIQAgBCACQQF0aiICLwEAIgNFDQALIAJBADsBACADC8ADAQx/IwBBwABrIgIkACACIAEpAwA3AzACQAJAIAAgAkEwahDvAw0AIAIgASkDADcDKCAAQZYQIAJBKGoQuAMMAQsgAiABKQMANwMgIAAgAkEgaiACQTxqEPEDIQMgAiACKAI8IgFBAXY2AjwgAUECSQ0AIABB5AFqIQRBACEAA0AgAyAAIgVBAXRqLwEAIQZBACEAAkAgBCgAACIHQSRqKAIAIgFBEEkNACABQQR2IgBBASAAQQFLGyEIIAcgBygCIGohCUEAIQECQANAIAAhCgJAAkAgCSABIgtBBHRqIgwoAgAiDSAGSw0AQQAhACAMIQEgDCgCBCANaiAGTw0BC0EBIQAgCiEBCyABIQEgAEUNASABIQAgC0EBaiIMIQEgDCAIRw0AC0EAIQAMAQsgASEACwJAAkAgACIARQ0AIAcoAiAhASACIAQoAgA2AhwgAkEcaiAAIAcgAWprQQR1IgEQeyEMIAAoAgAhACACIAE2AhQgAiAMNgIQIAIgBiAAazYCGEGW6QAgAkEQahA7DAELIAIgBjYCAEH/6AAgAhA7CyAFQQFqIgEhACABIAIoAjxJDQALCyACQcAAaiQAC7gCAQJ/IwBB4ABrIgIkACACQSA2AkAgAiAAQdYCajYCREG8IyACQcAAahA7IAIgASkDADcDOAJAAkAgACACQThqEKsDRQ0AIAIgASkDADcDMCACQdgAaiAAIAJBMGpB4wAQmAMCQAJAIAIpA1hQRQ0AQQAhAwwBCyACIAIpA1g3AyggAEHVJSACQShqELgDQQEhAwsgAiABKQMANwMgIAJB0ABqIAAgAkEgakH2ABCYAyADIQMCQCACKQNQUA0AIAIgAikDUDcDGCAAQbM4IAJBGGoQuAMgAiABKQMANwMQIAJByABqIAAgAkEQakHxABCYAwJAIAIpA0hQDQAgAiACKQNINwMIIAAgAkEIahDUAwtBASEDCyADDQELIAIgASkDADcDACAAQdUlIAIQuAMLIAJB4ABqJAALhwQBBn8jAEHgAGsiAyQAAkACQCAALQBFRQ0AIAMgASkDADcDQCAAQeELIANBwABqELgDDAELAkAgACgC6AENACADIAEpAwA3A1hBvyVBABA7IABBADoARSADIAMpA1g3AwAgACADENUDIABB5dQDEHYMAQsgAEEBOgBFIAAgASkDADcDOCADIAEpAwA3AzggACADQThqEKsDIQQgAkEBcQ0AIARFDQAgAyABKQMANwMwIANB2ABqIAAgA0EwakHxABCYAyADKQNYQgBSDQACQAJAIAAoAugBIgINAEEAIQUMAQsgAiECQQAhBANAIARBAWoiBCEFIAIoAgwiBiECIAQhBCAGDQALCwJAAkAgACAFIgJBECACQRBJGyIFQQF0EJQBIgdFDQACQCAFRQ0AIAAoAugBIgJFDQAgB0EMaiEIIAIhAkEAIQQDQCAIIAQiBEEBdGogAiICLwEEOwEAIAIoAgwiAkUNASACIQIgBEEBaiIGIQQgBiAFSQ0ACwsgA0HQAGogAEEIIAcQ6wMMAQsgA0IANwNQCyADIAMpA1A3AyggACADQShqEI4BIANByABqQfEAEMkDIAMgASkDADcDICADIAMpA0g3AxggAyADKQNQNwMQIAAgA0EgaiADQRhqIANBEGoQnQMgAyADKQNQNwMIIAAgA0EIahCPAQsgA0HgAGokAAvPBwIMfwF+IwBBEGsiASQAIAApAzgiDUIgiKchAgJAAkACQAJAIA2nIgNBgAhJDQAgAg0AIANBD3EhBCADQYB4akEEdiEFDAELAkAgAC0ARw0AQQAhBEEAIQUMAQsCQAJAIAAtAEhFDQBBASEGQQAhBwwBC0EBIQZBACEHIAAtAElBA3FFDQAgACgC6AEiB0EARyEEAkACQCAHDQAgBCEIDAELIAQhBCAHIQUDQCAEIQlBACEHAkAgBSIGKAIQIgQtAA4iBUUNACAGIAQvAQhBA3RqQRhqIQcLIAchCCAGLwEEIQoCQCAFRQ0AQQAhBCAFIQUDQCAEIQsCQCAIIAUiB0F/aiIFQQF0ai8BACIERQ0AIAYgBDsBBCAGIAAQgARB0gBHDQAgBiAKOwEEIAkhCCALQQFxDQIMBAsgB0ECSCEEIAUhBSAHQQFKDQALCyAGIAo7AQQgBigCDCIHQQBHIgYhBCAHIQUgBiEIIAcNAAsLQQAhBkECIQcgCEEBcUUNACAALQBJIgdBAnFFIQYgB0EedEEfdUEDcSEHC0EAIQRBACEFIAchByAGRQ0BC0EAQQMgBSIKGyEJQX9BACAKGyEMIAQhBwJAA0AgByELIAAoAugBIghFDQECQAJAIApFDQAgCw0AIAggCjsBBCALIQdBAyEEDAELAkACQCAIKAIQIgctAA4iBA0AQQAhBwwBCyAIIAcvAQhBA3RqQRhqIQUgBCEHA0ACQCAHIgdBAU4NAEEAIQcMAgsgB0F/aiIEIQcgBSAEQQF0aiIELwEAIgZFDQALIARBADsBACAGIQcLAkAgByIHDQACQCAKRQ0AIAFBCGogAEH8ABCBASALIQdBAyEEDAILIAgoAgwhByAAKALsASAIEHkCQCAHRQ0AIAshB0ECIQQMAgsgASACNgIMIAEgAzYCCEG/JUEAEDsgAEEAOgBFIAEgASkDCDcDACAAIAEQ1QMgAEHl1AMQdiALIQdBAyEEDAELIAggBzsBBAJAAkACQAJAIAggABCABEGuf2oOAgABAgsgCyAMaiEHIAkhBAwDCyAKRQ0BIAFBCGogCiALQX9qEPwDIAAgASkDCDcDOCAALQBHRQ0BIAAoAqwCIAAoAugBRw0BIABBCBCGBAwBCyABQQhqIABB/QAQgQEgCyEHQQMhBAwBCyALIQdBAyEECyAHIQcgBEEDRw0ACwsgAEEAOgBFIABBADoAQgJAIAAoAuwBIgdFDQAgByAAKQM4NwMgCyAAQgA3AzhBCCEHIAAtAAdFDQELIAAgBxCGBAsgAUEQaiQAC4oBAQF/IwBBIGsiBSQAAkACQCABIAEgAhDyAhCQASICDQAgAEIANwMADAELIAAgAUEIIAIQ6wMgBSAAKQMANwMQIAEgBUEQahCOASAFQRhqIAEgAyAEEMoDIAUgBSkDGDcDCCABIAJB9gAgBUEIahDPAyAFIAApAwA3AwAgASAFEI8BCyAFQSBqJAALUwEBfyMAQSBrIgQkACAEIAM2AhQgBEEYaiABQR4gAiADENgDAkAgBCkDGFANACAEIAQpAxg3AwggASAEQQhqQQIQ1gMLIABCADcDACAEQSBqJAALUwEBfyMAQSBrIgQkACAEIAM2AhQgBEEYaiABQRwgAiADENgDAkAgBCkDGFANACAEIAQpAxg3AwggASAEQQhqQQIQ1gMLIABCADcDACAEQSBqJAALUwEBfyMAQSBrIgQkACAEIAM2AhQgBEEYaiABQSAgAiADENgDAkAgBCkDGFANACAEIAQpAxg3AwggASAEQQhqQQIQ1gMLIABCADcDACAEQSBqJAALKAEBfyMAQRBrIgMkACADIAI2AgAgACABQbnkACADENkDIANBEGokAAtSAgF/AX4jAEEgayIEJAAgAhCKBCECIAQgAykDACIFNwMQIAQgBTcDGCAEIAEgBEEQahC5AzYCBCAEIAI2AgAgACABQboZIAQQ2QMgBEEgaiQAC0ABAX8jAEEQayIEJAAgBCADKQMANwMIIAQgASAEQQhqELkDNgIEIAQgAjYCACAAIAFBuhkgBBDZAyAEQRBqJAALKgEBfyMAQRBrIgMkACADIAIQigQ2AgAgACABQf8uIAMQ2wMgA0EQaiQAC1MBAX8jAEEgayIEJAAgBCADNgIUIARBGGogAUEiIAIgAxDYAwJAIAQpAxhQDQAgBCAEKQMYNwMIIAEgBEEIakECENYDCyAAQgA3AwAgBEEgaiQAC4oCAQN/IwBBIGsiAyQAIAMgASkDADcDEAJAAkAgACADQRBqEMcDIgRFDQBBfyEBIAQvAQIiACACTQ0BQQAhAQJAIAJBEEkNACACQQN2Qf7///8BcSAEakECai8BACEBCyABIQECQCACQQ9xIgINACABIQEMAgsgBCAAQQN2Qf4/cWpBBGohACACIQIgASEEA0AgAiEFIAQhAgNAIAJBAWoiASECIAAgAWotAABBwAFxQYABRg0ACyAFQX9qIgUhAiABIQQgASEBIAVFDQIMAAsACyADIAEpAwA3AwggACADQQhqIANBHGoQyAMhASACQX8gAygCHCACSxtBfyABGyEBCyADQSBqJAAgAQtlAQJ/IwBBIGsiAiQAIAIgASkDADcDEAJAAkAgACACQRBqEMcDIgNFDQAgAy8BAiEBDAELIAIgASkDADcDCCAAIAJBCGogAkEcahDIAyEBIAIoAhxBfyABGyEBCyACQSBqJAAgAQvoAQACQCAAQf8ASw0AIAEgADoAAEEBDwsCQCAAQf8PSw0AIAEgAEE/cUGAAXI6AAEgASAAQQZ2QcABcjoAAEECDwsCQCAAQf//A0sNACABIABBP3FBgAFyOgACIAEgAEEMdkHgAXI6AAAgASAAQQZ2QT9xQYABcjoAAUEDDwsCQCAAQf//wwBLDQAgASAAQT9xQYABcjoAAyABIABBEnZB8AFyOgAAIAEgAEEGdkE/cUGAAXI6AAIgASAAQQx2QT9xQYABcjoAAUEEDwsgAUECakEALQCCiwE6AAAgAUEALwCAiwE7AABBAwtdAQF/QQEhAQJAIAAsAAAiAEF/Sg0AQQIhASAAQf8BcSIAQeABcUHAAUYNAEEDIQEgAEHwAXFB4AFGDQBBBCEBIABB+AFxQfABRg0AQafOAEHUAEGlKxD+BQALIAELwwEBAn8gACwAACIBQf8BcSECAkAgAUF/TA0AIAIPCwJAAkACQCACQeABcUHAAUcNAEEBIQEgAkEGdEHAD3EhAgwBCwJAIAJB8AFxQeABRw0AQQIhASAALQABQT9xQQZ0IAJBDHRBgOADcXIhAgwBCyACQfgBcUHwAUcNAUEDIQEgAC0AAUE/cUEMdCACQRJ0QYCA8ABxciAALQACQT9xQQZ0ciECCyACIAAgAWotAABBP3FyDwtBp84AQeQAQeMQEP4FAAtTAQF/IwBBEGsiAiQAAkAgASABQQZqLwEAQQN2Qf4/cWpBCGogAS8BBEEAIAFBBGpBBhDnAyIBQX9KDQAgAkEIaiAAQYEBEIEBCyACQRBqJAAgAQvlCAEPf0EAIQUCQCAEQQFxRQ0AIAMgAy8BAkEDdkH+P3FqQQRqIQULIAUhBiAAIAFqIQcgBEEIcSEIIANBBGohCSAEQQJxIQogBEEEcSELIAAhBEEAIQBBACEFAkADQCABIQwgBSENIAAhBQJAAkACQAJAIAQiBCAHTw0AQQEhACAELAAAIgFBf0oNAQJAAkAgAUH/AXEiDkHgAXFBwAFHDQACQCAHIARrQQFODQBBASEPDAILQQEhDyAELQABQcABcUGAAUcNAUECIQBBAiEPIAFBfnFBQEcNAwwBCwJAAkAgDkHwAXFB4AFHDQACQCAHIARrIgBBAU4NAEEBIQ8MAwtBASEPIAQtAAEiDkHAAXFBgAFHDQICQCAAQQJODQBBAiEPDAMLQQIhDyAELQACIhBBwAFxQYABRw0CIA5B4AFxIQACQCABQWBHDQAgAEGAAUcNAEEDIQ8MAwsCQCABQW1HDQBBAyEPIABBoAFGDQMLAkAgAUFvRg0AQQMhAAwFCyAOQb8BRg0BQQMhAAwEC0EBIQ8gDkH4AXFB8AFHDQEgByAEayIAQQAgAEEAShsiEUEBaiESQQEhD0EAIRACQAJAIABBAU4NAEEAIRAgEiEADAELAkADQCAQIRACQCAEIA8iAGotAABBwAFxQYABRg0AIBAhECAAIQAMAwsgAEECSyETIABBAWoiD0EERg0BIA8hDyATIRAgACARRw0ACyATIRAgEiEADAELIBMhEEEBIQALIAAhDyAQQQFxRQ0BAkACQAJAIA5BkH5qDgUAAgICAQILQQQhDyAELQABQfABcUGAAUYNAyABQXRHDQELAkAgAUF0TQ0AQQQhDwwDC0EEIQBBBCEPIAQtAAFB/wFxQY8BTQ0EDAILQQQhAEEEIQ8gAUF0Sw0BDAMLQQMhAEEDIQ8gEEH+AXFBvgFHDQILIAQgD2ohBAJAIAtFDQAgBCEEIAUhACANIQVBACENQX4hAQwECyAEIQBBAyEBQYCLASEEDAILAkAgA0UNAAJAIA0gAy8BAiIERg0AQX0PC0F9IQ8gBSADLwEAIgBHDQVBfCEPIAMgBEEDdkH+P3FqIABqQQRqLQAADQULAkAgAkUNACACIA02AgALIAUhDwwECyAEIAAiAWohACABIQEgBCEECyAEIQ8gASEBIAAhDkEAIQQCQCAGRQ0AA0AgBiAEIgQgBWpqIA8gBGotAAA6AAAgBEEBaiIAIQQgACABRw0ACwsgASAFaiEAAkACQCANQQ9xQQ9GDQAgDCEBDAELIA1BBHYhBAJAAkACQCAKRQ0AIAkgBEEBdGogADsBAAwBCyAIRQ0AIAAgAyAEQQF0akEEai8BAEYNAEEAIQRBfyEFDAELQQEhBCAMIQULIAUiDyEBIAQNACAOIQQgACEAIA0hBUEAIQ0gDyEBDAELIA4hBCAAIQAgDUEBaiEFQQEhDSABIQELIAQhBCAAIQAgBSEFIAEiDyEBIA8hDyANDQALCyAPC8MCAgF+BH8CQAJAAkACQCABEJ8GDgQAAQICAwsgAEICNwMADwsCQCABRAAAAAAAAAAAZEUNACAAQsIANwMADwsgAELDADcDAA8LIABCgICAgHA3AwAPCwJAIAG9IgJCIIinIgMgAqciBHINACAAQoCAgIBwNwMADwsCQCADQRR2Qf8PcSIFQf8HSQ0AAkACQCAFQZMISw0AIAQNAgJAIAVBkwhGDQAgA0H//z9xIAVBjXhqdA0DCyADQf//P3FBgIDAAHJBkwggBWt2IQMMAQsCQCAFQZ4ISQ0AIAQNAiADQYCAgI98Rw0CIABCgICAgHg3AwAPCyAEIAVB7XdqIgZ0DQEgA0H//z9xQYCAwAByIAZ0IARBswggBWt2ciEDCyAAQX82AgQgAEEAIAMiA2sgAyACQgBTGzYCAA8LIAAgATkDAAsQACAAIAE2AgAgAEF/NgIECw8AIABCwABCASABGzcDAAtEAAJAIAMNACAAQgA3AwAPCwJAIAJBCHFFDQAgASADEJwBIAAgAzYCACAAIAI2AgQPC0HS5wBB8csAQdsAQZ4fEIMGAAuVAgICfwF8IwBBIGsiAiQAAkACQCABKAIEIgNBf0cNACABKAIAtyEEDAELAkAgAUEGai8BAEHw/wFxRQ0AIAErAwAhBAwBCwJAIAMNAAJAAkACQAJAAkAgASgCACIBQUBqDgQBBAIDAAtEAAAAAAAAAAAhBCABQX9qDgMFAwUDC0QAAAAAAADwPyEEDAQLRAAAAAAAAPB/IQQMAwtEAAAAAAAA8P8hBAwCC0QAAAAAAAD4fyEEDAELIAIgASkDADcDEAJAIAAgAkEQahDFA0UNACACIAEpAwA3AwggACACQQhqIAJBHGoQyAMiASACQRhqEOYGIQQgASACKAIYRw0BC0QAAAAAAAD4fyEECyACQSBqJAAgBAvWAQIBfwF8IwBBEGsiAiQAAkACQAJAAkAgASgCBEEBag4CAAECCyABKAIAIQEMAgsgASgCAEE/SyEBDAELIAIgASkDADcDCEEAIQEgACACQQhqEOwDIgO9Qv///////////wCDQoCAgICAgID4/wBWDQACQAJAIAOdRAAAAAAAAPBBEKcGIgNEAAAAAAAA8EGgIAMgA0QAAAAAAAAAAGMbIgNEAAAAAAAA8EFjIANEAAAAAAAAAABmcUUNACADqyEBDAELQQAhAQsgASEBCyACQRBqJAAgAQuwAQEBfyMAQSBrIgIkAAJAAkACQAJAIAEoAgRBAWoOAgABAgsgASgCAEEARyEBDAILIAEoAgBBP0shAQwBCyACIAEpAwA3AxACQCAAIAJBEGoQxQNFDQAgAiABKQMANwMIIAAgAkEIaiACQRxqEMgDGiACKAIcQQBHIQEMAQsCQCABQQZqLwEAQfD/AXENAEEBIQEMAQsgASsDAEQAAAAAAAAAAGEhAQsgAkEgaiQAIAELYQECf0EAIQICQAJAAkBBECABKAIEIgNBD3EgA0GAgMD/B3EbQXxqDgUBAgICAAILQQAhAiABKAIAIgFFDQEgASgCAEGAgID4AHFBgICAKEYPCyABKAIAQYCAAUkhAgsgAgtsAQJ/QQAhAgJAAkACQEEQIAEoAgQiA0EPcSADQYCAwP8HcRsiA0F8ag4FAQICAgACC0EAIQIgASgCACIBRQ0BIAEoAgBBgICA+ABxQYCAgChGIQIMAQsgASgCAEGAgAFJIQILIANBBEcgAnELyAEBAn8CQAJAAkACQEEQIAEoAgQiA0EPcSADQYCAwP8HcRsiBEF8ag4FAQMDAwADCyABKAIAIgNFDQIgAygCAEGAgID4AHFBgICAKEYhAwwBCyABKAIAQYCAAUkhAwsgA0UNAAJAAkACQCAEQXxqDgUCAQEBAAELIAEoAgAhAQJAIAJFDQAgAiABLwEENgIACyABQQxqDwtB8csAQdEBQfDOABD+BQALIAAgASgCACACEI0EDwtBpeMAQfHLAEHDAUHwzgAQgwYAC90BAQJ/IwBBIGsiAyQAAkACQAJAAkACQEEQIAEoAgQiBEEPcSAEQYCAwP8HcRtBfGoOBQEDAwMAAwsgASgCACIERQ0CIAQoAgBBgICA+ABxQYCAgChGIQQMAQsgASgCAEGAgAFJIQQLIARFDQAgAyABKQMANwMYIAAgA0EYaiACEPEDIQEMAQsgAyABKQMANwMQAkAgACADQRBqEMUDRQ0AIAMgASkDADcDCCAAIANBCGogAhDIAyEBDAELAkAgAg0AQQAhAQwBCyACQQA2AgBBACEBCyADQSBqJAAgAQsjAEEAIAEoAgBBACABKAIEIgFBD3FBCEYbIAFBgIDA/wdxGwtSAQF/AkAgASgCBCICQYCAwP8HcUUNAEEADwsCQCACQQ9xQQhGDQBBAA8LQQAhAgJAIAEoAgAiAUUNACABKAIAQYCAgPgAcUGAgIAYRiECCyACC8cDAQN/IwBBEGsiAiQAAkACQCABKAIEIgNBf0cNAEEBIQQMAQtBASEEAkACQAJAAkACQAJAAkACQAJAQRAgA0EPcSABQQZqLwEAQfD/AXEbDhEAAQYCBAIFBwMCAgcHBwcHCQcLQQwhBAJAAkACQAJAIAEoAgAiAQ5EAAECDAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwEDAgIDC0EAIQQMCwtBBiEEDAoLQQEhBAwJC0ECIQQgAUGgf2pBLEkNCEELIQQgAUH/B0sNCEHxywBBiAJB2C8Q/gUAC0EHIQQMBwtBCCEEDAYLAkACQCABKAIAIgENAEF9IQEMAQsgAS0AA0EPcUF9aiEBCyABIgFBC0kNBEHxywBBqAJB2C8Q/gUAC0EEQQkgASgCAEGAgAFJGyEEDAQLIAIgASkDADcDCEECIQQgACACQQhqEIEDDQMgAiABKQMANwMAQQhBAiAAIAJBABCCAy8BAkGAIEkbIQQMAwtBBSEEDAILQfHLAEG3AkHYLxD+BQALIAFBAnRBuIsBaigCACEECyACQRBqJAAgBAsRACAAKAIERSAAKAIAQQRJcQskAQF/QQAhAQJAIAAoAgQNACAAKAIAIgBFIABBA0ZyIQELIAELawECfyMAQRBrIgMkAAJAAkAgASgCBA0AAkAgASgCAA4EAAEBAAELIAIoAgQNAEEBIQQgAigCAA4EAQAAAQALIAMgASkDADcDCCADIAIpAwA3AwAgACADQQhqIAMQ+QMhBAsgA0EQaiQAIAQLhgICAn8CfiMAQcAAayIDJAACQAJAIAEoAgQNACABKAIAQQJHDQAgAigCBA0AQQAhBCACKAIAQQJGDQELIAMgAikDACIFNwMwIAMgASkDACIGNwMoQQEhAQJAIAYgBVENACADIAMpAyg3AyACQCAAIANBIGoQxQMNAEEAIQEMAQsgAyADKQMwNwMYQQAhASAAIANBGGoQxQNFDQAgAyADKQMoNwMQIAAgA0EQaiADQTxqEMgDIQIgAyADKQMwNwMIIAAgA0EIaiADQThqEMgDIQRBACEBAkAgAygCPCIAIAMoAjhHDQAgAiAEIAAQuwZFIQELIAEhAQsgASEECyADQcAAaiQAIAQLwAEBAn8jAEEwayIDJABBASEEAkAgASkDACACKQMAUQ0AIAMgASkDADcDIAJAIAAgA0EgahDFAw0AQQAhBAwBCyADIAIpAwA3AxhBACEEIAAgA0EYahDFA0UNACADIAEpAwA3AxAgACADQRBqIANBLGoQyAMhBCADIAIpAwA3AwggACADQQhqIANBKGoQyAMhAkEAIQECQCADKAIsIgAgAygCKEcNACAEIAIgABC7BkUhAQsgASEECyADQTBqJAAgBAvdAQICfwJ+IwBBwABrIgMkACADQSBqIAIQyQMgAyADKQMgIgU3AzAgAyABKQMAIgY3AyhBASECAkAgBiAFUQ0AIAMgAykDKDcDGAJAIAAgA0EYahDFAw0AQQAhAgwBCyADIAMpAzA3AxBBACECIAAgA0EQahDFA0UNACADIAMpAyg3AwggACADQQhqIANBPGoQyAMhASADIAMpAzA3AwAgACADIANBOGoQyAMhAEEAIQICQCADKAI8IgQgAygCOEcNACABIAAgBBC7BkUhAgsgAiECCyADQcAAaiQAIAILXQACQAJAIAJBEE8NACABRQ0BIAFBgICACE4NASAAQQA2AgQgACABQQR0IAJyQYAIajYCAA8LQYbSAEHxywBBgANB4sMAEIMGAAtBrtIAQfHLAEGBA0HiwwAQgwYAC40BAQF/QQAhAgJAIAFB//8DSw0AQeIBIQICQAJAAkACQAJAAkAgAUEOdg4EAwUAAQILIAAoAgBBxABqIQJBASEADAMLIAAoAgBBzABqIQJBAiEADAILQbLGAEE5QaoqEP4FAAsgACgCAEHUAGohAkEDIQALIAIoAgAgAHYhAgsgAUH//wBxIAJJIQILIAILbwECfyMAQSBrIgEkACAAKAAIIQAQ7wUhAiABQRhqIABB//8DcTYCACABQRBqIABBGHY2AgAgAUEUaiAAQRB2Qf8BcTYCACABQQY2AgwgAUKCgICA8AE3AgQgASACNgIAQazBACABEDsgAUEgaiQAC4whAgx/AX4jAEGgBGsiAiQAAkACQAJAIABBA3ENAAJAIAFB8ABNDQAgAiAANgKcBAJAAkAgACgCAEHEytmbBUcNACAAKAIEQYrcpYl/Rg0BCyACQugHNwOABEHWCiACQYAEahA7QZh4IQAMBAsCQAJAIAAoAggiA0GAgIB4cUGAgIAQRw0AIANBEHZB/wFxQXlqQQlJDQELQfosQQAQOyAAKAAIIQAQ7wUhASACQeADakEYaiAAQf//A3E2AgAgAkHgA2pBEGogAEEYdjYCACACQfQDaiAAQRB2Qf8BcTYCACACQQY2AuwDIAJCgoCAgPABNwLkAyACIAE2AuADQazBACACQeADahA7IAJCmgg3A9ADQdYKIAJB0ANqEDtB5nchAAwEC0EAIQQgAEEgaiEFQQAhAwNAIAMhAyAEIQYCQAJAAkAgBSIFKAIAIgQgAU0NAEHpByEDQZd4IQQMAQsCQCAFKAIEIgcgBGogAU0NAEHqByEDQZZ4IQQMAQsCQCAEQQNxRQ0AQesHIQNBlXghBAwBCwJAIAdBA3FFDQBB7AchA0GUeCEEDAELIANFDQEgBUF4aiIHQQRqKAIAIAcoAgBqIARGDQFB8gchA0GOeCEECyACIAM2AsADIAIgBSAAazYCxANB1gogAkHAA2oQOyAGIQcgBCEIDAQLIANBCEsiByEEIAVBCGohBSADQQFqIgYhAyAHIQcgBkEKRw0ADAMLAAtB0OQAQbLGAEHJAEG3CBCDBgALQdHeAEGyxgBByABBtwgQgwYACyAIIQMCQCAHQQFxDQAgAyEADAELAkAgAEE0ai0AAEEHcUUNACACQvOHgICABjcDsANB1gogAkGwA2oQO0GNeCEADAELIAAgACgCMGoiBSAFIAAoAjRqIgRJIQcCQAJAIAUgBEkNACAHIQQgAyEHDAELIAchBiADIQggBSEJA0AgCCEDIAYhBAJAAkAgCSIGKQMAIg5C/////29YDQBBCyEFIAMhAwwBCwJAAkAgDkL///////////8Ag0KAgICAgICA+P8AWA0AQZMIIQNB7XchBwwBCyACQZAEaiAOvxDoA0EAIQUgAyEDIAIpA5AEIA5RDQFBlAghA0HsdyEHCyACQTA2AqQDIAIgAzYCoANB1gogAkGgA2oQO0EBIQUgByEDCyAEIQQgAyIDIQcCQCAFDgwAAgICAgICAgICAgACCyAGQQhqIgQgACAAKAIwaiAAKAI0akkiBSEGIAMhCCAEIQkgBSEEIAMhByAFDQALCyAHIQMCQCAEQQFxRQ0AIAMhAAwBCwJAIABBJGooAgBBgOowSQ0AIAJCo4iAgIAGNwOQA0HWCiACQZADahA7Qd13IQAMAQsgACAAKAIgaiIFIAUgACgCJGoiBEkhBwJAAkAgBSAESQ0AIAchBUEwIQEgAyEDDAELAkACQAJAAkAgBS8BCCAFLQAKTw0AIAchCkEwIQsMAQsgBUEKaiEIIAUhBSAAKAIoIQYgAyEJIAchBANAIAQhDCAJIQ0gBiEGIAghCiAFIgMgAGshCQJAIAMoAgAiBSABTQ0AIAIgCTYC5AEgAkHpBzYC4AFB1gogAkHgAWoQOyAMIQUgCSEBQZd4IQMMBQsCQCADKAIEIgQgBWoiByABTQ0AIAIgCTYC9AEgAkHqBzYC8AFB1gogAkHwAWoQOyAMIQUgCSEBQZZ4IQMMBQsCQCAFQQNxRQ0AIAIgCTYChAMgAkHrBzYCgANB1gogAkGAA2oQOyAMIQUgCSEBQZV4IQMMBQsCQCAEQQNxRQ0AIAIgCTYC9AIgAkHsBzYC8AJB1gogAkHwAmoQOyAMIQUgCSEBQZR4IQMMBQsCQAJAIAAoAigiCCAFSw0AIAUgACgCLCAIaiILTQ0BCyACIAk2AoQCIAJB/Qc2AoACQdYKIAJBgAJqEDsgDCEFIAkhAUGDeCEDDAULAkACQCAIIAdLDQAgByALTQ0BCyACIAk2ApQCIAJB/Qc2ApACQdYKIAJBkAJqEDsgDCEFIAkhAUGDeCEDDAULAkAgBSAGRg0AIAIgCTYC5AIgAkH8BzYC4AJB1gogAkHgAmoQOyAMIQUgCSEBQYR4IQMMBQsCQCAEIAZqIgdBgIAESQ0AIAIgCTYC1AIgAkGbCDYC0AJB1gogAkHQAmoQOyAMIQUgCSEBQeV3IQMMBQsgAy8BDCEFIAIgAigCnAQ2AswCAkAgAkHMAmogBRD9Aw0AIAIgCTYCxAIgAkGcCDYCwAJB1gogAkHAAmoQOyAMIQUgCSEBQeR3IQMMBQsCQCADLQALIgVBA3FBAkcNACACIAk2AqQCIAJBswg2AqACQdYKIAJBoAJqEDsgDCEFIAkhAUHNdyEDDAULIA0hBAJAIAVBBXTAQQd1IAVBAXFrIAotAABqQX9KIgUNACACIAk2ArQCIAJBtAg2ArACQdYKIAJBsAJqEDtBzHchBAsgBCENIAVFDQIgA0EQaiIFIAAgACgCIGogACgCJGoiBkkhBAJAIAUgBkkNACAEIQUMBAsgBCEKIAkhCyADQRpqIgwhCCAFIQUgByEGIA0hCSAEIQQgA0EYai8BACAMLQAATw0ACwsgAiALIgE2AtQBIAJBpgg2AtABQdYKIAJB0AFqEDsgCiEFIAEhAUHadyEDDAILIAwhBQsgCSEBIA0hAwsgAyEDIAEhCAJAIAVBAXFFDQAgAyEADAELAkAgAEHcAGooAgAgACAAKAJYaiIFakF/ai0AAEUNACACIAg2AsQBIAJBowg2AsABQdYKIAJBwAFqEDtB3XchAAwBCwJAAkAgACAAKAJIaiIBIAEgAEHMAGooAgBqSSIEDQAgBCENIAMhAQwBCyAEIQQgAyEHIAEhBgJAA0AgByEJIAQhDQJAIAYiBygCACIBQQFxRQ0AQbYIIQFBynchAwwCCwJAIAEgACgCXCIDSQ0AQbcIIQFByXchAwwCCwJAIAFBBWogA0kNAEG4CCEBQch3IQMMAgsCQAJAAkAgASAFIAFqIgQvAQAiBmogBC8BAiIBQQN2Qf4/cWpBBWogA0kNAEG5CCEBQcd3IQQMAQsCQCAEIAFB8P8DcUEDdmpBBGogBkEAIARBDBDnAyIEQXtLDQBBASEDIAkhASAEQX9KDQJBvgghAUHCdyEEDAELQbkIIARrIQEgBEHHd2ohBAsgAiAINgKkASACIAE2AqABQdYKIAJBoAFqEDtBACEDIAQhAQsgASEBAkAgA0UNACAHQQRqIgMgACAAKAJIaiAAKAJMaiIJSSINIQQgASEHIAMhBiANIQ0gASEBIAMgCU8NAwwBCwsgDSENIAEhAQwBCyACIAg2ArQBIAIgATYCsAFB1gogAkGwAWoQOyANIQ0gAyEBCyABIQYCQCANQQFxRQ0AIAYhAAwBCwJAIABB1ABqKAIAIgFBAUgNACAAIAAoAlBqIgQgAWohByAAKAJcIQMgBCEBA0ACQCABIgEoAgAiBCADSQ0AIAIgCDYClAEgAkGfCDYCkAFB1gogAkGQAWoQO0HhdyEADAMLAkAgASgCBCAEaiADTw0AIAFBCGoiBCEBIAQgB08NAgwBCwsgAiAINgKEASACQaAINgKAAUHWCiACQYABahA7QeB3IQAMAQsCQAJAIAAgACgCQGoiASABIABBxABqKAIAakkiAw0AIAMhDSAGIQEMAQsgAyEEIAYhByABIQYDQCAHIQ0gBCEKIAYiCS8BACIEIQECQCAAKAJcIgYgBEsNACACIAg2AnQgAkGhCDYCcEHWCiACQfAAahA7IAohDUHfdyEBDAILAkADQAJAIAEiASAEa0HIAUkiBw0AIAIgCDYCZCACQaIINgJgQdYKIAJB4ABqEDtB3nchAQwCCwJAIAUgAWotAABFDQAgAUEBaiIDIQEgAyAGSQ0BCwsgDSEBCyABIQECQCAHRQ0AIAlBAmoiAyAAIAAoAkBqIAAoAkRqIglJIg0hBCABIQcgAyEGIA0hDSABIQEgAyAJTw0CDAELCyAKIQ0gASEBCyABIQECQCANQQFxRQ0AIAEhAAwBCwJAIABBPGooAgBFDQAgAiAINgJUIAJBkAg2AlBB1gogAkHQAGoQO0HwdyEADAELIAAvAQ4iA0EARyEFAkACQCADDQAgBSEJIAghBiABIQEMAQsgACAAKAJgaiENIAUhBSABIQRBACEHA0AgBCEGIAUhCCANIAciBUEEdGoiAyAAayEBAkACQAJAIANBEGogACAAKAJgaiAAKAJkIgRqSQ0AQbIIIQNBznchBwwBCwJAAkACQCAFDgIAAQILAkAgAygCBEHz////AUYNAEGnCCEDQdl3IQcMAwsgBUEBRw0BCyADKAIEQfL///8BRg0AQagIIQNB2HchBwwBCwJAIAMvAQpBAnQiByAESQ0AQakIIQNB13chBwwBCwJAIAMvAQhBA3QgB2ogBE0NAEGqCCEDQdZ3IQcMAQsgAy8BACEEIAIgAigCnAQ2AkwCQCACQcwAaiAEEP0DDQBBqwghA0HVdyEHDAELAkAgAy0AAkEOcUUNAEGsCCEDQdR3IQcMAQsCQAJAIANBCGoiCi8BAEUNACANIAdqIQsgBiEHQQAhBgwBC0EBIQMgASEEIAYhAQwCCwNAIAchByALIAYiBkEDdGoiAS8BACEDIAIgAigCnAQ2AkggASAAayEEAkACQCACQcgAaiADEP0DDQAgAiAENgJEIAJBrQg2AkBB1gogAkHAAGoQO0EAIQNB03chAQwBCwJAAkAgAS0ABEEBcQ0AIAchBwwBCwJAAkACQCABLwEGQQJ0IgFBBGogACgCZEkNAEGuCCEDQdJ3IQwMAQsgDSABaiIDIQECQCADIAAgACgCYGogACgCZGpPDQADQAJAIAEiAS8BACIDDQACQCABLQACRQ0AQa8IIQNB0XchDAwEC0GvCCEDQdF3IQwgAS0AAw0DQQEhCSAHIQEMBAsgAiACKAKcBDYCPAJAIAJBPGogAxD9Aw0AQbAIIQNB0HchDAwDCyABQQRqIgMhASADIAAgACgCYGogACgCZGpJDQALC0GxCCEDQc93IQwLIAIgBDYCNCACIAM2AjBB1gogAkEwahA7QQAhCSAMIQELIAEiASEHQQAhAyABIQEgCUUNAQtBASEDIAchAQsgASEBAkAgAyIDRQ0AIAEhByAGQQFqIgkhBiADIQMgBCEEIAEhASAJIAovAQBPDQMMAQsLIAMhAyAEIQQgASEBDAELIAIgATYCJCACIAM2AiBB1gogAkEgahA7QQAhAyABIQQgByEBCyABIQEgBCEGAkAgA0UNACAFQQFqIgMgAC8BDiIISSIJIQUgASEEIAMhByAJIQkgBiEGIAEhASADIAhPDQIMAQsLIAghCSAGIQYgASEBCyABIQEgBiEDAkAgCUEBcUUNACABIQAMAQsCQCAAQewAaigCACIFRQ0AAkACQCAAIAAoAmhqIgQoAgggBU0NACACIAM2AgQgAkG1CDYCAEHWCiACEDtBACEDQct3IQAMAQsCQCAEEK8FIgUNACAFRSEDIAEhAAwBCyACIAAoAmg2AhQgAiAFNgIQQdYKIAJBEGoQO0EAIQNBACAFayEACyAAIQAgA0UNAQtBACEACyACQaAEaiQAIAALXgECfyMAQRBrIgIkAAJAAkAgAC8BBCIDIAAvAQZPDQAgASgC5AEhASAAIANBAWo7AQQgASADai0AACEADAELIAJBCGogAUHkABCBAUEAIQALIAJBEGokACAAQf8BcQs8AQF/QX8hAQJAAkACQCAALQBGDgYCAAAAAAEACyAAQQA6AEYgACAALQAGQRByOgAGQQAPC0F+IQELIAELNQAgACABOgBHAkAgAQ0AAkAgAC0ARg4GAQAAAAABAAsgAEEAOgBGIAAgAC0ABkEQcjoABgsLPgAgACgCsAIQICAAQc4CakIANwEAIABByAJqQgA3AwAgAEHAAmpCADcDACAAQbgCakIANwMAIABCADcDsAILtAIBBH8CQCABDQBBAA8LAkAgAUGAgARPDQACQCAALwG0AiICDQAgAkEARw8LIAAoArACIQNBACEEAkADQAJAIAMgBCIEQQJ0aiIFLwEAIAFHDQAgBSAFQQRqIAIgBEF/c2pBAnQQogYaIAAvAbQCIgJBAnQgACgCsAIiA2pBfGpBADsBACAAQc4CakIANwEAIABBxgJqQgA3AQAgAEG+AmpCADcBACAAQgA3AbYCAkAgAg0AQQEPC0EAIQQDQAJAIAMgBCIEQQJ0ai8BACIFRQ0AIAAgBUEfcWpBtgJqIgUtAAANACAFIARBAWo6AAALIARBAWoiBSEEQQEhASAFIAJHDQAMAwsACyAEQQFqIgUhBCAFIAJHDQALQQAhAQsgAQ8LQYHEAEH6yQBB1gBByhAQgwYACyQAAkAgACgC6AFFDQAgAEEEEIYEDwsgACAALQAHQYABcjoABwvkAgEHfwJAIAAtAEdFDQACQCAALQAHQQJxRQ0AIAAoArACIQJBACEDIAAvAbQCIgQhBQJAIARFDQBBACEGQQAhBANAIAQhBAJAAkAgAiAGIgZBAnRqIgctAAJBAXFFDQAgBCEEDAELIAIgBEECdGogBygBADYBACAEQQFqIQQLIAQiBCEDIAAvAbQCIgchBSAGQQFqIgghBiAEIQQgCCAHSQ0ACwsgAiADIgRBAnRqQQAgBSAEa0ECdBCjBhogAEHOAmpCADcBACAAQcYCakIANwEAIABBvgJqQgA3AQAgAEIANwG2AiAALwG0AiIHRQ0AIAAoArACIQhBACEEA0ACQCAIIAQiBEECdGovAQAiBkUNACAAIAZBH3FqQbYCaiIGLQAADQAgBiAEQQFqOgAACyAEQQFqIgYhBCAGIAdHDQALCyAAQQA6AAcgAEEANgKsAiAALQBGDQAgACABOgBGIAAQYQsLyQQBCX8CQCABQYCABE8NAAJAIAENAEF+DwsCQAJAAkAgAC8BtAIiA0UNACADQQJ0IAAoArACIgRqQXxqLwEADQAgBCEEIAMhAwwBC0F/IQUgA0HvAUsNASADQQF0IgNB6AEgA0HoAUkbQQhqIgNBAnQQHyAAKAKwAiAALwG0AkECdBChBiEEIAAoArACECAgACADOwG0AiAAIAQ2ArACIAQhBCADIQMLIAMhBiAEIQdBACEDQQAhBAJAA0AgBCEFAkACQAJAIAcgAyIEQQJ0aiIDLwEAIghFDQACQAJAIAggAXNBH3EiCUUNACAFQQFzQQFxRQ0BCwJAIAlFDQBBASEKQQAhCyAJRSEJDAQLQQEhCkEAIQtBASEJIAggAUkNAwsCQCAIIAFHDQAgAy0AAiACRw0AQQAhCkEBIQsMAgsgA0EEaiADIAYgBEF/c2pBAnQQogYaCyADIAE7AQAgAyACOgACQQAhCkEEIQsLIAUhCQsgCSEFIAshAyAKRQ0BIARBAWoiCCEDIAUhBCAIIAZHDQALQQQhAwtBACEFIANBBEcNACAAQgA3AbYCIABBzgJqQgA3AQAgAEHGAmpCADcBACAAQb4CakIANwEAAkAgAC8BtAIiAQ0AQQEPCyAAKAKwAiEIQQAhAwNAAkAgCCADIgNBAnRqLwEAIgRFDQAgACAEQR9xakG2AmoiBC0AAA0AIAQgA0EBajoAAAsgA0EBaiIEIQNBASEFIAQgAUcNAAsLIAUPC0GBxABB+skAQYUBQbMQEIMGAAu1BwILfwF+IwBBEGsiASQAAkAgACwAB0F/Sg0AIABBBBCGBAsCQCAAKALoASICRQ0AIAIhAkGAgAghAwJAA0AgAiECIANBf2oiBEUNASAALQBGDQICQAJAIAAtAEdFDQACQCAALQBIRQ0AIABBADoASAwBCyAAIAIvAQQiBUEfcWpBtgJqLQAAIgNFDQAgACgCsAIiBiADQX9qIgNBAnRqLwEAIgchCCADIQMgBSAHSQ0AA0AgAyEDAkAgBSAIQf//A3FHDQACQCAGIANBAnRqLQACQQFxRQ0AIAAoAqwCIAJHDQEgAEEIEIYEDAQLIABBARCGBAwDCyAGIANBAWoiA0ECdGovAQAiByEIIAMhAyAFIAdPDQALCwJAAkAgAi8BBCIDIAIvAQZPDQAgACgC5AEhBSACIANBAWo7AQQgBSADai0AACEDDAELIAFBCGogAEHkABCBAUEAIQMLIAMiA0H/AXEhBgJAIAPAQX9KDQAgASAGQfB+ahDpAwJAIAAtAEIiAkEQSQ0AIAFBCGogAEHlABCBAQwCCyABKQMAIQwgACACQQFqOgBCIAAgAkEDdGpB2ABqIAw3AwAMAQsCQCAGQd8ASQ0AIAFBCGogAEHmABCBAQwBCwJAIAZB+JIBai0AACIJQSBxRQ0AIAAgAi8BBCIDQX9qOwFAAkACQCADIAIvAQZPDQAgACgC5AEhBSACIANBAWo7AQQgBSADai0AACEDDAELIAFBCGogAEHkABCBAUEAIQMLAkACQCADQf8BcSIKQfgBTw0AIAohAwwBCyAKQQNxIQtBACEFQQAhCANAIAghCCAFIQMCQAJAIAIvAQQiBSACLwEGTw0AIAAoAuQBIQcgAiAFQQFqOwEEIAcgBWotAAAhBwwBCyABQQhqIABB5AAQgQFBACEHCyADQQFqIQUgCEEIdCAHQf8BcXIiByEIIAMgC0cNAAtBACAHayAHIApBBHEbIQMLIAAgAzYCUAsgACAALQBCOgBDAkACQCAJQRBxRQ0AIAIgAEHgkwEgBkECdGooAgARAgAgAC0AQkUNASABQQhqIABB5wAQgQEMAQsgASACIABB4JMBIAZBAnRqKAIAEQEAAkAgAC0AQiICQRBJDQAgAUEIaiAAQeUAEIEBDAELIAEpAwAhDCAAIAJBAWo6AEIgACACQQN0akHYAGogDDcDAAsgAC0ARUUNACAAENcDCyAAKALoASIFIQIgBCEDIAUNAAwCCwALIABB4dQDEHYLIAFBEGokAAsqAQF/AkAgACgC6AENAEEADwtBACEBAkAgAC0ARg0AIAAvAQhFIQELIAELJAEBf0EAIQECQCAAQeEBSw0AIABBAnRB8IsBaigCACEBCyABCyEAIAAoAgAiACAAKAJYaiAAIAAoAkhqIAFBAnRqKAIAagvBAgECfyMAQRBrIgMkACADIAAoAgA2AgwCQAJAIANBDGogARD9Aw0AAkAgAg0AQQAhAQwCCyACQQA2AgBBACEBDAELIAFB//8AcSEEAkACQAJAAkACQCABQQ52QQNxDgQBAgMAAQsgACgCACIBIAEoAlhqIAEgASgCSGogBEECdGooAgBqIQECQCACRQ0AIAIgAS8BADYCAAsgASABLwECQQN2Qf4/cWpBBGohAQwECyAAKAIAIgEgASgCUGogBEEDdGohAAJAIAJFDQAgAiAAKAIENgIACyABIAEoAlhqIAAoAgBqIQEMAwsgBEECdEHwiwFqKAIAIQEMAQsgACgCACIBIAEoAlhqIAEgASgCQGogBEEBdGovAQBqIQELIAEhAQJAIAJFDQAgAiABENAGNgIACyABIQELIANBEGokACABC0sBAX8jAEEQayIDJAAgAyAAKALkATYCBCADQQRqIAEgAhCMBCIBIQICQCABDQAgA0EIaiAAQegAEIEBQcnuACECCyADQRBqJAAgAgtQAQF/IwBBEGsiBCQAIAQgASgC5AE2AgwCQAJAIARBDGogAkEOdCADciIBEP0DDQAgAEIANwMADAELIAAgATYCACAAQQQ2AgQLIARBEGokAAsMACAAIAJB8gAQgQELDgAgACACIAIoAlAQrAMLNgACQCABLQBCQQFGDQBBm9sAQd/HAEHPAEGw1QAQgwYACyABQQA6AEIgASgC7AFBAEEAEHUaCzYAAkAgAS0AQkECRg0AQZvbAEHfxwBBzwBBsNUAEIMGAAsgAUEAOgBCIAEoAuwBQQFBABB1Ggs2AAJAIAEtAEJBA0YNAEGb2wBB38cAQc8AQbDVABCDBgALIAFBADoAQiABKALsAUECQQAQdRoLNgACQCABLQBCQQRGDQBBm9sAQd/HAEHPAEGw1QAQgwYACyABQQA6AEIgASgC7AFBA0EAEHUaCzYAAkAgAS0AQkEFRg0AQZvbAEHfxwBBzwBBsNUAEIMGAAsgAUEAOgBCIAEoAuwBQQRBABB1Ggs2AAJAIAEtAEJBBkYNAEGb2wBB38cAQc8AQbDVABCDBgALIAFBADoAQiABKALsAUEFQQAQdRoLNgACQCABLQBCQQdGDQBBm9sAQd/HAEHPAEGw1QAQgwYACyABQQA6AEIgASgC7AFBBkEAEHUaCzYAAkAgAS0AQkEIRg0AQZvbAEHfxwBBzwBBsNUAEIMGAAsgAUEAOgBCIAEoAuwBQQdBABB1Ggs2AAJAIAEtAEJBCUYNAEGb2wBB38cAQc8AQbDVABCDBgALIAFBADoAQiABKALsAUEIQQAQdRoL+AECA38BfiMAQdAAayICJAAgAkHIAGogARDsBCACQcAAaiABEOwEIAEoAuwBQQApA5iLATcDICABIAIpA0g3AzAgAiACKQNANwMwAkAgASACQTBqEJIDIgNFDQAgAiACKQNINwMoAkAgASACQShqEMUDIgQNACACIAIpA0g3AyAgAkE4aiABIAJBIGoQzQMgAiACKQM4IgU3A0ggAiAFNwMYIAEgAkEYahCOAQsgAiACKQNINwMQAkAgASADIAJBEGoQ+wINACABKALsAUEAKQOQiwE3AyALIAQNACACIAIpA0g3AwggASACQQhqEI8BCyACQdAAaiQAC14BAn8jAEEQayICJAAgASgC7AEhAyACQQhqIAEQ7AQgAyACKQMINwMgIAMgABB5AkAgAS0AR0UNACABKAKsAiAARw0AIAEtAAdBCHFFDQAgAUEIEIYECyACQRBqJAALYgEDfyMAQRBrIgIkAAJAAkAgACgCECgCACABKAJQIAEvAUBqIgNKDQAgAyEEIAMgAC8BBkgNAQsgAkEIaiABQekAEIEBQQAhBAsCQCAEIgFFDQAgACABOwEECyACQRBqJAALggEBBH8jAEEQayICJAAgAkEIaiABEOwEIAIgAikDCDcDACABIAIQ7gMhAwJAAkAgACgCECgCACABKAJQIAEvAUBqIgRKDQAgBCEFIAQgAC8BBkgNAQsgAkEIaiABQekAEIEBQQAhBQsCQCAFIgFFIANyDQAgACABOwEECyACQRBqJAALjwEBAX8jAEEwayIDJAAgA0EoaiACEOwEIANBIGogAhDsBAJAIAMoAiRBj4DA/wdxDQAgAygCIEGgf2pBK0sNACADIAMpAyA3AxAgA0EYaiACIANBEGpB2AAQmAMgAyADKQMYNwMgCyADIAMpAyg3AwggAyADKQMgNwMAIAAgAiADQQhqIAMQigMgA0EwaiQAC44BAQJ/IwBBIGsiAyQAIAIoAlAhBCADIAIoAuQBNgIMAkACQCADQQxqIARBgIABciIEEP0DDQAgA0IANwMQDAELIAMgBDYCECADQQQ2AhQLAkAgAykDEEIAUg0AIANBGGogAkH6ABCBAQsgAkEBEPICIQQgAyADKQMQNwMAIAAgAiAEIAMQjwMgA0EgaiQAC1UBAn8jAEEQayICJAAgAkEIaiABEOwEAkACQCABKAJQIgMgACgCEC8BCEkNACACIAFB7wAQgQEMAQsgACADQQN0akEYaiACKQMINwMACyACQRBqJAALVgECfyMAQRBrIgIkACACQQhqIAEQ7AQCQAJAIAEoAlAiAyABKALkAS8BDEkNACACIAFB8QAQgQEMAQsgASgCACADQQN0aiACKQMINwMACyACQRBqJAALYQEDfyMAQSBrIgIkACACQRhqIAEQ7AQgARDtBCEDIAEQ7QQhBCACQRBqIAFBARDvBAJAIAIpAxBQDQAgAiACKQMQNwMAIAJBCGogASAEIAMgAiACQRhqEEcLIAJBIGokAAsOACAAQQApA6iLATcDAAs3AQF/AkAgAigCUCIDIAEoAhAvAQhPDQAgACABIANBA3RqQRhqKQMANwMADwsgACACQfMAEIEBCzgBAX8CQCACKAJQIgMgAigC5AEvAQxPDQAgACACKAIAIANBA3RqKQMANwMADwsgACACQfYAEIEBC3EBAX8jAEEgayIDJAAgA0EYaiACEOwEIAMgAykDGDcDEAJAAkACQCADQRBqEMYDDQAgAygCHA0BIAMoAhhBAkcNAQsgACADKQMYNwMADAELIAMgAykDGDcDCCAAIAIgA0EIahDsAxDoAwsgA0EgaiQAC0oBAX8jAEEgayIDJAAgA0EYaiACEOwEIANBEGogAhDsBCADIAMpAxA3AwggAyADKQMYNwMAIAAgAiADQQhqIAMQnAMgA0EgaiQAC2EBAX8jAEEwayICJAAgAkEoaiABEOwEIAJBIGogARDsBCACQRhqIAEQ7AQgAiACKQMYNwMQIAIgAikDIDcDCCACIAIpAyg3AwAgASACQRBqIAJBCGogAhCdAyACQTBqJAALxAEBAn8jAEHAAGsiAyQAIANBIGogAhDsBCADIAMpAyA3AyggAigCUCEEIAMgAigC5AE2AhwCQAJAIANBHGogBEGAgAFyIgQQ/QMNACADQgA3AzAMAQsgAyAENgIwIANBBDYCNAsCQCADKQMwQgBSDQAgA0E4aiACQfoAEIEBCwJAAkAgAykDMEIAUg0AIABCADcDAAwBCyADIAMpAyg3AxAgAyADKQMwNwMIIAAgAiADQRBqIANBCGoQmgMLIANBwABqJAALxAEBAn8jAEHAAGsiAyQAIANBIGogAhDsBCADIAMpAyA3AyggAigCUCEEIAMgAigC5AE2AhwCQAJAIANBHGogBEGAgAJyIgQQ/QMNACADQgA3AzAMAQsgAyAENgIwIANBBDYCNAsCQCADKQMwQgBSDQAgA0E4aiACQfoAEIEBCwJAAkAgAykDMEIAUg0AIABCADcDAAwBCyADIAMpAyg3AxAgAyADKQMwNwMIIAAgAiADQRBqIANBCGoQmgMLIANBwABqJAALxAEBAn8jAEHAAGsiAyQAIANBIGogAhDsBCADIAMpAyA3AyggAigCUCEEIAMgAigC5AE2AhwCQAJAIANBHGogBEGAgANyIgQQ/QMNACADQgA3AzAMAQsgAyAENgIwIANBBDYCNAsCQCADKQMwQgBSDQAgA0E4aiACQfoAEIEBCwJAAkAgAykDMEIAUg0AIABCADcDAAwBCyADIAMpAyg3AxAgAyADKQMwNwMIIAAgAiADQRBqIANBCGoQmgMLIANBwABqJAALjgEBAn8jAEEgayIDJAAgAigCUCEEIAMgAigC5AE2AgwCQAJAIANBDGogBEGAgAFyIgQQ/QMNACADQgA3AxAMAQsgAyAENgIQIANBBDYCFAsCQCADKQMQQgBSDQAgA0EYaiACQfoAEIEBCyACQQAQ8gIhBCADIAMpAxA3AwAgACACIAQgAxCPAyADQSBqJAALjgEBAn8jAEEgayIDJAAgAigCUCEEIAMgAigC5AE2AgwCQAJAIANBDGogBEGAgAFyIgQQ/QMNACADQgA3AxAMAQsgAyAENgIQIANBBDYCFAsCQCADKQMQQgBSDQAgA0EYaiACQfoAEIEBCyACQRUQ8gIhBCADIAMpAxA3AwAgACACIAQgAxCPAyADQSBqJAALTQEDfyMAQRBrIgIkAAJAIAEgAUECEPICEJABIgMNACABQRAQUQsgASgC7AEhBCACQQhqIAFBCCADEOsDIAQgAikDCDcDICACQRBqJAALfwEDfyMAQRBrIgIkAAJAAkAgASABEO0EIgMQkgEiBA0AIAEgA0EDdEEQahBRIAEoAuwBIQMgAkEIaiABQQggBBDrAyADIAIpAwg3AyAMAQsgASgC7AEhAyACQQhqIAFBCCAEEOsDIAMgAikDCDcDICAEQQA7AQgLIAJBEGokAAtQAQN/IwBBEGsiAiQAAkAgASABEO0EIgMQlAEiBA0AIAEgA0EMahBRCyABKALsASEDIAJBCGogAUEIIAQQ6wMgAyACKQMINwMgIAJBEGokAAs1AQF/AkAgAigCUCIDIAIoAuQBLwEOSQ0AIAAgAkGDARCBAQ8LIAAgAkEIIAIgAxCQAxDrAwtpAQJ/IwBBEGsiAyQAIAIoAlAhBCADIAIoAuQBNgIEAkACQCADQQRqIAQQ/QMNACAAQgA3AwAMAQsgACAENgIAIABBBDYCBAsCQCAAKQMAQgBSDQAgA0EIaiACQfoAEIEBCyADQRBqJAALcAECfyMAQRBrIgMkACACKAJQIQQgAyACKALkATYCBAJAAkAgA0EEaiAEQYCAAXIiBBD9Aw0AIABCADcDAAwBCyAAIAQ2AgAgAEEENgIECwJAIAApAwBCAFINACADQQhqIAJB+gAQgQELIANBEGokAAtwAQJ/IwBBEGsiAyQAIAIoAlAhBCADIAIoAuQBNgIEAkACQCADQQRqIARBgIACciIEEP0DDQAgAEIANwMADAELIAAgBDYCACAAQQQ2AgQLAkAgACkDAEIAUg0AIANBCGogAkH6ABCBAQsgA0EQaiQAC3ABAn8jAEEQayIDJAAgAigCUCEEIAMgAigC5AE2AgQCQAJAIANBBGogBEGAgANyIgQQ/QMNACAAQgA3AwAMAQsgACAENgIAIABBBDYCBAsCQCAAKQMAQgBSDQAgA0EIaiACQfoAEIEBCyADQRBqJAALOQEBfwJAIAIoAlAiAyACKADkAUEkaigCAEEEdkkNACAAIAJB+AAQgQEPCyAAIAM2AgAgAEEDNgIECwwAIAAgAigCUBDpAwtDAQJ/AkAgAigCUCIDIAIoAOQBIgRBNGooAgBBA3ZPDQAgACAEIAQoAjBqIANBA3RqKQAANwMADwsgACACQfcAEIEBC18BA38jAEEQayIDJAAgAhDtBCEEIAIQ7QQhBSADQQhqIAJBAhDvBAJAAkAgAykDCEIAUg0AIABCADcDAAwBCyADIAMpAwg3AwAgACACIAUgBCADQQAQRwsgA0EQaiQACxAAIAAgAigC7AEpAyA3AwALNAEBfyMAQRBrIgMkACADQQhqIAIQ7AQgAyADKQMINwMAIAAgAiADEPUDEOkDIANBEGokAAsJACAAQgA3AwALNQEBfyMAQRBrIgMkACADQQhqIAIQ7AQgAEGQiwFBmIsBIAMpAwhQGykDADcDACADQRBqJAALDgAgAEEAKQOQiwE3AwALDgAgAEEAKQOYiwE3AwALNAEBfyMAQRBrIgMkACADQQhqIAIQ7AQgAyADKQMINwMAIAAgAiADEO4DEOoDIANBEGokAAsOACAAQQApA6CLATcDAAuqAQIBfwF8IwBBEGsiAyQAIANBCGogAhDsBAJAAkAgAygCDEF/Rg0AIAMgAykDCDcDAAJAIAIgAxDsAyIERAAAAAAAAAAAY0UNACAAIASaEOgDDAILIAAgAykDCDcDAAwBCwJAIAMoAggiAkF/Sg0AAkAgAkGAgICAeEcNACAAQQApA4iLATcDAAwCCyAAQQAgAmsQ6QMMAQsgACADKQMINwMACyADQRBqJAALDwAgACACEO4EQX9zEOkDCzIBAX8jAEEQayIDJAAgA0EIaiACEOwEIAAgAygCDEUgAygCCEECRnEQ6gMgA0EQaiQAC3IBAX8jAEEQayIDJAAgA0EIaiACEOwEAkACQCADKAIMQX9GDQAgAyADKQMINwMAIAAgAiADEOwDmhDoAwwBCwJAIAMoAggiAkGAgICAeEcNACAAQQApA4iLATcDAAwBCyAAQQAgAmsQ6QMLIANBEGokAAs3AQF/IwBBEGsiAyQAIANBCGogAhDsBCADIAMpAwg3AwAgACACIAMQ7gNBAXMQ6gMgA0EQaiQACwwAIAAgAhDuBBDpAwupAgIFfwF8IwBBwABrIgMkACADQThqIAIQ7AQgAkEYaiIEIAMpAzg3AwAgA0E4aiACEOwEIAIgAykDODcDECACQRBqIQUCQAJAIAIoABRBf0cNACACKAAcQX9HDQAgBCgCACIGQQBIIAUoAgAiByAGaiIGIAdIcw0AIAAgBhDpAwwBCyADIAUpAwA3AzACQAJAIAIgA0EwahDFAw0AIAMgBCkDADcDKCACIANBKGoQxQNFDQELIAMgBSkDADcDECADIAQpAwA3AwggACACIANBEGogA0EIahDQAwwBCyADIAUpAwA3AyAgAiACIANBIGoQ7AM5AyAgAyAEKQMANwMYIAJBKGogAiADQRhqEOwDIgg5AwAgACAIIAIrAyCgEOgDCyADQcAAaiQAC80BAgV/AXwjAEEgayIDJAAgA0EYaiACEOwEIAJBGGoiBCADKQMYNwMAIANBGGogAhDsBCACIAMpAxg3AxAgAkEQaiEFAkACQCACKAAUQX9HDQAgAigAHEF/Rw0AIAQoAgAiBkEASiAFKAIAIgcgBmsiBiAHSHMNACAAIAYQ6QMMAQsgAyAFKQMANwMQIAIgAiADQRBqEOwDOQMgIAMgBCkDADcDCCACQShqIAIgA0EIahDsAyIIOQMAIAAgAisDICAIoRDoAwsgA0EgaiQAC88BAwR/AX4BfCMAQSBrIgMkACADQRhqIAIQ7AQgAkEYaiIEIAMpAxg3AwAgA0EYaiACEOwEIAIgAykDGDcDECACQRBqIQUCQAJAIAIoABRBf0cNACACKAAcQX9HDQAgBTQCACAENAIAfiIHQiCIpyAHpyIGQR91Rw0AIAAgBhDpAwwBCyADIAUpAwA3AxAgAiACIANBEGoQ7AM5AyAgAyAEKQMANwMIIAJBKGogAiADQQhqEOwDIgg5AwAgACAIIAIrAyCiEOgDCyADQSBqJAAL6AECBn8BfCMAQSBrIgMkACADQRhqIAIQ7AQgAkEYaiIEIAMpAxg3AwAgA0EYaiACEOwEIAIgAykDGDcDECACQRBqIQUCQAJAIAIoABRBf0cNACACKAAcQX9HDQACQAJAIAQoAgAiBkEBag4CAAIBCyAFKAIAQYCAgIB4Rg0BCyAFKAIAIgcgBm0iCCAGbCAHRw0AIAAgCBDpAwwBCyADIAUpAwA3AxAgAiACIANBEGoQ7AM5AyAgAyAEKQMANwMIIAJBKGogAiADQQhqEOwDIgk5AwAgACACKwMgIAmjEOgDCyADQSBqJAALLAECfyACQRhqIgMgAhDuBDYCACACIAIQ7gQiBDYCECAAIAQgAygCAHEQ6QMLLAECfyACQRhqIgMgAhDuBDYCACACIAIQ7gQiBDYCECAAIAQgAygCAHIQ6QMLLAECfyACQRhqIgMgAhDuBDYCACACIAIQ7gQiBDYCECAAIAQgAygCAHMQ6QMLLAECfyACQRhqIgMgAhDuBDYCACACIAIQ7gQiBDYCECAAIAQgAygCAHQQ6QMLLAECfyACQRhqIgMgAhDuBDYCACACIAIQ7gQiBDYCECAAIAQgAygCAHUQ6QMLQQECfyACQRhqIgMgAhDuBDYCACACIAIQ7gQiBDYCEAJAIAQgAygCAHYiAkF/Sg0AIAAgArgQ6AMPCyAAIAIQ6QMLnQEBA38jAEEgayIDJAAgA0EYaiACEOwEIAJBGGoiBCADKQMYNwMAIANBGGogAhDsBCACIAMpAxg3AxAgAkEQaiEFAkACQCACKAAUQX9HDQAgAigAHEF/Rw0AIAUoAgAgBCgCAEYhAgwBCyADIAUpAwA3AxAgAyAEKQMANwMIIAIgA0EQaiADQQhqEPkDIQILIAAgAhDqAyADQSBqJAALvgECA38BfCMAQSBrIgMkACADQRhqIAIQ7AQgAkEYaiIEIAMpAxg3AwAgA0EYaiACEOwEIAIgAykDGDcDECACQRBqIQUCQAJAAkAgAigAFEF/Rw0AIAIoABxBf0YNAQsgAyAFKQMANwMQIAIgAiADQRBqEOwDOQMgIAMgBCkDADcDCCACQShqIAIgA0EIahDsAyIGOQMAIAIrAyAgBmUhAgwBCyAFKAIAIAQoAgBMIQILIAAgAhDqAyADQSBqJAALvgECA38BfCMAQSBrIgMkACADQRhqIAIQ7AQgAkEYaiIEIAMpAxg3AwAgA0EYaiACEOwEIAIgAykDGDcDECACQRBqIQUCQAJAAkAgAigAFEF/Rw0AIAIoABxBf0YNAQsgAyAFKQMANwMQIAIgAiADQRBqEOwDOQMgIAMgBCkDADcDCCACQShqIAIgA0EIahDsAyIGOQMAIAIrAyAgBmMhAgwBCyAFKAIAIAQoAgBIIQILIAAgAhDqAyADQSBqJAALoAEBA38jAEEgayIDJAAgA0EYaiACEOwEIAJBGGoiBCADKQMYNwMAIANBGGogAhDsBCACIAMpAxg3AxAgAkEQaiEFAkACQCACKAAUQX9HDQAgAigAHEF/Rw0AIAUoAgAgBCgCAEchAgwBCyADIAUpAwA3AxAgAyAEKQMANwMIIAIgA0EQaiADQQhqEPkDQQFzIQILIAAgAhDqAyADQSBqJAALPgEBfyMAQRBrIgMkACADQQhqIAIQ7AQgAyADKQMINwMAIABBkIsBQZiLASADEPcDGykDADcDACADQRBqJAAL4gEBBX8jAEEQayICJAAgAkEIaiABEOwEAkACQCABEO4EIgNBAU4NAEEAIQMMAQsCQAJAIAANACAAIQMgAEEARyEEDAELIAAhBSADIQYDQCAGIQAgBSgCCCIDQQBHIQQCQCADDQAgAyEDIAQhBAwCCyADIQUgAEF/aiEGIAMhAyAEIQQgAEEBSg0ACwsgAyEAQQAhAyAERQ0AIAAgASgCUCIDQQN0akEYakEAIAMgACgCEC8BCEkbIQMLAkACQCADIgMNACACIAFB8AAQgQEMAQsgAyACKQMINwMACyACQRBqJAALxAEBBH8CQAJAIAIQ7gQiA0EBTg0AQQAhAwwBCwJAAkAgAQ0AIAEhAyABQQBHIQQMAQsgASEFIAMhBgNAIAYhASAFKAIIIgNBAEchBAJAIAMNACADIQMgBCEEDAILIAMhBSABQX9qIQYgAyEDIAQhBCABQQFKDQALCyADIQFBACEDIARFDQAgASACKAJQIgNBA3RqQRhqQQAgAyABKAIQLwEISRshAwsCQCADIgMNACAAIAJB9AAQgQEPCyAAIAMpAwA3AwALNgEBfwJAIAIoAlAiAyACKADkAUEkaigCAEEEdkkNACAAIAJB9QAQgQEPCyAAIAIgASADEIsDC7oBAQN/IwBBIGsiAyQAIANBEGogAhDsBCADIAMpAxA3AwhBACEEAkAgAiADQQhqEPUDIgVBDUsNACAFQeCWAWotAAAhBAsCQAJAIAQiBA0AIABCADcDAAwBCyACIAQ2AlAgAyACKALkATYCBAJAAkAgA0EEaiAEQYCAAXIiBBD9Aw0AIABCADcDAAwBCyAAIAQ2AgAgAEEENgIECyAAKQMAQgBSDQAgA0EYaiACQfoAEIEBCyADQSBqJAALgwEBA38jAEEQayICJAACQAJAIAAoAhAoAgAgASgCUCABLwFAaiIDSg0AIAMhBCADIAAvAQZIDQELIAJBCGogAUHpABCBAUEAIQQLAkAgBCIERQ0AIAIgASgC7AEpAyA3AwAgAhD3A0UNACABKALsAUIANwMgIAAgBDsBBAsgAkEQaiQAC6UBAQJ/IwBBMGsiAiQAIAJBKGogARDsBCACQSBqIAEQ7AQgAiACKQMoNwMQAkACQAJAIAEgAkEQahD0Aw0AIAIgAikDKDcDCCACQRhqIAFBDyACQQhqEN0DDAELIAEtAEINASABQQE6AEMgASgC7AEhAyACIAIpAyg3AwAgA0EAIAEgAhDzAxB1GgsgAkEwaiQADwtB69wAQd/HAEHuAEHNCBCDBgALWgEDfyMAQRBrIgIkAAJAAkAgACgCECgCACABKAJQIAEvAUBqIgNKDQAgAyEEIAMgAC8BBkgNAQsgAkEIaiABQekAEIEBQQAhBAsgACABIAQQ0gMgAkEQaiQAC3sBA38jAEEQayICJAACQAJAIAAoAhAoAgAgASgCUCABLwFAaiIDSg0AIAMhBCADIAAvAQZIDQELIAJBCGogAUHpABCBAUEAIQQLAkAgBCIERQ0AIAAgBDsBBAsCQCAAIAEQ0wMNACACQQhqIAFB6gAQgQELIAJBEGokAAshAQF/IwBBEGsiAiQAIAJBCGogAUHrABCBASACQRBqJAALRgEBfyMAQRBrIgIkAAJAAkAgACABENMDIAAvAQRBf2pHDQAgASgC7AFCADcDIAwBCyACQQhqIAFB7QAQgQELIAJBEGokAAtdAQF/IwBBIGsiAiQAIAJBGGogARDsBCACIAIpAxg3AwgCQAJAIAJBCGoQ9wNFDQAgAkEQaiABQew+QQAQ2QMMAQsgAiACKQMYNwMAIAEgAkEAENYDCyACQSBqJAALPAEBfyMAQRBrIgIkACACQQhqIAEQ7AQCQCACKQMIUA0AIAIgAikDCDcDACABIAJBARDWAwsgAkEQaiQAC5gBAQR/IwBBEGsiAiQAAkACQCABEO4EIgNBEEkNACACQQhqIAFB7gAQgQEMAQsCQAJAIAAoAhAoAgAgASgCUCABLwFAaiIESg0AIAQhBSAEIAAvAQZIDQELIAJBCGogAUHpABCBAUEAIQULIAUiAEUNACACQQhqIAAgAxD8AyACIAIpAwg3AwAgASACQQEQ1gMLIAJBEGokAAsJACABQQcQhgQLhAIBA38jAEEgayIDJAAgA0EYaiACEOwEIAMgAykDGDcDAAJAAkACQAJAIAIgAyADQRBqIANBDGoQjAMiBEF/Sg0AIAAgAkHHJkEAENkDDAELAkACQCAEQdCGA0gNACAEQbD5fGoiBEEALwHI7gFODQNBkP8AIARBA3RqLQADQQhxDQEgACACQaEdQQAQ2QMMAgsgBCACKADkASIFQSRqKAIAQQR2Tg0DIAUgBSgCIGogBEEEdGotAAtBAnENACAAIAJBqR1BABDZAwwBCyAAIAMpAxg3AwALIANBIGokAA8LQfcWQd/HAEHRAkHXDBCDBgALQaXnAEHfxwBB1gJB1wwQgwYAC1YBAn8jAEEgayIDJAAgA0EYaiACEOwEIANBEGogAhDsBCADIAMpAxg3AwggAiADQQhqEJcDIQQgAyADKQMQNwMAIAAgAiADIAQQmQMQ6gMgA0EgaiQACw4AIABBACkDsIsBNwMAC50BAQN/IwBBIGsiAyQAIANBGGogAhDsBCACQRhqIgQgAykDGDcDACADQRhqIAIQ7AQgAiADKQMYNwMQIAJBEGohBQJAAkAgAigAFEF/Rw0AIAIoABxBf0cNACAFKAIAIAQoAgBGIQIMAQsgAyAFKQMANwMQIAMgBCkDADcDCCACIANBEGogA0EIahD4AyECCyAAIAIQ6gMgA0EgaiQAC6ABAQN/IwBBIGsiAyQAIANBGGogAhDsBCACQRhqIgQgAykDGDcDACADQRhqIAIQ7AQgAiADKQMYNwMQIAJBEGohBQJAAkAgAigAFEF/Rw0AIAIoABxBf0cNACAFKAIAIAQoAgBHIQIMAQsgAyAFKQMANwMQIAMgBCkDADcDCCACIANBEGogA0EIahD4A0EBcyECCyAAIAIQ6gMgA0EgaiQACywBAX8jAEEQayICJAAgAkEIaiABEOwEIAEoAuwBIAIpAwg3AyAgAkEQaiQACy4BAX8CQCACKAJQIgMgAigC5AEvAQ5JDQAgACACQYABEIEBDwsgACACIAMQ/QILPwEBfwJAIAEtAEIiAg0AIAAgAUHsABCBAQ8LIAEgAkF/aiICOgBCIAAgASACQf8BcUEDdGpB2ABqKQMANwMAC2sBAn8jAEEQayIBJAACQAJAIAAtAEIiAg0AIAFBCGogAEHsABCBAQwBCyAAIAJBf2oiAjoAQiABIAAgAkH/AXFBA3RqQdgAaikDADcDCAsgASABKQMINwMAIAAgARDtAyEAIAFBEGokACAAC2sBAn8jAEEQayIBJAACQAJAIAAtAEIiAg0AIAFBCGogAEHsABCBAQwBCyAAIAJBf2oiAjoAQiABIAAgAkH/AXFBA3RqQdgAaikDADcDCAsgASABKQMINwMAIAAgARDtAyEAIAFBEGokACAAC4kCAgJ/AX4jAEHAAGsiAyQAAkACQCABLQBCIgQNACADQThqIAFB7AAQgQEMAQsgASAEQX9qIgQ6AEIgAyABIARB/wFxQQN0akHYAGopAwA3AzgLIAMgAykDODcDKAJAAkAgASADQShqEO8DDQACQCACQQJxRQ0AIAMgAykDODcDICABIANBIGoQxQMNAQsgAyADKQM4NwMYIANBMGogAUESIANBGGoQ3QNCACEFDAELAkAgAkEBcUUNACADIAMpAzg3AxAgASADQRBqEPADDQAgAyADKQM4NwMIIANBMGogAUGwICADQQhqEN4DQgAhBQwBCyADKQM4IQULIAAgBTcDACADQcAAaiQAC8kEAQV/AkAgBUH2/wNPDQAgABD0BEEAQQE6AKCDAkEAIAEpAAA3AKGDAkEAIAFBBWoiBikAADcApoMCQQAgBUEIdCAFQYD+A3FBCHZyOwGugwJBACADQQJ0QfgBcUF5ajoAoIMCQaCDAhD1BAJAIAVFDQBBACEAA0ACQCAFIAAiB2siAEEQIABBEEkbIghFDQAgBCAHaiEJQQAhAANAIAAiAEGggwJqIgogCi0AACAJIABqLQAAczoAACAAQQFqIgohACAKIAhHDQALC0GggwIQ9QQgB0EQaiIKIQAgCiAFSQ0ACwsgAkGggwIgAxChBiEIQQBBAToAoIMCQQAgASkAADcAoYMCQQAgBikAADcApoMCQQBBADsBroMCQaCDAhD1BAJAIANBECADQRBJGyIJRQ0AQQAhAANAIAggACIAaiIKIAotAAAgAEGggwJqLQAAczoAACAAQQFqIgohACAKIAlHDQALCwJAIAVFDQAgBUF/akEEdkEBaiECIAFBBWohBkEAIQBBASEKA0BBAEEBOgCggwJBACABKQAANwChgwJBACAGKQAANwCmgwJBACAKIgdBCHQgB0GA/gNxQQh2cjsBroMCQaCDAhD1BAJAIAUgACIDayIAQRAgAEEQSRsiCEUNACAEIANqIQlBACEAA0AgCSAAIgBqIgogCi0AACAAQaCDAmotAABzOgAAIABBAWoiCiEAIAogCEcNAAsLIANBEGohACAHQQFqIQogByACRw0ACwsQ9gQPC0GRygBBMEHnDxD+BQAL4QUBB39BfyEGAkAgBUH1/wNLDQAgABD0BAJAIAVFDQAgBUF/akEEdkEBaiEHIAFBBWohCEEAIQBBASEJA0BBAEEBOgCggwJBACABKQAANwChgwJBACAIKQAANwCmgwJBACAJIgpBCHQgCkGA/gNxQQh2cjsBroMCQaCDAhD1BAJAIAUgACILayIAQRAgAEEQSRsiBkUNACAEIAtqIQxBACEAA0AgDCAAIgBqIgkgCS0AACAAQaCDAmotAABzOgAAIABBAWoiCSEAIAkgBkcNAAsLIAtBEGohACAKQQFqIQkgCiAHRw0ACwtBAEEBOgCggwJBACABKQAANwChgwJBACABQQVqKQAANwCmgwJBACAFQQh0IAVBgP4DcUEIdnI7Aa6DAkEAIANBAnRB+AFxQXlqOgCggwJBoIMCEPUEAkAgBUUNAEEAIQADQAJAIAUgACIKayIAQRAgAEEQSRsiBkUNACAEIApqIQxBACEAA0AgACIAQaCDAmoiCSAJLQAAIAwgAGotAABzOgAAIABBAWoiCSEAIAkgBkcNAAsLQaCDAhD1BCAKQRBqIgkhACAJIAVJDQALCwJAAkAgA0EQIANBEEkbIgZFDQBBACEAA0AgAiAAIgBqIgkgCS0AACAAQaCDAmotAABzOgAAIABBAWoiCSEAIAkgBkcNAAtBAEEBOgCggwJBACABKQAANwChgwJBACABQQVqKQAANwCmgwJBAEEAOwGugwJBoIMCEPUEIAZFDQFBACEAA0AgAiAAIgBqIgkgCS0AACAAQaCDAmotAABzOgAAIABBAWoiCSEAIAkgBkcNAAwCCwALQQBBAToAoIMCQQAgASkAADcAoYMCQQAgAUEFaikAADcApoMCQQBBADsBroMCQaCDAhD1BAsQ9gQCQCADDQBBAA8LQQAhAEEAIQkDQCAAIgZBAWoiDCEAIAkgAiAGai0AAGoiBiEJIAYhBiAMIANHDQALCyAGC90DAQh/QQAhAgNAIAAgAiIDQQJ0IgJqIAEgAmotAAA6AAAgACACQQFyIgRqIAEgBGotAAA6AAAgACACQQJyIgRqIAEgBGotAAA6AAAgACACQQNyIgJqIAEgAmotAAA6AAAgA0EBaiIDIQIgA0EIRw0AC0EIIQIDQCACIgNBAnQiASAAaiICQX9qLQAAIQUgAkF+ai0AACEGIAJBfWotAAAhByACQXxqLQAAIQgCQAJAIANBB3EiBEUNACAFIQkgBiEFIAchBiAIIQcMAQsgCEHwlgFqLQAAIQkgBUHwlgFqLQAAIQUgBkHwlgFqLQAAIQYgA0EDdkHwmAFqLQAAIAdB8JYBai0AAHMhBwsgByEHIAYhBiAFIQUgCSEIAkACQCAEQQRGDQAgCCEEIAUhBSAGIQYgByEHDAELIAhB/wFxQfCWAWotAAAhBCAFQf8BcUHwlgFqLQAAIQUgBkH/AXFB8JYBai0AACEGIAdB/wFxQfCWAWotAAAhBwsgAiACQWBqLQAAIAdzOgAAIAAgAUEBcmogAkFhai0AACAGczoAACAAIAFBAnJqIAJBYmotAAAgBXM6AAAgACABQQNyaiACQWNqLQAAIARzOgAAIANBAWoiASECIAFBPEcNAAsLzAUBCX9BACECA0AgAiIDQQJ0IQRBACECA0AgASAEaiACIgJqIgUgBS0AACAAIAIgBGpqLQAAczoAACACQQFqIgUhAiAFQQRHDQALIANBAWoiBCECIARBBEcNAAtBASECA0AgAiEGQQAhAgNAIAIhBUEAIQIDQCABIAIiAkECdGogBWoiBCAELQAAQfCWAWotAAA6AAAgAkEBaiIEIQIgBEEERw0ACyAFQQFqIgQhAiAEQQRHDQALIAEtAAEhAiABIAEtAAU6AAEgAS0ACSEEIAEgAS0ADToACSABIAQ6AAUgASACOgANIAEtAAIhAiABIAEtAAo6AAIgASACOgAKIAEtAAYhAiABIAEtAA46AAYgASACOgAOIAEtAAMhAiABIAEtAA86AAMgASABLQALOgAPIAEgAS0ABzoACyABIAI6AAcCQCAGQQ5GDQBBACECA0AgASACIgdBAnRqIgIgAi0AAyIEIAItAAAiBXMiA0EBdCADwEEHdkEbcXMgBHMgBCACLQACIgNzIgggAi0AASIJIAVzIgpzIgRzOgADIAIgAyAIQQF0IAjAQQd2QRtxc3MgBHM6AAIgAiAJIAMgCXMiA0EBdCADwEEHdkEbcXNzIARzOgABIAIgBSAKQQF0IArAQQd2QRtxc3MgBHM6AAAgB0EBaiIEIQIgBEEERw0ACyAGQQR0IQlBACECA0AgAiIIQQJ0IgUgCWohA0EAIQIDQCABIAVqIAIiAmoiBCAELQAAIAAgAyACamotAABzOgAAIAJBAWoiBCECIARBBEcNAAsgCEEBaiIEIQIgBEEERw0ACyAGQQFqIQIMAQsLQQAhAgNAIAIiCEECdCIFQeABaiEDQQAhAgNAIAEgBWogAiICaiIEIAQtAAAgACADIAJqai0AAHM6AAAgAkEBaiIEIQIgBEEERw0ACyAIQQFqIgQhAiAEQQRHDQALCwsAQbCDAiAAEPIECwsAQbCDAiAAEPMECw8AQbCDAkEAQfABEKMGGgupAQEFf0GUfyEEAkACQEEAKAKghQINAEEAQQA2AaaFAiAAENAGIgQgAxDQBiIFaiIGIAIQ0AYiB2oiCEH2fWpB8H1NDQEgBEGshQIgACAEEKEGakEAOgAAIARBrYUCaiADIAUQoQYhBCAGQa2FAmpBADoAACAEIAVqQQFqIAIgBxChBhogCEGuhQJqQQA6AAAgACABED4hBAsgBA8LQdbJAEE3QcgMEP4FAAsLACAAIAFBAhD5BAvoAQEFfwJAIAFBgOADTw0AQQhBBiABQf0ASxsgAWoiAxAfIgQgAkGAAXI6AAACQAJAIAFB/gBJDQAgBCABOgADIARB/gA6AAEgBCABQQh2OgACIARBBGohAgwBCyAEIAE6AAEgBEECaiECCyAEIAQtAAFBgAFyOgABIAIiBRD3BTYAAAJAIAFFDQAgBUEEaiEGQQAhAgNAIAYgAiICaiAFIAJBA3FqLQAAIAAgAmotAABzOgAAIAJBAWoiByECIAcgAUcNAAsLIAQgAxA/IQIgBBAgIAIPC0G+2wBB1skAQcQAQaY4EIMGAAu6AgECfyMAQcAAayIDJAACQAJAQQAoAqCFAiIERQ0AIAAgASACIAQRAQAMAQsCQAJAAkACQCAAQX9qDgQAAgMBBAtBAEEBOgCkhQIgA0E1akELECggA0E1akELEIsGIQBBrIUCENAGQa2FAmoiAhDQBiEBIANBJGoQ8QU2AgAgA0EgaiACNgIAIAMgADYCHCADQayFAjYCGCADQayFAjYCFCADIAIgAWpBAWo2AhBB2uwAIANBEGoQigYhAiAAECAgAiACENAGED9Bf0oNA0EALQCkhQJB/wFxQf8BRg0DIANB1h02AgBBohsgAxA7QQBB/wE6AKSFAkEDQdYdQRAQgQUQQAwDCyABIAIQ+wQMAgtBAiABIAIQgQUMAQtBAEH/AToApIUCEEBBAyABIAIQgQULIANBwABqJAALtA4BCH8jAEGwAWsiAiQAIAEhASAAIQACQAJAAkADQCAAIQAgASEBQQAtAKSFAkH/AUYNAQJAAkACQCABQY4CQQAvAaaFAiIDayIESg0AQQIhAwwBCwJAIANBjgJJDQAgAkGKDDYCoAFBohsgAkGgAWoQO0EAQf8BOgCkhQJBA0GKDEEOEIEFEEBBASEDDAELIAAgBBD7BEEAIQMgASAEayEBIAAgBGohAAwBCyABIQEgACEACyABIgQhASAAIgUhACADIgNFDQALAkAgA0F/ag4CAQABC0EALwGmhQJBrIUCaiAFIAQQoQYaQQBBAC8BpoUCIARqIgE7AaaFAiABQf//A3EiAUGPAk8NAiABQayFAmpBADoAAAJAIAFBDEkNAEEALQCkhQJB/wFxQQFHDQACQEGshQJB/doAEI8GRQ0AQQBBAjoApIUCQfHaAEEAEDsMAQsgAkGshQI2ApABQcAbIAJBkAFqEDtBAC0ApIUCQf8BRg0AIAJBlzQ2AoABQaIbIAJBgAFqEDtBAEH/AToApIUCQQNBlzRBEBCBBRBACwJAQQAtAKSFAkECRw0AAkACQEEALwGmhQIiBQ0AQX8hAwwBC0F/IQBBACEBAkADQCAAIQACQCABIgFBrIUCai0AAEEKRw0AIAEhAAJAAkAgAUGthQJqLQAAQXZqDgQAAgIBAgsgAUECaiIDIQAgAyAFTQ0DQeAcQdbJAEGXAUG0LRCDBgALIAEhACABQa6FAmotAABBCkcNACABQQNqIgMhACADIAVNDQJB4BxB1skAQZcBQbQtEIMGAAsgACIDIQAgAUEBaiIEIQEgAyEDIAQgBUcNAAwCCwALQQAgBSAAIgBrIgM7AaaFAkGshQIgAEGshQJqIANB//8DcRCiBhpBAEEDOgCkhQIgASEDCyADIQECQAJAQQAtAKSFAkF+ag4CAAECCwJAAkAgAUEBag4CAAMBC0EAQQA7AaaFAgwCCyABQQAvAaaFAiIASw0DQQAgACABayIAOwGmhQJBrIUCIAFBrIUCaiAAQf//A3EQogYaDAELIAJBAC8BpoUCNgJwQZrDACACQfAAahA7QQFBAEEAEIEFC0EALQCkhQJBA0cNAANAQQAhAQJAQQAvAaaFAiIDQQAvAaiFAiIAayIEQQJIDQACQCAAQa2FAmotAAAiBcAiAUF/Sg0AQQAhAUEALQCkhQJB/wFGDQEgAkG0EjYCYEGiGyACQeAAahA7QQBB/wE6AKSFAkEDQbQSQREQgQUQQEEAIQEMAQsCQCABQf8ARw0AQQAhAUEALQCkhQJB/wFGDQEgAkHR4gA2AgBBohsgAhA7QQBB/wE6AKSFAkEDQdHiAEELEIEFEEBBACEBDAELIABBrIUCaiIGLAAAIQcCQAJAIAFB/gBGDQAgBSEFIABBAmohCAwBC0EAIQEgBEEESA0BAkAgAEGuhQJqLQAAQQh0IABBr4UCai0AAHIiAUH9AE0NACABIQUgAEEEaiEIDAELQQAhAUEALQCkhQJB/wFGDQEgAkGKKjYCEEGiGyACQRBqEDtBAEH/AToApIUCQQNBiipBCxCBBRBAQQAhAQwBC0EAIQEgCCIIIAUiBWoiCSADSg0AAkAgB0H/AHEiAUEISQ0AAkAgB0EASA0AQQAhAUEALQCkhQJB/wFGDQIgAkGXKTYCIEGiGyACQSBqEDtBAEH/AToApIUCQQNBlylBDBCBBRBAQQAhAQwCCwJAIAVB/gBIDQBBACEBQQAtAKSFAkH/AUYNAiACQaQpNgIwQaIbIAJBMGoQO0EAQf8BOgCkhQJBA0GkKUEOEIEFEEBBACEBDAILAkACQAJAAkAgAUF4ag4DAgADAQsgBiAFQQoQ+QRFDQJB5C0Q/ARBACEBDAQLQYopEPwEQQAhAQwDC0EAQQQ6AKSFAkHCNkEAEDtBAiAIQayFAmogBRCBBQsgBiAJQayFAmpBAC8BpoUCIAlrIgEQogYaQQBBAC8BqIUCIAFqOwGmhQJBASEBDAELAkAgAEUNACABRQ0AQQAhAUEALQCkhQJB/wFGDQEgAkGB0wA2AkBBohsgAkHAAGoQO0EAQf8BOgCkhQJBA0GB0wBBDhCBBRBAQQAhAQwBCwJAIAANACABQQJGDQBBACEBQQAtAKSFAkH/AUYNASACQYjWADYCUEGiGyACQdAAahA7QQBB/wE6AKSFAkEDQYjWAEENEIEFEEBBACEBDAELQQAgAyAIIABrIgFrOwGmhQIgBiAIQayFAmogBCABaxCiBhpBAEEALwGohQIgBWoiATsBqIUCAkAgB0F/Sg0AQQRBrIUCIAFB//8DcSIBEIEFIAEQ/QRBAEEAOwGohQILQQEhAQsgAUUNAUEALQCkhQJB/wFxQQNGDQALCyACQbABaiQADwtB4BxB1skAQZcBQbQtEIMGAAtB6NgAQdbJAEGyAUGBzwAQgwYAC0oBAX8jAEEQayIBJAACQEEALQCkhQJB/wFGDQAgASAANgIAQaIbIAEQO0EAQf8BOgCkhQJBAyAAIAAQ0AYQgQUQQAsgAUEQaiQAC1MBAX8CQAJAIABFDQBBAC8BpoUCIgEgAEkNAUEAIAEgAGsiATsBpoUCQayFAiAAQayFAmogAUH//wNxEKIGGgsPC0HgHEHWyQBBlwFBtC0QgwYACzEBAX8CQEEALQCkhQIiAEEERg0AIABB/wFGDQBBAEEEOgCkhQIQQEECQQBBABCBBQsLzwEBBX8jAEEQayIEJABBACEFQQAhBgNAIAUgAyAGIgZqLQAAaiIHIQUgBkEBaiIIIQYgCEEgRw0ACwJAIAcNAEG87ABBABA7QcrKAEEwQbwMEP4FAAtBACADKQAANwC8hwJBACADQRhqKQAANwDUhwJBACADQRBqKQAANwDMhwJBACADQQhqKQAANwDEhwJBAEEBOgD8hwJB3IcCQRAQKCAEQdyHAkEQEIsGNgIAIAAgASACQdcYIAQQigYiBRD3BCEGIAUQICAEQRBqJAAgBgvcAgEEfyMAQRBrIgQkAAJAAkACQBAhDQACQCAADQAgAkUNAEF/IQUMAwsCQCAAQQBHQQAtAPyHAiIGQQJGcUUNAEF/IQUMAwtBfyEFIABFIAZBA0ZxDQIgAyABaiIGQQRqIgcQHyEFAkAgAEUNACAFIAAgARChBhoLAkAgAkUNACAFIAFqIAIgAxChBhoLQbyHAkHchwIgBSAGakEEIAUgBhDwBCAFIAcQ+AQhACAFECAgAA0BQQwhAgNAAkAgAiIAQdyHAmoiBS0AACICQf8BRg0AIABB3IcCaiACQQFqOgAAQQAhBQwECyAFQQA6AAAgAEF/aiECQQAhBSAADQAMAwsAC0HKygBBqAFBnjgQ/gUACyAEQYIdNgIAQbAbIAQQOwJAQQAtAPyHAkH/AUcNACAAIQUMAQtBAEH/AToA/IcCQQNBgh1BCRCEBRD+BCAAIQULIARBEGokACAFC+cGAgJ/AX4jAEGQAWsiAyQAAkAQIQ0AAkACQAJAAkAgAEF+ag4DAQIAAwsCQAJAAkBBAC0A/IcCQX9qDgMAAQIFCyADIAI2AkBBhuUAIANBwABqEDsCQCACQRdLDQAgA0GJJTYCAEGwGyADEDtBAC0A/IcCQf8BRg0FQQBB/wE6APyHAkEDQYklQQsQhAUQ/gQMBQsgA0H4AGpBEGogAUEQaikAADcDACADQfgAakEIaiABQQhqKQAANwMAIAMgASkAACIFNwN4AkAgBadBytGQ93xGDQAgA0GIxQA2AjBBsBsgA0EwahA7QQAtAPyHAkH/AUYNBUEAQf8BOgD8hwJBA0GIxQBBCRCEBRD+BAwFCwJAIAMoAnxBAkYNACADQfMmNgIgQbAbIANBIGoQO0EALQD8hwJB/wFGDQVBAEH/AToA/IcCQQNB8yZBCxCEBRD+BAwFC0EAQQBBvIcCQSBB3IcCQRAgA0GAAWpBEEG8hwIQwwNBAEIANwDchwJBAEIANwDshwJBAEIANwDkhwJBAEIANwD0hwJBAEECOgD8hwJBAEEBOgDchwJBAEECOgDshwICQEEAQSBBAEEAEIAFRQ0AIANBiCs2AhBBsBsgA0EQahA7QQAtAPyHAkH/AUYNBUEAQf8BOgD8hwJBA0GIK0EPEIQFEP4EDAULQfgqQQAQOwwECyADIAI2AnBBpeUAIANB8ABqEDsCQCACQSNLDQAgA0H8DjYCUEGwGyADQdAAahA7QQAtAPyHAkH/AUYNBEEAQf8BOgD8hwJBA0H8DkEOEIQFEP4EDAQLIAEgAhCCBQ0DQQAhAAJAAkAgAS0AAA0AQQAhAgNAIAIiBEEBaiIAQSBGDQIgACECIAEgAGotAABFDQALIARBHkshAAsgACEAIANB3NsANgJgQbAbIANB4ABqEDsCQEEALQD8hwJB/wFGDQBBAEH/AToA/IcCQQNB3NsAQQoQhAUQ/gQLIABFDQQLQQBBAzoA/IcCQQFBAEEAEIQFDAMLIAEgAhCCBQ0CQQQgASACQXxqEIQFDAILAkBBAC0A/IcCQf8BRg0AQQBBBDoA/IcCC0ECIAEgAhCEBQwBC0EAQf8BOgD8hwIQ/gRBAyABIAIQhAULIANBkAFqJAAPC0HKygBBwgFBnhEQ/gUAC4ECAQN/IwBBIGsiAiQAAkACQAJAIAFBBEsNACACQb4tNgIAQbAbIAIQO0G+LSEBQQAtAPyHAkH/AUcNAUF/IQEMAgtBvIcCQeyHAiAAIAFBfGoiAWpBBCAAIAEQ8QQhA0EMIQACQANAAkAgACIBQeyHAmoiAC0AACIEQf8BRg0AIAFB7IcCaiAEQQFqOgAADAILIABBADoAACABQX9qIQAgAQ0ACwsCQCADDQBBACEBDAILIAJBzB02AhBBsBsgAkEQahA7QcwdIQFBAC0A/IcCQf8BRw0AQX8hAQwBC0EAQf8BOgD8hwJBAyABQQkQhAUQ/gRBfyEBCyACQSBqJAAgAQs2AQF/AkAQIQ0AAkBBAC0A/IcCIgBBBEYNACAAQf8BRg0AEP4ECw8LQcrKAEHcAUHtMxD+BQALhAkBBH8jAEGAAmsiAyQAQQAoAoCIAiEEAkACQAJAAkACQCAAQX9qDgQAAgMBBAsgAyAEKAI4NgIQQd4ZIANBEGoQOyAEQYACOwEQIARBACgC4PsBIgBBgICACGo2AjQgBCAAQYCAgBBqNgIoIAQvAQZBAUYNAyADQZLZADYCBCADQQE2AgBBw+UAIAMQOyAEQQE7AQYgBEEDIARBBmpBAhCSBgwDCyAEQQAoAuD7ASIAQYCAgAhqNgI0IAQgAEGAgIAQajYCKAJAIAJFDQAgAyABLQAAIgA6AP8BIAJBf2ohBSABQQFqIQYCQAJAAkACQAJAAkACQAJAAkAgAEHwfmoOCgIDDAQFBgcBCAAICyABLQADQQxqIgQgBUsNCCAGIAQQjQYiBBCXBhogBBAgDAsLIAVFDQcgAS0AASABQQJqIAJBfmoQVgwKCyAELwEQIQIgBCABLQACQQh0IAEtAAEiAHI7ARACQCAAQQFxRQ0AIAQoAmQNACAEQYAQENkFNgJkCwJAIAQtABBBAnFFDQAgAkECcQ0AIAQQuAU2AhgLIARBACgC4PsBQYCAgAhqNgIUIAMgBC8BEDYCYEGvCyADQeAAahA7DAkLIAMgADoA0AEgBC8BBkEBRw0IAkAgAEHlAGpB/wFxQf0BSw0AIAMgADYCcEGfCiADQfAAahA7CyADQdABakEBQQBBABCABQ0IIAQoAgwiAEUNCCAEQQAoApCRAiAAajYCMAwICyADQdABahBsGkEAKAKAiAIiBC8BBkEBRw0HAkAgAy0A/wEiAEHlAGpB/wFxQf0BSw0AIAMgADYCgAFBnwogA0GAAWoQOwsgA0H/AWpBASADQdABakEgEIAFDQcgBCgCDCIARQ0HIARBACgCkJECIABqNgIwDAcLIAAgASAGIAUQogYoAgAQahCFBQwGCyAAIAEgBiAFEKIGIAUQaxCFBQwFC0GWAUEAQQAQaxCFBQwECyADIAA2AlBBhwsgA0HQAGoQOyADQf8BOgDQAUEAKAKAiAIiBC8BBkEBRw0DIANB/wE2AkBBnwogA0HAAGoQOyADQdABakEBQQBBABCABQ0DIAQoAgwiAEUNAyAEQQAoApCRAiAAajYCMAwDCyADIAI2AjBBr8MAIANBMGoQOyADQf8BOgDQAUEAKAKAiAIiBC8BBkEBRw0CIANB/wE2AiBBnwogA0EgahA7IANB0AFqQQFBAEEAEIAFDQIgBCgCDCIARQ0CIARBACgCkJECIABqNgIwDAILAkAgBCgCOCIARQ0AIAMgADYCoAFBoz4gA0GgAWoQOwsgBCAEQRFqLQAAQQh0OwEQIAQvAQZBAkYNASADQY/ZADYClAEgA0ECNgKQAUHD5QAgA0GQAWoQOyAEQQI7AQYgBEEDIARBBmpBAhCSBgwBCyADIAEgAhDnAjYCwAFB5BggA0HAAWoQOyAELwEGQQJGDQAgA0GP2QA2ArQBIANBAjYCsAFBw+UAIANBsAFqEDsgBEECOwEGIARBAyAEQQZqQQIQkgYLIANBgAJqJAAL6wEBAX8jAEEwayICJAACQAJAIAENACACIAA6AC5BACgCgIgCIgEvAQZBAUcNAQJAIABB5QBqQf8BcUH9AUsNACACIABB/wFxNgIAQZ8KIAIQOwsgAkEuakEBQQBBABCABQ0BIAEoAgwiAEUNASABQQAoApCRAiAAajYCMAwBCyACIAA2AiBBhwogAkEgahA7IAJB/wE6AC9BACgCgIgCIgAvAQZBAUcNACACQf8BNgIQQZ8KIAJBEGoQOyACQS9qQQFBAEEAEIAFDQAgACgCDCIBRQ0AIABBACgCkJECIAFqNgIwCyACQTBqJAALjwUBBn8jAEEQayIBJAACQAJAIAAoAgxFDQBBACgCkJECIAAoAjBrQQBODQELAkAgAEEUakGAgIAIEIAGRQ0AIAAtABBFDQBBvT5BABA7IAAgAEERai0AAEEIdDsBEAsCQCAALQAQQQJxRQ0AQQAoArSIAiAAKAIcRg0AIAEgACgCGDYCCAJAIAAoAiANACAAQYACEB82AiALIAAoAiBBgAIgAUEIahC5BSECQQAoArSIAiEDIAJFDQAgASgCCCEEIAAoAiAhBSABQZoBOgANQQAoAoCIAiIGLwEGQQFHDQAgAUENakEBIAUgAhCABQ0AAkAgBigCDCICRQ0AIAZBACgCkJECIAJqNgIwCyAAIAEoAgg2AhggAyAERw0AIABBACgCtIgCNgIcCwJAIAAoAmRFDQAgACgCZBDXBSICRQ0AIAIhAgNAIAIhAgJAIAAtABBBAXFFDQAgAi0AAiEFIAFBmQE6AA5BACgCgIgCIgMvAQZBAUcNAiABQQ5qQQEgAiAFQQxqEIAFDQIgAygCDCICRQ0AIANBACgCkJECIAJqNgIwCyAAKAJkENgFIAAoAmQQ1wUiAyECIAMNAAsLAkAgAEE0akGAgIACEIAGRQ0AIAFBkgE6AA9BACgCgIgCIgIvAQZBAUcNACABQZIBNgIAQZ8KIAEQOyABQQ9qQQFBAEEAEIAFDQAgAigCDCIDRQ0AIAJBACgCkJECIANqNgIwCwJAIABBJGpBgIAgEIAGRQ0AQZsEIQICQBBBRQ0AIAAvAQZBAnRBgJkBaigCACECCyACEB0LAkAgAEEoakGAgCAQgAZFDQAgABCHBQsgAEEsaiAAKAIIEP8FGiABQRBqJAAPC0GgE0EAEDsQNAALtgIBBX8jAEEwayIBJAAgAEEGaiECAkACQAJAIAAvAQZBfmoOAwIAAQALIAFB3tcANgIkIAFBBDYCIEHD5QAgAUEgahA7IABBBDsBBiAAQQMgAkECEJIGCxCDBQsCQCAAKAI4RQ0AEEFFDQAgAC0AYiEDIAAoAjghBCAALwFgIQUgASAAKAI8NgIcIAEgBTYCGCABIAQ2AhQgAUGaFkHmFSADGzYCEEH8GCABQRBqEDsgACgCOEEAIAAvAWAiA2sgAyAALQBiGyAAKAI8IABBwABqEP8EDQACQCACLwEAQQNGDQAgAUHh1wA2AgQgAUEDNgIAQcPlACABEDsgAEEDOwEGIABBAyACQQIQkgYLIABBACgC4PsBIgJBgICACGo2AjQgACACQYCAgBBqNgIoCyABQTBqJAAL+wIBAn8jAEEQayICJAACQAJAAkACQAJAAkACQAJAAkAgAS8BDiIDQf9+ag4GAgMHBwcBAAsgA0GAXWoOBAMFBgQGCyAAIAFBEGogAS0ADEEBEIkFDAYLIAAQhwUMBQsCQAJAIAAvAQZBfmoOAwYAAQALIAJB3tcANgIEIAJBBDYCAEHD5QAgAhA7IABBBDsBBiAAQQMgAEEGakECEJIGCxCDBQwECyABIAAoAjgQ3QUaDAMLIAFB9dYAEN0FGgwCCwJAAkAgACgCPCIADQBBACEADAELIABBBkEAIABBo+IAEI8GG2ohAAsgASAAEN0FGgwBCyAAIAFBlJkBEOAFQX5xQYABRw0AAkAgACgCCEHnB0sNACAAQegHNgIICwJAIAAoAghBgbiZKUkNACAAQYC4mSk2AggLIAAoAgwiAUUNAAJAIAEgACgCCEEDbCIDTw0AIAAgAzYCDAsgACgCDCIBRQ0AIABBACgCkJECIAFqNgIwCyACQRBqJAAL8wQBCX8jAEEwayIEJAACQAJAIAINAEG/LkEAEDsgACgCOBAgIAAoAjwQICAAQgA3AjggAEHQADsBYCAAQcAAakIANwIAIABByABqQgA3AgAgAEHQAGpCADcCACAAQdgAakIANwIAAkAgA0UNAEHTHEEAELcDGgsgABCHBQwBCwJAAkAgAkEBahAfIAEgAhChBiIFENAGQcYASQ0AAkACQCAFQbDiABCPBiIGRQ0AQbsDIQdBBiEIDAELIAVBquIAEI8GRQ0BQdAAIQdBBSEICyAHIQkgBSAIaiIIQcAAEM0GIQcgCEE6EM0GIQogB0E6EM0GIQsgB0EvEM0GIQwgB0UNACAMRQ0AAkAgC0UNACAHIAtPDQEgCyAMTw0BCwJAAkBBACAKIAogB0sbIgoNACAIIQgMAQsgCEHG2QAQjwZFDQEgCkEBaiEICyAHIAgiCGtBwABHDQAgB0EAOgAAIARBEGogCBCCBkEgRw0AIAkhCAJAIAtFDQAgC0EAOgAAIAtBAWoQhAYiCyEIIAtBgIB8akGCgHxJDQELIAxBADoAACAHQQFqEIwGIQcgDEEvOgAAIAwQjAYhCyAAEIoFIAAgCzYCPCAAIAc2AjggACAGIAdB/AwQjgYiC3I6AGIgAEG7AyAIIgcgCxsgByAHQdAARhs7AWAgACAEKQMQNwJAIABByABqIAQpAxg3AgAgAEHQAGogBEEgaikDADcCACAAQdgAaiAEQShqKQMANwIAAkAgA0UNAEHTHCAFIAEgAhChBhC3AxoLIAAQhwUMAQsgBCABNgIAQc0bIAQQO0EAECBBABAgCyAFECALIARBMGokAAtLACAAKAI4ECAgACgCPBAgIABCADcCOCAAQdAAOwFgIABBwABqQgA3AgAgAEHIAGpCADcCACAAQdAAakIANwIAIABB2ABqQgA3AgALQwECf0GgmQEQ5gUiAEGIJzYCCCAAQQI7AQYCQEHTHBC2AyIBRQ0AIAAgASABENAGQQAQiQUgARAgC0EAIAA2AoCIAgukAQEEfyMAQRBrIgQkACABENAGIgVBA2oiBhAfIgcgADoAASAHQZgBOgAAIAdBAmogASAFEKEGGkGcfyEBAkBBACgCgIgCIgAvAQZBAUcNACAEQZgBNgIAQZ8KIAQQOyAHIAYgAiADEIAFIgUhASAFDQACQCAAKAIMIgENAEEAIQEMAQsgAEEAKAKQkQIgAWo2AjBBACEBCyAHECAgBEEQaiQAIAELDwBBACgCgIgCLwEGQQFGC5MCAQh/IwBBEGsiASQAAkBBACgCgIgCIgJFDQAgAkERai0AAEEBcUUNACACLwEGQQFHDQAgARC4BTYCCAJAIAIoAiANACACQYACEB82AiALA0AgAigCIEGAAiABQQhqELkFIQNBACgCtIgCIQRBAiEFAkAgA0UNACABKAIIIQYgAigCICEHIAFBmwE6AA8CQAJAQQAoAoCIAiIILwEGQQFGDQBBACEFDAELIAFBmwE2AgBBnwogARA7QQAhBSABQQ9qQQEgByADEIAFDQACQCAIKAIMIgVFDQAgCEEAKAKQkQIgBWo2AjALQQEhBQsgBCAGRkEBdEECIAUbIQULIAVFDQALQZLAAEEAEDsLIAFBEGokAAtQAQJ/IwBBEGsiASQAQQAhAgJAIAAvAQ5BgSNHDQAgAUEAKAKAiAIoAjg2AgAgAEHN6wAgARCKBiICEN0FGiACECBBASECCyABQRBqJAAgAgsNACAAKAIEENAGQQ1qC2sCA38BfiAAKAIEENAGQQ1qEB8hAQJAIAAoAhAiAkUNACACQQAgAi0ABCIDa0EMbGpBZGopAwAhBCABIAM6AAwgASAENwMACyABIAAoAgg2AgggACgCBCEAIAFBDWogACAAENAGEKEGGiABC4MDAgZ/AX4CQAJAIAAoAqACIgFFDQAgAEEYaiECIAEhAQNAAkAgAiABIgMoAgQQ0AZBDWoiBBDTBSIBRQ0AIAFBAUYNAiAAQQA2AqACIAIQ1QUaDAILIAMoAgQQ0AZBDWoQHyEBAkAgAygCECIFRQ0AIAVBACAFLQAEIgZrQQxsakFkaikDACEHIAEgBjoADCABIAc3AwALIAEgAygCCDYCCCADKAIEIQUgAUENaiAFIAUQ0AYQoQYaIAIgASAEENQFDQIgARAgIAMoAgAiASEDIAEhBQJAIAFFDQADQAJAIAMiAS0ADEEBcQ0AIAEhBQwCCyABKAIAIgEhAyABIQUgAQ0ACwsgACAFIgE2AqACAkAgAQ0AIAIQ1QUaCyAAKAKgAiIDIQEgAw0ACwsCQCAAQRBqQaDoOxCABkUNACAAEJMFCwJAIABBFGpB0IYDEIAGRQ0AIAAtAAhFDQAgAEEAOgAIIABBA0EAQQAQkgYLDwtB4twAQdzIAEG2AUGwFhCDBgALnQcCCX8BfiMAQTBrIgEkAAJAAkAgAC0ABkUNAAJAAkAgAC0ACQ0AIABBAToACSAAKAIMIgJFDQEgAiECA0ACQCACIgIoAhANAEIAIQoCQAJAAkAgAi0ADQ4DAwEAAgsgACkDqAIhCgwBCxD2BSEKCyAKIgpQDQAgChCfBSIDRQ0AIAMtABBFDQBBACEEIAItAA4hBQNAIAUhBQJAAkAgAyAEIgZBDGxqIgRBJGoiBygCACACKAIIRg0AQQQhBCAFIQUMAQsgBUF/aiEIAkACQCAFRQ0AQQAhBAwBCwJAIARBKWoiBS0AAEEBcQ0AIAIoAhAiCSAHRg0AAkAgCUUNACAJIAktAAVB/gFxOgAFCyAFIAUtAABBAXI6AAAgAUEraiAHQQAgBEEoaiIFLQAAa0EMbGpBZGopAwAQiQYgAigCBCEEIAEgBS0AADYCGCABIAQ2AhAgASABQStqNgIUQYHBACABQRBqEDsgAiAHNgIQIABBAToACCACEJ4FC0ECIQQLIAghBQsgBSEFAkAgBA4FAAICAgACCyAGQQFqIgYhBCAFIQUgBiADLQAQSQ0ACwsgAigCACIFIQIgBQ0ADAILAAtBwT9B3MgAQe4AQeo6EIMGAAsCQCAAKAIMIgJFDQAgAiECA0ACQCACIgYoAhANAAJAIAYtAA1FDQAgAC0ACg0BC0GQiAIhAgJAA0ACQCACKAIAIgINAEEMIQMMAgtBASEFAkACQCACLQAQQQFLDQBBDyEDDAELA0ACQAJAIAIgBSIEQQxsaiIHQSRqIggoAgAgBigCCEYNAEEBIQVBACEDDAELQQEhBUEAIQMgB0EpaiIJLQAAQQFxDQACQAJAIAYoAhAiBSAIRw0AQQAhBQwBCwJAIAVFDQAgBSAFLQAFQf4BcToABQsgCSAJLQAAQQFyOgAAIAFBK2ogCEEAIAdBKGoiBS0AAGtBDGxqQWRqKQMAEIkGIAYoAgQhAyABIAUtAAA2AgggASADNgIAIAEgAUErajYCBEGBwQAgARA7IAYgCDYCECAAQQE6AAggBhCeBUEAIQULQRIhAwsgAyEDIAVFDQEgBEEBaiIDIQUgAyACLQAQSQ0AC0EPIQMLIAIhAiADIgUhAyAFQQ9GDQALCyADQXRqDgcAAgICAgIAAgsgBigCACIFIQIgBQ0ACwsgAC0ACUUNASAAQQA6AAkLIAFBMGokAA8LQcI/QdzIAEGEAUHqOhCDBgAL2gUCBn8BfiMAQcAAayICJAACQCAALQAJDQACQAJAAkACQAJAIAEvAQ5B/35qDgQBAwIAAwsgACgCDCIDRQ0DIAMhAwNAAkAgAyIDKAIQIgRFDQAgBCAELQAFQf4BcToABSACIAMoAgQ2AgBB0xogAhA7IANBADYCECAAQQE6AAggAxCeBQsgAygCACIEIQMgBA0ADAQLAAsCQAJAIAAoAgwiAw0AIAMhBQwBCyABQRlqIQYgAS0ADEFwaiEHIAMhBANAAkAgBCIDKAIEIgQgBiAHELsGDQAgBCAHai0AAA0AIAMhBQwCCyADKAIAIgMhBCADIQUgAw0ACwsgBSIDRQ0CAkAgASkDECIIQgBSDQAgAygCECIERQ0DIAQgBC0ABUH+AXE6AAUgAiADKAIENgIQQdMaIAJBEGoQOyADQQA2AhAgAEEBOgAIIAMQngUMAwsCQAJAIAgQnwUiBw0AQQAhBAwBC0EAIQQgBy0AECABLQAYIgVNDQAgByAFQQxsakEkaiEECyAEIgRFDQIgAygCECIHIARGDQICQCAHRQ0AIAcgBy0ABUH+AXE6AAULIAQgBC0ABUEBcjoABSACQTtqIARBACAELQAEa0EMbGpBZGopAwAQiQYgAygCBCEHIAIgBC0ABDYCKCACIAc2AiAgAiACQTtqNgIkQYHBACACQSBqEDsgAyAENgIQIABBAToACCADEJ4FDAILIABBGGoiBSABEM4FDQECQAJAIAAoAgwiAw0AIAMhBwwBCyADIQQDQAJAIAQiAy0ADEEBcQ0AIAMhBwwCCyADKAIAIgMhBCADIQcgAw0ACwsgACAHIgM2AqACIAMNASAFENUFGgwBCyAAQQE6AAcgAEEMaiEEAkADQCAEKAIAIgNFDQEgAyEEIAMoAhANAAsgAEEAOgAHCyAAIAFBxJkBEOAFGgsgAkHAAGokAA8LQcE/QdzIAEHcAUHtExCDBgALLAEBf0EAQdCZARDmBSIANgKEiAIgAEEBOgAGIABBACgC4PsBQaDoO2o2AhAL2QEBBH8jAEEQayIBJAACQAJAQQAoAoSIAiICLQAJDQAgAkEBOgAJAkAgAigCDCIDRQ0AIAMhAwNAAkAgAyIEKAIQIgNFDQAgA0EAIAMtAARrQQxsakFcaiAARw0AIAMgAy0ABUH+AXE6AAUgASAEKAIENgIAQdMaIAEQOyAEQQA2AhAgAkEBOgAIIAQQngULIAQoAgAiBCEDIAQNAAsLIAItAAlFDQEgAkEAOgAJIAFBEGokAA8LQcE/QdzIAEGFAkHiPBCDBgALQcI/QdzIAEGLAkHiPBCDBgALLwEBfwJAQQAoAoSIAiICDQBB3MgAQZkCQYgWEP4FAAsgAiAAOgAKIAIgATcDqAILugMBBn8CQAJAAkACQAJAQQAoAoSIAiICRQ0AIAAQ0AYhAwJAIAIoAgwiBEUNACAEIQUCQANAAkAgBSIEKAIEIgUgACADELsGDQAgBSADai0AAA0AIAQhBgwCCyAEKAIAIgQhBSAEIQYgBA0ACwsgBg0CCyACLQAJDQICQCACKAKgAkUNACACQQA2AqACIAJBGGoQ1QUaCyACQQxqIQRBFBAfIgcgATYCCCAHIAA2AgQCQCAAQdsAEM0GIgVFDQBBAiEDAkACQCAFQQFqIgFBwdkAEI8GDQBBASEDIAEhBiABQbzZABCPBkUNAQsgByADOgANIAVBBWohBgsgBiEFIActAA1FDQAgByAFEIQGOgAOCyAEKAIAIgVFDQMgACAFKAIEEM8GQQBIDQMgBSEFA0ACQCAFIgMoAgAiBA0AIAQhBiADIQMMBgsgBCEFIAQhBiADIQMgACAEKAIEEM8GQX9KDQAMBQsAC0HcyABBoQJBwsQAEP4FAAtB3MgAQaQCQcLEABD+BQALQcE/QdzIAEGPAkHWDhCDBgALIAUhBiAEIQMLIAcgBjYCACADIAc2AgAgAkEBOgAIIAcL1QIBBH8jAEEQayIAJAACQAJAAkBBACgChIgCIgEtAAkNAAJAIAEoAqACRQ0AIAFBADYCoAIgAUEYahDVBRoLIAEtAAkNASABQQE6AAkCQCABKAIMIgJFDQAgAiECA0ACQCACIgIoAhAiA0UNACADIAMtAAVB/gFxOgAFIAAgAigCBDYCAEHTGiAAEDsgAkEANgIQIAFBAToACCACEJ4FCyACKAIAIgMhAiADDQALCyABLQAJRQ0CIAFBADoACQJAIAEoAgwiAkUNACACIQIDQAJAIAIiAigCECIDRQ0AIAMgAy0ABUH+AXE6AAULIAEgAigCADYCDCACQQA2AgQgAhAgIAEoAgwiAyECIAMNAAsLIAFBAToACCAAQRBqJAAPC0HBP0HcyABBjwJB1g4QgwYAC0HBP0HcyABB7AJBzSkQgwYAC0HCP0HcyABB7wJBzSkQgwYACwwAQQAoAoSIAhCTBQvQAQECfyMAQcAAayIDJAACQAJAAkACQAJAIABBf2oOIAABAgQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQDBAsgAyABQRRqNgIQQbccIANBEGoQOwwDCyADIAFBFGo2AiBBohwgA0EgahA7DAILIAMgAUEUajYCMEGIGyADQTBqEDsMAQsgAS0ABCEAIAIvAQQhBCADIAItAAc2AgwgAyAENgIIIAMgADYCBCADIAFBACAAa0EMbGpBcGo2AgBB5NAAIAMQOwsgA0HAAGokAAsxAQJ/QQwQHyECQQAoAoiIAiEDIAIgATYCCCACIAM2AgAgAiAANgIEQQAgAjYCiIgCC5UBAQJ/AkACQEEALQCMiAJFDQBBAEEAOgCMiAIgACABIAIQmwUCQEEAKAKIiAIiA0UNACADIQMDQCADIgMoAgggACABIAIgAygCBBEFACADKAIAIgQhAyAEDQALC0EALQCMiAINAUEAQQE6AIyIAg8LQYrbAEH0ygBB4wBB+BAQgwYAC0H/3ABB9MoAQekAQfgQEIMGAAucAQEDfwJAAkBBAC0AjIgCDQBBAEEBOgCMiAIgACgCECEBQQBBADoAjIgCAkBBACgCiIgCIgJFDQAgAiECA0AgAiICKAIIQcAAIAEgACACKAIEEQUAIAIoAgAiAyECIAMNAAsLQQAtAIyIAg0BQQBBADoAjIgCDwtB/9wAQfTKAEHtAEHpPxCDBgALQf/cAEH0ygBB6QBB+BAQgwYACzABA39BkIgCIQEDQAJAIAEoAgAiAg0AQQAPCyACIQEgAiEDIAIpAwggAFINAAsgAwtZAQR/AkAgAC0AECICDQBBAA8LIABBJGohA0EAIQQDQAJAIAMgBCIEQQxsaigCACABRw0AIAAgBEEMbGpBJGpBACAAGw8LIARBAWoiBSEEIAUgAkcNAAtBAAtiAgJ/AX4gA0EQahAfIgRBAToAAyAAQQAgAC0ABCIFa0EMbGpBZGopAwAhBiAEIAE7AQ4gBCAFOgANIAQgBjcCBCAEIAM6AAwgBEEQaiACIAMQoQYaIAQQ3wUhAyAEECAgAwveAgECfwJAAkACQEEALQCMiAINAEEAQQE6AIyIAgJAQZSIAkHgpxIQgAZFDQACQEEAKAKQiAIiAEUNACAAIQADQEEAKALg+wEgACIAKAIca0EASA0BQQAgACgCADYCkIgCIAAQowVBACgCkIgCIgEhACABDQALC0EAKAKQiAIiAEUNACAAIQADQCAAIgEoAgAiAEUNAQJAQQAoAuD7ASAAKAIca0EASA0AIAEgACgCADYCACAAEKMFCyABKAIAIgEhACABDQALC0EALQCMiAJFDQFBAEEAOgCMiAICQEEAKAKIiAIiAEUNACAAIQADQCAAIgAoAghBMEEAQQAgACgCBBEFACAAKAIAIgEhACABDQALC0EALQCMiAINAkEAQQA6AIyIAg8LQf/cAEH0ygBBlAJBnhYQgwYAC0GK2wBB9MoAQeMAQfgQEIMGAAtB/9wAQfTKAEHpAEH4EBCDBgALnwIBA38jAEEQayIBJAACQAJAAkBBAC0AjIgCRQ0AQQBBADoAjIgCIAAQlgVBAC0AjIgCDQEgASAAQRRqNgIAQQBBADoAjIgCQaIcIAEQOwJAQQAoAoiIAiICRQ0AIAIhAgNAIAIiAigCCEECIABBACACKAIEEQUAIAIoAgAiAyECIAMNAAsLQQAtAIyIAg0CQQBBAToAjIgCAkAgACgCBCICRQ0AIAIhAgNAIAAgAiICKAIAIgM2AgQCQCACLQAHQQVJDQAgAigCDBAgCyACECAgAyECIAMNAAsLIAAQICABQRBqJAAPC0GK2wBB9MoAQbABQf04EIMGAAtB/9wAQfTKAEGyAUH9OBCDBgALQf/cAEH0ygBB6QBB+BAQgwYAC58OAgp/AX4jAEEQayIBJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAQQAtAIyIAg0AQQBBAToAjIgCAkAgAC0AAyICQQRxRQ0AQQBBADoAjIgCAkBBACgCiIgCIgNFDQAgAyEDA0AgAyIDKAIIQRJBACAAIAMoAgQRBQAgAygCACIEIQMgBA0ACwtBAC0AjIgCRQ0IQf/cAEH0ygBB6QBB+BAQgwYACyAAKQIEIQtBkIgCIQQCQANAAkAgBCgCACIDDQBBACEFDAILIAMhBCADIQUgAykDCCALUg0ACwtBACEEAkAgBSIDRQ0AIAMgAC0ADUE/cSIEQQxsakEkakEAIAQgAy0AEEkbIQQLIAQhBQJAIAJBAXFFDQBBECEEIAUhAiADIQMMBwsgAC0ADQ0EIAAvAQ4NBCADIQQCQCADDQAgABClBSEECwJAIAQiAy8BEiIFIAAvARAiBEYNAAJAIAVBD3EgBEEPcU0NAEEDIAMgABCdBUEAKAKQiAIiBCADRg0DIAQhBANAIAQiBUUNBSAFKAIAIgIhBCACIANHDQALIAUgAygCADYCAAwECyADIAQ7ARILIAMhAwwDC0H/3ABB9MoAQb4CQdUTEIMGAAtBACADKAIANgKQiAILIAMQowUgABClBSEDCyADIgNBACgC4PsBQYCJ+gBqNgIcIANBJGohBCADIQMMAQsgBSEEIAMhAwsgAyEGAkACQCAEIgUNAEEQIQRBACECDAELAkACQCAALQADQQFxDQAgAC0ADUEwSw0AIAAuAQ5Bf0oNAAJAIABBD2otAAAiAyADQf8AcSIEQX9qIAYtABEiAyADQf8BRhtBAWoiA2tB/wBxIgJFDQACQCADIARrQfwAcUE8Tw0AQRMhAwwDC0ETIQMgAkEFSQ0CCyAGIAQ6ABELQRAhAwsgAyEHAkACQAJAIAAtAAwiCEEESQ0AIAAvAQ5BA0cNACAALwEQIgNBgOADcUGAIEcNAgJAAkAgBUEAIAUtAAQiCWtBDGxqQWBqKAIAIgRFDQAgA0H/H3EhAiAEIQMDQAJAIAIgAyIDLwEERw0AIAMtAAZBP3EgCUcNACADIQMMAwsgAygCACIEIQMgBA0ACwtBACEDCyADIgJFDQIgAiwABiIDQQBIDQIgAiADQYABcjoABkEALQCMiAJFDQZBAEEAOgCMiAICQEEAKAKIiAIiA0UNACADIQMDQCADIgMoAghBISAFIAIgAygCBBEFACADKAIAIgQhAyAEDQALC0EALQCMiAJFDQFB/9wAQfTKAEHpAEH4EBCDBgALIAAvAQ4iA0GA4ANxQYAgRw0BAkACQCAFQQAgBS0ABCIJa0EMbGpBYGooAgAiBEUNACADQf8fcSECIAQhAwNAAkAgAiADIgMvAQRHDQAgAy0ABkE/cSAJRw0AIAMhAwwDCyADKAIAIgQhAyAEDQALC0EAIQMLIAMiAkUNAQJAAkAgAi0AByIDIAhHDQAgAyEEIAJBDGohCSAAQRBqIQoCQAJAIANBBU8NACAJIQkMAQsgCSgCACEJCyAKIAkgBBC7Bg0AQQEhBAwBC0EAIQQLIAQhBAJAIAhBBUkNACADIAhGDQACQCADQQVJDQAgAigCDBAgCyACIAAtAAwQHzYCDAsgAiAALQAMIgM6AAcgAkEMaiEJAkACQCADQQVPDQAgCSEJDAELIAkoAgAhCQsgCSAAQRBqIAMQoQYaIAQNAUEALQCMiAJFDQZBAEEAOgCMiAIgBS0ABCEDIAIvAQQhBCABIAItAAc2AgwgASAENgIIIAEgAzYCBCABIAVBACADa0EMbGpBcGo2AgBB5NAAIAEQOwJAQQAoAoiIAiIDRQ0AIAMhAwNAIAMiAygCCEEgIAUgAiADKAIEEQUAIAMoAgAiBCEDIAQNAAsLQQAtAIyIAg0HC0EAQQE6AIyIAgsgByEEIAUhAgsgBiEDCyADIQYgBCEFQQAtAIyIAiEDAkAgAiICRQ0AIANBAXFFDQVBAEEAOgCMiAIgBSACIAAQmwUCQEEAKAKIiAIiA0UNACADIQMDQCADIgMoAgggBSACIAAgAygCBBEFACADKAIAIgQhAyAEDQALC0EALQCMiAJFDQFB/9wAQfTKAEHpAEH4EBCDBgALIANBAXFFDQVBAEEAOgCMiAICQEEAKAKIiAIiA0UNACADIQMDQCADIgMoAghBESAGIAAgAygCBBEFACADKAIAIgQhAyAEDQALC0EALQCMiAINBgtBAEEAOgCMiAIgAUEQaiQADwtBitsAQfTKAEHjAEH4EBCDBgALQYrbAEH0ygBB4wBB+BAQgwYAC0H/3ABB9MoAQekAQfgQEIMGAAtBitsAQfTKAEHjAEH4EBCDBgALQYrbAEH0ygBB4wBB+BAQgwYAC0H/3ABB9MoAQekAQfgQEIMGAAuTBAIIfwF+IwBBEGsiASQAIAAtAAwiAkECdiIDQQxsQShqEB8iBCADOgAQIAQgACkCBCIJNwMIQQAoAuD7ASEFIARB/wE6ABEgBCAFQYCJ+gBqNgIcIARBFGoiBiAJEIkGIAQgACgCEDsBEgJAIAJBBEkNACAAQRBqIQcgA0EBIANBAUsbIQhBACEDA0ACQAJAIAMiAw0AQQAhAgwBCyAHIANBAnRqKAIAIQILIAQgA0EMbGoiBUEoaiADOgAAIAVBJGogAjYCACADQQFqIgIhAyACIAhHDQALCwJAAkBBACgCkIgCIgNFDQAgBEEIaiICKQMAEPYFUQ0AIAIgA0EIakEIELsGQQBIDQBBkIgCIQUDQCAFKAIAIgNFDQICQCADKAIAIghFDQAgAikDABD2BVENACADIQUgAiAIQQhqQQgQuwZBf0oNAQsLIAQgAygCADYCACADIAQ2AgAMAQsgBEEAKAKQiAI2AgBBACAENgKQiAILAkACQEEALQCMiAJFDQAgASAGNgIAQQBBADoAjIgCQbccIAEQOwJAQQAoAoiIAiIDRQ0AIAMhAwNAIAMiAygCCEEBIAQgACADKAIEEQUAIAMoAgAiAiEDIAINAAsLQQAtAIyIAg0BQQBBAToAjIgCIAFBEGokACAEDwtBitsAQfTKAEHjAEH4EBCDBgALQf/cAEH0ygBB6QBB+BAQgwYACwIAC5kCAQV/IwBBIGsiAiQAAkACQCABLwEOIgNBgH9qIgRBBEsNAEEBIAR0QRNxRQ0AIAJBAXIgAUEQaiIFIAEtAAwiBEEPIARBD0kbIgYQoQYhACACQTo6AAAgBiACckEBakEAOgAAIAAQ0AYiBkEOSg0BAkACQAJAIANBgH9qDgUAAgQEAQQLIAZBAWohBCACIAQgBCACQQBBABC7BSIDQQAgA0EAShsiA2oiBRAfIAAgBhChBiIAaiADELsFGiABLQANIAEvAQ4gACAFEJoGGiAAECAMAwsgAkEAQQAQvgUaDAILIAIgBSAGakEBaiAGQX9zIARqIgFBACABQQBKGxC+BRoMAQsgACABQeCZARDgBRoLIAJBIGokAAsKAEHomQEQ5gUaCwUAEDQACwIAC7kBAQJ/IwBBEGsiAiQAAkACQAJAAkACQAJAAkAgAS8BDiIDQYBdag4HAQMFBQMCBAALAkACQAJAAkAgA0H/fmoOBwECCAgICAMACyADDQcQ6gUMCAtB/AAQHAwHCxA0AAsgASgCEBCpBQwFCyABEO8FEN0FGgwECyABEPEFEN0FGgwDCyABEPAFENwFGgwCCyACEDU3AwhBACABLwEOIAJBCGpBCBCaBhoMAQsgARDeBRoLIAJBEGokAAsKAEH4mQEQ5gUaCycBAX8QrgVBAEEANgKYiAICQCAAEK8FIgENAEEAIAA2ApiIAgsgAQuXAQECfyMAQSBrIgAkAAJAAkBBAC0AsIgCDQBBAEEBOgCwiAIQIQ0BAkBB8O4AEK8FIgENAEEAQfDuADYCnIgCIABB8O4ALwEMNgIAIABB8O4AKAIINgIEQeMXIAAQOwwBCyAAIAE2AhQgAEHw7gA2AhBB/cEAIABBEGoQOwsgAEEgaiQADwtB1+sAQcDLAEEhQeESEIMGAAurBQEKfwJAIAANAEHQDw8LQdEPIQECQCAAQQNxDQBB0g8hASAAKAIAQcSGmboERw0AQdMPIQEgACgCBEGKttLVfEcNAEHUDyEBIAAoAggiAkH//wdLDQBB3g8hASAALwEMIgNBGGxB8ABqIgQgAksNAEHfDyEBIABB2ABqIgUgA0EYbGoiBi8BEEH//wNHDQBB4A8hASAGLwESQf//A0cNAEEAIQZBACEBA0AgCCEHIAYhCAJAAkAgACABIgFBAXRqQRhqLwEAIgYgA00NAEEAIQZB4Q8hCQwBCwJAIAEgBSAGQRhsaiIKLwEQQQt2TQ0AQQAhBkHiDyEJDAELAkAgBkUNAEEAIQZB4w8hCSABIApBeGovAQBBC3ZNDQELQQEhBiAHIQkLIAkhByAIIQkCQCAGRQ0AIAFBHksiCSEGIAchCCABQQFqIgohASAJIQkgCkEgRw0BCwsCQCAJQQFxDQAgBw8LAkAgAw0AQQAPCyAHIQlBACEGA0AgCSEIAkACQCAFIAYiBkEYbGoiARDQBiIJQQ9NDQBBACEBQdYPIQkMAQsgASAJEPUFIQkCQCABLwEQIgcgCSAJQRB2c0H//wNxRg0AQQAhAUHXDyEJDAELAkAgBkUNACABQXhqLwEAIAdNDQBBACEBQdgPIQkMAQsCQAJAIAEvARIiB0ECcQ0AQQAhAUHZDyEJIAdBBEkNAQwCCwJAIAEoAhQiASAETw0AQQAhAUHaDyEJDAILAkAgASACSQ0AQQAhAUHbDyEJDAILAkAgASAHQQJ2aiIHIAJJDQBBACEBQdwPIQkMAgtBACEBQd0PIQkgACAHai0AAA0BC0EBIQEgCCEJCyAJIQkCQCABRQ0AIAkhCSAGQQFqIgghBkEAIQEgCCADRg0CDAELCyAJIQELIAEL/AEBCn8QrgVBACEBAkADQCABIQIgBCEDQQAhBAJAIABFDQBBACEEIAJBAnRBmIgCaigCACIBRQ0AQQAhBCAAENAGIgVBD0sNAEEAIQQgASAAIAUQ9QUiBkEQdiAGcyIHQQp2QT5xakEYai8BACIGIAEvAQwiCE8NACABQdgAaiEJIAYhBAJAA0AgCSAEIgpBGGxqIgEvARAiBCAHQf//A3EiBksNAQJAIAQgBkcNACABIQQgASAAIAUQuwZFDQMLIApBAWoiASEEIAEgCEcNAAsLQQAhBAsgBCIEIAMgBBshASAEDQEgASEEIAJBAWohASACRQ0AC0EADwsgAQuhAgEIfxCuBSAAENAGIQJBACEDIAEhAQJAA0AgASEEIAYhBQJAAkAgAyIHQQJ0QZiIAmooAgAiAUUNAEEAIQYCQCAERQ0AIAQgAWtBqH9qQRhtIgZBfyAGIAEvAQxJGyIGQQBIDQEgBkEBaiEGC0EAIQggBiIDIQYCQCADIAEvAQwiCUgNACAIIQZBACEBIAUhAwwCCwJAA0AgACABIAYiBkEYbGpB2ABqIgMgAhC7BkUNASAGQQFqIgMhBiADIAlHDQALQQAhBkEAIQEgBSEDDAILIAQhBkEBIQEgAyEDDAELIAQhBkEEIQEgBSEDCyAGIQkgAyIGIQMCQCABDgUAAgICAAILIAYhBiAHQQFqIQMgCSEBIAdFDQALQQAhAwsgAwtRAQJ/AkACQCAAELAFIgANAEH/ASECDAELIAAvARJBA3EhAgsgASEDAkACQAJAIAIOAgABAgsgASAAKAIUIgAgAEEASBsPCyAAKAIUIQMLIAMLvwEBAn8gACEBAkAgAEEAELQFIgBFDQACQEG34gBBoIgCRg0AQQBBAC0Au2I6AKSIAkEAQQAoALdiNgKgiAILQQAhASAAENAGIgJBBWpBD0sNACACQaWIAiAAIAIQoQZqQQA6AABBoIgCIQELAkACQCABELAFIgENAEH/ASECDAELIAEvARJBA3EhAgtBfyEAAkACQAJAIAIOAgABAgsgASgCFCIAQX8gAEF/ShshAAwBCyABKAIUIQALIABB/wFxC8oCAQp/EK4FQQAhAgJAAkADQCACIgNBAnRBmIgCaiEEQQAhAgJAIABFDQBBACECIAQoAgAiBUUNAEEAIQIgABDQBiIGQQ9LDQBBACECIAUgACAGEPUFIgdBEHYgB3MiCEEKdkE+cWpBGGovAQAiByAFLwEMIglPDQAgBUHYAGohCiAHIQICQANAIAogAiILQRhsaiIFLwEQIgIgCEH//wNxIgdLDQECQCACIAdHDQAgBSECIAUgACAGELsGRQ0DCyALQQFqIgUhAiAFIAlHDQALC0EAIQILIAIiAg0BIANBAWohAiADRQ0AC0EAIQJBACEFDAELIAIhAiAEKAIAIQULIAUhBQJAIAIiAkUNACACLQASQQJxRQ0AAkAgAUUNACABIAIvARJBAnY2AgALIAUgAigCFGoPCwJAIAENAEEADwsgAUEANgIAQQALzwEBAn8CQAJAAkAgAA0AQQAhAAwBC0EAIQMgABDQBiIEQQ5LDQECQCAAQaCIAkYNAEGgiAIgACAEEKEGGgsgBCEACyAAIQACQAJAIAFB//8DRw0AIAAhAAwBC0EAIQMgAUHkAEsNASAAQaCIAmogAUGAAXM6AAAgAEEBaiEACyAAIQACQAJAIAINACAAIQAMAQtBACEDIAIQ0AYiASAAaiIEQQ9LDQEgAEGgiAJqIAIgARChBhogBCEACyAAQaCIAmpBADoAAEGgiAIhAwsgAwtRAQJ/AkACQCAAELAFIgANAEH/ASECDAELIAAvARJBA3EhAgsgASEDAkACQAJAIAIOAgEAAgsgASAAKAIUIgAgAEEASBsPCyAAKAIUIQMLIAMLowIBA38jAEGwAmsiAiQAIAJBqwIgACABEIcGGgJAAkAgAhDQBiIBDQAgASEADAELIAEhAANAIAAiASEAAkAgAiABQX9qIgFqLQAAQXZqDgQAAgIAAgsgASEAIAENAAtBACEACyACIAAiAWpBCjoAABAiIAFBAWohAyACIQQCQAJAQYAIQQAoArSIAmsiACABQQJqSQ0AIAMhAyAEIQAMAQtBtIgCQQAoArSIAmpBBGogAiAAEKEGGkEAQQA2ArSIAkEBIAMgAGsiASABQYF4akH/d0kbIQMgAiAAaiEAC0G0iAJBBGoiAUEAKAK0iAJqIAAgAyIAEKEGGkEAQQAoArSIAiAAajYCtIgCIAFBACgCtIgCakEAOgAAECMgAkGwAmokAAs5AQJ/ECICQAJAQQAoArSIAkEBaiIAQf8HSw0AIAAhAUG0iAIgAGpBBGotAAANAQtBACEBCxAjIAELdgEDfxAiAkAgAigCAEGACEkNACACQQA2AgALQQAhAwJAQYAIQQAoArSIAiIEIAQgAigCACIFSRsiBCAFRg0AIABBtIgCIAVqQQRqIAQgBWsiBSABIAUgAUkbIgUQoQYaIAIgAigCACAFajYCACAFIQMLECMgAwv4AQEHfxAiAkAgAigCAEGACEkNACACQQA2AgALQQAhAwJAQQAoArSIAiIEIAIoAgAiBUYNACAAIAFqQX9qIQYgACEBIAUhAwJAA0AgAyEDAkAgASIBIAZJDQAgASEFIAMhBwwCCyABIQUgA0EBaiIIIQdBAyEJAkACQEG0iAIgA2pBBGotAAAiAw4LAQAAAAAAAAAAAAEACyABIAM6AAAgAUEBaiEFQQAgCCAIQYAIRhsiAyEHQQNBACADIARGGyEJCyAFIgUhASAHIgchAyAFIQUgByEHIAlFDQALCyACIAc2AgAgBSIDQQA6AAAgAyAAayEDCxAjIAMLiAEBAX8jAEEQayIDJAACQAJAAkAgAEUNACAAENAGQQ9LDQAgAC0AAEEqRw0BCyADIAA2AgBBo+wAIAMQO0F/IQAMAQsCQCAAELwFIgANAEF+IQAMAQsCQCAAKAIUIAJLDQAgAUEAKAK4kAIgACgCEGogAhChBhoLIAAoAhQhAAsgA0EQaiQAIAALugUBBn8jAEEgayIBJAACQAJAQQAoAsiQAg0AQQBBAUEAKALE+wEiAkEQdiIDQfABIANB8AFJGyACQYCABEkbOgC8kAJBABAWIgI2AriQAiACQQAtALyQAiIEQQx0aiEDQQAhBQJAIAIoAgBBxqbRkgVHDQBBACEFIAIoAgRBitSz3wZHDQBBACEFIAIoAgxBgCBHDQBBACEFQQAoAsT7AUEMdiACLwEQRw0AIAIvARIgBEYhBQsgBSEFQQAhBgJAIAMoAgBBxqbRkgVHDQBBACEGIAMoAgRBitSz3wZHDQBBACEGIAMoAgxBgCBHDQBBACEGQQAoAsT7AUEMdiADLwEQRw0AIAMvARIgBEYhBgsgA0EAIAYiBhshAwJAAkACQCAFIAZxQQFHDQAgAkEAIAUbIgIgAyACKAIIIAMoAghLGyECDAELIAUgBnJBAUcNASACIAMgBRshAgtBACACNgLIkAILAkBBACgCyJACRQ0AEL0FCwJAQQAoAsiQAg0AQfQLQQAQO0EAQQAoAriQAiIFNgLIkAICQEEALQC8kAIiBkUNAEEAIQIDQCAFIAIiAkEMdGoQGCACQQFqIgMhAiADIAZHDQALCyABQoGAgICAgAQ3AhAgAULGptGSpcG69usANwIIIAFBADYCHCABQQAtALyQAjsBGiABQQAoAsT7AUEMdjsBGEEAKALIkAIgAUEIakEYEBcQGRC9BUEAKALIkAJFDQILIAFBACgCwJACQQAoAsSQAmtBUGoiAkEAIAJBAEobNgIAQZI5IAEQOwsCQAJAQQAoAsSQAiICQQAoAsiQAkEYaiIFSQ0AIAIhAgNAAkAgAiICIAAQzwYNACACIQIMAwsgAkFoaiIDIQIgAyAFTw0ACwtBACECCyABQSBqJAAgAg8LQaLWAEGqyABB6gFBxhIQgwYAC80DAQh/IwBBIGsiACQAQQAoAsiQAiIBQQAtALyQAiICQQx0akEAKAK4kAIiA2shBCABQRhqIgUhAQJAAkACQANAIAQhBCABIgYoAhAiAUF/Rg0BIAEgBCABIARJGyIHIQQgBkEYaiIGIQEgBiADIAdqTQ0AC0H6ESEEDAELQQAgAyAEaiIHNgLAkAJBACAGQWhqNgLEkAIgBiEBAkADQCABIgQgB08NASAEQQFqIQEgBC0AAEH/AUYNAAtBrTAhBAwBCwJAQQAoAsT7AUEMdiACQQF0a0GBAU8NAEEAQgA3A9iQAkEAQgA3A9CQAiAFQQAoAsSQAiIESw0CIAQhBCAFIQEDQCAEIQYCQCABIgMtAABBKkcNACAAQQhqQRBqIANBEGopAgA3AwAgAEEIakEIaiADQQhqKQIANwMAIAAgAykCADcDCCADIQECQANAIAFBGGoiBCAGSyIHDQEgBCEBIAQgAEEIahDPBg0ACyAHRQ0BCyADQQEQwgULQQAoAsSQAiIGIQQgA0EYaiIHIQEgByAGTQ0ADAMLAAtBztQAQarIAEGpAUG/NxCDBgALIAAgBDYCAEGJHCAAEDtBAEEANgLIkAILIABBIGokAAv0AwEEfyMAQcAAayIDJAACQAJAAkACQCAARQ0AIAAQ0AZBD0sNACAALQAAQSpHDQELIAMgADYCAEGj7AAgAxA7QX8hBAwBCwJAQQAtALyQAkEMdEG4fmogAk8NACADIAI2AhBB9Q0gA0EQahA7QX4hBAwBCwJAIAAQvAUiBUUNACAFKAIUIAJHDQBBACEEQQAoAriQAiAFKAIQaiABIAIQuwZFDQELAkBBACgCwJACQQAoAsSQAmtBUGoiBEEAIARBAEobIAJBB2pBeHFBCCACGyIEQRhqIgVPDQAQvwVBACgCwJACQQAoAsSQAmtBUGoiBkEAIAZBAEobIAVPDQAgAyACNgIgQbkNIANBIGoQO0F9IQQMAQtBAEEAKALAkAIgBGsiBTYCwJACAkACQCABQQAgAhsiBEEDcUUNACAEIAIQjQYhBEEAKALAkAIgBCACEBcgBBAgDAELIAUgBCACEBcLIANBMGpCADcDACADQgA3AyggAyACNgI8IANBACgCwJACQQAoAriQAms2AjggA0EoaiAAIAAQ0AYQoQYaQQBBACgCxJACQRhqIgA2AsSQAiAAIANBKGpBGBAXEBlBACgCxJACQRhqQQAoAsCQAksNAUEAIQQLIANBwABqJAAgBA8LQbcPQarIAEHOAkGoJxCDBgALjgUCDX8BfiMAQSBrIgAkAEHFxQBBABA7QQAoAriQAiIBQQAtALyQAiICQQx0QQAgAUEAKALIkAJGG2ohAwJAIAJFDQBBACEBA0AgAyABIgFBDHRqEBggAUEBaiIEIQEgBCACRw0ACwsCQEEAKALIkAJBGGoiBEEAKALEkAIiAUsNACABIQEgBCEEIANBAC0AvJACQQx0aiECIANBGGohBQNAIAUhBiACIQcgASECIABBCGpBEGoiCCAEIglBEGoiCikCADcDACAAQQhqQQhqIgsgCUEIaiIMKQIANwMAIAAgCSkCADcDCCAJIQQCQAJAA0AgBEEYaiIBIAJLIgUNASABIQQgASAAQQhqEM8GDQALIAUNACAGIQUgByECDAELIAggCikCADcDACALIAwpAgA3AwAgACAJKQIAIg03AwgCQAJAIA2nQf8BcUEqRw0AIAchAQwBCyAHIAAoAhwiAUEHakF4cUEIIAEbayIEQQAoAriQAiAAKAIYaiABEBcgACAEQQAoAriQAms2AhggBCEBCyAGIABBCGpBGBAXIAZBGGohBSABIQILQQAoAsSQAiIGIQEgCUEYaiIJIQQgAiECIAUhBSAJIAZNDQALC0EAKALIkAIoAgghAUEAIAM2AsiQAiAAQYAgNgIUIAAgAUEBaiIBNgIQIABCxqbRkqXBuvbrADcCCCAAQQAoAsT7AUEMdjsBGCAAQQA2AhwgAEEALQC8kAI7ARogAyAAQQhqQRgQFxAZEL0FAkBBACgCyJACDQBBotYAQarIAEGLAkGSxQAQgwYACyAAIAE2AgQgAEEAKALAkAJBACgCxJACa0FQaiIBQQAgAUEAShs2AgBBmSggABA7IABBIGokAAuAAQEBfyMAQRBrIgIkAAJAAkACQCAARQ0AIAAtAABBKkcNACAAENAGQRBJDQELIAIgADYCAEGE7AAgAhA7QQAhAAwBCwJAIAAQvAUiAA0AQQAhAAwBCwJAIAFFDQAgASAAKAIUNgIAC0EAKAK4kAIgACgCEGohAAsgAkEQaiQAIAAL/gYBDH8jAEEwayICJAACQAJAAkACQAJAIABFDQAgAC0AAEEqRw0AIAAQ0AZBEEkNAQsgAiAANgIAQYTsACACEDtBACEDDAELAkAgABC8BSIERQ0AIARBABDCBQsgAkEgakIANwMAIAJCADcDGEEAKALE+wFBDHYiA0EALQC8kAIiBUEBdCIGayEHIAMgAUH/H2pBDHZBASABGyIIIAZqayEJIAVBDXQhCiAIQX9qIQtBACEFAkADQCADIQwCQCAFIgYgCUkNAEEAIQ0MAgsCQAJAIAgNACAMIQMgBiEFQQEhBgwBCwJAIAcgBk0NAEEAIAcgBmsiAyADIAdLGyENQQAhAwNAAkAgAyIDIAZqIgVBA3ZB/P///wFxQdCQAmooAgAgBXZBAXFFDQAgDCEDIAVBAWohBUEBIQYMAwsCQCADIAtHDQAgBkEMdCAKaiEDIAYhBUEAIQYMAwsgA0EBaiIFIQMgBSANRw0ACwtBqusAQarIAEHgAEHWPRCDBgALIAMiDSEDIAUhBSANIQ0gBg0ACwsgAiABNgIsIAIgDSIDNgIoAkACQCADDQAgAiABNgIQQZ0NIAJBEGoQOwJAIAQNAEEAIQMMAgsgBEEBEMIFQQAhAwwBCyACQRhqIAAgABDQBhChBhoCQEEAKALAkAJBACgCxJACa0FQaiIDQQAgA0EAShtBF0sNABC/BUEAKALAkAJBACgCxJACa0FQaiIDQQAgA0EAShtBF0sNAEHHIEEAEDtBACEDDAELQQBBACgCxJACQRhqNgLEkAICQCAIRQ0AQQAoAriQAiACKAIoaiEGQQAhAwNAIAYgAyIDQQx0ahAYIANBAWoiBSEDIAUgCEcNAAsLQQAoAsSQAiACQRhqQRgQFxAZIAItABhBKkcNAiACKAIoIQwCQCACKAIsIgNB/x9qQQx2QQEgAxsiC0UNACAMQQx2QQAtALyQAkEBdCIDayEHQQAoAsT7AUEMdiADayEIQQAhAwNAIAggAyIFIAdqIgNNDQUCQCADQQN2Qfz///8BcUHQkAJqIgYoAgAiDUEBIAN0IgNxDQAgBiANIANzNgIACyAFQQFqIgUhAyAFIAtHDQALC0EAKAK4kAIgDGohAwsgAyEDCyACQTBqJAAgAw8LQfDnAEGqyABB9gBBzzcQgwYAC0Gq6wBBqsgAQeAAQdY9EIMGAAvUAQEGfwJAAkAgAC0AAEEqRw0AAkAgACgCFCICQf8fakEMdkEBIAIbIgNFDQAgACgCEEEMdkEALQC8kAJBAXQiAGshBEEAKALE+wFBDHYgAGshBUEAIQADQCAFIAAiAiAEaiIATQ0DAkAgAEEDdkH8////AXFB0JACaiIGKAIAIgdBASAAdCIAcUEARyABRg0AIAYgByAAczYCAAsgAkEBaiICIQAgAiADRw0ACwsPC0Hw5wBBqsgAQfYAQc83EIMGAAtBqusAQarIAEHgAEHWPRCDBgALDAAgACABIAIQF0EACwYAEBlBAAsaAAJAQQAoAuCQAiAATQ0AQQAgADYC4JACCwuXAgEDfwJAECENAAJAAkACQEEAKALkkAIiAyAARw0AQeSQAiEDDAELIAMhAwNAIAMiBEUNAiAEKAIIIgUhAyAFIABHDQALIARBCGohAwsgAyAAKAIINgIACyAAIAI2AgQgACABNgIAIABBADsBDANAEPcFIgFB/wNxIgJFDQBBACgC5JACIgNFIQUCQAJAIAMNACAFIQUMAQsgAyEEIAUhBSACIAMvAQxBB3ZGDQADQCAEKAIIIgNFIQUCQCADDQAgBSEFDAILIAMhBCAFIQUgAiADLwEMQQd2Rw0ACwsgBUUNAAsgACABQQd0OwEMIABBACgC5JACNgIIQQAgADYC5JACIAFB/wNxDwtBi80AQSdB/ycQ/gUAC4gCAQR/AkAgAC0ADUE+Rw0AIAAtAANBAXFFDQAgACkCBBD2BVINAEEAKALkkAIiAUUNACAALwEOIQIgASEBA0ACQCABIgEvAQwiAyACcyIEQf//A3FB/wBLDQAgBEEfcQ0CIAEgA0EBakEfcSADQeD/A3FyOwEMIAEgACABQQRqIAEgAkHAAHEbKAIAEQIAIAJBIHFFDQIgAUEAIAEoAgQRAgACQAJAAkBBACgC5JACIgAgAUcNAEHkkAIhAAwBCyAAIQADQCAAIgRFDQIgBCgCCCICIQAgAiABRw0ACyAEQQhqIQALIAAgASgCCDYCAAsgAUEAOwEMDwsgASgCCCIEIQEgBA0ACwsLWQEDfwJAAkACQEEAKALkkAIiASAARw0AQeSQAiEBDAELIAEhAQNAIAEiAkUNAiACKAIIIgMhASADIABHDQALIAJBCGohAQsgASAAKAIINgIACyAAQQA7AQwLNwEBfwJAIABBDnFBCEcNAEEADwtBACEBAkAgAEEMcUEMRg0AIABBBHZBCCAAQQNxdE0hAQsgAQuTBAIBfwF+IAFBD3EhAwJAAkAgAUEQTw0AIAIhAgwBCyABQRB0QYCAwP8DakGAgMD/B3GtQiCGvyACoiECCyACIQICQAJAAkACQAJAAkAgA0F+ag4KAAEFBQUCBQUDBAULQQAhAQJAIAJEAAAAAAAAAABjDQBBfyEBIAJEAADg////70FkDQACQAJAIAJEAAAAAAAA4D+gIgJEAAAAAAAA8EFjIAJEAAAAAAAAAABmcUUNACACqyEBDAELQQAhAQsgASEBCyAAIAE2AAAPC0IAIQQCQCACRAAAAAAAAAAAYw0AIAJEAAAAAAAA8ENkDQACQAJAIAJEAAAAAAAA4D+gIgJEAAAAAAAA8ENjIAJEAAAAAAAAAABmcUUNACACsSEEDAELQgAhBAsgBCEECyAAIAQ3AAAPCwJARAAAAAAAAOBDIAJEAAAAAAAA4D+gIAJEAAAAAAAA4ENkIAJEAAAAAAAA4ENjchsiAplEAAAAAAAA4ENjRQ0AIAAgArA3AAAPCyAAQoCAgICAgICAgH83AAAPCyAAIAK2OAAADwsgACACOQAADwtBgICAgHghAQJAIAJEAAAAAAAA4MFjDQBB/////wchASACRAAAwP///99BZA0AAkACQCACRAAAAAAAAOA/oCICmUQAAAAAAADgQWNFDQAgAqohAQwBC0GAgICAeCEBCyABIQELIAAgAyABEMsFC/kBAAJAIAFBCEkNACAAIAEgArcQygUPCwJAAkACQAJAAkACQAJAAkACQCABDggIAAECAwQFBgcLIAAgAkH//wMgAkH//wNIGyIBQQAgAUEAShs7AAAPCyAAIAJBACACQQBKGzYAAA8LIAAgAkEAIAJBAEobrTcAAA8LIAAgAkH/ACACQf8ASBsiAUGAfyABQYB/Shs6AAAPCyAAIAJB//8BIAJB//8BSBsiAUGAgH4gAUGAgH5KGzsAAA8LIAAgAjYAAA8LIAAgAqw3AAAPC0HkxgBBrgFBwNoAEP4FAAsgACACQf8BIAJB/wFIGyIBQQAgAUEAShs6AAALvAMDAX8BfAF+AkACQAJAIAFBCEkNAAJAAkACQAJAAkACQAJAIAFBD3EiAkF+ag4KAAEFBQUCBQUDBAULIAAoAAC4IQMMBQsgACkAALohAwwECyAAKQAAuSEDDAMLIAAqAAC7IQMMAgsgACsAACEDDAELIAAgAhDMBbchAwsgAyEDAkACQCABQRBPDQAgAyEDDAELIANBgIDA/wMgAUEQdEGAgMD/B3FrQYCAwP8Hca1CIIa/oiEDCyADIgNEAAAAAAAA4MFjDQFB/////wchASADRAAAwP///99BZA0CIANEAAAAAAAA4D+gIgOZRAAAAAAAAOBBY0UNASADqg8LAkACQAJAAkACQAJAAkACQAJAIAEOCAABAgMEBQYHCAsgAC0AAA8LIAAvAAAPCyAAKAAAIgFB/////wcgAUH/////B0kbDwsgACkAACIEQv////8HIARC/////wdUG6cPCyAALAAADwsgAC4AAA8LIAAoAAAPC0GAgICAeCEBIAApAAAiBEKAgICAeFMNAiAEQv////8HIARC/////wdTG6cPC0HkxgBBygFB1NoAEP4FAAtBgICAgHghAQsgAQugAQIBfwF8AkACQAJAAkACQAJAAkAgAUEPcSICQX5qDgoAAQUFBQIFBQMEBQsgACgAALghAwwFCyAAKQAAuiEDDAQLIAApAAC5IQMMAwsgACoAALshAwwCCyAAKwAAIQMMAQsgACACEMwFtyEDCyADIQMCQCABQRBPDQAgAw8LIANBgIDA/wMgAUEQdEGAgMD/B3FrQYCAwP8Hca1CIIa/ogvkAQIDfwF+AkAgAS0ADEEMTw0AQX4PC0F+IQICQAJAIAEpAhAiBVANACABLwEYIQMQIQ0BAkAgAC0ABkUNAAJAAkACQEEAKALokAIiASAARw0AQeiQAiEBDAELIAEhAgNAIAIiAUUNAiABKAIAIgQhAiABIQEgBCAARw0ACwsgASAAKAIANgIACyAAQQBBiAIQowYaCyAAQQE7AQYgAEEPakEDOgAAIABBEGogBTcCACAAIANBB3Q7AQQgAEEAKALokAI2AgBBACAANgLokAJBACECCyACDwtB8MwAQStB8ScQ/gUAC+QBAgN/AX4CQCABLQAMQQJPDQBBfg8LQX4hAgJAAkAgASkCBCIFUA0AIAEvARAhAxAhDQECQCAALQAGRQ0AAkACQAJAQQAoAuiQAiIBIABHDQBB6JACIQEMAQsgASECA0AgAiIBRQ0CIAEoAgAiBCECIAEhASAEIABHDQALCyABIAAoAgA2AgALIABBAEGIAhCjBhoLIABBATsBBiAAQQ9qQQM6AAAgAEEQaiAFNwIAIAAgA0EHdDsBBCAAQQAoAuiQAjYCAEEAIAA2AuiQAkEAIQILIAIPC0HwzABBK0HxJxD+BQAL1wIBBH8CQAJAAkAgAC0ADUE/Rw0AIAAtAANBAXENABAhDQFBACgC6JACIgFFDQAgASEBA0ACQCABIgEtAAdFDQAgAC8BDiABLwEMRw0AIAFBEGopAgAgACkCBFINACABQQA6AAcgAUEMaiICEPwFAkACQCABLQAGQYB/ag4DAQIAAgtBACgC6JACIgIhAwJAAkACQCACIAFHDQBB6JACIQIMAQsDQCADIgJFDQIgAigCACIEIQMgAiECIAQgAUcNAAsLIAIgASgCADYCAAsgAUEAQYgCEKMGGgwBCyABQQE6AAYCQCABQQBBAEHgABDRBQ0AIAFBggE6AAYgAS0ABw0FIAIQ+QUgAUEBOgAHIAFBACgC4PsBNgIIDAELIAFBgAE6AAYLIAEoAgAiAiEBIAINAAsLDwtB8MwAQckAQYMUEP4FAAtBqdwAQfDMAEHxAEHeLBCDBgAL6gEBAn9BACEEQX8hBQJAAkACQCAALQAGQX9qDggBAAAAAAAAAgALQQAhBEF+IQUMAQtBACEEQQEhBSAALQAHDQACQCACIABBDmotAABqQQRqQe0BTw0AQQEhBEEAIQUMAQsgAEEMahD5BSAAQQE6AAcgAEEAKALg+wE2AghBACEEQQEhBQsgBSEFAkACQCAERQ0AIABBDGpBPiAALwEEIANyIAIQ/QUiBEUNASAEIAEgAhChBhogACAALwEEIgRBAWpBH3EgBEHg/wNxcjsBBEEAIQULIAUPC0Gz1gBB8MwAQYwBQcAJEIMGAAvaAQEDfwJAECENAAJAQQAoAuiQAiIARQ0AIAAhAANAAkAgACIALQAHIgFFDQBBACgC4PsBIgIgACgCCGtBAEgNAAJAIAFBBEsNACAAQQxqEJgGIQFBACgC4PsBIQICQCABDQAgACAALQAHIgFBAWo6AAcgAEGAICABdCACajYCCAwCCyAAIAJBgIAEajYCCAwBCwJAIAFBBUcNACAAIAFBAWo6AAcgACACQYCAAmo2AggMAQsgAEEIOgAGCyAAKAIAIgEhACABDQALCw8LQfDMAEHaAEHAFhD+BQALawEBf0F/IQICQAJAAkAgAC0ABkF/ag4IAQAAAAAAAAIAC0F+DwtBASECIAAtAAcNAEEAIQIgASAAQQ5qLQAAakEEakHtAUkNACAAQQxqEPkFIABBAToAByAAQQAoAuD7ATYCCEEBIQILIAILDQAgACABIAJBABDRBQuOAgEDfyAALQAGIgEhAgJAAkACQAJAAkACQAJAIAEOCQUCAwMDAwMDAQALIAFBgH9qDgMBAgMCCwJAAkACQEEAKALokAIiASAARw0AQeiQAiEBDAELIAEhAgNAIAIiAUUNAiABKAIAIgMhAiABIQEgAyAARw0ACwsgASAAKAIANgIACyAAQQBBiAIQowYaQQAPCyAAQQE6AAYCQCAAQQBBAEHgABDRBSIBDQAgAEGCAToABiAALQAHDQQgAEEMahD5BSAAQQE6AAcgAEEAKALg+wE2AghBAQ8LIABBgAE6AAYgAQ8LQfDMAEG8AUH7MxD+BQALQQEhAgsgAg8LQancAEHwzABB8QBB3iwQgwYAC58CAQV/AkACQAJAAkAgAS0AAkUNABAiIAEtAAJBD2pB/ANxIgIgAC8BAiIDaiEEAkACQAJAAkAgAC8BACIFIANLDQAgBCEGIAQgAC8BBE0NAiACIAVJDQFBACEEQX8hAwwDCyAEIQYgBCAFSQ0BQQAhBEF+IQMMAgsgACADOwEGIAIhBgsgACAGOwECQQEhBEEAIQMLIAMhAwJAIARFDQAgACAALwECaiACa0EIaiABIAIQoQYaCyAALwEAIAAvAQQiAUsNASAALwECIAFLDQIgAC8BBiABSw0DECMgAw8LQdXMAEEdQcQsEP4FAAtBuDFB1cwAQTZBxCwQgwYAC0HMMUHVzABBN0HELBCDBgALQd8xQdXMAEE4QcQsEIMGAAsxAQJ/QQAhAQJAIAAvAQAiAiAALwECRg0AIAAgAkEAIAIgAC8BBkkbakEIaiEBCyABC6YBAQN/ECJBACEBAkAgAC8BACICIAAvAQJGDQAgACACQQAgAiAALwEGSRtqQQhqIQELAkACQCABIgFFDQAgAS0AAkEPakH8A3EhAQJAIAIgAC8BBiIDSQ0AIAIgA0cNAiAAIAE7AQAgACAALwEEOwEGECMPCyAAIAIgAWo7AQAQIw8LQZbWAEHVzABBzgBBhBMQgwYAC0HuMEHVzABB0QBBhBMQgwYACyIBAX8gAEEIahAfIgEgADsBBCABIAA7AQYgAUEANgEAIAELMwEBfyMAQRBrIgIkACACIAE6AA8gAC0ADSAALwEOIAJBD2pBARCaBiEAIAJBEGokACAACzMBAX8jAEEQayICJAAgAiABOwEOIAAtAA0gAC8BDiACQQ5qQQIQmgYhACACQRBqJAAgAAszAQF/IwBBEGsiAiQAIAIgATYCDCAALQANIAAvAQ4gAkEMakEEEJoGIQAgAkEQaiQAIAALPAACQAJAIAFFDQAgAS0AAA0BCyAALQANIAAvAQ5Bye4AQQAQmgYPCyAALQANIAAvAQ4gASABENAGEJoGC04BAn8jAEEQayIBJABBACECAkAgAC0AA0EEcQ0AIAEgAC8BDjsBDCABIAAvAQA7AQ4gAC0ADUEDIAFBDGpBBBCaBiECCyABQRBqJAAgAgsZACAAIAAtAAxBBGo6AAIgABD5BSAAEJgGCxoAAkAgACABIAIQ4QUiAg0AIAEQ3gUaCyACC4EHARB/IwBBEGsiAyQAAkACQCABLwEOIgRBDHYiBUF/akEBTQ0AQQAhBAwBCwJAIAVBAkcNACABLQAMDQBBACEEDAELAkAgBEH/H3EiBkH/HU0NAEEAIQQMAQsCQCAFQQJHDQAgBEGAHnFBgAJHDQBBACEEDAELQQAhBCACLwEAIgdB8R9GDQBBACAGayEIIAFBEGoiCSEKIAchB0EAIgQhC0EAIQwgBCENA0AgDSENIAwhDiALIQsgECEPAkACQCAHQf//A3EiDEEMdiIEQQlGDQAgDSEHIARBkJoBai0AACEQDAELIA1BAWoiECEHIAIgEEEBdGovAQAhEAsgByERAkACQAJAAkAgECIHRQ0AAkACQCAEQXZqQX1NDQAgDiENIAshEAwBC0EAIQ0gCyAOQf8BcUEAR2pBAyAHQX9qIAdBA0sbIhBqIBBBf3NxIRALIBAhECANIQsCQCAMQf8fcSAGRyISDQAgACAQaiEPAkAgBUEBRw0AAkACQCAEQQhHDQAgAyAPLQAAIAtB/wFxdkEBcToADyABLQANIAEvAQ4gA0EPakEBEJoGGgwBCyAPIQ0gByEOAkAgDEGAwAJJDQADQCANIQQgDiIMRQ0HIARBAWohDSAMQX9qIQ4gBC0AAEUNAAsgDEUNBgsgAS0ADSABLwEOIA8gBxCaBhoLIAshCyAQIQcgCCEEDAULAkAgBEEIRw0AQQEgC0H/AXF0IQQgDy0AACEHAkAgAS0AEEUNACAPIAcgBHI6AAAMBAsgDyAHIARBf3NxOgAADAMLAkAgByABLQAMIgRLDQAgDyAKIAcQoQYaDAMLIA8gCSAEEKEGIQ0CQAJAIAxB/58BTQ0AQQAhBAwBC0EAIQQgDEGAIHENACABLQAMIAFqQQ9qLAAAQQd1IQQLIA0gAS0ADCIMaiAEIAcgDGsQowYaDAILAkACQCAEQQhHDQBBACALQQFqIgQgBEH/AXFBCEYiBBshCyAQIARqIQcMAQsgCyELIBAgB2ohBwsgDyEEDAMLQfXHAEHbAEG9HhD+BQALIAshCyAQIQcgBiEEDAELIAshCyAQIQdBACEECyAEIQQgByENIAshDAJAIBJFDQAgAiARQQFqIg5BAXRqLwEAIhIhByAEIRAgDSELIAwhDCAOIQ1BACEEIBJB8R9GDQIMAQsLIAQhBAsgA0EQaiQAIAQL/gIBBH8gABDjBSAAENAFIAAQxwUgABCkBQJAAkAgAC0AA0EBcQ0AIAAtAA0NASAALwEODQEgAC0ADEEESQ0BIAAtABFBCHFFDQFBAEEAKALg+wE2AvSQAkGAAhAdQQAtALjuARAcDwsCQCAAKQIEEPYFUg0AIAAQ5AUgAC0ADSIBQQAtAPCQAk8NAUEAKALskAIgAUECdGooAgAhAgJAAkACQCAALwEOQfldag4DAQIAAgsgARDlBSIDIQECQCADDQAgAhDzBSEBCwJAIAEiAQ0AIAAQ3gUaDwsgACABEN0FGg8LIAIQ9AUiAUF/Rg0AIAAgAUH/AXEQ2gUaDwsgAiAAIAIoAgAoAgwRAgAPCyAALQADQQRxRQ0AQQAtAPCQAkUNACAAKAIEIQRBACEBA0ACQEEAKALskAIgASIBQQJ0aigCACICKAIAIgMoAgAgBEcNACAAIAE6AA0gAiAAIAMoAgwRAgALIAFBAWoiAiEBIAJBAC0A8JACSQ0ACwsLAgALAgALBABBAAtnAQF/AkBBAC0A8JACQSBJDQBB9ccAQbABQfY5EP4FAAsgAC8BBBAfIgEgADYCACABQQAtAPCQAiIAOgAEQQBB/wE6APGQAkEAIABBAWo6APCQAkEAKALskAIgAEECdGogATYCACABC5cCAQV/IwBBgAFrIgAkAEEAQQA6APCQAkEAIAA2AuyQAkEAEDWnIgE2AuD7AQJAAkAgAUEAKAKAkQIiAmsiA0H//wBLDQAgAyEEIANB6AdNDQFBAEEAKQOIkQIgASACa0GXeGoiA0HoB24iBEEBaq18NwOIkQIgASACIANqayADIARB6Adsa2pBmHhqIQQMAQtBAEEAKQOIkQIgA0HoB24iBK18NwOIkQIgAyAEQegHbGshBAtBACABIARrNgKAkQJBAEEAKQOIkQI+ApCRAhCsBRA4EPIFQQBBADoA8ZACQQBBAC0A8JACQQJ0EB8iATYC7JACIAEgAEEALQDwkAJBAnQQoQYaQQAQNT4C9JACIABBgAFqJAALqAEBBH9BABA1pyIANgLg+wECQAJAIABBACgCgJECIgFrIgJB//8ASw0AIAIhAyACQegHTQ0BQQBBACkDiJECIAAgAWtBl3hqIgJB6AduIgOtfEIBfDcDiJECIAIgA0HoB2xrQQFqIQMMAQtBAEEAKQOIkQIgAkHoB24iA618NwOIkQIgAiADQegHbGshAwtBACAAIANrNgKAkQJBAEEAKQOIkQI+ApCRAgsTAEEAQQAtAPiQAkEBajoA+JACC8QBAQZ/IwAiACEBEB4gAEEALQDwkAIiAkECdEEPakHwD3FrIgMkAAJAIAJFDQBBACgC7JACIQRBACEAA0AgAyAAIgBBAnQiBWogBCAFaigCACgCACgCADYCACAAQQFqIgUhACAFIAJHDQALCwJAQQAtAPmQAiIAQQ9PDQBBACAAQQFqOgD5kAILIANBAC0A+JACQRB0QQAtAPmQAnJBgJ4EajYCAAJAQQBBACADIAJBAnQQmgYNAEEAQQA6APiQAgsgASQACwQAQQEL3AEBAn8CQEH8kAJBoMIeEIAGRQ0AEOoFCwJAAkBBACgC9JACIgBFDQBBACgC4PsBIABrQYCAgH9qQQBIDQELQQBBADYC9JACQZECEB0LQQAoAuyQAigCACIAIAAoAgAoAggRAAACQEEALQDxkAJB/gFGDQACQEEALQDwkAJBAU0NAEEBIQADQEEAIAAiADoA8ZACQQAoAuyQAiAAQQJ0aigCACIBIAEoAgAoAggRAAAgAEEBaiIBIQAgAUEALQDwkAJJDQALC0EAQQA6APGQAgsQkAYQ0gUQogUQnQYLwAEBBH9BAEGQzgA2AuCQAkEAEDWnIgA2AuD7AQJAAkAgAEEAKAKAkQIiAWsiAkH//wBLDQAgAiEDIAJB6AdNDQFBAEEAKQOIkQIgACABa0GXeGoiAkHoB24iA0EBaq18NwOIkQIgACABIAJqayACIANB6Adsa2pBmHhqIQMMAQtBAEEAKQOIkQIgAkHoB24iA618NwOIkQIgAiADQegHbGshAwtBACAAIANrNgKAkQJBAEEAKQOIkQI+ApCRAhDuBQtnAQF/AkACQANAEJUGIgBFDQECQCAALQADQQNxQQNHDQAgACkCBBD2BVINAEE/IAAvAQBBAEEAEJoGGhCdBgsDQCAAEOIFIAAQ+gUNAAsgABCWBhDsBRA9IAANAAwCCwALEOwFED0LCxQBAX9B6zZBABC0BSIAQYwuIAAbCw8AQdvAAEHx////AxC2BQsGAEHK7gAL4wEBA38jAEEQayIAJAACQEEALQCUkQINAEEAQn83A7iRAkEAQn83A7CRAkEAQn83A6iRAkEAQn83A6CRAgNAQQAhAQJAQQAtAJSRAiICQf8BRg0AQcnuACACQYI6ELUFIQELIAFBABC0BSEBQQAtAJSRAiECAkACQAJAIAFFDQAgACACNgIEIAAgATYCAEHCOiAAEDtBAC0AlJECQQFqIQEMAQtBwAAhASACQcAATw0BC0EAIAE6AJSRAgwBCwtBAEH/AToAlJECIABBEGokAA8LQb7cAEGkywBB3ABBmiUQgwYACzUBAX9BACEBAkAgAC0ABEGgkQJqLQAAIgBB/wFGDQBBye4AIABB5jYQtQUhAQsgAUEAELQFCzgAAkACQCAALQAEQaCRAmotAAAiAEH/AUcNAEEAIQAMAQtBye4AIABBgxIQtQUhAAsgAEF/ELIFC1MBA38CQCABDQBBxbvyiHgPC0HFu/KIeCECIAAhACABIQEDQCACIAAiAC0AAHNBk4OACGwiAyECIABBAWohACABQX9qIgQhASADIQMgBA0ACyADCwQAEDMLTgEBfwJAQQAoAsCRAiIADQBBACAAQZODgAhsQQ1zNgLAkQILQQBBACgCwJECIgBBDXQgAHMiAEERdiAAcyIAQQV0IABzIgA2AsCRAiAAC34BA39B//8DIQICQCABRQ0AIAEhAyAAIQBB//8DIQEDQCADQX9qIgQhAyAAIgJBAWohACABQf//A3EiAUEIdCACLQAAIAFBCHZzIgFB8AFxQQR2IAFzQf8BcSIBciABQQx0cyABQQV0cyICIQEgAiECIAQNAAsLIAJB//8DcQt1AQV/IAAtAAJBCmohASAAQQJqIQJB//8DIQMDQCABQX9qIgQhASACIgVBAWohAiADQf//A3EiA0EIdCAFLQAAIANBCHZzIgNB8AFxQQR2IANzQf8BcSIDciADQQx0cyADQQV0cyIFIQMgBA0ACyAAIAU7AQALhgIBCH8CQCAALQAMIgFBB2pB/ANxIgIgAC0AAiIDSQ0AQQAPCyACIQICQCAAQQxqIgQgAUEEaiIFai0AAEH/AUcNAAJAIAEgAGpBEWotAAAiASADSQ0AQQAPCyABIQIgBSABSQ0AQQAPCyAAIAAtAANB/QFxOgADQQAhAQJAIAAgAiIFakEMaiICLQAAIgZBBGoiByAFaiADSw0AIAIhASAEIQMgBkEHaiIIQQJ2IQIDQCADIgMgASIBKAIANgIAIAFBBGohASADQQRqIQMgAkF/aiIEIQIgBA0ACyAAQQxqIgEgB2pB/wE6AAAgBiABakEFaiAIQfwBcSAFajoAAEEBIQELIAELSQEBfwJAIAJBBEkNACABIQEgACEAIAJBAnYhAgNAIAAiACABIgEoAgA2AgAgAUEEaiEBIABBBGohACACQX9qIgMhAiADDQALCwsJACAAQQA6AAILmAEBA38CQAJAIAFBgAJPDQAgAkGAgARPDQFBACEEAkAgA0EEaiAAQQxqIgUgBSAALQACIgZqIgVrQewBaksNACAFIAI6AAIgBSABOgABIAUgAzoAACAFIAJBCHY6AAMgACAGIANBB2pB/AFxajoAAiAFQQRqIQQLIAQPC0GwygBB/QBBsTYQ/gUAC0GwygBB/wBBsTYQ/gUACywBAX8jAEEQayIDJAAgAyACNgIIIAMgATYCBCADIAA2AgBBlRogAxA7EBsAC0kBA38CQCAAKAIAIgJBACgCkJECayIDQX9KDQAgACACIAFqIgI2AgAgAkEAKAKQkQIiBGtBf0oNACAAIAQgAWo2AgALIANBH3YLSQEDfwJAIAAoAgAiAkEAKALg+wFrIgNBf0oNACAAIAIgAWoiAjYCACACQQAoAuD7ASIEa0F/Sg0AIAAgBCABajYCAAsgA0EfdgtqAQN/AkAgAkUNAEEAIQMDQCAAIAMiA0EBdGoiBCABIANqIgUtAABBBHZBtDBqLQAAOgAAIARBAWogBS0AAEEPcUG0MGotAAA6AAAgA0EBaiIEIQMgBCACRw0ACwsgACACQQF0akEAOgAAC+gCAQd/IAAhAgJAIAEtAAAiA0UNACADRSEEIAMhAyABIQFBACEFIAAhBgNAIAYhByAFIQggBCEEIAMhAyABIQICQANAIAIhAiAEIQUCQAJAIAMiBEFQakH/AXFBCUsiAw0AIATAQVBqIQEMAQtBfyEBIARBIHIiBkGff2pB/wFxQQVLDQAgBsBBqX9qIQELIAFBf0cNASACLQABIgFFIQQgASEDIAJBAWohAiABDQALIAchAgwCCwJAIAVBAXFFDQAgByECDAILAkACQCADDQAgBMBBUGohAQwBC0F/IQEgBEEgciIEQZ9/akH/AXFBBUsNACAEwEGpf2ohAQsgASEBAkACQCAIDQAgByEGIAFBBHRBgAJyIQUMAQsCQCAARQ0AIAcgASAIcjoAAAsgB0EBaiEGQQAhBQsgAkEBaiICLQAAIgdFIQQgByEDIAIhASAFIQUgBiICIQYgAiECIAcNAAsLIAIgAGsLMwEBfyMAQRBrIgQkACAEIAM2AgwgBCACNgIIIAQgATYCBCAEIAA2AgBB8BkgBBA7EBsAC1gBBH8gACAALQAAIgFBLUZqIQBBACECA0AgACIDQQFqIQAgAywAAEFQaiIDIAIiAkEKbGogAiADQf8BcUEKSSIDGyIEIQIgAw0AC0EAIARrIAQgAUEtRhsLtxABDX8jAEHAAGsiBSQAIAAgAWohBiAFQQFyIQcgBUECciEIIAVBf2ohCUEAIQEgACEKIAQhBCACIQsgAiECA0AgAiECIAQhDCAKIQ0gASEBIAsiDkEBaiEPAkACQCAOLQAAIhBBJUYNACAQRQ0AIAEhASANIQogDCEEIA8hC0EBIQ8gAiECDAELAkACQCACIA9HDQAgASEBIA0hCgwBCyABIQFBACEKAkAgAkF/cyAPaiILQQBMDQADQCABIAIgCiIKai0AAEHAAXFBgAFHaiEBIApBAWoiBCEKIAQgC0cNAAsLIAEhCgJAIAYgDWsiAUEATA0AIA0gAiALIAFBf2ogASALShsiARChBiABakEAOgAACyAKIQEgDSALaiEKCyAKIQ0gASERAkAgEA0AIBEhASANIQogDCEEIA8hC0EAIQ8gAiECDAELAkACQCAPLQAAQS1GDQAgDyEBQQAhCgwBCyAOQQJqIA8gDi0AAkHzAEYiChshASAKIABBAEdxIQoLIAohDiABIhAsAAAhASAFQQA6AAEgEEEBaiEPAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAFBW2oOVAgHBwcHBgcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwMHBwcHBwcHBwcHAAEHBQcHBwcHBwcHBwQHBwoHAgcHAwcLIAUgDCgCADoAACARIQogDSEEIAxBBGohAgwMCyAFIQoCQAJAIAwoAgAiAUF/TA0AIAEhASAKIQoMAQsgBUEtOgAAQQAgAWshASAHIQoLIAxBBGohDiAKIgshCiABIQQDQCAKIgogBCIBIAFBCm4iBEEKbGtBMHI6AAAgCkEBaiICIQogBCEEIAFBCUsNAAsgAkEAOgAAIAsgCxDQBmpBf2oiBCEKIAshASAEIAtNDQoDQCABIgEtAAAhBCABIAoiCi0AADoAACAKIAQ6AAAgCkF/aiIEIQogAUEBaiICIQEgAiAESQ0ADAsLAAsgBSEKIAwoAgAhBANAIAoiCiAEIgEgAUEKbiIEQQpsa0EwcjoAACAKQQFqIgIhCiAEIQQgAUEJSw0ACyACQQA6AAAgDEEEaiELIAkgBRDQBmoiBCEKIAUhASAEIAVNDQgDQCABIgEtAAAhBCABIAoiCi0AADoAACAKIAQ6AAAgCkF/aiIEIQogAUEBaiICIQEgAiAESQ0ADAkLAAsgBUGw8AE7AQAgDCgCACELQQAhCkEcIQIDQCAKIQQgCyACIgF2QQ9xIQoCQAJAIAFFDQAgCg0AQQAhAiAERQ0BCyAIIARqIApBN2ogCkEwciAKQQlLGzoAACAEQQFqIQILIAIiBCEKIAFBfGohAiABDQALIAggBGpBADoAACARIQogDSEEIAxBBGohAgwJCyAFQbDwATsBACAMKAIAIQtBACEKQRwhAgNAIAohBCALIAIiAXZBD3EhCgJAAkAgAUUNACAKDQBBACECIARFDQELIAggBGogCkE3aiAKQTByIApBCUsbOgAAIARBAWohAgsgAiIEIQogAUF8aiECIAENAAsgCCAEakEAOgAAIBEhCiANIQQgDEEEaiECDAgLIAUgDEEHakF4cSIBKwMAQQgQhgYgESEKIA0hBCABQQhqIQIMBwsCQAJAIBAtAAFB8ABGDQAgESEBIA0hD0E/IQ0MAQsCQCAMKAIAIgFBAU4NACARIQEgDSEPQQAhDQwBCyAMKAIEIQogASEEIA0hAiARIQsDQCALIREgAiENIAohCyAEIg5BHyAOQR9IGyECQQAhAQNAIAUgASIBQQF0aiIKIAsgAWoiBC0AAEEEdkG0MGotAAA6AAAgCiAELQAAQQ9xQbQwai0AADoAASABQQFqIgohASAKIAJHDQALIAUgAkEBdCIPakEAOgAAIBEhAUEAIQoCQCAPQQBMDQADQCABIAUgCiIKai0AAEHAAXFBgAFHaiEBIApBAWoiBCEKIAQgD0cNAAsLIAEhAQJAIAYgDWsiCkEATA0AIA0gBSAPIApBf2ogCiAPShsiChChBiAKakEAOgAACyALIAJqIQogDiACayIOIQQgDSAPaiIPIQIgASELIAEhASAPIQ9BACENIA5BAEoNAAsLIAUgDToAACABIQogDyEEIAxBCGohAiAQQQJqIQEMBwsgBUE/OgAADAELIAUgAToAAAsgESEKIA0hBCAMIQIMAwsgBiANayEQIBEhAUEAIQoCQCAMKAIAIgRB1OYAIAQbIgsQ0AYiAkEATA0AA0AgASALIAoiCmotAABBwAFxQYABR2ohASAKQQFqIgQhCiAEIAJHDQALCyABIQECQCAQQQBMDQAgDSALIAIgEEF/aiAQIAJKGyIKEKEGIApqQQA6AAALIAxBBGohECAFQQA6AAAgDSACaiEEAkAgDkUNACALECALIAEhCiAEIQQgECECDAILIBEhCiANIQQgCyECDAELIBEhCiANIQQgDiECCyAPIQELIAEhDSACIQ4gBiAEIg9rIQsgCiEBQQAhCgJAIAUQ0AYiAkEATA0AA0AgASAFIAoiCmotAABBwAFxQYABR2ohASAKQQFqIgQhCiAEIAJHDQALCyABIQECQCALQQBMDQAgDyAFIAIgC0F/aiALIAJKGyIKEKEGIApqQQA6AAALIAEhASAPIAJqIQogDiEEIA0hC0EBIQ8gDSECCyABIg4hASAKIg0hCiAEIQQgCyELIAIhAiAPDQALAkAgA0UNACADIA5BAWo2AgALIAVBwABqJAAgDSAAa0EBagvtCAMDfgh/AXwCQAJAIAFEAAAAAAAAAABjDQAgASEBIAAhAAwBCyAAQS06AAAgAZohASAAQQFqIQALIAAhAAJAIAEiAb1C////////////AIMiA0KBgICAgICA+P8AVA0AIABBzsK5AjYAAA8LAkAgA0KAgICAgICA+P8AUg0AIABB6dyZAzYAAA8LAkAgAUSwym5H7YkQAGNFDQAgAEEwOwAADwsgAkEEIAJBBEobIgJBD0khBiABRI3ttaD3xrA+YyEHAkACQCABELkGIg6ZRAAAAAAAAOBBY0UNACAOqiEIDAELQYCAgIB4IQgLIAghCCACQQ8gBhshAgJAAkAgBw0AIAFEUO/i1uQaS0RkDQAgCCEGQQEhByABIQEMAQsCQCAIQX9KDQBBACEGIAghByABRAAAAAAAACRAQQAgCGsQ+gaiIQEMAQtBACEGIAghByABRAAAAAAAACRAIAgQ+gajIQELIAEhASAHIQkgAiAGIgpBAWoiC0EPIApBD0giBhsgCiACSCIIGyEMAkACQCAIDQAgBg0AIAogDGtBAWoiCCECIAFEAAAAAAAAJEAgCBD6BqNEAAAAAAAA4D+gIQEMAQtBACECIAFEAAAAAAAAJEAgDCAKQX9zahD6BqJEAAAAAAAA4D+gIQELIAIhDSAKQX9KIQICQAJAIAEiAUQAAAAAAADwQ2MgAUQAAAAAAAAAAGZxRQ0AIAGxIQMMAQtCACEDCyADIQMCQAJAIAJFDQAgACEADAELIABBsNwAOwAAIABBAmohAgJAIApBf0cNACACIQAMAQsgAkEwIApBf3MQowYaIAAgCmtBAWohAAsgAyEDIAwhCCAAIQACQANAIAAhAiADIQQCQCAIIghBAU4NACACIQIMAgtBMCEAIAQhAwJAIAQgCEF/aiIIQQN0QaCaAWopAwAiBVQNAANAIABBAWohACADIAV9IgQhAyAEIAVaDQALCyACIAA6AAAgAkEBaiEAAkACQCADIgNCAFIgDCAIayIHIApMciIGQQFGDQAgACEADAELIAAhACAHIAtHDQAgAkEuOgABIAJBAmohAAsgAyEDIAghCCAAIgIhACACIQIgBg0ACwsgAiEAAkACQCANQQFODQAgACEADAELIABBMCANEKMGIA1qIQALIAAhAAJAAkAgCUEBRg0AIABB5QA6AAACQAJAIAlBAU4NACAAQQFqIQAMAQsgAEErOgABIABBAmohAAsgACEAAkACQCAJQX9MDQAgCSEIIAAhAAwBCyAAQS06AABBACAJayEIIABBAWohAAsgACIHIQIgCCEIA0AgAiICIAgiACAAQQpuIghBCmxrQTByOgAAIAJBAWoiBiECIAghCCAAQQlLDQALIAZBADoAACAHIAcQ0AZqQX9qIgAgB00NASAAIQIgByEAA0AgACIALQAAIQggACACIgItAAA6AAAgAiAIOgAAIAJBf2oiCCECIABBAWoiBiEAIAYgCEkNAAwCCwALIABBADoAAAsLDwAgACABIAJBACADEIUGCywBAX8jAEEQayIEJAAgBCADNgIMIAAgASACQQAgAxCFBiEDIARBEGokACADC64BAQZ/IwBBEGsiAiABNwMIQcW78oh4IQMgAkEIaiECQQghBANAIANBk4OACGwiBSACIgItAABzIgYhAyACQQFqIQIgBEF/aiIHIQQgBw0ACyAAQQA6AAQgACAGQf////8DcSIDQeg0bkEKcEEwcjoAAyAAIANBpAVuQQpwQTByOgACIAAgAyAFQR52cyIDQRpuIgJBGnBBwQBqOgABIAAgAyACQRpsa0HBAGo6AAALTQECfyMAQRBrIgIkACACIAE2AgQgAiABNgIMIAIgATYCCEEAQQAgAEEAIAEQhQYiARAfIgMgASAAQQAgAigCCBCFBhogAkEQaiQAIAMLdwEFfyABQQF0IgJBAXIQHyEDAkAgAUUNAEEAIQQDQCADIAQiBEEBdGoiBSAAIARqIgYtAABBBHZBtDBqLQAAOgAAIAVBAWogBi0AAEEPcUG0MGotAAA6AAAgBEEBaiIFIQQgBSABRw0ACwsgAyACakEAOgAAIAML6QEBB38jAEEQayIBJAAgAUEANgIMIAFCADcCBCABIAA2AgACQAJAIAANAEEBIQIMAQsgACECQQAhA0EAIQQDQCACIQUgASAEQQFqIgRBAnRqKAIAIgYhAiAFENAGIANqIgUhAyAEIQQgBg0ACyAFQQFqIQILIAIQHyEHQQAhBQJAIABFDQAgACECQQAhA0EAIQQDQCACIQIgByADIgNqIAIgAhDQBiIFEKEGGiABIARBAWoiBEECdGooAgAiBiECIAUgA2oiBSEDIAQhBCAFIQUgBg0ACwsgByAFakEAOgAAIAFBEGokACAHCxkAAkAgAQ0AQQEQHw8LIAEQHyAAIAEQoQYLQgEDfwJAIAANAEEADwsCQCABDQBBAQ8LQQAhAgJAIAAQ0AYiAyABENAGIgRJDQAgACADaiAEayABEM8GRSECCyACCyMAAkAgAA0AQQAPCwJAIAENAEEBDwsgACABIAEQ0AYQuwZFCxIAAkBBACgCyJECRQ0AEJEGCwueAwEHfwJAQQAvAcyRAiIARQ0AIAAhAUEAKALEkQIiACICIQMgACEAIAIhAgNAIAAhBCACIgBBCGohBSABIQIgAyEBA0AgASEBIAIhAwJAAkACQCAALQAFIgJB/wFHDQAgACABRw0BQQAgAyABLQAEQQNqQfwDcUEIaiICayIDOwHMkQIgASABIAJqIANB//8DcRD7BQwCC0EAKALg+wEgACgCAGtBAEgNACACQf8AcSAALwEGIAUgAC0ABBCaBg0EAkACQCAALAAFIgFBf0oNAAJAIABBACgCxJECIgFGDQBB/wEhAQwCC0EAQQAvAcyRAiABLQAEQQNqQfwDcUEIaiICayIDOwHMkQIgASABIAJqIANB//8DcRD7BQwDCyAAIAAoAgBB0IYDajYCACABQYB/ciEBCyAAIAE6AAULQQAvAcyRAiIEIQFBACgCxJECIgUhAyAALQAEQQNqQfwDcSAAakEIaiIGIQAgBiECIAYgBWsgBEgNAgwDC0EALwHMkQIiAyECQQAoAsSRAiIGIQEgBCAGayADSA0ACwsLC/oCAQR/AkACQBAhDQAgAUGAAk8NAUEAQQAtAM6RAkEBaiIEOgDOkQIgAC0ABCAEQQh0IAFB/wFxckGAgH5yIgVB//8DcSACIAMQmgYaAkBBACgCxJECDQBBgAEQHyEBQQBBkwI2AsiRAkEAIAE2AsSRAgsCQCADQQhqIgZBgAFKDQBBAC8BzJECIgEhBwJAAkBBgAEgAWsgBkgNACABIQQgByEBDAELIAEhBANAQQAgBEEAKALEkQIiAS0ABEEDakH8A3FBCGoiBGsiBzsBzJECIAEgASAEaiAHQf//A3EQ+wVBAC8BzJECIgEhBEGAASABayAGSA0ACyABIQQgASEBC0EAKALEkQIgAWoiASAFOwEGIAEgAzoABCABIAAtAAQ6AAUgAUEIaiACIAMQoQYaIAFBACgC4PsBQaCcAWo2AgBBACADQf8BcUEDakH8A3EgBGpBCGo7AcyRAgsPC0GszABB3QBBjw4Q/gUAC0GszABBI0GXPBD+BQALGwACQEEAKALQkQINAEEAQYAQENkFNgLQkQILCzsBAX8CQCAADQBBAA8LQQAhAQJAIAAQ6wVFDQAgACAALQADQcAAcjoAA0EAKALQkQIgABDWBSEBCyABCwwAQQAoAtCRAhDXBQsMAEEAKALQkQIQ2AULTQECf0EAIQECQCAAEOYCRQ0AQQAhAUEAKALUkQIgABDWBSICRQ0AQbAvQQAQOyACIQELIAEhAQJAIAAQlAZFDQBBni9BABA7CxBEIAELUgECfyAAEEYaQQAhAQJAIAAQ5gJFDQBBACEBQQAoAtSRAiAAENYFIgJFDQBBsC9BABA7IAIhAQsgASEBAkAgABCUBkUNAEGeL0EAEDsLEEQgAQsbAAJAQQAoAtSRAg0AQQBBgAgQ2QU2AtSRAgsLrwEBAn8CQAJAAkAQIQ0AQdyRAiAAIAEgAxD9BSIEIQUCQCAEDQBBABD2BTcC4JECQdyRAhD5BUHckQIQmAYaQdyRAhD8BUHckQIgACABIAMQ/QUiASEFIAFFDQILIAUhAQJAIANFDQAgAkUNAyABIAIgAxChBhoLQQAPC0GGzABB5gBBtjsQ/gUAC0Gz1gBBhswAQe4AQbY7EIMGAAtB6NYAQYbMAEH2AEG2OxCDBgALRwECfwJAQQAtANiRAg0AQQAhAAJAQQAoAtSRAhDXBSIBRQ0AQQBBAToA2JECIAEhAAsgAA8LQfQuQYbMAEGIAUGhNhCDBgALRgACQEEALQDYkQJFDQBBACgC1JECENgFQQBBADoA2JECAkBBACgC1JECENcFRQ0AEEQLDwtB9S5BhswAQbABQckREIMGAAtIAAJAECENAAJAQQAtAN6RAkUNAEEAEPYFNwLgkQJB3JECEPkFQdyRAhCYBhoQ6QVB3JECEPwFCw8LQYbMAEG9AUHSLBD+BQALBgBB2JMCC08CAX4CfwJAAkAgAL0iAUI0iKdB/w9xIgJB/w9GDQBBBCEDIAINAUECQQMgAUL///////////8Ag1AbDwsgAUL/////////B4NQIQMLIAMLBAAgAAuOBAEDfwJAIAJBgARJDQAgACABIAIQESAADwsgACACaiEDAkACQCABIABzQQNxDQACQAJAIABBA3ENACAAIQIMAQsCQCACDQAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBwABqIQEgAkHAAGoiAiAFTQ0ACwsgAiAETw0BA0AgAiABKAIANgIAIAFBBGohASACQQRqIgIgBEkNAAwCCwALAkAgA0EETw0AIAAhAgwBCwJAIANBfGoiBCAATw0AIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAiABLQABOgABIAIgAS0AAjoAAiACIAEtAAM6AAMgAUEEaiEBIAJBBGoiAiAETQ0ACwsCQCACIANPDQADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAv3AgECfwJAIAAgAUYNAAJAIAEgACACaiIDa0EAIAJBAXRrSw0AIAAgASACEKEGDwsgASAAc0EDcSEEAkACQAJAIAAgAU8NAAJAIARFDQAgACEDDAMLAkAgAEEDcQ0AIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcUUNAgwACwALAkAgBA0AAkAgA0EDcUUNAANAIAJFDQUgACACQX9qIgJqIgMgASACai0AADoAACADQQNxDQALCyACQQNNDQADQCAAIAJBfGoiAmogASACaigCADYCACACQQNLDQALCyACRQ0CA0AgACACQX9qIgJqIAEgAmotAAA6AAAgAg0ADAMLAAsgAkEDTQ0AA0AgAyABKAIANgIAIAFBBGohASADQQRqIQMgAkF8aiICQQNLDQALCyACRQ0AA0AgAyABLQAAOgAAIANBAWohAyABQQFqIQEgAkF/aiICDQALCyAAC/ICAgN/AX4CQCACRQ0AIAAgAToAACACIABqIgNBf2ogAToAACACQQNJDQAgACABOgACIAAgAToAASADQX1qIAE6AAAgA0F+aiABOgAAIAJBB0kNACAAIAE6AAMgA0F8aiABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQXxqIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkF4aiABNgIAIAJBdGogATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBcGogATYCACACQWxqIAE2AgAgAkFoaiABNgIAIAJBZGogATYCACAEIANBBHFBGHIiBWsiAkEgSQ0AIAGtQoGAgIAQfiEGIAMgBWohAQNAIAEgBjcDGCABIAY3AxAgASAGNwMIIAEgBjcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACwQAQQELAgALvQIBA38CQCAADQBBACEBAkBBACgC3JMCRQ0AQQAoAtyTAhCmBiEBCwJAQQAoAuDvAUUNAEEAKALg7wEQpgYgAXIhAQsCQBC8BigCACIARQ0AA0BBACECAkAgACgCTEEASA0AIAAQpAYhAgsCQCAAKAIUIAAoAhxGDQAgABCmBiABciEBCwJAIAJFDQAgABClBgsgACgCOCIADQALCxC9BiABDwtBACECAkAgACgCTEEASA0AIAAQpAYhAgsCQAJAAkAgACgCFCAAKAIcRg0AIABBAEEAIAAoAiQRBgAaIAAoAhQNAEF/IQEgAg0BDAILAkAgACgCBCIBIAAoAggiA0YNACAAIAEgA2usQQEgACgCKBERABoLQQAhASAAQQA2AhwgAEIANwMQIABCADcCBCACRQ0BCyAAEKUGCyABC7IEAgR+An8CQAJAIAG9IgJCAYYiA1ANACABEKgGIQQgAL0iBUI0iKdB/w9xIgZB/w9GDQAgBEL///////////8Ag0KBgICAgICA+P8AVA0BCyAAIAGiIgEgAaMPCwJAIAVCAYYiBCADVg0AIABEAAAAAAAAAACiIAAgBCADURsPCyACQjSIp0H/D3EhBwJAAkAgBg0AQQAhBgJAIAVCDIYiA0IAUw0AA0AgBkF/aiEGIANCAYYiA0J/VQ0ACwsgBUEBIAZrrYYhAwwBCyAFQv////////8Hg0KAgICAgICACIQhAwsCQAJAIAcNAEEAIQcCQCACQgyGIgRCAFMNAANAIAdBf2ohByAEQgGGIgRCf1UNAAsLIAJBASAHa62GIQIMAQsgAkL/////////B4NCgICAgICAgAiEIQILAkAgBiAHTA0AA0ACQCADIAJ9IgRCAFMNACAEIQMgBEIAUg0AIABEAAAAAAAAAACiDwsgA0IBhiEDIAZBf2oiBiAHSg0ACyAHIQYLAkAgAyACfSIEQgBTDQAgBCEDIARCAFINACAARAAAAAAAAAAAog8LAkACQCADQv////////8HWA0AIAMhBAwBCwNAIAZBf2ohBiADQoCAgICAgIAEVCEHIANCAYYiBCEDIAcNAAsLIAVCgICAgICAgICAf4MhAwJAAkAgBkEBSA0AIARCgICAgICAgHh8IAatQjSGhCEEDAELIARBASAGa62IIQQLIAQgA4S/CwUAIAC9Cw4AIAAoAjwgASACELoGC+UCAQd/IwBBIGsiAyQAIAMgACgCHCIENgIQIAAoAhQhBSADIAI2AhwgAyABNgIYIAMgBSAEayIBNgIUIAEgAmohBiADQRBqIQRBAiEHAkACQAJAAkACQCAAKAI8IANBEGpBAiADQQxqEBIQ5wZFDQAgBCEFDAELA0AgBiADKAIMIgFGDQICQCABQX9KDQAgBCEFDAQLIAQgASAEKAIEIghLIglBA3RqIgUgBSgCACABIAhBACAJG2siCGo2AgAgBEEMQQQgCRtqIgQgBCgCACAIazYCACAGIAFrIQYgBSEEIAAoAjwgBSAHIAlrIgcgA0EMahASEOcGRQ0ACwsgBkF/Rw0BCyAAIAAoAiwiATYCHCAAIAE2AhQgACABIAAoAjBqNgIQIAIhAQwBC0EAIQEgAEEANgIcIABCADcDECAAIAAoAgBBIHI2AgAgB0ECRg0AIAIgBSgCBGshAQsgA0EgaiQAIAELDAAgACgCPBCgBhAQC4EBAQJ/IAAgACgCSCIBQX9qIAFyNgJIAkAgACgCFCAAKAIcRg0AIABBAEEAIAAoAiQRBgAaCyAAQQA2AhwgAEIANwMQAkAgACgCACIBQQRxRQ0AIAAgAUEgcjYCAEF/DwsgACAAKAIsIAAoAjBqIgI2AgggACACNgIEIAFBG3RBH3ULXAEBfyAAIAAoAkgiAUF/aiABcjYCSAJAIAAoAgAiAUEIcUUNACAAIAFBIHI2AgBBfw8LIABCADcCBCAAIAAoAiwiATYCHCAAIAE2AhQgACABIAAoAjBqNgIQQQALzgEBA38CQAJAIAIoAhAiAw0AQQAhBCACEK0GDQEgAigCECEDCwJAIAMgAigCFCIFayABTw0AIAIgACABIAIoAiQRBgAPCwJAAkAgAigCUEEATg0AQQAhAwwBCyABIQQDQAJAIAQiAw0AQQAhAwwCCyAAIANBf2oiBGotAABBCkcNAAsgAiAAIAMgAigCJBEGACIEIANJDQEgACADaiEAIAEgA2shASACKAIUIQULIAUgACABEKEGGiACIAIoAhQgAWo2AhQgAyABaiEECyAEC1sBAn8gAiABbCEEAkACQCADKAJMQX9KDQAgACAEIAMQrgYhAAwBCyADEKQGIQUgACAEIAMQrgYhACAFRQ0AIAMQpQYLAkAgACAERw0AIAJBACABGw8LIAAgAW4LBABBAAsEAEEACwIACwIACyQARAAAAAAAAPC/RAAAAAAAAPA/IAAbELUGRAAAAAAAAAAAowsVAQF/IwBBEGsiASAAOQMIIAErAwgLDAAgACAAoSIAIACjC9MEAwF/An4GfCAAELgGIQECQCAAvSICQoCAgICAgICJQHxC//////+fwgFWDQACQCACQoCAgICAgID4P1INAEQAAAAAAAAAAA8LIABEAAAAAAAA8L+gIgAgACAARAAAAAAAAKBBoiIEoCAEoSIEIASiQQArA9CbASIFoiIGoCIHIAAgACAAoiIIoiIJIAkgCSAJQQArA6CcAaIgCEEAKwOYnAGiIABBACsDkJwBokEAKwOInAGgoKCiIAhBACsDgJwBoiAAQQArA/ibAaJBACsD8JsBoKCgoiAIQQArA+ibAaIgAEEAKwPgmwGiQQArA9ibAaCgoKIgACAEoSAFoiAAIASgoiAGIAAgB6GgoKCgDwsCQAJAIAFBkIB+akGfgH5LDQACQCACQv///////////wCDQgBSDQBBARC0Bg8LIAJCgICAgICAgPj/AFENAQJAAkAgAUH//wFLDQAgAUHw/wFxQfD/AUcNAQsgABC2Bg8LIABEAAAAAAAAMEOivUKAgICAgICA4Hx8IQILIAJCgICAgICAgI1AfCIDQjSHp7ciCEEAKwOYmwGiIANCLYinQf8AcUEEdCIBQbCcAWorAwCgIgkgAUGonAFqKwMAIAIgA0KAgICAgICAeIN9vyABQaisAWorAwChIAFBsKwBaisDAKGiIgCgIgUgACAAIACiIgSiIAQgAEEAKwPImwGiQQArA8CbAaCiIABBACsDuJsBokEAKwOwmwGgoKIgBEEAKwOomwGiIAhBACsDoJsBoiAAIAkgBaGgoKCgoCEACyAACwkAIAC9QjCIpwvuAwMBfgN/BnwCQAJAAkACQAJAIAC9IgFCAFMNACABQiCIpyICQf//P0sNAQsCQCABQv///////////wCDQgBSDQBEAAAAAAAA8L8gACAAoqMPCyABQn9VDQEgACAAoUQAAAAAAAAAAKMPCyACQf//v/8HSw0CQYCAwP8DIQNBgXghBAJAIAJBgIDA/wNGDQAgAiEDDAILIAGnDQFEAAAAAAAAAAAPCyAARAAAAAAAAFBDor0iAUIgiKchA0HLdyEECyAEIANB4r4laiICQRR2arciBUQAYJ9QE0TTP6IiBiACQf//P3FBnsGa/wNqrUIghiABQv////8Pg4S/RAAAAAAAAPC/oCIAIAAgAEQAAAAAAADgP6KiIgehvUKAgICAcIO/IghEAAAgFXvL2z+iIgmgIgogCSAGIAqhoCAAIABEAAAAAAAAAECgoyIGIAcgBiAGoiIJIAmiIgYgBiAGRJ/GeNAJmsM/okSveI4dxXHMP6CiRAT6l5mZmdk/oKIgCSAGIAYgBkREUj7fEvHCP6JE3gPLlmRGxz+gokRZkyKUJEnSP6CiRJNVVVVVVeU/oKKgoKIgACAIoSAHoaAiAEQAACAVe8vbP6IgBUQ2K/ER8/5ZPaIgACAIoETVrZrKOJS7PaKgoKCgIQALIAALOQEBfyMAQRBrIgMkACAAIAEgAkH/AXEgA0EIahCJBxDnBiECIAMpAwghASADQRBqJABCfyABIAIbC4cBAQJ/AkACQAJAIAJBBEkNACABIAByQQNxDQEDQCAAKAIAIAEoAgBHDQIgAUEEaiEBIABBBGohACACQXxqIgJBA0sNAAsLIAJFDQELAkADQCAALQAAIgMgAS0AACIERw0BIAFBAWohASAAQQFqIQAgAkF/aiICRQ0CDAALAAsgAyAEaw8LQQALDQBB4JMCELIGQeSTAgsJAEHgkwIQswYLEAAgAZogASAAGxC/BiABogsVAQF/IwBBEGsiASAAOQMIIAErAwgLEAAgAEQAAAAAAAAAcBC+BgsQACAARAAAAAAAAAAQEL4GCwUAIACZC+YEAwZ/A34CfCMAQRBrIgIkACAAEMQGIQMgARDEBiIEQf8PcSIFQcJ3aiEGIAG9IQggAL0hCQJAAkACQCADQYFwakGCcEkNAEEAIQcgBkH/fksNAQsCQCAIEMUGRQ0ARAAAAAAAAPA/IQsgCUKAgICAgICA+D9RDQIgCEIBhiIKUA0CAkACQCAJQgGGIglCgICAgICAgHBWDQAgCkKBgICAgICAcFQNAQsgACABoCELDAMLIAlCgICAgICAgPD/AFENAkQAAAAAAAAAACABIAGiIAlC/////////+//AFYgCEJ/VXMbIQsMAgsCQCAJEMUGRQ0AIAAgAKIhCwJAIAlCf1UNACALmiALIAgQxgZBAUYbIQsLIAhCf1UNAkQAAAAAAADwPyALoxDHBiELDAILQQAhBwJAIAlCf1UNAAJAIAgQxgYiBw0AIAAQtgYhCwwDCyADQf8PcSEDIAlC////////////AIMhCSAHQQFGQRJ0IQcLAkAgBkH/fksNAEQAAAAAAADwPyELIAlCgICAgICAgPg/UQ0CAkAgBUG9B0sNACABIAGaIAlCgICAgICAgPg/VhtEAAAAAAAA8D+gIQsMAwsCQCAEQYAQSSAJQoGAgICAgID4P1RGDQBBABDABiELDAMLQQAQwQYhCwwCCyADDQAgAEQAAAAAAAAwQ6K9Qv///////////wCDQoCAgICAgIDgfHwhCQsgCEKAgIBAg78iCyAJIAJBCGoQyAYiDL1CgICAQIO/IgCiIAEgC6EgAKIgAisDCCAMIAChoCABoqAgBxDJBiELCyACQRBqJAAgCwsJACAAvUI0iKcLGwAgAEIBhkKAgICAgICAEHxCgYCAgICAgBBUC1UCAn8BfkEAIQECQCAAQjSIp0H/D3EiAkH/B0kNAEECIQEgAkGzCEsNAEEAIQFCAUGzCCACa62GIgNCf3wgAINCAFINAEECQQEgAyAAg1AbIQELIAELFQEBfyMAQRBrIgEgADkDCCABKwMIC7MCAwF+BnwBfyABIABCgICAgLDV2oxAfCICQjSHp7ciA0EAKwOgzQGiIAJCLYinQf8AcUEFdCIJQfjNAWorAwCgIAAgAkKAgICAgICAeIN9IgBCgICAgAh8QoCAgIBwg78iBCAJQeDNAWorAwAiBaJEAAAAAAAA8L+gIgYgAL8gBKEgBaIiBaAiBCADQQArA5jNAaIgCUHwzQFqKwMAoCIDIAQgA6AiA6GgoCAFIARBACsDqM0BIgeiIgggBiAHoiIHoKKgIAYgB6IiBiADIAMgBqAiBqGgoCAEIAQgCKIiA6IgAyADIARBACsD2M0BokEAKwPQzQGgoiAEQQArA8jNAaJBACsDwM0BoKCiIARBACsDuM0BokEAKwOwzQGgoKKgIgQgBiAGIASgIgShoDkDACAEC7wCAwJ/AnwCfgJAIAAQxAZB/w9xIgNEAAAAAAAAkDwQxAYiBGtEAAAAAAAAgEAQxAYgBGtJDQACQCADIARPDQAgAEQAAAAAAADwP6AiAJogACACGw8LIANEAAAAAAAAkEAQxAZJIQRBACEDIAQNAAJAIAC9Qn9VDQAgAhDBBg8LIAIQwAYPC0EAKwOovAEgAKJBACsDsLwBIgWgIgYgBaEiBUEAKwPAvAGiIAVBACsDuLwBoiAAoKAgAaAiACAAoiIBIAGiIABBACsD4LwBokEAKwPYvAGgoiABIABBACsD0LwBokEAKwPIvAGgoiAGvSIHp0EEdEHwD3EiBEGYvQFqKwMAIACgoKAhACAEQaC9AWopAwAgByACrXxCLYZ8IQgCQCADDQAgACAIIAcQygYPCyAIvyIBIACiIAGgC+UBAQR8AkAgAkKAgICACINCAFINACABQoCAgICAgID4QHy/IgMgAKIgA6BEAAAAAAAAAH+iDwsCQCABQoCAgICAgIDwP3wiAr8iAyAAoiIEIAOgIgAQwgZEAAAAAAAA8D9jRQ0ARAAAAAAAABAAEMcGRAAAAAAAABAAohDLBiACQoCAgICAgICAgH+DvyAARAAAAAAAAPC/RAAAAAAAAPA/IABEAAAAAAAAAABjGyIFoCIGIAQgAyAAoaAgACAFIAahoKCgIAWhIgAgAEQAAAAAAAAAAGEbIQALIABEAAAAAAAAEACiCwwAIwBBEGsgADkDCAu3AQMBfgF/AXwCQCAAvSIBQjSIp0H/D3EiAkGyCEsNAAJAIAJB/QdLDQAgAEQAAAAAAAAAAKIPCwJAAkAgACAAmiABQn9VGyIARAAAAAAAADBDoEQAAAAAAAAww6AgAKEiA0QAAAAAAADgP2RFDQAgACADoEQAAAAAAADwv6AhAAwBCyAAIAOgIQAgA0QAAAAAAADgv2VFDQAgAEQAAAAAAADwP6AhAAsgACAAmiABQn9VGyEACyAACxoAIAAgARDOBiIAQQAgAC0AACABQf8BcUYbC+QBAQJ/AkACQCABQf8BcSICRQ0AAkAgAEEDcUUNAANAIAAtAAAiA0UNAyADIAFB/wFxRg0DIABBAWoiAEEDcQ0ACwsCQCAAKAIAIgNBf3MgA0H//ft3anFBgIGChHhxDQAgAkGBgoQIbCECA0AgAyACcyIDQX9zIANB//37d2pxQYCBgoR4cQ0BIAAoAgQhAyAAQQRqIQAgA0F/cyADQf/9+3dqcUGAgYKEeHFFDQALCwJAA0AgACIDLQAAIgJFDQEgA0EBaiEAIAIgAUH/AXFHDQALCyADDwsgACAAENAGag8LIAALWQECfyABLQAAIQICQCAALQAAIgNFDQAgAyACQf8BcUcNAANAIAEtAAEhAiAALQABIgNFDQEgAUEBaiEBIABBAWohACADIAJB/wFxRg0ACwsgAyACQf8BcWsLhQEBA38gACEBAkACQCAAQQNxRQ0AAkAgAC0AAA0AIAAgAGsPCyAAIQEDQCABQQFqIgFBA3FFDQEgAS0AAA0ADAILAAsDQCABIgJBBGohASACKAIAIgNBf3MgA0H//ft3anFBgIGChHhxRQ0ACwNAIAIiAUEBaiECIAEtAAANAAsLIAEgAGsL5QEBAn8gAkEARyEDAkACQAJAIABBA3FFDQAgAkUNACABQf8BcSEEA0AgAC0AACAERg0CIAJBf2oiAkEARyEDIABBAWoiAEEDcUUNASACDQALCyADRQ0BAkAgAC0AACABQf8BcUYNACACQQRJDQAgAUH/AXFBgYKECGwhBANAIAAoAgAgBHMiA0F/cyADQf/9+3dqcUGAgYKEeHENAiAAQQRqIQAgAkF8aiICQQNLDQALCyACRQ0BCyABQf8BcSEDA0ACQCAALQAAIANHDQAgAA8LIABBAWohACACQX9qIgINAAsLQQALjAEBAn8CQCABLAAAIgINACAADwtBACEDAkAgACACEM0GIgBFDQACQCABLQABDQAgAA8LIAAtAAFFDQACQCABLQACDQAgACABENMGDwsgAC0AAkUNAAJAIAEtAAMNACAAIAEQ1AYPCyAALQADRQ0AAkAgAS0ABA0AIAAgARDVBg8LIAAgARDWBiEDCyADC3cBBH8gAC0AASICQQBHIQMCQCACRQ0AIAAtAABBCHQgAnIiBCABLQAAQQh0IAEtAAFyIgVGDQAgAEEBaiEBA0AgASIALQABIgJBAEchAyACRQ0BIABBAWohASAEQQh0QYD+A3EgAnIiBCAFRw0ACwsgAEEAIAMbC5kBAQR/IABBAmohAiAALQACIgNBAEchBAJAAkAgA0UNACAALQABQRB0IAAtAABBGHRyIANBCHRyIgMgAS0AAUEQdCABLQAAQRh0ciABLQACQQh0ciIFRg0AA0AgAkEBaiEBIAItAAEiAEEARyEEIABFDQIgASECIAMgAHJBCHQiAyAFRw0ADAILAAsgAiEBCyABQX5qQQAgBBsLqwEBBH8gAEEDaiECIAAtAAMiA0EARyEEAkACQCADRQ0AIAAtAAFBEHQgAC0AAEEYdHIgAC0AAkEIdHIgA3IiBSABKAAAIgBBGHQgAEGA/gNxQQh0ciAAQQh2QYD+A3EgAEEYdnJyIgFGDQADQCACQQFqIQMgAi0AASIAQQBHIQQgAEUNAiADIQIgBUEIdCAAciIFIAFHDQAMAgsACyACIQMLIANBfWpBACAEGwuOBwENfyMAQaAIayICJAAgAkGYCGpCADcDACACQZAIakIANwMAIAJCADcDiAggAkIANwOACEEAIQMCQAJAAkACQAJAAkAgAS0AACIEDQBBfyEFQQEhBgwBCwNAIAAgA2otAABFDQQgAiAEQf8BcUECdGogA0EBaiIDNgIAIAJBgAhqIARBA3ZBHHFqIgYgBigCAEEBIAR0cjYCACABIANqLQAAIgQNAAtBASEGQX8hBSADQQFLDQELQX8hB0EBIQgMAQtBACEIQQEhCUEBIQQDQAJAAkAgASAEIAVqai0AACIHIAEgBmotAAAiCkcNAAJAIAQgCUcNACAJIAhqIQhBASEEDAILIARBAWohBAwBCwJAIAcgCk0NACAGIAVrIQlBASEEIAYhCAwBC0EBIQQgCCEFIAhBAWohCEEBIQkLIAQgCGoiBiADSQ0AC0EBIQhBfyEHAkAgA0EBSw0AIAkhBgwBC0EAIQZBASELQQEhBANAAkACQCABIAQgB2pqLQAAIgogASAIai0AACIMRw0AAkAgBCALRw0AIAsgBmohBkEBIQQMAgsgBEEBaiEEDAELAkAgCiAMTw0AIAggB2shC0EBIQQgCCEGDAELQQEhBCAGIQcgBkEBaiEGQQEhCwsgBCAGaiIIIANJDQALIAkhBiALIQgLAkACQCABIAEgCCAGIAdBAWogBUEBaksiBBsiDWogByAFIAQbIgtBAWoiChC7BkUNACALIAMgC0F/c2oiBCALIARLG0EBaiENQQAhDgwBCyADIA1rIQ4LIANBf2ohCSADQT9yIQxBACEHIAAhBgNAAkAgACAGayADTw0AAkAgAEEAIAwQ0QYiBEUNACAEIQAgBCAGayADSQ0DDAELIAAgDGohAAsCQAJAAkAgAkGACGogBiAJai0AACIEQQN2QRxxaigCACAEdkEBcQ0AIAMhBAwBCwJAIAMgAiAEQQJ0aigCACIERg0AIAMgBGsiBCAHIAQgB0sbIQQMAQsgCiEEAkACQCABIAogByAKIAdLGyIIai0AACIFRQ0AA0AgBUH/AXEgBiAIai0AAEcNAiABIAhBAWoiCGotAAAiBQ0ACyAKIQQLA0AgBCAHTQ0GIAEgBEF/aiIEai0AACAGIARqLQAARg0ACyANIQQgDiEHDAILIAggC2shBAtBACEHCyAGIARqIQYMAAsAC0EAIQYLIAJBoAhqJAAgBgtBAQJ/IwBBEGsiASQAQX8hAgJAIAAQrAYNACAAIAFBD2pBASAAKAIgEQYAQQFHDQAgAS0ADyECCyABQRBqJAAgAgtHAQJ/IAAgATcDcCAAIAAoAiwgACgCBCICa6w3A3ggACgCCCEDAkAgAVANACADIAJrrCABVw0AIAIgAadqIQMLIAAgAzYCaAvdAQIDfwJ+IAApA3ggACgCBCIBIAAoAiwiAmusfCEEAkACQAJAIAApA3AiBVANACAEIAVZDQELIAAQ1wYiAkF/Sg0BIAAoAgQhASAAKAIsIQILIABCfzcDcCAAIAE2AmggACAEIAIgAWusfDcDeEF/DwsgBEIBfCEEIAAoAgQhASAAKAIIIQMCQCAAKQNwIgVCAFENACAFIAR9IgUgAyABa6xZDQAgASAFp2ohAwsgACADNgJoIAAgBCAAKAIsIgMgAWusfDcDeAJAIAEgA0sNACABQX9qIAI6AAALIAILEAAgAEEgRiAAQXdqQQVJcguuAQACQAJAIAFBgAhIDQAgAEQAAAAAAADgf6IhAAJAIAFB/w9PDQAgAUGBeGohAQwCCyAARAAAAAAAAOB/oiEAIAFB/RcgAUH9F0gbQYJwaiEBDAELIAFBgXhKDQAgAEQAAAAAAABgA6IhAAJAIAFBuHBNDQAgAUHJB2ohAQwBCyAARAAAAAAAAGADoiEAIAFB8GggAUHwaEobQZIPaiEBCyAAIAFB/wdqrUI0hr+iCzUAIAAgATcDACAAIARCMIinQYCAAnEgAkIwiKdB//8BcXKtQjCGIAJC////////P4OENwMIC+cCAQF/IwBB0ABrIgQkAAJAAkAgA0GAgAFIDQAgBEEgaiABIAJCAEKAgICAgICA//8AEPgGIARBIGpBCGopAwAhAiAEKQMgIQECQCADQf//AU8NACADQYGAf2ohAwwCCyAEQRBqIAEgAkIAQoCAgICAgID//wAQ+AYgA0H9/wIgA0H9/wJIG0GCgH5qIQMgBEEQakEIaikDACECIAQpAxAhAQwBCyADQYGAf0oNACAEQcAAaiABIAJCAEKAgICAgICAORD4BiAEQcAAakEIaikDACECIAQpA0AhAQJAIANB9IB+TQ0AIANBjf8AaiEDDAELIARBMGogASACQgBCgICAgICAgDkQ+AYgA0HogX0gA0HogX1KG0Ga/gFqIQMgBEEwakEIaikDACECIAQpAzAhAQsgBCABIAJCACADQf//AGqtQjCGEPgGIAAgBEEIaikDADcDCCAAIAQpAwA3AwAgBEHQAGokAAtLAgF+An8gAUL///////8/gyECAkACQCABQjCIp0H//wFxIgNB//8BRg0AQQQhBCADDQFBAkEDIAIgAIRQGw8LIAIgAIRQIQQLIAQL1QYCBH8DfiMAQYABayIFJAACQAJAAkAgAyAEQgBCABDuBkUNACADIAQQ3gYhBiACQjCIpyIHQf//AXEiCEH//wFGDQAgBg0BCyAFQRBqIAEgAiADIAQQ+AYgBSAFKQMQIgQgBUEQakEIaikDACIDIAQgAxDwBiAFQQhqKQMAIQIgBSkDACEEDAELAkAgASACQv///////////wCDIgkgAyAEQv///////////wCDIgoQ7gZBAEoNAAJAIAEgCSADIAoQ7gZFDQAgASEEDAILIAVB8ABqIAEgAkIAQgAQ+AYgBUH4AGopAwAhAiAFKQNwIQQMAQsgBEIwiKdB//8BcSEGAkACQCAIRQ0AIAEhBAwBCyAFQeAAaiABIAlCAEKAgICAgIDAu8AAEPgGIAVB6ABqKQMAIglCMIinQYh/aiEIIAUpA2AhBAsCQCAGDQAgBUHQAGogAyAKQgBCgICAgICAwLvAABD4BiAFQdgAaikDACIKQjCIp0GIf2ohBiAFKQNQIQMLIApC////////P4NCgICAgICAwACEIQsgCUL///////8/g0KAgICAgIDAAIQhCQJAIAggBkwNAANAAkACQCAJIAt9IAQgA1StfSIKQgBTDQACQCAKIAQgA30iBIRCAFINACAFQSBqIAEgAkIAQgAQ+AYgBUEoaikDACECIAUpAyAhBAwFCyAKQgGGIARCP4iEIQkMAQsgCUIBhiAEQj+IhCEJCyAEQgGGIQQgCEF/aiIIIAZKDQALIAYhCAsCQAJAIAkgC30gBCADVK19IgpCAFkNACAJIQoMAQsgCiAEIAN9IgSEQgBSDQAgBUEwaiABIAJCAEIAEPgGIAVBOGopAwAhAiAFKQMwIQQMAQsCQCAKQv///////z9WDQADQCAEQj+IIQMgCEF/aiEIIARCAYYhBCADIApCAYaEIgpCgICAgICAwABUDQALCyAHQYCAAnEhBgJAIAhBAEoNACAFQcAAaiAEIApC////////P4MgCEH4AGogBnKtQjCGhEIAQoCAgICAgMDDPxD4BiAFQcgAaikDACECIAUpA0AhBAwBCyAKQv///////z+DIAggBnKtQjCGhCECCyAAIAQ3AwAgACACNwMIIAVBgAFqJAALHAAgACACQv///////////wCDNwMIIAAgATcDAAuFCQIFfwN+IwBBMGsiBCQAQgAhCQJAAkAgAkECSw0AIAJBAnQiAkGs7gFqKAIAIQUgAkGg7gFqKAIAIQYDQAJAAkAgASgCBCICIAEoAmhGDQAgASACQQFqNgIEIAItAAAhAgwBCyABENkGIQILIAIQ2gYNAAtBASEHAkACQCACQVVqDgMAAQABC0F/QQEgAkEtRhshBwJAIAEoAgQiAiABKAJoRg0AIAEgAkEBajYCBCACLQAAIQIMAQsgARDZBiECC0EAIQgCQAJAAkADQCACQSByIAhBgAhqLAAARw0BAkAgCEEGSw0AAkAgASgCBCICIAEoAmhGDQAgASACQQFqNgIEIAItAAAhAgwBCyABENkGIQILIAhBAWoiCEEIRw0ADAILAAsCQCAIQQNGDQAgCEEIRg0BIANFDQIgCEEESQ0CIAhBCEYNAQsCQCABKQNwIglCAFMNACABIAEoAgRBf2o2AgQLIANFDQAgCEEESQ0AIAlCAFMhAgNAAkAgAg0AIAEgASgCBEF/ajYCBAsgCEF/aiIIQQNLDQALCyAEIAeyQwAAgH+UEPIGIARBCGopAwAhCiAEKQMAIQkMAgsCQAJAAkAgCA0AQQAhCANAIAJBIHIgCEG5KGosAABHDQECQCAIQQFLDQACQCABKAIEIgIgASgCaEYNACABIAJBAWo2AgQgAi0AACECDAELIAEQ2QYhAgsgCEEBaiIIQQNHDQAMAgsACwJAAkAgCA4EAAEBAgELAkAgAkEwRw0AAkACQCABKAIEIgggASgCaEYNACABIAhBAWo2AgQgCC0AACEIDAELIAEQ2QYhCAsCQCAIQV9xQdgARw0AIARBEGogASAGIAUgByADEOIGIARBGGopAwAhCiAEKQMQIQkMBgsgASkDcEIAUw0AIAEgASgCBEF/ajYCBAsgBEEgaiABIAIgBiAFIAcgAxDjBiAEQShqKQMAIQogBCkDICEJDAQLQgAhCQJAIAEpA3BCAFMNACABIAEoAgRBf2o2AgQLEJ4GQRw2AgAMAQsCQAJAIAEoAgQiAiABKAJoRg0AIAEgAkEBajYCBCACLQAAIQIMAQsgARDZBiECCwJAAkAgAkEoRw0AQQEhCAwBC0IAIQlCgICAgICA4P//ACEKIAEpA3BCAFMNAyABIAEoAgRBf2o2AgQMAwsDQAJAAkAgASgCBCICIAEoAmhGDQAgASACQQFqNgIEIAItAAAhAgwBCyABENkGIQILIAJBv39qIQcCQAJAIAJBUGpBCkkNACAHQRpJDQAgAkGff2ohByACQd8ARg0AIAdBGk8NAQsgCEEBaiEIDAELC0KAgICAgIDg//8AIQogAkEpRg0CAkAgASkDcCILQgBTDQAgASABKAIEQX9qNgIECwJAAkAgA0UNACAIDQFCACEJDAQLEJ4GQRw2AgBCACEJDAELA0ACQCALQgBTDQAgASABKAIEQX9qNgIEC0IAIQkgCEF/aiIIDQAMAwsACyABIAkQ2AYLQgAhCgsgACAJNwMAIAAgCjcDCCAEQTBqJAALwg8CCH8HfiMAQbADayIGJAACQAJAIAEoAgQiByABKAJoRg0AIAEgB0EBajYCBCAHLQAAIQcMAQsgARDZBiEHC0EAIQhCACEOQQAhCQJAAkACQANAAkAgB0EwRg0AIAdBLkcNBCABKAIEIgcgASgCaEYNAiABIAdBAWo2AgQgBy0AACEHDAMLAkAgASgCBCIHIAEoAmhGDQBBASEJIAEgB0EBajYCBCAHLQAAIQcMAQtBASEJIAEQ2QYhBwwACwALIAEQ2QYhBwtBASEIQgAhDiAHQTBHDQADQAJAAkAgASgCBCIHIAEoAmhGDQAgASAHQQFqNgIEIActAAAhBwwBCyABENkGIQcLIA5Cf3whDiAHQTBGDQALQQEhCEEBIQkLQoCAgICAgMD/PyEPQQAhCkIAIRBCACERQgAhEkEAIQtCACETAkADQCAHQSByIQwCQAJAIAdBUGoiDUEKSQ0AAkAgB0EuRg0AIAxBn39qQQVLDQQLIAdBLkcNACAIDQNBASEIIBMhDgwBCyAMQal/aiANIAdBOUobIQcCQAJAIBNCB1UNACAHIApBBHRqIQoMAQsCQCATQhxWDQAgBkEwaiAHEPMGIAZBIGogEiAPQgBCgICAgICAwP0/EPgGIAZBEGogBikDMCAGQTBqQQhqKQMAIAYpAyAiEiAGQSBqQQhqKQMAIg8Q+AYgBiAGKQMQIAZBEGpBCGopAwAgECAREOwGIAZBCGopAwAhESAGKQMAIRAMAQsgB0UNACALDQAgBkHQAGogEiAPQgBCgICAgICAgP8/EPgGIAZBwABqIAYpA1AgBkHQAGpBCGopAwAgECAREOwGIAZBwABqQQhqKQMAIRFBASELIAYpA0AhEAsgE0IBfCETQQEhCQsCQCABKAIEIgcgASgCaEYNACABIAdBAWo2AgQgBy0AACEHDAELIAEQ2QYhBwwACwALAkACQCAJDQACQAJAAkAgASkDcEIAUw0AIAEgASgCBCIHQX9qNgIEIAVFDQEgASAHQX5qNgIEIAhFDQIgASAHQX1qNgIEDAILIAUNAQsgAUIAENgGCyAGQeAAaiAEt0QAAAAAAAAAAKIQ8QYgBkHoAGopAwAhEyAGKQNgIRAMAQsCQCATQgdVDQAgEyEPA0AgCkEEdCEKIA9CAXwiD0IIUg0ACwsCQAJAAkACQCAHQV9xQdAARw0AIAEgBRDkBiIPQoCAgICAgICAgH9SDQMCQCAFRQ0AIAEpA3BCf1UNAgwDC0IAIRAgAUIAENgGQgAhEwwEC0IAIQ8gASkDcEIAUw0CCyABIAEoAgRBf2o2AgQLQgAhDwsCQCAKDQAgBkHwAGogBLdEAAAAAAAAAACiEPEGIAZB+ABqKQMAIRMgBikDcCEQDAELAkAgDiATIAgbQgKGIA98QmB8IhNBACADa61XDQAQngZBxAA2AgAgBkGgAWogBBDzBiAGQZABaiAGKQOgASAGQaABakEIaikDAEJ/Qv///////7///wAQ+AYgBkGAAWogBikDkAEgBkGQAWpBCGopAwBCf0L///////+///8AEPgGIAZBgAFqQQhqKQMAIRMgBikDgAEhEAwBCwJAIBMgA0GefmqsUw0AAkAgCkF/TA0AA0AgBkGgA2ogECARQgBCgICAgICAwP+/fxDsBiAQIBFCAEKAgICAgICA/z8Q7wYhByAGQZADaiAQIBEgBikDoAMgECAHQX9KIgcbIAZBoANqQQhqKQMAIBEgBxsQ7AYgE0J/fCETIAZBkANqQQhqKQMAIREgBikDkAMhECAKQQF0IAdyIgpBf0oNAAsLAkACQCATIAOsfUIgfCIOpyIHQQAgB0EAShsgAiAOIAKtUxsiB0HxAEgNACAGQYADaiAEEPMGIAZBiANqKQMAIQ5CACEPIAYpA4ADIRJCACEUDAELIAZB4AJqRAAAAAAAAPA/QZABIAdrENsGEPEGIAZB0AJqIAQQ8wYgBkHwAmogBikD4AIgBkHgAmpBCGopAwAgBikD0AIiEiAGQdACakEIaikDACIOENwGIAZB8AJqQQhqKQMAIRQgBikD8AIhDwsgBkHAAmogCiAKQQFxRSAHQSBIIBAgEUIAQgAQ7gZBAEdxcSIHahD0BiAGQbACaiASIA4gBikDwAIgBkHAAmpBCGopAwAQ+AYgBkGQAmogBikDsAIgBkGwAmpBCGopAwAgDyAUEOwGIAZBoAJqIBIgDkIAIBAgBxtCACARIAcbEPgGIAZBgAJqIAYpA6ACIAZBoAJqQQhqKQMAIAYpA5ACIAZBkAJqQQhqKQMAEOwGIAZB8AFqIAYpA4ACIAZBgAJqQQhqKQMAIA8gFBD7BgJAIAYpA/ABIhAgBkHwAWpBCGopAwAiEUIAQgAQ7gYNABCeBkHEADYCAAsgBkHgAWogECARIBOnEN0GIAZB4AFqQQhqKQMAIRMgBikD4AEhEAwBCxCeBkHEADYCACAGQdABaiAEEPMGIAZBwAFqIAYpA9ABIAZB0AFqQQhqKQMAQgBCgICAgICAwAAQ+AYgBkGwAWogBikDwAEgBkHAAWpBCGopAwBCAEKAgICAgIDAABD4BiAGQbABakEIaikDACETIAYpA7ABIRALIAAgEDcDACAAIBM3AwggBkGwA2okAAv5HwMLfwZ+AXwjAEGQxgBrIgckAEEAIQhBACAEayIJIANrIQpCACESQQAhCwJAAkACQANAAkAgAkEwRg0AIAJBLkcNBCABKAIEIgIgASgCaEYNAiABIAJBAWo2AgQgAi0AACECDAMLAkAgASgCBCICIAEoAmhGDQBBASELIAEgAkEBajYCBCACLQAAIQIMAQtBASELIAEQ2QYhAgwACwALIAEQ2QYhAgtBASEIQgAhEiACQTBHDQADQAJAAkAgASgCBCICIAEoAmhGDQAgASACQQFqNgIEIAItAAAhAgwBCyABENkGIQILIBJCf3whEiACQTBGDQALQQEhC0EBIQgLQQAhDCAHQQA2ApAGIAJBUGohDQJAAkACQAJAAkACQAJAIAJBLkYiDg0AQgAhEyANQQlNDQBBACEPQQAhEAwBC0IAIRNBACEQQQAhD0EAIQwDQAJAAkAgDkEBcUUNAAJAIAgNACATIRJBASEIDAILIAtFIQ4MBAsgE0IBfCETAkAgD0H8D0oNACAHQZAGaiAPQQJ0aiEOAkAgEEUNACACIA4oAgBBCmxqQVBqIQ0LIAwgE6cgAkEwRhshDCAOIA02AgBBASELQQAgEEEBaiICIAJBCUYiAhshECAPIAJqIQ8MAQsgAkEwRg0AIAcgBygCgEZBAXI2AoBGQdyPASEMCwJAAkAgASgCBCICIAEoAmhGDQAgASACQQFqNgIEIAItAAAhAgwBCyABENkGIQILIAJBUGohDSACQS5GIg4NACANQQpJDQALCyASIBMgCBshEgJAIAtFDQAgAkFfcUHFAEcNAAJAIAEgBhDkBiIUQoCAgICAgICAgH9SDQAgBkUNBEIAIRQgASkDcEIAUw0AIAEgASgCBEF/ajYCBAsgFCASfCESDAQLIAtFIQ4gAkEASA0BCyABKQNwQgBTDQAgASABKAIEQX9qNgIECyAORQ0BEJ4GQRw2AgALQgAhEyABQgAQ2AZCACESDAELAkAgBygCkAYiAQ0AIAcgBbdEAAAAAAAAAACiEPEGIAdBCGopAwAhEiAHKQMAIRMMAQsCQCATQglVDQAgEiATUg0AAkAgA0EeSg0AIAEgA3YNAQsgB0EwaiAFEPMGIAdBIGogARD0BiAHQRBqIAcpAzAgB0EwakEIaikDACAHKQMgIAdBIGpBCGopAwAQ+AYgB0EQakEIaikDACESIAcpAxAhEwwBCwJAIBIgCUEBdq1XDQAQngZBxAA2AgAgB0HgAGogBRDzBiAHQdAAaiAHKQNgIAdB4ABqQQhqKQMAQn9C////////v///ABD4BiAHQcAAaiAHKQNQIAdB0ABqQQhqKQMAQn9C////////v///ABD4BiAHQcAAakEIaikDACESIAcpA0AhEwwBCwJAIBIgBEGefmqsWQ0AEJ4GQcQANgIAIAdBkAFqIAUQ8wYgB0GAAWogBykDkAEgB0GQAWpBCGopAwBCAEKAgICAgIDAABD4BiAHQfAAaiAHKQOAASAHQYABakEIaikDAEIAQoCAgICAgMAAEPgGIAdB8ABqQQhqKQMAIRIgBykDcCETDAELAkAgEEUNAAJAIBBBCEoNACAHQZAGaiAPQQJ0aiICKAIAIQEDQCABQQpsIQEgEEEBaiIQQQlHDQALIAIgATYCAAsgD0EBaiEPCyASpyEQAkAgDEEJTg0AIAwgEEoNACAQQRFKDQACQCAQQQlHDQAgB0HAAWogBRDzBiAHQbABaiAHKAKQBhD0BiAHQaABaiAHKQPAASAHQcABakEIaikDACAHKQOwASAHQbABakEIaikDABD4BiAHQaABakEIaikDACESIAcpA6ABIRMMAgsCQCAQQQhKDQAgB0GQAmogBRDzBiAHQYACaiAHKAKQBhD0BiAHQfABaiAHKQOQAiAHQZACakEIaikDACAHKQOAAiAHQYACakEIaikDABD4BiAHQeABakEIIBBrQQJ0QYDuAWooAgAQ8wYgB0HQAWogBykD8AEgB0HwAWpBCGopAwAgBykD4AEgB0HgAWpBCGopAwAQ8AYgB0HQAWpBCGopAwAhEiAHKQPQASETDAILIAcoApAGIQECQCADIBBBfWxqQRtqIgJBHkoNACABIAJ2DQELIAdB4AJqIAUQ8wYgB0HQAmogARD0BiAHQcACaiAHKQPgAiAHQeACakEIaikDACAHKQPQAiAHQdACakEIaikDABD4BiAHQbACaiAQQQJ0QdjtAWooAgAQ8wYgB0GgAmogBykDwAIgB0HAAmpBCGopAwAgBykDsAIgB0GwAmpBCGopAwAQ+AYgB0GgAmpBCGopAwAhEiAHKQOgAiETDAELA0AgB0GQBmogDyIOQX9qIg9BAnRqKAIARQ0AC0EAIQwCQAJAIBBBCW8iAQ0AQQAhDQwBC0EAIQ0gAUEJaiABIBBBAEgbIQkCQAJAIA4NAEEAIQ4MAQtBgJTr3ANBCCAJa0ECdEGA7gFqKAIAIgttIQZBACECQQAhAUEAIQ0DQCAHQZAGaiABQQJ0aiIPIA8oAgAiDyALbiIIIAJqIgI2AgAgDUEBakH/D3EgDSABIA1GIAJFcSICGyENIBBBd2ogECACGyEQIAYgDyAIIAtsa2whAiABQQFqIgEgDkcNAAsgAkUNACAHQZAGaiAOQQJ0aiACNgIAIA5BAWohDgsgECAJa0EJaiEQCwNAIAdBkAZqIA1BAnRqIQYCQANAAkAgEEEkSA0AIBBBJEcNAiAGKAIAQdHp+QRPDQILIA5B/w9qIQ9BACELA0AgDiECAkACQCAHQZAGaiAPQf8PcSIBQQJ0aiIONQIAQh2GIAutfCISQoGU69wDWg0AQQAhCwwBCyASIBJCgJTr3AOAIhNCgJTr3AN+fSESIBOnIQsLIA4gEqciDzYCACACIAIgAiABIA8bIAEgDUYbIAEgAkF/akH/D3EiCEcbIQ4gAUF/aiEPIAEgDUcNAAsgDEFjaiEMIAIhDiALRQ0ACwJAAkAgDUF/akH/D3EiDSACRg0AIAIhDgwBCyAHQZAGaiACQf4PakH/D3FBAnRqIgEgASgCACAHQZAGaiAIQQJ0aigCAHI2AgAgCCEOCyAQQQlqIRAgB0GQBmogDUECdGogCzYCAAwBCwsCQANAIA5BAWpB/w9xIREgB0GQBmogDkF/akH/D3FBAnRqIQkDQEEJQQEgEEEtShshDwJAA0AgDSELQQAhAQJAAkADQCABIAtqQf8PcSICIA5GDQEgB0GQBmogAkECdGooAgAiAiABQQJ0QfDtAWooAgAiDUkNASACIA1LDQIgAUEBaiIBQQRHDQALCyAQQSRHDQBCACESQQAhAUIAIRMDQAJAIAEgC2pB/w9xIgIgDkcNACAOQQFqQf8PcSIOQQJ0IAdBkAZqakF8akEANgIACyAHQYAGaiAHQZAGaiACQQJ0aigCABD0BiAHQfAFaiASIBNCAEKAgICA5Zq3jsAAEPgGIAdB4AVqIAcpA/AFIAdB8AVqQQhqKQMAIAcpA4AGIAdBgAZqQQhqKQMAEOwGIAdB4AVqQQhqKQMAIRMgBykD4AUhEiABQQFqIgFBBEcNAAsgB0HQBWogBRDzBiAHQcAFaiASIBMgBykD0AUgB0HQBWpBCGopAwAQ+AYgB0HABWpBCGopAwAhE0IAIRIgBykDwAUhFCAMQfEAaiINIARrIgFBACABQQBKGyADIAEgA0giCBsiAkHwAEwNAkIAIRVCACEWQgAhFwwFCyAPIAxqIQwgDiENIAsgDkYNAAtBgJTr3AMgD3YhCEF/IA90QX9zIQZBACEBIAshDQNAIAdBkAZqIAtBAnRqIgIgAigCACICIA92IAFqIgE2AgAgDUEBakH/D3EgDSALIA1GIAFFcSIBGyENIBBBd2ogECABGyEQIAIgBnEgCGwhASALQQFqQf8PcSILIA5HDQALIAFFDQECQCARIA1GDQAgB0GQBmogDkECdGogATYCACARIQ4MAwsgCSAJKAIAQQFyNgIADAELCwsgB0GQBWpEAAAAAAAA8D9B4QEgAmsQ2wYQ8QYgB0GwBWogBykDkAUgB0GQBWpBCGopAwAgFCATENwGIAdBsAVqQQhqKQMAIRcgBykDsAUhFiAHQYAFakQAAAAAAADwP0HxACACaxDbBhDxBiAHQaAFaiAUIBMgBykDgAUgB0GABWpBCGopAwAQ3wYgB0HwBGogFCATIAcpA6AFIhIgB0GgBWpBCGopAwAiFRD7BiAHQeAEaiAWIBcgBykD8AQgB0HwBGpBCGopAwAQ7AYgB0HgBGpBCGopAwAhEyAHKQPgBCEUCwJAIAtBBGpB/w9xIg8gDkYNAAJAAkAgB0GQBmogD0ECdGooAgAiD0H/ybXuAUsNAAJAIA8NACALQQVqQf8PcSAORg0CCyAHQfADaiAFt0QAAAAAAADQP6IQ8QYgB0HgA2ogEiAVIAcpA/ADIAdB8ANqQQhqKQMAEOwGIAdB4ANqQQhqKQMAIRUgBykD4AMhEgwBCwJAIA9BgMq17gFGDQAgB0HQBGogBbdEAAAAAAAA6D+iEPEGIAdBwARqIBIgFSAHKQPQBCAHQdAEakEIaikDABDsBiAHQcAEakEIaikDACEVIAcpA8AEIRIMAQsgBbchGAJAIAtBBWpB/w9xIA5HDQAgB0GQBGogGEQAAAAAAADgP6IQ8QYgB0GABGogEiAVIAcpA5AEIAdBkARqQQhqKQMAEOwGIAdBgARqQQhqKQMAIRUgBykDgAQhEgwBCyAHQbAEaiAYRAAAAAAAAOg/ohDxBiAHQaAEaiASIBUgBykDsAQgB0GwBGpBCGopAwAQ7AYgB0GgBGpBCGopAwAhFSAHKQOgBCESCyACQe8ASg0AIAdB0ANqIBIgFUIAQoCAgICAgMD/PxDfBiAHKQPQAyAHQdADakEIaikDAEIAQgAQ7gYNACAHQcADaiASIBVCAEKAgICAgIDA/z8Q7AYgB0HAA2pBCGopAwAhFSAHKQPAAyESCyAHQbADaiAUIBMgEiAVEOwGIAdBoANqIAcpA7ADIAdBsANqQQhqKQMAIBYgFxD7BiAHQaADakEIaikDACETIAcpA6ADIRQCQCANQf////8HcSAKQX5qTA0AIAdBkANqIBQgExDgBiAHQYADaiAUIBNCAEKAgICAgICA/z8Q+AYgBykDkAMgB0GQA2pBCGopAwBCAEKAgICAgICAuMAAEO8GIQ0gB0GAA2pBCGopAwAgEyANQX9KIg4bIRMgBykDgAMgFCAOGyEUIBIgFUIAQgAQ7gYhCwJAIAwgDmoiDEHuAGogCkoNACAIIAIgAUcgDUEASHJxIAtBAEdxRQ0BCxCeBkHEADYCAAsgB0HwAmogFCATIAwQ3QYgB0HwAmpBCGopAwAhEiAHKQPwAiETCyAAIBI3AwggACATNwMAIAdBkMYAaiQAC8QEAgR/AX4CQAJAIAAoAgQiAiAAKAJoRg0AIAAgAkEBajYCBCACLQAAIQMMAQsgABDZBiEDCwJAAkACQAJAAkAgA0FVag4DAAEAAQsCQAJAIAAoAgQiAiAAKAJoRg0AIAAgAkEBajYCBCACLQAAIQIMAQsgABDZBiECCyADQS1GIQQgAkFGaiEFIAFFDQEgBUF1Sw0BIAApA3BCAFMNAiAAIAAoAgRBf2o2AgQMAgsgA0FGaiEFQQAhBCADIQILIAVBdkkNAEIAIQYCQCACQVBqQQpPDQBBACEDA0AgAiADQQpsaiEDAkACQCAAKAIEIgIgACgCaEYNACAAIAJBAWo2AgQgAi0AACECDAELIAAQ2QYhAgsgA0FQaiEDAkAgAkFQaiIFQQlLDQAgA0HMmbPmAEgNAQsLIAOsIQYgBUEKTw0AA0AgAq0gBkIKfnwhBgJAAkAgACgCBCICIAAoAmhGDQAgACACQQFqNgIEIAItAAAhAgwBCyAAENkGIQILIAZCUHwhBgJAIAJBUGoiA0EJSw0AIAZCro+F18fC66MBUw0BCwsgA0EKTw0AA0ACQAJAIAAoAgQiAiAAKAJoRg0AIAAgAkEBajYCBCACLQAAIQIMAQsgABDZBiECCyACQVBqQQpJDQALCwJAIAApA3BCAFMNACAAIAAoAgRBf2o2AgQLQgAgBn0gBiAEGyEGDAELQoCAgICAgICAgH8hBiAAKQNwQgBTDQAgACAAKAIEQX9qNgIEQoCAgICAgICAgH8PCyAGC4YBAgF/An4jAEGgAWsiBCQAIAQgATYCPCAEIAE2AhQgBEF/NgIYIARBEGpCABDYBiAEIARBEGogA0EBEOEGIARBCGopAwAhBSAEKQMAIQYCQCACRQ0AIAIgASAEKAIUIAQoAogBaiAEKAI8a2o2AgALIAAgBTcDCCAAIAY3AwAgBEGgAWokAAs1AgF/AXwjAEEQayICJAAgAiAAIAFBARDlBiACKQMAIAJBCGopAwAQ/AYhAyACQRBqJAAgAwsWAAJAIAANAEEADwsQngYgADYCAEF/CwcAPwBBEHQLVAECf0EAKALk7wEiASAAQQdqQXhxIgJqIQACQAJAIAJFDQAgACABTQ0BCwJAIAAQ6AZNDQAgABATRQ0BC0EAIAA2AuTvASABDwsQngZBMDYCAEF/C9gqAQt/IwBBEGsiASQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFLDQACQEEAKALwkwIiAkEQIABBC2pBeHEgAEELSRsiA0EDdiIEdiIAQQNxRQ0AAkACQCAAQX9zQQFxIARqIgVBA3QiBEGYlAJqIgAgBEGglAJqKAIAIgQoAggiA0cNAEEAIAJBfiAFd3E2AvCTAgwBCyADIAA2AgwgACADNgIICyAEQQhqIQAgBCAFQQN0IgVBA3I2AgQgBCAFaiIEIAQoAgRBAXI2AgQMDwsgA0EAKAL4kwIiBk0NAQJAIABFDQACQAJAIAAgBHRBAiAEdCIAQQAgAGtycWgiBEEDdCIAQZiUAmoiBSAAQaCUAmooAgAiACgCCCIHRw0AQQAgAkF+IAR3cSICNgLwkwIMAQsgByAFNgIMIAUgBzYCCAsgACADQQNyNgIEIAAgA2oiByAEQQN0IgQgA2siBUEBcjYCBCAAIARqIAU2AgACQCAGRQ0AIAZBeHFBmJQCaiEDQQAoAoSUAiEEAkACQCACQQEgBkEDdnQiCHENAEEAIAIgCHI2AvCTAiADIQgMAQsgAygCCCEICyADIAQ2AgggCCAENgIMIAQgAzYCDCAEIAg2AggLIABBCGohAEEAIAc2AoSUAkEAIAU2AviTAgwPC0EAKAL0kwIiCUUNASAJaEECdEGglgJqKAIAIgcoAgRBeHEgA2shBCAHIQUCQANAAkAgBSgCECIADQAgBUEUaigCACIARQ0CCyAAKAIEQXhxIANrIgUgBCAFIARJIgUbIQQgACAHIAUbIQcgACEFDAALAAsgBygCGCEKAkAgBygCDCIIIAdGDQAgBygCCCIAQQAoAoCUAkkaIAAgCDYCDCAIIAA2AggMDgsCQCAHQRRqIgUoAgAiAA0AIAcoAhAiAEUNAyAHQRBqIQULA0AgBSELIAAiCEEUaiIFKAIAIgANACAIQRBqIQUgCCgCECIADQALIAtBADYCAAwNC0F/IQMgAEG/f0sNACAAQQtqIgBBeHEhA0EAKAL0kwIiBkUNAEEAIQsCQCADQYACSQ0AQR8hCyADQf///wdLDQAgA0EmIABBCHZnIgBrdkEBcSAAQQF0a0E+aiELC0EAIANrIQQCQAJAAkACQCALQQJ0QaCWAmooAgAiBQ0AQQAhAEEAIQgMAQtBACEAIANBAEEZIAtBAXZrIAtBH0YbdCEHQQAhCANAAkAgBSgCBEF4cSADayICIARPDQAgAiEEIAUhCCACDQBBACEEIAUhCCAFIQAMAwsgACAFQRRqKAIAIgIgAiAFIAdBHXZBBHFqQRBqKAIAIgVGGyAAIAIbIQAgB0EBdCEHIAUNAAsLAkAgACAIcg0AQQAhCEECIAt0IgBBACAAa3IgBnEiAEUNAyAAaEECdEGglgJqKAIAIQALIABFDQELA0AgACgCBEF4cSADayICIARJIQcCQCAAKAIQIgUNACAAQRRqKAIAIQULIAIgBCAHGyEEIAAgCCAHGyEIIAUhACAFDQALCyAIRQ0AIARBACgC+JMCIANrTw0AIAgoAhghCwJAIAgoAgwiByAIRg0AIAgoAggiAEEAKAKAlAJJGiAAIAc2AgwgByAANgIIDAwLAkAgCEEUaiIFKAIAIgANACAIKAIQIgBFDQMgCEEQaiEFCwNAIAUhAiAAIgdBFGoiBSgCACIADQAgB0EQaiEFIAcoAhAiAA0ACyACQQA2AgAMCwsCQEEAKAL4kwIiACADSQ0AQQAoAoSUAiEEAkACQCAAIANrIgVBEEkNACAEIANqIgcgBUEBcjYCBCAEIABqIAU2AgAgBCADQQNyNgIEDAELIAQgAEEDcjYCBCAEIABqIgAgACgCBEEBcjYCBEEAIQdBACEFC0EAIAU2AviTAkEAIAc2AoSUAiAEQQhqIQAMDQsCQEEAKAL8kwIiByADTQ0AQQAgByADayIENgL8kwJBAEEAKAKIlAIiACADaiIFNgKIlAIgBSAEQQFyNgIEIAAgA0EDcjYCBCAAQQhqIQAMDQsCQAJAQQAoAsiXAkUNAEEAKALQlwIhBAwBC0EAQn83AtSXAkEAQoCggICAgAQ3AsyXAkEAIAFBDGpBcHFB2KrVqgVzNgLIlwJBAEEANgLclwJBAEEANgKslwJBgCAhBAtBACEAIAQgA0EvaiIGaiICQQAgBGsiC3EiCCADTQ0MQQAhAAJAQQAoAqiXAiIERQ0AQQAoAqCXAiIFIAhqIgogBU0NDSAKIARLDQ0LAkACQEEALQCslwJBBHENAAJAAkACQAJAAkBBACgCiJQCIgRFDQBBsJcCIQADQAJAIAAoAgAiBSAESw0AIAUgACgCBGogBEsNAwsgACgCCCIADQALC0EAEOkGIgdBf0YNAyAIIQICQEEAKALMlwIiAEF/aiIEIAdxRQ0AIAggB2sgBCAHakEAIABrcWohAgsgAiADTQ0DAkBBACgCqJcCIgBFDQBBACgCoJcCIgQgAmoiBSAETQ0EIAUgAEsNBAsgAhDpBiIAIAdHDQEMBQsgAiAHayALcSICEOkGIgcgACgCACAAKAIEakYNASAHIQALIABBf0YNAQJAIAIgA0EwakkNACAAIQcMBAsgBiACa0EAKALQlwIiBGpBACAEa3EiBBDpBkF/Rg0BIAQgAmohAiAAIQcMAwsgB0F/Rw0CC0EAQQAoAqyXAkEEcjYCrJcCCyAIEOkGIQdBABDpBiEAIAdBf0YNBSAAQX9GDQUgByAATw0FIAAgB2siAiADQShqTQ0FC0EAQQAoAqCXAiACaiIANgKglwICQCAAQQAoAqSXAk0NAEEAIAA2AqSXAgsCQAJAQQAoAoiUAiIERQ0AQbCXAiEAA0AgByAAKAIAIgUgACgCBCIIakYNAiAAKAIIIgANAAwFCwALAkACQEEAKAKAlAIiAEUNACAHIABPDQELQQAgBzYCgJQCC0EAIQBBACACNgK0lwJBACAHNgKwlwJBAEF/NgKQlAJBAEEAKALIlwI2ApSUAkEAQQA2AryXAgNAIABBA3QiBEGglAJqIARBmJQCaiIFNgIAIARBpJQCaiAFNgIAIABBAWoiAEEgRw0AC0EAIAJBWGoiAEF4IAdrQQdxIgRrIgU2AvyTAkEAIAcgBGoiBDYCiJQCIAQgBUEBcjYCBCAHIABqQSg2AgRBAEEAKALYlwI2AoyUAgwECyAEIAdPDQIgBCAFSQ0CIAAoAgxBCHENAiAAIAggAmo2AgRBACAEQXggBGtBB3EiAGoiBTYCiJQCQQBBACgC/JMCIAJqIgcgAGsiADYC/JMCIAUgAEEBcjYCBCAEIAdqQSg2AgRBAEEAKALYlwI2AoyUAgwDC0EAIQgMCgtBACEHDAgLAkAgB0EAKAKAlAIiCE8NAEEAIAc2AoCUAiAHIQgLIAcgAmohBUGwlwIhAAJAAkACQAJAA0AgACgCACAFRg0BIAAoAggiAA0ADAILAAsgAC0ADEEIcUUNAQtBsJcCIQADQAJAIAAoAgAiBSAESw0AIAUgACgCBGoiBSAESw0DCyAAKAIIIQAMAAsACyAAIAc2AgAgACAAKAIEIAJqNgIEIAdBeCAHa0EHcWoiCyADQQNyNgIEIAVBeCAFa0EHcWoiAiALIANqIgNrIQACQCACIARHDQBBACADNgKIlAJBAEEAKAL8kwIgAGoiADYC/JMCIAMgAEEBcjYCBAwICwJAIAJBACgChJQCRw0AQQAgAzYChJQCQQBBACgC+JMCIABqIgA2AviTAiADIABBAXI2AgQgAyAAaiAANgIADAgLIAIoAgQiBEEDcUEBRw0GIARBeHEhBgJAIARB/wFLDQAgAigCCCIFIARBA3YiCEEDdEGYlAJqIgdGGgJAIAIoAgwiBCAFRw0AQQBBACgC8JMCQX4gCHdxNgLwkwIMBwsgBCAHRhogBSAENgIMIAQgBTYCCAwGCyACKAIYIQoCQCACKAIMIgcgAkYNACACKAIIIgQgCEkaIAQgBzYCDCAHIAQ2AggMBQsCQCACQRRqIgUoAgAiBA0AIAIoAhAiBEUNBCACQRBqIQULA0AgBSEIIAQiB0EUaiIFKAIAIgQNACAHQRBqIQUgBygCECIEDQALIAhBADYCAAwEC0EAIAJBWGoiAEF4IAdrQQdxIghrIgs2AvyTAkEAIAcgCGoiCDYCiJQCIAggC0EBcjYCBCAHIABqQSg2AgRBAEEAKALYlwI2AoyUAiAEIAVBJyAFa0EHcWpBUWoiACAAIARBEGpJGyIIQRs2AgQgCEEQakEAKQK4lwI3AgAgCEEAKQKwlwI3AghBACAIQQhqNgK4lwJBACACNgK0lwJBACAHNgKwlwJBAEEANgK8lwIgCEEYaiEAA0AgAEEHNgIEIABBCGohByAAQQRqIQAgByAFSQ0ACyAIIARGDQAgCCAIKAIEQX5xNgIEIAQgCCAEayIHQQFyNgIEIAggBzYCAAJAIAdB/wFLDQAgB0F4cUGYlAJqIQACQAJAQQAoAvCTAiIFQQEgB0EDdnQiB3ENAEEAIAUgB3I2AvCTAiAAIQUMAQsgACgCCCEFCyAAIAQ2AgggBSAENgIMIAQgADYCDCAEIAU2AggMAQtBHyEAAkAgB0H///8HSw0AIAdBJiAHQQh2ZyIAa3ZBAXEgAEEBdGtBPmohAAsgBCAANgIcIARCADcCECAAQQJ0QaCWAmohBQJAAkACQEEAKAL0kwIiCEEBIAB0IgJxDQBBACAIIAJyNgL0kwIgBSAENgIAIAQgBTYCGAwBCyAHQQBBGSAAQQF2ayAAQR9GG3QhACAFKAIAIQgDQCAIIgUoAgRBeHEgB0YNAiAAQR12IQggAEEBdCEAIAUgCEEEcWpBEGoiAigCACIIDQALIAIgBDYCACAEIAU2AhgLIAQgBDYCDCAEIAQ2AggMAQsgBSgCCCIAIAQ2AgwgBSAENgIIIARBADYCGCAEIAU2AgwgBCAANgIIC0EAKAL8kwIiACADTQ0AQQAgACADayIENgL8kwJBAEEAKAKIlAIiACADaiIFNgKIlAIgBSAEQQFyNgIEIAAgA0EDcjYCBCAAQQhqIQAMCAsQngZBMDYCAEEAIQAMBwtBACEHCyAKRQ0AAkACQCACIAIoAhwiBUECdEGglgJqIgQoAgBHDQAgBCAHNgIAIAcNAUEAQQAoAvSTAkF+IAV3cTYC9JMCDAILIApBEEEUIAooAhAgAkYbaiAHNgIAIAdFDQELIAcgCjYCGAJAIAIoAhAiBEUNACAHIAQ2AhAgBCAHNgIYCyACQRRqKAIAIgRFDQAgB0EUaiAENgIAIAQgBzYCGAsgBiAAaiEAIAIgBmoiAigCBCEECyACIARBfnE2AgQgAyAAQQFyNgIEIAMgAGogADYCAAJAIABB/wFLDQAgAEF4cUGYlAJqIQQCQAJAQQAoAvCTAiIFQQEgAEEDdnQiAHENAEEAIAUgAHI2AvCTAiAEIQAMAQsgBCgCCCEACyAEIAM2AgggACADNgIMIAMgBDYCDCADIAA2AggMAQtBHyEEAkAgAEH///8HSw0AIABBJiAAQQh2ZyIEa3ZBAXEgBEEBdGtBPmohBAsgAyAENgIcIANCADcCECAEQQJ0QaCWAmohBQJAAkACQEEAKAL0kwIiB0EBIAR0IghxDQBBACAHIAhyNgL0kwIgBSADNgIAIAMgBTYCGAwBCyAAQQBBGSAEQQF2ayAEQR9GG3QhBCAFKAIAIQcDQCAHIgUoAgRBeHEgAEYNAiAEQR12IQcgBEEBdCEEIAUgB0EEcWpBEGoiCCgCACIHDQALIAggAzYCACADIAU2AhgLIAMgAzYCDCADIAM2AggMAQsgBSgCCCIAIAM2AgwgBSADNgIIIANBADYCGCADIAU2AgwgAyAANgIICyALQQhqIQAMAgsCQCALRQ0AAkACQCAIIAgoAhwiBUECdEGglgJqIgAoAgBHDQAgACAHNgIAIAcNAUEAIAZBfiAFd3EiBjYC9JMCDAILIAtBEEEUIAsoAhAgCEYbaiAHNgIAIAdFDQELIAcgCzYCGAJAIAgoAhAiAEUNACAHIAA2AhAgACAHNgIYCyAIQRRqKAIAIgBFDQAgB0EUaiAANgIAIAAgBzYCGAsCQAJAIARBD0sNACAIIAQgA2oiAEEDcjYCBCAIIABqIgAgACgCBEEBcjYCBAwBCyAIIANBA3I2AgQgCCADaiIHIARBAXI2AgQgByAEaiAENgIAAkAgBEH/AUsNACAEQXhxQZiUAmohAAJAAkBBACgC8JMCIgVBASAEQQN2dCIEcQ0AQQAgBSAEcjYC8JMCIAAhBAwBCyAAKAIIIQQLIAAgBzYCCCAEIAc2AgwgByAANgIMIAcgBDYCCAwBC0EfIQACQCAEQf///wdLDQAgBEEmIARBCHZnIgBrdkEBcSAAQQF0a0E+aiEACyAHIAA2AhwgB0IANwIQIABBAnRBoJYCaiEFAkACQAJAIAZBASAAdCIDcQ0AQQAgBiADcjYC9JMCIAUgBzYCACAHIAU2AhgMAQsgBEEAQRkgAEEBdmsgAEEfRht0IQAgBSgCACEDA0AgAyIFKAIEQXhxIARGDQIgAEEddiEDIABBAXQhACAFIANBBHFqQRBqIgIoAgAiAw0ACyACIAc2AgAgByAFNgIYCyAHIAc2AgwgByAHNgIIDAELIAUoAggiACAHNgIMIAUgBzYCCCAHQQA2AhggByAFNgIMIAcgADYCCAsgCEEIaiEADAELAkAgCkUNAAJAAkAgByAHKAIcIgVBAnRBoJYCaiIAKAIARw0AIAAgCDYCACAIDQFBACAJQX4gBXdxNgL0kwIMAgsgCkEQQRQgCigCECAHRhtqIAg2AgAgCEUNAQsgCCAKNgIYAkAgBygCECIARQ0AIAggADYCECAAIAg2AhgLIAdBFGooAgAiAEUNACAIQRRqIAA2AgAgACAINgIYCwJAAkAgBEEPSw0AIAcgBCADaiIAQQNyNgIEIAcgAGoiACAAKAIEQQFyNgIEDAELIAcgA0EDcjYCBCAHIANqIgUgBEEBcjYCBCAFIARqIAQ2AgACQCAGRQ0AIAZBeHFBmJQCaiEDQQAoAoSUAiEAAkACQEEBIAZBA3Z0IgggAnENAEEAIAggAnI2AvCTAiADIQgMAQsgAygCCCEICyADIAA2AgggCCAANgIMIAAgAzYCDCAAIAg2AggLQQAgBTYChJQCQQAgBDYC+JMCCyAHQQhqIQALIAFBEGokACAAC9sMAQd/AkAgAEUNACAAQXhqIgEgAEF8aigCACICQXhxIgBqIQMCQCACQQFxDQAgAkEDcUUNASABIAEoAgAiAmsiAUEAKAKAlAIiBEkNASACIABqIQACQAJAAkAgAUEAKAKElAJGDQACQCACQf8BSw0AIAEoAggiBCACQQN2IgVBA3RBmJQCaiIGRhoCQCABKAIMIgIgBEcNAEEAQQAoAvCTAkF+IAV3cTYC8JMCDAULIAIgBkYaIAQgAjYCDCACIAQ2AggMBAsgASgCGCEHAkAgASgCDCIGIAFGDQAgASgCCCICIARJGiACIAY2AgwgBiACNgIIDAMLAkAgAUEUaiIEKAIAIgINACABKAIQIgJFDQIgAUEQaiEECwNAIAQhBSACIgZBFGoiBCgCACICDQAgBkEQaiEEIAYoAhAiAg0ACyAFQQA2AgAMAgsgAygCBCICQQNxQQNHDQJBACAANgL4kwIgAyACQX5xNgIEIAEgAEEBcjYCBCADIAA2AgAPC0EAIQYLIAdFDQACQAJAIAEgASgCHCIEQQJ0QaCWAmoiAigCAEcNACACIAY2AgAgBg0BQQBBACgC9JMCQX4gBHdxNgL0kwIMAgsgB0EQQRQgBygCECABRhtqIAY2AgAgBkUNAQsgBiAHNgIYAkAgASgCECICRQ0AIAYgAjYCECACIAY2AhgLIAFBFGooAgAiAkUNACAGQRRqIAI2AgAgAiAGNgIYCyABIANPDQAgAygCBCICQQFxRQ0AAkACQAJAAkACQCACQQJxDQACQCADQQAoAoiUAkcNAEEAIAE2AoiUAkEAQQAoAvyTAiAAaiIANgL8kwIgASAAQQFyNgIEIAFBACgChJQCRw0GQQBBADYC+JMCQQBBADYChJQCDwsCQCADQQAoAoSUAkcNAEEAIAE2AoSUAkEAQQAoAviTAiAAaiIANgL4kwIgASAAQQFyNgIEIAEgAGogADYCAA8LIAJBeHEgAGohAAJAIAJB/wFLDQAgAygCCCIEIAJBA3YiBUEDdEGYlAJqIgZGGgJAIAMoAgwiAiAERw0AQQBBACgC8JMCQX4gBXdxNgLwkwIMBQsgAiAGRhogBCACNgIMIAIgBDYCCAwECyADKAIYIQcCQCADKAIMIgYgA0YNACADKAIIIgJBACgCgJQCSRogAiAGNgIMIAYgAjYCCAwDCwJAIANBFGoiBCgCACICDQAgAygCECICRQ0CIANBEGohBAsDQCAEIQUgAiIGQRRqIgQoAgAiAg0AIAZBEGohBCAGKAIQIgINAAsgBUEANgIADAILIAMgAkF+cTYCBCABIABBAXI2AgQgASAAaiAANgIADAMLQQAhBgsgB0UNAAJAAkAgAyADKAIcIgRBAnRBoJYCaiICKAIARw0AIAIgBjYCACAGDQFBAEEAKAL0kwJBfiAEd3E2AvSTAgwCCyAHQRBBFCAHKAIQIANGG2ogBjYCACAGRQ0BCyAGIAc2AhgCQCADKAIQIgJFDQAgBiACNgIQIAIgBjYCGAsgA0EUaigCACICRQ0AIAZBFGogAjYCACACIAY2AhgLIAEgAEEBcjYCBCABIABqIAA2AgAgAUEAKAKElAJHDQBBACAANgL4kwIPCwJAIABB/wFLDQAgAEF4cUGYlAJqIQICQAJAQQAoAvCTAiIEQQEgAEEDdnQiAHENAEEAIAQgAHI2AvCTAiACIQAMAQsgAigCCCEACyACIAE2AgggACABNgIMIAEgAjYCDCABIAA2AggPC0EfIQICQCAAQf///wdLDQAgAEEmIABBCHZnIgJrdkEBcSACQQF0a0E+aiECCyABIAI2AhwgAUIANwIQIAJBAnRBoJYCaiEEAkACQAJAAkBBACgC9JMCIgZBASACdCIDcQ0AQQAgBiADcjYC9JMCIAQgATYCACABIAQ2AhgMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgBCgCACEGA0AgBiIEKAIEQXhxIABGDQIgAkEddiEGIAJBAXQhAiAEIAZBBHFqQRBqIgMoAgAiBg0ACyADIAE2AgAgASAENgIYCyABIAE2AgwgASABNgIIDAELIAQoAggiACABNgIMIAQgATYCCCABQQA2AhggASAENgIMIAEgADYCCAtBAEEAKAKQlAJBf2oiAUF/IAEbNgKQlAILC+gKAgR/BH4jAEHwAGsiBSQAIARC////////////AIMhCQJAAkACQCABUCIGIAJC////////////AIMiCkKAgICAgIDAgIB/fEKAgICAgIDAgIB/VCAKUBsNACADQgBSIAlCgICAgICAwICAf3wiC0KAgICAgIDAgIB/ViALQoCAgICAgMCAgH9RGw0BCwJAIAYgCkKAgICAgIDA//8AVCAKQoCAgICAgMD//wBRGw0AIAJCgICAgICAIIQhBCABIQMMAgsCQCADUCAJQoCAgICAgMD//wBUIAlCgICAgICAwP//AFEbDQAgBEKAgICAgIAghCEEDAILAkAgASAKQoCAgICAgMD//wCFhEIAUg0AQoCAgICAgOD//wAgAiADIAGFIAQgAoVCgICAgICAgICAf4WEUCIGGyEEQgAgASAGGyEDDAILIAMgCUKAgICAgIDA//8AhYRQDQECQCABIAqEQgBSDQAgAyAJhEIAUg0CIAMgAYMhAyAEIAKDIQQMAgsgAyAJhFBFDQAgASEDIAIhBAwBCyADIAEgAyABViAJIApWIAkgClEbIgcbIQkgBCACIAcbIgtC////////P4MhCiACIAQgBxsiAkIwiKdB//8BcSEIAkAgC0IwiKdB//8BcSIGDQAgBUHgAGogCSAKIAkgCiAKUCIGG3kgBkEGdK18pyIGQXFqEO0GQRAgBmshBiAFQegAaikDACEKIAUpA2AhCQsgASADIAcbIQMgAkL///////8/gyEEAkAgCA0AIAVB0ABqIAMgBCADIAQgBFAiBxt5IAdBBnStfKciB0FxahDtBkEQIAdrIQggBUHYAGopAwAhBCAFKQNQIQMLIARCA4YgA0I9iIRCgICAgICAgASEIQEgCkIDhiAJQj2IhCEEIANCA4YhCiALIAKFIQMCQCAGIAhGDQACQCAGIAhrIgdB/wBNDQBCACEBQgEhCgwBCyAFQcAAaiAKIAFBgAEgB2sQ7QYgBUEwaiAKIAEgBxD3BiAFKQMwIAUpA0AgBUHAAGpBCGopAwCEQgBSrYQhCiAFQTBqQQhqKQMAIQELIARCgICAgICAgASEIQwgCUIDhiEJAkACQCADQn9VDQBCACEDQgAhBCAJIAqFIAwgAYWEUA0CIAkgCn0hAiAMIAF9IAkgClStfSIEQv////////8DVg0BIAVBIGogAiAEIAIgBCAEUCIHG3kgB0EGdK18p0F0aiIHEO0GIAYgB2shBiAFQShqKQMAIQQgBSkDICECDAELIAEgDHwgCiAJfCICIApUrXwiBEKAgICAgICACINQDQAgAkIBiCAEQj+GhCAKQgGDhCECIAZBAWohBiAEQgGIIQQLIAtCgICAgICAgICAf4MhCgJAIAZB//8BSA0AIApCgICAgICAwP//AIQhBEIAIQMMAQtBACEHAkACQCAGQQBMDQAgBiEHDAELIAVBEGogAiAEIAZB/wBqEO0GIAUgAiAEQQEgBmsQ9wYgBSkDACAFKQMQIAVBEGpBCGopAwCEQgBSrYQhAiAFQQhqKQMAIQQLIAJCA4ggBEI9hoQhAyAHrUIwhiAEQgOIQv///////z+DhCAKhCEEIAKnQQdxIQYCQAJAAkACQAJAEPUGDgMAAQIDCyAEIAMgBkEES618IgogA1StfCEEAkAgBkEERg0AIAohAwwDCyAEIApCAYMiASAKfCIDIAFUrXwhBAwDCyAEIAMgCkIAUiAGQQBHca18IgogA1StfCEEIAohAwwBCyAEIAMgClAgBkEAR3GtfCIKIANUrXwhBCAKIQMLIAZFDQELEPYGGgsgACADNwMAIAAgBDcDCCAFQfAAaiQAC1MBAX4CQAJAIANBwABxRQ0AIAEgA0FAaq2GIQJCACEBDAELIANFDQAgAUHAACADa62IIAIgA60iBIaEIQIgASAEhiEBCyAAIAE3AwAgACACNwMIC+ABAgF/An5BASEEAkAgAEIAUiABQv///////////wCDIgVCgICAgICAwP//AFYgBUKAgICAgIDA//8AURsNACACQgBSIANC////////////AIMiBkKAgICAgIDA//8AViAGQoCAgICAgMD//wBRGw0AAkAgAiAAhCAGIAWEhFBFDQBBAA8LAkAgAyABg0IAUw0AQX8hBCAAIAJUIAEgA1MgASADURsNASAAIAKFIAEgA4WEQgBSDwtBfyEEIAAgAlYgASADVSABIANRGw0AIAAgAoUgASADhYRCAFIhBAsgBAvYAQIBfwJ+QX8hBAJAIABCAFIgAUL///////////8AgyIFQoCAgICAgMD//wBWIAVCgICAgICAwP//AFEbDQAgAkIAUiADQv///////////wCDIgZCgICAgICAwP//AFYgBkKAgICAgIDA//8AURsNAAJAIAIgAIQgBiAFhIRQRQ0AQQAPCwJAIAMgAYNCAFMNACAAIAJUIAEgA1MgASADURsNASAAIAKFIAEgA4WEQgBSDwsgACACViABIANVIAEgA1EbDQAgACAChSABIAOFhEIAUiEECyAEC+cQAgV/D34jAEHQAmsiBSQAIARC////////P4MhCiACQv///////z+DIQsgBCAChUKAgICAgICAgIB/gyEMIARCMIinQf//AXEhBgJAAkACQCACQjCIp0H//wFxIgdBgYB+akGCgH5JDQBBACEIIAZBgYB+akGBgH5LDQELAkAgAVAgAkL///////////8AgyINQoCAgICAgMD//wBUIA1CgICAgICAwP//AFEbDQAgAkKAgICAgIAghCEMDAILAkAgA1AgBEL///////////8AgyICQoCAgICAgMD//wBUIAJCgICAgICAwP//AFEbDQAgBEKAgICAgIAghCEMIAMhAQwCCwJAIAEgDUKAgICAgIDA//8AhYRCAFINAAJAIAMgAkKAgICAgIDA//8AhYRQRQ0AQgAhAUKAgICAgIDg//8AIQwMAwsgDEKAgICAgIDA//8AhCEMQgAhAQwCCwJAIAMgAkKAgICAgIDA//8AhYRCAFINAEIAIQEMAgsCQCABIA2EQgBSDQBCgICAgICA4P//ACAMIAMgAoRQGyEMQgAhAQwCCwJAIAMgAoRCAFINACAMQoCAgICAgMD//wCEIQxCACEBDAILQQAhCAJAIA1C////////P1YNACAFQcACaiABIAsgASALIAtQIggbeSAIQQZ0rXynIghBcWoQ7QZBECAIayEIIAVByAJqKQMAIQsgBSkDwAIhAQsgAkL///////8/Vg0AIAVBsAJqIAMgCiADIAogClAiCRt5IAlBBnStfKciCUFxahDtBiAJIAhqQXBqIQggBUG4AmopAwAhCiAFKQOwAiEDCyAFQaACaiADQjGIIApCgICAgICAwACEIg5CD4aEIgJCAEKAgICAsOa8gvUAIAJ9IgRCABD5BiAFQZACakIAIAVBoAJqQQhqKQMAfUIAIARCABD5BiAFQYACaiAFKQOQAkI/iCAFQZACakEIaikDAEIBhoQiBEIAIAJCABD5BiAFQfABaiAEQgBCACAFQYACakEIaikDAH1CABD5BiAFQeABaiAFKQPwAUI/iCAFQfABakEIaikDAEIBhoQiBEIAIAJCABD5BiAFQdABaiAEQgBCACAFQeABakEIaikDAH1CABD5BiAFQcABaiAFKQPQAUI/iCAFQdABakEIaikDAEIBhoQiBEIAIAJCABD5BiAFQbABaiAEQgBCACAFQcABakEIaikDAH1CABD5BiAFQaABaiACQgAgBSkDsAFCP4ggBUGwAWpBCGopAwBCAYaEQn98IgRCABD5BiAFQZABaiADQg+GQgAgBEIAEPkGIAVB8ABqIARCAEIAIAVBoAFqQQhqKQMAIAUpA6ABIgogBUGQAWpBCGopAwB8IgIgClStfCACQgFWrXx9QgAQ+QYgBUGAAWpCASACfUIAIARCABD5BiAIIAcgBmtqIQYCQAJAIAUpA3AiD0IBhiIQIAUpA4ABQj+IIAVBgAFqQQhqKQMAIhFCAYaEfCINQpmTf3wiEkIgiCICIAtCgICAgICAwACEIhNCAYYiFEIgiCIEfiIVIAFCAYYiFkIgiCIKIAVB8ABqQQhqKQMAQgGGIA9CP4iEIBFCP4h8IA0gEFStfCASIA1UrXxCf3wiD0IgiCINfnwiECAVVK0gECAPQv////8PgyIPIAFCP4giFyALQgGGhEL/////D4MiC358IhEgEFStfCANIAR+fCAPIAR+IhUgCyANfnwiECAVVK1CIIYgEEIgiIR8IBEgEEIghnwiECARVK18IBAgEkL/////D4MiEiALfiIVIAIgCn58IhEgFVStIBEgDyAWQv7///8PgyIVfnwiGCARVK18fCIRIBBUrXwgESASIAR+IhAgFSANfnwiBCACIAt+fCINIA8gCn58Ig9CIIggBCAQVK0gDSAEVK18IA8gDVStfEIghoR8IgQgEVStfCAEIBggAiAVfiICIBIgCn58IgpCIIggCiACVK1CIIaEfCICIBhUrSACIA9CIIZ8IAJUrXx8IgIgBFStfCIEQv////////8AVg0AIBQgF4QhEyAFQdAAaiACIAQgAyAOEPkGIAFCMYYgBUHQAGpBCGopAwB9IAUpA1AiAUIAUq19IQ0gBkH+/wBqIQZCACABfSEKDAELIAVB4ABqIAJCAYggBEI/hoQiAiAEQgGIIgQgAyAOEPkGIAFCMIYgBUHgAGpBCGopAwB9IAUpA2AiCkIAUq19IQ0gBkH//wBqIQZCACAKfSEKIAEhFgsCQCAGQf//AUgNACAMQoCAgICAgMD//wCEIQxCACEBDAELAkACQCAGQQFIDQAgDUIBhiAKQj+IhCENIAatQjCGIARC////////P4OEIQ8gCkIBhiEEDAELAkAgBkGPf0oNAEIAIQEMAgsgBUHAAGogAiAEQQEgBmsQ9wYgBUEwaiAWIBMgBkHwAGoQ7QYgBUEgaiADIA4gBSkDQCICIAVBwABqQQhqKQMAIg8Q+QYgBUEwakEIaikDACAFQSBqQQhqKQMAQgGGIAUpAyAiAUI/iIR9IAUpAzAiBCABQgGGIgFUrX0hDSAEIAF9IQQLIAVBEGogAyAOQgNCABD5BiAFIAMgDkIFQgAQ+QYgDyACIAJCAYMiASAEfCIEIANWIA0gBCABVK18IgEgDlYgASAOURutfCIDIAJUrXwiAiADIAJCgICAgICAwP//AFQgBCAFKQMQViABIAVBEGpBCGopAwAiAlYgASACURtxrXwiAiADVK18IgMgAiADQoCAgICAgMD//wBUIAQgBSkDAFYgASAFQQhqKQMAIgRWIAEgBFEbca18IgEgAlStfCAMhCEMCyAAIAE3AwAgACAMNwMIIAVB0AJqJAALjgICAn8DfiMAQRBrIgIkAAJAAkAgAb0iBEL///////////8AgyIFQoCAgICAgIB4fEL/////////7/8AVg0AIAVCPIYhBiAFQgSIQoCAgICAgICAPHwhBQwBCwJAIAVCgICAgICAgPj/AFQNACAEQjyGIQYgBEIEiEKAgICAgIDA//8AhCEFDAELAkAgBVBFDQBCACEGQgAhBQwBCyACIAVCACAEp2dBIGogBUIgiKdnIAVCgICAgBBUGyIDQTFqEO0GIAJBCGopAwBCgICAgICAwACFQYz4ACADa61CMIaEIQUgAikDACEGCyAAIAY3AwAgACAFIARCgICAgICAgICAf4OENwMIIAJBEGokAAvhAQIDfwJ+IwBBEGsiAiQAAkACQCABvCIDQf////8HcSIEQYCAgHxqQf////cHSw0AIAStQhmGQoCAgICAgIDAP3whBUIAIQYMAQsCQCAEQYCAgPwHSQ0AIAOtQhmGQoCAgICAgMD//wCEIQVCACEGDAELAkAgBA0AQgAhBkIAIQUMAQsgAiAErUIAIARnIgRB0QBqEO0GIAJBCGopAwBCgICAgICAwACFQYn/ACAEa61CMIaEIQUgAikDACEGCyAAIAY3AwAgACAFIANBgICAgHhxrUIghoQ3AwggAkEQaiQAC40BAgJ/An4jAEEQayICJAACQAJAIAENAEIAIQRCACEFDAELIAIgASABQR91IgNzIANrIgOtQgAgA2ciA0HRAGoQ7QYgAkEIaikDAEKAgICAgIDAAIVBnoABIANrrUIwhnwgAUGAgICAeHGtQiCGhCEFIAIpAwAhBAsgACAENwMAIAAgBTcDCCACQRBqJAALcgIBfwJ+IwBBEGsiAiQAAkACQCABDQBCACEDQgAhBAwBCyACIAGtQgAgAWciAUHRAGoQ7QYgAkEIaikDAEKAgICAgIDAAIVBnoABIAFrrUIwhnwhBCACKQMAIQMLIAAgAzcDACAAIAQ3AwggAkEQaiQACwQAQQALBABBAAtTAQF+AkACQCADQcAAcUUNACACIANBQGqtiCEBQgAhAgwBCyADRQ0AIAJBwAAgA2uthiABIAOtIgSIhCEBIAIgBIghAgsgACABNwMAIAAgAjcDCAuaCwIFfw9+IwBB4ABrIgUkACAEQv///////z+DIQogBCAChUKAgICAgICAgIB/gyELIAJC////////P4MiDEIgiCENIARCMIinQf//AXEhBgJAAkACQCACQjCIp0H//wFxIgdBgYB+akGCgH5JDQBBACEIIAZBgYB+akGBgH5LDQELAkAgAVAgAkL///////////8AgyIOQoCAgICAgMD//wBUIA5CgICAgICAwP//AFEbDQAgAkKAgICAgIAghCELDAILAkAgA1AgBEL///////////8AgyICQoCAgICAgMD//wBUIAJCgICAgICAwP//AFEbDQAgBEKAgICAgIAghCELIAMhAQwCCwJAIAEgDkKAgICAgIDA//8AhYRCAFINAAJAIAMgAoRQRQ0AQoCAgICAgOD//wAhC0IAIQEMAwsgC0KAgICAgIDA//8AhCELQgAhAQwCCwJAIAMgAkKAgICAgIDA//8AhYRCAFINACABIA6EIQJCACEBAkAgAlBFDQBCgICAgICA4P//ACELDAMLIAtCgICAgICAwP//AIQhCwwCCwJAIAEgDoRCAFINAEIAIQEMAgsCQCADIAKEQgBSDQBCACEBDAILQQAhCAJAIA5C////////P1YNACAFQdAAaiABIAwgASAMIAxQIggbeSAIQQZ0rXynIghBcWoQ7QZBECAIayEIIAVB2ABqKQMAIgxCIIghDSAFKQNQIQELIAJC////////P1YNACAFQcAAaiADIAogAyAKIApQIgkbeSAJQQZ0rXynIglBcWoQ7QYgCCAJa0EQaiEIIAVByABqKQMAIQogBSkDQCEDCyADQg+GIg5CgID+/w+DIgIgAUIgiCIEfiIPIA5CIIgiDiABQv////8PgyIBfnwiEEIghiIRIAIgAX58IhIgEVStIAIgDEL/////D4MiDH4iEyAOIAR+fCIRIANCMYggCkIPhiIUhEL/////D4MiAyABfnwiCiAQQiCIIBAgD1StQiCGhHwiDyACIA1CgIAEhCIQfiIVIA4gDH58Ig0gFEIgiEKAgICACIQiAiABfnwiFCADIAR+fCIWQiCGfCIXfCEBIAcgBmogCGpBgYB/aiEGAkACQCACIAR+IhggDiAQfnwiBCAYVK0gBCADIAx+fCIOIARUrXwgAiAQfnwgDiARIBNUrSAKIBFUrXx8IgQgDlStfCADIBB+IgMgAiAMfnwiAiADVK1CIIYgAkIgiIR8IAQgAkIghnwiAiAEVK18IAIgFkIgiCANIBVUrSAUIA1UrXwgFiAUVK18QiCGhHwiBCACVK18IAQgDyAKVK0gFyAPVK18fCICIARUrXwiBEKAgICAgIDAAINQDQAgBkEBaiEGDAELIBJCP4ghAyAEQgGGIAJCP4iEIQQgAkIBhiABQj+IhCECIBJCAYYhEiADIAFCAYaEIQELAkAgBkH//wFIDQAgC0KAgICAgIDA//8AhCELQgAhAQwBCwJAAkAgBkEASg0AAkBBASAGayIHQf8ASw0AIAVBMGogEiABIAZB/wBqIgYQ7QYgBUEgaiACIAQgBhDtBiAFQRBqIBIgASAHEPcGIAUgAiAEIAcQ9wYgBSkDICAFKQMQhCAFKQMwIAVBMGpBCGopAwCEQgBSrYQhEiAFQSBqQQhqKQMAIAVBEGpBCGopAwCEIQEgBUEIaikDACEEIAUpAwAhAgwCC0IAIQEMAgsgBq1CMIYgBEL///////8/g4QhBAsgBCALhCELAkAgElAgAUJ/VSABQoCAgICAgICAgH9RGw0AIAsgAkIBfCIBUK18IQsMAQsCQCASIAFCgICAgICAgICAf4WEQgBRDQAgAiEBDAELIAsgAiACQgGDfCIBIAJUrXwhCwsgACABNwMAIAAgCzcDCCAFQeAAaiQAC3UBAX4gACAEIAF+IAIgA358IANCIIgiAiABQiCIIgR+fCADQv////8PgyIDIAFC/////w+DIgF+IgVCIIggAyAEfnwiA0IgiHwgA0L/////D4MgAiABfnwiAUIgiHw3AwggACABQiCGIAVC/////w+DhDcDAAtrAgF8AX8gAEQAAAAAAADwPyABQQFxGyECAkAgAUEBakEDSQ0AIAEhAwNAIAIgACAAoiIARAAAAAAAAPA/IANBAm0iA0EBcRuiIQIgA0EBakECSw0ACwtEAAAAAAAA8D8gAqMgAiABQQBIGwtIAQF/IwBBEGsiBSQAIAUgASACIAMgBEKAgICAgICAgIB/hRDsBiAFKQMAIQQgACAFQQhqKQMANwMIIAAgBDcDACAFQRBqJAAL5AMCAn8CfiMAQSBrIgIkAAJAAkAgAUL///////////8AgyIEQoCAgICAgMD/Q3wgBEKAgICAgIDAgLx/fFoNACAAQjyIIAFCBIaEIQQCQCAAQv//////////D4MiAEKBgICAgICAgAhUDQAgBEKBgICAgICAgMAAfCEFDAILIARCgICAgICAgIDAAHwhBSAAQoCAgICAgICACFINASAFIARCAYN8IQUMAQsCQCAAUCAEQoCAgICAgMD//wBUIARCgICAgICAwP//AFEbDQAgAEI8iCABQgSGhEL/////////A4NCgICAgICAgPz/AIQhBQwBC0KAgICAgICA+P8AIQUgBEL///////+//8MAVg0AQgAhBSAEQjCIpyIDQZH3AEkNACACQRBqIAAgAUL///////8/g0KAgICAgIDAAIQiBCADQf+If2oQ7QYgAiAAIARBgfgAIANrEPcGIAIpAwAiBEI8iCACQQhqKQMAQgSGhCEFAkAgBEL//////////w+DIAIpAxAgAkEQakEIaikDAIRCAFKthCIEQoGAgICAgICACFQNACAFQgF8IQUMAQsgBEKAgICAgICAgAhSDQAgBUIBgyAFfCEFCyACQSBqJAAgBSABQoCAgICAgICAgH+DhL8LBgAgACQBCwQAIwELFABB4JcGJANB4JcCQQ9qQXBxJAILBwAjACMCawsEACMDCwQAIwILBAAjAAsGACAAJAALEgECfyMAIABrQXBxIgEkACABCwQAIwALDQAgASACIAMgABERAAslAQF+IAAgASACrSADrUIghoQgBBCHByEFIAVCIIinEP0GIAWnCxMAIAAgAacgAUIgiKcgAiADEBQLC87zAQMAQYAIC7jmAWluZmluaXR5AC1JbmZpbml0eQAhIEV4Y2VwdGlvbjogT3V0T2ZNZW1vcnkAaXNSZWFkT25seQBkZXZzX3ZlcmlmeQBzdHJpbmdpZnkAc3RtdDJfY2FsbF9hcnJheQBsYXJnZSBwYXJhbWV0ZXJzIGFycmF5AEV4cGVjdGluZyBzdHJpbmcsIGJ1ZmZlciBvciBhcnJheQBpc0FycmF5AGRlbGF5AHNldHVwX2N0eABoZXgAc2VydmljZUluZGV4AGpkX29waXBlX3dyaXRlX2V4AGRldnNfc3BlY19pZHgAbWF4ACEgYmxvY2sgY29ycnVwdGlvbjogJXAgb2ZmPSV1IHY9JXgAV1NTSy1IOiBlcnJvciBvbiBjbWQ9JXgAV1NTSy1IOiBzZW5kIGNtZD0leABtZXRob2Q6JWQ6JXgAZGJnOiB1bmhhbmRsZWQ6ICV4LyV4ACEgdmVyaWZpY2F0aW9uIGZhaWx1cmU6ICVkIGF0ICV4ACEgc3RlcCBmcmFtZSAleABXU1NLLUg6IHVua25vd24gY21kICV4AHNwZWMgbWlzc2luZzogJXgAV1NTSy1IOiBzdHJlYW1pbmc6ICV4AGRldnNfb2JqZWN0X2dldF9hdHRhY2hlZF9ydwAhIGRvdWJsZSB0aHJvdwBwb3cAZnN0b3I6IGZvcm1hdHRpbmcgbm93AGNodW5rIG92ZXJmbG93ACEgRXhjZXB0aW9uOiBTdGFja092ZXJmbG93AGJsaXRSb3cAamRfd3Nza19uZXcAamRfd2Vic29ja19uZXcAZXhwcjFfbmV3AGRldnNfamRfc2VuZF9yYXcAaWRpdgBwcmV2AC5hcHAuZ2l0aHViLmRldgAlcyV1AHRocm93OiVkQCV1AGZzdG9yOiBubyBmcmVlIHBhZ2VzOyBzej0ldQBmc3Rvcjogb3V0IG9mIHNwYWNlOyBzej0ldQBidWZmZXIgd3JpdGUgYXQgJXUsIGxlbj0ldQAlczoldQBmc3RvcjogdG9vIGxhcmdlOiAldQBuZXh0AGpkX3NlbmRfZXZlbnRfZXh0AFVuZXhwZWN0ZWQgZW5kIG9mIEpTT04gaW5wdXQAc2V0VGltZW91dABjbGVhclRpbWVvdXQAc3RvcF9saXN0AGRpZ2VzdABzcXJ0AHJlcG9ydABpc1JlcG9ydABhdXRoIHRvbyBzaG9ydABhc3NlcnQAaW5zZXJ0AGNicnQAcmVzdGFydABkZXZzX2ZpYmVyX3N0YXJ0AChjb25zdCB1aW50OF90ICopKGxhc3RfZW50cnkgKyAxKSA8PSBkYXRhX3N0YXJ0AGpkX2Flc19jY21fZW5jcnlwdABkZWNyeXB0AERldmljZVNjcmlwdAByZWJvb3QAISBleHBlY3Rpbmcgc3RhY2ssIGdvdABwcmludABkZXZzX3ZtX3NldF9icmVha3BvaW50AGRldnNfdm1fY2xlYXJfYnJlYWtwb2ludABkZXZzX3V0ZjhfY29kZV9wb2ludABqZF9jbGllbnRfZW1pdF9ldmVudAB0Y3Bzb2NrX29uX2V2ZW50AGpkX3dlYnNvY2tfb25fZXZlbnQAaXNFdmVudABfc29ja2V0T25FdmVudABqZF90eF9mcmFtZV9zZW50AGN1cnJlbnQAZGV2c19wYWNrZXRfc3BlY19wYXJlbnQAbGFzdC1lbnQAdmFyaWFudAByYW5kb21JbnQAcGFyc2VJbnQAdGhpcyBudW1mbXQAZGJnOiBoYWx0AG1hc2tlZCBzZXJ2ZXIgcGt0AGpkX2ZzdG9yX2luaXQAZGV2c21ncl9pbml0AGRjZmdfaW5pdABibGl0AHdhaXQAaGVpZ2h0AHVuc2hpZnQAamRfcXVldWVfc2hpZnQAdGFyZ2V0IHJlc2V0AGNsb3VkIHdhdGNoZG9nIHJlc2V0AGRldnNfc2hvcnRfbWFwX3NldABkZXZzX21hcF9zZXQAamRfY2xpZW50X2hhbmRsZV9wYWNrZXQAcm9sZW1ncl9oYW5kbGVfcGFja2V0AGpkX29waXBlX2hhbmRsZV9wYWNrZXQAX29uU2VydmVyUGFja2V0AF9vblBhY2tldABnZXQAaXNSZWdTZXQAaXNSZWdHZXQAZGV2c19nZXRfYnVpbHRpbl9vYmplY3QAYSBidWlsdGluIGZyb3plbiBvYmplY3QAZmlsbFJlY3QAcGFyc2VGbG9hdABkZXZzY2xvdWQ6IGludmFsaWQgY2xvdWQgdXBsb2FkIGZvcm1hdABibGl0QXQAc2V0QXQAZ2V0QXQAY2hhckF0AGZpbGxBdABjaGFyQ29kZUF0AGtleXMAd3MAamRpZjogcm9sZSAnJXMnIGFscmVhZHkgZXhpc3RzAGpkX3JvbGVfc2V0X2hpbnRzAHdzcwBqZF9jbGllbnRfcHJvY2VzcwByb2xlbWdyX3Byb2Nlc3MAamRfb3BpcGVfcHJvY2VzcwAweDF4eHh4eHh4IGV4cGVjdGVkIGZvciBzZXJ2aWNlIGNsYXNzAGJsdGluIDwgZGV2c19udW1fYnVpbHRpbl9mdW5jdGlvbnMAaWR4IDw9IGN0eC0+bnVtX3BpbnMAR1BJTzogaW5pdDogJWQgcGlucwBlcXVhbHMAbWlsbGlzAGZsYWdzAHNlbmRfdmFsdWVzAGRjZmc6IGluaXRlZCwgJWQgZW50cmllcywgJXUgYnl0ZXMAY2FwYWJpbGl0aWVzAGlkeCA8IGN0eC0+aW1nLmhlYWRlci0+bnVtX3NlcnZpY2Vfc3BlY3MAcGlwZXMgaW4gc3BlY3MAYWJzAGV2ZXJ5TXMAZGV2cy1rZXktJS1zACogY29ubmVjdGlvbiBlcnJvcjogJS1zAFdTU0stSDogY29ubmVjdGluZyB0byAlczovLyVzOiVkJXMAc2VsZi1kZXZpY2U6ICVzLyVzACMgJXUgJXMAZXhwZWN0aW5nICVzOyBnb3QgJXMAKiBzdGFydDogJXMgJXMAKiBjb25uZWN0ZWQgdG8gJXMAYXNzZXJ0aW9uICclcycgZmFpbGVkIGF0ICVzOiVkIGluICVzAEpEX1BBTklDKCkgYXQgJXM6JWQgaW4gJXMAJXMgZmllbGRzIG9mICVzACVzIGZpZWxkICclcycgb2YgJXMAY2xlYXIgcm9sZSAlcwAlYyAlcwA+ICVzAG1haW46IGFza2luZyBmb3IgZGVwbG95OiAlcwBkZXZpY2UgcmVzZXQ6ICVzAD4gJXM6ICVzAFdTOiBlcnJvcjogJXMAV1NTSzogZXJyb3I6ICVzAGJhZCByZXNwOiAlcwBXU1NLLUg6IGZhaWxlZCBwYXJzaW5nIGNvbm4gc3RyaW5nOiAlcwBVbmtub3duIGVuY29kaW5nOiAlcwBmc3RvcjogbW91bnQgZmFpbHVyZTogJXMAZGV2aWNlIGRlc3Ryb3llZDogJXMAZGV2aWNlIGNyZWF0ZWQ6ICVzACVjICAgICVzAHdzc2tfY29ubnN0cgBuIDw9IHdzLT5tc2dwdHIAZmFpbF9wdHIAbWFya19wdHIAd3JpdGUgZXJyAF9sb2dSZXByAGNvbnN0cnVjdG9yAGJ1aWx0aW4gZnVuY3Rpb24gaXMgbm90IGEgY3RvcgBpc1NpbXVsYXRvcgB0YWcgZXJyb3IAc29jayB3cml0ZSBlcnJvcgBTeW50YXhFcnJvcgBUeXBlRXJyb3IAUmFuZ2VFcnJvcgBmbG9vcgBzZXJ2ZXIASlNPTi5wYXJzZSByZXZpdmVyAGRldnNfamRfZ2V0X3JlZ2lzdGVyAHNlcnZpY2VfaGFuZGxlX3JlZ2lzdGVyAG1ncjogc3RhcnRpbmcgY2xvdWQgYWRhcHRlcgBtZ3I6IGRldk5ldHdvcmsgbW9kZSAtIGRpc2FibGUgY2xvdWQgYWRhcHRlcgBkZXZzX3ZhbHVlX2Zyb21fcG9pbnRlcgBkZXZzX2VudGVyAGRldnNfbWFwbGlrZV9pdGVyAGRlcGxveV9oYW5kbGVyAHN0YXJ0X3BrdF9oYW5kbGVyAGRlcGxveV9tZXRhX2hhbmRsZXIAY2xhc3NJZGVudGlmaWVyAGRldmljZUlkZW50aWZpZXIAYnVmZmVyAG11dGFibGUgQnVmZmVyAHNwaVhmZXIAZnN0b3I6IG5vIHNwYWNlIGZvciBoZWFkZXIASlNPTi5zdHJpbmdpZnkgcmVwbGFjZXIAbnVtYmVyAHJvbGVfbWVtYmVyAGluc3RhbnRpYXRlZCByb2xlIG1lbWJlcgBmcmVlX2ZpYmVyAEZpYmVyAGZsYXNoX2Jhc2VfYWRkcgBleHAAamRfc2hhMjU2X3NldHVwAGRldnNfcHJvdG9fbG9va3VwAGRldnNfc3BlY19sb29rdXAAKCgodWludDMyX3Qpb3RwIDw8IERFVlNfUEFDS19TSElGVCkgPj4gREVWU19QQUNLX1NISUZUKSA9PSAodWludDMyX3Qpb3RwAGJwcABwb3AAISBFeGNlcHRpb246IEluZmluaXRlTG9vcABkZXZzX2J1ZmZlcl9vcABjbGFtcAAhc3dlZXAAc2xlZXAAZGV2c19tYXBsaWtlX2lzX21hcABkZXZzX2R1bXBfaGVhcAB2YWxpZGF0ZV9oZWFwAERldlMtU0hBMjU2OiAlKnAAISBHQy1wdHIgdmFsaWRhdGlvbiBlcnJvcjogJXMgcHRyPSVwACVzOiVwAGNsb3N1cmU6JWQ6JXAAbWV0aG9kOiVkOiVwAGludmFsaWQgdGFnOiAleCBhdCAlcAAhIGhkOiAlcABkZXZzX21hcGxpa2VfZ2V0X3Byb3RvAGdldF9zdGF0aWNfYnVpbHRfaW5fcHJvdG8AZGV2c19nZXRfc3RhdGljX3Byb3RvAGRldnNfaW5zcGVjdF90bwBzbWFsbCBoZWxsbwBncGlvAGpkX3NydmNmZ19ydW4AZGV2c19qZF9zaG91bGRfcnVuAGZ1bgAhIFVuaGFuZGxlZCBleGNlcHRpb24AKiBFeGNlcHRpb24AZGV2c19maWJlcl9jYWxsX2Z1bmN0aW9uAGN0b3IgZnVuY3Rpb24AZmliZXIgc3RhcnRlZCB3aXRoIGEgYnVpbHRpbiBmdW5jdGlvbgBfaTJjVHJhbnNhY3Rpb24AaXNBY3Rpb24AbmV3IHVuc3VwcG9ydGVkIG9uIHRoaXMgZXhwcmVzc2lvbgBAdmVyc2lvbgBiYWQgdmVyc2lvbgBkZXZzX3ZhbHVlX3VucGluAGRldnNfdmFsdWVfcGluAGpvaW4AbWluAGpkX3NldHRpbmdzX3NldF9iaW4AbWFpbgBtZXRoMV9Ec1NlcnZpY2VTcGVjX2Fzc2lnbgBtZ3I6IHByb2dyYW0gd3JpdHRlbgBqZF9vcGlwZV9vcGVuAGpkX2lwaXBlX29wZW4AX3NvY2tldE9wZW4AZnN0b3I6IGdjIGRvbmUsICVkIGZyZWUsICVkIGdlbgBuYW4AYm9vbGVhbgBmcm9tAHJhbmRvbQBmaWxsUmFuZG9tAGFlcy0yNTYtY2NtAGZsYXNoX3Byb2dyYW0AKiBzdG9wIHByb2dyYW0AaW11bAB1bmtub3duIGN0cmwAbm9uLWZpbiBjdHJsAHRvbyBsYXJnZSBjdHJsAG51bGwAZmlsbABpbWFnZSB0b28gc21hbGwAamRfcm9sZV9mcmVlX2FsbABjZWlsAGxhYmVsAHNldEludGVydmFsAGNsZWFySW50ZXJ2YWwAc2lnbmFsAG5vbi1taW5pbWFsAD9zcGVjaWFsAGRldk5ldHdvcmsAZGV2c19pbWdfc3RyaWR4X29rAGRldnNfZ2NfYWRkX2NodW5rAG1hcmtfYmxvY2sAYWxsb2NfYmxvY2sAc3RhY2sAc2Nhbl9nY19vYmoAV1NTSzogc2VudCBhdXRoAGNhbid0IHNlbmQgYXV0aABvdmVybGFwc1dpdGgAZGV2c191dGY4X2NvZGVfcG9pbnRfbGVuZ3RoAHN6ID09IHMtPmxlbmd0aABtYXAtPmNhcGFjaXR5ID49IG1hcC0+bGVuZ3RoAGxlbiA9PSBzLT5pbm5lci5sZW5ndGgASW52YWxpZCBhcnJheSBsZW5ndGgAc2l6ZSA+PSBsZW5ndGgAc2V0TGVuZ3RoAGJ5dGVMZW5ndGgAd2lkdGgAamRfcXVldWVfcHVzaABqZF90eF9mbHVzaABkb19mbHVzaABkZXZzX3N0cmluZ19maW5pc2gAISB2ZXJzaW9uIG1pc21hdGNoAGVuY3J5cHRpb24gdGFnIG1pc21hdGNoAGZvckVhY2gAcCA8IGNoAHNoaWZ0X21zZwBzbWFsbCBtc2cAbmVlZCBmdW5jdGlvbiBhcmcAKnByb2cAbG9nAGNhbid0IHBvbmcAc2V0dGluZwBnZXR0aW5nAGJvZHkgbWlzc2luZwBEQ0ZHIG1pc3NpbmcAYnVmZmVyX3RvX3N0cmluZwBkZXZzX3ZhbHVlX3RvX3N0cmluZwBXU1NLLUg6IGNsZWFyIGNvbm5lY3Rpb24gc3RyaW5nAHRvU3RyaW5nAF9kY2ZnU3RyaW5nACFxX3NlbmRpbmcAJXMgdG9vIGJpZwBkZXZzX2dwaW9faW5pdF9kY2ZnACEgbG9vcGJhY2sgcnggb3ZmACEgZnJtIHNlbmQgb3ZmAGJ1ZgBkZXZzX3N0cmluZ192c3ByaW50ZgBkZXZzX3ZhbHVlX3R5cGVvZgBzZWxmACgodWludDhfdCAqKWRzdClbaV0gPT0gMHhmZgB0YWcgPD0gMHhmZgB5X29mZgBmbmlkeCA8PSAweGZmZmYAbm9uIGZmADAxMjM0NTY3ODlhYmNkZWYAaW5kZXhPZgBzZXRQcm90b3R5cGVPZgBnZXRQcm90b3R5cGVPZgAlZgBxLT5mcm9udCA9PSBxLT5jdXJyX3NpemUAYmxvY2tfc2l6ZQAwIDw9IGRpZmYgJiYgZGlmZiArIGxlbiA8PSBmbGFzaF9zaXplAHEtPmZyb250IDw9IHEtPnNpemUAcS0+YmFjayA8PSBxLT5zaXplAHEtPmN1cnJfc2l6ZSA8PSBxLT5zaXplAHN6ID09IHMtPmlubmVyLnNpemUAc3RhdGUub2ZmICsgMyA8PSBzaXplAGEgcHJpbWl0aXZlAGRldnNfbGVhdmUAdHJ1ZQBleHBhbmRfa2V5X3ZhbHVlAHByb3RvX3ZhbHVlAGRldnNfbWFwbGlrZV90b192YWx1ZQBqc29uX3ZhbHVlAGV4cGFuZF92YWx1ZQA/dmFsdWUAd3JpdGUAX3NvY2tldFdyaXRlAGRldnNfZmliZXJfYWN0aXZhdGUAc3RhdGUgPT0gX3N0YXRlAHJvdGF0ZQB0ZXJtaW5hdGUAY2F1c2UAZGV2c19qc29uX3BhcnNlAGpkX3dzc2tfY2xvc2UAamRfb3BpcGVfY2xvc2UAX3NvY2tldENsb3NlAHdlYnNvY2sgcmVzcG9uc2UAX2NvbW1hbmRSZXNwb25zZQBtZ3I6IHJ1bm5pbmcgc2V0IHRvIGZhbHNlAGZsYXNoX2VyYXNlAHRvTG93ZXJDYXNlAHRvVXBwZXJDYXNlAGRldnNfbWFrZV9jbG9zdXJlAHNwaUNvbmZpZ3VyZQBubyAucHJvdG90eXBlAGludmFsaWQgLnByb3RvdHlwZQBtYWluOiBvcGVuaW5nIGRlcGxveSBwaXBlAG1haW46IGNsb3NlZCBkZXBsb3kgcGlwZQBjbG9uZQBHUElPOiBpbml0IHVzZWQgZG9uZQBpbmxpbmUAZHJhd0xpbmUAZGJnOiByZXN1bWUAamRfdHhfZ2V0X2ZyYW1lAGpkX3B1c2hfaW5fZnJhbWUAV1M6IGNsb3NlIGZyYW1lAHByb3BfRnVuY3Rpb25fbmFtZQBAbmFtZQBkZXZOYW1lAChyb2xlICYgREVWU19ST0xFX01BU0spID09IHJvbGUAX2FsbG9jUm9sZQBmaWxsQ2lyY2xlAG5ldHdvcmsgbm90IGF2YWlsYWJsZQByZWNvbXB1dGVfY2FjaGUAbWFya19sYXJnZQBpbnZhbGlkIHJvdGF0aW9uIHJhbmdlAGJ1ZmZlciBzdG9yZSBvdXQgb2YgcmFuZ2UAb25DaGFuZ2UAcHVzaFJhbmdlAGpkX3dzc2tfc2VuZF9tZXNzYWdlACogIG1lc3NhZ2UAX3R3aW5NZXNzYWdlAGltYWdlAGRyYXdJbWFnZQBkcmF3VHJhbnNwYXJlbnRJbWFnZQBzcGlTZW5kSW1hZ2UAamRfZGV2aWNlX2ZyZWUAP2ZyZWUAZnN0b3I6IG1vdW50ZWQ7ICVkIGZyZWUAbW9kZQBlbmNvZGUAZGVjb2RlAHNldE1vZGUAYnlDb2RlAGV2ZW50Q29kZQBmcm9tQ2hhckNvZGUAcmVnQ29kZQBpbWdfc3RyaWRlAGpkX2FsbG9jYXRlX3NlcnZpY2UAc2xpY2UAc3BsaWNlAFNlcnZlckludGVyZmFjZQBzdWJzY3JpYmUAY2xvdWQAaW1vZAByb3VuZAAhIHNlcnZpY2UgJXM6JWQgbm90IGZvdW5kAGJvdW5kAGlzQm91bmQAcm9sZW1ncl9hdXRvYmluZABqZGlmOiBhdXRvYmluZABkZXZzX21hcGxpa2VfZ2V0X25vX2JpbmQAZGV2c19mdW5jdGlvbl9iaW5kAGpkX3NlbmQAc3VzcGVuZABfc2VydmVyU2VuZABsZWRTdHJpcFNlbmQAYmxvY2sgPCBjaHVuay0+ZW5kAGlzQ29tbWFuZABzZXJ2aWNlQ29tbWFuZABzZW5kQ29tbWFuZABuZXh0X2V2ZW50X2NtZABkZXZzX2pkX3NlbmRfY21kAGhvc3Qgb3IgcG9ydCBpbnZhbGlkAGJ1ZmZlciBudW1mbXQgaW52YWxpZAByb2xlbWdyX2RldmljZV9kZXN0cm95ZWQAcmVhZF9pbmRleGVkACogUkVTVEFSVCByZXF1ZXN0ZWQAbm90SW1wbGVtZW50ZWQAb2JqZWN0IGV4cGVjdGVkAG9uRGlzY29ubmVjdGVkAG9uQ29ubmVjdGVkAGRhdGFfcGFnZV91c2VkAHJvbGUgbmFtZSAnJXMnIGFscmVhZHkgdXNlZAB0cmFuc3Bvc2VkAGZpYmVyIGFscmVhZHkgZGlzcG9zZWQAKiBjb25uZWN0aW9uIHRvICVzIGNsb3NlZABXU1NLLUg6IHN0cmVhbWluZyBleHBpcmVkAGRldnNfdmFsdWVfaXNfcGlubmVkAHRocm93aW5nIG51bGwvdW5kZWZpbmVkAHJlYWRfbmFtZWQAJXUgcGFja2V0cyB0aHJvdHRsZWQAJXMgY2FsbGVkAGRldk5ldHdvcmsgZW5hYmxlZAAhc3RhdGUtPmxvY2tlZABkZXZzX29iamVjdF9nZXRfYXR0YWNoZWQAcm9sZW1ncl9yb2xlX2NoYW5nZWQAZmliZXIgbm90IHN1c3BlbmRlZABXU1NLLUg6IGV4Y2VwdGlvbiB1cGxvYWRlZABwYXlsb2FkAGRldnNjbG91ZDogZmFpbGVkIHVwbG9hZAByZWFkAHNob3J0SWQAcHJvZHVjdElkAGludmFsaWQgZGltZW5zaW9ucyAlZHglZHglZABzZXQgcm9sZSAlcyAtPiAlczolZABmdW46JWQAYnVpbHRpbl9vYmo6JWQAKiAlcyB2JWQuJWQuJWQ7IGZpbGUgdiVkLiVkLiVkAG9ubHkgb25lIHZhbHVlIGV4cGVjdGVkOyBnb3QgJWQAaW52YWxpZCBvZmZzZXQgJWQAISBjYW4ndCB2YWxpZGF0ZSBtZnIgY29uZmlnIGF0ICVwLCBlcnJvciAlZABHUElPOiAlcyglZCkgc2V0IHRvICVkAFVuZXhwZWN0ZWQgdG9rZW4gJyVjJyBpbiBKU09OIGF0IHBvc2l0aW9uICVkAGRiZzogc3VzcGVuZCAlZABqZGlmOiBjcmVhdGUgcm9sZSAnJXMnIC0+ICVkAFdTOiBoZWFkZXJzIGRvbmU7ICVkAFdTU0stSDogdG9vIHNob3J0IGZyYW1lOiAlZABkZXZzX2dldF9wcm9wZXJ0eV9kZXNjAGRldnNfdmFsdWVfZW5jb2RlX3Rocm93X2ptcF9wYwBwYyA9PSAoZGV2c19wY190KXBjAGRldnNfc3RyaW5nX2ptcF90cnlfYWxsb2MAZGV2c2RiZ19waXBlX2FsbG9jAGpkX3JvbGVfYWxsb2MAZGV2c19yZWdjYWNoZV9hbGxvYwBmbGFzaCBzeW5jAGZ1bjFfRGV2aWNlU2NyaXB0X19wYW5pYwBiYWQgbWFnaWMAamRfZnN0b3JfZ2MAbnVtcGFyYW1zICsgMSA9PSBjdHgtPnN0YWNrX3RvcF9mb3JfZ2MAZnN0b3I6IGdjAGRldnNfdmFsdWVfZnJvbV9wYWNrZXRfc3BlYwBkZXZzX2dldF9iYXNlX3NwZWMAZGV2c192YWx1ZV9mcm9tX3NlcnZpY2Vfc3BlYwBQYWNrZXRTcGVjAFNlcnZpY2VTcGVjAGRldmljZXNjcmlwdC92ZXJpZnkuYwBkZXZpY2VzY3JpcHQvZGV2aWNlc2NyaXB0LmMAamFjZGFjLWMvc291cmNlL2pkX251bWZtdC5jAGRldmljZXNjcmlwdC9pbXBsX3NvY2tldC5jAGRldmljZXNjcmlwdC9pbnNwZWN0LmMAZGV2aWNlc2NyaXB0L29iamVjdHMuYwBkZXZpY2VzY3JpcHQvZmliZXJzLmMAZGV2aWNlc2NyaXB0L3ZtX29wcy5jAGphY2RhYy1jL3NvdXJjZS9qZF9zZXJ2aWNlcy5jAGRldmljZXNjcmlwdC9pbXBsX2RzLmMAamFjZGFjLWMvc291cmNlL2pkX2ZzdG9yLmMAZGV2aWNlc2NyaXB0L2RldnNtZ3IuYwBqYWNkYWMtYy9jbGllbnQvcm9sZW1nci5jAGRldmljZXNjcmlwdC9idWZmZXIuYwBkZXZpY2VzY3JpcHQvaW1wbF9ncGlvLmMAZGV2aWNlc2NyaXB0L2pzb24uYwBkZXZpY2VzY3JpcHQvaW1wbF9mdW5jdGlvbi5jAGRldmljZXNjcmlwdC9uZXR3b3JrL3dlYnNvY2tfY29ubi5jAGRldmljZXNjcmlwdC92bV9tYWluLmMAZGV2aWNlc2NyaXB0L25ldHdvcmsvYWVzX2NjbS5jAGphY2RhYy1jL3NvdXJjZS9qZF91dGlsLmMAZGV2aWNlc2NyaXB0L25ldHdvcmsvd3Nzay5jAHBvc2l4L2ZsYXNoLmMAamFjZGFjLWMvY2xpZW50L3JvdXRpbmcuYwBkZXZpY2VzY3JpcHQvc3RyaW5nLmMAamFjZGFjLWMvc291cmNlL2pkX3NydmNmZy5jAGphY2RhYy1jL3NvdXJjZS9qZF9kY2ZnLmMAZGV2aWNlc2NyaXB0L2RldnNkYmcuYwBkZXZpY2VzY3JpcHQvdmFsdWUuYwBqYWNkYWMtYy9zb3VyY2UvaW50ZXJmYWNlcy90eF9xdWV1ZS5jAGphY2RhYy1jL3NvdXJjZS9pbnRlcmZhY2VzL2V2ZW50X3F1ZXVlLmMAamFjZGFjLWMvc291cmNlL2pkX3F1ZXVlLmMAamFjZGFjLWMvc291cmNlL2pkX29waXBlLmMAamFjZGFjLWMvc291cmNlL2pkX2lwaXBlLmMAZGV2aWNlc2NyaXB0L3JlZ2NhY2hlLmMAZGV2aWNlc2NyaXB0L2ltcGxfaW1hZ2UuYwBkZXZpY2VzY3JpcHQvamRpZmFjZS5jAGRldmljZXNjcmlwdC9nY19hbGxvYy5jAGRldmljZXNjcmlwdC9pbXBsX3NlcnZpY2VzcGVjLmMAZGV2aWNlc2NyaXB0L3V0ZjguYwBkZXZpY2VzY3JpcHQvc29mdF9zaGEyNTYuYwBmaWIAPz8/YgBtZ3I6IGRlcGxveSAlZCBiAGRldnNfYnVmZmVyX2RhdGEAb25fZGF0YQBleHBlY3RpbmcgdG9waWMgYW5kIGRhdGEAX19uZXdfXwBfX3Byb3RvX18AX19zdGFja19fAF9fZnVuY19fAFtUaHJvdzogJXhdAFtGaWJlcjogJXhdAFtSb2xlOiAlcy4lc10AW1BhY2tldFNwZWM6ICVzLiVzXQBbRnVuY3Rpb246ICVzXQBbQ2xvc3VyZTogJXNdAFtSb2xlOiAlc10AW01ldGhvZDogJXNdAFtTZXJ2aWNlU3BlYzogJXNdAFtDaXJjdWxhcl0AW0J1ZmZlclsldV0gJSpwXQBzZXJ2ICVzLyVkIHJlZyBjaGcgJXggW3N6PSVkXQBbUGFja2V0OiAlcyBjbWQ9JXggc3o9JWRdAFtTdGF0aWMgT2JqOiAlZF0AW0J1ZmZlclsldV0gJSpwLi4uXQBbSW1hZ2U6ICVkeCVkICglZCBicHApXQBmbGlwWQBmbGlwWABpZHggPD0gREVWU19CVUlMVElOX09CSkVDVF9fX01BWABsZXYgPD0gREVWU19TUEVDSUFMX1RIUk9XX0pNUF9MRVZFTF9NQVgAcGMgJiYgcGMgPD0gREVWU19TUEVDSUFMX1RIUk9XX0pNUF9QQ19NQVgAaWR4IDw9IERFVlNfU0VSVklDRVNQRUNfRkxBR19ERVJJVkVfTEFTVABleHBlY3RpbmcgQ09OVABkZXZzX2djX3RhZyhiKSA9PSBERVZTX0dDX1RBR19QQUNLRVQAY21kLT5wa3QtPnNlcnZpY2VfY29tbWFuZCA9PSBKRF9ERVZTX0RCR19DTURfUkVBRF9JTkRFWEVEX1ZBTFVFUwAodGFnICYgREVWU19HQ19UQUdfTUFTSykgPj0gREVWU19HQ19UQUdfQllURVMAQkFTSUNfVEFHKGItPmhlYWRlcikgPT0gREVWU19HQ19UQUdfQllURVMARlNUT1JfREFUQV9QQUdFUyA8PSBKRF9GU1RPUl9NQVhfREFUQV9QQUdFUwBkZXZzX2djX3RhZyhiKSA9PSBERVZTX0dDX1RBR19CVUZGRVIAbWlkeCA8IE1BWF9QUk9UTwBzdG10X2NhbGxOAE5hTgBDb252ZXJ0aW5nIGNpcmN1bGFyIHN0cnVjdHVyZSB0byBKU09OAGlkeCA+PSBERVZTX0ZJUlNUX0JVSUxUSU5fRlVOQ1RJT04AZXhwZWN0aW5nIEJJTgBwa3QgIT0gTlVMTABzZXR0aW5ncyAhPSBOVUxMAHRyZyAhPSBOVUxMAGYgIT0gTlVMTABmbGFzaF9iYXNlICE9IE5VTEwAZmliICE9IE5VTEwAZGF0YSAhPSBOVUxMAFdTU0sAKHRtcC52MCAmIEpEX0RFVlNfREJHX1NUUklOR19TVEFUSUNfSU5ESUNBVE9SX01BU0spICE9IEpEX0RFVlNfREJHX1NUUklOR19TVEFUSUNfSU5ESUNBVE9SX01BU0sAU1BJAERJU0NPTk5FQ1RJTkcAc3ogPT0gbGVuICYmIHN6IDwgREVWU19NQVhfQVNDSUlfU1RSSU5HAG1ncjogd291bGQgcmVzdGFydCBkdWUgdG8gRENGRwAwIDw9IGRpZmYgJiYgZGlmZiA8PSBmbGFzaF9zaXplIC0gSkRfRkxBU0hfUEFHRV9TSVpFAHdzLT5tc2dwdHIgPD0gTUFYX01FU1NBR0UATE9HMkUATE9HMTBFAERJU0NPTk5FQ1RFRAAhIGludmFsaWQgQ1JDAEkyQwA/Pz8AJWMgICVzID0+AGludDoAYXBwOgB3c3NrOgB1dGY4AHNpemUgPiBzaXplb2YoY2h1bmtfdCkgKyAxMjgAdXRmLTgAc2hhMjU2AGNudCA9PSAzIHx8IGNudCA9PSAtMwBsZW4gPT0gbDIAbG9nMgBkZXZzX2FyZ19pbWcyAFNRUlQxXzIAU1FSVDIATE4yAGpkX251bWZtdF93cml0ZV9pMzIAamRfbnVtZm10X3JlYWRfaTMyAHNpemUgPj0gMgBXUzogZ290IDEwMQBIVFRQLzEuMSAxMDEAZXZlbnRfc2NvcGUgPT0gMQBjdHgtPnN0YWNrX3RvcCA9PSBOICsgMQBsb2cxMABMTjEwAHNpemUgPCAweGYwMDAAbnVtX2VsdHMgPCAxMDAwAGF1dGggbm9uLTAAc3ogPiAwAHNlcnZpY2VfY29tbWFuZCA+IDAAYWN0LT5tYXhwYyA+IDAAc3ogPj0gMABpZHggPj0gMAByID49IDAAc3RyLT5jdXJyX3JldHJ5ID09IDAAamRfc3J2Y2ZnX2lkeCA9PSAwAGgtPm51bV9hcmdzID09IDAAZXJyID09IDAAY3R4LT5zdGFja190b3AgPT0gMABldmVudF9zY29wZSA9PSAwAHN0cltzel0gPT0gMABkZXZzX2hhbmRsZV9oaWdoX3ZhbHVlKG9iaikgPT0gMAAoY3R4LT5mbGFncyAmIERFVlNfQ1RYX0ZMQUdfQlVTWSkgPT0gMAAoaHYgPj4gREVWU19QQUNLX1NISUZUKSA9PSAwACh0YWcgJiBERVZTX0dDX1RBR19NQVNLX1BJTk5FRCkgPT0gMAAoZGlmZiAmIDcpID09IDAAKCh1aW50cHRyX3Qpc3JjICYgMykgPT0gMAAoKHVpbnRwdHJfdClpbWdkYXRhICYgMykgPT0gMABkZXZzX3ZlcmlmeShkZXZzX2VtcHR5X3Byb2dyYW0sIHNpemVvZihkZXZzX2VtcHR5X3Byb2dyYW0pKSA9PSAwACgodG1wLnYwIDw8IDEpICYgfihKRF9ERVZTX0RCR19TVFJJTkdfU1RBVElDX0lOREVYX01BU0spKSA9PSAwACgodG1wLnRhZyA8PCAyNCkgJiB+KEpEX0RFVlNfREJHX1NUUklOR19TVEFUSUNfVEFHX01BU0spKSA9PSAwAChHRVRfVEFHKGItPmhlYWRlcikgJiAoREVWU19HQ19UQUdfTUFTS19QSU5ORUQgfCBERVZTX0dDX1RBR19NQVNLX1NDQU5ORUQpKSA9PSAwAChkaWZmICYgKEpEX0ZMQVNIX1BBR0VfU0laRSAtIDEpKSA9PSAwACgodWludHB0cl90KXB0ciAmIChKRF9QVFJTSVpFIC0gMSkpID09IDAAcHQgIT0gMAAoY3R4LT5mbGFncyAmIERFVlNfQ1RYX0ZMQUdfQlVTWSkgIT0gMAAodGFnICYgREVWU19HQ19UQUdfTUFTS19QSU5ORUQpICE9IDAAL3dzc2svAHdzOi8vAHdzczovLwBwaW5zLgA/LgAlYyAgLi4uACEgIC4uLgAsAHBhY2tldCA2NGsrACFkZXZzX2luX3ZtX2xvb3AoY3R4KQBkZXZzX2hhbmRsZV9pc19wdHIodikAZGV2c19idWZmZXJpc2hfaXNfYnVmZmVyKHYpAGRldnNfaXNfYnVmZmVyKGN0eCwgdikAZGV2c19oYW5kbGVfdHlwZSh2KSA9PSBERVZTX0hBTkRMRV9UWVBFX0dDX09CSkVDVCAmJiBkZXZzX2lzX3N0cmluZyhjdHgsIHYpAGVuY3J5cHRlZCBkYXRhIChsZW49JXUpIHNob3J0ZXIgdGhhbiB0YWdMZW4gKCV1KQAlcyBub3Qgc3VwcG9ydGVkICh5ZXQpAHNpemUgPiBzaXplb2YoZGV2c19pbWdfaGVhZGVyX3QpAGRldnM6IE9PTSAoJXUgYnl0ZXMpAFdTU0s6IHByb2Nlc3MgaGVsbG8gKCVkIGJ5dGVzKQBXU1NLOiBwcm9jZXNzIGF1dGggKCVkIGJ5dGVzKQBXU1NLLUg6IHN0YXR1cyAlZCAoJXMpAGRldnNfYnVmZmVyX2lzX3dyaXRhYmxlKGN0eCwgYnVmZmVyKQByID09IE5VTEwgfHwgZGV2c19pc19tYXAocikAZGV2c19pc19tYXAobWFwKQBkZXZzX2lzX21hcChwcm90bykAZGV2c19pc19wcm90byhwcm90bykAKG51bGwpAHN0YXRzOiAlZCBvYmplY3RzLCAlZCBCIHVzZWQsICVkIEIgZnJlZSAoJWQgQiBtYXggYmxvY2spAGRldnNfaXNfbWFwKG9iaikAZmlkeCA8IChpbnQpZGV2c19pbWdfbnVtX2Z1bmN0aW9ucyhjdHgtPmltZykAZGV2c19oYW5kbGVfdHlwZV9pc19wdHIodHlwZSkAaXNfbGFyZ2UoZSkAR1BJTzogc2tpcCAlcyAtPiAlZCAodXNlZCkAISBpbnZhbGlkIHBrdCBzaXplOiAlZCAob2ZmPSVkIGVuZHA9JWQpAEdQSU86IGluaXRbJXVdICVzIC0+ICVkICg9JWQpACEgRXhjZXB0aW9uOiBQYW5pY18lZCBhdCAoZ3BjOiVkKQAqICBhdCB1bmtub3duIChncGM6JWQpACogIGF0ICVzX0YlZCAocGM6JWQpACEgIGF0ICVzX0YlZCAocGM6JWQpAGFjdDogJXNfRiVkIChwYzolZCkAISBtaXNzaW5nICVkIGJ5dGVzIChvZiAlZCkAZGV2c19pc19tYXAoc3JjKQBkZXZzX2lzX3NlcnZpY2Vfc3BlYyhjdHgsIHNwZWMpACEoaC0+ZmxhZ3MgJiBERVZTX0JVSUxUSU5fRkxBR19JU19QUk9QRVJUWSkAb2ZmIDwgKDEgPDwgTUFYX09GRl9CSVRTKQBHRVRfVEFHKGItPmhlYWRlcikgPT0gKERFVlNfR0NfVEFHX01BU0tfUElOTkVEIHwgREVWU19HQ19UQUdfQllURVMpAG9mZiA8ICh1bnNpZ25lZCkoRlNUT1JfREFUQV9QQUdFUykAJXMgKFdTU0spACF0YXJnZXRfaW5faXJxKCkAISBVc2VyLXJlcXVlc3RlZCBKRF9QQU5JQygpAGZzdG9yOiBpbnZhbGlkIGxhcmdlIGtleTogJyVzJwBmc3RvcjogaW52YWxpZCBrZXk6ICclcycAemVybyBrZXkhAGRlcGxveSBkZXZpY2UgbG9zdAoAR0VUICVzIEhUVFAvMS4xDQpIb3N0OiAlcw0KT3JpZ2luOiBodHRwOi8vJXMNClNlYy1XZWJTb2NrZXQtS2V5OiAlcz09DQpTZWMtV2ViU29ja2V0LVByb3RvY29sOiAlcw0KVXNlci1BZ2VudDogamFjZGFjLWMvJXMNClByYWdtYTogbm8tY2FjaGUNCkNhY2hlLUNvbnRyb2w6IG5vLWNhY2hlDQpVcGdyYWRlOiB3ZWJzb2NrZXQNCkNvbm5lY3Rpb246IFVwZ3JhZGUNClNlYy1XZWJTb2NrZXQtVmVyc2lvbjogMTMNCg0KAAEAMC4wLjAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAABEQ0ZHCpu0yvgAAAAEAAAAOLHJHaZxFQkAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQACAAIAAgACAAMAAwADAAMAAwADAAMAAwADAAQABAAEAAQABAAEAAQAZGV2TmFtZQAAAAAAAAAAAD1DdgDQAAAAaWQAAAAAAAAAAAAAAAAAANhdEgDuAAAAYXJjaElkAAAAAAAAAAAAAGZ9EgDzAAAAcHJvZHVjdElkAAAAAAAAAJfBAQBvtOU/AP//////////////////////////////RGV2aWNlU2NyaXB0IFNpbXVsYXRvciAoV0FTTSkAd2FzbQB3YXNtAJxuYBQMAAAAAwAAAAQAAADwnwYAARCAEIEQgBHxDwAAQFtbFRwBAAAGAAAABwAAAAAAAAAAAAAAAAAHAPCfBgCAEIEQ8Q8AACvqNBFAAQAACwAAAAwAAABEZXZTCm4p8QAADwIAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAkAAAAAwAAACcAAAAAAAAAJwAAAAAAAAAnAAAAAAAAACcAAAAAAAAAJwAAAAAAAAAnAAAAAQAAACgAAAAAAAAAKAAAAAAAAAAkAAAAAgAAAAAAAAAUEAAAJgAAAAEAAAAAAAAADRAAAAnAQKQDAAAAC4MAAAAAAAAAQAAAAMKAgAEAAAAAAAGAAAAAAAACAAFAAcAAAAAAAAAAAAAAAAAAAAJDAsACgAABg4SDBAIAAIAKQAAGAAAABcAAAAaAAAAFwAAABcAAAAXAAAAFwAAABcAAAAZAAAAFACjwxoApMM6AKXDDQCmwzYAp8M3AKjDIwCpwzIAqsMeAKvDSwCswx8ArcMoAK7DJwCvwwAAAAAAAAAAAAAAAFUAsMNWALHDVwCyw3kAs8NYALTDNAACAAAAAAB7ALTDAAAAAAAAAAAAAAAAAAAAAGwAUsNYAFPDNAAEAAAAAAAiAFDDTQBRw3sAU8M1AFTDbwBVwz8AVsMhAFfDAAAAAA4AWMOVAFnD2QBiwzQABgAAAAAAAAAAAAAAAAAAAAAAIgBaw0QAW8MZAFzDEABdw9sAXsO2AF/D1gBgw9cAYcMAAAAAqADjwzQACAAAAAAAIgDew7cA38MVAODDUQDhwz8A4sO2AOTDtQDlw7QA5sMAAAAANAAKAAAAAAAAAAAAjwCEwzQADAAAAAAAAAAAAJEAf8OZAIDDjQCBw44AgsMAAAAANAAOAAAAAAAAAAAAIADTw5wA1MNwANXDAAAAADQAEAAAAAAAAAAAAAAAAABOAIXDNACGw2MAh8MAAAAANAASAAAAAAA0ABQAAAAAAFkAtcNaALbDWwC3w1wAuMNdALnDaQC6w2sAu8NqALzDXgC9w2QAvsNlAL/DZgDAw2cAwcNoAMLDkwDDw5wAxMNfAMXDpgDGwwAAAAAAAAAASgBjw6cAZMMwAGXDmgBmwzkAZ8NMAGjDfgBpw1QAasNTAGvDfQBsw4gAbcOUAG7DWgBvw6UAcMOpAHHDpgByw84Ac8PNAHTD2gB1w6oAdsOrAHfDzwB4w4wAg8OsANvDrQDcw64A3cMAAAAAAAAAAFkAz8NjANDDYgDRwwAAAAADAAAPAAAAAMA5AAADAAAPAAAAAAA6AAADAAAPAAAAABw6AAADAAAPAAAAADA6AAADAAAPAAAAAEA6AAADAAAPAAAAAGA6AAADAAAPAAAAAIA6AAADAAAPAAAAAKQ6AAADAAAPAAAAALA6AAADAAAPAAAAANQ6AAADAAAPAAAAANw6AAADAAAPAAAAAOA6AAADAAAPAAAAAPA6AAADAAAPAAAAAAQ7AAADAAAPAAAAABA7AAADAAAPAAAAACA7AAADAAAPAAAAADA7AAADAAAPAAAAAEA7AAADAAAPAAAAANw6AAADAAAPAAAAAEg7AAADAAAPAAAAAFA7AAADAAAPAAAAAKA7AAADAAAPAAAAABA8AAADAAAPKD0AADA+AAADAAAPKD0AADw+AAADAAAPKD0AAEQ+AAADAAAPAAAAANw6AAADAAAPAAAAAEg+AAADAAAPAAAAAGA+AAADAAAPAAAAAHA+AAADAAAPcD0AAHw+AAADAAAPAAAAAIQ+AAADAAAPcD0AAJA+AAADAAAPAAAAAJg+AAADAAAPAAAAAKQ+AAADAAAPAAAAAKw+AAADAAAPAAAAALg+AAADAAAPAAAAAMA+AAADAAAPAAAAANg+AAADAAAPAAAAAOA+AAADAAAPAAAAAPw+AAADAAAPAAAAABA/AAADAAAPAAAAAGQ/AAADAAAPAAAAAHA/AAA4AM3DSQDOwwAAAABYANLDAAAAAAAAAABYAHnDNAAcAAAAAAAAAAAAAAAAAAAAAAB7AHnDYwB9w34AfsMAAAAAWAB7wzQAHgAAAAAAewB7wwAAAABYAHrDNAAgAAAAAAB7AHrDAAAAAFgAfMM0ACIAAAAAAHsAfMMAAAAAhgChw4cAosMAAAAANAAlAAAAAACeANbDYwDXw58A2MPhANnDVQDawwAAAAA0ACcAAAAAAKEAx8NjAMjDYgDJw6IAysPgAMvDYADMwwAAAAAOAJDDNAApAAAAAAAAAAAAAAAAALkAjMO6AI3DuwCOwxIAj8O+AJHDvACSw78Ak8PGAJTDyACVw70AlsPAAJfDwQCYw8IAmcPDAJrDxACbw8UAnMPHAJ3DywCew8wAn8PKAKDDAAAAADQAKwAAAAAAAAAAANIAiMPTAInD1ACKw9UAi8MAAAAAAAAAAAAAAAAAAAAAIgAAARMAAABNAAIAFAAAAGwAAQQVAAAADwAACBYAAAA1AAAAFwAAAG8AAQAYAAAAPwAAABkAAAAhAAEAGgAAAA4AAQQbAAAAlQACBBwAAAAiAAABHQAAAEQAAQAeAAAAGQADAB8AAAAQAAQAIAAAANsAAwAhAAAAtgADACIAAADWAAAAIwAAANcABAAkAAAA2QADBCUAAABKAAEEJgAAAKcAAQQnAAAAMAABBCgAAACaAAAEKQAAADkAAAQqAAAATAAABCsAAAB+AAIELAAAAFQAAQQtAAAAUwABBC4AAAB9AAIELwAAAIgAAQQwAAAAlAAABDEAAABaAAEEMgAAAKUAAgQzAAAAqQACBDQAAACmAAAENQAAAM4AAgQ2AAAAzQADBDcAAADaAAIEOAAAAKoABQQ5AAAAqwACBDoAAADPAAMEOwAAAHIAAQg8AAAAdAABCD0AAABzAAEIPgAAAIQAAQg/AAAAYwAAAUAAAAB+AAAAQQAAAJEAAAFCAAAAmQAAAUMAAACNAAEARAAAAI4AAABFAAAAjAABBEYAAACPAAAERwAAAE4AAABIAAAANAAAAUkAAABjAAABSgAAANIAAAFLAAAA0wAAAUwAAADUAAABTQAAANUAAQBOAAAAuQAAAU8AAAC6AAABUAAAALsAAAFRAAAAEgAAAVIAAAAOAAUEUwAAAL4AAwBUAAAAvAACAFUAAAC/AAEAVgAAAMYABQBXAAAAyAABAFgAAAC9AAAAWQAAAMAAAABaAAAAwQAAAFsAAADCAAAAXAAAAMMAAwBdAAAAxAAEAF4AAADFAAMAXwAAAMcABQBgAAAAywAFAGEAAADMAAsAYgAAAMoABABjAAAAhgACBGQAAACHAAMEZQAAABQAAQRmAAAAGgABBGcAAAA6AAEEaAAAAA0AAQRpAAAANgAABGoAAAA3AAEEawAAACMAAQRsAAAAMgACBG0AAAAeAAIEbgAAAEsAAgRvAAAAHwACBHAAAAAoAAIEcQAAACcAAgRyAAAAVQACBHMAAABWAAEEdAAAAFcAAQR1AAAAeQACBHYAAABSAAEIdwAAAFkAAAF4AAAAWgAAAXkAAABbAAABegAAAFwAAAF7AAAAXQAAAXwAAABpAAABfQAAAGsAAAF+AAAAagAAAX8AAABeAAABgAAAAGQAAAGBAAAAZQAAAYIAAABmAAABgwAAAGcAAAGEAAAAaAAAAYUAAACTAAABhgAAAJwAAAGHAAAAXwAAAIgAAACmAAAAiQAAAKEAAAGKAAAAYwAAAYsAAABiAAABjAAAAKIAAAGNAAAA4AAAAY4AAABgAAAAjwAAADgAAACQAAAASQAAAJEAAABZAAABkgAAAGMAAAGTAAAAYgAAAZQAAABYAAAAlQAAACAAAAGWAAAAnAAAAZcAAABwAAIAmAAAAJ4AAAGZAAAAYwAAAZoAAACfAAEAmwAAAOEAAQCcAAAAVQABAJ0AAACsAAIEngAAAK0AAASfAAAArgABBKAAAAAiAAABoQAAALcAAAGiAAAAFQABAKMAAABRAAEApAAAAD8AAgClAAAAqAAABKYAAAC2AAMApwAAALUAAACoAAAAtAAAAKkAAACMHAAAAAwAAJEEAACbEQAAKRAAAFgXAABcHQAAriwAAJsRAACbEQAAEwoAAFgXAABLHAAAAAAAAJgvikKRRDdxz/vAtaXbtelbwlY58RHxWaSCP5LVXhyrmKoH2AFbgxK+hTEkw30MVXRdvnL+sd6Apwbcm3Txm8HBaZvkhke+78adwQ/MoQwkbyzpLaqEdErcqbBc2oj5dlJRPphtxjGoyCcDsMd/Wb/zC+DGR5Gn1VFjygZnKSkUhQq3JzghGy78bSxNEw04U1RzCmW7Cmp2LsnCgYUscpKh6L+iS2YaqHCLS8KjUWzHGeiS0SQGmdaFNQ70cKBqEBbBpBkIbDceTHdIJ7W8sDSzDBw5SqrYTk/KnFvzby5o7oKPdG9jpXgUeMiECALHjPr/vpDrbFCk96P5vvJ4ccbvv70AAAAAAAAAAAAAAOBBQAAAAAAAAAABAAAAAAAAAAIAAAAAAAAAQgAAAAAAAAADAAAAAAAAAAMAAAACAAAABAAAAAkAAAAIAAAACwAAAAIAAAACAAAACgAAAAkAAAANAAAAAAAAAAAAAAAAAAAASTcAAAkEAAACCAAAjSwAAAoEAAC5LQAAPC0AAIgsAACCLAAAuyoAANsrAAAuLQAANi0AAEsMAABeIgAAkQQAALUKAAA9FAAAKRAAAJkHAADeFAAA1goAAHgRAADHEAAATRoAAM8KAAAIDwAApRYAACUTAADCCgAAcgYAAIUUAABiHQAAnxMAACIWAADgFgAAsy0AABstAACbEQAA4AQAAKQTAAAKBwAAsxQAAHoQAAALHAAAyh4AALseAAATCgAAgSIAAEsRAADwBQAAdwYAAK0aAABNFgAAShQAAAsJAABOIAAAngcAADwdAAC8CgAAKRYAAI0JAAADFQAACh0AABAdAABnBwAAWBcAACcdAABfFwAAOBkAAHofAAB8CQAAcAkAAI8ZAACFEQAANx0AAK4KAACSBwAA4QcAADEdAAC8EwAAyAoAAHMKAAAVCQAAgwoAANUTAADhCgAA3AsAAL4nAACOGwAAGBAAAFMgAACzBAAA/B0AAC0gAAC2HAAArxwAACoKAAC4HAAAZhsAALIIAADMHAAAOAoAAEEKAADjHAAA0QsAAHMHAADyHQAAlwQAAAUbAACLBwAAFBwAAAseAAC0JwAAAg8AAPMOAAD9DgAAZhUAADYcAADXGQAAoicAAE0YAABcGAAAlQ4AAKonAACMDgAALQgAAE8MAADpFAAAPgcAAPUUAABJBwAA5w4AAOAqAADnGQAAQwQAAGgXAADADgAAmRsAALEQAAC+HQAAGhsAAM0ZAADqFwAA2ggAAF8eAAAoGgAAPhMAAMoLAABFFAAArwQAAMwsAADuLAAACCAAAA8IAAAODwAAFiMAACYjAAAIEAAA9xAAABsjAADzCAAAHxoAABcdAAAaCgAAxh0AAJweAACfBAAA1hwAAJMbAACJGgAAPxAAAA0UAAAKGgAAlRkAALoIAAAIFAAABBoAAOEOAACdJwAAaxoAAF8aAABFGAAAMxYAAHccAAA+FgAAdQkAAEcRAAA0CgAA6hoAANEJAAC4FAAA3ygAANkoAAABHwAAURwAAFscAACYFQAAegoAAAwbAADDCwAALAQAAJ4bAAA0BgAAawkAAC4TAAA+HAAAcBwAAJUSAADjFAAAqhwAAAYMAACJGQAAvRwAAFEUAADyBwAA+gcAAGAHAADSHQAAxhkAAEwPAACsCAAANxMAAGwHAACyGgAAxRwAAH9gERITFBUWFxgZElFwMUJgMTEUQCAgQQITISEhYGAQERFgYGBgYGBgYBADAEFAQUBAQUBBQUFBQUFCQkJCQkJCQkJCQkJCQkEyISBBEDASMHAQEFFRcRBBQkBCQhFgAAAAAAAAAAAAqgAAAKsAAACsAAAArQAAAK4AAACvAAAAsAAAALEAAACyAAAAswAAALQAAAC1AAAAtgAAALcAAAC4AAAAuQAAALoAAAC7AAAAvAAAAL0AAAC+AAAAvwAAAMAAAADBAAAAwgAAAMMAAADEAAAAxQAAAMYAAADHAAAAyAAAAMkAAADKAAAAywAAAMwAAADNAAAAzgAAAM8AAADQAAAA0QAAANIAAADTAAAAqgAAANQAAADVAAAA1gAAANcAAADYAAAA2QAAANoAAADbAAAA3AAAAN0AAADeAAAA3wAAAOAAAADhAAAA4gAAAOMAAADkAAAA5QAAAOYAAADnAAAA6AAAAOkAAADqAAAA6wAAAOwAAADtAAAA7gAAAO8AAADwAAAA8QAAAPIAAADzAAAA9AAAAPUAAACqAAAA9gAAAPcAAAD4AAAA+QAAAPoAAAD7AAAA/AAAAP0AAAD+AAAA/wAAAAABAAABAQAAAgEAAAMBAAAEAQAABQEAAAYBAACqAAAARitSUlJSEVIcQlJSUlIAAGN8d3vya2/FMAFnK/7Xq3bKgsl9+llH8K3Uoq+cpHLAt/2TJjY/98w0peXxcdgxFQTHI8MYlgWaBxKA4usnsnUJgywaG25aoFI71rMp4y+EU9EA7SD8sVtqy745SkxYz9DvqvtDTTOFRfkCf1A8n6hRo0CPkp049by22iEQ//PSzQwT7F+XRBfEp349ZF0Zc2CBT9wiKpCIRu64FN5eC9vgMjoKSQYkXMLTrGKRleR558g3bY3VTqlsVvTqZXquCLp4JS4cprTG6N10H0u9i4pwPrVmSAP2DmE1V7mGwR2e4fiYEWnZjpSbHofpzlUo34yhiQ2/5kJoQZktD7BUuxaNAQIECBAgQIAbNgAAAAAAAAAAACwCAAApAgAAIwIAACkCAADwnwYAgjGAUIFQ8Q/87mIUaAAAAAcBAAAIAQAACQEAAAoBAAAABAAACwEAAAwBAADwnwYAgBCBEfEPAABmfkseMAEAAA0BAAAOAQAA8J8GAPEPAABK3AcRCAAAAA8BAAAQAQAAAAAAAAgAAAARAQAAEgEAAAAAAAAAAAAAAQECAgQEBAgBAAECBAQAAAEAAAAAAAAACgAAAAAAAABkAAAAAAAAAOgDAAAAAAAAECcAAAAAAACghgEAAAAAAEBCDwAAAAAAgJaYAAAAAAAA4fUFAAAAAADKmjsAAAAAAOQLVAIAAAAA6HZIFwAAAAAQpdToAAAAAKByThgJAAAAQHoQ81oAAAA4+v5CLuY/MGfHk1fzLj0BAAAAAADgv1swUVVVVdU/kEXr////z78RAfEks5nJP5/IBuV1VcW/AAAAAAAA4L93VVVVVVXVP8v9/////8+/DN2VmZmZyT+nRWdVVVXFvzDeRKMkScI/ZT1CpP//v7/K1ioohHG8P/9osEPrmbm/hdCv94KBtz/NRdF1E1K1v5/e4MPwNPc/AJDmeX/M178f6SxqeBP3PwAADcLub9e/oLX6CGDy9j8A4FET4xPXv32MEx+m0fY/AHgoOFu41r/RtMULSbH2PwB4gJBVXda/ugwvM0eR9j8AABh20ALWvyNCIhifcfY/AJCQhsqo1b/ZHqWZT1L2PwBQA1ZDT9W/xCSPqlYz9j8AQGvDN/bUvxTcnWuzFPY/AFCo/aed1L9MXMZSZPb1PwCoiTmSRdS/TyyRtWfY9T8AuLA59O3Tv96QW8u8uvU/AHCPRM6W0794GtnyYZ31PwCgvRceQNO/h1ZGElaA9T8AgEbv4unSv9Nr586XY/U/AOAwOBuU0r+Tf6fiJUf1PwCI2ozFPtK/g0UGQv8q9T8AkCcp4enRv9+9stsiD/U/APhIK22V0b/X3jRHj/P0PwD4uZpnQdG/QCjez0PY9D8AmO+U0O3Qv8ijeMA+vfQ/ABDbGKWa0L+KJeDDf6L0PwC4Y1LmR9C/NITUJAWI9D8A8IZFIuvPvwstGRvObfQ/ALAXdUpHz79UGDnT2VP0PwAwED1EpM6/WoS0RCc69D8AsOlEDQLOv/v4FUG1IPQ/APB3KaJgzb+x9D7aggf0PwCQlQQBwMy/j/5XXY/u8z8AEIlWKSDMv+lMC6DZ1fM/ABCBjReBy78rwRDAYL3zPwDQ08zJ4sq/uNp1KySl8z8AkBIuQEXKvwLQn80ijfM/APAdaHeoyb8ceoTFW3XzPwAwSGltDMm/4jatSc5d8z8AwEWmIHHIv0DUTZh5RvM/ADAUtI/Wx78ky//OXC/zPwBwYjy4PMe/SQ2hdXcY8z8AYDebmqPGv5A5PjfIAfM/AKC3VDELxr9B+JW7TuvyPwAwJHZ9c8W/0akZAgrV8j8AMMKPe9zEvyr9t6j5vvI/AADSUSxGxL+rGwx6HKnyPwAAg7yKsMO/MLUUYHKT8j8AAElrmRvDv/WhV1f6ffI/AECkkFSHwr+/Ox2bs2jyPwCgefi588G/vfWPg51T8j8AoCwlyGDBvzsIyaq3PvI/ACD3V3/OwL+2QKkrASryPwCg/kncPMC/MkHMlnkV8j8AgEu8vVe/v5v80h0gAfI/AEBAlgg3vr8LSE1J9OzxPwBA+T6YF72/aWWPUvXY8T8AoNhOZ/m7v3x+VxEjxfE/AGAvIHncur/pJst0fLHxPwCAKOfDwLm/thosDAGe8T8AwHKzRqa4v71wtnuwivE/AACsswGNt7+2vO8linfxPwAAOEXxdLa/2jFMNY1k8T8AgIdtDl61v91fJ5C5UfE/AOCh3lxItL9M0jKkDj/xPwCgak3ZM7O/2vkQcoss8T8AYMX4eSCyvzG17CgwGvE/ACBimEYOsb+vNITa+wfxPwAA0mps+q+/s2tOD+718D8AQHdKjdqtv86fKl0G5PA/AACF5Oy8q78hpSxjRNLwPwDAEkCJoam/GpjifKfA8D8AwAIzWIinv9E2xoMvr/A/AIDWZ15xpb85E6CY253wPwCAZUmKXKO/3+dSr6uM8D8AQBVk40mhv/soTi+fe/A/AIDrgsBynr8ZjzWMtWrwPwCAUlLxVZq/LPnspe5Z8D8AgIHPYj2Wv5As0c1JSfA/AACqjPsokr+prfDGxjjwPwAA+SB7MYy/qTJ5E2Uo8D8AAKpdNRmEv0hz6ickGPA/AADswgMSeL+VsRQGBAjwPwAAJHkJBGC/Gvom9x/g7z8AAJCE8+9vP3TqYcIcoe8/AAA9NUHchz8umYGwEGPvPwCAwsSjzpM/za3uPPYl7z8AAIkUwZ+bP+cTkQPI6e4/AAARztiwoT+rsct4gK7uPwDAAdBbiqU/mwydohp07j8AgNhAg1ypP7WZCoOROu4/AIBX72onrT9WmmAJ4AHuPwDAmOWYdbA/mLt35QHK7T8AIA3j9VOyPwORfAvyku0/AAA4i90utD/OXPtmrFztPwDAV4dZBrY/nd5eqiwn7T8AAGo1dtq3P80saz5u8uw/AGAcTkOruT8Ceaeibb7sPwBgDbvHeLs/bQg3bSaL7D8AIOcyE0O9PwRYXb2UWOw/AGDecTEKvz+Mn7sztSbsPwBAkSsVZ8A/P+fs7oP16z8AsJKChUfBP8GW23X9xOs/ADDKzW4mwj8oSoYMHpXrPwBQxabXA8M/LD7vxeJl6z8AEDM8w9/DP4uIyWdIN+s/AIB6aza6xD9KMB0hSwnrPwDw0Sg5k8U/fu/yhejb6j8A8BgkzWrGP6I9YDEdr+o/AJBm7PhAxz+nWNM/5oLqPwDwGvXAFcg/i3MJ70BX6j8AgPZUKenIPydLq5AqLOo/AED4Aja7yT/R8pMToAHqPwAALBzti8o/GzzbJJ/X6T8A0AFcUVvLP5CxxwUlruk/AMC8zGcpzD8vzpfyLoXpPwBgSNU19sw/dUuk7rpc6T8AwEY0vcHNPzhI553GNOk/AODPuAGMzj/mUmcvTw3pPwCQF8AJVc8/ndf/jlLm6D8AuB8SbA7QP3wAzJ/Ov+g/ANCTDrhx0D8Ow77awJnoPwBwhp5r1NA/+xcjqid06D8A0EszhzbRPwias6wAT+g/AEgjZw2Y0T9VPmXoSSroPwCAzOD/+NE/YAL0lQEG6D8AaGPXX1nSPymj4GMl4uc/AKgUCTC50j+ttdx3s77nPwBgQxByGNM/wiWXZ6qb5z8AGOxtJnfTP1cGF/IHeec/ADCv+0/V0z8ME9bbylbnPwDgL+PuMtQ/a7ZPAQAQ5j88W0KRbAJ+PJW0TQMAMOY/QV0ASOq/jTx41JQNAFDmP7el1oanf448rW9OBwBw5j9MJVRr6vxhPK4P3/7/j+Y//Q5ZTCd+fLy8xWMHALDmPwHa3EhowYq89sFcHgDQ5j8Rk0mdHD+DPD72Bev/7+Y/Uy3iGgSAfryAl4YOABDnP1J5CXFm/3s8Euln/P8v5z8kh70m4gCMPGoRgd//T+c/0gHxbpECbryQnGcPAHDnP3ScVM1x/Ge8Nch++v+P5z+DBPWewb6BPObCIP7/r+c/ZWTMKRd+cLwAyT/t/8/nPxyLewhygIC8dhom6f/v5z+u+Z1tKMCNPOijnAQAEOg/M0zlUdJ/iTyPLJMXADDoP4HzMLbp/oq8nHMzBgBQ6D+8NWVrv7+JPMaJQiAAcOg/dXsR82W/i7wEefXr/4/oP1fLPaJuAIm83wS8IgCw6D8KS+A43wB9vIobDOX/z+g/BZ//RnEAiLxDjpH8/+/oPzhwetB7gYM8x1/6HgAQ6T8DtN92kT6JPLl7RhMAMOk/dgKYS06AfzxvB+7m/0/pPy5i/9nwfo+80RI83v9v6T+6OCaWqoJwvA2KRfT/j+k/76hkkRuAh7w+Lpjd/6/pPzeTWorgQIe8ZvtJ7f/P6T8A4JvBCM4/PFGc8SAA8Ok/CluIJ6o/irwGsEURABDqP1baWJlI/3Q8+va7BwAw6j8YbSuKq76MPHkdlxAAUOo/MHl43cr+iDxILvUdAHDqP9ur2D12QY+8UjNZHACQ6j8SdsKEAr+OvEs+TyoAsOo/Xz//PAT9abzRHq7X/8/qP7RwkBLnPoK8eARR7v/v6j+j3g7gPgZqPFsNZdv/D+s/uQofOMgGWjxXyqr+/y/rPx08I3QeAXm83LqV2f9P6z+fKoZoEP95vJxlniQAcOs/Pk+G0EX/ijxAFof5/4/rP/nDwpZ3/nw8T8sE0v+v6z/EK/LuJ/9jvEVcQdL/z+s/Ieo77rf/bLzfCWP4/+/rP1wLLpcDQYG8U3a14f8P7D8ZareUZMGLPONX+vH/L+w/7cYwje/+ZLwk5L/c/0/sP3VH7LxoP4S897lU7f9v7D/s4FPwo36EPNWPmev/j+w/8ZL5jQaDczyaISUhALDsPwQOGGSO/Wi8nEaU3f/P7D9y6sccvn6OPHbE/er/7+w//oifrTm+jjwr+JoWABDtP3FauaiRfXU8HfcPDQAw7T/ax3BpkMGJPMQPeer/T+0/DP5YxTcOWLzlh9wuAHDtP0QPwU3WgH+8qoLcIQCQ7T9cXP2Uj3x0vIMCa9j/r+0/fmEhxR1/jDw5R2wpANDtP1Ox/7KeAYg89ZBE5f/v7T+JzFLG0gBuPJT2q83/D+4/0mktIECDf7zdyFLb/y/uP2QIG8rBAHs87xZC8v9P7j9Rq5SwqP9yPBFeiuj/b+4/Wb7vsXP2V7wN/54RAJDuPwHIC16NgIS8RBel3/+v7j+1IEPVBgB4PKF/EhoA0O4/klxWYPgCULzEvLoHAPDuPxHmNV1EQIW8Ao169f8P7z8Fke85MftPvMeK5R4AMO8/VRFz8qyBijyUNIL1/0/vP0PH19RBP4o8a0yp/P9v7z91eJgc9AJivEHE+eH/j+8/S+d39NF9dzx+4+DS/6/vPzGjfJoZAW+8nuR3HADQ7z+xrM5L7oFxPDHD4Pf/7+8/WodwATcFbrxuYGX0/w/wP9oKHEmtfoq8WHqG8/8v8D/gsvzDaX+XvBcN/P3/T/A/W5TLNP6/lzyCTc0DAHDwP8tW5MCDAII86Mvy+f+P8D8adTe+3/9tvGXaDAEAsPA/6ybmrn8/kbw406QBANDwP/efSHn6fYA8/f3a+v/v8D/Aa9ZwBQR3vJb9ugsAEPE/YgtthNSAjjxd9OX6/y/xP+82/WT6v5082ZrVDQBQ8T+uUBJwdwCaPJpVIQ8AcPE/7t7j4vn9jTwmVCf8/4/xP3NyO9wwAJE8WTw9EgCw8T+IAQOAeX+ZPLeeKfj/z/E/Z4yfqzL5ZbwA1Ir0/+/xP+tbp52/f5M8pIaLDAAQ8j8iW/2Ra4CfPANDhQMAMPI/M7+f68L/kzyE9rz//0/yP3IuLn7nAXY82SEp9f9v8j9hDH92u/x/PDw6kxQAkPI/K0ECPMoCcrwTY1UUALDyPwIf8jOCgJK8O1L+6//P8j/y3E84fv+IvJatuAsA8PI/xUEwUFH/hbyv4nr7/w/zP50oXohxAIG8f1+s/v8v8z8Vt7c/Xf+RvFZnpgwAUPM/vYKLIoJ/lTwh9/sRAHDzP8zVDcS6AIA8uS9Z+f+P8z9Rp7ItnT+UvELS3QQAsPM/4Th2cGt/hTxXybL1/8/zPzESvxA6Ano8GLSw6v/v8z+wUrFmbX+YPPSvMhUAEPQ/JIUZXzf4Zzwpi0cXADD0P0NR3HLmAYM8Y7SV5/9P9D9aibK4af+JPOB1BOj/b/Q/VPLCm7HAlbznwW/v/4/0P3IqOvIJQJs8BKe+5f+v9D9FfQ2/t/+UvN4nEBcA0PQ/PWrccWTAmbziPvAPAPD0PxxThQuJf5c80UvcEgAQ9T82pGZxZQRgPHonBRYAMPU/CTIjzs6/lrxMcNvs/0/1P9ehBQVyAom8qVRf7/9v9T8SZMkO5r+bPBIQ5hcAkPU/kO+vgcV+iDySPskDALD1P8AMvwoIQZ+8vBlJHQDQ9T8pRyX7KoGYvIl6uOf/7/U/BGntgLd+lLz+gitlRxVnQAAAAAAAADhDAAD6/kIudr86O568mvcMvb39/////98/PFRVVVVVxT+RKxfPVVWlPxfQpGcREYE/AAAAAAAAyELvOfr+Qi7mPyTEgv+9v84/tfQM1whrrD/MUEbSq7KDP4Q6Tpvg11U/AAAAAAAAAAAAAAAAAADwP26/iBpPO5s8NTP7qT327z9d3NicE2BxvGGAdz6a7O8/0WaHEHpekLyFf27oFePvPxP2ZzVS0ow8dIUV07DZ7z/6jvkjgM6LvN723Slr0O8/YcjmYU73YDzIm3UYRcfvP5nTM1vko5A8g/PGyj6+7z9te4NdppqXPA+J+WxYte8//O/9khq1jjz3R3IrkqzvP9GcL3A9vj48otHTMuyj7z8LbpCJNANqvBvT/q9mm+8/Dr0vKlJWlbxRWxLQAZPvP1XqTozvgFC8zDFswL2K7z8W9NW5I8mRvOAtqa6agu8/r1Vc6ePTgDxRjqXImHrvP0iTpeoVG4C8e1F9PLhy7z89Mt5V8B+PvOqNjDj5au8/v1MTP4yJizx1y2/rW2PvPybrEXac2Za81FwEhOBb7z9gLzo+9+yaPKq5aDGHVO8/nTiGy4Lnj7wd2fwiUE3vP43DpkRBb4o81oxiiDtG7z99BOSwBXqAPJbcfZFJP+8/lKio4/2Oljw4YnVuejjvP31IdPIYXoc8P6ayT84x7z/y5x+YK0eAPN184mVFK+8/XghxP3u4lryBY/Xh3yTvPzGrCW3h94I84d4f9Z0e7z/6v28amyE9vJDZ2tB/GO8/tAoMcoI3izwLA+SmhRLvP4/LzomSFG48Vi8+qa8M7z+2q7BNdU2DPBW3MQr+Bu8/THSs4gFChjwx2Ez8cAHvP0r401053Y88/xZksgj87j8EW447gKOGvPGfkl/F9u4/aFBLzO1KkrzLqTo3p/HuP44tURv4B5m8ZtgFba7s7j/SNpQ+6NFxvPef5TTb5+4/FRvOsxkZmbzlqBPDLePuP21MKqdIn4U8IjQSTKbe7j+KaSh6YBKTvByArARF2u4/W4kXSI+nWLwqLvchCtbuPxuaSWebLHy8l6hQ2fXR7j8RrMJg7WNDPC2JYWAIzu4/72QGOwlmljxXAB3tQcruP3kDodrhzG480DzBtaLG7j8wEg8/jv+TPN7T1/Aqw+4/sK96u86QdjwnKjbV2r/uP3fgVOu9HZM8Dd39mbK87j+Oo3EANJSPvKcsnXayue4/SaOT3Mzeh7xCZs+i2rbuP184D73G3ni8gk+dViu07j/2XHvsRhKGvA+SXcqkse4/jtf9GAU1kzzaJ7U2R6/uPwWbii+3mHs8/ceX1BKt7j8JVBzi4WOQPClUSN0Hq+4/6sYZUIXHNDy3RlmKJqnuPzXAZCvmMpQ8SCGtFW+n7j+fdplhSuSMvAncdrnhpe4/qE3vO8UzjLyFVTqwfqTuP67pK4l4U4S8IMPMNEaj7j9YWFZ43c6TvCUiVYI4ou4/ZBl+gKoQVzxzqUzUVaHuPygiXr/vs5O8zTt/Zp6g7j+CuTSHrRJqvL/aC3USoO4/7qltuO9nY7wvGmU8sp/uP1GI4FQ93IC8hJRR+X2f7j/PPlp+ZB94vHRf7Oh1n+4/sH2LwEruhrx0gaVImp/uP4rmVR4yGYa8yWdCVuuf7j/T1Aley5yQPD9d3k9poO4/HaVNudwye7yHAetzFKHuP2vAZ1T97JQ8MsEwAe2h7j9VbNar4etlPGJOzzbzou4/Qs+zL8WhiLwSGj5UJ6TuPzQ3O/G2aZO8E85MmYml7j8e/xk6hF6AvK3HI0Yap+4/bldy2FDUlLztkkSb2ajuPwCKDltnrZA8mWaK2ceq7j+06vDBL7eNPNugKkLlrO4//+fFnGC2ZbyMRLUWMq/uP0Rf81mD9ns8NncVma6x7j+DPR6nHwmTvMb/kQtbtO4/KR5si7ipXbzlxc2wN7fuP1m5kHz5I2y8D1LIy0S67j+q+fQiQ0OSvFBO3p+Cve4/S45m12zKhby6B8pw8cDuPyfOkSv8r3E8kPCjgpHE7j+7cwrhNdJtPCMj4xljyO4/YyJiIgTFh7xl5V17ZszuP9Ux4uOGHIs8My1K7JvQ7j8Vu7zT0buRvF0lPrID1e4/0jHunDHMkDxYszATntnuP7Nac26EaYQ8v/15VWve7j+0nY6Xzd+CvHrz079r4+4/hzPLkncajDyt01qZn+juP/rZ0UqPe5C8ZraNKQfu7j+6rtxW2cNVvPsVT7ii8+4/QPamPQ6kkLw6WeWNcvnuPzSTrTj01mi8R1778nb/7j81ilhr4u6RvEoGoTCwBe8/zd1fCtf/dDzSwUuQHgzvP6yYkvr7vZG8CR7XW8IS7z+zDK8wrm5zPJxShd2bGe8/lP2fXDLjjjx60P9fqyDvP6xZCdGP4IQ8S9FXLvEn7z9nGk44r81jPLXnBpRtL+8/aBmSbCxrZzxpkO/cIDfvP9K1zIMYioC8+sNdVQs/7z9v+v8/Xa2PvHyJB0otR+8/Sal1OK4NkLzyiQ0Ih0/vP6cHPaaFo3Q8h6T73BhY7z8PIkAgnpGCvJiDyRbjYO8/rJLB1VBajjyFMtsD5mnvP0trAaxZOoQ8YLQB8yFz7z8fPrQHIdWCvF+bezOXfO8/yQ1HO7kqibwpofUURobvP9OIOmAEtnQ89j+L5y6Q7z9xcp1R7MWDPINMx/tRmu8/8JHTjxL3j7zakKSir6TvP310I+KYro288WeOLUiv7z8IIKpBvMOOPCdaYe4buu8/Muupw5QrhDyXums3K8XvP+6F0TGpZIo8QEVuW3bQ7z/t4zvkujeOvBS+nK392+8/nc2RTTuJdzzYkJ6BwefvP4nMYEHBBVM88XGPK8Lz7z8AOPr+Qi7mPzBnx5NX8y49AAAAAAAA4L9gVVVVVVXlvwYAAAAAAOA/TlVZmZmZ6T96pClVVVXlv+lFSJtbSfK/wz8miysA8D8AAAAAAKD2PwAAAAAAAAAAAMi58oIs1r+AVjcoJLT6PAAAAAAAgPY/AAAAAAAAAAAACFi/vdHVvyD34NgIpRy9AAAAAABg9j8AAAAAAAAAAABYRRd3dtW/bVC21aRiI70AAAAAAED2PwAAAAAAAAAAAPgth60a1b/VZ7Ce5ITmvAAAAAAAIPY/AAAAAAAAAAAAeHeVX77Uv+A+KZNpGwS9AAAAAAAA9j8AAAAAAAAAAABgHMKLYdS/zIRMSC/YEz0AAAAAAOD1PwAAAAAAAAAAAKiGhjAE1L86C4Lt80LcPAAAAAAAwPU/AAAAAAAAAAAASGlVTKbTv2CUUYbGsSA9AAAAAACg9T8AAAAAAAAAAACAmJrdR9O/koDF1E1ZJT0AAAAAAID1PwAAAAAAAAAAACDhuuLo0r/YK7eZHnsmPQAAAAAAYPU/AAAAAAAAAAAAiN4TWonSvz+wz7YUyhU9AAAAAABg9T8AAAAAAAAAAACI3hNaidK/P7DPthTKFT0AAAAAAED1PwAAAAAAAAAAAHjP+0Ep0r922lMoJFoWvQAAAAAAIPU/AAAAAAAAAAAAmGnBmMjRvwRU52i8rx+9AAAAAAAA9T8AAAAAAAAAAACoq6tcZ9G/8KiCM8YfHz0AAAAAAOD0PwAAAAAAAAAAAEiu+YsF0b9mWgX9xKgmvQAAAAAAwPQ/AAAAAAAAAAAAkHPiJKPQvw4D9H7uawy9AAAAAACg9D8AAAAAAAAAAADQtJQlQNC/fy30nrg28LwAAAAAAKD0PwAAAAAAAAAAANC0lCVA0L9/LfSeuDbwvAAAAAAAgPQ/AAAAAAAAAAAAQF5tGLnPv4c8masqVw09AAAAAABg9D8AAAAAAAAAAABg3Mut8M6/JK+GnLcmKz0AAAAAAED0PwAAAAAAAAAAAPAqbgcnzr8Q/z9UTy8XvQAAAAAAIPQ/AAAAAAAAAAAAwE9rIVzNvxtoyruRuiE9AAAAAAAA9D8AAAAAAAAAAACgmsf3j8y/NISfaE95Jz0AAAAAAAD0PwAAAAAAAAAAAKCax/ePzL80hJ9oT3knPQAAAAAA4PM/AAAAAAAAAAAAkC10hsLLv4+3izGwThk9AAAAAADA8z8AAAAAAAAAAADAgE7J88q/ZpDNP2NOujwAAAAAAKDzPwAAAAAAAAAAALDiH7wjyr/qwUbcZIwlvQAAAAAAoPM/AAAAAAAAAAAAsOIfvCPKv+rBRtxkjCW9AAAAAACA8z8AAAAAAAAAAABQ9JxaUsm/49TBBNnRKr0AAAAAAGDzPwAAAAAAAAAAANAgZaB/yL8J+tt/v70rPQAAAAAAQPM/AAAAAAAAAAAA4BACiavHv1hKU3KQ2ys9AAAAAABA8z8AAAAAAAAAAADgEAKJq8e/WEpTcpDbKz0AAAAAACDzPwAAAAAAAAAAANAZ5w/Wxr9m4rKjauQQvQAAAAAAAPM/AAAAAAAAAAAAkKdwMP/FvzlQEJ9Dnh69AAAAAAAA8z8AAAAAAAAAAACQp3Aw/8W/OVAQn0OeHr0AAAAAAODyPwAAAAAAAAAAALCh4+Umxb+PWweQi94gvQAAAAAAwPI/AAAAAAAAAAAAgMtsK03Evzx4NWHBDBc9AAAAAADA8j8AAAAAAAAAAACAy2wrTcS/PHg1YcEMFz0AAAAAAKDyPwAAAAAAAAAAAJAeIPxxw786VCdNhnjxPAAAAAAAgPI/AAAAAAAAAAAA8B/4UpXCvwjEcRcwjSS9AAAAAABg8j8AAAAAAAAAAABgL9Uqt8G/lqMRGKSALr0AAAAAAGDyPwAAAAAAAAAAAGAv1Sq3wb+WoxEYpIAuvQAAAAAAQPI/AAAAAAAAAAAAkNB8ftfAv/Rb6IiWaQo9AAAAAABA8j8AAAAAAAAAAACQ0Hx+18C/9FvoiJZpCj0AAAAAACDyPwAAAAAAAAAAAODbMZHsv7/yM6NcVHUlvQAAAAAAAPI/AAAAAAAAAAAAACtuBye+vzwA8CosNCo9AAAAAAAA8j8AAAAAAAAAAAAAK24HJ76/PADwKiw0Kj0AAAAAAODxPwAAAAAAAAAAAMBbj1RevL8Gvl9YVwwdvQAAAAAAwPE/AAAAAAAAAAAA4Eo6bZK6v8iqW+g1OSU9AAAAAADA8T8AAAAAAAAAAADgSjptkrq/yKpb6DU5JT0AAAAAAKDxPwAAAAAAAAAAAKAx1kXDuL9oVi9NKXwTPQAAAAAAoPE/AAAAAAAAAAAAoDHWRcO4v2hWL00pfBM9AAAAAACA8T8AAAAAAAAAAABg5YrS8La/2nMzyTeXJr0AAAAAAGDxPwAAAAAAAAAAACAGPwcbtb9XXsZhWwIfPQAAAAAAYPE/AAAAAAAAAAAAIAY/Bxu1v1dexmFbAh89AAAAAABA8T8AAAAAAAAAAADgG5bXQbO/3xP5zNpeLD0AAAAAAEDxPwAAAAAAAAAAAOAbltdBs7/fE/nM2l4sPQAAAAAAIPE/AAAAAAAAAAAAgKPuNmWxvwmjj3ZefBQ9AAAAAAAA8T8AAAAAAAAAAACAEcAwCq+/kY42g55ZLT0AAAAAAADxPwAAAAAAAAAAAIARwDAKr7+RjjaDnlktPQAAAAAA4PA/AAAAAAAAAAAAgBlx3UKrv0xw1uV6ghw9AAAAAADg8D8AAAAAAAAAAACAGXHdQqu/THDW5XqCHD0AAAAAAMDwPwAAAAAAAAAAAMAy9lh0p7/uofI0RvwsvQAAAAAAwPA/AAAAAAAAAAAAwDL2WHSnv+6h8jRG/Cy9AAAAAACg8D8AAAAAAAAAAADA/rmHnqO/qv4m9bcC9TwAAAAAAKDwPwAAAAAAAAAAAMD+uYeeo7+q/ib1twL1PAAAAAAAgPA/AAAAAAAAAAAAAHgOm4Kfv+QJfnwmgCm9AAAAAACA8D8AAAAAAAAAAAAAeA6bgp+/5Al+fCaAKb0AAAAAAGDwPwAAAAAAAAAAAIDVBxu5l785pvqTVI0ovQAAAAAAQPA/AAAAAAAAAAAAAPywqMCPv5ym0/Z8Ht+8AAAAAABA8D8AAAAAAAAAAAAA/LCowI+/nKbT9nwe37wAAAAAACDwPwAAAAAAAAAAAAAQayrgf7/kQNoNP+IZvQAAAAAAIPA/AAAAAAAAAAAAABBrKuB/v+RA2g0/4hm9AAAAAAAA8D8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwO8/AAAAAAAAAAAAAIl1FRCAP+grnZlrxxC9AAAAAACA7z8AAAAAAAAAAACAk1hWIJA/0vfiBlvcI70AAAAAAEDvPwAAAAAAAAAAAADJKCVJmD80DFoyuqAqvQAAAAAAAO8/AAAAAAAAAAAAQOeJXUGgP1PX8VzAEQE9AAAAAADA7j8AAAAAAAAAAAAALtSuZqQ/KP29dXMWLL0AAAAAAIDuPwAAAAAAAAAAAMCfFKqUqD99JlrQlXkZvQAAAAAAQO4/AAAAAAAAAAAAwN3Nc8usPwco2EfyaBq9AAAAAAAg7j8AAAAAAAAAAADABsAx6q4/ezvJTz4RDr0AAAAAAODtPwAAAAAAAAAAAGBG0TuXsT+bng1WXTIlvQAAAAAAoO0/AAAAAAAAAAAA4NGn9b2zP9dO26VeyCw9AAAAAABg7T8AAAAAAAAAAACgl01a6bU/Hh1dPAZpLL0AAAAAAEDtPwAAAAAAAAAAAMDqCtMAtz8y7Z2pjR7sPAAAAAAAAO0/AAAAAAAAAAAAQFldXjO5P9pHvTpcESM9AAAAAADA7D8AAAAAAAAAAABgrY3Iars/5Wj3K4CQE70AAAAAAKDsPwAAAAAAAAAAAEC8AViIvD/TrFrG0UYmPQAAAAAAYOw/AAAAAAAAAAAAIAqDOce+P+BF5q9owC29AAAAAABA7D8AAAAAAAAAAADg2zmR6L8//QqhT9Y0Jb0AAAAAAADsPwAAAAAAAAAAAOAngo4XwT/yBy3OeO8hPQAAAAAA4Os/AAAAAAAAAAAA8CN+K6rBPzSZOESOpyw9AAAAAACg6z8AAAAAAAAAAACAhgxh0cI/obSBy2ydAz0AAAAAAIDrPwAAAAAAAAAAAJAVsPxlwz+JcksjqC/GPAAAAAAAQOs/AAAAAAAAAAAAsDODPZHEP3i2/VR5gyU9AAAAAAAg6z8AAAAAAAAAAACwoeTlJ8U/x31p5egzJj0AAAAAAODqPwAAAAAAAAAAABCMvk5Xxj94Ljwsi88ZPQAAAAAAwOo/AAAAAAAAAAAAcHWLEvDGP+EhnOWNESW9AAAAAACg6j8AAAAAAAAAAABQRIWNicc/BUORcBBmHL0AAAAAAGDqPwAAAAAAAAAAAAA566++yD/RLOmqVD0HvQAAAAAAQOo/AAAAAAAAAAAAAPfcWlrJP2//oFgo8gc9AAAAAAAA6j8AAAAAAAAAAADgijztk8o/aSFWUENyKL0AAAAAAODpPwAAAAAAAAAAANBbV9gxyz+q4axOjTUMvQAAAAAAwOk/AAAAAAAAAAAA4Ds4h9DLP7YSVFnESy29AAAAAACg6T8AAAAAAAAAAAAQ8Mb7b8w/0iuWxXLs8bwAAAAAAGDpPwAAAAAAAAAAAJDUsD2xzT81sBX3Kv8qvQAAAAAAQOk/AAAAAAAAAAAAEOf/DlPOPzD0QWAnEsI8AAAAAAAg6T8AAAAAAAAAAAAA3eSt9c4/EY67ZRUhyrwAAAAAAADpPwAAAAAAAAAAALCzbByZzz8w3wzK7MsbPQAAAAAAwOg/AAAAAAAAAAAAWE1gOHHQP5FO7RbbnPg8AAAAAACg6D8AAAAAAAAAAABgYWctxNA/6eo8FosYJz0AAAAAAIDoPwAAAAAAAAAAAOgngo4X0T8c8KVjDiEsvQAAAAAAYOg/AAAAAAAAAAAA+KzLXGvRP4EWpffNmis9AAAAAABA6D8AAAAAAAAAAABoWmOZv9E/t71HUe2mLD0AAAAAACDoPwAAAAAAAAAAALgObUUU0j/quka63ocKPQAAAAAA4Oc/AAAAAAAAAAAAkNx88L7SP/QEUEr6nCo9AAAAAADA5z8AAAAAAAAAAABg0+HxFNM/uDwh03riKL0AAAAAAKDnPwAAAAAAAAAAABC+dmdr0z/Id/GwzW4RPQAAAAAAgOc/AAAAAAAAAAAAMDN3UsLTP1y9BrZUOxg9AAAAAABg5z8AAAAAAAAAAADo1SO0GdQ/neCQ7DbkCD0AAAAAAEDnPwAAAAAAAAAAAMhxwo1x1D911mcJzicvvQAAAAAAIOc/AAAAAAAAAAAAMBee4MnUP6TYChuJIC69AAAAAAAA5z8AAAAAAAAAAACgOAeuItU/WcdkgXC+Lj0AAAAAAODmPwAAAAAAAAAAANDIU/d71T/vQF3u7a0fPQAAAAAAwOY/AAAAAAAAAAAAYFnfvdXVP9xlpAgqCwq9UHcAAAAAAAAAAAAAAAAAANF0ngBXnb0qgHBSD///PicKAAAAZAAAAOgDAAAQJwAAoIYBAEBCDwCAlpgAAOH1BRgAAAA1AAAAcQAAAGv////O+///kr///wBBuO4BC7ABCgAAAAAAAAAZifTuMGrUAZcAAAAAAAAABQAAAAAAAAAAAAAAFAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQEAABYBAADwiQAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUHcAAOCLAQAAQejvAQvNCyh2b2lkKTw6Oj57IGlmIChNb2R1bGUuZmxhc2hTaXplKSByZXR1cm4gTW9kdWxlLmZsYXNoU2l6ZTsgcmV0dXJuIDEyOCAqIDEwMjQ7IH0AKHZvaWQgKnN0YXJ0LCB1bnNpZ25lZCBzaXplKTw6Oj57IGlmIChNb2R1bGUuZmxhc2hTYXZlKSBNb2R1bGUuZmxhc2hTYXZlKEhFQVBVOC5zbGljZShzdGFydCwgc3RhcnQgKyBzaXplKSk7IH0AKHZvaWQgKnN0YXJ0LCB1bnNpZ25lZCBzaXplKTw6Oj57IGlmIChNb2R1bGUuZmxhc2hMb2FkKSB7IGNvbnN0IGRhdGEgPSBNb2R1bGUuZmxhc2hMb2FkKCk7IGlmIChNb2R1bGUuZG1lc2cpIE1vZHVsZS5kbWVzZygiZmxhc2ggbG9hZCwgc2l6ZT0iICsgZGF0YS5sZW5ndGgpOyBIRUFQVTguc2V0KGRhdGEuc2xpY2UoMCwgc2l6ZSksIHN0YXJ0KTsgfSB9ACh2b2lkICpmcmFtZSk8Ojo+eyBjb25zdCBzeiA9IDEyICsgSEVBUFU4W2ZyYW1lICsgMl07IGNvbnN0IHBrdCA9IEhFQVBVOC5zbGljZShmcmFtZSwgZnJhbWUgKyBzeik7IE1vZHVsZS5zZW5kUGFja2V0KHBrdCkgfQAoaW50IGV4aXRjb2RlKTw6Oj57IGlmIChleGl0Y29kZSkgY29uc29sZS5sb2coIlBBTklDIiwgZXhpdGNvZGUpOyBpZiAoTW9kdWxlLnBhbmljSGFuZGxlcikgTW9kdWxlLnBhbmljSGFuZGxlcihleGl0Y29kZSk7IH0AKGNvbnN0IHZvaWQgKmZyYW1lLCB1bnNpZ25lZCBzeik8Ojo+eyBjb25zdCBwa3QgPSBIRUFQVTguc2xpY2UoZnJhbWUsIGZyYW1lICsgc3opOyBNb2R1bGUuc2VuZFBhY2tldChwa3QpIH0AKGludCBleGl0Y29kZSk8Ojo+eyBpZiAoTW9kdWxlLmRlcGxveUhhbmRsZXIpIE1vZHVsZS5kZXBsb3lIYW5kbGVyKGV4aXRjb2RlKTsgfQAodm9pZCk8Ojo+eyByZXR1cm4gRGF0ZS5ub3coKTsgfQAodWludDhfdCAqIHRyZywgdW5zaWduZWQgc2l6ZSk8Ojo+eyBsZXQgYnVmID0gbmV3IFVpbnQ4QXJyYXkoc2l6ZSk7IGlmICh0eXBlb2Ygd2luZG93ID09ICJvYmplY3QiICYmIHdpbmRvdy5jcnlwdG8gJiYgd2luZG93LmNyeXB0by5nZXRSYW5kb21WYWx1ZXMpIHdpbmRvdy5jcnlwdG8uZ2V0UmFuZG9tVmFsdWVzKGJ1Zik7IGVsc2UgeyBidWYgPSByZXF1aXJlKCJjcnlwdG8iKS5yYW5kb21CeXRlcyhzaXplKTsgfSBIRUFQVTguc2V0KGJ1ZiwgdHJnKTsgfQAoY29uc3QgY2hhciAqcHRyKTw6Oj57IGNvbnN0IHMgPSBVVEY4VG9TdHJpbmcocHRyLCAxMDI0KTsgaWYgKE1vZHVsZS5kbWVzZykgTW9kdWxlLmRtZXNnKHMpOyBlbHNlIGNvbnNvbGUuZGVidWcocyk7IH0AKGNvbnN0IGNoYXIgKmhvc3RuYW1lLCBpbnQgcG9ydCk8Ojo+eyByZXR1cm4gTW9kdWxlLnNvY2tPcGVuKGhvc3RuYW1lLCBwb3J0KTsgfQAoY29uc3Qgdm9pZCAqYnVmLCB1bnNpZ25lZCBzaXplKTw6Oj57IHJldHVybiBNb2R1bGUuc29ja1dyaXRlKGJ1Ziwgc2l6ZSk7IH0AKHZvaWQpPDo6PnsgcmV0dXJuIE1vZHVsZS5zb2NrQ2xvc2UoKTsgfQAodm9pZCk8Ojo+eyByZXR1cm4gTW9kdWxlLnNvY2tJc0F2YWlsYWJsZSgpOyB9AACOiwEEbmFtZQAVFGRldmljZXNjcmlwdC12bS53YXNtAYaKAYoHAA1lbV9mbGFzaF9zYXZlAQ1lbV9mbGFzaF9zaXplAg1lbV9mbGFzaF9sb2FkAwVhYm9ydAQTZW1fc2VuZF9sYXJnZV9mcmFtZQUTX2RldnNfcGFuaWNfaGFuZGxlcgYRZW1fZGVwbG95X2hhbmRsZXIHF2VtX2pkX2NyeXB0b19nZXRfcmFuZG9tCA1lbV9zZW5kX2ZyYW1lCQRleGl0CgtlbV90aW1lX25vdwsOZW1fcHJpbnRfZG1lc2cMD19qZF90Y3Bzb2NrX25ldw0RX2pkX3RjcHNvY2tfd3JpdGUOEV9qZF90Y3Bzb2NrX2Nsb3NlDxhfamRfdGNwc29ja19pc19hdmFpbGFibGUQD19fd2FzaV9mZF9jbG9zZREVZW1zY3JpcHRlbl9tZW1jcHlfYmlnEg9fX3dhc2lfZmRfd3JpdGUTFmVtc2NyaXB0ZW5fcmVzaXplX2hlYXAUGmxlZ2FsaW1wb3J0JF9fd2FzaV9mZF9zZWVrFRFfX3dhc21fY2FsbF9jdG9ycxYPZmxhc2hfYmFzZV9hZGRyFw1mbGFzaF9wcm9ncmFtGAtmbGFzaF9lcmFzZRkKZmxhc2hfc3luYxoKZmxhc2hfaW5pdBsIaHdfcGFuaWMcCGpkX2JsaW5rHQdqZF9nbG93HhRqZF9hbGxvY19zdGFja19jaGVjax8IamRfYWxsb2MgB2pkX2ZyZWUhDXRhcmdldF9pbl9pcnEiEnRhcmdldF9kaXNhYmxlX2lycSMRdGFyZ2V0X2VuYWJsZV9pcnEkGGpkX2RldmljZV9pZF9mcm9tX3N0cmluZyUVZGV2c19zZW5kX2xhcmdlX2ZyYW1lJhJkZXZzX3BhbmljX2hhbmRsZXInE2RldnNfZGVwbG95X2hhbmRsZXIoFGpkX2NyeXB0b19nZXRfcmFuZG9tKRBqZF9lbV9zZW5kX2ZyYW1lKhpqZF9lbV9zZXRfZGV2aWNlX2lkXzJ4X2kzMisaamRfZW1fc2V0X2RldmljZV9pZF9zdHJpbmcsCmpkX2VtX2luaXQtDWpkX2VtX3Byb2Nlc3MuFGpkX2VtX2ZyYW1lX3JlY2VpdmVkLxFqZF9lbV9kZXZzX2RlcGxveTARamRfZW1fZGV2c192ZXJpZnkxGGpkX2VtX2RldnNfY2xpZW50X2RlcGxveTIbamRfZW1fZGV2c19lbmFibGVfZ2Nfc3RyZXNzMwxod19kZXZpY2VfaWQ0DHRhcmdldF9yZXNldDUOdGltX2dldF9taWNyb3M2D2FwcF9wcmludF9kbWVzZzcSamRfdGNwc29ja19wcm9jZXNzOBFhcHBfaW5pdF9zZXJ2aWNlczkSZGV2c19jbGllbnRfZGVwbG95OhRjbGllbnRfZXZlbnRfaGFuZGxlcjsJYXBwX2RtZXNnPAtmbHVzaF9kbWVzZz0LYXBwX3Byb2Nlc3M+DmpkX3RjcHNvY2tfbmV3PxBqZF90Y3Bzb2NrX3dyaXRlQBBqZF90Y3Bzb2NrX2Nsb3NlQRdqZF90Y3Bzb2NrX2lzX2F2YWlsYWJsZUIWamRfZW1fdGNwc29ja19vbl9ldmVudEMHdHhfaW5pdEQPamRfcGFja2V0X3JlYWR5RQp0eF9wcm9jZXNzRg10eF9zZW5kX2ZyYW1lRw5kZXZzX2J1ZmZlcl9vcEgSZGV2c19idWZmZXJfZGVjb2RlSRJkZXZzX2J1ZmZlcl9lbmNvZGVKD2RldnNfY3JlYXRlX2N0eEsJc2V0dXBfY3R4TApkZXZzX3RyYWNlTQ9kZXZzX2Vycm9yX2NvZGVOGWRldnNfY2xpZW50X2V2ZW50X2hhbmRsZXJPCWNsZWFyX2N0eFANZGV2c19mcmVlX2N0eFEIZGV2c19vb21SCWRldnNfZnJlZVMRZGV2c2Nsb3VkX3Byb2Nlc3NUF2RldnNjbG91ZF9oYW5kbGVfcGFja2V0VRBkZXZzY2xvdWRfdXBsb2FkVhRkZXZzY2xvdWRfb25fbWVzc2FnZVcOZGV2c2Nsb3VkX2luaXRYFGRldnNfdHJhY2tfZXhjZXB0aW9uWQ9kZXZzZGJnX3Byb2Nlc3NaEWRldnNkYmdfcmVzdGFydGVkWxVkZXZzZGJnX2hhbmRsZV9wYWNrZXRcC3NlbmRfdmFsdWVzXRF2YWx1ZV9mcm9tX3RhZ192MF4ZZGV2c2RiZ19vcGVuX3Jlc3VsdHNfcGlwZV8Nb2JqX2dldF9wcm9wc2AMZXhwYW5kX3ZhbHVlYRJkZXZzZGJnX3N1c3BlbmRfY2JiDGRldnNkYmdfaW5pdGMQZXhwYW5kX2tleV92YWx1ZWQGa3ZfYWRkZQ9kZXZzbWdyX3Byb2Nlc3NmB3RyeV9ydW5nB3J1bl9pbWdoDHN0b3BfcHJvZ3JhbWkPZGV2c21ncl9yZXN0YXJ0ahRkZXZzbWdyX2RlcGxveV9zdGFydGsUZGV2c21ncl9kZXBsb3lfd3JpdGVsEGRldnNtZ3JfZ2V0X2hhc2htFWRldnNtZ3JfaGFuZGxlX3BhY2tldG4OZGVwbG95X2hhbmRsZXJvE2RlcGxveV9tZXRhX2hhbmRsZXJwD2RldnNtZ3JfZ2V0X2N0eHEOZGV2c21ncl9kZXBsb3lyDGRldnNtZ3JfaW5pdHMRZGV2c21ncl9jbGllbnRfZXZ0FmRldnNfc2VydmljZV9mdWxsX2luaXR1GGRldnNfZmliZXJfY2FsbF9mdW5jdGlvbnYKZGV2c19wYW5pY3cYZGV2c19maWJlcl9zZXRfd2FrZV90aW1leBBkZXZzX2ZpYmVyX3NsZWVweRtkZXZzX2ZpYmVyX3JldHVybl9mcm9tX2NhbGx6GmRldnNfZmliZXJfZnJlZV9hbGxfZmliZXJzexFkZXZzX2ltZ19mdW5fbmFtZXwRZGV2c19maWJlcl9ieV90YWd9EGRldnNfZmliZXJfc3RhcnR+FGRldnNfZmliZXJfdGVybWlhbnRlfw5kZXZzX2ZpYmVyX3J1boABE2RldnNfZmliZXJfc3luY19ub3eBARVfZGV2c19pbnZhbGlkX3Byb2dyYW2CARhkZXZzX2ZpYmVyX2dldF9tYXhfc2xlZXCDAQ9kZXZzX2ZpYmVyX3Bva2WEARFkZXZzX2djX2FkZF9jaHVua4UBFmRldnNfZ2Nfb2JqX2NoZWNrX2NvcmWGARNqZF9nY19hbnlfdHJ5X2FsbG9jhwEHZGV2c19nY4gBD2ZpbmRfZnJlZV9ibG9ja4kBEmRldnNfYW55X3RyeV9hbGxvY4oBDmRldnNfdHJ5X2FsbG9jiwELamRfZ2NfdW5waW6MAQpqZF9nY19mcmVljQEUZGV2c192YWx1ZV9pc19waW5uZWSOAQ5kZXZzX3ZhbHVlX3Bpbo8BEGRldnNfdmFsdWVfdW5waW6QARJkZXZzX21hcF90cnlfYWxsb2ORARhkZXZzX3Nob3J0X21hcF90cnlfYWxsb2OSARRkZXZzX2FycmF5X3RyeV9hbGxvY5MBGmRldnNfYnVmZmVyX3RyeV9hbGxvY19pbml0lAEVZGV2c19idWZmZXJfdHJ5X2FsbG9jlQEVZGV2c19zdHJpbmdfdHJ5X2FsbG9jlgEQZGV2c19zdHJpbmdfcHJlcJcBEmRldnNfc3RyaW5nX2ZpbmlzaJgBGmRldnNfc3RyaW5nX3RyeV9hbGxvY19pbml0mQEPZGV2c19nY19zZXRfY3R4mgEOZGV2c19nY19jcmVhdGWbAQ9kZXZzX2djX2Rlc3Ryb3mcARFkZXZzX2djX29ial9jaGVja50BDmRldnNfZHVtcF9oZWFwngELc2Nhbl9nY19vYmqfARFwcm9wX0FycmF5X2xlbmd0aKABEm1ldGgyX0FycmF5X2luc2VydKEBEmZ1bjFfQXJyYXlfaXNBcnJheaIBFG1ldGhYX0FycmF5X19fY3Rvcl9fowEQbWV0aFhfQXJyYXlfcHVzaKQBFW1ldGgxX0FycmF5X3B1c2hSYW5nZaUBEW1ldGhYX0FycmF5X3NsaWNlpgEQbWV0aDFfQXJyYXlfam9pbqcBEWZ1bjFfQnVmZmVyX2FsbG9jqAEQZnVuMl9CdWZmZXJfZnJvbakBEnByb3BfQnVmZmVyX2xlbmd0aKoBFW1ldGgxX0J1ZmZlcl90b1N0cmluZ6sBE21ldGgzX0J1ZmZlcl9maWxsQXSsARNtZXRoNF9CdWZmZXJfYmxpdEF0rQETbWV0aDNfQnVmZmVyX3JvdGF0Za4BFG1ldGgzX0J1ZmZlcl9pbmRleE9mrwEXbWV0aDBfQnVmZmVyX2ZpbGxSYW5kb22wARRtZXRoNF9CdWZmZXJfZW5jcnlwdLEBEmZ1bjNfQnVmZmVyX2RpZ2VzdLIBFGRldnNfY29tcHV0ZV90aW1lb3V0swEXZnVuMV9EZXZpY2VTY3JpcHRfc2xlZXC0ARdmdW4xX0RldmljZVNjcmlwdF9kZWxhebUBGGZ1bjFfRGV2aWNlU2NyaXB0X19wYW5pY7YBGGZ1bjBfRGV2aWNlU2NyaXB0X3JlYm9vdLcBGWZ1bjBfRGV2aWNlU2NyaXB0X3Jlc3RhcnS4ARhmdW5YX0RldmljZVNjcmlwdF9mb3JtYXS5ARdmdW4yX0RldmljZVNjcmlwdF9wcmludLoBHGZ1bjFfRGV2aWNlU2NyaXB0X3BhcnNlRmxvYXS7ARpmdW4xX0RldmljZVNjcmlwdF9wYXJzZUludLwBGmZ1bjJfRGV2aWNlU2NyaXB0X19sb2dSZXByvQEdZnVuMV9EZXZpY2VTY3JpcHRfX2RjZmdTdHJpbme+ARhmdW4wX0RldmljZVNjcmlwdF9taWxsaXO/ASJmdW4xX0RldmljZVNjcmlwdF9kZXZpY2VJZGVudGlmaWVywAEdZnVuMl9EZXZpY2VTY3JpcHRfX3NlcnZlclNlbmTBARxmdW4yX0RldmljZVNjcmlwdF9fYWxsb2NSb2xlwgEgZnVuMF9EZXZpY2VTY3JpcHRfbm90SW1wbGVtZW50ZWTDAR5mdW4yX0RldmljZVNjcmlwdF9fdHdpbk1lc3NhZ2XEASFmdW4zX0RldmljZVNjcmlwdF9faTJjVHJhbnNhY3Rpb27FAR5mdW4yX0RldmljZVNjcmlwdF9sZWRTdHJpcFNlbmTGAR5mdW41X0RldmljZVNjcmlwdF9zcGlDb25maWd1cmXHARlmdW4yX0RldmljZVNjcmlwdF9zcGlYZmVyyAEeZnVuM19EZXZpY2VTY3JpcHRfc3BpU2VuZEltYWdlyQEUbWV0aDFfRXJyb3JfX19jdG9yX1/KARltZXRoMV9SYW5nZUVycm9yX19fY3Rvcl9fywEYbWV0aDFfVHlwZUVycm9yX19fY3Rvcl9fzAEabWV0aDFfU3ludGF4RXJyb3JfX19jdG9yX1/NAQ9wcm9wX0Vycm9yX25hbWXOARFtZXRoMF9FcnJvcl9wcmludM8BD3Byb3BfRHNGaWJlcl9pZNABFnByb3BfRHNGaWJlcl9zdXNwZW5kZWTRARRtZXRoMV9Ec0ZpYmVyX3Jlc3VtZdIBF21ldGgwX0RzRmliZXJfdGVybWluYXRl0wEZZnVuMV9EZXZpY2VTY3JpcHRfc3VzcGVuZNQBEWZ1bjBfRHNGaWJlcl9zZWxm1QEUbWV0aFhfRnVuY3Rpb25fc3RhcnTWARdwcm9wX0Z1bmN0aW9uX3Byb3RvdHlwZdcBEnByb3BfRnVuY3Rpb25fbmFtZdgBE2RldnNfZ3Bpb19pbml0X2RjZmfZAQlpbml0X3VzZWTaAQ5wcm9wX0dQSU9fbW9kZdsBFnByb3BfR1BJT19jYXBhYmlsaXRpZXPcAQ9wcm9wX0dQSU9fdmFsdWXdARJtZXRoMV9HUElPX3NldE1vZGXeARBwcm9wX0ltYWdlX3dpZHRo3wERcHJvcF9JbWFnZV9oZWlnaHTgAQ5wcm9wX0ltYWdlX2JwcOEBEXByb3BfSW1hZ2VfYnVmZmVy4gEQZnVuNV9JbWFnZV9hbGxvY+MBD21ldGgzX0ltYWdlX3NldOQBDGRldnNfYXJnX2ltZ+UBB3NldENvcmXmAQ9tZXRoMl9JbWFnZV9nZXTnARBtZXRoMV9JbWFnZV9maWxs6AEJZmlsbF9yZWN06QEUbWV0aDVfSW1hZ2VfZmlsbFJlY3TqARJtZXRoMV9JbWFnZV9lcXVhbHPrARFtZXRoMF9JbWFnZV9jbG9uZewBDWFsbG9jX2ltZ19yZXTtARFtZXRoMF9JbWFnZV9mbGlwWO4BB3BpeF9wdHLvARFtZXRoMF9JbWFnZV9mbGlwWfABFm1ldGgwX0ltYWdlX3RyYW5zcG9zZWTxARVtZXRoM19JbWFnZV9kcmF3SW1hZ2XyAQ1kZXZzX2FyZ19pbWcy8wENZHJhd0ltYWdlQ29yZfQBIG1ldGg0X0ltYWdlX2RyYXdUcmFuc3BhcmVudEltYWdl9QEYbWV0aDNfSW1hZ2Vfb3ZlcmxhcHNXaXRo9gEUbWV0aDVfSW1hZ2VfZHJhd0xpbmX3AQhkcmF3TGluZfgBE21ha2Vfd3JpdGFibGVfaW1hZ2X5AQtkcmF3TGluZUxvd/oBDGRyYXdMaW5lSGlnaPsBE21ldGg1X0ltYWdlX2JsaXRSb3f8ARFtZXRoMTFfSW1hZ2VfYmxpdP0BFm1ldGg0X0ltYWdlX2ZpbGxDaXJjbGX+AQ9mdW4yX0pTT05fcGFyc2X/ARNmdW4zX0pTT05fc3RyaW5naWZ5gAIOZnVuMV9NYXRoX2NlaWyBAg9mdW4xX01hdGhfZmxvb3KCAg9mdW4xX01hdGhfcm91bmSDAg1mdW4xX01hdGhfYWJzhAIQZnVuMF9NYXRoX3JhbmRvbYUCE2Z1bjFfTWF0aF9yYW5kb21JbnSGAg1mdW4xX01hdGhfbG9nhwINZnVuMl9NYXRoX3Bvd4gCDmZ1bjJfTWF0aF9pZGl2iQIOZnVuMl9NYXRoX2ltb2SKAg5mdW4yX01hdGhfaW11bIsCDWZ1bjJfTWF0aF9taW6MAgtmdW4yX21pbm1heI0CDWZ1bjJfTWF0aF9tYXiOAhJmdW4yX09iamVjdF9hc3NpZ26PAhBmdW4xX09iamVjdF9rZXlzkAITZnVuMV9rZXlzX29yX3ZhbHVlc5ECEmZ1bjFfT2JqZWN0X3ZhbHVlc5ICGmZ1bjJfT2JqZWN0X3NldFByb3RvdHlwZU9mkwIVbWV0aDFfT2JqZWN0X19fY3Rvcl9flAIdZGV2c192YWx1ZV90b19wYWNrZXRfb3JfdGhyb3eVAhJwcm9wX0RzUGFja2V0X3JvbGWWAh5wcm9wX0RzUGFja2V0X2RldmljZUlkZW50aWZpZXKXAhVwcm9wX0RzUGFja2V0X3Nob3J0SWSYAhpwcm9wX0RzUGFja2V0X3NlcnZpY2VJbmRleJkCHHByb3BfRHNQYWNrZXRfc2VydmljZUNvbW1hbmSaAhNwcm9wX0RzUGFja2V0X2ZsYWdzmwIXcHJvcF9Ec1BhY2tldF9pc0NvbW1hbmScAhZwcm9wX0RzUGFja2V0X2lzUmVwb3J0nQIVcHJvcF9Ec1BhY2tldF9wYXlsb2FkngIVcHJvcF9Ec1BhY2tldF9pc0V2ZW50nwIXcHJvcF9Ec1BhY2tldF9ldmVudENvZGWgAhZwcm9wX0RzUGFja2V0X2lzUmVnU2V0oQIWcHJvcF9Ec1BhY2tldF9pc1JlZ0dldKICFXByb3BfRHNQYWNrZXRfcmVnQ29kZaMCFnByb3BfRHNQYWNrZXRfaXNBY3Rpb26kAhVkZXZzX3BrdF9zcGVjX2J5X2NvZGWlAhJwcm9wX0RzUGFja2V0X3NwZWOmAhFkZXZzX3BrdF9nZXRfc3BlY6cCFW1ldGgwX0RzUGFja2V0X2RlY29kZagCHW1ldGgwX0RzUGFja2V0X25vdEltcGxlbWVudGVkqQIYcHJvcF9Ec1BhY2tldFNwZWNfcGFyZW50qgIWcHJvcF9Ec1BhY2tldFNwZWNfbmFtZasCFnByb3BfRHNQYWNrZXRTcGVjX2NvZGWsAhpwcm9wX0RzUGFja2V0U3BlY19yZXNwb25zZa0CFnByb3BfRHNQYWNrZXRTcGVjX3R5cGWuAhltZXRoWF9Ec1BhY2tldFNwZWNfZW5jb2RlrwISZGV2c19wYWNrZXRfZGVjb2RlsAIVbWV0aDBfRHNSZWdpc3Rlcl9yZWFksQIURHNSZWdpc3Rlcl9yZWFkX2NvbnSyAhJkZXZzX3BhY2tldF9lbmNvZGWzAhZtZXRoWF9Ec1JlZ2lzdGVyX3dyaXRltAIWcHJvcF9Ec1BhY2tldEluZm9fcm9sZbUCFnByb3BfRHNQYWNrZXRJbmZvX25hbWW2AhZwcm9wX0RzUGFja2V0SW5mb19jb2RltwIYbWV0aFhfRHNDb21tYW5kX19fZnVuY19fuAITcHJvcF9Ec1JvbGVfaXNCb3VuZLkCEHByb3BfRHNSb2xlX3NwZWO6AhhtZXRoMl9Ec1JvbGVfc2VuZENvbW1hbmS7AiJwcm9wX0RzU2VydmljZVNwZWNfY2xhc3NJZGVudGlmaWVyvAIXcHJvcF9Ec1NlcnZpY2VTcGVjX25hbWW9AhptZXRoMV9Ec1NlcnZpY2VTcGVjX2xvb2t1cL4CGm1ldGgxX0RzU2VydmljZVNwZWNfYnlDb2RlvwIabWV0aDFfRHNTZXJ2aWNlU3BlY19hc3NpZ27AAh1mdW4yX0RldmljZVNjcmlwdF9fc29ja2V0T3BlbsECEHRjcHNvY2tfb25fZXZlbnTCAh5mdW4wX0RldmljZVNjcmlwdF9fc29ja2V0Q2xvc2XDAh5mdW4xX0RldmljZVNjcmlwdF9fc29ja2V0V3JpdGXEAhJwcm9wX1N0cmluZ19sZW5ndGjFAhZwcm9wX1N0cmluZ19ieXRlTGVuZ3RoxgIXbWV0aDFfU3RyaW5nX2NoYXJDb2RlQXTHAhNtZXRoMV9TdHJpbmdfY2hhckF0yAISbWV0aDJfU3RyaW5nX3NsaWNlyQIYZnVuWF9TdHJpbmdfZnJvbUNoYXJDb2RlygIUbWV0aDNfU3RyaW5nX2luZGV4T2bLAhhtZXRoMF9TdHJpbmdfdG9Mb3dlckNhc2XMAhNtZXRoMF9TdHJpbmdfdG9DYXNlzQIYbWV0aDBfU3RyaW5nX3RvVXBwZXJDYXNlzgIMZGV2c19pbnNwZWN0zwILaW5zcGVjdF9vYmrQAgdhZGRfc3Ry0QINaW5zcGVjdF9maWVsZNICFGRldnNfamRfZ2V0X3JlZ2lzdGVy0wIWZGV2c19qZF9jbGVhcl9wa3Rfa2luZNQCEGRldnNfamRfc2VuZF9jbWTVAhBkZXZzX2pkX3NlbmRfcmF31gITZGV2c19qZF9zZW5kX2xvZ21zZ9cCE2RldnNfamRfcGt0X2NhcHR1cmXYAhFkZXZzX2pkX3dha2Vfcm9sZdkCEmRldnNfamRfc2hvdWxkX3J1btoCE2RldnNfamRfcHJvY2Vzc19wa3TbAhhkZXZzX2pkX3NlcnZlcl9kZXZpY2VfaWTcAhdkZXZzX2pkX3VwZGF0ZV9yZWdjYWNoZd0CEmRldnNfamRfYWZ0ZXJfdXNlct4CFGRldnNfamRfcm9sZV9jaGFuZ2Vk3wIUZGV2c19qZF9yZXNldF9wYWNrZXTgAhJkZXZzX2pkX2luaXRfcm9sZXPhAhJkZXZzX2pkX2ZyZWVfcm9sZXPiAhJkZXZzX2pkX2FsbG9jX3JvbGXjAhVkZXZzX3NldF9nbG9iYWxfZmxhZ3PkAhdkZXZzX3Jlc2V0X2dsb2JhbF9mbGFnc+UCFWRldnNfZ2V0X2dsb2JhbF9mbGFnc+YCD2pkX25lZWRfdG9fc2VuZOcCEGRldnNfanNvbl9lc2NhcGXoAhVkZXZzX2pzb25fZXNjYXBlX2NvcmXpAg9kZXZzX2pzb25fcGFyc2XqAgpqc29uX3ZhbHVl6wIMcGFyc2Vfc3RyaW5n7AITZGV2c19qc29uX3N0cmluZ2lmee0CDXN0cmluZ2lmeV9vYmruAhFwYXJzZV9zdHJpbmdfY29yZe8CCmFkZF9pbmRlbnTwAg9zdHJpbmdpZnlfZmllbGTxAhFkZXZzX21hcGxpa2VfaXRlcvICF2RldnNfZ2V0X2J1aWx0aW5fb2JqZWN08wISZGV2c19tYXBfY29weV9pbnRv9AIMZGV2c19tYXBfc2V09QIGbG9va3Vw9gITZGV2c19tYXBsaWtlX2lzX21hcPcCG2RldnNfbWFwbGlrZV9rZXlzX29yX3ZhbHVlc/gCEWRldnNfYXJyYXlfaW5zZXJ0+QIIa3ZfYWRkLjH6AhJkZXZzX3Nob3J0X21hcF9zZXT7Ag9kZXZzX21hcF9kZWxldGX8AhJkZXZzX3Nob3J0X21hcF9nZXT9AiBkZXZzX3ZhbHVlX2Zyb21fc2VydmljZV9zcGVjX2lkeP4CHGRldnNfdmFsdWVfZnJvbV9zZXJ2aWNlX3NwZWP/AhtkZXZzX3ZhbHVlX2Zyb21fcGFja2V0X3NwZWOAAx5kZXZzX3ZhbHVlX3RvX3NlcnZpY2Vfc3BlY19pZHiBAxpkZXZzX3ZhbHVlX3RvX3NlcnZpY2Vfc3BlY4IDF2RldnNfZGVjb2RlX3JvbGVfcGFja2V0gwMYZGV2c19yb2xlX3NwZWNfZm9yX2NsYXNzhAMXZGV2c19wYWNrZXRfc3BlY19wYXJlbnSFAw5kZXZzX3JvbGVfc3BlY4YDEWRldnNfcm9sZV9zZXJ2aWNlhwMOZGV2c19yb2xlX25hbWWIAxJkZXZzX2dldF9iYXNlX3NwZWOJAxBkZXZzX3NwZWNfbG9va3VwigMSZGV2c19mdW5jdGlvbl9iaW5kiwMRZGV2c19tYWtlX2Nsb3N1cmWMAw5kZXZzX2dldF9mbmlkeI0DE2RldnNfZ2V0X2ZuaWR4X2NvcmWOAxhkZXZzX29iamVjdF9nZXRfYXR0YWNoZWSPAxhkZXZzX21hcGxpa2VfZ2V0X25vX2JpbmSQAxNkZXZzX2dldF9zcGVjX3Byb3RvkQMTZGV2c19nZXRfcm9sZV9wcm90b5IDG2RldnNfb2JqZWN0X2dldF9hdHRhY2hlZF9yd5MDFWRldnNfZ2V0X3N0YXRpY19wcm90b5QDG2RldnNfb2JqZWN0X2dldF9hdHRhY2hlZF9yb5UDHWRldnNfb2JqZWN0X2dldF9hdHRhY2hlZF9lbnVtlgMWZGV2c19tYXBsaWtlX2dldF9wcm90b5cDGGRldnNfZ2V0X3Byb3RvdHlwZV9maWVsZJgDHmRldnNfb2JqZWN0X2dldF9idWlsdF9pbl9maWVsZJkDEGRldnNfaW5zdGFuY2Vfb2aaAw9kZXZzX29iamVjdF9nZXSbAwxkZXZzX3NlcV9nZXScAwxkZXZzX2FueV9nZXSdAwxkZXZzX2FueV9zZXSeAwxkZXZzX3NlcV9zZXSfAw5kZXZzX2FycmF5X3NldKADE2RldnNfYXJyYXlfcGluX3B1c2ihAxFkZXZzX2FyZ19pbnRfZGVmbKIDDGRldnNfYXJnX2ludKMDDWRldnNfYXJnX2Jvb2ykAw9kZXZzX2FyZ19kb3VibGWlAw9kZXZzX3JldF9kb3VibGWmAwxkZXZzX3JldF9pbnSnAw1kZXZzX3JldF9ib29sqAMPZGV2c19yZXRfZ2NfcHRyqQMRZGV2c19hcmdfc2VsZl9tYXCqAxFkZXZzX3NldHVwX3Jlc3VtZasDD2RldnNfY2FuX2F0dGFjaKwDGWRldnNfYnVpbHRpbl9vYmplY3RfdmFsdWWtAxVkZXZzX21hcGxpa2VfdG9fdmFsdWWuAxJkZXZzX3JlZ2NhY2hlX2ZyZWWvAxZkZXZzX3JlZ2NhY2hlX2ZyZWVfYWxssAMXZGV2c19yZWdjYWNoZV9tYXJrX3VzZWSxAxNkZXZzX3JlZ2NhY2hlX2FsbG9jsgMUZGV2c19yZWdjYWNoZV9sb29rdXCzAxFkZXZzX3JlZ2NhY2hlX2FnZbQDF2RldnNfcmVnY2FjaGVfZnJlZV9yb2xltQMSZGV2c19yZWdjYWNoZV9uZXh0tgMPamRfc2V0dGluZ3NfZ2V0twMPamRfc2V0dGluZ3Nfc2V0uAMOZGV2c19sb2dfdmFsdWW5Aw9kZXZzX3Nob3dfdmFsdWW6AxBkZXZzX3Nob3dfdmFsdWUwuwMNY29uc3VtZV9jaHVua7wDDXNoYV8yNTZfY2xvc2W9Aw9qZF9zaGEyNTZfc2V0dXC+AxBqZF9zaGEyNTZfdXBkYXRlvwMQamRfc2hhMjU2X2ZpbmlzaMADFGpkX3NoYTI1Nl9obWFjX3NldHVwwQMVamRfc2hhMjU2X2htYWNfdXBkYXRlwgMVamRfc2hhMjU2X2htYWNfZmluaXNowwMOamRfc2hhMjU2X2hrZGbEAw5kZXZzX3N0cmZvcm1hdMUDDmRldnNfaXNfc3RyaW5nxgMOZGV2c19pc19udW1iZXLHAxtkZXZzX3N0cmluZ19nZXRfdXRmOF9zdHJ1Y3TIAxRkZXZzX3N0cmluZ19nZXRfdXRmOMkDE2RldnNfYnVpbHRpbl9zdHJpbmfKAxRkZXZzX3N0cmluZ192c3ByaW50ZssDE2RldnNfc3RyaW5nX3NwcmludGbMAxVkZXZzX3N0cmluZ19mcm9tX3V0ZjjNAxRkZXZzX3ZhbHVlX3RvX3N0cmluZ84DEGJ1ZmZlcl90b19zdHJpbmfPAxlkZXZzX21hcF9zZXRfc3RyaW5nX2ZpZWxk0AMSZGV2c19zdHJpbmdfY29uY2F00QMRZGV2c19zdHJpbmdfc2xpY2XSAxJkZXZzX3B1c2hfdHJ5ZnJhbWXTAxFkZXZzX3BvcF90cnlmcmFtZdQDD2RldnNfZHVtcF9zdGFja9UDE2RldnNfZHVtcF9leGNlcHRpb27WAwpkZXZzX3Rocm931wMSZGV2c19wcm9jZXNzX3Rocm932AMQZGV2c19hbGxvY19lcnJvctkDFWRldnNfdGhyb3dfdHlwZV9lcnJvctoDGGRldnNfdGhyb3dfZ2VuZXJpY19lcnJvctsDFmRldnNfdGhyb3dfcmFuZ2VfZXJyb3LcAx5kZXZzX3Rocm93X25vdF9zdXBwb3J0ZWRfZXJyb3LdAxpkZXZzX3Rocm93X2V4cGVjdGluZ19lcnJvct4DHmRldnNfdGhyb3dfZXhwZWN0aW5nX2Vycm9yX2V4dN8DGGRldnNfdGhyb3dfdG9vX2JpZ19lcnJvcuADF2RldnNfdGhyb3dfc3ludGF4X2Vycm9y4QMRZGV2c19zdHJpbmdfaW5kZXjiAxJkZXZzX3N0cmluZ19sZW5ndGjjAxlkZXZzX3V0ZjhfZnJvbV9jb2RlX3BvaW505AMbZGV2c191dGY4X2NvZGVfcG9pbnRfbGVuZ3Ro5QMUZGV2c191dGY4X2NvZGVfcG9pbnTmAxRkZXZzX3N0cmluZ19qbXBfaW5pdOcDDmRldnNfdXRmOF9pbml06AMWZGV2c192YWx1ZV9mcm9tX2RvdWJsZekDE2RldnNfdmFsdWVfZnJvbV9pbnTqAxRkZXZzX3ZhbHVlX2Zyb21fYm9vbOsDF2RldnNfdmFsdWVfZnJvbV9wb2ludGVy7AMUZGV2c192YWx1ZV90b19kb3VibGXtAxFkZXZzX3ZhbHVlX3RvX2ludO4DEmRldnNfdmFsdWVfdG9fYm9vbO8DDmRldnNfaXNfYnVmZmVy8AMXZGV2c19idWZmZXJfaXNfd3JpdGFibGXxAxBkZXZzX2J1ZmZlcl9kYXRh8gMTZGV2c19idWZmZXJpc2hfZGF0YfMDFGRldnNfdmFsdWVfdG9fZ2Nfb2Jq9AMNZGV2c19pc19hcnJhefUDEWRldnNfdmFsdWVfdHlwZW9m9gMPZGV2c19pc19udWxsaXNo9wMZZGV2c19pc19udWxsX29yX3VuZGVmaW5lZPgDFGRldnNfdmFsdWVfYXBwcm94X2Vx+QMSZGV2c192YWx1ZV9pZWVlX2Vx+gMNZGV2c192YWx1ZV9lcfsDHGRldnNfdmFsdWVfZXFfYnVpbHRpbl9zdHJpbmf8Ax5kZXZzX3ZhbHVlX2VuY29kZV90aHJvd19qbXBfcGP9AxJkZXZzX2ltZ19zdHJpZHhfb2v+AxJkZXZzX2R1bXBfdmVyc2lvbnP/AwtkZXZzX3ZlcmlmeYAEEWRldnNfZmV0Y2hfb3Bjb2RlgQQOZGV2c192bV9yZXN1bWWCBBFkZXZzX3ZtX3NldF9kZWJ1Z4MEGWRldnNfdm1fY2xlYXJfYnJlYWtwb2ludHOEBBhkZXZzX3ZtX2NsZWFyX2JyZWFrcG9pbnSFBAxkZXZzX3ZtX2hhbHSGBA9kZXZzX3ZtX3N1c3BlbmSHBBZkZXZzX3ZtX3NldF9icmVha3BvaW50iAQUZGV2c192bV9leGVjX29wY29kZXOJBA9kZXZzX2luX3ZtX2xvb3CKBBpkZXZzX2J1aWx0aW5fc3RyaW5nX2J5X2lkeIsEF2RldnNfaW1nX2dldF9zdHJpbmdfam1wjAQRZGV2c19pbWdfZ2V0X3V0ZjiNBBRkZXZzX2dldF9zdGF0aWNfdXRmOI4EFGRldnNfdmFsdWVfYnVmZmVyaXNojwQMZXhwcl9pbnZhbGlkkAQUZXhwcnhfYnVpbHRpbl9vYmplY3SRBAtzdG10MV9jYWxsMJIEC3N0bXQyX2NhbGwxkwQLc3RtdDNfY2FsbDKUBAtzdG10NF9jYWxsM5UEC3N0bXQ1X2NhbGw0lgQLc3RtdDZfY2FsbDWXBAtzdG10N19jYWxsNpgEC3N0bXQ4X2NhbGw3mQQLc3RtdDlfY2FsbDiaBBJzdG10Ml9pbmRleF9kZWxldGWbBAxzdG10MV9yZXR1cm6cBAlzdG10eF9qbXCdBAxzdG10eDFfam1wX3qeBApleHByMl9iaW5knwQSZXhwcnhfb2JqZWN0X2ZpZWxkoAQSc3RtdHgxX3N0b3JlX2xvY2FsoQQTc3RtdHgxX3N0b3JlX2dsb2JhbKIEEnN0bXQ0X3N0b3JlX2J1ZmZlcqMECWV4cHIwX2luZqQEEGV4cHJ4X2xvYWRfbG9jYWylBBFleHByeF9sb2FkX2dsb2JhbKYEC2V4cHIxX3VwbHVzpwQLZXhwcjJfaW5kZXioBA9zdG10M19pbmRleF9zZXSpBBRleHByeDFfYnVpbHRpbl9maWVsZKoEEmV4cHJ4MV9hc2NpaV9maWVsZKsEEWV4cHJ4MV91dGY4X2ZpZWxkrAQQZXhwcnhfbWF0aF9maWVsZK0EDmV4cHJ4X2RzX2ZpZWxkrgQPc3RtdDBfYWxsb2NfbWFwrwQRc3RtdDFfYWxsb2NfYXJyYXmwBBJzdG10MV9hbGxvY19idWZmZXKxBBdleHByeF9zdGF0aWNfc3BlY19wcm90b7IEE2V4cHJ4X3N0YXRpY19idWZmZXKzBBtleHByeF9zdGF0aWNfYnVpbHRpbl9zdHJpbme0BBlleHByeF9zdGF0aWNfYXNjaWlfc3RyaW5ntQQYZXhwcnhfc3RhdGljX3V0Zjhfc3RyaW5ntgQVZXhwcnhfc3RhdGljX2Z1bmN0aW9utwQNZXhwcnhfbGl0ZXJhbLgEEWV4cHJ4X2xpdGVyYWxfZjY0uQQRZXhwcjNfbG9hZF9idWZmZXK6BA1leHByMF9yZXRfdmFsuwQMZXhwcjFfdHlwZW9mvAQPZXhwcjBfdW5kZWZpbmVkvQQSZXhwcjFfaXNfdW5kZWZpbmVkvgQKZXhwcjBfdHJ1Zb8EC2V4cHIwX2ZhbHNlwAQNZXhwcjFfdG9fYm9vbMEECWV4cHIwX25hbsIECWV4cHIxX2Fic8MEDWV4cHIxX2JpdF9ub3TEBAxleHByMV9pc19uYW7FBAlleHByMV9uZWfGBAlleHByMV9ub3THBAxleHByMV90b19pbnTIBAlleHByMl9hZGTJBAlleHByMl9zdWLKBAlleHByMl9tdWzLBAlleHByMl9kaXbMBA1leHByMl9iaXRfYW5kzQQMZXhwcjJfYml0X29yzgQNZXhwcjJfYml0X3hvcs8EEGV4cHIyX3NoaWZ0X2xlZnTQBBFleHByMl9zaGlmdF9yaWdodNEEGmV4cHIyX3NoaWZ0X3JpZ2h0X3Vuc2lnbmVk0gQIZXhwcjJfZXHTBAhleHByMl9sZdQECGV4cHIyX2x01QQIZXhwcjJfbmXWBBBleHByMV9pc19udWxsaXNo1wQUc3RtdHgyX3N0b3JlX2Nsb3N1cmXYBBNleHByeDFfbG9hZF9jbG9zdXJl2QQSZXhwcnhfbWFrZV9jbG9zdXJl2gQQZXhwcjFfdHlwZW9mX3N0ctsEE3N0bXR4X2ptcF9yZXRfdmFsX3rcBBBzdG10Ml9jYWxsX2FycmF53QQJc3RtdHhfdHJ53gQNc3RtdHhfZW5kX3Ryed8EC3N0bXQwX2NhdGNo4AQNc3RtdDBfZmluYWxseeEEC3N0bXQxX3Rocm934gQOc3RtdDFfcmVfdGhyb3fjBBBzdG10eDFfdGhyb3dfam1w5AQOc3RtdDBfZGVidWdnZXLlBAlleHByMV9uZXfmBBFleHByMl9pbnN0YW5jZV9vZucECmV4cHIwX251bGzoBA9leHByMl9hcHByb3hfZXHpBA9leHByMl9hcHByb3hfbmXqBBNzdG10MV9zdG9yZV9yZXRfdmFs6wQRZXhwcnhfc3RhdGljX3NwZWPsBA9kZXZzX3ZtX3BvcF9hcmftBBNkZXZzX3ZtX3BvcF9hcmdfdTMy7gQTZGV2c192bV9wb3BfYXJnX2kzMu8EFmRldnNfdm1fcG9wX2FyZ19idWZmZXLwBBJqZF9hZXNfY2NtX2VuY3J5cHTxBBJqZF9hZXNfY2NtX2RlY3J5cHTyBAxBRVNfaW5pdF9jdHjzBA9BRVNfRUNCX2VuY3J5cHT0BBBqZF9hZXNfc2V0dXBfa2V59QQOamRfYWVzX2VuY3J5cHT2BBBqZF9hZXNfY2xlYXJfa2V59wQOamRfd2Vic29ja19uZXf4BBdqZF93ZWJzb2NrX3NlbmRfbWVzc2FnZfkEDHNlbmRfbWVzc2FnZfoEE2pkX3RjcHNvY2tfb25fZXZlbnT7BAdvbl9kYXRh/AQLcmFpc2VfZXJyb3L9BAlzaGlmdF9tc2f+BBBqZF93ZWJzb2NrX2Nsb3Nl/wQLamRfd3Nza19uZXeABRRqZF93c3NrX3NlbmRfbWVzc2FnZYEFE2pkX3dlYnNvY2tfb25fZXZlbnSCBQdkZWNyeXB0gwUNamRfd3Nza19jbG9zZYQFEGpkX3dzc2tfb25fZXZlbnSFBQtyZXNwX3N0YXR1c4YFEndzc2toZWFsdGhfcHJvY2Vzc4cFFHdzc2toZWFsdGhfcmVjb25uZWN0iAUYd3Nza2hlYWx0aF9oYW5kbGVfcGFja2V0iQUPc2V0X2Nvbm5fc3RyaW5nigURY2xlYXJfY29ubl9zdHJpbmeLBQ93c3NraGVhbHRoX2luaXSMBRF3c3NrX3NlbmRfbWVzc2FnZY0FEXdzc2tfaXNfY29ubmVjdGVkjgUUd3Nza190cmFja19leGNlcHRpb26PBRJ3c3NrX3NlcnZpY2VfcXVlcnmQBRxyb2xlbWdyX3NlcmlhbGl6ZWRfcm9sZV9zaXplkQUWcm9sZW1ncl9zZXJpYWxpemVfcm9sZZIFD3JvbGVtZ3JfcHJvY2Vzc5MFEHJvbGVtZ3JfYXV0b2JpbmSUBRVyb2xlbWdyX2hhbmRsZV9wYWNrZXSVBRRqZF9yb2xlX21hbmFnZXJfaW5pdJYFGHJvbGVtZ3JfZGV2aWNlX2Rlc3Ryb3llZJcFEWpkX3JvbGVfc2V0X2hpbnRzmAUNamRfcm9sZV9hbGxvY5kFEGpkX3JvbGVfZnJlZV9hbGyaBRZqZF9yb2xlX2ZvcmNlX2F1dG9iaW5kmwUTamRfY2xpZW50X2xvZ19ldmVudJwFE2pkX2NsaWVudF9zdWJzY3JpYmWdBRRqZF9jbGllbnRfZW1pdF9ldmVudJ4FFHJvbGVtZ3Jfcm9sZV9jaGFuZ2VknwUQamRfZGV2aWNlX2xvb2t1cKAFGGpkX2RldmljZV9sb29rdXBfc2VydmljZaEFE2pkX3NlcnZpY2Vfc2VuZF9jbWSiBRFqZF9jbGllbnRfcHJvY2Vzc6MFDmpkX2RldmljZV9mcmVlpAUXamRfY2xpZW50X2hhbmRsZV9wYWNrZXSlBQ9qZF9kZXZpY2VfYWxsb2OmBRBzZXR0aW5nc19wcm9jZXNzpwUWc2V0dGluZ3NfaGFuZGxlX3BhY2tldKgFDXNldHRpbmdzX2luaXSpBQ50YXJnZXRfc3RhbmRieaoFD2pkX2N0cmxfcHJvY2Vzc6sFFWpkX2N0cmxfaGFuZGxlX3BhY2tldKwFDGpkX2N0cmxfaW5pdK0FFGRjZmdfc2V0X3VzZXJfY29uZmlnrgUJZGNmZ19pbml0rwUNZGNmZ192YWxpZGF0ZbAFDmRjZmdfZ2V0X2VudHJ5sQUTZGNmZ19nZXRfbmV4dF9lbnRyebIFDGRjZmdfZ2V0X2kzMrMFDGRjZmdfZ2V0X3BpbrQFD2RjZmdfZ2V0X3N0cmluZ7UFDGRjZmdfaWR4X2tlebYFDGRjZmdfZ2V0X3UzMrcFCWpkX3ZkbWVzZ7gFEWpkX2RtZXNnX3N0YXJ0cHRyuQUNamRfZG1lc2dfcmVhZLoFEmpkX2RtZXNnX3JlYWRfbGluZbsFE2pkX3NldHRpbmdzX2dldF9iaW68BQpmaW5kX2VudHJ5vQUPcmVjb21wdXRlX2NhY2hlvgUTamRfc2V0dGluZ3Nfc2V0X2Jpbr8FC2pkX2ZzdG9yX2djwAUVamRfc2V0dGluZ3NfZ2V0X2xhcmdlwQUWamRfc2V0dGluZ3NfcHJlcF9sYXJnZcIFCm1hcmtfbGFyZ2XDBRdqZF9zZXR0aW5nc193cml0ZV9sYXJnZcQFFmpkX3NldHRpbmdzX3N5bmNfbGFyZ2XFBRBqZF9zZXRfbWF4X3NsZWVwxgUNamRfaXBpcGVfb3BlbscFFmpkX2lwaXBlX2hhbmRsZV9wYWNrZXTIBQ5qZF9pcGlwZV9jbG9zZckFEmpkX251bWZtdF9pc192YWxpZMoFFWpkX251bWZtdF93cml0ZV9mbG9hdMsFE2pkX251bWZtdF93cml0ZV9pMzLMBRJqZF9udW1mbXRfcmVhZF9pMzLNBRRqZF9udW1mbXRfcmVhZF9mbG9hdM4FEWpkX29waXBlX29wZW5fY21kzwUUamRfb3BpcGVfb3Blbl9yZXBvcnTQBRZqZF9vcGlwZV9oYW5kbGVfcGFja2V00QURamRfb3BpcGVfd3JpdGVfZXjSBRBqZF9vcGlwZV9wcm9jZXNz0wUUamRfb3BpcGVfY2hlY2tfc3BhY2XUBQ5qZF9vcGlwZV93cml0ZdUFDmpkX29waXBlX2Nsb3Nl1gUNamRfcXVldWVfcHVzaNcFDmpkX3F1ZXVlX2Zyb2502AUOamRfcXVldWVfc2hpZnTZBQ5qZF9xdWV1ZV9hbGxvY9oFDWpkX3Jlc3BvbmRfdTjbBQ5qZF9yZXNwb25kX3UxNtwFDmpkX3Jlc3BvbmRfdTMy3QURamRfcmVzcG9uZF9zdHJpbmfeBRdqZF9zZW5kX25vdF9pbXBsZW1lbnRlZN8FC2pkX3NlbmRfcGt04AUdc2VydmljZV9oYW5kbGVfcmVnaXN0ZXJfZmluYWzhBRdzZXJ2aWNlX2hhbmRsZV9yZWdpc3RlcuIFGWpkX3NlcnZpY2VzX2hhbmRsZV9wYWNrZXTjBRRqZF9hcHBfaGFuZGxlX3BhY2tldOQFFWpkX2FwcF9oYW5kbGVfY29tbWFuZOUFFWFwcF9nZXRfaW5zdGFuY2VfbmFtZeYFE2pkX2FsbG9jYXRlX3NlcnZpY2XnBRBqZF9zZXJ2aWNlc19pbml06AUOamRfcmVmcmVzaF9ub3fpBRlqZF9zZXJ2aWNlc19wYWNrZXRfcXVldWVk6gUUamRfc2VydmljZXNfYW5ub3VuY2XrBRdqZF9zZXJ2aWNlc19uZWVkc19mcmFtZewFEGpkX3NlcnZpY2VzX3RpY2vtBRVqZF9wcm9jZXNzX2V2ZXJ5dGhpbmfuBRpqZF9wcm9jZXNzX2V2ZXJ5dGhpbmdfY29yZe8FFmFwcF9nZXRfZGV2X2NsYXNzX25hbWXwBRRhcHBfZ2V0X2RldmljZV9jbGFzc/EFEmFwcF9nZXRfZndfdmVyc2lvbvIFDWpkX3NydmNmZ19ydW7zBRdqZF9zcnZjZmdfaW5zdGFuY2VfbmFtZfQFEWpkX3NydmNmZ192YXJpYW509QUNamRfaGFzaF9mbnYxYfYFDGpkX2RldmljZV9pZPcFCWpkX3JhbmRvbfgFCGpkX2NyYzE2+QUOamRfY29tcHV0ZV9jcmP6BQ5qZF9zaGlmdF9mcmFtZfsFDGpkX3dvcmRfbW92ZfwFDmpkX3Jlc2V0X2ZyYW1l/QUQamRfcHVzaF9pbl9mcmFtZf4FDWpkX3BhbmljX2NvcmX/BRNqZF9zaG91bGRfc2FtcGxlX21zgAYQamRfc2hvdWxkX3NhbXBsZYEGCWpkX3RvX2hleIIGC2pkX2Zyb21faGV4gwYOamRfYXNzZXJ0X2ZhaWyEBgdqZF9hdG9phQYPamRfdnNwcmludGZfZXh0hgYPamRfcHJpbnRfZG91YmxlhwYLamRfdnNwcmludGaIBgpqZF9zcHJpbnRmiQYSamRfZGV2aWNlX3Nob3J0X2lkigYMamRfc3ByaW50Zl9hiwYLamRfdG9faGV4X2GMBglqZF9zdHJkdXCNBglqZF9tZW1kdXCOBgxqZF9lbmRzX3dpdGiPBg5qZF9zdGFydHNfd2l0aJAGFmpkX3Byb2Nlc3NfZXZlbnRfcXVldWWRBhZkb19wcm9jZXNzX2V2ZW50X3F1ZXVlkgYRamRfc2VuZF9ldmVudF9leHSTBgpqZF9yeF9pbml0lAYdamRfcnhfZnJhbWVfcmVjZWl2ZWRfbG9vcGJhY2uVBg9qZF9yeF9nZXRfZnJhbWWWBhNqZF9yeF9yZWxlYXNlX2ZyYW1llwYRamRfc2VuZF9mcmFtZV9yYXeYBg1qZF9zZW5kX2ZyYW1lmQYKamRfdHhfaW5pdJoGB2pkX3NlbmSbBg9qZF90eF9nZXRfZnJhbWWcBhBqZF90eF9mcmFtZV9zZW50nQYLamRfdHhfZmx1c2ieBhBfX2Vycm5vX2xvY2F0aW9unwYMX19mcGNsYXNzaWZ5oAYFZHVtbXmhBghfX21lbWNweaIGB21lbW1vdmWjBghfX21lbXNldKQGCl9fbG9ja2ZpbGWlBgxfX3VubG9ja2ZpbGWmBgZmZmx1c2inBgRmbW9kqAYNX19ET1VCTEVfQklUU6kGDF9fc3RkaW9fc2Vla6oGDV9fc3RkaW9fd3JpdGWrBg1fX3N0ZGlvX2Nsb3NlrAYIX190b3JlYWStBglfX3Rvd3JpdGWuBglfX2Z3cml0ZXivBgZmd3JpdGWwBhRfX3B0aHJlYWRfbXV0ZXhfbG9ja7EGFl9fcHRocmVhZF9tdXRleF91bmxvY2uyBgZfX2xvY2uzBghfX3VubG9ja7QGDl9fbWF0aF9kaXZ6ZXJvtQYKZnBfYmFycmllcrYGDl9fbWF0aF9pbnZhbGlktwYDbG9nuAYFdG9wMTa5BgVsb2cxMLoGB19fbHNlZWu7BgZtZW1jbXC8BgpfX29mbF9sb2NrvQYMX19vZmxfdW5sb2NrvgYMX19tYXRoX3hmbG93vwYMZnBfYmFycmllci4xwAYMX19tYXRoX29mbG93wQYMX19tYXRoX3VmbG93wgYEZmFic8MGA3Bvd8QGBXRvcDEyxQYKemVyb2luZm5hbsYGCGNoZWNraW50xwYMZnBfYmFycmllci4yyAYKbG9nX2lubGluZckGCmV4cF9pbmxpbmXKBgtzcGVjaWFsY2FzZcsGDWZwX2ZvcmNlX2V2YWzMBgVyb3VuZM0GBnN0cmNocs4GC19fc3RyY2hybnVszwYGc3RyY21w0AYGc3RybGVu0QYGbWVtY2hy0gYGc3Ryc3Ry0wYOdHdvYnl0ZV9zdHJzdHLUBhB0aHJlZWJ5dGVfc3Ryc3Ry1QYPZm91cmJ5dGVfc3Ryc3Ry1gYNdHdvd2F5X3N0cnN0ctcGB19fdWZsb3fYBgdfX3NobGlt2QYIX19zaGdldGPaBgdpc3NwYWNl2wYGc2NhbGJu3AYJY29weXNpZ25s3QYHc2NhbGJubN4GDV9fZnBjbGFzc2lmeWzfBgVmbW9kbOAGBWZhYnNs4QYLX19mbG9hdHNjYW7iBghoZXhmbG9hdOMGCGRlY2Zsb2F05AYHc2NhbmV4cOUGBnN0cnRveOYGBnN0cnRvZOcGEl9fd2FzaV9zeXNjYWxsX3JldOgGGGVtc2NyaXB0ZW5fZ2V0X2hlYXBfc2l6ZekGBHNicmvqBghkbG1hbGxvY+sGBmRsZnJlZewGCF9fYWRkdGYz7QYJX19hc2hsdGkz7gYHX19sZXRmMu8GB19fZ2V0ZjLwBghfX2RpdnRmM/EGDV9fZXh0ZW5kZGZ0ZjLyBg1fX2V4dGVuZHNmdGYy8wYLX19mbG9hdHNpdGb0Bg1fX2Zsb2F0dW5zaXRm9QYNX19mZV9nZXRyb3VuZPYGEl9fZmVfcmFpc2VfaW5leGFjdPcGCV9fbHNocnRpM/gGCF9fbXVsdGYz+QYIX19tdWx0aTP6BglfX3Bvd2lkZjL7BghfX3N1YnRmM/wGDF9fdHJ1bmN0ZmRmMv0GC3NldFRlbXBSZXQw/gYLZ2V0VGVtcFJldDD/BhVlbXNjcmlwdGVuX3N0YWNrX2luaXSABxllbXNjcmlwdGVuX3N0YWNrX2dldF9mcmVlgQcZZW1zY3JpcHRlbl9zdGFja19nZXRfYmFzZYIHGGVtc2NyaXB0ZW5fc3RhY2tfZ2V0X2VuZIMHCXN0YWNrU2F2ZYQHDHN0YWNrUmVzdG9yZYUHCnN0YWNrQWxsb2OGBxxlbXNjcmlwdGVuX3N0YWNrX2dldF9jdXJyZW50hwcMZHluQ2FsbF9qaWppiAcWbGVnYWxzdHViJGR5bkNhbGxfamlqaYkHGGxlZ2FsZnVuYyRfX3dhc2lfZmRfc2VlawITAYcHBAAEZnB0cgEBMAIBMQMBMgc3BAAPX19zdGFja19wb2ludGVyAQh0ZW1wUmV0MAILX19zdGFja19lbmQDDF9fc3RhY2tfYmFzZQkYAwAHLnJvZGF0YQEFLmRhdGECBWVtX2pz'; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + +function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + var binary = tryParseAsDataURI(file); + if (binary) { + return binary; + } + if (readBinary) { + return readBinary(file); + } + throw "both async and sync fetching of the wasm failed"; +} + +function getBinaryPromise(binaryFile) { + + // Otherwise, getBinarySync should be able to get it synchronously + return Promise.resolve().then(() => getBinarySync(binaryFile)); +} + +function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile).then((binary) => { + return WebAssembly.instantiate(binary, imports); + }).then((instance) => { + return instance; + }).then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + // Warn on some common problems. + if (isFileURI(wasmBinaryFile)) { + err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`); + } + abort(reason); + }); +} + +function instantiateAsync(binary, binaryFile, imports, callback) { + return instantiateArrayBuffer(binaryFile, imports, callback); +} + +// Create the wasm instance. +// Receives the wasm imports, returns the exports. +function createWasm() { + // prepare imports + var info = { + 'env': wasmImports, + 'wasi_snapshot_preview1': wasmImports, + }; + // Load the wasm module and create an instance of using native support in the JS engine. + // handle a generated wasm instance, receiving its exports and + // performing other necessary setup + /** @param {WebAssembly.Module=} module*/ + function receiveInstance(instance, module) { + var exports = instance.exports; + + wasmExports = exports; + + + wasmMemory = wasmExports['memory']; + + assert(wasmMemory, "memory not found in wasm exports"); + // This assertion doesn't hold when emscripten is run in --post-link + // mode. + // TODO(sbc): Read INITIAL_MEMORY out of the wasm file in post-link mode. + //assert(wasmMemory.buffer.byteLength === 16777216); + updateMemoryViews(); + + wasmTable = wasmExports['__indirect_function_table']; + + assert(wasmTable, "table not found in wasm exports"); + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return exports; + } + // wait for the pthread pool (if any) + addRunDependency('wasm-instantiate'); + + // Prefer streaming instantiation if available. + // Async compilation can be confusing when an error on the page overwrites Module + // (for example, if the order of elements is wrong, and the one defining Module is + // later), so we save Module and check it later. + var trueModule = Module; + function receiveInstantiationResult(result) { + // 'result' is a ResultObject object which has both the module and instance. + // receiveInstance() will swap in the exports (to Module.asm) so they can be called + assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?'); + trueModule = null; + // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. + // When the regression is fixed, can restore the above PTHREADS-enabled path. + receiveInstance(result['instance']); + } + + // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback + // to manually instantiate the Wasm module themselves. This allows pages to + // run the instantiation parallel to any other async startup actions they are + // performing. + // Also pthreads and wasm workers initialize the wasm instance through this + // path. + if (Module['instantiateWasm']) { + + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch(e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + // If instantiation fails, reject the module ready promise. + readyPromiseReject(e); + } + } + + // If instantiation fails, reject the module ready promise. + instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject); + return {}; // no exports yet; we'll fill them in later +} + +// Globals used by JS i64 conversions (see makeSetValue) +var tempDouble; +var tempI64; + +// include: runtime_debug.js +function legacyModuleProp(prop, newName, incomming=true) { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { + configurable: true, + get() { + let extra = incomming ? ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)' : ''; + abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra); + + } + }); + } +} + +function ignoredModuleProp(prop) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { + abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); + } +} + +// forcing the filesystem exports a few things by default +function isExportedByForceFilesystem(name) { + return name === 'FS_createPath' || + name === 'FS_createDataFile' || + name === 'FS_createPreloadedFile' || + name === 'FS_unlink' || + name === 'addRunDependency' || + // The old FS has some functionality that WasmFS lacks. + name === 'FS_createLazyFile' || + name === 'FS_createDevice' || + name === 'removeRunDependency'; +} + +function missingGlobal(sym, msg) { + if (typeof globalThis !== 'undefined') { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + warnOnce('`' + sym + '` is not longer defined by emscripten. ' + msg); + return undefined; + } + }); + } +} + +missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer'); +missingGlobal('asm', 'Please use wasmExports instead'); + +function missingLibrarySymbol(sym) { + if (typeof globalThis !== 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) { + Object.defineProperty(globalThis, sym, { + configurable: true, + get() { + // Can't `abort()` here because it would break code that does runtime + // checks. e.g. `if (typeof SDL === 'undefined')`. + var msg = '`' + sym + '` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line'; + // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in + // library.js, which means $name for a JS name with no prefix, or name + // for a JS name like _name. + var librarySymbol = sym; + if (!librarySymbol.startsWith('_')) { + librarySymbol = '$' + sym; + } + msg += " (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='" + librarySymbol + "')"; + if (isExportedByForceFilesystem(sym)) { + msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you'; + } + warnOnce(msg); + return undefined; + } + }); + } + // Any symbol that is not included from the JS libary is also (by definition) + // not exported on the Module object. + unexportedRuntimeSymbol(sym); +} + +function unexportedRuntimeSymbol(sym) { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { + configurable: true, + get() { + var msg = "'" + sym + "' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)"; + if (isExportedByForceFilesystem(sym)) { + msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you'; + } + abort(msg); + } + }); + } +} + +// Used by XXXXX_DEBUG settings to output debug messages. +function dbg(text) { + // TODO(sbc): Make this configurable somehow. Its not always convenient for + // logging to show up as warnings. + console.warn.apply(console, arguments); +} +// end include: runtime_debug.js +// === Body === + +function em_flash_size() { if (Module.flashSize) return Module.flashSize; return 128 * 1024; } +function em_flash_save(start,size) { if (Module.flashSave) Module.flashSave(HEAPU8.slice(start, start + size)); } +function em_flash_load(start,size) { if (Module.flashLoad) { const data = Module.flashLoad(); if (Module.dmesg) Module.dmesg("flash load, size=" + data.length); HEAPU8.set(data.slice(0, size), start); } } +function em_send_frame(frame) { const sz = 12 + HEAPU8[frame + 2]; const pkt = HEAPU8.slice(frame, frame + sz); Module.sendPacket(pkt) } +function _devs_panic_handler(exitcode) { if (exitcode) console.log("PANIC", exitcode); if (Module.panicHandler) Module.panicHandler(exitcode); } +function em_send_large_frame(frame,sz) { const pkt = HEAPU8.slice(frame, frame + sz); Module.sendPacket(pkt) } +function em_deploy_handler(exitcode) { if (Module.deployHandler) Module.deployHandler(exitcode); } +function em_time_now() { return Date.now(); } +function em_jd_crypto_get_random(trg,size) { let buf = new Uint8Array(size); if (typeof window == "object" && window.crypto && window.crypto.getRandomValues) window.crypto.getRandomValues(buf); else { buf = require("crypto").randomBytes(size); } HEAPU8.set(buf, trg); } +function em_print_dmesg(ptr) { const s = UTF8ToString(ptr, 1024); if (Module.dmesg) Module.dmesg(s); else console.debug(s); } +function _jd_tcpsock_new(hostname,port) { return Module.sockOpen(hostname, port); } +function _jd_tcpsock_write(buf,size) { return Module.sockWrite(buf, size); } +function _jd_tcpsock_close() { return Module.sockClose(); } +function _jd_tcpsock_is_available() { return Module.sockIsAvailable(); } + + +// end include: preamble.js + + /** @constructor */ + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + var c = str.charCodeAt(i); // possibly a lead surrogate + if (c <= 0x7F) { + len++; + } else if (c <= 0x7FF) { + len += 2; + } else if (c >= 0xD800 && c <= 0xDFFF) { + len += 4; ++i; + } else { + len += 3; + } + } + return len; + }; + + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + assert(typeof str === 'string'); + // Parameter maxBytesToWrite is not optional. Negative values, 0, null, + // undefined and false each don't write out any bytes. + if (!(maxBytesToWrite > 0)) + return 0; + + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator. + for (var i = 0; i < str.length; ++i) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code + // unit, not a Unicode code point of the character! So decode + // UTF16->UTF32->UTF8. + // See http://unicode.org/faq/utf_bom.html#utf16-3 + // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description + // and https://www.ietf.org/rfc/rfc2279.txt + // and https://tools.ietf.org/html/rfc3629 + var u = str.charCodeAt(i); // possibly a lead surrogate + if (u >= 0xD800 && u <= 0xDFFF) { + var u1 = str.charCodeAt(++i); + u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF); + } + if (u <= 0x7F) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 0x7FF) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 0xC0 | (u >> 6); + heap[outIdx++] = 0x80 | (u & 63); + } else if (u <= 0xFFFF) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 0xE0 | (u >> 12); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).'); + heap[outIdx++] = 0xF0 | (u >> 18); + heap[outIdx++] = 0x80 | ((u >> 12) & 63); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } + } + // Null-terminate the pointer to the buffer. + heap[outIdx] = 0; + return outIdx - startIdx; + }; + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + + /** @suppress {duplicate } */ + var stringToNewUTF8 = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8(str, ret, size); + return ret; + }; + var allocateUTF8 = stringToNewUTF8; + + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + // Pass the module as the first argument. + callbacks.shift()(Module); + } + }; + + + /** + * @param {number} ptr + * @param {string} type + */ + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': return HEAP8[((ptr)>>0)]; + case 'i8': return HEAP8[((ptr)>>0)]; + case 'i16': return HEAP16[((ptr)>>1)]; + case 'i32': return HEAP32[((ptr)>>2)]; + case 'i64': abort('to do getValue(i64) use WASM_BIGINT'); + case 'float': return HEAPF32[((ptr)>>2)]; + case 'double': return HEAPF64[((ptr)>>3)]; + case '*': return HEAPU32[((ptr)>>2)]; + default: abort(`invalid type for getValue: ${type}`); + } + } + + var ptrToString = (ptr) => { + assert(typeof ptr === 'number'); + // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned. + ptr >>>= 0; + return '0x' + ptr.toString(16).padStart(8, '0'); + }; + + + /** + * @param {number} ptr + * @param {number} value + * @param {string} type + */ + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': HEAP8[((ptr)>>0)] = value; break; + case 'i8': HEAP8[((ptr)>>0)] = value; break; + case 'i16': HEAP16[((ptr)>>1)] = value; break; + case 'i32': HEAP32[((ptr)>>2)] = value; break; + case 'i64': abort('to do setValue(i64) use WASM_BIGINT'); + case 'float': HEAPF32[((ptr)>>2)] = value; break; + case 'double': HEAPF64[((ptr)>>3)] = value; break; + case '*': HEAPU32[((ptr)>>2)] = value; break; + default: abort(`invalid type for setValue: ${type}`); + } + } + + var warnOnce = (text) => { + if (!warnOnce.shown) warnOnce.shown = {}; + if (!warnOnce.shown[text]) { + warnOnce.shown[text] = 1; + if (ENVIRONMENT_IS_NODE) text = 'warning: ' + text; + err(text); + } + }; + + var _abort = () => { + abort('native code called abort()'); + }; + + var _emscripten_memcpy_big = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num); + + var getHeapMax = () => + HEAPU8.length; + + var abortOnCannotGrowMemory = (requestedSize) => { + abort(`Cannot enlarge memory arrays to size ${requestedSize} bytes (OOM). Either (1) compile with -sINITIAL_MEMORY=X with X higher than the current value ${HEAP8.length}, (2) compile with -sALLOW_MEMORY_GROWTH which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -sABORTING_MALLOC=0`); + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned. + requestedSize >>>= 0; + abortOnCannotGrowMemory(requestedSize); + }; + + + var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined; + + /** + * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given + * array that contains uint8 values, returns a copy of that string as a + * Javascript String object. + * heapOrArray is either a regular array, or a JavaScript typed array view. + * @param {number} idx + * @param {number=} maxBytesToRead + * @return {string} + */ + var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + // TextDecoder needs to know the byte length in advance, it doesn't stop on + // null terminator by itself. Also, use the length info to avoid running tiny + // strings through TextDecoder, since .subarray() allocates garbage. + // (As a tiny code save trick, compare endPtr against endIdx using a negation, + // so that undefined means Infinity) + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + // If building with TextDecoder, we have already computed the string length + // above, so test loop end condition against that + while (idx < endPtr) { + // For UTF8 byte structure, see: + // http://en.wikipedia.org/wiki/UTF-8#Description + // https://www.ietf.org/rfc/rfc2279.txt + // https://tools.ietf.org/html/rfc3629 + var u0 = heapOrArray[idx++]; + if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 0xF0) == 0xE0) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte ' + ptrToString(u0) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!'); + u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); + } + + if (u0 < 0x10000) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 0x10000; + str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF)); + } + } + return str; + }; + + /** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index (i.e. maxBytesToRead will not + * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing + * frequent uses of UTF8ToString() with and without maxBytesToRead may throw + * JS JIT optimizations off, so it is worth to consider consistently using one + * @return {string} + */ + var UTF8ToString = (ptr, maxBytesToRead) => { + assert(typeof ptr == 'number'); + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + }; + var SYSCALLS = { + varargs:undefined, + get() { + assert(SYSCALLS.varargs != undefined); + var ret = HEAP32[((SYSCALLS.varargs)>>2)]; + SYSCALLS.varargs += 4; + return ret; + }, + getp() { return SYSCALLS.get() }, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module['onExit']) Module['onExit'](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + /** @suppress {duplicate } */ + /** @param {boolean|number=} implicit */ + var exitJS = (status, implicit) => { + EXITSTATUS = status; + + checkUnflushedContent(); + + // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down + if (keepRuntimeAlive() && !implicit) { + var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`; + readyPromiseReject(msg); + err(msg); + } + + _proc_exit(status); + }; + var _exit = exitJS; + + var _fd_close = (fd) => { + abort('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM'); + }; + + + var convertI32PairToI53Checked = (lo, hi) => { + assert(lo == (lo >>> 0) || lo == (lo|0)); // lo should either be a i32 or a u32 + assert(hi === (hi|0)); // hi should be a i32 + return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN; + }; + function _fd_seek(fd,offset_low, offset_high,whence,newOffset) { + var offset = convertI32PairToI53Checked(offset_low, offset_high);; + + + return 70; + ; + } + + var printCharBuffers = [null,[],[]]; + + var printChar = (stream, curr) => { + var buffer = printCharBuffers[stream]; + assert(buffer); + if (curr === 0 || curr === 10) { + (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0)); + buffer.length = 0; + } else { + buffer.push(curr); + } + }; + + var flush_NO_FILESYSTEM = () => { + // flush anything remaining in the buffers during shutdown + _fflush(0); + if (printCharBuffers[1].length) printChar(1, 10); + if (printCharBuffers[2].length) printChar(2, 10); + }; + + + var _fd_write = (fd, iov, iovcnt, pnum) => { + // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0 + var num = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[((iov)>>2)]; + var len = HEAPU32[(((iov)+(4))>>2)]; + iov += 8; + for (var j = 0; j < len; j++) { + printChar(fd, HEAPU8[ptr+j]); + } + num += len; + } + HEAPU32[((pnum)>>2)] = num; + return 0; + }; +function checkIncomingModuleAPI() { + ignoredModuleProp('fetchSettings'); +} +var wasmImports = { + _devs_panic_handler: _devs_panic_handler, + _jd_tcpsock_close: _jd_tcpsock_close, + _jd_tcpsock_is_available: _jd_tcpsock_is_available, + _jd_tcpsock_new: _jd_tcpsock_new, + _jd_tcpsock_write: _jd_tcpsock_write, + abort: _abort, + em_deploy_handler: em_deploy_handler, + em_flash_load: em_flash_load, + em_flash_save: em_flash_save, + em_flash_size: em_flash_size, + em_jd_crypto_get_random: em_jd_crypto_get_random, + em_print_dmesg: em_print_dmesg, + em_send_frame: em_send_frame, + em_send_large_frame: em_send_large_frame, + em_time_now: em_time_now, + emscripten_memcpy_big: _emscripten_memcpy_big, + emscripten_resize_heap: _emscripten_resize_heap, + exit: _exit, + fd_close: _fd_close, + fd_seek: _fd_seek, + fd_write: _fd_write +}; +var wasmExports = createWasm(); +var ___wasm_call_ctors = createExportWrapper('__wasm_call_ctors'); +var _malloc = Module['_malloc'] = createExportWrapper('malloc'); +var ___errno_location = createExportWrapper('__errno_location'); +var _free = Module['_free'] = createExportWrapper('free'); +var _jd_em_set_device_id_2x_i32 = Module['_jd_em_set_device_id_2x_i32'] = createExportWrapper('jd_em_set_device_id_2x_i32'); +var _jd_em_set_device_id_string = Module['_jd_em_set_device_id_string'] = createExportWrapper('jd_em_set_device_id_string'); +var _jd_em_init = Module['_jd_em_init'] = createExportWrapper('jd_em_init'); +var _jd_em_process = Module['_jd_em_process'] = createExportWrapper('jd_em_process'); +var _jd_em_frame_received = Module['_jd_em_frame_received'] = createExportWrapper('jd_em_frame_received'); +var _jd_em_devs_deploy = Module['_jd_em_devs_deploy'] = createExportWrapper('jd_em_devs_deploy'); +var _jd_em_devs_verify = Module['_jd_em_devs_verify'] = createExportWrapper('jd_em_devs_verify'); +var _jd_em_devs_client_deploy = Module['_jd_em_devs_client_deploy'] = createExportWrapper('jd_em_devs_client_deploy'); +var _jd_em_devs_enable_gc_stress = Module['_jd_em_devs_enable_gc_stress'] = createExportWrapper('jd_em_devs_enable_gc_stress'); +var _jd_em_tcpsock_on_event = Module['_jd_em_tcpsock_on_event'] = createExportWrapper('jd_em_tcpsock_on_event'); +var _fflush = Module['_fflush'] = createExportWrapper('fflush'); +var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])(); +var _emscripten_stack_get_free = () => (_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'])(); +var _emscripten_stack_get_base = () => (_emscripten_stack_get_base = wasmExports['emscripten_stack_get_base'])(); +var _emscripten_stack_get_end = () => (_emscripten_stack_get_end = wasmExports['emscripten_stack_get_end'])(); +var stackSave = createExportWrapper('stackSave'); +var stackRestore = createExportWrapper('stackRestore'); +var stackAlloc = createExportWrapper('stackAlloc'); +var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])(); +var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji'); +var ___start_em_js = Module['___start_em_js'] = 30696; +var ___stop_em_js = Module['___stop_em_js'] = 32181; + +// include: postamble.js +// === Auto-generated postamble setup entry stuff === + +// include: base64Utils.js +// Converts a string of base64 into a byte array. +// Throws error on invalid input. +function intArrayFromBase64(s) { + if (typeof ENVIRONMENT_IS_NODE != 'undefined' && ENVIRONMENT_IS_NODE) { + var buf = Buffer.from(s, 'base64'); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.length); + } + + try { + var decoded = atob(s); + var bytes = new Uint8Array(decoded.length); + for (var i = 0 ; i < decoded.length ; ++i) { + bytes[i] = decoded.charCodeAt(i); + } + return bytes; + } catch (_) { + throw new Error('Converting base64 string to bytes failed.'); + } +} + +// If filename is a base64 data URI, parses and returns data (Buffer on node, +// Uint8Array otherwise). If filename is not a base64 data URI, returns undefined. +function tryParseAsDataURI(filename) { + if (!isDataURI(filename)) { + return; + } + + return intArrayFromBase64(filename.slice(dataURIPrefix.length)); +} +// end include: base64Utils.js +var missingLibrarySymbols = [ + 'writeI53ToI64', + 'writeI53ToI64Clamped', + 'writeI53ToI64Signaling', + 'writeI53ToU64Clamped', + 'writeI53ToU64Signaling', + 'readI53FromI64', + 'readI53FromU64', + 'convertI32PairToI53', + 'convertU32PairToI53', + 'zeroMemory', + 'growMemory', + 'isLeapYear', + 'ydayFromDate', + 'arraySum', + 'addDays', + 'setErrNo', + 'inetPton4', + 'inetNtop4', + 'inetPton6', + 'inetNtop6', + 'readSockaddr', + 'writeSockaddr', + 'getHostByName', + 'initRandomFill', + 'randomFill', + 'getCallstack', + 'emscriptenLog', + 'convertPCtoSourceLocation', + 'readEmAsmArgs', + 'jstoi_q', + 'jstoi_s', + 'getExecutableName', + 'listenOnce', + 'autoResumeAudioContext', + 'dynCallLegacy', + 'getDynCaller', + 'dynCall', + 'handleException', + 'runtimeKeepalivePush', + 'runtimeKeepalivePop', + 'callUserCallback', + 'maybeExit', + 'safeSetTimeout', + 'asmjsMangle', + 'asyncLoad', + 'alignMemory', + 'mmapAlloc', + 'handleAllocatorInit', + 'HandleAllocator', + 'getNativeTypeSize', + 'STACK_SIZE', + 'STACK_ALIGN', + 'POINTER_SIZE', + 'ASSERTIONS', + 'getCFunc', + 'ccall', + 'cwrap', + 'uleb128Encode', + 'sigToWasmTypes', + 'generateFuncType', + 'convertJsFunctionToWasm', + 'getEmptyTableSlot', + 'updateTableMap', + 'getFunctionAddress', + 'addFunction', + 'removeFunction', + 'reallyNegative', + 'unSign', + 'strLen', + 'reSign', + 'formatString', + 'intArrayFromString', + 'intArrayToString', + 'AsciiToString', + 'stringToAscii', + 'UTF16ToString', + 'stringToUTF16', + 'lengthBytesUTF16', + 'UTF32ToString', + 'stringToUTF32', + 'lengthBytesUTF32', + 'stringToUTF8OnStack', + 'writeArrayToMemory', + 'registerKeyEventCallback', + 'maybeCStringToJsString', + 'findEventTarget', + 'findCanvasEventTarget', + 'getBoundingClientRect', + 'fillMouseEventData', + 'registerMouseEventCallback', + 'registerWheelEventCallback', + 'registerUiEventCallback', + 'registerFocusEventCallback', + 'fillDeviceOrientationEventData', + 'registerDeviceOrientationEventCallback', + 'fillDeviceMotionEventData', + 'registerDeviceMotionEventCallback', + 'screenOrientation', + 'fillOrientationChangeEventData', + 'registerOrientationChangeEventCallback', + 'fillFullscreenChangeEventData', + 'registerFullscreenChangeEventCallback', + 'JSEvents_requestFullscreen', + 'JSEvents_resizeCanvasForFullscreen', + 'registerRestoreOldStyle', + 'hideEverythingExceptGivenElement', + 'restoreHiddenElements', + 'setLetterbox', + 'softFullscreenResizeWebGLRenderTarget', + 'doRequestFullscreen', + 'fillPointerlockChangeEventData', + 'registerPointerlockChangeEventCallback', + 'registerPointerlockErrorEventCallback', + 'requestPointerLock', + 'fillVisibilityChangeEventData', + 'registerVisibilityChangeEventCallback', + 'registerTouchEventCallback', + 'fillGamepadEventData', + 'registerGamepadEventCallback', + 'registerBeforeUnloadEventCallback', + 'fillBatteryEventData', + 'battery', + 'registerBatteryEventCallback', + 'setCanvasElementSize', + 'getCanvasElementSize', + 'demangle', + 'demangleAll', + 'jsStackTrace', + 'stackTrace', + 'getEnvStrings', + 'checkWasiClock', + 'wasiRightsToMuslOFlags', + 'wasiOFlagsToMuslOFlags', + 'createDyncallWrapper', + 'setImmediateWrapped', + 'clearImmediateWrapped', + 'polyfillSetImmediate', + 'getPromise', + 'makePromise', + 'idsToPromises', + 'makePromiseCallback', + 'ExceptionInfo', + 'findMatchingCatch', + 'setMainLoop', + 'getSocketFromFD', + 'getSocketAddress', + 'FS_createPreloadedFile', + 'FS_modeStringToFlags', + 'FS_getMode', + 'FS_stdin_getChar', + '_setNetworkCallback', + 'heapObjectForWebGLType', + 'heapAccessShiftForWebGLHeap', + 'webgl_enable_ANGLE_instanced_arrays', + 'webgl_enable_OES_vertex_array_object', + 'webgl_enable_WEBGL_draw_buffers', + 'webgl_enable_WEBGL_multi_draw', + 'emscriptenWebGLGet', + 'computeUnpackAlignedImageSize', + 'colorChannelsInGlTextureFormat', + 'emscriptenWebGLGetTexPixelData', + '__glGenObject', + 'emscriptenWebGLGetUniform', + 'webglGetUniformLocation', + 'webglPrepareUniformLocationsBeforeFirstUse', + 'webglGetLeftBracePos', + 'emscriptenWebGLGetVertexAttrib', + '__glGetActiveAttribOrUniform', + 'writeGLArray', + 'registerWebGlEventCallback', + 'runAndAbortIfError', + 'SDL_unicode', + 'SDL_ttfContext', + 'SDL_audio', + 'GLFW_Window', + 'ALLOC_NORMAL', + 'ALLOC_STACK', + 'allocate', + 'writeStringToMemory', + 'writeAsciiToMemory', +]; +missingLibrarySymbols.forEach(missingLibrarySymbol) + +var unexportedSymbols = [ + 'run', + 'addOnPreRun', + 'addOnInit', + 'addOnPreMain', + 'addOnExit', + 'addOnPostRun', + 'addRunDependency', + 'removeRunDependency', + 'FS_createFolder', + 'FS_createPath', + 'FS_createDataFile', + 'FS_createLazyFile', + 'FS_createLink', + 'FS_createDevice', + 'FS_readFile', + 'FS_unlink', + 'out', + 'err', + 'callMain', + 'abort', + 'keepRuntimeAlive', + 'wasmMemory', + 'wasmTable', + 'wasmExports', + 'stackAlloc', + 'stackSave', + 'stackRestore', + 'getTempRet0', + 'setTempRet0', + 'writeStackCookie', + 'checkStackCookie', + 'intArrayFromBase64', + 'tryParseAsDataURI', + 'convertI32PairToI53Checked', + 'ptrToString', + 'exitJS', + 'getHeapMax', + 'abortOnCannotGrowMemory', + 'ENV', + 'MONTH_DAYS_REGULAR', + 'MONTH_DAYS_LEAP', + 'MONTH_DAYS_REGULAR_CUMULATIVE', + 'MONTH_DAYS_LEAP_CUMULATIVE', + 'ERRNO_CODES', + 'ERRNO_MESSAGES', + 'DNS', + 'Protocols', + 'Sockets', + 'timers', + 'warnOnce', + 'UNWIND_CACHE', + 'readEmAsmArgsArray', + 'freeTableIndexes', + 'functionsInTableMap', + 'setValue', + 'getValue', + 'PATH', + 'PATH_FS', + 'UTF8Decoder', + 'UTF8ArrayToString', + 'UTF8ToString', + 'stringToUTF8Array', + 'stringToUTF8', + 'lengthBytesUTF8', + 'UTF16Decoder', + 'stringToNewUTF8', + 'JSEvents', + 'specialHTMLTargets', + 'currentFullscreenStrategy', + 'restoreOldWindowedStyle', + 'ExitStatus', + 'flush_NO_FILESYSTEM', + 'promiseMap', + 'uncaughtExceptionCount', + 'exceptionLast', + 'exceptionCaught', + 'Browser', + 'wget', + 'SYSCALLS', + 'preloadPlugins', + 'FS_stdin_getChar_buffer', + 'FS', + 'MEMFS', + 'TTY', + 'PIPEFS', + 'SOCKFS', + 'tempFixedLengthArray', + 'miniTempWebGLFloatBuffers', + 'miniTempWebGLIntBuffers', + 'GL', + 'emscripten_webgl_power_preferences', + 'AL', + 'GLUT', + 'EGL', + 'GLEW', + 'IDBStore', + 'SDL', + 'SDL_gfx', + 'GLFW', + 'allocateUTF8', + 'allocateUTF8OnStack', + 'WS', +]; +unexportedSymbols.forEach(unexportedRuntimeSymbol); + + + +var calledRun; + +dependenciesFulfilled = function runCaller() { + // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled +}; + +function stackCheckInit() { + // This is normally called automatically during __wasm_call_ctors but need to + // get these values before even running any of the ctors so we call it redundantly + // here. + _emscripten_stack_init(); + // TODO(sbc): Move writeStackCookie to native to to avoid this. + writeStackCookie(); +} + +function run() { + + if (runDependencies > 0) { + return; + } + + stackCheckInit(); + + preRun(); + + // a preRun added a dependency, run will be called later + if (runDependencies > 0) { + return; + } + + function doRun() { + // run may have just been called through dependencies being fulfilled just in this very frame, + // or while the async setStatus time below was happening + if (calledRun) return; + calledRun = true; + Module['calledRun'] = true; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized'](); + + assert(!Module['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(function() { + setTimeout(function() { + Module['setStatus'](''); + }, 1); + doRun(); + }, 1); + } else + { + doRun(); + } + checkStackCookie(); +} + +function checkUnflushedContent() { + // Compiler settings do not allow exiting the runtime, so flushing + // the streams is not possible. but in ASSERTIONS mode we check + // if there was something to flush, and if so tell the user they + // should request that the runtime be exitable. + // Normally we would not even include flush() at all, but in ASSERTIONS + // builds we do so just for this check, and here we see if there is any + // content to flush, that is, we check if there would have been + // something a non-ASSERTIONS build would have not seen. + // How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0 + // mode (which has its own special function for this; otherwise, all + // the code is inside libc) + var oldOut = out; + var oldErr = err; + var has = false; + out = err = (x) => { + has = true; + } + try { // it doesn't matter if it fails + flush_NO_FILESYSTEM(); + } catch(e) {} + out = oldOut; + err = oldErr; + if (has) { + warnOnce('stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.'); + warnOnce('(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)'); + } +} + +if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } +} + +run(); + + +// end include: postamble.js + + + return moduleArg.ready +} + +); +})(); +if (typeof exports === 'object' && typeof module === 'object') + module.exports = Module; +else if (typeof define === 'function' && define['amd']) + define([], () => Module); diff --git a/getting-started.html b/getting-started.html new file mode 100644 index 00000000000..37e85904c71 --- /dev/null +++ b/getting-started.html @@ -0,0 +1,21 @@ + + + + + +Getting Started | DeviceScript + + + + + + + + +
+

Getting Started

DeviceScript has a development cycle tailored for TypeScript inclined developers, node or web.

Visual Studio Code extension

Visual Studio and the DeviceScript Extension provide the best developer experience, with building, deploying, debugging, +tracing, device monitoring and other developer productivity features.

Command Line

The command line is IDE agnostic and will let you script your own developer experience.

Samples

Once you are ready with your setup, you can start with the samples.

+ + + + \ No newline at end of file diff --git a/getting-started/cli.html b/getting-started/cli.html new file mode 100644 index 00000000000..2d0e6dd95fc --- /dev/null +++ b/getting-started/cli.html @@ -0,0 +1,23 @@ + + + + + +Command Line | DeviceScript + + + + + + + + +
+

Command Line

The command line tool is compatible with container and virtual machines so you can run it +in Docker, GitHub Codespaces, ...

Setting up the project

Let's get started by installing the DeviceScript command line and create an empty project

  • Open a terminal in a new folder
  • install Node.js 16+ if not already installed
  • Use the init command to setup a new project
npx --yes @devicescript/cli@latest init

You will have the following files created.

.devicescript/     reserved folder for devicescript generated files
package.json project configuration
devsconfig.json configure the DeviceScript compiler with additional flags,
also used by VSCode extension to activate.
src/ directory for DeviceScript sources
src/main.ts usual name for your entry point application
src/tsconfig.json configure the TypeScript compiler to compile DeviceScript syntax
...
  • open src/main.ts and copy the following code
src/main.ts
import * as ds from "@devicescript/core"
import { debounceTime, filter } from "@devicescript/observables"

const sensor = new ds.AirPressure()
const mouse = new ds.HidMouse()
// listen for pressure changes
sensor.reading
.pipe(
filter(pressure => pressure > 1400),
debounceTime(500)
)
.subscribe(async () => {
console.log(`click!`)
await mouse.setButton(
ds.HidMouseButton.Left,
ds.HidMouseButtonEvent.Click
)
})

Launch the build watch

Assuming src/main.ts is the root file of your application, +launch a compilation task in watch mode using this command.

devs devtools src/main.ts

or, for short,

yarn watch

The command line task will also start a local web server that will send the compiled bytecode +to a developer tools page similar to the one hosted in the docs.

  • open the developer tools page, typically http://localhost:8081/ (see cli output)
  • use te developer tools page similarly to the embedded docs page

Edit, deploy, debug loop

From here, your developer inner loop will be very similar to building/debugging a web site with hot reload.

  • make an edit in your source file, say src/main.ts
  • after a couple seconds, the compiler picks up the changes, produces a new bytecode and sends it to the developer tools
  • the developer tools automatically deploy the bytecode to the selected device (by default the simulator)
  • switch from VS Code to the browser and debug your new code
+ + + + \ No newline at end of file diff --git a/getting-started/vscode.html b/getting-started/vscode.html new file mode 100644 index 00000000000..49cff96210a --- /dev/null +++ b/getting-started/vscode.html @@ -0,0 +1,22 @@ + + + + + +Visual Studio Code Extension | DeviceScript + + + + + + + + +
+

Visual Studio Code Extension

The Visual Studio Code extension provides the best developer experience for DeviceScript.

You will also need

Features

  • Build and watch using DeviceScript compiler, deploy to simulator or hardware
  • Board configuration for hardware pins, I2S, SPI configurations
  • Debugger with breakpoints, stack traces, exceptions, stepping
  • Simulator for DeviceScript and sensors/actuators
  • Connection to native DeviceScript device
  • Device, services, register Explorer view
  • Register and Event watch

(Optional) Manual installation from the GitHub releases

Using the Install from VSIX command in the Extensions view command dropdown, +or the Extensions: Install from VSIX command in the Command Palette, point to the .vsix file +(see full instructions).

Creating a new project

  • install Node.JS 16+
  • From the Command palette, type DeviceScript: Create New Project... and follow the prompts.

The new project should be ready to go.

DeviceScript basics

Navigate to the Developer section to learn the basics of the language.

tip

To report an issue, open the command palette and run DeviceScript: Report Issue...*.

+ + + + \ No newline at end of file diff --git a/getting-started/vscode/debugging.html b/getting-started/vscode/debugging.html new file mode 100644 index 00000000000..acabd7b162c --- /dev/null +++ b/getting-started/vscode/debugging.html @@ -0,0 +1,21 @@ + + + + + +Debugging | DeviceScript + + + + + + + + +
+

Debugging

DeviceScript programs can be debugged using the usual Visual Studio Code debugger interface.

The services communication layer continues to process packets while the DeviceScript program is paused.

Configuration

DeviceScript project come with default debugging configurations, in launch.json, that can be extended or reconfigured.

launch.json
{
"version": "0.2.0",
"configurations": [
...
{
"name": "DeviceScript",
"type": "devicescript",
"request": "launch",
"program": "${workspaceFolder}/src/main.ts",
"deviceId": "${command:deviceScriptSimulator}",
"stopOnEntry": false
},
]
}

program

Let's you choose a different entry point file for debugging.

stopOnEntry

Notifies the debugger to break on the first user-code statement, or not.

deviceId

Specifies the device that the debugger should bind to. It can be a device identifier (short or long) +or the ${command:deviceScriptSimulator} command that launches the simulator.

+ + + + \ No newline at end of file diff --git a/getting-started/vscode/simulation.html b/getting-started/vscode/simulation.html new file mode 100644 index 00000000000..423afed0a0b --- /dev/null +++ b/getting-started/vscode/simulation.html @@ -0,0 +1,26 @@ + + + + + +Simulation | DeviceScript + + + + + + + + +
+

Simulation

DeviceScript provides a rich support for simulating devices and peripherals. +The Visual Studio Code extension makes it easy to start and stop simulators.

DeviceScript simulator

The first simulator you use is a DeviceScript Manager device, a device capable of running the DeviceScript bytecode. +It runs the DeviceScript C firmware compiled into WebAssembly. +This WASM simulator will be launched by the debugger or by clicking on the plug icon in the DeviceScript pane.

Connect button in DeviceScript pane

Once started the simulator will appear in the device tree and you can explore its services and status.

simulator tree

Peripherals dashboard

The dashboard icon starts a peripheral dashboard view. +It allows to visualize any connected device and also launch simulator peripherals. +The simulator peripheral are typically interactive and allow to change the values using UI controls.

Dashboard

note

The dashboard requires internet access.

Custom servers

It is also possible to create peripheral simulators in "node.js TypeScript" (running in a node.js process). +This technique is documented in the developer documentation.

+ + + + \ No newline at end of file diff --git a/getting-started/vscode/troubleshooting.html b/getting-started/vscode/troubleshooting.html new file mode 100644 index 00000000000..bd8f1b270c9 --- /dev/null +++ b/getting-started/vscode/troubleshooting.html @@ -0,0 +1,32 @@ + + + + + +Troubleshooting | DeviceScript + + + + + + + + +
+

Troubleshooting

Node.JS v16+ not installed

Make sure that your installed Node.JS version is v16+. Some linux distribution may +install an older version of Node.JS by default.

> node --version
v18.16.0
tip

nvm is a convinient way to install +and manage multiple Node.JS versions.

DeviceScript CLI not installed

The development server runs the DeviceScript command line (@devicescript/cli) installed +locally in your project. +Make sure @devicescript/cli has been +added as a developer dependency to your project, and that dependencies have been installed.

yarn add -D @devicescript/cli@latest
yarn install

DeviceScript terminal won't start

The DeviceScript extension spawns a Node.JS process to +run the debugger adapter, connect to hardware device and build sources. +Depending on your machine configuration, you may have to specify where the Node.JS binaries +are located.

Start by enable the Devtools: Shell preference so that DeviceScript start node is a terminal rather directly. +This allows you to look at the potential error messages.

  • Open the User Settings
  • Search for DeviceScript Devtools shell
  • Reload Visual Studio Code

Devtools shell settings

If the error messages indicates that the node process cannot be resolved, you may want to specify the path +of your node.js v16+ manually in the user settings.

  • Open the User Settings
  • Search for DeviceScript node and update the Node.JS binary path
  • Reload Visual Studio Code

Port 8081 is used

It may happen that a previous session left the development server dangling, run this command to kill processes hanging on port 8081.

npx kill-port 8081

Serial connection won't connect

  • serial connection used by another application
  • make sure the serialport package is installed
  • running in remote workspace

Can't connect after I deployed my program aka Factory Reset

First reset the device, or unplug and plug back in. +If this doesn't help, select "Clean Flash..." +from the connect menu and once done select "Flash Firmware..." from the same menu.

+ + + + \ No newline at end of file diff --git a/getting-started/vscode/user-interface.html b/getting-started/vscode/user-interface.html new file mode 100644 index 00000000000..77fe77c1f79 --- /dev/null +++ b/getting-started/vscode/user-interface.html @@ -0,0 +1,23 @@ + + + + + +User Interface | DeviceScript + + + + + + + + +
+

User interface

Device Explorer

The DeviceScript view is opened by clicking the DeviceScript logo in the left bar menu.

It provides a treeview of the device, services, registers and events. The tree view updates +automatically with live data from the simulators and devices.

Device explorer screenshot

Device Explorer Actions

The view has 3 actions:

  • connect, the plug icon, which allows you to connect to a physical device, start the simulator or flash new firmware.
  • dashboard, starts the peripheral simulator dashboard
  • terminal, displays the DeviceScript terminal

Dashboard

Register and Events watch

You can watch any register or event in the device explorer. This provides a way to 'pin' a register for debugging +or monitoring.

Editor title actions

Any main*.ts file in a DeviceScript project will have added action in the editor title.

Editor actions for the main file

  • Debug: starts a debugging session from this file,
  • Build: builds the binary for this entry point file,
  • Upload: builds and deploys the binary to the current device
  • Configure: a wizard experience that helps you configure the code for your hardware device

Terminal

The DeviceScript terminal displays the status of the development tool process and the console output from devices.

Status bar

The DeviceScript status shows a logo and the current project name (the extension works on a single project at a time). +You can hover over the status to get more information or click to change the current project.

status bar screenshot

+ + + + \ No newline at end of file diff --git a/getting-started/vscode/workspaces.html b/getting-started/vscode/workspaces.html new file mode 100644 index 00000000000..53e8b5dd600 --- /dev/null +++ b/getting-started/vscode/workspaces.html @@ -0,0 +1,25 @@ + + + + + +Local and Remote Workspaces | DeviceScript + + + + + + + + +
+

Local and Remote Workspaces

In a local workspace, DeviceScript opens a native serial connection to communicate with hardware devices.

In a remote workspace, DeviceScript uses a separate browser window using WebSerial that communicates with +the localhost developer tools server.

In general, web editor is not supported.

FeatureLocal (Windows, MacOS, Linux)Remote (WSL, Docker, Codespaces, ...)Web
TypeScript completion, syntax
Compiler
Device Simulator
Debugger
Simulator Dashboard
Devices/Watch views
Flash Firmware✓ (1)
Serial connection to hardware✓ (2)
USB connection to hardware(3)
  • (1) Using manual download of .UF2 files for RP2040 or the Adafruit WebSerial ESPTool
  • (2) Through a seperate browser window using WebSerial
  • (3) No board with USB connection supported yet

Two windows with a connection connector and Visual Studio Code in the browser

Remote workspace

When using a remote workspace, the developer tool command line (that gets spawned by the Visual Studio extension) +cannot access physical devices.

To work around this issue, the extension launches a web page that uses WebSerial/WebUSB to connect +to the physical device and proxy the packets back to the local web server hosted by the developer tools.

The key difference between local and remote are:

  • the connection is done through a separate web page +that needs to stay opened and in the foreground (browser aggressively throttle background pages)
  • the console output is displayed in the connection page rather than in the VS Code terminal

The remote feature was tested for the following remote solutions:

Virtual Workspaces

Virtual Workspaces, not to be confused with remote workspaces, +are not supported:

+ + + + \ No newline at end of file diff --git a/hero.png b/hero.png new file mode 100644 index 00000000000..0e9139d1a84 Binary files /dev/null and b/hero.png differ diff --git a/img/.dslogo.svg b/img/.dslogo.svg new file mode 100644 index 00000000000..0797d491aee --- /dev/null +++ b/img/.dslogo.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/img/.dslogo_dark.svg b/img/.dslogo_dark.svg new file mode 100644 index 00000000000..6220220ac32 --- /dev/null +++ b/img/.dslogo_dark.svg @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/img/ds.favicon.svg b/img/ds.favicon.svg new file mode 100644 index 00000000000..9dc0f758df5 --- /dev/null +++ b/img/ds.favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/favicon.svg b/img/favicon.svg new file mode 100644 index 00000000000..56c26f731fe --- /dev/null +++ b/img/favicon.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/img/logo.svg b/img/logo.svg new file mode 100644 index 00000000000..56c26f731fe --- /dev/null +++ b/img/logo.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/img/logo_dark.svg b/img/logo_dark.svg new file mode 100644 index 00000000000..56c26f731fe --- /dev/null +++ b/img/logo_dark.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/img/samples/temperature-mqtt.jpg b/img/samples/temperature-mqtt.jpg new file mode 100644 index 00000000000..fe8c25214d6 Binary files /dev/null and b/img/samples/temperature-mqtt.jpg differ diff --git a/img/shields/pico-bricks.jpg b/img/shields/pico-bricks.jpg new file mode 100644 index 00000000000..c0ae1975308 Binary files /dev/null and b/img/shields/pico-bricks.jpg differ diff --git a/img/shields/pimoroni-pico-badger.jpg b/img/shields/pimoroni-pico-badger.jpg new file mode 100644 index 00000000000..5e70bd35add Binary files /dev/null and b/img/shields/pimoroni-pico-badger.jpg differ diff --git a/img/shields/waveshare-pico-lcd-114.png b/img/shields/waveshare-pico-lcd-114.png new file mode 100644 index 00000000000..662a6155f67 Binary files /dev/null and b/img/shields/waveshare-pico-lcd-114.png differ diff --git a/img/shields/xiao-expansion-board.jpg b/img/shields/xiao-expansion-board.jpg new file mode 100644 index 00000000000..64dd9dac807 Binary files /dev/null and b/img/shields/xiao-expansion-board.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 00000000000..0afae3943de --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + +DeviceScript | DeviceScript + + + + + + + + +
+

DeviceScript

TypeScript for Tiny IoT Devices

TypeScript for IoT

The familiar syntax and tooling, all at your fingertips.

Small Runtime

Bytecode interpreter for low power/flash/memory.

Debugging

In Visual Studio Code, for embedded hardware or simulated devices.

Simulation and Testing

Develop and test your firmware using hardware/mock sensors. CI friendly.

Local and Remote Workspace

Develop your firmware from your local machine or a remote container

TypeScript Drivers

Write drivers in TypeScript using I2C, SPI, ... without having to go down to C (limitations apply :) )

ESP32, RP2040, ...

Supported on popular microcontrollers. Portable to more...

Networking

fetch, TCP, TLS, HTTP/S, MQTT, ...

Package Ecosystem

Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages.

+ + + + \ No newline at end of file diff --git a/intro.html b/intro.html new file mode 100644 index 00000000000..764f615fece --- /dev/null +++ b/intro.html @@ -0,0 +1,22 @@ + + + + + +DeviceScript | DeviceScript + + + + + + + + +
+

DeviceScript

DeviceScript brings a TypeScript developer experience to low-resource microcontroller-based devices. +DeviceScript is compiled to a custom VM bytecode, which can run in very constrained +environments.

A screenshot of the Visual Studio Code integration

TypeScript

The familiar syntax and tooling, all at your fingertips. Read the language reference.

Portable Virtual Machine

Small footprint DeviceScript bytecode interpreter. See supported devices.

Hardware as Services

Write reusable application/firmware on top of abstract hardware services. See clients.

Small

Designed for low power, low flash, low memory embedded projects.

Simulation & Tracing

Develop and test your firmware using simulated or real sensors. See simulation

Debugging

Full debugging experience in Visual Studio Code, for hardware or simulated devices. Read about the Visual Studio Extension.

Package Ecosystem

Leverage npm, yarn or pnpm to distribute and consume DeviceScript packages. Read about Packages.

+ + + + \ No newline at end of file diff --git a/language.html b/language.html new file mode 100644 index 00000000000..0ac0b3165f7 --- /dev/null +++ b/language.html @@ -0,0 +1,28 @@ + + + + + +DeviceScript Language | DeviceScript + + + + + + + + +
+

DeviceScript Language

DeviceScript generally works just like TypeScript, unless the compiler tells you something is not supported.

The TypeScript sources are compiled to a bytecode +that is then executed on the DeviceScript runtime.

TypeScript subset

DeviceScript is a subset of TypeScript. +TypeScript itself follows semantics of ECMAScript also known as JavaScript (JS). +DeviceScript generally also follows JavaScript semantics, and the DeviceScript compiler +will give you an error if you're using an unsupported feature.

Otherwise, there are some semantic differences stemming from the limited +resources available to the DeviceScript runtime:

Below we list supported and unsupported language features.

Supported language features

  • variable declarations with let, const
  • functions with lexical scoping and recursion
  • top-level code in the file; hello world really is console.log("Hello world")
  • if ... else if ... else statements
  • while and do ... while loops
  • for(;;) loops
  • for ... of statements
  • for ... in statements (though they behave the same as for ... of Object.keys(...))
  • break/continue; also with labeled loops
  • switch statement (on numbers, strings, and arbitrary types - the last one isn't very useful)
  • debugger statement for breakpoints
  • conditional operator ? :; lazy boolean operators
  • all arithmetic operators (including bitwise operators)
  • strings (with a few common methods)
  • string templates (`x is ${x}`)
  • arrow functions () => ...; passing functions as values
  • classes with inheritance, instance fields, methods and constructors; new keyword
  • public/private annotations on constructor arguments (syntactic sugar to make them into fields); initializers for class fields
  • enumerations (enum)
  • generic classes, methods, and functions
  • typeof expression
  • binding with arrays or objects: let [a, b] = ...; let { x, y } = ...
  • exceptions (throw, try ... catch, try ... finally)
  • union or intersection types
  • delete statement
  • array literals [1, 2, 3], [1, ...x, ...y, 2]
  • object literals { foo: 1, bar: "two" }
  • shorthand properties ({a, b: 1} parsed as {a: a, b: 1})
  • computed property names ({[foo()]: 1, bar: 2})
  • spread and rest operators (in certain places)
  • file-based modules (import * from ..., import { foo } from ... etc)
  • array/object destructuring in parameters and definitions (not in assignments yet)
  • optional chaining (a?.b.c, foo.bar?.(), foo?.[1], etc)
  • nullish coalescing operator (width ?? 240)
  • static fields and methods in classes
  • JSX is supported (though experimental) if you feel like developing an MCU-React!

Unsupported language features

Things you may miss and we may implement:

  • support of enums as run-time arrays
  • initializer for static fields
  • method-like properties (get/set accessors)
  • tagged templates tag `text ${expression} more text` are limited to special compiler features +like buffer literals; regular templates are supported

Things that we are not very likely to implement due to the scope of the project +or other constraints (note that if you don't know what a given feature is, you're +unlikely to miss it):

  • yield expression and function*
  • with statement
  • eval
  • namespaces (we do support ES modules)
  • arguments keyword; .apply method (modern spread operator is supported)
  • marking properties as non-enumerable etc
  • == and != operators (other than == null/undefined); please use === and !==
+ + + + \ No newline at end of file diff --git a/language/async.html b/language/async.html new file mode 100644 index 00000000000..aa3e4fc2c70 --- /dev/null +++ b/language/async.html @@ -0,0 +1,27 @@ + + + + + +Async/await and promises | DeviceScript + + + + + + + + +
+

Async/await and promises

The main difference in semantics between DeviceScript and JavaScript is that DeviceScript programs run in multiple fibers (threads). +In practice, this behaves like JS with async/await but without an ability to manipulate promises directly +(that is fibers can only interleave at await points and at most one fiber runs at any given time).

The compiler enforces usage of await where needed. +The Promise<T> is still used just as in TypeScript, but it has no properties.

Technically, the interpreter implements fibers internally (they can be accessed through ds.Fiber class), +the await keyword is no-op and the Promise type has no runtime representation. +You can inspect the currently running fibers in the debugger +and stack traces are not cut at await points (both of which match programmers general (if not JS-specific) expectations).

You can use Function.start(...args: any[]) to start an async or sync function in a new fiber. +It will begin executing only after the current fiber hits an await (.start() itself is not async).

+ + + + \ No newline at end of file diff --git a/language/bytecode.html b/language/bytecode.html new file mode 100644 index 00000000000..dea3cd0a1d6 --- /dev/null +++ b/language/bytecode.html @@ -0,0 +1,36 @@ + + + + + +Bytecode | DeviceScript + + + + + + + + +
+

Bytecode

DeviceScript bytecode spec

This file documents bytecode format for DeviceScript. +A C header file +and a TypeScript file are generated from it. +Additional structures are defined in devs_format.h.

A DeviceScript bytecode file contains magic and version numbers followed by a number of binary sections +defining functions, various literals (floats, ASCII strings, Unicode strings, buffers), +Jacdac service specifications, and runtime configuration (configureHardware() and built-in servers).

Functions are sequences of opcodes defined below. +Opcodes are divided into expressions (with return type) which do not modify state, +and statements (no return type; ret_val() expression is used to retrive the logical +result of a last statement). +Many opcodes (both expressions and statements) can also throw an exception.

For a more highlevel description of runtime and bytecode, see Runtime implementation page.

Format Constants

img_version_major = 2
img_version_minor = 15
img_version_patch = 6
img_version = $version
magic0 = 0x53766544 // "DevS"
magic1 = 0xf1296e0a
num_img_sections = 10
fix_header_size = 32
section_header_size = 8
function_header_size = 16
ascii_header_size = 2
utf8_header_size = 4
utf8_table_shift = 4
binary_size_align = 32
max_stack_depth = 16
max_call_depth = 100
direct_const_op = 0x80
direct_const_offset = 16
first_multibyte_int = 0xf8
first_non_opcode = 0x10000
first_builtin_function = 50000
max_args_short_call = 8
service_spec_header_size = 16
service_spec_packet_size = 8
service_spec_field_size = 4
role_bits = 15

Ops

Control flow

call0(func) = 2                                   // CALL func()
call1(func, v0) = 3 // CALL func(v0)
call2(func, v0, v1) = 4 // CALL func(v0, v1)
call3(func, v0, v1, v2) = 5 // CALL func(v0, v1, v2)
call4(func, v0, v1, v2, v3) = 6 // CALL func(v0, v1, v2, v3)
call5(func, v0, v1, v2, v3, v4) = 7 // CALL func(v0, v1, v2, v3, v4)
call6(func, v0, v1, v2, v3, v4, v5) = 8 // CALL func(v0, v1, v2, v3, v4, v5)
call7(func, v0, v1, v2, v3, v4, v5, v6) = 9 // CALL func(v0, v1, v2, v3, v4, v5, v6)
call8(func, v0, v1, v2, v3, v4, v5, v6, v7) = 10 // CALL func(v0, v1, v2, v3, v4, v5, v6, v7)

Call a function with given number of parameters.

call_array(func, args) = 79                        // CALL func(...args)

Passes arguments to a function as an array. The array can be at most max_stack_depth - 1 elements long.

final return(value) = 12

final jmp(*jmpoffset) = 13 // JMP jmpoffset

jmp_z(*jmpoffset, x) = 14 // JMP jmpoffset IF NOT x

Jump if condition is false.

jmp_ret_val_z(*jmpoffset) = 78            // JMP jmpoffset IF ret_val is nullish

Used in compilation of ?..

try(*jmpoffset) = 80                // TRY jmpoffset

Start try-catch block - catch/finally handler is at the jmpoffset.

final end_try(*jmpoffset) = 81

Try block has to end with this. jmpoffset is for continuation code.

catch() = 82

Has to be the first opcode in the catch handler. Causes error elsewhere. +If value throw is JMP rethrows immediately.

finally() = 83

Has to be the first opcode in the finally handler. +Finally block should be followed by storing exception value in a local +and finish with re_throw of the exception. +retval set to null when block executed not due to an exception.

final throw(value) = 84

Throw an exception.

final re_throw(value) = 85

Throw an exception without setting the __stack__ field. +Does nothing if value is null.

final throw_jmp(*jmpoffset, level) = 86

Jump to given offset popping level try blocks, activating the finally blocks on the way.

debugger() = 87

Trigger breakpoint when debugger connected. No-op otherwise.

Variables

store_local(*local_idx, value) = 17      // local_idx := value

store_global(*global_idx, value) = 18 // global_idx := value

store_buffer(buffer, numfmt, offset, value) = 19

load_local(*local_idx): any = 21

load_global(*global_idx): any = 22

store_closure(*local_clo_idx, levels, value) = 73

load_closure(*local_clo_idx, levels): any = 74

make_closure(*func_idx): function = 75 // CLOSURE(func_idx)

store_ret_val(x) = 93 // ret_val := x

Field access

index(object, idx): any = 24              // object[idx]

Read named field or sequence member (depending on type of idx).

index_set(object, index, value) = 25         // object[index] := value

Write named field or sequence member (depending on type of idx).

index_delete(object, index) = 11              // delete object[index]

Remove a named field from an object.

builtin_field(*builtin_idx, obj): any = 26  // {swap}obj.builtin_idx

Shorthand to index(obj, static_builtin_string(builtin_idx))

ascii_field(*ascii_idx, obj): any = 27      // {swap}obj.ascii_idx

Shorthand to index(obj, static_ascii_string(ascii_idx))

utf8_field(*utf8_idx, obj): any = 28        // {swap}obj.utf8_idx

Shorthand to index(obj, static_utf8_string(utf8_idx))

fun math_field(*builtin_idx): any = 29      // Math.builtin_idx

fun ds_field(*builtin_idx): any = 30 // ds.builtin_idx

fun object_field(*builtin_idx): any = 16 // Object.builtin_idx

fun new(func): function = 88 // new func

fun bind(func, obj): function = 15 // func.bind(obj)

Objects

alloc_map() = 31

alloc_array(initial_size) = 32

alloc_buffer(size) = 33

Statics

fun static_spec_proto(*spec_idx): any = 34  // spec_idx.prototype

fun static_buffer(*buffer_idx): buffer = 35

fun static_builtin_string(*builtin_idx): string = 36

fun static_ascii_string(*ascii_idx): string = 37

fun static_utf8_string(*utf8_idx): string = 38

fun static_function(*func_idx): function = 39

fun static_spec(*spec_idx): any = 94

fun literal(*value): number = 40

fun literal_f64(*f64_idx): number = 41

fun builtin_object(*builtin_object): number = 1

Misc

removed_42() = 42

load_buffer(buffer, numfmt, offset): number = 43

ret_val(): any = 44

Return value of query register, call, etc.

fun typeof(object): number = 45

Returns Object_Type enum.

fun typeof_str(object): number = 76

Returns JS-compatible string.

fun undefined(): null = 46  // undefined

Returns undefined value.

fun null(): null = 90        // null

Returns null value.

fun is_undefined(x): bool = 47

Check if object is exactly undefined.

fun instance_of(obj, cls): bool = 89

Check if obj has cls.prototype in its prototype chain.

fun is_nullish(x): bool = 72

Check if value is precisely null or undefined.

Booleans

fun true(): bool = 48

fun false(): bool = 49

fun to_bool(x): bool = 50 // !!x

Math operations

fun nan(): number = 51

fun inf(): number = 20

fun abs(x): number = 52

fun bit_not(x): number = 53 // ~x

fun is_nan(x): bool = 54

fun neg(x): number = 55 // -x

fun uplus(x): number = 23 // +x

fun not(x): bool = 56 // !x

fun to_int(x): number = 57

Same as x | 0.

fun add(x, y): number = 58     // x + y

Note that this also works on strings, etc.

fun sub(x, y): number = 59     // x - y

fun mul(x, y): number = 60 // x * y

fun div(x, y): number = 61 // x / y

fun bit_and(x, y): number = 62 // x & y

fun bit_or(x, y): number = 63 // x | y

fun bit_xor(x, y): number = 64 // x ^ y

fun shift_left(x, y): number = 65 // x << y

fun shift_right(x, y): number = 66 // x >> y

fun shift_right_unsigned(x, y): number = 67 // x >>> y

fun eq(x, y): bool = 68 // x === y

fun le(x, y): bool = 69 // x <= y

fun lt(x, y): bool = 70 // x < y

fun ne(x, y): bool = 71 // x !== y

fun approx_eq(x, y): bool = 91 // x == y

fun approx_ne(x, y): bool = 92 // x != y

To be removed (soon)

removed_77() = 77

Enum: StrIdx

buffer = 0
builtin = 1
ascii = 2
utf8 = 3
_shift = 14

Enum: OpCall

sync = 0

Regular call. Unused.

bg = 1

Always start new fiber.

bg_max1 = 2

Start new fiber unless one is already running.

bg_max1_pend1 = 3

If fiber is already running, set a flag for it to be restarted when it finishes. +Otherwise, start new fiber.

bg_max1_replace = 4

Start new fiber. If it's already running, replace it.

Enum: BytecodeFlag

num_args_mask = 0xf
is_stmt = 0x10
takes_number = 0x20
is_stateless = 0x40 // fun modifier - only valid when !is_stmt
is_final_stmt = 0x40 // final modifier - only valid when is_stmt

Enum: FunctionFlag

needs_this = 0x01
is_ctor = 0x02
has_rest_arg = 0x04

Enum: NumFmt

Size in bits is: 8 << (fmt & 0b11). +Format is ["u", "i", "f", "reserved"](fmt >> 2)

U8 = 0b0000
U16 = 0b0001
U32 = 0b0010
U64 = 0b0011
I8 = 0b0100
I16 = 0b0101
I32 = 0b0110
I64 = 0b0111
F8 = 0b1000 // not supported
F16 = 0b1001 // not supported
F32 = 0b1010
F64 = 0b1011
Special = 0b1100

Enum: NumFmt_Special

empty = 0
bytes = 1
string = 2
string0 = 3
bool = 4
pipe = 5
pipe_port = 6

Enum: PacketSpec_Code

register = 0x1000
event = 0x8000
command = 0x0000
report = 0x2000
MASK = 0xf000

Enum: ServiceSpec_Flag

derive_mask = 0x000f
derive_base = 0x0000
derive_sensor = 0x0001
derive_last = 0x0001

Enum: PacketSpec_Flag

multi_field = 0x01

Enum: FieldSpec_Flag

is_bytes = 0x01
starts_repeats = 0x02

Enum: Object_Type

undefined = 0

Only the undefined value.

number = 1

Integers, doubles, infinity, nan.

map = 2

array = 3

buffer = 4

role = 5

bool = 6

Only true and false values.

fiber = 7

function = 8

string = 9

packet = 10

exotic = 11

null = 12

image = 13

Object_Types only used in static type info

any = 14

void = 15

Enum: BuiltIn_Object

Math = 0
Object = 1
Object_prototype = 2
Array = 3
Array_prototype = 4
Buffer = 5
Buffer_prototype = 6
String = 7
String_prototype = 8
Number = 9
Number_prototype = 10
DsFiber = 11
DsFiber_prototype = 12
DsRole = 13
DsRole_prototype = 14
Function = 15
Function_prototype = 16
Boolean = 17
Boolean_prototype = 18
DsPacket = 19
DsPacket_prototype = 20
DeviceScript = 21
DsPacketInfo_prototype = 22
DsRegister_prototype = 23
DsCommand_prototype = 24
DsEvent_prototype = 25
DsReport_prototype = 26
Error = 27
Error_prototype = 28
TypeError = 29
TypeError_prototype = 30
RangeError = 31
RangeError_prototype = 32
SyntaxError = 33
SyntaxError_prototype = 34
JSON = 35
DsServiceSpec = 36
DsServiceSpec_prototype = 37
DsPacketSpec = 38
DsPacketSpec_prototype = 39
Image = 40
Image_prototype = 41
GPIO = 42
GPIO_prototype = 43

Enum: BuiltIn_String

_empty = 0
MInfinity = 1 // -Infinity
DeviceScript = 2
E = 3
Infinity = 4
LN10 = 5
LN2 = 6
LOG10E = 7
LOG2E = 8
NaN = 9
PI = 10
SQRT1_2 = 11
SQRT2 = 12
abs = 13
alloc = 14
array = 15
blitAt = 16
boolean = 17
buffer = 18
cbrt = 19
ceil = 20
charCodeAt = 21
clamp = 22
exp = 23
false = 24
fillAt = 25
floor = 26
forEach = 27
function = 28
getAt = 29
idiv = 30
imul = 31
isBound = 32
join = 33
length = 34
log = 35
log10 = 36
log2 = 37
map = 38
max = 39
min = 40
next = 41
null = 42
number = 43
onChange = 44
onConnected = 45
onDisconnected = 46
packet = 47
_panic = 48
pop = 49
pow = 50
prev = 51
prototype = 52
push = 53
random = 54
randomInt = 55
read = 56
restart = 57
round = 58
setAt = 59
setLength = 60
shift = 61
signal = 62
slice = 63
splice = 64
sqrt = 65
string = 66
subscribe = 67
toString = 68
true = 69
undefined = 70
unshift = 71
wait = 72
write = 73

sleep = 74
imod = 75
format = 76
insert = 77
start = 78
cloud = 79
main = 80
charAt = 81
object = 82
parseInt = 83
parseFloat = 84
assign = 85
keys = 86
values = 87
__func__ = 88
role = 89
deviceIdentifier = 90
shortId = 91
serviceIndex = 92
serviceCommand = 93
payload = 94
decode = 95
encode = 96
_onPacket = 97
code = 98
name = 99
isEvent = 100
eventCode = 101
isRegSet = 102
isRegGet = 103
regCode = 104
flags = 105
isReport = 106
isCommand = 107
isArray = 108
inline = 109
assert = 110
pushRange = 111
sendCommand = 112
__stack__ = 113
Error = 114
TypeError = 115
RangeError = 116
stack = 117
message = 118
cause = 119
__new__ = 120
setPrototypeOf = 121
getPrototypeOf = 122
constructor = 123
__proto__ = 124
_logRepr = 125
print = 126
everyMs = 127
setInterval = 128
setTimeout = 129
clearInterval = 130
clearTimeout = 131
SyntaxError = 132
JSON = 133
parse = 134
stringify = 135
_dcfgString = 136
isSimulator = 137
_Role = 138 // Role
Fiber = 139
suspend = 140
resume = 141
terminate = 142
self = 143
current = 144
id = 145
_commandResponse = 146
isAction = 147
millis = 148
from = 149
hex = 150
utf8 = 151
utf_8 = 152 // utf-8
suspended = 153
reboot = 154
server = 155
spec = 156
ServiceSpec = 157
classIdentifier = 158
lookup = 159
PacketSpec = 160
parent = 161
response = 162
ServerInterface = 163
_onServerPacket = 164
_serverSend = 165
notImplemented = 166
delay = 167
fromCharCode = 168
_allocRole = 169
spiConfigure = 170
spiXfer = 171
_socketOpen = 172
_socketClose = 173
_socketWrite = 174
_socketOnEvent = 175
open = 176
close = 177
error_ = 178 // error
data = 179
toUpperCase = 180
toLowerCase = 181
indexOf = 182
byteLength = 183
Image = 184
width = 185
height = 186
bpp = 187
get = 188
clone = 189
set = 190
fill = 191
flipX = 192
flipY = 193
transposed = 194
drawImage = 195
drawTransparentImage = 196
overlapsWith = 197
fillRect = 198
drawLine = 199
equals = 200
isReadOnly = 201
fillCircle = 202
blitRow = 203
blit = 204
_i2cTransaction = 205
_twinMessage = 206
spiSendImage = 207
gpio = 208
label = 209
mode = 210
capabilities = 211
value = 212
setMode = 213
fillRandom = 214
encrypt = 215
decrypt = 216
digest = 217
ledStripSend = 218
rotate = 219
register = 220
event = 221
action = 222
report = 223
type = 224
byCode = 225
+ + + + \ No newline at end of file diff --git a/language/devicescript-vs-javascript.html b/language/devicescript-vs-javascript.html new file mode 100644 index 00000000000..07d7bededab --- /dev/null +++ b/language/devicescript-vs-javascript.html @@ -0,0 +1,23 @@ + + + + + +Other differences with JavaScript | DeviceScript + + + + + + + + +
+

Other differences with JavaScript

This document lists differences in semantics between DeviceScript and EcmaScript/JavaScript/TypeScript +(referred to as JS in this document).

Subnormals

DeviceScript doesn't support subnormals, that is numbers is range around -5e-324 to 5e-324 are rounded to zero +(it follows that negative zero is not supported). +Subnormals are not required by the JS specs.

+ + + + \ No newline at end of file diff --git a/language/hex.html b/language/hex.html new file mode 100644 index 00000000000..8949af94dfc --- /dev/null +++ b/language/hex.html @@ -0,0 +1,21 @@ + + + + + +Hex template literal | DeviceScript + + + + + + + + +
+

Hex template literal

The hex template literal is a builtin template literal that can be used to create a Buffer from a hex string. +The buffer is stored in flash.

const buf: Buffer = hex`00 ab 12 2f 00`

Comments and whitespace are allowed in hex literals:

const commentedData: Buffer = hex`
01 02 03 // first three numbers
ff aa // two more bytes
`
+ + + + \ No newline at end of file diff --git a/language/runtime.html b/language/runtime.html new file mode 100644 index 00000000000..e99b4cb19e7 --- /dev/null +++ b/language/runtime.html @@ -0,0 +1,73 @@ + + + + + +Runtime implementation | DeviceScript + + + + + + + + +
+

Runtime implementation

DeviceScript compiler takes TypeScript files and generates bytecode files, which are then executed by +the DeviceScript runtime. +The bytecode files are designed to be small (about half the size of source code) +and executable directly from storage (typically flash memory), with minimal overhead in RAM.

For technical specification of bytecode files see Bytecode format page +and the example below.

Memory requirements

A DeviceScript build for Raspberry Pi Pico (not W) takes about 200kB of flash. +Of that, 134kB is taken by DeviceScript (and Jacdac) library and the rest by system libraries. +A build for STM32L4+ takes 153kB of flash, of which 115kB if taken by DeviceScript +(this likely due to different compiler settings). +Builds for ESP32 are around 1.2MB due to various libraries, mostly related to networking and TLS.

These numbers do not include bytecode size for user program.

RAM usage can be configured via JD_GC_KB. This defaults to 64kB but it's often possible +to run with 32kB or less when not doing web requests. +Additionally, the following subsystems take some RAM:

  • DeviceScript context - 2kB
  • DeviceScript logging (DMESG()) - 4kB
  • Jacdac packet queues - 5kB

Note that networking typically takes significant amounts of RAM, especially when using TLS.

Why not Web Assembly (Wasm)?

While the DeviceScript runtime itself can be compiled to Wasm, the bytecode format that the TypeScript +is compiled to is quite different.

Wasm files have a tree structure of unlimited depth, designed for fast JIT compilation, not in-place interpreters. +Thus, executing Wasm from a read-only memory incurs significant overhead in working memory, +even with state of the art approaches. +Typically, on an embedded system you have ~5x-20x the flash memory (which is quite slow to write) compared to RAM.

Additionally, Wasm is a low-level bytecode, for example i32.add takes two 32-bit integers and adds them up. +For JavaScript semantics, you want the + operator to work on doubles, strings, and integers (if represented differently than doubles).

NaN-boxing

The DeviceScript runtime uses NaN-boxing +on both 64- and 32-bit architectures. +That is all JavaScript values are represented as 64-bit doubles, +but various NaN and subnormal encodings have special meaning:

  • all 32-bit signed integers are represented in low word (mantissa), +when the high word (sign, exponent, and high bits of mantissa) is set to 0xffff_ffff +(this is a subset of NaNs)
  • various special values (undefined, null, NaN, true, false, Infinity, -Infinity) +are represented as subnormals
  • pointers to heap objects are also represented as subnormals; +on 64-bit machines pointers are assumed to live within GC heap, which is assumed to be under 4GB
  • references to bytecode objects (strings, buffers, service specifcations, functions, ...) +are subnormal too
  • finally, functions (which are 16 bit indices) can be bound to other objects and still fit in a subnormal; +that is, x.foo where .foo is a function is represented as heap reference to x and index of .foo function +in bytecode, all packed into a 64-bit value

String representation

All strings are represented as valid UTF8 (which is a slight departure from JavaScript semantics). +This makes it easy to send them over wire and also saves memory when strings only use +ASCII characters (which is often the case even in international code-bases due to field/function names). +There are two representations:

  • short ASCII strings are represented simply as NUL-terminated byte sequences in bytecode - when .length is requested - it's recomputed
  • longer and non-ASCII strings are represented as structures with byte size, character length and jump list to speed up indexing; +the jump list has byte index of every 16-th character index

GC

Garbage collector in DeviceScript is quite simple, yet efficient. +Collection can happen on any allocation, and is forced after a fixed size of allocations has been reached since +last collection, or when the allocation cannot be performed. +Allocation always prefers returning smaller addresses, which tends to reduce fragmentation +(this is also the reason why we force collection more often than necessary).

The collection is quick, since the heap size compared to CPU speed is very small. +Typical embedded system is 10x-100x slower than a desktop CPU, but has 100,000x-1,000,000x less RAM, +thus scanning the whole heap takes on the order of a single millisecond.

Bytecode example

Let's take a look at how a simple example is compiled:

function add(x: any, y: any) {
return x + y
}
function assertEq(x: any, y: any) {
if (x !== y) throw new Error(`Not eq: ${x} != ${y}!`)
}
assertEq(add(2, 2.1), 4.1)
assertEq(add("2", 2), "22")

We compile it with devs build and then can disassemble it with devs disasm +(or devs disasm --detailed; you can also pass a .devs or -dbg.json file to disasm). +The disassembly results in the following output:

proc main_F0(): @176

The first procedure in bytecode file is an entry point. +Here, it sits at byte offset 176 in the bytecode file.

   0:     CALL prototype_F1{F1}() // 270102

The three bytes 0x27, 0x01, 0x02 encode state +"function reference", "function number 1", "call 0-arguments".

   3:     CALL add_F3{F3}(2, 2.1{D0}) // 270392290004

Here the opcodes say "function reference", "function 3", +"constant 0x92 - 0x90 == 2", "double reference", +"double number 0", "call 2-arguments". +The number 3: in front refers to byte offset within a function.

   9:     CALL assertEq_F2{F2}(ret_val(), 4.1{D1}) // 27022c290104

Here, we have ret_val() opcode refering to the result of previous +call - calls are statements so they cannot be nested.

  15:     CALL add_F3{F3}("2"{A3}, 2) // 270325039204

The new thing here is ASCII string reference (see table of strings and doubles at the bottom of the file).

  21:     CALL assertEq_F2{F2}(ret_val(), "22"{A4}) // 27022c250404
27: CALL ds."restart"{I57}() // 1e3902
30: RETURN 0 // 900c

The compiler adds call to ds.restart() in test-mode compilation. +Note that there is special opcode for members of @devicescript/core +module that are referenced by built-in strings ("internal string 57"); +thus ds.restart() is only 3 bytes. +The final RETURN is superfluous.

proc prototype_F1(): @208
0: RETURN undefined // 2e0c

The prototype_Fx() function would have assignment of methods +to prototypes if there were any. +Also undefined has it's own opcode.

proc assertEq_F2(par0, par1): @212
0: JMP 25 IF NOT (par0{L0} !== par1{L1}) // 15001501470ef90014

Here we jump to offset 25 if the condition is not true. +The condition refers to "local variable 0" and "1" +(which happen to be parameters).

   9:     CALL ds."format"{I76}("Not eq: {0} != {1}!"{A1}, par0{L0}, par1{L1}) // 1e4c25011500150105

The template literals are compiled to ds.format() calls.

  18:     CALL (new Error{O27})(ret_val()) // 011b582c03

Here, the new opcode takes a reference to "built-in object 27" (Error).

  23:     THROW ret_val() // 2c54
25: RETURN undefined // 2e0c

proc add_F3(par0, par1): @240
0: RETURN (par0{L0} + par1{L1}) // 150015013a0c

Note how the + opcode can be used on both strings and numbers.

Strings ASCII:
0: "assertEq"
1: "Not eq: {0} != {1}!"
2: "add"
3: "2"
4: "22"
5: "assertEq"

Strings UTF8:

Strings buffer:

Doubles:
0: 2.1
1: 4.1

The file finishes with tables of various literals. +The short ASCII literals are separate from UTF8 literals, which have a more +complex representation.

+ + + + \ No newline at end of file diff --git a/language/special.html b/language/special.html new file mode 100644 index 00000000000..13e4d732b66 --- /dev/null +++ b/language/special.html @@ -0,0 +1,23 @@ + + + + + +Special objects | DeviceScript + + + + + + + + +
+

Special objects

To save RAM certain objects are treated specially by the runtime, +and as a consequence you cannot attach arbitrary properties to them, manipulate their prototypes freely, etc.

  • functions (built-in, top-level, nested (closures))
  • static buffers created with the hex template literals (eg., hex `00 11 22`)
  • strings and numbers ("".myProp === undefined as expected, +but "".myProp = val throws instead of being ignored as in JS)
  • ds.Fiber
  • ds.Register, ds.Event - members of ds.Role

It is OK to add properties to arrays ([].myProp = 1), dynamically allocated buffers, +and of course regular objects and class instances.

The prototype manipulation is limited also for arrays and buffers.

+ + + + \ No newline at end of file diff --git a/language/strings.html b/language/strings.html new file mode 100644 index 00000000000..f7b629772ea --- /dev/null +++ b/language/strings.html @@ -0,0 +1,30 @@ + + + + + +Strings and Unicode | DeviceScript + + + + + + + + +
+

Strings and Unicode

ECMAScript spec requires String.charCodeAt() to return a 16-bit value. +Unicode code points outside of 16-bit (mostly emoticons, but also some historical alphabets, +and rare Chinese/Japanese/Korean ideograms) are represented as surrogate pairs of two 16-bit code units. +The String.length returns the number of UTF-16 code units in the string.

If ES was designed today they would probably return up to 21-bit values from charCodeAt(), +or possibly use yet another abstraction since even with full 21-bit Unicode, +several code points can still combine into a single glyph (character displayed on the screen).

In DeviceScript, +the method String.charCodeAt() returns Unicode code point (up to 21 bits), not UTF-16 character. +Similarly, String.length will return the number of 21-bit code points. +Thus, "🗽".length === 1 and "🗽".charCodeAt(0) === 0x1f5fd, +and also "\uD83D\uDDFD".length === 1 since "\uD83D\uDDFD" === "🗽" which may be confusing.

Also string construction by concatnation quadratic, +however you can use String.join() which is linear in the size of output.

See also discussion.

+ + + + \ No newline at end of file diff --git a/language/tostring.html b/language/tostring.html new file mode 100644 index 00000000000..50a2dd83e73 --- /dev/null +++ b/language/tostring.html @@ -0,0 +1,28 @@ + + + + + +toString() method | DeviceScript + + + + + + + + +
+

toString() method

ECMAScript spec requires converting values to string, deep in the internals of the runtime +(in particular, in a + b, a[b], a == b, etc.). +It also mandates that these conversions use the .toString() method if provided on the object +by the user.

These are complex to implement in very limited stack space available on embedded devices. +Consider the following: .toString() triggers code execution with +say property indexing, which triggers another .toString(), etc. +See issue.

To alleviate this problem, the built-in string conversion for objects in DeviceScript +is similar to util.inspect() in node.js - it will show a limited number of object fields. +For example:

const o = { x: 1, y: ["foo", 2] }
console.log("o=", o)
console.log("o=" + o)
console.log(`o=${o}`)
Output
o={x:1,y:["foo",2]}
o={x:1,y:["foo",2]}
o={x:1,y:["foo",2]}
+ + + + \ No newline at end of file diff --git a/language/tree-shaking.html b/language/tree-shaking.html new file mode 100644 index 00000000000..76f708cbe6b --- /dev/null +++ b/language/tree-shaking.html @@ -0,0 +1,25 @@ + + + + + +Tree-shaking | DeviceScript + + + + + + + + +
+

Tree-shaking

Classes and/or methods in classes can be marked with @devsWhenUsed JSDoc attribute. +This will cause them to be omitted from compilation unless they are used. +In such case, care needs to be taken when using index operator (obj[some_expression]) +or accessing properties through any type. +You can use ds.keep() function to make sure methods are included.

/**
* Foooooo!
*
* @devsWhenUsed
*/
class Foo {
bar() {}
}
function callBar(v: any) {
v["bar"]()
}
callBar(new Foo())

// can be called anywhere from the reachable code
ds.keep(Foo.prototype.bar)

The @devsWhenUsed attribute is implicit when methods are defined through +prototype assignments.

We may improve compiler warnings about such cases in future.

See discussion.

+ + + + \ No newline at end of file diff --git a/opensearch.xml b/opensearch.xml new file mode 100644 index 00000000000..3d1144cdd75 --- /dev/null +++ b/opensearch.xml @@ -0,0 +1,11 @@ + + + DeviceScript + Search DeviceScript + UTF-8 + https://microsoft.github.io/devicescript/img/favicon.svg + + + https://microsoft.github.io/devicescript/ + \ No newline at end of file diff --git a/samples.html b/samples.html new file mode 100644 index 00000000000..f275ff0720a --- /dev/null +++ b/samples.html @@ -0,0 +1,20 @@ + + + + + +Samples | DeviceScript + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/blinky.html b/samples/blinky.html new file mode 100644 index 00000000000..e8ec5059418 --- /dev/null +++ b/samples/blinky.html @@ -0,0 +1,21 @@ + + + + + +Blinky | DeviceScript + + + + + + + + +
+

Blinky

The classic LED blinking program on a Raspberry Pi Pico. The LED is connected to the Pico's pin GP1 (2 on the silk)

import { pins } from "@dsboard/pico"
import { startLightBulb } from "@devicescript/servers"

// start a lightbulb server on pin GP1
// and store client in `led` variable
const led = startLightBulb({
pin: pins.GP1,
})

// start interval timer every 1000ms
setInterval(async () => {
// read current brightness
const brightness = await led.intensity.read()
// toggle on/off
const newbrightness = brightness > 0 ? 0 : 1
// apply new brightness
await led.intensity.write(newbrightness)
}, 1000)

ESP32

The classic LED blinking program on a ESP32 +is similar. The LED is connected to the pin A0.

import { pins } from "@dsboard/adafruit_qt_py_c3"
import { startLightBulb } from "@devicescript/servers"

const lightBulb = startLightBulb({
pin: pins.A0_D0,
})

setInterval(async () => {
await lightBulb.toggle()
}, 500)
+ + + + \ No newline at end of file diff --git a/samples/button-led.html b/samples/button-led.html new file mode 100644 index 00000000000..2ececb0ca21 --- /dev/null +++ b/samples/button-led.html @@ -0,0 +1,20 @@ + + + + + +Button LED | DeviceScript + + + + + + + + +
+

Button LED

This sample toggles a LED on/off by listening on the down events emitted by a button.

import { pins } from "@dsboard/esp32c3_bare"
import { startLightBulb, startButton } from "@devicescript/servers"

const led = startLightBulb({
pin: pins.P2,
})
const button = startButton({
pin: pins.P5,
})
console.log(`press button to toggle light`)
// listen for button down events
button.down.subscribe(async () => {
// toggle light on/off
console.log(`toggle`)
await led.toggle()
})
+ + + + \ No newline at end of file diff --git a/samples/copy-paste-button.html b/samples/copy-paste-button.html new file mode 100644 index 00000000000..cbb6a0718eb --- /dev/null +++ b/samples/copy-paste-button.html @@ -0,0 +1,22 @@ + + + + + +Copy Paste Button | DeviceScript + + + + + + + + +
+

Copy Paste Button

In this example, we use a single button to create a copy-paste micro-keyboard +on Raspberry Pi Pico.

  • The button is connected to the Pico's GP14 pin. When the button is pressed, the Pico will send a ctrl+c or ctrl+v keystroke to the computer using a HID keyboard server. +The ctrl+c keystroke will copy the selected text, and the ctrl+v keystroke will paste the copied text.
  • The status of the clipboard is indicated by a status LED connected to the Pico's GP1 pin. When the LED is on, the clipboard is full, and when the LED is off, the clipboard is empty.
note

On MacOS, we use LeftGUI. To update for Windows, replace LeftGuid with LeftControl.

import { pins, board } from "@dsboard/pico"
import {
startButton,
startHidKeyboard,
startLightBulb,
} from "@devicescript/servers"
import {
HidKeyboardAction,
HidKeyboardModifiers,
HidKeyboardSelector,
} from "@devicescript/core"

// the keyboard button mounted on GP14
const button = startButton({
pin: pins.GP14,
})
// a status indicator led mounted on GP1
const led = startLightBulb({
pin: pins.GP1,
})
// the HID keyboard driver that will send keystrokes
const keyboard = startHidKeyboard({})

// true: ctrl+c, false: ctrl+v
let copy = true
// use leftgui on mac or leftcontrol on windows
let modifier = HidKeyboardModifiers.LeftGUI
// uncomment for windows
// let modifier = HidKeyboardModifiers.LeftControl

// copy and paste on button click
button.down.subscribe(async () => {
// when copy is true, send ctrl+c
const selector = copy ? HidKeyboardSelector.C : HidKeyboardSelector.V
// when copy is true, turn on the led to represent a "full clipboard"
const brightness = copy ? 1 : 0

// a bit of logging
console.log(copy ? "ctrl+c" : "ctrl+v")
await keyboard.key(selector, modifier, HidKeyboardAction.Press)
await led.intensity.write(brightness)
// toggle for next round
copy = !copy
})
+ + + + \ No newline at end of file diff --git a/samples/dimmer.html b/samples/dimmer.html new file mode 100644 index 00000000000..62722efa3f9 --- /dev/null +++ b/samples/dimmer.html @@ -0,0 +1,21 @@ + + + + + +Dimmer | DeviceScript + + + + + + + + +
+

Dimmer

A potentiometer (slider or rotary) is used to control the brightness (intensity register) +of a light bulb. This example uses a Raspberry Pi pico but could be redone using other devices.

import { pins } from "@dsboard/pico"
import { startLightBulb, startPotentiometer } from "@devicescript/servers"

// starting a potentiometer driver on GP26
// pinout https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#pinout-and-design-files
const slider = startPotentiometer({
pin: pins.GP26,
})
// starting a dimmieable light on pin GP2
const led = startLightBulb({
pin: pins.GP7,
dimmable: true,
})

// subscribing to the slider readings and sending them to the intensity register
slider.reading.subscribe(async level => {
await led.intensity.write(level)
})
+ + + + \ No newline at end of file diff --git a/samples/double-blinky.html b/samples/double-blinky.html new file mode 100644 index 00000000000..3a6e908c4df --- /dev/null +++ b/samples/double-blinky.html @@ -0,0 +1,22 @@ + + + + + +Double Blinky | DeviceScript + + + + + + + + +
+

Double Blinky

This example shows how to blink two LEDs at a different rate. +You can use multiple setInterval to schedule different tasks, +in this case toggling the LED status.

import { pins } from "@dsboard/esp32c3_bare"
import { startLightBulb } from "@devicescript/servers"

// start a lightbulb drivers on pin GP1 and GP2
const led1 = startLightBulb({
pin: pins.P1,
})
const led2 = startLightBulb({
pin: pins.P2,
})

// start interval timer every 1000ms
setInterval(async () => {
// toggle on/off
await led1.toggle()
}, 1000)

// start interval timer every 250ms
setInterval(async () => {
// toggle on/off
await led2.toggle()
}, 250)
+ + + + \ No newline at end of file diff --git a/samples/github-build-status.html b/samples/github-build-status.html new file mode 100644 index 00000000000..ad218f4b72f --- /dev/null +++ b/samples/github-build-status.html @@ -0,0 +1,27 @@ + + + + + +GitHub Build Status | DeviceScript + + + + + + + + +
+

GitHub Build Status

In this sample, we will query the GitHub API to get the status of the latest build of a repository. The status will be used to update the status light.

Prerequisites

  • Device with WiFi connectivity (ESP32 only currently)
  • GitHub account and repository

Getting the build status

The GitHub commit API allows to query the +combined status of a reference. +We can use this API to get the status of a branch in the repository.

curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/commits/REF/status

Settings and secrets

To make the request to GitHub, you need a few configuration strings and one secret. Instead of storing those in source code, +we use the builtin settings.

Public configuration settings are stored in the ./env.defaults file. This file is part of the source code and can be committed to a repository.

./env.defaults
GITHUB_OWNER=microsoft
GITHUB_REPO=devicescript
# defaults to main
# GITHUB_REF=master

For private repositories, you will need a token to access the API. +Secrets are stored in the ./env.local file. This file is not part of the source code and should not be committed to a repository. +The GitHub token needs repo:status scope (and no more). You can create a token in the GitHub settings.

./env.local
GITHUB_TOKEN=...

In the code, we use the readSettings function to read the settings and secrets.

./src/index.ts
import { readSetting } from "@devicescript/settings"

// read configuration from ./env.defaults
const owner = await readSetting("GITHUB_OWNER")
const repo = await readSetting("GITHUB_REPO")
// read ref or default to 'main'
const ref = await readSetting("GITHUB_REF", "main")
// read secret from ./env.local
const token = await readSetting("GITHUB_TOKEN", "")

console.log({ owner, repo, ref })

Using fetch

We combine the settings and secrets to create the URL to query the GitHub API. We use the fetch function from the +@devicescript/net package to make the request. Fetch is similar to the Fetch API.

import { fetch } from "@devicescript/net"

...

const res = await fetch(
`https://api.github.com/repos/${owner}/${repo}/commits/${ref}/status`,
{
headers: {
Accept: "application/vnd.github+json",
Authorization: token ? `Bearer ${token}` : undefined,
"X-GitHub-Api-Version": "2022-11-28",
},
}
)

console.log({ res })
tip

Microcontrollers are memory constrained and you should always try to minimize the amount of data you send and receive. +The GraphQL API from GitHub would allow you to create more targetted queries with smaller result payloads.

Parsing the response

Handle the fetch response you like any other response. In this case, we parse the JSON response and log the status.

if (res.status === 200) {
const json = await res.json()
const state: "failure" | "pending" | "success" = json.state
console.log({ json, state })
}

Updating the status light

Based on the last state, we'll create some LED animation on the status light:

  • failure: blinking fast red (2x per second)
  • pending: blinking slow orange (1x per second)
  • success: solid green
import { setStatusLight } from "@devicescript/runtime"

let state: "failure" | "pending" | "success" = ...
let blinki = 0

setInterval(async () => {
blinki++;
let c = 0x000000
if (state === "failure")
c = blinki % 2 === 0 ? 0x100000 : 0x000000 // blink fast red
else if (state === "pending")
c = (blinki >> 1) % 2 === 0 ? 0x100500 : 0x000000 // blink slow orange
else if (state === "success") c = 0x000a00 // solid green
else c = 0x000000 // dark if any error
await setStatusLight(c)
}, 500)

Putting it all together

import { readSetting } from "@devicescript/settings"
import { fetch } from "@devicescript/net"
import { schedule, setStatusLight } from "@devicescript/runtime"

// read configuration from ./env.defaults
const owner = await readSetting("GITHUB_OWNER")
const repo = await readSetting("GITHUB_REPO")
// read ref or default to 'main'
const ref = await readSetting("GITHUB_REF", "main")
// read secret from ./env.local
const token = await readSetting("GITHUB_TOKEN", "")

if (!owner || !repo) throw new Error("missing configuration")

// track state of last fetch
let state: "failure" | "pending" | "success" | "error" | "" = ""
let blinki = 0

// update status light
setInterval(async () => {
blinki++
let c = 0x000000
if (state === "failure")
c = blinki % 2 === 0 ? 0x100000 : 0x000000 // blink fast red
else if (state === "pending")
c = (blinki >> 1) % 2 === 0 ? 0x100500 : 0x000000 // blink slow orange
else if (state === "success") c = 0x000a00 // solid green
else c = 0x000000 // dark if any error
await setStatusLight(c)
}, 500)

schedule(
async () => {
const res = await fetch(
`https://api.github.com/repos/${owner}/${repo}/commits/${ref}/status`,
{
headers: {
Accept: "application/vnd.github+json",
Authorization: token ? `Bearer ${token}` : undefined,
"X-GitHub-Api-Version": "2022-11-28",
},
}
)
if (res.status === 200) {
const json = await res.json()
state = json.state
console.log({ json, state })
} else state = "error"
},
{ timeout: 1000, interval: 60000 }
)
+ + + + \ No newline at end of file diff --git a/samples/homebridge-humidity.html b/samples/homebridge-humidity.html new file mode 100644 index 00000000000..319be0b43f7 --- /dev/null +++ b/samples/homebridge-humidity.html @@ -0,0 +1,22 @@ + + + + + +Homebridge + Humidity Sensor | DeviceScript + + + + + + + + +
+

Homebridge + Humidity Sensor

In this sample, we will use HomeBridge to integrate our device with Apple HomeKit. As an example, we will expose a humidity sensor to HomeKit.

HomeBridge allows you to integrate with smart home devices that do not natively support HomeKit. +Using the HomeBridge MQTTThing plugin, you can integrate your MQTT Things with HomeKit. +The DeviceScript Gateway can be configured to route cloud messages to a MQTT server which can then be used by HomeBridge.

MQTT server configuration

You will need the URL, port and optionaly username, password to configure the gateway.

Device Gateway configuration

  • Clone or create a DeviceScript Gateway (by starting a GitHub Codespace for example)
  • Configure it to route the messages to the MQTT server
  • Start the development server. If you are using GitHub Codespaces, make sure to change the visibility of the port to Public in the Ports pane.
  • Copy the connection string that is printed in the terminal output and enter it in the DeviceScript Gateway pane in Visual Studio Code. You should get a confirmation that the gateway is connected.

HomeBridge configuration

  • Install HomeBridge
  • Open the plugins pane and install the HomeBridge MQTTThing plugin plugin
  • Click on SETTINGS for the MQTTThing plugin and add a Humidity Sensor accessory
  • Configure the MQTT settings to connect to the MQTT server
  • Scroll down to the MQTT topics and set the get Humidity topic to humidity

Programming with simulators

We can start programming with devicescript by using the simulator. The simulator allows you to test your code without having to deploy it to a physical device.

  • Create a new DeviceScript project using the DeviceScript: New Project command
  • Open main.ts and add the following code and click the Run icon on the file menu.
import { Humidity } from "@devicescript/core"
import { throttleTime } from "@devicescript/observables"

const sensor = new Humidity()
sensor.reading.pipe(throttleTime(5000)).subscribe(humidity => {
console.data({ humidity })
})

Once the simulator is running and you start the humidity sensor simulator, you should see the humidity readings in the console.

  • Open the DeviceScript Gateway pane
  • Click on the + near devices to register the simulator

Update the program to publish the humidity readings to the cloud.

import { Humidity } from "@devicescript/core"
import { throttleTime } from "@devicescript/observables"
import { publishMessage } from "@devicescript/cloud"

const sensor = new Humidity()
sensor.reading.pipe(throttleTime(5000)).subscribe(async humidity => {
console.data({ humidity })
await publishMessage("/humidity", { humidity })
})
tip

Notice that the topic starts with /. By default DeviceScript routes topics to devs/{deviceid}/from/{topic}. Starting the topic with / disables this mode.

  • open HomeBridge and you should see the humidity being updated from the values on the sensor. Try to move the slider on the humidity sensor simulator to verify that the values are updated.

Programming hardware

  • Click the plug icon and connect your device
  • Click on the magic wand icon on the file menu and select your hardware device. Then add the code to connect to the startSHTC3.
import { Humidity } from "@devicescript/core"
import { throttleTime } from "@devicescript/observables"
import { publishMessage } from "@devicescript/cloud"
import { startSHTC3 } from "@devicescript/drivers"

const { humidity: sensor } = await startSHTC3()

sensor.reading.pipe(throttleTime(5000)).subscribe(async humidity => {
console.data({ humidity })
await publishMessage("/humidity", { humidity })
})
  • Click the play button to deploy the script to your board and test it.

Managing the device with the Gateway

The last step is to upload the script to the gateway and assign this script to the device. The gateway will automatically deploy the script to the device.

In the Device Gateway view,

  • Click + next to script and add your script
  • Click script icon near the device and assign the script you've just uploaded

Next steps

  • If you want to continue iterating locally, make sure to clear the script assigned to your device (the extension will remind).
  • If you upload a new version of the script, make sure to update the assigned script on the device too.
+ + + + \ No newline at end of file diff --git a/samples/schedule-blinky.html b/samples/schedule-blinky.html new file mode 100644 index 00000000000..bed24114db6 --- /dev/null +++ b/samples/schedule-blinky.html @@ -0,0 +1,20 @@ + + + + + +Schedule Blinky | DeviceScript + + + + + + + + +
+

Schedule Blinky

This sample blinks the onboard LED using the schedule

import { schedule, setStatusLight } from "@devicescript/runtime"

// counter increments on every invocation
schedule(
async ({ counter, elapsed, delta }) => {
console.data({ counter })
// toggle between red and off
await setStatusLight(counter % 2 === 0 ? 0xff0000 : 0x000000)
},
{
// first delay
timeout: 100,
// repeated delay
interval: 1000,
}
)
+ + + + \ No newline at end of file diff --git a/samples/status-light-blinky.html b/samples/status-light-blinky.html new file mode 100644 index 00000000000..e02240b909b --- /dev/null +++ b/samples/status-light-blinky.html @@ -0,0 +1,23 @@ + + + + + +Status Light Blinky | DeviceScript + + + + + + + + +
+

Status Light Blinky

Many boards have integrated status LED that can be controlled using the setStatusLight function.

It's important to remember that the status LED is also used by DeviceScript to +indicate the status of the runtime, like a short red blink every half second. +So your color will get overriden by the system colors. +Therefore, keep your blinks short.

import { delay } from "@devicescript/core"
import { setStatusLight } from "@devicescript/runtime"

setInterval(async () => {
// red
await setStatusLight(0x100000)
// wait 0.5s
await delay(400)
// blue
await setStatusLight(0x000010)
// wait 0.5s
await delay(400)
}, 1)
+ + + + \ No newline at end of file diff --git a/samples/temperature-mqtt.html b/samples/temperature-mqtt.html new file mode 100644 index 00000000000..8e54466c671 --- /dev/null +++ b/samples/temperature-mqtt.html @@ -0,0 +1,30 @@ + + + + + +Temperature + MQTT | DeviceScript + + + + + + + + +
+

Temperature + MQTT

This sample uses an ESP32-C3 board Adafruit QT Py C3 +and a SHTC3 sensor to publish a temperature reading to +the Adafruit.io MQTT APIs every minute.

A photograph of the Adafruit QT Py and SHTC3 breakout

Reading temperature

We start by configuring the script for the QT Py and adding a scheduled interval to read the temperature +from the SHTC3 sensor every 60 seconds.

// hardware configuration and drivers
import "@dsboard/adafruit_qt_py_c3"
import { startSHTC3 } from "@devicescript/drivers"
import { schedule } from "@devicescript/runtime"

// mounting a temperature server for the SHTC3 sensor
const { temperature } = await startSHTC3()

schedule(
async () => {
// read data from temperature sensor
const value = await temperature.reading.read()
},
{ timeout: 1000, interval: 60000 }
)

Configuration and Secrets

To connect to Adafruit.io, you will to get an account with https://io.adafruit.com +and store your username and password in the settings +as the IO_USERNAME and IO_KEY keys (make sure your key is in env.local). +Also create a feed and update the feed key in the example below.

import { readSetting } from "@devicescript/settings"

// TODO: update feed key
const feed = "temperature"
const username = await readSetting("IO_USERNAME")
// this secret is stored in the .env.local and uploaded to the device settings
const password = await readSetting("IO_KEY")

Starting the MQTT client

Following the Adafruit documentation, +we start a MQTT connection and craft a topic that will route the data to our account.

In the

import { startMQTTClient } from "@devicescript/net"

...

const mqtt = await startMQTTClient({
host: `io.adafruit.com`,
proto: "tls",
port: 8883,
username,
password,
})
const topic = `${username}/feeds/${feed}/json`

Publish data

With the MQTT client and the topic, we can add a call to mqtt.publish in the scheduled worker +to upload the data to Adafruit (note that { value } expands to JSON { "value": value } automatically)

schedule(
async () => {
...
// publish data to Adafruit
await mqtt.publish(topic, { value })
},
{ timeout: 1000, interval: 60000 }
)

All together

Putting all the pieces together we get the following program.

// hardware configuration and drivers
import "@dsboard/adafruit_qt_py_c3"
import { startSHTC3 } from "@devicescript/drivers"
import { startMQTTClient } from "@devicescript/net"
// extra APIs
import { readSetting } from "@devicescript/settings"
import { schedule } from "@devicescript/runtime"

// mounting a temperature server for the SHTC3 sensor
const { temperature } = await startSHTC3()

// update feed key
const feed = "temperature"
const username = await readSetting("IO_USERNAME")
// this secret is stored in the .env.local and uploaded to the device settings
const password = await readSetting("IO_KEY")

const mqtt = await startMQTTClient({
host: `io.adafruit.com`,
proto: "tls",
port: 8883,
username,
password,
})
// https://io.adafruit.com/api/docs/mqtt.html#feed-topic-format
const topic = `${username}/feeds/${feed}/json`

schedule(
async () => {
// read data from temperature sensor
const value = await temperature.reading.read()
// publish to feed topic
await mqtt.publish(topic, { value })
},
{ timeout: 1000, interval: 60000 }
)

Extra points: Filtering data

You could use observables to smooth the sensor +data. For example, apply an exponentially moving average +on the feed of temperature readings.

import { ewma, auditTime } from "@devicescript/observables"
...
temperature.reading
.pipe(ewma(0.5), auditTime(60000))
.subscribe(async value => await mqtt.publish(topic, { value }))
+ + + + \ No newline at end of file diff --git a/samples/thermostat-gateway.html b/samples/thermostat-gateway.html new file mode 100644 index 00000000000..2efaf78a648 --- /dev/null +++ b/samples/thermostat-gateway.html @@ -0,0 +1,25 @@ + + + + + +Thermostat + Gateway | DeviceScript + + + + + + + + +
+

Thermostat + Gateway

The Thermostat sample showed how to implement a thermostat controller +using local data. This part 2 of the sample shows how to connect the device to a cloud gateway and configure +the desired temperature from the cloud.

Development Gateway

Start by setting up a Development Gateway and connecting the ESP to it.

Telemetry

Just like any web or desktop app, a DeviceScript app can be instrumented with telemetry to get insights into +how it is behaving.

For example, we instrument the code to notify the cloud whenever the relay is enabled or disabled.

import { pins } from "@dsboard/adafruit_qt_py_c3"
import { Temperature } from "@devicescript/core"
import { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"
import { startRelay } from "@devicescript/servers"
import { trackEvent } from "@devicescript/cloud"

const thermometer = new Temperature()
const t_ref = 68 // degree F
const relay = startRelay({
pin: pins.A0_D0,
})

thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000),
tap(t_audit => console.data({ t_audit })),
levelDetector(t_ref - 1, t_ref + 1),
tap(level => console.data({ level }))
)
.subscribe(async level => {
const enabled = await relay.enabled.read()
const newEnabled = level < 0 ? true : level > 0 ? false : enabled
await relay.enabled.write(newEnabled)
if (enabled !== newEnabled)
await trackEvent("relay.change", {
properties: { active: newEnabled ? "on" : "off" },
})
})

Environment variables

If you connect the ESP to the Development Gateway, +you can use environment variables configured in the cloud rather constants in the code.

The environment function from @devicescript/cloud downloads and caches the environment variables from the cloud.

import { pins } from "@dsboard/adafruit_qt_py_c3"
import { Temperature } from "@devicescript/core"
import { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"
import { startRelay } from "@devicescript/servers"
import { environment } from "@devicescript/cloud"

const thermometer = new Temperature()
const relay = startRelay({
pin: pins.A0_D0,
})
const env = await environment<{ t_ref: number }>({ t_ref: 68 })
const { t_ref } = await env.read()

thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000),
tap(t_audit => console.data({ t_audit })),
levelDetector(t_ref - 1, t_ref + 1),
tap(level => console.data({ level }))
)
.subscribe(async level => {
if (level < 0) await relay.enabled.write(true)
else if (level > 0) await relay.enabled.write(false)
console.data({ relay: await relay.enabled.read() })
})

Environment updates

The environment variables can be updated in the cloud at any time. +We can track the changes and update the relay accordingly.

import { pins } from "@dsboard/adafruit_qt_py_c3"
import { Temperature } from "@devicescript/core"
import {
ewma,
tap,
auditTime,
levelDetector,
Subscription,
} from "@devicescript/observables"
import { startRelay } from "@devicescript/servers"
import { environment } from "@devicescript/cloud"

const thermometer = new ds.Temperature()
const relay = startRelay({
pin: pins.A0_D0,
})
const env = await environment<{ t_ref: number }>({ t_ref: 68 })
let sub: Subscription
const controlTemperature = async () => {
// cleanup previous loop
if (sub) sub.unsubscribe()

// start new control loop
const { t_ref } = await env.read()
sub = thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000),
tap(t_audit => console.data({ t_audit })),
levelDetector(t_ref - 1, t_ref + 1),
tap(level => console.data({ level }))
)
.subscribe(async level => {
if (level < 0) await relay.enabled.write(true)
else if (level > 0) await relay.enabled.write(false)
console.data({ relay: await relay.enabled.read() })
})
}

// hightline-next-line
env.subscribe(controlTemperature)
await controlTemperature()
+ + + + \ No newline at end of file diff --git a/samples/thermostat.html b/samples/thermostat.html new file mode 100644 index 00000000000..5ee60634af1 --- /dev/null +++ b/samples/thermostat.html @@ -0,0 +1,31 @@ + + + + + +Thermostat | DeviceScript + + + + + + + + +
+

Thermostat

A rudimentary thermostat controller that uses a +temperature sensor to decide when to turn on or off a furnace controlled by a relay.

Logging sensor data

Let's start by mounting a temperature service client +and logging each sensor reading to the console (using console.data).

import { Temperature } from "@devicescript/core"

const thermometer = new Temperature()
thermometer.reading.subscribe(t => {
console.data({ t })
})

In Visual Studio Code, you can run this program with a simulated device and sensor and collect virtual data. +Click on the Download Data icon in the DeviceScript view, you can analyze the data in a notebook.

This approach works for a basic scenario but we lack the control over when data arrives, how it is filtered +and at which rate. +This is where observables come into play.

Add observables

Add this import to your main.ts file (the @devicescript/observables is builtin).

import "@devicescript/observables"

Filtering

Observables provide a way to add operators over streams of data. A register like temperature is like +a stream of readings and we'll use operators to manipulate them.

We start with the ewma operator, which applies a exponentially weighted moving average filter to the data.

import { Temperature } from "@devicescript/core"
import { ewma } from "@devicescript/observables"

const thermometer = new Temperature()
thermometer.reading
.pipe(ewma(0.9))
.subscribe(t => console.data({ t }))

Tapping

import { Temperature } from "@devicescript/core"
import { ewma, tap } from "@devicescript/observables"

const thermometer = new Temperature()
thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9)
)
.subscribe(t => console.data({ t }))

Throttling

Although the sensor may produce a high frequency of data locally, we probably want to +throttle the output to a slower pace when deciding to control the relay. +This can be done through throttleTime (stream first value and wait) or auditTime (wait then stream last value).

import { Temperature } from "@devicescript/core"
import { ewma, tap, auditTime } from "@devicescript/observables"

const thermometer = new Temperature()
thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000) // once every 5 seconds
)
.subscribe(t => console.data({ t }))

Level detector

The next step is to categorize the current temperature in 3 zones, or levels: low, mid, high. +In the low zone, the relay should be turn on to heat the room. In the high zone, the relay should be turned off. +In the mid zone, the relay should not be actuated to avoid switching at the boundary of the levels.

import { Temperature } from "@devicescript/core"
import { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"

const thermometer = new Temperature()
const t_ref = 68 // degree F

thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000), // once every 5 seconds
tap(t_audit => console.data({ t_audit })),
levelDetector(t_ref - 1, t_ref + 1), // -1 = low, 0 = mid, 1 = high
tap(level => console.data({ level }))
)
.subscribe(level => console.data({ level }))

Relay

import { Temperature, Relay } from "@devicescript/core"
import { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"

const thermometer = new Temperature()
const t_ref = 68 // degree F
const relay = new Relay()

thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000),
tap(t_audit => console.data({ t_audit })),
levelDetector(t_ref - 1, t_ref + 1),
tap(level => console.data({ level }))
)
.subscribe(async level => {
if (level < 0) await relay.enabled.write(true)
else if (level > 0) await relay.enabled.write(false)
console.data({ relay: await relay.enabled.read() })
})

Relay on ESP32

Using a ESP32 board and a relay on pin A0, we can +finalize this example.

import { pins } from "@dsboard/adafruit_qt_py_c3"
import { Temperature } from "@devicescript/core"
import { ewma, tap, auditTime, levelDetector } from "@devicescript/observables"
import { startRelay } from "@devicescript/servers"

const thermometer = new Temperature()
const t_ref = 68 // degree F
const relay = startRelay({
pin: pins.A0_D0,
})

thermometer.reading
.pipe(
tap(t_raw => console.data({ t_raw })),
ewma(0.9),
tap(t_ewma => console.data({ t_ewma })),
auditTime(5000),
tap(t_audit => console.data({ t_audit })),
levelDetector(t_ref - 1, t_ref + 1),
tap(level => console.data({ level }))
)
.subscribe(async level => {
if (level < 0) await relay.enabled.write(true)
else if (level > 0) await relay.enabled.write(false)
console.data({ relay: await relay.enabled.read() })
})
+ + + + \ No newline at end of file diff --git a/samples/weather-dashboard.html b/samples/weather-dashboard.html new file mode 100644 index 00000000000..594ebd9d1e8 --- /dev/null +++ b/samples/weather-dashboard.html @@ -0,0 +1,23 @@ + + + + + +Weather Dashboard | DeviceScript + + + + + + + + +
+

Weather Dashboard

This sample uses a ValueDashboard to render temperature, humidity readings +on a character screen. A character screen could be a LCD screen or a OLED/TFT display.

The ValueDashboard is a helper class that renders the value. It is generic +and takes the list of data row to display in the constructor to provide a better +completion experience.

import { CharacterScreen } from "@devicescript/core"
import { ValueDashboard } from "@devicescript/runtime"

const screen = new CharacterScreen()
const dashboard = new ValueDashboard(screen, {
temperature: { digits: 1, unit: "C" },
humi: { digits: 0, unit: "%" },
})

Once the dashboard is setup, you can update the values record and call show to render again.

import { CharacterScreen, Humidity, Temperature } from "@devicescript/core"
import { ValueDashboard } from "@devicescript/runtime"

const temperature = new Temperature()
const humidity = new Humidity()
const screen = new CharacterScreen()
const dashboard = new ValueDashboard(screen, {
temperature: { digits: 1, unit: "C" },
humi: { digits: 0, unit: "%" },
})
setInterval(async () => {
dashboard.values.temperature = await temperature.reading.read()
dashboard.values.humi = await humidity.reading.read()
await dashboard.show()
}, 1000)

Xiao + Expansion board + BME680

The generic sample above can be specialized to run on a Xiao ESP32-C3 with expansion board.

import {
XiaoExpansionBoard,
startCharacterScreen,
startBME680,
} from "@devicescript/drivers"
import { ValueDashboard } from "@devicescript/runtime"

const board = new XiaoExpansionBoard()
const { temperature, humidity } = await startBME680({
address: 0x76
})
const display = await board.startDisplay()
const screen = await startCharacterScreen(display)

const dashboard = new ValueDashboard(screen, {
temperature: { digits: 1, unit: "C" },
humi: { digits: 0, unit: "%" },
})

setInterval(async () => {
dashboard.values.temperature = await temperature.reading.read()
dashboard.values.humi = await humidity.reading.read()
await dashboard.show()
}, 1000)
+ + + + \ No newline at end of file diff --git a/samples/weather-display.html b/samples/weather-display.html new file mode 100644 index 00000000000..20b85891eb4 --- /dev/null +++ b/samples/weather-display.html @@ -0,0 +1,22 @@ + + + + + +Weather Display | DeviceScript + + + + + + + + +
+

Weather Display

A simple weather display that gets new values every 5 seconds from a temperature and humidity sensor and displays them in a character display with a ascii symbol based on the humidity.

Configuring the hardware

Make sure to configure your program for your +hardware board so that the I2C pins are configured correctly.

Logging sensor data

Let's start by mounting a sensor client and logging each sensor reading to the display using several functions.

import { startSHT30 } from "@devicescript/drivers"
import { SSD1306Driver, startCharacterScreen } from "@devicescript/drivers"

const screen = await startCharacterScreen(
new SSD1306Driver({ width: 128, height: 64 })
)
const { temperature, humidity } = await startSHT30()

async function displayText(text: string, weatherCondition: string) {
const weatherIcon = getWeatherIcon(weatherCondition)

await screen.message.write(`${text}\n${weatherIcon}`)
}

async function readSensorData() {
// Assume weather condition is determined based on humidity level
const weatherCondition =
(await humidity.reading.read()) >= 70 ? "Rain" : "Sunny"

// get values from sensor
const displayValueTemperature = await temperature.reading.read()
const displayValueHumidity = await humidity.reading.read()

const temperatureString = `Temperature: ${displayValueTemperature}°C`
const humidityString = `Humidity: ${displayValueHumidity}%`
const text = `${temperatureString}\n${humidityString}`

await displayText(text, weatherCondition)
}

// Function to get an ascii weather icon based on the weather condition
function getWeatherIcon(weatherCondition: string) {
switch (weatherCondition) {
case "Rain":
return `
.-. .-.
( ) RAIN ( )
(___) (___)
''' '''
` // Use backticks to preserve multiline string formatting
case "Sunny":
return `
\\ | /
.-.
--( )-- SUNNY
'-'
`
default:
return ""
}
}

// Read sensor data every 5 seconds
setInterval(async () => {
await readSensorData()
}, 5000)

Example Photo using Devicescript simulator

See also

The value dashboard simplifies the display of sensor data +on a character screen.

+ + + + \ No newline at end of file diff --git a/samples/workshop.html b/samples/workshop.html new file mode 100644 index 00000000000..f96f3ad0b96 --- /dev/null +++ b/samples/workshop.html @@ -0,0 +1,27 @@ + + + + + +Workshop | DeviceScript + + + + + + + + +
+

Workshop

Leverage your TypeScript skills to program electronics using DeviceScript.

Time Estimate

2.0 hours

Overview

This project will introduce participants to DeviceScript, a TypeScript programming environment for small electronics, including sensing and interacting with the physical environment using a common microcontroller - ESP32-C3.

  • Participants will program a microcontroller to retrieve data readings from the sensor and then act upon that data.
  • Participants will use fetch to call a Web API (GitHub build status) and update an LED based on the result.

Who are You?

The ideal participant is someone who is familiar with TypeScript (front-end or back-end). Experience with electronics is not required.

Activity Outcome

Participants should have a device programmed with DeviceScript that can detect moisture levels in their plant soil, +show some light animation on a LED display. Update the LED display based on the build status of their favorite GitHub repository.

Participants will have learned to:

  • Connect sensors to read the phyiscal environment (BME680)
  • Control the physical environment by playing sounds on buzzer, animating LEDs
  • Deploy DeviceScript scripts to hardware device
  • Issue Web HTTP requests

Required Materials

These items are required.

ImageItemUrl
Xiao ESP32C3 on custom PCBXiao ESP32C3 + Breakout broardhttps://microsoft.github.io/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218
BME680 sensorBME680 sensorhttps://www.seeedstudio.com/Grove-Temperature-Humidity-Pressure-and-Gas-Sensor-for-Arduino-BME680.html?queryID=3a720270a67b60e6bdac9638b0b9e5f0&objectID=100&indexName=bazaar_retailer_products
Buzzer grove moduleBuzzerhttps://www.seeedstudio.com/Grove-Buzzer.html?queryID=fd5ea919ecbc76ef7f1e4210879a99fd&objectID=1805&indexName=bazaar_retailer_products
Grove cablesGrove cableshttps://www.seeedstudio.com/Grove-Universal-4-Pin-Buckled-20cm-Cable-5-PCs-pack.html?queryID=f4ec2714afc36affeef7955392573644&objectID=1693&indexName=bazaar_retailer_products
USB-C cableUSB-C cableshttps://www.seeedstudio.com/USB-3-1-Type-C-to-A-Cable-1-Meter-3-1A-p-4085.html?queryID=6bd7ee107594c139732c712ddb72eca0&objectID=4085&indexName=bazaar_retailer_products

Prerequisites: 

This workshop does not require experience with programming or electronics. However to make the most of the time, experience with TypeScript is helpful.

Setup

DeviceScript is tested on Windows and MacOS. Results may vary in other environment, depending of the support of serialport. The programming can be done from containers (GitHub Codespaces, docker, WSL2) but access to Serial/USB typically requires to run on the host OS.

Getting started

  • Open VS Code
  • Make sure that the DeviceScript extension is installed
  • Open the command palette and run the DeviceScript: Create new Project... command.

image

  • Once the project is created, reopen the project in VSCode

image

Part 1: Programming with simulators

Before we start working wiith hardware, we can start programming and debugging embedded application using simulators, both for the main board and the sensors.

  • edit src/main.ts to contain:
import { Buzzer } from "@devicescript/core"

const buzzer = new Buzzer()
setInterval(async () => {
// update the frequency, volume and duration to your taste
await buzzer.playNote(440, 0.5, 50)
}, 1000)
  • click on Play button on the editor menu in the top-right corner +Play button
  • in the simulator pane click auto-start to start the buzzer simulator +Auto-start button
  • enable sound on the simulator
  • enjoy the music!

More tutorials

  • Follow the Blinky to get used to the DeviceScript interface
  • Follow the Thermostat to get used to handle sensor data

Part 2: Configuring the Hardware

Now that we have a simple program working on simulator, it is time to specialize it for the available sensor and test it out on hardware.

Let's start by making sure the DeviceScript firmware is updated.

  • Connect the BME680 sensor to the Qwic connector
  • Connect the Buzzer to the Grove connector A0
  • Connect Xiao board to your computer using the USB-C cable
  • Make sure the Python extension is installed, along with a Python runtime
  • Open the DeviceScript view and click on the plug to connect to your Xiao.

image

  • Select Flash Firmware...
  • Scroll down and select Seeed Studio XIAO ESP32C3 with MSR218 base

image

Once the flashing process is over,

  • Open the DeviceScript view and click on the plug to connect to your Xiao.
  • Select Serial

Alt text

  • Your device should be appearing in the device explorer!

Alt text

Part 4: Sensors

  • Open main.ts and click on the magic wand icon in the file menu.

Alt text

The wizard will add an import that contains the pin mapping for the Xiao and search for startBME680. Repeat the operation for startBuzzer

import { pins, board } from "@dsboard/seeed_xiao_esp32c3_msr218"
import { startBME680 } from "@devicescript/drivers"
import { startBuzzer } from "@devicescript/servers"

const { temperature, humidity, pressure, airQualityIndex } = await startBME680()
const buzzer = startBuzzer({
pin: pins.A0,
})

Part 5: Funny humidity meter

Here is a tiny toy example that puts everything together. +It buzzes and turns the LEDs red if the humidity gets too high. In the simulator, drag the slider +or blow on the BME680 sensor to test it out.

If you want to use simulator, disconnect the hardware and restart.

import { pins, board } from "@dsboard/seeed_xiao_esp32c3_msr218"
import { startBME680 } from "@devicescript/drivers"
import { startBuzzer } from "@devicescript/servers"
import { setStatusLight } from "@devicescript/runtime"

const { temperature, humidity, pressure, airQualityIndex } = await startBME680()
const buzzer = startBuzzer({
pin: pins.A0,
})

setInterval(async () => {
// read humidity sensor data
// improvements: what about filtering?
const h = await humidity.reading.read()
// if humidity goes above threshold (80%)
const humidityThreshold = 80
if (h > humidityThreshold) {
// buzz and turn the board LED red
await buzzer.playNote(440, 0.5, 500)
await setStatusLight(0xff0000)
} else {
// otherwise turn the LED off
await setStatusLight(0)
}
}, 1000)

Part 6: Connect to Wifi

Enter the Wifi connection information through the explorer,

  • expand the wifi node in the device explorer
  • hover on the access point and click the plug button
  • enter the access point password

DeviceScript should use the Access Point when detected.

Microsoft Campus Device Registration

You need to register the XIAO MAC address in order for it to connect to the MSFTGUEST network.

  • in the Devices tree, find the WiFi MAC field value and copy it.

Alt text

  • navigate to https://aka.ms/getconnected , click Quick Registration - Wireless, Guest Account (MSFTGUEST), and register your device MAC address

Alt text

  • find MSFTGUEST in the list of APs, click the plug icon and press Enter to leave the password empty.

Part 7: Settings and secrets

In this section, we'll add a GET call to the GitHub repository status API and use it to change the LED color.

First thing first, we'll add .env files to the project to store the github configuration and secret token.

  • Click on the wand icon on the file menu
  • Select Add Device Settings...

Update .env.defaults with the public settings (checked in)

# .env.defaults = public settings
GITHUB_OWNER=microsoft
GITHUB_REPO=devicescript
GITHUB_REF=main

Secrets are stored in the ./env.local file. This file is not part of the source code and should not be committed to a repository. +The GitHub token needs repo:status scope (and no more). You can create a token in the GitHub settings.

# .env.local = secrets, do not commit
GITHUB_TOKEN=...
import { readSetting } from "@devicescript/settings"

// read configuration from ./env.defaults
const owner = await readSetting("GITHUB_OWNER")
const repo = await readSetting("GITHUB_REPO")
const ref = await readSetting("GITHUB_REF", "main")
// read secret from ./env.local
const token = await readSetting("GITHUB_TOKEN")

console.log({ owner, repo, ref })

Part 8: Fetching GitHub Build Status

DeviceScript provides a Fetch API similar to the browser fetch. You can use it to issue web requests.

This snippet makes the query to github and updates the status. +Feel free to remix it to integrate it into your current application

import { readSetting } from "@devicescript/settings"
import { fetch } from "@devicescript/net"
import { setStatusLight, schedule } from "@devicescript/runtime"

// read configuration from ./env.defaults
const owner = await readSetting("GITHUB_OWNER")
const repo = await readSetting("GITHUB_REPO")
// read ref or default to 'main'
const ref = await readSetting("GITHUB_REF", "main")
// read secret from ./env.local
const token = await readSetting("GITHUB_TOKEN", "")

if (!owner || !repo) throw new Error("missing configuration")

// track state of last fetch
let state: "failure" | "pending" | "success" | "error" | "" = ""
let blinki = 0

// update status light
setInterval(async () => {
blinki++
let c = 0x000000
if (state === "failure")
c = blinki % 2 === 0 ? 0x100000 : 0x000000 // blink fast red
else if (state === "pending")
c = (blinki >> 1) % 2 === 0 ? 0x100500 : 0x000000 // blink slow orange
else if (state === "success") c = 0x000a00 // solid green
else c = 0x000000 // dark if any error
await setStatusLight(c)
}, 500)

// query github every 5s
schedule(
async () => {
const res = await fetch(
`https://api.github.com/repos/${owner}/${repo}/commits/${ref}/status`,
{
headers: {
Accept: "application/vnd.github+json",
Authorization: token ? `Bearer ${token}` : undefined,
"X-GitHub-Api-Version": "2022-11-28",
},
}
)
if (res.status === 200) {
const json = await res.json()
state = json.state
console.log({ json, state })
} else state = "error"
},
{ timeout: 1000, interval: 5000 }
)

Memory is limited! Be careful about using Web APIs that return huge payloads as you will surely run out of memory...

+ + + + \ No newline at end of file diff --git a/search.html b/search.html new file mode 100644 index 00000000000..f41ebc89924 --- /dev/null +++ b/search.html @@ -0,0 +1,20 @@ + + + + + +Search the documentation | DeviceScript + + + + + + + + +
+

Search the documentation

+ + + + \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 00000000000..c5c69677932 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1 @@ +https://microsoft.github.io/devicescript/searchweekly0.5https://microsoft.github.io/devicescript/weekly0.5https://microsoft.github.io/devicescript/api/cliweekly0.5https://microsoft.github.io/devicescript/api/clientsweekly0.5https://microsoft.github.io/devicescript/api/clients/accelerometerweekly0.5https://microsoft.github.io/devicescript/api/clients/acidityweekly0.5https://microsoft.github.io/devicescript/api/clients/airpressureweekly0.5https://microsoft.github.io/devicescript/api/clients/airqualityindexweekly0.5https://microsoft.github.io/devicescript/api/clients/arcadegamepadweekly0.5https://microsoft.github.io/devicescript/api/clients/arcadesoundweekly0.5https://microsoft.github.io/devicescript/api/clients/barcodereaderweekly0.5https://microsoft.github.io/devicescript/api/clients/bitradioweekly0.5https://microsoft.github.io/devicescript/api/clients/bootloaderweekly0.5https://microsoft.github.io/devicescript/api/clients/brailledisplayweekly0.5https://microsoft.github.io/devicescript/api/clients/bridgeweekly0.5https://microsoft.github.io/devicescript/api/clients/buttonweekly0.5https://microsoft.github.io/devicescript/api/clients/buzzerweekly0.5https://microsoft.github.io/devicescript/api/clients/capacitivebuttonweekly0.5https://microsoft.github.io/devicescript/api/clients/characterscreenweekly0.5https://microsoft.github.io/devicescript/api/clients/cloudadapterweekly0.5https://microsoft.github.io/devicescript/api/clients/cloudconfigurationweekly0.5https://microsoft.github.io/devicescript/api/clients/codalmessagebusweekly0.5https://microsoft.github.io/devicescript/api/clients/colorweekly0.5https://microsoft.github.io/devicescript/api/clients/compassweekly0.5https://microsoft.github.io/devicescript/api/clients/controlweekly0.5https://microsoft.github.io/devicescript/api/clients/dashboardweekly0.5https://microsoft.github.io/devicescript/api/clients/dccurrentmeasurementweekly0.5https://microsoft.github.io/devicescript/api/clients/dcvoltagemeasurementweekly0.5https://microsoft.github.io/devicescript/api/clients/devicescriptconditionweekly0.5https://microsoft.github.io/devicescript/api/clients/devicescriptdebuggerweekly0.5https://microsoft.github.io/devicescript/api/clients/devicescriptmanagerweekly0.5https://microsoft.github.io/devicescript/api/clients/distanceweekly0.5https://microsoft.github.io/devicescript/api/clients/dmxweekly0.5https://microsoft.github.io/devicescript/api/clients/dotmatrixweekly0.5https://microsoft.github.io/devicescript/api/clients/dualmotorsweekly0.5https://microsoft.github.io/devicescript/api/clients/eco2weekly0.5https://microsoft.github.io/devicescript/api/clients/flexweekly0.5https://microsoft.github.io/devicescript/api/clients/gamepadweekly0.5https://microsoft.github.io/devicescript/api/clients/gpioweekly0.5https://microsoft.github.io/devicescript/api/clients/gyroscopeweekly0.5https://microsoft.github.io/devicescript/api/clients/heartrateweekly0.5https://microsoft.github.io/devicescript/api/clients/hidjoystickweekly0.5https://microsoft.github.io/devicescript/api/clients/hidkeyboardweekly0.5https://microsoft.github.io/devicescript/api/clients/hidmouseweekly0.5https://microsoft.github.io/devicescript/api/clients/humidityweekly0.5https://microsoft.github.io/devicescript/api/clients/i2cweekly0.5https://microsoft.github.io/devicescript/api/clients/illuminanceweekly0.5https://microsoft.github.io/devicescript/api/clients/indexedscreenweekly0.5https://microsoft.github.io/devicescript/api/clients/infrastructureweekly0.5https://microsoft.github.io/devicescript/api/clients/ledweekly0.5https://microsoft.github.io/devicescript/api/clients/ledsingleweekly0.5https://microsoft.github.io/devicescript/api/clients/ledstripweekly0.5https://microsoft.github.io/devicescript/api/clients/lightbulbweekly0.5https://microsoft.github.io/devicescript/api/clients/lightlevelweekly0.5https://microsoft.github.io/devicescript/api/clients/loggerweekly0.5https://microsoft.github.io/devicescript/api/clients/magneticfieldlevelweekly0.5https://microsoft.github.io/devicescript/api/clients/magnetomerweekly0.5https://microsoft.github.io/devicescript/api/clients/matrixkeypadweekly0.5https://microsoft.github.io/devicescript/api/clients/microphoneweekly0.5https://microsoft.github.io/devicescript/api/clients/midioutputweekly0.5https://microsoft.github.io/devicescript/api/clients/modelrunnerweekly0.5https://microsoft.github.io/devicescript/api/clients/motionweekly0.5https://microsoft.github.io/devicescript/api/clients/motorweekly0.5https://microsoft.github.io/devicescript/api/clients/multitouchweekly0.5https://microsoft.github.io/devicescript/api/clients/planarpositionweekly0.5https://microsoft.github.io/devicescript/api/clients/potentiometerweekly0.5https://microsoft.github.io/devicescript/api/clients/powerweekly0.5https://microsoft.github.io/devicescript/api/clients/powersupplyweekly0.5https://microsoft.github.io/devicescript/api/clients/pressurebuttonweekly0.5https://microsoft.github.io/devicescript/api/clients/prototestweekly0.5https://microsoft.github.io/devicescript/api/clients/proxyweekly0.5https://microsoft.github.io/devicescript/api/clients/pulseoximeterweekly0.5https://microsoft.github.io/devicescript/api/clients/raingaugeweekly0.5https://microsoft.github.io/devicescript/api/clients/realtimeclockweekly0.5https://microsoft.github.io/devicescript/api/clients/reflectedlightweekly0.5https://microsoft.github.io/devicescript/api/clients/relayweekly0.5https://microsoft.github.io/devicescript/api/clients/rngweekly0.5https://microsoft.github.io/devicescript/api/clients/rolemanagerweekly0.5https://microsoft.github.io/devicescript/api/clients/rosweekly0.5https://microsoft.github.io/devicescript/api/clients/rotaryencoderweekly0.5https://microsoft.github.io/devicescript/api/clients/roverweekly0.5https://microsoft.github.io/devicescript/api/clients/satelittenavigationsystemweekly0.5https://microsoft.github.io/devicescript/api/clients/sensoraggregatorweekly0.5https://microsoft.github.io/devicescript/api/clients/serialweekly0.5https://microsoft.github.io/devicescript/api/clients/servoweekly0.5https://microsoft.github.io/devicescript/api/clients/settingsweekly0.5https://microsoft.github.io/devicescript/api/clients/sevensegmentdisplayweekly0.5https://microsoft.github.io/devicescript/api/clients/soilmoistureweekly0.5https://microsoft.github.io/devicescript/api/clients/solenoidweekly0.5https://microsoft.github.io/devicescript/api/clients/soundlevelweekly0.5https://microsoft.github.io/devicescript/api/clients/soundplayerweekly0.5https://microsoft.github.io/devicescript/api/clients/soundrecorderwithplaybackweekly0.5https://microsoft.github.io/devicescript/api/clients/soundspectrumweekly0.5https://microsoft.github.io/devicescript/api/clients/speechsynthesisweekly0.5https://microsoft.github.io/devicescript/api/clients/switchweekly0.5https://microsoft.github.io/devicescript/api/clients/tcpweekly0.5https://microsoft.github.io/devicescript/api/clients/temperatureweekly0.5https://microsoft.github.io/devicescript/api/clients/timeseriesaggregatorweekly0.5https://microsoft.github.io/devicescript/api/clients/trafficlightweekly0.5https://microsoft.github.io/devicescript/api/clients/tvocweekly0.5https://microsoft.github.io/devicescript/api/clients/uniquebrainweekly0.5https://microsoft.github.io/devicescript/api/clients/usbbridgeweekly0.5https://microsoft.github.io/devicescript/api/clients/uvindexweekly0.5https://microsoft.github.io/devicescript/api/clients/verifiedtelemetrysensorweekly0.5https://microsoft.github.io/devicescript/api/clients/vibrationmotorweekly0.5https://microsoft.github.io/devicescript/api/clients/waterlevelweekly0.5https://microsoft.github.io/devicescript/api/clients/weightscaleweekly0.5https://microsoft.github.io/devicescript/api/clients/wifiweekly0.5https://microsoft.github.io/devicescript/api/clients/winddirectionweekly0.5https://microsoft.github.io/devicescript/api/clients/windspeedweekly0.5https://microsoft.github.io/devicescript/api/clients/wsskweekly0.5https://microsoft.github.io/devicescript/api/coreweekly0.5https://microsoft.github.io/devicescript/api/core/buffersweekly0.5https://microsoft.github.io/devicescript/api/core/commandsweekly0.5https://microsoft.github.io/devicescript/api/core/eventsweekly0.5https://microsoft.github.io/devicescript/api/core/registersweekly0.5https://microsoft.github.io/devicescript/api/core/rolesweekly0.5https://microsoft.github.io/devicescript/api/driversweekly0.5https://microsoft.github.io/devicescript/api/drivers/accelerometerweekly0.5https://microsoft.github.io/devicescript/api/drivers/aht20weekly0.5https://microsoft.github.io/devicescript/api/drivers/bme680weekly0.5https://microsoft.github.io/devicescript/api/drivers/buttonweekly0.5https://microsoft.github.io/devicescript/api/drivers/buzzerweekly0.5https://microsoft.github.io/devicescript/api/drivers/hallweekly0.5https://microsoft.github.io/devicescript/api/drivers/hidjoystickweekly0.5https://microsoft.github.io/devicescript/api/drivers/hidkeyboardweekly0.5https://microsoft.github.io/devicescript/api/drivers/hidmouseweekly0.5https://microsoft.github.io/devicescript/api/drivers/lightbulbweekly0.5https://microsoft.github.io/devicescript/api/drivers/lightlevelweekly0.5https://microsoft.github.io/devicescript/api/drivers/ltr390weekly0.5https://microsoft.github.io/devicescript/api/drivers/motionweekly0.5https://microsoft.github.io/devicescript/api/drivers/potentiometerweekly0.5https://microsoft.github.io/devicescript/api/drivers/powerweekly0.5https://microsoft.github.io/devicescript/api/drivers/reflectedlightweekly0.5https://microsoft.github.io/devicescript/api/drivers/relayweekly0.5https://microsoft.github.io/devicescript/api/drivers/rotaryencoderweekly0.5https://microsoft.github.io/devicescript/api/drivers/servoweekly0.5https://microsoft.github.io/devicescript/api/drivers/sht30weekly0.5https://microsoft.github.io/devicescript/api/drivers/shtc3weekly0.5https://microsoft.github.io/devicescript/api/drivers/soilmoistureweekly0.5https://microsoft.github.io/devicescript/api/drivers/soundlevelweekly0.5https://microsoft.github.io/devicescript/api/drivers/ssd1306weekly0.5https://microsoft.github.io/devicescript/api/drivers/st7789weekly0.5https://microsoft.github.io/devicescript/api/drivers/switchweekly0.5https://microsoft.github.io/devicescript/api/drivers/trafficlightweekly0.5https://microsoft.github.io/devicescript/api/drivers/uc8151weekly0.5https://microsoft.github.io/devicescript/api/drivers/waterlevelweekly0.5https://microsoft.github.io/devicescript/api/mathweekly0.5https://microsoft.github.io/devicescript/api/observablesweekly0.5https://microsoft.github.io/devicescript/api/observables/creationweekly0.5https://microsoft.github.io/devicescript/api/observables/dspweekly0.5https://microsoft.github.io/devicescript/api/observables/filterweekly0.5https://microsoft.github.io/devicescript/api/observables/transformweekly0.5https://microsoft.github.io/devicescript/api/observables/utilsweekly0.5https://microsoft.github.io/devicescript/api/runtimeweekly0.5https://microsoft.github.io/devicescript/api/runtime/paletteweekly0.5https://microsoft.github.io/devicescript/api/runtime/pixelbufferweekly0.5https://microsoft.github.io/devicescript/api/runtime/scheduleweekly0.5https://microsoft.github.io/devicescript/api/settingsweekly0.5https://microsoft.github.io/devicescript/api/spiweekly0.5https://microsoft.github.io/devicescript/api/testweekly0.5https://microsoft.github.io/devicescript/api/vmweekly0.5https://microsoft.github.io/devicescript/changelogweekly0.5https://microsoft.github.io/devicescript/contributingweekly0.5https://microsoft.github.io/devicescript/developerweekly0.5https://microsoft.github.io/devicescript/developer/board-configurationweekly0.5https://microsoft.github.io/devicescript/developer/bundleweekly0.5https://microsoft.github.io/devicescript/developer/clientsweekly0.5https://microsoft.github.io/devicescript/developer/commandsweekly0.5https://microsoft.github.io/devicescript/developer/consoleweekly0.5https://microsoft.github.io/devicescript/developer/cryptoweekly0.5https://microsoft.github.io/devicescript/developer/development-gatewayweekly0.5https://microsoft.github.io/devicescript/developer/development-gateway/configurationweekly0.5https://microsoft.github.io/devicescript/developer/development-gateway/environmentweekly0.5https://microsoft.github.io/devicescript/developer/development-gateway/gatewayweekly0.5https://microsoft.github.io/devicescript/developer/development-gateway/messagesweekly0.5https://microsoft.github.io/devicescript/developer/development-gateway/telemetryweekly0.5https://microsoft.github.io/devicescript/developer/driversweekly0.5https://microsoft.github.io/devicescript/developer/drivers/analogweekly0.5https://microsoft.github.io/devicescript/developer/drivers/custom-servicesweekly0.5https://microsoft.github.io/devicescript/developer/drivers/digital-ioweekly0.5https://microsoft.github.io/devicescript/developer/drivers/digital-io/wireweekly0.5https://microsoft.github.io/devicescript/developer/drivers/i2cweekly0.5https://microsoft.github.io/devicescript/developer/drivers/serialweekly0.5https://microsoft.github.io/devicescript/developer/drivers/spiweekly0.5https://microsoft.github.io/devicescript/developer/errorsweekly0.5https://microsoft.github.io/devicescript/developer/graphicsweekly0.5https://microsoft.github.io/devicescript/developer/graphics/displayweekly0.5https://microsoft.github.io/devicescript/developer/graphics/imageweekly0.5https://microsoft.github.io/devicescript/developer/iotweekly0.5https://microsoft.github.io/devicescript/developer/iot/adafruit-ioweekly0.5https://microsoft.github.io/devicescript/developer/iot/blues-ioweekly0.5https://microsoft.github.io/devicescript/developer/iot/blynk-ioweekly0.5https://microsoft.github.io/devicescript/developer/iot/matlab-thingspeakweekly0.5https://microsoft.github.io/devicescript/developer/jsonweekly0.5https://microsoft.github.io/devicescript/developer/jsxweekly0.5https://microsoft.github.io/devicescript/developer/ledsweekly0.5https://microsoft.github.io/devicescript/developer/leds/displayweekly0.5https://microsoft.github.io/devicescript/developer/leds/driverweekly0.5https://microsoft.github.io/devicescript/developer/low-powerweekly0.5https://microsoft.github.io/devicescript/developer/mcu-temperatureweekly0.5https://microsoft.github.io/devicescript/developer/netweekly0.5https://microsoft.github.io/devicescript/developer/net/encrypted-fetchweekly0.5https://microsoft.github.io/devicescript/developer/net/mqttweekly0.5https://microsoft.github.io/devicescript/developer/observablesweekly0.5https://microsoft.github.io/devicescript/developer/packagesweekly0.5https://microsoft.github.io/devicescript/developer/packages/customweekly0.5https://microsoft.github.io/devicescript/developer/registerweekly0.5https://microsoft.github.io/devicescript/developer/settingsweekly0.5https://microsoft.github.io/devicescript/developer/simulationweekly0.5https://microsoft.github.io/devicescript/developer/status-lightweekly0.5https://microsoft.github.io/devicescript/developer/testingweekly0.5https://microsoft.github.io/devicescript/devicesweekly0.5https://microsoft.github.io/devicescript/devices/add-boardweekly0.5https://microsoft.github.io/devicescript/devices/add-shieldweekly0.5https://microsoft.github.io/devicescript/devices/add-socweekly0.5https://microsoft.github.io/devicescript/devices/esp32weekly0.5https://microsoft.github.io/devicescript/devices/esp32/adafruit-feather-esp32-s2weekly0.5https://microsoft.github.io/devicescript/devices/esp32/adafruit-qt-py-c3weekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32-bareweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32-c3fh4-rgbweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32-devkit-cweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32c3-bareweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32c3-rust-devkitweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32s2-bareweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32s3-bareweekly0.5https://microsoft.github.io/devicescript/devices/esp32/esp32s3-devkit-mweekly0.5https://microsoft.github.io/devicescript/devices/esp32/feather-s2weekly0.5https://microsoft.github.io/devicescript/devices/esp32/msr207-v42weekly0.5https://microsoft.github.io/devicescript/devices/esp32/msr207-v43weekly0.5https://microsoft.github.io/devicescript/devices/esp32/msr48weekly0.5https://microsoft.github.io/devicescript/devices/esp32/seeed-xiao-esp32c3weekly0.5https://microsoft.github.io/devicescript/devices/esp32/seeed-xiao-esp32c3-msr218weekly0.5https://microsoft.github.io/devicescript/devices/rp2040weekly0.5https://microsoft.github.io/devicescript/devices/rp2040/msr124weekly0.5https://microsoft.github.io/devicescript/devices/rp2040/msr59weekly0.5https://microsoft.github.io/devicescript/devices/rp2040/picoweekly0.5https://microsoft.github.io/devicescript/devices/rp2040/pico-wweekly0.5https://microsoft.github.io/devicescript/devices/shieldsweekly0.5https://microsoft.github.io/devicescript/devices/shields/pico-bricksweekly0.5https://microsoft.github.io/devicescript/devices/shields/pimoroni-pico-badgerweekly0.5https://microsoft.github.io/devicescript/devices/shields/waveshare-pico-lcd-114weekly0.5https://microsoft.github.io/devicescript/devices/shields/xiao-expansion-boardweekly0.5https://microsoft.github.io/devicescript/getting-startedweekly0.5https://microsoft.github.io/devicescript/getting-started/cliweekly0.5https://microsoft.github.io/devicescript/getting-started/vscodeweekly0.5https://microsoft.github.io/devicescript/getting-started/vscode/debuggingweekly0.5https://microsoft.github.io/devicescript/getting-started/vscode/simulationweekly0.5https://microsoft.github.io/devicescript/getting-started/vscode/troubleshootingweekly0.5https://microsoft.github.io/devicescript/getting-started/vscode/user-interfaceweekly0.5https://microsoft.github.io/devicescript/getting-started/vscode/workspacesweekly0.5https://microsoft.github.io/devicescript/introweekly0.5https://microsoft.github.io/devicescript/languageweekly0.5https://microsoft.github.io/devicescript/language/asyncweekly0.5https://microsoft.github.io/devicescript/language/bytecodeweekly0.5https://microsoft.github.io/devicescript/language/devicescript-vs-javascriptweekly0.5https://microsoft.github.io/devicescript/language/hexweekly0.5https://microsoft.github.io/devicescript/language/runtimeweekly0.5https://microsoft.github.io/devicescript/language/specialweekly0.5https://microsoft.github.io/devicescript/language/stringsweekly0.5https://microsoft.github.io/devicescript/language/tostringweekly0.5https://microsoft.github.io/devicescript/language/tree-shakingweekly0.5https://microsoft.github.io/devicescript/samplesweekly0.5https://microsoft.github.io/devicescript/samples/blinkyweekly0.5https://microsoft.github.io/devicescript/samples/button-ledweekly0.5https://microsoft.github.io/devicescript/samples/copy-paste-buttonweekly0.5https://microsoft.github.io/devicescript/samples/dimmerweekly0.5https://microsoft.github.io/devicescript/samples/double-blinkyweekly0.5https://microsoft.github.io/devicescript/samples/github-build-statusweekly0.5https://microsoft.github.io/devicescript/samples/homebridge-humidityweekly0.5https://microsoft.github.io/devicescript/samples/schedule-blinkyweekly0.5https://microsoft.github.io/devicescript/samples/status-light-blinkyweekly0.5https://microsoft.github.io/devicescript/samples/temperature-mqttweekly0.5https://microsoft.github.io/devicescript/samples/thermostatweekly0.5https://microsoft.github.io/devicescript/samples/thermostat-gatewayweekly0.5https://microsoft.github.io/devicescript/samples/weather-dashboardweekly0.5https://microsoft.github.io/devicescript/samples/weather-displayweekly0.5https://microsoft.github.io/devicescript/samples/workshopweekly0.5 \ No newline at end of file diff --git a/test.json b/test.json new file mode 100644 index 00000000000..ce874e1e6fe --- /dev/null +++ b/test.json @@ -0,0 +1,3 @@ +{ + "data": "test" +} diff --git a/videos/blinky.jpg b/videos/blinky.jpg new file mode 100644 index 00000000000..e08307bb214 Binary files /dev/null and b/videos/blinky.jpg differ diff --git a/videos/blinky.mp4 b/videos/blinky.mp4 new file mode 100644 index 00000000000..6085da43a1e Binary files /dev/null and b/videos/blinky.mp4 differ diff --git a/videos/copy-paste-button.jpg b/videos/copy-paste-button.jpg new file mode 100644 index 00000000000..a7b0a09aa8b Binary files /dev/null and b/videos/copy-paste-button.jpg differ diff --git a/videos/copy-paste-button.mp4 b/videos/copy-paste-button.mp4 new file mode 100644 index 00000000000..d7d070bdb10 Binary files /dev/null and b/videos/copy-paste-button.mp4 differ